From aa5db684382bd8662a83ca09ed000e4a5a1013f9 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 16 Jul 2009 14:14:32 +0100 Subject: softpipe: remove backwards dependency from tilecache to softpipe The tile cache is a utility, it shouldn't know anything about the entity which is making use of it (ie softpipe). Remove softpipe parameter to all the tilecache function calls, and also remove the need to keep a softpipe pointer in the sampler structs. --- src/gallium/drivers/softpipe/sp_context.c | 8 ++---- src/gallium/drivers/softpipe/sp_flush.c | 6 ++--- src/gallium/drivers/softpipe/sp_quad_blend.c | 6 ++--- src/gallium/drivers/softpipe/sp_quad_colormask.c | 3 +-- src/gallium/drivers/softpipe/sp_quad_depth_test.c | 2 +- src/gallium/drivers/softpipe/sp_quad_output.c | 3 +-- src/gallium/drivers/softpipe/sp_quad_stencil.c | 2 +- src/gallium/drivers/softpipe/sp_state_derived.c | 22 ++++++++++++++++ src/gallium/drivers/softpipe/sp_state_sampler.c | 2 +- src/gallium/drivers/softpipe/sp_state_surface.c | 4 +-- src/gallium/drivers/softpipe/sp_tex_sample.c | 32 ++++++++--------------- src/gallium/drivers/softpipe/sp_tex_sample.h | 5 ++-- src/gallium/drivers/softpipe/sp_tile_cache.c | 20 ++++++-------- src/gallium/drivers/softpipe/sp_tile_cache.h | 12 +++------ 14 files changed, 62 insertions(+), 65 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 86df320ea8..f085889d3a 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -73,8 +73,8 @@ softpipe_unmap_transfers(struct softpipe_context *sp) uint i; for (i = 0; i < sp->framebuffer.nr_cbufs; i++) - sp_flush_tile_cache(sp, sp->cbuf_cache[i]); - sp_flush_tile_cache(sp, sp->zsbuf_cache); + sp_flush_tile_cache(sp->cbuf_cache[i]); + sp_flush_tile_cache(sp->zsbuf_cache); for (i = 0; i < sp->framebuffer.nr_cbufs; i++) { sp_tile_cache_unmap_transfers(sp->cbuf_cache[i]); @@ -254,8 +254,6 @@ softpipe_create( struct pipe_screen *screen ) /* vertex shader samplers */ for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { softpipe->tgsi.vert_samplers[i].base.get_samples = sp_get_samples_vertex; - softpipe->tgsi.vert_samplers[i].unit = i; - softpipe->tgsi.vert_samplers[i].sp = softpipe; softpipe->tgsi.vert_samplers[i].cache = softpipe->tex_cache[i]; softpipe->tgsi.vert_samplers_list[i] = &softpipe->tgsi.vert_samplers[i]; } @@ -263,8 +261,6 @@ softpipe_create( struct pipe_screen *screen ) /* fragment shader samplers */ for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { softpipe->tgsi.frag_samplers[i].base.get_samples = sp_get_samples_fragment; - softpipe->tgsi.frag_samplers[i].unit = i; - softpipe->tgsi.frag_samplers[i].sp = softpipe; softpipe->tgsi.frag_samplers[i].cache = softpipe->tex_cache[i]; softpipe->tgsi.frag_samplers_list[i] = &softpipe->tgsi.frag_samplers[i]; } diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c index 4a14d49686..732277a2c5 100644 --- a/src/gallium/drivers/softpipe/sp_flush.c +++ b/src/gallium/drivers/softpipe/sp_flush.c @@ -52,17 +52,17 @@ softpipe_flush( struct pipe_context *pipe, if (flags & PIPE_FLUSH_TEXTURE_CACHE) { for (i = 0; i < softpipe->num_textures; i++) { - sp_flush_tile_cache(softpipe, softpipe->tex_cache[i]); + sp_flush_tile_cache(softpipe->tex_cache[i]); } } if (flags & PIPE_FLUSH_RENDER_CACHE) { for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) if (softpipe->cbuf_cache[i]) - sp_flush_tile_cache(softpipe, softpipe->cbuf_cache[i]); + sp_flush_tile_cache(softpipe->cbuf_cache[i]); if (softpipe->zsbuf_cache) - sp_flush_tile_cache(softpipe, softpipe->zsbuf_cache); + sp_flush_tile_cache(softpipe->zsbuf_cache); /* Need this call for hardware buffers before swapbuffers. * diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c index b1e18805c7..04b5daf3a4 100644 --- a/src/gallium/drivers/softpipe/sp_quad_blend.c +++ b/src/gallium/drivers/softpipe/sp_quad_blend.c @@ -130,8 +130,7 @@ logicop_quad(struct quad_stage *qs, struct quad_header *quad) uint *dst4 = (uint *) dst; uint *res4 = (uint *) res; struct softpipe_cached_tile * - tile = sp_get_cached_tile(softpipe, - softpipe->cbuf_cache[cbuf], + tile = sp_get_cached_tile(softpipe->cbuf_cache[cbuf], quad->input.x0, quad->input.y0); float (*quadColor)[4] = quad->output.color[cbuf]; uint i, j; @@ -260,8 +259,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) { float source[4][QUAD_SIZE], dest[4][QUAD_SIZE]; struct softpipe_cached_tile *tile - = sp_get_cached_tile(softpipe, - softpipe->cbuf_cache[cbuf], + = sp_get_cached_tile(softpipe->cbuf_cache[cbuf], quad->input.x0, quad->input.y0); float (*quadColor)[4] = quad->output.color[cbuf]; uint i, j; diff --git a/src/gallium/drivers/softpipe/sp_quad_colormask.c b/src/gallium/drivers/softpipe/sp_quad_colormask.c index dc90e5d5e9..89efbe3b02 100644 --- a/src/gallium/drivers/softpipe/sp_quad_colormask.c +++ b/src/gallium/drivers/softpipe/sp_quad_colormask.c @@ -54,8 +54,7 @@ colormask_quad(struct quad_stage *qs, struct quad_header *quad) for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) { float dest[4][QUAD_SIZE]; struct softpipe_cached_tile *tile - = sp_get_cached_tile(softpipe, - softpipe->cbuf_cache[cbuf], + = sp_get_cached_tile(softpipe->cbuf_cache[cbuf], quad->input.x0, quad->input.y0); float (*quadColor)[4] = quad->output.color[cbuf]; uint i, j; diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c index d463930bae..768b9275b3 100644 --- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c +++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c @@ -60,7 +60,7 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad) unsigned zmask = 0; unsigned j; struct softpipe_cached_tile *tile - = sp_get_cached_tile(softpipe, softpipe->zsbuf_cache, quad->input.x0, quad->input.y0); + = sp_get_cached_tile(softpipe->zsbuf_cache, quad->input.x0, quad->input.y0); assert(ps); /* shouldn't get here if there's no zbuffer */ diff --git a/src/gallium/drivers/softpipe/sp_quad_output.c b/src/gallium/drivers/softpipe/sp_quad_output.c index 92d5f9f3c1..dd8f5377e9 100644 --- a/src/gallium/drivers/softpipe/sp_quad_output.c +++ b/src/gallium/drivers/softpipe/sp_quad_output.c @@ -50,8 +50,7 @@ output_quad(struct quad_stage *qs, struct quad_header *quad) /* loop over colorbuffer outputs */ for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) { struct softpipe_cached_tile *tile - = sp_get_cached_tile(softpipe, - softpipe->cbuf_cache[cbuf], + = sp_get_cached_tile(softpipe->cbuf_cache[cbuf], quad->input.x0, quad->input.y0); float (*quadColor)[4] = quad->output.color[cbuf]; int i, j; diff --git a/src/gallium/drivers/softpipe/sp_quad_stencil.c b/src/gallium/drivers/softpipe/sp_quad_stencil.c index 5e9d447737..34a8d9e9f6 100644 --- a/src/gallium/drivers/softpipe/sp_quad_stencil.c +++ b/src/gallium/drivers/softpipe/sp_quad_stencil.c @@ -206,7 +206,7 @@ stencil_test_quad(struct quad_stage *qs, struct quad_header *quad) ubyte ref, wrtMask, valMask; ubyte stencilVals[QUAD_SIZE]; struct softpipe_cached_tile *tile - = sp_get_cached_tile(softpipe, softpipe->zsbuf_cache, quad->input.x0, quad->input.y0); + = sp_get_cached_tile(softpipe->zsbuf_cache, quad->input.x0, quad->input.y0); uint j; uint face = quad->input.facing; diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index 75551000c9..75be99768c 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -184,11 +184,33 @@ compute_cliprect(struct softpipe_context *sp) } +static void +update_tgsi_samplers( struct softpipe_context *softpipe ) +{ + unsigned i; + + /* vertex shader samplers */ + for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { + softpipe->tgsi.vert_samplers[i].sampler = softpipe->sampler[i]; + softpipe->tgsi.vert_samplers[i].texture = softpipe->texture[i]; + } + + /* fragment shader samplers */ + for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { + softpipe->tgsi.frag_samplers[i].sampler = softpipe->sampler[i]; + softpipe->tgsi.frag_samplers[i].texture = softpipe->texture[i]; + } +} + /* Hopefully this will remain quite simple, otherwise need to pull in * something like the state tracker mechanism. */ void softpipe_update_derived( struct softpipe_context *softpipe ) { + if (softpipe->dirty & (SP_NEW_SAMPLER | + SP_NEW_TEXTURE)) + update_tgsi_samplers( softpipe ); + if (softpipe->dirty & (SP_NEW_RASTERIZER | SP_NEW_FS | SP_NEW_VS)) diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index cb517b02e4..aa2f3f2ccd 100644 --- a/src/gallium/drivers/softpipe/sp_state_sampler.c +++ b/src/gallium/drivers/softpipe/sp_state_sampler.c @@ -97,7 +97,7 @@ softpipe_set_sampler_textures(struct pipe_context *pipe, struct pipe_texture *tex = i < num ? texture[i] : NULL; pipe_texture_reference(&softpipe->texture[i], tex); - sp_tile_cache_set_texture(pipe, softpipe->tex_cache[i], tex); + sp_tile_cache_set_texture(softpipe->tex_cache[i], tex); } softpipe->num_textures = num; diff --git a/src/gallium/drivers/softpipe/sp_state_surface.c b/src/gallium/drivers/softpipe/sp_state_surface.c index 7c06d864a7..1621a27614 100644 --- a/src/gallium/drivers/softpipe/sp_state_surface.c +++ b/src/gallium/drivers/softpipe/sp_state_surface.c @@ -53,7 +53,7 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe, /* check if changing cbuf */ if (sp->framebuffer.cbufs[i] != fb->cbufs[i]) { /* flush old */ - sp_flush_tile_cache(sp, sp->cbuf_cache[i]); + sp_flush_tile_cache(sp->cbuf_cache[i]); /* assign new */ sp->framebuffer.cbufs[i] = fb->cbufs[i]; @@ -68,7 +68,7 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe, /* zbuf changing? */ if (sp->framebuffer.zsbuf != fb->zsbuf) { /* flush old */ - sp_flush_tile_cache(sp, sp->zsbuf_cache); + sp_flush_tile_cache(sp->zsbuf_cache); /* assign new */ sp->framebuffer.zsbuf = fb->zsbuf; diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index a1d3bade27..3daa88eedd 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -668,10 +668,8 @@ get_texel(const struct tgsi_sampler *tgsi_sampler, float rgba[NUM_CHANNELS][QUAD_SIZE], unsigned j) { const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); - struct softpipe_context *sp = samp->sp; - const uint unit = samp->unit; - const struct pipe_texture *texture = sp->texture[unit]; - const struct pipe_sampler_state *sampler = sp->sampler[unit]; + const struct pipe_texture *texture = samp->texture; + const struct pipe_sampler_state *sampler = samp->sampler; if (x < 0 || x >= (int) texture->width[level] || y < 0 || y >= (int) texture->height[level] || @@ -685,7 +683,7 @@ get_texel(const struct tgsi_sampler *tgsi_sampler, const int tx = x % TILE_SIZE; const int ty = y % TILE_SIZE; const struct softpipe_cached_tile *tile - = sp_get_cached_tile_tex(sp, samp->cache, + = sp_get_cached_tile_tex(samp->cache, x, y, z, face, level); rgba[0][j] = tile->data.color[ty][tx][0]; rgba[1][j] = tile->data.color[ty][tx][1]; @@ -840,10 +838,8 @@ sp_get_samples_2d_common(const struct tgsi_sampler *tgsi_sampler, const unsigned faces[4]) { const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); - const struct softpipe_context *sp = samp->sp; - const uint unit = samp->unit; - const struct pipe_texture *texture = sp->texture[unit]; - const struct pipe_sampler_state *sampler = sp->sampler[unit]; + const struct pipe_texture *texture = samp->texture; + const struct pipe_sampler_state *sampler = samp->sampler; unsigned level0, level1, j, imgFilter; int width, height; float levelBlend; @@ -992,10 +988,8 @@ sp_get_samples_3d(const struct tgsi_sampler *tgsi_sampler, float rgba[NUM_CHANNELS][QUAD_SIZE]) { const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); - const struct softpipe_context *sp = samp->sp; - const uint unit = samp->unit; - const struct pipe_texture *texture = sp->texture[unit]; - const struct pipe_sampler_state *sampler = sp->sampler[unit]; + const struct pipe_texture *texture = samp->texture; + const struct pipe_sampler_state *sampler = samp->sampler; /* get/map pipe_surfaces corresponding to 3D tex slices */ unsigned level0, level1, j, imgFilter; int width, height, depth; @@ -1139,10 +1133,8 @@ sp_get_samples_rect(const struct tgsi_sampler *tgsi_sampler, float rgba[NUM_CHANNELS][QUAD_SIZE]) { const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); - const struct softpipe_context *sp = samp->sp; - const uint unit = samp->unit; - const struct pipe_texture *texture = sp->texture[unit]; - const struct pipe_sampler_state *sampler = sp->sampler[unit]; + const struct pipe_texture *texture = samp->texture; + const struct pipe_sampler_state *sampler = samp->sampler; const uint face = 0; unsigned level0, level1, j, imgFilter; int width, height; @@ -1216,10 +1208,8 @@ sp_get_samples(struct tgsi_sampler *tgsi_sampler, float rgba[NUM_CHANNELS][QUAD_SIZE]) { const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); - const struct softpipe_context *sp = samp->sp; - const uint unit = samp->unit; - const struct pipe_texture *texture = sp->texture[unit]; - const struct pipe_sampler_state *sampler = sp->sampler[unit]; + const struct pipe_texture *texture = samp->texture; + const struct pipe_sampler_state *sampler = samp->sampler; if (!texture) return; diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.h b/src/gallium/drivers/softpipe/sp_tex_sample.h index 40d8eb2c2a..3c5beb560f 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.h +++ b/src/gallium/drivers/softpipe/sp_tex_sample.h @@ -39,8 +39,9 @@ struct sp_shader_sampler { struct tgsi_sampler base; /**< base class */ - uint unit; - struct softpipe_context *sp; + const struct pipe_texture *texture; + const struct pipe_sampler_state *sampler; + struct softpipe_tile_cache *cache; }; diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index 1f9b8f1f4f..306284808c 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -236,8 +236,7 @@ sp_tile_cache_unmap_transfers(struct softpipe_tile_cache *tc) * Specify the texture to cache. */ void -sp_tile_cache_set_texture(struct pipe_context *pipe, - struct softpipe_tile_cache *tc, +sp_tile_cache_set_texture(struct softpipe_tile_cache *tc, struct pipe_texture *texture) { uint i; @@ -344,8 +343,7 @@ clear_tile(struct softpipe_cached_tile *tile, * Actually clear the tiles which were flagged as being in a clear state. */ static void -sp_tile_cache_flush_clear(struct pipe_context *pipe, - struct softpipe_tile_cache *tc) +sp_tile_cache_flush_clear(struct softpipe_tile_cache *tc) { struct pipe_transfer *pt = tc->transfer; const uint w = tc->transfer->width; @@ -382,8 +380,7 @@ sp_tile_cache_flush_clear(struct pipe_context *pipe, * any tiles "flagged" as cleared will be "really" cleared. */ void -sp_flush_tile_cache(struct softpipe_context *softpipe, - struct softpipe_tile_cache *tc) +sp_flush_tile_cache(struct softpipe_tile_cache *tc) { struct pipe_transfer *pt = tc->transfer; int inuse = 0, pos; @@ -409,7 +406,7 @@ sp_flush_tile_cache(struct softpipe_context *softpipe, } #if TILE_CLEAR_OPTIMIZATION - sp_tile_cache_flush_clear(&softpipe->pipe, tc); + sp_tile_cache_flush_clear(tc); #endif } else if (tc->texture) { @@ -431,8 +428,7 @@ sp_flush_tile_cache(struct softpipe_context *softpipe, * \param x, y position of tile, in pixels */ struct softpipe_cached_tile * -sp_get_cached_tile(struct softpipe_context *softpipe, - struct softpipe_tile_cache *tc, int x, int y) +sp_get_cached_tile(struct softpipe_tile_cache *tc, int x, int y) { struct pipe_transfer *pt = tc->transfer; @@ -513,11 +509,11 @@ tex_cache_pos(int x, int y, int z, int face, int level) * Tiles are read-only and indexed with more params. */ const struct softpipe_cached_tile * -sp_get_cached_tile_tex(struct softpipe_context *sp, - struct softpipe_tile_cache *tc, int x, int y, int z, +sp_get_cached_tile_tex(struct softpipe_tile_cache *tc, + int x, int y, int z, int face, int level) { - struct pipe_screen *screen = sp->pipe.screen; + struct pipe_screen *screen = tc->screen; /* tile pos in framebuffer: */ const int tile_x = x & ~(TILE_SIZE - 1); const int tile_y = y & ~(TILE_SIZE - 1); diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.h b/src/gallium/drivers/softpipe/sp_tile_cache.h index 8f247d0e58..639cde6705 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.h +++ b/src/gallium/drivers/softpipe/sp_tile_cache.h @@ -80,25 +80,21 @@ extern void sp_tile_cache_unmap_transfers(struct softpipe_tile_cache *tc); extern void -sp_tile_cache_set_texture(struct pipe_context *pipe, - struct softpipe_tile_cache *tc, +sp_tile_cache_set_texture(struct softpipe_tile_cache *tc, struct pipe_texture *texture); extern void -sp_flush_tile_cache(struct softpipe_context *softpipe, - struct softpipe_tile_cache *tc); +sp_flush_tile_cache(struct softpipe_tile_cache *tc); extern void 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, - struct softpipe_tile_cache *tc, int x, int y); +sp_get_cached_tile(struct softpipe_tile_cache *tc, int x, int y); extern const struct softpipe_cached_tile * -sp_get_cached_tile_tex(struct softpipe_context *softpipe, - struct softpipe_tile_cache *tc, int x, int y, int z, +sp_get_cached_tile_tex(struct softpipe_tile_cache *tc, int x, int y, int z, int face, int level); -- cgit v1.2.3 From 0ac879dca797360570543d5bd0fd64f8fb8e566e Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 16 Jul 2009 17:51:02 +0100 Subject: util: _debug_printf should print even when DEBUG is not defined The leading underscore is meaningful... This function is used by _warning and _error functions as well as the more common debug_printf(). debug_printf (without underscore) gets turned off when DEBUG is disabled, but warning/error messages still use this function to get their message out. --- src/gallium/auxiliary/util/u_debug.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index a5ca0b72bd..96d400c839 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -143,11 +143,9 @@ void _debug_vprintf(const char *format, va_list ap) #elif defined(PIPE_SUBSYSTEM_WINDOWS_MINIPORT) /* TODO */ #else /* !PIPE_SUBSYSTEM_WINDOWS */ -#ifdef DEBUG fflush(stdout); vfprintf(stderr, format, ap); #endif -#endif } -- cgit v1.2.3 From 07bb026900a6c01226217ceee1d4d1426c040d6e Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 16 Jul 2009 17:57:00 +0100 Subject: gallium/xlib: use XSHM for swapbuffers Makes some difference, but suprisingly little. Barely worth the effort. --- src/gallium/winsys/xlib/xlib_softpipe.c | 98 ++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 45 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/xlib/xlib_softpipe.c b/src/gallium/winsys/xlib/xlib_softpipe.c index 44b8464518..1de93c4e8c 100644 --- a/src/gallium/winsys/xlib/xlib_softpipe.c +++ b/src/gallium/winsys/xlib/xlib_softpipe.c @@ -75,9 +75,6 @@ struct xmesa_pipe_winsys { struct pipe_winsys base; /* struct xmesa_visual *xm_visual; */ -#ifdef USE_XSHM - int shm; -#endif }; @@ -93,11 +90,6 @@ xm_buffer( struct pipe_buffer *buf ) /** * X Shared Memory Image extension code */ -#ifdef USE_XSHM -#define XSHM_ENABLED(b) ((b)->shm) -#else -#define XSHM_ENABLED(b) 0 -#endif #ifdef USE_XSHM @@ -116,23 +108,23 @@ mesaHandleXError(Display *dpy, XErrorEvent *event) } -static GLboolean alloc_shm(struct xm_buffer *buf, unsigned size) +static char *alloc_shm(struct xm_buffer *buf, unsigned size) { XShmSegmentInfo *const shminfo = & buf->shminfo; shminfo->shmid = shmget(IPC_PRIVATE, size, IPC_CREAT|0777); if (shminfo->shmid < 0) { - return GL_FALSE; + return NULL; } shminfo->shmaddr = (char *) shmat(shminfo->shmid, 0, 0); if (shminfo->shmaddr == (char *) -1) { shmctl(shminfo->shmid, IPC_RMID, 0); - return GL_FALSE; + return NULL; } shminfo->readOnly = False; - return GL_TRUE; + return shminfo->shmaddr; } @@ -258,25 +250,30 @@ xlib_softpipe_display_surface(struct xmesa_buffer *b, return; #ifdef USE_XSHM - if (XSHM_ENABLED(xm_buf) && (xm_buf->tempImage == NULL)) { - assert(surf->texture->block.width == 1); - assert(surf->texture->block.height == 1); - alloc_shm_ximage(xm_buf, b, spt->stride[surf->level] / - surf->texture->block.size, surf->height); - } -#endif + if (xm_buf->shm) + { + if (xm_buf->tempImage == NULL) + { + assert(surf->texture->block.width == 1); + assert(surf->texture->block.height == 1); + alloc_shm_ximage(xm_buf, b, spt->stride[surf->level] / + surf->texture->block.size, surf->height); + } - ximage = (XSHM_ENABLED(xm_buf)) ? xm_buf->tempImage : b->tempImage; - ximage->data = xm_buf->data; + ximage = xm_buf->tempImage; + ximage->data = xm_buf->data; - /* display image in Window */ -#ifdef USE_XSHM - if (XSHM_ENABLED(xm_buf)) { + /* _debug_printf("XSHM\n"); */ XShmPutImage(b->xm_visual->display, b->drawable, b->gc, ximage, 0, 0, 0, 0, surf->width, surf->height, False); - } else + } + else #endif { + /* display image in Window */ + ximage = b->tempImage; + ximage->data = xm_buf->data; + /* check that the XImage has been previously initialized */ assert(ximage->format); assert(ximage->bitmap_unit); @@ -286,6 +283,7 @@ xlib_softpipe_display_surface(struct xmesa_buffer *b, ximage->height = surf->height; ximage->bytes_per_line = spt->stride[surf->level]; + /* _debug_printf("XPUT\n"); */ XPutImage(b->xm_visual->display, b->drawable, b->gc, ximage, 0, 0, 0, 0, surf->width, surf->height); } @@ -321,21 +319,6 @@ xm_buffer_create(struct pipe_winsys *pws, unsigned size) { struct xm_buffer *buffer = CALLOC_STRUCT(xm_buffer); -#ifdef USE_XSHM - struct xmesa_pipe_winsys *xpws = (struct xmesa_pipe_winsys *) pws; - - buffer->shminfo.shmid = -1; - buffer->shminfo.shmaddr = (char *) -1; - - if (xpws->shm && (usage & PIPE_BUFFER_USAGE_PIXEL) != 0) { - buffer->shm = xpws->shm; - - if (alloc_shm(buffer, size)) { - buffer->data = buffer->shminfo.shmaddr; - buffer->shm = 1; - } - } -#endif pipe_reference_init(&buffer->base.reference, 1); buffer->base.alignment = alignment; @@ -362,9 +345,6 @@ xm_user_buffer_create(struct pipe_winsys *pws, void *ptr, unsigned bytes) buffer->base.size = bytes; buffer->userBuffer = TRUE; buffer->data = ptr; -#ifdef USE_XSHM - buffer->shm = 0; -#endif return &buffer->base; } @@ -379,16 +359,44 @@ xm_surface_buffer_create(struct pipe_winsys *winsys, { const unsigned alignment = 64; struct pipe_format_block block; - unsigned nblocksx, nblocksy; + unsigned nblocksx, nblocksy, size; pf_get_block(format, &block); nblocksx = pf_get_nblocksx(&block, width); nblocksy = pf_get_nblocksy(&block, height); *stride = align(nblocksx * block.size, alignment); + size = *stride * nblocksy; + +#ifdef USE_XSHM + if (!debug_get_bool_option("XLIB_NO_SHM", FALSE)) + { + struct xm_buffer *buffer = CALLOC_STRUCT(xm_buffer); + + pipe_reference_init(&buffer->base.reference, 1); + buffer->base.alignment = alignment; + buffer->base.usage = usage; + buffer->base.size = size; + buffer->userBuffer = FALSE; + buffer->shminfo.shmid = -1; + buffer->shminfo.shmaddr = (char *) -1; + buffer->shm = TRUE; + + buffer->data = alloc_shm(buffer, size); + if (!buffer->data) + goto out; + + return &buffer->base; + + out: + if (buffer) + FREE(buffer); + } +#endif + return winsys->buffer_create(winsys, alignment, usage, - *stride * nblocksy); + size); } -- cgit v1.2.3 From b5d583efeff5f195bff48c95125a225c273189e2 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 17 Jul 2009 10:44:22 +0100 Subject: softpipe: make some small steps to flush texture cache less frequently No performance gain yet, but the code is a bit cleaner. --- src/gallium/drivers/softpipe/sp_context.h | 3 +- src/gallium/drivers/softpipe/sp_state_derived.c | 14 +++++ src/gallium/drivers/softpipe/sp_texture.c | 3 +- src/gallium/drivers/softpipe/sp_texture.h | 2 +- src/gallium/drivers/softpipe/sp_tile_cache.c | 80 +++++++++++++++---------- src/gallium/drivers/softpipe/sp_tile_cache.h | 3 + 6 files changed, 70 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index 7888c2f644..f66f0b7849 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -149,7 +149,8 @@ struct softpipe_context { struct softpipe_tile_cache *cbuf_cache[PIPE_MAX_COLOR_BUFS]; struct softpipe_tile_cache *zsbuf_cache; - + + unsigned tex_timestamp; struct softpipe_tile_cache *tex_cache[PIPE_MAX_SAMPLERS]; unsigned use_sse : 1; diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index 75be99768c..629a1f8e29 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -32,6 +32,7 @@ #include "draw/draw_vertex.h" #include "draw/draw_private.h" #include "sp_context.h" +#include "sp_screen.h" #include "sp_state.h" @@ -200,6 +201,10 @@ update_tgsi_samplers( struct softpipe_context *softpipe ) softpipe->tgsi.frag_samplers[i].sampler = softpipe->sampler[i]; softpipe->tgsi.frag_samplers[i].texture = softpipe->texture[i]; } + + for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { + sp_tile_cache_validate_texture( softpipe->tex_cache[i] ); + } } /* Hopefully this will remain quite simple, otherwise need to pull in @@ -207,6 +212,15 @@ update_tgsi_samplers( struct softpipe_context *softpipe ) */ void softpipe_update_derived( struct softpipe_context *softpipe ) { + struct softpipe_screen *sp_screen = softpipe_screen(softpipe->pipe.screen); + + /* Check for updated textures. + */ + if (softpipe->tex_timestamp != sp_screen->timestamp) { + softpipe->tex_timestamp = sp_screen->timestamp; + softpipe->dirty |= SP_NEW_TEXTURE; + } + if (softpipe->dirty & (SP_NEW_SAMPLER | SP_NEW_TEXTURE)) update_tgsi_samplers( softpipe ); diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 7a533dad9f..0c84375bf1 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -227,7 +227,8 @@ softpipe_get_tex_surface(struct pipe_screen *screen, if (ps->usage & (PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_GPU_WRITE)) { /* Mark the surface as dirty. The tile cache will look for this. */ - spt->modified = TRUE; + spt->timestamp++; + softpipe_screen(screen)->timestamp++; } ps->face = face; diff --git a/src/gallium/drivers/softpipe/sp_texture.h b/src/gallium/drivers/softpipe/sp_texture.h index 893aa7d11d..42df722a2d 100644 --- a/src/gallium/drivers/softpipe/sp_texture.h +++ b/src/gallium/drivers/softpipe/sp_texture.h @@ -48,7 +48,7 @@ struct softpipe_texture */ struct pipe_buffer *buffer; - boolean modified; + unsigned timestamp; }; struct softpipe_transfer diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index 306284808c..79b1e036be 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -54,7 +54,10 @@ struct softpipe_tile_cache struct pipe_surface *surface; /**< the surface we're caching */ struct pipe_transfer *transfer; void *transfer_map; + struct pipe_texture *texture; /**< if caching a texture */ + unsigned timestamp; + struct softpipe_cached_tile entries[NUM_ENTRIES]; uint clear_flags[(MAX_WIDTH / TILE_SIZE) * (MAX_HEIGHT / TILE_SIZE) / 32]; float clear_color[4]; /**< for color bufs */ @@ -231,6 +234,23 @@ sp_tile_cache_unmap_transfers(struct softpipe_tile_cache *tc) } } +void +sp_tile_cache_validate_texture(struct softpipe_tile_cache *tc) +{ + if (tc->texture) { + struct softpipe_texture *spt = softpipe_texture(tc->texture); + if (spt->timestamp != tc->timestamp) { + /* texture was modified, invalidate all cached tiles */ + uint i; + _debug_printf("INV %d %d\n", tc->timestamp, spt->timestamp); + for (i = 0; i < NUM_ENTRIES; i++) { + tc->entries[i].x = -3; + } + + tc->timestamp = spt->timestamp; + } + } +} /** * Specify the texture to cache. @@ -243,27 +263,29 @@ sp_tile_cache_set_texture(struct softpipe_tile_cache *tc, assert(!tc->transfer); - pipe_texture_reference(&tc->texture, texture); + if (tc->texture != texture) { + pipe_texture_reference(&tc->texture, texture); - if (tc->tex_trans) { - struct pipe_screen *screen = tc->tex_trans->texture->screen; + if (tc->tex_trans) { + struct pipe_screen *screen = tc->tex_trans->texture->screen; + + if (tc->tex_trans_map) { + screen->transfer_unmap(screen, tc->tex_trans); + tc->tex_trans_map = NULL; + } - if (tc->tex_trans_map) { - screen->transfer_unmap(screen, tc->tex_trans); - tc->tex_trans_map = NULL; + screen->tex_transfer_destroy(tc->tex_trans); + tc->tex_trans = NULL; } - screen->tex_transfer_destroy(tc->tex_trans); - tc->tex_trans = NULL; - } + /* mark as entries as invalid/empty */ + /* XXX we should try to avoid this when the teximage hasn't changed */ + for (i = 0; i < NUM_ENTRIES; i++) { + tc->entries[i].x = -1; + } - /* mark as entries as invalid/empty */ - /* XXX we should try to avoid this when the teximage hasn't changed */ - for (i = 0; i < NUM_ENTRIES; i++) { - tc->entries[i].x = -1; + tc->tex_face = -1; /* any invalid value here */ } - - tc->tex_face = -1; /* any invalid value here */ } @@ -443,7 +465,7 @@ sp_get_cached_tile(struct softpipe_tile_cache *tc, int x, int y) if (tile_x != tile->x || tile_y != tile->y) { - if (tile->x != -1) { + if (tile->x >= 0) { /* put dirty tile back in framebuffer */ if (tc->depth_stencil) { pipe_put_tile_raw(pt, @@ -522,30 +544,24 @@ sp_get_cached_tile_tex(struct softpipe_tile_cache *tc, face, level); struct softpipe_cached_tile *tile = tc->entries + pos; - if (tc->texture) { - struct softpipe_texture *spt = softpipe_texture(tc->texture); - if (spt->modified) { - /* texture was modified, invalidate all cached tiles */ - uint p; - for (p = 0; p < NUM_ENTRIES; p++) { - tile = tc->entries + p; - tile->x = -1; - } - spt->modified = FALSE; - } - } - if (tile_x != tile->x || tile_y != tile->y || z != tile->z || face != tile->face || level != tile->level) { - /* cache miss */ + /* cache miss. Most misses are because we've invaldiated the + * texture cache previously -- most commonly on binding a new + * texture. Currently we effectively flush the cache on texture + * bind. + */ #if 0 - printf("miss at %u x=%d y=%d z=%d face=%d level=%d\n", pos, - x/TILE_SIZE, y/TILE_SIZE, z, face, level); + _debug_printf("miss at %u: x=%d y=%d z=%d face=%d level=%d\n" + " tile %u: x=%d y=%d z=%d face=%d level=%d\n", + pos, x/TILE_SIZE, y/TILE_SIZE, z, face, level, + pos, tile->x, tile->y, tile->z, tile->face, tile->level); #endif + /* check if we need to get a new transfer */ if (!tc->tex_trans || tc->tex_face != face || diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.h b/src/gallium/drivers/softpipe/sp_tile_cache.h index 639cde6705..0d165b4ad7 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.h +++ b/src/gallium/drivers/softpipe/sp_tile_cache.h @@ -83,6 +83,9 @@ extern void sp_tile_cache_set_texture(struct softpipe_tile_cache *tc, struct pipe_texture *texture); +void +sp_tile_cache_validate_texture(struct softpipe_tile_cache *tc); + extern void sp_flush_tile_cache(struct softpipe_tile_cache *tc); -- cgit v1.2.3 From 73e7356385a703c214b35fbb29aaf3108764f033 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 17 Jul 2009 10:47:32 +0100 Subject: softpipe: simplify flush_spans No loss of performance, but simpler code. --- src/gallium/drivers/softpipe/sp_setup.c | 72 +++++++++------------------------ 1 file changed, 19 insertions(+), 53 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c index de3ae3c369..f29fcbd5a2 100644 --- a/src/gallium/drivers/softpipe/sp_setup.c +++ b/src/gallium/drivers/softpipe/sp_setup.c @@ -428,65 +428,31 @@ static void flush_spans( struct setup_context *setup ) int minleft, maxright; int x; - switch (setup->span.y_flags) { - case 0x3: - /* both odd and even lines written (both quad rows) */ - minleft = block(MIN2(xleft0, xleft1)); - maxright = block(MAX2(xright0, xright1)); - for (x = minleft; x <= maxright; x += 2) { - /* determine which of the four pixels is inside the span bounds */ - uint mask = 0x0; - if (x >= xleft0 && x < xright0) - mask |= MASK_TOP_LEFT; - if (x >= xleft1 && x < xright1) - mask |= MASK_BOTTOM_LEFT; - if (x+1 >= xleft0 && x+1 < xright0) - mask |= MASK_TOP_RIGHT; - if (x+1 >= xleft1 && x+1 < xright1) - mask |= MASK_BOTTOM_RIGHT; - if (mask) - EMIT_QUAD( setup, x, setup->span.y, mask ); - } - break; - - case 0x1: - /* only even line written (quad top row) */ - minleft = block(xleft0); - maxright = block(xright0); - for (x = minleft; x <= maxright; x += 2) { - uint mask = 0x0; - if (x >= xleft0 && x < xright0) - mask |= MASK_TOP_LEFT; - if (x+1 >= xleft0 && x+1 < xright0) - mask |= MASK_TOP_RIGHT; - if (mask) - EMIT_QUAD( setup, x, setup->span.y, mask ); - } - break; - - case 0x2: - /* only odd line written (quad bottom row) */ - minleft = block(xleft1); - maxright = block(xright1); - for (x = minleft; x <= maxright; x += 2) { - uint mask = 0x0; - if (x >= xleft1 && x < xright1) - mask |= MASK_BOTTOM_LEFT; - if (x+1 >= xleft1 && x+1 < xright1) - mask |= MASK_BOTTOM_RIGHT; - if (mask) - EMIT_QUAD( setup, x, setup->span.y, mask ); - } - break; - - default: - return; + minleft = block(MIN2(xleft0, xleft1)); + maxright = block(MAX2(xright0, xright1)); + + for (x = minleft; x <= maxright; x += 2) { + /* determine which of the four pixels is inside the span bounds */ + uint mask = 0x0; + if (x >= xleft0 && x < xright0) + mask |= MASK_TOP_LEFT; + if (x >= xleft1 && x < xright1) + mask |= MASK_BOTTOM_LEFT; + if (x+1 >= xleft0 && x+1 < xright0) + mask |= MASK_TOP_RIGHT; + if (x+1 >= xleft1 && x+1 < xright1) + mask |= MASK_BOTTOM_RIGHT; + if (mask) + EMIT_QUAD( setup, x, setup->span.y, mask ); } + setup->span.y = 0; setup->span.y_flags = 0; setup->span.right[0] = 0; setup->span.right[1] = 0; + setup->span.left[0] = 1; /* greater than right[0] */ + setup->span.left[1] = 1; /* greater than right[1] */ } -- cgit v1.2.3 From 0ed99f45529178c77e47838f226231ea1bc9b918 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 17 Jul 2009 12:03:51 +0100 Subject: softpipe: use bitwise logic to setup quad masks in sp_setup --- src/gallium/drivers/softpipe/sp_setup.c | 65 ++++++++++++++++++++------------- 1 file changed, 40 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c index f29fcbd5a2..8ac22bd302 100644 --- a/src/gallium/drivers/softpipe/sp_setup.c +++ b/src/gallium/drivers/softpipe/sp_setup.c @@ -388,19 +388,19 @@ emit_quad_job( struct setup_context *setup, uint thread, struct quad_job *job ) emit_quad( setup, &quad, thread ); } -#define EMIT_QUAD(setup,x,y,mask) do {\ +#define EMIT_QUAD(setup,x,y,qmask) do {\ setup->quad.input.x0 = x;\ setup->quad.input.y0 = y;\ - setup->quad.inout.mask = mask;\ + setup->quad.inout.mask = qmask;\ add_quad_job( &setup->que, &setup->quad, emit_quad_job );\ } while (0) #else -#define EMIT_QUAD(setup,x,y,mask) do {\ +#define EMIT_QUAD(setup,x,y,qmask) do {\ setup->quad.input.x0 = x;\ setup->quad.input.y0 = y;\ - setup->quad.inout.mask = mask;\ + setup->quad.inout.mask = qmask;\ emit_quad( setup, &setup->quad, 0 );\ } while (0) @@ -421,29 +421,42 @@ static INLINE int block( int x ) */ static void flush_spans( struct setup_context *setup ) { + const int step = 30; const int xleft0 = setup->span.left[0]; const int xleft1 = setup->span.left[1]; const int xright0 = setup->span.right[0]; const int xright1 = setup->span.right[1]; - int minleft, maxright; + + int minleft = block(MIN2(xleft0, xleft1)); + int maxright = MAX2(xright0, xright1); int x; - minleft = block(MIN2(xleft0, xleft1)); - maxright = block(MAX2(xright0, xright1)); - - for (x = minleft; x <= maxright; x += 2) { - /* determine which of the four pixels is inside the span bounds */ - uint mask = 0x0; - if (x >= xleft0 && x < xright0) - mask |= MASK_TOP_LEFT; - if (x >= xleft1 && x < xright1) - mask |= MASK_BOTTOM_LEFT; - if (x+1 >= xleft0 && x+1 < xright0) - mask |= MASK_TOP_RIGHT; - if (x+1 >= xleft1 && x+1 < xright1) - mask |= MASK_BOTTOM_RIGHT; - if (mask) - EMIT_QUAD( setup, x, setup->span.y, mask ); + for (x = minleft; x < maxright; x += step) { + unsigned skip_left0 = CLAMP(xleft0 - x, 0, step); + unsigned skip_left1 = CLAMP(xleft1 - x, 0, step); + unsigned skip_right0 = CLAMP(x + step - xright0, 0, step); + unsigned skip_right1 = CLAMP(x + step - xright1, 0, step); + unsigned lx = x; + + unsigned skipmask_left0 = (1U << skip_left0) - 1U; + unsigned skipmask_left1 = (1U << skip_left1) - 1U; + + /* These calculations fail when step == 32 and skip_right == 0. + */ + unsigned skipmask_right0 = ~0U << (unsigned)(step - skip_right0); + unsigned skipmask_right1 = ~0U << (unsigned)(step - skip_right1); + + unsigned mask0 = ~skipmask_left0 & ~skipmask_right0; + unsigned mask1 = ~skipmask_left1 & ~skipmask_right1; + + while (mask0 | mask1) { + unsigned quadmask = (mask0 & 3) | ((mask1 & 3) << 2); + if (quadmask) + EMIT_QUAD( setup, lx, setup->span.y, quadmask ); + mask0 >>= 2; + mask1 >>= 2; + lx += 2; + } } @@ -451,8 +464,8 @@ static void flush_spans( struct setup_context *setup ) setup->span.y_flags = 0; setup->span.right[0] = 0; setup->span.right[1] = 0; - setup->span.left[0] = 1; /* greater than right[0] */ - setup->span.left[1] = 1; /* greater than right[1] */ + setup->span.left[0] = 1000000; /* greater than right[0] */ + setup->span.left[1] = 1000000; /* greater than right[1] */ } @@ -810,11 +823,10 @@ static void subtriangle( struct setup_context *setup, /* clip top/bottom */ start_y = sy; - finish_y = sy + lines; - if (start_y < miny) start_y = miny; + finish_y = sy + lines; if (finish_y > maxy) finish_y = maxy; @@ -1495,6 +1507,9 @@ struct setup_context *setup_create_context( struct softpipe_context *softpipe ) setup->quad.coef = setup->coef; setup->quad.posCoef = &setup->posCoef; + setup->span.left[0] = 1000000; /* greater than right[0] */ + setup->span.left[1] = 1000000; /* greater than right[1] */ + #if SP_NUM_QUAD_THREADS > 1 setup->que.first = 0; setup->que.last = 0; -- cgit v1.2.3 From 13e2d35764e0c8de3356ee663885568fc00424f0 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 17 Jul 2009 12:12:04 +0100 Subject: softpipe: remove unused vars in sp_setup.c --- src/gallium/drivers/softpipe/sp_setup.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c index 8ac22bd302..d05c9ad57c 100644 --- a/src/gallium/drivers/softpipe/sp_setup.c +++ b/src/gallium/drivers/softpipe/sp_setup.c @@ -178,8 +178,6 @@ struct setup_context { int left[2]; /**< [0] = row0, [1] = row1 */ int right[2]; int y; - unsigned y_flags; - unsigned mask; /**< mask of MASK_BOTTOM/TOP_LEFT/RIGHT bits */ } span; #if DEBUG_FRAGS @@ -461,7 +459,6 @@ static void flush_spans( struct setup_context *setup ) setup->span.y = 0; - setup->span.y_flags = 0; setup->span.right[0] = 0; setup->span.right[1] = 0; setup->span.left[0] = 1000000; /* greater than right[0] */ @@ -863,7 +860,6 @@ static void subtriangle( struct setup_context *setup, setup->span.left[_y&1] = left; setup->span.right[_y&1] = right; - setup->span.y_flags |= 1<<(_y&1); } } @@ -939,7 +935,6 @@ void setup_tri( struct setup_context *setup, setup->quad.input.prim = QUAD_PRIM_TRI; setup->span.y = 0; - setup->span.y_flags = 0; setup->span.right[0] = 0; setup->span.right[1] = 0; /* setup->span.z_mode = tri_z_mode( setup->ctx ); */ -- cgit v1.2.3 From f911c3b9897b90132c8621a72bfeb824eb3b01e5 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 22 Jul 2009 15:08:42 +0100 Subject: softpipe: shortcircuit repeated lookups of the same tile The sp_tile_cache is often called repeatedly to look up the same tile. Add a cache (to the cache) of the single tile most recently retreived and make a quick inline check to see if this matches the subsequent request. Add a tile_address bitfield struct to make this check easier. --- src/gallium/auxiliary/util/u_math.h | 12 +++ src/gallium/drivers/softpipe/sp_tex_sample.c | 12 ++- src/gallium/drivers/softpipe/sp_tile_cache.c | 153 ++++++++++++--------------- src/gallium/drivers/softpipe/sp_tile_cache.h | 88 ++++++++++++++- 4 files changed, 168 insertions(+), 97 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index e5003af01d..d30fa3c2d5 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -366,6 +366,18 @@ unsigned ffs( unsigned u ) #endif +/* Could also binary search for the highest bit. + */ +static INLINE unsigned +util_unsigned_logbase2(unsigned n) +{ + unsigned log2 = 0; + while (n >>= 1) + ++log2; + return log2; +} + + /** * Return float bits. */ diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 3daa88eedd..46c56b0c83 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -680,11 +680,13 @@ get_texel(const struct tgsi_sampler *tgsi_sampler, rgba[3][j] = sampler->border_color[3]; } else { - const int tx = x % TILE_SIZE; - const int ty = y % TILE_SIZE; - const struct softpipe_cached_tile *tile - = sp_get_cached_tile_tex(samp->cache, - x, y, z, face, level); + const unsigned tx = x % TILE_SIZE; + const unsigned ty = y % TILE_SIZE; + const struct softpipe_cached_tile *tile; + + tile = sp_get_cached_tile_tex(samp->cache, + tile_address(x, y, z, face, level)); + rgba[0][j] = tile->data.color[ty][tx][0]; rgba[1][j] = tile->data.color[ty][tx][1]; rgba[2][j] = tile->data.color[ty][tx][2]; diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index 79b1e036be..06d9c6a80a 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -40,36 +40,6 @@ #include "sp_texture.h" #include "sp_tile_cache.h" -#define NUM_ENTRIES 50 - - -/** XXX move these */ -#define MAX_WIDTH 2048 -#define MAX_HEIGHT 2048 - - -struct softpipe_tile_cache -{ - struct pipe_screen *screen; - struct pipe_surface *surface; /**< the surface we're caching */ - struct pipe_transfer *transfer; - void *transfer_map; - - struct pipe_texture *texture; /**< if caching a texture */ - unsigned timestamp; - - struct softpipe_cached_tile entries[NUM_ENTRIES]; - uint clear_flags[(MAX_WIDTH / TILE_SIZE) * (MAX_HEIGHT / TILE_SIZE) / 32]; - 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; - int tex_face, tex_level, tex_z; - - struct softpipe_cached_tile tile; /**< scratch tile for clears */ -}; /** @@ -124,9 +94,9 @@ sp_create_tile_cache( struct pipe_screen *screen ) if (tc) { tc->screen = screen; for (pos = 0; pos < NUM_ENTRIES; pos++) { - tc->entries[pos].x = - tc->entries[pos].y = -1; + tc->entries[pos].addr.bits.invalid = 1; } + tc->last_tile = &tc->entries[0]; /* any tile */ } return tc; } @@ -244,7 +214,7 @@ sp_tile_cache_validate_texture(struct softpipe_tile_cache *tc) uint i; _debug_printf("INV %d %d\n", tc->timestamp, spt->timestamp); for (i = 0; i < NUM_ENTRIES; i++) { - tc->entries[i].x = -3; + tc->entries[i].addr.bits.invalid = 1; } tc->timestamp = spt->timestamp; @@ -281,7 +251,7 @@ sp_tile_cache_set_texture(struct softpipe_tile_cache *tc, /* mark as entries as invalid/empty */ /* XXX we should try to avoid this when the teximage hasn't changed */ for (i = 0; i < NUM_ENTRIES; i++) { - tc->entries[i].x = -1; + tc->entries[i].addr.bits.invalid = 1; } tc->tex_face = -1; /* any invalid value here */ @@ -411,18 +381,22 @@ sp_flush_tile_cache(struct softpipe_tile_cache *tc) /* caching a drawing transfer */ for (pos = 0; pos < NUM_ENTRIES; pos++) { struct softpipe_cached_tile *tile = tc->entries + pos; - if (tile->x >= 0) { + if (!tile->addr.bits.invalid) { if (tc->depth_stencil) { pipe_put_tile_raw(pt, - tile->x, tile->y, TILE_SIZE, TILE_SIZE, + tile->addr.bits.x * TILE_SIZE, + tile->addr.bits.y * TILE_SIZE, + TILE_SIZE, TILE_SIZE, tile->data.depth32, 0/*STRIDE*/); } else { pipe_put_tile_rgba(pt, - tile->x, tile->y, TILE_SIZE, TILE_SIZE, + tile->addr.bits.x * TILE_SIZE, + tile->addr.bits.y * TILE_SIZE, + TILE_SIZE, TILE_SIZE, (float *) tile->data.color); } - tile->x = tile->y = -1; /* mark as empty */ + tile->addr.bits.invalid = 1; /* mark as empty */ inuse++; } } @@ -434,7 +408,7 @@ sp_flush_tile_cache(struct softpipe_tile_cache *tc) else if (tc->texture) { /* caching a texture, mark all entries as empty */ for (pos = 0; pos < NUM_ENTRIES; pos++) { - tc->entries[pos].x = -1; + tc->entries[pos].addr.bits.invalid = 1; } tc->tex_face = -1; } @@ -453,34 +427,34 @@ struct softpipe_cached_tile * sp_get_cached_tile(struct softpipe_tile_cache *tc, int x, int y) { struct pipe_transfer *pt = tc->transfer; - + /* tile pos in framebuffer: */ - const int tile_x = x & ~(TILE_SIZE - 1); - const int tile_y = y & ~(TILE_SIZE - 1); - + union tile_address addr = tile_address( x, y, 0, 0, 0 ); /* cache pos/entry: */ const int pos = CACHE_POS(x, y); struct softpipe_cached_tile *tile = tc->entries + pos; - if (tile_x != tile->x || - tile_y != tile->y) { + if (addr.value != tile->addr.value) { - if (tile->x >= 0) { + if (tile->addr.bits.invalid == 0) { /* put dirty tile back in framebuffer */ if (tc->depth_stencil) { pipe_put_tile_raw(pt, - tile->x, tile->y, TILE_SIZE, TILE_SIZE, + tile->addr.bits.x * TILE_SIZE, + tile->addr.bits.y * TILE_SIZE, + TILE_SIZE, TILE_SIZE, tile->data.depth32, 0/*STRIDE*/); } else { pipe_put_tile_rgba(pt, - tile->x, tile->y, TILE_SIZE, TILE_SIZE, + tile->addr.bits.x * TILE_SIZE, + tile->addr.bits.y * TILE_SIZE, + TILE_SIZE, TILE_SIZE, (float *) tile->data.color); } } - tile->x = tile_x; - tile->y = tile_y; + tile->addr = addr; if (is_clear_flag_set(tc->clear_flags, x, y)) { /* don't get tile from framebuffer, just clear it */ @@ -496,12 +470,16 @@ sp_get_cached_tile(struct softpipe_tile_cache *tc, int x, int y) /* get new tile data from transfer */ if (tc->depth_stencil) { pipe_get_tile_raw(pt, - tile->x, tile->y, TILE_SIZE, TILE_SIZE, + tile->addr.bits.x * TILE_SIZE, + tile->addr.bits.y * TILE_SIZE, + TILE_SIZE, TILE_SIZE, tile->data.depth32, 0/*STRIDE*/); } else { pipe_get_tile_rgba(pt, - tile->x, tile->y, TILE_SIZE, TILE_SIZE, + tile->addr.bits.x * TILE_SIZE, + tile->addr.bits.y * TILE_SIZE, + TILE_SIZE, TILE_SIZE, (float *) tile->data.color); } } @@ -519,36 +497,31 @@ sp_get_cached_tile(struct softpipe_tile_cache *tc, int x, int y) * XXX There's probably lots of ways in which we can improve this. */ static INLINE uint -tex_cache_pos(int x, int y, int z, int face, int level) +tex_cache_pos( union tile_address addr ) { - uint entry = x + y * 9 + z * 3 + face + level * 7; + uint entry = (addr.bits.x + + addr.bits.y * 9 + + addr.bits.z * 3 + + addr.bits.face + + addr.bits.level * 7); + return entry % NUM_ENTRIES; } - /** * Similar to sp_get_cached_tile() but for textures. * Tiles are read-only and indexed with more params. */ const struct softpipe_cached_tile * -sp_get_cached_tile_tex(struct softpipe_tile_cache *tc, - int x, int y, int z, - int face, int level) +sp_find_cached_tile_tex(struct softpipe_tile_cache *tc, + union tile_address addr ) { struct pipe_screen *screen = tc->screen; - /* tile pos in framebuffer: */ - const int tile_x = x & ~(TILE_SIZE - 1); - const int tile_y = y & ~(TILE_SIZE - 1); - /* cache pos/entry: */ - const uint pos = tex_cache_pos(x / TILE_SIZE, y / TILE_SIZE, z, - face, level); - struct softpipe_cached_tile *tile = tc->entries + pos; + struct softpipe_cached_tile *tile; + + tile = tc->entries + tex_cache_pos( addr ); - if (tile_x != tile->x || - tile_y != tile->y || - z != tile->z || - face != tile->face || - level != tile->level) { + if (addr.value != tile->addr.value) { /* cache miss. Most misses are because we've invaldiated the * texture cache previously -- most commonly on binding a new @@ -559,14 +532,14 @@ sp_get_cached_tile_tex(struct softpipe_tile_cache *tc, _debug_printf("miss at %u: x=%d y=%d z=%d face=%d level=%d\n" " tile %u: x=%d y=%d z=%d face=%d level=%d\n", pos, x/TILE_SIZE, y/TILE_SIZE, z, face, level, - pos, tile->x, tile->y, tile->z, tile->face, tile->level); + pos, tile->addr.bits.x, tile->addr.bits.y, tile->z, tile->face, tile->level); #endif /* check if we need to get a new transfer */ if (!tc->tex_trans || - tc->tex_face != face || - tc->tex_level != level || - tc->tex_z != z) { + tc->tex_face != addr.bits.face || + tc->tex_level != addr.bits.level || + tc->tex_z != addr.bits.z) { /* get new transfer (view into texture) */ if (tc->tex_trans) { @@ -579,28 +552,32 @@ sp_get_cached_tile_tex(struct softpipe_tile_cache *tc, tc->tex_trans = NULL; } - tc->tex_trans = screen->get_tex_transfer(screen, tc->texture, face, level, z, - PIPE_TRANSFER_READ, 0, 0, - tc->texture->width[level], - tc->texture->height[level]); + tc->tex_trans = + screen->get_tex_transfer(screen, tc->texture, + addr.bits.face, + addr.bits.level, + addr.bits.z, + PIPE_TRANSFER_READ, 0, 0, + tc->texture->width[addr.bits.level], + tc->texture->height[addr.bits.level]); + tc->tex_trans_map = screen->transfer_map(screen, tc->tex_trans); - tc->tex_face = face; - tc->tex_level = level; - tc->tex_z = z; + tc->tex_face = addr.bits.face; + tc->tex_level = addr.bits.level; + tc->tex_z = addr.bits.z; } /* get tile from the transfer (view into texture) */ pipe_get_tile_rgba(tc->tex_trans, - tile_x, tile_y, TILE_SIZE, TILE_SIZE, + addr.bits.x * TILE_SIZE, + addr.bits.y * TILE_SIZE, + TILE_SIZE, TILE_SIZE, (float *) tile->data.color); - tile->x = tile_x; - tile->y = tile_y; - tile->z = z; - tile->face = face; - tile->level = level; + tile->addr = addr; } + tc->last_tile = tile; return tile; } @@ -633,6 +610,6 @@ sp_tile_cache_clear(struct softpipe_tile_cache *tc, const float *rgba, for (pos = 0; pos < NUM_ENTRIES; pos++) { struct softpipe_cached_tile *tile = tc->entries + pos; - tile->x = tile->y = -1; + tile->addr.bits.invalid = 1; } } diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.h b/src/gallium/drivers/softpipe/sp_tile_cache.h index 0d165b4ad7..3017fcbebc 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.h +++ b/src/gallium/drivers/softpipe/sp_tile_cache.h @@ -44,11 +44,25 @@ struct softpipe_tile_cache; #define TILE_SIZE 64 +/* If we need to support > 4096, just expand this to be a 64 bit + * union, or consider tiling in Z as well. + */ +union tile_address { + struct { + unsigned x:6; /* 4096 / TILE_SIZE */ + unsigned y:6; /* 4096 / TILE_SIZE */ + unsigned z:12; /* 4096 -- z not tiled */ + unsigned face:3; + unsigned level:4; + unsigned invalid:1; + } bits; + unsigned value; +}; + struct softpipe_cached_tile { - int x, y; /**< pos of tile in window coords */ - int z, face, level; /**< Extra texture indexes */ + union tile_address addr; union { float color[TILE_SIZE][TILE_SIZE][4]; uint color32[TILE_SIZE][TILE_SIZE]; @@ -59,6 +73,39 @@ struct softpipe_cached_tile } data; }; +#define NUM_ENTRIES 50 + + +/** XXX move these */ +#define MAX_WIDTH 2048 +#define MAX_HEIGHT 2048 + + +struct softpipe_tile_cache +{ + struct pipe_screen *screen; + struct pipe_surface *surface; /**< the surface we're caching */ + struct pipe_transfer *transfer; + void *transfer_map; + + struct pipe_texture *texture; /**< if caching a texture */ + unsigned timestamp; + + struct softpipe_cached_tile entries[NUM_ENTRIES]; + uint clear_flags[(MAX_WIDTH / TILE_SIZE) * (MAX_HEIGHT / TILE_SIZE) / 32]; + 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; + int tex_face, tex_level, tex_z; + + struct softpipe_cached_tile tile; /**< scratch tile for clears */ + + struct softpipe_cached_tile *last_tile; /**< most recently retrieved tile */ +}; + extern struct softpipe_tile_cache * sp_create_tile_cache( struct pipe_screen *screen ); @@ -97,8 +144,41 @@ extern struct softpipe_cached_tile * sp_get_cached_tile(struct softpipe_tile_cache *tc, int x, int y); extern const struct softpipe_cached_tile * -sp_get_cached_tile_tex(struct softpipe_tile_cache *tc, int x, int y, int z, - int face, int level); +sp_find_cached_tile_tex(struct softpipe_tile_cache *tc, + union tile_address addr ); + +static INLINE const union tile_address +tile_address( unsigned x, + unsigned y, + unsigned z, + unsigned face, + unsigned level ) +{ + union tile_address addr; + + addr.value = 0; + addr.bits.x = x / TILE_SIZE; + addr.bits.y = y / TILE_SIZE; + addr.bits.z = z; + addr.bits.face = face; + addr.bits.level = level; + + return addr; +} + +/* Quickly retrieve tile if it matches last lookup. + */ +static INLINE const struct softpipe_cached_tile * +sp_get_cached_tile_tex(struct softpipe_tile_cache *tc, + union tile_address addr ) +{ + if (tc->last_tile->addr.value == addr.value) + return tc->last_tile; + + return sp_find_cached_tile_tex( tc, addr ); +} + + #endif /* SP_TILE_CACHE_H */ -- cgit v1.2.3 From 19097907ef042b97bbbda39b34bf3212f4cf154a Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 22 Jul 2009 15:36:25 +0100 Subject: softpipe: also shortcircuit non-texture tile lookups --- src/gallium/drivers/softpipe/sp_tile_cache.c | 33 ++++++++++++++-------------- src/gallium/drivers/softpipe/sp_tile_cache.h | 16 +++++++++++++- 2 files changed, 31 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index 06d9c6a80a..77d02fa3e7 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -49,7 +49,7 @@ * a LRU replacement policy. */ #define CACHE_POS(x, y) \ - (((x) / TILE_SIZE + ((y) / TILE_SIZE) * 5) % NUM_ENTRIES) + (((x) + (y) * 5) % NUM_ENTRIES) @@ -57,12 +57,10 @@ * Is the tile at (x,y) in cleared state? */ static INLINE uint -is_clear_flag_set(const uint *bitvec, int x, int y) +is_clear_flag_set(const uint *bitvec, union tile_address addr) { int pos, bit; - x /= TILE_SIZE; - y /= TILE_SIZE; - pos = y * (MAX_WIDTH / TILE_SIZE) + x; + pos = addr.bits.y * (MAX_WIDTH / TILE_SIZE) + addr.bits.x; assert(pos / 32 < (MAX_WIDTH / TILE_SIZE) * (MAX_HEIGHT / TILE_SIZE) / 32); bit = bitvec[pos / 32] & (1 << (pos & 31)); return bit; @@ -73,12 +71,10 @@ is_clear_flag_set(const uint *bitvec, int x, int y) * Mark the tile at (x,y) as not cleared. */ static INLINE void -clear_clear_flag(uint *bitvec, int x, int y) +clear_clear_flag(uint *bitvec, union tile_address addr) { int pos; - x /= TILE_SIZE; - y /= TILE_SIZE; - pos = y * (MAX_WIDTH / TILE_SIZE) + x; + pos = addr.bits.y * (MAX_WIDTH / TILE_SIZE) + addr.bits.x; assert(pos / 32 < (MAX_WIDTH / TILE_SIZE) * (MAX_HEIGHT / TILE_SIZE) / 32); bitvec[pos / 32] &= ~(1 << (pos & 31)); } @@ -349,13 +345,15 @@ sp_tile_cache_flush_clear(struct softpipe_tile_cache *tc) /* push the tile to all positions marked as clear */ for (y = 0; y < h; y += TILE_SIZE) { for (x = 0; x < w; x += TILE_SIZE) { - if (is_clear_flag_set(tc->clear_flags, x, y)) { + union tile_address addr = tile_address(x, y, 0, 0, 0); + + if (is_clear_flag_set(tc->clear_flags, addr)) { pipe_put_tile_raw(pt, x, y, TILE_SIZE, TILE_SIZE, tc->tile.data.color32, 0/*STRIDE*/); /* do this? */ - clear_clear_flag(tc->clear_flags, x, y); + clear_clear_flag(tc->clear_flags, addr); numCleared++; } @@ -424,14 +422,14 @@ sp_flush_tile_cache(struct softpipe_tile_cache *tc) * \param x, y position of tile, in pixels */ struct softpipe_cached_tile * -sp_get_cached_tile(struct softpipe_tile_cache *tc, int x, int y) +sp_find_cached_tile(struct softpipe_tile_cache *tc, + union tile_address addr ) { struct pipe_transfer *pt = tc->transfer; - /* tile pos in framebuffer: */ - union tile_address addr = tile_address( x, y, 0, 0, 0 ); /* cache pos/entry: */ - const int pos = CACHE_POS(x, y); + const int pos = CACHE_POS(addr.bits.x, + addr.bits.y); struct softpipe_cached_tile *tile = tc->entries + pos; if (addr.value != tile->addr.value) { @@ -456,7 +454,7 @@ sp_get_cached_tile(struct softpipe_tile_cache *tc, int x, int y) tile->addr = addr; - if (is_clear_flag_set(tc->clear_flags, x, y)) { + if (is_clear_flag_set(tc->clear_flags, addr)) { /* don't get tile from framebuffer, just clear it */ if (tc->depth_stencil) { clear_tile(tile, pt->format, tc->clear_val); @@ -464,7 +462,7 @@ sp_get_cached_tile(struct softpipe_tile_cache *tc, int x, int y) else { clear_tile_rgba(tile, pt->format, tc->clear_color); } - clear_clear_flag(tc->clear_flags, x, y); + clear_clear_flag(tc->clear_flags, addr); } else { /* get new tile data from transfer */ @@ -485,6 +483,7 @@ sp_get_cached_tile(struct softpipe_tile_cache *tc, int x, int y) } } + tc->last_tile = tile; return tile; } diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.h b/src/gallium/drivers/softpipe/sp_tile_cache.h index 3017fcbebc..ac2aae5875 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.h +++ b/src/gallium/drivers/softpipe/sp_tile_cache.h @@ -141,7 +141,8 @@ 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_tile_cache *tc, int x, int y); +sp_find_cached_tile(struct softpipe_tile_cache *tc, + union tile_address addr ); extern const struct softpipe_cached_tile * sp_find_cached_tile_tex(struct softpipe_tile_cache *tc, @@ -179,6 +180,19 @@ sp_get_cached_tile_tex(struct softpipe_tile_cache *tc, } +static INLINE struct softpipe_cached_tile * +sp_get_cached_tile(struct softpipe_tile_cache *tc, + int x, int y ) +{ + union tile_address addr = tile_address( x, y, 0, 0, 0 ); + + if (tc->last_tile->addr.value == addr.value) + return tc->last_tile; + + return sp_find_cached_tile( tc, addr ); +} + + #endif /* SP_TILE_CACHE_H */ -- cgit v1.2.3 From 93a026d4baf90266f4c9cc48d039b4d65ce1ab6d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 23 Jul 2009 11:14:39 +0100 Subject: softpipe: avoid flushing depth buffer cache on swapbuffers There's no need to push out depth buffer contents on swapbuffers. Note that this change doesn't throw away depth buffer changes, it simply holds them in the cache over calls to swapbuffers. The hope is that swapbuffers will be followed by a clear() which means in that case we won't have to write the changes out. --- src/gallium/drivers/softpipe/sp_context.c | 5 +---- src/gallium/drivers/softpipe/sp_flush.c | 20 +++++++++++++++----- 2 files changed, 16 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index f085889d3a..1b2c6aded0 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -72,13 +72,10 @@ softpipe_unmap_transfers(struct softpipe_context *sp) { uint i; - for (i = 0; i < sp->framebuffer.nr_cbufs; i++) - sp_flush_tile_cache(sp->cbuf_cache[i]); - sp_flush_tile_cache(sp->zsbuf_cache); - for (i = 0; i < sp->framebuffer.nr_cbufs; i++) { sp_tile_cache_unmap_transfers(sp->cbuf_cache[i]); } + sp_tile_cache_unmap_transfers(sp->zsbuf_cache); } diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c index 732277a2c5..679ad0cd3d 100644 --- a/src/gallium/drivers/softpipe/sp_flush.c +++ b/src/gallium/drivers/softpipe/sp_flush.c @@ -56,14 +56,16 @@ softpipe_flush( struct pipe_context *pipe, } } - if (flags & PIPE_FLUSH_RENDER_CACHE) { + if (flags & PIPE_FLUSH_SWAPBUFFERS) { + /* If this is a swapbuffers, just flush color buffers. + * + * The zbuffer changes are not discarded, but held in the cache + * in the hope that a later clear will wipe them out. + */ for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) if (softpipe->cbuf_cache[i]) sp_flush_tile_cache(softpipe->cbuf_cache[i]); - if (softpipe->zsbuf_cache) - sp_flush_tile_cache(softpipe->zsbuf_cache); - /* Need this call for hardware buffers before swapbuffers. * * there should probably be another/different flush-type function @@ -71,7 +73,15 @@ softpipe_flush( struct pipe_context *pipe, * to unmap surfaces when flushing. */ softpipe_unmap_transfers(softpipe); - + } + else if (flags & PIPE_FLUSH_RENDER_CACHE) { + for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) + if (softpipe->cbuf_cache[i]) + sp_flush_tile_cache(softpipe->cbuf_cache[i]); + + if (softpipe->zsbuf_cache) + sp_flush_tile_cache(softpipe->zsbuf_cache); + softpipe->dirty_render_cache = FALSE; } -- cgit v1.2.3 From 6153a1c28f118be1a74ffee0e19c16fb83b5cab7 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 24 Jul 2009 16:12:48 +0100 Subject: softpipe: rip out old mulithread support --- src/gallium/drivers/softpipe/sp_context.c | 48 +++--- src/gallium/drivers/softpipe/sp_context.h | 13 +- src/gallium/drivers/softpipe/sp_quad_pipe.c | 48 ++---- src/gallium/drivers/softpipe/sp_setup.c | 253 ++-------------------------- 4 files changed, 57 insertions(+), 305 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 1b2c6aded0..4418ef0ff4 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -88,19 +88,17 @@ static void softpipe_destroy( struct pipe_context *pipe ) if (softpipe->draw) draw_destroy( softpipe->draw ); - for (i = 0; i < SP_NUM_QUAD_THREADS; i++) { - softpipe->quad[i].polygon_stipple->destroy( softpipe->quad[i].polygon_stipple ); - softpipe->quad[i].earlyz->destroy( softpipe->quad[i].earlyz ); - softpipe->quad[i].shade->destroy( softpipe->quad[i].shade ); - softpipe->quad[i].alpha_test->destroy( softpipe->quad[i].alpha_test ); - softpipe->quad[i].depth_test->destroy( softpipe->quad[i].depth_test ); - softpipe->quad[i].stencil_test->destroy( softpipe->quad[i].stencil_test ); - softpipe->quad[i].occlusion->destroy( softpipe->quad[i].occlusion ); - softpipe->quad[i].coverage->destroy( softpipe->quad[i].coverage ); - softpipe->quad[i].blend->destroy( softpipe->quad[i].blend ); - softpipe->quad[i].colormask->destroy( softpipe->quad[i].colormask ); - softpipe->quad[i].output->destroy( softpipe->quad[i].output ); - } + softpipe->quad.polygon_stipple->destroy( softpipe->quad.polygon_stipple ); + softpipe->quad.earlyz->destroy( softpipe->quad.earlyz ); + softpipe->quad.shade->destroy( softpipe->quad.shade ); + softpipe->quad.alpha_test->destroy( softpipe->quad.alpha_test ); + softpipe->quad.depth_test->destroy( softpipe->quad.depth_test ); + softpipe->quad.stencil_test->destroy( softpipe->quad.stencil_test ); + softpipe->quad.occlusion->destroy( softpipe->quad.occlusion ); + softpipe->quad.coverage->destroy( softpipe->quad.coverage ); + softpipe->quad.blend->destroy( softpipe->quad.blend ); + softpipe->quad.colormask->destroy( softpipe->quad.colormask ); + softpipe->quad.output->destroy( softpipe->quad.output ); for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) sp_destroy_tile_cache(softpipe->cbuf_cache[i]); @@ -234,19 +232,17 @@ softpipe_create( struct pipe_screen *screen ) /* setup quad rendering stages */ - for (i = 0; i < SP_NUM_QUAD_THREADS; i++) { - softpipe->quad[i].polygon_stipple = sp_quad_polygon_stipple_stage(softpipe); - softpipe->quad[i].earlyz = sp_quad_earlyz_stage(softpipe); - softpipe->quad[i].shade = sp_quad_shade_stage(softpipe); - softpipe->quad[i].alpha_test = sp_quad_alpha_test_stage(softpipe); - softpipe->quad[i].depth_test = sp_quad_depth_test_stage(softpipe); - softpipe->quad[i].stencil_test = sp_quad_stencil_test_stage(softpipe); - softpipe->quad[i].occlusion = sp_quad_occlusion_stage(softpipe); - softpipe->quad[i].coverage = sp_quad_coverage_stage(softpipe); - softpipe->quad[i].blend = sp_quad_blend_stage(softpipe); - softpipe->quad[i].colormask = sp_quad_colormask_stage(softpipe); - softpipe->quad[i].output = sp_quad_output_stage(softpipe); - } + softpipe->quad.polygon_stipple = sp_quad_polygon_stipple_stage(softpipe); + softpipe->quad.earlyz = sp_quad_earlyz_stage(softpipe); + softpipe->quad.shade = sp_quad_shade_stage(softpipe); + softpipe->quad.alpha_test = sp_quad_alpha_test_stage(softpipe); + softpipe->quad.depth_test = sp_quad_depth_test_stage(softpipe); + softpipe->quad.stencil_test = sp_quad_stencil_test_stage(softpipe); + softpipe->quad.occlusion = sp_quad_occlusion_stage(softpipe); + softpipe->quad.coverage = sp_quad_coverage_stage(softpipe); + softpipe->quad.blend = sp_quad_blend_stage(softpipe); + softpipe->quad.colormask = sp_quad_colormask_stage(softpipe); + softpipe->quad.output = sp_quad_output_stage(softpipe); /* vertex shader samplers */ for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index f66f0b7849..414d903a37 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -39,17 +39,6 @@ #include "sp_tex_sample.h" -/** - * This is a temporary variable for testing draw-stage polygon stipple. - * If zero, do stipple in sp_quad_stipple.c - */ -#define USE_DRAW_STAGE_PSTIPPLE 1 - -/* Number of threads working on individual quads. - * Setting to 1 disables this feature. - */ -#define SP_NUM_QUAD_THREADS 1 - struct softpipe_vbuf_render; struct draw_context; struct draw_stage; @@ -129,7 +118,7 @@ struct softpipe_context { struct quad_stage *output; struct quad_stage *first; /**< points to one of the above stages */ - } quad[SP_NUM_QUAD_THREADS]; + } quad; /** TGSI exec things */ struct { diff --git a/src/gallium/drivers/softpipe/sp_quad_pipe.c b/src/gallium/drivers/softpipe/sp_quad_pipe.c index b5f69b7426..3a3359d303 100644 --- a/src/gallium/drivers/softpipe/sp_quad_pipe.c +++ b/src/gallium/drivers/softpipe/sp_quad_pipe.c @@ -31,35 +31,29 @@ #include "pipe/p_shader_tokens.h" static void -sp_push_quad_first( - struct softpipe_context *sp, - struct quad_stage *quad, - uint i ) +sp_push_quad_first( struct softpipe_context *sp, + struct quad_stage *quad ) { - quad->next = sp->quad[i].first; - sp->quad[i].first = quad; + quad->next = sp->quad.first; + sp->quad.first = quad; } static void -sp_build_depth_stencil( - struct softpipe_context *sp, - uint i ) +sp_build_depth_stencil( struct softpipe_context *sp ) { if (sp->depth_stencil->stencil[0].enabled || sp->depth_stencil->stencil[1].enabled) { - sp_push_quad_first( sp, sp->quad[i].stencil_test, i ); + sp_push_quad_first( sp, sp->quad.stencil_test ); } else if (sp->depth_stencil->depth.enabled && sp->framebuffer.zsbuf) { - sp_push_quad_first( sp, sp->quad[i].depth_test, i ); + sp_push_quad_first( sp, sp->quad.depth_test ); } } void sp_build_quad_pipeline(struct softpipe_context *sp) { - uint i; - boolean early_depth_test = sp->depth_stencil->depth.enabled && sp->framebuffer.zsbuf && @@ -68,51 +62,43 @@ sp_build_quad_pipeline(struct softpipe_context *sp) !sp->fs->info.writes_z; /* build up the pipeline in reverse order... */ - for (i = 0; i < SP_NUM_QUAD_THREADS; i++) { - sp->quad[i].first = sp->quad[i].output; + sp->quad.first = sp->quad.output; if (sp->blend->colormask != 0xf) { - sp_push_quad_first( sp, sp->quad[i].colormask, i ); + sp_push_quad_first( sp, sp->quad.colormask ); } if (sp->blend->blend_enable || sp->blend->logicop_enable) { - sp_push_quad_first( sp, sp->quad[i].blend, i ); + sp_push_quad_first( sp, sp->quad.blend ); } if (sp->active_query_count) { - sp_push_quad_first( sp, sp->quad[i].occlusion, i ); + sp_push_quad_first( sp, sp->quad.occlusion ); } if (sp->rasterizer->poly_smooth || sp->rasterizer->line_smooth || sp->rasterizer->point_smooth) { - sp_push_quad_first( sp, sp->quad[i].coverage, i ); + sp_push_quad_first( sp, sp->quad.coverage ); } if (!early_depth_test) { - sp_build_depth_stencil( sp, i ); + sp_build_depth_stencil( sp ); } if (sp->depth_stencil->alpha.enabled) { - sp_push_quad_first( sp, sp->quad[i].alpha_test, i ); + sp_push_quad_first( sp, sp->quad.alpha_test ); } /* XXX always enable shader? */ if (1) { - sp_push_quad_first( sp, sp->quad[i].shade, i ); + sp_push_quad_first( sp, sp->quad.shade ); } if (early_depth_test) { - sp_build_depth_stencil( sp, i ); - sp_push_quad_first( sp, sp->quad[i].earlyz, i ); - } - -#if !USE_DRAW_STAGE_PSTIPPLE - if (sp->rasterizer->poly_stipple_enable) { - sp_push_quad_first( sp, sp->quad[i].polygon_stipple, i ); + sp_build_depth_stencil( sp ); + sp_push_quad_first( sp, sp->quad.earlyz ); } -#endif - } } diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c index d05c9ad57c..eaf84ed9de 100644 --- a/src/gallium/drivers/softpipe/sp_setup.c +++ b/src/gallium/drivers/softpipe/sp_setup.c @@ -61,87 +61,7 @@ struct edge { int lines; /**< number of lines on this edge */ }; -#if SP_NUM_QUAD_THREADS > 1 -/* Set to 1 if you want other threads to be instantly - * notified of pending jobs. - */ -#define INSTANT_NOTEMPTY_NOTIFY 0 - -struct thread_info -{ - struct setup_context *setup; - uint id; - pipe_thread handle; -}; - -struct quad_job; - -typedef void (* quad_job_routine)( struct setup_context *setup, uint thread, struct quad_job *job ); - -struct quad_job -{ - struct quad_header_input input; - struct quad_header_inout inout; - quad_job_routine routine; -}; - -#define NUM_QUAD_JOBS 64 - -struct quad_job_que -{ - struct quad_job jobs[NUM_QUAD_JOBS]; - uint first; - uint last; - pipe_mutex que_mutex; - pipe_condvar que_notfull_condvar; - pipe_condvar que_notempty_condvar; - uint jobs_added; - uint jobs_done; - pipe_condvar que_done_condvar; -}; - -static void -add_quad_job( struct quad_job_que *que, struct quad_header *quad, quad_job_routine routine ) -{ -#if INSTANT_NOTEMPTY_NOTIFY - boolean empty; -#endif - - /* Wait for empty slot, see if the que is empty. - */ - pipe_mutex_lock( que->que_mutex ); - while ((que->last + 1) % NUM_QUAD_JOBS == que->first) { -#if !INSTANT_NOTEMPTY_NOTIFY - pipe_condvar_broadcast( que->que_notempty_condvar ); -#endif - pipe_condvar_wait( que->que_notfull_condvar, que->que_mutex ); - } -#if INSTANT_NOTEMPTY_NOTIFY - empty = que->last == que->first; -#endif - que->jobs_added++; - pipe_mutex_unlock( que->que_mutex ); - - /* Submit new job. - */ - que->jobs[que->last].input = quad->input; - que->jobs[que->last].inout = quad->inout; - que->jobs[que->last].routine = routine; - que->last = (que->last + 1) % NUM_QUAD_JOBS; - -#if INSTANT_NOTEMPTY_NOTIFY - /* If the que was empty, notify consumers there's a job to be done. - */ - if (empty) { - pipe_mutex_lock( que->que_mutex ); - pipe_condvar_broadcast( que->que_notempty_condvar ); - pipe_mutex_unlock( que->que_mutex ); - } -#endif -} - -#endif /** * Triangle setup info (derived from draw_stage). @@ -169,11 +89,6 @@ struct setup_context { struct tgsi_interp_coef posCoef; /* For Z, W */ struct quad_header quad; -#if SP_NUM_QUAD_THREADS > 1 - struct quad_job_que que; - struct thread_info threads[SP_NUM_QUAD_THREADS]; -#endif - struct { int left[2]; /**< [0] = row0, [1] = row1 */ int right[2]; @@ -188,67 +103,6 @@ struct setup_context { unsigned winding; /* which winding to cull */ }; -#if SP_NUM_QUAD_THREADS > 1 - -static PIPE_THREAD_ROUTINE( quad_thread, param ) -{ - struct thread_info *info = (struct thread_info *) param; - struct quad_job_que *que = &info->setup->que; - - for (;;) { - struct quad_job job; - boolean full; - - /* Wait for an available job. - */ - pipe_mutex_lock( que->que_mutex ); - while (que->last == que->first) - pipe_condvar_wait( que->que_notempty_condvar, que->que_mutex ); - - /* See if the que is full. - */ - full = (que->last + 1) % NUM_QUAD_JOBS == que->first; - - /* Take a job and remove it from que. - */ - job = que->jobs[que->first]; - que->first = (que->first + 1) % NUM_QUAD_JOBS; - - /* Notify the producer if the que is not full. - */ - if (full) - pipe_condvar_signal( que->que_notfull_condvar ); - pipe_mutex_unlock( que->que_mutex ); - - job.routine( info->setup, info->id, &job ); - - /* Notify the producer if that's the last finished job. - */ - pipe_mutex_lock( que->que_mutex ); - que->jobs_done++; - if (que->jobs_added == que->jobs_done) - pipe_condvar_signal( que->que_done_condvar ); - pipe_mutex_unlock( que->que_mutex ); - } - - return NULL; -} - -#define WAIT_FOR_COMPLETION(setup) \ - do {\ - pipe_mutex_lock( setup->que.que_mutex );\ - if (!INSTANT_NOTEMPTY_NOTIFY)\ - pipe_condvar_broadcast( setup->que.que_notempty_condvar );\ - while (setup->que.jobs_added != setup->que.jobs_done)\ - pipe_condvar_wait( setup->que.que_done_condvar, setup->que.que_mutex );\ - pipe_mutex_unlock( setup->que.que_mutex );\ - } while (0) - -#else - -#define WAIT_FOR_COMPLETION(setup) ((void) 0) - -#endif @@ -311,39 +165,17 @@ quad_clip( struct setup_context *setup, struct quad_header *quad ) * Emit a quad (pass to next stage) with clipping. */ static INLINE void -clip_emit_quad( struct setup_context *setup, struct quad_header *quad, uint thread ) +clip_emit_quad( struct setup_context *setup, struct quad_header *quad ) { quad_clip( setup, quad ); + if (quad->inout.mask) { struct softpipe_context *sp = setup->softpipe; - sp->quad[thread].first->run( sp->quad[thread].first, quad ); + sp->quad.first->run( sp->quad.first, quad ); } } -#if SP_NUM_QUAD_THREADS > 1 - -static void -clip_emit_quad_job( struct setup_context *setup, uint thread, struct quad_job *job ) -{ - struct quad_header quad; - - quad.input = job->input; - quad.inout = job->inout; - quad.coef = setup->quad.coef; - quad.posCoef = setup->quad.posCoef; - quad.nr_attrs = setup->quad.nr_attrs; - clip_emit_quad( setup, &quad, thread ); -} - -#define CLIP_EMIT_QUAD(setup) add_quad_job( &setup->que, &setup->quad, clip_emit_quad_job ) - -#else - -#define CLIP_EMIT_QUAD(setup) clip_emit_quad( setup, &setup->quad, 0 ) - -#endif - /** * Emit a quad (pass to next stage). No clipping is done. */ @@ -361,7 +193,7 @@ emit_quad( struct setup_context *setup, struct quad_header *quad, uint thread ) if (mask & 4) setup->numFragsEmitted++; if (mask & 8) setup->numFragsEmitted++; #endif - sp->quad[thread].first->run( sp->quad[thread].first, quad ); + sp->quad.first->run( sp->quad.first, quad ); #if DEBUG_FRAGS mask = quad->inout.mask; if (mask & 1) setup->numFragsWritten++; @@ -371,38 +203,15 @@ emit_quad( struct setup_context *setup, struct quad_header *quad, uint thread ) #endif } -#if SP_NUM_QUAD_THREADS > 1 - -static void -emit_quad_job( struct setup_context *setup, uint thread, struct quad_job *job ) -{ - struct quad_header quad; - - quad.input = job->input; - quad.inout = job->inout; - quad.coef = setup->quad.coef; - quad.posCoef = setup->quad.posCoef; - quad.nr_attrs = setup->quad.nr_attrs; - emit_quad( setup, &quad, thread ); -} - -#define EMIT_QUAD(setup,x,y,qmask) do {\ - setup->quad.input.x0 = x;\ - setup->quad.input.y0 = y;\ - setup->quad.inout.mask = qmask;\ - add_quad_job( &setup->que, &setup->quad, emit_quad_job );\ - } while (0) -#else +#define EMIT_QUAD(setup,x,y,qmask) \ +do { \ + setup->quad.input.x0 = x; \ + setup->quad.input.y0 = y; \ + setup->quad.inout.mask = qmask; \ + emit_quad( setup, &setup->quad, 0 ); \ +} while (0) -#define EMIT_QUAD(setup,x,y,qmask) do {\ - setup->quad.input.x0 = x;\ - setup->quad.input.y0 = y;\ - setup->quad.inout.mask = qmask;\ - emit_quad( setup, &setup->quad, 0 );\ - } while (0) - -#endif /** * Given an X or Y coordinate, return the block/quad coordinate that it @@ -956,8 +765,6 @@ void setup_tri( struct setup_context *setup, flush_spans( setup ); - WAIT_FOR_COMPLETION(setup); - #if DEBUG_FRAGS printf("Tri: %u frags emitted, %u written\n", setup->numFragsEmitted, @@ -1101,7 +908,7 @@ plot(struct setup_context *setup, int x, int y) /* flush prev quad, start new quad */ if (setup->quad.input.x0 != -1) - CLIP_EMIT_QUAD(setup); + clip_emit_quad( setup, &setup->quad ); setup->quad.input.x0 = quadX; setup->quad.input.y0 = quadY; @@ -1223,10 +1030,8 @@ setup_line(struct setup_context *setup, /* draw final quad */ if (setup->quad.inout.mask) { - CLIP_EMIT_QUAD(setup); + clip_emit_quad( setup, &setup->quad ); } - - WAIT_FOR_COMPLETION(setup); } @@ -1334,7 +1139,7 @@ setup_point( struct setup_context *setup, setup->quad.input.x0 = (int) x - ix; setup->quad.input.y0 = (int) y - iy; setup->quad.inout.mask = (1 << ix) << (2 * iy); - CLIP_EMIT_QUAD(setup); + clip_emit_quad( setup, &setup->quad ); } else { if (round) { @@ -1395,7 +1200,7 @@ setup_point( struct setup_context *setup, if (setup->quad.inout.mask) { setup->quad.input.x0 = ix; setup->quad.input.y0 = iy; - CLIP_EMIT_QUAD(setup); + clip_emit_quad( setup, &setup->quad ); } } } @@ -1442,19 +1247,16 @@ setup_point( struct setup_context *setup, setup->quad.inout.mask = mask; setup->quad.input.x0 = ix; setup->quad.input.y0 = iy; - CLIP_EMIT_QUAD(setup); + clip_emit_quad( setup, &setup->quad ); } } } } - - WAIT_FOR_COMPLETION(setup); } void setup_prepare( struct setup_context *setup ) { struct softpipe_context *sp = setup->softpipe; - unsigned i; if (sp->dirty) { softpipe_update_derived(sp); @@ -1463,9 +1265,7 @@ void setup_prepare( struct setup_context *setup ) /* Note: nr_attrs is only used for debugging (vertex printing) */ setup->quad.nr_attrs = draw_num_vs_outputs(sp->draw); - for (i = 0; i < SP_NUM_QUAD_THREADS; i++) { - sp->quad[i].first->begin( sp->quad[i].first ); - } + sp->quad.first->begin( sp->quad.first ); if (sp->reduced_api_prim == PIPE_PRIM_TRIANGLES && sp->rasterizer->fill_cw == PIPE_POLYGON_MODE_FILL && @@ -1493,9 +1293,6 @@ void setup_destroy_context( struct setup_context *setup ) struct setup_context *setup_create_context( struct softpipe_context *softpipe ) { struct setup_context *setup = CALLOC_STRUCT(setup_context); -#if SP_NUM_QUAD_THREADS > 1 - uint i; -#endif setup->softpipe = softpipe; @@ -1505,22 +1302,6 @@ struct setup_context *setup_create_context( struct softpipe_context *softpipe ) setup->span.left[0] = 1000000; /* greater than right[0] */ setup->span.left[1] = 1000000; /* greater than right[1] */ -#if SP_NUM_QUAD_THREADS > 1 - setup->que.first = 0; - setup->que.last = 0; - pipe_mutex_init( setup->que.que_mutex ); - pipe_condvar_init( setup->que.que_notfull_condvar ); - pipe_condvar_init( setup->que.que_notempty_condvar ); - setup->que.jobs_added = 0; - setup->que.jobs_done = 0; - pipe_condvar_init( setup->que.que_done_condvar ); - for (i = 0; i < SP_NUM_QUAD_THREADS; i++) { - setup->threads[i].setup = setup; - setup->threads[i].id = i; - setup->threads[i].handle = pipe_thread_create( quad_thread, &setup->threads[i] ); - } -#endif - return setup; } -- cgit v1.2.3 From ab9fb5167023a26566b53e98f206dd73a18000f3 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 24 Jul 2009 16:49:35 +0100 Subject: softpipe: expand quad pipeline to process >1 quad at a time This is part one -- we still only pass a single quad down, but the code can now cope with more. The quads must all be from the same tile. --- src/gallium/drivers/softpipe/sp_quad_alpha_test.c | 106 ++-- src/gallium/drivers/softpipe/sp_quad_blend.c | 730 +++++++++++----------- src/gallium/drivers/softpipe/sp_quad_colormask.c | 15 +- src/gallium/drivers/softpipe/sp_quad_coverage.c | 48 +- src/gallium/drivers/softpipe/sp_quad_depth_test.c | 23 +- src/gallium/drivers/softpipe/sp_quad_earlyz.c | 28 +- src/gallium/drivers/softpipe/sp_quad_fs.c | 40 +- src/gallium/drivers/softpipe/sp_quad_occlusion.c | 10 +- src/gallium/drivers/softpipe/sp_quad_output.c | 49 +- src/gallium/drivers/softpipe/sp_quad_pipe.c | 88 +-- src/gallium/drivers/softpipe/sp_quad_pipe.h | 4 +- src/gallium/drivers/softpipe/sp_quad_stencil.c | 185 +++--- src/gallium/drivers/softpipe/sp_quad_stipple.c | 48 +- src/gallium/drivers/softpipe/sp_setup.c | 4 +- 14 files changed, 745 insertions(+), 633 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_quad_alpha_test.c b/src/gallium/drivers/softpipe/sp_quad_alpha_test.c index 0845bae0e6..3a282208b6 100644 --- a/src/gallium/drivers/softpipe/sp_quad_alpha_test.c +++ b/src/gallium/drivers/softpipe/sp_quad_alpha_test.c @@ -9,76 +9,80 @@ #include "pipe/p_defines.h" #include "util/u_memory.h" +#define ALPHATEST( FUNC, COMP ) \ + static void \ + alpha_test_quads_##FUNC( struct quad_stage *qs, \ + struct quad_header *quads[], \ + unsigned nr ) \ + { \ + const float ref = qs->softpipe->depth_stencil->alpha.ref_value; \ + const uint cbuf = 0; /* only output[0].alpha is tested */ \ + unsigned pass_nr = 0; \ + unsigned i; \ + \ + for (i = 0; i < nr; i++) { \ + const float *aaaa = quads[i]->output.color[cbuf][3]; \ + unsigned passMask = 0; \ + \ + if (aaaa[0] COMP ref) passMask |= (1 << 0); \ + if (aaaa[1] COMP ref) passMask |= (1 << 1); \ + if (aaaa[2] COMP ref) passMask |= (1 << 2); \ + if (aaaa[3] COMP ref) passMask |= (1 << 3); \ + \ + quads[i]->inout.mask &= passMask; \ + \ + if (quads[i]->inout.mask) \ + quads[pass_nr++] = quads[i]; \ + } \ + \ + if (pass_nr) \ + qs->next->run(qs->next, quads, pass_nr); \ + } + + +ALPHATEST( LESS, < ) +ALPHATEST( EQUAL, == ) +ALPHATEST( LEQUAL, <= ) +ALPHATEST( GREATER, > ) +ALPHATEST( NOTEQUAL, != ) +ALPHATEST( GEQUAL, >= ) + +/* XXX: Incorporate into shader using KILP. + */ static void -alpha_test_quad(struct quad_stage *qs, struct quad_header *quad) +alpha_test_quad(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) { - struct softpipe_context *softpipe = qs->softpipe; - const float ref = softpipe->depth_stencil->alpha.ref_value; - unsigned passMask = 0x0, j; - const uint cbuf = 0; /* only output[0].alpha is tested */ - const float *aaaa = quad->output.color[cbuf][3]; - - switch (softpipe->depth_stencil->alpha.func) { - case PIPE_FUNC_NEVER: - break; + switch (qs->softpipe->depth_stencil->alpha.func) { case PIPE_FUNC_LESS: - /* - * If mask were an array [4] we could do this SIMD-style: - * passMask = (quad->outputs.color[0][3] <= vec4(ref)); - */ - for (j = 0; j < QUAD_SIZE; j++) { - if (aaaa[j] < ref) { - passMask |= (1 << j); - } - } + alpha_test_quads_LESS( qs, quads, nr ); break; case PIPE_FUNC_EQUAL: - for (j = 0; j < QUAD_SIZE; j++) { - if (aaaa[j] == ref) { - passMask |= (1 << j); - } - } + alpha_test_quads_EQUAL( qs, quads, nr ); break; case PIPE_FUNC_LEQUAL: - for (j = 0; j < QUAD_SIZE; j++) { - if (aaaa[j] <= ref) { - passMask |= (1 << j); - } - } + alpha_test_quads_LEQUAL( qs, quads, nr ); break; case PIPE_FUNC_GREATER: - for (j = 0; j < QUAD_SIZE; j++) { - if (aaaa[j] > ref) { - passMask |= (1 << j); - } - } + alpha_test_quads_GREATER( qs, quads, nr ); break; case PIPE_FUNC_NOTEQUAL: - for (j = 0; j < QUAD_SIZE; j++) { - if (aaaa[j] != ref) { - passMask |= (1 << j); - } - } + alpha_test_quads_NOTEQUAL( qs, quads, nr ); break; case PIPE_FUNC_GEQUAL: - for (j = 0; j < QUAD_SIZE; j++) { - if (aaaa[j] >= ref) { - passMask |= (1 << j); - } - } + alpha_test_quads_GEQUAL( qs, quads, nr ); break; case PIPE_FUNC_ALWAYS: - passMask = MASK_ALL; + assert(0); /* should be caught earlier */ + qs->next->run(qs->next, quads, nr); break; + case PIPE_FUNC_NEVER: default: - assert(0); + assert(0); /* should be caught earlier */ + return; } - - quad->inout.mask &= passMask; - - if (quad->inout.mask) - qs->next->run(qs->next, quad); } diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c index 04b5daf3a4..fdf1bb4552 100644 --- a/src/gallium/drivers/softpipe/sp_quad_blend.c +++ b/src/gallium/drivers/softpipe/sp_quad_blend.c @@ -117,10 +117,16 @@ do { \ static void -logicop_quad(struct quad_stage *qs, struct quad_header *quad) +logicop_quad(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) { struct softpipe_context *softpipe = qs->softpipe; uint cbuf; + struct softpipe_cached_tile * + tile = sp_get_cached_tile(softpipe->cbuf_cache[cbuf], + quads[0]->input.x0, + quads[0]->input.y0); /* loop over colorbuffer outputs */ for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) { @@ -129,165 +135,161 @@ logicop_quad(struct quad_stage *qs, struct quad_header *quad) uint *src4 = (uint *) src; uint *dst4 = (uint *) dst; uint *res4 = (uint *) res; - struct softpipe_cached_tile * - tile = sp_get_cached_tile(softpipe->cbuf_cache[cbuf], - quad->input.x0, quad->input.y0); - float (*quadColor)[4] = quad->output.color[cbuf]; uint i, j; - /* get/swizzle dest colors */ - for (j = 0; j < QUAD_SIZE; j++) { - int x = (quad->input.x0 & (TILE_SIZE-1)) + (j & 1); - int y = (quad->input.y0 & (TILE_SIZE-1)) + (j >> 1); - for (i = 0; i < 4; i++) { - dest[i][j] = tile->data.color[y][x][i]; + for (i = 0; i < nr; i++) { + struct quad_header *quad = quads[i]; + float (*quadColor)[4] = quad->output.color[cbuf]; + + /* get/swizzle dest colors */ + for (j = 0; j < QUAD_SIZE; j++) { + int x = (quad->input.x0 & (TILE_SIZE-1)) + (j & 1); + int y = (quad->input.y0 & (TILE_SIZE-1)) + (j >> 1); + for (i = 0; i < 4; i++) { + dest[i][j] = tile->data.color[y][x][i]; + } } - } - /* convert to ubyte */ - for (j = 0; j < 4; j++) { /* loop over R,G,B,A channels */ - dst[j][0] = float_to_ubyte(dest[j][0]); /* P0 */ - dst[j][1] = float_to_ubyte(dest[j][1]); /* P1 */ - dst[j][2] = float_to_ubyte(dest[j][2]); /* P2 */ - dst[j][3] = float_to_ubyte(dest[j][3]); /* P3 */ - - src[j][0] = float_to_ubyte(quadColor[j][0]); /* P0 */ - src[j][1] = float_to_ubyte(quadColor[j][1]); /* P1 */ - src[j][2] = float_to_ubyte(quadColor[j][2]); /* P2 */ - src[j][3] = float_to_ubyte(quadColor[j][3]); /* P3 */ - } + /* convert to ubyte */ + for (j = 0; j < 4; j++) { /* loop over R,G,B,A channels */ + dst[j][0] = float_to_ubyte(dest[j][0]); /* P0 */ + dst[j][1] = float_to_ubyte(dest[j][1]); /* P1 */ + dst[j][2] = float_to_ubyte(dest[j][2]); /* P2 */ + dst[j][3] = float_to_ubyte(dest[j][3]); /* P3 */ + + src[j][0] = float_to_ubyte(quadColor[j][0]); /* P0 */ + src[j][1] = float_to_ubyte(quadColor[j][1]); /* P1 */ + src[j][2] = float_to_ubyte(quadColor[j][2]); /* P2 */ + src[j][3] = float_to_ubyte(quadColor[j][3]); /* P3 */ + } - switch (softpipe->blend->logicop_func) { - case PIPE_LOGICOP_CLEAR: - for (j = 0; j < 4; j++) - res4[j] = 0; - break; - case PIPE_LOGICOP_NOR: - for (j = 0; j < 4; j++) - res4[j] = ~(src4[j] | dst4[j]); - break; - case PIPE_LOGICOP_AND_INVERTED: - for (j = 0; j < 4; j++) - res4[j] = ~src4[j] & dst4[j]; - break; - case PIPE_LOGICOP_COPY_INVERTED: - for (j = 0; j < 4; j++) - res4[j] = ~src4[j]; - break; - case PIPE_LOGICOP_AND_REVERSE: - for (j = 0; j < 4; j++) - res4[j] = src4[j] & ~dst4[j]; - break; - case PIPE_LOGICOP_INVERT: - for (j = 0; j < 4; j++) - res4[j] = ~dst4[j]; - break; - case PIPE_LOGICOP_XOR: - for (j = 0; j < 4; j++) - res4[j] = dst4[j] ^ src4[j]; - break; - case PIPE_LOGICOP_NAND: - for (j = 0; j < 4; j++) - res4[j] = ~(src4[j] & dst4[j]); - break; - case PIPE_LOGICOP_AND: - for (j = 0; j < 4; j++) - res4[j] = src4[j] & dst4[j]; - break; - case PIPE_LOGICOP_EQUIV: - for (j = 0; j < 4; j++) - res4[j] = ~(src4[j] ^ dst4[j]); - break; - case PIPE_LOGICOP_NOOP: - for (j = 0; j < 4; j++) - res4[j] = dst4[j]; - break; - case PIPE_LOGICOP_OR_INVERTED: - for (j = 0; j < 4; j++) - res4[j] = ~src4[j] | dst4[j]; - break; - case PIPE_LOGICOP_COPY: - for (j = 0; j < 4; j++) - res4[j] = src4[j]; - break; - case PIPE_LOGICOP_OR_REVERSE: - for (j = 0; j < 4; j++) - res4[j] = src4[j] | ~dst4[j]; - break; - case PIPE_LOGICOP_OR: - for (j = 0; j < 4; j++) - res4[j] = src4[j] | dst4[j]; - break; - case PIPE_LOGICOP_SET: - for (j = 0; j < 4; j++) - res4[j] = ~0; - break; - default: - assert(0); - } + switch (softpipe->blend->logicop_func) { + case PIPE_LOGICOP_CLEAR: + for (j = 0; j < 4; j++) + res4[j] = 0; + break; + case PIPE_LOGICOP_NOR: + for (j = 0; j < 4; j++) + res4[j] = ~(src4[j] | dst4[j]); + break; + case PIPE_LOGICOP_AND_INVERTED: + for (j = 0; j < 4; j++) + res4[j] = ~src4[j] & dst4[j]; + break; + case PIPE_LOGICOP_COPY_INVERTED: + for (j = 0; j < 4; j++) + res4[j] = ~src4[j]; + break; + case PIPE_LOGICOP_AND_REVERSE: + for (j = 0; j < 4; j++) + res4[j] = src4[j] & ~dst4[j]; + break; + case PIPE_LOGICOP_INVERT: + for (j = 0; j < 4; j++) + res4[j] = ~dst4[j]; + break; + case PIPE_LOGICOP_XOR: + for (j = 0; j < 4; j++) + res4[j] = dst4[j] ^ src4[j]; + break; + case PIPE_LOGICOP_NAND: + for (j = 0; j < 4; j++) + res4[j] = ~(src4[j] & dst4[j]); + break; + case PIPE_LOGICOP_AND: + for (j = 0; j < 4; j++) + res4[j] = src4[j] & dst4[j]; + break; + case PIPE_LOGICOP_EQUIV: + for (j = 0; j < 4; j++) + res4[j] = ~(src4[j] ^ dst4[j]); + break; + case PIPE_LOGICOP_NOOP: + for (j = 0; j < 4; j++) + res4[j] = dst4[j]; + break; + case PIPE_LOGICOP_OR_INVERTED: + for (j = 0; j < 4; j++) + res4[j] = ~src4[j] | dst4[j]; + break; + case PIPE_LOGICOP_COPY: + for (j = 0; j < 4; j++) + res4[j] = src4[j]; + break; + case PIPE_LOGICOP_OR_REVERSE: + for (j = 0; j < 4; j++) + res4[j] = src4[j] | ~dst4[j]; + break; + case PIPE_LOGICOP_OR: + for (j = 0; j < 4; j++) + res4[j] = src4[j] | dst4[j]; + break; + case PIPE_LOGICOP_SET: + for (j = 0; j < 4; j++) + res4[j] = ~0; + break; + default: + assert(0); + } - for (j = 0; j < 4; j++) { - quadColor[j][0] = ubyte_to_float(res[j][0]); - quadColor[j][1] = ubyte_to_float(res[j][1]); - quadColor[j][2] = ubyte_to_float(res[j][2]); - quadColor[j][3] = ubyte_to_float(res[j][3]); + for (j = 0; j < 4; j++) { + quadColor[j][0] = ubyte_to_float(res[j][0]); + quadColor[j][1] = ubyte_to_float(res[j][1]); + quadColor[j][2] = ubyte_to_float(res[j][2]); + quadColor[j][3] = ubyte_to_float(res[j][3]); + } } } - - /* pass quad to next stage */ - qs->next->run(qs->next, quad); } - - static void -blend_quad(struct quad_stage *qs, struct quad_header *quad) +blend_quads(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) { static const float zero[4] = { 0, 0, 0, 0 }; static const float one[4] = { 1, 1, 1, 1 }; - struct softpipe_context *softpipe = qs->softpipe; uint cbuf; - if (softpipe->blend->logicop_enable) { - logicop_quad(qs, quad); - return; - } - /* loop over colorbuffer outputs */ for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) { float source[4][QUAD_SIZE], dest[4][QUAD_SIZE]; struct softpipe_cached_tile *tile = sp_get_cached_tile(softpipe->cbuf_cache[cbuf], - quad->input.x0, quad->input.y0); - float (*quadColor)[4] = quad->output.color[cbuf]; - uint i, j; - - /* get/swizzle dest colors */ - for (j = 0; j < QUAD_SIZE; j++) { - int x = (quad->input.x0 & (TILE_SIZE-1)) + (j & 1); - int y = (quad->input.y0 & (TILE_SIZE-1)) + (j >> 1); - for (i = 0; i < 4; i++) { - dest[i][j] = tile->data.color[y][x][i]; + quads[0]->input.x0, + quads[0]->input.y0); + uint q, i, j; + + for (q = 0; q < nr; q++) { + struct quad_header *quad = quads[q]; + float (*quadColor)[4] = quad->output.color[cbuf]; + + /* get/swizzle dest colors */ + for (j = 0; j < QUAD_SIZE; j++) { + int x = (quad->input.x0 & (TILE_SIZE-1)) + (j & 1); + int y = (quad->input.y0 & (TILE_SIZE-1)) + (j >> 1); + for (i = 0; i < 4; i++) { + dest[i][j] = tile->data.color[y][x][i]; + } } - } - /* - * Compute src/first term RGB - */ - switch (softpipe->blend->rgb_src_factor) { - case PIPE_BLENDFACTOR_ONE: - VEC4_COPY(source[0], quadColor[0]); /* R */ - VEC4_COPY(source[1], quadColor[1]); /* G */ - VEC4_COPY(source[2], quadColor[2]); /* B */ - break; - case PIPE_BLENDFACTOR_SRC_COLOR: - VEC4_MUL(source[0], quadColor[0], quadColor[0]); /* R */ - VEC4_MUL(source[1], quadColor[1], quadColor[1]); /* G */ - VEC4_MUL(source[2], quadColor[2], quadColor[2]); /* B */ - break; - case PIPE_BLENDFACTOR_SRC_ALPHA: + /* + * Compute src/first term RGB + */ + switch (softpipe->blend->rgb_src_factor) { + case PIPE_BLENDFACTOR_ONE: + VEC4_COPY(source[0], quadColor[0]); /* R */ + VEC4_COPY(source[1], quadColor[1]); /* G */ + VEC4_COPY(source[2], quadColor[2]); /* B */ + break; + case PIPE_BLENDFACTOR_SRC_COLOR: + VEC4_MUL(source[0], quadColor[0], quadColor[0]); /* R */ + VEC4_MUL(source[1], quadColor[1], quadColor[1]); /* G */ + VEC4_MUL(source[2], quadColor[2], quadColor[2]); /* B */ + break; + case PIPE_BLENDFACTOR_SRC_ALPHA: { const float *alpha = quadColor[3]; VEC4_MUL(source[0], quadColor[0], alpha); /* R */ @@ -295,12 +297,12 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) VEC4_MUL(source[2], quadColor[2], alpha); /* B */ } break; - case PIPE_BLENDFACTOR_DST_COLOR: - VEC4_MUL(source[0], quadColor[0], dest[0]); /* R */ - VEC4_MUL(source[1], quadColor[1], dest[1]); /* G */ - VEC4_MUL(source[2], quadColor[2], dest[2]); /* B */ - break; - case PIPE_BLENDFACTOR_DST_ALPHA: + case PIPE_BLENDFACTOR_DST_COLOR: + VEC4_MUL(source[0], quadColor[0], dest[0]); /* R */ + VEC4_MUL(source[1], quadColor[1], dest[1]); /* G */ + VEC4_MUL(source[2], quadColor[2], dest[2]); /* B */ + break; + case PIPE_BLENDFACTOR_DST_ALPHA: { const float *alpha = dest[3]; VEC4_MUL(source[0], quadColor[0], alpha); /* R */ @@ -308,7 +310,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) VEC4_MUL(source[2], quadColor[2], alpha); /* B */ } break; - case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: + case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: { const float *alpha = quadColor[3]; float diff[4], temp[4]; @@ -319,7 +321,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) VEC4_MUL(source[2], quadColor[2], temp); /* B */ } break; - case PIPE_BLENDFACTOR_CONST_COLOR: + case PIPE_BLENDFACTOR_CONST_COLOR: { float comp[4]; VEC4_SCALAR(comp, softpipe->blend_color.color[0]); /* R */ @@ -330,7 +332,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) VEC4_MUL(source[2], quadColor[2], comp); /* B */ } break; - case PIPE_BLENDFACTOR_CONST_ALPHA: + case PIPE_BLENDFACTOR_CONST_ALPHA: { float alpha[4]; VEC4_SCALAR(alpha, softpipe->blend_color.color[3]); @@ -339,18 +341,18 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) VEC4_MUL(source[2], quadColor[2], alpha); /* B */ } break; - case PIPE_BLENDFACTOR_SRC1_COLOR: - assert(0); /* to do */ - break; - case PIPE_BLENDFACTOR_SRC1_ALPHA: - assert(0); /* to do */ - break; - case PIPE_BLENDFACTOR_ZERO: - VEC4_COPY(source[0], zero); /* R */ - VEC4_COPY(source[1], zero); /* G */ - VEC4_COPY(source[2], zero); /* B */ - break; - case PIPE_BLENDFACTOR_INV_SRC_COLOR: + case PIPE_BLENDFACTOR_SRC1_COLOR: + assert(0); /* to do */ + break; + case PIPE_BLENDFACTOR_SRC1_ALPHA: + assert(0); /* to do */ + break; + case PIPE_BLENDFACTOR_ZERO: + VEC4_COPY(source[0], zero); /* R */ + VEC4_COPY(source[1], zero); /* G */ + VEC4_COPY(source[2], zero); /* B */ + break; + case PIPE_BLENDFACTOR_INV_SRC_COLOR: { float inv_comp[4]; VEC4_SUB(inv_comp, one, quadColor[0]); /* R */ @@ -361,7 +363,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) VEC4_MUL(source[2], quadColor[2], inv_comp); /* B */ } break; - case PIPE_BLENDFACTOR_INV_SRC_ALPHA: + case PIPE_BLENDFACTOR_INV_SRC_ALPHA: { float inv_alpha[4]; VEC4_SUB(inv_alpha, one, quadColor[3]); @@ -370,7 +372,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) VEC4_MUL(source[2], quadColor[2], inv_alpha); /* B */ } break; - case PIPE_BLENDFACTOR_INV_DST_ALPHA: + case PIPE_BLENDFACTOR_INV_DST_ALPHA: { float inv_alpha[4]; VEC4_SUB(inv_alpha, one, dest[3]); @@ -379,7 +381,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) VEC4_MUL(source[2], quadColor[2], inv_alpha); /* B */ } break; - case PIPE_BLENDFACTOR_INV_DST_COLOR: + case PIPE_BLENDFACTOR_INV_DST_COLOR: { float inv_comp[4]; VEC4_SUB(inv_comp, one, dest[0]); /* R */ @@ -390,7 +392,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) VEC4_MUL(source[2], quadColor[2], inv_comp); /* B */ } break; - case PIPE_BLENDFACTOR_INV_CONST_COLOR: + case PIPE_BLENDFACTOR_INV_CONST_COLOR: { float inv_comp[4]; /* R */ @@ -404,7 +406,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) VEC4_MUL(source[2], quadColor[2], inv_comp); } break; - case PIPE_BLENDFACTOR_INV_CONST_ALPHA: + case PIPE_BLENDFACTOR_INV_CONST_ALPHA: { float inv_alpha[4]; VEC4_SCALAR(inv_alpha, 1.0f - softpipe->blend_color.color[3]); @@ -413,73 +415,73 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) VEC4_MUL(source[2], quadColor[2], inv_alpha); /* B */ } break; - case PIPE_BLENDFACTOR_INV_SRC1_COLOR: - assert(0); /* to do */ - break; - case PIPE_BLENDFACTOR_INV_SRC1_ALPHA: - assert(0); /* to do */ - break; - default: - assert(0); - } + case PIPE_BLENDFACTOR_INV_SRC1_COLOR: + assert(0); /* to do */ + break; + case PIPE_BLENDFACTOR_INV_SRC1_ALPHA: + assert(0); /* to do */ + break; + default: + assert(0); + } - /* - * Compute src/first term A - */ - switch (softpipe->blend->alpha_src_factor) { - case PIPE_BLENDFACTOR_ONE: - VEC4_COPY(source[3], quadColor[3]); /* A */ - break; - case PIPE_BLENDFACTOR_SRC_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_SRC_ALPHA: + /* + * Compute src/first term A + */ + switch (softpipe->blend->alpha_src_factor) { + case PIPE_BLENDFACTOR_ONE: + VEC4_COPY(source[3], quadColor[3]); /* A */ + break; + case PIPE_BLENDFACTOR_SRC_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_SRC_ALPHA: { const float *alpha = quadColor[3]; VEC4_MUL(source[3], quadColor[3], alpha); /* A */ } break; - case PIPE_BLENDFACTOR_DST_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_DST_ALPHA: - VEC4_MUL(source[3], quadColor[3], dest[3]); /* A */ - break; - case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: - /* multiply alpha by 1.0 */ - VEC4_COPY(source[3], quadColor[3]); /* A */ - break; - case PIPE_BLENDFACTOR_CONST_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_CONST_ALPHA: + case PIPE_BLENDFACTOR_DST_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_DST_ALPHA: + VEC4_MUL(source[3], quadColor[3], dest[3]); /* A */ + break; + case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: + /* multiply alpha by 1.0 */ + VEC4_COPY(source[3], quadColor[3]); /* A */ + break; + case PIPE_BLENDFACTOR_CONST_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_CONST_ALPHA: { float comp[4]; VEC4_SCALAR(comp, softpipe->blend_color.color[3]); /* A */ VEC4_MUL(source[3], quadColor[3], comp); /* A */ } break; - case PIPE_BLENDFACTOR_ZERO: - VEC4_COPY(source[3], zero); /* A */ - break; - case PIPE_BLENDFACTOR_INV_SRC_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_INV_SRC_ALPHA: + case PIPE_BLENDFACTOR_ZERO: + VEC4_COPY(source[3], zero); /* A */ + break; + case PIPE_BLENDFACTOR_INV_SRC_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_INV_SRC_ALPHA: { float inv_alpha[4]; VEC4_SUB(inv_alpha, one, quadColor[3]); VEC4_MUL(source[3], quadColor[3], inv_alpha); /* A */ } break; - case PIPE_BLENDFACTOR_INV_DST_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_INV_DST_ALPHA: + case PIPE_BLENDFACTOR_INV_DST_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_INV_DST_ALPHA: { float inv_alpha[4]; VEC4_SUB(inv_alpha, one, dest[3]); VEC4_MUL(source[3], quadColor[3], inv_alpha); /* A */ } break; - case PIPE_BLENDFACTOR_INV_CONST_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_INV_CONST_ALPHA: + case PIPE_BLENDFACTOR_INV_CONST_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_INV_CONST_ALPHA: { float inv_comp[4]; /* A */ @@ -487,42 +489,42 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) VEC4_MUL(source[3], quadColor[3], inv_comp); } break; - default: - assert(0); - } + default: + assert(0); + } - /* - * Compute dest/second term RGB - */ - switch (softpipe->blend->rgb_dst_factor) { - case PIPE_BLENDFACTOR_ONE: - /* dest = dest * 1 NO-OP, leave dest as-is */ - break; - case PIPE_BLENDFACTOR_SRC_COLOR: - VEC4_MUL(dest[0], dest[0], quadColor[0]); /* R */ - VEC4_MUL(dest[1], dest[1], quadColor[1]); /* G */ - VEC4_MUL(dest[2], dest[2], quadColor[2]); /* B */ - break; - case PIPE_BLENDFACTOR_SRC_ALPHA: - VEC4_MUL(dest[0], dest[0], quadColor[3]); /* R * A */ - VEC4_MUL(dest[1], dest[1], quadColor[3]); /* G * A */ - VEC4_MUL(dest[2], dest[2], quadColor[3]); /* B * A */ - break; - case PIPE_BLENDFACTOR_DST_ALPHA: - VEC4_MUL(dest[0], dest[0], dest[3]); /* R * A */ - VEC4_MUL(dest[1], dest[1], dest[3]); /* G * A */ - VEC4_MUL(dest[2], dest[2], dest[3]); /* B * A */ - break; - case PIPE_BLENDFACTOR_DST_COLOR: - VEC4_MUL(dest[0], dest[0], dest[0]); /* R */ - VEC4_MUL(dest[1], dest[1], dest[1]); /* G */ - VEC4_MUL(dest[2], dest[2], dest[2]); /* B */ - break; - case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: - assert(0); /* illegal */ - break; - case PIPE_BLENDFACTOR_CONST_COLOR: + /* + * Compute dest/second term RGB + */ + switch (softpipe->blend->rgb_dst_factor) { + case PIPE_BLENDFACTOR_ONE: + /* dest = dest * 1 NO-OP, leave dest as-is */ + break; + case PIPE_BLENDFACTOR_SRC_COLOR: + VEC4_MUL(dest[0], dest[0], quadColor[0]); /* R */ + VEC4_MUL(dest[1], dest[1], quadColor[1]); /* G */ + VEC4_MUL(dest[2], dest[2], quadColor[2]); /* B */ + break; + case PIPE_BLENDFACTOR_SRC_ALPHA: + VEC4_MUL(dest[0], dest[0], quadColor[3]); /* R * A */ + VEC4_MUL(dest[1], dest[1], quadColor[3]); /* G * A */ + VEC4_MUL(dest[2], dest[2], quadColor[3]); /* B * A */ + break; + case PIPE_BLENDFACTOR_DST_ALPHA: + VEC4_MUL(dest[0], dest[0], dest[3]); /* R * A */ + VEC4_MUL(dest[1], dest[1], dest[3]); /* G * A */ + VEC4_MUL(dest[2], dest[2], dest[3]); /* B * A */ + break; + case PIPE_BLENDFACTOR_DST_COLOR: + VEC4_MUL(dest[0], dest[0], dest[0]); /* R */ + VEC4_MUL(dest[1], dest[1], dest[1]); /* G */ + VEC4_MUL(dest[2], dest[2], dest[2]); /* B */ + break; + case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: + assert(0); /* illegal */ + break; + case PIPE_BLENDFACTOR_CONST_COLOR: { float comp[4]; VEC4_SCALAR(comp, softpipe->blend_color.color[0]); /* R */ @@ -533,7 +535,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) VEC4_MUL(dest[2], dest[2], comp); /* B */ } break; - case PIPE_BLENDFACTOR_CONST_ALPHA: + case PIPE_BLENDFACTOR_CONST_ALPHA: { float comp[4]; VEC4_SCALAR(comp, softpipe->blend_color.color[3]); /* A */ @@ -542,17 +544,17 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) VEC4_MUL(dest[2], dest[2], comp); /* B */ } break; - case PIPE_BLENDFACTOR_ZERO: - VEC4_COPY(dest[0], zero); /* R */ - VEC4_COPY(dest[1], zero); /* G */ - VEC4_COPY(dest[2], zero); /* B */ - break; - case PIPE_BLENDFACTOR_SRC1_COLOR: - case PIPE_BLENDFACTOR_SRC1_ALPHA: - /* XXX what are these? */ - assert(0); - break; - case PIPE_BLENDFACTOR_INV_SRC_COLOR: + case PIPE_BLENDFACTOR_ZERO: + VEC4_COPY(dest[0], zero); /* R */ + VEC4_COPY(dest[1], zero); /* G */ + VEC4_COPY(dest[2], zero); /* B */ + break; + case PIPE_BLENDFACTOR_SRC1_COLOR: + case PIPE_BLENDFACTOR_SRC1_ALPHA: + /* XXX what are these? */ + assert(0); + break; + case PIPE_BLENDFACTOR_INV_SRC_COLOR: { float inv_comp[4]; VEC4_SUB(inv_comp, one, quadColor[0]); /* R */ @@ -563,7 +565,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) VEC4_MUL(dest[2], inv_comp, dest[2]); /* B */ } break; - case PIPE_BLENDFACTOR_INV_SRC_ALPHA: + case PIPE_BLENDFACTOR_INV_SRC_ALPHA: { float one_minus_alpha[QUAD_SIZE]; VEC4_SUB(one_minus_alpha, one, quadColor[3]); @@ -572,7 +574,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) VEC4_MUL(dest[2], dest[2], one_minus_alpha); /* B */ } break; - case PIPE_BLENDFACTOR_INV_DST_ALPHA: + case PIPE_BLENDFACTOR_INV_DST_ALPHA: { float inv_comp[4]; VEC4_SUB(inv_comp, one, dest[3]); /* A */ @@ -581,7 +583,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) VEC4_MUL(dest[2], inv_comp, dest[2]); /* B */ } break; - case PIPE_BLENDFACTOR_INV_DST_COLOR: + case PIPE_BLENDFACTOR_INV_DST_COLOR: { float inv_comp[4]; VEC4_SUB(inv_comp, one, dest[0]); /* R */ @@ -592,7 +594,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) VEC4_MUL(dest[2], dest[2], inv_comp); /* B */ } break; - case PIPE_BLENDFACTOR_INV_CONST_COLOR: + case PIPE_BLENDFACTOR_INV_CONST_COLOR: { float inv_comp[4]; /* R */ @@ -606,7 +608,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) VEC4_MUL(dest[2], dest[2], inv_comp); } break; - case PIPE_BLENDFACTOR_INV_CONST_ALPHA: + case PIPE_BLENDFACTOR_INV_CONST_ALPHA: { float inv_comp[4]; VEC4_SCALAR(inv_comp, 1.0f - softpipe->blend_color.color[3]); @@ -615,138 +617,154 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad) VEC4_MUL(dest[2], dest[2], inv_comp); } break; - case PIPE_BLENDFACTOR_INV_SRC1_COLOR: - case PIPE_BLENDFACTOR_INV_SRC1_ALPHA: - /* XXX what are these? */ - assert(0); - break; - default: - assert(0); - } + case PIPE_BLENDFACTOR_INV_SRC1_COLOR: + case PIPE_BLENDFACTOR_INV_SRC1_ALPHA: + /* XXX what are these? */ + assert(0); + break; + default: + assert(0); + } - /* - * Compute dest/second term A - */ - switch (softpipe->blend->alpha_dst_factor) { - case PIPE_BLENDFACTOR_ONE: - /* dest = dest * 1 NO-OP, leave dest as-is */ - break; - case PIPE_BLENDFACTOR_SRC_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_SRC_ALPHA: - VEC4_MUL(dest[3], dest[3], quadColor[3]); /* A * A */ - break; - case PIPE_BLENDFACTOR_DST_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_DST_ALPHA: - VEC4_MUL(dest[3], dest[3], dest[3]); /* A */ - break; - case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: - assert(0); /* illegal */ - break; - case PIPE_BLENDFACTOR_CONST_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_CONST_ALPHA: + /* + * Compute dest/second term A + */ + switch (softpipe->blend->alpha_dst_factor) { + case PIPE_BLENDFACTOR_ONE: + /* dest = dest * 1 NO-OP, leave dest as-is */ + break; + case PIPE_BLENDFACTOR_SRC_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_SRC_ALPHA: + VEC4_MUL(dest[3], dest[3], quadColor[3]); /* A * A */ + break; + case PIPE_BLENDFACTOR_DST_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_DST_ALPHA: + VEC4_MUL(dest[3], dest[3], dest[3]); /* A */ + break; + case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: + assert(0); /* illegal */ + break; + case PIPE_BLENDFACTOR_CONST_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_CONST_ALPHA: { float comp[4]; VEC4_SCALAR(comp, softpipe->blend_color.color[3]); /* A */ VEC4_MUL(dest[3], dest[3], comp); /* A */ } break; - case PIPE_BLENDFACTOR_ZERO: - VEC4_COPY(dest[3], zero); /* A */ - break; - case PIPE_BLENDFACTOR_INV_SRC_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_INV_SRC_ALPHA: + case PIPE_BLENDFACTOR_ZERO: + VEC4_COPY(dest[3], zero); /* A */ + break; + case PIPE_BLENDFACTOR_INV_SRC_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_INV_SRC_ALPHA: { float one_minus_alpha[QUAD_SIZE]; VEC4_SUB(one_minus_alpha, one, quadColor[3]); VEC4_MUL(dest[3], dest[3], one_minus_alpha); /* A */ } break; - case PIPE_BLENDFACTOR_INV_DST_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_INV_DST_ALPHA: + case PIPE_BLENDFACTOR_INV_DST_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_INV_DST_ALPHA: { float inv_comp[4]; VEC4_SUB(inv_comp, one, dest[3]); /* A */ VEC4_MUL(dest[3], inv_comp, dest[3]); /* A */ } break; - case PIPE_BLENDFACTOR_INV_CONST_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_INV_CONST_ALPHA: + case PIPE_BLENDFACTOR_INV_CONST_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_INV_CONST_ALPHA: { float inv_comp[4]; VEC4_SCALAR(inv_comp, 1.0f - softpipe->blend_color.color[3]); VEC4_MUL(dest[3], dest[3], inv_comp); } break; - default: - assert(0); - } + default: + assert(0); + } - /* - * Combine RGB terms - */ - switch (softpipe->blend->rgb_func) { - case PIPE_BLEND_ADD: - VEC4_ADD_SAT(quadColor[0], source[0], dest[0]); /* R */ - VEC4_ADD_SAT(quadColor[1], source[1], dest[1]); /* G */ - VEC4_ADD_SAT(quadColor[2], source[2], dest[2]); /* B */ - break; - case PIPE_BLEND_SUBTRACT: - VEC4_SUB_SAT(quadColor[0], source[0], dest[0]); /* R */ - VEC4_SUB_SAT(quadColor[1], source[1], dest[1]); /* G */ - VEC4_SUB_SAT(quadColor[2], source[2], dest[2]); /* B */ - break; - case PIPE_BLEND_REVERSE_SUBTRACT: - VEC4_SUB_SAT(quadColor[0], dest[0], source[0]); /* R */ - VEC4_SUB_SAT(quadColor[1], dest[1], source[1]); /* G */ - VEC4_SUB_SAT(quadColor[2], dest[2], source[2]); /* B */ - break; - case PIPE_BLEND_MIN: - VEC4_MIN(quadColor[0], source[0], dest[0]); /* R */ - VEC4_MIN(quadColor[1], source[1], dest[1]); /* G */ - VEC4_MIN(quadColor[2], source[2], dest[2]); /* B */ - break; - case PIPE_BLEND_MAX: - VEC4_MAX(quadColor[0], source[0], dest[0]); /* R */ - VEC4_MAX(quadColor[1], source[1], dest[1]); /* G */ - VEC4_MAX(quadColor[2], source[2], dest[2]); /* B */ - break; - default: - assert(0); - } + /* + * Combine RGB terms + */ + switch (softpipe->blend->rgb_func) { + case PIPE_BLEND_ADD: + VEC4_ADD_SAT(quadColor[0], source[0], dest[0]); /* R */ + VEC4_ADD_SAT(quadColor[1], source[1], dest[1]); /* G */ + VEC4_ADD_SAT(quadColor[2], source[2], dest[2]); /* B */ + break; + case PIPE_BLEND_SUBTRACT: + VEC4_SUB_SAT(quadColor[0], source[0], dest[0]); /* R */ + VEC4_SUB_SAT(quadColor[1], source[1], dest[1]); /* G */ + VEC4_SUB_SAT(quadColor[2], source[2], dest[2]); /* B */ + break; + case PIPE_BLEND_REVERSE_SUBTRACT: + VEC4_SUB_SAT(quadColor[0], dest[0], source[0]); /* R */ + VEC4_SUB_SAT(quadColor[1], dest[1], source[1]); /* G */ + VEC4_SUB_SAT(quadColor[2], dest[2], source[2]); /* B */ + break; + case PIPE_BLEND_MIN: + VEC4_MIN(quadColor[0], source[0], dest[0]); /* R */ + VEC4_MIN(quadColor[1], source[1], dest[1]); /* G */ + VEC4_MIN(quadColor[2], source[2], dest[2]); /* B */ + break; + case PIPE_BLEND_MAX: + VEC4_MAX(quadColor[0], source[0], dest[0]); /* R */ + VEC4_MAX(quadColor[1], source[1], dest[1]); /* G */ + VEC4_MAX(quadColor[2], source[2], dest[2]); /* B */ + break; + default: + assert(0); + } - /* - * Combine A terms - */ - switch (softpipe->blend->alpha_func) { - case PIPE_BLEND_ADD: - VEC4_ADD_SAT(quadColor[3], source[3], dest[3]); /* A */ - break; - case PIPE_BLEND_SUBTRACT: - VEC4_SUB_SAT(quadColor[3], source[3], dest[3]); /* A */ - break; - case PIPE_BLEND_REVERSE_SUBTRACT: - VEC4_SUB_SAT(quadColor[3], dest[3], source[3]); /* A */ - break; - case PIPE_BLEND_MIN: - VEC4_MIN(quadColor[3], source[3], dest[3]); /* A */ - break; - case PIPE_BLEND_MAX: - VEC4_MAX(quadColor[3], source[3], dest[3]); /* A */ - break; - default: - assert(0); + /* + * Combine A terms + */ + switch (softpipe->blend->alpha_func) { + case PIPE_BLEND_ADD: + VEC4_ADD_SAT(quadColor[3], source[3], dest[3]); /* A */ + break; + case PIPE_BLEND_SUBTRACT: + VEC4_SUB_SAT(quadColor[3], source[3], dest[3]); /* A */ + break; + case PIPE_BLEND_REVERSE_SUBTRACT: + VEC4_SUB_SAT(quadColor[3], dest[3], source[3]); /* A */ + break; + case PIPE_BLEND_MIN: + VEC4_MIN(quadColor[3], source[3], dest[3]); /* A */ + break; + case PIPE_BLEND_MAX: + VEC4_MAX(quadColor[3], source[3], dest[3]); /* A */ + break; + default: + assert(0); + } } - } /* cbuf loop */ +} + + +static void +blend_quad(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) +{ + struct softpipe_context *softpipe = qs->softpipe; + + if (softpipe->blend->logicop_enable) { + logicop_quad(qs, quads, nr); + } + else if (softpipe->blend->blend_enable) { + blend_quads(qs, quads, nr ); + } /* pass blended quad to next stage */ - qs->next->run(qs->next, quad); + qs->next->run(qs->next, quads, nr); } diff --git a/src/gallium/drivers/softpipe/sp_quad_colormask.c b/src/gallium/drivers/softpipe/sp_quad_colormask.c index 89efbe3b02..ac74287473 100644 --- a/src/gallium/drivers/softpipe/sp_quad_colormask.c +++ b/src/gallium/drivers/softpipe/sp_quad_colormask.c @@ -84,12 +84,23 @@ colormask_quad(struct quad_stage *qs, struct quad_header *quad) if (!(softpipe->blend->colormask & PIPE_MASK_A)) COPY_4V(quadColor[3], dest[3]); } +} + +static void +colormask_quads(struct quad_stage *qs, struct quad_header *quads[], + unsigned nr) +{ + unsigned i; + + for (i = 0; i < nr; i++) + colormask_quad(qs, quads[i]); /* pass quad to next stage */ - qs->next->run(qs->next, quad); + qs->next->run(qs->next, quads, nr); } + static void colormask_begin(struct quad_stage *qs) { qs->next->begin(qs->next); @@ -108,7 +119,7 @@ struct quad_stage *sp_quad_colormask_stage( struct softpipe_context *softpipe ) stage->softpipe = softpipe; stage->begin = colormask_begin; - stage->run = colormask_quad; + stage->run = colormask_quads; stage->destroy = colormask_destroy; return stage; diff --git a/src/gallium/drivers/softpipe/sp_quad_coverage.c b/src/gallium/drivers/softpipe/sp_quad_coverage.c index 4aeee85870..eda5ce8e63 100644 --- a/src/gallium/drivers/softpipe/sp_quad_coverage.c +++ b/src/gallium/drivers/softpipe/sp_quad_coverage.c @@ -42,33 +42,47 @@ /** * Multiply quad's alpha values by the fragment coverage. */ -static void +static INLINE void coverage_quad(struct quad_stage *qs, struct quad_header *quad) { struct softpipe_context *softpipe = qs->softpipe; - const uint prim = quad->input.prim; + uint cbuf; + + /* loop over colorbuffer outputs */ + for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) { + float (*quadColor)[4] = quad->output.color[cbuf]; + unsigned j; + for (j = 0; j < QUAD_SIZE; j++) { + assert(quad->input.coverage[j] >= 0.0); + assert(quad->input.coverage[j] <= 1.0); + quadColor[3][j] *= quad->input.coverage[j]; + } + } +} + + +/* XXX: Incorporate into shader after alpha_test. + */ +static void +coverage_run(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) +{ + struct softpipe_context *softpipe = qs->softpipe; + const uint prim = quads[0]->input.prim; + unsigned i; if ((softpipe->rasterizer->poly_smooth && prim == QUAD_PRIM_TRI) || (softpipe->rasterizer->line_smooth && prim == QUAD_PRIM_LINE) || (softpipe->rasterizer->point_smooth && prim == QUAD_PRIM_POINT)) { - uint cbuf; - - /* loop over colorbuffer outputs */ - for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) { - float (*quadColor)[4] = quad->output.color[cbuf]; - unsigned j; - for (j = 0; j < QUAD_SIZE; j++) { - assert(quad->input.coverage[j] >= 0.0); - assert(quad->input.coverage[j] <= 1.0); - quadColor[3][j] *= quad->input.coverage[j]; - } - } + + for (i = 0; i < nr; i++) + coverage_quad( qs, quads[i] ); } - qs->next->run(qs->next, quad); + qs->next->run(qs->next, quads, nr); } - static void coverage_begin(struct quad_stage *qs) { qs->next->begin(qs->next); @@ -87,7 +101,7 @@ struct quad_stage *sp_quad_coverage_stage( struct softpipe_context *softpipe ) stage->softpipe = softpipe; stage->begin = coverage_begin; - stage->run = coverage_quad; + stage->run = coverage_run; stage->destroy = coverage_destroy; return stage; diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c index 768b9275b3..8f223a7eae 100644 --- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c +++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c @@ -49,7 +49,7 @@ * Try to effectively do that with codegen... */ -void +boolean sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad) { struct softpipe_context *softpipe = qs->softpipe; @@ -193,6 +193,8 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad) } quad->inout.mask &= zmask; + if (quad->inout.mask == 0) + return FALSE; if (softpipe->depth_stencil->depth.writemask) { @@ -252,16 +254,25 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad) assert(0); } } + + return TRUE; } static void -depth_test_quad(struct quad_stage *qs, struct quad_header *quad) +depth_test_quads(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) { - sp_depth_test_quad(qs, quad); + unsigned i, pass = 0; - if (quad->inout.mask) - qs->next->run(qs->next, quad); + for (i = 0; i < nr; i++) { + if (sp_depth_test_quad(qs, quads[i])) + quads[pass++] = quads[i]; + } + + if (pass) + qs->next->run(qs->next, quads, pass); } @@ -283,7 +294,7 @@ struct quad_stage *sp_quad_depth_test_stage( struct softpipe_context *softpipe ) stage->softpipe = softpipe; stage->begin = depth_test_begin; - stage->run = depth_test_quad; + stage->run = depth_test_quads; stage->destroy = depth_test_destroy; return stage; diff --git a/src/gallium/drivers/softpipe/sp_quad_earlyz.c b/src/gallium/drivers/softpipe/sp_quad_earlyz.c index 496fd39ed1..1048d44984 100644 --- a/src/gallium/drivers/softpipe/sp_quad_earlyz.c +++ b/src/gallium/drivers/softpipe/sp_quad_earlyz.c @@ -43,20 +43,26 @@ static void earlyz_quad( struct quad_stage *qs, - struct quad_header *quad ) + struct quad_header *quads[], + unsigned nr ) { - const float fx = (float) quad->input.x0; - const float fy = (float) quad->input.y0; - const float dzdx = quad->posCoef->dadx[2]; - const float dzdy = quad->posCoef->dady[2]; - const float z0 = quad->posCoef->a0[2] + dzdx * fx + dzdy * fy; + const float a0z = quads[0]->posCoef->a0[2]; + const float dzdx = quads[0]->posCoef->dadx[2]; + const float dzdy = quads[0]->posCoef->dady[2]; + unsigned i; - quad->output.depth[0] = z0; - quad->output.depth[1] = z0 + dzdx; - quad->output.depth[2] = z0 + dzdy; - quad->output.depth[3] = z0 + dzdx + dzdy; + for (i = 0; i < nr; i++) { + const float fx = (float) quads[i]->input.x0; + const float fy = (float) quads[i]->input.y0; + const float z0 = a0z + dzdx * fx + dzdy * fy; - qs->next->run( qs->next, quad ); + quads[i]->output.depth[0] = z0; + quads[i]->output.depth[1] = z0 + dzdx; + quads[i]->output.depth[2] = z0 + dzdy; + quads[i]->output.depth[3] = z0 + dzdx + dzdy; + } + + qs->next->run( qs->next, quads, nr ); } static void diff --git a/src/gallium/drivers/softpipe/sp_quad_fs.c b/src/gallium/drivers/softpipe/sp_quad_fs.c index 28f8d1a60e..ea5ed3bbd0 100644 --- a/src/gallium/drivers/softpipe/sp_quad_fs.c +++ b/src/gallium/drivers/softpipe/sp_quad_fs.c @@ -68,21 +68,18 @@ quad_shade_stage(struct quad_stage *qs) /** * Execute fragment shader for the four fragments in the quad. */ -static void +static boolean 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; struct tgsi_exec_machine *machine = qss->machine; boolean z_written; - - /* Consts do not require 16 byte alignment. */ - machine->Consts = softpipe->mapped_constants[PIPE_SHADER_FRAGMENT]; - - machine->InterpCoefs = quad->coef; /* run shader */ quad->inout.mask &= softpipe->fs->run( softpipe->fs, machine, quad ); + if (quad->inout.mask == 0) + return FALSE; /* store outputs */ z_written = FALSE; @@ -129,11 +126,34 @@ shade_quad(struct quad_stage *qs, struct quad_header *quad) quad->output.depth[3] = z0 + dzdx + dzdy; } - /* shader may cull fragments */ - if (quad->inout.mask) { - qs->next->run( qs->next, quad ); + return TRUE; +} + +static void +shade_quads(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) +{ + struct quad_shade_stage *qss = quad_shade_stage( qs ); + struct softpipe_context *softpipe = qs->softpipe; + struct tgsi_exec_machine *machine = qss->machine; + + unsigned i, pass = 0; + + machine->Consts = softpipe->mapped_constants[PIPE_SHADER_FRAGMENT]; + machine->InterpCoefs = quads[0]->coef; + + for (i = 0; i < nr; i++) { + if (shade_quad(qs, quads[i])) + quads[pass++] = quads[i]; } + + if (pass) + qs->next->run(qs->next, quads, pass); } + + + /** @@ -174,7 +194,7 @@ sp_quad_shade_stage( struct softpipe_context *softpipe ) qss->stage.softpipe = softpipe; qss->stage.begin = shade_begin; - qss->stage.run = shade_quad; + qss->stage.run = shade_quads; qss->stage.destroy = shade_destroy; qss->machine = tgsi_exec_machine_create(); diff --git a/src/gallium/drivers/softpipe/sp_quad_occlusion.c b/src/gallium/drivers/softpipe/sp_quad_occlusion.c index dfa7ff3b1d..4adeb16546 100644 --- a/src/gallium/drivers/softpipe/sp_quad_occlusion.c +++ b/src/gallium/drivers/softpipe/sp_quad_occlusion.c @@ -50,13 +50,15 @@ static unsigned count_bits( unsigned val ) } static void -occlusion_count_quad(struct quad_stage *qs, struct quad_header *quad) +occlusion_count_quads(struct quad_stage *qs, struct quad_header *quads[], unsigned nr) { struct softpipe_context *softpipe = qs->softpipe; + unsigned i; - softpipe->occlusion_count += count_bits(quad->inout.mask); + for (i = 0; i < nr; i++) + softpipe->occlusion_count += count_bits(quads[i]->inout.mask); - qs->next->run(qs->next, quad); + qs->next->run(qs->next, quads, nr); } @@ -78,7 +80,7 @@ struct quad_stage *sp_quad_occlusion_stage( struct softpipe_context *softpipe ) stage->softpipe = softpipe; stage->begin = occlusion_begin; - stage->run = occlusion_count_quad; + stage->run = occlusion_count_quads; stage->destroy = occlusion_destroy; return stage; diff --git a/src/gallium/drivers/softpipe/sp_quad_output.c b/src/gallium/drivers/softpipe/sp_quad_output.c index dd8f5377e9..79a222ff58 100644 --- a/src/gallium/drivers/softpipe/sp_quad_output.c +++ b/src/gallium/drivers/softpipe/sp_quad_output.c @@ -38,11 +38,8 @@ * taking mask into account. */ static void -output_quad(struct quad_stage *qs, struct quad_header *quad) +output_quad(struct quad_stage *qs, struct quad_header *quads[], unsigned nr) { - /* in-tile pos: */ - const int itx = quad->input.x0 % TILE_SIZE; - const int ity = quad->input.y0 % TILE_SIZE; struct softpipe_context *softpipe = qs->softpipe; uint cbuf; @@ -51,25 +48,35 @@ output_quad(struct quad_stage *qs, struct quad_header *quad) for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) { struct softpipe_cached_tile *tile = sp_get_cached_tile(softpipe->cbuf_cache[cbuf], - quad->input.x0, quad->input.y0); - float (*quadColor)[4] = quad->output.color[cbuf]; - int i, j; + quads[0]->input.x0, + quads[0]->input.y0); + int i, j, q; /* get/swizzle dest colors */ - for (j = 0; j < QUAD_SIZE; j++) { - if (quad->inout.mask & (1 << j)) { - int x = itx + (j & 1); - int y = ity + (j >> 1); - for (i = 0; i < 4; i++) { /* loop over color chans */ - tile->data.color[y][x][i] = quadColor[i][j]; - } - if (0) { - debug_printf("sp write pixel %d,%d: %g, %g, %g\n", - quad->input.x0 + x, - quad->input.y0 + y, - quadColor[0][j], - quadColor[1][j], - quadColor[2][j]); + for (q = 0; q < nr; q++) { + struct quad_header *quad = quads[q]; + float (*quadColor)[4] = quad->output.color[cbuf]; + + /* in-tile pos: */ + const int itx = quad->input.x0 % TILE_SIZE; + const int ity = quad->input.y0 % TILE_SIZE; + + + for (j = 0; j < QUAD_SIZE; j++) { + if (quad->inout.mask & (1 << j)) { + int x = itx + (j & 1); + int y = ity + (j >> 1); + for (i = 0; i < 4; i++) { /* loop over color chans */ + tile->data.color[y][x][i] = quadColor[i][j]; + } + if (0) { + debug_printf("sp write pixel %d,%d: %g, %g, %g\n", + quad->input.x0 + x, + quad->input.y0 + y, + quadColor[0][j], + quadColor[1][j], + quadColor[2][j]); + } } } } diff --git a/src/gallium/drivers/softpipe/sp_quad_pipe.c b/src/gallium/drivers/softpipe/sp_quad_pipe.c index 3a3359d303..594fade455 100644 --- a/src/gallium/drivers/softpipe/sp_quad_pipe.c +++ b/src/gallium/drivers/softpipe/sp_quad_pipe.c @@ -55,50 +55,52 @@ void sp_build_quad_pipeline(struct softpipe_context *sp) { boolean early_depth_test = - sp->depth_stencil->depth.enabled && - sp->framebuffer.zsbuf && - !sp->depth_stencil->alpha.enabled && - !sp->fs->info.uses_kill && - !sp->fs->info.writes_z; + sp->depth_stencil->depth.enabled && + sp->framebuffer.zsbuf && + !sp->depth_stencil->alpha.enabled && + !sp->fs->info.uses_kill && + !sp->fs->info.writes_z; /* build up the pipeline in reverse order... */ - sp->quad.first = sp->quad.output; - - if (sp->blend->colormask != 0xf) { - sp_push_quad_first( sp, sp->quad.colormask ); - } - - if (sp->blend->blend_enable || - sp->blend->logicop_enable) { - sp_push_quad_first( sp, sp->quad.blend ); - } - - if (sp->active_query_count) { - sp_push_quad_first( sp, sp->quad.occlusion ); - } - - if (sp->rasterizer->poly_smooth || - sp->rasterizer->line_smooth || - sp->rasterizer->point_smooth) { - sp_push_quad_first( sp, sp->quad.coverage ); - } - - if (!early_depth_test) { - sp_build_depth_stencil( sp ); - } - - if (sp->depth_stencil->alpha.enabled) { - sp_push_quad_first( sp, sp->quad.alpha_test ); - } - - /* XXX always enable shader? */ - if (1) { - sp_push_quad_first( sp, sp->quad.shade ); - } - - if (early_depth_test) { - sp_build_depth_stencil( sp ); - sp_push_quad_first( sp, sp->quad.earlyz ); - } + + /* Color combine + */ + sp->quad.first = sp->quad.output; + + if (sp->blend->colormask != 0xf) { + sp_push_quad_first( sp, sp->quad.colormask ); + } + + if (sp->blend->blend_enable || + sp->blend->logicop_enable) { + sp_push_quad_first( sp, sp->quad.blend ); + } + + if (sp->rasterizer->poly_smooth || + sp->rasterizer->line_smooth || + sp->rasterizer->point_smooth) { + sp_push_quad_first( sp, sp->quad.coverage ); + } + + /* Shade/Depth/Stencil/Alpha + */ + if (sp->active_query_count) { + sp_push_quad_first( sp, sp->quad.occlusion ); + } + + if (!early_depth_test) { + sp_build_depth_stencil( sp ); + } + + if (sp->depth_stencil->alpha.enabled) { + sp_push_quad_first( sp, sp->quad.alpha_test ); + } + + sp_push_quad_first( sp, sp->quad.shade ); + + if (early_depth_test) { + sp_build_depth_stencil( sp ); + sp_push_quad_first( sp, sp->quad.earlyz ); + } } diff --git a/src/gallium/drivers/softpipe/sp_quad_pipe.h b/src/gallium/drivers/softpipe/sp_quad_pipe.h index 0e40586ffc..add31ba705 100644 --- a/src/gallium/drivers/softpipe/sp_quad_pipe.h +++ b/src/gallium/drivers/softpipe/sp_quad_pipe.h @@ -49,7 +49,7 @@ struct quad_stage { void (*begin)(struct quad_stage *qs); /** the stage action */ - void (*run)(struct quad_stage *qs, struct quad_header *quad); + void (*run)(struct quad_stage *qs, struct quad_header *quad[], unsigned nr); void (*destroy)(struct quad_stage *qs); }; @@ -69,6 +69,6 @@ struct quad_stage *sp_quad_output_stage( struct softpipe_context *softpipe ); void sp_build_quad_pipeline(struct softpipe_context *sp); -void sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad); +boolean sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad); #endif /* SP_QUAD_PIPE_H */ diff --git a/src/gallium/drivers/softpipe/sp_quad_stencil.c b/src/gallium/drivers/softpipe/sp_quad_stencil.c index 34a8d9e9f6..706dd2f756 100644 --- a/src/gallium/drivers/softpipe/sp_quad_stencil.c +++ b/src/gallium/drivers/softpipe/sp_quad_stencil.c @@ -198,7 +198,8 @@ apply_stencil_op(ubyte stencilVals[QUAD_SIZE], * depth testing. */ static void -stencil_test_quad(struct quad_stage *qs, struct quad_header *quad) +stencil_test_quad(struct quad_stage *qs, struct quad_header *quads[], + unsigned nr) { struct softpipe_context *softpipe = qs->softpipe; struct pipe_surface *ps = softpipe->framebuffer.zsbuf; @@ -206,9 +207,12 @@ stencil_test_quad(struct quad_stage *qs, struct quad_header *quad) ubyte ref, wrtMask, valMask; ubyte stencilVals[QUAD_SIZE]; struct softpipe_cached_tile *tile - = sp_get_cached_tile(softpipe->zsbuf_cache, quad->input.x0, quad->input.y0); - uint j; - uint face = quad->input.facing; + = sp_get_cached_tile(softpipe->zsbuf_cache, + quads[0]->input.x0, + quads[0]->input.y0); + uint face = quads[0]->input.facing; + uint pass = 0; + uint j, q; if (!softpipe->depth_stencil->stencil[1].enabled) { /* single-sided stencil test, use front (face=0) state */ @@ -227,103 +231,110 @@ stencil_test_quad(struct quad_stage *qs, struct quad_header *quad) assert(ps); /* shouldn't get here if there's no stencil buffer */ - /* get stencil values from cached tile */ - switch (ps->format) { - case PIPE_FORMAT_S8Z24_UNORM: - for (j = 0; j < QUAD_SIZE; j++) { - int x = quad->input.x0 % TILE_SIZE + (j & 1); - int y = quad->input.y0 % TILE_SIZE + (j >> 1); - stencilVals[j] = tile->data.depth32[y][x] >> 24; - } - break; - case PIPE_FORMAT_Z24S8_UNORM: - for (j = 0; j < QUAD_SIZE; j++) { - int x = quad->input.x0 % TILE_SIZE + (j & 1); - int y = quad->input.y0 % TILE_SIZE + (j >> 1); - stencilVals[j] = tile->data.depth32[y][x] & 0xff; - } - break; - case PIPE_FORMAT_S8_UNORM: - for (j = 0; j < QUAD_SIZE; j++) { - int x = quad->input.x0 % TILE_SIZE + (j & 1); - int y = quad->input.y0 % TILE_SIZE + (j >> 1); - stencilVals[j] = tile->data.stencil8[y][x]; + for (q = 0; q < nr; q++) { + struct quad_header *quad = quads[q]; + + /* get stencil values from cached tile */ + switch (ps->format) { + case PIPE_FORMAT_S8Z24_UNORM: + for (j = 0; j < QUAD_SIZE; j++) { + int x = quad->input.x0 % TILE_SIZE + (j & 1); + int y = quad->input.y0 % TILE_SIZE + (j >> 1); + stencilVals[j] = tile->data.depth32[y][x] >> 24; + } + break; + case PIPE_FORMAT_Z24S8_UNORM: + for (j = 0; j < QUAD_SIZE; j++) { + int x = quad->input.x0 % TILE_SIZE + (j & 1); + int y = quad->input.y0 % TILE_SIZE + (j >> 1); + stencilVals[j] = tile->data.depth32[y][x] & 0xff; + } + break; + case PIPE_FORMAT_S8_UNORM: + for (j = 0; j < QUAD_SIZE; j++) { + int x = quad->input.x0 % TILE_SIZE + (j & 1); + int y = quad->input.y0 % TILE_SIZE + (j >> 1); + stencilVals[j] = tile->data.stencil8[y][x]; + } + break; + default: + assert(0); } - break; - default: - assert(0); - } - /* do the stencil test first */ - { - unsigned passMask, failMask; - passMask = do_stencil_test(stencilVals, func, ref, valMask); - failMask = quad->inout.mask & ~passMask; - quad->inout.mask &= passMask; + /* do the stencil test first */ + { + unsigned passMask, failMask; + passMask = do_stencil_test(stencilVals, func, ref, valMask); + failMask = quad->inout.mask & ~passMask; + quad->inout.mask &= passMask; - if (failOp != PIPE_STENCIL_OP_KEEP) { - apply_stencil_op(stencilVals, failMask, failOp, ref, wrtMask); + if (failOp != PIPE_STENCIL_OP_KEEP) { + apply_stencil_op(stencilVals, failMask, failOp, ref, wrtMask); + } } - } - if (quad->inout.mask) { - /* now the pixels that passed the stencil test are depth tested */ - if (softpipe->depth_stencil->depth.enabled) { - const unsigned origMask = quad->inout.mask; + if (quad->inout.mask) { + /* now the pixels that passed the stencil test are depth tested */ + if (softpipe->depth_stencil->depth.enabled) { + const unsigned origMask = quad->inout.mask; - sp_depth_test_quad(qs, quad); /* quad->mask is updated */ + sp_depth_test_quad(qs, quad); /* quad->mask is updated */ - /* update stencil buffer values according to z pass/fail result */ - if (zFailOp != PIPE_STENCIL_OP_KEEP) { - const unsigned failMask = origMask & ~quad->inout.mask; - apply_stencil_op(stencilVals, failMask, zFailOp, ref, wrtMask); - } + /* update stencil buffer values according to z pass/fail result */ + if (zFailOp != PIPE_STENCIL_OP_KEEP) { + const unsigned failMask = origMask & ~quad->inout.mask; + apply_stencil_op(stencilVals, failMask, zFailOp, ref, wrtMask); + } - if (zPassOp != PIPE_STENCIL_OP_KEEP) { - const unsigned passMask = origMask & quad->inout.mask; - apply_stencil_op(stencilVals, passMask, zPassOp, ref, wrtMask); + if (zPassOp != PIPE_STENCIL_OP_KEEP) { + const unsigned passMask = origMask & quad->inout.mask; + apply_stencil_op(stencilVals, passMask, zPassOp, ref, wrtMask); + } + } + else { + /* no depth test, apply Zpass operator to stencil buffer values */ + apply_stencil_op(stencilVals, quad->inout.mask, zPassOp, ref, wrtMask); } - } - else { - /* no depth test, apply Zpass operator to stencil buffer values */ - apply_stencil_op(stencilVals, quad->inout.mask, zPassOp, ref, wrtMask); - } - - } - /* put new stencil values into cached tile */ - switch (ps->format) { - case PIPE_FORMAT_S8Z24_UNORM: - for (j = 0; j < QUAD_SIZE; j++) { - int x = quad->input.x0 % TILE_SIZE + (j & 1); - int y = quad->input.y0 % TILE_SIZE + (j >> 1); - uint s8z24 = tile->data.depth32[y][x]; - s8z24 = (stencilVals[j] << 24) | (s8z24 & 0xffffff); - tile->data.depth32[y][x] = s8z24; } - break; - case PIPE_FORMAT_Z24S8_UNORM: - for (j = 0; j < QUAD_SIZE; j++) { - int x = quad->input.x0 % TILE_SIZE + (j & 1); - int y = quad->input.y0 % TILE_SIZE + (j >> 1); - uint z24s8 = tile->data.depth32[y][x]; - z24s8 = (z24s8 & 0xffffff00) | stencilVals[j]; - tile->data.depth32[y][x] = z24s8; - } - break; - case PIPE_FORMAT_S8_UNORM: - for (j = 0; j < QUAD_SIZE; j++) { - int x = quad->input.x0 % TILE_SIZE + (j & 1); - int y = quad->input.y0 % TILE_SIZE + (j >> 1); - tile->data.stencil8[y][x] = stencilVals[j]; + + /* put new stencil values into cached tile */ + switch (ps->format) { + case PIPE_FORMAT_S8Z24_UNORM: + for (j = 0; j < QUAD_SIZE; j++) { + int x = quad->input.x0 % TILE_SIZE + (j & 1); + int y = quad->input.y0 % TILE_SIZE + (j >> 1); + uint s8z24 = tile->data.depth32[y][x]; + s8z24 = (stencilVals[j] << 24) | (s8z24 & 0xffffff); + tile->data.depth32[y][x] = s8z24; + } + break; + case PIPE_FORMAT_Z24S8_UNORM: + for (j = 0; j < QUAD_SIZE; j++) { + int x = quad->input.x0 % TILE_SIZE + (j & 1); + int y = quad->input.y0 % TILE_SIZE + (j >> 1); + uint z24s8 = tile->data.depth32[y][x]; + z24s8 = (z24s8 & 0xffffff00) | stencilVals[j]; + tile->data.depth32[y][x] = z24s8; + } + break; + case PIPE_FORMAT_S8_UNORM: + for (j = 0; j < QUAD_SIZE; j++) { + int x = quad->input.x0 % TILE_SIZE + (j & 1); + int y = quad->input.y0 % TILE_SIZE + (j >> 1); + tile->data.stencil8[y][x] = stencilVals[j]; + } + break; + default: + assert(0); } - break; - default: - assert(0); + + if (quad->inout.mask) + quads[pass++] = q; } - if (quad->inout.mask) - qs->next->run(qs->next, quad); + if (pass) + qs->next->run(qs->next, quads, pass); } diff --git a/src/gallium/drivers/softpipe/sp_quad_stipple.c b/src/gallium/drivers/softpipe/sp_quad_stipple.c index 07162db7b6..05665d8e26 100644 --- a/src/gallium/drivers/softpipe/sp_quad_stipple.c +++ b/src/gallium/drivers/softpipe/sp_quad_stipple.c @@ -14,40 +14,46 @@ * Apply polygon stipple to quads produced by triangle rasterization */ static void -stipple_quad(struct quad_stage *qs, struct quad_header *quad) +stipple_quad(struct quad_stage *qs, struct quad_header *quads[], unsigned nr) { static const uint bit31 = 1 << 31; static const uint bit30 = 1 << 30; + unsigned pass = nr; - if (quad->input.prim == QUAD_PRIM_TRI) { + if (quads[0]->input.prim == QUAD_PRIM_TRI) { struct softpipe_context *softpipe = qs->softpipe; - /* need to invert Y to index into OpenGL's stipple pattern */ - const int col0 = quad->input.x0 % 32; - const int y0 = quad->input.y0; - const int y1 = y0 + 1; - const uint stipple0 = softpipe->poly_stipple.stipple[y0 % 32]; - const uint stipple1 = softpipe->poly_stipple.stipple[y1 % 32]; + unsigned q; - /* turn off quad mask bits that fail the stipple test */ - if ((stipple0 & (bit31 >> col0)) == 0) - quad->inout.mask &= ~MASK_TOP_LEFT; + pass = 0; - if ((stipple0 & (bit30 >> col0)) == 0) - quad->inout.mask &= ~MASK_TOP_RIGHT; + for (q = 0; q < nr; q++) { + struct quad_header *quad = quads[q]; - if ((stipple1 & (bit31 >> col0)) == 0) - quad->inout.mask &= ~MASK_BOTTOM_LEFT; + const int col0 = quad->input.x0 % 32; + const int y0 = quad->input.y0; + const int y1 = y0 + 1; + const uint stipple0 = softpipe->poly_stipple.stipple[y0 % 32]; + const uint stipple1 = softpipe->poly_stipple.stipple[y1 % 32]; - if ((stipple1 & (bit30 >> col0)) == 0) - quad->inout.mask &= ~MASK_BOTTOM_RIGHT; + /* turn off quad mask bits that fail the stipple test */ + if ((stipple0 & (bit31 >> col0)) == 0) + quad->inout.mask &= ~MASK_TOP_LEFT; - if (!quad->inout.mask) { - /* all fragments failed stipple test, end of quad pipeline */ - return; + if ((stipple0 & (bit30 >> col0)) == 0) + quad->inout.mask &= ~MASK_TOP_RIGHT; + + if ((stipple1 & (bit31 >> col0)) == 0) + quad->inout.mask &= ~MASK_BOTTOM_LEFT; + + if ((stipple1 & (bit30 >> col0)) == 0) + quad->inout.mask &= ~MASK_BOTTOM_RIGHT; + + if (quad->inout.mask) + quads[pass++] = quad; } } - qs->next->run(qs->next, quad); + qs->next->run(qs->next, quads, pass); } diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c index eaf84ed9de..23dcae89c6 100644 --- a/src/gallium/drivers/softpipe/sp_setup.c +++ b/src/gallium/drivers/softpipe/sp_setup.c @@ -172,7 +172,7 @@ clip_emit_quad( struct setup_context *setup, struct quad_header *quad ) if (quad->inout.mask) { struct softpipe_context *sp = setup->softpipe; - sp->quad.first->run( sp->quad.first, quad ); + sp->quad.first->run( sp->quad.first, &quad, 1 ); } } @@ -193,7 +193,7 @@ emit_quad( struct setup_context *setup, struct quad_header *quad, uint thread ) if (mask & 4) setup->numFragsEmitted++; if (mask & 8) setup->numFragsEmitted++; #endif - sp->quad.first->run( sp->quad.first, quad ); + sp->quad.first->run( sp->quad.first, &quad, 1 ); #if DEBUG_FRAGS mask = quad->inout.mask; if (mask & 1) setup->numFragsWritten++; -- cgit v1.2.3 From a1dbd7aa159e266592a1e52504680992327ca9e0 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 24 Jul 2009 18:17:05 +0100 Subject: softpipe: actually pass >1 quad from triangle routine First attempt --- src/gallium/drivers/softpipe/sp_context.h | 11 +- src/gallium/drivers/softpipe/sp_prim_vbuf.c | 2 + src/gallium/drivers/softpipe/sp_quad.h | 6 +- src/gallium/drivers/softpipe/sp_quad_blend.c | 9 +- src/gallium/drivers/softpipe/sp_quad_coverage.c | 10 +- src/gallium/drivers/softpipe/sp_quad_pipe.c | 6 +- src/gallium/drivers/softpipe/sp_quad_stipple.c | 44 +++--- src/gallium/drivers/softpipe/sp_setup.c | 186 ++++++++++++------------ 8 files changed, 135 insertions(+), 139 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index 414d903a37..153a648b0e 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -96,7 +96,16 @@ struct softpipe_context { /** Which vertex shader output slot contains point size */ int psize_slot; - unsigned reduced_api_prim; /**< PIPE_PRIM_POINTS, _LINES or _TRIANGLES */ + /* The reduced version of the primitive supplied by the state + * tracker. + */ + unsigned reduced_api_prim; + + /* The reduced primitive after unfilled triangles, wide-line + * decomposition, etc, are taken into account. This is the + * primitive actually rasterized. + */ + unsigned reduced_prim; /** Derived from scissor and surface bounds: */ struct pipe_scissor_state cliprect; diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c index 42021789ea..1dd63d99ff 100644 --- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c +++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c @@ -44,6 +44,7 @@ #include "draw/draw_context.h" #include "draw/draw_vbuf.h" #include "util/u_memory.h" +#include "util/u_prim.h" #define SP_MAX_VBUF_INDEXES 1024 @@ -167,6 +168,7 @@ sp_vbuf_set_primitive(struct vbuf_render *vbr, unsigned prim) setup_prepare( setup_ctx ); + cvbr->softpipe->reduced_prim = u_reduced_prim(prim); cvbr->prim = prim; return TRUE; diff --git a/src/gallium/drivers/softpipe/sp_quad.h b/src/gallium/drivers/softpipe/sp_quad.h index bd6c6cb912..a3236bd116 100644 --- a/src/gallium/drivers/softpipe/sp_quad.h +++ b/src/gallium/drivers/softpipe/sp_quad.h @@ -97,10 +97,10 @@ struct quad_header { struct quad_header_inout inout; struct quad_header_output output; - const struct tgsi_interp_coef *coef; + /* Redundant/duplicated: + */ const struct tgsi_interp_coef *posCoef; - - unsigned nr_attrs; + const struct tgsi_interp_coef *coef; }; #endif /* SP_QUAD_H */ diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c index fdf1bb4552..8ef8666c0e 100644 --- a/src/gallium/drivers/softpipe/sp_quad_blend.c +++ b/src/gallium/drivers/softpipe/sp_quad_blend.c @@ -123,10 +123,6 @@ logicop_quad(struct quad_stage *qs, { struct softpipe_context *softpipe = qs->softpipe; uint cbuf; - struct softpipe_cached_tile * - tile = sp_get_cached_tile(softpipe->cbuf_cache[cbuf], - quads[0]->input.x0, - quads[0]->input.y0); /* loop over colorbuffer outputs */ for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) { @@ -137,6 +133,11 @@ logicop_quad(struct quad_stage *qs, uint *res4 = (uint *) res; uint i, j; + struct softpipe_cached_tile * + tile = sp_get_cached_tile(softpipe->cbuf_cache[cbuf], + quads[0]->input.x0, + quads[0]->input.y0); + for (i = 0; i < nr; i++) { struct quad_header *quad = quads[i]; float (*quadColor)[4] = quad->output.color[cbuf]; diff --git a/src/gallium/drivers/softpipe/sp_quad_coverage.c b/src/gallium/drivers/softpipe/sp_quad_coverage.c index eda5ce8e63..f06a385b3c 100644 --- a/src/gallium/drivers/softpipe/sp_quad_coverage.c +++ b/src/gallium/drivers/softpipe/sp_quad_coverage.c @@ -69,16 +69,10 @@ coverage_run(struct quad_stage *qs, unsigned nr) { struct softpipe_context *softpipe = qs->softpipe; - const uint prim = quads[0]->input.prim; unsigned i; - if ((softpipe->rasterizer->poly_smooth && prim == QUAD_PRIM_TRI) || - (softpipe->rasterizer->line_smooth && prim == QUAD_PRIM_LINE) || - (softpipe->rasterizer->point_smooth && prim == QUAD_PRIM_POINT)) { - - for (i = 0; i < nr; i++) - coverage_quad( qs, quads[i] ); - } + for (i = 0; i < nr; i++) + coverage_quad( qs, quads[i] ); qs->next->run(qs->next, quads, nr); } diff --git a/src/gallium/drivers/softpipe/sp_quad_pipe.c b/src/gallium/drivers/softpipe/sp_quad_pipe.c index 594fade455..6fae7d552f 100644 --- a/src/gallium/drivers/softpipe/sp_quad_pipe.c +++ b/src/gallium/drivers/softpipe/sp_quad_pipe.c @@ -76,9 +76,9 @@ sp_build_quad_pipeline(struct softpipe_context *sp) sp_push_quad_first( sp, sp->quad.blend ); } - if (sp->rasterizer->poly_smooth || - sp->rasterizer->line_smooth || - sp->rasterizer->point_smooth) { + if ((sp->rasterizer->poly_smooth && sp->reduced_prim == PIPE_PRIM_TRIANGLES) || + (sp->rasterizer->line_smooth && sp->reduced_prim == PIPE_PRIM_LINES) || + (sp->rasterizer->point_smooth && sp->reduced_prim == PIPE_PRIM_POINTS)) { sp_push_quad_first( sp, sp->quad.coverage ); } diff --git a/src/gallium/drivers/softpipe/sp_quad_stipple.c b/src/gallium/drivers/softpipe/sp_quad_stipple.c index 05665d8e26..a0527a596a 100644 --- a/src/gallium/drivers/softpipe/sp_quad_stipple.c +++ b/src/gallium/drivers/softpipe/sp_quad_stipple.c @@ -20,37 +20,35 @@ stipple_quad(struct quad_stage *qs, struct quad_header *quads[], unsigned nr) static const uint bit30 = 1 << 30; unsigned pass = nr; - if (quads[0]->input.prim == QUAD_PRIM_TRI) { - struct softpipe_context *softpipe = qs->softpipe; - unsigned q; + struct softpipe_context *softpipe = qs->softpipe; + unsigned q; - pass = 0; + pass = 0; - for (q = 0; q < nr; q++) { - struct quad_header *quad = quads[q]; + for (q = 0; q < nr; q++) { + struct quad_header *quad = quads[q]; - const int col0 = quad->input.x0 % 32; - const int y0 = quad->input.y0; - const int y1 = y0 + 1; - const uint stipple0 = softpipe->poly_stipple.stipple[y0 % 32]; - const uint stipple1 = softpipe->poly_stipple.stipple[y1 % 32]; + const int col0 = quad->input.x0 % 32; + const int y0 = quad->input.y0; + const int y1 = y0 + 1; + const uint stipple0 = softpipe->poly_stipple.stipple[y0 % 32]; + const uint stipple1 = softpipe->poly_stipple.stipple[y1 % 32]; - /* turn off quad mask bits that fail the stipple test */ - if ((stipple0 & (bit31 >> col0)) == 0) - quad->inout.mask &= ~MASK_TOP_LEFT; + /* turn off quad mask bits that fail the stipple test */ + if ((stipple0 & (bit31 >> col0)) == 0) + quad->inout.mask &= ~MASK_TOP_LEFT; - if ((stipple0 & (bit30 >> col0)) == 0) - quad->inout.mask &= ~MASK_TOP_RIGHT; + if ((stipple0 & (bit30 >> col0)) == 0) + quad->inout.mask &= ~MASK_TOP_RIGHT; - if ((stipple1 & (bit31 >> col0)) == 0) - quad->inout.mask &= ~MASK_BOTTOM_LEFT; + if ((stipple1 & (bit31 >> col0)) == 0) + quad->inout.mask &= ~MASK_BOTTOM_LEFT; - if ((stipple1 & (bit30 >> col0)) == 0) - quad->inout.mask &= ~MASK_BOTTOM_RIGHT; + if ((stipple1 & (bit30 >> col0)) == 0) + quad->inout.mask &= ~MASK_BOTTOM_RIGHT; - if (quad->inout.mask) - quads[pass++] = quad; - } + if (quad->inout.mask) + quads[pass++] = quad; } qs->next->run(qs->next, quads, pass); diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c index 23dcae89c6..a132911c99 100644 --- a/src/gallium/drivers/softpipe/sp_setup.c +++ b/src/gallium/drivers/softpipe/sp_setup.c @@ -62,6 +62,8 @@ struct edge { }; +#define MAX_QUADS 16 + /** * Triangle setup info (derived from draw_stage). @@ -84,10 +86,14 @@ struct setup_context { struct edge emaj; float oneoverarea; + int facing; + + struct quad_header quad[MAX_QUADS]; + struct quad_header *quad_ptrs[MAX_QUADS]; + unsigned count; struct tgsi_interp_coef coef[PIPE_MAX_SHADER_INPUTS]; struct tgsi_interp_coef posCoef; /* For Z, W */ - struct quad_header quad; struct { int left[2]; /**< [0] = row0, [1] = row1 */ @@ -176,41 +182,6 @@ clip_emit_quad( struct setup_context *setup, struct quad_header *quad ) } } -/** - * Emit a quad (pass to next stage). No clipping is done. - */ -static INLINE void -emit_quad( struct setup_context *setup, struct quad_header *quad, uint thread ) -{ - struct softpipe_context *sp = setup->softpipe; -#if DEBUG_FRAGS - uint mask = quad->inout.mask; -#endif - -#if DEBUG_FRAGS - if (mask & 1) setup->numFragsEmitted++; - if (mask & 2) setup->numFragsEmitted++; - if (mask & 4) setup->numFragsEmitted++; - if (mask & 8) setup->numFragsEmitted++; -#endif - sp->quad.first->run( sp->quad.first, &quad, 1 ); -#if DEBUG_FRAGS - mask = quad->inout.mask; - if (mask & 1) setup->numFragsWritten++; - if (mask & 2) setup->numFragsWritten++; - if (mask & 4) setup->numFragsWritten++; - if (mask & 8) setup->numFragsWritten++; -#endif -} - - -#define EMIT_QUAD(setup,x,y,qmask) \ -do { \ - setup->quad.input.x0 = x; \ - setup->quad.input.y0 = y; \ - setup->quad.inout.mask = qmask; \ - emit_quad( setup, &setup->quad, 0 ); \ -} while (0) /** @@ -219,7 +190,12 @@ do { \ */ static INLINE int block( int x ) { - return x & ~1; + return x & ~(2-1); +} + +static INLINE int block_x( int x ) +{ + return x & ~(16-1); } @@ -228,13 +204,15 @@ static INLINE int block( int x ) */ static void flush_spans( struct setup_context *setup ) { - const int step = 30; + const int step = 16; const int xleft0 = setup->span.left[0]; const int xleft1 = setup->span.left[1]; const int xright0 = setup->span.right[0]; const int xright1 = setup->span.right[1]; + struct quad_stage *pipe = setup->softpipe->quad.first; + - int minleft = block(MIN2(xleft0, xleft1)); + int minleft = block_x(MIN2(xleft0, xleft1)); int maxright = MAX2(xright0, xright1); int x; @@ -244,7 +222,8 @@ static void flush_spans( struct setup_context *setup ) unsigned skip_right0 = CLAMP(x + step - xright0, 0, step); unsigned skip_right1 = CLAMP(x + step - xright1, 0, step); unsigned lx = x; - + unsigned q = 0; + unsigned skipmask_left0 = (1U << skip_left0) - 1U; unsigned skipmask_left1 = (1U << skip_left1) - 1U; @@ -256,13 +235,22 @@ static void flush_spans( struct setup_context *setup ) unsigned mask0 = ~skipmask_left0 & ~skipmask_right0; unsigned mask1 = ~skipmask_left1 & ~skipmask_right1; - while (mask0 | mask1) { - unsigned quadmask = (mask0 & 3) | ((mask1 & 3) << 2); - if (quadmask) - EMIT_QUAD( setup, lx, setup->span.y, quadmask ); - mask0 >>= 2; - mask1 >>= 2; - lx += 2; + if (mask0 | mask1) { + do { + unsigned quadmask = (mask0 & 3) | ((mask1 & 3) << 2); + if (quadmask) { + setup->quad[q].input.x0 = lx; + setup->quad[q].input.y0 = setup->span.y; + setup->quad[q].inout.mask = quadmask; + setup->quad_ptrs[q] = &setup->quad[q]; + q++; + } + mask0 >>= 2; + mask1 >>= 2; + lx += 2; + } while (mask0 | mask1); + + pipe->run( pipe, setup->quad_ptrs, q ); } } @@ -281,7 +269,7 @@ static void print_vertex(const struct setup_context *setup, { int i; debug_printf(" Vertex: (%p)\n", v); - for (i = 0; i < setup->quad.nr_attrs; i++) { + for (i = 0; i < setup->quad[0].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])) { @@ -386,7 +374,9 @@ static boolean setup_sort_vertices( struct setup_context *setup, * - the GLSL gl_FrontFacing fragment attribute (bool) * - two-sided stencil test */ - setup->quad.input.facing = (det > 0.0) ^ (setup->softpipe->rasterizer->front_winding == PIPE_WINDING_CW); + setup->facing = + ((det > 0.0) ^ + (setup->softpipe->rasterizer->front_winding == PIPE_WINDING_CW)); return TRUE; } @@ -573,7 +563,7 @@ static void setup_tri_coefficients( struct setup_context *setup ) } if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FACE) { - setup->coef[fragSlot].a0[0] = 1.0f - setup->quad.input.facing; + setup->coef[fragSlot].a0[0] = 1.0f - setup->facing; setup->coef[fragSlot].dadx[0] = 0.0; setup->coef[fragSlot].dady[0] = 0.0; } @@ -741,7 +731,7 @@ void setup_tri( struct setup_context *setup, setup_tri_coefficients( setup ); setup_tri_edges( setup ); - setup->quad.input.prim = QUAD_PRIM_TRI; + assert(setup->softpipe->reduced_prim == PIPE_PRIM_TRIANGLES); setup->span.y = 0; setup->span.right[0] = 0; @@ -881,7 +871,7 @@ setup_line_coefficients(struct setup_context *setup, } if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FACE) { - setup->coef[fragSlot].a0[0] = 1.0f - setup->quad.input.facing; + setup->coef[fragSlot].a0[0] = 1.0f - setup->facing; setup->coef[fragSlot].dadx[0] = 0.0; setup->coef[fragSlot].dady[0] = 0.0; } @@ -902,20 +892,20 @@ plot(struct setup_context *setup, int x, int y) const int quadY = y - iy; const int mask = (1 << ix) << (2 * iy); - if (quadX != setup->quad.input.x0 || - quadY != setup->quad.input.y0) + if (quadX != setup->quad[0].input.x0 || + quadY != setup->quad[0].input.y0) { /* flush prev quad, start new quad */ - if (setup->quad.input.x0 != -1) - clip_emit_quad( setup, &setup->quad ); + if (setup->quad[0].input.x0 != -1) + clip_emit_quad( setup, &setup->quad[0] ); - setup->quad.input.x0 = quadX; - setup->quad.input.y0 = quadY; - setup->quad.inout.mask = 0x0; + setup->quad[0].input.x0 = quadX; + setup->quad[0].input.y0 = quadY; + setup->quad[0].inout.mask = 0x0; } - setup->quad.inout.mask |= mask; + setup->quad[0].inout.mask |= mask; } @@ -975,17 +965,18 @@ setup_line(struct setup_context *setup, assert(dx >= 0); assert(dy >= 0); + assert(setup->softpipe->reduced_prim == PIPE_PRIM_LINES); + + setup->quad[0].input.x0 = setup->quad[0].input.y0 = -1; + setup->quad[0].inout.mask = 0x0; - setup->quad.input.x0 = setup->quad.input.y0 = -1; - setup->quad.inout.mask = 0x0; - setup->quad.input.prim = QUAD_PRIM_LINE; /* XXX temporary: set coverage to 1.0 so the line appears * if AA mode happens to be enabled. */ - setup->quad.input.coverage[0] = - setup->quad.input.coverage[1] = - setup->quad.input.coverage[2] = - setup->quad.input.coverage[3] = 1.0; + setup->quad[0].input.coverage[0] = + setup->quad[0].input.coverage[1] = + setup->quad[0].input.coverage[2] = + setup->quad[0].input.coverage[3] = 1.0; if (dx > dy) { /*** X-major line ***/ @@ -1029,8 +1020,8 @@ setup_line(struct setup_context *setup, } /* draw final quad */ - if (setup->quad.inout.mask) { - clip_emit_quad( setup, &setup->quad ); + if (setup->quad[0].inout.mask) { + clip_emit_quad( setup, &setup->quad[0] ); } } @@ -1078,6 +1069,8 @@ setup_point( struct setup_context *setup, if (softpipe->no_rast) return; + assert(setup->softpipe->reduced_prim == PIPE_PRIM_POINTS); + /* For points, all interpolants are constant-valued. * However, for point sprites, we'll need to setup texcoords appropriately. * XXX: which coefficients are the texcoords??? @@ -1124,22 +1117,21 @@ setup_point( struct setup_context *setup, } if (spfs->info.input_semantic_name[fragSlot] == TGSI_SEMANTIC_FACE) { - setup->coef[fragSlot].a0[0] = 1.0f - setup->quad.input.facing; + setup->coef[fragSlot].a0[0] = 1.0f - setup->facing; setup->coef[fragSlot].dadx[0] = 0.0; setup->coef[fragSlot].dady[0] = 0.0; } } - setup->quad.input.prim = QUAD_PRIM_POINT; if (halfSize <= 0.5 && !round) { /* special case for 1-pixel points */ const int ix = ((int) x) & 1; const int iy = ((int) y) & 1; - setup->quad.input.x0 = (int) x - ix; - setup->quad.input.y0 = (int) y - iy; - setup->quad.inout.mask = (1 << ix) << (2 * iy); - clip_emit_quad( setup, &setup->quad ); + setup->quad[0].input.x0 = (int) x - ix; + setup->quad[0].input.y0 = (int) y - iy; + setup->quad[0].inout.mask = (1 << ix) << (2 * iy); + clip_emit_quad( setup, &setup->quad[0] ); } else { if (round) { @@ -1159,15 +1151,15 @@ setup_point( struct setup_context *setup, for (ix = ixmin; ix <= ixmax; ix += 2) { float dx, dy, dist2, cover; - setup->quad.inout.mask = 0x0; + setup->quad[0].inout.mask = 0x0; dx = (ix + 0.5f) - x; dy = (iy + 0.5f) - y; dist2 = dx * dx + dy * dy; if (dist2 <= rmax2) { cover = 1.0F - (dist2 - rmin2) * cscale; - setup->quad.input.coverage[QUAD_TOP_LEFT] = MIN2(cover, 1.0f); - setup->quad.inout.mask |= MASK_TOP_LEFT; + setup->quad[0].input.coverage[QUAD_TOP_LEFT] = MIN2(cover, 1.0f); + setup->quad[0].inout.mask |= MASK_TOP_LEFT; } dx = (ix + 1.5f) - x; @@ -1175,8 +1167,8 @@ setup_point( struct setup_context *setup, dist2 = dx * dx + dy * dy; if (dist2 <= rmax2) { cover = 1.0F - (dist2 - rmin2) * cscale; - setup->quad.input.coverage[QUAD_TOP_RIGHT] = MIN2(cover, 1.0f); - setup->quad.inout.mask |= MASK_TOP_RIGHT; + setup->quad[0].input.coverage[QUAD_TOP_RIGHT] = MIN2(cover, 1.0f); + setup->quad[0].inout.mask |= MASK_TOP_RIGHT; } dx = (ix + 0.5f) - x; @@ -1184,8 +1176,8 @@ setup_point( struct setup_context *setup, dist2 = dx * dx + dy * dy; if (dist2 <= rmax2) { cover = 1.0F - (dist2 - rmin2) * cscale; - setup->quad.input.coverage[QUAD_BOTTOM_LEFT] = MIN2(cover, 1.0f); - setup->quad.inout.mask |= MASK_BOTTOM_LEFT; + setup->quad[0].input.coverage[QUAD_BOTTOM_LEFT] = MIN2(cover, 1.0f); + setup->quad[0].inout.mask |= MASK_BOTTOM_LEFT; } dx = (ix + 1.5f) - x; @@ -1193,14 +1185,14 @@ setup_point( struct setup_context *setup, dist2 = dx * dx + dy * dy; if (dist2 <= rmax2) { cover = 1.0F - (dist2 - rmin2) * cscale; - setup->quad.input.coverage[QUAD_BOTTOM_RIGHT] = MIN2(cover, 1.0f); - setup->quad.inout.mask |= MASK_BOTTOM_RIGHT; + setup->quad[0].input.coverage[QUAD_BOTTOM_RIGHT] = MIN2(cover, 1.0f); + setup->quad[0].inout.mask |= MASK_BOTTOM_RIGHT; } - if (setup->quad.inout.mask) { - setup->quad.input.x0 = ix; - setup->quad.input.y0 = iy; - clip_emit_quad( setup, &setup->quad ); + if (setup->quad[0].inout.mask) { + setup->quad[0].input.x0 = ix; + setup->quad[0].input.y0 = iy; + clip_emit_quad( setup, &setup->quad[0] ); } } } @@ -1244,10 +1236,10 @@ setup_point( struct setup_context *setup, mask &= (MASK_BOTTOM_LEFT | MASK_TOP_LEFT); } - setup->quad.inout.mask = mask; - setup->quad.input.x0 = ix; - setup->quad.input.y0 = iy; - clip_emit_quad( setup, &setup->quad ); + setup->quad[0].inout.mask = mask; + setup->quad[0].input.x0 = ix; + setup->quad[0].input.y0 = iy; + clip_emit_quad( setup, &setup->quad[0] ); } } } @@ -1262,9 +1254,6 @@ void setup_prepare( struct setup_context *setup ) softpipe_update_derived(sp); } - /* Note: nr_attrs is only used for debugging (vertex printing) */ - setup->quad.nr_attrs = draw_num_vs_outputs(sp->draw); - sp->quad.first->begin( sp->quad.first ); if (sp->reduced_api_prim == PIPE_PRIM_TRIANGLES && @@ -1293,11 +1282,14 @@ void setup_destroy_context( struct setup_context *setup ) struct setup_context *setup_create_context( struct softpipe_context *softpipe ) { struct setup_context *setup = CALLOC_STRUCT(setup_context); + unsigned i; setup->softpipe = softpipe; - setup->quad.coef = setup->coef; - setup->quad.posCoef = &setup->posCoef; + for (i = 0; i < MAX_QUADS; i++) { + setup->quad[i].coef = setup->coef; + setup->quad[i].posCoef = &setup->posCoef; + } setup->span.left[0] = 1000000; /* greater than right[0] */ setup->span.left[1] = 1000000; /* greater than right[1] */ -- cgit v1.2.3 From 333ec94380af502b1c492f61dcc1897bcf43a96c Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 24 Jul 2009 18:46:17 +0100 Subject: softpipe: example fastpaths in blending --- src/gallium/drivers/softpipe/sp_quad_blend.c | 132 ++++++++++++++++++++++++--- 1 file changed, 121 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c index 8ef8666c0e..1ef7529cff 100644 --- a/src/gallium/drivers/softpipe/sp_quad_blend.c +++ b/src/gallium/drivers/softpipe/sp_quad_blend.c @@ -117,9 +117,9 @@ do { \ static void -logicop_quad(struct quad_stage *qs, - struct quad_header *quads[], - unsigned nr) +logicop_quads(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) { struct softpipe_context *softpipe = qs->softpipe; uint cbuf; @@ -241,13 +241,102 @@ logicop_quad(struct quad_stage *qs, } } } + + /* pass blended quad to next stage */ + qs->next->run(qs->next, quads, nr); +} + +static void +blend_single_add_src_alpha_inv_src_alpha(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) +{ + static const float one[4] = { 1, 1, 1, 1 }; + float one_minus_alpha[QUAD_SIZE]; + float dest[4][QUAD_SIZE]; + float source[4][QUAD_SIZE]; + uint i, j, q; + + struct softpipe_cached_tile *tile + = sp_get_cached_tile(qs->softpipe->cbuf_cache[0], + quads[0]->input.x0, + quads[0]->input.y0); + + for (q = 0; q < nr; q++) { + struct quad_header *quad = quads[q]; + float (*quadColor)[4] = quad->output.color[0]; + const float *alpha = quadColor[3]; + + /* get/swizzle dest colors */ + for (j = 0; j < QUAD_SIZE; j++) { + int x = (quad->input.x0 & (TILE_SIZE-1)) + (j & 1); + int y = (quad->input.y0 & (TILE_SIZE-1)) + (j >> 1); + for (i = 0; i < 4; i++) { + dest[i][j] = tile->data.color[y][x][i]; + } + } + + VEC4_MUL(source[0], quadColor[0], alpha); /* R */ + VEC4_MUL(source[1], quadColor[1], alpha); /* G */ + VEC4_MUL(source[2], quadColor[2], alpha); /* B */ + VEC4_MUL(source[3], quadColor[3], alpha); /* A */ + + VEC4_SUB(one_minus_alpha, one, alpha); + VEC4_MUL(dest[0], dest[0], one_minus_alpha); /* R */ + VEC4_MUL(dest[1], dest[1], one_minus_alpha); /* G */ + VEC4_MUL(dest[2], dest[2], one_minus_alpha); /* B */ + VEC4_MUL(dest[3], dest[3], one_minus_alpha); /* B */ + + VEC4_ADD_SAT(quadColor[0], source[0], dest[0]); /* R */ + VEC4_ADD_SAT(quadColor[1], source[1], dest[1]); /* G */ + VEC4_ADD_SAT(quadColor[2], source[2], dest[2]); /* B */ + VEC4_ADD_SAT(quadColor[3], source[3], dest[3]); /* A */ + } + + /* pass blended quad to next stage */ + qs->next->run(qs->next, quads, nr); } +static void +blend_single_add_one_one(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) +{ + float dest[4][QUAD_SIZE]; + uint i, j, q; + + struct softpipe_cached_tile *tile + = sp_get_cached_tile(qs->softpipe->cbuf_cache[0], + quads[0]->input.x0, + quads[0]->input.y0); + + for (q = 0; q < nr; q++) { + struct quad_header *quad = quads[q]; + float (*quadColor)[4] = quad->output.color[0]; + + /* get/swizzle dest colors */ + for (j = 0; j < QUAD_SIZE; j++) { + int x = (quad->input.x0 & (TILE_SIZE-1)) + (j & 1); + int y = (quad->input.y0 & (TILE_SIZE-1)) + (j >> 1); + for (i = 0; i < 4; i++) { + dest[i][j] = tile->data.color[y][x][i]; + } + } + + VEC4_ADD_SAT(quadColor[0], quadColor[0], dest[0]); /* R */ + VEC4_ADD_SAT(quadColor[1], quadColor[1], dest[1]); /* G */ + VEC4_ADD_SAT(quadColor[2], quadColor[2], dest[2]); /* B */ + VEC4_ADD_SAT(quadColor[3], quadColor[3], dest[3]); /* A */ + } + + /* pass blended quad to next stage */ + qs->next->run(qs->next, quads, nr); +} static void -blend_quads(struct quad_stage *qs, - struct quad_header *quads[], - unsigned nr) +blend_quads_fallback(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) { static const float zero[4] = { 0, 0, 0, 0 }; static const float one[4] = { 1, 1, 1, 1 }; @@ -747,6 +836,9 @@ blend_quads(struct quad_stage *qs, } } } /* cbuf loop */ + + /* pass blended quad to next stage */ + qs->next->run(qs->next, quads, nr); } @@ -756,21 +848,39 @@ blend_quad(struct quad_stage *qs, unsigned nr) { struct softpipe_context *softpipe = qs->softpipe; + const struct pipe_blend_state *blend = softpipe->blend; if (softpipe->blend->logicop_enable) { - logicop_quad(qs, quads, nr); + qs->run = logicop_quads; } - else if (softpipe->blend->blend_enable) { - blend_quads(qs, quads, nr ); + else { + qs->run = blend_quads_fallback; + + if (blend->rgb_src_factor == blend->alpha_src_factor && + blend->rgb_dst_factor == blend->alpha_dst_factor && + blend->rgb_func == blend->alpha_func && + softpipe->framebuffer.nr_cbufs == 1) + { + if (blend->alpha_func == PIPE_BLEND_ADD) { + if (blend->rgb_src_factor == PIPE_BLENDFACTOR_ONE && + blend->rgb_dst_factor == PIPE_BLENDFACTOR_ONE) { + qs->run = blend_single_add_one_one; + } + else if (blend->rgb_src_factor == PIPE_BLENDFACTOR_SRC_ALPHA && + blend->rgb_dst_factor == PIPE_BLENDFACTOR_INV_SRC_ALPHA) + qs->run = blend_single_add_src_alpha_inv_src_alpha; + + } + } } - /* pass blended quad to next stage */ - qs->next->run(qs->next, quads, nr); + qs->run(qs, quads, nr); } static void blend_begin(struct quad_stage *qs) { + qs->run = blend_quad; qs->next->begin(qs->next); } -- cgit v1.2.3 From 42f1757189ba965e6d917d1124d0d6cf78b19a70 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 24 Jul 2009 20:18:52 +0100 Subject: softpipe: fix typo --- src/gallium/drivers/softpipe/sp_quad_stencil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_quad_stencil.c b/src/gallium/drivers/softpipe/sp_quad_stencil.c index 706dd2f756..d9ee80e59a 100644 --- a/src/gallium/drivers/softpipe/sp_quad_stencil.c +++ b/src/gallium/drivers/softpipe/sp_quad_stencil.c @@ -330,7 +330,7 @@ stencil_test_quad(struct quad_stage *qs, struct quad_header *quads[], } if (quad->inout.mask) - quads[pass++] = q; + quads[pass++] = quad; } if (pass) -- cgit v1.2.3 From a2f7ab1d155da52c689f7c6390c233e4eae44643 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 24 Jul 2009 20:19:18 +0100 Subject: softpipe: move all color-combine code into sp_quad_blend.c Consolidate the read-modify-write color combining code from the blend, colormask and output stages. --- src/gallium/drivers/softpipe/Makefile | 14 +- src/gallium/drivers/softpipe/SConscript | 2 - src/gallium/drivers/softpipe/sp_context.c | 4 - src/gallium/drivers/softpipe/sp_context.h | 2 - src/gallium/drivers/softpipe/sp_quad_blend.c | 1352 ++++++++++++---------- src/gallium/drivers/softpipe/sp_quad_bufloop.c | 74 -- src/gallium/drivers/softpipe/sp_quad_colormask.c | 126 -- src/gallium/drivers/softpipe/sp_quad_coverage.c | 1 - src/gallium/drivers/softpipe/sp_quad_output.c | 109 -- src/gallium/drivers/softpipe/sp_quad_pipe.c | 15 +- 10 files changed, 727 insertions(+), 972 deletions(-) delete mode 100644 src/gallium/drivers/softpipe/sp_quad_bufloop.c delete mode 100644 src/gallium/drivers/softpipe/sp_quad_colormask.c delete mode 100644 src/gallium/drivers/softpipe/sp_quad_output.c (limited to 'src') diff --git a/src/gallium/drivers/softpipe/Makefile b/src/gallium/drivers/softpipe/Makefile index 516e3992fd..bdc1a5819f 100644 --- a/src/gallium/drivers/softpipe/Makefile +++ b/src/gallium/drivers/softpipe/Makefile @@ -15,17 +15,15 @@ C_SOURCES = \ sp_prim_setup.c \ sp_prim_vbuf.c \ sp_quad_pipe.c \ - sp_quad_alpha_test.c \ - sp_quad_blend.c \ - sp_quad_colormask.c \ - sp_quad_coverage.c \ - sp_quad_depth_test.c \ + sp_quad_stipple.c \ sp_quad_earlyz.c \ + sp_quad_depth_test.c \ + sp_quad_stencil.c \ sp_quad_fs.c \ + sp_quad_alpha_test.c \ sp_quad_occlusion.c \ - sp_quad_output.c \ - sp_quad_stencil.c \ - sp_quad_stipple.c \ + sp_quad_coverage.c \ + sp_quad_blend.c \ sp_screen.c \ sp_setup.c \ sp_state_blend.c \ diff --git a/src/gallium/drivers/softpipe/SConscript b/src/gallium/drivers/softpipe/SConscript index f8720638a7..dcc25732ba 100644 --- a/src/gallium/drivers/softpipe/SConscript +++ b/src/gallium/drivers/softpipe/SConscript @@ -18,13 +18,11 @@ softpipe = env.ConvenienceLibrary( 'sp_quad_alpha_test.c', 'sp_quad_blend.c', 'sp_quad_pipe.c', - 'sp_quad_colormask.c', 'sp_quad_coverage.c', 'sp_quad_depth_test.c', 'sp_quad_earlyz.c', 'sp_quad_fs.c', 'sp_quad_occlusion.c', - 'sp_quad_output.c', 'sp_quad_stencil.c', 'sp_quad_stipple.c', 'sp_query.c', diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 4418ef0ff4..28a0dd62ac 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -97,8 +97,6 @@ static void softpipe_destroy( struct pipe_context *pipe ) softpipe->quad.occlusion->destroy( softpipe->quad.occlusion ); softpipe->quad.coverage->destroy( softpipe->quad.coverage ); softpipe->quad.blend->destroy( softpipe->quad.blend ); - softpipe->quad.colormask->destroy( softpipe->quad.colormask ); - softpipe->quad.output->destroy( softpipe->quad.output ); for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) sp_destroy_tile_cache(softpipe->cbuf_cache[i]); @@ -241,8 +239,6 @@ softpipe_create( struct pipe_screen *screen ) softpipe->quad.occlusion = sp_quad_occlusion_stage(softpipe); softpipe->quad.coverage = sp_quad_coverage_stage(softpipe); softpipe->quad.blend = sp_quad_blend_stage(softpipe); - softpipe->quad.colormask = sp_quad_colormask_stage(softpipe); - softpipe->quad.output = sp_quad_output_stage(softpipe); /* vertex shader samplers */ for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index 153a648b0e..b76ff610a3 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -123,8 +123,6 @@ struct softpipe_context { struct quad_stage *occlusion; struct quad_stage *coverage; struct quad_stage *blend; - struct quad_stage *colormask; - struct quad_stage *output; struct quad_stage *first; /**< points to one of the above stages */ } quad; diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c index 1ef7529cff..e1f0e77255 100644 --- a/src/gallium/drivers/softpipe/sp_quad_blend.c +++ b/src/gallium/drivers/softpipe/sp_quad_blend.c @@ -117,135 +117,677 @@ do { \ static void -logicop_quads(struct quad_stage *qs, - struct quad_header *quads[], - unsigned nr) +logicop_quad(struct quad_stage *qs, + float (*quadColor)[4], + float (*dest)[4]) { struct softpipe_context *softpipe = qs->softpipe; - uint cbuf; + ubyte src[4][4], dst[4][4], res[4][4]; + uint *src4 = (uint *) src; + uint *dst4 = (uint *) dst; + uint *res4 = (uint *) res; + uint j; + + + /* convert to ubyte */ + for (j = 0; j < 4; j++) { /* loop over R,G,B,A channels */ + dst[j][0] = float_to_ubyte(dest[j][0]); /* P0 */ + dst[j][1] = float_to_ubyte(dest[j][1]); /* P1 */ + dst[j][2] = float_to_ubyte(dest[j][2]); /* P2 */ + dst[j][3] = float_to_ubyte(dest[j][3]); /* P3 */ + + src[j][0] = float_to_ubyte(quadColor[j][0]); /* P0 */ + src[j][1] = float_to_ubyte(quadColor[j][1]); /* P1 */ + src[j][2] = float_to_ubyte(quadColor[j][2]); /* P2 */ + src[j][3] = float_to_ubyte(quadColor[j][3]); /* P3 */ + } + + switch (softpipe->blend->logicop_func) { + case PIPE_LOGICOP_CLEAR: + for (j = 0; j < 4; j++) + res4[j] = 0; + break; + case PIPE_LOGICOP_NOR: + for (j = 0; j < 4; j++) + res4[j] = ~(src4[j] | dst4[j]); + break; + case PIPE_LOGICOP_AND_INVERTED: + for (j = 0; j < 4; j++) + res4[j] = ~src4[j] & dst4[j]; + break; + case PIPE_LOGICOP_COPY_INVERTED: + for (j = 0; j < 4; j++) + res4[j] = ~src4[j]; + break; + case PIPE_LOGICOP_AND_REVERSE: + for (j = 0; j < 4; j++) + res4[j] = src4[j] & ~dst4[j]; + break; + case PIPE_LOGICOP_INVERT: + for (j = 0; j < 4; j++) + res4[j] = ~dst4[j]; + break; + case PIPE_LOGICOP_XOR: + for (j = 0; j < 4; j++) + res4[j] = dst4[j] ^ src4[j]; + break; + case PIPE_LOGICOP_NAND: + for (j = 0; j < 4; j++) + res4[j] = ~(src4[j] & dst4[j]); + break; + case PIPE_LOGICOP_AND: + for (j = 0; j < 4; j++) + res4[j] = src4[j] & dst4[j]; + break; + case PIPE_LOGICOP_EQUIV: + for (j = 0; j < 4; j++) + res4[j] = ~(src4[j] ^ dst4[j]); + break; + case PIPE_LOGICOP_NOOP: + for (j = 0; j < 4; j++) + res4[j] = dst4[j]; + break; + case PIPE_LOGICOP_OR_INVERTED: + for (j = 0; j < 4; j++) + res4[j] = ~src4[j] | dst4[j]; + break; + case PIPE_LOGICOP_COPY: + for (j = 0; j < 4; j++) + res4[j] = src4[j]; + break; + case PIPE_LOGICOP_OR_REVERSE: + for (j = 0; j < 4; j++) + res4[j] = src4[j] | ~dst4[j]; + break; + case PIPE_LOGICOP_OR: + for (j = 0; j < 4; j++) + res4[j] = src4[j] | dst4[j]; + break; + case PIPE_LOGICOP_SET: + for (j = 0; j < 4; j++) + res4[j] = ~0; + break; + default: + assert(0); + } + + for (j = 0; j < 4; j++) { + quadColor[j][0] = ubyte_to_float(res[j][0]); + quadColor[j][1] = ubyte_to_float(res[j][1]); + quadColor[j][2] = ubyte_to_float(res[j][2]); + quadColor[j][3] = ubyte_to_float(res[j][3]); + } +} + + + +static void +blend_quad(struct quad_stage *qs, + float (*quadColor)[4], + float (*dest)[4]) +{ + static const float zero[4] = { 0, 0, 0, 0 }; + static const float one[4] = { 1, 1, 1, 1 }; + struct softpipe_context *softpipe = qs->softpipe; + float source[4][QUAD_SIZE]; + + /* + * Compute src/first term RGB + */ + switch (softpipe->blend->rgb_src_factor) { + case PIPE_BLENDFACTOR_ONE: + VEC4_COPY(source[0], quadColor[0]); /* R */ + VEC4_COPY(source[1], quadColor[1]); /* G */ + VEC4_COPY(source[2], quadColor[2]); /* B */ + break; + case PIPE_BLENDFACTOR_SRC_COLOR: + VEC4_MUL(source[0], quadColor[0], quadColor[0]); /* R */ + VEC4_MUL(source[1], quadColor[1], quadColor[1]); /* G */ + VEC4_MUL(source[2], quadColor[2], quadColor[2]); /* B */ + break; + case PIPE_BLENDFACTOR_SRC_ALPHA: + { + const float *alpha = quadColor[3]; + VEC4_MUL(source[0], quadColor[0], alpha); /* R */ + VEC4_MUL(source[1], quadColor[1], alpha); /* G */ + VEC4_MUL(source[2], quadColor[2], alpha); /* B */ + } + break; + case PIPE_BLENDFACTOR_DST_COLOR: + VEC4_MUL(source[0], quadColor[0], dest[0]); /* R */ + VEC4_MUL(source[1], quadColor[1], dest[1]); /* G */ + VEC4_MUL(source[2], quadColor[2], dest[2]); /* B */ + break; + case PIPE_BLENDFACTOR_DST_ALPHA: + { + const float *alpha = dest[3]; + VEC4_MUL(source[0], quadColor[0], alpha); /* R */ + VEC4_MUL(source[1], quadColor[1], alpha); /* G */ + VEC4_MUL(source[2], quadColor[2], alpha); /* B */ + } + break; + case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: + { + const float *alpha = quadColor[3]; + float diff[4], temp[4]; + VEC4_SUB(diff, one, dest[3]); + VEC4_MIN(temp, alpha, diff); + VEC4_MUL(source[0], quadColor[0], temp); /* R */ + VEC4_MUL(source[1], quadColor[1], temp); /* G */ + VEC4_MUL(source[2], quadColor[2], temp); /* B */ + } + break; + case PIPE_BLENDFACTOR_CONST_COLOR: + { + float comp[4]; + VEC4_SCALAR(comp, softpipe->blend_color.color[0]); /* R */ + VEC4_MUL(source[0], quadColor[0], comp); /* R */ + VEC4_SCALAR(comp, softpipe->blend_color.color[1]); /* G */ + VEC4_MUL(source[1], quadColor[1], comp); /* G */ + VEC4_SCALAR(comp, softpipe->blend_color.color[2]); /* B */ + VEC4_MUL(source[2], quadColor[2], comp); /* B */ + } + break; + case PIPE_BLENDFACTOR_CONST_ALPHA: + { + float alpha[4]; + VEC4_SCALAR(alpha, softpipe->blend_color.color[3]); + VEC4_MUL(source[0], quadColor[0], alpha); /* R */ + VEC4_MUL(source[1], quadColor[1], alpha); /* G */ + VEC4_MUL(source[2], quadColor[2], alpha); /* B */ + } + break; + case PIPE_BLENDFACTOR_SRC1_COLOR: + assert(0); /* to do */ + break; + case PIPE_BLENDFACTOR_SRC1_ALPHA: + assert(0); /* to do */ + break; + case PIPE_BLENDFACTOR_ZERO: + VEC4_COPY(source[0], zero); /* R */ + VEC4_COPY(source[1], zero); /* G */ + VEC4_COPY(source[2], zero); /* B */ + break; + case PIPE_BLENDFACTOR_INV_SRC_COLOR: + { + float inv_comp[4]; + VEC4_SUB(inv_comp, one, quadColor[0]); /* R */ + VEC4_MUL(source[0], quadColor[0], inv_comp); /* R */ + VEC4_SUB(inv_comp, one, quadColor[1]); /* G */ + VEC4_MUL(source[1], quadColor[1], inv_comp); /* G */ + VEC4_SUB(inv_comp, one, quadColor[2]); /* B */ + VEC4_MUL(source[2], quadColor[2], inv_comp); /* B */ + } + break; + case PIPE_BLENDFACTOR_INV_SRC_ALPHA: + { + float inv_alpha[4]; + VEC4_SUB(inv_alpha, one, quadColor[3]); + VEC4_MUL(source[0], quadColor[0], inv_alpha); /* R */ + VEC4_MUL(source[1], quadColor[1], inv_alpha); /* G */ + VEC4_MUL(source[2], quadColor[2], inv_alpha); /* B */ + } + break; + case PIPE_BLENDFACTOR_INV_DST_ALPHA: + { + float inv_alpha[4]; + VEC4_SUB(inv_alpha, one, dest[3]); + VEC4_MUL(source[0], quadColor[0], inv_alpha); /* R */ + VEC4_MUL(source[1], quadColor[1], inv_alpha); /* G */ + VEC4_MUL(source[2], quadColor[2], inv_alpha); /* B */ + } + break; + case PIPE_BLENDFACTOR_INV_DST_COLOR: + { + float inv_comp[4]; + VEC4_SUB(inv_comp, one, dest[0]); /* R */ + VEC4_MUL(source[0], quadColor[0], inv_comp); /* R */ + VEC4_SUB(inv_comp, one, dest[1]); /* G */ + VEC4_MUL(source[1], quadColor[1], inv_comp); /* G */ + VEC4_SUB(inv_comp, one, dest[2]); /* B */ + VEC4_MUL(source[2], quadColor[2], inv_comp); /* B */ + } + break; + case PIPE_BLENDFACTOR_INV_CONST_COLOR: + { + float inv_comp[4]; + /* R */ + VEC4_SCALAR(inv_comp, 1.0f - softpipe->blend_color.color[0]); + VEC4_MUL(source[0], quadColor[0], inv_comp); + /* G */ + VEC4_SCALAR(inv_comp, 1.0f - softpipe->blend_color.color[1]); + VEC4_MUL(source[1], quadColor[1], inv_comp); + /* B */ + VEC4_SCALAR(inv_comp, 1.0f - softpipe->blend_color.color[2]); + VEC4_MUL(source[2], quadColor[2], inv_comp); + } + break; + case PIPE_BLENDFACTOR_INV_CONST_ALPHA: + { + float inv_alpha[4]; + VEC4_SCALAR(inv_alpha, 1.0f - softpipe->blend_color.color[3]); + VEC4_MUL(source[0], quadColor[0], inv_alpha); /* R */ + VEC4_MUL(source[1], quadColor[1], inv_alpha); /* G */ + VEC4_MUL(source[2], quadColor[2], inv_alpha); /* B */ + } + break; + case PIPE_BLENDFACTOR_INV_SRC1_COLOR: + assert(0); /* to do */ + break; + case PIPE_BLENDFACTOR_INV_SRC1_ALPHA: + assert(0); /* to do */ + break; + default: + assert(0); + } + + /* + * Compute src/first term A + */ + switch (softpipe->blend->alpha_src_factor) { + case PIPE_BLENDFACTOR_ONE: + VEC4_COPY(source[3], quadColor[3]); /* A */ + break; + case PIPE_BLENDFACTOR_SRC_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_SRC_ALPHA: + { + const float *alpha = quadColor[3]; + VEC4_MUL(source[3], quadColor[3], alpha); /* A */ + } + break; + case PIPE_BLENDFACTOR_DST_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_DST_ALPHA: + VEC4_MUL(source[3], quadColor[3], dest[3]); /* A */ + break; + case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: + /* multiply alpha by 1.0 */ + VEC4_COPY(source[3], quadColor[3]); /* A */ + break; + case PIPE_BLENDFACTOR_CONST_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_CONST_ALPHA: + { + float comp[4]; + VEC4_SCALAR(comp, softpipe->blend_color.color[3]); /* A */ + VEC4_MUL(source[3], quadColor[3], comp); /* A */ + } + break; + case PIPE_BLENDFACTOR_ZERO: + VEC4_COPY(source[3], zero); /* A */ + break; + case PIPE_BLENDFACTOR_INV_SRC_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_INV_SRC_ALPHA: + { + float inv_alpha[4]; + VEC4_SUB(inv_alpha, one, quadColor[3]); + VEC4_MUL(source[3], quadColor[3], inv_alpha); /* A */ + } + break; + case PIPE_BLENDFACTOR_INV_DST_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_INV_DST_ALPHA: + { + float inv_alpha[4]; + VEC4_SUB(inv_alpha, one, dest[3]); + VEC4_MUL(source[3], quadColor[3], inv_alpha); /* A */ + } + break; + case PIPE_BLENDFACTOR_INV_CONST_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_INV_CONST_ALPHA: + { + float inv_comp[4]; + /* A */ + VEC4_SCALAR(inv_comp, 1.0f - softpipe->blend_color.color[3]); + VEC4_MUL(source[3], quadColor[3], inv_comp); + } + break; + default: + assert(0); + } + - /* loop over colorbuffer outputs */ - for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) { + /* + * Compute dest/second term RGB + */ + switch (softpipe->blend->rgb_dst_factor) { + case PIPE_BLENDFACTOR_ONE: + /* dest = dest * 1 NO-OP, leave dest as-is */ + break; + case PIPE_BLENDFACTOR_SRC_COLOR: + VEC4_MUL(dest[0], dest[0], quadColor[0]); /* R */ + VEC4_MUL(dest[1], dest[1], quadColor[1]); /* G */ + VEC4_MUL(dest[2], dest[2], quadColor[2]); /* B */ + break; + case PIPE_BLENDFACTOR_SRC_ALPHA: + VEC4_MUL(dest[0], dest[0], quadColor[3]); /* R * A */ + VEC4_MUL(dest[1], dest[1], quadColor[3]); /* G * A */ + VEC4_MUL(dest[2], dest[2], quadColor[3]); /* B * A */ + break; + case PIPE_BLENDFACTOR_DST_ALPHA: + VEC4_MUL(dest[0], dest[0], dest[3]); /* R * A */ + VEC4_MUL(dest[1], dest[1], dest[3]); /* G * A */ + VEC4_MUL(dest[2], dest[2], dest[3]); /* B * A */ + break; + case PIPE_BLENDFACTOR_DST_COLOR: + VEC4_MUL(dest[0], dest[0], dest[0]); /* R */ + VEC4_MUL(dest[1], dest[1], dest[1]); /* G */ + VEC4_MUL(dest[2], dest[2], dest[2]); /* B */ + break; + case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: + assert(0); /* illegal */ + break; + case PIPE_BLENDFACTOR_CONST_COLOR: + { + float comp[4]; + VEC4_SCALAR(comp, softpipe->blend_color.color[0]); /* R */ + VEC4_MUL(dest[0], dest[0], comp); /* R */ + VEC4_SCALAR(comp, softpipe->blend_color.color[1]); /* G */ + VEC4_MUL(dest[1], dest[1], comp); /* G */ + VEC4_SCALAR(comp, softpipe->blend_color.color[2]); /* B */ + VEC4_MUL(dest[2], dest[2], comp); /* B */ + } + break; + case PIPE_BLENDFACTOR_CONST_ALPHA: + { + float comp[4]; + VEC4_SCALAR(comp, softpipe->blend_color.color[3]); /* A */ + VEC4_MUL(dest[0], dest[0], comp); /* R */ + VEC4_MUL(dest[1], dest[1], comp); /* G */ + VEC4_MUL(dest[2], dest[2], comp); /* B */ + } + break; + case PIPE_BLENDFACTOR_ZERO: + VEC4_COPY(dest[0], zero); /* R */ + VEC4_COPY(dest[1], zero); /* G */ + VEC4_COPY(dest[2], zero); /* B */ + break; + case PIPE_BLENDFACTOR_SRC1_COLOR: + case PIPE_BLENDFACTOR_SRC1_ALPHA: + /* XXX what are these? */ + assert(0); + break; + case PIPE_BLENDFACTOR_INV_SRC_COLOR: + { + float inv_comp[4]; + VEC4_SUB(inv_comp, one, quadColor[0]); /* R */ + VEC4_MUL(dest[0], inv_comp, dest[0]); /* R */ + VEC4_SUB(inv_comp, one, quadColor[1]); /* G */ + VEC4_MUL(dest[1], inv_comp, dest[1]); /* G */ + VEC4_SUB(inv_comp, one, quadColor[2]); /* B */ + VEC4_MUL(dest[2], inv_comp, dest[2]); /* B */ + } + break; + case PIPE_BLENDFACTOR_INV_SRC_ALPHA: + { + float one_minus_alpha[QUAD_SIZE]; + VEC4_SUB(one_minus_alpha, one, quadColor[3]); + VEC4_MUL(dest[0], dest[0], one_minus_alpha); /* R */ + VEC4_MUL(dest[1], dest[1], one_minus_alpha); /* G */ + VEC4_MUL(dest[2], dest[2], one_minus_alpha); /* B */ + } + break; + case PIPE_BLENDFACTOR_INV_DST_ALPHA: + { + float inv_comp[4]; + VEC4_SUB(inv_comp, one, dest[3]); /* A */ + VEC4_MUL(dest[0], inv_comp, dest[0]); /* R */ + VEC4_MUL(dest[1], inv_comp, dest[1]); /* G */ + VEC4_MUL(dest[2], inv_comp, dest[2]); /* B */ + } + break; + case PIPE_BLENDFACTOR_INV_DST_COLOR: + { + float inv_comp[4]; + VEC4_SUB(inv_comp, one, dest[0]); /* R */ + VEC4_MUL(dest[0], dest[0], inv_comp); /* R */ + VEC4_SUB(inv_comp, one, dest[1]); /* G */ + VEC4_MUL(dest[1], dest[1], inv_comp); /* G */ + VEC4_SUB(inv_comp, one, dest[2]); /* B */ + VEC4_MUL(dest[2], dest[2], inv_comp); /* B */ + } + break; + case PIPE_BLENDFACTOR_INV_CONST_COLOR: + { + float inv_comp[4]; + /* R */ + VEC4_SCALAR(inv_comp, 1.0f - softpipe->blend_color.color[0]); + VEC4_MUL(dest[0], dest[0], inv_comp); + /* G */ + VEC4_SCALAR(inv_comp, 1.0f - softpipe->blend_color.color[1]); + VEC4_MUL(dest[1], dest[1], inv_comp); + /* B */ + VEC4_SCALAR(inv_comp, 1.0f - softpipe->blend_color.color[2]); + VEC4_MUL(dest[2], dest[2], inv_comp); + } + break; + case PIPE_BLENDFACTOR_INV_CONST_ALPHA: + { + float inv_comp[4]; + VEC4_SCALAR(inv_comp, 1.0f - softpipe->blend_color.color[3]); + VEC4_MUL(dest[0], dest[0], inv_comp); + VEC4_MUL(dest[1], dest[1], inv_comp); + VEC4_MUL(dest[2], dest[2], inv_comp); + } + break; + case PIPE_BLENDFACTOR_INV_SRC1_COLOR: + case PIPE_BLENDFACTOR_INV_SRC1_ALPHA: + /* XXX what are these? */ + assert(0); + break; + default: + assert(0); + } + + /* + * Compute dest/second term A + */ + switch (softpipe->blend->alpha_dst_factor) { + case PIPE_BLENDFACTOR_ONE: + /* dest = dest * 1 NO-OP, leave dest as-is */ + break; + case PIPE_BLENDFACTOR_SRC_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_SRC_ALPHA: + VEC4_MUL(dest[3], dest[3], quadColor[3]); /* A * A */ + break; + case PIPE_BLENDFACTOR_DST_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_DST_ALPHA: + VEC4_MUL(dest[3], dest[3], dest[3]); /* A */ + break; + case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: + assert(0); /* illegal */ + break; + case PIPE_BLENDFACTOR_CONST_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_CONST_ALPHA: + { + float comp[4]; + VEC4_SCALAR(comp, softpipe->blend_color.color[3]); /* A */ + VEC4_MUL(dest[3], dest[3], comp); /* A */ + } + break; + case PIPE_BLENDFACTOR_ZERO: + VEC4_COPY(dest[3], zero); /* A */ + break; + case PIPE_BLENDFACTOR_INV_SRC_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_INV_SRC_ALPHA: + { + float one_minus_alpha[QUAD_SIZE]; + VEC4_SUB(one_minus_alpha, one, quadColor[3]); + VEC4_MUL(dest[3], dest[3], one_minus_alpha); /* A */ + } + break; + case PIPE_BLENDFACTOR_INV_DST_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_INV_DST_ALPHA: + { + float inv_comp[4]; + VEC4_SUB(inv_comp, one, dest[3]); /* A */ + VEC4_MUL(dest[3], inv_comp, dest[3]); /* A */ + } + break; + case PIPE_BLENDFACTOR_INV_CONST_COLOR: + /* fall-through */ + case PIPE_BLENDFACTOR_INV_CONST_ALPHA: + { + float inv_comp[4]; + VEC4_SCALAR(inv_comp, 1.0f - softpipe->blend_color.color[3]); + VEC4_MUL(dest[3], dest[3], inv_comp); + } + break; + default: + assert(0); + } + + /* + * Combine RGB terms + */ + switch (softpipe->blend->rgb_func) { + case PIPE_BLEND_ADD: + VEC4_ADD_SAT(quadColor[0], source[0], dest[0]); /* R */ + VEC4_ADD_SAT(quadColor[1], source[1], dest[1]); /* G */ + VEC4_ADD_SAT(quadColor[2], source[2], dest[2]); /* B */ + break; + case PIPE_BLEND_SUBTRACT: + VEC4_SUB_SAT(quadColor[0], source[0], dest[0]); /* R */ + VEC4_SUB_SAT(quadColor[1], source[1], dest[1]); /* G */ + VEC4_SUB_SAT(quadColor[2], source[2], dest[2]); /* B */ + break; + case PIPE_BLEND_REVERSE_SUBTRACT: + VEC4_SUB_SAT(quadColor[0], dest[0], source[0]); /* R */ + VEC4_SUB_SAT(quadColor[1], dest[1], source[1]); /* G */ + VEC4_SUB_SAT(quadColor[2], dest[2], source[2]); /* B */ + break; + case PIPE_BLEND_MIN: + VEC4_MIN(quadColor[0], source[0], dest[0]); /* R */ + VEC4_MIN(quadColor[1], source[1], dest[1]); /* G */ + VEC4_MIN(quadColor[2], source[2], dest[2]); /* B */ + break; + case PIPE_BLEND_MAX: + VEC4_MAX(quadColor[0], source[0], dest[0]); /* R */ + VEC4_MAX(quadColor[1], source[1], dest[1]); /* G */ + VEC4_MAX(quadColor[2], source[2], dest[2]); /* B */ + break; + default: + assert(0); + } + + /* + * Combine A terms + */ + switch (softpipe->blend->alpha_func) { + case PIPE_BLEND_ADD: + VEC4_ADD_SAT(quadColor[3], source[3], dest[3]); /* A */ + break; + case PIPE_BLEND_SUBTRACT: + VEC4_SUB_SAT(quadColor[3], source[3], dest[3]); /* A */ + break; + case PIPE_BLEND_REVERSE_SUBTRACT: + VEC4_SUB_SAT(quadColor[3], dest[3], source[3]); /* A */ + break; + case PIPE_BLEND_MIN: + VEC4_MIN(quadColor[3], source[3], dest[3]); /* A */ + break; + case PIPE_BLEND_MAX: + VEC4_MAX(quadColor[3], source[3], dest[3]); /* A */ + break; + default: + assert(0); + } +} + +static void +colormask_quad(struct quad_stage *qs, + float (*quadColor)[4], + float (*dest)[4]) +{ + struct softpipe_context *softpipe = qs->softpipe; + + /* R */ + if (!(softpipe->blend->colormask & PIPE_MASK_R)) + COPY_4V(quadColor[0], dest[0]); + + /* G */ + if (!(softpipe->blend->colormask & PIPE_MASK_G)) + COPY_4V(quadColor[1], dest[1]); + + /* B */ + if (!(softpipe->blend->colormask & PIPE_MASK_B)) + COPY_4V(quadColor[2], dest[2]); + + /* A */ + if (!(softpipe->blend->colormask & PIPE_MASK_A)) + COPY_4V(quadColor[3], dest[3]); +} + + +static void +blend_fallback(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) +{ + struct softpipe_context *softpipe = qs->softpipe; + const struct pipe_blend_state *blend = softpipe->blend; + unsigned cbuf; + + for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) + { float dest[4][QUAD_SIZE]; - ubyte src[4][4], dst[4][4], res[4][4]; - uint *src4 = (uint *) src; - uint *dst4 = (uint *) dst; - uint *res4 = (uint *) res; - uint i, j; - - struct softpipe_cached_tile * - tile = sp_get_cached_tile(softpipe->cbuf_cache[cbuf], - quads[0]->input.x0, - quads[0]->input.y0); - - for (i = 0; i < nr; i++) { - struct quad_header *quad = quads[i]; + struct softpipe_cached_tile *tile + = sp_get_cached_tile(softpipe->cbuf_cache[cbuf], + quads[0]->input.x0, + quads[0]->input.y0); + uint q, i, j; + + for (q = 0; q < nr; q++) { + struct quad_header *quad = quads[q]; float (*quadColor)[4] = quad->output.color[cbuf]; + const int itx = (quad->input.x0 & (TILE_SIZE-1)); + const int ity = (quad->input.y0 & (TILE_SIZE-1)); - /* get/swizzle dest colors */ + /* get/swizzle dest colors + */ for (j = 0; j < QUAD_SIZE; j++) { - int x = (quad->input.x0 & (TILE_SIZE-1)) + (j & 1); - int y = (quad->input.y0 & (TILE_SIZE-1)) + (j >> 1); + int x = itx + (j & 1); + int y = ity + (j >> 1); for (i = 0; i < 4; i++) { dest[i][j] = tile->data.color[y][x][i]; } } - /* convert to ubyte */ - for (j = 0; j < 4; j++) { /* loop over R,G,B,A channels */ - dst[j][0] = float_to_ubyte(dest[j][0]); /* P0 */ - dst[j][1] = float_to_ubyte(dest[j][1]); /* P1 */ - dst[j][2] = float_to_ubyte(dest[j][2]); /* P2 */ - dst[j][3] = float_to_ubyte(dest[j][3]); /* P3 */ - - src[j][0] = float_to_ubyte(quadColor[j][0]); /* P0 */ - src[j][1] = float_to_ubyte(quadColor[j][1]); /* P1 */ - src[j][2] = float_to_ubyte(quadColor[j][2]); /* P2 */ - src[j][3] = float_to_ubyte(quadColor[j][3]); /* P3 */ - } - switch (softpipe->blend->logicop_func) { - case PIPE_LOGICOP_CLEAR: - for (j = 0; j < 4; j++) - res4[j] = 0; - break; - case PIPE_LOGICOP_NOR: - for (j = 0; j < 4; j++) - res4[j] = ~(src4[j] | dst4[j]); - break; - case PIPE_LOGICOP_AND_INVERTED: - for (j = 0; j < 4; j++) - res4[j] = ~src4[j] & dst4[j]; - break; - case PIPE_LOGICOP_COPY_INVERTED: - for (j = 0; j < 4; j++) - res4[j] = ~src4[j]; - break; - case PIPE_LOGICOP_AND_REVERSE: - for (j = 0; j < 4; j++) - res4[j] = src4[j] & ~dst4[j]; - break; - case PIPE_LOGICOP_INVERT: - for (j = 0; j < 4; j++) - res4[j] = ~dst4[j]; - break; - case PIPE_LOGICOP_XOR: - for (j = 0; j < 4; j++) - res4[j] = dst4[j] ^ src4[j]; - break; - case PIPE_LOGICOP_NAND: - for (j = 0; j < 4; j++) - res4[j] = ~(src4[j] & dst4[j]); - break; - case PIPE_LOGICOP_AND: - for (j = 0; j < 4; j++) - res4[j] = src4[j] & dst4[j]; - break; - case PIPE_LOGICOP_EQUIV: - for (j = 0; j < 4; j++) - res4[j] = ~(src4[j] ^ dst4[j]); - break; - case PIPE_LOGICOP_NOOP: - for (j = 0; j < 4; j++) - res4[j] = dst4[j]; - break; - case PIPE_LOGICOP_OR_INVERTED: - for (j = 0; j < 4; j++) - res4[j] = ~src4[j] | dst4[j]; - break; - case PIPE_LOGICOP_COPY: - for (j = 0; j < 4; j++) - res4[j] = src4[j]; - break; - case PIPE_LOGICOP_OR_REVERSE: - for (j = 0; j < 4; j++) - res4[j] = src4[j] | ~dst4[j]; - break; - case PIPE_LOGICOP_OR: - for (j = 0; j < 4; j++) - res4[j] = src4[j] | dst4[j]; - break; - case PIPE_LOGICOP_SET: - for (j = 0; j < 4; j++) - res4[j] = ~0; - break; - default: - assert(0); + if (blend->logicop_enable) { + logicop_quad( qs, quadColor, dest ); + } + else if (blend->blend_enable) { + blend_quad( qs, quadColor, dest ); } - for (j = 0; j < 4; j++) { - quadColor[j][0] = ubyte_to_float(res[j][0]); - quadColor[j][1] = ubyte_to_float(res[j][1]); - quadColor[j][2] = ubyte_to_float(res[j][2]); - quadColor[j][3] = ubyte_to_float(res[j][3]); + if (blend->colormask != 0xf) + colormask_quad( qs, quadColor, dest ); + + /* Output color values + */ + for (j = 0; j < QUAD_SIZE; j++) { + if (quad->inout.mask & (1 << j)) { + int x = itx + (j & 1); + int y = ity + (j >> 1); + for (i = 0; i < 4; i++) { /* loop over color chans */ + tile->data.color[y][x][i] = quadColor[i][j]; + } + } } } } - - /* pass blended quad to next stage */ - qs->next->run(qs->next, quads, nr); } + static void blend_single_add_src_alpha_inv_src_alpha(struct quad_stage *qs, struct quad_header *quads[], @@ -266,11 +808,13 @@ blend_single_add_src_alpha_inv_src_alpha(struct quad_stage *qs, struct quad_header *quad = quads[q]; float (*quadColor)[4] = quad->output.color[0]; const float *alpha = quadColor[3]; + const int itx = (quad->input.x0 & (TILE_SIZE-1)); + const int ity = (quad->input.y0 & (TILE_SIZE-1)); /* get/swizzle dest colors */ for (j = 0; j < QUAD_SIZE; j++) { - int x = (quad->input.x0 & (TILE_SIZE-1)) + (j & 1); - int y = (quad->input.y0 & (TILE_SIZE-1)) + (j >> 1); + int x = itx + (j & 1); + int y = ity + (j >> 1); for (i = 0; i < 4; i++) { dest[i][j] = tile->data.color[y][x][i]; } @@ -291,10 +835,17 @@ blend_single_add_src_alpha_inv_src_alpha(struct quad_stage *qs, VEC4_ADD_SAT(quadColor[1], source[1], dest[1]); /* G */ VEC4_ADD_SAT(quadColor[2], source[2], dest[2]); /* B */ VEC4_ADD_SAT(quadColor[3], source[3], dest[3]); /* A */ - } - /* pass blended quad to next stage */ - qs->next->run(qs->next, quads, nr); + for (j = 0; j < QUAD_SIZE; j++) { + if (quad->inout.mask & (1 << j)) { + int x = itx + (j & 1); + int y = ity + (j >> 1); + for (i = 0; i < 4; i++) { /* loop over color chans */ + tile->data.color[y][x][i] = quadColor[i][j]; + } + } + } + } } static void @@ -313,11 +864,13 @@ blend_single_add_one_one(struct quad_stage *qs, for (q = 0; q < nr; q++) { struct quad_header *quad = quads[q]; float (*quadColor)[4] = quad->output.color[0]; + const int itx = (quad->input.x0 & (TILE_SIZE-1)); + const int ity = (quad->input.y0 & (TILE_SIZE-1)); /* get/swizzle dest colors */ for (j = 0; j < QUAD_SIZE; j++) { - int x = (quad->input.x0 & (TILE_SIZE-1)) + (j & 1); - int y = (quad->input.y0 & (TILE_SIZE-1)) + (j >> 1); + int x = itx + (j & 1); + int y = ity + (j >> 1); for (i = 0; i < 4; i++) { dest[i][j] = tile->data.color[y][x][i]; } @@ -327,539 +880,71 @@ blend_single_add_one_one(struct quad_stage *qs, VEC4_ADD_SAT(quadColor[1], quadColor[1], dest[1]); /* G */ VEC4_ADD_SAT(quadColor[2], quadColor[2], dest[2]); /* B */ VEC4_ADD_SAT(quadColor[3], quadColor[3], dest[3]); /* A */ - } - /* pass blended quad to next stage */ - qs->next->run(qs->next, quads, nr); + for (j = 0; j < QUAD_SIZE; j++) { + if (quad->inout.mask & (1 << j)) { + int x = itx + (j & 1); + int y = ity + (j >> 1); + for (i = 0; i < 4; i++) { /* loop over color chans */ + tile->data.color[y][x][i] = quadColor[i][j]; + } + } + } + } } + static void -blend_quads_fallback(struct quad_stage *qs, - struct quad_header *quads[], - unsigned nr) +single_output_color(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) { - static const float zero[4] = { 0, 0, 0, 0 }; - static const float one[4] = { 1, 1, 1, 1 }; - struct softpipe_context *softpipe = qs->softpipe; - uint cbuf; - - /* loop over colorbuffer outputs */ - for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) { - float source[4][QUAD_SIZE], dest[4][QUAD_SIZE]; - struct softpipe_cached_tile *tile - = sp_get_cached_tile(softpipe->cbuf_cache[cbuf], - quads[0]->input.x0, - quads[0]->input.y0); - uint q, i, j; + uint i, j, q; - for (q = 0; q < nr; q++) { - struct quad_header *quad = quads[q]; - float (*quadColor)[4] = quad->output.color[cbuf]; + struct softpipe_cached_tile *tile + = sp_get_cached_tile(qs->softpipe->cbuf_cache[0], + quads[0]->input.x0, + quads[0]->input.y0); - /* get/swizzle dest colors */ - for (j = 0; j < QUAD_SIZE; j++) { - int x = (quad->input.x0 & (TILE_SIZE-1)) + (j & 1); - int y = (quad->input.y0 & (TILE_SIZE-1)) + (j >> 1); - for (i = 0; i < 4; i++) { - dest[i][j] = tile->data.color[y][x][i]; + for (q = 0; q < nr; q++) { + struct quad_header *quad = quads[q]; + float (*quadColor)[4] = quad->output.color[0]; + const int itx = (quad->input.x0 & (TILE_SIZE-1)); + const int ity = (quad->input.y0 & (TILE_SIZE-1)); + + for (j = 0; j < QUAD_SIZE; j++) { + if (quad->inout.mask & (1 << j)) { + int x = itx + (j & 1); + int y = ity + (j >> 1); + for (i = 0; i < 4; i++) { /* loop over color chans */ + tile->data.color[y][x][i] = quadColor[i][j]; } } - - /* - * Compute src/first term RGB - */ - switch (softpipe->blend->rgb_src_factor) { - case PIPE_BLENDFACTOR_ONE: - VEC4_COPY(source[0], quadColor[0]); /* R */ - VEC4_COPY(source[1], quadColor[1]); /* G */ - VEC4_COPY(source[2], quadColor[2]); /* B */ - break; - case PIPE_BLENDFACTOR_SRC_COLOR: - VEC4_MUL(source[0], quadColor[0], quadColor[0]); /* R */ - VEC4_MUL(source[1], quadColor[1], quadColor[1]); /* G */ - VEC4_MUL(source[2], quadColor[2], quadColor[2]); /* B */ - break; - case PIPE_BLENDFACTOR_SRC_ALPHA: - { - const float *alpha = quadColor[3]; - VEC4_MUL(source[0], quadColor[0], alpha); /* R */ - VEC4_MUL(source[1], quadColor[1], alpha); /* G */ - VEC4_MUL(source[2], quadColor[2], alpha); /* B */ - } - break; - case PIPE_BLENDFACTOR_DST_COLOR: - VEC4_MUL(source[0], quadColor[0], dest[0]); /* R */ - VEC4_MUL(source[1], quadColor[1], dest[1]); /* G */ - VEC4_MUL(source[2], quadColor[2], dest[2]); /* B */ - break; - case PIPE_BLENDFACTOR_DST_ALPHA: - { - const float *alpha = dest[3]; - VEC4_MUL(source[0], quadColor[0], alpha); /* R */ - VEC4_MUL(source[1], quadColor[1], alpha); /* G */ - VEC4_MUL(source[2], quadColor[2], alpha); /* B */ - } - break; - case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: - { - const float *alpha = quadColor[3]; - float diff[4], temp[4]; - VEC4_SUB(diff, one, dest[3]); - VEC4_MIN(temp, alpha, diff); - VEC4_MUL(source[0], quadColor[0], temp); /* R */ - VEC4_MUL(source[1], quadColor[1], temp); /* G */ - VEC4_MUL(source[2], quadColor[2], temp); /* B */ - } - break; - case PIPE_BLENDFACTOR_CONST_COLOR: - { - float comp[4]; - VEC4_SCALAR(comp, softpipe->blend_color.color[0]); /* R */ - VEC4_MUL(source[0], quadColor[0], comp); /* R */ - VEC4_SCALAR(comp, softpipe->blend_color.color[1]); /* G */ - VEC4_MUL(source[1], quadColor[1], comp); /* G */ - VEC4_SCALAR(comp, softpipe->blend_color.color[2]); /* B */ - VEC4_MUL(source[2], quadColor[2], comp); /* B */ - } - break; - case PIPE_BLENDFACTOR_CONST_ALPHA: - { - float alpha[4]; - VEC4_SCALAR(alpha, softpipe->blend_color.color[3]); - VEC4_MUL(source[0], quadColor[0], alpha); /* R */ - VEC4_MUL(source[1], quadColor[1], alpha); /* G */ - VEC4_MUL(source[2], quadColor[2], alpha); /* B */ - } - break; - case PIPE_BLENDFACTOR_SRC1_COLOR: - assert(0); /* to do */ - break; - case PIPE_BLENDFACTOR_SRC1_ALPHA: - assert(0); /* to do */ - break; - case PIPE_BLENDFACTOR_ZERO: - VEC4_COPY(source[0], zero); /* R */ - VEC4_COPY(source[1], zero); /* G */ - VEC4_COPY(source[2], zero); /* B */ - break; - case PIPE_BLENDFACTOR_INV_SRC_COLOR: - { - float inv_comp[4]; - VEC4_SUB(inv_comp, one, quadColor[0]); /* R */ - VEC4_MUL(source[0], quadColor[0], inv_comp); /* R */ - VEC4_SUB(inv_comp, one, quadColor[1]); /* G */ - VEC4_MUL(source[1], quadColor[1], inv_comp); /* G */ - VEC4_SUB(inv_comp, one, quadColor[2]); /* B */ - VEC4_MUL(source[2], quadColor[2], inv_comp); /* B */ - } - break; - case PIPE_BLENDFACTOR_INV_SRC_ALPHA: - { - float inv_alpha[4]; - VEC4_SUB(inv_alpha, one, quadColor[3]); - VEC4_MUL(source[0], quadColor[0], inv_alpha); /* R */ - VEC4_MUL(source[1], quadColor[1], inv_alpha); /* G */ - VEC4_MUL(source[2], quadColor[2], inv_alpha); /* B */ - } - break; - case PIPE_BLENDFACTOR_INV_DST_ALPHA: - { - float inv_alpha[4]; - VEC4_SUB(inv_alpha, one, dest[3]); - VEC4_MUL(source[0], quadColor[0], inv_alpha); /* R */ - VEC4_MUL(source[1], quadColor[1], inv_alpha); /* G */ - VEC4_MUL(source[2], quadColor[2], inv_alpha); /* B */ - } - break; - case PIPE_BLENDFACTOR_INV_DST_COLOR: - { - float inv_comp[4]; - VEC4_SUB(inv_comp, one, dest[0]); /* R */ - VEC4_MUL(source[0], quadColor[0], inv_comp); /* R */ - VEC4_SUB(inv_comp, one, dest[1]); /* G */ - VEC4_MUL(source[1], quadColor[1], inv_comp); /* G */ - VEC4_SUB(inv_comp, one, dest[2]); /* B */ - VEC4_MUL(source[2], quadColor[2], inv_comp); /* B */ - } - break; - case PIPE_BLENDFACTOR_INV_CONST_COLOR: - { - float inv_comp[4]; - /* R */ - VEC4_SCALAR(inv_comp, 1.0f - softpipe->blend_color.color[0]); - VEC4_MUL(source[0], quadColor[0], inv_comp); - /* G */ - VEC4_SCALAR(inv_comp, 1.0f - softpipe->blend_color.color[1]); - VEC4_MUL(source[1], quadColor[1], inv_comp); - /* B */ - VEC4_SCALAR(inv_comp, 1.0f - softpipe->blend_color.color[2]); - VEC4_MUL(source[2], quadColor[2], inv_comp); - } - break; - case PIPE_BLENDFACTOR_INV_CONST_ALPHA: - { - float inv_alpha[4]; - VEC4_SCALAR(inv_alpha, 1.0f - softpipe->blend_color.color[3]); - VEC4_MUL(source[0], quadColor[0], inv_alpha); /* R */ - VEC4_MUL(source[1], quadColor[1], inv_alpha); /* G */ - VEC4_MUL(source[2], quadColor[2], inv_alpha); /* B */ - } - break; - case PIPE_BLENDFACTOR_INV_SRC1_COLOR: - assert(0); /* to do */ - break; - case PIPE_BLENDFACTOR_INV_SRC1_ALPHA: - assert(0); /* to do */ - break; - default: - assert(0); - } - - /* - * Compute src/first term A - */ - switch (softpipe->blend->alpha_src_factor) { - case PIPE_BLENDFACTOR_ONE: - VEC4_COPY(source[3], quadColor[3]); /* A */ - break; - case PIPE_BLENDFACTOR_SRC_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_SRC_ALPHA: - { - const float *alpha = quadColor[3]; - VEC4_MUL(source[3], quadColor[3], alpha); /* A */ - } - break; - case PIPE_BLENDFACTOR_DST_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_DST_ALPHA: - VEC4_MUL(source[3], quadColor[3], dest[3]); /* A */ - break; - case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: - /* multiply alpha by 1.0 */ - VEC4_COPY(source[3], quadColor[3]); /* A */ - break; - case PIPE_BLENDFACTOR_CONST_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_CONST_ALPHA: - { - float comp[4]; - VEC4_SCALAR(comp, softpipe->blend_color.color[3]); /* A */ - VEC4_MUL(source[3], quadColor[3], comp); /* A */ - } - break; - case PIPE_BLENDFACTOR_ZERO: - VEC4_COPY(source[3], zero); /* A */ - break; - case PIPE_BLENDFACTOR_INV_SRC_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_INV_SRC_ALPHA: - { - float inv_alpha[4]; - VEC4_SUB(inv_alpha, one, quadColor[3]); - VEC4_MUL(source[3], quadColor[3], inv_alpha); /* A */ - } - break; - case PIPE_BLENDFACTOR_INV_DST_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_INV_DST_ALPHA: - { - float inv_alpha[4]; - VEC4_SUB(inv_alpha, one, dest[3]); - VEC4_MUL(source[3], quadColor[3], inv_alpha); /* A */ - } - break; - case PIPE_BLENDFACTOR_INV_CONST_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_INV_CONST_ALPHA: - { - float inv_comp[4]; - /* A */ - VEC4_SCALAR(inv_comp, 1.0f - softpipe->blend_color.color[3]); - VEC4_MUL(source[3], quadColor[3], inv_comp); - } - break; - default: - assert(0); - } - - - /* - * Compute dest/second term RGB - */ - switch (softpipe->blend->rgb_dst_factor) { - case PIPE_BLENDFACTOR_ONE: - /* dest = dest * 1 NO-OP, leave dest as-is */ - break; - case PIPE_BLENDFACTOR_SRC_COLOR: - VEC4_MUL(dest[0], dest[0], quadColor[0]); /* R */ - VEC4_MUL(dest[1], dest[1], quadColor[1]); /* G */ - VEC4_MUL(dest[2], dest[2], quadColor[2]); /* B */ - break; - case PIPE_BLENDFACTOR_SRC_ALPHA: - VEC4_MUL(dest[0], dest[0], quadColor[3]); /* R * A */ - VEC4_MUL(dest[1], dest[1], quadColor[3]); /* G * A */ - VEC4_MUL(dest[2], dest[2], quadColor[3]); /* B * A */ - break; - case PIPE_BLENDFACTOR_DST_ALPHA: - VEC4_MUL(dest[0], dest[0], dest[3]); /* R * A */ - VEC4_MUL(dest[1], dest[1], dest[3]); /* G * A */ - VEC4_MUL(dest[2], dest[2], dest[3]); /* B * A */ - break; - case PIPE_BLENDFACTOR_DST_COLOR: - VEC4_MUL(dest[0], dest[0], dest[0]); /* R */ - VEC4_MUL(dest[1], dest[1], dest[1]); /* G */ - VEC4_MUL(dest[2], dest[2], dest[2]); /* B */ - break; - case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: - assert(0); /* illegal */ - break; - case PIPE_BLENDFACTOR_CONST_COLOR: - { - float comp[4]; - VEC4_SCALAR(comp, softpipe->blend_color.color[0]); /* R */ - VEC4_MUL(dest[0], dest[0], comp); /* R */ - VEC4_SCALAR(comp, softpipe->blend_color.color[1]); /* G */ - VEC4_MUL(dest[1], dest[1], comp); /* G */ - VEC4_SCALAR(comp, softpipe->blend_color.color[2]); /* B */ - VEC4_MUL(dest[2], dest[2], comp); /* B */ - } - break; - case PIPE_BLENDFACTOR_CONST_ALPHA: - { - float comp[4]; - VEC4_SCALAR(comp, softpipe->blend_color.color[3]); /* A */ - VEC4_MUL(dest[0], dest[0], comp); /* R */ - VEC4_MUL(dest[1], dest[1], comp); /* G */ - VEC4_MUL(dest[2], dest[2], comp); /* B */ - } - break; - case PIPE_BLENDFACTOR_ZERO: - VEC4_COPY(dest[0], zero); /* R */ - VEC4_COPY(dest[1], zero); /* G */ - VEC4_COPY(dest[2], zero); /* B */ - break; - case PIPE_BLENDFACTOR_SRC1_COLOR: - case PIPE_BLENDFACTOR_SRC1_ALPHA: - /* XXX what are these? */ - assert(0); - break; - case PIPE_BLENDFACTOR_INV_SRC_COLOR: - { - float inv_comp[4]; - VEC4_SUB(inv_comp, one, quadColor[0]); /* R */ - VEC4_MUL(dest[0], inv_comp, dest[0]); /* R */ - VEC4_SUB(inv_comp, one, quadColor[1]); /* G */ - VEC4_MUL(dest[1], inv_comp, dest[1]); /* G */ - VEC4_SUB(inv_comp, one, quadColor[2]); /* B */ - VEC4_MUL(dest[2], inv_comp, dest[2]); /* B */ - } - break; - case PIPE_BLENDFACTOR_INV_SRC_ALPHA: - { - float one_minus_alpha[QUAD_SIZE]; - VEC4_SUB(one_minus_alpha, one, quadColor[3]); - VEC4_MUL(dest[0], dest[0], one_minus_alpha); /* R */ - VEC4_MUL(dest[1], dest[1], one_minus_alpha); /* G */ - VEC4_MUL(dest[2], dest[2], one_minus_alpha); /* B */ - } - break; - case PIPE_BLENDFACTOR_INV_DST_ALPHA: - { - float inv_comp[4]; - VEC4_SUB(inv_comp, one, dest[3]); /* A */ - VEC4_MUL(dest[0], inv_comp, dest[0]); /* R */ - VEC4_MUL(dest[1], inv_comp, dest[1]); /* G */ - VEC4_MUL(dest[2], inv_comp, dest[2]); /* B */ - } - break; - case PIPE_BLENDFACTOR_INV_DST_COLOR: - { - float inv_comp[4]; - VEC4_SUB(inv_comp, one, dest[0]); /* R */ - VEC4_MUL(dest[0], dest[0], inv_comp); /* R */ - VEC4_SUB(inv_comp, one, dest[1]); /* G */ - VEC4_MUL(dest[1], dest[1], inv_comp); /* G */ - VEC4_SUB(inv_comp, one, dest[2]); /* B */ - VEC4_MUL(dest[2], dest[2], inv_comp); /* B */ - } - break; - case PIPE_BLENDFACTOR_INV_CONST_COLOR: - { - float inv_comp[4]; - /* R */ - VEC4_SCALAR(inv_comp, 1.0f - softpipe->blend_color.color[0]); - VEC4_MUL(dest[0], dest[0], inv_comp); - /* G */ - VEC4_SCALAR(inv_comp, 1.0f - softpipe->blend_color.color[1]); - VEC4_MUL(dest[1], dest[1], inv_comp); - /* B */ - VEC4_SCALAR(inv_comp, 1.0f - softpipe->blend_color.color[2]); - VEC4_MUL(dest[2], dest[2], inv_comp); - } - break; - case PIPE_BLENDFACTOR_INV_CONST_ALPHA: - { - float inv_comp[4]; - VEC4_SCALAR(inv_comp, 1.0f - softpipe->blend_color.color[3]); - VEC4_MUL(dest[0], dest[0], inv_comp); - VEC4_MUL(dest[1], dest[1], inv_comp); - VEC4_MUL(dest[2], dest[2], inv_comp); - } - break; - case PIPE_BLENDFACTOR_INV_SRC1_COLOR: - case PIPE_BLENDFACTOR_INV_SRC1_ALPHA: - /* XXX what are these? */ - assert(0); - break; - default: - assert(0); - } - - /* - * Compute dest/second term A - */ - switch (softpipe->blend->alpha_dst_factor) { - case PIPE_BLENDFACTOR_ONE: - /* dest = dest * 1 NO-OP, leave dest as-is */ - break; - case PIPE_BLENDFACTOR_SRC_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_SRC_ALPHA: - VEC4_MUL(dest[3], dest[3], quadColor[3]); /* A * A */ - break; - case PIPE_BLENDFACTOR_DST_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_DST_ALPHA: - VEC4_MUL(dest[3], dest[3], dest[3]); /* A */ - break; - case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: - assert(0); /* illegal */ - break; - case PIPE_BLENDFACTOR_CONST_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_CONST_ALPHA: - { - float comp[4]; - VEC4_SCALAR(comp, softpipe->blend_color.color[3]); /* A */ - VEC4_MUL(dest[3], dest[3], comp); /* A */ - } - break; - case PIPE_BLENDFACTOR_ZERO: - VEC4_COPY(dest[3], zero); /* A */ - break; - case PIPE_BLENDFACTOR_INV_SRC_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_INV_SRC_ALPHA: - { - float one_minus_alpha[QUAD_SIZE]; - VEC4_SUB(one_minus_alpha, one, quadColor[3]); - VEC4_MUL(dest[3], dest[3], one_minus_alpha); /* A */ - } - break; - case PIPE_BLENDFACTOR_INV_DST_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_INV_DST_ALPHA: - { - float inv_comp[4]; - VEC4_SUB(inv_comp, one, dest[3]); /* A */ - VEC4_MUL(dest[3], inv_comp, dest[3]); /* A */ - } - break; - case PIPE_BLENDFACTOR_INV_CONST_COLOR: - /* fall-through */ - case PIPE_BLENDFACTOR_INV_CONST_ALPHA: - { - float inv_comp[4]; - VEC4_SCALAR(inv_comp, 1.0f - softpipe->blend_color.color[3]); - VEC4_MUL(dest[3], dest[3], inv_comp); - } - break; - default: - assert(0); - } - - /* - * Combine RGB terms - */ - switch (softpipe->blend->rgb_func) { - case PIPE_BLEND_ADD: - VEC4_ADD_SAT(quadColor[0], source[0], dest[0]); /* R */ - VEC4_ADD_SAT(quadColor[1], source[1], dest[1]); /* G */ - VEC4_ADD_SAT(quadColor[2], source[2], dest[2]); /* B */ - break; - case PIPE_BLEND_SUBTRACT: - VEC4_SUB_SAT(quadColor[0], source[0], dest[0]); /* R */ - VEC4_SUB_SAT(quadColor[1], source[1], dest[1]); /* G */ - VEC4_SUB_SAT(quadColor[2], source[2], dest[2]); /* B */ - break; - case PIPE_BLEND_REVERSE_SUBTRACT: - VEC4_SUB_SAT(quadColor[0], dest[0], source[0]); /* R */ - VEC4_SUB_SAT(quadColor[1], dest[1], source[1]); /* G */ - VEC4_SUB_SAT(quadColor[2], dest[2], source[2]); /* B */ - break; - case PIPE_BLEND_MIN: - VEC4_MIN(quadColor[0], source[0], dest[0]); /* R */ - VEC4_MIN(quadColor[1], source[1], dest[1]); /* G */ - VEC4_MIN(quadColor[2], source[2], dest[2]); /* B */ - break; - case PIPE_BLEND_MAX: - VEC4_MAX(quadColor[0], source[0], dest[0]); /* R */ - VEC4_MAX(quadColor[1], source[1], dest[1]); /* G */ - VEC4_MAX(quadColor[2], source[2], dest[2]); /* B */ - break; - default: - assert(0); - } - - /* - * Combine A terms - */ - switch (softpipe->blend->alpha_func) { - case PIPE_BLEND_ADD: - VEC4_ADD_SAT(quadColor[3], source[3], dest[3]); /* A */ - break; - case PIPE_BLEND_SUBTRACT: - VEC4_SUB_SAT(quadColor[3], source[3], dest[3]); /* A */ - break; - case PIPE_BLEND_REVERSE_SUBTRACT: - VEC4_SUB_SAT(quadColor[3], dest[3], source[3]); /* A */ - break; - case PIPE_BLEND_MIN: - VEC4_MIN(quadColor[3], source[3], dest[3]); /* A */ - break; - case PIPE_BLEND_MAX: - VEC4_MAX(quadColor[3], source[3], dest[3]); /* A */ - break; - default: - assert(0); - } } - } /* cbuf loop */ - - /* pass blended quad to next stage */ - qs->next->run(qs->next, quads, nr); + } } static void -blend_quad(struct quad_stage *qs, - struct quad_header *quads[], - unsigned nr) +choose_blend_quad(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) { struct softpipe_context *softpipe = qs->softpipe; const struct pipe_blend_state *blend = softpipe->blend; - if (softpipe->blend->logicop_enable) { - qs->run = logicop_quads; - } - else { - qs->run = blend_quads_fallback; + qs->run = blend_fallback; - if (blend->rgb_src_factor == blend->alpha_src_factor && - blend->rgb_dst_factor == blend->alpha_dst_factor && - blend->rgb_func == blend->alpha_func && - softpipe->framebuffer.nr_cbufs == 1) + if (!softpipe->blend->logicop_enable && + softpipe->blend->colormask == 0xf) + { + if (!blend->blend_enable) { + qs->run = single_output_color; + } + else if (blend->rgb_src_factor == blend->alpha_src_factor && + blend->rgb_dst_factor == blend->alpha_dst_factor && + blend->rgb_func == blend->alpha_func && + softpipe->framebuffer.nr_cbufs == 1) { if (blend->alpha_func == PIPE_BLEND_ADD) { if (blend->rgb_src_factor == PIPE_BLENDFACTOR_ONE && @@ -871,7 +956,7 @@ blend_quad(struct quad_stage *qs, qs->run = blend_single_add_src_alpha_inv_src_alpha; } - } + } } qs->run(qs, quads, nr); @@ -880,8 +965,7 @@ blend_quad(struct quad_stage *qs, static void blend_begin(struct quad_stage *qs) { - qs->run = blend_quad; - qs->next->begin(qs->next); + qs->run = choose_blend_quad; } @@ -897,7 +981,7 @@ struct quad_stage *sp_quad_blend_stage( struct softpipe_context *softpipe ) stage->softpipe = softpipe; stage->begin = blend_begin; - stage->run = blend_quad; + stage->run = choose_blend_quad; stage->destroy = blend_destroy; return stage; diff --git a/src/gallium/drivers/softpipe/sp_quad_bufloop.c b/src/gallium/drivers/softpipe/sp_quad_bufloop.c deleted file mode 100644 index 953d8516b9..0000000000 --- a/src/gallium/drivers/softpipe/sp_quad_bufloop.c +++ /dev/null @@ -1,74 +0,0 @@ - -#include "util/u_memory.h" -#include "sp_context.h" -#include "sp_quad.h" -#include "sp_surface.h" -#include "sp_quad_pipe.h" - - -/** - * Loop over colorbuffers, passing quad to next stage each time. - */ -static void -cbuf_loop_quad(struct quad_stage *qs, struct quad_header *quad) -{ - struct softpipe_context *softpipe = qs->softpipe; - float tmp[PIPE_MAX_COLOR_BUFS][4][QUAD_SIZE]; - unsigned i; - - assert(sizeof(quad->outputs.color) == sizeof(tmp)); - assert(softpipe->framebuffer.nr_cbufs <= PIPE_MAX_COLOR_BUFS); - - /* make copy of original colors since they can get modified - * by blending and masking. - * XXX we won't have to do this if the fragment program actually emits - * N separate colors and we're drawing to N color buffers (MRT). - * But if we emitted one color and glDrawBuffer(GL_FRONT_AND_BACK) is - * in effect, we need to save/restore colors like this. - */ - memcpy(tmp, quad->outputs.color, sizeof(tmp)); - - for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) { - /* set current cbuffer */ -#if 0 /* obsolete & going away */ - softpipe->current_cbuf = i; -#endif - - /* pass blended quad to next stage */ - qs->next->run(qs->next, quad); - - /* restore quad's colors for next buffer */ - memcpy(quad->outputs.color, tmp, sizeof(tmp)); - } -} - - -static void cbuf_loop_begin(struct quad_stage *qs) -{ - qs->next->begin(qs->next); -} - - -static void cbuf_loop_destroy(struct quad_stage *qs) -{ - FREE( qs ); -} - - -/** - * Create the colorbuffer loop stage. - * This is used to implement multiple render targets and GL_FRONT_AND_BACK - * rendering. - */ -struct quad_stage *sp_quad_bufloop_stage( struct softpipe_context *softpipe ) -{ - struct quad_stage *stage = CALLOC_STRUCT(quad_stage); - - stage->softpipe = softpipe; - stage->begin = cbuf_loop_begin; - stage->run = cbuf_loop_quad; - stage->destroy = cbuf_loop_destroy; - - return stage; -} - diff --git a/src/gallium/drivers/softpipe/sp_quad_colormask.c b/src/gallium/drivers/softpipe/sp_quad_colormask.c deleted file mode 100644 index ac74287473..0000000000 --- a/src/gallium/drivers/softpipe/sp_quad_colormask.c +++ /dev/null @@ -1,126 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * 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. - * - **************************************************************************/ - -/** - * \brief quad colormask stage - * \author Brian Paul - */ - -#include "pipe/p_defines.h" -#include "util/u_math.h" -#include "util/u_memory.h" -#include "sp_context.h" -#include "sp_quad.h" -#include "sp_surface.h" -#include "sp_quad_pipe.h" -#include "sp_tile_cache.h" - - - -/** - * XXX colormask could be rolled into blending... - */ -static void -colormask_quad(struct quad_stage *qs, struct quad_header *quad) -{ - struct softpipe_context *softpipe = qs->softpipe; - uint cbuf; - - /* loop over colorbuffer outputs */ - for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) { - float dest[4][QUAD_SIZE]; - struct softpipe_cached_tile *tile - = sp_get_cached_tile(softpipe->cbuf_cache[cbuf], - quad->input.x0, quad->input.y0); - float (*quadColor)[4] = quad->output.color[cbuf]; - uint i, j; - - /* get/swizzle dest colors */ - for (j = 0; j < QUAD_SIZE; j++) { - int x = (quad->input.x0 & (TILE_SIZE-1)) + (j & 1); - int y = (quad->input.y0 & (TILE_SIZE-1)) + (j >> 1); - for (i = 0; i < 4; i++) { - dest[i][j] = tile->data.color[y][x][i]; - } - } - - /* R */ - if (!(softpipe->blend->colormask & PIPE_MASK_R)) - COPY_4V(quadColor[0], dest[0]); - - /* G */ - if (!(softpipe->blend->colormask & PIPE_MASK_G)) - COPY_4V(quadColor[1], dest[1]); - - /* B */ - if (!(softpipe->blend->colormask & PIPE_MASK_B)) - COPY_4V(quadColor[2], dest[2]); - - /* A */ - if (!(softpipe->blend->colormask & PIPE_MASK_A)) - COPY_4V(quadColor[3], dest[3]); - } -} - -static void -colormask_quads(struct quad_stage *qs, struct quad_header *quads[], - unsigned nr) -{ - unsigned i; - - for (i = 0; i < nr; i++) - colormask_quad(qs, quads[i]); - - /* pass quad to next stage */ - qs->next->run(qs->next, quads, nr); -} - - - -static void colormask_begin(struct quad_stage *qs) -{ - qs->next->begin(qs->next); -} - - -static void colormask_destroy(struct quad_stage *qs) -{ - FREE( qs ); -} - - -struct quad_stage *sp_quad_colormask_stage( struct softpipe_context *softpipe ) -{ - struct quad_stage *stage = CALLOC_STRUCT(quad_stage); - - stage->softpipe = softpipe; - stage->begin = colormask_begin; - stage->run = colormask_quads; - stage->destroy = colormask_destroy; - - return stage; -} diff --git a/src/gallium/drivers/softpipe/sp_quad_coverage.c b/src/gallium/drivers/softpipe/sp_quad_coverage.c index f06a385b3c..989e997f81 100644 --- a/src/gallium/drivers/softpipe/sp_quad_coverage.c +++ b/src/gallium/drivers/softpipe/sp_quad_coverage.c @@ -68,7 +68,6 @@ coverage_run(struct quad_stage *qs, struct quad_header *quads[], unsigned nr) { - struct softpipe_context *softpipe = qs->softpipe; unsigned i; for (i = 0; i < nr; i++) diff --git a/src/gallium/drivers/softpipe/sp_quad_output.c b/src/gallium/drivers/softpipe/sp_quad_output.c deleted file mode 100644 index 79a222ff58..0000000000 --- a/src/gallium/drivers/softpipe/sp_quad_output.c +++ /dev/null @@ -1,109 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include "util/u_memory.h" -#include "sp_context.h" -#include "sp_quad.h" -#include "sp_surface.h" -#include "sp_quad_pipe.h" -#include "sp_tile_cache.h" - - -/** - * Last step of quad processing: write quad colors to the framebuffer, - * taking mask into account. - */ -static void -output_quad(struct quad_stage *qs, struct quad_header *quads[], unsigned nr) -{ - - struct softpipe_context *softpipe = qs->softpipe; - uint cbuf; - - /* loop over colorbuffer outputs */ - for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) { - struct softpipe_cached_tile *tile - = sp_get_cached_tile(softpipe->cbuf_cache[cbuf], - quads[0]->input.x0, - quads[0]->input.y0); - int i, j, q; - - /* get/swizzle dest colors */ - for (q = 0; q < nr; q++) { - struct quad_header *quad = quads[q]; - float (*quadColor)[4] = quad->output.color[cbuf]; - - /* in-tile pos: */ - const int itx = quad->input.x0 % TILE_SIZE; - const int ity = quad->input.y0 % TILE_SIZE; - - - for (j = 0; j < QUAD_SIZE; j++) { - if (quad->inout.mask & (1 << j)) { - int x = itx + (j & 1); - int y = ity + (j >> 1); - for (i = 0; i < 4; i++) { /* loop over color chans */ - tile->data.color[y][x][i] = quadColor[i][j]; - } - if (0) { - debug_printf("sp write pixel %d,%d: %g, %g, %g\n", - quad->input.x0 + x, - quad->input.y0 + y, - quadColor[0][j], - quadColor[1][j], - quadColor[2][j]); - } - } - } - } - } -} - - -static void output_begin(struct quad_stage *qs) -{ - assert(qs->next == NULL); -} - - -static void output_destroy(struct quad_stage *qs) -{ - FREE( qs ); -} - - -struct quad_stage *sp_quad_output_stage( struct softpipe_context *softpipe ) -{ - struct quad_stage *stage = CALLOC_STRUCT(quad_stage); - - stage->softpipe = softpipe; - stage->begin = output_begin; - stage->run = output_quad; - stage->destroy = output_destroy; - - return stage; -} diff --git a/src/gallium/drivers/softpipe/sp_quad_pipe.c b/src/gallium/drivers/softpipe/sp_quad_pipe.c index 6fae7d552f..d138d417ac 100644 --- a/src/gallium/drivers/softpipe/sp_quad_pipe.c +++ b/src/gallium/drivers/softpipe/sp_quad_pipe.c @@ -65,25 +65,16 @@ sp_build_quad_pipeline(struct softpipe_context *sp) /* Color combine */ - sp->quad.first = sp->quad.output; - - if (sp->blend->colormask != 0xf) { - sp_push_quad_first( sp, sp->quad.colormask ); - } - - if (sp->blend->blend_enable || - sp->blend->logicop_enable) { - sp_push_quad_first( sp, sp->quad.blend ); - } + sp->quad.first = sp->quad.blend; + /* Shade/Depth/Stencil/Alpha + */ if ((sp->rasterizer->poly_smooth && sp->reduced_prim == PIPE_PRIM_TRIANGLES) || (sp->rasterizer->line_smooth && sp->reduced_prim == PIPE_PRIM_LINES) || (sp->rasterizer->point_smooth && sp->reduced_prim == PIPE_PRIM_POINTS)) { sp_push_quad_first( sp, sp->quad.coverage ); } - /* Shade/Depth/Stencil/Alpha - */ if (sp->active_query_count) { sp_push_quad_first( sp, sp->quad.occlusion ); } -- cgit v1.2.3 From ade8984f5023b05412f2467add4a59d14af53185 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sat, 25 Jul 2009 10:01:06 +0100 Subject: softpipe: cleanup framebuffer state routine slightly --- src/gallium/drivers/softpipe/sp_state_surface.c | 50 +++++-------------------- 1 file changed, 10 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_state_surface.c b/src/gallium/drivers/softpipe/sp_state_surface.c index 1621a27614..c8f55c3cec 100644 --- a/src/gallium/drivers/softpipe/sp_state_surface.c +++ b/src/gallium/drivers/softpipe/sp_state_surface.c @@ -75,51 +75,21 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe, /* update cache */ sp_tile_cache_set_surface(sp->zsbuf_cache, fb->zsbuf); - } - -#if 0 - /* XXX combined depth/stencil here */ - - /* sbuf changing? */ - if (sp->framebuffer.sbuf != fb->sbuf) { - /* flush old */ - sp_flush_tile_cache(sp, sp->sbuf_cache_sep); - - /* assign new */ - sp->framebuffer.sbuf = fb->sbuf; - - /* update cache */ - if (fb->sbuf != fb->zbuf) { - /* separate stencil buf */ - sp->sbuf_cache = sp->sbuf_cache_sep; - sp_tile_cache_set_surface(sp->sbuf_cache, fb->sbuf); - } - else { - /* combined depth/stencil */ - sp->sbuf_cache = sp->zbuf_cache; - sp_tile_cache_set_surface(sp->sbuf_cache, fb->sbuf); - } - } -#endif - /* Tell draw module how deep the Z/depth buffer is */ - { - int depth_bits; - double mrd; + /* Tell draw module how deep the Z/depth buffer is */ if (sp->framebuffer.zsbuf) { + int depth_bits; + double mrd; depth_bits = pf_get_component_bits(sp->framebuffer.zsbuf->format, PIPE_FORMAT_COMP_Z); + if (depth_bits > 16) { + mrd = 0.0000001; + } + else { + mrd = 0.00002; + } + draw_set_mrd(sp->draw, mrd); } - else { - depth_bits = 0; - } - if (depth_bits > 16) { - mrd = 0.0000001; - } - else { - mrd = 0.00002; - } - draw_set_mrd(sp->draw, mrd); } sp->framebuffer.width = fb->width; -- cgit v1.2.3 From 85613cc4f14de968ddd503610c5b8fcc77234c81 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sat, 25 Jul 2009 11:01:48 +0100 Subject: softpipe: fix error in scissor state dependencies --- src/gallium/drivers/softpipe/sp_state_derived.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index 629a1f8e29..0226501267 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -165,11 +165,19 @@ softpipe_get_vbuf_vertex_info(struct softpipe_context *softpipe) static void compute_cliprect(struct softpipe_context *sp) { + /* SP_NEW_FRAMEBUFFER + */ uint surfWidth = sp->framebuffer.width; uint surfHeight = sp->framebuffer.height; + /* SP_NEW_RASTERIZER + */ if (sp->rasterizer->scissor) { - /* clip to scissor rect */ + + /* SP_NEW_SCISSOR + * + * clip to scissor rect: + */ sp->cliprect.minx = MAX2(sp->scissor.minx, 0); sp->cliprect.miny = MAX2(sp->scissor.miny, 0); sp->cliprect.maxx = MIN2(sp->scissor.maxx, surfWidth); @@ -231,7 +239,7 @@ void softpipe_update_derived( struct softpipe_context *softpipe ) invalidate_vertex_layout( softpipe ); if (softpipe->dirty & (SP_NEW_SCISSOR | - SP_NEW_DEPTH_STENCIL_ALPHA | + SP_NEW_RASTERIZER | SP_NEW_FRAMEBUFFER)) compute_cliprect(softpipe); -- cgit v1.2.3 From bac8e34c9e4077d370923773d67fe565ce154849 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 27 Jul 2009 08:17:45 +0100 Subject: softpipe: move all depth/stencil/alpha pixel processing into one stage --- src/gallium/drivers/softpipe/Makefile | 5 - src/gallium/drivers/softpipe/sp_context.c | 12 - src/gallium/drivers/softpipe/sp_context.h | 6 - src/gallium/drivers/softpipe/sp_quad_alpha_test.c | 112 ---- src/gallium/drivers/softpipe/sp_quad_coverage.c | 101 ---- src/gallium/drivers/softpipe/sp_quad_depth_test.c | 659 ++++++++++++++++++---- src/gallium/drivers/softpipe/sp_quad_earlyz.c | 94 --- src/gallium/drivers/softpipe/sp_quad_fs.c | 46 +- src/gallium/drivers/softpipe/sp_quad_occlusion.c | 87 --- src/gallium/drivers/softpipe/sp_quad_pipe.c | 46 +- src/gallium/drivers/softpipe/sp_quad_pipe.h | 2 - src/gallium/drivers/softpipe/sp_quad_stencil.c | 363 ------------ src/gallium/drivers/softpipe/sp_state_derived.c | 4 +- 13 files changed, 580 insertions(+), 957 deletions(-) delete mode 100644 src/gallium/drivers/softpipe/sp_quad_alpha_test.c delete mode 100644 src/gallium/drivers/softpipe/sp_quad_coverage.c delete mode 100644 src/gallium/drivers/softpipe/sp_quad_earlyz.c delete mode 100644 src/gallium/drivers/softpipe/sp_quad_occlusion.c delete mode 100644 src/gallium/drivers/softpipe/sp_quad_stencil.c (limited to 'src') diff --git a/src/gallium/drivers/softpipe/Makefile b/src/gallium/drivers/softpipe/Makefile index bdc1a5819f..48522abe98 100644 --- a/src/gallium/drivers/softpipe/Makefile +++ b/src/gallium/drivers/softpipe/Makefile @@ -16,13 +16,8 @@ C_SOURCES = \ sp_prim_vbuf.c \ sp_quad_pipe.c \ sp_quad_stipple.c \ - sp_quad_earlyz.c \ sp_quad_depth_test.c \ - sp_quad_stencil.c \ sp_quad_fs.c \ - sp_quad_alpha_test.c \ - sp_quad_occlusion.c \ - sp_quad_coverage.c \ sp_quad_blend.c \ sp_screen.c \ sp_setup.c \ diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 28a0dd62ac..e35c6b3aec 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -88,14 +88,8 @@ static void softpipe_destroy( struct pipe_context *pipe ) if (softpipe->draw) draw_destroy( softpipe->draw ); - softpipe->quad.polygon_stipple->destroy( softpipe->quad.polygon_stipple ); - softpipe->quad.earlyz->destroy( softpipe->quad.earlyz ); softpipe->quad.shade->destroy( softpipe->quad.shade ); - softpipe->quad.alpha_test->destroy( softpipe->quad.alpha_test ); softpipe->quad.depth_test->destroy( softpipe->quad.depth_test ); - softpipe->quad.stencil_test->destroy( softpipe->quad.stencil_test ); - softpipe->quad.occlusion->destroy( softpipe->quad.occlusion ); - softpipe->quad.coverage->destroy( softpipe->quad.coverage ); softpipe->quad.blend->destroy( softpipe->quad.blend ); for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) @@ -230,14 +224,8 @@ softpipe_create( struct pipe_screen *screen ) /* setup quad rendering stages */ - softpipe->quad.polygon_stipple = sp_quad_polygon_stipple_stage(softpipe); - softpipe->quad.earlyz = sp_quad_earlyz_stage(softpipe); softpipe->quad.shade = sp_quad_shade_stage(softpipe); - softpipe->quad.alpha_test = sp_quad_alpha_test_stage(softpipe); softpipe->quad.depth_test = sp_quad_depth_test_stage(softpipe); - softpipe->quad.stencil_test = sp_quad_stencil_test_stage(softpipe); - softpipe->quad.occlusion = sp_quad_occlusion_stage(softpipe); - softpipe->quad.coverage = sp_quad_coverage_stage(softpipe); softpipe->quad.blend = sp_quad_blend_stage(softpipe); /* vertex shader samplers */ diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index b76ff610a3..fa3306c020 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -114,14 +114,8 @@ struct softpipe_context { /** Software quad rendering pipeline */ struct { - struct quad_stage *polygon_stipple; - struct quad_stage *earlyz; struct quad_stage *shade; - struct quad_stage *alpha_test; - struct quad_stage *stencil_test; struct quad_stage *depth_test; - struct quad_stage *occlusion; - struct quad_stage *coverage; struct quad_stage *blend; struct quad_stage *first; /**< points to one of the above stages */ diff --git a/src/gallium/drivers/softpipe/sp_quad_alpha_test.c b/src/gallium/drivers/softpipe/sp_quad_alpha_test.c deleted file mode 100644 index 3a282208b6..0000000000 --- a/src/gallium/drivers/softpipe/sp_quad_alpha_test.c +++ /dev/null @@ -1,112 +0,0 @@ - -/** - * quad alpha test - */ - -#include "sp_context.h" -#include "sp_quad.h" -#include "sp_quad_pipe.h" -#include "pipe/p_defines.h" -#include "util/u_memory.h" - -#define ALPHATEST( FUNC, COMP ) \ - static void \ - alpha_test_quads_##FUNC( struct quad_stage *qs, \ - struct quad_header *quads[], \ - unsigned nr ) \ - { \ - const float ref = qs->softpipe->depth_stencil->alpha.ref_value; \ - const uint cbuf = 0; /* only output[0].alpha is tested */ \ - unsigned pass_nr = 0; \ - unsigned i; \ - \ - for (i = 0; i < nr; i++) { \ - const float *aaaa = quads[i]->output.color[cbuf][3]; \ - unsigned passMask = 0; \ - \ - if (aaaa[0] COMP ref) passMask |= (1 << 0); \ - if (aaaa[1] COMP ref) passMask |= (1 << 1); \ - if (aaaa[2] COMP ref) passMask |= (1 << 2); \ - if (aaaa[3] COMP ref) passMask |= (1 << 3); \ - \ - quads[i]->inout.mask &= passMask; \ - \ - if (quads[i]->inout.mask) \ - quads[pass_nr++] = quads[i]; \ - } \ - \ - if (pass_nr) \ - qs->next->run(qs->next, quads, pass_nr); \ - } - - -ALPHATEST( LESS, < ) -ALPHATEST( EQUAL, == ) -ALPHATEST( LEQUAL, <= ) -ALPHATEST( GREATER, > ) -ALPHATEST( NOTEQUAL, != ) -ALPHATEST( GEQUAL, >= ) - - -/* XXX: Incorporate into shader using KILP. - */ -static void -alpha_test_quad(struct quad_stage *qs, - struct quad_header *quads[], - unsigned nr) -{ - switch (qs->softpipe->depth_stencil->alpha.func) { - case PIPE_FUNC_LESS: - alpha_test_quads_LESS( qs, quads, nr ); - break; - case PIPE_FUNC_EQUAL: - alpha_test_quads_EQUAL( qs, quads, nr ); - break; - case PIPE_FUNC_LEQUAL: - alpha_test_quads_LEQUAL( qs, quads, nr ); - break; - case PIPE_FUNC_GREATER: - alpha_test_quads_GREATER( qs, quads, nr ); - break; - case PIPE_FUNC_NOTEQUAL: - alpha_test_quads_NOTEQUAL( qs, quads, nr ); - break; - case PIPE_FUNC_GEQUAL: - alpha_test_quads_GEQUAL( qs, quads, nr ); - break; - case PIPE_FUNC_ALWAYS: - assert(0); /* should be caught earlier */ - qs->next->run(qs->next, quads, nr); - break; - case PIPE_FUNC_NEVER: - default: - assert(0); /* should be caught earlier */ - return; - } -} - - -static void alpha_test_begin(struct quad_stage *qs) -{ - qs->next->begin(qs->next); -} - - -static void alpha_test_destroy(struct quad_stage *qs) -{ - FREE( qs ); -} - - -struct quad_stage * -sp_quad_alpha_test_stage( struct softpipe_context *softpipe ) -{ - struct quad_stage *stage = CALLOC_STRUCT(quad_stage); - - stage->softpipe = softpipe; - stage->begin = alpha_test_begin; - stage->run = alpha_test_quad; - stage->destroy = alpha_test_destroy; - - return stage; -} diff --git a/src/gallium/drivers/softpipe/sp_quad_coverage.c b/src/gallium/drivers/softpipe/sp_quad_coverage.c deleted file mode 100644 index 989e997f81..0000000000 --- a/src/gallium/drivers/softpipe/sp_quad_coverage.c +++ /dev/null @@ -1,101 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * 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. - * - **************************************************************************/ - - -/** - * \brief Apply AA coverage to quad alpha valus - * \author Brian Paul - */ - - -#include "pipe/p_defines.h" -#include "util/u_memory.h" -#include "sp_context.h" -#include "sp_quad.h" -#include "sp_quad_pipe.h" - - -/** - * Multiply quad's alpha values by the fragment coverage. - */ -static INLINE void -coverage_quad(struct quad_stage *qs, struct quad_header *quad) -{ - struct softpipe_context *softpipe = qs->softpipe; - uint cbuf; - - /* loop over colorbuffer outputs */ - for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) { - float (*quadColor)[4] = quad->output.color[cbuf]; - unsigned j; - for (j = 0; j < QUAD_SIZE; j++) { - assert(quad->input.coverage[j] >= 0.0); - assert(quad->input.coverage[j] <= 1.0); - quadColor[3][j] *= quad->input.coverage[j]; - } - } -} - - -/* XXX: Incorporate into shader after alpha_test. - */ -static void -coverage_run(struct quad_stage *qs, - struct quad_header *quads[], - unsigned nr) -{ - unsigned i; - - for (i = 0; i < nr; i++) - coverage_quad( qs, quads[i] ); - - qs->next->run(qs->next, quads, nr); -} - -static void coverage_begin(struct quad_stage *qs) -{ - qs->next->begin(qs->next); -} - - -static void coverage_destroy(struct quad_stage *qs) -{ - FREE( qs ); -} - - -struct quad_stage *sp_quad_coverage_stage( struct softpipe_context *softpipe ) -{ - struct quad_stage *stage = CALLOC_STRUCT(quad_stage); - - stage->softpipe = softpipe; - stage->begin = coverage_begin; - stage->run = coverage_run; - stage->destroy = coverage_destroy; - - return stage; -} diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c index 8f223a7eae..bf65799a81 100644 --- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c +++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c @@ -31,61 +31,109 @@ #include "pipe/p_defines.h" #include "util/u_memory.h" +#include "tgsi/tgsi_scan.h" #include "sp_context.h" #include "sp_quad.h" #include "sp_surface.h" #include "sp_quad_pipe.h" #include "sp_tile_cache.h" +#include "sp_state.h" /* for sp_fragment_shader */ -/** - * Do depth testing for a quad. - * Not static since it's used by the stencil code. - */ +struct depth_data { + struct pipe_surface *ps; + enum pipe_format format; + unsigned bzzzz[QUAD_SIZE]; /**< Z values fetched from depth buffer */ + unsigned qzzzz[QUAD_SIZE]; /**< Z values from the quad */ + ubyte stencilVals[QUAD_SIZE]; + struct softpipe_cached_tile *tile; +}; -/* - * To increase efficiency, we should probably have multiple versions - * of this function that are specifically for Z16, Z32 and FP Z buffers. - * Try to effectively do that with codegen... - */ -boolean -sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad) + +static void +get_depth_stencil_values( struct depth_data *data, + const struct quad_header *quad ) { - struct softpipe_context *softpipe = qs->softpipe; - struct pipe_surface *ps = softpipe->framebuffer.zsbuf; - const enum pipe_format format = ps->format; - unsigned bzzzz[QUAD_SIZE]; /**< Z values fetched from depth buffer */ - unsigned qzzzz[QUAD_SIZE]; /**< Z values from the quad */ - unsigned zmask = 0; unsigned j; - struct softpipe_cached_tile *tile - = sp_get_cached_tile(softpipe->zsbuf_cache, quad->input.x0, quad->input.y0); + const struct softpipe_cached_tile *tile = data->tile; + + switch (data->format) { + case PIPE_FORMAT_Z16_UNORM: + for (j = 0; j < QUAD_SIZE; j++) { + int x = quad->input.x0 % TILE_SIZE + (j & 1); + int y = quad->input.y0 % TILE_SIZE + (j >> 1); + data->bzzzz[j] = tile->data.depth16[y][x]; + } + break; + case PIPE_FORMAT_Z32_UNORM: + for (j = 0; j < QUAD_SIZE; j++) { + int x = quad->input.x0 % TILE_SIZE + (j & 1); + int y = quad->input.y0 % TILE_SIZE + (j >> 1); + data->bzzzz[j] = tile->data.depth32[y][x]; + } + break; + case PIPE_FORMAT_X8Z24_UNORM: + case PIPE_FORMAT_S8Z24_UNORM: + for (j = 0; j < QUAD_SIZE; j++) { + int x = quad->input.x0 % TILE_SIZE + (j & 1); + int y = quad->input.y0 % TILE_SIZE + (j >> 1); + data->bzzzz[j] = tile->data.depth32[y][x] & 0xffffff; + data->stencilVals[j] = tile->data.depth32[y][x] >> 24; + } + break; + case PIPE_FORMAT_Z24X8_UNORM: + case PIPE_FORMAT_Z24S8_UNORM: + for (j = 0; j < QUAD_SIZE; j++) { + int x = quad->input.x0 % TILE_SIZE + (j & 1); + int y = quad->input.y0 % TILE_SIZE + (j >> 1); + data->bzzzz[j] = tile->data.depth32[y][x] >> 8; + data->stencilVals[j] = tile->data.depth32[y][x] & 0xff; + } + break; + default: + assert(0); + } +} - assert(ps); /* shouldn't get here if there's no zbuffer */ +/* If the shader has not been run, interpolate the depth values + * ourselves. + */ +static void +interpolate_quad_depth( struct quad_header *quad ) +{ + const float fx = (float) quad->input.x0; + const float fy = (float) quad->input.y0; + const float dzdx = quad->posCoef->dadx[2]; + const float dzdy = quad->posCoef->dady[2]; + const float z0 = quad->posCoef->a0[2] + dzdx * fx + dzdy * fy; + + quad->output.depth[0] = z0; + quad->output.depth[1] = z0 + dzdx; + quad->output.depth[2] = z0 + dzdy; + quad->output.depth[3] = z0 + dzdx + dzdy; +} - /* - * Convert quad's float depth values to int depth values (qzzzz). + +static void +convert_quad_depth( struct depth_data *data, + const struct quad_header *quad ) +{ + unsigned j; + + /* Convert quad's float depth values to int depth values (qzzzz). * If the Z buffer stores integer values, we _have_ to do the depth * compares with integers (not floats). Otherwise, the float->int->float * conversion of Z values (which isn't an identity function) will cause * Z-fighting errors. - * - * Also, get the zbuffer values (bzzzz) from the cached tile. */ - switch (format) { + switch (data->format) { case PIPE_FORMAT_Z16_UNORM: { float scale = 65535.0; for (j = 0; j < QUAD_SIZE; j++) { - qzzzz[j] = (unsigned) (quad->output.depth[j] * scale); - } - - for (j = 0; j < QUAD_SIZE; j++) { - int x = quad->input.x0 % TILE_SIZE + (j & 1); - int y = quad->input.y0 % TILE_SIZE + (j >> 1); - bzzzz[j] = tile->data.depth16[y][x]; + data->qzzzz[j] = (unsigned) (quad->output.depth[j] * scale); } } break; @@ -94,47 +142,247 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad) double scale = (double) (uint) ~0UL; for (j = 0; j < QUAD_SIZE; j++) { - qzzzz[j] = (unsigned) (quad->output.depth[j] * scale); - } - - for (j = 0; j < QUAD_SIZE; j++) { - int x = quad->input.x0 % TILE_SIZE + (j & 1); - int y = quad->input.y0 % TILE_SIZE + (j >> 1); - bzzzz[j] = tile->data.depth32[y][x]; + data->qzzzz[j] = (unsigned) (quad->output.depth[j] * scale); } } break; case PIPE_FORMAT_X8Z24_UNORM: - /* fall-through */ case PIPE_FORMAT_S8Z24_UNORM: { float scale = (float) ((1 << 24) - 1); for (j = 0; j < QUAD_SIZE; j++) { - qzzzz[j] = (unsigned) (quad->output.depth[j] * scale); - } - - for (j = 0; j < QUAD_SIZE; j++) { - int x = quad->input.x0 % TILE_SIZE + (j & 1); - int y = quad->input.y0 % TILE_SIZE + (j >> 1); - bzzzz[j] = tile->data.depth32[y][x] & 0xffffff; + data->qzzzz[j] = (unsigned) (quad->output.depth[j] * scale); } } break; case PIPE_FORMAT_Z24X8_UNORM: - /* fall-through */ case PIPE_FORMAT_Z24S8_UNORM: { float scale = (float) ((1 << 24) - 1); for (j = 0; j < QUAD_SIZE; j++) { - qzzzz[j] = (unsigned) (quad->output.depth[j] * scale); + data->qzzzz[j] = (unsigned) (quad->output.depth[j] * scale); } + } + break; + default: + assert(0); + } +} - for (j = 0; j < QUAD_SIZE; j++) { - int x = quad->input.x0 % TILE_SIZE + (j & 1); - int y = quad->input.y0 % TILE_SIZE + (j >> 1); - bzzzz[j] = tile->data.depth32[y][x] >> 8; + + +static void +write_depth_stencil_values( struct depth_data *data, + struct quad_header *quad ) +{ + struct softpipe_cached_tile *tile = data->tile; + unsigned j; + + /* put updated Z values back into cached tile */ + switch (data->format) { + case PIPE_FORMAT_Z16_UNORM: + for (j = 0; j < QUAD_SIZE; j++) { + int x = quad->input.x0 % TILE_SIZE + (j & 1); + int y = quad->input.y0 % TILE_SIZE + (j >> 1); + tile->data.depth16[y][x] = (ushort) data->bzzzz[j]; + } + break; + case PIPE_FORMAT_X8Z24_UNORM: + case PIPE_FORMAT_Z32_UNORM: + for (j = 0; j < QUAD_SIZE; j++) { + int x = quad->input.x0 % TILE_SIZE + (j & 1); + int y = quad->input.y0 % TILE_SIZE + (j >> 1); + tile->data.depth32[y][x] = data->bzzzz[j]; + } + break; + case PIPE_FORMAT_S8Z24_UNORM: + for (j = 0; j < QUAD_SIZE; j++) { + int x = quad->input.x0 % TILE_SIZE + (j & 1); + int y = quad->input.y0 % TILE_SIZE + (j >> 1); + tile->data.depth32[y][x] = (data->stencilVals[j] << 24) | data->bzzzz[j]; + } + break; + case PIPE_FORMAT_Z24S8_UNORM: + for (j = 0; j < QUAD_SIZE; j++) { + int x = quad->input.x0 % TILE_SIZE + (j & 1); + int y = quad->input.y0 % TILE_SIZE + (j >> 1); + tile->data.depth32[y][x] = (data->bzzzz[j] << 8) | data->stencilVals[j]; + } + break; + case PIPE_FORMAT_Z24X8_UNORM: + for (j = 0; j < QUAD_SIZE; j++) { + int x = quad->input.x0 % TILE_SIZE + (j & 1); + int y = quad->input.y0 % TILE_SIZE + (j >> 1); + tile->data.depth32[y][x] = data->bzzzz[j] << 8; + } + break; + default: + assert(0); + } +} + + + + +/** Only 8-bit stencil supported */ +#define STENCIL_MAX 0xff + + +/** + * Do the basic stencil test (compare stencil buffer values against the + * reference value. + * + * \param data->stencilVals the stencil values from the stencil buffer + * \param func the stencil func (PIPE_FUNC_x) + * \param ref the stencil reference value + * \param valMask the stencil value mask indicating which bits of the stencil + * values and ref value are to be used. + * \return mask indicating which pixels passed the stencil test + */ +static unsigned +do_stencil_test(struct depth_data *data, + unsigned func, + unsigned ref, unsigned valMask) +{ + unsigned passMask = 0x0; + unsigned j; + + ref &= valMask; + + switch (func) { + case PIPE_FUNC_NEVER: + /* passMask = 0x0 */ + break; + case PIPE_FUNC_LESS: + for (j = 0; j < QUAD_SIZE; j++) { + if (ref < (data->stencilVals[j] & valMask)) { + passMask |= (1 << j); + } + } + break; + case PIPE_FUNC_EQUAL: + for (j = 0; j < QUAD_SIZE; j++) { + if (ref == (data->stencilVals[j] & valMask)) { + passMask |= (1 << j); + } + } + break; + case PIPE_FUNC_LEQUAL: + for (j = 0; j < QUAD_SIZE; j++) { + if (ref <= (data->stencilVals[j] & valMask)) { + passMask |= (1 << j); + } + } + break; + case PIPE_FUNC_GREATER: + for (j = 0; j < QUAD_SIZE; j++) { + if (ref > (data->stencilVals[j] & valMask)) { + passMask |= (1 << j); + } + } + break; + case PIPE_FUNC_NOTEQUAL: + for (j = 0; j < QUAD_SIZE; j++) { + if (ref != (data->stencilVals[j] & valMask)) { + passMask |= (1 << j); + } + } + break; + case PIPE_FUNC_GEQUAL: + for (j = 0; j < QUAD_SIZE; j++) { + if (ref >= (data->stencilVals[j] & valMask)) { + passMask |= (1 << j); + } + } + break; + case PIPE_FUNC_ALWAYS: + passMask = MASK_ALL; + break; + default: + assert(0); + } + + return passMask; +} + + +/** + * Apply the stencil operator to stencil values. + * + * \param data->stencilVals the stencil buffer values (read and written) + * \param mask indicates which pixels to update + * \param op the stencil operator (PIPE_STENCIL_OP_x) + * \param ref the stencil reference value + * \param wrtMask writemask controlling which bits are changed in the + * stencil values + */ +static void +apply_stencil_op(struct depth_data *data, + unsigned mask, unsigned op, ubyte ref, ubyte wrtMask) +{ + unsigned j; + ubyte newstencil[QUAD_SIZE]; + + for (j = 0; j < QUAD_SIZE; j++) { + newstencil[j] = data->stencilVals[j]; + } + + switch (op) { + case PIPE_STENCIL_OP_KEEP: + /* no-op */ + break; + case PIPE_STENCIL_OP_ZERO: + for (j = 0; j < QUAD_SIZE; j++) { + if (mask & (1 << j)) { + newstencil[j] = 0; + } + } + break; + case PIPE_STENCIL_OP_REPLACE: + for (j = 0; j < QUAD_SIZE; j++) { + if (mask & (1 << j)) { + newstencil[j] = ref; + } + } + break; + case PIPE_STENCIL_OP_INCR: + for (j = 0; j < QUAD_SIZE; j++) { + if (mask & (1 << j)) { + if (data->stencilVals[j] < STENCIL_MAX) { + newstencil[j] = data->stencilVals[j] + 1; + } + } + } + break; + case PIPE_STENCIL_OP_DECR: + for (j = 0; j < QUAD_SIZE; j++) { + if (mask & (1 << j)) { + if (data->stencilVals[j] > 0) { + newstencil[j] = data->stencilVals[j] - 1; + } + } + } + break; + case PIPE_STENCIL_OP_INCR_WRAP: + for (j = 0; j < QUAD_SIZE; j++) { + if (mask & (1 << j)) { + newstencil[j] = data->stencilVals[j] + 1; + } + } + break; + case PIPE_STENCIL_OP_DECR_WRAP: + for (j = 0; j < QUAD_SIZE; j++) { + if (mask & (1 << j)) { + newstencil[j] = data->stencilVals[j] - 1; + } + } + break; + case PIPE_STENCIL_OP_INVERT: + for (j = 0; j < QUAD_SIZE; j++) { + if (mask & (1 << j)) { + newstencil[j] = ~data->stencilVals[j]; } } break; @@ -142,6 +390,39 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad) assert(0); } + /* + * update the stencil values + */ + if (wrtMask != STENCIL_MAX) { + /* apply bit-wise stencil buffer writemask */ + for (j = 0; j < QUAD_SIZE; j++) { + data->stencilVals[j] = (wrtMask & newstencil[j]) | (~wrtMask & data->stencilVals[j]); + } + } + else { + for (j = 0; j < QUAD_SIZE; j++) { + data->stencilVals[j] = newstencil[j]; + } + } +} + + + +/* + * To increase efficiency, we should probably have multiple versions + * of this function that are specifically for Z16, Z32 and FP Z buffers. + * Try to effectively do that with codegen... + */ + +static boolean +depth_test_quad(struct quad_stage *qs, + struct depth_data *data, + struct quad_header *quad) +{ + struct softpipe_context *softpipe = qs->softpipe; + unsigned zmask = 0; + unsigned j; + switch (softpipe->depth_stencil->depth.func) { case PIPE_FUNC_NEVER: /* zmask = 0 */ @@ -151,37 +432,37 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad) * Like this: quad->mask &= (quad->outputs.depth < zzzz); */ for (j = 0; j < QUAD_SIZE; j++) { - if (qzzzz[j] < bzzzz[j]) + if (data->qzzzz[j] < data->bzzzz[j]) zmask |= 1 << j; } break; case PIPE_FUNC_EQUAL: for (j = 0; j < QUAD_SIZE; j++) { - if (qzzzz[j] == bzzzz[j]) + if (data->qzzzz[j] == data->bzzzz[j]) zmask |= 1 << j; } break; case PIPE_FUNC_LEQUAL: for (j = 0; j < QUAD_SIZE; j++) { - if (qzzzz[j] <= bzzzz[j]) + if (data->qzzzz[j] <= data->bzzzz[j]) zmask |= (1 << j); } break; case PIPE_FUNC_GREATER: for (j = 0; j < QUAD_SIZE; j++) { - if (qzzzz[j] > bzzzz[j]) + if (data->qzzzz[j] > data->bzzzz[j]) zmask |= (1 << j); } break; case PIPE_FUNC_NOTEQUAL: for (j = 0; j < QUAD_SIZE; j++) { - if (qzzzz[j] != bzzzz[j]) + if (data->qzzzz[j] != data->bzzzz[j]) zmask |= (1 << j); } break; case PIPE_FUNC_GEQUAL: for (j = 0; j < QUAD_SIZE; j++) { - if (qzzzz[j] >= bzzzz[j]) + if (data->qzzzz[j] >= data->bzzzz[j]) zmask |= (1 << j); } break; @@ -196,83 +477,231 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad) if (quad->inout.mask == 0) return FALSE; + /* Update our internal copy only if writemask set. Even if + * depth.writemask is FALSE, may still need to write out buffer + * data due to stencil changes. + */ if (softpipe->depth_stencil->depth.writemask) { - - /* This is also efficient with sse / spe instructions: - */ for (j = 0; j < QUAD_SIZE; j++) { - if (quad->inout.mask & (1 << j)) { - bzzzz[j] = qzzzz[j]; - } + if (quad->inout.mask & (1 << j)) { + data->bzzzz[j] = data->qzzzz[j]; + } } + } - /* put updated Z values back into cached tile */ - switch (format) { - case PIPE_FORMAT_Z16_UNORM: - for (j = 0; j < QUAD_SIZE; j++) { - int x = quad->input.x0 % TILE_SIZE + (j & 1); - int y = quad->input.y0 % TILE_SIZE + (j >> 1); - tile->data.depth16[y][x] = (ushort) bzzzz[j]; - } - break; - case PIPE_FORMAT_X8Z24_UNORM: - /* fall-through */ - /* (yes, this falls through to a different case than above) */ - case PIPE_FORMAT_Z32_UNORM: - for (j = 0; j < QUAD_SIZE; j++) { - int x = quad->input.x0 % TILE_SIZE + (j & 1); - int y = quad->input.y0 % TILE_SIZE + (j >> 1); - tile->data.depth32[y][x] = bzzzz[j]; - } - break; - case PIPE_FORMAT_S8Z24_UNORM: - for (j = 0; j < QUAD_SIZE; j++) { - int x = quad->input.x0 % TILE_SIZE + (j & 1); - int y = quad->input.y0 % TILE_SIZE + (j >> 1); - uint s8z24 = tile->data.depth32[y][x]; - s8z24 = (s8z24 & 0xff000000) | bzzzz[j]; - tile->data.depth32[y][x] = s8z24; - } - break; - case PIPE_FORMAT_Z24S8_UNORM: - for (j = 0; j < QUAD_SIZE; j++) { - int x = quad->input.x0 % TILE_SIZE + (j & 1); - int y = quad->input.y0 % TILE_SIZE + (j >> 1); - uint z24s8 = tile->data.depth32[y][x]; - z24s8 = (z24s8 & 0xff) | (bzzzz[j] << 8); - tile->data.depth32[y][x] = z24s8; + return TRUE; +} + + + +/** + * Do stencil (and depth) testing. Stenciling depends on the outcome of + * depth testing. + */ +static boolean +depth_stencil_test_quad(struct quad_stage *qs, + struct depth_data *data, + struct quad_header *quad) +{ + struct softpipe_context *softpipe = qs->softpipe; + unsigned func, zFailOp, zPassOp, failOp; + ubyte ref, wrtMask, valMask; + uint face = quad->input.facing; + + if (!softpipe->depth_stencil->stencil[1].enabled) { + /* single-sided stencil test, use front (face=0) state */ + face = 0; + } + + /* choose front or back face function, operator, etc */ + /* XXX we could do these initializations once per primitive */ + func = softpipe->depth_stencil->stencil[face].func; + failOp = softpipe->depth_stencil->stencil[face].fail_op; + zFailOp = softpipe->depth_stencil->stencil[face].zfail_op; + zPassOp = softpipe->depth_stencil->stencil[face].zpass_op; + ref = softpipe->depth_stencil->stencil[face].ref_value; + wrtMask = softpipe->depth_stencil->stencil[face].writemask; + valMask = softpipe->depth_stencil->stencil[face].valuemask; + + + /* do the stencil test first */ + { + unsigned passMask, failMask; + passMask = do_stencil_test(data, func, ref, valMask); + failMask = quad->inout.mask & ~passMask; + quad->inout.mask &= passMask; + + if (failOp != PIPE_STENCIL_OP_KEEP) { + apply_stencil_op(data, failMask, failOp, ref, wrtMask); + } + } + + if (quad->inout.mask) { + /* now the pixels that passed the stencil test are depth tested */ + if (softpipe->depth_stencil->depth.enabled) { + const unsigned origMask = quad->inout.mask; + + depth_test_quad(qs, data, quad); /* quad->mask is updated */ + + /* update stencil buffer values according to z pass/fail result */ + if (zFailOp != PIPE_STENCIL_OP_KEEP) { + const unsigned failMask = origMask & ~quad->inout.mask; + apply_stencil_op(data, failMask, zFailOp, ref, wrtMask); } - break; - case PIPE_FORMAT_Z24X8_UNORM: - for (j = 0; j < QUAD_SIZE; j++) { - int x = quad->input.x0 % TILE_SIZE + (j & 1); - int y = quad->input.y0 % TILE_SIZE + (j >> 1); - tile->data.depth32[y][x] = bzzzz[j] << 8; + + if (zPassOp != PIPE_STENCIL_OP_KEEP) { + const unsigned passMask = origMask & quad->inout.mask; + apply_stencil_op(data, passMask, zPassOp, ref, wrtMask); } - break; - default: - assert(0); + } + else { + /* no depth test, apply Zpass operator to stencil buffer values */ + apply_stencil_op(data, quad->inout.mask, zPassOp, ref, wrtMask); } } - return TRUE; + return quad->inout.mask != 0; } +#define ALPHATEST( FUNC, COMP ) \ + static int \ + alpha_test_quads_##FUNC( struct quad_stage *qs, \ + struct quad_header *quads[], \ + unsigned nr ) \ + { \ + const float ref = qs->softpipe->depth_stencil->alpha.ref_value; \ + const uint cbuf = 0; /* only output[0].alpha is tested */ \ + unsigned pass_nr = 0; \ + unsigned i; \ + \ + for (i = 0; i < nr; i++) { \ + const float *aaaa = quads[i]->output.color[cbuf][3]; \ + unsigned passMask = 0; \ + \ + if (aaaa[0] COMP ref) passMask |= (1 << 0); \ + if (aaaa[1] COMP ref) passMask |= (1 << 1); \ + if (aaaa[2] COMP ref) passMask |= (1 << 2); \ + if (aaaa[3] COMP ref) passMask |= (1 << 3); \ + \ + quads[i]->inout.mask &= passMask; \ + \ + if (quads[i]->inout.mask) \ + quads[pass_nr++] = quads[i]; \ + } \ + \ + return pass_nr; \ + } + + +ALPHATEST( LESS, < ) +ALPHATEST( EQUAL, == ) +ALPHATEST( LEQUAL, <= ) +ALPHATEST( GREATER, > ) +ALPHATEST( NOTEQUAL, != ) +ALPHATEST( GEQUAL, >= ) + + +/* XXX: Incorporate into shader using KILP. + */ +static int +alpha_test_quads(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) +{ + switch (qs->softpipe->depth_stencil->alpha.func) { + case PIPE_FUNC_LESS: + return alpha_test_quads_LESS( qs, quads, nr ); + case PIPE_FUNC_EQUAL: + return alpha_test_quads_EQUAL( qs, quads, nr ); + break; + case PIPE_FUNC_LEQUAL: + return alpha_test_quads_LEQUAL( qs, quads, nr ); + case PIPE_FUNC_GREATER: + return alpha_test_quads_GREATER( qs, quads, nr ); + case PIPE_FUNC_NOTEQUAL: + return alpha_test_quads_NOTEQUAL( qs, quads, nr ); + case PIPE_FUNC_GEQUAL: + return alpha_test_quads_GEQUAL( qs, quads, nr ); + case PIPE_FUNC_ALWAYS: + return nr; + case PIPE_FUNC_NEVER: + default: + return 0; + } +} + +static unsigned mask_count[0x8] = +{ + 0, /* 0x0 */ + 1, /* 0x1 */ + 1, /* 0x2 */ + 2, /* 0x3 */ + 1, /* 0x4 */ + 2, /* 0x5 */ + 2, /* 0x6 */ + 3, /* 0x7 */ +}; + + + static void depth_test_quads(struct quad_stage *qs, struct quad_header *quads[], unsigned nr) { unsigned i, pass = 0; + const struct sp_fragment_shader *fs = qs->softpipe->fs; + boolean interp_depth = !fs->info.writes_z; + struct depth_data data; - for (i = 0; i < nr; i++) { - if (sp_depth_test_quad(qs, quads[i])) + + if (qs->softpipe->depth_stencil->alpha.enabled) { + nr = alpha_test_quads(qs, quads, nr); + } + + if (qs->softpipe->framebuffer.zsbuf && + (qs->softpipe->depth_stencil->depth.enabled || + qs->softpipe->depth_stencil->stencil[0].enabled)) { + + data.ps = qs->softpipe->framebuffer.zsbuf; + data.format = data.ps->format; + data.tile = sp_get_cached_tile(qs->softpipe->zsbuf_cache, + quads[0]->input.x0, + quads[0]->input.y0); + + for (i = 0; i < nr; i++) { + get_depth_stencil_values(&data, quads[i]); + + if (qs->softpipe->depth_stencil->depth.enabled) { + if (interp_depth) + interpolate_quad_depth(quads[i]); + + convert_quad_depth(&data, quads[i]); + } + + if (qs->softpipe->depth_stencil->stencil[0].enabled) { + if (!depth_stencil_test_quad(qs, &data, quads[i])) + continue; + } + else { + if (!depth_test_quad(qs, &data, quads[i])) + continue; + } + + if (qs->softpipe->depth_stencil->stencil[0].enabled || + qs->softpipe->depth_stencil->depth.writemask) + write_depth_stencil_values(&data, quads[i]); + + qs->softpipe->occlusion_count += mask_count[quads[i]->inout.mask]; quads[pass++] = quads[i]; + } + + nr = pass; } - - if (pass) - qs->next->run(qs->next, quads, pass); + + if (nr) + qs->next->run(qs->next, quads, nr); } diff --git a/src/gallium/drivers/softpipe/sp_quad_earlyz.c b/src/gallium/drivers/softpipe/sp_quad_earlyz.c deleted file mode 100644 index 1048d44984..0000000000 --- a/src/gallium/drivers/softpipe/sp_quad_earlyz.c +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * 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. - * - **************************************************************************/ - -/** - * \brief Quad early-z testing - */ - -#include "pipe/p_defines.h" -#include "util/u_memory.h" -#include "sp_quad.h" -#include "sp_quad_pipe.h" - - -/** - * All this stage does is compute the quad's Z values (which is normally - * done by the shading stage). - * The next stage will do the actual depth test. - */ -static void -earlyz_quad( - struct quad_stage *qs, - struct quad_header *quads[], - unsigned nr ) -{ - const float a0z = quads[0]->posCoef->a0[2]; - const float dzdx = quads[0]->posCoef->dadx[2]; - const float dzdy = quads[0]->posCoef->dady[2]; - unsigned i; - - for (i = 0; i < nr; i++) { - const float fx = (float) quads[i]->input.x0; - const float fy = (float) quads[i]->input.y0; - const float z0 = a0z + dzdx * fx + dzdy * fy; - - quads[i]->output.depth[0] = z0; - quads[i]->output.depth[1] = z0 + dzdx; - quads[i]->output.depth[2] = z0 + dzdy; - quads[i]->output.depth[3] = z0 + dzdx + dzdy; - } - - qs->next->run( qs->next, quads, nr ); -} - -static void -earlyz_begin( - struct quad_stage *qs ) -{ - qs->next->begin( qs->next ); -} - -static void -earlyz_destroy( - struct quad_stage *qs ) -{ - FREE( qs ); -} - -struct quad_stage * -sp_quad_earlyz_stage( - struct softpipe_context *softpipe ) -{ - struct quad_stage *stage = CALLOC_STRUCT( quad_stage ); - - stage->softpipe = softpipe; - stage->begin = earlyz_begin; - stage->run = earlyz_quad; - stage->destroy = earlyz_destroy; - - return stage; -} diff --git a/src/gallium/drivers/softpipe/sp_quad_fs.c b/src/gallium/drivers/softpipe/sp_quad_fs.c index ea5ed3bbd0..56a8f55d77 100644 --- a/src/gallium/drivers/softpipe/sp_quad_fs.c +++ b/src/gallium/drivers/softpipe/sp_quad_fs.c @@ -111,24 +111,31 @@ shade_quad(struct quad_stage *qs, struct quad_header *quad) } } - if (!z_written) { - /* compute Z values now, as in the quad earlyz stage */ - /* XXX we should really only do this if the earlyz stage is not used */ - const float fx = (float) quad->input.x0; - const float fy = (float) quad->input.y0; - const float dzdx = quad->posCoef->dadx[2]; - const float dzdy = quad->posCoef->dady[2]; - const float z0 = quad->posCoef->a0[2] + dzdx * fx + dzdy * fy; - - quad->output.depth[0] = z0; - quad->output.depth[1] = z0 + dzdx; - quad->output.depth[2] = z0 + dzdy; - quad->output.depth[3] = z0 + dzdx + dzdy; - } - return TRUE; } + + +static void +coverage_quad(struct quad_stage *qs, struct quad_header *quad) +{ + struct softpipe_context *softpipe = qs->softpipe; + uint cbuf; + + /* loop over colorbuffer outputs */ + for (cbuf = 0; cbuf < softpipe->framebuffer.nr_cbufs; cbuf++) { + float (*quadColor)[4] = quad->output.color[cbuf]; + unsigned j; + for (j = 0; j < QUAD_SIZE; j++) { + assert(quad->input.coverage[j] >= 0.0); + assert(quad->input.coverage[j] <= 1.0); + quadColor[3][j] *= quad->input.coverage[j]; + } + } +} + + + static void shade_quads(struct quad_stage *qs, struct quad_header *quads[], @@ -144,8 +151,13 @@ shade_quads(struct quad_stage *qs, machine->InterpCoefs = quads[0]->coef; for (i = 0; i < nr; i++) { - if (shade_quad(qs, quads[i])) - quads[pass++] = quads[i]; + if (!shade_quad(qs, quads[i])) + continue; + + if (/*do_coverage*/ 0) + coverage_quad( qs, quads[i] ); + + quads[pass++] = quads[i]; } if (pass) diff --git a/src/gallium/drivers/softpipe/sp_quad_occlusion.c b/src/gallium/drivers/softpipe/sp_quad_occlusion.c deleted file mode 100644 index 4adeb16546..0000000000 --- a/src/gallium/drivers/softpipe/sp_quad_occlusion.c +++ /dev/null @@ -1,87 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * 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. - * - **************************************************************************/ - - -/** - * \brief Quad occlusion counter stage - * \author Brian Paul - */ - - -#include "pipe/p_defines.h" -#include "util/u_memory.h" -#include "sp_context.h" -#include "sp_quad.h" -#include "sp_surface.h" -#include "sp_quad_pipe.h" - -static unsigned count_bits( unsigned val ) -{ - unsigned i; - - for (i = 0; val ; val >>= 1) - i += (val & 1); - - return i; -} - -static void -occlusion_count_quads(struct quad_stage *qs, struct quad_header *quads[], unsigned nr) -{ - struct softpipe_context *softpipe = qs->softpipe; - unsigned i; - - for (i = 0; i < nr; i++) - softpipe->occlusion_count += count_bits(quads[i]->inout.mask); - - qs->next->run(qs->next, quads, nr); -} - - -static void occlusion_begin(struct quad_stage *qs) -{ - qs->next->begin(qs->next); -} - - -static void occlusion_destroy(struct quad_stage *qs) -{ - FREE( qs ); -} - - -struct quad_stage *sp_quad_occlusion_stage( struct softpipe_context *softpipe ) -{ - struct quad_stage *stage = CALLOC_STRUCT(quad_stage); - - stage->softpipe = softpipe; - stage->begin = occlusion_begin; - stage->run = occlusion_count_quads; - stage->destroy = occlusion_destroy; - - return stage; -} diff --git a/src/gallium/drivers/softpipe/sp_quad_pipe.c b/src/gallium/drivers/softpipe/sp_quad_pipe.c index d138d417ac..1b5bab4eca 100644 --- a/src/gallium/drivers/softpipe/sp_quad_pipe.c +++ b/src/gallium/drivers/softpipe/sp_quad_pipe.c @@ -38,18 +38,6 @@ sp_push_quad_first( struct softpipe_context *sp, sp->quad.first = quad; } -static void -sp_build_depth_stencil( struct softpipe_context *sp ) -{ - if (sp->depth_stencil->stencil[0].enabled || - sp->depth_stencil->stencil[1].enabled) { - sp_push_quad_first( sp, sp->quad.stencil_test ); - } - else if (sp->depth_stencil->depth.enabled && - sp->framebuffer.zsbuf) { - sp_push_quad_first( sp, sp->quad.depth_test ); - } -} void sp_build_quad_pipeline(struct softpipe_context *sp) @@ -61,37 +49,15 @@ sp_build_quad_pipeline(struct softpipe_context *sp) !sp->fs->info.uses_kill && !sp->fs->info.writes_z; - /* build up the pipeline in reverse order... */ - - /* Color combine - */ sp->quad.first = sp->quad.blend; - /* Shade/Depth/Stencil/Alpha - */ - if ((sp->rasterizer->poly_smooth && sp->reduced_prim == PIPE_PRIM_TRIANGLES) || - (sp->rasterizer->line_smooth && sp->reduced_prim == PIPE_PRIM_LINES) || - (sp->rasterizer->point_smooth && sp->reduced_prim == PIPE_PRIM_POINTS)) { - sp_push_quad_first( sp, sp->quad.coverage ); - } - - if (sp->active_query_count) { - sp_push_quad_first( sp, sp->quad.occlusion ); - } - - if (!early_depth_test) { - sp_build_depth_stencil( sp ); - } - - if (sp->depth_stencil->alpha.enabled) { - sp_push_quad_first( sp, sp->quad.alpha_test ); - } - - sp_push_quad_first( sp, sp->quad.shade ); - if (early_depth_test) { - sp_build_depth_stencil( sp ); - sp_push_quad_first( sp, sp->quad.earlyz ); + sp_push_quad_first( sp, sp->quad.shade ); + sp_push_quad_first( sp, sp->quad.depth_test ); + } + else { + sp_push_quad_first( sp, sp->quad.depth_test ); + sp_push_quad_first( sp, sp->quad.shade ); } } diff --git a/src/gallium/drivers/softpipe/sp_quad_pipe.h b/src/gallium/drivers/softpipe/sp_quad_pipe.h index add31ba705..c0aa134831 100644 --- a/src/gallium/drivers/softpipe/sp_quad_pipe.h +++ b/src/gallium/drivers/softpipe/sp_quad_pipe.h @@ -69,6 +69,4 @@ struct quad_stage *sp_quad_output_stage( struct softpipe_context *softpipe ); void sp_build_quad_pipeline(struct softpipe_context *sp); -boolean sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad); - #endif /* SP_QUAD_PIPE_H */ diff --git a/src/gallium/drivers/softpipe/sp_quad_stencil.c b/src/gallium/drivers/softpipe/sp_quad_stencil.c deleted file mode 100644 index d9ee80e59a..0000000000 --- a/src/gallium/drivers/softpipe/sp_quad_stencil.c +++ /dev/null @@ -1,363 +0,0 @@ - -/** - * \brief Quad stencil testing - */ - - -#include "sp_context.h" -#include "sp_quad.h" -#include "sp_surface.h" -#include "sp_tile_cache.h" -#include "sp_quad_pipe.h" -#include "pipe/p_defines.h" -#include "util/u_memory.h" - - -/** Only 8-bit stencil supported */ -#define STENCIL_MAX 0xff - - -/** - * Do the basic stencil test (compare stencil buffer values against the - * reference value. - * - * \param stencilVals the stencil values from the stencil buffer - * \param func the stencil func (PIPE_FUNC_x) - * \param ref the stencil reference value - * \param valMask the stencil value mask indicating which bits of the stencil - * values and ref value are to be used. - * \return mask indicating which pixels passed the stencil test - */ -static unsigned -do_stencil_test(const ubyte stencilVals[QUAD_SIZE], unsigned func, - unsigned ref, unsigned valMask) -{ - unsigned passMask = 0x0; - unsigned j; - - ref &= valMask; - - switch (func) { - case PIPE_FUNC_NEVER: - /* passMask = 0x0 */ - break; - case PIPE_FUNC_LESS: - for (j = 0; j < QUAD_SIZE; j++) { - if (ref < (stencilVals[j] & valMask)) { - passMask |= (1 << j); - } - } - break; - case PIPE_FUNC_EQUAL: - for (j = 0; j < QUAD_SIZE; j++) { - if (ref == (stencilVals[j] & valMask)) { - passMask |= (1 << j); - } - } - break; - case PIPE_FUNC_LEQUAL: - for (j = 0; j < QUAD_SIZE; j++) { - if (ref <= (stencilVals[j] & valMask)) { - passMask |= (1 << j); - } - } - break; - case PIPE_FUNC_GREATER: - for (j = 0; j < QUAD_SIZE; j++) { - if (ref > (stencilVals[j] & valMask)) { - passMask |= (1 << j); - } - } - break; - case PIPE_FUNC_NOTEQUAL: - for (j = 0; j < QUAD_SIZE; j++) { - if (ref != (stencilVals[j] & valMask)) { - passMask |= (1 << j); - } - } - break; - case PIPE_FUNC_GEQUAL: - for (j = 0; j < QUAD_SIZE; j++) { - if (ref >= (stencilVals[j] & valMask)) { - passMask |= (1 << j); - } - } - break; - case PIPE_FUNC_ALWAYS: - passMask = MASK_ALL; - break; - default: - assert(0); - } - - return passMask; -} - - -/** - * Apply the stencil operator to stencil values. - * - * \param stencilVals the stencil buffer values (read and written) - * \param mask indicates which pixels to update - * \param op the stencil operator (PIPE_STENCIL_OP_x) - * \param ref the stencil reference value - * \param wrtMask writemask controlling which bits are changed in the - * stencil values - */ -static void -apply_stencil_op(ubyte stencilVals[QUAD_SIZE], - unsigned mask, unsigned op, ubyte ref, ubyte wrtMask) -{ - unsigned j; - ubyte newstencil[QUAD_SIZE]; - - for (j = 0; j < QUAD_SIZE; j++) { - newstencil[j] = stencilVals[j]; - } - - switch (op) { - case PIPE_STENCIL_OP_KEEP: - /* no-op */ - break; - case PIPE_STENCIL_OP_ZERO: - for (j = 0; j < QUAD_SIZE; j++) { - if (mask & (1 << j)) { - newstencil[j] = 0; - } - } - break; - case PIPE_STENCIL_OP_REPLACE: - for (j = 0; j < QUAD_SIZE; j++) { - if (mask & (1 << j)) { - newstencil[j] = ref; - } - } - break; - case PIPE_STENCIL_OP_INCR: - for (j = 0; j < QUAD_SIZE; j++) { - if (mask & (1 << j)) { - if (stencilVals[j] < STENCIL_MAX) { - newstencil[j] = stencilVals[j] + 1; - } - } - } - break; - case PIPE_STENCIL_OP_DECR: - for (j = 0; j < QUAD_SIZE; j++) { - if (mask & (1 << j)) { - if (stencilVals[j] > 0) { - newstencil[j] = stencilVals[j] - 1; - } - } - } - break; - case PIPE_STENCIL_OP_INCR_WRAP: - for (j = 0; j < QUAD_SIZE; j++) { - if (mask & (1 << j)) { - newstencil[j] = stencilVals[j] + 1; - } - } - break; - case PIPE_STENCIL_OP_DECR_WRAP: - for (j = 0; j < QUAD_SIZE; j++) { - if (mask & (1 << j)) { - newstencil[j] = stencilVals[j] - 1; - } - } - break; - case PIPE_STENCIL_OP_INVERT: - for (j = 0; j < QUAD_SIZE; j++) { - if (mask & (1 << j)) { - newstencil[j] = ~stencilVals[j]; - } - } - break; - default: - assert(0); - } - - /* - * update the stencil values - */ - if (wrtMask != STENCIL_MAX) { - /* apply bit-wise stencil buffer writemask */ - for (j = 0; j < QUAD_SIZE; j++) { - stencilVals[j] = (wrtMask & newstencil[j]) | (~wrtMask & stencilVals[j]); - } - } - else { - for (j = 0; j < QUAD_SIZE; j++) { - stencilVals[j] = newstencil[j]; - } - } -} - - -/** - * Do stencil (and depth) testing. Stenciling depends on the outcome of - * depth testing. - */ -static void -stencil_test_quad(struct quad_stage *qs, struct quad_header *quads[], - unsigned nr) -{ - struct softpipe_context *softpipe = qs->softpipe; - struct pipe_surface *ps = softpipe->framebuffer.zsbuf; - unsigned func, zFailOp, zPassOp, failOp; - ubyte ref, wrtMask, valMask; - ubyte stencilVals[QUAD_SIZE]; - struct softpipe_cached_tile *tile - = sp_get_cached_tile(softpipe->zsbuf_cache, - quads[0]->input.x0, - quads[0]->input.y0); - uint face = quads[0]->input.facing; - uint pass = 0; - uint j, q; - - if (!softpipe->depth_stencil->stencil[1].enabled) { - /* single-sided stencil test, use front (face=0) state */ - face = 0; - } - - /* choose front or back face function, operator, etc */ - /* XXX we could do these initializations once per primitive */ - func = softpipe->depth_stencil->stencil[face].func; - failOp = softpipe->depth_stencil->stencil[face].fail_op; - zFailOp = softpipe->depth_stencil->stencil[face].zfail_op; - zPassOp = softpipe->depth_stencil->stencil[face].zpass_op; - ref = softpipe->depth_stencil->stencil[face].ref_value; - wrtMask = softpipe->depth_stencil->stencil[face].writemask; - valMask = softpipe->depth_stencil->stencil[face].valuemask; - - assert(ps); /* shouldn't get here if there's no stencil buffer */ - - for (q = 0; q < nr; q++) { - struct quad_header *quad = quads[q]; - - /* get stencil values from cached tile */ - switch (ps->format) { - case PIPE_FORMAT_S8Z24_UNORM: - for (j = 0; j < QUAD_SIZE; j++) { - int x = quad->input.x0 % TILE_SIZE + (j & 1); - int y = quad->input.y0 % TILE_SIZE + (j >> 1); - stencilVals[j] = tile->data.depth32[y][x] >> 24; - } - break; - case PIPE_FORMAT_Z24S8_UNORM: - for (j = 0; j < QUAD_SIZE; j++) { - int x = quad->input.x0 % TILE_SIZE + (j & 1); - int y = quad->input.y0 % TILE_SIZE + (j >> 1); - stencilVals[j] = tile->data.depth32[y][x] & 0xff; - } - break; - case PIPE_FORMAT_S8_UNORM: - for (j = 0; j < QUAD_SIZE; j++) { - int x = quad->input.x0 % TILE_SIZE + (j & 1); - int y = quad->input.y0 % TILE_SIZE + (j >> 1); - stencilVals[j] = tile->data.stencil8[y][x]; - } - break; - default: - assert(0); - } - - /* do the stencil test first */ - { - unsigned passMask, failMask; - passMask = do_stencil_test(stencilVals, func, ref, valMask); - failMask = quad->inout.mask & ~passMask; - quad->inout.mask &= passMask; - - if (failOp != PIPE_STENCIL_OP_KEEP) { - apply_stencil_op(stencilVals, failMask, failOp, ref, wrtMask); - } - } - - if (quad->inout.mask) { - /* now the pixels that passed the stencil test are depth tested */ - if (softpipe->depth_stencil->depth.enabled) { - const unsigned origMask = quad->inout.mask; - - sp_depth_test_quad(qs, quad); /* quad->mask is updated */ - - /* update stencil buffer values according to z pass/fail result */ - if (zFailOp != PIPE_STENCIL_OP_KEEP) { - const unsigned failMask = origMask & ~quad->inout.mask; - apply_stencil_op(stencilVals, failMask, zFailOp, ref, wrtMask); - } - - if (zPassOp != PIPE_STENCIL_OP_KEEP) { - const unsigned passMask = origMask & quad->inout.mask; - apply_stencil_op(stencilVals, passMask, zPassOp, ref, wrtMask); - } - } - else { - /* no depth test, apply Zpass operator to stencil buffer values */ - apply_stencil_op(stencilVals, quad->inout.mask, zPassOp, ref, wrtMask); - } - - } - - /* put new stencil values into cached tile */ - switch (ps->format) { - case PIPE_FORMAT_S8Z24_UNORM: - for (j = 0; j < QUAD_SIZE; j++) { - int x = quad->input.x0 % TILE_SIZE + (j & 1); - int y = quad->input.y0 % TILE_SIZE + (j >> 1); - uint s8z24 = tile->data.depth32[y][x]; - s8z24 = (stencilVals[j] << 24) | (s8z24 & 0xffffff); - tile->data.depth32[y][x] = s8z24; - } - break; - case PIPE_FORMAT_Z24S8_UNORM: - for (j = 0; j < QUAD_SIZE; j++) { - int x = quad->input.x0 % TILE_SIZE + (j & 1); - int y = quad->input.y0 % TILE_SIZE + (j >> 1); - uint z24s8 = tile->data.depth32[y][x]; - z24s8 = (z24s8 & 0xffffff00) | stencilVals[j]; - tile->data.depth32[y][x] = z24s8; - } - break; - case PIPE_FORMAT_S8_UNORM: - for (j = 0; j < QUAD_SIZE; j++) { - int x = quad->input.x0 % TILE_SIZE + (j & 1); - int y = quad->input.y0 % TILE_SIZE + (j >> 1); - tile->data.stencil8[y][x] = stencilVals[j]; - } - break; - default: - assert(0); - } - - if (quad->inout.mask) - quads[pass++] = quad; - } - - if (pass) - qs->next->run(qs->next, quads, pass); -} - - -static void stencil_begin(struct quad_stage *qs) -{ - qs->next->begin(qs->next); -} - - -static void stencil_destroy(struct quad_stage *qs) -{ - FREE( qs ); -} - - -struct quad_stage *sp_quad_stencil_test_stage( struct softpipe_context *softpipe ) -{ - struct quad_stage *stage = CALLOC_STRUCT(quad_stage); - - stage->softpipe = softpipe; - stage->begin = stencil_begin; - stage->run = stencil_test_quad; - stage->destroy = stencil_destroy; - - return stage; -} diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index 0226501267..8654069bde 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -246,9 +246,7 @@ void softpipe_update_derived( struct softpipe_context *softpipe ) if (softpipe->dirty & (SP_NEW_BLEND | SP_NEW_DEPTH_STENCIL_ALPHA | SP_NEW_FRAMEBUFFER | - SP_NEW_RASTERIZER | - SP_NEW_FS | - SP_NEW_QUERY)) + SP_NEW_FS)) sp_build_quad_pipeline(softpipe); softpipe->dirty = 0; -- cgit v1.2.3 From 1078844d18367b4259cd3b6a3a73e3cd72ea019f Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 27 Jul 2009 11:23:51 +0100 Subject: softpipe: cope with nr_cbufs == 0 Disable blend code when no color buffer --- src/gallium/drivers/softpipe/sp_quad_blend.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c index e1f0e77255..e243c63fa2 100644 --- a/src/gallium/drivers/softpipe/sp_quad_blend.c +++ b/src/gallium/drivers/softpipe/sp_quad_blend.c @@ -924,6 +924,13 @@ single_output_color(struct quad_stage *qs, } } +static void +blend_noop(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) +{ +} + static void choose_blend_quad(struct quad_stage *qs, @@ -934,9 +941,12 @@ choose_blend_quad(struct quad_stage *qs, const struct pipe_blend_state *blend = softpipe->blend; qs->run = blend_fallback; - - if (!softpipe->blend->logicop_enable && - softpipe->blend->colormask == 0xf) + + if (softpipe->framebuffer.nr_cbufs == 0) { + qs->run = blend_noop; + } + else if (!softpipe->blend->logicop_enable && + softpipe->blend->colormask == 0xf) { if (!blend->blend_enable) { qs->run = single_output_color; -- cgit v1.2.3 From c61145820556833dccd728eb6df3397bec7f70da Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 27 Jul 2009 12:11:16 +0100 Subject: softpipe: fastpath for interpolated z16 less depthtesting Because this is interpolated (ie. early) depth, we can build in an assumption about the quads emitted by triangle setup, ie that they are actually linear spans. Interpolate z over those spans in z16 format to save on math & conversion. --- src/gallium/drivers/softpipe/sp_quad_depth_test.c | 143 +++++++++++++++++++++- 1 file changed, 139 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c index bf65799a81..506867f4d0 100644 --- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c +++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c @@ -646,9 +646,9 @@ static unsigned mask_count[0x8] = static void -depth_test_quads(struct quad_stage *qs, - struct quad_header *quads[], - unsigned nr) +depth_test_quads_fallback(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) { unsigned i, pass = 0; const struct sp_fragment_shader *fs = qs->softpipe->fs; @@ -704,9 +704,144 @@ depth_test_quads(struct quad_stage *qs, qs->next->run(qs->next, quads, nr); } +/* XXX: this function assumes setup function actually emits linear + * spans of quads. It seems a lot more natural to do (early) + * depth-testing on spans rather than quads. + */ +static void +depth_interp_z16_less_write(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) +{ + unsigned i, pass = 0; + const unsigned ix = quads[0]->input.x0; + const unsigned iy = quads[0]->input.y0; + const float fx = (float) ix; + const float fy = (float) iy; + const float dzdx = quads[0]->posCoef->dadx[2]; + const float dzdy = quads[0]->posCoef->dady[2]; + const float z0 = quads[0]->posCoef->a0[2] + dzdx * fx + dzdy * fy; + struct softpipe_cached_tile *tile; + ushort (*depth16)[TILE_SIZE]; + ushort idepth[4], depth_step; + const float scale = 65535.0; + + idepth[0] = (ushort)((z0) * scale); + idepth[1] = (ushort)((z0 + dzdx) * scale); + idepth[2] = (ushort)((z0 + dzdy) * scale); + idepth[3] = (ushort)((z0 + dzdx + dzdy) * scale); + + depth_step = (ushort)(dzdx * 2 * scale); + + tile = sp_get_cached_tile(qs->softpipe->zsbuf_cache, ix, iy); + + depth16 = (ushort (*)[TILE_SIZE]) + &tile->data.depth16[iy % TILE_SIZE][ix % TILE_SIZE]; + + for (i = 0; i < nr; i++) { + unsigned outmask = quads[i]->inout.mask; + unsigned mask = 0; + + if ((outmask & 1) && idepth[0] < depth16[0][0]) { + depth16[0][0] = idepth[0]; + mask |= (1 << 0); + } + + if ((outmask & 2) && idepth[1] < depth16[0][1]) { + depth16[0][1] = idepth[1]; + mask |= (1 << 1); + } + + if ((outmask & 4) && idepth[2] < depth16[1][0]) { + depth16[1][0] = idepth[2]; + mask |= (1 << 2); + } + + if ((outmask & 8) && idepth[3] < depth16[1][1]) { + depth16[1][1] = idepth[3]; + mask |= (1 << 3); + } + + idepth[0] += depth_step; + idepth[1] += depth_step; + idepth[2] += depth_step; + idepth[3] += depth_step; + + depth16 = (ushort (*)[TILE_SIZE]) &depth16[0][2]; + + quads[i]->inout.mask = mask; + if (quads[i]->inout.mask) + quads[pass++] = quads[i]; + } + + if (pass) + qs->next->run(qs->next, quads, pass); + +} + + +static void +depth_noop(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) +{ + qs->next->run(qs->next, quads, nr); +} + + + +static void +choose_depth_test(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) +{ + boolean interp_depth = !qs->softpipe->fs->info.writes_z; + + boolean alpha = qs->softpipe->depth_stencil->alpha.enabled; + + boolean depth = (qs->softpipe->framebuffer.zsbuf && + qs->softpipe->depth_stencil->depth.enabled); + + unsigned depthfunc = qs->softpipe->depth_stencil->depth.func; + + boolean stencil = qs->softpipe->depth_stencil->stencil[0].enabled; + + boolean depthwrite = qs->softpipe->depth_stencil->depth.writemask; + + + qs->run = depth_test_quads_fallback; + + if (!alpha && + !depth && + !stencil) { + qs->run = depth_noop; + } + else if (!alpha && + interp_depth && + depth && + depthfunc == PIPE_FUNC_LESS && + depthwrite && + !stencil) + { + switch (qs->softpipe->framebuffer.zsbuf->format) { + case PIPE_FORMAT_Z16_UNORM: + qs->run = depth_interp_z16_less_write; + break; + default: + break; + } + } + + qs->run( qs, quads, nr ); +} + + + + static void depth_test_begin(struct quad_stage *qs) { + qs->run = choose_depth_test; qs->next->begin(qs->next); } @@ -723,7 +858,7 @@ struct quad_stage *sp_quad_depth_test_stage( struct softpipe_context *softpipe ) stage->softpipe = softpipe; stage->begin = depth_test_begin; - stage->run = depth_test_quads; + stage->run = choose_depth_test; stage->destroy = depth_test_destroy; return stage; -- cgit v1.2.3 From 6142de393fe34ff0866f8489f1292eb473276f11 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 27 Jul 2009 12:44:58 +0100 Subject: softpipe: example fast paths for simple samplers All these fastpaths are examples of the types of things we'd code-generate in a more sophisticated version of softpipe. --- src/gallium/drivers/softpipe/sp_state_derived.c | 1 + src/gallium/drivers/softpipe/sp_tex_sample.c | 327 +++++++++++++++++++++++- src/gallium/drivers/softpipe/sp_tex_sample.h | 10 +- 3 files changed, 333 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index 8654069bde..3ed1de7e17 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -208,6 +208,7 @@ update_tgsi_samplers( struct softpipe_context *softpipe ) for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { softpipe->tgsi.frag_samplers[i].sampler = softpipe->sampler[i]; softpipe->tgsi.frag_samplers[i].texture = softpipe->texture[i]; + softpipe->tgsi.frag_samplers[i].base.get_samples = sp_get_samples_fragment; } for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 46c56b0c83..8248576e98 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -662,10 +662,64 @@ choose_mipmap_levels(const struct pipe_texture *texture, * XXX maybe move this into sp_tile_cache.c and merge with the * sp_get_cached_tile_tex() function. Also, get 4 texels instead of 1... */ +static void +get_texel_quad_2d(const struct tgsi_sampler *tgsi_sampler, + unsigned face, unsigned level, int x, int y, + const float *out[4]) +{ + const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); + + const struct softpipe_cached_tile *tile + = sp_get_cached_tile_tex(samp->cache, + tile_address(x, y, 0, face, level)); + + y %= TILE_SIZE; + x %= TILE_SIZE; + + out[0] = &tile->data.color[y ][x ][0]; + out[1] = &tile->data.color[y ][x+1][0]; + out[2] = &tile->data.color[y+1][x ][0]; + out[3] = &tile->data.color[y+1][x+1][0]; +} + +static INLINE const float * +get_texel_2d_ptr(const struct tgsi_sampler *tgsi_sampler, + unsigned face, unsigned level, int x, int y) +{ + const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); + + const struct softpipe_cached_tile *tile + = sp_get_cached_tile_tex(samp->cache, + tile_address(x, y, 0, face, level)); + + y %= TILE_SIZE; + x %= TILE_SIZE; + + return &tile->data.color[y][x][0]; +} + + +static void +get_texel_quad_2d_mt(const struct tgsi_sampler *tgsi_sampler, + unsigned face, unsigned level, + int x0, int y0, + int x1, int y1, + const float *out[4]) +{ + unsigned i; + + for (i = 0; i < 4; i++) { + unsigned tx = (i & 1) ? x1 : x0; + unsigned ty = (i >> 1) ? y1 : y0; + + out[i] = get_texel_2d_ptr( tgsi_sampler, face, level, tx, ty ); + } +} + static void get_texel(const struct tgsi_sampler *tgsi_sampler, - unsigned face, unsigned level, int x, int y, int z, - float rgba[NUM_CHANNELS][QUAD_SIZE], unsigned j) + unsigned face, unsigned level, int x, int y, int z, + float rgba[NUM_CHANNELS][QUAD_SIZE], unsigned j) { const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); const struct pipe_texture *texture = samp->texture; @@ -825,6 +879,193 @@ shadow_compare4(const struct pipe_sampler_state *sampler, } + +static void +sp_get_samples_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) +{ + const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); + unsigned j; + unsigned level = samp->level; + unsigned xpot = 1 << (samp->xpot - level); + unsigned ypot = 1 << (samp->ypot - level); + + for (j = 0; j < QUAD_SIZE; j++) { + int c; + + float u = s[j] * xpot - 0.5F; + float v = t[j] * ypot - 0.5F; + + int uflr = util_ifloor(u); + int vflr = util_ifloor(v); + + float xw = u - (float)uflr; + float yw = v - (float)vflr; + + int x0 = uflr & (xpot - 1); + int y0 = vflr & (ypot - 1); + + const float *tx[4]; + + + /* Can we fetch all four at once: + */ + if (x0 % TILE_SIZE != TILE_SIZE-1 && + y0 % TILE_SIZE != TILE_SIZE-1) + { + get_texel_quad_2d(tgsi_sampler, 0, level, x0, y0, tx); + } + else + { + unsigned x1 = (uflr + 1) & (xpot - 1); + unsigned y1 = (vflr + 1) & (ypot - 1); + get_texel_quad_2d_mt(tgsi_sampler, 0, level, + x0, y0, x1, y1, tx); + } + + + /* interpolate R, G, B, A */ + for (c = 0; c < 4; c++) { + rgba[c][j] = lerp_2d(xw, yw, + tx[0][c], tx[1][c], + tx[2][c], tx[3][c]); + } + } +} + + +static void +sp_get_samples_2d_nearest_repeat_POT(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) +{ + const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); + unsigned j; + unsigned level = samp->level; + unsigned xpot = 1 << (samp->xpot - level); + unsigned ypot = 1 << (samp->ypot - level); + + for (j = 0; j < QUAD_SIZE; j++) { + int c; + + float u = s[j] * xpot - 0.5F; + float v = t[j] * ypot - 0.5F; + + int uflr = util_ifloor(u); + int vflr = util_ifloor(v); + + int x0 = uflr & (xpot - 1); + int y0 = vflr & (ypot - 1); + + const float *out = get_texel_2d_ptr(tgsi_sampler, 0, level, x0, y0); + + for (c = 0; c < 4; c++) { + rgba[c][j] = out[c]; + } + } +} + + +static void +sp_get_samples_2d_nearest_clamp_POT(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) +{ + const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); + unsigned j; + unsigned level = samp->level; + unsigned xpot = (1<xpot); + unsigned ypot = (1<ypot); + + for (j = 0; j < QUAD_SIZE; j++) { + int c; + + float u = s[j] * xpot - 0.5F; + float v = t[j] * ypot - 0.5F; + + int x0, y0; + const float *out; + + x0 = util_ifloor(u); + if (x0 < 0) + x0 = 0; + else if (x0 > xpot - 1) + x0 = xpot - 1; + + y0 = util_ifloor(v); + if (y0 < 0) + y0 = 0; + else if (y0 > ypot - 1) + y0 = ypot - 1; + + out = get_texel_2d_ptr(tgsi_sampler, 0, level, x0, y0); + + for (c = 0; c < 4; c++) { + rgba[c][j] = out[c]; + } + } +} + + +static void +sp_get_samples_2d_linear_mip_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) +{ + struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); + const struct pipe_texture *texture = samp->texture; + const struct pipe_sampler_state *sampler = samp->sampler; + int level0, level1; + float lambda; + + lambda = compute_lambda(texture, sampler, s, t, p, lodbias); + level0 = (int)lambda; + level1 = level0 + 1; + + if (lambda < 0.0) { + samp->level = 0; + sp_get_samples_2d_linear_repeat_POT( tgsi_sampler, + s, t, p, lodbias, rgba ); + } + else if (level0 >= texture->last_level) { + samp->level = texture->last_level; + sp_get_samples_2d_linear_repeat_POT( tgsi_sampler, + s, t, p, lodbias, rgba ); + } + else { + float rgba0[4][4]; + float rgba1[4][4]; + int c,j; + + float levelBlend = lambda - level0; /* blending weight between levels */ + + samp->level = level0; + sp_get_samples_2d_linear_repeat_POT( tgsi_sampler, + s, t, p, lodbias, rgba0 ); + + samp->level++; + sp_get_samples_2d_linear_repeat_POT( tgsi_sampler, + s, t, p, lodbias, rgba1 ); + + for (c = 0; c < 4; c++) + for (j = 0; j < 4; j++) + rgba[c][j] = lerp(levelBlend, rgba0[c][j], rgba1[c][j]); + } +} + /** * Common code for sampling 1D/2D/cube textures. * Could probably extend for 3D... @@ -1254,6 +1495,16 @@ sp_get_samples(struct tgsi_sampler *tgsi_sampler, #endif } +static void +sp_get_samples_fallback(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) +{ + sp_get_samples(tgsi_sampler, s, t, p, TRUE, lodbias, rgba); +} /** * Called via tgsi_sampler::get_samples() when running a fragment shader. @@ -1267,7 +1518,77 @@ sp_get_samples_fragment(struct tgsi_sampler *tgsi_sampler, float lodbias, float rgba[NUM_CHANNELS][QUAD_SIZE]) { - sp_get_samples(tgsi_sampler, s, t, p, TRUE, lodbias, rgba); + struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); + const struct pipe_texture *texture = samp->texture; + const struct pipe_sampler_state *sampler = samp->sampler; + + tgsi_sampler->get_samples = sp_get_samples_fallback; + + /* Try to hook in a faster sampler. Ultimately we'll have to + * code-generate these. Luckily most of this looks like it is + * orthogonal state within the sampler. + */ + if (texture->target == PIPE_TEXTURE_2D && + sampler->min_img_filter == sampler->mag_img_filter && + sampler->wrap_s == sampler->wrap_t && + sampler->compare_mode == FALSE && + sampler->normalized_coords) + { + samp->xpot = util_unsigned_logbase2( samp->texture->width[0] ); + samp->ypot = util_unsigned_logbase2( samp->texture->height[0] ); + + if (sampler->min_mip_filter == PIPE_TEX_MIPFILTER_NONE) { + samp->level = CLAMP((int) sampler->min_lod, + 0, (int) texture->last_level); + + if (sampler->wrap_s == PIPE_TEX_WRAP_REPEAT) { + switch (sampler->min_img_filter) { + case PIPE_TEX_FILTER_NEAREST: + tgsi_sampler->get_samples = sp_get_samples_2d_nearest_repeat_POT; + break; + case PIPE_TEX_FILTER_LINEAR: + tgsi_sampler->get_samples = sp_get_samples_2d_linear_repeat_POT; + break; + default: + break; + } + } + else if (sampler->wrap_s == PIPE_TEX_WRAP_CLAMP) { + switch (sampler->min_img_filter) { + case PIPE_TEX_FILTER_NEAREST: + tgsi_sampler->get_samples = sp_get_samples_2d_nearest_clamp_POT; + break; + default: + break; + } + } + } + else if (sampler->min_mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { + if (sampler->wrap_s == PIPE_TEX_WRAP_REPEAT) { + switch (sampler->min_img_filter) { + case PIPE_TEX_FILTER_LINEAR: + /* This one not working yet: + */ + if (0) + tgsi_sampler->get_samples = sp_get_samples_2d_linear_mip_linear_repeat_POT; + break; + default: + break; + } + } + } + } + else if (0) { + _debug_printf("target %d/%d min_mip %d/%d min_img %d/%d wrap %d/%d compare %d/%d norm %d/%d\n", + texture->target, PIPE_TEXTURE_2D, + sampler->min_mip_filter, PIPE_TEX_MIPFILTER_NONE, + sampler->min_img_filter, sampler->mag_img_filter, + sampler->wrap_s, sampler->wrap_t, + sampler->compare_mode, FALSE, + sampler->normalized_coords, TRUE); + } + + tgsi_sampler->get_samples( tgsi_sampler, s, t, p, lodbias, rgba ); } diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.h b/src/gallium/drivers/softpipe/sp_tex_sample.h index 3c5beb560f..0650c7830b 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.h +++ b/src/gallium/drivers/softpipe/sp_tex_sample.h @@ -39,6 +39,12 @@ struct sp_shader_sampler { struct tgsi_sampler base; /**< base class */ + /* For sp_get_samples_2d_linear_POT: + */ + unsigned xpot; + unsigned ypot; + unsigned level; + const struct pipe_texture *texture; const struct pipe_sampler_state *sampler; @@ -47,10 +53,10 @@ struct sp_shader_sampler -static INLINE const struct sp_shader_sampler * +static INLINE struct sp_shader_sampler * sp_shader_sampler(const struct tgsi_sampler *sampler) { - return (const struct sp_shader_sampler *) sampler; + return (struct sp_shader_sampler *) sampler; } -- cgit v1.2.3 From 5fdac2dcea09c654725666b3cab5f59dfc9e31a5 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 27 Jul 2009 15:51:15 +0100 Subject: softpipe: fix off-by-one in nearest texcoord routines Stray '- 0.5' copied from linear versions. --- src/gallium/drivers/softpipe/sp_tex_sample.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 8248576e98..4651d781a9 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -955,8 +955,8 @@ sp_get_samples_2d_nearest_repeat_POT(struct tgsi_sampler *tgsi_sampler, for (j = 0; j < QUAD_SIZE; j++) { int c; - float u = s[j] * xpot - 0.5F; - float v = t[j] * ypot - 0.5F; + float u = s[j] * xpot; + float v = t[j] * ypot; int uflr = util_ifloor(u); int vflr = util_ifloor(v); @@ -990,8 +990,8 @@ sp_get_samples_2d_nearest_clamp_POT(struct tgsi_sampler *tgsi_sampler, for (j = 0; j < QUAD_SIZE; j++) { int c; - float u = s[j] * xpot - 0.5F; - float v = t[j] * ypot - 0.5F; + float u = s[j] * xpot; + float v = t[j] * ypot; int x0, y0; const float *out; -- cgit v1.2.3 From 572c2fb5bb6cec71ef42e93416251a6a6c183de0 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 30 Jul 2009 11:34:36 +0100 Subject: softpipe: remove unused variable in shade_quad --- src/gallium/drivers/softpipe/sp_quad_fs.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_quad_fs.c b/src/gallium/drivers/softpipe/sp_quad_fs.c index 56a8f55d77..e1bc0712de 100644 --- a/src/gallium/drivers/softpipe/sp_quad_fs.c +++ b/src/gallium/drivers/softpipe/sp_quad_fs.c @@ -74,7 +74,6 @@ 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; struct tgsi_exec_machine *machine = qss->machine; - boolean z_written; /* run shader */ quad->inout.mask &= softpipe->fs->run( softpipe->fs, machine, quad ); @@ -82,7 +81,6 @@ shade_quad(struct quad_stage *qs, struct quad_header *quad) return FALSE; /* store outputs */ - z_written = FALSE; { const ubyte *sem_name = softpipe->fs->info.output_semantic_name; const ubyte *sem_index = softpipe->fs->info.output_semantic_index; @@ -104,7 +102,6 @@ shade_quad(struct quad_stage *qs, struct quad_header *quad) for (j = 0; j < 4; j++) { quad->output.depth[j] = machine->Outputs[0].xyzw[2].f[j]; } - z_written = TRUE; } break; } -- cgit v1.2.3 From 73a6178a73a4cc34195348a537d3f94aab6a43e1 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 30 Jul 2009 11:35:08 +0100 Subject: softpipe: add depth-lequal z16 path --- src/gallium/drivers/softpipe/sp_quad_depth_test.c | 107 ++++++++++++++++++++-- 1 file changed, 100 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c index 506867f4d0..9cffea2c9e 100644 --- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c +++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c @@ -780,6 +780,81 @@ depth_interp_z16_less_write(struct quad_stage *qs, } +static void +depth_interp_z16_lequal_write(struct quad_stage *qs, + struct quad_header *quads[], + unsigned nr) +{ + unsigned i, pass = 0; + const unsigned ix = quads[0]->input.x0; + const unsigned iy = quads[0]->input.y0; + const float fx = (float) ix; + const float fy = (float) iy; + const float dzdx = quads[0]->posCoef->dadx[2]; + const float dzdy = quads[0]->posCoef->dady[2]; + const float z0 = quads[0]->posCoef->a0[2] + dzdx * fx + dzdy * fy; + struct softpipe_cached_tile *tile; + ushort (*depth16)[TILE_SIZE]; + ushort idepth[4], depth_step; + const float scale = 65535.0; + + idepth[0] = (ushort)((z0) * scale); + idepth[1] = (ushort)((z0 + dzdx) * scale); + idepth[2] = (ushort)((z0 + dzdy) * scale); + idepth[3] = (ushort)((z0 + dzdx + dzdy) * scale); + + depth_step = (ushort)(dzdx * 2 * scale); + + tile = sp_get_cached_tile(qs->softpipe->zsbuf_cache, ix, iy); + + depth16 = (ushort (*)[TILE_SIZE]) + &tile->data.depth16[iy % TILE_SIZE][ix % TILE_SIZE]; + + for (i = 0; i < nr; i++) { + unsigned outmask = quads[i]->inout.mask; + unsigned mask = 0; + + if ((outmask & 1) && idepth[0] <= depth16[0][0]) { + depth16[0][0] = idepth[0]; + mask |= (1 << 0); + } + + if ((outmask & 2) && idepth[1] <= depth16[0][1]) { + depth16[0][1] = idepth[1]; + mask |= (1 << 1); + } + + if ((outmask & 4) && idepth[2] <= depth16[1][0]) { + depth16[1][0] = idepth[2]; + mask |= (1 << 2); + } + + if ((outmask & 8) && idepth[3] <= depth16[1][1]) { + depth16[1][1] = idepth[3]; + mask |= (1 << 3); + } + + idepth[0] += depth_step; + idepth[1] += depth_step; + idepth[2] += depth_step; + idepth[3] += depth_step; + + depth16 = (ushort (*)[TILE_SIZE]) &depth16[0][2]; + + quads[i]->inout.mask = mask; + if (quads[i]->inout.mask) + quads[pass++] = quads[i]; + } + + if (pass) + qs->next->run(qs->next, quads, pass); + +} + + + + + static void depth_noop(struct quad_stage *qs, struct quad_header *quads[], @@ -809,8 +884,6 @@ choose_depth_test(struct quad_stage *qs, boolean depthwrite = qs->softpipe->depth_stencil->depth.writemask; - qs->run = depth_test_quads_fallback; - if (!alpha && !depth && !stencil) { @@ -819,18 +892,38 @@ choose_depth_test(struct quad_stage *qs, else if (!alpha && interp_depth && depth && - depthfunc == PIPE_FUNC_LESS && depthwrite && !stencil) { - switch (qs->softpipe->framebuffer.zsbuf->format) { - case PIPE_FORMAT_Z16_UNORM: - qs->run = depth_interp_z16_less_write; + switch (depthfunc) { + case PIPE_FUNC_LESS: + switch (qs->softpipe->framebuffer.zsbuf->format) { + case PIPE_FORMAT_Z16_UNORM: + qs->run = depth_interp_z16_less_write; + break; + default: + qs->run = depth_test_quads_fallback; + break; + } break; - default: + case PIPE_FUNC_LEQUAL: + switch (qs->softpipe->framebuffer.zsbuf->format) { + case PIPE_FORMAT_Z16_UNORM: + qs->run = depth_interp_z16_lequal_write; + break; + default: + qs->run = depth_test_quads_fallback; + break; + } break; + default: + qs->run = depth_test_quads_fallback; } } + else { + qs->run = depth_test_quads_fallback; + } + qs->run( qs, quads, nr ); } -- cgit v1.2.3 From 1295cf423e21dad04a947960782ffa8db2739709 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 30 Jul 2009 11:35:50 +0100 Subject: softpipe: rearrange blend fastpaths --- src/gallium/drivers/softpipe/sp_quad_blend.c | 82 +++++++++------------------- 1 file changed, 27 insertions(+), 55 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c index e243c63fa2..b8ed086734 100644 --- a/src/gallium/drivers/softpipe/sp_quad_blend.c +++ b/src/gallium/drivers/softpipe/sp_quad_blend.c @@ -793,10 +793,7 @@ blend_single_add_src_alpha_inv_src_alpha(struct quad_stage *qs, struct quad_header *quads[], unsigned nr) { - static const float one[4] = { 1, 1, 1, 1 }; - float one_minus_alpha[QUAD_SIZE]; - float dest[4][QUAD_SIZE]; - float source[4][QUAD_SIZE]; + float source[4]; uint i, j, q; struct softpipe_cached_tile *tile @@ -806,45 +803,26 @@ blend_single_add_src_alpha_inv_src_alpha(struct quad_stage *qs, for (q = 0; q < nr; q++) { struct quad_header *quad = quads[q]; - float (*quadColor)[4] = quad->output.color[0]; - const float *alpha = quadColor[3]; const int itx = (quad->input.x0 & (TILE_SIZE-1)); const int ity = (quad->input.y0 & (TILE_SIZE-1)); + float (*swzColor)[4] = quad->output.color[0]; - /* get/swizzle dest colors */ - for (j = 0; j < QUAD_SIZE; j++) { - int x = itx + (j & 1); - int y = ity + (j >> 1); - for (i = 0; i < 4; i++) { - dest[i][j] = tile->data.color[y][x][i]; - } - } - - VEC4_MUL(source[0], quadColor[0], alpha); /* R */ - VEC4_MUL(source[1], quadColor[1], alpha); /* G */ - VEC4_MUL(source[2], quadColor[2], alpha); /* B */ - VEC4_MUL(source[3], quadColor[3], alpha); /* A */ + for (j = 0; j < 4; j++) { + if (quad->inout.mask & (1<data.color[ity + (j>>1)][itx + (j&1)]; + const float alpha = swzColor[3][j]; + const float one_minus_alpha = 1.0 - alpha; - VEC4_SUB(one_minus_alpha, one, alpha); - VEC4_MUL(dest[0], dest[0], one_minus_alpha); /* R */ - VEC4_MUL(dest[1], dest[1], one_minus_alpha); /* G */ - VEC4_MUL(dest[2], dest[2], one_minus_alpha); /* B */ - VEC4_MUL(dest[3], dest[3], one_minus_alpha); /* B */ - - VEC4_ADD_SAT(quadColor[0], source[0], dest[0]); /* R */ - VEC4_ADD_SAT(quadColor[1], source[1], dest[1]); /* G */ - VEC4_ADD_SAT(quadColor[2], source[2], dest[2]); /* B */ - VEC4_ADD_SAT(quadColor[3], source[3], dest[3]); /* A */ + for (i = 0; i < 4; i++) { + dest[i] *= one_minus_alpha; + dest[i] += swzColor[i][j] * alpha; - for (j = 0; j < QUAD_SIZE; j++) { - if (quad->inout.mask & (1 << j)) { - int x = itx + (j & 1); - int y = ity + (j >> 1); - for (i = 0; i < 4; i++) { /* loop over color chans */ - tile->data.color[y][x][i] = quadColor[i][j]; + /* XXX: redundant, will be clamped later for argb8 surfaces: + */ + dest[i] = CLAMP(dest[i], 0.0, 1.0); } } - } + } } } @@ -863,33 +841,27 @@ blend_single_add_one_one(struct quad_stage *qs, for (q = 0; q < nr; q++) { struct quad_header *quad = quads[q]; - float (*quadColor)[4] = quad->output.color[0]; const int itx = (quad->input.x0 & (TILE_SIZE-1)); const int ity = (quad->input.y0 & (TILE_SIZE-1)); - + float (*dest)[64][4] = (float (*)[64][4])&tile->data.color[ity][itx]; + float (*swzColor)[4] = quad->output.color[0]; + float quadColor[4][4]; + /* get/swizzle dest colors */ for (j = 0; j < QUAD_SIZE; j++) { - int x = itx + (j & 1); - int y = ity + (j >> 1); for (i = 0; i < 4; i++) { - dest[i][j] = tile->data.color[y][x][i]; + quadColor[i][j] = swzColor[j][i]; } } - VEC4_ADD_SAT(quadColor[0], quadColor[0], dest[0]); /* R */ - VEC4_ADD_SAT(quadColor[1], quadColor[1], dest[1]); /* G */ - VEC4_ADD_SAT(quadColor[2], quadColor[2], dest[2]); /* B */ - VEC4_ADD_SAT(quadColor[3], quadColor[3], dest[3]); /* A */ - - for (j = 0; j < QUAD_SIZE; j++) { - if (quad->inout.mask & (1 << j)) { - int x = itx + (j & 1); - int y = ity + (j >> 1); - for (i = 0; i < 4; i++) { /* loop over color chans */ - tile->data.color[y][x][i] = quadColor[i][j]; - } - } - } + if (quad->inout.mask & 1) + VEC4_ADD_SAT(dest[0][0], quadColor[0], dest[0][0]); + if (quad->inout.mask & 2) + VEC4_ADD_SAT(dest[0][1], quadColor[1], dest[0][1]); + if (quad->inout.mask & 4) + VEC4_ADD_SAT(dest[1][0], quadColor[2], dest[1][0]); + if (quad->inout.mask & 8) + VEC4_ADD_SAT(dest[1][1], quadColor[3], dest[1][1]); } } -- cgit v1.2.3 From 95f7ed4638d4e379783abdd5b250e203b6b1b435 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 30 Jul 2009 11:59:32 +0100 Subject: softpipe: setup quad outputs from with fs->run --- src/gallium/drivers/softpipe/sp_fs_exec.c | 34 ++++++++++++++++++++++++++++- src/gallium/drivers/softpipe/sp_fs_sse.c | 35 +++++++++++++++++++++++++++++- src/gallium/drivers/softpipe/sp_quad_fs.c | 36 ++----------------------------- 3 files changed, 69 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_fs_exec.c b/src/gallium/drivers/softpipe/sp_fs_exec.c index 9ee86fe787..91e04687c5 100644 --- a/src/gallium/drivers/softpipe/sp_fs_exec.c +++ b/src/gallium/drivers/softpipe/sp_fs_exec.c @@ -126,7 +126,39 @@ exec_run( const struct sp_fragment_shader *base, (float)quad->input.x0, (float)quad->input.y0, &machine->QuadPos); - return tgsi_exec_machine_run( machine ); + quad->inout.mask &= tgsi_exec_machine_run( machine ); + if (quad->inout.mask == 0) + return FALSE; + + /* store outputs */ + { + const ubyte *sem_name = base->info.output_semantic_name; + const ubyte *sem_index = base->info.output_semantic_index; + const uint n = base->info.num_outputs; + uint i; + for (i = 0; i < n; i++) { + switch (sem_name[i]) { + case TGSI_SEMANTIC_COLOR: + { + uint cbuf = sem_index[i]; + memcpy(quad->output.color[cbuf], + &machine->Outputs[i].xyzw[0].f[0], + sizeof(quad->output.color[0]) ); + } + break; + case TGSI_SEMANTIC_POSITION: + { + uint j; + for (j = 0; j < 4; j++) { + quad->output.depth[j] = machine->Outputs[0].xyzw[2].f[j]; + } + } + break; + } + } + } + + return TRUE; } diff --git a/src/gallium/drivers/softpipe/sp_fs_sse.c b/src/gallium/drivers/softpipe/sp_fs_sse.c index f4fa0905d7..364bb94a5f 100644 --- a/src/gallium/drivers/softpipe/sp_fs_sse.c +++ b/src/gallium/drivers/softpipe/sp_fs_sse.c @@ -104,7 +104,40 @@ fs_sse_run( const struct sp_fragment_shader *base, // , &machine->QuadPos ); - return ~(machine->Temps[TGSI_EXEC_TEMP_KILMASK_I].xyzw[TGSI_EXEC_TEMP_KILMASK_C].u[0]); + quad->inout.mask &= ~(machine->Temps[TGSI_EXEC_TEMP_KILMASK_I].xyzw[TGSI_EXEC_TEMP_KILMASK_C].u[0]); + if (quad->inout.mask == 0) + return FALSE; + + + /* store outputs */ + { + const ubyte *sem_name = shader->base.info.output_semantic_name; + const ubyte *sem_index = shader->base.info.output_semantic_index; + const uint n = shader->base.info.num_outputs; + uint i; + for (i = 0; i < n; i++) { + switch (sem_name[i]) { + case TGSI_SEMANTIC_COLOR: + { + uint cbuf = sem_index[i]; + memcpy(quad->output.color[cbuf], + &machine->Outputs[i].xyzw[0].f[0], + sizeof(quad->output.color[0]) ); + } + break; + case TGSI_SEMANTIC_POSITION: + { + uint j; + for (j = 0; j < 4; j++) { + quad->output.depth[j] = machine->Outputs[0].xyzw[2].f[j]; + } + } + break; + } + } + } + + return TRUE; } diff --git a/src/gallium/drivers/softpipe/sp_quad_fs.c b/src/gallium/drivers/softpipe/sp_quad_fs.c index e1bc0712de..1e7533d0f9 100644 --- a/src/gallium/drivers/softpipe/sp_quad_fs.c +++ b/src/gallium/drivers/softpipe/sp_quad_fs.c @@ -68,7 +68,7 @@ quad_shade_stage(struct quad_stage *qs) /** * Execute fragment shader for the four fragments in the quad. */ -static boolean +static INLINE boolean shade_quad(struct quad_stage *qs, struct quad_header *quad) { struct quad_shade_stage *qss = quad_shade_stage( qs ); @@ -76,39 +76,7 @@ shade_quad(struct quad_stage *qs, struct quad_header *quad) struct tgsi_exec_machine *machine = qss->machine; /* run shader */ - quad->inout.mask &= softpipe->fs->run( softpipe->fs, machine, quad ); - if (quad->inout.mask == 0) - return FALSE; - - /* store outputs */ - { - const ubyte *sem_name = softpipe->fs->info.output_semantic_name; - const ubyte *sem_index = softpipe->fs->info.output_semantic_index; - const uint n = qss->stage.softpipe->fs->info.num_outputs; - uint i; - for (i = 0; i < n; i++) { - switch (sem_name[i]) { - case TGSI_SEMANTIC_COLOR: - { - uint cbuf = sem_index[i]; - memcpy(quad->output.color[cbuf], - &machine->Outputs[i].xyzw[0].f[0], - sizeof(quad->output.color[0]) ); - } - break; - case TGSI_SEMANTIC_POSITION: - { - uint j; - for (j = 0; j < 4; j++) { - quad->output.depth[j] = machine->Outputs[0].xyzw[2].f[j]; - } - } - break; - } - } - } - - return TRUE; + return softpipe->fs->run( softpipe->fs, machine, quad ); } -- cgit v1.2.3 From b5c389721aec09c260789e6371910937f15ef1a0 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 11 Aug 2009 18:03:01 +0100 Subject: softpipe: remove gallivm fragment shaders However we do llvm integration, it will be different & more comprehensive than this. --- src/gallium/drivers/softpipe/Makefile | 1 - src/gallium/drivers/softpipe/sp_fs_llvm.c | 205 ----------------------------- src/gallium/drivers/softpipe/sp_state_fs.c | 7 +- 3 files changed, 2 insertions(+), 211 deletions(-) delete mode 100644 src/gallium/drivers/softpipe/sp_fs_llvm.c (limited to 'src') diff --git a/src/gallium/drivers/softpipe/Makefile b/src/gallium/drivers/softpipe/Makefile index 48522abe98..a6ed7ea6a2 100644 --- a/src/gallium/drivers/softpipe/Makefile +++ b/src/gallium/drivers/softpipe/Makefile @@ -6,7 +6,6 @@ LIBNAME = softpipe C_SOURCES = \ sp_fs_exec.c \ sp_fs_sse.c \ - sp_fs_llvm.c \ sp_clear.c \ sp_flush.c \ sp_query.c \ diff --git a/src/gallium/drivers/softpipe/sp_fs_llvm.c b/src/gallium/drivers/softpipe/sp_fs_llvm.c deleted file mode 100644 index 95c0d982d1..0000000000 --- a/src/gallium/drivers/softpipe/sp_fs_llvm.c +++ /dev/null @@ -1,205 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * 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. - * - **************************************************************************/ - -/** - * Execute fragment shader using LLVM code generation. - * Authors: - * Zack Rusin - */ - -#include "sp_context.h" -#include "sp_state.h" -#include "sp_fs.h" - -#include "pipe/p_state.h" -#include "pipe/p_defines.h" -#include "util/u_memory.h" -#include "tgsi/tgsi_sse2.h" - -#if 0 - -/** - * 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) -{ - struct quad_shade_stage *qss = quad_shade_stage(qs); - struct softpipe_context *softpipe = qs->softpipe; - float dests[4][16][4] ALIGN16_ATTRIB; - float inputs[4][16][4] ALIGN16_ATTRIB; - const float fx = (float) quad->x0; - const float fy = (float) quad->y0; - struct gallivm_prog *llvm = qss->llvm_prog; - - inputs[0][0][0] = fx; - inputs[1][0][0] = fx + 1.0f; - inputs[2][0][0] = fx; - inputs[3][0][0] = fx + 1.0f; - - inputs[0][0][1] = fy; - inputs[1][0][1] = fy; - inputs[2][0][1] = fy + 1.0f; - inputs[3][0][1] = fy + 1.0f; - - - gallivm_prog_inputs_interpolate(llvm, inputs, quad->coef); - -#if DLLVM - debug_printf("MASK = %d\n", quad->mask); - for (int i = 0; i < 4; ++i) { - for (int j = 0; j < 2; ++j) { - debug_printf("IN(%d,%d) [%f %f %f %f]\n", i, j, - inputs[i][j][0], inputs[i][j][1], inputs[i][j][2], inputs[i][j][3]); - } - } -#endif - - quad->mask &= - gallivm_fragment_shader_exec(llvm, fx, fy, dests, inputs, - softpipe->mapped_constants[PIPE_SHADER_FRAGMENT], - qss->samplers); -#if DLLVM - debug_printf("OUT LLVM = 1[%f %f %f %f], 2[%f %f %f %f]\n", - dests[0][0][0], dests[0][0][1], dests[0][0][2], dests[0][0][3], - dests[0][1][0], dests[0][1][1], dests[0][1][2], dests[0][1][3]); -#endif - - /* store result color */ - if (qss->colorOutSlot >= 0) { - unsigned i; - /* XXX need to handle multiple color outputs someday */ - allvmrt(qss->stage.softpipe->fs->info.output_semantic_name[qss->colorOutSlot] - == TGSI_SEMANTIC_COLOR); - for (i = 0; i < QUAD_SIZE; ++i) { - quad->outputs.color[0][0][i] = dests[i][qss->colorOutSlot][0]; - quad->outputs.color[0][1][i] = dests[i][qss->colorOutSlot][1]; - quad->outputs.color[0][2][i] = dests[i][qss->colorOutSlot][2]; - quad->outputs.color[0][3][i] = dests[i][qss->colorOutSlot][3]; - } - } -#if DLLVM - for (int i = 0; i < QUAD_SIZE; ++i) { - debug_printf("QLLVM%d(%d) [%f, %f, %f, %f]\n", i, qss->colorOutSlot, - quad->outputs.color[0][0][i], - quad->outputs.color[0][1][i], - quad->outputs.color[0][2][i], - quad->outputs.color[0][3][i]); - } -#endif - - /* store result Z */ - if (qss->depthOutSlot >= 0) { - /* output[slot] is new Z */ - uint i; - for (i = 0; i < 4; i++) { - quad->outputs.depth[i] = dests[i][0][2]; - } - } - else { - /* copy input Z (which was interpolated by the executor) to output Z */ - uint i; - for (i = 0; i < 4; i++) { - quad->outputs.depth[i] = inputs[i][0][2]; - } - } -#if DLLVM - debug_printf("D [%f, %f, %f, %f] mask = %d\n", - quad->outputs.depth[0], - quad->outputs.depth[1], - quad->outputs.depth[2], - quad->outputs.depth[3], quad->mask); -#endif - - /* shader may cull fragments */ - if( quad->mask ) { - qs->next->run( qs->next, quad ); - } -} - - -unsigned -run_llvm_fs( const struct sp_fragment_shader *base, - struct foo *machine ) -{ -} - - -void -delete_llvm_fs( struct sp_fragment_shader *base ) -{ - FREE(base); -} - - -struct sp_fragment_shader * -softpipe_create_fs_llvm(struct softpipe_context *softpipe, - const struct pipe_shader_state *templ) -{ - struct sp_llvm_fragment_shader *shader = NULL; - - /* LLVM fragment shaders currently disabled: - */ - state = CALLOC_STRUCT(sp_llvm_shader_state); - if (!state) - return NULL; - - state->llvm_prog = 0; - - if (!gallivm_global_cpu_engine()) { - gallivm_cpu_engine_create(state->llvm_prog); - } - else - gallivm_cpu_jit_compile(gallivm_global_cpu_engine(), state->llvm_prog); - - if (shader) { - shader->base.run = run_llvm_fs; - shader->base.delete = delete_llvm_fs; - } - - return shader; -} - - -#else - -struct sp_fragment_shader * -softpipe_create_fs_llvm(struct softpipe_context *softpipe, - const struct pipe_shader_state *templ) -{ - return NULL; -} - -#endif diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c index 4330c20393..108ac8b9bb 100644 --- a/src/gallium/drivers/softpipe/sp_state_fs.c +++ b/src/gallium/drivers/softpipe/sp_state_fs.c @@ -51,12 +51,9 @@ softpipe_create_fs_state(struct pipe_context *pipe, tgsi_dump(templ->tokens, 0); /* codegen */ - state = softpipe_create_fs_llvm( softpipe, templ ); + state = softpipe_create_fs_sse( softpipe, templ ); if (!state) { - state = softpipe_create_fs_sse( softpipe, templ ); - if (!state) { - state = softpipe_create_fs_exec( softpipe, templ ); - } + state = softpipe_create_fs_exec( softpipe, templ ); } assert(state); -- cgit v1.2.3 From da319095f2ca8869657ebda0db54eb9b2f7393ce Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 11 Aug 2009 18:06:16 +0100 Subject: softpipe: reduce textual differences between exec and sse shader paths Unshare one function (setup_pos_vector) as we want to push this code into the generated shader in the SSE case. --- src/gallium/drivers/softpipe/sp_fs_exec.c | 51 ++++++++++++++++--------------- src/gallium/drivers/softpipe/sp_fs_sse.c | 50 +++++++++++++++++++++++++----- 2 files changed, 69 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_fs_exec.c b/src/gallium/drivers/softpipe/sp_fs_exec.c index 91e04687c5..c469ac6340 100644 --- a/src/gallium/drivers/softpipe/sp_fs_exec.c +++ b/src/gallium/drivers/softpipe/sp_fs_exec.c @@ -59,15 +59,34 @@ sp_exec_fragment_shader(const struct sp_fragment_shader *base) } +static void +exec_prepare( const struct sp_fragment_shader *base, + struct tgsi_exec_machine *machine, + struct tgsi_sampler **samplers ) +{ + /* + * Bind tokens/shader to the interpreter's machine state. + * Avoid redundant binding. + */ + if (machine->Tokens != base->shader.tokens) { + tgsi_exec_machine_bind_shader( machine, + base->shader.tokens, + PIPE_MAX_SAMPLERS, + samplers ); + } +} + + + /** * Compute quad X,Y,Z,W for the four fragments in a quad. * * This should really be part of the compiled shader. */ -void -sp_setup_pos_vector(const struct tgsi_interp_coef *coef, - float x, float y, - struct tgsi_exec_vector *quadpos) +static void +setup_pos_vector(const struct tgsi_interp_coef *coef, + float x, float y, + struct tgsi_exec_vector *quadpos) { uint chan; /* do X */ @@ -95,24 +114,6 @@ sp_setup_pos_vector(const struct tgsi_interp_coef *coef, } -static void -exec_prepare( const struct sp_fragment_shader *base, - struct tgsi_exec_machine *machine, - struct tgsi_sampler **samplers ) -{ - /* - * Bind tokens/shader to the interpreter's machine state. - * Avoid redundant binding. - */ - if (machine->Tokens != base->shader.tokens) { - tgsi_exec_machine_bind_shader( machine, - base->shader.tokens, - PIPE_MAX_SAMPLERS, - samplers ); - } -} - - /* TODO: hide the machine struct in here somewhere, remove from this * interface: */ @@ -122,9 +123,9 @@ exec_run( const struct sp_fragment_shader *base, 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, - &machine->QuadPos); + setup_pos_vector(quad->posCoef, + (float)quad->input.x0, (float)quad->input.y0, + &machine->QuadPos); quad->inout.mask &= tgsi_exec_machine_run( machine ); if (quad->inout.mask == 0) diff --git a/src/gallium/drivers/softpipe/sp_fs_sse.c b/src/gallium/drivers/softpipe/sp_fs_sse.c index 364bb94a5f..9d3e4670ee 100644 --- a/src/gallium/drivers/softpipe/sp_fs_sse.c +++ b/src/gallium/drivers/softpipe/sp_fs_sse.c @@ -76,6 +76,43 @@ fs_sse_prepare( const struct sp_fragment_shader *base, } + +/** + * Compute quad X,Y,Z,W for the four fragments in a quad. + * + * This should really be part of the compiled shader. + */ +static void +setup_pos_vector(const struct tgsi_interp_coef *coef, + float x, float y, + struct tgsi_exec_vector *quadpos) +{ + uint chan; + /* do X */ + quadpos->xyzw[0].f[0] = x; + quadpos->xyzw[0].f[1] = x + 1; + quadpos->xyzw[0].f[2] = x; + quadpos->xyzw[0].f[3] = x + 1; + + /* do Y */ + quadpos->xyzw[1].f[0] = y; + quadpos->xyzw[1].f[1] = y; + quadpos->xyzw[1].f[2] = y + 1; + quadpos->xyzw[1].f[3] = y + 1; + + /* do Z and W for all fragments in the quad */ + for (chan = 2; chan < 4; chan++) { + const float dadx = coef->dadx[chan]; + const float dady = coef->dady[chan]; + const float a0 = coef->a0[chan] + dadx * x + dady * y; + quadpos->xyzw[chan].f[0] = a0; + quadpos->xyzw[chan].f[1] = a0 + dadx; + quadpos->xyzw[chan].f[2] = a0 + dady; + quadpos->xyzw[chan].f[3] = a0 + dadx + dady; + } +} + + /* TODO: codegenerate the whole run function, skip this wrapper. * TODO: break dependency on tgsi_exec_machine struct * TODO: push Position calculation into the generated shader @@ -89,9 +126,9 @@ fs_sse_run( const struct sp_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, - (float)quad->input.x0, (float)quad->input.y0, - machine->Temps); + setup_pos_vector(quad->posCoef, + (float)quad->input.x0, (float)quad->input.y0, + machine->Temps); /* init kill mask */ tgsi_set_kill_mask(machine, 0x0); @@ -108,12 +145,11 @@ fs_sse_run( const struct sp_fragment_shader *base, if (quad->inout.mask == 0) return FALSE; - /* store outputs */ { - const ubyte *sem_name = shader->base.info.output_semantic_name; - const ubyte *sem_index = shader->base.info.output_semantic_index; - const uint n = shader->base.info.num_outputs; + const ubyte *sem_name = base->info.output_semantic_name; + const ubyte *sem_index = base->info.output_semantic_index; + const uint n = base->info.num_outputs; uint i; for (i = 0; i < n; i++) { switch (sem_name[i]) { -- cgit v1.2.3 From 99ec78d9462d2a553982d0ea15d538b36b1c123b Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 11 Aug 2009 18:23:28 +0100 Subject: Revert "softpipe: rearrange blend fastpaths" This reverts commit 1295cf423e21dad04a947960782ffa8db2739709. The original formulation was easier to understand & work with. Will revisit this later. --- src/gallium/drivers/softpipe/sp_quad_blend.c | 82 +++++++++++++++++++--------- 1 file changed, 55 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c index b8ed086734..e243c63fa2 100644 --- a/src/gallium/drivers/softpipe/sp_quad_blend.c +++ b/src/gallium/drivers/softpipe/sp_quad_blend.c @@ -793,7 +793,10 @@ blend_single_add_src_alpha_inv_src_alpha(struct quad_stage *qs, struct quad_header *quads[], unsigned nr) { - float source[4]; + static const float one[4] = { 1, 1, 1, 1 }; + float one_minus_alpha[QUAD_SIZE]; + float dest[4][QUAD_SIZE]; + float source[4][QUAD_SIZE]; uint i, j, q; struct softpipe_cached_tile *tile @@ -803,26 +806,45 @@ blend_single_add_src_alpha_inv_src_alpha(struct quad_stage *qs, for (q = 0; q < nr; q++) { struct quad_header *quad = quads[q]; + float (*quadColor)[4] = quad->output.color[0]; + const float *alpha = quadColor[3]; const int itx = (quad->input.x0 & (TILE_SIZE-1)); const int ity = (quad->input.y0 & (TILE_SIZE-1)); - float (*swzColor)[4] = quad->output.color[0]; - for (j = 0; j < 4; j++) { - if (quad->inout.mask & (1<data.color[ity + (j>>1)][itx + (j&1)]; - const float alpha = swzColor[3][j]; - const float one_minus_alpha = 1.0 - alpha; + /* get/swizzle dest colors */ + for (j = 0; j < QUAD_SIZE; j++) { + int x = itx + (j & 1); + int y = ity + (j >> 1); + for (i = 0; i < 4; i++) { + dest[i][j] = tile->data.color[y][x][i]; + } + } - for (i = 0; i < 4; i++) { - dest[i] *= one_minus_alpha; - dest[i] += swzColor[i][j] * alpha; + VEC4_MUL(source[0], quadColor[0], alpha); /* R */ + VEC4_MUL(source[1], quadColor[1], alpha); /* G */ + VEC4_MUL(source[2], quadColor[2], alpha); /* B */ + VEC4_MUL(source[3], quadColor[3], alpha); /* A */ + + VEC4_SUB(one_minus_alpha, one, alpha); + VEC4_MUL(dest[0], dest[0], one_minus_alpha); /* R */ + VEC4_MUL(dest[1], dest[1], one_minus_alpha); /* G */ + VEC4_MUL(dest[2], dest[2], one_minus_alpha); /* B */ + VEC4_MUL(dest[3], dest[3], one_minus_alpha); /* B */ + + VEC4_ADD_SAT(quadColor[0], source[0], dest[0]); /* R */ + VEC4_ADD_SAT(quadColor[1], source[1], dest[1]); /* G */ + VEC4_ADD_SAT(quadColor[2], source[2], dest[2]); /* B */ + VEC4_ADD_SAT(quadColor[3], source[3], dest[3]); /* A */ - /* XXX: redundant, will be clamped later for argb8 surfaces: - */ - dest[i] = CLAMP(dest[i], 0.0, 1.0); + for (j = 0; j < QUAD_SIZE; j++) { + if (quad->inout.mask & (1 << j)) { + int x = itx + (j & 1); + int y = ity + (j >> 1); + for (i = 0; i < 4; i++) { /* loop over color chans */ + tile->data.color[y][x][i] = quadColor[i][j]; } } - } + } } } @@ -841,27 +863,33 @@ blend_single_add_one_one(struct quad_stage *qs, for (q = 0; q < nr; q++) { struct quad_header *quad = quads[q]; + float (*quadColor)[4] = quad->output.color[0]; const int itx = (quad->input.x0 & (TILE_SIZE-1)); const int ity = (quad->input.y0 & (TILE_SIZE-1)); - float (*dest)[64][4] = (float (*)[64][4])&tile->data.color[ity][itx]; - float (*swzColor)[4] = quad->output.color[0]; - float quadColor[4][4]; - + /* get/swizzle dest colors */ for (j = 0; j < QUAD_SIZE; j++) { + int x = itx + (j & 1); + int y = ity + (j >> 1); for (i = 0; i < 4; i++) { - quadColor[i][j] = swzColor[j][i]; + dest[i][j] = tile->data.color[y][x][i]; } } - if (quad->inout.mask & 1) - VEC4_ADD_SAT(dest[0][0], quadColor[0], dest[0][0]); - if (quad->inout.mask & 2) - VEC4_ADD_SAT(dest[0][1], quadColor[1], dest[0][1]); - if (quad->inout.mask & 4) - VEC4_ADD_SAT(dest[1][0], quadColor[2], dest[1][0]); - if (quad->inout.mask & 8) - VEC4_ADD_SAT(dest[1][1], quadColor[3], dest[1][1]); + VEC4_ADD_SAT(quadColor[0], quadColor[0], dest[0]); /* R */ + VEC4_ADD_SAT(quadColor[1], quadColor[1], dest[1]); /* G */ + VEC4_ADD_SAT(quadColor[2], quadColor[2], dest[2]); /* B */ + VEC4_ADD_SAT(quadColor[3], quadColor[3], dest[3]); /* A */ + + for (j = 0; j < QUAD_SIZE; j++) { + if (quad->inout.mask & (1 << j)) { + int x = itx + (j & 1); + int y = ity + (j >> 1); + for (i = 0; i < 4; i++) { /* loop over color chans */ + tile->data.color[y][x][i] = quadColor[i][j]; + } + } + } } } -- cgit v1.2.3 From d12bae9368e0c44a9943d9b37ab848ea307d70c7 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 18 Aug 2009 16:21:12 +0100 Subject: softpipe: move flatshade-first check out of loop --- src/gallium/drivers/softpipe/sp_prim_vbuf.c | 80 ++++++++++++++++++----------- 1 file changed, 50 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c index 1dd63d99ff..76524a8d41 100644 --- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c +++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c @@ -239,14 +239,16 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) break; case PIPE_PRIM_TRIANGLES: - for (i = 2; i < nr; i += 3) { - if (softpipe->rasterizer->flatshade_first) { + if (softpipe->rasterizer->flatshade_first) { + for (i = 2; i < nr; i += 3) { setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i-1], stride), get_vert(vertex_buffer, indices[i-0], stride), get_vert(vertex_buffer, indices[i-2], stride) ); } - else { + } + else { + for (i = 2; i < nr; i += 3) { setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i-2], stride), get_vert(vertex_buffer, indices[i-1], stride), @@ -256,14 +258,16 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) break; case PIPE_PRIM_TRIANGLE_STRIP: - for (i = 2; i < nr; i += 1) { - if (softpipe->rasterizer->flatshade_first) { + if (softpipe->rasterizer->flatshade_first) { + for (i = 2; i < nr; i += 1) { setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i+(i&1)-1], stride), get_vert(vertex_buffer, indices[i-(i&1)], stride), get_vert(vertex_buffer, indices[i-2], stride) ); } - else { + } + else { + for (i = 2; i < nr; i += 1) { setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i+(i&1)-2], stride), get_vert(vertex_buffer, indices[i-(i&1)-1], stride), @@ -273,14 +277,16 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) break; case PIPE_PRIM_TRIANGLE_FAN: - for (i = 2; i < nr; i += 1) { - if (softpipe->rasterizer->flatshade_first) { + if (softpipe->rasterizer->flatshade_first) { + for (i = 2; i < nr; i += 1) { setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i-0], stride), get_vert(vertex_buffer, indices[0], stride), get_vert(vertex_buffer, indices[i-1], stride) ); } - else { + } + else { + for (i = 2; i < nr; i += 1) { setup_tri( setup_ctx, get_vert(vertex_buffer, indices[0], stride), get_vert(vertex_buffer, indices[i-1], stride), @@ -290,8 +296,8 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) break; case PIPE_PRIM_QUADS: - for (i = 3; i < nr; i += 4) { - if (softpipe->rasterizer->flatshade_first) { + if (softpipe->rasterizer->flatshade_first) { + for (i = 3; i < nr; i += 4) { setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i-2], stride), get_vert(vertex_buffer, indices[i-1], stride), @@ -301,7 +307,9 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) get_vert(vertex_buffer, indices[i-0], stride), get_vert(vertex_buffer, indices[i-3], stride) ); } - else { + } + else { + for (i = 3; i < nr; i += 4) { setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i-3], stride), get_vert(vertex_buffer, indices[i-2], stride), @@ -316,8 +324,8 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) break; case PIPE_PRIM_QUAD_STRIP: - for (i = 3; i < nr; i += 2) { - if (softpipe->rasterizer->flatshade_first) { + if (softpipe->rasterizer->flatshade_first) { + for (i = 3; i < nr; i += 2) { setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i-0], stride), get_vert(vertex_buffer, indices[i-1], stride), @@ -327,7 +335,9 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) get_vert(vertex_buffer, indices[i-0], stride), get_vert(vertex_buffer, indices[i-3], stride) ); } - else { + } + else { + for (i = 3; i < nr; i += 2) { setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i-3], stride), get_vert(vertex_buffer, indices[i-2], stride), @@ -423,14 +433,16 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) break; case PIPE_PRIM_TRIANGLES: - for (i = 2; i < nr; i += 3) { - if (softpipe->rasterizer->flatshade_first) { + if (softpipe->rasterizer->flatshade_first) { + for (i = 2; i < nr; i += 3) { setup_tri( setup_ctx, get_vert(vertex_buffer, i-1, stride), get_vert(vertex_buffer, i-0, stride), get_vert(vertex_buffer, i-2, stride) ); } - else { + } + else { + for (i = 2; i < nr; i += 3) { setup_tri( setup_ctx, get_vert(vertex_buffer, i-2, stride), get_vert(vertex_buffer, i-1, stride), @@ -440,14 +452,16 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) break; case PIPE_PRIM_TRIANGLE_STRIP: - for (i = 2; i < nr; i++) { - if (softpipe->rasterizer->flatshade_first) { + if (softpipe->rasterizer->flatshade_first) { + for (i = 2; i < nr; i++) { setup_tri( setup_ctx, get_vert(vertex_buffer, i+(i&1)-1, stride), get_vert(vertex_buffer, i-(i&1), stride), get_vert(vertex_buffer, i-2, stride) ); } - else { + } + else { + for (i = 2; i < nr; i++) { setup_tri( setup_ctx, get_vert(vertex_buffer, i+(i&1)-2, stride), get_vert(vertex_buffer, i-(i&1)-1, stride), @@ -457,14 +471,16 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) break; case PIPE_PRIM_TRIANGLE_FAN: - for (i = 2; i < nr; i += 1) { - if (softpipe->rasterizer->flatshade_first) { + if (softpipe->rasterizer->flatshade_first) { + for (i = 2; i < nr; i += 1) { setup_tri( setup_ctx, get_vert(vertex_buffer, i-0, stride), get_vert(vertex_buffer, 0, stride), get_vert(vertex_buffer, i-1, stride) ); } - else { + } + else { + for (i = 2; i < nr; i += 1) { setup_tri( setup_ctx, get_vert(vertex_buffer, 0, stride), get_vert(vertex_buffer, i-1, stride), @@ -474,8 +490,8 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) break; case PIPE_PRIM_QUADS: - for (i = 3; i < nr; i += 4) { - if (softpipe->rasterizer->flatshade_first) { + if (softpipe->rasterizer->flatshade_first) { + for (i = 3; i < nr; i += 4) { setup_tri( setup_ctx, get_vert(vertex_buffer, i-2, stride), get_vert(vertex_buffer, i-1, stride), @@ -485,7 +501,9 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) get_vert(vertex_buffer, i-0, stride), get_vert(vertex_buffer, i-3, stride) ); } - else { + } + else { + for (i = 3; i < nr; i += 4) { setup_tri( setup_ctx, get_vert(vertex_buffer, i-3, stride), get_vert(vertex_buffer, i-2, stride), @@ -499,8 +517,8 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) break; case PIPE_PRIM_QUAD_STRIP: - for (i = 3; i < nr; i += 2) { - if (softpipe->rasterizer->flatshade_first) { + if (softpipe->rasterizer->flatshade_first) { + for (i = 3; i < nr; i += 2) { setup_tri( setup_ctx, get_vert(vertex_buffer, i-0, stride), get_vert(vertex_buffer, i-1, stride), @@ -510,7 +528,9 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) get_vert(vertex_buffer, i-0, stride), get_vert(vertex_buffer, i-3, stride) ); } - else { + } + else { + for (i = 3; i < nr; i += 2) { setup_tri( setup_ctx, get_vert(vertex_buffer, i-3, stride), get_vert(vertex_buffer, i-2, stride), -- cgit v1.2.3 From 80c78472ad43f4288c9ef5076074ba9d31a39885 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 29 Jul 2009 07:40:50 +0100 Subject: softpipe: split texture and surface tile caches These do similar jobs but with largely disjoint code. Will want to evolve them separately going forward. --- src/gallium/drivers/softpipe/Makefile | 1 + src/gallium/drivers/softpipe/SConscript | 1 + src/gallium/drivers/softpipe/sp_context.c | 4 +- src/gallium/drivers/softpipe/sp_context.h | 3 +- src/gallium/drivers/softpipe/sp_flush.c | 3 +- src/gallium/drivers/softpipe/sp_state_derived.c | 2 +- src/gallium/drivers/softpipe/sp_state_sampler.c | 4 +- src/gallium/drivers/softpipe/sp_tex_sample.c | 16 +- src/gallium/drivers/softpipe/sp_tex_sample.h | 2 +- src/gallium/drivers/softpipe/sp_tex_tile_cache.c | 274 +++++++++++++++++++++++ src/gallium/drivers/softpipe/sp_tex_tile_cache.h | 161 +++++++++++++ src/gallium/drivers/softpipe/sp_tile_cache.c | 171 +------------- src/gallium/drivers/softpipe/sp_tile_cache.h | 42 +--- 13 files changed, 460 insertions(+), 224 deletions(-) create mode 100644 src/gallium/drivers/softpipe/sp_tex_tile_cache.c create mode 100644 src/gallium/drivers/softpipe/sp_tex_tile_cache.h (limited to 'src') diff --git a/src/gallium/drivers/softpipe/Makefile b/src/gallium/drivers/softpipe/Makefile index a6ed7ea6a2..3da9be6957 100644 --- a/src/gallium/drivers/softpipe/Makefile +++ b/src/gallium/drivers/softpipe/Makefile @@ -30,6 +30,7 @@ C_SOURCES = \ sp_state_vertex.c \ sp_texture.c \ sp_tex_sample.c \ + sp_tex_tile_cache.c \ sp_tile_cache.c \ sp_surface.c diff --git a/src/gallium/drivers/softpipe/SConscript b/src/gallium/drivers/softpipe/SConscript index dcc25732ba..30c099813e 100644 --- a/src/gallium/drivers/softpipe/SConscript +++ b/src/gallium/drivers/softpipe/SConscript @@ -37,6 +37,7 @@ softpipe = env.ConvenienceLibrary( 'sp_state_vertex.c', 'sp_surface.c', 'sp_tex_sample.c', + 'sp_tex_tile_cache.c', 'sp_texture.c', 'sp_tile_cache.c', ]) diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index e35c6b3aec..396d4c6557 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -97,7 +97,7 @@ static void softpipe_destroy( struct pipe_context *pipe ) sp_destroy_tile_cache(softpipe->zsbuf_cache); for (i = 0; i < PIPE_MAX_SAMPLERS; i++) - sp_destroy_tile_cache(softpipe->tex_cache[i]); + sp_destroy_tex_tile_cache(softpipe->tex_cache[i]); for (i = 0; i < Elements(softpipe->constants); i++) { if (softpipe->constants[i].buffer) { @@ -220,7 +220,7 @@ softpipe_create( struct pipe_screen *screen ) softpipe->zsbuf_cache = sp_create_tile_cache( screen ); for (i = 0; i < PIPE_MAX_SAMPLERS; i++) - softpipe->tex_cache[i] = sp_create_tile_cache( screen ); + softpipe->tex_cache[i] = sp_create_tex_tile_cache( screen ); /* setup quad rendering stages */ diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index fa3306c020..683c3aef9b 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -43,6 +43,7 @@ struct softpipe_vbuf_render; struct draw_context; struct draw_stage; struct softpipe_tile_cache; +struct softpipe_tex_tile_cache; struct sp_fragment_shader; struct sp_vertex_shader; @@ -141,7 +142,7 @@ struct softpipe_context { struct softpipe_tile_cache *zsbuf_cache; unsigned tex_timestamp; - struct softpipe_tile_cache *tex_cache[PIPE_MAX_SAMPLERS]; + struct softpipe_tex_tile_cache *tex_cache[PIPE_MAX_SAMPLERS]; unsigned use_sse : 1; unsigned dump_fs : 1; diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c index 679ad0cd3d..e38b767cf2 100644 --- a/src/gallium/drivers/softpipe/sp_flush.c +++ b/src/gallium/drivers/softpipe/sp_flush.c @@ -37,6 +37,7 @@ #include "sp_surface.h" #include "sp_state.h" #include "sp_tile_cache.h" +#include "sp_tex_tile_cache.h" #include "sp_winsys.h" @@ -52,7 +53,7 @@ softpipe_flush( struct pipe_context *pipe, if (flags & PIPE_FLUSH_TEXTURE_CACHE) { for (i = 0; i < softpipe->num_textures; i++) { - sp_flush_tile_cache(softpipe->tex_cache[i]); + sp_flush_tex_tile_cache(softpipe->tex_cache[i]); } } diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index 3ed1de7e17..88a6e4fbdf 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -212,7 +212,7 @@ update_tgsi_samplers( struct softpipe_context *softpipe ) } for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { - sp_tile_cache_validate_texture( softpipe->tex_cache[i] ); + sp_tex_tile_cache_validate_texture( softpipe->tex_cache[i] ); } } diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index aa2f3f2ccd..a725925264 100644 --- a/src/gallium/drivers/softpipe/sp_state_sampler.c +++ b/src/gallium/drivers/softpipe/sp_state_sampler.c @@ -37,7 +37,7 @@ #include "sp_context.h" #include "sp_state.h" #include "sp_texture.h" -#include "sp_tile_cache.h" +#include "sp_tex_tile_cache.h" #include "draw/draw_context.h" @@ -97,7 +97,7 @@ softpipe_set_sampler_textures(struct pipe_context *pipe, struct pipe_texture *tex = i < num ? texture[i] : NULL; pipe_texture_reference(&softpipe->texture[i], tex); - sp_tile_cache_set_texture(softpipe->tex_cache[i], tex); + sp_tex_tile_cache_set_texture(softpipe->tex_cache[i], tex); } softpipe->num_textures = num; diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 4651d781a9..8bed573e8c 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -38,7 +38,7 @@ #include "sp_surface.h" #include "sp_texture.h" #include "sp_tex_sample.h" -#include "sp_tile_cache.h" +#include "sp_tex_tile_cache.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "util/u_math.h" @@ -659,7 +659,7 @@ choose_mipmap_levels(const struct pipe_texture *texture, * \param rgba the quad to put the texel/color into * \param j which element of the rgba quad to write to * - * XXX maybe move this into sp_tile_cache.c and merge with the + * XXX maybe move this into sp_tex_tile_cache.c and merge with the * sp_get_cached_tile_tex() function. Also, get 4 texels instead of 1... */ static void @@ -669,9 +669,9 @@ get_texel_quad_2d(const struct tgsi_sampler *tgsi_sampler, { const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); - const struct softpipe_cached_tile *tile + const struct softpipe_tex_cached_tile *tile = sp_get_cached_tile_tex(samp->cache, - tile_address(x, y, 0, face, level)); + tex_tile_address(x, y, 0, face, level)); y %= TILE_SIZE; x %= TILE_SIZE; @@ -688,9 +688,9 @@ get_texel_2d_ptr(const struct tgsi_sampler *tgsi_sampler, { const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); - const struct softpipe_cached_tile *tile + const struct softpipe_tex_cached_tile *tile = sp_get_cached_tile_tex(samp->cache, - tile_address(x, y, 0, face, level)); + tex_tile_address(x, y, 0, face, level)); y %= TILE_SIZE; x %= TILE_SIZE; @@ -736,10 +736,10 @@ get_texel(const struct tgsi_sampler *tgsi_sampler, else { const unsigned tx = x % TILE_SIZE; const unsigned ty = y % TILE_SIZE; - const struct softpipe_cached_tile *tile; + const struct softpipe_tex_cached_tile *tile; tile = sp_get_cached_tile_tex(samp->cache, - tile_address(x, y, z, face, level)); + tex_tile_address(x, y, z, face, level)); rgba[0][j] = tile->data.color[ty][tx][0]; rgba[1][j] = tile->data.color[ty][tx][1]; diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.h b/src/gallium/drivers/softpipe/sp_tex_sample.h index 0650c7830b..1756d3a4ee 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.h +++ b/src/gallium/drivers/softpipe/sp_tex_sample.h @@ -48,7 +48,7 @@ struct sp_shader_sampler const struct pipe_texture *texture; const struct pipe_sampler_state *sampler; - struct softpipe_tile_cache *cache; + struct softpipe_tex_tile_cache *cache; }; diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c new file mode 100644 index 0000000000..c2dd68c7a2 --- /dev/null +++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c @@ -0,0 +1,274 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * 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. + * + **************************************************************************/ + +/** + * Texture tile caching. + * + * Author: + * Brian Paul + */ + +#include "pipe/p_inlines.h" +#include "util/u_memory.h" +#include "util/u_tile.h" +#include "sp_context.h" +#include "sp_surface.h" +#include "sp_texture.h" +#include "sp_tex_tile_cache.h" + + + +struct softpipe_tex_tile_cache * +sp_create_tex_tile_cache( struct pipe_screen *screen ) +{ + struct softpipe_tex_tile_cache *tc; + uint pos; + + tc = CALLOC_STRUCT( softpipe_tex_tile_cache ); + if (tc) { + tc->screen = screen; + for (pos = 0; pos < NUM_ENTRIES; pos++) { + tc->entries[pos].addr.bits.invalid = 1; + } + tc->last_tile = &tc->entries[0]; /* any tile */ + } + return tc; +} + + +void +sp_destroy_tex_tile_cache(struct softpipe_tex_tile_cache *tc) +{ + struct pipe_screen *screen; + uint pos; + + for (pos = 0; pos < NUM_ENTRIES; pos++) { + /*assert(tc->entries[pos].x < 0);*/ + } + if (tc->transfer) { + screen = tc->transfer->texture->screen; + screen->tex_transfer_destroy(tc->transfer); + } + if (tc->tex_trans) { + screen = tc->tex_trans->texture->screen; + screen->tex_transfer_destroy(tc->tex_trans); + } + + FREE( tc ); +} + + + + +void +sp_tex_tile_cache_map_transfers(struct softpipe_tex_tile_cache *tc) +{ + if (tc->tex_trans && !tc->tex_trans_map) + tc->tex_trans_map = tc->screen->transfer_map(tc->screen, tc->tex_trans); +} + + +void +sp_tex_tile_cache_unmap_transfers(struct softpipe_tex_tile_cache *tc) +{ + if (tc->tex_trans_map) { + tc->screen->transfer_unmap(tc->screen, tc->tex_trans); + tc->tex_trans_map = NULL; + } +} + +void +sp_tex_tile_cache_validate_texture(struct softpipe_tex_tile_cache *tc) +{ + if (tc->texture) { + struct softpipe_texture *spt = softpipe_texture(tc->texture); + if (spt->timestamp != tc->timestamp) { + /* texture was modified, invalidate all cached tiles */ + uint i; + _debug_printf("INV %d %d\n", tc->timestamp, spt->timestamp); + for (i = 0; i < NUM_ENTRIES; i++) { + tc->entries[i].addr.bits.invalid = 1; + } + + tc->timestamp = spt->timestamp; + } + } +} + +/** + * Specify the texture to cache. + */ +void +sp_tex_tile_cache_set_texture(struct softpipe_tex_tile_cache *tc, + struct pipe_texture *texture) +{ + uint i; + + assert(!tc->transfer); + + if (tc->texture != texture) { + pipe_texture_reference(&tc->texture, texture); + + if (tc->tex_trans) { + struct pipe_screen *screen = tc->tex_trans->texture->screen; + + if (tc->tex_trans_map) { + screen->transfer_unmap(screen, tc->tex_trans); + tc->tex_trans_map = NULL; + } + + screen->tex_transfer_destroy(tc->tex_trans); + tc->tex_trans = NULL; + } + + /* mark as entries as invalid/empty */ + /* XXX we should try to avoid this when the teximage hasn't changed */ + for (i = 0; i < NUM_ENTRIES; i++) { + tc->entries[i].addr.bits.invalid = 1; + } + + tc->tex_face = -1; /* any invalid value here */ + } +} + + + + +/** + * Flush the tile cache: write all dirty tiles back to the transfer. + * any tiles "flagged" as cleared will be "really" cleared. + */ +void +sp_flush_tex_tile_cache(struct softpipe_tex_tile_cache *tc) +{ + int pos; + + if (tc->texture) { + /* caching a texture, mark all entries as empty */ + for (pos = 0; pos < NUM_ENTRIES; pos++) { + tc->entries[pos].addr.bits.invalid = 1; + } + tc->tex_face = -1; + } + +} + + +/** + * Given the texture face, level, zslice, x and y values, compute + * the cache entry position/index where we'd hope to find the + * cached texture tile. + * This is basically a direct-map cache. + * XXX There's probably lots of ways in which we can improve this. + */ +static INLINE uint +tex_cache_pos( union tex_tile_address addr ) +{ + uint entry = (addr.bits.x + + addr.bits.y * 9 + + addr.bits.z * 3 + + addr.bits.face + + addr.bits.level * 7); + + return entry % NUM_ENTRIES; +} + +/** + * Similar to sp_get_cached_tile() but for textures. + * Tiles are read-only and indexed with more params. + */ +const struct softpipe_tex_cached_tile * +sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc, + union tex_tile_address addr ) +{ + struct pipe_screen *screen = tc->screen; + struct softpipe_tex_cached_tile *tile; + + tile = tc->entries + tex_cache_pos( addr ); + + if (addr.value != tile->addr.value) { + + /* cache miss. Most misses are because we've invaldiated the + * texture cache previously -- most commonly on binding a new + * texture. Currently we effectively flush the cache on texture + * bind. + */ +#if 0 + _debug_printf("miss at %u: x=%d y=%d z=%d face=%d level=%d\n" + " tile %u: x=%d y=%d z=%d face=%d level=%d\n", + pos, x/TILE_SIZE, y/TILE_SIZE, z, face, level, + pos, tile->addr.bits.x, tile->addr.bits.y, tile->z, tile->face, tile->level); +#endif + + /* check if we need to get a new transfer */ + if (!tc->tex_trans || + tc->tex_face != addr.bits.face || + tc->tex_level != addr.bits.level || + tc->tex_z != addr.bits.z) { + /* get new transfer (view into texture) */ + + if (tc->tex_trans) { + if (tc->tex_trans_map) { + tc->screen->transfer_unmap(tc->screen, tc->tex_trans); + tc->tex_trans_map = NULL; + } + + screen->tex_transfer_destroy(tc->tex_trans); + tc->tex_trans = NULL; + } + + tc->tex_trans = + screen->get_tex_transfer(screen, tc->texture, + addr.bits.face, + addr.bits.level, + addr.bits.z, + PIPE_TRANSFER_READ, 0, 0, + tc->texture->width[addr.bits.level], + tc->texture->height[addr.bits.level]); + + tc->tex_trans_map = screen->transfer_map(screen, tc->tex_trans); + + tc->tex_face = addr.bits.face; + tc->tex_level = addr.bits.level; + tc->tex_z = addr.bits.z; + } + + /* get tile from the transfer (view into texture) */ + pipe_get_tile_rgba(tc->tex_trans, + addr.bits.x * TILE_SIZE, + addr.bits.y * TILE_SIZE, + TILE_SIZE, TILE_SIZE, + (float *) tile->data.color); + tile->addr = addr; + } + + tc->last_tile = tile; + return tile; +} + + + diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.h b/src/gallium/drivers/softpipe/sp_tex_tile_cache.h new file mode 100644 index 0000000000..c6003f3550 --- /dev/null +++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.h @@ -0,0 +1,161 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef SP_TEX_TILE_CACHE_H +#define SP_TEX_TILE_CACHE_H + + +#include "pipe/p_compiler.h" + + +struct softpipe_context; +struct softpipe_tex_tile_cache; + + +/** + * Cache tile size (width and height). This needs to be a power of two. + */ +#define TILE_SIZE 64 + + +/* If we need to support > 4096, just expand this to be a 64 bit + * union, or consider tiling in Z as well. + */ +union tex_tile_address { + struct { + unsigned x:6; /* 4096 / TILE_SIZE */ + unsigned y:6; /* 4096 / TILE_SIZE */ + unsigned z:12; /* 4096 -- z not tiled */ + unsigned face:3; + unsigned level:4; + unsigned invalid:1; + } bits; + unsigned value; +}; + + +struct softpipe_tex_cached_tile +{ + union tex_tile_address addr; + union { + float color[TILE_SIZE][TILE_SIZE][4]; + } data; +}; + +#define NUM_ENTRIES 50 + + +/** XXX move these */ +#define MAX_WIDTH 2048 +#define MAX_HEIGHT 2048 + + +struct softpipe_tex_tile_cache +{ + struct pipe_screen *screen; + struct pipe_transfer *transfer; + void *transfer_map; + + struct pipe_texture *texture; /**< if caching a texture */ + unsigned timestamp; + + struct softpipe_tex_cached_tile entries[NUM_ENTRIES]; + + struct pipe_transfer *tex_trans; + void *tex_trans_map; + int tex_face, tex_level, tex_z; + + struct softpipe_tex_cached_tile *last_tile; /**< most recently retrieved tile */ +}; + + +extern struct softpipe_tex_tile_cache * +sp_create_tex_tile_cache( struct pipe_screen *screen ); + +extern void +sp_destroy_tex_tile_cache(struct softpipe_tex_tile_cache *tc); + + +extern void +sp_tex_tile_cache_map_transfers(struct softpipe_tex_tile_cache *tc); + +extern void +sp_tex_tile_cache_unmap_transfers(struct softpipe_tex_tile_cache *tc); + +extern void +sp_tex_tile_cache_set_texture(struct softpipe_tex_tile_cache *tc, + struct pipe_texture *texture); + +void +sp_tex_tile_cache_validate_texture(struct softpipe_tex_tile_cache *tc); + +extern void +sp_flush_tex_tile_cache(struct softpipe_tex_tile_cache *tc); + + + +extern const struct softpipe_tex_cached_tile * +sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc, + union tex_tile_address addr ); + +static INLINE const union tex_tile_address +tex_tile_address( unsigned x, + unsigned y, + unsigned z, + unsigned face, + unsigned level ) +{ + union tex_tile_address addr; + + addr.value = 0; + addr.bits.x = x / TILE_SIZE; + addr.bits.y = y / TILE_SIZE; + addr.bits.z = z; + addr.bits.face = face; + addr.bits.level = level; + + return addr; +} + +/* Quickly retrieve tile if it matches last lookup. + */ +static INLINE const struct softpipe_tex_cached_tile * +sp_get_cached_tile_tex(struct softpipe_tex_tile_cache *tc, + union tex_tile_address addr ) +{ + if (tc->last_tile->addr.value == addr.value) + return tc->last_tile; + + return sp_find_cached_tile_tex( tc, addr ); +} + + + + + +#endif /* SP_TEX_TILE_CACHE_H */ + diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index 77d02fa3e7..2d82badcec 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -26,7 +26,7 @@ **************************************************************************/ /** - * Texture tile caching. + * Render target tile caching. * * Author: * Brian Paul @@ -37,7 +37,6 @@ #include "util/u_tile.h" #include "sp_context.h" #include "sp_surface.h" -#include "sp_texture.h" #include "sp_tile_cache.h" @@ -111,10 +110,6 @@ sp_destroy_tile_cache(struct softpipe_tile_cache *tc) screen = tc->transfer->texture->screen; screen->tex_transfer_destroy(tc->transfer); } - if (tc->tex_trans) { - screen = tc->tex_trans->texture->screen; - screen->tex_transfer_destroy(tc->tex_trans); - } FREE( tc ); } @@ -127,8 +122,6 @@ void sp_tile_cache_set_surface(struct softpipe_tile_cache *tc, struct pipe_surface *ps) { - assert(!tc->texture); - if (tc->transfer) { struct pipe_screen *screen = tc->transfer->texture->screen; @@ -180,9 +173,6 @@ sp_tile_cache_map_transfers(struct softpipe_tile_cache *tc) { if (tc->transfer && !tc->transfer_map) tc->transfer_map = tc->screen->transfer_map(tc->screen, tc->transfer); - - if (tc->tex_trans && !tc->tex_trans_map) - tc->tex_trans_map = tc->screen->transfer_map(tc->screen, tc->tex_trans); } @@ -193,68 +183,8 @@ sp_tile_cache_unmap_transfers(struct softpipe_tile_cache *tc) tc->screen->transfer_unmap(tc->screen, tc->transfer); tc->transfer_map = NULL; } - - if (tc->tex_trans_map) { - tc->screen->transfer_unmap(tc->screen, tc->tex_trans); - tc->tex_trans_map = NULL; - } -} - -void -sp_tile_cache_validate_texture(struct softpipe_tile_cache *tc) -{ - if (tc->texture) { - struct softpipe_texture *spt = softpipe_texture(tc->texture); - if (spt->timestamp != tc->timestamp) { - /* texture was modified, invalidate all cached tiles */ - uint i; - _debug_printf("INV %d %d\n", tc->timestamp, spt->timestamp); - for (i = 0; i < NUM_ENTRIES; i++) { - tc->entries[i].addr.bits.invalid = 1; - } - - tc->timestamp = spt->timestamp; - } - } -} - -/** - * Specify the texture to cache. - */ -void -sp_tile_cache_set_texture(struct softpipe_tile_cache *tc, - struct pipe_texture *texture) -{ - uint i; - - assert(!tc->transfer); - - if (tc->texture != texture) { - pipe_texture_reference(&tc->texture, texture); - - if (tc->tex_trans) { - struct pipe_screen *screen = tc->tex_trans->texture->screen; - - if (tc->tex_trans_map) { - screen->transfer_unmap(screen, tc->tex_trans); - tc->tex_trans_map = NULL; - } - - screen->tex_transfer_destroy(tc->tex_trans); - tc->tex_trans = NULL; - } - - /* mark as entries as invalid/empty */ - /* XXX we should try to avoid this when the teximage hasn't changed */ - for (i = 0; i < NUM_ENTRIES; i++) { - tc->entries[i].addr.bits.invalid = 1; - } - - tc->tex_face = -1; /* any invalid value here */ - } } - /** * Set pixels in a tile to the given clear color/value, float. */ @@ -345,7 +275,7 @@ sp_tile_cache_flush_clear(struct softpipe_tile_cache *tc) /* push the tile to all positions marked as clear */ for (y = 0; y < h; y += TILE_SIZE) { for (x = 0; x < w; x += TILE_SIZE) { - union tile_address addr = tile_address(x, y, 0, 0, 0); + union tile_address addr = tile_address(x, y); if (is_clear_flag_set(tc->clear_flags, addr)) { pipe_put_tile_raw(pt, @@ -403,13 +333,6 @@ sp_flush_tile_cache(struct softpipe_tile_cache *tc) sp_tile_cache_flush_clear(tc); #endif } - else if (tc->texture) { - /* caching a texture, mark all entries as empty */ - for (pos = 0; pos < NUM_ENTRIES; pos++) { - tc->entries[pos].addr.bits.invalid = 1; - } - tc->tex_face = -1; - } #if 0 debug_printf("flushed tiles in use: %d\n", inuse); @@ -488,97 +411,7 @@ sp_find_cached_tile(struct softpipe_tile_cache *tc, } -/** - * Given the texture face, level, zslice, x and y values, compute - * the cache entry position/index where we'd hope to find the - * cached texture tile. - * This is basically a direct-map cache. - * XXX There's probably lots of ways in which we can improve this. - */ -static INLINE uint -tex_cache_pos( union tile_address addr ) -{ - uint entry = (addr.bits.x + - addr.bits.y * 9 + - addr.bits.z * 3 + - addr.bits.face + - addr.bits.level * 7); - - return entry % NUM_ENTRIES; -} - -/** - * Similar to sp_get_cached_tile() but for textures. - * Tiles are read-only and indexed with more params. - */ -const struct softpipe_cached_tile * -sp_find_cached_tile_tex(struct softpipe_tile_cache *tc, - union tile_address addr ) -{ - struct pipe_screen *screen = tc->screen; - struct softpipe_cached_tile *tile; - - tile = tc->entries + tex_cache_pos( addr ); - - if (addr.value != tile->addr.value) { - - /* cache miss. Most misses are because we've invaldiated the - * texture cache previously -- most commonly on binding a new - * texture. Currently we effectively flush the cache on texture - * bind. - */ -#if 0 - _debug_printf("miss at %u: x=%d y=%d z=%d face=%d level=%d\n" - " tile %u: x=%d y=%d z=%d face=%d level=%d\n", - pos, x/TILE_SIZE, y/TILE_SIZE, z, face, level, - pos, tile->addr.bits.x, tile->addr.bits.y, tile->z, tile->face, tile->level); -#endif - - /* check if we need to get a new transfer */ - if (!tc->tex_trans || - tc->tex_face != addr.bits.face || - tc->tex_level != addr.bits.level || - tc->tex_z != addr.bits.z) { - /* get new transfer (view into texture) */ - - if (tc->tex_trans) { - if (tc->tex_trans_map) { - tc->screen->transfer_unmap(tc->screen, tc->tex_trans); - tc->tex_trans_map = NULL; - } - - screen->tex_transfer_destroy(tc->tex_trans); - tc->tex_trans = NULL; - } - - tc->tex_trans = - screen->get_tex_transfer(screen, tc->texture, - addr.bits.face, - addr.bits.level, - addr.bits.z, - PIPE_TRANSFER_READ, 0, 0, - tc->texture->width[addr.bits.level], - tc->texture->height[addr.bits.level]); - - tc->tex_trans_map = screen->transfer_map(screen, tc->tex_trans); - tc->tex_face = addr.bits.face; - tc->tex_level = addr.bits.level; - tc->tex_z = addr.bits.z; - } - - /* get tile from the transfer (view into texture) */ - pipe_get_tile_rgba(tc->tex_trans, - addr.bits.x * TILE_SIZE, - addr.bits.y * TILE_SIZE, - TILE_SIZE, TILE_SIZE, - (float *) tile->data.color); - tile->addr = addr; - } - - tc->last_tile = tile; - return tile; -} /** diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.h b/src/gallium/drivers/softpipe/sp_tile_cache.h index ac2aae5875..3b0be274d5 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.h +++ b/src/gallium/drivers/softpipe/sp_tile_cache.h @@ -51,10 +51,8 @@ union tile_address { struct { unsigned x:6; /* 4096 / TILE_SIZE */ unsigned y:6; /* 4096 / TILE_SIZE */ - unsigned z:12; /* 4096 -- z not tiled */ - unsigned face:3; - unsigned level:4; unsigned invalid:1; + unsigned pad:19; } bits; unsigned value; }; @@ -88,19 +86,12 @@ struct softpipe_tile_cache struct pipe_transfer *transfer; void *transfer_map; - struct pipe_texture *texture; /**< if caching a texture */ - unsigned timestamp; - struct softpipe_cached_tile entries[NUM_ENTRIES]; uint clear_flags[(MAX_WIDTH / TILE_SIZE) * (MAX_HEIGHT / TILE_SIZE) / 32]; 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; - int tex_face, tex_level, tex_z; - struct softpipe_cached_tile tile; /**< scratch tile for clears */ struct softpipe_cached_tile *last_tile; /**< most recently retrieved tile */ @@ -126,13 +117,6 @@ sp_tile_cache_map_transfers(struct softpipe_tile_cache *tc); extern void sp_tile_cache_unmap_transfers(struct softpipe_tile_cache *tc); -extern void -sp_tile_cache_set_texture(struct softpipe_tile_cache *tc, - struct pipe_texture *texture); - -void -sp_tile_cache_validate_texture(struct softpipe_tile_cache *tc); - extern void sp_flush_tile_cache(struct softpipe_tile_cache *tc); @@ -144,47 +128,27 @@ extern struct softpipe_cached_tile * sp_find_cached_tile(struct softpipe_tile_cache *tc, union tile_address addr ); -extern const struct softpipe_cached_tile * -sp_find_cached_tile_tex(struct softpipe_tile_cache *tc, - union tile_address addr ); static INLINE const union tile_address tile_address( unsigned x, - unsigned y, - unsigned z, - unsigned face, - unsigned level ) + unsigned y ) { union tile_address addr; addr.value = 0; addr.bits.x = x / TILE_SIZE; addr.bits.y = y / TILE_SIZE; - addr.bits.z = z; - addr.bits.face = face; - addr.bits.level = level; return addr; } /* Quickly retrieve tile if it matches last lookup. */ -static INLINE const struct softpipe_cached_tile * -sp_get_cached_tile_tex(struct softpipe_tile_cache *tc, - union tile_address addr ) -{ - if (tc->last_tile->addr.value == addr.value) - return tc->last_tile; - - return sp_find_cached_tile_tex( tc, addr ); -} - - static INLINE struct softpipe_cached_tile * sp_get_cached_tile(struct softpipe_tile_cache *tc, int x, int y ) { - union tile_address addr = tile_address( x, y, 0, 0, 0 ); + union tile_address addr = tile_address( x, y ); if (tc->last_tile->addr.value == addr.value) return tc->last_tile; -- cgit v1.2.3 From c84abe36a93312cfa061ce1bd005e43eb9f6a6df Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 29 Jul 2009 23:06:22 +0100 Subject: softpipe: fix typo in clear_tile --- src/gallium/drivers/softpipe/sp_tile_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index 2d82badcec..c520aef44f 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -225,7 +225,7 @@ clear_tile(struct softpipe_cached_tile *tile, switch (pf_get_size(format)) { case 1: - memset(tile->data.any, 0, TILE_SIZE * TILE_SIZE); + memset(tile->data.any, clear_value, TILE_SIZE * TILE_SIZE); break; case 2: if (clear_value == 0) { -- cgit v1.2.3 From 4f409da3456070946eda2d8ff5153b3b4306bb46 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 20 Aug 2009 11:25:20 +0100 Subject: softpipe: optimized path for simple mipmap sampling linear-mip-linear-repeat-POT sampling faspath, provides a very nice speedup to apps that do this common type of texturing. Test case: demos/terrain, turn fog off, turn texturing on. Without patch: 12 fps With patch: 20 fps. --- src/gallium/drivers/softpipe/sp_tex_sample.c | 95 +++++++++++++++++++++------- 1 file changed, 71 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 4651d781a9..b32ac9dabb 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -921,8 +921,8 @@ sp_get_samples_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler, } else { - unsigned x1 = (uflr + 1) & (xpot - 1); - unsigned y1 = (vflr + 1) & (ypot - 1); + unsigned x1 = (x0 + 1) & (xpot - 1); + unsigned y1 = (y0 + 1) & (ypot - 1); get_texel_quad_2d_mt(tgsi_sampler, 0, level, x0, y0, x1, y1, tx); } @@ -1028,42 +1028,92 @@ sp_get_samples_2d_linear_mip_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); const struct pipe_texture *texture = samp->texture; const struct pipe_sampler_state *sampler = samp->sampler; - int level0, level1; + int level0; float lambda; lambda = compute_lambda(texture, sampler, s, t, p, lodbias); level0 = (int)lambda; - level1 = level0 + 1; if (lambda < 0.0) { samp->level = 0; sp_get_samples_2d_linear_repeat_POT( tgsi_sampler, - s, t, p, lodbias, rgba ); + s, t, p, 0, rgba ); } else if (level0 >= texture->last_level) { samp->level = texture->last_level; sp_get_samples_2d_linear_repeat_POT( tgsi_sampler, - s, t, p, lodbias, rgba ); + s, t, p, 0, rgba ); } else { - float rgba0[4][4]; - float rgba1[4][4]; - int c,j; - float levelBlend = lambda - level0; /* blending weight between levels */ + unsigned xpot = 1 << (samp->xpot - level0); + unsigned ypot = 1 << (samp->ypot - level0); + unsigned xpot1 = 1 << (samp->xpot - (level0+1)); + unsigned ypot1 = 1 << (samp->ypot - (level0+1)); + unsigned j; - samp->level = level0; - sp_get_samples_2d_linear_repeat_POT( tgsi_sampler, - s, t, p, lodbias, rgba0 ); + for (j = 0; j < QUAD_SIZE; j++) { + int c; + + float u = s[j] * xpot - 0.5F; + float v = t[j] * ypot - 0.5F; - samp->level++; - sp_get_samples_2d_linear_repeat_POT( tgsi_sampler, - s, t, p, lodbias, rgba1 ); + int uflr = util_ifloor(u); + int vflr = util_ifloor(v); + + float xw = u - (float)uflr; + float yw = v - (float)vflr; + + int x0 = uflr & (xpot - 1); + int y0 = vflr & (ypot - 1); + + const float *tx0[4]; + const float *tx1[4]; + + if (x0 % TILE_SIZE != TILE_SIZE-1 && + y0 % TILE_SIZE != TILE_SIZE-1) + { + get_texel_quad_2d(tgsi_sampler, 0, level0, x0, y0, tx0); + } + else + { + unsigned x1 = (x0 + 1) & (xpot - 1); + unsigned y1 = (y0 + 1) & (ypot - 1); + get_texel_quad_2d_mt(tgsi_sampler, 0, level0, + x0, y0, x1, y1, tx0); + } - for (c = 0; c < 4; c++) - for (j = 0; j < 4; j++) - rgba[c][j] = lerp(levelBlend, rgba0[c][j], rgba1[c][j]); - } + x0 /= 2; + y0 /= 2; + /* also need to adjust xw, yw?? */ + + if (x0 % TILE_SIZE != TILE_SIZE-1 && + y0 % TILE_SIZE != TILE_SIZE-1) + { + get_texel_quad_2d(tgsi_sampler, 0, level0+1, x0, y0, tx1); + } + else + { + unsigned x1 = (x0 + 1) & (xpot1 - 1); + unsigned y1 = (y0 + 1) & (ypot1 - 1); + get_texel_quad_2d_mt(tgsi_sampler, 0, level0+1, + x0, y0, x1, y1, tx1); + } + + /* interpolate R, G, B, A */ + for (c = 0; c < 4; c++) { + float rgba0 = lerp_2d(xw, yw, + tx0[0][c], tx0[1][c], + tx0[2][c], tx0[3][c]); + + float rgba1 = lerp_2d(xw, yw, + tx1[0][c], tx1[1][c], + tx1[2][c], tx1[3][c]); + + rgba[c][j] = lerp(levelBlend, rgba0, rgba1); + } + } + } } /** @@ -1567,10 +1617,7 @@ sp_get_samples_fragment(struct tgsi_sampler *tgsi_sampler, if (sampler->wrap_s == PIPE_TEX_WRAP_REPEAT) { switch (sampler->min_img_filter) { case PIPE_TEX_FILTER_LINEAR: - /* This one not working yet: - */ - if (0) - tgsi_sampler->get_samples = sp_get_samples_2d_linear_mip_linear_repeat_POT; + tgsi_sampler->get_samples = sp_get_samples_2d_linear_mip_linear_repeat_POT; break; default: break; -- cgit v1.2.3 From 79a7ddb57a04cde5a4a0c27eb4a9b6889d12622a Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 20 Aug 2009 15:46:51 +0100 Subject: softpipe: fix glitch in texel lookups on fastpaths Fixes two issues - firstly for mipmap levels with one or more dimensions smaller than tilesize, the code was sampling off the edge of the texture (but still within the tile). Secondly, in the linear_mipmap_linear case, both the default code and new fastpath were incorrect. This change fixes the fastpath and adds a comment to the default path, which still needs to be fixed. Basically the issue is that the coordinates in the smaller texture level are/were being computed by just dividing thecoordinates from the larger texture level by two, as in: x0[j] /= 2; y0[j] /= 2; x1[j] /= 2; y1[j] /= 2; The issues with this are signficant. Initially x1 is most often equal to x0+1, but after this, it will likely be equal to x0, so we will not actually be performing the linear blend within the smaller mipmap. The fastpath code avoided this (recalculated x1), but was still using the weighting factors from the larger mipmap level (xw, yw), which were incorrect. Change the fastpath code to do two full, independent linear samples of the two mipmap levels before blending. The default code needs to do the same thing. --- src/gallium/drivers/softpipe/sp_tex_sample.c | 87 ++++++++-------------------- 1 file changed, 23 insertions(+), 64 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index b32ac9dabb..24f3311772 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -894,6 +894,9 @@ sp_get_samples_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler, unsigned xpot = 1 << (samp->xpot - level); unsigned ypot = 1 << (samp->ypot - level); + unsigned xmax = MIN2(TILE_SIZE, xpot) - 1; + unsigned ymax = MIN2(TILE_SIZE, ypot) - 1; + for (j = 0; j < QUAD_SIZE; j++) { int c; @@ -914,8 +917,7 @@ sp_get_samples_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler, /* Can we fetch all four at once: */ - if (x0 % TILE_SIZE != TILE_SIZE-1 && - y0 % TILE_SIZE != TILE_SIZE-1) + if (x0 < xmax && y0 < ymax) { get_texel_quad_2d(tgsi_sampler, 0, level, x0, y0, tx); } @@ -1045,72 +1047,22 @@ sp_get_samples_2d_linear_mip_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler s, t, p, 0, rgba ); } else { - float levelBlend = lambda - level0; /* blending weight between levels */ - unsigned xpot = 1 << (samp->xpot - level0); - unsigned ypot = 1 << (samp->ypot - level0); - unsigned xpot1 = 1 << (samp->xpot - (level0+1)); - unsigned ypot1 = 1 << (samp->ypot - (level0+1)); - unsigned j; - - for (j = 0; j < QUAD_SIZE; j++) { - int c; - - float u = s[j] * xpot - 0.5F; - float v = t[j] * ypot - 0.5F; - - int uflr = util_ifloor(u); - int vflr = util_ifloor(v); - - float xw = u - (float)uflr; - float yw = v - (float)vflr; - - int x0 = uflr & (xpot - 1); - int y0 = vflr & (ypot - 1); - - const float *tx0[4]; - const float *tx1[4]; - - if (x0 % TILE_SIZE != TILE_SIZE-1 && - y0 % TILE_SIZE != TILE_SIZE-1) - { - get_texel_quad_2d(tgsi_sampler, 0, level0, x0, y0, tx0); - } - else - { - unsigned x1 = (x0 + 1) & (xpot - 1); - unsigned y1 = (y0 + 1) & (ypot - 1); - get_texel_quad_2d_mt(tgsi_sampler, 0, level0, - x0, y0, x1, y1, tx0); - } + float levelBlend = lambda - level0; + float rgba0[4][4]; + float rgba1[4][4]; + int c,j; - x0 /= 2; - y0 /= 2; - /* also need to adjust xw, yw?? */ + samp->level = level0; + sp_get_samples_2d_linear_repeat_POT( tgsi_sampler, + s, t, p, 0, rgba0 ); - if (x0 % TILE_SIZE != TILE_SIZE-1 && - y0 % TILE_SIZE != TILE_SIZE-1) - { - get_texel_quad_2d(tgsi_sampler, 0, level0+1, x0, y0, tx1); - } - else - { - unsigned x1 = (x0 + 1) & (xpot1 - 1); - unsigned y1 = (y0 + 1) & (ypot1 - 1); - get_texel_quad_2d_mt(tgsi_sampler, 0, level0+1, - x0, y0, x1, y1, tx1); - } + samp->level = level0+1; + sp_get_samples_2d_linear_repeat_POT( tgsi_sampler, + s, t, p, 0, rgba1 ); - /* interpolate R, G, B, A */ + for (j = 0; j < QUAD_SIZE; j++) { for (c = 0; c < 4; c++) { - float rgba0 = lerp_2d(xw, yw, - tx0[0][c], tx0[1][c], - tx0[2][c], tx0[3][c]); - - float rgba1 = lerp_2d(xw, yw, - tx1[0][c], tx1[1][c], - tx1[2][c], tx1[3][c]); - - rgba[c][j] = lerp(levelBlend, rgba0, rgba1); + rgba[c][j] = lerp(levelBlend, rgba0[c][j], rgba1[c][j]); } } } @@ -1209,6 +1161,13 @@ sp_get_samples_2d_common(const struct tgsi_sampler *tgsi_sampler, if (level0 != level1) { /* get texels from second mipmap level and blend */ float rgba2[4][4]; + + /* XXX: This is incorrect -- will often end up with (x0 + * == x1 && y0 == y1), meaning that we fetch the same + * texel four times and linearly interpolate between + * identical values. The correct approach would be to + * call linear_texcoord again for the second level. + */ x0[j] /= 2; y0[j] /= 2; x1[j] /= 2; -- cgit v1.2.3 From 1fd40e506c2207664f0c3f435e4614472ea4c540 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 20 Aug 2009 18:12:44 +0100 Subject: softpipe: slightly optimized tiling calculation --- src/gallium/drivers/softpipe/sp_tex_sample.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 24f3311772..90371d6353 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -893,9 +893,8 @@ sp_get_samples_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler, unsigned level = samp->level; unsigned xpot = 1 << (samp->xpot - level); unsigned ypot = 1 << (samp->ypot - level); - - unsigned xmax = MIN2(TILE_SIZE, xpot) - 1; - unsigned ymax = MIN2(TILE_SIZE, ypot) - 1; + unsigned xmax = (xpot - 1) & (TILE_SIZE - 1); /* MIN2(TILE_SIZE, xpot) - 1; */ + unsigned ymax = (ypot - 1) & (TILE_SIZE - 1); /* MIN2(TILE_SIZE, ypot) - 1; */ for (j = 0; j < QUAD_SIZE; j++) { int c; -- cgit v1.2.3 From 0d9979d9ec5b931856d29c4ec44edb1f4931d1ac Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 20 Aug 2009 18:13:25 +0100 Subject: softpipe: fix xpot calculation typo in sp_get_samples_2d_nearest_clamp_POT --- src/gallium/drivers/softpipe/sp_tex_sample.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 90371d6353..2987548fb3 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -985,8 +985,8 @@ sp_get_samples_2d_nearest_clamp_POT(struct tgsi_sampler *tgsi_sampler, const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); unsigned j; unsigned level = samp->level; - unsigned xpot = (1<xpot); - unsigned ypot = (1<ypot); + unsigned xpot = 1 << (samp->xpot - level); + unsigned ypot = 1 << (samp->ypot - level); for (j = 0; j < QUAD_SIZE; j++) { int c; -- cgit v1.2.3 From 00c835918259f8d41c3f74eca679a972713b11b2 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 20 Aug 2009 18:36:57 +0100 Subject: softpipe: allow the existing sampler routines to be hooked up directly Let eg. sp_get_samples_rect be hooked directly in as the tgsi sampler routine. Add a field to determine whether this is a vertex or fragment sampling call, and massage parameters to match the tgsi call. --- src/gallium/drivers/softpipe/sp_context.c | 6 +- src/gallium/drivers/softpipe/sp_state_derived.c | 3 +- src/gallium/drivers/softpipe/sp_tex_sample.c | 193 ++++++++++-------------- src/gallium/drivers/softpipe/sp_tex_sample.h | 21 +-- 4 files changed, 94 insertions(+), 129 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index e35c6b3aec..a0196955c8 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -230,14 +230,16 @@ softpipe_create( struct pipe_screen *screen ) /* vertex shader samplers */ for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { - softpipe->tgsi.vert_samplers[i].base.get_samples = sp_get_samples_vertex; + softpipe->tgsi.vert_samplers[i].base.get_samples = sp_get_samples; + softpipe->tgsi.vert_samplers[i].processor = TGSI_PROCESSOR_VERTEX; softpipe->tgsi.vert_samplers[i].cache = softpipe->tex_cache[i]; softpipe->tgsi.vert_samplers_list[i] = &softpipe->tgsi.vert_samplers[i]; } /* fragment shader samplers */ for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { - softpipe->tgsi.frag_samplers[i].base.get_samples = sp_get_samples_fragment; + softpipe->tgsi.frag_samplers[i].base.get_samples = sp_get_samples; + softpipe->tgsi.frag_samplers[i].processor = TGSI_PROCESSOR_FRAGMENT; softpipe->tgsi.frag_samplers[i].cache = softpipe->tex_cache[i]; softpipe->tgsi.frag_samplers_list[i] = &softpipe->tgsi.frag_samplers[i]; } diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index 3ed1de7e17..1f6e2ccb83 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -202,13 +202,14 @@ update_tgsi_samplers( struct softpipe_context *softpipe ) for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { softpipe->tgsi.vert_samplers[i].sampler = softpipe->sampler[i]; softpipe->tgsi.vert_samplers[i].texture = softpipe->texture[i]; + softpipe->tgsi.frag_samplers[i].base.get_samples = sp_get_samples; } /* fragment shader samplers */ for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { softpipe->tgsi.frag_samplers[i].sampler = softpipe->sampler[i]; softpipe->tgsi.frag_samplers[i].texture = softpipe->texture[i]; - softpipe->tgsi.frag_samplers[i].base.get_samples = sp_get_samples_fragment; + softpipe->tgsi.frag_samplers[i].base.get_samples = sp_get_samples; } for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 2987548fb3..6c75158d59 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -41,6 +41,7 @@ #include "sp_tile_cache.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" +#include "pipe/p_shader_tokens.h" #include "util/u_math.h" #include "util/u_memory.h" @@ -521,15 +522,20 @@ choose_cube_face(float rx, float ry, float rz, float *newS, float *newT) * This is only done for fragment shaders, not vertex shaders. */ static float -compute_lambda(const struct pipe_texture *tex, - const struct pipe_sampler_state *sampler, +compute_lambda(struct tgsi_sampler *tgsi_sampler, const float s[QUAD_SIZE], const float t[QUAD_SIZE], const float p[QUAD_SIZE], float lodbias) { + const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); + const struct pipe_texture *texture = samp->texture; + const struct pipe_sampler_state *sampler = samp->sampler; float rho, lambda; + if (samp->processor == TGSI_PROCESSOR_VERTEX) + return lodbias; + assert(sampler->normalized_coords); assert(s); @@ -538,7 +544,7 @@ compute_lambda(const struct pipe_texture *tex, float dsdy = s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]; dsdx = fabsf(dsdx); dsdy = fabsf(dsdy); - rho = MAX2(dsdx, dsdy) * tex->width[0]; + rho = MAX2(dsdx, dsdy) * texture->width[0]; } if (t) { float dtdx = t[QUAD_BOTTOM_RIGHT] - t[QUAD_BOTTOM_LEFT]; @@ -546,7 +552,7 @@ compute_lambda(const struct pipe_texture *tex, float max; dtdx = fabsf(dtdx); dtdy = fabsf(dtdy); - max = MAX2(dtdx, dtdy) * tex->height[0]; + max = MAX2(dtdx, dtdy) * texture->height[0]; rho = MAX2(rho, max); } if (p) { @@ -555,7 +561,7 @@ compute_lambda(const struct pipe_texture *tex, float max; dpdx = fabsf(dpdx); dpdy = fabsf(dpdy); - max = MAX2(dpdx, dpdy) * tex->depth[0]; + max = MAX2(dpdx, dpdy) * texture->depth[0]; rho = MAX2(rho, max); } @@ -579,16 +585,18 @@ compute_lambda(const struct pipe_texture *tex, * \param imgFilter Returns either the min or mag filter, depending on lambda */ static void -choose_mipmap_levels(const struct pipe_texture *texture, - const struct pipe_sampler_state *sampler, +choose_mipmap_levels(struct tgsi_sampler *tgsi_sampler, const float s[QUAD_SIZE], const float t[QUAD_SIZE], const float p[QUAD_SIZE], - boolean computeLambda, float lodbias, unsigned *level0, unsigned *level1, float *levelBlend, unsigned *imgFilter) { + const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); + const struct pipe_texture *texture = samp->texture; + const struct pipe_sampler_state *sampler = samp->sampler; + if (sampler->min_mip_filter == PIPE_TEX_MIPFILTER_NONE) { /* no mipmap selection needed */ *level0 = *level1 = CLAMP((int) sampler->min_lod, @@ -598,7 +606,7 @@ choose_mipmap_levels(const struct pipe_texture *texture, /* non-mipmapped texture, but still need to determine if doing * minification or magnification. */ - float lambda = compute_lambda(texture, sampler, s, t, p, lodbias); + float lambda = compute_lambda(tgsi_sampler, s, t, p, lodbias); if (lambda <= 0.0) { *imgFilter = sampler->mag_img_filter; } @@ -611,14 +619,7 @@ choose_mipmap_levels(const struct pipe_texture *texture, } } else { - float lambda; - - if (computeLambda) - /* fragment shader */ - lambda = compute_lambda(texture, sampler, s, t, p, lodbias); - else - /* vertex shader */ - lambda = lodbias; /* not really a bias, but absolute LOD */ + float lambda = compute_lambda(tgsi_sampler, s, t, p, lodbias); if (lambda <= 0.0) { /* XXX threshold depends on the filter */ /* magnifying */ @@ -1028,11 +1029,10 @@ sp_get_samples_2d_linear_mip_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler { struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); const struct pipe_texture *texture = samp->texture; - const struct pipe_sampler_state *sampler = samp->sampler; int level0; float lambda; - lambda = compute_lambda(texture, sampler, s, t, p, lodbias); + lambda = compute_lambda(tgsi_sampler, s, t, p, lodbias); level0 = (int)lambda; if (lambda < 0.0) { @@ -1072,11 +1072,10 @@ sp_get_samples_2d_linear_mip_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler * Could probably extend for 3D... */ static void -sp_get_samples_2d_common(const struct tgsi_sampler *tgsi_sampler, +sp_get_samples_2d_common(struct tgsi_sampler *tgsi_sampler, const float s[QUAD_SIZE], const float t[QUAD_SIZE], const float p[QUAD_SIZE], - boolean computeLambda, float lodbias, float rgba[NUM_CHANNELS][QUAD_SIZE], const unsigned faces[4]) @@ -1088,7 +1087,8 @@ sp_get_samples_2d_common(const struct tgsi_sampler *tgsi_sampler, int width, height; float levelBlend; - choose_mipmap_levels(texture, sampler, s, t, p, computeLambda, lodbias, + choose_mipmap_levels(tgsi_sampler, s, t, p, + lodbias, &level0, &level1, &levelBlend, &imgFilter); assert(sampler->normalized_coords); @@ -1199,42 +1199,39 @@ sp_get_samples_2d_common(const struct tgsi_sampler *tgsi_sampler, static INLINE void -sp_get_samples_1d(const struct tgsi_sampler *sampler, +sp_get_samples_1d(struct tgsi_sampler *sampler, const float s[QUAD_SIZE], const float t[QUAD_SIZE], const float p[QUAD_SIZE], - boolean computeLambda, float lodbias, float rgba[NUM_CHANNELS][QUAD_SIZE]) { static const unsigned faces[4] = {0, 0, 0, 0}; static const float tzero[4] = {0, 0, 0, 0}; sp_get_samples_2d_common(sampler, s, tzero, NULL, - computeLambda, lodbias, rgba, faces); + lodbias, rgba, faces); } static INLINE void -sp_get_samples_2d(const struct tgsi_sampler *sampler, +sp_get_samples_2d(struct tgsi_sampler *sampler, const float s[QUAD_SIZE], const float t[QUAD_SIZE], const float p[QUAD_SIZE], - boolean computeLambda, float lodbias, float rgba[NUM_CHANNELS][QUAD_SIZE]) { static const unsigned faces[4] = {0, 0, 0, 0}; sp_get_samples_2d_common(sampler, s, t, p, - computeLambda, lodbias, rgba, faces); + lodbias, rgba, faces); } static INLINE void -sp_get_samples_3d(const struct tgsi_sampler *tgsi_sampler, +sp_get_samples_3d(struct tgsi_sampler *tgsi_sampler, const float s[QUAD_SIZE], const float t[QUAD_SIZE], const float p[QUAD_SIZE], - boolean computeLambda, float lodbias, float rgba[NUM_CHANNELS][QUAD_SIZE]) { @@ -1247,7 +1244,8 @@ sp_get_samples_3d(const struct tgsi_sampler *tgsi_sampler, float levelBlend; const uint face = 0; - choose_mipmap_levels(texture, sampler, s, t, p, computeLambda, lodbias, + choose_mipmap_levels(tgsi_sampler, s, t, p, + lodbias, &level0, &level1, &levelBlend, &imgFilter); assert(sampler->normalized_coords); @@ -1356,11 +1354,10 @@ sp_get_samples_3d(const struct tgsi_sampler *tgsi_sampler, static void -sp_get_samples_cube(const struct tgsi_sampler *sampler, +sp_get_samples_cube(struct tgsi_sampler *sampler, const float s[QUAD_SIZE], const float t[QUAD_SIZE], const float p[QUAD_SIZE], - boolean computeLambda, float lodbias, float rgba[NUM_CHANNELS][QUAD_SIZE]) { @@ -1370,16 +1367,15 @@ sp_get_samples_cube(const struct tgsi_sampler *sampler, faces[j] = choose_cube_face(s[j], t[j], p[j], ssss + j, tttt + j); } sp_get_samples_2d_common(sampler, ssss, tttt, NULL, - computeLambda, lodbias, rgba, faces); + lodbias, rgba, faces); } static void -sp_get_samples_rect(const struct tgsi_sampler *tgsi_sampler, +sp_get_samples_rect(struct tgsi_sampler *tgsi_sampler, const float s[QUAD_SIZE], const float t[QUAD_SIZE], const float p[QUAD_SIZE], - boolean computeLambda, float lodbias, float rgba[NUM_CHANNELS][QUAD_SIZE]) { @@ -1391,7 +1387,8 @@ sp_get_samples_rect(const struct tgsi_sampler *tgsi_sampler, int width, height; float levelBlend; - choose_mipmap_levels(texture, sampler, s, t, p, computeLambda, lodbias, + choose_mipmap_levels(tgsi_sampler, s, t, p, + lodbias, &level0, &level1, &levelBlend, &imgFilter); /* texture RECTS cannot be mipmapped */ @@ -1447,90 +1444,77 @@ sp_get_samples_rect(const struct tgsi_sampler *tgsi_sampler, /** - * Common code for vertex/fragment program texture sampling. + * Error condition handler */ static INLINE void +sp_get_samples_null(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) +{ + int i,j; + + for (i = 0; i < 4; i++) + for (j = 0; j < 4; j++) + rgba[i][j] = 1.0; +} + +/** + * Called via tgsi_sampler::get_samples() when using a sampler for the + * first time. Determine the actual sampler function, link it in and + * call it. + */ +void sp_get_samples(struct tgsi_sampler *tgsi_sampler, const float s[QUAD_SIZE], const float t[QUAD_SIZE], const float p[QUAD_SIZE], - boolean computeLambda, float lodbias, float rgba[NUM_CHANNELS][QUAD_SIZE]) { - const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); + struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); const struct pipe_texture *texture = samp->texture; const struct pipe_sampler_state *sampler = samp->sampler; - if (!texture) - return; + /* Default to the 'undefined' case: + */ + tgsi_sampler->get_samples = sp_get_samples_null; + + if (!texture) { + assert(0); /* is this legal?? */ + goto out; + } + + if (!sampler->normalized_coords) { + assert (texture->target == PIPE_TEXTURE_2D); + tgsi_sampler->get_samples = sp_get_samples_rect; + goto out; + } switch (texture->target) { case PIPE_TEXTURE_1D: - assert(sampler->normalized_coords); - sp_get_samples_1d(tgsi_sampler, s, t, p, computeLambda, lodbias, rgba); + tgsi_sampler->get_samples = sp_get_samples_1d; break; case PIPE_TEXTURE_2D: - if (sampler->normalized_coords) - sp_get_samples_2d(tgsi_sampler, s, t, p, computeLambda, lodbias, rgba); - else - sp_get_samples_rect(tgsi_sampler, s, t, p, computeLambda, lodbias, rgba); + tgsi_sampler->get_samples = sp_get_samples_2d; break; case PIPE_TEXTURE_3D: - assert(sampler->normalized_coords); - sp_get_samples_3d(tgsi_sampler, s, t, p, computeLambda, lodbias, rgba); + tgsi_sampler->get_samples = sp_get_samples_3d; break; case PIPE_TEXTURE_CUBE: - assert(sampler->normalized_coords); - sp_get_samples_cube(tgsi_sampler, s, t, p, computeLambda, lodbias, rgba); + tgsi_sampler->get_samples = sp_get_samples_cube; break; default: assert(0); + break; } -#if 0 /* DEBUG */ - { - int i; - printf("Sampled at %f, %f, %f:\n", s[0], t[0], p[0]); - for (i = 0; i < 4; i++) { - printf("Frag %d: %f %f %f %f\n", i, - rgba[0][i], - rgba[1][i], - rgba[2][i], - rgba[3][i]); - } - } -#endif -} - -static void -sp_get_samples_fallback(struct tgsi_sampler *tgsi_sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE]) -{ - sp_get_samples(tgsi_sampler, s, t, p, TRUE, lodbias, rgba); -} - -/** - * Called via tgsi_sampler::get_samples() when running a fragment shader. - * Get four filtered RGBA values from the sampler's texture. - */ -void -sp_get_samples_fragment(struct tgsi_sampler *tgsi_sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE]) -{ - struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); - const struct pipe_texture *texture = samp->texture; - const struct pipe_sampler_state *sampler = samp->sampler; - - tgsi_sampler->get_samples = sp_get_samples_fallback; + /* Do this elsewhere: + */ + samp->xpot = util_unsigned_logbase2( samp->texture->width[0] ); + samp->ypot = util_unsigned_logbase2( samp->texture->height[0] ); /* Try to hook in a faster sampler. Ultimately we'll have to * code-generate these. Luckily most of this looks like it is @@ -1542,9 +1526,6 @@ sp_get_samples_fragment(struct tgsi_sampler *tgsi_sampler, sampler->compare_mode == FALSE && sampler->normalized_coords) { - samp->xpot = util_unsigned_logbase2( samp->texture->width[0] ); - samp->ypot = util_unsigned_logbase2( samp->texture->height[0] ); - if (sampler->min_mip_filter == PIPE_TEX_MIPFILTER_NONE) { samp->level = CLAMP((int) sampler->min_lod, 0, (int) texture->last_level); @@ -1593,21 +1574,7 @@ sp_get_samples_fragment(struct tgsi_sampler *tgsi_sampler, sampler->normalized_coords, TRUE); } +out: tgsi_sampler->get_samples( tgsi_sampler, s, t, p, lodbias, rgba ); } - -/** - * Called via tgsi_sampler::get_samples() when running a vertex shader. - * Get four filtered RGBA values from the sampler's texture. - */ -void -sp_get_samples_vertex(struct tgsi_sampler *tgsi_sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE]) -{ - sp_get_samples(tgsi_sampler, s, t, p, FALSE, lodbias, rgba); -} diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.h b/src/gallium/drivers/softpipe/sp_tex_sample.h index 0650c7830b..c73ae44131 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.h +++ b/src/gallium/drivers/softpipe/sp_tex_sample.h @@ -39,6 +39,8 @@ struct sp_shader_sampler { struct tgsi_sampler base; /**< base class */ + unsigned processor; + /* For sp_get_samples_2d_linear_POT: */ unsigned xpot; @@ -60,21 +62,14 @@ sp_shader_sampler(const struct tgsi_sampler *sampler) } -extern void -sp_get_samples_fragment(struct tgsi_sampler *tgsi_sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE]); extern void -sp_get_samples_vertex(struct tgsi_sampler *tgsi_sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE]); +sp_get_samples(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]); #endif /* SP_TEX_SAMPLE_H */ -- cgit v1.2.3 From b1cc196e6d18494348c2974aad5d85d1b8281ce0 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 21 Aug 2009 18:07:35 +0100 Subject: util: add util_is_power_of_two function --- src/gallium/auxiliary/util/u_math.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index d30fa3c2d5..163522d3ef 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -273,6 +273,14 @@ util_fast_pow(float x, float y) return util_fast_exp2(util_fast_log2(x) * y); } +/* Note that this counts zero as a power of two. + */ +static INLINE boolean +util_is_power_of_two( unsigned v ) +{ + return (v & (v-1)) == 0; +} + /** -- cgit v1.2.3 From 4fc7d0345a18042a79686940fb7cc4e698cc9192 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 21 Aug 2009 17:13:11 +0100 Subject: softpipe: rework texture sampling code Split into component pieces, stitch together at runtime using function pointers. Make it possible to utilize the existing fastpaths as image-level filters for generic mip-filtering routines. Remove special case for rectangle filtering, as it can now be handled by the 2d path. As most of the mesa demo texturing was already covered by fast paths, its harder to find examples of speedups, but tunnel gets a boost as mip-nearest filtering is now able to access the img_2d_linear_wrap_POT functions for sampling within a mipmap level. --- src/gallium/drivers/softpipe/sp_context.c | 15 - src/gallium/drivers/softpipe/sp_context.h | 23 +- src/gallium/drivers/softpipe/sp_state.h | 1 + src/gallium/drivers/softpipe/sp_state_blend.c | 4 +- src/gallium/drivers/softpipe/sp_state_derived.c | 18 +- src/gallium/drivers/softpipe/sp_state_fs.c | 3 + src/gallium/drivers/softpipe/sp_state_sampler.c | 104 +- src/gallium/drivers/softpipe/sp_tex_sample.c | 2198 ++++++++++++----------- src/gallium/drivers/softpipe/sp_tex_sample.h | 94 +- src/gallium/drivers/softpipe/sp_texture.c | 8 +- src/gallium/drivers/softpipe/sp_texture.h | 4 + 11 files changed, 1361 insertions(+), 1111 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index a0196955c8..ef8faab3bd 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -228,21 +228,6 @@ softpipe_create( struct pipe_screen *screen ) softpipe->quad.depth_test = sp_quad_depth_test_stage(softpipe); softpipe->quad.blend = sp_quad_blend_stage(softpipe); - /* vertex shader samplers */ - for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { - softpipe->tgsi.vert_samplers[i].base.get_samples = sp_get_samples; - softpipe->tgsi.vert_samplers[i].processor = TGSI_PROCESSOR_VERTEX; - softpipe->tgsi.vert_samplers[i].cache = softpipe->tex_cache[i]; - softpipe->tgsi.vert_samplers_list[i] = &softpipe->tgsi.vert_samplers[i]; - } - - /* fragment shader samplers */ - for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { - softpipe->tgsi.frag_samplers[i].base.get_samples = sp_get_samples; - softpipe->tgsi.frag_samplers[i].processor = TGSI_PROCESSOR_FRAGMENT; - softpipe->tgsi.frag_samplers[i].cache = softpipe->tex_cache[i]; - softpipe->tgsi.frag_samplers_list[i] = &softpipe->tgsi.frag_samplers[i]; - } /* * Create drawing context and plug our rendering stage into it. diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index fa3306c020..068a892f25 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -36,7 +36,6 @@ #include "draw/draw_vertex.h" #include "sp_quad_pipe.h" -#include "sp_tex_sample.h" struct softpipe_vbuf_render; @@ -51,12 +50,12 @@ struct softpipe_context { struct pipe_context pipe; /**< base class */ /** Constant state objects */ - const struct pipe_blend_state *blend; - const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS]; - const struct pipe_depth_stencil_alpha_state *depth_stencil; - const struct pipe_rasterizer_state *rasterizer; - const struct sp_fragment_shader *fs; - const struct sp_vertex_shader *vs; + struct pipe_blend_state *blend; + struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS]; + struct pipe_depth_stencil_alpha_state *depth_stencil; + struct pipe_rasterizer_state *rasterizer; + struct sp_fragment_shader *fs; + struct sp_vertex_shader *vs; /** Other rendering state */ struct pipe_blend_color blend_color; @@ -123,10 +122,8 @@ struct softpipe_context { /** TGSI exec things */ struct { - struct sp_shader_sampler vert_samplers[PIPE_MAX_SAMPLERS]; - struct sp_shader_sampler *vert_samplers_list[PIPE_MAX_SAMPLERS]; - struct sp_shader_sampler frag_samplers[PIPE_MAX_SAMPLERS]; - struct sp_shader_sampler *frag_samplers_list[PIPE_MAX_SAMPLERS]; + struct sp_sampler_varient *vert_samplers_list[PIPE_MAX_SAMPLERS]; + struct sp_sampler_varient *frag_samplers_list[PIPE_MAX_SAMPLERS]; } tgsi; /** The primitive drawing context */ @@ -155,5 +152,9 @@ softpipe_context( struct pipe_context *pipe ) return (struct softpipe_context *)pipe; } +void +softpipe_reset_sampler_varients(struct softpipe_context *softpipe); + + #endif /* SP_CONTEXT_H */ diff --git a/src/gallium/drivers/softpipe/sp_state.h b/src/gallium/drivers/softpipe/sp_state.h index 9776e978e3..77ee3c1136 100644 --- a/src/gallium/drivers/softpipe/sp_state.h +++ b/src/gallium/drivers/softpipe/sp_state.h @@ -87,6 +87,7 @@ struct sp_fragment_shader { struct sp_vertex_shader { struct pipe_shader_state shader; struct draw_vertex_shader *draw_data; + int max_sampler; /* -1 if no samplers */ }; diff --git a/src/gallium/drivers/softpipe/sp_state_blend.c b/src/gallium/drivers/softpipe/sp_state_blend.c index 384fe559af..efed082f82 100644 --- a/src/gallium/drivers/softpipe/sp_state_blend.c +++ b/src/gallium/drivers/softpipe/sp_state_blend.c @@ -45,7 +45,7 @@ void softpipe_bind_blend_state( struct pipe_context *pipe, { struct softpipe_context *softpipe = softpipe_context(pipe); - softpipe->blend = (const struct pipe_blend_state *)blend; + softpipe->blend = (struct pipe_blend_state *)blend; softpipe->dirty |= SP_NEW_BLEND; } @@ -86,7 +86,7 @@ softpipe_bind_depth_stencil_state(struct pipe_context *pipe, { struct softpipe_context *softpipe = softpipe_context(pipe); - softpipe->depth_stencil = (const struct pipe_depth_stencil_alpha_state *)depth_stencil; + softpipe->depth_stencil = (struct pipe_depth_stencil_alpha_state *)depth_stencil; softpipe->dirty |= SP_NEW_DEPTH_STENCIL_ALPHA; } diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index 1f6e2ccb83..5310928332 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -198,19 +198,7 @@ update_tgsi_samplers( struct softpipe_context *softpipe ) { unsigned i; - /* vertex shader samplers */ - for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { - softpipe->tgsi.vert_samplers[i].sampler = softpipe->sampler[i]; - softpipe->tgsi.vert_samplers[i].texture = softpipe->texture[i]; - softpipe->tgsi.frag_samplers[i].base.get_samples = sp_get_samples; - } - - /* fragment shader samplers */ - for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { - softpipe->tgsi.frag_samplers[i].sampler = softpipe->sampler[i]; - softpipe->tgsi.frag_samplers[i].texture = softpipe->texture[i]; - softpipe->tgsi.frag_samplers[i].base.get_samples = sp_get_samples; - } + softpipe_reset_sampler_varients( softpipe ); for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { sp_tile_cache_validate_texture( softpipe->tex_cache[i] ); @@ -232,7 +220,9 @@ void softpipe_update_derived( struct softpipe_context *softpipe ) } if (softpipe->dirty & (SP_NEW_SAMPLER | - SP_NEW_TEXTURE)) + SP_NEW_TEXTURE | + SP_NEW_FS | + SP_NEW_VS)) update_tgsi_samplers( softpipe ); if (softpipe->dirty & (SP_NEW_RASTERIZER | diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c index 108ac8b9bb..3a45321923 100644 --- a/src/gallium/drivers/softpipe/sp_state_fs.c +++ b/src/gallium/drivers/softpipe/sp_state_fs.c @@ -34,6 +34,7 @@ #include "pipe/internal/p_winsys_screen.h" #include "pipe/p_shader_tokens.h" #include "draw/draw_context.h" +#include "draw/draw_vs.h" #include "tgsi/tgsi_dump.h" #include "tgsi/tgsi_scan.h" #include "tgsi/tgsi_parse.h" @@ -108,6 +109,8 @@ softpipe_create_vs_state(struct pipe_context *pipe, if (state->draw_data == NULL) goto fail; + state->max_sampler = state->draw_data->info.file_max[TGSI_FILE_SAMPLER]; + return state; fail: diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index aa2f3f2ccd..714e638048 100644 --- a/src/gallium/drivers/softpipe/sp_state_sampler.c +++ b/src/gallium/drivers/softpipe/sp_state_sampler.c @@ -38,15 +38,32 @@ #include "sp_state.h" #include "sp_texture.h" #include "sp_tile_cache.h" +#include "sp_tex_sample.h" #include "draw/draw_context.h" +struct sp_sampler { + struct pipe_sampler_state base; + struct sp_sampler_varient *varients; + struct sp_sampler_varient *current; +}; + +static struct sp_sampler *sp_sampler( struct pipe_sampler_state *sampler ) +{ + return (struct sp_sampler *)sampler; +} + void * softpipe_create_sampler_state(struct pipe_context *pipe, const struct pipe_sampler_state *sampler) { - return mem_dup(sampler, sizeof(*sampler)); + struct sp_sampler *sp_sampler = CALLOC_STRUCT(sp_sampler); + + sp_sampler->base = *sampler; + sp_sampler->varients = NULL; + + return (void *)sp_sampler; } @@ -106,10 +123,95 @@ softpipe_set_sampler_textures(struct pipe_context *pipe, } + +static struct sp_sampler_varient * +get_sampler_varient( struct sp_sampler *sampler, + struct pipe_texture *texture, + unsigned processor ) +{ + struct softpipe_texture *sp_texture = softpipe_texture(texture); + struct sp_sampler_varient *v = NULL; + union sp_sampler_key key; + + key.bits.target = sp_texture->base.target; + key.bits.is_pot = sp_texture->pot; + key.bits.processor = processor; + key.bits.pad = 0; + + if (sampler->current && + key.value == sampler->current->key.value) { + v = sampler->current; + } + + if (v == NULL) { + for (v = sampler->varients; v; v = v->next) + if (v->key.value == key.value) + break; + + if (v == NULL) { + v = sp_create_sampler_varient( &sampler->base, key ); + v->next = sampler->varients; + sampler->varients = v; + } + } + + sampler->current = v; + return v; +} + + + + +void +softpipe_reset_sampler_varients(struct softpipe_context *softpipe) +{ + int i; + + /* It's a bit hard to build these samplers ahead of time -- don't + * really know which samplers are going to be used for vertex and + * fragment programs. + */ + for (i = 0; i <= softpipe->vs->max_sampler; i++) { + if (softpipe->sampler[i]) { + softpipe->tgsi.vert_samplers_list[i] = + get_sampler_varient( sp_sampler(softpipe->sampler[i]), + softpipe->texture[i], + TGSI_PROCESSOR_VERTEX ); + + sp_sampler_varient_bind_texture( softpipe->tgsi.vert_samplers_list[i], + softpipe->tex_cache[i], + softpipe->texture[i] ); + } + } + + for (i = 0; i <= softpipe->fs->info.file_max[TGSI_FILE_SAMPLER]; i++) { + if (softpipe->sampler[i]) { + softpipe->tgsi.frag_samplers_list[i] = + get_sampler_varient( sp_sampler(softpipe->sampler[i]), + softpipe->texture[i], + TGSI_PROCESSOR_FRAGMENT ); + + sp_sampler_varient_bind_texture( softpipe->tgsi.frag_samplers_list[i], + softpipe->tex_cache[i], + softpipe->texture[i] ); + } + } +} + + + void softpipe_delete_sampler_state(struct pipe_context *pipe, void *sampler) { + struct sp_sampler *sp_sampler = (struct sp_sampler *)sampler; + struct sp_sampler_varient *v, *tmp; + + for (v = sp_sampler->varients; v; v = tmp) { + tmp = v->next; + sp_sampler_varient_destroy(v); + } + FREE( sampler ); } diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 6c75158d59..7bc689a298 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -31,6 +31,7 @@ * * Authors: * Brian Paul + * Keith Whitwell */ #include "sp_context.h" @@ -116,133 +117,157 @@ lerp_3d(float a, float b, float c, * \param icoord returns the integer texcoords * \return integer texture index */ -static INLINE void -nearest_texcoord_4(unsigned wrapMode, const float s[4], unsigned size, +static void +wrap_nearest_repeat(const float s[4], unsigned size, + int icoord[4]) +{ + uint ch; + + /* s limited to [0,1) */ + /* i limited to [0,size-1] */ + for (ch = 0; ch < 4; ch++) { + int i = util_ifloor(s[ch] * size); + icoord[ch] = REMAINDER(i, size); + } +} + + +static void +wrap_nearest_clamp(const float s[4], unsigned size, int icoord[4]) { uint ch; - switch (wrapMode) { - case PIPE_TEX_WRAP_REPEAT: - /* s limited to [0,1) */ - /* i limited to [0,size-1] */ - for (ch = 0; ch < 4; ch++) { - int i = util_ifloor(s[ch] * size); - icoord[ch] = REMAINDER(i, size); - } - return; - case PIPE_TEX_WRAP_CLAMP: + /* s limited to [0,1] */ + /* i limited to [0,size-1] */ + for (ch = 0; ch < 4; ch++) { + if (s[ch] <= 0.0F) + icoord[ch] = 0; + else if (s[ch] >= 1.0F) + icoord[ch] = size - 1; + else + icoord[ch] = util_ifloor(s[ch] * size); + } +} + + +static void +wrap_nearest_clamp_to_edge(const float s[4], unsigned size, + int icoord[4]) +{ + uint ch; + /* s limited to [min,max] */ + /* i limited to [0, size-1] */ + const float min = 1.0F / (2.0F * size); + const float max = 1.0F - min; + for (ch = 0; ch < 4; ch++) { + if (s[ch] < min) + icoord[ch] = 0; + else if (s[ch] > max) + icoord[ch] = size - 1; + else + icoord[ch] = util_ifloor(s[ch] * size); + } +} + + +static void +wrap_nearest_clamp_to_border(const float s[4], unsigned size, + int icoord[4]) +{ + uint ch; + /* s limited to [min,max] */ + /* i limited to [-1, size] */ + const float min = -1.0F / (2.0F * size); + const float max = 1.0F - min; + for (ch = 0; ch < 4; ch++) { + if (s[ch] <= min) + icoord[ch] = -1; + else if (s[ch] >= max) + icoord[ch] = size; + else + icoord[ch] = util_ifloor(s[ch] * size); + } +} + +static void +wrap_nearest_mirror_repeat(const float s[4], unsigned size, + int icoord[4]) +{ + uint ch; + const float min = 1.0F / (2.0F * size); + const float max = 1.0F - min; + for (ch = 0; ch < 4; ch++) { + const int flr = util_ifloor(s[ch]); + float u; + if (flr & 1) + u = 1.0F - (s[ch] - (float) flr); + else + u = s[ch] - (float) flr; + if (u < min) + icoord[ch] = 0; + else if (u > max) + icoord[ch] = size - 1; + else + icoord[ch] = util_ifloor(u * size); + } +} + +static void +wrap_nearest_mirror_clamp(const float s[4], unsigned size, + int icoord[4]) +{ + uint ch; + for (ch = 0; ch < 4; ch++) { /* s limited to [0,1] */ /* i limited to [0,size-1] */ - for (ch = 0; ch < 4; ch++) { - if (s[ch] <= 0.0F) - icoord[ch] = 0; - else if (s[ch] >= 1.0F) - icoord[ch] = size - 1; - else - icoord[ch] = util_ifloor(s[ch] * size); - } - return; - case PIPE_TEX_WRAP_CLAMP_TO_EDGE: - { - /* s limited to [min,max] */ - /* i limited to [0, size-1] */ - const float min = 1.0F / (2.0F * size); - const float max = 1.0F - min; - for (ch = 0; ch < 4; ch++) { - if (s[ch] < min) - icoord[ch] = 0; - else if (s[ch] > max) - icoord[ch] = size - 1; - else - icoord[ch] = util_ifloor(s[ch] * size); - } - } - return; - case PIPE_TEX_WRAP_CLAMP_TO_BORDER: - { - /* s limited to [min,max] */ - /* i limited to [-1, size] */ - const float min = -1.0F / (2.0F * size); - const float max = 1.0F - min; - for (ch = 0; ch < 4; ch++) { - if (s[ch] <= min) - icoord[ch] = -1; - else if (s[ch] >= max) - icoord[ch] = size; - else - icoord[ch] = util_ifloor(s[ch] * size); - } - } - return; - case PIPE_TEX_WRAP_MIRROR_REPEAT: - { - const float min = 1.0F / (2.0F * size); - const float max = 1.0F - min; - for (ch = 0; ch < 4; ch++) { - const int flr = util_ifloor(s[ch]); - float u; - if (flr & 1) - u = 1.0F - (s[ch] - (float) flr); - else - u = s[ch] - (float) flr; - if (u < min) - icoord[ch] = 0; - else if (u > max) - icoord[ch] = size - 1; - else - icoord[ch] = util_ifloor(u * size); - } - } - return; - case PIPE_TEX_WRAP_MIRROR_CLAMP: - for (ch = 0; ch < 4; ch++) { - /* s limited to [0,1] */ - /* i limited to [0,size-1] */ - const float u = fabsf(s[ch]); - if (u <= 0.0F) - icoord[ch] = 0; - else if (u >= 1.0F) - icoord[ch] = size - 1; - else - icoord[ch] = util_ifloor(u * size); - } - return; - case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: - { - /* s limited to [min,max] */ - /* i limited to [0, size-1] */ - const float min = 1.0F / (2.0F * size); - const float max = 1.0F - min; - for (ch = 0; ch < 4; ch++) { - const float u = fabsf(s[ch]); - if (u < min) - icoord[ch] = 0; - else if (u > max) - icoord[ch] = size - 1; - else - icoord[ch] = util_ifloor(u * size); - } - } - return; - case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: - { - /* s limited to [min,max] */ - /* i limited to [0, size-1] */ - const float min = -1.0F / (2.0F * size); - const float max = 1.0F - min; - for (ch = 0; ch < 4; ch++) { - const float u = fabsf(s[ch]); - if (u < min) - icoord[ch] = -1; - else if (u > max) - icoord[ch] = size; - else - icoord[ch] = util_ifloor(u * size); - } - } - return; - default: - assert(0); + const float u = fabsf(s[ch]); + if (u <= 0.0F) + icoord[ch] = 0; + else if (u >= 1.0F) + icoord[ch] = size - 1; + else + icoord[ch] = util_ifloor(u * size); + } +} + +static void +wrap_nearest_mirror_clamp_to_edge(const float s[4], unsigned size, + int icoord[4]) +{ + uint ch; + /* s limited to [min,max] */ + /* i limited to [0, size-1] */ + const float min = 1.0F / (2.0F * size); + const float max = 1.0F - min; + for (ch = 0; ch < 4; ch++) { + const float u = fabsf(s[ch]); + if (u < min) + icoord[ch] = 0; + else if (u > max) + icoord[ch] = size - 1; + else + icoord[ch] = util_ifloor(u * size); + } +} + + +static void +wrap_nearest_mirror_clamp_to_border(const float s[4], unsigned size, + int icoord[4]) +{ + uint ch; + /* s limited to [min,max] */ + /* i limited to [0, size-1] */ + const float min = -1.0F / (2.0F * size); + const float max = 1.0F - min; + for (ch = 0; ch < 4; ch++) { + const float u = fabsf(s[ch]); + if (u < min) + icoord[ch] = -1; + else if (u > max) + icoord[ch] = size; + else + icoord[ch] = util_ifloor(u * size); } } @@ -257,125 +282,151 @@ nearest_texcoord_4(unsigned wrapMode, const float s[4], unsigned size, * \param w returns blend factor/weight between texture indexes * \param icoord returns the computed integer texture coords */ -static INLINE void -linear_texcoord_4(unsigned wrapMode, const float s[4], unsigned size, +static void +wrap_linear_repeat(const float s[4], unsigned size, + int icoord0[4], int icoord1[4], float w[4]) +{ + uint ch; + + for (ch = 0; ch < 4; ch++) { + float u = s[ch] * size - 0.5F; + icoord0[ch] = REMAINDER(util_ifloor(u), size); + icoord1[ch] = REMAINDER(icoord0[ch] + 1, size); + w[ch] = FRAC(u); + } +} + +static void +wrap_linear_clamp(const float s[4], unsigned size, int icoord0[4], int icoord1[4], float w[4]) { uint ch; + for (ch = 0; ch < 4; ch++) { + float u = CLAMP(s[ch], 0.0F, 1.0F); + u = u * size - 0.5f; + icoord0[ch] = util_ifloor(u); + icoord1[ch] = icoord0[ch] + 1; + w[ch] = FRAC(u); + } +} - switch (wrapMode) { - case PIPE_TEX_WRAP_REPEAT: - for (ch = 0; ch < 4; ch++) { - float u = s[ch] * size - 0.5F; - icoord0[ch] = REMAINDER(util_ifloor(u), size); - icoord1[ch] = REMAINDER(icoord0[ch] + 1, size); - w[ch] = FRAC(u); - } - break;; - case PIPE_TEX_WRAP_CLAMP: - for (ch = 0; ch < 4; ch++) { - float u = CLAMP(s[ch], 0.0F, 1.0F); - u = u * size - 0.5f; - icoord0[ch] = util_ifloor(u); - icoord1[ch] = icoord0[ch] + 1; - w[ch] = FRAC(u); - } - break;; - case PIPE_TEX_WRAP_CLAMP_TO_EDGE: - for (ch = 0; ch < 4; ch++) { - float u = CLAMP(s[ch], 0.0F, 1.0F); - u = u * size - 0.5f; - icoord0[ch] = util_ifloor(u); - icoord1[ch] = icoord0[ch] + 1; - if (icoord0[ch] < 0) - icoord0[ch] = 0; - if (icoord1[ch] >= (int) size) - icoord1[ch] = size - 1; - w[ch] = FRAC(u); - } - break;; - case PIPE_TEX_WRAP_CLAMP_TO_BORDER: - { - const float min = -1.0F / (2.0F * size); - const float max = 1.0F - min; - for (ch = 0; ch < 4; ch++) { - float u = CLAMP(s[ch], min, max); - u = u * size - 0.5f; - icoord0[ch] = util_ifloor(u); - icoord1[ch] = icoord0[ch] + 1; - w[ch] = FRAC(u); - } - } - break;; - case PIPE_TEX_WRAP_MIRROR_REPEAT: - for (ch = 0; ch < 4; ch++) { - const int flr = util_ifloor(s[ch]); - float u; - if (flr & 1) - u = 1.0F - (s[ch] - (float) flr); - else - u = s[ch] - (float) flr; - u = u * size - 0.5F; - icoord0[ch] = util_ifloor(u); - icoord1[ch] = icoord0[ch] + 1; - if (icoord0[ch] < 0) - icoord0[ch] = 0; - if (icoord1[ch] >= (int) size) - icoord1[ch] = size - 1; - w[ch] = FRAC(u); - } - break;; - case PIPE_TEX_WRAP_MIRROR_CLAMP: - for (ch = 0; ch < 4; ch++) { - float u = fabsf(s[ch]); - if (u >= 1.0F) - u = (float) size; - else - u *= size; - u -= 0.5F; - icoord0[ch] = util_ifloor(u); - icoord1[ch] = icoord0[ch] + 1; - w[ch] = FRAC(u); - } - break;; - case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: - for (ch = 0; ch < 4; ch++) { - float u = fabsf(s[ch]); - if (u >= 1.0F) - u = (float) size; - else - u *= size; - u -= 0.5F; - icoord0[ch] = util_ifloor(u); - icoord1[ch] = icoord0[ch] + 1; - if (icoord0[ch] < 0) - icoord0[ch] = 0; - if (icoord1[ch] >= (int) size) - icoord1[ch] = size - 1; - w[ch] = FRAC(u); - } - break;; - case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: - { - const float min = -1.0F / (2.0F * size); - const float max = 1.0F - min; - for (ch = 0; ch < 4; ch++) { - float u = fabsf(s[ch]); - if (u <= min) - u = min * size; - else if (u >= max) - u = max * size; - else - u *= size; - u -= 0.5F; - icoord0[ch] = util_ifloor(u); - icoord1[ch] = icoord0[ch] + 1; - w[ch] = FRAC(u); - } - } - break;; - default: - assert(0); +static void +wrap_linear_clamp_to_edge(const float s[4], unsigned size, + int icoord0[4], int icoord1[4], float w[4]) +{ + uint ch; + for (ch = 0; ch < 4; ch++) { + float u = CLAMP(s[ch], 0.0F, 1.0F); + u = u * size - 0.5f; + icoord0[ch] = util_ifloor(u); + icoord1[ch] = icoord0[ch] + 1; + if (icoord0[ch] < 0) + icoord0[ch] = 0; + if (icoord1[ch] >= (int) size) + icoord1[ch] = size - 1; + w[ch] = FRAC(u); + } +} + +static void +wrap_linear_clamp_to_border(const float s[4], unsigned size, + int icoord0[4], int icoord1[4], float w[4]) +{ + const float min = -1.0F / (2.0F * size); + const float max = 1.0F - min; + uint ch; + for (ch = 0; ch < 4; ch++) { + float u = CLAMP(s[ch], min, max); + u = u * size - 0.5f; + icoord0[ch] = util_ifloor(u); + icoord1[ch] = icoord0[ch] + 1; + w[ch] = FRAC(u); + } +} + + +static void +wrap_linear_mirror_repeat(const float s[4], unsigned size, + int icoord0[4], int icoord1[4], float w[4]) +{ + uint ch; + for (ch = 0; ch < 4; ch++) { + const int flr = util_ifloor(s[ch]); + float u; + if (flr & 1) + u = 1.0F - (s[ch] - (float) flr); + else + u = s[ch] - (float) flr; + u = u * size - 0.5F; + icoord0[ch] = util_ifloor(u); + icoord1[ch] = icoord0[ch] + 1; + if (icoord0[ch] < 0) + icoord0[ch] = 0; + if (icoord1[ch] >= (int) size) + icoord1[ch] = size - 1; + w[ch] = FRAC(u); + } +} + +static void +wrap_linear_mirror_clamp(const float s[4], unsigned size, + int icoord0[4], int icoord1[4], float w[4]) +{ + uint ch; + for (ch = 0; ch < 4; ch++) { + float u = fabsf(s[ch]); + if (u >= 1.0F) + u = (float) size; + else + u *= size; + u -= 0.5F; + icoord0[ch] = util_ifloor(u); + icoord1[ch] = icoord0[ch] + 1; + w[ch] = FRAC(u); + } +} + +static void +wrap_linear_mirror_clamp_to_edge(const float s[4], unsigned size, + int icoord0[4], int icoord1[4], float w[4]) +{ + uint ch; + for (ch = 0; ch < 4; ch++) { + float u = fabsf(s[ch]); + if (u >= 1.0F) + u = (float) size; + else + u *= size; + u -= 0.5F; + icoord0[ch] = util_ifloor(u); + icoord1[ch] = icoord0[ch] + 1; + if (icoord0[ch] < 0) + icoord0[ch] = 0; + if (icoord1[ch] >= (int) size) + icoord1[ch] = size - 1; + w[ch] = FRAC(u); + } +} + +static void +wrap_linear_mirror_clamp_to_border(const float s[4], unsigned size, + int icoord0[4], int icoord1[4], float w[4]) +{ + const float min = -1.0F / (2.0F * size); + const float max = 1.0F - min; + uint ch; + for (ch = 0; ch < 4; ch++) { + float u = fabsf(s[ch]); + if (u <= min) + u = min * size; + else if (u >= max) + u = max * size; + else + u *= size; + u -= 0.5F; + icoord0[ch] = util_ifloor(u); + icoord1[ch] = icoord0[ch] + 1; + w[ch] = FRAC(u); } } @@ -384,27 +435,26 @@ linear_texcoord_4(unsigned wrapMode, const float s[4], unsigned size, * For RECT textures / unnormalized texcoords * Only a subset of wrap modes supported. */ -static INLINE void -nearest_texcoord_unnorm_4(unsigned wrapMode, const float s[4], unsigned size, +static void +wrap_nearest_unorm_clamp(const float s[4], unsigned size, int icoord[4]) { uint ch; - switch (wrapMode) { - case PIPE_TEX_WRAP_CLAMP: - for (ch = 0; ch < 4; ch++) { - int i = util_ifloor(s[ch]); - icoord[ch]= CLAMP(i, 0, (int) size-1); - } - return; - case PIPE_TEX_WRAP_CLAMP_TO_EDGE: - /* fall-through */ - case PIPE_TEX_WRAP_CLAMP_TO_BORDER: - for (ch = 0; ch < 4; ch++) { - icoord[ch]= util_ifloor( CLAMP(s[ch], 0.5F, (float) size - 0.5F) ); - } - return; - default: - assert(0); + for (ch = 0; ch < 4; ch++) { + int i = util_ifloor(s[ch]); + icoord[ch]= CLAMP(i, 0, (int) size-1); + } +} + +/* Handles clamp_to_edge and clamp_to_border: + */ +static void +wrap_nearest_unorm_clamp_to_border(const float s[4], unsigned size, + int icoord[4]) +{ + uint ch; + for (ch = 0; ch < 4; ch++) { + icoord[ch]= util_ifloor( CLAMP(s[ch], 0.5F, (float) size - 0.5F) ); } } @@ -413,157 +463,82 @@ nearest_texcoord_unnorm_4(unsigned wrapMode, const float s[4], unsigned size, * For RECT textures / unnormalized texcoords. * Only a subset of wrap modes supported. */ -static INLINE void -linear_texcoord_unnorm_4(unsigned wrapMode, const float s[4], unsigned size, +static void +wrap_linear_unorm_clamp(const float s[4], unsigned size, int icoord0[4], int icoord1[4], float w[4]) { uint ch; - switch (wrapMode) { - case PIPE_TEX_WRAP_CLAMP: - for (ch = 0; ch < 4; ch++) { - /* Not exactly what the spec says, but it matches NVIDIA output */ - float u = CLAMP(s[ch] - 0.5F, 0.0f, (float) size - 1.0f); - icoord0[ch] = util_ifloor(u); - icoord1[ch] = icoord0[ch] + 1; - w[ch] = FRAC(u); - } - return; - case PIPE_TEX_WRAP_CLAMP_TO_EDGE: - /* fall-through */ - case PIPE_TEX_WRAP_CLAMP_TO_BORDER: - for (ch = 0; ch < 4; ch++) { - float u = CLAMP(s[ch], 0.5F, (float) size - 0.5F); - u -= 0.5F; - icoord0[ch] = util_ifloor(u); - icoord1[ch] = icoord0[ch] + 1; - if (icoord1[ch] > (int) size - 1) - icoord1[ch] = size - 1; - w[ch] = FRAC(u); - } - break; - default: - assert(0); + for (ch = 0; ch < 4; ch++) { + /* Not exactly what the spec says, but it matches NVIDIA output */ + float u = CLAMP(s[ch] - 0.5F, 0.0f, (float) size - 1.0f); + icoord0[ch] = util_ifloor(u); + icoord1[ch] = icoord0[ch] + 1; + w[ch] = FRAC(u); } } - -static unsigned -choose_cube_face(float rx, float ry, float rz, float *newS, float *newT) +static void +wrap_linear_unorm_clamp_to_border( const float s[4], unsigned size, + int icoord0[4], int icoord1[4], float w[4]) { - /* - major axis - direction target sc tc ma - ---------- ------------------------------- --- --- --- - +rx TEXTURE_CUBE_MAP_POSITIVE_X_EXT -rz -ry rx - -rx TEXTURE_CUBE_MAP_NEGATIVE_X_EXT +rz -ry rx - +ry TEXTURE_CUBE_MAP_POSITIVE_Y_EXT +rx +rz ry - -ry TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT +rx -rz ry - +rz TEXTURE_CUBE_MAP_POSITIVE_Z_EXT +rx -ry rz - -rz TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT -rx -ry rz - */ - const float arx = fabsf(rx), ary = fabsf(ry), arz = fabsf(rz); - unsigned face; - float sc, tc, ma; - - if (arx > ary && arx > arz) { - if (rx >= 0.0F) { - face = PIPE_TEX_FACE_POS_X; - sc = -rz; - tc = -ry; - ma = arx; - } - else { - face = PIPE_TEX_FACE_NEG_X; - sc = rz; - tc = -ry; - ma = arx; - } - } - else if (ary > arx && ary > arz) { - if (ry >= 0.0F) { - face = PIPE_TEX_FACE_POS_Y; - sc = rx; - tc = rz; - ma = ary; - } - else { - face = PIPE_TEX_FACE_NEG_Y; - sc = rx; - tc = -rz; - ma = ary; - } - } - else { - if (rz > 0.0F) { - face = PIPE_TEX_FACE_POS_Z; - sc = rx; - tc = -ry; - ma = arz; - } - else { - face = PIPE_TEX_FACE_NEG_Z; - sc = -rx; - tc = -ry; - ma = arz; - } + uint ch; + for (ch = 0; ch < 4; ch++) { + float u = CLAMP(s[ch], 0.5F, (float) size - 0.5F); + u -= 0.5F; + icoord0[ch] = util_ifloor(u); + icoord1[ch] = icoord0[ch] + 1; + if (icoord1[ch] > (int) size - 1) + icoord1[ch] = size - 1; + w[ch] = FRAC(u); } +} + - *newS = ( sc / ma + 1.0F ) * 0.5F; - *newT = ( tc / ma + 1.0F ) * 0.5F; - return face; -} /** * Examine the quad's texture coordinates to compute the partial * derivatives w.r.t X and Y, then compute lambda (level of detail). - * - * This is only done for fragment shaders, not vertex shaders. */ static float -compute_lambda(struct tgsi_sampler *tgsi_sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias) +compute_lambda_1d(const struct sp_sampler_varient *samp, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias) { - const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); const struct pipe_texture *texture = samp->texture; const struct pipe_sampler_state *sampler = samp->sampler; - float rho, lambda; + float dsdx = fabsf(s[QUAD_BOTTOM_RIGHT] - s[QUAD_BOTTOM_LEFT]); + float dsdy = fabsf(s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]); + float rho = MAX2(dsdx, dsdy) * texture->width[0]; + float lambda; - if (samp->processor == TGSI_PROCESSOR_VERTEX) - return lodbias; + lambda = util_fast_log2(rho); + lambda += lodbias + sampler->lod_bias; + lambda = CLAMP(lambda, sampler->min_lod, sampler->max_lod); - assert(sampler->normalized_coords); + return lambda; +} - assert(s); - { - float dsdx = s[QUAD_BOTTOM_RIGHT] - s[QUAD_BOTTOM_LEFT]; - float dsdy = s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]; - dsdx = fabsf(dsdx); - dsdy = fabsf(dsdy); - rho = MAX2(dsdx, dsdy) * texture->width[0]; - } - if (t) { - float dtdx = t[QUAD_BOTTOM_RIGHT] - t[QUAD_BOTTOM_LEFT]; - float dtdy = t[QUAD_TOP_LEFT] - t[QUAD_BOTTOM_LEFT]; - float max; - dtdx = fabsf(dtdx); - dtdy = fabsf(dtdy); - max = MAX2(dtdx, dtdy) * texture->height[0]; - rho = MAX2(rho, max); - } - if (p) { - float dpdx = p[QUAD_BOTTOM_RIGHT] - p[QUAD_BOTTOM_LEFT]; - float dpdy = p[QUAD_TOP_LEFT] - p[QUAD_BOTTOM_LEFT]; - float max; - dpdx = fabsf(dpdx); - dpdy = fabsf(dpdy); - max = MAX2(dpdx, dpdy) * texture->depth[0]; - rho = MAX2(rho, max); - } +static float +compute_lambda_2d(const struct sp_sampler_varient *samp, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias) +{ + const struct pipe_texture *texture = samp->texture; + const struct pipe_sampler_state *sampler = samp->sampler; + float dsdx = fabsf(s[QUAD_BOTTOM_RIGHT] - s[QUAD_BOTTOM_LEFT]); + float dsdy = fabsf(s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]); + float dtdx = fabsf(t[QUAD_BOTTOM_RIGHT] - t[QUAD_BOTTOM_LEFT]); + float dtdy = fabsf(t[QUAD_TOP_LEFT] - t[QUAD_BOTTOM_LEFT]); + float maxx = MAX2(dsdx, dsdy) * texture->width[0]; + float maxy = MAX2(dtdx, dtdy) * texture->height[0]; + float rho = MAX2(maxx, maxy); + float lambda; lambda = util_fast_log2(rho); lambda += lodbias + sampler->lod_bias; @@ -573,88 +548,56 @@ compute_lambda(struct tgsi_sampler *tgsi_sampler, } -/** - * Do several things here: - * 1. Compute lambda from the texcoords, if needed - * 2. Determine if we're minifying or magnifying - * 3. If minifying, choose mipmap levels - * 4. Return image filter to use within mipmap images - * \param level0 Returns first mipmap level to sample from - * \param level1 Returns second mipmap level to sample from - * \param levelBlend Returns blend factor between levels, in [0,1] - * \param imgFilter Returns either the min or mag filter, depending on lambda - */ -static void -choose_mipmap_levels(struct tgsi_sampler *tgsi_sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - unsigned *level0, unsigned *level1, float *levelBlend, - unsigned *imgFilter) +static float +compute_lambda_3d(const struct sp_sampler_varient *samp, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias) { - const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); const struct pipe_texture *texture = samp->texture; const struct pipe_sampler_state *sampler = samp->sampler; + float dsdx = fabsf(s[QUAD_BOTTOM_RIGHT] - s[QUAD_BOTTOM_LEFT]); + float dsdy = fabsf(s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]); + float dtdx = fabsf(t[QUAD_BOTTOM_RIGHT] - t[QUAD_BOTTOM_LEFT]); + float dtdy = fabsf(t[QUAD_TOP_LEFT] - t[QUAD_BOTTOM_LEFT]); + float dpdx = fabsf(p[QUAD_BOTTOM_RIGHT] - p[QUAD_BOTTOM_LEFT]); + float dpdy = fabsf(p[QUAD_TOP_LEFT] - p[QUAD_BOTTOM_LEFT]); + float maxx = MAX2(dsdx, dsdy) * texture->width[0]; + float maxy = MAX2(dtdx, dtdy) * texture->height[0]; + float maxz = MAX2(dpdx, dpdy) * texture->depth[0]; + float rho, lambda; - if (sampler->min_mip_filter == PIPE_TEX_MIPFILTER_NONE) { - /* no mipmap selection needed */ - *level0 = *level1 = CLAMP((int) sampler->min_lod, - 0, (int) texture->last_level); - - if (sampler->min_img_filter != sampler->mag_img_filter) { - /* non-mipmapped texture, but still need to determine if doing - * minification or magnification. - */ - float lambda = compute_lambda(tgsi_sampler, s, t, p, lodbias); - if (lambda <= 0.0) { - *imgFilter = sampler->mag_img_filter; - } - else { - *imgFilter = sampler->min_img_filter; - } - } - else { - *imgFilter = sampler->mag_img_filter; - } - } - else { - float lambda = compute_lambda(tgsi_sampler, s, t, p, lodbias); + rho = MAX2(maxx, maxy); + rho = MAX2(rho, maxz); - if (lambda <= 0.0) { /* XXX threshold depends on the filter */ - /* magnifying */ - *imgFilter = sampler->mag_img_filter; - *level0 = *level1 = 0; - } - else { - /* minifying */ - *imgFilter = sampler->min_img_filter; - - /* choose mipmap level(s) and compute the blend factor between them */ - if (sampler->min_mip_filter == PIPE_TEX_MIPFILTER_NEAREST) { - /* Nearest mipmap level */ - const int lvl = (int) (lambda + 0.5); - *level0 = - *level1 = CLAMP(lvl, 0, (int) texture->last_level); - } - else { - /* Linear interpolation between mipmap levels */ - const int lvl = (int) lambda; - *level0 = CLAMP(lvl, 0, (int) texture->last_level); - *level1 = CLAMP(lvl + 1, 0, (int) texture->last_level); - *levelBlend = FRAC(lambda); /* blending weight between levels */ - } - } - } + lambda = util_fast_log2(rho); + lambda += lodbias + sampler->lod_bias; + lambda = CLAMP(lambda, sampler->min_lod, sampler->max_lod); + + return lambda; } -/** - * Get a texel from a texture, using the texture tile cache. - * - * \param face the cube face in 0..5 - * \param level the mipmap level - * \param x the x coord of texel within 2D image + +static float +compute_lambda_vert(const struct sp_sampler_varient *samp, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias) +{ + return lodbias; +} + + + +/** + * Get a texel from a texture, using the texture tile cache. + * + * \param face the cube face in 0..5 + * \param level the mipmap level + * \param x the x coord of texel within 2D image * \param y the y coord of texel within 2D image * \param z which slice of a 3D texture * \param rgba the quad to put the texel/color into @@ -663,12 +606,12 @@ choose_mipmap_levels(struct tgsi_sampler *tgsi_sampler, * XXX maybe move this into sp_tile_cache.c and merge with the * sp_get_cached_tile_tex() function. Also, get 4 texels instead of 1... */ -static void +static INLINE void get_texel_quad_2d(const struct tgsi_sampler *tgsi_sampler, unsigned face, unsigned level, int x, int y, const float *out[4]) { - const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); + const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); const struct softpipe_cached_tile *tile = sp_get_cached_tile_tex(samp->cache, @@ -687,7 +630,7 @@ static INLINE const float * get_texel_2d_ptr(const struct tgsi_sampler *tgsi_sampler, unsigned face, unsigned level, int x, int y) { - const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); + const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); const struct softpipe_cached_tile *tile = sp_get_cached_tile_tex(samp->cache, @@ -700,7 +643,7 @@ get_texel_2d_ptr(const struct tgsi_sampler *tgsi_sampler, } -static void +static INLINE void get_texel_quad_2d_mt(const struct tgsi_sampler *tgsi_sampler, unsigned face, unsigned level, int x0, int y0, @@ -717,12 +660,12 @@ get_texel_quad_2d_mt(const struct tgsi_sampler *tgsi_sampler, } } -static void +static INLINE void get_texel(const struct tgsi_sampler *tgsi_sampler, unsigned face, unsigned level, int x, int y, int z, float rgba[NUM_CHANNELS][QUAD_SIZE], unsigned j) { - const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); + const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); const struct pipe_texture *texture = samp->texture; const struct pipe_sampler_state *sampler = samp->sampler; @@ -756,140 +699,18 @@ get_texel(const struct tgsi_sampler *tgsi_sampler, } -/** - * Compare texcoord 'p' (aka R) against texture value 'rgba[0]' - * When we sampled the depth texture, the depth value was put into all - * RGBA channels. We look at the red channel here. - * \param rgba quad of (depth) texel values - * \param p texture 'P' components for four pixels in quad - * \param j which pixel in the quad to test [0..3] - */ -static INLINE void -shadow_compare(const struct pipe_sampler_state *sampler, - float rgba[NUM_CHANNELS][QUAD_SIZE], - const float p[QUAD_SIZE], - uint j) -{ - int k; - switch (sampler->compare_func) { - case PIPE_FUNC_LESS: - k = p[j] < rgba[0][j]; - break; - case PIPE_FUNC_LEQUAL: - k = p[j] <= rgba[0][j]; - break; - case PIPE_FUNC_GREATER: - k = p[j] > rgba[0][j]; - break; - case PIPE_FUNC_GEQUAL: - k = p[j] >= rgba[0][j]; - break; - case PIPE_FUNC_EQUAL: - k = p[j] == rgba[0][j]; - break; - case PIPE_FUNC_NOTEQUAL: - k = p[j] != rgba[0][j]; - break; - case PIPE_FUNC_ALWAYS: - k = 1; - break; - case PIPE_FUNC_NEVER: - k = 0; - break; - default: - k = 0; - assert(0); - break; - } - /* XXX returning result for default GL_DEPTH_TEXTURE_MODE = GL_LUMINANCE */ - rgba[0][j] = rgba[1][j] = rgba[2][j] = (float) k; - rgba[3][j] = 1.0F; -} -/** - * As above, but do four z/texture comparisons. - */ static INLINE void -shadow_compare4(const struct pipe_sampler_state *sampler, - float rgba[NUM_CHANNELS][QUAD_SIZE], - const float p[QUAD_SIZE]) -{ - int j, k0, k1, k2, k3; - float val; - - /* compare four texcoords vs. four texture samples */ - switch (sampler->compare_func) { - case PIPE_FUNC_LESS: - k0 = p[0] < rgba[0][0]; - k1 = p[1] < rgba[0][1]; - k2 = p[2] < rgba[0][2]; - k3 = p[3] < rgba[0][3]; - break; - case PIPE_FUNC_LEQUAL: - k0 = p[0] <= rgba[0][0]; - k1 = p[1] <= rgba[0][1]; - k2 = p[2] <= rgba[0][2]; - k3 = p[3] <= rgba[0][3]; - break; - case PIPE_FUNC_GREATER: - k0 = p[0] > rgba[0][0]; - k1 = p[1] > rgba[0][1]; - k2 = p[2] > rgba[0][2]; - k3 = p[3] > rgba[0][3]; - break; - case PIPE_FUNC_GEQUAL: - k0 = p[0] >= rgba[0][0]; - k1 = p[1] >= rgba[0][1]; - k2 = p[2] >= rgba[0][2]; - k3 = p[3] >= rgba[0][3]; - break; - case PIPE_FUNC_EQUAL: - k0 = p[0] == rgba[0][0]; - k1 = p[1] == rgba[0][1]; - k2 = p[2] == rgba[0][2]; - k3 = p[3] == rgba[0][3]; - break; - case PIPE_FUNC_NOTEQUAL: - k0 = p[0] != rgba[0][0]; - k1 = p[1] != rgba[0][1]; - k2 = p[2] != rgba[0][2]; - k3 = p[3] != rgba[0][3]; - break; - case PIPE_FUNC_ALWAYS: - k0 = k1 = k2 = k3 = 1; - break; - case PIPE_FUNC_NEVER: - k0 = k1 = k2 = k3 = 0; - break; - default: - k0 = k1 = k2 = k3 = 0; - assert(0); - break; - } - - /* convert four pass/fail values to an intensity in [0,1] */ - val = 0.25F * (k0 + k1 + k2 + k3); - - /* XXX returning result for default GL_DEPTH_TEXTURE_MODE = GL_LUMINANCE */ - for (j = 0; j < 4; j++) { - rgba[0][j] = rgba[1][j] = rgba[2][j] = val; - rgba[3][j] = 1.0F; - } -} - - - -static void -sp_get_samples_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE]) +img_filter_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) { - const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); + const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); unsigned j; unsigned level = samp->level; unsigned xpot = 1 << (samp->xpot - level); @@ -940,15 +761,15 @@ sp_get_samples_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler, } -static void -sp_get_samples_2d_nearest_repeat_POT(struct tgsi_sampler *tgsi_sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE]) +static INLINE void +img_filter_2d_nearest_repeat_POT(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) { - const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); + const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); unsigned j; unsigned level = samp->level; unsigned xpot = 1 << (samp->xpot - level); @@ -975,15 +796,15 @@ sp_get_samples_2d_nearest_repeat_POT(struct tgsi_sampler *tgsi_sampler, } -static void -sp_get_samples_2d_nearest_clamp_POT(struct tgsi_sampler *tgsi_sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE]) +static INLINE void +img_filter_2d_nearest_clamp_POT(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) { - const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); + const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); unsigned j; unsigned level = samp->level; unsigned xpot = 1 << (samp->xpot - level); @@ -1018,238 +839,78 @@ sp_get_samples_2d_nearest_clamp_POT(struct tgsi_sampler *tgsi_sampler, } } - static void -sp_get_samples_2d_linear_mip_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE]) +img_filter_1d_nearest(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) { - struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); + const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); const struct pipe_texture *texture = samp->texture; - int level0; - float lambda; - - lambda = compute_lambda(tgsi_sampler, s, t, p, lodbias); - level0 = (int)lambda; + unsigned level0, j; + int width; + int x[4]; - if (lambda < 0.0) { - samp->level = 0; - sp_get_samples_2d_linear_repeat_POT( tgsi_sampler, - s, t, p, 0, rgba ); - } - else if (level0 >= texture->last_level) { - samp->level = texture->last_level; - sp_get_samples_2d_linear_repeat_POT( tgsi_sampler, - s, t, p, 0, rgba ); - } - else { - float levelBlend = lambda - level0; - float rgba0[4][4]; - float rgba1[4][4]; - int c,j; + level0 = samp->level; + width = texture->width[level0]; - samp->level = level0; - sp_get_samples_2d_linear_repeat_POT( tgsi_sampler, - s, t, p, 0, rgba0 ); + assert(width > 0); - samp->level = level0+1; - sp_get_samples_2d_linear_repeat_POT( tgsi_sampler, - s, t, p, 0, rgba1 ); + samp->nearest_texcoord_s(s, width, x); - for (j = 0; j < QUAD_SIZE; j++) { - for (c = 0; c < 4; c++) { - rgba[c][j] = lerp(levelBlend, rgba0[c][j], rgba1[c][j]); - } - } + for (j = 0; j < QUAD_SIZE; j++) { + get_texel(tgsi_sampler, 0, level0, x[j], 0, 0, rgba, j); } } -/** - * Common code for sampling 1D/2D/cube textures. - * Could probably extend for 3D... - */ + static void -sp_get_samples_2d_common(struct tgsi_sampler *tgsi_sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE], - const unsigned faces[4]) +img_filter_2d_nearest(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) { - const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); + const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); const struct pipe_texture *texture = samp->texture; - const struct pipe_sampler_state *sampler = samp->sampler; - unsigned level0, level1, j, imgFilter; + const unsigned *faces = samp->faces; /* zero when not cube-mapping */ + unsigned level0, j; int width, height; - float levelBlend; - - choose_mipmap_levels(tgsi_sampler, s, t, p, - lodbias, - &level0, &level1, &levelBlend, &imgFilter); - - assert(sampler->normalized_coords); + int x[4], y[4]; + level0 = samp->level; width = texture->width[level0]; height = texture->height[level0]; assert(width > 0); - switch (imgFilter) { - case PIPE_TEX_FILTER_NEAREST: - { - int x[4], y[4]; - nearest_texcoord_4(sampler->wrap_s, s, width, x); - nearest_texcoord_4(sampler->wrap_t, t, height, y); - - for (j = 0; j < QUAD_SIZE; j++) { - get_texel(tgsi_sampler, faces[j], level0, x[j], y[j], 0, rgba, j); - if (sampler->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) { - shadow_compare(sampler, rgba, p, j); - } - - if (level0 != level1) { - /* get texels from second mipmap level and blend */ - float rgba2[4][4]; - unsigned c; - x[j] /= 2; - y[j] /= 2; - get_texel(tgsi_sampler, faces[j], level1, x[j], y[j], 0, - rgba2, j); - if (sampler->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE){ - shadow_compare(sampler, rgba2, p, j); - } - - for (c = 0; c < NUM_CHANNELS; c++) { - rgba[c][j] = lerp(levelBlend, rgba[c][j], rgba2[c][j]); - } - } - } - } - break; - case PIPE_TEX_FILTER_LINEAR: - case PIPE_TEX_FILTER_ANISO: - { - int x0[4], y0[4], x1[4], y1[4]; - float xw[4], yw[4]; /* weights */ - - linear_texcoord_4(sampler->wrap_s, s, width, x0, x1, xw); - linear_texcoord_4(sampler->wrap_t, t, height, y0, y1, yw); - - for (j = 0; j < QUAD_SIZE; j++) { - float tx[4][4]; /* texels */ - int c; - get_texel(tgsi_sampler, faces[j], level0, x0[j], y0[j], 0, tx, 0); - get_texel(tgsi_sampler, faces[j], level0, x1[j], y0[j], 0, tx, 1); - get_texel(tgsi_sampler, faces[j], level0, x0[j], y1[j], 0, tx, 2); - get_texel(tgsi_sampler, faces[j], level0, x1[j], y1[j], 0, tx, 3); - if (sampler->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) { - shadow_compare4(sampler, tx, p); - } - - /* interpolate R, G, B, A */ - for (c = 0; c < 4; c++) { - rgba[c][j] = lerp_2d(xw[j], yw[j], - tx[c][0], tx[c][1], - tx[c][2], tx[c][3]); - } + samp->nearest_texcoord_s(s, width, x); + samp->nearest_texcoord_t(t, height, y); - if (level0 != level1) { - /* get texels from second mipmap level and blend */ - float rgba2[4][4]; - - /* XXX: This is incorrect -- will often end up with (x0 - * == x1 && y0 == y1), meaning that we fetch the same - * texel four times and linearly interpolate between - * identical values. The correct approach would be to - * call linear_texcoord again for the second level. - */ - x0[j] /= 2; - y0[j] /= 2; - x1[j] /= 2; - y1[j] /= 2; - get_texel(tgsi_sampler, faces[j], level1, x0[j], y0[j], 0, tx, 0); - get_texel(tgsi_sampler, faces[j], level1, x1[j], y0[j], 0, tx, 1); - get_texel(tgsi_sampler, faces[j], level1, x0[j], y1[j], 0, tx, 2); - get_texel(tgsi_sampler, faces[j], level1, x1[j], y1[j], 0, tx, 3); - if (sampler->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE){ - shadow_compare4(sampler, tx, p); - } - - /* interpolate R, G, B, A */ - for (c = 0; c < 4; c++) { - rgba2[c][j] = lerp_2d(xw[j], yw[j], - tx[c][0], tx[c][1], tx[c][2], tx[c][3]); - } - - for (c = 0; c < NUM_CHANNELS; c++) { - rgba[c][j] = lerp(levelBlend, rgba[c][j], rgba2[c][j]); - } - } - } - } - break; - default: - assert(0); + for (j = 0; j < QUAD_SIZE; j++) { + get_texel(tgsi_sampler, faces[j], level0, x[j], y[j], 0, rgba, j); } } -static INLINE void -sp_get_samples_1d(struct tgsi_sampler *sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE]) -{ - static const unsigned faces[4] = {0, 0, 0, 0}; - static const float tzero[4] = {0, 0, 0, 0}; - sp_get_samples_2d_common(sampler, s, tzero, NULL, - lodbias, rgba, faces); -} - - -static INLINE void -sp_get_samples_2d(struct tgsi_sampler *sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE]) -{ - static const unsigned faces[4] = {0, 0, 0, 0}; - sp_get_samples_2d_common(sampler, s, t, p, - lodbias, rgba, faces); -} - - -static INLINE void -sp_get_samples_3d(struct tgsi_sampler *tgsi_sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE]) +static void +img_filter_3d_nearest(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) { - const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); + const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); const struct pipe_texture *texture = samp->texture; - const struct pipe_sampler_state *sampler = samp->sampler; - /* get/map pipe_surfaces corresponding to 3D tex slices */ - unsigned level0, level1, j, imgFilter; + unsigned level0, j; int width, height, depth; - float levelBlend; - const uint face = 0; - - choose_mipmap_levels(tgsi_sampler, s, t, p, - lodbias, - &level0, &level1, &levelBlend, &imgFilter); - - assert(sampler->normalized_coords); + int x[4], y[4], z[4]; + level0 = samp->level; width = texture->width[level0]; height = texture->height[level0]; depth = texture->depth[level0]; @@ -1258,323 +919,746 @@ sp_get_samples_3d(struct tgsi_sampler *tgsi_sampler, assert(height > 0); assert(depth > 0); - switch (imgFilter) { - case PIPE_TEX_FILTER_NEAREST: - { - int x[4], y[4], z[4]; - nearest_texcoord_4(sampler->wrap_s, s, width, x); - nearest_texcoord_4(sampler->wrap_t, t, height, y); - nearest_texcoord_4(sampler->wrap_r, p, depth, z); - for (j = 0; j < QUAD_SIZE; j++) { - get_texel(tgsi_sampler, face, level0, x[j], y[j], z[j], rgba, j); - if (level0 != level1) { - /* get texels from second mipmap level and blend */ - float rgba2[4][4]; - unsigned c; - x[j] /= 2; - y[j] /= 2; - z[j] /= 2; - get_texel(tgsi_sampler, face, level1, x[j], y[j], z[j], rgba2, j); - for (c = 0; c < NUM_CHANNELS; c++) { - rgba[c][j] = lerp(levelBlend, rgba2[c][j], rgba[c][j]); - } - } - } - } - break; - case PIPE_TEX_FILTER_LINEAR: - case PIPE_TEX_FILTER_ANISO: - { - int x0[4], x1[4], y0[4], y1[4], z0[4], z1[4]; - float xw[4], yw[4], zw[4]; /* interpolation weights */ - linear_texcoord_4(sampler->wrap_s, s, width, x0, x1, xw); - linear_texcoord_4(sampler->wrap_t, t, height, y0, y1, yw); - linear_texcoord_4(sampler->wrap_r, p, depth, z0, z1, zw); - - for (j = 0; j < QUAD_SIZE; j++) { - int c; - float tx0[4][4], tx1[4][4]; - get_texel(tgsi_sampler, face, level0, x0[j], y0[j], z0[j], tx0, 0); - get_texel(tgsi_sampler, face, level0, x1[j], y0[j], z0[j], tx0, 1); - get_texel(tgsi_sampler, face, level0, x0[j], y1[j], z0[j], tx0, 2); - get_texel(tgsi_sampler, face, level0, x1[j], y1[j], z0[j], tx0, 3); - get_texel(tgsi_sampler, face, level0, x0[j], y0[j], z1[j], tx1, 0); - get_texel(tgsi_sampler, face, level0, x1[j], y0[j], z1[j], tx1, 1); - get_texel(tgsi_sampler, face, level0, x0[j], y1[j], z1[j], tx1, 2); - get_texel(tgsi_sampler, face, level0, x1[j], y1[j], z1[j], tx1, 3); - - /* interpolate R, G, B, A */ - for (c = 0; c < 4; c++) { - rgba[c][j] = lerp_3d(xw[j], yw[j], zw[j], - tx0[c][0], tx0[c][1], - tx0[c][2], tx0[c][3], - tx1[c][0], tx1[c][1], - tx1[c][2], tx1[c][3]); - } + samp->nearest_texcoord_s(s, width, x); + samp->nearest_texcoord_t(t, height, y); + samp->nearest_texcoord_p(p, depth, z); - if (level0 != level1) { - /* get texels from second mipmap level and blend */ - float rgba2[4][4]; - x0[j] /= 2; - y0[j] /= 2; - z0[j] /= 2; - x1[j] /= 2; - y1[j] /= 2; - z1[j] /= 2; - get_texel(tgsi_sampler, face, level1, x0[j], y0[j], z0[j], tx0, 0); - get_texel(tgsi_sampler, face, level1, x1[j], y0[j], z0[j], tx0, 1); - get_texel(tgsi_sampler, face, level1, x0[j], y1[j], z0[j], tx0, 2); - get_texel(tgsi_sampler, face, level1, x1[j], y1[j], z0[j], tx0, 3); - get_texel(tgsi_sampler, face, level1, x0[j], y0[j], z1[j], tx1, 0); - get_texel(tgsi_sampler, face, level1, x1[j], y0[j], z1[j], tx1, 1); - get_texel(tgsi_sampler, face, level1, x0[j], y1[j], z1[j], tx1, 2); - get_texel(tgsi_sampler, face, level1, x1[j], y1[j], z1[j], tx1, 3); - - /* interpolate R, G, B, A */ - for (c = 0; c < 4; c++) { - rgba2[c][j] = lerp_3d(xw[j], yw[j], zw[j], - tx0[c][0], tx0[c][1], - tx0[c][2], tx0[c][3], - tx1[c][0], tx1[c][1], - tx1[c][2], tx1[c][3]); - } - - /* blend mipmap levels */ - for (c = 0; c < NUM_CHANNELS; c++) { - rgba[c][j] = lerp(levelBlend, rgba[c][j], rgba2[c][j]); - } - } - } - } - break; - default: - assert(0); + for (j = 0; j < QUAD_SIZE; j++) { + get_texel(tgsi_sampler, 0, level0, x[j], y[j], z[j], rgba, j); } } static void -sp_get_samples_cube(struct tgsi_sampler *sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE]) +img_filter_1d_linear(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) { - unsigned faces[QUAD_SIZE], j; - float ssss[4], tttt[4]; + const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + const struct pipe_texture *texture = samp->texture; + unsigned level0, j; + int width; + int x0[4], x1[4]; + float xw[4]; /* weights */ + + + level0 = samp->level; + width = texture->width[level0]; + + assert(width > 0); + + samp->linear_texcoord_s(s, width, x0, x1, xw); + + for (j = 0; j < QUAD_SIZE; j++) { - faces[j] = choose_cube_face(s[j], t[j], p[j], ssss + j, tttt + j); + float tx[4][4]; /* texels */ + int c; + get_texel(tgsi_sampler, 0, level0, x0[j], 0, 0, tx, 0); + get_texel(tgsi_sampler, 0, level0, x1[j], 0, 0, tx, 1); + + /* interpolate R, G, B, A */ + for (c = 0; c < 4; c++) { + rgba[c][j] = lerp(xw[j], tx[c][0], tx[c][1]); + } } - sp_get_samples_2d_common(sampler, ssss, tttt, NULL, - lodbias, rgba, faces); } - static void -sp_get_samples_rect(struct tgsi_sampler *tgsi_sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE]) +img_filter_2d_linear(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) { - const struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); + const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); const struct pipe_texture *texture = samp->texture; - const struct pipe_sampler_state *sampler = samp->sampler; - const uint face = 0; - unsigned level0, level1, j, imgFilter; + const unsigned *faces = samp->faces; /* zero when not cube-mapping */ + unsigned level0, j; int width, height; - float levelBlend; + int x0[4], y0[4], x1[4], y1[4]; + float xw[4], yw[4]; /* weights */ - choose_mipmap_levels(tgsi_sampler, s, t, p, - lodbias, - &level0, &level1, &levelBlend, &imgFilter); - - /* texture RECTS cannot be mipmapped */ - assert(level0 == level1); + level0 = samp->level; width = texture->width[level0]; height = texture->height[level0]; assert(width > 0); - switch (imgFilter) { - case PIPE_TEX_FILTER_NEAREST: - { - int x[4], y[4]; - nearest_texcoord_unnorm_4(sampler->wrap_s, s, width, x); - nearest_texcoord_unnorm_4(sampler->wrap_t, t, height, y); - for (j = 0; j < QUAD_SIZE; j++) { - get_texel(tgsi_sampler, face, level0, x[j], y[j], 0, rgba, j); - if (sampler->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) { - shadow_compare(sampler, rgba, p, j); - } - } + samp->linear_texcoord_s(s, width, x0, x1, xw); + samp->linear_texcoord_s(t, height, y0, y1, yw); + + for (j = 0; j < QUAD_SIZE; j++) { + float tx[4][4]; /* texels */ + int c; + get_texel(tgsi_sampler, faces[j], level0, x0[j], y0[j], 0, tx, 0); + get_texel(tgsi_sampler, faces[j], level0, x1[j], y0[j], 0, tx, 1); + get_texel(tgsi_sampler, faces[j], level0, x0[j], y1[j], 0, tx, 2); + get_texel(tgsi_sampler, faces[j], level0, x1[j], y1[j], 0, tx, 3); + + /* interpolate R, G, B, A */ + for (c = 0; c < 4; c++) { + rgba[c][j] = lerp_2d(xw[j], yw[j], + tx[c][0], tx[c][1], + tx[c][2], tx[c][3]); } - break; - case PIPE_TEX_FILTER_LINEAR: - case PIPE_TEX_FILTER_ANISO: - { - int x0[4], y0[4], x1[4], y1[4]; - float xw[4], yw[4]; /* weights */ - linear_texcoord_unnorm_4(sampler->wrap_s, s, width, x0, x1, xw); - linear_texcoord_unnorm_4(sampler->wrap_t, t, height, y0, y1, yw); - for (j = 0; j < QUAD_SIZE; j++) { - float tx[4][4]; /* texels */ - int c; - get_texel(tgsi_sampler, face, level0, x0[j], y0[j], 0, tx, 0); - get_texel(tgsi_sampler, face, level0, x1[j], y0[j], 0, tx, 1); - get_texel(tgsi_sampler, face, level0, x0[j], y1[j], 0, tx, 2); - get_texel(tgsi_sampler, face, level0, x1[j], y1[j], 0, tx, 3); - if (sampler->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) { - shadow_compare4(sampler, tx, p); - } - for (c = 0; c < 4; c++) { - rgba[c][j] = lerp_2d(xw[j], yw[j], - tx[c][0], tx[c][1], tx[c][2], tx[c][3]); - } + } +} + + +static void +img_filter_3d_linear(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) +{ + const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + const struct pipe_texture *texture = samp->texture; + unsigned level0, j; + int width, height, depth; + int x0[4], x1[4], y0[4], y1[4], z0[4], z1[4]; + float xw[4], yw[4], zw[4]; /* interpolation weights */ + + level0 = samp->level; + width = texture->width[level0]; + height = texture->height[level0]; + depth = texture->depth[level0]; + + assert(width > 0); + assert(height > 0); + assert(depth > 0); + + samp->linear_texcoord_s(s, width, x0, x1, xw); + samp->linear_texcoord_s(t, height, y0, y1, yw); + samp->linear_texcoord_s(p, depth, z0, z1, zw); + + for (j = 0; j < QUAD_SIZE; j++) { + float tx0[4][4], tx1[4][4]; + int c; + + get_texel(tgsi_sampler, 0, level0, x0[j], y0[j], z0[j], tx0, 0); + get_texel(tgsi_sampler, 0, level0, x1[j], y0[j], z0[j], tx0, 1); + get_texel(tgsi_sampler, 0, level0, x0[j], y1[j], z0[j], tx0, 2); + get_texel(tgsi_sampler, 0, level0, x1[j], y1[j], z0[j], tx0, 3); + get_texel(tgsi_sampler, 0, level0, x0[j], y0[j], z1[j], tx1, 0); + get_texel(tgsi_sampler, 0, level0, x1[j], y0[j], z1[j], tx1, 1); + get_texel(tgsi_sampler, 0, level0, x0[j], y1[j], z1[j], tx1, 2); + get_texel(tgsi_sampler, 0, level0, x1[j], y1[j], z1[j], tx1, 3); + + /* interpolate R, G, B, A */ + for (c = 0; c < 4; c++) { + rgba[c][j] = lerp_3d(xw[j], yw[j], zw[j], + tx0[c][0], tx0[c][1], + tx0[c][2], tx0[c][3], + tx1[c][0], tx1[c][1], + tx1[c][2], tx1[c][3]); + } + } +} + + + + + + + +static void +mip_filter_linear(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) +{ + struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + const struct pipe_texture *texture = samp->texture; + int level0; + float lambda; + + lambda = samp->compute_lambda(samp, s, t, p, lodbias); + level0 = (int)lambda; + + if (lambda < 0.0) { + samp->level = 0; + samp->mag_img_filter( tgsi_sampler, s, t, p, 0, rgba ); + } + else if (level0 >= texture->last_level) { + samp->level = texture->last_level; + samp->min_img_filter( tgsi_sampler, s, t, p, 0, rgba ); + } + else { + float levelBlend = lambda - level0; + float rgba0[4][4]; + float rgba1[4][4]; + int c,j; + + samp->level = level0; + samp->min_img_filter( tgsi_sampler, s, t, p, 0, rgba0 ); + + samp->level = level0+1; + samp->min_img_filter( tgsi_sampler, s, t, p, 0, rgba1 ); + + for (j = 0; j < QUAD_SIZE; j++) { + for (c = 0; c < 4; c++) { + rgba[c][j] = lerp(levelBlend, rgba0[c][j], rgba1[c][j]); } } - break; - default: - assert(0); } } -/** - * Error condition handler + +static void +mip_filter_nearest(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) +{ + struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + const struct pipe_texture *texture = samp->texture; + float lambda; + + lambda = samp->compute_lambda(samp, s, t, p, lodbias); + + if (lambda < 0.0) { + samp->level = 0; + samp->mag_img_filter( tgsi_sampler, s, t, p, 0, rgba ); + } + else { + samp->level = (int)(lambda + 0.5) ; + samp->level = MIN2(samp->level, (int)texture->last_level); + samp->min_img_filter( tgsi_sampler, s, t, p, 0, rgba ); + } +} + + +static void +mip_filter_none(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) +{ + struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + float lambda = samp->compute_lambda(samp, s, t, p, lodbias); + + if (lambda < 0.0) { + samp->mag_img_filter( tgsi_sampler, s, t, p, 0, rgba ); + } + else { + samp->min_img_filter( tgsi_sampler, s, t, p, 0, rgba ); + } +} + + + +/* Specialized version of mip_filter_linear with hard-wired calls to + * 2d lambda calculation and 2d_linear_repeat_POT img filters. */ -static INLINE void -sp_get_samples_null(struct tgsi_sampler *tgsi_sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE]) +static void +mip_filter_linear_2d_linear_repeat_POT( + struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) { - int i,j; + struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + const struct pipe_texture *texture = samp->texture; + int level0; + float lambda; - for (i = 0; i < 4; i++) - for (j = 0; j < 4; j++) - rgba[i][j] = 1.0; + lambda = compute_lambda_2d(samp, s, t, p, lodbias); + level0 = (int)lambda; + + /* Catches both negative and large values of level0: + */ + if ((unsigned)level0 >= texture->last_level) { + if (level0 < 0) + samp->level = 0; + else + samp->level = texture->last_level; + + img_filter_2d_linear_repeat_POT( tgsi_sampler, s, t, p, 0, rgba ); + } + else { + float levelBlend = lambda - level0; + float rgba0[4][4]; + float rgba1[4][4]; + int c,j; + + samp->level = level0; + img_filter_2d_linear_repeat_POT( tgsi_sampler, s, t, p, 0, rgba0 ); + + samp->level = level0+1; + img_filter_2d_linear_repeat_POT( tgsi_sampler, s, t, p, 0, rgba1 ); + + for (j = 0; j < QUAD_SIZE; j++) { + for (c = 0; c < 4; c++) { + rgba[c][j] = lerp(levelBlend, rgba0[c][j], rgba1[c][j]); + } + } + } } -/** - * Called via tgsi_sampler::get_samples() when using a sampler for the - * first time. Determine the actual sampler function, link it in and - * call it. + + +/* Compare stage in the little sampling pipeline. */ -void -sp_get_samples(struct tgsi_sampler *tgsi_sampler, +static void +sample_compare(struct tgsi_sampler *tgsi_sampler, const float s[QUAD_SIZE], const float t[QUAD_SIZE], const float p[QUAD_SIZE], float lodbias, float rgba[NUM_CHANNELS][QUAD_SIZE]) { - struct sp_shader_sampler *samp = sp_shader_sampler(tgsi_sampler); - const struct pipe_texture *texture = samp->texture; + struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); const struct pipe_sampler_state *sampler = samp->sampler; + int j, k0, k1, k2, k3; + float val; - /* Default to the 'undefined' case: - */ - tgsi_sampler->get_samples = sp_get_samples_null; + samp->mip_filter( tgsi_sampler, s, t, p, lodbias, rgba ); - if (!texture) { - assert(0); /* is this legal?? */ - goto out; - } - if (!sampler->normalized_coords) { - assert (texture->target == PIPE_TEXTURE_2D); - tgsi_sampler->get_samples = sp_get_samples_rect; - goto out; - } + /** + * Compare texcoord 'p' (aka R) against texture value 'rgba[0]' + * When we sampled the depth texture, the depth value was put into all + * RGBA channels. We look at the red channel here. + */ - switch (texture->target) { - case PIPE_TEXTURE_1D: - tgsi_sampler->get_samples = sp_get_samples_1d; + /* compare four texcoords vs. four texture samples */ + switch (sampler->compare_func) { + case PIPE_FUNC_LESS: + k0 = p[0] < rgba[0][0]; + k1 = p[1] < rgba[0][1]; + k2 = p[2] < rgba[0][2]; + k3 = p[3] < rgba[0][3]; break; - case PIPE_TEXTURE_2D: - tgsi_sampler->get_samples = sp_get_samples_2d; + case PIPE_FUNC_LEQUAL: + k0 = p[0] <= rgba[0][0]; + k1 = p[1] <= rgba[0][1]; + k2 = p[2] <= rgba[0][2]; + k3 = p[3] <= rgba[0][3]; break; - case PIPE_TEXTURE_3D: - tgsi_sampler->get_samples = sp_get_samples_3d; + case PIPE_FUNC_GREATER: + k0 = p[0] > rgba[0][0]; + k1 = p[1] > rgba[0][1]; + k2 = p[2] > rgba[0][2]; + k3 = p[3] > rgba[0][3]; break; - case PIPE_TEXTURE_CUBE: - tgsi_sampler->get_samples = sp_get_samples_cube; + case PIPE_FUNC_GEQUAL: + k0 = p[0] >= rgba[0][0]; + k1 = p[1] >= rgba[0][1]; + k2 = p[2] >= rgba[0][2]; + k3 = p[3] >= rgba[0][3]; + break; + case PIPE_FUNC_EQUAL: + k0 = p[0] == rgba[0][0]; + k1 = p[1] == rgba[0][1]; + k2 = p[2] == rgba[0][2]; + k3 = p[3] == rgba[0][3]; + break; + case PIPE_FUNC_NOTEQUAL: + k0 = p[0] != rgba[0][0]; + k1 = p[1] != rgba[0][1]; + k2 = p[2] != rgba[0][2]; + k3 = p[3] != rgba[0][3]; + break; + case PIPE_FUNC_ALWAYS: + k0 = k1 = k2 = k3 = 1; + break; + case PIPE_FUNC_NEVER: + k0 = k1 = k2 = k3 = 0; break; default: + k0 = k1 = k2 = k3 = 0; assert(0); break; } - /* Do this elsewhere: - */ - samp->xpot = util_unsigned_logbase2( samp->texture->width[0] ); - samp->ypot = util_unsigned_logbase2( samp->texture->height[0] ); + /* convert four pass/fail values to an intensity in [0,1] */ + val = 0.25F * (k0 + k1 + k2 + k3); + + /* XXX returning result for default GL_DEPTH_TEXTURE_MODE = GL_LUMINANCE */ + for (j = 0; j < 4; j++) { + rgba[0][j] = rgba[1][j] = rgba[2][j] = val; + rgba[3][j] = 1.0F; + } +} + +/* Calculate cube faces. + */ +static void +sample_cube(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) +{ + struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + unsigned j; + float ssss[4], tttt[4]; + + /* + major axis + direction target sc tc ma + ---------- ------------------------------- --- --- --- + +rx TEXTURE_CUBE_MAP_POSITIVE_X_EXT -rz -ry rx + -rx TEXTURE_CUBE_MAP_NEGATIVE_X_EXT +rz -ry rx + +ry TEXTURE_CUBE_MAP_POSITIVE_Y_EXT +rx +rz ry + -ry TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT +rx -rz ry + +rz TEXTURE_CUBE_MAP_POSITIVE_Z_EXT +rx -ry rz + -rz TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT -rx -ry rz + */ + for (j = 0; j < QUAD_SIZE; j++) { + float rx = s[j]; + float ry = t[j]; + float rz = p[j]; + const float arx = fabsf(rx), ary = fabsf(ry), arz = fabsf(rz); + unsigned face; + float sc, tc, ma; + + if (arx > ary && arx > arz) { + if (rx >= 0.0F) { + face = PIPE_TEX_FACE_POS_X; + sc = -rz; + tc = -ry; + ma = arx; + } + else { + face = PIPE_TEX_FACE_NEG_X; + sc = rz; + tc = -ry; + ma = arx; + } + } + else if (ary > arx && ary > arz) { + if (ry >= 0.0F) { + face = PIPE_TEX_FACE_POS_Y; + sc = rx; + tc = rz; + ma = ary; + } + else { + face = PIPE_TEX_FACE_NEG_Y; + sc = rx; + tc = -rz; + ma = ary; + } + } + else { + if (rz > 0.0F) { + face = PIPE_TEX_FACE_POS_Z; + sc = rx; + tc = -ry; + ma = arz; + } + else { + face = PIPE_TEX_FACE_NEG_Z; + sc = -rx; + tc = -ry; + ma = arz; + } + } + + ssss[j] = ( sc / ma + 1.0F ) * 0.5F; + tttt[j] = ( tc / ma + 1.0F ) * 0.5F; + samp->faces[j] = face; + } - /* Try to hook in a faster sampler. Ultimately we'll have to - * code-generate these. Luckily most of this looks like it is - * orthogonal state within the sampler. + /* In our little pipeline, the compare stage is next. If compare + * is not active, this will point somewhere deeper into the + * pipeline, eg. to mip_filter or even img_filter. */ - if (texture->target == PIPE_TEXTURE_2D && - sampler->min_img_filter == sampler->mag_img_filter && - sampler->wrap_s == sampler->wrap_t && - sampler->compare_mode == FALSE && - sampler->normalized_coords) - { - if (sampler->min_mip_filter == PIPE_TEX_MIPFILTER_NONE) { - samp->level = CLAMP((int) sampler->min_lod, - 0, (int) texture->last_level); - - if (sampler->wrap_s == PIPE_TEX_WRAP_REPEAT) { - switch (sampler->min_img_filter) { + samp->compare(tgsi_sampler, ssss, tttt, NULL, lodbias, rgba); +} + + + + +static wrap_nearest_func get_nearest_unorm_wrap( unsigned mode ) +{ + switch (mode) { + case PIPE_TEX_WRAP_CLAMP: + return wrap_nearest_unorm_clamp; + case PIPE_TEX_WRAP_CLAMP_TO_EDGE: + case PIPE_TEX_WRAP_CLAMP_TO_BORDER: + return wrap_nearest_unorm_clamp_to_border; + default: + assert(0); + return wrap_nearest_unorm_clamp; + } +} + + +static wrap_nearest_func get_nearest_wrap( unsigned mode ) +{ + switch (mode) { + case PIPE_TEX_WRAP_REPEAT: + return wrap_nearest_repeat; + case PIPE_TEX_WRAP_CLAMP: + return wrap_nearest_clamp; + case PIPE_TEX_WRAP_CLAMP_TO_EDGE: + return wrap_nearest_clamp_to_edge; + case PIPE_TEX_WRAP_CLAMP_TO_BORDER: + return wrap_nearest_clamp_to_border; + case PIPE_TEX_WRAP_MIRROR_REPEAT: + return wrap_nearest_mirror_repeat; + case PIPE_TEX_WRAP_MIRROR_CLAMP: + return wrap_nearest_mirror_clamp; + case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: + return wrap_nearest_mirror_clamp_to_edge; + case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: + return wrap_nearest_mirror_clamp_to_border; + default: + assert(0); + return wrap_nearest_repeat; + } +} + +static wrap_linear_func get_linear_unorm_wrap( unsigned mode ) +{ + switch (mode) { + case PIPE_TEX_WRAP_CLAMP: + return wrap_linear_unorm_clamp; + case PIPE_TEX_WRAP_CLAMP_TO_EDGE: + case PIPE_TEX_WRAP_CLAMP_TO_BORDER: + return wrap_linear_unorm_clamp_to_border; + default: + assert(0); + return wrap_linear_unorm_clamp; + } +} + +static wrap_linear_func get_linear_wrap( unsigned mode ) +{ + switch (mode) { + case PIPE_TEX_WRAP_REPEAT: + return wrap_linear_repeat; + case PIPE_TEX_WRAP_CLAMP: + return wrap_linear_clamp; + case PIPE_TEX_WRAP_CLAMP_TO_EDGE: + return wrap_linear_clamp_to_edge; + case PIPE_TEX_WRAP_CLAMP_TO_BORDER: + return wrap_linear_clamp_to_border; + case PIPE_TEX_WRAP_MIRROR_REPEAT: + return wrap_linear_mirror_repeat; + case PIPE_TEX_WRAP_MIRROR_CLAMP: + return wrap_linear_mirror_clamp; + case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: + return wrap_linear_mirror_clamp_to_edge; + case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: + return wrap_linear_mirror_clamp_to_border; + default: + assert(0); + return wrap_linear_repeat; + } +} + +static compute_lambda_func get_lambda_func( const union sp_sampler_key key ) +{ + if (key.bits.processor == TGSI_PROCESSOR_VERTEX) + return compute_lambda_vert; + + switch (key.bits.target) { + case PIPE_TEXTURE_1D: + return compute_lambda_1d; + case PIPE_TEXTURE_2D: + return compute_lambda_2d; + case PIPE_TEXTURE_3D: + return compute_lambda_3d; + default: + assert(0); + return compute_lambda_1d; + } +} + +static filter_func get_img_filter( const union sp_sampler_key key, + unsigned filter, + const struct pipe_sampler_state *sampler ) +{ + switch (key.bits.target) { + case PIPE_TEXTURE_1D: + if (filter == PIPE_TEX_FILTER_NEAREST) + return img_filter_1d_nearest; + else + return img_filter_1d_linear; + break; + case PIPE_TEXTURE_2D: + /* Try for fast path: + */ + if (key.bits.is_pot && + sampler->wrap_s == sampler->wrap_t && + sampler->normalized_coords) + { + switch (sampler->wrap_s) { + case PIPE_TEX_WRAP_REPEAT: + switch (filter) { case PIPE_TEX_FILTER_NEAREST: - tgsi_sampler->get_samples = sp_get_samples_2d_nearest_repeat_POT; - break; + return img_filter_2d_nearest_repeat_POT; case PIPE_TEX_FILTER_LINEAR: - tgsi_sampler->get_samples = sp_get_samples_2d_linear_repeat_POT; - break; + return img_filter_2d_linear_repeat_POT; default: break; } - } - else if (sampler->wrap_s == PIPE_TEX_WRAP_CLAMP) { - switch (sampler->min_img_filter) { + break; + case PIPE_TEX_WRAP_CLAMP: + switch (filter) { case PIPE_TEX_FILTER_NEAREST: - tgsi_sampler->get_samples = sp_get_samples_2d_nearest_clamp_POT; - break; + return img_filter_2d_nearest_clamp_POT; default: break; } } } - else if (sampler->min_mip_filter == PIPE_TEX_MIPFILTER_LINEAR) { - if (sampler->wrap_s == PIPE_TEX_WRAP_REPEAT) { - switch (sampler->min_img_filter) { - case PIPE_TEX_FILTER_LINEAR: - tgsi_sampler->get_samples = sp_get_samples_2d_linear_mip_linear_repeat_POT; - break; - default: - break; - } - } + /* Fallthrough to default versions: + */ + case PIPE_TEXTURE_CUBE: + if (filter == PIPE_TEX_FILTER_NEAREST) + return img_filter_2d_nearest; + else + return img_filter_2d_linear; + break; + case PIPE_TEXTURE_3D: + if (filter == PIPE_TEX_FILTER_NEAREST) + return img_filter_3d_nearest; + else + return img_filter_3d_linear; + break; + default: + assert(0); + return img_filter_1d_nearest; + } +} + + +void +sp_sampler_varient_bind_texture( struct sp_sampler_varient *samp, + struct softpipe_tile_cache *tex_cache, + const struct pipe_texture *texture ) +{ + const struct pipe_sampler_state *sampler = samp->sampler; + + samp->texture = texture; + samp->cache = tex_cache; + samp->xpot = util_unsigned_logbase2( texture->width[0] ); + samp->ypot = util_unsigned_logbase2( texture->height[0] ); + samp->level = CLAMP((int) sampler->min_lod, 0, (int) texture->last_level); +} + +/* Create a sampler varient for a given set of non-orthogonal state. Currently the + */ +struct sp_sampler_varient * +sp_create_sampler_varient( const struct pipe_sampler_state *sampler, + const union sp_sampler_key key ) +{ + struct sp_sampler_varient *samp = CALLOC_STRUCT(sp_sampler_varient); + if (!samp) + return NULL; + + samp->sampler = sampler; + samp->key = key; + + /* Note that (for instance) linear_texcoord_s and + * nearest_texcoord_s may be active at the same time, if the + * sampler min_img_filter differs from its mag_img_filter. + */ + if (sampler->normalized_coords) { + samp->linear_texcoord_s = get_linear_wrap( sampler->wrap_s ); + samp->linear_texcoord_t = get_linear_wrap( sampler->wrap_t ); + samp->linear_texcoord_p = get_linear_wrap( sampler->wrap_r ); + + samp->nearest_texcoord_s = get_nearest_wrap( sampler->wrap_s ); + samp->nearest_texcoord_t = get_nearest_wrap( sampler->wrap_t ); + samp->nearest_texcoord_p = get_nearest_wrap( sampler->wrap_r ); + } + else { + samp->linear_texcoord_s = get_linear_unorm_wrap( sampler->wrap_s ); + samp->linear_texcoord_t = get_linear_unorm_wrap( sampler->wrap_t ); + samp->linear_texcoord_p = get_linear_unorm_wrap( sampler->wrap_r ); + + samp->nearest_texcoord_s = get_nearest_unorm_wrap( sampler->wrap_s ); + samp->nearest_texcoord_t = get_nearest_unorm_wrap( sampler->wrap_t ); + samp->nearest_texcoord_p = get_nearest_unorm_wrap( sampler->wrap_r ); + } + + samp->compute_lambda = get_lambda_func( key ); + + samp->min_img_filter = get_img_filter(key, sampler->min_img_filter, sampler); + samp->mag_img_filter = get_img_filter(key, sampler->min_img_filter, sampler); + + switch (sampler->min_mip_filter) { + case PIPE_TEX_MIPFILTER_NONE: + if (sampler->min_img_filter == sampler->mag_img_filter) + samp->mip_filter = samp->min_img_filter; + else + samp->mip_filter = mip_filter_none; + break; + + case PIPE_TEX_MIPFILTER_NEAREST: + samp->mip_filter = mip_filter_nearest; + break; + + case PIPE_TEX_MIPFILTER_LINEAR: + if (key.bits.is_pot && + sampler->min_img_filter == sampler->mag_img_filter && + sampler->wrap_s == sampler->wrap_t && + sampler->normalized_coords && + sampler->wrap_s == sampler->wrap_t && + sampler->wrap_s == PIPE_TEX_WRAP_REPEAT && + sampler->min_img_filter == PIPE_TEX_FILTER_LINEAR) + { + samp->mip_filter = mip_filter_linear_2d_linear_repeat_POT; + } + else + { + samp->mip_filter = mip_filter_linear; } + break; + } + + if (sampler->compare_mode != FALSE) { + samp->compare = sample_compare; } - else if (0) { - _debug_printf("target %d/%d min_mip %d/%d min_img %d/%d wrap %d/%d compare %d/%d norm %d/%d\n", - texture->target, PIPE_TEXTURE_2D, - sampler->min_mip_filter, PIPE_TEX_MIPFILTER_NONE, - sampler->min_img_filter, sampler->mag_img_filter, - sampler->wrap_s, sampler->wrap_t, - sampler->compare_mode, FALSE, - sampler->normalized_coords, TRUE); + else { + /* Skip compare operation by promoting the mip_filter function + * pointer: + */ + samp->compare = samp->mip_filter; + } + + if (key.bits.target == PIPE_TEXTURE_CUBE) { + samp->base.get_samples = sample_cube; + } + else { + samp->faces[0] = 0; + samp->faces[1] = 0; + samp->faces[2] = 0; + samp->faces[3] = 0; + + /* Skip cube face determination by promoting the compare + * function pointer: + */ + samp->base.get_samples = samp->compare; } -out: - tgsi_sampler->get_samples( tgsi_sampler, s, t, p, lodbias, rgba ); + return samp; } + + + + + diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.h b/src/gallium/drivers/softpipe/sp_tex_sample.h index c73ae44131..26f80eb88a 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.h +++ b/src/gallium/drivers/softpipe/sp_tex_sample.h @@ -31,14 +31,61 @@ #include "tgsi/tgsi_exec.h" +struct sp_sampler_varient; + +typedef void (*wrap_nearest_func)(const float s[4], + unsigned size, + int icoord[4]); + +typedef void (*wrap_linear_func)(const float s[4], + unsigned size, + int icoord0[4], + int icoord1[4], + float w[4]); + +typedef float (*compute_lambda_func)(const struct sp_sampler_varient *sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias); + +typedef void (*filter_func)(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]); + + +union sp_sampler_key { + struct { + unsigned target:3; + unsigned is_pot:1; + unsigned processor:2; + unsigned pad:26; + } bits; + unsigned value; +}; /** * Subclass of tgsi_sampler */ -struct sp_shader_sampler +struct sp_sampler_varient { struct tgsi_sampler base; /**< base class */ + union sp_sampler_key key; + + /* The owner of this struct: + */ + const struct pipe_sampler_state *sampler; + + + /* Currently bound texture: + */ + const struct pipe_texture *texture; + struct softpipe_tile_cache *cache; + unsigned processor; /* For sp_get_samples_2d_linear_POT: @@ -47,22 +94,51 @@ struct sp_shader_sampler unsigned ypot; unsigned level; - const struct pipe_texture *texture; - const struct pipe_sampler_state *sampler; + unsigned faces[4]; + + wrap_nearest_func nearest_texcoord_s; + wrap_nearest_func nearest_texcoord_t; + wrap_nearest_func nearest_texcoord_p; - struct softpipe_tile_cache *cache; + wrap_linear_func linear_texcoord_s; + wrap_linear_func linear_texcoord_t; + wrap_linear_func linear_texcoord_p; + + filter_func min_img_filter; + filter_func mag_img_filter; + + compute_lambda_func compute_lambda; + + filter_func mip_filter; + filter_func compare; + + /* Linked list: + */ + struct sp_sampler_varient *next; }; +struct sp_sampler; + +/* Create a sampler varient for a given set of non-orthogonal state. Currently the + */ +struct sp_sampler_varient * +sp_create_sampler_varient( const struct pipe_sampler_state *sampler, + const union sp_sampler_key key ); +void sp_sampler_varient_bind_texture( struct sp_sampler_varient *varient, + struct softpipe_tile_cache *tex_cache, + const struct pipe_texture *tex ); -static INLINE struct sp_shader_sampler * -sp_shader_sampler(const struct tgsi_sampler *sampler) -{ - return (struct sp_shader_sampler *) sampler; -} +void sp_sampler_varient_destroy( struct sp_sampler_varient * ); +static INLINE struct sp_sampler_varient * +sp_sampler_varient(const struct tgsi_sampler *sampler) +{ + return (struct sp_sampler_varient *) sampler; +} + extern void sp_get_samples(struct tgsi_sampler *tgsi_sampler, const float s[QUAD_SIZE], diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 0c84375bf1..a3a54dada4 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -120,16 +120,20 @@ softpipe_displaytarget_layout(struct pipe_screen *screen, static struct pipe_texture * softpipe_texture_create(struct pipe_screen *screen, - const struct pipe_texture *templat) + const struct pipe_texture *template) { struct softpipe_texture *spt = CALLOC_STRUCT(softpipe_texture); if (!spt) return NULL; - spt->base = *templat; + spt->base = *template; pipe_reference_init(&spt->base.reference, 1); spt->base.screen = screen; + spt->pot = (util_is_power_of_two(template->width[0]) && + util_is_power_of_two(template->height[0]) && + util_is_power_of_two(template->depth[0])); + if (spt->base.tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET) { if (!softpipe_displaytarget_layout(screen, spt)) goto fail; diff --git a/src/gallium/drivers/softpipe/sp_texture.h b/src/gallium/drivers/softpipe/sp_texture.h index 42df722a2d..4dd0c1239e 100644 --- a/src/gallium/drivers/softpipe/sp_texture.h +++ b/src/gallium/drivers/softpipe/sp_texture.h @@ -48,6 +48,10 @@ struct softpipe_texture */ struct pipe_buffer *buffer; + /* True if texture images are power-of-two in all dimensions: + */ + boolean pot; + unsigned timestamp; }; -- cgit v1.2.3 From 4e5c385d2183e7006c9d7ac0823919156bd4b8e6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 21 Aug 2009 11:40:33 -0600 Subject: softpipe: fix s/t/p typos --- src/gallium/drivers/softpipe/sp_tex_sample.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 7bc689a298..a626731105 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -990,7 +990,7 @@ img_filter_2d_linear(struct tgsi_sampler *tgsi_sampler, assert(width > 0); samp->linear_texcoord_s(s, width, x0, x1, xw); - samp->linear_texcoord_s(t, height, y0, y1, yw); + samp->linear_texcoord_t(t, height, y0, y1, yw); for (j = 0; j < QUAD_SIZE; j++) { float tx[4][4]; /* texels */ @@ -1035,8 +1035,8 @@ img_filter_3d_linear(struct tgsi_sampler *tgsi_sampler, assert(depth > 0); samp->linear_texcoord_s(s, width, x0, x1, xw); - samp->linear_texcoord_s(t, height, y0, y1, yw); - samp->linear_texcoord_s(p, depth, z0, z1, zw); + samp->linear_texcoord_t(t, height, y0, y1, yw); + samp->linear_texcoord_p(p, depth, z0, z1, zw); for (j = 0; j < QUAD_SIZE; j++) { float tx0[4][4], tx1[4][4]; -- cgit v1.2.3 From 41483627f0fd3dc9df2cc55dfd5f3e5987fcfd22 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 21 Aug 2009 11:41:29 -0600 Subject: softpipe: fix min/mag filter typo --- src/gallium/drivers/softpipe/sp_tex_sample.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index a626731105..9502b60479 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -1597,7 +1597,7 @@ sp_create_sampler_varient( const struct pipe_sampler_state *sampler, samp->compute_lambda = get_lambda_func( key ); samp->min_img_filter = get_img_filter(key, sampler->min_img_filter, sampler); - samp->mag_img_filter = get_img_filter(key, sampler->min_img_filter, sampler); + samp->mag_img_filter = get_img_filter(key, sampler->mag_img_filter, sampler); switch (sampler->min_mip_filter) { case PIPE_TEX_MIPFILTER_NONE: -- cgit v1.2.3 From cf102b031e7ef33c8e3ffce2f9dcd064f44e8190 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 21 Aug 2009 11:43:48 -0600 Subject: softpipe: remove redundant comparison, make test easier to understand --- src/gallium/drivers/softpipe/sp_tex_sample.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 9502b60479..51118ae38b 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -1614,10 +1614,9 @@ sp_create_sampler_varient( const struct pipe_sampler_state *sampler, case PIPE_TEX_MIPFILTER_LINEAR: if (key.bits.is_pot && sampler->min_img_filter == sampler->mag_img_filter && - sampler->wrap_s == sampler->wrap_t && sampler->normalized_coords && - sampler->wrap_s == sampler->wrap_t && sampler->wrap_s == PIPE_TEX_WRAP_REPEAT && + sampler->wrap_t == PIPE_TEX_WRAP_REPEAT && sampler->min_img_filter == PIPE_TEX_FILTER_LINEAR) { samp->mip_filter = mip_filter_linear_2d_linear_repeat_POT; -- cgit v1.2.3 From ecfa8be150ed276af816467b467e76e026f5b541 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 21 Aug 2009 18:44:27 +0100 Subject: softpipe: add missing sp_sampler_varient_destroy --- src/gallium/drivers/softpipe/sp_tex_sample.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 51118ae38b..a2e2a221e4 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -1558,6 +1558,14 @@ sp_sampler_varient_bind_texture( struct sp_sampler_varient *samp, samp->level = CLAMP((int) sampler->min_lod, 0, (int) texture->last_level); } + +void +sp_sampler_varient_destroy( struct sp_sampler_varient *samp ) +{ + FREE(samp); +} + + /* Create a sampler varient for a given set of non-orthogonal state. Currently the */ struct sp_sampler_varient * -- cgit v1.2.3 From 87ec83afd58536c31bf02c307f1d5488abc84861 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 21 Aug 2009 11:47:27 -0600 Subject: softpipe: add missing PIPE_TEXTURE_CUBE case in get_lambda_func() Fixes progs/demos/cubemap --- src/gallium/drivers/softpipe/sp_tex_sample.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index a2e2a221e4..f371003708 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -1476,6 +1476,7 @@ static compute_lambda_func get_lambda_func( const union sp_sampler_key key ) case PIPE_TEXTURE_1D: return compute_lambda_1d; case PIPE_TEXTURE_2D: + case PIPE_TEXTURE_CUBE: return compute_lambda_2d; case PIPE_TEXTURE_3D: return compute_lambda_3d; -- cgit v1.2.3 From a29447c33d44b3427e0c40a761067c0cc6e71c39 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 21 Aug 2009 12:11:44 -0600 Subject: softpipe: per-unit sampler varients Can't share sampler varients across multiple tex units because the texture pointer is in the sampler varient. That prevents different textures per unit. Fixes progs/demos/multiarb, progs/glsl/samplers, etc. --- src/gallium/drivers/softpipe/sp_state_sampler.c | 24 ++++++++++++++++++++---- src/gallium/drivers/softpipe/sp_tex_sample.c | 3 +++ src/gallium/drivers/softpipe/sp_tex_sample.h | 3 ++- 3 files changed, 25 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index 714e638048..53210812f4 100644 --- a/src/gallium/drivers/softpipe/sp_state_sampler.c +++ b/src/gallium/drivers/softpipe/sp_state_sampler.c @@ -123,9 +123,19 @@ softpipe_set_sampler_textures(struct pipe_context *pipe, } - +/** + * Find/create an sp_sampler_varient object for sampling the given texture, + * sampler and tex unit. + * + * Note that the tex unit is significant. We can't re-use a sampler + * varient for multiple texture units because the sampler varient contains + * the texture object pointer. If the texture object pointer were stored + * somewhere outside the sampler varient, we could re-use samplers for + * multiple texture units. + */ static struct sp_sampler_varient * -get_sampler_varient( struct sp_sampler *sampler, +get_sampler_varient( unsigned unit, + struct sp_sampler *sampler, struct pipe_texture *texture, unsigned processor ) { @@ -133,9 +143,13 @@ get_sampler_varient( struct sp_sampler *sampler, struct sp_sampler_varient *v = NULL; union sp_sampler_key key; + /* if this fails, widen the key.unit field and update this assertion */ + assert(PIPE_MAX_SAMPLERS <= 16); + key.bits.target = sp_texture->base.target; key.bits.is_pot = sp_texture->pot; key.bits.processor = processor; + key.bits.unit = unit; key.bits.pad = 0; if (sampler->current && @@ -174,7 +188,8 @@ softpipe_reset_sampler_varients(struct softpipe_context *softpipe) for (i = 0; i <= softpipe->vs->max_sampler; i++) { if (softpipe->sampler[i]) { softpipe->tgsi.vert_samplers_list[i] = - get_sampler_varient( sp_sampler(softpipe->sampler[i]), + get_sampler_varient( i, + sp_sampler(softpipe->sampler[i]), softpipe->texture[i], TGSI_PROCESSOR_VERTEX ); @@ -187,7 +202,8 @@ softpipe_reset_sampler_varients(struct softpipe_context *softpipe) for (i = 0; i <= softpipe->fs->info.file_max[TGSI_FILE_SAMPLER]; i++) { if (softpipe->sampler[i]) { softpipe->tgsi.frag_samplers_list[i] = - get_sampler_varient( sp_sampler(softpipe->sampler[i]), + get_sampler_varient( i, + sp_sampler(softpipe->sampler[i]), softpipe->texture[i], TGSI_PROCESSOR_FRAGMENT ); diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index f371003708..8f3dc12d0f 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -1545,6 +1545,9 @@ static filter_func get_img_filter( const union sp_sampler_key key, } +/** + * Bind the given texture object and texture cache to the sampler varient. + */ void sp_sampler_varient_bind_texture( struct sp_sampler_varient *samp, struct softpipe_tile_cache *tex_cache, diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.h b/src/gallium/drivers/softpipe/sp_tex_sample.h index 26f80eb88a..f6cd57ec0a 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.h +++ b/src/gallium/drivers/softpipe/sp_tex_sample.h @@ -62,7 +62,8 @@ union sp_sampler_key { unsigned target:3; unsigned is_pot:1; unsigned processor:2; - unsigned pad:26; + unsigned unit:4; + unsigned pad:22; } bits; unsigned value; }; -- cgit v1.2.3 From 46fbc872881081ffcf0b526f8c4a909fd915ad78 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 21 Aug 2009 13:45:16 -0600 Subject: softpipe: remove unneeded const qualifier --- src/gallium/drivers/softpipe/sp_state_fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c index 3a45321923..a055d6295f 100644 --- a/src/gallium/drivers/softpipe/sp_state_fs.c +++ b/src/gallium/drivers/softpipe/sp_state_fs.c @@ -128,7 +128,7 @@ softpipe_bind_vs_state(struct pipe_context *pipe, void *vs) { struct softpipe_context *softpipe = softpipe_context(pipe); - softpipe->vs = (const struct sp_vertex_shader *)vs; + softpipe->vs = (struct sp_vertex_shader *)vs; draw_bind_vertex_shader(softpipe->draw, (softpipe->vs ? softpipe->vs->draw_data : NULL)); -- cgit v1.2.3 From 4256c5829f8c23f8bd5c7c29491210f0f7813bf9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 21 Aug 2009 13:47:50 -0600 Subject: softpipe: remove unused #includes, white-space clean-up --- src/gallium/drivers/softpipe/sp_state_fs.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c index a055d6295f..256faa94b8 100644 --- a/src/gallium/drivers/softpipe/sp_state_fs.c +++ b/src/gallium/drivers/softpipe/sp_state_fs.c @@ -31,8 +31,6 @@ #include "pipe/p_defines.h" #include "util/u_memory.h" -#include "pipe/internal/p_winsys_screen.h" -#include "pipe/p_shader_tokens.h" #include "draw/draw_context.h" #include "draw/draw_vs.h" #include "tgsi/tgsi_dump.h" @@ -128,7 +126,7 @@ softpipe_bind_vs_state(struct pipe_context *pipe, void *vs) { struct softpipe_context *softpipe = softpipe_context(pipe); - softpipe->vs = (struct sp_vertex_shader *)vs; + softpipe->vs = (struct sp_vertex_shader *) vs; draw_bind_vertex_shader(softpipe->draw, (softpipe->vs ? softpipe->vs->draw_data : NULL)); @@ -142,8 +140,7 @@ softpipe_delete_vs_state(struct pipe_context *pipe, void *vs) { struct softpipe_context *softpipe = softpipe_context(pipe); - struct sp_vertex_shader *state = - (struct sp_vertex_shader *)vs; + struct sp_vertex_shader *state = (struct sp_vertex_shader *) vs; draw_delete_vertex_shader(softpipe->draw, state->draw_data); FREE( state ); -- cgit v1.2.3 From 3adc8c3779895c483ba8a1004939e7dd7d76fa9a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 21 Aug 2009 14:01:58 -0600 Subject: softpipe: minor code refactoring to remove softpipe/tile cache dependencies The tile cache code now has no hard dependencies on softpipe. --- src/gallium/drivers/softpipe/sp_state_derived.c | 13 ++++++++++++- src/gallium/drivers/softpipe/sp_tile_cache.c | 26 ++++++++++++------------- src/gallium/drivers/softpipe/sp_tile_cache.h | 1 - 3 files changed, 24 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index 5310928332..202a2bc94c 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -34,6 +34,8 @@ #include "sp_context.h" #include "sp_screen.h" #include "sp_state.h" +#include "sp_texture.h" +#include "sp_tile_cache.h" /** @@ -201,10 +203,19 @@ update_tgsi_samplers( struct softpipe_context *softpipe ) softpipe_reset_sampler_varients( softpipe ); for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { - sp_tile_cache_validate_texture( softpipe->tex_cache[i] ); + struct softpipe_tile_cache *tc = softpipe->tex_cache[i]; + if (tc->texture) { + struct softpipe_texture *spt = softpipe_texture(tc->texture); + if (spt->timestamp != tc->timestamp) { + sp_tile_cache_validate_texture( tc ); + _debug_printf("INV %d %d\n", tc->timestamp, spt->timestamp); + tc->timestamp = spt->timestamp; + } + } } } + /* Hopefully this will remain quite simple, otherwise need to pull in * something like the state tracker mechanism. */ diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index 77d02fa3e7..e075ab6290 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -35,9 +35,6 @@ #include "pipe/p_inlines.h" #include "util/u_memory.h" #include "util/u_tile.h" -#include "sp_context.h" -#include "sp_surface.h" -#include "sp_texture.h" #include "sp_tile_cache.h" @@ -200,24 +197,25 @@ sp_tile_cache_unmap_transfers(struct softpipe_tile_cache *tc) } } + +/** + * Invalidate all cached tiles for the cached texture. + * Should be called when the texture is modified. + */ void sp_tile_cache_validate_texture(struct softpipe_tile_cache *tc) { - if (tc->texture) { - struct softpipe_texture *spt = softpipe_texture(tc->texture); - if (spt->timestamp != tc->timestamp) { - /* texture was modified, invalidate all cached tiles */ - uint i; - _debug_printf("INV %d %d\n", tc->timestamp, spt->timestamp); - for (i = 0; i < NUM_ENTRIES; i++) { - tc->entries[i].addr.bits.invalid = 1; - } + uint i; - tc->timestamp = spt->timestamp; - } + assert(tc); + assert(tc->texture); + + for (i = 0; i < NUM_ENTRIES; i++) { + tc->entries[i].addr.bits.invalid = 1; } } + /** * Specify the texture to cache. */ diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.h b/src/gallium/drivers/softpipe/sp_tile_cache.h index ac2aae5875..1596cd0ae7 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.h +++ b/src/gallium/drivers/softpipe/sp_tile_cache.h @@ -34,7 +34,6 @@ #include "pipe/p_compiler.h" -struct softpipe_context; struct softpipe_tile_cache; -- cgit v1.2.3 From d204659c8c725c02212ad4a49275c7447f2d02a6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 21 Aug 2009 14:04:47 -0600 Subject: softpipe: remove tex sample dependencies on softpipe The texture sampling code doesn't really have any dependencies on the rest of softpipe, just the tile cache. --- src/gallium/drivers/softpipe/sp_tex_sample.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 8f3dc12d0f..a9efb82491 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -34,17 +34,14 @@ * Keith Whitwell */ -#include "sp_context.h" -#include "sp_quad.h" -#include "sp_surface.h" -#include "sp_texture.h" -#include "sp_tex_sample.h" -#include "sp_tile_cache.h" #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_shader_tokens.h" #include "util/u_math.h" #include "util/u_memory.h" +#include "sp_quad.h" /* only for #define QUAD_* tokens */ +#include "sp_tex_sample.h" +#include "sp_tile_cache.h" -- cgit v1.2.3 From 0f24886f922df3e00094a53b5b37b1588ea84bc0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 21 Aug 2009 14:07:37 -0600 Subject: softpipe: remove duplicate #include, move another --- src/gallium/drivers/softpipe/sp_state_sampler.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index 53210812f4..afc6e1d2eb 100644 --- a/src/gallium/drivers/softpipe/sp_state_sampler.c +++ b/src/gallium/drivers/softpipe/sp_state_sampler.c @@ -31,15 +31,14 @@ #include "util/u_memory.h" +#include "draw/draw_context.h" #include "draw/draw_context.h" -#include "sp_context.h" #include "sp_context.h" #include "sp_state.h" #include "sp_texture.h" #include "sp_tile_cache.h" #include "sp_tex_sample.h" -#include "draw/draw_context.h" struct sp_sampler { -- cgit v1.2.3 From 47800c572f199e7857e02e0f999b410c727a275d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 23 Aug 2009 11:13:20 +0100 Subject: softpipe: add missing header --- src/gallium/drivers/softpipe/sp_context.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 48ec540ebf..3c465c95a5 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -42,6 +42,7 @@ #include "sp_state.h" #include "sp_surface.h" #include "sp_tile_cache.h" +#include "sp_tex_tile_cache.h" #include "sp_texture.h" #include "sp_winsys.h" #include "sp_query.h" -- cgit v1.2.3 From 4fe0fc3eba1f79beda890a5016359d549bab6ad4 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 23 Aug 2009 11:22:41 +0100 Subject: softpipe: remove old prim_setup draw stage Everything now goes through the draw_vbuf handler, the same as regular drivers. --- src/gallium/drivers/softpipe/Makefile | 1 - src/gallium/drivers/softpipe/SConscript | 1 - src/gallium/drivers/softpipe/sp_context.c | 26 ++-- src/gallium/drivers/softpipe/sp_context.h | 5 +- src/gallium/drivers/softpipe/sp_prim_setup.c | 190 ------------------------ src/gallium/drivers/softpipe/sp_prim_setup.h | 85 ----------- src/gallium/drivers/softpipe/sp_prim_vbuf.c | 107 ++++--------- src/gallium/drivers/softpipe/sp_prim_vbuf.h | 4 +- src/gallium/drivers/softpipe/sp_setup.c | 1 - src/gallium/drivers/softpipe/sp_state_derived.c | 25 ++-- 10 files changed, 59 insertions(+), 386 deletions(-) delete mode 100644 src/gallium/drivers/softpipe/sp_prim_setup.c delete mode 100644 src/gallium/drivers/softpipe/sp_prim_setup.h (limited to 'src') diff --git a/src/gallium/drivers/softpipe/Makefile b/src/gallium/drivers/softpipe/Makefile index 3da9be6957..6ab3753762 100644 --- a/src/gallium/drivers/softpipe/Makefile +++ b/src/gallium/drivers/softpipe/Makefile @@ -11,7 +11,6 @@ C_SOURCES = \ sp_query.c \ sp_context.c \ sp_draw_arrays.c \ - sp_prim_setup.c \ sp_prim_vbuf.c \ sp_quad_pipe.c \ sp_quad_stipple.c \ diff --git a/src/gallium/drivers/softpipe/SConscript b/src/gallium/drivers/softpipe/SConscript index 30c099813e..153fe44546 100644 --- a/src/gallium/drivers/softpipe/SConscript +++ b/src/gallium/drivers/softpipe/SConscript @@ -12,7 +12,6 @@ softpipe = env.ConvenienceLibrary( 'sp_context.c', 'sp_draw_arrays.c', 'sp_flush.c', - 'sp_prim_setup.c', 'sp_prim_vbuf.c', 'sp_setup.c', 'sp_quad_alpha_test.c', diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 3c465c95a5..6b75ee6002 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -31,13 +31,13 @@ */ #include "draw/draw_context.h" +#include "draw/draw_vbuf.h" #include "pipe/p_defines.h" #include "util/u_math.h" #include "util/u_memory.h" #include "sp_clear.h" #include "sp_context.h" #include "sp_flush.h" -#include "sp_prim_setup.h" #include "sp_prim_vbuf.h" #include "sp_state.h" #include "sp_surface.h" @@ -242,21 +242,21 @@ softpipe_create( struct pipe_screen *screen ) (struct tgsi_sampler **) softpipe->tgsi.vert_samplers_list); - softpipe->setup = sp_draw_render_stage(softpipe); - if (!softpipe->setup) - goto fail; - if (debug_get_bool_option( "SP_NO_RAST", FALSE )) softpipe->no_rast = TRUE; - if (debug_get_bool_option( "SP_NO_VBUF", FALSE )) { - /* Deprecated path -- vbuf is the intended interface to the draw module: - */ - draw_set_rasterize_stage(softpipe->draw, softpipe->setup); - } - else { - sp_init_vbuf(softpipe); - } + softpipe->vbuf_backend = sp_create_vbuf_backend(softpipe); + if (!softpipe->vbuf_backend) + goto fail; + + softpipe->vbuf = draw_vbuf_stage(softpipe->draw, softpipe->vbuf_backend); + if (!softpipe->vbuf) + goto fail; + + draw_set_rasterize_stage(softpipe->draw, softpipe->vbuf); + draw_set_render(softpipe->draw, softpipe->vbuf_backend); + + /* plug in AA line/point stages */ draw_install_aaline_stage(softpipe->draw, &softpipe->pipe); diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index df45d2249f..43a195c8ef 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -129,9 +129,10 @@ struct softpipe_context { /** The primitive drawing context */ struct draw_context *draw; - struct draw_stage *setup; + + /** Draw module backend */ + struct vbuf_render *vbuf_backend; struct draw_stage *vbuf; - struct softpipe_vbuf_render *vbuf_render; boolean dirty_render_cache; diff --git a/src/gallium/drivers/softpipe/sp_prim_setup.c b/src/gallium/drivers/softpipe/sp_prim_setup.c deleted file mode 100644 index 038ff04d4f..0000000000 --- a/src/gallium/drivers/softpipe/sp_prim_setup.c +++ /dev/null @@ -1,190 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * 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. - * - **************************************************************************/ - -/** - * \brief A draw stage that drives our triangle setup routines from - * within the draw pipeline. One of two ways to drive setup, the - * other being in sp_prim_vbuf.c. - * - * \author Keith Whitwell - * \author Brian Paul - */ - - -#include "sp_context.h" -#include "sp_setup.h" -#include "sp_state.h" -#include "sp_prim_setup.h" -#include "draw/draw_pipe.h" -#include "draw/draw_vertex.h" -#include "util/u_memory.h" - -/** - * Triangle setup info (derived from draw_stage). - * Also used for line drawing (taking some liberties). - */ -struct setup_stage { - struct draw_stage stage; /**< This must be first (base class) */ - - struct setup_context *setup; -}; - - - -/** - * Basically a cast wrapper. - */ -static INLINE struct setup_stage *setup_stage( struct draw_stage *stage ) -{ - return (struct setup_stage *)stage; -} - - -typedef const float (*cptrf4)[4]; - -static void -do_tri(struct draw_stage *stage, struct prim_header *prim) -{ - struct setup_stage *setup = setup_stage( stage ); - - setup_tri( setup->setup, - (cptrf4)prim->v[0]->data, - (cptrf4)prim->v[1]->data, - (cptrf4)prim->v[2]->data ); -} - -static void -do_line(struct draw_stage *stage, struct prim_header *prim) -{ - struct setup_stage *setup = setup_stage( stage ); - - setup_line( setup->setup, - (cptrf4)prim->v[0]->data, - (cptrf4)prim->v[1]->data ); -} - -static void -do_point(struct draw_stage *stage, struct prim_header *prim) -{ - struct setup_stage *setup = setup_stage( stage ); - - setup_point( setup->setup, - (cptrf4)prim->v[0]->data ); -} - - - - -static void setup_begin( struct draw_stage *stage ) -{ - struct setup_stage *setup = setup_stage(stage); - - setup_prepare( setup->setup ); - - stage->point = do_point; - stage->line = do_line; - stage->tri = do_tri; -} - - -static void setup_first_point( struct draw_stage *stage, - struct prim_header *header ) -{ - setup_begin(stage); - stage->point( stage, header ); -} - -static void setup_first_line( struct draw_stage *stage, - struct prim_header *header ) -{ - setup_begin(stage); - stage->line( stage, header ); -} - - -static void setup_first_tri( struct draw_stage *stage, - struct prim_header *header ) -{ - setup_begin(stage); - stage->tri( stage, header ); -} - - - -static void setup_flush( struct draw_stage *stage, - unsigned flags ) -{ - stage->point = setup_first_point; - stage->line = setup_first_line; - stage->tri = setup_first_tri; -} - - -static void reset_stipple_counter( struct draw_stage *stage ) -{ -} - - -static void render_destroy( struct draw_stage *stage ) -{ - struct setup_stage *ssetup = setup_stage(stage); - setup_destroy_context(ssetup->setup); - FREE( stage ); -} - - -/** - * Create a new primitive setup/render stage. - */ -struct draw_stage *sp_draw_render_stage( struct softpipe_context *softpipe ) -{ - struct setup_stage *sstage = CALLOC_STRUCT(setup_stage); - - sstage->setup = setup_create_context(softpipe); - sstage->stage.draw = softpipe->draw; - sstage->stage.point = setup_first_point; - sstage->stage.line = setup_first_line; - sstage->stage.tri = setup_first_tri; - sstage->stage.flush = setup_flush; - sstage->stage.reset_stipple_counter = reset_stipple_counter; - sstage->stage.destroy = render_destroy; - - return (struct draw_stage *)sstage; -} - -struct setup_context * -sp_draw_setup_context( struct draw_stage *stage ) -{ - struct setup_stage *ssetup = setup_stage(stage); - return ssetup->setup; -} - -void -sp_draw_flush( struct draw_stage *stage ) -{ - stage->flush( stage, 0 ); -} diff --git a/src/gallium/drivers/softpipe/sp_prim_setup.h b/src/gallium/drivers/softpipe/sp_prim_setup.h deleted file mode 100644 index 49bdd98ed8..0000000000 --- a/src/gallium/drivers/softpipe/sp_prim_setup.h +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#ifndef SP_PRIM_SETUP_H -#define SP_PRIM_SETUP_H - - -/** - * vbuf is a special stage to gather the stream of triangles, lines, points - * together and reconstruct vertex buffers for hardware upload. - * - * First attempt, work in progress. - * - * TODO: - * - separate out vertex buffer building and primitive emit, ie >1 draw per vb. - * - tell vbuf stage how to build hw vertices directly - * - pass vbuf stage a buffer pointer for direct emit to agp/vram. - * - * - * - * Vertices are just an array of floats, with all the attributes - * packed. We currently assume a layout like: - * - * attr[0][0..3] - window position - * attr[1..n][0..3] - remaining attributes. - * - * Attributes are assumed to be 4 floats wide but are packed so that - * all the enabled attributes run contiguously. - */ - - -struct draw_stage; -struct softpipe_context; - - -typedef void (*vbuf_draw_func)( struct pipe_context *pipe, - unsigned prim, - const ushort *elements, - unsigned nr_elements, - const void *vertex_buffer, - unsigned nr_vertices ); - - -extern struct draw_stage * -sp_draw_render_stage( struct softpipe_context *softpipe ); - -extern struct setup_context * -sp_draw_setup_context( struct draw_stage * ); - -extern void -sp_draw_flush( struct draw_stage * ); - - -extern struct draw_stage * -sp_draw_vbuf_stage( struct draw_context *draw_context, - struct pipe_context *pipe, - vbuf_draw_func draw ); - - -#endif /* SP_PRIM_SETUP_H */ diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c index 76524a8d41..e603c20fc4 100644 --- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c +++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c @@ -37,10 +37,9 @@ #include "sp_context.h" +#include "sp_setup.h" #include "sp_state.h" #include "sp_prim_vbuf.h" -#include "sp_prim_setup.h" -#include "sp_setup.h" #include "draw/draw_context.h" #include "draw/draw_vbuf.h" #include "util/u_memory.h" @@ -59,6 +58,8 @@ struct softpipe_vbuf_render { struct vbuf_render base; struct softpipe_context *softpipe; + struct setup_context *setup; + uint prim; uint vertex_size; uint nr_vertices; @@ -75,6 +76,11 @@ softpipe_vbuf_render(struct vbuf_render *vbr) } + + + + + static const struct vertex_info * sp_vbuf_get_vertex_info(struct vbuf_render *vbr) { @@ -105,36 +111,6 @@ sp_vbuf_allocate_vertices(struct vbuf_render *vbr, static void sp_vbuf_release_vertices(struct vbuf_render *vbr) { -#if 0 - { - struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr); - const struct vertex_info *info = - softpipe_get_vbuf_vertex_info(cvbr->softpipe); - const float *vtx = (const float *) cvbr->vertex_buffer; - uint i, j; - debug_printf("%s (vtx_size = %u, vtx_used = %u)\n", - __FUNCTION__, cvbr->vertex_size, cvbr->nr_vertices); - for (i = 0; i < cvbr->nr_vertices; i++) { - for (j = 0; j < info->num_attribs; j++) { - uint k; - switch (info->attrib[j].emit) { - case EMIT_4F: k = 4; break; - case EMIT_3F: k = 3; break; - case EMIT_2F: k = 2; break; - case EMIT_1F: k = 1; break; - default: assert(0); - } - debug_printf("Vert %u attr %u: ", i, j); - while (k-- > 0) { - debug_printf("%g ", vtx[0]); - vtx++; - } - debug_printf("\n"); - } - } - } -#endif - /* keep the old allocation for next time */ } @@ -160,11 +136,7 @@ static boolean sp_vbuf_set_primitive(struct vbuf_render *vbr, unsigned prim) { struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr); - - /* XXX: break this dependency - make setup_context live under - * softpipe, rename the old "setup" draw stage to something else. - */ - struct setup_context *setup_ctx = sp_draw_setup_context(cvbr->softpipe->setup); + struct setup_context *setup_ctx = cvbr->setup; setup_prepare( setup_ctx ); @@ -193,14 +165,9 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) struct softpipe_context *softpipe = cvbr->softpipe; const unsigned stride = softpipe->vertex_info_vbuf.size * sizeof(float); const void *vertex_buffer = cvbr->vertex_buffer; + struct setup_context *setup_ctx = cvbr->setup; unsigned i; - /* XXX: break this dependency - make setup_context live under - * softpipe, rename the old "setup" draw stage to something else. - */ - struct draw_stage *setup = softpipe->setup; - struct setup_context *setup_ctx = sp_draw_setup_context(setup); - switch (cvbr->prim) { case PIPE_PRIM_POINTS: for (i = 0; i < nr; i++) { @@ -367,11 +334,6 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) default: assert(0); } - - /* XXX: why are we calling this??? If we had to call something, it - * would be a function in sp_setup.c: - */ - sp_draw_flush( setup ); } @@ -384,17 +346,12 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) { struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr); struct softpipe_context *softpipe = cvbr->softpipe; + struct setup_context *setup_ctx = cvbr->setup; const unsigned stride = softpipe->vertex_info_vbuf.size * sizeof(float); const void *vertex_buffer = (void *) get_vert(cvbr->vertex_buffer, start, stride); unsigned i; - /* XXX: break this dependency - make setup_context live under - * softpipe, rename the old "setup" draw stage to something else. - */ - struct draw_stage *setup = softpipe->setup; - struct setup_context *setup_ctx = sp_draw_setup_context(setup); - switch (cvbr->prim) { case PIPE_PRIM_POINTS: for (i = 0; i < nr; i++) { @@ -568,40 +525,38 @@ static void sp_vbuf_destroy(struct vbuf_render *vbr) { struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr); - cvbr->softpipe->vbuf_render = NULL; + setup_destroy_context(cvbr->setup); FREE(cvbr); } /** - * Initialize the post-transform vertex buffer information for the given - * context. + * Create the post-transform vertex handler for the given context. */ -void -sp_init_vbuf(struct softpipe_context *sp) +struct vbuf_render * +sp_create_vbuf_backend(struct softpipe_context *sp) { - assert(sp->draw); + struct softpipe_vbuf_render *cvbr = CALLOC_STRUCT(softpipe_vbuf_render); - sp->vbuf_render = CALLOC_STRUCT(softpipe_vbuf_render); + assert(sp->draw); - sp->vbuf_render->base.max_indices = SP_MAX_VBUF_INDEXES; - sp->vbuf_render->base.max_vertex_buffer_bytes = SP_MAX_VBUF_SIZE; - sp->vbuf_render->base.get_vertex_info = sp_vbuf_get_vertex_info; - sp->vbuf_render->base.allocate_vertices = sp_vbuf_allocate_vertices; - sp->vbuf_render->base.map_vertices = sp_vbuf_map_vertices; - sp->vbuf_render->base.unmap_vertices = sp_vbuf_unmap_vertices; - sp->vbuf_render->base.set_primitive = sp_vbuf_set_primitive; - sp->vbuf_render->base.draw = sp_vbuf_draw; - sp->vbuf_render->base.draw_arrays = sp_vbuf_draw_arrays; - sp->vbuf_render->base.release_vertices = sp_vbuf_release_vertices; - sp->vbuf_render->base.destroy = sp_vbuf_destroy; + cvbr->base.max_indices = SP_MAX_VBUF_INDEXES; + cvbr->base.max_vertex_buffer_bytes = SP_MAX_VBUF_SIZE; - sp->vbuf_render->softpipe = sp; + cvbr->base.get_vertex_info = sp_vbuf_get_vertex_info; + cvbr->base.allocate_vertices = sp_vbuf_allocate_vertices; + cvbr->base.map_vertices = sp_vbuf_map_vertices; + cvbr->base.unmap_vertices = sp_vbuf_unmap_vertices; + cvbr->base.set_primitive = sp_vbuf_set_primitive; + cvbr->base.draw = sp_vbuf_draw; + cvbr->base.draw_arrays = sp_vbuf_draw_arrays; + cvbr->base.release_vertices = sp_vbuf_release_vertices; + cvbr->base.destroy = sp_vbuf_destroy; - sp->vbuf = draw_vbuf_stage(sp->draw, &sp->vbuf_render->base); + cvbr->softpipe = sp; - draw_set_rasterize_stage(sp->draw, sp->vbuf); + cvbr->setup = setup_create_context(cvbr->softpipe); - draw_set_render(sp->draw, &sp->vbuf_render->base); + return &cvbr->base; } diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.h b/src/gallium/drivers/softpipe/sp_prim_vbuf.h index 1de9cc2a89..ad01cc2f28 100644 --- a/src/gallium/drivers/softpipe/sp_prim_vbuf.h +++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.h @@ -31,8 +31,8 @@ struct softpipe_context; -extern void -sp_init_vbuf(struct softpipe_context *softpipe); +extern struct vbuf_render * +sp_create_vbuf_backend(struct softpipe_context *softpipe); #endif /* SP_VBUF_H */ diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c index a132911c99..bc8366b0e6 100644 --- a/src/gallium/drivers/softpipe/sp_setup.c +++ b/src/gallium/drivers/softpipe/sp_setup.c @@ -33,7 +33,6 @@ */ #include "sp_context.h" -#include "sp_prim_setup.h" #include "sp_quad.h" #include "sp_quad_pipe.h" #include "sp_setup.h" diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index 04fc125e3d..2a40589e84 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -68,24 +68,19 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe) const struct sp_fragment_shader *spfs = softpipe->fs; const enum interp_mode colorInterp = softpipe->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR; + struct vertex_info *vinfo_vbuf = &softpipe->vertex_info_vbuf; + const uint num = draw_num_vs_outputs(softpipe->draw); uint i; - if (softpipe->vbuf) { - /* if using the post-transform vertex buffer, tell draw_vbuf to - * simply emit the whole post-xform vertex as-is: - */ - struct vertex_info *vinfo_vbuf = &softpipe->vertex_info_vbuf; - const uint num = draw_num_vs_outputs(softpipe->draw); - uint i; - - /* No longer any need to try and emit draw vertex_header info. - */ - vinfo_vbuf->num_attribs = 0; - for (i = 0; i < num; i++) { - draw_emit_vertex_attr(vinfo_vbuf, EMIT_4F, INTERP_PERSPECTIVE, i); - } - draw_compute_vertex_size(vinfo_vbuf); + /* Tell draw_vbuf to simply emit the whole post-xform vertex + * as-is. No longer any need to try and emit draw vertex_header + * info. + */ + vinfo_vbuf->num_attribs = 0; + for (i = 0; i < num; i++) { + draw_emit_vertex_attr(vinfo_vbuf, EMIT_4F, INTERP_PERSPECTIVE, i); } + draw_compute_vertex_size(vinfo_vbuf); /* * Loop over fragment shader inputs, searching for the matching output -- cgit v1.2.3 From 153e474d22d1b440bb6bd7b04dabf244d7455582 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 23 Aug 2009 13:38:10 +0100 Subject: softpipe: lift tex_address construction up to img_filter For fastpaths at least, can avoid recalculating this sometimes. --- src/gallium/drivers/softpipe/sp_tex_sample.c | 60 ++++++++++++++++------------ 1 file changed, 35 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index d233924565..f2d4f7eb8c 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -605,14 +605,14 @@ compute_lambda_vert(const struct sp_sampler_varient *samp, */ static INLINE void get_texel_quad_2d(const struct tgsi_sampler *tgsi_sampler, - unsigned face, unsigned level, int x, int y, + union tex_tile_address addr, + unsigned x, unsigned y, const float *out[4]) { const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); const struct softpipe_tex_cached_tile *tile - = sp_get_cached_tile_tex(samp->cache, - tex_tile_address(x, y, 0, face, level)); + = sp_get_cached_tile_tex(samp->cache, addr); y %= TILE_SIZE; x %= TILE_SIZE; @@ -625,36 +625,33 @@ get_texel_quad_2d(const struct tgsi_sampler *tgsi_sampler, static INLINE const float * get_texel_2d_ptr(const struct tgsi_sampler *tgsi_sampler, - unsigned face, unsigned level, int x, int y) + union tex_tile_address addr, int x, int y) { const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + const struct softpipe_tex_cached_tile *tile; - const struct softpipe_tex_cached_tile *tile - = sp_get_cached_tile_tex(samp->cache, - tex_tile_address(x, y, 0, face, level)); - + addr.bits.x = x / TILE_SIZE; + addr.bits.y = y / TILE_SIZE; y %= TILE_SIZE; x %= TILE_SIZE; + tile = sp_get_cached_tile_tex(samp->cache, addr); + return &tile->data.color[y][x][0]; } static INLINE void get_texel_quad_2d_mt(const struct tgsi_sampler *tgsi_sampler, - unsigned face, unsigned level, + union tex_tile_address addr, int x0, int y0, int x1, int y1, const float *out[4]) { - unsigned i; - - for (i = 0; i < 4; i++) { - unsigned tx = (i & 1) ? x1 : x0; - unsigned ty = (i >> 1) ? y1 : y0; - - out[i] = get_texel_2d_ptr( tgsi_sampler, face, level, tx, ty ); - } + out[0] = get_texel_2d_ptr( tgsi_sampler, addr, x0, y0 ); + out[1] = get_texel_2d_ptr( tgsi_sampler, addr, x1, y0 ); + out[2] = get_texel_2d_ptr( tgsi_sampler, addr, x0, y1 ); + out[3] = get_texel_2d_ptr( tgsi_sampler, addr, x1, y1 ); } static INLINE void @@ -714,7 +711,12 @@ img_filter_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler, unsigned ypot = 1 << (samp->ypot - level); unsigned xmax = (xpot - 1) & (TILE_SIZE - 1); /* MIN2(TILE_SIZE, xpot) - 1; */ unsigned ymax = (ypot - 1) & (TILE_SIZE - 1); /* MIN2(TILE_SIZE, ypot) - 1; */ - + union tex_tile_address addr; + + addr.value = 0; + addr.bits.level = samp->level; + + for (j = 0; j < QUAD_SIZE; j++) { int c; @@ -730,21 +732,21 @@ img_filter_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler, int x0 = uflr & (xpot - 1); int y0 = vflr & (ypot - 1); - const float *tx[4]; + const float *tx[4]; - /* Can we fetch all four at once: */ if (x0 < xmax && y0 < ymax) { - get_texel_quad_2d(tgsi_sampler, 0, level, x0, y0, tx); + addr.bits.x = x0 / TILE_SIZE; + addr.bits.y = y0 / TILE_SIZE; + get_texel_quad_2d(tgsi_sampler, addr, x0, y0, tx); } else { unsigned x1 = (x0 + 1) & (xpot - 1); unsigned y1 = (y0 + 1) & (ypot - 1); - get_texel_quad_2d_mt(tgsi_sampler, 0, level, - x0, y0, x1, y1, tx); + get_texel_quad_2d_mt(tgsi_sampler, addr, x0, y0, x1, y1, tx); } @@ -771,6 +773,10 @@ img_filter_2d_nearest_repeat_POT(struct tgsi_sampler *tgsi_sampler, unsigned level = samp->level; unsigned xpot = 1 << (samp->xpot - level); unsigned ypot = 1 << (samp->ypot - level); + union tex_tile_address addr; + + addr.value = 0; + addr.bits.level = samp->level; for (j = 0; j < QUAD_SIZE; j++) { int c; @@ -784,7 +790,7 @@ img_filter_2d_nearest_repeat_POT(struct tgsi_sampler *tgsi_sampler, int x0 = uflr & (xpot - 1); int y0 = vflr & (ypot - 1); - const float *out = get_texel_2d_ptr(tgsi_sampler, 0, level, x0, y0); + const float *out = get_texel_2d_ptr(tgsi_sampler, addr, x0, y0); for (c = 0; c < 4; c++) { rgba[c][j] = out[c]; @@ -806,6 +812,10 @@ img_filter_2d_nearest_clamp_POT(struct tgsi_sampler *tgsi_sampler, unsigned level = samp->level; unsigned xpot = 1 << (samp->xpot - level); unsigned ypot = 1 << (samp->ypot - level); + union tex_tile_address addr; + + addr.value = 0; + addr.bits.level = samp->level; for (j = 0; j < QUAD_SIZE; j++) { int c; @@ -828,7 +838,7 @@ img_filter_2d_nearest_clamp_POT(struct tgsi_sampler *tgsi_sampler, else if (y0 > ypot - 1) y0 = ypot - 1; - out = get_texel_2d_ptr(tgsi_sampler, 0, level, x0, y0); + out = get_texel_2d_ptr(tgsi_sampler, addr, x0, y0); for (c = 0; c < 4; c++) { rgba[c][j] = out[c]; -- cgit v1.2.3 From 81601d85ef6b82297b046d5aab1b70e75168c2fa Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 23 Aug 2009 19:14:09 +0100 Subject: softpipe: make the various get_texel routines more similar Remove arguments, return const float * by default. Add specialized 3d versions and remove 3d texture support from the others. --- src/gallium/drivers/softpipe/sp_tex_sample.c | 268 ++++++++++++++++++--------- 1 file changed, 176 insertions(+), 92 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index f2d4f7eb8c..8283010740 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -592,30 +592,68 @@ compute_lambda_vert(const struct sp_sampler_varient *samp, /** * Get a texel from a texture, using the texture tile cache. * - * \param face the cube face in 0..5 - * \param level the mipmap level + * \param addr the template tex address containing cube, z, face info. * \param x the x coord of texel within 2D image * \param y the y coord of texel within 2D image - * \param z which slice of a 3D texture * \param rgba the quad to put the texel/color into - * \param j which element of the rgba quad to write to * * XXX maybe move this into sp_tex_tile_cache.c and merge with the * sp_get_cached_tile_tex() function. Also, get 4 texels instead of 1... */ -static INLINE void -get_texel_quad_2d(const struct tgsi_sampler *tgsi_sampler, - union tex_tile_address addr, - unsigned x, unsigned y, - const float *out[4]) + + + + +static INLINE const float * +get_texel_2d_no_border(const struct sp_sampler_varient *samp, + union tex_tile_address addr, int x, int y) { - const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + const struct softpipe_tex_cached_tile *tile; + + addr.bits.x = x / TILE_SIZE; + addr.bits.y = y / TILE_SIZE; + y %= TILE_SIZE; + x %= TILE_SIZE; + + tile = sp_get_cached_tile_tex(samp->cache, addr); + + return &tile->data.color[y][x][0]; +} + + +static INLINE const float * +get_texel_2d(const struct sp_sampler_varient *samp, + union tex_tile_address addr, int x, int y) +{ + const struct pipe_texture *texture = samp->texture; + unsigned level = addr.bits.level; + + if (x < 0 || x >= (int) texture->width[level] || + y < 0 || y >= (int) texture->height[level]) { + return samp->sampler->border_color; + } + else { + return get_texel_2d_no_border( samp, addr, x, y ); + } +} - const struct softpipe_tex_cached_tile *tile - = sp_get_cached_tile_tex(samp->cache, addr); +/* Gather a quad of adjacent texels within a tile: + */ +static INLINE void +get_texel_quad_2d_no_border_single_tile(const struct sp_sampler_varient *samp, + union tex_tile_address addr, + unsigned x, unsigned y, + const float *out[4]) +{ + const struct softpipe_tex_cached_tile *tile; + + addr.bits.x = x / TILE_SIZE; + addr.bits.y = y / TILE_SIZE; y %= TILE_SIZE; x %= TILE_SIZE; + + tile = sp_get_cached_tile_tex(samp->cache, addr); out[0] = &tile->data.color[y ][x ][0]; out[1] = &tile->data.color[y ][x+1][0]; @@ -623,15 +661,50 @@ get_texel_quad_2d(const struct tgsi_sampler *tgsi_sampler, out[3] = &tile->data.color[y+1][x+1][0]; } + +/* Gather a quad of potentially non-adjacent texels: + */ +static INLINE void +get_texel_quad_2d_no_border(const struct sp_sampler_varient *samp, + union tex_tile_address addr, + int x0, int y0, + int x1, int y1, + const float *out[4]) +{ + out[0] = get_texel_2d_no_border( samp, addr, x0, y0 ); + out[1] = get_texel_2d_no_border( samp, addr, x1, y0 ); + out[2] = get_texel_2d_no_border( samp, addr, x0, y1 ); + out[3] = get_texel_2d_no_border( samp, addr, x1, y1 ); +} + +/* Can involve a lot of unnecessary checks for border color: + */ +static INLINE void +get_texel_quad_2d(const struct sp_sampler_varient *samp, + union tex_tile_address addr, + int x0, int y0, + int x1, int y1, + const float *out[4]) +{ + out[0] = get_texel_2d( samp, addr, x0, y0 ); + out[1] = get_texel_2d( samp, addr, x1, y0 ); + out[3] = get_texel_2d( samp, addr, x1, y1 ); + out[2] = get_texel_2d( samp, addr, x0, y1 ); +} + + + +/* 3d varients: + */ static INLINE const float * -get_texel_2d_ptr(const struct tgsi_sampler *tgsi_sampler, - union tex_tile_address addr, int x, int y) +get_texel_3d_no_border(const struct sp_sampler_varient *samp, + union tex_tile_address addr, int x, int y, int z) { - const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); const struct softpipe_tex_cached_tile *tile; addr.bits.x = x / TILE_SIZE; addr.bits.y = y / TILE_SIZE; + addr.bits.z = z; y %= TILE_SIZE; x %= TILE_SIZE; @@ -641,61 +714,26 @@ get_texel_2d_ptr(const struct tgsi_sampler *tgsi_sampler, } -static INLINE void -get_texel_quad_2d_mt(const struct tgsi_sampler *tgsi_sampler, - union tex_tile_address addr, - int x0, int y0, - int x1, int y1, - const float *out[4]) -{ - out[0] = get_texel_2d_ptr( tgsi_sampler, addr, x0, y0 ); - out[1] = get_texel_2d_ptr( tgsi_sampler, addr, x1, y0 ); - out[2] = get_texel_2d_ptr( tgsi_sampler, addr, x0, y1 ); - out[3] = get_texel_2d_ptr( tgsi_sampler, addr, x1, y1 ); -} - -static INLINE void -get_texel(const struct tgsi_sampler *tgsi_sampler, - unsigned face, unsigned level, int x, int y, int z, - float rgba[NUM_CHANNELS][QUAD_SIZE], unsigned j) +static INLINE const float * +get_texel_3d(const struct sp_sampler_varient *samp, + union tex_tile_address addr, int x, int y, int z ) { - const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); const struct pipe_texture *texture = samp->texture; - const struct pipe_sampler_state *sampler = samp->sampler; + unsigned level = addr.bits.level; if (x < 0 || x >= (int) texture->width[level] || y < 0 || y >= (int) texture->height[level] || z < 0 || z >= (int) texture->depth[level]) { - rgba[0][j] = sampler->border_color[0]; - rgba[1][j] = sampler->border_color[1]; - rgba[2][j] = sampler->border_color[2]; - rgba[3][j] = sampler->border_color[3]; + return samp->sampler->border_color; } else { - const unsigned tx = x % TILE_SIZE; - const unsigned ty = y % TILE_SIZE; - const struct softpipe_tex_cached_tile *tile; - - tile = sp_get_cached_tile_tex(samp->cache, - tex_tile_address(x, y, z, face, level)); - - rgba[0][j] = tile->data.color[ty][tx][0]; - rgba[1][j] = tile->data.color[ty][tx][1]; - rgba[2][j] = tile->data.color[ty][tx][2]; - rgba[3][j] = tile->data.color[ty][tx][3]; - if (0) - { - debug_printf("Get texel %f %f %f %f from %s\n", - rgba[0][j], rgba[1][j], rgba[2][j], rgba[3][j], - pf_name(texture->format)); - } + return get_texel_3d_no_border( samp, addr, x, y, z ); } } - - - +/* Some image-filter fastpaths: + */ static INLINE void img_filter_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler, const float s[QUAD_SIZE], @@ -738,15 +776,13 @@ img_filter_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler, */ if (x0 < xmax && y0 < ymax) { - addr.bits.x = x0 / TILE_SIZE; - addr.bits.y = y0 / TILE_SIZE; - get_texel_quad_2d(tgsi_sampler, addr, x0, y0, tx); + get_texel_quad_2d_no_border_single_tile(samp, addr, x0, y0, tx); } else { unsigned x1 = (x0 + 1) & (xpot - 1); unsigned y1 = (y0 + 1) & (ypot - 1); - get_texel_quad_2d_mt(tgsi_sampler, addr, x0, y0, x1, y1, tx); + get_texel_quad_2d_no_border(samp, addr, x0, y0, x1, y1, tx); } @@ -790,7 +826,7 @@ img_filter_2d_nearest_repeat_POT(struct tgsi_sampler *tgsi_sampler, int x0 = uflr & (xpot - 1); int y0 = vflr & (ypot - 1); - const float *out = get_texel_2d_ptr(tgsi_sampler, addr, x0, y0); + const float *out = get_texel_2d_no_border(samp, addr, x0, y0); for (c = 0; c < 4; c++) { rgba[c][j] = out[c]; @@ -838,7 +874,7 @@ img_filter_2d_nearest_clamp_POT(struct tgsi_sampler *tgsi_sampler, else if (y0 > ypot - 1) y0 = ypot - 1; - out = get_texel_2d_ptr(tgsi_sampler, addr, x0, y0); + out = get_texel_2d_no_border(samp, addr, x0, y0); for (c = 0; c < 4; c++) { rgba[c][j] = out[c]; @@ -859,20 +895,37 @@ img_filter_1d_nearest(struct tgsi_sampler *tgsi_sampler, unsigned level0, j; int width; int x[4]; + union tex_tile_address addr; level0 = samp->level; width = texture->width[level0]; assert(width > 0); + addr.value = 0; + addr.bits.level = samp->level; + samp->nearest_texcoord_s(s, width, x); for (j = 0; j < QUAD_SIZE; j++) { - get_texel(tgsi_sampler, 0, level0, x[j], 0, 0, rgba, j); + const float *out = get_texel_2d(samp, addr, x[j], 0); + int c; + for (c = 0; c < 4; c++) { + rgba[c][j] = out[c]; + } } } + + +static inline union tex_tile_address face( union tex_tile_address addr, + unsigned face ) +{ + addr.bits.face = face; + return addr; +} + static void img_filter_2d_nearest(struct tgsi_sampler *tgsi_sampler, const float s[QUAD_SIZE], @@ -887,18 +940,27 @@ img_filter_2d_nearest(struct tgsi_sampler *tgsi_sampler, unsigned level0, j; int width, height; int x[4], y[4]; + union tex_tile_address addr; + level0 = samp->level; width = texture->width[level0]; height = texture->height[level0]; assert(width > 0); + + addr.value = 0; + addr.bits.level = samp->level; samp->nearest_texcoord_s(s, width, x); samp->nearest_texcoord_t(t, height, y); for (j = 0; j < QUAD_SIZE; j++) { - get_texel(tgsi_sampler, faces[j], level0, x[j], y[j], 0, rgba, j); + const float *out = get_texel_2d(samp, face(addr, faces[j]), x[j], y[j]); + int c; + for (c = 0; c < 4; c++) { + rgba[c][j] = out[c]; + } } } @@ -916,6 +978,7 @@ img_filter_3d_nearest(struct tgsi_sampler *tgsi_sampler, unsigned level0, j; int width, height, depth; int x[4], y[4], z[4]; + union tex_tile_address addr; level0 = samp->level; width = texture->width[level0]; @@ -930,8 +993,15 @@ img_filter_3d_nearest(struct tgsi_sampler *tgsi_sampler, samp->nearest_texcoord_t(t, height, y); samp->nearest_texcoord_p(p, depth, z); + addr.value = 0; + addr.bits.level = samp->level; + for (j = 0; j < QUAD_SIZE; j++) { - get_texel(tgsi_sampler, 0, level0, x[j], y[j], z[j], rgba, j); + const float *out = get_texel_3d(samp, addr, x[j], y[j], z[j]); + int c; + for (c = 0; c < 4; c++) { + rgba[c][j] = out[c]; + } } } @@ -950,6 +1020,7 @@ img_filter_1d_linear(struct tgsi_sampler *tgsi_sampler, int width; int x0[4], x1[4]; float xw[4]; /* weights */ + union tex_tile_address addr; level0 = samp->level; @@ -957,22 +1028,27 @@ img_filter_1d_linear(struct tgsi_sampler *tgsi_sampler, assert(width > 0); + addr.value = 0; + addr.bits.level = samp->level; + samp->linear_texcoord_s(s, width, x0, x1, xw); for (j = 0; j < QUAD_SIZE; j++) { - float tx[4][4]; /* texels */ + const float *tx0 = get_texel_2d(samp, addr, x0[j], 0); + const float *tx1 = get_texel_2d(samp, addr, x1[j], 0); int c; - get_texel(tgsi_sampler, 0, level0, x0[j], 0, 0, tx, 0); - get_texel(tgsi_sampler, 0, level0, x1[j], 0, 0, tx, 1); /* interpolate R, G, B, A */ for (c = 0; c < 4; c++) { - rgba[c][j] = lerp(xw[j], tx[c][0], tx[c][1]); + rgba[c][j] = lerp(xw[j], tx0[c], tx1[c]); } } } + + + static void img_filter_2d_linear(struct tgsi_sampler *tgsi_sampler, const float s[QUAD_SIZE], @@ -988,6 +1064,7 @@ img_filter_2d_linear(struct tgsi_sampler *tgsi_sampler, int width, height; int x0[4], y0[4], x1[4], y1[4]; float xw[4], yw[4]; /* weights */ + union tex_tile_address addr; level0 = samp->level; @@ -996,22 +1073,25 @@ img_filter_2d_linear(struct tgsi_sampler *tgsi_sampler, assert(width > 0); + addr.value = 0; + addr.bits.level = samp->level; + samp->linear_texcoord_s(s, width, x0, x1, xw); samp->linear_texcoord_t(t, height, y0, y1, yw); for (j = 0; j < QUAD_SIZE; j++) { - float tx[4][4]; /* texels */ + union tex_tile_address addrj = face(addr, faces[j]); + const float *tx0 = get_texel_2d(samp, addrj, x0[j], y0[j]); + const float *tx1 = get_texel_2d(samp, addrj, x1[j], y0[j]); + const float *tx2 = get_texel_2d(samp, addrj, x0[j], y1[j]); + const float *tx3 = get_texel_2d(samp, addrj, x1[j], y1[j]); int c; - get_texel(tgsi_sampler, faces[j], level0, x0[j], y0[j], 0, tx, 0); - get_texel(tgsi_sampler, faces[j], level0, x1[j], y0[j], 0, tx, 1); - get_texel(tgsi_sampler, faces[j], level0, x0[j], y1[j], 0, tx, 2); - get_texel(tgsi_sampler, faces[j], level0, x1[j], y1[j], 0, tx, 3); /* interpolate R, G, B, A */ for (c = 0; c < 4; c++) { rgba[c][j] = lerp_2d(xw[j], yw[j], - tx[c][0], tx[c][1], - tx[c][2], tx[c][3]); + tx0[c], tx1[c], + tx2[c], tx3[c]); } } } @@ -1031,12 +1111,16 @@ img_filter_3d_linear(struct tgsi_sampler *tgsi_sampler, int width, height, depth; int x0[4], x1[4], y0[4], y1[4], z0[4], z1[4]; float xw[4], yw[4], zw[4]; /* interpolation weights */ + union tex_tile_address addr; level0 = samp->level; width = texture->width[level0]; height = texture->height[level0]; depth = texture->depth[level0]; + addr.value = 0; + addr.bits.level = level0; + assert(width > 0); assert(height > 0); assert(depth > 0); @@ -1046,25 +1130,25 @@ img_filter_3d_linear(struct tgsi_sampler *tgsi_sampler, samp->linear_texcoord_p(p, depth, z0, z1, zw); for (j = 0; j < QUAD_SIZE; j++) { - float tx0[4][4], tx1[4][4]; int c; - - get_texel(tgsi_sampler, 0, level0, x0[j], y0[j], z0[j], tx0, 0); - get_texel(tgsi_sampler, 0, level0, x1[j], y0[j], z0[j], tx0, 1); - get_texel(tgsi_sampler, 0, level0, x0[j], y1[j], z0[j], tx0, 2); - get_texel(tgsi_sampler, 0, level0, x1[j], y1[j], z0[j], tx0, 3); - get_texel(tgsi_sampler, 0, level0, x0[j], y0[j], z1[j], tx1, 0); - get_texel(tgsi_sampler, 0, level0, x1[j], y0[j], z1[j], tx1, 1); - get_texel(tgsi_sampler, 0, level0, x0[j], y1[j], z1[j], tx1, 2); - get_texel(tgsi_sampler, 0, level0, x1[j], y1[j], z1[j], tx1, 3); + const float *tx00 = get_texel_3d(samp, addr, x0[j], y0[j], z0[j]); + const float *tx01 = get_texel_3d(samp, addr, x1[j], y0[j], z0[j]); + const float *tx02 = get_texel_3d(samp, addr, x0[j], y1[j], z0[j]); + const float *tx03 = get_texel_3d(samp, addr, x1[j], y1[j], z0[j]); + + const float *tx10 = get_texel_3d(samp, addr, x0[j], y0[j], z1[j]); + const float *tx11 = get_texel_3d(samp, addr, x1[j], y0[j], z1[j]); + const float *tx12 = get_texel_3d(samp, addr, x0[j], y1[j], z1[j]); + const float *tx13 = get_texel_3d(samp, addr, x1[j], y1[j], z1[j]); + /* interpolate R, G, B, A */ for (c = 0; c < 4; c++) { rgba[c][j] = lerp_3d(xw[j], yw[j], zw[j], - tx0[c][0], tx0[c][1], - tx0[c][2], tx0[c][3], - tx1[c][0], tx1[c][1], - tx1[c][2], tx1[c][3]); + tx00[c], tx01[c], + tx02[c], tx03[c], + tx10[c], tx11[c], + tx12[c], tx13[c]); } } } -- cgit v1.2.3 From 60adc15ba5633190fc8a68e7c182f06dc7909df4 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 23 Aug 2009 19:17:35 +0100 Subject: softpipe: separate out 2d and cube img filter functions --- src/gallium/drivers/softpipe/sp_tex_sample.c | 92 ++++++++++++++++++++++++++-- 1 file changed, 88 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 8283010740..3bc4599e04 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -917,8 +917,43 @@ img_filter_1d_nearest(struct tgsi_sampler *tgsi_sampler, } +static void +img_filter_2d_nearest(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) +{ + const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + const struct pipe_texture *texture = samp->texture; + unsigned level0, j; + int width, height; + int x[4], y[4]; + union tex_tile_address addr; + level0 = samp->level; + width = texture->width[level0]; + height = texture->height[level0]; + + assert(width > 0); + + addr.value = 0; + addr.bits.level = samp->level; + + samp->nearest_texcoord_s(s, width, x); + samp->nearest_texcoord_t(t, height, y); + + for (j = 0; j < QUAD_SIZE; j++) { + const float *out = get_texel_2d(samp, addr, x[j], y[j]); + int c; + for (c = 0; c < 4; c++) { + rgba[c][j] = out[c]; + } + } +} + static inline union tex_tile_address face( union tex_tile_address addr, unsigned face ) { @@ -927,7 +962,7 @@ static inline union tex_tile_address face( union tex_tile_address addr, } static void -img_filter_2d_nearest(struct tgsi_sampler *tgsi_sampler, +img_filter_cube_nearest(struct tgsi_sampler *tgsi_sampler, const float s[QUAD_SIZE], const float t[QUAD_SIZE], const float p[QUAD_SIZE], @@ -1047,10 +1082,54 @@ img_filter_1d_linear(struct tgsi_sampler *tgsi_sampler, } +static void +img_filter_2d_linear(struct tgsi_sampler *tgsi_sampler, + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) +{ + const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); + const struct pipe_texture *texture = samp->texture; + unsigned level0, j; + int width, height; + int x0[4], y0[4], x1[4], y1[4]; + float xw[4], yw[4]; /* weights */ + union tex_tile_address addr; + + + level0 = samp->level; + width = texture->width[level0]; + height = texture->height[level0]; + + assert(width > 0); + + addr.value = 0; + addr.bits.level = samp->level; + + samp->linear_texcoord_s(s, width, x0, x1, xw); + samp->linear_texcoord_t(t, height, y0, y1, yw); + + for (j = 0; j < QUAD_SIZE; j++) { + const float *tx0 = get_texel_2d(samp, addr, x0[j], y0[j]); + const float *tx1 = get_texel_2d(samp, addr, x1[j], y0[j]); + const float *tx2 = get_texel_2d(samp, addr, x0[j], y1[j]); + const float *tx3 = get_texel_2d(samp, addr, x1[j], y1[j]); + int c; + + /* interpolate R, G, B, A */ + for (c = 0; c < 4; c++) { + rgba[c][j] = lerp_2d(xw[j], yw[j], + tx0[c], tx1[c], + tx2[c], tx3[c]); + } + } +} static void -img_filter_2d_linear(struct tgsi_sampler *tgsi_sampler, +img_filter_cube_linear(struct tgsi_sampler *tgsi_sampler, const float s[QUAD_SIZE], const float t[QUAD_SIZE], const float p[QUAD_SIZE], @@ -1615,14 +1694,19 @@ static filter_func get_img_filter( const union sp_sampler_key key, } } } - /* Fallthrough to default versions: + /* Otherwise use default versions: */ - case PIPE_TEXTURE_CUBE: if (filter == PIPE_TEX_FILTER_NEAREST) return img_filter_2d_nearest; else return img_filter_2d_linear; break; + case PIPE_TEXTURE_CUBE: + if (filter == PIPE_TEX_FILTER_NEAREST) + return img_filter_cube_nearest; + else + return img_filter_cube_linear; + break; case PIPE_TEXTURE_3D: if (filter == PIPE_TEX_FILTER_NEAREST) return img_filter_3d_nearest; -- cgit v1.2.3 From fd19e8adcd82e88d0fc8d187360b528100fed244 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 23 Aug 2009 19:28:34 +0100 Subject: softpipe: use one fewer divide in sample_cube GCC won't do this for us. Makes a bigger difference to cubemap fps than previous set of compilcated rearrangements. --- src/gallium/drivers/softpipe/sp_tex_sample.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 3bc4599e04..50460df7cd 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -1543,9 +1543,12 @@ sample_cube(struct tgsi_sampler *tgsi_sampler, } } - ssss[j] = ( sc / ma + 1.0F ) * 0.5F; - tttt[j] = ( tc / ma + 1.0F ) * 0.5F; - samp->faces[j] = face; + { + const float ima = 1.0 / ma; + ssss[j] = ( sc * ima + 1.0F ) * 0.5F; + tttt[j] = ( tc * ima + 1.0F ) * 0.5F; + samp->faces[j] = face; + } } /* In our little pipeline, the compare stage is next. If compare -- cgit v1.2.3 From 67d4a5b15cfd8583c19a5776b0ec1564b60239eb Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 23 Aug 2009 23:50:27 +0100 Subject: mesa/swrast: use one fewer divide in swrast's choose_cube_face also Same change as for softpipe --- src/mesa/swrast/s_texfilter.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 6b1f934647..216c107e3f 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -1905,8 +1905,12 @@ choose_cube_face(const struct gl_texture_object *texObj, } } - newCoord[0] = ( sc / ma + 1.0F ) * 0.5F; - newCoord[1] = ( tc / ma + 1.0F ) * 0.5F; + { + const float ima = 1.0F / ma; + newCoord[0] = ( sc * ima + 1.0F ) * 0.5F; + newCoord[1] = ( tc * ima + 1.0F ) * 0.5F; + } + return (const struct gl_texture_image **) texObj->Image[face]; } -- cgit v1.2.3 From d6d71e5bf4a720a1ee84c96231aec539ec17a7c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sun, 30 Aug 2009 12:49:53 +0200 Subject: r300: Move Mesa -> RC program conversion to classic Mesa driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This really doesn't belong into the compiler itself, since the compiler should eventually be independent of Mesa's program representation. Signed-off-by: Nicolai Hähnle --- src/mesa/drivers/dri/r300/Makefile | 1 + .../drivers/dri/r300/compiler/radeon_compiler.h | 2 - .../drivers/dri/r300/compiler/radeon_program.c | 26 ---------- src/mesa/drivers/dri/r300/r300_fragprog_common.c | 3 +- src/mesa/drivers/dri/r300/r300_vertprog.c | 3 +- src/mesa/drivers/dri/r300/radeon_mesa_to_rc.c | 60 ++++++++++++++++++++++ src/mesa/drivers/dri/r300/radeon_mesa_to_rc.h | 36 +++++++++++++ 7 files changed, 101 insertions(+), 30 deletions(-) create mode 100644 src/mesa/drivers/dri/r300/radeon_mesa_to_rc.c create mode 100644 src/mesa/drivers/dri/r300/radeon_mesa_to_rc.h (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/Makefile b/src/mesa/drivers/dri/r300/Makefile index 188efcb7a0..5d1e2c0adc 100644 --- a/src/mesa/drivers/dri/r300/Makefile +++ b/src/mesa/drivers/dri/r300/Makefile @@ -53,6 +53,7 @@ DRIVER_SOURCES = \ r300_vertprog.c \ r300_fragprog_common.c \ r300_shader.c \ + radeon_mesa_to_rc.c \ r300_emit.c \ r300_swtcl.c \ $(RADEON_COMMON_SOURCES) \ diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h index e63ab8840a..fbe7c37dd1 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h @@ -67,8 +67,6 @@ void rc_destroy(struct radeon_compiler * c); void rc_debug(struct radeon_compiler * c, const char * fmt, ...); void rc_error(struct radeon_compiler * c, const char * fmt, ...); -void rc_mesa_to_rc_program(struct radeon_compiler * c, struct gl_program * program); - void rc_calculate_inputs_outputs(struct radeon_compiler * c); void rc_move_input(struct radeon_compiler * c, unsigned input, struct prog_src_register new_input); diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.c b/src/mesa/drivers/dri/r300/compiler/radeon_program.c index bbbf0dd776..bf7f9ac92c 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.c @@ -136,32 +136,6 @@ void rc_remove_instruction(struct rc_instruction * inst) } -void rc_mesa_to_rc_program(struct radeon_compiler * c, struct gl_program * program) -{ - struct prog_instruction *source; - unsigned int i; - - for(source = program->Instructions; source->Opcode != OPCODE_END; ++source) { - struct rc_instruction * dest = rc_insert_new_instruction(c, c->Program.Instructions.Prev); - dest->I = *source; - } - - c->Program.ShadowSamplers = program->ShadowSamplers; - c->Program.InputsRead = program->InputsRead; - c->Program.OutputsWritten = program->OutputsWritten; - - for(i = 0; i < program->Parameters->NumParameters; ++i) { - struct rc_constant constant; - - constant.Type = RC_CONSTANT_EXTERNAL; - constant.Size = 4; - constant.u.External = i; - - rc_constants_add(&c->Program.Constants, &constant); - } -} - - /** * Print program to stderr, default options. */ diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c index e1dc231027..ea6ff03e61 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c @@ -44,6 +44,7 @@ #include "compiler/radeon_compiler.h" +#include "radeon_mesa_to_rc.h" #include "r300_state.h" @@ -218,7 +219,7 @@ static void translate_fragment_program(GLcontext *ctx, struct r300_fragment_prog fflush(stderr); } - rc_mesa_to_rc_program(&compiler.Base, &cont->Base.Base); + radeon_mesa_to_rc_program(&compiler.Base, &cont->Base.Base); insert_WPOS_trailer(&compiler, fp); diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 9fe6c18f56..be21268ba5 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -42,6 +42,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "compiler/radeon_compiler.h" #include "compiler/radeon_nqssadce.h" +#include "radeon_mesa_to_rc.h" #include "r300_context.h" #include "r300_state.h" @@ -232,7 +233,7 @@ static struct r300_vertex_program *build_program(GLcontext *ctx, _mesa_insert_mvp_code(ctx, vp->Base); } - rc_mesa_to_rc_program(&compiler.Base, &vp->Base->Base); + radeon_mesa_to_rc_program(&compiler.Base, &vp->Base->Base); rc_move_output(&compiler.Base, VERT_RESULT_PSIZ, VERT_RESULT_PSIZ, WRITEMASK_X); diff --git a/src/mesa/drivers/dri/r300/radeon_mesa_to_rc.c b/src/mesa/drivers/dri/r300/radeon_mesa_to_rc.c new file mode 100644 index 0000000000..13b9d3541f --- /dev/null +++ b/src/mesa/drivers/dri/r300/radeon_mesa_to_rc.c @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2009 Nicolai Haehnle. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 "radeon_mesa_to_rc.h" + +#include "main/mtypes.h" +#include "shader/prog_parameter.h" + +#include "compiler/radeon_compiler.h" +#include "compiler/radeon_program.h" + + +void radeon_mesa_to_rc_program(struct radeon_compiler * c, struct gl_program * program) +{ + struct prog_instruction *source; + unsigned int i; + + for(source = program->Instructions; source->Opcode != OPCODE_END; ++source) { + struct rc_instruction * dest = rc_insert_new_instruction(c, c->Program.Instructions.Prev); + dest->I = *source; + } + + c->Program.ShadowSamplers = program->ShadowSamplers; + c->Program.InputsRead = program->InputsRead; + c->Program.OutputsWritten = program->OutputsWritten; + + for(i = 0; i < program->Parameters->NumParameters; ++i) { + struct rc_constant constant; + + constant.Type = RC_CONSTANT_EXTERNAL; + constant.Size = 4; + constant.u.External = i; + + rc_constants_add(&c->Program.Constants, &constant); + } +} diff --git a/src/mesa/drivers/dri/r300/radeon_mesa_to_rc.h b/src/mesa/drivers/dri/r300/radeon_mesa_to_rc.h new file mode 100644 index 0000000000..9511a04f36 --- /dev/null +++ b/src/mesa/drivers/dri/r300/radeon_mesa_to_rc.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2009 Nicolai Haehnle. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 RADEON_MESA_TO_RC_H +#define RADEON_MESA_TO_RC_H + +struct gl_program; +struct radeon_compiler; + +void radeon_mesa_to_rc_program(struct radeon_compiler * c, struct gl_program * program); + +#endif /* RADEON_MESA_TO_RC_H */ -- cgit v1.2.3 From d1b4351e603522be11061522cb6b685da9ef1fee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sun, 30 Aug 2009 18:51:29 +0200 Subject: r300: Remove all Mesa dependencies from the shader compiler MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In particular, this removes the dependency on prog_instruction, which unfortunately creates some code duplication, but also opens a path towards adding some hardware-specific things in there. Signed-off-by: Nicolai Hähnle --- src/gallium/drivers/r300/Makefile | 4 +- src/gallium/drivers/r300/r300_tgsi_to_rc.c | 277 ++++++----- src/mesa/drivers/dri/r300/compiler/Makefile | 1 + src/mesa/drivers/dri/r300/compiler/r300_fragprog.c | 118 ++--- src/mesa/drivers/dri/r300/compiler/r300_fragprog.h | 5 +- .../drivers/dri/r300/compiler/r300_fragprog_emit.c | 96 ++-- .../dri/r300/compiler/r300_fragprog_swizzle.c | 84 ++-- .../dri/r300/compiler/r300_fragprog_swizzle.h | 11 +- src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c | 48 +- src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c | 321 ++++++------- src/mesa/drivers/dri/r300/compiler/r500_fragprog.c | 166 +++---- src/mesa/drivers/dri/r300/compiler/r500_fragprog.h | 9 +- .../drivers/dri/r300/compiler/r500_fragprog_emit.c | 96 ++-- src/mesa/drivers/dri/r300/compiler/radeon_code.c | 14 +- src/mesa/drivers/dri/r300/compiler/radeon_code.h | 23 +- .../drivers/dri/r300/compiler/radeon_compiler.c | 92 ++-- .../drivers/dri/r300/compiler/radeon_compiler.h | 31 +- .../drivers/dri/r300/compiler/radeon_nqssadce.c | 159 +++---- .../drivers/dri/r300/compiler/radeon_nqssadce.h | 13 +- .../drivers/dri/r300/compiler/radeon_opcodes.c | 318 +++++++++++++ .../drivers/dri/r300/compiler/radeon_opcodes.h | 202 ++++++++ .../drivers/dri/r300/compiler/radeon_program.c | 203 ++++++-- .../drivers/dri/r300/compiler/radeon_program.h | 230 +++++++-- .../drivers/dri/r300/compiler/radeon_program_alu.c | 521 ++++++++++----------- .../drivers/dri/r300/compiler/radeon_program_alu.h | 10 +- .../dri/r300/compiler/radeon_program_pair.c | 361 +++++++------- .../dri/r300/compiler/radeon_program_pair.h | 68 +-- src/mesa/drivers/dri/r300/r300_fragprog_common.c | 4 +- src/mesa/drivers/dri/r300/radeon_mesa_to_rc.c | 143 +++++- 29 files changed, 2268 insertions(+), 1360 deletions(-) create mode 100644 src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c create mode 100644 src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h (limited to 'src') diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile index d7a2c8c462..ec58eeacc2 100644 --- a/src/gallium/drivers/r300/Makefile +++ b/src/gallium/drivers/r300/Makefile @@ -24,9 +24,7 @@ C_SOURCES = \ r300_tgsi_to_rc.c LIBRARY_INCLUDES = \ - -I$(TOP)/src/mesa/drivers/dri/r300/compiler \ - -I$(TOP)/src/mesa \ - -I$(TOP)/include + -I$(TOP)/src/mesa/drivers/dri/r300/compiler COMPILER_ARCHIVE = $(TOP)/src/mesa/drivers/dri/r300/compiler/libr300compiler.a diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/src/gallium/drivers/r300/r300_tgsi_to_rc.c index 3adbb715f3..2c63a46c27 100644 --- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c +++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c @@ -33,152 +33,151 @@ static unsigned translate_opcode(unsigned opcode) { switch(opcode) { - case TGSI_OPCODE_ARL: return OPCODE_ARL; - case TGSI_OPCODE_MOV: return OPCODE_MOV; - case TGSI_OPCODE_LIT: return OPCODE_LIT; - case TGSI_OPCODE_RCP: return OPCODE_RCP; - case TGSI_OPCODE_RSQ: return OPCODE_RSQ; - case TGSI_OPCODE_EXP: return OPCODE_EXP; - case TGSI_OPCODE_LOG: return OPCODE_LOG; - case TGSI_OPCODE_MUL: return OPCODE_MUL; - case TGSI_OPCODE_ADD: return OPCODE_ADD; - case TGSI_OPCODE_DP3: return OPCODE_DP3; - case TGSI_OPCODE_DP4: return OPCODE_DP4; - case TGSI_OPCODE_DST: return OPCODE_DST; - case TGSI_OPCODE_MIN: return OPCODE_MIN; - case TGSI_OPCODE_MAX: return OPCODE_MAX; - case TGSI_OPCODE_SLT: return OPCODE_SLT; - case TGSI_OPCODE_SGE: return OPCODE_SGE; - case TGSI_OPCODE_MAD: return OPCODE_MAD; - case TGSI_OPCODE_SUB: return OPCODE_SUB; - case TGSI_OPCODE_LRP: return OPCODE_LRP; - /* case TGSI_OPCODE_CND: return OPCODE_CND; */ - /* case TGSI_OPCODE_CND0: return OPCODE_CND0; */ - case TGSI_OPCODE_DP2A: return OPCODE_DP2A; + case TGSI_OPCODE_ARL: return RC_OPCODE_ARL; + case TGSI_OPCODE_MOV: return RC_OPCODE_MOV; + case TGSI_OPCODE_LIT: return RC_OPCODE_LIT; + case TGSI_OPCODE_RCP: return RC_OPCODE_RCP; + case TGSI_OPCODE_RSQ: return RC_OPCODE_RSQ; + case TGSI_OPCODE_EXP: return RC_OPCODE_EXP; + case TGSI_OPCODE_LOG: return RC_OPCODE_LOG; + case TGSI_OPCODE_MUL: return RC_OPCODE_MUL; + case TGSI_OPCODE_ADD: return RC_OPCODE_ADD; + case TGSI_OPCODE_DP3: return RC_OPCODE_DP3; + case TGSI_OPCODE_DP4: return RC_OPCODE_DP4; + case TGSI_OPCODE_DST: return RC_OPCODE_DST; + case TGSI_OPCODE_MIN: return RC_OPCODE_MIN; + case TGSI_OPCODE_MAX: return RC_OPCODE_MAX; + case TGSI_OPCODE_SLT: return RC_OPCODE_SLT; + case TGSI_OPCODE_SGE: return RC_OPCODE_SGE; + case TGSI_OPCODE_MAD: return RC_OPCODE_MAD; + case TGSI_OPCODE_SUB: return RC_OPCODE_SUB; + case TGSI_OPCODE_LRP: return RC_OPCODE_LRP; + /* case TGSI_OPCODE_CND: return RC_OPCODE_CND; */ + /* case TGSI_OPCODE_CND0: return RC_OPCODE_CND0; */ + /* case TGSI_OPCODE_DP2A: return RC_OPCODE_DP2A; */ /* gap */ - case TGSI_OPCODE_FRC: return OPCODE_FRC; - /* case TGSI_OPCODE_CLAMP: return OPCODE_CLAMP; */ - case TGSI_OPCODE_FLR: return OPCODE_FLR; - /* case TGSI_OPCODE_ROUND: return OPCODE_ROUND; */ - case TGSI_OPCODE_EX2: return OPCODE_EX2; - case TGSI_OPCODE_LG2: return OPCODE_LG2; - case TGSI_OPCODE_POW: return OPCODE_POW; - case TGSI_OPCODE_XPD: return OPCODE_XPD; + case TGSI_OPCODE_FRC: return RC_OPCODE_FRC; + /* case TGSI_OPCODE_CLAMP: return RC_OPCODE_CLAMP; */ + case TGSI_OPCODE_FLR: return RC_OPCODE_FLR; + /* case TGSI_OPCODE_ROUND: return RC_OPCODE_ROUND; */ + case TGSI_OPCODE_EX2: return RC_OPCODE_EX2; + case TGSI_OPCODE_LG2: return RC_OPCODE_LG2; + case TGSI_OPCODE_POW: return RC_OPCODE_POW; + case TGSI_OPCODE_XPD: return RC_OPCODE_XPD; /* gap */ - case TGSI_OPCODE_ABS: return OPCODE_ABS; - case TGSI_OPCODE_RCC: return OPCODE_RCC; - case TGSI_OPCODE_DPH: return OPCODE_DPH; - case TGSI_OPCODE_COS: return OPCODE_COS; - case TGSI_OPCODE_DDX: return OPCODE_DDX; - case TGSI_OPCODE_DDY: return OPCODE_DDY; - /* case TGSI_OPCODE_KILP: return OPCODE_KILP; */ - case TGSI_OPCODE_PK2H: return OPCODE_PK2H; - case TGSI_OPCODE_PK2US: return OPCODE_PK2US; - case TGSI_OPCODE_PK4B: return OPCODE_PK4B; - case TGSI_OPCODE_PK4UB: return OPCODE_PK4UB; - case TGSI_OPCODE_RFL: return OPCODE_RFL; - case TGSI_OPCODE_SEQ: return OPCODE_SEQ; - case TGSI_OPCODE_SFL: return OPCODE_SFL; - case TGSI_OPCODE_SGT: return OPCODE_SGT; - case TGSI_OPCODE_SIN: return OPCODE_SIN; - case TGSI_OPCODE_SLE: return OPCODE_SLE; - case TGSI_OPCODE_SNE: return OPCODE_SNE; - case TGSI_OPCODE_STR: return OPCODE_STR; - case TGSI_OPCODE_TEX: return OPCODE_TEX; - case TGSI_OPCODE_TXD: return OPCODE_TXD; - case TGSI_OPCODE_TXP: return OPCODE_TXP; - case TGSI_OPCODE_UP2H: return OPCODE_UP2H; - case TGSI_OPCODE_UP2US: return OPCODE_UP2US; - case TGSI_OPCODE_UP4B: return OPCODE_UP4B; - case TGSI_OPCODE_UP4UB: return OPCODE_UP4UB; - case TGSI_OPCODE_X2D: return OPCODE_X2D; - case TGSI_OPCODE_ARA: return OPCODE_ARA; - case TGSI_OPCODE_ARR: return OPCODE_ARR; - case TGSI_OPCODE_BRA: return OPCODE_BRA; - case TGSI_OPCODE_CAL: return OPCODE_CAL; - case TGSI_OPCODE_RET: return OPCODE_RET; - case TGSI_OPCODE_SSG: return OPCODE_SSG; - case TGSI_OPCODE_CMP: return OPCODE_CMP; - case TGSI_OPCODE_SCS: return OPCODE_SCS; - case TGSI_OPCODE_TXB: return OPCODE_TXB; - /* case TGSI_OPCODE_NRM: return OPCODE_NRM; */ - /* case TGSI_OPCODE_DIV: return OPCODE_DIV; */ - case TGSI_OPCODE_DP2: return OPCODE_DP2; - case TGSI_OPCODE_TXL: return OPCODE_TXL; - case TGSI_OPCODE_BRK: return OPCODE_BRK; - case TGSI_OPCODE_IF: return OPCODE_IF; - /* case TGSI_OPCODE_LOOP: return OPCODE_LOOP; */ - /* case TGSI_OPCODE_REP: return OPCODE_REP; */ - case TGSI_OPCODE_ELSE: return OPCODE_ELSE; - case TGSI_OPCODE_ENDIF: return OPCODE_ENDIF; - case TGSI_OPCODE_ENDLOOP: return OPCODE_ENDLOOP; - /* case TGSI_OPCODE_ENDREP: return OPCODE_ENDREP; */ - case TGSI_OPCODE_PUSHA: return OPCODE_PUSHA; - case TGSI_OPCODE_POPA: return OPCODE_POPA; - /* case TGSI_OPCODE_CEIL: return OPCODE_CEIL; */ - /* case TGSI_OPCODE_I2F: return OPCODE_I2F; */ - case TGSI_OPCODE_NOT: return OPCODE_NOT; - case TGSI_OPCODE_TRUNC: return OPCODE_TRUNC; - /* case TGSI_OPCODE_SHL: return OPCODE_SHL; */ - /* case TGSI_OPCODE_SHR: return OPCODE_SHR; */ - case TGSI_OPCODE_AND: return OPCODE_AND; - case TGSI_OPCODE_OR: return OPCODE_OR; - /* case TGSI_OPCODE_MOD: return OPCODE_MOD; */ - case TGSI_OPCODE_XOR: return OPCODE_XOR; - /* case TGSI_OPCODE_SAD: return OPCODE_SAD; */ - /* case TGSI_OPCODE_TXF: return OPCODE_TXF; */ - /* case TGSI_OPCODE_TXQ: return OPCODE_TXQ; */ - case TGSI_OPCODE_CONT: return OPCODE_CONT; - /* case TGSI_OPCODE_EMIT: return OPCODE_EMIT; */ - /* case TGSI_OPCODE_ENDPRIM: return OPCODE_ENDPRIM; */ - /* case TGSI_OPCODE_BGNLOOP2: return OPCODE_BGNLOOP2; */ - case TGSI_OPCODE_BGNSUB: return OPCODE_BGNSUB; - /* case TGSI_OPCODE_ENDLOOP2: return OPCODE_ENDLOOP2; */ - case TGSI_OPCODE_ENDSUB: return OPCODE_ENDSUB; - case TGSI_OPCODE_NOISE1: return OPCODE_NOISE1; - case TGSI_OPCODE_NOISE2: return OPCODE_NOISE2; - case TGSI_OPCODE_NOISE3: return OPCODE_NOISE3; - case TGSI_OPCODE_NOISE4: return OPCODE_NOISE4; - case TGSI_OPCODE_NOP: return OPCODE_NOP; + case TGSI_OPCODE_ABS: return RC_OPCODE_ABS; + /* case TGSI_OPCODE_RCC: return RC_OPCODE_RCC; */ + case TGSI_OPCODE_DPH: return RC_OPCODE_DPH; + case TGSI_OPCODE_COS: return RC_OPCODE_COS; + case TGSI_OPCODE_DDX: return RC_OPCODE_DDX; + case TGSI_OPCODE_DDY: return RC_OPCODE_DDY; + /* case TGSI_OPCODE_KILP: return RC_OPCODE_KILP; */ + /* case TGSI_OPCODE_PK2H: return RC_OPCODE_PK2H; */ + /* case TGSI_OPCODE_PK2US: return RC_OPCODE_PK2US; */ + /* case TGSI_OPCODE_PK4B: return RC_OPCODE_PK4B; */ + /* case TGSI_OPCODE_PK4UB: return RC_OPCODE_PK4UB; */ + /* case TGSI_OPCODE_RFL: return RC_OPCODE_RFL; */ + case TGSI_OPCODE_SEQ: return RC_OPCODE_SEQ; + case TGSI_OPCODE_SFL: return RC_OPCODE_SFL; + case TGSI_OPCODE_SGT: return RC_OPCODE_SGT; + case TGSI_OPCODE_SIN: return RC_OPCODE_SIN; + case TGSI_OPCODE_SLE: return RC_OPCODE_SLE; + case TGSI_OPCODE_SNE: return RC_OPCODE_SNE; + /* case TGSI_OPCODE_STR: return RC_OPCODE_STR; */ + case TGSI_OPCODE_TEX: return RC_OPCODE_TEX; + case TGSI_OPCODE_TXD: return RC_OPCODE_TXD; + case TGSI_OPCODE_TXP: return RC_OPCODE_TXP; + /* case TGSI_OPCODE_UP2H: return RC_OPCODE_UP2H; */ + /* case TGSI_OPCODE_UP2US: return RC_OPCODE_UP2US; */ + /* case TGSI_OPCODE_UP4B: return RC_OPCODE_UP4B; */ + /* case TGSI_OPCODE_UP4UB: return RC_OPCODE_UP4UB; */ + /* case TGSI_OPCODE_X2D: return RC_OPCODE_X2D; */ + /* case TGSI_OPCODE_ARA: return RC_OPCODE_ARA; */ + /* case TGSI_OPCODE_ARR: return RC_OPCODE_ARR; */ + /* case TGSI_OPCODE_BRA: return RC_OPCODE_BRA; */ + /* case TGSI_OPCODE_CAL: return RC_OPCODE_CAL; */ + /* case TGSI_OPCODE_RET: return RC_OPCODE_RET; */ + /* case TGSI_OPCODE_SSG: return RC_OPCODE_SSG; */ + case TGSI_OPCODE_CMP: return RC_OPCODE_CMP; + case TGSI_OPCODE_SCS: return RC_OPCODE_SCS; + case TGSI_OPCODE_TXB: return RC_OPCODE_TXB; + /* case TGSI_OPCODE_NRM: return RC_OPCODE_NRM; */ + /* case TGSI_OPCODE_DIV: return RC_OPCODE_DIV; */ + /* case TGSI_OPCODE_DP2: return RC_OPCODE_DP2; */ + case TGSI_OPCODE_TXL: return RC_OPCODE_TXL; + /* case TGSI_OPCODE_BRK: return RC_OPCODE_BRK; */ + /* case TGSI_OPCODE_IF: return RC_OPCODE_IF; */ + /* case TGSI_OPCODE_LOOP: return RC_OPCODE_LOOP; */ + /* case TGSI_OPCODE_REP: return RC_OPCODE_REP; */ + /* case TGSI_OPCODE_ELSE: return RC_OPCODE_ELSE; */ + /* case TGSI_OPCODE_ENDIF: return RC_OPCODE_ENDIF; */ + /* case TGSI_OPCODE_ENDLOOP: return RC_OPCODE_ENDLOOP; */ + /* case TGSI_OPCODE_ENDREP: return RC_OPCODE_ENDREP; */ + /* case TGSI_OPCODE_PUSHA: return RC_OPCODE_PUSHA; */ + /* case TGSI_OPCODE_POPA: return RC_OPCODE_POPA; */ + /* case TGSI_OPCODE_CEIL: return RC_OPCODE_CEIL; */ + /* case TGSI_OPCODE_I2F: return RC_OPCODE_I2F; */ + /* case TGSI_OPCODE_NOT: return RC_OPCODE_NOT; */ + /* case TGSI_OPCODE_TRUNC: return RC_OPCODE_TRUNC; */ + /* case TGSI_OPCODE_SHL: return RC_OPCODE_SHL; */ + /* case TGSI_OPCODE_SHR: return RC_OPCODE_SHR; */ + /* case TGSI_OPCODE_AND: return RC_OPCODE_AND; */ + /* case TGSI_OPCODE_OR: return RC_OPCODE_OR; */ + /* case TGSI_OPCODE_MOD: return RC_OPCODE_MOD; */ + /* case TGSI_OPCODE_XOR: return RC_OPCODE_XOR; */ + /* case TGSI_OPCODE_SAD: return RC_OPCODE_SAD; */ + /* case TGSI_OPCODE_TXF: return RC_OPCODE_TXF; */ + /* case TGSI_OPCODE_TXQ: return RC_OPCODE_TXQ; */ + /* case TGSI_OPCODE_CONT: return RC_OPCODE_CONT; */ + /* case TGSI_OPCODE_EMIT: return RC_OPCODE_EMIT; */ + /* case TGSI_OPCODE_ENDPRIM: return RC_OPCODE_ENDPRIM; */ + /* case TGSI_OPCODE_BGNLOOP2: return RC_OPCODE_BGNLOOP2; */ + /* case TGSI_OPCODE_BGNSUB: return RC_OPCODE_BGNSUB; */ + /* case TGSI_OPCODE_ENDLOOP2: return RC_OPCODE_ENDLOOP2; */ + /* case TGSI_OPCODE_ENDSUB: return RC_OPCODE_ENDSUB; */ + /* case TGSI_OPCODE_NOISE1: return RC_OPCODE_NOISE1; */ + /* case TGSI_OPCODE_NOISE2: return RC_OPCODE_NOISE2; */ + /* case TGSI_OPCODE_NOISE3: return RC_OPCODE_NOISE3; */ + /* case TGSI_OPCODE_NOISE4: return RC_OPCODE_NOISE4; */ + case TGSI_OPCODE_NOP: return RC_OPCODE_NOP; /* gap */ - case TGSI_OPCODE_NRM4: return OPCODE_NRM4; - /* case TGSI_OPCODE_CALLNZ: return OPCODE_CALLNZ; */ - /* case TGSI_OPCODE_IFC: return OPCODE_IFC; */ - /* case TGSI_OPCODE_BREAKC: return OPCODE_BREAKC; */ - case TGSI_OPCODE_KIL: return OPCODE_KIL; - case TGSI_OPCODE_END: return OPCODE_END; - case TGSI_OPCODE_SWZ: return OPCODE_SWZ; + /* case TGSI_OPCODE_NRM4: return RC_OPCODE_NRM4; */ + /* case TGSI_OPCODE_CALLNZ: return RC_OPCODE_CALLNZ; */ + /* case TGSI_OPCODE_IFC: return RC_OPCODE_IFC; */ + /* case TGSI_OPCODE_BREAKC: return RC_OPCODE_BREAKC; */ + case TGSI_OPCODE_KIL: return RC_OPCODE_KIL; + case TGSI_OPCODE_SWZ: return RC_OPCODE_SWZ; } fprintf(stderr, "Unknown opcode: %i\n", opcode); - abort(); + return RC_OPCODE_ILLEGAL_OPCODE; } static unsigned translate_saturate(unsigned saturate) { switch(saturate) { - case TGSI_SAT_NONE: return SATURATE_OFF; - case TGSI_SAT_ZERO_ONE: return SATURATE_ZERO_ONE; - case TGSI_SAT_MINUS_PLUS_ONE: return SATURATE_PLUS_MINUS_ONE; + default: + fprintf(stderr, "Unknown saturate mode: %i\n", saturate); + /* fall-through */ + case TGSI_SAT_NONE: return RC_SATURATE_NONE; + case TGSI_SAT_ZERO_ONE: return RC_SATURATE_ZERO_ONE; + case TGSI_SAT_MINUS_PLUS_ONE: return RC_SATURATE_MINUS_PLUS_ONE; } - - fprintf(stderr, "Unknown saturate mode: %i\n", saturate); - abort(); } static unsigned translate_register_file(unsigned file) { switch(file) { - case TGSI_FILE_CONSTANT: return PROGRAM_CONSTANT; - case TGSI_FILE_IMMEDIATE: return PROGRAM_CONSTANT; - case TGSI_FILE_INPUT: return PROGRAM_INPUT; - case TGSI_FILE_OUTPUT: return PROGRAM_OUTPUT; - case TGSI_FILE_TEMPORARY: return PROGRAM_TEMPORARY; - case TGSI_FILE_ADDRESS: return PROGRAM_ADDRESS; + case TGSI_FILE_CONSTANT: return RC_FILE_CONSTANT; + case TGSI_FILE_IMMEDIATE: return RC_FILE_CONSTANT; + case TGSI_FILE_INPUT: return RC_FILE_INPUT; + case TGSI_FILE_OUTPUT: return RC_FILE_OUTPUT; + default: + fprintf(stderr, "Unhandled register file: %i\n", file); + /* fall-through */ + case TGSI_FILE_TEMPORARY: return RC_FILE_TEMPORARY; + case TGSI_FILE_ADDRESS: return RC_FILE_ADDRESS; } - - fprintf(stderr, "Unhandled register file: %i\n", file); - abort(); } static int translate_register_index( @@ -194,7 +193,7 @@ static int translate_register_index( static void transform_dstreg( struct tgsi_to_rc * ttr, - struct prog_dst_register * dst, + struct rc_dst_register * dst, struct tgsi_full_dst_register * src) { dst->File = translate_register_file(src->DstRegister.File); @@ -205,7 +204,7 @@ static void transform_dstreg( static void transform_srcreg( struct tgsi_to_rc * ttr, - struct prog_src_register * dst, + struct rc_src_register * dst, struct tgsi_full_src_register * src) { dst->File = translate_register_file(src->SrcRegister.File); @@ -221,37 +220,37 @@ static void transform_srcreg( (src->SrcRegisterExtSwz.NegateY << 1) | (src->SrcRegisterExtSwz.NegateZ << 2) | (src->SrcRegisterExtSwz.NegateW << 3); - dst->Negate ^= src->SrcRegister.Negate ? NEGATE_XYZW : 0; + dst->Negate ^= src->SrcRegister.Negate ? RC_MASK_XYZW : 0; } static void transform_texture(struct rc_instruction * dst, struct tgsi_instruction_ext_texture src) { switch(src.Texture) { case TGSI_TEXTURE_1D: - dst->I.TexSrcTarget = TEXTURE_1D_INDEX; + dst->I.TexSrcTarget = RC_TEXTURE_1D; break; case TGSI_TEXTURE_2D: - dst->I.TexSrcTarget = TEXTURE_2D_INDEX; + dst->I.TexSrcTarget = RC_TEXTURE_2D; break; case TGSI_TEXTURE_3D: - dst->I.TexSrcTarget = TEXTURE_3D_INDEX; + dst->I.TexSrcTarget = RC_TEXTURE_3D; break; case TGSI_TEXTURE_CUBE: - dst->I.TexSrcTarget = TEXTURE_CUBE_INDEX; + dst->I.TexSrcTarget = RC_TEXTURE_CUBE; break; case TGSI_TEXTURE_RECT: - dst->I.TexSrcTarget = TEXTURE_RECT_INDEX; + dst->I.TexSrcTarget = RC_TEXTURE_RECT; break; case TGSI_TEXTURE_SHADOW1D: - dst->I.TexSrcTarget = TEXTURE_1D_INDEX; + dst->I.TexSrcTarget = RC_TEXTURE_1D; dst->I.TexShadow = 1; break; case TGSI_TEXTURE_SHADOW2D: - dst->I.TexSrcTarget = TEXTURE_2D_INDEX; + dst->I.TexSrcTarget = RC_TEXTURE_2D; dst->I.TexShadow = 1; break; case TGSI_TEXTURE_SHADOWRECT: - dst->I.TexSrcTarget = TEXTURE_RECT_INDEX; + dst->I.TexSrcTarget = RC_TEXTURE_RECT; dst->I.TexShadow = 1; break; } diff --git a/src/mesa/drivers/dri/r300/compiler/Makefile b/src/mesa/drivers/dri/r300/compiler/Makefile index d973844192..080c79898b 100644 --- a/src/mesa/drivers/dri/r300/compiler/Makefile +++ b/src/mesa/drivers/dri/r300/compiler/Makefile @@ -10,6 +10,7 @@ C_SOURCES = \ radeon_compiler.c \ radeon_nqssadce.c \ radeon_program.c \ + radeon_opcodes.c \ radeon_program_alu.c \ radeon_program_pair.c \ r3xx_fragprog.c \ diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog.c index 6c9fba4914..94f8fdfea3 100644 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog.c @@ -27,17 +27,17 @@ #include "r300_fragprog.h" -#include "shader/prog_parameter.h" +#include #include "../r300_reg.h" -static struct prog_src_register shadow_ambient(struct radeon_compiler * c, int tmu) +static struct rc_src_register shadow_ambient(struct radeon_compiler * c, int tmu) { - struct prog_src_register reg = { 0, }; + struct rc_src_register reg = { 0, }; - reg.File = PROGRAM_STATE_VAR; + reg.File = RC_FILE_CONSTANT; reg.Index = rc_constants_add_state(&c->Program.Constants, RC_STATE_SHADOW_AMBIENT, tmu); - reg.Swizzle = SWIZZLE_WWWW; + reg.Swizzle = RC_SWIZZLE_WWWW; return reg; } @@ -47,7 +47,7 @@ static struct prog_src_register shadow_ambient(struct radeon_compiler * c, int t * - extract operand swizzles * - introduce a temporary register when write masks are needed */ -GLboolean r300_transform_TEX( +int r300_transform_TEX( struct radeon_compiler * c, struct rc_instruction* inst, void* data) @@ -55,77 +55,77 @@ GLboolean r300_transform_TEX( struct r300_fragment_program_compiler *compiler = (struct r300_fragment_program_compiler*)data; - if (inst->I.Opcode != OPCODE_TEX && - inst->I.Opcode != OPCODE_TXB && - inst->I.Opcode != OPCODE_TXP && - inst->I.Opcode != OPCODE_KIL) - return GL_FALSE; + if (inst->I.Opcode != RC_OPCODE_TEX && + inst->I.Opcode != RC_OPCODE_TXB && + inst->I.Opcode != RC_OPCODE_TXP && + inst->I.Opcode != RC_OPCODE_KIL) + return 0; /* ARB_shadow & EXT_shadow_funcs */ - if (inst->I.Opcode != OPCODE_KIL && + if (inst->I.Opcode != RC_OPCODE_KIL && c->Program.ShadowSamplers & (1 << inst->I.TexSrcUnit)) { - GLuint comparefunc = GL_NEVER + compiler->state.unit[inst->I.TexSrcUnit].texture_compare_func; + rc_compare_func comparefunc = compiler->state.unit[inst->I.TexSrcUnit].texture_compare_func; - if (comparefunc == GL_NEVER || comparefunc == GL_ALWAYS) { - inst->I.Opcode = OPCODE_MOV; + if (comparefunc == RC_COMPARE_FUNC_NEVER || comparefunc == RC_COMPARE_FUNC_ALWAYS) { + inst->I.Opcode = RC_OPCODE_MOV; - if (comparefunc == GL_ALWAYS) { - inst->I.SrcReg[0].File = PROGRAM_BUILTIN; - inst->I.SrcReg[0].Swizzle = SWIZZLE_1111; + if (comparefunc == RC_COMPARE_FUNC_ALWAYS) { + inst->I.SrcReg[0].File = RC_FILE_NONE; + inst->I.SrcReg[0].Swizzle = RC_SWIZZLE_1111; } else { inst->I.SrcReg[0] = shadow_ambient(c, inst->I.TexSrcUnit); } - return GL_TRUE; + return 1; } else { - GLuint comparefunc = GL_NEVER + compiler->state.unit[inst->I.TexSrcUnit].texture_compare_func; - GLuint depthmode = compiler->state.unit[inst->I.TexSrcUnit].depth_texture_mode; + rc_compare_func comparefunc = compiler->state.unit[inst->I.TexSrcUnit].texture_compare_func; + unsigned int depthmode = compiler->state.unit[inst->I.TexSrcUnit].depth_texture_mode; struct rc_instruction * inst_rcp = rc_insert_new_instruction(c, inst); struct rc_instruction * inst_mad = rc_insert_new_instruction(c, inst_rcp); struct rc_instruction * inst_cmp = rc_insert_new_instruction(c, inst_mad); int pass, fail; - inst_rcp->I.Opcode = OPCODE_RCP; - inst_rcp->I.DstReg.File = PROGRAM_TEMPORARY; + inst_rcp->I.Opcode = RC_OPCODE_RCP; + inst_rcp->I.DstReg.File = RC_FILE_TEMPORARY; inst_rcp->I.DstReg.Index = rc_find_free_temporary(c); - inst_rcp->I.DstReg.WriteMask = WRITEMASK_W; + inst_rcp->I.DstReg.WriteMask = RC_MASK_W; inst_rcp->I.SrcReg[0] = inst->I.SrcReg[0]; - inst_rcp->I.SrcReg[0].Swizzle = SWIZZLE_WWWW; + inst_rcp->I.SrcReg[0].Swizzle = RC_SWIZZLE_WWWW; inst_cmp->I.DstReg = inst->I.DstReg; - inst->I.DstReg.File = PROGRAM_TEMPORARY; + inst->I.DstReg.File = RC_FILE_TEMPORARY; inst->I.DstReg.Index = rc_find_free_temporary(c); - inst->I.DstReg.WriteMask = WRITEMASK_XYZW; + inst->I.DstReg.WriteMask = RC_MASK_XYZW; - inst_mad->I.Opcode = OPCODE_MAD; - inst_mad->I.DstReg.File = PROGRAM_TEMPORARY; + inst_mad->I.Opcode = RC_OPCODE_MAD; + inst_mad->I.DstReg.File = RC_FILE_TEMPORARY; inst_mad->I.DstReg.Index = rc_find_free_temporary(c); inst_mad->I.SrcReg[0] = inst->I.SrcReg[0]; - inst_mad->I.SrcReg[0].Swizzle = SWIZZLE_ZZZZ; - inst_mad->I.SrcReg[1].File = PROGRAM_TEMPORARY; + inst_mad->I.SrcReg[0].Swizzle = RC_SWIZZLE_ZZZZ; + inst_mad->I.SrcReg[1].File = RC_FILE_TEMPORARY; inst_mad->I.SrcReg[1].Index = inst_rcp->I.DstReg.Index; - inst_mad->I.SrcReg[1].Swizzle = SWIZZLE_WWWW; - inst_mad->I.SrcReg[2].File = PROGRAM_TEMPORARY; + inst_mad->I.SrcReg[1].Swizzle = RC_SWIZZLE_WWWW; + inst_mad->I.SrcReg[2].File = RC_FILE_TEMPORARY; inst_mad->I.SrcReg[2].Index = inst->I.DstReg.Index; if (depthmode == 0) /* GL_LUMINANCE */ - inst_mad->I.SrcReg[2].Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_Z); + inst_mad->I.SrcReg[2].Swizzle = RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_Z); else if (depthmode == 2) /* GL_ALPHA */ - inst_mad->I.SrcReg[2].Swizzle = SWIZZLE_WWWW; + inst_mad->I.SrcReg[2].Swizzle = RC_SWIZZLE_WWWW; /* Recall that SrcReg[0] is tex, SrcReg[2] is r and: * r < tex <=> -tex+r < 0 * r >= tex <=> not (-tex+r < 0 */ - if (comparefunc == GL_LESS || comparefunc == GL_GEQUAL) - inst_mad->I.SrcReg[2].Negate = inst_mad->I.SrcReg[2].Negate ^ NEGATE_XYZW; + if (comparefunc == RC_COMPARE_FUNC_LESS || comparefunc == RC_COMPARE_FUNC_GEQUAL) + inst_mad->I.SrcReg[2].Negate = inst_mad->I.SrcReg[2].Negate ^ RC_MASK_XYZW; else - inst_mad->I.SrcReg[0].Negate = inst_mad->I.SrcReg[0].Negate ^ NEGATE_XYZW; + inst_mad->I.SrcReg[0].Negate = inst_mad->I.SrcReg[0].Negate ^ RC_MASK_XYZW; - inst_cmp->I.Opcode = OPCODE_CMP; + inst_cmp->I.Opcode = RC_OPCODE_CMP; /* DstReg has been filled out above */ - inst_cmp->I.SrcReg[0].File = PROGRAM_TEMPORARY; + inst_cmp->I.SrcReg[0].File = RC_FILE_TEMPORARY; inst_cmp->I.SrcReg[0].Index = inst_mad->I.DstReg.Index; - if (comparefunc == GL_LESS || comparefunc == GL_GREATER) { + if (comparefunc == RC_COMPARE_FUNC_LESS || comparefunc == RC_COMPARE_FUNC_GREATER) { pass = 1; fail = 2; } else { @@ -133,8 +133,8 @@ GLboolean r300_transform_TEX( fail = 1; } - inst_cmp->I.SrcReg[pass].File = PROGRAM_BUILTIN; - inst_cmp->I.SrcReg[pass].Swizzle = SWIZZLE_1111; + inst_cmp->I.SrcReg[pass].File = RC_FILE_NONE; + inst_cmp->I.SrcReg[pass].Swizzle = RC_SWIZZLE_1111; inst_cmp->I.SrcReg[fail] = shadow_ambient(c, inst->I.TexSrcUnit); } } @@ -143,52 +143,52 @@ GLboolean r300_transform_TEX( * instead of [0..Width]x[0..Height]. * Add a scaling instruction. */ - if (inst->I.Opcode != OPCODE_KIL && inst->I.TexSrcTarget == TEXTURE_RECT_INDEX) { + if (inst->I.Opcode != RC_OPCODE_KIL && inst->I.TexSrcTarget == RC_TEXTURE_RECT) { struct rc_instruction * inst_mul = rc_insert_new_instruction(c, inst->Prev); - inst_mul->I.Opcode = OPCODE_MUL; - inst_mul->I.DstReg.File = PROGRAM_TEMPORARY; + inst_mul->I.Opcode = RC_OPCODE_MUL; + inst_mul->I.DstReg.File = RC_FILE_TEMPORARY; inst_mul->I.DstReg.Index = rc_find_free_temporary(c); inst_mul->I.SrcReg[0] = inst->I.SrcReg[0]; - inst_mul->I.SrcReg[1].File = PROGRAM_STATE_VAR; + inst_mul->I.SrcReg[1].File = RC_FILE_CONSTANT; inst_mul->I.SrcReg[1].Index = rc_constants_add_state(&c->Program.Constants, RC_STATE_R300_TEXRECT_FACTOR, inst->I.TexSrcUnit); reset_srcreg(&inst->I.SrcReg[0]); - inst->I.SrcReg[0].File = PROGRAM_TEMPORARY; + inst->I.SrcReg[0].File = RC_FILE_TEMPORARY; inst->I.SrcReg[0].Index = inst_mul->I.DstReg.Index; } /* Cannot write texture to output registers or with masks */ - if (inst->I.Opcode != OPCODE_KIL && - (inst->I.DstReg.File != PROGRAM_TEMPORARY || inst->I.DstReg.WriteMask != WRITEMASK_XYZW)) { + if (inst->I.Opcode != RC_OPCODE_KIL && + (inst->I.DstReg.File != RC_FILE_TEMPORARY || inst->I.DstReg.WriteMask != RC_MASK_XYZW)) { struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst); - inst_mov->I.Opcode = OPCODE_MOV; + inst_mov->I.Opcode = RC_OPCODE_MOV; inst_mov->I.DstReg = inst->I.DstReg; - inst_mov->I.SrcReg[0].File = PROGRAM_TEMPORARY; + inst_mov->I.SrcReg[0].File = RC_FILE_TEMPORARY; inst_mov->I.SrcReg[0].Index = rc_find_free_temporary(c); - inst->I.DstReg.File = PROGRAM_TEMPORARY; + inst->I.DstReg.File = RC_FILE_TEMPORARY; inst->I.DstReg.Index = inst_mov->I.SrcReg[0].Index; - inst->I.DstReg.WriteMask = WRITEMASK_XYZW; + inst->I.DstReg.WriteMask = RC_MASK_XYZW; } /* Cannot read texture coordinate from constants file */ - if (inst->I.SrcReg[0].File != PROGRAM_TEMPORARY && inst->I.SrcReg[0].File != PROGRAM_INPUT) { + if (inst->I.SrcReg[0].File != RC_FILE_TEMPORARY && inst->I.SrcReg[0].File != RC_FILE_INPUT) { struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst->Prev); - inst_mov->I.Opcode = OPCODE_MOV; - inst_mov->I.DstReg.File = PROGRAM_TEMPORARY; + inst_mov->I.Opcode = RC_OPCODE_MOV; + inst_mov->I.DstReg.File = RC_FILE_TEMPORARY; inst_mov->I.DstReg.Index = rc_find_free_temporary(c); inst_mov->I.SrcReg[0] = inst->I.SrcReg[0]; reset_srcreg(&inst->I.SrcReg[0]); - inst->I.SrcReg[0].File = PROGRAM_TEMPORARY; + inst->I.SrcReg[0].File = RC_FILE_TEMPORARY; inst->I.SrcReg[0].Index = inst_mov->I.DstReg.Index; } - return GL_TRUE; + return 1; } /* just some random things... */ diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog.h b/src/mesa/drivers/dri/r300/compiler/r300_fragprog.h index 0ac46dbd9c..418df36c93 100644 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog.h +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog.h @@ -33,9 +33,6 @@ #ifndef __R300_FRAGPROG_H_ #define __R300_FRAGPROG_H_ -#include "shader/program.h" -#include "shader/prog_instruction.h" - #include "radeon_compiler.h" #include "radeon_program.h" @@ -44,6 +41,6 @@ extern void r300BuildFragmentProgramHwCode(struct r300_fragment_program_compiler extern void r300FragmentProgramDump(struct rX00_fragment_program_code *c); -extern GLboolean r300_transform_TEX(struct radeon_compiler * c, struct rc_instruction* inst, void* data); +extern int r300_transform_TEX(struct radeon_compiler * c, struct rc_instruction* inst, void* data); #endif diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c index 305dc074ee..58953f6b04 100644 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c @@ -69,64 +69,64 @@ struct r300_emit_state { /** * Mark a temporary register as used. */ -static void use_temporary(struct r300_fragment_program_code *code, GLuint index) +static void use_temporary(struct r300_fragment_program_code *code, unsigned int index) { if (index > code->pixsize) code->pixsize = index; } -static GLuint translate_rgb_opcode(struct r300_fragment_program_compiler * c, GLuint opcode) +static unsigned int translate_rgb_opcode(struct r300_fragment_program_compiler * c, rc_opcode opcode) { switch(opcode) { - case OPCODE_CMP: return R300_ALU_OUTC_CMP; - case OPCODE_DP3: return R300_ALU_OUTC_DP3; - case OPCODE_DP4: return R300_ALU_OUTC_DP4; - case OPCODE_FRC: return R300_ALU_OUTC_FRC; + case RC_OPCODE_CMP: return R300_ALU_OUTC_CMP; + case RC_OPCODE_DP3: return R300_ALU_OUTC_DP3; + case RC_OPCODE_DP4: return R300_ALU_OUTC_DP4; + case RC_OPCODE_FRC: return R300_ALU_OUTC_FRC; default: error("translate_rgb_opcode(%i): Unknown opcode", opcode); /* fall through */ - case OPCODE_NOP: + case RC_OPCODE_NOP: /* fall through */ - case OPCODE_MAD: return R300_ALU_OUTC_MAD; - case OPCODE_MAX: return R300_ALU_OUTC_MAX; - case OPCODE_MIN: return R300_ALU_OUTC_MIN; - case OPCODE_REPL_ALPHA: return R300_ALU_OUTC_REPL_ALPHA; + case RC_OPCODE_MAD: return R300_ALU_OUTC_MAD; + case RC_OPCODE_MAX: return R300_ALU_OUTC_MAX; + case RC_OPCODE_MIN: return R300_ALU_OUTC_MIN; + case RC_OPCODE_REPL_ALPHA: return R300_ALU_OUTC_REPL_ALPHA; } } -static GLuint translate_alpha_opcode(struct r300_fragment_program_compiler * c, GLuint opcode) +static unsigned int translate_alpha_opcode(struct r300_fragment_program_compiler * c, rc_opcode opcode) { switch(opcode) { - case OPCODE_CMP: return R300_ALU_OUTA_CMP; - case OPCODE_DP3: return R300_ALU_OUTA_DP4; - case OPCODE_DP4: return R300_ALU_OUTA_DP4; - case OPCODE_EX2: return R300_ALU_OUTA_EX2; - case OPCODE_FRC: return R300_ALU_OUTA_FRC; - case OPCODE_LG2: return R300_ALU_OUTA_LG2; + case RC_OPCODE_CMP: return R300_ALU_OUTA_CMP; + case RC_OPCODE_DP3: return R300_ALU_OUTA_DP4; + case RC_OPCODE_DP4: return R300_ALU_OUTA_DP4; + case RC_OPCODE_EX2: return R300_ALU_OUTA_EX2; + case RC_OPCODE_FRC: return R300_ALU_OUTA_FRC; + case RC_OPCODE_LG2: return R300_ALU_OUTA_LG2; default: error("translate_rgb_opcode(%i): Unknown opcode", opcode); /* fall through */ - case OPCODE_NOP: + case RC_OPCODE_NOP: /* fall through */ - case OPCODE_MAD: return R300_ALU_OUTA_MAD; - case OPCODE_MAX: return R300_ALU_OUTA_MAX; - case OPCODE_MIN: return R300_ALU_OUTA_MIN; - case OPCODE_RCP: return R300_ALU_OUTA_RCP; - case OPCODE_RSQ: return R300_ALU_OUTA_RSQ; + case RC_OPCODE_MAD: return R300_ALU_OUTA_MAD; + case RC_OPCODE_MAX: return R300_ALU_OUTA_MAX; + case RC_OPCODE_MIN: return R300_ALU_OUTA_MIN; + case RC_OPCODE_RCP: return R300_ALU_OUTA_RCP; + case RC_OPCODE_RSQ: return R300_ALU_OUTA_RSQ; } } /** * Emit one paired ALU instruction. */ -static GLboolean emit_alu(void* data, struct radeon_pair_instruction* inst) +static int emit_alu(void* data, struct radeon_pair_instruction* inst) { PROG_CODE; if (code->alu.length >= R300_PFS_MAX_ALU_INST) { error("Too many ALU instructions"); - return GL_FALSE; + return 0; } int ip = code->alu.length++; @@ -136,7 +136,7 @@ static GLboolean emit_alu(void* data, struct radeon_pair_instruction* inst) code->alu.inst[ip].alpha_inst = translate_alpha_opcode(c, inst->Alpha.Opcode); for(j = 0; j < 3; ++j) { - GLuint src = inst->RGB.Src[j].Index | (inst->RGB.Src[j].Constant << 5); + unsigned int src = inst->RGB.Src[j].Index | (inst->RGB.Src[j].Constant << 5); if (!inst->RGB.Src[j].Constant) use_temporary(code, inst->RGB.Src[j].Index); code->alu.inst[ip].rgb_addr |= src << (6*j); @@ -146,7 +146,7 @@ static GLboolean emit_alu(void* data, struct radeon_pair_instruction* inst) use_temporary(code, inst->Alpha.Src[j].Index); code->alu.inst[ip].alpha_addr |= src << (6*j); - GLuint arg = r300FPTranslateRGBSwizzle(inst->RGB.Arg[j].Source, inst->RGB.Arg[j].Swizzle); + unsigned int arg = r300FPTranslateRGBSwizzle(inst->RGB.Arg[j].Source, inst->RGB.Arg[j].Swizzle); arg |= inst->RGB.Arg[j].Abs << 6; arg |= inst->RGB.Arg[j].Negate << 5; code->alu.inst[ip].rgb_inst |= arg << (7*j); @@ -186,17 +186,17 @@ static GLboolean emit_alu(void* data, struct radeon_pair_instruction* inst) if (inst->Alpha.DepthWriteMask) { code->alu.inst[ip].alpha_addr |= R300_ALU_DSTA_DEPTH; emit->node_flags |= R300_W_OUT; - c->code->writes_depth = GL_TRUE; + c->code->writes_depth = 1; } - return GL_TRUE; + return 1; } /** * Finish the current node without advancing to the next one. */ -static GLboolean finish_node(struct r300_emit_state * emit) +static int finish_node(struct r300_emit_state * emit) { struct r300_fragment_program_compiler * c = emit->compiler; struct r300_fragment_program_code *code = &emit->compiler->code->code.r300; @@ -204,9 +204,9 @@ static GLboolean finish_node(struct r300_emit_state * emit) if (code->alu.length == emit->node_first_alu) { /* Generate a single NOP for this node */ struct radeon_pair_instruction inst; - _mesa_bzero(&inst, sizeof(inst)); + memset(&inst, 0, sizeof(inst)); if (!emit_alu(emit, &inst)) - return GL_FALSE; + return 0; } unsigned alu_offset = emit->node_first_alu; @@ -217,7 +217,7 @@ static GLboolean finish_node(struct r300_emit_state * emit) if (code->tex.length == emit->node_first_tex) { if (emit->current_node > 0) { error("Node %i has no TEX instructions", emit->current_node); - return GL_FALSE; + return 0; } tex_end = 0; @@ -240,7 +240,7 @@ static GLboolean finish_node(struct r300_emit_state * emit) (tex_end << R300_TEX_SIZE_SHIFT) | emit->node_flags; - return GL_TRUE; + return 1; } @@ -248,43 +248,43 @@ static GLboolean finish_node(struct r300_emit_state * emit) * Begin a block of texture instructions. * Create the necessary indirection. */ -static GLboolean begin_tex(void* data) +static int begin_tex(void* data) { PROG_CODE; if (code->alu.length == emit->node_first_alu && code->tex.length == emit->node_first_tex) { - return GL_TRUE; + return 1; } if (emit->current_node == 3) { error("Too many texture indirections"); - return GL_FALSE; + return 0; } if (!finish_node(emit)) - return GL_FALSE; + return 0; emit->current_node++; emit->node_first_tex = code->tex.length; emit->node_first_alu = code->alu.length; emit->node_flags = 0; - return GL_TRUE; + return 1; } -static GLboolean emit_tex(void* data, struct radeon_pair_texture_instruction* inst) +static int emit_tex(void* data, struct radeon_pair_texture_instruction* inst) { PROG_CODE; if (code->tex.length >= R300_PFS_MAX_TEX_INST) { error("Too many TEX instructions"); - return GL_FALSE; + return 0; } - GLuint unit = inst->TexSrcUnit; - GLuint dest = inst->DestIndex; - GLuint opcode; + unsigned int unit = inst->TexSrcUnit; + unsigned int dest = inst->DestIndex; + unsigned int opcode; switch(inst->Opcode) { case RADEON_OPCODE_KIL: opcode = R300_TEX_OP_KIL; break; @@ -293,7 +293,7 @@ static GLboolean emit_tex(void* data, struct radeon_pair_texture_instruction* in case RADEON_OPCODE_TXP: opcode = R300_TEX_OP_TXP; break; default: error("Unknown texture opcode %i", inst->Opcode); - return GL_FALSE; + return 0; } if (inst->Opcode == RADEON_OPCODE_KIL) { @@ -310,7 +310,7 @@ static GLboolean emit_tex(void* data, struct radeon_pair_texture_instruction* in (dest << R300_DST_ADDR_SHIFT) | (unit << R300_TEX_ID_SHIFT) | (opcode << R300_TEX_INST_SHIFT); - return GL_TRUE; + return 1; } @@ -333,7 +333,7 @@ void r300BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compi memset(&emit, 0, sizeof(emit)); emit.compiler = compiler; - _mesa_bzero(code, sizeof(struct r300_fragment_program_code)); + memset(code, 0, sizeof(struct r300_fragment_program_code)); radeonPairProgram(compiler, &pair_handler, &emit); if (compiler->Base.Error) diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c index 1b14cc3888..ded6966d08 100644 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c @@ -33,16 +33,18 @@ #include "r300_fragprog_swizzle.h" +#include + #include "../r300_reg.h" #include "radeon_nqssadce.h" #include "radeon_compiler.h" -#define MAKE_SWZ3(x, y, z) (MAKE_SWIZZLE4(SWIZZLE_##x, SWIZZLE_##y, SWIZZLE_##z, SWIZZLE_ZERO)) +#define MAKE_SWZ3(x, y, z) (RC_MAKE_SWIZZLE(RC_SWIZZLE_##x, RC_SWIZZLE_##y, RC_SWIZZLE_##z, RC_SWIZZLE_ZERO)) struct swizzle_data { - GLuint hash; /**< swizzle value this matches */ - GLuint base; /**< base value for hw swizzle */ - GLuint stride; /**< difference in base between arg0/1/2 */ + unsigned int hash; /**< swizzle value this matches */ + unsigned int base; /**< base value for hw swizzle */ + unsigned int stride; /**< difference in base between arg0/1/2 */ }; static const struct swizzle_data native_swizzles[] = { @@ -65,15 +67,15 @@ static const int num_native_swizzles = sizeof(native_swizzles)/sizeof(native_swi * Find a native RGB swizzle that matches the given swizzle. * Returns 0 if none found. */ -static const struct swizzle_data* lookup_native_swizzle(GLuint swizzle) +static const struct swizzle_data* lookup_native_swizzle(unsigned int swizzle) { int i, comp; for(i = 0; i < num_native_swizzles; ++i) { const struct swizzle_data* sd = &native_swizzles[i]; for(comp = 0; comp < 3; ++comp) { - GLuint swz = GET_SWZ(swizzle, comp); - if (swz == SWIZZLE_NIL) + unsigned int swz = GET_SWZ(swizzle, comp); + if (swz == RC_SWIZZLE_UNUSED) continue; if (swz != GET_SWZ(sd->hash, comp)) break; @@ -90,71 +92,71 @@ static const struct swizzle_data* lookup_native_swizzle(GLuint swizzle) * Check whether the given instruction supports the swizzle and negate * combinations in the given source register. */ -GLboolean r300FPIsNativeSwizzle(GLuint opcode, struct prog_src_register reg) +int r300FPIsNativeSwizzle(rc_opcode opcode, struct rc_src_register reg) { if (reg.Abs) - reg.Negate = NEGATE_NONE; + reg.Negate = RC_MASK_NONE; - if (opcode == OPCODE_KIL || - opcode == OPCODE_TEX || - opcode == OPCODE_TXB || - opcode == OPCODE_TXP) { + if (opcode == RC_OPCODE_KIL || + opcode == RC_OPCODE_TEX || + opcode == RC_OPCODE_TXB || + opcode == RC_OPCODE_TXP) { int j; if (reg.Abs || reg.Negate) - return GL_FALSE; + return 0; for(j = 0; j < 4; ++j) { - GLuint swz = GET_SWZ(reg.Swizzle, j); - if (swz == SWIZZLE_NIL) + unsigned int swz = GET_SWZ(reg.Swizzle, j); + if (swz == RC_SWIZZLE_UNUSED) continue; if (swz != j) - return GL_FALSE; + return 0; } - return GL_TRUE; + return 1; } - GLuint relevant = 0; + unsigned int relevant = 0; int j; for(j = 0; j < 3; ++j) - if (GET_SWZ(reg.Swizzle, j) != SWIZZLE_NIL) + if (GET_SWZ(reg.Swizzle, j) != RC_SWIZZLE_UNUSED) relevant |= 1 << j; if ((reg.Negate & relevant) && ((reg.Negate & relevant) != relevant)) - return GL_FALSE; + return 0; if (!lookup_native_swizzle(reg.Swizzle)) - return GL_FALSE; + return 0; - return GL_TRUE; + return 1; } /** * Generate MOV dst, src using only native swizzles. */ -void r300FPBuildSwizzle(struct nqssadce_state *s, struct prog_dst_register dst, struct prog_src_register src) +void r300FPBuildSwizzle(struct nqssadce_state *s, struct rc_dst_register dst, struct rc_src_register src) { if (src.Abs) - src.Negate = NEGATE_NONE; + src.Negate = RC_MASK_NONE; while(dst.WriteMask) { const struct swizzle_data *best_swizzle = 0; - GLuint best_matchcount = 0; - GLuint best_matchmask = 0; + unsigned int best_matchcount = 0; + unsigned int best_matchmask = 0; int i, comp; for(i = 0; i < num_native_swizzles; ++i) { const struct swizzle_data *sd = &native_swizzles[i]; - GLuint matchcount = 0; - GLuint matchmask = 0; + unsigned int matchcount = 0; + unsigned int matchmask = 0; for(comp = 0; comp < 3; ++comp) { if (!GET_BIT(dst.WriteMask, comp)) continue; - GLuint swz = GET_SWZ(src.Swizzle, comp); - if (swz == SWIZZLE_NIL) + unsigned int swz = GET_SWZ(src.Swizzle, comp); + if (swz == RC_SWIZZLE_UNUSED) continue; if (swz == GET_SWZ(sd->hash, comp)) { /* check if the negate bit of current component @@ -170,17 +172,17 @@ void r300FPBuildSwizzle(struct nqssadce_state *s, struct prog_dst_register dst, best_swizzle = sd; best_matchcount = matchcount; best_matchmask = matchmask; - if (matchmask == (dst.WriteMask & WRITEMASK_XYZ)) + if (matchmask == (dst.WriteMask & RC_MASK_XYZ)) break; } } struct rc_instruction *inst = rc_insert_new_instruction(s->Compiler, s->IP->Prev); - inst->I.Opcode = OPCODE_MOV; + inst->I.Opcode = RC_OPCODE_MOV; inst->I.DstReg = dst; - inst->I.DstReg.WriteMask &= (best_matchmask | WRITEMASK_W); + inst->I.DstReg.WriteMask &= (best_matchmask | RC_MASK_W); inst->I.SrcReg[0] = src; - inst->I.SrcReg[0].Negate = (best_matchmask & src.Negate) ? NEGATE_XYZW : NEGATE_NONE; + inst->I.SrcReg[0].Negate = (best_matchmask & src.Negate) ? RC_MASK_XYZW : RC_MASK_NONE; /* Note: We rely on NqSSA/DCE to set unused swizzle components to NIL */ dst.WriteMask &= ~inst->I.DstReg.WriteMask; @@ -192,12 +194,12 @@ void r300FPBuildSwizzle(struct nqssadce_state *s, struct prog_dst_register dst, * Translate an RGB (XYZ) swizzle into the hardware code for the given * instruction source. */ -GLuint r300FPTranslateRGBSwizzle(GLuint src, GLuint swizzle) +unsigned int r300FPTranslateRGBSwizzle(unsigned int src, unsigned int swizzle) { const struct swizzle_data* sd = lookup_native_swizzle(swizzle); if (!sd) { - _mesa_printf("Not a native swizzle: %08x\n", swizzle); + fprintf(stderr, "Not a native swizzle: %08x\n", swizzle); return 0; } @@ -209,15 +211,15 @@ GLuint r300FPTranslateRGBSwizzle(GLuint src, GLuint swizzle) * Translate an Alpha (W) swizzle into the hardware code for the given * instruction source. */ -GLuint r300FPTranslateAlphaSwizzle(GLuint src, GLuint swizzle) +unsigned int r300FPTranslateAlphaSwizzle(unsigned int src, unsigned int swizzle) { if (swizzle < 3) return swizzle + 3*src; switch(swizzle) { - case SWIZZLE_W: return R300_ALU_ARGA_SRC0A + src; - case SWIZZLE_ONE: return R300_ALU_ARGA_ONE; - case SWIZZLE_ZERO: return R300_ALU_ARGA_ZERO; + case RC_SWIZZLE_W: return R300_ALU_ARGA_SRC0A + src; + case RC_SWIZZLE_ONE: return R300_ALU_ARGA_ONE; + case RC_SWIZZLE_ZERO: return R300_ALU_ARGA_ZERO; default: return R300_ALU_ARGA_ONE; } } diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.h b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.h index 231bf4eef5..728c2cd972 100644 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.h +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.h @@ -28,15 +28,14 @@ #ifndef __R300_FRAGPROG_SWIZZLE_H_ #define __R300_FRAGPROG_SWIZZLE_H_ -#include "main/glheader.h" -#include "shader/prog_instruction.h" +#include "radeon_program.h" struct nqssadce_state; -GLboolean r300FPIsNativeSwizzle(GLuint opcode, struct prog_src_register reg); -void r300FPBuildSwizzle(struct nqssadce_state*, struct prog_dst_register dst, struct prog_src_register src); +int r300FPIsNativeSwizzle(rc_opcode opcode, struct rc_src_register reg); +void r300FPBuildSwizzle(struct nqssadce_state*, struct rc_dst_register dst, struct rc_src_register src); -GLuint r300FPTranslateRGBSwizzle(GLuint src, GLuint swizzle); -GLuint r300FPTranslateAlphaSwizzle(GLuint src, GLuint swizzle); +unsigned int r300FPTranslateRGBSwizzle(unsigned int src, unsigned int swizzle); +unsigned int r300FPTranslateAlphaSwizzle(unsigned int src, unsigned int swizzle); #endif /* __R300_FRAGPROG_SWIZZLE_H_ */ diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c index 76c3a7ecfd..0aa40c0587 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c @@ -22,9 +22,7 @@ #include "radeon_compiler.h" -#include "shader/prog_parameter.h" -#include "shader/prog_print.h" -#include "shader/prog_statevars.h" +#include #include "radeon_nqssadce.h" #include "radeon_program_alu.h" @@ -36,8 +34,8 @@ static void nqssadce_init(struct nqssadce_state* s) { struct r300_fragment_program_compiler * c = s->UserData; - s->Outputs[c->OutputColor].Sourced = WRITEMASK_XYZW; - s->Outputs[c->OutputDepth].Sourced = WRITEMASK_W; + s->Outputs[c->OutputColor].Sourced = RC_MASK_XYZW; + s->Outputs[c->OutputDepth].Sourced = RC_MASK_W; } static void rewrite_depth_out(struct r300_fragment_program_compiler * c) @@ -45,35 +43,35 @@ static void rewrite_depth_out(struct r300_fragment_program_compiler * c) struct rc_instruction *rci; for (rci = c->Base.Program.Instructions.Next; rci != &c->Base.Program.Instructions; rci = rci->Next) { - struct prog_instruction * inst = &rci->I; + struct rc_sub_instruction * inst = &rci->I; - if (inst->DstReg.File != PROGRAM_OUTPUT || inst->DstReg.Index != c->OutputDepth) + if (inst->DstReg.File != RC_FILE_OUTPUT || inst->DstReg.Index != c->OutputDepth) continue; - if (inst->DstReg.WriteMask & WRITEMASK_Z) { - inst->DstReg.WriteMask = WRITEMASK_W; + if (inst->DstReg.WriteMask & RC_MASK_Z) { + inst->DstReg.WriteMask = RC_MASK_W; } else { inst->DstReg.WriteMask = 0; continue; } switch (inst->Opcode) { - case OPCODE_FRC: - case OPCODE_MOV: - inst->SrcReg[0] = lmul_swizzle(SWIZZLE_ZZZZ, inst->SrcReg[0]); + case RC_OPCODE_FRC: + case RC_OPCODE_MOV: + inst->SrcReg[0] = lmul_swizzle(RC_SWIZZLE_ZZZZ, inst->SrcReg[0]); break; - case OPCODE_ADD: - case OPCODE_MAX: - case OPCODE_MIN: - case OPCODE_MUL: - inst->SrcReg[0] = lmul_swizzle(SWIZZLE_ZZZZ, inst->SrcReg[0]); - inst->SrcReg[1] = lmul_swizzle(SWIZZLE_ZZZZ, inst->SrcReg[1]); + case RC_OPCODE_ADD: + case RC_OPCODE_MAX: + case RC_OPCODE_MIN: + case RC_OPCODE_MUL: + inst->SrcReg[0] = lmul_swizzle(RC_SWIZZLE_ZZZZ, inst->SrcReg[0]); + inst->SrcReg[1] = lmul_swizzle(RC_SWIZZLE_ZZZZ, inst->SrcReg[1]); break; - case OPCODE_CMP: - case OPCODE_MAD: - inst->SrcReg[0] = lmul_swizzle(SWIZZLE_ZZZZ, inst->SrcReg[0]); - inst->SrcReg[1] = lmul_swizzle(SWIZZLE_ZZZZ, inst->SrcReg[1]); - inst->SrcReg[2] = lmul_swizzle(SWIZZLE_ZZZZ, inst->SrcReg[2]); + case RC_OPCODE_CMP: + case RC_OPCODE_MAD: + inst->SrcReg[0] = lmul_swizzle(RC_SWIZZLE_ZZZZ, inst->SrcReg[0]); + inst->SrcReg[1] = lmul_swizzle(RC_SWIZZLE_ZZZZ, inst->SrcReg[1]); + inst->SrcReg[2] = lmul_swizzle(RC_SWIZZLE_ZZZZ, inst->SrcReg[2]); break; default: // Scalar instructions needn't be reswizzled @@ -104,7 +102,7 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) } if (c->Base.Debug) { - _mesa_printf("Fragment Program: After native rewrite:\n"); + fprintf(stderr, "Fragment Program: After native rewrite:\n"); rc_print_program(&c->Base.Program); fflush(stderr); } @@ -126,7 +124,7 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) } if (c->Base.Debug) { - _mesa_printf("Compiler: after NqSSA-DCE:\n"); + fprintf(stderr, "Compiler: after NqSSA-DCE:\n"); rc_print_program(&c->Base.Program); fflush(stderr); } diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c index 93a516105e..0efd2c91e6 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c @@ -22,14 +22,14 @@ #include "radeon_compiler.h" +#include + #include "../r300_reg.h" #include "radeon_nqssadce.h" #include "radeon_program.h" #include "radeon_program_alu.h" -#include "shader/prog_print.h" - /* * Take an already-setup and valid source then swizzle it appropriately to @@ -42,103 +42,82 @@ t_swizzle(y), \ t_swizzle(y), \ t_src_class(vpi->SrcReg[x].File), \ - NEGATE_NONE) | (vpi->SrcReg[x].RelAddr << 4)) + RC_MASK_NONE) | (vpi->SrcReg[x].RelAddr << 4)) -static unsigned long t_dst_mask(GLuint mask) +static unsigned long t_dst_mask(unsigned int mask) { - /* WRITEMASK_* is equivalent to VSF_FLAG_* */ - return mask & WRITEMASK_XYZW; + /* RC_MASK_* is equivalent to VSF_FLAG_* */ + return mask & RC_MASK_XYZW; } -static unsigned long t_dst_class(gl_register_file file) +static unsigned long t_dst_class(rc_register_file file) { - switch (file) { - case PROGRAM_TEMPORARY: + default: + fprintf(stderr, "%s: Bad register file %i\n", __FUNCTION__, file); + /* fall-through */ + case RC_FILE_TEMPORARY: return PVS_DST_REG_TEMPORARY; - case PROGRAM_OUTPUT: + case RC_FILE_OUTPUT: return PVS_DST_REG_OUT; - case PROGRAM_ADDRESS: + case RC_FILE_ADDRESS: return PVS_DST_REG_A0; - /* - case PROGRAM_INPUT: - case PROGRAM_LOCAL_PARAM: - case PROGRAM_ENV_PARAM: - case PROGRAM_NAMED_PARAM: - case PROGRAM_STATE_VAR: - case PROGRAM_WRITE_ONLY: - case PROGRAM_ADDRESS: - */ - default: - fprintf(stderr, "problem in %s", __FUNCTION__); - _mesa_exit(-1); - return -1; } } static unsigned long t_dst_index(struct r300_vertex_program_code *vp, - struct prog_dst_register *dst) + struct rc_dst_register *dst) { - if (dst->File == PROGRAM_OUTPUT) + if (dst->File == RC_FILE_OUTPUT) return vp->outputs[dst->Index]; return dst->Index; } -static unsigned long t_src_class(gl_register_file file) +static unsigned long t_src_class(rc_register_file file) { switch (file) { - case PROGRAM_TEMPORARY: + default: + fprintf(stderr, "%s: Bad register file %i\n", __FUNCTION__, file); + /* fall-through */ + case RC_FILE_TEMPORARY: return PVS_SRC_REG_TEMPORARY; - case PROGRAM_INPUT: + case RC_FILE_INPUT: return PVS_SRC_REG_INPUT; - case PROGRAM_LOCAL_PARAM: - case PROGRAM_ENV_PARAM: - case PROGRAM_NAMED_PARAM: - case PROGRAM_CONSTANT: - case PROGRAM_STATE_VAR: + case RC_FILE_CONSTANT: return PVS_SRC_REG_CONSTANT; - /* - case PROGRAM_OUTPUT: - case PROGRAM_WRITE_ONLY: - case PROGRAM_ADDRESS: - */ - default: - fprintf(stderr, "problem in %s", __FUNCTION__); - _mesa_exit(-1); - return -1; } } -static GLboolean t_src_conflict(struct prog_src_register a, struct prog_src_register b) +static int t_src_conflict(struct rc_src_register a, struct rc_src_register b) { unsigned long aclass = t_src_class(a.File); unsigned long bclass = t_src_class(b.File); if (aclass != bclass) - return GL_FALSE; + return 0; if (aclass == PVS_SRC_REG_TEMPORARY) - return GL_FALSE; + return 0; if (a.RelAddr || b.RelAddr) - return GL_TRUE; + return 1; if (a.Index != b.Index) - return GL_TRUE; + return 1; - return GL_FALSE; + return 0; } -static INLINE unsigned long t_swizzle(GLubyte swizzle) +static inline unsigned long t_swizzle(unsigned int swizzle) { - /* this is in fact a NOP as the Mesa SWIZZLE_* are all identical to VSF_IN_COMPONENT_* */ + /* this is in fact a NOP as the Mesa RC_SWIZZLE_* are all identical to VSF_IN_COMPONENT_* */ return swizzle; } static unsigned long t_src_index(struct r300_vertex_program_code *vp, - struct prog_src_register *src) + struct rc_src_register *src) { - if (src->File == PROGRAM_INPUT) { + if (src->File == RC_FILE_INPUT) { assert(vp->inputs[src->Index] != -1); return vp->inputs[src->Index]; } else { @@ -154,9 +133,9 @@ static unsigned long t_src_index(struct r300_vertex_program_code *vp, /* these two functions should probably be merged... */ static unsigned long t_src(struct r300_vertex_program_code *vp, - struct prog_src_register *src) + struct rc_src_register *src) { - /* src->Negate uses the NEGATE_ flags from program_instruction.h, + /* src->Negate uses the RC_MASK_ flags from program_instruction.h, * which equal our VSF_FLAGS_ values, so it's safe to just pass it here. */ return PVS_SRC_OPERAND(t_src_index(vp, src), @@ -169,9 +148,9 @@ static unsigned long t_src(struct r300_vertex_program_code *vp, } static unsigned long t_src_scalar(struct r300_vertex_program_code *vp, - struct prog_src_register *src) + struct rc_src_register *src) { - /* src->Negate uses the NEGATE_ flags from program_instruction.h, + /* src->Negate uses the RC_MASK_ flags from program_instruction.h, * which equal our VSF_FLAGS_ values, so it's safe to just pass it here. */ return PVS_SRC_OPERAND(t_src_index(vp, src), @@ -180,79 +159,79 @@ static unsigned long t_src_scalar(struct r300_vertex_program_code *vp, t_swizzle(GET_SWZ(src->Swizzle, 0)), t_swizzle(GET_SWZ(src->Swizzle, 0)), t_src_class(src->File), - src->Negate ? NEGATE_XYZW : NEGATE_NONE) | + src->Negate ? RC_MASK_XYZW : RC_MASK_NONE) | (src->RelAddr << 4); } -static GLboolean valid_dst(struct r300_vertex_program_code *vp, - struct prog_dst_register *dst) +static int valid_dst(struct r300_vertex_program_code *vp, + struct rc_dst_register *dst) { - if (dst->File == PROGRAM_OUTPUT && vp->outputs[dst->Index] == -1) { - return GL_FALSE; - } else if (dst->File == PROGRAM_ADDRESS) { + if (dst->File == RC_FILE_OUTPUT && vp->outputs[dst->Index] == -1) { + return 0; + } else if (dst->File == RC_FILE_ADDRESS) { assert(dst->Index == 0); } - return GL_TRUE; + return 1; } static void ei_vector1(struct r300_vertex_program_code *vp, - GLuint hw_opcode, - struct prog_instruction *vpi, - GLuint * inst) + unsigned int hw_opcode, + struct rc_sub_instruction *vpi, + unsigned int * inst) { inst[0] = PVS_OP_DST_OPERAND(hw_opcode, - GL_FALSE, - GL_FALSE, + 0, + 0, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &vpi->SrcReg[0]); - inst[2] = __CONST(0, SWIZZLE_ZERO); - inst[3] = __CONST(0, SWIZZLE_ZERO); + inst[2] = __CONST(0, RC_SWIZZLE_ZERO); + inst[3] = __CONST(0, RC_SWIZZLE_ZERO); } static void ei_vector2(struct r300_vertex_program_code *vp, - GLuint hw_opcode, - struct prog_instruction *vpi, - GLuint * inst) + unsigned int hw_opcode, + struct rc_sub_instruction *vpi, + unsigned int * inst) { inst[0] = PVS_OP_DST_OPERAND(hw_opcode, - GL_FALSE, - GL_FALSE, + 0, + 0, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src(vp, &vpi->SrcReg[0]); inst[2] = t_src(vp, &vpi->SrcReg[1]); - inst[3] = __CONST(1, SWIZZLE_ZERO); + inst[3] = __CONST(1, RC_SWIZZLE_ZERO); } static void ei_math1(struct r300_vertex_program_code *vp, - GLuint hw_opcode, - struct prog_instruction *vpi, - GLuint * inst) + unsigned int hw_opcode, + struct rc_sub_instruction *vpi, + unsigned int * inst) { inst[0] = PVS_OP_DST_OPERAND(hw_opcode, - GL_TRUE, - GL_FALSE, + 1, + 0, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &vpi->SrcReg[0]); - inst[2] = __CONST(0, SWIZZLE_ZERO); - inst[3] = __CONST(0, SWIZZLE_ZERO); + inst[2] = __CONST(0, RC_SWIZZLE_ZERO); + inst[3] = __CONST(0, RC_SWIZZLE_ZERO); } static void ei_lit(struct r300_vertex_program_code *vp, - struct prog_instruction *vpi, - GLuint * inst) + struct rc_sub_instruction *vpi, + unsigned int * inst) { //LIT TMP 1.Y Z TMP 1{} {X W Z Y} TMP 1{} {Y W Z X} TMP 1{} {Y X Z W} inst[0] = PVS_OP_DST_OPERAND(ME_LIGHT_COEFF_DX, - GL_TRUE, - GL_FALSE, + 1, + 0, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -262,27 +241,27 @@ static void ei_lit(struct r300_vertex_program_code *vp, PVS_SRC_SELECT_FORCE_0, // Z t_swizzle(GET_SWZ(vpi->SrcReg[0].Swizzle, 1)), // Y t_src_class(vpi->SrcReg[0].File), - vpi->SrcReg[0].Negate ? NEGATE_XYZW : NEGATE_NONE) | + vpi->SrcReg[0].Negate ? RC_MASK_XYZW : RC_MASK_NONE) | (vpi->SrcReg[0].RelAddr << 4); inst[2] = PVS_SRC_OPERAND(t_src_index(vp, &vpi->SrcReg[0]), t_swizzle(GET_SWZ(vpi->SrcReg[0].Swizzle, 1)), // Y t_swizzle(GET_SWZ(vpi->SrcReg[0].Swizzle, 3)), // W PVS_SRC_SELECT_FORCE_0, // Z t_swizzle(GET_SWZ(vpi->SrcReg[0].Swizzle, 0)), // X t_src_class(vpi->SrcReg[0].File), - vpi->SrcReg[0].Negate ? NEGATE_XYZW : NEGATE_NONE) | + vpi->SrcReg[0].Negate ? RC_MASK_XYZW : RC_MASK_NONE) | (vpi->SrcReg[0].RelAddr << 4); inst[3] = PVS_SRC_OPERAND(t_src_index(vp, &vpi->SrcReg[0]), t_swizzle(GET_SWZ(vpi->SrcReg[0].Swizzle, 1)), // Y t_swizzle(GET_SWZ(vpi->SrcReg[0].Swizzle, 0)), // X PVS_SRC_SELECT_FORCE_0, // Z t_swizzle(GET_SWZ(vpi->SrcReg[0].Swizzle, 3)), // W t_src_class(vpi->SrcReg[0].File), - vpi->SrcReg[0].Negate ? NEGATE_XYZW : NEGATE_NONE) | + vpi->SrcReg[0].Negate ? RC_MASK_XYZW : RC_MASK_NONE) | (vpi->SrcReg[0].RelAddr << 4); } static void ei_mad(struct r300_vertex_program_code *vp, - struct prog_instruction *vpi, - GLuint * inst) + struct rc_sub_instruction *vpi, + unsigned int * inst) { /* Remarks about hardware limitations of MAD * (please preserve this comment, as this information is _NOT_ @@ -310,22 +289,22 @@ static void ei_mad(struct r300_vertex_program_code *vp, * according to AMD docs, this should improve performance by one clock * as a nice side bonus. */ - if (vpi->SrcReg[0].File == PROGRAM_TEMPORARY && - vpi->SrcReg[1].File == PROGRAM_TEMPORARY && - vpi->SrcReg[2].File == PROGRAM_TEMPORARY && + if (vpi->SrcReg[0].File == RC_FILE_TEMPORARY && + vpi->SrcReg[1].File == RC_FILE_TEMPORARY && + vpi->SrcReg[2].File == RC_FILE_TEMPORARY && vpi->SrcReg[0].Index != vpi->SrcReg[1].Index && vpi->SrcReg[0].Index != vpi->SrcReg[2].Index && vpi->SrcReg[1].Index != vpi->SrcReg[2].Index) { inst[0] = PVS_OP_DST_OPERAND(PVS_MACRO_OP_2CLK_MADD, - GL_FALSE, - GL_TRUE, + 0, + 1, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); } else { inst[0] = PVS_OP_DST_OPERAND(VE_MULTIPLY_ADD, - GL_FALSE, - GL_FALSE, + 0, + 0, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); @@ -336,17 +315,17 @@ static void ei_mad(struct r300_vertex_program_code *vp, } static void ei_pow(struct r300_vertex_program_code *vp, - struct prog_instruction *vpi, - GLuint * inst) + struct rc_sub_instruction *vpi, + unsigned int * inst) { inst[0] = PVS_OP_DST_OPERAND(ME_POWER_FUNC_FF, - GL_TRUE, - GL_FALSE, + 1, + 0, t_dst_index(vp, &vpi->DstReg), t_dst_mask(vpi->DstReg.WriteMask), t_dst_class(vpi->DstReg.File)); inst[1] = t_src_scalar(vp, &vpi->SrcReg[0]); - inst[2] = __CONST(0, SWIZZLE_ZERO); + inst[2] = __CONST(0, RC_SWIZZLE_ZERO); inst[3] = t_src_scalar(vp, &vpi->SrcReg[1]); } @@ -361,8 +340,8 @@ static void translate_vertex_program(struct r300_vertex_program_compiler * compi compiler->SetHwInputOutput(compiler); for(rci = compiler->Base.Program.Instructions.Next; rci != &compiler->Base.Program.Instructions; rci = rci->Next) { - struct prog_instruction *vpi = &rci->I; - GLuint *inst = compiler->code->body.d + compiler->code->length; + struct rc_sub_instruction *vpi = &rci->I; + unsigned int *inst = compiler->code->body.d + compiler->code->length; /* Skip instructions writing to non-existing destination */ if (!valid_dst(compiler->code, &vpi->DstReg)) @@ -374,26 +353,26 @@ static void translate_vertex_program(struct r300_vertex_program_compiler * compi } switch (vpi->Opcode) { - case OPCODE_ADD: ei_vector2(compiler->code, VE_ADD, vpi, inst); break; - case OPCODE_ARL: ei_vector1(compiler->code, VE_FLT2FIX_DX, vpi, inst); break; - case OPCODE_DP4: ei_vector2(compiler->code, VE_DOT_PRODUCT, vpi, inst); break; - case OPCODE_DST: ei_vector2(compiler->code, VE_DISTANCE_VECTOR, vpi, inst); break; - case OPCODE_EX2: ei_math1(compiler->code, ME_EXP_BASE2_FULL_DX, vpi, inst); break; - case OPCODE_EXP: ei_math1(compiler->code, ME_EXP_BASE2_DX, vpi, inst); break; - case OPCODE_FRC: ei_vector1(compiler->code, VE_FRACTION, vpi, inst); break; - case OPCODE_LG2: ei_math1(compiler->code, ME_LOG_BASE2_FULL_DX, vpi, inst); break; - case OPCODE_LIT: ei_lit(compiler->code, vpi, inst); break; - case OPCODE_LOG: ei_math1(compiler->code, ME_LOG_BASE2_DX, vpi, inst); break; - case OPCODE_MAD: ei_mad(compiler->code, vpi, inst); break; - case OPCODE_MAX: ei_vector2(compiler->code, VE_MAXIMUM, vpi, inst); break; - case OPCODE_MIN: ei_vector2(compiler->code, VE_MINIMUM, vpi, inst); break; - case OPCODE_MOV: ei_vector1(compiler->code, VE_ADD, vpi, inst); break; - case OPCODE_MUL: ei_vector2(compiler->code, VE_MULTIPLY, vpi, inst); break; - case OPCODE_POW: ei_pow(compiler->code, vpi, inst); break; - case OPCODE_RCP: ei_math1(compiler->code, ME_RECIP_DX, vpi, inst); break; - case OPCODE_RSQ: ei_math1(compiler->code, ME_RECIP_SQRT_DX, vpi, inst); break; - case OPCODE_SGE: ei_vector2(compiler->code, VE_SET_GREATER_THAN_EQUAL, vpi, inst); break; - case OPCODE_SLT: ei_vector2(compiler->code, VE_SET_LESS_THAN, vpi, inst); break; + case RC_OPCODE_ADD: ei_vector2(compiler->code, VE_ADD, vpi, inst); break; + case RC_OPCODE_ARL: ei_vector1(compiler->code, VE_FLT2FIX_DX, vpi, inst); break; + case RC_OPCODE_DP4: ei_vector2(compiler->code, VE_DOT_PRODUCT, vpi, inst); break; + case RC_OPCODE_DST: ei_vector2(compiler->code, VE_DISTANCE_VECTOR, vpi, inst); break; + case RC_OPCODE_EX2: ei_math1(compiler->code, ME_EXP_BASE2_FULL_DX, vpi, inst); break; + case RC_OPCODE_EXP: ei_math1(compiler->code, ME_EXP_BASE2_DX, vpi, inst); break; + case RC_OPCODE_FRC: ei_vector1(compiler->code, VE_FRACTION, vpi, inst); break; + case RC_OPCODE_LG2: ei_math1(compiler->code, ME_LOG_BASE2_FULL_DX, vpi, inst); break; + case RC_OPCODE_LIT: ei_lit(compiler->code, vpi, inst); break; + case RC_OPCODE_LOG: ei_math1(compiler->code, ME_LOG_BASE2_DX, vpi, inst); break; + case RC_OPCODE_MAD: ei_mad(compiler->code, vpi, inst); break; + case RC_OPCODE_MAX: ei_vector2(compiler->code, VE_MAXIMUM, vpi, inst); break; + case RC_OPCODE_MIN: ei_vector2(compiler->code, VE_MINIMUM, vpi, inst); break; + case RC_OPCODE_MOV: ei_vector1(compiler->code, VE_ADD, vpi, inst); break; + case RC_OPCODE_MUL: ei_vector2(compiler->code, VE_MULTIPLY, vpi, inst); break; + case RC_OPCODE_POW: ei_pow(compiler->code, vpi, inst); break; + case RC_OPCODE_RCP: ei_math1(compiler->code, ME_RECIP_DX, vpi, inst); break; + case RC_OPCODE_RSQ: ei_math1(compiler->code, ME_RECIP_SQRT_DX, vpi, inst); break; + case RC_OPCODE_SGE: ei_vector2(compiler->code, VE_SET_GREATER_THAN_EQUAL, vpi, inst); break; + case RC_OPCODE_SLT: ei_vector2(compiler->code, VE_SET_LESS_THAN, vpi, inst); break; default: rc_error(&compiler->Base, "Unknown opcode %i\n", vpi->Opcode); return; @@ -407,36 +386,35 @@ static void translate_vertex_program(struct r300_vertex_program_compiler * compi } struct temporary_allocation { - GLuint Allocated:1; - GLuint HwTemp:15; + unsigned int Allocated:1; + unsigned int HwTemp:15; struct rc_instruction * LastRead; }; static void allocate_temporary_registers(struct r300_vertex_program_compiler * compiler) { struct rc_instruction *inst; - GLuint num_orig_temps = 0; - GLboolean hwtemps[VSF_MAX_FRAGMENT_TEMPS]; + unsigned int num_orig_temps = 0; + char hwtemps[VSF_MAX_FRAGMENT_TEMPS]; struct temporary_allocation * ta; - GLuint i, j; + unsigned int i, j; compiler->code->num_temporaries = 0; memset(hwtemps, 0, sizeof(hwtemps)); /* Pass 1: Count original temporaries and allocate structures */ for(inst = compiler->Base.Program.Instructions.Next; inst != &compiler->Base.Program.Instructions; inst = inst->Next) { - GLuint numsrcs = _mesa_num_inst_src_regs(inst->I.Opcode); - GLuint numdsts = _mesa_num_inst_dst_regs(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); - for (i = 0; i < numsrcs; ++i) { - if (inst->I.SrcReg[i].File == PROGRAM_TEMPORARY) { + for (i = 0; i < opcode->NumSrcRegs; ++i) { + if (inst->I.SrcReg[i].File == RC_FILE_TEMPORARY) { if (inst->I.SrcReg[i].Index >= num_orig_temps) num_orig_temps = inst->I.SrcReg[i].Index + 1; } } - if (numdsts) { - if (inst->I.DstReg.File == PROGRAM_TEMPORARY) { + if (opcode->HasDstReg) { + if (inst->I.DstReg.File == RC_FILE_TEMPORARY) { if (inst->I.DstReg.Index >= num_orig_temps) num_orig_temps = inst->I.DstReg.Index + 1; } @@ -449,32 +427,31 @@ static void allocate_temporary_registers(struct r300_vertex_program_compiler * c /* Pass 2: Determine original temporary lifetimes */ for(inst = compiler->Base.Program.Instructions.Next; inst != &compiler->Base.Program.Instructions; inst = inst->Next) { - GLuint numsrcs = _mesa_num_inst_src_regs(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); - for (i = 0; i < numsrcs; ++i) { - if (inst->I.SrcReg[i].File == PROGRAM_TEMPORARY) + for (i = 0; i < opcode->NumSrcRegs; ++i) { + if (inst->I.SrcReg[i].File == RC_FILE_TEMPORARY) ta[inst->I.SrcReg[i].Index].LastRead = inst; } } /* Pass 3: Register allocation */ for(inst = compiler->Base.Program.Instructions.Next; inst != &compiler->Base.Program.Instructions; inst = inst->Next) { - GLuint numsrcs = _mesa_num_inst_src_regs(inst->I.Opcode); - GLuint numdsts = _mesa_num_inst_dst_regs(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); - for (i = 0; i < numsrcs; ++i) { - if (inst->I.SrcReg[i].File == PROGRAM_TEMPORARY) { - GLuint orig = inst->I.SrcReg[i].Index; + for (i = 0; i < opcode->NumSrcRegs; ++i) { + if (inst->I.SrcReg[i].File == RC_FILE_TEMPORARY) { + unsigned int orig = inst->I.SrcReg[i].Index; inst->I.SrcReg[i].Index = ta[orig].HwTemp; if (ta[orig].Allocated && inst == ta[orig].LastRead) - hwtemps[ta[orig].HwTemp] = GL_FALSE; + hwtemps[ta[orig].HwTemp] = 0; } } - if (numdsts) { - if (inst->I.DstReg.File == PROGRAM_TEMPORARY) { - GLuint orig = inst->I.DstReg.Index; + if (opcode->HasDstReg) { + if (inst->I.DstReg.File == RC_FILE_TEMPORARY) { + unsigned int orig = inst->I.DstReg.Index; if (!ta[orig].Allocated) { for(j = 0; j < VSF_MAX_FRAGMENT_TEMPS; ++j) { @@ -484,9 +461,9 @@ static void allocate_temporary_registers(struct r300_vertex_program_compiler * c if (j >= VSF_MAX_FRAGMENT_TEMPS) { fprintf(stderr, "Out of hw temporaries\n"); } else { - ta[orig].Allocated = GL_TRUE; + ta[orig].Allocated = 1; ta[orig].HwTemp = j; - hwtemps[j] = GL_TRUE; + hwtemps[j] = 1; if (j >= compiler->code->num_temporaries) compiler->code->num_temporaries = j + 1; @@ -504,45 +481,45 @@ static void allocate_temporary_registers(struct r300_vertex_program_compiler * c * Vertex engine cannot read two inputs or two constants at the same time. * Introduce intermediate MOVs to temporary registers to account for this. */ -static GLboolean transform_source_conflicts( +static int transform_source_conflicts( struct radeon_compiler *c, struct rc_instruction* inst, void* unused) { - GLuint num_operands = _mesa_num_inst_src_regs(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); - if (num_operands == 3) { + if (opcode->NumSrcRegs == 3) { if (t_src_conflict(inst->I.SrcReg[1], inst->I.SrcReg[2]) || t_src_conflict(inst->I.SrcReg[0], inst->I.SrcReg[2])) { int tmpreg = rc_find_free_temporary(c); struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst->Prev); - inst_mov->I.Opcode = OPCODE_MOV; - inst_mov->I.DstReg.File = PROGRAM_TEMPORARY; + inst_mov->I.Opcode = RC_OPCODE_MOV; + inst_mov->I.DstReg.File = RC_FILE_TEMPORARY; inst_mov->I.DstReg.Index = tmpreg; inst_mov->I.SrcReg[0] = inst->I.SrcReg[2]; reset_srcreg(&inst->I.SrcReg[2]); - inst->I.SrcReg[2].File = PROGRAM_TEMPORARY; + inst->I.SrcReg[2].File = RC_FILE_TEMPORARY; inst->I.SrcReg[2].Index = tmpreg; } } - if (num_operands >= 2) { + if (opcode->NumSrcRegs >= 2) { if (t_src_conflict(inst->I.SrcReg[1], inst->I.SrcReg[0])) { int tmpreg = rc_find_free_temporary(c); struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst->Prev); - inst_mov->I.Opcode = OPCODE_MOV; - inst_mov->I.DstReg.File = PROGRAM_TEMPORARY; + inst_mov->I.Opcode = RC_OPCODE_MOV; + inst_mov->I.DstReg.File = RC_FILE_TEMPORARY; inst_mov->I.DstReg.Index = tmpreg; inst_mov->I.SrcReg[0] = inst->I.SrcReg[1]; reset_srcreg(&inst->I.SrcReg[1]); - inst->I.SrcReg[1].File = PROGRAM_TEMPORARY; + inst->I.SrcReg[1].File = RC_FILE_TEMPORARY; inst->I.SrcReg[1].Index = tmpreg; } } - return GL_TRUE; + return 1; } static void addArtificialOutputs(struct r300_vertex_program_compiler * compiler) @@ -553,15 +530,15 @@ static void addArtificialOutputs(struct r300_vertex_program_compiler * compiler) if ((compiler->RequiredOutputs & (1 << i)) && !(compiler->Base.Program.OutputsWritten & (1 << i))) { struct rc_instruction * inst = rc_insert_new_instruction(&compiler->Base, compiler->Base.Program.Instructions.Prev); - inst->I.Opcode = OPCODE_MOV; + inst->I.Opcode = RC_OPCODE_MOV; - inst->I.DstReg.File = PROGRAM_OUTPUT; + inst->I.DstReg.File = RC_FILE_OUTPUT; inst->I.DstReg.Index = i; - inst->I.DstReg.WriteMask = WRITEMASK_XYZW; + inst->I.DstReg.WriteMask = RC_MASK_XYZW; - inst->I.SrcReg[0].File = PROGRAM_CONSTANT; + inst->I.SrcReg[0].File = RC_FILE_CONSTANT; inst->I.SrcReg[0].Index = 0; - inst->I.SrcReg[0].Swizzle = SWIZZLE_XYZW; + inst->I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZW; compiler->Base.Program.OutputsWritten |= 1 << i; } @@ -573,18 +550,18 @@ static void nqssadceInit(struct nqssadce_state* s) struct r300_vertex_program_compiler * compiler = s->UserData; int i; - for(i = 0; i < VERT_RESULT_MAX; ++i) { + for(i = 0; i < 32; ++i) { if (compiler->RequiredOutputs & (1 << i)) - s->Outputs[i].Sourced = WRITEMASK_XYZW; + s->Outputs[i].Sourced = RC_MASK_XYZW; } } -static GLboolean swizzleIsNative(GLuint opcode, struct prog_src_register reg) +static int swizzleIsNative(rc_opcode opcode, struct rc_src_register reg) { (void) opcode; (void) reg; - return GL_TRUE; + return 1; } diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c index 7e2faed690..3e994ebd1b 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c @@ -27,15 +27,17 @@ #include "r500_fragprog.h" +#include + #include "../r300_reg.h" -static struct prog_src_register shadow_ambient(struct radeon_compiler * c, int tmu) +static struct rc_src_register shadow_ambient(struct radeon_compiler * c, int tmu) { - struct prog_src_register reg = { 0, }; + struct rc_src_register reg = { 0, }; - reg.File = PROGRAM_STATE_VAR; + reg.File = RC_FILE_CONSTANT; reg.Index = rc_constants_add_state(&c->Program.Constants, RC_STATE_SHADOW_AMBIENT, tmu); - reg.Swizzle = SWIZZLE_WWWW; + reg.Swizzle = RC_SWIZZLE_WWWW; return reg; } @@ -44,7 +46,7 @@ static struct prog_src_register shadow_ambient(struct radeon_compiler * c, int t * - implement texture compare (shadow extensions) * - extract non-native source / destination operands */ -GLboolean r500_transform_TEX( +int r500_transform_TEX( struct radeon_compiler * c, struct rc_instruction * inst, void* data) @@ -52,77 +54,77 @@ GLboolean r500_transform_TEX( struct r300_fragment_program_compiler *compiler = (struct r300_fragment_program_compiler*)data; - if (inst->I.Opcode != OPCODE_TEX && - inst->I.Opcode != OPCODE_TXB && - inst->I.Opcode != OPCODE_TXP && - inst->I.Opcode != OPCODE_KIL) - return GL_FALSE; + if (inst->I.Opcode != RC_OPCODE_TEX && + inst->I.Opcode != RC_OPCODE_TXB && + inst->I.Opcode != RC_OPCODE_TXP && + inst->I.Opcode != RC_OPCODE_KIL) + return 0; /* ARB_shadow & EXT_shadow_funcs */ - if (inst->I.Opcode != OPCODE_KIL && + if (inst->I.Opcode != RC_OPCODE_KIL && c->Program.ShadowSamplers & (1 << inst->I.TexSrcUnit)) { - GLuint comparefunc = GL_NEVER + compiler->state.unit[inst->I.TexSrcUnit].texture_compare_func; + rc_compare_func comparefunc = compiler->state.unit[inst->I.TexSrcUnit].texture_compare_func; - if (comparefunc == GL_NEVER || comparefunc == GL_ALWAYS) { - inst->I.Opcode = OPCODE_MOV; + if (comparefunc == RC_COMPARE_FUNC_NEVER || comparefunc == RC_COMPARE_FUNC_ALWAYS) { + inst->I.Opcode = RC_OPCODE_MOV; - if (comparefunc == GL_ALWAYS) { - inst->I.SrcReg[0].File = PROGRAM_BUILTIN; - inst->I.SrcReg[0].Swizzle = SWIZZLE_1111; + if (comparefunc == RC_COMPARE_FUNC_ALWAYS) { + inst->I.SrcReg[0].File = RC_FILE_NONE; + inst->I.SrcReg[0].Swizzle = RC_SWIZZLE_1111; } else { inst->I.SrcReg[0] = shadow_ambient(c, inst->I.TexSrcUnit); } - return GL_TRUE; + return 1; } else { - GLuint comparefunc = GL_NEVER + compiler->state.unit[inst->I.TexSrcUnit].texture_compare_func; - GLuint depthmode = compiler->state.unit[inst->I.TexSrcUnit].depth_texture_mode; + rc_compare_func comparefunc = compiler->state.unit[inst->I.TexSrcUnit].texture_compare_func; + unsigned int depthmode = compiler->state.unit[inst->I.TexSrcUnit].depth_texture_mode; struct rc_instruction * inst_rcp = rc_insert_new_instruction(c, inst); struct rc_instruction * inst_mad = rc_insert_new_instruction(c, inst_rcp); struct rc_instruction * inst_cmp = rc_insert_new_instruction(c, inst_mad); int pass, fail; - inst_rcp->I.Opcode = OPCODE_RCP; - inst_rcp->I.DstReg.File = PROGRAM_TEMPORARY; + inst_rcp->I.Opcode = RC_OPCODE_RCP; + inst_rcp->I.DstReg.File = RC_FILE_TEMPORARY; inst_rcp->I.DstReg.Index = rc_find_free_temporary(c); - inst_rcp->I.DstReg.WriteMask = WRITEMASK_W; + inst_rcp->I.DstReg.WriteMask = RC_MASK_W; inst_rcp->I.SrcReg[0] = inst->I.SrcReg[0]; - inst_rcp->I.SrcReg[0].Swizzle = SWIZZLE_WWWW; + inst_rcp->I.SrcReg[0].Swizzle = RC_SWIZZLE_WWWW; inst_cmp->I.DstReg = inst->I.DstReg; - inst->I.DstReg.File = PROGRAM_TEMPORARY; + inst->I.DstReg.File = RC_FILE_TEMPORARY; inst->I.DstReg.Index = rc_find_free_temporary(c); - inst->I.DstReg.WriteMask = WRITEMASK_XYZW; + inst->I.DstReg.WriteMask = RC_MASK_XYZW; - inst_mad->I.Opcode = OPCODE_MAD; - inst_mad->I.DstReg.File = PROGRAM_TEMPORARY; + inst_mad->I.Opcode = RC_OPCODE_MAD; + inst_mad->I.DstReg.File = RC_FILE_TEMPORARY; inst_mad->I.DstReg.Index = rc_find_free_temporary(c); inst_mad->I.SrcReg[0] = inst->I.SrcReg[0]; - inst_mad->I.SrcReg[0].Swizzle = SWIZZLE_ZZZZ; - inst_mad->I.SrcReg[1].File = PROGRAM_TEMPORARY; + inst_mad->I.SrcReg[0].Swizzle = RC_SWIZZLE_ZZZZ; + inst_mad->I.SrcReg[1].File = RC_FILE_TEMPORARY; inst_mad->I.SrcReg[1].Index = inst_rcp->I.DstReg.Index; - inst_mad->I.SrcReg[1].Swizzle = SWIZZLE_WWWW; - inst_mad->I.SrcReg[2].File = PROGRAM_TEMPORARY; + inst_mad->I.SrcReg[1].Swizzle = RC_SWIZZLE_WWWW; + inst_mad->I.SrcReg[2].File = RC_FILE_TEMPORARY; inst_mad->I.SrcReg[2].Index = inst->I.DstReg.Index; if (depthmode == 0) /* GL_LUMINANCE */ - inst_mad->I.SrcReg[2].Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_Z); + inst_mad->I.SrcReg[2].Swizzle = RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_Z); else if (depthmode == 2) /* GL_ALPHA */ - inst_mad->I.SrcReg[2].Swizzle = SWIZZLE_WWWW; + inst_mad->I.SrcReg[2].Swizzle = RC_SWIZZLE_WWWW; /* Recall that SrcReg[0] is tex, SrcReg[2] is r and: * r < tex <=> -tex+r < 0 * r >= tex <=> not (-tex+r < 0 */ - if (comparefunc == GL_LESS || comparefunc == GL_GEQUAL) - inst_mad->I.SrcReg[2].Negate = inst_mad->I.SrcReg[2].Negate ^ NEGATE_XYZW; + if (comparefunc == RC_COMPARE_FUNC_LESS || comparefunc == RC_COMPARE_FUNC_GEQUAL) + inst_mad->I.SrcReg[2].Negate = inst_mad->I.SrcReg[2].Negate ^ RC_MASK_XYZW; else - inst_mad->I.SrcReg[0].Negate = inst_mad->I.SrcReg[0].Negate ^ NEGATE_XYZW; + inst_mad->I.SrcReg[0].Negate = inst_mad->I.SrcReg[0].Negate ^ RC_MASK_XYZW; - inst_cmp->I.Opcode = OPCODE_CMP; + inst_cmp->I.Opcode = RC_OPCODE_CMP; /* DstReg has been filled out above */ - inst_cmp->I.SrcReg[0].File = PROGRAM_TEMPORARY; + inst_cmp->I.SrcReg[0].File = RC_FILE_TEMPORARY; inst_cmp->I.SrcReg[0].Index = inst_mad->I.DstReg.Index; - if (comparefunc == GL_LESS || comparefunc == GL_GREATER) { + if (comparefunc == RC_COMPARE_FUNC_LESS || comparefunc == RC_COMPARE_FUNC_GREATER) { pass = 1; fail = 2; } else { @@ -130,97 +132,97 @@ GLboolean r500_transform_TEX( fail = 1; } - inst_cmp->I.SrcReg[pass].File = PROGRAM_BUILTIN; - inst_cmp->I.SrcReg[pass].Swizzle = SWIZZLE_1111; + inst_cmp->I.SrcReg[pass].File = RC_FILE_NONE; + inst_cmp->I.SrcReg[pass].Swizzle = RC_SWIZZLE_1111; inst_cmp->I.SrcReg[fail] = shadow_ambient(c, inst->I.TexSrcUnit); } } /* Cannot write texture to output registers */ - if (inst->I.Opcode != OPCODE_KIL && inst->I.DstReg.File != PROGRAM_TEMPORARY) { + if (inst->I.Opcode != RC_OPCODE_KIL && inst->I.DstReg.File != RC_FILE_TEMPORARY) { struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst); - inst_mov->I.Opcode = OPCODE_MOV; + inst_mov->I.Opcode = RC_OPCODE_MOV; inst_mov->I.DstReg = inst->I.DstReg; - inst_mov->I.SrcReg[0].File = PROGRAM_TEMPORARY; + inst_mov->I.SrcReg[0].File = RC_FILE_TEMPORARY; inst_mov->I.SrcReg[0].Index = rc_find_free_temporary(c); - inst->I.DstReg.File = PROGRAM_TEMPORARY; + inst->I.DstReg.File = RC_FILE_TEMPORARY; inst->I.DstReg.Index = inst_mov->I.SrcReg[0].Index; - inst->I.DstReg.WriteMask = WRITEMASK_XYZW; + inst->I.DstReg.WriteMask = RC_MASK_XYZW; } /* Cannot read texture coordinate from constants file */ - if (inst->I.SrcReg[0].File != PROGRAM_TEMPORARY && inst->I.SrcReg[0].File != PROGRAM_INPUT) { + if (inst->I.SrcReg[0].File != RC_FILE_TEMPORARY && inst->I.SrcReg[0].File != RC_FILE_INPUT) { struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst->Prev); - inst_mov->I.Opcode = OPCODE_MOV; - inst_mov->I.DstReg.File = PROGRAM_TEMPORARY; + inst_mov->I.Opcode = RC_OPCODE_MOV; + inst_mov->I.DstReg.File = RC_FILE_TEMPORARY; inst_mov->I.DstReg.Index = rc_find_free_temporary(c); inst_mov->I.SrcReg[0] = inst->I.SrcReg[0]; reset_srcreg(&inst->I.SrcReg[0]); - inst->I.SrcReg[0].File = PROGRAM_TEMPORARY; + inst->I.SrcReg[0].File = RC_FILE_TEMPORARY; inst->I.SrcReg[0].Index = inst_mov->I.DstReg.Index; } - return GL_TRUE; + return 1; } -GLboolean r500FPIsNativeSwizzle(GLuint opcode, struct prog_src_register reg) +int r500FPIsNativeSwizzle(rc_opcode opcode, struct rc_src_register reg) { - GLuint relevant; + unsigned int relevant; int i; - if (opcode == OPCODE_TEX || - opcode == OPCODE_TXB || - opcode == OPCODE_TXP || - opcode == OPCODE_KIL) { + if (opcode == RC_OPCODE_TEX || + opcode == RC_OPCODE_TXB || + opcode == RC_OPCODE_TXP || + opcode == RC_OPCODE_KIL) { if (reg.Abs) - return GL_FALSE; + return 0; - if (opcode == OPCODE_KIL && (reg.Swizzle != SWIZZLE_NOOP || reg.Negate != NEGATE_NONE)) - return GL_FALSE; + if (opcode == RC_OPCODE_KIL && (reg.Swizzle != RC_SWIZZLE_XYZW || reg.Negate != RC_MASK_NONE)) + return 0; if (reg.Negate) - reg.Negate ^= NEGATE_XYZW; + reg.Negate ^= RC_MASK_XYZW; for(i = 0; i < 4; ++i) { - GLuint swz = GET_SWZ(reg.Swizzle, i); - if (swz == SWIZZLE_NIL) { + unsigned int swz = GET_SWZ(reg.Swizzle, i); + if (swz == RC_SWIZZLE_UNUSED) { reg.Negate &= ~(1 << i); continue; } if (swz >= 4) - return GL_FALSE; + return 0; } if (reg.Negate) - return GL_FALSE; + return 0; - return GL_TRUE; - } else if (opcode == OPCODE_DDX || opcode == OPCODE_DDY) { + return 1; + } else if (opcode == RC_OPCODE_DDX || opcode == RC_OPCODE_DDY) { /* DDX/MDH and DDY/MDV explicitly ignore incoming swizzles; * if it doesn't fit perfectly into a .xyzw case... */ - if (reg.Swizzle == SWIZZLE_NOOP && !reg.Abs && !reg.Negate) - return GL_TRUE; + if (reg.Swizzle == RC_SWIZZLE_XYZW && !reg.Abs && !reg.Negate) + return 1; - return GL_FALSE; + return 0; } else { /* ALU instructions support almost everything */ if (reg.Abs) - return GL_TRUE; + return 1; relevant = 0; for(i = 0; i < 3; ++i) { - GLuint swz = GET_SWZ(reg.Swizzle, i); - if (swz != SWIZZLE_NIL && swz != SWIZZLE_ZERO) + unsigned int swz = GET_SWZ(reg.Swizzle, i); + if (swz != RC_SWIZZLE_UNUSED && swz != RC_SWIZZLE_ZERO) relevant |= 1 << i; } if ((reg.Negate & relevant) && ((reg.Negate & relevant) != relevant)) - return GL_FALSE; + return 0; - return GL_TRUE; + return 1; } } @@ -230,14 +232,14 @@ GLboolean r500FPIsNativeSwizzle(GLuint opcode, struct prog_src_register reg) * The only thing we *cannot* do in an ALU instruction is per-component * negation. Therefore, we split the MOV into two instructions when necessary. */ -void r500FPBuildSwizzle(struct nqssadce_state *s, struct prog_dst_register dst, struct prog_src_register src) +void r500FPBuildSwizzle(struct nqssadce_state *s, struct rc_dst_register dst, struct rc_src_register src) { - GLuint negatebase[2] = { 0, 0 }; + unsigned int negatebase[2] = { 0, 0 }; int i; for(i = 0; i < 4; ++i) { - GLuint swz = GET_SWZ(src.Swizzle, i); - if (swz == SWIZZLE_NIL) + unsigned int swz = GET_SWZ(src.Swizzle, i); + if (swz == RC_SWIZZLE_UNUSED) continue; negatebase[GET_BIT(src.Negate, i)] |= 1 << i; } @@ -247,11 +249,11 @@ void r500FPBuildSwizzle(struct nqssadce_state *s, struct prog_dst_register dst, continue; struct rc_instruction *inst = rc_insert_new_instruction(s->Compiler, s->IP->Prev); - inst->I.Opcode = OPCODE_MOV; + inst->I.Opcode = RC_OPCODE_MOV; inst->I.DstReg = dst; inst->I.DstReg.WriteMask = negatebase[i]; inst->I.SrcReg[0] = src; - inst->I.SrcReg[0].Negate = (i == 0) ? NEGATE_NONE : NEGATE_XYZW; + inst->I.SrcReg[0].Negate = (i == 0) ? RC_MASK_NONE : RC_MASK_XYZW; } } diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.h b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.h index 9091f65cd2..887d4abbd2 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.h +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.h @@ -33,9 +33,6 @@ #ifndef __R500_FRAGPROG_H_ #define __R500_FRAGPROG_H_ -#include "shader/prog_parameter.h" -#include "shader/prog_instruction.h" - #include "radeon_compiler.h" #include "radeon_nqssadce.h" @@ -43,11 +40,11 @@ extern void r500BuildFragmentProgramHwCode(struct r300_fragment_program_compiler extern void r500FragmentProgramDump(struct rX00_fragment_program_code *c); -extern GLboolean r500FPIsNativeSwizzle(GLuint opcode, struct prog_src_register reg); +extern int r500FPIsNativeSwizzle(rc_opcode opcode, struct rc_src_register reg); -extern void r500FPBuildSwizzle(struct nqssadce_state *s, struct prog_dst_register dst, struct prog_src_register src); +extern void r500FPBuildSwizzle(struct nqssadce_state *s, struct rc_dst_register dst, struct rc_src_register src); -extern GLboolean r500_transform_TEX( +extern int r500_transform_TEX( struct radeon_compiler * c, struct rc_instruction * inst, void* data); diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c index d694725c9b..2f0c0d5283 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c @@ -60,63 +60,63 @@ } while(0) -static GLuint translate_rgb_op(struct r300_fragment_program_compiler *c, GLuint opcode) +static unsigned int translate_rgb_op(struct r300_fragment_program_compiler *c, rc_opcode opcode) { switch(opcode) { - case OPCODE_CMP: return R500_ALU_RGBA_OP_CMP; - case OPCODE_DDX: return R500_ALU_RGBA_OP_MDH; - case OPCODE_DDY: return R500_ALU_RGBA_OP_MDV; - case OPCODE_DP3: return R500_ALU_RGBA_OP_DP3; - case OPCODE_DP4: return R500_ALU_RGBA_OP_DP4; - case OPCODE_FRC: return R500_ALU_RGBA_OP_FRC; + case RC_OPCODE_CMP: return R500_ALU_RGBA_OP_CMP; + case RC_OPCODE_DDX: return R500_ALU_RGBA_OP_MDH; + case RC_OPCODE_DDY: return R500_ALU_RGBA_OP_MDV; + case RC_OPCODE_DP3: return R500_ALU_RGBA_OP_DP3; + case RC_OPCODE_DP4: return R500_ALU_RGBA_OP_DP4; + case RC_OPCODE_FRC: return R500_ALU_RGBA_OP_FRC; default: error("translate_rgb_op(%d): unknown opcode\n", opcode); /* fall through */ - case OPCODE_NOP: + case RC_OPCODE_NOP: /* fall through */ - case OPCODE_MAD: return R500_ALU_RGBA_OP_MAD; - case OPCODE_MAX: return R500_ALU_RGBA_OP_MAX; - case OPCODE_MIN: return R500_ALU_RGBA_OP_MIN; - case OPCODE_REPL_ALPHA: return R500_ALU_RGBA_OP_SOP; + case RC_OPCODE_MAD: return R500_ALU_RGBA_OP_MAD; + case RC_OPCODE_MAX: return R500_ALU_RGBA_OP_MAX; + case RC_OPCODE_MIN: return R500_ALU_RGBA_OP_MIN; + case RC_OPCODE_REPL_ALPHA: return R500_ALU_RGBA_OP_SOP; } } -static GLuint translate_alpha_op(struct r300_fragment_program_compiler *c, GLuint opcode) +static unsigned int translate_alpha_op(struct r300_fragment_program_compiler *c, rc_opcode opcode) { switch(opcode) { - case OPCODE_CMP: return R500_ALPHA_OP_CMP; - case OPCODE_COS: return R500_ALPHA_OP_COS; - case OPCODE_DDX: return R500_ALPHA_OP_MDH; - case OPCODE_DDY: return R500_ALPHA_OP_MDV; - case OPCODE_DP3: return R500_ALPHA_OP_DP; - case OPCODE_DP4: return R500_ALPHA_OP_DP; - case OPCODE_EX2: return R500_ALPHA_OP_EX2; - case OPCODE_FRC: return R500_ALPHA_OP_FRC; - case OPCODE_LG2: return R500_ALPHA_OP_LN2; + case RC_OPCODE_CMP: return R500_ALPHA_OP_CMP; + case RC_OPCODE_COS: return R500_ALPHA_OP_COS; + case RC_OPCODE_DDX: return R500_ALPHA_OP_MDH; + case RC_OPCODE_DDY: return R500_ALPHA_OP_MDV; + case RC_OPCODE_DP3: return R500_ALPHA_OP_DP; + case RC_OPCODE_DP4: return R500_ALPHA_OP_DP; + case RC_OPCODE_EX2: return R500_ALPHA_OP_EX2; + case RC_OPCODE_FRC: return R500_ALPHA_OP_FRC; + case RC_OPCODE_LG2: return R500_ALPHA_OP_LN2; default: error("translate_alpha_op(%d): unknown opcode\n", opcode); /* fall through */ - case OPCODE_NOP: + case RC_OPCODE_NOP: /* fall through */ - case OPCODE_MAD: return R500_ALPHA_OP_MAD; - case OPCODE_MAX: return R500_ALPHA_OP_MAX; - case OPCODE_MIN: return R500_ALPHA_OP_MIN; - case OPCODE_RCP: return R500_ALPHA_OP_RCP; - case OPCODE_RSQ: return R500_ALPHA_OP_RSQ; - case OPCODE_SIN: return R500_ALPHA_OP_SIN; + case RC_OPCODE_MAD: return R500_ALPHA_OP_MAD; + case RC_OPCODE_MAX: return R500_ALPHA_OP_MAX; + case RC_OPCODE_MIN: return R500_ALPHA_OP_MIN; + case RC_OPCODE_RCP: return R500_ALPHA_OP_RCP; + case RC_OPCODE_RSQ: return R500_ALPHA_OP_RSQ; + case RC_OPCODE_SIN: return R500_ALPHA_OP_SIN; } } -static GLuint fix_hw_swizzle(GLuint swz) +static unsigned int fix_hw_swizzle(unsigned int swz) { if (swz == 5) swz = 6; - if (swz == SWIZZLE_NIL) swz = 4; + if (swz == RC_SWIZZLE_UNUSED) swz = 4; return swz; } -static GLuint translate_arg_rgb(struct radeon_pair_instruction *inst, int arg) +static unsigned int translate_arg_rgb(struct radeon_pair_instruction *inst, int arg) { - GLuint t = inst->RGB.Arg[arg].Source; + unsigned int t = inst->RGB.Arg[arg].Source; int comp; t |= inst->RGB.Arg[arg].Negate << 11; t |= inst->RGB.Arg[arg].Abs << 12; @@ -127,22 +127,22 @@ static GLuint translate_arg_rgb(struct radeon_pair_instruction *inst, int arg) return t; } -static GLuint translate_arg_alpha(struct radeon_pair_instruction *inst, int i) +static unsigned int translate_arg_alpha(struct radeon_pair_instruction *inst, int i) { - GLuint t = inst->Alpha.Arg[i].Source; + unsigned int t = inst->Alpha.Arg[i].Source; t |= fix_hw_swizzle(inst->Alpha.Arg[i].Swizzle) << 2; t |= inst->Alpha.Arg[i].Negate << 5; t |= inst->Alpha.Arg[i].Abs << 6; return t; } -static void use_temporary(struct r500_fragment_program_code* code, GLuint index) +static void use_temporary(struct r500_fragment_program_code* code, unsigned int index) { if (index > code->max_temp_idx) code->max_temp_idx = index; } -static GLuint use_source(struct r500_fragment_program_code* code, struct radeon_pair_instruction_source src) +static unsigned int use_source(struct r500_fragment_program_code* code, struct radeon_pair_instruction_source src) { if (!src.Constant) use_temporary(code, src.Index); @@ -153,13 +153,13 @@ static GLuint use_source(struct r500_fragment_program_code* code, struct radeon_ /** * Emit a paired ALU instruction. */ -static GLboolean emit_paired(void *data, struct radeon_pair_instruction *inst) +static int emit_paired(void *data, struct radeon_pair_instruction *inst) { PROG_CODE; if (code->inst_end >= 511) { error("emit_alu: Too many instructions"); - return GL_FALSE; + return 0; } int ip = ++code->inst_end; @@ -177,7 +177,7 @@ static GLboolean emit_paired(void *data, struct radeon_pair_instruction *inst) code->inst[ip].inst0 |= (inst->RGB.OutputWriteMask << 15) | (inst->Alpha.OutputWriteMask << 18); if (inst->Alpha.DepthWriteMask) { code->inst[ip].inst4 |= R500_ALPHA_W_OMASK; - c->code->writes_depth = GL_TRUE; + c->code->writes_depth = 1; } code->inst[ip].inst4 |= R500_ALPHA_ADDRD(inst->Alpha.DestIndex); @@ -206,12 +206,12 @@ static GLboolean emit_paired(void *data, struct radeon_pair_instruction *inst) code->inst[ip].inst4 |= translate_arg_alpha(inst, 1) << R500_ALPHA_SEL_B_SHIFT; code->inst[ip].inst5 |= translate_arg_alpha(inst, 2) << R500_ALU_RGBA_ALPHA_SEL_C_SHIFT; - return GL_TRUE; + return 1; } -static GLuint translate_strq_swizzle(GLuint swizzle) +static unsigned int translate_strq_swizzle(unsigned int swizzle) { - GLuint swiz = 0; + unsigned int swiz = 0; int i; for (i = 0; i < 4; i++) swiz |= (GET_SWZ(swizzle, i) & 0x3) << i*2; @@ -221,13 +221,13 @@ static GLuint translate_strq_swizzle(GLuint swizzle) /** * Emit a single TEX instruction */ -static GLboolean emit_tex(void *data, struct radeon_pair_texture_instruction *inst) +static int emit_tex(void *data, struct radeon_pair_texture_instruction *inst) { PROG_CODE; if (code->inst_end >= 511) { error("emit_tex: Too many instructions"); - return GL_FALSE; + return 0; } int ip = ++code->inst_end; @@ -238,7 +238,7 @@ static GLboolean emit_tex(void *data, struct radeon_pair_texture_instruction *in code->inst[ip].inst1 = R500_TEX_ID(inst->TexSrcUnit) | R500_TEX_SEM_ACQUIRE | R500_TEX_IGNORE_UNCOVERED; - if (inst->TexSrcTarget == TEXTURE_RECT_INDEX) + if (inst->TexSrcTarget == RC_TEXTURE_RECT) code->inst[ip].inst1 |= R500_TEX_UNSCALED; switch (inst->Opcode) { @@ -264,7 +264,7 @@ static GLboolean emit_tex(void *data, struct radeon_pair_texture_instruction *in | R500_TEX_DST_R_SWIZ_R | R500_TEX_DST_G_SWIZ_G | R500_TEX_DST_B_SWIZ_B | R500_TEX_DST_A_SWIZ_A; - return GL_TRUE; + return 1; } static const struct radeon_pair_handler pair_handler = { @@ -277,7 +277,7 @@ void r500BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compi { struct r500_fragment_program_code *code = &compiler->code->code.r500; - _mesa_bzero(code, sizeof(*code)); + memset(code, 0, sizeof(*code)); code->max_temp_idx = 1; code->inst_end = -1; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_code.c b/src/mesa/drivers/dri/r300/compiler/radeon_code.c index c7923004df..1a3d8bb641 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_code.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_code.c @@ -25,11 +25,13 @@ * */ -#include "main/mtypes.h" -#include "shader/prog_instruction.h" - #include "radeon_code.h" +#include +#include + +#include "radeon_program.h" + void rc_constants_init(struct rc_constant_list * c) { memset(c, 0, sizeof(*c)); @@ -143,7 +145,7 @@ unsigned rc_constants_add_immediate_scalar(struct rc_constant_list * c, float da if (c->Constants[index].Type == RC_CONSTANT_IMMEDIATE) { for(unsigned comp = 0; comp < c->Constants[index].Size; ++comp) { if (c->Constants[index].u.Immediate[comp] == data) { - *swizzle = MAKE_SWIZZLE4(comp, comp, comp, comp); + *swizzle = RC_MAKE_SWIZZLE(comp, comp, comp, comp); return index; } } @@ -156,7 +158,7 @@ unsigned rc_constants_add_immediate_scalar(struct rc_constant_list * c, float da if (free_index >= 0) { unsigned comp = c->Constants[free_index].Size++; c->Constants[free_index].u.Immediate[comp] = data; - *swizzle = MAKE_SWIZZLE4(comp, comp, comp, comp); + *swizzle = RC_MAKE_SWIZZLE(comp, comp, comp, comp); return free_index; } @@ -164,7 +166,7 @@ unsigned rc_constants_add_immediate_scalar(struct rc_constant_list * c, float da constant.Type = RC_CONSTANT_IMMEDIATE; constant.Size = 1; constant.u.Immediate[0] = data; - *swizzle = SWIZZLE_XXXX; + *swizzle = RC_SWIZZLE_XXXX; return rc_constants_add(c, &constant); } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_code.h b/src/mesa/drivers/dri/r300/compiler/radeon_code.h index 0806fb1b5c..de0c88ed51 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_code.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_code.h @@ -88,6 +88,23 @@ unsigned rc_constants_add_state(struct rc_constant_list * c, unsigned state1, un unsigned rc_constants_add_immediate_vec4(struct rc_constant_list * c, const float * data); unsigned rc_constants_add_immediate_scalar(struct rc_constant_list * c, float data, unsigned * swizzle); +/** + * Compare functions. + * + * \note By design, RC_COMPARE_FUNC_xxx + GL_NEVER gives you + * the correct GL compare function. + */ +typedef enum { + RC_COMPARE_FUNC_NEVER = 0, + RC_COMPARE_FUNC_LESS, + RC_COMPARE_FUNC_EQUAL, + RC_COMPARE_FUNC_LEQUAL, + RC_COMPARE_FUNC_GREATER, + RC_COMPARE_FUNC_NOTEQUAL, + RC_COMPARE_FUNC_GEQUAL, + RC_COMPARE_FUNC_ALWAYS +} rc_compare_func; + /** * Stores state that influences the compilation of a fragment program. */ @@ -105,10 +122,12 @@ struct r300_fragment_program_external_state { /** * If the sampler is used as a shadow sampler, - * this field is (texture_compare_func - GL_NEVER). - * [e.g. if compare function is GL_LEQUAL, this field is 3] + * this field specifies the compare function. + * + * Otherwise, this field is \ref RC_COMPARE_FUNC_NEVER (aka 0). * * Otherwise, this field is 0. + * \sa rc_compare_func */ unsigned texture_compare_func : 3; } unit[16]; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c index da950d5289..babdcffd3a 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c @@ -23,6 +23,8 @@ #include "radeon_compiler.h" #include +#include +#include #include "radeon_program.h" @@ -34,7 +36,7 @@ void rc_init(struct radeon_compiler * c) memory_pool_init(&c->Pool); c->Program.Instructions.Prev = &c->Program.Instructions; c->Program.Instructions.Next = &c->Program.Instructions; - c->Program.Instructions.I.Opcode = OPCODE_END; + c->Program.Instructions.I.Opcode = RC_OPCODE_ILLEGAL_OPCODE; } void rc_destroy(struct radeon_compiler * c) @@ -60,7 +62,7 @@ void rc_error(struct radeon_compiler * c, const char * fmt, ...) { va_list ap; - c->Error = GL_TRUE; + c->Error = 1; if (!c->ErrorMsg) { /* Only remember the first error */ @@ -95,18 +97,18 @@ void rc_error(struct radeon_compiler * c, const char * fmt, ...) * Rewrite the program such that everything that source the given input * register will source new_input instead. */ -void rc_move_input(struct radeon_compiler * c, unsigned input, struct prog_src_register new_input) +void rc_move_input(struct radeon_compiler * c, unsigned input, struct rc_src_register new_input) { struct rc_instruction * inst; c->Program.InputsRead &= ~(1 << input); for(inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next) { - const unsigned numsrcs = _mesa_num_inst_src_regs(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); unsigned i; - for(i = 0; i < numsrcs; ++i) { - if (inst->I.SrcReg[i].File == PROGRAM_INPUT && inst->I.SrcReg[i].Index == input) { + for(i = 0; i < opcode->NumSrcRegs; ++i) { + if (inst->I.SrcReg[i].File == RC_FILE_INPUT && inst->I.SrcReg[i].Index == input) { inst->I.SrcReg[i].File = new_input.File; inst->I.SrcReg[i].Index = new_input.Index; inst->I.SrcReg[i].Swizzle = combine_swizzles(new_input.Swizzle, inst->I.SrcReg[i].Swizzle); @@ -134,10 +136,10 @@ void rc_move_output(struct radeon_compiler * c, unsigned output, unsigned new_ou c->Program.OutputsWritten &= ~(1 << output); for(inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next) { - const unsigned numdsts = _mesa_num_inst_dst_regs(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); - if (numdsts) { - if (inst->I.DstReg.File == PROGRAM_OUTPUT && inst->I.DstReg.Index == output) { + if (opcode->HasDstReg) { + if (inst->I.DstReg.File == RC_FILE_OUTPUT && inst->I.DstReg.Index == output) { inst->I.DstReg.Index = new_output; inst->I.DstReg.WriteMask &= writemask; @@ -157,33 +159,33 @@ void rc_copy_output(struct radeon_compiler * c, unsigned output, unsigned dup_ou struct rc_instruction * inst; for(inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next) { - const unsigned numdsts = _mesa_num_inst_dst_regs(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); - if (numdsts) { - if (inst->I.DstReg.File == PROGRAM_OUTPUT && inst->I.DstReg.Index == output) { - inst->I.DstReg.File = PROGRAM_TEMPORARY; + if (opcode->HasDstReg) { + if (inst->I.DstReg.File == RC_FILE_OUTPUT && inst->I.DstReg.Index == output) { + inst->I.DstReg.File = RC_FILE_TEMPORARY; inst->I.DstReg.Index = tempreg; } } } inst = rc_insert_new_instruction(c, c->Program.Instructions.Prev); - inst->I.Opcode = OPCODE_MOV; - inst->I.DstReg.File = PROGRAM_OUTPUT; + inst->I.Opcode = RC_OPCODE_MOV; + inst->I.DstReg.File = RC_FILE_OUTPUT; inst->I.DstReg.Index = output; - inst->I.SrcReg[0].File = PROGRAM_TEMPORARY; + inst->I.SrcReg[0].File = RC_FILE_TEMPORARY; inst->I.SrcReg[0].Index = tempreg; - inst->I.SrcReg[0].Swizzle = SWIZZLE_XYZW; + inst->I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZW; inst = rc_insert_new_instruction(c, c->Program.Instructions.Prev); - inst->I.Opcode = OPCODE_MOV; - inst->I.DstReg.File = PROGRAM_OUTPUT; + inst->I.Opcode = RC_OPCODE_MOV; + inst->I.DstReg.File = RC_FILE_OUTPUT; inst->I.DstReg.Index = dup_output; - inst->I.SrcReg[0].File = PROGRAM_TEMPORARY; + inst->I.SrcReg[0].File = RC_FILE_TEMPORARY; inst->I.SrcReg[0].Index = tempreg; - inst->I.SrcReg[0].Swizzle = SWIZZLE_XYZW; + inst->I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZW; c->Program.OutputsWritten |= 1 << dup_output; } @@ -201,59 +203,59 @@ void rc_transform_fragment_wpos(struct radeon_compiler * c, unsigned wpos, unsig /* perspective divide */ struct rc_instruction * inst_rcp = rc_insert_new_instruction(c, &c->Program.Instructions); - inst_rcp->I.Opcode = OPCODE_RCP; + inst_rcp->I.Opcode = RC_OPCODE_RCP; - inst_rcp->I.DstReg.File = PROGRAM_TEMPORARY; + inst_rcp->I.DstReg.File = RC_FILE_TEMPORARY; inst_rcp->I.DstReg.Index = tempregi; - inst_rcp->I.DstReg.WriteMask = WRITEMASK_W; + inst_rcp->I.DstReg.WriteMask = RC_MASK_W; - inst_rcp->I.SrcReg[0].File = PROGRAM_INPUT; + inst_rcp->I.SrcReg[0].File = RC_FILE_INPUT; inst_rcp->I.SrcReg[0].Index = new_input; - inst_rcp->I.SrcReg[0].Swizzle = SWIZZLE_WWWW; + inst_rcp->I.SrcReg[0].Swizzle = RC_SWIZZLE_WWWW; struct rc_instruction * inst_mul = rc_insert_new_instruction(c, inst_rcp); - inst_mul->I.Opcode = OPCODE_MUL; + inst_mul->I.Opcode = RC_OPCODE_MUL; - inst_mul->I.DstReg.File = PROGRAM_TEMPORARY; + inst_mul->I.DstReg.File = RC_FILE_TEMPORARY; inst_mul->I.DstReg.Index = tempregi; - inst_mul->I.DstReg.WriteMask = WRITEMASK_XYZ; + inst_mul->I.DstReg.WriteMask = RC_MASK_XYZ; - inst_mul->I.SrcReg[0].File = PROGRAM_INPUT; + inst_mul->I.SrcReg[0].File = RC_FILE_INPUT; inst_mul->I.SrcReg[0].Index = new_input; - inst_mul->I.SrcReg[1].File = PROGRAM_TEMPORARY; + inst_mul->I.SrcReg[1].File = RC_FILE_TEMPORARY; inst_mul->I.SrcReg[1].Index = tempregi; - inst_mul->I.SrcReg[1].Swizzle = SWIZZLE_WWWW; + inst_mul->I.SrcReg[1].Swizzle = RC_SWIZZLE_WWWW; /* viewport transformation */ struct rc_instruction * inst_mad = rc_insert_new_instruction(c, inst_mul); - inst_mad->I.Opcode = OPCODE_MAD; + inst_mad->I.Opcode = RC_OPCODE_MAD; - inst_mad->I.DstReg.File = PROGRAM_TEMPORARY; + inst_mad->I.DstReg.File = RC_FILE_TEMPORARY; inst_mad->I.DstReg.Index = tempregi; - inst_mad->I.DstReg.WriteMask = WRITEMASK_XYZ; + inst_mad->I.DstReg.WriteMask = RC_MASK_XYZ; - inst_mad->I.SrcReg[0].File = PROGRAM_TEMPORARY; + inst_mad->I.SrcReg[0].File = RC_FILE_TEMPORARY; inst_mad->I.SrcReg[0].Index = tempregi; - inst_mad->I.SrcReg[0].Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ZERO); + inst_mad->I.SrcReg[0].Swizzle = RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_ZERO); - inst_mad->I.SrcReg[1].File = PROGRAM_STATE_VAR; + inst_mad->I.SrcReg[1].File = RC_FILE_CONSTANT; inst_mad->I.SrcReg[1].Index = rc_constants_add_state(&c->Program.Constants, RC_STATE_R300_WINDOW_DIMENSION, 0); - inst_mad->I.SrcReg[1].Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ZERO); + inst_mad->I.SrcReg[1].Swizzle = RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_ZERO); - inst_mad->I.SrcReg[2].File = PROGRAM_STATE_VAR; + inst_mad->I.SrcReg[2].File = RC_FILE_CONSTANT; inst_mad->I.SrcReg[2].Index = inst_mad->I.SrcReg[1].Index; - inst_mad->I.SrcReg[2].Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ZERO); + inst_mad->I.SrcReg[2].Swizzle = RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_ZERO); struct rc_instruction * inst; for (inst = inst_mad->Next; inst != &c->Program.Instructions; inst = inst->Next) { - const unsigned numsrcs = _mesa_num_inst_src_regs(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); unsigned i; - for(i = 0; i < numsrcs; i++) { - if (inst->I.SrcReg[i].File == PROGRAM_INPUT && + for(i = 0; i < opcode->NumSrcRegs; i++) { + if (inst->I.SrcReg[i].File == RC_FILE_INPUT && inst->I.SrcReg[i].Index == wpos) { - inst->I.SrcReg[i].File = PROGRAM_TEMPORARY; + inst->I.SrcReg[i].File = RC_FILE_TEMPORARY; inst->I.SrcReg[i].Index = tempregi; } } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h index fbe7c37dd1..018f9bba06 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h @@ -23,36 +23,11 @@ #ifndef RADEON_COMPILER_H #define RADEON_COMPILER_H -#include "main/mtypes.h" -#include "shader/prog_instruction.h" - #include "memory_pool.h" #include "radeon_code.h" +#include "radeon_program.h" -struct rc_instruction { - struct rc_instruction * Prev; - struct rc_instruction * Next; - struct prog_instruction I; -}; - -struct rc_program { - /** - * Instructions.Next points to the first instruction, - * Instructions.Prev points to the last instruction. - */ - struct rc_instruction Instructions; - - /* Long term, we should probably remove InputsRead & OutputsWritten, - * since updating dependent state can be fragile, and they aren't - * actually used very often. */ - uint32_t InputsRead; - uint32_t OutputsWritten; - uint32_t ShadowSamplers; /**< Texture units used for shadow sampling. */ - - struct rc_constant_list Constants; -}; - struct radeon_compiler { struct memory_pool Pool; struct rc_program Program; @@ -69,7 +44,7 @@ void rc_error(struct radeon_compiler * c, const char * fmt, ...); void rc_calculate_inputs_outputs(struct radeon_compiler * c); -void rc_move_input(struct radeon_compiler * c, unsigned input, struct prog_src_register new_input); +void rc_move_input(struct radeon_compiler * c, unsigned input, struct rc_src_register new_input); void rc_move_output(struct radeon_compiler * c, unsigned output, unsigned new_output, unsigned writemask); void rc_copy_output(struct radeon_compiler * c, unsigned output, unsigned dup_output); void rc_transform_fragment_wpos(struct radeon_compiler * c, unsigned wpos, unsigned new_input); @@ -95,7 +70,7 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c); struct r300_vertex_program_compiler { struct radeon_compiler Base; struct r300_vertex_program_code *code; - GLbitfield RequiredOutputs; + uint32_t RequiredOutputs; void * UserData; void (*SetHwInputOutput)(struct r300_vertex_program_compiler * c); diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_nqssadce.c b/src/mesa/drivers/dri/r300/compiler/radeon_nqssadce.c index aaaa50ad1f..3e02ebee81 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_nqssadce.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_nqssadce.c @@ -29,9 +29,6 @@ * @file * * "Not-quite SSA" and Dead-Code Elimination. - * - * @note This code uses SWIZZLE_NIL in a source register to indicate that - * the corresponding component is ignored by the corresponding instruction. */ #include "radeon_nqssadce.h" @@ -43,76 +40,55 @@ * Return the @ref register_state for the given register (or 0 for untracked * registers, i.e. constants). */ -static struct register_state *get_reg_state(struct nqssadce_state* s, GLuint file, GLuint index) +static struct register_state *get_reg_state(struct nqssadce_state* s, rc_register_file file, unsigned int index) { + if (index >= RC_REGISTER_MAX_INDEX) + return 0; + switch(file) { - case PROGRAM_TEMPORARY: return &s->Temps[index]; - case PROGRAM_OUTPUT: return &s->Outputs[index]; - case PROGRAM_ADDRESS: return &s->Address; + case RC_FILE_TEMPORARY: return &s->Temps[index]; + case RC_FILE_OUTPUT: return &s->Outputs[index]; + case RC_FILE_ADDRESS: return &s->Address; default: return 0; } } -/** - * Left multiplication of a register with a swizzle - * - * @note Works correctly only for X, Y, Z, W swizzles, not for constant swizzles. - */ -struct prog_src_register lmul_swizzle(GLuint swizzle, struct prog_src_register srcreg) -{ - struct prog_src_register tmp = srcreg; - int i; - tmp.Swizzle = 0; - tmp.Negate = NEGATE_NONE; - for(i = 0; i < 4; ++i) { - GLuint swz = GET_SWZ(swizzle, i); - if (swz < 4) { - tmp.Swizzle |= GET_SWZ(srcreg.Swizzle, swz) << (i*3); - tmp.Negate |= GET_BIT(srcreg.Negate, swz) << i; - } else { - tmp.Swizzle |= swz << (i*3); - } - } - return tmp; -} - - static void track_used_srcreg(struct nqssadce_state* s, - GLint src, GLuint sourced) + int src, unsigned int sourced) { - struct prog_instruction * inst = &s->IP->I; + struct rc_sub_instruction * inst = &s->IP->I; int i; - GLuint deswz_source = 0; + unsigned int deswz_source = 0; for(i = 0; i < 4; ++i) { if (GET_BIT(sourced, i)) { - GLuint swz = GET_SWZ(inst->SrcReg[src].Swizzle, i); + unsigned int swz = GET_SWZ(inst->SrcReg[src].Swizzle, i); deswz_source |= 1 << swz; } else { inst->SrcReg[src].Swizzle &= ~(7 << (3*i)); - inst->SrcReg[src].Swizzle |= SWIZZLE_NIL << (3*i); + inst->SrcReg[src].Swizzle |= RC_SWIZZLE_UNUSED << (3*i); } } if (!s->Descr->IsNativeSwizzle(inst->Opcode, inst->SrcReg[src])) { - struct prog_dst_register dstreg = inst->DstReg; - dstreg.File = PROGRAM_TEMPORARY; + struct rc_dst_register dstreg = inst->DstReg; + dstreg.File = RC_FILE_TEMPORARY; dstreg.Index = rc_find_free_temporary(s->Compiler); dstreg.WriteMask = sourced; s->Descr->BuildSwizzle(s, dstreg, inst->SrcReg[src]); - inst->SrcReg[src].File = PROGRAM_TEMPORARY; + inst->SrcReg[src].File = RC_FILE_TEMPORARY; inst->SrcReg[src].Index = dstreg.Index; inst->SrcReg[src].Swizzle = 0; - inst->SrcReg[src].Negate = NEGATE_NONE; + inst->SrcReg[src].Negate = RC_MASK_NONE; inst->SrcReg[src].Abs = 0; for(i = 0; i < 4; ++i) { if (GET_BIT(sourced, i)) inst->SrcReg[src].Swizzle |= i << (3*i); else - inst->SrcReg[src].Swizzle |= SWIZZLE_NIL << (3*i); + inst->SrcReg[src].Swizzle |= RC_SWIZZLE_UNUSED << (3*i); } deswz_source = sourced; } @@ -120,9 +96,9 @@ static void track_used_srcreg(struct nqssadce_state* s, struct register_state *regstate; if (inst->SrcReg[src].RelAddr) { - regstate = get_reg_state(s, PROGRAM_ADDRESS, 0); + regstate = get_reg_state(s, RC_FILE_ADDRESS, 0); if (regstate) - regstate->Sourced |= WRITEMASK_X; + regstate->Sourced |= RC_MASK_X; } else { regstate = get_reg_state(s, inst->SrcReg[src].File, inst->SrcReg[src].Index); if (regstate) @@ -130,21 +106,21 @@ static void track_used_srcreg(struct nqssadce_state* s, } } -static void unalias_srcregs(struct rc_instruction *inst, GLuint oldindex, GLuint newindex) +static void unalias_srcregs(struct rc_instruction *inst, unsigned int oldindex, unsigned int newindex) { - int nsrc = _mesa_num_inst_src_regs(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); int i; - for(i = 0; i < nsrc; ++i) - if (inst->I.SrcReg[i].File == PROGRAM_TEMPORARY && inst->I.SrcReg[i].Index == oldindex) + for(i = 0; i < opcode->NumSrcRegs; ++i) + if (inst->I.SrcReg[i].File == RC_FILE_TEMPORARY && inst->I.SrcReg[i].Index == oldindex) inst->I.SrcReg[i].Index = newindex; } -static void unalias_temporary(struct nqssadce_state* s, GLuint oldindex) +static void unalias_temporary(struct nqssadce_state* s, unsigned int oldindex) { - GLuint newindex = rc_find_free_temporary(s->Compiler); + unsigned int newindex = rc_find_free_temporary(s->Compiler); struct rc_instruction * inst; for(inst = s->Compiler->Program.Instructions.Next; inst != s->IP; inst = inst->Next) { - if (inst->I.DstReg.File == PROGRAM_TEMPORARY && inst->I.DstReg.Index == oldindex) + if (inst->I.DstReg.File == RC_FILE_TEMPORARY && inst->I.DstReg.Index == oldindex) inst->I.DstReg.Index = newindex; unalias_srcregs(inst, oldindex, newindex); } @@ -157,13 +133,10 @@ static void unalias_temporary(struct nqssadce_state* s, GLuint oldindex) */ static void process_instruction(struct nqssadce_state* s) { - struct prog_instruction *inst = &s->IP->I; - GLuint WriteMask; - - if (inst->Opcode == OPCODE_END) - return; + struct rc_sub_instruction *inst = &s->IP->I; + unsigned int WriteMask; - if (inst->Opcode != OPCODE_KIL) { + if (inst->Opcode != RC_OPCODE_KIL) { struct register_state *regstate = get_reg_state(s, inst->DstReg.File, inst->DstReg.Index); if (!regstate) { rc_error(s->Compiler, "NqssaDce: bad destination register (%i[%i])\n", @@ -181,67 +154,67 @@ static void process_instruction(struct nqssadce_state* s) return; } - if (inst->DstReg.File == PROGRAM_TEMPORARY && !regstate->Sourced) + if (inst->DstReg.File == RC_FILE_TEMPORARY && !regstate->Sourced) unalias_temporary(s, inst->DstReg.Index); } WriteMask = inst->DstReg.WriteMask; switch (inst->Opcode) { - case OPCODE_ARL: - case OPCODE_DDX: - case OPCODE_DDY: - case OPCODE_FRC: - case OPCODE_MOV: + case RC_OPCODE_ARL: + case RC_OPCODE_DDX: + case RC_OPCODE_DDY: + case RC_OPCODE_FRC: + case RC_OPCODE_MOV: track_used_srcreg(s, 0, WriteMask); break; - case OPCODE_ADD: - case OPCODE_MAX: - case OPCODE_MIN: - case OPCODE_MUL: - case OPCODE_SGE: - case OPCODE_SLT: + case RC_OPCODE_ADD: + case RC_OPCODE_MAX: + case RC_OPCODE_MIN: + case RC_OPCODE_MUL: + case RC_OPCODE_SGE: + case RC_OPCODE_SLT: track_used_srcreg(s, 0, WriteMask); track_used_srcreg(s, 1, WriteMask); break; - case OPCODE_CMP: - case OPCODE_MAD: + case RC_OPCODE_CMP: + case RC_OPCODE_MAD: track_used_srcreg(s, 0, WriteMask); track_used_srcreg(s, 1, WriteMask); track_used_srcreg(s, 2, WriteMask); break; - case OPCODE_COS: - case OPCODE_EX2: - case OPCODE_LG2: - case OPCODE_RCP: - case OPCODE_RSQ: - case OPCODE_SIN: + case RC_OPCODE_COS: + case RC_OPCODE_EX2: + case RC_OPCODE_LG2: + case RC_OPCODE_RCP: + case RC_OPCODE_RSQ: + case RC_OPCODE_SIN: track_used_srcreg(s, 0, 0x1); break; - case OPCODE_DP3: + case RC_OPCODE_DP3: track_used_srcreg(s, 0, 0x7); track_used_srcreg(s, 1, 0x7); break; - case OPCODE_DP4: + case RC_OPCODE_DP4: track_used_srcreg(s, 0, 0xf); track_used_srcreg(s, 1, 0xf); break; - case OPCODE_KIL: - case OPCODE_TEX: - case OPCODE_TXB: - case OPCODE_TXP: + case RC_OPCODE_KIL: + case RC_OPCODE_TEX: + case RC_OPCODE_TXB: + case RC_OPCODE_TXP: track_used_srcreg(s, 0, 0xf); break; - case OPCODE_DST: + case RC_OPCODE_DST: track_used_srcreg(s, 0, 0x6); track_used_srcreg(s, 1, 0xa); break; - case OPCODE_EXP: - case OPCODE_LOG: - case OPCODE_POW: + case RC_OPCODE_EXP: + case RC_OPCODE_LOG: + case RC_OPCODE_POW: track_used_srcreg(s, 0, 0x3); break; - case OPCODE_LIT: + case RC_OPCODE_LIT: track_used_srcreg(s, 0, 0xb); break; default: @@ -261,16 +234,16 @@ void rc_calculate_inputs_outputs(struct radeon_compiler * c) for(inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next) { + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); int i; - int num_src_regs = _mesa_num_inst_src_regs(inst->I.Opcode); - for (i = 0; i < num_src_regs; ++i) { - if (inst->I.SrcReg[i].File == PROGRAM_INPUT) + for (i = 0; i < opcode->NumSrcRegs; ++i) { + if (inst->I.SrcReg[i].File == RC_FILE_INPUT) c->Program.InputsRead |= 1 << inst->I.SrcReg[i].Index; } - if (_mesa_num_inst_dst_regs(inst->I.Opcode)) { - if (inst->I.DstReg.File == PROGRAM_OUTPUT) + if (opcode->HasDstReg) { + if (inst->I.DstReg.File == RC_FILE_OUTPUT) c->Program.OutputsWritten |= 1 << inst->I.DstReg.Index; } } @@ -280,7 +253,7 @@ void radeonNqssaDce(struct radeon_compiler * c, struct radeon_nqssadce_descr* de { struct nqssadce_state s; - _mesa_bzero(&s, sizeof(s)); + memset(&s, 0, sizeof(s)); s.Compiler = c; s.Descr = descr; s.UserData = data; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_nqssadce.h b/src/mesa/drivers/dri/r300/compiler/radeon_nqssadce.h index b3fc77a35a..a2aa1eb8ca 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_nqssadce.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_nqssadce.h @@ -35,7 +35,7 @@ struct register_state { * Bitmask indicating which components of the register are sourced * by later instructions. */ - GLuint Sourced : 4; + unsigned int Sourced : 4; }; /** @@ -54,8 +54,8 @@ struct nqssadce_state { /** * Which registers are read by subsequent instructions? */ - struct register_state Temps[MAX_PROGRAM_TEMPS]; - struct register_state Outputs[VERT_RESULT_MAX]; + struct register_state Temps[RC_REGISTER_MAX_INDEX]; + struct register_state Outputs[RC_REGISTER_MAX_INDEX]; struct register_state Address; void * UserData; @@ -75,17 +75,18 @@ struct radeon_nqssadce_descr { /** * Check whether the given swizzle, absolute and negate combination * can be implemented natively by the hardware for this opcode. + * + * \return 1 if the swizzle is native for the given opcode */ - GLboolean (*IsNativeSwizzle)(GLuint opcode, struct prog_src_register reg); + int (*IsNativeSwizzle)(rc_opcode opcode, struct rc_src_register reg); /** * Emit (at the current IP) the instruction MOV dst, src; * The transformation will work recursively on the emitted instruction(s). */ - void (*BuildSwizzle)(struct nqssadce_state*, struct prog_dst_register dst, struct prog_src_register src); + void (*BuildSwizzle)(struct nqssadce_state*, struct rc_dst_register dst, struct rc_src_register src); }; void radeonNqssaDce(struct radeon_compiler * c, struct radeon_nqssadce_descr* descr, void * data); -struct prog_src_register lmul_swizzle(GLuint swizzle, struct prog_src_register srcreg); #endif /* __RADEON_PROGRAM_NQSSADCE_H_ */ diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c new file mode 100644 index 0000000000..ffe2de1a87 --- /dev/null +++ b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c @@ -0,0 +1,318 @@ +/* + * Copyright (C) 2009 Nicolai Haehnle. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 "radeon_opcodes.h" + +struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE] = { + { + .Opcode = RC_OPCODE_NOP, + .Name = "NOP" + }, + { + .Opcode = RC_OPCODE_ILLEGAL_OPCODE, + .Name = "ILLEGAL OPCODE" + }, + { + .Opcode = RC_OPCODE_ABS, + .Name = "ABS", + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_ADD, + .Name = "ADD", + .NumSrcRegs = 2, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_ARL, + .Name = "ARL", + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_CMP, + .Name = "CMP", + .NumSrcRegs = 3, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_COS, + .Name = "COS", + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_DDX, + .Name = "DDX", + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_DDY, + .Name = "DDY", + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_DP3, + .Name = "DP3", + .NumSrcRegs = 2, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_DP4, + .Name = "DP4", + .NumSrcRegs = 2, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_DPH, + .Name = "DPH", + .NumSrcRegs = 2, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_DST, + .Name = "DST", + .NumSrcRegs = 2, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_EX2, + .Name = "EX2", + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_EXP, + .Name = "EXP", + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_FLR, + .Name = "FLR", + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_FRC, + .Name = "FRC", + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_KIL, + .Name = "KIL", + .NumSrcRegs = 1 + }, + { + .Opcode = RC_OPCODE_LG2, + .Name = "LG2", + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_LIT, + .Name = "LIT", + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_LOG, + .Name = "LOG", + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_LRP, + .Name = "LRP", + .NumSrcRegs = 3, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_MAD, + .Name = "MAD", + .NumSrcRegs = 3, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_MAX, + .Name = "MAX", + .NumSrcRegs = 2, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_MIN, + .Name = "MIN", + .NumSrcRegs = 2, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_MOV, + .Name = "MOV", + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_MUL, + .Name = "MUL", + .NumSrcRegs = 2, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_POW, + .Name = "POW", + .NumSrcRegs = 2, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_RCP, + .Name = "RCP", + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_RSQ, + .Name = "RSQ", + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_SCS, + .Name = "SCS", + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_SEQ, + .Name = "SEQ", + .NumSrcRegs = 2, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_SFL, + .Name = "SFL", + .NumSrcRegs = 0, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_SGE, + .Name = "SGE", + .NumSrcRegs = 2, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_SGT, + .Name = "SGT", + .NumSrcRegs = 2, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_SIN, + .Name = "SIN", + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_SLE, + .Name = "SLE", + .NumSrcRegs = 2, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_SLT, + .Name = "SLT", + .NumSrcRegs = 2, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_SNE, + .Name = "SNE", + .NumSrcRegs = 2, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_SUB, + .Name = "SUB", + .NumSrcRegs = 2, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_SWZ, + .Name = "SWZ", + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_XPD, + .Name = "XPD", + .NumSrcRegs = 2, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_TEX, + .Name = "TEX", + .HasTexture = 1, + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_TXB, + .Name = "TXB", + .HasTexture = 1, + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_TXD, + .Name = "TXD", + .HasTexture = 1, + .NumSrcRegs = 3, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_TXL, + .Name = "TXL", + .HasTexture = 1, + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_TXP, + .Name = "TXP", + .HasTexture = 1, + .NumSrcRegs = 1, + .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_REPL_ALPHA, + .Name = "REPL_ALPHA", + .HasDstReg = 1 + } +}; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h new file mode 100644 index 0000000000..4eb9be3e55 --- /dev/null +++ b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h @@ -0,0 +1,202 @@ +/* + * Copyright (C) 2009 Nicolai Haehnle. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 RADEON_OPCODES_H +#define RADEON_OPCODES_H + +#include + +/** + * Opcodes understood by the Radeon compiler. + */ +typedef enum { + RC_OPCODE_NOP = 0, + RC_OPCODE_ILLEGAL_OPCODE, + + /** vec4 instruction: dst.c = abs(src0.c); */ + RC_OPCODE_ABS, + + /** vec4 instruction: dst.c = src0.c + src1.c; */ + RC_OPCODE_ADD, + + /** special instruction: load address register + * dst.x = floor(src.x), where dst must be an address register */ + RC_OPCODE_ARL, + + /** vec4 instruction: dst.c = src0.c < 0.0 ? src1.c : src2.c */ + RC_OPCODE_CMP, + + /** scalar instruction: dst = cos(src0.x) */ + RC_OPCODE_COS, + + /** special instruction: take vec4 partial derivative in X direction + * dst.c = d src0.c / dx */ + RC_OPCODE_DDX, + + /** special instruction: take vec4 partial derivative in Y direction + * dst.c = d src0.c / dy */ + RC_OPCODE_DDY, + + /** scalar instruction: dst = src0.x*src1.x + src0.y*src1.y + src0.z*src1.z */ + RC_OPCODE_DP3, + + /** scalar instruction: dst = src0.x*src1.x + src0.y*src1.y + src0.z*src1.z + src0.w*src1.w */ + RC_OPCODE_DP4, + + /** scalar instruction: dst = src0.x*src1.x + src0.y*src1.y + src0.z*src1.z + src1.w */ + RC_OPCODE_DPH, + + /** special instruction, see ARB_fragment_program */ + RC_OPCODE_DST, + + /** scalar instruction: dst = 2**src0.x */ + RC_OPCODE_EX2, + + /** special instruction, see ARB_vertex_program */ + RC_OPCODE_EXP, + + /** vec4 instruction: dst.c = floor(src0.c) */ + RC_OPCODE_FLR, + + /** vec4 instruction: dst.c = src0.c - floor(src0.c) */ + RC_OPCODE_FRC, + + /** special instruction: stop execution if any component of src0 is negative */ + RC_OPCODE_KIL, + + /** scalar instruction: dst = log_2(src0.x) */ + RC_OPCODE_LG2, + + /** special instruction, see ARB_vertex_program */ + RC_OPCODE_LIT, + + /** special instruction, see ARB_vertex_program */ + RC_OPCODE_LOG, + + /** vec4 instruction: dst.c = src0.c*src1.c + (1 - src0.c)*src2.c */ + RC_OPCODE_LRP, + + /** vec4 instruction: dst.c = src0.c*src1.c + src2.c */ + RC_OPCODE_MAD, + + /** vec4 instruction: dst.c = max(src0.c, src1.c) */ + RC_OPCODE_MAX, + + /** vec4 instruction: dst.c = min(src0.c, src1.c) */ + RC_OPCODE_MIN, + + /** vec4 instruction: dst.c = src0.c */ + RC_OPCODE_MOV, + + /** vec4 instruction: dst.c = src0.c*src1.c */ + RC_OPCODE_MUL, + + /** scalar instruction: dst = src0.x ** src1.x */ + RC_OPCODE_POW, + + /** scalar instruction: dst = 1 / src0.x */ + RC_OPCODE_RCP, + + /** scalar instruction: dst = 1 / sqrt(src0.x) */ + RC_OPCODE_RSQ, + + /** special instruction, see ARB_fragment_program */ + RC_OPCODE_SCS, + + /** vec4 instruction: dst.c = (src0.c == src1.c) ? 1.0 : 0.0 */ + RC_OPCODE_SEQ, + + /** vec4 instruction: dst.c = 0.0 */ + RC_OPCODE_SFL, + + /** vec4 instruction: dst.c = (src0.c >= src1.c) ? 1.0 : 0.0 */ + RC_OPCODE_SGE, + + /** vec4 instruction: dst.c = (src0.c > src1.c) ? 1.0 : 0.0 */ + RC_OPCODE_SGT, + + /** scalar instruction: dst = sin(src0.x) */ + RC_OPCODE_SIN, + + /** vec4 instruction: dst.c = (src0.c <= src1.c) ? 1.0 : 0.0 */ + RC_OPCODE_SLE, + + /** vec4 instruction: dst.c = (src0.c < src1.c) ? 1.0 : 0.0 */ + RC_OPCODE_SLT, + + /** vec4 instruction: dst.c = (src0.c != src1.c) ? 1.0 : 0.0 */ + RC_OPCODE_SNE, + + /** vec4 instruction: dst.c = src0.c - src1.c */ + RC_OPCODE_SUB, + + /** vec4 instruction: dst.c = src0.c */ + RC_OPCODE_SWZ, + + /** special instruction, see ARB_fragment_program */ + RC_OPCODE_XPD, + + RC_OPCODE_TEX, + RC_OPCODE_TXB, + RC_OPCODE_TXD, + RC_OPCODE_TXL, + RC_OPCODE_TXP, + + /** special instruction, used in R300-R500 fragment program pair instructions + * indicates that the result of the alpha operation shall be replicated + * across all other channels */ + RC_OPCODE_REPL_ALPHA, + + MAX_RC_OPCODE +} rc_opcode; + + +struct rc_opcode_info { + rc_opcode Opcode; + const char * Name; + + /** true if the instruction reads from a texture. + * + * \note This is false for the KIL instruction, even though KIL is + * a texture instruction from a hardware point of view. */ + unsigned int HasTexture:1; + + unsigned int NumSrcRegs:2; + unsigned int HasDstReg:1; +}; + +extern struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE]; + +static inline const struct rc_opcode_info * rc_get_opcode_info(rc_opcode opcode) +{ + assert((unsigned int)opcode < MAX_RC_OPCODE); + assert(rc_opcodes[opcode].Opcode == opcode); + + return &rc_opcodes[opcode]; +} + +#endif /* RADEON_OPCODES_H */ diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.c b/src/mesa/drivers/dri/r300/compiler/radeon_program.c index bf7f9ac92c..0e0c1f68e6 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.c @@ -27,9 +27,9 @@ #include "radeon_program.h" +#include + #include "radeon_compiler.h" -#include "shader/prog_parameter.h" -#include "shader/prog_print.h" /** @@ -69,37 +69,57 @@ void radeonLocalTransform( } } +/** + * Left multiplication of a register with a swizzle + */ +struct rc_src_register lmul_swizzle(unsigned int swizzle, struct rc_src_register srcreg) +{ + struct rc_src_register tmp = srcreg; + int i; + tmp.Swizzle = 0; + tmp.Negate = 0; + for(i = 0; i < 4; ++i) { + rc_swizzle swz = GET_SWZ(swizzle, i); + if (swz < 4) { + tmp.Swizzle |= GET_SWZ(srcreg.Swizzle, swz) << (i*3); + tmp.Negate |= GET_BIT(srcreg.Negate, swz) << i; + } else { + tmp.Swizzle |= swz << (i*3); + } + } + return tmp; +} -GLint rc_find_free_temporary(struct radeon_compiler * c) +unsigned int rc_find_free_temporary(struct radeon_compiler * c) { - GLboolean used[MAX_PROGRAM_TEMPS]; - GLuint i; + char used[RC_REGISTER_MAX_INDEX]; + unsigned int i; memset(used, 0, sizeof(used)); for (struct rc_instruction * rcinst = c->Program.Instructions.Next; rcinst != &c->Program.Instructions; rcinst = rcinst->Next) { - const struct prog_instruction *inst = &rcinst->I; - const GLuint nsrc = _mesa_num_inst_src_regs(inst->Opcode); - const GLuint ndst = _mesa_num_inst_dst_regs(inst->Opcode); - GLuint k; - - for (k = 0; k < nsrc; k++) { - if (inst->SrcReg[k].File == PROGRAM_TEMPORARY) - used[inst->SrcReg[k].Index] = GL_TRUE; + const struct rc_sub_instruction *inst = &rcinst->I; + const struct rc_opcode_info *opcode = rc_get_opcode_info(inst->Opcode); + unsigned int k; + + for (k = 0; k < opcode->NumSrcRegs; k++) { + if (inst->SrcReg[k].File == RC_FILE_TEMPORARY) + used[inst->SrcReg[k].Index] = 1; } - if (ndst) { - if (inst->DstReg.File == PROGRAM_TEMPORARY) - used[inst->DstReg.Index] = GL_TRUE; + if (opcode->HasDstReg) { + if (inst->DstReg.File == RC_FILE_TEMPORARY) + used[inst->DstReg.Index] = 1; } } - for (i = 0; i < MAX_PROGRAM_TEMPS; i++) { + for (i = 0; i < RC_REGISTER_MAX_INDEX; i++) { if (!used[i]) return i; } - return -1; + rc_error(c, "Ran out of temporary registers\n"); + return 0; } @@ -107,10 +127,13 @@ struct rc_instruction *rc_alloc_instruction(struct radeon_compiler * c) { struct rc_instruction * inst = memory_pool_malloc(&c->Pool, sizeof(struct rc_instruction)); - inst->Prev = 0; - inst->Next = 0; + memset(inst, 0, sizeof(struct rc_instruction)); - _mesa_init_instructions(&inst->I, 1); + inst->I.Opcode = RC_OPCODE_ILLEGAL_OPCODE; + inst->I.DstReg.WriteMask = RC_MASK_XYZW; + inst->I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZW; + inst->I.SrcReg[1].Swizzle = RC_SWIZZLE_XYZW; + inst->I.SrcReg[2].Swizzle = RC_SWIZZLE_XYZW; return inst; } @@ -135,14 +158,142 @@ void rc_remove_instruction(struct rc_instruction * inst) inst->Next->Prev = inst->Prev; } +static const char * textarget_to_string(rc_texture_target target) +{ + switch(target) { + case RC_TEXTURE_2D_ARRAY: return "2D_ARRAY"; + case RC_TEXTURE_1D_ARRAY: return "1D_ARRAY"; + case RC_TEXTURE_CUBE: return "CUBE"; + case RC_TEXTURE_3D: return "3D"; + case RC_TEXTURE_RECT: return "RECT"; + case RC_TEXTURE_2D: return "2D"; + case RC_TEXTURE_1D: return "1D"; + default: return "BAD_TEXTURE_TARGET"; + } +} + +static void rc_print_register(FILE * f, rc_register_file file, int index, unsigned int reladdr) +{ + if (file == RC_FILE_NONE) { + fprintf(f, "none"); + } else { + const char * filename; + switch(file) { + case RC_FILE_TEMPORARY: filename = "temp"; break; + case RC_FILE_INPUT: filename = "input"; break; + case RC_FILE_OUTPUT: filename = "output"; break; + case RC_FILE_ADDRESS: filename = "addr"; break; + case RC_FILE_CONSTANT: filename = "const"; break; + default: filename = "BAD FILE"; break; + } + fprintf(f, "%s[%i%s]", filename, index, reladdr ? " + addr[0]" : ""); + } +} + +static void rc_print_mask(FILE * f, unsigned int mask) +{ + if (mask & RC_MASK_X) fprintf(f, "x"); + if (mask & RC_MASK_Y) fprintf(f, "y"); + if (mask & RC_MASK_Z) fprintf(f, "z"); + if (mask & RC_MASK_W) fprintf(f, "w"); +} + +static void rc_print_dst_register(FILE * f, struct rc_dst_register dst) +{ + rc_print_register(f, dst.File, dst.Index, dst.RelAddr); + if (dst.WriteMask != RC_MASK_XYZW) { + fprintf(f, "."); + rc_print_mask(f, dst.WriteMask); + } +} + +static void rc_print_swizzle(FILE * f, unsigned int swizzle, unsigned int negate) +{ + unsigned int comp; + for(comp = 0; comp < 4; ++comp) { + rc_swizzle swz = GET_SWZ(swizzle, comp); + if (GET_BIT(negate, comp)) + fprintf(f, "-"); + switch(swz) { + case RC_SWIZZLE_X: fprintf(f, "x"); break; + case RC_SWIZZLE_Y: fprintf(f, "y"); break; + case RC_SWIZZLE_Z: fprintf(f, "z"); break; + case RC_SWIZZLE_W: fprintf(f, "w"); break; + case RC_SWIZZLE_ZERO: fprintf(f, "0"); break; + case RC_SWIZZLE_ONE: fprintf(f, "1"); break; + case RC_SWIZZLE_HALF: fprintf(f, "H"); break; + case RC_SWIZZLE_UNUSED: fprintf(f, "_"); break; + } + } +} + +static void rc_print_src_register(FILE * f, struct rc_src_register src) +{ + int trivial_negate = (src.Negate == RC_MASK_NONE || src.Negate == RC_MASK_XYZW); + + if (src.Negate == RC_MASK_XYZW) + fprintf(f, "-"); + if (src.Abs) + fprintf(f, "|"); + + rc_print_register(f, src.File, src.Index, src.RelAddr); + + if (src.Abs && !trivial_negate) + fprintf(f, "|"); + + if (src.Swizzle != RC_SWIZZLE_XYZW || !trivial_negate) { + fprintf(f, "."); + rc_print_swizzle(f, src.Swizzle, trivial_negate ? 0 : src.Negate); + } + + if (src.Abs && trivial_negate) + fprintf(f, "|"); +} + +static void rc_print_instruction(FILE * f, struct rc_instruction * inst) +{ + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + unsigned int reg; + + fprintf(f, "%s", opcode->Name); + + switch(inst->I.SaturateMode) { + case RC_SATURATE_NONE: break; + case RC_SATURATE_ZERO_ONE: fprintf(f, "_SAT"); break; + case RC_SATURATE_MINUS_PLUS_ONE: fprintf(f, "_SAT2"); break; + default: fprintf(f, "_BAD_SAT"); break; + } + + if (opcode->HasDstReg) { + fprintf(f, " "); + rc_print_dst_register(f, inst->I.DstReg); + if (opcode->NumSrcRegs) + fprintf(f, ","); + } + + for(reg = 0; reg < opcode->NumSrcRegs; ++reg) { + if (reg > 0) + fprintf(f, ","); + fprintf(f, " "); + rc_print_src_register(f, inst->I.SrcReg[reg]); + } + + if (opcode->HasTexture) { + fprintf(f, ", %s%s[%u]", + textarget_to_string(inst->I.TexSrcTarget), + inst->I.TexShadow ? "SHADOW" : "", + inst->I.TexSrcUnit); + } + + fprintf(f, ";\n"); +} /** * Print program to stderr, default options. */ void rc_print_program(const struct rc_program *prog) { - GLuint indent = 0; - GLuint linenum = 1; + unsigned int linenum = 0; struct rc_instruction *inst; fprintf(stderr, "# Radeon Compiler Program\n"); @@ -150,11 +301,7 @@ void rc_print_program(const struct rc_program *prog) for(inst = prog->Instructions.Next; inst != &prog->Instructions; inst = inst->Next) { fprintf(stderr, "%3d: ", linenum); - /* Massive hack: We rely on the fact that the printers do not actually - * use the gl_program argument (last argument) in debug mode */ - indent = _mesa_fprint_instruction_opt( - stderr, &inst->I, - indent, PROG_PRINT_DEBUG, 0); + rc_print_instruction(stderr, inst); linenum++; } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.h b/src/mesa/drivers/dri/r300/compiler/radeon_program.h index 561958608c..a2ab757fec 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.h @@ -28,37 +28,211 @@ #ifndef __RADEON_PROGRAM_H_ #define __RADEON_PROGRAM_H_ -#include "main/glheader.h" -#include "main/macros.h" -#include "main/enums.h" -#include "shader/program.h" -#include "shader/prog_instruction.h" +#include +#include + +#include "radeon_opcodes.h" +#include "radeon_code.h" struct radeon_compiler; -struct rc_instruction; -struct rc_program; -enum { - PROGRAM_BUILTIN = PROGRAM_FILE_MAX /**< not a real register, but a special swizzle constant */ +typedef enum { + RC_SATURATE_NONE = 0, + RC_SATURATE_ZERO_ONE, + RC_SATURATE_MINUS_PLUS_ONE +} rc_saturate_mode; + +typedef enum { + RC_TEXTURE_2D_ARRAY, + RC_TEXTURE_1D_ARRAY, + RC_TEXTURE_CUBE, + RC_TEXTURE_3D, + RC_TEXTURE_RECT, + RC_TEXTURE_2D, + RC_TEXTURE_1D +} rc_texture_target; + +typedef enum { + /** + * Used to indicate unused register descriptions and + * source register that use a constant swizzle. + */ + RC_FILE_NONE = 0, + RC_FILE_TEMPORARY, + + /** + * Input register. + * + * \note The compiler attaches no implicit semantics to input registers. + * Fragment/vertex program specific semantics must be defined explicitly + * using the appropriate compiler interfaces. + */ + RC_FILE_INPUT, + + /** + * Output register. + * + * \note The compiler attaches no implicit semantics to input registers. + * Fragment/vertex program specific semantics must be defined explicitly + * using the appropriate compiler interfaces. + */ + RC_FILE_OUTPUT, + RC_FILE_ADDRESS, + + /** + * Indicates a constant from the \ref rc_constant_list . + */ + RC_FILE_CONSTANT +} rc_register_file; + +#define RC_REGISTER_INDEX_BITS 10 +#define RC_REGISTER_MAX_INDEX (1 << RC_REGISTER_INDEX_BITS) + +typedef enum { + RC_SWIZZLE_X = 0, + RC_SWIZZLE_Y, + RC_SWIZZLE_Z, + RC_SWIZZLE_W, + RC_SWIZZLE_ZERO, + RC_SWIZZLE_ONE, + RC_SWIZZLE_HALF, + RC_SWIZZLE_UNUSED +} rc_swizzle; + +#define RC_MAKE_SWIZZLE(a,b,c,d) (((a)<<0) | ((b)<<3) | ((c)<<6) | ((d)<<9)) +#define RC_MAKE_SWIZZLE_SMEAR(a) RC_MAKE_SWIZZLE((a),(a),(a),(a)) +#define GET_SWZ(swz, idx) (((swz) >> ((idx)*3)) & 0x7) +#define GET_BIT(msk, idx) (((msk) >> (idx)) & 0x1) + +#define RC_SWIZZLE_XYZW RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_W) +#define RC_SWIZZLE_XXXX RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_X) +#define RC_SWIZZLE_YYYY RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_Y) +#define RC_SWIZZLE_ZZZZ RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_Z) +#define RC_SWIZZLE_WWWW RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_W) +#define RC_SWIZZLE_0000 RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_ZERO) +#define RC_SWIZZLE_1111 RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_ONE) + +/** + * \name Bitmasks for components of vectors. + * + * Used for write masks, negation masks, etc. + */ +/*@{*/ +#define RC_MASK_NONE 0 +#define RC_MASK_X 1 +#define RC_MASK_Y 2 +#define RC_MASK_Z 4 +#define RC_MASK_W 8 +#define RC_MASK_XY (RC_MASK_X|RC_MASK_Y) +#define RC_MASK_XYZ (RC_MASK_X|RC_MASK_Y|RC_MASK_Z) +#define RC_MASK_XYW (RC_MASK_X|RC_MASK_Y|RC_MASK_W) +#define RC_MASK_XYZW (RC_MASK_X|RC_MASK_Y|RC_MASK_Z|RC_MASK_W) +/*@}*/ + +struct rc_src_register { + rc_register_file File:3; + + /** Negative values may be used for relative addressing. */ + signed int Index:(RC_REGISTER_INDEX_BITS+1); + unsigned int RelAddr:1; + + unsigned int Swizzle:12; + + /** Take the component-wise absolute value */ + unsigned int Abs:1; + + /** Post-Abs negation. */ + unsigned int Negate:4; +}; + +struct rc_dst_register { + rc_register_file File:3; + + /** Negative values may be used for relative addressing. */ + signed int Index:(RC_REGISTER_INDEX_BITS+1); + unsigned int RelAddr:1; + + unsigned int WriteMask:4; +}; + +/** + * Instructions are maintained by the compiler in a doubly linked list + * of these structures. + * + * This instruction format is intended to be expanded for hardware-specific + * trickery. At different stages of compilation, a different set of + * instruction types may be valid. + */ +struct rc_sub_instruction { + struct rc_src_register SrcReg[3]; + struct rc_dst_register DstReg; + + /** + * Opcode of this instruction, according to \ref rc_opcode enums. + */ + rc_opcode Opcode:8; + + /** + * Saturate each value of the result to the range [0,1] or [-1,1], + * according to \ref rc_saturate_mode enums. + */ + rc_saturate_mode SaturateMode:2; + + /** + * \name Extra fields for TEX, TXB, TXD, TXL, TXP instructions. + */ + /*@{*/ + /** Source texture unit. */ + unsigned int TexSrcUnit:5; + + /** Source texture target, one of the \ref rc_texture_target enums */ + rc_texture_target TexSrcTarget:3; + + /** True if tex instruction should do shadow comparison */ + unsigned int TexShadow:1; + /*@}*/ +}; + +struct rc_instruction { + struct rc_instruction * Prev; + struct rc_instruction * Next; + + struct rc_sub_instruction I; +}; + +struct rc_program { + /** + * Instructions.Next points to the first instruction, + * Instructions.Prev points to the last instruction. + */ + struct rc_instruction Instructions; + + /* Long term, we should probably remove InputsRead & OutputsWritten, + * since updating dependent state can be fragile, and they aren't + * actually used very often. */ + uint32_t InputsRead; + uint32_t OutputsWritten; + uint32_t ShadowSamplers; /**< Texture units used for shadow sampling. */ + + struct rc_constant_list Constants; }; enum { - OPCODE_REPL_ALPHA = MAX_OPCODE /**< used in paired instructions */ + OPCODE_REPL_ALPHA = MAX_RC_OPCODE /**< used in paired instructions */ }; -#define SWIZZLE_0000 MAKE_SWIZZLE4(SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ZERO) -#define SWIZZLE_1111 MAKE_SWIZZLE4(SWIZZLE_ONE, SWIZZLE_ONE, SWIZZLE_ONE, SWIZZLE_ONE) -static inline GLuint get_swz(GLuint swz, GLuint idx) +static inline rc_swizzle get_swz(unsigned int swz, rc_swizzle idx) { if (idx & 0x4) return idx; return GET_SWZ(swz, idx); } -static inline GLuint combine_swizzles4(GLuint src, GLuint swz_x, GLuint swz_y, GLuint swz_z, GLuint swz_w) +static inline unsigned int combine_swizzles4(unsigned int src, + rc_swizzle swz_x, rc_swizzle swz_y, rc_swizzle swz_z, rc_swizzle swz_w) { - GLuint ret = 0; + unsigned int ret = 0; ret |= get_swz(src, swz_x); ret |= get_swz(src, swz_y) << 3; @@ -68,22 +242,24 @@ static inline GLuint combine_swizzles4(GLuint src, GLuint swz_x, GLuint swz_y, G return ret; } -static inline GLuint combine_swizzles(GLuint src, GLuint swz) +static inline unsigned int combine_swizzles(unsigned int src, unsigned int swz) { - GLuint ret = 0; + unsigned int ret = 0; - ret |= get_swz(src, GET_SWZ(swz, SWIZZLE_X)); - ret |= get_swz(src, GET_SWZ(swz, SWIZZLE_Y)) << 3; - ret |= get_swz(src, GET_SWZ(swz, SWIZZLE_Z)) << 6; - ret |= get_swz(src, GET_SWZ(swz, SWIZZLE_W)) << 9; + ret |= get_swz(src, GET_SWZ(swz, RC_SWIZZLE_X)); + ret |= get_swz(src, GET_SWZ(swz, RC_SWIZZLE_Y)) << 3; + ret |= get_swz(src, GET_SWZ(swz, RC_SWIZZLE_Z)) << 6; + ret |= get_swz(src, GET_SWZ(swz, RC_SWIZZLE_W)) << 9; return ret; } -static INLINE void reset_srcreg(struct prog_src_register* reg) +struct rc_src_register lmul_swizzle(unsigned int swizzle, struct rc_src_register srcreg); + +static inline void reset_srcreg(struct rc_src_register* reg) { - _mesa_bzero(reg, sizeof(*reg)); - reg->Swizzle = SWIZZLE_NOOP; + memset(reg, 0, sizeof(reg)); + reg->Swizzle = RC_SWIZZLE_XYZW; } @@ -92,13 +268,13 @@ static INLINE void reset_srcreg(struct prog_src_register* reg) * * The function will be called once for each instruction. * It has to either emit the appropriate transformed code for the instruction - * and return GL_TRUE, or return GL_FALSE if it doesn't understand the + * and return true, or return false if it doesn't understand the * instruction. * * The function gets passed the userData as last parameter. */ struct radeon_program_transformation { - GLboolean (*function)( + int (*function)( struct radeon_compiler*, struct rc_instruction*, void*); @@ -110,7 +286,7 @@ void radeonLocalTransform( int num_transformations, struct radeon_program_transformation* transformations); -GLint rc_find_free_temporary(struct radeon_compiler * c); +unsigned int rc_find_free_temporary(struct radeon_compiler * c); struct rc_instruction *rc_alloc_instruction(struct radeon_compiler * c); struct rc_instruction *rc_insert_new_instruction(struct radeon_compiler * c, struct rc_instruction * after); diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c index 8071899eaa..041e3cab82 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c @@ -40,8 +40,8 @@ static struct rc_instruction *emit1( struct radeon_compiler * c, struct rc_instruction * after, - gl_inst_opcode Opcode, GLuint Saturate, struct prog_dst_register DstReg, - struct prog_src_register SrcReg) + rc_opcode Opcode, rc_saturate_mode Saturate, struct rc_dst_register DstReg, + struct rc_src_register SrcReg) { struct rc_instruction *fpi = rc_insert_new_instruction(c, after); @@ -54,8 +54,8 @@ static struct rc_instruction *emit1( static struct rc_instruction *emit2( struct radeon_compiler * c, struct rc_instruction * after, - gl_inst_opcode Opcode, GLuint Saturate, struct prog_dst_register DstReg, - struct prog_src_register SrcReg0, struct prog_src_register SrcReg1) + rc_opcode Opcode, rc_saturate_mode Saturate, struct rc_dst_register DstReg, + struct rc_src_register SrcReg0, struct rc_src_register SrcReg1) { struct rc_instruction *fpi = rc_insert_new_instruction(c, after); @@ -69,9 +69,9 @@ static struct rc_instruction *emit2( static struct rc_instruction *emit3( struct radeon_compiler * c, struct rc_instruction * after, - gl_inst_opcode Opcode, GLuint Saturate, struct prog_dst_register DstReg, - struct prog_src_register SrcReg0, struct prog_src_register SrcReg1, - struct prog_src_register SrcReg2) + rc_opcode Opcode, rc_saturate_mode Saturate, struct rc_dst_register DstReg, + struct rc_src_register SrcReg0, struct rc_src_register SrcReg1, + struct rc_src_register SrcReg2) { struct rc_instruction *fpi = rc_insert_new_instruction(c, after); @@ -84,131 +84,120 @@ static struct rc_instruction *emit3( return fpi; } -static struct prog_dst_register dstreg(int file, int index) +static struct rc_dst_register dstreg(int file, int index) { - struct prog_dst_register dst; + struct rc_dst_register dst; dst.File = file; dst.Index = index; - dst.WriteMask = WRITEMASK_XYZW; - dst.CondMask = COND_TR; + dst.WriteMask = RC_MASK_XYZW; dst.RelAddr = 0; - dst.CondSwizzle = SWIZZLE_NOOP; - dst.CondSrc = 0; - dst.pad = 0; return dst; } -static struct prog_dst_register dstregtmpmask(int index, int mask) +static struct rc_dst_register dstregtmpmask(int index, int mask) { - struct prog_dst_register dst = {0}; - dst.File = PROGRAM_TEMPORARY; + struct rc_dst_register dst = {0}; + dst.File = RC_FILE_TEMPORARY; dst.Index = index; dst.WriteMask = mask; dst.RelAddr = 0; - dst.CondMask = COND_TR; - dst.CondSwizzle = SWIZZLE_NOOP; - dst.CondSrc = 0; - dst.pad = 0; return dst; } -static const struct prog_src_register builtin_zero = { - .File = PROGRAM_BUILTIN, +static const struct rc_src_register builtin_zero = { + .File = RC_FILE_NONE, .Index = 0, - .Swizzle = SWIZZLE_0000 + .Swizzle = RC_SWIZZLE_0000 }; -static const struct prog_src_register builtin_one = { - .File = PROGRAM_BUILTIN, +static const struct rc_src_register builtin_one = { + .File = RC_FILE_NONE, .Index = 0, - .Swizzle = SWIZZLE_1111 + .Swizzle = RC_SWIZZLE_1111 }; -static const struct prog_src_register srcreg_undefined = { - .File = PROGRAM_UNDEFINED, +static const struct rc_src_register srcreg_undefined = { + .File = RC_FILE_NONE, .Index = 0, - .Swizzle = SWIZZLE_NOOP + .Swizzle = RC_SWIZZLE_XYZW }; -static struct prog_src_register srcreg(int file, int index) +static struct rc_src_register srcreg(int file, int index) { - struct prog_src_register src = srcreg_undefined; + struct rc_src_register src = srcreg_undefined; src.File = file; src.Index = index; return src; } -static struct prog_src_register srcregswz(int file, int index, int swz) +static struct rc_src_register srcregswz(int file, int index, int swz) { - struct prog_src_register src = srcreg_undefined; + struct rc_src_register src = srcreg_undefined; src.File = file; src.Index = index; src.Swizzle = swz; return src; } -static struct prog_src_register absolute(struct prog_src_register reg) +static struct rc_src_register absolute(struct rc_src_register reg) { - struct prog_src_register newreg = reg; + struct rc_src_register newreg = reg; newreg.Abs = 1; - newreg.Negate = NEGATE_NONE; + newreg.Negate = RC_MASK_NONE; return newreg; } -static struct prog_src_register negate(struct prog_src_register reg) +static struct rc_src_register negate(struct rc_src_register reg) { - struct prog_src_register newreg = reg; - newreg.Negate = newreg.Negate ^ NEGATE_XYZW; + struct rc_src_register newreg = reg; + newreg.Negate = newreg.Negate ^ RC_MASK_XYZW; return newreg; } -static struct prog_src_register swizzle(struct prog_src_register reg, GLuint x, GLuint y, GLuint z, GLuint w) +static struct rc_src_register swizzle(struct rc_src_register reg, + rc_swizzle x, rc_swizzle y, rc_swizzle z, rc_swizzle w) { - struct prog_src_register swizzled = reg; - swizzled.Swizzle = MAKE_SWIZZLE4( - x >= 4 ? x : GET_SWZ(reg.Swizzle, x), - y >= 4 ? y : GET_SWZ(reg.Swizzle, y), - z >= 4 ? z : GET_SWZ(reg.Swizzle, z), - w >= 4 ? w : GET_SWZ(reg.Swizzle, w)); + struct rc_src_register swizzled = reg; + swizzled.Swizzle = combine_swizzles4(reg.Swizzle, x, y, z, w); return swizzled; } -static struct prog_src_register scalar(struct prog_src_register reg) +static struct rc_src_register scalar(struct rc_src_register reg) { - return swizzle(reg, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X); + return swizzle(reg, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X); } static void transform_ABS(struct radeon_compiler* c, struct rc_instruction* inst) { - struct prog_src_register src = inst->I.SrcReg[0]; + struct rc_src_register src = inst->I.SrcReg[0]; src.Abs = 1; - src.Negate = NEGATE_NONE; - emit1(c, inst->Prev, OPCODE_MOV, inst->I.SaturateMode, inst->I.DstReg, src); + src.Negate = RC_MASK_NONE; + emit1(c, inst->Prev, RC_OPCODE_MOV, inst->I.SaturateMode, inst->I.DstReg, src); rc_remove_instruction(inst); } static void transform_DP3(struct radeon_compiler* c, struct rc_instruction* inst) { - struct prog_src_register src0 = inst->I.SrcReg[0]; - struct prog_src_register src1 = inst->I.SrcReg[1]; - src0.Negate &= ~NEGATE_W; + struct rc_src_register src0 = inst->I.SrcReg[0]; + struct rc_src_register src1 = inst->I.SrcReg[1]; + src0.Negate &= ~RC_MASK_W; src0.Swizzle &= ~(7 << (3 * 3)); - src0.Swizzle |= SWIZZLE_ZERO << (3 * 3); - src1.Negate &= ~NEGATE_W; + src0.Swizzle |= RC_SWIZZLE_ZERO << (3 * 3); + src1.Negate &= ~RC_MASK_W; src1.Swizzle &= ~(7 << (3 * 3)); - src1.Swizzle |= SWIZZLE_ZERO << (3 * 3); - emit2(c, inst->Prev, OPCODE_DP4, inst->I.SaturateMode, inst->I.DstReg, src0, src1); + src1.Swizzle |= RC_SWIZZLE_ZERO << (3 * 3); + emit2(c, inst->Prev, RC_OPCODE_DP4, inst->I.SaturateMode, inst->I.DstReg, src0, src1); rc_remove_instruction(inst); } static void transform_DPH(struct radeon_compiler* c, struct rc_instruction* inst) { - struct prog_src_register src0 = inst->I.SrcReg[0]; - src0.Negate &= ~NEGATE_W; + struct rc_src_register src0 = inst->I.SrcReg[0]; + src0.Negate &= ~RC_MASK_W; src0.Swizzle &= ~(7 << (3 * 3)); - src0.Swizzle |= SWIZZLE_ONE << (3 * 3); - emit2(c, inst->Prev, OPCODE_DP4, inst->I.SaturateMode, inst->I.DstReg, src0, inst->I.SrcReg[1]); + src0.Swizzle |= RC_SWIZZLE_ONE << (3 * 3); + emit2(c, inst->Prev, RC_OPCODE_DP4, inst->I.SaturateMode, inst->I.DstReg, src0, inst->I.SrcReg[1]); rc_remove_instruction(inst); } @@ -219,9 +208,9 @@ static void transform_DPH(struct radeon_compiler* c, static void transform_DST(struct radeon_compiler* c, struct rc_instruction* inst) { - emit2(c, inst->Prev, OPCODE_MUL, inst->I.SaturateMode, inst->I.DstReg, - swizzle(inst->I.SrcReg[0], SWIZZLE_ONE, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ONE), - swizzle(inst->I.SrcReg[1], SWIZZLE_ONE, SWIZZLE_Y, SWIZZLE_ONE, SWIZZLE_W)); + emit2(c, inst->Prev, RC_OPCODE_MUL, inst->I.SaturateMode, inst->I.DstReg, + swizzle(inst->I.SrcReg[0], RC_SWIZZLE_ONE, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_ONE), + swizzle(inst->I.SrcReg[1], RC_SWIZZLE_ONE, RC_SWIZZLE_Y, RC_SWIZZLE_ONE, RC_SWIZZLE_W)); rc_remove_instruction(inst); } @@ -229,9 +218,9 @@ static void transform_FLR(struct radeon_compiler* c, struct rc_instruction* inst) { int tempreg = rc_find_free_temporary(c); - emit1(c, inst->Prev, OPCODE_FRC, 0, dstreg(PROGRAM_TEMPORARY, tempreg), inst->I.SrcReg[0]); - emit2(c, inst->Prev, OPCODE_ADD, inst->I.SaturateMode, inst->I.DstReg, - inst->I.SrcReg[0], negate(srcreg(PROGRAM_TEMPORARY, tempreg))); + emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstreg(RC_FILE_TEMPORARY, tempreg), inst->I.SrcReg[0]); + emit2(c, inst->Prev, RC_OPCODE_ADD, inst->I.SaturateMode, inst->I.DstReg, + inst->I.SrcReg[0], negate(srcreg(RC_FILE_TEMPORARY, tempreg))); rc_remove_instruction(inst); } @@ -256,64 +245,64 @@ static void transform_FLR(struct radeon_compiler* c, static void transform_LIT(struct radeon_compiler* c, struct rc_instruction* inst) { - GLuint constant; - GLuint constant_swizzle; - GLuint temp; - struct prog_src_register srctemp; + unsigned int constant; + unsigned int constant_swizzle; + unsigned int temp; + struct rc_src_register srctemp; constant = rc_constants_add_immediate_scalar(&c->Program.Constants, -127.999999, &constant_swizzle); - if (inst->I.DstReg.WriteMask != WRITEMASK_XYZW || inst->I.DstReg.File != PROGRAM_TEMPORARY) { + if (inst->I.DstReg.WriteMask != RC_MASK_XYZW || inst->I.DstReg.File != RC_FILE_TEMPORARY) { struct rc_instruction * inst_mov; inst_mov = emit1(c, inst, - OPCODE_MOV, 0, inst->I.DstReg, - srcreg(PROGRAM_TEMPORARY, rc_find_free_temporary(c))); + RC_OPCODE_MOV, 0, inst->I.DstReg, + srcreg(RC_FILE_TEMPORARY, rc_find_free_temporary(c))); - inst->I.DstReg.File = PROGRAM_TEMPORARY; + inst->I.DstReg.File = RC_FILE_TEMPORARY; inst->I.DstReg.Index = inst_mov->I.SrcReg[0].Index; - inst->I.DstReg.WriteMask = WRITEMASK_XYZW; + inst->I.DstReg.WriteMask = RC_MASK_XYZW; } temp = inst->I.DstReg.Index; - srctemp = srcreg(PROGRAM_TEMPORARY, temp); + srctemp = srcreg(RC_FILE_TEMPORARY, temp); // tmp.x = max(0.0, Src.x); // tmp.y = max(0.0, Src.y); // tmp.w = clamp(Src.z, -128+eps, 128-eps); - emit2(c, inst->Prev, OPCODE_MAX, 0, - dstregtmpmask(temp, WRITEMASK_XYW), + emit2(c, inst->Prev, RC_OPCODE_MAX, 0, + dstregtmpmask(temp, RC_MASK_XYW), inst->I.SrcReg[0], - swizzle(srcreg(PROGRAM_CONSTANT, constant), - SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ZERO, constant_swizzle&3)); - emit2(c, inst->Prev, OPCODE_MIN, 0, - dstregtmpmask(temp, WRITEMASK_Z), - swizzle(srctemp, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W), - negate(srcregswz(PROGRAM_CONSTANT, constant, constant_swizzle))); + swizzle(srcreg(RC_FILE_CONSTANT, constant), + RC_SWIZZLE_ZERO, RC_SWIZZLE_ZERO, RC_SWIZZLE_ZERO, constant_swizzle&3)); + emit2(c, inst->Prev, RC_OPCODE_MIN, 0, + dstregtmpmask(temp, RC_MASK_Z), + swizzle(srctemp, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W), + negate(srcregswz(RC_FILE_CONSTANT, constant, constant_swizzle))); // tmp.w = Pow(tmp.y, tmp.w) - emit1(c, inst->Prev, OPCODE_LG2, 0, - dstregtmpmask(temp, WRITEMASK_W), - swizzle(srctemp, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y)); - emit2(c, inst->Prev, OPCODE_MUL, 0, - dstregtmpmask(temp, WRITEMASK_W), - swizzle(srctemp, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W), - swizzle(srctemp, SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z)); - emit1(c, inst->Prev, OPCODE_EX2, 0, - dstregtmpmask(temp, WRITEMASK_W), - swizzle(srctemp, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W)); + emit1(c, inst->Prev, RC_OPCODE_LG2, 0, + dstregtmpmask(temp, RC_MASK_W), + swizzle(srctemp, RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y)); + emit2(c, inst->Prev, RC_OPCODE_MUL, 0, + dstregtmpmask(temp, RC_MASK_W), + swizzle(srctemp, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W), + swizzle(srctemp, RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z)); + emit1(c, inst->Prev, RC_OPCODE_EX2, 0, + dstregtmpmask(temp, RC_MASK_W), + swizzle(srctemp, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W)); // tmp.z = (tmp.x > 0) ? tmp.w : 0.0 - emit3(c, inst->Prev, OPCODE_CMP, inst->I.SaturateMode, - dstregtmpmask(temp, WRITEMASK_Z), - negate(swizzle(srctemp, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X)), - swizzle(srctemp, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W), + emit3(c, inst->Prev, RC_OPCODE_CMP, inst->I.SaturateMode, + dstregtmpmask(temp, RC_MASK_Z), + negate(swizzle(srctemp, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X)), + swizzle(srctemp, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W), builtin_zero); // tmp.x, tmp.y, tmp.w = 1.0, tmp.x, 1.0 - emit1(c, inst->Prev, OPCODE_MOV, inst->I.SaturateMode, - dstregtmpmask(temp, WRITEMASK_XYW), - swizzle(srctemp, SWIZZLE_ONE, SWIZZLE_X, SWIZZLE_ONE, SWIZZLE_ONE)); + emit1(c, inst->Prev, RC_OPCODE_MOV, inst->I.SaturateMode, + dstregtmpmask(temp, RC_MASK_XYW), + swizzle(srctemp, RC_SWIZZLE_ONE, RC_SWIZZLE_X, RC_SWIZZLE_ONE, RC_SWIZZLE_ONE)); rc_remove_instruction(inst); } @@ -323,12 +312,12 @@ static void transform_LRP(struct radeon_compiler* c, { int tempreg = rc_find_free_temporary(c); - emit2(c, inst->Prev, OPCODE_ADD, 0, - dstreg(PROGRAM_TEMPORARY, tempreg), + emit2(c, inst->Prev, RC_OPCODE_ADD, 0, + dstreg(RC_FILE_TEMPORARY, tempreg), inst->I.SrcReg[1], negate(inst->I.SrcReg[2])); - emit3(c, inst->Prev, OPCODE_MAD, inst->I.SaturateMode, + emit3(c, inst->Prev, RC_OPCODE_MAD, inst->I.SaturateMode, inst->I.DstReg, - inst->I.SrcReg[0], srcreg(PROGRAM_TEMPORARY, tempreg), inst->I.SrcReg[2]); + inst->I.SrcReg[0], srcreg(RC_FILE_TEMPORARY, tempreg), inst->I.SrcReg[2]); rc_remove_instruction(inst); } @@ -337,14 +326,14 @@ static void transform_POW(struct radeon_compiler* c, struct rc_instruction* inst) { int tempreg = rc_find_free_temporary(c); - struct prog_dst_register tempdst = dstreg(PROGRAM_TEMPORARY, tempreg); - struct prog_src_register tempsrc = srcreg(PROGRAM_TEMPORARY, tempreg); - tempdst.WriteMask = WRITEMASK_W; - tempsrc.Swizzle = SWIZZLE_WWWW; + struct rc_dst_register tempdst = dstreg(RC_FILE_TEMPORARY, tempreg); + struct rc_src_register tempsrc = srcreg(RC_FILE_TEMPORARY, tempreg); + tempdst.WriteMask = RC_MASK_W; + tempsrc.Swizzle = RC_SWIZZLE_WWWW; - emit1(c, inst->Prev, OPCODE_LG2, 0, tempdst, scalar(inst->I.SrcReg[0])); - emit2(c, inst->Prev, OPCODE_MUL, 0, tempdst, tempsrc, scalar(inst->I.SrcReg[1])); - emit1(c, inst->Prev, OPCODE_EX2, inst->I.SaturateMode, inst->I.DstReg, tempsrc); + emit1(c, inst->Prev, RC_OPCODE_LG2, 0, tempdst, scalar(inst->I.SrcReg[0])); + emit2(c, inst->Prev, RC_OPCODE_MUL, 0, tempdst, tempsrc, scalar(inst->I.SrcReg[1])); + emit1(c, inst->Prev, RC_OPCODE_EX2, inst->I.SaturateMode, inst->I.DstReg, tempsrc); rc_remove_instruction(inst); } @@ -360,9 +349,9 @@ static void transform_SGE(struct radeon_compiler* c, { int tempreg = rc_find_free_temporary(c); - emit2(c, inst->Prev, OPCODE_ADD, 0, dstreg(PROGRAM_TEMPORARY, tempreg), inst->I.SrcReg[0], negate(inst->I.SrcReg[1])); - emit3(c, inst->Prev, OPCODE_CMP, inst->I.SaturateMode, inst->I.DstReg, - srcreg(PROGRAM_TEMPORARY, tempreg), builtin_zero, builtin_one); + emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), inst->I.SrcReg[0], negate(inst->I.SrcReg[1])); + emit3(c, inst->Prev, RC_OPCODE_CMP, inst->I.SaturateMode, inst->I.DstReg, + srcreg(RC_FILE_TEMPORARY, tempreg), builtin_zero, builtin_one); rc_remove_instruction(inst); } @@ -372,9 +361,9 @@ static void transform_SLT(struct radeon_compiler* c, { int tempreg = rc_find_free_temporary(c); - emit2(c, inst->Prev, OPCODE_ADD, 0, dstreg(PROGRAM_TEMPORARY, tempreg), inst->I.SrcReg[0], negate(inst->I.SrcReg[1])); - emit3(c, inst->Prev, OPCODE_CMP, inst->I.SaturateMode, inst->I.DstReg, - srcreg(PROGRAM_TEMPORARY, tempreg), builtin_one, builtin_zero); + emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), inst->I.SrcReg[0], negate(inst->I.SrcReg[1])); + emit3(c, inst->Prev, RC_OPCODE_CMP, inst->I.SaturateMode, inst->I.DstReg, + srcreg(RC_FILE_TEMPORARY, tempreg), builtin_one, builtin_zero); rc_remove_instruction(inst); } @@ -382,14 +371,14 @@ static void transform_SLT(struct radeon_compiler* c, static void transform_SUB(struct radeon_compiler* c, struct rc_instruction* inst) { - inst->I.Opcode = OPCODE_ADD; + inst->I.Opcode = RC_OPCODE_ADD; inst->I.SrcReg[1] = negate(inst->I.SrcReg[1]); } static void transform_SWZ(struct radeon_compiler* c, struct rc_instruction* inst) { - inst->I.Opcode = OPCODE_MOV; + inst->I.Opcode = RC_OPCODE_MOV; } static void transform_XPD(struct radeon_compiler* c, @@ -397,13 +386,13 @@ static void transform_XPD(struct radeon_compiler* c, { int tempreg = rc_find_free_temporary(c); - emit2(c, inst->Prev, OPCODE_MUL, 0, dstreg(PROGRAM_TEMPORARY, tempreg), - swizzle(inst->I.SrcReg[0], SWIZZLE_Z, SWIZZLE_X, SWIZZLE_Y, SWIZZLE_W), - swizzle(inst->I.SrcReg[1], SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_X, SWIZZLE_W)); - emit3(c, inst->Prev, OPCODE_MAD, inst->I.SaturateMode, inst->I.DstReg, - swizzle(inst->I.SrcReg[0], SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_X, SWIZZLE_W), - swizzle(inst->I.SrcReg[1], SWIZZLE_Z, SWIZZLE_X, SWIZZLE_Y, SWIZZLE_W), - negate(srcreg(PROGRAM_TEMPORARY, tempreg))); + emit2(c, inst->Prev, RC_OPCODE_MUL, 0, dstreg(RC_FILE_TEMPORARY, tempreg), + swizzle(inst->I.SrcReg[0], RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_W), + swizzle(inst->I.SrcReg[1], RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_W)); + emit3(c, inst->Prev, RC_OPCODE_MAD, inst->I.SaturateMode, inst->I.DstReg, + swizzle(inst->I.SrcReg[0], RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_W), + swizzle(inst->I.SrcReg[1], RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_W), + negate(srcreg(RC_FILE_TEMPORARY, tempreg))); rc_remove_instruction(inst); } @@ -423,27 +412,27 @@ static void transform_XPD(struct radeon_compiler* c, * * @note should be applicable to R300 and R500 fragment programs. */ -GLboolean radeonTransformALU( +int radeonTransformALU( struct radeon_compiler * c, struct rc_instruction* inst, void* unused) { switch(inst->I.Opcode) { - case OPCODE_ABS: transform_ABS(c, inst); return GL_TRUE; - case OPCODE_DPH: transform_DPH(c, inst); return GL_TRUE; - case OPCODE_DST: transform_DST(c, inst); return GL_TRUE; - case OPCODE_FLR: transform_FLR(c, inst); return GL_TRUE; - case OPCODE_LIT: transform_LIT(c, inst); return GL_TRUE; - case OPCODE_LRP: transform_LRP(c, inst); return GL_TRUE; - case OPCODE_POW: transform_POW(c, inst); return GL_TRUE; - case OPCODE_RSQ: transform_RSQ(c, inst); return GL_TRUE; - case OPCODE_SGE: transform_SGE(c, inst); return GL_TRUE; - case OPCODE_SLT: transform_SLT(c, inst); return GL_TRUE; - case OPCODE_SUB: transform_SUB(c, inst); return GL_TRUE; - case OPCODE_SWZ: transform_SWZ(c, inst); return GL_TRUE; - case OPCODE_XPD: transform_XPD(c, inst); return GL_TRUE; + case RC_OPCODE_ABS: transform_ABS(c, inst); return 1; + case RC_OPCODE_DPH: transform_DPH(c, inst); return 1; + case RC_OPCODE_DST: transform_DST(c, inst); return 1; + case RC_OPCODE_FLR: transform_FLR(c, inst); return 1; + case RC_OPCODE_LIT: transform_LIT(c, inst); return 1; + case RC_OPCODE_LRP: transform_LRP(c, inst); return 1; + case RC_OPCODE_POW: transform_POW(c, inst); return 1; + case RC_OPCODE_RSQ: transform_RSQ(c, inst); return 1; + case RC_OPCODE_SGE: transform_SGE(c, inst); return 1; + case RC_OPCODE_SLT: transform_SLT(c, inst); return 1; + case RC_OPCODE_SUB: transform_SUB(c, inst); return 1; + case RC_OPCODE_SWZ: transform_SWZ(c, inst); return 1; + case RC_OPCODE_XPD: transform_XPD(c, inst); return 1; default: - return GL_FALSE; + return 0; } } @@ -452,37 +441,37 @@ static void transform_r300_vertex_ABS(struct radeon_compiler* c, struct rc_instruction* inst) { /* Note: r500 can take absolute values, but r300 cannot. */ - inst->I.Opcode = OPCODE_MAX; + inst->I.Opcode = RC_OPCODE_MAX; inst->I.SrcReg[1] = inst->I.SrcReg[0]; - inst->I.SrcReg[1].Negate ^= NEGATE_XYZW; + inst->I.SrcReg[1].Negate ^= RC_MASK_XYZW; } /** * For use with radeonLocalTransform, this transforms non-native ALU * instructions of the r300 up to r500 vertex engine. */ -GLboolean r300_transform_vertex_alu( +int r300_transform_vertex_alu( struct radeon_compiler * c, struct rc_instruction* inst, void* unused) { switch(inst->I.Opcode) { - case OPCODE_ABS: transform_r300_vertex_ABS(c, inst); return GL_TRUE; - case OPCODE_DP3: transform_DP3(c, inst); return GL_TRUE; - case OPCODE_DPH: transform_DPH(c, inst); return GL_TRUE; - case OPCODE_FLR: transform_FLR(c, inst); return GL_TRUE; - case OPCODE_LRP: transform_LRP(c, inst); return GL_TRUE; - case OPCODE_SUB: transform_SUB(c, inst); return GL_TRUE; - case OPCODE_SWZ: transform_SWZ(c, inst); return GL_TRUE; - case OPCODE_XPD: transform_XPD(c, inst); return GL_TRUE; + case RC_OPCODE_ABS: transform_r300_vertex_ABS(c, inst); return 1; + case RC_OPCODE_DP3: transform_DP3(c, inst); return 1; + case RC_OPCODE_DPH: transform_DPH(c, inst); return 1; + case RC_OPCODE_FLR: transform_FLR(c, inst); return 1; + case RC_OPCODE_LRP: transform_LRP(c, inst); return 1; + case RC_OPCODE_SUB: transform_SUB(c, inst); return 1; + case RC_OPCODE_SWZ: transform_SWZ(c, inst); return 1; + case RC_OPCODE_XPD: transform_XPD(c, inst); return 1; default: - return GL_FALSE; + return 0; } } -static void sincos_constants(struct radeon_compiler* c, GLuint *constants) +static void sincos_constants(struct radeon_compiler* c, unsigned int *constants) { - static const GLfloat SinCosConsts[2][4] = { + static const float SinCosConsts[2][4] = { { 1.273239545, // 4/PI -0.405284735, // -4/(PI*PI) @@ -512,25 +501,25 @@ static void sincos_constants(struct radeon_compiler* c, GLuint *constants) */ static void sin_approx( struct radeon_compiler* c, struct rc_instruction * after, - struct prog_dst_register dst, struct prog_src_register src, const GLuint* constants) -{ - GLuint tempreg = rc_find_free_temporary(c); - - emit2(c, after->Prev, OPCODE_MUL, 0, dstregtmpmask(tempreg, WRITEMASK_XY), - swizzle(src, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X), - srcreg(PROGRAM_CONSTANT, constants[0])); - emit3(c, after->Prev, OPCODE_MAD, 0, dstregtmpmask(tempreg, WRITEMASK_X), - swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y), - absolute(swizzle(src, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X)), - swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X)); - emit3(c, after->Prev, OPCODE_MAD, 0, dstregtmpmask(tempreg, WRITEMASK_Y), - swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X), - absolute(swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X)), - negate(swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X))); - emit3(c, after->Prev, OPCODE_MAD, 0, dst, - swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y), - swizzle(srcreg(PROGRAM_CONSTANT, constants[0]), SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W), - swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X)); + struct rc_dst_register dst, struct rc_src_register src, const unsigned int* constants) +{ + unsigned int tempreg = rc_find_free_temporary(c); + + emit2(c, after->Prev, RC_OPCODE_MUL, 0, dstregtmpmask(tempreg, RC_MASK_XY), + swizzle(src, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X), + srcreg(RC_FILE_CONSTANT, constants[0])); + emit3(c, after->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_X), + swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y), + absolute(swizzle(src, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X)), + swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X)); + emit3(c, after->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_Y), + swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X), + absolute(swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X)), + negate(swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X))); + emit3(c, after->Prev, RC_OPCODE_MAD, 0, dst, + swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y), + swizzle(srcreg(RC_FILE_CONSTANT, constants[0]), RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W), + swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X)); } /** @@ -538,81 +527,81 @@ static void sin_approx( * using only the basic instructions * MOV, ADD, MUL, MAD, FRC */ -GLboolean radeonTransformTrigSimple(struct radeon_compiler* c, +int radeonTransformTrigSimple(struct radeon_compiler* c, struct rc_instruction* inst, void* unused) { - if (inst->I.Opcode != OPCODE_COS && - inst->I.Opcode != OPCODE_SIN && - inst->I.Opcode != OPCODE_SCS) - return GL_FALSE; + if (inst->I.Opcode != RC_OPCODE_COS && + inst->I.Opcode != RC_OPCODE_SIN && + inst->I.Opcode != RC_OPCODE_SCS) + return 0; - GLuint constants[2]; - GLuint tempreg = rc_find_free_temporary(c); + unsigned int constants[2]; + unsigned int tempreg = rc_find_free_temporary(c); sincos_constants(c, constants); - if (inst->I.Opcode == OPCODE_COS) { + if (inst->I.Opcode == RC_OPCODE_COS) { // MAD tmp.x, src, 1/(2*PI), 0.75 // FRC tmp.x, tmp.x // MAD tmp.z, tmp.x, 2*PI, -PI - emit3(c, inst->Prev, OPCODE_MAD, 0, dstregtmpmask(tempreg, WRITEMASK_W), - swizzle(inst->I.SrcReg[0], SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X), - swizzle(srcreg(PROGRAM_CONSTANT, constants[1]), SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z), - swizzle(srcreg(PROGRAM_CONSTANT, constants[1]), SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X)); - emit1(c, inst->Prev, OPCODE_FRC, 0, dstregtmpmask(tempreg, WRITEMASK_W), - swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W)); - emit3(c, inst->Prev, OPCODE_MAD, 0, dstregtmpmask(tempreg, WRITEMASK_W), - swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W), - swizzle(srcreg(PROGRAM_CONSTANT, constants[1]), SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W), - negate(swizzle(srcreg(PROGRAM_CONSTANT, constants[0]), SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z))); + emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_W), + swizzle(inst->I.SrcReg[0], RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X), + swizzle(srcreg(RC_FILE_CONSTANT, constants[1]), RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z), + swizzle(srcreg(RC_FILE_CONSTANT, constants[1]), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X)); + emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstregtmpmask(tempreg, RC_MASK_W), + swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W)); + emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_W), + swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W), + swizzle(srcreg(RC_FILE_CONSTANT, constants[1]), RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W), + negate(swizzle(srcreg(RC_FILE_CONSTANT, constants[0]), RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z))); sin_approx(c, inst->Prev, inst->I.DstReg, - swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W), + swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W), constants); - } else if (inst->I.Opcode == OPCODE_SIN) { - emit3(c, inst->Prev, OPCODE_MAD, 0, dstregtmpmask(tempreg, WRITEMASK_W), - swizzle(inst->I.SrcReg[0], SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X), - swizzle(srcreg(PROGRAM_CONSTANT, constants[1]), SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z), - swizzle(srcreg(PROGRAM_CONSTANT, constants[1]), SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y)); - emit1(c, inst->Prev, OPCODE_FRC, 0, dstregtmpmask(tempreg, WRITEMASK_W), - swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W)); - emit3(c, inst->Prev, OPCODE_MAD, 0, dstregtmpmask(tempreg, WRITEMASK_W), - swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W), - swizzle(srcreg(PROGRAM_CONSTANT, constants[1]), SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W), - negate(swizzle(srcreg(PROGRAM_CONSTANT, constants[0]), SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z))); + } else if (inst->I.Opcode == RC_OPCODE_SIN) { + emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_W), + swizzle(inst->I.SrcReg[0], RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X), + swizzle(srcreg(RC_FILE_CONSTANT, constants[1]), RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z), + swizzle(srcreg(RC_FILE_CONSTANT, constants[1]), RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y)); + emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstregtmpmask(tempreg, RC_MASK_W), + swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W)); + emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_W), + swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W), + swizzle(srcreg(RC_FILE_CONSTANT, constants[1]), RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W), + negate(swizzle(srcreg(RC_FILE_CONSTANT, constants[0]), RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z))); sin_approx(c, inst->Prev, inst->I.DstReg, - swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W), + swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W), constants); } else { - emit3(c, inst->Prev, OPCODE_MAD, 0, dstregtmpmask(tempreg, WRITEMASK_XY), - swizzle(inst->I.SrcReg[0], SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X), - swizzle(srcreg(PROGRAM_CONSTANT, constants[1]), SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z), - swizzle(srcreg(PROGRAM_CONSTANT, constants[1]), SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_W)); - emit1(c, inst->Prev, OPCODE_FRC, 0, dstregtmpmask(tempreg, WRITEMASK_XY), - srcreg(PROGRAM_TEMPORARY, tempreg)); - emit3(c, inst->Prev, OPCODE_MAD, 0, dstregtmpmask(tempreg, WRITEMASK_XY), - srcreg(PROGRAM_TEMPORARY, tempreg), - swizzle(srcreg(PROGRAM_CONSTANT, constants[1]), SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W), - negate(swizzle(srcreg(PROGRAM_CONSTANT, constants[0]), SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z))); - - struct prog_dst_register dst = inst->I.DstReg; - - dst.WriteMask = inst->I.DstReg.WriteMask & WRITEMASK_X; + emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_XY), + swizzle(inst->I.SrcReg[0], RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X), + swizzle(srcreg(RC_FILE_CONSTANT, constants[1]), RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z), + swizzle(srcreg(RC_FILE_CONSTANT, constants[1]), RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_W)); + emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstregtmpmask(tempreg, RC_MASK_XY), + srcreg(RC_FILE_TEMPORARY, tempreg)); + emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_XY), + srcreg(RC_FILE_TEMPORARY, tempreg), + swizzle(srcreg(RC_FILE_CONSTANT, constants[1]), RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W), + negate(swizzle(srcreg(RC_FILE_CONSTANT, constants[0]), RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z))); + + struct rc_dst_register dst = inst->I.DstReg; + + dst.WriteMask = inst->I.DstReg.WriteMask & RC_MASK_X; sin_approx(c, inst->Prev, dst, - swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X), + swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X), constants); - dst.WriteMask = inst->I.DstReg.WriteMask & WRITEMASK_Y; + dst.WriteMask = inst->I.DstReg.WriteMask & RC_MASK_Y; sin_approx(c, inst->Prev, dst, - swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y), + swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y), constants); } rc_remove_instruction(inst); - return GL_TRUE; + return 1; } @@ -624,53 +613,53 @@ GLboolean radeonTransformTrigSimple(struct radeon_compiler* c, * * @warning This transformation implicitly changes the semantics of SIN and COS! */ -GLboolean radeonTransformTrigScale(struct radeon_compiler* c, +int radeonTransformTrigScale(struct radeon_compiler* c, struct rc_instruction* inst, void* unused) { - if (inst->I.Opcode != OPCODE_COS && - inst->I.Opcode != OPCODE_SIN && - inst->I.Opcode != OPCODE_SCS) - return GL_FALSE; + if (inst->I.Opcode != RC_OPCODE_COS && + inst->I.Opcode != RC_OPCODE_SIN && + inst->I.Opcode != RC_OPCODE_SCS) + return 0; - static const GLfloat RCP_2PI = 0.15915494309189535; - GLuint temp; - GLuint constant; - GLuint constant_swizzle; + static const float RCP_2PI = 0.15915494309189535; + unsigned int temp; + unsigned int constant; + unsigned int constant_swizzle; temp = rc_find_free_temporary(c); constant = rc_constants_add_immediate_scalar(&c->Program.Constants, RCP_2PI, &constant_swizzle); - emit2(c, inst->Prev, OPCODE_MUL, 0, dstregtmpmask(temp, WRITEMASK_W), - swizzle(inst->I.SrcReg[0], SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X), - srcregswz(PROGRAM_CONSTANT, constant, constant_swizzle)); - emit1(c, inst->Prev, OPCODE_FRC, 0, dstregtmpmask(temp, WRITEMASK_W), - srcreg(PROGRAM_TEMPORARY, temp)); - - if (inst->I.Opcode == OPCODE_COS) { - emit1(c, inst->Prev, OPCODE_COS, inst->I.SaturateMode, inst->I.DstReg, - srcregswz(PROGRAM_TEMPORARY, temp, SWIZZLE_WWWW)); - } else if (inst->I.Opcode == OPCODE_SIN) { - emit1(c, inst->Prev, OPCODE_SIN, inst->I.SaturateMode, - inst->I.DstReg, srcregswz(PROGRAM_TEMPORARY, temp, SWIZZLE_WWWW)); - } else if (inst->I.Opcode == OPCODE_SCS) { - struct prog_dst_register moddst = inst->I.DstReg; - - if (inst->I.DstReg.WriteMask & WRITEMASK_X) { - moddst.WriteMask = WRITEMASK_X; - emit1(c, inst->Prev, OPCODE_COS, inst->I.SaturateMode, moddst, - srcregswz(PROGRAM_TEMPORARY, temp, SWIZZLE_WWWW)); + emit2(c, inst->Prev, RC_OPCODE_MUL, 0, dstregtmpmask(temp, RC_MASK_W), + swizzle(inst->I.SrcReg[0], RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X), + srcregswz(RC_FILE_CONSTANT, constant, constant_swizzle)); + emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstregtmpmask(temp, RC_MASK_W), + srcreg(RC_FILE_TEMPORARY, temp)); + + if (inst->I.Opcode == RC_OPCODE_COS) { + emit1(c, inst->Prev, RC_OPCODE_COS, inst->I.SaturateMode, inst->I.DstReg, + srcregswz(RC_FILE_TEMPORARY, temp, RC_SWIZZLE_WWWW)); + } else if (inst->I.Opcode == RC_OPCODE_SIN) { + emit1(c, inst->Prev, RC_OPCODE_SIN, inst->I.SaturateMode, + inst->I.DstReg, srcregswz(RC_FILE_TEMPORARY, temp, RC_SWIZZLE_WWWW)); + } else if (inst->I.Opcode == RC_OPCODE_SCS) { + struct rc_dst_register moddst = inst->I.DstReg; + + if (inst->I.DstReg.WriteMask & RC_MASK_X) { + moddst.WriteMask = RC_MASK_X; + emit1(c, inst->Prev, RC_OPCODE_COS, inst->I.SaturateMode, moddst, + srcregswz(RC_FILE_TEMPORARY, temp, RC_SWIZZLE_WWWW)); } - if (inst->I.DstReg.WriteMask & WRITEMASK_Y) { - moddst.WriteMask = WRITEMASK_Y; - emit1(c, inst->Prev, OPCODE_SIN, inst->I.SaturateMode, moddst, - srcregswz(PROGRAM_TEMPORARY, temp, SWIZZLE_WWWW)); + if (inst->I.DstReg.WriteMask & RC_MASK_Y) { + moddst.WriteMask = RC_MASK_Y; + emit1(c, inst->Prev, RC_OPCODE_SIN, inst->I.SaturateMode, moddst, + srcregswz(RC_FILE_TEMPORARY, temp, RC_SWIZZLE_WWWW)); } } rc_remove_instruction(inst); - return GL_TRUE; + return 1; } /** @@ -681,15 +670,15 @@ GLboolean radeonTransformTrigScale(struct radeon_compiler* c, * @warning This explicitly changes the form of DDX and DDY! */ -GLboolean radeonTransformDeriv(struct radeon_compiler* c, +int radeonTransformDeriv(struct radeon_compiler* c, struct rc_instruction* inst, void* unused) { - if (inst->I.Opcode != OPCODE_DDX && inst->I.Opcode != OPCODE_DDY) - return GL_FALSE; + if (inst->I.Opcode != RC_OPCODE_DDX && inst->I.Opcode != RC_OPCODE_DDY) + return 0; - inst->I.SrcReg[1].Swizzle = MAKE_SWIZZLE4(SWIZZLE_ONE, SWIZZLE_ONE, SWIZZLE_ONE, SWIZZLE_ONE); - inst->I.SrcReg[1].Negate = NEGATE_XYZW; + inst->I.SrcReg[1].Swizzle = RC_MAKE_SWIZZLE(RC_SWIZZLE_ONE, RC_SWIZZLE_ONE, RC_SWIZZLE_ONE, RC_SWIZZLE_ONE); + inst->I.SrcReg[1].Negate = RC_MASK_XYZW; - return GL_TRUE; + return 1; } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.h b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.h index 147efec6fc..7cb5f84b7f 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.h @@ -30,27 +30,27 @@ #include "radeon_program.h" -GLboolean radeonTransformALU( +int radeonTransformALU( struct radeon_compiler * c, struct rc_instruction * inst, void*); -GLboolean r300_transform_vertex_alu( +int r300_transform_vertex_alu( struct radeon_compiler * c, struct rc_instruction * inst, void*); -GLboolean radeonTransformTrigSimple( +int radeonTransformTrigSimple( struct radeon_compiler * c, struct rc_instruction * inst, void*); -GLboolean radeonTransformTrigScale( +int radeonTransformTrigScale( struct radeon_compiler * c, struct rc_instruction * inst, void*); -GLboolean radeonTransformDeriv( +int radeonTransformDeriv( struct radeon_compiler * c, struct rc_instruction * inst, void*); diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c index 4c26db5d24..6cda208600 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c @@ -35,9 +35,10 @@ #include "radeon_program_pair.h" +#include + #include "memory_pool.h" #include "radeon_compiler.h" -#include "shader/prog_print.h" #define error(fmt, args...) do { \ rc_error(&s->Compiler->Base, "%s::%s(): " fmt "\n", \ @@ -45,19 +46,19 @@ } while(0) struct pair_state_instruction { - struct prog_instruction Instruction; - GLuint IP; /**< Position of this instruction in original program */ + struct rc_sub_instruction Instruction; + unsigned int IP; /**< Position of this instruction in original program */ - GLuint IsTex:1; /**< Is a texture instruction */ - GLuint NeedRGB:1; /**< Needs the RGB ALU */ - GLuint NeedAlpha:1; /**< Needs the Alpha ALU */ - GLuint IsTranscendent:1; /**< Is a special transcendent instruction */ + unsigned int IsTex:1; /**< Is a texture instruction */ + unsigned int NeedRGB:1; /**< Needs the RGB ALU */ + unsigned int NeedAlpha:1; /**< Needs the Alpha ALU */ + unsigned int IsTranscendent:1; /**< Is a special transcendent instruction */ /** * Number of (read and write) dependencies that must be resolved before * this instruction can be scheduled. */ - GLuint NumDependencies:5; + unsigned int NumDependencies:5; /** * Next instruction in the linked list of ready instructions. @@ -81,11 +82,11 @@ struct reg_value_reader { /** * Used to keep track which values are stored in each component of a - * PROGRAM_TEMPORARY. + * RC_FILE_TEMPORARY. */ struct reg_value { struct pair_state_instruction *Writer; - struct reg_value *Next; /**< Pointer to the next value to be written to the same PROGRAM_TEMPORARY component */ + struct reg_value *Next; /**< Pointer to the next value to be written to the same RC_FILE_TEMPORARY component */ /** * Unordered linked list of instructions that read from this value. @@ -98,21 +99,21 @@ struct reg_value { * When this count reaches zero, the instruction that writes the @ref Next value * can be scheduled. */ - GLuint NumReaders; + unsigned int NumReaders; }; /** - * Used to translate a PROGRAM_INPUT or PROGRAM_TEMPORARY Mesa register + * Used to translate a RC_FILE_INPUT or RC_FILE_TEMPORARY Mesa register * to the proper hardware temporary. */ struct pair_register_translation { - GLuint Allocated:1; - GLuint HwIndex:8; - GLuint RefCount:23; /**< # of times this occurs in an unscheduled instruction SrcReg or DstReg */ + unsigned int Allocated:1; + unsigned int HwIndex:8; + unsigned int RefCount:23; /**< # of times this occurs in an unscheduled instruction SrcReg or DstReg */ /** * Notes the value that is currently contained in each component - * (only used for PROGRAM_TEMPORARY registers). + * (only used for RC_FILE_TEMPORARY registers). */ struct reg_value *Value[4]; }; @@ -120,17 +121,17 @@ struct pair_register_translation { struct pair_state { struct r300_fragment_program_compiler * Compiler; const struct radeon_pair_handler *Handler; - GLboolean Verbose; + unsigned int Verbose; void *UserData; /** * Translate Mesa registers to hardware registers */ - struct pair_register_translation Inputs[FRAG_ATTRIB_MAX]; - struct pair_register_translation Temps[MAX_PROGRAM_TEMPS]; + struct pair_register_translation Inputs[RC_REGISTER_MAX_INDEX]; + struct pair_register_translation Temps[RC_REGISTER_MAX_INDEX]; struct { - GLuint RefCount; /**< # of times this occurs in an unscheduled SrcReg or DstReg */ + unsigned int RefCount; /**< # of times this occurs in an unscheduled SrcReg or DstReg */ } HwTemps[128]; /** @@ -144,28 +145,28 @@ struct pair_state { }; -static struct pair_register_translation *get_register(struct pair_state *s, GLuint file, GLuint index) +static struct pair_register_translation *get_register(struct pair_state *s, rc_register_file file, unsigned int index) { switch(file) { - case PROGRAM_TEMPORARY: return &s->Temps[index]; - case PROGRAM_INPUT: return &s->Inputs[index]; + case RC_FILE_TEMPORARY: return &s->Temps[index]; + case RC_FILE_INPUT: return &s->Inputs[index]; default: return 0; } } -static void alloc_hw_reg(struct pair_state *s, GLuint file, GLuint index, GLuint hwindex) +static void alloc_hw_reg(struct pair_state *s, rc_register_file file, unsigned int index, unsigned int hwindex) { struct pair_register_translation *t = get_register(s, file, index); - ASSERT(!s->HwTemps[hwindex].RefCount); - ASSERT(!t->Allocated); + assert(!s->HwTemps[hwindex].RefCount); + assert(!t->Allocated); s->HwTemps[hwindex].RefCount = t->RefCount; t->Allocated = 1; t->HwIndex = hwindex; } -static GLuint get_hw_reg(struct pair_state *s, GLuint file, GLuint index) +static unsigned int get_hw_reg(struct pair_state *s, rc_register_file file, unsigned int index) { - GLuint hwindex; + unsigned int hwindex; struct pair_register_translation *t = get_register(s, file, index); if (!t) { @@ -190,7 +191,7 @@ static GLuint get_hw_reg(struct pair_state *s, GLuint file, GLuint index) } -static void deref_hw_reg(struct pair_state *s, GLuint hwindex) +static void deref_hw_reg(struct pair_state *s, unsigned int hwindex) { if (!s->HwTemps[hwindex].RefCount) { error("Hwindex %i refcount error", hwindex); @@ -213,7 +214,7 @@ static void add_pairinst_to_list(struct pair_state_instruction **list, struct pa static void instruction_ready(struct pair_state *s, struct pair_state_instruction *pairinst) { if (s->Verbose) - _mesa_printf("instruction_ready(%i)\n", pairinst->IP); + fprintf(stderr, "instruction_ready(%i)\n", pairinst->IP); if (pairinst->IsTex) add_pairinst_to_list(&s->ReadyTEX, pairinst); @@ -230,24 +231,24 @@ static void instruction_ready(struct pair_state *s, struct pair_state_instructio * Finally rewrite ADD, MOV, MUL as the appropriate native instruction * and reverse the order of arguments for CMP. */ -static void final_rewrite(struct pair_state *s, struct prog_instruction *inst) +static void final_rewrite(struct pair_state *s, struct rc_sub_instruction *inst) { - struct prog_src_register tmp; + struct rc_src_register tmp; switch(inst->Opcode) { - case OPCODE_ADD: + case RC_OPCODE_ADD: inst->SrcReg[2] = inst->SrcReg[1]; - inst->SrcReg[1].File = PROGRAM_BUILTIN; - inst->SrcReg[1].Swizzle = SWIZZLE_1111; - inst->SrcReg[1].Negate = NEGATE_NONE; - inst->Opcode = OPCODE_MAD; + inst->SrcReg[1].File = RC_FILE_NONE; + inst->SrcReg[1].Swizzle = RC_SWIZZLE_1111; + inst->SrcReg[1].Negate = RC_MASK_NONE; + inst->Opcode = RC_OPCODE_MAD; break; - case OPCODE_CMP: + case RC_OPCODE_CMP: tmp = inst->SrcReg[2]; inst->SrcReg[2] = inst->SrcReg[0]; inst->SrcReg[0] = tmp; break; - case OPCODE_MOV: + case RC_OPCODE_MOV: /* AMD say we should use CMP. * However, when we transform * KIL -r0; @@ -258,16 +259,16 @@ static void final_rewrite(struct pair_state *s, struct prog_instruction *inst) * It appears that the R500 KIL hardware treats -0.0 as less * than zero. */ - inst->SrcReg[1].File = PROGRAM_BUILTIN; - inst->SrcReg[1].Swizzle = SWIZZLE_1111; - inst->SrcReg[2].File = PROGRAM_BUILTIN; - inst->SrcReg[2].Swizzle = SWIZZLE_0000; - inst->Opcode = OPCODE_MAD; + inst->SrcReg[1].File = RC_FILE_NONE; + inst->SrcReg[1].Swizzle = RC_SWIZZLE_1111; + inst->SrcReg[2].File = RC_FILE_NONE; + inst->SrcReg[2].Swizzle = RC_SWIZZLE_0000; + inst->Opcode = RC_OPCODE_MAD; break; - case OPCODE_MUL: - inst->SrcReg[2].File = PROGRAM_BUILTIN; - inst->SrcReg[2].Swizzle = SWIZZLE_0000; - inst->Opcode = OPCODE_MAD; + case RC_OPCODE_MUL: + inst->SrcReg[2].File = RC_FILE_NONE; + inst->SrcReg[2].Swizzle = RC_SWIZZLE_0000; + inst->Opcode = RC_OPCODE_MAD; break; default: /* nothing to do */ @@ -282,41 +283,40 @@ static void final_rewrite(struct pair_state *s, struct prog_instruction *inst) static void classify_instruction(struct pair_state *s, struct pair_state_instruction *psi) { - psi->NeedRGB = (psi->Instruction.DstReg.WriteMask & WRITEMASK_XYZ) ? 1 : 0; - psi->NeedAlpha = (psi->Instruction.DstReg.WriteMask & WRITEMASK_W) ? 1 : 0; + psi->NeedRGB = (psi->Instruction.DstReg.WriteMask & RC_MASK_XYZ) ? 1 : 0; + psi->NeedAlpha = (psi->Instruction.DstReg.WriteMask & RC_MASK_W) ? 1 : 0; switch(psi->Instruction.Opcode) { - case OPCODE_ADD: - case OPCODE_CMP: - case OPCODE_DDX: - case OPCODE_DDY: - case OPCODE_FRC: - case OPCODE_MAD: - case OPCODE_MAX: - case OPCODE_MIN: - case OPCODE_MOV: - case OPCODE_MUL: + case RC_OPCODE_ADD: + case RC_OPCODE_CMP: + case RC_OPCODE_DDX: + case RC_OPCODE_DDY: + case RC_OPCODE_FRC: + case RC_OPCODE_MAD: + case RC_OPCODE_MAX: + case RC_OPCODE_MIN: + case RC_OPCODE_MOV: + case RC_OPCODE_MUL: break; - case OPCODE_COS: - case OPCODE_EX2: - case OPCODE_LG2: - case OPCODE_RCP: - case OPCODE_RSQ: - case OPCODE_SIN: + case RC_OPCODE_COS: + case RC_OPCODE_EX2: + case RC_OPCODE_LG2: + case RC_OPCODE_RCP: + case RC_OPCODE_RSQ: + case RC_OPCODE_SIN: psi->IsTranscendent = 1; psi->NeedAlpha = 1; break; - case OPCODE_DP4: + case RC_OPCODE_DP4: psi->NeedAlpha = 1; /* fall through */ - case OPCODE_DP3: + case RC_OPCODE_DP3: psi->NeedRGB = 1; break; - case OPCODE_KIL: - case OPCODE_TEX: - case OPCODE_TXB: - case OPCODE_TXP: - case OPCODE_END: + case RC_OPCODE_KIL: + case RC_OPCODE_TEX: + case RC_OPCODE_TXB: + case RC_OPCODE_TXP: psi->IsTex = 1; break; default: @@ -333,7 +333,7 @@ static void classify_instruction(struct pair_state *s, static void scan_instructions(struct pair_state *s) { struct rc_instruction *source; - GLuint ip; + unsigned int ip; for(source = s->Compiler->Base.Program.Instructions.Next, ip = 0; source != &s->Compiler->Base.Program.Instructions; @@ -346,9 +346,9 @@ static void scan_instructions(struct pair_state *s) final_rewrite(s, &pairinst->Instruction); classify_instruction(s, pairinst); - int nsrc = _mesa_num_inst_src_regs(pairinst->Instruction.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(pairinst->Instruction.Opcode); int j; - for(j = 0; j < nsrc; j++) { + for(j = 0; j < opcode->NumSrcRegs; j++) { struct pair_register_translation *t = get_register(s, pairinst->Instruction.SrcReg[j].File, pairinst->Instruction.SrcReg[j].Index); if (!t) @@ -356,10 +356,10 @@ static void scan_instructions(struct pair_state *s) t->RefCount++; - if (pairinst->Instruction.SrcReg[j].File == PROGRAM_TEMPORARY) { + if (pairinst->Instruction.SrcReg[j].File == RC_FILE_TEMPORARY) { int i; for(i = 0; i < 4; ++i) { - GLuint swz = GET_SWZ(pairinst->Instruction.SrcReg[j].Swizzle, i); + unsigned int swz = GET_SWZ(pairinst->Instruction.SrcReg[j].Swizzle, i); if (swz >= 4) continue; /* constant or NIL swizzle */ if (!t->Value[swz]) @@ -369,7 +369,7 @@ static void scan_instructions(struct pair_state *s) * also rewrites the value. The code below adds * a dependency for the DstReg, which is a superset * of the SrcReg dependency. */ - if (pairinst->Instruction.DstReg.File == PROGRAM_TEMPORARY && + if (pairinst->Instruction.DstReg.File == RC_FILE_TEMPORARY && pairinst->Instruction.DstReg.Index == pairinst->Instruction.SrcReg[j].Index && GET_BIT(pairinst->Instruction.DstReg.WriteMask, swz)) continue; @@ -384,14 +384,13 @@ static void scan_instructions(struct pair_state *s) } } - int ndst = _mesa_num_inst_dst_regs(pairinst->Instruction.Opcode); - if (ndst) { + if (opcode->HasDstReg) { struct pair_register_translation *t = get_register(s, pairinst->Instruction.DstReg.File, pairinst->Instruction.DstReg.Index); if (t) { t->RefCount++; - if (pairinst->Instruction.DstReg.File == PROGRAM_TEMPORARY) { + if (pairinst->Instruction.DstReg.File == RC_FILE_TEMPORARY) { int j; for(j = 0; j < 4; ++j) { if (!GET_BIT(pairinst->Instruction.DstReg.WriteMask, j)) @@ -412,15 +411,15 @@ static void scan_instructions(struct pair_state *s) } if (s->Verbose) - _mesa_printf("scan(%i): NumDeps = %i\n", ip, pairinst->NumDependencies); + fprintf(stderr, "scan(%i): NumDeps = %i\n", ip, pairinst->NumDependencies); if (!pairinst->NumDependencies) instruction_ready(s, pairinst); } - /* Clear the PROGRAM_TEMPORARY state */ + /* Clear the RC_FILE_TEMPORARY state */ int i, j; - for(i = 0; i < MAX_PROGRAM_TEMPS; ++i) { + for(i = 0; i < RC_REGISTER_MAX_INDEX; ++i) { for(j = 0; j < 4; ++j) s->Temps[i].Value[j] = 0; } @@ -429,7 +428,7 @@ static void scan_instructions(struct pair_state *s) static void decrement_dependencies(struct pair_state *s, struct pair_state_instruction *pairinst) { - ASSERT(pairinst->NumDependencies > 0); + assert(pairinst->NumDependencies > 0); if (!--pairinst->NumDependencies) instruction_ready(s, pairinst); } @@ -440,12 +439,12 @@ static void decrement_dependencies(struct pair_state *s, struct pair_state_instr */ static void commit_instruction(struct pair_state *s, struct pair_state_instruction *pairinst) { - struct prog_instruction *inst = &pairinst->Instruction; + struct rc_sub_instruction *inst = &pairinst->Instruction; if (s->Verbose) - _mesa_printf("commit_instruction(%i)\n", pairinst->IP); + fprintf(stderr, "commit_instruction(%i)\n", pairinst->IP); - if (inst->DstReg.File == PROGRAM_TEMPORARY) { + if (inst->DstReg.File == RC_FILE_TEMPORARY) { struct pair_register_translation *t = &s->Temps[inst->DstReg.Index]; deref_hw_reg(s, t->HwIndex); @@ -467,21 +466,21 @@ static void commit_instruction(struct pair_state *s, struct pair_state_instructi } } - int nsrc = _mesa_num_inst_src_regs(inst->Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Opcode); int i; - for(i = 0; i < nsrc; i++) { + for(i = 0; i < opcode->NumSrcRegs; i++) { struct pair_register_translation *t = get_register(s, inst->SrcReg[i].File, inst->SrcReg[i].Index); if (!t) continue; deref_hw_reg(s, get_hw_reg(s, inst->SrcReg[i].File, inst->SrcReg[i].Index)); - if (inst->SrcReg[i].File != PROGRAM_TEMPORARY) + if (inst->SrcReg[i].File != RC_FILE_TEMPORARY) continue; int j; for(j = 0; j < 4; ++j) { - GLuint swz = GET_SWZ(inst->SrcReg[i].Swizzle, j); + unsigned int swz = GET_SWZ(inst->SrcReg[i].Swizzle, j); if (swz >= 4) continue; if (!t->Value[swz]) @@ -489,7 +488,7 @@ static void commit_instruction(struct pair_state *s, struct pair_state_instructi /* Do not free a dependency if this instruction * also rewrites the value. See scan_instructions. */ - if (inst->DstReg.File == PROGRAM_TEMPORARY && + if (inst->DstReg.File == RC_FILE_TEMPORARY && inst->DstReg.Index == inst->SrcReg[i].Index && GET_BIT(inst->DstReg.WriteMask, swz)) continue; @@ -519,7 +518,7 @@ static void emit_all_tex(struct pair_state *s) struct pair_state_instruction *readytex; struct pair_state_instruction *pairinst; - ASSERT(s->ReadyTEX); + assert(s->ReadyTEX); // Don't let the ready list change under us! readytex = s->ReadyTEX; @@ -527,39 +526,37 @@ static void emit_all_tex(struct pair_state *s) // Allocate destination hardware registers in one block to avoid conflicts. for(pairinst = readytex; pairinst; pairinst = pairinst->NextReady) { - struct prog_instruction *inst = &pairinst->Instruction; - if (inst->Opcode != OPCODE_KIL) + struct rc_sub_instruction *inst = &pairinst->Instruction; + if (inst->Opcode != RC_OPCODE_KIL) get_hw_reg(s, inst->DstReg.File, inst->DstReg.Index); } if (s->Compiler->Base.Debug) - _mesa_printf(" BEGIN_TEX\n"); + fprintf(stderr, " BEGIN_TEX\n"); if (s->Handler->BeginTexBlock) s->Compiler->Base.Error = s->Compiler->Base.Error || !s->Handler->BeginTexBlock(s->UserData); for(pairinst = readytex; pairinst; pairinst = pairinst->NextReady) { - struct prog_instruction *inst = &pairinst->Instruction; + struct rc_sub_instruction *inst = &pairinst->Instruction; commit_instruction(s, pairinst); - if (inst->Opcode != OPCODE_KIL) + if (inst->Opcode != RC_OPCODE_KIL) inst->DstReg.Index = get_hw_reg(s, inst->DstReg.File, inst->DstReg.Index); inst->SrcReg[0].Index = get_hw_reg(s, inst->SrcReg[0].File, inst->SrcReg[0].Index); if (s->Compiler->Base.Debug) { - _mesa_printf(" "); - _mesa_print_instruction(inst); - fflush(stderr); + /* Should print the TEX instruction here */ } struct radeon_pair_texture_instruction rpti; switch(inst->Opcode) { - case OPCODE_TEX: rpti.Opcode = RADEON_OPCODE_TEX; break; - case OPCODE_TXB: rpti.Opcode = RADEON_OPCODE_TXB; break; - case OPCODE_TXP: rpti.Opcode = RADEON_OPCODE_TXP; break; + case RC_OPCODE_TEX: rpti.Opcode = RADEON_OPCODE_TEX; break; + case RC_OPCODE_TXB: rpti.Opcode = RADEON_OPCODE_TXB; break; + case RC_OPCODE_TXP: rpti.Opcode = RADEON_OPCODE_TXP; break; default: - case OPCODE_KIL: rpti.Opcode = RADEON_OPCODE_KIL; break; + case RC_OPCODE_KIL: rpti.Opcode = RADEON_OPCODE_KIL; break; } rpti.DestIndex = inst->DstReg.Index; @@ -573,12 +570,12 @@ static void emit_all_tex(struct pair_state *s) } if (s->Compiler->Base.Debug) - _mesa_printf(" END_TEX\n"); + fprintf(stderr, " END_TEX\n"); } static int alloc_pair_source(struct pair_state *s, struct radeon_pair_instruction *pair, - struct prog_src_register src, GLboolean rgb, GLboolean alpha) + struct rc_src_register src, unsigned int rgb, unsigned int alpha) { int candidate = -1; int candidate_quality = -1; @@ -587,10 +584,10 @@ static int alloc_pair_source(struct pair_state *s, struct radeon_pair_instructio if (!rgb && !alpha) return 0; - GLuint constant; - GLuint index; + unsigned int constant; + unsigned int index; - if (src.File == PROGRAM_TEMPORARY || src.File == PROGRAM_INPUT) { + if (src.File == RC_FILE_TEMPORARY || src.File == RC_FILE_INPUT) { constant = 0; index = get_hw_reg(s, src.File, src.Index); } else { @@ -642,37 +639,38 @@ static int alloc_pair_source(struct pair_state *s, struct radeon_pair_instructio * Fill the given ALU instruction's opcodes and source operands into the given pair, * if possible. */ -static GLboolean fill_instruction_into_pair( +static int fill_instruction_into_pair( struct pair_state *s, struct radeon_pair_instruction *pair, struct pair_state_instruction *pairinst) { - struct prog_instruction *inst = &pairinst->Instruction; + struct rc_sub_instruction *inst = &pairinst->Instruction; - ASSERT(!pairinst->NeedRGB || pair->RGB.Opcode == OPCODE_NOP); - ASSERT(!pairinst->NeedAlpha || pair->Alpha.Opcode == OPCODE_NOP); + assert(!pairinst->NeedRGB || pair->RGB.Opcode == RC_OPCODE_NOP); + assert(!pairinst->NeedAlpha || pair->Alpha.Opcode == RC_OPCODE_NOP); if (pairinst->NeedRGB) { if (pairinst->IsTranscendent) - pair->RGB.Opcode = OPCODE_REPL_ALPHA; + pair->RGB.Opcode = RC_OPCODE_REPL_ALPHA; else pair->RGB.Opcode = inst->Opcode; - if (inst->SaturateMode == SATURATE_ZERO_ONE) + if (inst->SaturateMode == RC_SATURATE_ZERO_ONE) pair->RGB.Saturate = 1; } if (pairinst->NeedAlpha) { pair->Alpha.Opcode = inst->Opcode; - if (inst->SaturateMode == SATURATE_ZERO_ONE) + if (inst->SaturateMode == RC_SATURATE_ZERO_ONE) pair->Alpha.Saturate = 1; } - int nargs = _mesa_num_inst_src_regs(inst->Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Opcode); + int nargs = opcode->NumSrcRegs; int i; /* Special case for DDX/DDY (MDH/MDV). */ - if (inst->Opcode == OPCODE_DDX || inst->Opcode == OPCODE_DDY) { + if (inst->Opcode == RC_OPCODE_DDX || inst->Opcode == RC_OPCODE_DDY) { if (pair->RGB.Src[0].Used || pair->Alpha.Src[0].Used) - return GL_FALSE; + return 0; else nargs++; } @@ -680,43 +678,43 @@ static GLboolean fill_instruction_into_pair( for(i = 0; i < nargs; ++i) { int source; if (pairinst->NeedRGB && !pairinst->IsTranscendent) { - GLboolean srcrgb = GL_FALSE; - GLboolean srcalpha = GL_FALSE; + unsigned int srcrgb = 0; + unsigned int srcalpha = 0; int j; for(j = 0; j < 3; ++j) { - GLuint swz = GET_SWZ(inst->SrcReg[i].Swizzle, j); + unsigned int swz = GET_SWZ(inst->SrcReg[i].Swizzle, j); if (swz < 3) - srcrgb = GL_TRUE; + srcrgb = 1; else if (swz < 4) - srcalpha = GL_TRUE; + srcalpha = 1; } source = alloc_pair_source(s, pair, inst->SrcReg[i], srcrgb, srcalpha); if (source < 0) - return GL_FALSE; + return 0; pair->RGB.Arg[i].Source = source; pair->RGB.Arg[i].Swizzle = inst->SrcReg[i].Swizzle & 0x1ff; pair->RGB.Arg[i].Abs = inst->SrcReg[i].Abs; - pair->RGB.Arg[i].Negate = !!(inst->SrcReg[i].Negate & (NEGATE_X | NEGATE_Y | NEGATE_Z)); + pair->RGB.Arg[i].Negate = !!(inst->SrcReg[i].Negate & (RC_MASK_X | RC_MASK_Y | RC_MASK_Z)); } if (pairinst->NeedAlpha) { - GLboolean srcrgb = GL_FALSE; - GLboolean srcalpha = GL_FALSE; - GLuint swz = GET_SWZ(inst->SrcReg[i].Swizzle, pairinst->IsTranscendent ? 0 : 3); + unsigned int srcrgb = 0; + unsigned int srcalpha = 0; + unsigned int swz = GET_SWZ(inst->SrcReg[i].Swizzle, pairinst->IsTranscendent ? 0 : 3); if (swz < 3) - srcrgb = GL_TRUE; + srcrgb = 1; else if (swz < 4) - srcalpha = GL_TRUE; + srcalpha = 1; source = alloc_pair_source(s, pair, inst->SrcReg[i], srcrgb, srcalpha); if (source < 0) - return GL_FALSE; + return 0; pair->Alpha.Arg[i].Source = source; pair->Alpha.Arg[i].Swizzle = swz; pair->Alpha.Arg[i].Abs = inst->SrcReg[i].Abs; - pair->Alpha.Arg[i].Negate = !!(inst->SrcReg[i].Negate & NEGATE_W); + pair->Alpha.Arg[i].Negate = !!(inst->SrcReg[i].Negate & RC_MASK_W); } } - return GL_TRUE; + return 1; } @@ -733,20 +731,20 @@ static void fill_dest_into_pair( struct radeon_pair_instruction *pair, struct pair_state_instruction *pairinst) { - struct prog_instruction *inst = &pairinst->Instruction; + struct rc_sub_instruction *inst = &pairinst->Instruction; - if (inst->DstReg.File == PROGRAM_OUTPUT) { + if (inst->DstReg.File == RC_FILE_OUTPUT) { if (inst->DstReg.Index == s->Compiler->OutputColor) { - pair->RGB.OutputWriteMask |= inst->DstReg.WriteMask & WRITEMASK_XYZ; + pair->RGB.OutputWriteMask |= inst->DstReg.WriteMask & RC_MASK_XYZ; pair->Alpha.OutputWriteMask |= GET_BIT(inst->DstReg.WriteMask, 3); } else if (inst->DstReg.Index == s->Compiler->OutputDepth) { pair->Alpha.DepthWriteMask |= GET_BIT(inst->DstReg.WriteMask, 3); } } else { - GLuint hwindex = get_hw_reg(s, inst->DstReg.File, inst->DstReg.Index); + unsigned int hwindex = get_hw_reg(s, inst->DstReg.File, inst->DstReg.Index); if (pairinst->NeedRGB) { pair->RGB.DestIndex = hwindex; - pair->RGB.WriteMask |= inst->DstReg.WriteMask & WRITEMASK_XYZ; + pair->RGB.WriteMask |= inst->DstReg.WriteMask & RC_MASK_XYZ; } if (pairinst->NeedAlpha) { pair->Alpha.DestIndex = hwindex; @@ -780,7 +778,7 @@ static void emit_alu(struct pair_state *s) s->ReadyAlpha = s->ReadyAlpha->NextReady; } - _mesa_bzero(&pair, sizeof(pair)); + memset(&pair, 0, sizeof(pair)); fill_instruction_into_pair(s, &pair, psi); fill_dest_into_pair(s, &pair, psi); commit_instruction(s, psi); @@ -794,7 +792,7 @@ static void emit_alu(struct pair_state *s) for(palpha = &s->ReadyAlpha; *palpha; palpha = &(*palpha)->NextReady) { struct pair_state_instruction * psirgb = *prgb; struct pair_state_instruction * psialpha = *palpha; - _mesa_bzero(&pair, sizeof(pair)); + memset(&pair, 0, sizeof(pair)); fill_instruction_into_pair(s, &pair, psirgb); if (!fill_instruction_into_pair(s, &pair, psialpha)) continue; @@ -812,7 +810,7 @@ static void emit_alu(struct pair_state *s) psi = s->ReadyRGB; s->ReadyRGB = s->ReadyRGB->NextReady; - _mesa_bzero(&pair, sizeof(pair)); + memset(&pair, 0, sizeof(pair)); fill_instruction_into_pair(s, &pair, psi); fill_dest_into_pair(s, &pair, psi); commit_instruction(s, psi); @@ -829,7 +827,7 @@ static void emit_alu(struct pair_state *s) static void alloc_helper(void * data, unsigned input, unsigned hwreg) { struct pair_state * s = data; - alloc_hw_reg(s, PROGRAM_INPUT, input, hwreg); + alloc_hw_reg(s, RC_FILE_INPUT, input, hwreg); } void radeonPairProgram( @@ -838,14 +836,14 @@ void radeonPairProgram( { struct pair_state s; - _mesa_bzero(&s, sizeof(s)); + memset(&s, 0, sizeof(s)); s.Compiler = compiler; s.Handler = handler; s.UserData = userdata; - s.Verbose = GL_FALSE && s.Compiler->Base.Debug; + s.Verbose = 0 && s.Compiler->Base.Debug; if (s.Compiler->Base.Debug) - _mesa_printf("Emit paired program\n"); + fprintf(stderr, "Emit paired program\n"); scan_instructions(&s); s.Compiler->AllocateHwInputs(s.Compiler, &alloc_helper, &s); @@ -860,41 +858,36 @@ void radeonPairProgram( } if (s.Compiler->Base.Debug) - _mesa_printf(" END\n"); + fprintf(stderr, " END\n"); } static void print_pair_src(int i, struct radeon_pair_instruction_source* src) { - _mesa_printf(" Src%i = %s[%i]", i, src->Constant ? "CNST" : "TEMP", src->Index); + fprintf(stderr, " Src%i = %s[%i]", i, src->Constant ? "CNST" : "TEMP", src->Index); } -static const char* opcode_string(GLuint opcode) +static const char* opcode_string(rc_opcode opcode) { - if (opcode == OPCODE_REPL_ALPHA) - return "SOP"; - else - return _mesa_opcode_string(opcode); + return rc_get_opcode_info(opcode)->Name; } -static int num_pairinst_args(GLuint opcode) +static int num_pairinst_args(rc_opcode opcode) { - if (opcode == OPCODE_REPL_ALPHA) - return 0; - else - return _mesa_num_inst_src_regs(opcode); + return rc_get_opcode_info(opcode)->NumSrcRegs; } -static char swizzle_char(GLuint swz) +static char swizzle_char(rc_swizzle swz) { switch(swz) { - case SWIZZLE_X: return 'x'; - case SWIZZLE_Y: return 'y'; - case SWIZZLE_Z: return 'z'; - case SWIZZLE_W: return 'w'; - case SWIZZLE_ZERO: return '0'; - case SWIZZLE_ONE: return '1'; - case SWIZZLE_NIL: return '_'; + case RC_SWIZZLE_X: return 'x'; + case RC_SWIZZLE_Y: return 'y'; + case RC_SWIZZLE_Z: return 'z'; + case RC_SWIZZLE_W: return 'w'; + case RC_SWIZZLE_ZERO: return '0'; + case RC_SWIZZLE_ONE: return '1'; + case RC_SWIZZLE_HALF: return 'H'; + case RC_SWIZZLE_UNUSED: return '_'; default: return '?'; } } @@ -904,27 +897,27 @@ void radeonPrintPairInstruction(struct radeon_pair_instruction *inst) int nargs; int i; - _mesa_printf(" RGB: "); + fprintf(stderr, " RGB: "); for(i = 0; i < 3; ++i) { if (inst->RGB.Src[i].Used) print_pair_src(i, inst->RGB.Src + i); } - _mesa_printf("\n"); - _mesa_printf(" Alpha:"); + fprintf(stderr, "\n"); + fprintf(stderr, " Alpha:"); for(i = 0; i < 3; ++i) { if (inst->Alpha.Src[i].Used) print_pair_src(i, inst->Alpha.Src + i); } - _mesa_printf("\n"); + fprintf(stderr, "\n"); - _mesa_printf(" %s%s", opcode_string(inst->RGB.Opcode), inst->RGB.Saturate ? "_SAT" : ""); + fprintf(stderr, " %s%s", opcode_string(inst->RGB.Opcode), inst->RGB.Saturate ? "_SAT" : ""); if (inst->RGB.WriteMask) - _mesa_printf(" TEMP[%i].%s%s%s", inst->RGB.DestIndex, + fprintf(stderr, " TEMP[%i].%s%s%s", inst->RGB.DestIndex, (inst->RGB.WriteMask & 1) ? "x" : "", (inst->RGB.WriteMask & 2) ? "y" : "", (inst->RGB.WriteMask & 4) ? "z" : ""); if (inst->RGB.OutputWriteMask) - _mesa_printf(" COLOR.%s%s%s", + fprintf(stderr, " COLOR.%s%s%s", (inst->RGB.OutputWriteMask & 1) ? "x" : "", (inst->RGB.OutputWriteMask & 2) ? "y" : "", (inst->RGB.OutputWriteMask & 4) ? "z" : ""); @@ -932,27 +925,27 @@ void radeonPrintPairInstruction(struct radeon_pair_instruction *inst) for(i = 0; i < nargs; ++i) { const char* abs = inst->RGB.Arg[i].Abs ? "|" : ""; const char* neg = inst->RGB.Arg[i].Negate ? "-" : ""; - _mesa_printf(", %s%sSrc%i.%c%c%c%s", neg, abs, inst->RGB.Arg[i].Source, + fprintf(stderr, ", %s%sSrc%i.%c%c%c%s", neg, abs, inst->RGB.Arg[i].Source, swizzle_char(GET_SWZ(inst->RGB.Arg[i].Swizzle, 0)), swizzle_char(GET_SWZ(inst->RGB.Arg[i].Swizzle, 1)), swizzle_char(GET_SWZ(inst->RGB.Arg[i].Swizzle, 2)), abs); } - _mesa_printf("\n"); + fprintf(stderr, "\n"); - _mesa_printf(" %s%s", opcode_string(inst->Alpha.Opcode), inst->Alpha.Saturate ? "_SAT" : ""); + fprintf(stderr, " %s%s", opcode_string(inst->Alpha.Opcode), inst->Alpha.Saturate ? "_SAT" : ""); if (inst->Alpha.WriteMask) - _mesa_printf(" TEMP[%i].w", inst->Alpha.DestIndex); + fprintf(stderr, " TEMP[%i].w", inst->Alpha.DestIndex); if (inst->Alpha.OutputWriteMask) - _mesa_printf(" COLOR.w"); + fprintf(stderr, " COLOR.w"); if (inst->Alpha.DepthWriteMask) - _mesa_printf(" DEPTH.w"); + fprintf(stderr, " DEPTH.w"); nargs = num_pairinst_args(inst->Alpha.Opcode); for(i = 0; i < nargs; ++i) { const char* abs = inst->Alpha.Arg[i].Abs ? "|" : ""; const char* neg = inst->Alpha.Arg[i].Negate ? "-" : ""; - _mesa_printf(", %s%sSrc%i.%c%s", neg, abs, inst->Alpha.Arg[i].Source, + fprintf(stderr, ", %s%sSrc%i.%c%s", neg, abs, inst->Alpha.Arg[i].Source, swizzle_char(inst->Alpha.Arg[i].Swizzle), abs); } - _mesa_printf("\n"); + fprintf(stderr, "\n"); } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h index ff76178551..da2bcc5d89 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h @@ -38,43 +38,43 @@ struct r300_fragment_program_compiler; * fragment programs. */ struct radeon_pair_instruction_source { - GLuint Index:8; - GLuint Constant:1; - GLuint Used:1; + unsigned int Index:8; + unsigned int Constant:1; + unsigned int Used:1; }; struct radeon_pair_instruction_rgb { - GLuint Opcode:8; - GLuint DestIndex:8; - GLuint WriteMask:3; - GLuint OutputWriteMask:3; - GLuint Saturate:1; + unsigned int Opcode:8; + unsigned int DestIndex:8; + unsigned int WriteMask:3; + unsigned int OutputWriteMask:3; + unsigned int Saturate:1; struct radeon_pair_instruction_source Src[3]; struct { - GLuint Source:2; - GLuint Swizzle:9; - GLuint Abs:1; - GLuint Negate:1; + unsigned int Source:2; + unsigned int Swizzle:9; + unsigned int Abs:1; + unsigned int Negate:1; } Arg[3]; }; struct radeon_pair_instruction_alpha { - GLuint Opcode:8; - GLuint DestIndex:8; - GLuint WriteMask:1; - GLuint OutputWriteMask:1; - GLuint DepthWriteMask:1; - GLuint Saturate:1; + unsigned int Opcode:8; + unsigned int DestIndex:8; + unsigned int WriteMask:1; + unsigned int OutputWriteMask:1; + unsigned int DepthWriteMask:1; + unsigned int Saturate:1; struct radeon_pair_instruction_source Src[3]; struct { - GLuint Source:2; - GLuint Swizzle:3; - GLuint Abs:1; - GLuint Negate:1; + unsigned int Source:2; + unsigned int Swizzle:3; + unsigned int Abs:1; + unsigned int Negate:1; } Arg[3]; }; @@ -92,16 +92,16 @@ enum { }; struct radeon_pair_texture_instruction { - GLuint Opcode:2; /**< one of RADEON_OPCODE_xxx */ + unsigned int Opcode:2; /**< one of RADEON_OPCODE_xxx */ - GLuint DestIndex:8; - GLuint WriteMask:4; + unsigned int DestIndex:8; + unsigned int WriteMask:4; - GLuint TexSrcUnit:5; - GLuint TexSrcTarget:3; + unsigned int TexSrcUnit:5; + unsigned int TexSrcTarget:3; - GLuint SrcIndex:8; - GLuint SrcSwizzle:12; + unsigned int SrcIndex:8; + unsigned int SrcSwizzle:12; }; @@ -112,24 +112,24 @@ struct radeon_pair_handler { /** * Write a paired instruction to the hardware. * - * @return GL_FALSE on error. + * @return 0 on error. */ - GLboolean (*EmitPaired)(void*, struct radeon_pair_instruction*); + int (*EmitPaired)(void*, struct radeon_pair_instruction*); /** * Write a texture instruction to the hardware. * Register indices have already been rewritten to the allocated * hardware register numbers. * - * @return GL_FALSE on error. + * @return 0 on error. */ - GLboolean (*EmitTex)(void*, struct radeon_pair_texture_instruction*); + int (*EmitTex)(void*, struct radeon_pair_texture_instruction*); /** * Called before a block of contiguous, independent texture * instructions is emitted. */ - GLboolean (*BeginTexBlock)(void*); + int (*BeginTexBlock)(void*); unsigned MaxHwTemps; }; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c index ea6ff03e61..588b9c0825 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c @@ -125,7 +125,7 @@ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler, */ static void rewriteFog(struct r300_fragment_program_compiler *compiler, struct r300_fragment_program * fp) { - struct prog_src_register src; + struct rc_src_register src; int i; if (!(compiler->Base.Program.InputsRead & FRAG_BIT_FOGC)) { @@ -142,7 +142,7 @@ static void rewriteFog(struct r300_fragment_program_compiler *compiler, struct r } memset(&src, 0, sizeof(src)); - src.File = PROGRAM_INPUT; + src.File = RC_FILE_INPUT; src.Index = fp->fog_attr; src.Swizzle = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_ZERO, SWIZZLE_ZERO, SWIZZLE_ONE); rc_move_input(&compiler->Base, FRAG_ATTRIB_FOGC, src); diff --git a/src/mesa/drivers/dri/r300/radeon_mesa_to_rc.c b/src/mesa/drivers/dri/r300/radeon_mesa_to_rc.c index 13b9d3541f..1e8fc3de4e 100644 --- a/src/mesa/drivers/dri/r300/radeon_mesa_to_rc.c +++ b/src/mesa/drivers/dri/r300/radeon_mesa_to_rc.c @@ -28,12 +28,153 @@ #include "radeon_mesa_to_rc.h" #include "main/mtypes.h" +#include "shader/prog_instruction.h" #include "shader/prog_parameter.h" #include "compiler/radeon_compiler.h" #include "compiler/radeon_program.h" +static rc_opcode translate_opcode(gl_inst_opcode opcode) +{ + switch(opcode) { + case OPCODE_NOP: return RC_OPCODE_NOP; + case OPCODE_ABS: return RC_OPCODE_ABS; + case OPCODE_ADD: return RC_OPCODE_ADD; + case OPCODE_ARL: return RC_OPCODE_ARL; + case OPCODE_CMP: return RC_OPCODE_CMP; + case OPCODE_COS: return RC_OPCODE_COS; + case OPCODE_DDX: return RC_OPCODE_DDX; + case OPCODE_DDY: return RC_OPCODE_DDY; + case OPCODE_DP3: return RC_OPCODE_DP3; + case OPCODE_DP4: return RC_OPCODE_DP4; + case OPCODE_DPH: return RC_OPCODE_DPH; + case OPCODE_DST: return RC_OPCODE_DST; + case OPCODE_EX2: return RC_OPCODE_EX2; + case OPCODE_EXP: return RC_OPCODE_EXP; + case OPCODE_FLR: return RC_OPCODE_FLR; + case OPCODE_FRC: return RC_OPCODE_FRC; + case OPCODE_KIL: return RC_OPCODE_KIL; + case OPCODE_LG2: return RC_OPCODE_LG2; + case OPCODE_LIT: return RC_OPCODE_LIT; + case OPCODE_LOG: return RC_OPCODE_LOG; + case OPCODE_LRP: return RC_OPCODE_LRP; + case OPCODE_MAD: return RC_OPCODE_MAD; + case OPCODE_MAX: return RC_OPCODE_MAX; + case OPCODE_MIN: return RC_OPCODE_MIN; + case OPCODE_MOV: return RC_OPCODE_MOV; + case OPCODE_MUL: return RC_OPCODE_MUL; + case OPCODE_POW: return RC_OPCODE_POW; + case OPCODE_RCP: return RC_OPCODE_RCP; + case OPCODE_RSQ: return RC_OPCODE_RSQ; + case OPCODE_SCS: return RC_OPCODE_SCS; + case OPCODE_SEQ: return RC_OPCODE_SEQ; + case OPCODE_SFL: return RC_OPCODE_SFL; + case OPCODE_SGE: return RC_OPCODE_SGE; + case OPCODE_SGT: return RC_OPCODE_SGT; + case OPCODE_SIN: return RC_OPCODE_SIN; + case OPCODE_SLE: return RC_OPCODE_SLE; + case OPCODE_SLT: return RC_OPCODE_SLT; + case OPCODE_SNE: return RC_OPCODE_SNE; + case OPCODE_SUB: return RC_OPCODE_SUB; + case OPCODE_SWZ: return RC_OPCODE_SWZ; + case OPCODE_TEX: return RC_OPCODE_TEX; + case OPCODE_TXB: return RC_OPCODE_TXB; + case OPCODE_TXD: return RC_OPCODE_TXD; + case OPCODE_TXL: return RC_OPCODE_TXL; + case OPCODE_TXP: return RC_OPCODE_TXP; + case OPCODE_XPD: return RC_OPCODE_XPD; + default: return RC_OPCODE_ILLEGAL_OPCODE; + } +} + +static rc_saturate_mode translate_saturate(unsigned int saturate) +{ + switch(saturate) { + default: + case SATURATE_OFF: return RC_SATURATE_NONE; + case SATURATE_ZERO_ONE: return RC_SATURATE_ZERO_ONE; + case SATURATE_PLUS_MINUS_ONE: return RC_SATURATE_MINUS_PLUS_ONE; + } +} + +static rc_register_file translate_register_file(unsigned int file) +{ + switch(file) { + case PROGRAM_TEMPORARY: return RC_FILE_TEMPORARY; + case PROGRAM_INPUT: return RC_FILE_INPUT; + case PROGRAM_OUTPUT: return RC_FILE_OUTPUT; + case PROGRAM_LOCAL_PARAM: + case PROGRAM_ENV_PARAM: + case PROGRAM_STATE_VAR: + case PROGRAM_NAMED_PARAM: + case PROGRAM_CONSTANT: + case PROGRAM_UNIFORM: return RC_FILE_CONSTANT; + case PROGRAM_ADDRESS: return RC_FILE_ADDRESS; + default: return RC_FILE_NONE; + } +} + +static void translate_srcreg(struct rc_src_register * dest, struct prog_src_register * src) +{ + dest->File = translate_register_file(src->File); + dest->Index = src->Index; + dest->RelAddr = src->RelAddr; + dest->Swizzle = src->Swizzle; + dest->Abs = src->Abs; + dest->Negate = src->Negate; +} + +static void translate_dstreg(struct rc_dst_register * dest, struct prog_dst_register * src) +{ + dest->File = translate_register_file(src->File); + dest->Index = src->Index; + dest->RelAddr = src->RelAddr; + dest->WriteMask = src->WriteMask; +} + +static rc_texture_target translate_tex_target(gl_texture_index target) +{ + switch(target) { + case TEXTURE_2D_ARRAY_INDEX: return RC_TEXTURE_2D_ARRAY; + case TEXTURE_1D_ARRAY_INDEX: return RC_TEXTURE_1D_ARRAY; + case TEXTURE_CUBE_INDEX: return RC_TEXTURE_CUBE; + case TEXTURE_3D_INDEX: return RC_TEXTURE_3D; + case TEXTURE_RECT_INDEX: return RC_TEXTURE_RECT; + default: + case TEXTURE_2D_INDEX: return RC_TEXTURE_2D; + case TEXTURE_1D_INDEX: return RC_TEXTURE_1D; + } +} + +static void translate_instruction(struct radeon_compiler * c, + struct rc_instruction * dest, struct prog_instruction * src) +{ + const struct rc_opcode_info * opcode; + unsigned int i; + + dest->I.Opcode = translate_opcode(src->Opcode); + if (dest->I.Opcode == RC_OPCODE_ILLEGAL_OPCODE) { + rc_error(c, "Unsupported opcode %i\n", src->Opcode); + return; + } + dest->I.SaturateMode = translate_saturate(src->SaturateMode); + + opcode = rc_get_opcode_info(dest->I.Opcode); + + for(i = 0; i < opcode->NumSrcRegs; ++i) + translate_srcreg(&dest->I.SrcReg[i], &src->SrcReg[i]); + + if (opcode->HasDstReg) + translate_dstreg(&dest->I.DstReg, &src->DstReg); + + if (opcode->HasTexture) { + dest->I.TexSrcUnit = src->TexSrcUnit; + dest->I.TexSrcTarget = translate_tex_target(src->TexSrcTarget); + dest->I.TexShadow = src->TexShadow; + } +} + void radeon_mesa_to_rc_program(struct radeon_compiler * c, struct gl_program * program) { struct prog_instruction *source; @@ -41,7 +182,7 @@ void radeon_mesa_to_rc_program(struct radeon_compiler * c, struct gl_program * p for(source = program->Instructions; source->Opcode != OPCODE_END; ++source) { struct rc_instruction * dest = rc_insert_new_instruction(c, c->Program.Instructions.Prev); - dest->I = *source; + translate_instruction(c, dest, source); } c->Program.ShadowSamplers = program->ShadowSamplers; -- cgit v1.2.3 From efff7aa980e78dc3ee1782308f0c9f3861c9992a Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 31 Aug 2009 16:43:39 -0700 Subject: NV fp: Add tracking for NV_fragment_program_option --- src/mesa/main/extensions.c | 1 + src/mesa/main/mtypes.h | 1 + 2 files changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 195fdde346..903da99ed0 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -162,6 +162,7 @@ static const struct { { ON, "GL_MESA_window_pos", F(ARB_window_pos) }, { OFF, "GL_NV_blend_square", F(NV_blend_square) }, { OFF, "GL_NV_fragment_program", F(NV_fragment_program) }, + { OFF, "GL_NV_fragment_program_option", F(NV_fragment_program_option) }, { ON, "GL_NV_light_max_exponent", F(NV_light_max_exponent) }, { OFF, "GL_NV_point_sprite", F(NV_point_sprite) }, { OFF, "GL_NV_texture_env_combine4", F(NV_texture_env_combine4) }, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 53dc6360ea..a99a25597f 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2553,6 +2553,7 @@ struct gl_extensions GLboolean MESA_texture_signed_rgba; GLboolean NV_blend_square; GLboolean NV_fragment_program; + GLboolean NV_fragment_program_option; GLboolean NV_light_max_exponent; GLboolean NV_point_sprite; GLboolean NV_texgen_reflection; -- cgit v1.2.3 From dc8ec05ace3d2a0284dbe47ec2d88168b1efb517 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 31 Aug 2009 16:57:49 -0700 Subject: NV fp: Parse 'OPTION NV_fragment_program' in ARB assembly shaders --- src/mesa/shader/program_parse_extra.c | 11 +++++++++++ src/mesa/shader/program_parser.h | 1 + 2 files changed, 12 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/program_parse_extra.c b/src/mesa/shader/program_parse_extra.c index 8e4be606f1..79e80c54d7 100644 --- a/src/mesa/shader/program_parse_extra.c +++ b/src/mesa/shader/program_parse_extra.c @@ -102,6 +102,17 @@ _mesa_ARBfp_parse_option(struct asm_parser_state *state, const char *option) return 1; } } + } else if (strncmp(option, "NV_fragment_program", 19) == 0) { + option += 19; + + /* Other NV_fragment_program strings may be supported later. + */ + if (option[0] == '\0') { + if (state->ctx->Extensions.NV_fragment_program_option) { + state->option.NV_fragment = 1; + return 1; + } + } } else if (strncmp(option, "MESA_", 5) == 0) { option += 5; diff --git a/src/mesa/shader/program_parser.h b/src/mesa/shader/program_parser.h index fa47d84565..be32a1bed1 100644 --- a/src/mesa/shader/program_parser.h +++ b/src/mesa/shader/program_parser.h @@ -202,6 +202,7 @@ struct asm_parser_state { unsigned Shadow:1; unsigned TexRect:1; unsigned TexArray:1; + unsigned NV_fragment:1; } option; struct { -- cgit v1.2.3 From ede0cd4d8c8eb8c6c443c84905138091944d69af Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 31 Aug 2009 17:00:31 -0700 Subject: NV fp lexer: Add new opcodes --- src/mesa/shader/lex.yy.c | 1766 ++++++++++++++++++++--------------- src/mesa/shader/program_lexer.l | 36 + src/mesa/shader/program_parse.tab.c | 671 ++++++------- src/mesa/shader/program_parse.tab.h | 171 ++-- src/mesa/shader/program_parse.y | 2 +- 5 files changed, 1455 insertions(+), 1191 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/lex.yy.c b/src/mesa/shader/lex.yy.c index 6d661bd187..5bde12a6b7 100644 --- a/src/mesa/shader/lex.yy.c +++ b/src/mesa/shader/lex.yy.c @@ -357,8 +357,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 183 -#define YY_END_OF_BUFFER 184 +#define YY_NUM_RULES 217 +#define YY_END_OF_BUFFER 218 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -366,82 +366,93 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[675] = +static yyconst flex_int16_t yy_accept[776] = { 0, - 0, 0, 184, 182, 180, 179, 182, 182, 152, 178, - 154, 154, 154, 154, 152, 152, 152, 152, 152, 152, - 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, - 152, 152, 152, 152, 180, 0, 0, 181, 152, 0, - 153, 155, 175, 175, 0, 0, 0, 0, 175, 0, - 0, 0, 0, 0, 0, 0, 132, 176, 133, 134, - 166, 166, 166, 166, 0, 154, 0, 140, 141, 142, - 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, - 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, - 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, - - 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, - 152, 152, 152, 152, 152, 152, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 174, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 173, 173, 0, 0, 0, + 0, 0, 218, 216, 214, 213, 216, 216, 186, 212, + 188, 188, 188, 188, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 214, 0, 0, 215, 186, + 0, 187, 189, 209, 209, 0, 0, 0, 0, 209, + 0, 0, 0, 0, 0, 0, 0, 166, 210, 167, + 168, 200, 200, 200, 200, 0, 188, 0, 174, 175, + 176, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 208, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 207, 207, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 172, 172, 172, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 163, 163, 163, 164, 164, 165, 156, - 155, 156, 0, 157, 11, 13, 152, 15, 152, 152, - 16, 18, 152, 20, 22, 24, 26, 6, 28, 30, - 31, 33, 35, 38, 36, 40, 41, 43, 45, 47, - - 49, 51, 152, 152, 152, 53, 55, 152, 57, 59, - 61, 152, 63, 65, 67, 69, 152, 71, 73, 75, - 77, 152, 152, 152, 152, 152, 152, 0, 0, 0, - 0, 155, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 93, 94, 96, 0, 171, 0, 0, 0, - 0, 0, 0, 110, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 170, 169, 169, 122, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 160, 160, - 161, 162, 0, 158, 152, 152, 152, 152, 152, 152, - 152, 152, 143, 152, 152, 152, 152, 152, 152, 152, - - 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, - 152, 152, 152, 144, 152, 152, 152, 152, 152, 152, - 152, 152, 10, 152, 152, 152, 152, 152, 152, 152, - 152, 152, 152, 0, 177, 0, 0, 0, 86, 87, - 0, 0, 0, 0, 0, 0, 0, 98, 0, 0, + 206, 206, 206, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 197, 197, 197, 198, 198, 199, 190, + 189, 190, 0, 191, 11, 13, 186, 15, 186, 186, + 16, 18, 186, 20, 22, 24, 26, 28, 30, 6, + + 32, 34, 35, 37, 39, 42, 40, 44, 45, 47, + 49, 51, 53, 55, 186, 186, 186, 186, 186, 65, + 67, 186, 69, 71, 73, 75, 77, 79, 81, 186, + 83, 85, 87, 89, 91, 93, 95, 186, 97, 99, + 101, 103, 186, 109, 111, 186, 186, 186, 186, 186, + 186, 0, 0, 0, 0, 189, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 127, 128, 130, 0, + 205, 0, 0, 0, 0, 0, 0, 144, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 204, 203, + 203, 156, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 194, 194, 195, 196, 0, 192, 186, 186, + 186, 186, 186, 186, 186, 186, 177, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 57, 186, 61, + 186, 186, 186, 178, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 10, + 186, 186, 186, 186, 105, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 0, 211, 0, 0, 0, 120, + 121, 0, 0, 0, 0, 0, 0, 0, 132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 168, 0, 0, 0, - 126, 0, 128, 0, 0, 0, 0, 0, 0, 167, - 159, 152, 152, 152, 4, 152, 152, 152, 152, 152, - 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, - - 152, 152, 152, 152, 152, 152, 9, 152, 152, 152, - 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, - 152, 152, 152, 152, 82, 152, 152, 0, 0, 0, - 0, 0, 88, 89, 0, 0, 0, 0, 97, 0, - 0, 101, 104, 0, 0, 0, 0, 0, 0, 0, - 115, 116, 0, 0, 0, 0, 121, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 152, 152, 152, - 152, 152, 152, 5, 152, 152, 152, 152, 152, 152, - 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, - 152, 7, 8, 152, 152, 152, 152, 152, 152, 152, - - 152, 152, 152, 152, 152, 152, 152, 152, 152, 83, - 152, 79, 0, 0, 0, 0, 137, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 107, 0, 111, 112, - 0, 114, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 130, 131, 0, 0, 138, 12, 3, 14, - 148, 149, 152, 17, 19, 21, 23, 25, 27, 29, - 32, 34, 39, 37, 42, 44, 46, 48, 50, 52, - 54, 56, 58, 60, 62, 152, 152, 152, 64, 66, - 68, 70, 72, 74, 76, 78, 152, 81, 139, 0, - 0, 84, 0, 90, 0, 0, 0, 99, 0, 0, - - 0, 0, 0, 0, 113, 0, 0, 119, 106, 0, - 0, 0, 0, 0, 0, 135, 0, 152, 145, 146, - 152, 80, 0, 0, 0, 0, 92, 95, 100, 0, - 0, 105, 0, 0, 0, 118, 0, 0, 0, 0, - 127, 129, 0, 152, 152, 2, 1, 0, 91, 0, - 103, 0, 109, 117, 0, 0, 124, 125, 136, 152, - 147, 0, 102, 0, 120, 123, 152, 85, 108, 152, - 152, 150, 151, 0 + + 0, 0, 0, 0, 0, 0, 0, 202, 0, 0, + 0, 160, 0, 162, 0, 0, 0, 0, 0, 0, + 201, 193, 186, 186, 186, 4, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 9, + 186, 59, 186, 63, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 107, 186, 186, 186, + 186, 186, 116, 186, 186, 0, 0, 0, 0, 0, + 122, 123, 0, 0, 0, 0, 131, 0, 0, 135, + + 138, 0, 0, 0, 0, 0, 0, 0, 149, 150, + 0, 0, 0, 0, 155, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 186, 186, 186, 186, 186, + 186, 5, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 7, 8, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, + 186, 186, 186, 186, 117, 186, 113, 0, 0, 0, + 0, 171, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 141, 0, 145, 146, 0, 148, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 164, 165, 0, + 0, 172, 12, 3, 14, 182, 183, 186, 17, 19, + 21, 23, 25, 27, 29, 31, 33, 36, 38, 43, + 41, 46, 48, 50, 52, 54, 56, 186, 186, 186, + 186, 66, 68, 70, 72, 74, 76, 78, 80, 82, + 186, 186, 186, 84, 86, 88, 90, 92, 94, 96, + 98, 100, 102, 104, 186, 186, 110, 112, 186, 115, + 173, 0, 0, 118, 0, 124, 0, 0, 0, 133, + 0, 0, 0, 0, 0, 0, 147, 0, 0, 153, + + 140, 0, 0, 0, 0, 0, 0, 169, 0, 186, + 58, 186, 62, 186, 179, 180, 186, 106, 186, 114, + 0, 0, 0, 0, 126, 129, 134, 0, 0, 139, + 0, 0, 0, 152, 0, 0, 0, 0, 161, 163, + 0, 186, 60, 64, 186, 108, 2, 1, 0, 125, + 0, 137, 0, 143, 151, 0, 0, 158, 159, 170, + 186, 181, 0, 136, 0, 154, 157, 186, 119, 142, + 186, 186, 184, 185, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -487,280 +498,313 @@ static yyconst flex_int32_t yy_meta[68] = 2, 2, 2, 2, 2, 2, 2 } ; -static yyconst flex_int16_t yy_base[678] = +static yyconst flex_int16_t yy_base[779] = { 0, - 0, 0, 954, 955, 66, 955, 948, 949, 0, 69, - 85, 128, 140, 152, 151, 58, 39, 48, 75, 927, - 158, 160, 73, 59, 71, 170, 54, 920, 890, 889, - 901, 885, 899, 898, 142, 927, 939, 955, 0, 206, - 955, 189, 168, 171, 53, 27, 66, 119, 175, 899, - 885, 123, 170, 883, 895, 183, 955, 198, 225, 99, - 212, 219, 223, 227, 285, 297, 308, 955, 955, 955, - 904, 917, 911, 165, 900, 903, 899, 914, 224, 896, - 910, 194, 896, 909, 900, 913, 890, 901, 892, 294, - 893, 884, 893, 884, 883, 884, 878, 884, 895, 881, - - 878, 890, 893, 880, 873, 889, 865, 193, 139, 885, - 861, 846, 841, 858, 834, 839, 865, 167, 854, 259, - 849, 325, 282, 851, 832, 302, 842, 838, 833, 43, - 839, 825, 841, 838, 829, 305, 309, 831, 820, 834, - 837, 819, 834, 821, 818, 825, 275, 833, 254, 299, - 317, 327, 331, 810, 827, 828, 821, 803, 310, 804, - 826, 817, 316, 327, 331, 335, 339, 343, 347, 955, - 405, 416, 422, 428, 825, 240, 849, 0, 848, 831, - 821, 820, 840, 818, 817, 816, 815, 0, 814, 0, - 813, 812, 0, 811, 810, 0, 809, 808, 807, 806, - - 805, 804, 820, 813, 826, 800, 799, 805, 797, 796, - 795, 816, 793, 792, 791, 790, 800, 788, 787, 786, - 785, 777, 776, 761, 761, 760, 759, 802, 774, 762, - 434, 442, 416, 766, 186, 763, 757, 757, 751, 764, - 764, 749, 955, 955, 764, 752, 418, 759, 281, 756, - 762, 308, 757, 955, 748, 755, 754, 757, 743, 742, - 746, 741, 278, 746, 420, 428, 430, 955, 738, 736, - 736, 744, 745, 727, 421, 732, 738, 419, 426, 430, - 434, 438, 496, 502, 752, 764, 750, 749, 742, 756, - 746, 745, 0, 744, 743, 742, 741, 740, 739, 738, - - 737, 736, 735, 734, 733, 732, 731, 730, 733, 726, - 733, 726, 725, 0, 724, 723, 722, 725, 720, 719, - 718, 717, 0, 716, 715, 714, 713, 691, 685, 690, - 696, 679, 694, 315, 955, 693, 683, 687, 955, 955, - 677, 686, 672, 689, 672, 675, 669, 955, 670, 669, - 666, 673, 666, 674, 670, 680, 677, 659, 665, 672, - 656, 655, 673, 655, 667, 666, 955, 665, 655, 659, - 955, 646, 955, 651, 651, 659, 642, 643, 653, 955, - 955, 685, 667, 683, 0, 507, 681, 681, 680, 679, - 678, 677, 676, 675, 674, 673, 672, 671, 670, 669, - - 668, 667, 666, 665, 652, 645, 0, 662, 661, 660, - 659, 658, 636, 656, 655, 654, 653, 652, 651, 650, - 649, 618, 621, 601, 0, 602, 595, 602, 601, 602, - 594, 612, 955, 955, 594, 592, 602, 595, 955, 590, - 607, 330, 955, 598, 582, 583, 592, 583, 582, 582, - 955, 581, 590, 580, 596, 593, 955, 592, 590, 579, - 580, 576, 568, 575, 570, 571, 566, 592, 592, 590, - 604, 603, 598, 0, 586, 585, 584, 583, 582, 581, - 580, 579, 578, 577, 576, 575, 574, 573, 572, 571, - 570, 0, 0, 569, 568, 567, 566, 565, 509, 564, - - 563, 562, 561, 560, 559, 558, 557, 535, 535, 0, - 542, 0, 576, 575, 524, 542, 955, 537, 532, 525, - 521, 533, 523, 521, 517, 533, 524, 523, 955, 955, - 526, 955, 521, 514, 503, 514, 506, 510, 523, 518, - 521, 503, 955, 955, 515, 504, 955, 0, 0, 0, - 0, 0, 543, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 1054, 1055, 66, 1055, 1048, 1049, 0, 69, + 85, 128, 140, 152, 151, 58, 56, 63, 76, 1027, + 158, 160, 39, 163, 173, 189, 52, 1020, 76, 990, + 989, 1001, 985, 999, 998, 105, 1027, 1039, 1055, 0, + 225, 1055, 218, 160, 157, 20, 123, 66, 119, 192, + 999, 985, 54, 162, 983, 995, 194, 1055, 200, 195, + 98, 227, 196, 231, 235, 293, 305, 316, 1055, 1055, + 1055, 1004, 1017, 1011, 223, 1000, 1003, 999, 1014, 107, + 298, 996, 1010, 246, 996, 1009, 1000, 1013, 990, 1001, + 992, 182, 993, 984, 993, 984, 983, 984, 144, 978, + + 984, 995, 986, 980, 977, 978, 982, 289, 991, 978, + 302, 985, 972, 986, 962, 65, 315, 989, 981, 980, + 956, 941, 936, 953, 929, 934, 960, 279, 949, 293, + 944, 342, 299, 946, 927, 317, 937, 933, 928, 207, + 934, 920, 936, 933, 924, 320, 324, 926, 915, 929, + 932, 914, 929, 916, 913, 920, 284, 928, 227, 288, + 327, 342, 345, 905, 922, 923, 916, 898, 318, 899, + 921, 912, 330, 341, 345, 349, 353, 357, 361, 1055, + 419, 430, 436, 442, 920, 205, 944, 0, 943, 926, + 916, 915, 935, 913, 912, 911, 910, 909, 908, 0, + + 907, 0, 906, 905, 0, 904, 903, 0, 902, 901, + 900, 899, 898, 897, 913, 906, 919, 354, 356, 893, + 892, 898, 890, 889, 888, 887, 886, 885, 884, 905, + 882, 881, 880, 879, 878, 877, 876, 886, 874, 873, + 872, 871, 357, 870, 869, 861, 860, 845, 845, 844, + 843, 886, 858, 846, 448, 456, 430, 850, 418, 847, + 841, 841, 835, 848, 848, 833, 1055, 1055, 848, 836, + 432, 843, 135, 840, 846, 433, 841, 1055, 832, 839, + 838, 841, 827, 826, 830, 825, 330, 830, 439, 442, + 451, 1055, 822, 820, 820, 828, 829, 811, 456, 816, + + 822, 441, 447, 454, 458, 462, 520, 526, 836, 848, + 834, 833, 826, 840, 830, 829, 0, 828, 827, 826, + 825, 824, 823, 822, 821, 820, 819, 818, 817, 816, + 815, 814, 813, 812, 815, 808, 815, 800, 807, 798, + 821, 804, 803, 0, 802, 801, 800, 799, 798, 797, + 796, 799, 794, 793, 792, 791, 790, 789, 788, 0, + 787, 786, 785, 784, 775, 782, 781, 780, 758, 752, + 757, 763, 746, 761, 495, 1055, 760, 750, 754, 1055, + 1055, 744, 753, 739, 756, 739, 742, 736, 1055, 737, + 736, 733, 740, 733, 741, 737, 747, 744, 726, 732, + + 739, 723, 722, 740, 722, 734, 733, 1055, 732, 722, + 726, 1055, 713, 1055, 718, 718, 726, 709, 710, 720, + 1055, 1055, 752, 734, 750, 0, 532, 748, 748, 747, + 746, 745, 744, 743, 742, 741, 740, 739, 738, 737, + 736, 735, 734, 733, 732, 731, 730, 717, 710, 0, + 710, 701, 708, 699, 723, 722, 721, 720, 719, 718, + 717, 716, 715, 693, 713, 712, 711, 710, 709, 708, + 707, 706, 705, 704, 703, 685, 676, 700, 699, 668, + 671, 651, 0, 652, 645, 652, 651, 652, 644, 662, + 1055, 1055, 644, 642, 652, 645, 1055, 640, 657, 345, + + 1055, 648, 632, 633, 642, 633, 632, 632, 1055, 631, + 640, 630, 646, 643, 1055, 642, 640, 629, 630, 626, + 618, 625, 620, 621, 616, 642, 642, 640, 654, 653, + 648, 0, 636, 635, 634, 633, 632, 631, 630, 629, + 628, 627, 626, 625, 624, 623, 622, 621, 620, 619, + 618, 0, 0, 635, 617, 633, 615, 613, 612, 611, + 610, 609, 608, 607, 606, 605, 484, 604, 603, 602, + 601, 600, 599, 598, 597, 596, 595, 594, 611, 593, + 591, 590, 568, 568, 0, 575, 0, 609, 608, 557, + 575, 1055, 570, 565, 558, 554, 566, 556, 554, 550, + + 566, 557, 556, 1055, 1055, 559, 1055, 554, 547, 536, + 547, 539, 543, 556, 551, 554, 536, 1055, 1055, 548, + 537, 1055, 0, 0, 0, 0, 0, 576, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 539, 538, 536, 0, 0, - 0, 0, 0, 0, 0, 0, 494, 0, 0, 545, - 544, 955, 491, 955, 495, 495, 504, 955, 488, 502, - - 483, 485, 482, 490, 955, 468, 479, 955, 955, 483, - 479, 472, 470, 470, 483, 955, 467, 507, 0, 0, - 507, 0, 514, 513, 472, 433, 955, 955, 955, 435, - 435, 955, 429, 386, 377, 955, 366, 365, 323, 328, - 955, 955, 339, 348, 337, 955, 955, 307, 955, 305, - 955, 257, 955, 955, 247, 221, 955, 955, 955, 236, - 0, 213, 955, 150, 955, 955, 232, 955, 955, 162, - 138, 0, 0, 955, 541, 108, 544 + 0, 0, 0, 0, 0, 0, 0, 557, 574, 555, + 572, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 568, 567, 565, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 550, 567, 0, 0, 521, 0, + 0, 572, 571, 1055, 518, 1055, 522, 522, 531, 1055, + 515, 529, 517, 519, 516, 518, 1055, 496, 507, 1055, + + 1055, 511, 507, 500, 497, 497, 510, 1055, 494, 534, + 0, 518, 0, 517, 0, 0, 532, 0, 515, 0, + 67, 187, 172, 202, 1055, 1055, 1055, 219, 243, 1055, + 245, 246, 300, 1055, 292, 315, 332, 340, 1055, 1055, + 357, 406, 0, 0, 402, 0, 1055, 1055, 381, 1055, + 423, 1055, 437, 1055, 1055, 431, 429, 1055, 1055, 1055, + 460, 0, 448, 1055, 444, 1055, 1055, 534, 1055, 1055, + 496, 528, 0, 0, 1055, 565, 546, 568 } ; -static yyconst flex_int16_t yy_def[678] = +static yyconst flex_int16_t yy_def[779] = { 0, - 674, 1, 674, 674, 674, 674, 674, 675, 676, 674, - 674, 674, 674, 674, 676, 676, 676, 676, 676, 676, - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - 676, 676, 676, 676, 674, 674, 675, 674, 676, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 677, 674, 674, 674, 674, 674, - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - 676, 676, 676, 676, 676, 676, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 676, 676, 676, 676, 676, 676, - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - 676, 676, 676, 676, 676, 676, 676, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 676, 676, 676, 676, 676, 676, - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - 676, 676, 676, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 676, 676, 676, 676, 676, 676, 676, 676, 676, - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - 676, 676, 676, 676, 676, 676, 676, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 676, 676, 676, - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - 676, 676, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 676, 676, 676, - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - 676, 676, 676, 676, 676, 676, 676, 676, 676, 676, - 676, 676, 676, 676, 676, 676, 676, 676, 676, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 676, 676, 676, - 676, 676, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 676, 676, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 676, - 676, 674, 674, 674, 674, 674, 676, 674, 674, 676, - 676, 676, 676, 0, 674, 674, 674 + 775, 1, 775, 775, 775, 775, 775, 776, 777, 775, + 775, 775, 775, 775, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 775, 775, 776, 775, 777, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 778, 775, 775, 775, 775, + 775, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + + 775, 775, 775, 775, 775, 775, 775, 775, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 777, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + + 775, 775, 775, 775, 775, 775, 775, 775, 775, 777, + 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 777, 777, 777, 777, 777, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 777, 777, 775, 775, 775, 775, 775, 777, 775, 775, + 777, 777, 777, 777, 0, 775, 775, 775 } ; -static yyconst flex_int16_t yy_nxt[1023] = +static yyconst flex_int16_t yy_nxt[1123] = { 0, 4, 5, 6, 5, 7, 8, 9, 4, 10, 11, 12, 13, 14, 11, 11, 15, 9, 16, 17, 18, 19, 9, 9, 9, 20, 21, 22, 9, 23, 24, - 9, 25, 26, 27, 9, 9, 9, 28, 9, 9, - 9, 9, 9, 9, 9, 9, 29, 9, 9, 9, - 9, 9, 9, 9, 9, 9, 30, 9, 31, 32, - 33, 9, 34, 9, 9, 9, 9, 35, 79, 35, - 40, 80, 129, 108, 96, 81, 130, 41, 42, 42, - 42, 42, 42, 42, 76, 82, 77, 97, 98, 240, - 99, 109, 78, 65, 66, 66, 66, 66, 66, 66, - - 83, 241, 94, 100, 67, 127, 84, 95, 128, 39, - 43, 44, 45, 46, 47, 48, 49, 50, 51, 131, - 132, 52, 53, 54, 55, 56, 57, 58, 59, 60, - 67, 133, 61, 62, 63, 64, 65, 66, 66, 66, - 66, 66, 66, 35, 160, 35, 68, 67, 65, 66, - 66, 66, 66, 66, 66, 219, 673, 161, 69, 67, - 65, 66, 66, 66, 66, 66, 66, 71, 220, 72, - 70, 67, 140, 67, 134, 90, 73, 135, 141, 86, - 672, 87, 74, 91, 75, 67, 88, 101, 92, 89, - 178, 102, 103, 104, 93, 105, 179, 67, 42, 42, - - 42, 42, 42, 42, 106, 189, 107, 40, 122, 123, - 123, 142, 126, 123, 669, 123, 136, 137, 123, 217, - 124, 124, 123, 190, 147, 143, 123, 125, 125, 123, - 218, 337, 144, 123, 122, 148, 184, 185, 149, 151, - 152, 150, 670, 671, 338, 153, 186, 118, 119, 45, - 46, 47, 48, 154, 50, 51, 123, 162, 52, 53, - 54, 55, 56, 57, 120, 59, 60, 668, 155, 121, - 156, 286, 667, 157, 158, 163, 163, 163, 163, 666, - 287, 159, 164, 163, 165, 166, 167, 163, 163, 168, - 169, 163, 163, 163, 171, 171, 171, 171, 171, 171, - - 230, 665, 664, 260, 172, 65, 66, 66, 66, 66, - 66, 66, 198, 261, 154, 173, 67, 174, 174, 174, - 174, 174, 174, 233, 233, 364, 349, 257, 365, 233, - 172, 199, 231, 258, 232, 232, 232, 232, 232, 232, - 233, 350, 67, 233, 233, 236, 233, 233, 262, 233, - 247, 233, 233, 353, 263, 273, 233, 663, 233, 233, - 233, 428, 662, 233, 233, 274, 354, 233, 265, 233, - 661, 264, 266, 267, 233, 233, 660, 429, 233, 278, - 278, 278, 278, 524, 659, 233, 525, 658, 657, 233, - 278, 278, 278, 278, 279, 278, 278, 280, 281, 278, - - 278, 278, 278, 278, 278, 278, 282, 278, 278, 278, - 278, 278, 278, 278, 42, 42, 42, 42, 42, 42, - 656, 655, 654, 283, 122, 284, 284, 284, 284, 284, - 284, 174, 174, 174, 174, 174, 174, 174, 174, 174, - 174, 174, 174, 232, 232, 232, 232, 232, 232, 653, - 122, 232, 232, 232, 232, 232, 232, 335, 335, 335, - 335, 335, 335, 335, 374, 335, 375, 335, 376, 335, - 335, 367, 335, 652, 335, 335, 335, 335, 335, 651, - 650, 377, 380, 380, 380, 380, 335, 649, 335, 380, - 380, 380, 380, 381, 380, 380, 380, 380, 380, 380, - - 380, 380, 380, 380, 380, 284, 284, 284, 284, 284, - 284, 284, 284, 284, 284, 284, 284, 471, 472, 576, - 577, 648, 647, 646, 645, 644, 643, 642, 641, 640, - 639, 638, 637, 636, 635, 634, 633, 632, 631, 473, - 578, 37, 37, 37, 170, 170, 630, 629, 628, 627, - 626, 625, 624, 623, 622, 621, 620, 619, 618, 617, - 616, 615, 614, 613, 612, 611, 610, 609, 608, 607, - 606, 605, 604, 603, 602, 601, 600, 599, 598, 597, + 9, 25, 26, 27, 28, 9, 9, 29, 9, 9, + 9, 9, 9, 9, 9, 9, 30, 9, 9, 9, + 9, 9, 9, 9, 9, 9, 31, 9, 32, 33, + 34, 9, 35, 9, 9, 9, 9, 36, 96, 36, + 41, 116, 137, 97, 80, 138, 747, 42, 43, 43, + 43, 43, 43, 43, 77, 81, 78, 119, 82, 117, + 83, 238, 79, 66, 67, 67, 67, 67, 67, 67, + + 84, 85, 239, 150, 68, 120, 36, 86, 36, 151, + 44, 45, 46, 47, 48, 49, 50, 51, 52, 141, + 142, 53, 54, 55, 56, 57, 58, 59, 60, 61, + 68, 143, 62, 63, 64, 65, 66, 67, 67, 67, + 67, 67, 67, 170, 194, 195, 69, 68, 66, 67, + 67, 67, 67, 67, 67, 218, 171, 219, 70, 68, + 66, 67, 67, 67, 67, 67, 67, 72, 139, 73, + 71, 68, 140, 68, 144, 92, 74, 145, 98, 88, + 390, 89, 75, 93, 76, 68, 90, 99, 94, 91, + 101, 100, 102, 103, 95, 391, 748, 68, 136, 133, + + 210, 133, 133, 152, 133, 104, 105, 133, 106, 107, + 108, 109, 110, 134, 111, 133, 112, 153, 133, 211, + 135, 749, 113, 114, 154, 115, 41, 43, 43, 43, + 43, 43, 43, 146, 147, 157, 310, 132, 165, 133, + 166, 161, 162, 167, 168, 311, 158, 163, 188, 159, + 133, 169, 160, 264, 189, 164, 750, 201, 133, 174, + 173, 175, 176, 132, 751, 265, 128, 129, 46, 47, + 48, 49, 172, 51, 52, 202, 284, 53, 54, 55, + 56, 57, 58, 130, 60, 61, 285, 752, 131, 753, + 173, 173, 173, 173, 177, 173, 173, 178, 179, 173, + + 173, 173, 181, 181, 181, 181, 181, 181, 228, 754, + 196, 197, 182, 66, 67, 67, 67, 67, 67, 67, + 198, 232, 229, 183, 68, 184, 184, 184, 184, 184, + 184, 240, 134, 241, 254, 233, 281, 286, 182, 135, + 257, 257, 282, 287, 242, 755, 257, 756, 164, 255, + 68, 256, 256, 256, 256, 256, 256, 257, 257, 257, + 260, 257, 257, 297, 257, 271, 257, 257, 257, 257, + 757, 257, 340, 298, 257, 257, 338, 405, 257, 365, + 406, 288, 257, 289, 257, 257, 290, 291, 339, 257, + 341, 366, 257, 302, 302, 302, 302, 758, 599, 759, + + 257, 600, 760, 257, 302, 302, 302, 302, 303, 302, + 302, 304, 305, 302, 302, 302, 302, 302, 302, 302, + 306, 302, 302, 302, 302, 302, 302, 302, 43, 43, + 43, 43, 43, 43, 761, 762, 763, 307, 132, 308, + 308, 308, 308, 308, 308, 184, 184, 184, 184, 184, + 184, 184, 184, 184, 184, 184, 184, 256, 256, 256, + 256, 256, 256, 378, 132, 256, 256, 256, 256, 256, + 256, 376, 376, 376, 376, 764, 379, 376, 394, 376, + 376, 376, 765, 376, 376, 766, 376, 767, 376, 376, + 376, 395, 408, 376, 661, 662, 768, 376, 376, 415, + + 376, 416, 769, 417, 421, 421, 421, 421, 770, 376, + 421, 421, 421, 421, 773, 663, 418, 422, 421, 421, + 421, 421, 421, 421, 421, 421, 421, 421, 421, 308, + 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, + 308, 486, 529, 530, 771, 772, 774, 40, 746, 745, + 744, 743, 742, 741, 740, 739, 738, 487, 737, 736, + 735, 734, 733, 732, 531, 38, 38, 38, 180, 180, + 731, 730, 729, 728, 727, 726, 725, 724, 723, 722, + 721, 720, 719, 718, 717, 716, 715, 714, 713, 712, + 711, 710, 709, 708, 707, 706, 705, 704, 703, 702, + + 701, 700, 699, 698, 697, 696, 695, 694, 693, 692, + 691, 690, 689, 688, 687, 686, 685, 684, 683, 682, + 681, 680, 679, 678, 677, 676, 675, 674, 673, 672, + 671, 670, 669, 668, 667, 666, 665, 664, 660, 659, + 658, 657, 656, 655, 654, 653, 652, 651, 650, 649, + 648, 647, 646, 645, 644, 643, 642, 641, 640, 639, + 638, 637, 636, 635, 634, 633, 632, 631, 630, 629, + 628, 627, 626, 625, 624, 623, 622, 621, 620, 619, + 618, 617, 616, 615, 614, 613, 612, 611, 610, 609, + 608, 607, 606, 605, 604, 603, 602, 601, 598, 597, + 596, 595, 594, 593, 592, 591, 590, 589, 588, 587, - 586, 585, 584, 583, 582, 581, 580, 579, 575, 574, - - 573, 572, 571, 570, 569, 568, 567, 566, 565, 564, - 563, 562, 561, 560, 559, 558, 557, 556, 555, 554, - 553, 552, 551, 550, 549, 548, 547, 546, 545, 544, - 543, 542, 541, 540, 539, 538, 537, 536, 535, 534, - 533, 532, 531, 530, 529, 528, 527, 526, 523, 522, - 521, 520, 519, 518, 517, 516, 515, 514, 513, 512, - 511, 510, 509, 508, 507, 506, 505, 504, 503, 502, - 501, 500, 499, 498, 497, 496, 495, 494, 493, 492, - 491, 490, 489, 488, 487, 486, 485, 484, 483, 482, - 481, 480, 479, 478, 477, 476, 475, 474, 470, 469, - - 468, 467, 466, 465, 464, 463, 462, 461, 460, 459, - 458, 457, 456, 455, 454, 453, 452, 451, 450, 449, - 448, 447, 446, 445, 444, 443, 442, 441, 440, 439, - 438, 437, 436, 435, 434, 433, 432, 431, 430, 427, - 426, 425, 424, 423, 422, 421, 420, 419, 418, 417, - 416, 415, 414, 413, 412, 411, 410, 409, 408, 407, - 406, 405, 404, 403, 402, 401, 400, 399, 398, 397, - 396, 395, 394, 393, 392, 391, 390, 389, 388, 387, - 386, 385, 384, 383, 382, 379, 378, 373, 372, 371, - 370, 369, 368, 366, 363, 362, 361, 360, 359, 358, - - 357, 356, 355, 352, 351, 348, 347, 346, 345, 344, - 343, 342, 341, 340, 339, 336, 264, 236, 334, 333, - 332, 331, 330, 329, 328, 327, 326, 325, 324, 323, - 322, 321, 320, 319, 318, 317, 316, 315, 314, 313, - 312, 311, 310, 309, 308, 307, 306, 305, 304, 303, - 302, 301, 300, 299, 298, 297, 296, 295, 294, 293, - 292, 291, 290, 289, 288, 285, 277, 276, 275, 272, - 271, 270, 269, 268, 259, 256, 255, 254, 253, 252, - 251, 250, 249, 248, 246, 245, 244, 243, 242, 239, - 238, 237, 235, 234, 162, 229, 228, 227, 226, 225, - - 224, 223, 222, 221, 216, 215, 214, 213, 212, 211, - 210, 209, 208, 207, 206, 205, 204, 203, 202, 201, - 200, 197, 196, 195, 194, 193, 192, 191, 188, 187, - 183, 182, 181, 180, 177, 176, 175, 146, 145, 139, - 138, 38, 117, 116, 115, 114, 113, 112, 111, 110, - 85, 38, 36, 674, 3, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674 + 586, 585, 584, 583, 582, 581, 580, 579, 578, 577, + 576, 575, 574, 573, 572, 571, 570, 569, 568, 567, + 566, 565, 564, 563, 562, 561, 560, 559, 558, 557, + 556, 555, 554, 553, 552, 551, 550, 549, 548, 547, + 546, 545, 544, 543, 542, 541, 540, 539, 538, 537, + 536, 535, 534, 533, 532, 528, 527, 526, 525, 524, + 523, 522, 521, 520, 519, 518, 517, 516, 515, 514, + 513, 512, 511, 510, 509, 508, 507, 506, 505, 504, + 503, 502, 501, 500, 499, 498, 497, 496, 495, 494, + + 493, 492, 491, 490, 489, 488, 485, 484, 483, 482, + 481, 480, 479, 478, 477, 476, 475, 474, 473, 472, + 471, 470, 469, 468, 467, 466, 465, 464, 463, 462, + 461, 460, 459, 458, 457, 456, 455, 454, 453, 452, + 451, 450, 449, 448, 447, 446, 445, 444, 443, 442, + 441, 440, 439, 438, 437, 436, 435, 434, 433, 432, + 431, 430, 429, 428, 427, 426, 425, 424, 423, 420, + 419, 414, 413, 412, 411, 410, 409, 407, 404, 403, + 402, 401, 400, 399, 398, 397, 396, 393, 392, 389, + 388, 387, 386, 385, 384, 383, 382, 381, 380, 377, + + 288, 260, 375, 374, 373, 372, 371, 370, 369, 368, + 367, 364, 363, 362, 361, 360, 359, 358, 357, 356, + 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, + 345, 344, 343, 342, 337, 336, 335, 334, 333, 332, + 331, 330, 329, 328, 327, 326, 325, 324, 323, 322, + 321, 320, 319, 318, 317, 316, 315, 314, 313, 312, + 309, 301, 300, 299, 296, 295, 294, 293, 292, 283, + 280, 279, 278, 277, 276, 275, 274, 273, 272, 270, + 269, 268, 267, 266, 263, 262, 261, 259, 258, 172, + 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, + + 243, 237, 236, 235, 234, 231, 230, 227, 226, 225, + 224, 223, 222, 221, 220, 217, 216, 215, 214, 213, + 212, 209, 208, 207, 206, 205, 204, 203, 200, 199, + 193, 192, 191, 190, 187, 186, 185, 156, 155, 149, + 148, 39, 127, 126, 125, 124, 123, 122, 121, 118, + 87, 39, 37, 775, 3, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775 } ; -static yyconst flex_int16_t yy_chk[1023] = +static yyconst flex_int16_t yy_chk[1123] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -768,113 +812,124 @@ static yyconst flex_int16_t yy_chk[1023] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 5, 17, 5, - 10, 17, 46, 27, 24, 18, 46, 10, 10, 10, - 10, 10, 10, 10, 16, 18, 16, 24, 25, 130, - 25, 27, 16, 11, 11, 11, 11, 11, 11, 11, - - 19, 130, 23, 25, 11, 45, 19, 23, 45, 676, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 47, - 47, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 11, 47, 10, 10, 10, 10, 12, 12, 12, 12, - 12, 12, 12, 35, 60, 35, 12, 12, 13, 13, - 13, 13, 13, 13, 13, 109, 671, 60, 13, 13, - 14, 14, 14, 14, 14, 14, 14, 15, 109, 15, - 14, 14, 52, 12, 48, 22, 15, 48, 52, 21, - 670, 21, 15, 22, 15, 13, 21, 26, 22, 21, - 74, 26, 26, 26, 22, 26, 74, 14, 42, 42, - - 42, 42, 42, 42, 26, 82, 26, 40, 42, 43, - 43, 53, 44, 44, 664, 43, 49, 49, 44, 108, - 118, 43, 49, 82, 56, 53, 43, 118, 43, 44, - 108, 235, 53, 49, 42, 56, 79, 79, 56, 58, - 58, 56, 667, 667, 235, 58, 79, 40, 40, 40, - 40, 40, 40, 58, 40, 40, 58, 61, 40, 40, - 40, 40, 40, 40, 40, 40, 40, 662, 59, 40, - 59, 176, 660, 59, 59, 61, 61, 61, 61, 656, - 176, 59, 62, 62, 62, 62, 63, 63, 63, 63, - 64, 64, 64, 64, 65, 65, 65, 65, 65, 65, - - 120, 655, 652, 149, 65, 66, 66, 66, 66, 66, - 66, 66, 90, 149, 120, 67, 66, 67, 67, 67, - 67, 67, 67, 123, 123, 263, 249, 147, 263, 123, - 65, 90, 122, 147, 122, 122, 122, 122, 122, 122, - 123, 249, 66, 126, 126, 126, 136, 136, 150, 126, - 137, 137, 136, 252, 150, 159, 137, 650, 151, 151, - 126, 334, 648, 136, 151, 159, 252, 137, 152, 152, - 645, 151, 153, 153, 152, 151, 644, 334, 153, 163, - 163, 163, 163, 442, 643, 152, 442, 640, 639, 153, - 164, 164, 164, 164, 165, 165, 165, 165, 166, 166, - - 166, 166, 167, 167, 167, 167, 168, 168, 168, 168, - 169, 169, 169, 169, 171, 171, 171, 171, 171, 171, - 638, 637, 635, 172, 171, 172, 172, 172, 172, 172, - 172, 173, 173, 173, 173, 173, 173, 174, 174, 174, - 174, 174, 174, 231, 231, 231, 231, 231, 231, 634, - 171, 232, 232, 232, 232, 232, 232, 233, 233, 247, - 247, 265, 265, 233, 275, 247, 275, 265, 275, 266, - 266, 267, 267, 633, 233, 266, 247, 267, 265, 631, - 630, 275, 278, 278, 278, 278, 266, 626, 267, 279, - 279, 279, 279, 280, 280, 280, 280, 281, 281, 281, - - 281, 282, 282, 282, 282, 283, 283, 283, 283, 283, - 283, 284, 284, 284, 284, 284, 284, 386, 386, 499, - 499, 625, 624, 623, 621, 618, 617, 615, 614, 613, - 612, 611, 610, 607, 606, 604, 603, 602, 601, 386, - 499, 675, 675, 675, 677, 677, 600, 599, 597, 596, - 595, 593, 591, 590, 587, 578, 577, 576, 553, 546, - 545, 542, 541, 540, 539, 538, 537, 536, 535, 534, - 533, 531, 528, 527, 526, 525, 524, 523, 522, 521, - 520, 519, 518, 516, 515, 514, 513, 511, 509, 508, - 507, 506, 505, 504, 503, 502, 501, 500, 498, 497, - - 496, 495, 494, 491, 490, 489, 488, 487, 486, 485, - 484, 483, 482, 481, 480, 479, 478, 477, 476, 475, + 1, 1, 1, 1, 1, 1, 1, 5, 23, 5, + 10, 27, 46, 23, 17, 46, 721, 10, 10, 10, + 10, 10, 10, 10, 16, 17, 16, 29, 17, 27, + 18, 116, 16, 11, 11, 11, 11, 11, 11, 11, + + 18, 19, 116, 53, 11, 29, 36, 19, 36, 53, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 48, + 48, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 11, 48, 10, 10, 10, 10, 12, 12, 12, 12, + 12, 12, 12, 61, 80, 80, 12, 12, 13, 13, + 13, 13, 13, 13, 13, 99, 61, 99, 13, 13, + 14, 14, 14, 14, 14, 14, 14, 15, 47, 15, + 14, 14, 47, 12, 49, 22, 15, 49, 24, 21, + 273, 21, 15, 22, 15, 13, 21, 24, 22, 21, + 25, 24, 25, 25, 22, 273, 722, 14, 45, 45, + + 92, 44, 44, 54, 45, 25, 26, 44, 26, 26, + 26, 26, 26, 44, 26, 45, 26, 54, 44, 92, + 44, 723, 26, 26, 54, 26, 41, 43, 43, 43, + 43, 43, 43, 50, 50, 57, 186, 43, 60, 50, + 60, 59, 59, 60, 60, 186, 57, 59, 75, 57, + 50, 60, 57, 140, 75, 59, 724, 84, 59, 63, + 63, 63, 63, 43, 728, 140, 41, 41, 41, 41, + 41, 41, 62, 41, 41, 84, 159, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 159, 729, 41, 731, + 62, 62, 62, 62, 64, 64, 64, 64, 65, 65, + + 65, 65, 66, 66, 66, 66, 66, 66, 108, 732, + 81, 81, 66, 67, 67, 67, 67, 67, 67, 67, + 81, 111, 108, 68, 67, 68, 68, 68, 68, 68, + 68, 117, 128, 117, 130, 111, 157, 160, 66, 128, + 133, 133, 157, 160, 117, 733, 133, 735, 130, 132, + 67, 132, 132, 132, 132, 132, 132, 133, 136, 136, + 136, 146, 146, 169, 136, 147, 147, 146, 161, 161, + 736, 147, 219, 169, 161, 136, 218, 287, 146, 243, + 287, 161, 147, 162, 162, 161, 163, 163, 218, 162, + 219, 243, 163, 173, 173, 173, 173, 737, 500, 738, + + 162, 500, 741, 163, 174, 174, 174, 174, 175, 175, + 175, 175, 176, 176, 176, 176, 177, 177, 177, 177, + 178, 178, 178, 178, 179, 179, 179, 179, 181, 181, + 181, 181, 181, 181, 742, 745, 749, 182, 181, 182, + 182, 182, 182, 182, 182, 183, 183, 183, 183, 183, + 183, 184, 184, 184, 184, 184, 184, 255, 255, 255, + 255, 255, 255, 259, 181, 256, 256, 256, 256, 256, + 256, 257, 257, 271, 271, 751, 259, 257, 276, 271, + 289, 289, 753, 290, 290, 756, 289, 757, 257, 290, + 271, 276, 291, 291, 567, 567, 761, 289, 291, 299, + + 290, 299, 763, 299, 302, 302, 302, 302, 765, 291, + 303, 303, 303, 303, 771, 567, 299, 304, 304, 304, + 304, 305, 305, 305, 305, 306, 306, 306, 306, 307, + 307, 307, 307, 307, 307, 308, 308, 308, 308, 308, + 308, 375, 427, 427, 768, 768, 772, 777, 719, 717, + 714, 712, 710, 709, 707, 706, 705, 375, 704, 703, + 702, 699, 698, 696, 427, 776, 776, 776, 778, 778, + 695, 694, 693, 692, 691, 689, 688, 687, 685, 683, + 682, 679, 676, 675, 663, 662, 661, 651, 650, 649, + 648, 628, 621, 620, 617, 616, 615, 614, 613, 612, + + 611, 610, 609, 608, 606, 603, 602, 601, 600, 599, + 598, 597, 596, 595, 594, 593, 591, 590, 589, 588, + 586, 584, 583, 582, 581, 580, 579, 578, 577, 576, + 575, 574, 573, 572, 571, 570, 569, 568, 566, 565, + 564, 563, 562, 561, 560, 559, 558, 557, 556, 555, + 554, 551, 550, 549, 548, 547, 546, 545, 544, 543, + 542, 541, 540, 539, 538, 537, 536, 535, 534, 533, + 531, 530, 529, 528, 527, 526, 525, 524, 523, 522, + 521, 520, 519, 518, 517, 516, 514, 513, 512, 511, + 510, 508, 507, 506, 505, 504, 503, 502, 499, 498, + + 496, 495, 494, 493, 490, 489, 488, 487, 486, 485, + 484, 482, 481, 480, 479, 478, 477, 476, 475, 474, 473, 472, 471, 470, 469, 468, 467, 466, 465, 464, - 463, 462, 461, 460, 459, 458, 456, 455, 454, 453, - 452, 450, 449, 448, 447, 446, 445, 444, 441, 440, - 438, 437, 436, 435, 432, 431, 430, 429, 428, 427, - 426, 424, 423, 422, 421, 420, 419, 418, 417, 416, - 415, 414, 413, 412, 411, 410, 409, 408, 406, 405, - 404, 403, 402, 401, 400, 399, 398, 397, 396, 395, - 394, 393, 392, 391, 390, 389, 388, 387, 384, 383, - - 382, 379, 378, 377, 376, 375, 374, 372, 370, 369, - 368, 366, 365, 364, 363, 362, 361, 360, 359, 358, - 357, 356, 355, 354, 353, 352, 351, 350, 349, 347, - 346, 345, 344, 343, 342, 341, 338, 337, 336, 333, - 332, 331, 330, 329, 328, 327, 326, 325, 324, 322, - 321, 320, 319, 318, 317, 316, 315, 313, 312, 311, - 310, 309, 308, 307, 306, 305, 304, 303, 302, 301, - 300, 299, 298, 297, 296, 295, 294, 292, 291, 290, - 289, 288, 287, 286, 285, 277, 276, 274, 273, 272, - 271, 270, 269, 264, 262, 261, 260, 259, 258, 257, - - 256, 255, 253, 251, 250, 248, 246, 245, 242, 241, - 240, 239, 238, 237, 236, 234, 230, 229, 228, 227, - 226, 225, 224, 223, 222, 221, 220, 219, 218, 217, - 216, 215, 214, 213, 212, 211, 210, 209, 208, 207, - 206, 205, 204, 203, 202, 201, 200, 199, 198, 197, - 195, 194, 192, 191, 189, 187, 186, 185, 184, 183, - 182, 181, 180, 179, 177, 175, 162, 161, 160, 158, - 157, 156, 155, 154, 148, 146, 145, 144, 143, 142, - 141, 140, 139, 138, 135, 134, 133, 132, 131, 129, - 128, 127, 125, 124, 121, 119, 117, 116, 115, 114, - - 113, 112, 111, 110, 107, 106, 105, 104, 103, 102, - 101, 100, 99, 98, 97, 96, 95, 94, 93, 92, - 91, 89, 88, 87, 86, 85, 84, 83, 81, 80, - 78, 77, 76, 75, 73, 72, 71, 55, 54, 51, - 50, 37, 36, 34, 33, 32, 31, 30, 29, 28, - 20, 8, 7, 3, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674, 674, 674, 674, 674, 674, 674, 674, 674, - 674, 674 + 463, 462, 461, 460, 459, 458, 457, 456, 455, 454, + 453, 452, 451, 449, 448, 447, 446, 445, 444, 443, + 442, 441, 440, 439, 438, 437, 436, 435, 434, 433, + 432, 431, 430, 429, 428, 425, 424, 423, 420, 419, + 418, 417, 416, 415, 413, 411, 410, 409, 407, 406, + 405, 404, 403, 402, 401, 400, 399, 398, 397, 396, + 395, 394, 393, 392, 391, 390, 388, 387, 386, 385, + + 384, 383, 382, 379, 378, 377, 374, 373, 372, 371, + 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, + 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, + 349, 348, 347, 346, 345, 343, 342, 341, 340, 339, + 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, + 328, 327, 326, 325, 324, 323, 322, 321, 320, 319, + 318, 316, 315, 314, 313, 312, 311, 310, 309, 301, + 300, 298, 297, 296, 295, 294, 293, 288, 286, 285, + 284, 283, 282, 281, 280, 279, 277, 275, 274, 272, + 270, 269, 266, 265, 264, 263, 262, 261, 260, 258, + + 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, + 244, 242, 241, 240, 239, 238, 237, 236, 235, 234, + 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, + 223, 222, 221, 220, 217, 216, 215, 214, 213, 212, + 211, 210, 209, 207, 206, 204, 203, 201, 199, 198, + 197, 196, 195, 194, 193, 192, 191, 190, 189, 187, + 185, 172, 171, 170, 168, 167, 166, 165, 164, 158, + 156, 155, 154, 153, 152, 151, 150, 149, 148, 145, + 144, 143, 142, 141, 139, 138, 137, 135, 134, 131, + 129, 127, 126, 125, 124, 123, 122, 121, 120, 119, + + 118, 115, 114, 113, 112, 110, 109, 107, 106, 105, + 104, 103, 102, 101, 100, 98, 97, 96, 95, 94, + 93, 91, 90, 89, 88, 87, 86, 85, 83, 82, + 79, 78, 77, 76, 74, 73, 72, 56, 55, 52, + 51, 38, 37, 35, 34, 33, 32, 31, 30, 28, + 20, 8, 7, 3, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, + 775, 775 } ; /* The intent behind this definition is that it'll catch @@ -916,6 +971,7 @@ static yyconst flex_int16_t yy_chk[1023] = #define require_ARB_vp (yyextra->mode == ARB_vertex) #define require_ARB_fp (yyextra->mode == ARB_fragment) +#define require_NV_fp (yyextra->option.NV_fragment) #define require_shadow (yyextra->option.Shadow) #define require_rect (yyextra->option.TexRect) #define require_texarray (yyextra->option.TexArray) @@ -1011,7 +1067,7 @@ swiz_from_char(char c) } while(0); #define YY_EXTRA_TYPE struct asm_parser_state * -#line 1015 "lex.yy.c" +#line 1071 "lex.yy.c" #define INITIAL 0 @@ -1257,10 +1313,10 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 135 "program_lexer.l" +#line 136 "program_lexer.l" -#line 1264 "lex.yy.c" +#line 1320 "lex.yy.c" yylval = yylval_param; @@ -1317,13 +1373,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 675 ) + if ( yy_current_state >= 776 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 955 ); + while ( yy_base[yy_current_state] != 1055 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -1349,17 +1405,17 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 137 "program_lexer.l" +#line 138 "program_lexer.l" { return ARBvp_10; } YY_BREAK case 2: YY_RULE_SETUP -#line 138 "program_lexer.l" +#line 139 "program_lexer.l" { return ARBfp_10; } YY_BREAK case 3: YY_RULE_SETUP -#line 139 "program_lexer.l" +#line 140 "program_lexer.l" { yylval->integer = at_address; return_token_or_IDENTIFIER(require_ARB_vp, ADDRESS); @@ -1367,813 +1423,983 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 143 "program_lexer.l" +#line 144 "program_lexer.l" { return ALIAS; } YY_BREAK case 5: YY_RULE_SETUP -#line 144 "program_lexer.l" +#line 145 "program_lexer.l" { return ATTRIB; } YY_BREAK case 6: YY_RULE_SETUP -#line 145 "program_lexer.l" +#line 146 "program_lexer.l" { return END; } YY_BREAK case 7: YY_RULE_SETUP -#line 146 "program_lexer.l" +#line 147 "program_lexer.l" { return OPTION; } YY_BREAK case 8: YY_RULE_SETUP -#line 147 "program_lexer.l" +#line 148 "program_lexer.l" { return OUTPUT; } YY_BREAK case 9: YY_RULE_SETUP -#line 148 "program_lexer.l" +#line 149 "program_lexer.l" { return PARAM; } YY_BREAK case 10: YY_RULE_SETUP -#line 149 "program_lexer.l" +#line 150 "program_lexer.l" { yylval->integer = at_temp; return TEMP; } YY_BREAK case 11: YY_RULE_SETUP -#line 151 "program_lexer.l" +#line 152 "program_lexer.l" { return_opcode( 1, VECTOR_OP, ABS, OFF); } YY_BREAK case 12: YY_RULE_SETUP -#line 152 "program_lexer.l" +#line 153 "program_lexer.l" { return_opcode(require_ARB_fp, VECTOR_OP, ABS, ZERO_ONE); } YY_BREAK case 13: YY_RULE_SETUP -#line 153 "program_lexer.l" +#line 154 "program_lexer.l" { return_opcode( 1, BIN_OP, ADD, OFF); } YY_BREAK case 14: YY_RULE_SETUP -#line 154 "program_lexer.l" +#line 155 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, ADD, ZERO_ONE); } YY_BREAK case 15: YY_RULE_SETUP -#line 155 "program_lexer.l" +#line 156 "program_lexer.l" { return_opcode(require_ARB_vp, ARL, ARL, OFF); } YY_BREAK case 16: YY_RULE_SETUP -#line 157 "program_lexer.l" +#line 158 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, CMP, OFF); } YY_BREAK case 17: YY_RULE_SETUP -#line 158 "program_lexer.l" +#line 159 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, CMP, ZERO_ONE); } YY_BREAK case 18: YY_RULE_SETUP -#line 159 "program_lexer.l" +#line 160 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, COS, OFF); } YY_BREAK case 19: YY_RULE_SETUP -#line 160 "program_lexer.l" +#line 161 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, COS, ZERO_ONE); } YY_BREAK case 20: YY_RULE_SETUP -#line 162 "program_lexer.l" -{ return_opcode( 1, BIN_OP, DP3, OFF); } +#line 163 "program_lexer.l" +{ return_opcode(require_NV_fp, VECTOR_OP, DDX, OFF); } YY_BREAK case 21: YY_RULE_SETUP -#line 163 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, DP3, ZERO_ONE); } +#line 164 "program_lexer.l" +{ return_opcode(require_NV_fp, VECTOR_OP, DDX, ZERO_ONE); } YY_BREAK case 22: YY_RULE_SETUP -#line 164 "program_lexer.l" -{ return_opcode( 1, BIN_OP, DP4, OFF); } +#line 165 "program_lexer.l" +{ return_opcode(require_NV_fp, VECTOR_OP, DDY, OFF); } YY_BREAK case 23: YY_RULE_SETUP -#line 165 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, DP4, ZERO_ONE); } +#line 166 "program_lexer.l" +{ return_opcode(require_NV_fp, VECTOR_OP, DDY, ZERO_ONE); } YY_BREAK case 24: YY_RULE_SETUP -#line 166 "program_lexer.l" -{ return_opcode( 1, BIN_OP, DPH, OFF); } +#line 167 "program_lexer.l" +{ return_opcode( 1, BIN_OP, DP3, OFF); } YY_BREAK case 25: YY_RULE_SETUP -#line 167 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, DPH, ZERO_ONE); } +#line 168 "program_lexer.l" +{ return_opcode(require_ARB_fp, BIN_OP, DP3, ZERO_ONE); } YY_BREAK case 26: YY_RULE_SETUP -#line 168 "program_lexer.l" -{ return_opcode( 1, BIN_OP, DST, OFF); } +#line 169 "program_lexer.l" +{ return_opcode( 1, BIN_OP, DP4, OFF); } YY_BREAK case 27: YY_RULE_SETUP -#line 169 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, DST, ZERO_ONE); } +#line 170 "program_lexer.l" +{ return_opcode(require_ARB_fp, BIN_OP, DP4, ZERO_ONE); } YY_BREAK case 28: YY_RULE_SETUP #line 171 "program_lexer.l" -{ return_opcode( 1, SCALAR_OP, EX2, OFF); } +{ return_opcode( 1, BIN_OP, DPH, OFF); } YY_BREAK case 29: YY_RULE_SETUP #line 172 "program_lexer.l" -{ return_opcode(require_ARB_fp, SCALAR_OP, EX2, ZERO_ONE); } +{ return_opcode(require_ARB_fp, BIN_OP, DPH, ZERO_ONE); } YY_BREAK case 30: YY_RULE_SETUP #line 173 "program_lexer.l" -{ return_opcode(require_ARB_vp, SCALAR_OP, EXP, OFF); } +{ return_opcode( 1, BIN_OP, DST, OFF); } YY_BREAK case 31: YY_RULE_SETUP -#line 175 "program_lexer.l" -{ return_opcode( 1, VECTOR_OP, FLR, OFF); } +#line 174 "program_lexer.l" +{ return_opcode(require_ARB_fp, BIN_OP, DST, ZERO_ONE); } YY_BREAK case 32: YY_RULE_SETUP #line 176 "program_lexer.l" -{ return_opcode(require_ARB_fp, VECTOR_OP, FLR, ZERO_ONE); } +{ return_opcode( 1, SCALAR_OP, EX2, OFF); } YY_BREAK case 33: YY_RULE_SETUP #line 177 "program_lexer.l" -{ return_opcode( 1, VECTOR_OP, FRC, OFF); } +{ return_opcode(require_ARB_fp, SCALAR_OP, EX2, ZERO_ONE); } YY_BREAK case 34: YY_RULE_SETUP #line 178 "program_lexer.l" -{ return_opcode(require_ARB_fp, VECTOR_OP, FRC, ZERO_ONE); } +{ return_opcode(require_ARB_vp, SCALAR_OP, EXP, OFF); } YY_BREAK case 35: YY_RULE_SETUP #line 180 "program_lexer.l" -{ return_opcode(require_ARB_fp, KIL, KIL, OFF); } +{ return_opcode( 1, VECTOR_OP, FLR, OFF); } YY_BREAK case 36: YY_RULE_SETUP -#line 182 "program_lexer.l" -{ return_opcode( 1, VECTOR_OP, LIT, OFF); } +#line 181 "program_lexer.l" +{ return_opcode(require_ARB_fp, VECTOR_OP, FLR, ZERO_ONE); } YY_BREAK case 37: YY_RULE_SETUP -#line 183 "program_lexer.l" -{ return_opcode(require_ARB_fp, VECTOR_OP, LIT, ZERO_ONE); } +#line 182 "program_lexer.l" +{ return_opcode( 1, VECTOR_OP, FRC, OFF); } YY_BREAK case 38: YY_RULE_SETUP -#line 184 "program_lexer.l" -{ return_opcode( 1, SCALAR_OP, LG2, OFF); } +#line 183 "program_lexer.l" +{ return_opcode(require_ARB_fp, VECTOR_OP, FRC, ZERO_ONE); } YY_BREAK case 39: YY_RULE_SETUP #line 185 "program_lexer.l" -{ return_opcode(require_ARB_fp, SCALAR_OP, LG2, ZERO_ONE); } +{ return_opcode(require_ARB_fp, KIL, KIL, OFF); } YY_BREAK case 40: YY_RULE_SETUP -#line 186 "program_lexer.l" -{ return_opcode(require_ARB_vp, SCALAR_OP, LOG, OFF); } +#line 187 "program_lexer.l" +{ return_opcode( 1, VECTOR_OP, LIT, OFF); } YY_BREAK case 41: YY_RULE_SETUP -#line 187 "program_lexer.l" -{ return_opcode(require_ARB_fp, TRI_OP, LRP, OFF); } +#line 188 "program_lexer.l" +{ return_opcode(require_ARB_fp, VECTOR_OP, LIT, ZERO_ONE); } YY_BREAK case 42: YY_RULE_SETUP -#line 188 "program_lexer.l" -{ return_opcode(require_ARB_fp, TRI_OP, LRP, ZERO_ONE); } +#line 189 "program_lexer.l" +{ return_opcode( 1, SCALAR_OP, LG2, OFF); } YY_BREAK case 43: YY_RULE_SETUP #line 190 "program_lexer.l" -{ return_opcode( 1, TRI_OP, MAD, OFF); } +{ return_opcode(require_ARB_fp, SCALAR_OP, LG2, ZERO_ONE); } YY_BREAK case 44: YY_RULE_SETUP #line 191 "program_lexer.l" -{ return_opcode(require_ARB_fp, TRI_OP, MAD, ZERO_ONE); } +{ return_opcode(require_ARB_vp, SCALAR_OP, LOG, OFF); } YY_BREAK case 45: YY_RULE_SETUP #line 192 "program_lexer.l" -{ return_opcode( 1, BIN_OP, MAX, OFF); } +{ return_opcode(require_ARB_fp, TRI_OP, LRP, OFF); } YY_BREAK case 46: YY_RULE_SETUP #line 193 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, MAX, ZERO_ONE); } +{ return_opcode(require_ARB_fp, TRI_OP, LRP, ZERO_ONE); } YY_BREAK case 47: YY_RULE_SETUP -#line 194 "program_lexer.l" -{ return_opcode( 1, BIN_OP, MIN, OFF); } +#line 195 "program_lexer.l" +{ return_opcode( 1, TRI_OP, MAD, OFF); } YY_BREAK case 48: YY_RULE_SETUP -#line 195 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, MIN, ZERO_ONE); } +#line 196 "program_lexer.l" +{ return_opcode(require_ARB_fp, TRI_OP, MAD, ZERO_ONE); } YY_BREAK case 49: YY_RULE_SETUP -#line 196 "program_lexer.l" -{ return_opcode( 1, VECTOR_OP, MOV, OFF); } +#line 197 "program_lexer.l" +{ return_opcode( 1, BIN_OP, MAX, OFF); } YY_BREAK case 50: YY_RULE_SETUP -#line 197 "program_lexer.l" -{ return_opcode(require_ARB_fp, VECTOR_OP, MOV, ZERO_ONE); } +#line 198 "program_lexer.l" +{ return_opcode(require_ARB_fp, BIN_OP, MAX, ZERO_ONE); } YY_BREAK case 51: YY_RULE_SETUP -#line 198 "program_lexer.l" -{ return_opcode( 1, BIN_OP, MUL, OFF); } +#line 199 "program_lexer.l" +{ return_opcode( 1, BIN_OP, MIN, OFF); } YY_BREAK case 52: YY_RULE_SETUP -#line 199 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, MUL, ZERO_ONE); } +#line 200 "program_lexer.l" +{ return_opcode(require_ARB_fp, BIN_OP, MIN, ZERO_ONE); } YY_BREAK case 53: YY_RULE_SETUP #line 201 "program_lexer.l" -{ return_opcode( 1, BINSC_OP, POW, OFF); } +{ return_opcode( 1, VECTOR_OP, MOV, OFF); } YY_BREAK case 54: YY_RULE_SETUP #line 202 "program_lexer.l" -{ return_opcode(require_ARB_fp, BINSC_OP, POW, ZERO_ONE); } +{ return_opcode(require_ARB_fp, VECTOR_OP, MOV, ZERO_ONE); } YY_BREAK case 55: YY_RULE_SETUP -#line 204 "program_lexer.l" -{ return_opcode( 1, SCALAR_OP, RCP, OFF); } +#line 203 "program_lexer.l" +{ return_opcode( 1, BIN_OP, MUL, OFF); } YY_BREAK case 56: YY_RULE_SETUP -#line 205 "program_lexer.l" -{ return_opcode(require_ARB_fp, SCALAR_OP, RCP, ZERO_ONE); } +#line 204 "program_lexer.l" +{ return_opcode(require_ARB_fp, BIN_OP, MUL, ZERO_ONE); } YY_BREAK case 57: YY_RULE_SETUP #line 206 "program_lexer.l" -{ return_opcode( 1, SCALAR_OP, RSQ, OFF); } +{ return_opcode(require_NV_fp, VECTOR_OP, PK2H, OFF); } YY_BREAK case 58: YY_RULE_SETUP #line 207 "program_lexer.l" -{ return_opcode(require_ARB_fp, SCALAR_OP, RSQ, ZERO_ONE); } +{ return_opcode(require_NV_fp, VECTOR_OP, PK2H, ZERO_ONE); } YY_BREAK case 59: YY_RULE_SETUP -#line 209 "program_lexer.l" -{ return_opcode(require_ARB_fp, SCALAR_OP, SCS, OFF); } +#line 208 "program_lexer.l" +{ return_opcode(require_NV_fp, VECTOR_OP, PK2US, OFF); } YY_BREAK case 60: YY_RULE_SETUP -#line 210 "program_lexer.l" -{ return_opcode(require_ARB_fp, SCALAR_OP, SCS, ZERO_ONE); } +#line 209 "program_lexer.l" +{ return_opcode(require_NV_fp, VECTOR_OP, PK2US, ZERO_ONE); } YY_BREAK case 61: YY_RULE_SETUP -#line 211 "program_lexer.l" -{ return_opcode( 1, BIN_OP, SGE, OFF); } +#line 210 "program_lexer.l" +{ return_opcode(require_NV_fp, VECTOR_OP, PK4B, OFF); } YY_BREAK case 62: YY_RULE_SETUP -#line 212 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, SGE, ZERO_ONE); } +#line 211 "program_lexer.l" +{ return_opcode(require_NV_fp, VECTOR_OP, PK4B, ZERO_ONE); } YY_BREAK case 63: YY_RULE_SETUP -#line 213 "program_lexer.l" -{ return_opcode(require_ARB_fp, SCALAR_OP, SIN, OFF); } +#line 212 "program_lexer.l" +{ return_opcode(require_NV_fp, VECTOR_OP, PK4UB, OFF); } YY_BREAK case 64: YY_RULE_SETUP -#line 214 "program_lexer.l" -{ return_opcode(require_ARB_fp, SCALAR_OP, SIN, ZERO_ONE); } +#line 213 "program_lexer.l" +{ return_opcode(require_NV_fp, VECTOR_OP, PK4UB, ZERO_ONE); } YY_BREAK case 65: YY_RULE_SETUP -#line 215 "program_lexer.l" -{ return_opcode( 1, BIN_OP, SLT, OFF); } +#line 214 "program_lexer.l" +{ return_opcode( 1, BINSC_OP, POW, OFF); } YY_BREAK case 66: YY_RULE_SETUP -#line 216 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, SLT, ZERO_ONE); } +#line 215 "program_lexer.l" +{ return_opcode(require_ARB_fp, BINSC_OP, POW, ZERO_ONE); } YY_BREAK case 67: YY_RULE_SETUP #line 217 "program_lexer.l" -{ return_opcode( 1, BIN_OP, SUB, OFF); } +{ return_opcode( 1, SCALAR_OP, RCP, OFF); } YY_BREAK case 68: YY_RULE_SETUP #line 218 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, SUB, ZERO_ONE); } +{ return_opcode(require_ARB_fp, SCALAR_OP, RCP, ZERO_ONE); } YY_BREAK case 69: YY_RULE_SETUP #line 219 "program_lexer.l" -{ return_opcode( 1, SWZ, SWZ, OFF); } +{ return_opcode(require_NV_fp, BIN_OP, RFL, OFF); } YY_BREAK case 70: YY_RULE_SETUP #line 220 "program_lexer.l" -{ return_opcode(require_ARB_fp, SWZ, SWZ, ZERO_ONE); } +{ return_opcode(require_NV_fp, BIN_OP, RFL, ZERO_ONE); } YY_BREAK case 71: YY_RULE_SETUP -#line 222 "program_lexer.l" -{ return_opcode(require_ARB_fp, SAMPLE_OP, TEX, OFF); } +#line 221 "program_lexer.l" +{ return_opcode( 1, SCALAR_OP, RSQ, OFF); } YY_BREAK case 72: YY_RULE_SETUP -#line 223 "program_lexer.l" -{ return_opcode(require_ARB_fp, SAMPLE_OP, TEX, ZERO_ONE); } +#line 222 "program_lexer.l" +{ return_opcode(require_ARB_fp, SCALAR_OP, RSQ, ZERO_ONE); } YY_BREAK case 73: YY_RULE_SETUP #line 224 "program_lexer.l" -{ return_opcode(require_ARB_fp, SAMPLE_OP, TXB, OFF); } +{ return_opcode(require_ARB_fp, SCALAR_OP, SCS, OFF); } YY_BREAK case 74: YY_RULE_SETUP #line 225 "program_lexer.l" -{ return_opcode(require_ARB_fp, SAMPLE_OP, TXB, ZERO_ONE); } +{ return_opcode(require_ARB_fp, SCALAR_OP, SCS, ZERO_ONE); } YY_BREAK case 75: YY_RULE_SETUP #line 226 "program_lexer.l" -{ return_opcode(require_ARB_fp, SAMPLE_OP, TXP, OFF); } +{ return_opcode(require_NV_fp, BIN_OP, SEQ, OFF); } YY_BREAK case 76: YY_RULE_SETUP #line 227 "program_lexer.l" -{ return_opcode(require_ARB_fp, SAMPLE_OP, TXP, ZERO_ONE); } +{ return_opcode(require_NV_fp, BIN_OP, SEQ, ZERO_ONE); } YY_BREAK case 77: YY_RULE_SETUP -#line 229 "program_lexer.l" -{ return_opcode( 1, BIN_OP, XPD, OFF); } +#line 228 "program_lexer.l" +{ return_opcode(require_NV_fp, BIN_OP, SFL, OFF); } YY_BREAK case 78: YY_RULE_SETUP -#line 230 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, XPD, ZERO_ONE); } +#line 229 "program_lexer.l" +{ return_opcode(require_NV_fp, BIN_OP, SFL, ZERO_ONE); } YY_BREAK case 79: YY_RULE_SETUP -#line 232 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); } +#line 230 "program_lexer.l" +{ return_opcode( 1, BIN_OP, SGE, OFF); } YY_BREAK case 80: YY_RULE_SETUP -#line 233 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); } +#line 231 "program_lexer.l" +{ return_opcode(require_ARB_fp, BIN_OP, SGE, ZERO_ONE); } YY_BREAK case 81: YY_RULE_SETUP -#line 234 "program_lexer.l" -{ return PROGRAM; } +#line 232 "program_lexer.l" +{ return_opcode(require_NV_fp, BIN_OP, SGT, OFF); } YY_BREAK case 82: YY_RULE_SETUP -#line 235 "program_lexer.l" -{ return STATE; } +#line 233 "program_lexer.l" +{ return_opcode(require_NV_fp, BIN_OP, SGT, ZERO_ONE); } YY_BREAK case 83: YY_RULE_SETUP -#line 236 "program_lexer.l" -{ return RESULT; } +#line 234 "program_lexer.l" +{ return_opcode(require_ARB_fp, SCALAR_OP, SIN, OFF); } YY_BREAK case 84: YY_RULE_SETUP -#line 238 "program_lexer.l" -{ return AMBIENT; } +#line 235 "program_lexer.l" +{ return_opcode(require_ARB_fp, SCALAR_OP, SIN, ZERO_ONE); } YY_BREAK case 85: YY_RULE_SETUP -#line 239 "program_lexer.l" -{ return ATTENUATION; } +#line 236 "program_lexer.l" +{ return_opcode(require_NV_fp, BIN_OP, SLE, OFF); } YY_BREAK case 86: YY_RULE_SETUP -#line 240 "program_lexer.l" -{ return BACK; } +#line 237 "program_lexer.l" +{ return_opcode(require_NV_fp, BIN_OP, SLE, ZERO_ONE); } YY_BREAK case 87: YY_RULE_SETUP -#line 241 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, CLIP); } +#line 238 "program_lexer.l" +{ return_opcode( 1, BIN_OP, SLT, OFF); } YY_BREAK case 88: YY_RULE_SETUP -#line 242 "program_lexer.l" -{ return COLOR; } +#line 239 "program_lexer.l" +{ return_opcode(require_ARB_fp, BIN_OP, SLT, ZERO_ONE); } YY_BREAK case 89: YY_RULE_SETUP -#line 243 "program_lexer.l" -{ return_token_or_DOT(require_ARB_fp, DEPTH); } +#line 240 "program_lexer.l" +{ return_opcode(require_NV_fp, BIN_OP, SNE, OFF); } YY_BREAK case 90: YY_RULE_SETUP -#line 244 "program_lexer.l" -{ return DIFFUSE; } +#line 241 "program_lexer.l" +{ return_opcode(require_NV_fp, BIN_OP, SNE, ZERO_ONE); } YY_BREAK case 91: YY_RULE_SETUP -#line 245 "program_lexer.l" -{ return DIRECTION; } +#line 242 "program_lexer.l" +{ return_opcode(require_NV_fp, BIN_OP, STR, OFF); } YY_BREAK case 92: YY_RULE_SETUP -#line 246 "program_lexer.l" -{ return EMISSION; } +#line 243 "program_lexer.l" +{ return_opcode(require_NV_fp, BIN_OP, STR, ZERO_ONE); } YY_BREAK case 93: YY_RULE_SETUP -#line 247 "program_lexer.l" -{ return ENV; } +#line 244 "program_lexer.l" +{ return_opcode( 1, BIN_OP, SUB, OFF); } YY_BREAK case 94: YY_RULE_SETUP -#line 248 "program_lexer.l" -{ return EYE; } +#line 245 "program_lexer.l" +{ return_opcode(require_ARB_fp, BIN_OP, SUB, ZERO_ONE); } YY_BREAK case 95: YY_RULE_SETUP -#line 249 "program_lexer.l" -{ return FOGCOORD; } +#line 246 "program_lexer.l" +{ return_opcode( 1, SWZ, SWZ, OFF); } YY_BREAK case 96: YY_RULE_SETUP -#line 250 "program_lexer.l" -{ return FOG; } +#line 247 "program_lexer.l" +{ return_opcode(require_ARB_fp, SWZ, SWZ, ZERO_ONE); } YY_BREAK case 97: YY_RULE_SETUP -#line 251 "program_lexer.l" -{ return FRONT; } +#line 249 "program_lexer.l" +{ return_opcode(require_ARB_fp, SAMPLE_OP, TEX, OFF); } YY_BREAK case 98: YY_RULE_SETUP -#line 252 "program_lexer.l" -{ return HALF; } +#line 250 "program_lexer.l" +{ return_opcode(require_ARB_fp, SAMPLE_OP, TEX, ZERO_ONE); } YY_BREAK case 99: YY_RULE_SETUP -#line 253 "program_lexer.l" -{ return INVERSE; } +#line 251 "program_lexer.l" +{ return_opcode(require_ARB_fp, SAMPLE_OP, TXB, OFF); } YY_BREAK case 100: YY_RULE_SETUP -#line 254 "program_lexer.l" -{ return INVTRANS; } +#line 252 "program_lexer.l" +{ return_opcode(require_ARB_fp, SAMPLE_OP, TXB, ZERO_ONE); } YY_BREAK case 101: YY_RULE_SETUP -#line 255 "program_lexer.l" -{ return LIGHT; } +#line 253 "program_lexer.l" +{ return_opcode(require_NV_fp, TXD_OP, TXD, OFF); } YY_BREAK case 102: YY_RULE_SETUP -#line 256 "program_lexer.l" -{ return LIGHTMODEL; } +#line 254 "program_lexer.l" +{ return_opcode(require_NV_fp, TXD_OP, TXD, ZERO_ONE); } YY_BREAK case 103: YY_RULE_SETUP -#line 257 "program_lexer.l" -{ return LIGHTPROD; } +#line 255 "program_lexer.l" +{ return_opcode(require_ARB_fp, SAMPLE_OP, TXP, OFF); } YY_BREAK case 104: YY_RULE_SETUP -#line 258 "program_lexer.l" -{ return LOCAL; } +#line 256 "program_lexer.l" +{ return_opcode(require_ARB_fp, SAMPLE_OP, TXP, ZERO_ONE); } YY_BREAK case 105: YY_RULE_SETUP -#line 259 "program_lexer.l" -{ return MATERIAL; } +#line 258 "program_lexer.l" +{ return_opcode(require_NV_fp, SCALAR_OP, UP2H, OFF); } YY_BREAK case 106: YY_RULE_SETUP -#line 260 "program_lexer.l" -{ return MAT_PROGRAM; } +#line 259 "program_lexer.l" +{ return_opcode(require_NV_fp, SCALAR_OP, UP2H, ZERO_ONE); } YY_BREAK case 107: YY_RULE_SETUP -#line 261 "program_lexer.l" -{ return MATRIX; } +#line 260 "program_lexer.l" +{ return_opcode(require_NV_fp, SCALAR_OP, UP2US, OFF); } YY_BREAK case 108: YY_RULE_SETUP -#line 262 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, MATRIXINDEX); } +#line 261 "program_lexer.l" +{ return_opcode(require_NV_fp, SCALAR_OP, UP2US, ZERO_ONE); } YY_BREAK case 109: YY_RULE_SETUP #line 263 "program_lexer.l" -{ return MODELVIEW; } +{ return_opcode(require_NV_fp, TRI_OP, X2D, OFF); } YY_BREAK case 110: YY_RULE_SETUP #line 264 "program_lexer.l" -{ return MVP; } +{ return_opcode(require_NV_fp, TRI_OP, X2D, ZERO_ONE); } YY_BREAK case 111: YY_RULE_SETUP #line 265 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, NORMAL); } +{ return_opcode( 1, BIN_OP, XPD, OFF); } YY_BREAK case 112: YY_RULE_SETUP #line 266 "program_lexer.l" -{ return OBJECT; } +{ return_opcode(require_ARB_fp, BIN_OP, XPD, ZERO_ONE); } YY_BREAK case 113: YY_RULE_SETUP -#line 267 "program_lexer.l" -{ return PALETTE; } +#line 268 "program_lexer.l" +{ return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); } YY_BREAK case 114: YY_RULE_SETUP -#line 268 "program_lexer.l" -{ return PARAMS; } +#line 269 "program_lexer.l" +{ return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); } YY_BREAK case 115: YY_RULE_SETUP -#line 269 "program_lexer.l" -{ return PLANE; } +#line 270 "program_lexer.l" +{ return PROGRAM; } YY_BREAK case 116: YY_RULE_SETUP -#line 270 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, POINT); } +#line 271 "program_lexer.l" +{ return STATE; } YY_BREAK case 117: YY_RULE_SETUP -#line 271 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, POINTSIZE); } +#line 272 "program_lexer.l" +{ return RESULT; } YY_BREAK case 118: YY_RULE_SETUP -#line 272 "program_lexer.l" -{ return POSITION; } +#line 274 "program_lexer.l" +{ return AMBIENT; } YY_BREAK case 119: YY_RULE_SETUP -#line 273 "program_lexer.l" -{ return PRIMARY; } +#line 275 "program_lexer.l" +{ return ATTENUATION; } YY_BREAK case 120: YY_RULE_SETUP -#line 274 "program_lexer.l" -{ return PROJECTION; } +#line 276 "program_lexer.l" +{ return BACK; } YY_BREAK case 121: YY_RULE_SETUP -#line 275 "program_lexer.l" -{ return_token_or_DOT(require_ARB_fp, RANGE); } +#line 277 "program_lexer.l" +{ return_token_or_DOT(require_ARB_vp, CLIP); } YY_BREAK case 122: YY_RULE_SETUP -#line 276 "program_lexer.l" -{ return ROW; } +#line 278 "program_lexer.l" +{ return COLOR; } YY_BREAK case 123: YY_RULE_SETUP -#line 277 "program_lexer.l" -{ return SCENECOLOR; } +#line 279 "program_lexer.l" +{ return_token_or_DOT(require_ARB_fp, DEPTH); } YY_BREAK case 124: YY_RULE_SETUP -#line 278 "program_lexer.l" -{ return SECONDARY; } +#line 280 "program_lexer.l" +{ return DIFFUSE; } YY_BREAK case 125: YY_RULE_SETUP -#line 279 "program_lexer.l" -{ return SHININESS; } +#line 281 "program_lexer.l" +{ return DIRECTION; } YY_BREAK case 126: YY_RULE_SETUP -#line 280 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, SIZE); } +#line 282 "program_lexer.l" +{ return EMISSION; } YY_BREAK case 127: YY_RULE_SETUP -#line 281 "program_lexer.l" -{ return SPECULAR; } +#line 283 "program_lexer.l" +{ return ENV; } YY_BREAK case 128: YY_RULE_SETUP -#line 282 "program_lexer.l" -{ return SPOT; } +#line 284 "program_lexer.l" +{ return EYE; } YY_BREAK case 129: YY_RULE_SETUP -#line 283 "program_lexer.l" -{ return TEXCOORD; } +#line 285 "program_lexer.l" +{ return FOGCOORD; } YY_BREAK case 130: YY_RULE_SETUP -#line 284 "program_lexer.l" -{ return_token_or_DOT(require_ARB_fp, TEXENV); } +#line 286 "program_lexer.l" +{ return FOG; } YY_BREAK case 131: YY_RULE_SETUP -#line 285 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, TEXGEN); } +#line 287 "program_lexer.l" +{ return FRONT; } YY_BREAK case 132: YY_RULE_SETUP -#line 286 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, TEXGEN_Q); } +#line 288 "program_lexer.l" +{ return HALF; } YY_BREAK case 133: YY_RULE_SETUP -#line 287 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, TEXGEN_S); } +#line 289 "program_lexer.l" +{ return INVERSE; } YY_BREAK case 134: YY_RULE_SETUP -#line 288 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, TEXGEN_T); } +#line 290 "program_lexer.l" +{ return INVTRANS; } YY_BREAK case 135: YY_RULE_SETUP -#line 289 "program_lexer.l" -{ return TEXTURE; } +#line 291 "program_lexer.l" +{ return LIGHT; } YY_BREAK case 136: YY_RULE_SETUP -#line 290 "program_lexer.l" -{ return TRANSPOSE; } +#line 292 "program_lexer.l" +{ return LIGHTMODEL; } YY_BREAK case 137: YY_RULE_SETUP -#line 291 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, VTXATTRIB); } +#line 293 "program_lexer.l" +{ return LIGHTPROD; } YY_BREAK case 138: YY_RULE_SETUP -#line 292 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, WEIGHT); } +#line 294 "program_lexer.l" +{ return LOCAL; } YY_BREAK case 139: YY_RULE_SETUP -#line 294 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp, TEXTURE_UNIT); } +#line 295 "program_lexer.l" +{ return MATERIAL; } YY_BREAK case 140: YY_RULE_SETUP -#line 295 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_1D); } +#line 296 "program_lexer.l" +{ return MAT_PROGRAM; } YY_BREAK case 141: YY_RULE_SETUP -#line 296 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_2D); } +#line 297 "program_lexer.l" +{ return MATRIX; } YY_BREAK case 142: YY_RULE_SETUP -#line 297 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_3D); } +#line 298 "program_lexer.l" +{ return_token_or_DOT(require_ARB_vp, MATRIXINDEX); } YY_BREAK case 143: YY_RULE_SETUP -#line 298 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_CUBE); } +#line 299 "program_lexer.l" +{ return MODELVIEW; } YY_BREAK case 144: YY_RULE_SETUP -#line 299 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp && require_rect, TEX_RECT); } +#line 300 "program_lexer.l" +{ return MVP; } YY_BREAK case 145: YY_RULE_SETUP -#line 300 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW1D); } +#line 301 "program_lexer.l" +{ return_token_or_DOT(require_ARB_vp, NORMAL); } YY_BREAK case 146: YY_RULE_SETUP -#line 301 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW2D); } +#line 302 "program_lexer.l" +{ return OBJECT; } YY_BREAK case 147: YY_RULE_SETUP -#line 302 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_rect, TEX_SHADOWRECT); } +#line 303 "program_lexer.l" +{ return PALETTE; } YY_BREAK case 148: YY_RULE_SETUP -#line 303 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY1D); } +#line 304 "program_lexer.l" +{ return PARAMS; } YY_BREAK case 149: YY_RULE_SETUP -#line 304 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY2D); } +#line 305 "program_lexer.l" +{ return PLANE; } YY_BREAK case 150: YY_RULE_SETUP -#line 305 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW1D); } +#line 306 "program_lexer.l" +{ return_token_or_DOT(require_ARB_vp, POINT); } YY_BREAK case 151: YY_RULE_SETUP -#line 306 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); } +#line 307 "program_lexer.l" +{ return_token_or_DOT(require_ARB_vp, POINTSIZE); } YY_BREAK case 152: YY_RULE_SETUP #line 308 "program_lexer.l" +{ return POSITION; } + YY_BREAK +case 153: +YY_RULE_SETUP +#line 309 "program_lexer.l" +{ return PRIMARY; } + YY_BREAK +case 154: +YY_RULE_SETUP +#line 310 "program_lexer.l" +{ return PROJECTION; } + YY_BREAK +case 155: +YY_RULE_SETUP +#line 311 "program_lexer.l" +{ return_token_or_DOT(require_ARB_fp, RANGE); } + YY_BREAK +case 156: +YY_RULE_SETUP +#line 312 "program_lexer.l" +{ return ROW; } + YY_BREAK +case 157: +YY_RULE_SETUP +#line 313 "program_lexer.l" +{ return SCENECOLOR; } + YY_BREAK +case 158: +YY_RULE_SETUP +#line 314 "program_lexer.l" +{ return SECONDARY; } + YY_BREAK +case 159: +YY_RULE_SETUP +#line 315 "program_lexer.l" +{ return SHININESS; } + YY_BREAK +case 160: +YY_RULE_SETUP +#line 316 "program_lexer.l" +{ return_token_or_DOT(require_ARB_vp, SIZE); } + YY_BREAK +case 161: +YY_RULE_SETUP +#line 317 "program_lexer.l" +{ return SPECULAR; } + YY_BREAK +case 162: +YY_RULE_SETUP +#line 318 "program_lexer.l" +{ return SPOT; } + YY_BREAK +case 163: +YY_RULE_SETUP +#line 319 "program_lexer.l" +{ return TEXCOORD; } + YY_BREAK +case 164: +YY_RULE_SETUP +#line 320 "program_lexer.l" +{ return_token_or_DOT(require_ARB_fp, TEXENV); } + YY_BREAK +case 165: +YY_RULE_SETUP +#line 321 "program_lexer.l" +{ return_token_or_DOT(require_ARB_vp, TEXGEN); } + YY_BREAK +case 166: +YY_RULE_SETUP +#line 322 "program_lexer.l" +{ return_token_or_DOT(require_ARB_vp, TEXGEN_Q); } + YY_BREAK +case 167: +YY_RULE_SETUP +#line 323 "program_lexer.l" +{ return_token_or_DOT(require_ARB_vp, TEXGEN_S); } + YY_BREAK +case 168: +YY_RULE_SETUP +#line 324 "program_lexer.l" +{ return_token_or_DOT(require_ARB_vp, TEXGEN_T); } + YY_BREAK +case 169: +YY_RULE_SETUP +#line 325 "program_lexer.l" +{ return TEXTURE; } + YY_BREAK +case 170: +YY_RULE_SETUP +#line 326 "program_lexer.l" +{ return TRANSPOSE; } + YY_BREAK +case 171: +YY_RULE_SETUP +#line 327 "program_lexer.l" +{ return_token_or_DOT(require_ARB_vp, VTXATTRIB); } + YY_BREAK +case 172: +YY_RULE_SETUP +#line 328 "program_lexer.l" +{ return_token_or_DOT(require_ARB_vp, WEIGHT); } + YY_BREAK +case 173: +YY_RULE_SETUP +#line 330 "program_lexer.l" +{ return_token_or_IDENTIFIER(require_ARB_fp, TEXTURE_UNIT); } + YY_BREAK +case 174: +YY_RULE_SETUP +#line 331 "program_lexer.l" +{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_1D); } + YY_BREAK +case 175: +YY_RULE_SETUP +#line 332 "program_lexer.l" +{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_2D); } + YY_BREAK +case 176: +YY_RULE_SETUP +#line 333 "program_lexer.l" +{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_3D); } + YY_BREAK +case 177: +YY_RULE_SETUP +#line 334 "program_lexer.l" +{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_CUBE); } + YY_BREAK +case 178: +YY_RULE_SETUP +#line 335 "program_lexer.l" +{ return_token_or_IDENTIFIER(require_ARB_fp && require_rect, TEX_RECT); } + YY_BREAK +case 179: +YY_RULE_SETUP +#line 336 "program_lexer.l" +{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW1D); } + YY_BREAK +case 180: +YY_RULE_SETUP +#line 337 "program_lexer.l" +{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW2D); } + YY_BREAK +case 181: +YY_RULE_SETUP +#line 338 "program_lexer.l" +{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_rect, TEX_SHADOWRECT); } + YY_BREAK +case 182: +YY_RULE_SETUP +#line 339 "program_lexer.l" +{ return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY1D); } + YY_BREAK +case 183: +YY_RULE_SETUP +#line 340 "program_lexer.l" +{ return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY2D); } + YY_BREAK +case 184: +YY_RULE_SETUP +#line 341 "program_lexer.l" +{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW1D); } + YY_BREAK +case 185: +YY_RULE_SETUP +#line 342 "program_lexer.l" +{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); } + YY_BREAK +case 186: +YY_RULE_SETUP +#line 344 "program_lexer.l" { yylval->string = strdup(yytext); return IDENTIFIER; } YY_BREAK -case 153: +case 187: YY_RULE_SETUP -#line 313 "program_lexer.l" +#line 349 "program_lexer.l" { return DOT_DOT; } YY_BREAK -case 154: +case 188: YY_RULE_SETUP -#line 315 "program_lexer.l" +#line 351 "program_lexer.l" { yylval->integer = strtol(yytext, NULL, 10); return INTEGER; } YY_BREAK -case 155: +case 189: YY_RULE_SETUP -#line 319 "program_lexer.l" +#line 355 "program_lexer.l" { yylval->real = strtod(yytext, NULL); return REAL; } YY_BREAK -case 156: -/* rule 156 can match eol */ +case 190: +/* rule 190 can match eol */ *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 323 "program_lexer.l" +#line 359 "program_lexer.l" { yylval->real = strtod(yytext, NULL); return REAL; } YY_BREAK -case 157: +case 191: YY_RULE_SETUP -#line 327 "program_lexer.l" +#line 363 "program_lexer.l" { yylval->real = strtod(yytext, NULL); return REAL; } YY_BREAK -case 158: +case 192: YY_RULE_SETUP -#line 331 "program_lexer.l" +#line 367 "program_lexer.l" { yylval->real = strtod(yytext, NULL); return REAL; } YY_BREAK -case 159: +case 193: YY_RULE_SETUP -#line 336 "program_lexer.l" +#line 372 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; return MASK4; } YY_BREAK -case 160: +case 194: YY_RULE_SETUP -#line 342 "program_lexer.l" +#line 378 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2181,27 +2407,27 @@ YY_RULE_SETUP return MASK3; } YY_BREAK -case 161: +case 195: YY_RULE_SETUP -#line 348 "program_lexer.l" +#line 384 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; return MASK3; } YY_BREAK -case 162: +case 196: YY_RULE_SETUP -#line 353 "program_lexer.l" +#line 389 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; return MASK3; } YY_BREAK -case 163: +case 197: YY_RULE_SETUP -#line 359 "program_lexer.l" +#line 395 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2209,9 +2435,9 @@ YY_RULE_SETUP return MASK2; } YY_BREAK -case 164: +case 198: YY_RULE_SETUP -#line 365 "program_lexer.l" +#line 401 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2219,18 +2445,18 @@ YY_RULE_SETUP return MASK2; } YY_BREAK -case 165: +case 199: YY_RULE_SETUP -#line 371 "program_lexer.l" +#line 407 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; return MASK2; } YY_BREAK -case 166: +case 200: YY_RULE_SETUP -#line 377 "program_lexer.l" +#line 413 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2238,9 +2464,9 @@ YY_RULE_SETUP return MASK1; } YY_BREAK -case 167: +case 201: YY_RULE_SETUP -#line 384 "program_lexer.l" +#line 420 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2250,18 +2476,18 @@ YY_RULE_SETUP return SWIZZLE; } YY_BREAK -case 168: +case 202: YY_RULE_SETUP -#line 393 "program_lexer.l" +#line 429 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; return_token_or_DOT(require_ARB_fp, MASK4); } YY_BREAK -case 169: +case 203: YY_RULE_SETUP -#line 399 "program_lexer.l" +#line 435 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2269,27 +2495,27 @@ YY_RULE_SETUP return_token_or_DOT(require_ARB_fp, MASK3); } YY_BREAK -case 170: +case 204: YY_RULE_SETUP -#line 405 "program_lexer.l" +#line 441 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; return_token_or_DOT(require_ARB_fp, MASK3); } YY_BREAK -case 171: +case 205: YY_RULE_SETUP -#line 410 "program_lexer.l" +#line 446 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; return_token_or_DOT(require_ARB_fp, MASK3); } YY_BREAK -case 172: +case 206: YY_RULE_SETUP -#line 416 "program_lexer.l" +#line 452 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2297,9 +2523,9 @@ YY_RULE_SETUP return_token_or_DOT(require_ARB_fp, MASK2); } YY_BREAK -case 173: +case 207: YY_RULE_SETUP -#line 422 "program_lexer.l" +#line 458 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2307,18 +2533,18 @@ YY_RULE_SETUP return_token_or_DOT(require_ARB_fp, MASK2); } YY_BREAK -case 174: +case 208: YY_RULE_SETUP -#line 428 "program_lexer.l" +#line 464 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; return_token_or_DOT(require_ARB_fp, MASK2); } YY_BREAK -case 175: +case 209: YY_RULE_SETUP -#line 434 "program_lexer.l" +#line 470 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2326,9 +2552,9 @@ YY_RULE_SETUP return_token_or_DOT(require_ARB_fp, MASK1); } YY_BREAK -case 176: +case 210: YY_RULE_SETUP -#line 442 "program_lexer.l" +#line 478 "program_lexer.l" { if (require_ARB_vp) { return TEXGEN_R; @@ -2340,9 +2566,9 @@ YY_RULE_SETUP } } YY_BREAK -case 177: +case 211: YY_RULE_SETUP -#line 453 "program_lexer.l" +#line 489 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2352,15 +2578,15 @@ YY_RULE_SETUP return_token_or_DOT(require_ARB_fp, SWIZZLE); } YY_BREAK -case 178: +case 212: YY_RULE_SETUP -#line 462 "program_lexer.l" +#line 498 "program_lexer.l" { return DOT; } YY_BREAK -case 179: -/* rule 179 can match eol */ +case 213: +/* rule 213 can match eol */ YY_RULE_SETUP -#line 464 "program_lexer.l" +#line 500 "program_lexer.l" { yylloc->first_line++; yylloc->first_column = 1; @@ -2369,30 +2595,30 @@ YY_RULE_SETUP yylloc->position++; } YY_BREAK -case 180: +case 214: YY_RULE_SETUP -#line 471 "program_lexer.l" +#line 507 "program_lexer.l" /* eat whitespace */ ; YY_BREAK -case 181: +case 215: *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 472 "program_lexer.l" +#line 508 "program_lexer.l" /* eat comments */ ; YY_BREAK -case 182: +case 216: YY_RULE_SETUP -#line 473 "program_lexer.l" +#line 509 "program_lexer.l" { return yytext[0]; } YY_BREAK -case 183: +case 217: YY_RULE_SETUP -#line 474 "program_lexer.l" +#line 510 "program_lexer.l" ECHO; YY_BREAK -#line 2396 "lex.yy.c" +#line 2622 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2686,7 +2912,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 675 ) + if ( yy_current_state >= 776 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -2715,11 +2941,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 675 ) + if ( yy_current_state >= 776 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 674); + yy_is_jam = (yy_current_state == 775); return yy_is_jam ? 0 : yy_current_state; } @@ -3567,7 +3793,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 474 "program_lexer.l" +#line 510 "program_lexer.l" diff --git a/src/mesa/shader/program_lexer.l b/src/mesa/shader/program_lexer.l index c50c7c5739..62ca9b6db6 100644 --- a/src/mesa/shader/program_lexer.l +++ b/src/mesa/shader/program_lexer.l @@ -29,6 +29,7 @@ #define require_ARB_vp (yyextra->mode == ARB_vertex) #define require_ARB_fp (yyextra->mode == ARB_fragment) +#define require_NV_fp (yyextra->option.NV_fragment) #define require_shadow (yyextra->option.Shadow) #define require_rect (yyextra->option.TexRect) #define require_texarray (yyextra->option.TexArray) @@ -159,6 +160,10 @@ CMP_SAT { return_opcode(require_ARB_fp, TRI_OP, CMP, ZERO_ONE); } COS { return_opcode(require_ARB_fp, SCALAR_OP, COS, OFF); } COS_SAT { return_opcode(require_ARB_fp, SCALAR_OP, COS, ZERO_ONE); } +DDX { return_opcode(require_NV_fp, VECTOR_OP, DDX, OFF); } +DDX_SAT { return_opcode(require_NV_fp, VECTOR_OP, DDX, ZERO_ONE); } +DDY { return_opcode(require_NV_fp, VECTOR_OP, DDY, OFF); } +DDY_SAT { return_opcode(require_NV_fp, VECTOR_OP, DDY, ZERO_ONE); } DP3 { return_opcode( 1, BIN_OP, DP3, OFF); } DP3_SAT { return_opcode(require_ARB_fp, BIN_OP, DP3, ZERO_ONE); } DP4 { return_opcode( 1, BIN_OP, DP4, OFF); } @@ -198,22 +203,44 @@ MOV_SAT { return_opcode(require_ARB_fp, VECTOR_OP, MOV, ZERO_ONE); } MUL { return_opcode( 1, BIN_OP, MUL, OFF); } MUL_SAT { return_opcode(require_ARB_fp, BIN_OP, MUL, ZERO_ONE); } +PK2H { return_opcode(require_NV_fp, VECTOR_OP, PK2H, OFF); } +PK2H_SAT { return_opcode(require_NV_fp, VECTOR_OP, PK2H, ZERO_ONE); } +PK2US { return_opcode(require_NV_fp, VECTOR_OP, PK2US, OFF); } +PK2US_SAT { return_opcode(require_NV_fp, VECTOR_OP, PK2US, ZERO_ONE); } +PK4B { return_opcode(require_NV_fp, VECTOR_OP, PK4B, OFF); } +PK4B_SAT { return_opcode(require_NV_fp, VECTOR_OP, PK4B, ZERO_ONE); } +PK4UB { return_opcode(require_NV_fp, VECTOR_OP, PK4UB, OFF); } +PK4UB_SAT { return_opcode(require_NV_fp, VECTOR_OP, PK4UB, ZERO_ONE); } POW { return_opcode( 1, BINSC_OP, POW, OFF); } POW_SAT { return_opcode(require_ARB_fp, BINSC_OP, POW, ZERO_ONE); } RCP { return_opcode( 1, SCALAR_OP, RCP, OFF); } RCP_SAT { return_opcode(require_ARB_fp, SCALAR_OP, RCP, ZERO_ONE); } +RFL { return_opcode(require_NV_fp, BIN_OP, RFL, OFF); } +RFL_SAT { return_opcode(require_NV_fp, BIN_OP, RFL, ZERO_ONE); } RSQ { return_opcode( 1, SCALAR_OP, RSQ, OFF); } RSQ_SAT { return_opcode(require_ARB_fp, SCALAR_OP, RSQ, ZERO_ONE); } SCS { return_opcode(require_ARB_fp, SCALAR_OP, SCS, OFF); } SCS_SAT { return_opcode(require_ARB_fp, SCALAR_OP, SCS, ZERO_ONE); } +SEQ { return_opcode(require_NV_fp, BIN_OP, SEQ, OFF); } +SEQ_SAT { return_opcode(require_NV_fp, BIN_OP, SEQ, ZERO_ONE); } +SFL { return_opcode(require_NV_fp, BIN_OP, SFL, OFF); } +SFL_SAT { return_opcode(require_NV_fp, BIN_OP, SFL, ZERO_ONE); } SGE { return_opcode( 1, BIN_OP, SGE, OFF); } SGE_SAT { return_opcode(require_ARB_fp, BIN_OP, SGE, ZERO_ONE); } +SGT { return_opcode(require_NV_fp, BIN_OP, SGT, OFF); } +SGT_SAT { return_opcode(require_NV_fp, BIN_OP, SGT, ZERO_ONE); } SIN { return_opcode(require_ARB_fp, SCALAR_OP, SIN, OFF); } SIN_SAT { return_opcode(require_ARB_fp, SCALAR_OP, SIN, ZERO_ONE); } +SLE { return_opcode(require_NV_fp, BIN_OP, SLE, OFF); } +SLE_SAT { return_opcode(require_NV_fp, BIN_OP, SLE, ZERO_ONE); } SLT { return_opcode( 1, BIN_OP, SLT, OFF); } SLT_SAT { return_opcode(require_ARB_fp, BIN_OP, SLT, ZERO_ONE); } +SNE { return_opcode(require_NV_fp, BIN_OP, SNE, OFF); } +SNE_SAT { return_opcode(require_NV_fp, BIN_OP, SNE, ZERO_ONE); } +STR { return_opcode(require_NV_fp, BIN_OP, STR, OFF); } +STR_SAT { return_opcode(require_NV_fp, BIN_OP, STR, ZERO_ONE); } SUB { return_opcode( 1, BIN_OP, SUB, OFF); } SUB_SAT { return_opcode(require_ARB_fp, BIN_OP, SUB, ZERO_ONE); } SWZ { return_opcode( 1, SWZ, SWZ, OFF); } @@ -223,9 +250,18 @@ TEX { return_opcode(require_ARB_fp, SAMPLE_OP, TEX, OFF); } TEX_SAT { return_opcode(require_ARB_fp, SAMPLE_OP, TEX, ZERO_ONE); } TXB { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, OFF); } TXB_SAT { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, ZERO_ONE); } +TXD { return_opcode(require_NV_fp, TXD_OP, TXD, OFF); } +TXD_SAT { return_opcode(require_NV_fp, TXD_OP, TXD, ZERO_ONE); } TXP { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, OFF); } TXP_SAT { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, ZERO_ONE); } +UP2H { return_opcode(require_NV_fp, SCALAR_OP, UP2H, OFF); } +UP2H_SAT { return_opcode(require_NV_fp, SCALAR_OP, UP2H, ZERO_ONE); } +UP2US { return_opcode(require_NV_fp, SCALAR_OP, UP2US, OFF); } +UP2US_SAT { return_opcode(require_NV_fp, SCALAR_OP, UP2US, ZERO_ONE); } + +X2D { return_opcode(require_NV_fp, TRI_OP, X2D, OFF); } +X2D_SAT { return_opcode(require_NV_fp, TRI_OP, X2D, ZERO_ONE); } XPD { return_opcode( 1, BIN_OP, XPD, OFF); } XPD_SAT { return_opcode(require_ARB_fp, BIN_OP, XPD, ZERO_ONE); } diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c index 5c604c2fd1..4108374652 100644 --- a/src/mesa/shader/program_parse.tab.c +++ b/src/mesa/shader/program_parse.tab.c @@ -216,90 +216,91 @@ static struct asm_instruction *asm_instruction_ctor(gl_inst_opcode op, ARL = 274, KIL = 275, SWZ = 276, - INTEGER = 277, - REAL = 278, - AMBIENT = 279, - ATTENUATION = 280, - BACK = 281, - CLIP = 282, - COLOR = 283, - DEPTH = 284, - DIFFUSE = 285, - DIRECTION = 286, - EMISSION = 287, - ENV = 288, - EYE = 289, - FOG = 290, - FOGCOORD = 291, - FRAGMENT = 292, - FRONT = 293, - HALF = 294, - INVERSE = 295, - INVTRANS = 296, - LIGHT = 297, - LIGHTMODEL = 298, - LIGHTPROD = 299, - LOCAL = 300, - MATERIAL = 301, - MAT_PROGRAM = 302, - MATRIX = 303, - MATRIXINDEX = 304, - MODELVIEW = 305, - MVP = 306, - NORMAL = 307, - OBJECT = 308, - PALETTE = 309, - PARAMS = 310, - PLANE = 311, - POINT = 312, - POINTSIZE = 313, - POSITION = 314, - PRIMARY = 315, - PROGRAM = 316, - PROJECTION = 317, - RANGE = 318, - RESULT = 319, - ROW = 320, - SCENECOLOR = 321, - SECONDARY = 322, - SHININESS = 323, - SIZE = 324, - SPECULAR = 325, - SPOT = 326, - STATE = 327, - TEXCOORD = 328, - TEXENV = 329, - TEXGEN = 330, - TEXGEN_Q = 331, - TEXGEN_R = 332, - TEXGEN_S = 333, - TEXGEN_T = 334, - TEXTURE = 335, - TRANSPOSE = 336, - TEXTURE_UNIT = 337, - TEX_1D = 338, - TEX_2D = 339, - TEX_3D = 340, - TEX_CUBE = 341, - TEX_RECT = 342, - TEX_SHADOW1D = 343, - TEX_SHADOW2D = 344, - TEX_SHADOWRECT = 345, - TEX_ARRAY1D = 346, - TEX_ARRAY2D = 347, - TEX_ARRAYSHADOW1D = 348, - TEX_ARRAYSHADOW2D = 349, - VERTEX = 350, - VTXATTRIB = 351, - WEIGHT = 352, - IDENTIFIER = 353, - MASK4 = 354, - MASK3 = 355, - MASK2 = 356, - MASK1 = 357, - SWIZZLE = 358, - DOT_DOT = 359, - DOT = 360 + TXD_OP = 277, + INTEGER = 278, + REAL = 279, + AMBIENT = 280, + ATTENUATION = 281, + BACK = 282, + CLIP = 283, + COLOR = 284, + DEPTH = 285, + DIFFUSE = 286, + DIRECTION = 287, + EMISSION = 288, + ENV = 289, + EYE = 290, + FOG = 291, + FOGCOORD = 292, + FRAGMENT = 293, + FRONT = 294, + HALF = 295, + INVERSE = 296, + INVTRANS = 297, + LIGHT = 298, + LIGHTMODEL = 299, + LIGHTPROD = 300, + LOCAL = 301, + MATERIAL = 302, + MAT_PROGRAM = 303, + MATRIX = 304, + MATRIXINDEX = 305, + MODELVIEW = 306, + MVP = 307, + NORMAL = 308, + OBJECT = 309, + PALETTE = 310, + PARAMS = 311, + PLANE = 312, + POINT = 313, + POINTSIZE = 314, + POSITION = 315, + PRIMARY = 316, + PROGRAM = 317, + PROJECTION = 318, + RANGE = 319, + RESULT = 320, + ROW = 321, + SCENECOLOR = 322, + SECONDARY = 323, + SHININESS = 324, + SIZE = 325, + SPECULAR = 326, + SPOT = 327, + STATE = 328, + TEXCOORD = 329, + TEXENV = 330, + TEXGEN = 331, + TEXGEN_Q = 332, + TEXGEN_R = 333, + TEXGEN_S = 334, + TEXGEN_T = 335, + TEXTURE = 336, + TRANSPOSE = 337, + TEXTURE_UNIT = 338, + TEX_1D = 339, + TEX_2D = 340, + TEX_3D = 341, + TEX_CUBE = 342, + TEX_RECT = 343, + TEX_SHADOW1D = 344, + TEX_SHADOW2D = 345, + TEX_SHADOWRECT = 346, + TEX_ARRAY1D = 347, + TEX_ARRAY2D = 348, + TEX_ARRAYSHADOW1D = 349, + TEX_ARRAYSHADOW2D = 350, + VERTEX = 351, + VTXATTRIB = 352, + WEIGHT = 353, + IDENTIFIER = 354, + MASK4 = 355, + MASK3 = 356, + MASK2 = 357, + MASK1 = 358, + SWIZZLE = 359, + DOT_DOT = 360, + DOT = 361 }; #endif @@ -339,7 +340,7 @@ typedef union YYSTYPE /* Line 214 of yacc.c */ -#line 343 "program_parse.tab.c" +#line 344 "program_parse.tab.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -370,7 +371,7 @@ extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, /* Line 264 of yacc.c */ -#line 374 "program_parse.tab.c" +#line 375 "program_parse.tab.c" #ifdef short # undef short @@ -590,7 +591,7 @@ union yyalloc #define YYLAST 340 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 115 +#define YYNTOKENS 116 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 134 /* YYNRULES -- Number of rules. */ @@ -600,7 +601,7 @@ union yyalloc /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 360 +#define YYMAXUTOK 361 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -612,15 +613,15 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 110, 107, 111, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 106, - 2, 112, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 111, 108, 112, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 107, + 2, 113, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 108, 2, 109, 2, 2, 2, 2, 2, 2, + 2, 109, 2, 110, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 113, 2, 114, 2, 2, 2, 2, + 2, 2, 2, 114, 2, 115, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -644,7 +645,7 @@ static const yytype_uint8 yytranslate[] = 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105 + 105, 106 }; #if YYDEBUG @@ -684,80 +685,80 @@ static const yytype_uint16 yyprhs[] = /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { - 116, 0, -1, 117, 118, 120, 12, -1, 3, -1, - 4, -1, 118, 119, -1, -1, 8, 98, 106, -1, - 120, 121, -1, -1, 122, 106, -1, 158, 106, -1, - 123, -1, 124, -1, 125, -1, 126, -1, 127, -1, - 128, -1, 129, -1, 130, -1, 135, -1, 131, -1, - 132, -1, 19, 139, 107, 136, -1, 18, 138, 107, - 137, -1, 16, 138, 107, 136, -1, 14, 138, 107, - 136, 107, 136, -1, 13, 138, 107, 137, 107, 137, - -1, 17, 138, 107, 137, 107, 137, 107, 137, -1, - 15, 138, 107, 137, 107, 133, 107, 134, -1, 20, - 137, -1, 82, 243, -1, 83, -1, 84, -1, 85, - -1, 86, -1, 87, -1, 88, -1, 89, -1, 90, - -1, 91, -1, 92, -1, 93, -1, 94, -1, 21, - 138, 107, 143, 107, 140, -1, 229, 143, 155, -1, - 229, 143, 156, -1, 144, 157, -1, 152, 154, -1, - 141, 107, 141, 107, 141, 107, 141, -1, 229, 142, - -1, 22, -1, 98, -1, 98, -1, 160, -1, 145, - 108, 146, 109, -1, 174, -1, 236, -1, 98, -1, - 98, -1, 147, -1, 148, -1, 22, -1, 152, 153, - 149, -1, -1, 110, 150, -1, 111, 151, -1, 22, - -1, 22, -1, 98, -1, 102, -1, 102, -1, 102, - -1, 102, -1, 99, -1, 103, -1, -1, 99, -1, - 100, -1, 101, -1, 102, -1, -1, 159, -1, 166, - -1, 230, -1, 232, -1, 235, -1, 248, -1, 7, - 98, 112, 160, -1, 95, 161, -1, 37, 165, -1, - 59, -1, 97, 163, -1, 52, -1, 28, 241, -1, - 36, -1, 73, 242, -1, 49, 108, 164, 109, -1, - 96, 108, 162, 109, -1, 22, -1, -1, 108, 164, - 109, -1, 22, -1, 59, -1, 28, 241, -1, 36, - -1, 73, 242, -1, 167, -1, 168, -1, 10, 98, - 170, -1, 10, 98, 108, 169, 109, 171, -1, -1, - 22, -1, 112, 173, -1, 112, 113, 172, 114, -1, - 175, -1, 172, 107, 175, -1, 177, -1, 213, -1, - 223, -1, 177, -1, 213, -1, 224, -1, 176, -1, - 214, -1, 223, -1, 177, -1, 72, 201, -1, 72, - 178, -1, 72, 180, -1, 72, 183, -1, 72, 185, - -1, 72, 191, -1, 72, 187, -1, 72, 194, -1, - 72, 196, -1, 72, 198, -1, 72, 200, -1, 72, - 212, -1, 46, 240, 179, -1, 189, -1, 32, -1, - 68, -1, 42, 108, 190, 109, 181, -1, 189, -1, - 59, -1, 25, -1, 71, 182, -1, 39, -1, 31, - -1, 43, 184, -1, 24, -1, 240, 66, -1, 44, - 108, 190, 109, 240, 186, -1, 189, -1, 74, 244, - 188, -1, 28, -1, 24, -1, 30, -1, 70, -1, - 22, -1, 75, 242, 192, 193, -1, 34, -1, 53, - -1, 78, -1, 79, -1, 77, -1, 76, -1, 35, - 195, -1, 28, -1, 55, -1, 27, 108, 197, 109, - 56, -1, 22, -1, 57, 199, -1, 69, -1, 25, - -1, 203, 65, 108, 206, 109, -1, 203, 202, -1, - -1, 65, 108, 206, 104, 206, 109, -1, 48, 207, - 204, -1, -1, 205, -1, 40, -1, 81, -1, 41, - -1, 22, -1, 50, 208, -1, 62, -1, 51, -1, - 80, 242, -1, 54, 108, 210, 109, -1, 47, 108, - 211, 109, -1, -1, 209, -1, 22, -1, 22, -1, - 22, -1, 29, 63, -1, 217, -1, 220, -1, 215, - -1, 218, -1, 61, 33, 108, 216, 109, -1, 221, - -1, 221, 104, 221, -1, 61, 33, 108, 221, 109, - -1, 61, 45, 108, 219, 109, -1, 222, -1, 222, - 104, 222, -1, 61, 45, 108, 222, 109, -1, 22, - -1, 22, -1, 225, -1, 227, -1, 226, -1, 227, - -1, 228, -1, 23, -1, 22, -1, 113, 228, 114, - -1, 113, 228, 107, 228, 114, -1, 113, 228, 107, - 228, 107, 228, 114, -1, 113, 228, 107, 228, 107, - 228, 107, 228, 114, -1, 229, 23, -1, 229, 22, - -1, 110, -1, 111, -1, -1, -1, 11, 231, 234, - -1, -1, 5, 233, 234, -1, 234, 107, 98, -1, - 98, -1, 9, 98, 112, 236, -1, 64, 59, -1, - 64, 36, -1, 64, 237, -1, 64, 58, -1, 64, - 73, 242, -1, 64, 29, -1, 28, 238, 239, -1, - -1, 38, -1, 26, -1, -1, 60, -1, 67, -1, - -1, 38, -1, 26, -1, -1, 60, -1, 67, -1, - -1, 108, 245, 109, -1, -1, 108, 246, 109, -1, - -1, 108, 247, 109, -1, 22, -1, 22, -1, 22, - -1, 6, 98, 112, 98, -1 + 117, 0, -1, 118, 119, 121, 12, -1, 3, -1, + 4, -1, 119, 120, -1, -1, 8, 99, 107, -1, + 121, 122, -1, -1, 123, 107, -1, 159, 107, -1, + 124, -1, 125, -1, 126, -1, 127, -1, 128, -1, + 129, -1, 130, -1, 131, -1, 136, -1, 132, -1, + 133, -1, 19, 140, 108, 137, -1, 18, 139, 108, + 138, -1, 16, 139, 108, 137, -1, 14, 139, 108, + 137, 108, 137, -1, 13, 139, 108, 138, 108, 138, + -1, 17, 139, 108, 138, 108, 138, 108, 138, -1, + 15, 139, 108, 138, 108, 134, 108, 135, -1, 20, + 138, -1, 83, 244, -1, 84, -1, 85, -1, 86, + -1, 87, -1, 88, -1, 89, -1, 90, -1, 91, + -1, 92, -1, 93, -1, 94, -1, 95, -1, 21, + 139, 108, 144, 108, 141, -1, 230, 144, 156, -1, + 230, 144, 157, -1, 145, 158, -1, 153, 155, -1, + 142, 108, 142, 108, 142, 108, 142, -1, 230, 143, + -1, 23, -1, 99, -1, 99, -1, 161, -1, 146, + 109, 147, 110, -1, 175, -1, 237, -1, 99, -1, + 99, -1, 148, -1, 149, -1, 23, -1, 153, 154, + 150, -1, -1, 111, 151, -1, 112, 152, -1, 23, + -1, 23, -1, 99, -1, 103, -1, 103, -1, 103, + -1, 103, -1, 100, -1, 104, -1, -1, 100, -1, + 101, -1, 102, -1, 103, -1, -1, 160, -1, 167, + -1, 231, -1, 233, -1, 236, -1, 249, -1, 7, + 99, 113, 161, -1, 96, 162, -1, 38, 166, -1, + 60, -1, 98, 164, -1, 53, -1, 29, 242, -1, + 37, -1, 74, 243, -1, 50, 109, 165, 110, -1, + 97, 109, 163, 110, -1, 23, -1, -1, 109, 165, + 110, -1, 23, -1, 60, -1, 29, 242, -1, 37, + -1, 74, 243, -1, 168, -1, 169, -1, 10, 99, + 171, -1, 10, 99, 109, 170, 110, 172, -1, -1, + 23, -1, 113, 174, -1, 113, 114, 173, 115, -1, + 176, -1, 173, 108, 176, -1, 178, -1, 214, -1, + 224, -1, 178, -1, 214, -1, 225, -1, 177, -1, + 215, -1, 224, -1, 178, -1, 73, 202, -1, 73, + 179, -1, 73, 181, -1, 73, 184, -1, 73, 186, + -1, 73, 192, -1, 73, 188, -1, 73, 195, -1, + 73, 197, -1, 73, 199, -1, 73, 201, -1, 73, + 213, -1, 47, 241, 180, -1, 190, -1, 33, -1, + 69, -1, 43, 109, 191, 110, 182, -1, 190, -1, + 60, -1, 26, -1, 72, 183, -1, 40, -1, 32, + -1, 44, 185, -1, 25, -1, 241, 67, -1, 45, + 109, 191, 110, 241, 187, -1, 190, -1, 75, 245, + 189, -1, 29, -1, 25, -1, 31, -1, 71, -1, + 23, -1, 76, 243, 193, 194, -1, 35, -1, 54, + -1, 79, -1, 80, -1, 78, -1, 77, -1, 36, + 196, -1, 29, -1, 56, -1, 28, 109, 198, 110, + 57, -1, 23, -1, 58, 200, -1, 70, -1, 26, + -1, 204, 66, 109, 207, 110, -1, 204, 203, -1, + -1, 66, 109, 207, 105, 207, 110, -1, 49, 208, + 205, -1, -1, 206, -1, 41, -1, 82, -1, 42, + -1, 23, -1, 51, 209, -1, 63, -1, 52, -1, + 81, 243, -1, 55, 109, 211, 110, -1, 48, 109, + 212, 110, -1, -1, 210, -1, 23, -1, 23, -1, + 23, -1, 30, 64, -1, 218, -1, 221, -1, 216, + -1, 219, -1, 62, 34, 109, 217, 110, -1, 222, + -1, 222, 105, 222, -1, 62, 34, 109, 222, 110, + -1, 62, 46, 109, 220, 110, -1, 223, -1, 223, + 105, 223, -1, 62, 46, 109, 223, 110, -1, 23, + -1, 23, -1, 226, -1, 228, -1, 227, -1, 228, + -1, 229, -1, 24, -1, 23, -1, 114, 229, 115, + -1, 114, 229, 108, 229, 115, -1, 114, 229, 108, + 229, 108, 229, 115, -1, 114, 229, 108, 229, 108, + 229, 108, 229, 115, -1, 230, 24, -1, 230, 23, + -1, 111, -1, 112, -1, -1, -1, 11, 232, 235, + -1, -1, 5, 234, 235, -1, 235, 108, 99, -1, + 99, -1, 9, 99, 113, 237, -1, 65, 60, -1, + 65, 37, -1, 65, 238, -1, 65, 59, -1, 65, + 74, 243, -1, 65, 30, -1, 29, 239, 240, -1, + -1, 39, -1, 27, -1, -1, 61, -1, 68, -1, + -1, 39, -1, 27, -1, -1, 61, -1, 68, -1, + -1, 109, 246, 110, -1, -1, 109, 247, 110, -1, + -1, 109, 248, 110, -1, 23, -1, 23, -1, 23, + -1, 6, 99, 113, 99, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -801,9 +802,9 @@ static const char *const yytname[] = "$end", "error", "$undefined", "ARBvp_10", "ARBfp_10", "ADDRESS", "ALIAS", "ATTRIB", "OPTION", "OUTPUT", "PARAM", "TEMP", "END", "BIN_OP", "BINSC_OP", "SAMPLE_OP", "SCALAR_OP", "TRI_OP", "VECTOR_OP", "ARL", - "KIL", "SWZ", "INTEGER", "REAL", "AMBIENT", "ATTENUATION", "BACK", - "CLIP", "COLOR", "DEPTH", "DIFFUSE", "DIRECTION", "EMISSION", "ENV", - "EYE", "FOG", "FOGCOORD", "FRAGMENT", "FRONT", "HALF", "INVERSE", + "KIL", "SWZ", "TXD_OP", "INTEGER", "REAL", "AMBIENT", "ATTENUATION", + "BACK", "CLIP", "COLOR", "DEPTH", "DIFFUSE", "DIRECTION", "EMISSION", + "ENV", "EYE", "FOG", "FOGCOORD", "FRAGMENT", "FRONT", "HALF", "INVERSE", "INVTRANS", "LIGHT", "LIGHTMODEL", "LIGHTPROD", "LOCAL", "MATERIAL", "MAT_PROGRAM", "MATRIX", "MATRIXINDEX", "MODELVIEW", "MVP", "NORMAL", "OBJECT", "PALETTE", "PARAMS", "PLANE", "POINT", "POINTSIZE", "POSITION", @@ -875,41 +876,41 @@ static const yytype_uint16 yytoknum[] = 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 59, 44, 91, 93, - 43, 45, 61, 123, 125 + 355, 356, 357, 358, 359, 360, 361, 59, 44, 91, + 93, 43, 45, 61, 123, 125 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 115, 116, 117, 117, 118, 118, 119, 120, 120, - 121, 121, 122, 122, 123, 123, 123, 123, 123, 123, - 123, 124, 124, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 134, 134, 134, 134, 134, 134, 134, - 134, 134, 134, 134, 135, 136, 137, 138, 139, 140, - 141, 142, 142, 143, 143, 143, 143, 144, 144, 145, - 146, 146, 147, 148, 149, 149, 149, 150, 151, 152, - 153, 154, 155, 156, 156, 156, 156, 157, 157, 157, - 157, 157, 158, 158, 158, 158, 158, 158, 159, 160, - 160, 161, 161, 161, 161, 161, 161, 161, 161, 162, - 163, 163, 164, 165, 165, 165, 165, 166, 166, 167, - 168, 169, 169, 170, 171, 172, 172, 173, 173, 173, - 174, 174, 174, 175, 175, 175, 176, 176, 177, 177, - 177, 177, 177, 177, 177, 177, 177, 177, 177, 178, - 179, 179, 179, 180, 181, 181, 181, 181, 181, 182, - 183, 184, 184, 185, 186, 187, 188, 189, 189, 189, - 190, 191, 192, 192, 193, 193, 193, 193, 194, 195, - 195, 196, 197, 198, 199, 199, 200, 201, 202, 202, - 203, 204, 204, 205, 205, 205, 206, 207, 207, 207, - 207, 207, 207, 208, 208, 209, 210, 211, 212, 213, - 213, 214, 214, 215, 216, 216, 217, 218, 219, 219, - 220, 221, 222, 223, 223, 224, 224, 225, 226, 226, - 227, 227, 227, 227, 228, 228, 229, 229, 229, 231, - 230, 233, 232, 234, 234, 235, 236, 236, 236, 236, - 236, 236, 237, 238, 238, 238, 239, 239, 239, 240, - 240, 240, 241, 241, 241, 242, 242, 243, 243, 244, - 244, 245, 246, 247, 248 + 0, 116, 117, 118, 118, 119, 119, 120, 121, 121, + 122, 122, 123, 123, 124, 124, 124, 124, 124, 124, + 124, 125, 125, 126, 127, 128, 129, 130, 131, 132, + 133, 134, 135, 135, 135, 135, 135, 135, 135, 135, + 135, 135, 135, 135, 136, 137, 138, 139, 140, 141, + 142, 143, 143, 144, 144, 144, 144, 145, 145, 146, + 147, 147, 148, 149, 150, 150, 150, 151, 152, 153, + 154, 155, 156, 157, 157, 157, 157, 158, 158, 158, + 158, 158, 159, 159, 159, 159, 159, 159, 160, 161, + 161, 162, 162, 162, 162, 162, 162, 162, 162, 163, + 164, 164, 165, 166, 166, 166, 166, 167, 167, 168, + 169, 170, 170, 171, 172, 173, 173, 174, 174, 174, + 175, 175, 175, 176, 176, 176, 177, 177, 178, 178, + 178, 178, 178, 178, 178, 178, 178, 178, 178, 179, + 180, 180, 180, 181, 182, 182, 182, 182, 182, 183, + 184, 185, 185, 186, 187, 188, 189, 190, 190, 190, + 191, 192, 193, 193, 194, 194, 194, 194, 195, 196, + 196, 197, 198, 199, 200, 200, 201, 202, 203, 203, + 204, 205, 205, 206, 206, 206, 207, 208, 208, 208, + 208, 208, 208, 209, 209, 210, 211, 212, 213, 214, + 214, 215, 215, 216, 217, 217, 218, 219, 220, 220, + 221, 222, 223, 224, 224, 225, 225, 226, 227, 227, + 228, 228, 228, 228, 229, 229, 230, 230, 230, 232, + 231, 234, 233, 235, 235, 236, 237, 237, 237, 237, + 237, 237, 238, 239, 239, 239, 240, 240, 240, 241, + 241, 241, 242, 242, 242, 243, 243, 244, 244, 245, + 245, 246, 247, 248, 249 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -1019,50 +1020,50 @@ static const yytype_int16 yydefgoto[] = #define YYPACT_NINF -334 static const yytype_int16 yypact[] = { - 134, -334, -334, 41, -334, -334, 47, -49, -334, 169, - 20, -334, 34, 61, 75, 115, -334, -334, -19, -19, - -19, -19, -19, -19, 116, 44, -19, -334, 109, -334, + 134, -334, -334, 41, -334, -334, 47, -50, -334, 169, + 19, -334, 33, 60, 74, 114, -334, -334, -20, -20, + -20, -20, -20, -20, 115, 43, -20, -334, 108, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, - 110, -334, -334, -334, -334, -334, -334, -334, -334, -334, - 119, 106, 107, 111, -22, 119, 4, -334, 5, 104, - -334, 113, 114, 117, 118, 120, -334, 121, 124, -334, - -334, -334, -15, 122, -334, -334, -334, 123, 133, -14, - 158, 210, -11, -334, 123, 21, -334, -334, -334, -334, - 127, -334, 44, -334, -334, -334, -334, -334, 44, 44, - 44, 44, 44, 44, -334, -334, -334, -334, 1, 68, - 87, -1, 132, 44, 65, 135, -334, -334, -334, -334, - -334, -334, -334, -334, -334, -15, 141, -334, -334, -334, - -334, 136, -334, -334, -334, -334, -334, -334, -334, 149, - -334, -334, 58, 219, -334, 137, 139, -15, 140, -334, - 142, -334, -334, 74, -334, -334, 127, -334, 143, 144, - 145, 179, 15, 146, 81, 147, 83, 89, 0, 148, - 127, -334, -334, -334, -334, -334, -334, -334, -334, -334, - -334, 183, -334, 74, -334, 150, -334, -334, 127, 151, - 152, -334, 43, -334, -334, -334, -334, -10, 155, -334, - 138, -334, -334, -334, -334, -334, -334, 154, 44, 44, - 162, 175, 44, -334, -334, -334, -334, 243, 245, 246, - -334, -334, -334, -334, 247, -334, -334, -334, -334, 204, - 247, -4, 163, 250, -334, 165, -334, 127, 27, -334, - -334, -334, 252, 248, 18, 167, -334, 255, -334, 256, - 255, -334, 44, -334, -334, 170, -334, -334, 178, 44, - 168, -334, -334, -334, -334, -334, -334, 174, 176, 177, - -334, 180, -334, 181, -334, 182, -334, 184, -334, 185, + 109, -334, -334, -334, -334, -334, -334, -334, -334, -334, + 118, 105, 106, 110, -23, 118, 3, -334, 4, 103, + -334, 112, 113, 116, 117, 119, -334, 120, 123, -334, + -334, -334, -16, 121, -334, -334, -334, 122, 132, -15, + 157, 209, -12, -334, 122, 20, -334, -334, -334, -334, + 131, -334, 43, -334, -334, -334, -334, -334, 43, 43, + 43, 43, 43, 43, -334, -334, -334, -334, 0, 67, + 86, -2, 133, 43, 64, 135, -334, -334, -334, -334, + -334, -334, -334, -334, -334, -16, 136, -334, -334, -334, + -334, 129, -334, -334, -334, -334, -334, -334, -334, 148, + -334, -334, 57, 218, -334, 137, 138, -16, 139, -334, + 140, -334, -334, 73, -334, -334, 131, -334, 141, 142, + 143, 179, 14, 144, 80, 145, 82, 88, -1, 146, + 131, -334, -334, -334, -334, -334, -334, -334, -334, -334, + -334, 183, -334, 73, -334, 147, -334, -334, 131, 149, + 150, -334, 42, -334, -334, -334, -334, -11, 152, -334, + 151, -334, -334, -334, -334, -334, -334, 153, 43, 43, + 154, 182, 43, -334, -334, -334, -334, 239, 244, 245, + -334, -334, -334, -334, 246, -334, -334, -334, -334, 203, + 246, -5, 162, 249, -334, 164, -334, 131, 26, -334, + -334, -334, 251, 247, 17, 166, -334, 254, -334, 255, + 254, -334, 43, -334, -334, 170, -334, -334, 176, 43, + 167, -334, -334, -334, -334, -334, -334, 173, 175, 177, + -334, 174, -334, 178, -334, 180, -334, 181, -334, 184, -334, -334, -334, -334, -334, -334, -334, 263, -334, -334, - -334, 264, -334, -334, -334, -334, -334, -334, -334, 186, - -334, -334, -334, -334, 131, 265, -334, 188, -334, 189, - 190, 46, -334, -334, 101, -334, 193, -5, -7, 266, - -334, 108, 44, -334, -334, 236, 14, 83, -334, 192, - -334, 194, -334, -334, -334, -334, -334, -334, -334, 195, - -334, -334, -334, 44, -334, 280, 283, -334, 44, -334, - -334, -334, 78, 87, 49, -334, -334, -334, -334, -334, - -334, -334, -334, 197, -334, -334, -334, -334, -334, -334, + -334, 264, -334, -334, -334, -334, -334, -334, -334, 185, + -334, -334, -334, -334, 130, 266, -334, 187, -334, 188, + 189, 45, -334, -334, 100, -334, 192, -6, -8, 269, + -334, 107, 43, -334, -334, 236, 13, 82, -334, 191, + -334, 193, -334, -334, -334, -334, -334, -334, -334, 194, + -334, -334, -334, 43, -334, 279, 282, -334, 43, -334, + -334, -334, 77, 86, 48, -334, -334, -334, -334, -334, + -334, -334, -334, 196, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, - -334, -334, 276, -334, -334, 6, -334, -334, -334, 51, - -334, -334, -334, -334, 201, 202, 203, -334, 244, -7, - -334, -334, -334, -334, -334, -334, 44, -334, 44, 243, - 245, 205, -334, -334, 198, 207, 206, 212, 211, 217, - 265, -334, 44, -334, 243, -334, 245, -17, -334, -334, - -334, 265, 213, -334 + -334, -334, 275, -334, -334, 5, -334, -334, -334, 50, + -334, -334, -334, -334, 200, 201, 202, -334, 243, -8, + -334, -334, -334, -334, -334, -334, 43, -334, 43, 239, + 244, 204, -334, -334, 197, 206, 205, 211, 210, 216, + 266, -334, 43, -334, 239, -334, 244, -18, -334, -334, + -334, 266, 212, -334 }; /* YYPGOTO[NTERM-NUM]. */ @@ -1072,15 +1073,15 @@ static const yytype_int16 yypgoto[] = -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -94, -88, 126, -334, -334, -333, -334, -91, -334, -334, -334, -334, -334, -334, -334, -334, 128, -334, -334, - -334, -334, -334, -334, -334, 249, -334, -334, -334, 73, + -334, -334, -334, -334, -334, 248, -334, -334, -334, 78, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, - -72, -334, -81, -334, -334, -334, -334, -334, -334, -334, + -76, -334, -81, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, -307, 99, -334, -334, -334, -334, - -334, -334, -334, -334, -334, -334, -334, -334, -23, -334, - -334, -303, -334, -334, -334, -334, -334, -334, 251, -334, - -334, -334, -334, -334, -334, -334, -327, -316, 253, -334, - -334, -334, -80, -110, -82, -334, -334, -334, -334, 277, - -334, 254, -334, -334, -334, -161, 153, -146, -334, -334, + -334, -334, -334, -334, -334, -334, -334, -334, -22, -334, + -334, -303, -334, -334, -334, -334, -334, -334, 250, -334, + -334, -334, -334, -334, -334, -334, -327, -316, 252, -334, + -334, -334, -80, -110, -82, -334, -334, -334, -334, 278, + -334, 256, -334, -334, -334, -161, 155, -146, -334, -334, -334, -334, -334, -334 }; @@ -1114,56 +1115,56 @@ static const yytype_int16 yytable[] = 373, 374, 375, 93, 94, 95, 96, 333, 334, 335, 336, 345, 346, 54, 66, 74, 75, 76, 78, 79, 98, 99, 56, 80, 100, 101, 104, 102, 103, 125, - 126, 127, 130, 389, 377, 143, 139, 357, 137, 199, - -59, 206, 220, 197, 208, 200, 209, 211, 245, 212, - 260, 217, 218, 219, 224, 230, 242, 267, 247, 249, - 250, 139, 259, 262, 265, 270, 317, 272, 274, 276, - 278, 287, 288, 291, 298, 305, 300, 306, 308, 312, - 313, 318, 319, 321, 322, 328, 330, 338, 362, 323, - 324, 325, 378, 326, 327, 332, 414, 340, 341, 342, + 126, 127, 130, 389, 377, 199, 139, 357, 137, 200, + 143, 206, -59, 220, 197, 208, 209, 211, 212, 245, + 217, 218, 219, 224, 230, 242, 247, 265, 249, 250, + 259, 139, 270, 262, 260, 267, 317, 272, 274, 276, + 278, 287, 288, 291, 298, 305, 300, 306, 308, 313, + 312, 318, 319, 321, 323, 322, 328, 330, 324, 338, + 325, 326, 362, 378, 327, 332, 414, 340, 341, 342, 348, 386, 390, 387, 388, 392, 401, 402, 408, 411, 409, 410, 421, 420, 422, 423, 424, 139, 357, 137, - 425, 426, 433, 310, 139, 258, 317, 413, 128, 279, - 398, 0, 84, 134, 129, 135, 246, 0, 0, 0, + 425, 426, 433, 413, 139, 258, 317, 128, 310, 279, + 0, 398, 134, 84, 135, 0, 129, 0, 246, 0, 317 }; static const yytype_int16 yycheck[] = { - 82, 82, 82, 113, 92, 166, 100, 22, 23, 103, - 156, 99, 22, 101, 102, 348, 98, 22, 100, 326, - 24, 103, 37, 37, 170, 25, 30, 28, 32, 28, - 24, 113, 28, 29, 125, 36, 30, 36, 24, 25, - 36, 0, 188, 28, 30, 64, 61, 26, 49, 98, - 61, 52, 34, 39, 61, 8, 147, 72, 59, 38, - 59, 72, 58, 59, 68, 72, 70, 40, 41, 69, - 55, 53, 73, 59, 73, 408, 70, 73, 385, 98, - 95, 95, 409, 98, 70, 71, 108, 104, 98, 422, - 112, 237, 109, 98, 410, 96, 97, 424, 113, 110, - 111, 33, 113, 110, 111, 24, 113, 26, 81, 26, - 426, 33, 107, 45, 27, 209, 29, 420, 60, 38, - 208, 38, 35, 45, 212, 67, 106, 209, 431, 42, - 43, 44, 98, 46, 60, 48, 47, 3, 4, 50, - 51, 67, 252, 54, 57, 19, 20, 21, 22, 23, - 107, 62, 26, 107, 110, 111, 107, 114, 107, 98, - 114, 74, 75, 114, 99, 114, 327, 102, 103, 80, - 252, 22, 23, 98, 5, 6, 7, 259, 9, 10, + 82, 82, 82, 113, 92, 166, 100, 23, 24, 103, + 156, 99, 23, 101, 102, 348, 98, 23, 100, 326, + 25, 103, 38, 38, 170, 26, 31, 29, 33, 29, + 25, 113, 29, 30, 125, 37, 31, 37, 25, 26, + 37, 0, 188, 29, 31, 65, 62, 27, 50, 99, + 62, 53, 35, 40, 62, 8, 147, 73, 60, 39, + 60, 73, 59, 60, 69, 73, 71, 41, 42, 70, + 56, 54, 74, 60, 74, 408, 71, 74, 385, 99, + 96, 96, 409, 99, 71, 72, 109, 105, 99, 422, + 113, 237, 110, 99, 410, 97, 98, 424, 114, 111, + 112, 34, 114, 111, 112, 25, 114, 27, 82, 27, + 426, 34, 108, 46, 28, 209, 30, 420, 61, 39, + 208, 39, 36, 46, 212, 68, 107, 209, 431, 43, + 44, 45, 99, 47, 61, 49, 48, 3, 4, 51, + 52, 68, 252, 55, 58, 19, 20, 21, 22, 23, + 108, 63, 26, 108, 111, 112, 108, 115, 108, 99, + 115, 75, 76, 115, 100, 115, 327, 103, 104, 81, + 252, 23, 24, 99, 5, 6, 7, 259, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 83, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 99, 100, 101, 102, 76, 77, 78, - 79, 110, 111, 98, 98, 106, 106, 98, 112, 112, - 107, 107, 64, 112, 107, 107, 102, 107, 107, 107, - 107, 98, 22, 343, 322, 108, 318, 318, 318, 98, - 108, 22, 63, 108, 107, 109, 107, 107, 65, 107, - 112, 108, 108, 108, 108, 108, 108, 82, 108, 108, - 108, 343, 107, 109, 102, 22, 348, 22, 22, 22, - 66, 108, 22, 108, 22, 108, 28, 22, 22, 109, - 102, 113, 108, 107, 107, 22, 22, 22, 22, 109, - 109, 109, 56, 109, 109, 109, 406, 109, 109, 109, - 107, 109, 22, 109, 109, 22, 109, 31, 107, 65, - 108, 108, 114, 108, 107, 109, 104, 399, 399, 399, - 109, 104, 109, 250, 406, 197, 408, 399, 79, 230, - 353, -1, 55, 82, 80, 82, 183, -1, -1, -1, + 21, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 100, 101, 102, 103, 77, 78, 79, + 80, 111, 112, 99, 99, 107, 107, 99, 113, 113, + 108, 108, 65, 113, 108, 108, 103, 108, 108, 108, + 108, 99, 23, 343, 322, 99, 318, 318, 318, 110, + 109, 23, 109, 64, 109, 108, 108, 108, 108, 66, + 109, 109, 109, 109, 109, 109, 109, 103, 109, 109, + 108, 343, 23, 110, 113, 83, 348, 23, 23, 23, + 67, 109, 23, 109, 23, 109, 29, 23, 23, 103, + 110, 114, 109, 108, 110, 108, 23, 23, 110, 23, + 110, 110, 23, 57, 110, 110, 406, 110, 110, 110, + 108, 110, 23, 110, 110, 23, 110, 32, 108, 66, + 109, 109, 115, 109, 108, 110, 105, 399, 399, 399, + 110, 105, 110, 399, 406, 197, 408, 79, 250, 230, + -1, 353, 82, 55, 82, -1, 80, -1, 183, -1, 422 }; @@ -1171,50 +1172,50 @@ static const yytype_int16 yycheck[] = symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 3, 4, 116, 117, 0, 118, 8, 119, 120, - 98, 5, 6, 7, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 121, 122, 123, - 124, 125, 126, 127, 128, 129, 130, 131, 132, 135, - 158, 159, 166, 167, 168, 230, 232, 235, 248, 106, - 233, 98, 98, 98, 98, 231, 64, 98, 138, 144, - 236, 138, 138, 138, 138, 138, 98, 139, 152, 110, - 111, 137, 229, 138, 106, 106, 98, 234, 112, 112, - 112, 108, 112, 170, 234, 28, 29, 36, 58, 59, - 73, 237, 107, 99, 100, 101, 102, 157, 107, 107, - 107, 107, 107, 107, 102, 154, 22, 23, 37, 61, - 72, 95, 98, 113, 143, 145, 160, 174, 177, 213, - 217, 220, 224, 226, 227, 107, 107, 98, 160, 236, - 22, 169, 173, 177, 213, 223, 225, 227, 228, 229, - 26, 38, 238, 108, 242, 137, 136, 229, 137, 136, - 137, 137, 136, 28, 36, 59, 73, 165, 33, 45, - 27, 29, 35, 42, 43, 44, 46, 48, 57, 74, - 75, 178, 180, 183, 185, 187, 191, 194, 196, 198, - 200, 203, 212, 28, 36, 49, 52, 59, 73, 96, - 97, 161, 228, 99, 102, 103, 156, 108, 143, 98, - 109, 22, 23, 60, 67, 239, 22, 245, 107, 107, - 143, 107, 107, 60, 67, 241, 242, 108, 108, 108, - 63, 28, 55, 195, 108, 24, 26, 38, 184, 240, - 108, 240, 47, 50, 51, 54, 62, 80, 207, 25, - 69, 199, 108, 244, 242, 65, 241, 108, 242, 108, - 108, 163, 107, 114, 22, 146, 147, 148, 152, 107, - 112, 171, 109, 137, 136, 102, 155, 82, 133, 137, - 22, 221, 22, 222, 22, 197, 22, 190, 66, 190, - 24, 30, 32, 68, 70, 179, 189, 108, 22, 208, - 209, 108, 242, 40, 41, 81, 204, 205, 22, 247, - 28, 188, 34, 53, 192, 108, 22, 164, 22, 162, - 164, 228, 109, 102, 153, 140, 141, 229, 113, 108, - 243, 107, 107, 109, 109, 109, 109, 109, 22, 211, - 22, 210, 109, 76, 77, 78, 79, 193, 22, 206, - 109, 109, 109, 107, 114, 110, 111, 149, 107, 22, - 98, 142, 61, 72, 172, 175, 176, 177, 214, 215, - 218, 223, 22, 246, 83, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 134, 137, 56, 25, - 39, 59, 71, 181, 189, 240, 109, 109, 109, 228, - 22, 150, 22, 151, 141, 33, 45, 201, 203, 107, - 114, 109, 31, 182, 186, 189, 107, 114, 107, 108, - 108, 65, 202, 175, 228, 141, 216, 221, 219, 222, - 108, 114, 107, 109, 104, 109, 104, 206, 141, 221, - 222, 104, 206, 109 + 0, 3, 4, 117, 118, 0, 119, 8, 120, 121, + 99, 5, 6, 7, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 136, + 159, 160, 167, 168, 169, 231, 233, 236, 249, 107, + 234, 99, 99, 99, 99, 232, 65, 99, 139, 145, + 237, 139, 139, 139, 139, 139, 99, 140, 153, 111, + 112, 138, 230, 139, 107, 107, 99, 235, 113, 113, + 113, 109, 113, 171, 235, 29, 30, 37, 59, 60, + 74, 238, 108, 100, 101, 102, 103, 158, 108, 108, + 108, 108, 108, 108, 103, 155, 23, 24, 38, 62, + 73, 96, 99, 114, 144, 146, 161, 175, 178, 214, + 218, 221, 225, 227, 228, 108, 108, 99, 161, 237, + 23, 170, 174, 178, 214, 224, 226, 228, 229, 230, + 27, 39, 239, 109, 243, 138, 137, 230, 138, 137, + 138, 138, 137, 29, 37, 60, 74, 166, 34, 46, + 28, 30, 36, 43, 44, 45, 47, 49, 58, 75, + 76, 179, 181, 184, 186, 188, 192, 195, 197, 199, + 201, 204, 213, 29, 37, 50, 53, 60, 74, 97, + 98, 162, 229, 100, 103, 104, 157, 109, 144, 99, + 110, 23, 24, 61, 68, 240, 23, 246, 108, 108, + 144, 108, 108, 61, 68, 242, 243, 109, 109, 109, + 64, 29, 56, 196, 109, 25, 27, 39, 185, 241, + 109, 241, 48, 51, 52, 55, 63, 81, 208, 26, + 70, 200, 109, 245, 243, 66, 242, 109, 243, 109, + 109, 164, 108, 115, 23, 147, 148, 149, 153, 108, + 113, 172, 110, 138, 137, 103, 156, 83, 134, 138, + 23, 222, 23, 223, 23, 198, 23, 191, 67, 191, + 25, 31, 33, 69, 71, 180, 190, 109, 23, 209, + 210, 109, 243, 41, 42, 82, 205, 206, 23, 248, + 29, 189, 35, 54, 193, 109, 23, 165, 23, 163, + 165, 229, 110, 103, 154, 141, 142, 230, 114, 109, + 244, 108, 108, 110, 110, 110, 110, 110, 23, 212, + 23, 211, 110, 77, 78, 79, 80, 194, 23, 207, + 110, 110, 110, 108, 115, 111, 112, 150, 108, 23, + 99, 143, 62, 73, 173, 176, 177, 178, 215, 216, + 219, 224, 23, 247, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 135, 138, 57, 26, + 40, 60, 72, 182, 190, 241, 110, 110, 110, 229, + 23, 151, 23, 152, 142, 34, 46, 202, 204, 108, + 115, 110, 32, 183, 187, 190, 108, 115, 108, 109, + 109, 66, 203, 176, 229, 142, 217, 222, 220, 223, + 109, 115, 108, 110, 105, 110, 105, 207, 142, 222, + 223, 105, 207, 110 }; #define yyerrok (yyerrstatus = 0) @@ -4573,7 +4574,7 @@ yyreduce: /* Line 1455 of yacc.c */ -#line 4577 "program_parse.tab.c" +#line 4578 "program_parse.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); diff --git a/src/mesa/shader/program_parse.tab.h b/src/mesa/shader/program_parse.tab.h index de08fb747f..7ab6f6b23e 100644 --- a/src/mesa/shader/program_parse.tab.h +++ b/src/mesa/shader/program_parse.tab.h @@ -58,90 +58,91 @@ ARL = 274, KIL = 275, SWZ = 276, - INTEGER = 277, - REAL = 278, - AMBIENT = 279, - ATTENUATION = 280, - BACK = 281, - CLIP = 282, - COLOR = 283, - DEPTH = 284, - DIFFUSE = 285, - DIRECTION = 286, - EMISSION = 287, - ENV = 288, - EYE = 289, - FOG = 290, - FOGCOORD = 291, - FRAGMENT = 292, - FRONT = 293, - HALF = 294, - INVERSE = 295, - INVTRANS = 296, - LIGHT = 297, - LIGHTMODEL = 298, - LIGHTPROD = 299, - LOCAL = 300, - MATERIAL = 301, - MAT_PROGRAM = 302, - MATRIX = 303, - MATRIXINDEX = 304, - MODELVIEW = 305, - MVP = 306, - NORMAL = 307, - OBJECT = 308, - PALETTE = 309, - PARAMS = 310, - PLANE = 311, - POINT = 312, - POINTSIZE = 313, - POSITION = 314, - PRIMARY = 315, - PROGRAM = 316, - PROJECTION = 317, - RANGE = 318, - RESULT = 319, - ROW = 320, - SCENECOLOR = 321, - SECONDARY = 322, - SHININESS = 323, - SIZE = 324, - SPECULAR = 325, - SPOT = 326, - STATE = 327, - TEXCOORD = 328, - TEXENV = 329, - TEXGEN = 330, - TEXGEN_Q = 331, - TEXGEN_R = 332, - TEXGEN_S = 333, - TEXGEN_T = 334, - TEXTURE = 335, - TRANSPOSE = 336, - TEXTURE_UNIT = 337, - TEX_1D = 338, - TEX_2D = 339, - TEX_3D = 340, - TEX_CUBE = 341, - TEX_RECT = 342, - TEX_SHADOW1D = 343, - TEX_SHADOW2D = 344, - TEX_SHADOWRECT = 345, - TEX_ARRAY1D = 346, - TEX_ARRAY2D = 347, - TEX_ARRAYSHADOW1D = 348, - TEX_ARRAYSHADOW2D = 349, - VERTEX = 350, - VTXATTRIB = 351, - WEIGHT = 352, - IDENTIFIER = 353, - MASK4 = 354, - MASK3 = 355, - MASK2 = 356, - MASK1 = 357, - SWIZZLE = 358, - DOT_DOT = 359, - DOT = 360 + TXD_OP = 277, + INTEGER = 278, + REAL = 279, + AMBIENT = 280, + ATTENUATION = 281, + BACK = 282, + CLIP = 283, + COLOR = 284, + DEPTH = 285, + DIFFUSE = 286, + DIRECTION = 287, + EMISSION = 288, + ENV = 289, + EYE = 290, + FOG = 291, + FOGCOORD = 292, + FRAGMENT = 293, + FRONT = 294, + HALF = 295, + INVERSE = 296, + INVTRANS = 297, + LIGHT = 298, + LIGHTMODEL = 299, + LIGHTPROD = 300, + LOCAL = 301, + MATERIAL = 302, + MAT_PROGRAM = 303, + MATRIX = 304, + MATRIXINDEX = 305, + MODELVIEW = 306, + MVP = 307, + NORMAL = 308, + OBJECT = 309, + PALETTE = 310, + PARAMS = 311, + PLANE = 312, + POINT = 313, + POINTSIZE = 314, + POSITION = 315, + PRIMARY = 316, + PROGRAM = 317, + PROJECTION = 318, + RANGE = 319, + RESULT = 320, + ROW = 321, + SCENECOLOR = 322, + SECONDARY = 323, + SHININESS = 324, + SIZE = 325, + SPECULAR = 326, + SPOT = 327, + STATE = 328, + TEXCOORD = 329, + TEXENV = 330, + TEXGEN = 331, + TEXGEN_Q = 332, + TEXGEN_R = 333, + TEXGEN_S = 334, + TEXGEN_T = 335, + TEXTURE = 336, + TRANSPOSE = 337, + TEXTURE_UNIT = 338, + TEX_1D = 339, + TEX_2D = 340, + TEX_3D = 341, + TEX_CUBE = 342, + TEX_RECT = 343, + TEX_SHADOW1D = 344, + TEX_SHADOW2D = 345, + TEX_SHADOWRECT = 346, + TEX_ARRAY1D = 347, + TEX_ARRAY2D = 348, + TEX_ARRAYSHADOW1D = 349, + TEX_ARRAYSHADOW2D = 350, + VERTEX = 351, + VTXATTRIB = 352, + WEIGHT = 353, + IDENTIFIER = 354, + MASK4 = 355, + MASK3 = 356, + MASK2 = 357, + MASK1 = 358, + SWIZZLE = 359, + DOT_DOT = 360, + DOT = 361 }; #endif @@ -181,7 +182,7 @@ typedef union YYSTYPE /* Line 1676 of yacc.c */ -#line 185 "program_parse.tab.h" +#line 186 "program_parse.tab.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index e2e83e484f..9dab00c385 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -142,7 +142,7 @@ static struct asm_instruction *asm_instruction_ctor(gl_inst_opcode op, /* Tokens for instructions */ %token BIN_OP BINSC_OP SAMPLE_OP SCALAR_OP TRI_OP VECTOR_OP -%token ARL KIL SWZ +%token ARL KIL SWZ TXD_OP %token INTEGER %token REAL -- cgit v1.2.3 From 8ca6fd8a83412e3a76746f0ee61027b796516f95 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 1 Sep 2009 14:16:03 -0700 Subject: NV fp parser: Parse TXD instruction --- src/mesa/shader/program_parse.tab.c | 1735 ++++++++++++++++++----------------- src/mesa/shader/program_parse.y | 48 +- 2 files changed, 941 insertions(+), 842 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c index 4108374652..06aefd073f 100644 --- a/src/mesa/shader/program_parse.tab.c +++ b/src/mesa/shader/program_parse.tab.c @@ -588,16 +588,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 5 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 340 +#define YYLAST 349 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 116 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 134 +#define YYNNTS 135 /* YYNRULES -- Number of rules. */ -#define YYNRULES 264 +#define YYNRULES 266 /* YYNRULES -- Number of states. */ -#define YYNSTATES 434 +#define YYNSTATES 447 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -655,31 +655,31 @@ static const yytype_uint16 yyprhs[] = { 0, 0, 3, 8, 10, 12, 15, 16, 20, 23, 24, 27, 30, 32, 34, 36, 38, 40, 42, 44, - 46, 48, 50, 52, 57, 62, 67, 74, 81, 90, - 99, 102, 105, 107, 109, 111, 113, 115, 117, 119, - 121, 123, 125, 127, 129, 136, 140, 144, 147, 150, - 158, 161, 163, 165, 167, 169, 174, 176, 178, 180, - 182, 184, 186, 188, 192, 193, 196, 199, 201, 203, - 205, 207, 209, 211, 213, 215, 217, 218, 220, 222, - 224, 226, 227, 229, 231, 233, 235, 237, 239, 244, - 247, 250, 252, 255, 257, 260, 262, 265, 270, 275, - 277, 278, 282, 284, 286, 289, 291, 294, 296, 298, - 302, 309, 310, 312, 315, 320, 322, 326, 328, 330, - 332, 334, 336, 338, 340, 342, 344, 346, 349, 352, - 355, 358, 361, 364, 367, 370, 373, 376, 379, 382, - 386, 388, 390, 392, 398, 400, 402, 404, 407, 409, - 411, 414, 416, 419, 426, 428, 432, 434, 436, 438, - 440, 442, 447, 449, 451, 453, 455, 457, 459, 462, - 464, 466, 472, 474, 477, 479, 481, 487, 490, 491, - 498, 502, 503, 505, 507, 509, 511, 513, 516, 518, - 520, 523, 528, 533, 534, 536, 538, 540, 542, 545, - 547, 549, 551, 553, 559, 561, 565, 571, 577, 579, - 583, 589, 591, 593, 595, 597, 599, 601, 603, 605, - 607, 611, 617, 625, 635, 638, 641, 643, 645, 646, - 647, 651, 652, 656, 660, 662, 667, 670, 673, 676, - 679, 683, 686, 690, 691, 693, 695, 696, 698, 700, - 701, 703, 705, 706, 708, 710, 711, 715, 716, 720, - 721, 725, 727, 729, 731 + 46, 48, 50, 52, 54, 59, 64, 69, 76, 83, + 92, 101, 104, 117, 120, 122, 124, 126, 128, 130, + 132, 134, 136, 138, 140, 142, 144, 151, 155, 159, + 162, 165, 173, 176, 178, 180, 182, 184, 189, 191, + 193, 195, 197, 199, 201, 203, 207, 208, 211, 214, + 216, 218, 220, 222, 224, 226, 228, 230, 232, 233, + 235, 237, 239, 241, 242, 244, 246, 248, 250, 252, + 254, 259, 262, 265, 267, 270, 272, 275, 277, 280, + 285, 290, 292, 293, 297, 299, 301, 304, 306, 309, + 311, 313, 317, 324, 325, 327, 330, 335, 337, 341, + 343, 345, 347, 349, 351, 353, 355, 357, 359, 361, + 364, 367, 370, 373, 376, 379, 382, 385, 388, 391, + 394, 397, 401, 403, 405, 407, 413, 415, 417, 419, + 422, 424, 426, 429, 431, 434, 441, 443, 447, 449, + 451, 453, 455, 457, 462, 464, 466, 468, 470, 472, + 474, 477, 479, 481, 487, 489, 492, 494, 496, 502, + 505, 506, 513, 517, 518, 520, 522, 524, 526, 528, + 531, 533, 535, 538, 543, 548, 549, 551, 553, 555, + 557, 560, 562, 564, 566, 568, 574, 576, 580, 586, + 592, 594, 598, 604, 606, 608, 610, 612, 614, 616, + 618, 620, 622, 626, 632, 640, 650, 653, 656, 658, + 660, 661, 662, 666, 667, 671, 675, 677, 682, 685, + 688, 691, 694, 698, 701, 705, 706, 708, 710, 711, + 713, 715, 716, 718, 720, 721, 723, 725, 726, 730, + 731, 735, 736, 740, 742, 744, 746 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ @@ -687,78 +687,80 @@ static const yytype_int16 yyrhs[] = { 117, 0, -1, 118, 119, 121, 12, -1, 3, -1, 4, -1, 119, 120, -1, -1, 8, 99, 107, -1, - 121, 122, -1, -1, 123, 107, -1, 159, 107, -1, + 121, 122, -1, -1, 123, 107, -1, 160, 107, -1, 124, -1, 125, -1, 126, -1, 127, -1, 128, -1, - 129, -1, 130, -1, 131, -1, 136, -1, 132, -1, - 133, -1, 19, 140, 108, 137, -1, 18, 139, 108, - 138, -1, 16, 139, 108, 137, -1, 14, 139, 108, - 137, 108, 137, -1, 13, 139, 108, 138, 108, 138, - -1, 17, 139, 108, 138, 108, 138, 108, 138, -1, - 15, 139, 108, 138, 108, 134, 108, 135, -1, 20, - 138, -1, 83, 244, -1, 84, -1, 85, -1, 86, - -1, 87, -1, 88, -1, 89, -1, 90, -1, 91, - -1, 92, -1, 93, -1, 94, -1, 95, -1, 21, - 139, 108, 144, 108, 141, -1, 230, 144, 156, -1, - 230, 144, 157, -1, 145, 158, -1, 153, 155, -1, - 142, 108, 142, 108, 142, 108, 142, -1, 230, 143, - -1, 23, -1, 99, -1, 99, -1, 161, -1, 146, - 109, 147, 110, -1, 175, -1, 237, -1, 99, -1, - 99, -1, 148, -1, 149, -1, 23, -1, 153, 154, - 150, -1, -1, 111, 151, -1, 112, 152, -1, 23, - -1, 23, -1, 99, -1, 103, -1, 103, -1, 103, - -1, 103, -1, 100, -1, 104, -1, -1, 100, -1, - 101, -1, 102, -1, 103, -1, -1, 160, -1, 167, - -1, 231, -1, 233, -1, 236, -1, 249, -1, 7, - 99, 113, 161, -1, 96, 162, -1, 38, 166, -1, - 60, -1, 98, 164, -1, 53, -1, 29, 242, -1, - 37, -1, 74, 243, -1, 50, 109, 165, 110, -1, - 97, 109, 163, 110, -1, 23, -1, -1, 109, 165, - 110, -1, 23, -1, 60, -1, 29, 242, -1, 37, - -1, 74, 243, -1, 168, -1, 169, -1, 10, 99, - 171, -1, 10, 99, 109, 170, 110, 172, -1, -1, - 23, -1, 113, 174, -1, 113, 114, 173, 115, -1, - 176, -1, 173, 108, 176, -1, 178, -1, 214, -1, - 224, -1, 178, -1, 214, -1, 225, -1, 177, -1, - 215, -1, 224, -1, 178, -1, 73, 202, -1, 73, - 179, -1, 73, 181, -1, 73, 184, -1, 73, 186, - -1, 73, 192, -1, 73, 188, -1, 73, 195, -1, - 73, 197, -1, 73, 199, -1, 73, 201, -1, 73, - 213, -1, 47, 241, 180, -1, 190, -1, 33, -1, - 69, -1, 43, 109, 191, 110, 182, -1, 190, -1, - 60, -1, 26, -1, 72, 183, -1, 40, -1, 32, - -1, 44, 185, -1, 25, -1, 241, 67, -1, 45, - 109, 191, 110, 241, 187, -1, 190, -1, 75, 245, - 189, -1, 29, -1, 25, -1, 31, -1, 71, -1, - 23, -1, 76, 243, 193, 194, -1, 35, -1, 54, - -1, 79, -1, 80, -1, 78, -1, 77, -1, 36, - 196, -1, 29, -1, 56, -1, 28, 109, 198, 110, - 57, -1, 23, -1, 58, 200, -1, 70, -1, 26, - -1, 204, 66, 109, 207, 110, -1, 204, 203, -1, - -1, 66, 109, 207, 105, 207, 110, -1, 49, 208, - 205, -1, -1, 206, -1, 41, -1, 82, -1, 42, - -1, 23, -1, 51, 209, -1, 63, -1, 52, -1, - 81, 243, -1, 55, 109, 211, 110, -1, 48, 109, - 212, 110, -1, -1, 210, -1, 23, -1, 23, -1, - 23, -1, 30, 64, -1, 218, -1, 221, -1, 216, - -1, 219, -1, 62, 34, 109, 217, 110, -1, 222, - -1, 222, 105, 222, -1, 62, 34, 109, 222, 110, - -1, 62, 46, 109, 220, 110, -1, 223, -1, 223, - 105, 223, -1, 62, 46, 109, 223, 110, -1, 23, - -1, 23, -1, 226, -1, 228, -1, 227, -1, 228, - -1, 229, -1, 24, -1, 23, -1, 114, 229, 115, - -1, 114, 229, 108, 229, 115, -1, 114, 229, 108, - 229, 108, 229, 115, -1, 114, 229, 108, 229, 108, - 229, 108, 229, 115, -1, 230, 24, -1, 230, 23, - -1, 111, -1, 112, -1, -1, -1, 11, 232, 235, - -1, -1, 5, 234, 235, -1, 235, 108, 99, -1, - 99, -1, 9, 99, 113, 237, -1, 65, 60, -1, - 65, 37, -1, 65, 238, -1, 65, 59, -1, 65, - 74, 243, -1, 65, 30, -1, 29, 239, 240, -1, - -1, 39, -1, 27, -1, -1, 61, -1, 68, -1, - -1, 39, -1, 27, -1, -1, 61, -1, 68, -1, - -1, 109, 246, 110, -1, -1, 109, 247, 110, -1, - -1, 109, 248, 110, -1, 23, -1, 23, -1, 23, - -1, 6, 99, 113, 99, -1 + 129, -1, 130, -1, 131, -1, 137, -1, 132, -1, + 133, -1, 134, -1, 19, 141, 108, 138, -1, 18, + 140, 108, 139, -1, 16, 140, 108, 138, -1, 14, + 140, 108, 138, 108, 138, -1, 13, 140, 108, 139, + 108, 139, -1, 17, 140, 108, 139, 108, 139, 108, + 139, -1, 15, 140, 108, 139, 108, 135, 108, 136, + -1, 20, 139, -1, 22, 140, 108, 139, 108, 139, + 108, 139, 108, 135, 108, 136, -1, 83, 245, -1, + 84, -1, 85, -1, 86, -1, 87, -1, 88, -1, + 89, -1, 90, -1, 91, -1, 92, -1, 93, -1, + 94, -1, 95, -1, 21, 140, 108, 145, 108, 142, + -1, 231, 145, 157, -1, 231, 145, 158, -1, 146, + 159, -1, 154, 156, -1, 143, 108, 143, 108, 143, + 108, 143, -1, 231, 144, -1, 23, -1, 99, -1, + 99, -1, 162, -1, 147, 109, 148, 110, -1, 176, + -1, 238, -1, 99, -1, 99, -1, 149, -1, 150, + -1, 23, -1, 154, 155, 151, -1, -1, 111, 152, + -1, 112, 153, -1, 23, -1, 23, -1, 99, -1, + 103, -1, 103, -1, 103, -1, 103, -1, 100, -1, + 104, -1, -1, 100, -1, 101, -1, 102, -1, 103, + -1, -1, 161, -1, 168, -1, 232, -1, 234, -1, + 237, -1, 250, -1, 7, 99, 113, 162, -1, 96, + 163, -1, 38, 167, -1, 60, -1, 98, 165, -1, + 53, -1, 29, 243, -1, 37, -1, 74, 244, -1, + 50, 109, 166, 110, -1, 97, 109, 164, 110, -1, + 23, -1, -1, 109, 166, 110, -1, 23, -1, 60, + -1, 29, 243, -1, 37, -1, 74, 244, -1, 169, + -1, 170, -1, 10, 99, 172, -1, 10, 99, 109, + 171, 110, 173, -1, -1, 23, -1, 113, 175, -1, + 113, 114, 174, 115, -1, 177, -1, 174, 108, 177, + -1, 179, -1, 215, -1, 225, -1, 179, -1, 215, + -1, 226, -1, 178, -1, 216, -1, 225, -1, 179, + -1, 73, 203, -1, 73, 180, -1, 73, 182, -1, + 73, 185, -1, 73, 187, -1, 73, 193, -1, 73, + 189, -1, 73, 196, -1, 73, 198, -1, 73, 200, + -1, 73, 202, -1, 73, 214, -1, 47, 242, 181, + -1, 191, -1, 33, -1, 69, -1, 43, 109, 192, + 110, 183, -1, 191, -1, 60, -1, 26, -1, 72, + 184, -1, 40, -1, 32, -1, 44, 186, -1, 25, + -1, 242, 67, -1, 45, 109, 192, 110, 242, 188, + -1, 191, -1, 75, 246, 190, -1, 29, -1, 25, + -1, 31, -1, 71, -1, 23, -1, 76, 244, 194, + 195, -1, 35, -1, 54, -1, 79, -1, 80, -1, + 78, -1, 77, -1, 36, 197, -1, 29, -1, 56, + -1, 28, 109, 199, 110, 57, -1, 23, -1, 58, + 201, -1, 70, -1, 26, -1, 205, 66, 109, 208, + 110, -1, 205, 204, -1, -1, 66, 109, 208, 105, + 208, 110, -1, 49, 209, 206, -1, -1, 207, -1, + 41, -1, 82, -1, 42, -1, 23, -1, 51, 210, + -1, 63, -1, 52, -1, 81, 244, -1, 55, 109, + 212, 110, -1, 48, 109, 213, 110, -1, -1, 211, + -1, 23, -1, 23, -1, 23, -1, 30, 64, -1, + 219, -1, 222, -1, 217, -1, 220, -1, 62, 34, + 109, 218, 110, -1, 223, -1, 223, 105, 223, -1, + 62, 34, 109, 223, 110, -1, 62, 46, 109, 221, + 110, -1, 224, -1, 224, 105, 224, -1, 62, 46, + 109, 224, 110, -1, 23, -1, 23, -1, 227, -1, + 229, -1, 228, -1, 229, -1, 230, -1, 24, -1, + 23, -1, 114, 230, 115, -1, 114, 230, 108, 230, + 115, -1, 114, 230, 108, 230, 108, 230, 115, -1, + 114, 230, 108, 230, 108, 230, 108, 230, 115, -1, + 231, 24, -1, 231, 23, -1, 111, -1, 112, -1, + -1, -1, 11, 233, 236, -1, -1, 5, 235, 236, + -1, 236, 108, 99, -1, 99, -1, 9, 99, 113, + 238, -1, 65, 60, -1, 65, 37, -1, 65, 239, + -1, 65, 59, -1, 65, 74, 244, -1, 65, 30, + -1, 29, 240, 241, -1, -1, 39, -1, 27, -1, + -1, 61, -1, 68, -1, -1, 39, -1, 27, -1, + -1, 61, -1, 68, -1, -1, 109, 247, 110, -1, + -1, 109, 248, 110, -1, -1, 109, 249, 110, -1, + 23, -1, 23, -1, 23, -1, 6, 99, 113, 99, + -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -766,31 +768,31 @@ static const yytype_uint16 yyrline[] = { 0, 256, 256, 259, 267, 279, 280, 283, 305, 306, 309, 324, 327, 332, 339, 340, 341, 342, 343, 344, - 345, 348, 349, 352, 358, 365, 372, 380, 387, 395, - 440, 447, 453, 454, 455, 456, 457, 458, 459, 460, - 461, 462, 463, 464, 467, 480, 493, 506, 528, 537, - 570, 577, 592, 642, 684, 695, 716, 726, 732, 763, - 780, 780, 782, 789, 801, 802, 803, 806, 818, 830, - 848, 859, 871, 873, 874, 875, 876, 879, 879, 879, - 879, 880, 883, 884, 885, 886, 887, 888, 891, 909, - 913, 919, 923, 927, 931, 940, 949, 953, 958, 964, - 975, 975, 976, 978, 982, 986, 990, 996, 996, 998, - 1014, 1037, 1040, 1051, 1057, 1063, 1064, 1071, 1077, 1083, - 1091, 1097, 1103, 1111, 1117, 1123, 1131, 1132, 1135, 1136, - 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1148, - 1157, 1161, 1165, 1171, 1180, 1184, 1188, 1197, 1201, 1207, - 1213, 1220, 1225, 1233, 1243, 1245, 1253, 1259, 1263, 1267, - 1273, 1284, 1293, 1297, 1302, 1306, 1310, 1314, 1320, 1327, - 1331, 1337, 1345, 1356, 1363, 1367, 1373, 1383, 1394, 1398, - 1416, 1425, 1428, 1434, 1438, 1442, 1448, 1459, 1464, 1469, - 1474, 1479, 1484, 1492, 1495, 1500, 1513, 1521, 1532, 1540, - 1540, 1542, 1542, 1544, 1554, 1559, 1566, 1576, 1585, 1590, - 1597, 1607, 1617, 1629, 1629, 1630, 1630, 1632, 1642, 1650, - 1660, 1668, 1676, 1685, 1696, 1700, 1706, 1707, 1708, 1711, - 1711, 1714, 1714, 1717, 1723, 1731, 1744, 1753, 1762, 1766, - 1775, 1784, 1795, 1802, 1807, 1816, 1828, 1831, 1840, 1851, - 1852, 1853, 1856, 1857, 1858, 1861, 1862, 1865, 1866, 1869, - 1870, 1873, 1884, 1895, 1906 + 345, 348, 349, 350, 353, 359, 366, 373, 381, 388, + 396, 441, 448, 493, 499, 500, 501, 502, 503, 504, + 505, 506, 507, 508, 509, 510, 513, 526, 539, 552, + 574, 583, 616, 623, 638, 688, 730, 741, 762, 772, + 778, 809, 826, 826, 828, 835, 847, 848, 849, 852, + 864, 876, 894, 905, 917, 919, 920, 921, 922, 925, + 925, 925, 925, 926, 929, 930, 931, 932, 933, 934, + 937, 955, 959, 965, 969, 973, 977, 986, 995, 999, + 1004, 1010, 1021, 1021, 1022, 1024, 1028, 1032, 1036, 1042, + 1042, 1044, 1060, 1083, 1086, 1097, 1103, 1109, 1110, 1117, + 1123, 1129, 1137, 1143, 1149, 1157, 1163, 1169, 1177, 1178, + 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, + 1191, 1194, 1203, 1207, 1211, 1217, 1226, 1230, 1234, 1243, + 1247, 1253, 1259, 1266, 1271, 1279, 1289, 1291, 1299, 1305, + 1309, 1313, 1319, 1330, 1339, 1343, 1348, 1352, 1356, 1360, + 1366, 1373, 1377, 1383, 1391, 1402, 1409, 1413, 1419, 1429, + 1440, 1444, 1462, 1471, 1474, 1480, 1484, 1488, 1494, 1505, + 1510, 1515, 1520, 1525, 1530, 1538, 1541, 1546, 1559, 1567, + 1578, 1586, 1586, 1588, 1588, 1590, 1600, 1605, 1612, 1622, + 1631, 1636, 1643, 1653, 1663, 1675, 1675, 1676, 1676, 1678, + 1688, 1696, 1706, 1714, 1722, 1731, 1742, 1746, 1752, 1753, + 1754, 1757, 1757, 1760, 1760, 1763, 1769, 1777, 1790, 1799, + 1808, 1812, 1821, 1830, 1841, 1848, 1853, 1862, 1874, 1877, + 1886, 1897, 1898, 1899, 1902, 1903, 1904, 1907, 1908, 1911, + 1912, 1915, 1916, 1919, 1930, 1941, 1952 }; #endif @@ -822,24 +824,24 @@ static const char *const yytname[] = "TexInstruction", "ARL_instruction", "VECTORop_instruction", "SCALARop_instruction", "BINSCop_instruction", "BINop_instruction", "TRIop_instruction", "SAMPLE_instruction", "KIL_instruction", - "texImageUnit", "texTarget", "SWZ_instruction", "scalarSrcReg", - "swizzleSrcReg", "maskedDstReg", "maskedAddrReg", "extendedSwizzle", - "extSwizComp", "extSwizSel", "srcReg", "dstReg", "progParamArray", - "progParamArrayMem", "progParamArrayAbs", "progParamArrayRel", - "addrRegRelOffset", "addrRegPosOffset", "addrRegNegOffset", "addrReg", - "addrComponent", "addrWriteMask", "scalarSuffix", "swizzleSuffix", - "optionalMask", "namingStatement", "ATTRIB_statement", "attribBinding", - "vtxAttribItem", "vtxAttribNum", "vtxOptWeightNum", "vtxWeightNum", - "fragAttribItem", "PARAM_statement", "PARAM_singleStmt", - "PARAM_multipleStmt", "optArraySize", "paramSingleInit", - "paramMultipleInit", "paramMultInitList", "paramSingleItemDecl", - "paramSingleItemUse", "paramMultipleItem", "stateMultipleItem", - "stateSingleItem", "stateMaterialItem", "stateMatProperty", - "stateLightItem", "stateLightProperty", "stateSpotProperty", - "stateLightModelItem", "stateLModProperty", "stateLightProdItem", - "stateLProdProperty", "stateTexEnvItem", "stateTexEnvProperty", - "ambDiffSpecProperty", "stateLightNumber", "stateTexGenItem", - "stateTexGenType", "stateTexGenCoord", "stateFogItem", + "TXD_instruction", "texImageUnit", "texTarget", "SWZ_instruction", + "scalarSrcReg", "swizzleSrcReg", "maskedDstReg", "maskedAddrReg", + "extendedSwizzle", "extSwizComp", "extSwizSel", "srcReg", "dstReg", + "progParamArray", "progParamArrayMem", "progParamArrayAbs", + "progParamArrayRel", "addrRegRelOffset", "addrRegPosOffset", + "addrRegNegOffset", "addrReg", "addrComponent", "addrWriteMask", + "scalarSuffix", "swizzleSuffix", "optionalMask", "namingStatement", + "ATTRIB_statement", "attribBinding", "vtxAttribItem", "vtxAttribNum", + "vtxOptWeightNum", "vtxWeightNum", "fragAttribItem", "PARAM_statement", + "PARAM_singleStmt", "PARAM_multipleStmt", "optArraySize", + "paramSingleInit", "paramMultipleInit", "paramMultInitList", + "paramSingleItemDecl", "paramSingleItemUse", "paramMultipleItem", + "stateMultipleItem", "stateSingleItem", "stateMaterialItem", + "stateMatProperty", "stateLightItem", "stateLightProperty", + "stateSpotProperty", "stateLightModelItem", "stateLModProperty", + "stateLightProdItem", "stateLProdProperty", "stateTexEnvItem", + "stateTexEnvProperty", "ambDiffSpecProperty", "stateLightNumber", + "stateTexGenItem", "stateTexGenType", "stateTexGenCoord", "stateFogItem", "stateFogProperty", "stateClipPlaneItem", "stateClipPlaneNum", "statePointItem", "statePointProperty", "stateMatrixRow", "stateMatrixRows", "optMatrixRows", "stateMatrixItem", @@ -886,31 +888,31 @@ static const yytype_uint8 yyr1[] = { 0, 116, 117, 118, 118, 119, 119, 120, 121, 121, 122, 122, 123, 123, 124, 124, 124, 124, 124, 124, - 124, 125, 125, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 135, 135, 135, 135, 135, 135, 135, - 135, 135, 135, 135, 136, 137, 138, 139, 140, 141, - 142, 143, 143, 144, 144, 144, 144, 145, 145, 146, - 147, 147, 148, 149, 150, 150, 150, 151, 152, 153, - 154, 155, 156, 157, 157, 157, 157, 158, 158, 158, - 158, 158, 159, 159, 159, 159, 159, 159, 160, 161, - 161, 162, 162, 162, 162, 162, 162, 162, 162, 163, - 164, 164, 165, 166, 166, 166, 166, 167, 167, 168, - 169, 170, 170, 171, 172, 173, 173, 174, 174, 174, - 175, 175, 175, 176, 176, 176, 177, 177, 178, 178, - 178, 178, 178, 178, 178, 178, 178, 178, 178, 179, - 180, 180, 180, 181, 182, 182, 182, 182, 182, 183, - 184, 185, 185, 186, 187, 188, 189, 190, 190, 190, - 191, 192, 193, 193, 194, 194, 194, 194, 195, 196, - 196, 197, 198, 199, 200, 200, 201, 202, 203, 203, - 204, 205, 205, 206, 206, 206, 207, 208, 208, 208, - 208, 208, 208, 209, 209, 210, 211, 212, 213, 214, - 214, 215, 215, 216, 217, 217, 218, 219, 220, 220, - 221, 222, 223, 224, 224, 225, 225, 226, 227, 227, - 228, 228, 228, 228, 229, 229, 230, 230, 230, 232, - 231, 234, 233, 235, 235, 236, 237, 237, 237, 237, - 237, 237, 238, 239, 239, 239, 240, 240, 240, 241, - 241, 241, 242, 242, 242, 243, 243, 244, 244, 245, - 245, 246, 247, 248, 249 + 124, 125, 125, 125, 126, 127, 128, 129, 130, 131, + 132, 133, 134, 135, 136, 136, 136, 136, 136, 136, + 136, 136, 136, 136, 136, 136, 137, 138, 139, 140, + 141, 142, 143, 144, 144, 145, 145, 145, 145, 146, + 146, 147, 148, 148, 149, 150, 151, 151, 151, 152, + 153, 154, 155, 156, 157, 158, 158, 158, 158, 159, + 159, 159, 159, 159, 160, 160, 160, 160, 160, 160, + 161, 162, 162, 163, 163, 163, 163, 163, 163, 163, + 163, 164, 165, 165, 166, 167, 167, 167, 167, 168, + 168, 169, 170, 171, 171, 172, 173, 174, 174, 175, + 175, 175, 176, 176, 176, 177, 177, 177, 178, 178, + 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, + 179, 180, 181, 181, 181, 182, 183, 183, 183, 183, + 183, 184, 185, 186, 186, 187, 188, 189, 190, 191, + 191, 191, 192, 193, 194, 194, 195, 195, 195, 195, + 196, 197, 197, 198, 199, 200, 201, 201, 202, 203, + 204, 204, 205, 206, 206, 207, 207, 207, 208, 209, + 209, 209, 209, 209, 209, 210, 210, 211, 212, 213, + 214, 215, 215, 216, 216, 217, 218, 218, 219, 220, + 221, 221, 222, 223, 224, 225, 225, 226, 226, 227, + 228, 228, 229, 229, 229, 229, 230, 230, 231, 231, + 231, 233, 232, 235, 234, 236, 236, 237, 238, 238, + 238, 238, 238, 238, 239, 240, 240, 240, 241, 241, + 241, 242, 242, 242, 243, 243, 243, 244, 244, 245, + 245, 246, 246, 247, 248, 249, 250 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -918,31 +920,31 @@ static const yytype_uint8 yyr2[] = { 0, 2, 4, 1, 1, 2, 0, 3, 2, 0, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 4, 4, 4, 6, 6, 8, 8, - 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 6, 3, 3, 2, 2, 7, - 2, 1, 1, 1, 1, 4, 1, 1, 1, 1, - 1, 1, 1, 3, 0, 2, 2, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, - 1, 0, 1, 1, 1, 1, 1, 1, 4, 2, - 2, 1, 2, 1, 2, 1, 2, 4, 4, 1, - 0, 3, 1, 1, 2, 1, 2, 1, 1, 3, - 6, 0, 1, 2, 4, 1, 3, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, - 1, 1, 1, 5, 1, 1, 1, 2, 1, 1, - 2, 1, 2, 6, 1, 3, 1, 1, 1, 1, - 1, 4, 1, 1, 1, 1, 1, 1, 2, 1, - 1, 5, 1, 2, 1, 1, 5, 2, 0, 6, - 3, 0, 1, 1, 1, 1, 1, 2, 1, 1, - 2, 4, 4, 0, 1, 1, 1, 1, 2, 1, - 1, 1, 1, 5, 1, 3, 5, 5, 1, 3, - 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 3, 5, 7, 9, 2, 2, 1, 1, 0, 0, - 3, 0, 3, 3, 1, 4, 2, 2, 2, 2, - 3, 2, 3, 0, 1, 1, 0, 1, 1, 0, - 1, 1, 0, 1, 1, 0, 3, 0, 3, 0, - 3, 1, 1, 1, 4 + 1, 1, 1, 1, 4, 4, 4, 6, 6, 8, + 8, 2, 12, 2, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 6, 3, 3, 2, + 2, 7, 2, 1, 1, 1, 1, 4, 1, 1, + 1, 1, 1, 1, 1, 3, 0, 2, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, + 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, + 4, 2, 2, 1, 2, 1, 2, 1, 2, 4, + 4, 1, 0, 3, 1, 1, 2, 1, 2, 1, + 1, 3, 6, 0, 1, 2, 4, 1, 3, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 3, 1, 1, 1, 5, 1, 1, 1, 2, + 1, 1, 2, 1, 2, 6, 1, 3, 1, 1, + 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, + 2, 1, 1, 5, 1, 2, 1, 1, 5, 2, + 0, 6, 3, 0, 1, 1, 1, 1, 1, 2, + 1, 1, 2, 4, 4, 0, 1, 1, 1, 1, + 2, 1, 1, 1, 1, 5, 1, 3, 5, 5, + 1, 3, 5, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 3, 5, 7, 9, 2, 2, 1, 1, + 0, 0, 3, 0, 3, 3, 1, 4, 2, 2, + 2, 2, 3, 2, 3, 0, 1, 1, 0, 1, + 1, 0, 1, 1, 0, 1, 1, 0, 3, 0, + 3, 0, 3, 1, 1, 1, 4 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -951,221 +953,223 @@ static const yytype_uint8 yyr2[] = static const yytype_uint16 yydefact[] = { 0, 3, 4, 0, 6, 1, 9, 0, 5, 0, - 0, 231, 0, 0, 0, 0, 229, 2, 0, 0, - 0, 0, 0, 0, 0, 228, 0, 8, 0, 12, - 13, 14, 15, 16, 17, 18, 19, 21, 22, 20, - 0, 82, 83, 107, 108, 84, 85, 86, 87, 7, - 0, 0, 0, 0, 0, 0, 0, 58, 0, 81, - 57, 0, 0, 0, 0, 0, 69, 0, 0, 226, - 227, 30, 0, 0, 10, 11, 234, 232, 0, 0, - 0, 111, 228, 109, 230, 243, 241, 237, 239, 236, - 255, 238, 228, 77, 78, 79, 80, 47, 228, 228, - 228, 228, 228, 228, 71, 48, 219, 218, 0, 0, - 0, 0, 53, 228, 76, 0, 54, 56, 120, 121, - 199, 200, 122, 215, 216, 0, 0, 264, 88, 235, - 112, 0, 113, 117, 118, 119, 213, 214, 217, 0, - 245, 244, 246, 0, 240, 0, 0, 0, 0, 25, - 0, 24, 23, 252, 105, 103, 255, 90, 0, 0, - 0, 0, 0, 0, 249, 0, 249, 0, 0, 259, - 255, 128, 129, 130, 131, 133, 132, 134, 135, 136, - 137, 0, 138, 252, 95, 0, 93, 91, 255, 0, - 100, 89, 0, 74, 73, 75, 46, 0, 0, 233, - 0, 225, 224, 247, 248, 242, 261, 0, 228, 228, - 0, 0, 228, 253, 254, 104, 106, 0, 0, 0, - 198, 169, 170, 168, 0, 151, 251, 250, 150, 0, - 0, 0, 0, 193, 189, 0, 188, 255, 181, 175, - 174, 173, 0, 0, 0, 0, 94, 0, 96, 0, - 0, 92, 228, 220, 62, 0, 60, 61, 0, 228, - 0, 110, 256, 27, 26, 72, 45, 257, 0, 0, - 211, 0, 212, 0, 172, 0, 160, 0, 152, 0, - 157, 158, 141, 142, 159, 139, 140, 0, 195, 187, - 194, 0, 190, 183, 185, 184, 180, 182, 263, 0, - 156, 155, 162, 163, 0, 0, 102, 0, 99, 0, - 0, 0, 55, 70, 64, 44, 0, 0, 228, 0, - 31, 0, 228, 206, 210, 0, 0, 249, 197, 0, - 196, 0, 260, 167, 166, 164, 165, 161, 186, 0, - 97, 98, 101, 228, 221, 0, 0, 63, 228, 51, - 52, 50, 0, 0, 0, 115, 123, 126, 124, 201, - 202, 125, 262, 0, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 29, 28, 171, 146, - 148, 145, 0, 143, 144, 0, 192, 191, 176, 0, - 67, 65, 68, 66, 0, 0, 0, 127, 178, 228, - 114, 258, 149, 147, 153, 154, 228, 222, 228, 0, - 0, 0, 177, 116, 0, 0, 0, 204, 0, 208, - 0, 223, 228, 203, 0, 207, 0, 0, 49, 205, - 209, 0, 0, 179 + 0, 233, 0, 0, 0, 0, 231, 2, 0, 0, + 0, 0, 0, 0, 0, 230, 0, 0, 8, 0, + 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, + 23, 20, 0, 84, 85, 109, 110, 86, 87, 88, + 89, 7, 0, 0, 0, 0, 0, 0, 0, 60, + 0, 83, 59, 0, 0, 0, 0, 0, 71, 0, + 0, 228, 229, 31, 0, 0, 0, 10, 11, 236, + 234, 0, 0, 0, 113, 230, 111, 232, 245, 243, + 239, 241, 238, 257, 240, 230, 79, 80, 81, 82, + 49, 230, 230, 230, 230, 230, 230, 73, 50, 221, + 220, 0, 0, 0, 0, 55, 230, 78, 0, 56, + 58, 122, 123, 201, 202, 124, 217, 218, 0, 230, + 0, 266, 90, 237, 114, 0, 115, 119, 120, 121, + 215, 216, 219, 0, 247, 246, 248, 0, 242, 0, + 0, 0, 0, 26, 0, 25, 24, 254, 107, 105, + 257, 92, 0, 0, 0, 0, 0, 0, 251, 0, + 251, 0, 0, 261, 257, 130, 131, 132, 133, 135, + 134, 136, 137, 138, 139, 0, 140, 254, 97, 0, + 95, 93, 257, 0, 102, 91, 0, 76, 75, 77, + 48, 0, 0, 0, 235, 0, 227, 226, 249, 250, + 244, 263, 0, 230, 230, 0, 0, 230, 255, 256, + 106, 108, 0, 0, 0, 200, 171, 172, 170, 0, + 153, 253, 252, 152, 0, 0, 0, 0, 195, 191, + 0, 190, 257, 183, 177, 176, 175, 0, 0, 0, + 0, 96, 0, 98, 0, 0, 94, 230, 222, 64, + 0, 62, 63, 0, 230, 230, 0, 112, 258, 28, + 27, 74, 47, 259, 0, 0, 213, 0, 214, 0, + 174, 0, 162, 0, 154, 0, 159, 160, 143, 144, + 161, 141, 142, 0, 197, 189, 196, 0, 192, 185, + 187, 186, 182, 184, 265, 0, 158, 157, 164, 165, + 0, 0, 104, 0, 101, 0, 0, 0, 57, 72, + 66, 46, 0, 0, 0, 230, 0, 33, 0, 230, + 208, 212, 0, 0, 251, 199, 0, 198, 0, 262, + 169, 168, 166, 167, 163, 188, 0, 99, 100, 103, + 230, 223, 0, 0, 65, 230, 53, 54, 52, 230, + 0, 0, 0, 117, 125, 128, 126, 203, 204, 127, + 264, 0, 34, 35, 36, 37, 38, 39, 40, 41, + 42, 43, 44, 45, 30, 29, 173, 148, 150, 147, + 0, 145, 146, 0, 194, 193, 178, 0, 69, 67, + 70, 68, 0, 0, 0, 0, 129, 180, 230, 116, + 260, 151, 149, 155, 156, 230, 224, 230, 0, 0, + 0, 0, 179, 118, 0, 0, 0, 0, 206, 0, + 210, 0, 225, 230, 0, 205, 0, 209, 0, 0, + 51, 32, 207, 211, 0, 0, 181 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 3, 4, 6, 8, 9, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 268, 376, - 39, 146, 71, 58, 67, 315, 316, 351, 114, 59, - 115, 255, 256, 257, 347, 391, 393, 68, 314, 105, - 266, 196, 97, 40, 41, 116, 191, 309, 251, 307, - 157, 42, 43, 44, 131, 83, 261, 354, 132, 117, - 355, 356, 118, 171, 285, 172, 383, 403, 173, 228, - 174, 404, 175, 301, 286, 277, 176, 304, 337, 177, - 223, 178, 275, 179, 241, 180, 397, 412, 181, 296, - 297, 339, 238, 289, 290, 331, 329, 182, 119, 358, - 359, 416, 120, 360, 418, 121, 271, 273, 361, 122, - 136, 123, 124, 138, 72, 45, 55, 46, 50, 77, - 47, 60, 91, 142, 205, 229, 215, 144, 320, 243, - 207, 363, 299, 48 + -1, 3, 4, 6, 8, 9, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 274, + 384, 41, 150, 73, 60, 69, 321, 322, 358, 117, + 61, 118, 260, 261, 262, 354, 399, 401, 70, 320, + 108, 272, 200, 100, 42, 43, 119, 195, 315, 256, + 313, 161, 44, 45, 46, 135, 86, 267, 362, 136, + 120, 363, 364, 121, 175, 291, 176, 391, 412, 177, + 233, 178, 413, 179, 307, 292, 283, 180, 310, 344, + 181, 228, 182, 281, 183, 246, 184, 406, 422, 185, + 302, 303, 346, 243, 295, 296, 338, 336, 186, 122, + 366, 367, 427, 123, 368, 429, 124, 277, 279, 369, + 125, 140, 126, 127, 142, 74, 47, 57, 48, 52, + 80, 49, 62, 94, 146, 210, 234, 220, 148, 327, + 248, 212, 371, 305, 50 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -334 +#define YYPACT_NINF -384 static const yytype_int16 yypact[] = { - 134, -334, -334, 41, -334, -334, 47, -50, -334, 169, - 19, -334, 33, 60, 74, 114, -334, -334, -20, -20, - -20, -20, -20, -20, 115, 43, -20, -334, 108, -334, - -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, - 109, -334, -334, -334, -334, -334, -334, -334, -334, -334, - 118, 105, 106, 110, -23, 118, 3, -334, 4, 103, - -334, 112, 113, 116, 117, 119, -334, 120, 123, -334, - -334, -334, -16, 121, -334, -334, -334, 122, 132, -15, - 157, 209, -12, -334, 122, 20, -334, -334, -334, -334, - 131, -334, 43, -334, -334, -334, -334, -334, 43, 43, - 43, 43, 43, 43, -334, -334, -334, -334, 0, 67, - 86, -2, 133, 43, 64, 135, -334, -334, -334, -334, - -334, -334, -334, -334, -334, -16, 136, -334, -334, -334, - -334, 129, -334, -334, -334, -334, -334, -334, -334, 148, - -334, -334, 57, 218, -334, 137, 138, -16, 139, -334, - 140, -334, -334, 73, -334, -334, 131, -334, 141, 142, - 143, 179, 14, 144, 80, 145, 82, 88, -1, 146, - 131, -334, -334, -334, -334, -334, -334, -334, -334, -334, - -334, 183, -334, 73, -334, 147, -334, -334, 131, 149, - 150, -334, 42, -334, -334, -334, -334, -11, 152, -334, - 151, -334, -334, -334, -334, -334, -334, 153, 43, 43, - 154, 182, 43, -334, -334, -334, -334, 239, 244, 245, - -334, -334, -334, -334, 246, -334, -334, -334, -334, 203, - 246, -5, 162, 249, -334, 164, -334, 131, 26, -334, - -334, -334, 251, 247, 17, 166, -334, 254, -334, 255, - 254, -334, 43, -334, -334, 170, -334, -334, 176, 43, - 167, -334, -334, -334, -334, -334, -334, 173, 175, 177, - -334, 174, -334, 178, -334, 180, -334, 181, -334, 184, - -334, -334, -334, -334, -334, -334, -334, 263, -334, -334, - -334, 264, -334, -334, -334, -334, -334, -334, -334, 185, - -334, -334, -334, -334, 130, 266, -334, 187, -334, 188, - 189, 45, -334, -334, 100, -334, 192, -6, -8, 269, - -334, 107, 43, -334, -334, 236, 13, 82, -334, 191, - -334, 193, -334, -334, -334, -334, -334, -334, -334, 194, - -334, -334, -334, 43, -334, 279, 282, -334, 43, -334, - -334, -334, 77, 86, 48, -334, -334, -334, -334, -334, - -334, -334, -334, 196, -334, -334, -334, -334, -334, -334, - -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, - -334, -334, 275, -334, -334, 5, -334, -334, -334, 50, - -334, -334, -334, -334, 200, 201, 202, -334, 243, -8, - -334, -334, -334, -334, -334, -334, 43, -334, 43, 239, - 244, 204, -334, -334, 197, 206, 205, 211, 210, 216, - 266, -334, 43, -334, 239, -334, 244, -18, -334, -334, - -334, 266, 212, -334 + 167, -384, -384, 37, -384, -384, 60, -70, -384, 171, + -23, -384, -13, 9, 12, 63, -384, -384, -33, -33, + -33, -33, -33, -33, 67, 104, -33, -33, -384, 66, + -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, + -384, -384, 68, -384, -384, -384, -384, -384, -384, -384, + -384, -384, 115, 109, 111, 112, -4, 115, 22, -384, + 113, 106, -384, 118, 120, 121, 122, 123, -384, 124, + 130, -384, -384, -384, -16, 126, 127, -384, -384, -384, + 128, 140, -18, 158, 204, -39, -384, 128, 26, -384, + -384, -384, -384, 134, -384, 104, -384, -384, -384, -384, + -384, 104, 104, 104, 104, 104, 104, -384, -384, -384, + -384, 73, 84, 76, -10, 135, 104, 64, 136, -384, + -384, -384, -384, -384, -384, -384, -384, -384, -16, 104, + 147, -384, -384, -384, -384, 137, -384, -384, -384, -384, + -384, -384, -384, 194, -384, -384, 46, 225, -384, 141, + 142, -16, 143, -384, 144, -384, -384, 87, -384, -384, + 134, -384, 145, 146, 148, 189, 15, 149, 88, 150, + 97, 80, 0, 151, 134, -384, -384, -384, -384, -384, + -384, -384, -384, -384, -384, 190, -384, 87, -384, 152, + -384, -384, 134, 153, 154, -384, 42, -384, -384, -384, + -384, -8, 156, 159, -384, 160, -384, -384, -384, -384, + -384, -384, 161, 104, 104, 163, 186, 104, -384, -384, + -384, -384, 249, 251, 252, -384, -384, -384, -384, 253, + -384, -384, -384, -384, 210, 253, 8, 169, 256, -384, + 172, -384, 134, 21, -384, -384, -384, 257, 254, -7, + 173, -384, 261, -384, 262, 261, -384, 104, -384, -384, + 176, -384, -384, 184, 104, 104, 174, -384, -384, -384, + -384, -384, -384, 180, 182, 183, -384, 185, -384, 187, + -384, 188, -384, 191, -384, 193, -384, -384, -384, -384, + -384, -384, -384, 269, -384, -384, -384, 270, -384, -384, + -384, -384, -384, -384, -384, 195, -384, -384, -384, -384, + 133, 271, -384, 196, -384, 197, 198, 45, -384, -384, + 108, -384, 192, -6, 201, -17, 273, -384, 110, 104, + -384, -384, 242, 29, 97, -384, 200, -384, 202, -384, + -384, -384, -384, -384, -384, -384, 203, -384, -384, -384, + 104, -384, 281, 288, -384, 104, -384, -384, -384, 104, + 103, 76, 48, -384, -384, -384, -384, -384, -384, -384, + -384, 205, -384, -384, -384, -384, -384, -384, -384, -384, + -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, + 282, -384, -384, 5, -384, -384, -384, 50, -384, -384, + -384, -384, 208, 209, 211, 212, -384, 260, -17, -384, + -384, -384, -384, -384, -384, 104, -384, 104, 186, 249, + 251, 213, -384, -384, 214, 219, 220, 221, 228, 224, + 230, 271, -384, 104, 110, -384, 249, -384, 251, 49, + -384, -384, -384, -384, 271, 226, -384 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, - -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, - -334, -94, -88, 126, -334, -334, -333, -334, -91, -334, - -334, -334, -334, -334, -334, -334, -334, 128, -334, -334, - -334, -334, -334, -334, -334, 248, -334, -334, -334, 78, - -334, -334, -334, -334, -334, -334, -334, -334, -334, -334, - -76, -334, -81, -334, -334, -334, -334, -334, -334, -334, - -334, -334, -334, -334, -307, 99, -334, -334, -334, -334, - -334, -334, -334, -334, -334, -334, -334, -334, -22, -334, - -334, -303, -334, -334, -334, -334, -334, -334, 250, -334, - -334, -334, -334, -334, -334, -334, -327, -316, 252, -334, - -334, -334, -80, -110, -82, -334, -334, -334, -334, 278, - -334, 256, -334, -334, -334, -161, 155, -146, -334, -334, - -334, -334, -334, -334 + -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, + -384, -384, -384, -384, -384, -384, -384, -384, -384, -100, + -115, -384, -97, -91, 119, -384, -384, -343, -384, -93, + -384, -384, -384, -384, -384, -384, -384, -384, 138, -384, + -384, -384, -384, -384, -384, -384, 255, -384, -384, -384, + 83, -384, -384, -384, -384, -384, -384, -384, -384, -384, + -384, -68, -384, -84, -384, -384, -384, -384, -384, -384, + -384, -384, -384, -384, -384, -308, 107, -384, -384, -384, + -384, -384, -384, -384, -384, -384, -384, -384, -384, -20, + -384, -384, -383, -384, -384, -384, -384, -384, -384, 258, + -384, -384, -384, -384, -384, -384, -384, -320, -371, 259, + -384, -384, -384, -83, -113, -85, -384, -384, -384, -384, + 289, -384, 264, -384, -384, -384, -165, 162, -150, -384, + -384, -384, -384, -384, -384 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -60 +#define YYTABLE_NINF -62 static const yytype_int16 yytable[] = { - 139, 133, 137, 192, 145, 231, 149, 106, 107, 152, - 216, 148, 254, 150, 151, 394, 147, 349, 147, 384, - 280, 147, 108, 108, 244, 239, 281, 183, 282, 153, - 280, 139, 85, 86, 198, 184, 281, 154, 280, 379, - 87, 5, 248, 221, 281, 56, 109, 140, 185, 10, - 109, 186, 302, 380, 352, 7, 210, 110, 187, 141, - 155, 110, 88, 89, 283, 353, 284, 293, 294, 240, - 222, 303, 188, 381, 156, 415, 284, 90, 405, 57, - 111, 111, 417, 112, 284, 382, 81, 431, 66, 428, - 82, 292, 388, 350, 419, 189, 190, 429, 113, 69, - 70, 158, 113, 69, 70, 225, 113, 226, 295, 226, - 430, 395, 92, 159, 160, 264, 161, 427, 203, 227, - 263, 227, 162, 396, 269, 204, 49, 147, 432, 163, - 164, 165, 51, 166, 213, 167, 232, 1, 2, 233, - 234, 214, 311, 235, 168, 61, 62, 63, 64, 65, - 252, 236, 73, 343, 69, 70, 399, 253, 406, 52, - 344, 169, 170, 400, 193, 407, 385, 194, 195, 237, - 139, 201, 202, 53, 11, 12, 13, 317, 14, 15, - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - 26, 364, 365, 366, 367, 368, 369, 370, 371, 372, - 373, 374, 375, 93, 94, 95, 96, 333, 334, 335, - 336, 345, 346, 54, 66, 74, 75, 76, 78, 79, - 98, 99, 56, 80, 100, 101, 104, 102, 103, 125, - 126, 127, 130, 389, 377, 199, 139, 357, 137, 200, - 143, 206, -59, 220, 197, 208, 209, 211, 212, 245, - 217, 218, 219, 224, 230, 242, 247, 265, 249, 250, - 259, 139, 270, 262, 260, 267, 317, 272, 274, 276, - 278, 287, 288, 291, 298, 305, 300, 306, 308, 313, - 312, 318, 319, 321, 323, 322, 328, 330, 324, 338, - 325, 326, 362, 378, 327, 332, 414, 340, 341, 342, - 348, 386, 390, 387, 388, 392, 401, 402, 408, 411, - 409, 410, 421, 420, 422, 423, 424, 139, 357, 137, - 425, 426, 433, 413, 139, 258, 317, 128, 310, 279, - 0, 398, 134, 84, 135, 0, 129, 0, 246, 0, - 317 + 143, 137, 141, 196, 149, 236, 153, 109, 110, 156, + 221, 152, 402, 154, 155, 259, 151, 356, 151, 187, + 111, 151, 111, 112, 249, 392, 244, 188, 308, 10, + 286, 143, 58, 286, 113, 202, 287, 5, 203, 287, + 189, 288, 253, 190, 226, 360, 112, 309, 439, 430, + 191, 88, 89, 144, 286, 387, 361, 113, 215, 90, + 287, 445, 299, 300, 192, 145, 59, 443, 7, 388, + 245, 227, 71, 72, 425, 116, 290, 289, 114, 290, + 114, 91, 92, 115, 51, 414, 53, 193, 194, 389, + 440, 68, 298, 357, 71, 72, 93, 116, 116, 428, + 290, 390, 157, 301, 164, 84, 165, 208, 54, 85, + 158, 55, 166, 230, 209, 231, 442, 270, 162, 167, + 168, 169, 269, 170, 231, 171, 275, 232, 237, 151, + 163, 238, 239, 159, 172, 240, 232, 404, 63, 64, + 65, 66, 67, 241, 317, 75, 76, 160, 218, 405, + 257, 173, 174, 350, 444, 219, 408, 258, 415, 396, + 351, 242, 56, 409, 197, 416, 68, 198, 199, 393, + 1, 2, 143, 77, 324, 78, 11, 12, 13, 323, + 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, 26, 27, 372, 373, 374, 375, 376, 377, + 378, 379, 380, 381, 382, 383, 96, 97, 98, 99, + 340, 341, 342, 343, 79, 71, 72, 206, 207, 352, + 353, 95, 81, 58, 82, 83, 101, 134, 102, 103, + 104, 105, 106, 107, 128, 129, 130, 397, 385, 131, + 143, 365, 141, 147, -61, 201, 204, 205, 211, 213, + 214, 216, 217, 225, 222, 223, 250, 224, 229, 235, + 247, 252, 254, 255, 264, 143, 271, 265, 403, 273, + 323, 268, 276, 266, 278, 280, 282, 284, 293, 294, + 304, 297, 311, 306, 312, 314, 318, 319, 325, 326, + 328, 329, 335, 337, 345, 330, 370, 331, 332, 386, + 355, 333, 424, 334, 398, 339, 347, 348, 349, 359, + 394, 400, 395, 396, 411, 410, 417, 418, 426, 441, + 419, 420, 431, 143, 365, 141, 421, 433, 434, 432, + 143, 435, 323, 436, 437, 438, 446, 132, 316, 263, + 423, 407, 285, 138, 139, 0, 87, 133, 323, 251 }; static const yytype_int16 yycheck[] = { - 82, 82, 82, 113, 92, 166, 100, 23, 24, 103, - 156, 99, 23, 101, 102, 348, 98, 23, 100, 326, - 25, 103, 38, 38, 170, 26, 31, 29, 33, 29, - 25, 113, 29, 30, 125, 37, 31, 37, 25, 26, - 37, 0, 188, 29, 31, 65, 62, 27, 50, 99, - 62, 53, 35, 40, 62, 8, 147, 73, 60, 39, - 60, 73, 59, 60, 69, 73, 71, 41, 42, 70, - 56, 54, 74, 60, 74, 408, 71, 74, 385, 99, - 96, 96, 409, 99, 71, 72, 109, 105, 99, 422, - 113, 237, 110, 99, 410, 97, 98, 424, 114, 111, - 112, 34, 114, 111, 112, 25, 114, 27, 82, 27, - 426, 34, 108, 46, 28, 209, 30, 420, 61, 39, - 208, 39, 36, 46, 212, 68, 107, 209, 431, 43, - 44, 45, 99, 47, 61, 49, 48, 3, 4, 51, - 52, 68, 252, 55, 58, 19, 20, 21, 22, 23, - 108, 63, 26, 108, 111, 112, 108, 115, 108, 99, - 115, 75, 76, 115, 100, 115, 327, 103, 104, 81, - 252, 23, 24, 99, 5, 6, 7, 259, 9, 10, - 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 100, 101, 102, 103, 77, 78, 79, - 80, 111, 112, 99, 99, 107, 107, 99, 113, 113, - 108, 108, 65, 113, 108, 108, 103, 108, 108, 108, - 108, 99, 23, 343, 322, 99, 318, 318, 318, 110, - 109, 23, 109, 64, 109, 108, 108, 108, 108, 66, - 109, 109, 109, 109, 109, 109, 109, 103, 109, 109, - 108, 343, 23, 110, 113, 83, 348, 23, 23, 23, - 67, 109, 23, 109, 23, 109, 29, 23, 23, 103, - 110, 114, 109, 108, 110, 108, 23, 23, 110, 23, - 110, 110, 23, 57, 110, 110, 406, 110, 110, 110, - 108, 110, 23, 110, 110, 23, 110, 32, 108, 66, - 109, 109, 115, 109, 108, 110, 105, 399, 399, 399, - 110, 105, 110, 399, 406, 197, 408, 79, 250, 230, - -1, 353, 82, 55, 82, -1, 80, -1, 183, -1, - 422 + 85, 85, 85, 116, 95, 170, 103, 23, 24, 106, + 160, 102, 355, 104, 105, 23, 101, 23, 103, 29, + 38, 106, 38, 62, 174, 333, 26, 37, 35, 99, + 25, 116, 65, 25, 73, 128, 31, 0, 129, 31, + 50, 33, 192, 53, 29, 62, 62, 54, 431, 420, + 60, 29, 30, 27, 25, 26, 73, 73, 151, 37, + 31, 444, 41, 42, 74, 39, 99, 438, 8, 40, + 70, 56, 111, 112, 417, 114, 71, 69, 96, 71, + 96, 59, 60, 99, 107, 393, 99, 97, 98, 60, + 433, 99, 242, 99, 111, 112, 74, 114, 114, 419, + 71, 72, 29, 82, 28, 109, 30, 61, 99, 113, + 37, 99, 36, 25, 68, 27, 436, 214, 34, 43, + 44, 45, 213, 47, 27, 49, 217, 39, 48, 214, + 46, 51, 52, 60, 58, 55, 39, 34, 19, 20, + 21, 22, 23, 63, 257, 26, 27, 74, 61, 46, + 108, 75, 76, 108, 105, 68, 108, 115, 108, 110, + 115, 81, 99, 115, 100, 115, 99, 103, 104, 334, + 3, 4, 257, 107, 265, 107, 5, 6, 7, 264, + 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, + 19, 20, 21, 22, 84, 85, 86, 87, 88, 89, + 90, 91, 92, 93, 94, 95, 100, 101, 102, 103, + 77, 78, 79, 80, 99, 111, 112, 23, 24, 111, + 112, 108, 113, 65, 113, 113, 108, 23, 108, 108, + 108, 108, 108, 103, 108, 108, 108, 350, 329, 99, + 325, 325, 325, 109, 109, 109, 99, 110, 23, 108, + 108, 108, 108, 64, 109, 109, 66, 109, 109, 109, + 109, 109, 109, 109, 108, 350, 103, 108, 359, 83, + 355, 110, 23, 113, 23, 23, 23, 67, 109, 23, + 23, 109, 109, 29, 23, 23, 110, 103, 114, 109, + 108, 108, 23, 23, 23, 110, 23, 110, 110, 57, + 108, 110, 415, 110, 23, 110, 110, 110, 110, 108, + 110, 23, 110, 110, 32, 110, 108, 108, 418, 434, + 109, 109, 109, 408, 408, 408, 66, 108, 108, 115, + 415, 110, 417, 105, 110, 105, 110, 82, 255, 201, + 408, 361, 235, 85, 85, -1, 57, 83, 433, 187 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -1174,48 +1178,49 @@ static const yytype_uint8 yystos[] = { 0, 3, 4, 117, 118, 0, 119, 8, 120, 121, 99, 5, 6, 7, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 122, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 136, - 159, 160, 167, 168, 169, 231, 233, 236, 249, 107, - 234, 99, 99, 99, 99, 232, 65, 99, 139, 145, - 237, 139, 139, 139, 139, 139, 99, 140, 153, 111, - 112, 138, 230, 139, 107, 107, 99, 235, 113, 113, - 113, 109, 113, 171, 235, 29, 30, 37, 59, 60, - 74, 238, 108, 100, 101, 102, 103, 158, 108, 108, - 108, 108, 108, 108, 103, 155, 23, 24, 38, 62, - 73, 96, 99, 114, 144, 146, 161, 175, 178, 214, - 218, 221, 225, 227, 228, 108, 108, 99, 161, 237, - 23, 170, 174, 178, 214, 224, 226, 228, 229, 230, - 27, 39, 239, 109, 243, 138, 137, 230, 138, 137, - 138, 138, 137, 29, 37, 60, 74, 166, 34, 46, - 28, 30, 36, 43, 44, 45, 47, 49, 58, 75, - 76, 179, 181, 184, 186, 188, 192, 195, 197, 199, - 201, 204, 213, 29, 37, 50, 53, 60, 74, 97, - 98, 162, 229, 100, 103, 104, 157, 109, 144, 99, - 110, 23, 24, 61, 68, 240, 23, 246, 108, 108, - 144, 108, 108, 61, 68, 242, 243, 109, 109, 109, - 64, 29, 56, 196, 109, 25, 27, 39, 185, 241, - 109, 241, 48, 51, 52, 55, 63, 81, 208, 26, - 70, 200, 109, 245, 243, 66, 242, 109, 243, 109, - 109, 164, 108, 115, 23, 147, 148, 149, 153, 108, - 113, 172, 110, 138, 137, 103, 156, 83, 134, 138, - 23, 222, 23, 223, 23, 198, 23, 191, 67, 191, - 25, 31, 33, 69, 71, 180, 190, 109, 23, 209, - 210, 109, 243, 41, 42, 82, 205, 206, 23, 248, - 29, 189, 35, 54, 193, 109, 23, 165, 23, 163, - 165, 229, 110, 103, 154, 141, 142, 230, 114, 109, - 244, 108, 108, 110, 110, 110, 110, 110, 23, 212, - 23, 211, 110, 77, 78, 79, 80, 194, 23, 207, - 110, 110, 110, 108, 115, 111, 112, 150, 108, 23, - 99, 143, 62, 73, 173, 176, 177, 178, 215, 216, - 219, 224, 23, 247, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 135, 138, 57, 26, - 40, 60, 72, 182, 190, 241, 110, 110, 110, 229, - 23, 151, 23, 152, 142, 34, 46, 202, 204, 108, - 115, 110, 32, 183, 187, 190, 108, 115, 108, 109, - 109, 66, 203, 176, 229, 142, 217, 222, 220, 223, - 109, 115, 108, 110, 105, 110, 105, 207, 142, 222, - 223, 105, 207, 110 + 15, 16, 17, 18, 19, 20, 21, 22, 122, 123, + 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, + 134, 137, 160, 161, 168, 169, 170, 232, 234, 237, + 250, 107, 235, 99, 99, 99, 99, 233, 65, 99, + 140, 146, 238, 140, 140, 140, 140, 140, 99, 141, + 154, 111, 112, 139, 231, 140, 140, 107, 107, 99, + 236, 113, 113, 113, 109, 113, 172, 236, 29, 30, + 37, 59, 60, 74, 239, 108, 100, 101, 102, 103, + 159, 108, 108, 108, 108, 108, 108, 103, 156, 23, + 24, 38, 62, 73, 96, 99, 114, 145, 147, 162, + 176, 179, 215, 219, 222, 226, 228, 229, 108, 108, + 108, 99, 162, 238, 23, 171, 175, 179, 215, 225, + 227, 229, 230, 231, 27, 39, 240, 109, 244, 139, + 138, 231, 139, 138, 139, 139, 138, 29, 37, 60, + 74, 167, 34, 46, 28, 30, 36, 43, 44, 45, + 47, 49, 58, 75, 76, 180, 182, 185, 187, 189, + 193, 196, 198, 200, 202, 205, 214, 29, 37, 50, + 53, 60, 74, 97, 98, 163, 230, 100, 103, 104, + 158, 109, 145, 139, 99, 110, 23, 24, 61, 68, + 241, 23, 247, 108, 108, 145, 108, 108, 61, 68, + 243, 244, 109, 109, 109, 64, 29, 56, 197, 109, + 25, 27, 39, 186, 242, 109, 242, 48, 51, 52, + 55, 63, 81, 209, 26, 70, 201, 109, 246, 244, + 66, 243, 109, 244, 109, 109, 165, 108, 115, 23, + 148, 149, 150, 154, 108, 108, 113, 173, 110, 139, + 138, 103, 157, 83, 135, 139, 23, 223, 23, 224, + 23, 199, 23, 192, 67, 192, 25, 31, 33, 69, + 71, 181, 191, 109, 23, 210, 211, 109, 244, 41, + 42, 82, 206, 207, 23, 249, 29, 190, 35, 54, + 194, 109, 23, 166, 23, 164, 166, 230, 110, 103, + 155, 142, 143, 231, 139, 114, 109, 245, 108, 108, + 110, 110, 110, 110, 110, 23, 213, 23, 212, 110, + 77, 78, 79, 80, 195, 23, 208, 110, 110, 110, + 108, 115, 111, 112, 151, 108, 23, 99, 144, 108, + 62, 73, 174, 177, 178, 179, 216, 217, 220, 225, + 23, 248, 84, 85, 86, 87, 88, 89, 90, 91, + 92, 93, 94, 95, 136, 139, 57, 26, 40, 60, + 72, 183, 191, 242, 110, 110, 110, 230, 23, 152, + 23, 153, 143, 139, 34, 46, 203, 205, 108, 115, + 110, 32, 184, 188, 191, 108, 115, 108, 108, 109, + 109, 66, 204, 177, 230, 143, 135, 218, 223, 221, + 224, 109, 115, 108, 108, 110, 105, 110, 105, 208, + 143, 136, 223, 224, 105, 208, 110 }; #define yyerrok (yyerrstatus = 0) @@ -2159,69 +2164,69 @@ yyreduce: ;} break; - case 23: + case 24: /* Line 1455 of yacc.c */ -#line 353 "program_parse.y" +#line 354 "program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_ARL, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); ;} break; - case 24: + case 25: /* Line 1455 of yacc.c */ -#line 359 "program_parse.y" +#line 360 "program_parse.y" { (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (4)].temp_inst).Opcode, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (4)].temp_inst).SaturateMode; ;} break; - case 25: + case 26: /* Line 1455 of yacc.c */ -#line 366 "program_parse.y" +#line 367 "program_parse.y" { (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (4)].temp_inst).Opcode, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (4)].temp_inst).SaturateMode; ;} break; - case 26: + case 27: /* Line 1455 of yacc.c */ -#line 373 "program_parse.y" +#line 374 "program_parse.y" { (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (6)].temp_inst).Opcode, & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL); (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (6)].temp_inst).SaturateMode; ;} break; - case 27: + case 28: /* Line 1455 of yacc.c */ -#line 381 "program_parse.y" +#line 382 "program_parse.y" { (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (6)].temp_inst).Opcode, & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL); (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (6)].temp_inst).SaturateMode; ;} break; - case 28: + case 29: /* Line 1455 of yacc.c */ -#line 389 "program_parse.y" +#line 390 "program_parse.y" { (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (8)].temp_inst).Opcode, & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), & (yyvsp[(6) - (8)].src_reg), & (yyvsp[(8) - (8)].src_reg)); (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (8)].temp_inst).SaturateMode; ;} break; - case 29: + case 30: /* Line 1455 of yacc.c */ -#line 396 "program_parse.y" +#line 397 "program_parse.y" { (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (8)].temp_inst).Opcode, & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), NULL, NULL); if ((yyval.inst) != NULL) { @@ -2266,113 +2271,161 @@ yyreduce: ;} break; - case 30: + case 31: /* Line 1455 of yacc.c */ -#line 441 "program_parse.y" +#line 442 "program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_KIL, NULL, & (yyvsp[(2) - (2)].src_reg), NULL, NULL); state->fragment.UsesKill = 1; ;} break; - case 31: + case 32: + +/* Line 1455 of yacc.c */ +#line 449 "program_parse.y" + { + (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (12)].temp_inst).Opcode, & (yyvsp[(2) - (12)].dst_reg), & (yyvsp[(4) - (12)].src_reg), & (yyvsp[(6) - (12)].src_reg), & (yyvsp[(8) - (12)].src_reg)); + if ((yyval.inst) != NULL) { + const GLbitfield tex_mask = (1U << (yyvsp[(10) - (12)].integer)); + GLbitfield shadow_tex = 0; + GLbitfield target_mask = 0; + + + (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (12)].temp_inst).SaturateMode; + (yyval.inst)->Base.TexSrcUnit = (yyvsp[(10) - (12)].integer); + + if ((yyvsp[(12) - (12)].integer) < 0) { + shadow_tex = tex_mask; + + (yyval.inst)->Base.TexSrcTarget = -(yyvsp[(12) - (12)].integer); + (yyval.inst)->Base.TexShadow = 1; + } else { + (yyval.inst)->Base.TexSrcTarget = (yyvsp[(12) - (12)].integer); + } + + target_mask = (1U << (yyval.inst)->Base.TexSrcTarget); + + /* If this texture unit was previously accessed and that access + * had a different texture target, generate an error. + * + * If this texture unit was previously accessed and that access + * had a different shadow mode, generate an error. + */ + if ((state->prog->TexturesUsed[(yyvsp[(10) - (12)].integer)] != 0) + && ((state->prog->TexturesUsed[(yyvsp[(10) - (12)].integer)] != target_mask) + || ((state->prog->ShadowSamplers & tex_mask) + != shadow_tex))) { + yyerror(& (yylsp[(12) - (12)]), state, + "multiple targets used on one texture image unit"); + YYERROR; + } + + + state->prog->TexturesUsed[(yyvsp[(10) - (12)].integer)] |= target_mask; + state->prog->ShadowSamplers |= shadow_tex; + } + ;} + break; + + case 33: /* Line 1455 of yacc.c */ -#line 448 "program_parse.y" +#line 494 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; - case 32: + case 34: /* Line 1455 of yacc.c */ -#line 453 "program_parse.y" +#line 499 "program_parse.y" { (yyval.integer) = TEXTURE_1D_INDEX; ;} break; - case 33: + case 35: /* Line 1455 of yacc.c */ -#line 454 "program_parse.y" +#line 500 "program_parse.y" { (yyval.integer) = TEXTURE_2D_INDEX; ;} break; - case 34: + case 36: /* Line 1455 of yacc.c */ -#line 455 "program_parse.y" +#line 501 "program_parse.y" { (yyval.integer) = TEXTURE_3D_INDEX; ;} break; - case 35: + case 37: /* Line 1455 of yacc.c */ -#line 456 "program_parse.y" +#line 502 "program_parse.y" { (yyval.integer) = TEXTURE_CUBE_INDEX; ;} break; - case 36: + case 38: /* Line 1455 of yacc.c */ -#line 457 "program_parse.y" +#line 503 "program_parse.y" { (yyval.integer) = TEXTURE_RECT_INDEX; ;} break; - case 37: + case 39: /* Line 1455 of yacc.c */ -#line 458 "program_parse.y" +#line 504 "program_parse.y" { (yyval.integer) = -TEXTURE_1D_INDEX; ;} break; - case 38: + case 40: /* Line 1455 of yacc.c */ -#line 459 "program_parse.y" +#line 505 "program_parse.y" { (yyval.integer) = -TEXTURE_2D_INDEX; ;} break; - case 39: + case 41: /* Line 1455 of yacc.c */ -#line 460 "program_parse.y" +#line 506 "program_parse.y" { (yyval.integer) = -TEXTURE_RECT_INDEX; ;} break; - case 40: + case 42: /* Line 1455 of yacc.c */ -#line 461 "program_parse.y" +#line 507 "program_parse.y" { (yyval.integer) = TEXTURE_1D_ARRAY_INDEX; ;} break; - case 41: + case 43: /* Line 1455 of yacc.c */ -#line 462 "program_parse.y" +#line 508 "program_parse.y" { (yyval.integer) = TEXTURE_2D_ARRAY_INDEX; ;} break; - case 42: + case 44: /* Line 1455 of yacc.c */ -#line 463 "program_parse.y" +#line 509 "program_parse.y" { (yyval.integer) = -TEXTURE_1D_ARRAY_INDEX; ;} break; - case 43: + case 45: /* Line 1455 of yacc.c */ -#line 464 "program_parse.y" +#line 510 "program_parse.y" { (yyval.integer) = -TEXTURE_2D_ARRAY_INDEX; ;} break; - case 44: + case 46: /* Line 1455 of yacc.c */ -#line 468 "program_parse.y" +#line 514 "program_parse.y" { /* FIXME: Is this correct? Should the extenedSwizzle be applied * FIXME: to the existing swizzle? @@ -2385,10 +2438,10 @@ yyreduce: ;} break; - case 45: + case 47: /* Line 1455 of yacc.c */ -#line 481 "program_parse.y" +#line 527 "program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (3)].src_reg); @@ -2401,10 +2454,10 @@ yyreduce: ;} break; - case 46: + case 48: /* Line 1455 of yacc.c */ -#line 494 "program_parse.y" +#line 540 "program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (3)].src_reg); @@ -2417,10 +2470,10 @@ yyreduce: ;} break; - case 47: + case 49: /* Line 1455 of yacc.c */ -#line 507 "program_parse.y" +#line 553 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); (yyval.dst_reg).WriteMask = (yyvsp[(2) - (2)].swiz_mask).mask; @@ -2442,10 +2495,10 @@ yyreduce: ;} break; - case 48: + case 50: /* Line 1455 of yacc.c */ -#line 529 "program_parse.y" +#line 575 "program_parse.y" { init_dst_reg(& (yyval.dst_reg)); (yyval.dst_reg).File = PROGRAM_ADDRESS; @@ -2454,10 +2507,10 @@ yyreduce: ;} break; - case 49: + case 51: /* Line 1455 of yacc.c */ -#line 538 "program_parse.y" +#line 584 "program_parse.y" { const unsigned xyzw_valid = ((yyvsp[(1) - (7)].ext_swizzle).xyzw_valid << 0) @@ -2490,20 +2543,20 @@ yyreduce: ;} break; - case 50: + case 52: /* Line 1455 of yacc.c */ -#line 571 "program_parse.y" +#line 617 "program_parse.y" { (yyval.ext_swizzle) = (yyvsp[(2) - (2)].ext_swizzle); (yyval.ext_swizzle).negate = ((yyvsp[(1) - (2)].negate)) ? 1 : 0; ;} break; - case 51: + case 53: /* Line 1455 of yacc.c */ -#line 578 "program_parse.y" +#line 624 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) != 0) && ((yyvsp[(1) - (1)].integer) != 1)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector"); @@ -2520,10 +2573,10 @@ yyreduce: ;} break; - case 52: + case 54: /* Line 1455 of yacc.c */ -#line 593 "program_parse.y" +#line 639 "program_parse.y" { if (strlen((yyvsp[(1) - (1)].string)) > 1) { yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector"); @@ -2573,10 +2626,10 @@ yyreduce: ;} break; - case 53: + case 55: /* Line 1455 of yacc.c */ -#line 643 "program_parse.y" +#line 689 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2620,10 +2673,10 @@ yyreduce: ;} break; - case 54: + case 56: /* Line 1455 of yacc.c */ -#line 685 "program_parse.y" +#line 731 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.File = PROGRAM_INPUT; @@ -2636,10 +2689,10 @@ yyreduce: ;} break; - case 55: + case 57: /* Line 1455 of yacc.c */ -#line 696 "program_parse.y" +#line 742 "program_parse.y" { if (! (yyvsp[(3) - (4)].src_reg).Base.RelAddr && ((unsigned) (yyvsp[(3) - (4)].src_reg).Base.Index >= (yyvsp[(1) - (4)].sym)->param_binding_length)) { @@ -2662,10 +2715,10 @@ yyreduce: ;} break; - case 56: + case 58: /* Line 1455 of yacc.c */ -#line 717 "program_parse.y" +#line 763 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.File = ((yyvsp[(1) - (1)].temp_sym).name != NULL) @@ -2675,10 +2728,10 @@ yyreduce: ;} break; - case 57: + case 59: /* Line 1455 of yacc.c */ -#line 727 "program_parse.y" +#line 773 "program_parse.y" { init_dst_reg(& (yyval.dst_reg)); (yyval.dst_reg).File = PROGRAM_OUTPUT; @@ -2686,10 +2739,10 @@ yyreduce: ;} break; - case 58: + case 60: /* Line 1455 of yacc.c */ -#line 733 "program_parse.y" +#line 779 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2720,10 +2773,10 @@ yyreduce: ;} break; - case 59: + case 61: /* Line 1455 of yacc.c */ -#line 764 "program_parse.y" +#line 810 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2740,20 +2793,20 @@ yyreduce: ;} break; - case 62: + case 64: /* Line 1455 of yacc.c */ -#line 783 "program_parse.y" +#line 829 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].integer); ;} break; - case 63: + case 65: /* Line 1455 of yacc.c */ -#line 790 "program_parse.y" +#line 836 "program_parse.y" { /* FINISHME: Add support for multiple address registers. */ @@ -2765,31 +2818,31 @@ yyreduce: ;} break; - case 64: + case 66: /* Line 1455 of yacc.c */ -#line 801 "program_parse.y" +#line 847 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 65: + case 67: /* Line 1455 of yacc.c */ -#line 802 "program_parse.y" +#line 848 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; - case 66: + case 68: /* Line 1455 of yacc.c */ -#line 803 "program_parse.y" +#line 849 "program_parse.y" { (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;} break; - case 67: + case 69: /* Line 1455 of yacc.c */ -#line 807 "program_parse.y" +#line 853 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 63)) { yyerror(& (yylsp[(1) - (1)]), state, @@ -2801,10 +2854,10 @@ yyreduce: ;} break; - case 68: + case 70: /* Line 1455 of yacc.c */ -#line 819 "program_parse.y" +#line 865 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 64)) { yyerror(& (yylsp[(1) - (1)]), state, @@ -2816,10 +2869,10 @@ yyreduce: ;} break; - case 69: + case 71: /* Line 1455 of yacc.c */ -#line 831 "program_parse.y" +#line 877 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2837,10 +2890,10 @@ yyreduce: ;} break; - case 70: + case 72: /* Line 1455 of yacc.c */ -#line 849 "program_parse.y" +#line 895 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, "invalid address component selector"); @@ -2851,10 +2904,10 @@ yyreduce: ;} break; - case 71: + case 73: /* Line 1455 of yacc.c */ -#line 860 "program_parse.y" +#line 906 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, @@ -2866,24 +2919,24 @@ yyreduce: ;} break; - case 76: + case 78: /* Line 1455 of yacc.c */ -#line 876 "program_parse.y" +#line 922 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; - case 81: + case 83: /* Line 1455 of yacc.c */ -#line 880 "program_parse.y" +#line 926 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; - case 88: + case 90: /* Line 1455 of yacc.c */ -#line 892 "program_parse.y" +#line 938 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (4)].string), at_attrib, & (yylsp[(2) - (4)])); @@ -2901,55 +2954,55 @@ yyreduce: ;} break; - case 89: + case 91: /* Line 1455 of yacc.c */ -#line 910 "program_parse.y" +#line 956 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} break; - case 90: + case 92: /* Line 1455 of yacc.c */ -#line 914 "program_parse.y" +#line 960 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} break; - case 91: + case 93: /* Line 1455 of yacc.c */ -#line 920 "program_parse.y" +#line 966 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_POS; ;} break; - case 92: + case 94: /* Line 1455 of yacc.c */ -#line 924 "program_parse.y" +#line 970 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_WEIGHT; ;} break; - case 93: + case 95: /* Line 1455 of yacc.c */ -#line 928 "program_parse.y" +#line 974 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_NORMAL; ;} break; - case 94: + case 96: /* Line 1455 of yacc.c */ -#line 932 "program_parse.y" +#line 978 "program_parse.y" { if (!state->ctx->Extensions.EXT_secondary_color) { yyerror(& (yylsp[(2) - (2)]), state, "GL_EXT_secondary_color not supported"); @@ -2960,10 +3013,10 @@ yyreduce: ;} break; - case 95: + case 97: /* Line 1455 of yacc.c */ -#line 941 "program_parse.y" +#line 987 "program_parse.y" { if (!state->ctx->Extensions.EXT_fog_coord) { yyerror(& (yylsp[(1) - (1)]), state, "GL_EXT_fog_coord not supported"); @@ -2974,38 +3027,38 @@ yyreduce: ;} break; - case 96: + case 98: /* Line 1455 of yacc.c */ -#line 950 "program_parse.y" +#line 996 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} break; - case 97: + case 99: /* Line 1455 of yacc.c */ -#line 954 "program_parse.y" +#line 1000 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; ;} break; - case 98: + case 100: /* Line 1455 of yacc.c */ -#line 959 "program_parse.y" +#line 1005 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_GENERIC0 + (yyvsp[(3) - (4)].integer); ;} break; - case 99: + case 101: /* Line 1455 of yacc.c */ -#line 965 "program_parse.y" +#line 1011 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxAttribs) { yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex attribute reference"); @@ -3016,46 +3069,46 @@ yyreduce: ;} break; - case 103: + case 105: /* Line 1455 of yacc.c */ -#line 979 "program_parse.y" +#line 1025 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_WPOS; ;} break; - case 104: + case 106: /* Line 1455 of yacc.c */ -#line 983 "program_parse.y" +#line 1029 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_COL0 + (yyvsp[(2) - (2)].integer); ;} break; - case 105: + case 107: /* Line 1455 of yacc.c */ -#line 987 "program_parse.y" +#line 1033 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_FOGC; ;} break; - case 106: + case 108: /* Line 1455 of yacc.c */ -#line 991 "program_parse.y" +#line 1037 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} break; - case 109: + case 111: /* Line 1455 of yacc.c */ -#line 999 "program_parse.y" +#line 1045 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (3)].string), at_param, & (yylsp[(2) - (3)])); @@ -3071,10 +3124,10 @@ yyreduce: ;} break; - case 110: + case 112: /* Line 1455 of yacc.c */ -#line 1015 "program_parse.y" +#line 1061 "program_parse.y" { if (((yyvsp[(4) - (6)].integer) != 0) && ((unsigned) (yyvsp[(4) - (6)].integer) != (yyvsp[(6) - (6)].temp_sym).param_binding_length)) { yyerror(& (yylsp[(4) - (6)]), state, @@ -3096,19 +3149,19 @@ yyreduce: ;} break; - case 111: + case 113: /* Line 1455 of yacc.c */ -#line 1037 "program_parse.y" +#line 1083 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 112: + case 114: /* Line 1455 of yacc.c */ -#line 1041 "program_parse.y" +#line 1087 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxParameters)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid parameter array size"); @@ -3119,38 +3172,38 @@ yyreduce: ;} break; - case 113: + case 115: /* Line 1455 of yacc.c */ -#line 1052 "program_parse.y" +#line 1098 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(2) - (2)].temp_sym); ;} break; - case 114: + case 116: /* Line 1455 of yacc.c */ -#line 1058 "program_parse.y" +#line 1104 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(3) - (4)].temp_sym); ;} break; - case 116: + case 118: /* Line 1455 of yacc.c */ -#line 1065 "program_parse.y" +#line 1111 "program_parse.y" { (yyvsp[(1) - (3)].temp_sym).param_binding_length += (yyvsp[(3) - (3)].temp_sym).param_binding_length; (yyval.temp_sym) = (yyvsp[(1) - (3)].temp_sym); ;} break; - case 117: + case 119: /* Line 1455 of yacc.c */ -#line 1072 "program_parse.y" +#line 1118 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3158,10 +3211,10 @@ yyreduce: ;} break; - case 118: + case 120: /* Line 1455 of yacc.c */ -#line 1078 "program_parse.y" +#line 1124 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3169,10 +3222,10 @@ yyreduce: ;} break; - case 119: + case 121: /* Line 1455 of yacc.c */ -#line 1084 "program_parse.y" +#line 1130 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3180,10 +3233,10 @@ yyreduce: ;} break; - case 120: + case 122: /* Line 1455 of yacc.c */ -#line 1092 "program_parse.y" +#line 1138 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3191,10 +3244,10 @@ yyreduce: ;} break; - case 121: + case 123: /* Line 1455 of yacc.c */ -#line 1098 "program_parse.y" +#line 1144 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3202,10 +3255,10 @@ yyreduce: ;} break; - case 122: + case 124: /* Line 1455 of yacc.c */ -#line 1104 "program_parse.y" +#line 1150 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3213,10 +3266,10 @@ yyreduce: ;} break; - case 123: + case 125: /* Line 1455 of yacc.c */ -#line 1112 "program_parse.y" +#line 1158 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3224,10 +3277,10 @@ yyreduce: ;} break; - case 124: + case 126: /* Line 1455 of yacc.c */ -#line 1118 "program_parse.y" +#line 1164 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3235,10 +3288,10 @@ yyreduce: ;} break; - case 125: + case 127: /* Line 1455 of yacc.c */ -#line 1124 "program_parse.y" +#line 1170 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3246,101 +3299,101 @@ yyreduce: ;} break; - case 126: - -/* Line 1455 of yacc.c */ -#line 1131 "program_parse.y" - { memcpy((yyval.state), (yyvsp[(1) - (1)].state), sizeof((yyval.state))); ;} - break; - - case 127: - -/* Line 1455 of yacc.c */ -#line 1132 "program_parse.y" - { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} - break; - case 128: /* Line 1455 of yacc.c */ -#line 1135 "program_parse.y" - { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} +#line 1177 "program_parse.y" + { memcpy((yyval.state), (yyvsp[(1) - (1)].state), sizeof((yyval.state))); ;} break; case 129: /* Line 1455 of yacc.c */ -#line 1136 "program_parse.y" +#line 1178 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 130: /* Line 1455 of yacc.c */ -#line 1137 "program_parse.y" +#line 1181 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 131: /* Line 1455 of yacc.c */ -#line 1138 "program_parse.y" +#line 1182 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 132: /* Line 1455 of yacc.c */ -#line 1139 "program_parse.y" +#line 1183 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 133: /* Line 1455 of yacc.c */ -#line 1140 "program_parse.y" +#line 1184 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 134: /* Line 1455 of yacc.c */ -#line 1141 "program_parse.y" +#line 1185 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 135: /* Line 1455 of yacc.c */ -#line 1142 "program_parse.y" +#line 1186 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 136: /* Line 1455 of yacc.c */ -#line 1143 "program_parse.y" +#line 1187 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 137: /* Line 1455 of yacc.c */ -#line 1144 "program_parse.y" +#line 1188 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 138: /* Line 1455 of yacc.c */ -#line 1145 "program_parse.y" +#line 1189 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 139: /* Line 1455 of yacc.c */ -#line 1149 "program_parse.y" +#line 1190 "program_parse.y" + { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} + break; + + case 140: + +/* Line 1455 of yacc.c */ +#line 1191 "program_parse.y" + { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} + break; + + case 141: + +/* Line 1455 of yacc.c */ +#line 1195 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_MATERIAL; @@ -3349,37 +3402,37 @@ yyreduce: ;} break; - case 140: + case 142: /* Line 1455 of yacc.c */ -#line 1158 "program_parse.y" +#line 1204 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 141: + case 143: /* Line 1455 of yacc.c */ -#line 1162 "program_parse.y" +#line 1208 "program_parse.y" { (yyval.integer) = STATE_EMISSION; ;} break; - case 142: + case 144: /* Line 1455 of yacc.c */ -#line 1166 "program_parse.y" +#line 1212 "program_parse.y" { (yyval.integer) = STATE_SHININESS; ;} break; - case 143: + case 145: /* Line 1455 of yacc.c */ -#line 1172 "program_parse.y" +#line 1218 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHT; @@ -3388,28 +3441,28 @@ yyreduce: ;} break; - case 144: + case 146: /* Line 1455 of yacc.c */ -#line 1181 "program_parse.y" +#line 1227 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 145: + case 147: /* Line 1455 of yacc.c */ -#line 1185 "program_parse.y" +#line 1231 "program_parse.y" { (yyval.integer) = STATE_POSITION; ;} break; - case 146: + case 148: /* Line 1455 of yacc.c */ -#line 1189 "program_parse.y" +#line 1235 "program_parse.y" { if (!state->ctx->Extensions.EXT_point_parameters) { yyerror(& (yylsp[(1) - (1)]), state, "GL_ARB_point_parameters not supported"); @@ -3420,57 +3473,57 @@ yyreduce: ;} break; - case 147: + case 149: /* Line 1455 of yacc.c */ -#line 1198 "program_parse.y" +#line 1244 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; - case 148: + case 150: /* Line 1455 of yacc.c */ -#line 1202 "program_parse.y" +#line 1248 "program_parse.y" { (yyval.integer) = STATE_HALF_VECTOR; ;} break; - case 149: + case 151: /* Line 1455 of yacc.c */ -#line 1208 "program_parse.y" +#line 1254 "program_parse.y" { (yyval.integer) = STATE_SPOT_DIRECTION; ;} break; - case 150: + case 152: /* Line 1455 of yacc.c */ -#line 1214 "program_parse.y" +#line 1260 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (2)].state)[1]; ;} break; - case 151: + case 153: /* Line 1455 of yacc.c */ -#line 1221 "program_parse.y" +#line 1267 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_AMBIENT; ;} break; - case 152: + case 154: /* Line 1455 of yacc.c */ -#line 1226 "program_parse.y" +#line 1272 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_SCENECOLOR; @@ -3478,10 +3531,10 @@ yyreduce: ;} break; - case 153: + case 155: /* Line 1455 of yacc.c */ -#line 1234 "program_parse.y" +#line 1280 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTPROD; @@ -3491,10 +3544,10 @@ yyreduce: ;} break; - case 155: + case 157: /* Line 1455 of yacc.c */ -#line 1246 "program_parse.y" +#line 1292 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(3) - (3)].integer); @@ -3502,46 +3555,46 @@ yyreduce: ;} break; - case 156: + case 158: /* Line 1455 of yacc.c */ -#line 1254 "program_parse.y" +#line 1300 "program_parse.y" { (yyval.integer) = STATE_TEXENV_COLOR; ;} break; - case 157: + case 159: /* Line 1455 of yacc.c */ -#line 1260 "program_parse.y" +#line 1306 "program_parse.y" { (yyval.integer) = STATE_AMBIENT; ;} break; - case 158: + case 160: /* Line 1455 of yacc.c */ -#line 1264 "program_parse.y" +#line 1310 "program_parse.y" { (yyval.integer) = STATE_DIFFUSE; ;} break; - case 159: + case 161: /* Line 1455 of yacc.c */ -#line 1268 "program_parse.y" +#line 1314 "program_parse.y" { (yyval.integer) = STATE_SPECULAR; ;} break; - case 160: + case 162: /* Line 1455 of yacc.c */ -#line 1274 "program_parse.y" +#line 1320 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxLights) { yyerror(& (yylsp[(1) - (1)]), state, "invalid light selector"); @@ -3552,10 +3605,10 @@ yyreduce: ;} break; - case 161: + case 163: /* Line 1455 of yacc.c */ -#line 1285 "program_parse.y" +#line 1331 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_TEXGEN; @@ -3564,92 +3617,92 @@ yyreduce: ;} break; - case 162: + case 164: /* Line 1455 of yacc.c */ -#line 1294 "program_parse.y" +#line 1340 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S; ;} break; - case 163: + case 165: /* Line 1455 of yacc.c */ -#line 1298 "program_parse.y" +#line 1344 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_OBJECT_S; ;} break; - case 164: + case 166: /* Line 1455 of yacc.c */ -#line 1303 "program_parse.y" +#line 1349 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S; ;} break; - case 165: + case 167: /* Line 1455 of yacc.c */ -#line 1307 "program_parse.y" +#line 1353 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S; ;} break; - case 166: + case 168: /* Line 1455 of yacc.c */ -#line 1311 "program_parse.y" +#line 1357 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S; ;} break; - case 167: + case 169: /* Line 1455 of yacc.c */ -#line 1315 "program_parse.y" +#line 1361 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S; ;} break; - case 168: + case 170: /* Line 1455 of yacc.c */ -#line 1321 "program_parse.y" +#line 1367 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); ;} break; - case 169: + case 171: /* Line 1455 of yacc.c */ -#line 1328 "program_parse.y" +#line 1374 "program_parse.y" { (yyval.integer) = STATE_FOG_COLOR; ;} break; - case 170: + case 172: /* Line 1455 of yacc.c */ -#line 1332 "program_parse.y" +#line 1378 "program_parse.y" { (yyval.integer) = STATE_FOG_PARAMS; ;} break; - case 171: + case 173: /* Line 1455 of yacc.c */ -#line 1338 "program_parse.y" +#line 1384 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_CLIPPLANE; @@ -3657,10 +3710,10 @@ yyreduce: ;} break; - case 172: + case 174: /* Line 1455 of yacc.c */ -#line 1346 "program_parse.y" +#line 1392 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxClipPlanes) { yyerror(& (yylsp[(1) - (1)]), state, "invalid clip plane selector"); @@ -3671,38 +3724,38 @@ yyreduce: ;} break; - case 173: + case 175: /* Line 1455 of yacc.c */ -#line 1357 "program_parse.y" +#line 1403 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); ;} break; - case 174: + case 176: /* Line 1455 of yacc.c */ -#line 1364 "program_parse.y" +#line 1410 "program_parse.y" { (yyval.integer) = STATE_POINT_SIZE; ;} break; - case 175: + case 177: /* Line 1455 of yacc.c */ -#line 1368 "program_parse.y" +#line 1414 "program_parse.y" { (yyval.integer) = STATE_POINT_ATTENUATION; ;} break; - case 176: + case 178: /* Line 1455 of yacc.c */ -#line 1374 "program_parse.y" +#line 1420 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (5)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (5)].state)[1]; @@ -3712,10 +3765,10 @@ yyreduce: ;} break; - case 177: + case 179: /* Line 1455 of yacc.c */ -#line 1384 "program_parse.y" +#line 1430 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (2)].state)[1]; @@ -3725,20 +3778,20 @@ yyreduce: ;} break; - case 178: + case 180: /* Line 1455 of yacc.c */ -#line 1394 "program_parse.y" +#line 1440 "program_parse.y" { (yyval.state)[2] = 0; (yyval.state)[3] = 3; ;} break; - case 179: + case 181: /* Line 1455 of yacc.c */ -#line 1399 "program_parse.y" +#line 1445 "program_parse.y" { /* It seems logical that the matrix row range specifier would have * to specify a range or more than one row (i.e., $5 > $3). @@ -3756,10 +3809,10 @@ yyreduce: ;} break; - case 180: + case 182: /* Line 1455 of yacc.c */ -#line 1417 "program_parse.y" +#line 1463 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (3)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (3)].state)[1]; @@ -3767,55 +3820,55 @@ yyreduce: ;} break; - case 181: + case 183: /* Line 1455 of yacc.c */ -#line 1425 "program_parse.y" +#line 1471 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 182: + case 184: /* Line 1455 of yacc.c */ -#line 1429 "program_parse.y" +#line 1475 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 183: + case 185: /* Line 1455 of yacc.c */ -#line 1435 "program_parse.y" +#line 1481 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVERSE; ;} break; - case 184: + case 186: /* Line 1455 of yacc.c */ -#line 1439 "program_parse.y" +#line 1485 "program_parse.y" { (yyval.integer) = STATE_MATRIX_TRANSPOSE; ;} break; - case 185: + case 187: /* Line 1455 of yacc.c */ -#line 1443 "program_parse.y" +#line 1489 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVTRANS; ;} break; - case 186: + case 188: /* Line 1455 of yacc.c */ -#line 1449 "program_parse.y" +#line 1495 "program_parse.y" { if ((yyvsp[(1) - (1)].integer) > 3) { yyerror(& (yylsp[(1) - (1)]), state, "invalid matrix row reference"); @@ -3826,88 +3879,88 @@ yyreduce: ;} break; - case 187: + case 189: /* Line 1455 of yacc.c */ -#line 1460 "program_parse.y" +#line 1506 "program_parse.y" { (yyval.state)[0] = STATE_MODELVIEW_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); ;} break; - case 188: + case 190: /* Line 1455 of yacc.c */ -#line 1465 "program_parse.y" +#line 1511 "program_parse.y" { (yyval.state)[0] = STATE_PROJECTION_MATRIX; (yyval.state)[1] = 0; ;} break; - case 189: + case 191: /* Line 1455 of yacc.c */ -#line 1470 "program_parse.y" +#line 1516 "program_parse.y" { (yyval.state)[0] = STATE_MVP_MATRIX; (yyval.state)[1] = 0; ;} break; - case 190: + case 192: /* Line 1455 of yacc.c */ -#line 1475 "program_parse.y" +#line 1521 "program_parse.y" { (yyval.state)[0] = STATE_TEXTURE_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); ;} break; - case 191: + case 193: /* Line 1455 of yacc.c */ -#line 1480 "program_parse.y" +#line 1526 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; ;} break; - case 192: + case 194: /* Line 1455 of yacc.c */ -#line 1485 "program_parse.y" +#line 1531 "program_parse.y" { (yyval.state)[0] = STATE_PROGRAM_MATRIX; (yyval.state)[1] = (yyvsp[(3) - (4)].integer); ;} break; - case 193: + case 195: /* Line 1455 of yacc.c */ -#line 1492 "program_parse.y" +#line 1538 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 194: + case 196: /* Line 1455 of yacc.c */ -#line 1496 "program_parse.y" +#line 1542 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 195: + case 197: /* Line 1455 of yacc.c */ -#line 1501 "program_parse.y" +#line 1547 "program_parse.y" { /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix * zero is valid. @@ -3921,10 +3974,10 @@ yyreduce: ;} break; - case 196: + case 198: /* Line 1455 of yacc.c */ -#line 1514 "program_parse.y" +#line 1560 "program_parse.y" { /* Since GL_ARB_matrix_palette isn't supported, just let any value * through here. The error will be generated later. @@ -3933,10 +3986,10 @@ yyreduce: ;} break; - case 197: + case 199: /* Line 1455 of yacc.c */ -#line 1522 "program_parse.y" +#line 1568 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxProgramMatrices) { yyerror(& (yylsp[(1) - (1)]), state, "invalid program matrix selector"); @@ -3947,20 +4000,20 @@ yyreduce: ;} break; - case 198: + case 200: /* Line 1455 of yacc.c */ -#line 1533 "program_parse.y" +#line 1579 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_DEPTH_RANGE; ;} break; - case 203: + case 205: /* Line 1455 of yacc.c */ -#line 1545 "program_parse.y" +#line 1591 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -3970,30 +4023,30 @@ yyreduce: ;} break; - case 204: + case 206: /* Line 1455 of yacc.c */ -#line 1555 "program_parse.y" +#line 1601 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); ;} break; - case 205: + case 207: /* Line 1455 of yacc.c */ -#line 1560 "program_parse.y" +#line 1606 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); ;} break; - case 206: + case 208: /* Line 1455 of yacc.c */ -#line 1567 "program_parse.y" +#line 1613 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4003,10 +4056,10 @@ yyreduce: ;} break; - case 207: + case 209: /* Line 1455 of yacc.c */ -#line 1577 "program_parse.y" +#line 1623 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4016,30 +4069,30 @@ yyreduce: ;} break; - case 208: + case 210: /* Line 1455 of yacc.c */ -#line 1586 "program_parse.y" +#line 1632 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); ;} break; - case 209: + case 211: /* Line 1455 of yacc.c */ -#line 1591 "program_parse.y" +#line 1637 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); ;} break; - case 210: + case 212: /* Line 1455 of yacc.c */ -#line 1598 "program_parse.y" +#line 1644 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4049,10 +4102,10 @@ yyreduce: ;} break; - case 211: + case 213: /* Line 1455 of yacc.c */ -#line 1608 "program_parse.y" +#line 1654 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxEnvParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid environment parameter reference"); @@ -4062,10 +4115,10 @@ yyreduce: ;} break; - case 212: + case 214: /* Line 1455 of yacc.c */ -#line 1618 "program_parse.y" +#line 1664 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxLocalParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid local parameter reference"); @@ -4075,10 +4128,10 @@ yyreduce: ;} break; - case 217: + case 219: /* Line 1455 of yacc.c */ -#line 1633 "program_parse.y" +#line 1679 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4088,10 +4141,10 @@ yyreduce: ;} break; - case 218: + case 220: /* Line 1455 of yacc.c */ -#line 1643 "program_parse.y" +#line 1689 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4101,10 +4154,10 @@ yyreduce: ;} break; - case 219: + case 221: /* Line 1455 of yacc.c */ -#line 1651 "program_parse.y" +#line 1697 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (float) (yyvsp[(1) - (1)].integer); @@ -4114,10 +4167,10 @@ yyreduce: ;} break; - case 220: + case 222: /* Line 1455 of yacc.c */ -#line 1661 "program_parse.y" +#line 1707 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (3)].real); @@ -4127,10 +4180,10 @@ yyreduce: ;} break; - case 221: + case 223: /* Line 1455 of yacc.c */ -#line 1669 "program_parse.y" +#line 1715 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (5)].real); @@ -4140,10 +4193,10 @@ yyreduce: ;} break; - case 222: + case 224: /* Line 1455 of yacc.c */ -#line 1678 "program_parse.y" +#line 1724 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (7)].real); @@ -4153,10 +4206,10 @@ yyreduce: ;} break; - case 223: + case 225: /* Line 1455 of yacc.c */ -#line 1687 "program_parse.y" +#line 1733 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (9)].real); @@ -4166,63 +4219,63 @@ yyreduce: ;} break; - case 224: + case 226: /* Line 1455 of yacc.c */ -#line 1697 "program_parse.y" +#line 1743 "program_parse.y" { (yyval.real) = ((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].real) : (yyvsp[(2) - (2)].real); ;} break; - case 225: + case 227: /* Line 1455 of yacc.c */ -#line 1701 "program_parse.y" +#line 1747 "program_parse.y" { (yyval.real) = (float)(((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].integer) : (yyvsp[(2) - (2)].integer)); ;} break; - case 226: + case 228: /* Line 1455 of yacc.c */ -#line 1706 "program_parse.y" +#line 1752 "program_parse.y" { (yyval.negate) = FALSE; ;} break; - case 227: + case 229: /* Line 1455 of yacc.c */ -#line 1707 "program_parse.y" +#line 1753 "program_parse.y" { (yyval.negate) = TRUE; ;} break; - case 228: + case 230: /* Line 1455 of yacc.c */ -#line 1708 "program_parse.y" +#line 1754 "program_parse.y" { (yyval.negate) = FALSE; ;} break; - case 229: + case 231: /* Line 1455 of yacc.c */ -#line 1711 "program_parse.y" +#line 1757 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 231: + case 233: /* Line 1455 of yacc.c */ -#line 1714 "program_parse.y" +#line 1760 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 233: + case 235: /* Line 1455 of yacc.c */ -#line 1718 "program_parse.y" +#line 1764 "program_parse.y" { if (!declare_variable(state, (yyvsp[(3) - (3)].string), (yyvsp[(0) - (3)].integer), & (yylsp[(3) - (3)]))) { YYERROR; @@ -4230,10 +4283,10 @@ yyreduce: ;} break; - case 234: + case 236: /* Line 1455 of yacc.c */ -#line 1724 "program_parse.y" +#line 1770 "program_parse.y" { if (!declare_variable(state, (yyvsp[(1) - (1)].string), (yyvsp[(0) - (1)].integer), & (yylsp[(1) - (1)]))) { YYERROR; @@ -4241,10 +4294,10 @@ yyreduce: ;} break; - case 235: + case 237: /* Line 1455 of yacc.c */ -#line 1732 "program_parse.y" +#line 1778 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (4)].string), at_output, & (yylsp[(2) - (4)])); @@ -4257,10 +4310,10 @@ yyreduce: ;} break; - case 236: + case 238: /* Line 1455 of yacc.c */ -#line 1745 "program_parse.y" +#line 1791 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_HPOS; @@ -4271,10 +4324,10 @@ yyreduce: ;} break; - case 237: + case 239: /* Line 1455 of yacc.c */ -#line 1754 "program_parse.y" +#line 1800 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_FOGC; @@ -4285,19 +4338,19 @@ yyreduce: ;} break; - case 238: + case 240: /* Line 1455 of yacc.c */ -#line 1763 "program_parse.y" +#line 1809 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (2)].result); ;} break; - case 239: + case 241: /* Line 1455 of yacc.c */ -#line 1767 "program_parse.y" +#line 1813 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_PSIZ; @@ -4308,10 +4361,10 @@ yyreduce: ;} break; - case 240: + case 242: /* Line 1455 of yacc.c */ -#line 1776 "program_parse.y" +#line 1822 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_TEX0 + (yyvsp[(3) - (3)].integer); @@ -4322,10 +4375,10 @@ yyreduce: ;} break; - case 241: + case 243: /* Line 1455 of yacc.c */ -#line 1785 "program_parse.y" +#line 1831 "program_parse.y" { if (state->mode == ARB_fragment) { (yyval.result) = FRAG_RESULT_DEPTH; @@ -4336,19 +4389,19 @@ yyreduce: ;} break; - case 242: + case 244: /* Line 1455 of yacc.c */ -#line 1796 "program_parse.y" +#line 1842 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (3)].integer) + (yyvsp[(3) - (3)].integer); ;} break; - case 243: + case 245: /* Line 1455 of yacc.c */ -#line 1802 "program_parse.y" +#line 1848 "program_parse.y" { (yyval.integer) = (state->mode == ARB_vertex) ? VERT_RESULT_COL0 @@ -4356,10 +4409,10 @@ yyreduce: ;} break; - case 244: + case 246: /* Line 1455 of yacc.c */ -#line 1808 "program_parse.y" +#line 1854 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_COL0; @@ -4370,10 +4423,10 @@ yyreduce: ;} break; - case 245: + case 247: /* Line 1455 of yacc.c */ -#line 1817 "program_parse.y" +#line 1863 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_BFC0; @@ -4384,19 +4437,19 @@ yyreduce: ;} break; - case 246: + case 248: /* Line 1455 of yacc.c */ -#line 1828 "program_parse.y" +#line 1874 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 247: + case 249: /* Line 1455 of yacc.c */ -#line 1832 "program_parse.y" +#line 1878 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 0; @@ -4407,10 +4460,10 @@ yyreduce: ;} break; - case 248: + case 250: /* Line 1455 of yacc.c */ -#line 1841 "program_parse.y" +#line 1887 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 1; @@ -4421,94 +4474,94 @@ yyreduce: ;} break; - case 249: + case 251: /* Line 1455 of yacc.c */ -#line 1851 "program_parse.y" +#line 1897 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 250: + case 252: /* Line 1455 of yacc.c */ -#line 1852 "program_parse.y" +#line 1898 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 251: + case 253: /* Line 1455 of yacc.c */ -#line 1853 "program_parse.y" +#line 1899 "program_parse.y" { (yyval.integer) = 1; ;} break; - case 252: + case 254: /* Line 1455 of yacc.c */ -#line 1856 "program_parse.y" +#line 1902 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 253: + case 255: /* Line 1455 of yacc.c */ -#line 1857 "program_parse.y" +#line 1903 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 254: + case 256: /* Line 1455 of yacc.c */ -#line 1858 "program_parse.y" +#line 1904 "program_parse.y" { (yyval.integer) = 1; ;} break; - case 255: + case 257: /* Line 1455 of yacc.c */ -#line 1861 "program_parse.y" +#line 1907 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 256: + case 258: /* Line 1455 of yacc.c */ -#line 1862 "program_parse.y" +#line 1908 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; - case 257: + case 259: /* Line 1455 of yacc.c */ -#line 1865 "program_parse.y" +#line 1911 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 258: + case 260: /* Line 1455 of yacc.c */ -#line 1866 "program_parse.y" +#line 1912 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; - case 259: + case 261: /* Line 1455 of yacc.c */ -#line 1869 "program_parse.y" +#line 1915 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 260: + case 262: /* Line 1455 of yacc.c */ -#line 1870 "program_parse.y" +#line 1916 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; - case 261: + case 263: /* Line 1455 of yacc.c */ -#line 1874 "program_parse.y" +#line 1920 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureCoordUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture coordinate unit selector"); @@ -4519,10 +4572,10 @@ yyreduce: ;} break; - case 262: + case 264: /* Line 1455 of yacc.c */ -#line 1885 "program_parse.y" +#line 1931 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureImageUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture image unit selector"); @@ -4533,10 +4586,10 @@ yyreduce: ;} break; - case 263: + case 265: /* Line 1455 of yacc.c */ -#line 1896 "program_parse.y" +#line 1942 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture unit selector"); @@ -4547,10 +4600,10 @@ yyreduce: ;} break; - case 264: + case 266: /* Line 1455 of yacc.c */ -#line 1907 "program_parse.y" +#line 1953 "program_parse.y" { struct asm_symbol *exist = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(2) - (4)].string)); @@ -4574,7 +4627,7 @@ yyreduce: /* Line 1455 of yacc.c */ -#line 4578 "program_parse.tab.c" +#line 4631 "program_parse.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -4793,7 +4846,7 @@ yyreturn: /* Line 1675 of yacc.c */ -#line 1927 "program_parse.y" +#line 1973 "program_parse.y" struct asm_instruction * diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index 9dab00c385..4cd459a096 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -177,7 +177,7 @@ static struct asm_instruction *asm_instruction_ctor(gl_inst_opcode op, %type instruction ALU_instruction TexInstruction %type ARL_instruction VECTORop_instruction %type SCALARop_instruction BINSCop_instruction BINop_instruction -%type TRIop_instruction SWZ_instruction SAMPLE_instruction +%type TRIop_instruction TXD_instruction SWZ_instruction SAMPLE_instruction %type KIL_instruction %type dstReg maskedDstReg maskedAddrReg @@ -347,6 +347,7 @@ ALU_instruction: ARL_instruction TexInstruction: SAMPLE_instruction | KIL_instruction + | TXD_instruction ; ARL_instruction: ARL maskedAddrReg ',' scalarSrcReg @@ -444,6 +445,51 @@ KIL_instruction: KIL swizzleSrcReg } ; +TXD_instruction: TXD_OP maskedDstReg ',' swizzleSrcReg ',' swizzleSrcReg ',' swizzleSrcReg ',' texImageUnit ',' texTarget + { + $$ = asm_instruction_ctor($1.Opcode, & $2, & $4, & $6, & $8); + if ($$ != NULL) { + const GLbitfield tex_mask = (1U << $10); + GLbitfield shadow_tex = 0; + GLbitfield target_mask = 0; + + + $$->Base.SaturateMode = $1.SaturateMode; + $$->Base.TexSrcUnit = $10; + + if ($12 < 0) { + shadow_tex = tex_mask; + + $$->Base.TexSrcTarget = -$12; + $$->Base.TexShadow = 1; + } else { + $$->Base.TexSrcTarget = $12; + } + + target_mask = (1U << $$->Base.TexSrcTarget); + + /* If this texture unit was previously accessed and that access + * had a different texture target, generate an error. + * + * If this texture unit was previously accessed and that access + * had a different shadow mode, generate an error. + */ + if ((state->prog->TexturesUsed[$10] != 0) + && ((state->prog->TexturesUsed[$10] != target_mask) + || ((state->prog->ShadowSamplers & tex_mask) + != shadow_tex))) { + yyerror(& @12, state, + "multiple targets used on one texture image unit"); + YYERROR; + } + + + state->prog->TexturesUsed[$10] |= target_mask; + state->prog->ShadowSamplers |= shadow_tex; + } + } + ; + texImageUnit: TEXTURE_UNIT optTexImageUnitNum { $$ = $2; -- cgit v1.2.3 From b8e389bb0315287b72087b93a089ab944d77ab80 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 3 Sep 2009 14:05:18 -0700 Subject: NV fp parser: Support new scalar constant behavior ARBfp requires scalar constants have a '.x' suffix, but NVfp_option does not. This shows up with instructions that require a scalar parameter (e.g., COS). --- src/mesa/shader/program_parse.tab.c | 1482 ++++++++++++++++++----------------- src/mesa/shader/program_parse.y | 17 + 2 files changed, 770 insertions(+), 729 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c index 06aefd073f..508ac617e4 100644 --- a/src/mesa/shader/program_parse.tab.c +++ b/src/mesa/shader/program_parse.tab.c @@ -588,16 +588,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 5 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 349 +#define YYLAST 351 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 116 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 135 /* YYNRULES -- Number of rules. */ -#define YYNRULES 266 +#define YYNRULES 267 /* YYNRULES -- Number of states. */ -#define YYNSTATES 447 +#define YYNSTATES 448 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -657,29 +657,29 @@ static const yytype_uint16 yyprhs[] = 24, 27, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 59, 64, 69, 76, 83, 92, 101, 104, 117, 120, 122, 124, 126, 128, 130, - 132, 134, 136, 138, 140, 142, 144, 151, 155, 159, - 162, 165, 173, 176, 178, 180, 182, 184, 189, 191, - 193, 195, 197, 199, 201, 203, 207, 208, 211, 214, - 216, 218, 220, 222, 224, 226, 228, 230, 232, 233, - 235, 237, 239, 241, 242, 244, 246, 248, 250, 252, - 254, 259, 262, 265, 267, 270, 272, 275, 277, 280, - 285, 290, 292, 293, 297, 299, 301, 304, 306, 309, - 311, 313, 317, 324, 325, 327, 330, 335, 337, 341, - 343, 345, 347, 349, 351, 353, 355, 357, 359, 361, + 132, 134, 136, 138, 140, 142, 144, 151, 155, 158, + 162, 165, 168, 176, 179, 181, 183, 185, 187, 192, + 194, 196, 198, 200, 202, 204, 206, 210, 211, 214, + 217, 219, 221, 223, 225, 227, 229, 231, 233, 235, + 236, 238, 240, 242, 244, 245, 247, 249, 251, 253, + 255, 257, 262, 265, 268, 270, 273, 275, 278, 280, + 283, 288, 293, 295, 296, 300, 302, 304, 307, 309, + 312, 314, 316, 320, 327, 328, 330, 333, 338, 340, + 344, 346, 348, 350, 352, 354, 356, 358, 360, 362, 364, 367, 370, 373, 376, 379, 382, 385, 388, 391, - 394, 397, 401, 403, 405, 407, 413, 415, 417, 419, - 422, 424, 426, 429, 431, 434, 441, 443, 447, 449, - 451, 453, 455, 457, 462, 464, 466, 468, 470, 472, - 474, 477, 479, 481, 487, 489, 492, 494, 496, 502, - 505, 506, 513, 517, 518, 520, 522, 524, 526, 528, - 531, 533, 535, 538, 543, 548, 549, 551, 553, 555, - 557, 560, 562, 564, 566, 568, 574, 576, 580, 586, - 592, 594, 598, 604, 606, 608, 610, 612, 614, 616, - 618, 620, 622, 626, 632, 640, 650, 653, 656, 658, - 660, 661, 662, 666, 667, 671, 675, 677, 682, 685, - 688, 691, 694, 698, 701, 705, 706, 708, 710, 711, - 713, 715, 716, 718, 720, 721, 723, 725, 726, 730, - 731, 735, 736, 740, 742, 744, 746 + 394, 397, 400, 404, 406, 408, 410, 416, 418, 420, + 422, 425, 427, 429, 432, 434, 437, 444, 446, 450, + 452, 454, 456, 458, 460, 465, 467, 469, 471, 473, + 475, 477, 480, 482, 484, 490, 492, 495, 497, 499, + 505, 508, 509, 516, 520, 521, 523, 525, 527, 529, + 531, 534, 536, 538, 541, 546, 551, 552, 554, 556, + 558, 560, 563, 565, 567, 569, 571, 577, 579, 583, + 589, 595, 597, 601, 607, 609, 611, 613, 615, 617, + 619, 621, 623, 625, 629, 635, 643, 653, 656, 659, + 661, 663, 664, 665, 669, 670, 674, 678, 680, 685, + 688, 691, 694, 697, 701, 704, 708, 709, 711, 713, + 714, 716, 718, 719, 721, 723, 724, 726, 728, 729, + 733, 734, 738, 739, 743, 745, 747, 749 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ @@ -700,67 +700,67 @@ static const yytype_int16 yyrhs[] = 84, -1, 85, -1, 86, -1, 87, -1, 88, -1, 89, -1, 90, -1, 91, -1, 92, -1, 93, -1, 94, -1, 95, -1, 21, 140, 108, 145, 108, 142, - -1, 231, 145, 157, -1, 231, 145, 158, -1, 146, - 159, -1, 154, 156, -1, 143, 108, 143, 108, 143, - 108, 143, -1, 231, 144, -1, 23, -1, 99, -1, - 99, -1, 162, -1, 147, 109, 148, 110, -1, 176, - -1, 238, -1, 99, -1, 99, -1, 149, -1, 150, - -1, 23, -1, 154, 155, 151, -1, -1, 111, 152, - -1, 112, 153, -1, 23, -1, 23, -1, 99, -1, - 103, -1, 103, -1, 103, -1, 103, -1, 100, -1, - 104, -1, -1, 100, -1, 101, -1, 102, -1, 103, - -1, -1, 161, -1, 168, -1, 232, -1, 234, -1, - 237, -1, 250, -1, 7, 99, 113, 162, -1, 96, - 163, -1, 38, 167, -1, 60, -1, 98, 165, -1, - 53, -1, 29, 243, -1, 37, -1, 74, 244, -1, - 50, 109, 166, 110, -1, 97, 109, 164, 110, -1, - 23, -1, -1, 109, 166, 110, -1, 23, -1, 60, - -1, 29, 243, -1, 37, -1, 74, 244, -1, 169, - -1, 170, -1, 10, 99, 172, -1, 10, 99, 109, - 171, 110, 173, -1, -1, 23, -1, 113, 175, -1, - 113, 114, 174, 115, -1, 177, -1, 174, 108, 177, - -1, 179, -1, 215, -1, 225, -1, 179, -1, 215, - -1, 226, -1, 178, -1, 216, -1, 225, -1, 179, - -1, 73, 203, -1, 73, 180, -1, 73, 182, -1, - 73, 185, -1, 73, 187, -1, 73, 193, -1, 73, - 189, -1, 73, 196, -1, 73, 198, -1, 73, 200, - -1, 73, 202, -1, 73, 214, -1, 47, 242, 181, - -1, 191, -1, 33, -1, 69, -1, 43, 109, 192, - 110, 183, -1, 191, -1, 60, -1, 26, -1, 72, - 184, -1, 40, -1, 32, -1, 44, 186, -1, 25, - -1, 242, 67, -1, 45, 109, 192, 110, 242, 188, - -1, 191, -1, 75, 246, 190, -1, 29, -1, 25, - -1, 31, -1, 71, -1, 23, -1, 76, 244, 194, - 195, -1, 35, -1, 54, -1, 79, -1, 80, -1, - 78, -1, 77, -1, 36, 197, -1, 29, -1, 56, - -1, 28, 109, 199, 110, 57, -1, 23, -1, 58, - 201, -1, 70, -1, 26, -1, 205, 66, 109, 208, - 110, -1, 205, 204, -1, -1, 66, 109, 208, 105, - 208, 110, -1, 49, 209, 206, -1, -1, 207, -1, - 41, -1, 82, -1, 42, -1, 23, -1, 51, 210, - -1, 63, -1, 52, -1, 81, 244, -1, 55, 109, - 212, 110, -1, 48, 109, 213, 110, -1, -1, 211, - -1, 23, -1, 23, -1, 23, -1, 30, 64, -1, - 219, -1, 222, -1, 217, -1, 220, -1, 62, 34, - 109, 218, 110, -1, 223, -1, 223, 105, 223, -1, - 62, 34, 109, 223, 110, -1, 62, 46, 109, 221, - 110, -1, 224, -1, 224, 105, 224, -1, 62, 46, - 109, 224, 110, -1, 23, -1, 23, -1, 227, -1, - 229, -1, 228, -1, 229, -1, 230, -1, 24, -1, - 23, -1, 114, 230, 115, -1, 114, 230, 108, 230, - 115, -1, 114, 230, 108, 230, 108, 230, 115, -1, - 114, 230, 108, 230, 108, 230, 108, 230, 115, -1, - 231, 24, -1, 231, 23, -1, 111, -1, 112, -1, - -1, -1, 11, 233, 236, -1, -1, 5, 235, 236, - -1, 236, 108, 99, -1, 99, -1, 9, 99, 113, - 238, -1, 65, 60, -1, 65, 37, -1, 65, 239, - -1, 65, 59, -1, 65, 74, 244, -1, 65, 30, - -1, 29, 240, 241, -1, -1, 39, -1, 27, -1, - -1, 61, -1, 68, -1, -1, 39, -1, 27, -1, - -1, 61, -1, 68, -1, -1, 109, 247, 110, -1, - -1, 109, 248, 110, -1, -1, 109, 249, 110, -1, - 23, -1, 23, -1, 23, -1, 6, 99, 113, 99, - -1 + -1, 231, 145, 157, -1, 231, 228, -1, 231, 145, + 158, -1, 146, 159, -1, 154, 156, -1, 143, 108, + 143, 108, 143, 108, 143, -1, 231, 144, -1, 23, + -1, 99, -1, 99, -1, 162, -1, 147, 109, 148, + 110, -1, 176, -1, 238, -1, 99, -1, 99, -1, + 149, -1, 150, -1, 23, -1, 154, 155, 151, -1, + -1, 111, 152, -1, 112, 153, -1, 23, -1, 23, + -1, 99, -1, 103, -1, 103, -1, 103, -1, 103, + -1, 100, -1, 104, -1, -1, 100, -1, 101, -1, + 102, -1, 103, -1, -1, 161, -1, 168, -1, 232, + -1, 234, -1, 237, -1, 250, -1, 7, 99, 113, + 162, -1, 96, 163, -1, 38, 167, -1, 60, -1, + 98, 165, -1, 53, -1, 29, 243, -1, 37, -1, + 74, 244, -1, 50, 109, 166, 110, -1, 97, 109, + 164, 110, -1, 23, -1, -1, 109, 166, 110, -1, + 23, -1, 60, -1, 29, 243, -1, 37, -1, 74, + 244, -1, 169, -1, 170, -1, 10, 99, 172, -1, + 10, 99, 109, 171, 110, 173, -1, -1, 23, -1, + 113, 175, -1, 113, 114, 174, 115, -1, 177, -1, + 174, 108, 177, -1, 179, -1, 215, -1, 225, -1, + 179, -1, 215, -1, 226, -1, 178, -1, 216, -1, + 225, -1, 179, -1, 73, 203, -1, 73, 180, -1, + 73, 182, -1, 73, 185, -1, 73, 187, -1, 73, + 193, -1, 73, 189, -1, 73, 196, -1, 73, 198, + -1, 73, 200, -1, 73, 202, -1, 73, 214, -1, + 47, 242, 181, -1, 191, -1, 33, -1, 69, -1, + 43, 109, 192, 110, 183, -1, 191, -1, 60, -1, + 26, -1, 72, 184, -1, 40, -1, 32, -1, 44, + 186, -1, 25, -1, 242, 67, -1, 45, 109, 192, + 110, 242, 188, -1, 191, -1, 75, 246, 190, -1, + 29, -1, 25, -1, 31, -1, 71, -1, 23, -1, + 76, 244, 194, 195, -1, 35, -1, 54, -1, 79, + -1, 80, -1, 78, -1, 77, -1, 36, 197, -1, + 29, -1, 56, -1, 28, 109, 199, 110, 57, -1, + 23, -1, 58, 201, -1, 70, -1, 26, -1, 205, + 66, 109, 208, 110, -1, 205, 204, -1, -1, 66, + 109, 208, 105, 208, 110, -1, 49, 209, 206, -1, + -1, 207, -1, 41, -1, 82, -1, 42, -1, 23, + -1, 51, 210, -1, 63, -1, 52, -1, 81, 244, + -1, 55, 109, 212, 110, -1, 48, 109, 213, 110, + -1, -1, 211, -1, 23, -1, 23, -1, 23, -1, + 30, 64, -1, 219, -1, 222, -1, 217, -1, 220, + -1, 62, 34, 109, 218, 110, -1, 223, -1, 223, + 105, 223, -1, 62, 34, 109, 223, 110, -1, 62, + 46, 109, 221, 110, -1, 224, -1, 224, 105, 224, + -1, 62, 46, 109, 224, 110, -1, 23, -1, 23, + -1, 227, -1, 229, -1, 228, -1, 229, -1, 230, + -1, 24, -1, 23, -1, 114, 230, 115, -1, 114, + 230, 108, 230, 115, -1, 114, 230, 108, 230, 108, + 230, 115, -1, 114, 230, 108, 230, 108, 230, 108, + 230, 115, -1, 231, 24, -1, 231, 23, -1, 111, + -1, 112, -1, -1, -1, 11, 233, 236, -1, -1, + 5, 235, 236, -1, 236, 108, 99, -1, 99, -1, + 9, 99, 113, 238, -1, 65, 60, -1, 65, 37, + -1, 65, 239, -1, 65, 59, -1, 65, 74, 244, + -1, 65, 30, -1, 29, 240, 241, -1, -1, 39, + -1, 27, -1, -1, 61, -1, 68, -1, -1, 39, + -1, 27, -1, -1, 61, -1, 68, -1, -1, 109, + 247, 110, -1, -1, 109, 248, 110, -1, -1, 109, + 249, 110, -1, 23, -1, 23, -1, 23, -1, 6, + 99, 113, 99, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -770,29 +770,29 @@ static const yytype_uint16 yyrline[] = 309, 324, 327, 332, 339, 340, 341, 342, 343, 344, 345, 348, 349, 350, 353, 359, 366, 373, 381, 388, 396, 441, 448, 493, 499, 500, 501, 502, 503, 504, - 505, 506, 507, 508, 509, 510, 513, 526, 539, 552, - 574, 583, 616, 623, 638, 688, 730, 741, 762, 772, - 778, 809, 826, 826, 828, 835, 847, 848, 849, 852, - 864, 876, 894, 905, 917, 919, 920, 921, 922, 925, - 925, 925, 925, 926, 929, 930, 931, 932, 933, 934, - 937, 955, 959, 965, 969, 973, 977, 986, 995, 999, - 1004, 1010, 1021, 1021, 1022, 1024, 1028, 1032, 1036, 1042, - 1042, 1044, 1060, 1083, 1086, 1097, 1103, 1109, 1110, 1117, - 1123, 1129, 1137, 1143, 1149, 1157, 1163, 1169, 1177, 1178, - 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, 1189, 1190, - 1191, 1194, 1203, 1207, 1211, 1217, 1226, 1230, 1234, 1243, - 1247, 1253, 1259, 1266, 1271, 1279, 1289, 1291, 1299, 1305, - 1309, 1313, 1319, 1330, 1339, 1343, 1348, 1352, 1356, 1360, - 1366, 1373, 1377, 1383, 1391, 1402, 1409, 1413, 1419, 1429, - 1440, 1444, 1462, 1471, 1474, 1480, 1484, 1488, 1494, 1505, - 1510, 1515, 1520, 1525, 1530, 1538, 1541, 1546, 1559, 1567, - 1578, 1586, 1586, 1588, 1588, 1590, 1600, 1605, 1612, 1622, - 1631, 1636, 1643, 1653, 1663, 1675, 1675, 1676, 1676, 1678, - 1688, 1696, 1706, 1714, 1722, 1731, 1742, 1746, 1752, 1753, - 1754, 1757, 1757, 1760, 1760, 1763, 1769, 1777, 1790, 1799, - 1808, 1812, 1821, 1830, 1841, 1848, 1853, 1862, 1874, 1877, - 1886, 1897, 1898, 1899, 1902, 1903, 1904, 1907, 1908, 1911, - 1912, 1915, 1916, 1919, 1930, 1941, 1952 + 505, 506, 507, 508, 509, 510, 513, 526, 537, 556, + 569, 591, 600, 633, 640, 655, 705, 747, 758, 779, + 789, 795, 826, 843, 843, 845, 852, 864, 865, 866, + 869, 881, 893, 911, 922, 934, 936, 937, 938, 939, + 942, 942, 942, 942, 943, 946, 947, 948, 949, 950, + 951, 954, 972, 976, 982, 986, 990, 994, 1003, 1012, + 1016, 1021, 1027, 1038, 1038, 1039, 1041, 1045, 1049, 1053, + 1059, 1059, 1061, 1077, 1100, 1103, 1114, 1120, 1126, 1127, + 1134, 1140, 1146, 1154, 1160, 1166, 1174, 1180, 1186, 1194, + 1195, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1206, + 1207, 1208, 1211, 1220, 1224, 1228, 1234, 1243, 1247, 1251, + 1260, 1264, 1270, 1276, 1283, 1288, 1296, 1306, 1308, 1316, + 1322, 1326, 1330, 1336, 1347, 1356, 1360, 1365, 1369, 1373, + 1377, 1383, 1390, 1394, 1400, 1408, 1419, 1426, 1430, 1436, + 1446, 1457, 1461, 1479, 1488, 1491, 1497, 1501, 1505, 1511, + 1522, 1527, 1532, 1537, 1542, 1547, 1555, 1558, 1563, 1576, + 1584, 1595, 1603, 1603, 1605, 1605, 1607, 1617, 1622, 1629, + 1639, 1648, 1653, 1660, 1670, 1680, 1692, 1692, 1693, 1693, + 1695, 1705, 1713, 1723, 1731, 1739, 1748, 1759, 1763, 1769, + 1770, 1771, 1774, 1774, 1777, 1777, 1780, 1786, 1794, 1807, + 1816, 1825, 1829, 1838, 1847, 1858, 1865, 1870, 1879, 1891, + 1894, 1903, 1914, 1915, 1916, 1919, 1920, 1921, 1924, 1925, + 1928, 1929, 1932, 1933, 1936, 1947, 1958, 1969 }; #endif @@ -890,29 +890,29 @@ static const yytype_uint8 yyr1[] = 122, 122, 123, 123, 124, 124, 124, 124, 124, 124, 124, 125, 125, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 137, 138, 139, 140, - 141, 142, 143, 144, 144, 145, 145, 145, 145, 146, - 146, 147, 148, 148, 149, 150, 151, 151, 151, 152, - 153, 154, 155, 156, 157, 158, 158, 158, 158, 159, - 159, 159, 159, 159, 160, 160, 160, 160, 160, 160, - 161, 162, 162, 163, 163, 163, 163, 163, 163, 163, - 163, 164, 165, 165, 166, 167, 167, 167, 167, 168, - 168, 169, 170, 171, 171, 172, 173, 174, 174, 175, - 175, 175, 176, 176, 176, 177, 177, 177, 178, 178, - 179, 179, 179, 179, 179, 179, 179, 179, 179, 179, - 179, 180, 181, 181, 181, 182, 183, 183, 183, 183, - 183, 184, 185, 186, 186, 187, 188, 189, 190, 191, - 191, 191, 192, 193, 194, 194, 195, 195, 195, 195, - 196, 197, 197, 198, 199, 200, 201, 201, 202, 203, - 204, 204, 205, 206, 206, 207, 207, 207, 208, 209, - 209, 209, 209, 209, 209, 210, 210, 211, 212, 213, - 214, 215, 215, 216, 216, 217, 218, 218, 219, 220, - 221, 221, 222, 223, 224, 225, 225, 226, 226, 227, - 228, 228, 229, 229, 229, 229, 230, 230, 231, 231, - 231, 233, 232, 235, 234, 236, 236, 237, 238, 238, - 238, 238, 238, 238, 239, 240, 240, 240, 241, 241, - 241, 242, 242, 242, 243, 243, 243, 244, 244, 245, - 245, 246, 246, 247, 248, 249, 250 + 136, 136, 136, 136, 136, 136, 137, 138, 138, 139, + 140, 141, 142, 143, 144, 144, 145, 145, 145, 145, + 146, 146, 147, 148, 148, 149, 150, 151, 151, 151, + 152, 153, 154, 155, 156, 157, 158, 158, 158, 158, + 159, 159, 159, 159, 159, 160, 160, 160, 160, 160, + 160, 161, 162, 162, 163, 163, 163, 163, 163, 163, + 163, 163, 164, 165, 165, 166, 167, 167, 167, 167, + 168, 168, 169, 170, 171, 171, 172, 173, 174, 174, + 175, 175, 175, 176, 176, 176, 177, 177, 177, 178, + 178, 179, 179, 179, 179, 179, 179, 179, 179, 179, + 179, 179, 180, 181, 181, 181, 182, 183, 183, 183, + 183, 183, 184, 185, 186, 186, 187, 188, 189, 190, + 191, 191, 191, 192, 193, 194, 194, 195, 195, 195, + 195, 196, 197, 197, 198, 199, 200, 201, 201, 202, + 203, 204, 204, 205, 206, 206, 207, 207, 207, 208, + 209, 209, 209, 209, 209, 209, 210, 210, 211, 212, + 213, 214, 215, 215, 216, 216, 217, 218, 218, 219, + 220, 221, 221, 222, 223, 224, 225, 225, 226, 226, + 227, 228, 228, 229, 229, 229, 229, 230, 230, 231, + 231, 231, 233, 232, 235, 234, 236, 236, 237, 238, + 238, 238, 238, 238, 238, 239, 240, 240, 240, 241, + 241, 241, 242, 242, 242, 243, 243, 243, 244, 244, + 245, 245, 246, 246, 247, 248, 249, 250 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -922,29 +922,29 @@ static const yytype_uint8 yyr2[] = 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 6, 6, 8, 8, 2, 12, 2, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 6, 3, 3, 2, - 2, 7, 2, 1, 1, 1, 1, 4, 1, 1, - 1, 1, 1, 1, 1, 3, 0, 2, 2, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, - 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 4, 2, 2, 1, 2, 1, 2, 1, 2, 4, - 4, 1, 0, 3, 1, 1, 2, 1, 2, 1, - 1, 3, 6, 0, 1, 2, 4, 1, 3, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, + 1, 1, 1, 1, 1, 1, 6, 3, 2, 3, + 2, 2, 7, 2, 1, 1, 1, 1, 4, 1, + 1, 1, 1, 1, 1, 1, 3, 0, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, + 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, + 1, 4, 2, 2, 1, 2, 1, 2, 1, 2, + 4, 4, 1, 0, 3, 1, 1, 2, 1, 2, + 1, 1, 3, 6, 0, 1, 2, 4, 1, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 3, 1, 1, 1, 5, 1, 1, 1, 2, - 1, 1, 2, 1, 2, 6, 1, 3, 1, 1, - 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, - 2, 1, 1, 5, 1, 2, 1, 1, 5, 2, - 0, 6, 3, 0, 1, 1, 1, 1, 1, 2, - 1, 1, 2, 4, 4, 0, 1, 1, 1, 1, - 2, 1, 1, 1, 1, 5, 1, 3, 5, 5, - 1, 3, 5, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 3, 5, 7, 9, 2, 2, 1, 1, - 0, 0, 3, 0, 3, 3, 1, 4, 2, 2, - 2, 2, 3, 2, 3, 0, 1, 1, 0, 1, - 1, 0, 1, 1, 0, 1, 1, 0, 3, 0, - 3, 0, 3, 1, 1, 1, 4 + 2, 2, 3, 1, 1, 1, 5, 1, 1, 1, + 2, 1, 1, 2, 1, 2, 6, 1, 3, 1, + 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, + 1, 2, 1, 1, 5, 1, 2, 1, 1, 5, + 2, 0, 6, 3, 0, 1, 1, 1, 1, 1, + 2, 1, 1, 2, 4, 4, 0, 1, 1, 1, + 1, 2, 1, 1, 1, 1, 5, 1, 3, 5, + 5, 1, 3, 5, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 3, 5, 7, 9, 2, 2, 1, + 1, 0, 0, 3, 0, 3, 3, 1, 4, 2, + 2, 2, 2, 3, 2, 3, 0, 1, 1, 0, + 1, 1, 0, 1, 1, 0, 1, 1, 0, 3, + 0, 3, 0, 3, 1, 1, 1, 4 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -953,223 +953,225 @@ static const yytype_uint8 yyr2[] = static const yytype_uint16 yydefact[] = { 0, 3, 4, 0, 6, 1, 9, 0, 5, 0, - 0, 233, 0, 0, 0, 0, 231, 2, 0, 0, - 0, 0, 0, 0, 0, 230, 0, 0, 8, 0, + 0, 234, 0, 0, 0, 0, 232, 2, 0, 0, + 0, 0, 0, 0, 0, 231, 0, 0, 8, 0, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, - 23, 20, 0, 84, 85, 109, 110, 86, 87, 88, - 89, 7, 0, 0, 0, 0, 0, 0, 0, 60, - 0, 83, 59, 0, 0, 0, 0, 0, 71, 0, - 0, 228, 229, 31, 0, 0, 0, 10, 11, 236, - 234, 0, 0, 0, 113, 230, 111, 232, 245, 243, - 239, 241, 238, 257, 240, 230, 79, 80, 81, 82, - 49, 230, 230, 230, 230, 230, 230, 73, 50, 221, - 220, 0, 0, 0, 0, 55, 230, 78, 0, 56, - 58, 122, 123, 201, 202, 124, 217, 218, 0, 230, - 0, 266, 90, 237, 114, 0, 115, 119, 120, 121, - 215, 216, 219, 0, 247, 246, 248, 0, 242, 0, - 0, 0, 0, 26, 0, 25, 24, 254, 107, 105, - 257, 92, 0, 0, 0, 0, 0, 0, 251, 0, - 251, 0, 0, 261, 257, 130, 131, 132, 133, 135, - 134, 136, 137, 138, 139, 0, 140, 254, 97, 0, - 95, 93, 257, 0, 102, 91, 0, 76, 75, 77, - 48, 0, 0, 0, 235, 0, 227, 226, 249, 250, - 244, 263, 0, 230, 230, 0, 0, 230, 255, 256, - 106, 108, 0, 0, 0, 200, 171, 172, 170, 0, - 153, 253, 252, 152, 0, 0, 0, 0, 195, 191, - 0, 190, 257, 183, 177, 176, 175, 0, 0, 0, - 0, 96, 0, 98, 0, 0, 94, 230, 222, 64, - 0, 62, 63, 0, 230, 230, 0, 112, 258, 28, - 27, 74, 47, 259, 0, 0, 213, 0, 214, 0, - 174, 0, 162, 0, 154, 0, 159, 160, 143, 144, - 161, 141, 142, 0, 197, 189, 196, 0, 192, 185, - 187, 186, 182, 184, 265, 0, 158, 157, 164, 165, - 0, 0, 104, 0, 101, 0, 0, 0, 57, 72, - 66, 46, 0, 0, 0, 230, 0, 33, 0, 230, - 208, 212, 0, 0, 251, 199, 0, 198, 0, 262, - 169, 168, 166, 167, 163, 188, 0, 99, 100, 103, - 230, 223, 0, 0, 65, 230, 53, 54, 52, 230, - 0, 0, 0, 117, 125, 128, 126, 203, 204, 127, - 264, 0, 34, 35, 36, 37, 38, 39, 40, 41, - 42, 43, 44, 45, 30, 29, 173, 148, 150, 147, - 0, 145, 146, 0, 194, 193, 178, 0, 69, 67, - 70, 68, 0, 0, 0, 0, 129, 180, 230, 116, - 260, 151, 149, 155, 156, 230, 224, 230, 0, 0, - 0, 0, 179, 118, 0, 0, 0, 0, 206, 0, - 210, 0, 225, 230, 0, 205, 0, 209, 0, 0, - 51, 32, 207, 211, 0, 0, 181 + 23, 20, 0, 85, 86, 110, 111, 87, 88, 89, + 90, 7, 0, 0, 0, 0, 0, 0, 0, 61, + 0, 84, 60, 0, 0, 0, 0, 0, 72, 0, + 0, 229, 230, 31, 0, 0, 0, 10, 11, 237, + 235, 0, 0, 0, 114, 231, 112, 233, 246, 244, + 240, 242, 239, 258, 241, 231, 80, 81, 82, 83, + 50, 231, 231, 231, 231, 231, 231, 74, 51, 222, + 221, 0, 0, 0, 0, 56, 231, 79, 0, 57, + 59, 123, 124, 202, 203, 125, 218, 219, 0, 231, + 0, 267, 91, 238, 115, 0, 116, 120, 121, 122, + 216, 217, 220, 0, 248, 247, 249, 0, 243, 0, + 0, 0, 0, 26, 0, 25, 24, 255, 108, 106, + 258, 93, 0, 0, 0, 0, 0, 0, 252, 0, + 252, 0, 0, 262, 258, 131, 132, 133, 134, 136, + 135, 137, 138, 139, 140, 0, 141, 255, 98, 0, + 96, 94, 258, 0, 103, 92, 0, 77, 76, 78, + 49, 0, 0, 0, 236, 0, 228, 227, 250, 251, + 245, 264, 0, 231, 231, 0, 48, 0, 231, 256, + 257, 107, 109, 0, 0, 0, 201, 172, 173, 171, + 0, 154, 254, 253, 153, 0, 0, 0, 0, 196, + 192, 0, 191, 258, 184, 178, 177, 176, 0, 0, + 0, 0, 97, 0, 99, 0, 0, 95, 231, 223, + 65, 0, 63, 64, 0, 231, 231, 0, 113, 259, + 28, 27, 75, 47, 260, 0, 0, 214, 0, 215, + 0, 175, 0, 163, 0, 155, 0, 160, 161, 144, + 145, 162, 142, 143, 0, 198, 190, 197, 0, 193, + 186, 188, 187, 183, 185, 266, 0, 159, 158, 165, + 166, 0, 0, 105, 0, 102, 0, 0, 0, 58, + 73, 67, 46, 0, 0, 0, 231, 0, 33, 0, + 231, 209, 213, 0, 0, 252, 200, 0, 199, 0, + 263, 170, 169, 167, 168, 164, 189, 0, 100, 101, + 104, 231, 224, 0, 0, 66, 231, 54, 55, 53, + 231, 0, 0, 0, 118, 126, 129, 127, 204, 205, + 128, 265, 0, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 30, 29, 174, 149, 151, + 148, 0, 146, 147, 0, 195, 194, 179, 0, 70, + 68, 71, 69, 0, 0, 0, 0, 130, 181, 231, + 117, 261, 152, 150, 156, 157, 231, 225, 231, 0, + 0, 0, 0, 180, 119, 0, 0, 0, 0, 207, + 0, 211, 0, 226, 231, 0, 206, 0, 210, 0, + 0, 52, 32, 208, 212, 0, 0, 182 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 3, 4, 6, 8, 9, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 274, - 384, 41, 150, 73, 60, 69, 321, 322, 358, 117, - 61, 118, 260, 261, 262, 354, 399, 401, 70, 320, - 108, 272, 200, 100, 42, 43, 119, 195, 315, 256, - 313, 161, 44, 45, 46, 135, 86, 267, 362, 136, - 120, 363, 364, 121, 175, 291, 176, 391, 412, 177, - 233, 178, 413, 179, 307, 292, 283, 180, 310, 344, - 181, 228, 182, 281, 183, 246, 184, 406, 422, 185, - 302, 303, 346, 243, 295, 296, 338, 336, 186, 122, - 366, 367, 427, 123, 368, 429, 124, 277, 279, 369, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 275, + 385, 41, 150, 73, 60, 69, 322, 323, 359, 117, + 61, 118, 261, 262, 263, 355, 400, 402, 70, 321, + 108, 273, 200, 100, 42, 43, 119, 195, 316, 257, + 314, 161, 44, 45, 46, 135, 86, 268, 363, 136, + 120, 364, 365, 121, 175, 292, 176, 392, 413, 177, + 234, 178, 414, 179, 308, 293, 284, 180, 311, 345, + 181, 229, 182, 282, 183, 247, 184, 407, 423, 185, + 303, 304, 347, 244, 296, 297, 339, 337, 186, 122, + 367, 368, 428, 123, 369, 430, 124, 278, 280, 370, 125, 140, 126, 127, 142, 74, 47, 57, 48, 52, - 80, 49, 62, 94, 146, 210, 234, 220, 148, 327, - 248, 212, 371, 305, 50 + 80, 49, 62, 94, 146, 210, 235, 221, 148, 328, + 249, 212, 372, 306, 50 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -384 +#define YYPACT_NINF -399 static const yytype_int16 yypact[] = { - 167, -384, -384, 37, -384, -384, 60, -70, -384, 171, - -23, -384, -13, 9, 12, 63, -384, -384, -33, -33, - -33, -33, -33, -33, 67, 104, -33, -33, -384, 66, - -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, - -384, -384, 68, -384, -384, -384, -384, -384, -384, -384, - -384, -384, 115, 109, 111, 112, -4, 115, 22, -384, - 113, 106, -384, 118, 120, 121, 122, 123, -384, 124, - 130, -384, -384, -384, -16, 126, 127, -384, -384, -384, - 128, 140, -18, 158, 204, -39, -384, 128, 26, -384, - -384, -384, -384, 134, -384, 104, -384, -384, -384, -384, - -384, 104, 104, 104, 104, 104, 104, -384, -384, -384, - -384, 73, 84, 76, -10, 135, 104, 64, 136, -384, - -384, -384, -384, -384, -384, -384, -384, -384, -16, 104, - 147, -384, -384, -384, -384, 137, -384, -384, -384, -384, - -384, -384, -384, 194, -384, -384, 46, 225, -384, 141, - 142, -16, 143, -384, 144, -384, -384, 87, -384, -384, - 134, -384, 145, 146, 148, 189, 15, 149, 88, 150, - 97, 80, 0, 151, 134, -384, -384, -384, -384, -384, - -384, -384, -384, -384, -384, 190, -384, 87, -384, 152, - -384, -384, 134, 153, 154, -384, 42, -384, -384, -384, - -384, -8, 156, 159, -384, 160, -384, -384, -384, -384, - -384, -384, 161, 104, 104, 163, 186, 104, -384, -384, - -384, -384, 249, 251, 252, -384, -384, -384, -384, 253, - -384, -384, -384, -384, 210, 253, 8, 169, 256, -384, - 172, -384, 134, 21, -384, -384, -384, 257, 254, -7, - 173, -384, 261, -384, 262, 261, -384, 104, -384, -384, - 176, -384, -384, 184, 104, 104, 174, -384, -384, -384, - -384, -384, -384, 180, 182, 183, -384, 185, -384, 187, - -384, 188, -384, 191, -384, 193, -384, -384, -384, -384, - -384, -384, -384, 269, -384, -384, -384, 270, -384, -384, - -384, -384, -384, -384, -384, 195, -384, -384, -384, -384, - 133, 271, -384, 196, -384, 197, 198, 45, -384, -384, - 108, -384, 192, -6, 201, -17, 273, -384, 110, 104, - -384, -384, 242, 29, 97, -384, 200, -384, 202, -384, - -384, -384, -384, -384, -384, -384, 203, -384, -384, -384, - 104, -384, 281, 288, -384, 104, -384, -384, -384, 104, - 103, 76, 48, -384, -384, -384, -384, -384, -384, -384, - -384, 205, -384, -384, -384, -384, -384, -384, -384, -384, - -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, - 282, -384, -384, 5, -384, -384, -384, 50, -384, -384, - -384, -384, 208, 209, 211, 212, -384, 260, -17, -384, - -384, -384, -384, -384, -384, 104, -384, 104, 186, 249, - 251, 213, -384, -384, 214, 219, 220, 221, 228, 224, - 230, 271, -384, 104, 110, -384, 249, -384, 251, 49, - -384, -384, -384, -384, 271, 226, -384 + 154, -399, -399, 48, -399, -399, 51, -37, -399, 172, + -2, -399, 17, 31, 42, 47, -399, -399, -33, -33, + -33, -33, -33, -33, 54, 56, -33, -33, -399, 6, + -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, + -399, -399, 52, -399, -399, -399, -399, -399, -399, -399, + -399, -399, 66, 25, 61, 112, -6, 66, 102, -399, + 118, 116, -399, 119, 120, 121, 122, 123, -399, 124, + 130, -399, -399, -399, -16, 126, 127, -399, -399, -399, + 128, 70, -15, 159, 214, -36, -399, 128, 28, -399, + -399, -399, -399, 131, -399, 56, -399, -399, -399, -399, + -399, 56, 56, 56, 56, 56, 56, -399, -399, -399, + -399, 27, 38, 76, -9, 135, 56, 60, 136, -399, + -399, -399, -399, -399, -399, -399, -399, -399, -16, 56, + 147, -399, -399, -399, -399, 137, -399, -399, -399, -399, + -399, -399, -399, 148, -399, -399, 18, 225, -399, 141, + 142, -16, 144, -399, 145, -399, -399, 50, -399, -399, + 131, -399, 146, 149, 150, 187, 7, 151, 43, 152, + 69, 85, -1, 153, 131, -399, -399, -399, -399, -399, + -399, -399, -399, -399, -399, 190, -399, 50, -399, 155, + -399, -399, 131, 156, 158, -399, 20, -399, -399, -399, + -399, -8, 160, 162, -399, 161, -399, -399, -399, -399, + -399, -399, 163, 56, 56, 169, 173, 171, 56, -399, + -399, -399, -399, 234, 240, 252, -399, -399, -399, -399, + 254, -399, -399, -399, -399, 211, 254, 2, 170, 257, + -399, 174, -399, 131, 12, -399, -399, -399, 258, 253, + -5, 175, -399, 262, -399, 263, 262, -399, 56, -399, + -399, 177, -399, -399, 185, 56, 56, 176, -399, -399, + -399, -399, -399, -399, 180, 183, 184, -399, 186, -399, + 189, -399, 191, -399, 192, -399, 194, -399, -399, -399, + -399, -399, -399, -399, 270, -399, -399, -399, 271, -399, + -399, -399, -399, -399, -399, -399, 195, -399, -399, -399, + -399, 143, 272, -399, 196, -399, 197, 198, 34, -399, + -399, 101, -399, 201, -4, 202, -12, 274, -399, 111, + 56, -399, -399, 241, 84, 69, -399, 203, -399, 204, + -399, -399, -399, -399, -399, -399, -399, 205, -399, -399, + -399, 56, -399, 277, 288, -399, 56, -399, -399, -399, + 56, 80, 76, 35, -399, -399, -399, -399, -399, -399, + -399, -399, 206, -399, -399, -399, -399, -399, -399, -399, + -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, + -399, 280, -399, -399, 14, -399, -399, -399, 39, -399, + -399, -399, -399, 209, 210, 212, 213, -399, 261, -12, + -399, -399, -399, -399, -399, -399, 56, -399, 56, 171, + 234, 240, 219, -399, -399, 208, 221, 222, 224, 215, + 226, 227, 272, -399, 56, 111, -399, 234, -399, 240, + -13, -399, -399, -399, -399, 272, 228, -399 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -384, -384, -384, -384, -384, -384, -384, -384, -384, -384, - -384, -384, -384, -384, -384, -384, -384, -384, -384, -100, - -115, -384, -97, -91, 119, -384, -384, -343, -384, -93, - -384, -384, -384, -384, -384, -384, -384, -384, 138, -384, - -384, -384, -384, -384, -384, -384, 255, -384, -384, -384, - 83, -384, -384, -384, -384, -384, -384, -384, -384, -384, - -384, -68, -384, -84, -384, -384, -384, -384, -384, -384, - -384, -384, -384, -384, -384, -308, 107, -384, -384, -384, - -384, -384, -384, -384, -384, -384, -384, -384, -384, -20, - -384, -384, -383, -384, -384, -384, -384, -384, -384, 258, - -384, -384, -384, -384, -384, -384, -384, -320, -371, 259, - -384, -384, -384, -83, -113, -85, -384, -384, -384, -384, - 289, -384, 264, -384, -384, -384, -165, 162, -150, -384, - -384, -384, -384, -384, -384 + -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, + -399, -399, -399, -399, -399, -399, -399, -399, -399, -100, + -98, -399, -97, -91, 188, -399, -399, -344, -399, -99, + -399, -399, -399, -399, -399, -399, -399, -399, 134, -399, + -399, -399, -399, -399, -399, -399, 259, -399, -399, -399, + 83, -399, -399, -399, -399, -399, -399, -399, -399, -399, + -399, -69, -399, -84, -399, -399, -399, -399, -399, -399, + -399, -399, -399, -399, -399, -317, 106, -399, -399, -399, + -399, -399, -399, -399, -399, -399, -399, -399, -399, -19, + -399, -399, -398, -399, -399, -399, -399, -399, -399, 260, + -399, -399, -399, -399, -399, -399, -399, -377, -381, 265, + -399, -399, 193, -83, -113, -85, -399, -399, -399, -399, + 289, -399, 264, -399, -399, -399, -165, 164, -150, -399, + -399, -399, -399, -399, -399 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -62 +#define YYTABLE_NINF -219 static const yytype_int16 yytable[] = { - 143, 137, 141, 196, 149, 236, 153, 109, 110, 156, - 221, 152, 402, 154, 155, 259, 151, 356, 151, 187, - 111, 151, 111, 112, 249, 392, 244, 188, 308, 10, - 286, 143, 58, 286, 113, 202, 287, 5, 203, 287, - 189, 288, 253, 190, 226, 360, 112, 309, 439, 430, - 191, 88, 89, 144, 286, 387, 361, 113, 215, 90, - 287, 445, 299, 300, 192, 145, 59, 443, 7, 388, - 245, 227, 71, 72, 425, 116, 290, 289, 114, 290, - 114, 91, 92, 115, 51, 414, 53, 193, 194, 389, - 440, 68, 298, 357, 71, 72, 93, 116, 116, 428, - 290, 390, 157, 301, 164, 84, 165, 208, 54, 85, - 158, 55, 166, 230, 209, 231, 442, 270, 162, 167, - 168, 169, 269, 170, 231, 171, 275, 232, 237, 151, - 163, 238, 239, 159, 172, 240, 232, 404, 63, 64, - 65, 66, 67, 241, 317, 75, 76, 160, 218, 405, - 257, 173, 174, 350, 444, 219, 408, 258, 415, 396, - 351, 242, 56, 409, 197, 416, 68, 198, 199, 393, - 1, 2, 143, 77, 324, 78, 11, 12, 13, 323, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 25, 26, 27, 372, 373, 374, 375, 376, 377, - 378, 379, 380, 381, 382, 383, 96, 97, 98, 99, - 340, 341, 342, 343, 79, 71, 72, 206, 207, 352, - 353, 95, 81, 58, 82, 83, 101, 134, 102, 103, - 104, 105, 106, 107, 128, 129, 130, 397, 385, 131, - 143, 365, 141, 147, -61, 201, 204, 205, 211, 213, - 214, 216, 217, 225, 222, 223, 250, 224, 229, 235, - 247, 252, 254, 255, 264, 143, 271, 265, 403, 273, - 323, 268, 276, 266, 278, 280, 282, 284, 293, 294, - 304, 297, 311, 306, 312, 314, 318, 319, 325, 326, - 328, 329, 335, 337, 345, 330, 370, 331, 332, 386, - 355, 333, 424, 334, 398, 339, 347, 348, 349, 359, - 394, 400, 395, 396, 411, 410, 417, 418, 426, 441, - 419, 420, 431, 143, 365, 141, 421, 433, 434, 432, - 143, 435, 323, 436, 437, 438, 446, 132, 316, 263, - 423, 407, 285, 138, 139, 0, 87, 133, 323, 251 + 143, 137, 141, 196, 149, 237, 153, 109, 110, 156, + 222, 152, 403, 154, 155, 260, 151, 393, 151, 357, + 187, 151, 111, 111, 250, 245, 112, 287, 188, 202, + 309, 143, 58, 288, 440, 289, 227, 113, 203, 287, + 431, 189, 254, 429, 190, 288, 112, 446, 5, 310, + 361, 191, 215, 300, 301, 144, 157, 113, 444, 7, + 443, 362, 10, 228, 158, 192, 59, 145, 231, 246, + 232, 290, 162, 291, 426, 71, 72, 415, 116, 208, + 114, 114, 233, 115, 163, 291, 209, 159, 193, 194, + 441, 68, 445, 299, 302, 358, 232, 397, 116, 71, + 72, 160, 116, 84, 164, 51, 165, 85, 233, 287, + 388, 219, 166, 77, 405, 288, 53, 271, 220, 167, + 168, 169, 270, 170, 389, 171, 406, 276, 258, 151, + 54, 88, 89, 238, 172, 259, 239, 240, 81, 90, + 241, 55, 351, 409, 390, 318, 56, 416, 242, 352, + 410, 173, 174, 68, 417, 291, 391, 1, 2, 78, + 197, 91, 92, 198, 199, 79, 243, 71, 72, 131, + 394, 206, 207, 143, 82, 325, 93, 11, 12, 13, + 324, 14, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 26, 27, 373, 374, 375, 376, 377, + 378, 379, 380, 381, 382, 383, 384, 63, 64, 65, + 66, 67, 353, 354, 75, 76, 96, 97, 98, 99, + 341, 342, 343, 344, 58, 83, 95, 101, 102, 103, + 104, 105, 106, 107, 128, 129, 130, 134, 398, 386, + 147, 143, 366, 141, -62, 201, 204, 205, 211, 213, + 214, 226, 217, 218, 274, 223, 251, 277, 224, 225, + 230, 236, 248, 279, 253, 255, 143, 256, 265, 404, + 266, 324, 272, 269, 267, 281, -218, 283, 285, 294, + 295, 305, 307, 298, 312, 313, 315, 319, 320, 327, + 326, 329, 330, 336, 338, 346, 331, 371, 387, 332, + 399, 333, 334, 425, 335, 340, 348, 349, 350, 356, + 360, 401, 412, 395, 396, 397, 411, 418, 419, 427, + 437, 420, 421, 433, 143, 366, 141, 422, 432, 434, + 435, 143, 439, 324, 436, 264, 438, 442, 447, 317, + 424, 132, 286, 408, 216, 138, 87, 133, 0, 324, + 139, 252 }; static const yytype_int16 yycheck[] = { 85, 85, 85, 116, 95, 170, 103, 23, 24, 106, - 160, 102, 355, 104, 105, 23, 101, 23, 103, 29, - 38, 106, 38, 62, 174, 333, 26, 37, 35, 99, - 25, 116, 65, 25, 73, 128, 31, 0, 129, 31, - 50, 33, 192, 53, 29, 62, 62, 54, 431, 420, - 60, 29, 30, 27, 25, 26, 73, 73, 151, 37, - 31, 444, 41, 42, 74, 39, 99, 438, 8, 40, - 70, 56, 111, 112, 417, 114, 71, 69, 96, 71, - 96, 59, 60, 99, 107, 393, 99, 97, 98, 60, - 433, 99, 242, 99, 111, 112, 74, 114, 114, 419, - 71, 72, 29, 82, 28, 109, 30, 61, 99, 113, - 37, 99, 36, 25, 68, 27, 436, 214, 34, 43, - 44, 45, 213, 47, 27, 49, 217, 39, 48, 214, - 46, 51, 52, 60, 58, 55, 39, 34, 19, 20, - 21, 22, 23, 63, 257, 26, 27, 74, 61, 46, - 108, 75, 76, 108, 105, 68, 108, 115, 108, 110, - 115, 81, 99, 115, 100, 115, 99, 103, 104, 334, - 3, 4, 257, 107, 265, 107, 5, 6, 7, 264, - 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, - 19, 20, 21, 22, 84, 85, 86, 87, 88, 89, - 90, 91, 92, 93, 94, 95, 100, 101, 102, 103, - 77, 78, 79, 80, 99, 111, 112, 23, 24, 111, - 112, 108, 113, 65, 113, 113, 108, 23, 108, 108, - 108, 108, 108, 103, 108, 108, 108, 350, 329, 99, - 325, 325, 325, 109, 109, 109, 99, 110, 23, 108, - 108, 108, 108, 64, 109, 109, 66, 109, 109, 109, - 109, 109, 109, 109, 108, 350, 103, 108, 359, 83, - 355, 110, 23, 113, 23, 23, 23, 67, 109, 23, - 23, 109, 109, 29, 23, 23, 110, 103, 114, 109, - 108, 108, 23, 23, 23, 110, 23, 110, 110, 57, - 108, 110, 415, 110, 23, 110, 110, 110, 110, 108, - 110, 23, 110, 110, 32, 110, 108, 108, 418, 434, - 109, 109, 109, 408, 408, 408, 66, 108, 108, 115, - 415, 110, 417, 105, 110, 105, 110, 82, 255, 201, - 408, 361, 235, 85, 85, -1, 57, 83, 433, 187 + 160, 102, 356, 104, 105, 23, 101, 334, 103, 23, + 29, 106, 38, 38, 174, 26, 62, 25, 37, 128, + 35, 116, 65, 31, 432, 33, 29, 73, 129, 25, + 421, 50, 192, 420, 53, 31, 62, 445, 0, 54, + 62, 60, 151, 41, 42, 27, 29, 73, 439, 8, + 437, 73, 99, 56, 37, 74, 99, 39, 25, 70, + 27, 69, 34, 71, 418, 111, 112, 394, 114, 61, + 96, 96, 39, 99, 46, 71, 68, 60, 97, 98, + 434, 99, 105, 243, 82, 99, 27, 110, 114, 111, + 112, 74, 114, 109, 28, 107, 30, 113, 39, 25, + 26, 61, 36, 107, 34, 31, 99, 214, 68, 43, + 44, 45, 213, 47, 40, 49, 46, 218, 108, 214, + 99, 29, 30, 48, 58, 115, 51, 52, 113, 37, + 55, 99, 108, 108, 60, 258, 99, 108, 63, 115, + 115, 75, 76, 99, 115, 71, 72, 3, 4, 107, + 100, 59, 60, 103, 104, 99, 81, 111, 112, 99, + 335, 23, 24, 258, 113, 266, 74, 5, 6, 7, + 265, 9, 10, 11, 12, 13, 14, 15, 16, 17, + 18, 19, 20, 21, 22, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 19, 20, 21, + 22, 23, 111, 112, 26, 27, 100, 101, 102, 103, + 77, 78, 79, 80, 65, 113, 108, 108, 108, 108, + 108, 108, 108, 103, 108, 108, 108, 23, 351, 330, + 109, 326, 326, 326, 109, 109, 99, 110, 23, 108, + 108, 64, 108, 108, 83, 109, 66, 23, 109, 109, + 109, 109, 109, 23, 109, 109, 351, 109, 108, 360, + 108, 356, 103, 110, 113, 23, 103, 23, 67, 109, + 23, 23, 29, 109, 109, 23, 23, 110, 103, 109, + 114, 108, 108, 23, 23, 23, 110, 23, 57, 110, + 23, 110, 110, 416, 110, 110, 110, 110, 110, 108, + 108, 23, 32, 110, 110, 110, 110, 108, 108, 419, + 105, 109, 109, 115, 409, 409, 409, 66, 109, 108, + 108, 416, 105, 418, 110, 201, 110, 435, 110, 256, + 409, 82, 236, 362, 151, 85, 57, 83, -1, 434, + 85, 187 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -1197,30 +1199,30 @@ static const yytype_uint8 yystos[] = 193, 196, 198, 200, 202, 205, 214, 29, 37, 50, 53, 60, 74, 97, 98, 163, 230, 100, 103, 104, 158, 109, 145, 139, 99, 110, 23, 24, 61, 68, - 241, 23, 247, 108, 108, 145, 108, 108, 61, 68, - 243, 244, 109, 109, 109, 64, 29, 56, 197, 109, - 25, 27, 39, 186, 242, 109, 242, 48, 51, 52, - 55, 63, 81, 209, 26, 70, 201, 109, 246, 244, - 66, 243, 109, 244, 109, 109, 165, 108, 115, 23, - 148, 149, 150, 154, 108, 108, 113, 173, 110, 139, - 138, 103, 157, 83, 135, 139, 23, 223, 23, 224, - 23, 199, 23, 192, 67, 192, 25, 31, 33, 69, - 71, 181, 191, 109, 23, 210, 211, 109, 244, 41, - 42, 82, 206, 207, 23, 249, 29, 190, 35, 54, - 194, 109, 23, 166, 23, 164, 166, 230, 110, 103, - 155, 142, 143, 231, 139, 114, 109, 245, 108, 108, - 110, 110, 110, 110, 110, 23, 213, 23, 212, 110, - 77, 78, 79, 80, 195, 23, 208, 110, 110, 110, - 108, 115, 111, 112, 151, 108, 23, 99, 144, 108, - 62, 73, 174, 177, 178, 179, 216, 217, 220, 225, - 23, 248, 84, 85, 86, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 136, 139, 57, 26, 40, 60, - 72, 183, 191, 242, 110, 110, 110, 230, 23, 152, - 23, 153, 143, 139, 34, 46, 203, 205, 108, 115, - 110, 32, 184, 188, 191, 108, 115, 108, 108, 109, - 109, 66, 204, 177, 230, 143, 135, 218, 223, 221, - 224, 109, 115, 108, 108, 110, 105, 110, 105, 208, - 143, 136, 223, 224, 105, 208, 110 + 241, 23, 247, 108, 108, 145, 228, 108, 108, 61, + 68, 243, 244, 109, 109, 109, 64, 29, 56, 197, + 109, 25, 27, 39, 186, 242, 109, 242, 48, 51, + 52, 55, 63, 81, 209, 26, 70, 201, 109, 246, + 244, 66, 243, 109, 244, 109, 109, 165, 108, 115, + 23, 148, 149, 150, 154, 108, 108, 113, 173, 110, + 139, 138, 103, 157, 83, 135, 139, 23, 223, 23, + 224, 23, 199, 23, 192, 67, 192, 25, 31, 33, + 69, 71, 181, 191, 109, 23, 210, 211, 109, 244, + 41, 42, 82, 206, 207, 23, 249, 29, 190, 35, + 54, 194, 109, 23, 166, 23, 164, 166, 230, 110, + 103, 155, 142, 143, 231, 139, 114, 109, 245, 108, + 108, 110, 110, 110, 110, 110, 23, 213, 23, 212, + 110, 77, 78, 79, 80, 195, 23, 208, 110, 110, + 110, 108, 115, 111, 112, 151, 108, 23, 99, 144, + 108, 62, 73, 174, 177, 178, 179, 216, 217, 220, + 225, 23, 248, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 136, 139, 57, 26, 40, + 60, 72, 183, 191, 242, 110, 110, 110, 230, 23, + 152, 23, 153, 143, 139, 34, 46, 203, 205, 108, + 115, 110, 32, 184, 188, 191, 108, 115, 108, 108, + 109, 109, 66, 204, 177, 230, 143, 135, 218, 223, + 221, 224, 109, 115, 108, 108, 110, 105, 110, 105, + 208, 143, 136, 223, 224, 105, 208, 110 }; #define yyerrok (yyerrstatus = 0) @@ -2457,7 +2459,29 @@ yyreduce: case 48: /* Line 1455 of yacc.c */ -#line 540 "program_parse.y" +#line 538 "program_parse.y" + { + struct asm_symbol temp_sym; + + if (!state->option.NV_fragment) { + yyerror(& (yylsp[(2) - (2)]), state, "expected scalar suffix"); + YYERROR; + } + + memset(& temp_sym, 0, sizeof(temp_sym)); + temp_sym.param_binding_begin = ~0; + initialize_symbol_from_const(state->prog, & temp_sym, & (yyvsp[(2) - (2)].vector)); + + init_src_reg(& (yyval.src_reg)); + (yyval.src_reg).Base.File = PROGRAM_CONSTANT; + (yyval.src_reg).Base.Index = temp_sym.param_binding_begin; + ;} + break; + + case 49: + +/* Line 1455 of yacc.c */ +#line 557 "program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (3)].src_reg); @@ -2470,10 +2494,10 @@ yyreduce: ;} break; - case 49: + case 50: /* Line 1455 of yacc.c */ -#line 553 "program_parse.y" +#line 570 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); (yyval.dst_reg).WriteMask = (yyvsp[(2) - (2)].swiz_mask).mask; @@ -2495,10 +2519,10 @@ yyreduce: ;} break; - case 50: + case 51: /* Line 1455 of yacc.c */ -#line 575 "program_parse.y" +#line 592 "program_parse.y" { init_dst_reg(& (yyval.dst_reg)); (yyval.dst_reg).File = PROGRAM_ADDRESS; @@ -2507,10 +2531,10 @@ yyreduce: ;} break; - case 51: + case 52: /* Line 1455 of yacc.c */ -#line 584 "program_parse.y" +#line 601 "program_parse.y" { const unsigned xyzw_valid = ((yyvsp[(1) - (7)].ext_swizzle).xyzw_valid << 0) @@ -2543,20 +2567,20 @@ yyreduce: ;} break; - case 52: + case 53: /* Line 1455 of yacc.c */ -#line 617 "program_parse.y" +#line 634 "program_parse.y" { (yyval.ext_swizzle) = (yyvsp[(2) - (2)].ext_swizzle); (yyval.ext_swizzle).negate = ((yyvsp[(1) - (2)].negate)) ? 1 : 0; ;} break; - case 53: + case 54: /* Line 1455 of yacc.c */ -#line 624 "program_parse.y" +#line 641 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) != 0) && ((yyvsp[(1) - (1)].integer) != 1)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector"); @@ -2573,10 +2597,10 @@ yyreduce: ;} break; - case 54: + case 55: /* Line 1455 of yacc.c */ -#line 639 "program_parse.y" +#line 656 "program_parse.y" { if (strlen((yyvsp[(1) - (1)].string)) > 1) { yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector"); @@ -2626,10 +2650,10 @@ yyreduce: ;} break; - case 55: + case 56: /* Line 1455 of yacc.c */ -#line 689 "program_parse.y" +#line 706 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2673,10 +2697,10 @@ yyreduce: ;} break; - case 56: + case 57: /* Line 1455 of yacc.c */ -#line 731 "program_parse.y" +#line 748 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.File = PROGRAM_INPUT; @@ -2689,10 +2713,10 @@ yyreduce: ;} break; - case 57: + case 58: /* Line 1455 of yacc.c */ -#line 742 "program_parse.y" +#line 759 "program_parse.y" { if (! (yyvsp[(3) - (4)].src_reg).Base.RelAddr && ((unsigned) (yyvsp[(3) - (4)].src_reg).Base.Index >= (yyvsp[(1) - (4)].sym)->param_binding_length)) { @@ -2715,10 +2739,10 @@ yyreduce: ;} break; - case 58: + case 59: /* Line 1455 of yacc.c */ -#line 763 "program_parse.y" +#line 780 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.File = ((yyvsp[(1) - (1)].temp_sym).name != NULL) @@ -2728,10 +2752,10 @@ yyreduce: ;} break; - case 59: + case 60: /* Line 1455 of yacc.c */ -#line 773 "program_parse.y" +#line 790 "program_parse.y" { init_dst_reg(& (yyval.dst_reg)); (yyval.dst_reg).File = PROGRAM_OUTPUT; @@ -2739,10 +2763,10 @@ yyreduce: ;} break; - case 60: + case 61: /* Line 1455 of yacc.c */ -#line 779 "program_parse.y" +#line 796 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2773,10 +2797,10 @@ yyreduce: ;} break; - case 61: + case 62: /* Line 1455 of yacc.c */ -#line 810 "program_parse.y" +#line 827 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2793,20 +2817,20 @@ yyreduce: ;} break; - case 64: + case 65: /* Line 1455 of yacc.c */ -#line 829 "program_parse.y" +#line 846 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].integer); ;} break; - case 65: + case 66: /* Line 1455 of yacc.c */ -#line 836 "program_parse.y" +#line 853 "program_parse.y" { /* FINISHME: Add support for multiple address registers. */ @@ -2818,31 +2842,31 @@ yyreduce: ;} break; - case 66: + case 67: /* Line 1455 of yacc.c */ -#line 847 "program_parse.y" +#line 864 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 67: + case 68: /* Line 1455 of yacc.c */ -#line 848 "program_parse.y" +#line 865 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; - case 68: + case 69: /* Line 1455 of yacc.c */ -#line 849 "program_parse.y" +#line 866 "program_parse.y" { (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;} break; - case 69: + case 70: /* Line 1455 of yacc.c */ -#line 853 "program_parse.y" +#line 870 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 63)) { yyerror(& (yylsp[(1) - (1)]), state, @@ -2854,10 +2878,10 @@ yyreduce: ;} break; - case 70: + case 71: /* Line 1455 of yacc.c */ -#line 865 "program_parse.y" +#line 882 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 64)) { yyerror(& (yylsp[(1) - (1)]), state, @@ -2869,10 +2893,10 @@ yyreduce: ;} break; - case 71: + case 72: /* Line 1455 of yacc.c */ -#line 877 "program_parse.y" +#line 894 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2890,10 +2914,10 @@ yyreduce: ;} break; - case 72: + case 73: /* Line 1455 of yacc.c */ -#line 895 "program_parse.y" +#line 912 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, "invalid address component selector"); @@ -2904,10 +2928,10 @@ yyreduce: ;} break; - case 73: + case 74: /* Line 1455 of yacc.c */ -#line 906 "program_parse.y" +#line 923 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, @@ -2919,24 +2943,24 @@ yyreduce: ;} break; - case 78: + case 79: /* Line 1455 of yacc.c */ -#line 922 "program_parse.y" +#line 939 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; - case 83: + case 84: /* Line 1455 of yacc.c */ -#line 926 "program_parse.y" +#line 943 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; - case 90: + case 91: /* Line 1455 of yacc.c */ -#line 938 "program_parse.y" +#line 955 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (4)].string), at_attrib, & (yylsp[(2) - (4)])); @@ -2954,55 +2978,55 @@ yyreduce: ;} break; - case 91: + case 92: /* Line 1455 of yacc.c */ -#line 956 "program_parse.y" +#line 973 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} break; - case 92: + case 93: /* Line 1455 of yacc.c */ -#line 960 "program_parse.y" +#line 977 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} break; - case 93: + case 94: /* Line 1455 of yacc.c */ -#line 966 "program_parse.y" +#line 983 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_POS; ;} break; - case 94: + case 95: /* Line 1455 of yacc.c */ -#line 970 "program_parse.y" +#line 987 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_WEIGHT; ;} break; - case 95: + case 96: /* Line 1455 of yacc.c */ -#line 974 "program_parse.y" +#line 991 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_NORMAL; ;} break; - case 96: + case 97: /* Line 1455 of yacc.c */ -#line 978 "program_parse.y" +#line 995 "program_parse.y" { if (!state->ctx->Extensions.EXT_secondary_color) { yyerror(& (yylsp[(2) - (2)]), state, "GL_EXT_secondary_color not supported"); @@ -3013,10 +3037,10 @@ yyreduce: ;} break; - case 97: + case 98: /* Line 1455 of yacc.c */ -#line 987 "program_parse.y" +#line 1004 "program_parse.y" { if (!state->ctx->Extensions.EXT_fog_coord) { yyerror(& (yylsp[(1) - (1)]), state, "GL_EXT_fog_coord not supported"); @@ -3027,38 +3051,38 @@ yyreduce: ;} break; - case 98: + case 99: /* Line 1455 of yacc.c */ -#line 996 "program_parse.y" +#line 1013 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} break; - case 99: + case 100: /* Line 1455 of yacc.c */ -#line 1000 "program_parse.y" +#line 1017 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; ;} break; - case 100: + case 101: /* Line 1455 of yacc.c */ -#line 1005 "program_parse.y" +#line 1022 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_GENERIC0 + (yyvsp[(3) - (4)].integer); ;} break; - case 101: + case 102: /* Line 1455 of yacc.c */ -#line 1011 "program_parse.y" +#line 1028 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxAttribs) { yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex attribute reference"); @@ -3069,46 +3093,46 @@ yyreduce: ;} break; - case 105: + case 106: /* Line 1455 of yacc.c */ -#line 1025 "program_parse.y" +#line 1042 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_WPOS; ;} break; - case 106: + case 107: /* Line 1455 of yacc.c */ -#line 1029 "program_parse.y" +#line 1046 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_COL0 + (yyvsp[(2) - (2)].integer); ;} break; - case 107: + case 108: /* Line 1455 of yacc.c */ -#line 1033 "program_parse.y" +#line 1050 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_FOGC; ;} break; - case 108: + case 109: /* Line 1455 of yacc.c */ -#line 1037 "program_parse.y" +#line 1054 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} break; - case 111: + case 112: /* Line 1455 of yacc.c */ -#line 1045 "program_parse.y" +#line 1062 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (3)].string), at_param, & (yylsp[(2) - (3)])); @@ -3124,10 +3148,10 @@ yyreduce: ;} break; - case 112: + case 113: /* Line 1455 of yacc.c */ -#line 1061 "program_parse.y" +#line 1078 "program_parse.y" { if (((yyvsp[(4) - (6)].integer) != 0) && ((unsigned) (yyvsp[(4) - (6)].integer) != (yyvsp[(6) - (6)].temp_sym).param_binding_length)) { yyerror(& (yylsp[(4) - (6)]), state, @@ -3149,19 +3173,19 @@ yyreduce: ;} break; - case 113: + case 114: /* Line 1455 of yacc.c */ -#line 1083 "program_parse.y" +#line 1100 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 114: + case 115: /* Line 1455 of yacc.c */ -#line 1087 "program_parse.y" +#line 1104 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxParameters)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid parameter array size"); @@ -3172,38 +3196,38 @@ yyreduce: ;} break; - case 115: + case 116: /* Line 1455 of yacc.c */ -#line 1098 "program_parse.y" +#line 1115 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(2) - (2)].temp_sym); ;} break; - case 116: + case 117: /* Line 1455 of yacc.c */ -#line 1104 "program_parse.y" +#line 1121 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(3) - (4)].temp_sym); ;} break; - case 118: + case 119: /* Line 1455 of yacc.c */ -#line 1111 "program_parse.y" +#line 1128 "program_parse.y" { (yyvsp[(1) - (3)].temp_sym).param_binding_length += (yyvsp[(3) - (3)].temp_sym).param_binding_length; (yyval.temp_sym) = (yyvsp[(1) - (3)].temp_sym); ;} break; - case 119: + case 120: /* Line 1455 of yacc.c */ -#line 1118 "program_parse.y" +#line 1135 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3211,10 +3235,10 @@ yyreduce: ;} break; - case 120: + case 121: /* Line 1455 of yacc.c */ -#line 1124 "program_parse.y" +#line 1141 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3222,10 +3246,10 @@ yyreduce: ;} break; - case 121: + case 122: /* Line 1455 of yacc.c */ -#line 1130 "program_parse.y" +#line 1147 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3233,10 +3257,10 @@ yyreduce: ;} break; - case 122: + case 123: /* Line 1455 of yacc.c */ -#line 1138 "program_parse.y" +#line 1155 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3244,10 +3268,10 @@ yyreduce: ;} break; - case 123: + case 124: /* Line 1455 of yacc.c */ -#line 1144 "program_parse.y" +#line 1161 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3255,10 +3279,10 @@ yyreduce: ;} break; - case 124: + case 125: /* Line 1455 of yacc.c */ -#line 1150 "program_parse.y" +#line 1167 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3266,10 +3290,10 @@ yyreduce: ;} break; - case 125: + case 126: /* Line 1455 of yacc.c */ -#line 1158 "program_parse.y" +#line 1175 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3277,10 +3301,10 @@ yyreduce: ;} break; - case 126: + case 127: /* Line 1455 of yacc.c */ -#line 1164 "program_parse.y" +#line 1181 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3288,10 +3312,10 @@ yyreduce: ;} break; - case 127: + case 128: /* Line 1455 of yacc.c */ -#line 1170 "program_parse.y" +#line 1187 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3299,101 +3323,101 @@ yyreduce: ;} break; - case 128: - -/* Line 1455 of yacc.c */ -#line 1177 "program_parse.y" - { memcpy((yyval.state), (yyvsp[(1) - (1)].state), sizeof((yyval.state))); ;} - break; - case 129: /* Line 1455 of yacc.c */ -#line 1178 "program_parse.y" - { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} +#line 1194 "program_parse.y" + { memcpy((yyval.state), (yyvsp[(1) - (1)].state), sizeof((yyval.state))); ;} break; case 130: /* Line 1455 of yacc.c */ -#line 1181 "program_parse.y" +#line 1195 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 131: /* Line 1455 of yacc.c */ -#line 1182 "program_parse.y" +#line 1198 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 132: /* Line 1455 of yacc.c */ -#line 1183 "program_parse.y" +#line 1199 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 133: /* Line 1455 of yacc.c */ -#line 1184 "program_parse.y" +#line 1200 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 134: /* Line 1455 of yacc.c */ -#line 1185 "program_parse.y" +#line 1201 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 135: /* Line 1455 of yacc.c */ -#line 1186 "program_parse.y" +#line 1202 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 136: /* Line 1455 of yacc.c */ -#line 1187 "program_parse.y" +#line 1203 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 137: /* Line 1455 of yacc.c */ -#line 1188 "program_parse.y" +#line 1204 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 138: /* Line 1455 of yacc.c */ -#line 1189 "program_parse.y" +#line 1205 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 139: /* Line 1455 of yacc.c */ -#line 1190 "program_parse.y" +#line 1206 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 140: /* Line 1455 of yacc.c */ -#line 1191 "program_parse.y" +#line 1207 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 141: /* Line 1455 of yacc.c */ -#line 1195 "program_parse.y" +#line 1208 "program_parse.y" + { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} + break; + + case 142: + +/* Line 1455 of yacc.c */ +#line 1212 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_MATERIAL; @@ -3402,37 +3426,37 @@ yyreduce: ;} break; - case 142: + case 143: /* Line 1455 of yacc.c */ -#line 1204 "program_parse.y" +#line 1221 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 143: + case 144: /* Line 1455 of yacc.c */ -#line 1208 "program_parse.y" +#line 1225 "program_parse.y" { (yyval.integer) = STATE_EMISSION; ;} break; - case 144: + case 145: /* Line 1455 of yacc.c */ -#line 1212 "program_parse.y" +#line 1229 "program_parse.y" { (yyval.integer) = STATE_SHININESS; ;} break; - case 145: + case 146: /* Line 1455 of yacc.c */ -#line 1218 "program_parse.y" +#line 1235 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHT; @@ -3441,28 +3465,28 @@ yyreduce: ;} break; - case 146: + case 147: /* Line 1455 of yacc.c */ -#line 1227 "program_parse.y" +#line 1244 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 147: + case 148: /* Line 1455 of yacc.c */ -#line 1231 "program_parse.y" +#line 1248 "program_parse.y" { (yyval.integer) = STATE_POSITION; ;} break; - case 148: + case 149: /* Line 1455 of yacc.c */ -#line 1235 "program_parse.y" +#line 1252 "program_parse.y" { if (!state->ctx->Extensions.EXT_point_parameters) { yyerror(& (yylsp[(1) - (1)]), state, "GL_ARB_point_parameters not supported"); @@ -3473,57 +3497,57 @@ yyreduce: ;} break; - case 149: + case 150: /* Line 1455 of yacc.c */ -#line 1244 "program_parse.y" +#line 1261 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; - case 150: + case 151: /* Line 1455 of yacc.c */ -#line 1248 "program_parse.y" +#line 1265 "program_parse.y" { (yyval.integer) = STATE_HALF_VECTOR; ;} break; - case 151: + case 152: /* Line 1455 of yacc.c */ -#line 1254 "program_parse.y" +#line 1271 "program_parse.y" { (yyval.integer) = STATE_SPOT_DIRECTION; ;} break; - case 152: + case 153: /* Line 1455 of yacc.c */ -#line 1260 "program_parse.y" +#line 1277 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (2)].state)[1]; ;} break; - case 153: + case 154: /* Line 1455 of yacc.c */ -#line 1267 "program_parse.y" +#line 1284 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_AMBIENT; ;} break; - case 154: + case 155: /* Line 1455 of yacc.c */ -#line 1272 "program_parse.y" +#line 1289 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_SCENECOLOR; @@ -3531,10 +3555,10 @@ yyreduce: ;} break; - case 155: + case 156: /* Line 1455 of yacc.c */ -#line 1280 "program_parse.y" +#line 1297 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTPROD; @@ -3544,10 +3568,10 @@ yyreduce: ;} break; - case 157: + case 158: /* Line 1455 of yacc.c */ -#line 1292 "program_parse.y" +#line 1309 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(3) - (3)].integer); @@ -3555,46 +3579,46 @@ yyreduce: ;} break; - case 158: + case 159: /* Line 1455 of yacc.c */ -#line 1300 "program_parse.y" +#line 1317 "program_parse.y" { (yyval.integer) = STATE_TEXENV_COLOR; ;} break; - case 159: + case 160: /* Line 1455 of yacc.c */ -#line 1306 "program_parse.y" +#line 1323 "program_parse.y" { (yyval.integer) = STATE_AMBIENT; ;} break; - case 160: + case 161: /* Line 1455 of yacc.c */ -#line 1310 "program_parse.y" +#line 1327 "program_parse.y" { (yyval.integer) = STATE_DIFFUSE; ;} break; - case 161: + case 162: /* Line 1455 of yacc.c */ -#line 1314 "program_parse.y" +#line 1331 "program_parse.y" { (yyval.integer) = STATE_SPECULAR; ;} break; - case 162: + case 163: /* Line 1455 of yacc.c */ -#line 1320 "program_parse.y" +#line 1337 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxLights) { yyerror(& (yylsp[(1) - (1)]), state, "invalid light selector"); @@ -3605,10 +3629,10 @@ yyreduce: ;} break; - case 163: + case 164: /* Line 1455 of yacc.c */ -#line 1331 "program_parse.y" +#line 1348 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_TEXGEN; @@ -3617,92 +3641,92 @@ yyreduce: ;} break; - case 164: + case 165: /* Line 1455 of yacc.c */ -#line 1340 "program_parse.y" +#line 1357 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S; ;} break; - case 165: + case 166: /* Line 1455 of yacc.c */ -#line 1344 "program_parse.y" +#line 1361 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_OBJECT_S; ;} break; - case 166: + case 167: /* Line 1455 of yacc.c */ -#line 1349 "program_parse.y" +#line 1366 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S; ;} break; - case 167: + case 168: /* Line 1455 of yacc.c */ -#line 1353 "program_parse.y" +#line 1370 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S; ;} break; - case 168: + case 169: /* Line 1455 of yacc.c */ -#line 1357 "program_parse.y" +#line 1374 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S; ;} break; - case 169: + case 170: /* Line 1455 of yacc.c */ -#line 1361 "program_parse.y" +#line 1378 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S; ;} break; - case 170: + case 171: /* Line 1455 of yacc.c */ -#line 1367 "program_parse.y" +#line 1384 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); ;} break; - case 171: + case 172: /* Line 1455 of yacc.c */ -#line 1374 "program_parse.y" +#line 1391 "program_parse.y" { (yyval.integer) = STATE_FOG_COLOR; ;} break; - case 172: + case 173: /* Line 1455 of yacc.c */ -#line 1378 "program_parse.y" +#line 1395 "program_parse.y" { (yyval.integer) = STATE_FOG_PARAMS; ;} break; - case 173: + case 174: /* Line 1455 of yacc.c */ -#line 1384 "program_parse.y" +#line 1401 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_CLIPPLANE; @@ -3710,10 +3734,10 @@ yyreduce: ;} break; - case 174: + case 175: /* Line 1455 of yacc.c */ -#line 1392 "program_parse.y" +#line 1409 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxClipPlanes) { yyerror(& (yylsp[(1) - (1)]), state, "invalid clip plane selector"); @@ -3724,38 +3748,38 @@ yyreduce: ;} break; - case 175: + case 176: /* Line 1455 of yacc.c */ -#line 1403 "program_parse.y" +#line 1420 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); ;} break; - case 176: + case 177: /* Line 1455 of yacc.c */ -#line 1410 "program_parse.y" +#line 1427 "program_parse.y" { (yyval.integer) = STATE_POINT_SIZE; ;} break; - case 177: + case 178: /* Line 1455 of yacc.c */ -#line 1414 "program_parse.y" +#line 1431 "program_parse.y" { (yyval.integer) = STATE_POINT_ATTENUATION; ;} break; - case 178: + case 179: /* Line 1455 of yacc.c */ -#line 1420 "program_parse.y" +#line 1437 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (5)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (5)].state)[1]; @@ -3765,10 +3789,10 @@ yyreduce: ;} break; - case 179: + case 180: /* Line 1455 of yacc.c */ -#line 1430 "program_parse.y" +#line 1447 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (2)].state)[1]; @@ -3778,20 +3802,20 @@ yyreduce: ;} break; - case 180: + case 181: /* Line 1455 of yacc.c */ -#line 1440 "program_parse.y" +#line 1457 "program_parse.y" { (yyval.state)[2] = 0; (yyval.state)[3] = 3; ;} break; - case 181: + case 182: /* Line 1455 of yacc.c */ -#line 1445 "program_parse.y" +#line 1462 "program_parse.y" { /* It seems logical that the matrix row range specifier would have * to specify a range or more than one row (i.e., $5 > $3). @@ -3809,10 +3833,10 @@ yyreduce: ;} break; - case 182: + case 183: /* Line 1455 of yacc.c */ -#line 1463 "program_parse.y" +#line 1480 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (3)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (3)].state)[1]; @@ -3820,55 +3844,55 @@ yyreduce: ;} break; - case 183: + case 184: /* Line 1455 of yacc.c */ -#line 1471 "program_parse.y" +#line 1488 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 184: + case 185: /* Line 1455 of yacc.c */ -#line 1475 "program_parse.y" +#line 1492 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 185: + case 186: /* Line 1455 of yacc.c */ -#line 1481 "program_parse.y" +#line 1498 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVERSE; ;} break; - case 186: + case 187: /* Line 1455 of yacc.c */ -#line 1485 "program_parse.y" +#line 1502 "program_parse.y" { (yyval.integer) = STATE_MATRIX_TRANSPOSE; ;} break; - case 187: + case 188: /* Line 1455 of yacc.c */ -#line 1489 "program_parse.y" +#line 1506 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVTRANS; ;} break; - case 188: + case 189: /* Line 1455 of yacc.c */ -#line 1495 "program_parse.y" +#line 1512 "program_parse.y" { if ((yyvsp[(1) - (1)].integer) > 3) { yyerror(& (yylsp[(1) - (1)]), state, "invalid matrix row reference"); @@ -3879,88 +3903,88 @@ yyreduce: ;} break; - case 189: + case 190: /* Line 1455 of yacc.c */ -#line 1506 "program_parse.y" +#line 1523 "program_parse.y" { (yyval.state)[0] = STATE_MODELVIEW_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); ;} break; - case 190: + case 191: /* Line 1455 of yacc.c */ -#line 1511 "program_parse.y" +#line 1528 "program_parse.y" { (yyval.state)[0] = STATE_PROJECTION_MATRIX; (yyval.state)[1] = 0; ;} break; - case 191: + case 192: /* Line 1455 of yacc.c */ -#line 1516 "program_parse.y" +#line 1533 "program_parse.y" { (yyval.state)[0] = STATE_MVP_MATRIX; (yyval.state)[1] = 0; ;} break; - case 192: + case 193: /* Line 1455 of yacc.c */ -#line 1521 "program_parse.y" +#line 1538 "program_parse.y" { (yyval.state)[0] = STATE_TEXTURE_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); ;} break; - case 193: + case 194: /* Line 1455 of yacc.c */ -#line 1526 "program_parse.y" +#line 1543 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; ;} break; - case 194: + case 195: /* Line 1455 of yacc.c */ -#line 1531 "program_parse.y" +#line 1548 "program_parse.y" { (yyval.state)[0] = STATE_PROGRAM_MATRIX; (yyval.state)[1] = (yyvsp[(3) - (4)].integer); ;} break; - case 195: + case 196: /* Line 1455 of yacc.c */ -#line 1538 "program_parse.y" +#line 1555 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 196: + case 197: /* Line 1455 of yacc.c */ -#line 1542 "program_parse.y" +#line 1559 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 197: + case 198: /* Line 1455 of yacc.c */ -#line 1547 "program_parse.y" +#line 1564 "program_parse.y" { /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix * zero is valid. @@ -3974,10 +3998,10 @@ yyreduce: ;} break; - case 198: + case 199: /* Line 1455 of yacc.c */ -#line 1560 "program_parse.y" +#line 1577 "program_parse.y" { /* Since GL_ARB_matrix_palette isn't supported, just let any value * through here. The error will be generated later. @@ -3986,10 +4010,10 @@ yyreduce: ;} break; - case 199: + case 200: /* Line 1455 of yacc.c */ -#line 1568 "program_parse.y" +#line 1585 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxProgramMatrices) { yyerror(& (yylsp[(1) - (1)]), state, "invalid program matrix selector"); @@ -4000,20 +4024,20 @@ yyreduce: ;} break; - case 200: + case 201: /* Line 1455 of yacc.c */ -#line 1579 "program_parse.y" +#line 1596 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_DEPTH_RANGE; ;} break; - case 205: + case 206: /* Line 1455 of yacc.c */ -#line 1591 "program_parse.y" +#line 1608 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4023,30 +4047,30 @@ yyreduce: ;} break; - case 206: + case 207: /* Line 1455 of yacc.c */ -#line 1601 "program_parse.y" +#line 1618 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); ;} break; - case 207: + case 208: /* Line 1455 of yacc.c */ -#line 1606 "program_parse.y" +#line 1623 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); ;} break; - case 208: + case 209: /* Line 1455 of yacc.c */ -#line 1613 "program_parse.y" +#line 1630 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4056,10 +4080,10 @@ yyreduce: ;} break; - case 209: + case 210: /* Line 1455 of yacc.c */ -#line 1623 "program_parse.y" +#line 1640 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4069,30 +4093,30 @@ yyreduce: ;} break; - case 210: + case 211: /* Line 1455 of yacc.c */ -#line 1632 "program_parse.y" +#line 1649 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); ;} break; - case 211: + case 212: /* Line 1455 of yacc.c */ -#line 1637 "program_parse.y" +#line 1654 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); ;} break; - case 212: + case 213: /* Line 1455 of yacc.c */ -#line 1644 "program_parse.y" +#line 1661 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4102,10 +4126,10 @@ yyreduce: ;} break; - case 213: + case 214: /* Line 1455 of yacc.c */ -#line 1654 "program_parse.y" +#line 1671 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxEnvParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid environment parameter reference"); @@ -4115,10 +4139,10 @@ yyreduce: ;} break; - case 214: + case 215: /* Line 1455 of yacc.c */ -#line 1664 "program_parse.y" +#line 1681 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxLocalParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid local parameter reference"); @@ -4128,10 +4152,10 @@ yyreduce: ;} break; - case 219: + case 220: /* Line 1455 of yacc.c */ -#line 1679 "program_parse.y" +#line 1696 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4141,10 +4165,10 @@ yyreduce: ;} break; - case 220: + case 221: /* Line 1455 of yacc.c */ -#line 1689 "program_parse.y" +#line 1706 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4154,10 +4178,10 @@ yyreduce: ;} break; - case 221: + case 222: /* Line 1455 of yacc.c */ -#line 1697 "program_parse.y" +#line 1714 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (float) (yyvsp[(1) - (1)].integer); @@ -4167,10 +4191,10 @@ yyreduce: ;} break; - case 222: + case 223: /* Line 1455 of yacc.c */ -#line 1707 "program_parse.y" +#line 1724 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (3)].real); @@ -4180,10 +4204,10 @@ yyreduce: ;} break; - case 223: + case 224: /* Line 1455 of yacc.c */ -#line 1715 "program_parse.y" +#line 1732 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (5)].real); @@ -4193,10 +4217,10 @@ yyreduce: ;} break; - case 224: + case 225: /* Line 1455 of yacc.c */ -#line 1724 "program_parse.y" +#line 1741 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (7)].real); @@ -4206,10 +4230,10 @@ yyreduce: ;} break; - case 225: + case 226: /* Line 1455 of yacc.c */ -#line 1733 "program_parse.y" +#line 1750 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (9)].real); @@ -4219,63 +4243,63 @@ yyreduce: ;} break; - case 226: + case 227: /* Line 1455 of yacc.c */ -#line 1743 "program_parse.y" +#line 1760 "program_parse.y" { (yyval.real) = ((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].real) : (yyvsp[(2) - (2)].real); ;} break; - case 227: + case 228: /* Line 1455 of yacc.c */ -#line 1747 "program_parse.y" +#line 1764 "program_parse.y" { (yyval.real) = (float)(((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].integer) : (yyvsp[(2) - (2)].integer)); ;} break; - case 228: + case 229: /* Line 1455 of yacc.c */ -#line 1752 "program_parse.y" +#line 1769 "program_parse.y" { (yyval.negate) = FALSE; ;} break; - case 229: + case 230: /* Line 1455 of yacc.c */ -#line 1753 "program_parse.y" +#line 1770 "program_parse.y" { (yyval.negate) = TRUE; ;} break; - case 230: + case 231: /* Line 1455 of yacc.c */ -#line 1754 "program_parse.y" +#line 1771 "program_parse.y" { (yyval.negate) = FALSE; ;} break; - case 231: + case 232: /* Line 1455 of yacc.c */ -#line 1757 "program_parse.y" +#line 1774 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 233: + case 234: /* Line 1455 of yacc.c */ -#line 1760 "program_parse.y" +#line 1777 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 235: + case 236: /* Line 1455 of yacc.c */ -#line 1764 "program_parse.y" +#line 1781 "program_parse.y" { if (!declare_variable(state, (yyvsp[(3) - (3)].string), (yyvsp[(0) - (3)].integer), & (yylsp[(3) - (3)]))) { YYERROR; @@ -4283,10 +4307,10 @@ yyreduce: ;} break; - case 236: + case 237: /* Line 1455 of yacc.c */ -#line 1770 "program_parse.y" +#line 1787 "program_parse.y" { if (!declare_variable(state, (yyvsp[(1) - (1)].string), (yyvsp[(0) - (1)].integer), & (yylsp[(1) - (1)]))) { YYERROR; @@ -4294,10 +4318,10 @@ yyreduce: ;} break; - case 237: + case 238: /* Line 1455 of yacc.c */ -#line 1778 "program_parse.y" +#line 1795 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (4)].string), at_output, & (yylsp[(2) - (4)])); @@ -4310,10 +4334,10 @@ yyreduce: ;} break; - case 238: + case 239: /* Line 1455 of yacc.c */ -#line 1791 "program_parse.y" +#line 1808 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_HPOS; @@ -4324,10 +4348,10 @@ yyreduce: ;} break; - case 239: + case 240: /* Line 1455 of yacc.c */ -#line 1800 "program_parse.y" +#line 1817 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_FOGC; @@ -4338,19 +4362,19 @@ yyreduce: ;} break; - case 240: + case 241: /* Line 1455 of yacc.c */ -#line 1809 "program_parse.y" +#line 1826 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (2)].result); ;} break; - case 241: + case 242: /* Line 1455 of yacc.c */ -#line 1813 "program_parse.y" +#line 1830 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_PSIZ; @@ -4361,10 +4385,10 @@ yyreduce: ;} break; - case 242: + case 243: /* Line 1455 of yacc.c */ -#line 1822 "program_parse.y" +#line 1839 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_TEX0 + (yyvsp[(3) - (3)].integer); @@ -4375,10 +4399,10 @@ yyreduce: ;} break; - case 243: + case 244: /* Line 1455 of yacc.c */ -#line 1831 "program_parse.y" +#line 1848 "program_parse.y" { if (state->mode == ARB_fragment) { (yyval.result) = FRAG_RESULT_DEPTH; @@ -4389,19 +4413,19 @@ yyreduce: ;} break; - case 244: + case 245: /* Line 1455 of yacc.c */ -#line 1842 "program_parse.y" +#line 1859 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (3)].integer) + (yyvsp[(3) - (3)].integer); ;} break; - case 245: + case 246: /* Line 1455 of yacc.c */ -#line 1848 "program_parse.y" +#line 1865 "program_parse.y" { (yyval.integer) = (state->mode == ARB_vertex) ? VERT_RESULT_COL0 @@ -4409,10 +4433,10 @@ yyreduce: ;} break; - case 246: + case 247: /* Line 1455 of yacc.c */ -#line 1854 "program_parse.y" +#line 1871 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_COL0; @@ -4423,10 +4447,10 @@ yyreduce: ;} break; - case 247: + case 248: /* Line 1455 of yacc.c */ -#line 1863 "program_parse.y" +#line 1880 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_BFC0; @@ -4437,19 +4461,19 @@ yyreduce: ;} break; - case 248: + case 249: /* Line 1455 of yacc.c */ -#line 1874 "program_parse.y" +#line 1891 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 249: + case 250: /* Line 1455 of yacc.c */ -#line 1878 "program_parse.y" +#line 1895 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 0; @@ -4460,10 +4484,10 @@ yyreduce: ;} break; - case 250: + case 251: /* Line 1455 of yacc.c */ -#line 1887 "program_parse.y" +#line 1904 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 1; @@ -4474,94 +4498,94 @@ yyreduce: ;} break; - case 251: + case 252: /* Line 1455 of yacc.c */ -#line 1897 "program_parse.y" +#line 1914 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 252: + case 253: /* Line 1455 of yacc.c */ -#line 1898 "program_parse.y" +#line 1915 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 253: + case 254: /* Line 1455 of yacc.c */ -#line 1899 "program_parse.y" +#line 1916 "program_parse.y" { (yyval.integer) = 1; ;} break; - case 254: + case 255: /* Line 1455 of yacc.c */ -#line 1902 "program_parse.y" +#line 1919 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 255: + case 256: /* Line 1455 of yacc.c */ -#line 1903 "program_parse.y" +#line 1920 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 256: + case 257: /* Line 1455 of yacc.c */ -#line 1904 "program_parse.y" +#line 1921 "program_parse.y" { (yyval.integer) = 1; ;} break; - case 257: + case 258: /* Line 1455 of yacc.c */ -#line 1907 "program_parse.y" +#line 1924 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 258: + case 259: /* Line 1455 of yacc.c */ -#line 1908 "program_parse.y" +#line 1925 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; - case 259: + case 260: /* Line 1455 of yacc.c */ -#line 1911 "program_parse.y" +#line 1928 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 260: + case 261: /* Line 1455 of yacc.c */ -#line 1912 "program_parse.y" +#line 1929 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; - case 261: + case 262: /* Line 1455 of yacc.c */ -#line 1915 "program_parse.y" +#line 1932 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 262: + case 263: /* Line 1455 of yacc.c */ -#line 1916 "program_parse.y" +#line 1933 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; - case 263: + case 264: /* Line 1455 of yacc.c */ -#line 1920 "program_parse.y" +#line 1937 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureCoordUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture coordinate unit selector"); @@ -4572,10 +4596,10 @@ yyreduce: ;} break; - case 264: + case 265: /* Line 1455 of yacc.c */ -#line 1931 "program_parse.y" +#line 1948 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureImageUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture image unit selector"); @@ -4586,10 +4610,10 @@ yyreduce: ;} break; - case 265: + case 266: /* Line 1455 of yacc.c */ -#line 1942 "program_parse.y" +#line 1959 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture unit selector"); @@ -4600,10 +4624,10 @@ yyreduce: ;} break; - case 266: + case 267: /* Line 1455 of yacc.c */ -#line 1953 "program_parse.y" +#line 1970 "program_parse.y" { struct asm_symbol *exist = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(2) - (4)].string)); @@ -4627,7 +4651,7 @@ yyreduce: /* Line 1455 of yacc.c */ -#line 4631 "program_parse.tab.c" +#line 4655 "program_parse.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -4846,7 +4870,7 @@ yyreturn: /* Line 1675 of yacc.c */ -#line 1973 "program_parse.y" +#line 1990 "program_parse.y" struct asm_instruction * diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index 4cd459a096..fa94f763c4 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -534,6 +534,23 @@ scalarSrcReg: optionalSign srcReg scalarSuffix $$.Base.Swizzle = _mesa_combine_swizzles($$.Base.Swizzle, $3.swizzle); } + | optionalSign paramConstScalarUse + { + struct asm_symbol temp_sym; + + if (!state->option.NV_fragment) { + yyerror(& @2, state, "expected scalar suffix"); + YYERROR; + } + + memset(& temp_sym, 0, sizeof(temp_sym)); + temp_sym.param_binding_begin = ~0; + initialize_symbol_from_const(state->prog, & temp_sym, & $2); + + init_src_reg(& $$); + $$.Base.File = PROGRAM_CONSTANT; + $$.Base.Index = temp_sym.param_binding_begin; + } ; swizzleSrcReg: optionalSign srcReg swizzleSuffix -- cgit v1.2.3 From 5db8ebb8f534907614247afaf1dd8621b2d0462e Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 3 Sep 2009 14:06:42 -0700 Subject: Enable GL_NV_fragment_program_option for software rendering At this point the extension is not fully implemented. --- src/mesa/drivers/dri/swrast/swrast.c | 1 + src/mesa/main/extensions.c | 3 +++ 2 files changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index 3aa7843b1b..d8de5cca80 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -109,6 +109,7 @@ const struct dri_extension card_extensions[] = { "GL_MESA_resize_buffers", GL_MESA_resize_buffers_functions }, { "GL_NV_vertex_program", GL_NV_vertex_program_functions }, { "GL_NV_fragment_program", GL_NV_fragment_program_functions }, + { "GL_NV_fragment_program_option", NULL }, { NULL, NULL } }; diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 903da99ed0..c6f5068685 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -305,6 +305,9 @@ _mesa_enable_sw_extensions(GLcontext *ctx) #endif #if FEATURE_NV_fragment_program ctx->Extensions.NV_fragment_program = GL_TRUE; +#endif +#if FEATURE_NV_fragment_program && FEATURE_ARB_fragment_program + ctx->Extensions.NV_fragment_program_option = GL_TRUE; #endif ctx->Extensions.SGI_color_matrix = GL_TRUE; ctx->Extensions.SGI_color_table = GL_TRUE; -- cgit v1.2.3 From eeb1402c0514248773e66f2077b0fb52f7245d56 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 3 Sep 2009 14:32:48 -0700 Subject: NV fp parser: Add support for absolute value operator on instruction operands --- src/mesa/shader/program_parse.tab.c | 1731 ++++++++++++++++++----------------- src/mesa/shader/program_parse.y | 51 +- 2 files changed, 942 insertions(+), 840 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c index 508ac617e4..505a1eb94f 100644 --- a/src/mesa/shader/program_parse.tab.c +++ b/src/mesa/shader/program_parse.tab.c @@ -588,16 +588,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 5 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 351 +#define YYLAST 375 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 116 +#define YYNTOKENS 117 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 135 +#define YYNNTS 136 /* YYNRULES -- Number of rules. */ -#define YYNRULES 267 +#define YYNRULES 270 /* YYNRULES -- Number of states. */ -#define YYNSTATES 448 +#define YYNSTATES 456 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -613,15 +613,15 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 111, 108, 112, 2, 2, 2, 2, + 2, 2, 2, 112, 108, 113, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 107, - 2, 113, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 114, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 109, 2, 110, 2, 2, 2, 2, 2, 2, + 2, 110, 2, 111, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 114, 2, 115, 2, 2, 2, 2, + 2, 2, 2, 115, 109, 116, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -657,110 +657,112 @@ static const yytype_uint16 yyprhs[] = 24, 27, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 59, 64, 69, 76, 83, 92, 101, 104, 117, 120, 122, 124, 126, 128, 130, - 132, 134, 136, 138, 140, 142, 144, 151, 155, 158, - 162, 165, 168, 176, 179, 181, 183, 185, 187, 192, - 194, 196, 198, 200, 202, 204, 206, 210, 211, 214, - 217, 219, 221, 223, 225, 227, 229, 231, 233, 235, - 236, 238, 240, 242, 244, 245, 247, 249, 251, 253, - 255, 257, 262, 265, 268, 270, 273, 275, 278, 280, - 283, 288, 293, 295, 296, 300, 302, 304, 307, 309, - 312, 314, 316, 320, 327, 328, 330, 333, 338, 340, - 344, 346, 348, 350, 352, 354, 356, 358, 360, 362, - 364, 367, 370, 373, 376, 379, 382, 385, 388, 391, - 394, 397, 400, 404, 406, 408, 410, 416, 418, 420, - 422, 425, 427, 429, 432, 434, 437, 444, 446, 450, - 452, 454, 456, 458, 460, 465, 467, 469, 471, 473, - 475, 477, 480, 482, 484, 490, 492, 495, 497, 499, - 505, 508, 509, 516, 520, 521, 523, 525, 527, 529, - 531, 534, 536, 538, 541, 546, 551, 552, 554, 556, - 558, 560, 563, 565, 567, 569, 571, 577, 579, 583, - 589, 595, 597, 601, 607, 609, 611, 613, 615, 617, - 619, 621, 623, 625, 629, 635, 643, 653, 656, 659, - 661, 663, 664, 665, 669, 670, 674, 678, 680, 685, - 688, 691, 694, 697, 701, 704, 708, 709, 711, 713, - 714, 716, 718, 719, 721, 723, 724, 726, 728, 729, - 733, 734, 738, 739, 743, 745, 747, 749 + 132, 134, 136, 138, 140, 142, 144, 151, 154, 159, + 162, 164, 168, 174, 177, 180, 188, 191, 193, 195, + 197, 199, 204, 206, 208, 210, 212, 214, 216, 218, + 222, 223, 226, 229, 231, 233, 235, 237, 239, 241, + 243, 245, 247, 248, 250, 252, 254, 256, 257, 259, + 261, 263, 265, 267, 269, 274, 277, 280, 282, 285, + 287, 290, 292, 295, 300, 305, 307, 308, 312, 314, + 316, 319, 321, 324, 326, 328, 332, 339, 340, 342, + 345, 350, 352, 356, 358, 360, 362, 364, 366, 368, + 370, 372, 374, 376, 379, 382, 385, 388, 391, 394, + 397, 400, 403, 406, 409, 412, 416, 418, 420, 422, + 428, 430, 432, 434, 437, 439, 441, 444, 446, 449, + 456, 458, 462, 464, 466, 468, 470, 472, 477, 479, + 481, 483, 485, 487, 489, 492, 494, 496, 502, 504, + 507, 509, 511, 517, 520, 521, 528, 532, 533, 535, + 537, 539, 541, 543, 546, 548, 550, 553, 558, 563, + 564, 566, 568, 570, 572, 575, 577, 579, 581, 583, + 589, 591, 595, 601, 607, 609, 613, 619, 621, 623, + 625, 627, 629, 631, 633, 635, 637, 641, 647, 655, + 665, 668, 671, 673, 675, 676, 677, 681, 682, 686, + 690, 692, 697, 700, 703, 706, 709, 713, 716, 720, + 721, 723, 725, 726, 728, 730, 731, 733, 735, 736, + 738, 740, 741, 745, 746, 750, 751, 755, 757, 759, + 761 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { - 117, 0, -1, 118, 119, 121, 12, -1, 3, -1, - 4, -1, 119, 120, -1, -1, 8, 99, 107, -1, - 121, 122, -1, -1, 123, 107, -1, 160, 107, -1, - 124, -1, 125, -1, 126, -1, 127, -1, 128, -1, - 129, -1, 130, -1, 131, -1, 137, -1, 132, -1, - 133, -1, 134, -1, 19, 141, 108, 138, -1, 18, - 140, 108, 139, -1, 16, 140, 108, 138, -1, 14, - 140, 108, 138, 108, 138, -1, 13, 140, 108, 139, - 108, 139, -1, 17, 140, 108, 139, 108, 139, 108, - 139, -1, 15, 140, 108, 139, 108, 135, 108, 136, - -1, 20, 139, -1, 22, 140, 108, 139, 108, 139, - 108, 139, 108, 135, 108, 136, -1, 83, 245, -1, + 118, 0, -1, 119, 120, 122, 12, -1, 3, -1, + 4, -1, 120, 121, -1, -1, 8, 99, 107, -1, + 122, 123, -1, -1, 124, 107, -1, 162, 107, -1, + 125, -1, 126, -1, 127, -1, 128, -1, 129, -1, + 130, -1, 131, -1, 132, -1, 138, -1, 133, -1, + 134, -1, 135, -1, 19, 143, 108, 139, -1, 18, + 142, 108, 141, -1, 16, 142, 108, 139, -1, 14, + 142, 108, 139, 108, 139, -1, 13, 142, 108, 141, + 108, 141, -1, 17, 142, 108, 141, 108, 141, 108, + 141, -1, 15, 142, 108, 141, 108, 136, 108, 137, + -1, 20, 141, -1, 22, 142, 108, 141, 108, 141, + 108, 141, 108, 136, 108, 137, -1, 83, 247, -1, 84, -1, 85, -1, 86, -1, 87, -1, 88, -1, 89, -1, 90, -1, 91, -1, 92, -1, 93, -1, - 94, -1, 95, -1, 21, 140, 108, 145, 108, 142, - -1, 231, 145, 157, -1, 231, 228, -1, 231, 145, - 158, -1, 146, 159, -1, 154, 156, -1, 143, 108, - 143, 108, 143, 108, 143, -1, 231, 144, -1, 23, - -1, 99, -1, 99, -1, 162, -1, 147, 109, 148, - 110, -1, 176, -1, 238, -1, 99, -1, 99, -1, - 149, -1, 150, -1, 23, -1, 154, 155, 151, -1, - -1, 111, 152, -1, 112, 153, -1, 23, -1, 23, - -1, 99, -1, 103, -1, 103, -1, 103, -1, 103, - -1, 100, -1, 104, -1, -1, 100, -1, 101, -1, - 102, -1, 103, -1, -1, 161, -1, 168, -1, 232, - -1, 234, -1, 237, -1, 250, -1, 7, 99, 113, - 162, -1, 96, 163, -1, 38, 167, -1, 60, -1, - 98, 165, -1, 53, -1, 29, 243, -1, 37, -1, - 74, 244, -1, 50, 109, 166, 110, -1, 97, 109, - 164, 110, -1, 23, -1, -1, 109, 166, 110, -1, - 23, -1, 60, -1, 29, 243, -1, 37, -1, 74, - 244, -1, 169, -1, 170, -1, 10, 99, 172, -1, - 10, 99, 109, 171, 110, 173, -1, -1, 23, -1, - 113, 175, -1, 113, 114, 174, 115, -1, 177, -1, - 174, 108, 177, -1, 179, -1, 215, -1, 225, -1, - 179, -1, 215, -1, 226, -1, 178, -1, 216, -1, - 225, -1, 179, -1, 73, 203, -1, 73, 180, -1, - 73, 182, -1, 73, 185, -1, 73, 187, -1, 73, - 193, -1, 73, 189, -1, 73, 196, -1, 73, 198, - -1, 73, 200, -1, 73, 202, -1, 73, 214, -1, - 47, 242, 181, -1, 191, -1, 33, -1, 69, -1, - 43, 109, 192, 110, 183, -1, 191, -1, 60, -1, - 26, -1, 72, 184, -1, 40, -1, 32, -1, 44, - 186, -1, 25, -1, 242, 67, -1, 45, 109, 192, - 110, 242, 188, -1, 191, -1, 75, 246, 190, -1, - 29, -1, 25, -1, 31, -1, 71, -1, 23, -1, - 76, 244, 194, 195, -1, 35, -1, 54, -1, 79, - -1, 80, -1, 78, -1, 77, -1, 36, 197, -1, - 29, -1, 56, -1, 28, 109, 199, 110, 57, -1, - 23, -1, 58, 201, -1, 70, -1, 26, -1, 205, - 66, 109, 208, 110, -1, 205, 204, -1, -1, 66, - 109, 208, 105, 208, 110, -1, 49, 209, 206, -1, - -1, 207, -1, 41, -1, 82, -1, 42, -1, 23, - -1, 51, 210, -1, 63, -1, 52, -1, 81, 244, - -1, 55, 109, 212, 110, -1, 48, 109, 213, 110, - -1, -1, 211, -1, 23, -1, 23, -1, 23, -1, - 30, 64, -1, 219, -1, 222, -1, 217, -1, 220, - -1, 62, 34, 109, 218, 110, -1, 223, -1, 223, - 105, 223, -1, 62, 34, 109, 223, 110, -1, 62, - 46, 109, 221, 110, -1, 224, -1, 224, 105, 224, - -1, 62, 46, 109, 224, 110, -1, 23, -1, 23, - -1, 227, -1, 229, -1, 228, -1, 229, -1, 230, - -1, 24, -1, 23, -1, 114, 230, 115, -1, 114, - 230, 108, 230, 115, -1, 114, 230, 108, 230, 108, - 230, 115, -1, 114, 230, 108, 230, 108, 230, 108, - 230, 115, -1, 231, 24, -1, 231, 23, -1, 111, - -1, 112, -1, -1, -1, 11, 233, 236, -1, -1, - 5, 235, 236, -1, 236, 108, 99, -1, 99, -1, - 9, 99, 113, 238, -1, 65, 60, -1, 65, 37, - -1, 65, 239, -1, 65, 59, -1, 65, 74, 244, - -1, 65, 30, -1, 29, 240, 241, -1, -1, 39, - -1, 27, -1, -1, 61, -1, 68, -1, -1, 39, - -1, 27, -1, -1, 61, -1, 68, -1, -1, 109, - 247, 110, -1, -1, 109, 248, 110, -1, -1, 109, - 249, 110, -1, 23, -1, 23, -1, 23, -1, 6, - 99, 113, 99, -1 + 94, -1, 95, -1, 21, 142, 108, 147, 108, 144, + -1, 233, 140, -1, 233, 109, 140, 109, -1, 147, + 159, -1, 230, -1, 233, 147, 160, -1, 233, 109, + 147, 160, 109, -1, 148, 161, -1, 156, 158, -1, + 145, 108, 145, 108, 145, 108, 145, -1, 233, 146, + -1, 23, -1, 99, -1, 99, -1, 164, -1, 149, + 110, 150, 111, -1, 178, -1, 240, -1, 99, -1, + 99, -1, 151, -1, 152, -1, 23, -1, 156, 157, + 153, -1, -1, 112, 154, -1, 113, 155, -1, 23, + -1, 23, -1, 99, -1, 103, -1, 103, -1, 103, + -1, 103, -1, 100, -1, 104, -1, -1, 100, -1, + 101, -1, 102, -1, 103, -1, -1, 163, -1, 170, + -1, 234, -1, 236, -1, 239, -1, 252, -1, 7, + 99, 114, 164, -1, 96, 165, -1, 38, 169, -1, + 60, -1, 98, 167, -1, 53, -1, 29, 245, -1, + 37, -1, 74, 246, -1, 50, 110, 168, 111, -1, + 97, 110, 166, 111, -1, 23, -1, -1, 110, 168, + 111, -1, 23, -1, 60, -1, 29, 245, -1, 37, + -1, 74, 246, -1, 171, -1, 172, -1, 10, 99, + 174, -1, 10, 99, 110, 173, 111, 175, -1, -1, + 23, -1, 114, 177, -1, 114, 115, 176, 116, -1, + 179, -1, 176, 108, 179, -1, 181, -1, 217, -1, + 227, -1, 181, -1, 217, -1, 228, -1, 180, -1, + 218, -1, 227, -1, 181, -1, 73, 205, -1, 73, + 182, -1, 73, 184, -1, 73, 187, -1, 73, 189, + -1, 73, 195, -1, 73, 191, -1, 73, 198, -1, + 73, 200, -1, 73, 202, -1, 73, 204, -1, 73, + 216, -1, 47, 244, 183, -1, 193, -1, 33, -1, + 69, -1, 43, 110, 194, 111, 185, -1, 193, -1, + 60, -1, 26, -1, 72, 186, -1, 40, -1, 32, + -1, 44, 188, -1, 25, -1, 244, 67, -1, 45, + 110, 194, 111, 244, 190, -1, 193, -1, 75, 248, + 192, -1, 29, -1, 25, -1, 31, -1, 71, -1, + 23, -1, 76, 246, 196, 197, -1, 35, -1, 54, + -1, 79, -1, 80, -1, 78, -1, 77, -1, 36, + 199, -1, 29, -1, 56, -1, 28, 110, 201, 111, + 57, -1, 23, -1, 58, 203, -1, 70, -1, 26, + -1, 207, 66, 110, 210, 111, -1, 207, 206, -1, + -1, 66, 110, 210, 105, 210, 111, -1, 49, 211, + 208, -1, -1, 209, -1, 41, -1, 82, -1, 42, + -1, 23, -1, 51, 212, -1, 63, -1, 52, -1, + 81, 246, -1, 55, 110, 214, 111, -1, 48, 110, + 215, 111, -1, -1, 213, -1, 23, -1, 23, -1, + 23, -1, 30, 64, -1, 221, -1, 224, -1, 219, + -1, 222, -1, 62, 34, 110, 220, 111, -1, 225, + -1, 225, 105, 225, -1, 62, 34, 110, 225, 111, + -1, 62, 46, 110, 223, 111, -1, 226, -1, 226, + 105, 226, -1, 62, 46, 110, 226, 111, -1, 23, + -1, 23, -1, 229, -1, 231, -1, 230, -1, 231, + -1, 232, -1, 24, -1, 23, -1, 115, 232, 116, + -1, 115, 232, 108, 232, 116, -1, 115, 232, 108, + 232, 108, 232, 116, -1, 115, 232, 108, 232, 108, + 232, 108, 232, 116, -1, 233, 24, -1, 233, 23, + -1, 112, -1, 113, -1, -1, -1, 11, 235, 238, + -1, -1, 5, 237, 238, -1, 238, 108, 99, -1, + 99, -1, 9, 99, 114, 240, -1, 65, 60, -1, + 65, 37, -1, 65, 241, -1, 65, 59, -1, 65, + 74, 246, -1, 65, 30, -1, 29, 242, 243, -1, + -1, 39, -1, 27, -1, -1, 61, -1, 68, -1, + -1, 39, -1, 27, -1, -1, 61, -1, 68, -1, + -1, 110, 249, 111, -1, -1, 110, 250, 111, -1, + -1, 110, 251, 111, -1, 23, -1, 23, -1, 23, + -1, 6, 99, 114, 99, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -770,29 +772,30 @@ static const yytype_uint16 yyrline[] = 309, 324, 327, 332, 339, 340, 341, 342, 343, 344, 345, 348, 349, 350, 353, 359, 366, 373, 381, 388, 396, 441, 448, 493, 499, 500, 501, 502, 503, 504, - 505, 506, 507, 508, 509, 510, 513, 526, 537, 556, - 569, 591, 600, 633, 640, 655, 705, 747, 758, 779, - 789, 795, 826, 843, 843, 845, 852, 864, 865, 866, - 869, 881, 893, 911, 922, 934, 936, 937, 938, 939, - 942, 942, 942, 942, 943, 946, 947, 948, 949, 950, - 951, 954, 972, 976, 982, 986, 990, 994, 1003, 1012, - 1016, 1021, 1027, 1038, 1038, 1039, 1041, 1045, 1049, 1053, - 1059, 1059, 1061, 1077, 1100, 1103, 1114, 1120, 1126, 1127, - 1134, 1140, 1146, 1154, 1160, 1166, 1174, 1180, 1186, 1194, - 1195, 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, 1206, - 1207, 1208, 1211, 1220, 1224, 1228, 1234, 1243, 1247, 1251, - 1260, 1264, 1270, 1276, 1283, 1288, 1296, 1306, 1308, 1316, - 1322, 1326, 1330, 1336, 1347, 1356, 1360, 1365, 1369, 1373, - 1377, 1383, 1390, 1394, 1400, 1408, 1419, 1426, 1430, 1436, - 1446, 1457, 1461, 1479, 1488, 1491, 1497, 1501, 1505, 1511, - 1522, 1527, 1532, 1537, 1542, 1547, 1555, 1558, 1563, 1576, - 1584, 1595, 1603, 1603, 1605, 1605, 1607, 1617, 1622, 1629, - 1639, 1648, 1653, 1660, 1670, 1680, 1692, 1692, 1693, 1693, - 1695, 1705, 1713, 1723, 1731, 1739, 1748, 1759, 1763, 1769, - 1770, 1771, 1774, 1774, 1777, 1777, 1780, 1786, 1794, 1807, - 1816, 1825, 1829, 1838, 1847, 1858, 1865, 1870, 1879, 1891, - 1894, 1903, 1914, 1915, 1916, 1919, 1920, 1921, 1924, 1925, - 1928, 1929, 1932, 1933, 1936, 1947, 1958, 1969 + 505, 506, 507, 508, 509, 510, 513, 526, 534, 551, + 558, 577, 588, 608, 630, 639, 672, 679, 694, 744, + 786, 797, 818, 828, 834, 865, 882, 882, 884, 891, + 903, 904, 905, 908, 920, 932, 950, 961, 973, 975, + 976, 977, 978, 981, 981, 981, 981, 982, 985, 986, + 987, 988, 989, 990, 993, 1011, 1015, 1021, 1025, 1029, + 1033, 1042, 1051, 1055, 1060, 1066, 1077, 1077, 1078, 1080, + 1084, 1088, 1092, 1098, 1098, 1100, 1116, 1139, 1142, 1153, + 1159, 1165, 1166, 1173, 1179, 1185, 1193, 1199, 1205, 1213, + 1219, 1225, 1233, 1234, 1237, 1238, 1239, 1240, 1241, 1242, + 1243, 1244, 1245, 1246, 1247, 1250, 1259, 1263, 1267, 1273, + 1282, 1286, 1290, 1299, 1303, 1309, 1315, 1322, 1327, 1335, + 1345, 1347, 1355, 1361, 1365, 1369, 1375, 1386, 1395, 1399, + 1404, 1408, 1412, 1416, 1422, 1429, 1433, 1439, 1447, 1458, + 1465, 1469, 1475, 1485, 1496, 1500, 1518, 1527, 1530, 1536, + 1540, 1544, 1550, 1561, 1566, 1571, 1576, 1581, 1586, 1594, + 1597, 1602, 1615, 1623, 1634, 1642, 1642, 1644, 1644, 1646, + 1656, 1661, 1668, 1678, 1687, 1692, 1699, 1709, 1719, 1731, + 1731, 1732, 1732, 1734, 1744, 1752, 1762, 1770, 1778, 1787, + 1798, 1802, 1808, 1809, 1810, 1813, 1813, 1816, 1816, 1819, + 1825, 1833, 1846, 1855, 1864, 1868, 1877, 1886, 1897, 1904, + 1909, 1918, 1930, 1933, 1942, 1953, 1954, 1955, 1958, 1959, + 1960, 1963, 1964, 1967, 1968, 1971, 1972, 1975, 1986, 1997, + 2008 }; #endif @@ -818,45 +821,45 @@ static const char *const yytname[] = "TEX_SHADOW2D", "TEX_SHADOWRECT", "TEX_ARRAY1D", "TEX_ARRAY2D", "TEX_ARRAYSHADOW1D", "TEX_ARRAYSHADOW2D", "VERTEX", "VTXATTRIB", "WEIGHT", "IDENTIFIER", "MASK4", "MASK3", "MASK2", "MASK1", "SWIZZLE", - "DOT_DOT", "DOT", "';'", "','", "'['", "']'", "'+'", "'-'", "'='", "'{'", - "'}'", "$accept", "program", "language", "optionSequence", "option", - "statementSequence", "statement", "instruction", "ALU_instruction", - "TexInstruction", "ARL_instruction", "VECTORop_instruction", - "SCALARop_instruction", "BINSCop_instruction", "BINop_instruction", - "TRIop_instruction", "SAMPLE_instruction", "KIL_instruction", - "TXD_instruction", "texImageUnit", "texTarget", "SWZ_instruction", - "scalarSrcReg", "swizzleSrcReg", "maskedDstReg", "maskedAddrReg", - "extendedSwizzle", "extSwizComp", "extSwizSel", "srcReg", "dstReg", - "progParamArray", "progParamArrayMem", "progParamArrayAbs", - "progParamArrayRel", "addrRegRelOffset", "addrRegPosOffset", - "addrRegNegOffset", "addrReg", "addrComponent", "addrWriteMask", - "scalarSuffix", "swizzleSuffix", "optionalMask", "namingStatement", - "ATTRIB_statement", "attribBinding", "vtxAttribItem", "vtxAttribNum", - "vtxOptWeightNum", "vtxWeightNum", "fragAttribItem", "PARAM_statement", - "PARAM_singleStmt", "PARAM_multipleStmt", "optArraySize", - "paramSingleInit", "paramMultipleInit", "paramMultInitList", - "paramSingleItemDecl", "paramSingleItemUse", "paramMultipleItem", - "stateMultipleItem", "stateSingleItem", "stateMaterialItem", - "stateMatProperty", "stateLightItem", "stateLightProperty", - "stateSpotProperty", "stateLightModelItem", "stateLModProperty", - "stateLightProdItem", "stateLProdProperty", "stateTexEnvItem", - "stateTexEnvProperty", "ambDiffSpecProperty", "stateLightNumber", - "stateTexGenItem", "stateTexGenType", "stateTexGenCoord", "stateFogItem", - "stateFogProperty", "stateClipPlaneItem", "stateClipPlaneNum", - "statePointItem", "statePointProperty", "stateMatrixRow", - "stateMatrixRows", "optMatrixRows", "stateMatrixItem", - "stateOptMatModifier", "stateMatModifier", "stateMatrixRowNum", - "stateMatrixName", "stateOptModMatNum", "stateModMatNum", - "statePaletteMatNum", "stateProgramMatNum", "stateDepthItem", - "programSingleItem", "programMultipleItem", "progEnvParams", - "progEnvParamNums", "progEnvParam", "progLocalParams", - "progLocalParamNums", "progLocalParam", "progEnvParamNum", - "progLocalParamNum", "paramConstDecl", "paramConstUse", - "paramConstScalarDecl", "paramConstScalarUse", "paramConstVector", - "signedFloatConstant", "optionalSign", "TEMP_statement", "@1", - "ADDRESS_statement", "@2", "varNameList", "OUTPUT_statement", - "resultBinding", "resultColBinding", "optResultFaceType", - "optResultColorType", "optFaceType", "optColorType", + "DOT_DOT", "DOT", "';'", "','", "'|'", "'['", "']'", "'+'", "'-'", "'='", + "'{'", "'}'", "$accept", "program", "language", "optionSequence", + "option", "statementSequence", "statement", "instruction", + "ALU_instruction", "TexInstruction", "ARL_instruction", + "VECTORop_instruction", "SCALARop_instruction", "BINSCop_instruction", + "BINop_instruction", "TRIop_instruction", "SAMPLE_instruction", + "KIL_instruction", "TXD_instruction", "texImageUnit", "texTarget", + "SWZ_instruction", "scalarSrcReg", "scalarUse", "swizzleSrcReg", + "maskedDstReg", "maskedAddrReg", "extendedSwizzle", "extSwizComp", + "extSwizSel", "srcReg", "dstReg", "progParamArray", "progParamArrayMem", + "progParamArrayAbs", "progParamArrayRel", "addrRegRelOffset", + "addrRegPosOffset", "addrRegNegOffset", "addrReg", "addrComponent", + "addrWriteMask", "scalarSuffix", "swizzleSuffix", "optionalMask", + "namingStatement", "ATTRIB_statement", "attribBinding", "vtxAttribItem", + "vtxAttribNum", "vtxOptWeightNum", "vtxWeightNum", "fragAttribItem", + "PARAM_statement", "PARAM_singleStmt", "PARAM_multipleStmt", + "optArraySize", "paramSingleInit", "paramMultipleInit", + "paramMultInitList", "paramSingleItemDecl", "paramSingleItemUse", + "paramMultipleItem", "stateMultipleItem", "stateSingleItem", + "stateMaterialItem", "stateMatProperty", "stateLightItem", + "stateLightProperty", "stateSpotProperty", "stateLightModelItem", + "stateLModProperty", "stateLightProdItem", "stateLProdProperty", + "stateTexEnvItem", "stateTexEnvProperty", "ambDiffSpecProperty", + "stateLightNumber", "stateTexGenItem", "stateTexGenType", + "stateTexGenCoord", "stateFogItem", "stateFogProperty", + "stateClipPlaneItem", "stateClipPlaneNum", "statePointItem", + "statePointProperty", "stateMatrixRow", "stateMatrixRows", + "optMatrixRows", "stateMatrixItem", "stateOptMatModifier", + "stateMatModifier", "stateMatrixRowNum", "stateMatrixName", + "stateOptModMatNum", "stateModMatNum", "statePaletteMatNum", + "stateProgramMatNum", "stateDepthItem", "programSingleItem", + "programMultipleItem", "progEnvParams", "progEnvParamNums", + "progEnvParam", "progLocalParams", "progLocalParamNums", + "progLocalParam", "progEnvParamNum", "progLocalParamNum", + "paramConstDecl", "paramConstUse", "paramConstScalarDecl", + "paramConstScalarUse", "paramConstVector", "signedFloatConstant", + "optionalSign", "TEMP_statement", "@1", "ADDRESS_statement", "@2", + "varNameList", "OUTPUT_statement", "resultBinding", "resultColBinding", + "optResultFaceType", "optResultColorType", "optFaceType", "optColorType", "optTexCoordUnitNum", "optTexImageUnitNum", "optLegacyTexUnitNum", "texCoordUnitNum", "texImageUnitNum", "legacyTexUnitNum", "ALIAS_statement", 0 @@ -878,41 +881,42 @@ static const yytype_uint16 yytoknum[] = 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 361, 59, 44, 91, - 93, 43, 45, 61, 123, 125 + 355, 356, 357, 358, 359, 360, 361, 59, 44, 124, + 91, 93, 43, 45, 61, 123, 125 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 116, 117, 118, 118, 119, 119, 120, 121, 121, - 122, 122, 123, 123, 124, 124, 124, 124, 124, 124, - 124, 125, 125, 125, 126, 127, 128, 129, 130, 131, - 132, 133, 134, 135, 136, 136, 136, 136, 136, 136, - 136, 136, 136, 136, 136, 136, 137, 138, 138, 139, - 140, 141, 142, 143, 144, 144, 145, 145, 145, 145, - 146, 146, 147, 148, 148, 149, 150, 151, 151, 151, - 152, 153, 154, 155, 156, 157, 158, 158, 158, 158, - 159, 159, 159, 159, 159, 160, 160, 160, 160, 160, - 160, 161, 162, 162, 163, 163, 163, 163, 163, 163, - 163, 163, 164, 165, 165, 166, 167, 167, 167, 167, - 168, 168, 169, 170, 171, 171, 172, 173, 174, 174, - 175, 175, 175, 176, 176, 176, 177, 177, 177, 178, - 178, 179, 179, 179, 179, 179, 179, 179, 179, 179, - 179, 179, 180, 181, 181, 181, 182, 183, 183, 183, - 183, 183, 184, 185, 186, 186, 187, 188, 189, 190, - 191, 191, 191, 192, 193, 194, 194, 195, 195, 195, - 195, 196, 197, 197, 198, 199, 200, 201, 201, 202, - 203, 204, 204, 205, 206, 206, 207, 207, 207, 208, - 209, 209, 209, 209, 209, 209, 210, 210, 211, 212, - 213, 214, 215, 215, 216, 216, 217, 218, 218, 219, - 220, 221, 221, 222, 223, 224, 225, 225, 226, 226, - 227, 228, 228, 229, 229, 229, 229, 230, 230, 231, - 231, 231, 233, 232, 235, 234, 236, 236, 237, 238, - 238, 238, 238, 238, 238, 239, 240, 240, 240, 241, - 241, 241, 242, 242, 242, 243, 243, 243, 244, 244, - 245, 245, 246, 246, 247, 248, 249, 250 + 0, 117, 118, 119, 119, 120, 120, 121, 122, 122, + 123, 123, 124, 124, 125, 125, 125, 125, 125, 125, + 125, 126, 126, 126, 127, 128, 129, 130, 131, 132, + 133, 134, 135, 136, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 138, 139, 139, 140, + 140, 141, 141, 142, 143, 144, 145, 146, 146, 147, + 147, 147, 147, 148, 148, 149, 150, 150, 151, 152, + 153, 153, 153, 154, 155, 156, 157, 158, 159, 160, + 160, 160, 160, 161, 161, 161, 161, 161, 162, 162, + 162, 162, 162, 162, 163, 164, 164, 165, 165, 165, + 165, 165, 165, 165, 165, 166, 167, 167, 168, 169, + 169, 169, 169, 170, 170, 171, 172, 173, 173, 174, + 175, 176, 176, 177, 177, 177, 178, 178, 178, 179, + 179, 179, 180, 180, 181, 181, 181, 181, 181, 181, + 181, 181, 181, 181, 181, 182, 183, 183, 183, 184, + 185, 185, 185, 185, 185, 186, 187, 188, 188, 189, + 190, 191, 192, 193, 193, 193, 194, 195, 196, 196, + 197, 197, 197, 197, 198, 199, 199, 200, 201, 202, + 203, 203, 204, 205, 206, 206, 207, 208, 208, 209, + 209, 209, 210, 211, 211, 211, 211, 211, 211, 212, + 212, 213, 214, 215, 216, 217, 217, 218, 218, 219, + 220, 220, 221, 222, 223, 223, 224, 225, 226, 227, + 227, 228, 228, 229, 230, 230, 231, 231, 231, 231, + 232, 232, 233, 233, 233, 235, 234, 237, 236, 238, + 238, 239, 240, 240, 240, 240, 240, 240, 241, 242, + 242, 242, 243, 243, 243, 244, 244, 244, 245, 245, + 245, 246, 246, 247, 247, 248, 248, 249, 250, 251, + 252 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -922,29 +926,30 @@ static const yytype_uint8 yyr2[] = 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 6, 6, 8, 8, 2, 12, 2, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 6, 3, 2, 3, - 2, 2, 7, 2, 1, 1, 1, 1, 4, 1, - 1, 1, 1, 1, 1, 1, 3, 0, 2, 2, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, - 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, - 1, 4, 2, 2, 1, 2, 1, 2, 1, 2, - 4, 4, 1, 0, 3, 1, 1, 2, 1, 2, - 1, 1, 3, 6, 0, 1, 2, 4, 1, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 3, 1, 1, 1, 5, 1, 1, 1, - 2, 1, 1, 2, 1, 2, 6, 1, 3, 1, - 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, - 1, 2, 1, 1, 5, 1, 2, 1, 1, 5, - 2, 0, 6, 3, 0, 1, 1, 1, 1, 1, - 2, 1, 1, 2, 4, 4, 0, 1, 1, 1, - 1, 2, 1, 1, 1, 1, 5, 1, 3, 5, - 5, 1, 3, 5, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 3, 5, 7, 9, 2, 2, 1, - 1, 0, 0, 3, 0, 3, 3, 1, 4, 2, - 2, 2, 2, 3, 2, 3, 0, 1, 1, 0, - 1, 1, 0, 1, 1, 0, 1, 1, 0, 3, - 0, 3, 0, 3, 1, 1, 1, 4 + 1, 1, 1, 1, 1, 1, 6, 2, 4, 2, + 1, 3, 5, 2, 2, 7, 2, 1, 1, 1, + 1, 4, 1, 1, 1, 1, 1, 1, 1, 3, + 0, 2, 2, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, + 1, 1, 1, 1, 4, 2, 2, 1, 2, 1, + 2, 1, 2, 4, 4, 1, 0, 3, 1, 1, + 2, 1, 2, 1, 1, 3, 6, 0, 1, 2, + 4, 1, 3, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 3, 1, 1, 1, 5, + 1, 1, 1, 2, 1, 1, 2, 1, 2, 6, + 1, 3, 1, 1, 1, 1, 1, 4, 1, 1, + 1, 1, 1, 1, 2, 1, 1, 5, 1, 2, + 1, 1, 5, 2, 0, 6, 3, 0, 1, 1, + 1, 1, 1, 2, 1, 1, 2, 4, 4, 0, + 1, 1, 1, 1, 2, 1, 1, 1, 1, 5, + 1, 3, 5, 5, 1, 3, 5, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 3, 5, 7, 9, + 2, 2, 1, 1, 0, 0, 3, 0, 3, 3, + 1, 4, 2, 2, 2, 2, 3, 2, 3, 0, + 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, + 1, 0, 3, 0, 3, 0, 3, 1, 1, 1, + 4 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -953,276 +958,283 @@ static const yytype_uint8 yyr2[] = static const yytype_uint16 yydefact[] = { 0, 3, 4, 0, 6, 1, 9, 0, 5, 0, - 0, 234, 0, 0, 0, 0, 232, 2, 0, 0, - 0, 0, 0, 0, 0, 231, 0, 0, 8, 0, + 0, 237, 0, 0, 0, 0, 235, 2, 0, 0, + 0, 0, 0, 0, 0, 234, 0, 0, 8, 0, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, - 23, 20, 0, 85, 86, 110, 111, 87, 88, 89, - 90, 7, 0, 0, 0, 0, 0, 0, 0, 61, - 0, 84, 60, 0, 0, 0, 0, 0, 72, 0, - 0, 229, 230, 31, 0, 0, 0, 10, 11, 237, - 235, 0, 0, 0, 114, 231, 112, 233, 246, 244, - 240, 242, 239, 258, 241, 231, 80, 81, 82, 83, - 50, 231, 231, 231, 231, 231, 231, 74, 51, 222, - 221, 0, 0, 0, 0, 56, 231, 79, 0, 57, - 59, 123, 124, 202, 203, 125, 218, 219, 0, 231, - 0, 267, 91, 238, 115, 0, 116, 120, 121, 122, - 216, 217, 220, 0, 248, 247, 249, 0, 243, 0, - 0, 0, 0, 26, 0, 25, 24, 255, 108, 106, - 258, 93, 0, 0, 0, 0, 0, 0, 252, 0, - 252, 0, 0, 262, 258, 131, 132, 133, 134, 136, - 135, 137, 138, 139, 140, 0, 141, 255, 98, 0, - 96, 94, 258, 0, 103, 92, 0, 77, 76, 78, - 49, 0, 0, 0, 236, 0, 228, 227, 250, 251, - 245, 264, 0, 231, 231, 0, 48, 0, 231, 256, - 257, 107, 109, 0, 0, 0, 201, 172, 173, 171, - 0, 154, 254, 253, 153, 0, 0, 0, 0, 196, - 192, 0, 191, 258, 184, 178, 177, 176, 0, 0, - 0, 0, 97, 0, 99, 0, 0, 95, 231, 223, - 65, 0, 63, 64, 0, 231, 231, 0, 113, 259, - 28, 27, 75, 47, 260, 0, 0, 214, 0, 215, - 0, 175, 0, 163, 0, 155, 0, 160, 161, 144, - 145, 162, 142, 143, 0, 198, 190, 197, 0, 193, - 186, 188, 187, 183, 185, 266, 0, 159, 158, 165, - 166, 0, 0, 105, 0, 102, 0, 0, 0, 58, - 73, 67, 46, 0, 0, 0, 231, 0, 33, 0, - 231, 209, 213, 0, 0, 252, 200, 0, 199, 0, - 263, 170, 169, 167, 168, 164, 189, 0, 100, 101, - 104, 231, 224, 0, 0, 66, 231, 54, 55, 53, - 231, 0, 0, 0, 118, 126, 129, 127, 204, 205, - 128, 265, 0, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 30, 29, 174, 149, 151, - 148, 0, 146, 147, 0, 195, 194, 179, 0, 70, - 68, 71, 69, 0, 0, 0, 0, 130, 181, 231, - 117, 261, 152, 150, 156, 157, 231, 225, 231, 0, - 0, 0, 0, 180, 119, 0, 0, 0, 0, 207, - 0, 211, 0, 226, 231, 0, 206, 0, 210, 0, - 0, 52, 32, 208, 212, 0, 0, 182 + 23, 20, 0, 88, 89, 113, 114, 90, 91, 92, + 93, 7, 0, 0, 0, 0, 0, 0, 0, 64, + 0, 87, 63, 0, 0, 0, 0, 0, 75, 0, + 0, 232, 233, 31, 0, 0, 0, 10, 11, 240, + 238, 0, 0, 0, 117, 234, 115, 236, 249, 247, + 243, 245, 242, 261, 244, 234, 83, 84, 85, 86, + 53, 234, 234, 234, 234, 234, 234, 77, 54, 225, + 224, 0, 0, 0, 0, 59, 0, 234, 82, 0, + 60, 62, 126, 127, 205, 206, 128, 221, 222, 0, + 234, 0, 270, 94, 241, 118, 0, 119, 123, 124, + 125, 219, 220, 223, 0, 251, 250, 252, 0, 246, + 0, 0, 0, 0, 26, 0, 25, 24, 258, 111, + 109, 261, 96, 0, 0, 0, 0, 0, 0, 255, + 0, 255, 0, 0, 265, 261, 134, 135, 136, 137, + 139, 138, 140, 141, 142, 143, 0, 144, 258, 101, + 0, 99, 97, 261, 0, 106, 95, 82, 0, 80, + 79, 81, 51, 0, 0, 0, 239, 0, 231, 230, + 253, 254, 248, 267, 0, 234, 234, 0, 47, 0, + 50, 0, 234, 259, 260, 110, 112, 0, 0, 0, + 204, 175, 176, 174, 0, 157, 257, 256, 156, 0, + 0, 0, 0, 199, 195, 0, 194, 261, 187, 181, + 180, 179, 0, 0, 0, 0, 100, 0, 102, 0, + 0, 98, 0, 234, 226, 68, 0, 66, 67, 0, + 234, 234, 0, 116, 262, 28, 27, 0, 78, 49, + 263, 0, 0, 217, 0, 218, 0, 178, 0, 166, + 0, 158, 0, 163, 164, 147, 148, 165, 145, 146, + 0, 201, 193, 200, 0, 196, 189, 191, 190, 186, + 188, 269, 0, 162, 161, 168, 169, 0, 0, 108, + 0, 105, 0, 0, 52, 0, 61, 76, 70, 46, + 0, 0, 0, 234, 48, 0, 33, 0, 234, 212, + 216, 0, 0, 255, 203, 0, 202, 0, 266, 173, + 172, 170, 171, 167, 192, 0, 103, 104, 107, 234, + 227, 0, 0, 69, 234, 57, 58, 56, 234, 0, + 0, 0, 121, 129, 132, 130, 207, 208, 131, 268, + 0, 34, 35, 36, 37, 38, 39, 40, 41, 42, + 43, 44, 45, 30, 29, 177, 152, 154, 151, 0, + 149, 150, 0, 198, 197, 182, 0, 73, 71, 74, + 72, 0, 0, 0, 0, 133, 184, 234, 120, 264, + 155, 153, 159, 160, 234, 228, 234, 0, 0, 0, + 0, 183, 122, 0, 0, 0, 0, 210, 0, 214, + 0, 229, 234, 0, 209, 0, 213, 0, 0, 55, + 32, 211, 215, 0, 0, 185 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 3, 4, 6, 8, 9, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 275, - 385, 41, 150, 73, 60, 69, 322, 323, 359, 117, - 61, 118, 261, 262, 263, 355, 400, 402, 70, 321, - 108, 273, 200, 100, 42, 43, 119, 195, 316, 257, - 314, 161, 44, 45, 46, 135, 86, 268, 363, 136, - 120, 364, 365, 121, 175, 292, 176, 392, 413, 177, - 234, 178, 414, 179, 308, 293, 284, 180, 311, 345, - 181, 229, 182, 282, 183, 247, 184, 407, 423, 185, - 303, 304, 347, 244, 296, 297, 339, 337, 186, 122, - 367, 368, 428, 123, 369, 430, 124, 278, 280, 370, - 125, 140, 126, 127, 142, 74, 47, 57, 48, 52, - 80, 49, 62, 94, 146, 210, 235, 221, 148, 328, - 249, 212, 372, 306, 50 + 32, 33, 34, 35, 36, 37, 38, 39, 40, 281, + 393, 41, 151, 218, 73, 60, 69, 329, 330, 367, + 219, 61, 119, 266, 267, 268, 363, 408, 410, 70, + 328, 108, 279, 202, 100, 42, 43, 120, 196, 322, + 261, 320, 162, 44, 45, 46, 136, 86, 273, 371, + 137, 121, 372, 373, 122, 176, 298, 177, 400, 421, + 178, 238, 179, 422, 180, 314, 299, 290, 181, 317, + 353, 182, 233, 183, 288, 184, 251, 185, 415, 431, + 186, 309, 310, 355, 248, 302, 303, 347, 345, 187, + 123, 375, 376, 436, 124, 377, 438, 125, 284, 286, + 378, 126, 141, 127, 128, 143, 74, 47, 57, 48, + 52, 80, 49, 62, 94, 147, 212, 239, 225, 149, + 336, 253, 214, 380, 312, 50 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -399 +#define YYPACT_NINF -403 static const yytype_int16 yypact[] = { - 154, -399, -399, 48, -399, -399, 51, -37, -399, 172, - -2, -399, 17, 31, 42, 47, -399, -399, -33, -33, - -33, -33, -33, -33, 54, 56, -33, -33, -399, 6, - -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, - -399, -399, 52, -399, -399, -399, -399, -399, -399, -399, - -399, -399, 66, 25, 61, 112, -6, 66, 102, -399, - 118, 116, -399, 119, 120, 121, 122, 123, -399, 124, - 130, -399, -399, -399, -16, 126, 127, -399, -399, -399, - 128, 70, -15, 159, 214, -36, -399, 128, 28, -399, - -399, -399, -399, 131, -399, 56, -399, -399, -399, -399, - -399, 56, 56, 56, 56, 56, 56, -399, -399, -399, - -399, 27, 38, 76, -9, 135, 56, 60, 136, -399, - -399, -399, -399, -399, -399, -399, -399, -399, -16, 56, - 147, -399, -399, -399, -399, 137, -399, -399, -399, -399, - -399, -399, -399, 148, -399, -399, 18, 225, -399, 141, - 142, -16, 144, -399, 145, -399, -399, 50, -399, -399, - 131, -399, 146, 149, 150, 187, 7, 151, 43, 152, - 69, 85, -1, 153, 131, -399, -399, -399, -399, -399, - -399, -399, -399, -399, -399, 190, -399, 50, -399, 155, - -399, -399, 131, 156, 158, -399, 20, -399, -399, -399, - -399, -8, 160, 162, -399, 161, -399, -399, -399, -399, - -399, -399, 163, 56, 56, 169, 173, 171, 56, -399, - -399, -399, -399, 234, 240, 252, -399, -399, -399, -399, - 254, -399, -399, -399, -399, 211, 254, 2, 170, 257, - -399, 174, -399, 131, 12, -399, -399, -399, 258, 253, - -5, 175, -399, 262, -399, 263, 262, -399, 56, -399, - -399, 177, -399, -399, 185, 56, 56, 176, -399, -399, - -399, -399, -399, -399, 180, 183, 184, -399, 186, -399, - 189, -399, 191, -399, 192, -399, 194, -399, -399, -399, - -399, -399, -399, -399, 270, -399, -399, -399, 271, -399, - -399, -399, -399, -399, -399, -399, 195, -399, -399, -399, - -399, 143, 272, -399, 196, -399, 197, 198, 34, -399, - -399, 101, -399, 201, -4, 202, -12, 274, -399, 111, - 56, -399, -399, 241, 84, 69, -399, 203, -399, 204, - -399, -399, -399, -399, -399, -399, -399, 205, -399, -399, - -399, 56, -399, 277, 288, -399, 56, -399, -399, -399, - 56, 80, 76, 35, -399, -399, -399, -399, -399, -399, - -399, -399, 206, -399, -399, -399, -399, -399, -399, -399, - -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, - -399, 280, -399, -399, 14, -399, -399, -399, 39, -399, - -399, -399, -399, 209, 210, 212, 213, -399, 261, -12, - -399, -399, -399, -399, -399, -399, 56, -399, 56, 171, - 234, 240, 219, -399, -399, 208, 221, 222, 224, 215, - 226, 227, 272, -399, 56, 111, -399, 234, -399, 240, - -13, -399, -399, -399, -399, 272, 228, -399 + 62, -403, -403, 41, -403, -403, 81, -36, -403, 198, + -8, -403, -5, 18, 20, 35, -403, -403, -23, -23, + -23, -23, -23, -23, 45, 131, -23, -23, -403, 58, + -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, + -403, -403, 67, -403, -403, -403, -403, -403, -403, -403, + -403, -403, 63, 86, 92, 128, 84, 63, 99, -403, + 69, 133, -403, 87, 89, 129, 145, 146, -403, 147, + 154, -403, -403, -403, -13, 150, 151, -403, -403, -403, + 152, 162, -14, 197, 240, -34, -403, 152, 98, -403, + -403, -403, -403, 155, -403, 131, -403, -403, -403, -403, + -403, 131, 131, 131, 131, 131, 131, -403, -403, -403, + -403, 72, 105, 77, 17, 156, 12, 131, 68, 157, + -403, -403, -403, -403, -403, -403, -403, -403, -403, 12, + 131, 165, -403, -403, -403, -403, 158, -403, -403, -403, + -403, -403, -403, -403, 223, -403, -403, -16, 245, -403, + 163, 164, -9, 167, -403, 168, -403, -403, 55, -403, + -403, 155, -403, 170, 171, 172, 206, 2, 173, 34, + 174, 127, 112, 1, 175, 155, -403, -403, -403, -403, + -403, -403, -403, -403, -403, -403, 207, -403, 55, -403, + 177, -403, -403, 155, 178, 179, -403, 68, 22, -403, + -403, -403, -403, -6, 169, 182, -403, 180, -403, -403, + -403, -403, -403, -403, 181, 131, 131, 12, -403, 188, + 190, 195, 131, -403, -403, -403, -403, 272, 273, 274, + -403, -403, -403, -403, 275, -403, -403, -403, -403, 232, + 275, 79, 191, 277, -403, 192, -403, 155, 15, -403, + -403, -403, 280, 276, 8, 194, -403, 283, -403, 284, + 283, -403, 199, 131, -403, -403, 200, -403, -403, 209, + 131, 131, 201, -403, -403, -403, -403, 204, -403, -403, + 205, 210, 211, -403, 203, -403, 212, -403, 213, -403, + 214, -403, 215, -403, -403, -403, -403, -403, -403, -403, + 286, -403, -403, -403, 294, -403, -403, -403, -403, -403, + -403, -403, 216, -403, -403, -403, -403, 161, 297, -403, + 217, -403, 218, 219, -403, 76, -403, -403, 139, -403, + 227, -4, 228, 30, -403, 298, -403, 137, 131, -403, + -403, 265, 130, 127, -403, 220, -403, 226, -403, -403, + -403, -403, -403, -403, -403, 229, -403, -403, -403, 131, + -403, 315, 319, -403, 131, -403, -403, -403, 131, 123, + 77, 80, -403, -403, -403, -403, -403, -403, -403, -403, + 233, -403, -403, -403, -403, -403, -403, -403, -403, -403, + -403, -403, -403, -403, -403, -403, -403, -403, -403, 311, + -403, -403, 9, -403, -403, -403, 83, -403, -403, -403, + -403, 237, 238, 239, 241, -403, 281, 30, -403, -403, + -403, -403, -403, -403, 131, -403, 131, 195, 272, 273, + 242, -403, -403, 234, 246, 247, 248, 243, 249, 251, + 297, -403, 131, 137, -403, 272, -403, 273, 36, -403, + -403, -403, -403, 297, 250, -403 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -399, -399, -399, -399, -399, -399, -399, -399, -399, -399, - -399, -399, -399, -399, -399, -399, -399, -399, -399, -100, - -98, -399, -97, -91, 188, -399, -399, -344, -399, -99, - -399, -399, -399, -399, -399, -399, -399, -399, 134, -399, - -399, -399, -399, -399, -399, -399, 259, -399, -399, -399, - 83, -399, -399, -399, -399, -399, -399, -399, -399, -399, - -399, -69, -399, -84, -399, -399, -399, -399, -399, -399, - -399, -399, -399, -399, -399, -317, 106, -399, -399, -399, - -399, -399, -399, -399, -399, -399, -399, -399, -399, -19, - -399, -399, -398, -399, -399, -399, -399, -399, -399, 260, - -399, -399, -399, -399, -399, -399, -399, -377, -381, 265, - -399, -399, 193, -83, -113, -85, -399, -399, -399, -399, - 289, -399, 264, -399, -399, -399, -165, 164, -150, -399, - -399, -399, -399, -399, -399 + -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, + -403, -403, -403, -403, -403, -403, -403, -403, -403, -74, + -81, -403, -98, 141, -82, 160, -403, -403, -358, -403, + -41, -403, -403, -403, -403, -403, -403, -403, -403, 166, + -403, -403, -403, 176, -403, -403, -403, 282, -403, -403, + -403, 103, -403, -403, -403, -403, -403, -403, -403, -403, + -403, -403, -52, -403, -84, -403, -403, -403, -403, -403, + -403, -403, -403, -403, -403, -403, -333, 126, -403, -403, + -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, + -3, -403, -403, -402, -403, -403, -403, -403, -403, -403, + 285, -403, -403, -403, -403, -403, -403, -403, -398, -392, + 287, -403, -403, -145, -83, -114, -85, -403, -403, -403, + -403, 314, -403, 291, -403, -403, -403, -167, 187, -149, + -403, -403, -403, -403, -403, -403 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -219 +#define YYTABLE_NINF -222 static const yytype_int16 yytable[] = { - 143, 137, 141, 196, 149, 237, 153, 109, 110, 156, - 222, 152, 403, 154, 155, 260, 151, 393, 151, 357, - 187, 151, 111, 111, 250, 245, 112, 287, 188, 202, - 309, 143, 58, 288, 440, 289, 227, 113, 203, 287, - 431, 189, 254, 429, 190, 288, 112, 446, 5, 310, - 361, 191, 215, 300, 301, 144, 157, 113, 444, 7, - 443, 362, 10, 228, 158, 192, 59, 145, 231, 246, - 232, 290, 162, 291, 426, 71, 72, 415, 116, 208, - 114, 114, 233, 115, 163, 291, 209, 159, 193, 194, - 441, 68, 445, 299, 302, 358, 232, 397, 116, 71, - 72, 160, 116, 84, 164, 51, 165, 85, 233, 287, - 388, 219, 166, 77, 405, 288, 53, 271, 220, 167, - 168, 169, 270, 170, 389, 171, 406, 276, 258, 151, - 54, 88, 89, 238, 172, 259, 239, 240, 81, 90, - 241, 55, 351, 409, 390, 318, 56, 416, 242, 352, - 410, 173, 174, 68, 417, 291, 391, 1, 2, 78, - 197, 91, 92, 198, 199, 79, 243, 71, 72, 131, - 394, 206, 207, 143, 82, 325, 93, 11, 12, 13, - 324, 14, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 373, 374, 375, 376, 377, - 378, 379, 380, 381, 382, 383, 384, 63, 64, 65, - 66, 67, 353, 354, 75, 76, 96, 97, 98, 99, - 341, 342, 343, 344, 58, 83, 95, 101, 102, 103, - 104, 105, 106, 107, 128, 129, 130, 134, 398, 386, - 147, 143, 366, 141, -62, 201, 204, 205, 211, 213, - 214, 226, 217, 218, 274, 223, 251, 277, 224, 225, - 230, 236, 248, 279, 253, 255, 143, 256, 265, 404, - 266, 324, 272, 269, 267, 281, -218, 283, 285, 294, - 295, 305, 307, 298, 312, 313, 315, 319, 320, 327, - 326, 329, 330, 336, 338, 346, 331, 371, 387, 332, - 399, 333, 334, 425, 335, 340, 348, 349, 350, 356, - 360, 401, 412, 395, 396, 397, 411, 418, 419, 427, - 437, 420, 421, 433, 143, 366, 141, 422, 432, 434, - 435, 143, 439, 324, 436, 264, 438, 442, 447, 317, - 424, 132, 286, 408, 216, 138, 87, 133, 0, 324, - 139, 252 + 144, 138, 142, 198, 241, 154, 411, 220, 157, 401, + 109, 110, 226, 150, 109, 110, 152, 265, 152, 365, + 153, 152, 155, 156, 111, 111, 254, 249, 112, 111, + 437, 231, 144, 118, 293, 109, 110, 439, 448, 113, + 294, 5, 58, 315, 258, 210, 188, 451, 205, 112, + 111, 454, 211, 112, 189, 452, 306, 307, 232, 235, + 113, 236, 316, 10, 113, 1, 2, 190, 434, 423, + 191, 250, 220, 237, 112, 197, 59, 192, 71, 72, + 297, 117, 114, 114, 449, 113, 115, 114, 204, 7, + 115, 193, 369, 68, 53, 366, 116, 308, 305, 51, + 217, 158, 117, 370, 293, 165, 117, 166, 114, 159, + 294, 115, 295, 167, 194, 195, 223, 54, 276, 55, + 168, 169, 170, 224, 171, 145, 172, 117, 88, 89, + 263, 152, 160, 275, 56, 173, 90, 146, 264, 163, + 282, 453, 71, 72, 68, 117, 161, 405, 296, 325, + 297, 164, 174, 175, 236, 293, 396, 413, 91, 92, + 242, 294, 79, 243, 244, 77, 237, 245, 199, 414, + 397, 200, 201, 93, 78, 246, 402, 95, 144, 63, + 64, 65, 66, 67, 359, 331, 75, 76, 417, 332, + 398, 424, 360, 247, 84, 101, 418, 102, 85, 425, + 81, 297, 399, 11, 12, 13, 82, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, + 27, 381, 382, 383, 384, 385, 386, 387, 388, 389, + 390, 391, 392, 96, 97, 98, 99, 103, 349, 350, + 351, 352, 83, 71, 72, 406, 208, 209, 144, 374, + 142, 361, 362, 104, 105, 106, 394, 107, 129, 130, + 131, 132, 58, 135, 206, 148, -65, 203, 213, 207, + 230, 215, 216, 255, 144, 221, 222, 270, 280, 331, + 227, 228, 229, 234, 240, 252, 412, 257, 259, 260, + 271, 278, 274, -221, 272, 283, 285, 287, 289, 291, + 301, 300, 304, 311, 318, 313, 319, 321, 324, 344, + 433, 326, 327, 334, 339, 335, 333, 346, 337, 338, + 354, 379, 395, 340, 341, 342, 343, 348, 356, 357, + 358, 403, 144, 374, 142, 364, 368, 404, 407, 144, + 405, 331, 409, 420, 419, 426, 427, 430, 445, 428, + 441, 429, 440, 435, 442, 443, 447, 331, 277, 444, + 446, 455, 450, 323, 133, 432, 292, 416, 0, 269, + 139, 87, 140, 262, 134, 256 }; static const yytype_int16 yycheck[] = { - 85, 85, 85, 116, 95, 170, 103, 23, 24, 106, - 160, 102, 356, 104, 105, 23, 101, 334, 103, 23, - 29, 106, 38, 38, 174, 26, 62, 25, 37, 128, - 35, 116, 65, 31, 432, 33, 29, 73, 129, 25, - 421, 50, 192, 420, 53, 31, 62, 445, 0, 54, - 62, 60, 151, 41, 42, 27, 29, 73, 439, 8, - 437, 73, 99, 56, 37, 74, 99, 39, 25, 70, - 27, 69, 34, 71, 418, 111, 112, 394, 114, 61, - 96, 96, 39, 99, 46, 71, 68, 60, 97, 98, - 434, 99, 105, 243, 82, 99, 27, 110, 114, 111, - 112, 74, 114, 109, 28, 107, 30, 113, 39, 25, - 26, 61, 36, 107, 34, 31, 99, 214, 68, 43, - 44, 45, 213, 47, 40, 49, 46, 218, 108, 214, - 99, 29, 30, 48, 58, 115, 51, 52, 113, 37, - 55, 99, 108, 108, 60, 258, 99, 108, 63, 115, - 115, 75, 76, 99, 115, 71, 72, 3, 4, 107, - 100, 59, 60, 103, 104, 99, 81, 111, 112, 99, - 335, 23, 24, 258, 113, 266, 74, 5, 6, 7, - 265, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 19, 20, 21, - 22, 23, 111, 112, 26, 27, 100, 101, 102, 103, - 77, 78, 79, 80, 65, 113, 108, 108, 108, 108, - 108, 108, 108, 103, 108, 108, 108, 23, 351, 330, - 109, 326, 326, 326, 109, 109, 99, 110, 23, 108, - 108, 64, 108, 108, 83, 109, 66, 23, 109, 109, - 109, 109, 109, 23, 109, 109, 351, 109, 108, 360, - 108, 356, 103, 110, 113, 23, 103, 23, 67, 109, - 23, 23, 29, 109, 109, 23, 23, 110, 103, 109, - 114, 108, 108, 23, 23, 23, 110, 23, 57, 110, - 23, 110, 110, 416, 110, 110, 110, 110, 110, 108, - 108, 23, 32, 110, 110, 110, 110, 108, 108, 419, - 105, 109, 109, 115, 409, 409, 409, 66, 109, 108, - 108, 416, 105, 418, 110, 201, 110, 435, 110, 256, - 409, 82, 236, 362, 151, 85, 57, 83, -1, 434, - 85, 187 + 85, 85, 85, 117, 171, 103, 364, 152, 106, 342, + 23, 24, 161, 95, 23, 24, 101, 23, 103, 23, + 102, 106, 104, 105, 38, 38, 175, 26, 62, 38, + 428, 29, 117, 74, 25, 23, 24, 429, 440, 73, + 31, 0, 65, 35, 193, 61, 29, 445, 130, 62, + 38, 453, 68, 62, 37, 447, 41, 42, 56, 25, + 73, 27, 54, 99, 73, 3, 4, 50, 426, 402, + 53, 70, 217, 39, 62, 116, 99, 60, 112, 113, + 71, 115, 96, 96, 442, 73, 99, 96, 129, 8, + 99, 74, 62, 99, 99, 99, 109, 82, 247, 107, + 109, 29, 115, 73, 25, 28, 115, 30, 96, 37, + 31, 99, 33, 36, 97, 98, 61, 99, 216, 99, + 43, 44, 45, 68, 47, 27, 49, 115, 29, 30, + 108, 216, 60, 215, 99, 58, 37, 39, 116, 34, + 222, 105, 112, 113, 99, 115, 74, 111, 69, 263, + 71, 46, 75, 76, 27, 25, 26, 34, 59, 60, + 48, 31, 99, 51, 52, 107, 39, 55, 100, 46, + 40, 103, 104, 74, 107, 63, 343, 108, 263, 19, + 20, 21, 22, 23, 108, 270, 26, 27, 108, 271, + 60, 108, 116, 81, 110, 108, 116, 108, 114, 116, + 114, 71, 72, 5, 6, 7, 114, 9, 10, 11, + 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, + 22, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 100, 101, 102, 103, 108, 77, 78, + 79, 80, 114, 112, 113, 359, 23, 24, 333, 333, + 333, 112, 113, 108, 108, 108, 338, 103, 108, 108, + 108, 99, 65, 23, 99, 110, 110, 110, 23, 111, + 64, 108, 108, 66, 359, 108, 108, 108, 83, 364, + 110, 110, 110, 110, 110, 110, 368, 110, 110, 110, + 108, 103, 111, 103, 114, 23, 23, 23, 23, 67, + 23, 110, 110, 23, 110, 29, 23, 23, 109, 23, + 424, 111, 103, 109, 111, 110, 115, 23, 108, 108, + 23, 23, 57, 111, 111, 111, 111, 111, 111, 111, + 111, 111, 417, 417, 417, 108, 108, 111, 23, 424, + 111, 426, 23, 32, 111, 108, 108, 66, 105, 110, + 116, 110, 110, 427, 108, 108, 105, 442, 217, 111, + 111, 111, 443, 260, 82, 417, 240, 370, -1, 203, + 85, 57, 85, 197, 83, 188 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 3, 4, 117, 118, 0, 119, 8, 120, 121, + 0, 3, 4, 118, 119, 0, 120, 8, 121, 122, 99, 5, 6, 7, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 122, 123, - 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, - 134, 137, 160, 161, 168, 169, 170, 232, 234, 237, - 250, 107, 235, 99, 99, 99, 99, 233, 65, 99, - 140, 146, 238, 140, 140, 140, 140, 140, 99, 141, - 154, 111, 112, 139, 231, 140, 140, 107, 107, 99, - 236, 113, 113, 113, 109, 113, 172, 236, 29, 30, - 37, 59, 60, 74, 239, 108, 100, 101, 102, 103, - 159, 108, 108, 108, 108, 108, 108, 103, 156, 23, - 24, 38, 62, 73, 96, 99, 114, 145, 147, 162, - 176, 179, 215, 219, 222, 226, 228, 229, 108, 108, - 108, 99, 162, 238, 23, 171, 175, 179, 215, 225, - 227, 229, 230, 231, 27, 39, 240, 109, 244, 139, - 138, 231, 139, 138, 139, 139, 138, 29, 37, 60, - 74, 167, 34, 46, 28, 30, 36, 43, 44, 45, - 47, 49, 58, 75, 76, 180, 182, 185, 187, 189, - 193, 196, 198, 200, 202, 205, 214, 29, 37, 50, - 53, 60, 74, 97, 98, 163, 230, 100, 103, 104, - 158, 109, 145, 139, 99, 110, 23, 24, 61, 68, - 241, 23, 247, 108, 108, 145, 228, 108, 108, 61, - 68, 243, 244, 109, 109, 109, 64, 29, 56, 197, - 109, 25, 27, 39, 186, 242, 109, 242, 48, 51, - 52, 55, 63, 81, 209, 26, 70, 201, 109, 246, - 244, 66, 243, 109, 244, 109, 109, 165, 108, 115, - 23, 148, 149, 150, 154, 108, 108, 113, 173, 110, - 139, 138, 103, 157, 83, 135, 139, 23, 223, 23, - 224, 23, 199, 23, 192, 67, 192, 25, 31, 33, - 69, 71, 181, 191, 109, 23, 210, 211, 109, 244, - 41, 42, 82, 206, 207, 23, 249, 29, 190, 35, - 54, 194, 109, 23, 166, 23, 164, 166, 230, 110, - 103, 155, 142, 143, 231, 139, 114, 109, 245, 108, - 108, 110, 110, 110, 110, 110, 23, 213, 23, 212, - 110, 77, 78, 79, 80, 195, 23, 208, 110, 110, - 110, 108, 115, 111, 112, 151, 108, 23, 99, 144, - 108, 62, 73, 174, 177, 178, 179, 216, 217, 220, - 225, 23, 248, 84, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 136, 139, 57, 26, 40, - 60, 72, 183, 191, 242, 110, 110, 110, 230, 23, - 152, 23, 153, 143, 139, 34, 46, 203, 205, 108, - 115, 110, 32, 184, 188, 191, 108, 115, 108, 108, - 109, 109, 66, 204, 177, 230, 143, 135, 218, 223, - 221, 224, 109, 115, 108, 108, 110, 105, 110, 105, - 208, 143, 136, 223, 224, 105, 208, 110 + 15, 16, 17, 18, 19, 20, 21, 22, 123, 124, + 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, + 135, 138, 162, 163, 170, 171, 172, 234, 236, 239, + 252, 107, 237, 99, 99, 99, 99, 235, 65, 99, + 142, 148, 240, 142, 142, 142, 142, 142, 99, 143, + 156, 112, 113, 141, 233, 142, 142, 107, 107, 99, + 238, 114, 114, 114, 110, 114, 174, 238, 29, 30, + 37, 59, 60, 74, 241, 108, 100, 101, 102, 103, + 161, 108, 108, 108, 108, 108, 108, 103, 158, 23, + 24, 38, 62, 73, 96, 99, 109, 115, 147, 149, + 164, 178, 181, 217, 221, 224, 228, 230, 231, 108, + 108, 108, 99, 164, 240, 23, 173, 177, 181, 217, + 227, 229, 231, 232, 233, 27, 39, 242, 110, 246, + 141, 139, 233, 141, 139, 141, 141, 139, 29, 37, + 60, 74, 169, 34, 46, 28, 30, 36, 43, 44, + 45, 47, 49, 58, 75, 76, 182, 184, 187, 189, + 191, 195, 198, 200, 202, 204, 207, 216, 29, 37, + 50, 53, 60, 74, 97, 98, 165, 147, 232, 100, + 103, 104, 160, 110, 147, 141, 99, 111, 23, 24, + 61, 68, 243, 23, 249, 108, 108, 109, 140, 147, + 230, 108, 108, 61, 68, 245, 246, 110, 110, 110, + 64, 29, 56, 199, 110, 25, 27, 39, 188, 244, + 110, 244, 48, 51, 52, 55, 63, 81, 211, 26, + 70, 203, 110, 248, 246, 66, 245, 110, 246, 110, + 110, 167, 160, 108, 116, 23, 150, 151, 152, 156, + 108, 108, 114, 175, 111, 141, 139, 140, 103, 159, + 83, 136, 141, 23, 225, 23, 226, 23, 201, 23, + 194, 67, 194, 25, 31, 33, 69, 71, 183, 193, + 110, 23, 212, 213, 110, 246, 41, 42, 82, 208, + 209, 23, 251, 29, 192, 35, 54, 196, 110, 23, + 168, 23, 166, 168, 109, 232, 111, 103, 157, 144, + 145, 233, 141, 115, 109, 110, 247, 108, 108, 111, + 111, 111, 111, 111, 23, 215, 23, 214, 111, 77, + 78, 79, 80, 197, 23, 210, 111, 111, 111, 108, + 116, 112, 113, 153, 108, 23, 99, 146, 108, 62, + 73, 176, 179, 180, 181, 218, 219, 222, 227, 23, + 250, 84, 85, 86, 87, 88, 89, 90, 91, 92, + 93, 94, 95, 137, 141, 57, 26, 40, 60, 72, + 185, 193, 244, 111, 111, 111, 232, 23, 154, 23, + 155, 145, 141, 34, 46, 205, 207, 108, 116, 111, + 32, 186, 190, 193, 108, 116, 108, 108, 110, 110, + 66, 206, 179, 232, 145, 136, 220, 225, 223, 226, + 110, 116, 108, 108, 111, 105, 111, 105, 210, 145, + 137, 225, 226, 105, 210, 111 }; #define yyerrok (yyerrstatus = 0) @@ -2445,32 +2457,61 @@ yyreduce: /* Line 1455 of yacc.c */ #line 527 "program_parse.y" { - (yyval.src_reg) = (yyvsp[(2) - (3)].src_reg); + (yyval.src_reg) = (yyvsp[(2) - (2)].src_reg); - if ((yyvsp[(1) - (3)].negate)) { + if ((yyvsp[(1) - (2)].negate)) { + (yyval.src_reg).Base.Negate = ~(yyval.src_reg).Base.Negate; + } + ;} + break; + + case 48: + +/* Line 1455 of yacc.c */ +#line 535 "program_parse.y" + { + (yyval.src_reg) = (yyvsp[(3) - (4)].src_reg); + + if (!state->option.NV_fragment) { + yyerror(& (yylsp[(2) - (4)]), state, "unexpected character '|'"); + YYERROR; + } + + if ((yyvsp[(1) - (4)].negate)) { (yyval.src_reg).Base.Negate = ~(yyval.src_reg).Base.Negate; } + (yyval.src_reg).Base.Abs = 1; + ;} + break; + + case 49: + +/* Line 1455 of yacc.c */ +#line 552 "program_parse.y" + { + (yyval.src_reg) = (yyvsp[(1) - (2)].src_reg); + (yyval.src_reg).Base.Swizzle = _mesa_combine_swizzles((yyval.src_reg).Base.Swizzle, - (yyvsp[(3) - (3)].swiz_mask).swizzle); + (yyvsp[(2) - (2)].swiz_mask).swizzle); ;} break; - case 48: + case 50: /* Line 1455 of yacc.c */ -#line 538 "program_parse.y" +#line 559 "program_parse.y" { struct asm_symbol temp_sym; if (!state->option.NV_fragment) { - yyerror(& (yylsp[(2) - (2)]), state, "expected scalar suffix"); + yyerror(& (yylsp[(1) - (1)]), state, "expected scalar suffix"); YYERROR; } memset(& temp_sym, 0, sizeof(temp_sym)); temp_sym.param_binding_begin = ~0; - initialize_symbol_from_const(state->prog, & temp_sym, & (yyvsp[(2) - (2)].vector)); + initialize_symbol_from_const(state->prog, & temp_sym, & (yyvsp[(1) - (1)].vector)); init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.File = PROGRAM_CONSTANT; @@ -2478,10 +2519,10 @@ yyreduce: ;} break; - case 49: + case 51: /* Line 1455 of yacc.c */ -#line 557 "program_parse.y" +#line 578 "program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (3)].src_reg); @@ -2494,10 +2535,32 @@ yyreduce: ;} break; - case 50: + case 52: + +/* Line 1455 of yacc.c */ +#line 589 "program_parse.y" + { + (yyval.src_reg) = (yyvsp[(3) - (5)].src_reg); + + if (!state->option.NV_fragment) { + yyerror(& (yylsp[(2) - (5)]), state, "unexpected character '|'"); + YYERROR; + } + + if ((yyvsp[(1) - (5)].negate)) { + (yyval.src_reg).Base.Negate = ~(yyval.src_reg).Base.Negate; + } + + (yyval.src_reg).Base.Abs = 1; + (yyval.src_reg).Base.Swizzle = _mesa_combine_swizzles((yyval.src_reg).Base.Swizzle, + (yyvsp[(4) - (5)].swiz_mask).swizzle); + ;} + break; + + case 53: /* Line 1455 of yacc.c */ -#line 570 "program_parse.y" +#line 609 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); (yyval.dst_reg).WriteMask = (yyvsp[(2) - (2)].swiz_mask).mask; @@ -2519,10 +2582,10 @@ yyreduce: ;} break; - case 51: + case 54: /* Line 1455 of yacc.c */ -#line 592 "program_parse.y" +#line 631 "program_parse.y" { init_dst_reg(& (yyval.dst_reg)); (yyval.dst_reg).File = PROGRAM_ADDRESS; @@ -2531,10 +2594,10 @@ yyreduce: ;} break; - case 52: + case 55: /* Line 1455 of yacc.c */ -#line 601 "program_parse.y" +#line 640 "program_parse.y" { const unsigned xyzw_valid = ((yyvsp[(1) - (7)].ext_swizzle).xyzw_valid << 0) @@ -2567,20 +2630,20 @@ yyreduce: ;} break; - case 53: + case 56: /* Line 1455 of yacc.c */ -#line 634 "program_parse.y" +#line 673 "program_parse.y" { (yyval.ext_swizzle) = (yyvsp[(2) - (2)].ext_swizzle); (yyval.ext_swizzle).negate = ((yyvsp[(1) - (2)].negate)) ? 1 : 0; ;} break; - case 54: + case 57: /* Line 1455 of yacc.c */ -#line 641 "program_parse.y" +#line 680 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) != 0) && ((yyvsp[(1) - (1)].integer) != 1)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector"); @@ -2597,10 +2660,10 @@ yyreduce: ;} break; - case 55: + case 58: /* Line 1455 of yacc.c */ -#line 656 "program_parse.y" +#line 695 "program_parse.y" { if (strlen((yyvsp[(1) - (1)].string)) > 1) { yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector"); @@ -2650,10 +2713,10 @@ yyreduce: ;} break; - case 56: + case 59: /* Line 1455 of yacc.c */ -#line 706 "program_parse.y" +#line 745 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2697,10 +2760,10 @@ yyreduce: ;} break; - case 57: + case 60: /* Line 1455 of yacc.c */ -#line 748 "program_parse.y" +#line 787 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.File = PROGRAM_INPUT; @@ -2713,10 +2776,10 @@ yyreduce: ;} break; - case 58: + case 61: /* Line 1455 of yacc.c */ -#line 759 "program_parse.y" +#line 798 "program_parse.y" { if (! (yyvsp[(3) - (4)].src_reg).Base.RelAddr && ((unsigned) (yyvsp[(3) - (4)].src_reg).Base.Index >= (yyvsp[(1) - (4)].sym)->param_binding_length)) { @@ -2739,10 +2802,10 @@ yyreduce: ;} break; - case 59: + case 62: /* Line 1455 of yacc.c */ -#line 780 "program_parse.y" +#line 819 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.File = ((yyvsp[(1) - (1)].temp_sym).name != NULL) @@ -2752,10 +2815,10 @@ yyreduce: ;} break; - case 60: + case 63: /* Line 1455 of yacc.c */ -#line 790 "program_parse.y" +#line 829 "program_parse.y" { init_dst_reg(& (yyval.dst_reg)); (yyval.dst_reg).File = PROGRAM_OUTPUT; @@ -2763,10 +2826,10 @@ yyreduce: ;} break; - case 61: + case 64: /* Line 1455 of yacc.c */ -#line 796 "program_parse.y" +#line 835 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2797,10 +2860,10 @@ yyreduce: ;} break; - case 62: + case 65: /* Line 1455 of yacc.c */ -#line 827 "program_parse.y" +#line 866 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2817,20 +2880,20 @@ yyreduce: ;} break; - case 65: + case 68: /* Line 1455 of yacc.c */ -#line 846 "program_parse.y" +#line 885 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].integer); ;} break; - case 66: + case 69: /* Line 1455 of yacc.c */ -#line 853 "program_parse.y" +#line 892 "program_parse.y" { /* FINISHME: Add support for multiple address registers. */ @@ -2842,31 +2905,31 @@ yyreduce: ;} break; - case 67: + case 70: /* Line 1455 of yacc.c */ -#line 864 "program_parse.y" +#line 903 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 68: + case 71: /* Line 1455 of yacc.c */ -#line 865 "program_parse.y" +#line 904 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; - case 69: + case 72: /* Line 1455 of yacc.c */ -#line 866 "program_parse.y" +#line 905 "program_parse.y" { (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;} break; - case 70: + case 73: /* Line 1455 of yacc.c */ -#line 870 "program_parse.y" +#line 909 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 63)) { yyerror(& (yylsp[(1) - (1)]), state, @@ -2878,10 +2941,10 @@ yyreduce: ;} break; - case 71: + case 74: /* Line 1455 of yacc.c */ -#line 882 "program_parse.y" +#line 921 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 64)) { yyerror(& (yylsp[(1) - (1)]), state, @@ -2893,10 +2956,10 @@ yyreduce: ;} break; - case 72: + case 75: /* Line 1455 of yacc.c */ -#line 894 "program_parse.y" +#line 933 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2914,10 +2977,10 @@ yyreduce: ;} break; - case 73: + case 76: /* Line 1455 of yacc.c */ -#line 912 "program_parse.y" +#line 951 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, "invalid address component selector"); @@ -2928,10 +2991,10 @@ yyreduce: ;} break; - case 74: + case 77: /* Line 1455 of yacc.c */ -#line 923 "program_parse.y" +#line 962 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, @@ -2943,24 +3006,24 @@ yyreduce: ;} break; - case 79: + case 82: /* Line 1455 of yacc.c */ -#line 939 "program_parse.y" +#line 978 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; - case 84: + case 87: /* Line 1455 of yacc.c */ -#line 943 "program_parse.y" +#line 982 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; - case 91: + case 94: /* Line 1455 of yacc.c */ -#line 955 "program_parse.y" +#line 994 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (4)].string), at_attrib, & (yylsp[(2) - (4)])); @@ -2978,55 +3041,55 @@ yyreduce: ;} break; - case 92: + case 95: /* Line 1455 of yacc.c */ -#line 973 "program_parse.y" +#line 1012 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} break; - case 93: + case 96: /* Line 1455 of yacc.c */ -#line 977 "program_parse.y" +#line 1016 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} break; - case 94: + case 97: /* Line 1455 of yacc.c */ -#line 983 "program_parse.y" +#line 1022 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_POS; ;} break; - case 95: + case 98: /* Line 1455 of yacc.c */ -#line 987 "program_parse.y" +#line 1026 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_WEIGHT; ;} break; - case 96: + case 99: /* Line 1455 of yacc.c */ -#line 991 "program_parse.y" +#line 1030 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_NORMAL; ;} break; - case 97: + case 100: /* Line 1455 of yacc.c */ -#line 995 "program_parse.y" +#line 1034 "program_parse.y" { if (!state->ctx->Extensions.EXT_secondary_color) { yyerror(& (yylsp[(2) - (2)]), state, "GL_EXT_secondary_color not supported"); @@ -3037,10 +3100,10 @@ yyreduce: ;} break; - case 98: + case 101: /* Line 1455 of yacc.c */ -#line 1004 "program_parse.y" +#line 1043 "program_parse.y" { if (!state->ctx->Extensions.EXT_fog_coord) { yyerror(& (yylsp[(1) - (1)]), state, "GL_EXT_fog_coord not supported"); @@ -3051,38 +3114,38 @@ yyreduce: ;} break; - case 99: + case 102: /* Line 1455 of yacc.c */ -#line 1013 "program_parse.y" +#line 1052 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} break; - case 100: + case 103: /* Line 1455 of yacc.c */ -#line 1017 "program_parse.y" +#line 1056 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; ;} break; - case 101: + case 104: /* Line 1455 of yacc.c */ -#line 1022 "program_parse.y" +#line 1061 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_GENERIC0 + (yyvsp[(3) - (4)].integer); ;} break; - case 102: + case 105: /* Line 1455 of yacc.c */ -#line 1028 "program_parse.y" +#line 1067 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxAttribs) { yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex attribute reference"); @@ -3093,46 +3156,46 @@ yyreduce: ;} break; - case 106: + case 109: /* Line 1455 of yacc.c */ -#line 1042 "program_parse.y" +#line 1081 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_WPOS; ;} break; - case 107: + case 110: /* Line 1455 of yacc.c */ -#line 1046 "program_parse.y" +#line 1085 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_COL0 + (yyvsp[(2) - (2)].integer); ;} break; - case 108: + case 111: /* Line 1455 of yacc.c */ -#line 1050 "program_parse.y" +#line 1089 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_FOGC; ;} break; - case 109: + case 112: /* Line 1455 of yacc.c */ -#line 1054 "program_parse.y" +#line 1093 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} break; - case 112: + case 115: /* Line 1455 of yacc.c */ -#line 1062 "program_parse.y" +#line 1101 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (3)].string), at_param, & (yylsp[(2) - (3)])); @@ -3148,10 +3211,10 @@ yyreduce: ;} break; - case 113: + case 116: /* Line 1455 of yacc.c */ -#line 1078 "program_parse.y" +#line 1117 "program_parse.y" { if (((yyvsp[(4) - (6)].integer) != 0) && ((unsigned) (yyvsp[(4) - (6)].integer) != (yyvsp[(6) - (6)].temp_sym).param_binding_length)) { yyerror(& (yylsp[(4) - (6)]), state, @@ -3173,19 +3236,19 @@ yyreduce: ;} break; - case 114: + case 117: /* Line 1455 of yacc.c */ -#line 1100 "program_parse.y" +#line 1139 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 115: + case 118: /* Line 1455 of yacc.c */ -#line 1104 "program_parse.y" +#line 1143 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxParameters)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid parameter array size"); @@ -3196,38 +3259,38 @@ yyreduce: ;} break; - case 116: + case 119: /* Line 1455 of yacc.c */ -#line 1115 "program_parse.y" +#line 1154 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(2) - (2)].temp_sym); ;} break; - case 117: + case 120: /* Line 1455 of yacc.c */ -#line 1121 "program_parse.y" +#line 1160 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(3) - (4)].temp_sym); ;} break; - case 119: + case 122: /* Line 1455 of yacc.c */ -#line 1128 "program_parse.y" +#line 1167 "program_parse.y" { (yyvsp[(1) - (3)].temp_sym).param_binding_length += (yyvsp[(3) - (3)].temp_sym).param_binding_length; (yyval.temp_sym) = (yyvsp[(1) - (3)].temp_sym); ;} break; - case 120: + case 123: /* Line 1455 of yacc.c */ -#line 1135 "program_parse.y" +#line 1174 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3235,10 +3298,10 @@ yyreduce: ;} break; - case 121: + case 124: /* Line 1455 of yacc.c */ -#line 1141 "program_parse.y" +#line 1180 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3246,10 +3309,10 @@ yyreduce: ;} break; - case 122: + case 125: /* Line 1455 of yacc.c */ -#line 1147 "program_parse.y" +#line 1186 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3257,10 +3320,10 @@ yyreduce: ;} break; - case 123: + case 126: /* Line 1455 of yacc.c */ -#line 1155 "program_parse.y" +#line 1194 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3268,10 +3331,10 @@ yyreduce: ;} break; - case 124: + case 127: /* Line 1455 of yacc.c */ -#line 1161 "program_parse.y" +#line 1200 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3279,10 +3342,10 @@ yyreduce: ;} break; - case 125: + case 128: /* Line 1455 of yacc.c */ -#line 1167 "program_parse.y" +#line 1206 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3290,10 +3353,10 @@ yyreduce: ;} break; - case 126: + case 129: /* Line 1455 of yacc.c */ -#line 1175 "program_parse.y" +#line 1214 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3301,10 +3364,10 @@ yyreduce: ;} break; - case 127: + case 130: /* Line 1455 of yacc.c */ -#line 1181 "program_parse.y" +#line 1220 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3312,10 +3375,10 @@ yyreduce: ;} break; - case 128: + case 131: /* Line 1455 of yacc.c */ -#line 1187 "program_parse.y" +#line 1226 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3323,101 +3386,101 @@ yyreduce: ;} break; - case 129: + case 132: /* Line 1455 of yacc.c */ -#line 1194 "program_parse.y" +#line 1233 "program_parse.y" { memcpy((yyval.state), (yyvsp[(1) - (1)].state), sizeof((yyval.state))); ;} break; - case 130: + case 133: /* Line 1455 of yacc.c */ -#line 1195 "program_parse.y" +#line 1234 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 131: + case 134: /* Line 1455 of yacc.c */ -#line 1198 "program_parse.y" +#line 1237 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 132: + case 135: /* Line 1455 of yacc.c */ -#line 1199 "program_parse.y" +#line 1238 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 133: + case 136: /* Line 1455 of yacc.c */ -#line 1200 "program_parse.y" +#line 1239 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 134: + case 137: /* Line 1455 of yacc.c */ -#line 1201 "program_parse.y" +#line 1240 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 135: + case 138: /* Line 1455 of yacc.c */ -#line 1202 "program_parse.y" +#line 1241 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 136: + case 139: /* Line 1455 of yacc.c */ -#line 1203 "program_parse.y" +#line 1242 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 137: + case 140: /* Line 1455 of yacc.c */ -#line 1204 "program_parse.y" +#line 1243 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 138: + case 141: /* Line 1455 of yacc.c */ -#line 1205 "program_parse.y" +#line 1244 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 139: + case 142: /* Line 1455 of yacc.c */ -#line 1206 "program_parse.y" +#line 1245 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 140: + case 143: /* Line 1455 of yacc.c */ -#line 1207 "program_parse.y" +#line 1246 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 141: + case 144: /* Line 1455 of yacc.c */ -#line 1208 "program_parse.y" +#line 1247 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 142: + case 145: /* Line 1455 of yacc.c */ -#line 1212 "program_parse.y" +#line 1251 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_MATERIAL; @@ -3426,37 +3489,37 @@ yyreduce: ;} break; - case 143: + case 146: /* Line 1455 of yacc.c */ -#line 1221 "program_parse.y" +#line 1260 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 144: + case 147: /* Line 1455 of yacc.c */ -#line 1225 "program_parse.y" +#line 1264 "program_parse.y" { (yyval.integer) = STATE_EMISSION; ;} break; - case 145: + case 148: /* Line 1455 of yacc.c */ -#line 1229 "program_parse.y" +#line 1268 "program_parse.y" { (yyval.integer) = STATE_SHININESS; ;} break; - case 146: + case 149: /* Line 1455 of yacc.c */ -#line 1235 "program_parse.y" +#line 1274 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHT; @@ -3465,28 +3528,28 @@ yyreduce: ;} break; - case 147: + case 150: /* Line 1455 of yacc.c */ -#line 1244 "program_parse.y" +#line 1283 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 148: + case 151: /* Line 1455 of yacc.c */ -#line 1248 "program_parse.y" +#line 1287 "program_parse.y" { (yyval.integer) = STATE_POSITION; ;} break; - case 149: + case 152: /* Line 1455 of yacc.c */ -#line 1252 "program_parse.y" +#line 1291 "program_parse.y" { if (!state->ctx->Extensions.EXT_point_parameters) { yyerror(& (yylsp[(1) - (1)]), state, "GL_ARB_point_parameters not supported"); @@ -3497,57 +3560,57 @@ yyreduce: ;} break; - case 150: + case 153: /* Line 1455 of yacc.c */ -#line 1261 "program_parse.y" +#line 1300 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; - case 151: + case 154: /* Line 1455 of yacc.c */ -#line 1265 "program_parse.y" +#line 1304 "program_parse.y" { (yyval.integer) = STATE_HALF_VECTOR; ;} break; - case 152: + case 155: /* Line 1455 of yacc.c */ -#line 1271 "program_parse.y" +#line 1310 "program_parse.y" { (yyval.integer) = STATE_SPOT_DIRECTION; ;} break; - case 153: + case 156: /* Line 1455 of yacc.c */ -#line 1277 "program_parse.y" +#line 1316 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (2)].state)[1]; ;} break; - case 154: + case 157: /* Line 1455 of yacc.c */ -#line 1284 "program_parse.y" +#line 1323 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_AMBIENT; ;} break; - case 155: + case 158: /* Line 1455 of yacc.c */ -#line 1289 "program_parse.y" +#line 1328 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_SCENECOLOR; @@ -3555,10 +3618,10 @@ yyreduce: ;} break; - case 156: + case 159: /* Line 1455 of yacc.c */ -#line 1297 "program_parse.y" +#line 1336 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTPROD; @@ -3568,10 +3631,10 @@ yyreduce: ;} break; - case 158: + case 161: /* Line 1455 of yacc.c */ -#line 1309 "program_parse.y" +#line 1348 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(3) - (3)].integer); @@ -3579,46 +3642,46 @@ yyreduce: ;} break; - case 159: + case 162: /* Line 1455 of yacc.c */ -#line 1317 "program_parse.y" +#line 1356 "program_parse.y" { (yyval.integer) = STATE_TEXENV_COLOR; ;} break; - case 160: + case 163: /* Line 1455 of yacc.c */ -#line 1323 "program_parse.y" +#line 1362 "program_parse.y" { (yyval.integer) = STATE_AMBIENT; ;} break; - case 161: + case 164: /* Line 1455 of yacc.c */ -#line 1327 "program_parse.y" +#line 1366 "program_parse.y" { (yyval.integer) = STATE_DIFFUSE; ;} break; - case 162: + case 165: /* Line 1455 of yacc.c */ -#line 1331 "program_parse.y" +#line 1370 "program_parse.y" { (yyval.integer) = STATE_SPECULAR; ;} break; - case 163: + case 166: /* Line 1455 of yacc.c */ -#line 1337 "program_parse.y" +#line 1376 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxLights) { yyerror(& (yylsp[(1) - (1)]), state, "invalid light selector"); @@ -3629,10 +3692,10 @@ yyreduce: ;} break; - case 164: + case 167: /* Line 1455 of yacc.c */ -#line 1348 "program_parse.y" +#line 1387 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_TEXGEN; @@ -3641,92 +3704,92 @@ yyreduce: ;} break; - case 165: + case 168: /* Line 1455 of yacc.c */ -#line 1357 "program_parse.y" +#line 1396 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S; ;} break; - case 166: + case 169: /* Line 1455 of yacc.c */ -#line 1361 "program_parse.y" +#line 1400 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_OBJECT_S; ;} break; - case 167: + case 170: /* Line 1455 of yacc.c */ -#line 1366 "program_parse.y" +#line 1405 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S; ;} break; - case 168: + case 171: /* Line 1455 of yacc.c */ -#line 1370 "program_parse.y" +#line 1409 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S; ;} break; - case 169: + case 172: /* Line 1455 of yacc.c */ -#line 1374 "program_parse.y" +#line 1413 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S; ;} break; - case 170: + case 173: /* Line 1455 of yacc.c */ -#line 1378 "program_parse.y" +#line 1417 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S; ;} break; - case 171: + case 174: /* Line 1455 of yacc.c */ -#line 1384 "program_parse.y" +#line 1423 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); ;} break; - case 172: + case 175: /* Line 1455 of yacc.c */ -#line 1391 "program_parse.y" +#line 1430 "program_parse.y" { (yyval.integer) = STATE_FOG_COLOR; ;} break; - case 173: + case 176: /* Line 1455 of yacc.c */ -#line 1395 "program_parse.y" +#line 1434 "program_parse.y" { (yyval.integer) = STATE_FOG_PARAMS; ;} break; - case 174: + case 177: /* Line 1455 of yacc.c */ -#line 1401 "program_parse.y" +#line 1440 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_CLIPPLANE; @@ -3734,10 +3797,10 @@ yyreduce: ;} break; - case 175: + case 178: /* Line 1455 of yacc.c */ -#line 1409 "program_parse.y" +#line 1448 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxClipPlanes) { yyerror(& (yylsp[(1) - (1)]), state, "invalid clip plane selector"); @@ -3748,38 +3811,38 @@ yyreduce: ;} break; - case 176: + case 179: /* Line 1455 of yacc.c */ -#line 1420 "program_parse.y" +#line 1459 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); ;} break; - case 177: + case 180: /* Line 1455 of yacc.c */ -#line 1427 "program_parse.y" +#line 1466 "program_parse.y" { (yyval.integer) = STATE_POINT_SIZE; ;} break; - case 178: + case 181: /* Line 1455 of yacc.c */ -#line 1431 "program_parse.y" +#line 1470 "program_parse.y" { (yyval.integer) = STATE_POINT_ATTENUATION; ;} break; - case 179: + case 182: /* Line 1455 of yacc.c */ -#line 1437 "program_parse.y" +#line 1476 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (5)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (5)].state)[1]; @@ -3789,10 +3852,10 @@ yyreduce: ;} break; - case 180: + case 183: /* Line 1455 of yacc.c */ -#line 1447 "program_parse.y" +#line 1486 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (2)].state)[1]; @@ -3802,20 +3865,20 @@ yyreduce: ;} break; - case 181: + case 184: /* Line 1455 of yacc.c */ -#line 1457 "program_parse.y" +#line 1496 "program_parse.y" { (yyval.state)[2] = 0; (yyval.state)[3] = 3; ;} break; - case 182: + case 185: /* Line 1455 of yacc.c */ -#line 1462 "program_parse.y" +#line 1501 "program_parse.y" { /* It seems logical that the matrix row range specifier would have * to specify a range or more than one row (i.e., $5 > $3). @@ -3833,10 +3896,10 @@ yyreduce: ;} break; - case 183: + case 186: /* Line 1455 of yacc.c */ -#line 1480 "program_parse.y" +#line 1519 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (3)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (3)].state)[1]; @@ -3844,55 +3907,55 @@ yyreduce: ;} break; - case 184: + case 187: /* Line 1455 of yacc.c */ -#line 1488 "program_parse.y" +#line 1527 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 185: + case 188: /* Line 1455 of yacc.c */ -#line 1492 "program_parse.y" +#line 1531 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 186: + case 189: /* Line 1455 of yacc.c */ -#line 1498 "program_parse.y" +#line 1537 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVERSE; ;} break; - case 187: + case 190: /* Line 1455 of yacc.c */ -#line 1502 "program_parse.y" +#line 1541 "program_parse.y" { (yyval.integer) = STATE_MATRIX_TRANSPOSE; ;} break; - case 188: + case 191: /* Line 1455 of yacc.c */ -#line 1506 "program_parse.y" +#line 1545 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVTRANS; ;} break; - case 189: + case 192: /* Line 1455 of yacc.c */ -#line 1512 "program_parse.y" +#line 1551 "program_parse.y" { if ((yyvsp[(1) - (1)].integer) > 3) { yyerror(& (yylsp[(1) - (1)]), state, "invalid matrix row reference"); @@ -3903,88 +3966,88 @@ yyreduce: ;} break; - case 190: + case 193: /* Line 1455 of yacc.c */ -#line 1523 "program_parse.y" +#line 1562 "program_parse.y" { (yyval.state)[0] = STATE_MODELVIEW_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); ;} break; - case 191: + case 194: /* Line 1455 of yacc.c */ -#line 1528 "program_parse.y" +#line 1567 "program_parse.y" { (yyval.state)[0] = STATE_PROJECTION_MATRIX; (yyval.state)[1] = 0; ;} break; - case 192: + case 195: /* Line 1455 of yacc.c */ -#line 1533 "program_parse.y" +#line 1572 "program_parse.y" { (yyval.state)[0] = STATE_MVP_MATRIX; (yyval.state)[1] = 0; ;} break; - case 193: + case 196: /* Line 1455 of yacc.c */ -#line 1538 "program_parse.y" +#line 1577 "program_parse.y" { (yyval.state)[0] = STATE_TEXTURE_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); ;} break; - case 194: + case 197: /* Line 1455 of yacc.c */ -#line 1543 "program_parse.y" +#line 1582 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; ;} break; - case 195: + case 198: /* Line 1455 of yacc.c */ -#line 1548 "program_parse.y" +#line 1587 "program_parse.y" { (yyval.state)[0] = STATE_PROGRAM_MATRIX; (yyval.state)[1] = (yyvsp[(3) - (4)].integer); ;} break; - case 196: + case 199: /* Line 1455 of yacc.c */ -#line 1555 "program_parse.y" +#line 1594 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 197: + case 200: /* Line 1455 of yacc.c */ -#line 1559 "program_parse.y" +#line 1598 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 198: + case 201: /* Line 1455 of yacc.c */ -#line 1564 "program_parse.y" +#line 1603 "program_parse.y" { /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix * zero is valid. @@ -3998,10 +4061,10 @@ yyreduce: ;} break; - case 199: + case 202: /* Line 1455 of yacc.c */ -#line 1577 "program_parse.y" +#line 1616 "program_parse.y" { /* Since GL_ARB_matrix_palette isn't supported, just let any value * through here. The error will be generated later. @@ -4010,10 +4073,10 @@ yyreduce: ;} break; - case 200: + case 203: /* Line 1455 of yacc.c */ -#line 1585 "program_parse.y" +#line 1624 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxProgramMatrices) { yyerror(& (yylsp[(1) - (1)]), state, "invalid program matrix selector"); @@ -4024,20 +4087,20 @@ yyreduce: ;} break; - case 201: + case 204: /* Line 1455 of yacc.c */ -#line 1596 "program_parse.y" +#line 1635 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_DEPTH_RANGE; ;} break; - case 206: + case 209: /* Line 1455 of yacc.c */ -#line 1608 "program_parse.y" +#line 1647 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4047,30 +4110,30 @@ yyreduce: ;} break; - case 207: + case 210: /* Line 1455 of yacc.c */ -#line 1618 "program_parse.y" +#line 1657 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); ;} break; - case 208: + case 211: /* Line 1455 of yacc.c */ -#line 1623 "program_parse.y" +#line 1662 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); ;} break; - case 209: + case 212: /* Line 1455 of yacc.c */ -#line 1630 "program_parse.y" +#line 1669 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4080,10 +4143,10 @@ yyreduce: ;} break; - case 210: + case 213: /* Line 1455 of yacc.c */ -#line 1640 "program_parse.y" +#line 1679 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4093,30 +4156,30 @@ yyreduce: ;} break; - case 211: + case 214: /* Line 1455 of yacc.c */ -#line 1649 "program_parse.y" +#line 1688 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); ;} break; - case 212: + case 215: /* Line 1455 of yacc.c */ -#line 1654 "program_parse.y" +#line 1693 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); ;} break; - case 213: + case 216: /* Line 1455 of yacc.c */ -#line 1661 "program_parse.y" +#line 1700 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4126,10 +4189,10 @@ yyreduce: ;} break; - case 214: + case 217: /* Line 1455 of yacc.c */ -#line 1671 "program_parse.y" +#line 1710 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxEnvParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid environment parameter reference"); @@ -4139,10 +4202,10 @@ yyreduce: ;} break; - case 215: + case 218: /* Line 1455 of yacc.c */ -#line 1681 "program_parse.y" +#line 1720 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxLocalParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid local parameter reference"); @@ -4152,10 +4215,10 @@ yyreduce: ;} break; - case 220: + case 223: /* Line 1455 of yacc.c */ -#line 1696 "program_parse.y" +#line 1735 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4165,10 +4228,10 @@ yyreduce: ;} break; - case 221: + case 224: /* Line 1455 of yacc.c */ -#line 1706 "program_parse.y" +#line 1745 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4178,10 +4241,10 @@ yyreduce: ;} break; - case 222: + case 225: /* Line 1455 of yacc.c */ -#line 1714 "program_parse.y" +#line 1753 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (float) (yyvsp[(1) - (1)].integer); @@ -4191,10 +4254,10 @@ yyreduce: ;} break; - case 223: + case 226: /* Line 1455 of yacc.c */ -#line 1724 "program_parse.y" +#line 1763 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (3)].real); @@ -4204,10 +4267,10 @@ yyreduce: ;} break; - case 224: + case 227: /* Line 1455 of yacc.c */ -#line 1732 "program_parse.y" +#line 1771 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (5)].real); @@ -4217,10 +4280,10 @@ yyreduce: ;} break; - case 225: + case 228: /* Line 1455 of yacc.c */ -#line 1741 "program_parse.y" +#line 1780 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (7)].real); @@ -4230,10 +4293,10 @@ yyreduce: ;} break; - case 226: + case 229: /* Line 1455 of yacc.c */ -#line 1750 "program_parse.y" +#line 1789 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (9)].real); @@ -4243,63 +4306,63 @@ yyreduce: ;} break; - case 227: + case 230: /* Line 1455 of yacc.c */ -#line 1760 "program_parse.y" +#line 1799 "program_parse.y" { (yyval.real) = ((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].real) : (yyvsp[(2) - (2)].real); ;} break; - case 228: + case 231: /* Line 1455 of yacc.c */ -#line 1764 "program_parse.y" +#line 1803 "program_parse.y" { (yyval.real) = (float)(((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].integer) : (yyvsp[(2) - (2)].integer)); ;} break; - case 229: + case 232: /* Line 1455 of yacc.c */ -#line 1769 "program_parse.y" +#line 1808 "program_parse.y" { (yyval.negate) = FALSE; ;} break; - case 230: + case 233: /* Line 1455 of yacc.c */ -#line 1770 "program_parse.y" +#line 1809 "program_parse.y" { (yyval.negate) = TRUE; ;} break; - case 231: + case 234: /* Line 1455 of yacc.c */ -#line 1771 "program_parse.y" +#line 1810 "program_parse.y" { (yyval.negate) = FALSE; ;} break; - case 232: + case 235: /* Line 1455 of yacc.c */ -#line 1774 "program_parse.y" +#line 1813 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 234: + case 237: /* Line 1455 of yacc.c */ -#line 1777 "program_parse.y" +#line 1816 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 236: + case 239: /* Line 1455 of yacc.c */ -#line 1781 "program_parse.y" +#line 1820 "program_parse.y" { if (!declare_variable(state, (yyvsp[(3) - (3)].string), (yyvsp[(0) - (3)].integer), & (yylsp[(3) - (3)]))) { YYERROR; @@ -4307,10 +4370,10 @@ yyreduce: ;} break; - case 237: + case 240: /* Line 1455 of yacc.c */ -#line 1787 "program_parse.y" +#line 1826 "program_parse.y" { if (!declare_variable(state, (yyvsp[(1) - (1)].string), (yyvsp[(0) - (1)].integer), & (yylsp[(1) - (1)]))) { YYERROR; @@ -4318,10 +4381,10 @@ yyreduce: ;} break; - case 238: + case 241: /* Line 1455 of yacc.c */ -#line 1795 "program_parse.y" +#line 1834 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (4)].string), at_output, & (yylsp[(2) - (4)])); @@ -4334,10 +4397,10 @@ yyreduce: ;} break; - case 239: + case 242: /* Line 1455 of yacc.c */ -#line 1808 "program_parse.y" +#line 1847 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_HPOS; @@ -4348,10 +4411,10 @@ yyreduce: ;} break; - case 240: + case 243: /* Line 1455 of yacc.c */ -#line 1817 "program_parse.y" +#line 1856 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_FOGC; @@ -4362,19 +4425,19 @@ yyreduce: ;} break; - case 241: + case 244: /* Line 1455 of yacc.c */ -#line 1826 "program_parse.y" +#line 1865 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (2)].result); ;} break; - case 242: + case 245: /* Line 1455 of yacc.c */ -#line 1830 "program_parse.y" +#line 1869 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_PSIZ; @@ -4385,10 +4448,10 @@ yyreduce: ;} break; - case 243: + case 246: /* Line 1455 of yacc.c */ -#line 1839 "program_parse.y" +#line 1878 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_TEX0 + (yyvsp[(3) - (3)].integer); @@ -4399,10 +4462,10 @@ yyreduce: ;} break; - case 244: + case 247: /* Line 1455 of yacc.c */ -#line 1848 "program_parse.y" +#line 1887 "program_parse.y" { if (state->mode == ARB_fragment) { (yyval.result) = FRAG_RESULT_DEPTH; @@ -4413,19 +4476,19 @@ yyreduce: ;} break; - case 245: + case 248: /* Line 1455 of yacc.c */ -#line 1859 "program_parse.y" +#line 1898 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (3)].integer) + (yyvsp[(3) - (3)].integer); ;} break; - case 246: + case 249: /* Line 1455 of yacc.c */ -#line 1865 "program_parse.y" +#line 1904 "program_parse.y" { (yyval.integer) = (state->mode == ARB_vertex) ? VERT_RESULT_COL0 @@ -4433,10 +4496,10 @@ yyreduce: ;} break; - case 247: + case 250: /* Line 1455 of yacc.c */ -#line 1871 "program_parse.y" +#line 1910 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_COL0; @@ -4447,10 +4510,10 @@ yyreduce: ;} break; - case 248: + case 251: /* Line 1455 of yacc.c */ -#line 1880 "program_parse.y" +#line 1919 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_BFC0; @@ -4461,19 +4524,19 @@ yyreduce: ;} break; - case 249: + case 252: /* Line 1455 of yacc.c */ -#line 1891 "program_parse.y" +#line 1930 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 250: + case 253: /* Line 1455 of yacc.c */ -#line 1895 "program_parse.y" +#line 1934 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 0; @@ -4484,10 +4547,10 @@ yyreduce: ;} break; - case 251: + case 254: /* Line 1455 of yacc.c */ -#line 1904 "program_parse.y" +#line 1943 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 1; @@ -4498,94 +4561,94 @@ yyreduce: ;} break; - case 252: + case 255: /* Line 1455 of yacc.c */ -#line 1914 "program_parse.y" +#line 1953 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 253: + case 256: /* Line 1455 of yacc.c */ -#line 1915 "program_parse.y" +#line 1954 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 254: + case 257: /* Line 1455 of yacc.c */ -#line 1916 "program_parse.y" +#line 1955 "program_parse.y" { (yyval.integer) = 1; ;} break; - case 255: + case 258: /* Line 1455 of yacc.c */ -#line 1919 "program_parse.y" +#line 1958 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 256: + case 259: /* Line 1455 of yacc.c */ -#line 1920 "program_parse.y" +#line 1959 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 257: + case 260: /* Line 1455 of yacc.c */ -#line 1921 "program_parse.y" +#line 1960 "program_parse.y" { (yyval.integer) = 1; ;} break; - case 258: + case 261: /* Line 1455 of yacc.c */ -#line 1924 "program_parse.y" +#line 1963 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 259: + case 262: /* Line 1455 of yacc.c */ -#line 1925 "program_parse.y" +#line 1964 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; - case 260: + case 263: /* Line 1455 of yacc.c */ -#line 1928 "program_parse.y" +#line 1967 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 261: + case 264: /* Line 1455 of yacc.c */ -#line 1929 "program_parse.y" +#line 1968 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; - case 262: + case 265: /* Line 1455 of yacc.c */ -#line 1932 "program_parse.y" +#line 1971 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 263: + case 266: /* Line 1455 of yacc.c */ -#line 1933 "program_parse.y" +#line 1972 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; - case 264: + case 267: /* Line 1455 of yacc.c */ -#line 1937 "program_parse.y" +#line 1976 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureCoordUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture coordinate unit selector"); @@ -4596,10 +4659,10 @@ yyreduce: ;} break; - case 265: + case 268: /* Line 1455 of yacc.c */ -#line 1948 "program_parse.y" +#line 1987 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureImageUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture image unit selector"); @@ -4610,10 +4673,10 @@ yyreduce: ;} break; - case 266: + case 269: /* Line 1455 of yacc.c */ -#line 1959 "program_parse.y" +#line 1998 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture unit selector"); @@ -4624,10 +4687,10 @@ yyreduce: ;} break; - case 267: + case 270: /* Line 1455 of yacc.c */ -#line 1970 "program_parse.y" +#line 2009 "program_parse.y" { struct asm_symbol *exist = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(2) - (4)].string)); @@ -4651,7 +4714,7 @@ yyreduce: /* Line 1455 of yacc.c */ -#line 4655 "program_parse.tab.c" +#line 4718 "program_parse.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -4870,7 +4933,7 @@ yyreturn: /* Line 1675 of yacc.c */ -#line 1990 "program_parse.y" +#line 2029 "program_parse.y" struct asm_instruction * diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index fa94f763c4..32aa9d503f 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -181,7 +181,7 @@ static struct asm_instruction *asm_instruction_ctor(gl_inst_opcode op, %type KIL_instruction %type dstReg maskedDstReg maskedAddrReg -%type srcReg scalarSrcReg swizzleSrcReg +%type srcReg scalarUse scalarSrcReg swizzleSrcReg %type scalarSuffix swizzleSuffix extendedSwizzle %type extSwizComp extSwizSel %type optionalMask @@ -523,29 +523,50 @@ SWZ_instruction: SWZ maskedDstReg ',' srcReg ',' extendedSwizzle } ; -scalarSrcReg: optionalSign srcReg scalarSuffix +scalarSrcReg: optionalSign scalarUse { $$ = $2; if ($1) { $$.Base.Negate = ~$$.Base.Negate; } + } + | optionalSign '|' scalarUse '|' + { + $$ = $3; + + if (!state->option.NV_fragment) { + yyerror(& @2, state, "unexpected character '|'"); + YYERROR; + } + + if ($1) { + $$.Base.Negate = ~$$.Base.Negate; + } + + $$.Base.Abs = 1; + } + ; + +scalarUse: srcReg scalarSuffix + { + $$ = $1; $$.Base.Swizzle = _mesa_combine_swizzles($$.Base.Swizzle, - $3.swizzle); + $2.swizzle); } - | optionalSign paramConstScalarUse + | paramConstScalarUse { struct asm_symbol temp_sym; if (!state->option.NV_fragment) { - yyerror(& @2, state, "expected scalar suffix"); + yyerror(& @1, state, "expected scalar suffix"); YYERROR; } memset(& temp_sym, 0, sizeof(temp_sym)); temp_sym.param_binding_begin = ~0; - initialize_symbol_from_const(state->prog, & temp_sym, & $2); + initialize_symbol_from_const(state->prog, & temp_sym, & $1); init_src_reg(& $$); $$.Base.File = PROGRAM_CONSTANT; @@ -564,6 +585,24 @@ swizzleSrcReg: optionalSign srcReg swizzleSuffix $$.Base.Swizzle = _mesa_combine_swizzles($$.Base.Swizzle, $3.swizzle); } + | optionalSign '|' srcReg swizzleSuffix '|' + { + $$ = $3; + + if (!state->option.NV_fragment) { + yyerror(& @2, state, "unexpected character '|'"); + YYERROR; + } + + if ($1) { + $$.Base.Negate = ~$$.Base.Negate; + } + + $$.Base.Abs = 1; + $$.Base.Swizzle = _mesa_combine_swizzles($$.Base.Swizzle, + $4.swizzle); + } + ; maskedDstReg: dstReg optionalMask -- cgit v1.2.3 From 9ea4319744fb7474635cb1994e1babe1552d4d4f Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 4 Sep 2009 16:35:50 -0700 Subject: ARB prog parser: Add new constructor for asm_instruction The new constructor copies fields from the prog_instruction that the parser expects the lexer to set. --- src/mesa/shader/program_parse.tab.c | 621 +++++++++++++++++++----------------- src/mesa/shader/program_parse.tab.h | 2 +- src/mesa/shader/program_parse.y | 111 ++++--- 3 files changed, 400 insertions(+), 334 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c index 505a1eb94f..b9a0e557ad 100644 --- a/src/mesa/shader/program_parse.tab.c +++ b/src/mesa/shader/program_parse.tab.c @@ -139,10 +139,19 @@ static void init_dst_reg(struct prog_dst_register *r); static void init_src_reg(struct asm_src_register *r); +static void asm_instruction_set_operands(struct asm_instruction *inst, + const struct prog_dst_register *dst, const struct asm_src_register *src0, + const struct asm_src_register *src1, const struct asm_src_register *src2); + static struct asm_instruction *asm_instruction_ctor(gl_inst_opcode op, const struct prog_dst_register *dst, const struct asm_src_register *src0, const struct asm_src_register *src1, const struct asm_src_register *src2); +static struct asm_instruction *asm_instruction_copy_ctor( + const struct prog_instruction *base, const struct prog_dst_register *dst, + const struct asm_src_register *src0, const struct asm_src_register *src1, + const struct asm_src_register *src2); + #ifndef FALSE #define FALSE 0 #define TRUE (!FALSE) @@ -170,7 +179,7 @@ static struct asm_instruction *asm_instruction_ctor(gl_inst_opcode op, /* Line 189 of yacc.c */ -#line 174 "program_parse.tab.c" +#line 183 "program_parse.tab.c" /* Enabling traces. */ #ifndef YYDEBUG @@ -311,7 +320,7 @@ typedef union YYSTYPE { /* Line 214 of yacc.c */ -#line 107 "program_parse.y" +#line 116 "program_parse.y" struct asm_instruction *inst; struct asm_symbol *sym; @@ -340,7 +349,7 @@ typedef union YYSTYPE /* Line 214 of yacc.c */ -#line 344 "program_parse.tab.c" +#line 353 "program_parse.tab.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -364,14 +373,14 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ /* Line 264 of yacc.c */ -#line 249 "program_parse.y" +#line 258 "program_parse.y" extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, void *yyscanner); /* Line 264 of yacc.c */ -#line 375 "program_parse.tab.c" +#line 384 "program_parse.tab.c" #ifdef short # undef short @@ -768,34 +777,34 @@ static const yytype_int16 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 256, 256, 259, 267, 279, 280, 283, 305, 306, - 309, 324, 327, 332, 339, 340, 341, 342, 343, 344, - 345, 348, 349, 350, 353, 359, 366, 373, 381, 388, - 396, 441, 448, 493, 499, 500, 501, 502, 503, 504, - 505, 506, 507, 508, 509, 510, 513, 526, 534, 551, - 558, 577, 588, 608, 630, 639, 672, 679, 694, 744, - 786, 797, 818, 828, 834, 865, 882, 882, 884, 891, - 903, 904, 905, 908, 920, 932, 950, 961, 973, 975, - 976, 977, 978, 981, 981, 981, 981, 982, 985, 986, - 987, 988, 989, 990, 993, 1011, 1015, 1021, 1025, 1029, - 1033, 1042, 1051, 1055, 1060, 1066, 1077, 1077, 1078, 1080, - 1084, 1088, 1092, 1098, 1098, 1100, 1116, 1139, 1142, 1153, - 1159, 1165, 1166, 1173, 1179, 1185, 1193, 1199, 1205, 1213, - 1219, 1225, 1233, 1234, 1237, 1238, 1239, 1240, 1241, 1242, - 1243, 1244, 1245, 1246, 1247, 1250, 1259, 1263, 1267, 1273, - 1282, 1286, 1290, 1299, 1303, 1309, 1315, 1322, 1327, 1335, - 1345, 1347, 1355, 1361, 1365, 1369, 1375, 1386, 1395, 1399, - 1404, 1408, 1412, 1416, 1422, 1429, 1433, 1439, 1447, 1458, - 1465, 1469, 1475, 1485, 1496, 1500, 1518, 1527, 1530, 1536, - 1540, 1544, 1550, 1561, 1566, 1571, 1576, 1581, 1586, 1594, - 1597, 1602, 1615, 1623, 1634, 1642, 1642, 1644, 1644, 1646, - 1656, 1661, 1668, 1678, 1687, 1692, 1699, 1709, 1719, 1731, - 1731, 1732, 1732, 1734, 1744, 1752, 1762, 1770, 1778, 1787, - 1798, 1802, 1808, 1809, 1810, 1813, 1813, 1816, 1816, 1819, - 1825, 1833, 1846, 1855, 1864, 1868, 1877, 1886, 1897, 1904, - 1909, 1918, 1930, 1933, 1942, 1953, 1954, 1955, 1958, 1959, - 1960, 1963, 1964, 1967, 1968, 1971, 1972, 1975, 1986, 1997, - 2008 + 0, 265, 265, 268, 276, 288, 289, 292, 314, 315, + 318, 333, 336, 341, 348, 349, 350, 351, 352, 353, + 354, 357, 358, 359, 362, 368, 374, 380, 387, 393, + 400, 444, 451, 495, 501, 502, 503, 504, 505, 506, + 507, 508, 509, 510, 511, 512, 515, 527, 535, 552, + 559, 578, 589, 609, 631, 640, 673, 680, 695, 745, + 787, 798, 819, 829, 835, 866, 883, 883, 885, 892, + 904, 905, 906, 909, 921, 933, 951, 962, 974, 976, + 977, 978, 979, 982, 982, 982, 982, 983, 986, 987, + 988, 989, 990, 991, 994, 1012, 1016, 1022, 1026, 1030, + 1034, 1043, 1052, 1056, 1061, 1067, 1078, 1078, 1079, 1081, + 1085, 1089, 1093, 1099, 1099, 1101, 1117, 1140, 1143, 1154, + 1160, 1166, 1167, 1174, 1180, 1186, 1194, 1200, 1206, 1214, + 1220, 1226, 1234, 1235, 1238, 1239, 1240, 1241, 1242, 1243, + 1244, 1245, 1246, 1247, 1248, 1251, 1260, 1264, 1268, 1274, + 1283, 1287, 1291, 1300, 1304, 1310, 1316, 1323, 1328, 1336, + 1346, 1348, 1356, 1362, 1366, 1370, 1376, 1387, 1396, 1400, + 1405, 1409, 1413, 1417, 1423, 1430, 1434, 1440, 1448, 1459, + 1466, 1470, 1476, 1486, 1497, 1501, 1519, 1528, 1531, 1537, + 1541, 1545, 1551, 1562, 1567, 1572, 1577, 1582, 1587, 1595, + 1598, 1603, 1616, 1624, 1635, 1643, 1643, 1645, 1645, 1647, + 1657, 1662, 1669, 1679, 1688, 1693, 1700, 1710, 1720, 1732, + 1732, 1733, 1733, 1735, 1745, 1753, 1763, 1771, 1779, 1788, + 1799, 1803, 1809, 1810, 1811, 1814, 1814, 1817, 1817, 1820, + 1826, 1834, 1847, 1856, 1865, 1869, 1878, 1887, 1898, 1905, + 1910, 1919, 1931, 1934, 1943, 1954, 1955, 1956, 1959, 1960, + 1961, 1964, 1965, 1968, 1969, 1972, 1973, 1976, 1987, 1998, + 2009 }; #endif @@ -2088,7 +2097,7 @@ yyreduce: case 3: /* Line 1455 of yacc.c */ -#line 260 "program_parse.y" +#line 269 "program_parse.y" { if (state->prog->Target != GL_VERTEX_PROGRAM_ARB) { yyerror(& (yylsp[(1) - (1)]), state, "invalid fragment program header"); @@ -2101,7 +2110,7 @@ yyreduce: case 4: /* Line 1455 of yacc.c */ -#line 268 "program_parse.y" +#line 277 "program_parse.y" { if (state->prog->Target != GL_FRAGMENT_PROGRAM_ARB) { yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex program header"); @@ -2116,7 +2125,7 @@ yyreduce: case 7: /* Line 1455 of yacc.c */ -#line 284 "program_parse.y" +#line 293 "program_parse.y" { int valid = 0; @@ -2141,7 +2150,7 @@ yyreduce: case 10: /* Line 1455 of yacc.c */ -#line 310 "program_parse.y" +#line 319 "program_parse.y" { if ((yyvsp[(1) - (2)].inst) != NULL) { if (state->inst_tail == NULL) { @@ -2161,7 +2170,7 @@ yyreduce: case 12: /* Line 1455 of yacc.c */ -#line 328 "program_parse.y" +#line 337 "program_parse.y" { (yyval.inst) = (yyvsp[(1) - (1)].inst); state->prog->NumAluInstructions++; @@ -2171,7 +2180,7 @@ yyreduce: case 13: /* Line 1455 of yacc.c */ -#line 333 "program_parse.y" +#line 342 "program_parse.y" { (yyval.inst) = (yyvsp[(1) - (1)].inst); state->prog->NumTexInstructions++; @@ -2181,7 +2190,7 @@ yyreduce: case 24: /* Line 1455 of yacc.c */ -#line 354 "program_parse.y" +#line 363 "program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_ARL, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); ;} @@ -2190,66 +2199,60 @@ yyreduce: case 25: /* Line 1455 of yacc.c */ -#line 360 "program_parse.y" +#line 369 "program_parse.y" { - (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (4)].temp_inst).Opcode, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); - (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (4)].temp_inst).SaturateMode; + (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); ;} break; case 26: /* Line 1455 of yacc.c */ -#line 367 "program_parse.y" +#line 375 "program_parse.y" { - (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (4)].temp_inst).Opcode, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); - (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (4)].temp_inst).SaturateMode; + (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); ;} break; case 27: /* Line 1455 of yacc.c */ -#line 374 "program_parse.y" +#line 381 "program_parse.y" { - (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (6)].temp_inst).Opcode, & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL); - (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (6)].temp_inst).SaturateMode; + (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL); ;} break; case 28: /* Line 1455 of yacc.c */ -#line 382 "program_parse.y" +#line 388 "program_parse.y" { - (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (6)].temp_inst).Opcode, & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL); - (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (6)].temp_inst).SaturateMode; + (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL); ;} break; case 29: /* Line 1455 of yacc.c */ -#line 390 "program_parse.y" +#line 395 "program_parse.y" { - (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (8)].temp_inst).Opcode, & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), & (yyvsp[(6) - (8)].src_reg), & (yyvsp[(8) - (8)].src_reg)); - (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (8)].temp_inst).SaturateMode; + (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (8)].temp_inst), & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), & (yyvsp[(6) - (8)].src_reg), & (yyvsp[(8) - (8)].src_reg)); ;} break; case 30: /* Line 1455 of yacc.c */ -#line 397 "program_parse.y" +#line 401 "program_parse.y" { - (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (8)].temp_inst).Opcode, & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), NULL, NULL); + (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (8)].temp_inst), & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), NULL, NULL); if ((yyval.inst) != NULL) { const GLbitfield tex_mask = (1U << (yyvsp[(6) - (8)].integer)); GLbitfield shadow_tex = 0; GLbitfield target_mask = 0; - (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (8)].temp_inst).SaturateMode; (yyval.inst)->Base.TexSrcUnit = (yyvsp[(6) - (8)].integer); if ((yyvsp[(8) - (8)].integer) < 0) { @@ -2288,7 +2291,7 @@ yyreduce: case 31: /* Line 1455 of yacc.c */ -#line 442 "program_parse.y" +#line 445 "program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_KIL, NULL, & (yyvsp[(2) - (2)].src_reg), NULL, NULL); state->fragment.UsesKill = 1; @@ -2298,16 +2301,15 @@ yyreduce: case 32: /* Line 1455 of yacc.c */ -#line 449 "program_parse.y" +#line 452 "program_parse.y" { - (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (12)].temp_inst).Opcode, & (yyvsp[(2) - (12)].dst_reg), & (yyvsp[(4) - (12)].src_reg), & (yyvsp[(6) - (12)].src_reg), & (yyvsp[(8) - (12)].src_reg)); + (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (12)].temp_inst), & (yyvsp[(2) - (12)].dst_reg), & (yyvsp[(4) - (12)].src_reg), & (yyvsp[(6) - (12)].src_reg), & (yyvsp[(8) - (12)].src_reg)); if ((yyval.inst) != NULL) { const GLbitfield tex_mask = (1U << (yyvsp[(10) - (12)].integer)); GLbitfield shadow_tex = 0; GLbitfield target_mask = 0; - (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (12)].temp_inst).SaturateMode; (yyval.inst)->Base.TexSrcUnit = (yyvsp[(10) - (12)].integer); if ((yyvsp[(12) - (12)].integer) < 0) { @@ -2346,7 +2348,7 @@ yyreduce: case 33: /* Line 1455 of yacc.c */ -#line 494 "program_parse.y" +#line 496 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} @@ -2355,91 +2357,91 @@ yyreduce: case 34: /* Line 1455 of yacc.c */ -#line 499 "program_parse.y" +#line 501 "program_parse.y" { (yyval.integer) = TEXTURE_1D_INDEX; ;} break; case 35: /* Line 1455 of yacc.c */ -#line 500 "program_parse.y" +#line 502 "program_parse.y" { (yyval.integer) = TEXTURE_2D_INDEX; ;} break; case 36: /* Line 1455 of yacc.c */ -#line 501 "program_parse.y" +#line 503 "program_parse.y" { (yyval.integer) = TEXTURE_3D_INDEX; ;} break; case 37: /* Line 1455 of yacc.c */ -#line 502 "program_parse.y" +#line 504 "program_parse.y" { (yyval.integer) = TEXTURE_CUBE_INDEX; ;} break; case 38: /* Line 1455 of yacc.c */ -#line 503 "program_parse.y" +#line 505 "program_parse.y" { (yyval.integer) = TEXTURE_RECT_INDEX; ;} break; case 39: /* Line 1455 of yacc.c */ -#line 504 "program_parse.y" +#line 506 "program_parse.y" { (yyval.integer) = -TEXTURE_1D_INDEX; ;} break; case 40: /* Line 1455 of yacc.c */ -#line 505 "program_parse.y" +#line 507 "program_parse.y" { (yyval.integer) = -TEXTURE_2D_INDEX; ;} break; case 41: /* Line 1455 of yacc.c */ -#line 506 "program_parse.y" +#line 508 "program_parse.y" { (yyval.integer) = -TEXTURE_RECT_INDEX; ;} break; case 42: /* Line 1455 of yacc.c */ -#line 507 "program_parse.y" +#line 509 "program_parse.y" { (yyval.integer) = TEXTURE_1D_ARRAY_INDEX; ;} break; case 43: /* Line 1455 of yacc.c */ -#line 508 "program_parse.y" +#line 510 "program_parse.y" { (yyval.integer) = TEXTURE_2D_ARRAY_INDEX; ;} break; case 44: /* Line 1455 of yacc.c */ -#line 509 "program_parse.y" +#line 511 "program_parse.y" { (yyval.integer) = -TEXTURE_1D_ARRAY_INDEX; ;} break; case 45: /* Line 1455 of yacc.c */ -#line 510 "program_parse.y" +#line 512 "program_parse.y" { (yyval.integer) = -TEXTURE_2D_ARRAY_INDEX; ;} break; case 46: /* Line 1455 of yacc.c */ -#line 514 "program_parse.y" +#line 516 "program_parse.y" { /* FIXME: Is this correct? Should the extenedSwizzle be applied * FIXME: to the existing swizzle? @@ -2447,15 +2449,14 @@ yyreduce: (yyvsp[(4) - (6)].src_reg).Base.Swizzle = (yyvsp[(6) - (6)].swiz_mask).swizzle; (yyvsp[(4) - (6)].src_reg).Base.Negate = (yyvsp[(6) - (6)].swiz_mask).mask; - (yyval.inst) = asm_instruction_ctor(OPCODE_SWZ, & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), NULL, NULL); - (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (6)].temp_inst).SaturateMode; + (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), NULL, NULL); ;} break; case 47: /* Line 1455 of yacc.c */ -#line 527 "program_parse.y" +#line 528 "program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (2)].src_reg); @@ -2468,7 +2469,7 @@ yyreduce: case 48: /* Line 1455 of yacc.c */ -#line 535 "program_parse.y" +#line 536 "program_parse.y" { (yyval.src_reg) = (yyvsp[(3) - (4)].src_reg); @@ -2488,7 +2489,7 @@ yyreduce: case 49: /* Line 1455 of yacc.c */ -#line 552 "program_parse.y" +#line 553 "program_parse.y" { (yyval.src_reg) = (yyvsp[(1) - (2)].src_reg); @@ -2500,7 +2501,7 @@ yyreduce: case 50: /* Line 1455 of yacc.c */ -#line 559 "program_parse.y" +#line 560 "program_parse.y" { struct asm_symbol temp_sym; @@ -2522,7 +2523,7 @@ yyreduce: case 51: /* Line 1455 of yacc.c */ -#line 578 "program_parse.y" +#line 579 "program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (3)].src_reg); @@ -2538,7 +2539,7 @@ yyreduce: case 52: /* Line 1455 of yacc.c */ -#line 589 "program_parse.y" +#line 590 "program_parse.y" { (yyval.src_reg) = (yyvsp[(3) - (5)].src_reg); @@ -2560,7 +2561,7 @@ yyreduce: case 53: /* Line 1455 of yacc.c */ -#line 609 "program_parse.y" +#line 610 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); (yyval.dst_reg).WriteMask = (yyvsp[(2) - (2)].swiz_mask).mask; @@ -2585,7 +2586,7 @@ yyreduce: case 54: /* Line 1455 of yacc.c */ -#line 631 "program_parse.y" +#line 632 "program_parse.y" { init_dst_reg(& (yyval.dst_reg)); (yyval.dst_reg).File = PROGRAM_ADDRESS; @@ -2597,7 +2598,7 @@ yyreduce: case 55: /* Line 1455 of yacc.c */ -#line 640 "program_parse.y" +#line 641 "program_parse.y" { const unsigned xyzw_valid = ((yyvsp[(1) - (7)].ext_swizzle).xyzw_valid << 0) @@ -2633,7 +2634,7 @@ yyreduce: case 56: /* Line 1455 of yacc.c */ -#line 673 "program_parse.y" +#line 674 "program_parse.y" { (yyval.ext_swizzle) = (yyvsp[(2) - (2)].ext_swizzle); (yyval.ext_swizzle).negate = ((yyvsp[(1) - (2)].negate)) ? 1 : 0; @@ -2643,7 +2644,7 @@ yyreduce: case 57: /* Line 1455 of yacc.c */ -#line 680 "program_parse.y" +#line 681 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) != 0) && ((yyvsp[(1) - (1)].integer) != 1)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector"); @@ -2663,7 +2664,7 @@ yyreduce: case 58: /* Line 1455 of yacc.c */ -#line 695 "program_parse.y" +#line 696 "program_parse.y" { if (strlen((yyvsp[(1) - (1)].string)) > 1) { yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector"); @@ -2716,7 +2717,7 @@ yyreduce: case 59: /* Line 1455 of yacc.c */ -#line 745 "program_parse.y" +#line 746 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2763,7 +2764,7 @@ yyreduce: case 60: /* Line 1455 of yacc.c */ -#line 787 "program_parse.y" +#line 788 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.File = PROGRAM_INPUT; @@ -2779,7 +2780,7 @@ yyreduce: case 61: /* Line 1455 of yacc.c */ -#line 798 "program_parse.y" +#line 799 "program_parse.y" { if (! (yyvsp[(3) - (4)].src_reg).Base.RelAddr && ((unsigned) (yyvsp[(3) - (4)].src_reg).Base.Index >= (yyvsp[(1) - (4)].sym)->param_binding_length)) { @@ -2805,7 +2806,7 @@ yyreduce: case 62: /* Line 1455 of yacc.c */ -#line 819 "program_parse.y" +#line 820 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.File = ((yyvsp[(1) - (1)].temp_sym).name != NULL) @@ -2818,7 +2819,7 @@ yyreduce: case 63: /* Line 1455 of yacc.c */ -#line 829 "program_parse.y" +#line 830 "program_parse.y" { init_dst_reg(& (yyval.dst_reg)); (yyval.dst_reg).File = PROGRAM_OUTPUT; @@ -2829,7 +2830,7 @@ yyreduce: case 64: /* Line 1455 of yacc.c */ -#line 835 "program_parse.y" +#line 836 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2863,7 +2864,7 @@ yyreduce: case 65: /* Line 1455 of yacc.c */ -#line 866 "program_parse.y" +#line 867 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2883,7 +2884,7 @@ yyreduce: case 68: /* Line 1455 of yacc.c */ -#line 885 "program_parse.y" +#line 886 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].integer); @@ -2893,7 +2894,7 @@ yyreduce: case 69: /* Line 1455 of yacc.c */ -#line 892 "program_parse.y" +#line 893 "program_parse.y" { /* FINISHME: Add support for multiple address registers. */ @@ -2908,28 +2909,28 @@ yyreduce: case 70: /* Line 1455 of yacc.c */ -#line 903 "program_parse.y" +#line 904 "program_parse.y" { (yyval.integer) = 0; ;} break; case 71: /* Line 1455 of yacc.c */ -#line 904 "program_parse.y" +#line 905 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; case 72: /* Line 1455 of yacc.c */ -#line 905 "program_parse.y" +#line 906 "program_parse.y" { (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;} break; case 73: /* Line 1455 of yacc.c */ -#line 909 "program_parse.y" +#line 910 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 63)) { yyerror(& (yylsp[(1) - (1)]), state, @@ -2944,7 +2945,7 @@ yyreduce: case 74: /* Line 1455 of yacc.c */ -#line 921 "program_parse.y" +#line 922 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 64)) { yyerror(& (yylsp[(1) - (1)]), state, @@ -2959,7 +2960,7 @@ yyreduce: case 75: /* Line 1455 of yacc.c */ -#line 933 "program_parse.y" +#line 934 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2980,7 +2981,7 @@ yyreduce: case 76: /* Line 1455 of yacc.c */ -#line 951 "program_parse.y" +#line 952 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, "invalid address component selector"); @@ -2994,7 +2995,7 @@ yyreduce: case 77: /* Line 1455 of yacc.c */ -#line 962 "program_parse.y" +#line 963 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, @@ -3009,21 +3010,21 @@ yyreduce: case 82: /* Line 1455 of yacc.c */ -#line 978 "program_parse.y" +#line 979 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; case 87: /* Line 1455 of yacc.c */ -#line 982 "program_parse.y" +#line 983 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; case 94: /* Line 1455 of yacc.c */ -#line 994 "program_parse.y" +#line 995 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (4)].string), at_attrib, & (yylsp[(2) - (4)])); @@ -3044,7 +3045,7 @@ yyreduce: case 95: /* Line 1455 of yacc.c */ -#line 1012 "program_parse.y" +#line 1013 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} @@ -3053,7 +3054,7 @@ yyreduce: case 96: /* Line 1455 of yacc.c */ -#line 1016 "program_parse.y" +#line 1017 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} @@ -3062,7 +3063,7 @@ yyreduce: case 97: /* Line 1455 of yacc.c */ -#line 1022 "program_parse.y" +#line 1023 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_POS; ;} @@ -3071,7 +3072,7 @@ yyreduce: case 98: /* Line 1455 of yacc.c */ -#line 1026 "program_parse.y" +#line 1027 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_WEIGHT; ;} @@ -3080,7 +3081,7 @@ yyreduce: case 99: /* Line 1455 of yacc.c */ -#line 1030 "program_parse.y" +#line 1031 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_NORMAL; ;} @@ -3089,7 +3090,7 @@ yyreduce: case 100: /* Line 1455 of yacc.c */ -#line 1034 "program_parse.y" +#line 1035 "program_parse.y" { if (!state->ctx->Extensions.EXT_secondary_color) { yyerror(& (yylsp[(2) - (2)]), state, "GL_EXT_secondary_color not supported"); @@ -3103,7 +3104,7 @@ yyreduce: case 101: /* Line 1455 of yacc.c */ -#line 1043 "program_parse.y" +#line 1044 "program_parse.y" { if (!state->ctx->Extensions.EXT_fog_coord) { yyerror(& (yylsp[(1) - (1)]), state, "GL_EXT_fog_coord not supported"); @@ -3117,7 +3118,7 @@ yyreduce: case 102: /* Line 1455 of yacc.c */ -#line 1052 "program_parse.y" +#line 1053 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} @@ -3126,7 +3127,7 @@ yyreduce: case 103: /* Line 1455 of yacc.c */ -#line 1056 "program_parse.y" +#line 1057 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; @@ -3136,7 +3137,7 @@ yyreduce: case 104: /* Line 1455 of yacc.c */ -#line 1061 "program_parse.y" +#line 1062 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_GENERIC0 + (yyvsp[(3) - (4)].integer); ;} @@ -3145,7 +3146,7 @@ yyreduce: case 105: /* Line 1455 of yacc.c */ -#line 1067 "program_parse.y" +#line 1068 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxAttribs) { yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex attribute reference"); @@ -3159,7 +3160,7 @@ yyreduce: case 109: /* Line 1455 of yacc.c */ -#line 1081 "program_parse.y" +#line 1082 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_WPOS; ;} @@ -3168,7 +3169,7 @@ yyreduce: case 110: /* Line 1455 of yacc.c */ -#line 1085 "program_parse.y" +#line 1086 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_COL0 + (yyvsp[(2) - (2)].integer); ;} @@ -3177,7 +3178,7 @@ yyreduce: case 111: /* Line 1455 of yacc.c */ -#line 1089 "program_parse.y" +#line 1090 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_FOGC; ;} @@ -3186,7 +3187,7 @@ yyreduce: case 112: /* Line 1455 of yacc.c */ -#line 1093 "program_parse.y" +#line 1094 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} @@ -3195,7 +3196,7 @@ yyreduce: case 115: /* Line 1455 of yacc.c */ -#line 1101 "program_parse.y" +#line 1102 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (3)].string), at_param, & (yylsp[(2) - (3)])); @@ -3214,7 +3215,7 @@ yyreduce: case 116: /* Line 1455 of yacc.c */ -#line 1117 "program_parse.y" +#line 1118 "program_parse.y" { if (((yyvsp[(4) - (6)].integer) != 0) && ((unsigned) (yyvsp[(4) - (6)].integer) != (yyvsp[(6) - (6)].temp_sym).param_binding_length)) { yyerror(& (yylsp[(4) - (6)]), state, @@ -3239,7 +3240,7 @@ yyreduce: case 117: /* Line 1455 of yacc.c */ -#line 1139 "program_parse.y" +#line 1140 "program_parse.y" { (yyval.integer) = 0; ;} @@ -3248,7 +3249,7 @@ yyreduce: case 118: /* Line 1455 of yacc.c */ -#line 1143 "program_parse.y" +#line 1144 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxParameters)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid parameter array size"); @@ -3262,7 +3263,7 @@ yyreduce: case 119: /* Line 1455 of yacc.c */ -#line 1154 "program_parse.y" +#line 1155 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(2) - (2)].temp_sym); ;} @@ -3271,7 +3272,7 @@ yyreduce: case 120: /* Line 1455 of yacc.c */ -#line 1160 "program_parse.y" +#line 1161 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(3) - (4)].temp_sym); ;} @@ -3280,7 +3281,7 @@ yyreduce: case 122: /* Line 1455 of yacc.c */ -#line 1167 "program_parse.y" +#line 1168 "program_parse.y" { (yyvsp[(1) - (3)].temp_sym).param_binding_length += (yyvsp[(3) - (3)].temp_sym).param_binding_length; (yyval.temp_sym) = (yyvsp[(1) - (3)].temp_sym); @@ -3290,7 +3291,7 @@ yyreduce: case 123: /* Line 1455 of yacc.c */ -#line 1174 "program_parse.y" +#line 1175 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3301,7 +3302,7 @@ yyreduce: case 124: /* Line 1455 of yacc.c */ -#line 1180 "program_parse.y" +#line 1181 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3312,7 +3313,7 @@ yyreduce: case 125: /* Line 1455 of yacc.c */ -#line 1186 "program_parse.y" +#line 1187 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3323,7 +3324,7 @@ yyreduce: case 126: /* Line 1455 of yacc.c */ -#line 1194 "program_parse.y" +#line 1195 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3334,7 +3335,7 @@ yyreduce: case 127: /* Line 1455 of yacc.c */ -#line 1200 "program_parse.y" +#line 1201 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3345,7 +3346,7 @@ yyreduce: case 128: /* Line 1455 of yacc.c */ -#line 1206 "program_parse.y" +#line 1207 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3356,7 +3357,7 @@ yyreduce: case 129: /* Line 1455 of yacc.c */ -#line 1214 "program_parse.y" +#line 1215 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3367,7 +3368,7 @@ yyreduce: case 130: /* Line 1455 of yacc.c */ -#line 1220 "program_parse.y" +#line 1221 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3378,7 +3379,7 @@ yyreduce: case 131: /* Line 1455 of yacc.c */ -#line 1226 "program_parse.y" +#line 1227 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3389,98 +3390,98 @@ yyreduce: case 132: /* Line 1455 of yacc.c */ -#line 1233 "program_parse.y" +#line 1234 "program_parse.y" { memcpy((yyval.state), (yyvsp[(1) - (1)].state), sizeof((yyval.state))); ;} break; case 133: /* Line 1455 of yacc.c */ -#line 1234 "program_parse.y" +#line 1235 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 134: /* Line 1455 of yacc.c */ -#line 1237 "program_parse.y" +#line 1238 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 135: /* Line 1455 of yacc.c */ -#line 1238 "program_parse.y" +#line 1239 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 136: /* Line 1455 of yacc.c */ -#line 1239 "program_parse.y" +#line 1240 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 137: /* Line 1455 of yacc.c */ -#line 1240 "program_parse.y" +#line 1241 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 138: /* Line 1455 of yacc.c */ -#line 1241 "program_parse.y" +#line 1242 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 139: /* Line 1455 of yacc.c */ -#line 1242 "program_parse.y" +#line 1243 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 140: /* Line 1455 of yacc.c */ -#line 1243 "program_parse.y" +#line 1244 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 141: /* Line 1455 of yacc.c */ -#line 1244 "program_parse.y" +#line 1245 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 142: /* Line 1455 of yacc.c */ -#line 1245 "program_parse.y" +#line 1246 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 143: /* Line 1455 of yacc.c */ -#line 1246 "program_parse.y" +#line 1247 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 144: /* Line 1455 of yacc.c */ -#line 1247 "program_parse.y" +#line 1248 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 145: /* Line 1455 of yacc.c */ -#line 1251 "program_parse.y" +#line 1252 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_MATERIAL; @@ -3492,7 +3493,7 @@ yyreduce: case 146: /* Line 1455 of yacc.c */ -#line 1260 "program_parse.y" +#line 1261 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -3501,7 +3502,7 @@ yyreduce: case 147: /* Line 1455 of yacc.c */ -#line 1264 "program_parse.y" +#line 1265 "program_parse.y" { (yyval.integer) = STATE_EMISSION; ;} @@ -3510,7 +3511,7 @@ yyreduce: case 148: /* Line 1455 of yacc.c */ -#line 1268 "program_parse.y" +#line 1269 "program_parse.y" { (yyval.integer) = STATE_SHININESS; ;} @@ -3519,7 +3520,7 @@ yyreduce: case 149: /* Line 1455 of yacc.c */ -#line 1274 "program_parse.y" +#line 1275 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHT; @@ -3531,7 +3532,7 @@ yyreduce: case 150: /* Line 1455 of yacc.c */ -#line 1283 "program_parse.y" +#line 1284 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -3540,7 +3541,7 @@ yyreduce: case 151: /* Line 1455 of yacc.c */ -#line 1287 "program_parse.y" +#line 1288 "program_parse.y" { (yyval.integer) = STATE_POSITION; ;} @@ -3549,7 +3550,7 @@ yyreduce: case 152: /* Line 1455 of yacc.c */ -#line 1291 "program_parse.y" +#line 1292 "program_parse.y" { if (!state->ctx->Extensions.EXT_point_parameters) { yyerror(& (yylsp[(1) - (1)]), state, "GL_ARB_point_parameters not supported"); @@ -3563,7 +3564,7 @@ yyreduce: case 153: /* Line 1455 of yacc.c */ -#line 1300 "program_parse.y" +#line 1301 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} @@ -3572,7 +3573,7 @@ yyreduce: case 154: /* Line 1455 of yacc.c */ -#line 1304 "program_parse.y" +#line 1305 "program_parse.y" { (yyval.integer) = STATE_HALF_VECTOR; ;} @@ -3581,7 +3582,7 @@ yyreduce: case 155: /* Line 1455 of yacc.c */ -#line 1310 "program_parse.y" +#line 1311 "program_parse.y" { (yyval.integer) = STATE_SPOT_DIRECTION; ;} @@ -3590,7 +3591,7 @@ yyreduce: case 156: /* Line 1455 of yacc.c */ -#line 1316 "program_parse.y" +#line 1317 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (2)].state)[1]; @@ -3600,7 +3601,7 @@ yyreduce: case 157: /* Line 1455 of yacc.c */ -#line 1323 "program_parse.y" +#line 1324 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_AMBIENT; @@ -3610,7 +3611,7 @@ yyreduce: case 158: /* Line 1455 of yacc.c */ -#line 1328 "program_parse.y" +#line 1329 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_SCENECOLOR; @@ -3621,7 +3622,7 @@ yyreduce: case 159: /* Line 1455 of yacc.c */ -#line 1336 "program_parse.y" +#line 1337 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTPROD; @@ -3634,7 +3635,7 @@ yyreduce: case 161: /* Line 1455 of yacc.c */ -#line 1348 "program_parse.y" +#line 1349 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(3) - (3)].integer); @@ -3645,7 +3646,7 @@ yyreduce: case 162: /* Line 1455 of yacc.c */ -#line 1356 "program_parse.y" +#line 1357 "program_parse.y" { (yyval.integer) = STATE_TEXENV_COLOR; ;} @@ -3654,7 +3655,7 @@ yyreduce: case 163: /* Line 1455 of yacc.c */ -#line 1362 "program_parse.y" +#line 1363 "program_parse.y" { (yyval.integer) = STATE_AMBIENT; ;} @@ -3663,7 +3664,7 @@ yyreduce: case 164: /* Line 1455 of yacc.c */ -#line 1366 "program_parse.y" +#line 1367 "program_parse.y" { (yyval.integer) = STATE_DIFFUSE; ;} @@ -3672,7 +3673,7 @@ yyreduce: case 165: /* Line 1455 of yacc.c */ -#line 1370 "program_parse.y" +#line 1371 "program_parse.y" { (yyval.integer) = STATE_SPECULAR; ;} @@ -3681,7 +3682,7 @@ yyreduce: case 166: /* Line 1455 of yacc.c */ -#line 1376 "program_parse.y" +#line 1377 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxLights) { yyerror(& (yylsp[(1) - (1)]), state, "invalid light selector"); @@ -3695,7 +3696,7 @@ yyreduce: case 167: /* Line 1455 of yacc.c */ -#line 1387 "program_parse.y" +#line 1388 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_TEXGEN; @@ -3707,7 +3708,7 @@ yyreduce: case 168: /* Line 1455 of yacc.c */ -#line 1396 "program_parse.y" +#line 1397 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S; ;} @@ -3716,7 +3717,7 @@ yyreduce: case 169: /* Line 1455 of yacc.c */ -#line 1400 "program_parse.y" +#line 1401 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_OBJECT_S; ;} @@ -3725,7 +3726,7 @@ yyreduce: case 170: /* Line 1455 of yacc.c */ -#line 1405 "program_parse.y" +#line 1406 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S; ;} @@ -3734,7 +3735,7 @@ yyreduce: case 171: /* Line 1455 of yacc.c */ -#line 1409 "program_parse.y" +#line 1410 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S; ;} @@ -3743,7 +3744,7 @@ yyreduce: case 172: /* Line 1455 of yacc.c */ -#line 1413 "program_parse.y" +#line 1414 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S; ;} @@ -3752,7 +3753,7 @@ yyreduce: case 173: /* Line 1455 of yacc.c */ -#line 1417 "program_parse.y" +#line 1418 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S; ;} @@ -3761,7 +3762,7 @@ yyreduce: case 174: /* Line 1455 of yacc.c */ -#line 1423 "program_parse.y" +#line 1424 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); @@ -3771,7 +3772,7 @@ yyreduce: case 175: /* Line 1455 of yacc.c */ -#line 1430 "program_parse.y" +#line 1431 "program_parse.y" { (yyval.integer) = STATE_FOG_COLOR; ;} @@ -3780,7 +3781,7 @@ yyreduce: case 176: /* Line 1455 of yacc.c */ -#line 1434 "program_parse.y" +#line 1435 "program_parse.y" { (yyval.integer) = STATE_FOG_PARAMS; ;} @@ -3789,7 +3790,7 @@ yyreduce: case 177: /* Line 1455 of yacc.c */ -#line 1440 "program_parse.y" +#line 1441 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_CLIPPLANE; @@ -3800,7 +3801,7 @@ yyreduce: case 178: /* Line 1455 of yacc.c */ -#line 1448 "program_parse.y" +#line 1449 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxClipPlanes) { yyerror(& (yylsp[(1) - (1)]), state, "invalid clip plane selector"); @@ -3814,7 +3815,7 @@ yyreduce: case 179: /* Line 1455 of yacc.c */ -#line 1459 "program_parse.y" +#line 1460 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); @@ -3824,7 +3825,7 @@ yyreduce: case 180: /* Line 1455 of yacc.c */ -#line 1466 "program_parse.y" +#line 1467 "program_parse.y" { (yyval.integer) = STATE_POINT_SIZE; ;} @@ -3833,7 +3834,7 @@ yyreduce: case 181: /* Line 1455 of yacc.c */ -#line 1470 "program_parse.y" +#line 1471 "program_parse.y" { (yyval.integer) = STATE_POINT_ATTENUATION; ;} @@ -3842,7 +3843,7 @@ yyreduce: case 182: /* Line 1455 of yacc.c */ -#line 1476 "program_parse.y" +#line 1477 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (5)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (5)].state)[1]; @@ -3855,7 +3856,7 @@ yyreduce: case 183: /* Line 1455 of yacc.c */ -#line 1486 "program_parse.y" +#line 1487 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (2)].state)[1]; @@ -3868,7 +3869,7 @@ yyreduce: case 184: /* Line 1455 of yacc.c */ -#line 1496 "program_parse.y" +#line 1497 "program_parse.y" { (yyval.state)[2] = 0; (yyval.state)[3] = 3; @@ -3878,7 +3879,7 @@ yyreduce: case 185: /* Line 1455 of yacc.c */ -#line 1501 "program_parse.y" +#line 1502 "program_parse.y" { /* It seems logical that the matrix row range specifier would have * to specify a range or more than one row (i.e., $5 > $3). @@ -3899,7 +3900,7 @@ yyreduce: case 186: /* Line 1455 of yacc.c */ -#line 1519 "program_parse.y" +#line 1520 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (3)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (3)].state)[1]; @@ -3910,7 +3911,7 @@ yyreduce: case 187: /* Line 1455 of yacc.c */ -#line 1527 "program_parse.y" +#line 1528 "program_parse.y" { (yyval.integer) = 0; ;} @@ -3919,7 +3920,7 @@ yyreduce: case 188: /* Line 1455 of yacc.c */ -#line 1531 "program_parse.y" +#line 1532 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -3928,7 +3929,7 @@ yyreduce: case 189: /* Line 1455 of yacc.c */ -#line 1537 "program_parse.y" +#line 1538 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVERSE; ;} @@ -3937,7 +3938,7 @@ yyreduce: case 190: /* Line 1455 of yacc.c */ -#line 1541 "program_parse.y" +#line 1542 "program_parse.y" { (yyval.integer) = STATE_MATRIX_TRANSPOSE; ;} @@ -3946,7 +3947,7 @@ yyreduce: case 191: /* Line 1455 of yacc.c */ -#line 1545 "program_parse.y" +#line 1546 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVTRANS; ;} @@ -3955,7 +3956,7 @@ yyreduce: case 192: /* Line 1455 of yacc.c */ -#line 1551 "program_parse.y" +#line 1552 "program_parse.y" { if ((yyvsp[(1) - (1)].integer) > 3) { yyerror(& (yylsp[(1) - (1)]), state, "invalid matrix row reference"); @@ -3969,7 +3970,7 @@ yyreduce: case 193: /* Line 1455 of yacc.c */ -#line 1562 "program_parse.y" +#line 1563 "program_parse.y" { (yyval.state)[0] = STATE_MODELVIEW_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); @@ -3979,7 +3980,7 @@ yyreduce: case 194: /* Line 1455 of yacc.c */ -#line 1567 "program_parse.y" +#line 1568 "program_parse.y" { (yyval.state)[0] = STATE_PROJECTION_MATRIX; (yyval.state)[1] = 0; @@ -3989,7 +3990,7 @@ yyreduce: case 195: /* Line 1455 of yacc.c */ -#line 1572 "program_parse.y" +#line 1573 "program_parse.y" { (yyval.state)[0] = STATE_MVP_MATRIX; (yyval.state)[1] = 0; @@ -3999,7 +4000,7 @@ yyreduce: case 196: /* Line 1455 of yacc.c */ -#line 1577 "program_parse.y" +#line 1578 "program_parse.y" { (yyval.state)[0] = STATE_TEXTURE_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); @@ -4009,7 +4010,7 @@ yyreduce: case 197: /* Line 1455 of yacc.c */ -#line 1582 "program_parse.y" +#line 1583 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; @@ -4019,7 +4020,7 @@ yyreduce: case 198: /* Line 1455 of yacc.c */ -#line 1587 "program_parse.y" +#line 1588 "program_parse.y" { (yyval.state)[0] = STATE_PROGRAM_MATRIX; (yyval.state)[1] = (yyvsp[(3) - (4)].integer); @@ -4029,7 +4030,7 @@ yyreduce: case 199: /* Line 1455 of yacc.c */ -#line 1594 "program_parse.y" +#line 1595 "program_parse.y" { (yyval.integer) = 0; ;} @@ -4038,7 +4039,7 @@ yyreduce: case 200: /* Line 1455 of yacc.c */ -#line 1598 "program_parse.y" +#line 1599 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -4047,7 +4048,7 @@ yyreduce: case 201: /* Line 1455 of yacc.c */ -#line 1603 "program_parse.y" +#line 1604 "program_parse.y" { /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix * zero is valid. @@ -4064,7 +4065,7 @@ yyreduce: case 202: /* Line 1455 of yacc.c */ -#line 1616 "program_parse.y" +#line 1617 "program_parse.y" { /* Since GL_ARB_matrix_palette isn't supported, just let any value * through here. The error will be generated later. @@ -4076,7 +4077,7 @@ yyreduce: case 203: /* Line 1455 of yacc.c */ -#line 1624 "program_parse.y" +#line 1625 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxProgramMatrices) { yyerror(& (yylsp[(1) - (1)]), state, "invalid program matrix selector"); @@ -4090,7 +4091,7 @@ yyreduce: case 204: /* Line 1455 of yacc.c */ -#line 1635 "program_parse.y" +#line 1636 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_DEPTH_RANGE; @@ -4100,7 +4101,7 @@ yyreduce: case 209: /* Line 1455 of yacc.c */ -#line 1647 "program_parse.y" +#line 1648 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4113,7 +4114,7 @@ yyreduce: case 210: /* Line 1455 of yacc.c */ -#line 1657 "program_parse.y" +#line 1658 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); @@ -4123,7 +4124,7 @@ yyreduce: case 211: /* Line 1455 of yacc.c */ -#line 1662 "program_parse.y" +#line 1663 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); @@ -4133,7 +4134,7 @@ yyreduce: case 212: /* Line 1455 of yacc.c */ -#line 1669 "program_parse.y" +#line 1670 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4146,7 +4147,7 @@ yyreduce: case 213: /* Line 1455 of yacc.c */ -#line 1679 "program_parse.y" +#line 1680 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4159,7 +4160,7 @@ yyreduce: case 214: /* Line 1455 of yacc.c */ -#line 1688 "program_parse.y" +#line 1689 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); @@ -4169,7 +4170,7 @@ yyreduce: case 215: /* Line 1455 of yacc.c */ -#line 1693 "program_parse.y" +#line 1694 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); @@ -4179,7 +4180,7 @@ yyreduce: case 216: /* Line 1455 of yacc.c */ -#line 1700 "program_parse.y" +#line 1701 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4192,7 +4193,7 @@ yyreduce: case 217: /* Line 1455 of yacc.c */ -#line 1710 "program_parse.y" +#line 1711 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxEnvParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid environment parameter reference"); @@ -4205,7 +4206,7 @@ yyreduce: case 218: /* Line 1455 of yacc.c */ -#line 1720 "program_parse.y" +#line 1721 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxLocalParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid local parameter reference"); @@ -4218,7 +4219,7 @@ yyreduce: case 223: /* Line 1455 of yacc.c */ -#line 1735 "program_parse.y" +#line 1736 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4231,7 +4232,7 @@ yyreduce: case 224: /* Line 1455 of yacc.c */ -#line 1745 "program_parse.y" +#line 1746 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4244,7 +4245,7 @@ yyreduce: case 225: /* Line 1455 of yacc.c */ -#line 1753 "program_parse.y" +#line 1754 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (float) (yyvsp[(1) - (1)].integer); @@ -4257,7 +4258,7 @@ yyreduce: case 226: /* Line 1455 of yacc.c */ -#line 1763 "program_parse.y" +#line 1764 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (3)].real); @@ -4270,7 +4271,7 @@ yyreduce: case 227: /* Line 1455 of yacc.c */ -#line 1771 "program_parse.y" +#line 1772 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (5)].real); @@ -4283,7 +4284,7 @@ yyreduce: case 228: /* Line 1455 of yacc.c */ -#line 1780 "program_parse.y" +#line 1781 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (7)].real); @@ -4296,7 +4297,7 @@ yyreduce: case 229: /* Line 1455 of yacc.c */ -#line 1789 "program_parse.y" +#line 1790 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (9)].real); @@ -4309,7 +4310,7 @@ yyreduce: case 230: /* Line 1455 of yacc.c */ -#line 1799 "program_parse.y" +#line 1800 "program_parse.y" { (yyval.real) = ((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].real) : (yyvsp[(2) - (2)].real); ;} @@ -4318,7 +4319,7 @@ yyreduce: case 231: /* Line 1455 of yacc.c */ -#line 1803 "program_parse.y" +#line 1804 "program_parse.y" { (yyval.real) = (float)(((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].integer) : (yyvsp[(2) - (2)].integer)); ;} @@ -4327,42 +4328,42 @@ yyreduce: case 232: /* Line 1455 of yacc.c */ -#line 1808 "program_parse.y" +#line 1809 "program_parse.y" { (yyval.negate) = FALSE; ;} break; case 233: /* Line 1455 of yacc.c */ -#line 1809 "program_parse.y" +#line 1810 "program_parse.y" { (yyval.negate) = TRUE; ;} break; case 234: /* Line 1455 of yacc.c */ -#line 1810 "program_parse.y" +#line 1811 "program_parse.y" { (yyval.negate) = FALSE; ;} break; case 235: /* Line 1455 of yacc.c */ -#line 1813 "program_parse.y" +#line 1814 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; case 237: /* Line 1455 of yacc.c */ -#line 1816 "program_parse.y" +#line 1817 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; case 239: /* Line 1455 of yacc.c */ -#line 1820 "program_parse.y" +#line 1821 "program_parse.y" { if (!declare_variable(state, (yyvsp[(3) - (3)].string), (yyvsp[(0) - (3)].integer), & (yylsp[(3) - (3)]))) { YYERROR; @@ -4373,7 +4374,7 @@ yyreduce: case 240: /* Line 1455 of yacc.c */ -#line 1826 "program_parse.y" +#line 1827 "program_parse.y" { if (!declare_variable(state, (yyvsp[(1) - (1)].string), (yyvsp[(0) - (1)].integer), & (yylsp[(1) - (1)]))) { YYERROR; @@ -4384,7 +4385,7 @@ yyreduce: case 241: /* Line 1455 of yacc.c */ -#line 1834 "program_parse.y" +#line 1835 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (4)].string), at_output, & (yylsp[(2) - (4)])); @@ -4400,7 +4401,7 @@ yyreduce: case 242: /* Line 1455 of yacc.c */ -#line 1847 "program_parse.y" +#line 1848 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_HPOS; @@ -4414,7 +4415,7 @@ yyreduce: case 243: /* Line 1455 of yacc.c */ -#line 1856 "program_parse.y" +#line 1857 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_FOGC; @@ -4428,7 +4429,7 @@ yyreduce: case 244: /* Line 1455 of yacc.c */ -#line 1865 "program_parse.y" +#line 1866 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (2)].result); ;} @@ -4437,7 +4438,7 @@ yyreduce: case 245: /* Line 1455 of yacc.c */ -#line 1869 "program_parse.y" +#line 1870 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_PSIZ; @@ -4451,7 +4452,7 @@ yyreduce: case 246: /* Line 1455 of yacc.c */ -#line 1878 "program_parse.y" +#line 1879 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_TEX0 + (yyvsp[(3) - (3)].integer); @@ -4465,7 +4466,7 @@ yyreduce: case 247: /* Line 1455 of yacc.c */ -#line 1887 "program_parse.y" +#line 1888 "program_parse.y" { if (state->mode == ARB_fragment) { (yyval.result) = FRAG_RESULT_DEPTH; @@ -4479,7 +4480,7 @@ yyreduce: case 248: /* Line 1455 of yacc.c */ -#line 1898 "program_parse.y" +#line 1899 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (3)].integer) + (yyvsp[(3) - (3)].integer); ;} @@ -4488,7 +4489,7 @@ yyreduce: case 249: /* Line 1455 of yacc.c */ -#line 1904 "program_parse.y" +#line 1905 "program_parse.y" { (yyval.integer) = (state->mode == ARB_vertex) ? VERT_RESULT_COL0 @@ -4499,7 +4500,7 @@ yyreduce: case 250: /* Line 1455 of yacc.c */ -#line 1910 "program_parse.y" +#line 1911 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_COL0; @@ -4513,7 +4514,7 @@ yyreduce: case 251: /* Line 1455 of yacc.c */ -#line 1919 "program_parse.y" +#line 1920 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_BFC0; @@ -4527,7 +4528,7 @@ yyreduce: case 252: /* Line 1455 of yacc.c */ -#line 1930 "program_parse.y" +#line 1931 "program_parse.y" { (yyval.integer) = 0; ;} @@ -4536,7 +4537,7 @@ yyreduce: case 253: /* Line 1455 of yacc.c */ -#line 1934 "program_parse.y" +#line 1935 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 0; @@ -4550,7 +4551,7 @@ yyreduce: case 254: /* Line 1455 of yacc.c */ -#line 1943 "program_parse.y" +#line 1944 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 1; @@ -4564,91 +4565,91 @@ yyreduce: case 255: /* Line 1455 of yacc.c */ -#line 1953 "program_parse.y" +#line 1954 "program_parse.y" { (yyval.integer) = 0; ;} break; case 256: /* Line 1455 of yacc.c */ -#line 1954 "program_parse.y" +#line 1955 "program_parse.y" { (yyval.integer) = 0; ;} break; case 257: /* Line 1455 of yacc.c */ -#line 1955 "program_parse.y" +#line 1956 "program_parse.y" { (yyval.integer) = 1; ;} break; case 258: /* Line 1455 of yacc.c */ -#line 1958 "program_parse.y" +#line 1959 "program_parse.y" { (yyval.integer) = 0; ;} break; case 259: /* Line 1455 of yacc.c */ -#line 1959 "program_parse.y" +#line 1960 "program_parse.y" { (yyval.integer) = 0; ;} break; case 260: /* Line 1455 of yacc.c */ -#line 1960 "program_parse.y" +#line 1961 "program_parse.y" { (yyval.integer) = 1; ;} break; case 261: /* Line 1455 of yacc.c */ -#line 1963 "program_parse.y" +#line 1964 "program_parse.y" { (yyval.integer) = 0; ;} break; case 262: /* Line 1455 of yacc.c */ -#line 1964 "program_parse.y" +#line 1965 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 263: /* Line 1455 of yacc.c */ -#line 1967 "program_parse.y" +#line 1968 "program_parse.y" { (yyval.integer) = 0; ;} break; case 264: /* Line 1455 of yacc.c */ -#line 1968 "program_parse.y" +#line 1969 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 265: /* Line 1455 of yacc.c */ -#line 1971 "program_parse.y" +#line 1972 "program_parse.y" { (yyval.integer) = 0; ;} break; case 266: /* Line 1455 of yacc.c */ -#line 1972 "program_parse.y" +#line 1973 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 267: /* Line 1455 of yacc.c */ -#line 1976 "program_parse.y" +#line 1977 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureCoordUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture coordinate unit selector"); @@ -4662,7 +4663,7 @@ yyreduce: case 268: /* Line 1455 of yacc.c */ -#line 1987 "program_parse.y" +#line 1988 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureImageUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture image unit selector"); @@ -4676,7 +4677,7 @@ yyreduce: case 269: /* Line 1455 of yacc.c */ -#line 1998 "program_parse.y" +#line 1999 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture unit selector"); @@ -4690,7 +4691,7 @@ yyreduce: case 270: /* Line 1455 of yacc.c */ -#line 2009 "program_parse.y" +#line 2010 "program_parse.y" { struct asm_symbol *exist = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(2) - (4)].string)); @@ -4714,7 +4715,7 @@ yyreduce: /* Line 1455 of yacc.c */ -#line 4718 "program_parse.tab.c" +#line 4719 "program_parse.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -4933,7 +4934,42 @@ yyreturn: /* Line 1675 of yacc.c */ -#line 2029 "program_parse.y" +#line 2030 "program_parse.y" + + +void +asm_instruction_set_operands(struct asm_instruction *inst, + const struct prog_dst_register *dst, + const struct asm_src_register *src0, + const struct asm_src_register *src1, + const struct asm_src_register *src2) +{ + /* In the core ARB extensions only the KIL instruction doesn't have a + * destination register. + */ + if (dst == NULL) { + init_dst_reg(& inst->Base.DstReg); + } else { + inst->Base.DstReg = *dst; + } + + inst->Base.SrcReg[0] = src0->Base; + inst->SrcReg[0] = *src0; + + if (src1 != NULL) { + inst->Base.SrcReg[1] = src1->Base; + inst->SrcReg[1] = *src1; + } else { + init_src_reg(& inst->SrcReg[1]); + } + + if (src2 != NULL) { + inst->Base.SrcReg[2] = src2->Base; + inst->SrcReg[2] = *src2; + } else { + init_src_reg(& inst->SrcReg[2]); + } +} struct asm_instruction * @@ -4943,37 +4979,34 @@ asm_instruction_ctor(gl_inst_opcode op, const struct asm_src_register *src1, const struct asm_src_register *src2) { - struct asm_instruction *inst = calloc(1, sizeof(struct asm_instruction)); + struct asm_instruction *inst = CALLOC_STRUCT(asm_instruction); if (inst) { _mesa_init_instructions(& inst->Base, 1); inst->Base.Opcode = op; - /* In the core ARB extensions only the KIL instruction doesn't have a - * destination register. - */ - if (dst == NULL) { - init_dst_reg(& inst->Base.DstReg); - } else { - inst->Base.DstReg = *dst; - } + asm_instruction_set_operands(inst, dst, src0, src1, src2); + } - inst->Base.SrcReg[0] = src0->Base; - inst->SrcReg[0] = *src0; + return inst; +} - if (src1 != NULL) { - inst->Base.SrcReg[1] = src1->Base; - inst->SrcReg[1] = *src1; - } else { - init_src_reg(& inst->SrcReg[1]); - } - if (src2 != NULL) { - inst->Base.SrcReg[2] = src2->Base; - inst->SrcReg[2] = *src2; - } else { - init_src_reg(& inst->SrcReg[2]); - } +struct asm_instruction * +asm_instruction_copy_ctor(const struct prog_instruction *base, + const struct prog_dst_register *dst, + const struct asm_src_register *src0, + const struct asm_src_register *src1, + const struct asm_src_register *src2) +{ + struct asm_instruction *inst = CALLOC_STRUCT(asm_instruction); + + if (inst) { + _mesa_init_instructions(& inst->Base, 1); + inst->Base.Opcode = base->Opcode; + inst->Base.SaturateMode = base->SaturateMode; + + asm_instruction_set_operands(inst, dst, src0, src1, src2); } return inst; diff --git a/src/mesa/shader/program_parse.tab.h b/src/mesa/shader/program_parse.tab.h index 7ab6f6b23e..5f89532d65 100644 --- a/src/mesa/shader/program_parse.tab.h +++ b/src/mesa/shader/program_parse.tab.h @@ -153,7 +153,7 @@ typedef union YYSTYPE { /* Line 1676 of yacc.c */ -#line 107 "program_parse.y" +#line 116 "program_parse.y" struct asm_instruction *inst; struct asm_symbol *sym; diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index 32aa9d503f..4e2912d1c4 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -68,10 +68,19 @@ static void init_dst_reg(struct prog_dst_register *r); static void init_src_reg(struct asm_src_register *r); +static void asm_instruction_set_operands(struct asm_instruction *inst, + const struct prog_dst_register *dst, const struct asm_src_register *src0, + const struct asm_src_register *src1, const struct asm_src_register *src2); + static struct asm_instruction *asm_instruction_ctor(gl_inst_opcode op, const struct prog_dst_register *dst, const struct asm_src_register *src0, const struct asm_src_register *src1, const struct asm_src_register *src2); +static struct asm_instruction *asm_instruction_copy_ctor( + const struct prog_instruction *base, const struct prog_dst_register *dst, + const struct asm_src_register *src0, const struct asm_src_register *src1, + const struct asm_src_register *src2); + #ifndef FALSE #define FALSE 0 #define TRUE (!FALSE) @@ -358,51 +367,45 @@ ARL_instruction: ARL maskedAddrReg ',' scalarSrcReg VECTORop_instruction: VECTOR_OP maskedDstReg ',' swizzleSrcReg { - $$ = asm_instruction_ctor($1.Opcode, & $2, & $4, NULL, NULL); - $$->Base.SaturateMode = $1.SaturateMode; + $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, NULL, NULL); } ; SCALARop_instruction: SCALAR_OP maskedDstReg ',' scalarSrcReg { - $$ = asm_instruction_ctor($1.Opcode, & $2, & $4, NULL, NULL); - $$->Base.SaturateMode = $1.SaturateMode; + $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, NULL, NULL); } ; BINSCop_instruction: BINSC_OP maskedDstReg ',' scalarSrcReg ',' scalarSrcReg { - $$ = asm_instruction_ctor($1.Opcode, & $2, & $4, & $6, NULL); - $$->Base.SaturateMode = $1.SaturateMode; + $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, & $6, NULL); } ; BINop_instruction: BIN_OP maskedDstReg ',' swizzleSrcReg ',' swizzleSrcReg { - $$ = asm_instruction_ctor($1.Opcode, & $2, & $4, & $6, NULL); - $$->Base.SaturateMode = $1.SaturateMode; + $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, & $6, NULL); } ; TRIop_instruction: TRI_OP maskedDstReg ',' swizzleSrcReg ',' swizzleSrcReg ',' swizzleSrcReg { - $$ = asm_instruction_ctor($1.Opcode, & $2, & $4, & $6, & $8); - $$->Base.SaturateMode = $1.SaturateMode; + $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, & $6, & $8); } ; SAMPLE_instruction: SAMPLE_OP maskedDstReg ',' swizzleSrcReg ',' texImageUnit ',' texTarget { - $$ = asm_instruction_ctor($1.Opcode, & $2, & $4, NULL, NULL); + $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, NULL, NULL); if ($$ != NULL) { const GLbitfield tex_mask = (1U << $6); GLbitfield shadow_tex = 0; GLbitfield target_mask = 0; - $$->Base.SaturateMode = $1.SaturateMode; $$->Base.TexSrcUnit = $6; if ($8 < 0) { @@ -447,14 +450,13 @@ KIL_instruction: KIL swizzleSrcReg TXD_instruction: TXD_OP maskedDstReg ',' swizzleSrcReg ',' swizzleSrcReg ',' swizzleSrcReg ',' texImageUnit ',' texTarget { - $$ = asm_instruction_ctor($1.Opcode, & $2, & $4, & $6, & $8); + $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, & $6, & $8); if ($$ != NULL) { const GLbitfield tex_mask = (1U << $10); GLbitfield shadow_tex = 0; GLbitfield target_mask = 0; - $$->Base.SaturateMode = $1.SaturateMode; $$->Base.TexSrcUnit = $10; if ($12 < 0) { @@ -518,8 +520,7 @@ SWZ_instruction: SWZ maskedDstReg ',' srcReg ',' extendedSwizzle $4.Base.Swizzle = $6.swizzle; $4.Base.Negate = $6.mask; - $$ = asm_instruction_ctor(OPCODE_SWZ, & $2, & $4, NULL, NULL); - $$->Base.SaturateMode = $1.SaturateMode; + $$ = asm_instruction_copy_ctor(& $1, & $2, & $4, NULL, NULL); } ; @@ -2028,6 +2029,41 @@ ALIAS_statement: ALIAS IDENTIFIER '=' IDENTIFIER %% +void +asm_instruction_set_operands(struct asm_instruction *inst, + const struct prog_dst_register *dst, + const struct asm_src_register *src0, + const struct asm_src_register *src1, + const struct asm_src_register *src2) +{ + /* In the core ARB extensions only the KIL instruction doesn't have a + * destination register. + */ + if (dst == NULL) { + init_dst_reg(& inst->Base.DstReg); + } else { + inst->Base.DstReg = *dst; + } + + inst->Base.SrcReg[0] = src0->Base; + inst->SrcReg[0] = *src0; + + if (src1 != NULL) { + inst->Base.SrcReg[1] = src1->Base; + inst->SrcReg[1] = *src1; + } else { + init_src_reg(& inst->SrcReg[1]); + } + + if (src2 != NULL) { + inst->Base.SrcReg[2] = src2->Base; + inst->SrcReg[2] = *src2; + } else { + init_src_reg(& inst->SrcReg[2]); + } +} + + struct asm_instruction * asm_instruction_ctor(gl_inst_opcode op, const struct prog_dst_register *dst, @@ -2035,37 +2071,34 @@ asm_instruction_ctor(gl_inst_opcode op, const struct asm_src_register *src1, const struct asm_src_register *src2) { - struct asm_instruction *inst = calloc(1, sizeof(struct asm_instruction)); + struct asm_instruction *inst = CALLOC_STRUCT(asm_instruction); if (inst) { _mesa_init_instructions(& inst->Base, 1); inst->Base.Opcode = op; - /* In the core ARB extensions only the KIL instruction doesn't have a - * destination register. - */ - if (dst == NULL) { - init_dst_reg(& inst->Base.DstReg); - } else { - inst->Base.DstReg = *dst; - } + asm_instruction_set_operands(inst, dst, src0, src1, src2); + } - inst->Base.SrcReg[0] = src0->Base; - inst->SrcReg[0] = *src0; + return inst; +} - if (src1 != NULL) { - inst->Base.SrcReg[1] = src1->Base; - inst->SrcReg[1] = *src1; - } else { - init_src_reg(& inst->SrcReg[1]); - } - if (src2 != NULL) { - inst->Base.SrcReg[2] = src2->Base; - inst->SrcReg[2] = *src2; - } else { - init_src_reg(& inst->SrcReg[2]); - } +struct asm_instruction * +asm_instruction_copy_ctor(const struct prog_instruction *base, + const struct prog_dst_register *dst, + const struct asm_src_register *src0, + const struct asm_src_register *src1, + const struct asm_src_register *src2) +{ + struct asm_instruction *inst = CALLOC_STRUCT(asm_instruction); + + if (inst) { + _mesa_init_instructions(& inst->Base, 1); + inst->Base.Opcode = base->Opcode; + inst->Base.SaturateMode = base->SaturateMode; + + asm_instruction_set_operands(inst, dst, src0, src1, src2); } return inst; -- cgit v1.2.3 From d0adebb8d5ef680590b0f281a20516318c0b8b62 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 4 Sep 2009 17:27:27 -0700 Subject: NV fp parser: Support instruction and TEMP / OUTPUT sizes Adds support for declaring TEMP and OUTPUT variables as 'LONG' or 'SHORT' precision. The precision specifiers are parsed, but they are currently ignored. Some support for this may be added in the future, but neither Intel hardware nor, as far as I'm aware, Radeon hardware support multiple precisions. Also adds support for instruction precision ('X', 'H', and 'R') suffixes and instruction condition code output ('C') suffix. This results in a fairly major change to the lexer. Instructions are matched with all the possible suffix strings. The suffix string are then carved off by a context (i.e., which program mode and options are set) aware parser that converts the suffixes to bits in prog_instruction. This could have been handled in the same way _SAT was originally handled in the lexer, but it would have resulted in a very large lexer with lots of opportunity for cut-and-paste errors. --- src/mesa/shader/lex.yy.c | 1874 +++++++++++++++------------------ src/mesa/shader/program_lexer.l | 194 ++-- src/mesa/shader/program_parse.tab.c | 776 +++++++------- src/mesa/shader/program_parse.y | 50 +- src/mesa/shader/program_parse_extra.c | 61 ++ src/mesa/shader/program_parser.h | 14 + 6 files changed, 1463 insertions(+), 1506 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/lex.yy.c b/src/mesa/shader/lex.yy.c index 5bde12a6b7..d71a13c3bd 100644 --- a/src/mesa/shader/lex.yy.c +++ b/src/mesa/shader/lex.yy.c @@ -357,8 +357,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 217 -#define YY_END_OF_BUFFER 218 +#define YY_NUM_RULES 168 +#define YY_END_OF_BUFFER 169 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -366,93 +366,100 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[776] = +static yyconst flex_int16_t yy_accept[836] = { 0, - 0, 0, 218, 216, 214, 213, 216, 216, 186, 212, - 188, 188, 188, 188, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 214, 0, 0, 215, 186, - 0, 187, 189, 209, 209, 0, 0, 0, 0, 209, - 0, 0, 0, 0, 0, 0, 0, 166, 210, 167, - 168, 200, 200, 200, 200, 0, 188, 0, 174, 175, - 176, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, - - 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 208, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 207, 207, 0, 0, 0, + 0, 0, 169, 167, 165, 164, 167, 167, 137, 163, + 139, 139, 139, 139, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 165, 0, 0, 166, 137, + 0, 138, 140, 160, 160, 0, 0, 0, 0, 160, + 0, 0, 0, 0, 0, 0, 0, 117, 161, 118, + 119, 151, 151, 151, 151, 0, 139, 0, 125, 126, + 127, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 159, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 158, 158, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 206, 206, 206, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 197, 197, 197, 198, 198, 199, 190, - 189, 190, 0, 191, 11, 13, 186, 15, 186, 186, - 16, 18, 186, 20, 22, 24, 26, 28, 30, 6, - - 32, 34, 35, 37, 39, 42, 40, 44, 45, 47, - 49, 51, 53, 55, 186, 186, 186, 186, 186, 65, - 67, 186, 69, 71, 73, 75, 77, 79, 81, 186, - 83, 85, 87, 89, 91, 93, 95, 186, 97, 99, - 101, 103, 186, 109, 111, 186, 186, 186, 186, 186, - 186, 0, 0, 0, 0, 189, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 127, 128, 130, 0, - 205, 0, 0, 0, 0, 0, 0, 144, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 204, 203, - 203, 156, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 194, 194, 195, 196, 0, 192, 186, 186, - 186, 186, 186, 186, 186, 186, 177, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 57, 186, 61, - 186, 186, 186, 178, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 10, - 186, 186, 186, 186, 105, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 0, 211, 0, 0, 0, 120, - 121, 0, 0, 0, 0, 0, 0, 0, 132, 0, + 157, 157, 157, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 148, 148, 148, 149, 149, 150, 141, + 140, 141, 0, 142, 11, 12, 137, 13, 137, 137, + 14, 15, 137, 16, 17, 18, 19, 20, 21, 6, + + 22, 23, 24, 25, 26, 28, 27, 29, 30, 31, + 32, 33, 34, 35, 137, 137, 137, 137, 137, 40, + 41, 137, 42, 43, 44, 45, 46, 47, 48, 137, + 49, 50, 51, 52, 53, 54, 55, 137, 56, 57, + 58, 59, 137, 62, 63, 137, 137, 137, 137, 137, + 137, 0, 0, 0, 0, 140, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 78, 79, 81, 0, + 156, 0, 0, 0, 0, 0, 0, 95, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 155, 154, + 154, 107, 0, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 145, 145, 146, 147, 0, 143, 11, 11, + 137, 12, 12, 12, 137, 137, 137, 137, 137, 15, + 15, 137, 128, 16, 16, 137, 17, 17, 137, 18, + 18, 137, 19, 19, 137, 20, 20, 137, 21, 21, + 137, 22, 22, 137, 24, 24, 137, 25, 25, 137, + 28, 28, 137, 27, 27, 137, 30, 30, 137, 31, + 31, 137, 32, 32, 137, 33, 33, 137, 34, 34, + 137, 35, 35, 137, 137, 137, 137, 36, 137, 38, + 137, 40, 40, 137, 41, 41, 137, 129, 42, 42, + 137, 43, 43, 137, 137, 45, 45, 137, 46, 46, + + 137, 47, 47, 137, 48, 48, 137, 137, 49, 49, + 137, 50, 50, 137, 51, 51, 137, 52, 52, 137, + 53, 53, 137, 54, 54, 137, 137, 10, 56, 137, + 57, 137, 58, 137, 59, 137, 60, 137, 62, 62, + 137, 137, 137, 137, 137, 137, 137, 137, 0, 162, + 0, 0, 0, 71, 72, 0, 0, 0, 0, 0, + 0, 0, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 202, 0, 0, - 0, 160, 0, 162, 0, 0, 0, 0, 0, 0, - 201, 193, 186, 186, 186, 4, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 9, - 186, 59, 186, 63, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 107, 186, 186, 186, - 186, 186, 116, 186, 186, 0, 0, 0, 0, 0, - 122, 123, 0, 0, 0, 0, 131, 0, 0, 135, - - 138, 0, 0, 0, 0, 0, 0, 0, 149, 150, - 0, 0, 0, 0, 155, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 186, 186, 186, 186, 186, - 186, 5, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 7, 8, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 186, 186, 186, 186, 186, 186, - 186, 186, 186, 186, 117, 186, 113, 0, 0, 0, - 0, 171, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 141, 0, 145, 146, 0, 148, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 164, 165, 0, - 0, 172, 12, 3, 14, 182, 183, 186, 17, 19, - 21, 23, 25, 27, 29, 31, 33, 36, 38, 43, - 41, 46, 48, 50, 52, 54, 56, 186, 186, 186, - 186, 66, 68, 70, 72, 74, 76, 78, 80, 82, - 186, 186, 186, 84, 86, 88, 90, 92, 94, 96, - 98, 100, 102, 104, 186, 186, 110, 112, 186, 115, - 173, 0, 0, 118, 0, 124, 0, 0, 0, 133, - 0, 0, 0, 0, 0, 0, 147, 0, 0, 153, - - 140, 0, 0, 0, 0, 0, 0, 169, 0, 186, - 58, 186, 62, 186, 179, 180, 186, 106, 186, 114, - 0, 0, 0, 0, 126, 129, 134, 0, 0, 139, - 0, 0, 0, 152, 0, 0, 0, 0, 161, 163, - 0, 186, 60, 64, 186, 108, 2, 1, 0, 125, - 0, 137, 0, 143, 151, 0, 0, 158, 159, 170, - 186, 181, 0, 136, 0, 154, 157, 186, 119, 142, - 186, 186, 184, 185, 0 + 0, 153, 0, 0, 0, 111, 0, 113, 0, 0, + 0, 0, 0, 0, 152, 144, 137, 137, 137, 4, + + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 9, 37, 39, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 60, 137, 61, + 137, 137, 137, 137, 137, 67, 137, 137, 0, 0, + 0, 0, 0, 73, 74, 0, 0, 0, 0, 82, + 0, 0, 86, 89, 0, 0, 0, 0, 0, 0, + 0, 100, 101, 0, 0, 0, 0, 106, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 137, 137, + + 137, 137, 137, 137, 5, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 7, 8, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, + 137, 137, 137, 137, 137, 137, 137, 137, 61, 137, + 137, 137, 137, 137, 68, 137, 64, 0, 0, 0, + 0, 122, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 92, 0, 96, 97, 0, 99, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 115, 116, 0, + 0, 123, 11, 3, 12, 133, 134, 137, 14, 15, + + 16, 17, 18, 19, 20, 21, 22, 24, 25, 28, + 27, 30, 31, 32, 33, 34, 35, 40, 41, 42, + 43, 44, 45, 46, 47, 48, 137, 137, 137, 49, + 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, + 137, 137, 62, 63, 137, 66, 124, 0, 0, 69, + 0, 75, 0, 0, 0, 84, 0, 0, 0, 0, + 0, 0, 98, 0, 0, 104, 91, 0, 0, 0, + 0, 0, 0, 120, 0, 137, 130, 131, 137, 60, + 137, 65, 0, 0, 0, 0, 77, 80, 85, 0, + 0, 90, 0, 0, 0, 103, 0, 0, 0, 0, + + 112, 114, 0, 137, 137, 61, 2, 1, 0, 76, + 0, 88, 0, 94, 102, 0, 0, 109, 110, 121, + 137, 132, 0, 87, 0, 105, 108, 137, 70, 93, + 137, 137, 135, 136, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -498,185 +505,199 @@ static yyconst flex_int32_t yy_meta[68] = 2, 2, 2, 2, 2, 2, 2 } ; -static yyconst flex_int16_t yy_base[779] = +static yyconst flex_int16_t yy_base[839] = { 0, - 0, 0, 1054, 1055, 66, 1055, 1048, 1049, 0, 69, - 85, 128, 140, 152, 151, 58, 56, 63, 76, 1027, - 158, 160, 39, 163, 173, 189, 52, 1020, 76, 990, - 989, 1001, 985, 999, 998, 105, 1027, 1039, 1055, 0, - 225, 1055, 218, 160, 157, 20, 123, 66, 119, 192, - 999, 985, 54, 162, 983, 995, 194, 1055, 200, 195, - 98, 227, 196, 231, 235, 293, 305, 316, 1055, 1055, - 1055, 1004, 1017, 1011, 223, 1000, 1003, 999, 1014, 107, - 298, 996, 1010, 246, 996, 1009, 1000, 1013, 990, 1001, - 992, 182, 993, 984, 993, 984, 983, 984, 144, 978, - - 984, 995, 986, 980, 977, 978, 982, 289, 991, 978, - 302, 985, 972, 986, 962, 65, 315, 989, 981, 980, - 956, 941, 936, 953, 929, 934, 960, 279, 949, 293, - 944, 342, 299, 946, 927, 317, 937, 933, 928, 207, - 934, 920, 936, 933, 924, 320, 324, 926, 915, 929, - 932, 914, 929, 916, 913, 920, 284, 928, 227, 288, - 327, 342, 345, 905, 922, 923, 916, 898, 318, 899, - 921, 912, 330, 341, 345, 349, 353, 357, 361, 1055, - 419, 430, 436, 442, 920, 205, 944, 0, 943, 926, - 916, 915, 935, 913, 912, 911, 910, 909, 908, 0, - - 907, 0, 906, 905, 0, 904, 903, 0, 902, 901, - 900, 899, 898, 897, 913, 906, 919, 354, 356, 893, - 892, 898, 890, 889, 888, 887, 886, 885, 884, 905, - 882, 881, 880, 879, 878, 877, 876, 886, 874, 873, - 872, 871, 357, 870, 869, 861, 860, 845, 845, 844, - 843, 886, 858, 846, 448, 456, 430, 850, 418, 847, - 841, 841, 835, 848, 848, 833, 1055, 1055, 848, 836, - 432, 843, 135, 840, 846, 433, 841, 1055, 832, 839, - 838, 841, 827, 826, 830, 825, 330, 830, 439, 442, - 451, 1055, 822, 820, 820, 828, 829, 811, 456, 816, - - 822, 441, 447, 454, 458, 462, 520, 526, 836, 848, - 834, 833, 826, 840, 830, 829, 0, 828, 827, 826, - 825, 824, 823, 822, 821, 820, 819, 818, 817, 816, - 815, 814, 813, 812, 815, 808, 815, 800, 807, 798, - 821, 804, 803, 0, 802, 801, 800, 799, 798, 797, - 796, 799, 794, 793, 792, 791, 790, 789, 788, 0, - 787, 786, 785, 784, 775, 782, 781, 780, 758, 752, - 757, 763, 746, 761, 495, 1055, 760, 750, 754, 1055, - 1055, 744, 753, 739, 756, 739, 742, 736, 1055, 737, - 736, 733, 740, 733, 741, 737, 747, 744, 726, 732, - - 739, 723, 722, 740, 722, 734, 733, 1055, 732, 722, - 726, 1055, 713, 1055, 718, 718, 726, 709, 710, 720, - 1055, 1055, 752, 734, 750, 0, 532, 748, 748, 747, - 746, 745, 744, 743, 742, 741, 740, 739, 738, 737, - 736, 735, 734, 733, 732, 731, 730, 717, 710, 0, - 710, 701, 708, 699, 723, 722, 721, 720, 719, 718, - 717, 716, 715, 693, 713, 712, 711, 710, 709, 708, - 707, 706, 705, 704, 703, 685, 676, 700, 699, 668, - 671, 651, 0, 652, 645, 652, 651, 652, 644, 662, - 1055, 1055, 644, 642, 652, 645, 1055, 640, 657, 345, - - 1055, 648, 632, 633, 642, 633, 632, 632, 1055, 631, - 640, 630, 646, 643, 1055, 642, 640, 629, 630, 626, - 618, 625, 620, 621, 616, 642, 642, 640, 654, 653, - 648, 0, 636, 635, 634, 633, 632, 631, 630, 629, - 628, 627, 626, 625, 624, 623, 622, 621, 620, 619, - 618, 0, 0, 635, 617, 633, 615, 613, 612, 611, - 610, 609, 608, 607, 606, 605, 484, 604, 603, 602, - 601, 600, 599, 598, 597, 596, 595, 594, 611, 593, - 591, 590, 568, 568, 0, 575, 0, 609, 608, 557, - 575, 1055, 570, 565, 558, 554, 566, 556, 554, 550, - - 566, 557, 556, 1055, 1055, 559, 1055, 554, 547, 536, - 547, 539, 543, 556, 551, 554, 536, 1055, 1055, 548, - 537, 1055, 0, 0, 0, 0, 0, 576, 0, 0, + 0, 0, 1283, 1284, 66, 1284, 1277, 1278, 0, 69, + 85, 128, 140, 152, 151, 58, 56, 63, 76, 1256, + 158, 160, 39, 163, 173, 189, 52, 1249, 76, 1219, + 1218, 1230, 1214, 1228, 1227, 105, 1256, 1268, 1284, 0, + 225, 1284, 218, 160, 157, 20, 123, 66, 119, 192, + 1228, 1214, 54, 162, 1212, 1224, 194, 1284, 200, 195, + 98, 227, 196, 231, 235, 293, 305, 316, 1284, 1284, + 1284, 1233, 1246, 1240, 223, 1229, 1232, 1228, 1243, 107, + 298, 1225, 1239, 246, 1225, 1238, 1229, 1242, 1219, 1230, + 1221, 182, 1222, 1213, 1222, 1213, 1212, 1213, 144, 1207, + + 1213, 1224, 1215, 1209, 1206, 1207, 1211, 289, 1220, 1207, + 302, 1214, 1201, 1215, 1191, 65, 315, 1218, 1210, 1209, + 1185, 1170, 1165, 1182, 1158, 1163, 1189, 279, 1178, 293, + 1173, 342, 299, 1175, 1156, 317, 1166, 1162, 1157, 207, + 1163, 1149, 1165, 1162, 1153, 320, 324, 1155, 1144, 1158, + 1161, 1143, 1158, 1145, 1142, 1149, 284, 1157, 227, 288, + 327, 342, 345, 1134, 1151, 1152, 1145, 1127, 318, 1128, + 1150, 1141, 330, 341, 345, 349, 353, 357, 361, 1284, + 419, 430, 436, 442, 440, 441, 1174, 0, 1173, 1156, + 1146, 443, 1166, 444, 451, 468, 470, 472, 471, 0, + + 496, 0, 497, 498, 0, 499, 500, 0, 524, 525, + 526, 536, 537, 553, 1161, 1154, 1167, 354, 356, 561, + 563, 1148, 564, 565, 1140, 580, 590, 591, 592, 1161, + 593, 617, 618, 619, 629, 630, 1138, 1148, 247, 330, + 362, 419, 445, 646, 1136, 1128, 1127, 1112, 1112, 1111, + 1110, 1153, 1125, 1113, 662, 669, 643, 1117, 487, 1114, + 1108, 1108, 1102, 1115, 1115, 1100, 1284, 1284, 1115, 1103, + 646, 1110, 135, 1107, 1113, 561, 1108, 1284, 1099, 1106, + 1105, 1108, 1094, 1093, 1097, 1092, 330, 1097, 650, 653, + 665, 1284, 1089, 1087, 1087, 1095, 1096, 1078, 670, 1083, + + 1089, 432, 460, 486, 579, 655, 715, 722, 1095, 682, + 1102, 1093, 697, 721, 1100, 1099, 1092, 1106, 1096, 1087, + 699, 1094, 0, 1085, 724, 1092, 1083, 725, 1090, 1081, + 726, 1088, 1079, 727, 1086, 1077, 728, 1084, 1075, 729, + 1082, 1073, 730, 1080, 1071, 731, 1078, 1069, 732, 1076, + 1067, 733, 1074, 1065, 734, 1072, 1063, 735, 1070, 1061, + 736, 1068, 1059, 737, 1066, 1057, 738, 1064, 1055, 739, + 1062, 1053, 740, 1060, 1063, 1056, 1063, 0, 1056, 0, + 1071, 1046, 741, 1053, 1044, 742, 1051, 0, 1042, 743, + 1049, 1040, 745, 1047, 1046, 1037, 746, 1044, 1035, 767, + + 1042, 1033, 770, 1040, 1031, 771, 1038, 1041, 1028, 772, + 1035, 1026, 773, 1033, 1024, 774, 1031, 1022, 775, 1029, + 1020, 776, 1027, 1018, 777, 1025, 1024, 0, 1015, 1022, + 1013, 1020, 1011, 1018, 1009, 1016, 778, 1015, 1006, 779, + 1013, 1012, 990, 984, 989, 995, 978, 993, 424, 1284, + 992, 982, 986, 1284, 1284, 976, 985, 971, 988, 971, + 974, 968, 1284, 969, 968, 965, 972, 965, 973, 969, + 979, 976, 958, 964, 971, 955, 954, 972, 954, 966, + 965, 1284, 964, 954, 958, 1284, 945, 1284, 950, 950, + 958, 941, 942, 952, 1284, 1284, 984, 966, 982, 0, + + 788, 980, 980, 979, 978, 977, 976, 975, 974, 973, + 972, 971, 970, 969, 968, 967, 966, 965, 964, 963, + 962, 949, 942, 0, 0, 0, 959, 958, 957, 956, + 955, 954, 953, 952, 951, 929, 949, 948, 947, 946, + 945, 944, 943, 942, 941, 940, 939, 913, 920, 783, + 936, 935, 904, 907, 887, 0, 888, 881, 888, 887, + 888, 880, 898, 1284, 1284, 880, 878, 888, 881, 1284, + 876, 893, 345, 1284, 884, 868, 869, 878, 869, 868, + 868, 1284, 867, 876, 866, 882, 879, 1284, 878, 876, + 865, 866, 862, 854, 861, 856, 857, 852, 878, 878, + + 876, 890, 889, 884, 0, 872, 871, 870, 869, 868, + 867, 866, 865, 864, 863, 862, 861, 860, 859, 858, + 857, 856, 855, 854, 0, 0, 853, 852, 851, 850, + 849, 848, 847, 846, 845, 791, 844, 843, 842, 841, + 840, 839, 838, 837, 836, 835, 834, 851, 825, 832, + 830, 829, 807, 807, 0, 814, 0, 848, 847, 796, + 814, 1284, 809, 804, 797, 793, 805, 795, 793, 789, + 805, 796, 795, 1284, 1284, 798, 1284, 793, 786, 775, + 786, 778, 782, 795, 790, 793, 775, 1284, 1284, 787, + 776, 1284, 0, 0, 0, 0, 0, 815, 0, 0, + + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 811, 803, 790, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 557, 574, 555, - 572, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 568, 567, 565, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 550, 567, 0, 0, 521, 0, - 0, 572, 571, 1055, 518, 1055, 522, 522, 531, 1055, - 515, 529, 517, 519, 516, 518, 1055, 496, 507, 1055, - - 1055, 511, 507, 500, 497, 497, 510, 1055, 494, 534, - 0, 518, 0, 517, 0, 0, 532, 0, 515, 0, - 67, 187, 172, 202, 1055, 1055, 1055, 219, 243, 1055, - 245, 246, 300, 1055, 292, 315, 332, 340, 1055, 1055, - 357, 406, 0, 0, 402, 0, 1055, 1055, 381, 1055, - 423, 1055, 437, 1055, 1055, 431, 429, 1055, 1055, 1055, - 460, 0, 448, 1055, 444, 1055, 1055, 534, 1055, 1055, - 496, 528, 0, 0, 1055, 565, 546, 568 + 775, 791, 0, 0, 745, 0, 0, 796, 795, 1284, + 737, 1284, 655, 655, 661, 1284, 644, 658, 643, 644, + 635, 620, 1284, 598, 608, 1284, 1284, 604, 586, 579, + 567, 567, 574, 1284, 557, 582, 0, 0, 582, 0, + 565, 0, 582, 580, 539, 525, 1284, 1284, 1284, 527, + 527, 1284, 525, 497, 499, 1284, 478, 451, 439, 441, + + 1284, 1284, 431, 441, 366, 0, 1284, 1284, 21, 1284, + 144, 1284, 176, 1284, 1284, 182, 187, 1284, 1284, 1284, + 220, 0, 235, 1284, 245, 1284, 1284, 424, 1284, 1284, + 327, 373, 0, 0, 1284, 824, 396, 827 } ; -static yyconst flex_int16_t yy_def[779] = +static yyconst flex_int16_t yy_def[839] = { 0, - 775, 1, 775, 775, 775, 775, 775, 776, 777, 775, - 775, 775, 775, 775, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 775, 775, 776, 775, 777, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 778, 775, 775, 775, 775, - 775, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - - 775, 775, 775, 775, 775, 775, 775, 775, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 777, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - - 775, 775, 775, 775, 775, 775, 775, 775, 775, 777, - 777, 777, 777, 777, 777, 777, 777, 777, 777, 777, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 777, 777, 777, 777, 777, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 777, 777, 775, 775, 775, 775, 775, 777, 775, 775, - 777, 777, 777, 777, 0, 775, 775, 775 + 835, 1, 835, 835, 835, 835, 835, 836, 837, 835, + 835, 835, 835, 835, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 835, 835, 836, 835, 837, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 838, 835, 835, 835, 835, + 835, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + + 835, 835, 835, 835, 835, 835, 835, 835, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 837, 837, 837, 837, + + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 837, 837, + + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 837, 837, 837, 837, 837, 837, 837, 837, + + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, + 837, 837, 837, 837, 837, 837, 837, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 837, 837, 837, 837, 837, + 837, 837, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + + 835, 835, 835, 837, 837, 837, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 837, 837, 835, 835, 835, 835, 835, 837, 835, 835, + 837, 837, 837, 837, 0, 835, 835, 835 } ; -static yyconst flex_int16_t yy_nxt[1123] = +static yyconst flex_int16_t yy_nxt[1352] = { 0, 4, 5, 6, 5, 7, 8, 9, 4, 10, 11, 12, 13, 14, 11, 11, 15, 9, 16, 17, 18, @@ -685,7 +706,7 @@ static yyconst flex_int16_t yy_nxt[1123] = 9, 9, 9, 9, 9, 9, 30, 9, 9, 9, 9, 9, 9, 9, 9, 9, 31, 9, 32, 33, 34, 9, 35, 9, 9, 9, 9, 36, 96, 36, - 41, 116, 137, 97, 80, 138, 747, 42, 43, 43, + 41, 116, 137, 97, 80, 138, 823, 42, 43, 43, 43, 43, 43, 43, 77, 81, 78, 119, 82, 117, 83, 238, 79, 66, 67, 67, 67, 67, 67, 67, @@ -697,114 +718,139 @@ static yyconst flex_int16_t yy_nxt[1123] = 67, 67, 67, 67, 67, 218, 171, 219, 70, 68, 66, 67, 67, 67, 67, 67, 67, 72, 139, 73, 71, 68, 140, 68, 144, 92, 74, 145, 98, 88, - 390, 89, 75, 93, 76, 68, 90, 99, 94, 91, - 101, 100, 102, 103, 95, 391, 748, 68, 136, 133, + 464, 89, 75, 93, 76, 68, 90, 99, 94, 91, + 101, 100, 102, 103, 95, 465, 824, 68, 136, 133, 210, 133, 133, 152, 133, 104, 105, 133, 106, 107, 108, 109, 110, 134, 111, 133, 112, 153, 133, 211, - 135, 749, 113, 114, 154, 115, 41, 43, 43, 43, - 43, 43, 43, 146, 147, 157, 310, 132, 165, 133, - 166, 161, 162, 167, 168, 311, 158, 163, 188, 159, - 133, 169, 160, 264, 189, 164, 750, 201, 133, 174, - 173, 175, 176, 132, 751, 265, 128, 129, 46, 47, + 135, 825, 113, 114, 154, 115, 41, 43, 43, 43, + 43, 43, 43, 146, 147, 157, 826, 132, 165, 133, + 166, 161, 162, 167, 168, 827, 158, 163, 188, 159, + 133, 169, 160, 264, 189, 164, 828, 201, 133, 174, + 173, 175, 176, 132, 429, 265, 128, 129, 46, 47, 48, 49, 172, 51, 52, 202, 284, 53, 54, 55, - 56, 57, 58, 130, 60, 61, 285, 752, 131, 753, + 56, 57, 58, 130, 60, 61, 285, 430, 131, 829, 173, 173, 173, 173, 177, 173, 173, 178, 179, 173, - 173, 173, 181, 181, 181, 181, 181, 181, 228, 754, + 173, 173, 181, 181, 181, 181, 181, 181, 228, 830, 196, 197, 182, 66, 67, 67, 67, 67, 67, 67, 198, 232, 229, 183, 68, 184, 184, 184, 184, 184, 184, 240, 134, 241, 254, 233, 281, 286, 182, 135, - 257, 257, 282, 287, 242, 755, 257, 756, 164, 255, + 257, 257, 282, 287, 242, 833, 257, 431, 164, 255, 68, 256, 256, 256, 256, 256, 256, 257, 257, 257, 260, 257, 257, 297, 257, 271, 257, 257, 257, 257, - 757, 257, 340, 298, 257, 257, 338, 405, 257, 365, - 406, 288, 257, 289, 257, 257, 290, 291, 339, 257, - 341, 366, 257, 302, 302, 302, 302, 758, 599, 759, + 432, 257, 380, 298, 257, 257, 378, 479, 257, 433, + 480, 288, 257, 289, 257, 257, 290, 291, 379, 257, + 381, 834, 257, 302, 302, 302, 302, 40, 669, 822, - 257, 600, 760, 257, 302, 302, 302, 302, 303, 302, + 257, 670, 434, 257, 302, 302, 302, 302, 303, 302, 302, 304, 305, 302, 302, 302, 302, 302, 302, 302, 306, 302, 302, 302, 302, 302, 302, 302, 43, 43, - 43, 43, 43, 43, 761, 762, 763, 307, 132, 308, + 43, 43, 43, 43, 831, 832, 435, 307, 132, 308, 308, 308, 308, 308, 308, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 256, 256, 256, - 256, 256, 256, 378, 132, 256, 256, 256, 256, 256, - 256, 376, 376, 376, 376, 764, 379, 376, 394, 376, - 376, 376, 765, 376, 376, 766, 376, 767, 376, 376, - 376, 395, 408, 376, 661, 662, 768, 376, 376, 415, - - 376, 416, 769, 417, 421, 421, 421, 421, 770, 376, - 421, 421, 421, 421, 773, 663, 418, 422, 421, 421, - 421, 421, 421, 421, 421, 421, 421, 421, 421, 308, - 308, 308, 308, 308, 308, 308, 308, 308, 308, 308, - 308, 486, 529, 530, 771, 772, 774, 40, 746, 745, - 744, 743, 742, 741, 740, 739, 738, 487, 737, 736, - 735, 734, 733, 732, 531, 38, 38, 38, 180, 180, - 731, 730, 729, 728, 727, 726, 725, 724, 723, 722, - 721, 720, 719, 718, 717, 716, 715, 714, 713, 712, - 711, 710, 709, 708, 707, 706, 705, 704, 703, 702, - - 701, 700, 699, 698, 697, 696, 695, 694, 693, 692, - 691, 690, 689, 688, 687, 686, 685, 684, 683, 682, - 681, 680, 679, 678, 677, 676, 675, 674, 673, 672, - 671, 670, 669, 668, 667, 666, 665, 664, 660, 659, - 658, 657, 656, 655, 654, 653, 652, 651, 650, 649, - 648, 647, 646, 645, 644, 643, 642, 641, 640, 639, - 638, 637, 636, 635, 634, 633, 632, 631, 630, 629, - 628, 627, 626, 625, 624, 623, 622, 621, 620, 619, - 618, 617, 616, 615, 614, 613, 612, 611, 610, 609, - 608, 607, 606, 605, 604, 603, 602, 601, 598, 597, - - 596, 595, 594, 593, 592, 591, 590, 589, 588, 587, - 586, 585, 584, 583, 582, 581, 580, 579, 578, 577, - 576, 575, 574, 573, 572, 571, 570, 569, 568, 567, - 566, 565, 564, 563, 562, 561, 560, 559, 558, 557, - 556, 555, 554, 553, 552, 551, 550, 549, 548, 547, - 546, 545, 544, 543, 542, 541, 540, 539, 538, 537, - 536, 535, 534, 533, 532, 528, 527, 526, 525, 524, - 523, 522, 521, 520, 519, 518, 517, 516, 515, 514, - 513, 512, 511, 510, 509, 508, 507, 506, 505, 504, - 503, 502, 501, 500, 499, 498, 497, 496, 495, 494, - - 493, 492, 491, 490, 489, 488, 485, 484, 483, 482, - 481, 480, 479, 478, 477, 476, 475, 474, 473, 472, - 471, 470, 469, 468, 467, 466, 465, 464, 463, 462, - 461, 460, 459, 458, 457, 456, 455, 454, 453, 452, - 451, 450, 449, 448, 447, 446, 445, 444, 443, 442, - 441, 440, 439, 438, 437, 436, 435, 434, 433, 432, - 431, 430, 429, 428, 427, 426, 425, 424, 423, 420, - 419, 414, 413, 412, 411, 410, 409, 407, 404, 403, - 402, 401, 400, 399, 398, 397, 396, 393, 392, 389, - 388, 387, 386, 385, 384, 383, 382, 381, 380, 377, - - 288, 260, 375, 374, 373, 372, 371, 370, 369, 368, - 367, 364, 363, 362, 361, 360, 359, 358, 357, 356, - 355, 354, 353, 352, 351, 350, 349, 348, 347, 346, - 345, 344, 343, 342, 337, 336, 335, 334, 333, 332, - 331, 330, 329, 328, 327, 326, 325, 324, 323, 322, - 321, 320, 319, 318, 317, 316, 315, 314, 313, 312, - 309, 301, 300, 299, 296, 295, 294, 293, 292, 283, - 280, 279, 278, 277, 276, 275, 274, 273, 272, 270, - 269, 268, 267, 266, 263, 262, 261, 259, 258, 172, - 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, - - 243, 237, 236, 235, 234, 231, 230, 227, 226, 225, - 224, 223, 222, 221, 220, 217, 216, 215, 214, 213, - 212, 209, 208, 207, 206, 205, 204, 203, 200, 199, - 193, 192, 191, 190, 187, 186, 185, 156, 155, 149, - 148, 39, 127, 126, 125, 124, 123, 122, 121, 118, - 87, 39, 37, 775, 3, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775 + 184, 184, 184, 184, 184, 184, 184, 309, 312, 436, + 320, 324, 310, 313, 132, 321, 325, 437, 327, 821, + 559, 310, 314, 328, 321, 325, 820, 310, 313, 438, + 311, 315, 328, 322, 326, 330, 560, 333, 339, 336, + 331, 329, 334, 340, 337, 495, 495, 495, 495, 331, + + 819, 334, 340, 337, 818, 331, 817, 334, 332, 337, + 335, 341, 338, 342, 345, 348, 351, 354, 343, 346, + 349, 352, 355, 495, 495, 495, 495, 343, 346, 349, + 352, 355, 452, 816, 346, 349, 344, 347, 350, 353, + 356, 357, 360, 363, 815, 453, 358, 361, 364, 496, + 495, 495, 495, 366, 369, 358, 361, 364, 367, 370, + 814, 358, 361, 364, 359, 362, 365, 367, 370, 813, + 372, 812, 811, 367, 370, 373, 368, 371, 382, 810, + 385, 389, 392, 383, 373, 386, 390, 393, 809, 808, + 373, 807, 383, 374, 386, 390, 393, 396, 806, 805, + + 804, 384, 397, 387, 391, 394, 468, 399, 402, 405, + 409, 397, 400, 403, 406, 410, 803, 397, 802, 469, + 398, 400, 403, 406, 410, 801, 800, 400, 403, 406, + 401, 404, 407, 411, 412, 415, 418, 799, 798, 413, + 416, 419, 495, 495, 495, 495, 421, 424, 413, 416, + 419, 422, 425, 797, 413, 416, 419, 414, 417, 420, + 422, 425, 796, 439, 795, 794, 422, 425, 440, 423, + 426, 256, 256, 256, 256, 256, 256, 440, 256, 256, + 256, 256, 256, 256, 450, 450, 441, 450, 450, 793, + 450, 450, 450, 450, 450, 450, 792, 450, 791, 309, + + 450, 450, 790, 789, 450, 788, 482, 450, 450, 787, + 786, 450, 450, 489, 312, 490, 320, 491, 495, 495, + 495, 495, 311, 450, 308, 308, 308, 308, 308, 308, + 492, 308, 308, 308, 308, 308, 308, 315, 312, 322, + 498, 324, 327, 330, 333, 336, 339, 342, 345, 348, + 351, 354, 357, 360, 363, 366, 369, 372, 382, 385, + 389, 315, 392, 396, 326, 329, 332, 335, 338, 341, + 344, 347, 350, 353, 356, 359, 362, 365, 368, 371, + 374, 384, 387, 391, 399, 394, 398, 402, 405, 409, + 412, 415, 418, 421, 424, 548, 439, 785, 602, 603, + + 649, 727, 728, 784, 783, 782, 781, 401, 780, 779, + 404, 407, 411, 414, 417, 420, 423, 426, 549, 441, + 604, 778, 729, 650, 38, 38, 38, 180, 180, 777, + 776, 775, 774, 773, 772, 771, 770, 769, 768, 767, + 766, 765, 764, 763, 762, 761, 760, 759, 758, 757, + 756, 755, 754, 753, 752, 751, 750, 749, 748, 747, + 746, 745, 744, 743, 742, 650, 741, 740, 739, 738, + 737, 736, 735, 734, 733, 732, 731, 730, 726, 725, + 724, 723, 722, 721, 720, 719, 718, 717, 716, 715, + 714, 713, 712, 711, 710, 709, 708, 707, 706, 705, + + 704, 703, 702, 701, 700, 699, 698, 697, 696, 695, + 694, 693, 692, 691, 690, 689, 688, 687, 686, 685, + 684, 683, 682, 681, 680, 679, 678, 677, 676, 675, + 674, 673, 672, 671, 668, 667, 666, 665, 664, 663, + 662, 661, 660, 659, 658, 657, 656, 655, 654, 653, + 652, 651, 648, 549, 647, 646, 645, 644, 643, 642, + 641, 640, 639, 638, 637, 636, 635, 634, 633, 632, + 631, 630, 629, 628, 627, 626, 625, 624, 623, 622, + 621, 620, 619, 618, 617, 616, 615, 614, 613, 612, + 611, 610, 609, 608, 607, 606, 605, 601, 600, 599, + + 598, 597, 596, 595, 594, 593, 592, 591, 590, 589, + 588, 587, 586, 585, 584, 583, 582, 581, 580, 579, + 578, 577, 576, 575, 574, 573, 572, 571, 570, 569, + 568, 567, 566, 565, 564, 563, 562, 561, 558, 557, + 556, 555, 554, 553, 552, 551, 441, 550, 547, 436, + 546, 434, 545, 432, 544, 430, 543, 542, 426, 541, + 423, 540, 420, 539, 417, 538, 414, 537, 411, 536, + 535, 407, 534, 404, 533, 401, 532, 398, 531, 530, + 394, 529, 391, 528, 387, 527, 384, 526, 525, 524, + 523, 522, 521, 374, 520, 371, 519, 368, 518, 365, + + 517, 362, 516, 359, 515, 356, 514, 353, 513, 350, + 512, 347, 511, 344, 510, 341, 509, 338, 508, 335, + 507, 332, 506, 329, 505, 326, 504, 322, 503, 502, + 501, 500, 499, 315, 497, 311, 494, 493, 488, 487, + 486, 485, 484, 483, 481, 478, 477, 476, 475, 474, + 473, 472, 471, 470, 467, 466, 463, 462, 461, 460, + 459, 458, 457, 456, 455, 454, 451, 288, 260, 449, + 448, 447, 446, 445, 444, 443, 442, 428, 427, 408, + 395, 388, 377, 376, 375, 323, 319, 318, 317, 316, + 301, 300, 299, 296, 295, 294, 293, 292, 283, 280, + + 279, 278, 277, 276, 275, 274, 273, 272, 270, 269, + 268, 267, 266, 263, 262, 261, 259, 258, 172, 253, + 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, + 237, 236, 235, 234, 231, 230, 227, 226, 225, 224, + 223, 222, 221, 220, 217, 216, 215, 214, 213, 212, + 209, 208, 207, 206, 205, 204, 203, 200, 199, 193, + 192, 191, 190, 187, 186, 185, 156, 155, 149, 148, + 39, 127, 126, 125, 124, 123, 122, 121, 118, 87, + 39, 37, 835, 3, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835 } ; -static yyconst flex_int16_t yy_chk[1123] = +static yyconst flex_int16_t yy_chk[1352] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -813,7 +859,7 @@ static yyconst flex_int16_t yy_chk[1123] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 23, 5, - 10, 27, 46, 23, 17, 46, 721, 10, 10, 10, + 10, 27, 46, 23, 17, 46, 809, 10, 10, 10, 10, 10, 10, 10, 16, 17, 16, 29, 17, 27, 18, 116, 16, 11, 11, 11, 11, 11, 11, 11, @@ -826,110 +872,135 @@ static yyconst flex_int16_t yy_chk[1123] = 14, 14, 14, 14, 14, 14, 14, 15, 47, 15, 14, 14, 47, 12, 49, 22, 15, 49, 24, 21, 273, 21, 15, 22, 15, 13, 21, 24, 22, 21, - 25, 24, 25, 25, 22, 273, 722, 14, 45, 45, + 25, 24, 25, 25, 22, 273, 811, 14, 45, 45, 92, 44, 44, 54, 45, 25, 26, 44, 26, 26, 26, 26, 26, 44, 26, 45, 26, 54, 44, 92, - 44, 723, 26, 26, 54, 26, 41, 43, 43, 43, - 43, 43, 43, 50, 50, 57, 186, 43, 60, 50, - 60, 59, 59, 60, 60, 186, 57, 59, 75, 57, - 50, 60, 57, 140, 75, 59, 724, 84, 59, 63, - 63, 63, 63, 43, 728, 140, 41, 41, 41, 41, + 44, 813, 26, 26, 54, 26, 41, 43, 43, 43, + 43, 43, 43, 50, 50, 57, 816, 43, 60, 50, + 60, 59, 59, 60, 60, 817, 57, 59, 75, 57, + 50, 60, 57, 140, 75, 59, 821, 84, 59, 63, + 63, 63, 63, 43, 239, 140, 41, 41, 41, 41, 41, 41, 62, 41, 41, 84, 159, 41, 41, 41, - 41, 41, 41, 41, 41, 41, 159, 729, 41, 731, + 41, 41, 41, 41, 41, 41, 159, 239, 41, 823, 62, 62, 62, 62, 64, 64, 64, 64, 65, 65, - 65, 65, 66, 66, 66, 66, 66, 66, 108, 732, + 65, 65, 66, 66, 66, 66, 66, 66, 108, 825, 81, 81, 66, 67, 67, 67, 67, 67, 67, 67, 81, 111, 108, 68, 67, 68, 68, 68, 68, 68, 68, 117, 128, 117, 130, 111, 157, 160, 66, 128, - 133, 133, 157, 160, 117, 733, 133, 735, 130, 132, + 133, 133, 157, 160, 117, 831, 133, 240, 130, 132, 67, 132, 132, 132, 132, 132, 132, 133, 136, 136, 136, 146, 146, 169, 136, 147, 147, 146, 161, 161, - 736, 147, 219, 169, 161, 136, 218, 287, 146, 243, + 240, 147, 219, 169, 161, 136, 218, 287, 146, 241, 287, 161, 147, 162, 162, 161, 163, 163, 218, 162, - 219, 243, 163, 173, 173, 173, 173, 737, 500, 738, + 219, 832, 163, 173, 173, 173, 173, 837, 573, 805, - 162, 500, 741, 163, 174, 174, 174, 174, 175, 175, + 162, 573, 241, 163, 174, 174, 174, 174, 175, 175, 175, 175, 176, 176, 176, 176, 177, 177, 177, 177, 178, 178, 178, 178, 179, 179, 179, 179, 181, 181, - 181, 181, 181, 181, 742, 745, 749, 182, 181, 182, + 181, 181, 181, 181, 828, 828, 242, 182, 181, 182, 182, 182, 182, 182, 182, 183, 183, 183, 183, 183, - 183, 184, 184, 184, 184, 184, 184, 255, 255, 255, - 255, 255, 255, 259, 181, 256, 256, 256, 256, 256, - 256, 257, 257, 271, 271, 751, 259, 257, 276, 271, - 289, 289, 753, 290, 290, 756, 289, 757, 257, 290, - 271, 276, 291, 291, 567, 567, 761, 289, 291, 299, - - 290, 299, 763, 299, 302, 302, 302, 302, 765, 291, - 303, 303, 303, 303, 771, 567, 299, 304, 304, 304, - 304, 305, 305, 305, 305, 306, 306, 306, 306, 307, - 307, 307, 307, 307, 307, 308, 308, 308, 308, 308, - 308, 375, 427, 427, 768, 768, 772, 777, 719, 717, - 714, 712, 710, 709, 707, 706, 705, 375, 704, 703, - 702, 699, 698, 696, 427, 776, 776, 776, 778, 778, - 695, 694, 693, 692, 691, 689, 688, 687, 685, 683, - 682, 679, 676, 675, 663, 662, 661, 651, 650, 649, - 648, 628, 621, 620, 617, 616, 615, 614, 613, 612, - - 611, 610, 609, 608, 606, 603, 602, 601, 600, 599, - 598, 597, 596, 595, 594, 593, 591, 590, 589, 588, - 586, 584, 583, 582, 581, 580, 579, 578, 577, 576, - 575, 574, 573, 572, 571, 570, 569, 568, 566, 565, - 564, 563, 562, 561, 560, 559, 558, 557, 556, 555, - 554, 551, 550, 549, 548, 547, 546, 545, 544, 543, - 542, 541, 540, 539, 538, 537, 536, 535, 534, 533, - 531, 530, 529, 528, 527, 526, 525, 524, 523, 522, - 521, 520, 519, 518, 517, 516, 514, 513, 512, 511, - 510, 508, 507, 506, 505, 504, 503, 502, 499, 498, - - 496, 495, 494, 493, 490, 489, 488, 487, 486, 485, - 484, 482, 481, 480, 479, 478, 477, 476, 475, 474, - 473, 472, 471, 470, 469, 468, 467, 466, 465, 464, - 463, 462, 461, 460, 459, 458, 457, 456, 455, 454, - 453, 452, 451, 449, 448, 447, 446, 445, 444, 443, - 442, 441, 440, 439, 438, 437, 436, 435, 434, 433, - 432, 431, 430, 429, 428, 425, 424, 423, 420, 419, - 418, 417, 416, 415, 413, 411, 410, 409, 407, 406, - 405, 404, 403, 402, 401, 400, 399, 398, 397, 396, - 395, 394, 393, 392, 391, 390, 388, 387, 386, 385, - - 384, 383, 382, 379, 378, 377, 374, 373, 372, 371, - 370, 369, 368, 367, 366, 365, 364, 363, 362, 361, - 359, 358, 357, 356, 355, 354, 353, 352, 351, 350, - 349, 348, 347, 346, 345, 343, 342, 341, 340, 339, - 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, - 328, 327, 326, 325, 324, 323, 322, 321, 320, 319, - 318, 316, 315, 314, 313, 312, 311, 310, 309, 301, - 300, 298, 297, 296, 295, 294, 293, 288, 286, 285, - 284, 283, 282, 281, 280, 279, 277, 275, 274, 272, - 270, 269, 266, 265, 264, 263, 262, 261, 260, 258, - - 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, - 244, 242, 241, 240, 239, 238, 237, 236, 235, 234, - 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, - 223, 222, 221, 220, 217, 216, 215, 214, 213, 212, - 211, 210, 209, 207, 206, 204, 203, 201, 199, 198, - 197, 196, 195, 194, 193, 192, 191, 190, 189, 187, - 185, 172, 171, 170, 168, 167, 166, 165, 164, 158, - 156, 155, 154, 153, 152, 151, 150, 149, 148, 145, - 144, 143, 142, 141, 139, 138, 137, 135, 134, 131, - 129, 127, 126, 125, 124, 123, 122, 121, 120, 119, - - 118, 115, 114, 113, 112, 110, 109, 107, 106, 105, - 104, 103, 102, 101, 100, 98, 97, 96, 95, 94, - 93, 91, 90, 89, 88, 87, 86, 85, 83, 82, - 79, 78, 77, 76, 74, 73, 72, 56, 55, 52, - 51, 38, 37, 35, 34, 33, 32, 31, 30, 28, - 20, 8, 7, 3, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775, 775, 775, 775, 775, 775, 775, 775, 775, - 775, 775 + 183, 184, 184, 184, 184, 184, 184, 185, 186, 242, + 192, 194, 185, 186, 181, 192, 194, 243, 195, 804, + 449, 185, 186, 195, 192, 194, 803, 185, 186, 243, + 185, 186, 195, 192, 194, 196, 449, 197, 199, 198, + 196, 195, 197, 199, 198, 302, 302, 302, 302, 196, + + 800, 197, 199, 198, 799, 196, 798, 197, 196, 198, + 197, 199, 198, 201, 203, 204, 206, 207, 201, 203, + 204, 206, 207, 303, 303, 303, 303, 201, 203, 204, + 206, 207, 259, 797, 203, 204, 201, 203, 204, 206, + 207, 209, 210, 211, 795, 259, 209, 210, 211, 304, + 304, 304, 304, 212, 213, 209, 210, 211, 212, 213, + 794, 209, 210, 211, 209, 210, 211, 212, 213, 793, + 214, 791, 790, 212, 213, 214, 212, 213, 220, 786, + 221, 223, 224, 220, 214, 221, 223, 224, 785, 784, + 214, 783, 220, 214, 221, 223, 224, 226, 781, 779, + + 776, 220, 226, 221, 223, 224, 276, 227, 228, 229, + 231, 226, 227, 228, 229, 231, 775, 226, 773, 276, + 226, 227, 228, 229, 231, 772, 771, 227, 228, 229, + 227, 228, 229, 231, 232, 233, 234, 770, 769, 232, + 233, 234, 305, 305, 305, 305, 235, 236, 232, 233, + 234, 235, 236, 768, 232, 233, 234, 232, 233, 234, + 235, 236, 765, 244, 764, 762, 235, 236, 244, 235, + 236, 255, 255, 255, 255, 255, 255, 244, 256, 256, + 256, 256, 256, 256, 257, 257, 244, 271, 271, 761, + 257, 289, 289, 271, 290, 290, 760, 289, 759, 310, + + 290, 257, 758, 757, 271, 755, 291, 291, 289, 754, + 753, 290, 291, 299, 313, 299, 321, 299, 306, 306, + 306, 306, 310, 291, 307, 307, 307, 307, 307, 307, + 299, 308, 308, 308, 308, 308, 308, 313, 314, 321, + 314, 325, 328, 331, 334, 337, 340, 343, 346, 349, + 352, 355, 358, 361, 364, 367, 370, 373, 383, 386, + 390, 314, 393, 397, 325, 328, 331, 334, 337, 340, + 343, 346, 349, 352, 355, 358, 361, 364, 367, 370, + 373, 383, 386, 390, 400, 393, 397, 403, 406, 410, + 413, 416, 419, 422, 425, 437, 440, 751, 501, 501, + + 550, 636, 636, 749, 748, 745, 742, 400, 741, 729, + 403, 406, 410, 413, 416, 419, 422, 425, 437, 440, + 501, 728, 636, 550, 836, 836, 836, 838, 838, 727, + 698, 691, 690, 687, 686, 685, 684, 683, 682, 681, + 680, 679, 678, 676, 673, 672, 671, 670, 669, 668, + 667, 666, 665, 664, 663, 661, 660, 659, 658, 656, + 654, 653, 652, 651, 650, 649, 648, 647, 646, 645, + 644, 643, 642, 641, 640, 639, 638, 637, 635, 634, + 633, 632, 631, 630, 629, 628, 627, 624, 623, 622, + 621, 620, 619, 618, 617, 616, 615, 614, 613, 612, + + 611, 610, 609, 608, 607, 606, 604, 603, 602, 601, + 600, 599, 598, 597, 596, 595, 594, 593, 592, 591, + 590, 589, 587, 586, 585, 584, 583, 581, 580, 579, + 578, 577, 576, 575, 572, 571, 569, 568, 567, 566, + 563, 562, 561, 560, 559, 558, 557, 555, 554, 553, + 552, 551, 549, 548, 547, 546, 545, 544, 543, 542, + 541, 540, 539, 538, 537, 536, 535, 534, 533, 532, + 531, 530, 529, 528, 527, 523, 522, 521, 520, 519, + 518, 517, 516, 515, 514, 513, 512, 511, 510, 509, + 508, 507, 506, 505, 504, 503, 502, 499, 498, 497, + + 494, 493, 492, 491, 490, 489, 487, 485, 484, 483, + 481, 480, 479, 478, 477, 476, 475, 474, 473, 472, + 471, 470, 469, 468, 467, 466, 465, 464, 462, 461, + 460, 459, 458, 457, 456, 453, 452, 451, 448, 447, + 446, 445, 444, 443, 442, 441, 439, 438, 436, 435, + 434, 433, 432, 431, 430, 429, 427, 426, 424, 423, + 421, 420, 418, 417, 415, 414, 412, 411, 409, 408, + 407, 405, 404, 402, 401, 399, 398, 396, 395, 394, + 392, 391, 389, 387, 385, 384, 382, 381, 379, 377, + 376, 375, 374, 372, 371, 369, 368, 366, 365, 363, + + 362, 360, 359, 357, 356, 354, 353, 351, 350, 348, + 347, 345, 344, 342, 341, 339, 338, 336, 335, 333, + 332, 330, 329, 327, 326, 324, 322, 320, 319, 318, + 317, 316, 315, 312, 311, 309, 301, 300, 298, 297, + 296, 295, 294, 293, 288, 286, 285, 284, 283, 282, + 281, 280, 279, 277, 275, 274, 272, 270, 269, 266, + 265, 264, 263, 262, 261, 260, 258, 254, 253, 252, + 251, 250, 249, 248, 247, 246, 245, 238, 237, 230, + 225, 222, 217, 216, 215, 193, 191, 190, 189, 187, + 172, 171, 170, 168, 167, 166, 165, 164, 158, 156, + + 155, 154, 153, 152, 151, 150, 149, 148, 145, 144, + 143, 142, 141, 139, 138, 137, 135, 134, 131, 129, + 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, + 115, 114, 113, 112, 110, 109, 107, 106, 105, 104, + 103, 102, 101, 100, 98, 97, 96, 95, 94, 93, + 91, 90, 89, 88, 87, 86, 85, 83, 82, 79, + 78, 77, 76, 74, 73, 72, 56, 55, 52, 51, + 38, 37, 35, 34, 33, 32, 31, 30, 28, 20, + 8, 7, 3, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, + 835 } ; /* The intent behind this definition is that it'll catch @@ -997,11 +1068,13 @@ static yyconst flex_int16_t yy_chk[1123] = } while (0) -#define return_opcode(condition, token, opcode, sat) \ +#define return_opcode(condition, token, opcode, len) \ do { \ - if (condition) { \ + if (condition && \ + _mesa_parse_instruction_suffix(yyextra, \ + yytext + len, \ + & yylval->temp_inst)) { \ yylval->temp_inst.Opcode = OPCODE_ ## opcode; \ - yylval->temp_inst.SaturateMode = SATURATE_ ## sat; \ return token; \ } else { \ yylval->string = strdup(yytext); \ @@ -1067,7 +1140,7 @@ swiz_from_char(char c) } while(0); #define YY_EXTRA_TYPE struct asm_parser_state * -#line 1071 "lex.yy.c" +#line 1144 "lex.yy.c" #define INITIAL 0 @@ -1313,10 +1386,10 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 136 "program_lexer.l" +#line 143 "program_lexer.l" -#line 1320 "lex.yy.c" +#line 1393 "lex.yy.c" yylval = yylval_param; @@ -1373,13 +1446,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 776 ) + if ( yy_current_state >= 836 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 1055 ); + while ( yy_base[yy_current_state] != 1284 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -1405,17 +1478,17 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 138 "program_lexer.l" +#line 145 "program_lexer.l" { return ARBvp_10; } YY_BREAK case 2: YY_RULE_SETUP -#line 139 "program_lexer.l" +#line 146 "program_lexer.l" { return ARBfp_10; } YY_BREAK case 3: YY_RULE_SETUP -#line 140 "program_lexer.l" +#line 147 "program_lexer.l" { yylval->integer = at_address; return_token_or_IDENTIFIER(require_ARB_vp, ADDRESS); @@ -1423,983 +1496,738 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 144 "program_lexer.l" +#line 151 "program_lexer.l" { return ALIAS; } YY_BREAK case 5: YY_RULE_SETUP -#line 145 "program_lexer.l" +#line 152 "program_lexer.l" { return ATTRIB; } YY_BREAK case 6: YY_RULE_SETUP -#line 146 "program_lexer.l" +#line 153 "program_lexer.l" { return END; } YY_BREAK case 7: YY_RULE_SETUP -#line 147 "program_lexer.l" +#line 154 "program_lexer.l" { return OPTION; } YY_BREAK case 8: YY_RULE_SETUP -#line 148 "program_lexer.l" +#line 155 "program_lexer.l" { return OUTPUT; } YY_BREAK case 9: YY_RULE_SETUP -#line 149 "program_lexer.l" +#line 156 "program_lexer.l" { return PARAM; } YY_BREAK case 10: YY_RULE_SETUP -#line 150 "program_lexer.l" +#line 157 "program_lexer.l" { yylval->integer = at_temp; return TEMP; } YY_BREAK case 11: YY_RULE_SETUP -#line 152 "program_lexer.l" -{ return_opcode( 1, VECTOR_OP, ABS, OFF); } +#line 159 "program_lexer.l" +{ return_opcode( 1, VECTOR_OP, ABS, 3); } YY_BREAK case 12: YY_RULE_SETUP -#line 153 "program_lexer.l" -{ return_opcode(require_ARB_fp, VECTOR_OP, ABS, ZERO_ONE); } +#line 160 "program_lexer.l" +{ return_opcode( 1, BIN_OP, ADD, 3); } YY_BREAK case 13: YY_RULE_SETUP -#line 154 "program_lexer.l" -{ return_opcode( 1, BIN_OP, ADD, OFF); } +#line 161 "program_lexer.l" +{ return_opcode(require_ARB_vp, ARL, ARL, 3); } YY_BREAK case 14: YY_RULE_SETUP -#line 155 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, ADD, ZERO_ONE); } +#line 163 "program_lexer.l" +{ return_opcode(require_ARB_fp, TRI_OP, CMP, 3); } YY_BREAK case 15: YY_RULE_SETUP -#line 156 "program_lexer.l" -{ return_opcode(require_ARB_vp, ARL, ARL, OFF); } +#line 164 "program_lexer.l" +{ return_opcode(require_ARB_fp, SCALAR_OP, COS, 3); } YY_BREAK case 16: YY_RULE_SETUP -#line 158 "program_lexer.l" -{ return_opcode(require_ARB_fp, TRI_OP, CMP, OFF); } +#line 166 "program_lexer.l" +{ return_opcode(require_NV_fp, VECTOR_OP, DDX, 3); } YY_BREAK case 17: YY_RULE_SETUP -#line 159 "program_lexer.l" -{ return_opcode(require_ARB_fp, TRI_OP, CMP, ZERO_ONE); } +#line 167 "program_lexer.l" +{ return_opcode(require_NV_fp, VECTOR_OP, DDY, 3); } YY_BREAK case 18: YY_RULE_SETUP -#line 160 "program_lexer.l" -{ return_opcode(require_ARB_fp, SCALAR_OP, COS, OFF); } +#line 168 "program_lexer.l" +{ return_opcode( 1, BIN_OP, DP3, 3); } YY_BREAK case 19: YY_RULE_SETUP -#line 161 "program_lexer.l" -{ return_opcode(require_ARB_fp, SCALAR_OP, COS, ZERO_ONE); } +#line 169 "program_lexer.l" +{ return_opcode( 1, BIN_OP, DP4, 3); } YY_BREAK case 20: YY_RULE_SETUP -#line 163 "program_lexer.l" -{ return_opcode(require_NV_fp, VECTOR_OP, DDX, OFF); } +#line 170 "program_lexer.l" +{ return_opcode( 1, BIN_OP, DPH, 3); } YY_BREAK case 21: YY_RULE_SETUP -#line 164 "program_lexer.l" -{ return_opcode(require_NV_fp, VECTOR_OP, DDX, ZERO_ONE); } +#line 171 "program_lexer.l" +{ return_opcode( 1, BIN_OP, DST, 3); } YY_BREAK case 22: YY_RULE_SETUP -#line 165 "program_lexer.l" -{ return_opcode(require_NV_fp, VECTOR_OP, DDY, OFF); } +#line 173 "program_lexer.l" +{ return_opcode( 1, SCALAR_OP, EX2, 3); } YY_BREAK case 23: YY_RULE_SETUP -#line 166 "program_lexer.l" -{ return_opcode(require_NV_fp, VECTOR_OP, DDY, ZERO_ONE); } +#line 174 "program_lexer.l" +{ return_opcode(require_ARB_vp, SCALAR_OP, EXP, 3); } YY_BREAK case 24: YY_RULE_SETUP -#line 167 "program_lexer.l" -{ return_opcode( 1, BIN_OP, DP3, OFF); } +#line 176 "program_lexer.l" +{ return_opcode( 1, VECTOR_OP, FLR, 3); } YY_BREAK case 25: YY_RULE_SETUP -#line 168 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, DP3, ZERO_ONE); } +#line 177 "program_lexer.l" +{ return_opcode( 1, VECTOR_OP, FRC, 3); } YY_BREAK case 26: YY_RULE_SETUP -#line 169 "program_lexer.l" -{ return_opcode( 1, BIN_OP, DP4, OFF); } +#line 179 "program_lexer.l" +{ return_opcode(require_ARB_fp, KIL, KIL, 3); } YY_BREAK case 27: YY_RULE_SETUP -#line 170 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, DP4, ZERO_ONE); } +#line 181 "program_lexer.l" +{ return_opcode( 1, VECTOR_OP, LIT, 3); } YY_BREAK case 28: YY_RULE_SETUP -#line 171 "program_lexer.l" -{ return_opcode( 1, BIN_OP, DPH, OFF); } +#line 182 "program_lexer.l" +{ return_opcode( 1, SCALAR_OP, LG2, 3); } YY_BREAK case 29: YY_RULE_SETUP -#line 172 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, DPH, ZERO_ONE); } +#line 183 "program_lexer.l" +{ return_opcode(require_ARB_vp, SCALAR_OP, LOG, 3); } YY_BREAK case 30: YY_RULE_SETUP -#line 173 "program_lexer.l" -{ return_opcode( 1, BIN_OP, DST, OFF); } +#line 184 "program_lexer.l" +{ return_opcode(require_ARB_fp, TRI_OP, LRP, 3); } YY_BREAK case 31: YY_RULE_SETUP -#line 174 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, DST, ZERO_ONE); } +#line 186 "program_lexer.l" +{ return_opcode( 1, TRI_OP, MAD, 3); } YY_BREAK case 32: YY_RULE_SETUP -#line 176 "program_lexer.l" -{ return_opcode( 1, SCALAR_OP, EX2, OFF); } +#line 187 "program_lexer.l" +{ return_opcode( 1, BIN_OP, MAX, 3); } YY_BREAK case 33: YY_RULE_SETUP -#line 177 "program_lexer.l" -{ return_opcode(require_ARB_fp, SCALAR_OP, EX2, ZERO_ONE); } +#line 188 "program_lexer.l" +{ return_opcode( 1, BIN_OP, MIN, 3); } YY_BREAK case 34: YY_RULE_SETUP -#line 178 "program_lexer.l" -{ return_opcode(require_ARB_vp, SCALAR_OP, EXP, OFF); } +#line 189 "program_lexer.l" +{ return_opcode( 1, VECTOR_OP, MOV, 3); } YY_BREAK case 35: YY_RULE_SETUP -#line 180 "program_lexer.l" -{ return_opcode( 1, VECTOR_OP, FLR, OFF); } +#line 190 "program_lexer.l" +{ return_opcode( 1, BIN_OP, MUL, 3); } YY_BREAK case 36: YY_RULE_SETUP -#line 181 "program_lexer.l" -{ return_opcode(require_ARB_fp, VECTOR_OP, FLR, ZERO_ONE); } +#line 192 "program_lexer.l" +{ return_opcode(require_NV_fp, VECTOR_OP, PK2H, 4); } YY_BREAK case 37: YY_RULE_SETUP -#line 182 "program_lexer.l" -{ return_opcode( 1, VECTOR_OP, FRC, OFF); } +#line 193 "program_lexer.l" +{ return_opcode(require_NV_fp, VECTOR_OP, PK2US, 5); } YY_BREAK case 38: YY_RULE_SETUP -#line 183 "program_lexer.l" -{ return_opcode(require_ARB_fp, VECTOR_OP, FRC, ZERO_ONE); } +#line 194 "program_lexer.l" +{ return_opcode(require_NV_fp, VECTOR_OP, PK4B, 4); } YY_BREAK case 39: YY_RULE_SETUP -#line 185 "program_lexer.l" -{ return_opcode(require_ARB_fp, KIL, KIL, OFF); } +#line 195 "program_lexer.l" +{ return_opcode(require_NV_fp, VECTOR_OP, PK4UB, 5); } YY_BREAK case 40: YY_RULE_SETUP -#line 187 "program_lexer.l" -{ return_opcode( 1, VECTOR_OP, LIT, OFF); } +#line 196 "program_lexer.l" +{ return_opcode( 1, BINSC_OP, POW, 3); } YY_BREAK case 41: YY_RULE_SETUP -#line 188 "program_lexer.l" -{ return_opcode(require_ARB_fp, VECTOR_OP, LIT, ZERO_ONE); } +#line 198 "program_lexer.l" +{ return_opcode( 1, SCALAR_OP, RCP, 3); } YY_BREAK case 42: YY_RULE_SETUP -#line 189 "program_lexer.l" -{ return_opcode( 1, SCALAR_OP, LG2, OFF); } +#line 199 "program_lexer.l" +{ return_opcode(require_NV_fp, BIN_OP, RFL, 3); } YY_BREAK case 43: YY_RULE_SETUP -#line 190 "program_lexer.l" -{ return_opcode(require_ARB_fp, SCALAR_OP, LG2, ZERO_ONE); } +#line 200 "program_lexer.l" +{ return_opcode( 1, SCALAR_OP, RSQ, 3); } YY_BREAK case 44: YY_RULE_SETUP -#line 191 "program_lexer.l" -{ return_opcode(require_ARB_vp, SCALAR_OP, LOG, OFF); } +#line 202 "program_lexer.l" +{ return_opcode(require_ARB_fp, SCALAR_OP, SCS, 3); } YY_BREAK case 45: YY_RULE_SETUP -#line 192 "program_lexer.l" -{ return_opcode(require_ARB_fp, TRI_OP, LRP, OFF); } +#line 203 "program_lexer.l" +{ return_opcode(require_NV_fp, BIN_OP, SEQ, 3); } YY_BREAK case 46: YY_RULE_SETUP -#line 193 "program_lexer.l" -{ return_opcode(require_ARB_fp, TRI_OP, LRP, ZERO_ONE); } +#line 204 "program_lexer.l" +{ return_opcode(require_NV_fp, BIN_OP, SFL, 3); } YY_BREAK case 47: YY_RULE_SETUP -#line 195 "program_lexer.l" -{ return_opcode( 1, TRI_OP, MAD, OFF); } +#line 205 "program_lexer.l" +{ return_opcode( 1, BIN_OP, SGE, 3); } YY_BREAK case 48: YY_RULE_SETUP -#line 196 "program_lexer.l" -{ return_opcode(require_ARB_fp, TRI_OP, MAD, ZERO_ONE); } +#line 206 "program_lexer.l" +{ return_opcode(require_NV_fp, BIN_OP, SGT, 3); } YY_BREAK case 49: YY_RULE_SETUP -#line 197 "program_lexer.l" -{ return_opcode( 1, BIN_OP, MAX, OFF); } +#line 207 "program_lexer.l" +{ return_opcode(require_ARB_fp, SCALAR_OP, SIN, 3); } YY_BREAK case 50: YY_RULE_SETUP -#line 198 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, MAX, ZERO_ONE); } +#line 208 "program_lexer.l" +{ return_opcode(require_NV_fp, BIN_OP, SLE, 3); } YY_BREAK case 51: YY_RULE_SETUP -#line 199 "program_lexer.l" -{ return_opcode( 1, BIN_OP, MIN, OFF); } +#line 209 "program_lexer.l" +{ return_opcode( 1, BIN_OP, SLT, 3); } YY_BREAK case 52: YY_RULE_SETUP -#line 200 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, MIN, ZERO_ONE); } +#line 210 "program_lexer.l" +{ return_opcode(require_NV_fp, BIN_OP, SNE, 3); } YY_BREAK case 53: YY_RULE_SETUP -#line 201 "program_lexer.l" -{ return_opcode( 1, VECTOR_OP, MOV, OFF); } +#line 211 "program_lexer.l" +{ return_opcode(require_NV_fp, BIN_OP, STR, 3); } YY_BREAK case 54: YY_RULE_SETUP -#line 202 "program_lexer.l" -{ return_opcode(require_ARB_fp, VECTOR_OP, MOV, ZERO_ONE); } +#line 212 "program_lexer.l" +{ return_opcode( 1, BIN_OP, SUB, 3); } YY_BREAK case 55: YY_RULE_SETUP -#line 203 "program_lexer.l" -{ return_opcode( 1, BIN_OP, MUL, OFF); } +#line 213 "program_lexer.l" +{ return_opcode( 1, SWZ, SWZ, 3); } YY_BREAK case 56: YY_RULE_SETUP -#line 204 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, MUL, ZERO_ONE); } +#line 215 "program_lexer.l" +{ return_opcode(require_ARB_fp, SAMPLE_OP, TEX, 3); } YY_BREAK case 57: YY_RULE_SETUP -#line 206 "program_lexer.l" -{ return_opcode(require_NV_fp, VECTOR_OP, PK2H, OFF); } +#line 216 "program_lexer.l" +{ return_opcode(require_ARB_fp, SAMPLE_OP, TXB, 3); } YY_BREAK case 58: YY_RULE_SETUP -#line 207 "program_lexer.l" -{ return_opcode(require_NV_fp, VECTOR_OP, PK2H, ZERO_ONE); } +#line 217 "program_lexer.l" +{ return_opcode(require_NV_fp, TXD_OP, TXD, 3); } YY_BREAK case 59: YY_RULE_SETUP -#line 208 "program_lexer.l" -{ return_opcode(require_NV_fp, VECTOR_OP, PK2US, OFF); } +#line 218 "program_lexer.l" +{ return_opcode(require_ARB_fp, SAMPLE_OP, TXP, 3); } YY_BREAK case 60: YY_RULE_SETUP -#line 209 "program_lexer.l" -{ return_opcode(require_NV_fp, VECTOR_OP, PK2US, ZERO_ONE); } +#line 220 "program_lexer.l" +{ return_opcode(require_NV_fp, SCALAR_OP, UP2H, 4); } YY_BREAK case 61: YY_RULE_SETUP -#line 210 "program_lexer.l" -{ return_opcode(require_NV_fp, VECTOR_OP, PK4B, OFF); } +#line 221 "program_lexer.l" +{ return_opcode(require_NV_fp, SCALAR_OP, UP2US, 5); } YY_BREAK case 62: YY_RULE_SETUP -#line 211 "program_lexer.l" -{ return_opcode(require_NV_fp, VECTOR_OP, PK4B, ZERO_ONE); } +#line 223 "program_lexer.l" +{ return_opcode(require_NV_fp, TRI_OP, X2D, 3); } YY_BREAK case 63: YY_RULE_SETUP -#line 212 "program_lexer.l" -{ return_opcode(require_NV_fp, VECTOR_OP, PK4UB, OFF); } +#line 224 "program_lexer.l" +{ return_opcode( 1, BIN_OP, XPD, 3); } YY_BREAK case 64: YY_RULE_SETUP -#line 213 "program_lexer.l" -{ return_opcode(require_NV_fp, VECTOR_OP, PK4UB, ZERO_ONE); } +#line 226 "program_lexer.l" +{ return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); } YY_BREAK case 65: YY_RULE_SETUP -#line 214 "program_lexer.l" -{ return_opcode( 1, BINSC_OP, POW, OFF); } +#line 227 "program_lexer.l" +{ return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); } YY_BREAK case 66: YY_RULE_SETUP -#line 215 "program_lexer.l" -{ return_opcode(require_ARB_fp, BINSC_OP, POW, ZERO_ONE); } +#line 228 "program_lexer.l" +{ return PROGRAM; } YY_BREAK case 67: YY_RULE_SETUP -#line 217 "program_lexer.l" -{ return_opcode( 1, SCALAR_OP, RCP, OFF); } +#line 229 "program_lexer.l" +{ return STATE; } YY_BREAK case 68: YY_RULE_SETUP -#line 218 "program_lexer.l" -{ return_opcode(require_ARB_fp, SCALAR_OP, RCP, ZERO_ONE); } +#line 230 "program_lexer.l" +{ return RESULT; } YY_BREAK case 69: YY_RULE_SETUP -#line 219 "program_lexer.l" -{ return_opcode(require_NV_fp, BIN_OP, RFL, OFF); } +#line 232 "program_lexer.l" +{ return AMBIENT; } YY_BREAK case 70: YY_RULE_SETUP -#line 220 "program_lexer.l" -{ return_opcode(require_NV_fp, BIN_OP, RFL, ZERO_ONE); } +#line 233 "program_lexer.l" +{ return ATTENUATION; } YY_BREAK case 71: YY_RULE_SETUP -#line 221 "program_lexer.l" -{ return_opcode( 1, SCALAR_OP, RSQ, OFF); } +#line 234 "program_lexer.l" +{ return BACK; } YY_BREAK case 72: YY_RULE_SETUP -#line 222 "program_lexer.l" -{ return_opcode(require_ARB_fp, SCALAR_OP, RSQ, ZERO_ONE); } +#line 235 "program_lexer.l" +{ return_token_or_DOT(require_ARB_vp, CLIP); } YY_BREAK case 73: YY_RULE_SETUP -#line 224 "program_lexer.l" -{ return_opcode(require_ARB_fp, SCALAR_OP, SCS, OFF); } +#line 236 "program_lexer.l" +{ return COLOR; } YY_BREAK case 74: YY_RULE_SETUP -#line 225 "program_lexer.l" -{ return_opcode(require_ARB_fp, SCALAR_OP, SCS, ZERO_ONE); } +#line 237 "program_lexer.l" +{ return_token_or_DOT(require_ARB_fp, DEPTH); } YY_BREAK case 75: YY_RULE_SETUP -#line 226 "program_lexer.l" -{ return_opcode(require_NV_fp, BIN_OP, SEQ, OFF); } +#line 238 "program_lexer.l" +{ return DIFFUSE; } YY_BREAK case 76: YY_RULE_SETUP -#line 227 "program_lexer.l" -{ return_opcode(require_NV_fp, BIN_OP, SEQ, ZERO_ONE); } +#line 239 "program_lexer.l" +{ return DIRECTION; } YY_BREAK case 77: YY_RULE_SETUP -#line 228 "program_lexer.l" -{ return_opcode(require_NV_fp, BIN_OP, SFL, OFF); } +#line 240 "program_lexer.l" +{ return EMISSION; } YY_BREAK case 78: YY_RULE_SETUP -#line 229 "program_lexer.l" -{ return_opcode(require_NV_fp, BIN_OP, SFL, ZERO_ONE); } +#line 241 "program_lexer.l" +{ return ENV; } YY_BREAK case 79: YY_RULE_SETUP -#line 230 "program_lexer.l" -{ return_opcode( 1, BIN_OP, SGE, OFF); } +#line 242 "program_lexer.l" +{ return EYE; } YY_BREAK case 80: YY_RULE_SETUP -#line 231 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, SGE, ZERO_ONE); } +#line 243 "program_lexer.l" +{ return FOGCOORD; } YY_BREAK case 81: YY_RULE_SETUP -#line 232 "program_lexer.l" -{ return_opcode(require_NV_fp, BIN_OP, SGT, OFF); } +#line 244 "program_lexer.l" +{ return FOG; } YY_BREAK case 82: YY_RULE_SETUP -#line 233 "program_lexer.l" -{ return_opcode(require_NV_fp, BIN_OP, SGT, ZERO_ONE); } +#line 245 "program_lexer.l" +{ return FRONT; } YY_BREAK case 83: YY_RULE_SETUP -#line 234 "program_lexer.l" -{ return_opcode(require_ARB_fp, SCALAR_OP, SIN, OFF); } +#line 246 "program_lexer.l" +{ return HALF; } YY_BREAK case 84: YY_RULE_SETUP -#line 235 "program_lexer.l" -{ return_opcode(require_ARB_fp, SCALAR_OP, SIN, ZERO_ONE); } +#line 247 "program_lexer.l" +{ return INVERSE; } YY_BREAK case 85: YY_RULE_SETUP -#line 236 "program_lexer.l" -{ return_opcode(require_NV_fp, BIN_OP, SLE, OFF); } +#line 248 "program_lexer.l" +{ return INVTRANS; } YY_BREAK case 86: YY_RULE_SETUP -#line 237 "program_lexer.l" -{ return_opcode(require_NV_fp, BIN_OP, SLE, ZERO_ONE); } +#line 249 "program_lexer.l" +{ return LIGHT; } YY_BREAK case 87: YY_RULE_SETUP -#line 238 "program_lexer.l" -{ return_opcode( 1, BIN_OP, SLT, OFF); } +#line 250 "program_lexer.l" +{ return LIGHTMODEL; } YY_BREAK case 88: YY_RULE_SETUP -#line 239 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, SLT, ZERO_ONE); } +#line 251 "program_lexer.l" +{ return LIGHTPROD; } YY_BREAK case 89: YY_RULE_SETUP -#line 240 "program_lexer.l" -{ return_opcode(require_NV_fp, BIN_OP, SNE, OFF); } +#line 252 "program_lexer.l" +{ return LOCAL; } YY_BREAK case 90: YY_RULE_SETUP -#line 241 "program_lexer.l" -{ return_opcode(require_NV_fp, BIN_OP, SNE, ZERO_ONE); } +#line 253 "program_lexer.l" +{ return MATERIAL; } YY_BREAK case 91: YY_RULE_SETUP -#line 242 "program_lexer.l" -{ return_opcode(require_NV_fp, BIN_OP, STR, OFF); } +#line 254 "program_lexer.l" +{ return MAT_PROGRAM; } YY_BREAK case 92: YY_RULE_SETUP -#line 243 "program_lexer.l" -{ return_opcode(require_NV_fp, BIN_OP, STR, ZERO_ONE); } +#line 255 "program_lexer.l" +{ return MATRIX; } YY_BREAK case 93: YY_RULE_SETUP -#line 244 "program_lexer.l" -{ return_opcode( 1, BIN_OP, SUB, OFF); } +#line 256 "program_lexer.l" +{ return_token_or_DOT(require_ARB_vp, MATRIXINDEX); } YY_BREAK case 94: YY_RULE_SETUP -#line 245 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, SUB, ZERO_ONE); } +#line 257 "program_lexer.l" +{ return MODELVIEW; } YY_BREAK case 95: YY_RULE_SETUP -#line 246 "program_lexer.l" -{ return_opcode( 1, SWZ, SWZ, OFF); } +#line 258 "program_lexer.l" +{ return MVP; } YY_BREAK case 96: YY_RULE_SETUP -#line 247 "program_lexer.l" -{ return_opcode(require_ARB_fp, SWZ, SWZ, ZERO_ONE); } +#line 259 "program_lexer.l" +{ return_token_or_DOT(require_ARB_vp, NORMAL); } YY_BREAK case 97: YY_RULE_SETUP -#line 249 "program_lexer.l" -{ return_opcode(require_ARB_fp, SAMPLE_OP, TEX, OFF); } +#line 260 "program_lexer.l" +{ return OBJECT; } YY_BREAK case 98: YY_RULE_SETUP -#line 250 "program_lexer.l" -{ return_opcode(require_ARB_fp, SAMPLE_OP, TEX, ZERO_ONE); } +#line 261 "program_lexer.l" +{ return PALETTE; } YY_BREAK case 99: YY_RULE_SETUP -#line 251 "program_lexer.l" -{ return_opcode(require_ARB_fp, SAMPLE_OP, TXB, OFF); } +#line 262 "program_lexer.l" +{ return PARAMS; } YY_BREAK case 100: YY_RULE_SETUP -#line 252 "program_lexer.l" -{ return_opcode(require_ARB_fp, SAMPLE_OP, TXB, ZERO_ONE); } +#line 263 "program_lexer.l" +{ return PLANE; } YY_BREAK case 101: YY_RULE_SETUP -#line 253 "program_lexer.l" -{ return_opcode(require_NV_fp, TXD_OP, TXD, OFF); } +#line 264 "program_lexer.l" +{ return_token_or_DOT(require_ARB_vp, POINT); } YY_BREAK case 102: YY_RULE_SETUP -#line 254 "program_lexer.l" -{ return_opcode(require_NV_fp, TXD_OP, TXD, ZERO_ONE); } +#line 265 "program_lexer.l" +{ return_token_or_DOT(require_ARB_vp, POINTSIZE); } YY_BREAK case 103: YY_RULE_SETUP -#line 255 "program_lexer.l" -{ return_opcode(require_ARB_fp, SAMPLE_OP, TXP, OFF); } +#line 266 "program_lexer.l" +{ return POSITION; } YY_BREAK case 104: YY_RULE_SETUP -#line 256 "program_lexer.l" -{ return_opcode(require_ARB_fp, SAMPLE_OP, TXP, ZERO_ONE); } +#line 267 "program_lexer.l" +{ return PRIMARY; } YY_BREAK case 105: YY_RULE_SETUP -#line 258 "program_lexer.l" -{ return_opcode(require_NV_fp, SCALAR_OP, UP2H, OFF); } +#line 268 "program_lexer.l" +{ return PROJECTION; } YY_BREAK case 106: YY_RULE_SETUP -#line 259 "program_lexer.l" -{ return_opcode(require_NV_fp, SCALAR_OP, UP2H, ZERO_ONE); } +#line 269 "program_lexer.l" +{ return_token_or_DOT(require_ARB_fp, RANGE); } YY_BREAK case 107: YY_RULE_SETUP -#line 260 "program_lexer.l" -{ return_opcode(require_NV_fp, SCALAR_OP, UP2US, OFF); } +#line 270 "program_lexer.l" +{ return ROW; } YY_BREAK case 108: YY_RULE_SETUP -#line 261 "program_lexer.l" -{ return_opcode(require_NV_fp, SCALAR_OP, UP2US, ZERO_ONE); } +#line 271 "program_lexer.l" +{ return SCENECOLOR; } YY_BREAK case 109: YY_RULE_SETUP -#line 263 "program_lexer.l" -{ return_opcode(require_NV_fp, TRI_OP, X2D, OFF); } +#line 272 "program_lexer.l" +{ return SECONDARY; } YY_BREAK case 110: YY_RULE_SETUP -#line 264 "program_lexer.l" -{ return_opcode(require_NV_fp, TRI_OP, X2D, ZERO_ONE); } +#line 273 "program_lexer.l" +{ return SHININESS; } YY_BREAK case 111: YY_RULE_SETUP -#line 265 "program_lexer.l" -{ return_opcode( 1, BIN_OP, XPD, OFF); } +#line 274 "program_lexer.l" +{ return_token_or_DOT(require_ARB_vp, SIZE); } YY_BREAK case 112: YY_RULE_SETUP -#line 266 "program_lexer.l" -{ return_opcode(require_ARB_fp, BIN_OP, XPD, ZERO_ONE); } +#line 275 "program_lexer.l" +{ return SPECULAR; } YY_BREAK case 113: YY_RULE_SETUP -#line 268 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); } +#line 276 "program_lexer.l" +{ return SPOT; } YY_BREAK case 114: YY_RULE_SETUP -#line 269 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); } +#line 277 "program_lexer.l" +{ return TEXCOORD; } YY_BREAK case 115: YY_RULE_SETUP -#line 270 "program_lexer.l" -{ return PROGRAM; } - YY_BREAK -case 116: -YY_RULE_SETUP -#line 271 "program_lexer.l" -{ return STATE; } - YY_BREAK -case 117: -YY_RULE_SETUP -#line 272 "program_lexer.l" -{ return RESULT; } - YY_BREAK -case 118: -YY_RULE_SETUP -#line 274 "program_lexer.l" -{ return AMBIENT; } - YY_BREAK -case 119: -YY_RULE_SETUP -#line 275 "program_lexer.l" -{ return ATTENUATION; } - YY_BREAK -case 120: -YY_RULE_SETUP -#line 276 "program_lexer.l" -{ return BACK; } - YY_BREAK -case 121: -YY_RULE_SETUP -#line 277 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, CLIP); } - YY_BREAK -case 122: -YY_RULE_SETUP #line 278 "program_lexer.l" -{ return COLOR; } - YY_BREAK -case 123: -YY_RULE_SETUP -#line 279 "program_lexer.l" -{ return_token_or_DOT(require_ARB_fp, DEPTH); } - YY_BREAK -case 124: -YY_RULE_SETUP -#line 280 "program_lexer.l" -{ return DIFFUSE; } - YY_BREAK -case 125: -YY_RULE_SETUP -#line 281 "program_lexer.l" -{ return DIRECTION; } - YY_BREAK -case 126: -YY_RULE_SETUP -#line 282 "program_lexer.l" -{ return EMISSION; } - YY_BREAK -case 127: -YY_RULE_SETUP -#line 283 "program_lexer.l" -{ return ENV; } - YY_BREAK -case 128: -YY_RULE_SETUP -#line 284 "program_lexer.l" -{ return EYE; } - YY_BREAK -case 129: -YY_RULE_SETUP -#line 285 "program_lexer.l" -{ return FOGCOORD; } - YY_BREAK -case 130: -YY_RULE_SETUP -#line 286 "program_lexer.l" -{ return FOG; } - YY_BREAK -case 131: -YY_RULE_SETUP -#line 287 "program_lexer.l" -{ return FRONT; } - YY_BREAK -case 132: -YY_RULE_SETUP -#line 288 "program_lexer.l" -{ return HALF; } - YY_BREAK -case 133: -YY_RULE_SETUP -#line 289 "program_lexer.l" -{ return INVERSE; } - YY_BREAK -case 134: -YY_RULE_SETUP -#line 290 "program_lexer.l" -{ return INVTRANS; } - YY_BREAK -case 135: -YY_RULE_SETUP -#line 291 "program_lexer.l" -{ return LIGHT; } - YY_BREAK -case 136: -YY_RULE_SETUP -#line 292 "program_lexer.l" -{ return LIGHTMODEL; } - YY_BREAK -case 137: -YY_RULE_SETUP -#line 293 "program_lexer.l" -{ return LIGHTPROD; } - YY_BREAK -case 138: -YY_RULE_SETUP -#line 294 "program_lexer.l" -{ return LOCAL; } - YY_BREAK -case 139: -YY_RULE_SETUP -#line 295 "program_lexer.l" -{ return MATERIAL; } - YY_BREAK -case 140: -YY_RULE_SETUP -#line 296 "program_lexer.l" -{ return MAT_PROGRAM; } - YY_BREAK -case 141: -YY_RULE_SETUP -#line 297 "program_lexer.l" -{ return MATRIX; } - YY_BREAK -case 142: -YY_RULE_SETUP -#line 298 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, MATRIXINDEX); } - YY_BREAK -case 143: -YY_RULE_SETUP -#line 299 "program_lexer.l" -{ return MODELVIEW; } - YY_BREAK -case 144: -YY_RULE_SETUP -#line 300 "program_lexer.l" -{ return MVP; } - YY_BREAK -case 145: -YY_RULE_SETUP -#line 301 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, NORMAL); } - YY_BREAK -case 146: -YY_RULE_SETUP -#line 302 "program_lexer.l" -{ return OBJECT; } - YY_BREAK -case 147: -YY_RULE_SETUP -#line 303 "program_lexer.l" -{ return PALETTE; } - YY_BREAK -case 148: -YY_RULE_SETUP -#line 304 "program_lexer.l" -{ return PARAMS; } - YY_BREAK -case 149: -YY_RULE_SETUP -#line 305 "program_lexer.l" -{ return PLANE; } - YY_BREAK -case 150: -YY_RULE_SETUP -#line 306 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, POINT); } - YY_BREAK -case 151: -YY_RULE_SETUP -#line 307 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, POINTSIZE); } - YY_BREAK -case 152: -YY_RULE_SETUP -#line 308 "program_lexer.l" -{ return POSITION; } - YY_BREAK -case 153: -YY_RULE_SETUP -#line 309 "program_lexer.l" -{ return PRIMARY; } - YY_BREAK -case 154: -YY_RULE_SETUP -#line 310 "program_lexer.l" -{ return PROJECTION; } - YY_BREAK -case 155: -YY_RULE_SETUP -#line 311 "program_lexer.l" -{ return_token_or_DOT(require_ARB_fp, RANGE); } - YY_BREAK -case 156: -YY_RULE_SETUP -#line 312 "program_lexer.l" -{ return ROW; } - YY_BREAK -case 157: -YY_RULE_SETUP -#line 313 "program_lexer.l" -{ return SCENECOLOR; } - YY_BREAK -case 158: -YY_RULE_SETUP -#line 314 "program_lexer.l" -{ return SECONDARY; } - YY_BREAK -case 159: -YY_RULE_SETUP -#line 315 "program_lexer.l" -{ return SHININESS; } - YY_BREAK -case 160: -YY_RULE_SETUP -#line 316 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, SIZE); } - YY_BREAK -case 161: -YY_RULE_SETUP -#line 317 "program_lexer.l" -{ return SPECULAR; } - YY_BREAK -case 162: -YY_RULE_SETUP -#line 318 "program_lexer.l" -{ return SPOT; } - YY_BREAK -case 163: -YY_RULE_SETUP -#line 319 "program_lexer.l" -{ return TEXCOORD; } - YY_BREAK -case 164: -YY_RULE_SETUP -#line 320 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, TEXENV); } YY_BREAK -case 165: +case 116: YY_RULE_SETUP -#line 321 "program_lexer.l" +#line 279 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN); } YY_BREAK -case 166: +case 117: YY_RULE_SETUP -#line 322 "program_lexer.l" +#line 280 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_Q); } YY_BREAK -case 167: +case 118: YY_RULE_SETUP -#line 323 "program_lexer.l" +#line 281 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_S); } YY_BREAK -case 168: +case 119: YY_RULE_SETUP -#line 324 "program_lexer.l" +#line 282 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_T); } YY_BREAK -case 169: +case 120: YY_RULE_SETUP -#line 325 "program_lexer.l" +#line 283 "program_lexer.l" { return TEXTURE; } YY_BREAK -case 170: +case 121: YY_RULE_SETUP -#line 326 "program_lexer.l" +#line 284 "program_lexer.l" { return TRANSPOSE; } YY_BREAK -case 171: +case 122: YY_RULE_SETUP -#line 327 "program_lexer.l" +#line 285 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, VTXATTRIB); } YY_BREAK -case 172: +case 123: YY_RULE_SETUP -#line 328 "program_lexer.l" +#line 286 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, WEIGHT); } YY_BREAK -case 173: +case 124: YY_RULE_SETUP -#line 330 "program_lexer.l" +#line 288 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEXTURE_UNIT); } YY_BREAK -case 174: +case 125: YY_RULE_SETUP -#line 331 "program_lexer.l" +#line 289 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_1D); } YY_BREAK -case 175: +case 126: YY_RULE_SETUP -#line 332 "program_lexer.l" +#line 290 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_2D); } YY_BREAK -case 176: +case 127: YY_RULE_SETUP -#line 333 "program_lexer.l" +#line 291 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_3D); } YY_BREAK -case 177: +case 128: YY_RULE_SETUP -#line 334 "program_lexer.l" +#line 292 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_CUBE); } YY_BREAK -case 178: +case 129: YY_RULE_SETUP -#line 335 "program_lexer.l" +#line 293 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_rect, TEX_RECT); } YY_BREAK -case 179: +case 130: YY_RULE_SETUP -#line 336 "program_lexer.l" +#line 294 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW1D); } YY_BREAK -case 180: +case 131: YY_RULE_SETUP -#line 337 "program_lexer.l" +#line 295 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW2D); } YY_BREAK -case 181: +case 132: YY_RULE_SETUP -#line 338 "program_lexer.l" +#line 296 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_rect, TEX_SHADOWRECT); } YY_BREAK -case 182: +case 133: YY_RULE_SETUP -#line 339 "program_lexer.l" +#line 297 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY1D); } YY_BREAK -case 183: +case 134: YY_RULE_SETUP -#line 340 "program_lexer.l" +#line 298 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY2D); } YY_BREAK -case 184: +case 135: YY_RULE_SETUP -#line 341 "program_lexer.l" +#line 299 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW1D); } YY_BREAK -case 185: +case 136: YY_RULE_SETUP -#line 342 "program_lexer.l" +#line 300 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); } YY_BREAK -case 186: +case 137: YY_RULE_SETUP -#line 344 "program_lexer.l" +#line 302 "program_lexer.l" { yylval->string = strdup(yytext); return IDENTIFIER; } YY_BREAK -case 187: +case 138: YY_RULE_SETUP -#line 349 "program_lexer.l" +#line 307 "program_lexer.l" { return DOT_DOT; } YY_BREAK -case 188: +case 139: YY_RULE_SETUP -#line 351 "program_lexer.l" +#line 309 "program_lexer.l" { yylval->integer = strtol(yytext, NULL, 10); return INTEGER; } YY_BREAK -case 189: +case 140: YY_RULE_SETUP -#line 355 "program_lexer.l" +#line 313 "program_lexer.l" { yylval->real = strtod(yytext, NULL); return REAL; } YY_BREAK -case 190: -/* rule 190 can match eol */ +case 141: +/* rule 141 can match eol */ *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 359 "program_lexer.l" +#line 317 "program_lexer.l" { yylval->real = strtod(yytext, NULL); return REAL; } YY_BREAK -case 191: +case 142: YY_RULE_SETUP -#line 363 "program_lexer.l" +#line 321 "program_lexer.l" { yylval->real = strtod(yytext, NULL); return REAL; } YY_BREAK -case 192: +case 143: YY_RULE_SETUP -#line 367 "program_lexer.l" +#line 325 "program_lexer.l" { yylval->real = strtod(yytext, NULL); return REAL; } YY_BREAK -case 193: +case 144: YY_RULE_SETUP -#line 372 "program_lexer.l" +#line 330 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; return MASK4; } YY_BREAK -case 194: +case 145: YY_RULE_SETUP -#line 378 "program_lexer.l" +#line 336 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2407,27 +2235,27 @@ YY_RULE_SETUP return MASK3; } YY_BREAK -case 195: +case 146: YY_RULE_SETUP -#line 384 "program_lexer.l" +#line 342 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; return MASK3; } YY_BREAK -case 196: +case 147: YY_RULE_SETUP -#line 389 "program_lexer.l" +#line 347 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; return MASK3; } YY_BREAK -case 197: +case 148: YY_RULE_SETUP -#line 395 "program_lexer.l" +#line 353 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2435,9 +2263,9 @@ YY_RULE_SETUP return MASK2; } YY_BREAK -case 198: +case 149: YY_RULE_SETUP -#line 401 "program_lexer.l" +#line 359 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2445,18 +2273,18 @@ YY_RULE_SETUP return MASK2; } YY_BREAK -case 199: +case 150: YY_RULE_SETUP -#line 407 "program_lexer.l" +#line 365 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; return MASK2; } YY_BREAK -case 200: +case 151: YY_RULE_SETUP -#line 413 "program_lexer.l" +#line 371 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2464,9 +2292,9 @@ YY_RULE_SETUP return MASK1; } YY_BREAK -case 201: +case 152: YY_RULE_SETUP -#line 420 "program_lexer.l" +#line 378 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2476,18 +2304,18 @@ YY_RULE_SETUP return SWIZZLE; } YY_BREAK -case 202: +case 153: YY_RULE_SETUP -#line 429 "program_lexer.l" +#line 387 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; return_token_or_DOT(require_ARB_fp, MASK4); } YY_BREAK -case 203: +case 154: YY_RULE_SETUP -#line 435 "program_lexer.l" +#line 393 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2495,27 +2323,27 @@ YY_RULE_SETUP return_token_or_DOT(require_ARB_fp, MASK3); } YY_BREAK -case 204: +case 155: YY_RULE_SETUP -#line 441 "program_lexer.l" +#line 399 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; return_token_or_DOT(require_ARB_fp, MASK3); } YY_BREAK -case 205: +case 156: YY_RULE_SETUP -#line 446 "program_lexer.l" +#line 404 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; return_token_or_DOT(require_ARB_fp, MASK3); } YY_BREAK -case 206: +case 157: YY_RULE_SETUP -#line 452 "program_lexer.l" +#line 410 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2523,9 +2351,9 @@ YY_RULE_SETUP return_token_or_DOT(require_ARB_fp, MASK2); } YY_BREAK -case 207: +case 158: YY_RULE_SETUP -#line 458 "program_lexer.l" +#line 416 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2533,18 +2361,18 @@ YY_RULE_SETUP return_token_or_DOT(require_ARB_fp, MASK2); } YY_BREAK -case 208: +case 159: YY_RULE_SETUP -#line 464 "program_lexer.l" +#line 422 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; return_token_or_DOT(require_ARB_fp, MASK2); } YY_BREAK -case 209: +case 160: YY_RULE_SETUP -#line 470 "program_lexer.l" +#line 428 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2552,9 +2380,9 @@ YY_RULE_SETUP return_token_or_DOT(require_ARB_fp, MASK1); } YY_BREAK -case 210: +case 161: YY_RULE_SETUP -#line 478 "program_lexer.l" +#line 436 "program_lexer.l" { if (require_ARB_vp) { return TEXGEN_R; @@ -2566,9 +2394,9 @@ YY_RULE_SETUP } } YY_BREAK -case 211: +case 162: YY_RULE_SETUP -#line 489 "program_lexer.l" +#line 447 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2578,15 +2406,15 @@ YY_RULE_SETUP return_token_or_DOT(require_ARB_fp, SWIZZLE); } YY_BREAK -case 212: +case 163: YY_RULE_SETUP -#line 498 "program_lexer.l" +#line 456 "program_lexer.l" { return DOT; } YY_BREAK -case 213: -/* rule 213 can match eol */ +case 164: +/* rule 164 can match eol */ YY_RULE_SETUP -#line 500 "program_lexer.l" +#line 458 "program_lexer.l" { yylloc->first_line++; yylloc->first_column = 1; @@ -2595,30 +2423,30 @@ YY_RULE_SETUP yylloc->position++; } YY_BREAK -case 214: +case 165: YY_RULE_SETUP -#line 507 "program_lexer.l" +#line 465 "program_lexer.l" /* eat whitespace */ ; YY_BREAK -case 215: +case 166: *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 508 "program_lexer.l" +#line 466 "program_lexer.l" /* eat comments */ ; YY_BREAK -case 216: +case 167: YY_RULE_SETUP -#line 509 "program_lexer.l" +#line 467 "program_lexer.l" { return yytext[0]; } YY_BREAK -case 217: +case 168: YY_RULE_SETUP -#line 510 "program_lexer.l" +#line 468 "program_lexer.l" ECHO; YY_BREAK -#line 2622 "lex.yy.c" +#line 2450 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2912,7 +2740,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 776 ) + if ( yy_current_state >= 836 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -2941,11 +2769,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 776 ) + if ( yy_current_state >= 836 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 775); + yy_is_jam = (yy_current_state == 835); return yy_is_jam ? 0 : yy_current_state; } @@ -3793,7 +3621,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 510 "program_lexer.l" +#line 468 "program_lexer.l" diff --git a/src/mesa/shader/program_lexer.l b/src/mesa/shader/program_lexer.l index 62ca9b6db6..d7493f42fa 100644 --- a/src/mesa/shader/program_lexer.l +++ b/src/mesa/shader/program_lexer.l @@ -55,11 +55,13 @@ } while (0) -#define return_opcode(condition, token, opcode, sat) \ +#define return_opcode(condition, token, opcode, len) \ do { \ - if (condition) { \ + if (condition && \ + _mesa_parse_instruction_suffix(yyextra, \ + yytext + len, \ + & yylval->temp_inst)) { \ yylval->temp_inst.Opcode = OPCODE_ ## opcode; \ - yylval->temp_inst.SaturateMode = SATURATE_ ## sat; \ return token; \ } else { \ yylval->string = strdup(yytext); \ @@ -132,6 +134,11 @@ exp [Ee][-+]?[0-9]+ frac "."[0-9]+ dot "."[ \t]* +sz [HRX]? +szf [HR]? +cc C? +sat (_SAT)? + %option bison-bridge bison-locations reentrant noyywrap %% @@ -149,121 +156,72 @@ OUTPUT { return OUTPUT; } PARAM { return PARAM; } TEMP { yylval->integer = at_temp; return TEMP; } -ABS { return_opcode( 1, VECTOR_OP, ABS, OFF); } -ABS_SAT { return_opcode(require_ARB_fp, VECTOR_OP, ABS, ZERO_ONE); } -ADD { return_opcode( 1, BIN_OP, ADD, OFF); } -ADD_SAT { return_opcode(require_ARB_fp, BIN_OP, ADD, ZERO_ONE); } -ARL { return_opcode(require_ARB_vp, ARL, ARL, OFF); } - -CMP { return_opcode(require_ARB_fp, TRI_OP, CMP, OFF); } -CMP_SAT { return_opcode(require_ARB_fp, TRI_OP, CMP, ZERO_ONE); } -COS { return_opcode(require_ARB_fp, SCALAR_OP, COS, OFF); } -COS_SAT { return_opcode(require_ARB_fp, SCALAR_OP, COS, ZERO_ONE); } - -DDX { return_opcode(require_NV_fp, VECTOR_OP, DDX, OFF); } -DDX_SAT { return_opcode(require_NV_fp, VECTOR_OP, DDX, ZERO_ONE); } -DDY { return_opcode(require_NV_fp, VECTOR_OP, DDY, OFF); } -DDY_SAT { return_opcode(require_NV_fp, VECTOR_OP, DDY, ZERO_ONE); } -DP3 { return_opcode( 1, BIN_OP, DP3, OFF); } -DP3_SAT { return_opcode(require_ARB_fp, BIN_OP, DP3, ZERO_ONE); } -DP4 { return_opcode( 1, BIN_OP, DP4, OFF); } -DP4_SAT { return_opcode(require_ARB_fp, BIN_OP, DP4, ZERO_ONE); } -DPH { return_opcode( 1, BIN_OP, DPH, OFF); } -DPH_SAT { return_opcode(require_ARB_fp, BIN_OP, DPH, ZERO_ONE); } -DST { return_opcode( 1, BIN_OP, DST, OFF); } -DST_SAT { return_opcode(require_ARB_fp, BIN_OP, DST, ZERO_ONE); } - -EX2 { return_opcode( 1, SCALAR_OP, EX2, OFF); } -EX2_SAT { return_opcode(require_ARB_fp, SCALAR_OP, EX2, ZERO_ONE); } -EXP { return_opcode(require_ARB_vp, SCALAR_OP, EXP, OFF); } - -FLR { return_opcode( 1, VECTOR_OP, FLR, OFF); } -FLR_SAT { return_opcode(require_ARB_fp, VECTOR_OP, FLR, ZERO_ONE); } -FRC { return_opcode( 1, VECTOR_OP, FRC, OFF); } -FRC_SAT { return_opcode(require_ARB_fp, VECTOR_OP, FRC, ZERO_ONE); } - -KIL { return_opcode(require_ARB_fp, KIL, KIL, OFF); } - -LIT { return_opcode( 1, VECTOR_OP, LIT, OFF); } -LIT_SAT { return_opcode(require_ARB_fp, VECTOR_OP, LIT, ZERO_ONE); } -LG2 { return_opcode( 1, SCALAR_OP, LG2, OFF); } -LG2_SAT { return_opcode(require_ARB_fp, SCALAR_OP, LG2, ZERO_ONE); } -LOG { return_opcode(require_ARB_vp, SCALAR_OP, LOG, OFF); } -LRP { return_opcode(require_ARB_fp, TRI_OP, LRP, OFF); } -LRP_SAT { return_opcode(require_ARB_fp, TRI_OP, LRP, ZERO_ONE); } - -MAD { return_opcode( 1, TRI_OP, MAD, OFF); } -MAD_SAT { return_opcode(require_ARB_fp, TRI_OP, MAD, ZERO_ONE); } -MAX { return_opcode( 1, BIN_OP, MAX, OFF); } -MAX_SAT { return_opcode(require_ARB_fp, BIN_OP, MAX, ZERO_ONE); } -MIN { return_opcode( 1, BIN_OP, MIN, OFF); } -MIN_SAT { return_opcode(require_ARB_fp, BIN_OP, MIN, ZERO_ONE); } -MOV { return_opcode( 1, VECTOR_OP, MOV, OFF); } -MOV_SAT { return_opcode(require_ARB_fp, VECTOR_OP, MOV, ZERO_ONE); } -MUL { return_opcode( 1, BIN_OP, MUL, OFF); } -MUL_SAT { return_opcode(require_ARB_fp, BIN_OP, MUL, ZERO_ONE); } - -PK2H { return_opcode(require_NV_fp, VECTOR_OP, PK2H, OFF); } -PK2H_SAT { return_opcode(require_NV_fp, VECTOR_OP, PK2H, ZERO_ONE); } -PK2US { return_opcode(require_NV_fp, VECTOR_OP, PK2US, OFF); } -PK2US_SAT { return_opcode(require_NV_fp, VECTOR_OP, PK2US, ZERO_ONE); } -PK4B { return_opcode(require_NV_fp, VECTOR_OP, PK4B, OFF); } -PK4B_SAT { return_opcode(require_NV_fp, VECTOR_OP, PK4B, ZERO_ONE); } -PK4UB { return_opcode(require_NV_fp, VECTOR_OP, PK4UB, OFF); } -PK4UB_SAT { return_opcode(require_NV_fp, VECTOR_OP, PK4UB, ZERO_ONE); } -POW { return_opcode( 1, BINSC_OP, POW, OFF); } -POW_SAT { return_opcode(require_ARB_fp, BINSC_OP, POW, ZERO_ONE); } - -RCP { return_opcode( 1, SCALAR_OP, RCP, OFF); } -RCP_SAT { return_opcode(require_ARB_fp, SCALAR_OP, RCP, ZERO_ONE); } -RFL { return_opcode(require_NV_fp, BIN_OP, RFL, OFF); } -RFL_SAT { return_opcode(require_NV_fp, BIN_OP, RFL, ZERO_ONE); } -RSQ { return_opcode( 1, SCALAR_OP, RSQ, OFF); } -RSQ_SAT { return_opcode(require_ARB_fp, SCALAR_OP, RSQ, ZERO_ONE); } - -SCS { return_opcode(require_ARB_fp, SCALAR_OP, SCS, OFF); } -SCS_SAT { return_opcode(require_ARB_fp, SCALAR_OP, SCS, ZERO_ONE); } -SEQ { return_opcode(require_NV_fp, BIN_OP, SEQ, OFF); } -SEQ_SAT { return_opcode(require_NV_fp, BIN_OP, SEQ, ZERO_ONE); } -SFL { return_opcode(require_NV_fp, BIN_OP, SFL, OFF); } -SFL_SAT { return_opcode(require_NV_fp, BIN_OP, SFL, ZERO_ONE); } -SGE { return_opcode( 1, BIN_OP, SGE, OFF); } -SGE_SAT { return_opcode(require_ARB_fp, BIN_OP, SGE, ZERO_ONE); } -SGT { return_opcode(require_NV_fp, BIN_OP, SGT, OFF); } -SGT_SAT { return_opcode(require_NV_fp, BIN_OP, SGT, ZERO_ONE); } -SIN { return_opcode(require_ARB_fp, SCALAR_OP, SIN, OFF); } -SIN_SAT { return_opcode(require_ARB_fp, SCALAR_OP, SIN, ZERO_ONE); } -SLE { return_opcode(require_NV_fp, BIN_OP, SLE, OFF); } -SLE_SAT { return_opcode(require_NV_fp, BIN_OP, SLE, ZERO_ONE); } -SLT { return_opcode( 1, BIN_OP, SLT, OFF); } -SLT_SAT { return_opcode(require_ARB_fp, BIN_OP, SLT, ZERO_ONE); } -SNE { return_opcode(require_NV_fp, BIN_OP, SNE, OFF); } -SNE_SAT { return_opcode(require_NV_fp, BIN_OP, SNE, ZERO_ONE); } -STR { return_opcode(require_NV_fp, BIN_OP, STR, OFF); } -STR_SAT { return_opcode(require_NV_fp, BIN_OP, STR, ZERO_ONE); } -SUB { return_opcode( 1, BIN_OP, SUB, OFF); } -SUB_SAT { return_opcode(require_ARB_fp, BIN_OP, SUB, ZERO_ONE); } -SWZ { return_opcode( 1, SWZ, SWZ, OFF); } -SWZ_SAT { return_opcode(require_ARB_fp, SWZ, SWZ, ZERO_ONE); } - -TEX { return_opcode(require_ARB_fp, SAMPLE_OP, TEX, OFF); } -TEX_SAT { return_opcode(require_ARB_fp, SAMPLE_OP, TEX, ZERO_ONE); } -TXB { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, OFF); } -TXB_SAT { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, ZERO_ONE); } -TXD { return_opcode(require_NV_fp, TXD_OP, TXD, OFF); } -TXD_SAT { return_opcode(require_NV_fp, TXD_OP, TXD, ZERO_ONE); } -TXP { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, OFF); } -TXP_SAT { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, ZERO_ONE); } - -UP2H { return_opcode(require_NV_fp, SCALAR_OP, UP2H, OFF); } -UP2H_SAT { return_opcode(require_NV_fp, SCALAR_OP, UP2H, ZERO_ONE); } -UP2US { return_opcode(require_NV_fp, SCALAR_OP, UP2US, OFF); } -UP2US_SAT { return_opcode(require_NV_fp, SCALAR_OP, UP2US, ZERO_ONE); } - -X2D { return_opcode(require_NV_fp, TRI_OP, X2D, OFF); } -X2D_SAT { return_opcode(require_NV_fp, TRI_OP, X2D, ZERO_ONE); } -XPD { return_opcode( 1, BIN_OP, XPD, OFF); } -XPD_SAT { return_opcode(require_ARB_fp, BIN_OP, XPD, ZERO_ONE); } +ABS{sz}{cc}{sat} { return_opcode( 1, VECTOR_OP, ABS, 3); } +ADD{sz}{cc}{sat} { return_opcode( 1, BIN_OP, ADD, 3); } +ARL { return_opcode(require_ARB_vp, ARL, ARL, 3); } + +CMP{sat} { return_opcode(require_ARB_fp, TRI_OP, CMP, 3); } +COS{szf}{cc}{sat} { return_opcode(require_ARB_fp, SCALAR_OP, COS, 3); } + +DDX{szf}{cc}{sat} { return_opcode(require_NV_fp, VECTOR_OP, DDX, 3); } +DDY{szf}{cc}{sat} { return_opcode(require_NV_fp, VECTOR_OP, DDY, 3); } +DP3{sz}{cc}{sat} { return_opcode( 1, BIN_OP, DP3, 3); } +DP4{sz}{cc}{sat} { return_opcode( 1, BIN_OP, DP4, 3); } +DPH{sz}{cc}{sat} { return_opcode( 1, BIN_OP, DPH, 3); } +DST{szf}{cc}{sat} { return_opcode( 1, BIN_OP, DST, 3); } + +EX2{szf}{cc}{sat} { return_opcode( 1, SCALAR_OP, EX2, 3); } +EXP { return_opcode(require_ARB_vp, SCALAR_OP, EXP, 3); } + +FLR{sz}{cc}{sat} { return_opcode( 1, VECTOR_OP, FLR, 3); } +FRC{sz}{cc}{sat} { return_opcode( 1, VECTOR_OP, FRC, 3); } + +KIL { return_opcode(require_ARB_fp, KIL, KIL, 3); } + +LIT{szf}{cc}{sat} { return_opcode( 1, VECTOR_OP, LIT, 3); } +LG2{szf}{cc}{sat} { return_opcode( 1, SCALAR_OP, LG2, 3); } +LOG { return_opcode(require_ARB_vp, SCALAR_OP, LOG, 3); } +LRP{sz}{cc}{sat} { return_opcode(require_ARB_fp, TRI_OP, LRP, 3); } + +MAD{sz}{cc}{sat} { return_opcode( 1, TRI_OP, MAD, 3); } +MAX{sz}{cc}{sat} { return_opcode( 1, BIN_OP, MAX, 3); } +MIN{sz}{cc}{sat} { return_opcode( 1, BIN_OP, MIN, 3); } +MOV{sz}{cc}{sat} { return_opcode( 1, VECTOR_OP, MOV, 3); } +MUL{sz}{cc}{sat} { return_opcode( 1, BIN_OP, MUL, 3); } + +PK2H { return_opcode(require_NV_fp, VECTOR_OP, PK2H, 4); } +PK2US { return_opcode(require_NV_fp, VECTOR_OP, PK2US, 5); } +PK4B { return_opcode(require_NV_fp, VECTOR_OP, PK4B, 4); } +PK4UB { return_opcode(require_NV_fp, VECTOR_OP, PK4UB, 5); } +POW{szf}{cc}{sat} { return_opcode( 1, BINSC_OP, POW, 3); } + +RCP{szf}{cc}{sat} { return_opcode( 1, SCALAR_OP, RCP, 3); } +RFL{szf}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, RFL, 3); } +RSQ{szf}{cc}{sat} { return_opcode( 1, SCALAR_OP, RSQ, 3); } + +SCS{sat} { return_opcode(require_ARB_fp, SCALAR_OP, SCS, 3); } +SEQ{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, SEQ, 3); } +SFL{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, SFL, 3); } +SGE{sz}{cc}{sat} { return_opcode( 1, BIN_OP, SGE, 3); } +SGT{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, SGT, 3); } +SIN{szf}{cc}{sat} { return_opcode(require_ARB_fp, SCALAR_OP, SIN, 3); } +SLE{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, SLE, 3); } +SLT{sz}{cc}{sat} { return_opcode( 1, BIN_OP, SLT, 3); } +SNE{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, SNE, 3); } +STR{sz}{cc}{sat} { return_opcode(require_NV_fp, BIN_OP, STR, 3); } +SUB{sz}{cc}{sat} { return_opcode( 1, BIN_OP, SUB, 3); } +SWZ{sat} { return_opcode( 1, SWZ, SWZ, 3); } + +TEX{cc}{sat} { return_opcode(require_ARB_fp, SAMPLE_OP, TEX, 3); } +TXB{cc}{sat} { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, 3); } +TXD{cc}{sat} { return_opcode(require_NV_fp, TXD_OP, TXD, 3); } +TXP{cc}{sat} { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, 3); } + +UP2H{cc}{sat} { return_opcode(require_NV_fp, SCALAR_OP, UP2H, 4); } +UP2US{cc}{sat} { return_opcode(require_NV_fp, SCALAR_OP, UP2US, 5); } + +X2D{szf}{cc}{sat} { return_opcode(require_NV_fp, TRI_OP, X2D, 3); } +XPD{sat} { return_opcode( 1, BIN_OP, XPD, 3); } vertex { return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); } fragment { return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); } diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c index b9a0e557ad..e741e9a13b 100644 --- a/src/mesa/shader/program_parse.tab.c +++ b/src/mesa/shader/program_parse.tab.c @@ -597,16 +597,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 5 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 375 +#define YYLAST 383 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 117 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 136 +#define YYNNTS 137 /* YYNRULES -- Number of rules. */ -#define YYNRULES 270 +#define YYNRULES 272 /* YYNRULES -- Number of states. */ -#define YYNSTATES 456 +#define YYNSTATES 458 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -685,11 +685,11 @@ static const yytype_uint16 yyprhs[] = 564, 566, 568, 570, 572, 575, 577, 579, 581, 583, 589, 591, 595, 601, 607, 609, 613, 619, 621, 623, 625, 627, 629, 631, 633, 635, 637, 641, 647, 655, - 665, 668, 671, 673, 675, 676, 677, 681, 682, 686, - 690, 692, 697, 700, 703, 706, 709, 713, 716, 720, - 721, 723, 725, 726, 728, 730, 731, 733, 735, 736, - 738, 740, 741, 745, 746, 750, 751, 755, 757, 759, - 761 + 665, 668, 671, 673, 675, 676, 677, 682, 684, 685, + 686, 690, 694, 696, 702, 705, 708, 711, 714, 718, + 721, 725, 726, 728, 730, 731, 733, 735, 736, 738, + 740, 741, 743, 745, 746, 750, 751, 755, 756, 760, + 762, 764, 766 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ @@ -706,7 +706,7 @@ static const yytype_int16 yyrhs[] = 108, 141, -1, 17, 142, 108, 141, 108, 141, 108, 141, -1, 15, 142, 108, 141, 108, 136, 108, 137, -1, 20, 141, -1, 22, 142, 108, 141, 108, 141, - 108, 141, 108, 136, 108, 137, -1, 83, 247, -1, + 108, 141, 108, 136, 108, 137, -1, 83, 248, -1, 84, -1, 85, -1, 86, -1, 87, -1, 88, -1, 89, -1, 90, -1, 91, -1, 92, -1, 93, -1, 94, -1, 95, -1, 21, 142, 108, 147, 108, 144, @@ -715,19 +715,19 @@ static const yytype_int16 yyrhs[] = 147, 160, 109, -1, 148, 161, -1, 156, 158, -1, 145, 108, 145, 108, 145, 108, 145, -1, 233, 146, -1, 23, -1, 99, -1, 99, -1, 164, -1, 149, - 110, 150, 111, -1, 178, -1, 240, -1, 99, -1, + 110, 150, 111, -1, 178, -1, 241, -1, 99, -1, 99, -1, 151, -1, 152, -1, 23, -1, 156, 157, 153, -1, -1, 112, 154, -1, 113, 155, -1, 23, -1, 23, -1, 99, -1, 103, -1, 103, -1, 103, -1, 103, -1, 100, -1, 104, -1, -1, 100, -1, 101, -1, 102, -1, 103, -1, -1, 163, -1, 170, - -1, 234, -1, 236, -1, 239, -1, 252, -1, 7, + -1, 234, -1, 237, -1, 240, -1, 253, -1, 7, 99, 114, 164, -1, 96, 165, -1, 38, 169, -1, - 60, -1, 98, 167, -1, 53, -1, 29, 245, -1, - 37, -1, 74, 246, -1, 50, 110, 168, 111, -1, + 60, -1, 98, 167, -1, 53, -1, 29, 246, -1, + 37, -1, 74, 247, -1, 50, 110, 168, 111, -1, 97, 110, 166, 111, -1, 23, -1, -1, 110, 168, - 111, -1, 23, -1, 60, -1, 29, 245, -1, 37, - -1, 74, 246, -1, 171, -1, 172, -1, 10, 99, + 111, -1, 23, -1, 60, -1, 29, 246, -1, 37, + -1, 74, 247, -1, 171, -1, 172, -1, 10, 99, 174, -1, 10, 99, 110, 173, 111, 175, -1, -1, 23, -1, 114, 177, -1, 114, 115, 176, 116, -1, 179, -1, 176, 108, 179, -1, 181, -1, 217, -1, @@ -736,13 +736,13 @@ static const yytype_int16 yyrhs[] = 182, -1, 73, 184, -1, 73, 187, -1, 73, 189, -1, 73, 195, -1, 73, 191, -1, 73, 198, -1, 73, 200, -1, 73, 202, -1, 73, 204, -1, 73, - 216, -1, 47, 244, 183, -1, 193, -1, 33, -1, + 216, -1, 47, 245, 183, -1, 193, -1, 33, -1, 69, -1, 43, 110, 194, 111, 185, -1, 193, -1, 60, -1, 26, -1, 72, 186, -1, 40, -1, 32, - -1, 44, 188, -1, 25, -1, 244, 67, -1, 45, - 110, 194, 111, 244, 190, -1, 193, -1, 75, 248, + -1, 44, 188, -1, 25, -1, 245, 67, -1, 45, + 110, 194, 111, 245, 190, -1, 193, -1, 75, 249, 192, -1, 29, -1, 25, -1, 31, -1, 71, -1, - 23, -1, 76, 246, 196, 197, -1, 35, -1, 54, + 23, -1, 76, 247, 196, 197, -1, 35, -1, 54, -1, 79, -1, 80, -1, 78, -1, 77, -1, 36, 199, -1, 29, -1, 56, -1, 28, 110, 201, 111, 57, -1, 23, -1, 58, 203, -1, 70, -1, 26, @@ -750,7 +750,7 @@ static const yytype_int16 yyrhs[] = -1, 66, 110, 210, 105, 210, 111, -1, 49, 211, 208, -1, -1, 209, -1, 41, -1, 82, -1, 42, -1, 23, -1, 51, 212, -1, 63, -1, 52, -1, - 81, 246, -1, 55, 110, 214, 111, -1, 48, 110, + 81, 247, -1, 55, 110, 214, 111, -1, 48, 110, 215, 111, -1, -1, 213, -1, 23, -1, 23, -1, 23, -1, 30, 64, -1, 221, -1, 224, -1, 219, -1, 222, -1, 62, 34, 110, 220, 111, -1, 225, @@ -762,16 +762,17 @@ static const yytype_int16 yyrhs[] = -1, 115, 232, 108, 232, 116, -1, 115, 232, 108, 232, 108, 232, 116, -1, 115, 232, 108, 232, 108, 232, 108, 232, 116, -1, 233, 24, -1, 233, 23, - -1, 112, -1, 113, -1, -1, -1, 11, 235, 238, - -1, -1, 5, 237, 238, -1, 238, 108, 99, -1, - 99, -1, 9, 99, 114, 240, -1, 65, 60, -1, - 65, 37, -1, 65, 241, -1, 65, 59, -1, 65, - 74, 246, -1, 65, 30, -1, 29, 242, 243, -1, - -1, 39, -1, 27, -1, -1, 61, -1, 68, -1, - -1, 39, -1, 27, -1, -1, 61, -1, 68, -1, - -1, 110, 249, 111, -1, -1, 110, 250, 111, -1, - -1, 110, 251, 111, -1, 23, -1, 23, -1, 23, - -1, 6, 99, 114, 99, -1 + -1, 112, -1, 113, -1, -1, -1, 236, 11, 235, + 239, -1, 99, -1, -1, -1, 5, 238, 239, -1, + 239, 108, 99, -1, 99, -1, 236, 9, 99, 114, + 241, -1, 65, 60, -1, 65, 37, -1, 65, 242, + -1, 65, 59, -1, 65, 74, 247, -1, 65, 30, + -1, 29, 243, 244, -1, -1, 39, -1, 27, -1, + -1, 61, -1, 68, -1, -1, 39, -1, 27, -1, + -1, 61, -1, 68, -1, -1, 110, 250, 111, -1, + -1, 110, 251, 111, -1, -1, 110, 252, 111, -1, + 23, -1, 23, -1, 23, -1, 6, 99, 114, 99, + -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ @@ -800,11 +801,11 @@ static const yytype_uint16 yyrline[] = 1598, 1603, 1616, 1624, 1635, 1643, 1643, 1645, 1645, 1647, 1657, 1662, 1669, 1679, 1688, 1693, 1700, 1710, 1720, 1732, 1732, 1733, 1733, 1735, 1745, 1753, 1763, 1771, 1779, 1788, - 1799, 1803, 1809, 1810, 1811, 1814, 1814, 1817, 1817, 1820, - 1826, 1834, 1847, 1856, 1865, 1869, 1878, 1887, 1898, 1905, - 1910, 1919, 1931, 1934, 1943, 1954, 1955, 1956, 1959, 1960, - 1961, 1964, 1965, 1968, 1969, 1972, 1973, 1976, 1987, 1998, - 2009 + 1799, 1803, 1809, 1810, 1811, 1814, 1814, 1817, 1852, 1856, + 1856, 1859, 1865, 1873, 1886, 1895, 1904, 1908, 1917, 1926, + 1937, 1944, 1949, 1958, 1970, 1973, 1982, 1993, 1994, 1995, + 1998, 1999, 2000, 2003, 2004, 2007, 2008, 2011, 2012, 2015, + 2026, 2037, 2048 }; #endif @@ -866,9 +867,10 @@ static const char *const yytname[] = "progLocalParam", "progEnvParamNum", "progLocalParamNum", "paramConstDecl", "paramConstUse", "paramConstScalarDecl", "paramConstScalarUse", "paramConstVector", "signedFloatConstant", - "optionalSign", "TEMP_statement", "@1", "ADDRESS_statement", "@2", - "varNameList", "OUTPUT_statement", "resultBinding", "resultColBinding", - "optResultFaceType", "optResultColorType", "optFaceType", "optColorType", + "optionalSign", "TEMP_statement", "@1", "optVarSize", + "ADDRESS_statement", "@2", "varNameList", "OUTPUT_statement", + "resultBinding", "resultColBinding", "optResultFaceType", + "optResultColorType", "optFaceType", "optColorType", "optTexCoordUnitNum", "optTexImageUnitNum", "optLegacyTexUnitNum", "texCoordUnitNum", "texImageUnitNum", "legacyTexUnitNum", "ALIAS_statement", 0 @@ -921,11 +923,11 @@ static const yytype_uint8 yyr1[] = 212, 213, 214, 215, 216, 217, 217, 218, 218, 219, 220, 220, 221, 222, 223, 223, 224, 225, 226, 227, 227, 228, 228, 229, 230, 230, 231, 231, 231, 231, - 232, 232, 233, 233, 233, 235, 234, 237, 236, 238, - 238, 239, 240, 240, 240, 240, 240, 240, 241, 242, - 242, 242, 243, 243, 243, 244, 244, 244, 245, 245, - 245, 246, 246, 247, 247, 248, 248, 249, 250, 251, - 252 + 232, 232, 233, 233, 233, 235, 234, 236, 236, 238, + 237, 239, 239, 240, 241, 241, 241, 241, 241, 241, + 242, 243, 243, 243, 244, 244, 244, 245, 245, 245, + 246, 246, 246, 247, 247, 248, 248, 249, 249, 250, + 251, 252, 253 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -954,11 +956,11 @@ static const yytype_uint8 yyr2[] = 1, 1, 1, 1, 2, 1, 1, 1, 1, 5, 1, 3, 5, 5, 1, 3, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 5, 7, 9, - 2, 2, 1, 1, 0, 0, 3, 0, 3, 3, - 1, 4, 2, 2, 2, 2, 3, 2, 3, 0, - 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, - 1, 0, 3, 0, 3, 0, 3, 1, 1, 1, - 4 + 2, 2, 1, 1, 0, 0, 4, 1, 0, 0, + 3, 3, 1, 5, 2, 2, 2, 2, 3, 2, + 3, 0, 1, 1, 0, 1, 1, 0, 1, 1, + 0, 1, 1, 0, 3, 0, 3, 0, 3, 1, + 1, 1, 4 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -966,143 +968,143 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint16 yydefact[] = { - 0, 3, 4, 0, 6, 1, 9, 0, 5, 0, - 0, 237, 0, 0, 0, 0, 235, 2, 0, 0, - 0, 0, 0, 0, 0, 234, 0, 0, 8, 0, - 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, - 23, 20, 0, 88, 89, 113, 114, 90, 91, 92, - 93, 7, 0, 0, 0, 0, 0, 0, 0, 64, - 0, 87, 63, 0, 0, 0, 0, 0, 75, 0, - 0, 232, 233, 31, 0, 0, 0, 10, 11, 240, - 238, 0, 0, 0, 117, 234, 115, 236, 249, 247, - 243, 245, 242, 261, 244, 234, 83, 84, 85, 86, - 53, 234, 234, 234, 234, 234, 234, 77, 54, 225, - 224, 0, 0, 0, 0, 59, 0, 234, 82, 0, - 60, 62, 126, 127, 205, 206, 128, 221, 222, 0, - 234, 0, 270, 94, 241, 118, 0, 119, 123, 124, - 125, 219, 220, 223, 0, 251, 250, 252, 0, 246, - 0, 0, 0, 0, 26, 0, 25, 24, 258, 111, - 109, 261, 96, 0, 0, 0, 0, 0, 0, 255, - 0, 255, 0, 0, 265, 261, 134, 135, 136, 137, - 139, 138, 140, 141, 142, 143, 0, 144, 258, 101, - 0, 99, 97, 261, 0, 106, 95, 82, 0, 80, - 79, 81, 51, 0, 0, 0, 239, 0, 231, 230, - 253, 254, 248, 267, 0, 234, 234, 0, 47, 0, - 50, 0, 234, 259, 260, 110, 112, 0, 0, 0, - 204, 175, 176, 174, 0, 157, 257, 256, 156, 0, - 0, 0, 0, 199, 195, 0, 194, 261, 187, 181, - 180, 179, 0, 0, 0, 0, 100, 0, 102, 0, - 0, 98, 0, 234, 226, 68, 0, 66, 67, 0, - 234, 234, 0, 116, 262, 28, 27, 0, 78, 49, - 263, 0, 0, 217, 0, 218, 0, 178, 0, 166, - 0, 158, 0, 163, 164, 147, 148, 165, 145, 146, - 0, 201, 193, 200, 0, 196, 189, 191, 190, 186, - 188, 269, 0, 162, 161, 168, 169, 0, 0, 108, - 0, 105, 0, 0, 52, 0, 61, 76, 70, 46, - 0, 0, 0, 234, 48, 0, 33, 0, 234, 212, - 216, 0, 0, 255, 203, 0, 202, 0, 266, 173, - 172, 170, 171, 167, 192, 0, 103, 104, 107, 234, - 227, 0, 0, 69, 234, 57, 58, 56, 234, 0, - 0, 0, 121, 129, 132, 130, 207, 208, 131, 268, - 0, 34, 35, 36, 37, 38, 39, 40, 41, 42, - 43, 44, 45, 30, 29, 177, 152, 154, 151, 0, - 149, 150, 0, 198, 197, 182, 0, 73, 71, 74, - 72, 0, 0, 0, 0, 133, 184, 234, 120, 264, - 155, 153, 159, 160, 234, 228, 234, 0, 0, 0, - 0, 183, 122, 0, 0, 0, 0, 210, 0, 214, - 0, 229, 234, 0, 209, 0, 213, 0, 0, 55, - 32, 211, 215, 0, 0, 185 + 0, 3, 4, 0, 6, 1, 9, 0, 5, 238, + 0, 239, 0, 0, 0, 2, 0, 0, 0, 0, + 0, 0, 0, 234, 0, 0, 237, 8, 0, 12, + 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, + 20, 0, 88, 89, 113, 114, 90, 0, 91, 92, + 93, 7, 0, 0, 0, 0, 0, 64, 0, 87, + 63, 0, 0, 0, 0, 0, 75, 0, 0, 232, + 233, 31, 0, 0, 0, 10, 11, 0, 235, 242, + 240, 0, 0, 117, 234, 115, 251, 249, 245, 247, + 244, 263, 246, 234, 83, 84, 85, 86, 53, 234, + 234, 234, 234, 234, 234, 77, 54, 225, 224, 0, + 0, 0, 0, 59, 0, 234, 82, 0, 60, 62, + 126, 127, 205, 206, 128, 221, 222, 0, 234, 0, + 0, 0, 272, 94, 118, 0, 119, 123, 124, 125, + 219, 220, 223, 0, 253, 252, 254, 0, 248, 0, + 0, 0, 0, 26, 0, 25, 24, 260, 111, 109, + 263, 96, 0, 0, 0, 0, 0, 0, 257, 0, + 257, 0, 0, 267, 263, 134, 135, 136, 137, 139, + 138, 140, 141, 142, 143, 0, 144, 260, 101, 0, + 99, 97, 263, 0, 106, 95, 82, 0, 80, 79, + 81, 51, 0, 0, 0, 0, 236, 241, 0, 231, + 230, 255, 256, 250, 269, 0, 234, 234, 0, 47, + 0, 50, 0, 234, 261, 262, 110, 112, 0, 0, + 0, 204, 175, 176, 174, 0, 157, 259, 258, 156, + 0, 0, 0, 0, 199, 195, 0, 194, 263, 187, + 181, 180, 179, 0, 0, 0, 0, 100, 0, 102, + 0, 0, 98, 0, 234, 226, 68, 0, 66, 67, + 0, 234, 234, 243, 0, 116, 264, 28, 27, 0, + 78, 49, 265, 0, 0, 217, 0, 218, 0, 178, + 0, 166, 0, 158, 0, 163, 164, 147, 148, 165, + 145, 146, 0, 201, 193, 200, 0, 196, 189, 191, + 190, 186, 188, 271, 0, 162, 161, 168, 169, 0, + 0, 108, 0, 105, 0, 0, 52, 0, 61, 76, + 70, 46, 0, 0, 0, 234, 48, 0, 33, 0, + 234, 212, 216, 0, 0, 257, 203, 0, 202, 0, + 268, 173, 172, 170, 171, 167, 192, 0, 103, 104, + 107, 234, 227, 0, 0, 69, 234, 57, 58, 56, + 234, 0, 0, 0, 121, 129, 132, 130, 207, 208, + 131, 270, 0, 34, 35, 36, 37, 38, 39, 40, + 41, 42, 43, 44, 45, 30, 29, 177, 152, 154, + 151, 0, 149, 150, 0, 198, 197, 182, 0, 73, + 71, 74, 72, 0, 0, 0, 0, 133, 184, 234, + 120, 266, 155, 153, 159, 160, 234, 228, 234, 0, + 0, 0, 0, 183, 122, 0, 0, 0, 0, 210, + 0, 214, 0, 229, 234, 0, 209, 0, 213, 0, + 0, 55, 32, 211, 215, 0, 0, 185 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 3, 4, 6, 8, 9, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 281, - 393, 41, 151, 218, 73, 60, 69, 329, 330, 367, - 219, 61, 119, 266, 267, 268, 363, 408, 410, 70, - 328, 108, 279, 202, 100, 42, 43, 120, 196, 322, - 261, 320, 162, 44, 45, 46, 136, 86, 273, 371, - 137, 121, 372, 373, 122, 176, 298, 177, 400, 421, - 178, 238, 179, 422, 180, 314, 299, 290, 181, 317, - 353, 182, 233, 183, 288, 184, 251, 185, 415, 431, - 186, 309, 310, 355, 248, 302, 303, 347, 345, 187, - 123, 375, 376, 436, 124, 377, 438, 125, 284, 286, - 378, 126, 141, 127, 128, 143, 74, 47, 57, 48, - 52, 80, 49, 62, 94, 147, 212, 239, 225, 149, - 336, 253, 214, 380, 312, 50 + -1, 3, 4, 6, 8, 9, 27, 28, 29, 30, + 31, 32, 33, 34, 35, 36, 37, 38, 39, 283, + 395, 40, 150, 219, 71, 58, 67, 331, 332, 369, + 220, 59, 117, 267, 268, 269, 365, 410, 412, 68, + 330, 106, 281, 201, 98, 41, 42, 118, 195, 324, + 262, 322, 161, 43, 44, 45, 135, 85, 275, 373, + 136, 119, 374, 375, 120, 175, 300, 176, 402, 423, + 177, 239, 178, 424, 179, 316, 301, 292, 180, 319, + 355, 181, 234, 182, 290, 183, 252, 184, 417, 433, + 185, 311, 312, 357, 249, 304, 305, 349, 347, 186, + 121, 377, 378, 438, 122, 379, 440, 123, 286, 288, + 380, 124, 140, 125, 126, 142, 72, 46, 130, 47, + 48, 52, 80, 49, 60, 92, 146, 213, 240, 226, + 148, 338, 254, 215, 382, 314, 50 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -403 +#define YYPACT_NINF -386 static const yytype_int16 yypact[] = { - 62, -403, -403, 41, -403, -403, 81, -36, -403, 198, - -8, -403, -5, 18, 20, 35, -403, -403, -23, -23, - -23, -23, -23, -23, 45, 131, -23, -23, -403, 58, - -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, - -403, -403, 67, -403, -403, -403, -403, -403, -403, -403, - -403, -403, 63, 86, 92, 128, 84, 63, 99, -403, - 69, 133, -403, 87, 89, 129, 145, 146, -403, 147, - 154, -403, -403, -403, -13, 150, 151, -403, -403, -403, - 152, 162, -14, 197, 240, -34, -403, 152, 98, -403, - -403, -403, -403, 155, -403, 131, -403, -403, -403, -403, - -403, 131, 131, 131, 131, 131, 131, -403, -403, -403, - -403, 72, 105, 77, 17, 156, 12, 131, 68, 157, - -403, -403, -403, -403, -403, -403, -403, -403, -403, 12, - 131, 165, -403, -403, -403, -403, 158, -403, -403, -403, - -403, -403, -403, -403, 223, -403, -403, -16, 245, -403, - 163, 164, -9, 167, -403, 168, -403, -403, 55, -403, - -403, 155, -403, 170, 171, 172, 206, 2, 173, 34, - 174, 127, 112, 1, 175, 155, -403, -403, -403, -403, - -403, -403, -403, -403, -403, -403, 207, -403, 55, -403, - 177, -403, -403, 155, 178, 179, -403, 68, 22, -403, - -403, -403, -403, -6, 169, 182, -403, 180, -403, -403, - -403, -403, -403, -403, 181, 131, 131, 12, -403, 188, - 190, 195, 131, -403, -403, -403, -403, 272, 273, 274, - -403, -403, -403, -403, 275, -403, -403, -403, -403, 232, - 275, 79, 191, 277, -403, 192, -403, 155, 15, -403, - -403, -403, 280, 276, 8, 194, -403, 283, -403, 284, - 283, -403, 199, 131, -403, -403, 200, -403, -403, 209, - 131, 131, 201, -403, -403, -403, -403, 204, -403, -403, - 205, 210, 211, -403, 203, -403, 212, -403, 213, -403, - 214, -403, 215, -403, -403, -403, -403, -403, -403, -403, - 286, -403, -403, -403, 294, -403, -403, -403, -403, -403, - -403, -403, 216, -403, -403, -403, -403, 161, 297, -403, - 217, -403, 218, 219, -403, 76, -403, -403, 139, -403, - 227, -4, 228, 30, -403, 298, -403, 137, 131, -403, - -403, 265, 130, 127, -403, 220, -403, 226, -403, -403, - -403, -403, -403, -403, -403, 229, -403, -403, -403, 131, - -403, 315, 319, -403, 131, -403, -403, -403, 131, 123, - 77, 80, -403, -403, -403, -403, -403, -403, -403, -403, - 233, -403, -403, -403, -403, -403, -403, -403, -403, -403, - -403, -403, -403, -403, -403, -403, -403, -403, -403, 311, - -403, -403, 9, -403, -403, -403, 83, -403, -403, -403, - -403, 237, 238, 239, 241, -403, 281, 30, -403, -403, - -403, -403, -403, -403, 131, -403, 131, 195, 272, 273, - 242, -403, -403, 234, 246, 247, 248, 243, 249, 251, - 297, -403, 131, 137, -403, 272, -403, 273, 36, -403, - -403, -403, -403, 297, 250, -403 + 203, -386, -386, 23, -386, -386, 67, -50, -386, 20, + 16, -386, 21, 37, 48, -386, -19, -19, -19, -19, + -19, -19, 58, 131, -19, -19, -386, -386, 53, -386, + -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, + -386, 64, -386, -386, -386, -386, -386, 229, -386, -386, + -386, -386, 77, 81, 89, 78, 95, -386, 75, 130, + -386, 119, 139, 140, 142, 146, -386, 147, 136, -386, + -386, -386, -14, 148, 149, -386, -386, 159, -386, -386, + 152, 162, -20, 239, -6, -386, 31, -386, -386, -386, + -386, 153, -386, 131, -386, -386, -386, -386, -386, 131, + 131, 131, 131, 131, 131, -386, -386, -386, -386, 28, + 50, 123, 40, 154, 30, 131, 101, 155, -386, -386, + -386, -386, -386, -386, -386, -386, -386, 30, 131, 156, + 77, 167, -386, -386, -386, 158, -386, -386, -386, -386, + -386, -386, -386, 218, -386, -386, 13, 244, -386, 160, + 163, -10, 164, -386, 165, -386, -386, 73, -386, -386, + 153, -386, 166, 168, 169, 210, 42, 170, 91, 171, + 100, 145, 38, 173, 153, -386, -386, -386, -386, -386, + -386, -386, -386, -386, -386, 209, -386, 73, -386, 174, + -386, -386, 153, 175, 176, -386, 101, 57, -386, -386, + -386, -386, -16, 179, 180, 225, 152, -386, 177, -386, + -386, -386, -386, -386, -386, 181, 131, 131, 30, -386, + 190, 191, 212, 131, -386, -386, -386, -386, 273, 274, + 275, -386, -386, -386, -386, 276, -386, -386, -386, -386, + 233, 276, 115, 192, 278, -386, 193, -386, 153, 9, + -386, -386, -386, 281, 277, 25, 195, -386, 284, -386, + 285, 284, -386, 200, 131, -386, -386, 199, -386, -386, + 208, 131, 131, -386, 197, -386, -386, -386, -386, 206, + -386, -386, 207, 205, 211, -386, 213, -386, 214, -386, + 215, -386, 216, -386, 217, -386, -386, -386, -386, -386, + -386, -386, 293, -386, -386, -386, 295, -386, -386, -386, + -386, -386, -386, -386, 219, -386, -386, -386, -386, 157, + 297, -386, 220, -386, 221, 222, -386, 66, -386, -386, + 133, -386, 226, -12, 230, 49, -386, 298, -386, 125, + 131, -386, -386, 265, 118, 100, -386, 228, -386, 232, + -386, -386, -386, -386, -386, -386, -386, 234, -386, -386, + -386, 131, -386, 300, 306, -386, 131, -386, -386, -386, + 131, 129, 123, 69, -386, -386, -386, -386, -386, -386, + -386, -386, 235, -386, -386, -386, -386, -386, -386, -386, + -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, + -386, 308, -386, -386, 41, -386, -386, -386, 86, -386, + -386, -386, -386, 240, 241, 231, 237, -386, 286, 49, + -386, -386, -386, -386, -386, -386, 131, -386, 131, 212, + 273, 274, 243, -386, -386, 238, 242, 247, 245, 246, + 248, 252, 297, -386, 131, 125, -386, 273, -386, 274, + 45, -386, -386, -386, -386, 297, 250, -386 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, - -403, -403, -403, -403, -403, -403, -403, -403, -403, -74, - -81, -403, -98, 141, -82, 160, -403, -403, -358, -403, - -41, -403, -403, -403, -403, -403, -403, -403, -403, 166, - -403, -403, -403, 176, -403, -403, -403, 282, -403, -403, - -403, 103, -403, -403, -403, -403, -403, -403, -403, -403, - -403, -403, -52, -403, -84, -403, -403, -403, -403, -403, - -403, -403, -403, -403, -403, -403, -333, 126, -403, -403, - -403, -403, -403, -403, -403, -403, -403, -403, -403, -403, - -3, -403, -403, -402, -403, -403, -403, -403, -403, -403, - 285, -403, -403, -403, -403, -403, -403, -403, -398, -392, - 287, -403, -403, -145, -83, -114, -85, -403, -403, -403, - -403, 314, -403, 291, -403, -403, -403, -167, 187, -149, - -403, -403, -403, -403, -403, -403 + -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, + -386, -386, -386, -386, -386, -386, -386, -386, -386, -71, + -80, -386, -96, 144, -81, 204, -386, -386, -350, -386, + -17, -386, -386, -386, -386, -386, -386, -386, -386, 161, + -386, -386, -386, 172, -386, -386, -386, 282, -386, -386, + -386, 105, -386, -386, -386, -386, -386, -386, -386, -386, + -386, -386, -52, -386, -83, -386, -386, -386, -386, -386, + -386, -386, -386, -386, -386, -386, -300, 128, -386, -386, + -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, + -2, -386, -386, -327, -386, -386, -386, -386, -386, -386, + 287, -386, -386, -386, -386, -386, -386, -386, -385, -318, + 288, -386, -386, -145, -82, -112, -84, -386, -386, -386, + -386, -386, 249, -386, 178, -386, -386, -386, -166, 186, + -131, -386, -386, -386, -386, -386, -386 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -1112,86 +1114,88 @@ static const yytype_int16 yypgoto[] = #define YYTABLE_NINF -222 static const yytype_int16 yytable[] = { - 144, 138, 142, 198, 241, 154, 411, 220, 157, 401, - 109, 110, 226, 150, 109, 110, 152, 265, 152, 365, - 153, 152, 155, 156, 111, 111, 254, 249, 112, 111, - 437, 231, 144, 118, 293, 109, 110, 439, 448, 113, - 294, 5, 58, 315, 258, 210, 188, 451, 205, 112, - 111, 454, 211, 112, 189, 452, 306, 307, 232, 235, - 113, 236, 316, 10, 113, 1, 2, 190, 434, 423, - 191, 250, 220, 237, 112, 197, 59, 192, 71, 72, - 297, 117, 114, 114, 449, 113, 115, 114, 204, 7, - 115, 193, 369, 68, 53, 366, 116, 308, 305, 51, - 217, 158, 117, 370, 293, 165, 117, 166, 114, 159, - 294, 115, 295, 167, 194, 195, 223, 54, 276, 55, - 168, 169, 170, 224, 171, 145, 172, 117, 88, 89, - 263, 152, 160, 275, 56, 173, 90, 146, 264, 163, - 282, 453, 71, 72, 68, 117, 161, 405, 296, 325, - 297, 164, 174, 175, 236, 293, 396, 413, 91, 92, - 242, 294, 79, 243, 244, 77, 237, 245, 199, 414, - 397, 200, 201, 93, 78, 246, 402, 95, 144, 63, - 64, 65, 66, 67, 359, 331, 75, 76, 417, 332, - 398, 424, 360, 247, 84, 101, 418, 102, 85, 425, - 81, 297, 399, 11, 12, 13, 82, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, - 27, 381, 382, 383, 384, 385, 386, 387, 388, 389, - 390, 391, 392, 96, 97, 98, 99, 103, 349, 350, - 351, 352, 83, 71, 72, 406, 208, 209, 144, 374, - 142, 361, 362, 104, 105, 106, 394, 107, 129, 130, - 131, 132, 58, 135, 206, 148, -65, 203, 213, 207, - 230, 215, 216, 255, 144, 221, 222, 270, 280, 331, - 227, 228, 229, 234, 240, 252, 412, 257, 259, 260, - 271, 278, 274, -221, 272, 283, 285, 287, 289, 291, - 301, 300, 304, 311, 318, 313, 319, 321, 324, 344, - 433, 326, 327, 334, 339, 335, 333, 346, 337, 338, - 354, 379, 395, 340, 341, 342, 343, 348, 356, 357, - 358, 403, 144, 374, 142, 364, 368, 404, 407, 144, - 405, 331, 409, 420, 419, 426, 427, 430, 445, 428, - 441, 429, 440, 435, 442, 443, 447, 331, 277, 444, - 446, 455, 450, 323, 133, 432, 292, 416, 0, 269, - 139, 87, 140, 262, 134, 256 + 143, 137, 141, 197, 242, 153, 221, 266, 156, 107, + 108, 367, 149, 107, 108, 151, 413, 151, 109, 152, + 151, 154, 155, 5, 109, 11, 12, 13, 109, 227, + 14, 143, 15, 16, 17, 18, 19, 20, 21, 22, + 23, 24, 25, 255, 403, 439, 56, 204, 110, 10, + 308, 309, 110, 107, 108, 116, 110, 157, 144, 111, + 317, 259, 453, 111, 250, 158, 295, 111, 109, 187, + 145, 232, 296, 221, 211, 7, 112, 188, 436, 318, + 57, 212, 112, 66, 162, 113, 112, 368, 159, 113, + 189, 310, 110, 190, 451, 114, 163, 196, 233, 218, + 191, 115, 160, 111, 425, 115, 69, 70, 251, 115, + 203, 371, 299, 441, 192, 450, 236, 307, 237, 26, + 53, 278, 372, 51, 86, 87, 112, 237, 456, 113, + 238, 454, 88, 151, 224, 277, 54, 193, 194, 238, + 295, 225, 284, 295, 398, 115, 296, 55, 297, 296, + 455, 164, 327, 165, 89, 90, 407, 66, 399, 166, + 75, 69, 70, 415, 115, 264, 167, 168, 169, 91, + 170, 76, 171, 265, 361, 416, 79, 419, 400, 404, + 143, 172, 362, 93, 298, 420, 299, 333, 83, 299, + 401, 334, 84, 243, 426, 81, 244, 245, 173, 174, + 246, 198, 427, 82, 199, 200, 1, 2, 247, 383, + 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, + 394, 61, 62, 63, 64, 65, 248, 99, 73, 74, + 94, 95, 96, 97, 351, 352, 353, 354, 77, 105, + 78, 209, 210, 69, 70, 363, 364, 100, 101, 408, + 102, 143, 376, 141, 103, 104, 127, 128, 129, 396, + 131, 132, 134, 147, -65, 202, 207, 214, 216, 208, + 205, 217, 222, 223, 231, 256, 228, 143, 229, 230, + 235, 241, 333, 253, 258, 260, 261, 271, 272, 414, + 56, 274, 276, 280, -221, 282, 285, 287, 289, 291, + 293, 303, 302, 306, 313, 320, 315, 321, 323, 326, + 328, 329, 335, 339, 435, 336, 346, 337, 348, 340, + 356, 381, 397, 409, 341, 342, 343, 344, 345, 411, + 350, 358, 359, 360, 366, 143, 376, 141, 370, 405, + 422, 430, 143, 406, 333, 407, 421, 431, 428, 429, + 444, 447, 432, 442, 443, 445, 446, 449, 437, 448, + 333, 457, 279, 270, 133, 452, 325, 434, 263, 294, + 418, 138, 139, 257, 0, 0, 0, 0, 0, 206, + 0, 0, 0, 273 }; static const yytype_int16 yycheck[] = { - 85, 85, 85, 117, 171, 103, 364, 152, 106, 342, - 23, 24, 161, 95, 23, 24, 101, 23, 103, 23, - 102, 106, 104, 105, 38, 38, 175, 26, 62, 38, - 428, 29, 117, 74, 25, 23, 24, 429, 440, 73, - 31, 0, 65, 35, 193, 61, 29, 445, 130, 62, - 38, 453, 68, 62, 37, 447, 41, 42, 56, 25, - 73, 27, 54, 99, 73, 3, 4, 50, 426, 402, - 53, 70, 217, 39, 62, 116, 99, 60, 112, 113, - 71, 115, 96, 96, 442, 73, 99, 96, 129, 8, - 99, 74, 62, 99, 99, 99, 109, 82, 247, 107, - 109, 29, 115, 73, 25, 28, 115, 30, 96, 37, - 31, 99, 33, 36, 97, 98, 61, 99, 216, 99, - 43, 44, 45, 68, 47, 27, 49, 115, 29, 30, - 108, 216, 60, 215, 99, 58, 37, 39, 116, 34, - 222, 105, 112, 113, 99, 115, 74, 111, 69, 263, - 71, 46, 75, 76, 27, 25, 26, 34, 59, 60, - 48, 31, 99, 51, 52, 107, 39, 55, 100, 46, - 40, 103, 104, 74, 107, 63, 343, 108, 263, 19, - 20, 21, 22, 23, 108, 270, 26, 27, 108, 271, - 60, 108, 116, 81, 110, 108, 116, 108, 114, 116, - 114, 71, 72, 5, 6, 7, 114, 9, 10, 11, - 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 100, 101, 102, 103, 108, 77, 78, - 79, 80, 114, 112, 113, 359, 23, 24, 333, 333, - 333, 112, 113, 108, 108, 108, 338, 103, 108, 108, - 108, 99, 65, 23, 99, 110, 110, 110, 23, 111, - 64, 108, 108, 66, 359, 108, 108, 108, 83, 364, - 110, 110, 110, 110, 110, 110, 368, 110, 110, 110, - 108, 103, 111, 103, 114, 23, 23, 23, 23, 67, - 23, 110, 110, 23, 110, 29, 23, 23, 109, 23, - 424, 111, 103, 109, 111, 110, 115, 23, 108, 108, - 23, 23, 57, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 417, 417, 417, 108, 108, 111, 23, 424, - 111, 426, 23, 32, 111, 108, 108, 66, 105, 110, - 116, 110, 110, 427, 108, 108, 105, 442, 217, 111, - 111, 111, 443, 260, 82, 417, 240, 370, -1, 203, - 85, 57, 85, 197, 83, 188 + 84, 84, 84, 115, 170, 101, 151, 23, 104, 23, + 24, 23, 93, 23, 24, 99, 366, 101, 38, 100, + 104, 102, 103, 0, 38, 5, 6, 7, 38, 160, + 10, 115, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 174, 344, 430, 65, 128, 62, 99, + 41, 42, 62, 23, 24, 72, 62, 29, 27, 73, + 35, 192, 447, 73, 26, 37, 25, 73, 38, 29, + 39, 29, 31, 218, 61, 8, 96, 37, 428, 54, + 99, 68, 96, 99, 34, 99, 96, 99, 60, 99, + 50, 82, 62, 53, 444, 109, 46, 114, 56, 109, + 60, 115, 74, 73, 404, 115, 112, 113, 70, 115, + 127, 62, 71, 431, 74, 442, 25, 248, 27, 99, + 99, 217, 73, 107, 29, 30, 96, 27, 455, 99, + 39, 449, 37, 217, 61, 216, 99, 97, 98, 39, + 25, 68, 223, 25, 26, 115, 31, 99, 33, 31, + 105, 28, 264, 30, 59, 60, 111, 99, 40, 36, + 107, 112, 113, 34, 115, 108, 43, 44, 45, 74, + 47, 107, 49, 116, 108, 46, 99, 108, 60, 345, + 264, 58, 116, 108, 69, 116, 71, 271, 110, 71, + 72, 272, 114, 48, 108, 114, 51, 52, 75, 76, + 55, 100, 116, 114, 103, 104, 3, 4, 63, 84, + 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, + 95, 17, 18, 19, 20, 21, 81, 108, 24, 25, + 100, 101, 102, 103, 77, 78, 79, 80, 9, 103, + 11, 23, 24, 112, 113, 112, 113, 108, 108, 361, + 108, 335, 335, 335, 108, 108, 108, 108, 99, 340, + 108, 99, 23, 110, 110, 110, 99, 23, 108, 111, + 114, 108, 108, 108, 64, 66, 110, 361, 110, 110, + 110, 110, 366, 110, 110, 110, 110, 108, 108, 370, + 65, 114, 111, 103, 103, 83, 23, 23, 23, 23, + 67, 23, 110, 110, 23, 110, 29, 23, 23, 109, + 111, 103, 115, 108, 426, 109, 23, 110, 23, 108, + 23, 23, 57, 23, 111, 111, 111, 111, 111, 23, + 111, 111, 111, 111, 108, 419, 419, 419, 108, 111, + 32, 110, 426, 111, 428, 111, 111, 110, 108, 108, + 108, 105, 66, 110, 116, 108, 111, 105, 429, 111, + 444, 111, 218, 202, 82, 445, 261, 419, 196, 241, + 372, 84, 84, 187, -1, -1, -1, -1, -1, 130, + -1, -1, -1, 205 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing @@ -1199,51 +1203,51 @@ static const yytype_int16 yycheck[] = static const yytype_uint8 yystos[] = { 0, 3, 4, 118, 119, 0, 120, 8, 121, 122, - 99, 5, 6, 7, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 123, 124, - 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, - 135, 138, 162, 163, 170, 171, 172, 234, 236, 239, - 252, 107, 237, 99, 99, 99, 99, 235, 65, 99, - 142, 148, 240, 142, 142, 142, 142, 142, 99, 143, - 156, 112, 113, 141, 233, 142, 142, 107, 107, 99, - 238, 114, 114, 114, 110, 114, 174, 238, 29, 30, - 37, 59, 60, 74, 241, 108, 100, 101, 102, 103, - 161, 108, 108, 108, 108, 108, 108, 103, 158, 23, - 24, 38, 62, 73, 96, 99, 109, 115, 147, 149, - 164, 178, 181, 217, 221, 224, 228, 230, 231, 108, - 108, 108, 99, 164, 240, 23, 173, 177, 181, 217, - 227, 229, 231, 232, 233, 27, 39, 242, 110, 246, - 141, 139, 233, 141, 139, 141, 141, 139, 29, 37, - 60, 74, 169, 34, 46, 28, 30, 36, 43, 44, - 45, 47, 49, 58, 75, 76, 182, 184, 187, 189, - 191, 195, 198, 200, 202, 204, 207, 216, 29, 37, - 50, 53, 60, 74, 97, 98, 165, 147, 232, 100, - 103, 104, 160, 110, 147, 141, 99, 111, 23, 24, - 61, 68, 243, 23, 249, 108, 108, 109, 140, 147, - 230, 108, 108, 61, 68, 245, 246, 110, 110, 110, - 64, 29, 56, 199, 110, 25, 27, 39, 188, 244, - 110, 244, 48, 51, 52, 55, 63, 81, 211, 26, - 70, 203, 110, 248, 246, 66, 245, 110, 246, 110, - 110, 167, 160, 108, 116, 23, 150, 151, 152, 156, - 108, 108, 114, 175, 111, 141, 139, 140, 103, 159, - 83, 136, 141, 23, 225, 23, 226, 23, 201, 23, - 194, 67, 194, 25, 31, 33, 69, 71, 183, 193, - 110, 23, 212, 213, 110, 246, 41, 42, 82, 208, - 209, 23, 251, 29, 192, 35, 54, 196, 110, 23, - 168, 23, 166, 168, 109, 232, 111, 103, 157, 144, - 145, 233, 141, 115, 109, 110, 247, 108, 108, 111, - 111, 111, 111, 111, 23, 215, 23, 214, 111, 77, - 78, 79, 80, 197, 23, 210, 111, 111, 111, 108, - 116, 112, 113, 153, 108, 23, 99, 146, 108, 62, - 73, 176, 179, 180, 181, 218, 219, 222, 227, 23, - 250, 84, 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 137, 141, 57, 26, 40, 60, 72, - 185, 193, 244, 111, 111, 111, 232, 23, 154, 23, - 155, 145, 141, 34, 46, 205, 207, 108, 116, 111, - 32, 186, 190, 193, 108, 116, 108, 108, 110, 110, - 66, 206, 179, 232, 145, 136, 220, 225, 223, 226, - 110, 116, 108, 108, 111, 105, 111, 105, 210, 145, - 137, 225, 226, 105, 210, 111 + 99, 5, 6, 7, 10, 12, 13, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 99, 123, 124, 125, + 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, + 138, 162, 163, 170, 171, 172, 234, 236, 237, 240, + 253, 107, 238, 99, 99, 99, 65, 99, 142, 148, + 241, 142, 142, 142, 142, 142, 99, 143, 156, 112, + 113, 141, 233, 142, 142, 107, 107, 9, 11, 99, + 239, 114, 114, 110, 114, 174, 29, 30, 37, 59, + 60, 74, 242, 108, 100, 101, 102, 103, 161, 108, + 108, 108, 108, 108, 108, 103, 158, 23, 24, 38, + 62, 73, 96, 99, 109, 115, 147, 149, 164, 178, + 181, 217, 221, 224, 228, 230, 231, 108, 108, 99, + 235, 108, 99, 164, 23, 173, 177, 181, 217, 227, + 229, 231, 232, 233, 27, 39, 243, 110, 247, 141, + 139, 233, 141, 139, 141, 141, 139, 29, 37, 60, + 74, 169, 34, 46, 28, 30, 36, 43, 44, 45, + 47, 49, 58, 75, 76, 182, 184, 187, 189, 191, + 195, 198, 200, 202, 204, 207, 216, 29, 37, 50, + 53, 60, 74, 97, 98, 165, 147, 232, 100, 103, + 104, 160, 110, 147, 141, 114, 239, 99, 111, 23, + 24, 61, 68, 244, 23, 250, 108, 108, 109, 140, + 147, 230, 108, 108, 61, 68, 246, 247, 110, 110, + 110, 64, 29, 56, 199, 110, 25, 27, 39, 188, + 245, 110, 245, 48, 51, 52, 55, 63, 81, 211, + 26, 70, 203, 110, 249, 247, 66, 246, 110, 247, + 110, 110, 167, 160, 108, 116, 23, 150, 151, 152, + 156, 108, 108, 241, 114, 175, 111, 141, 139, 140, + 103, 159, 83, 136, 141, 23, 225, 23, 226, 23, + 201, 23, 194, 67, 194, 25, 31, 33, 69, 71, + 183, 193, 110, 23, 212, 213, 110, 247, 41, 42, + 82, 208, 209, 23, 252, 29, 192, 35, 54, 196, + 110, 23, 168, 23, 166, 168, 109, 232, 111, 103, + 157, 144, 145, 233, 141, 115, 109, 110, 248, 108, + 108, 111, 111, 111, 111, 111, 23, 215, 23, 214, + 111, 77, 78, 79, 80, 197, 23, 210, 111, 111, + 111, 108, 116, 112, 113, 153, 108, 23, 99, 146, + 108, 62, 73, 176, 179, 180, 181, 218, 219, 222, + 227, 23, 251, 84, 85, 86, 87, 88, 89, 90, + 91, 92, 93, 94, 95, 137, 141, 57, 26, 40, + 60, 72, 185, 193, 245, 111, 111, 111, 232, 23, + 154, 23, 155, 145, 141, 34, 46, 205, 207, 108, + 116, 111, 32, 186, 190, 193, 108, 116, 108, 108, + 110, 110, 66, 206, 179, 232, 145, 136, 220, 225, + 223, 226, 110, 116, 108, 108, 111, 105, 111, 105, + 210, 145, 137, 225, 226, 105, 210, 111 }; #define yyerrok (yyerrstatus = 0) @@ -4350,20 +4354,67 @@ yyreduce: /* Line 1455 of yacc.c */ #line 1814 "program_parse.y" - { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} + { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; case 237: /* Line 1455 of yacc.c */ -#line 1817 "program_parse.y" - { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} +#line 1818 "program_parse.y" + { + /* NV_fragment_program_option defines the size qualifiers in a + * fairly broken way. "SHORT" or "LONG" can optionally be used + * before TEMP or OUTPUT. However, neither is a reserved word! + * This means that we have to parse it as an identifier, then check + * to make sure it's one of the valid values. *sigh* + * + * In addition, the grammar in the extension spec does *not* allow + * the size specifier to be optional, but all known implementations + * do. + */ + if (!state->option.NV_fragment) { + yyerror(& (yylsp[(1) - (1)]), state, "unexpected IDENTIFIER"); + YYERROR; + } + + if (strcmp("SHORT", (yyvsp[(1) - (1)].string)) == 0) { + } else if (strcmp("LONG", (yyvsp[(1) - (1)].string)) == 0) { + } else { + char *const err_str = + make_error_string("invalid storage size specifier \"%s\"", + (yyvsp[(1) - (1)].string)); + + yyerror(& (yylsp[(1) - (1)]), state, (err_str != NULL) + ? err_str : "invalid storage size specifier"); + + if (err_str != NULL) { + _mesa_free(err_str); + } + + YYERROR; + } + ;} + break; + + case 238: + +/* Line 1455 of yacc.c */ +#line 1852 "program_parse.y" + { + ;} break; case 239: /* Line 1455 of yacc.c */ -#line 1821 "program_parse.y" +#line 1856 "program_parse.y" + { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} + break; + + case 241: + +/* Line 1455 of yacc.c */ +#line 1860 "program_parse.y" { if (!declare_variable(state, (yyvsp[(3) - (3)].string), (yyvsp[(0) - (3)].integer), & (yylsp[(3) - (3)]))) { YYERROR; @@ -4371,10 +4422,10 @@ yyreduce: ;} break; - case 240: + case 242: /* Line 1455 of yacc.c */ -#line 1827 "program_parse.y" +#line 1866 "program_parse.y" { if (!declare_variable(state, (yyvsp[(1) - (1)].string), (yyvsp[(0) - (1)].integer), & (yylsp[(1) - (1)]))) { YYERROR; @@ -4382,26 +4433,26 @@ yyreduce: ;} break; - case 241: + case 243: /* Line 1455 of yacc.c */ -#line 1835 "program_parse.y" +#line 1874 "program_parse.y" { struct asm_symbol *const s = - declare_variable(state, (yyvsp[(2) - (4)].string), at_output, & (yylsp[(2) - (4)])); + declare_variable(state, (yyvsp[(3) - (5)].string), at_output, & (yylsp[(3) - (5)])); if (s == NULL) { YYERROR; } else { - s->output_binding = (yyvsp[(4) - (4)].result); + s->output_binding = (yyvsp[(5) - (5)].result); } ;} break; - case 242: + case 244: /* Line 1455 of yacc.c */ -#line 1848 "program_parse.y" +#line 1887 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_HPOS; @@ -4412,10 +4463,10 @@ yyreduce: ;} break; - case 243: + case 245: /* Line 1455 of yacc.c */ -#line 1857 "program_parse.y" +#line 1896 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_FOGC; @@ -4426,19 +4477,19 @@ yyreduce: ;} break; - case 244: + case 246: /* Line 1455 of yacc.c */ -#line 1866 "program_parse.y" +#line 1905 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (2)].result); ;} break; - case 245: + case 247: /* Line 1455 of yacc.c */ -#line 1870 "program_parse.y" +#line 1909 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_PSIZ; @@ -4449,10 +4500,10 @@ yyreduce: ;} break; - case 246: + case 248: /* Line 1455 of yacc.c */ -#line 1879 "program_parse.y" +#line 1918 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_TEX0 + (yyvsp[(3) - (3)].integer); @@ -4463,10 +4514,10 @@ yyreduce: ;} break; - case 247: + case 249: /* Line 1455 of yacc.c */ -#line 1888 "program_parse.y" +#line 1927 "program_parse.y" { if (state->mode == ARB_fragment) { (yyval.result) = FRAG_RESULT_DEPTH; @@ -4477,19 +4528,19 @@ yyreduce: ;} break; - case 248: + case 250: /* Line 1455 of yacc.c */ -#line 1899 "program_parse.y" +#line 1938 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (3)].integer) + (yyvsp[(3) - (3)].integer); ;} break; - case 249: + case 251: /* Line 1455 of yacc.c */ -#line 1905 "program_parse.y" +#line 1944 "program_parse.y" { (yyval.integer) = (state->mode == ARB_vertex) ? VERT_RESULT_COL0 @@ -4497,10 +4548,10 @@ yyreduce: ;} break; - case 250: + case 252: /* Line 1455 of yacc.c */ -#line 1911 "program_parse.y" +#line 1950 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_COL0; @@ -4511,10 +4562,10 @@ yyreduce: ;} break; - case 251: + case 253: /* Line 1455 of yacc.c */ -#line 1920 "program_parse.y" +#line 1959 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_BFC0; @@ -4525,19 +4576,19 @@ yyreduce: ;} break; - case 252: + case 254: /* Line 1455 of yacc.c */ -#line 1931 "program_parse.y" +#line 1970 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 253: + case 255: /* Line 1455 of yacc.c */ -#line 1935 "program_parse.y" +#line 1974 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 0; @@ -4548,10 +4599,10 @@ yyreduce: ;} break; - case 254: + case 256: /* Line 1455 of yacc.c */ -#line 1944 "program_parse.y" +#line 1983 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 1; @@ -4562,94 +4613,94 @@ yyreduce: ;} break; - case 255: + case 257: /* Line 1455 of yacc.c */ -#line 1954 "program_parse.y" +#line 1993 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 256: + case 258: /* Line 1455 of yacc.c */ -#line 1955 "program_parse.y" +#line 1994 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 257: + case 259: /* Line 1455 of yacc.c */ -#line 1956 "program_parse.y" +#line 1995 "program_parse.y" { (yyval.integer) = 1; ;} break; - case 258: + case 260: /* Line 1455 of yacc.c */ -#line 1959 "program_parse.y" +#line 1998 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 259: + case 261: /* Line 1455 of yacc.c */ -#line 1960 "program_parse.y" +#line 1999 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 260: + case 262: /* Line 1455 of yacc.c */ -#line 1961 "program_parse.y" +#line 2000 "program_parse.y" { (yyval.integer) = 1; ;} break; - case 261: + case 263: /* Line 1455 of yacc.c */ -#line 1964 "program_parse.y" +#line 2003 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 262: + case 264: /* Line 1455 of yacc.c */ -#line 1965 "program_parse.y" +#line 2004 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; - case 263: + case 265: /* Line 1455 of yacc.c */ -#line 1968 "program_parse.y" +#line 2007 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 264: + case 266: /* Line 1455 of yacc.c */ -#line 1969 "program_parse.y" +#line 2008 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; - case 265: + case 267: /* Line 1455 of yacc.c */ -#line 1972 "program_parse.y" +#line 2011 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 266: + case 268: /* Line 1455 of yacc.c */ -#line 1973 "program_parse.y" +#line 2012 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; - case 267: + case 269: /* Line 1455 of yacc.c */ -#line 1977 "program_parse.y" +#line 2016 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureCoordUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture coordinate unit selector"); @@ -4660,10 +4711,10 @@ yyreduce: ;} break; - case 268: + case 270: /* Line 1455 of yacc.c */ -#line 1988 "program_parse.y" +#line 2027 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureImageUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture image unit selector"); @@ -4674,10 +4725,10 @@ yyreduce: ;} break; - case 269: + case 271: /* Line 1455 of yacc.c */ -#line 1999 "program_parse.y" +#line 2038 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture unit selector"); @@ -4688,10 +4739,10 @@ yyreduce: ;} break; - case 270: + case 272: /* Line 1455 of yacc.c */ -#line 2010 "program_parse.y" +#line 2049 "program_parse.y" { struct asm_symbol *exist = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(2) - (4)].string)); @@ -4715,7 +4766,7 @@ yyreduce: /* Line 1455 of yacc.c */ -#line 4719 "program_parse.tab.c" +#line 4770 "program_parse.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -4934,7 +4985,7 @@ yyreturn: /* Line 1675 of yacc.c */ -#line 2030 "program_parse.y" +#line 2069 "program_parse.y" void @@ -5004,7 +5055,10 @@ asm_instruction_copy_ctor(const struct prog_instruction *base, if (inst) { _mesa_init_instructions(& inst->Base, 1); inst->Base.Opcode = base->Opcode; + inst->Base.CondUpdate = base->CondUpdate; + inst->Base.CondDst = base->CondDst; inst->Base.SaturateMode = base->SaturateMode; + inst->Base.Precision = base->Precision; asm_instruction_set_operands(inst, dst, src0, src1, src2); } diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index 4e2912d1c4..51cc9f7f11 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -1811,7 +1811,46 @@ optionalSign: '+' { $$ = FALSE; } | { $$ = FALSE; } ; -TEMP_statement: TEMP { $$ = $1; } varNameList +TEMP_statement: optVarSize TEMP { $$ = $2; } varNameList + ; + +optVarSize: IDENTIFIER + { + /* NV_fragment_program_option defines the size qualifiers in a + * fairly broken way. "SHORT" or "LONG" can optionally be used + * before TEMP or OUTPUT. However, neither is a reserved word! + * This means that we have to parse it as an identifier, then check + * to make sure it's one of the valid values. *sigh* + * + * In addition, the grammar in the extension spec does *not* allow + * the size specifier to be optional, but all known implementations + * do. + */ + if (!state->option.NV_fragment) { + yyerror(& @1, state, "unexpected IDENTIFIER"); + YYERROR; + } + + if (strcmp("SHORT", $1) == 0) { + } else if (strcmp("LONG", $1) == 0) { + } else { + char *const err_str = + make_error_string("invalid storage size specifier \"%s\"", + $1); + + yyerror(& @1, state, (err_str != NULL) + ? err_str : "invalid storage size specifier"); + + if (err_str != NULL) { + _mesa_free(err_str); + } + + YYERROR; + } + } + | + { + } ; ADDRESS_statement: ADDRESS { $$ = $1; } varNameList @@ -1831,15 +1870,15 @@ varNameList: varNameList ',' IDENTIFIER } ; -OUTPUT_statement: OUTPUT IDENTIFIER '=' resultBinding +OUTPUT_statement: optVarSize OUTPUT IDENTIFIER '=' resultBinding { struct asm_symbol *const s = - declare_variable(state, $2, at_output, & @2); + declare_variable(state, $3, at_output, & @3); if (s == NULL) { YYERROR; } else { - s->output_binding = $4; + s->output_binding = $5; } } ; @@ -2096,7 +2135,10 @@ asm_instruction_copy_ctor(const struct prog_instruction *base, if (inst) { _mesa_init_instructions(& inst->Base, 1); inst->Base.Opcode = base->Opcode; + inst->Base.CondUpdate = base->CondUpdate; + inst->Base.CondDst = base->CondDst; inst->Base.SaturateMode = base->SaturateMode; + inst->Base.Precision = base->Precision; asm_instruction_set_operands(inst, dst, src0, src1, src2); } diff --git a/src/mesa/shader/program_parse_extra.c b/src/mesa/shader/program_parse_extra.c index 79e80c54d7..cb7b7a5fb2 100644 --- a/src/mesa/shader/program_parse_extra.c +++ b/src/mesa/shader/program_parse_extra.c @@ -33,6 +33,67 @@ * \author Ian Romanick */ +int +_mesa_parse_instruction_suffix(const struct asm_parser_state *state, + const char *suffix, + struct prog_instruction *inst) +{ + inst->CondUpdate = 0; + inst->CondDst = 0; + inst->SaturateMode = SATURATE_OFF; + inst->Precision = FLOAT32; + + + /* The first possible suffix element is the precision specifier from + * NV_fragment_program_option. + */ + if (state->option.NV_fragment) { + switch (suffix[0]) { + case 'H': + inst->Precision = FLOAT16; + suffix++; + break; + case 'R': + inst->Precision = FLOAT32; + suffix++; + break; + case 'X': + inst->Precision = FIXED12; + suffix++; + break; + default: + break; + } + } + + /* The next possible suffix element is the condition code modifier selection + * from NV_fragment_program_option. + */ + if (state->option.NV_fragment) { + if (suffix[0] == 'C') { + inst->CondUpdate = 1; + suffix++; + } + } + + + /* The final possible suffix element is the saturation selector from + * ARB_fragment_program. + */ + if (state->mode == ARB_fragment) { + if (strcmp(suffix, "_SAT") == 0) { + inst->SaturateMode = SATURATE_ZERO_ONE; + suffix += 4; + } + } + + + /* It is an error for all of the suffix string not to be consumed. + */ + return suffix[0] == '\0'; +} + + int _mesa_ARBvp_parse_option(struct asm_parser_state *state, const char *option) { diff --git a/src/mesa/shader/program_parser.h b/src/mesa/shader/program_parser.h index be32a1bed1..497891f53d 100644 --- a/src/mesa/shader/program_parser.h +++ b/src/mesa/shader/program_parser.h @@ -264,4 +264,18 @@ extern int _mesa_ARBvp_parse_option(struct asm_parser_state *state, extern int _mesa_ARBfp_parse_option(struct asm_parser_state *state, const char *option); +/** + * Parses and processes instruction suffixes + * + * Instruction suffixes, such as \c _SAT, are processed. The relevant bits + * are set in \c inst. If suffixes are encountered that are either not known + * or not supported by the modes and options set in \c state, zero will be + * returned. + * + * \return + * Non-zero on success, zero on failure. + */ +extern int _mesa_parse_instruction_suffix(const struct asm_parser_state *state, + const char *suffix, struct prog_instruction *inst); + /*@}*/ -- cgit v1.2.3 From e95e76e1255a3ad0ce604271301d090337b2e82b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sun, 6 Sep 2009 11:47:40 +0200 Subject: r300/compiler: New dataflow structures and passes This replaces the old NQSSADCE code with the same functionality, but quite different design. Instead of doing a single integerated pass, we now build explicit data structures representing the dataflow. This will enable analysis of flow control instruction, and could potentially open an avenue for several dataflow based optimizations, such as peephole optimization, fusing MUL+ADD to MAD, and so on. --- src/mesa/drivers/dri/r300/compiler/Makefile | 8 +- .../dri/r300/compiler/r300_fragprog_swizzle.c | 35 +- .../dri/r300/compiler/r300_fragprog_swizzle.h | 7 +- src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c | 38 +-- src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c | 50 +-- src/mesa/drivers/dri/r300/compiler/r500_fragprog.c | 24 +- src/mesa/drivers/dri/r300/compiler/r500_fragprog.h | 6 +- .../drivers/dri/r300/compiler/radeon_compiler.c | 35 ++ .../drivers/dri/r300/compiler/radeon_compiler.h | 26 ++ .../drivers/dri/r300/compiler/radeon_dataflow.c | 106 ++++++ .../drivers/dri/r300/compiler/radeon_dataflow.h | 113 +++++++ .../dri/r300/compiler/radeon_dataflow_annotate.c | 365 +++++++++++++++++++++ .../dri/r300/compiler/radeon_dataflow_dealias.c | 150 +++++++++ .../dri/r300/compiler/radeon_dataflow_swizzles.c | 126 +++++++ .../drivers/dri/r300/compiler/radeon_nqssadce.c | 267 --------------- .../drivers/dri/r300/compiler/radeon_nqssadce.h | 92 ------ .../drivers/dri/r300/compiler/radeon_opcodes.c | 87 +++-- .../drivers/dri/r300/compiler/radeon_opcodes.h | 8 + .../drivers/dri/r300/compiler/radeon_program.c | 150 +-------- .../drivers/dri/r300/compiler/radeon_program.h | 110 +------ .../dri/r300/compiler/radeon_program_constants.h | 128 ++++++++ .../dri/r300/compiler/radeon_program_print.c | 214 ++++++++++++ .../drivers/dri/r300/compiler/radeon_swizzle.h | 57 ++++ src/mesa/drivers/dri/r300/r300_vertprog.c | 1 - 24 files changed, 1486 insertions(+), 717 deletions(-) create mode 100644 src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c create mode 100644 src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h create mode 100644 src/mesa/drivers/dri/r300/compiler/radeon_dataflow_annotate.c create mode 100644 src/mesa/drivers/dri/r300/compiler/radeon_dataflow_dealias.c create mode 100644 src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c delete mode 100644 src/mesa/drivers/dri/r300/compiler/radeon_nqssadce.c delete mode 100644 src/mesa/drivers/dri/r300/compiler/radeon_nqssadce.h create mode 100644 src/mesa/drivers/dri/r300/compiler/radeon_program_constants.h create mode 100644 src/mesa/drivers/dri/r300/compiler/radeon_program_print.c create mode 100644 src/mesa/drivers/dri/r300/compiler/radeon_swizzle.h (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/Makefile b/src/mesa/drivers/dri/r300/compiler/Makefile index 080c79898b..53fb7caa95 100644 --- a/src/mesa/drivers/dri/r300/compiler/Makefile +++ b/src/mesa/drivers/dri/r300/compiler/Makefile @@ -8,11 +8,15 @@ LIBNAME = r300compiler C_SOURCES = \ radeon_code.c \ radeon_compiler.c \ - radeon_nqssadce.c \ radeon_program.c \ - radeon_opcodes.c \ + radeon_program_print.c \ + radeon_opcodes.c \ radeon_program_alu.c \ radeon_program_pair.c \ + radeon_dataflow.c \ + radeon_dataflow_annotate.c \ + radeon_dataflow_dealias.c \ + radeon_dataflow_swizzles.c \ r3xx_fragprog.c \ r300_fragprog.c \ r300_fragprog_swizzle.c \ diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c index ded6966d08..cfa48a59e3 100644 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.c @@ -36,7 +36,6 @@ #include #include "../r300_reg.h" -#include "radeon_nqssadce.h" #include "radeon_compiler.h" #define MAKE_SWZ3(x, y, z) (RC_MAKE_SWIZZLE(RC_SWIZZLE_##x, RC_SWIZZLE_##y, RC_SWIZZLE_##z, RC_SWIZZLE_ZERO)) @@ -92,7 +91,7 @@ static const struct swizzle_data* lookup_native_swizzle(unsigned int swizzle) * Check whether the given instruction supports the swizzle and negate * combinations in the given source register. */ -int r300FPIsNativeSwizzle(rc_opcode opcode, struct rc_src_register reg) +static int r300_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg) { if (reg.Abs) reg.Negate = RC_MASK_NONE; @@ -134,15 +133,16 @@ int r300FPIsNativeSwizzle(rc_opcode opcode, struct rc_src_register reg) } -/** - * Generate MOV dst, src using only native swizzles. - */ -void r300FPBuildSwizzle(struct nqssadce_state *s, struct rc_dst_register dst, struct rc_src_register src) +static void r300_swizzle_split( + struct rc_src_register src, unsigned int mask, + struct rc_swizzle_split * split) { if (src.Abs) src.Negate = RC_MASK_NONE; - while(dst.WriteMask) { + split->NumPhases = 0; + + while(mask) { const struct swizzle_data *best_swizzle = 0; unsigned int best_matchcount = 0; unsigned int best_matchmask = 0; @@ -153,7 +153,7 @@ void r300FPBuildSwizzle(struct nqssadce_state *s, struct rc_dst_register dst, st unsigned int matchcount = 0; unsigned int matchmask = 0; for(comp = 0; comp < 3; ++comp) { - if (!GET_BIT(dst.WriteMask, comp)) + if (!GET_BIT(mask, comp)) continue; unsigned int swz = GET_SWZ(src.Swizzle, comp); if (swz == RC_SWIZZLE_UNUSED) @@ -172,23 +172,24 @@ void r300FPBuildSwizzle(struct nqssadce_state *s, struct rc_dst_register dst, st best_swizzle = sd; best_matchcount = matchcount; best_matchmask = matchmask; - if (matchmask == (dst.WriteMask & RC_MASK_XYZ)) + if (matchmask == (mask & RC_MASK_XYZ)) break; } } - struct rc_instruction *inst = rc_insert_new_instruction(s->Compiler, s->IP->Prev); - inst->I.Opcode = RC_OPCODE_MOV; - inst->I.DstReg = dst; - inst->I.DstReg.WriteMask &= (best_matchmask | RC_MASK_W); - inst->I.SrcReg[0] = src; - inst->I.SrcReg[0].Negate = (best_matchmask & src.Negate) ? RC_MASK_XYZW : RC_MASK_NONE; - /* Note: We rely on NqSSA/DCE to set unused swizzle components to NIL */ + if (mask & RC_MASK_W) + best_matchmask |= RC_MASK_W; - dst.WriteMask &= ~inst->I.DstReg.WriteMask; + split->Phase[split->NumPhases++] = best_matchmask; + mask &= ~best_matchmask; } } +struct rc_swizzle_caps r300_swizzle_caps = { + .IsNative = r300_swizzle_is_native, + .Split = r300_swizzle_split +}; + /** * Translate an RGB (XYZ) swizzle into the hardware code for the given diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.h b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.h index 728c2cd972..118476af13 100644 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.h +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_swizzle.h @@ -28,12 +28,9 @@ #ifndef __R300_FRAGPROG_SWIZZLE_H_ #define __R300_FRAGPROG_SWIZZLE_H_ -#include "radeon_program.h" +#include "radeon_swizzle.h" -struct nqssadce_state; - -int r300FPIsNativeSwizzle(rc_opcode opcode, struct rc_src_register reg); -void r300FPBuildSwizzle(struct nqssadce_state*, struct rc_dst_register dst, struct rc_src_register src); +extern struct rc_swizzle_caps r300_swizzle_caps; unsigned int r300FPTranslateRGBSwizzle(unsigned int src, unsigned int swizzle); unsigned int r300FPTranslateAlphaSwizzle(unsigned int src, unsigned int swizzle); diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c index 0aa40c0587..bf9bea685a 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c @@ -24,18 +24,18 @@ #include -#include "radeon_nqssadce.h" #include "radeon_program_alu.h" #include "r300_fragprog.h" #include "r300_fragprog_swizzle.h" #include "r500_fragprog.h" -static void nqssadce_init(struct nqssadce_state* s) +static void dataflow_outputs_mark_use(void * userdata, void * data, + void (*callback)(void *, unsigned int, unsigned int)) { - struct r300_fragment_program_compiler * c = s->UserData; - s->Outputs[c->OutputColor].Sourced = RC_MASK_XYZW; - s->Outputs[c->OutputDepth].Sourced = RC_MASK_W; + struct r300_fragment_program_compiler * c = userdata; + callback(data, c->OutputColor, RC_MASK_XYZW); + callback(data, c->OutputDepth, RC_MASK_W); } static void rewrite_depth_out(struct r300_fragment_program_compiler * c) @@ -92,6 +92,8 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) { &radeonTransformTrigScale, 0 } }; radeonLocalTransform(&c->Base, 4, transformations); + + c->Base.SwizzleCaps = &r500_swizzle_caps; } else { struct radeon_program_transformation transformations[] = { { &r300_transform_TEX, c }, @@ -99,33 +101,23 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) { &radeonTransformTrigSimple, 0 } }; radeonLocalTransform(&c->Base, 3, transformations); + + c->Base.SwizzleCaps = &r300_swizzle_caps; } if (c->Base.Debug) { fprintf(stderr, "Fragment Program: After native rewrite:\n"); - rc_print_program(&c->Base.Program); + rc_print_program(&c->Base.Program, 0); fflush(stderr); } - if (c->is_r500) { - struct radeon_nqssadce_descr nqssadce = { - .Init = &nqssadce_init, - .IsNativeSwizzle = &r500FPIsNativeSwizzle, - .BuildSwizzle = &r500FPBuildSwizzle - }; - radeonNqssaDce(&c->Base, &nqssadce, c); - } else { - struct radeon_nqssadce_descr nqssadce = { - .Init = &nqssadce_init, - .IsNativeSwizzle = &r300FPIsNativeSwizzle, - .BuildSwizzle = &r300FPBuildSwizzle - }; - radeonNqssaDce(&c->Base, &nqssadce, c); - } + rc_dataflow_annotate(&c->Base, &dataflow_outputs_mark_use, c); + rc_dataflow_dealias(&c->Base); + rc_dataflow_swizzles(&c->Base); if (c->Base.Debug) { - fprintf(stderr, "Compiler: after NqSSA-DCE:\n"); - rc_print_program(&c->Base.Program); + fprintf(stderr, "Compiler: after dataflow passes:\n"); + rc_print_program(&c->Base.Program, 0); fflush(stderr); } diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c index 0efd2c91e6..c64648ff3b 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c @@ -26,9 +26,9 @@ #include "../r300_reg.h" -#include "radeon_nqssadce.h" -#include "radeon_program.h" +#include "radeon_dataflow.h" #include "radeon_program_alu.h" +#include "radeon_swizzle.h" /* @@ -545,18 +545,19 @@ static void addArtificialOutputs(struct r300_vertex_program_compiler * compiler) } } -static void nqssadceInit(struct nqssadce_state* s) +static void dataflow_outputs_mark_used(void * userdata, void * data, + void (*callback)(void *, unsigned int, unsigned int)) { - struct r300_vertex_program_compiler * compiler = s->UserData; + struct r300_vertex_program_compiler * c = userdata; int i; for(i = 0; i < 32; ++i) { - if (compiler->RequiredOutputs & (1 << i)) - s->Outputs[i].Sourced = RC_MASK_XYZW; + if (c->RequiredOutputs & (1 << i)) + callback(data, i, RC_MASK_XYZW); } } -static int swizzleIsNative(rc_opcode opcode, struct rc_src_register reg) +static int swizzle_is_native(rc_opcode opcode, struct rc_src_register reg) { (void) opcode; (void) reg; @@ -565,9 +566,16 @@ static int swizzleIsNative(rc_opcode opcode, struct rc_src_register reg) } +static struct rc_swizzle_caps r300_vertprog_swizzle_caps = { + .IsNative = &swizzle_is_native, + .Split = 0 /* should never be called */ +}; + void r3xx_compile_vertex_program(struct r300_vertex_program_compiler* compiler) { + compiler->Base.SwizzleCaps = &r300_vertprog_swizzle_caps; + addArtificialOutputs(compiler); { @@ -579,7 +587,7 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler* compiler) if (compiler->Base.Debug) { fprintf(stderr, "Vertex program after native rewrite:\n"); - rc_print_program(&compiler->Base.Program); + rc_print_program(&compiler->Base.Program, 0); fflush(stderr); } @@ -596,26 +604,22 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler* compiler) if (compiler->Base.Debug) { fprintf(stderr, "Vertex program after source conflict resolve:\n"); - rc_print_program(&compiler->Base.Program); + rc_print_program(&compiler->Base.Program, 0); fflush(stderr); } - { - struct radeon_nqssadce_descr nqssadce = { - .Init = &nqssadceInit, - .IsNativeSwizzle = &swizzleIsNative, - .BuildSwizzle = NULL - }; - radeonNqssaDce(&compiler->Base, &nqssadce, compiler); + rc_dataflow_annotate(&compiler->Base, &dataflow_outputs_mark_used, compiler); + rc_dataflow_dealias(&compiler->Base); + rc_dataflow_swizzles(&compiler->Base); - /* We need this step for reusing temporary registers */ - allocate_temporary_registers(compiler); + /* This invalidates dataflow annotations and should be replaced + * by a future generic register allocation pass. */ + allocate_temporary_registers(compiler); - if (compiler->Base.Debug) { - fprintf(stderr, "Vertex program after NQSSADCE:\n"); - rc_print_program(&compiler->Base.Program); - fflush(stderr); - } + if (compiler->Base.Debug) { + fprintf(stderr, "Vertex program after dataflow:\n"); + rc_print_program(&compiler->Base.Program, 0); + fflush(stderr); } translate_vertex_program(compiler); diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c index 3e994ebd1b..971465e359 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c @@ -169,7 +169,7 @@ int r500_transform_TEX( return 1; } -int r500FPIsNativeSwizzle(rc_opcode opcode, struct rc_src_register reg) +static int r500_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg) { unsigned int relevant; int i; @@ -227,36 +227,38 @@ int r500FPIsNativeSwizzle(rc_opcode opcode, struct rc_src_register reg) } /** - * Implement a MOV with a potentially non-native swizzle. + * Split source register access. * * The only thing we *cannot* do in an ALU instruction is per-component - * negation. Therefore, we split the MOV into two instructions when necessary. + * negation. */ -void r500FPBuildSwizzle(struct nqssadce_state *s, struct rc_dst_register dst, struct rc_src_register src) +static void r500_swizzle_split(struct rc_src_register src, unsigned int usemask, + struct rc_swizzle_split * split) { unsigned int negatebase[2] = { 0, 0 }; int i; for(i = 0; i < 4; ++i) { unsigned int swz = GET_SWZ(src.Swizzle, i); - if (swz == RC_SWIZZLE_UNUSED) + if (swz == RC_SWIZZLE_UNUSED || !GET_BIT(usemask, i)) continue; negatebase[GET_BIT(src.Negate, i)] |= 1 << i; } + split->NumPhases = 0; + for(i = 0; i <= 1; ++i) { if (!negatebase[i]) continue; - struct rc_instruction *inst = rc_insert_new_instruction(s->Compiler, s->IP->Prev); - inst->I.Opcode = RC_OPCODE_MOV; - inst->I.DstReg = dst; - inst->I.DstReg.WriteMask = negatebase[i]; - inst->I.SrcReg[0] = src; - inst->I.SrcReg[0].Negate = (i == 0) ? RC_MASK_NONE : RC_MASK_XYZW; + split->Phase[split->NumPhases++] = negatebase[i]; } } +struct rc_swizzle_caps r500_swizzle_caps = { + .IsNative = r500_swizzle_is_native, + .Split = r500_swizzle_split +}; static char *toswiz(int swiz_val) { switch(swiz_val) { diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.h b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.h index 887d4abbd2..92ac75d5fd 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.h +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.h @@ -34,15 +34,13 @@ #define __R500_FRAGPROG_H_ #include "radeon_compiler.h" -#include "radeon_nqssadce.h" +#include "radeon_swizzle.h" extern void r500BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compiler); extern void r500FragmentProgramDump(struct rX00_fragment_program_code *c); -extern int r500FPIsNativeSwizzle(rc_opcode opcode, struct rc_src_register reg); - -extern void r500FPBuildSwizzle(struct nqssadce_state *s, struct rc_dst_register dst, struct rc_src_register src); +extern struct rc_swizzle_caps r500_swizzle_caps; extern int r500_transform_TEX( struct radeon_compiler * c, diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c index babdcffd3a..d0b78ec1c8 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c @@ -93,6 +93,41 @@ void rc_error(struct radeon_compiler * c, const char * fmt, ...) } } +int rc_if_fail_helper(struct radeon_compiler * c, const char * file, int line, const char * assertion) +{ + rc_error(c, "ICE at %s:%i: assertion failed: %s\n", file, line, assertion); + return 1; +} + +/** + * Recompute c->Program.InputsRead and c->Program.OutputsWritten + * based on which inputs and outputs are actually referenced + * in program instructions. + */ +void rc_calculate_inputs_outputs(struct radeon_compiler * c) +{ + struct rc_instruction *inst; + + c->Program.InputsRead = 0; + c->Program.OutputsWritten = 0; + + for(inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next) + { + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + int i; + + for (i = 0; i < opcode->NumSrcRegs; ++i) { + if (inst->I.SrcReg[i].File == RC_FILE_INPUT) + c->Program.InputsRead |= 1 << inst->I.SrcReg[i].Index; + } + + if (opcode->HasDstReg) { + if (inst->I.DstReg.File == RC_FILE_OUTPUT) + c->Program.OutputsWritten |= 1 << inst->I.DstReg.Index; + } + } +} + /** * Rewrite the program such that everything that source the given input * register will source new_input instead. diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h index 018f9bba06..87a732cd90 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.h @@ -27,6 +27,7 @@ #include "radeon_code.h" #include "radeon_program.h" +struct rc_swizzle_caps; struct radeon_compiler { struct memory_pool Pool; @@ -34,6 +35,14 @@ struct radeon_compiler { unsigned Debug:1; unsigned Error:1; char * ErrorMsg; + + /** + * Variables used internally, not be touched by callers + * of the compiler + */ + /*@{*/ + struct rc_swizzle_caps * SwizzleCaps; + /*@}*/ }; void rc_init(struct radeon_compiler * c); @@ -42,6 +51,23 @@ void rc_destroy(struct radeon_compiler * c); void rc_debug(struct radeon_compiler * c, const char * fmt, ...); void rc_error(struct radeon_compiler * c, const char * fmt, ...); +int rc_if_fail_helper(struct radeon_compiler * c, const char * file, int line, const char * assertion); + +/** + * This macro acts like an if-statement that can be used to implement + * non-aborting assertions in the compiler. + * + * It checks whether \p cond is true. If not, an internal compiler error is + * flagged and the if-clause is run. + * + * A typical use-case would be: + * + * if (rc_assert(c, condition-that-must-be-true)) + * return; + */ +#define rc_assert(c, cond) \ + (!(cond) && rc_if_fail_helper(c, __FILE__, __LINE__, #cond)) + void rc_calculate_inputs_outputs(struct radeon_compiler * c); void rc_move_input(struct radeon_compiler * c, unsigned input, struct rc_src_register new_input); diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c new file mode 100644 index 0000000000..af6777a7bd --- /dev/null +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2009 Nicolai Haehnle. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 "radeon_dataflow.h" + +#include "radeon_compiler.h" + + +static void add_ref_to_vector(struct rc_dataflow_ref * ref, struct rc_dataflow_vector * vector) +{ + ref->Vector = vector; + ref->Prev = &vector->Refs; + ref->Next = vector->Refs.Next; + ref->Prev->Next = ref; + ref->Next->Prev = ref; +} + +struct rc_dataflow_ref * rc_dataflow_create_ref(struct radeon_compiler * c, + struct rc_dataflow_vector * vector, struct rc_instruction * inst) +{ + struct rc_dataflow_ref * ref = memory_pool_malloc(&c->Pool, sizeof(struct rc_dataflow_ref)); + ref->ReadInstruction = inst; + ref->UseMask = 0; + + add_ref_to_vector(ref, vector); + + return ref; +} + +struct rc_dataflow_vector * rc_dataflow_create_vector(struct radeon_compiler * c, + rc_register_file file, unsigned int index, struct rc_instruction * inst) +{ + struct rc_dataflow_vector * vec = memory_pool_malloc(&c->Pool, sizeof(struct rc_dataflow_vector)); + + memset(vec, 0, sizeof(struct rc_dataflow_vector)); + vec->File = file; + vec->Index = index; + vec->WriteInstruction = inst; + + vec->Refs.Next = vec->Refs.Prev = &vec->Refs; + + return vec; +} + +void rc_dataflow_remove_ref(struct rc_dataflow_ref * ref) +{ + ref->Prev->Next = ref->Next; + ref->Next->Prev = ref->Prev; +} + +void rc_dataflow_remove_instruction(struct rc_instruction * inst) +{ + for(unsigned int i = 0; i < 3; ++i) { + if (inst->Dataflow.SrcReg[i]) { + rc_dataflow_remove_ref(inst->Dataflow.SrcReg[i]); + inst->Dataflow.SrcReg[i] = 0; + } + if (inst->Dataflow.SrcRegAddress[i]) { + rc_dataflow_remove_ref(inst->Dataflow.SrcRegAddress[i]); + inst->Dataflow.SrcRegAddress[i] = 0; + } + } + + if (inst->Dataflow.DstReg) { + while(inst->Dataflow.DstReg->Refs.Next != &inst->Dataflow.DstReg->Refs) { + struct rc_dataflow_ref * ref = inst->Dataflow.DstReg->Refs.Next; + rc_dataflow_remove_ref(ref); + if (inst->Dataflow.DstRegPrev) + add_ref_to_vector(ref, inst->Dataflow.DstRegPrev->Vector); + } + + inst->Dataflow.DstReg->WriteInstruction = 0; + inst->Dataflow.DstReg = 0; + } + + if (inst->Dataflow.DstRegPrev) { + rc_dataflow_remove_ref(inst->Dataflow.DstRegPrev); + inst->Dataflow.DstRegPrev = 0; + } + + inst->Dataflow.DstRegAliased = 0; +} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h new file mode 100644 index 0000000000..c9856affe8 --- /dev/null +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2009 Nicolai Haehnle. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 RADEON_DATAFLOW_H +#define RADEON_DATAFLOW_H + +#include "radeon_program_constants.h" + +struct radeon_compiler; +struct rc_instruction; +struct rc_swizzle_caps; + +struct rc_dataflow_vector; + +struct rc_dataflow_ref { + struct rc_dataflow_vector * Vector; + + /** + * Linked list of references to the above-mentioned vector. + * The linked list is \em not sorted. + */ + /*@{*/ + struct rc_dataflow_ref * Prev; + struct rc_dataflow_ref * Next; + /*@}*/ + + unsigned int UseMask:4; + struct rc_instruction * ReadInstruction; +}; + +struct rc_dataflow_vector { + rc_register_file File:3; + unsigned int Index:RC_REGISTER_INDEX_BITS; + + /** For private use in compiler passes. MUST BE RESET TO 0 by the end of each pass. + * The annotate pass uses this bit to track whether a vector is in the + * update stack. + */ + unsigned int PassBit:1; + /** Which of the components have been written with useful values */ + unsigned int ValidMask:4; + /** Which of the components are used downstream */ + unsigned int UseMask:4; + /** The instruction that produced this vector */ + struct rc_instruction * WriteInstruction; + + /** Linked list of references to this vector */ + struct rc_dataflow_ref Refs; +}; + +struct rc_instruction_dataflow { + struct rc_dataflow_ref * SrcReg[3]; + struct rc_dataflow_ref * SrcRegAddress[3]; + + /** Reference the components of the destination register + * that are carried over without being overwritten */ + struct rc_dataflow_ref * DstRegPrev; + /** Indicates whether the destination register was in use + * before this instruction */ + unsigned int DstRegAliased:1; + struct rc_dataflow_vector * DstReg; +}; + +/** + * General functions for manipulating the dataflow structures. + */ +/*@{*/ +struct rc_dataflow_ref * rc_dataflow_create_ref(struct radeon_compiler * c, + struct rc_dataflow_vector * vector, struct rc_instruction * inst); +struct rc_dataflow_vector * rc_dataflow_create_vector(struct radeon_compiler * c, + rc_register_file file, unsigned int index, struct rc_instruction * inst); +void rc_dataflow_remove_ref(struct rc_dataflow_ref * ref); + +void rc_dataflow_remove_instruction(struct rc_instruction * inst); +/*@}*/ + + +/** + * Compiler passes based on dataflow structures. + */ +/*@{*/ +typedef void (*rc_dataflow_mark_outputs_fn)(void * userdata, void * data, + void (*mark_fn)(void * data, unsigned int index, unsigned int mask)); +void rc_dataflow_annotate(struct radeon_compiler * c, rc_dataflow_mark_outputs_fn dce, void * userdata); +void rc_dataflow_dealias(struct radeon_compiler * c); +void rc_dataflow_swizzles(struct radeon_compiler * c); +/*@}*/ + +#endif /* RADEON_DATAFLOW_H */ diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_annotate.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_annotate.c new file mode 100644 index 0000000000..41d175a22f --- /dev/null +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_annotate.c @@ -0,0 +1,365 @@ +/* + * Copyright (C) 2009 Nicolai Haehnle. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 "radeon_dataflow.h" + +#include "radeon_compiler.h" + + +struct dataflow_state { + struct radeon_compiler * C; + unsigned int DCE:1; + unsigned int UpdateRunning:1; + + struct rc_dataflow_vector * Input[RC_REGISTER_MAX_INDEX]; + struct rc_dataflow_vector * Output[RC_REGISTER_MAX_INDEX]; + struct rc_dataflow_vector * Temporary[RC_REGISTER_MAX_INDEX]; + struct rc_dataflow_vector * Address; + + struct rc_dataflow_vector ** UpdateStack; + unsigned int UpdateStackSize; + unsigned int UpdateStackReserved; +}; + +static void mark_vector_use(struct dataflow_state * s, struct rc_dataflow_vector * vector, unsigned int mask); + +static struct rc_dataflow_vector * get_register_contents(struct dataflow_state * s, + rc_register_file file, unsigned int index) +{ + if (file == RC_FILE_INPUT || file == RC_FILE_OUTPUT || file == RC_FILE_TEMPORARY) { + if (index >= RC_REGISTER_MAX_INDEX) + return 0; /* cannot happen, but be defensive */ + + if (file == RC_FILE_TEMPORARY) + return s->Temporary[index]; + if (file == RC_FILE_INPUT) + return s->Input[index]; + if (file == RC_FILE_OUTPUT) + return s->Output[index]; + } + + if (file == RC_FILE_ADDRESS) + return s->Address; + + return 0; /* can happen, constant register file */ +} + +static void mark_ref_use(struct dataflow_state * s, struct rc_dataflow_ref * ref, unsigned int mask) +{ + if (!(mask & ~ref->UseMask)) + return; + + ref->UseMask |= mask; + mark_vector_use(s, ref->Vector, ref->UseMask); +} + +static void mark_source_use(struct dataflow_state * s, struct rc_instruction * inst, + unsigned int src, unsigned int srcmask) +{ + unsigned int refmask = 0; + + for(unsigned int i = 0; i < 4; ++i) { + if (GET_BIT(srcmask, i)) + refmask |= 1 << GET_SWZ(inst->I.SrcReg[src].Swizzle, i); + } + + /* get rid of spurious bits from ZERO, ONE, etc. swizzles */ + refmask &= RC_MASK_XYZW; + + if (!refmask) + return; /* can happen if the swizzle contains constant components */ + + if (inst->Dataflow.SrcReg[src]) + mark_ref_use(s, inst->Dataflow.SrcReg[src], refmask); + + if (inst->Dataflow.SrcRegAddress[src]) + mark_ref_use(s, inst->Dataflow.SrcRegAddress[src], RC_MASK_X); +} + +static void compute_sources_for_writemask( + struct rc_instruction * inst, + unsigned int writemask, + unsigned int *srcmasks) +{ + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + + srcmasks[0] = 0; + srcmasks[1] = 0; + srcmasks[2] = 0; + + if (inst->I.Opcode == RC_OPCODE_KIL) + srcmasks[0] |= RC_MASK_XYZW; + + if (!writemask) + return; + + if (opcode->IsComponentwise) { + for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) + srcmasks[src] |= writemask; + } else if (opcode->IsStandardScalar) { + for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) + srcmasks[src] |= RC_MASK_X; + } else { + switch(inst->I.Opcode) { + case RC_OPCODE_ARL: + srcmasks[0] |= RC_MASK_X; + break; + case RC_OPCODE_DP3: + srcmasks[0] |= RC_MASK_XYZ; + srcmasks[1] |= RC_MASK_XYZ; + break; + case RC_OPCODE_DP4: + srcmasks[0] |= RC_MASK_XYZW; + srcmasks[1] |= RC_MASK_XYZW; + break; + case RC_OPCODE_TEX: + case RC_OPCODE_TXB: + case RC_OPCODE_TXP: + srcmasks[0] |= RC_MASK_XYZW; + break; + case RC_OPCODE_DST: + srcmasks[0] |= 0x6; + srcmasks[1] |= 0xa; + break; + case RC_OPCODE_EXP: + case RC_OPCODE_LOG: + srcmasks[0] |= RC_MASK_XY; + break; + case RC_OPCODE_LIT: + srcmasks[0] |= 0xb; + break; + default: + break; + } + } +} + +static void mark_instruction_source_use(struct dataflow_state * s, + struct rc_instruction * inst, unsigned int writemask) +{ + unsigned int srcmasks[3]; + + compute_sources_for_writemask(inst, writemask, srcmasks); + + for(unsigned int src = 0; src < 3; ++src) + mark_source_use(s, inst, src, srcmasks[src]); +} + +static void run_update(struct dataflow_state * s) +{ + s->UpdateRunning = 1; + + while(s->UpdateStackSize) { + struct rc_dataflow_vector * vector = s->UpdateStack[--s->UpdateStackSize]; + vector->PassBit = 0; + + if (vector->WriteInstruction) { + struct rc_instruction * inst = vector->WriteInstruction; + + if (inst->Dataflow.DstRegPrev) { + unsigned int carryover = vector->UseMask & ~inst->I.DstReg.WriteMask; + + if (carryover) + mark_ref_use(s, inst->Dataflow.DstRegPrev, carryover); + } + + mark_instruction_source_use( + s, vector->WriteInstruction, + vector->UseMask & inst->I.DstReg.WriteMask); + } + } + + s->UpdateRunning = 0; +} + +static void mark_vector_use(struct dataflow_state * s, struct rc_dataflow_vector * vector, unsigned int mask) +{ + if (!(mask & ~vector->UseMask)) + return; /* no new used bits */ + + vector->UseMask |= mask; + if (vector->PassBit) + return; + + if (s->UpdateStackSize >= s->UpdateStackReserved) { + unsigned int new_reserve = 2 * s->UpdateStackReserved; + struct rc_dataflow_vector ** new_stack; + + if (!new_reserve) + new_reserve = 16; + + new_stack = memory_pool_malloc(&s->C->Pool, new_reserve * sizeof(struct rc_dataflow_vector *)); + memcpy(new_stack, s->UpdateStack, s->UpdateStackSize * sizeof(struct rc_dataflow_vector *)); + + s->UpdateStack = new_stack; + s->UpdateStackReserved = new_reserve; + } + + s->UpdateStack[s->UpdateStackSize++] = vector; + vector->PassBit = 1; + + if (!s->UpdateRunning) + run_update(s); +} + +static void annotate_instruction(struct dataflow_state * s, struct rc_instruction * inst) +{ + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + unsigned int src; + + for(src = 0; src < opcode->NumSrcRegs; ++src) { + struct rc_dataflow_vector * vector = get_register_contents(s, inst->I.SrcReg[src].File, inst->I.SrcReg[src].Index); + if (vector) { + inst->Dataflow.SrcReg[src] = rc_dataflow_create_ref(s->C, vector, inst); + } + if (inst->I.SrcReg[src].RelAddr) { + struct rc_dataflow_vector * addr = get_register_contents(s, RC_FILE_ADDRESS, 0); + if (addr) + inst->Dataflow.SrcRegAddress[src] = rc_dataflow_create_ref(s->C, addr, inst); + } + } + + mark_instruction_source_use(s, inst, 0); /* for KIL */ + + if (opcode->HasDstReg) { + struct rc_dataflow_vector * oldvec = get_register_contents(s, inst->I.DstReg.File, inst->I.DstReg.Index); + struct rc_dataflow_vector * newvec = rc_dataflow_create_vector(s->C, inst->I.DstReg.File, inst->I.DstReg.Index, inst); + + newvec->ValidMask = inst->I.DstReg.WriteMask; + + if (oldvec) { + unsigned int carryover = oldvec->ValidMask & ~inst->I.DstReg.WriteMask; + + if (oldvec->ValidMask) + inst->Dataflow.DstRegAliased = 1; + + if (carryover) { + inst->Dataflow.DstRegPrev = rc_dataflow_create_ref(s->C, oldvec, inst); + newvec->ValidMask |= carryover; + + if (!s->DCE) + mark_ref_use(s, inst->Dataflow.DstRegPrev, carryover); + } + } + + inst->Dataflow.DstReg = newvec; + + if (newvec->File == RC_FILE_TEMPORARY) + s->Temporary[newvec->Index] = newvec; + else if (newvec->File == RC_FILE_OUTPUT) + s->Output[newvec->Index] = newvec; + else + s->Address = newvec; + + if (!s->DCE) + mark_vector_use(s, newvec, inst->I.DstReg.WriteMask); + } +} + +static void init_inputs(struct dataflow_state * s) +{ + unsigned int index; + + for(index = 0; index < 32; ++index) { + if (s->C->Program.InputsRead & (1 << index)) { + s->Input[index] = rc_dataflow_create_vector(s->C, RC_FILE_INPUT, index, 0); + s->Input[index]->ValidMask = RC_MASK_XYZW; + } + } +} + +static void mark_output_use(void * data, unsigned int index, unsigned int mask) +{ + struct dataflow_state * s = data; + struct rc_dataflow_vector * vec = s->Output[index]; + + if (vec) + mark_vector_use(s, vec, mask); +} + +void rc_dataflow_annotate(struct radeon_compiler * c, rc_dataflow_mark_outputs_fn dce, void * userdata) +{ + struct dataflow_state s; + struct rc_instruction * inst; + + memset(&s, 0, sizeof(s)); + s.C = c; + s.DCE = dce ? 1 : 0; + + init_inputs(&s); + + for(inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next) { + annotate_instruction(&s, inst); + } + + if (s.DCE) { + dce(userdata, &s, &mark_output_use); + + for(inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next) { + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + + if (opcode->HasDstReg) { + unsigned int redundant_writes = inst->I.DstReg.WriteMask & ~inst->Dataflow.DstReg->UseMask; + + inst->I.DstReg.WriteMask &= ~redundant_writes; + + if (!inst->I.DstReg.WriteMask) { + struct rc_instruction * todelete = inst; + inst = inst->Prev; + rc_remove_instruction(todelete); + continue; + } + } + + unsigned int srcmasks[3]; + compute_sources_for_writemask(inst, inst->I.DstReg.WriteMask, srcmasks); + + for(unsigned int src = 0; src < 3; ++src) { + for(unsigned int chan = 0; chan < 4; ++chan) { + if (!GET_BIT(srcmasks[src], chan)) + SET_SWZ(inst->I.SrcReg[src].Swizzle, chan, RC_SWIZZLE_UNUSED); + } + + if (inst->Dataflow.SrcReg[src]) { + if (!inst->Dataflow.SrcReg[src]->UseMask) { + rc_dataflow_remove_ref(inst->Dataflow.SrcReg[src]); + inst->Dataflow.SrcReg[src] = 0; + } + } + + if (inst->Dataflow.SrcRegAddress[src]) { + if (!inst->Dataflow.SrcRegAddress[src]->UseMask) { + rc_dataflow_remove_ref(inst->Dataflow.SrcRegAddress[src]); + inst->Dataflow.SrcRegAddress[src] = 0; + } + } + } + } + + rc_calculate_inputs_outputs(c); + } +} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_dealias.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_dealias.c new file mode 100644 index 0000000000..4596636970 --- /dev/null +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_dealias.c @@ -0,0 +1,150 @@ +/* + * Copyright (C) 2009 Nicolai Haehnle. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 "radeon_dataflow.h" + +#include "radeon_compiler.h" + + +#define DEALIAS_LIST_SIZE 128 + +struct dealias_state { + struct radeon_compiler * C; + + unsigned int OldIndex:RC_REGISTER_INDEX_BITS; + unsigned int NewIndex:RC_REGISTER_INDEX_BITS; + unsigned int DealiasFail:1; + + struct rc_dataflow_vector * List[DEALIAS_LIST_SIZE]; + unsigned int Length; +}; + +static void push_dealias_vector(struct dealias_state * s, struct rc_dataflow_vector * vec) +{ + if (s->Length >= DEALIAS_LIST_SIZE) { + rc_debug(s->C, "%s: list size exceeded\n", __FUNCTION__); + s->DealiasFail = 1; + return; + } + + if (rc_assert(s->C, vec->File == RC_FILE_TEMPORARY && vec->Index == s->OldIndex)) + return; + + s->List[s->Length++] = vec; +} + +static void run_dealias(struct dealias_state * s) +{ + unsigned int i; + + for(i = 0; i < s->Length && !s->DealiasFail; ++i) { + struct rc_dataflow_vector * vec = s->List[i]; + struct rc_dataflow_ref * ref; + + for(ref = vec->Refs.Next; ref != &vec->Refs; ref = ref->Next) { + if (ref->ReadInstruction->Dataflow.DstRegPrev == ref) + push_dealias_vector(s, ref->ReadInstruction->Dataflow.DstReg); + } + } + + if (s->DealiasFail) + return; + + for(i = 0; i < s->Length; ++i) { + struct rc_dataflow_vector * vec = s->List[i]; + struct rc_dataflow_ref * ref; + + vec->Index = s->NewIndex; + vec->WriteInstruction->I.DstReg.Index = s->NewIndex; + + for(ref = vec->Refs.Next; ref != &vec->Refs; ref = ref->Next) { + struct rc_instruction * inst = ref->ReadInstruction; + unsigned int i; + + for(i = 0; i < 3; ++i) { + if (inst->Dataflow.SrcReg[i] == ref) { + if (rc_assert(s->C, inst->I.SrcReg[i].File == RC_FILE_TEMPORARY && + inst->I.SrcReg[i].Index == s->OldIndex)) + return; + + inst->I.SrcReg[i].Index = s->NewIndex; + } + } + } + } +} + +/** + * Breaks register aliasing to reduce multiple assignments to a single register. + * + * This affects sequences like: + * MUL r0, ...; + * MAD r0, r1, r2, r0; + * In this example, a new register will be used for the destination of the + * second MAD. + * + * The purpose of this dealiasing is to make the resulting code more SSA-like + * and therefore make it easier to move instructions around. + * This is of crucial importance for R300 fragment programs, where de-aliasing + * can help to reduce texture indirections, but other targets can benefit from + * it as well. + * + * \note When compiling GLSL, there may be some benefit gained from breaking + * up vectors whose components are unrelated. This is not done yet and should + * be investigated at some point (of course, a matching pass to re-merge + * components would be required). + */ +void rc_dataflow_dealias(struct radeon_compiler * c) +{ + struct dealias_state s; + + memset(&s, 0, sizeof(s)); + s.C = c; + + struct rc_instruction * inst; + for(inst = c->Program.Instructions.Prev; inst != &c->Program.Instructions; inst = inst->Prev) { + if (!inst->Dataflow.DstRegAliased || inst->Dataflow.DstReg->File != RC_FILE_TEMPORARY) + continue; + + if (inst->Dataflow.DstReg->UseMask & ~inst->I.DstReg.WriteMask) + continue; + + s.OldIndex = inst->I.DstReg.Index; + s.NewIndex = rc_find_free_temporary(c); + s.DealiasFail = 0; + s.Length = 0; + + inst->Dataflow.DstRegAliased = 0; + if (inst->Dataflow.DstRegPrev) { + rc_dataflow_remove_ref(inst->Dataflow.DstRegPrev); + inst->Dataflow.DstRegPrev = 0; + } + + push_dealias_vector(&s, inst->Dataflow.DstReg); + run_dealias(&s); + } +} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c new file mode 100644 index 0000000000..1aa91eff7c --- /dev/null +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2009 Nicolai Haehnle. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 "radeon_dataflow.h" + +#include "radeon_compiler.h" +#include "radeon_swizzle.h" + + +static void rewrite_source(struct radeon_compiler * c, + struct rc_instruction * inst, unsigned src) +{ + struct rc_swizzle_split split; + unsigned int tempreg = rc_find_free_temporary(c); + unsigned int usemask; + struct rc_dataflow_ref * oldref = inst->Dataflow.SrcReg[src]; + struct rc_dataflow_vector * vector = 0; + + usemask = 0; + for(unsigned int chan = 0; chan < 4; ++chan) { + if (GET_SWZ(inst->I.SrcReg[src].Swizzle, chan) != RC_SWIZZLE_UNUSED) + usemask |= 1 << chan; + } + + c->SwizzleCaps->Split(inst->I.SrcReg[src], usemask, &split); + + for(unsigned int phase = 0; phase < split.NumPhases; ++phase) { + struct rc_instruction * mov = rc_insert_new_instruction(c, inst->Prev); + unsigned int phase_refmask; + unsigned int masked_negate; + + mov->I.Opcode = RC_OPCODE_MOV; + mov->I.DstReg.File = RC_FILE_TEMPORARY; + mov->I.DstReg.Index = tempreg; + mov->I.DstReg.WriteMask = split.Phase[phase]; + mov->I.SrcReg[0] = inst->I.SrcReg[src]; + + phase_refmask = 0; + for(unsigned int chan = 0; chan < 4; ++chan) { + if (!GET_BIT(split.Phase[phase], chan)) + SET_SWZ(mov->I.SrcReg[0].Swizzle, chan, RC_SWIZZLE_UNUSED); + else + phase_refmask |= 1 << GET_SWZ(mov->I.SrcReg[0].Swizzle, chan); + } + + phase_refmask &= RC_MASK_XYZW; + + masked_negate = split.Phase[phase] & mov->I.SrcReg[0].Negate; + if (masked_negate == 0) + mov->I.SrcReg[0].Negate = 0; + else if (masked_negate == split.Phase[phase]) + mov->I.SrcReg[0].Negate = RC_MASK_XYZW; + + if (oldref) { + mov->Dataflow.SrcReg[0] = rc_dataflow_create_ref(c, oldref->Vector, mov); + mov->Dataflow.SrcReg[0]->UseMask = phase_refmask; + } + + mov->Dataflow.DstReg = rc_dataflow_create_vector(c, RC_FILE_TEMPORARY, tempreg, mov); + mov->Dataflow.DstReg->ValidMask = split.Phase[phase]; + + if (vector) { + mov->Dataflow.DstRegPrev = rc_dataflow_create_ref(c, vector, mov); + mov->Dataflow.DstRegPrev->UseMask = vector->ValidMask; + mov->Dataflow.DstReg->ValidMask |= vector->ValidMask; + mov->Dataflow.DstRegAliased = 1; + } + + mov->Dataflow.DstReg->UseMask = mov->Dataflow.DstReg->ValidMask; + vector = mov->Dataflow.DstReg; + } + + if (oldref) + rc_dataflow_remove_ref(oldref); + inst->Dataflow.SrcReg[src] = rc_dataflow_create_ref(c, vector, inst); + inst->Dataflow.SrcReg[src]->UseMask = usemask; + + inst->I.SrcReg[src].File = RC_FILE_TEMPORARY; + inst->I.SrcReg[src].Index = tempreg; + inst->I.SrcReg[src].Swizzle = 0; + inst->I.SrcReg[src].Negate = RC_MASK_NONE; + inst->I.SrcReg[src].Abs = 0; + for(unsigned int chan = 0; chan < 4; ++chan) { + SET_SWZ(inst->I.SrcReg[src].Swizzle, chan, + GET_BIT(usemask, chan) ? chan : RC_SWIZZLE_UNUSED); + } +} + +void rc_dataflow_swizzles(struct radeon_compiler * c) +{ + struct rc_instruction * inst; + + for(inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next) { + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + unsigned int src; + + for(src = 0; src < opcode->NumSrcRegs; ++src) { + if (!c->SwizzleCaps->IsNative(inst->I.Opcode, inst->I.SrcReg[src])) + rewrite_source(c, inst, src); + } + } +} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_nqssadce.c b/src/mesa/drivers/dri/r300/compiler/radeon_nqssadce.c deleted file mode 100644 index 3e02ebee81..0000000000 --- a/src/mesa/drivers/dri/r300/compiler/radeon_nqssadce.c +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Copyright (C) 2008 Nicolai Haehnle. - * - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 - * - * "Not-quite SSA" and Dead-Code Elimination. - */ - -#include "radeon_nqssadce.h" - -#include "radeon_compiler.h" - - -/** - * Return the @ref register_state for the given register (or 0 for untracked - * registers, i.e. constants). - */ -static struct register_state *get_reg_state(struct nqssadce_state* s, rc_register_file file, unsigned int index) -{ - if (index >= RC_REGISTER_MAX_INDEX) - return 0; - - switch(file) { - case RC_FILE_TEMPORARY: return &s->Temps[index]; - case RC_FILE_OUTPUT: return &s->Outputs[index]; - case RC_FILE_ADDRESS: return &s->Address; - default: return 0; - } -} - - -static void track_used_srcreg(struct nqssadce_state* s, - int src, unsigned int sourced) -{ - struct rc_sub_instruction * inst = &s->IP->I; - int i; - unsigned int deswz_source = 0; - - for(i = 0; i < 4; ++i) { - if (GET_BIT(sourced, i)) { - unsigned int swz = GET_SWZ(inst->SrcReg[src].Swizzle, i); - deswz_source |= 1 << swz; - } else { - inst->SrcReg[src].Swizzle &= ~(7 << (3*i)); - inst->SrcReg[src].Swizzle |= RC_SWIZZLE_UNUSED << (3*i); - } - } - - if (!s->Descr->IsNativeSwizzle(inst->Opcode, inst->SrcReg[src])) { - struct rc_dst_register dstreg = inst->DstReg; - dstreg.File = RC_FILE_TEMPORARY; - dstreg.Index = rc_find_free_temporary(s->Compiler); - dstreg.WriteMask = sourced; - - s->Descr->BuildSwizzle(s, dstreg, inst->SrcReg[src]); - - inst->SrcReg[src].File = RC_FILE_TEMPORARY; - inst->SrcReg[src].Index = dstreg.Index; - inst->SrcReg[src].Swizzle = 0; - inst->SrcReg[src].Negate = RC_MASK_NONE; - inst->SrcReg[src].Abs = 0; - for(i = 0; i < 4; ++i) { - if (GET_BIT(sourced, i)) - inst->SrcReg[src].Swizzle |= i << (3*i); - else - inst->SrcReg[src].Swizzle |= RC_SWIZZLE_UNUSED << (3*i); - } - deswz_source = sourced; - } - - struct register_state *regstate; - - if (inst->SrcReg[src].RelAddr) { - regstate = get_reg_state(s, RC_FILE_ADDRESS, 0); - if (regstate) - regstate->Sourced |= RC_MASK_X; - } else { - regstate = get_reg_state(s, inst->SrcReg[src].File, inst->SrcReg[src].Index); - if (regstate) - regstate->Sourced |= deswz_source & 0xf; - } -} - -static void unalias_srcregs(struct rc_instruction *inst, unsigned int oldindex, unsigned int newindex) -{ - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); - int i; - for(i = 0; i < opcode->NumSrcRegs; ++i) - if (inst->I.SrcReg[i].File == RC_FILE_TEMPORARY && inst->I.SrcReg[i].Index == oldindex) - inst->I.SrcReg[i].Index = newindex; -} - -static void unalias_temporary(struct nqssadce_state* s, unsigned int oldindex) -{ - unsigned int newindex = rc_find_free_temporary(s->Compiler); - struct rc_instruction * inst; - for(inst = s->Compiler->Program.Instructions.Next; inst != s->IP; inst = inst->Next) { - if (inst->I.DstReg.File == RC_FILE_TEMPORARY && inst->I.DstReg.Index == oldindex) - inst->I.DstReg.Index = newindex; - unalias_srcregs(inst, oldindex, newindex); - } - unalias_srcregs(s->IP, oldindex, newindex); -} - - -/** - * Handle one instruction. - */ -static void process_instruction(struct nqssadce_state* s) -{ - struct rc_sub_instruction *inst = &s->IP->I; - unsigned int WriteMask; - - if (inst->Opcode != RC_OPCODE_KIL) { - struct register_state *regstate = get_reg_state(s, inst->DstReg.File, inst->DstReg.Index); - if (!regstate) { - rc_error(s->Compiler, "NqssaDce: bad destination register (%i[%i])\n", - inst->DstReg.File, inst->DstReg.Index); - return; - } - - inst->DstReg.WriteMask &= regstate->Sourced; - regstate->Sourced &= ~inst->DstReg.WriteMask; - - if (inst->DstReg.WriteMask == 0) { - struct rc_instruction * inst_remove = s->IP; - s->IP = s->IP->Prev; - rc_remove_instruction(inst_remove); - return; - } - - if (inst->DstReg.File == RC_FILE_TEMPORARY && !regstate->Sourced) - unalias_temporary(s, inst->DstReg.Index); - } - - WriteMask = inst->DstReg.WriteMask; - - switch (inst->Opcode) { - case RC_OPCODE_ARL: - case RC_OPCODE_DDX: - case RC_OPCODE_DDY: - case RC_OPCODE_FRC: - case RC_OPCODE_MOV: - track_used_srcreg(s, 0, WriteMask); - break; - case RC_OPCODE_ADD: - case RC_OPCODE_MAX: - case RC_OPCODE_MIN: - case RC_OPCODE_MUL: - case RC_OPCODE_SGE: - case RC_OPCODE_SLT: - track_used_srcreg(s, 0, WriteMask); - track_used_srcreg(s, 1, WriteMask); - break; - case RC_OPCODE_CMP: - case RC_OPCODE_MAD: - track_used_srcreg(s, 0, WriteMask); - track_used_srcreg(s, 1, WriteMask); - track_used_srcreg(s, 2, WriteMask); - break; - case RC_OPCODE_COS: - case RC_OPCODE_EX2: - case RC_OPCODE_LG2: - case RC_OPCODE_RCP: - case RC_OPCODE_RSQ: - case RC_OPCODE_SIN: - track_used_srcreg(s, 0, 0x1); - break; - case RC_OPCODE_DP3: - track_used_srcreg(s, 0, 0x7); - track_used_srcreg(s, 1, 0x7); - break; - case RC_OPCODE_DP4: - track_used_srcreg(s, 0, 0xf); - track_used_srcreg(s, 1, 0xf); - break; - case RC_OPCODE_KIL: - case RC_OPCODE_TEX: - case RC_OPCODE_TXB: - case RC_OPCODE_TXP: - track_used_srcreg(s, 0, 0xf); - break; - case RC_OPCODE_DST: - track_used_srcreg(s, 0, 0x6); - track_used_srcreg(s, 1, 0xa); - break; - case RC_OPCODE_EXP: - case RC_OPCODE_LOG: - case RC_OPCODE_POW: - track_used_srcreg(s, 0, 0x3); - break; - case RC_OPCODE_LIT: - track_used_srcreg(s, 0, 0xb); - break; - default: - rc_error(s->Compiler, "NqssaDce: Unknown opcode %d\n", inst->Opcode); - return; - } - - s->IP = s->IP->Prev; -} - -void rc_calculate_inputs_outputs(struct radeon_compiler * c) -{ - struct rc_instruction *inst; - - c->Program.InputsRead = 0; - c->Program.OutputsWritten = 0; - - for(inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next) - { - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); - int i; - - for (i = 0; i < opcode->NumSrcRegs; ++i) { - if (inst->I.SrcReg[i].File == RC_FILE_INPUT) - c->Program.InputsRead |= 1 << inst->I.SrcReg[i].Index; - } - - if (opcode->HasDstReg) { - if (inst->I.DstReg.File == RC_FILE_OUTPUT) - c->Program.OutputsWritten |= 1 << inst->I.DstReg.Index; - } - } -} - -void radeonNqssaDce(struct radeon_compiler * c, struct radeon_nqssadce_descr* descr, void * data) -{ - struct nqssadce_state s; - - memset(&s, 0, sizeof(s)); - s.Compiler = c; - s.Descr = descr; - s.UserData = data; - s.Descr->Init(&s); - s.IP = c->Program.Instructions.Prev; - - while(s.IP != &c->Program.Instructions && !c->Error) - process_instruction(&s); - - rc_calculate_inputs_outputs(c); -} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_nqssadce.h b/src/mesa/drivers/dri/r300/compiler/radeon_nqssadce.h deleted file mode 100644 index a2aa1eb8ca..0000000000 --- a/src/mesa/drivers/dri/r300/compiler/radeon_nqssadce.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (C) 2008 Nicolai Haehnle. - * - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 __RADEON_PROGRAM_NQSSADCE_H_ -#define __RADEON_PROGRAM_NQSSADCE_H_ - -#include "radeon_program.h" - -struct register_state { - /** - * Bitmask indicating which components of the register are sourced - * by later instructions. - */ - unsigned int Sourced : 4; -}; - -/** - * Maintain state such as which registers are used, which registers are - * read from, etc. - */ -struct nqssadce_state { - struct radeon_compiler *Compiler; - struct radeon_nqssadce_descr *Descr; - - /** - * All instructions after this instruction pointer have been dealt with. - */ - struct rc_instruction * IP; - - /** - * Which registers are read by subsequent instructions? - */ - struct register_state Temps[RC_REGISTER_MAX_INDEX]; - struct register_state Outputs[RC_REGISTER_MAX_INDEX]; - struct register_state Address; - - void * UserData; -}; - - -/** - * This structure contains a description of the hardware in-so-far as - * it is required for the NqSSA-DCE pass. - */ -struct radeon_nqssadce_descr { - /** - * Fill in which outputs - */ - void (*Init)(struct nqssadce_state *); - - /** - * Check whether the given swizzle, absolute and negate combination - * can be implemented natively by the hardware for this opcode. - * - * \return 1 if the swizzle is native for the given opcode - */ - int (*IsNativeSwizzle)(rc_opcode opcode, struct rc_src_register reg); - - /** - * Emit (at the current IP) the instruction MOV dst, src; - * The transformation will work recursively on the emitted instruction(s). - */ - void (*BuildSwizzle)(struct nqssadce_state*, struct rc_dst_register dst, struct rc_src_register src); -}; - -void radeonNqssaDce(struct radeon_compiler * c, struct radeon_nqssadce_descr* descr, void * data); - -#endif /* __RADEON_PROGRAM_NQSSADCE_H_ */ diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c index ffe2de1a87..b7200990c2 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c @@ -40,13 +40,15 @@ struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE] = { .Opcode = RC_OPCODE_ABS, .Name = "ABS", .NumSrcRegs = 1, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_ADD, .Name = "ADD", .NumSrcRegs = 2, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_ARL, @@ -58,25 +60,29 @@ struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE] = { .Opcode = RC_OPCODE_CMP, .Name = "CMP", .NumSrcRegs = 3, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_COS, .Name = "COS", .NumSrcRegs = 1, - .HasDstReg = 1 + .HasDstReg = 1, + .IsStandardScalar = 1 }, { .Opcode = RC_OPCODE_DDX, .Name = "DDX", .NumSrcRegs = 1, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_DDY, .Name = "DDY", .NumSrcRegs = 1, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_DP3, @@ -106,7 +112,8 @@ struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE] = { .Opcode = RC_OPCODE_EX2, .Name = "EX2", .NumSrcRegs = 1, - .HasDstReg = 1 + .HasDstReg = 1, + .IsStandardScalar = 1 }, { .Opcode = RC_OPCODE_EXP, @@ -118,13 +125,15 @@ struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE] = { .Opcode = RC_OPCODE_FLR, .Name = "FLR", .NumSrcRegs = 1, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_FRC, .Name = "FRC", .NumSrcRegs = 1, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_KIL, @@ -135,7 +144,8 @@ struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE] = { .Opcode = RC_OPCODE_LG2, .Name = "LG2", .NumSrcRegs = 1, - .HasDstReg = 1 + .HasDstReg = 1, + .IsStandardScalar = 1 }, { .Opcode = RC_OPCODE_LIT, @@ -153,55 +163,64 @@ struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE] = { .Opcode = RC_OPCODE_LRP, .Name = "LRP", .NumSrcRegs = 3, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_MAD, .Name = "MAD", .NumSrcRegs = 3, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_MAX, .Name = "MAX", .NumSrcRegs = 2, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_MIN, .Name = "MIN", .NumSrcRegs = 2, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_MOV, .Name = "MOV", .NumSrcRegs = 1, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_MUL, .Name = "MUL", .NumSrcRegs = 2, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_POW, .Name = "POW", .NumSrcRegs = 2, - .HasDstReg = 1 + .HasDstReg = 1, + .IsStandardScalar = 1 }, { .Opcode = RC_OPCODE_RCP, .Name = "RCP", .NumSrcRegs = 1, - .HasDstReg = 1 + .HasDstReg = 1, + .IsStandardScalar = 1 }, { .Opcode = RC_OPCODE_RSQ, .Name = "RSQ", .NumSrcRegs = 1, - .HasDstReg = 1 + .HasDstReg = 1, + .IsStandardScalar = 1 }, { .Opcode = RC_OPCODE_SCS, @@ -213,61 +232,71 @@ struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE] = { .Opcode = RC_OPCODE_SEQ, .Name = "SEQ", .NumSrcRegs = 2, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_SFL, .Name = "SFL", .NumSrcRegs = 0, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_SGE, .Name = "SGE", .NumSrcRegs = 2, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_SGT, .Name = "SGT", .NumSrcRegs = 2, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_SIN, .Name = "SIN", .NumSrcRegs = 1, - .HasDstReg = 1 + .HasDstReg = 1, + .IsStandardScalar = 1 }, { .Opcode = RC_OPCODE_SLE, .Name = "SLE", .NumSrcRegs = 2, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_SLT, .Name = "SLT", .NumSrcRegs = 2, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_SNE, .Name = "SNE", .NumSrcRegs = 2, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_SUB, .Name = "SUB", .NumSrcRegs = 2, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_SWZ, .Name = "SWZ", .NumSrcRegs = 1, - .HasDstReg = 1 + .HasDstReg = 1, + .IsComponentwise = 1 }, { .Opcode = RC_OPCODE_XPD, diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h index 4eb9be3e55..8e30bef1e3 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h @@ -187,6 +187,14 @@ struct rc_opcode_info { unsigned int NumSrcRegs:2; unsigned int HasDstReg:1; + + /** true if this is a vector instruction that operates on components in parallel + * without any cross-component interaction */ + unsigned int IsComponentwise:1; + + /** true if this instruction sources only its operands X components + * to compute one result which is smeared across all output channels */ + unsigned int IsStandardScalar:1; }; extern struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE]; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.c b/src/mesa/drivers/dri/r300/compiler/radeon_program.c index 0e0c1f68e6..b97c48084b 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.c @@ -154,155 +154,7 @@ struct rc_instruction *rc_insert_new_instruction(struct radeon_compiler * c, str void rc_remove_instruction(struct rc_instruction * inst) { + rc_dataflow_remove_instruction(inst); inst->Prev->Next = inst->Next; inst->Next->Prev = inst->Prev; } - -static const char * textarget_to_string(rc_texture_target target) -{ - switch(target) { - case RC_TEXTURE_2D_ARRAY: return "2D_ARRAY"; - case RC_TEXTURE_1D_ARRAY: return "1D_ARRAY"; - case RC_TEXTURE_CUBE: return "CUBE"; - case RC_TEXTURE_3D: return "3D"; - case RC_TEXTURE_RECT: return "RECT"; - case RC_TEXTURE_2D: return "2D"; - case RC_TEXTURE_1D: return "1D"; - default: return "BAD_TEXTURE_TARGET"; - } -} - -static void rc_print_register(FILE * f, rc_register_file file, int index, unsigned int reladdr) -{ - if (file == RC_FILE_NONE) { - fprintf(f, "none"); - } else { - const char * filename; - switch(file) { - case RC_FILE_TEMPORARY: filename = "temp"; break; - case RC_FILE_INPUT: filename = "input"; break; - case RC_FILE_OUTPUT: filename = "output"; break; - case RC_FILE_ADDRESS: filename = "addr"; break; - case RC_FILE_CONSTANT: filename = "const"; break; - default: filename = "BAD FILE"; break; - } - fprintf(f, "%s[%i%s]", filename, index, reladdr ? " + addr[0]" : ""); - } -} - -static void rc_print_mask(FILE * f, unsigned int mask) -{ - if (mask & RC_MASK_X) fprintf(f, "x"); - if (mask & RC_MASK_Y) fprintf(f, "y"); - if (mask & RC_MASK_Z) fprintf(f, "z"); - if (mask & RC_MASK_W) fprintf(f, "w"); -} - -static void rc_print_dst_register(FILE * f, struct rc_dst_register dst) -{ - rc_print_register(f, dst.File, dst.Index, dst.RelAddr); - if (dst.WriteMask != RC_MASK_XYZW) { - fprintf(f, "."); - rc_print_mask(f, dst.WriteMask); - } -} - -static void rc_print_swizzle(FILE * f, unsigned int swizzle, unsigned int negate) -{ - unsigned int comp; - for(comp = 0; comp < 4; ++comp) { - rc_swizzle swz = GET_SWZ(swizzle, comp); - if (GET_BIT(negate, comp)) - fprintf(f, "-"); - switch(swz) { - case RC_SWIZZLE_X: fprintf(f, "x"); break; - case RC_SWIZZLE_Y: fprintf(f, "y"); break; - case RC_SWIZZLE_Z: fprintf(f, "z"); break; - case RC_SWIZZLE_W: fprintf(f, "w"); break; - case RC_SWIZZLE_ZERO: fprintf(f, "0"); break; - case RC_SWIZZLE_ONE: fprintf(f, "1"); break; - case RC_SWIZZLE_HALF: fprintf(f, "H"); break; - case RC_SWIZZLE_UNUSED: fprintf(f, "_"); break; - } - } -} - -static void rc_print_src_register(FILE * f, struct rc_src_register src) -{ - int trivial_negate = (src.Negate == RC_MASK_NONE || src.Negate == RC_MASK_XYZW); - - if (src.Negate == RC_MASK_XYZW) - fprintf(f, "-"); - if (src.Abs) - fprintf(f, "|"); - - rc_print_register(f, src.File, src.Index, src.RelAddr); - - if (src.Abs && !trivial_negate) - fprintf(f, "|"); - - if (src.Swizzle != RC_SWIZZLE_XYZW || !trivial_negate) { - fprintf(f, "."); - rc_print_swizzle(f, src.Swizzle, trivial_negate ? 0 : src.Negate); - } - - if (src.Abs && trivial_negate) - fprintf(f, "|"); -} - -static void rc_print_instruction(FILE * f, struct rc_instruction * inst) -{ - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); - unsigned int reg; - - fprintf(f, "%s", opcode->Name); - - switch(inst->I.SaturateMode) { - case RC_SATURATE_NONE: break; - case RC_SATURATE_ZERO_ONE: fprintf(f, "_SAT"); break; - case RC_SATURATE_MINUS_PLUS_ONE: fprintf(f, "_SAT2"); break; - default: fprintf(f, "_BAD_SAT"); break; - } - - if (opcode->HasDstReg) { - fprintf(f, " "); - rc_print_dst_register(f, inst->I.DstReg); - if (opcode->NumSrcRegs) - fprintf(f, ","); - } - - for(reg = 0; reg < opcode->NumSrcRegs; ++reg) { - if (reg > 0) - fprintf(f, ","); - fprintf(f, " "); - rc_print_src_register(f, inst->I.SrcReg[reg]); - } - - if (opcode->HasTexture) { - fprintf(f, ", %s%s[%u]", - textarget_to_string(inst->I.TexSrcTarget), - inst->I.TexShadow ? "SHADOW" : "", - inst->I.TexSrcUnit); - } - - fprintf(f, ";\n"); -} - -/** - * Print program to stderr, default options. - */ -void rc_print_program(const struct rc_program *prog) -{ - unsigned int linenum = 0; - struct rc_instruction *inst; - - fprintf(stderr, "# Radeon Compiler Program\n"); - - for(inst = prog->Instructions.Next; inst != &prog->Instructions; inst = inst->Next) { - fprintf(stderr, "%3d: ", linenum); - - rc_print_instruction(stderr, inst); - - linenum++; - } -} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.h b/src/mesa/drivers/dri/r300/compiler/radeon_program.h index a2ab757fec..d38c9a420c 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.h @@ -33,102 +33,11 @@ #include "radeon_opcodes.h" #include "radeon_code.h" +#include "radeon_program_constants.h" +#include "radeon_dataflow.h" struct radeon_compiler; -typedef enum { - RC_SATURATE_NONE = 0, - RC_SATURATE_ZERO_ONE, - RC_SATURATE_MINUS_PLUS_ONE -} rc_saturate_mode; - -typedef enum { - RC_TEXTURE_2D_ARRAY, - RC_TEXTURE_1D_ARRAY, - RC_TEXTURE_CUBE, - RC_TEXTURE_3D, - RC_TEXTURE_RECT, - RC_TEXTURE_2D, - RC_TEXTURE_1D -} rc_texture_target; - -typedef enum { - /** - * Used to indicate unused register descriptions and - * source register that use a constant swizzle. - */ - RC_FILE_NONE = 0, - RC_FILE_TEMPORARY, - - /** - * Input register. - * - * \note The compiler attaches no implicit semantics to input registers. - * Fragment/vertex program specific semantics must be defined explicitly - * using the appropriate compiler interfaces. - */ - RC_FILE_INPUT, - - /** - * Output register. - * - * \note The compiler attaches no implicit semantics to input registers. - * Fragment/vertex program specific semantics must be defined explicitly - * using the appropriate compiler interfaces. - */ - RC_FILE_OUTPUT, - RC_FILE_ADDRESS, - - /** - * Indicates a constant from the \ref rc_constant_list . - */ - RC_FILE_CONSTANT -} rc_register_file; - -#define RC_REGISTER_INDEX_BITS 10 -#define RC_REGISTER_MAX_INDEX (1 << RC_REGISTER_INDEX_BITS) - -typedef enum { - RC_SWIZZLE_X = 0, - RC_SWIZZLE_Y, - RC_SWIZZLE_Z, - RC_SWIZZLE_W, - RC_SWIZZLE_ZERO, - RC_SWIZZLE_ONE, - RC_SWIZZLE_HALF, - RC_SWIZZLE_UNUSED -} rc_swizzle; - -#define RC_MAKE_SWIZZLE(a,b,c,d) (((a)<<0) | ((b)<<3) | ((c)<<6) | ((d)<<9)) -#define RC_MAKE_SWIZZLE_SMEAR(a) RC_MAKE_SWIZZLE((a),(a),(a),(a)) -#define GET_SWZ(swz, idx) (((swz) >> ((idx)*3)) & 0x7) -#define GET_BIT(msk, idx) (((msk) >> (idx)) & 0x1) - -#define RC_SWIZZLE_XYZW RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_W) -#define RC_SWIZZLE_XXXX RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_X) -#define RC_SWIZZLE_YYYY RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_Y) -#define RC_SWIZZLE_ZZZZ RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_Z) -#define RC_SWIZZLE_WWWW RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_W) -#define RC_SWIZZLE_0000 RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_ZERO) -#define RC_SWIZZLE_1111 RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_ONE) - -/** - * \name Bitmasks for components of vectors. - * - * Used for write masks, negation masks, etc. - */ -/*@{*/ -#define RC_MASK_NONE 0 -#define RC_MASK_X 1 -#define RC_MASK_Y 2 -#define RC_MASK_Z 4 -#define RC_MASK_W 8 -#define RC_MASK_XY (RC_MASK_X|RC_MASK_Y) -#define RC_MASK_XYZ (RC_MASK_X|RC_MASK_Y|RC_MASK_Z) -#define RC_MASK_XYW (RC_MASK_X|RC_MASK_Y|RC_MASK_W) -#define RC_MASK_XYZW (RC_MASK_X|RC_MASK_Y|RC_MASK_Z|RC_MASK_W) -/*@}*/ - struct rc_src_register { rc_register_file File:3; @@ -198,6 +107,15 @@ struct rc_instruction { struct rc_instruction * Next; struct rc_sub_instruction I; + + /** + * Dataflow annotations. + * + * These are not supplied by the caller of the compiler, + * but filled in during compilation stages that make use of + * dataflow analysis. + */ + struct rc_instruction_dataflow Dataflow; }; struct rc_program { @@ -292,6 +210,10 @@ struct rc_instruction *rc_alloc_instruction(struct radeon_compiler * c); struct rc_instruction *rc_insert_new_instruction(struct radeon_compiler * c, struct rc_instruction * after); void rc_remove_instruction(struct rc_instruction * inst); -void rc_print_program(const struct rc_program *prog); +enum { + RC_PRINT_DATAFLOW = 0x1 +}; + +void rc_print_program(const struct rc_program *prog, unsigned int flags); #endif diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_constants.h b/src/mesa/drivers/dri/r300/compiler/radeon_program_constants.h new file mode 100644 index 0000000000..69994f9880 --- /dev/null +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_constants.h @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2009 Nicolai Haehnle. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 RADEON_PROGRAM_CONSTANTS_H +#define RADEON_PROGRAM_CONSTANTS_H + +typedef enum { + RC_SATURATE_NONE = 0, + RC_SATURATE_ZERO_ONE, + RC_SATURATE_MINUS_PLUS_ONE +} rc_saturate_mode; + +typedef enum { + RC_TEXTURE_2D_ARRAY, + RC_TEXTURE_1D_ARRAY, + RC_TEXTURE_CUBE, + RC_TEXTURE_3D, + RC_TEXTURE_RECT, + RC_TEXTURE_2D, + RC_TEXTURE_1D +} rc_texture_target; + +typedef enum { + /** + * Used to indicate unused register descriptions and + * source register that use a constant swizzle. + */ + RC_FILE_NONE = 0, + RC_FILE_TEMPORARY, + + /** + * Input register. + * + * \note The compiler attaches no implicit semantics to input registers. + * Fragment/vertex program specific semantics must be defined explicitly + * using the appropriate compiler interfaces. + */ + RC_FILE_INPUT, + + /** + * Output register. + * + * \note The compiler attaches no implicit semantics to input registers. + * Fragment/vertex program specific semantics must be defined explicitly + * using the appropriate compiler interfaces. + */ + RC_FILE_OUTPUT, + RC_FILE_ADDRESS, + + /** + * Indicates a constant from the \ref rc_constant_list . + */ + RC_FILE_CONSTANT +} rc_register_file; + +#define RC_REGISTER_INDEX_BITS 10 +#define RC_REGISTER_MAX_INDEX (1 << RC_REGISTER_INDEX_BITS) + +typedef enum { + RC_SWIZZLE_X = 0, + RC_SWIZZLE_Y, + RC_SWIZZLE_Z, + RC_SWIZZLE_W, + RC_SWIZZLE_ZERO, + RC_SWIZZLE_ONE, + RC_SWIZZLE_HALF, + RC_SWIZZLE_UNUSED +} rc_swizzle; + +#define RC_MAKE_SWIZZLE(a,b,c,d) (((a)<<0) | ((b)<<3) | ((c)<<6) | ((d)<<9)) +#define RC_MAKE_SWIZZLE_SMEAR(a) RC_MAKE_SWIZZLE((a),(a),(a),(a)) +#define GET_SWZ(swz, idx) (((swz) >> ((idx)*3)) & 0x7) +#define GET_BIT(msk, idx) (((msk) >> (idx)) & 0x1) +#define SET_SWZ(swz, idx, newv) \ + do { \ + (swz) = ((swz) & ~(7 << ((idx)*3))) | ((newv) << ((idx)*3)); \ + } while(0) + +#define RC_SWIZZLE_XYZW RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_W) +#define RC_SWIZZLE_XXXX RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_X) +#define RC_SWIZZLE_YYYY RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_Y) +#define RC_SWIZZLE_ZZZZ RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_Z) +#define RC_SWIZZLE_WWWW RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_W) +#define RC_SWIZZLE_0000 RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_ZERO) +#define RC_SWIZZLE_1111 RC_MAKE_SWIZZLE_SMEAR(RC_SWIZZLE_ONE) + +/** + * \name Bitmasks for components of vectors. + * + * Used for write masks, negation masks, etc. + */ +/*@{*/ +#define RC_MASK_NONE 0 +#define RC_MASK_X 1 +#define RC_MASK_Y 2 +#define RC_MASK_Z 4 +#define RC_MASK_W 8 +#define RC_MASK_XY (RC_MASK_X|RC_MASK_Y) +#define RC_MASK_XYZ (RC_MASK_X|RC_MASK_Y|RC_MASK_Z) +#define RC_MASK_XYW (RC_MASK_X|RC_MASK_Y|RC_MASK_W) +#define RC_MASK_XYZW (RC_MASK_X|RC_MASK_Y|RC_MASK_Z|RC_MASK_W) +/*@}*/ + +#endif /* RADEON_PROGRAM_CONSTANTS_H */ diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c new file mode 100644 index 0000000000..38060ea3ad --- /dev/null +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c @@ -0,0 +1,214 @@ +/* + * Copyright 2009 Nicolai Hähnle + * + * 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 "radeon_program.h" + +#include + +static void print_comment(FILE * f) +{ + fprintf(f, " # "); +} + +static const char * textarget_to_string(rc_texture_target target) +{ + switch(target) { + case RC_TEXTURE_2D_ARRAY: return "2D_ARRAY"; + case RC_TEXTURE_1D_ARRAY: return "1D_ARRAY"; + case RC_TEXTURE_CUBE: return "CUBE"; + case RC_TEXTURE_3D: return "3D"; + case RC_TEXTURE_RECT: return "RECT"; + case RC_TEXTURE_2D: return "2D"; + case RC_TEXTURE_1D: return "1D"; + default: return "BAD_TEXTURE_TARGET"; + } +} + +static void rc_print_register(FILE * f, rc_register_file file, int index, unsigned int reladdr) +{ + if (file == RC_FILE_NONE) { + fprintf(f, "none"); + } else { + const char * filename; + switch(file) { + case RC_FILE_TEMPORARY: filename = "temp"; break; + case RC_FILE_INPUT: filename = "input"; break; + case RC_FILE_OUTPUT: filename = "output"; break; + case RC_FILE_ADDRESS: filename = "addr"; break; + case RC_FILE_CONSTANT: filename = "const"; break; + default: filename = "BAD FILE"; break; + } + fprintf(f, "%s[%i%s]", filename, index, reladdr ? " + addr[0]" : ""); + } +} + +static void rc_print_mask(FILE * f, unsigned int mask) +{ + if (mask & RC_MASK_X) fprintf(f, "x"); + if (mask & RC_MASK_Y) fprintf(f, "y"); + if (mask & RC_MASK_Z) fprintf(f, "z"); + if (mask & RC_MASK_W) fprintf(f, "w"); +} + +static void rc_print_dst_register(FILE * f, struct rc_dst_register dst) +{ + rc_print_register(f, dst.File, dst.Index, dst.RelAddr); + if (dst.WriteMask != RC_MASK_XYZW) { + fprintf(f, "."); + rc_print_mask(f, dst.WriteMask); + } +} + +static void rc_print_swizzle(FILE * f, unsigned int swizzle, unsigned int negate) +{ + unsigned int comp; + for(comp = 0; comp < 4; ++comp) { + rc_swizzle swz = GET_SWZ(swizzle, comp); + if (GET_BIT(negate, comp)) + fprintf(f, "-"); + switch(swz) { + case RC_SWIZZLE_X: fprintf(f, "x"); break; + case RC_SWIZZLE_Y: fprintf(f, "y"); break; + case RC_SWIZZLE_Z: fprintf(f, "z"); break; + case RC_SWIZZLE_W: fprintf(f, "w"); break; + case RC_SWIZZLE_ZERO: fprintf(f, "0"); break; + case RC_SWIZZLE_ONE: fprintf(f, "1"); break; + case RC_SWIZZLE_HALF: fprintf(f, "H"); break; + case RC_SWIZZLE_UNUSED: fprintf(f, "_"); break; + } + } +} + +static void rc_print_src_register(FILE * f, struct rc_src_register src) +{ + int trivial_negate = (src.Negate == RC_MASK_NONE || src.Negate == RC_MASK_XYZW); + + if (src.Negate == RC_MASK_XYZW) + fprintf(f, "-"); + if (src.Abs) + fprintf(f, "|"); + + rc_print_register(f, src.File, src.Index, src.RelAddr); + + if (src.Abs && !trivial_negate) + fprintf(f, "|"); + + if (src.Swizzle != RC_SWIZZLE_XYZW || !trivial_negate) { + fprintf(f, "."); + rc_print_swizzle(f, src.Swizzle, trivial_negate ? 0 : src.Negate); + } + + if (src.Abs && trivial_negate) + fprintf(f, "|"); +} + +static void rc_print_ref(FILE * f, struct rc_dataflow_ref * ref) +{ + fprintf(f, "ref(%p", ref->Vector); + + if (ref->UseMask != RC_MASK_XYZW) { + fprintf(f, "."); + rc_print_mask(f, ref->UseMask); + } + + fprintf(f, ")"); +} + +static void rc_print_instruction(FILE * f, unsigned int flags, struct rc_instruction * inst) +{ + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + unsigned int reg; + + fprintf(f, "%s", opcode->Name); + + switch(inst->I.SaturateMode) { + case RC_SATURATE_NONE: break; + case RC_SATURATE_ZERO_ONE: fprintf(f, "_SAT"); break; + case RC_SATURATE_MINUS_PLUS_ONE: fprintf(f, "_SAT2"); break; + default: fprintf(f, "_BAD_SAT"); break; + } + + if (opcode->HasDstReg) { + fprintf(f, " "); + rc_print_dst_register(f, inst->I.DstReg); + if (opcode->NumSrcRegs) + fprintf(f, ","); + } + + for(reg = 0; reg < opcode->NumSrcRegs; ++reg) { + if (reg > 0) + fprintf(f, ","); + fprintf(f, " "); + rc_print_src_register(f, inst->I.SrcReg[reg]); + } + + if (opcode->HasTexture) { + fprintf(f, ", %s%s[%u]", + textarget_to_string(inst->I.TexSrcTarget), + inst->I.TexShadow ? "SHADOW" : "", + inst->I.TexSrcUnit); + } + + fprintf(f, ";\n"); + + if (flags & RC_PRINT_DATAFLOW) { + print_comment(f); + + fprintf(f, "Dst = %p", inst->Dataflow.DstReg); + if (inst->Dataflow.DstRegAliased) + fprintf(f, " aliased"); + if (inst->Dataflow.DstRegPrev) { + fprintf(f, " from "); + rc_print_ref(f, inst->Dataflow.DstRegPrev); + } + + for(reg = 0; reg < opcode->NumSrcRegs; ++reg) { + fprintf(f, ", "); + if (inst->Dataflow.SrcReg[reg]) + rc_print_ref(f, inst->Dataflow.SrcReg[reg]); + else + fprintf(f, ""); + } + + fprintf(f, "\n"); + } +} + +/** + * Print program to stderr, default options. + */ +void rc_print_program(const struct rc_program *prog, unsigned int flags) +{ + unsigned int linenum = 0; + struct rc_instruction *inst; + + fprintf(stderr, "# Radeon Compiler Program%s\n", + flags & RC_PRINT_DATAFLOW ? " (with dataflow annotations)" : ""); + + for(inst = prog->Instructions.Next; inst != &prog->Instructions; inst = inst->Next) { + fprintf(stderr, "%3d: ", linenum); + + rc_print_instruction(stderr, flags, inst); + + linenum++; + } +} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_swizzle.h b/src/mesa/drivers/dri/r300/compiler/radeon_swizzle.h new file mode 100644 index 0000000000..c81d5f7a5e --- /dev/null +++ b/src/mesa/drivers/dri/r300/compiler/radeon_swizzle.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2009 Nicolai Haehnle. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 RADEON_SWIZZLE_H +#define RADEON_SWIZZLE_H + +#include "radeon_program.h" + +struct rc_swizzle_split { + unsigned char NumPhases; + unsigned char Phase[4]; +}; + +/** + * Describe the swizzling capability of target hardware. + */ +struct rc_swizzle_caps { + /** + * Check whether the given swizzle, absolute and negate combination + * can be implemented natively by the hardware for this opcode. + * + * \return 1 if the swizzle is native for the given opcode + */ + int (*IsNative)(rc_opcode opcode, struct rc_src_register reg); + + /** + * Determine how to split access to the masked channels of the + * given source register to obtain ALU-native swizzles. + */ + void (*Split)(struct rc_src_register reg, unsigned int mask, struct rc_swizzle_split * split); +}; + +#endif /* RADEON_SWIZZLE_H */ diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index be21268ba5..b7d5429dc5 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -41,7 +41,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tnl/tnl.h" #include "compiler/radeon_compiler.h" -#include "compiler/radeon_nqssadce.h" #include "radeon_mesa_to_rc.h" #include "r300_context.h" #include "r300_state.h" -- cgit v1.2.3 From 0e7953366f2a8ab1b0e885d94f6635c7640b3cc7 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 10 Sep 2009 14:35:33 -0700 Subject: ARB prog parser: Differentiate between used and unused names in the lexer The lexer will return IDENTIFIER only when the name does not have an associated symbol. Otherwise USED_IDENTIFIER is returned. --- src/mesa/shader/lex.yy.c | 366 +++++----- src/mesa/shader/program_lexer.l | 20 +- src/mesa/shader/program_parse.tab.c | 1259 ++++++++++++++++++----------------- src/mesa/shader/program_parse.tab.h | 17 +- src/mesa/shader/program_parse.y | 23 +- 5 files changed, 851 insertions(+), 834 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/lex.yy.c b/src/mesa/shader/lex.yy.c index d71a13c3bd..959eb854d6 100644 --- a/src/mesa/shader/lex.yy.c +++ b/src/mesa/shader/lex.yy.c @@ -1052,8 +1052,7 @@ static yyconst flex_int16_t yy_chk[1352] = if (condition) { \ return token; \ } else { \ - yylval->string = strdup(yytext); \ - return IDENTIFIER; \ + return handle_ident(yyextra, yytext, yylval); \ } \ } while (0) @@ -1077,8 +1076,7 @@ static yyconst flex_int16_t yy_chk[1352] = yylval->temp_inst.Opcode = OPCODE_ ## opcode; \ return token; \ } else { \ - yylval->string = strdup(yytext); \ - return IDENTIFIER; \ + return handle_ident(yyextra, yytext, yylval); \ } \ } while (0) @@ -1127,6 +1125,15 @@ swiz_from_char(char c) return 0; } +static int +handle_ident(struct asm_parser_state *state, const char *text, YYSTYPE *lval) +{ + lval->string = strdup(text); + + return (_mesa_symbol_table_find_symbol(state->st, 0, text) == NULL) + ? IDENTIFIER : USED_IDENTIFIER; +} + #define YY_USER_ACTION \ do { \ yylloc->first_column = yylloc->last_column; \ @@ -1140,7 +1147,7 @@ swiz_from_char(char c) } while(0); #define YY_EXTRA_TYPE struct asm_parser_state * -#line 1144 "lex.yy.c" +#line 1151 "lex.yy.c" #define INITIAL 0 @@ -1386,10 +1393,10 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 143 "program_lexer.l" +#line 150 "program_lexer.l" -#line 1393 "lex.yy.c" +#line 1400 "lex.yy.c" yylval = yylval_param; @@ -1478,17 +1485,17 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 145 "program_lexer.l" +#line 152 "program_lexer.l" { return ARBvp_10; } YY_BREAK case 2: YY_RULE_SETUP -#line 146 "program_lexer.l" +#line 153 "program_lexer.l" { return ARBfp_10; } YY_BREAK case 3: YY_RULE_SETUP -#line 147 "program_lexer.l" +#line 154 "program_lexer.l" { yylval->integer = at_address; return_token_or_IDENTIFIER(require_ARB_vp, ADDRESS); @@ -1496,685 +1503,682 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 151 "program_lexer.l" +#line 158 "program_lexer.l" { return ALIAS; } YY_BREAK case 5: YY_RULE_SETUP -#line 152 "program_lexer.l" +#line 159 "program_lexer.l" { return ATTRIB; } YY_BREAK case 6: YY_RULE_SETUP -#line 153 "program_lexer.l" +#line 160 "program_lexer.l" { return END; } YY_BREAK case 7: YY_RULE_SETUP -#line 154 "program_lexer.l" +#line 161 "program_lexer.l" { return OPTION; } YY_BREAK case 8: YY_RULE_SETUP -#line 155 "program_lexer.l" +#line 162 "program_lexer.l" { return OUTPUT; } YY_BREAK case 9: YY_RULE_SETUP -#line 156 "program_lexer.l" +#line 163 "program_lexer.l" { return PARAM; } YY_BREAK case 10: YY_RULE_SETUP -#line 157 "program_lexer.l" +#line 164 "program_lexer.l" { yylval->integer = at_temp; return TEMP; } YY_BREAK case 11: YY_RULE_SETUP -#line 159 "program_lexer.l" +#line 166 "program_lexer.l" { return_opcode( 1, VECTOR_OP, ABS, 3); } YY_BREAK case 12: YY_RULE_SETUP -#line 160 "program_lexer.l" +#line 167 "program_lexer.l" { return_opcode( 1, BIN_OP, ADD, 3); } YY_BREAK case 13: YY_RULE_SETUP -#line 161 "program_lexer.l" +#line 168 "program_lexer.l" { return_opcode(require_ARB_vp, ARL, ARL, 3); } YY_BREAK case 14: YY_RULE_SETUP -#line 163 "program_lexer.l" +#line 170 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, CMP, 3); } YY_BREAK case 15: YY_RULE_SETUP -#line 164 "program_lexer.l" +#line 171 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, COS, 3); } YY_BREAK case 16: YY_RULE_SETUP -#line 166 "program_lexer.l" +#line 173 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, DDX, 3); } YY_BREAK case 17: YY_RULE_SETUP -#line 167 "program_lexer.l" +#line 174 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, DDY, 3); } YY_BREAK case 18: YY_RULE_SETUP -#line 168 "program_lexer.l" +#line 175 "program_lexer.l" { return_opcode( 1, BIN_OP, DP3, 3); } YY_BREAK case 19: YY_RULE_SETUP -#line 169 "program_lexer.l" +#line 176 "program_lexer.l" { return_opcode( 1, BIN_OP, DP4, 3); } YY_BREAK case 20: YY_RULE_SETUP -#line 170 "program_lexer.l" +#line 177 "program_lexer.l" { return_opcode( 1, BIN_OP, DPH, 3); } YY_BREAK case 21: YY_RULE_SETUP -#line 171 "program_lexer.l" +#line 178 "program_lexer.l" { return_opcode( 1, BIN_OP, DST, 3); } YY_BREAK case 22: YY_RULE_SETUP -#line 173 "program_lexer.l" +#line 180 "program_lexer.l" { return_opcode( 1, SCALAR_OP, EX2, 3); } YY_BREAK case 23: YY_RULE_SETUP -#line 174 "program_lexer.l" +#line 181 "program_lexer.l" { return_opcode(require_ARB_vp, SCALAR_OP, EXP, 3); } YY_BREAK case 24: YY_RULE_SETUP -#line 176 "program_lexer.l" +#line 183 "program_lexer.l" { return_opcode( 1, VECTOR_OP, FLR, 3); } YY_BREAK case 25: YY_RULE_SETUP -#line 177 "program_lexer.l" +#line 184 "program_lexer.l" { return_opcode( 1, VECTOR_OP, FRC, 3); } YY_BREAK case 26: YY_RULE_SETUP -#line 179 "program_lexer.l" +#line 186 "program_lexer.l" { return_opcode(require_ARB_fp, KIL, KIL, 3); } YY_BREAK case 27: YY_RULE_SETUP -#line 181 "program_lexer.l" +#line 188 "program_lexer.l" { return_opcode( 1, VECTOR_OP, LIT, 3); } YY_BREAK case 28: YY_RULE_SETUP -#line 182 "program_lexer.l" +#line 189 "program_lexer.l" { return_opcode( 1, SCALAR_OP, LG2, 3); } YY_BREAK case 29: YY_RULE_SETUP -#line 183 "program_lexer.l" +#line 190 "program_lexer.l" { return_opcode(require_ARB_vp, SCALAR_OP, LOG, 3); } YY_BREAK case 30: YY_RULE_SETUP -#line 184 "program_lexer.l" +#line 191 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, LRP, 3); } YY_BREAK case 31: YY_RULE_SETUP -#line 186 "program_lexer.l" +#line 193 "program_lexer.l" { return_opcode( 1, TRI_OP, MAD, 3); } YY_BREAK case 32: YY_RULE_SETUP -#line 187 "program_lexer.l" +#line 194 "program_lexer.l" { return_opcode( 1, BIN_OP, MAX, 3); } YY_BREAK case 33: YY_RULE_SETUP -#line 188 "program_lexer.l" +#line 195 "program_lexer.l" { return_opcode( 1, BIN_OP, MIN, 3); } YY_BREAK case 34: YY_RULE_SETUP -#line 189 "program_lexer.l" +#line 196 "program_lexer.l" { return_opcode( 1, VECTOR_OP, MOV, 3); } YY_BREAK case 35: YY_RULE_SETUP -#line 190 "program_lexer.l" +#line 197 "program_lexer.l" { return_opcode( 1, BIN_OP, MUL, 3); } YY_BREAK case 36: YY_RULE_SETUP -#line 192 "program_lexer.l" +#line 199 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK2H, 4); } YY_BREAK case 37: YY_RULE_SETUP -#line 193 "program_lexer.l" +#line 200 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK2US, 5); } YY_BREAK case 38: YY_RULE_SETUP -#line 194 "program_lexer.l" +#line 201 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK4B, 4); } YY_BREAK case 39: YY_RULE_SETUP -#line 195 "program_lexer.l" +#line 202 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK4UB, 5); } YY_BREAK case 40: YY_RULE_SETUP -#line 196 "program_lexer.l" +#line 203 "program_lexer.l" { return_opcode( 1, BINSC_OP, POW, 3); } YY_BREAK case 41: YY_RULE_SETUP -#line 198 "program_lexer.l" +#line 205 "program_lexer.l" { return_opcode( 1, SCALAR_OP, RCP, 3); } YY_BREAK case 42: YY_RULE_SETUP -#line 199 "program_lexer.l" +#line 206 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, RFL, 3); } YY_BREAK case 43: YY_RULE_SETUP -#line 200 "program_lexer.l" +#line 207 "program_lexer.l" { return_opcode( 1, SCALAR_OP, RSQ, 3); } YY_BREAK case 44: YY_RULE_SETUP -#line 202 "program_lexer.l" +#line 209 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SCS, 3); } YY_BREAK case 45: YY_RULE_SETUP -#line 203 "program_lexer.l" +#line 210 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SEQ, 3); } YY_BREAK case 46: YY_RULE_SETUP -#line 204 "program_lexer.l" +#line 211 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SFL, 3); } YY_BREAK case 47: YY_RULE_SETUP -#line 205 "program_lexer.l" +#line 212 "program_lexer.l" { return_opcode( 1, BIN_OP, SGE, 3); } YY_BREAK case 48: YY_RULE_SETUP -#line 206 "program_lexer.l" +#line 213 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SGT, 3); } YY_BREAK case 49: YY_RULE_SETUP -#line 207 "program_lexer.l" +#line 214 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SIN, 3); } YY_BREAK case 50: YY_RULE_SETUP -#line 208 "program_lexer.l" +#line 215 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SLE, 3); } YY_BREAK case 51: YY_RULE_SETUP -#line 209 "program_lexer.l" +#line 216 "program_lexer.l" { return_opcode( 1, BIN_OP, SLT, 3); } YY_BREAK case 52: YY_RULE_SETUP -#line 210 "program_lexer.l" +#line 217 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SNE, 3); } YY_BREAK case 53: YY_RULE_SETUP -#line 211 "program_lexer.l" +#line 218 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, STR, 3); } YY_BREAK case 54: YY_RULE_SETUP -#line 212 "program_lexer.l" +#line 219 "program_lexer.l" { return_opcode( 1, BIN_OP, SUB, 3); } YY_BREAK case 55: YY_RULE_SETUP -#line 213 "program_lexer.l" +#line 220 "program_lexer.l" { return_opcode( 1, SWZ, SWZ, 3); } YY_BREAK case 56: YY_RULE_SETUP -#line 215 "program_lexer.l" +#line 222 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TEX, 3); } YY_BREAK case 57: YY_RULE_SETUP -#line 216 "program_lexer.l" +#line 223 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, 3); } YY_BREAK case 58: YY_RULE_SETUP -#line 217 "program_lexer.l" +#line 224 "program_lexer.l" { return_opcode(require_NV_fp, TXD_OP, TXD, 3); } YY_BREAK case 59: YY_RULE_SETUP -#line 218 "program_lexer.l" +#line 225 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, 3); } YY_BREAK case 60: YY_RULE_SETUP -#line 220 "program_lexer.l" +#line 227 "program_lexer.l" { return_opcode(require_NV_fp, SCALAR_OP, UP2H, 4); } YY_BREAK case 61: YY_RULE_SETUP -#line 221 "program_lexer.l" +#line 228 "program_lexer.l" { return_opcode(require_NV_fp, SCALAR_OP, UP2US, 5); } YY_BREAK case 62: YY_RULE_SETUP -#line 223 "program_lexer.l" +#line 230 "program_lexer.l" { return_opcode(require_NV_fp, TRI_OP, X2D, 3); } YY_BREAK case 63: YY_RULE_SETUP -#line 224 "program_lexer.l" +#line 231 "program_lexer.l" { return_opcode( 1, BIN_OP, XPD, 3); } YY_BREAK case 64: YY_RULE_SETUP -#line 226 "program_lexer.l" +#line 233 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); } YY_BREAK case 65: YY_RULE_SETUP -#line 227 "program_lexer.l" +#line 234 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); } YY_BREAK case 66: YY_RULE_SETUP -#line 228 "program_lexer.l" +#line 235 "program_lexer.l" { return PROGRAM; } YY_BREAK case 67: YY_RULE_SETUP -#line 229 "program_lexer.l" +#line 236 "program_lexer.l" { return STATE; } YY_BREAK case 68: YY_RULE_SETUP -#line 230 "program_lexer.l" +#line 237 "program_lexer.l" { return RESULT; } YY_BREAK case 69: YY_RULE_SETUP -#line 232 "program_lexer.l" +#line 239 "program_lexer.l" { return AMBIENT; } YY_BREAK case 70: YY_RULE_SETUP -#line 233 "program_lexer.l" +#line 240 "program_lexer.l" { return ATTENUATION; } YY_BREAK case 71: YY_RULE_SETUP -#line 234 "program_lexer.l" +#line 241 "program_lexer.l" { return BACK; } YY_BREAK case 72: YY_RULE_SETUP -#line 235 "program_lexer.l" +#line 242 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, CLIP); } YY_BREAK case 73: YY_RULE_SETUP -#line 236 "program_lexer.l" +#line 243 "program_lexer.l" { return COLOR; } YY_BREAK case 74: YY_RULE_SETUP -#line 237 "program_lexer.l" +#line 244 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, DEPTH); } YY_BREAK case 75: YY_RULE_SETUP -#line 238 "program_lexer.l" +#line 245 "program_lexer.l" { return DIFFUSE; } YY_BREAK case 76: YY_RULE_SETUP -#line 239 "program_lexer.l" +#line 246 "program_lexer.l" { return DIRECTION; } YY_BREAK case 77: YY_RULE_SETUP -#line 240 "program_lexer.l" +#line 247 "program_lexer.l" { return EMISSION; } YY_BREAK case 78: YY_RULE_SETUP -#line 241 "program_lexer.l" +#line 248 "program_lexer.l" { return ENV; } YY_BREAK case 79: YY_RULE_SETUP -#line 242 "program_lexer.l" +#line 249 "program_lexer.l" { return EYE; } YY_BREAK case 80: YY_RULE_SETUP -#line 243 "program_lexer.l" +#line 250 "program_lexer.l" { return FOGCOORD; } YY_BREAK case 81: YY_RULE_SETUP -#line 244 "program_lexer.l" +#line 251 "program_lexer.l" { return FOG; } YY_BREAK case 82: YY_RULE_SETUP -#line 245 "program_lexer.l" +#line 252 "program_lexer.l" { return FRONT; } YY_BREAK case 83: YY_RULE_SETUP -#line 246 "program_lexer.l" +#line 253 "program_lexer.l" { return HALF; } YY_BREAK case 84: YY_RULE_SETUP -#line 247 "program_lexer.l" +#line 254 "program_lexer.l" { return INVERSE; } YY_BREAK case 85: YY_RULE_SETUP -#line 248 "program_lexer.l" +#line 255 "program_lexer.l" { return INVTRANS; } YY_BREAK case 86: YY_RULE_SETUP -#line 249 "program_lexer.l" +#line 256 "program_lexer.l" { return LIGHT; } YY_BREAK case 87: YY_RULE_SETUP -#line 250 "program_lexer.l" +#line 257 "program_lexer.l" { return LIGHTMODEL; } YY_BREAK case 88: YY_RULE_SETUP -#line 251 "program_lexer.l" +#line 258 "program_lexer.l" { return LIGHTPROD; } YY_BREAK case 89: YY_RULE_SETUP -#line 252 "program_lexer.l" +#line 259 "program_lexer.l" { return LOCAL; } YY_BREAK case 90: YY_RULE_SETUP -#line 253 "program_lexer.l" +#line 260 "program_lexer.l" { return MATERIAL; } YY_BREAK case 91: YY_RULE_SETUP -#line 254 "program_lexer.l" +#line 261 "program_lexer.l" { return MAT_PROGRAM; } YY_BREAK case 92: YY_RULE_SETUP -#line 255 "program_lexer.l" +#line 262 "program_lexer.l" { return MATRIX; } YY_BREAK case 93: YY_RULE_SETUP -#line 256 "program_lexer.l" +#line 263 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, MATRIXINDEX); } YY_BREAK case 94: YY_RULE_SETUP -#line 257 "program_lexer.l" +#line 264 "program_lexer.l" { return MODELVIEW; } YY_BREAK case 95: YY_RULE_SETUP -#line 258 "program_lexer.l" +#line 265 "program_lexer.l" { return MVP; } YY_BREAK case 96: YY_RULE_SETUP -#line 259 "program_lexer.l" +#line 266 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, NORMAL); } YY_BREAK case 97: YY_RULE_SETUP -#line 260 "program_lexer.l" +#line 267 "program_lexer.l" { return OBJECT; } YY_BREAK case 98: YY_RULE_SETUP -#line 261 "program_lexer.l" +#line 268 "program_lexer.l" { return PALETTE; } YY_BREAK case 99: YY_RULE_SETUP -#line 262 "program_lexer.l" +#line 269 "program_lexer.l" { return PARAMS; } YY_BREAK case 100: YY_RULE_SETUP -#line 263 "program_lexer.l" +#line 270 "program_lexer.l" { return PLANE; } YY_BREAK case 101: YY_RULE_SETUP -#line 264 "program_lexer.l" +#line 271 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, POINT); } YY_BREAK case 102: YY_RULE_SETUP -#line 265 "program_lexer.l" +#line 272 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, POINTSIZE); } YY_BREAK case 103: YY_RULE_SETUP -#line 266 "program_lexer.l" +#line 273 "program_lexer.l" { return POSITION; } YY_BREAK case 104: YY_RULE_SETUP -#line 267 "program_lexer.l" +#line 274 "program_lexer.l" { return PRIMARY; } YY_BREAK case 105: YY_RULE_SETUP -#line 268 "program_lexer.l" +#line 275 "program_lexer.l" { return PROJECTION; } YY_BREAK case 106: YY_RULE_SETUP -#line 269 "program_lexer.l" +#line 276 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, RANGE); } YY_BREAK case 107: YY_RULE_SETUP -#line 270 "program_lexer.l" +#line 277 "program_lexer.l" { return ROW; } YY_BREAK case 108: YY_RULE_SETUP -#line 271 "program_lexer.l" +#line 278 "program_lexer.l" { return SCENECOLOR; } YY_BREAK case 109: YY_RULE_SETUP -#line 272 "program_lexer.l" +#line 279 "program_lexer.l" { return SECONDARY; } YY_BREAK case 110: YY_RULE_SETUP -#line 273 "program_lexer.l" +#line 280 "program_lexer.l" { return SHININESS; } YY_BREAK case 111: YY_RULE_SETUP -#line 274 "program_lexer.l" +#line 281 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, SIZE); } YY_BREAK case 112: YY_RULE_SETUP -#line 275 "program_lexer.l" +#line 282 "program_lexer.l" { return SPECULAR; } YY_BREAK case 113: YY_RULE_SETUP -#line 276 "program_lexer.l" +#line 283 "program_lexer.l" { return SPOT; } YY_BREAK case 114: YY_RULE_SETUP -#line 277 "program_lexer.l" +#line 284 "program_lexer.l" { return TEXCOORD; } YY_BREAK case 115: YY_RULE_SETUP -#line 278 "program_lexer.l" +#line 285 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, TEXENV); } YY_BREAK case 116: YY_RULE_SETUP -#line 279 "program_lexer.l" +#line 286 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN); } YY_BREAK case 117: YY_RULE_SETUP -#line 280 "program_lexer.l" +#line 287 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_Q); } YY_BREAK case 118: YY_RULE_SETUP -#line 281 "program_lexer.l" +#line 288 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_S); } YY_BREAK case 119: YY_RULE_SETUP -#line 282 "program_lexer.l" +#line 289 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_T); } YY_BREAK case 120: YY_RULE_SETUP -#line 283 "program_lexer.l" +#line 290 "program_lexer.l" { return TEXTURE; } YY_BREAK case 121: YY_RULE_SETUP -#line 284 "program_lexer.l" +#line 291 "program_lexer.l" { return TRANSPOSE; } YY_BREAK case 122: YY_RULE_SETUP -#line 285 "program_lexer.l" +#line 292 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, VTXATTRIB); } YY_BREAK case 123: YY_RULE_SETUP -#line 286 "program_lexer.l" +#line 293 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, WEIGHT); } YY_BREAK case 124: YY_RULE_SETUP -#line 288 "program_lexer.l" +#line 295 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEXTURE_UNIT); } YY_BREAK case 125: YY_RULE_SETUP -#line 289 "program_lexer.l" +#line 296 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_1D); } YY_BREAK case 126: YY_RULE_SETUP -#line 290 "program_lexer.l" +#line 297 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_2D); } YY_BREAK case 127: YY_RULE_SETUP -#line 291 "program_lexer.l" +#line 298 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_3D); } YY_BREAK case 128: YY_RULE_SETUP -#line 292 "program_lexer.l" +#line 299 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_CUBE); } YY_BREAK case 129: YY_RULE_SETUP -#line 293 "program_lexer.l" +#line 300 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_rect, TEX_RECT); } YY_BREAK case 130: YY_RULE_SETUP -#line 294 "program_lexer.l" +#line 301 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW1D); } YY_BREAK case 131: YY_RULE_SETUP -#line 295 "program_lexer.l" +#line 302 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW2D); } YY_BREAK case 132: YY_RULE_SETUP -#line 296 "program_lexer.l" +#line 303 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_rect, TEX_SHADOWRECT); } YY_BREAK case 133: YY_RULE_SETUP -#line 297 "program_lexer.l" +#line 304 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY1D); } YY_BREAK case 134: YY_RULE_SETUP -#line 298 "program_lexer.l" +#line 305 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY2D); } YY_BREAK case 135: YY_RULE_SETUP -#line 299 "program_lexer.l" +#line 306 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW1D); } YY_BREAK case 136: YY_RULE_SETUP -#line 300 "program_lexer.l" +#line 307 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); } YY_BREAK case 137: YY_RULE_SETUP -#line 302 "program_lexer.l" -{ - yylval->string = strdup(yytext); - return IDENTIFIER; -} +#line 309 "program_lexer.l" +{ return handle_ident(yyextra, yytext, yylval); } YY_BREAK case 138: YY_RULE_SETUP -#line 307 "program_lexer.l" +#line 311 "program_lexer.l" { return DOT_DOT; } YY_BREAK case 139: YY_RULE_SETUP -#line 309 "program_lexer.l" +#line 313 "program_lexer.l" { yylval->integer = strtol(yytext, NULL, 10); return INTEGER; @@ -2182,7 +2186,7 @@ YY_RULE_SETUP YY_BREAK case 140: YY_RULE_SETUP -#line 313 "program_lexer.l" +#line 317 "program_lexer.l" { yylval->real = strtod(yytext, NULL); return REAL; @@ -2194,7 +2198,7 @@ case 141: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 317 "program_lexer.l" +#line 321 "program_lexer.l" { yylval->real = strtod(yytext, NULL); return REAL; @@ -2202,7 +2206,7 @@ YY_RULE_SETUP YY_BREAK case 142: YY_RULE_SETUP -#line 321 "program_lexer.l" +#line 325 "program_lexer.l" { yylval->real = strtod(yytext, NULL); return REAL; @@ -2210,7 +2214,7 @@ YY_RULE_SETUP YY_BREAK case 143: YY_RULE_SETUP -#line 325 "program_lexer.l" +#line 329 "program_lexer.l" { yylval->real = strtod(yytext, NULL); return REAL; @@ -2218,7 +2222,7 @@ YY_RULE_SETUP YY_BREAK case 144: YY_RULE_SETUP -#line 330 "program_lexer.l" +#line 334 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; @@ -2227,7 +2231,7 @@ YY_RULE_SETUP YY_BREAK case 145: YY_RULE_SETUP -#line 336 "program_lexer.l" +#line 340 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2237,7 +2241,7 @@ YY_RULE_SETUP YY_BREAK case 146: YY_RULE_SETUP -#line 342 "program_lexer.l" +#line 346 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; @@ -2246,7 +2250,7 @@ YY_RULE_SETUP YY_BREAK case 147: YY_RULE_SETUP -#line 347 "program_lexer.l" +#line 351 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; @@ -2255,7 +2259,7 @@ YY_RULE_SETUP YY_BREAK case 148: YY_RULE_SETUP -#line 353 "program_lexer.l" +#line 357 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2265,7 +2269,7 @@ YY_RULE_SETUP YY_BREAK case 149: YY_RULE_SETUP -#line 359 "program_lexer.l" +#line 363 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2275,7 +2279,7 @@ YY_RULE_SETUP YY_BREAK case 150: YY_RULE_SETUP -#line 365 "program_lexer.l" +#line 369 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; @@ -2284,7 +2288,7 @@ YY_RULE_SETUP YY_BREAK case 151: YY_RULE_SETUP -#line 371 "program_lexer.l" +#line 375 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2294,7 +2298,7 @@ YY_RULE_SETUP YY_BREAK case 152: YY_RULE_SETUP -#line 378 "program_lexer.l" +#line 382 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2306,7 +2310,7 @@ YY_RULE_SETUP YY_BREAK case 153: YY_RULE_SETUP -#line 387 "program_lexer.l" +#line 391 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; @@ -2315,7 +2319,7 @@ YY_RULE_SETUP YY_BREAK case 154: YY_RULE_SETUP -#line 393 "program_lexer.l" +#line 397 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2325,7 +2329,7 @@ YY_RULE_SETUP YY_BREAK case 155: YY_RULE_SETUP -#line 399 "program_lexer.l" +#line 403 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; @@ -2334,7 +2338,7 @@ YY_RULE_SETUP YY_BREAK case 156: YY_RULE_SETUP -#line 404 "program_lexer.l" +#line 408 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; @@ -2343,7 +2347,7 @@ YY_RULE_SETUP YY_BREAK case 157: YY_RULE_SETUP -#line 410 "program_lexer.l" +#line 414 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2353,7 +2357,7 @@ YY_RULE_SETUP YY_BREAK case 158: YY_RULE_SETUP -#line 416 "program_lexer.l" +#line 420 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2363,7 +2367,7 @@ YY_RULE_SETUP YY_BREAK case 159: YY_RULE_SETUP -#line 422 "program_lexer.l" +#line 426 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; @@ -2372,7 +2376,7 @@ YY_RULE_SETUP YY_BREAK case 160: YY_RULE_SETUP -#line 428 "program_lexer.l" +#line 432 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2382,7 +2386,7 @@ YY_RULE_SETUP YY_BREAK case 161: YY_RULE_SETUP -#line 436 "program_lexer.l" +#line 440 "program_lexer.l" { if (require_ARB_vp) { return TEXGEN_R; @@ -2396,7 +2400,7 @@ YY_RULE_SETUP YY_BREAK case 162: YY_RULE_SETUP -#line 447 "program_lexer.l" +#line 451 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2408,13 +2412,13 @@ YY_RULE_SETUP YY_BREAK case 163: YY_RULE_SETUP -#line 456 "program_lexer.l" +#line 460 "program_lexer.l" { return DOT; } YY_BREAK case 164: /* rule 164 can match eol */ YY_RULE_SETUP -#line 458 "program_lexer.l" +#line 462 "program_lexer.l" { yylloc->first_line++; yylloc->first_column = 1; @@ -2425,7 +2429,7 @@ YY_RULE_SETUP YY_BREAK case 165: YY_RULE_SETUP -#line 465 "program_lexer.l" +#line 469 "program_lexer.l" /* eat whitespace */ ; YY_BREAK case 166: @@ -2433,20 +2437,20 @@ case 166: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 466 "program_lexer.l" +#line 470 "program_lexer.l" /* eat comments */ ; YY_BREAK case 167: YY_RULE_SETUP -#line 467 "program_lexer.l" +#line 471 "program_lexer.l" { return yytext[0]; } YY_BREAK case 168: YY_RULE_SETUP -#line 468 "program_lexer.l" +#line 472 "program_lexer.l" ECHO; YY_BREAK -#line 2450 "lex.yy.c" +#line 2454 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -3621,7 +3625,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 468 "program_lexer.l" +#line 472 "program_lexer.l" diff --git a/src/mesa/shader/program_lexer.l b/src/mesa/shader/program_lexer.l index d7493f42fa..9e68c34ac0 100644 --- a/src/mesa/shader/program_lexer.l +++ b/src/mesa/shader/program_lexer.l @@ -39,8 +39,7 @@ if (condition) { \ return token; \ } else { \ - yylval->string = strdup(yytext); \ - return IDENTIFIER; \ + return handle_ident(yyextra, yytext, yylval); \ } \ } while (0) @@ -64,8 +63,7 @@ yylval->temp_inst.Opcode = OPCODE_ ## opcode; \ return token; \ } else { \ - yylval->string = strdup(yytext); \ - return IDENTIFIER; \ + return handle_ident(yyextra, yytext, yylval); \ } \ } while (0) @@ -114,6 +112,15 @@ swiz_from_char(char c) return 0; } +static int +handle_ident(struct asm_parser_state *state, const char *text, YYSTYPE *lval) +{ + lval->string = strdup(text); + + return (_mesa_symbol_table_find_symbol(state->st, 0, text) == NULL) + ? IDENTIFIER : USED_IDENTIFIER; +} + #define YY_USER_ACTION \ do { \ yylloc->first_column = yylloc->last_column; \ @@ -299,10 +306,7 @@ ARRAY2D { return_token_or_IDENTIFIER(require_ARB_fp && require ARRAYSHADOW1D { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW1D); } ARRAYSHADOW2D { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); } -[_a-zA-Z$][_a-zA-Z0-9$]* { - yylval->string = strdup(yytext); - return IDENTIFIER; -} +[_a-zA-Z$][_a-zA-Z0-9$]* { return handle_ident(yyextra, yytext, yylval); } ".." { return DOT_DOT; } diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c index e741e9a13b..d37b20ba42 100644 --- a/src/mesa/shader/program_parse.tab.c +++ b/src/mesa/shader/program_parse.tab.c @@ -303,13 +303,14 @@ static struct asm_instruction *asm_instruction_copy_ctor( VTXATTRIB = 352, WEIGHT = 353, IDENTIFIER = 354, - MASK4 = 355, - MASK3 = 356, - MASK2 = 357, - MASK1 = 358, - SWIZZLE = 359, - DOT_DOT = 360, - DOT = 361 + USED_IDENTIFIER = 355, + MASK4 = 356, + MASK3 = 357, + MASK2 = 358, + MASK1 = 359, + SWIZZLE = 360, + DOT_DOT = 361, + DOT = 362 }; #endif @@ -349,7 +350,7 @@ typedef union YYSTYPE /* Line 214 of yacc.c */ -#line 353 "program_parse.tab.c" +#line 354 "program_parse.tab.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ @@ -373,14 +374,14 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ /* Line 264 of yacc.c */ -#line 258 "program_parse.y" +#line 259 "program_parse.y" extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, void *yyscanner); /* Line 264 of yacc.c */ -#line 384 "program_parse.tab.c" +#line 385 "program_parse.tab.c" #ifdef short # undef short @@ -597,20 +598,20 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 5 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 383 +#define YYLAST 393 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 117 +#define YYNTOKENS 118 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 137 +#define YYNNTS 138 /* YYNRULES -- Number of rules. */ -#define YYNRULES 272 +#define YYNRULES 274 /* YYNRULES -- Number of states. */ -#define YYNSTATES 458 +#define YYNSTATES 460 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 -#define YYMAXUTOK 361 +#define YYMAXUTOK 362 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) @@ -622,15 +623,15 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 112, 108, 113, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 107, - 2, 114, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 113, 109, 114, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 108, + 2, 115, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 110, 2, 111, 2, 2, 2, 2, 2, 2, + 2, 111, 2, 112, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 115, 109, 116, 2, 2, 2, 2, + 2, 2, 2, 116, 110, 117, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -654,7 +655,7 @@ static const yytype_uint8 yytranslate[] = 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, - 105, 106 + 105, 106, 107 }; #if YYDEBUG @@ -689,123 +690,123 @@ static const yytype_uint16 yyprhs[] = 686, 690, 694, 696, 702, 705, 708, 711, 714, 718, 721, 725, 726, 728, 730, 731, 733, 735, 736, 738, 740, 741, 743, 745, 746, 750, 751, 755, 756, 760, - 762, 764, 766 + 762, 764, 766, 771, 773 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { - 118, 0, -1, 119, 120, 122, 12, -1, 3, -1, - 4, -1, 120, 121, -1, -1, 8, 99, 107, -1, - 122, 123, -1, -1, 124, 107, -1, 162, 107, -1, - 125, -1, 126, -1, 127, -1, 128, -1, 129, -1, - 130, -1, 131, -1, 132, -1, 138, -1, 133, -1, - 134, -1, 135, -1, 19, 143, 108, 139, -1, 18, - 142, 108, 141, -1, 16, 142, 108, 139, -1, 14, - 142, 108, 139, 108, 139, -1, 13, 142, 108, 141, - 108, 141, -1, 17, 142, 108, 141, 108, 141, 108, - 141, -1, 15, 142, 108, 141, 108, 136, 108, 137, - -1, 20, 141, -1, 22, 142, 108, 141, 108, 141, - 108, 141, 108, 136, 108, 137, -1, 83, 248, -1, + 119, 0, -1, 120, 121, 123, 12, -1, 3, -1, + 4, -1, 121, 122, -1, -1, 8, 255, 108, -1, + 123, 124, -1, -1, 125, 108, -1, 163, 108, -1, + 126, -1, 127, -1, 128, -1, 129, -1, 130, -1, + 131, -1, 132, -1, 133, -1, 139, -1, 134, -1, + 135, -1, 136, -1, 19, 144, 109, 140, -1, 18, + 143, 109, 142, -1, 16, 143, 109, 140, -1, 14, + 143, 109, 140, 109, 140, -1, 13, 143, 109, 142, + 109, 142, -1, 17, 143, 109, 142, 109, 142, 109, + 142, -1, 15, 143, 109, 142, 109, 137, 109, 138, + -1, 20, 142, -1, 22, 143, 109, 142, 109, 142, + 109, 142, 109, 137, 109, 138, -1, 83, 249, -1, 84, -1, 85, -1, 86, -1, 87, -1, 88, -1, 89, -1, 90, -1, 91, -1, 92, -1, 93, -1, - 94, -1, 95, -1, 21, 142, 108, 147, 108, 144, - -1, 233, 140, -1, 233, 109, 140, 109, -1, 147, - 159, -1, 230, -1, 233, 147, 160, -1, 233, 109, - 147, 160, 109, -1, 148, 161, -1, 156, 158, -1, - 145, 108, 145, 108, 145, 108, 145, -1, 233, 146, - -1, 23, -1, 99, -1, 99, -1, 164, -1, 149, - 110, 150, 111, -1, 178, -1, 241, -1, 99, -1, - 99, -1, 151, -1, 152, -1, 23, -1, 156, 157, - 153, -1, -1, 112, 154, -1, 113, 155, -1, 23, - -1, 23, -1, 99, -1, 103, -1, 103, -1, 103, - -1, 103, -1, 100, -1, 104, -1, -1, 100, -1, - 101, -1, 102, -1, 103, -1, -1, 163, -1, 170, - -1, 234, -1, 237, -1, 240, -1, 253, -1, 7, - 99, 114, 164, -1, 96, 165, -1, 38, 169, -1, - 60, -1, 98, 167, -1, 53, -1, 29, 246, -1, - 37, -1, 74, 247, -1, 50, 110, 168, 111, -1, - 97, 110, 166, 111, -1, 23, -1, -1, 110, 168, - 111, -1, 23, -1, 60, -1, 29, 246, -1, 37, - -1, 74, 247, -1, 171, -1, 172, -1, 10, 99, - 174, -1, 10, 99, 110, 173, 111, 175, -1, -1, - 23, -1, 114, 177, -1, 114, 115, 176, 116, -1, - 179, -1, 176, 108, 179, -1, 181, -1, 217, -1, - 227, -1, 181, -1, 217, -1, 228, -1, 180, -1, - 218, -1, 227, -1, 181, -1, 73, 205, -1, 73, - 182, -1, 73, 184, -1, 73, 187, -1, 73, 189, - -1, 73, 195, -1, 73, 191, -1, 73, 198, -1, - 73, 200, -1, 73, 202, -1, 73, 204, -1, 73, - 216, -1, 47, 245, 183, -1, 193, -1, 33, -1, - 69, -1, 43, 110, 194, 111, 185, -1, 193, -1, - 60, -1, 26, -1, 72, 186, -1, 40, -1, 32, - -1, 44, 188, -1, 25, -1, 245, 67, -1, 45, - 110, 194, 111, 245, 190, -1, 193, -1, 75, 249, - 192, -1, 29, -1, 25, -1, 31, -1, 71, -1, - 23, -1, 76, 247, 196, 197, -1, 35, -1, 54, + 94, -1, 95, -1, 21, 143, 109, 148, 109, 145, + -1, 234, 141, -1, 234, 110, 141, 110, -1, 148, + 160, -1, 231, -1, 234, 148, 161, -1, 234, 110, + 148, 161, 110, -1, 149, 162, -1, 157, 159, -1, + 146, 109, 146, 109, 146, 109, 146, -1, 234, 147, + -1, 23, -1, 255, -1, 100, -1, 165, -1, 150, + 111, 151, 112, -1, 179, -1, 242, -1, 100, -1, + 100, -1, 152, -1, 153, -1, 23, -1, 157, 158, + 154, -1, -1, 113, 155, -1, 114, 156, -1, 23, + -1, 23, -1, 100, -1, 104, -1, 104, -1, 104, + -1, 104, -1, 101, -1, 105, -1, -1, 101, -1, + 102, -1, 103, -1, 104, -1, -1, 164, -1, 171, + -1, 235, -1, 238, -1, 241, -1, 254, -1, 7, + 99, 115, 165, -1, 96, 166, -1, 38, 170, -1, + 60, -1, 98, 168, -1, 53, -1, 29, 247, -1, + 37, -1, 74, 248, -1, 50, 111, 169, 112, -1, + 97, 111, 167, 112, -1, 23, -1, -1, 111, 169, + 112, -1, 23, -1, 60, -1, 29, 247, -1, 37, + -1, 74, 248, -1, 172, -1, 173, -1, 10, 99, + 175, -1, 10, 99, 111, 174, 112, 176, -1, -1, + 23, -1, 115, 178, -1, 115, 116, 177, 117, -1, + 180, -1, 177, 109, 180, -1, 182, -1, 218, -1, + 228, -1, 182, -1, 218, -1, 229, -1, 181, -1, + 219, -1, 228, -1, 182, -1, 73, 206, -1, 73, + 183, -1, 73, 185, -1, 73, 188, -1, 73, 190, + -1, 73, 196, -1, 73, 192, -1, 73, 199, -1, + 73, 201, -1, 73, 203, -1, 73, 205, -1, 73, + 217, -1, 47, 246, 184, -1, 194, -1, 33, -1, + 69, -1, 43, 111, 195, 112, 186, -1, 194, -1, + 60, -1, 26, -1, 72, 187, -1, 40, -1, 32, + -1, 44, 189, -1, 25, -1, 246, 67, -1, 45, + 111, 195, 112, 246, 191, -1, 194, -1, 75, 250, + 193, -1, 29, -1, 25, -1, 31, -1, 71, -1, + 23, -1, 76, 248, 197, 198, -1, 35, -1, 54, -1, 79, -1, 80, -1, 78, -1, 77, -1, 36, - 199, -1, 29, -1, 56, -1, 28, 110, 201, 111, - 57, -1, 23, -1, 58, 203, -1, 70, -1, 26, - -1, 207, 66, 110, 210, 111, -1, 207, 206, -1, - -1, 66, 110, 210, 105, 210, 111, -1, 49, 211, - 208, -1, -1, 209, -1, 41, -1, 82, -1, 42, - -1, 23, -1, 51, 212, -1, 63, -1, 52, -1, - 81, 247, -1, 55, 110, 214, 111, -1, 48, 110, - 215, 111, -1, -1, 213, -1, 23, -1, 23, -1, - 23, -1, 30, 64, -1, 221, -1, 224, -1, 219, - -1, 222, -1, 62, 34, 110, 220, 111, -1, 225, - -1, 225, 105, 225, -1, 62, 34, 110, 225, 111, - -1, 62, 46, 110, 223, 111, -1, 226, -1, 226, - 105, 226, -1, 62, 46, 110, 226, 111, -1, 23, - -1, 23, -1, 229, -1, 231, -1, 230, -1, 231, - -1, 232, -1, 24, -1, 23, -1, 115, 232, 116, - -1, 115, 232, 108, 232, 116, -1, 115, 232, 108, - 232, 108, 232, 116, -1, 115, 232, 108, 232, 108, - 232, 108, 232, 116, -1, 233, 24, -1, 233, 23, - -1, 112, -1, 113, -1, -1, -1, 236, 11, 235, - 239, -1, 99, -1, -1, -1, 5, 238, 239, -1, - 239, 108, 99, -1, 99, -1, 236, 9, 99, 114, - 241, -1, 65, 60, -1, 65, 37, -1, 65, 242, - -1, 65, 59, -1, 65, 74, 247, -1, 65, 30, - -1, 29, 243, 244, -1, -1, 39, -1, 27, -1, + 200, -1, 29, -1, 56, -1, 28, 111, 202, 112, + 57, -1, 23, -1, 58, 204, -1, 70, -1, 26, + -1, 208, 66, 111, 211, 112, -1, 208, 207, -1, + -1, 66, 111, 211, 106, 211, 112, -1, 49, 212, + 209, -1, -1, 210, -1, 41, -1, 82, -1, 42, + -1, 23, -1, 51, 213, -1, 63, -1, 52, -1, + 81, 248, -1, 55, 111, 215, 112, -1, 48, 111, + 216, 112, -1, -1, 214, -1, 23, -1, 23, -1, + 23, -1, 30, 64, -1, 222, -1, 225, -1, 220, + -1, 223, -1, 62, 34, 111, 221, 112, -1, 226, + -1, 226, 106, 226, -1, 62, 34, 111, 226, 112, + -1, 62, 46, 111, 224, 112, -1, 227, -1, 227, + 106, 227, -1, 62, 46, 111, 227, 112, -1, 23, + -1, 23, -1, 230, -1, 232, -1, 231, -1, 232, + -1, 233, -1, 24, -1, 23, -1, 116, 233, 117, + -1, 116, 233, 109, 233, 117, -1, 116, 233, 109, + 233, 109, 233, 117, -1, 116, 233, 109, 233, 109, + 233, 109, 233, 117, -1, 234, 24, -1, 234, 23, + -1, 113, -1, 114, -1, -1, -1, 237, 11, 236, + 240, -1, 255, -1, -1, -1, 5, 239, 240, -1, + 240, 109, 99, -1, 99, -1, 237, 9, 99, 115, + 242, -1, 65, 60, -1, 65, 37, -1, 65, 243, + -1, 65, 59, -1, 65, 74, 248, -1, 65, 30, + -1, 29, 244, 245, -1, -1, 39, -1, 27, -1, -1, 61, -1, 68, -1, -1, 39, -1, 27, -1, - -1, 61, -1, 68, -1, -1, 110, 250, 111, -1, - -1, 110, 251, 111, -1, -1, 110, 252, 111, -1, - 23, -1, 23, -1, 23, -1, 6, 99, 114, 99, - -1 + -1, 61, -1, 68, -1, -1, 111, 251, 112, -1, + -1, 111, 252, 112, -1, -1, 111, 253, 112, -1, + 23, -1, 23, -1, 23, -1, 6, 99, 115, 100, + -1, 99, -1, 100, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 265, 265, 268, 276, 288, 289, 292, 314, 315, - 318, 333, 336, 341, 348, 349, 350, 351, 352, 353, - 354, 357, 358, 359, 362, 368, 374, 380, 387, 393, - 400, 444, 451, 495, 501, 502, 503, 504, 505, 506, - 507, 508, 509, 510, 511, 512, 515, 527, 535, 552, - 559, 578, 589, 609, 631, 640, 673, 680, 695, 745, - 787, 798, 819, 829, 835, 866, 883, 883, 885, 892, - 904, 905, 906, 909, 921, 933, 951, 962, 974, 976, - 977, 978, 979, 982, 982, 982, 982, 983, 986, 987, - 988, 989, 990, 991, 994, 1012, 1016, 1022, 1026, 1030, - 1034, 1043, 1052, 1056, 1061, 1067, 1078, 1078, 1079, 1081, - 1085, 1089, 1093, 1099, 1099, 1101, 1117, 1140, 1143, 1154, - 1160, 1166, 1167, 1174, 1180, 1186, 1194, 1200, 1206, 1214, - 1220, 1226, 1234, 1235, 1238, 1239, 1240, 1241, 1242, 1243, - 1244, 1245, 1246, 1247, 1248, 1251, 1260, 1264, 1268, 1274, - 1283, 1287, 1291, 1300, 1304, 1310, 1316, 1323, 1328, 1336, - 1346, 1348, 1356, 1362, 1366, 1370, 1376, 1387, 1396, 1400, - 1405, 1409, 1413, 1417, 1423, 1430, 1434, 1440, 1448, 1459, - 1466, 1470, 1476, 1486, 1497, 1501, 1519, 1528, 1531, 1537, - 1541, 1545, 1551, 1562, 1567, 1572, 1577, 1582, 1587, 1595, - 1598, 1603, 1616, 1624, 1635, 1643, 1643, 1645, 1645, 1647, - 1657, 1662, 1669, 1679, 1688, 1693, 1700, 1710, 1720, 1732, - 1732, 1733, 1733, 1735, 1745, 1753, 1763, 1771, 1779, 1788, - 1799, 1803, 1809, 1810, 1811, 1814, 1814, 1817, 1852, 1856, - 1856, 1859, 1865, 1873, 1886, 1895, 1904, 1908, 1917, 1926, - 1937, 1944, 1949, 1958, 1970, 1973, 1982, 1993, 1994, 1995, - 1998, 1999, 2000, 2003, 2004, 2007, 2008, 2011, 2012, 2015, - 2026, 2037, 2048 + 0, 266, 266, 269, 277, 289, 290, 293, 315, 316, + 319, 334, 337, 342, 349, 350, 351, 352, 353, 354, + 355, 358, 359, 360, 363, 369, 375, 381, 388, 394, + 401, 445, 452, 496, 502, 503, 504, 505, 506, 507, + 508, 509, 510, 511, 512, 513, 516, 528, 536, 553, + 560, 579, 590, 610, 632, 641, 674, 681, 696, 746, + 788, 799, 820, 830, 836, 867, 884, 884, 886, 893, + 905, 906, 907, 910, 922, 934, 952, 963, 975, 977, + 978, 979, 980, 983, 983, 983, 983, 984, 987, 988, + 989, 990, 991, 992, 995, 1013, 1017, 1023, 1027, 1031, + 1035, 1044, 1053, 1057, 1062, 1068, 1079, 1079, 1080, 1082, + 1086, 1090, 1094, 1100, 1100, 1102, 1118, 1141, 1144, 1155, + 1161, 1167, 1168, 1175, 1181, 1187, 1195, 1201, 1207, 1215, + 1221, 1227, 1235, 1236, 1239, 1240, 1241, 1242, 1243, 1244, + 1245, 1246, 1247, 1248, 1249, 1252, 1261, 1265, 1269, 1275, + 1284, 1288, 1292, 1301, 1305, 1311, 1317, 1324, 1329, 1337, + 1347, 1349, 1357, 1363, 1367, 1371, 1377, 1388, 1397, 1401, + 1406, 1410, 1414, 1418, 1424, 1431, 1435, 1441, 1449, 1460, + 1467, 1471, 1477, 1487, 1498, 1502, 1520, 1529, 1532, 1538, + 1542, 1546, 1552, 1563, 1568, 1573, 1578, 1583, 1588, 1596, + 1599, 1604, 1617, 1625, 1636, 1644, 1644, 1646, 1646, 1648, + 1658, 1663, 1670, 1680, 1689, 1694, 1701, 1711, 1721, 1733, + 1733, 1734, 1734, 1736, 1746, 1754, 1764, 1772, 1780, 1789, + 1800, 1804, 1810, 1811, 1812, 1815, 1815, 1818, 1853, 1857, + 1857, 1860, 1866, 1874, 1887, 1896, 1905, 1909, 1918, 1927, + 1938, 1945, 1950, 1959, 1971, 1974, 1983, 1994, 1995, 1996, + 1999, 2000, 2001, 2004, 2005, 2008, 2009, 2012, 2013, 2016, + 2027, 2038, 2049, 2070, 2071 }; #endif @@ -830,11 +831,11 @@ static const char *const yytname[] = "TEX_2D", "TEX_3D", "TEX_CUBE", "TEX_RECT", "TEX_SHADOW1D", "TEX_SHADOW2D", "TEX_SHADOWRECT", "TEX_ARRAY1D", "TEX_ARRAY2D", "TEX_ARRAYSHADOW1D", "TEX_ARRAYSHADOW2D", "VERTEX", "VTXATTRIB", - "WEIGHT", "IDENTIFIER", "MASK4", "MASK3", "MASK2", "MASK1", "SWIZZLE", - "DOT_DOT", "DOT", "';'", "','", "'|'", "'['", "']'", "'+'", "'-'", "'='", - "'{'", "'}'", "$accept", "program", "language", "optionSequence", - "option", "statementSequence", "statement", "instruction", - "ALU_instruction", "TexInstruction", "ARL_instruction", + "WEIGHT", "IDENTIFIER", "USED_IDENTIFIER", "MASK4", "MASK3", "MASK2", + "MASK1", "SWIZZLE", "DOT_DOT", "DOT", "';'", "','", "'|'", "'['", "']'", + "'+'", "'-'", "'='", "'{'", "'}'", "$accept", "program", "language", + "optionSequence", "option", "statementSequence", "statement", + "instruction", "ALU_instruction", "TexInstruction", "ARL_instruction", "VECTORop_instruction", "SCALARop_instruction", "BINSCop_instruction", "BINop_instruction", "TRIop_instruction", "SAMPLE_instruction", "KIL_instruction", "TXD_instruction", "texImageUnit", "texTarget", @@ -873,7 +874,7 @@ static const char *const yytname[] = "optResultColorType", "optFaceType", "optColorType", "optTexCoordUnitNum", "optTexImageUnitNum", "optLegacyTexUnitNum", "texCoordUnitNum", "texImageUnitNum", "legacyTexUnitNum", - "ALIAS_statement", 0 + "ALIAS_statement", "string", 0 }; #endif @@ -892,42 +893,42 @@ static const yytype_uint16 yytoknum[] = 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, - 355, 356, 357, 358, 359, 360, 361, 59, 44, 124, - 91, 93, 43, 45, 61, 123, 125 + 355, 356, 357, 358, 359, 360, 361, 362, 59, 44, + 124, 91, 93, 43, 45, 61, 123, 125 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { - 0, 117, 118, 119, 119, 120, 120, 121, 122, 122, - 123, 123, 124, 124, 125, 125, 125, 125, 125, 125, - 125, 126, 126, 126, 127, 128, 129, 130, 131, 132, - 133, 134, 135, 136, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 138, 139, 139, 140, - 140, 141, 141, 142, 143, 144, 145, 146, 146, 147, - 147, 147, 147, 148, 148, 149, 150, 150, 151, 152, - 153, 153, 153, 154, 155, 156, 157, 158, 159, 160, - 160, 160, 160, 161, 161, 161, 161, 161, 162, 162, - 162, 162, 162, 162, 163, 164, 164, 165, 165, 165, - 165, 165, 165, 165, 165, 166, 167, 167, 168, 169, - 169, 169, 169, 170, 170, 171, 172, 173, 173, 174, - 175, 176, 176, 177, 177, 177, 178, 178, 178, 179, - 179, 179, 180, 180, 181, 181, 181, 181, 181, 181, - 181, 181, 181, 181, 181, 182, 183, 183, 183, 184, - 185, 185, 185, 185, 185, 186, 187, 188, 188, 189, - 190, 191, 192, 193, 193, 193, 194, 195, 196, 196, - 197, 197, 197, 197, 198, 199, 199, 200, 201, 202, - 203, 203, 204, 205, 206, 206, 207, 208, 208, 209, - 209, 209, 210, 211, 211, 211, 211, 211, 211, 212, - 212, 213, 214, 215, 216, 217, 217, 218, 218, 219, - 220, 220, 221, 222, 223, 223, 224, 225, 226, 227, - 227, 228, 228, 229, 230, 230, 231, 231, 231, 231, - 232, 232, 233, 233, 233, 235, 234, 236, 236, 238, - 237, 239, 239, 240, 241, 241, 241, 241, 241, 241, - 242, 243, 243, 243, 244, 244, 244, 245, 245, 245, - 246, 246, 246, 247, 247, 248, 248, 249, 249, 250, - 251, 252, 253 + 0, 118, 119, 120, 120, 121, 121, 122, 123, 123, + 124, 124, 125, 125, 126, 126, 126, 126, 126, 126, + 126, 127, 127, 127, 128, 129, 130, 131, 132, 133, + 134, 135, 136, 137, 138, 138, 138, 138, 138, 138, + 138, 138, 138, 138, 138, 138, 139, 140, 140, 141, + 141, 142, 142, 143, 144, 145, 146, 147, 147, 148, + 148, 148, 148, 149, 149, 150, 151, 151, 152, 153, + 154, 154, 154, 155, 156, 157, 158, 159, 160, 161, + 161, 161, 161, 162, 162, 162, 162, 162, 163, 163, + 163, 163, 163, 163, 164, 165, 165, 166, 166, 166, + 166, 166, 166, 166, 166, 167, 168, 168, 169, 170, + 170, 170, 170, 171, 171, 172, 173, 174, 174, 175, + 176, 177, 177, 178, 178, 178, 179, 179, 179, 180, + 180, 180, 181, 181, 182, 182, 182, 182, 182, 182, + 182, 182, 182, 182, 182, 183, 184, 184, 184, 185, + 186, 186, 186, 186, 186, 187, 188, 189, 189, 190, + 191, 192, 193, 194, 194, 194, 195, 196, 197, 197, + 198, 198, 198, 198, 199, 200, 200, 201, 202, 203, + 204, 204, 205, 206, 207, 207, 208, 209, 209, 210, + 210, 210, 211, 212, 212, 212, 212, 212, 212, 213, + 213, 214, 215, 216, 217, 218, 218, 219, 219, 220, + 221, 221, 222, 223, 224, 224, 225, 226, 227, 228, + 228, 229, 229, 230, 231, 231, 232, 232, 232, 232, + 233, 233, 234, 234, 234, 236, 235, 237, 237, 239, + 238, 240, 240, 241, 242, 242, 242, 242, 242, 242, + 243, 244, 244, 244, 245, 245, 245, 246, 246, 246, + 247, 247, 247, 248, 248, 249, 249, 250, 250, 251, + 252, 253, 254, 255, 255 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -960,7 +961,7 @@ static const yytype_uint8 yyr2[] = 3, 3, 1, 5, 2, 2, 2, 2, 3, 2, 3, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 1, 0, 3, 0, 3, 0, 3, 1, - 1, 1, 4 + 1, 1, 4, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -969,142 +970,142 @@ static const yytype_uint8 yyr2[] = static const yytype_uint16 yydefact[] = { 0, 3, 4, 0, 6, 1, 9, 0, 5, 238, - 0, 239, 0, 0, 0, 2, 0, 0, 0, 0, - 0, 0, 0, 234, 0, 0, 237, 8, 0, 12, - 13, 14, 15, 16, 17, 18, 19, 21, 22, 23, - 20, 0, 88, 89, 113, 114, 90, 0, 91, 92, - 93, 7, 0, 0, 0, 0, 0, 64, 0, 87, - 63, 0, 0, 0, 0, 0, 75, 0, 0, 232, - 233, 31, 0, 0, 0, 10, 11, 0, 235, 242, - 240, 0, 0, 117, 234, 115, 251, 249, 245, 247, - 244, 263, 246, 234, 83, 84, 85, 86, 53, 234, - 234, 234, 234, 234, 234, 77, 54, 225, 224, 0, - 0, 0, 0, 59, 0, 234, 82, 0, 60, 62, - 126, 127, 205, 206, 128, 221, 222, 0, 234, 0, - 0, 0, 272, 94, 118, 0, 119, 123, 124, 125, - 219, 220, 223, 0, 253, 252, 254, 0, 248, 0, - 0, 0, 0, 26, 0, 25, 24, 260, 111, 109, - 263, 96, 0, 0, 0, 0, 0, 0, 257, 0, - 257, 0, 0, 267, 263, 134, 135, 136, 137, 139, - 138, 140, 141, 142, 143, 0, 144, 260, 101, 0, - 99, 97, 263, 0, 106, 95, 82, 0, 80, 79, - 81, 51, 0, 0, 0, 0, 236, 241, 0, 231, - 230, 255, 256, 250, 269, 0, 234, 234, 0, 47, - 0, 50, 0, 234, 261, 262, 110, 112, 0, 0, - 0, 204, 175, 176, 174, 0, 157, 259, 258, 156, - 0, 0, 0, 0, 199, 195, 0, 194, 263, 187, - 181, 180, 179, 0, 0, 0, 0, 100, 0, 102, - 0, 0, 98, 0, 234, 226, 68, 0, 66, 67, - 0, 234, 234, 243, 0, 116, 264, 28, 27, 0, - 78, 49, 265, 0, 0, 217, 0, 218, 0, 178, - 0, 166, 0, 158, 0, 163, 164, 147, 148, 165, - 145, 146, 0, 201, 193, 200, 0, 196, 189, 191, - 190, 186, 188, 271, 0, 162, 161, 168, 169, 0, - 0, 108, 0, 105, 0, 0, 52, 0, 61, 76, - 70, 46, 0, 0, 0, 234, 48, 0, 33, 0, - 234, 212, 216, 0, 0, 257, 203, 0, 202, 0, - 268, 173, 172, 170, 171, 167, 192, 0, 103, 104, - 107, 234, 227, 0, 0, 69, 234, 57, 58, 56, - 234, 0, 0, 0, 121, 129, 132, 130, 207, 208, - 131, 270, 0, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 30, 29, 177, 152, 154, - 151, 0, 149, 150, 0, 198, 197, 182, 0, 73, - 71, 74, 72, 0, 0, 0, 0, 133, 184, 234, - 120, 266, 155, 153, 159, 160, 234, 228, 234, 0, - 0, 0, 0, 183, 122, 0, 0, 0, 0, 210, - 0, 214, 0, 229, 234, 0, 209, 0, 213, 0, - 0, 55, 32, 211, 215, 0, 0, 185 + 273, 274, 0, 239, 0, 0, 0, 2, 0, 0, + 0, 0, 0, 0, 0, 234, 0, 0, 8, 0, + 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, + 23, 20, 0, 88, 89, 113, 114, 90, 0, 91, + 92, 93, 237, 7, 0, 0, 0, 0, 0, 64, + 0, 87, 63, 0, 0, 0, 0, 0, 75, 0, + 0, 232, 233, 31, 0, 0, 0, 10, 11, 0, + 235, 242, 240, 0, 0, 117, 234, 115, 251, 249, + 245, 247, 244, 263, 246, 234, 83, 84, 85, 86, + 53, 234, 234, 234, 234, 234, 234, 77, 54, 225, + 224, 0, 0, 0, 0, 59, 0, 234, 82, 0, + 60, 62, 126, 127, 205, 206, 128, 221, 222, 0, + 234, 0, 0, 0, 272, 94, 118, 0, 119, 123, + 124, 125, 219, 220, 223, 0, 253, 252, 254, 0, + 248, 0, 0, 0, 0, 26, 0, 25, 24, 260, + 111, 109, 263, 96, 0, 0, 0, 0, 0, 0, + 257, 0, 257, 0, 0, 267, 263, 134, 135, 136, + 137, 139, 138, 140, 141, 142, 143, 0, 144, 260, + 101, 0, 99, 97, 263, 0, 106, 95, 82, 0, + 80, 79, 81, 51, 0, 0, 0, 0, 236, 241, + 0, 231, 230, 255, 256, 250, 269, 0, 234, 234, + 0, 47, 0, 50, 0, 234, 261, 262, 110, 112, + 0, 0, 0, 204, 175, 176, 174, 0, 157, 259, + 258, 156, 0, 0, 0, 0, 199, 195, 0, 194, + 263, 187, 181, 180, 179, 0, 0, 0, 0, 100, + 0, 102, 0, 0, 98, 0, 234, 226, 68, 0, + 66, 67, 0, 234, 234, 243, 0, 116, 264, 28, + 27, 0, 78, 49, 265, 0, 0, 217, 0, 218, + 0, 178, 0, 166, 0, 158, 0, 163, 164, 147, + 148, 165, 145, 146, 0, 201, 193, 200, 0, 196, + 189, 191, 190, 186, 188, 271, 0, 162, 161, 168, + 169, 0, 0, 108, 0, 105, 0, 0, 52, 0, + 61, 76, 70, 46, 0, 0, 0, 234, 48, 0, + 33, 0, 234, 212, 216, 0, 0, 257, 203, 0, + 202, 0, 268, 173, 172, 170, 171, 167, 192, 0, + 103, 104, 107, 234, 227, 0, 0, 69, 234, 57, + 56, 58, 234, 0, 0, 0, 121, 129, 132, 130, + 207, 208, 131, 270, 0, 34, 35, 36, 37, 38, + 39, 40, 41, 42, 43, 44, 45, 30, 29, 177, + 152, 154, 151, 0, 149, 150, 0, 198, 197, 182, + 0, 73, 71, 74, 72, 0, 0, 0, 0, 133, + 184, 234, 120, 266, 155, 153, 159, 160, 234, 228, + 234, 0, 0, 0, 0, 183, 122, 0, 0, 0, + 0, 210, 0, 214, 0, 229, 234, 0, 209, 0, + 213, 0, 0, 55, 32, 211, 215, 0, 0, 185 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { - -1, 3, 4, 6, 8, 9, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, 39, 283, - 395, 40, 150, 219, 71, 58, 67, 331, 332, 369, - 220, 59, 117, 267, 268, 269, 365, 410, 412, 68, - 330, 106, 281, 201, 98, 41, 42, 118, 195, 324, - 262, 322, 161, 43, 44, 45, 135, 85, 275, 373, - 136, 119, 374, 375, 120, 175, 300, 176, 402, 423, - 177, 239, 178, 424, 179, 316, 301, 292, 180, 319, - 355, 181, 234, 182, 290, 183, 252, 184, 417, 433, - 185, 311, 312, 357, 249, 304, 305, 349, 347, 186, - 121, 377, 378, 438, 122, 379, 440, 123, 286, 288, - 380, 124, 140, 125, 126, 142, 72, 46, 130, 47, - 48, 52, 80, 49, 60, 92, 146, 213, 240, 226, - 148, 338, 254, 215, 382, 314, 50 + -1, 3, 4, 6, 8, 9, 28, 29, 30, 31, + 32, 33, 34, 35, 36, 37, 38, 39, 40, 285, + 397, 41, 152, 221, 73, 60, 69, 333, 334, 370, + 222, 61, 119, 269, 270, 271, 367, 412, 414, 70, + 332, 108, 283, 203, 100, 42, 43, 120, 197, 326, + 264, 324, 163, 44, 45, 46, 137, 87, 277, 375, + 138, 121, 376, 377, 122, 177, 302, 178, 404, 425, + 179, 241, 180, 426, 181, 318, 303, 294, 182, 321, + 357, 183, 236, 184, 292, 185, 254, 186, 419, 435, + 187, 313, 314, 359, 251, 306, 307, 351, 349, 188, + 123, 379, 380, 440, 124, 381, 442, 125, 288, 290, + 382, 126, 142, 127, 128, 144, 74, 47, 132, 48, + 49, 54, 82, 50, 62, 94, 148, 215, 242, 228, + 150, 340, 256, 217, 384, 316, 51, 12 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -386 +#define YYPACT_NINF -401 static const yytype_int16 yypact[] = { - 203, -386, -386, 23, -386, -386, 67, -50, -386, 20, - 16, -386, 21, 37, 48, -386, -19, -19, -19, -19, - -19, -19, 58, 131, -19, -19, -386, -386, 53, -386, - -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, - -386, 64, -386, -386, -386, -386, -386, 229, -386, -386, - -386, -386, 77, 81, 89, 78, 95, -386, 75, 130, - -386, 119, 139, 140, 142, 146, -386, 147, 136, -386, - -386, -386, -14, 148, 149, -386, -386, 159, -386, -386, - 152, 162, -20, 239, -6, -386, 31, -386, -386, -386, - -386, 153, -386, 131, -386, -386, -386, -386, -386, 131, - 131, 131, 131, 131, 131, -386, -386, -386, -386, 28, - 50, 123, 40, 154, 30, 131, 101, 155, -386, -386, - -386, -386, -386, -386, -386, -386, -386, 30, 131, 156, - 77, 167, -386, -386, -386, 158, -386, -386, -386, -386, - -386, -386, -386, 218, -386, -386, 13, 244, -386, 160, - 163, -10, 164, -386, 165, -386, -386, 73, -386, -386, - 153, -386, 166, 168, 169, 210, 42, 170, 91, 171, - 100, 145, 38, 173, 153, -386, -386, -386, -386, -386, - -386, -386, -386, -386, -386, 209, -386, 73, -386, 174, - -386, -386, 153, 175, 176, -386, 101, 57, -386, -386, - -386, -386, -16, 179, 180, 225, 152, -386, 177, -386, - -386, -386, -386, -386, -386, 181, 131, 131, 30, -386, - 190, 191, 212, 131, -386, -386, -386, -386, 273, 274, - 275, -386, -386, -386, -386, 276, -386, -386, -386, -386, - 233, 276, 115, 192, 278, -386, 193, -386, 153, 9, - -386, -386, -386, 281, 277, 25, 195, -386, 284, -386, - 285, 284, -386, 200, 131, -386, -386, 199, -386, -386, - 208, 131, 131, -386, 197, -386, -386, -386, -386, 206, - -386, -386, 207, 205, 211, -386, 213, -386, 214, -386, - 215, -386, 216, -386, 217, -386, -386, -386, -386, -386, - -386, -386, 293, -386, -386, -386, 295, -386, -386, -386, - -386, -386, -386, -386, 219, -386, -386, -386, -386, 157, - 297, -386, 220, -386, 221, 222, -386, 66, -386, -386, - 133, -386, 226, -12, 230, 49, -386, 298, -386, 125, - 131, -386, -386, 265, 118, 100, -386, 228, -386, 232, - -386, -386, -386, -386, -386, -386, -386, 234, -386, -386, - -386, 131, -386, 300, 306, -386, 131, -386, -386, -386, - 131, 129, 123, 69, -386, -386, -386, -386, -386, -386, - -386, -386, 235, -386, -386, -386, -386, -386, -386, -386, - -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, - -386, 308, -386, -386, 41, -386, -386, -386, 86, -386, - -386, -386, -386, 240, 241, 231, 237, -386, 286, 49, - -386, -386, -386, -386, -386, -386, 131, -386, 131, 212, - 273, 274, 243, -386, -386, 238, 242, 247, 245, 246, - 248, 252, 297, -386, 131, 125, -386, 273, -386, 274, - 45, -386, -386, -386, -386, 297, 250, -386 + 122, -401, -401, 49, -401, -401, 56, 61, -401, 20, + -401, -401, -5, -401, 7, 45, 78, -401, -47, -47, + -47, -47, -47, -47, 79, 85, -47, -47, -401, 99, + -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, + -401, -401, 127, -401, -401, -401, -401, -401, 120, -401, + -401, -401, -401, -401, 135, 133, 134, 25, 129, -401, + 138, 137, -401, 145, 146, 147, 148, 151, -401, 152, + 154, -401, -401, -401, -14, 153, 155, -401, -401, 143, + -401, -401, 156, 163, 14, 243, 32, -401, 31, -401, + -401, -401, -401, 157, -401, 85, -401, -401, -401, -401, + -401, 85, 85, 85, 85, 85, 85, -401, -401, -401, + -401, 112, 149, 126, 54, 158, 27, 85, 132, 159, + -401, -401, -401, -401, -401, -401, -401, -401, -401, 27, + 85, 160, 135, 168, -401, -401, -401, 161, -401, -401, + -401, -401, -401, -401, -401, 198, -401, -401, 89, 248, + -401, 167, 169, 22, 170, -401, 171, -401, -401, 117, + -401, -401, 157, -401, 172, 173, 174, 208, -1, 175, + 53, 176, 165, 142, -3, 177, 157, -401, -401, -401, + -401, -401, -401, -401, -401, -401, -401, 215, -401, 117, + -401, 179, -401, -401, 157, 180, 181, -401, 132, -38, + -401, -401, -401, -401, -10, 184, 185, 209, 156, -401, + 182, -401, -401, -401, -401, -401, -401, 183, 85, 85, + 27, -401, 192, 194, 216, 85, -401, -401, -401, -401, + 277, 278, 279, -401, -401, -401, -401, 280, -401, -401, + -401, -401, 237, 280, 68, 195, 282, -401, 196, -401, + 157, 33, -401, -401, -401, 285, 281, 19, 200, -401, + 286, -401, 289, 286, -401, 203, 85, -401, -401, 202, + -401, -401, 212, 85, 85, -401, 201, -401, -401, -401, + -401, 210, -401, -401, 207, 213, 214, -401, 218, -401, + 219, -401, 220, -401, 221, -401, 222, -401, -401, -401, + -401, -401, -401, -401, 296, -401, -401, -401, 298, -401, + -401, -401, -401, -401, -401, -401, 226, -401, -401, -401, + -401, 166, 301, -401, 227, -401, 228, 229, -401, 46, + -401, -401, 116, -401, 217, -12, 234, 51, -401, 302, + -401, 125, 85, -401, -401, 270, 37, 165, -401, 233, + -401, 235, -401, -401, -401, -401, -401, -401, -401, 236, + -401, -401, -401, 85, -401, 305, 323, -401, 85, -401, + -401, -401, 85, 162, 126, 59, -401, -401, -401, -401, + -401, -401, -401, -401, 238, -401, -401, -401, -401, -401, + -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, + -401, -401, -401, 317, -401, -401, 41, -401, -401, -401, + 65, -401, -401, -401, -401, 242, 244, 241, 245, -401, + 288, 51, -401, -401, -401, -401, -401, -401, 85, -401, + 85, 216, 277, 278, 246, -401, -401, 247, 249, 250, + 251, 255, 253, 256, 301, -401, 85, 125, -401, 277, + -401, 278, 94, -401, -401, -401, -401, 301, 254, -401 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, - -386, -386, -386, -386, -386, -386, -386, -386, -386, -71, - -80, -386, -96, 144, -81, 204, -386, -386, -350, -386, - -17, -386, -386, -386, -386, -386, -386, -386, -386, 161, - -386, -386, -386, 172, -386, -386, -386, 282, -386, -386, - -386, 105, -386, -386, -386, -386, -386, -386, -386, -386, - -386, -386, -52, -386, -83, -386, -386, -386, -386, -386, - -386, -386, -386, -386, -386, -386, -300, 128, -386, -386, - -386, -386, -386, -386, -386, -386, -386, -386, -386, -386, - -2, -386, -386, -327, -386, -386, -386, -386, -386, -386, - 287, -386, -386, -386, -386, -386, -386, -386, -385, -318, - 288, -386, -386, -145, -82, -112, -84, -386, -386, -386, - -386, -386, 249, -386, 178, -386, -386, -386, -166, 186, - -131, -386, -386, -386, -386, -386, -386 + -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, + -401, -401, -401, -401, -401, -401, -401, -401, -401, -76, + -80, -401, -98, 150, -83, 205, -401, -401, -361, -401, + -18, -401, -401, -401, -401, -401, -401, -401, -401, 164, + -401, -401, -401, 178, -401, -401, -401, 287, -401, -401, + -401, 106, -401, -401, -401, -401, -401, -401, -401, -401, + -401, -401, -49, -401, -85, -401, -401, -401, -401, -401, + -401, -401, -401, -401, -401, -401, -330, 130, -401, -401, + -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, + 0, -401, -401, -400, -401, -401, -401, -401, -401, -401, + 291, -401, -401, -401, -401, -401, -401, -401, -302, -317, + 292, -401, -401, -139, -84, -113, -86, -401, -401, -401, + -401, -401, 252, -401, 186, -401, -401, -401, -166, 190, + -133, -401, -401, -401, -401, -401, -401, -6 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If @@ -1114,140 +1115,142 @@ static const yytype_int16 yypgoto[] = #define YYTABLE_NINF -222 static const yytype_int16 yytable[] = { - 143, 137, 141, 197, 242, 153, 221, 266, 156, 107, - 108, 367, 149, 107, 108, 151, 413, 151, 109, 152, - 151, 154, 155, 5, 109, 11, 12, 13, 109, 227, - 14, 143, 15, 16, 17, 18, 19, 20, 21, 22, - 23, 24, 25, 255, 403, 439, 56, 204, 110, 10, - 308, 309, 110, 107, 108, 116, 110, 157, 144, 111, - 317, 259, 453, 111, 250, 158, 295, 111, 109, 187, - 145, 232, 296, 221, 211, 7, 112, 188, 436, 318, - 57, 212, 112, 66, 162, 113, 112, 368, 159, 113, - 189, 310, 110, 190, 451, 114, 163, 196, 233, 218, - 191, 115, 160, 111, 425, 115, 69, 70, 251, 115, - 203, 371, 299, 441, 192, 450, 236, 307, 237, 26, - 53, 278, 372, 51, 86, 87, 112, 237, 456, 113, - 238, 454, 88, 151, 224, 277, 54, 193, 194, 238, - 295, 225, 284, 295, 398, 115, 296, 55, 297, 296, - 455, 164, 327, 165, 89, 90, 407, 66, 399, 166, - 75, 69, 70, 415, 115, 264, 167, 168, 169, 91, - 170, 76, 171, 265, 361, 416, 79, 419, 400, 404, - 143, 172, 362, 93, 298, 420, 299, 333, 83, 299, - 401, 334, 84, 243, 426, 81, 244, 245, 173, 174, - 246, 198, 427, 82, 199, 200, 1, 2, 247, 383, - 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, - 394, 61, 62, 63, 64, 65, 248, 99, 73, 74, - 94, 95, 96, 97, 351, 352, 353, 354, 77, 105, - 78, 209, 210, 69, 70, 363, 364, 100, 101, 408, - 102, 143, 376, 141, 103, 104, 127, 128, 129, 396, - 131, 132, 134, 147, -65, 202, 207, 214, 216, 208, - 205, 217, 222, 223, 231, 256, 228, 143, 229, 230, - 235, 241, 333, 253, 258, 260, 261, 271, 272, 414, - 56, 274, 276, 280, -221, 282, 285, 287, 289, 291, - 293, 303, 302, 306, 313, 320, 315, 321, 323, 326, - 328, 329, 335, 339, 435, 336, 346, 337, 348, 340, - 356, 381, 397, 409, 341, 342, 343, 344, 345, 411, - 350, 358, 359, 360, 366, 143, 376, 141, 370, 405, - 422, 430, 143, 406, 333, 407, 421, 431, 428, 429, - 444, 447, 432, 442, 443, 445, 446, 449, 437, 448, - 333, 457, 279, 270, 133, 452, 325, 434, 263, 294, - 418, 138, 139, 257, 0, 0, 0, 0, 0, 206, - 0, 0, 0, 273 + 145, 139, 143, 52, 199, 155, 244, 415, 158, 109, + 110, 369, 151, 268, 223, 153, 405, 153, 58, 154, + 153, 156, 157, 252, 111, 13, 14, 15, 234, 229, + 16, 145, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 257, 452, 109, 110, 206, 112, 5, + 109, 110, 111, 59, 319, 235, 118, 458, 146, 113, + 111, 261, 297, 400, 7, 111, 297, 253, 298, 438, + 147, 266, 298, 320, 310, 311, 427, 401, 238, 267, + 239, 223, 114, 189, 112, 453, 115, 10, 11, 112, + 68, 190, 240, 297, 112, 113, 116, 402, 198, 298, + 113, 299, 117, 53, 191, 113, 55, 192, 301, 403, + 114, 205, 301, 373, 193, 312, 443, 309, 114, 10, + 11, 280, 115, 114, 374, 1, 2, 115, 194, 79, + 441, 80, 220, 153, 456, 279, 85, 300, 117, 301, + 86, 159, 286, 117, 56, 71, 72, 455, 117, 160, + 213, 195, 196, 329, 166, 363, 167, 214, 88, 89, + 10, 11, 168, 364, 71, 72, 90, 117, 421, 169, + 170, 171, 161, 172, 428, 173, 422, 57, 226, 68, + 145, 406, 429, 164, 174, 227, 162, 335, 91, 92, + 245, 336, 239, 246, 247, 165, 417, 248, 71, 72, + 457, 175, 176, 93, 240, 249, 409, 77, 418, 385, + 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, + 396, 211, 212, 250, 63, 64, 65, 66, 67, 365, + 366, 75, 76, 200, 81, 78, 201, 202, 96, 97, + 98, 99, 131, 353, 354, 355, 356, 95, 83, 84, + 410, 145, 378, 143, 101, 102, 103, 104, 107, 398, + 105, 106, 129, 134, 130, 133, 136, 209, 149, -65, + 204, 216, 233, 210, 58, 207, 218, 145, 219, 224, + 225, 258, 335, 230, 231, 232, 237, 243, 255, 416, + 260, 262, 263, 273, 274, 278, 282, 276, -221, 284, + 287, 289, 291, 293, 295, 305, 304, 308, 315, 323, + 317, 322, 325, 328, 330, 437, 331, 337, 339, 348, + 338, 350, 341, 342, 358, 383, 368, 399, 411, 371, + 343, 344, 345, 346, 347, 145, 378, 143, 352, 360, + 361, 362, 145, 372, 335, 407, 413, 408, 409, 424, + 423, 430, 432, 431, 434, 439, 433, 444, 446, 447, + 335, 449, 451, 448, 445, 450, 459, 454, 272, 327, + 281, 135, 436, 296, 420, 0, 265, 140, 141, 259, + 0, 0, 0, 0, 208, 0, 0, 0, 0, 0, + 0, 0, 0, 275 }; static const yytype_int16 yycheck[] = { - 84, 84, 84, 115, 170, 101, 151, 23, 104, 23, - 24, 23, 93, 23, 24, 99, 366, 101, 38, 100, - 104, 102, 103, 0, 38, 5, 6, 7, 38, 160, - 10, 115, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 174, 344, 430, 65, 128, 62, 99, - 41, 42, 62, 23, 24, 72, 62, 29, 27, 73, - 35, 192, 447, 73, 26, 37, 25, 73, 38, 29, - 39, 29, 31, 218, 61, 8, 96, 37, 428, 54, - 99, 68, 96, 99, 34, 99, 96, 99, 60, 99, - 50, 82, 62, 53, 444, 109, 46, 114, 56, 109, - 60, 115, 74, 73, 404, 115, 112, 113, 70, 115, - 127, 62, 71, 431, 74, 442, 25, 248, 27, 99, - 99, 217, 73, 107, 29, 30, 96, 27, 455, 99, - 39, 449, 37, 217, 61, 216, 99, 97, 98, 39, - 25, 68, 223, 25, 26, 115, 31, 99, 33, 31, - 105, 28, 264, 30, 59, 60, 111, 99, 40, 36, - 107, 112, 113, 34, 115, 108, 43, 44, 45, 74, - 47, 107, 49, 116, 108, 46, 99, 108, 60, 345, - 264, 58, 116, 108, 69, 116, 71, 271, 110, 71, - 72, 272, 114, 48, 108, 114, 51, 52, 75, 76, - 55, 100, 116, 114, 103, 104, 3, 4, 63, 84, + 86, 86, 86, 9, 117, 103, 172, 368, 106, 23, + 24, 23, 95, 23, 153, 101, 346, 103, 65, 102, + 106, 104, 105, 26, 38, 5, 6, 7, 29, 162, + 10, 117, 12, 13, 14, 15, 16, 17, 18, 19, + 20, 21, 22, 176, 444, 23, 24, 130, 62, 0, + 23, 24, 38, 100, 35, 56, 74, 457, 27, 73, + 38, 194, 25, 26, 8, 38, 25, 70, 31, 430, + 39, 109, 31, 54, 41, 42, 406, 40, 25, 117, + 27, 220, 96, 29, 62, 446, 100, 99, 100, 62, + 100, 37, 39, 25, 62, 73, 110, 60, 116, 31, + 73, 33, 116, 108, 50, 73, 99, 53, 71, 72, + 96, 129, 71, 62, 60, 82, 433, 250, 96, 99, + 100, 219, 100, 96, 73, 3, 4, 100, 74, 9, + 432, 11, 110, 219, 451, 218, 111, 69, 116, 71, + 115, 29, 225, 116, 99, 113, 114, 449, 116, 37, + 61, 97, 98, 266, 28, 109, 30, 68, 29, 30, + 99, 100, 36, 117, 113, 114, 37, 116, 109, 43, + 44, 45, 60, 47, 109, 49, 117, 99, 61, 100, + 266, 347, 117, 34, 58, 68, 74, 273, 59, 60, + 48, 274, 27, 51, 52, 46, 34, 55, 113, 114, + 106, 75, 76, 74, 39, 63, 112, 108, 46, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 17, 18, 19, 20, 21, 81, 108, 24, 25, - 100, 101, 102, 103, 77, 78, 79, 80, 9, 103, - 11, 23, 24, 112, 113, 112, 113, 108, 108, 361, - 108, 335, 335, 335, 108, 108, 108, 108, 99, 340, - 108, 99, 23, 110, 110, 110, 99, 23, 108, 111, - 114, 108, 108, 108, 64, 66, 110, 361, 110, 110, - 110, 110, 366, 110, 110, 110, 110, 108, 108, 370, - 65, 114, 111, 103, 103, 83, 23, 23, 23, 23, - 67, 23, 110, 110, 23, 110, 29, 23, 23, 109, - 111, 103, 115, 108, 426, 109, 23, 110, 23, 108, - 23, 23, 57, 23, 111, 111, 111, 111, 111, 23, - 111, 111, 111, 111, 108, 419, 419, 419, 108, 111, - 32, 110, 426, 111, 428, 111, 111, 110, 108, 108, - 108, 105, 66, 110, 116, 108, 111, 105, 429, 111, - 444, 111, 218, 202, 82, 445, 261, 419, 196, 241, - 372, 84, 84, 187, -1, -1, -1, -1, -1, 130, - -1, -1, -1, 205 + 95, 23, 24, 81, 19, 20, 21, 22, 23, 113, + 114, 26, 27, 101, 99, 108, 104, 105, 101, 102, + 103, 104, 99, 77, 78, 79, 80, 109, 115, 115, + 363, 337, 337, 337, 109, 109, 109, 109, 104, 342, + 109, 109, 109, 100, 109, 109, 23, 99, 111, 111, + 111, 23, 64, 112, 65, 115, 109, 363, 109, 109, + 109, 66, 368, 111, 111, 111, 111, 111, 111, 372, + 111, 111, 111, 109, 109, 112, 104, 115, 104, 83, + 23, 23, 23, 23, 67, 23, 111, 111, 23, 23, + 29, 111, 23, 110, 112, 428, 104, 116, 111, 23, + 110, 23, 109, 109, 23, 23, 109, 57, 23, 335, + 112, 112, 112, 112, 112, 421, 421, 421, 112, 112, + 112, 112, 428, 109, 430, 112, 23, 112, 112, 32, + 112, 109, 111, 109, 66, 431, 111, 111, 109, 109, + 446, 106, 106, 112, 117, 112, 112, 447, 204, 263, + 220, 84, 421, 243, 374, -1, 198, 86, 86, 189, + -1, -1, -1, -1, 132, -1, -1, -1, -1, -1, + -1, -1, -1, 207 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { - 0, 3, 4, 118, 119, 0, 120, 8, 121, 122, - 99, 5, 6, 7, 10, 12, 13, 14, 15, 16, - 17, 18, 19, 20, 21, 22, 99, 123, 124, 125, + 0, 3, 4, 119, 120, 0, 121, 8, 122, 123, + 99, 100, 255, 5, 6, 7, 10, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 138, 162, 163, 170, 171, 172, 234, 236, 237, 240, - 253, 107, 238, 99, 99, 99, 65, 99, 142, 148, - 241, 142, 142, 142, 142, 142, 99, 143, 156, 112, - 113, 141, 233, 142, 142, 107, 107, 9, 11, 99, - 239, 114, 114, 110, 114, 174, 29, 30, 37, 59, - 60, 74, 242, 108, 100, 101, 102, 103, 161, 108, - 108, 108, 108, 108, 108, 103, 158, 23, 24, 38, - 62, 73, 96, 99, 109, 115, 147, 149, 164, 178, - 181, 217, 221, 224, 228, 230, 231, 108, 108, 99, - 235, 108, 99, 164, 23, 173, 177, 181, 217, 227, - 229, 231, 232, 233, 27, 39, 243, 110, 247, 141, - 139, 233, 141, 139, 141, 141, 139, 29, 37, 60, - 74, 169, 34, 46, 28, 30, 36, 43, 44, 45, - 47, 49, 58, 75, 76, 182, 184, 187, 189, 191, - 195, 198, 200, 202, 204, 207, 216, 29, 37, 50, - 53, 60, 74, 97, 98, 165, 147, 232, 100, 103, - 104, 160, 110, 147, 141, 114, 239, 99, 111, 23, - 24, 61, 68, 244, 23, 250, 108, 108, 109, 140, - 147, 230, 108, 108, 61, 68, 246, 247, 110, 110, - 110, 64, 29, 56, 199, 110, 25, 27, 39, 188, - 245, 110, 245, 48, 51, 52, 55, 63, 81, 211, - 26, 70, 203, 110, 249, 247, 66, 246, 110, 247, - 110, 110, 167, 160, 108, 116, 23, 150, 151, 152, - 156, 108, 108, 241, 114, 175, 111, 141, 139, 140, - 103, 159, 83, 136, 141, 23, 225, 23, 226, 23, - 201, 23, 194, 67, 194, 25, 31, 33, 69, 71, - 183, 193, 110, 23, 212, 213, 110, 247, 41, 42, - 82, 208, 209, 23, 252, 29, 192, 35, 54, 196, - 110, 23, 168, 23, 166, 168, 109, 232, 111, 103, - 157, 144, 145, 233, 141, 115, 109, 110, 248, 108, - 108, 111, 111, 111, 111, 111, 23, 215, 23, 214, - 111, 77, 78, 79, 80, 197, 23, 210, 111, 111, - 111, 108, 116, 112, 113, 153, 108, 23, 99, 146, - 108, 62, 73, 176, 179, 180, 181, 218, 219, 222, - 227, 23, 251, 84, 85, 86, 87, 88, 89, 90, - 91, 92, 93, 94, 95, 137, 141, 57, 26, 40, - 60, 72, 185, 193, 245, 111, 111, 111, 232, 23, - 154, 23, 155, 145, 141, 34, 46, 205, 207, 108, - 116, 111, 32, 186, 190, 193, 108, 116, 108, 108, - 110, 110, 66, 206, 179, 232, 145, 136, 220, 225, - 223, 226, 110, 116, 108, 108, 111, 105, 111, 105, - 210, 145, 137, 225, 226, 105, 210, 111 + 136, 139, 163, 164, 171, 172, 173, 235, 237, 238, + 241, 254, 255, 108, 239, 99, 99, 99, 65, 100, + 143, 149, 242, 143, 143, 143, 143, 143, 100, 144, + 157, 113, 114, 142, 234, 143, 143, 108, 108, 9, + 11, 99, 240, 115, 115, 111, 115, 175, 29, 30, + 37, 59, 60, 74, 243, 109, 101, 102, 103, 104, + 162, 109, 109, 109, 109, 109, 109, 104, 159, 23, + 24, 38, 62, 73, 96, 100, 110, 116, 148, 150, + 165, 179, 182, 218, 222, 225, 229, 231, 232, 109, + 109, 99, 236, 109, 100, 165, 23, 174, 178, 182, + 218, 228, 230, 232, 233, 234, 27, 39, 244, 111, + 248, 142, 140, 234, 142, 140, 142, 142, 140, 29, + 37, 60, 74, 170, 34, 46, 28, 30, 36, 43, + 44, 45, 47, 49, 58, 75, 76, 183, 185, 188, + 190, 192, 196, 199, 201, 203, 205, 208, 217, 29, + 37, 50, 53, 60, 74, 97, 98, 166, 148, 233, + 101, 104, 105, 161, 111, 148, 142, 115, 240, 99, + 112, 23, 24, 61, 68, 245, 23, 251, 109, 109, + 110, 141, 148, 231, 109, 109, 61, 68, 247, 248, + 111, 111, 111, 64, 29, 56, 200, 111, 25, 27, + 39, 189, 246, 111, 246, 48, 51, 52, 55, 63, + 81, 212, 26, 70, 204, 111, 250, 248, 66, 247, + 111, 248, 111, 111, 168, 161, 109, 117, 23, 151, + 152, 153, 157, 109, 109, 242, 115, 176, 112, 142, + 140, 141, 104, 160, 83, 137, 142, 23, 226, 23, + 227, 23, 202, 23, 195, 67, 195, 25, 31, 33, + 69, 71, 184, 194, 111, 23, 213, 214, 111, 248, + 41, 42, 82, 209, 210, 23, 253, 29, 193, 35, + 54, 197, 111, 23, 169, 23, 167, 169, 110, 233, + 112, 104, 158, 145, 146, 234, 142, 116, 110, 111, + 249, 109, 109, 112, 112, 112, 112, 112, 23, 216, + 23, 215, 112, 77, 78, 79, 80, 198, 23, 211, + 112, 112, 112, 109, 117, 113, 114, 154, 109, 23, + 147, 255, 109, 62, 73, 177, 180, 181, 182, 219, + 220, 223, 228, 23, 252, 84, 85, 86, 87, 88, + 89, 90, 91, 92, 93, 94, 95, 138, 142, 57, + 26, 40, 60, 72, 186, 194, 246, 112, 112, 112, + 233, 23, 155, 23, 156, 146, 142, 34, 46, 206, + 208, 109, 117, 112, 32, 187, 191, 194, 109, 117, + 109, 109, 111, 111, 66, 207, 180, 233, 146, 137, + 221, 226, 224, 227, 111, 117, 109, 109, 112, 106, + 112, 106, 211, 146, 138, 226, 227, 106, 211, 112 }; #define yyerrok (yyerrstatus = 0) @@ -2101,7 +2104,7 @@ yyreduce: case 3: /* Line 1455 of yacc.c */ -#line 269 "program_parse.y" +#line 270 "program_parse.y" { if (state->prog->Target != GL_VERTEX_PROGRAM_ARB) { yyerror(& (yylsp[(1) - (1)]), state, "invalid fragment program header"); @@ -2114,7 +2117,7 @@ yyreduce: case 4: /* Line 1455 of yacc.c */ -#line 277 "program_parse.y" +#line 278 "program_parse.y" { if (state->prog->Target != GL_FRAGMENT_PROGRAM_ARB) { yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex program header"); @@ -2129,7 +2132,7 @@ yyreduce: case 7: /* Line 1455 of yacc.c */ -#line 293 "program_parse.y" +#line 294 "program_parse.y" { int valid = 0; @@ -2154,7 +2157,7 @@ yyreduce: case 10: /* Line 1455 of yacc.c */ -#line 319 "program_parse.y" +#line 320 "program_parse.y" { if ((yyvsp[(1) - (2)].inst) != NULL) { if (state->inst_tail == NULL) { @@ -2174,7 +2177,7 @@ yyreduce: case 12: /* Line 1455 of yacc.c */ -#line 337 "program_parse.y" +#line 338 "program_parse.y" { (yyval.inst) = (yyvsp[(1) - (1)].inst); state->prog->NumAluInstructions++; @@ -2184,7 +2187,7 @@ yyreduce: case 13: /* Line 1455 of yacc.c */ -#line 342 "program_parse.y" +#line 343 "program_parse.y" { (yyval.inst) = (yyvsp[(1) - (1)].inst); state->prog->NumTexInstructions++; @@ -2194,7 +2197,7 @@ yyreduce: case 24: /* Line 1455 of yacc.c */ -#line 363 "program_parse.y" +#line 364 "program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_ARL, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); ;} @@ -2203,7 +2206,7 @@ yyreduce: case 25: /* Line 1455 of yacc.c */ -#line 369 "program_parse.y" +#line 370 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); ;} @@ -2212,7 +2215,7 @@ yyreduce: case 26: /* Line 1455 of yacc.c */ -#line 375 "program_parse.y" +#line 376 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); ;} @@ -2221,7 +2224,7 @@ yyreduce: case 27: /* Line 1455 of yacc.c */ -#line 381 "program_parse.y" +#line 382 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL); ;} @@ -2230,7 +2233,7 @@ yyreduce: case 28: /* Line 1455 of yacc.c */ -#line 388 "program_parse.y" +#line 389 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL); ;} @@ -2239,7 +2242,7 @@ yyreduce: case 29: /* Line 1455 of yacc.c */ -#line 395 "program_parse.y" +#line 396 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (8)].temp_inst), & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), & (yyvsp[(6) - (8)].src_reg), & (yyvsp[(8) - (8)].src_reg)); ;} @@ -2248,7 +2251,7 @@ yyreduce: case 30: /* Line 1455 of yacc.c */ -#line 401 "program_parse.y" +#line 402 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (8)].temp_inst), & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), NULL, NULL); if ((yyval.inst) != NULL) { @@ -2295,7 +2298,7 @@ yyreduce: case 31: /* Line 1455 of yacc.c */ -#line 445 "program_parse.y" +#line 446 "program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_KIL, NULL, & (yyvsp[(2) - (2)].src_reg), NULL, NULL); state->fragment.UsesKill = 1; @@ -2305,7 +2308,7 @@ yyreduce: case 32: /* Line 1455 of yacc.c */ -#line 452 "program_parse.y" +#line 453 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (12)].temp_inst), & (yyvsp[(2) - (12)].dst_reg), & (yyvsp[(4) - (12)].src_reg), & (yyvsp[(6) - (12)].src_reg), & (yyvsp[(8) - (12)].src_reg)); if ((yyval.inst) != NULL) { @@ -2352,7 +2355,7 @@ yyreduce: case 33: /* Line 1455 of yacc.c */ -#line 496 "program_parse.y" +#line 497 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} @@ -2361,91 +2364,91 @@ yyreduce: case 34: /* Line 1455 of yacc.c */ -#line 501 "program_parse.y" +#line 502 "program_parse.y" { (yyval.integer) = TEXTURE_1D_INDEX; ;} break; case 35: /* Line 1455 of yacc.c */ -#line 502 "program_parse.y" +#line 503 "program_parse.y" { (yyval.integer) = TEXTURE_2D_INDEX; ;} break; case 36: /* Line 1455 of yacc.c */ -#line 503 "program_parse.y" +#line 504 "program_parse.y" { (yyval.integer) = TEXTURE_3D_INDEX; ;} break; case 37: /* Line 1455 of yacc.c */ -#line 504 "program_parse.y" +#line 505 "program_parse.y" { (yyval.integer) = TEXTURE_CUBE_INDEX; ;} break; case 38: /* Line 1455 of yacc.c */ -#line 505 "program_parse.y" +#line 506 "program_parse.y" { (yyval.integer) = TEXTURE_RECT_INDEX; ;} break; case 39: /* Line 1455 of yacc.c */ -#line 506 "program_parse.y" +#line 507 "program_parse.y" { (yyval.integer) = -TEXTURE_1D_INDEX; ;} break; case 40: /* Line 1455 of yacc.c */ -#line 507 "program_parse.y" +#line 508 "program_parse.y" { (yyval.integer) = -TEXTURE_2D_INDEX; ;} break; case 41: /* Line 1455 of yacc.c */ -#line 508 "program_parse.y" +#line 509 "program_parse.y" { (yyval.integer) = -TEXTURE_RECT_INDEX; ;} break; case 42: /* Line 1455 of yacc.c */ -#line 509 "program_parse.y" +#line 510 "program_parse.y" { (yyval.integer) = TEXTURE_1D_ARRAY_INDEX; ;} break; case 43: /* Line 1455 of yacc.c */ -#line 510 "program_parse.y" +#line 511 "program_parse.y" { (yyval.integer) = TEXTURE_2D_ARRAY_INDEX; ;} break; case 44: /* Line 1455 of yacc.c */ -#line 511 "program_parse.y" +#line 512 "program_parse.y" { (yyval.integer) = -TEXTURE_1D_ARRAY_INDEX; ;} break; case 45: /* Line 1455 of yacc.c */ -#line 512 "program_parse.y" +#line 513 "program_parse.y" { (yyval.integer) = -TEXTURE_2D_ARRAY_INDEX; ;} break; case 46: /* Line 1455 of yacc.c */ -#line 516 "program_parse.y" +#line 517 "program_parse.y" { /* FIXME: Is this correct? Should the extenedSwizzle be applied * FIXME: to the existing swizzle? @@ -2460,7 +2463,7 @@ yyreduce: case 47: /* Line 1455 of yacc.c */ -#line 528 "program_parse.y" +#line 529 "program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (2)].src_reg); @@ -2473,7 +2476,7 @@ yyreduce: case 48: /* Line 1455 of yacc.c */ -#line 536 "program_parse.y" +#line 537 "program_parse.y" { (yyval.src_reg) = (yyvsp[(3) - (4)].src_reg); @@ -2493,7 +2496,7 @@ yyreduce: case 49: /* Line 1455 of yacc.c */ -#line 553 "program_parse.y" +#line 554 "program_parse.y" { (yyval.src_reg) = (yyvsp[(1) - (2)].src_reg); @@ -2505,7 +2508,7 @@ yyreduce: case 50: /* Line 1455 of yacc.c */ -#line 560 "program_parse.y" +#line 561 "program_parse.y" { struct asm_symbol temp_sym; @@ -2527,7 +2530,7 @@ yyreduce: case 51: /* Line 1455 of yacc.c */ -#line 579 "program_parse.y" +#line 580 "program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (3)].src_reg); @@ -2543,7 +2546,7 @@ yyreduce: case 52: /* Line 1455 of yacc.c */ -#line 590 "program_parse.y" +#line 591 "program_parse.y" { (yyval.src_reg) = (yyvsp[(3) - (5)].src_reg); @@ -2565,7 +2568,7 @@ yyreduce: case 53: /* Line 1455 of yacc.c */ -#line 610 "program_parse.y" +#line 611 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); (yyval.dst_reg).WriteMask = (yyvsp[(2) - (2)].swiz_mask).mask; @@ -2590,7 +2593,7 @@ yyreduce: case 54: /* Line 1455 of yacc.c */ -#line 632 "program_parse.y" +#line 633 "program_parse.y" { init_dst_reg(& (yyval.dst_reg)); (yyval.dst_reg).File = PROGRAM_ADDRESS; @@ -2602,7 +2605,7 @@ yyreduce: case 55: /* Line 1455 of yacc.c */ -#line 641 "program_parse.y" +#line 642 "program_parse.y" { const unsigned xyzw_valid = ((yyvsp[(1) - (7)].ext_swizzle).xyzw_valid << 0) @@ -2638,7 +2641,7 @@ yyreduce: case 56: /* Line 1455 of yacc.c */ -#line 674 "program_parse.y" +#line 675 "program_parse.y" { (yyval.ext_swizzle) = (yyvsp[(2) - (2)].ext_swizzle); (yyval.ext_swizzle).negate = ((yyvsp[(1) - (2)].negate)) ? 1 : 0; @@ -2648,7 +2651,7 @@ yyreduce: case 57: /* Line 1455 of yacc.c */ -#line 681 "program_parse.y" +#line 682 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) != 0) && ((yyvsp[(1) - (1)].integer) != 1)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector"); @@ -2668,7 +2671,7 @@ yyreduce: case 58: /* Line 1455 of yacc.c */ -#line 696 "program_parse.y" +#line 697 "program_parse.y" { if (strlen((yyvsp[(1) - (1)].string)) > 1) { yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector"); @@ -2721,7 +2724,7 @@ yyreduce: case 59: /* Line 1455 of yacc.c */ -#line 746 "program_parse.y" +#line 747 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2768,7 +2771,7 @@ yyreduce: case 60: /* Line 1455 of yacc.c */ -#line 788 "program_parse.y" +#line 789 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.File = PROGRAM_INPUT; @@ -2784,7 +2787,7 @@ yyreduce: case 61: /* Line 1455 of yacc.c */ -#line 799 "program_parse.y" +#line 800 "program_parse.y" { if (! (yyvsp[(3) - (4)].src_reg).Base.RelAddr && ((unsigned) (yyvsp[(3) - (4)].src_reg).Base.Index >= (yyvsp[(1) - (4)].sym)->param_binding_length)) { @@ -2810,7 +2813,7 @@ yyreduce: case 62: /* Line 1455 of yacc.c */ -#line 820 "program_parse.y" +#line 821 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.File = ((yyvsp[(1) - (1)].temp_sym).name != NULL) @@ -2823,7 +2826,7 @@ yyreduce: case 63: /* Line 1455 of yacc.c */ -#line 830 "program_parse.y" +#line 831 "program_parse.y" { init_dst_reg(& (yyval.dst_reg)); (yyval.dst_reg).File = PROGRAM_OUTPUT; @@ -2834,7 +2837,7 @@ yyreduce: case 64: /* Line 1455 of yacc.c */ -#line 836 "program_parse.y" +#line 837 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2868,7 +2871,7 @@ yyreduce: case 65: /* Line 1455 of yacc.c */ -#line 867 "program_parse.y" +#line 868 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2888,7 +2891,7 @@ yyreduce: case 68: /* Line 1455 of yacc.c */ -#line 886 "program_parse.y" +#line 887 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].integer); @@ -2898,7 +2901,7 @@ yyreduce: case 69: /* Line 1455 of yacc.c */ -#line 893 "program_parse.y" +#line 894 "program_parse.y" { /* FINISHME: Add support for multiple address registers. */ @@ -2913,28 +2916,28 @@ yyreduce: case 70: /* Line 1455 of yacc.c */ -#line 904 "program_parse.y" +#line 905 "program_parse.y" { (yyval.integer) = 0; ;} break; case 71: /* Line 1455 of yacc.c */ -#line 905 "program_parse.y" +#line 906 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; case 72: /* Line 1455 of yacc.c */ -#line 906 "program_parse.y" +#line 907 "program_parse.y" { (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;} break; case 73: /* Line 1455 of yacc.c */ -#line 910 "program_parse.y" +#line 911 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 63)) { yyerror(& (yylsp[(1) - (1)]), state, @@ -2949,7 +2952,7 @@ yyreduce: case 74: /* Line 1455 of yacc.c */ -#line 922 "program_parse.y" +#line 923 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 64)) { yyerror(& (yylsp[(1) - (1)]), state, @@ -2964,7 +2967,7 @@ yyreduce: case 75: /* Line 1455 of yacc.c */ -#line 934 "program_parse.y" +#line 935 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2985,7 +2988,7 @@ yyreduce: case 76: /* Line 1455 of yacc.c */ -#line 952 "program_parse.y" +#line 953 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, "invalid address component selector"); @@ -2999,7 +3002,7 @@ yyreduce: case 77: /* Line 1455 of yacc.c */ -#line 963 "program_parse.y" +#line 964 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, @@ -3014,21 +3017,21 @@ yyreduce: case 82: /* Line 1455 of yacc.c */ -#line 979 "program_parse.y" +#line 980 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; case 87: /* Line 1455 of yacc.c */ -#line 983 "program_parse.y" +#line 984 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; case 94: /* Line 1455 of yacc.c */ -#line 995 "program_parse.y" +#line 996 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (4)].string), at_attrib, & (yylsp[(2) - (4)])); @@ -3049,7 +3052,7 @@ yyreduce: case 95: /* Line 1455 of yacc.c */ -#line 1013 "program_parse.y" +#line 1014 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} @@ -3058,7 +3061,7 @@ yyreduce: case 96: /* Line 1455 of yacc.c */ -#line 1017 "program_parse.y" +#line 1018 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} @@ -3067,7 +3070,7 @@ yyreduce: case 97: /* Line 1455 of yacc.c */ -#line 1023 "program_parse.y" +#line 1024 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_POS; ;} @@ -3076,7 +3079,7 @@ yyreduce: case 98: /* Line 1455 of yacc.c */ -#line 1027 "program_parse.y" +#line 1028 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_WEIGHT; ;} @@ -3085,7 +3088,7 @@ yyreduce: case 99: /* Line 1455 of yacc.c */ -#line 1031 "program_parse.y" +#line 1032 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_NORMAL; ;} @@ -3094,7 +3097,7 @@ yyreduce: case 100: /* Line 1455 of yacc.c */ -#line 1035 "program_parse.y" +#line 1036 "program_parse.y" { if (!state->ctx->Extensions.EXT_secondary_color) { yyerror(& (yylsp[(2) - (2)]), state, "GL_EXT_secondary_color not supported"); @@ -3108,7 +3111,7 @@ yyreduce: case 101: /* Line 1455 of yacc.c */ -#line 1044 "program_parse.y" +#line 1045 "program_parse.y" { if (!state->ctx->Extensions.EXT_fog_coord) { yyerror(& (yylsp[(1) - (1)]), state, "GL_EXT_fog_coord not supported"); @@ -3122,7 +3125,7 @@ yyreduce: case 102: /* Line 1455 of yacc.c */ -#line 1053 "program_parse.y" +#line 1054 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} @@ -3131,7 +3134,7 @@ yyreduce: case 103: /* Line 1455 of yacc.c */ -#line 1057 "program_parse.y" +#line 1058 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; @@ -3141,7 +3144,7 @@ yyreduce: case 104: /* Line 1455 of yacc.c */ -#line 1062 "program_parse.y" +#line 1063 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_GENERIC0 + (yyvsp[(3) - (4)].integer); ;} @@ -3150,7 +3153,7 @@ yyreduce: case 105: /* Line 1455 of yacc.c */ -#line 1068 "program_parse.y" +#line 1069 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxAttribs) { yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex attribute reference"); @@ -3164,7 +3167,7 @@ yyreduce: case 109: /* Line 1455 of yacc.c */ -#line 1082 "program_parse.y" +#line 1083 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_WPOS; ;} @@ -3173,7 +3176,7 @@ yyreduce: case 110: /* Line 1455 of yacc.c */ -#line 1086 "program_parse.y" +#line 1087 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_COL0 + (yyvsp[(2) - (2)].integer); ;} @@ -3182,7 +3185,7 @@ yyreduce: case 111: /* Line 1455 of yacc.c */ -#line 1090 "program_parse.y" +#line 1091 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_FOGC; ;} @@ -3191,7 +3194,7 @@ yyreduce: case 112: /* Line 1455 of yacc.c */ -#line 1094 "program_parse.y" +#line 1095 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} @@ -3200,7 +3203,7 @@ yyreduce: case 115: /* Line 1455 of yacc.c */ -#line 1102 "program_parse.y" +#line 1103 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (3)].string), at_param, & (yylsp[(2) - (3)])); @@ -3219,7 +3222,7 @@ yyreduce: case 116: /* Line 1455 of yacc.c */ -#line 1118 "program_parse.y" +#line 1119 "program_parse.y" { if (((yyvsp[(4) - (6)].integer) != 0) && ((unsigned) (yyvsp[(4) - (6)].integer) != (yyvsp[(6) - (6)].temp_sym).param_binding_length)) { yyerror(& (yylsp[(4) - (6)]), state, @@ -3244,7 +3247,7 @@ yyreduce: case 117: /* Line 1455 of yacc.c */ -#line 1140 "program_parse.y" +#line 1141 "program_parse.y" { (yyval.integer) = 0; ;} @@ -3253,7 +3256,7 @@ yyreduce: case 118: /* Line 1455 of yacc.c */ -#line 1144 "program_parse.y" +#line 1145 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxParameters)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid parameter array size"); @@ -3267,7 +3270,7 @@ yyreduce: case 119: /* Line 1455 of yacc.c */ -#line 1155 "program_parse.y" +#line 1156 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(2) - (2)].temp_sym); ;} @@ -3276,7 +3279,7 @@ yyreduce: case 120: /* Line 1455 of yacc.c */ -#line 1161 "program_parse.y" +#line 1162 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(3) - (4)].temp_sym); ;} @@ -3285,7 +3288,7 @@ yyreduce: case 122: /* Line 1455 of yacc.c */ -#line 1168 "program_parse.y" +#line 1169 "program_parse.y" { (yyvsp[(1) - (3)].temp_sym).param_binding_length += (yyvsp[(3) - (3)].temp_sym).param_binding_length; (yyval.temp_sym) = (yyvsp[(1) - (3)].temp_sym); @@ -3295,7 +3298,7 @@ yyreduce: case 123: /* Line 1455 of yacc.c */ -#line 1175 "program_parse.y" +#line 1176 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3306,7 +3309,7 @@ yyreduce: case 124: /* Line 1455 of yacc.c */ -#line 1181 "program_parse.y" +#line 1182 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3317,7 +3320,7 @@ yyreduce: case 125: /* Line 1455 of yacc.c */ -#line 1187 "program_parse.y" +#line 1188 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3328,7 +3331,7 @@ yyreduce: case 126: /* Line 1455 of yacc.c */ -#line 1195 "program_parse.y" +#line 1196 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3339,7 +3342,7 @@ yyreduce: case 127: /* Line 1455 of yacc.c */ -#line 1201 "program_parse.y" +#line 1202 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3350,7 +3353,7 @@ yyreduce: case 128: /* Line 1455 of yacc.c */ -#line 1207 "program_parse.y" +#line 1208 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3361,7 +3364,7 @@ yyreduce: case 129: /* Line 1455 of yacc.c */ -#line 1215 "program_parse.y" +#line 1216 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3372,7 +3375,7 @@ yyreduce: case 130: /* Line 1455 of yacc.c */ -#line 1221 "program_parse.y" +#line 1222 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3383,7 +3386,7 @@ yyreduce: case 131: /* Line 1455 of yacc.c */ -#line 1227 "program_parse.y" +#line 1228 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3394,98 +3397,98 @@ yyreduce: case 132: /* Line 1455 of yacc.c */ -#line 1234 "program_parse.y" +#line 1235 "program_parse.y" { memcpy((yyval.state), (yyvsp[(1) - (1)].state), sizeof((yyval.state))); ;} break; case 133: /* Line 1455 of yacc.c */ -#line 1235 "program_parse.y" +#line 1236 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 134: /* Line 1455 of yacc.c */ -#line 1238 "program_parse.y" +#line 1239 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 135: /* Line 1455 of yacc.c */ -#line 1239 "program_parse.y" +#line 1240 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 136: /* Line 1455 of yacc.c */ -#line 1240 "program_parse.y" +#line 1241 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 137: /* Line 1455 of yacc.c */ -#line 1241 "program_parse.y" +#line 1242 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 138: /* Line 1455 of yacc.c */ -#line 1242 "program_parse.y" +#line 1243 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 139: /* Line 1455 of yacc.c */ -#line 1243 "program_parse.y" +#line 1244 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 140: /* Line 1455 of yacc.c */ -#line 1244 "program_parse.y" +#line 1245 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 141: /* Line 1455 of yacc.c */ -#line 1245 "program_parse.y" +#line 1246 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 142: /* Line 1455 of yacc.c */ -#line 1246 "program_parse.y" +#line 1247 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 143: /* Line 1455 of yacc.c */ -#line 1247 "program_parse.y" +#line 1248 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 144: /* Line 1455 of yacc.c */ -#line 1248 "program_parse.y" +#line 1249 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 145: /* Line 1455 of yacc.c */ -#line 1252 "program_parse.y" +#line 1253 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_MATERIAL; @@ -3497,7 +3500,7 @@ yyreduce: case 146: /* Line 1455 of yacc.c */ -#line 1261 "program_parse.y" +#line 1262 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -3506,7 +3509,7 @@ yyreduce: case 147: /* Line 1455 of yacc.c */ -#line 1265 "program_parse.y" +#line 1266 "program_parse.y" { (yyval.integer) = STATE_EMISSION; ;} @@ -3515,7 +3518,7 @@ yyreduce: case 148: /* Line 1455 of yacc.c */ -#line 1269 "program_parse.y" +#line 1270 "program_parse.y" { (yyval.integer) = STATE_SHININESS; ;} @@ -3524,7 +3527,7 @@ yyreduce: case 149: /* Line 1455 of yacc.c */ -#line 1275 "program_parse.y" +#line 1276 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHT; @@ -3536,7 +3539,7 @@ yyreduce: case 150: /* Line 1455 of yacc.c */ -#line 1284 "program_parse.y" +#line 1285 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -3545,7 +3548,7 @@ yyreduce: case 151: /* Line 1455 of yacc.c */ -#line 1288 "program_parse.y" +#line 1289 "program_parse.y" { (yyval.integer) = STATE_POSITION; ;} @@ -3554,7 +3557,7 @@ yyreduce: case 152: /* Line 1455 of yacc.c */ -#line 1292 "program_parse.y" +#line 1293 "program_parse.y" { if (!state->ctx->Extensions.EXT_point_parameters) { yyerror(& (yylsp[(1) - (1)]), state, "GL_ARB_point_parameters not supported"); @@ -3568,7 +3571,7 @@ yyreduce: case 153: /* Line 1455 of yacc.c */ -#line 1301 "program_parse.y" +#line 1302 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} @@ -3577,7 +3580,7 @@ yyreduce: case 154: /* Line 1455 of yacc.c */ -#line 1305 "program_parse.y" +#line 1306 "program_parse.y" { (yyval.integer) = STATE_HALF_VECTOR; ;} @@ -3586,7 +3589,7 @@ yyreduce: case 155: /* Line 1455 of yacc.c */ -#line 1311 "program_parse.y" +#line 1312 "program_parse.y" { (yyval.integer) = STATE_SPOT_DIRECTION; ;} @@ -3595,7 +3598,7 @@ yyreduce: case 156: /* Line 1455 of yacc.c */ -#line 1317 "program_parse.y" +#line 1318 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (2)].state)[1]; @@ -3605,7 +3608,7 @@ yyreduce: case 157: /* Line 1455 of yacc.c */ -#line 1324 "program_parse.y" +#line 1325 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_AMBIENT; @@ -3615,7 +3618,7 @@ yyreduce: case 158: /* Line 1455 of yacc.c */ -#line 1329 "program_parse.y" +#line 1330 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_SCENECOLOR; @@ -3626,7 +3629,7 @@ yyreduce: case 159: /* Line 1455 of yacc.c */ -#line 1337 "program_parse.y" +#line 1338 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTPROD; @@ -3639,7 +3642,7 @@ yyreduce: case 161: /* Line 1455 of yacc.c */ -#line 1349 "program_parse.y" +#line 1350 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(3) - (3)].integer); @@ -3650,7 +3653,7 @@ yyreduce: case 162: /* Line 1455 of yacc.c */ -#line 1357 "program_parse.y" +#line 1358 "program_parse.y" { (yyval.integer) = STATE_TEXENV_COLOR; ;} @@ -3659,7 +3662,7 @@ yyreduce: case 163: /* Line 1455 of yacc.c */ -#line 1363 "program_parse.y" +#line 1364 "program_parse.y" { (yyval.integer) = STATE_AMBIENT; ;} @@ -3668,7 +3671,7 @@ yyreduce: case 164: /* Line 1455 of yacc.c */ -#line 1367 "program_parse.y" +#line 1368 "program_parse.y" { (yyval.integer) = STATE_DIFFUSE; ;} @@ -3677,7 +3680,7 @@ yyreduce: case 165: /* Line 1455 of yacc.c */ -#line 1371 "program_parse.y" +#line 1372 "program_parse.y" { (yyval.integer) = STATE_SPECULAR; ;} @@ -3686,7 +3689,7 @@ yyreduce: case 166: /* Line 1455 of yacc.c */ -#line 1377 "program_parse.y" +#line 1378 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxLights) { yyerror(& (yylsp[(1) - (1)]), state, "invalid light selector"); @@ -3700,7 +3703,7 @@ yyreduce: case 167: /* Line 1455 of yacc.c */ -#line 1388 "program_parse.y" +#line 1389 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_TEXGEN; @@ -3712,7 +3715,7 @@ yyreduce: case 168: /* Line 1455 of yacc.c */ -#line 1397 "program_parse.y" +#line 1398 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S; ;} @@ -3721,7 +3724,7 @@ yyreduce: case 169: /* Line 1455 of yacc.c */ -#line 1401 "program_parse.y" +#line 1402 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_OBJECT_S; ;} @@ -3730,7 +3733,7 @@ yyreduce: case 170: /* Line 1455 of yacc.c */ -#line 1406 "program_parse.y" +#line 1407 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S; ;} @@ -3739,7 +3742,7 @@ yyreduce: case 171: /* Line 1455 of yacc.c */ -#line 1410 "program_parse.y" +#line 1411 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S; ;} @@ -3748,7 +3751,7 @@ yyreduce: case 172: /* Line 1455 of yacc.c */ -#line 1414 "program_parse.y" +#line 1415 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S; ;} @@ -3757,7 +3760,7 @@ yyreduce: case 173: /* Line 1455 of yacc.c */ -#line 1418 "program_parse.y" +#line 1419 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S; ;} @@ -3766,7 +3769,7 @@ yyreduce: case 174: /* Line 1455 of yacc.c */ -#line 1424 "program_parse.y" +#line 1425 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); @@ -3776,7 +3779,7 @@ yyreduce: case 175: /* Line 1455 of yacc.c */ -#line 1431 "program_parse.y" +#line 1432 "program_parse.y" { (yyval.integer) = STATE_FOG_COLOR; ;} @@ -3785,7 +3788,7 @@ yyreduce: case 176: /* Line 1455 of yacc.c */ -#line 1435 "program_parse.y" +#line 1436 "program_parse.y" { (yyval.integer) = STATE_FOG_PARAMS; ;} @@ -3794,7 +3797,7 @@ yyreduce: case 177: /* Line 1455 of yacc.c */ -#line 1441 "program_parse.y" +#line 1442 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_CLIPPLANE; @@ -3805,7 +3808,7 @@ yyreduce: case 178: /* Line 1455 of yacc.c */ -#line 1449 "program_parse.y" +#line 1450 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxClipPlanes) { yyerror(& (yylsp[(1) - (1)]), state, "invalid clip plane selector"); @@ -3819,7 +3822,7 @@ yyreduce: case 179: /* Line 1455 of yacc.c */ -#line 1460 "program_parse.y" +#line 1461 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); @@ -3829,7 +3832,7 @@ yyreduce: case 180: /* Line 1455 of yacc.c */ -#line 1467 "program_parse.y" +#line 1468 "program_parse.y" { (yyval.integer) = STATE_POINT_SIZE; ;} @@ -3838,7 +3841,7 @@ yyreduce: case 181: /* Line 1455 of yacc.c */ -#line 1471 "program_parse.y" +#line 1472 "program_parse.y" { (yyval.integer) = STATE_POINT_ATTENUATION; ;} @@ -3847,7 +3850,7 @@ yyreduce: case 182: /* Line 1455 of yacc.c */ -#line 1477 "program_parse.y" +#line 1478 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (5)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (5)].state)[1]; @@ -3860,7 +3863,7 @@ yyreduce: case 183: /* Line 1455 of yacc.c */ -#line 1487 "program_parse.y" +#line 1488 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (2)].state)[1]; @@ -3873,7 +3876,7 @@ yyreduce: case 184: /* Line 1455 of yacc.c */ -#line 1497 "program_parse.y" +#line 1498 "program_parse.y" { (yyval.state)[2] = 0; (yyval.state)[3] = 3; @@ -3883,7 +3886,7 @@ yyreduce: case 185: /* Line 1455 of yacc.c */ -#line 1502 "program_parse.y" +#line 1503 "program_parse.y" { /* It seems logical that the matrix row range specifier would have * to specify a range or more than one row (i.e., $5 > $3). @@ -3904,7 +3907,7 @@ yyreduce: case 186: /* Line 1455 of yacc.c */ -#line 1520 "program_parse.y" +#line 1521 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (3)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (3)].state)[1]; @@ -3915,7 +3918,7 @@ yyreduce: case 187: /* Line 1455 of yacc.c */ -#line 1528 "program_parse.y" +#line 1529 "program_parse.y" { (yyval.integer) = 0; ;} @@ -3924,7 +3927,7 @@ yyreduce: case 188: /* Line 1455 of yacc.c */ -#line 1532 "program_parse.y" +#line 1533 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -3933,7 +3936,7 @@ yyreduce: case 189: /* Line 1455 of yacc.c */ -#line 1538 "program_parse.y" +#line 1539 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVERSE; ;} @@ -3942,7 +3945,7 @@ yyreduce: case 190: /* Line 1455 of yacc.c */ -#line 1542 "program_parse.y" +#line 1543 "program_parse.y" { (yyval.integer) = STATE_MATRIX_TRANSPOSE; ;} @@ -3951,7 +3954,7 @@ yyreduce: case 191: /* Line 1455 of yacc.c */ -#line 1546 "program_parse.y" +#line 1547 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVTRANS; ;} @@ -3960,7 +3963,7 @@ yyreduce: case 192: /* Line 1455 of yacc.c */ -#line 1552 "program_parse.y" +#line 1553 "program_parse.y" { if ((yyvsp[(1) - (1)].integer) > 3) { yyerror(& (yylsp[(1) - (1)]), state, "invalid matrix row reference"); @@ -3974,7 +3977,7 @@ yyreduce: case 193: /* Line 1455 of yacc.c */ -#line 1563 "program_parse.y" +#line 1564 "program_parse.y" { (yyval.state)[0] = STATE_MODELVIEW_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); @@ -3984,7 +3987,7 @@ yyreduce: case 194: /* Line 1455 of yacc.c */ -#line 1568 "program_parse.y" +#line 1569 "program_parse.y" { (yyval.state)[0] = STATE_PROJECTION_MATRIX; (yyval.state)[1] = 0; @@ -3994,7 +3997,7 @@ yyreduce: case 195: /* Line 1455 of yacc.c */ -#line 1573 "program_parse.y" +#line 1574 "program_parse.y" { (yyval.state)[0] = STATE_MVP_MATRIX; (yyval.state)[1] = 0; @@ -4004,7 +4007,7 @@ yyreduce: case 196: /* Line 1455 of yacc.c */ -#line 1578 "program_parse.y" +#line 1579 "program_parse.y" { (yyval.state)[0] = STATE_TEXTURE_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); @@ -4014,7 +4017,7 @@ yyreduce: case 197: /* Line 1455 of yacc.c */ -#line 1583 "program_parse.y" +#line 1584 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; @@ -4024,7 +4027,7 @@ yyreduce: case 198: /* Line 1455 of yacc.c */ -#line 1588 "program_parse.y" +#line 1589 "program_parse.y" { (yyval.state)[0] = STATE_PROGRAM_MATRIX; (yyval.state)[1] = (yyvsp[(3) - (4)].integer); @@ -4034,7 +4037,7 @@ yyreduce: case 199: /* Line 1455 of yacc.c */ -#line 1595 "program_parse.y" +#line 1596 "program_parse.y" { (yyval.integer) = 0; ;} @@ -4043,7 +4046,7 @@ yyreduce: case 200: /* Line 1455 of yacc.c */ -#line 1599 "program_parse.y" +#line 1600 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -4052,7 +4055,7 @@ yyreduce: case 201: /* Line 1455 of yacc.c */ -#line 1604 "program_parse.y" +#line 1605 "program_parse.y" { /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix * zero is valid. @@ -4069,7 +4072,7 @@ yyreduce: case 202: /* Line 1455 of yacc.c */ -#line 1617 "program_parse.y" +#line 1618 "program_parse.y" { /* Since GL_ARB_matrix_palette isn't supported, just let any value * through here. The error will be generated later. @@ -4081,7 +4084,7 @@ yyreduce: case 203: /* Line 1455 of yacc.c */ -#line 1625 "program_parse.y" +#line 1626 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxProgramMatrices) { yyerror(& (yylsp[(1) - (1)]), state, "invalid program matrix selector"); @@ -4095,7 +4098,7 @@ yyreduce: case 204: /* Line 1455 of yacc.c */ -#line 1636 "program_parse.y" +#line 1637 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_DEPTH_RANGE; @@ -4105,7 +4108,7 @@ yyreduce: case 209: /* Line 1455 of yacc.c */ -#line 1648 "program_parse.y" +#line 1649 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4118,7 +4121,7 @@ yyreduce: case 210: /* Line 1455 of yacc.c */ -#line 1658 "program_parse.y" +#line 1659 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); @@ -4128,7 +4131,7 @@ yyreduce: case 211: /* Line 1455 of yacc.c */ -#line 1663 "program_parse.y" +#line 1664 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); @@ -4138,7 +4141,7 @@ yyreduce: case 212: /* Line 1455 of yacc.c */ -#line 1670 "program_parse.y" +#line 1671 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4151,7 +4154,7 @@ yyreduce: case 213: /* Line 1455 of yacc.c */ -#line 1680 "program_parse.y" +#line 1681 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4164,7 +4167,7 @@ yyreduce: case 214: /* Line 1455 of yacc.c */ -#line 1689 "program_parse.y" +#line 1690 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); @@ -4174,7 +4177,7 @@ yyreduce: case 215: /* Line 1455 of yacc.c */ -#line 1694 "program_parse.y" +#line 1695 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); @@ -4184,7 +4187,7 @@ yyreduce: case 216: /* Line 1455 of yacc.c */ -#line 1701 "program_parse.y" +#line 1702 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4197,7 +4200,7 @@ yyreduce: case 217: /* Line 1455 of yacc.c */ -#line 1711 "program_parse.y" +#line 1712 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxEnvParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid environment parameter reference"); @@ -4210,7 +4213,7 @@ yyreduce: case 218: /* Line 1455 of yacc.c */ -#line 1721 "program_parse.y" +#line 1722 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxLocalParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid local parameter reference"); @@ -4223,7 +4226,7 @@ yyreduce: case 223: /* Line 1455 of yacc.c */ -#line 1736 "program_parse.y" +#line 1737 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4236,7 +4239,7 @@ yyreduce: case 224: /* Line 1455 of yacc.c */ -#line 1746 "program_parse.y" +#line 1747 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4249,7 +4252,7 @@ yyreduce: case 225: /* Line 1455 of yacc.c */ -#line 1754 "program_parse.y" +#line 1755 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (float) (yyvsp[(1) - (1)].integer); @@ -4262,7 +4265,7 @@ yyreduce: case 226: /* Line 1455 of yacc.c */ -#line 1764 "program_parse.y" +#line 1765 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (3)].real); @@ -4275,7 +4278,7 @@ yyreduce: case 227: /* Line 1455 of yacc.c */ -#line 1772 "program_parse.y" +#line 1773 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (5)].real); @@ -4288,7 +4291,7 @@ yyreduce: case 228: /* Line 1455 of yacc.c */ -#line 1781 "program_parse.y" +#line 1782 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (7)].real); @@ -4301,7 +4304,7 @@ yyreduce: case 229: /* Line 1455 of yacc.c */ -#line 1790 "program_parse.y" +#line 1791 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (9)].real); @@ -4314,7 +4317,7 @@ yyreduce: case 230: /* Line 1455 of yacc.c */ -#line 1800 "program_parse.y" +#line 1801 "program_parse.y" { (yyval.real) = ((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].real) : (yyvsp[(2) - (2)].real); ;} @@ -4323,7 +4326,7 @@ yyreduce: case 231: /* Line 1455 of yacc.c */ -#line 1804 "program_parse.y" +#line 1805 "program_parse.y" { (yyval.real) = (float)(((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].integer) : (yyvsp[(2) - (2)].integer)); ;} @@ -4332,35 +4335,35 @@ yyreduce: case 232: /* Line 1455 of yacc.c */ -#line 1809 "program_parse.y" +#line 1810 "program_parse.y" { (yyval.negate) = FALSE; ;} break; case 233: /* Line 1455 of yacc.c */ -#line 1810 "program_parse.y" +#line 1811 "program_parse.y" { (yyval.negate) = TRUE; ;} break; case 234: /* Line 1455 of yacc.c */ -#line 1811 "program_parse.y" +#line 1812 "program_parse.y" { (yyval.negate) = FALSE; ;} break; case 235: /* Line 1455 of yacc.c */ -#line 1814 "program_parse.y" +#line 1815 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; case 237: /* Line 1455 of yacc.c */ -#line 1818 "program_parse.y" +#line 1819 "program_parse.y" { /* NV_fragment_program_option defines the size qualifiers in a * fairly broken way. "SHORT" or "LONG" can optionally be used @@ -4399,7 +4402,7 @@ yyreduce: case 238: /* Line 1455 of yacc.c */ -#line 1852 "program_parse.y" +#line 1853 "program_parse.y" { ;} break; @@ -4407,14 +4410,14 @@ yyreduce: case 239: /* Line 1455 of yacc.c */ -#line 1856 "program_parse.y" +#line 1857 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; case 241: /* Line 1455 of yacc.c */ -#line 1860 "program_parse.y" +#line 1861 "program_parse.y" { if (!declare_variable(state, (yyvsp[(3) - (3)].string), (yyvsp[(0) - (3)].integer), & (yylsp[(3) - (3)]))) { YYERROR; @@ -4425,7 +4428,7 @@ yyreduce: case 242: /* Line 1455 of yacc.c */ -#line 1866 "program_parse.y" +#line 1867 "program_parse.y" { if (!declare_variable(state, (yyvsp[(1) - (1)].string), (yyvsp[(0) - (1)].integer), & (yylsp[(1) - (1)]))) { YYERROR; @@ -4436,7 +4439,7 @@ yyreduce: case 243: /* Line 1455 of yacc.c */ -#line 1874 "program_parse.y" +#line 1875 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(3) - (5)].string), at_output, & (yylsp[(3) - (5)])); @@ -4452,7 +4455,7 @@ yyreduce: case 244: /* Line 1455 of yacc.c */ -#line 1887 "program_parse.y" +#line 1888 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_HPOS; @@ -4466,7 +4469,7 @@ yyreduce: case 245: /* Line 1455 of yacc.c */ -#line 1896 "program_parse.y" +#line 1897 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_FOGC; @@ -4480,7 +4483,7 @@ yyreduce: case 246: /* Line 1455 of yacc.c */ -#line 1905 "program_parse.y" +#line 1906 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (2)].result); ;} @@ -4489,7 +4492,7 @@ yyreduce: case 247: /* Line 1455 of yacc.c */ -#line 1909 "program_parse.y" +#line 1910 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_PSIZ; @@ -4503,7 +4506,7 @@ yyreduce: case 248: /* Line 1455 of yacc.c */ -#line 1918 "program_parse.y" +#line 1919 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_TEX0 + (yyvsp[(3) - (3)].integer); @@ -4517,7 +4520,7 @@ yyreduce: case 249: /* Line 1455 of yacc.c */ -#line 1927 "program_parse.y" +#line 1928 "program_parse.y" { if (state->mode == ARB_fragment) { (yyval.result) = FRAG_RESULT_DEPTH; @@ -4531,7 +4534,7 @@ yyreduce: case 250: /* Line 1455 of yacc.c */ -#line 1938 "program_parse.y" +#line 1939 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (3)].integer) + (yyvsp[(3) - (3)].integer); ;} @@ -4540,7 +4543,7 @@ yyreduce: case 251: /* Line 1455 of yacc.c */ -#line 1944 "program_parse.y" +#line 1945 "program_parse.y" { (yyval.integer) = (state->mode == ARB_vertex) ? VERT_RESULT_COL0 @@ -4551,7 +4554,7 @@ yyreduce: case 252: /* Line 1455 of yacc.c */ -#line 1950 "program_parse.y" +#line 1951 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_COL0; @@ -4565,7 +4568,7 @@ yyreduce: case 253: /* Line 1455 of yacc.c */ -#line 1959 "program_parse.y" +#line 1960 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_BFC0; @@ -4579,7 +4582,7 @@ yyreduce: case 254: /* Line 1455 of yacc.c */ -#line 1970 "program_parse.y" +#line 1971 "program_parse.y" { (yyval.integer) = 0; ;} @@ -4588,7 +4591,7 @@ yyreduce: case 255: /* Line 1455 of yacc.c */ -#line 1974 "program_parse.y" +#line 1975 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 0; @@ -4602,7 +4605,7 @@ yyreduce: case 256: /* Line 1455 of yacc.c */ -#line 1983 "program_parse.y" +#line 1984 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 1; @@ -4616,91 +4619,91 @@ yyreduce: case 257: /* Line 1455 of yacc.c */ -#line 1993 "program_parse.y" +#line 1994 "program_parse.y" { (yyval.integer) = 0; ;} break; case 258: /* Line 1455 of yacc.c */ -#line 1994 "program_parse.y" +#line 1995 "program_parse.y" { (yyval.integer) = 0; ;} break; case 259: /* Line 1455 of yacc.c */ -#line 1995 "program_parse.y" +#line 1996 "program_parse.y" { (yyval.integer) = 1; ;} break; case 260: /* Line 1455 of yacc.c */ -#line 1998 "program_parse.y" +#line 1999 "program_parse.y" { (yyval.integer) = 0; ;} break; case 261: /* Line 1455 of yacc.c */ -#line 1999 "program_parse.y" +#line 2000 "program_parse.y" { (yyval.integer) = 0; ;} break; case 262: /* Line 1455 of yacc.c */ -#line 2000 "program_parse.y" +#line 2001 "program_parse.y" { (yyval.integer) = 1; ;} break; case 263: /* Line 1455 of yacc.c */ -#line 2003 "program_parse.y" +#line 2004 "program_parse.y" { (yyval.integer) = 0; ;} break; case 264: /* Line 1455 of yacc.c */ -#line 2004 "program_parse.y" +#line 2005 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 265: /* Line 1455 of yacc.c */ -#line 2007 "program_parse.y" +#line 2008 "program_parse.y" { (yyval.integer) = 0; ;} break; case 266: /* Line 1455 of yacc.c */ -#line 2008 "program_parse.y" +#line 2009 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 267: /* Line 1455 of yacc.c */ -#line 2011 "program_parse.y" +#line 2012 "program_parse.y" { (yyval.integer) = 0; ;} break; case 268: /* Line 1455 of yacc.c */ -#line 2012 "program_parse.y" +#line 2013 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 269: /* Line 1455 of yacc.c */ -#line 2016 "program_parse.y" +#line 2017 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureCoordUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture coordinate unit selector"); @@ -4714,7 +4717,7 @@ yyreduce: case 270: /* Line 1455 of yacc.c */ -#line 2027 "program_parse.y" +#line 2028 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureImageUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture image unit selector"); @@ -4728,7 +4731,7 @@ yyreduce: case 271: /* Line 1455 of yacc.c */ -#line 2038 "program_parse.y" +#line 2039 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture unit selector"); @@ -4742,7 +4745,7 @@ yyreduce: case 272: /* Line 1455 of yacc.c */ -#line 2049 "program_parse.y" +#line 2050 "program_parse.y" { struct asm_symbol *exist = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(2) - (4)].string)); @@ -4766,7 +4769,7 @@ yyreduce: /* Line 1455 of yacc.c */ -#line 4770 "program_parse.tab.c" +#line 4773 "program_parse.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -4985,7 +4988,7 @@ yyreturn: /* Line 1675 of yacc.c */ -#line 2069 "program_parse.y" +#line 2074 "program_parse.y" void diff --git a/src/mesa/shader/program_parse.tab.h b/src/mesa/shader/program_parse.tab.h index 5f89532d65..c6ed6c777e 100644 --- a/src/mesa/shader/program_parse.tab.h +++ b/src/mesa/shader/program_parse.tab.h @@ -136,13 +136,14 @@ VTXATTRIB = 352, WEIGHT = 353, IDENTIFIER = 354, - MASK4 = 355, - MASK3 = 356, - MASK2 = 357, - MASK1 = 358, - SWIZZLE = 359, - DOT_DOT = 360, - DOT = 361 + USED_IDENTIFIER = 355, + MASK4 = 356, + MASK3 = 357, + MASK2 = 358, + MASK1 = 359, + SWIZZLE = 360, + DOT_DOT = 361, + DOT = 362 }; #endif @@ -182,7 +183,7 @@ typedef union YYSTYPE /* Line 1676 of yacc.c */ -#line 186 "program_parse.tab.h" +#line 187 "program_parse.tab.h" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index 51cc9f7f11..d6bac07081 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -178,7 +178,8 @@ static struct asm_instruction *asm_instruction_copy_ctor( %token VERTEX VTXATTRIB %token WEIGHT -%token IDENTIFIER +%token IDENTIFIER USED_IDENTIFIER +%type string %token MASK4 MASK3 MASK2 MASK1 SWIZZLE %token DOT_DOT %token DOT @@ -289,7 +290,7 @@ optionSequence: optionSequence option | ; -option: OPTION IDENTIFIER ';' +option: OPTION string ';' { int valid = 0; @@ -692,7 +693,7 @@ extSwizSel: INTEGER $$.xyzw_valid = 1; $$.rgba_valid = 1; } - | IDENTIFIER + | string { if (strlen($1) > 1) { yyerror(& @1, state, "invalid extended swizzle selector"); @@ -742,7 +743,7 @@ extSwizSel: INTEGER } ; -srcReg: IDENTIFIER /* temporaryReg | progParamSingle */ +srcReg: USED_IDENTIFIER /* temporaryReg | progParamSingle */ { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, $1); @@ -832,7 +833,7 @@ dstReg: resultBinding $$.File = PROGRAM_OUTPUT; $$.Index = $1; } - | IDENTIFIER /* temporaryReg | vertexResultReg */ + | USED_IDENTIFIER /* temporaryReg | vertexResultReg */ { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, $1); @@ -863,7 +864,7 @@ dstReg: resultBinding } ; -progParamArray: IDENTIFIER +progParamArray: USED_IDENTIFIER { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, $1); @@ -930,7 +931,7 @@ addrRegNegOffset: INTEGER } ; -addrReg: IDENTIFIER +addrReg: USED_IDENTIFIER { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, $1); @@ -1814,7 +1815,7 @@ optionalSign: '+' { $$ = FALSE; } TEMP_statement: optVarSize TEMP { $$ = $2; } varNameList ; -optVarSize: IDENTIFIER +optVarSize: string { /* NV_fragment_program_option defines the size qualifiers in a * fairly broken way. "SHORT" or "LONG" can optionally be used @@ -2045,7 +2046,7 @@ legacyTexUnitNum: INTEGER } ; -ALIAS_statement: ALIAS IDENTIFIER '=' IDENTIFIER +ALIAS_statement: ALIAS IDENTIFIER '=' USED_IDENTIFIER { struct asm_symbol *exist = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, $2); @@ -2066,6 +2067,10 @@ ALIAS_statement: ALIAS IDENTIFIER '=' IDENTIFIER } ; +string: IDENTIFIER + | USED_IDENTIFIER + ; + %% void -- cgit v1.2.3 From cdb719399438194c5e9d5bc1bae3458398fe4e54 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 10 Sep 2009 14:55:36 -0700 Subject: ARB prog lexer: Add missing #include to silence compile warning --- src/mesa/shader/lex.yy.c | 347 ++++++++++++++++++++-------------------- src/mesa/shader/program_lexer.l | 1 + 2 files changed, 175 insertions(+), 173 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/lex.yy.c b/src/mesa/shader/lex.yy.c index 959eb854d6..ba3512365e 100644 --- a/src/mesa/shader/lex.yy.c +++ b/src/mesa/shader/lex.yy.c @@ -1037,6 +1037,7 @@ static yyconst flex_int16_t yy_chk[1352] = #include "main/glheader.h" #include "prog_instruction.h" +#include "symbol_table.h" #include "program_parser.h" #include "program_parse.tab.h" @@ -1147,7 +1148,7 @@ handle_ident(struct asm_parser_state *state, const char *text, YYSTYPE *lval) } while(0); #define YY_EXTRA_TYPE struct asm_parser_state * -#line 1151 "lex.yy.c" +#line 1152 "lex.yy.c" #define INITIAL 0 @@ -1393,10 +1394,10 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 150 "program_lexer.l" +#line 151 "program_lexer.l" -#line 1400 "lex.yy.c" +#line 1401 "lex.yy.c" yylval = yylval_param; @@ -1485,17 +1486,17 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 152 "program_lexer.l" +#line 153 "program_lexer.l" { return ARBvp_10; } YY_BREAK case 2: YY_RULE_SETUP -#line 153 "program_lexer.l" +#line 154 "program_lexer.l" { return ARBfp_10; } YY_BREAK case 3: YY_RULE_SETUP -#line 154 "program_lexer.l" +#line 155 "program_lexer.l" { yylval->integer = at_address; return_token_or_IDENTIFIER(require_ARB_vp, ADDRESS); @@ -1503,682 +1504,682 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 158 "program_lexer.l" +#line 159 "program_lexer.l" { return ALIAS; } YY_BREAK case 5: YY_RULE_SETUP -#line 159 "program_lexer.l" +#line 160 "program_lexer.l" { return ATTRIB; } YY_BREAK case 6: YY_RULE_SETUP -#line 160 "program_lexer.l" +#line 161 "program_lexer.l" { return END; } YY_BREAK case 7: YY_RULE_SETUP -#line 161 "program_lexer.l" +#line 162 "program_lexer.l" { return OPTION; } YY_BREAK case 8: YY_RULE_SETUP -#line 162 "program_lexer.l" +#line 163 "program_lexer.l" { return OUTPUT; } YY_BREAK case 9: YY_RULE_SETUP -#line 163 "program_lexer.l" +#line 164 "program_lexer.l" { return PARAM; } YY_BREAK case 10: YY_RULE_SETUP -#line 164 "program_lexer.l" +#line 165 "program_lexer.l" { yylval->integer = at_temp; return TEMP; } YY_BREAK case 11: YY_RULE_SETUP -#line 166 "program_lexer.l" +#line 167 "program_lexer.l" { return_opcode( 1, VECTOR_OP, ABS, 3); } YY_BREAK case 12: YY_RULE_SETUP -#line 167 "program_lexer.l" +#line 168 "program_lexer.l" { return_opcode( 1, BIN_OP, ADD, 3); } YY_BREAK case 13: YY_RULE_SETUP -#line 168 "program_lexer.l" +#line 169 "program_lexer.l" { return_opcode(require_ARB_vp, ARL, ARL, 3); } YY_BREAK case 14: YY_RULE_SETUP -#line 170 "program_lexer.l" +#line 171 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, CMP, 3); } YY_BREAK case 15: YY_RULE_SETUP -#line 171 "program_lexer.l" +#line 172 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, COS, 3); } YY_BREAK case 16: YY_RULE_SETUP -#line 173 "program_lexer.l" +#line 174 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, DDX, 3); } YY_BREAK case 17: YY_RULE_SETUP -#line 174 "program_lexer.l" +#line 175 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, DDY, 3); } YY_BREAK case 18: YY_RULE_SETUP -#line 175 "program_lexer.l" +#line 176 "program_lexer.l" { return_opcode( 1, BIN_OP, DP3, 3); } YY_BREAK case 19: YY_RULE_SETUP -#line 176 "program_lexer.l" +#line 177 "program_lexer.l" { return_opcode( 1, BIN_OP, DP4, 3); } YY_BREAK case 20: YY_RULE_SETUP -#line 177 "program_lexer.l" +#line 178 "program_lexer.l" { return_opcode( 1, BIN_OP, DPH, 3); } YY_BREAK case 21: YY_RULE_SETUP -#line 178 "program_lexer.l" +#line 179 "program_lexer.l" { return_opcode( 1, BIN_OP, DST, 3); } YY_BREAK case 22: YY_RULE_SETUP -#line 180 "program_lexer.l" +#line 181 "program_lexer.l" { return_opcode( 1, SCALAR_OP, EX2, 3); } YY_BREAK case 23: YY_RULE_SETUP -#line 181 "program_lexer.l" +#line 182 "program_lexer.l" { return_opcode(require_ARB_vp, SCALAR_OP, EXP, 3); } YY_BREAK case 24: YY_RULE_SETUP -#line 183 "program_lexer.l" +#line 184 "program_lexer.l" { return_opcode( 1, VECTOR_OP, FLR, 3); } YY_BREAK case 25: YY_RULE_SETUP -#line 184 "program_lexer.l" +#line 185 "program_lexer.l" { return_opcode( 1, VECTOR_OP, FRC, 3); } YY_BREAK case 26: YY_RULE_SETUP -#line 186 "program_lexer.l" +#line 187 "program_lexer.l" { return_opcode(require_ARB_fp, KIL, KIL, 3); } YY_BREAK case 27: YY_RULE_SETUP -#line 188 "program_lexer.l" +#line 189 "program_lexer.l" { return_opcode( 1, VECTOR_OP, LIT, 3); } YY_BREAK case 28: YY_RULE_SETUP -#line 189 "program_lexer.l" +#line 190 "program_lexer.l" { return_opcode( 1, SCALAR_OP, LG2, 3); } YY_BREAK case 29: YY_RULE_SETUP -#line 190 "program_lexer.l" +#line 191 "program_lexer.l" { return_opcode(require_ARB_vp, SCALAR_OP, LOG, 3); } YY_BREAK case 30: YY_RULE_SETUP -#line 191 "program_lexer.l" +#line 192 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, LRP, 3); } YY_BREAK case 31: YY_RULE_SETUP -#line 193 "program_lexer.l" +#line 194 "program_lexer.l" { return_opcode( 1, TRI_OP, MAD, 3); } YY_BREAK case 32: YY_RULE_SETUP -#line 194 "program_lexer.l" +#line 195 "program_lexer.l" { return_opcode( 1, BIN_OP, MAX, 3); } YY_BREAK case 33: YY_RULE_SETUP -#line 195 "program_lexer.l" +#line 196 "program_lexer.l" { return_opcode( 1, BIN_OP, MIN, 3); } YY_BREAK case 34: YY_RULE_SETUP -#line 196 "program_lexer.l" +#line 197 "program_lexer.l" { return_opcode( 1, VECTOR_OP, MOV, 3); } YY_BREAK case 35: YY_RULE_SETUP -#line 197 "program_lexer.l" +#line 198 "program_lexer.l" { return_opcode( 1, BIN_OP, MUL, 3); } YY_BREAK case 36: YY_RULE_SETUP -#line 199 "program_lexer.l" +#line 200 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK2H, 4); } YY_BREAK case 37: YY_RULE_SETUP -#line 200 "program_lexer.l" +#line 201 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK2US, 5); } YY_BREAK case 38: YY_RULE_SETUP -#line 201 "program_lexer.l" +#line 202 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK4B, 4); } YY_BREAK case 39: YY_RULE_SETUP -#line 202 "program_lexer.l" +#line 203 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK4UB, 5); } YY_BREAK case 40: YY_RULE_SETUP -#line 203 "program_lexer.l" +#line 204 "program_lexer.l" { return_opcode( 1, BINSC_OP, POW, 3); } YY_BREAK case 41: YY_RULE_SETUP -#line 205 "program_lexer.l" +#line 206 "program_lexer.l" { return_opcode( 1, SCALAR_OP, RCP, 3); } YY_BREAK case 42: YY_RULE_SETUP -#line 206 "program_lexer.l" +#line 207 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, RFL, 3); } YY_BREAK case 43: YY_RULE_SETUP -#line 207 "program_lexer.l" +#line 208 "program_lexer.l" { return_opcode( 1, SCALAR_OP, RSQ, 3); } YY_BREAK case 44: YY_RULE_SETUP -#line 209 "program_lexer.l" +#line 210 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SCS, 3); } YY_BREAK case 45: YY_RULE_SETUP -#line 210 "program_lexer.l" +#line 211 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SEQ, 3); } YY_BREAK case 46: YY_RULE_SETUP -#line 211 "program_lexer.l" +#line 212 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SFL, 3); } YY_BREAK case 47: YY_RULE_SETUP -#line 212 "program_lexer.l" +#line 213 "program_lexer.l" { return_opcode( 1, BIN_OP, SGE, 3); } YY_BREAK case 48: YY_RULE_SETUP -#line 213 "program_lexer.l" +#line 214 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SGT, 3); } YY_BREAK case 49: YY_RULE_SETUP -#line 214 "program_lexer.l" +#line 215 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SIN, 3); } YY_BREAK case 50: YY_RULE_SETUP -#line 215 "program_lexer.l" +#line 216 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SLE, 3); } YY_BREAK case 51: YY_RULE_SETUP -#line 216 "program_lexer.l" +#line 217 "program_lexer.l" { return_opcode( 1, BIN_OP, SLT, 3); } YY_BREAK case 52: YY_RULE_SETUP -#line 217 "program_lexer.l" +#line 218 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SNE, 3); } YY_BREAK case 53: YY_RULE_SETUP -#line 218 "program_lexer.l" +#line 219 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, STR, 3); } YY_BREAK case 54: YY_RULE_SETUP -#line 219 "program_lexer.l" +#line 220 "program_lexer.l" { return_opcode( 1, BIN_OP, SUB, 3); } YY_BREAK case 55: YY_RULE_SETUP -#line 220 "program_lexer.l" +#line 221 "program_lexer.l" { return_opcode( 1, SWZ, SWZ, 3); } YY_BREAK case 56: YY_RULE_SETUP -#line 222 "program_lexer.l" +#line 223 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TEX, 3); } YY_BREAK case 57: YY_RULE_SETUP -#line 223 "program_lexer.l" +#line 224 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, 3); } YY_BREAK case 58: YY_RULE_SETUP -#line 224 "program_lexer.l" +#line 225 "program_lexer.l" { return_opcode(require_NV_fp, TXD_OP, TXD, 3); } YY_BREAK case 59: YY_RULE_SETUP -#line 225 "program_lexer.l" +#line 226 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, 3); } YY_BREAK case 60: YY_RULE_SETUP -#line 227 "program_lexer.l" +#line 228 "program_lexer.l" { return_opcode(require_NV_fp, SCALAR_OP, UP2H, 4); } YY_BREAK case 61: YY_RULE_SETUP -#line 228 "program_lexer.l" +#line 229 "program_lexer.l" { return_opcode(require_NV_fp, SCALAR_OP, UP2US, 5); } YY_BREAK case 62: YY_RULE_SETUP -#line 230 "program_lexer.l" +#line 231 "program_lexer.l" { return_opcode(require_NV_fp, TRI_OP, X2D, 3); } YY_BREAK case 63: YY_RULE_SETUP -#line 231 "program_lexer.l" +#line 232 "program_lexer.l" { return_opcode( 1, BIN_OP, XPD, 3); } YY_BREAK case 64: YY_RULE_SETUP -#line 233 "program_lexer.l" +#line 234 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); } YY_BREAK case 65: YY_RULE_SETUP -#line 234 "program_lexer.l" +#line 235 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); } YY_BREAK case 66: YY_RULE_SETUP -#line 235 "program_lexer.l" +#line 236 "program_lexer.l" { return PROGRAM; } YY_BREAK case 67: YY_RULE_SETUP -#line 236 "program_lexer.l" +#line 237 "program_lexer.l" { return STATE; } YY_BREAK case 68: YY_RULE_SETUP -#line 237 "program_lexer.l" +#line 238 "program_lexer.l" { return RESULT; } YY_BREAK case 69: YY_RULE_SETUP -#line 239 "program_lexer.l" +#line 240 "program_lexer.l" { return AMBIENT; } YY_BREAK case 70: YY_RULE_SETUP -#line 240 "program_lexer.l" +#line 241 "program_lexer.l" { return ATTENUATION; } YY_BREAK case 71: YY_RULE_SETUP -#line 241 "program_lexer.l" +#line 242 "program_lexer.l" { return BACK; } YY_BREAK case 72: YY_RULE_SETUP -#line 242 "program_lexer.l" +#line 243 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, CLIP); } YY_BREAK case 73: YY_RULE_SETUP -#line 243 "program_lexer.l" +#line 244 "program_lexer.l" { return COLOR; } YY_BREAK case 74: YY_RULE_SETUP -#line 244 "program_lexer.l" +#line 245 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, DEPTH); } YY_BREAK case 75: YY_RULE_SETUP -#line 245 "program_lexer.l" +#line 246 "program_lexer.l" { return DIFFUSE; } YY_BREAK case 76: YY_RULE_SETUP -#line 246 "program_lexer.l" +#line 247 "program_lexer.l" { return DIRECTION; } YY_BREAK case 77: YY_RULE_SETUP -#line 247 "program_lexer.l" +#line 248 "program_lexer.l" { return EMISSION; } YY_BREAK case 78: YY_RULE_SETUP -#line 248 "program_lexer.l" +#line 249 "program_lexer.l" { return ENV; } YY_BREAK case 79: YY_RULE_SETUP -#line 249 "program_lexer.l" +#line 250 "program_lexer.l" { return EYE; } YY_BREAK case 80: YY_RULE_SETUP -#line 250 "program_lexer.l" +#line 251 "program_lexer.l" { return FOGCOORD; } YY_BREAK case 81: YY_RULE_SETUP -#line 251 "program_lexer.l" +#line 252 "program_lexer.l" { return FOG; } YY_BREAK case 82: YY_RULE_SETUP -#line 252 "program_lexer.l" +#line 253 "program_lexer.l" { return FRONT; } YY_BREAK case 83: YY_RULE_SETUP -#line 253 "program_lexer.l" +#line 254 "program_lexer.l" { return HALF; } YY_BREAK case 84: YY_RULE_SETUP -#line 254 "program_lexer.l" +#line 255 "program_lexer.l" { return INVERSE; } YY_BREAK case 85: YY_RULE_SETUP -#line 255 "program_lexer.l" +#line 256 "program_lexer.l" { return INVTRANS; } YY_BREAK case 86: YY_RULE_SETUP -#line 256 "program_lexer.l" +#line 257 "program_lexer.l" { return LIGHT; } YY_BREAK case 87: YY_RULE_SETUP -#line 257 "program_lexer.l" +#line 258 "program_lexer.l" { return LIGHTMODEL; } YY_BREAK case 88: YY_RULE_SETUP -#line 258 "program_lexer.l" +#line 259 "program_lexer.l" { return LIGHTPROD; } YY_BREAK case 89: YY_RULE_SETUP -#line 259 "program_lexer.l" +#line 260 "program_lexer.l" { return LOCAL; } YY_BREAK case 90: YY_RULE_SETUP -#line 260 "program_lexer.l" +#line 261 "program_lexer.l" { return MATERIAL; } YY_BREAK case 91: YY_RULE_SETUP -#line 261 "program_lexer.l" +#line 262 "program_lexer.l" { return MAT_PROGRAM; } YY_BREAK case 92: YY_RULE_SETUP -#line 262 "program_lexer.l" +#line 263 "program_lexer.l" { return MATRIX; } YY_BREAK case 93: YY_RULE_SETUP -#line 263 "program_lexer.l" +#line 264 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, MATRIXINDEX); } YY_BREAK case 94: YY_RULE_SETUP -#line 264 "program_lexer.l" +#line 265 "program_lexer.l" { return MODELVIEW; } YY_BREAK case 95: YY_RULE_SETUP -#line 265 "program_lexer.l" +#line 266 "program_lexer.l" { return MVP; } YY_BREAK case 96: YY_RULE_SETUP -#line 266 "program_lexer.l" +#line 267 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, NORMAL); } YY_BREAK case 97: YY_RULE_SETUP -#line 267 "program_lexer.l" +#line 268 "program_lexer.l" { return OBJECT; } YY_BREAK case 98: YY_RULE_SETUP -#line 268 "program_lexer.l" +#line 269 "program_lexer.l" { return PALETTE; } YY_BREAK case 99: YY_RULE_SETUP -#line 269 "program_lexer.l" +#line 270 "program_lexer.l" { return PARAMS; } YY_BREAK case 100: YY_RULE_SETUP -#line 270 "program_lexer.l" +#line 271 "program_lexer.l" { return PLANE; } YY_BREAK case 101: YY_RULE_SETUP -#line 271 "program_lexer.l" +#line 272 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, POINT); } YY_BREAK case 102: YY_RULE_SETUP -#line 272 "program_lexer.l" +#line 273 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, POINTSIZE); } YY_BREAK case 103: YY_RULE_SETUP -#line 273 "program_lexer.l" +#line 274 "program_lexer.l" { return POSITION; } YY_BREAK case 104: YY_RULE_SETUP -#line 274 "program_lexer.l" +#line 275 "program_lexer.l" { return PRIMARY; } YY_BREAK case 105: YY_RULE_SETUP -#line 275 "program_lexer.l" +#line 276 "program_lexer.l" { return PROJECTION; } YY_BREAK case 106: YY_RULE_SETUP -#line 276 "program_lexer.l" +#line 277 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, RANGE); } YY_BREAK case 107: YY_RULE_SETUP -#line 277 "program_lexer.l" +#line 278 "program_lexer.l" { return ROW; } YY_BREAK case 108: YY_RULE_SETUP -#line 278 "program_lexer.l" +#line 279 "program_lexer.l" { return SCENECOLOR; } YY_BREAK case 109: YY_RULE_SETUP -#line 279 "program_lexer.l" +#line 280 "program_lexer.l" { return SECONDARY; } YY_BREAK case 110: YY_RULE_SETUP -#line 280 "program_lexer.l" +#line 281 "program_lexer.l" { return SHININESS; } YY_BREAK case 111: YY_RULE_SETUP -#line 281 "program_lexer.l" +#line 282 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, SIZE); } YY_BREAK case 112: YY_RULE_SETUP -#line 282 "program_lexer.l" +#line 283 "program_lexer.l" { return SPECULAR; } YY_BREAK case 113: YY_RULE_SETUP -#line 283 "program_lexer.l" +#line 284 "program_lexer.l" { return SPOT; } YY_BREAK case 114: YY_RULE_SETUP -#line 284 "program_lexer.l" +#line 285 "program_lexer.l" { return TEXCOORD; } YY_BREAK case 115: YY_RULE_SETUP -#line 285 "program_lexer.l" +#line 286 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, TEXENV); } YY_BREAK case 116: YY_RULE_SETUP -#line 286 "program_lexer.l" +#line 287 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN); } YY_BREAK case 117: YY_RULE_SETUP -#line 287 "program_lexer.l" +#line 288 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_Q); } YY_BREAK case 118: YY_RULE_SETUP -#line 288 "program_lexer.l" +#line 289 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_S); } YY_BREAK case 119: YY_RULE_SETUP -#line 289 "program_lexer.l" +#line 290 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_T); } YY_BREAK case 120: YY_RULE_SETUP -#line 290 "program_lexer.l" +#line 291 "program_lexer.l" { return TEXTURE; } YY_BREAK case 121: YY_RULE_SETUP -#line 291 "program_lexer.l" +#line 292 "program_lexer.l" { return TRANSPOSE; } YY_BREAK case 122: YY_RULE_SETUP -#line 292 "program_lexer.l" +#line 293 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, VTXATTRIB); } YY_BREAK case 123: YY_RULE_SETUP -#line 293 "program_lexer.l" +#line 294 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, WEIGHT); } YY_BREAK case 124: YY_RULE_SETUP -#line 295 "program_lexer.l" +#line 296 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEXTURE_UNIT); } YY_BREAK case 125: YY_RULE_SETUP -#line 296 "program_lexer.l" +#line 297 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_1D); } YY_BREAK case 126: YY_RULE_SETUP -#line 297 "program_lexer.l" +#line 298 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_2D); } YY_BREAK case 127: YY_RULE_SETUP -#line 298 "program_lexer.l" +#line 299 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_3D); } YY_BREAK case 128: YY_RULE_SETUP -#line 299 "program_lexer.l" +#line 300 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_CUBE); } YY_BREAK case 129: YY_RULE_SETUP -#line 300 "program_lexer.l" +#line 301 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_rect, TEX_RECT); } YY_BREAK case 130: YY_RULE_SETUP -#line 301 "program_lexer.l" +#line 302 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW1D); } YY_BREAK case 131: YY_RULE_SETUP -#line 302 "program_lexer.l" +#line 303 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW2D); } YY_BREAK case 132: YY_RULE_SETUP -#line 303 "program_lexer.l" +#line 304 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_rect, TEX_SHADOWRECT); } YY_BREAK case 133: YY_RULE_SETUP -#line 304 "program_lexer.l" +#line 305 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY1D); } YY_BREAK case 134: YY_RULE_SETUP -#line 305 "program_lexer.l" +#line 306 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY2D); } YY_BREAK case 135: YY_RULE_SETUP -#line 306 "program_lexer.l" +#line 307 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW1D); } YY_BREAK case 136: YY_RULE_SETUP -#line 307 "program_lexer.l" +#line 308 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); } YY_BREAK case 137: YY_RULE_SETUP -#line 309 "program_lexer.l" +#line 310 "program_lexer.l" { return handle_ident(yyextra, yytext, yylval); } YY_BREAK case 138: YY_RULE_SETUP -#line 311 "program_lexer.l" +#line 312 "program_lexer.l" { return DOT_DOT; } YY_BREAK case 139: YY_RULE_SETUP -#line 313 "program_lexer.l" +#line 314 "program_lexer.l" { yylval->integer = strtol(yytext, NULL, 10); return INTEGER; @@ -2186,7 +2187,7 @@ YY_RULE_SETUP YY_BREAK case 140: YY_RULE_SETUP -#line 317 "program_lexer.l" +#line 318 "program_lexer.l" { yylval->real = strtod(yytext, NULL); return REAL; @@ -2198,7 +2199,7 @@ case 141: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 321 "program_lexer.l" +#line 322 "program_lexer.l" { yylval->real = strtod(yytext, NULL); return REAL; @@ -2206,7 +2207,7 @@ YY_RULE_SETUP YY_BREAK case 142: YY_RULE_SETUP -#line 325 "program_lexer.l" +#line 326 "program_lexer.l" { yylval->real = strtod(yytext, NULL); return REAL; @@ -2214,7 +2215,7 @@ YY_RULE_SETUP YY_BREAK case 143: YY_RULE_SETUP -#line 329 "program_lexer.l" +#line 330 "program_lexer.l" { yylval->real = strtod(yytext, NULL); return REAL; @@ -2222,7 +2223,7 @@ YY_RULE_SETUP YY_BREAK case 144: YY_RULE_SETUP -#line 334 "program_lexer.l" +#line 335 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; @@ -2231,7 +2232,7 @@ YY_RULE_SETUP YY_BREAK case 145: YY_RULE_SETUP -#line 340 "program_lexer.l" +#line 341 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2241,7 +2242,7 @@ YY_RULE_SETUP YY_BREAK case 146: YY_RULE_SETUP -#line 346 "program_lexer.l" +#line 347 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; @@ -2250,7 +2251,7 @@ YY_RULE_SETUP YY_BREAK case 147: YY_RULE_SETUP -#line 351 "program_lexer.l" +#line 352 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; @@ -2259,7 +2260,7 @@ YY_RULE_SETUP YY_BREAK case 148: YY_RULE_SETUP -#line 357 "program_lexer.l" +#line 358 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2269,7 +2270,7 @@ YY_RULE_SETUP YY_BREAK case 149: YY_RULE_SETUP -#line 363 "program_lexer.l" +#line 364 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2279,7 +2280,7 @@ YY_RULE_SETUP YY_BREAK case 150: YY_RULE_SETUP -#line 369 "program_lexer.l" +#line 370 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; @@ -2288,7 +2289,7 @@ YY_RULE_SETUP YY_BREAK case 151: YY_RULE_SETUP -#line 375 "program_lexer.l" +#line 376 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2298,7 +2299,7 @@ YY_RULE_SETUP YY_BREAK case 152: YY_RULE_SETUP -#line 382 "program_lexer.l" +#line 383 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2310,7 +2311,7 @@ YY_RULE_SETUP YY_BREAK case 153: YY_RULE_SETUP -#line 391 "program_lexer.l" +#line 392 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; @@ -2319,7 +2320,7 @@ YY_RULE_SETUP YY_BREAK case 154: YY_RULE_SETUP -#line 397 "program_lexer.l" +#line 398 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2329,7 +2330,7 @@ YY_RULE_SETUP YY_BREAK case 155: YY_RULE_SETUP -#line 403 "program_lexer.l" +#line 404 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; @@ -2338,7 +2339,7 @@ YY_RULE_SETUP YY_BREAK case 156: YY_RULE_SETUP -#line 408 "program_lexer.l" +#line 409 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; @@ -2347,7 +2348,7 @@ YY_RULE_SETUP YY_BREAK case 157: YY_RULE_SETUP -#line 414 "program_lexer.l" +#line 415 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2357,7 +2358,7 @@ YY_RULE_SETUP YY_BREAK case 158: YY_RULE_SETUP -#line 420 "program_lexer.l" +#line 421 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2367,7 +2368,7 @@ YY_RULE_SETUP YY_BREAK case 159: YY_RULE_SETUP -#line 426 "program_lexer.l" +#line 427 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; @@ -2376,7 +2377,7 @@ YY_RULE_SETUP YY_BREAK case 160: YY_RULE_SETUP -#line 432 "program_lexer.l" +#line 433 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2386,7 +2387,7 @@ YY_RULE_SETUP YY_BREAK case 161: YY_RULE_SETUP -#line 440 "program_lexer.l" +#line 441 "program_lexer.l" { if (require_ARB_vp) { return TEXGEN_R; @@ -2400,7 +2401,7 @@ YY_RULE_SETUP YY_BREAK case 162: YY_RULE_SETUP -#line 451 "program_lexer.l" +#line 452 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2412,13 +2413,13 @@ YY_RULE_SETUP YY_BREAK case 163: YY_RULE_SETUP -#line 460 "program_lexer.l" +#line 461 "program_lexer.l" { return DOT; } YY_BREAK case 164: /* rule 164 can match eol */ YY_RULE_SETUP -#line 462 "program_lexer.l" +#line 463 "program_lexer.l" { yylloc->first_line++; yylloc->first_column = 1; @@ -2429,7 +2430,7 @@ YY_RULE_SETUP YY_BREAK case 165: YY_RULE_SETUP -#line 469 "program_lexer.l" +#line 470 "program_lexer.l" /* eat whitespace */ ; YY_BREAK case 166: @@ -2437,20 +2438,20 @@ case 166: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 470 "program_lexer.l" +#line 471 "program_lexer.l" /* eat comments */ ; YY_BREAK case 167: YY_RULE_SETUP -#line 471 "program_lexer.l" +#line 472 "program_lexer.l" { return yytext[0]; } YY_BREAK case 168: YY_RULE_SETUP -#line 472 "program_lexer.l" +#line 473 "program_lexer.l" ECHO; YY_BREAK -#line 2454 "lex.yy.c" +#line 2455 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -3625,7 +3626,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 472 "program_lexer.l" +#line 473 "program_lexer.l" diff --git a/src/mesa/shader/program_lexer.l b/src/mesa/shader/program_lexer.l index 9e68c34ac0..a0d1af1e07 100644 --- a/src/mesa/shader/program_lexer.l +++ b/src/mesa/shader/program_lexer.l @@ -24,6 +24,7 @@ #include "main/glheader.h" #include "prog_instruction.h" +#include "symbol_table.h" #include "program_parser.h" #include "program_parse.tab.h" -- cgit v1.2.3 From 81722c5d7e8e93d837510b9e6e5d014ec64cf4b3 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 10 Sep 2009 15:04:24 -0700 Subject: NV fp parser: Add support for condition codes Conditional write masks and the condition-code based KIL instruction are all supported. The specific behavior of KIL in the following shader may or may not match the behavior of other implementations: !!ARBfp1.0 TEMP GT; MOVC GT, fragment.texcoord[0]; KIL GT.x; END Should be it interpreted as 'KIL srcReg' or as 'KIL ccTest'? The current parser will interpret it as 'KIL srcReg'. --- src/mesa/shader/program_parse.tab.c | 1895 ++++++++++++++++++--------------- src/mesa/shader/program_parse.y | 102 +- src/mesa/shader/program_parse_extra.c | 54 + src/mesa/shader/program_parser.h | 13 + 4 files changed, 1183 insertions(+), 881 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c index d37b20ba42..33195c0b16 100644 --- a/src/mesa/shader/program_parse.tab.c +++ b/src/mesa/shader/program_parse.tab.c @@ -374,7 +374,7 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ /* Line 264 of yacc.c */ -#line 259 "program_parse.y" +#line 261 "program_parse.y" extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, void *yyscanner); @@ -598,16 +598,16 @@ union yyalloc /* YYFINAL -- State number of the termination state. */ #define YYFINAL 5 /* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 393 +#define YYLAST 396 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 118 +#define YYNTOKENS 120 /* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 138 +#define YYNNTS 143 /* YYNRULES -- Number of rules. */ -#define YYNRULES 274 +#define YYNRULES 282 /* YYNRULES -- Number of states. */ -#define YYNSTATES 460 +#define YYNSTATES 473 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 @@ -623,15 +623,15 @@ static const yytype_uint8 yytranslate[] = 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 113, 109, 114, 2, 2, 2, 2, + 115, 116, 2, 113, 109, 114, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 108, - 2, 115, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 117, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 111, 2, 112, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 116, 110, 117, 2, 2, 2, 2, + 2, 2, 2, 118, 110, 119, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -666,147 +666,151 @@ static const yytype_uint16 yyprhs[] = 0, 0, 3, 8, 10, 12, 15, 16, 20, 23, 24, 27, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 59, 64, 69, 76, 83, - 92, 101, 104, 117, 120, 122, 124, 126, 128, 130, - 132, 134, 136, 138, 140, 142, 144, 151, 154, 159, - 162, 164, 168, 174, 177, 180, 188, 191, 193, 195, - 197, 199, 204, 206, 208, 210, 212, 214, 216, 218, - 222, 223, 226, 229, 231, 233, 235, 237, 239, 241, - 243, 245, 247, 248, 250, 252, 254, 256, 257, 259, - 261, 263, 265, 267, 269, 274, 277, 280, 282, 285, - 287, 290, 292, 295, 300, 305, 307, 308, 312, 314, - 316, 319, 321, 324, 326, 328, 332, 339, 340, 342, - 345, 350, 352, 356, 358, 360, 362, 364, 366, 368, - 370, 372, 374, 376, 379, 382, 385, 388, 391, 394, - 397, 400, 403, 406, 409, 412, 416, 418, 420, 422, - 428, 430, 432, 434, 437, 439, 441, 444, 446, 449, - 456, 458, 462, 464, 466, 468, 470, 472, 477, 479, - 481, 483, 485, 487, 489, 492, 494, 496, 502, 504, - 507, 509, 511, 517, 520, 521, 528, 532, 533, 535, - 537, 539, 541, 543, 546, 548, 550, 553, 558, 563, - 564, 566, 568, 570, 572, 575, 577, 579, 581, 583, - 589, 591, 595, 601, 607, 609, 613, 619, 621, 623, - 625, 627, 629, 631, 633, 635, 637, 641, 647, 655, - 665, 668, 671, 673, 675, 676, 677, 682, 684, 685, - 686, 690, 694, 696, 702, 705, 708, 711, 714, 718, - 721, 725, 726, 728, 730, 731, 733, 735, 736, 738, - 740, 741, 743, 745, 746, 750, 751, 755, 756, 760, - 762, 764, 766, 771, 773 + 92, 101, 104, 107, 120, 123, 125, 127, 129, 131, + 133, 135, 137, 139, 141, 143, 145, 147, 154, 157, + 162, 165, 167, 171, 177, 181, 184, 192, 195, 197, + 199, 201, 203, 208, 210, 212, 214, 216, 218, 220, + 222, 226, 227, 230, 233, 235, 237, 239, 241, 243, + 245, 247, 249, 251, 252, 254, 256, 258, 260, 261, + 265, 269, 270, 273, 276, 278, 280, 282, 284, 286, + 288, 290, 292, 297, 300, 303, 305, 308, 310, 313, + 315, 318, 323, 328, 330, 331, 335, 337, 339, 342, + 344, 347, 349, 351, 355, 362, 363, 365, 368, 373, + 375, 379, 381, 383, 385, 387, 389, 391, 393, 395, + 397, 399, 402, 405, 408, 411, 414, 417, 420, 423, + 426, 429, 432, 435, 439, 441, 443, 445, 451, 453, + 455, 457, 460, 462, 464, 467, 469, 472, 479, 481, + 485, 487, 489, 491, 493, 495, 500, 502, 504, 506, + 508, 510, 512, 515, 517, 519, 525, 527, 530, 532, + 534, 540, 543, 544, 551, 555, 556, 558, 560, 562, + 564, 566, 569, 571, 573, 576, 581, 586, 587, 589, + 591, 593, 595, 598, 600, 602, 604, 606, 612, 614, + 618, 624, 630, 632, 636, 642, 644, 646, 648, 650, + 652, 654, 656, 658, 660, 664, 670, 678, 688, 691, + 694, 696, 698, 699, 700, 705, 707, 708, 709, 713, + 717, 719, 725, 728, 731, 734, 737, 741, 744, 748, + 749, 751, 753, 754, 756, 758, 759, 761, 763, 764, + 766, 768, 769, 773, 774, 778, 779, 783, 785, 787, + 789, 794, 796 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { - 119, 0, -1, 120, 121, 123, 12, -1, 3, -1, - 4, -1, 121, 122, -1, -1, 8, 255, 108, -1, - 123, 124, -1, -1, 125, 108, -1, 163, 108, -1, - 126, -1, 127, -1, 128, -1, 129, -1, 130, -1, - 131, -1, 132, -1, 133, -1, 139, -1, 134, -1, - 135, -1, 136, -1, 19, 144, 109, 140, -1, 18, - 143, 109, 142, -1, 16, 143, 109, 140, -1, 14, - 143, 109, 140, 109, 140, -1, 13, 143, 109, 142, - 109, 142, -1, 17, 143, 109, 142, 109, 142, 109, - 142, -1, 15, 143, 109, 142, 109, 137, 109, 138, - -1, 20, 142, -1, 22, 143, 109, 142, 109, 142, - 109, 142, 109, 137, 109, 138, -1, 83, 249, -1, - 84, -1, 85, -1, 86, -1, 87, -1, 88, -1, - 89, -1, 90, -1, 91, -1, 92, -1, 93, -1, - 94, -1, 95, -1, 21, 143, 109, 148, 109, 145, - -1, 234, 141, -1, 234, 110, 141, 110, -1, 148, - 160, -1, 231, -1, 234, 148, 161, -1, 234, 110, - 148, 161, 110, -1, 149, 162, -1, 157, 159, -1, - 146, 109, 146, 109, 146, 109, 146, -1, 234, 147, - -1, 23, -1, 255, -1, 100, -1, 165, -1, 150, - 111, 151, 112, -1, 179, -1, 242, -1, 100, -1, - 100, -1, 152, -1, 153, -1, 23, -1, 157, 158, - 154, -1, -1, 113, 155, -1, 114, 156, -1, 23, - -1, 23, -1, 100, -1, 104, -1, 104, -1, 104, - -1, 104, -1, 101, -1, 105, -1, -1, 101, -1, - 102, -1, 103, -1, 104, -1, -1, 164, -1, 171, - -1, 235, -1, 238, -1, 241, -1, 254, -1, 7, - 99, 115, 165, -1, 96, 166, -1, 38, 170, -1, - 60, -1, 98, 168, -1, 53, -1, 29, 247, -1, - 37, -1, 74, 248, -1, 50, 111, 169, 112, -1, - 97, 111, 167, 112, -1, 23, -1, -1, 111, 169, - 112, -1, 23, -1, 60, -1, 29, 247, -1, 37, - -1, 74, 248, -1, 172, -1, 173, -1, 10, 99, - 175, -1, 10, 99, 111, 174, 112, 176, -1, -1, - 23, -1, 115, 178, -1, 115, 116, 177, 117, -1, - 180, -1, 177, 109, 180, -1, 182, -1, 218, -1, - 228, -1, 182, -1, 218, -1, 229, -1, 181, -1, - 219, -1, 228, -1, 182, -1, 73, 206, -1, 73, - 183, -1, 73, 185, -1, 73, 188, -1, 73, 190, - -1, 73, 196, -1, 73, 192, -1, 73, 199, -1, - 73, 201, -1, 73, 203, -1, 73, 205, -1, 73, - 217, -1, 47, 246, 184, -1, 194, -1, 33, -1, - 69, -1, 43, 111, 195, 112, 186, -1, 194, -1, - 60, -1, 26, -1, 72, 187, -1, 40, -1, 32, - -1, 44, 189, -1, 25, -1, 246, 67, -1, 45, - 111, 195, 112, 246, 191, -1, 194, -1, 75, 250, - 193, -1, 29, -1, 25, -1, 31, -1, 71, -1, - 23, -1, 76, 248, 197, 198, -1, 35, -1, 54, - -1, 79, -1, 80, -1, 78, -1, 77, -1, 36, - 200, -1, 29, -1, 56, -1, 28, 111, 202, 112, - 57, -1, 23, -1, 58, 204, -1, 70, -1, 26, - -1, 208, 66, 111, 211, 112, -1, 208, 207, -1, - -1, 66, 111, 211, 106, 211, 112, -1, 49, 212, - 209, -1, -1, 210, -1, 41, -1, 82, -1, 42, - -1, 23, -1, 51, 213, -1, 63, -1, 52, -1, - 81, 248, -1, 55, 111, 215, 112, -1, 48, 111, - 216, 112, -1, -1, 214, -1, 23, -1, 23, -1, - 23, -1, 30, 64, -1, 222, -1, 225, -1, 220, - -1, 223, -1, 62, 34, 111, 221, 112, -1, 226, - -1, 226, 106, 226, -1, 62, 34, 111, 226, 112, - -1, 62, 46, 111, 224, 112, -1, 227, -1, 227, - 106, 227, -1, 62, 46, 111, 227, 112, -1, 23, - -1, 23, -1, 230, -1, 232, -1, 231, -1, 232, - -1, 233, -1, 24, -1, 23, -1, 116, 233, 117, - -1, 116, 233, 109, 233, 117, -1, 116, 233, 109, - 233, 109, 233, 117, -1, 116, 233, 109, 233, 109, - 233, 109, 233, 117, -1, 234, 24, -1, 234, 23, - -1, 113, -1, 114, -1, -1, -1, 237, 11, 236, - 240, -1, 255, -1, -1, -1, 5, 239, 240, -1, - 240, 109, 99, -1, 99, -1, 237, 9, 99, 115, - 242, -1, 65, 60, -1, 65, 37, -1, 65, 243, - -1, 65, 59, -1, 65, 74, 248, -1, 65, 30, - -1, 29, 244, 245, -1, -1, 39, -1, 27, -1, - -1, 61, -1, 68, -1, -1, 39, -1, 27, -1, - -1, 61, -1, 68, -1, -1, 111, 251, 112, -1, - -1, 111, 252, 112, -1, -1, 111, 253, 112, -1, - 23, -1, 23, -1, 23, -1, 6, 99, 115, 100, - -1, 99, -1, 100, -1 + 121, 0, -1, 122, 123, 125, 12, -1, 3, -1, + 4, -1, 123, 124, -1, -1, 8, 262, 108, -1, + 125, 126, -1, -1, 127, 108, -1, 170, 108, -1, + 128, -1, 129, -1, 130, -1, 131, -1, 132, -1, + 133, -1, 134, -1, 135, -1, 141, -1, 136, -1, + 137, -1, 138, -1, 19, 146, 109, 142, -1, 18, + 145, 109, 144, -1, 16, 145, 109, 142, -1, 14, + 145, 109, 142, 109, 142, -1, 13, 145, 109, 144, + 109, 144, -1, 17, 145, 109, 144, 109, 144, 109, + 144, -1, 15, 145, 109, 144, 109, 139, 109, 140, + -1, 20, 144, -1, 20, 166, -1, 22, 145, 109, + 144, 109, 144, 109, 144, 109, 139, 109, 140, -1, + 83, 256, -1, 84, -1, 85, -1, 86, -1, 87, + -1, 88, -1, 89, -1, 90, -1, 91, -1, 92, + -1, 93, -1, 94, -1, 95, -1, 21, 145, 109, + 150, 109, 147, -1, 241, 143, -1, 241, 110, 143, + 110, -1, 150, 162, -1, 238, -1, 241, 150, 163, + -1, 241, 110, 150, 163, 110, -1, 151, 164, 165, + -1, 159, 161, -1, 148, 109, 148, 109, 148, 109, + 148, -1, 241, 149, -1, 23, -1, 262, -1, 100, + -1, 172, -1, 152, 111, 153, 112, -1, 186, -1, + 249, -1, 100, -1, 100, -1, 154, -1, 155, -1, + 23, -1, 159, 160, 156, -1, -1, 113, 157, -1, + 114, 158, -1, 23, -1, 23, -1, 100, -1, 104, + -1, 104, -1, 104, -1, 104, -1, 101, -1, 105, + -1, -1, 101, -1, 102, -1, 103, -1, 104, -1, + -1, 115, 166, 116, -1, 115, 167, 116, -1, -1, + 168, 163, -1, 169, 163, -1, 99, -1, 100, -1, + 171, -1, 178, -1, 242, -1, 245, -1, 248, -1, + 261, -1, 7, 99, 117, 172, -1, 96, 173, -1, + 38, 177, -1, 60, -1, 98, 175, -1, 53, -1, + 29, 254, -1, 37, -1, 74, 255, -1, 50, 111, + 176, 112, -1, 97, 111, 174, 112, -1, 23, -1, + -1, 111, 176, 112, -1, 23, -1, 60, -1, 29, + 254, -1, 37, -1, 74, 255, -1, 179, -1, 180, + -1, 10, 99, 182, -1, 10, 99, 111, 181, 112, + 183, -1, -1, 23, -1, 117, 185, -1, 117, 118, + 184, 119, -1, 187, -1, 184, 109, 187, -1, 189, + -1, 225, -1, 235, -1, 189, -1, 225, -1, 236, + -1, 188, -1, 226, -1, 235, -1, 189, -1, 73, + 213, -1, 73, 190, -1, 73, 192, -1, 73, 195, + -1, 73, 197, -1, 73, 203, -1, 73, 199, -1, + 73, 206, -1, 73, 208, -1, 73, 210, -1, 73, + 212, -1, 73, 224, -1, 47, 253, 191, -1, 201, + -1, 33, -1, 69, -1, 43, 111, 202, 112, 193, + -1, 201, -1, 60, -1, 26, -1, 72, 194, -1, + 40, -1, 32, -1, 44, 196, -1, 25, -1, 253, + 67, -1, 45, 111, 202, 112, 253, 198, -1, 201, + -1, 75, 257, 200, -1, 29, -1, 25, -1, 31, + -1, 71, -1, 23, -1, 76, 255, 204, 205, -1, + 35, -1, 54, -1, 79, -1, 80, -1, 78, -1, + 77, -1, 36, 207, -1, 29, -1, 56, -1, 28, + 111, 209, 112, 57, -1, 23, -1, 58, 211, -1, + 70, -1, 26, -1, 215, 66, 111, 218, 112, -1, + 215, 214, -1, -1, 66, 111, 218, 106, 218, 112, + -1, 49, 219, 216, -1, -1, 217, -1, 41, -1, + 82, -1, 42, -1, 23, -1, 51, 220, -1, 63, + -1, 52, -1, 81, 255, -1, 55, 111, 222, 112, + -1, 48, 111, 223, 112, -1, -1, 221, -1, 23, + -1, 23, -1, 23, -1, 30, 64, -1, 229, -1, + 232, -1, 227, -1, 230, -1, 62, 34, 111, 228, + 112, -1, 233, -1, 233, 106, 233, -1, 62, 34, + 111, 233, 112, -1, 62, 46, 111, 231, 112, -1, + 234, -1, 234, 106, 234, -1, 62, 46, 111, 234, + 112, -1, 23, -1, 23, -1, 237, -1, 239, -1, + 238, -1, 239, -1, 240, -1, 24, -1, 23, -1, + 118, 240, 119, -1, 118, 240, 109, 240, 119, -1, + 118, 240, 109, 240, 109, 240, 119, -1, 118, 240, + 109, 240, 109, 240, 109, 240, 119, -1, 241, 24, + -1, 241, 23, -1, 113, -1, 114, -1, -1, -1, + 244, 11, 243, 247, -1, 262, -1, -1, -1, 5, + 246, 247, -1, 247, 109, 99, -1, 99, -1, 244, + 9, 99, 117, 249, -1, 65, 60, -1, 65, 37, + -1, 65, 250, -1, 65, 59, -1, 65, 74, 255, + -1, 65, 30, -1, 29, 251, 252, -1, -1, 39, + -1, 27, -1, -1, 61, -1, 68, -1, -1, 39, + -1, 27, -1, -1, 61, -1, 68, -1, -1, 111, + 258, 112, -1, -1, 111, 259, 112, -1, -1, 111, + 260, 112, -1, 23, -1, 23, -1, 23, -1, 6, + 99, 117, 100, -1, 99, -1, 100, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 266, 266, 269, 277, 289, 290, 293, 315, 316, - 319, 334, 337, 342, 349, 350, 351, 352, 353, 354, - 355, 358, 359, 360, 363, 369, 375, 381, 388, 394, - 401, 445, 452, 496, 502, 503, 504, 505, 506, 507, - 508, 509, 510, 511, 512, 513, 516, 528, 536, 553, - 560, 579, 590, 610, 632, 641, 674, 681, 696, 746, - 788, 799, 820, 830, 836, 867, 884, 884, 886, 893, - 905, 906, 907, 910, 922, 934, 952, 963, 975, 977, - 978, 979, 980, 983, 983, 983, 983, 984, 987, 988, - 989, 990, 991, 992, 995, 1013, 1017, 1023, 1027, 1031, - 1035, 1044, 1053, 1057, 1062, 1068, 1079, 1079, 1080, 1082, - 1086, 1090, 1094, 1100, 1100, 1102, 1118, 1141, 1144, 1155, - 1161, 1167, 1168, 1175, 1181, 1187, 1195, 1201, 1207, 1215, - 1221, 1227, 1235, 1236, 1239, 1240, 1241, 1242, 1243, 1244, - 1245, 1246, 1247, 1248, 1249, 1252, 1261, 1265, 1269, 1275, - 1284, 1288, 1292, 1301, 1305, 1311, 1317, 1324, 1329, 1337, - 1347, 1349, 1357, 1363, 1367, 1371, 1377, 1388, 1397, 1401, - 1406, 1410, 1414, 1418, 1424, 1431, 1435, 1441, 1449, 1460, - 1467, 1471, 1477, 1487, 1498, 1502, 1520, 1529, 1532, 1538, - 1542, 1546, 1552, 1563, 1568, 1573, 1578, 1583, 1588, 1596, - 1599, 1604, 1617, 1625, 1636, 1644, 1644, 1646, 1646, 1648, - 1658, 1663, 1670, 1680, 1689, 1694, 1701, 1711, 1721, 1733, - 1733, 1734, 1734, 1736, 1746, 1754, 1764, 1772, 1780, 1789, - 1800, 1804, 1810, 1811, 1812, 1815, 1815, 1818, 1853, 1857, - 1857, 1860, 1866, 1874, 1887, 1896, 1905, 1909, 1918, 1927, - 1938, 1945, 1950, 1959, 1971, 1974, 1983, 1994, 1995, 1996, - 1999, 2000, 2001, 2004, 2005, 2008, 2009, 2012, 2013, 2016, - 2027, 2038, 2049, 2070, 2071 + 0, 268, 268, 271, 279, 291, 292, 295, 317, 318, + 321, 336, 339, 344, 351, 352, 353, 354, 355, 356, + 357, 360, 361, 362, 365, 371, 377, 383, 390, 396, + 403, 447, 452, 462, 506, 512, 513, 514, 515, 516, + 517, 518, 519, 520, 521, 522, 523, 526, 538, 546, + 563, 570, 589, 600, 620, 645, 654, 687, 694, 709, + 759, 801, 812, 833, 843, 849, 880, 897, 897, 899, + 906, 918, 919, 920, 923, 935, 947, 965, 976, 988, + 990, 991, 992, 993, 996, 996, 996, 996, 997, 1000, + 1004, 1009, 1016, 1023, 1030, 1053, 1076, 1077, 1078, 1079, + 1080, 1081, 1084, 1102, 1106, 1112, 1116, 1120, 1124, 1133, + 1142, 1146, 1151, 1157, 1168, 1168, 1169, 1171, 1175, 1179, + 1183, 1189, 1189, 1191, 1207, 1230, 1233, 1244, 1250, 1256, + 1257, 1264, 1270, 1276, 1284, 1290, 1296, 1304, 1310, 1316, + 1324, 1325, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, + 1336, 1337, 1338, 1341, 1350, 1354, 1358, 1364, 1373, 1377, + 1381, 1390, 1394, 1400, 1406, 1413, 1418, 1426, 1436, 1438, + 1446, 1452, 1456, 1460, 1466, 1477, 1486, 1490, 1495, 1499, + 1503, 1507, 1513, 1520, 1524, 1530, 1538, 1549, 1556, 1560, + 1566, 1576, 1587, 1591, 1609, 1618, 1621, 1627, 1631, 1635, + 1641, 1652, 1657, 1662, 1667, 1672, 1677, 1685, 1688, 1693, + 1706, 1714, 1725, 1733, 1733, 1735, 1735, 1737, 1747, 1752, + 1759, 1769, 1778, 1783, 1790, 1800, 1810, 1822, 1822, 1823, + 1823, 1825, 1835, 1843, 1853, 1861, 1869, 1878, 1889, 1893, + 1899, 1900, 1901, 1904, 1904, 1907, 1942, 1946, 1946, 1949, + 1955, 1963, 1976, 1985, 1994, 1998, 2007, 2016, 2027, 2034, + 2039, 2048, 2060, 2063, 2072, 2083, 2084, 2085, 2088, 2089, + 2090, 2093, 2094, 2097, 2098, 2101, 2102, 2105, 2116, 2127, + 2138, 2159, 2160 }; #endif @@ -833,8 +837,8 @@ static const char *const yytname[] = "TEX_ARRAYSHADOW1D", "TEX_ARRAYSHADOW2D", "VERTEX", "VTXATTRIB", "WEIGHT", "IDENTIFIER", "USED_IDENTIFIER", "MASK4", "MASK3", "MASK2", "MASK1", "SWIZZLE", "DOT_DOT", "DOT", "';'", "','", "'|'", "'['", "']'", - "'+'", "'-'", "'='", "'{'", "'}'", "$accept", "program", "language", - "optionSequence", "option", "statementSequence", "statement", + "'+'", "'-'", "'('", "')'", "'='", "'{'", "'}'", "$accept", "program", + "language", "optionSequence", "option", "statementSequence", "statement", "instruction", "ALU_instruction", "TexInstruction", "ARL_instruction", "VECTORop_instruction", "SCALARop_instruction", "BINSCop_instruction", "BINop_instruction", "TRIop_instruction", "SAMPLE_instruction", @@ -845,6 +849,7 @@ static const char *const yytname[] = "progParamArrayAbs", "progParamArrayRel", "addrRegRelOffset", "addrRegPosOffset", "addrRegNegOffset", "addrReg", "addrComponent", "addrWriteMask", "scalarSuffix", "swizzleSuffix", "optionalMask", + "optionalCcMask", "ccTest", "ccTest2", "ccMaskRule", "ccMaskRule2", "namingStatement", "ATTRIB_statement", "attribBinding", "vtxAttribItem", "vtxAttribNum", "vtxOptWeightNum", "vtxWeightNum", "fragAttribItem", "PARAM_statement", "PARAM_singleStmt", "PARAM_multipleStmt", @@ -894,41 +899,42 @@ static const yytype_uint16 yytoknum[] = 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 59, 44, - 124, 91, 93, 43, 45, 61, 123, 125 + 124, 91, 93, 43, 45, 40, 41, 61, 123, 125 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = +static const yytype_uint16 yyr1[] = { - 0, 118, 119, 120, 120, 121, 121, 122, 123, 123, - 124, 124, 125, 125, 126, 126, 126, 126, 126, 126, - 126, 127, 127, 127, 128, 129, 130, 131, 132, 133, - 134, 135, 136, 137, 138, 138, 138, 138, 138, 138, - 138, 138, 138, 138, 138, 138, 139, 140, 140, 141, - 141, 142, 142, 143, 144, 145, 146, 147, 147, 148, - 148, 148, 148, 149, 149, 150, 151, 151, 152, 153, - 154, 154, 154, 155, 156, 157, 158, 159, 160, 161, - 161, 161, 161, 162, 162, 162, 162, 162, 163, 163, - 163, 163, 163, 163, 164, 165, 165, 166, 166, 166, - 166, 166, 166, 166, 166, 167, 168, 168, 169, 170, - 170, 170, 170, 171, 171, 172, 173, 174, 174, 175, - 176, 177, 177, 178, 178, 178, 179, 179, 179, 180, - 180, 180, 181, 181, 182, 182, 182, 182, 182, 182, - 182, 182, 182, 182, 182, 183, 184, 184, 184, 185, - 186, 186, 186, 186, 186, 187, 188, 189, 189, 190, - 191, 192, 193, 194, 194, 194, 195, 196, 197, 197, - 198, 198, 198, 198, 199, 200, 200, 201, 202, 203, - 204, 204, 205, 206, 207, 207, 208, 209, 209, 210, - 210, 210, 211, 212, 212, 212, 212, 212, 212, 213, - 213, 214, 215, 216, 217, 218, 218, 219, 219, 220, - 221, 221, 222, 223, 224, 224, 225, 226, 227, 228, - 228, 229, 229, 230, 231, 231, 232, 232, 232, 232, - 233, 233, 234, 234, 234, 236, 235, 237, 237, 239, - 238, 240, 240, 241, 242, 242, 242, 242, 242, 242, - 243, 244, 244, 244, 245, 245, 245, 246, 246, 246, - 247, 247, 247, 248, 248, 249, 249, 250, 250, 251, - 252, 253, 254, 255, 255 + 0, 120, 121, 122, 122, 123, 123, 124, 125, 125, + 126, 126, 127, 127, 128, 128, 128, 128, 128, 128, + 128, 129, 129, 129, 130, 131, 132, 133, 134, 135, + 136, 137, 137, 138, 139, 140, 140, 140, 140, 140, + 140, 140, 140, 140, 140, 140, 140, 141, 142, 142, + 143, 143, 144, 144, 145, 146, 147, 148, 149, 149, + 150, 150, 150, 150, 151, 151, 152, 153, 153, 154, + 155, 156, 156, 156, 157, 158, 159, 160, 161, 162, + 163, 163, 163, 163, 164, 164, 164, 164, 164, 165, + 165, 165, 166, 167, 168, 169, 170, 170, 170, 170, + 170, 170, 171, 172, 172, 173, 173, 173, 173, 173, + 173, 173, 173, 174, 175, 175, 176, 177, 177, 177, + 177, 178, 178, 179, 180, 181, 181, 182, 183, 184, + 184, 185, 185, 185, 186, 186, 186, 187, 187, 187, + 188, 188, 189, 189, 189, 189, 189, 189, 189, 189, + 189, 189, 189, 190, 191, 191, 191, 192, 193, 193, + 193, 193, 193, 194, 195, 196, 196, 197, 198, 199, + 200, 201, 201, 201, 202, 203, 204, 204, 205, 205, + 205, 205, 206, 207, 207, 208, 209, 210, 211, 211, + 212, 213, 214, 214, 215, 216, 216, 217, 217, 217, + 218, 219, 219, 219, 219, 219, 219, 220, 220, 221, + 222, 223, 224, 225, 225, 226, 226, 227, 228, 228, + 229, 230, 231, 231, 232, 233, 234, 235, 235, 236, + 236, 237, 238, 238, 239, 239, 239, 239, 240, 240, + 241, 241, 241, 243, 242, 244, 244, 246, 245, 247, + 247, 248, 249, 249, 249, 249, 249, 249, 250, 251, + 251, 251, 252, 252, 252, 253, 253, 253, 254, 254, + 254, 255, 255, 256, 256, 257, 257, 258, 259, 260, + 261, 262, 262 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -937,31 +943,32 @@ static const yytype_uint8 yyr2[] = 0, 2, 4, 1, 1, 2, 0, 3, 2, 0, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 6, 6, 8, - 8, 2, 12, 2, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 6, 2, 4, 2, - 1, 3, 5, 2, 2, 7, 2, 1, 1, 1, - 1, 4, 1, 1, 1, 1, 1, 1, 1, 3, - 0, 2, 2, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, - 1, 1, 1, 1, 4, 2, 2, 1, 2, 1, - 2, 1, 2, 4, 4, 1, 0, 3, 1, 1, - 2, 1, 2, 1, 1, 3, 6, 0, 1, 2, - 4, 1, 3, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 3, 1, 1, 1, 5, - 1, 1, 1, 2, 1, 1, 2, 1, 2, 6, - 1, 3, 1, 1, 1, 1, 1, 4, 1, 1, - 1, 1, 1, 1, 2, 1, 1, 5, 1, 2, - 1, 1, 5, 2, 0, 6, 3, 0, 1, 1, - 1, 1, 1, 2, 1, 1, 2, 4, 4, 0, - 1, 1, 1, 1, 2, 1, 1, 1, 1, 5, - 1, 3, 5, 5, 1, 3, 5, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 3, 5, 7, 9, - 2, 2, 1, 1, 0, 0, 4, 1, 0, 0, - 3, 3, 1, 5, 2, 2, 2, 2, 3, 2, - 3, 0, 1, 1, 0, 1, 1, 0, 1, 1, - 0, 1, 1, 0, 3, 0, 3, 0, 3, 1, - 1, 1, 4, 1, 1 + 8, 2, 2, 12, 2, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 6, 2, 4, + 2, 1, 3, 5, 3, 2, 7, 2, 1, 1, + 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, + 3, 0, 2, 2, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 0, 1, 1, 1, 1, 0, 3, + 3, 0, 2, 2, 1, 1, 1, 1, 1, 1, + 1, 1, 4, 2, 2, 1, 2, 1, 2, 1, + 2, 4, 4, 1, 0, 3, 1, 1, 2, 1, + 2, 1, 1, 3, 6, 0, 1, 2, 4, 1, + 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 3, 1, 1, 1, 5, 1, 1, + 1, 2, 1, 1, 2, 1, 2, 6, 1, 3, + 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, + 1, 1, 2, 1, 1, 5, 1, 2, 1, 1, + 5, 2, 0, 6, 3, 0, 1, 1, 1, 1, + 1, 2, 1, 1, 2, 4, 4, 0, 1, 1, + 1, 1, 2, 1, 1, 1, 1, 5, 1, 3, + 5, 5, 1, 3, 5, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 3, 5, 7, 9, 2, 2, + 1, 1, 0, 0, 4, 1, 0, 0, 3, 3, + 1, 5, 2, 2, 2, 2, 3, 2, 3, 0, + 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, + 1, 0, 3, 0, 3, 0, 3, 1, 1, 1, + 4, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state @@ -969,288 +976,296 @@ static const yytype_uint8 yyr2[] = means the default is an error. */ static const yytype_uint16 yydefact[] = { - 0, 3, 4, 0, 6, 1, 9, 0, 5, 238, - 273, 274, 0, 239, 0, 0, 0, 2, 0, 0, - 0, 0, 0, 0, 0, 234, 0, 0, 8, 0, + 0, 3, 4, 0, 6, 1, 9, 0, 5, 246, + 281, 282, 0, 247, 0, 0, 0, 2, 0, 0, + 0, 0, 0, 0, 0, 242, 0, 0, 8, 0, 12, 13, 14, 15, 16, 17, 18, 19, 21, 22, - 23, 20, 0, 88, 89, 113, 114, 90, 0, 91, - 92, 93, 237, 7, 0, 0, 0, 0, 0, 64, - 0, 87, 63, 0, 0, 0, 0, 0, 75, 0, - 0, 232, 233, 31, 0, 0, 0, 10, 11, 0, - 235, 242, 240, 0, 0, 117, 234, 115, 251, 249, - 245, 247, 244, 263, 246, 234, 83, 84, 85, 86, - 53, 234, 234, 234, 234, 234, 234, 77, 54, 225, - 224, 0, 0, 0, 0, 59, 0, 234, 82, 0, - 60, 62, 126, 127, 205, 206, 128, 221, 222, 0, - 234, 0, 0, 0, 272, 94, 118, 0, 119, 123, - 124, 125, 219, 220, 223, 0, 253, 252, 254, 0, - 248, 0, 0, 0, 0, 26, 0, 25, 24, 260, - 111, 109, 263, 96, 0, 0, 0, 0, 0, 0, - 257, 0, 257, 0, 0, 267, 263, 134, 135, 136, - 137, 139, 138, 140, 141, 142, 143, 0, 144, 260, - 101, 0, 99, 97, 263, 0, 106, 95, 82, 0, - 80, 79, 81, 51, 0, 0, 0, 0, 236, 241, - 0, 231, 230, 255, 256, 250, 269, 0, 234, 234, - 0, 47, 0, 50, 0, 234, 261, 262, 110, 112, - 0, 0, 0, 204, 175, 176, 174, 0, 157, 259, - 258, 156, 0, 0, 0, 0, 199, 195, 0, 194, - 263, 187, 181, 180, 179, 0, 0, 0, 0, 100, - 0, 102, 0, 0, 98, 0, 234, 226, 68, 0, - 66, 67, 0, 234, 234, 243, 0, 116, 264, 28, - 27, 0, 78, 49, 265, 0, 0, 217, 0, 218, - 0, 178, 0, 166, 0, 158, 0, 163, 164, 147, - 148, 165, 145, 146, 0, 201, 193, 200, 0, 196, - 189, 191, 190, 186, 188, 271, 0, 162, 161, 168, - 169, 0, 0, 108, 0, 105, 0, 0, 52, 0, - 61, 76, 70, 46, 0, 0, 0, 234, 48, 0, - 33, 0, 234, 212, 216, 0, 0, 257, 203, 0, - 202, 0, 268, 173, 172, 170, 171, 167, 192, 0, - 103, 104, 107, 234, 227, 0, 0, 69, 234, 57, - 56, 58, 234, 0, 0, 0, 121, 129, 132, 130, - 207, 208, 131, 270, 0, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 30, 29, 177, - 152, 154, 151, 0, 149, 150, 0, 198, 197, 182, - 0, 73, 71, 74, 72, 0, 0, 0, 0, 133, - 184, 234, 120, 266, 155, 153, 159, 160, 234, 228, - 234, 0, 0, 0, 0, 183, 122, 0, 0, 0, - 0, 210, 0, 214, 0, 229, 234, 0, 209, 0, - 213, 0, 0, 55, 32, 211, 215, 0, 0, 185 + 23, 20, 0, 96, 97, 121, 122, 98, 0, 99, + 100, 101, 245, 7, 0, 0, 0, 0, 0, 65, + 0, 88, 64, 0, 0, 0, 0, 0, 76, 0, + 0, 94, 240, 241, 31, 32, 83, 0, 0, 0, + 10, 11, 0, 243, 250, 248, 0, 0, 125, 242, + 123, 259, 257, 253, 255, 252, 271, 254, 242, 84, + 85, 86, 87, 91, 242, 242, 242, 242, 242, 242, + 78, 55, 81, 80, 82, 92, 233, 232, 0, 0, + 0, 0, 60, 0, 242, 83, 0, 61, 63, 134, + 135, 213, 214, 136, 229, 230, 0, 242, 0, 0, + 0, 280, 102, 126, 0, 127, 131, 132, 133, 227, + 228, 231, 0, 261, 260, 262, 0, 256, 0, 0, + 54, 0, 0, 0, 26, 0, 25, 24, 268, 119, + 117, 271, 104, 0, 0, 0, 0, 0, 0, 265, + 0, 265, 0, 0, 275, 271, 142, 143, 144, 145, + 147, 146, 148, 149, 150, 151, 0, 152, 268, 109, + 0, 107, 105, 271, 0, 114, 103, 83, 0, 52, + 0, 0, 0, 0, 244, 249, 0, 239, 238, 263, + 264, 258, 277, 0, 242, 95, 0, 0, 83, 242, + 0, 48, 0, 51, 0, 242, 269, 270, 118, 120, + 0, 0, 0, 212, 183, 184, 182, 0, 165, 267, + 266, 164, 0, 0, 0, 0, 207, 203, 0, 202, + 271, 195, 189, 188, 187, 0, 0, 0, 0, 108, + 0, 110, 0, 0, 106, 0, 242, 234, 69, 0, + 67, 68, 0, 242, 242, 251, 0, 124, 272, 28, + 89, 90, 93, 27, 0, 79, 50, 273, 0, 0, + 225, 0, 226, 0, 186, 0, 174, 0, 166, 0, + 171, 172, 155, 156, 173, 153, 154, 0, 209, 201, + 208, 0, 204, 197, 199, 198, 194, 196, 279, 0, + 170, 169, 176, 177, 0, 0, 116, 0, 113, 0, + 0, 53, 0, 62, 77, 71, 47, 0, 0, 0, + 242, 49, 0, 34, 0, 242, 220, 224, 0, 0, + 265, 211, 0, 210, 0, 276, 181, 180, 178, 179, + 175, 200, 0, 111, 112, 115, 242, 235, 0, 0, + 70, 242, 58, 57, 59, 242, 0, 0, 0, 129, + 137, 140, 138, 215, 216, 139, 278, 0, 35, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, + 30, 29, 185, 160, 162, 159, 0, 157, 158, 0, + 206, 205, 190, 0, 74, 72, 75, 73, 0, 0, + 0, 0, 141, 192, 242, 128, 274, 163, 161, 167, + 168, 242, 236, 242, 0, 0, 0, 0, 191, 130, + 0, 0, 0, 0, 218, 0, 222, 0, 237, 242, + 0, 217, 0, 221, 0, 0, 56, 33, 219, 223, + 0, 0, 193 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 3, 4, 6, 8, 9, 28, 29, 30, 31, - 32, 33, 34, 35, 36, 37, 38, 39, 40, 285, - 397, 41, 152, 221, 73, 60, 69, 333, 334, 370, - 222, 61, 119, 269, 270, 271, 367, 412, 414, 70, - 332, 108, 283, 203, 100, 42, 43, 120, 197, 326, - 264, 324, 163, 44, 45, 46, 137, 87, 277, 375, - 138, 121, 376, 377, 122, 177, 302, 178, 404, 425, - 179, 241, 180, 426, 181, 318, 303, 294, 182, 321, - 357, 183, 236, 184, 292, 185, 254, 186, 419, 435, - 187, 313, 314, 359, 251, 306, 307, 351, 349, 188, - 123, 379, 380, 440, 124, 381, 442, 125, 288, 290, - 382, 126, 142, 127, 128, 144, 74, 47, 132, 48, - 49, 54, 82, 50, 62, 94, 148, 215, 242, 228, - 150, 340, 256, 217, 384, 316, 51, 12 + 32, 33, 34, 35, 36, 37, 38, 39, 40, 298, + 410, 41, 161, 231, 74, 60, 69, 346, 347, 383, + 232, 61, 126, 279, 280, 281, 380, 425, 427, 70, + 345, 111, 296, 115, 103, 160, 75, 227, 76, 228, + 42, 43, 127, 206, 339, 274, 337, 172, 44, 45, + 46, 144, 90, 287, 388, 145, 128, 389, 390, 129, + 186, 315, 187, 417, 438, 188, 251, 189, 439, 190, + 331, 316, 307, 191, 334, 370, 192, 246, 193, 305, + 194, 264, 195, 432, 448, 196, 326, 327, 372, 261, + 319, 320, 364, 362, 197, 130, 392, 393, 453, 131, + 394, 455, 132, 301, 303, 395, 133, 149, 134, 135, + 151, 77, 47, 139, 48, 49, 54, 85, 50, 62, + 97, 155, 221, 252, 238, 157, 353, 266, 223, 397, + 329, 51, 12 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ -#define YYPACT_NINF -401 +#define YYPACT_NINF -387 static const yytype_int16 yypact[] = { - 122, -401, -401, 49, -401, -401, 56, 61, -401, 20, - -401, -401, -5, -401, 7, 45, 78, -401, -47, -47, - -47, -47, -47, -47, 79, 85, -47, -47, -401, 99, - -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, - -401, -401, 127, -401, -401, -401, -401, -401, 120, -401, - -401, -401, -401, -401, 135, 133, 134, 25, 129, -401, - 138, 137, -401, 145, 146, 147, 148, 151, -401, 152, - 154, -401, -401, -401, -14, 153, 155, -401, -401, 143, - -401, -401, 156, 163, 14, 243, 32, -401, 31, -401, - -401, -401, -401, 157, -401, 85, -401, -401, -401, -401, - -401, 85, 85, 85, 85, 85, 85, -401, -401, -401, - -401, 112, 149, 126, 54, 158, 27, 85, 132, 159, - -401, -401, -401, -401, -401, -401, -401, -401, -401, 27, - 85, 160, 135, 168, -401, -401, -401, 161, -401, -401, - -401, -401, -401, -401, -401, 198, -401, -401, 89, 248, - -401, 167, 169, 22, 170, -401, 171, -401, -401, 117, - -401, -401, 157, -401, 172, 173, 174, 208, -1, 175, - 53, 176, 165, 142, -3, 177, 157, -401, -401, -401, - -401, -401, -401, -401, -401, -401, -401, 215, -401, 117, - -401, 179, -401, -401, 157, 180, 181, -401, 132, -38, - -401, -401, -401, -401, -10, 184, 185, 209, 156, -401, - 182, -401, -401, -401, -401, -401, -401, 183, 85, 85, - 27, -401, 192, 194, 216, 85, -401, -401, -401, -401, - 277, 278, 279, -401, -401, -401, -401, 280, -401, -401, - -401, -401, 237, 280, 68, 195, 282, -401, 196, -401, - 157, 33, -401, -401, -401, 285, 281, 19, 200, -401, - 286, -401, 289, 286, -401, 203, 85, -401, -401, 202, - -401, -401, 212, 85, 85, -401, 201, -401, -401, -401, - -401, 210, -401, -401, 207, 213, 214, -401, 218, -401, - 219, -401, 220, -401, 221, -401, 222, -401, -401, -401, - -401, -401, -401, -401, 296, -401, -401, -401, 298, -401, - -401, -401, -401, -401, -401, -401, 226, -401, -401, -401, - -401, 166, 301, -401, 227, -401, 228, 229, -401, 46, - -401, -401, 116, -401, 217, -12, 234, 51, -401, 302, - -401, 125, 85, -401, -401, 270, 37, 165, -401, 233, - -401, 235, -401, -401, -401, -401, -401, -401, -401, 236, - -401, -401, -401, 85, -401, 305, 323, -401, 85, -401, - -401, -401, 85, 162, 126, 59, -401, -401, -401, -401, - -401, -401, -401, -401, 238, -401, -401, -401, -401, -401, - -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, - -401, -401, -401, 317, -401, -401, 41, -401, -401, -401, - 65, -401, -401, -401, -401, 242, 244, 241, 245, -401, - 288, 51, -401, -401, -401, -401, -401, -401, 85, -401, - 85, 216, 277, 278, 246, -401, -401, 247, 249, 250, - 251, 255, 253, 256, 301, -401, 85, 125, -401, 277, - -401, 278, 94, -401, -401, -401, -401, 301, 254, -401 + 202, -387, -387, 67, -387, -387, 73, -73, -387, 24, + -387, -387, -4, -387, 78, 84, 127, -387, -18, -18, + -18, -18, -18, -18, 66, 44, -18, -18, -387, 138, + -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, + -387, -387, 144, -387, -387, -387, -387, -387, 236, -387, + -387, -387, -387, -387, 154, 140, 141, 10, 133, -387, + 145, 136, -387, 150, 151, 155, 156, 157, -387, 158, + 166, -387, -387, -387, -387, -387, 131, -13, 159, 162, + -387, -387, 173, -387, -387, 165, 175, 23, 232, 0, + -387, 125, -387, -387, -387, -387, 167, -387, 116, -387, + -387, -387, -387, 161, 116, 116, 116, 116, 116, 116, + -387, -387, -387, -387, -387, -387, -387, -387, 105, 98, + 92, 19, 168, 30, 116, 131, 169, -387, -387, -387, + -387, -387, -387, -387, -387, -387, 30, 116, 160, 154, + 174, -387, -387, -387, 170, -387, -387, -387, -387, -387, + -387, -387, 210, -387, -387, 134, 258, -387, 176, 149, + -387, 177, -10, 179, -387, 180, -387, -387, 135, -387, + -387, 167, -387, 172, 182, 183, 220, 46, 184, 106, + 185, 146, 123, 7, 186, 167, -387, -387, -387, -387, + -387, -387, -387, -387, -387, -387, 224, -387, 135, -387, + 187, -387, -387, 167, 189, 190, -387, 131, -45, -387, + 1, 193, 194, 226, 165, -387, 188, -387, -387, -387, + -387, -387, -387, 192, 116, -387, 191, 195, 131, 116, + 30, -387, 204, 205, 223, 116, -387, -387, -387, -387, + 287, 289, 290, -387, -387, -387, -387, 291, -387, -387, + -387, -387, 248, 291, 128, 206, 293, -387, 207, -387, + 167, 16, -387, -387, -387, 296, 294, 45, 209, -387, + 299, -387, 301, 299, -387, 215, 116, -387, -387, 214, + -387, -387, 225, 116, 116, -387, 212, -387, -387, -387, + -387, -387, -387, -387, 217, -387, -387, 221, 219, 222, + -387, 227, -387, 228, -387, 229, -387, 231, -387, 237, + -387, -387, -387, -387, -387, -387, -387, 310, -387, -387, + -387, 311, -387, -387, -387, -387, -387, -387, -387, 238, + -387, -387, -387, -387, 164, 312, -387, 239, -387, 241, + 243, -387, 63, -387, -387, 137, -387, 235, -15, 247, + 33, -387, 313, -387, 124, 116, -387, -387, 280, 129, + 146, -387, 245, -387, 246, -387, -387, -387, -387, -387, + -387, -387, 249, -387, -387, -387, 116, -387, 315, 325, + -387, 116, -387, -387, -387, 116, 142, 92, 71, -387, + -387, -387, -387, -387, -387, -387, -387, 250, -387, -387, + -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, + -387, -387, -387, -387, -387, -387, 327, -387, -387, 40, + -387, -387, -387, 72, -387, -387, -387, -387, 251, 254, + 253, 255, -387, 302, 33, -387, -387, -387, -387, -387, + -387, 116, -387, 116, 223, 287, 289, 256, -387, -387, + 252, 260, 263, 261, 259, 262, 269, 312, -387, 116, + 124, -387, 287, -387, 289, 119, -387, -387, -387, -387, + 312, 264, -387 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { - -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, - -401, -401, -401, -401, -401, -401, -401, -401, -401, -76, - -80, -401, -98, 150, -83, 205, -401, -401, -361, -401, - -18, -401, -401, -401, -401, -401, -401, -401, -401, 164, - -401, -401, -401, 178, -401, -401, -401, 287, -401, -401, - -401, 106, -401, -401, -401, -401, -401, -401, -401, -401, - -401, -401, -49, -401, -85, -401, -401, -401, -401, -401, - -401, -401, -401, -401, -401, -401, -330, 130, -401, -401, - -401, -401, -401, -401, -401, -401, -401, -401, -401, -401, - 0, -401, -401, -400, -401, -401, -401, -401, -401, -401, - 291, -401, -401, -401, -401, -401, -401, -401, -302, -317, - 292, -401, -401, -139, -84, -113, -86, -401, -401, -401, - -401, -401, 252, -401, 186, -401, -401, -401, -166, 190, - -133, -401, -401, -401, -401, -401, -401, -6 + -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, + -387, -387, -387, -387, -387, -387, -387, -387, -387, -67, + -82, -387, -100, 152, -86, 201, -387, -387, -365, -387, + -11, -387, -387, -387, -387, -387, -387, -387, -387, 171, + -387, -387, -387, -118, -387, -387, 230, -387, -387, -387, + -387, -387, 292, -387, -387, -387, 107, -387, -387, -387, + -387, -387, -387, -387, -387, -387, -387, -51, -387, -88, + -387, -387, -387, -387, -387, -387, -387, -387, -387, -387, + -387, -304, 132, -387, -387, -387, -387, -387, -387, -387, + -387, -387, -387, -387, -387, -3, -387, -387, -361, -387, + -387, -387, -387, -387, -387, 297, -387, -387, -387, -387, + -387, -387, -387, -386, -376, 298, -387, -387, -139, -87, + -120, -89, -387, -387, -387, -387, -387, 257, -387, 178, + -387, -387, -387, -176, 196, -153, -387, -387, -387, -387, + -387, -387, -6 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ -#define YYTABLE_NINF -222 +#define YYTABLE_NINF -230 static const yytype_int16 yytable[] = { - 145, 139, 143, 52, 199, 155, 244, 415, 158, 109, - 110, 369, 151, 268, 223, 153, 405, 153, 58, 154, - 153, 156, 157, 252, 111, 13, 14, 15, 234, 229, - 16, 145, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 257, 452, 109, 110, 206, 112, 5, - 109, 110, 111, 59, 319, 235, 118, 458, 146, 113, - 111, 261, 297, 400, 7, 111, 297, 253, 298, 438, - 147, 266, 298, 320, 310, 311, 427, 401, 238, 267, - 239, 223, 114, 189, 112, 453, 115, 10, 11, 112, - 68, 190, 240, 297, 112, 113, 116, 402, 198, 298, - 113, 299, 117, 53, 191, 113, 55, 192, 301, 403, - 114, 205, 301, 373, 193, 312, 443, 309, 114, 10, - 11, 280, 115, 114, 374, 1, 2, 115, 194, 79, - 441, 80, 220, 153, 456, 279, 85, 300, 117, 301, - 86, 159, 286, 117, 56, 71, 72, 455, 117, 160, - 213, 195, 196, 329, 166, 363, 167, 214, 88, 89, - 10, 11, 168, 364, 71, 72, 90, 117, 421, 169, - 170, 171, 161, 172, 428, 173, 422, 57, 226, 68, - 145, 406, 429, 164, 174, 227, 162, 335, 91, 92, - 245, 336, 239, 246, 247, 165, 417, 248, 71, 72, - 457, 175, 176, 93, 240, 249, 409, 77, 418, 385, - 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, - 396, 211, 212, 250, 63, 64, 65, 66, 67, 365, - 366, 75, 76, 200, 81, 78, 201, 202, 96, 97, - 98, 99, 131, 353, 354, 355, 356, 95, 83, 84, - 410, 145, 378, 143, 101, 102, 103, 104, 107, 398, - 105, 106, 129, 134, 130, 133, 136, 209, 149, -65, - 204, 216, 233, 210, 58, 207, 218, 145, 219, 224, - 225, 258, 335, 230, 231, 232, 237, 243, 255, 416, - 260, 262, 263, 273, 274, 278, 282, 276, -221, 284, - 287, 289, 291, 293, 295, 305, 304, 308, 315, 323, - 317, 322, 325, 328, 330, 437, 331, 337, 339, 348, - 338, 350, 341, 342, 358, 383, 368, 399, 411, 371, - 343, 344, 345, 346, 347, 145, 378, 143, 352, 360, - 361, 362, 145, 372, 335, 407, 413, 408, 409, 424, - 423, 430, 432, 431, 434, 439, 433, 444, 446, 447, - 335, 449, 451, 448, 445, 450, 459, 454, 272, 327, - 281, 135, 436, 296, 420, 0, 265, 140, 141, 259, - 0, 0, 0, 0, 208, 0, 0, 0, 0, 0, - 0, 0, 0, 275 + 152, 146, 150, 52, 208, 254, 164, 209, 382, 167, + 116, 117, 158, 116, 117, 162, 428, 162, 239, 163, + 162, 165, 166, 233, 278, 118, 10, 11, 118, 13, + 14, 15, 267, 262, 16, 152, 17, 18, 19, 20, + 21, 22, 23, 24, 25, 26, 27, 58, 198, 119, + 271, 212, 119, 116, 117, 418, 199, 323, 324, 454, + 120, 118, 119, 120, 276, 310, 125, 5, 118, 200, + 456, 311, 201, 120, 277, 244, 468, 263, 451, 202, + 332, 7, 59, 121, 10, 11, 121, 122, 469, 275, + 122, 233, 119, 203, 466, 386, 465, 123, 325, 333, + 230, 68, 245, 120, 53, 124, 387, 322, 124, 471, + 292, 314, 207, 72, 73, 440, 204, 205, 124, 121, + 175, 88, 176, 10, 11, 211, 121, 89, 177, 293, + 122, 248, 173, 249, 168, 178, 179, 180, 289, 181, + 162, 182, 169, 71, 174, 250, 72, 73, 124, 299, + 183, 124, 153, 310, 310, 413, 342, 72, 73, 311, + 311, 312, 91, 92, 154, 170, 68, 184, 185, 414, + 93, 255, 376, 249, 256, 257, 430, 55, 258, 171, + 434, 441, 377, 56, 419, 250, 259, 152, 431, 415, + 435, 442, 94, 95, 348, 219, 236, 313, 349, 314, + 314, 416, 220, 237, 260, 1, 2, 96, 398, 399, + 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, + 63, 64, 65, 66, 67, 470, 57, 78, 79, 72, + 73, 422, 112, 217, 218, 113, 114, 99, 100, 101, + 102, 366, 367, 368, 369, 82, 80, 83, 71, 225, + 378, 379, 81, 84, 98, 143, 423, 86, 87, 104, + 105, 152, 391, 150, 106, 107, 108, 109, 136, 411, + 110, 137, 138, 215, 140, 141, 159, 213, 156, -66, + 210, 222, 216, 240, 243, 224, 229, 152, 234, 235, + 268, 58, 348, 241, 242, 247, 253, 265, 270, 429, + 272, 273, 283, 284, 288, 286, 297, 290, 295, -229, + 300, 291, 302, 304, 306, 308, 318, 317, 321, 328, + 335, 450, 336, 330, 338, 341, 343, 351, 354, 344, + 350, 355, 352, 361, 363, 371, 396, 412, 424, 356, + 357, 358, 384, 359, 381, 152, 391, 150, 426, 360, + 365, 373, 152, 374, 348, 375, 385, 420, 421, 437, + 443, 422, 436, 444, 445, 462, 446, 457, 447, 459, + 348, 458, 460, 461, 463, 464, 472, 452, 467, 142, + 340, 282, 294, 449, 433, 309, 147, 148, 0, 226, + 0, 285, 0, 0, 269, 0, 214 }; static const yytype_int16 yycheck[] = { - 86, 86, 86, 9, 117, 103, 172, 368, 106, 23, - 24, 23, 95, 23, 153, 101, 346, 103, 65, 102, - 106, 104, 105, 26, 38, 5, 6, 7, 29, 162, - 10, 117, 12, 13, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 176, 444, 23, 24, 130, 62, 0, - 23, 24, 38, 100, 35, 56, 74, 457, 27, 73, - 38, 194, 25, 26, 8, 38, 25, 70, 31, 430, - 39, 109, 31, 54, 41, 42, 406, 40, 25, 117, - 27, 220, 96, 29, 62, 446, 100, 99, 100, 62, - 100, 37, 39, 25, 62, 73, 110, 60, 116, 31, - 73, 33, 116, 108, 50, 73, 99, 53, 71, 72, - 96, 129, 71, 62, 60, 82, 433, 250, 96, 99, - 100, 219, 100, 96, 73, 3, 4, 100, 74, 9, - 432, 11, 110, 219, 451, 218, 111, 69, 116, 71, - 115, 29, 225, 116, 99, 113, 114, 449, 116, 37, - 61, 97, 98, 266, 28, 109, 30, 68, 29, 30, - 99, 100, 36, 117, 113, 114, 37, 116, 109, 43, - 44, 45, 60, 47, 109, 49, 117, 99, 61, 100, - 266, 347, 117, 34, 58, 68, 74, 273, 59, 60, - 48, 274, 27, 51, 52, 46, 34, 55, 113, 114, - 106, 75, 76, 74, 39, 63, 112, 108, 46, 84, - 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - 95, 23, 24, 81, 19, 20, 21, 22, 23, 113, - 114, 26, 27, 101, 99, 108, 104, 105, 101, 102, - 103, 104, 99, 77, 78, 79, 80, 109, 115, 115, - 363, 337, 337, 337, 109, 109, 109, 109, 104, 342, - 109, 109, 109, 100, 109, 109, 23, 99, 111, 111, - 111, 23, 64, 112, 65, 115, 109, 363, 109, 109, - 109, 66, 368, 111, 111, 111, 111, 111, 111, 372, - 111, 111, 111, 109, 109, 112, 104, 115, 104, 83, - 23, 23, 23, 23, 67, 23, 111, 111, 23, 23, - 29, 111, 23, 110, 112, 428, 104, 116, 111, 23, - 110, 23, 109, 109, 23, 23, 109, 57, 23, 335, - 112, 112, 112, 112, 112, 421, 421, 421, 112, 112, - 112, 112, 428, 109, 430, 112, 23, 112, 112, 32, - 112, 109, 111, 109, 66, 431, 111, 111, 109, 109, - 446, 106, 106, 112, 117, 112, 112, 447, 204, 263, - 220, 84, 421, 243, 374, -1, 198, 86, 86, 189, - -1, -1, -1, -1, 132, -1, -1, -1, -1, -1, - -1, -1, -1, 207 + 89, 89, 89, 9, 124, 181, 106, 125, 23, 109, + 23, 24, 98, 23, 24, 104, 381, 106, 171, 105, + 109, 107, 108, 162, 23, 38, 99, 100, 38, 5, + 6, 7, 185, 26, 10, 124, 12, 13, 14, 15, + 16, 17, 18, 19, 20, 21, 22, 65, 29, 62, + 203, 137, 62, 23, 24, 359, 37, 41, 42, 445, + 73, 38, 62, 73, 109, 25, 77, 0, 38, 50, + 446, 31, 53, 73, 119, 29, 462, 70, 443, 60, + 35, 8, 100, 96, 99, 100, 96, 100, 464, 207, + 100, 230, 62, 74, 459, 62, 457, 110, 82, 54, + 110, 100, 56, 73, 108, 118, 73, 260, 118, 470, + 228, 71, 123, 113, 114, 419, 97, 98, 118, 96, + 28, 111, 30, 99, 100, 136, 96, 117, 36, 229, + 100, 25, 34, 27, 29, 43, 44, 45, 224, 47, + 229, 49, 37, 99, 46, 39, 113, 114, 118, 235, + 58, 118, 27, 25, 25, 26, 276, 113, 114, 31, + 31, 33, 29, 30, 39, 60, 100, 75, 76, 40, + 37, 48, 109, 27, 51, 52, 34, 99, 55, 74, + 109, 109, 119, 99, 360, 39, 63, 276, 46, 60, + 119, 119, 59, 60, 283, 61, 61, 69, 284, 71, + 71, 72, 68, 68, 81, 3, 4, 74, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 19, 20, 21, 22, 23, 106, 99, 26, 27, 113, + 114, 112, 101, 23, 24, 104, 105, 101, 102, 103, + 104, 77, 78, 79, 80, 9, 108, 11, 99, 100, + 113, 114, 108, 99, 109, 23, 376, 117, 117, 109, + 109, 350, 350, 350, 109, 109, 109, 109, 109, 355, + 104, 109, 99, 99, 109, 100, 115, 117, 111, 111, + 111, 23, 112, 111, 64, 109, 109, 376, 109, 109, + 66, 65, 381, 111, 111, 111, 111, 111, 111, 385, + 111, 111, 109, 109, 112, 117, 83, 116, 104, 104, + 23, 116, 23, 23, 23, 67, 23, 111, 111, 23, + 111, 441, 23, 29, 23, 110, 112, 110, 109, 104, + 118, 109, 111, 23, 23, 23, 23, 57, 23, 112, + 112, 112, 348, 112, 109, 434, 434, 434, 23, 112, + 112, 112, 441, 112, 443, 112, 109, 112, 112, 32, + 109, 112, 112, 109, 111, 106, 111, 111, 66, 109, + 459, 119, 109, 112, 112, 106, 112, 444, 460, 87, + 273, 210, 230, 434, 387, 253, 89, 89, -1, 159, + -1, 213, -1, -1, 198, -1, 139 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = +static const yytype_uint16 yystos[] = { - 0, 3, 4, 119, 120, 0, 121, 8, 122, 123, - 99, 100, 255, 5, 6, 7, 10, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, - 136, 139, 163, 164, 171, 172, 173, 235, 237, 238, - 241, 254, 255, 108, 239, 99, 99, 99, 65, 100, - 143, 149, 242, 143, 143, 143, 143, 143, 100, 144, - 157, 113, 114, 142, 234, 143, 143, 108, 108, 9, - 11, 99, 240, 115, 115, 111, 115, 175, 29, 30, - 37, 59, 60, 74, 243, 109, 101, 102, 103, 104, - 162, 109, 109, 109, 109, 109, 109, 104, 159, 23, - 24, 38, 62, 73, 96, 100, 110, 116, 148, 150, - 165, 179, 182, 218, 222, 225, 229, 231, 232, 109, - 109, 99, 236, 109, 100, 165, 23, 174, 178, 182, - 218, 228, 230, 232, 233, 234, 27, 39, 244, 111, - 248, 142, 140, 234, 142, 140, 142, 142, 140, 29, - 37, 60, 74, 170, 34, 46, 28, 30, 36, 43, - 44, 45, 47, 49, 58, 75, 76, 183, 185, 188, - 190, 192, 196, 199, 201, 203, 205, 208, 217, 29, - 37, 50, 53, 60, 74, 97, 98, 166, 148, 233, - 101, 104, 105, 161, 111, 148, 142, 115, 240, 99, - 112, 23, 24, 61, 68, 245, 23, 251, 109, 109, - 110, 141, 148, 231, 109, 109, 61, 68, 247, 248, - 111, 111, 111, 64, 29, 56, 200, 111, 25, 27, - 39, 189, 246, 111, 246, 48, 51, 52, 55, 63, - 81, 212, 26, 70, 204, 111, 250, 248, 66, 247, - 111, 248, 111, 111, 168, 161, 109, 117, 23, 151, - 152, 153, 157, 109, 109, 242, 115, 176, 112, 142, - 140, 141, 104, 160, 83, 137, 142, 23, 226, 23, - 227, 23, 202, 23, 195, 67, 195, 25, 31, 33, - 69, 71, 184, 194, 111, 23, 213, 214, 111, 248, - 41, 42, 82, 209, 210, 23, 253, 29, 193, 35, - 54, 197, 111, 23, 169, 23, 167, 169, 110, 233, - 112, 104, 158, 145, 146, 234, 142, 116, 110, 111, - 249, 109, 109, 112, 112, 112, 112, 112, 23, 216, - 23, 215, 112, 77, 78, 79, 80, 198, 23, 211, - 112, 112, 112, 109, 117, 113, 114, 154, 109, 23, - 147, 255, 109, 62, 73, 177, 180, 181, 182, 219, - 220, 223, 228, 23, 252, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 138, 142, 57, - 26, 40, 60, 72, 186, 194, 246, 112, 112, 112, - 233, 23, 155, 23, 156, 146, 142, 34, 46, 206, - 208, 109, 117, 112, 32, 187, 191, 194, 109, 117, - 109, 109, 111, 111, 66, 207, 180, 233, 146, 137, - 221, 226, 224, 227, 111, 117, 109, 109, 112, 106, - 112, 106, 211, 146, 138, 226, 227, 106, 211, 112 + 0, 3, 4, 121, 122, 0, 123, 8, 124, 125, + 99, 100, 262, 5, 6, 7, 10, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 126, 127, + 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, + 138, 141, 170, 171, 178, 179, 180, 242, 244, 245, + 248, 261, 262, 108, 246, 99, 99, 99, 65, 100, + 145, 151, 249, 145, 145, 145, 145, 145, 100, 146, + 159, 99, 113, 114, 144, 166, 168, 241, 145, 145, + 108, 108, 9, 11, 99, 247, 117, 117, 111, 117, + 182, 29, 30, 37, 59, 60, 74, 250, 109, 101, + 102, 103, 104, 164, 109, 109, 109, 109, 109, 109, + 104, 161, 101, 104, 105, 163, 23, 24, 38, 62, + 73, 96, 100, 110, 118, 150, 152, 172, 186, 189, + 225, 229, 232, 236, 238, 239, 109, 109, 99, 243, + 109, 100, 172, 23, 181, 185, 189, 225, 235, 237, + 239, 240, 241, 27, 39, 251, 111, 255, 144, 115, + 165, 142, 241, 144, 142, 144, 144, 142, 29, 37, + 60, 74, 177, 34, 46, 28, 30, 36, 43, 44, + 45, 47, 49, 58, 75, 76, 190, 192, 195, 197, + 199, 203, 206, 208, 210, 212, 215, 224, 29, 37, + 50, 53, 60, 74, 97, 98, 173, 150, 240, 163, + 111, 150, 144, 117, 247, 99, 112, 23, 24, 61, + 68, 252, 23, 258, 109, 100, 166, 167, 169, 109, + 110, 143, 150, 238, 109, 109, 61, 68, 254, 255, + 111, 111, 111, 64, 29, 56, 207, 111, 25, 27, + 39, 196, 253, 111, 253, 48, 51, 52, 55, 63, + 81, 219, 26, 70, 211, 111, 257, 255, 66, 254, + 111, 255, 111, 111, 175, 163, 109, 119, 23, 153, + 154, 155, 159, 109, 109, 249, 117, 183, 112, 144, + 116, 116, 163, 142, 143, 104, 162, 83, 139, 144, + 23, 233, 23, 234, 23, 209, 23, 202, 67, 202, + 25, 31, 33, 69, 71, 191, 201, 111, 23, 220, + 221, 111, 255, 41, 42, 82, 216, 217, 23, 260, + 29, 200, 35, 54, 204, 111, 23, 176, 23, 174, + 176, 110, 240, 112, 104, 160, 147, 148, 241, 144, + 118, 110, 111, 256, 109, 109, 112, 112, 112, 112, + 112, 23, 223, 23, 222, 112, 77, 78, 79, 80, + 205, 23, 218, 112, 112, 112, 109, 119, 113, 114, + 156, 109, 23, 149, 262, 109, 62, 73, 184, 187, + 188, 189, 226, 227, 230, 235, 23, 259, 84, 85, + 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, + 140, 144, 57, 26, 40, 60, 72, 193, 201, 253, + 112, 112, 112, 240, 23, 157, 23, 158, 148, 144, + 34, 46, 213, 215, 109, 119, 112, 32, 194, 198, + 201, 109, 119, 109, 109, 111, 111, 66, 214, 187, + 240, 148, 139, 228, 233, 231, 234, 111, 119, 109, + 109, 112, 106, 112, 106, 218, 148, 140, 233, 234, + 106, 218, 112 }; #define yyerrok (yyerrstatus = 0) @@ -2104,7 +2119,7 @@ yyreduce: case 3: /* Line 1455 of yacc.c */ -#line 270 "program_parse.y" +#line 272 "program_parse.y" { if (state->prog->Target != GL_VERTEX_PROGRAM_ARB) { yyerror(& (yylsp[(1) - (1)]), state, "invalid fragment program header"); @@ -2117,7 +2132,7 @@ yyreduce: case 4: /* Line 1455 of yacc.c */ -#line 278 "program_parse.y" +#line 280 "program_parse.y" { if (state->prog->Target != GL_FRAGMENT_PROGRAM_ARB) { yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex program header"); @@ -2132,7 +2147,7 @@ yyreduce: case 7: /* Line 1455 of yacc.c */ -#line 294 "program_parse.y" +#line 296 "program_parse.y" { int valid = 0; @@ -2157,7 +2172,7 @@ yyreduce: case 10: /* Line 1455 of yacc.c */ -#line 320 "program_parse.y" +#line 322 "program_parse.y" { if ((yyvsp[(1) - (2)].inst) != NULL) { if (state->inst_tail == NULL) { @@ -2177,7 +2192,7 @@ yyreduce: case 12: /* Line 1455 of yacc.c */ -#line 338 "program_parse.y" +#line 340 "program_parse.y" { (yyval.inst) = (yyvsp[(1) - (1)].inst); state->prog->NumAluInstructions++; @@ -2187,7 +2202,7 @@ yyreduce: case 13: /* Line 1455 of yacc.c */ -#line 343 "program_parse.y" +#line 345 "program_parse.y" { (yyval.inst) = (yyvsp[(1) - (1)].inst); state->prog->NumTexInstructions++; @@ -2197,7 +2212,7 @@ yyreduce: case 24: /* Line 1455 of yacc.c */ -#line 364 "program_parse.y" +#line 366 "program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_ARL, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); ;} @@ -2206,7 +2221,7 @@ yyreduce: case 25: /* Line 1455 of yacc.c */ -#line 370 "program_parse.y" +#line 372 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); ;} @@ -2215,7 +2230,7 @@ yyreduce: case 26: /* Line 1455 of yacc.c */ -#line 376 "program_parse.y" +#line 378 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); ;} @@ -2224,7 +2239,7 @@ yyreduce: case 27: /* Line 1455 of yacc.c */ -#line 382 "program_parse.y" +#line 384 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL); ;} @@ -2233,7 +2248,7 @@ yyreduce: case 28: /* Line 1455 of yacc.c */ -#line 389 "program_parse.y" +#line 391 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL); ;} @@ -2242,7 +2257,7 @@ yyreduce: case 29: /* Line 1455 of yacc.c */ -#line 396 "program_parse.y" +#line 398 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (8)].temp_inst), & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), & (yyvsp[(6) - (8)].src_reg), & (yyvsp[(8) - (8)].src_reg)); ;} @@ -2251,7 +2266,7 @@ yyreduce: case 30: /* Line 1455 of yacc.c */ -#line 402 "program_parse.y" +#line 404 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (8)].temp_inst), & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), NULL, NULL); if ((yyval.inst) != NULL) { @@ -2298,7 +2313,7 @@ yyreduce: case 31: /* Line 1455 of yacc.c */ -#line 446 "program_parse.y" +#line 448 "program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_KIL, NULL, & (yyvsp[(2) - (2)].src_reg), NULL, NULL); state->fragment.UsesKill = 1; @@ -2309,6 +2324,19 @@ yyreduce: /* Line 1455 of yacc.c */ #line 453 "program_parse.y" + { + (yyval.inst) = asm_instruction_ctor(OPCODE_KIL_NV, NULL, NULL, NULL, NULL); + (yyval.inst)->Base.DstReg.CondMask = (yyvsp[(2) - (2)].dst_reg).CondMask; + (yyval.inst)->Base.DstReg.CondSwizzle = (yyvsp[(2) - (2)].dst_reg).CondSwizzle; + (yyval.inst)->Base.DstReg.CondSrc = (yyvsp[(2) - (2)].dst_reg).CondSrc; + state->fragment.UsesKill = 1; + ;} + break; + + case 33: + +/* Line 1455 of yacc.c */ +#line 463 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (12)].temp_inst), & (yyvsp[(2) - (12)].dst_reg), & (yyvsp[(4) - (12)].src_reg), & (yyvsp[(6) - (12)].src_reg), & (yyvsp[(8) - (12)].src_reg)); if ((yyval.inst) != NULL) { @@ -2352,103 +2380,103 @@ yyreduce: ;} break; - case 33: + case 34: /* Line 1455 of yacc.c */ -#line 497 "program_parse.y" +#line 507 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; - case 34: + case 35: /* Line 1455 of yacc.c */ -#line 502 "program_parse.y" +#line 512 "program_parse.y" { (yyval.integer) = TEXTURE_1D_INDEX; ;} break; - case 35: + case 36: /* Line 1455 of yacc.c */ -#line 503 "program_parse.y" +#line 513 "program_parse.y" { (yyval.integer) = TEXTURE_2D_INDEX; ;} break; - case 36: + case 37: /* Line 1455 of yacc.c */ -#line 504 "program_parse.y" +#line 514 "program_parse.y" { (yyval.integer) = TEXTURE_3D_INDEX; ;} break; - case 37: + case 38: /* Line 1455 of yacc.c */ -#line 505 "program_parse.y" +#line 515 "program_parse.y" { (yyval.integer) = TEXTURE_CUBE_INDEX; ;} break; - case 38: + case 39: /* Line 1455 of yacc.c */ -#line 506 "program_parse.y" +#line 516 "program_parse.y" { (yyval.integer) = TEXTURE_RECT_INDEX; ;} break; - case 39: + case 40: /* Line 1455 of yacc.c */ -#line 507 "program_parse.y" +#line 517 "program_parse.y" { (yyval.integer) = -TEXTURE_1D_INDEX; ;} break; - case 40: + case 41: /* Line 1455 of yacc.c */ -#line 508 "program_parse.y" +#line 518 "program_parse.y" { (yyval.integer) = -TEXTURE_2D_INDEX; ;} break; - case 41: + case 42: /* Line 1455 of yacc.c */ -#line 509 "program_parse.y" +#line 519 "program_parse.y" { (yyval.integer) = -TEXTURE_RECT_INDEX; ;} break; - case 42: + case 43: /* Line 1455 of yacc.c */ -#line 510 "program_parse.y" +#line 520 "program_parse.y" { (yyval.integer) = TEXTURE_1D_ARRAY_INDEX; ;} break; - case 43: + case 44: /* Line 1455 of yacc.c */ -#line 511 "program_parse.y" +#line 521 "program_parse.y" { (yyval.integer) = TEXTURE_2D_ARRAY_INDEX; ;} break; - case 44: + case 45: /* Line 1455 of yacc.c */ -#line 512 "program_parse.y" +#line 522 "program_parse.y" { (yyval.integer) = -TEXTURE_1D_ARRAY_INDEX; ;} break; - case 45: + case 46: /* Line 1455 of yacc.c */ -#line 513 "program_parse.y" +#line 523 "program_parse.y" { (yyval.integer) = -TEXTURE_2D_ARRAY_INDEX; ;} break; - case 46: + case 47: /* Line 1455 of yacc.c */ -#line 517 "program_parse.y" +#line 527 "program_parse.y" { /* FIXME: Is this correct? Should the extenedSwizzle be applied * FIXME: to the existing swizzle? @@ -2460,10 +2488,10 @@ yyreduce: ;} break; - case 47: + case 48: /* Line 1455 of yacc.c */ -#line 529 "program_parse.y" +#line 539 "program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (2)].src_reg); @@ -2473,10 +2501,10 @@ yyreduce: ;} break; - case 48: + case 49: /* Line 1455 of yacc.c */ -#line 537 "program_parse.y" +#line 547 "program_parse.y" { (yyval.src_reg) = (yyvsp[(3) - (4)].src_reg); @@ -2493,10 +2521,10 @@ yyreduce: ;} break; - case 49: + case 50: /* Line 1455 of yacc.c */ -#line 554 "program_parse.y" +#line 564 "program_parse.y" { (yyval.src_reg) = (yyvsp[(1) - (2)].src_reg); @@ -2505,10 +2533,10 @@ yyreduce: ;} break; - case 50: + case 51: /* Line 1455 of yacc.c */ -#line 561 "program_parse.y" +#line 571 "program_parse.y" { struct asm_symbol temp_sym; @@ -2527,10 +2555,10 @@ yyreduce: ;} break; - case 51: + case 52: /* Line 1455 of yacc.c */ -#line 580 "program_parse.y" +#line 590 "program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (3)].src_reg); @@ -2543,10 +2571,10 @@ yyreduce: ;} break; - case 52: + case 53: /* Line 1455 of yacc.c */ -#line 591 "program_parse.y" +#line 601 "program_parse.y" { (yyval.src_reg) = (yyvsp[(3) - (5)].src_reg); @@ -2565,13 +2593,16 @@ yyreduce: ;} break; - case 53: + case 54: /* Line 1455 of yacc.c */ -#line 611 "program_parse.y" +#line 621 "program_parse.y" { - (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); - (yyval.dst_reg).WriteMask = (yyvsp[(2) - (2)].swiz_mask).mask; + (yyval.dst_reg) = (yyvsp[(1) - (3)].dst_reg); + (yyval.dst_reg).WriteMask = (yyvsp[(2) - (3)].swiz_mask).mask; + (yyval.dst_reg).CondMask = (yyvsp[(3) - (3)].dst_reg).CondMask; + (yyval.dst_reg).CondSwizzle = (yyvsp[(3) - (3)].dst_reg).CondSwizzle; + (yyval.dst_reg).CondSrc = (yyvsp[(3) - (3)].dst_reg).CondSrc; if ((yyval.dst_reg).File == PROGRAM_OUTPUT) { /* Technically speaking, this should check that it is in @@ -2580,7 +2611,7 @@ yyreduce: */ if (state->option.PositionInvariant && ((yyval.dst_reg).Index == VERT_RESULT_HPOS)) { - yyerror(& (yylsp[(1) - (2)]), state, "position-invariant programs cannot " + yyerror(& (yylsp[(1) - (3)]), state, "position-invariant programs cannot " "write position"); YYERROR; } @@ -2590,10 +2621,10 @@ yyreduce: ;} break; - case 54: + case 55: /* Line 1455 of yacc.c */ -#line 633 "program_parse.y" +#line 646 "program_parse.y" { init_dst_reg(& (yyval.dst_reg)); (yyval.dst_reg).File = PROGRAM_ADDRESS; @@ -2602,10 +2633,10 @@ yyreduce: ;} break; - case 55: + case 56: /* Line 1455 of yacc.c */ -#line 642 "program_parse.y" +#line 655 "program_parse.y" { const unsigned xyzw_valid = ((yyvsp[(1) - (7)].ext_swizzle).xyzw_valid << 0) @@ -2638,20 +2669,20 @@ yyreduce: ;} break; - case 56: + case 57: /* Line 1455 of yacc.c */ -#line 675 "program_parse.y" +#line 688 "program_parse.y" { (yyval.ext_swizzle) = (yyvsp[(2) - (2)].ext_swizzle); (yyval.ext_swizzle).negate = ((yyvsp[(1) - (2)].negate)) ? 1 : 0; ;} break; - case 57: + case 58: /* Line 1455 of yacc.c */ -#line 682 "program_parse.y" +#line 695 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) != 0) && ((yyvsp[(1) - (1)].integer) != 1)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector"); @@ -2668,10 +2699,10 @@ yyreduce: ;} break; - case 58: + case 59: /* Line 1455 of yacc.c */ -#line 697 "program_parse.y" +#line 710 "program_parse.y" { if (strlen((yyvsp[(1) - (1)].string)) > 1) { yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector"); @@ -2721,10 +2752,10 @@ yyreduce: ;} break; - case 59: + case 60: /* Line 1455 of yacc.c */ -#line 747 "program_parse.y" +#line 760 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2768,10 +2799,10 @@ yyreduce: ;} break; - case 60: + case 61: /* Line 1455 of yacc.c */ -#line 789 "program_parse.y" +#line 802 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.File = PROGRAM_INPUT; @@ -2784,10 +2815,10 @@ yyreduce: ;} break; - case 61: + case 62: /* Line 1455 of yacc.c */ -#line 800 "program_parse.y" +#line 813 "program_parse.y" { if (! (yyvsp[(3) - (4)].src_reg).Base.RelAddr && ((unsigned) (yyvsp[(3) - (4)].src_reg).Base.Index >= (yyvsp[(1) - (4)].sym)->param_binding_length)) { @@ -2810,10 +2841,10 @@ yyreduce: ;} break; - case 62: + case 63: /* Line 1455 of yacc.c */ -#line 821 "program_parse.y" +#line 834 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.File = ((yyvsp[(1) - (1)].temp_sym).name != NULL) @@ -2823,10 +2854,10 @@ yyreduce: ;} break; - case 63: + case 64: /* Line 1455 of yacc.c */ -#line 831 "program_parse.y" +#line 844 "program_parse.y" { init_dst_reg(& (yyval.dst_reg)); (yyval.dst_reg).File = PROGRAM_OUTPUT; @@ -2834,10 +2865,10 @@ yyreduce: ;} break; - case 64: + case 65: /* Line 1455 of yacc.c */ -#line 837 "program_parse.y" +#line 850 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2868,10 +2899,10 @@ yyreduce: ;} break; - case 65: + case 66: /* Line 1455 of yacc.c */ -#line 868 "program_parse.y" +#line 881 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2888,20 +2919,20 @@ yyreduce: ;} break; - case 68: + case 69: /* Line 1455 of yacc.c */ -#line 887 "program_parse.y" +#line 900 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].integer); ;} break; - case 69: + case 70: /* Line 1455 of yacc.c */ -#line 894 "program_parse.y" +#line 907 "program_parse.y" { /* FINISHME: Add support for multiple address registers. */ @@ -2913,31 +2944,31 @@ yyreduce: ;} break; - case 70: + case 71: /* Line 1455 of yacc.c */ -#line 905 "program_parse.y" +#line 918 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 71: + case 72: /* Line 1455 of yacc.c */ -#line 906 "program_parse.y" +#line 919 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; - case 72: + case 73: /* Line 1455 of yacc.c */ -#line 907 "program_parse.y" +#line 920 "program_parse.y" { (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;} break; - case 73: + case 74: /* Line 1455 of yacc.c */ -#line 911 "program_parse.y" +#line 924 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 63)) { yyerror(& (yylsp[(1) - (1)]), state, @@ -2949,10 +2980,10 @@ yyreduce: ;} break; - case 74: + case 75: /* Line 1455 of yacc.c */ -#line 923 "program_parse.y" +#line 936 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 64)) { yyerror(& (yylsp[(1) - (1)]), state, @@ -2964,10 +2995,10 @@ yyreduce: ;} break; - case 75: + case 76: /* Line 1455 of yacc.c */ -#line 935 "program_parse.y" +#line 948 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2985,10 +3016,10 @@ yyreduce: ;} break; - case 76: + case 77: /* Line 1455 of yacc.c */ -#line 953 "program_parse.y" +#line 966 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, "invalid address component selector"); @@ -2999,10 +3030,10 @@ yyreduce: ;} break; - case 77: + case 78: /* Line 1455 of yacc.c */ -#line 964 "program_parse.y" +#line 977 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, @@ -3014,24 +3045,125 @@ yyreduce: ;} break; - case 82: + case 83: /* Line 1455 of yacc.c */ -#line 980 "program_parse.y" +#line 993 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; - case 87: + case 88: /* Line 1455 of yacc.c */ -#line 984 "program_parse.y" +#line 997 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; + case 89: + +/* Line 1455 of yacc.c */ +#line 1001 "program_parse.y" + { + (yyval.dst_reg) = (yyvsp[(2) - (3)].dst_reg); + ;} + break; + + case 90: + +/* Line 1455 of yacc.c */ +#line 1005 "program_parse.y" + { + (yyval.dst_reg) = (yyvsp[(2) - (3)].dst_reg); + ;} + break; + + case 91: + +/* Line 1455 of yacc.c */ +#line 1009 "program_parse.y" + { + (yyval.dst_reg).CondMask = COND_TR; + (yyval.dst_reg).CondSwizzle = SWIZZLE_NOOP; + (yyval.dst_reg).CondSrc = 0; + ;} + break; + + case 92: + +/* Line 1455 of yacc.c */ +#line 1017 "program_parse.y" + { + (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); + (yyval.dst_reg).CondSwizzle = (yyvsp[(2) - (2)].swiz_mask).swizzle; + ;} + break; + + case 93: + +/* Line 1455 of yacc.c */ +#line 1024 "program_parse.y" + { + (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); + (yyval.dst_reg).CondSwizzle = (yyvsp[(2) - (2)].swiz_mask).swizzle; + ;} + break; + case 94: /* Line 1455 of yacc.c */ -#line 996 "program_parse.y" +#line 1031 "program_parse.y" + { + const int cond = _mesa_parse_cc((yyvsp[(1) - (1)].string)); + if ((cond == 0) || ((yyvsp[(1) - (1)].string)[2] != '\0')) { + char *const err_str = + make_error_string("invalid condition code \"%s\"", (yyvsp[(1) - (1)].string)); + + yyerror(& (yylsp[(1) - (1)]), state, (err_str != NULL) + ? err_str : "invalid condition code"); + + if (err_str != NULL) { + _mesa_free(err_str); + } + + YYERROR; + } + + (yyval.dst_reg).CondMask = cond; + (yyval.dst_reg).CondSwizzle = SWIZZLE_NOOP; + (yyval.dst_reg).CondSrc = 0; + ;} + break; + + case 95: + +/* Line 1455 of yacc.c */ +#line 1054 "program_parse.y" + { + const int cond = _mesa_parse_cc((yyvsp[(1) - (1)].string)); + if ((cond == 0) || ((yyvsp[(1) - (1)].string)[2] != '\0')) { + char *const err_str = + make_error_string("invalid condition code \"%s\"", (yyvsp[(1) - (1)].string)); + + yyerror(& (yylsp[(1) - (1)]), state, (err_str != NULL) + ? err_str : "invalid condition code"); + + if (err_str != NULL) { + _mesa_free(err_str); + } + + YYERROR; + } + + (yyval.dst_reg).CondMask = cond; + (yyval.dst_reg).CondSwizzle = SWIZZLE_NOOP; + (yyval.dst_reg).CondSrc = 0; + ;} + break; + + case 102: + +/* Line 1455 of yacc.c */ +#line 1085 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (4)].string), at_attrib, & (yylsp[(2) - (4)])); @@ -3049,55 +3181,55 @@ yyreduce: ;} break; - case 95: + case 103: /* Line 1455 of yacc.c */ -#line 1014 "program_parse.y" +#line 1103 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} break; - case 96: + case 104: /* Line 1455 of yacc.c */ -#line 1018 "program_parse.y" +#line 1107 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} break; - case 97: + case 105: /* Line 1455 of yacc.c */ -#line 1024 "program_parse.y" +#line 1113 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_POS; ;} break; - case 98: + case 106: /* Line 1455 of yacc.c */ -#line 1028 "program_parse.y" +#line 1117 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_WEIGHT; ;} break; - case 99: + case 107: /* Line 1455 of yacc.c */ -#line 1032 "program_parse.y" +#line 1121 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_NORMAL; ;} break; - case 100: + case 108: /* Line 1455 of yacc.c */ -#line 1036 "program_parse.y" +#line 1125 "program_parse.y" { if (!state->ctx->Extensions.EXT_secondary_color) { yyerror(& (yylsp[(2) - (2)]), state, "GL_EXT_secondary_color not supported"); @@ -3108,10 +3240,10 @@ yyreduce: ;} break; - case 101: + case 109: /* Line 1455 of yacc.c */ -#line 1045 "program_parse.y" +#line 1134 "program_parse.y" { if (!state->ctx->Extensions.EXT_fog_coord) { yyerror(& (yylsp[(1) - (1)]), state, "GL_EXT_fog_coord not supported"); @@ -3122,38 +3254,38 @@ yyreduce: ;} break; - case 102: + case 110: /* Line 1455 of yacc.c */ -#line 1054 "program_parse.y" +#line 1143 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} break; - case 103: + case 111: /* Line 1455 of yacc.c */ -#line 1058 "program_parse.y" +#line 1147 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; ;} break; - case 104: + case 112: /* Line 1455 of yacc.c */ -#line 1063 "program_parse.y" +#line 1152 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_GENERIC0 + (yyvsp[(3) - (4)].integer); ;} break; - case 105: + case 113: /* Line 1455 of yacc.c */ -#line 1069 "program_parse.y" +#line 1158 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxAttribs) { yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex attribute reference"); @@ -3164,46 +3296,46 @@ yyreduce: ;} break; - case 109: + case 117: /* Line 1455 of yacc.c */ -#line 1083 "program_parse.y" +#line 1172 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_WPOS; ;} break; - case 110: + case 118: /* Line 1455 of yacc.c */ -#line 1087 "program_parse.y" +#line 1176 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_COL0 + (yyvsp[(2) - (2)].integer); ;} break; - case 111: + case 119: /* Line 1455 of yacc.c */ -#line 1091 "program_parse.y" +#line 1180 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_FOGC; ;} break; - case 112: + case 120: /* Line 1455 of yacc.c */ -#line 1095 "program_parse.y" +#line 1184 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} break; - case 115: + case 123: /* Line 1455 of yacc.c */ -#line 1103 "program_parse.y" +#line 1192 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (3)].string), at_param, & (yylsp[(2) - (3)])); @@ -3219,10 +3351,10 @@ yyreduce: ;} break; - case 116: + case 124: /* Line 1455 of yacc.c */ -#line 1119 "program_parse.y" +#line 1208 "program_parse.y" { if (((yyvsp[(4) - (6)].integer) != 0) && ((unsigned) (yyvsp[(4) - (6)].integer) != (yyvsp[(6) - (6)].temp_sym).param_binding_length)) { yyerror(& (yylsp[(4) - (6)]), state, @@ -3244,19 +3376,19 @@ yyreduce: ;} break; - case 117: + case 125: /* Line 1455 of yacc.c */ -#line 1141 "program_parse.y" +#line 1230 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 118: + case 126: /* Line 1455 of yacc.c */ -#line 1145 "program_parse.y" +#line 1234 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxParameters)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid parameter array size"); @@ -3267,38 +3399,38 @@ yyreduce: ;} break; - case 119: + case 127: /* Line 1455 of yacc.c */ -#line 1156 "program_parse.y" +#line 1245 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(2) - (2)].temp_sym); ;} break; - case 120: + case 128: /* Line 1455 of yacc.c */ -#line 1162 "program_parse.y" +#line 1251 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(3) - (4)].temp_sym); ;} break; - case 122: + case 130: /* Line 1455 of yacc.c */ -#line 1169 "program_parse.y" +#line 1258 "program_parse.y" { (yyvsp[(1) - (3)].temp_sym).param_binding_length += (yyvsp[(3) - (3)].temp_sym).param_binding_length; (yyval.temp_sym) = (yyvsp[(1) - (3)].temp_sym); ;} break; - case 123: + case 131: /* Line 1455 of yacc.c */ -#line 1176 "program_parse.y" +#line 1265 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3306,10 +3438,10 @@ yyreduce: ;} break; - case 124: + case 132: /* Line 1455 of yacc.c */ -#line 1182 "program_parse.y" +#line 1271 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3317,10 +3449,10 @@ yyreduce: ;} break; - case 125: + case 133: /* Line 1455 of yacc.c */ -#line 1188 "program_parse.y" +#line 1277 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3328,10 +3460,10 @@ yyreduce: ;} break; - case 126: + case 134: /* Line 1455 of yacc.c */ -#line 1196 "program_parse.y" +#line 1285 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3339,10 +3471,10 @@ yyreduce: ;} break; - case 127: + case 135: /* Line 1455 of yacc.c */ -#line 1202 "program_parse.y" +#line 1291 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3350,10 +3482,10 @@ yyreduce: ;} break; - case 128: + case 136: /* Line 1455 of yacc.c */ -#line 1208 "program_parse.y" +#line 1297 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3361,10 +3493,10 @@ yyreduce: ;} break; - case 129: + case 137: /* Line 1455 of yacc.c */ -#line 1216 "program_parse.y" +#line 1305 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3372,10 +3504,10 @@ yyreduce: ;} break; - case 130: + case 138: /* Line 1455 of yacc.c */ -#line 1222 "program_parse.y" +#line 1311 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3383,10 +3515,10 @@ yyreduce: ;} break; - case 131: + case 139: /* Line 1455 of yacc.c */ -#line 1228 "program_parse.y" +#line 1317 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3394,101 +3526,101 @@ yyreduce: ;} break; - case 132: + case 140: /* Line 1455 of yacc.c */ -#line 1235 "program_parse.y" +#line 1324 "program_parse.y" { memcpy((yyval.state), (yyvsp[(1) - (1)].state), sizeof((yyval.state))); ;} break; - case 133: + case 141: /* Line 1455 of yacc.c */ -#line 1236 "program_parse.y" +#line 1325 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 134: + case 142: /* Line 1455 of yacc.c */ -#line 1239 "program_parse.y" +#line 1328 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 135: + case 143: /* Line 1455 of yacc.c */ -#line 1240 "program_parse.y" +#line 1329 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 136: + case 144: /* Line 1455 of yacc.c */ -#line 1241 "program_parse.y" +#line 1330 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 137: + case 145: /* Line 1455 of yacc.c */ -#line 1242 "program_parse.y" +#line 1331 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 138: + case 146: /* Line 1455 of yacc.c */ -#line 1243 "program_parse.y" +#line 1332 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 139: + case 147: /* Line 1455 of yacc.c */ -#line 1244 "program_parse.y" +#line 1333 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 140: + case 148: /* Line 1455 of yacc.c */ -#line 1245 "program_parse.y" +#line 1334 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 141: + case 149: /* Line 1455 of yacc.c */ -#line 1246 "program_parse.y" +#line 1335 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 142: + case 150: /* Line 1455 of yacc.c */ -#line 1247 "program_parse.y" +#line 1336 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 143: + case 151: /* Line 1455 of yacc.c */ -#line 1248 "program_parse.y" +#line 1337 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 144: + case 152: /* Line 1455 of yacc.c */ -#line 1249 "program_parse.y" +#line 1338 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; - case 145: + case 153: /* Line 1455 of yacc.c */ -#line 1253 "program_parse.y" +#line 1342 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_MATERIAL; @@ -3497,37 +3629,37 @@ yyreduce: ;} break; - case 146: + case 154: /* Line 1455 of yacc.c */ -#line 1262 "program_parse.y" +#line 1351 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 147: + case 155: /* Line 1455 of yacc.c */ -#line 1266 "program_parse.y" +#line 1355 "program_parse.y" { (yyval.integer) = STATE_EMISSION; ;} break; - case 148: + case 156: /* Line 1455 of yacc.c */ -#line 1270 "program_parse.y" +#line 1359 "program_parse.y" { (yyval.integer) = STATE_SHININESS; ;} break; - case 149: + case 157: /* Line 1455 of yacc.c */ -#line 1276 "program_parse.y" +#line 1365 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHT; @@ -3536,28 +3668,28 @@ yyreduce: ;} break; - case 150: + case 158: /* Line 1455 of yacc.c */ -#line 1285 "program_parse.y" +#line 1374 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 151: + case 159: /* Line 1455 of yacc.c */ -#line 1289 "program_parse.y" +#line 1378 "program_parse.y" { (yyval.integer) = STATE_POSITION; ;} break; - case 152: + case 160: /* Line 1455 of yacc.c */ -#line 1293 "program_parse.y" +#line 1382 "program_parse.y" { if (!state->ctx->Extensions.EXT_point_parameters) { yyerror(& (yylsp[(1) - (1)]), state, "GL_ARB_point_parameters not supported"); @@ -3568,57 +3700,57 @@ yyreduce: ;} break; - case 153: + case 161: /* Line 1455 of yacc.c */ -#line 1302 "program_parse.y" +#line 1391 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; - case 154: + case 162: /* Line 1455 of yacc.c */ -#line 1306 "program_parse.y" +#line 1395 "program_parse.y" { (yyval.integer) = STATE_HALF_VECTOR; ;} break; - case 155: + case 163: /* Line 1455 of yacc.c */ -#line 1312 "program_parse.y" +#line 1401 "program_parse.y" { (yyval.integer) = STATE_SPOT_DIRECTION; ;} break; - case 156: + case 164: /* Line 1455 of yacc.c */ -#line 1318 "program_parse.y" +#line 1407 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (2)].state)[1]; ;} break; - case 157: + case 165: /* Line 1455 of yacc.c */ -#line 1325 "program_parse.y" +#line 1414 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_AMBIENT; ;} break; - case 158: + case 166: /* Line 1455 of yacc.c */ -#line 1330 "program_parse.y" +#line 1419 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_SCENECOLOR; @@ -3626,10 +3758,10 @@ yyreduce: ;} break; - case 159: + case 167: /* Line 1455 of yacc.c */ -#line 1338 "program_parse.y" +#line 1427 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTPROD; @@ -3639,10 +3771,10 @@ yyreduce: ;} break; - case 161: + case 169: /* Line 1455 of yacc.c */ -#line 1350 "program_parse.y" +#line 1439 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(3) - (3)].integer); @@ -3650,46 +3782,46 @@ yyreduce: ;} break; - case 162: + case 170: /* Line 1455 of yacc.c */ -#line 1358 "program_parse.y" +#line 1447 "program_parse.y" { (yyval.integer) = STATE_TEXENV_COLOR; ;} break; - case 163: + case 171: /* Line 1455 of yacc.c */ -#line 1364 "program_parse.y" +#line 1453 "program_parse.y" { (yyval.integer) = STATE_AMBIENT; ;} break; - case 164: + case 172: /* Line 1455 of yacc.c */ -#line 1368 "program_parse.y" +#line 1457 "program_parse.y" { (yyval.integer) = STATE_DIFFUSE; ;} break; - case 165: + case 173: /* Line 1455 of yacc.c */ -#line 1372 "program_parse.y" +#line 1461 "program_parse.y" { (yyval.integer) = STATE_SPECULAR; ;} break; - case 166: + case 174: /* Line 1455 of yacc.c */ -#line 1378 "program_parse.y" +#line 1467 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxLights) { yyerror(& (yylsp[(1) - (1)]), state, "invalid light selector"); @@ -3700,10 +3832,10 @@ yyreduce: ;} break; - case 167: + case 175: /* Line 1455 of yacc.c */ -#line 1389 "program_parse.y" +#line 1478 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_TEXGEN; @@ -3712,92 +3844,92 @@ yyreduce: ;} break; - case 168: + case 176: /* Line 1455 of yacc.c */ -#line 1398 "program_parse.y" +#line 1487 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S; ;} break; - case 169: + case 177: /* Line 1455 of yacc.c */ -#line 1402 "program_parse.y" +#line 1491 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_OBJECT_S; ;} break; - case 170: + case 178: /* Line 1455 of yacc.c */ -#line 1407 "program_parse.y" +#line 1496 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S; ;} break; - case 171: + case 179: /* Line 1455 of yacc.c */ -#line 1411 "program_parse.y" +#line 1500 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S; ;} break; - case 172: + case 180: /* Line 1455 of yacc.c */ -#line 1415 "program_parse.y" +#line 1504 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S; ;} break; - case 173: + case 181: /* Line 1455 of yacc.c */ -#line 1419 "program_parse.y" +#line 1508 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S; ;} break; - case 174: + case 182: /* Line 1455 of yacc.c */ -#line 1425 "program_parse.y" +#line 1514 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); ;} break; - case 175: + case 183: /* Line 1455 of yacc.c */ -#line 1432 "program_parse.y" +#line 1521 "program_parse.y" { (yyval.integer) = STATE_FOG_COLOR; ;} break; - case 176: + case 184: /* Line 1455 of yacc.c */ -#line 1436 "program_parse.y" +#line 1525 "program_parse.y" { (yyval.integer) = STATE_FOG_PARAMS; ;} break; - case 177: + case 185: /* Line 1455 of yacc.c */ -#line 1442 "program_parse.y" +#line 1531 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_CLIPPLANE; @@ -3805,10 +3937,10 @@ yyreduce: ;} break; - case 178: + case 186: /* Line 1455 of yacc.c */ -#line 1450 "program_parse.y" +#line 1539 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxClipPlanes) { yyerror(& (yylsp[(1) - (1)]), state, "invalid clip plane selector"); @@ -3819,38 +3951,38 @@ yyreduce: ;} break; - case 179: + case 187: /* Line 1455 of yacc.c */ -#line 1461 "program_parse.y" +#line 1550 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); ;} break; - case 180: + case 188: /* Line 1455 of yacc.c */ -#line 1468 "program_parse.y" +#line 1557 "program_parse.y" { (yyval.integer) = STATE_POINT_SIZE; ;} break; - case 181: + case 189: /* Line 1455 of yacc.c */ -#line 1472 "program_parse.y" +#line 1561 "program_parse.y" { (yyval.integer) = STATE_POINT_ATTENUATION; ;} break; - case 182: + case 190: /* Line 1455 of yacc.c */ -#line 1478 "program_parse.y" +#line 1567 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (5)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (5)].state)[1]; @@ -3860,10 +3992,10 @@ yyreduce: ;} break; - case 183: + case 191: /* Line 1455 of yacc.c */ -#line 1488 "program_parse.y" +#line 1577 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (2)].state)[1]; @@ -3873,20 +4005,20 @@ yyreduce: ;} break; - case 184: + case 192: /* Line 1455 of yacc.c */ -#line 1498 "program_parse.y" +#line 1587 "program_parse.y" { (yyval.state)[2] = 0; (yyval.state)[3] = 3; ;} break; - case 185: + case 193: /* Line 1455 of yacc.c */ -#line 1503 "program_parse.y" +#line 1592 "program_parse.y" { /* It seems logical that the matrix row range specifier would have * to specify a range or more than one row (i.e., $5 > $3). @@ -3904,10 +4036,10 @@ yyreduce: ;} break; - case 186: + case 194: /* Line 1455 of yacc.c */ -#line 1521 "program_parse.y" +#line 1610 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (3)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (3)].state)[1]; @@ -3915,55 +4047,55 @@ yyreduce: ;} break; - case 187: + case 195: /* Line 1455 of yacc.c */ -#line 1529 "program_parse.y" +#line 1618 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 188: + case 196: /* Line 1455 of yacc.c */ -#line 1533 "program_parse.y" +#line 1622 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 189: + case 197: /* Line 1455 of yacc.c */ -#line 1539 "program_parse.y" +#line 1628 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVERSE; ;} break; - case 190: + case 198: /* Line 1455 of yacc.c */ -#line 1543 "program_parse.y" +#line 1632 "program_parse.y" { (yyval.integer) = STATE_MATRIX_TRANSPOSE; ;} break; - case 191: + case 199: /* Line 1455 of yacc.c */ -#line 1547 "program_parse.y" +#line 1636 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVTRANS; ;} break; - case 192: + case 200: /* Line 1455 of yacc.c */ -#line 1553 "program_parse.y" +#line 1642 "program_parse.y" { if ((yyvsp[(1) - (1)].integer) > 3) { yyerror(& (yylsp[(1) - (1)]), state, "invalid matrix row reference"); @@ -3974,88 +4106,88 @@ yyreduce: ;} break; - case 193: + case 201: /* Line 1455 of yacc.c */ -#line 1564 "program_parse.y" +#line 1653 "program_parse.y" { (yyval.state)[0] = STATE_MODELVIEW_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); ;} break; - case 194: + case 202: /* Line 1455 of yacc.c */ -#line 1569 "program_parse.y" +#line 1658 "program_parse.y" { (yyval.state)[0] = STATE_PROJECTION_MATRIX; (yyval.state)[1] = 0; ;} break; - case 195: + case 203: /* Line 1455 of yacc.c */ -#line 1574 "program_parse.y" +#line 1663 "program_parse.y" { (yyval.state)[0] = STATE_MVP_MATRIX; (yyval.state)[1] = 0; ;} break; - case 196: + case 204: /* Line 1455 of yacc.c */ -#line 1579 "program_parse.y" +#line 1668 "program_parse.y" { (yyval.state)[0] = STATE_TEXTURE_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); ;} break; - case 197: + case 205: /* Line 1455 of yacc.c */ -#line 1584 "program_parse.y" +#line 1673 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; ;} break; - case 198: + case 206: /* Line 1455 of yacc.c */ -#line 1589 "program_parse.y" +#line 1678 "program_parse.y" { (yyval.state)[0] = STATE_PROGRAM_MATRIX; (yyval.state)[1] = (yyvsp[(3) - (4)].integer); ;} break; - case 199: + case 207: /* Line 1455 of yacc.c */ -#line 1596 "program_parse.y" +#line 1685 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 200: + case 208: /* Line 1455 of yacc.c */ -#line 1600 "program_parse.y" +#line 1689 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 201: + case 209: /* Line 1455 of yacc.c */ -#line 1605 "program_parse.y" +#line 1694 "program_parse.y" { /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix * zero is valid. @@ -4069,10 +4201,10 @@ yyreduce: ;} break; - case 202: + case 210: /* Line 1455 of yacc.c */ -#line 1618 "program_parse.y" +#line 1707 "program_parse.y" { /* Since GL_ARB_matrix_palette isn't supported, just let any value * through here. The error will be generated later. @@ -4081,10 +4213,10 @@ yyreduce: ;} break; - case 203: + case 211: /* Line 1455 of yacc.c */ -#line 1626 "program_parse.y" +#line 1715 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxProgramMatrices) { yyerror(& (yylsp[(1) - (1)]), state, "invalid program matrix selector"); @@ -4095,20 +4227,20 @@ yyreduce: ;} break; - case 204: + case 212: /* Line 1455 of yacc.c */ -#line 1637 "program_parse.y" +#line 1726 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_DEPTH_RANGE; ;} break; - case 209: + case 217: /* Line 1455 of yacc.c */ -#line 1649 "program_parse.y" +#line 1738 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4118,30 +4250,30 @@ yyreduce: ;} break; - case 210: + case 218: /* Line 1455 of yacc.c */ -#line 1659 "program_parse.y" +#line 1748 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); ;} break; - case 211: + case 219: /* Line 1455 of yacc.c */ -#line 1664 "program_parse.y" +#line 1753 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); ;} break; - case 212: + case 220: /* Line 1455 of yacc.c */ -#line 1671 "program_parse.y" +#line 1760 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4151,10 +4283,10 @@ yyreduce: ;} break; - case 213: + case 221: /* Line 1455 of yacc.c */ -#line 1681 "program_parse.y" +#line 1770 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4164,30 +4296,30 @@ yyreduce: ;} break; - case 214: + case 222: /* Line 1455 of yacc.c */ -#line 1690 "program_parse.y" +#line 1779 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); ;} break; - case 215: + case 223: /* Line 1455 of yacc.c */ -#line 1695 "program_parse.y" +#line 1784 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); ;} break; - case 216: + case 224: /* Line 1455 of yacc.c */ -#line 1702 "program_parse.y" +#line 1791 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4197,10 +4329,10 @@ yyreduce: ;} break; - case 217: + case 225: /* Line 1455 of yacc.c */ -#line 1712 "program_parse.y" +#line 1801 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxEnvParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid environment parameter reference"); @@ -4210,10 +4342,10 @@ yyreduce: ;} break; - case 218: + case 226: /* Line 1455 of yacc.c */ -#line 1722 "program_parse.y" +#line 1811 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxLocalParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid local parameter reference"); @@ -4223,10 +4355,10 @@ yyreduce: ;} break; - case 223: + case 231: /* Line 1455 of yacc.c */ -#line 1737 "program_parse.y" +#line 1826 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4236,10 +4368,10 @@ yyreduce: ;} break; - case 224: + case 232: /* Line 1455 of yacc.c */ -#line 1747 "program_parse.y" +#line 1836 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4249,10 +4381,10 @@ yyreduce: ;} break; - case 225: + case 233: /* Line 1455 of yacc.c */ -#line 1755 "program_parse.y" +#line 1844 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (float) (yyvsp[(1) - (1)].integer); @@ -4262,10 +4394,10 @@ yyreduce: ;} break; - case 226: + case 234: /* Line 1455 of yacc.c */ -#line 1765 "program_parse.y" +#line 1854 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (3)].real); @@ -4275,10 +4407,10 @@ yyreduce: ;} break; - case 227: + case 235: /* Line 1455 of yacc.c */ -#line 1773 "program_parse.y" +#line 1862 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (5)].real); @@ -4288,10 +4420,10 @@ yyreduce: ;} break; - case 228: + case 236: /* Line 1455 of yacc.c */ -#line 1782 "program_parse.y" +#line 1871 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (7)].real); @@ -4301,10 +4433,10 @@ yyreduce: ;} break; - case 229: + case 237: /* Line 1455 of yacc.c */ -#line 1791 "program_parse.y" +#line 1880 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (9)].real); @@ -4314,56 +4446,56 @@ yyreduce: ;} break; - case 230: + case 238: /* Line 1455 of yacc.c */ -#line 1801 "program_parse.y" +#line 1890 "program_parse.y" { (yyval.real) = ((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].real) : (yyvsp[(2) - (2)].real); ;} break; - case 231: + case 239: /* Line 1455 of yacc.c */ -#line 1805 "program_parse.y" +#line 1894 "program_parse.y" { (yyval.real) = (float)(((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].integer) : (yyvsp[(2) - (2)].integer)); ;} break; - case 232: + case 240: /* Line 1455 of yacc.c */ -#line 1810 "program_parse.y" +#line 1899 "program_parse.y" { (yyval.negate) = FALSE; ;} break; - case 233: + case 241: /* Line 1455 of yacc.c */ -#line 1811 "program_parse.y" +#line 1900 "program_parse.y" { (yyval.negate) = TRUE; ;} break; - case 234: + case 242: /* Line 1455 of yacc.c */ -#line 1812 "program_parse.y" +#line 1901 "program_parse.y" { (yyval.negate) = FALSE; ;} break; - case 235: + case 243: /* Line 1455 of yacc.c */ -#line 1815 "program_parse.y" +#line 1904 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; - case 237: + case 245: /* Line 1455 of yacc.c */ -#line 1819 "program_parse.y" +#line 1908 "program_parse.y" { /* NV_fragment_program_option defines the size qualifiers in a * fairly broken way. "SHORT" or "LONG" can optionally be used @@ -4399,25 +4531,25 @@ yyreduce: ;} break; - case 238: + case 246: /* Line 1455 of yacc.c */ -#line 1853 "program_parse.y" +#line 1942 "program_parse.y" { ;} break; - case 239: + case 247: /* Line 1455 of yacc.c */ -#line 1857 "program_parse.y" +#line 1946 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; - case 241: + case 249: /* Line 1455 of yacc.c */ -#line 1861 "program_parse.y" +#line 1950 "program_parse.y" { if (!declare_variable(state, (yyvsp[(3) - (3)].string), (yyvsp[(0) - (3)].integer), & (yylsp[(3) - (3)]))) { YYERROR; @@ -4425,10 +4557,10 @@ yyreduce: ;} break; - case 242: + case 250: /* Line 1455 of yacc.c */ -#line 1867 "program_parse.y" +#line 1956 "program_parse.y" { if (!declare_variable(state, (yyvsp[(1) - (1)].string), (yyvsp[(0) - (1)].integer), & (yylsp[(1) - (1)]))) { YYERROR; @@ -4436,10 +4568,10 @@ yyreduce: ;} break; - case 243: + case 251: /* Line 1455 of yacc.c */ -#line 1875 "program_parse.y" +#line 1964 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(3) - (5)].string), at_output, & (yylsp[(3) - (5)])); @@ -4452,10 +4584,10 @@ yyreduce: ;} break; - case 244: + case 252: /* Line 1455 of yacc.c */ -#line 1888 "program_parse.y" +#line 1977 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_HPOS; @@ -4466,10 +4598,10 @@ yyreduce: ;} break; - case 245: + case 253: /* Line 1455 of yacc.c */ -#line 1897 "program_parse.y" +#line 1986 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_FOGC; @@ -4480,19 +4612,19 @@ yyreduce: ;} break; - case 246: + case 254: /* Line 1455 of yacc.c */ -#line 1906 "program_parse.y" +#line 1995 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (2)].result); ;} break; - case 247: + case 255: /* Line 1455 of yacc.c */ -#line 1910 "program_parse.y" +#line 1999 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_PSIZ; @@ -4503,10 +4635,10 @@ yyreduce: ;} break; - case 248: + case 256: /* Line 1455 of yacc.c */ -#line 1919 "program_parse.y" +#line 2008 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_TEX0 + (yyvsp[(3) - (3)].integer); @@ -4517,10 +4649,10 @@ yyreduce: ;} break; - case 249: + case 257: /* Line 1455 of yacc.c */ -#line 1928 "program_parse.y" +#line 2017 "program_parse.y" { if (state->mode == ARB_fragment) { (yyval.result) = FRAG_RESULT_DEPTH; @@ -4531,19 +4663,19 @@ yyreduce: ;} break; - case 250: + case 258: /* Line 1455 of yacc.c */ -#line 1939 "program_parse.y" +#line 2028 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (3)].integer) + (yyvsp[(3) - (3)].integer); ;} break; - case 251: + case 259: /* Line 1455 of yacc.c */ -#line 1945 "program_parse.y" +#line 2034 "program_parse.y" { (yyval.integer) = (state->mode == ARB_vertex) ? VERT_RESULT_COL0 @@ -4551,10 +4683,10 @@ yyreduce: ;} break; - case 252: + case 260: /* Line 1455 of yacc.c */ -#line 1951 "program_parse.y" +#line 2040 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_COL0; @@ -4565,10 +4697,10 @@ yyreduce: ;} break; - case 253: + case 261: /* Line 1455 of yacc.c */ -#line 1960 "program_parse.y" +#line 2049 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_BFC0; @@ -4579,19 +4711,19 @@ yyreduce: ;} break; - case 254: + case 262: /* Line 1455 of yacc.c */ -#line 1971 "program_parse.y" +#line 2060 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 255: + case 263: /* Line 1455 of yacc.c */ -#line 1975 "program_parse.y" +#line 2064 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 0; @@ -4602,10 +4734,10 @@ yyreduce: ;} break; - case 256: + case 264: /* Line 1455 of yacc.c */ -#line 1984 "program_parse.y" +#line 2073 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 1; @@ -4616,94 +4748,94 @@ yyreduce: ;} break; - case 257: + case 265: /* Line 1455 of yacc.c */ -#line 1994 "program_parse.y" +#line 2083 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 258: + case 266: /* Line 1455 of yacc.c */ -#line 1995 "program_parse.y" +#line 2084 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 259: + case 267: /* Line 1455 of yacc.c */ -#line 1996 "program_parse.y" +#line 2085 "program_parse.y" { (yyval.integer) = 1; ;} break; - case 260: + case 268: /* Line 1455 of yacc.c */ -#line 1999 "program_parse.y" +#line 2088 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 261: + case 269: /* Line 1455 of yacc.c */ -#line 2000 "program_parse.y" +#line 2089 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 262: + case 270: /* Line 1455 of yacc.c */ -#line 2001 "program_parse.y" +#line 2090 "program_parse.y" { (yyval.integer) = 1; ;} break; - case 263: + case 271: /* Line 1455 of yacc.c */ -#line 2004 "program_parse.y" +#line 2093 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 264: + case 272: /* Line 1455 of yacc.c */ -#line 2005 "program_parse.y" +#line 2094 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; - case 265: + case 273: /* Line 1455 of yacc.c */ -#line 2008 "program_parse.y" +#line 2097 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 266: + case 274: /* Line 1455 of yacc.c */ -#line 2009 "program_parse.y" +#line 2098 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; - case 267: + case 275: /* Line 1455 of yacc.c */ -#line 2012 "program_parse.y" +#line 2101 "program_parse.y" { (yyval.integer) = 0; ;} break; - case 268: + case 276: /* Line 1455 of yacc.c */ -#line 2013 "program_parse.y" +#line 2102 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; - case 269: + case 277: /* Line 1455 of yacc.c */ -#line 2017 "program_parse.y" +#line 2106 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureCoordUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture coordinate unit selector"); @@ -4714,10 +4846,10 @@ yyreduce: ;} break; - case 270: + case 278: /* Line 1455 of yacc.c */ -#line 2028 "program_parse.y" +#line 2117 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureImageUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture image unit selector"); @@ -4728,10 +4860,10 @@ yyreduce: ;} break; - case 271: + case 279: /* Line 1455 of yacc.c */ -#line 2039 "program_parse.y" +#line 2128 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture unit selector"); @@ -4742,10 +4874,10 @@ yyreduce: ;} break; - case 272: + case 280: /* Line 1455 of yacc.c */ -#line 2050 "program_parse.y" +#line 2139 "program_parse.y" { struct asm_symbol *exist = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(2) - (4)].string)); @@ -4769,7 +4901,7 @@ yyreduce: /* Line 1455 of yacc.c */ -#line 4773 "program_parse.tab.c" +#line 4905 "program_parse.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -4988,7 +5120,7 @@ yyreturn: /* Line 1675 of yacc.c */ -#line 2074 "program_parse.y" +#line 2163 "program_parse.y" void @@ -5007,8 +5139,15 @@ asm_instruction_set_operands(struct asm_instruction *inst, inst->Base.DstReg = *dst; } - inst->Base.SrcReg[0] = src0->Base; - inst->SrcReg[0] = *src0; + /* The only instruction that doesn't have any source registers is the + * condition-code based KIL instruction added by NV_fragment_program_option. + */ + if (src0 != NULL) { + inst->Base.SrcReg[0] = src0->Base; + inst->SrcReg[0] = *src0; + } else { + init_src_reg(& inst->SrcReg[0]); + } if (src1 != NULL) { inst->Base.SrcReg[1] = src1->Base; diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index d6bac07081..3021ae83f3 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -202,6 +202,8 @@ static struct asm_instruction *asm_instruction_copy_ctor( %type addrReg %type addrComponent addrWriteMask +%type ccMaskRule ccTest ccMaskRule2 ccTest2 optionalCcMask + %type resultBinding resultColBinding %type optFaceType optColorType %type optResultFaceType optResultColorType @@ -447,6 +449,14 @@ KIL_instruction: KIL swizzleSrcReg $$ = asm_instruction_ctor(OPCODE_KIL, NULL, & $2, NULL, NULL); state->fragment.UsesKill = 1; } + | KIL ccTest + { + $$ = asm_instruction_ctor(OPCODE_KIL_NV, NULL, NULL, NULL, NULL); + $$->Base.DstReg.CondMask = $2.CondMask; + $$->Base.DstReg.CondSwizzle = $2.CondSwizzle; + $$->Base.DstReg.CondSrc = $2.CondSrc; + state->fragment.UsesKill = 1; + } ; TXD_instruction: TXD_OP maskedDstReg ',' swizzleSrcReg ',' swizzleSrcReg ',' swizzleSrcReg ',' texImageUnit ',' texTarget @@ -607,10 +617,13 @@ swizzleSrcReg: optionalSign srcReg swizzleSuffix ; -maskedDstReg: dstReg optionalMask +maskedDstReg: dstReg optionalMask optionalCcMask { $$ = $1; $$.WriteMask = $2.mask; + $$.CondMask = $3.CondMask; + $$.CondSwizzle = $3.CondSwizzle; + $$.CondSrc = $3.CondSrc; if ($$.File == PROGRAM_OUTPUT) { /* Technically speaking, this should check that it is in @@ -984,6 +997,82 @@ optionalMask: MASK4 | MASK3 | MASK2 | MASK1 | { $$.swizzle = SWIZZLE_NOOP; $$.mask = WRITEMASK_XYZW; } ; +optionalCcMask: '(' ccTest ')' + { + $$ = $2; + } + | '(' ccTest2 ')' + { + $$ = $2; + } + | + { + $$.CondMask = COND_TR; + $$.CondSwizzle = SWIZZLE_NOOP; + $$.CondSrc = 0; + } + ; + +ccTest: ccMaskRule swizzleSuffix + { + $$ = $1; + $$.CondSwizzle = $2.swizzle; + } + ; + +ccTest2: ccMaskRule2 swizzleSuffix + { + $$ = $1; + $$.CondSwizzle = $2.swizzle; + } + ; + +ccMaskRule: IDENTIFIER + { + const int cond = _mesa_parse_cc($1); + if ((cond == 0) || ($1[2] != '\0')) { + char *const err_str = + make_error_string("invalid condition code \"%s\"", $1); + + yyerror(& @1, state, (err_str != NULL) + ? err_str : "invalid condition code"); + + if (err_str != NULL) { + _mesa_free(err_str); + } + + YYERROR; + } + + $$.CondMask = cond; + $$.CondSwizzle = SWIZZLE_NOOP; + $$.CondSrc = 0; + } + ; + +ccMaskRule2: USED_IDENTIFIER + { + const int cond = _mesa_parse_cc($1); + if ((cond == 0) || ($1[2] != '\0')) { + char *const err_str = + make_error_string("invalid condition code \"%s\"", $1); + + yyerror(& @1, state, (err_str != NULL) + ? err_str : "invalid condition code"); + + if (err_str != NULL) { + _mesa_free(err_str); + } + + YYERROR; + } + + $$.CondMask = cond; + $$.CondSwizzle = SWIZZLE_NOOP; + $$.CondSrc = 0; + } + ; + namingStatement: ATTRIB_statement | PARAM_statement | TEMP_statement @@ -2089,8 +2178,15 @@ asm_instruction_set_operands(struct asm_instruction *inst, inst->Base.DstReg = *dst; } - inst->Base.SrcReg[0] = src0->Base; - inst->SrcReg[0] = *src0; + /* The only instruction that doesn't have any source registers is the + * condition-code based KIL instruction added by NV_fragment_program_option. + */ + if (src0 != NULL) { + inst->Base.SrcReg[0] = src0->Base; + inst->SrcReg[0] = *src0; + } else { + init_src_reg(& inst->SrcReg[0]); + } if (src1 != NULL) { inst->Base.SrcReg[1] = src1->Base; diff --git a/src/mesa/shader/program_parse_extra.c b/src/mesa/shader/program_parse_extra.c index cb7b7a5fb2..0656c5eaa8 100644 --- a/src/mesa/shader/program_parse_extra.c +++ b/src/mesa/shader/program_parse_extra.c @@ -94,6 +94,60 @@ _mesa_parse_instruction_suffix(const struct asm_parser_state *state, } +int +_mesa_parse_cc(const char *s) +{ + int cond = 0; + + switch (s[0]) { + case 'E': + if (s[1] == 'Q') { + cond = COND_EQ; + } + break; + + case 'F': + if (s[1] == 'L') { + cond = COND_FL; + } + break; + + case 'G': + if (s[1] == 'E') { + cond = COND_GE; + } else if (s[1] == 'T') { + cond = COND_GT; + } + break; + + case 'L': + if (s[1] == 'E') { + cond = COND_LE; + } else if (s[1] == 'T') { + cond = COND_LT; + } + break; + + case 'N': + if (s[1] == 'E') { + cond = COND_NE; + } + break; + + case 'T': + if (s[1] == 'R') { + cond = COND_TR; + } + break; + + default: + break; + } + + return ((cond == 0) || (s[2] != '\0')) ? 0 : cond; +} + + int _mesa_ARBvp_parse_option(struct asm_parser_state *state, const char *option) { diff --git a/src/mesa/shader/program_parser.h b/src/mesa/shader/program_parser.h index 497891f53d..bce6041381 100644 --- a/src/mesa/shader/program_parser.h +++ b/src/mesa/shader/program_parser.h @@ -278,4 +278,17 @@ extern int _mesa_ARBfp_parse_option(struct asm_parser_state *state, extern int _mesa_parse_instruction_suffix(const struct asm_parser_state *state, const char *suffix, struct prog_instruction *inst); +/** + * Parses a condition code name + * + * The condition code names (e.g., \c LT, \c GT, \c NE) were added to assembly + * shaders with the \c GL_NV_fragment_program_option extension. This function + * converts a string representation into one of the \c COND_ macros. + * + * \return + * One of the \c COND_ macros defined in prog_instruction.h on success or zero + * on failure. + */ +extern int _mesa_parse_cc(const char *s); + /*@}*/ -- cgit v1.2.3 From cfa1a0a609daefffc6f8c4087ed0bc34c2665ef4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 16 Sep 2009 12:57:26 -0600 Subject: st/mesa: fix texture memory allocation bug The following example caused an incorrect GL_OUT_OF_MEMORY error to be raised in glTexSubImage2D: glTexImage2D(level=0, width=32, height=32, pixels=NULL); glTexImage2D(level=0, width=64, height=64, pixels=NULL); glTexSubImage2D(level=0, pixels!=NULL); The second glTexImage2D() call needs to cause the first image to be deallocated then reallocated at the new size. This was not happening because we were testing for pixels==NULL too early. --- src/mesa/state_tracker/st_cb_texture.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 2db28ef0a4..31196fe776 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -661,8 +661,10 @@ st_TexImage(GLcontext * ctx, format, type, pixels, unpack, "glTexImage"); } - if (!pixels) - return; + + /* Note: we can't check for pixels==NULL until after we've allocated + * memory for the texture. + */ /* See if we can do texture compression with a blit/render. */ @@ -673,6 +675,9 @@ st_TexImage(GLcontext * ctx, stImage->pt->format, stImage->pt->target, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) { + if (!pixels) + goto done; + if (compress_with_blit(ctx, target, level, 0, 0, 0, width, height, depth, format, type, pixels, unpack, texImage)) { goto done; @@ -714,6 +719,9 @@ st_TexImage(GLcontext * ctx, return; } + if (!pixels) + goto done; + DBG("Upload image %dx%dx%d row_len %x pitch %x\n", width, height, depth, width * texelBytes, dstRowStride); -- cgit v1.2.3 From 08d39251a79a964e4a3ac0d7d8a397c2b66a0808 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 16 Sep 2009 13:07:12 -0600 Subject: st/mesa: fix some incorrect branching/clean-up code in TexImage functions We need to be sure to call the _mesa_unmap_teximage_pbo() function if we called _mesa_validate_pbo_teximage(). --- src/mesa/state_tracker/st_cb_texture.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 31196fe776..cfa33d48e1 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -764,9 +764,9 @@ st_TexImage(GLcontext * ctx, } } +done: _mesa_unmap_teximage_pbo(ctx, unpack); -done: if (stImage->pt && texImage->Data) { st_texture_image_unmap(ctx->st, stImage); texImage->Data = NULL; @@ -1107,7 +1107,7 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage"); - return; + goto done; } src = (const GLubyte *) pixels; @@ -1138,9 +1138,9 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, } } +done: _mesa_unmap_teximage_pbo(ctx, packing); -done: if (stImage->pt) { st_texture_image_unmap(ctx->st, stImage); texImage->Data = NULL; -- cgit v1.2.3 From 9666529b5a5be1fcde82caadc2fe2efa5ea81e49 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 16 Sep 2009 16:43:50 -0700 Subject: glx: Use initstate_r / random_r instead of corrupting global random number state Previously srandom and random were used. This cause the global random number generator state to be modified. This caused problems for applications that called srandom before calling into GLX. By using local state the global state is left unmodified. This should fix bug #23774. --- src/glx/x11/glxhash.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/glx/x11/glxhash.c b/src/glx/x11/glxhash.c index 74cd4f344d..7d28ada49c 100644 --- a/src/glx/x11/glxhash.c +++ b/src/glx/x11/glxhash.c @@ -87,9 +87,13 @@ #define HASH_ALLOC malloc #define HASH_FREE free -#define HASH_RANDOM_DECL -#define HASH_RANDOM_INIT(seed) srandom(seed) -#define HASH_RANDOM random() +#define HASH_RANDOM_DECL struct random_data rd; int32_t rv; char rs[256] +#define HASH_RANDOM_INIT(seed) \ + do { \ + (void) memset(&rd, 0, sizeof(rd)); \ + (void) initstate_r(seed, rs, sizeof(rs), &rd); \ + } while(0) +#define HASH_RANDOM ((void) random_r(&rd, &rv), rv) #define HASH_RANDOM_DESTROY typedef struct __glxHashBucket -- cgit v1.2.3 From fac38e8c8f1814ae54703b872db8c6dd21c34a3b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 16 Sep 2009 21:21:42 -0600 Subject: mesa: fix clip plane, fog issues --- src/mesa/drivers/common/meta.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 47090ba297..ddd476eba1 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -656,7 +656,6 @@ _mesa_meta_end(GLcontext *ctx) _mesa_MatrixMode(save->MatrixMode); - save->ClipPlanesEnabled = ctx->Transform.ClipPlanesEnabled; if (save->ClipPlanesEnabled) { GLuint i; for (i = 0; i < ctx->Const.MaxClipPlanes; i++) { @@ -692,9 +691,6 @@ _mesa_meta_end(GLcontext *ctx) if (save->Lighting) { _mesa_set_enable(ctx, GL_LIGHTING, GL_TRUE); } - if (save->Fog) { - _mesa_set_enable(ctx, GL_FOG, GL_TRUE); - } } -- cgit v1.2.3 From 5f0b49e7a956291842c7ad3a597570cf0db50cb6 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 17 Sep 2009 16:04:35 +0100 Subject: tgsi: Scan input interpolators, too. --- src/gallium/auxiliary/tgsi/tgsi_scan.c | 1 + src/gallium/auxiliary/tgsi/tgsi_scan.h | 1 + 2 files changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c index c535788819..0db4481a3d 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c @@ -132,6 +132,7 @@ tgsi_scan_shader(const struct tgsi_token *tokens, if (file == TGSI_FILE_INPUT) { info->input_semantic_name[reg] = (ubyte)fulldecl->Semantic.SemanticName; info->input_semantic_index[reg] = (ubyte)fulldecl->Semantic.SemanticIndex; + info->input_interpolate[reg] = (ubyte)fulldecl->Declaration.Interpolate; info->num_inputs++; } else if (file == TGSI_FILE_OUTPUT) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.h b/src/gallium/auxiliary/tgsi/tgsi_scan.h index 2c1a75bc81..8a7ee0c7e4 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.h +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.h @@ -45,6 +45,7 @@ struct tgsi_shader_info ubyte num_outputs; ubyte input_semantic_name[PIPE_MAX_SHADER_INPUTS]; /**< TGSI_SEMANTIC_x */ ubyte input_semantic_index[PIPE_MAX_SHADER_INPUTS]; + ubyte input_interpolate[PIPE_MAX_SHADER_INPUTS]; ubyte output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; /**< TGSI_SEMANTIC_x */ ubyte output_semantic_index[PIPE_MAX_SHADER_OUTPUTS]; -- cgit v1.2.3 From fb2c7b6743ba6e89f24843890fb7fcd6a09c3dbb Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 17 Sep 2009 16:05:08 +0100 Subject: softpipe: Respect input interpolators for the shader. --- src/gallium/drivers/softpipe/sp_state_derived.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index 75551000c9..9258f64109 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -91,6 +91,23 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe) vinfo->num_attribs = 0; for (i = 0; i < spfs->info.num_inputs; i++) { int src; + enum interp_mode interp; + + switch (spfs->info.input_interpolate[i]) { + case TGSI_INTERPOLATE_CONSTANT: + interp = INTERP_CONSTANT; + break; + case TGSI_INTERPOLATE_LINEAR: + interp = INTERP_LINEAR; + break; + case TGSI_INTERPOLATE_PERSPECTIVE: + interp = INTERP_PERSPECTIVE; + break; + default: + assert(0); + interp = INTERP_LINEAR; + } + switch (spfs->info.input_semantic_name[i]) { case TGSI_SEMANTIC_POSITION: src = draw_find_vs_output(softpipe->draw, @@ -106,7 +123,7 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe) case TGSI_SEMANTIC_FOG: src = draw_find_vs_output(softpipe->draw, TGSI_SEMANTIC_FOG, 0); - draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src); + draw_emit_vertex_attr(vinfo, EMIT_4F, interp, src); break; case TGSI_SEMANTIC_GENERIC: @@ -114,7 +131,7 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe) /* this includes texcoords and varying vars */ src = draw_find_vs_output(softpipe->draw, TGSI_SEMANTIC_GENERIC, spfs->info.input_semantic_index[i]); - draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src); + draw_emit_vertex_attr(vinfo, EMIT_4F, interp, src); break; default: -- cgit v1.2.3 From a66bab0e379c3add034667ed394bcead386d8c10 Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Fri, 18 Sep 2009 13:29:28 +0800 Subject: [i965] use intel_batchbuffer_flush to flush the clear --- src/mesa/drivers/dri/intel/intel_clear.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index 9efe6a277c..736434d763 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -170,8 +170,9 @@ intelClear(GLcontext *ctx, GLbitfield mask) } DBG("\n"); } - intelFlush(&intel->ctx); + _mesa_meta_clear(&intel->ctx, tri_mask); + intel_batchbuffer_flush(intel->batch); } if (swrast_mask) { -- cgit v1.2.3 From 1e4c3535111dc431e4fe51da6892259a5ebe2ae6 Mon Sep 17 00:00:00 2001 From: Zou Nan hai Date: Fri, 18 Sep 2009 16:04:41 +0800 Subject: [i965] add a missing header file --- src/mesa/drivers/dri/intel/intel_clear.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index 736434d763..9010b910c7 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -38,6 +38,7 @@ #include "intel_fbo.h" #include "intel_pixel.h" #include "intel_regions.h" +#include "intel_batchbuffer.h" #define FILE_DEBUG_FLAG DEBUG_BLIT -- cgit v1.2.3 From de685b37a91bc95dd4093a44a49b7b47385b1f7c Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 18 Sep 2009 14:36:59 +0100 Subject: softpipe: Fix cube face selection. If arx and ary are equal, we still want to choose from one of them, and not arz. --- src/gallium/drivers/softpipe/sp_tex_sample.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index a1d3bade27..f99a30277d 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -464,7 +464,7 @@ choose_cube_face(float rx, float ry, float rz, float *newS, float *newT) unsigned face; float sc, tc, ma; - if (arx > ary && arx > arz) { + if (arx >= ary && arx >= arz) { if (rx >= 0.0F) { face = PIPE_TEX_FACE_POS_X; sc = -rz; @@ -478,7 +478,7 @@ choose_cube_face(float rx, float ry, float rz, float *newS, float *newT) ma = arx; } } - else if (ary > arx && ary > arz) { + else if (ary >= arx && ary >= arz) { if (ry >= 0.0F) { face = PIPE_TEX_FACE_POS_Y; sc = rx; -- cgit v1.2.3 From fdd605e446ed174bae13171d116f498704259057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sat, 19 Sep 2009 14:33:35 +0100 Subject: mesa: Allow BlitFramebuffer from a texture. Although GL_EXT_framebuffer_blit does not mention textures, it doesn't forbid them either, and some thirdparty driver appear to support this. --- src/mesa/state_tracker/st_cb_blit.c | 56 +++++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_blit.c b/src/mesa/state_tracker/st_cb_blit.c index c741940bcf..5626e25323 100644 --- a/src/mesa/state_tracker/st_cb_blit.c +++ b/src/mesa/state_tracker/st_cb_blit.c @@ -39,6 +39,7 @@ #include "shader/prog_print.h" #include "st_context.h" +#include "st_texture.h" #include "st_program.h" #include "st_cb_blit.h" #include "st_cb_fbo.h" @@ -110,17 +111,50 @@ st_BlitFramebuffer(GLcontext *ctx, } if (mask & GL_COLOR_BUFFER_BIT) { - struct st_renderbuffer *srcRb = - st_renderbuffer(readFB->_ColorReadBuffer); - struct st_renderbuffer *dstRb = - st_renderbuffer(drawFB->_ColorDrawBuffers[0]); - struct pipe_surface *srcSurf = srcRb->surface; - struct pipe_surface *dstSurf = dstRb->surface; - - util_blit_pixels(st->blit, - srcSurf, srcX0, srcY0, srcX1, srcY1, - dstSurf, dstX0, dstY0, dstX1, dstY1, - 0.0, pFilter); + struct gl_renderbuffer_attachment *srcAtt = + &readFB->Attachment[readFB->_ColorReadBufferIndex]; + + if(srcAtt->Type == GL_TEXTURE) { + struct pipe_screen *screen = ctx->st->pipe->screen; + const struct st_texture_object *srcObj = + st_texture_object(srcAtt->Texture); + struct st_renderbuffer *dstRb = + st_renderbuffer(drawFB->_ColorDrawBuffers[0]); + struct pipe_surface *srcSurf; + struct pipe_surface *dstSurf = dstRb->surface; + + if (!srcObj->pt) + return; + + srcSurf = screen->get_tex_surface(screen, + srcObj->pt, + srcAtt->CubeMapFace, + srcAtt->TextureLevel, + srcAtt->Zoffset, + PIPE_BUFFER_USAGE_GPU_READ); + if(!srcSurf) + return; + + util_blit_pixels(st->blit, + srcSurf, srcX0, srcY0, srcX1, srcY1, + dstSurf, dstX0, dstY0, dstX1, dstY1, + 0.0, pFilter); + + pipe_surface_reference(&srcSurf, NULL); + } + else { + struct st_renderbuffer *srcRb = + st_renderbuffer(readFB->_ColorReadBuffer); + struct st_renderbuffer *dstRb = + st_renderbuffer(drawFB->_ColorDrawBuffers[0]); + struct pipe_surface *srcSurf = srcRb->surface; + struct pipe_surface *dstSurf = dstRb->surface; + + util_blit_pixels(st->blit, + srcSurf, srcX0, srcY0, srcX1, srcY1, + dstSurf, dstX0, dstY0, dstX1, dstY1, + 0.0, pFilter); + } } if (mask & depthStencil) { -- cgit v1.2.3 From 18d0f9a7a38674367eca25e87f67ddf423d8c4f7 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 17 Sep 2009 16:05:08 +0100 Subject: llvmpipe: Respect input interpolators for the shader. Cherry-picked from fb2c7b6743ba6e89f24843890fb7fcd6a09c3dbb --- src/gallium/drivers/llvmpipe/lp_state_derived.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_state_derived.c b/src/gallium/drivers/llvmpipe/lp_state_derived.c index e87976b9f3..30fb41ea65 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_derived.c +++ b/src/gallium/drivers/llvmpipe/lp_state_derived.c @@ -93,6 +93,23 @@ llvmpipe_get_vertex_info(struct llvmpipe_context *llvmpipe) vinfo->num_attribs = 0; for (i = 0; i < lpfs->info.num_inputs; i++) { int src; + enum interp_mode interp; + + switch (lpfs->info.input_interpolate[i]) { + case TGSI_INTERPOLATE_CONSTANT: + interp = INTERP_CONSTANT; + break; + case TGSI_INTERPOLATE_LINEAR: + interp = INTERP_LINEAR; + break; + case TGSI_INTERPOLATE_PERSPECTIVE: + interp = INTERP_PERSPECTIVE; + break; + default: + assert(0); + interp = INTERP_LINEAR; + } + switch (lpfs->info.input_semantic_name[i]) { case TGSI_SEMANTIC_POSITION: src = draw_find_vs_output(llvmpipe->draw, @@ -108,7 +125,7 @@ llvmpipe_get_vertex_info(struct llvmpipe_context *llvmpipe) case TGSI_SEMANTIC_FOG: src = draw_find_vs_output(llvmpipe->draw, TGSI_SEMANTIC_FOG, 0); - draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src); + draw_emit_vertex_attr(vinfo, EMIT_4F, interp, src); break; case TGSI_SEMANTIC_GENERIC: @@ -116,7 +133,7 @@ llvmpipe_get_vertex_info(struct llvmpipe_context *llvmpipe) /* this includes texcoords and varying vars */ src = draw_find_vs_output(llvmpipe->draw, TGSI_SEMANTIC_GENERIC, lpfs->info.input_semantic_index[i]); - draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src); + draw_emit_vertex_attr(vinfo, EMIT_4F, interp, src); break; default: -- cgit v1.2.3 From c9a87ff441857a8af405f3df16d8c2f590e5b10e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 10:00:19 -0600 Subject: glapi: added tokens, function for GL_ARB_provoking_vertex --- src/mesa/glapi/EXT_provoking_vertex.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/mesa/glapi/EXT_provoking_vertex.xml b/src/mesa/glapi/EXT_provoking_vertex.xml index f528a2c7d3..71d2c72909 100644 --- a/src/mesa/glapi/EXT_provoking_vertex.xml +++ b/src/mesa/glapi/EXT_provoking_vertex.xml @@ -19,4 +19,17 @@ + + + + + + + + + + + + + -- cgit v1.2.3 From 22f02509f27a5cab967d42a317e58a73c7d26e0b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 10:00:55 -0600 Subject: glapi: regenerated files --- src/mesa/drivers/dri/common/extension_helper.h | 10 +- src/mesa/glapi/glapitemp.h | 6 + src/mesa/glapi/glprocs.h | 2 + src/mesa/main/enums.c | 4808 ++++++++++++------------ src/mesa/sparc/glapi_sparc.S | 1 + src/mesa/x86-64/glapi_x86-64.S | 1 + src/mesa/x86/glapi_x86.S | 1 + 7 files changed, 2428 insertions(+), 2401 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/common/extension_helper.h b/src/mesa/drivers/dri/common/extension_helper.h index 2c89a9f58a..5e86324eec 100644 --- a/src/mesa/drivers/dri/common/extension_helper.h +++ b/src/mesa/drivers/dri/common/extension_helper.h @@ -4417,10 +4417,11 @@ static const char SpriteParameterivSGIX_names[] = ""; #endif -#if defined(need_GL_EXT_provoking_vertex) +#if defined(need_GL_EXT_provoking_vertex) || defined(need_GL_ARB_provoking_vertex) static const char ProvokingVertexEXT_names[] = "i\0" /* Parameter signature */ "glProvokingVertexEXT\0" + "glProvokingVertex\0" ""; #endif @@ -5194,6 +5195,13 @@ static const struct dri_extension_function GL_ARB_point_parameters_functions[] = }; #endif +#if defined(need_GL_ARB_provoking_vertex) +static const struct dri_extension_function GL_ARB_provoking_vertex_functions[] = { + { ProvokingVertexEXT_names, ProvokingVertexEXT_remap_index, -1 }, + { NULL, 0, 0 } +}; +#endif + #if defined(need_GL_ARB_shader_objects) static const struct dri_extension_function GL_ARB_shader_objects_functions[] = { { UniformMatrix3fvARB_names, UniformMatrix3fvARB_remap_index, -1 }, diff --git a/src/mesa/glapi/glapitemp.h b/src/mesa/glapi/glapitemp.h index 3da0f63143..d9a3690f2a 100644 --- a/src/mesa/glapi/glapitemp.h +++ b/src/mesa/glapi/glapitemp.h @@ -5677,6 +5677,11 @@ KEYWORD1 void KEYWORD2 NAME(ProvokingVertexEXT)(GLenum mode) DISPATCH(ProvokingVertexEXT, (mode), (F, "glProvokingVertexEXT(0x%x);\n", mode)); } +KEYWORD1 void KEYWORD2 NAME(ProvokingVertex)(GLenum mode) +{ + DISPATCH(ProvokingVertexEXT, (mode), (F, "glProvokingVertex(0x%x);\n", mode)); +} + KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_788)(GLenum target, GLenum pname, GLvoid ** params); KEYWORD1_ALT void KEYWORD2 NAME(_dispatch_stub_788)(GLenum target, GLenum pname, GLvoid ** params) @@ -6923,6 +6928,7 @@ static _glapi_proc UNUSED_TABLE_NAME[] = { TABLE_ENTRY(RenderbufferStorage), TABLE_ENTRY(BlitFramebuffer), TABLE_ENTRY(FramebufferTextureLayer), + TABLE_ENTRY(ProvokingVertex), }; #endif /*UNUSED_TABLE_NAME*/ diff --git a/src/mesa/glapi/glprocs.h b/src/mesa/glapi/glprocs.h index fc0fcd331a..c29f8b57be 100644 --- a/src/mesa/glapi/glprocs.h +++ b/src/mesa/glapi/glprocs.h @@ -1147,6 +1147,7 @@ static const char gl_string_table[] = "glRenderbufferStorage\0" "glBlitFramebuffer\0" "glFramebufferTextureLayer\0" + "glProvokingVertex\0" ; @@ -2353,6 +2354,7 @@ static const glprocs_table_t static_functions[] = { NAME_FUNC_OFFSET(19722, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), NAME_FUNC_OFFSET(19744, gl_dispatch_stub_783, gl_dispatch_stub_783, NULL, _gloffset_BlitFramebufferEXT), NAME_FUNC_OFFSET(19762, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), + NAME_FUNC_OFFSET(19788, glProvokingVertexEXT, glProvokingVertexEXT, NULL, _gloffset_ProvokingVertexEXT), NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0) }; diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c index 2d1594eb7a..606d50c59a 100644 --- a/src/mesa/main/enums.c +++ b/src/mesa/main/enums.c @@ -519,6 +519,7 @@ LONGSTRING static const char enum_string_table[] = "GL_FEEDBACK_BUFFER_SIZE\0" "GL_FEEDBACK_BUFFER_TYPE\0" "GL_FILL\0" + "GL_FIRST_VERTEX_CONVENTION\0" "GL_FIRST_VERTEX_CONVENTION_EXT\0" "GL_FLAT\0" "GL_FLOAT\0" @@ -702,6 +703,7 @@ LONGSTRING static const char enum_string_table[] = "GL_INVERSE_TRANSPOSE_NV\0" "GL_INVERT\0" "GL_KEEP\0" + "GL_LAST_VERTEX_CONVENTION\0" "GL_LAST_VERTEX_CONVENTION_EXT\0" "GL_LEFT\0" "GL_LEQUAL\0" @@ -1288,6 +1290,7 @@ LONGSTRING static const char enum_string_table[] = "GL_PROJECTION\0" "GL_PROJECTION_MATRIX\0" "GL_PROJECTION_STACK_DEPTH\0" + "GL_PROVOKING_VERTEX\0" "GL_PROVOKING_VERTEX_EXT\0" "GL_PROXY_COLOR_TABLE\0" "GL_PROXY_HISTOGRAM\0" @@ -1309,6 +1312,7 @@ LONGSTRING static const char enum_string_table[] = "GL_Q\0" "GL_QUADRATIC_ATTENUATION\0" "GL_QUADS\0" + "GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION\0" "GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT\0" "GL_QUAD_MESH_SUN\0" "GL_QUAD_STRIP\0" @@ -1896,7 +1900,7 @@ LONGSTRING static const char enum_string_table[] = "GL_ZOOM_Y\0" ; -static const enum_elt all_enums[1858] = +static const enum_elt all_enums[1862] = { { 0, 0x00000600 }, /* GL_2D */ { 6, 0x00001407 }, /* GL_2_BYTES */ @@ -2381,1460 +2385,1464 @@ static const enum_elt all_enums[1858] = { 9670, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */ { 9694, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */ { 9718, 0x00001B02 }, /* GL_FILL */ - { 9726, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION_EXT */ - { 9757, 0x00001D00 }, /* GL_FLAT */ - { 9765, 0x00001406 }, /* GL_FLOAT */ - { 9774, 0x00008B5A }, /* GL_FLOAT_MAT2 */ - { 9788, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */ - { 9806, 0x00008B65 }, /* GL_FLOAT_MAT2x3 */ - { 9822, 0x00008B66 }, /* GL_FLOAT_MAT2x4 */ - { 9838, 0x00008B5B }, /* GL_FLOAT_MAT3 */ - { 9852, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */ - { 9870, 0x00008B67 }, /* GL_FLOAT_MAT3x2 */ - { 9886, 0x00008B68 }, /* GL_FLOAT_MAT3x4 */ - { 9902, 0x00008B5C }, /* GL_FLOAT_MAT4 */ - { 9916, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */ - { 9934, 0x00008B69 }, /* GL_FLOAT_MAT4x2 */ - { 9950, 0x00008B6A }, /* GL_FLOAT_MAT4x3 */ - { 9966, 0x00008B50 }, /* GL_FLOAT_VEC2 */ - { 9980, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */ - { 9998, 0x00008B51 }, /* GL_FLOAT_VEC3 */ - { 10012, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */ - { 10030, 0x00008B52 }, /* GL_FLOAT_VEC4 */ - { 10044, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */ - { 10062, 0x00000B60 }, /* GL_FOG */ - { 10069, 0x00000080 }, /* GL_FOG_BIT */ - { 10080, 0x00000B66 }, /* GL_FOG_COLOR */ - { 10093, 0x00008451 }, /* GL_FOG_COORD */ - { 10106, 0x00008451 }, /* GL_FOG_COORDINATE */ - { 10124, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */ - { 10148, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ - { 10187, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */ - { 10230, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */ - { 10262, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ - { 10293, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */ - { 10322, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */ - { 10347, 0x00008457 }, /* GL_FOG_COORD_ARRAY */ - { 10366, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */ - { 10400, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */ - { 10427, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */ - { 10453, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */ - { 10477, 0x00008450 }, /* GL_FOG_COORD_SRC */ - { 10494, 0x00000B62 }, /* GL_FOG_DENSITY */ - { 10509, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */ - { 10533, 0x00000B64 }, /* GL_FOG_END */ - { 10544, 0x00000C54 }, /* GL_FOG_HINT */ - { 10556, 0x00000B61 }, /* GL_FOG_INDEX */ - { 10569, 0x00000B65 }, /* GL_FOG_MODE */ - { 10581, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */ - { 10600, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */ - { 10625, 0x00000B63 }, /* GL_FOG_START */ - { 10638, 0x00008452 }, /* GL_FRAGMENT_DEPTH */ - { 10656, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */ - { 10680, 0x00008B30 }, /* GL_FRAGMENT_SHADER */ - { 10699, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */ - { 10722, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ - { 10757, 0x00008D40 }, /* GL_FRAMEBUFFER */ - { 10772, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ - { 10809, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ - { 10845, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ - { 10886, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ - { 10927, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ - { 10964, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ - { 11001, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ - { 11039, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */ - { 11081, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ - { 11119, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */ - { 11161, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ - { 11196, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ - { 11235, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */ - { 11284, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ - { 11332, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */ - { 11384, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ - { 11424, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ - { 11468, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ - { 11508, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */ - { 11552, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */ - { 11579, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */ - { 11603, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */ - { 11631, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */ - { 11654, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */ - { 11673, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ - { 11710, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */ - { 11751, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ - { 11792, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ - { 11834, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ - { 11885, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ - { 11923, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ - { 11968, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */ - { 12017, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ - { 12055, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ - { 12097, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ - { 12129, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */ - { 12154, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */ - { 12181, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */ - { 12212, 0x00000404 }, /* GL_FRONT */ - { 12221, 0x00000408 }, /* GL_FRONT_AND_BACK */ - { 12239, 0x00000B46 }, /* GL_FRONT_FACE */ - { 12253, 0x00000400 }, /* GL_FRONT_LEFT */ - { 12267, 0x00000401 }, /* GL_FRONT_RIGHT */ - { 12282, 0x00008006 }, /* GL_FUNC_ADD */ - { 12294, 0x00008006 }, /* GL_FUNC_ADD_EXT */ - { 12310, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */ - { 12335, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */ - { 12364, 0x0000800A }, /* GL_FUNC_SUBTRACT */ - { 12381, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */ - { 12402, 0x00008191 }, /* GL_GENERATE_MIPMAP */ - { 12421, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */ - { 12445, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */ - { 12474, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */ - { 12498, 0x00000206 }, /* GL_GEQUAL */ - { 12508, 0x00000204 }, /* GL_GREATER */ - { 12519, 0x00001904 }, /* GL_GREEN */ - { 12528, 0x00000D19 }, /* GL_GREEN_BIAS */ - { 12542, 0x00000D53 }, /* GL_GREEN_BITS */ - { 12556, 0x00000D18 }, /* GL_GREEN_SCALE */ - { 12571, 0x00008000 }, /* GL_HINT_BIT */ - { 12583, 0x00008024 }, /* GL_HISTOGRAM */ - { 12596, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */ - { 12620, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */ - { 12648, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */ - { 12671, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */ - { 12698, 0x00008024 }, /* GL_HISTOGRAM_EXT */ - { 12715, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */ - { 12735, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */ - { 12759, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */ - { 12783, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */ - { 12811, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */ - { 12839, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */ - { 12871, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */ - { 12893, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */ - { 12919, 0x0000802D }, /* GL_HISTOGRAM_SINK */ - { 12937, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */ - { 12959, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */ - { 12978, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */ - { 13001, 0x0000862A }, /* GL_IDENTITY_NV */ - { 13016, 0x00008150 }, /* GL_IGNORE_BORDER_HP */ - { 13036, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ - { 13076, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ - { 13114, 0x00001E02 }, /* GL_INCR */ - { 13122, 0x00008507 }, /* GL_INCR_WRAP */ - { 13135, 0x00008507 }, /* GL_INCR_WRAP_EXT */ - { 13152, 0x00008222 }, /* GL_INDEX */ - { 13161, 0x00008077 }, /* GL_INDEX_ARRAY */ - { 13176, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */ - { 13206, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */ - { 13240, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */ - { 13263, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */ - { 13285, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */ - { 13305, 0x00000D51 }, /* GL_INDEX_BITS */ - { 13319, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */ - { 13340, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */ - { 13358, 0x00000C30 }, /* GL_INDEX_MODE */ - { 13372, 0x00000D13 }, /* GL_INDEX_OFFSET */ - { 13388, 0x00000D12 }, /* GL_INDEX_SHIFT */ - { 13403, 0x00000C21 }, /* GL_INDEX_WRITEMASK */ - { 13422, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */ - { 13441, 0x00001404 }, /* GL_INT */ - { 13448, 0x00008049 }, /* GL_INTENSITY */ - { 13461, 0x0000804C }, /* GL_INTENSITY12 */ - { 13476, 0x0000804C }, /* GL_INTENSITY12_EXT */ - { 13495, 0x0000804D }, /* GL_INTENSITY16 */ - { 13510, 0x0000804D }, /* GL_INTENSITY16_EXT */ - { 13529, 0x0000804A }, /* GL_INTENSITY4 */ - { 13543, 0x0000804A }, /* GL_INTENSITY4_EXT */ - { 13561, 0x0000804B }, /* GL_INTENSITY8 */ - { 13575, 0x0000804B }, /* GL_INTENSITY8_EXT */ - { 13593, 0x00008049 }, /* GL_INTENSITY_EXT */ - { 13610, 0x00008575 }, /* GL_INTERPOLATE */ - { 13625, 0x00008575 }, /* GL_INTERPOLATE_ARB */ - { 13644, 0x00008575 }, /* GL_INTERPOLATE_EXT */ - { 13663, 0x00008B53 }, /* GL_INT_VEC2 */ - { 13675, 0x00008B53 }, /* GL_INT_VEC2_ARB */ - { 13691, 0x00008B54 }, /* GL_INT_VEC3 */ - { 13703, 0x00008B54 }, /* GL_INT_VEC3_ARB */ - { 13719, 0x00008B55 }, /* GL_INT_VEC4 */ - { 13731, 0x00008B55 }, /* GL_INT_VEC4_ARB */ - { 13747, 0x00000500 }, /* GL_INVALID_ENUM */ - { 13763, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */ - { 13796, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */ - { 13833, 0x00000502 }, /* GL_INVALID_OPERATION */ - { 13854, 0x00000501 }, /* GL_INVALID_VALUE */ - { 13871, 0x0000862B }, /* GL_INVERSE_NV */ - { 13885, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */ - { 13909, 0x0000150A }, /* GL_INVERT */ - { 13919, 0x00001E00 }, /* GL_KEEP */ - { 13927, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION_EXT */ - { 13957, 0x00000406 }, /* GL_LEFT */ - { 13965, 0x00000203 }, /* GL_LEQUAL */ - { 13975, 0x00000201 }, /* GL_LESS */ - { 13983, 0x00004000 }, /* GL_LIGHT0 */ - { 13993, 0x00004001 }, /* GL_LIGHT1 */ - { 14003, 0x00004002 }, /* GL_LIGHT2 */ - { 14013, 0x00004003 }, /* GL_LIGHT3 */ - { 14023, 0x00004004 }, /* GL_LIGHT4 */ - { 14033, 0x00004005 }, /* GL_LIGHT5 */ - { 14043, 0x00004006 }, /* GL_LIGHT6 */ - { 14053, 0x00004007 }, /* GL_LIGHT7 */ - { 14063, 0x00000B50 }, /* GL_LIGHTING */ - { 14075, 0x00000040 }, /* GL_LIGHTING_BIT */ - { 14091, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */ - { 14114, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */ - { 14143, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */ - { 14176, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ - { 14204, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */ - { 14228, 0x00001B01 }, /* GL_LINE */ - { 14236, 0x00002601 }, /* GL_LINEAR */ - { 14246, 0x00001208 }, /* GL_LINEAR_ATTENUATION */ - { 14268, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ - { 14298, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ - { 14329, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */ - { 14353, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */ - { 14378, 0x00000001 }, /* GL_LINES */ - { 14387, 0x00000004 }, /* GL_LINE_BIT */ - { 14399, 0x00000002 }, /* GL_LINE_LOOP */ - { 14412, 0x00000707 }, /* GL_LINE_RESET_TOKEN */ - { 14432, 0x00000B20 }, /* GL_LINE_SMOOTH */ - { 14447, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */ - { 14467, 0x00000B24 }, /* GL_LINE_STIPPLE */ - { 14483, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */ - { 14507, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */ - { 14530, 0x00000003 }, /* GL_LINE_STRIP */ - { 14544, 0x00000702 }, /* GL_LINE_TOKEN */ - { 14558, 0x00000B21 }, /* GL_LINE_WIDTH */ - { 14572, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */ - { 14598, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */ - { 14618, 0x00008B82 }, /* GL_LINK_STATUS */ - { 14633, 0x00000B32 }, /* GL_LIST_BASE */ - { 14646, 0x00020000 }, /* GL_LIST_BIT */ - { 14658, 0x00000B33 }, /* GL_LIST_INDEX */ - { 14672, 0x00000B30 }, /* GL_LIST_MODE */ - { 14685, 0x00000101 }, /* GL_LOAD */ - { 14693, 0x00000BF1 }, /* GL_LOGIC_OP */ - { 14705, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */ - { 14722, 0x00008CA1 }, /* GL_LOWER_LEFT */ - { 14736, 0x00001909 }, /* GL_LUMINANCE */ - { 14749, 0x00008041 }, /* GL_LUMINANCE12 */ - { 14764, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */ - { 14787, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */ - { 14814, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */ - { 14836, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */ - { 14862, 0x00008041 }, /* GL_LUMINANCE12_EXT */ - { 14881, 0x00008042 }, /* GL_LUMINANCE16 */ - { 14896, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */ - { 14919, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */ - { 14946, 0x00008042 }, /* GL_LUMINANCE16_EXT */ - { 14965, 0x0000803F }, /* GL_LUMINANCE4 */ - { 14979, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */ - { 15000, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */ - { 15025, 0x0000803F }, /* GL_LUMINANCE4_EXT */ - { 15043, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */ - { 15064, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */ - { 15089, 0x00008040 }, /* GL_LUMINANCE8 */ - { 15103, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */ - { 15124, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */ - { 15149, 0x00008040 }, /* GL_LUMINANCE8_EXT */ - { 15167, 0x0000190A }, /* GL_LUMINANCE_ALPHA */ - { 15186, 0x00000D90 }, /* GL_MAP1_COLOR_4 */ - { 15202, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */ - { 15222, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */ - { 15244, 0x00000D91 }, /* GL_MAP1_INDEX */ - { 15258, 0x00000D92 }, /* GL_MAP1_NORMAL */ - { 15273, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */ - { 15297, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */ - { 15321, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */ - { 15345, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */ - { 15369, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */ - { 15386, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */ - { 15403, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ - { 15431, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ - { 15460, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ - { 15489, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ - { 15518, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ - { 15547, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ - { 15576, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ - { 15605, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ - { 15633, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ - { 15661, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ - { 15689, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ - { 15717, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ - { 15745, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ - { 15773, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ - { 15801, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ - { 15829, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ - { 15857, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */ - { 15873, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */ - { 15893, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */ - { 15915, 0x00000DB1 }, /* GL_MAP2_INDEX */ - { 15929, 0x00000DB2 }, /* GL_MAP2_NORMAL */ - { 15944, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */ - { 15968, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */ - { 15992, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */ - { 16016, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */ - { 16040, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */ - { 16057, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */ - { 16074, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ - { 16102, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ - { 16131, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ - { 16160, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ - { 16189, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ - { 16218, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ - { 16247, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ - { 16276, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ - { 16304, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ - { 16332, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ - { 16360, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ - { 16388, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ - { 16416, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ - { 16444, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */ - { 16472, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ - { 16500, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ - { 16528, 0x00000D10 }, /* GL_MAP_COLOR */ - { 16541, 0x00000010 }, /* GL_MAP_FLUSH_EXPLICIT_BIT */ - { 16567, 0x00000008 }, /* GL_MAP_INVALIDATE_BUFFER_BIT */ - { 16596, 0x00000004 }, /* GL_MAP_INVALIDATE_RANGE_BIT */ - { 16624, 0x00000001 }, /* GL_MAP_READ_BIT */ - { 16640, 0x00000D11 }, /* GL_MAP_STENCIL */ - { 16655, 0x00000020 }, /* GL_MAP_UNSYNCHRONIZED_BIT */ - { 16681, 0x00000002 }, /* GL_MAP_WRITE_BIT */ - { 16698, 0x000088C0 }, /* GL_MATRIX0_ARB */ - { 16713, 0x00008630 }, /* GL_MATRIX0_NV */ - { 16727, 0x000088CA }, /* GL_MATRIX10_ARB */ - { 16743, 0x000088CB }, /* GL_MATRIX11_ARB */ - { 16759, 0x000088CC }, /* GL_MATRIX12_ARB */ - { 16775, 0x000088CD }, /* GL_MATRIX13_ARB */ - { 16791, 0x000088CE }, /* GL_MATRIX14_ARB */ - { 16807, 0x000088CF }, /* GL_MATRIX15_ARB */ - { 16823, 0x000088D0 }, /* GL_MATRIX16_ARB */ - { 16839, 0x000088D1 }, /* GL_MATRIX17_ARB */ - { 16855, 0x000088D2 }, /* GL_MATRIX18_ARB */ - { 16871, 0x000088D3 }, /* GL_MATRIX19_ARB */ - { 16887, 0x000088C1 }, /* GL_MATRIX1_ARB */ - { 16902, 0x00008631 }, /* GL_MATRIX1_NV */ - { 16916, 0x000088D4 }, /* GL_MATRIX20_ARB */ - { 16932, 0x000088D5 }, /* GL_MATRIX21_ARB */ - { 16948, 0x000088D6 }, /* GL_MATRIX22_ARB */ - { 16964, 0x000088D7 }, /* GL_MATRIX23_ARB */ - { 16980, 0x000088D8 }, /* GL_MATRIX24_ARB */ - { 16996, 0x000088D9 }, /* GL_MATRIX25_ARB */ - { 17012, 0x000088DA }, /* GL_MATRIX26_ARB */ - { 17028, 0x000088DB }, /* GL_MATRIX27_ARB */ - { 17044, 0x000088DC }, /* GL_MATRIX28_ARB */ - { 17060, 0x000088DD }, /* GL_MATRIX29_ARB */ - { 17076, 0x000088C2 }, /* GL_MATRIX2_ARB */ - { 17091, 0x00008632 }, /* GL_MATRIX2_NV */ - { 17105, 0x000088DE }, /* GL_MATRIX30_ARB */ - { 17121, 0x000088DF }, /* GL_MATRIX31_ARB */ - { 17137, 0x000088C3 }, /* GL_MATRIX3_ARB */ - { 17152, 0x00008633 }, /* GL_MATRIX3_NV */ - { 17166, 0x000088C4 }, /* GL_MATRIX4_ARB */ - { 17181, 0x00008634 }, /* GL_MATRIX4_NV */ - { 17195, 0x000088C5 }, /* GL_MATRIX5_ARB */ - { 17210, 0x00008635 }, /* GL_MATRIX5_NV */ - { 17224, 0x000088C6 }, /* GL_MATRIX6_ARB */ - { 17239, 0x00008636 }, /* GL_MATRIX6_NV */ - { 17253, 0x000088C7 }, /* GL_MATRIX7_ARB */ - { 17268, 0x00008637 }, /* GL_MATRIX7_NV */ - { 17282, 0x000088C8 }, /* GL_MATRIX8_ARB */ - { 17297, 0x000088C9 }, /* GL_MATRIX9_ARB */ - { 17312, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */ - { 17338, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ - { 17372, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ - { 17403, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ - { 17436, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ - { 17467, 0x00000BA0 }, /* GL_MATRIX_MODE */ - { 17482, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */ - { 17504, 0x00008008 }, /* GL_MAX */ - { 17511, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */ - { 17534, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ - { 17566, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */ - { 17592, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ - { 17625, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ - { 17651, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - { 17685, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */ - { 17704, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ - { 17733, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ - { 17765, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */ - { 17801, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ - { 17837, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */ - { 17877, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */ - { 17903, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */ - { 17933, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */ - { 17958, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */ - { 17987, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ - { 18016, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */ - { 18049, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */ - { 18069, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */ - { 18093, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */ - { 18117, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */ - { 18141, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */ - { 18166, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */ - { 18184, 0x00008008 }, /* GL_MAX_EXT */ - { 18195, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ - { 18230, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */ - { 18269, 0x00000D31 }, /* GL_MAX_LIGHTS */ - { 18283, 0x00000B31 }, /* GL_MAX_LIST_NESTING */ - { 18303, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ - { 18341, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */ - { 18370, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */ - { 18394, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */ - { 18422, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */ - { 18445, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ - { 18482, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ - { 18518, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ - { 18545, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ - { 18574, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ - { 18608, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ - { 18644, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ - { 18671, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ - { 18703, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ - { 18739, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ - { 18768, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ - { 18797, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */ - { 18825, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ - { 18863, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - { 18907, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - { 18950, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ - { 18984, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - { 19023, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ - { 19060, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ - { 19098, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - { 19141, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - { 19184, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ - { 19214, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ - { 19245, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ - { 19281, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ - { 19317, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */ - { 19347, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ - { 19381, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */ - { 19414, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ - { 19443, 0x00008D57 }, /* GL_MAX_SAMPLES */ - { 19458, 0x00009111 }, /* GL_MAX_SERVER_WAIT_TIMEOUT */ - { 19485, 0x00008504 }, /* GL_MAX_SHININESS_NV */ - { 19505, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */ - { 19529, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */ - { 19551, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */ - { 19577, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */ - { 19604, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */ - { 19635, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */ - { 19659, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ - { 19693, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */ - { 19713, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */ - { 19740, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */ - { 19761, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */ - { 19786, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */ - { 19811, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */ - { 19846, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */ - { 19868, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */ - { 19894, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */ - { 19916, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */ - { 19942, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ - { 19976, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ - { 20014, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ - { 20047, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */ - { 20084, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */ - { 20108, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */ - { 20129, 0x00008007 }, /* GL_MIN */ - { 20136, 0x0000802E }, /* GL_MINMAX */ - { 20146, 0x0000802E }, /* GL_MINMAX_EXT */ - { 20160, 0x0000802F }, /* GL_MINMAX_FORMAT */ - { 20177, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */ - { 20198, 0x00008030 }, /* GL_MINMAX_SINK */ - { 20213, 0x00008030 }, /* GL_MINMAX_SINK_EXT */ - { 20232, 0x00008007 }, /* GL_MIN_EXT */ - { 20243, 0x00008370 }, /* GL_MIRRORED_REPEAT */ - { 20262, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */ - { 20285, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */ - { 20308, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */ - { 20328, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */ - { 20348, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ - { 20378, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */ - { 20406, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ - { 20434, 0x00001700 }, /* GL_MODELVIEW */ - { 20447, 0x00001700 }, /* GL_MODELVIEW0_ARB */ - { 20465, 0x0000872A }, /* GL_MODELVIEW10_ARB */ - { 20484, 0x0000872B }, /* GL_MODELVIEW11_ARB */ - { 20503, 0x0000872C }, /* GL_MODELVIEW12_ARB */ - { 20522, 0x0000872D }, /* GL_MODELVIEW13_ARB */ - { 20541, 0x0000872E }, /* GL_MODELVIEW14_ARB */ - { 20560, 0x0000872F }, /* GL_MODELVIEW15_ARB */ - { 20579, 0x00008730 }, /* GL_MODELVIEW16_ARB */ - { 20598, 0x00008731 }, /* GL_MODELVIEW17_ARB */ - { 20617, 0x00008732 }, /* GL_MODELVIEW18_ARB */ - { 20636, 0x00008733 }, /* GL_MODELVIEW19_ARB */ - { 20655, 0x0000850A }, /* GL_MODELVIEW1_ARB */ - { 20673, 0x00008734 }, /* GL_MODELVIEW20_ARB */ - { 20692, 0x00008735 }, /* GL_MODELVIEW21_ARB */ - { 20711, 0x00008736 }, /* GL_MODELVIEW22_ARB */ - { 20730, 0x00008737 }, /* GL_MODELVIEW23_ARB */ - { 20749, 0x00008738 }, /* GL_MODELVIEW24_ARB */ - { 20768, 0x00008739 }, /* GL_MODELVIEW25_ARB */ - { 20787, 0x0000873A }, /* GL_MODELVIEW26_ARB */ - { 20806, 0x0000873B }, /* GL_MODELVIEW27_ARB */ - { 20825, 0x0000873C }, /* GL_MODELVIEW28_ARB */ - { 20844, 0x0000873D }, /* GL_MODELVIEW29_ARB */ - { 20863, 0x00008722 }, /* GL_MODELVIEW2_ARB */ - { 20881, 0x0000873E }, /* GL_MODELVIEW30_ARB */ - { 20900, 0x0000873F }, /* GL_MODELVIEW31_ARB */ - { 20919, 0x00008723 }, /* GL_MODELVIEW3_ARB */ - { 20937, 0x00008724 }, /* GL_MODELVIEW4_ARB */ - { 20955, 0x00008725 }, /* GL_MODELVIEW5_ARB */ - { 20973, 0x00008726 }, /* GL_MODELVIEW6_ARB */ - { 20991, 0x00008727 }, /* GL_MODELVIEW7_ARB */ - { 21009, 0x00008728 }, /* GL_MODELVIEW8_ARB */ - { 21027, 0x00008729 }, /* GL_MODELVIEW9_ARB */ - { 21045, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */ - { 21065, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */ - { 21092, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */ - { 21117, 0x00002100 }, /* GL_MODULATE */ - { 21129, 0x00008744 }, /* GL_MODULATE_ADD_ATI */ - { 21149, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */ - { 21176, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */ - { 21201, 0x00000103 }, /* GL_MULT */ - { 21209, 0x0000809D }, /* GL_MULTISAMPLE */ - { 21224, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */ - { 21244, 0x0000809D }, /* GL_MULTISAMPLE_ARB */ - { 21263, 0x20000000 }, /* GL_MULTISAMPLE_BIT */ - { 21282, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */ - { 21306, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */ - { 21329, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */ - { 21359, 0x00002A25 }, /* GL_N3F_V3F */ - { 21370, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */ - { 21390, 0x0000150E }, /* GL_NAND */ - { 21398, 0x00002600 }, /* GL_NEAREST */ - { 21409, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ - { 21440, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ - { 21472, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */ - { 21497, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */ - { 21523, 0x00000200 }, /* GL_NEVER */ - { 21532, 0x00001102 }, /* GL_NICEST */ - { 21542, 0x00000000 }, /* GL_NONE */ - { 21550, 0x00001505 }, /* GL_NOOP */ - { 21558, 0x00001508 }, /* GL_NOR */ - { 21565, 0x00000BA1 }, /* GL_NORMALIZE */ - { 21578, 0x00008075 }, /* GL_NORMAL_ARRAY */ - { 21594, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ - { 21625, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */ - { 21660, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */ - { 21684, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */ - { 21707, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */ - { 21728, 0x00008511 }, /* GL_NORMAL_MAP */ - { 21742, 0x00008511 }, /* GL_NORMAL_MAP_ARB */ - { 21760, 0x00008511 }, /* GL_NORMAL_MAP_NV */ - { 21777, 0x00000205 }, /* GL_NOTEQUAL */ - { 21789, 0x00000000 }, /* GL_NO_ERROR */ - { 21801, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ - { 21835, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */ - { 21873, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */ - { 21905, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */ - { 21947, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */ - { 21977, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */ - { 22017, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */ - { 22048, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */ - { 22077, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */ - { 22105, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */ - { 22135, 0x00002401 }, /* GL_OBJECT_LINEAR */ - { 22152, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */ - { 22178, 0x00002501 }, /* GL_OBJECT_PLANE */ - { 22194, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */ - { 22229, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */ - { 22251, 0x00009112 }, /* GL_OBJECT_TYPE */ - { 22266, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */ - { 22285, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */ - { 22315, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */ - { 22336, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */ - { 22364, 0x00000001 }, /* GL_ONE */ - { 22371, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */ - { 22399, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */ - { 22431, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */ - { 22459, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */ - { 22491, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */ - { 22514, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */ - { 22537, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */ - { 22560, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */ - { 22583, 0x00008598 }, /* GL_OPERAND0_ALPHA */ - { 22601, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */ - { 22623, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */ - { 22645, 0x00008590 }, /* GL_OPERAND0_RGB */ - { 22661, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */ - { 22681, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */ - { 22701, 0x00008599 }, /* GL_OPERAND1_ALPHA */ - { 22719, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */ - { 22741, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */ - { 22763, 0x00008591 }, /* GL_OPERAND1_RGB */ - { 22779, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */ - { 22799, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */ - { 22819, 0x0000859A }, /* GL_OPERAND2_ALPHA */ - { 22837, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */ - { 22859, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */ - { 22881, 0x00008592 }, /* GL_OPERAND2_RGB */ - { 22897, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */ - { 22917, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */ - { 22937, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */ - { 22958, 0x00008593 }, /* GL_OPERAND3_RGB_NV */ - { 22977, 0x00001507 }, /* GL_OR */ - { 22983, 0x00000A01 }, /* GL_ORDER */ - { 22992, 0x0000150D }, /* GL_OR_INVERTED */ - { 23007, 0x0000150B }, /* GL_OR_REVERSE */ - { 23021, 0x00000505 }, /* GL_OUT_OF_MEMORY */ - { 23038, 0x00000D05 }, /* GL_PACK_ALIGNMENT */ - { 23056, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */ - { 23077, 0x00008758 }, /* GL_PACK_INVERT_MESA */ - { 23097, 0x00000D01 }, /* GL_PACK_LSB_FIRST */ - { 23115, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */ - { 23134, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */ - { 23154, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */ - { 23174, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */ - { 23192, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */ - { 23211, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */ - { 23236, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */ - { 23260, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */ - { 23281, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */ - { 23303, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */ - { 23325, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */ - { 23350, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */ - { 23374, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */ - { 23395, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */ - { 23417, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */ - { 23439, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */ - { 23461, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */ - { 23492, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */ - { 23512, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */ - { 23537, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */ - { 23557, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */ - { 23582, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */ - { 23602, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */ - { 23627, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */ - { 23647, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */ - { 23672, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */ - { 23692, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */ - { 23717, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */ - { 23737, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */ - { 23762, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */ - { 23782, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */ - { 23807, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */ - { 23827, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */ - { 23852, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */ - { 23872, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */ - { 23897, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */ - { 23917, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */ - { 23942, 0x00000020 }, /* GL_PIXEL_MODE_BIT */ - { 23960, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */ - { 23981, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */ - { 24010, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */ - { 24043, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */ - { 24068, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */ - { 24091, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ - { 24122, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */ - { 24157, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */ - { 24184, 0x00001B00 }, /* GL_POINT */ - { 24193, 0x00000000 }, /* GL_POINTS */ - { 24203, 0x00000002 }, /* GL_POINT_BIT */ - { 24216, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */ - { 24246, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */ - { 24280, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */ - { 24314, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */ - { 24349, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */ - { 24378, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */ - { 24411, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */ - { 24444, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */ - { 24478, 0x00000B11 }, /* GL_POINT_SIZE */ - { 24492, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */ - { 24518, 0x00008127 }, /* GL_POINT_SIZE_MAX */ - { 24536, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */ - { 24558, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */ - { 24580, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */ - { 24603, 0x00008126 }, /* GL_POINT_SIZE_MIN */ - { 24621, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */ - { 24643, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */ - { 24665, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */ - { 24688, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */ - { 24708, 0x00000B10 }, /* GL_POINT_SMOOTH */ - { 24724, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */ - { 24745, 0x00008861 }, /* GL_POINT_SPRITE */ - { 24761, 0x00008861 }, /* GL_POINT_SPRITE_ARB */ - { 24781, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */ - { 24810, 0x00008861 }, /* GL_POINT_SPRITE_NV */ - { 24829, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */ - { 24855, 0x00000701 }, /* GL_POINT_TOKEN */ - { 24870, 0x00000009 }, /* GL_POLYGON */ - { 24881, 0x00000008 }, /* GL_POLYGON_BIT */ - { 24896, 0x00000B40 }, /* GL_POLYGON_MODE */ - { 24912, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */ - { 24935, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */ - { 24960, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */ - { 24983, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */ - { 25006, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */ - { 25030, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */ - { 25054, 0x00000B41 }, /* GL_POLYGON_SMOOTH */ - { 25072, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */ - { 25095, 0x00000B42 }, /* GL_POLYGON_STIPPLE */ - { 25114, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */ - { 25137, 0x00000703 }, /* GL_POLYGON_TOKEN */ - { 25154, 0x00001203 }, /* GL_POSITION */ - { 25166, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ - { 25198, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */ - { 25234, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ - { 25267, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */ - { 25304, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ - { 25335, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */ - { 25370, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ - { 25402, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */ - { 25438, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ - { 25471, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ - { 25503, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */ - { 25539, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ - { 25572, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */ - { 25609, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */ - { 25639, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */ - { 25673, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */ - { 25704, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */ - { 25739, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ - { 25770, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */ - { 25805, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ - { 25837, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */ - { 25873, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */ - { 25903, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */ - { 25937, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */ - { 25968, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */ - { 26003, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */ - { 26035, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */ - { 26066, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */ - { 26101, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */ - { 26133, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */ - { 26169, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */ - { 26198, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */ - { 26231, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */ - { 26261, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */ - { 26295, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ - { 26334, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ - { 26367, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ - { 26407, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ - { 26441, 0x00008578 }, /* GL_PREVIOUS */ - { 26453, 0x00008578 }, /* GL_PREVIOUS_ARB */ - { 26469, 0x00008578 }, /* GL_PREVIOUS_EXT */ - { 26485, 0x00008577 }, /* GL_PRIMARY_COLOR */ - { 26502, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */ - { 26523, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */ - { 26544, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ - { 26577, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ - { 26609, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */ - { 26632, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */ - { 26655, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */ - { 26685, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */ - { 26714, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */ - { 26742, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */ - { 26764, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */ - { 26792, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */ - { 26820, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */ - { 26842, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */ - { 26863, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - { 26903, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - { 26942, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ - { 26972, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - { 27007, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ - { 27040, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ - { 27074, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - { 27113, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - { 27152, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */ - { 27174, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */ - { 27200, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */ - { 27224, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */ - { 27247, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */ - { 27269, 0x00008628 }, /* GL_PROGRAM_STRING_NV */ - { 27290, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */ - { 27311, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */ - { 27338, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ - { 27370, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ - { 27402, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ - { 27437, 0x00001701 }, /* GL_PROJECTION */ - { 27451, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */ - { 27472, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */ - { 27498, 0x00008E4F }, /* GL_PROVOKING_VERTEX_EXT */ - { 27522, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */ - { 27543, 0x00008025 }, /* GL_PROXY_HISTOGRAM */ - { 27562, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */ - { 27585, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ - { 27624, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ - { 27662, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */ - { 27682, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ - { 27712, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */ - { 27736, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */ - { 27756, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ - { 27786, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */ - { 27810, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */ - { 27830, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ - { 27863, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */ - { 27889, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */ - { 27919, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ - { 27950, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */ - { 27980, 0x00002003 }, /* GL_Q */ - { 27985, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */ - { 28010, 0x00000007 }, /* GL_QUADS */ - { 28019, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */ - { 28067, 0x00008614 }, /* GL_QUAD_MESH_SUN */ - { 28084, 0x00000008 }, /* GL_QUAD_STRIP */ - { 28098, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */ - { 28120, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */ - { 28146, 0x00008866 }, /* GL_QUERY_RESULT */ - { 28162, 0x00008866 }, /* GL_QUERY_RESULT_ARB */ - { 28182, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */ - { 28208, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */ - { 28238, 0x00002002 }, /* GL_R */ - { 28243, 0x00002A10 }, /* GL_R3_G3_B2 */ - { 28255, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ - { 28288, 0x00000C02 }, /* GL_READ_BUFFER */ - { 28303, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */ - { 28323, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ - { 28355, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */ - { 28379, 0x000088B8 }, /* GL_READ_ONLY */ - { 28392, 0x000088B8 }, /* GL_READ_ONLY_ARB */ - { 28409, 0x000088BA }, /* GL_READ_WRITE */ - { 28423, 0x000088BA }, /* GL_READ_WRITE_ARB */ - { 28441, 0x00001903 }, /* GL_RED */ - { 28448, 0x00008016 }, /* GL_REDUCE */ - { 28458, 0x00008016 }, /* GL_REDUCE_EXT */ - { 28472, 0x00000D15 }, /* GL_RED_BIAS */ - { 28484, 0x00000D52 }, /* GL_RED_BITS */ - { 28496, 0x00000D14 }, /* GL_RED_SCALE */ - { 28509, 0x00008512 }, /* GL_REFLECTION_MAP */ - { 28527, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */ - { 28549, 0x00008512 }, /* GL_REFLECTION_MAP_NV */ - { 28570, 0x00001C00 }, /* GL_RENDER */ - { 28580, 0x00008D41 }, /* GL_RENDERBUFFER */ - { 28596, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */ - { 28623, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */ - { 28651, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */ - { 28677, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */ - { 28704, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */ - { 28724, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */ - { 28751, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */ - { 28774, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */ - { 28801, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ - { 28833, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */ - { 28869, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */ - { 28894, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */ - { 28918, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */ - { 28947, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */ - { 28969, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */ - { 28995, 0x00001F01 }, /* GL_RENDERER */ - { 29007, 0x00000C40 }, /* GL_RENDER_MODE */ - { 29022, 0x00002901 }, /* GL_REPEAT */ - { 29032, 0x00001E01 }, /* GL_REPLACE */ - { 29043, 0x00008062 }, /* GL_REPLACE_EXT */ - { 29058, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */ - { 29081, 0x0000803A }, /* GL_RESCALE_NORMAL */ - { 29099, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */ - { 29121, 0x00000102 }, /* GL_RETURN */ - { 29131, 0x00001907 }, /* GL_RGB */ - { 29138, 0x00008052 }, /* GL_RGB10 */ - { 29147, 0x00008059 }, /* GL_RGB10_A2 */ - { 29159, 0x00008059 }, /* GL_RGB10_A2_EXT */ - { 29175, 0x00008052 }, /* GL_RGB10_EXT */ - { 29188, 0x00008053 }, /* GL_RGB12 */ - { 29197, 0x00008053 }, /* GL_RGB12_EXT */ - { 29210, 0x00008054 }, /* GL_RGB16 */ - { 29219, 0x00008054 }, /* GL_RGB16_EXT */ - { 29232, 0x0000804E }, /* GL_RGB2_EXT */ - { 29244, 0x0000804F }, /* GL_RGB4 */ - { 29252, 0x0000804F }, /* GL_RGB4_EXT */ - { 29264, 0x000083A1 }, /* GL_RGB4_S3TC */ - { 29277, 0x00008050 }, /* GL_RGB5 */ - { 29285, 0x00008057 }, /* GL_RGB5_A1 */ - { 29296, 0x00008057 }, /* GL_RGB5_A1_EXT */ - { 29311, 0x00008050 }, /* GL_RGB5_EXT */ - { 29323, 0x00008051 }, /* GL_RGB8 */ - { 29331, 0x00008051 }, /* GL_RGB8_EXT */ - { 29343, 0x00001908 }, /* GL_RGBA */ - { 29351, 0x0000805A }, /* GL_RGBA12 */ - { 29361, 0x0000805A }, /* GL_RGBA12_EXT */ - { 29375, 0x0000805B }, /* GL_RGBA16 */ - { 29385, 0x0000805B }, /* GL_RGBA16_EXT */ - { 29399, 0x00008055 }, /* GL_RGBA2 */ - { 29408, 0x00008055 }, /* GL_RGBA2_EXT */ - { 29421, 0x00008056 }, /* GL_RGBA4 */ - { 29430, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */ - { 29449, 0x00008056 }, /* GL_RGBA4_EXT */ - { 29462, 0x000083A3 }, /* GL_RGBA4_S3TC */ - { 29476, 0x00008058 }, /* GL_RGBA8 */ - { 29485, 0x00008058 }, /* GL_RGBA8_EXT */ - { 29498, 0x00008F97 }, /* GL_RGBA8_SNORM */ - { 29513, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */ - { 29531, 0x00000C31 }, /* GL_RGBA_MODE */ - { 29544, 0x000083A2 }, /* GL_RGBA_S3TC */ - { 29557, 0x00008F93 }, /* GL_RGBA_SNORM */ - { 29571, 0x000083A0 }, /* GL_RGB_S3TC */ - { 29583, 0x00008573 }, /* GL_RGB_SCALE */ - { 29596, 0x00008573 }, /* GL_RGB_SCALE_ARB */ - { 29613, 0x00008573 }, /* GL_RGB_SCALE_EXT */ - { 29630, 0x00000407 }, /* GL_RIGHT */ - { 29639, 0x00002000 }, /* GL_S */ - { 29644, 0x00008B5D }, /* GL_SAMPLER_1D */ - { 29658, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */ - { 29679, 0x00008B5E }, /* GL_SAMPLER_2D */ - { 29693, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */ - { 29714, 0x00008B5F }, /* GL_SAMPLER_3D */ - { 29728, 0x00008B60 }, /* GL_SAMPLER_CUBE */ - { 29744, 0x000080A9 }, /* GL_SAMPLES */ - { 29755, 0x000086B4 }, /* GL_SAMPLES_3DFX */ - { 29771, 0x000080A9 }, /* GL_SAMPLES_ARB */ - { 29786, 0x00008914 }, /* GL_SAMPLES_PASSED */ - { 29804, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */ - { 29826, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ - { 29854, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */ - { 29886, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */ - { 29909, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */ - { 29936, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */ - { 29954, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */ - { 29977, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */ - { 29999, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */ - { 30018, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */ - { 30041, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */ - { 30067, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */ - { 30097, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */ - { 30122, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */ - { 30151, 0x00080000 }, /* GL_SCISSOR_BIT */ - { 30166, 0x00000C10 }, /* GL_SCISSOR_BOX */ - { 30181, 0x00000C11 }, /* GL_SCISSOR_TEST */ - { 30197, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */ - { 30222, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ - { 30262, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */ - { 30306, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ - { 30339, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ - { 30369, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ - { 30401, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ - { 30431, 0x00001C02 }, /* GL_SELECT */ - { 30441, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */ - { 30469, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */ - { 30494, 0x00008012 }, /* GL_SEPARABLE_2D */ - { 30510, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */ - { 30537, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */ - { 30568, 0x0000150F }, /* GL_SET */ - { 30575, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */ - { 30596, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */ - { 30620, 0x00008B4F }, /* GL_SHADER_TYPE */ - { 30635, 0x00000B54 }, /* GL_SHADE_MODEL */ - { 30650, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */ - { 30678, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */ - { 30701, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */ - { 30731, 0x00001601 }, /* GL_SHININESS */ - { 30744, 0x00001402 }, /* GL_SHORT */ - { 30753, 0x00009119 }, /* GL_SIGNALED */ - { 30765, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */ - { 30786, 0x000081F9 }, /* GL_SINGLE_COLOR */ - { 30802, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */ - { 30822, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */ - { 30841, 0x00008C46 }, /* GL_SLUMINANCE */ - { 30855, 0x00008C47 }, /* GL_SLUMINANCE8 */ - { 30870, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */ - { 30892, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */ - { 30912, 0x00001D01 }, /* GL_SMOOTH */ - { 30922, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */ - { 30955, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */ - { 30982, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */ - { 31015, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */ - { 31042, 0x00008588 }, /* GL_SOURCE0_ALPHA */ - { 31059, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */ - { 31080, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */ - { 31101, 0x00008580 }, /* GL_SOURCE0_RGB */ - { 31116, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */ - { 31135, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */ - { 31154, 0x00008589 }, /* GL_SOURCE1_ALPHA */ - { 31171, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */ - { 31192, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */ - { 31213, 0x00008581 }, /* GL_SOURCE1_RGB */ - { 31228, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */ - { 31247, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */ - { 31266, 0x0000858A }, /* GL_SOURCE2_ALPHA */ - { 31283, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */ - { 31304, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */ - { 31325, 0x00008582 }, /* GL_SOURCE2_RGB */ - { 31340, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */ - { 31359, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */ - { 31378, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */ - { 31398, 0x00008583 }, /* GL_SOURCE3_RGB_NV */ - { 31416, 0x00001202 }, /* GL_SPECULAR */ - { 31428, 0x00002402 }, /* GL_SPHERE_MAP */ - { 31442, 0x00001206 }, /* GL_SPOT_CUTOFF */ - { 31457, 0x00001204 }, /* GL_SPOT_DIRECTION */ - { 31475, 0x00001205 }, /* GL_SPOT_EXPONENT */ - { 31492, 0x00008588 }, /* GL_SRC0_ALPHA */ - { 31506, 0x00008580 }, /* GL_SRC0_RGB */ - { 31518, 0x00008589 }, /* GL_SRC1_ALPHA */ - { 31532, 0x00008581 }, /* GL_SRC1_RGB */ - { 31544, 0x0000858A }, /* GL_SRC2_ALPHA */ - { 31558, 0x00008582 }, /* GL_SRC2_RGB */ - { 31570, 0x00000302 }, /* GL_SRC_ALPHA */ - { 31583, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */ - { 31605, 0x00000300 }, /* GL_SRC_COLOR */ - { 31618, 0x00008C40 }, /* GL_SRGB */ - { 31626, 0x00008C41 }, /* GL_SRGB8 */ - { 31635, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */ - { 31651, 0x00008C42 }, /* GL_SRGB_ALPHA */ - { 31665, 0x00000503 }, /* GL_STACK_OVERFLOW */ - { 31683, 0x00000504 }, /* GL_STACK_UNDERFLOW */ - { 31702, 0x000088E6 }, /* GL_STATIC_COPY */ - { 31717, 0x000088E6 }, /* GL_STATIC_COPY_ARB */ - { 31736, 0x000088E4 }, /* GL_STATIC_DRAW */ - { 31751, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */ - { 31770, 0x000088E5 }, /* GL_STATIC_READ */ - { 31785, 0x000088E5 }, /* GL_STATIC_READ_ARB */ - { 31804, 0x00001802 }, /* GL_STENCIL */ - { 31815, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */ - { 31837, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */ - { 31863, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */ - { 31884, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */ - { 31909, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */ - { 31930, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */ - { 31955, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ - { 31987, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */ - { 32023, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ - { 32055, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */ - { 32091, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */ - { 32111, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */ - { 32138, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */ - { 32164, 0x00000D57 }, /* GL_STENCIL_BITS */ - { 32180, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */ - { 32202, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */ - { 32225, 0x00000B94 }, /* GL_STENCIL_FAIL */ - { 32241, 0x00000B92 }, /* GL_STENCIL_FUNC */ - { 32257, 0x00001901 }, /* GL_STENCIL_INDEX */ - { 32274, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */ - { 32297, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */ - { 32319, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */ - { 32341, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */ - { 32363, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */ - { 32384, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */ - { 32411, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */ - { 32438, 0x00000B97 }, /* GL_STENCIL_REF */ - { 32453, 0x00000B90 }, /* GL_STENCIL_TEST */ - { 32469, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ - { 32498, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */ - { 32520, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */ - { 32541, 0x00000C33 }, /* GL_STEREO */ - { 32551, 0x000085BE }, /* GL_STORAGE_CACHED_APPLE */ - { 32575, 0x000085BD }, /* GL_STORAGE_PRIVATE_APPLE */ - { 32600, 0x000085BF }, /* GL_STORAGE_SHARED_APPLE */ - { 32624, 0x000088E2 }, /* GL_STREAM_COPY */ - { 32639, 0x000088E2 }, /* GL_STREAM_COPY_ARB */ - { 32658, 0x000088E0 }, /* GL_STREAM_DRAW */ - { 32673, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */ - { 32692, 0x000088E1 }, /* GL_STREAM_READ */ - { 32707, 0x000088E1 }, /* GL_STREAM_READ_ARB */ - { 32726, 0x00000D50 }, /* GL_SUBPIXEL_BITS */ - { 32743, 0x000084E7 }, /* GL_SUBTRACT */ - { 32755, 0x000084E7 }, /* GL_SUBTRACT_ARB */ - { 32771, 0x00009113 }, /* GL_SYNC_CONDITION */ - { 32789, 0x00009116 }, /* GL_SYNC_FENCE */ - { 32803, 0x00009115 }, /* GL_SYNC_FLAGS */ - { 32817, 0x00000001 }, /* GL_SYNC_FLUSH_COMMANDS_BIT */ - { 32844, 0x00009117 }, /* GL_SYNC_GPU_COMMANDS_COMPLETE */ - { 32874, 0x00009114 }, /* GL_SYNC_STATUS */ - { 32889, 0x00002001 }, /* GL_T */ - { 32894, 0x00002A2A }, /* GL_T2F_C3F_V3F */ - { 32909, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */ - { 32928, 0x00002A29 }, /* GL_T2F_C4UB_V3F */ - { 32944, 0x00002A2B }, /* GL_T2F_N3F_V3F */ - { 32959, 0x00002A27 }, /* GL_T2F_V3F */ - { 32970, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */ - { 32989, 0x00002A28 }, /* GL_T4F_V4F */ - { 33000, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */ - { 33023, 0x00001702 }, /* GL_TEXTURE */ - { 33034, 0x000084C0 }, /* GL_TEXTURE0 */ - { 33046, 0x000084C0 }, /* GL_TEXTURE0_ARB */ - { 33062, 0x000084C1 }, /* GL_TEXTURE1 */ - { 33074, 0x000084CA }, /* GL_TEXTURE10 */ - { 33087, 0x000084CA }, /* GL_TEXTURE10_ARB */ - { 33104, 0x000084CB }, /* GL_TEXTURE11 */ - { 33117, 0x000084CB }, /* GL_TEXTURE11_ARB */ - { 33134, 0x000084CC }, /* GL_TEXTURE12 */ - { 33147, 0x000084CC }, /* GL_TEXTURE12_ARB */ - { 33164, 0x000084CD }, /* GL_TEXTURE13 */ - { 33177, 0x000084CD }, /* GL_TEXTURE13_ARB */ - { 33194, 0x000084CE }, /* GL_TEXTURE14 */ - { 33207, 0x000084CE }, /* GL_TEXTURE14_ARB */ - { 33224, 0x000084CF }, /* GL_TEXTURE15 */ - { 33237, 0x000084CF }, /* GL_TEXTURE15_ARB */ - { 33254, 0x000084D0 }, /* GL_TEXTURE16 */ - { 33267, 0x000084D0 }, /* GL_TEXTURE16_ARB */ - { 33284, 0x000084D1 }, /* GL_TEXTURE17 */ - { 33297, 0x000084D1 }, /* GL_TEXTURE17_ARB */ - { 33314, 0x000084D2 }, /* GL_TEXTURE18 */ - { 33327, 0x000084D2 }, /* GL_TEXTURE18_ARB */ - { 33344, 0x000084D3 }, /* GL_TEXTURE19 */ - { 33357, 0x000084D3 }, /* GL_TEXTURE19_ARB */ - { 33374, 0x000084C1 }, /* GL_TEXTURE1_ARB */ - { 33390, 0x000084C2 }, /* GL_TEXTURE2 */ - { 33402, 0x000084D4 }, /* GL_TEXTURE20 */ - { 33415, 0x000084D4 }, /* GL_TEXTURE20_ARB */ - { 33432, 0x000084D5 }, /* GL_TEXTURE21 */ - { 33445, 0x000084D5 }, /* GL_TEXTURE21_ARB */ - { 33462, 0x000084D6 }, /* GL_TEXTURE22 */ - { 33475, 0x000084D6 }, /* GL_TEXTURE22_ARB */ - { 33492, 0x000084D7 }, /* GL_TEXTURE23 */ - { 33505, 0x000084D7 }, /* GL_TEXTURE23_ARB */ - { 33522, 0x000084D8 }, /* GL_TEXTURE24 */ - { 33535, 0x000084D8 }, /* GL_TEXTURE24_ARB */ - { 33552, 0x000084D9 }, /* GL_TEXTURE25 */ - { 33565, 0x000084D9 }, /* GL_TEXTURE25_ARB */ - { 33582, 0x000084DA }, /* GL_TEXTURE26 */ - { 33595, 0x000084DA }, /* GL_TEXTURE26_ARB */ - { 33612, 0x000084DB }, /* GL_TEXTURE27 */ - { 33625, 0x000084DB }, /* GL_TEXTURE27_ARB */ - { 33642, 0x000084DC }, /* GL_TEXTURE28 */ - { 33655, 0x000084DC }, /* GL_TEXTURE28_ARB */ - { 33672, 0x000084DD }, /* GL_TEXTURE29 */ - { 33685, 0x000084DD }, /* GL_TEXTURE29_ARB */ - { 33702, 0x000084C2 }, /* GL_TEXTURE2_ARB */ - { 33718, 0x000084C3 }, /* GL_TEXTURE3 */ - { 33730, 0x000084DE }, /* GL_TEXTURE30 */ - { 33743, 0x000084DE }, /* GL_TEXTURE30_ARB */ - { 33760, 0x000084DF }, /* GL_TEXTURE31 */ - { 33773, 0x000084DF }, /* GL_TEXTURE31_ARB */ - { 33790, 0x000084C3 }, /* GL_TEXTURE3_ARB */ - { 33806, 0x000084C4 }, /* GL_TEXTURE4 */ - { 33818, 0x000084C4 }, /* GL_TEXTURE4_ARB */ - { 33834, 0x000084C5 }, /* GL_TEXTURE5 */ - { 33846, 0x000084C5 }, /* GL_TEXTURE5_ARB */ - { 33862, 0x000084C6 }, /* GL_TEXTURE6 */ - { 33874, 0x000084C6 }, /* GL_TEXTURE6_ARB */ - { 33890, 0x000084C7 }, /* GL_TEXTURE7 */ - { 33902, 0x000084C7 }, /* GL_TEXTURE7_ARB */ - { 33918, 0x000084C8 }, /* GL_TEXTURE8 */ - { 33930, 0x000084C8 }, /* GL_TEXTURE8_ARB */ - { 33946, 0x000084C9 }, /* GL_TEXTURE9 */ - { 33958, 0x000084C9 }, /* GL_TEXTURE9_ARB */ - { 33974, 0x00000DE0 }, /* GL_TEXTURE_1D */ - { 33988, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */ - { 34012, 0x00000DE1 }, /* GL_TEXTURE_2D */ - { 34026, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */ - { 34050, 0x0000806F }, /* GL_TEXTURE_3D */ - { 34064, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */ - { 34086, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */ - { 34112, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */ - { 34134, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */ - { 34156, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ - { 34188, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */ - { 34210, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ - { 34242, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */ - { 34264, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */ - { 34292, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */ - { 34324, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ - { 34357, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */ - { 34389, 0x00040000 }, /* GL_TEXTURE_BIT */ - { 34404, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */ - { 34425, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */ - { 34450, 0x00001005 }, /* GL_TEXTURE_BORDER */ - { 34468, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */ - { 34492, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ - { 34523, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ - { 34553, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ - { 34583, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ - { 34618, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ - { 34649, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - { 34687, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */ - { 34714, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ - { 34746, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ - { 34780, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */ - { 34804, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */ - { 34832, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */ - { 34856, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */ - { 34884, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ - { 34917, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */ - { 34941, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */ - { 34963, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */ - { 34985, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */ - { 35011, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */ - { 35045, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ - { 35078, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */ - { 35115, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */ - { 35143, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */ - { 35175, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */ - { 35198, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ - { 35236, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */ - { 35278, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */ - { 35309, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */ - { 35337, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ - { 35367, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */ - { 35395, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */ - { 35415, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */ - { 35439, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ - { 35470, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */ - { 35505, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ - { 35536, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */ - { 35571, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ - { 35602, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */ - { 35637, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ - { 35668, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */ - { 35703, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ - { 35734, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */ - { 35769, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ - { 35800, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */ - { 35835, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */ - { 35864, 0x00008071 }, /* GL_TEXTURE_DEPTH */ - { 35881, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */ - { 35903, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */ - { 35929, 0x00002300 }, /* GL_TEXTURE_ENV */ - { 35944, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */ - { 35965, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */ - { 35985, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */ - { 36011, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */ - { 36031, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */ - { 36048, 0x00000C62 }, /* GL_TEXTURE_GEN_R */ - { 36065, 0x00000C60 }, /* GL_TEXTURE_GEN_S */ - { 36082, 0x00000C61 }, /* GL_TEXTURE_GEN_T */ - { 36099, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */ - { 36124, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */ - { 36146, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */ - { 36172, 0x00001001 }, /* GL_TEXTURE_HEIGHT */ - { 36190, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */ - { 36216, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */ - { 36242, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */ - { 36272, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */ - { 36299, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */ - { 36324, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */ - { 36344, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */ - { 36368, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ - { 36395, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ - { 36422, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ - { 36449, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */ - { 36475, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */ - { 36505, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */ - { 36527, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */ - { 36545, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ - { 36575, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ - { 36603, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ - { 36631, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ - { 36659, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */ - { 36680, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */ - { 36699, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */ - { 36721, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */ - { 36740, 0x00008066 }, /* GL_TEXTURE_PRIORITY */ - { 36760, 0x000085B7 }, /* GL_TEXTURE_RANGE_LENGTH_APPLE */ - { 36790, 0x000085B8 }, /* GL_TEXTURE_RANGE_POINTER_APPLE */ - { 36821, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */ - { 36846, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */ - { 36870, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */ - { 36890, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */ - { 36914, 0x00008067 }, /* GL_TEXTURE_RESIDENT */ - { 36934, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */ - { 36957, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */ - { 36981, 0x000085BC }, /* GL_TEXTURE_STORAGE_HINT_APPLE */ - { 37011, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */ - { 37036, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ - { 37070, 0x00001000 }, /* GL_TEXTURE_WIDTH */ - { 37087, 0x00008072 }, /* GL_TEXTURE_WRAP_R */ - { 37105, 0x00002802 }, /* GL_TEXTURE_WRAP_S */ - { 37123, 0x00002803 }, /* GL_TEXTURE_WRAP_T */ - { 37141, 0x0000911B }, /* GL_TIMEOUT_EXPIRED */ - { 37160, 0xFFFFFFFFFFFFFFFF }, /* GL_TIMEOUT_IGNORED */ - { 37179, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */ - { 37199, 0x00008648 }, /* GL_TRACK_MATRIX_NV */ - { 37218, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */ - { 37247, 0x00001000 }, /* GL_TRANSFORM_BIT */ - { 37264, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */ - { 37290, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */ - { 37320, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ - { 37352, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ - { 37382, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */ - { 37416, 0x0000862C }, /* GL_TRANSPOSE_NV */ - { 37432, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */ - { 37463, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */ - { 37498, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */ - { 37526, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */ - { 37558, 0x00000004 }, /* GL_TRIANGLES */ - { 37571, 0x00000006 }, /* GL_TRIANGLE_FAN */ - { 37587, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */ - { 37608, 0x00000005 }, /* GL_TRIANGLE_STRIP */ - { 37626, 0x00000001 }, /* GL_TRUE */ - { 37634, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */ - { 37654, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */ - { 37677, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */ - { 37697, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */ - { 37718, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */ - { 37740, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */ - { 37762, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */ - { 37782, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */ - { 37803, 0x00009118 }, /* GL_UNSIGNALED */ - { 37817, 0x00001401 }, /* GL_UNSIGNED_BYTE */ - { 37834, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */ - { 37861, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */ - { 37884, 0x00001405 }, /* GL_UNSIGNED_INT */ - { 37900, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */ - { 37927, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */ - { 37948, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */ - { 37972, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */ - { 38003, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */ - { 38027, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */ - { 38055, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */ - { 38078, 0x00001403 }, /* GL_UNSIGNED_SHORT */ - { 38096, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ - { 38126, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */ - { 38152, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ - { 38182, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */ - { 38208, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */ - { 38232, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */ - { 38260, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */ - { 38288, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */ - { 38315, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ - { 38347, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */ - { 38378, 0x00008CA2 }, /* GL_UPPER_LEFT */ - { 38392, 0x00002A20 }, /* GL_V2F */ - { 38399, 0x00002A21 }, /* GL_V3F */ - { 38406, 0x00008B83 }, /* GL_VALIDATE_STATUS */ - { 38425, 0x00001F00 }, /* GL_VENDOR */ - { 38435, 0x00001F02 }, /* GL_VERSION */ - { 38446, 0x00008074 }, /* GL_VERTEX_ARRAY */ - { 38462, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING */ - { 38486, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */ - { 38516, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ - { 38547, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */ - { 38582, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */ - { 38606, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */ - { 38627, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */ - { 38650, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */ - { 38671, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ - { 38698, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ - { 38726, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ - { 38754, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ - { 38782, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ - { 38810, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ - { 38838, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ - { 38866, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ - { 38893, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ - { 38920, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ - { 38947, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ - { 38974, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ - { 39001, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ - { 39028, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ - { 39055, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ - { 39082, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ - { 39109, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ - { 39147, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */ - { 39189, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ - { 39220, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ - { 39255, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ - { 39289, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ - { 39327, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ - { 39358, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ - { 39393, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ - { 39421, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ - { 39453, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ - { 39483, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ - { 39517, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ - { 39545, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ - { 39577, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */ - { 39597, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */ - { 39619, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */ - { 39648, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */ - { 39669, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */ - { 39698, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ - { 39731, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ - { 39763, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */ - { 39790, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ - { 39821, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ - { 39851, 0x00008B31 }, /* GL_VERTEX_SHADER */ - { 39868, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */ - { 39889, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */ - { 39916, 0x00000BA2 }, /* GL_VIEWPORT */ - { 39928, 0x00000800 }, /* GL_VIEWPORT_BIT */ - { 39944, 0x0000911D }, /* GL_WAIT_FAILED */ - { 39959, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */ - { 39979, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ - { 40010, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */ - { 40045, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */ - { 40073, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */ - { 40098, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ - { 40125, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */ - { 40150, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */ - { 40174, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */ - { 40193, 0x000088B9 }, /* GL_WRITE_ONLY */ - { 40207, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */ - { 40225, 0x00001506 }, /* GL_XOR */ - { 40232, 0x000085B9 }, /* GL_YCBCR_422_APPLE */ - { 40251, 0x00008757 }, /* GL_YCBCR_MESA */ - { 40265, 0x00000000 }, /* GL_ZERO */ - { 40273, 0x00000D16 }, /* GL_ZOOM_X */ - { 40283, 0x00000D17 }, /* GL_ZOOM_Y */ + { 9726, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION */ + { 9753, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION_EXT */ + { 9784, 0x00001D00 }, /* GL_FLAT */ + { 9792, 0x00001406 }, /* GL_FLOAT */ + { 9801, 0x00008B5A }, /* GL_FLOAT_MAT2 */ + { 9815, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */ + { 9833, 0x00008B65 }, /* GL_FLOAT_MAT2x3 */ + { 9849, 0x00008B66 }, /* GL_FLOAT_MAT2x4 */ + { 9865, 0x00008B5B }, /* GL_FLOAT_MAT3 */ + { 9879, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */ + { 9897, 0x00008B67 }, /* GL_FLOAT_MAT3x2 */ + { 9913, 0x00008B68 }, /* GL_FLOAT_MAT3x4 */ + { 9929, 0x00008B5C }, /* GL_FLOAT_MAT4 */ + { 9943, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */ + { 9961, 0x00008B69 }, /* GL_FLOAT_MAT4x2 */ + { 9977, 0x00008B6A }, /* GL_FLOAT_MAT4x3 */ + { 9993, 0x00008B50 }, /* GL_FLOAT_VEC2 */ + { 10007, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */ + { 10025, 0x00008B51 }, /* GL_FLOAT_VEC3 */ + { 10039, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */ + { 10057, 0x00008B52 }, /* GL_FLOAT_VEC4 */ + { 10071, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */ + { 10089, 0x00000B60 }, /* GL_FOG */ + { 10096, 0x00000080 }, /* GL_FOG_BIT */ + { 10107, 0x00000B66 }, /* GL_FOG_COLOR */ + { 10120, 0x00008451 }, /* GL_FOG_COORD */ + { 10133, 0x00008451 }, /* GL_FOG_COORDINATE */ + { 10151, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */ + { 10175, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ + { 10214, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */ + { 10257, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */ + { 10289, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ + { 10320, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */ + { 10349, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */ + { 10374, 0x00008457 }, /* GL_FOG_COORD_ARRAY */ + { 10393, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */ + { 10427, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */ + { 10454, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */ + { 10480, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */ + { 10504, 0x00008450 }, /* GL_FOG_COORD_SRC */ + { 10521, 0x00000B62 }, /* GL_FOG_DENSITY */ + { 10536, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */ + { 10560, 0x00000B64 }, /* GL_FOG_END */ + { 10571, 0x00000C54 }, /* GL_FOG_HINT */ + { 10583, 0x00000B61 }, /* GL_FOG_INDEX */ + { 10596, 0x00000B65 }, /* GL_FOG_MODE */ + { 10608, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */ + { 10627, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */ + { 10652, 0x00000B63 }, /* GL_FOG_START */ + { 10665, 0x00008452 }, /* GL_FRAGMENT_DEPTH */ + { 10683, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */ + { 10707, 0x00008B30 }, /* GL_FRAGMENT_SHADER */ + { 10726, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */ + { 10749, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ + { 10784, 0x00008D40 }, /* GL_FRAMEBUFFER */ + { 10799, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ + { 10836, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ + { 10872, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ + { 10913, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ + { 10954, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ + { 10991, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ + { 11028, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ + { 11066, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */ + { 11108, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ + { 11146, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */ + { 11188, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ + { 11223, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ + { 11262, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */ + { 11311, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ + { 11359, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */ + { 11411, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ + { 11451, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ + { 11495, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ + { 11535, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */ + { 11579, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */ + { 11606, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */ + { 11630, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */ + { 11658, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */ + { 11681, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */ + { 11700, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ + { 11737, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */ + { 11778, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ + { 11819, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ + { 11861, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ + { 11912, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ + { 11950, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ + { 11995, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */ + { 12044, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ + { 12082, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ + { 12124, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ + { 12156, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */ + { 12181, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */ + { 12208, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */ + { 12239, 0x00000404 }, /* GL_FRONT */ + { 12248, 0x00000408 }, /* GL_FRONT_AND_BACK */ + { 12266, 0x00000B46 }, /* GL_FRONT_FACE */ + { 12280, 0x00000400 }, /* GL_FRONT_LEFT */ + { 12294, 0x00000401 }, /* GL_FRONT_RIGHT */ + { 12309, 0x00008006 }, /* GL_FUNC_ADD */ + { 12321, 0x00008006 }, /* GL_FUNC_ADD_EXT */ + { 12337, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */ + { 12362, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */ + { 12391, 0x0000800A }, /* GL_FUNC_SUBTRACT */ + { 12408, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */ + { 12429, 0x00008191 }, /* GL_GENERATE_MIPMAP */ + { 12448, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */ + { 12472, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */ + { 12501, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */ + { 12525, 0x00000206 }, /* GL_GEQUAL */ + { 12535, 0x00000204 }, /* GL_GREATER */ + { 12546, 0x00001904 }, /* GL_GREEN */ + { 12555, 0x00000D19 }, /* GL_GREEN_BIAS */ + { 12569, 0x00000D53 }, /* GL_GREEN_BITS */ + { 12583, 0x00000D18 }, /* GL_GREEN_SCALE */ + { 12598, 0x00008000 }, /* GL_HINT_BIT */ + { 12610, 0x00008024 }, /* GL_HISTOGRAM */ + { 12623, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */ + { 12647, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */ + { 12675, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */ + { 12698, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */ + { 12725, 0x00008024 }, /* GL_HISTOGRAM_EXT */ + { 12742, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */ + { 12762, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */ + { 12786, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */ + { 12810, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */ + { 12838, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */ + { 12866, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */ + { 12898, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */ + { 12920, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */ + { 12946, 0x0000802D }, /* GL_HISTOGRAM_SINK */ + { 12964, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */ + { 12986, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */ + { 13005, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */ + { 13028, 0x0000862A }, /* GL_IDENTITY_NV */ + { 13043, 0x00008150 }, /* GL_IGNORE_BORDER_HP */ + { 13063, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ + { 13103, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ + { 13141, 0x00001E02 }, /* GL_INCR */ + { 13149, 0x00008507 }, /* GL_INCR_WRAP */ + { 13162, 0x00008507 }, /* GL_INCR_WRAP_EXT */ + { 13179, 0x00008222 }, /* GL_INDEX */ + { 13188, 0x00008077 }, /* GL_INDEX_ARRAY */ + { 13203, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */ + { 13233, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */ + { 13267, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */ + { 13290, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */ + { 13312, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */ + { 13332, 0x00000D51 }, /* GL_INDEX_BITS */ + { 13346, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */ + { 13367, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */ + { 13385, 0x00000C30 }, /* GL_INDEX_MODE */ + { 13399, 0x00000D13 }, /* GL_INDEX_OFFSET */ + { 13415, 0x00000D12 }, /* GL_INDEX_SHIFT */ + { 13430, 0x00000C21 }, /* GL_INDEX_WRITEMASK */ + { 13449, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */ + { 13468, 0x00001404 }, /* GL_INT */ + { 13475, 0x00008049 }, /* GL_INTENSITY */ + { 13488, 0x0000804C }, /* GL_INTENSITY12 */ + { 13503, 0x0000804C }, /* GL_INTENSITY12_EXT */ + { 13522, 0x0000804D }, /* GL_INTENSITY16 */ + { 13537, 0x0000804D }, /* GL_INTENSITY16_EXT */ + { 13556, 0x0000804A }, /* GL_INTENSITY4 */ + { 13570, 0x0000804A }, /* GL_INTENSITY4_EXT */ + { 13588, 0x0000804B }, /* GL_INTENSITY8 */ + { 13602, 0x0000804B }, /* GL_INTENSITY8_EXT */ + { 13620, 0x00008049 }, /* GL_INTENSITY_EXT */ + { 13637, 0x00008575 }, /* GL_INTERPOLATE */ + { 13652, 0x00008575 }, /* GL_INTERPOLATE_ARB */ + { 13671, 0x00008575 }, /* GL_INTERPOLATE_EXT */ + { 13690, 0x00008B53 }, /* GL_INT_VEC2 */ + { 13702, 0x00008B53 }, /* GL_INT_VEC2_ARB */ + { 13718, 0x00008B54 }, /* GL_INT_VEC3 */ + { 13730, 0x00008B54 }, /* GL_INT_VEC3_ARB */ + { 13746, 0x00008B55 }, /* GL_INT_VEC4 */ + { 13758, 0x00008B55 }, /* GL_INT_VEC4_ARB */ + { 13774, 0x00000500 }, /* GL_INVALID_ENUM */ + { 13790, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */ + { 13823, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */ + { 13860, 0x00000502 }, /* GL_INVALID_OPERATION */ + { 13881, 0x00000501 }, /* GL_INVALID_VALUE */ + { 13898, 0x0000862B }, /* GL_INVERSE_NV */ + { 13912, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */ + { 13936, 0x0000150A }, /* GL_INVERT */ + { 13946, 0x00001E00 }, /* GL_KEEP */ + { 13954, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION */ + { 13980, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION_EXT */ + { 14010, 0x00000406 }, /* GL_LEFT */ + { 14018, 0x00000203 }, /* GL_LEQUAL */ + { 14028, 0x00000201 }, /* GL_LESS */ + { 14036, 0x00004000 }, /* GL_LIGHT0 */ + { 14046, 0x00004001 }, /* GL_LIGHT1 */ + { 14056, 0x00004002 }, /* GL_LIGHT2 */ + { 14066, 0x00004003 }, /* GL_LIGHT3 */ + { 14076, 0x00004004 }, /* GL_LIGHT4 */ + { 14086, 0x00004005 }, /* GL_LIGHT5 */ + { 14096, 0x00004006 }, /* GL_LIGHT6 */ + { 14106, 0x00004007 }, /* GL_LIGHT7 */ + { 14116, 0x00000B50 }, /* GL_LIGHTING */ + { 14128, 0x00000040 }, /* GL_LIGHTING_BIT */ + { 14144, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */ + { 14167, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */ + { 14196, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */ + { 14229, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ + { 14257, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */ + { 14281, 0x00001B01 }, /* GL_LINE */ + { 14289, 0x00002601 }, /* GL_LINEAR */ + { 14299, 0x00001208 }, /* GL_LINEAR_ATTENUATION */ + { 14321, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ + { 14351, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ + { 14382, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */ + { 14406, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */ + { 14431, 0x00000001 }, /* GL_LINES */ + { 14440, 0x00000004 }, /* GL_LINE_BIT */ + { 14452, 0x00000002 }, /* GL_LINE_LOOP */ + { 14465, 0x00000707 }, /* GL_LINE_RESET_TOKEN */ + { 14485, 0x00000B20 }, /* GL_LINE_SMOOTH */ + { 14500, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */ + { 14520, 0x00000B24 }, /* GL_LINE_STIPPLE */ + { 14536, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */ + { 14560, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */ + { 14583, 0x00000003 }, /* GL_LINE_STRIP */ + { 14597, 0x00000702 }, /* GL_LINE_TOKEN */ + { 14611, 0x00000B21 }, /* GL_LINE_WIDTH */ + { 14625, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */ + { 14651, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */ + { 14671, 0x00008B82 }, /* GL_LINK_STATUS */ + { 14686, 0x00000B32 }, /* GL_LIST_BASE */ + { 14699, 0x00020000 }, /* GL_LIST_BIT */ + { 14711, 0x00000B33 }, /* GL_LIST_INDEX */ + { 14725, 0x00000B30 }, /* GL_LIST_MODE */ + { 14738, 0x00000101 }, /* GL_LOAD */ + { 14746, 0x00000BF1 }, /* GL_LOGIC_OP */ + { 14758, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */ + { 14775, 0x00008CA1 }, /* GL_LOWER_LEFT */ + { 14789, 0x00001909 }, /* GL_LUMINANCE */ + { 14802, 0x00008041 }, /* GL_LUMINANCE12 */ + { 14817, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */ + { 14840, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */ + { 14867, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */ + { 14889, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */ + { 14915, 0x00008041 }, /* GL_LUMINANCE12_EXT */ + { 14934, 0x00008042 }, /* GL_LUMINANCE16 */ + { 14949, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */ + { 14972, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */ + { 14999, 0x00008042 }, /* GL_LUMINANCE16_EXT */ + { 15018, 0x0000803F }, /* GL_LUMINANCE4 */ + { 15032, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */ + { 15053, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */ + { 15078, 0x0000803F }, /* GL_LUMINANCE4_EXT */ + { 15096, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */ + { 15117, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */ + { 15142, 0x00008040 }, /* GL_LUMINANCE8 */ + { 15156, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */ + { 15177, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */ + { 15202, 0x00008040 }, /* GL_LUMINANCE8_EXT */ + { 15220, 0x0000190A }, /* GL_LUMINANCE_ALPHA */ + { 15239, 0x00000D90 }, /* GL_MAP1_COLOR_4 */ + { 15255, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */ + { 15275, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */ + { 15297, 0x00000D91 }, /* GL_MAP1_INDEX */ + { 15311, 0x00000D92 }, /* GL_MAP1_NORMAL */ + { 15326, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */ + { 15350, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */ + { 15374, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */ + { 15398, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */ + { 15422, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */ + { 15439, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */ + { 15456, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ + { 15484, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ + { 15513, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ + { 15542, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ + { 15571, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ + { 15600, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ + { 15629, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ + { 15658, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ + { 15686, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ + { 15714, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ + { 15742, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ + { 15770, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ + { 15798, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ + { 15826, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ + { 15854, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ + { 15882, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ + { 15910, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */ + { 15926, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */ + { 15946, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */ + { 15968, 0x00000DB1 }, /* GL_MAP2_INDEX */ + { 15982, 0x00000DB2 }, /* GL_MAP2_NORMAL */ + { 15997, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */ + { 16021, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */ + { 16045, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */ + { 16069, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */ + { 16093, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */ + { 16110, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */ + { 16127, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ + { 16155, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ + { 16184, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ + { 16213, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ + { 16242, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ + { 16271, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ + { 16300, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ + { 16329, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ + { 16357, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ + { 16385, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ + { 16413, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ + { 16441, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ + { 16469, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ + { 16497, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */ + { 16525, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ + { 16553, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ + { 16581, 0x00000D10 }, /* GL_MAP_COLOR */ + { 16594, 0x00000010 }, /* GL_MAP_FLUSH_EXPLICIT_BIT */ + { 16620, 0x00000008 }, /* GL_MAP_INVALIDATE_BUFFER_BIT */ + { 16649, 0x00000004 }, /* GL_MAP_INVALIDATE_RANGE_BIT */ + { 16677, 0x00000001 }, /* GL_MAP_READ_BIT */ + { 16693, 0x00000D11 }, /* GL_MAP_STENCIL */ + { 16708, 0x00000020 }, /* GL_MAP_UNSYNCHRONIZED_BIT */ + { 16734, 0x00000002 }, /* GL_MAP_WRITE_BIT */ + { 16751, 0x000088C0 }, /* GL_MATRIX0_ARB */ + { 16766, 0x00008630 }, /* GL_MATRIX0_NV */ + { 16780, 0x000088CA }, /* GL_MATRIX10_ARB */ + { 16796, 0x000088CB }, /* GL_MATRIX11_ARB */ + { 16812, 0x000088CC }, /* GL_MATRIX12_ARB */ + { 16828, 0x000088CD }, /* GL_MATRIX13_ARB */ + { 16844, 0x000088CE }, /* GL_MATRIX14_ARB */ + { 16860, 0x000088CF }, /* GL_MATRIX15_ARB */ + { 16876, 0x000088D0 }, /* GL_MATRIX16_ARB */ + { 16892, 0x000088D1 }, /* GL_MATRIX17_ARB */ + { 16908, 0x000088D2 }, /* GL_MATRIX18_ARB */ + { 16924, 0x000088D3 }, /* GL_MATRIX19_ARB */ + { 16940, 0x000088C1 }, /* GL_MATRIX1_ARB */ + { 16955, 0x00008631 }, /* GL_MATRIX1_NV */ + { 16969, 0x000088D4 }, /* GL_MATRIX20_ARB */ + { 16985, 0x000088D5 }, /* GL_MATRIX21_ARB */ + { 17001, 0x000088D6 }, /* GL_MATRIX22_ARB */ + { 17017, 0x000088D7 }, /* GL_MATRIX23_ARB */ + { 17033, 0x000088D8 }, /* GL_MATRIX24_ARB */ + { 17049, 0x000088D9 }, /* GL_MATRIX25_ARB */ + { 17065, 0x000088DA }, /* GL_MATRIX26_ARB */ + { 17081, 0x000088DB }, /* GL_MATRIX27_ARB */ + { 17097, 0x000088DC }, /* GL_MATRIX28_ARB */ + { 17113, 0x000088DD }, /* GL_MATRIX29_ARB */ + { 17129, 0x000088C2 }, /* GL_MATRIX2_ARB */ + { 17144, 0x00008632 }, /* GL_MATRIX2_NV */ + { 17158, 0x000088DE }, /* GL_MATRIX30_ARB */ + { 17174, 0x000088DF }, /* GL_MATRIX31_ARB */ + { 17190, 0x000088C3 }, /* GL_MATRIX3_ARB */ + { 17205, 0x00008633 }, /* GL_MATRIX3_NV */ + { 17219, 0x000088C4 }, /* GL_MATRIX4_ARB */ + { 17234, 0x00008634 }, /* GL_MATRIX4_NV */ + { 17248, 0x000088C5 }, /* GL_MATRIX5_ARB */ + { 17263, 0x00008635 }, /* GL_MATRIX5_NV */ + { 17277, 0x000088C6 }, /* GL_MATRIX6_ARB */ + { 17292, 0x00008636 }, /* GL_MATRIX6_NV */ + { 17306, 0x000088C7 }, /* GL_MATRIX7_ARB */ + { 17321, 0x00008637 }, /* GL_MATRIX7_NV */ + { 17335, 0x000088C8 }, /* GL_MATRIX8_ARB */ + { 17350, 0x000088C9 }, /* GL_MATRIX9_ARB */ + { 17365, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */ + { 17391, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ + { 17425, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ + { 17456, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ + { 17489, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ + { 17520, 0x00000BA0 }, /* GL_MATRIX_MODE */ + { 17535, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */ + { 17557, 0x00008008 }, /* GL_MAX */ + { 17564, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */ + { 17587, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ + { 17619, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */ + { 17645, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ + { 17678, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ + { 17704, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + { 17738, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */ + { 17757, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ + { 17786, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ + { 17818, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */ + { 17854, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ + { 17890, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */ + { 17930, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */ + { 17956, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */ + { 17986, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */ + { 18011, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */ + { 18040, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ + { 18069, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */ + { 18102, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */ + { 18122, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */ + { 18146, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */ + { 18170, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */ + { 18194, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */ + { 18219, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */ + { 18237, 0x00008008 }, /* GL_MAX_EXT */ + { 18248, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ + { 18283, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */ + { 18322, 0x00000D31 }, /* GL_MAX_LIGHTS */ + { 18336, 0x00000B31 }, /* GL_MAX_LIST_NESTING */ + { 18356, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ + { 18394, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */ + { 18423, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */ + { 18447, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */ + { 18475, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */ + { 18498, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ + { 18535, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ + { 18571, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ + { 18598, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ + { 18627, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ + { 18661, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ + { 18697, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ + { 18724, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ + { 18756, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ + { 18792, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ + { 18821, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ + { 18850, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */ + { 18878, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ + { 18916, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + { 18960, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + { 19003, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ + { 19037, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + { 19076, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ + { 19113, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ + { 19151, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + { 19194, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + { 19237, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ + { 19267, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ + { 19298, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ + { 19334, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ + { 19370, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */ + { 19400, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ + { 19434, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */ + { 19467, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ + { 19496, 0x00008D57 }, /* GL_MAX_SAMPLES */ + { 19511, 0x00009111 }, /* GL_MAX_SERVER_WAIT_TIMEOUT */ + { 19538, 0x00008504 }, /* GL_MAX_SHININESS_NV */ + { 19558, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */ + { 19582, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */ + { 19604, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */ + { 19630, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */ + { 19657, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */ + { 19688, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */ + { 19712, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ + { 19746, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */ + { 19766, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */ + { 19793, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */ + { 19814, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */ + { 19839, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */ + { 19864, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */ + { 19899, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */ + { 19921, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */ + { 19947, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */ + { 19969, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */ + { 19995, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ + { 20029, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ + { 20067, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ + { 20100, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */ + { 20137, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */ + { 20161, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */ + { 20182, 0x00008007 }, /* GL_MIN */ + { 20189, 0x0000802E }, /* GL_MINMAX */ + { 20199, 0x0000802E }, /* GL_MINMAX_EXT */ + { 20213, 0x0000802F }, /* GL_MINMAX_FORMAT */ + { 20230, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */ + { 20251, 0x00008030 }, /* GL_MINMAX_SINK */ + { 20266, 0x00008030 }, /* GL_MINMAX_SINK_EXT */ + { 20285, 0x00008007 }, /* GL_MIN_EXT */ + { 20296, 0x00008370 }, /* GL_MIRRORED_REPEAT */ + { 20315, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */ + { 20338, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */ + { 20361, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */ + { 20381, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */ + { 20401, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ + { 20431, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */ + { 20459, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ + { 20487, 0x00001700 }, /* GL_MODELVIEW */ + { 20500, 0x00001700 }, /* GL_MODELVIEW0_ARB */ + { 20518, 0x0000872A }, /* GL_MODELVIEW10_ARB */ + { 20537, 0x0000872B }, /* GL_MODELVIEW11_ARB */ + { 20556, 0x0000872C }, /* GL_MODELVIEW12_ARB */ + { 20575, 0x0000872D }, /* GL_MODELVIEW13_ARB */ + { 20594, 0x0000872E }, /* GL_MODELVIEW14_ARB */ + { 20613, 0x0000872F }, /* GL_MODELVIEW15_ARB */ + { 20632, 0x00008730 }, /* GL_MODELVIEW16_ARB */ + { 20651, 0x00008731 }, /* GL_MODELVIEW17_ARB */ + { 20670, 0x00008732 }, /* GL_MODELVIEW18_ARB */ + { 20689, 0x00008733 }, /* GL_MODELVIEW19_ARB */ + { 20708, 0x0000850A }, /* GL_MODELVIEW1_ARB */ + { 20726, 0x00008734 }, /* GL_MODELVIEW20_ARB */ + { 20745, 0x00008735 }, /* GL_MODELVIEW21_ARB */ + { 20764, 0x00008736 }, /* GL_MODELVIEW22_ARB */ + { 20783, 0x00008737 }, /* GL_MODELVIEW23_ARB */ + { 20802, 0x00008738 }, /* GL_MODELVIEW24_ARB */ + { 20821, 0x00008739 }, /* GL_MODELVIEW25_ARB */ + { 20840, 0x0000873A }, /* GL_MODELVIEW26_ARB */ + { 20859, 0x0000873B }, /* GL_MODELVIEW27_ARB */ + { 20878, 0x0000873C }, /* GL_MODELVIEW28_ARB */ + { 20897, 0x0000873D }, /* GL_MODELVIEW29_ARB */ + { 20916, 0x00008722 }, /* GL_MODELVIEW2_ARB */ + { 20934, 0x0000873E }, /* GL_MODELVIEW30_ARB */ + { 20953, 0x0000873F }, /* GL_MODELVIEW31_ARB */ + { 20972, 0x00008723 }, /* GL_MODELVIEW3_ARB */ + { 20990, 0x00008724 }, /* GL_MODELVIEW4_ARB */ + { 21008, 0x00008725 }, /* GL_MODELVIEW5_ARB */ + { 21026, 0x00008726 }, /* GL_MODELVIEW6_ARB */ + { 21044, 0x00008727 }, /* GL_MODELVIEW7_ARB */ + { 21062, 0x00008728 }, /* GL_MODELVIEW8_ARB */ + { 21080, 0x00008729 }, /* GL_MODELVIEW9_ARB */ + { 21098, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */ + { 21118, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */ + { 21145, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */ + { 21170, 0x00002100 }, /* GL_MODULATE */ + { 21182, 0x00008744 }, /* GL_MODULATE_ADD_ATI */ + { 21202, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */ + { 21229, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */ + { 21254, 0x00000103 }, /* GL_MULT */ + { 21262, 0x0000809D }, /* GL_MULTISAMPLE */ + { 21277, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */ + { 21297, 0x0000809D }, /* GL_MULTISAMPLE_ARB */ + { 21316, 0x20000000 }, /* GL_MULTISAMPLE_BIT */ + { 21335, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */ + { 21359, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */ + { 21382, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */ + { 21412, 0x00002A25 }, /* GL_N3F_V3F */ + { 21423, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */ + { 21443, 0x0000150E }, /* GL_NAND */ + { 21451, 0x00002600 }, /* GL_NEAREST */ + { 21462, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ + { 21493, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ + { 21525, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */ + { 21550, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */ + { 21576, 0x00000200 }, /* GL_NEVER */ + { 21585, 0x00001102 }, /* GL_NICEST */ + { 21595, 0x00000000 }, /* GL_NONE */ + { 21603, 0x00001505 }, /* GL_NOOP */ + { 21611, 0x00001508 }, /* GL_NOR */ + { 21618, 0x00000BA1 }, /* GL_NORMALIZE */ + { 21631, 0x00008075 }, /* GL_NORMAL_ARRAY */ + { 21647, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ + { 21678, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */ + { 21713, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */ + { 21737, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */ + { 21760, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */ + { 21781, 0x00008511 }, /* GL_NORMAL_MAP */ + { 21795, 0x00008511 }, /* GL_NORMAL_MAP_ARB */ + { 21813, 0x00008511 }, /* GL_NORMAL_MAP_NV */ + { 21830, 0x00000205 }, /* GL_NOTEQUAL */ + { 21842, 0x00000000 }, /* GL_NO_ERROR */ + { 21854, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ + { 21888, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */ + { 21926, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */ + { 21958, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */ + { 22000, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */ + { 22030, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */ + { 22070, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */ + { 22101, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */ + { 22130, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */ + { 22158, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */ + { 22188, 0x00002401 }, /* GL_OBJECT_LINEAR */ + { 22205, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */ + { 22231, 0x00002501 }, /* GL_OBJECT_PLANE */ + { 22247, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */ + { 22282, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */ + { 22304, 0x00009112 }, /* GL_OBJECT_TYPE */ + { 22319, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */ + { 22338, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */ + { 22368, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */ + { 22389, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */ + { 22417, 0x00000001 }, /* GL_ONE */ + { 22424, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */ + { 22452, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */ + { 22484, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */ + { 22512, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */ + { 22544, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */ + { 22567, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */ + { 22590, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */ + { 22613, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */ + { 22636, 0x00008598 }, /* GL_OPERAND0_ALPHA */ + { 22654, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */ + { 22676, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */ + { 22698, 0x00008590 }, /* GL_OPERAND0_RGB */ + { 22714, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */ + { 22734, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */ + { 22754, 0x00008599 }, /* GL_OPERAND1_ALPHA */ + { 22772, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */ + { 22794, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */ + { 22816, 0x00008591 }, /* GL_OPERAND1_RGB */ + { 22832, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */ + { 22852, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */ + { 22872, 0x0000859A }, /* GL_OPERAND2_ALPHA */ + { 22890, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */ + { 22912, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */ + { 22934, 0x00008592 }, /* GL_OPERAND2_RGB */ + { 22950, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */ + { 22970, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */ + { 22990, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */ + { 23011, 0x00008593 }, /* GL_OPERAND3_RGB_NV */ + { 23030, 0x00001507 }, /* GL_OR */ + { 23036, 0x00000A01 }, /* GL_ORDER */ + { 23045, 0x0000150D }, /* GL_OR_INVERTED */ + { 23060, 0x0000150B }, /* GL_OR_REVERSE */ + { 23074, 0x00000505 }, /* GL_OUT_OF_MEMORY */ + { 23091, 0x00000D05 }, /* GL_PACK_ALIGNMENT */ + { 23109, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */ + { 23130, 0x00008758 }, /* GL_PACK_INVERT_MESA */ + { 23150, 0x00000D01 }, /* GL_PACK_LSB_FIRST */ + { 23168, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */ + { 23187, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */ + { 23207, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */ + { 23227, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */ + { 23245, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */ + { 23264, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */ + { 23289, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */ + { 23313, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */ + { 23334, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */ + { 23356, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */ + { 23378, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */ + { 23403, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */ + { 23427, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */ + { 23448, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */ + { 23470, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */ + { 23492, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */ + { 23514, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */ + { 23545, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */ + { 23565, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */ + { 23590, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */ + { 23610, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */ + { 23635, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */ + { 23655, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */ + { 23680, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */ + { 23700, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */ + { 23725, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */ + { 23745, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */ + { 23770, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */ + { 23790, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */ + { 23815, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */ + { 23835, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */ + { 23860, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */ + { 23880, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */ + { 23905, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */ + { 23925, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */ + { 23950, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */ + { 23970, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */ + { 23995, 0x00000020 }, /* GL_PIXEL_MODE_BIT */ + { 24013, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */ + { 24034, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */ + { 24063, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */ + { 24096, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */ + { 24121, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */ + { 24144, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ + { 24175, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */ + { 24210, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */ + { 24237, 0x00001B00 }, /* GL_POINT */ + { 24246, 0x00000000 }, /* GL_POINTS */ + { 24256, 0x00000002 }, /* GL_POINT_BIT */ + { 24269, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */ + { 24299, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */ + { 24333, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */ + { 24367, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */ + { 24402, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */ + { 24431, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */ + { 24464, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */ + { 24497, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */ + { 24531, 0x00000B11 }, /* GL_POINT_SIZE */ + { 24545, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */ + { 24571, 0x00008127 }, /* GL_POINT_SIZE_MAX */ + { 24589, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */ + { 24611, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */ + { 24633, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */ + { 24656, 0x00008126 }, /* GL_POINT_SIZE_MIN */ + { 24674, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */ + { 24696, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */ + { 24718, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */ + { 24741, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */ + { 24761, 0x00000B10 }, /* GL_POINT_SMOOTH */ + { 24777, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */ + { 24798, 0x00008861 }, /* GL_POINT_SPRITE */ + { 24814, 0x00008861 }, /* GL_POINT_SPRITE_ARB */ + { 24834, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */ + { 24863, 0x00008861 }, /* GL_POINT_SPRITE_NV */ + { 24882, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */ + { 24908, 0x00000701 }, /* GL_POINT_TOKEN */ + { 24923, 0x00000009 }, /* GL_POLYGON */ + { 24934, 0x00000008 }, /* GL_POLYGON_BIT */ + { 24949, 0x00000B40 }, /* GL_POLYGON_MODE */ + { 24965, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */ + { 24988, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */ + { 25013, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */ + { 25036, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */ + { 25059, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */ + { 25083, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */ + { 25107, 0x00000B41 }, /* GL_POLYGON_SMOOTH */ + { 25125, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */ + { 25148, 0x00000B42 }, /* GL_POLYGON_STIPPLE */ + { 25167, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */ + { 25190, 0x00000703 }, /* GL_POLYGON_TOKEN */ + { 25207, 0x00001203 }, /* GL_POSITION */ + { 25219, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ + { 25251, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */ + { 25287, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ + { 25320, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */ + { 25357, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ + { 25388, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */ + { 25423, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ + { 25455, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */ + { 25491, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ + { 25524, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ + { 25556, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */ + { 25592, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ + { 25625, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */ + { 25662, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */ + { 25692, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */ + { 25726, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */ + { 25757, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */ + { 25792, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ + { 25823, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */ + { 25858, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ + { 25890, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */ + { 25926, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */ + { 25956, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */ + { 25990, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */ + { 26021, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */ + { 26056, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */ + { 26088, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */ + { 26119, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */ + { 26154, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */ + { 26186, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */ + { 26222, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */ + { 26251, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */ + { 26284, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */ + { 26314, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */ + { 26348, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ + { 26387, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ + { 26420, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ + { 26460, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ + { 26494, 0x00008578 }, /* GL_PREVIOUS */ + { 26506, 0x00008578 }, /* GL_PREVIOUS_ARB */ + { 26522, 0x00008578 }, /* GL_PREVIOUS_EXT */ + { 26538, 0x00008577 }, /* GL_PRIMARY_COLOR */ + { 26555, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */ + { 26576, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */ + { 26597, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ + { 26630, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ + { 26662, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */ + { 26685, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */ + { 26708, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */ + { 26738, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */ + { 26767, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */ + { 26795, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */ + { 26817, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */ + { 26845, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */ + { 26873, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */ + { 26895, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */ + { 26916, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + { 26956, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + { 26995, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ + { 27025, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + { 27060, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ + { 27093, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ + { 27127, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + { 27166, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + { 27205, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */ + { 27227, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */ + { 27253, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */ + { 27277, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */ + { 27300, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */ + { 27322, 0x00008628 }, /* GL_PROGRAM_STRING_NV */ + { 27343, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */ + { 27364, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */ + { 27391, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ + { 27423, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ + { 27455, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ + { 27490, 0x00001701 }, /* GL_PROJECTION */ + { 27504, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */ + { 27525, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */ + { 27551, 0x00008E4F }, /* GL_PROVOKING_VERTEX */ + { 27571, 0x00008E4F }, /* GL_PROVOKING_VERTEX_EXT */ + { 27595, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */ + { 27616, 0x00008025 }, /* GL_PROXY_HISTOGRAM */ + { 27635, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */ + { 27658, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ + { 27697, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ + { 27735, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */ + { 27755, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ + { 27785, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */ + { 27809, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */ + { 27829, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ + { 27859, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */ + { 27883, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */ + { 27903, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ + { 27936, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */ + { 27962, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */ + { 27992, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ + { 28023, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */ + { 28053, 0x00002003 }, /* GL_Q */ + { 28058, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */ + { 28083, 0x00000007 }, /* GL_QUADS */ + { 28092, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */ + { 28136, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */ + { 28184, 0x00008614 }, /* GL_QUAD_MESH_SUN */ + { 28201, 0x00000008 }, /* GL_QUAD_STRIP */ + { 28215, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */ + { 28237, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */ + { 28263, 0x00008866 }, /* GL_QUERY_RESULT */ + { 28279, 0x00008866 }, /* GL_QUERY_RESULT_ARB */ + { 28299, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */ + { 28325, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */ + { 28355, 0x00002002 }, /* GL_R */ + { 28360, 0x00002A10 }, /* GL_R3_G3_B2 */ + { 28372, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ + { 28405, 0x00000C02 }, /* GL_READ_BUFFER */ + { 28420, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */ + { 28440, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ + { 28472, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */ + { 28496, 0x000088B8 }, /* GL_READ_ONLY */ + { 28509, 0x000088B8 }, /* GL_READ_ONLY_ARB */ + { 28526, 0x000088BA }, /* GL_READ_WRITE */ + { 28540, 0x000088BA }, /* GL_READ_WRITE_ARB */ + { 28558, 0x00001903 }, /* GL_RED */ + { 28565, 0x00008016 }, /* GL_REDUCE */ + { 28575, 0x00008016 }, /* GL_REDUCE_EXT */ + { 28589, 0x00000D15 }, /* GL_RED_BIAS */ + { 28601, 0x00000D52 }, /* GL_RED_BITS */ + { 28613, 0x00000D14 }, /* GL_RED_SCALE */ + { 28626, 0x00008512 }, /* GL_REFLECTION_MAP */ + { 28644, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */ + { 28666, 0x00008512 }, /* GL_REFLECTION_MAP_NV */ + { 28687, 0x00001C00 }, /* GL_RENDER */ + { 28697, 0x00008D41 }, /* GL_RENDERBUFFER */ + { 28713, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */ + { 28740, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */ + { 28768, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */ + { 28794, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */ + { 28821, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */ + { 28841, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */ + { 28868, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */ + { 28891, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */ + { 28918, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ + { 28950, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */ + { 28986, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */ + { 29011, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */ + { 29035, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */ + { 29064, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */ + { 29086, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */ + { 29112, 0x00001F01 }, /* GL_RENDERER */ + { 29124, 0x00000C40 }, /* GL_RENDER_MODE */ + { 29139, 0x00002901 }, /* GL_REPEAT */ + { 29149, 0x00001E01 }, /* GL_REPLACE */ + { 29160, 0x00008062 }, /* GL_REPLACE_EXT */ + { 29175, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */ + { 29198, 0x0000803A }, /* GL_RESCALE_NORMAL */ + { 29216, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */ + { 29238, 0x00000102 }, /* GL_RETURN */ + { 29248, 0x00001907 }, /* GL_RGB */ + { 29255, 0x00008052 }, /* GL_RGB10 */ + { 29264, 0x00008059 }, /* GL_RGB10_A2 */ + { 29276, 0x00008059 }, /* GL_RGB10_A2_EXT */ + { 29292, 0x00008052 }, /* GL_RGB10_EXT */ + { 29305, 0x00008053 }, /* GL_RGB12 */ + { 29314, 0x00008053 }, /* GL_RGB12_EXT */ + { 29327, 0x00008054 }, /* GL_RGB16 */ + { 29336, 0x00008054 }, /* GL_RGB16_EXT */ + { 29349, 0x0000804E }, /* GL_RGB2_EXT */ + { 29361, 0x0000804F }, /* GL_RGB4 */ + { 29369, 0x0000804F }, /* GL_RGB4_EXT */ + { 29381, 0x000083A1 }, /* GL_RGB4_S3TC */ + { 29394, 0x00008050 }, /* GL_RGB5 */ + { 29402, 0x00008057 }, /* GL_RGB5_A1 */ + { 29413, 0x00008057 }, /* GL_RGB5_A1_EXT */ + { 29428, 0x00008050 }, /* GL_RGB5_EXT */ + { 29440, 0x00008051 }, /* GL_RGB8 */ + { 29448, 0x00008051 }, /* GL_RGB8_EXT */ + { 29460, 0x00001908 }, /* GL_RGBA */ + { 29468, 0x0000805A }, /* GL_RGBA12 */ + { 29478, 0x0000805A }, /* GL_RGBA12_EXT */ + { 29492, 0x0000805B }, /* GL_RGBA16 */ + { 29502, 0x0000805B }, /* GL_RGBA16_EXT */ + { 29516, 0x00008055 }, /* GL_RGBA2 */ + { 29525, 0x00008055 }, /* GL_RGBA2_EXT */ + { 29538, 0x00008056 }, /* GL_RGBA4 */ + { 29547, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */ + { 29566, 0x00008056 }, /* GL_RGBA4_EXT */ + { 29579, 0x000083A3 }, /* GL_RGBA4_S3TC */ + { 29593, 0x00008058 }, /* GL_RGBA8 */ + { 29602, 0x00008058 }, /* GL_RGBA8_EXT */ + { 29615, 0x00008F97 }, /* GL_RGBA8_SNORM */ + { 29630, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */ + { 29648, 0x00000C31 }, /* GL_RGBA_MODE */ + { 29661, 0x000083A2 }, /* GL_RGBA_S3TC */ + { 29674, 0x00008F93 }, /* GL_RGBA_SNORM */ + { 29688, 0x000083A0 }, /* GL_RGB_S3TC */ + { 29700, 0x00008573 }, /* GL_RGB_SCALE */ + { 29713, 0x00008573 }, /* GL_RGB_SCALE_ARB */ + { 29730, 0x00008573 }, /* GL_RGB_SCALE_EXT */ + { 29747, 0x00000407 }, /* GL_RIGHT */ + { 29756, 0x00002000 }, /* GL_S */ + { 29761, 0x00008B5D }, /* GL_SAMPLER_1D */ + { 29775, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */ + { 29796, 0x00008B5E }, /* GL_SAMPLER_2D */ + { 29810, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */ + { 29831, 0x00008B5F }, /* GL_SAMPLER_3D */ + { 29845, 0x00008B60 }, /* GL_SAMPLER_CUBE */ + { 29861, 0x000080A9 }, /* GL_SAMPLES */ + { 29872, 0x000086B4 }, /* GL_SAMPLES_3DFX */ + { 29888, 0x000080A9 }, /* GL_SAMPLES_ARB */ + { 29903, 0x00008914 }, /* GL_SAMPLES_PASSED */ + { 29921, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */ + { 29943, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ + { 29971, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */ + { 30003, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */ + { 30026, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */ + { 30053, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */ + { 30071, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */ + { 30094, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */ + { 30116, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */ + { 30135, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */ + { 30158, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */ + { 30184, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */ + { 30214, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */ + { 30239, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */ + { 30268, 0x00080000 }, /* GL_SCISSOR_BIT */ + { 30283, 0x00000C10 }, /* GL_SCISSOR_BOX */ + { 30298, 0x00000C11 }, /* GL_SCISSOR_TEST */ + { 30314, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */ + { 30339, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ + { 30379, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */ + { 30423, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ + { 30456, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ + { 30486, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ + { 30518, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ + { 30548, 0x00001C02 }, /* GL_SELECT */ + { 30558, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */ + { 30586, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */ + { 30611, 0x00008012 }, /* GL_SEPARABLE_2D */ + { 30627, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */ + { 30654, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */ + { 30685, 0x0000150F }, /* GL_SET */ + { 30692, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */ + { 30713, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */ + { 30737, 0x00008B4F }, /* GL_SHADER_TYPE */ + { 30752, 0x00000B54 }, /* GL_SHADE_MODEL */ + { 30767, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */ + { 30795, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */ + { 30818, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */ + { 30848, 0x00001601 }, /* GL_SHININESS */ + { 30861, 0x00001402 }, /* GL_SHORT */ + { 30870, 0x00009119 }, /* GL_SIGNALED */ + { 30882, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */ + { 30903, 0x000081F9 }, /* GL_SINGLE_COLOR */ + { 30919, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */ + { 30939, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */ + { 30958, 0x00008C46 }, /* GL_SLUMINANCE */ + { 30972, 0x00008C47 }, /* GL_SLUMINANCE8 */ + { 30987, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */ + { 31009, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */ + { 31029, 0x00001D01 }, /* GL_SMOOTH */ + { 31039, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */ + { 31072, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */ + { 31099, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */ + { 31132, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */ + { 31159, 0x00008588 }, /* GL_SOURCE0_ALPHA */ + { 31176, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */ + { 31197, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */ + { 31218, 0x00008580 }, /* GL_SOURCE0_RGB */ + { 31233, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */ + { 31252, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */ + { 31271, 0x00008589 }, /* GL_SOURCE1_ALPHA */ + { 31288, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */ + { 31309, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */ + { 31330, 0x00008581 }, /* GL_SOURCE1_RGB */ + { 31345, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */ + { 31364, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */ + { 31383, 0x0000858A }, /* GL_SOURCE2_ALPHA */ + { 31400, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */ + { 31421, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */ + { 31442, 0x00008582 }, /* GL_SOURCE2_RGB */ + { 31457, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */ + { 31476, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */ + { 31495, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */ + { 31515, 0x00008583 }, /* GL_SOURCE3_RGB_NV */ + { 31533, 0x00001202 }, /* GL_SPECULAR */ + { 31545, 0x00002402 }, /* GL_SPHERE_MAP */ + { 31559, 0x00001206 }, /* GL_SPOT_CUTOFF */ + { 31574, 0x00001204 }, /* GL_SPOT_DIRECTION */ + { 31592, 0x00001205 }, /* GL_SPOT_EXPONENT */ + { 31609, 0x00008588 }, /* GL_SRC0_ALPHA */ + { 31623, 0x00008580 }, /* GL_SRC0_RGB */ + { 31635, 0x00008589 }, /* GL_SRC1_ALPHA */ + { 31649, 0x00008581 }, /* GL_SRC1_RGB */ + { 31661, 0x0000858A }, /* GL_SRC2_ALPHA */ + { 31675, 0x00008582 }, /* GL_SRC2_RGB */ + { 31687, 0x00000302 }, /* GL_SRC_ALPHA */ + { 31700, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */ + { 31722, 0x00000300 }, /* GL_SRC_COLOR */ + { 31735, 0x00008C40 }, /* GL_SRGB */ + { 31743, 0x00008C41 }, /* GL_SRGB8 */ + { 31752, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */ + { 31768, 0x00008C42 }, /* GL_SRGB_ALPHA */ + { 31782, 0x00000503 }, /* GL_STACK_OVERFLOW */ + { 31800, 0x00000504 }, /* GL_STACK_UNDERFLOW */ + { 31819, 0x000088E6 }, /* GL_STATIC_COPY */ + { 31834, 0x000088E6 }, /* GL_STATIC_COPY_ARB */ + { 31853, 0x000088E4 }, /* GL_STATIC_DRAW */ + { 31868, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */ + { 31887, 0x000088E5 }, /* GL_STATIC_READ */ + { 31902, 0x000088E5 }, /* GL_STATIC_READ_ARB */ + { 31921, 0x00001802 }, /* GL_STENCIL */ + { 31932, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */ + { 31954, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */ + { 31980, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */ + { 32001, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */ + { 32026, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */ + { 32047, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */ + { 32072, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ + { 32104, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */ + { 32140, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ + { 32172, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */ + { 32208, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */ + { 32228, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */ + { 32255, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */ + { 32281, 0x00000D57 }, /* GL_STENCIL_BITS */ + { 32297, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */ + { 32319, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */ + { 32342, 0x00000B94 }, /* GL_STENCIL_FAIL */ + { 32358, 0x00000B92 }, /* GL_STENCIL_FUNC */ + { 32374, 0x00001901 }, /* GL_STENCIL_INDEX */ + { 32391, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */ + { 32414, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */ + { 32436, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */ + { 32458, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */ + { 32480, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */ + { 32501, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */ + { 32528, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */ + { 32555, 0x00000B97 }, /* GL_STENCIL_REF */ + { 32570, 0x00000B90 }, /* GL_STENCIL_TEST */ + { 32586, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ + { 32615, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */ + { 32637, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */ + { 32658, 0x00000C33 }, /* GL_STEREO */ + { 32668, 0x000085BE }, /* GL_STORAGE_CACHED_APPLE */ + { 32692, 0x000085BD }, /* GL_STORAGE_PRIVATE_APPLE */ + { 32717, 0x000085BF }, /* GL_STORAGE_SHARED_APPLE */ + { 32741, 0x000088E2 }, /* GL_STREAM_COPY */ + { 32756, 0x000088E2 }, /* GL_STREAM_COPY_ARB */ + { 32775, 0x000088E0 }, /* GL_STREAM_DRAW */ + { 32790, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */ + { 32809, 0x000088E1 }, /* GL_STREAM_READ */ + { 32824, 0x000088E1 }, /* GL_STREAM_READ_ARB */ + { 32843, 0x00000D50 }, /* GL_SUBPIXEL_BITS */ + { 32860, 0x000084E7 }, /* GL_SUBTRACT */ + { 32872, 0x000084E7 }, /* GL_SUBTRACT_ARB */ + { 32888, 0x00009113 }, /* GL_SYNC_CONDITION */ + { 32906, 0x00009116 }, /* GL_SYNC_FENCE */ + { 32920, 0x00009115 }, /* GL_SYNC_FLAGS */ + { 32934, 0x00000001 }, /* GL_SYNC_FLUSH_COMMANDS_BIT */ + { 32961, 0x00009117 }, /* GL_SYNC_GPU_COMMANDS_COMPLETE */ + { 32991, 0x00009114 }, /* GL_SYNC_STATUS */ + { 33006, 0x00002001 }, /* GL_T */ + { 33011, 0x00002A2A }, /* GL_T2F_C3F_V3F */ + { 33026, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */ + { 33045, 0x00002A29 }, /* GL_T2F_C4UB_V3F */ + { 33061, 0x00002A2B }, /* GL_T2F_N3F_V3F */ + { 33076, 0x00002A27 }, /* GL_T2F_V3F */ + { 33087, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */ + { 33106, 0x00002A28 }, /* GL_T4F_V4F */ + { 33117, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */ + { 33140, 0x00001702 }, /* GL_TEXTURE */ + { 33151, 0x000084C0 }, /* GL_TEXTURE0 */ + { 33163, 0x000084C0 }, /* GL_TEXTURE0_ARB */ + { 33179, 0x000084C1 }, /* GL_TEXTURE1 */ + { 33191, 0x000084CA }, /* GL_TEXTURE10 */ + { 33204, 0x000084CA }, /* GL_TEXTURE10_ARB */ + { 33221, 0x000084CB }, /* GL_TEXTURE11 */ + { 33234, 0x000084CB }, /* GL_TEXTURE11_ARB */ + { 33251, 0x000084CC }, /* GL_TEXTURE12 */ + { 33264, 0x000084CC }, /* GL_TEXTURE12_ARB */ + { 33281, 0x000084CD }, /* GL_TEXTURE13 */ + { 33294, 0x000084CD }, /* GL_TEXTURE13_ARB */ + { 33311, 0x000084CE }, /* GL_TEXTURE14 */ + { 33324, 0x000084CE }, /* GL_TEXTURE14_ARB */ + { 33341, 0x000084CF }, /* GL_TEXTURE15 */ + { 33354, 0x000084CF }, /* GL_TEXTURE15_ARB */ + { 33371, 0x000084D0 }, /* GL_TEXTURE16 */ + { 33384, 0x000084D0 }, /* GL_TEXTURE16_ARB */ + { 33401, 0x000084D1 }, /* GL_TEXTURE17 */ + { 33414, 0x000084D1 }, /* GL_TEXTURE17_ARB */ + { 33431, 0x000084D2 }, /* GL_TEXTURE18 */ + { 33444, 0x000084D2 }, /* GL_TEXTURE18_ARB */ + { 33461, 0x000084D3 }, /* GL_TEXTURE19 */ + { 33474, 0x000084D3 }, /* GL_TEXTURE19_ARB */ + { 33491, 0x000084C1 }, /* GL_TEXTURE1_ARB */ + { 33507, 0x000084C2 }, /* GL_TEXTURE2 */ + { 33519, 0x000084D4 }, /* GL_TEXTURE20 */ + { 33532, 0x000084D4 }, /* GL_TEXTURE20_ARB */ + { 33549, 0x000084D5 }, /* GL_TEXTURE21 */ + { 33562, 0x000084D5 }, /* GL_TEXTURE21_ARB */ + { 33579, 0x000084D6 }, /* GL_TEXTURE22 */ + { 33592, 0x000084D6 }, /* GL_TEXTURE22_ARB */ + { 33609, 0x000084D7 }, /* GL_TEXTURE23 */ + { 33622, 0x000084D7 }, /* GL_TEXTURE23_ARB */ + { 33639, 0x000084D8 }, /* GL_TEXTURE24 */ + { 33652, 0x000084D8 }, /* GL_TEXTURE24_ARB */ + { 33669, 0x000084D9 }, /* GL_TEXTURE25 */ + { 33682, 0x000084D9 }, /* GL_TEXTURE25_ARB */ + { 33699, 0x000084DA }, /* GL_TEXTURE26 */ + { 33712, 0x000084DA }, /* GL_TEXTURE26_ARB */ + { 33729, 0x000084DB }, /* GL_TEXTURE27 */ + { 33742, 0x000084DB }, /* GL_TEXTURE27_ARB */ + { 33759, 0x000084DC }, /* GL_TEXTURE28 */ + { 33772, 0x000084DC }, /* GL_TEXTURE28_ARB */ + { 33789, 0x000084DD }, /* GL_TEXTURE29 */ + { 33802, 0x000084DD }, /* GL_TEXTURE29_ARB */ + { 33819, 0x000084C2 }, /* GL_TEXTURE2_ARB */ + { 33835, 0x000084C3 }, /* GL_TEXTURE3 */ + { 33847, 0x000084DE }, /* GL_TEXTURE30 */ + { 33860, 0x000084DE }, /* GL_TEXTURE30_ARB */ + { 33877, 0x000084DF }, /* GL_TEXTURE31 */ + { 33890, 0x000084DF }, /* GL_TEXTURE31_ARB */ + { 33907, 0x000084C3 }, /* GL_TEXTURE3_ARB */ + { 33923, 0x000084C4 }, /* GL_TEXTURE4 */ + { 33935, 0x000084C4 }, /* GL_TEXTURE4_ARB */ + { 33951, 0x000084C5 }, /* GL_TEXTURE5 */ + { 33963, 0x000084C5 }, /* GL_TEXTURE5_ARB */ + { 33979, 0x000084C6 }, /* GL_TEXTURE6 */ + { 33991, 0x000084C6 }, /* GL_TEXTURE6_ARB */ + { 34007, 0x000084C7 }, /* GL_TEXTURE7 */ + { 34019, 0x000084C7 }, /* GL_TEXTURE7_ARB */ + { 34035, 0x000084C8 }, /* GL_TEXTURE8 */ + { 34047, 0x000084C8 }, /* GL_TEXTURE8_ARB */ + { 34063, 0x000084C9 }, /* GL_TEXTURE9 */ + { 34075, 0x000084C9 }, /* GL_TEXTURE9_ARB */ + { 34091, 0x00000DE0 }, /* GL_TEXTURE_1D */ + { 34105, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */ + { 34129, 0x00000DE1 }, /* GL_TEXTURE_2D */ + { 34143, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */ + { 34167, 0x0000806F }, /* GL_TEXTURE_3D */ + { 34181, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */ + { 34203, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */ + { 34229, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */ + { 34251, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */ + { 34273, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ + { 34305, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */ + { 34327, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ + { 34359, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */ + { 34381, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */ + { 34409, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */ + { 34441, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ + { 34474, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */ + { 34506, 0x00040000 }, /* GL_TEXTURE_BIT */ + { 34521, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */ + { 34542, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */ + { 34567, 0x00001005 }, /* GL_TEXTURE_BORDER */ + { 34585, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */ + { 34609, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ + { 34640, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ + { 34670, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ + { 34700, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ + { 34735, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ + { 34766, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + { 34804, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */ + { 34831, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ + { 34863, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + { 34897, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */ + { 34921, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */ + { 34949, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */ + { 34973, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */ + { 35001, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ + { 35034, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */ + { 35058, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */ + { 35080, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */ + { 35102, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */ + { 35128, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */ + { 35162, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ + { 35195, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */ + { 35232, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */ + { 35260, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */ + { 35292, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */ + { 35315, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ + { 35353, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */ + { 35395, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */ + { 35426, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */ + { 35454, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ + { 35484, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */ + { 35512, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */ + { 35532, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */ + { 35556, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ + { 35587, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */ + { 35622, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ + { 35653, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */ + { 35688, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ + { 35719, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */ + { 35754, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ + { 35785, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */ + { 35820, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ + { 35851, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */ + { 35886, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ + { 35917, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */ + { 35952, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */ + { 35981, 0x00008071 }, /* GL_TEXTURE_DEPTH */ + { 35998, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */ + { 36020, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */ + { 36046, 0x00002300 }, /* GL_TEXTURE_ENV */ + { 36061, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */ + { 36082, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */ + { 36102, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */ + { 36128, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */ + { 36148, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */ + { 36165, 0x00000C62 }, /* GL_TEXTURE_GEN_R */ + { 36182, 0x00000C60 }, /* GL_TEXTURE_GEN_S */ + { 36199, 0x00000C61 }, /* GL_TEXTURE_GEN_T */ + { 36216, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */ + { 36241, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */ + { 36263, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */ + { 36289, 0x00001001 }, /* GL_TEXTURE_HEIGHT */ + { 36307, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */ + { 36333, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */ + { 36359, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */ + { 36389, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */ + { 36416, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */ + { 36441, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */ + { 36461, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */ + { 36485, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ + { 36512, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ + { 36539, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ + { 36566, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */ + { 36592, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */ + { 36622, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */ + { 36644, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */ + { 36662, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ + { 36692, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ + { 36720, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ + { 36748, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ + { 36776, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */ + { 36797, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */ + { 36816, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */ + { 36838, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */ + { 36857, 0x00008066 }, /* GL_TEXTURE_PRIORITY */ + { 36877, 0x000085B7 }, /* GL_TEXTURE_RANGE_LENGTH_APPLE */ + { 36907, 0x000085B8 }, /* GL_TEXTURE_RANGE_POINTER_APPLE */ + { 36938, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */ + { 36963, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */ + { 36987, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */ + { 37007, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */ + { 37031, 0x00008067 }, /* GL_TEXTURE_RESIDENT */ + { 37051, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */ + { 37074, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */ + { 37098, 0x000085BC }, /* GL_TEXTURE_STORAGE_HINT_APPLE */ + { 37128, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */ + { 37153, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ + { 37187, 0x00001000 }, /* GL_TEXTURE_WIDTH */ + { 37204, 0x00008072 }, /* GL_TEXTURE_WRAP_R */ + { 37222, 0x00002802 }, /* GL_TEXTURE_WRAP_S */ + { 37240, 0x00002803 }, /* GL_TEXTURE_WRAP_T */ + { 37258, 0x0000911B }, /* GL_TIMEOUT_EXPIRED */ + { 37277, 0xFFFFFFFFFFFFFFFF }, /* GL_TIMEOUT_IGNORED */ + { 37296, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */ + { 37316, 0x00008648 }, /* GL_TRACK_MATRIX_NV */ + { 37335, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */ + { 37364, 0x00001000 }, /* GL_TRANSFORM_BIT */ + { 37381, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */ + { 37407, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */ + { 37437, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ + { 37469, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ + { 37499, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */ + { 37533, 0x0000862C }, /* GL_TRANSPOSE_NV */ + { 37549, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */ + { 37580, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */ + { 37615, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */ + { 37643, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */ + { 37675, 0x00000004 }, /* GL_TRIANGLES */ + { 37688, 0x00000006 }, /* GL_TRIANGLE_FAN */ + { 37704, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */ + { 37725, 0x00000005 }, /* GL_TRIANGLE_STRIP */ + { 37743, 0x00000001 }, /* GL_TRUE */ + { 37751, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */ + { 37771, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */ + { 37794, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */ + { 37814, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */ + { 37835, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */ + { 37857, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */ + { 37879, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */ + { 37899, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */ + { 37920, 0x00009118 }, /* GL_UNSIGNALED */ + { 37934, 0x00001401 }, /* GL_UNSIGNED_BYTE */ + { 37951, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */ + { 37978, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */ + { 38001, 0x00001405 }, /* GL_UNSIGNED_INT */ + { 38017, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */ + { 38044, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */ + { 38065, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */ + { 38089, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */ + { 38120, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */ + { 38144, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */ + { 38172, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */ + { 38195, 0x00001403 }, /* GL_UNSIGNED_SHORT */ + { 38213, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ + { 38243, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */ + { 38269, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ + { 38299, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */ + { 38325, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */ + { 38349, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */ + { 38377, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */ + { 38405, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */ + { 38432, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ + { 38464, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */ + { 38495, 0x00008CA2 }, /* GL_UPPER_LEFT */ + { 38509, 0x00002A20 }, /* GL_V2F */ + { 38516, 0x00002A21 }, /* GL_V3F */ + { 38523, 0x00008B83 }, /* GL_VALIDATE_STATUS */ + { 38542, 0x00001F00 }, /* GL_VENDOR */ + { 38552, 0x00001F02 }, /* GL_VERSION */ + { 38563, 0x00008074 }, /* GL_VERTEX_ARRAY */ + { 38579, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING */ + { 38603, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */ + { 38633, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ + { 38664, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */ + { 38699, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */ + { 38723, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */ + { 38744, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */ + { 38767, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */ + { 38788, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ + { 38815, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ + { 38843, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ + { 38871, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ + { 38899, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ + { 38927, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ + { 38955, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ + { 38983, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ + { 39010, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ + { 39037, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ + { 39064, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ + { 39091, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ + { 39118, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ + { 39145, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ + { 39172, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ + { 39199, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ + { 39226, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ + { 39264, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */ + { 39306, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ + { 39337, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ + { 39372, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ + { 39406, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ + { 39444, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ + { 39475, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ + { 39510, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ + { 39538, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ + { 39570, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ + { 39600, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ + { 39634, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ + { 39662, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ + { 39694, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */ + { 39714, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */ + { 39736, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */ + { 39765, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */ + { 39786, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */ + { 39815, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ + { 39848, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ + { 39880, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */ + { 39907, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ + { 39938, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ + { 39968, 0x00008B31 }, /* GL_VERTEX_SHADER */ + { 39985, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */ + { 40006, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */ + { 40033, 0x00000BA2 }, /* GL_VIEWPORT */ + { 40045, 0x00000800 }, /* GL_VIEWPORT_BIT */ + { 40061, 0x0000911D }, /* GL_WAIT_FAILED */ + { 40076, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */ + { 40096, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ + { 40127, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */ + { 40162, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */ + { 40190, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */ + { 40215, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ + { 40242, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */ + { 40267, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */ + { 40291, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */ + { 40310, 0x000088B9 }, /* GL_WRITE_ONLY */ + { 40324, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */ + { 40342, 0x00001506 }, /* GL_XOR */ + { 40349, 0x000085B9 }, /* GL_YCBCR_422_APPLE */ + { 40368, 0x00008757 }, /* GL_YCBCR_MESA */ + { 40382, 0x00000000 }, /* GL_ZERO */ + { 40390, 0x00000D16 }, /* GL_ZOOM_X */ + { 40400, 0x00000D17 }, /* GL_ZOOM_Y */ }; static const unsigned reduced_enums[1347] = { 476, /* GL_FALSE */ - 692, /* GL_LINES */ - 694, /* GL_LINE_LOOP */ - 701, /* GL_LINE_STRIP */ - 1744, /* GL_TRIANGLES */ - 1747, /* GL_TRIANGLE_STRIP */ - 1745, /* GL_TRIANGLE_FAN */ - 1272, /* GL_QUADS */ - 1275, /* GL_QUAD_STRIP */ - 1159, /* GL_POLYGON */ - 1171, /* GL_POLYGON_STIPPLE_BIT */ - 1120, /* GL_PIXEL_MODE_BIT */ - 679, /* GL_LIGHTING_BIT */ - 505, /* GL_FOG_BIT */ + 694, /* GL_LINES */ + 696, /* GL_LINE_LOOP */ + 703, /* GL_LINE_STRIP */ + 1748, /* GL_TRIANGLES */ + 1751, /* GL_TRIANGLE_STRIP */ + 1749, /* GL_TRIANGLE_FAN */ + 1275, /* GL_QUADS */ + 1279, /* GL_QUAD_STRIP */ + 1161, /* GL_POLYGON */ + 1173, /* GL_POLYGON_STIPPLE_BIT */ + 1122, /* GL_PIXEL_MODE_BIT */ + 681, /* GL_LIGHTING_BIT */ + 506, /* GL_FOG_BIT */ 8, /* GL_ACCUM */ - 711, /* GL_LOAD */ - 1327, /* GL_RETURN */ - 992, /* GL_MULT */ + 713, /* GL_LOAD */ + 1331, /* GL_RETURN */ + 994, /* GL_MULT */ 23, /* GL_ADD */ - 1008, /* GL_NEVER */ - 669, /* GL_LESS */ + 1010, /* GL_NEVER */ + 671, /* GL_LESS */ 466, /* GL_EQUAL */ - 668, /* GL_LEQUAL */ - 591, /* GL_GREATER */ - 1023, /* GL_NOTEQUAL */ - 590, /* GL_GEQUAL */ + 670, /* GL_LEQUAL */ + 592, /* GL_GREATER */ + 1025, /* GL_NOTEQUAL */ + 591, /* GL_GEQUAL */ 47, /* GL_ALWAYS */ - 1468, /* GL_SRC_COLOR */ - 1053, /* GL_ONE_MINUS_SRC_COLOR */ - 1466, /* GL_SRC_ALPHA */ - 1052, /* GL_ONE_MINUS_SRC_ALPHA */ + 1472, /* GL_SRC_COLOR */ + 1055, /* GL_ONE_MINUS_SRC_COLOR */ + 1470, /* GL_SRC_ALPHA */ + 1054, /* GL_ONE_MINUS_SRC_ALPHA */ 445, /* GL_DST_ALPHA */ - 1050, /* GL_ONE_MINUS_DST_ALPHA */ + 1052, /* GL_ONE_MINUS_DST_ALPHA */ 446, /* GL_DST_COLOR */ - 1051, /* GL_ONE_MINUS_DST_COLOR */ - 1467, /* GL_SRC_ALPHA_SATURATE */ - 578, /* GL_FRONT_LEFT */ - 579, /* GL_FRONT_RIGHT */ + 1053, /* GL_ONE_MINUS_DST_COLOR */ + 1471, /* GL_SRC_ALPHA_SATURATE */ + 579, /* GL_FRONT_LEFT */ + 580, /* GL_FRONT_RIGHT */ 69, /* GL_BACK_LEFT */ 70, /* GL_BACK_RIGHT */ - 575, /* GL_FRONT */ + 576, /* GL_FRONT */ 68, /* GL_BACK */ - 667, /* GL_LEFT */ - 1369, /* GL_RIGHT */ - 576, /* GL_FRONT_AND_BACK */ + 669, /* GL_LEFT */ + 1373, /* GL_RIGHT */ + 577, /* GL_FRONT_AND_BACK */ 63, /* GL_AUX0 */ 64, /* GL_AUX1 */ 65, /* GL_AUX2 */ 66, /* GL_AUX3 */ - 657, /* GL_INVALID_ENUM */ - 661, /* GL_INVALID_VALUE */ - 660, /* GL_INVALID_OPERATION */ - 1473, /* GL_STACK_OVERFLOW */ - 1474, /* GL_STACK_UNDERFLOW */ - 1078, /* GL_OUT_OF_MEMORY */ - 658, /* GL_INVALID_FRAMEBUFFER_OPERATION */ + 658, /* GL_INVALID_ENUM */ + 662, /* GL_INVALID_VALUE */ + 661, /* GL_INVALID_OPERATION */ + 1477, /* GL_STACK_OVERFLOW */ + 1478, /* GL_STACK_UNDERFLOW */ + 1080, /* GL_OUT_OF_MEMORY */ + 659, /* GL_INVALID_FRAMEBUFFER_OPERATION */ 0, /* GL_2D */ 2, /* GL_3D */ 3, /* GL_3D_COLOR */ 4, /* GL_3D_COLOR_TEXTURE */ 6, /* GL_4D_COLOR_TEXTURE */ - 1098, /* GL_PASS_THROUGH_TOKEN */ - 1158, /* GL_POINT_TOKEN */ - 702, /* GL_LINE_TOKEN */ - 1172, /* GL_POLYGON_TOKEN */ + 1100, /* GL_PASS_THROUGH_TOKEN */ + 1160, /* GL_POINT_TOKEN */ + 704, /* GL_LINE_TOKEN */ + 1174, /* GL_POLYGON_TOKEN */ 74, /* GL_BITMAP_TOKEN */ 444, /* GL_DRAW_PIXEL_TOKEN */ 301, /* GL_COPY_PIXEL_TOKEN */ - 695, /* GL_LINE_RESET_TOKEN */ + 697, /* GL_LINE_RESET_TOKEN */ 469, /* GL_EXP */ 470, /* GL_EXP2 */ 337, /* GL_CW */ 125, /* GL_CCW */ 146, /* GL_COEFF */ - 1075, /* GL_ORDER */ + 1077, /* GL_ORDER */ 382, /* GL_DOMAIN */ 311, /* GL_CURRENT_COLOR */ 314, /* GL_CURRENT_INDEX */ @@ -3846,67 +3854,67 @@ static const unsigned reduced_enums[1347] = 328, /* GL_CURRENT_RASTER_POSITION */ 329, /* GL_CURRENT_RASTER_POSITION_VALID */ 326, /* GL_CURRENT_RASTER_DISTANCE */ - 1151, /* GL_POINT_SMOOTH */ - 1140, /* GL_POINT_SIZE */ - 1150, /* GL_POINT_SIZE_RANGE */ - 1141, /* GL_POINT_SIZE_GRANULARITY */ - 696, /* GL_LINE_SMOOTH */ - 703, /* GL_LINE_WIDTH */ - 705, /* GL_LINE_WIDTH_RANGE */ - 704, /* GL_LINE_WIDTH_GRANULARITY */ - 698, /* GL_LINE_STIPPLE */ - 699, /* GL_LINE_STIPPLE_PATTERN */ - 700, /* GL_LINE_STIPPLE_REPEAT */ - 710, /* GL_LIST_MODE */ - 875, /* GL_MAX_LIST_NESTING */ - 707, /* GL_LIST_BASE */ - 709, /* GL_LIST_INDEX */ - 1161, /* GL_POLYGON_MODE */ - 1168, /* GL_POLYGON_SMOOTH */ - 1170, /* GL_POLYGON_STIPPLE */ + 1153, /* GL_POINT_SMOOTH */ + 1142, /* GL_POINT_SIZE */ + 1152, /* GL_POINT_SIZE_RANGE */ + 1143, /* GL_POINT_SIZE_GRANULARITY */ + 698, /* GL_LINE_SMOOTH */ + 705, /* GL_LINE_WIDTH */ + 707, /* GL_LINE_WIDTH_RANGE */ + 706, /* GL_LINE_WIDTH_GRANULARITY */ + 700, /* GL_LINE_STIPPLE */ + 701, /* GL_LINE_STIPPLE_PATTERN */ + 702, /* GL_LINE_STIPPLE_REPEAT */ + 712, /* GL_LIST_MODE */ + 877, /* GL_MAX_LIST_NESTING */ + 709, /* GL_LIST_BASE */ + 711, /* GL_LIST_INDEX */ + 1163, /* GL_POLYGON_MODE */ + 1170, /* GL_POLYGON_SMOOTH */ + 1172, /* GL_POLYGON_STIPPLE */ 455, /* GL_EDGE_FLAG */ 304, /* GL_CULL_FACE */ 305, /* GL_CULL_FACE_MODE */ - 577, /* GL_FRONT_FACE */ - 678, /* GL_LIGHTING */ - 683, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ - 684, /* GL_LIGHT_MODEL_TWO_SIDE */ - 680, /* GL_LIGHT_MODEL_AMBIENT */ - 1415, /* GL_SHADE_MODEL */ + 578, /* GL_FRONT_FACE */ + 680, /* GL_LIGHTING */ + 685, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ + 686, /* GL_LIGHT_MODEL_TWO_SIDE */ + 682, /* GL_LIGHT_MODEL_AMBIENT */ + 1419, /* GL_SHADE_MODEL */ 193, /* GL_COLOR_MATERIAL_FACE */ 194, /* GL_COLOR_MATERIAL_PARAMETER */ 192, /* GL_COLOR_MATERIAL */ - 504, /* GL_FOG */ - 526, /* GL_FOG_INDEX */ - 522, /* GL_FOG_DENSITY */ - 530, /* GL_FOG_START */ - 524, /* GL_FOG_END */ - 527, /* GL_FOG_MODE */ - 506, /* GL_FOG_COLOR */ + 505, /* GL_FOG */ + 527, /* GL_FOG_INDEX */ + 523, /* GL_FOG_DENSITY */ + 531, /* GL_FOG_START */ + 525, /* GL_FOG_END */ + 528, /* GL_FOG_MODE */ + 507, /* GL_FOG_COLOR */ 369, /* GL_DEPTH_RANGE */ 376, /* GL_DEPTH_TEST */ 379, /* GL_DEPTH_WRITEMASK */ 357, /* GL_DEPTH_CLEAR_VALUE */ 368, /* GL_DEPTH_FUNC */ 12, /* GL_ACCUM_CLEAR_VALUE */ - 1509, /* GL_STENCIL_TEST */ - 1497, /* GL_STENCIL_CLEAR_VALUE */ - 1499, /* GL_STENCIL_FUNC */ - 1511, /* GL_STENCIL_VALUE_MASK */ - 1498, /* GL_STENCIL_FAIL */ - 1506, /* GL_STENCIL_PASS_DEPTH_FAIL */ - 1507, /* GL_STENCIL_PASS_DEPTH_PASS */ - 1508, /* GL_STENCIL_REF */ - 1512, /* GL_STENCIL_WRITEMASK */ - 844, /* GL_MATRIX_MODE */ - 1013, /* GL_NORMALIZE */ - 1838, /* GL_VIEWPORT */ - 987, /* GL_MODELVIEW_STACK_DEPTH */ - 1251, /* GL_PROJECTION_STACK_DEPTH */ - 1719, /* GL_TEXTURE_STACK_DEPTH */ - 985, /* GL_MODELVIEW_MATRIX */ - 1250, /* GL_PROJECTION_MATRIX */ - 1702, /* GL_TEXTURE_MATRIX */ + 1513, /* GL_STENCIL_TEST */ + 1501, /* GL_STENCIL_CLEAR_VALUE */ + 1503, /* GL_STENCIL_FUNC */ + 1515, /* GL_STENCIL_VALUE_MASK */ + 1502, /* GL_STENCIL_FAIL */ + 1510, /* GL_STENCIL_PASS_DEPTH_FAIL */ + 1511, /* GL_STENCIL_PASS_DEPTH_PASS */ + 1512, /* GL_STENCIL_REF */ + 1516, /* GL_STENCIL_WRITEMASK */ + 846, /* GL_MATRIX_MODE */ + 1015, /* GL_NORMALIZE */ + 1842, /* GL_VIEWPORT */ + 989, /* GL_MODELVIEW_STACK_DEPTH */ + 1253, /* GL_PROJECTION_STACK_DEPTH */ + 1723, /* GL_TEXTURE_STACK_DEPTH */ + 987, /* GL_MODELVIEW_MATRIX */ + 1252, /* GL_PROJECTION_MATRIX */ + 1706, /* GL_TEXTURE_MATRIX */ 61, /* GL_ATTRIB_STACK_DEPTH */ 136, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ 43, /* GL_ALPHA_TEST */ @@ -3916,162 +3924,162 @@ static const unsigned reduced_enums[1347] = 78, /* GL_BLEND_DST */ 87, /* GL_BLEND_SRC */ 75, /* GL_BLEND */ - 713, /* GL_LOGIC_OP_MODE */ - 631, /* GL_INDEX_LOGIC_OP */ + 715, /* GL_LOGIC_OP_MODE */ + 632, /* GL_INDEX_LOGIC_OP */ 191, /* GL_COLOR_LOGIC_OP */ 67, /* GL_AUX_BUFFERS */ 392, /* GL_DRAW_BUFFER */ - 1285, /* GL_READ_BUFFER */ - 1396, /* GL_SCISSOR_BOX */ - 1397, /* GL_SCISSOR_TEST */ - 630, /* GL_INDEX_CLEAR_VALUE */ - 635, /* GL_INDEX_WRITEMASK */ + 1289, /* GL_READ_BUFFER */ + 1400, /* GL_SCISSOR_BOX */ + 1401, /* GL_SCISSOR_TEST */ + 631, /* GL_INDEX_CLEAR_VALUE */ + 636, /* GL_INDEX_WRITEMASK */ 188, /* GL_COLOR_CLEAR_VALUE */ 230, /* GL_COLOR_WRITEMASK */ - 632, /* GL_INDEX_MODE */ - 1362, /* GL_RGBA_MODE */ + 633, /* GL_INDEX_MODE */ + 1366, /* GL_RGBA_MODE */ 391, /* GL_DOUBLEBUFFER */ - 1513, /* GL_STEREO */ - 1320, /* GL_RENDER_MODE */ - 1099, /* GL_PERSPECTIVE_CORRECTION_HINT */ - 1152, /* GL_POINT_SMOOTH_HINT */ - 697, /* GL_LINE_SMOOTH_HINT */ - 1169, /* GL_POLYGON_SMOOTH_HINT */ - 525, /* GL_FOG_HINT */ - 1683, /* GL_TEXTURE_GEN_S */ - 1684, /* GL_TEXTURE_GEN_T */ - 1682, /* GL_TEXTURE_GEN_R */ - 1681, /* GL_TEXTURE_GEN_Q */ - 1112, /* GL_PIXEL_MAP_I_TO_I */ - 1118, /* GL_PIXEL_MAP_S_TO_S */ - 1114, /* GL_PIXEL_MAP_I_TO_R */ - 1110, /* GL_PIXEL_MAP_I_TO_G */ - 1108, /* GL_PIXEL_MAP_I_TO_B */ - 1106, /* GL_PIXEL_MAP_I_TO_A */ - 1116, /* GL_PIXEL_MAP_R_TO_R */ - 1104, /* GL_PIXEL_MAP_G_TO_G */ - 1102, /* GL_PIXEL_MAP_B_TO_B */ - 1100, /* GL_PIXEL_MAP_A_TO_A */ - 1113, /* GL_PIXEL_MAP_I_TO_I_SIZE */ - 1119, /* GL_PIXEL_MAP_S_TO_S_SIZE */ - 1115, /* GL_PIXEL_MAP_I_TO_R_SIZE */ - 1111, /* GL_PIXEL_MAP_I_TO_G_SIZE */ - 1109, /* GL_PIXEL_MAP_I_TO_B_SIZE */ - 1107, /* GL_PIXEL_MAP_I_TO_A_SIZE */ - 1117, /* GL_PIXEL_MAP_R_TO_R_SIZE */ - 1105, /* GL_PIXEL_MAP_G_TO_G_SIZE */ - 1103, /* GL_PIXEL_MAP_B_TO_B_SIZE */ - 1101, /* GL_PIXEL_MAP_A_TO_A_SIZE */ - 1756, /* GL_UNPACK_SWAP_BYTES */ - 1751, /* GL_UNPACK_LSB_FIRST */ - 1752, /* GL_UNPACK_ROW_LENGTH */ - 1755, /* GL_UNPACK_SKIP_ROWS */ - 1754, /* GL_UNPACK_SKIP_PIXELS */ - 1749, /* GL_UNPACK_ALIGNMENT */ - 1087, /* GL_PACK_SWAP_BYTES */ - 1082, /* GL_PACK_LSB_FIRST */ - 1083, /* GL_PACK_ROW_LENGTH */ - 1086, /* GL_PACK_SKIP_ROWS */ - 1085, /* GL_PACK_SKIP_PIXELS */ - 1079, /* GL_PACK_ALIGNMENT */ - 791, /* GL_MAP_COLOR */ - 796, /* GL_MAP_STENCIL */ - 634, /* GL_INDEX_SHIFT */ - 633, /* GL_INDEX_OFFSET */ - 1298, /* GL_RED_SCALE */ - 1296, /* GL_RED_BIAS */ - 1856, /* GL_ZOOM_X */ - 1857, /* GL_ZOOM_Y */ - 595, /* GL_GREEN_SCALE */ - 593, /* GL_GREEN_BIAS */ + 1517, /* GL_STEREO */ + 1324, /* GL_RENDER_MODE */ + 1101, /* GL_PERSPECTIVE_CORRECTION_HINT */ + 1154, /* GL_POINT_SMOOTH_HINT */ + 699, /* GL_LINE_SMOOTH_HINT */ + 1171, /* GL_POLYGON_SMOOTH_HINT */ + 526, /* GL_FOG_HINT */ + 1687, /* GL_TEXTURE_GEN_S */ + 1688, /* GL_TEXTURE_GEN_T */ + 1686, /* GL_TEXTURE_GEN_R */ + 1685, /* GL_TEXTURE_GEN_Q */ + 1114, /* GL_PIXEL_MAP_I_TO_I */ + 1120, /* GL_PIXEL_MAP_S_TO_S */ + 1116, /* GL_PIXEL_MAP_I_TO_R */ + 1112, /* GL_PIXEL_MAP_I_TO_G */ + 1110, /* GL_PIXEL_MAP_I_TO_B */ + 1108, /* GL_PIXEL_MAP_I_TO_A */ + 1118, /* GL_PIXEL_MAP_R_TO_R */ + 1106, /* GL_PIXEL_MAP_G_TO_G */ + 1104, /* GL_PIXEL_MAP_B_TO_B */ + 1102, /* GL_PIXEL_MAP_A_TO_A */ + 1115, /* GL_PIXEL_MAP_I_TO_I_SIZE */ + 1121, /* GL_PIXEL_MAP_S_TO_S_SIZE */ + 1117, /* GL_PIXEL_MAP_I_TO_R_SIZE */ + 1113, /* GL_PIXEL_MAP_I_TO_G_SIZE */ + 1111, /* GL_PIXEL_MAP_I_TO_B_SIZE */ + 1109, /* GL_PIXEL_MAP_I_TO_A_SIZE */ + 1119, /* GL_PIXEL_MAP_R_TO_R_SIZE */ + 1107, /* GL_PIXEL_MAP_G_TO_G_SIZE */ + 1105, /* GL_PIXEL_MAP_B_TO_B_SIZE */ + 1103, /* GL_PIXEL_MAP_A_TO_A_SIZE */ + 1760, /* GL_UNPACK_SWAP_BYTES */ + 1755, /* GL_UNPACK_LSB_FIRST */ + 1756, /* GL_UNPACK_ROW_LENGTH */ + 1759, /* GL_UNPACK_SKIP_ROWS */ + 1758, /* GL_UNPACK_SKIP_PIXELS */ + 1753, /* GL_UNPACK_ALIGNMENT */ + 1089, /* GL_PACK_SWAP_BYTES */ + 1084, /* GL_PACK_LSB_FIRST */ + 1085, /* GL_PACK_ROW_LENGTH */ + 1088, /* GL_PACK_SKIP_ROWS */ + 1087, /* GL_PACK_SKIP_PIXELS */ + 1081, /* GL_PACK_ALIGNMENT */ + 793, /* GL_MAP_COLOR */ + 798, /* GL_MAP_STENCIL */ + 635, /* GL_INDEX_SHIFT */ + 634, /* GL_INDEX_OFFSET */ + 1302, /* GL_RED_SCALE */ + 1300, /* GL_RED_BIAS */ + 1860, /* GL_ZOOM_X */ + 1861, /* GL_ZOOM_Y */ + 596, /* GL_GREEN_SCALE */ + 594, /* GL_GREEN_BIAS */ 93, /* GL_BLUE_SCALE */ 91, /* GL_BLUE_BIAS */ 42, /* GL_ALPHA_SCALE */ 40, /* GL_ALPHA_BIAS */ 370, /* GL_DEPTH_SCALE */ 350, /* GL_DEPTH_BIAS */ - 870, /* GL_MAX_EVAL_ORDER */ - 874, /* GL_MAX_LIGHTS */ - 853, /* GL_MAX_CLIP_PLANES */ - 920, /* GL_MAX_TEXTURE_SIZE */ - 880, /* GL_MAX_PIXEL_MAP_TABLE */ - 849, /* GL_MAX_ATTRIB_STACK_DEPTH */ - 877, /* GL_MAX_MODELVIEW_STACK_DEPTH */ - 878, /* GL_MAX_NAME_STACK_DEPTH */ - 906, /* GL_MAX_PROJECTION_STACK_DEPTH */ - 921, /* GL_MAX_TEXTURE_STACK_DEPTH */ - 935, /* GL_MAX_VIEWPORT_DIMS */ - 850, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ - 1523, /* GL_SUBPIXEL_BITS */ - 629, /* GL_INDEX_BITS */ - 1297, /* GL_RED_BITS */ - 594, /* GL_GREEN_BITS */ + 872, /* GL_MAX_EVAL_ORDER */ + 876, /* GL_MAX_LIGHTS */ + 855, /* GL_MAX_CLIP_PLANES */ + 922, /* GL_MAX_TEXTURE_SIZE */ + 882, /* GL_MAX_PIXEL_MAP_TABLE */ + 851, /* GL_MAX_ATTRIB_STACK_DEPTH */ + 879, /* GL_MAX_MODELVIEW_STACK_DEPTH */ + 880, /* GL_MAX_NAME_STACK_DEPTH */ + 908, /* GL_MAX_PROJECTION_STACK_DEPTH */ + 923, /* GL_MAX_TEXTURE_STACK_DEPTH */ + 937, /* GL_MAX_VIEWPORT_DIMS */ + 852, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ + 1527, /* GL_SUBPIXEL_BITS */ + 630, /* GL_INDEX_BITS */ + 1301, /* GL_RED_BITS */ + 595, /* GL_GREEN_BITS */ 92, /* GL_BLUE_BITS */ 41, /* GL_ALPHA_BITS */ 351, /* GL_DEPTH_BITS */ - 1495, /* GL_STENCIL_BITS */ + 1499, /* GL_STENCIL_BITS */ 14, /* GL_ACCUM_RED_BITS */ 13, /* GL_ACCUM_GREEN_BITS */ 10, /* GL_ACCUM_BLUE_BITS */ 9, /* GL_ACCUM_ALPHA_BITS */ - 1001, /* GL_NAME_STACK_DEPTH */ + 1003, /* GL_NAME_STACK_DEPTH */ 62, /* GL_AUTO_NORMAL */ - 737, /* GL_MAP1_COLOR_4 */ - 740, /* GL_MAP1_INDEX */ - 741, /* GL_MAP1_NORMAL */ - 742, /* GL_MAP1_TEXTURE_COORD_1 */ - 743, /* GL_MAP1_TEXTURE_COORD_2 */ - 744, /* GL_MAP1_TEXTURE_COORD_3 */ - 745, /* GL_MAP1_TEXTURE_COORD_4 */ - 746, /* GL_MAP1_VERTEX_3 */ - 747, /* GL_MAP1_VERTEX_4 */ - 764, /* GL_MAP2_COLOR_4 */ - 767, /* GL_MAP2_INDEX */ - 768, /* GL_MAP2_NORMAL */ - 769, /* GL_MAP2_TEXTURE_COORD_1 */ - 770, /* GL_MAP2_TEXTURE_COORD_2 */ - 771, /* GL_MAP2_TEXTURE_COORD_3 */ - 772, /* GL_MAP2_TEXTURE_COORD_4 */ - 773, /* GL_MAP2_VERTEX_3 */ - 774, /* GL_MAP2_VERTEX_4 */ - 738, /* GL_MAP1_GRID_DOMAIN */ - 739, /* GL_MAP1_GRID_SEGMENTS */ - 765, /* GL_MAP2_GRID_DOMAIN */ - 766, /* GL_MAP2_GRID_SEGMENTS */ - 1606, /* GL_TEXTURE_1D */ - 1608, /* GL_TEXTURE_2D */ + 739, /* GL_MAP1_COLOR_4 */ + 742, /* GL_MAP1_INDEX */ + 743, /* GL_MAP1_NORMAL */ + 744, /* GL_MAP1_TEXTURE_COORD_1 */ + 745, /* GL_MAP1_TEXTURE_COORD_2 */ + 746, /* GL_MAP1_TEXTURE_COORD_3 */ + 747, /* GL_MAP1_TEXTURE_COORD_4 */ + 748, /* GL_MAP1_VERTEX_3 */ + 749, /* GL_MAP1_VERTEX_4 */ + 766, /* GL_MAP2_COLOR_4 */ + 769, /* GL_MAP2_INDEX */ + 770, /* GL_MAP2_NORMAL */ + 771, /* GL_MAP2_TEXTURE_COORD_1 */ + 772, /* GL_MAP2_TEXTURE_COORD_2 */ + 773, /* GL_MAP2_TEXTURE_COORD_3 */ + 774, /* GL_MAP2_TEXTURE_COORD_4 */ + 775, /* GL_MAP2_VERTEX_3 */ + 776, /* GL_MAP2_VERTEX_4 */ + 740, /* GL_MAP1_GRID_DOMAIN */ + 741, /* GL_MAP1_GRID_SEGMENTS */ + 767, /* GL_MAP2_GRID_DOMAIN */ + 768, /* GL_MAP2_GRID_SEGMENTS */ + 1610, /* GL_TEXTURE_1D */ + 1612, /* GL_TEXTURE_2D */ 479, /* GL_FEEDBACK_BUFFER_POINTER */ 480, /* GL_FEEDBACK_BUFFER_SIZE */ 481, /* GL_FEEDBACK_BUFFER_TYPE */ - 1406, /* GL_SELECTION_BUFFER_POINTER */ - 1407, /* GL_SELECTION_BUFFER_SIZE */ - 1724, /* GL_TEXTURE_WIDTH */ - 1688, /* GL_TEXTURE_HEIGHT */ - 1643, /* GL_TEXTURE_COMPONENTS */ - 1627, /* GL_TEXTURE_BORDER_COLOR */ - 1626, /* GL_TEXTURE_BORDER */ + 1410, /* GL_SELECTION_BUFFER_POINTER */ + 1411, /* GL_SELECTION_BUFFER_SIZE */ + 1728, /* GL_TEXTURE_WIDTH */ + 1692, /* GL_TEXTURE_HEIGHT */ + 1647, /* GL_TEXTURE_COMPONENTS */ + 1631, /* GL_TEXTURE_BORDER_COLOR */ + 1630, /* GL_TEXTURE_BORDER */ 383, /* GL_DONT_CARE */ 477, /* GL_FASTEST */ - 1009, /* GL_NICEST */ + 1011, /* GL_NICEST */ 48, /* GL_AMBIENT */ 380, /* GL_DIFFUSE */ - 1455, /* GL_SPECULAR */ - 1173, /* GL_POSITION */ - 1458, /* GL_SPOT_DIRECTION */ - 1459, /* GL_SPOT_EXPONENT */ - 1457, /* GL_SPOT_CUTOFF */ + 1459, /* GL_SPECULAR */ + 1175, /* GL_POSITION */ + 1462, /* GL_SPOT_DIRECTION */ + 1463, /* GL_SPOT_EXPONENT */ + 1461, /* GL_SPOT_CUTOFF */ 275, /* GL_CONSTANT_ATTENUATION */ - 687, /* GL_LINEAR_ATTENUATION */ - 1271, /* GL_QUADRATIC_ATTENUATION */ + 689, /* GL_LINEAR_ATTENUATION */ + 1274, /* GL_QUADRATIC_ATTENUATION */ 244, /* GL_COMPILE */ 245, /* GL_COMPILE_AND_EXECUTE */ 120, /* GL_BYTE */ - 1758, /* GL_UNSIGNED_BYTE */ - 1420, /* GL_SHORT */ - 1769, /* GL_UNSIGNED_SHORT */ - 637, /* GL_INT */ - 1761, /* GL_UNSIGNED_INT */ - 485, /* GL_FLOAT */ + 1762, /* GL_UNSIGNED_BYTE */ + 1424, /* GL_SHORT */ + 1773, /* GL_UNSIGNED_SHORT */ + 638, /* GL_INT */ + 1765, /* GL_UNSIGNED_INT */ + 486, /* GL_FLOAT */ 1, /* GL_2_BYTES */ 5, /* GL_3_BYTES */ 7, /* GL_4_BYTES */ @@ -4081,284 +4089,284 @@ static const unsigned reduced_enums[1347] = 52, /* GL_AND_REVERSE */ 299, /* GL_COPY */ 51, /* GL_AND_INVERTED */ - 1011, /* GL_NOOP */ - 1852, /* GL_XOR */ - 1074, /* GL_OR */ - 1012, /* GL_NOR */ + 1013, /* GL_NOOP */ + 1856, /* GL_XOR */ + 1076, /* GL_OR */ + 1014, /* GL_NOR */ 467, /* GL_EQUIV */ - 664, /* GL_INVERT */ - 1077, /* GL_OR_REVERSE */ + 665, /* GL_INVERT */ + 1079, /* GL_OR_REVERSE */ 300, /* GL_COPY_INVERTED */ - 1076, /* GL_OR_INVERTED */ - 1002, /* GL_NAND */ - 1411, /* GL_SET */ + 1078, /* GL_OR_INVERTED */ + 1004, /* GL_NAND */ + 1415, /* GL_SET */ 464, /* GL_EMISSION */ - 1419, /* GL_SHININESS */ + 1423, /* GL_SHININESS */ 49, /* GL_AMBIENT_AND_DIFFUSE */ 190, /* GL_COLOR_INDEXES */ - 952, /* GL_MODELVIEW */ - 1249, /* GL_PROJECTION */ - 1541, /* GL_TEXTURE */ + 954, /* GL_MODELVIEW */ + 1251, /* GL_PROJECTION */ + 1545, /* GL_TEXTURE */ 147, /* GL_COLOR */ 346, /* GL_DEPTH */ - 1481, /* GL_STENCIL */ + 1485, /* GL_STENCIL */ 189, /* GL_COLOR_INDEX */ - 1500, /* GL_STENCIL_INDEX */ + 1504, /* GL_STENCIL_INDEX */ 358, /* GL_DEPTH_COMPONENT */ - 1293, /* GL_RED */ - 592, /* GL_GREEN */ + 1297, /* GL_RED */ + 593, /* GL_GREEN */ 90, /* GL_BLUE */ 31, /* GL_ALPHA */ - 1328, /* GL_RGB */ - 1347, /* GL_RGBA */ - 715, /* GL_LUMINANCE */ - 736, /* GL_LUMINANCE_ALPHA */ + 1332, /* GL_RGB */ + 1351, /* GL_RGBA */ + 717, /* GL_LUMINANCE */ + 738, /* GL_LUMINANCE_ALPHA */ 73, /* GL_BITMAP */ - 1129, /* GL_POINT */ - 685, /* GL_LINE */ + 1131, /* GL_POINT */ + 687, /* GL_LINE */ 482, /* GL_FILL */ - 1302, /* GL_RENDER */ + 1306, /* GL_RENDER */ 478, /* GL_FEEDBACK */ - 1405, /* GL_SELECT */ - 484, /* GL_FLAT */ - 1430, /* GL_SMOOTH */ - 665, /* GL_KEEP */ - 1322, /* GL_REPLACE */ - 619, /* GL_INCR */ + 1409, /* GL_SELECT */ + 485, /* GL_FLAT */ + 1434, /* GL_SMOOTH */ + 666, /* GL_KEEP */ + 1326, /* GL_REPLACE */ + 620, /* GL_INCR */ 342, /* GL_DECR */ - 1784, /* GL_VENDOR */ - 1319, /* GL_RENDERER */ - 1785, /* GL_VERSION */ + 1788, /* GL_VENDOR */ + 1323, /* GL_RENDERER */ + 1789, /* GL_VERSION */ 471, /* GL_EXTENSIONS */ - 1370, /* GL_S */ - 1532, /* GL_T */ - 1282, /* GL_R */ - 1270, /* GL_Q */ - 988, /* GL_MODULATE */ + 1374, /* GL_S */ + 1536, /* GL_T */ + 1286, /* GL_R */ + 1273, /* GL_Q */ + 990, /* GL_MODULATE */ 341, /* GL_DECAL */ - 1678, /* GL_TEXTURE_ENV_MODE */ - 1677, /* GL_TEXTURE_ENV_COLOR */ - 1676, /* GL_TEXTURE_ENV */ + 1682, /* GL_TEXTURE_ENV_MODE */ + 1681, /* GL_TEXTURE_ENV_COLOR */ + 1680, /* GL_TEXTURE_ENV */ 472, /* GL_EYE_LINEAR */ - 1035, /* GL_OBJECT_LINEAR */ - 1456, /* GL_SPHERE_MAP */ - 1680, /* GL_TEXTURE_GEN_MODE */ - 1037, /* GL_OBJECT_PLANE */ + 1037, /* GL_OBJECT_LINEAR */ + 1460, /* GL_SPHERE_MAP */ + 1684, /* GL_TEXTURE_GEN_MODE */ + 1039, /* GL_OBJECT_PLANE */ 473, /* GL_EYE_PLANE */ - 1003, /* GL_NEAREST */ - 686, /* GL_LINEAR */ - 1007, /* GL_NEAREST_MIPMAP_NEAREST */ - 691, /* GL_LINEAR_MIPMAP_NEAREST */ - 1006, /* GL_NEAREST_MIPMAP_LINEAR */ - 690, /* GL_LINEAR_MIPMAP_LINEAR */ - 1701, /* GL_TEXTURE_MAG_FILTER */ - 1709, /* GL_TEXTURE_MIN_FILTER */ - 1726, /* GL_TEXTURE_WRAP_S */ - 1727, /* GL_TEXTURE_WRAP_T */ + 1005, /* GL_NEAREST */ + 688, /* GL_LINEAR */ + 1009, /* GL_NEAREST_MIPMAP_NEAREST */ + 693, /* GL_LINEAR_MIPMAP_NEAREST */ + 1008, /* GL_NEAREST_MIPMAP_LINEAR */ + 692, /* GL_LINEAR_MIPMAP_LINEAR */ + 1705, /* GL_TEXTURE_MAG_FILTER */ + 1713, /* GL_TEXTURE_MIN_FILTER */ + 1730, /* GL_TEXTURE_WRAP_S */ + 1731, /* GL_TEXTURE_WRAP_T */ 126, /* GL_CLAMP */ - 1321, /* GL_REPEAT */ - 1167, /* GL_POLYGON_OFFSET_UNITS */ - 1166, /* GL_POLYGON_OFFSET_POINT */ - 1165, /* GL_POLYGON_OFFSET_LINE */ - 1283, /* GL_R3_G3_B2 */ - 1781, /* GL_V2F */ - 1782, /* GL_V3F */ + 1325, /* GL_REPEAT */ + 1169, /* GL_POLYGON_OFFSET_UNITS */ + 1168, /* GL_POLYGON_OFFSET_POINT */ + 1167, /* GL_POLYGON_OFFSET_LINE */ + 1287, /* GL_R3_G3_B2 */ + 1785, /* GL_V2F */ + 1786, /* GL_V3F */ 123, /* GL_C4UB_V2F */ 124, /* GL_C4UB_V3F */ 121, /* GL_C3F_V3F */ - 1000, /* GL_N3F_V3F */ + 1002, /* GL_N3F_V3F */ 122, /* GL_C4F_N3F_V3F */ - 1537, /* GL_T2F_V3F */ - 1539, /* GL_T4F_V4F */ - 1535, /* GL_T2F_C4UB_V3F */ - 1533, /* GL_T2F_C3F_V3F */ - 1536, /* GL_T2F_N3F_V3F */ - 1534, /* GL_T2F_C4F_N3F_V3F */ - 1538, /* GL_T4F_C4F_N3F_V4F */ + 1541, /* GL_T2F_V3F */ + 1543, /* GL_T4F_V4F */ + 1539, /* GL_T2F_C4UB_V3F */ + 1537, /* GL_T2F_C3F_V3F */ + 1540, /* GL_T2F_N3F_V3F */ + 1538, /* GL_T2F_C4F_N3F_V3F */ + 1542, /* GL_T4F_C4F_N3F_V4F */ 139, /* GL_CLIP_PLANE0 */ 140, /* GL_CLIP_PLANE1 */ 141, /* GL_CLIP_PLANE2 */ 142, /* GL_CLIP_PLANE3 */ 143, /* GL_CLIP_PLANE4 */ 144, /* GL_CLIP_PLANE5 */ - 670, /* GL_LIGHT0 */ - 671, /* GL_LIGHT1 */ - 672, /* GL_LIGHT2 */ - 673, /* GL_LIGHT3 */ - 674, /* GL_LIGHT4 */ - 675, /* GL_LIGHT5 */ - 676, /* GL_LIGHT6 */ - 677, /* GL_LIGHT7 */ - 596, /* GL_HINT_BIT */ + 672, /* GL_LIGHT0 */ + 673, /* GL_LIGHT1 */ + 674, /* GL_LIGHT2 */ + 675, /* GL_LIGHT3 */ + 676, /* GL_LIGHT4 */ + 677, /* GL_LIGHT5 */ + 678, /* GL_LIGHT6 */ + 679, /* GL_LIGHT7 */ + 597, /* GL_HINT_BIT */ 277, /* GL_CONSTANT_COLOR */ - 1048, /* GL_ONE_MINUS_CONSTANT_COLOR */ + 1050, /* GL_ONE_MINUS_CONSTANT_COLOR */ 272, /* GL_CONSTANT_ALPHA */ - 1046, /* GL_ONE_MINUS_CONSTANT_ALPHA */ + 1048, /* GL_ONE_MINUS_CONSTANT_ALPHA */ 76, /* GL_BLEND_COLOR */ - 580, /* GL_FUNC_ADD */ - 936, /* GL_MIN */ - 846, /* GL_MAX */ + 581, /* GL_FUNC_ADD */ + 938, /* GL_MIN */ + 848, /* GL_MAX */ 81, /* GL_BLEND_EQUATION */ - 584, /* GL_FUNC_SUBTRACT */ - 582, /* GL_FUNC_REVERSE_SUBTRACT */ + 585, /* GL_FUNC_SUBTRACT */ + 583, /* GL_FUNC_REVERSE_SUBTRACT */ 280, /* GL_CONVOLUTION_1D */ 281, /* GL_CONVOLUTION_2D */ - 1408, /* GL_SEPARABLE_2D */ + 1412, /* GL_SEPARABLE_2D */ 284, /* GL_CONVOLUTION_BORDER_MODE */ 288, /* GL_CONVOLUTION_FILTER_SCALE */ 286, /* GL_CONVOLUTION_FILTER_BIAS */ - 1294, /* GL_REDUCE */ + 1298, /* GL_REDUCE */ 290, /* GL_CONVOLUTION_FORMAT */ 294, /* GL_CONVOLUTION_WIDTH */ 292, /* GL_CONVOLUTION_HEIGHT */ - 861, /* GL_MAX_CONVOLUTION_WIDTH */ - 859, /* GL_MAX_CONVOLUTION_HEIGHT */ - 1206, /* GL_POST_CONVOLUTION_RED_SCALE */ - 1202, /* GL_POST_CONVOLUTION_GREEN_SCALE */ - 1197, /* GL_POST_CONVOLUTION_BLUE_SCALE */ - 1193, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ - 1204, /* GL_POST_CONVOLUTION_RED_BIAS */ - 1200, /* GL_POST_CONVOLUTION_GREEN_BIAS */ - 1195, /* GL_POST_CONVOLUTION_BLUE_BIAS */ - 1191, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ - 597, /* GL_HISTOGRAM */ - 1254, /* GL_PROXY_HISTOGRAM */ - 613, /* GL_HISTOGRAM_WIDTH */ - 603, /* GL_HISTOGRAM_FORMAT */ - 609, /* GL_HISTOGRAM_RED_SIZE */ - 605, /* GL_HISTOGRAM_GREEN_SIZE */ - 600, /* GL_HISTOGRAM_BLUE_SIZE */ - 598, /* GL_HISTOGRAM_ALPHA_SIZE */ - 607, /* GL_HISTOGRAM_LUMINANCE_SIZE */ - 611, /* GL_HISTOGRAM_SINK */ - 937, /* GL_MINMAX */ - 939, /* GL_MINMAX_FORMAT */ - 941, /* GL_MINMAX_SINK */ - 1540, /* GL_TABLE_TOO_LARGE_EXT */ - 1760, /* GL_UNSIGNED_BYTE_3_3_2 */ - 1771, /* GL_UNSIGNED_SHORT_4_4_4_4 */ - 1773, /* GL_UNSIGNED_SHORT_5_5_5_1 */ - 1766, /* GL_UNSIGNED_INT_8_8_8_8 */ - 1762, /* GL_UNSIGNED_INT_10_10_10_2 */ - 1164, /* GL_POLYGON_OFFSET_FILL */ - 1163, /* GL_POLYGON_OFFSET_FACTOR */ - 1162, /* GL_POLYGON_OFFSET_BIAS */ - 1325, /* GL_RESCALE_NORMAL */ + 863, /* GL_MAX_CONVOLUTION_WIDTH */ + 861, /* GL_MAX_CONVOLUTION_HEIGHT */ + 1208, /* GL_POST_CONVOLUTION_RED_SCALE */ + 1204, /* GL_POST_CONVOLUTION_GREEN_SCALE */ + 1199, /* GL_POST_CONVOLUTION_BLUE_SCALE */ + 1195, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ + 1206, /* GL_POST_CONVOLUTION_RED_BIAS */ + 1202, /* GL_POST_CONVOLUTION_GREEN_BIAS */ + 1197, /* GL_POST_CONVOLUTION_BLUE_BIAS */ + 1193, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ + 598, /* GL_HISTOGRAM */ + 1257, /* GL_PROXY_HISTOGRAM */ + 614, /* GL_HISTOGRAM_WIDTH */ + 604, /* GL_HISTOGRAM_FORMAT */ + 610, /* GL_HISTOGRAM_RED_SIZE */ + 606, /* GL_HISTOGRAM_GREEN_SIZE */ + 601, /* GL_HISTOGRAM_BLUE_SIZE */ + 599, /* GL_HISTOGRAM_ALPHA_SIZE */ + 608, /* GL_HISTOGRAM_LUMINANCE_SIZE */ + 612, /* GL_HISTOGRAM_SINK */ + 939, /* GL_MINMAX */ + 941, /* GL_MINMAX_FORMAT */ + 943, /* GL_MINMAX_SINK */ + 1544, /* GL_TABLE_TOO_LARGE_EXT */ + 1764, /* GL_UNSIGNED_BYTE_3_3_2 */ + 1775, /* GL_UNSIGNED_SHORT_4_4_4_4 */ + 1777, /* GL_UNSIGNED_SHORT_5_5_5_1 */ + 1770, /* GL_UNSIGNED_INT_8_8_8_8 */ + 1766, /* GL_UNSIGNED_INT_10_10_10_2 */ + 1166, /* GL_POLYGON_OFFSET_FILL */ + 1165, /* GL_POLYGON_OFFSET_FACTOR */ + 1164, /* GL_POLYGON_OFFSET_BIAS */ + 1329, /* GL_RESCALE_NORMAL */ 36, /* GL_ALPHA4 */ 38, /* GL_ALPHA8 */ 32, /* GL_ALPHA12 */ 34, /* GL_ALPHA16 */ - 726, /* GL_LUMINANCE4 */ - 732, /* GL_LUMINANCE8 */ - 716, /* GL_LUMINANCE12 */ - 722, /* GL_LUMINANCE16 */ - 727, /* GL_LUMINANCE4_ALPHA4 */ - 730, /* GL_LUMINANCE6_ALPHA2 */ - 733, /* GL_LUMINANCE8_ALPHA8 */ - 719, /* GL_LUMINANCE12_ALPHA4 */ - 717, /* GL_LUMINANCE12_ALPHA12 */ - 723, /* GL_LUMINANCE16_ALPHA16 */ - 638, /* GL_INTENSITY */ - 643, /* GL_INTENSITY4 */ - 645, /* GL_INTENSITY8 */ - 639, /* GL_INTENSITY12 */ - 641, /* GL_INTENSITY16 */ - 1337, /* GL_RGB2_EXT */ - 1338, /* GL_RGB4 */ - 1341, /* GL_RGB5 */ - 1345, /* GL_RGB8 */ - 1329, /* GL_RGB10 */ - 1333, /* GL_RGB12 */ - 1335, /* GL_RGB16 */ - 1352, /* GL_RGBA2 */ - 1354, /* GL_RGBA4 */ - 1342, /* GL_RGB5_A1 */ - 1358, /* GL_RGBA8 */ - 1330, /* GL_RGB10_A2 */ - 1348, /* GL_RGBA12 */ - 1350, /* GL_RGBA16 */ - 1716, /* GL_TEXTURE_RED_SIZE */ - 1686, /* GL_TEXTURE_GREEN_SIZE */ - 1624, /* GL_TEXTURE_BLUE_SIZE */ - 1611, /* GL_TEXTURE_ALPHA_SIZE */ - 1699, /* GL_TEXTURE_LUMINANCE_SIZE */ - 1690, /* GL_TEXTURE_INTENSITY_SIZE */ - 1323, /* GL_REPLACE_EXT */ - 1258, /* GL_PROXY_TEXTURE_1D */ - 1261, /* GL_PROXY_TEXTURE_2D */ - 1722, /* GL_TEXTURE_TOO_LARGE_EXT */ - 1711, /* GL_TEXTURE_PRIORITY */ - 1718, /* GL_TEXTURE_RESIDENT */ - 1614, /* GL_TEXTURE_BINDING_1D */ - 1616, /* GL_TEXTURE_BINDING_2D */ - 1618, /* GL_TEXTURE_BINDING_3D */ - 1084, /* GL_PACK_SKIP_IMAGES */ - 1080, /* GL_PACK_IMAGE_HEIGHT */ - 1753, /* GL_UNPACK_SKIP_IMAGES */ - 1750, /* GL_UNPACK_IMAGE_HEIGHT */ - 1610, /* GL_TEXTURE_3D */ - 1264, /* GL_PROXY_TEXTURE_3D */ - 1673, /* GL_TEXTURE_DEPTH */ - 1725, /* GL_TEXTURE_WRAP_R */ - 847, /* GL_MAX_3D_TEXTURE_SIZE */ - 1786, /* GL_VERTEX_ARRAY */ - 1014, /* GL_NORMAL_ARRAY */ + 728, /* GL_LUMINANCE4 */ + 734, /* GL_LUMINANCE8 */ + 718, /* GL_LUMINANCE12 */ + 724, /* GL_LUMINANCE16 */ + 729, /* GL_LUMINANCE4_ALPHA4 */ + 732, /* GL_LUMINANCE6_ALPHA2 */ + 735, /* GL_LUMINANCE8_ALPHA8 */ + 721, /* GL_LUMINANCE12_ALPHA4 */ + 719, /* GL_LUMINANCE12_ALPHA12 */ + 725, /* GL_LUMINANCE16_ALPHA16 */ + 639, /* GL_INTENSITY */ + 644, /* GL_INTENSITY4 */ + 646, /* GL_INTENSITY8 */ + 640, /* GL_INTENSITY12 */ + 642, /* GL_INTENSITY16 */ + 1341, /* GL_RGB2_EXT */ + 1342, /* GL_RGB4 */ + 1345, /* GL_RGB5 */ + 1349, /* GL_RGB8 */ + 1333, /* GL_RGB10 */ + 1337, /* GL_RGB12 */ + 1339, /* GL_RGB16 */ + 1356, /* GL_RGBA2 */ + 1358, /* GL_RGBA4 */ + 1346, /* GL_RGB5_A1 */ + 1362, /* GL_RGBA8 */ + 1334, /* GL_RGB10_A2 */ + 1352, /* GL_RGBA12 */ + 1354, /* GL_RGBA16 */ + 1720, /* GL_TEXTURE_RED_SIZE */ + 1690, /* GL_TEXTURE_GREEN_SIZE */ + 1628, /* GL_TEXTURE_BLUE_SIZE */ + 1615, /* GL_TEXTURE_ALPHA_SIZE */ + 1703, /* GL_TEXTURE_LUMINANCE_SIZE */ + 1694, /* GL_TEXTURE_INTENSITY_SIZE */ + 1327, /* GL_REPLACE_EXT */ + 1261, /* GL_PROXY_TEXTURE_1D */ + 1264, /* GL_PROXY_TEXTURE_2D */ + 1726, /* GL_TEXTURE_TOO_LARGE_EXT */ + 1715, /* GL_TEXTURE_PRIORITY */ + 1722, /* GL_TEXTURE_RESIDENT */ + 1618, /* GL_TEXTURE_BINDING_1D */ + 1620, /* GL_TEXTURE_BINDING_2D */ + 1622, /* GL_TEXTURE_BINDING_3D */ + 1086, /* GL_PACK_SKIP_IMAGES */ + 1082, /* GL_PACK_IMAGE_HEIGHT */ + 1757, /* GL_UNPACK_SKIP_IMAGES */ + 1754, /* GL_UNPACK_IMAGE_HEIGHT */ + 1614, /* GL_TEXTURE_3D */ + 1267, /* GL_PROXY_TEXTURE_3D */ + 1677, /* GL_TEXTURE_DEPTH */ + 1729, /* GL_TEXTURE_WRAP_R */ + 849, /* GL_MAX_3D_TEXTURE_SIZE */ + 1790, /* GL_VERTEX_ARRAY */ + 1016, /* GL_NORMAL_ARRAY */ 148, /* GL_COLOR_ARRAY */ - 623, /* GL_INDEX_ARRAY */ - 1651, /* GL_TEXTURE_COORD_ARRAY */ + 624, /* GL_INDEX_ARRAY */ + 1655, /* GL_TEXTURE_COORD_ARRAY */ 456, /* GL_EDGE_FLAG_ARRAY */ - 1792, /* GL_VERTEX_ARRAY_SIZE */ - 1794, /* GL_VERTEX_ARRAY_TYPE */ - 1793, /* GL_VERTEX_ARRAY_STRIDE */ - 1019, /* GL_NORMAL_ARRAY_TYPE */ - 1018, /* GL_NORMAL_ARRAY_STRIDE */ + 1796, /* GL_VERTEX_ARRAY_SIZE */ + 1798, /* GL_VERTEX_ARRAY_TYPE */ + 1797, /* GL_VERTEX_ARRAY_STRIDE */ + 1021, /* GL_NORMAL_ARRAY_TYPE */ + 1020, /* GL_NORMAL_ARRAY_STRIDE */ 152, /* GL_COLOR_ARRAY_SIZE */ 154, /* GL_COLOR_ARRAY_TYPE */ 153, /* GL_COLOR_ARRAY_STRIDE */ - 628, /* GL_INDEX_ARRAY_TYPE */ - 627, /* GL_INDEX_ARRAY_STRIDE */ - 1655, /* GL_TEXTURE_COORD_ARRAY_SIZE */ - 1657, /* GL_TEXTURE_COORD_ARRAY_TYPE */ - 1656, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ + 629, /* GL_INDEX_ARRAY_TYPE */ + 628, /* GL_INDEX_ARRAY_STRIDE */ + 1659, /* GL_TEXTURE_COORD_ARRAY_SIZE */ + 1661, /* GL_TEXTURE_COORD_ARRAY_TYPE */ + 1660, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ 460, /* GL_EDGE_FLAG_ARRAY_STRIDE */ - 1791, /* GL_VERTEX_ARRAY_POINTER */ - 1017, /* GL_NORMAL_ARRAY_POINTER */ + 1795, /* GL_VERTEX_ARRAY_POINTER */ + 1019, /* GL_NORMAL_ARRAY_POINTER */ 151, /* GL_COLOR_ARRAY_POINTER */ - 626, /* GL_INDEX_ARRAY_POINTER */ - 1654, /* GL_TEXTURE_COORD_ARRAY_POINTER */ + 627, /* GL_INDEX_ARRAY_POINTER */ + 1658, /* GL_TEXTURE_COORD_ARRAY_POINTER */ 459, /* GL_EDGE_FLAG_ARRAY_POINTER */ - 993, /* GL_MULTISAMPLE */ - 1382, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ - 1384, /* GL_SAMPLE_ALPHA_TO_ONE */ - 1389, /* GL_SAMPLE_COVERAGE */ - 1386, /* GL_SAMPLE_BUFFERS */ - 1377, /* GL_SAMPLES */ - 1393, /* GL_SAMPLE_COVERAGE_VALUE */ - 1391, /* GL_SAMPLE_COVERAGE_INVERT */ + 995, /* GL_MULTISAMPLE */ + 1386, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ + 1388, /* GL_SAMPLE_ALPHA_TO_ONE */ + 1393, /* GL_SAMPLE_COVERAGE */ + 1390, /* GL_SAMPLE_BUFFERS */ + 1381, /* GL_SAMPLES */ + 1397, /* GL_SAMPLE_COVERAGE_VALUE */ + 1395, /* GL_SAMPLE_COVERAGE_INVERT */ 195, /* GL_COLOR_MATRIX */ 197, /* GL_COLOR_MATRIX_STACK_DEPTH */ - 855, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ - 1189, /* GL_POST_COLOR_MATRIX_RED_SCALE */ - 1185, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ - 1180, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ - 1176, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ - 1187, /* GL_POST_COLOR_MATRIX_RED_BIAS */ - 1183, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ - 1178, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ - 1174, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ - 1634, /* GL_TEXTURE_COLOR_TABLE_SGI */ - 1265, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ - 1636, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + 857, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ + 1191, /* GL_POST_COLOR_MATRIX_RED_SCALE */ + 1187, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ + 1182, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ + 1178, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ + 1189, /* GL_POST_COLOR_MATRIX_RED_BIAS */ + 1185, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ + 1180, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ + 1176, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ + 1638, /* GL_TEXTURE_COLOR_TABLE_SGI */ + 1268, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ + 1640, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ 80, /* GL_BLEND_DST_RGB */ 89, /* GL_BLEND_SRC_RGB */ 79, /* GL_BLEND_DST_ALPHA */ 88, /* GL_BLEND_SRC_ALPHA */ 201, /* GL_COLOR_TABLE */ - 1199, /* GL_POST_CONVOLUTION_COLOR_TABLE */ - 1182, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ - 1253, /* GL_PROXY_COLOR_TABLE */ - 1257, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ - 1256, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ + 1201, /* GL_POST_CONVOLUTION_COLOR_TABLE */ + 1184, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ + 1256, /* GL_PROXY_COLOR_TABLE */ + 1260, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ + 1259, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ 225, /* GL_COLOR_TABLE_SCALE */ 205, /* GL_COLOR_TABLE_BIAS */ 210, /* GL_COLOR_TABLE_FORMAT */ @@ -4371,380 +4379,380 @@ static const unsigned reduced_enums[1347] = 216, /* GL_COLOR_TABLE_INTENSITY_SIZE */ 71, /* GL_BGR */ 72, /* GL_BGRA */ - 869, /* GL_MAX_ELEMENTS_VERTICES */ - 868, /* GL_MAX_ELEMENTS_INDICES */ - 1689, /* GL_TEXTURE_INDEX_SIZE_EXT */ + 871, /* GL_MAX_ELEMENTS_VERTICES */ + 870, /* GL_MAX_ELEMENTS_INDICES */ + 1693, /* GL_TEXTURE_INDEX_SIZE_EXT */ 145, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ - 1146, /* GL_POINT_SIZE_MIN */ - 1142, /* GL_POINT_SIZE_MAX */ - 1136, /* GL_POINT_FADE_THRESHOLD_SIZE */ - 1132, /* GL_POINT_DISTANCE_ATTENUATION */ + 1148, /* GL_POINT_SIZE_MIN */ + 1144, /* GL_POINT_SIZE_MAX */ + 1138, /* GL_POINT_FADE_THRESHOLD_SIZE */ + 1134, /* GL_POINT_DISTANCE_ATTENUATION */ 127, /* GL_CLAMP_TO_BORDER */ 130, /* GL_CLAMP_TO_EDGE */ - 1710, /* GL_TEXTURE_MIN_LOD */ - 1708, /* GL_TEXTURE_MAX_LOD */ - 1613, /* GL_TEXTURE_BASE_LEVEL */ - 1707, /* GL_TEXTURE_MAX_LEVEL */ - 616, /* GL_IGNORE_BORDER_HP */ + 1714, /* GL_TEXTURE_MIN_LOD */ + 1712, /* GL_TEXTURE_MAX_LOD */ + 1617, /* GL_TEXTURE_BASE_LEVEL */ + 1711, /* GL_TEXTURE_MAX_LEVEL */ + 617, /* GL_IGNORE_BORDER_HP */ 276, /* GL_CONSTANT_BORDER_HP */ - 1324, /* GL_REPLICATE_BORDER_HP */ + 1328, /* GL_REPLICATE_BORDER_HP */ 282, /* GL_CONVOLUTION_BORDER_COLOR */ - 1043, /* GL_OCCLUSION_TEST_HP */ - 1044, /* GL_OCCLUSION_TEST_RESULT_HP */ - 688, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ - 1628, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ - 1630, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ - 1632, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ - 1633, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - 1631, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ - 1629, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ - 851, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ - 852, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - 1209, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ - 1211, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ - 1208, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ - 1210, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ - 1697, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ - 1698, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ - 1696, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ - 586, /* GL_GENERATE_MIPMAP */ - 587, /* GL_GENERATE_MIPMAP_HINT */ - 528, /* GL_FOG_OFFSET_SGIX */ - 529, /* GL_FOG_OFFSET_VALUE_SGIX */ - 1642, /* GL_TEXTURE_COMPARE_SGIX */ - 1641, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ - 1693, /* GL_TEXTURE_LEQUAL_R_SGIX */ - 1685, /* GL_TEXTURE_GEQUAL_R_SGIX */ + 1045, /* GL_OCCLUSION_TEST_HP */ + 1046, /* GL_OCCLUSION_TEST_RESULT_HP */ + 690, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ + 1632, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ + 1634, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ + 1636, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ + 1637, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + 1635, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ + 1633, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ + 853, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ + 854, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + 1211, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ + 1213, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ + 1210, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ + 1212, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ + 1701, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ + 1702, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ + 1700, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ + 587, /* GL_GENERATE_MIPMAP */ + 588, /* GL_GENERATE_MIPMAP_HINT */ + 529, /* GL_FOG_OFFSET_SGIX */ + 530, /* GL_FOG_OFFSET_VALUE_SGIX */ + 1646, /* GL_TEXTURE_COMPARE_SGIX */ + 1645, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ + 1697, /* GL_TEXTURE_LEQUAL_R_SGIX */ + 1689, /* GL_TEXTURE_GEQUAL_R_SGIX */ 359, /* GL_DEPTH_COMPONENT16 */ 362, /* GL_DEPTH_COMPONENT24 */ 365, /* GL_DEPTH_COMPONENT32 */ 306, /* GL_CULL_VERTEX_EXT */ 308, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ 307, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ - 1849, /* GL_WRAP_BORDER_SUN */ - 1635, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ - 681, /* GL_LIGHT_MODEL_COLOR_CONTROL */ - 1423, /* GL_SINGLE_COLOR */ - 1409, /* GL_SEPARATE_SPECULAR_COLOR */ - 1418, /* GL_SHARED_TEXTURE_PALETTE_EXT */ - 539, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ - 540, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ - 547, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ - 542, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ - 538, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ - 537, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ - 541, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ - 548, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ - 559, /* GL_FRAMEBUFFER_DEFAULT */ - 572, /* GL_FRAMEBUFFER_UNDEFINED */ + 1853, /* GL_WRAP_BORDER_SUN */ + 1639, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ + 683, /* GL_LIGHT_MODEL_COLOR_CONTROL */ + 1427, /* GL_SINGLE_COLOR */ + 1413, /* GL_SEPARATE_SPECULAR_COLOR */ + 1422, /* GL_SHARED_TEXTURE_PALETTE_EXT */ + 540, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ + 541, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ + 548, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ + 543, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ + 539, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ + 538, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ + 542, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ + 549, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ + 560, /* GL_FRAMEBUFFER_DEFAULT */ + 573, /* GL_FRAMEBUFFER_UNDEFINED */ 372, /* GL_DEPTH_STENCIL_ATTACHMENT */ - 622, /* GL_INDEX */ - 1759, /* GL_UNSIGNED_BYTE_2_3_3_REV */ - 1774, /* GL_UNSIGNED_SHORT_5_6_5 */ - 1775, /* GL_UNSIGNED_SHORT_5_6_5_REV */ - 1772, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ - 1770, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ - 1767, /* GL_UNSIGNED_INT_8_8_8_8_REV */ - 1765, /* GL_UNSIGNED_INT_2_10_10_10_REV */ - 1705, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ - 1706, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ - 1704, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ - 944, /* GL_MIRRORED_REPEAT */ - 1365, /* GL_RGB_S3TC */ - 1340, /* GL_RGB4_S3TC */ - 1363, /* GL_RGBA_S3TC */ - 1357, /* GL_RGBA4_S3TC */ - 1361, /* GL_RGBA_DXT5_S3TC */ - 1355, /* GL_RGBA4_DXT5_S3TC */ + 623, /* GL_INDEX */ + 1763, /* GL_UNSIGNED_BYTE_2_3_3_REV */ + 1778, /* GL_UNSIGNED_SHORT_5_6_5 */ + 1779, /* GL_UNSIGNED_SHORT_5_6_5_REV */ + 1776, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ + 1774, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ + 1771, /* GL_UNSIGNED_INT_8_8_8_8_REV */ + 1769, /* GL_UNSIGNED_INT_2_10_10_10_REV */ + 1709, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ + 1710, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ + 1708, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ + 946, /* GL_MIRRORED_REPEAT */ + 1369, /* GL_RGB_S3TC */ + 1344, /* GL_RGB4_S3TC */ + 1367, /* GL_RGBA_S3TC */ + 1361, /* GL_RGBA4_S3TC */ + 1365, /* GL_RGBA_DXT5_S3TC */ + 1359, /* GL_RGBA4_DXT5_S3TC */ 264, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */ 259, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */ 260, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */ 261, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */ - 1005, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ - 1004, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ - 689, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ - 515, /* GL_FOG_COORDINATE_SOURCE */ - 507, /* GL_FOG_COORD */ - 531, /* GL_FRAGMENT_DEPTH */ + 1007, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ + 1006, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ + 691, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ + 516, /* GL_FOG_COORDINATE_SOURCE */ + 508, /* GL_FOG_COORD */ + 532, /* GL_FRAGMENT_DEPTH */ 312, /* GL_CURRENT_FOG_COORD */ - 514, /* GL_FOG_COORDINATE_ARRAY_TYPE */ - 513, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ - 512, /* GL_FOG_COORDINATE_ARRAY_POINTER */ - 509, /* GL_FOG_COORDINATE_ARRAY */ + 515, /* GL_FOG_COORDINATE_ARRAY_TYPE */ + 514, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ + 513, /* GL_FOG_COORDINATE_ARRAY_POINTER */ + 510, /* GL_FOG_COORDINATE_ARRAY */ 199, /* GL_COLOR_SUM */ 332, /* GL_CURRENT_SECONDARY_COLOR */ - 1402, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ - 1404, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ - 1403, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ - 1401, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ - 1398, /* GL_SECONDARY_COLOR_ARRAY */ + 1406, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ + 1408, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ + 1407, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ + 1405, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ + 1402, /* GL_SECONDARY_COLOR_ARRAY */ 330, /* GL_CURRENT_RASTER_SECONDARY_COLOR */ 28, /* GL_ALIASED_POINT_SIZE_RANGE */ 27, /* GL_ALIASED_LINE_WIDTH_RANGE */ - 1542, /* GL_TEXTURE0 */ - 1544, /* GL_TEXTURE1 */ - 1566, /* GL_TEXTURE2 */ - 1588, /* GL_TEXTURE3 */ - 1594, /* GL_TEXTURE4 */ - 1596, /* GL_TEXTURE5 */ - 1598, /* GL_TEXTURE6 */ - 1600, /* GL_TEXTURE7 */ - 1602, /* GL_TEXTURE8 */ - 1604, /* GL_TEXTURE9 */ - 1545, /* GL_TEXTURE10 */ - 1547, /* GL_TEXTURE11 */ - 1549, /* GL_TEXTURE12 */ - 1551, /* GL_TEXTURE13 */ - 1553, /* GL_TEXTURE14 */ - 1555, /* GL_TEXTURE15 */ - 1557, /* GL_TEXTURE16 */ - 1559, /* GL_TEXTURE17 */ - 1561, /* GL_TEXTURE18 */ - 1563, /* GL_TEXTURE19 */ - 1567, /* GL_TEXTURE20 */ - 1569, /* GL_TEXTURE21 */ - 1571, /* GL_TEXTURE22 */ - 1573, /* GL_TEXTURE23 */ - 1575, /* GL_TEXTURE24 */ - 1577, /* GL_TEXTURE25 */ - 1579, /* GL_TEXTURE26 */ - 1581, /* GL_TEXTURE27 */ - 1583, /* GL_TEXTURE28 */ - 1585, /* GL_TEXTURE29 */ - 1589, /* GL_TEXTURE30 */ - 1591, /* GL_TEXTURE31 */ + 1546, /* GL_TEXTURE0 */ + 1548, /* GL_TEXTURE1 */ + 1570, /* GL_TEXTURE2 */ + 1592, /* GL_TEXTURE3 */ + 1598, /* GL_TEXTURE4 */ + 1600, /* GL_TEXTURE5 */ + 1602, /* GL_TEXTURE6 */ + 1604, /* GL_TEXTURE7 */ + 1606, /* GL_TEXTURE8 */ + 1608, /* GL_TEXTURE9 */ + 1549, /* GL_TEXTURE10 */ + 1551, /* GL_TEXTURE11 */ + 1553, /* GL_TEXTURE12 */ + 1555, /* GL_TEXTURE13 */ + 1557, /* GL_TEXTURE14 */ + 1559, /* GL_TEXTURE15 */ + 1561, /* GL_TEXTURE16 */ + 1563, /* GL_TEXTURE17 */ + 1565, /* GL_TEXTURE18 */ + 1567, /* GL_TEXTURE19 */ + 1571, /* GL_TEXTURE20 */ + 1573, /* GL_TEXTURE21 */ + 1575, /* GL_TEXTURE22 */ + 1577, /* GL_TEXTURE23 */ + 1579, /* GL_TEXTURE24 */ + 1581, /* GL_TEXTURE25 */ + 1583, /* GL_TEXTURE26 */ + 1585, /* GL_TEXTURE27 */ + 1587, /* GL_TEXTURE28 */ + 1589, /* GL_TEXTURE29 */ + 1593, /* GL_TEXTURE30 */ + 1595, /* GL_TEXTURE31 */ 18, /* GL_ACTIVE_TEXTURE */ 133, /* GL_CLIENT_ACTIVE_TEXTURE */ - 922, /* GL_MAX_TEXTURE_UNITS */ - 1737, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ - 1740, /* GL_TRANSPOSE_PROJECTION_MATRIX */ - 1742, /* GL_TRANSPOSE_TEXTURE_MATRIX */ - 1734, /* GL_TRANSPOSE_COLOR_MATRIX */ - 1524, /* GL_SUBTRACT */ - 909, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ + 924, /* GL_MAX_TEXTURE_UNITS */ + 1741, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ + 1744, /* GL_TRANSPOSE_PROJECTION_MATRIX */ + 1746, /* GL_TRANSPOSE_TEXTURE_MATRIX */ + 1738, /* GL_TRANSPOSE_COLOR_MATRIX */ + 1528, /* GL_SUBTRACT */ + 911, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ 247, /* GL_COMPRESSED_ALPHA */ 251, /* GL_COMPRESSED_LUMINANCE */ 252, /* GL_COMPRESSED_LUMINANCE_ALPHA */ 249, /* GL_COMPRESSED_INTENSITY */ 255, /* GL_COMPRESSED_RGB */ 256, /* GL_COMPRESSED_RGBA */ - 1649, /* GL_TEXTURE_COMPRESSION_HINT */ - 1714, /* GL_TEXTURE_RECTANGLE_ARB */ - 1621, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ - 1268, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ - 907, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ + 1653, /* GL_TEXTURE_COMPRESSION_HINT */ + 1718, /* GL_TEXTURE_RECTANGLE_ARB */ + 1625, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ + 1271, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ + 909, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ 371, /* GL_DEPTH_STENCIL */ - 1763, /* GL_UNSIGNED_INT_24_8 */ - 918, /* GL_MAX_TEXTURE_LOD_BIAS */ - 1703, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ - 919, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ - 1679, /* GL_TEXTURE_FILTER_CONTROL */ - 1694, /* GL_TEXTURE_LOD_BIAS */ + 1767, /* GL_UNSIGNED_INT_24_8 */ + 920, /* GL_MAX_TEXTURE_LOD_BIAS */ + 1707, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ + 921, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ + 1683, /* GL_TEXTURE_FILTER_CONTROL */ + 1698, /* GL_TEXTURE_LOD_BIAS */ 232, /* GL_COMBINE4 */ - 912, /* GL_MAX_SHININESS_NV */ - 913, /* GL_MAX_SPOT_EXPONENT_NV */ - 620, /* GL_INCR_WRAP */ + 914, /* GL_MAX_SHININESS_NV */ + 915, /* GL_MAX_SPOT_EXPONENT_NV */ + 621, /* GL_INCR_WRAP */ 343, /* GL_DECR_WRAP */ - 964, /* GL_MODELVIEW1_ARB */ - 1020, /* GL_NORMAL_MAP */ - 1299, /* GL_REFLECTION_MAP */ - 1658, /* GL_TEXTURE_CUBE_MAP */ - 1619, /* GL_TEXTURE_BINDING_CUBE_MAP */ - 1666, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ - 1660, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ - 1668, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ - 1662, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ - 1670, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ - 1664, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ - 1266, /* GL_PROXY_TEXTURE_CUBE_MAP */ - 863, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ - 999, /* GL_MULTISAMPLE_FILTER_HINT_NV */ - 523, /* GL_FOG_DISTANCE_MODE_NV */ + 966, /* GL_MODELVIEW1_ARB */ + 1022, /* GL_NORMAL_MAP */ + 1303, /* GL_REFLECTION_MAP */ + 1662, /* GL_TEXTURE_CUBE_MAP */ + 1623, /* GL_TEXTURE_BINDING_CUBE_MAP */ + 1670, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ + 1664, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ + 1672, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ + 1666, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ + 1674, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ + 1668, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ + 1269, /* GL_PROXY_TEXTURE_CUBE_MAP */ + 865, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ + 1001, /* GL_MULTISAMPLE_FILTER_HINT_NV */ + 524, /* GL_FOG_DISTANCE_MODE_NV */ 475, /* GL_EYE_RADIAL_NV */ 474, /* GL_EYE_PLANE_ABSOLUTE_NV */ 231, /* GL_COMBINE */ 238, /* GL_COMBINE_RGB */ 233, /* GL_COMBINE_ALPHA */ - 1366, /* GL_RGB_SCALE */ + 1370, /* GL_RGB_SCALE */ 24, /* GL_ADD_SIGNED */ - 648, /* GL_INTERPOLATE */ + 649, /* GL_INTERPOLATE */ 271, /* GL_CONSTANT */ - 1215, /* GL_PRIMARY_COLOR */ - 1212, /* GL_PREVIOUS */ - 1438, /* GL_SOURCE0_RGB */ - 1444, /* GL_SOURCE1_RGB */ - 1450, /* GL_SOURCE2_RGB */ - 1454, /* GL_SOURCE3_RGB_NV */ - 1435, /* GL_SOURCE0_ALPHA */ - 1441, /* GL_SOURCE1_ALPHA */ - 1447, /* GL_SOURCE2_ALPHA */ - 1453, /* GL_SOURCE3_ALPHA_NV */ - 1057, /* GL_OPERAND0_RGB */ - 1063, /* GL_OPERAND1_RGB */ - 1069, /* GL_OPERAND2_RGB */ - 1073, /* GL_OPERAND3_RGB_NV */ - 1054, /* GL_OPERAND0_ALPHA */ - 1060, /* GL_OPERAND1_ALPHA */ - 1066, /* GL_OPERAND2_ALPHA */ - 1072, /* GL_OPERAND3_ALPHA_NV */ - 1787, /* GL_VERTEX_ARRAY_BINDING */ - 1712, /* GL_TEXTURE_RANGE_LENGTH_APPLE */ - 1713, /* GL_TEXTURE_RANGE_POINTER_APPLE */ - 1853, /* GL_YCBCR_422_APPLE */ - 1776, /* GL_UNSIGNED_SHORT_8_8_APPLE */ - 1778, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ - 1721, /* GL_TEXTURE_STORAGE_HINT_APPLE */ - 1515, /* GL_STORAGE_PRIVATE_APPLE */ - 1514, /* GL_STORAGE_CACHED_APPLE */ - 1516, /* GL_STORAGE_SHARED_APPLE */ - 1425, /* GL_SLICE_ACCUM_SUN */ - 1274, /* GL_QUAD_MESH_SUN */ - 1746, /* GL_TRIANGLE_MESH_SUN */ - 1826, /* GL_VERTEX_PROGRAM_ARB */ - 1837, /* GL_VERTEX_STATE_PROGRAM_NV */ - 1813, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ - 1819, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ - 1821, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ - 1823, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ + 1217, /* GL_PRIMARY_COLOR */ + 1214, /* GL_PREVIOUS */ + 1442, /* GL_SOURCE0_RGB */ + 1448, /* GL_SOURCE1_RGB */ + 1454, /* GL_SOURCE2_RGB */ + 1458, /* GL_SOURCE3_RGB_NV */ + 1439, /* GL_SOURCE0_ALPHA */ + 1445, /* GL_SOURCE1_ALPHA */ + 1451, /* GL_SOURCE2_ALPHA */ + 1457, /* GL_SOURCE3_ALPHA_NV */ + 1059, /* GL_OPERAND0_RGB */ + 1065, /* GL_OPERAND1_RGB */ + 1071, /* GL_OPERAND2_RGB */ + 1075, /* GL_OPERAND3_RGB_NV */ + 1056, /* GL_OPERAND0_ALPHA */ + 1062, /* GL_OPERAND1_ALPHA */ + 1068, /* GL_OPERAND2_ALPHA */ + 1074, /* GL_OPERAND3_ALPHA_NV */ + 1791, /* GL_VERTEX_ARRAY_BINDING */ + 1716, /* GL_TEXTURE_RANGE_LENGTH_APPLE */ + 1717, /* GL_TEXTURE_RANGE_POINTER_APPLE */ + 1857, /* GL_YCBCR_422_APPLE */ + 1780, /* GL_UNSIGNED_SHORT_8_8_APPLE */ + 1782, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ + 1725, /* GL_TEXTURE_STORAGE_HINT_APPLE */ + 1519, /* GL_STORAGE_PRIVATE_APPLE */ + 1518, /* GL_STORAGE_CACHED_APPLE */ + 1520, /* GL_STORAGE_SHARED_APPLE */ + 1429, /* GL_SLICE_ACCUM_SUN */ + 1278, /* GL_QUAD_MESH_SUN */ + 1750, /* GL_TRIANGLE_MESH_SUN */ + 1830, /* GL_VERTEX_PROGRAM_ARB */ + 1841, /* GL_VERTEX_STATE_PROGRAM_NV */ + 1817, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ + 1823, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ + 1825, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ + 1827, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ 334, /* GL_CURRENT_VERTEX_ATTRIB */ - 1228, /* GL_PROGRAM_LENGTH_ARB */ - 1242, /* GL_PROGRAM_STRING_ARB */ - 986, /* GL_MODELVIEW_PROJECTION_NV */ - 615, /* GL_IDENTITY_NV */ - 662, /* GL_INVERSE_NV */ - 1739, /* GL_TRANSPOSE_NV */ - 663, /* GL_INVERSE_TRANSPOSE_NV */ - 893, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ - 892, /* GL_MAX_PROGRAM_MATRICES_ARB */ - 800, /* GL_MATRIX0_NV */ - 812, /* GL_MATRIX1_NV */ - 824, /* GL_MATRIX2_NV */ - 828, /* GL_MATRIX3_NV */ - 830, /* GL_MATRIX4_NV */ - 832, /* GL_MATRIX5_NV */ - 834, /* GL_MATRIX6_NV */ - 836, /* GL_MATRIX7_NV */ + 1230, /* GL_PROGRAM_LENGTH_ARB */ + 1244, /* GL_PROGRAM_STRING_ARB */ + 988, /* GL_MODELVIEW_PROJECTION_NV */ + 616, /* GL_IDENTITY_NV */ + 663, /* GL_INVERSE_NV */ + 1743, /* GL_TRANSPOSE_NV */ + 664, /* GL_INVERSE_TRANSPOSE_NV */ + 895, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ + 894, /* GL_MAX_PROGRAM_MATRICES_ARB */ + 802, /* GL_MATRIX0_NV */ + 814, /* GL_MATRIX1_NV */ + 826, /* GL_MATRIX2_NV */ + 830, /* GL_MATRIX3_NV */ + 832, /* GL_MATRIX4_NV */ + 834, /* GL_MATRIX5_NV */ + 836, /* GL_MATRIX6_NV */ + 838, /* GL_MATRIX7_NV */ 318, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ 315, /* GL_CURRENT_MATRIX_ARB */ - 1829, /* GL_VERTEX_PROGRAM_POINT_SIZE */ - 1832, /* GL_VERTEX_PROGRAM_TWO_SIDE */ - 1240, /* GL_PROGRAM_PARAMETER_NV */ - 1817, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ - 1244, /* GL_PROGRAM_TARGET_NV */ - 1241, /* GL_PROGRAM_RESIDENT_NV */ - 1731, /* GL_TRACK_MATRIX_NV */ - 1732, /* GL_TRACK_MATRIX_TRANSFORM_NV */ - 1827, /* GL_VERTEX_PROGRAM_BINDING_NV */ - 1222, /* GL_PROGRAM_ERROR_POSITION_ARB */ + 1833, /* GL_VERTEX_PROGRAM_POINT_SIZE */ + 1836, /* GL_VERTEX_PROGRAM_TWO_SIDE */ + 1242, /* GL_PROGRAM_PARAMETER_NV */ + 1821, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ + 1246, /* GL_PROGRAM_TARGET_NV */ + 1243, /* GL_PROGRAM_RESIDENT_NV */ + 1735, /* GL_TRACK_MATRIX_NV */ + 1736, /* GL_TRACK_MATRIX_TRANSFORM_NV */ + 1831, /* GL_VERTEX_PROGRAM_BINDING_NV */ + 1224, /* GL_PROGRAM_ERROR_POSITION_ARB */ 355, /* GL_DEPTH_CLAMP */ - 1795, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ - 1802, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ - 1803, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ - 1804, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ - 1805, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ - 1806, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ - 1807, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ - 1808, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ - 1809, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ - 1810, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ - 1796, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ - 1797, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ - 1798, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ - 1799, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ - 1800, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ - 1801, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ - 748, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ - 755, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ - 756, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ - 757, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ - 758, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ - 759, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ - 760, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ - 761, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ - 762, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ - 763, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ - 749, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ - 750, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ - 751, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ - 752, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ - 753, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ - 754, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ - 775, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ - 782, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ - 783, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ - 784, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ - 785, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ - 786, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ - 787, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ - 1221, /* GL_PROGRAM_BINDING_ARB */ - 789, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ - 790, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ - 776, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ - 777, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ - 778, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ - 779, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ - 780, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ - 781, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ - 1647, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ - 1644, /* GL_TEXTURE_COMPRESSED */ - 1025, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ + 1799, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ + 1806, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ + 1807, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ + 1808, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ + 1809, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ + 1810, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ + 1811, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ + 1812, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ + 1813, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ + 1814, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ + 1800, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ + 1801, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ + 1802, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ + 1803, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ + 1804, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ + 1805, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ + 750, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ + 757, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ + 758, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ + 759, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ + 760, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ + 761, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ + 762, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ + 763, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ + 764, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ + 765, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ + 751, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ + 752, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ + 753, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ + 754, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ + 755, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ + 756, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ + 777, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ + 784, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ + 785, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ + 786, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ + 787, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ + 788, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ + 789, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ + 1223, /* GL_PROGRAM_BINDING_ARB */ + 791, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ + 792, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ + 778, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ + 779, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ + 780, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ + 781, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ + 782, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ + 783, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ + 1651, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ + 1648, /* GL_TEXTURE_COMPRESSED */ + 1027, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ 269, /* GL_COMPRESSED_TEXTURE_FORMATS */ - 934, /* GL_MAX_VERTEX_UNITS_ARB */ + 936, /* GL_MAX_VERTEX_UNITS_ARB */ 22, /* GL_ACTIVE_VERTEX_UNITS_ARB */ - 1848, /* GL_WEIGHT_SUM_UNITY_ARB */ - 1825, /* GL_VERTEX_BLEND_ARB */ + 1852, /* GL_WEIGHT_SUM_UNITY_ARB */ + 1829, /* GL_VERTEX_BLEND_ARB */ 336, /* GL_CURRENT_WEIGHT_ARB */ - 1847, /* GL_WEIGHT_ARRAY_TYPE_ARB */ - 1846, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ - 1845, /* GL_WEIGHT_ARRAY_SIZE_ARB */ - 1844, /* GL_WEIGHT_ARRAY_POINTER_ARB */ - 1841, /* GL_WEIGHT_ARRAY_ARB */ + 1851, /* GL_WEIGHT_ARRAY_TYPE_ARB */ + 1850, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ + 1849, /* GL_WEIGHT_ARRAY_SIZE_ARB */ + 1848, /* GL_WEIGHT_ARRAY_POINTER_ARB */ + 1845, /* GL_WEIGHT_ARRAY_ARB */ 384, /* GL_DOT3_RGB */ 385, /* GL_DOT3_RGBA */ 263, /* GL_COMPRESSED_RGB_FXT1_3DFX */ 258, /* GL_COMPRESSED_RGBA_FXT1_3DFX */ - 994, /* GL_MULTISAMPLE_3DFX */ - 1387, /* GL_SAMPLE_BUFFERS_3DFX */ - 1378, /* GL_SAMPLES_3DFX */ - 975, /* GL_MODELVIEW2_ARB */ - 978, /* GL_MODELVIEW3_ARB */ - 979, /* GL_MODELVIEW4_ARB */ - 980, /* GL_MODELVIEW5_ARB */ - 981, /* GL_MODELVIEW6_ARB */ - 982, /* GL_MODELVIEW7_ARB */ - 983, /* GL_MODELVIEW8_ARB */ - 984, /* GL_MODELVIEW9_ARB */ - 954, /* GL_MODELVIEW10_ARB */ - 955, /* GL_MODELVIEW11_ARB */ - 956, /* GL_MODELVIEW12_ARB */ - 957, /* GL_MODELVIEW13_ARB */ - 958, /* GL_MODELVIEW14_ARB */ - 959, /* GL_MODELVIEW15_ARB */ - 960, /* GL_MODELVIEW16_ARB */ - 961, /* GL_MODELVIEW17_ARB */ - 962, /* GL_MODELVIEW18_ARB */ - 963, /* GL_MODELVIEW19_ARB */ - 965, /* GL_MODELVIEW20_ARB */ - 966, /* GL_MODELVIEW21_ARB */ - 967, /* GL_MODELVIEW22_ARB */ - 968, /* GL_MODELVIEW23_ARB */ - 969, /* GL_MODELVIEW24_ARB */ - 970, /* GL_MODELVIEW25_ARB */ - 971, /* GL_MODELVIEW26_ARB */ - 972, /* GL_MODELVIEW27_ARB */ - 973, /* GL_MODELVIEW28_ARB */ - 974, /* GL_MODELVIEW29_ARB */ - 976, /* GL_MODELVIEW30_ARB */ - 977, /* GL_MODELVIEW31_ARB */ + 996, /* GL_MULTISAMPLE_3DFX */ + 1391, /* GL_SAMPLE_BUFFERS_3DFX */ + 1382, /* GL_SAMPLES_3DFX */ + 977, /* GL_MODELVIEW2_ARB */ + 980, /* GL_MODELVIEW3_ARB */ + 981, /* GL_MODELVIEW4_ARB */ + 982, /* GL_MODELVIEW5_ARB */ + 983, /* GL_MODELVIEW6_ARB */ + 984, /* GL_MODELVIEW7_ARB */ + 985, /* GL_MODELVIEW8_ARB */ + 986, /* GL_MODELVIEW9_ARB */ + 956, /* GL_MODELVIEW10_ARB */ + 957, /* GL_MODELVIEW11_ARB */ + 958, /* GL_MODELVIEW12_ARB */ + 959, /* GL_MODELVIEW13_ARB */ + 960, /* GL_MODELVIEW14_ARB */ + 961, /* GL_MODELVIEW15_ARB */ + 962, /* GL_MODELVIEW16_ARB */ + 963, /* GL_MODELVIEW17_ARB */ + 964, /* GL_MODELVIEW18_ARB */ + 965, /* GL_MODELVIEW19_ARB */ + 967, /* GL_MODELVIEW20_ARB */ + 968, /* GL_MODELVIEW21_ARB */ + 969, /* GL_MODELVIEW22_ARB */ + 970, /* GL_MODELVIEW23_ARB */ + 971, /* GL_MODELVIEW24_ARB */ + 972, /* GL_MODELVIEW25_ARB */ + 973, /* GL_MODELVIEW26_ARB */ + 974, /* GL_MODELVIEW27_ARB */ + 975, /* GL_MODELVIEW28_ARB */ + 976, /* GL_MODELVIEW29_ARB */ + 978, /* GL_MODELVIEW30_ARB */ + 979, /* GL_MODELVIEW31_ARB */ 389, /* GL_DOT3_RGB_EXT */ 387, /* GL_DOT3_RGBA_EXT */ - 948, /* GL_MIRROR_CLAMP_EXT */ - 951, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ - 989, /* GL_MODULATE_ADD_ATI */ - 990, /* GL_MODULATE_SIGNED_ADD_ATI */ - 991, /* GL_MODULATE_SUBTRACT_ATI */ - 1854, /* GL_YCBCR_MESA */ - 1081, /* GL_PACK_INVERT_MESA */ + 950, /* GL_MIRROR_CLAMP_EXT */ + 953, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ + 991, /* GL_MODULATE_ADD_ATI */ + 992, /* GL_MODULATE_SIGNED_ADD_ATI */ + 993, /* GL_MODULATE_SUBTRACT_ATI */ + 1858, /* GL_YCBCR_MESA */ + 1083, /* GL_PACK_INVERT_MESA */ 339, /* GL_DEBUG_OBJECT_MESA */ 340, /* GL_DEBUG_PRINT_MESA */ 338, /* GL_DEBUG_ASSERT_MESA */ @@ -4758,24 +4766,24 @@ static const unsigned reduced_enums[1347] = 447, /* GL_DU8DV8_ATI */ 114, /* GL_BUMP_ENVMAP_ATI */ 118, /* GL_BUMP_TARGET_ATI */ - 1486, /* GL_STENCIL_BACK_FUNC */ - 1484, /* GL_STENCIL_BACK_FAIL */ - 1488, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ - 1490, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ - 532, /* GL_FRAGMENT_PROGRAM_ARB */ - 1219, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ - 1247, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ - 1246, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ - 1231, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - 1237, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - 1236, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - 882, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ - 905, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ - 904, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ - 895, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - 901, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - 900, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - 865, /* GL_MAX_DRAW_BUFFERS */ + 1490, /* GL_STENCIL_BACK_FUNC */ + 1488, /* GL_STENCIL_BACK_FAIL */ + 1492, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ + 1494, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ + 533, /* GL_FRAGMENT_PROGRAM_ARB */ + 1221, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ + 1249, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ + 1248, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ + 1233, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + 1239, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + 1238, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + 884, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ + 907, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ + 906, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ + 897, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + 903, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + 902, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + 867, /* GL_MAX_DRAW_BUFFERS */ 393, /* GL_DRAW_BUFFER0 */ 396, /* GL_DRAW_BUFFER1 */ 417, /* GL_DRAW_BUFFER2 */ @@ -4793,253 +4801,253 @@ static const unsigned reduced_enums[1347] = 409, /* GL_DRAW_BUFFER14 */ 412, /* GL_DRAW_BUFFER15 */ 82, /* GL_BLEND_EQUATION_ALPHA */ - 845, /* GL_MATRIX_PALETTE_ARB */ - 876, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ - 879, /* GL_MAX_PALETTE_MATRICES_ARB */ + 847, /* GL_MATRIX_PALETTE_ARB */ + 878, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ + 881, /* GL_MAX_PALETTE_MATRICES_ARB */ 321, /* GL_CURRENT_PALETTE_MATRIX_ARB */ - 839, /* GL_MATRIX_INDEX_ARRAY_ARB */ + 841, /* GL_MATRIX_INDEX_ARRAY_ARB */ 316, /* GL_CURRENT_MATRIX_INDEX_ARB */ - 841, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ - 843, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ - 842, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ - 840, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ - 1674, /* GL_TEXTURE_DEPTH_SIZE */ + 843, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ + 845, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ + 844, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ + 842, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ + 1678, /* GL_TEXTURE_DEPTH_SIZE */ 377, /* GL_DEPTH_TEXTURE_MODE */ - 1639, /* GL_TEXTURE_COMPARE_MODE */ - 1637, /* GL_TEXTURE_COMPARE_FUNC */ + 1643, /* GL_TEXTURE_COMPARE_MODE */ + 1641, /* GL_TEXTURE_COMPARE_FUNC */ 242, /* GL_COMPARE_R_TO_TEXTURE */ - 1153, /* GL_POINT_SPRITE */ + 1155, /* GL_POINT_SPRITE */ 296, /* GL_COORD_REPLACE */ - 1157, /* GL_POINT_SPRITE_R_MODE_NV */ - 1276, /* GL_QUERY_COUNTER_BITS */ + 1159, /* GL_POINT_SPRITE_R_MODE_NV */ + 1280, /* GL_QUERY_COUNTER_BITS */ 323, /* GL_CURRENT_QUERY */ - 1278, /* GL_QUERY_RESULT */ - 1280, /* GL_QUERY_RESULT_AVAILABLE */ - 928, /* GL_MAX_VERTEX_ATTRIBS */ - 1815, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ + 1282, /* GL_QUERY_RESULT */ + 1284, /* GL_QUERY_RESULT_AVAILABLE */ + 930, /* GL_MAX_VERTEX_ATTRIBS */ + 1819, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ 375, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ 374, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ - 914, /* GL_MAX_TEXTURE_COORDS */ - 916, /* GL_MAX_TEXTURE_IMAGE_UNITS */ - 1224, /* GL_PROGRAM_ERROR_STRING_ARB */ - 1226, /* GL_PROGRAM_FORMAT_ASCII_ARB */ - 1225, /* GL_PROGRAM_FORMAT_ARB */ - 1723, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ + 916, /* GL_MAX_TEXTURE_COORDS */ + 918, /* GL_MAX_TEXTURE_IMAGE_UNITS */ + 1226, /* GL_PROGRAM_ERROR_STRING_ARB */ + 1228, /* GL_PROGRAM_FORMAT_ASCII_ARB */ + 1227, /* GL_PROGRAM_FORMAT_ARB */ + 1727, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ 353, /* GL_DEPTH_BOUNDS_TEST_EXT */ 352, /* GL_DEPTH_BOUNDS_EXT */ 53, /* GL_ARRAY_BUFFER */ 461, /* GL_ELEMENT_ARRAY_BUFFER */ 54, /* GL_ARRAY_BUFFER_BINDING */ 462, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ - 1789, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ - 1015, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ + 1793, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ + 1017, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ 149, /* GL_COLOR_ARRAY_BUFFER_BINDING */ - 624, /* GL_INDEX_ARRAY_BUFFER_BINDING */ - 1652, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ + 625, /* GL_INDEX_ARRAY_BUFFER_BINDING */ + 1656, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ 457, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ - 1399, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ - 510, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ - 1842, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ - 1811, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ - 1227, /* GL_PROGRAM_INSTRUCTIONS_ARB */ - 888, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ - 1233, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - 897, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - 1245, /* GL_PROGRAM_TEMPORARIES_ARB */ - 903, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ - 1235, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ - 899, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ - 1239, /* GL_PROGRAM_PARAMETERS_ARB */ - 902, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ - 1234, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ - 898, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ - 1220, /* GL_PROGRAM_ATTRIBS_ARB */ - 883, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ - 1232, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ - 896, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ - 1218, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ - 881, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ - 1230, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - 894, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - 889, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ - 885, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ - 1248, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ - 1736, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ - 1289, /* GL_READ_ONLY */ - 1850, /* GL_WRITE_ONLY */ - 1291, /* GL_READ_WRITE */ + 1403, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ + 511, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ + 1846, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ + 1815, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ + 1229, /* GL_PROGRAM_INSTRUCTIONS_ARB */ + 890, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ + 1235, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + 899, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + 1247, /* GL_PROGRAM_TEMPORARIES_ARB */ + 905, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ + 1237, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ + 901, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ + 1241, /* GL_PROGRAM_PARAMETERS_ARB */ + 904, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ + 1236, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ + 900, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ + 1222, /* GL_PROGRAM_ATTRIBS_ARB */ + 885, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ + 1234, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ + 898, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ + 1220, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ + 883, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ + 1232, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + 896, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + 891, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ + 887, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ + 1250, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ + 1740, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ + 1293, /* GL_READ_ONLY */ + 1854, /* GL_WRITE_ONLY */ + 1295, /* GL_READ_WRITE */ 102, /* GL_BUFFER_ACCESS */ 105, /* GL_BUFFER_MAPPED */ 107, /* GL_BUFFER_MAP_POINTER */ - 1730, /* GL_TIME_ELAPSED_EXT */ - 799, /* GL_MATRIX0_ARB */ - 811, /* GL_MATRIX1_ARB */ - 823, /* GL_MATRIX2_ARB */ - 827, /* GL_MATRIX3_ARB */ - 829, /* GL_MATRIX4_ARB */ - 831, /* GL_MATRIX5_ARB */ - 833, /* GL_MATRIX6_ARB */ - 835, /* GL_MATRIX7_ARB */ - 837, /* GL_MATRIX8_ARB */ - 838, /* GL_MATRIX9_ARB */ - 801, /* GL_MATRIX10_ARB */ - 802, /* GL_MATRIX11_ARB */ - 803, /* GL_MATRIX12_ARB */ - 804, /* GL_MATRIX13_ARB */ - 805, /* GL_MATRIX14_ARB */ - 806, /* GL_MATRIX15_ARB */ - 807, /* GL_MATRIX16_ARB */ - 808, /* GL_MATRIX17_ARB */ - 809, /* GL_MATRIX18_ARB */ - 810, /* GL_MATRIX19_ARB */ - 813, /* GL_MATRIX20_ARB */ - 814, /* GL_MATRIX21_ARB */ - 815, /* GL_MATRIX22_ARB */ - 816, /* GL_MATRIX23_ARB */ - 817, /* GL_MATRIX24_ARB */ - 818, /* GL_MATRIX25_ARB */ - 819, /* GL_MATRIX26_ARB */ - 820, /* GL_MATRIX27_ARB */ - 821, /* GL_MATRIX28_ARB */ - 822, /* GL_MATRIX29_ARB */ - 825, /* GL_MATRIX30_ARB */ - 826, /* GL_MATRIX31_ARB */ - 1519, /* GL_STREAM_DRAW */ - 1521, /* GL_STREAM_READ */ - 1517, /* GL_STREAM_COPY */ - 1477, /* GL_STATIC_DRAW */ - 1479, /* GL_STATIC_READ */ - 1475, /* GL_STATIC_COPY */ + 1734, /* GL_TIME_ELAPSED_EXT */ + 801, /* GL_MATRIX0_ARB */ + 813, /* GL_MATRIX1_ARB */ + 825, /* GL_MATRIX2_ARB */ + 829, /* GL_MATRIX3_ARB */ + 831, /* GL_MATRIX4_ARB */ + 833, /* GL_MATRIX5_ARB */ + 835, /* GL_MATRIX6_ARB */ + 837, /* GL_MATRIX7_ARB */ + 839, /* GL_MATRIX8_ARB */ + 840, /* GL_MATRIX9_ARB */ + 803, /* GL_MATRIX10_ARB */ + 804, /* GL_MATRIX11_ARB */ + 805, /* GL_MATRIX12_ARB */ + 806, /* GL_MATRIX13_ARB */ + 807, /* GL_MATRIX14_ARB */ + 808, /* GL_MATRIX15_ARB */ + 809, /* GL_MATRIX16_ARB */ + 810, /* GL_MATRIX17_ARB */ + 811, /* GL_MATRIX18_ARB */ + 812, /* GL_MATRIX19_ARB */ + 815, /* GL_MATRIX20_ARB */ + 816, /* GL_MATRIX21_ARB */ + 817, /* GL_MATRIX22_ARB */ + 818, /* GL_MATRIX23_ARB */ + 819, /* GL_MATRIX24_ARB */ + 820, /* GL_MATRIX25_ARB */ + 821, /* GL_MATRIX26_ARB */ + 822, /* GL_MATRIX27_ARB */ + 823, /* GL_MATRIX28_ARB */ + 824, /* GL_MATRIX29_ARB */ + 827, /* GL_MATRIX30_ARB */ + 828, /* GL_MATRIX31_ARB */ + 1523, /* GL_STREAM_DRAW */ + 1525, /* GL_STREAM_READ */ + 1521, /* GL_STREAM_COPY */ + 1481, /* GL_STATIC_DRAW */ + 1483, /* GL_STATIC_READ */ + 1479, /* GL_STATIC_COPY */ 451, /* GL_DYNAMIC_DRAW */ 453, /* GL_DYNAMIC_READ */ 449, /* GL_DYNAMIC_COPY */ - 1121, /* GL_PIXEL_PACK_BUFFER */ - 1125, /* GL_PIXEL_UNPACK_BUFFER */ - 1122, /* GL_PIXEL_PACK_BUFFER_BINDING */ - 1126, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ + 1123, /* GL_PIXEL_PACK_BUFFER */ + 1127, /* GL_PIXEL_UNPACK_BUFFER */ + 1124, /* GL_PIXEL_PACK_BUFFER_BINDING */ + 1128, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ 347, /* GL_DEPTH24_STENCIL8 */ - 1720, /* GL_TEXTURE_STENCIL_SIZE */ - 1672, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */ - 884, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ - 887, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ - 891, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ - 890, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ - 848, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ - 1510, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ + 1724, /* GL_TEXTURE_STENCIL_SIZE */ + 1676, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */ + 886, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ + 889, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ + 893, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ + 892, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ + 850, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ + 1514, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ 17, /* GL_ACTIVE_STENCIL_FACE_EXT */ - 949, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ - 1380, /* GL_SAMPLES_PASSED */ + 951, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ + 1384, /* GL_SAMPLES_PASSED */ 109, /* GL_BUFFER_SERIALIZED_MODIFY_APPLE */ 104, /* GL_BUFFER_FLUSHING_UNMAP_APPLE */ - 533, /* GL_FRAGMENT_SHADER */ - 1835, /* GL_VERTEX_SHADER */ - 1238, /* GL_PROGRAM_OBJECT_ARB */ - 1412, /* GL_SHADER_OBJECT_ARB */ - 872, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ - 932, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ - 926, /* GL_MAX_VARYING_FLOATS */ - 930, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ - 857, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ - 1041, /* GL_OBJECT_TYPE_ARB */ - 1414, /* GL_SHADER_TYPE */ - 498, /* GL_FLOAT_VEC2 */ - 500, /* GL_FLOAT_VEC3 */ - 502, /* GL_FLOAT_VEC4 */ - 651, /* GL_INT_VEC2 */ - 653, /* GL_INT_VEC3 */ - 655, /* GL_INT_VEC4 */ + 534, /* GL_FRAGMENT_SHADER */ + 1839, /* GL_VERTEX_SHADER */ + 1240, /* GL_PROGRAM_OBJECT_ARB */ + 1416, /* GL_SHADER_OBJECT_ARB */ + 874, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ + 934, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ + 928, /* GL_MAX_VARYING_FLOATS */ + 932, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ + 859, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ + 1043, /* GL_OBJECT_TYPE_ARB */ + 1418, /* GL_SHADER_TYPE */ + 499, /* GL_FLOAT_VEC2 */ + 501, /* GL_FLOAT_VEC3 */ + 503, /* GL_FLOAT_VEC4 */ + 652, /* GL_INT_VEC2 */ + 654, /* GL_INT_VEC3 */ + 656, /* GL_INT_VEC4 */ 94, /* GL_BOOL */ 96, /* GL_BOOL_VEC2 */ 98, /* GL_BOOL_VEC3 */ 100, /* GL_BOOL_VEC4 */ - 486, /* GL_FLOAT_MAT2 */ - 490, /* GL_FLOAT_MAT3 */ - 494, /* GL_FLOAT_MAT4 */ - 1371, /* GL_SAMPLER_1D */ - 1373, /* GL_SAMPLER_2D */ - 1375, /* GL_SAMPLER_3D */ - 1376, /* GL_SAMPLER_CUBE */ - 1372, /* GL_SAMPLER_1D_SHADOW */ - 1374, /* GL_SAMPLER_2D_SHADOW */ - 488, /* GL_FLOAT_MAT2x3 */ - 489, /* GL_FLOAT_MAT2x4 */ - 492, /* GL_FLOAT_MAT3x2 */ - 493, /* GL_FLOAT_MAT3x4 */ - 496, /* GL_FLOAT_MAT4x2 */ - 497, /* GL_FLOAT_MAT4x3 */ + 487, /* GL_FLOAT_MAT2 */ + 491, /* GL_FLOAT_MAT3 */ + 495, /* GL_FLOAT_MAT4 */ + 1375, /* GL_SAMPLER_1D */ + 1377, /* GL_SAMPLER_2D */ + 1379, /* GL_SAMPLER_3D */ + 1380, /* GL_SAMPLER_CUBE */ + 1376, /* GL_SAMPLER_1D_SHADOW */ + 1378, /* GL_SAMPLER_2D_SHADOW */ + 489, /* GL_FLOAT_MAT2x3 */ + 490, /* GL_FLOAT_MAT2x4 */ + 493, /* GL_FLOAT_MAT3x2 */ + 494, /* GL_FLOAT_MAT3x4 */ + 497, /* GL_FLOAT_MAT4x2 */ + 498, /* GL_FLOAT_MAT4x3 */ 345, /* GL_DELETE_STATUS */ 246, /* GL_COMPILE_STATUS */ - 706, /* GL_LINK_STATUS */ - 1783, /* GL_VALIDATE_STATUS */ - 636, /* GL_INFO_LOG_LENGTH */ + 708, /* GL_LINK_STATUS */ + 1787, /* GL_VALIDATE_STATUS */ + 637, /* GL_INFO_LOG_LENGTH */ 56, /* GL_ATTACHED_SHADERS */ 20, /* GL_ACTIVE_UNIFORMS */ 21, /* GL_ACTIVE_UNIFORM_MAX_LENGTH */ - 1413, /* GL_SHADER_SOURCE_LENGTH */ + 1417, /* GL_SHADER_SOURCE_LENGTH */ 15, /* GL_ACTIVE_ATTRIBUTES */ 16, /* GL_ACTIVE_ATTRIBUTE_MAX_LENGTH */ - 535, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ - 1416, /* GL_SHADING_LANGUAGE_VERSION */ + 536, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ + 1420, /* GL_SHADING_LANGUAGE_VERSION */ 322, /* GL_CURRENT_PROGRAM */ - 1090, /* GL_PALETTE4_RGB8_OES */ - 1092, /* GL_PALETTE4_RGBA8_OES */ - 1088, /* GL_PALETTE4_R5_G6_B5_OES */ - 1091, /* GL_PALETTE4_RGBA4_OES */ - 1089, /* GL_PALETTE4_RGB5_A1_OES */ - 1095, /* GL_PALETTE8_RGB8_OES */ - 1097, /* GL_PALETTE8_RGBA8_OES */ - 1093, /* GL_PALETTE8_R5_G6_B5_OES */ - 1096, /* GL_PALETTE8_RGBA4_OES */ - 1094, /* GL_PALETTE8_RGB5_A1_OES */ - 618, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ - 617, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ - 1768, /* GL_UNSIGNED_NORMALIZED */ - 1607, /* GL_TEXTURE_1D_ARRAY_EXT */ - 1259, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ - 1609, /* GL_TEXTURE_2D_ARRAY_EXT */ - 1262, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ - 1615, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ - 1617, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ - 1469, /* GL_SRGB */ - 1470, /* GL_SRGB8 */ - 1472, /* GL_SRGB_ALPHA */ - 1471, /* GL_SRGB8_ALPHA8 */ - 1429, /* GL_SLUMINANCE_ALPHA */ - 1428, /* GL_SLUMINANCE8_ALPHA8 */ - 1426, /* GL_SLUMINANCE */ - 1427, /* GL_SLUMINANCE8 */ + 1092, /* GL_PALETTE4_RGB8_OES */ + 1094, /* GL_PALETTE4_RGBA8_OES */ + 1090, /* GL_PALETTE4_R5_G6_B5_OES */ + 1093, /* GL_PALETTE4_RGBA4_OES */ + 1091, /* GL_PALETTE4_RGB5_A1_OES */ + 1097, /* GL_PALETTE8_RGB8_OES */ + 1099, /* GL_PALETTE8_RGBA8_OES */ + 1095, /* GL_PALETTE8_R5_G6_B5_OES */ + 1098, /* GL_PALETTE8_RGBA4_OES */ + 1096, /* GL_PALETTE8_RGB5_A1_OES */ + 619, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ + 618, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ + 1772, /* GL_UNSIGNED_NORMALIZED */ + 1611, /* GL_TEXTURE_1D_ARRAY_EXT */ + 1262, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ + 1613, /* GL_TEXTURE_2D_ARRAY_EXT */ + 1265, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ + 1619, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ + 1621, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ + 1473, /* GL_SRGB */ + 1474, /* GL_SRGB8 */ + 1476, /* GL_SRGB_ALPHA */ + 1475, /* GL_SRGB8_ALPHA8 */ + 1433, /* GL_SLUMINANCE_ALPHA */ + 1432, /* GL_SLUMINANCE8_ALPHA8 */ + 1430, /* GL_SLUMINANCE */ + 1431, /* GL_SLUMINANCE8 */ 267, /* GL_COMPRESSED_SRGB */ 268, /* GL_COMPRESSED_SRGB_ALPHA */ 265, /* GL_COMPRESSED_SLUMINANCE */ 266, /* GL_COMPRESSED_SLUMINANCE_ALPHA */ - 1155, /* GL_POINT_SPRITE_COORD_ORIGIN */ - 714, /* GL_LOWER_LEFT */ - 1780, /* GL_UPPER_LEFT */ - 1492, /* GL_STENCIL_BACK_REF */ - 1493, /* GL_STENCIL_BACK_VALUE_MASK */ - 1494, /* GL_STENCIL_BACK_WRITEMASK */ + 1157, /* GL_POINT_SPRITE_COORD_ORIGIN */ + 716, /* GL_LOWER_LEFT */ + 1784, /* GL_UPPER_LEFT */ + 1496, /* GL_STENCIL_BACK_REF */ + 1497, /* GL_STENCIL_BACK_VALUE_MASK */ + 1498, /* GL_STENCIL_BACK_WRITEMASK */ 442, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */ - 1305, /* GL_RENDERBUFFER_BINDING_EXT */ - 1286, /* GL_READ_FRAMEBUFFER */ + 1309, /* GL_RENDERBUFFER_BINDING_EXT */ + 1290, /* GL_READ_FRAMEBUFFER */ 441, /* GL_DRAW_FRAMEBUFFER */ - 1287, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ - 1315, /* GL_RENDERBUFFER_SAMPLES */ - 545, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ - 543, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ - 554, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ - 550, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ - 552, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ - 557, /* GL_FRAMEBUFFER_COMPLETE */ - 561, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ - 567, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ - 565, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ - 563, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ - 566, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ - 564, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ - 570, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ - 573, /* GL_FRAMEBUFFER_UNSUPPORTED */ - 571, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ - 854, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ + 1291, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ + 1319, /* GL_RENDERBUFFER_SAMPLES */ + 546, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ + 544, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ + 555, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ + 551, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ + 553, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ + 558, /* GL_FRAMEBUFFER_COMPLETE */ + 562, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ + 568, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ + 566, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ + 564, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ + 567, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ + 565, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ + 571, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ + 574, /* GL_FRAMEBUFFER_UNSUPPORTED */ + 572, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ + 856, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ 155, /* GL_COLOR_ATTACHMENT0 */ 157, /* GL_COLOR_ATTACHMENT1 */ 171, /* GL_COLOR_ATTACHMENT2 */ @@ -5057,56 +5065,56 @@ static const unsigned reduced_enums[1347] = 166, /* GL_COLOR_ATTACHMENT14 */ 168, /* GL_COLOR_ATTACHMENT15 */ 348, /* GL_DEPTH_ATTACHMENT */ - 1482, /* GL_STENCIL_ATTACHMENT */ - 536, /* GL_FRAMEBUFFER */ - 1303, /* GL_RENDERBUFFER */ - 1317, /* GL_RENDERBUFFER_WIDTH */ - 1310, /* GL_RENDERBUFFER_HEIGHT */ - 1312, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ - 1505, /* GL_STENCIL_INDEX_EXT */ - 1502, /* GL_STENCIL_INDEX1_EXT */ - 1503, /* GL_STENCIL_INDEX4_EXT */ - 1504, /* GL_STENCIL_INDEX8_EXT */ - 1501, /* GL_STENCIL_INDEX16_EXT */ - 1314, /* GL_RENDERBUFFER_RED_SIZE */ - 1309, /* GL_RENDERBUFFER_GREEN_SIZE */ - 1306, /* GL_RENDERBUFFER_BLUE_SIZE */ - 1304, /* GL_RENDERBUFFER_ALPHA_SIZE */ - 1307, /* GL_RENDERBUFFER_DEPTH_SIZE */ - 1316, /* GL_RENDERBUFFER_STENCIL_SIZE */ - 569, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ - 910, /* GL_MAX_SAMPLES */ - 1273, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */ - 483, /* GL_FIRST_VERTEX_CONVENTION_EXT */ - 666, /* GL_LAST_VERTEX_CONVENTION_EXT */ - 1252, /* GL_PROVOKING_VERTEX_EXT */ + 1486, /* GL_STENCIL_ATTACHMENT */ + 537, /* GL_FRAMEBUFFER */ + 1307, /* GL_RENDERBUFFER */ + 1321, /* GL_RENDERBUFFER_WIDTH */ + 1314, /* GL_RENDERBUFFER_HEIGHT */ + 1316, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ + 1509, /* GL_STENCIL_INDEX_EXT */ + 1506, /* GL_STENCIL_INDEX1_EXT */ + 1507, /* GL_STENCIL_INDEX4_EXT */ + 1508, /* GL_STENCIL_INDEX8_EXT */ + 1505, /* GL_STENCIL_INDEX16_EXT */ + 1318, /* GL_RENDERBUFFER_RED_SIZE */ + 1313, /* GL_RENDERBUFFER_GREEN_SIZE */ + 1310, /* GL_RENDERBUFFER_BLUE_SIZE */ + 1308, /* GL_RENDERBUFFER_ALPHA_SIZE */ + 1311, /* GL_RENDERBUFFER_DEPTH_SIZE */ + 1320, /* GL_RENDERBUFFER_STENCIL_SIZE */ + 570, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ + 912, /* GL_MAX_SAMPLES */ + 1276, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */ + 483, /* GL_FIRST_VERTEX_CONVENTION */ + 667, /* GL_LAST_VERTEX_CONVENTION */ + 1254, /* GL_PROVOKING_VERTEX */ 302, /* GL_COPY_READ_BUFFER */ 303, /* GL_COPY_WRITE_BUFFER */ - 1364, /* GL_RGBA_SNORM */ - 1360, /* GL_RGBA8_SNORM */ - 1422, /* GL_SIGNED_NORMALIZED */ - 911, /* GL_MAX_SERVER_WAIT_TIMEOUT */ - 1040, /* GL_OBJECT_TYPE */ - 1526, /* GL_SYNC_CONDITION */ - 1531, /* GL_SYNC_STATUS */ - 1528, /* GL_SYNC_FLAGS */ - 1527, /* GL_SYNC_FENCE */ - 1530, /* GL_SYNC_GPU_COMMANDS_COMPLETE */ - 1757, /* GL_UNSIGNALED */ - 1421, /* GL_SIGNALED */ + 1368, /* GL_RGBA_SNORM */ + 1364, /* GL_RGBA8_SNORM */ + 1426, /* GL_SIGNED_NORMALIZED */ + 913, /* GL_MAX_SERVER_WAIT_TIMEOUT */ + 1042, /* GL_OBJECT_TYPE */ + 1530, /* GL_SYNC_CONDITION */ + 1535, /* GL_SYNC_STATUS */ + 1532, /* GL_SYNC_FLAGS */ + 1531, /* GL_SYNC_FENCE */ + 1534, /* GL_SYNC_GPU_COMMANDS_COMPLETE */ + 1761, /* GL_UNSIGNALED */ + 1425, /* GL_SIGNALED */ 46, /* GL_ALREADY_SIGNALED */ - 1728, /* GL_TIMEOUT_EXPIRED */ + 1732, /* GL_TIMEOUT_EXPIRED */ 270, /* GL_CONDITION_SATISFIED */ - 1840, /* GL_WAIT_FAILED */ + 1844, /* GL_WAIT_FAILED */ 468, /* GL_EVAL_BIT */ - 1284, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ - 708, /* GL_LIST_BIT */ - 1623, /* GL_TEXTURE_BIT */ - 1395, /* GL_SCISSOR_BIT */ + 1288, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ + 710, /* GL_LIST_BIT */ + 1627, /* GL_TEXTURE_BIT */ + 1399, /* GL_SCISSOR_BIT */ 29, /* GL_ALL_ATTRIB_BITS */ - 996, /* GL_MULTISAMPLE_BIT */ + 998, /* GL_MULTISAMPLE_BIT */ 30, /* GL_ALL_CLIENT_ATTRIB_BITS */ - 1729, /* GL_TIMEOUT_IGNORED */ + 1733, /* GL_TIMEOUT_IGNORED */ }; typedef int (*cfunc)(const void *, const void *); diff --git a/src/mesa/sparc/glapi_sparc.S b/src/mesa/sparc/glapi_sparc.S index 50a2037034..aaa17e6a3b 100644 --- a/src/mesa/sparc/glapi_sparc.S +++ b/src/mesa/sparc/glapi_sparc.S @@ -1362,6 +1362,7 @@ gl_dispatch_functions_start: GL_STUB_ALIAS(glIsRenderbuffer, glIsRenderbufferEXT) GL_STUB_ALIAS(glRenderbufferStorage, glRenderbufferStorageEXT) GL_STUB_ALIAS(glFramebufferTextureLayer, glFramebufferTextureLayerEXT) + GL_STUB_ALIAS(glProvokingVertex, glProvokingVertexEXT) .globl gl_dispatch_functions_end HIDDEN(gl_dispatch_functions_end) diff --git a/src/mesa/x86-64/glapi_x86-64.S b/src/mesa/x86-64/glapi_x86-64.S index 907deb4d2f..72d0532906 100644 --- a/src/mesa/x86-64/glapi_x86-64.S +++ b/src/mesa/x86-64/glapi_x86-64.S @@ -30393,6 +30393,7 @@ GL_PREFIX(_dispatch_stub_794): .globl GL_PREFIX(RenderbufferStorage) ; .set GL_PREFIX(RenderbufferStorage), GL_PREFIX(RenderbufferStorageEXT) .globl GL_PREFIX(BlitFramebuffer) ; .set GL_PREFIX(BlitFramebuffer), GL_PREFIX(_dispatch_stub_783) .globl GL_PREFIX(FramebufferTextureLayer) ; .set GL_PREFIX(FramebufferTextureLayer), GL_PREFIX(FramebufferTextureLayerEXT) + .globl GL_PREFIX(ProvokingVertex) ; .set GL_PREFIX(ProvokingVertex), GL_PREFIX(ProvokingVertexEXT) #if defined(GLX_USE_TLS) && defined(__linux__) .section ".note.ABI-tag", "a" diff --git a/src/mesa/x86/glapi_x86.S b/src/mesa/x86/glapi_x86.S index 5f12b4fb6a..12c77f434e 100644 --- a/src/mesa/x86/glapi_x86.S +++ b/src/mesa/x86/glapi_x86.S @@ -1316,6 +1316,7 @@ GLNAME(gl_dispatch_functions_start): GL_STUB_ALIAS(IsRenderbuffer, _gloffset_IsRenderbufferEXT, IsRenderbuffer@4, IsRenderbufferEXT, IsRenderbufferEXT@4) GL_STUB_ALIAS(RenderbufferStorage, _gloffset_RenderbufferStorageEXT, RenderbufferStorage@16, RenderbufferStorageEXT, RenderbufferStorageEXT@16) GL_STUB_ALIAS(FramebufferTextureLayer, _gloffset_FramebufferTextureLayerEXT, FramebufferTextureLayer@20, FramebufferTextureLayerEXT, FramebufferTextureLayerEXT@20) + GL_STUB_ALIAS(ProvokingVertex, _gloffset_ProvokingVertexEXT, ProvokingVertex@4, ProvokingVertexEXT, ProvokingVertexEXT@4) GLOBL GLNAME(gl_dispatch_functions_end) HIDDEN(GLNAME(gl_dispatch_functions_end)) -- cgit v1.2.3 From af693464466aab161fe24700a0c2865c774ccf80 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 10:58:07 -0600 Subject: intel: use new _mesa_meta_CopyTex[Sub]Image() functions --- src/mesa/drivers/dri/intel/intel_tex_copy.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 148e8c048c..ac557a9200 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -30,7 +30,8 @@ #include "main/image.h" #include "main/teximage.h" #include "main/mipmap.h" -#include "swrast/swrast.h" + +#include "drivers/common/meta.h" #include "intel_screen.h" #include "intel_context.h" @@ -215,8 +216,8 @@ intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level, return; fail: - _swrast_copy_teximage1d(ctx, target, level, internalFormat, x, y, - width, border); + _mesa_meta_CopyTexImage1D(ctx, target, level, internalFormat, x, y, + width, border); } @@ -263,8 +264,8 @@ intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level, return; fail: - _swrast_copy_teximage2d(ctx, target, level, internalFormat, x, y, - width, height, border); + _mesa_meta_CopyTexImage2D(ctx, target, level, internalFormat, x, y, + width, height, border); } @@ -288,7 +289,7 @@ intelCopyTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, if (!do_copy_texsubimage(intel_context(ctx), target, intel_texture_image(texImage), internalFormat, xoffset, 0, x, y, width, 1)) { - _swrast_copy_texsubimage1d(ctx, target, level, xoffset, x, y, width); + _mesa_meta_CopyTexSubImage1D(ctx, target, level, xoffset, x, y, width); } } @@ -314,10 +315,10 @@ intelCopyTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, internalFormat, xoffset, yoffset, x, y, width, height)) { - DBG("%s - fallback to swrast\n", __FUNCTION__); + DBG("%s - fallback to _mesa_meta_CopyTexSubImage2D\n", __FUNCTION__); - _swrast_copy_texsubimage2d(ctx, target, level, - xoffset, yoffset, x, y, width, height); + _mesa_meta_CopyTexSubImage2D(ctx, target, level, + xoffset, yoffset, x, y, width, height); } } -- cgit v1.2.3 From 6f9dbe773953b024075910b3bec11ebc96c2e8e0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 10:55:09 -0600 Subject: mesa: use new _mesa_meta_CopyTex[Sub]Image() functions --- src/mesa/drivers/common/driverfuncs.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index a9f3c8e727..e72fcd3d9a 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -56,6 +56,7 @@ #include "swrast/swrast.h" #include "driverfuncs.h" +#include "meta.h" @@ -100,11 +101,11 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->TexSubImage2D = _mesa_store_texsubimage2d; driver->TexSubImage3D = _mesa_store_texsubimage3d; driver->GetTexImage = _mesa_get_teximage; - driver->CopyTexImage1D = _swrast_copy_teximage1d; - driver->CopyTexImage2D = _swrast_copy_teximage2d; - driver->CopyTexSubImage1D = _swrast_copy_texsubimage1d; - driver->CopyTexSubImage2D = _swrast_copy_texsubimage2d; - driver->CopyTexSubImage3D = _swrast_copy_texsubimage3d; + driver->CopyTexImage1D = _mesa_meta_CopyTexImage1D; + driver->CopyTexImage2D = _mesa_meta_CopyTexImage2D; + driver->CopyTexSubImage1D = _mesa_meta_CopyTexSubImage1D; + driver->CopyTexSubImage2D = _mesa_meta_CopyTexSubImage2D; + driver->CopyTexSubImage3D = _mesa_meta_CopyTexSubImage3D; driver->GenerateMipmap = _mesa_generate_mipmap; driver->TestProxyTexImage = _mesa_test_proxy_teximage; driver->CompressedTexImage1D = _mesa_store_compressed_teximage1d; -- cgit v1.2.3 From e2e0735e0e3d8ffe560ae9a9176c9aaf0a7e27a5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 11:01:07 -0600 Subject: gldirect: remove refs to soon-to-be-obsolete functions I don't know if this driver is anywhere near build-able, but anyway. --- .../windows/gldirect/mesasw/gld_wgl_mesasw.c | 26 ++-------------------- 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c b/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c index 342a742867..7ac425a109 100644 --- a/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c +++ b/src/mesa/drivers/windows/gldirect/mesasw/gld_wgl_mesasw.c @@ -1346,6 +1346,8 @@ static void wmesa_update_state_first_time( struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference( ctx ); TNLcontext *tnl = TNL_CONTEXT(ctx); + _mesa_init_driver_functions(&ctx->Driver); + /* * XXX these function pointers could be initialized just once during * context creation since they don't depend on any state changes. @@ -1362,8 +1364,6 @@ static void wmesa_update_state_first_time( ctx->Driver.Viewport = wmesa_viewport; - ctx->Driver.Accum = _swrast_Accum; - ctx->Driver.Bitmap = _swrast_Bitmap; ctx->Driver.Clear = clear; ctx->Driver.Flush = flush; @@ -1371,28 +1371,6 @@ static void wmesa_update_state_first_time( ctx->Driver.ClearColor = clear_color; ctx->Driver.Enable = enable; - ctx->Driver.CopyPixels = _swrast_CopyPixels; - ctx->Driver.DrawPixels = _swrast_DrawPixels; - ctx->Driver.ReadPixels = _swrast_ReadPixels; - - ctx->Driver.ChooseTextureFormat = _mesa_choose_tex_format; - ctx->Driver.TexImage1D = _mesa_store_teximage1d; - ctx->Driver.TexImage2D = _mesa_store_teximage2d; - ctx->Driver.TexImage3D = _mesa_store_teximage3d; - ctx->Driver.TexSubImage1D = _mesa_store_texsubimage1d; - ctx->Driver.TexSubImage2D = _mesa_store_texsubimage2d; - ctx->Driver.TexSubImage3D = _mesa_store_texsubimage3d; - ctx->Driver.TestProxyTexImage = _mesa_test_proxy_teximage; - - ctx->Driver.CopyTexImage1D = _swrast_copy_teximage1d; - ctx->Driver.CopyTexImage2D = _swrast_copy_teximage2d; - ctx->Driver.CopyTexSubImage1D = _swrast_copy_texsubimage1d; - ctx->Driver.CopyTexSubImage2D = _swrast_copy_texsubimage2d; - ctx->Driver.CopyTexSubImage3D = _swrast_copy_texsubimage3d; - ctx->Driver.CopyColorTable = _swrast_CopyColorTable; - ctx->Driver.CopyColorSubTable = _swrast_CopyColorSubTable; - ctx->Driver.CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; - ctx->Driver.CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; // Does not apply for Mesa 5.x //ctx->Driver.BaseCompressedTexFormat = _mesa_base_compressed_texformat; -- cgit v1.2.3 From 41a171b7148abbc5b3aeec61b8d6e5f38a146541 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 11:03:33 -0600 Subject: windows: replace old TexCopy functions w/ new --- src/mesa/drivers/windows/gdi/mesa.def | 10 +++++----- src/mesa/drivers/windows/icd/mesa.def | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/windows/gdi/mesa.def b/src/mesa/drivers/windows/gdi/mesa.def index bd3e5b2137..c588c5703c 100644 --- a/src/mesa/drivers/windows/gdi/mesa.def +++ b/src/mesa/drivers/windows/gdi/mesa.def @@ -943,6 +943,11 @@ EXPORTS _mesa_update_framebuffer_visual _mesa_use_program _mesa_Viewport + _mesa_meta_CopyTexImage1D + _mesa_meta_CopyTexImage2D + _mesa_meta_CopyTexSubImage1D + _mesa_meta_CopyTexSubImage2D + _mesa_meta_CopyTexSubImage3D _mesa_wait_query _swrast_Accum _swrast_Bitmap @@ -957,11 +962,6 @@ EXPORTS _swrast_CopyColorTable _swrast_CopyConvolutionFilter1D _swrast_CopyConvolutionFilter2D - _swrast_copy_teximage1d - _swrast_copy_teximage2d - _swrast_copy_texsubimage1d - _swrast_copy_texsubimage2d - _swrast_copy_texsubimage3d _swrast_CreateContext _swrast_DestroyContext _swrast_exec_fragment_program diff --git a/src/mesa/drivers/windows/icd/mesa.def b/src/mesa/drivers/windows/icd/mesa.def index 465b380a0c..000dc9d983 100644 --- a/src/mesa/drivers/windows/icd/mesa.def +++ b/src/mesa/drivers/windows/icd/mesa.def @@ -75,6 +75,11 @@ EXPORTS _mesa_strcmp _mesa_test_proxy_teximage _mesa_Viewport + _mesa_meta_CopyTexImage1D + _mesa_meta_CopyTexImage2D + _mesa_meta_CopyTexSubImage1D + _mesa_meta_CopyTexSubImage2D + _mesa_meta_CopyTexSubImage3D _swrast_Accum _swrast_Bitmap _swrast_CopyPixels @@ -88,11 +93,6 @@ EXPORTS _swrast_CopyColorTable _swrast_CopyConvolutionFilter1D _swrast_CopyConvolutionFilter2D - _swrast_copy_teximage1d - _swrast_copy_teximage2d - _swrast_copy_texsubimage1d - _swrast_copy_texsubimage2d - _swrast_copy_texsubimage3d _swrast_CreateContext _swrast_DestroyContext _swrast_InvalidateState -- cgit v1.2.3 From a9c64daf02b7a7715abc3912e2f7db4ab481ce79 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 11:05:54 -0600 Subject: glapi: replace old TexCopy functions w/ new --- src/mesa/glapi/mesadef.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/glapi/mesadef.py b/src/mesa/glapi/mesadef.py index 0f410fc482..92d956761b 100644 --- a/src/mesa/glapi/mesadef.py +++ b/src/mesa/glapi/mesadef.py @@ -155,6 +155,11 @@ def PrintTail(): print '\t_mesa_strcmp' print '\t_mesa_test_proxy_teximage' print '\t_mesa_Viewport' + print '\t_mesa_meta_CopyTexImage1D' + print '\t_mesa_meta_CopyTexImage2D' + print '\t_mesa_meta_CopyTexSubImage1D' + print '\t_mesa_meta_CopyTexSubImage2D' + print '\t_mesa_meta_CopyTexSubImage3D' print '\t_swrast_Accum' print '\t_swrast_alloc_buffers' print '\t_swrast_Bitmap' @@ -168,11 +173,6 @@ def PrintTail(): print '\t_swrast_CopyColorTable' print '\t_swrast_CopyConvolutionFilter1D' print '\t_swrast_CopyConvolutionFilter2D' - print '\t_swrast_copy_teximage1d' - print '\t_swrast_copy_teximage2d' - print '\t_swrast_copy_texsubimage1d' - print '\t_swrast_copy_texsubimage2d' - print '\t_swrast_copy_texsubimage3d' print '\t_swrast_CreateContext' print '\t_swrast_DestroyContext' print '\t_swrast_InvalidateState' -- cgit v1.2.3 From 14869c09847f7d2f638acb13064fb1bb8bce620c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 11:08:20 -0600 Subject: mesa: remove s_texstore.c from makefile/project files --- src/mesa/sources.mak | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index fa2a6307a4..0ae1a11cae 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -125,7 +125,6 @@ SWRAST_SOURCES = \ swrast/s_stencil.c \ swrast/s_texcombine.c \ swrast/s_texfilter.c \ - swrast/s_texstore.c \ swrast/s_triangle.c \ swrast/s_zoom.c -- cgit v1.2.3 From 2f89044e6f2ed92ec4ea7a4f98efcac8c1ce3aab Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 11:08:49 -0600 Subject: swrast: remove prototypes for obsolete functions --- src/mesa/swrast/swrast.h | 33 --------------------------------- 1 file changed, 33 deletions(-) (limited to 'src') diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h index c319ca62f9..3a352a2f4d 100644 --- a/src/mesa/swrast/swrast.h +++ b/src/mesa/swrast/swrast.h @@ -229,39 +229,6 @@ _swrast_CopyColorTable( GLcontext *ctx, GLint x, GLint y, GLsizei width); -/* - * Texture fallbacks. Could also live in a new module - * with the rest of the texture store fallbacks? - */ -extern void -_swrast_copy_teximage1d(GLcontext *ctx, GLenum target, GLint level, - GLenum internalFormat, - GLint x, GLint y, GLsizei width, GLint border); - -extern void -_swrast_copy_teximage2d(GLcontext *ctx, GLenum target, GLint level, - GLenum internalFormat, - GLint x, GLint y, GLsizei width, GLsizei height, - GLint border); - - -extern void -_swrast_copy_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, - GLint xoffset, GLint x, GLint y, GLsizei width); - -extern void -_swrast_copy_texsubimage2d(GLcontext *ctx, - GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLint x, GLint y, GLsizei width, GLsizei height); - -extern void -_swrast_copy_texsubimage3d(GLcontext *ctx, - GLenum target, GLint level, - GLint xoffset, GLint yoffset, GLint zoffset, - GLint x, GLint y, GLsizei width, GLsizei height); - - extern void _swrast_eject_texture_images(GLcontext *ctx); -- cgit v1.2.3 From 67cad78e08f1a0770c5a7f67ecaf8145b2fdbdc4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 11:09:25 -0600 Subject: swrast: remove obsolete s_texstore.c Replaced by new, simpler meta functions. --- src/mesa/swrast/s_texstore.c | 576 ------------------------------------------- 1 file changed, 576 deletions(-) delete mode 100644 src/mesa/swrast/s_texstore.c (limited to 'src') diff --git a/src/mesa/swrast/s_texstore.c b/src/mesa/swrast/s_texstore.c deleted file mode 100644 index 4f19d19ab1..0000000000 --- a/src/mesa/swrast/s_texstore.c +++ /dev/null @@ -1,576 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.2 - * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* - * Authors: - * Brian Paul - */ - - -/* - * The functions in this file are mostly related to software texture fallbacks. - * This includes texture image transfer/packing and texel fetching. - * Hardware drivers will likely override most of this. - */ - - - -#include "main/glheader.h" -#include "main/imports.h" -#include "main/colormac.h" -#include "main/context.h" -#include "main/convolve.h" -#include "main/image.h" -#include "main/macros.h" -#include "main/mipmap.h" -#include "main/texformat.h" -#include "main/teximage.h" -#include "main/texstore.h" - -#include "s_context.h" -#include "s_depth.h" -#include "s_span.h" - - -/** - * Read an RGBA image from the frame buffer. - * This is used by glCopyTex[Sub]Image[12]D(). - * \param x window source x - * \param y window source y - * \param width image width - * \param height image height - * \param type datatype for returned GL_RGBA image - * \return pointer to image - */ -static GLvoid * -read_color_image( GLcontext *ctx, GLint x, GLint y, GLenum type, - GLsizei width, GLsizei height ) -{ - struct gl_renderbuffer *rb = ctx->ReadBuffer->_ColorReadBuffer; - const GLint pixelSize = _mesa_bytes_per_pixel(GL_RGBA, type); - const GLint stride = width * pixelSize; - GLint row; - GLubyte *image, *dst; - - image = (GLubyte *) _mesa_malloc(width * height * pixelSize); - if (!image) - return NULL; - - swrast_render_start(ctx); - - dst = image; - for (row = 0; row < height; row++) { - _swrast_read_rgba_span(ctx, rb, width, x, y + row, type, dst); - dst += stride; - } - - swrast_render_finish(ctx); - - return image; -} - - -/** - * As above, but read data from depth buffer. Returned as GLuints. - * \sa read_color_image - */ -static GLuint * -read_depth_image( GLcontext *ctx, GLint x, GLint y, - GLsizei width, GLsizei height ) -{ - struct gl_renderbuffer *rb = ctx->ReadBuffer->_DepthBuffer; - GLuint *image, *dst; - GLint i; - - image = (GLuint *) _mesa_malloc(width * height * sizeof(GLuint)); - if (!image) - return NULL; - - swrast_render_start(ctx); - - dst = image; - for (i = 0; i < height; i++) { - _swrast_read_depth_span_uint(ctx, rb, width, x, y + i, dst); - dst += width; - } - - swrast_render_finish(ctx); - - return image; -} - - -/** - * As above, but read data from depth+stencil buffers. - */ -static GLuint * -read_depth_stencil_image(GLcontext *ctx, GLint x, GLint y, - GLsizei width, GLsizei height) -{ - struct gl_renderbuffer *depthRb = ctx->ReadBuffer->_DepthBuffer; - struct gl_renderbuffer *stencilRb = ctx->ReadBuffer->_StencilBuffer; - GLuint *image, *dst; - GLint i; - - ASSERT(depthRb); - ASSERT(stencilRb); - - image = (GLuint *) _mesa_malloc(width * height * sizeof(GLuint)); - if (!image) - return NULL; - - swrast_render_start(ctx); - - /* read from depth buffer */ - dst = image; - if (depthRb->DataType == GL_UNSIGNED_INT) { - for (i = 0; i < height; i++) { - _swrast_get_row(ctx, depthRb, width, x, y + i, dst, sizeof(GLuint)); - dst += width; - } - } - else { - GLushort z16[MAX_WIDTH]; - ASSERT(depthRb->DataType == GL_UNSIGNED_SHORT); - for (i = 0; i < height; i++) { - GLint j; - _swrast_get_row(ctx, depthRb, width, x, y + i, z16, sizeof(GLushort)); - /* convert GLushorts to GLuints */ - for (j = 0; j < width; j++) { - dst[j] = z16[j]; - } - dst += width; - } - } - - /* put depth values into bits 0xffffff00 */ - if (ctx->ReadBuffer->Visual.depthBits == 24) { - GLint j; - for (j = 0; j < width * height; j++) { - image[j] <<= 8; - } - } - else if (ctx->ReadBuffer->Visual.depthBits == 16) { - GLint j; - for (j = 0; j < width * height; j++) { - image[j] = (image[j] << 16) | (image[j] & 0xff00); - } - } - else { - /* this handles arbitrary depthBits >= 12 */ - const GLint rShift = ctx->ReadBuffer->Visual.depthBits; - const GLint lShift = 32 - rShift; - GLint j; - for (j = 0; j < width * height; j++) { - GLuint z = (image[j] << lShift); - image[j] = z | (z >> rShift); - } - } - - /* read stencil values and interleave into image array */ - dst = image; - for (i = 0; i < height; i++) { - GLstencil stencil[MAX_WIDTH]; - GLint j; - ASSERT(8 * sizeof(GLstencil) == stencilRb->StencilBits); - _swrast_get_row(ctx, stencilRb, width, x, y + i, - stencil, sizeof(GLstencil)); - for (j = 0; j < width; j++) { - dst[j] = (dst[j] & 0xffffff00) | (stencil[j] & 0xff); - } - dst += width; - } - - swrast_render_finish(ctx); - - return image; -} - - -static GLboolean -is_depth_format(GLenum format) -{ - switch (format) { - case GL_DEPTH_COMPONENT: - case GL_DEPTH_COMPONENT16: - case GL_DEPTH_COMPONENT24: - case GL_DEPTH_COMPONENT32: - return GL_TRUE; - default: - return GL_FALSE; - } -} - - -static GLboolean -is_depth_stencil_format(GLenum format) -{ - switch (format) { - case GL_DEPTH_STENCIL_EXT: - case GL_DEPTH24_STENCIL8_EXT: - return GL_TRUE; - default: - return GL_FALSE; - } -} - - -/* - * Fallback for Driver.CopyTexImage1D(). - */ -void -_swrast_copy_teximage1d( GLcontext *ctx, GLenum target, GLint level, - GLenum internalFormat, - GLint x, GLint y, GLsizei width, GLint border ) -{ - struct gl_texture_unit *texUnit; - struct gl_texture_object *texObj; - struct gl_texture_image *texImage; - - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texObj = _mesa_select_tex_object(ctx, texUnit, target); - ASSERT(texObj); - texImage = _mesa_select_tex_image(ctx, texObj, target, level); - ASSERT(texImage); - - ASSERT(ctx->Driver.TexImage1D); - - if (is_depth_format(internalFormat)) { - /* read depth image from framebuffer */ - GLuint *image = read_depth_image(ctx, x, y, width, 1); - if (!image) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D"); - return; - } - /* call glTexImage1D to redefine the texture */ - ctx->Driver.TexImage1D(ctx, target, level, internalFormat, - width, border, - GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, image, - &ctx->DefaultPacking, texObj, texImage); - _mesa_free(image); - } - else if (is_depth_stencil_format(internalFormat)) { - /* read depth/stencil image from framebuffer */ - GLuint *image = read_depth_stencil_image(ctx, x, y, width, 1); - if (!image) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D"); - return; - } - /* call glTexImage1D to redefine the texture */ - ctx->Driver.TexImage1D(ctx, target, level, internalFormat, - width, border, - GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, - image, &ctx->DefaultPacking, texObj, texImage); - _mesa_free(image); - } - else { - /* read RGBA image from framebuffer */ - const GLenum format = GL_RGBA; - const GLenum type = ctx->ReadBuffer->_ColorReadBuffer->DataType; - GLvoid *image = read_color_image(ctx, x, y, type, width, 1); - if (!image) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage1D"); - return; - } - /* call glTexImage1D to redefine the texture */ - ctx->Driver.TexImage1D(ctx, target, level, internalFormat, - width, border, format, type, image, - &ctx->DefaultPacking, texObj, texImage); - _mesa_free(image); - } -} - - -/** - * Fallback for Driver.CopyTexImage2D(). - * - * We implement CopyTexImage by reading the image from the framebuffer - * then passing it to the ctx->Driver.TexImage2D() function. - * - * Device drivers should try to implement direct framebuffer->texture copies. - */ -void -_swrast_copy_teximage2d( GLcontext *ctx, GLenum target, GLint level, - GLenum internalFormat, - GLint x, GLint y, GLsizei width, GLsizei height, - GLint border ) -{ - struct gl_texture_unit *texUnit; - struct gl_texture_object *texObj; - struct gl_texture_image *texImage; - - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texObj = _mesa_select_tex_object(ctx, texUnit, target); - ASSERT(texObj); - texImage = _mesa_select_tex_image(ctx, texObj, target, level); - ASSERT(texImage); - - ASSERT(ctx->Driver.TexImage2D); - - if (is_depth_format(internalFormat)) { - /* read depth image from framebuffer */ - GLuint *image = read_depth_image(ctx, x, y, width, height); - if (!image) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D"); - return; - } - /* call glTexImage2D to redefine the texture */ - ctx->Driver.TexImage2D(ctx, target, level, internalFormat, - width, height, border, - GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, image, - &ctx->DefaultPacking, texObj, texImage); - _mesa_free(image); - } - else if (is_depth_stencil_format(internalFormat)) { - GLuint *image = read_depth_stencil_image(ctx, x, y, width, height); - if (!image) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D"); - return; - } - /* call glTexImage2D to redefine the texture */ - ctx->Driver.TexImage2D(ctx, target, level, internalFormat, - width, height, border, - GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, - image, &ctx->DefaultPacking, texObj, texImage); - _mesa_free(image); - } - else { - /* read RGBA image from framebuffer */ - const GLenum format = GL_RGBA; - const GLenum type = ctx->ReadBuffer->_ColorReadBuffer->DataType; - GLvoid *image = read_color_image(ctx, x, y, type, width, height); - if (!image) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexImage2D"); - return; - } - /* call glTexImage2D to redefine the texture */ - ctx->Driver.TexImage2D(ctx, target, level, internalFormat, - width, height, border, format, type, image, - &ctx->DefaultPacking, texObj, texImage); - _mesa_free(image); - } -} - - -/* - * Fallback for Driver.CopyTexSubImage1D(). - */ -void -_swrast_copy_texsubimage1d( GLcontext *ctx, GLenum target, GLint level, - GLint xoffset, GLint x, GLint y, GLsizei width ) -{ - struct gl_texture_unit *texUnit; - struct gl_texture_object *texObj; - struct gl_texture_image *texImage; - - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texObj = _mesa_select_tex_object(ctx, texUnit, target); - ASSERT(texObj); - texImage = _mesa_select_tex_image(ctx, texObj, target, level); - ASSERT(texImage); - - ASSERT(ctx->Driver.TexImage1D); - - if (texImage->_BaseFormat == GL_DEPTH_COMPONENT) { - /* read depth image from framebuffer */ - GLuint *image = read_depth_image(ctx, x, y, width, 1); - if (!image) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D"); - return; - } - - /* call glTexSubImage1D to redefine the texture */ - ctx->Driver.TexSubImage1D(ctx, target, level, xoffset, width, - GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, image, - &ctx->DefaultPacking, texObj, texImage); - _mesa_free(image); - } - else if (texImage->_BaseFormat == GL_DEPTH_STENCIL_EXT) { - /* read depth/stencil image from framebuffer */ - GLuint *image = read_depth_stencil_image(ctx, x, y, width, 1); - if (!image) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D"); - return; - } - /* call glTexImage1D to redefine the texture */ - ctx->Driver.TexSubImage1D(ctx, target, level, xoffset, width, - GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, - image, &ctx->DefaultPacking, texObj, texImage); - _mesa_free(image); - } - else { - /* read RGBA image from framebuffer */ - const GLenum format = GL_RGBA; - const GLenum type = ctx->ReadBuffer->_ColorReadBuffer->DataType; - GLvoid *image = read_color_image(ctx, x, y, type, width, 1); - if (!image) { - _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage1D" ); - return; - } - /* now call glTexSubImage1D to do the real work */ - ctx->Driver.TexSubImage1D(ctx, target, level, xoffset, width, - format, type, image, - &ctx->DefaultPacking, texObj, texImage); - _mesa_free(image); - } -} - - -/** - * Fallback for Driver.CopyTexSubImage2D(). - * - * Read the image from the framebuffer then hand it - * off to ctx->Driver.TexSubImage2D(). - */ -void -_swrast_copy_texsubimage2d( GLcontext *ctx, - GLenum target, GLint level, - GLint xoffset, GLint yoffset, - GLint x, GLint y, GLsizei width, GLsizei height ) -{ - struct gl_texture_unit *texUnit; - struct gl_texture_object *texObj; - struct gl_texture_image *texImage; - - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texObj = _mesa_select_tex_object(ctx, texUnit, target); - ASSERT(texObj); - texImage = _mesa_select_tex_image(ctx, texObj, target, level); - ASSERT(texImage); - - ASSERT(ctx->Driver.TexImage2D); - - if (texImage->_BaseFormat == GL_DEPTH_COMPONENT) { - /* read depth image from framebuffer */ - GLuint *image = read_depth_image(ctx, x, y, width, height); - if (!image) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D"); - return; - } - /* call glTexImage2D to redefine the texture */ - ctx->Driver.TexSubImage2D(ctx, target, level, - xoffset, yoffset, width, height, - GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, image, - &ctx->DefaultPacking, texObj, texImage); - _mesa_free(image); - } - else if (texImage->_BaseFormat == GL_DEPTH_STENCIL_EXT) { - /* read depth/stencil image from framebuffer */ - GLuint *image = read_depth_stencil_image(ctx, x, y, width, height); - if (!image) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D"); - return; - } - /* call glTexImage2D to redefine the texture */ - ctx->Driver.TexSubImage2D(ctx, target, level, - xoffset, yoffset, width, height, - GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, - image, &ctx->DefaultPacking, texObj, texImage); - _mesa_free(image); - } - else { - /* read RGBA image from framebuffer */ - const GLenum format = GL_RGBA; - const GLenum type = ctx->ReadBuffer->_ColorReadBuffer->DataType; - GLvoid *image = read_color_image(ctx, x, y, type, width, height); - if (!image) { - _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage2D" ); - return; - } - /* now call glTexSubImage2D to do the real work */ - ctx->Driver.TexSubImage2D(ctx, target, level, - xoffset, yoffset, width, height, - format, type, image, - &ctx->DefaultPacking, texObj, texImage); - _mesa_free(image); - } -} - - -/* - * Fallback for Driver.CopyTexSubImage3D(). - */ -void -_swrast_copy_texsubimage3d( GLcontext *ctx, - GLenum target, GLint level, - GLint xoffset, GLint yoffset, GLint zoffset, - GLint x, GLint y, GLsizei width, GLsizei height ) -{ - struct gl_texture_unit *texUnit; - struct gl_texture_object *texObj; - struct gl_texture_image *texImage; - - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; - texObj = _mesa_select_tex_object(ctx, texUnit, target); - ASSERT(texObj); - texImage = _mesa_select_tex_image(ctx, texObj, target, level); - ASSERT(texImage); - - ASSERT(ctx->Driver.TexImage3D); - - if (texImage->_BaseFormat == GL_DEPTH_COMPONENT) { - /* read depth image from framebuffer */ - GLuint *image = read_depth_image(ctx, x, y, width, height); - if (!image) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D"); - return; - } - /* call glTexImage3D to redefine the texture */ - ctx->Driver.TexSubImage3D(ctx, target, level, - xoffset, yoffset, zoffset, width, height, 1, - GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, image, - &ctx->DefaultPacking, texObj, texImage); - _mesa_free(image); - } - else if (texImage->_BaseFormat == GL_DEPTH_STENCIL_EXT) { - /* read depth/stencil image from framebuffer */ - GLuint *image = read_depth_stencil_image(ctx, x, y, width, height); - if (!image) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D"); - return; - } - /* call glTexImage3D to redefine the texture */ - ctx->Driver.TexSubImage3D(ctx, target, level, - xoffset, yoffset, zoffset, width, height, 1, - GL_DEPTH_STENCIL_EXT, GL_UNSIGNED_INT_24_8_EXT, - image, &ctx->DefaultPacking, texObj, texImage); - _mesa_free(image); - } - else { - /* read RGBA image from framebuffer */ - const GLenum format = GL_RGBA; - const GLenum type = ctx->ReadBuffer->_ColorReadBuffer->DataType; - GLvoid *image = read_color_image(ctx, x, y, type, width, height); - if (!image) { - _mesa_error( ctx, GL_OUT_OF_MEMORY, "glCopyTexSubImage3D" ); - return; - } - /* now call glTexSubImage3D to do the real work */ - ctx->Driver.TexSubImage3D(ctx, target, level, - xoffset, yoffset, zoffset, width, height, 1, - format, type, image, - &ctx->DefaultPacking, texObj, texImage); - _mesa_free(image); - } -} -- cgit v1.2.3 From 368fb578f86c53d888324f9bb25369216b3187b1 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Sat, 19 Sep 2009 14:46:06 -0400 Subject: r600: fix polygon offset --- src/mesa/drivers/dri/r600/r700_state.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index e91aa43118..8477c88c58 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -1130,20 +1130,25 @@ static void r700PolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units) // context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); GLfloat constant = units; + GLchar depth = 0; + + R600_STATECHANGE(context, poly); switch (ctx->Visual.depthBits) { case 16: constant *= 4.0; + depth = -16; break; case 24: constant *= 2.0; + depth = -24; break; } factor *= 12.0; - - R600_STATECHANGE(context, poly); - + SETfield(r700->PA_SU_POLY_OFFSET_DB_FMT_CNTL.u32All, depth, + POLY_OFFSET_NEG_NUM_DB_BITS_shift, POLY_OFFSET_NEG_NUM_DB_BITS_mask); + //r700->PA_SU_POLY_OFFSET_CLAMP.f32All = constant; //??? r700->PA_SU_POLY_OFFSET_FRONT_SCALE.f32All = factor; r700->PA_SU_POLY_OFFSET_FRONT_OFFSET.f32All = constant; r700->PA_SU_POLY_OFFSET_BACK_SCALE.f32All = factor; -- cgit v1.2.3 From b8477f079bd72d15b2d4e9c1453374d744da5ce7 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Sat, 19 Sep 2009 15:18:42 -0400 Subject: r600: fix point sizes registers takes radius --- src/mesa/drivers/dri/r600/r700_state.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index 8477c88c58..fc0b511684 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -845,9 +845,9 @@ static void r700PointSize(GLcontext * ctx, GLfloat size) size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize); /* format is 12.4 fixed point */ - SETfield(r700->PA_SU_POINT_SIZE.u32All, (int)(size * 16), + SETfield(r700->PA_SU_POINT_SIZE.u32All, (int)(size * 8.0), PA_SU_POINT_SIZE__HEIGHT_shift, PA_SU_POINT_SIZE__HEIGHT_mask); - SETfield(r700->PA_SU_POINT_SIZE.u32All, (int)(size * 16), + SETfield(r700->PA_SU_POINT_SIZE.u32All, (int)(size * 8.0), PA_SU_POINT_SIZE__WIDTH_shift, PA_SU_POINT_SIZE__WIDTH_mask); } @@ -862,11 +862,11 @@ static void r700PointParameter(GLcontext * ctx, GLenum pname, const GLfloat * pa /* format is 12.4 fixed point */ switch (pname) { case GL_POINT_SIZE_MIN: - SETfield(r700->PA_SU_POINT_MINMAX.u32All, (int)(ctx->Point.MinSize * 16.0), + SETfield(r700->PA_SU_POINT_MINMAX.u32All, (int)(ctx->Point.MinSize * 8.0), MIN_SIZE_shift, MIN_SIZE_mask); break; case GL_POINT_SIZE_MAX: - SETfield(r700->PA_SU_POINT_MINMAX.u32All, (int)(ctx->Point.MaxSize * 16.0), + SETfield(r700->PA_SU_POINT_MINMAX.u32All, (int)(ctx->Point.MaxSize * 8.0), MAX_SIZE_shift, MAX_SIZE_mask); break; case GL_POINT_DISTANCE_ATTENUATION: -- cgit v1.2.3 From 651cffd626a82d9bf539437ca4bdf8ea4b396fab Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 12:58:55 -0600 Subject: mesa: move _mesa_meta_init/free() calls to core Mesa --- src/mesa/drivers/dri/intel/intel_context.c | 5 ----- src/mesa/drivers/dri/radeon/radeon_common_context.c | 5 ----- src/mesa/drivers/x11/xm_api.c | 7 ------- src/mesa/main/context.c | 5 +++++ 4 files changed, 5 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 03db8b1c68..ab1cf40387 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -38,7 +38,6 @@ #include "swrast_setup/swrast_setup.h" #include "tnl/tnl.h" #include "drivers/common/driverfuncs.h" -#include "drivers/common/meta.h" #include "i830_dri.h" @@ -712,8 +711,6 @@ intelInitContext(struct intel_context *intel, _swrast_allow_pixel_fog(ctx, GL_FALSE); _swrast_allow_vertex_fog(ctx, GL_TRUE); - _mesa_meta_init(ctx); - intel->hw_stencil = mesaVis->stencilBits && mesaVis->depthBits == 24; intel->hw_stipple = 1; @@ -817,8 +814,6 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv) INTEL_FIREVERTICES(intel); - _mesa_meta_free(&intel->ctx); - meta_destroy_metaops(&intel->meta); intel->vtbl.destroy(intel); diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index 1c53c04da7..d4bea86796 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -37,7 +37,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "utils.h" #include "vblank.h" #include "drirenderbuffer.h" -#include "drivers/common/meta.h" #include "main/context.h" #include "main/framebuffer.h" #include "main/renderbuffer.h" @@ -209,8 +208,6 @@ GLboolean radeonInitContext(radeonContextPtr radeon, meta_init_metaops(ctx, &radeon->meta); - _mesa_meta_init(ctx); - /* DRI fields */ radeon->dri.context = driContextPriv; radeon->dri.screen = sPriv; @@ -306,8 +303,6 @@ void radeonDestroyContext(__DRIcontextPrivate *driContextPriv ) assert(radeon); - _mesa_meta_free(radeon->glCtx); - if (radeon == current) { radeon_firevertices(radeon); _mesa_make_current(NULL, NULL, NULL); diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 662c61ae7e..90efd86a6b 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -79,7 +79,6 @@ #include "tnl/t_context.h" #include "tnl/t_pipeline.h" #include "drivers/common/driverfuncs.h" -#include "drivers/common/meta.h" /** * Global X driver lock @@ -1648,9 +1647,6 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) xmesa_register_swrast_functions( mesaCtx ); _swsetup_Wakeup(mesaCtx); - if (TEST_META_FUNCS) - _mesa_meta_init(mesaCtx); - return c; } @@ -1665,9 +1661,6 @@ void XMesaDestroyContext( XMesaContext c ) FXdestroyContext( XMESA_BUFFER(mesaCtx->DrawBuffer) ); #endif - if (TEST_META_FUNCS) - _mesa_meta_free( mesaCtx ); - _swsetup_DestroyContext( mesaCtx ); _swrast_DestroyContext( mesaCtx ); _tnl_DestroyContext( mesaCtx ); diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index f6d4ac4595..4c69e688da 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -149,6 +149,7 @@ #include "version.h" #include "viewport.h" #include "vtxfmt.h" +#include "drivers/common/meta.h" #include "glapi/glthread.h" #include "glapi/glapioffsets.h" #include "glapi/glapitable.h" @@ -926,6 +927,8 @@ _mesa_initialize_context(GLcontext *ctx, _mesa_initialize_context_extra(ctx); #endif + _mesa_meta_init(ctx); + ctx->FirstTimeCurrent = GL_TRUE; return GL_TRUE; @@ -991,6 +994,8 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_make_current(ctx, NULL, NULL); } + _mesa_meta_free(ctx); + /* unreference WinSysDraw/Read buffers */ _mesa_reference_framebuffer(&ctx->WinSysDrawBuffer, NULL); _mesa_reference_framebuffer(&ctx->WinSysReadBuffer, NULL); -- cgit v1.2.3 From b0e9ea60840b5161634767e391c601ad0cc935b2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 13:37:28 -0600 Subject: mesa: fix some glCopyTex[Sub]Image regressions related to convolution --- src/mesa/drivers/common/meta.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index aa7c73ba36..b1465d1fba 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -38,6 +38,7 @@ #include "main/blend.h" #include "main/bufferobj.h" #include "main/buffers.h" +#include "main/convolve.h" #include "main/depth.h" #include "main/enable.h" #include "main/fbobject.h" @@ -49,6 +50,7 @@ #include "main/readpix.h" #include "main/scissor.h" #include "main/shaders.h" +#include "main/state.h" #include "main/stencil.h" #include "main/texobj.h" #include "main/texenv.h" @@ -2156,6 +2158,7 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; + GLsizei postConvWidth = width, postConvHeight = height; GLenum format, type; GLint bpp; void *buf; @@ -2191,10 +2194,31 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, format, type, &ctx->Pack, buf); _mesa_meta_end(ctx); + /* + * Prepare for new texture image size/data + */ +#if FEATURE_convolve + if (_mesa_is_color_format(internalFormat)) { + _mesa_adjust_image_for_convolution(ctx, 2, + &postConvWidth, &postConvHeight); + } +#endif + + if (texImage->Data) { + ctx->Driver.FreeTexImageData(ctx, texImage); + } + + _mesa_init_teximage_fields(ctx, target, texImage, + postConvWidth, postConvHeight, 1, + border, internalFormat); + /* * Store texture data (with pixel transfer ops) */ _mesa_meta_begin(ctx, META_PIXEL_STORE); + + _mesa_update_state(ctx); /* to update pixel transfer state */ + if (target == GL_TEXTURE_1D) { ctx->Driver.TexImage1D(ctx, target, level, internalFormat, width, border, format, type, @@ -2282,6 +2306,8 @@ copy_tex_sub_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, format, type, &ctx->Pack, buf); _mesa_meta_end(ctx); + _mesa_update_state(ctx); /* to update pixel transfer state */ + /* * Store texture data (with pixel transfer ops) */ -- cgit v1.2.3 From 3ed9dab19cfb2576f2a0fef92107f9246db7bdc1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 16:13:01 -0600 Subject: mesa: use _mesa_get_current_tex_unit() helper --- src/mesa/main/colortab.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index 5a7de5f209..fcd54bc5cc 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -31,6 +31,7 @@ #include "macros.h" #include "state.h" #include "teximage.h" +#include "texstate.h" /** @@ -278,7 +279,7 @@ _mesa_ColorTable( GLenum target, GLenum internalFormat, static const GLfloat one[4] = { 1.0, 1.0, 1.0, 1.0 }; static const GLfloat zero[4] = { 0.0, 0.0, 0.0, 0.0 }; GET_CURRENT_CONTEXT(ctx); - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); struct gl_texture_object *texObj = NULL; struct gl_color_table *table = NULL; GLboolean proxy = GL_FALSE; @@ -443,7 +444,7 @@ _mesa_ColorSubTable( GLenum target, GLsizei start, static const GLfloat one[4] = { 1.0, 1.0, 1.0, 1.0 }; static const GLfloat zero[4] = { 0.0, 0.0, 0.0, 0.0 }; GET_CURRENT_CONTEXT(ctx); - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); struct gl_texture_object *texObj = NULL; struct gl_color_table *table = NULL; const GLfloat *scale = one, *bias = zero; @@ -565,7 +566,7 @@ _mesa_GetColorTable( GLenum target, GLenum format, GLenum type, GLvoid *data ) { GET_CURRENT_CONTEXT(ctx); - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); struct gl_color_table *table = NULL; GLfloat rgba[MAX_COLOR_TABLE_SIZE][4]; ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); @@ -766,7 +767,7 @@ void GLAPIENTRY _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); struct gl_color_table *table = NULL; ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -893,7 +894,7 @@ void GLAPIENTRY _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); struct gl_color_table *table = NULL; ASSERT_OUTSIDE_BEGIN_END(ctx); -- cgit v1.2.3 From 883dd9d770f0d25fb8474dc381faa99ee38de0e6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 16:16:48 -0600 Subject: mesa: use _mesa_get_current_tex_unit() helper --- src/mesa/main/texgen.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c index e3feb024c3..b3ecfc784e 100644 --- a/src/mesa/main/texgen.c +++ b/src/mesa/main/texgen.c @@ -35,6 +35,7 @@ #include "main/enums.h" #include "main/macros.h" #include "main/texgen.h" +#include "main/texstate.h" #include "math/m_matrix.h" @@ -79,7 +80,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) return; } - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texUnit = _mesa_get_current_tex_unit(ctx); texgen = get_texgen(texUnit, coord); if (!texgen) { @@ -231,7 +232,7 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) return; } - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texUnit = _mesa_get_current_tex_unit(ctx); texgen = get_texgen(texUnit, coord); if (!texgen) { @@ -269,7 +270,7 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) return; } - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texUnit = _mesa_get_current_tex_unit(ctx); texgen = get_texgen(texUnit, coord); if (!texgen) { @@ -307,7 +308,7 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) return; } - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texUnit = _mesa_get_current_tex_unit(ctx); texgen = get_texgen(texUnit, coord); if (!texgen) { -- cgit v1.2.3 From dc3839ef3dc032627b7bb10b2c24786efc3ef5ec Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 16:27:59 -0600 Subject: mesa: move readbuffer tests --- src/mesa/main/colortab.c | 9 ++++++++- src/mesa/main/convolve.c | 8 ++++++++ src/mesa/swrast/s_imaging.c | 20 -------------------- 3 files changed, 16 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index fcd54bc5cc..5447eb18ef 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -543,7 +543,10 @@ _mesa_CopyColorTable(GLenum target, GLenum internalformat, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - /* Select buffer to read from */ + if (!ctx->ReadBuffer->_ColorReadBuffer) { + return; /* no readbuffer - OK */ + } + ctx->Driver.CopyColorTable( ctx, target, internalformat, x, y, width ); } @@ -556,6 +559,10 @@ _mesa_CopyColorSubTable(GLenum target, GLsizei start, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (!ctx->ReadBuffer->_ColorReadBuffer) { + return; /* no readbuffer - OK */ + } + ctx->Driver.CopyColorSubTable( ctx, target, start, x, y, width ); } diff --git a/src/mesa/main/convolve.c b/src/mesa/main/convolve.c index 70951112a1..bf6f6619d4 100644 --- a/src/mesa/main/convolve.c +++ b/src/mesa/main/convolve.c @@ -482,6 +482,10 @@ _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLi return; } + if (!ctx->ReadBuffer->_ColorReadBuffer) { + return; /* no readbuffer - OK */ + } + ctx->Driver.CopyConvolutionFilter1D( ctx, target, internalFormat, x, y, width); } @@ -514,6 +518,10 @@ _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLi return; } + if (!ctx->ReadBuffer->_ColorReadBuffer) { + return; /* no readbuffer - OK */ + } + ctx->Driver.CopyConvolutionFilter2D( ctx, target, internalFormat, x, y, width, height ); } diff --git a/src/mesa/swrast/s_imaging.c b/src/mesa/swrast/s_imaging.c index 3578b713f6..5a860a51ba 100644 --- a/src/mesa/swrast/s_imaging.c +++ b/src/mesa/swrast/s_imaging.c @@ -42,11 +42,6 @@ _swrast_CopyColorTable( GLcontext *ctx, GLchan data[MAX_WIDTH][4]; struct gl_buffer_object *bufferSave; - if (!ctx->ReadBuffer->_ColorReadBuffer) { - /* no readbuffer - OK */ - return; - } - if (width > MAX_WIDTH) width = MAX_WIDTH; @@ -76,11 +71,6 @@ _swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start, GLchan data[MAX_WIDTH][4]; struct gl_buffer_object *bufferSave; - if (!ctx->ReadBuffer->_ColorReadBuffer) { - /* no readbuffer - OK */ - return; - } - if (width > MAX_WIDTH) width = MAX_WIDTH; @@ -111,11 +101,6 @@ _swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, GLchan rgba[MAX_CONVOLUTION_WIDTH][4]; struct gl_buffer_object *bufferSave; - if (!ctx->ReadBuffer->_ColorReadBuffer) { - /* no readbuffer - OK */ - return; - } - swrast_render_start(ctx); /* read the data from framebuffer */ @@ -147,11 +132,6 @@ _swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, GLint i; struct gl_buffer_object *bufferSave; - if (!ctx->ReadBuffer->_ColorReadBuffer) { - /* no readbuffer - OK */ - return; - } - swrast_render_start(ctx); /* read pixels from framebuffer */ -- cgit v1.2.3 From 3e5a35269b201d25e2a63743d8d4b1b4311b6fb0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 16:32:42 -0600 Subject: mesa: meta functions for glCopyColorTable, glCopyConvolutionFilter, etc --- src/mesa/drivers/common/meta.c | 122 +++++++++++++++++++++++++++++++++++++++++ src/mesa/drivers/common/meta.h | 19 +++++++ 2 files changed, 141 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index b1465d1fba..5857feb4b5 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -38,6 +38,7 @@ #include "main/blend.h" #include "main/bufferobj.h" #include "main/buffers.h" +#include "main/colortab.h" #include "main/convolve.h" #include "main/depth.h" #include "main/enable.h" @@ -2365,3 +2366,124 @@ _mesa_meta_CopyTexSubImage3D(GLcontext *ctx, GLenum target, GLint level, copy_tex_sub_image(ctx, 3, target, level, xoffset, yoffset, zoffset, x, y, width, height); } + + +void +_mesa_meta_CopyColorTable(GLcontext *ctx, + GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width) +{ + GLfloat *buf; + + buf = (GLfloat *) _mesa_malloc(width * 4 * sizeof(GLfloat)); + if (!buf) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyColorTable"); + return; + } + + /* + * Read image from framebuffer (disable pixel transfer ops) + */ + _mesa_meta_begin(ctx, META_PIXEL_STORE | META_PIXEL_TRANSFER); + ctx->Driver.ReadPixels(ctx, x, y, width, 1, + GL_RGBA, GL_FLOAT, &ctx->Pack, buf); + + _mesa_ColorTable(target, internalformat, width, GL_RGBA, GL_FLOAT, buf); + + _mesa_meta_end(ctx); + + _mesa_free(buf); +} + + +void +_mesa_meta_CopyColorSubTable(GLcontext *ctx,GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width) +{ + GLfloat *buf; + + buf = (GLfloat *) _mesa_malloc(width * 4 * sizeof(GLfloat)); + if (!buf) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyColorSubTable"); + return; + } + + /* + * Read image from framebuffer (disable pixel transfer ops) + */ + _mesa_meta_begin(ctx, META_PIXEL_STORE | META_PIXEL_TRANSFER); + ctx->Driver.ReadPixels(ctx, x, y, width, 1, + GL_RGBA, GL_FLOAT, &ctx->Pack, buf); + + _mesa_ColorSubTable(target, start, width, GL_RGBA, GL_FLOAT, buf); + + _mesa_meta_end(ctx); + + _mesa_free(buf); +} + + +void +_mesa_meta_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, + GLenum internalFormat, + GLint x, GLint y, GLsizei width) +{ + GLfloat *buf; + + buf = (GLfloat *) _mesa_malloc(width * 4 * sizeof(GLfloat)); + if (!buf) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyConvolutionFilter2D"); + return; + } + + /* + * Read image from framebuffer (disable pixel transfer ops) + */ + _mesa_meta_begin(ctx, META_PIXEL_STORE | META_PIXEL_TRANSFER); + _mesa_update_state(ctx); + ctx->Driver.ReadPixels(ctx, x, y, width, 1, + GL_RGBA, GL_FLOAT, &ctx->Pack, buf); + + _mesa_ConvolutionFilter1D(target, internalFormat, width, + GL_RGBA, GL_FLOAT, buf); + + _mesa_meta_end(ctx); + + _mesa_free(buf); +} + + +void +_mesa_meta_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, + GLenum internalFormat, GLint x, GLint y, + GLsizei width, GLsizei height) +{ + GLfloat *buf; + + if (!ctx->ReadBuffer->_ColorReadBuffer) { + /* no readbuffer - OK */ + return; + } + + buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); + if (!buf) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyConvolutionFilter2D"); + return; + } + + /* + * Read image from framebuffer (disable pixel transfer ops) + */ + _mesa_meta_begin(ctx, META_PIXEL_STORE | META_PIXEL_TRANSFER); + _mesa_update_state(ctx); + + ctx->Driver.ReadPixels(ctx, x, y, width, height, + GL_RGBA, GL_FLOAT, &ctx->Pack, buf); + + _mesa_ConvolutionFilter2D(target, internalFormat, width, height, + GL_RGBA, GL_FLOAT, buf); + + _mesa_meta_end(ctx); + + _mesa_free(buf); +} diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index 9f7100f09c..c30671741f 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -91,5 +91,24 @@ _mesa_meta_CopyTexSubImage3D(GLcontext *ctx, GLenum target, GLint level, GLint x, GLint y, GLsizei width, GLsizei height); +extern void +_mesa_meta_CopyColorTable(GLcontext *ctx, + GLenum target, GLenum internalformat, + GLint x, GLint y, GLsizei width); + +extern void +_mesa_meta_CopyColorSubTable(GLcontext *ctx,GLenum target, GLsizei start, + GLint x, GLint y, GLsizei width); + +extern void +_mesa_meta_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, + GLenum internalFormat, + GLint x, GLint y, GLsizei width); + +extern void +_mesa_meta_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, + GLenum internalFormat, GLint x, GLint y, + GLsizei width, GLsizei height); + #endif /* META_H */ -- cgit v1.2.3 From bc1c8d4af768be12ae96bc080e7e52b0c4cbfbdb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 16:33:09 -0600 Subject: mesa: use new meta functions --- src/mesa/drivers/common/driverfuncs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index e72fcd3d9a..f09106b77c 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -130,10 +130,10 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->UpdateTexturePalette = NULL; /* imaging */ - driver->CopyColorTable = _swrast_CopyColorTable; - driver->CopyColorSubTable = _swrast_CopyColorSubTable; - driver->CopyConvolutionFilter1D = _swrast_CopyConvolutionFilter1D; - driver->CopyConvolutionFilter2D = _swrast_CopyConvolutionFilter2D; + driver->CopyColorTable = _mesa_meta_CopyColorTable; + driver->CopyColorSubTable = _mesa_meta_CopyColorSubTable; + driver->CopyConvolutionFilter1D = _mesa_meta_CopyConvolutionFilter1D; + driver->CopyConvolutionFilter2D = _mesa_meta_CopyConvolutionFilter2D; /* Vertex/fragment programs */ driver->BindProgram = NULL; -- cgit v1.2.3 From 32e4b6c6073b71cac195ca011c4a0eaad8b0851c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 16:36:15 -0600 Subject: windows: replace old ColorTable, Convolution functions with new --- src/mesa/drivers/windows/gdi/mesa.def | 8 ++++---- src/mesa/drivers/windows/icd/mesa.def | 8 ++++---- src/mesa/glapi/mesadef.py | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/windows/gdi/mesa.def b/src/mesa/drivers/windows/gdi/mesa.def index c588c5703c..5abcd1d927 100644 --- a/src/mesa/drivers/windows/gdi/mesa.def +++ b/src/mesa/drivers/windows/gdi/mesa.def @@ -943,6 +943,10 @@ EXPORTS _mesa_update_framebuffer_visual _mesa_use_program _mesa_Viewport + _mesa_meta_CopyColorSubTable + _mesa_meta_CopyColorTable + _mesa_meta_CopyConvolutionFilter1D + _mesa_meta_CopyConvolutionFilter2D _mesa_meta_CopyTexImage1D _mesa_meta_CopyTexImage2D _mesa_meta_CopyTexSubImage1D @@ -958,10 +962,6 @@ EXPORTS _swrast_Clear _swrast_choose_line _swrast_choose_triangle - _swrast_CopyColorSubTable - _swrast_CopyColorTable - _swrast_CopyConvolutionFilter1D - _swrast_CopyConvolutionFilter2D _swrast_CreateContext _swrast_DestroyContext _swrast_exec_fragment_program diff --git a/src/mesa/drivers/windows/icd/mesa.def b/src/mesa/drivers/windows/icd/mesa.def index 000dc9d983..25ac08a2f0 100644 --- a/src/mesa/drivers/windows/icd/mesa.def +++ b/src/mesa/drivers/windows/icd/mesa.def @@ -75,6 +75,10 @@ EXPORTS _mesa_strcmp _mesa_test_proxy_teximage _mesa_Viewport + _mesa_meta_CopyColorSubTable + _mesa_meta_CopyColorTable + _mesa_meta_CopyConvolutionFilter1D + _mesa_meta_CopyConvolutionFilter2D _mesa_meta_CopyTexImage1D _mesa_meta_CopyTexImage2D _mesa_meta_CopyTexSubImage1D @@ -89,10 +93,6 @@ EXPORTS _swrast_Clear _swrast_choose_line _swrast_choose_triangle - _swrast_CopyColorSubTable - _swrast_CopyColorTable - _swrast_CopyConvolutionFilter1D - _swrast_CopyConvolutionFilter2D _swrast_CreateContext _swrast_DestroyContext _swrast_InvalidateState diff --git a/src/mesa/glapi/mesadef.py b/src/mesa/glapi/mesadef.py index 92d956761b..342c9cde46 100644 --- a/src/mesa/glapi/mesadef.py +++ b/src/mesa/glapi/mesadef.py @@ -155,6 +155,10 @@ def PrintTail(): print '\t_mesa_strcmp' print '\t_mesa_test_proxy_teximage' print '\t_mesa_Viewport' + print '\t_mesa_meta_CopyColorSubTable' + print '\t_mesa_meta_CopyColorTable' + print '\t_mesa_meta_CopyConvolutionFilter1D' + print '\t_mesa_meta_CopyConvolutionFilter2D' print '\t_mesa_meta_CopyTexImage1D' print '\t_mesa_meta_CopyTexImage2D' print '\t_mesa_meta_CopyTexSubImage1D' @@ -169,10 +173,6 @@ def PrintTail(): print '\t_swrast_Clear' print '\t_swrast_choose_line' print '\t_swrast_choose_triangle' - print '\t_swrast_CopyColorSubTable' - print '\t_swrast_CopyColorTable' - print '\t_swrast_CopyConvolutionFilter1D' - print '\t_swrast_CopyConvolutionFilter2D' print '\t_swrast_CreateContext' print '\t_swrast_DestroyContext' print '\t_swrast_InvalidateState' -- cgit v1.2.3 From 58e843dda05e2addfe6584c5480fb2181b0aff53 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 16:40:09 -0600 Subject: mesa: remove s_imaging.c from build --- src/mesa/sources.mak | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index 0ae1a11cae..7107538cee 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -115,7 +115,6 @@ SWRAST_SOURCES = \ swrast/s_feedback.c \ swrast/s_fog.c \ swrast/s_fragprog.c \ - swrast/s_imaging.c \ swrast/s_lines.c \ swrast/s_logic.c \ swrast/s_masking.c \ -- cgit v1.2.3 From 7e0f2ce9410506277a9f17e2713006a2b510c319 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 16:41:37 -0600 Subject: swrast: remove prototypes for obsolete functions --- src/mesa/swrast/swrast.h | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'src') diff --git a/src/mesa/swrast/swrast.h b/src/mesa/swrast/swrast.h index 3a352a2f4d..c183b315b6 100644 --- a/src/mesa/swrast/swrast.h +++ b/src/mesa/swrast/swrast.h @@ -207,27 +207,6 @@ extern void _swrast_print_vertex( GLcontext *ctx, const SWvertex *v ); -/* - * Imaging fallbacks (a better solution should be found, perhaps - * moving all the imaging fallback code to a new module) - */ -extern void -_swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, - GLenum internalFormat, - GLint x, GLint y, GLsizei width, - GLsizei height); -extern void -_swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, - GLenum internalFormat, - GLint x, GLint y, GLsizei width); -extern void -_swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start, - GLint x, GLint y, GLsizei width); -extern void -_swrast_CopyColorTable( GLcontext *ctx, - GLenum target, GLenum internalformat, - GLint x, GLint y, GLsizei width); - extern void _swrast_eject_texture_images(GLcontext *ctx); -- cgit v1.2.3 From 232fc7d333fff6895d892929e438b7a808f774b0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 16:42:36 -0600 Subject: swrast: remove obsolete s_imaging.c file --- src/mesa/swrast/s_imaging.c | 176 -------------------------------------------- 1 file changed, 176 deletions(-) delete mode 100644 src/mesa/swrast/s_imaging.c (limited to 'src') diff --git a/src/mesa/swrast/s_imaging.c b/src/mesa/swrast/s_imaging.c deleted file mode 100644 index 5a860a51ba..0000000000 --- a/src/mesa/swrast/s_imaging.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5 - * - * Copyright (C) 1999-2005 Brian Paul All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -/* KW: Moved these here to remove knowledge of swrast from core mesa. - * Should probably pull the entire software implementation of these - * extensions into either swrast or a sister module. - */ - -#include "main/glheader.h" -#include "main/colortab.h" -#include "main/convolve.h" -#include "s_context.h" -#include "s_span.h" - - -void -_swrast_CopyColorTable( GLcontext *ctx, - GLenum target, GLenum internalformat, - GLint x, GLint y, GLsizei width) -{ - GLchan data[MAX_WIDTH][4]; - struct gl_buffer_object *bufferSave; - - if (width > MAX_WIDTH) - width = MAX_WIDTH; - - swrast_render_start(ctx); - - /* read the data from framebuffer */ - _swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer, - width, x, y, CHAN_TYPE, data ); - - swrast_render_finish(ctx); - - /* save PBO binding */ - bufferSave = ctx->Unpack.BufferObj; - ctx->Unpack.BufferObj = ctx->Shared->NullBufferObj; - - _mesa_ColorTable(target, internalformat, width, GL_RGBA, CHAN_TYPE, data); - - /* restore PBO binding */ - ctx->Unpack.BufferObj = bufferSave; -} - - -void -_swrast_CopyColorSubTable( GLcontext *ctx,GLenum target, GLsizei start, - GLint x, GLint y, GLsizei width) -{ - GLchan data[MAX_WIDTH][4]; - struct gl_buffer_object *bufferSave; - - if (width > MAX_WIDTH) - width = MAX_WIDTH; - - swrast_render_start(ctx); - - /* read the data from framebuffer */ - _swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer, - width, x, y, CHAN_TYPE, data ); - - swrast_render_finish(ctx); - - /* save PBO binding */ - bufferSave = ctx->Unpack.BufferObj; - ctx->Unpack.BufferObj = ctx->Shared->NullBufferObj; - - _mesa_ColorSubTable(target, start, width, GL_RGBA, CHAN_TYPE, data); - - /* restore PBO binding */ - ctx->Unpack.BufferObj = bufferSave; -} - - -void -_swrast_CopyConvolutionFilter1D(GLcontext *ctx, GLenum target, - GLenum internalFormat, - GLint x, GLint y, GLsizei width) -{ - GLchan rgba[MAX_CONVOLUTION_WIDTH][4]; - struct gl_buffer_object *bufferSave; - - swrast_render_start(ctx); - - /* read the data from framebuffer */ - _swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer, - width, x, y, CHAN_TYPE, rgba ); - - swrast_render_finish(ctx); - - /* save PBO binding */ - bufferSave = ctx->Unpack.BufferObj; - ctx->Unpack.BufferObj = ctx->Shared->NullBufferObj; - - /* store as convolution filter */ - _mesa_ConvolutionFilter1D(target, internalFormat, width, - GL_RGBA, CHAN_TYPE, rgba); - - /* restore PBO binding */ - ctx->Unpack.BufferObj = bufferSave; -} - - -void -_swrast_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, - GLenum internalFormat, - GLint x, GLint y, GLsizei width, GLsizei height) -{ - struct gl_pixelstore_attrib packSave; - GLchan rgba[MAX_CONVOLUTION_HEIGHT][MAX_CONVOLUTION_WIDTH][4]; - GLint i; - struct gl_buffer_object *bufferSave; - - swrast_render_start(ctx); - - /* read pixels from framebuffer */ - for (i = 0; i < height; i++) { - _swrast_read_rgba_span( ctx, ctx->ReadBuffer->_ColorReadBuffer, - width, x, y + i, CHAN_TYPE, rgba[i] ); - } - - swrast_render_finish(ctx); - - /* - * HACK: save & restore context state so we can store this as a - * convolution filter via the GL api. Doesn't call any callbacks - * hanging off ctx->Unpack statechanges. - */ - - packSave = ctx->Unpack; /* save pixel packing params */ - - ctx->Unpack.Alignment = 1; - ctx->Unpack.RowLength = MAX_CONVOLUTION_WIDTH; - ctx->Unpack.SkipPixels = 0; - ctx->Unpack.SkipRows = 0; - ctx->Unpack.ImageHeight = 0; - ctx->Unpack.SkipImages = 0; - ctx->Unpack.SwapBytes = GL_FALSE; - ctx->Unpack.LsbFirst = GL_FALSE; - ctx->Unpack.BufferObj = ctx->Shared->NullBufferObj; - ctx->NewState |= _NEW_PACKUNPACK; - - /* save PBO binding */ - bufferSave = ctx->Unpack.BufferObj; - ctx->Unpack.BufferObj = ctx->Shared->NullBufferObj; - - _mesa_ConvolutionFilter2D(target, internalFormat, width, height, - GL_RGBA, CHAN_TYPE, rgba); - - /* restore PBO binding */ - ctx->Unpack.BufferObj = bufferSave; - - ctx->Unpack = packSave; /* restore pixel packing params */ - ctx->NewState |= _NEW_PACKUNPACK; -} -- cgit v1.2.3 From 4de8e2123ebeb50db252b2bb57fb167058fa4683 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 17:06:15 -0600 Subject: mesa: rename functions to be more consistant with rest of mesa --- src/mesa/drivers/common/meta.c | 49 +++++++++++++-------------- src/mesa/drivers/common/meta.h | 32 ++++++++--------- src/mesa/drivers/dri/intel/intel_clear.c | 2 +- src/mesa/drivers/dri/intel/intel_fbo.c | 2 +- src/mesa/drivers/dri/intel/intel_pixel_copy.c | 2 +- src/mesa/drivers/dri/intel/intel_pixel_draw.c | 8 ++--- src/mesa/drivers/dri/radeon/radeon_common.c | 2 +- src/mesa/drivers/dri/radeon/radeon_fbo.c | 2 +- src/mesa/drivers/x11/xm_dd.c | 10 +++--- 9 files changed, 54 insertions(+), 55 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 5857feb4b5..be32ae6902 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -274,12 +274,12 @@ struct gl_meta_state struct temp_texture TempTex; - struct blit_state Blit; /**< For _mesa_meta_blit_framebuffer() */ - struct clear_state Clear; /**< For _mesa_meta_clear() */ - struct copypix_state CopyPix; /**< For _mesa_meta_copy_pixels() */ - struct drawpix_state DrawPix; /**< For _mesa_meta_draw_pixels() */ - struct bitmap_state Bitmap; /**< For _mesa_meta_bitmap() */ - struct gen_mipmap_state Mipmap; /**< For _mesa_meta_generate_mipmap() */ + struct blit_state Blit; /**< For _mesa_meta_BlitFramebuffer() */ + struct clear_state Clear; /**< For _mesa_meta_Clear() */ + struct copypix_state CopyPix; /**< For _mesa_meta_CopyPixels() */ + struct drawpix_state DrawPix; /**< For _mesa_meta_DrawPixels() */ + struct bitmap_state Bitmap; /**< For _mesa_meta_Bitmap() */ + struct gen_mipmap_state Mipmap; /**< For _mesa_meta_GenerateMipmap() */ }; @@ -1055,10 +1055,10 @@ init_blit_depth_pixels(GLcontext *ctx) * of texture mapping and polygon rendering. */ void -_mesa_meta_blit_framebuffer(GLcontext *ctx, - GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, - GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, - GLbitfield mask, GLenum filter) +_mesa_meta_BlitFramebuffer(GLcontext *ctx, + GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, + GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter) { struct blit_state *blit = &ctx->Meta->Blit; struct temp_texture *tex = get_temp_texture(ctx); @@ -1204,7 +1204,7 @@ _mesa_meta_blit_framebuffer(GLcontext *ctx, * Meta implementation of ctx->Driver.Clear() in terms of polygon rendering. */ void -_mesa_meta_clear(GLcontext *ctx, GLbitfield buffers) +_mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers) { struct clear_state *clear = &ctx->Meta->Clear; struct vertex { @@ -1323,9 +1323,9 @@ _mesa_meta_clear(GLcontext *ctx, GLbitfield buffers) * of texture mapping and polygon rendering. */ void -_mesa_meta_copy_pixels(GLcontext *ctx, GLint srcX, GLint srcY, - GLsizei width, GLsizei height, - GLint dstX, GLint dstY, GLenum type) +_mesa_meta_CopyPixels(GLcontext *ctx, GLint srcX, GLint srcY, + GLsizei width, GLsizei height, + GLint dstX, GLint dstY, GLenum type) { struct copypix_state *copypix = &ctx->Meta->CopyPix; struct temp_texture *tex = get_temp_texture(ctx); @@ -1462,9 +1462,8 @@ tiled_draw_pixels(GLcontext *ctx, tileUnpack.SkipRows = unpack->SkipRows + j; - _mesa_meta_draw_pixels(ctx, tileX, tileY, - tileWidth, tileHeight, - format, type, &tileUnpack, pixels); + _mesa_meta_DrawPixels(ctx, tileX, tileY, tileWidth, tileHeight, + format, type, &tileUnpack, pixels); } } } @@ -1573,11 +1572,11 @@ init_draw_depth_pixels(GLcontext *ctx) * of texture mapping and polygon rendering. */ void -_mesa_meta_draw_pixels(GLcontext *ctx, - GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *unpack, - const GLvoid *pixels) +_mesa_meta_DrawPixels(GLcontext *ctx, + GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels) { struct drawpix_state *drawpix = &ctx->Meta->DrawPix; struct temp_texture *tex = get_temp_texture(ctx); @@ -1812,7 +1811,7 @@ _mesa_meta_draw_pixels(GLcontext *ctx, * improve performance a lot. */ void -_mesa_meta_bitmap(GLcontext *ctx, +_mesa_meta_Bitmap(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap1) @@ -1953,8 +1952,8 @@ _mesa_meta_bitmap(GLcontext *ctx, void -_mesa_meta_generate_mipmap(GLcontext *ctx, GLenum target, - struct gl_texture_object *texObj) +_mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, + struct gl_texture_object *texObj) { struct gen_mipmap_state *mipmap = &ctx->Meta->Mipmap; struct vertex { diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index c30671741f..7f659528dc 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -34,35 +34,35 @@ extern void _mesa_meta_free(GLcontext *ctx); extern void -_mesa_meta_blit_framebuffer(GLcontext *ctx, - GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, - GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, - GLbitfield mask, GLenum filter); +_mesa_meta_BlitFramebuffer(GLcontext *ctx, + GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, + GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter); extern void -_mesa_meta_clear(GLcontext *ctx, GLbitfield buffers); +_mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers); extern void -_mesa_meta_copy_pixels(GLcontext *ctx, GLint srcx, GLint srcy, - GLsizei width, GLsizei height, - GLint dstx, GLint dsty, GLenum type); +_mesa_meta_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, + GLsizei width, GLsizei height, + GLint dstx, GLint dsty, GLenum type); extern void -_mesa_meta_draw_pixels(GLcontext *ctx, - GLint x, GLint y, GLsizei width, GLsizei height, - GLenum format, GLenum type, - const struct gl_pixelstore_attrib *unpack, - const GLvoid *pixels); +_mesa_meta_DrawPixels(GLcontext *ctx, + GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, + const struct gl_pixelstore_attrib *unpack, + const GLvoid *pixels); extern void -_mesa_meta_bitmap(GLcontext *ctx, +_mesa_meta_Bitmap(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap); extern void -_mesa_meta_generate_mipmap(GLcontext *ctx, GLenum target, - struct gl_texture_object *texObj); +_mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, + struct gl_texture_object *texObj); extern void _mesa_meta_CopyTexImage1D(GLcontext *ctx, GLenum target, GLint level, diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index 9efe6a277c..4ce783f450 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -171,7 +171,7 @@ intelClear(GLcontext *ctx, GLbitfield mask) DBG("\n"); } intelFlush(&intel->ctx); - _mesa_meta_clear(&intel->ctx, tri_mask); + _mesa_meta_Clear(&intel->ctx, tri_mask); } if (swrast_mask) { diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 804c034840..8dfb24290d 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -715,5 +715,5 @@ intel_fbo_init(struct intel_context *intel) intel->ctx.Driver.FinishRenderTexture = intel_finish_render_texture; intel->ctx.Driver.ResizeBuffers = intel_resize_buffers; intel->ctx.Driver.ValidateFramebuffer = intel_validate_framebuffer; - intel->ctx.Driver.BlitFramebuffer = _mesa_meta_blit_framebuffer; + intel->ctx.Driver.BlitFramebuffer = _mesa_meta_BlitFramebuffer; } diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c b/src/mesa/drivers/dri/intel/intel_pixel_copy.c index 07ca8f7ddb..f058b3c8e4 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c @@ -240,5 +240,5 @@ intelCopyPixels(GLcontext * ctx, return; /* this will use swrast if needed */ - _mesa_meta_copy_pixels(ctx, srcx, srcy, width, height, destx, desty, type); + _mesa_meta_CopyPixels(ctx, srcx, srcy, width, height, destx, desty, type); } diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c index 7fbb89fd6a..5ffa847fd4 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c @@ -54,7 +54,7 @@ #include "intel_fbo.h" -/** XXX compare perf of this vs. _mesa_meta_draw_pixels(STENCIL) */ +/** XXX compare perf of this vs. _mesa_meta_DrawPixels(STENCIL) */ static GLboolean intel_stencil_drawpixels(GLcontext * ctx, GLint x, GLint y, @@ -265,7 +265,7 @@ intelDrawPixels(GLcontext * ctx, /* XXX this function doesn't seem to work reliably even when all * the pre-requisite conditions are met. * Note that this function is never hit with conform. - * Fall back to swrast because even the _mesa_meta_draw_pixels() approach + * Fall back to swrast because even the _mesa_meta_DrawPixels() approach * isn't working because of an apparent stencil bug. */ if (intel_stencil_drawpixels(ctx, x, y, width, height, format, type, @@ -280,6 +280,6 @@ intelDrawPixels(GLcontext * ctx, } #endif - _mesa_meta_draw_pixels(ctx, x, y, width, height, format, type, - unpack, pixels); + _mesa_meta_DrawPixels(ctx, x, y, width, height, format, type, + unpack, pixels); } diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index a4c7b40798..264392b327 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -1345,5 +1345,5 @@ void rcommonBeginBatch(radeonContextPtr rmesa, int n, void radeonUserClear(GLcontext *ctx, GLuint mask) { - _mesa_meta_clear(ctx, mask); + _mesa_meta_Clear(ctx, mask); } diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index d83b166742..7ac53ec0ca 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -583,7 +583,7 @@ void radeon_fbo_init(struct radeon_context *radeon) radeon->glCtx->Driver.FinishRenderTexture = radeon_finish_render_texture; radeon->glCtx->Driver.ResizeBuffers = radeon_resize_buffers; radeon->glCtx->Driver.ValidateFramebuffer = radeon_validate_framebuffer; - radeon->glCtx->Driver.BlitFramebuffer = _mesa_meta_blit_framebuffer; + radeon->glCtx->Driver.BlitFramebuffer = _mesa_meta_BlitFramebuffer; } diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 4e9c001cc7..e2d4aa9b2d 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -1150,11 +1150,11 @@ xmesa_init_driver_functions( XMesaVisual xmvisual, driver->Enable = enable; driver->Viewport = xmesa_viewport; if (TEST_META_FUNCS) { - driver->Clear = _mesa_meta_clear; - driver->CopyPixels = _mesa_meta_copy_pixels; - driver->BlitFramebuffer = _mesa_meta_blit_framebuffer; - driver->DrawPixels = _mesa_meta_draw_pixels; - driver->Bitmap = _mesa_meta_bitmap; + driver->Clear = _mesa_meta_Clear; + driver->CopyPixels = _mesa_meta_CopyPixels; + driver->BlitFramebuffer = _mesa_meta_BlitFramebuffer; + driver->DrawPixels = _mesa_meta_DrawPixels; + driver->Bitmap = _mesa_meta_Bitmap; } else { driver->Clear = clear_buffers; -- cgit v1.2.3 From ed4076b5b8c5d3c024e291f42a8730b4f71226c9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 19 Sep 2009 17:26:14 -0600 Subject: mesa: remove redundant readbuffer check --- src/mesa/drivers/common/meta.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index be32ae6902..e9b892e33f 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2459,11 +2459,6 @@ _mesa_meta_CopyConvolutionFilter2D(GLcontext *ctx, GLenum target, { GLfloat *buf; - if (!ctx->ReadBuffer->_ColorReadBuffer) { - /* no readbuffer - OK */ - return; - } - buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); if (!buf) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCopyConvolutionFilter2D"); -- cgit v1.2.3 From 6c323a2473cbfcdf41a8b3c395fcd277e16b963c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sun, 20 Sep 2009 16:33:59 +0200 Subject: r300/compiler: Fix R300 fragment program regression introduced by 0723cd1... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We obviously need to move the code addr register backwards because their may be overlap. This bug affected in particular the Compiz water plugin. Signed-off-by: Nicolai Hähnle --- src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c index 305dc074ee..c7227bbd15 100644 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c @@ -352,7 +352,7 @@ void r300BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compi if (emit.current_node < 3) { int shift = 3 - emit.current_node; int i; - for(i = 0; i <= emit.current_node; ++i) + for(i = emit.current_node; i >= 0; --i) code->code_addr[shift + i] = code->code_addr[i]; for(i = 0; i < shift; ++i) code->code_addr[i] = 0; -- cgit v1.2.3 From c4ce6f6a7c124c62a8ee9bd9fba28fc69a38e18c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sat, 12 Sep 2009 12:13:35 +0200 Subject: mesa/st: Initialize format bits of framebuffer renderbuffers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle --- src/mesa/state_tracker/st_cb_fbo.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 21ddf2fc7a..6762ed39c3 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -256,6 +256,7 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw) strb->Base.ClassID = 0x4242; /* just a unique value */ strb->Base.NumSamples = samples; strb->format = format; + init_renderbuffer_bits(strb, format); strb->software = sw; switch (format) { -- cgit v1.2.3 From e617dd14ab4863921c02612ab76faa94b02a155c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sat, 12 Sep 2009 16:49:31 +0200 Subject: mesa/st: Create front renderbuffer on the fly when supplied with a surface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Normally, the mesa/st would create a fake front buffer out of a client-allocated surface. In the DRI setting, however, st/dri provides a front buffer surface which is created and maintained by the X server. Prefer to use this surface instead, so that front buffer rendering and reading works correctly. Signed-off-by: Nicolai Hähnle --- src/mesa/state_tracker/st_framebuffer.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index ca32b2e573..5c0d335d62 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -66,7 +66,7 @@ st_create_framebuffer( const __GLcontextModes *visual, else { /* Only allocate front buffer right now if we're single buffered. * If double-buffered, allocate front buffer on demand later. - * See check_create_front_buffers(). + * See check_create_front_buffers() and st_set_framebuffer_surface(). */ struct gl_renderbuffer *rb = st_new_renderbuffer_fb(colorFormat, samples, FALSE); @@ -170,8 +170,20 @@ st_set_framebuffer_surface(struct st_framebuffer *stfb, strb = st_renderbuffer(stfb->Base.Attachment[surfIndex].Renderbuffer); - /* fail */ - if (!strb) return; + if (!strb) { + if (surfIndex == ST_SURFACE_FRONT_LEFT) { + /* Delayed creation when the window system supplies a fake front buffer */ + struct st_renderbuffer *strb_back + = st_renderbuffer(stfb->Base.Attachment[ST_SURFACE_BACK_LEFT].Renderbuffer); + struct gl_renderbuffer *rb + = st_new_renderbuffer_fb(surf->format, strb_back->Base.NumSamples, FALSE); + _mesa_add_renderbuffer(&stfb->Base, BUFFER_FRONT_LEFT, rb); + strb = st_renderbuffer(rb); + } else { + /* fail */ + return; + } + } /* replace the renderbuffer's surface/texture pointers */ pipe_surface_reference( &strb->surface, surf ); -- cgit v1.2.3 From 94a3c5979fdfa7e5da97523456ee89848528aab0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sun, 20 Sep 2009 18:45:32 +0200 Subject: radeon: Fix "verts" debugging enable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Copy'n'paste apparently prevented the RADEON_VERTS flag from being enabled. Signed-off-by: Nicolai Hähnle --- src/mesa/drivers/dri/radeon/radeon_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_debug.c b/src/mesa/drivers/dri/radeon/radeon_debug.c index 3b6f003803..413000b6c0 100644 --- a/src/mesa/drivers/dri/radeon/radeon_debug.c +++ b/src/mesa/drivers/dri/radeon/radeon_debug.c @@ -39,7 +39,7 @@ static const struct dri_debug_control debug_control[] = { {"fall", RADEON_FALLBACKS}, {"tex", RADEON_TEXTURE}, {"ioctl", RADEON_IOCTL}, - {"verts", RADEON_RENDER}, + {"verts", RADEON_VERTS}, {"render", RADEON_RENDER}, {"swrender", RADEON_SWRENDER}, {"state", RADEON_STATE}, -- cgit v1.2.3 From 76c2e34b22836c3a71a096be5620ded97a2ae636 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 20 Sep 2009 12:28:07 +0100 Subject: llvmpipe: Update tile status on flush. --- src/gallium/drivers/llvmpipe/lp_tile_cache.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_tile_cache.c b/src/gallium/drivers/llvmpipe/lp_tile_cache.c index 143afec3d3..ddda5650a9 100644 --- a/src/gallium/drivers/llvmpipe/lp_tile_cache.c +++ b/src/gallium/drivers/llvmpipe/lp_tile_cache.c @@ -225,11 +225,14 @@ lp_flush_tile_cache(struct llvmpipe_tile_cache *tc) tc->clear_val); screen->transfer_unmap(screen, pt); + + tile->status = LP_TILE_STATUS_UNDEFINED; break; } case LP_TILE_STATUS_DEFINED: lp_put_tile_rgba_soa(pt, x, y, tile->color); + tile->status = LP_TILE_STATUS_UNDEFINED; break; } } -- cgit v1.2.3 From 911a7a82cd44e89dd7c24a256a0a172f01eadde3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 20 Sep 2009 18:04:00 +0100 Subject: llvmpipe: Fix lp_get_cached_tile. Align coordinates to tile boundaries. --- src/gallium/drivers/llvmpipe/lp_tile_cache.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_tile_cache.c b/src/gallium/drivers/llvmpipe/lp_tile_cache.c index ddda5650a9..2e576e6039 100644 --- a/src/gallium/drivers/llvmpipe/lp_tile_cache.c +++ b/src/gallium/drivers/llvmpipe/lp_tile_cache.c @@ -260,7 +260,7 @@ lp_get_cached_tile(struct llvmpipe_tile_cache *tc, case LP_TILE_STATUS_UNDEFINED: /* get new tile data from transfer */ - lp_get_tile_rgba_soa(pt, x, y, tile->color); + lp_get_tile_rgba_soa(pt, x & ~(TILE_SIZE - 1), y & ~(TILE_SIZE - 1), tile->color); tile->status = LP_TILE_STATUS_DEFINED; break; -- cgit v1.2.3 From 5fa9a7a9a9cb87c8a86402981cc1b4affde95777 Mon Sep 17 00:00:00 2001 From: Pauli Nieminen Date: Sun, 20 Sep 2009 20:07:35 +0300 Subject: radeon: Improve WARN_ONCE macro to appear as single statement. Do-while makes macro safe to be used with if and for constructions. Also remove __LINE__ macro from variable name because scope is local to macro anyway. --- src/mesa/drivers/dri/radeon/radeon_debug.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_debug.h b/src/mesa/drivers/dri/radeon/radeon_debug.h index 2a8302293b..a59104168f 100644 --- a/src/mesa/drivers/dri/radeon/radeon_debug.h +++ b/src/mesa/drivers/dri/radeon/radeon_debug.h @@ -149,21 +149,22 @@ static inline void radeon_debug_remove_indent(void) } } + /* From http://gcc. gnu.org/onlinedocs/gcc-3.2.3/gcc/Variadic-Macros.html . I suppose we could inline this and use macro to fetch out __LINE__ and stuff in case we run into trouble with other compilers ... GLUE! */ -#define WARN_ONCE(a, ...) { \ - static int warn##__LINE__=1; \ - if(warn##__LINE__){ \ +#define WARN_ONCE(a, ...) do { \ + static int __warn_once=1; \ + if(__warn__once){ \ radeon_warning("*********************************WARN_ONCE*********************************\n"); \ radeon_warning("File %s function %s line %d\n", \ __FILE__, __FUNCTION__, __LINE__); \ radeon_warning( (a), ## __VA_ARGS__);\ radeon_warning("***************************************************************************\n"); \ - warn##__LINE__=0;\ + __warn_once=0;\ } \ - } + } while(0) #endif -- cgit v1.2.3 From 3640e4acde2fb050b1659271d1687a8a5f90365d Mon Sep 17 00:00:00 2001 From: Pauli Nieminen Date: Sun, 20 Sep 2009 21:08:42 +0300 Subject: radeon: Fix typo in variable name. --- src/mesa/drivers/dri/radeon/radeon_debug.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_debug.h b/src/mesa/drivers/dri/radeon/radeon_debug.h index a59104168f..26da31c1c4 100644 --- a/src/mesa/drivers/dri/radeon/radeon_debug.h +++ b/src/mesa/drivers/dri/radeon/radeon_debug.h @@ -156,7 +156,7 @@ static inline void radeon_debug_remove_indent(void) */ #define WARN_ONCE(a, ...) do { \ static int __warn_once=1; \ - if(__warn__once){ \ + if(__warn_once){ \ radeon_warning("*********************************WARN_ONCE*********************************\n"); \ radeon_warning("File %s function %s line %d\n", \ __FILE__, __FUNCTION__, __LINE__); \ -- cgit v1.2.3 From 7e3b8b0d8fdfd7cffbb57afce67a3fe54827d90a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sun, 20 Sep 2009 20:40:03 +0200 Subject: r300/compiler: Fix trig instructions in R300 fp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle --- .../drivers/dri/r300/compiler/radeon_program_alu.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c index 8071899eaa..f23ce301ca 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c @@ -511,23 +511,23 @@ static void sincos_constants(struct radeon_compiler* c, GLuint *constants) * MAD dest, tmp.y, weight, tmp.x */ static void sin_approx( - struct radeon_compiler* c, struct rc_instruction * after, + struct radeon_compiler* c, struct rc_instruction * before, struct prog_dst_register dst, struct prog_src_register src, const GLuint* constants) { GLuint tempreg = rc_find_free_temporary(c); - emit2(c, after->Prev, OPCODE_MUL, 0, dstregtmpmask(tempreg, WRITEMASK_XY), + emit2(c, before->Prev, OPCODE_MUL, 0, dstregtmpmask(tempreg, WRITEMASK_XY), swizzle(src, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X), srcreg(PROGRAM_CONSTANT, constants[0])); - emit3(c, after->Prev, OPCODE_MAD, 0, dstregtmpmask(tempreg, WRITEMASK_X), + emit3(c, before->Prev, OPCODE_MAD, 0, dstregtmpmask(tempreg, WRITEMASK_X), swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y), absolute(swizzle(src, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X)), swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X)); - emit3(c, after->Prev, OPCODE_MAD, 0, dstregtmpmask(tempreg, WRITEMASK_Y), + emit3(c, before->Prev, OPCODE_MAD, 0, dstregtmpmask(tempreg, WRITEMASK_Y), swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X), absolute(swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X)), negate(swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X))); - emit3(c, after->Prev, OPCODE_MAD, 0, dst, + emit3(c, before->Prev, OPCODE_MAD, 0, dst, swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y), swizzle(srcreg(PROGRAM_CONSTANT, constants[0]), SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W), swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X)); @@ -567,7 +567,7 @@ GLboolean radeonTransformTrigSimple(struct radeon_compiler* c, swizzle(srcreg(PROGRAM_CONSTANT, constants[1]), SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W), negate(swizzle(srcreg(PROGRAM_CONSTANT, constants[0]), SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z))); - sin_approx(c, inst->Prev, inst->I.DstReg, + sin_approx(c, inst, inst->I.DstReg, swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W), constants); } else if (inst->I.Opcode == OPCODE_SIN) { @@ -582,7 +582,7 @@ GLboolean radeonTransformTrigSimple(struct radeon_compiler* c, swizzle(srcreg(PROGRAM_CONSTANT, constants[1]), SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W), negate(swizzle(srcreg(PROGRAM_CONSTANT, constants[0]), SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z, SWIZZLE_Z))); - sin_approx(c, inst->Prev, inst->I.DstReg, + sin_approx(c, inst, inst->I.DstReg, swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_W, SWIZZLE_W, SWIZZLE_W, SWIZZLE_W), constants); } else { @@ -600,12 +600,12 @@ GLboolean radeonTransformTrigSimple(struct radeon_compiler* c, struct prog_dst_register dst = inst->I.DstReg; dst.WriteMask = inst->I.DstReg.WriteMask & WRITEMASK_X; - sin_approx(c, inst->Prev, dst, + sin_approx(c, inst, dst, swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_X), constants); dst.WriteMask = inst->I.DstReg.WriteMask & WRITEMASK_Y; - sin_approx(c, inst->Prev, dst, + sin_approx(c, inst, dst, swizzle(srcreg(PROGRAM_TEMPORARY, tempreg), SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y, SWIZZLE_Y), constants); } -- cgit v1.2.3 From 284a7af274bc148f112bd0ebb40583923ee26b49 Mon Sep 17 00:00:00 2001 From: Pauli Nieminen Date: Sun, 20 Sep 2009 22:24:35 +0300 Subject: radeon: Fix legacy bo not to reuse dma buffers before refcount is 1. This should help detecting possible memory leaks with dma buffers and prevent possible visual corruption if data would be overwriten too early. --- src/mesa/drivers/dri/radeon/radeon_dma.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_dma.c b/src/mesa/drivers/dri/radeon/radeon_dma.c index c9a32c808b..c6edbae9a1 100644 --- a/src/mesa/drivers/dri/radeon/radeon_dma.c +++ b/src/mesa/drivers/dri/radeon/radeon_dma.c @@ -207,7 +207,6 @@ again_alloc: counter on unused buffers for later freeing them from begin of list */ dma_bo = last_elem(&rmesa->dma.free); - assert(dma_bo->bo->cref == 1); remove_from_list(dma_bo); insert_at_head(&rmesa->dma.reserved, dma_bo); } @@ -307,6 +306,10 @@ static int radeon_bo_is_idle(struct radeon_bo* bo) WARN_ONCE("Your libdrm or kernel doesn't have support for busy query.\n" "This may cause small performance drop for you.\n"); } + /* Protect against bug in legacy bo handling that causes bos stay + * referenced even after they should be freed */ + if (bo->cref != 1) + return 0; return ret != -EBUSY; } @@ -343,7 +346,9 @@ void radeonReleaseDmaRegions(radeonContextPtr rmesa) foreach_s(dma_bo, temp, &rmesa->dma.wait) { if (dma_bo->expire_counter == time) { WARN_ONCE("Leaking dma buffer object!\n"); - radeon_bo_unref(dma_bo->bo); + /* force free of buffer so we don't realy start + * leaking stuff now*/ + while ((dma_bo->bo = radeon_bo_unref(dma_bo->bo))) {} remove_from_list(dma_bo); FREE(dma_bo); continue; -- cgit v1.2.3 From e9d6ab72be065becf7a077c33919d37faa8db92e Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 21 Sep 2009 13:26:48 +1000 Subject: xorg/st: fixup builds against later dpms headers. --- src/gallium/state_trackers/xorg/xorg_crtc.c | 4 ++++ src/gallium/state_trackers/xorg/xorg_output.c | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index fe08bde9ef..67fe29a69d 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -42,8 +42,12 @@ #include "xorg_tracker.h" #include "xf86Modes.h" +#ifdef HAVE_XEXTPROTO_71 +#include +#else #define DPMS_SERVER #include +#endif #include "pipe/p_inlines.h" #include "util/u_rect.h" diff --git a/src/gallium/state_trackers/xorg/xorg_output.c b/src/gallium/state_trackers/xorg/xorg_output.c index 950af942f5..26f45f8d64 100644 --- a/src/gallium/state_trackers/xorg/xorg_output.c +++ b/src/gallium/state_trackers/xorg/xorg_output.c @@ -42,8 +42,12 @@ #include #include +#ifdef HAVE_XEXTPROTO_71 +#include +#else #define DPMS_SERVER #include +#endif #include "X11/Xatom.h" -- cgit v1.2.3 From 81bac6e2a811ee537c38070f19e70e730ea1169f Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 21 Sep 2009 10:52:07 +0800 Subject: intel: meta clear has a new name. It was renamed to _mesa_meta_Clear. Signed-off-by: Chia-I Wu --- src/mesa/drivers/dri/intel/intel_clear.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index 9010b910c7..fef977f465 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -172,7 +172,7 @@ intelClear(GLcontext *ctx, GLbitfield mask) DBG("\n"); } - _mesa_meta_clear(&intel->ctx, tri_mask); + _mesa_meta_Clear(&intel->ctx, tri_mask); intel_batchbuffer_flush(intel->batch); } -- cgit v1.2.3 From 6c5726cd39ab12b86fae391d075fa74bc24b615c Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 21 Sep 2009 10:57:14 +0800 Subject: st/mesa: Compile in meta.c. meta was moved to core Mesa since 651cffd626a82d9bf539437ca4bdf8ea4b396fab. Signed-off-by: Chia-I Wu --- src/mesa/sources.mak | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index 7107538cee..c8d2f5a1a7 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -333,6 +333,7 @@ MESA_GALLIUM_SOURCES = \ $(VBO_SOURCES) \ $(STATETRACKER_SOURCES) \ $(SHADER_SOURCES) \ + drivers/common/meta.c \ ppc/common_ppc.c \ x86/common_x86.c \ $(SLANG_SOURCES) -- cgit v1.2.3 From 41fefe88c50376a57876b498c8619c8c9f535de6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 20 Sep 2009 21:31:38 -0600 Subject: scons: add meta.c to sources --- src/mesa/SConscript | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/mesa/SConscript b/src/mesa/SConscript index cad5676320..fbe5be0dcd 100644 --- a/src/mesa/SConscript +++ b/src/mesa/SConscript @@ -234,11 +234,16 @@ if env['platform'] != 'winddk': 'shader/slang/slang_utility.c', ] + driver_sources = [ + 'drivers/common/meta.c' + ] + mesa_sources = ( main_sources + math_sources + vbo_sources + vf_sources + + driver_soruces + statetracker_sources + shader_sources + slang_sources -- cgit v1.2.3 From da9d8f192431b0142e65bceb5ca8a2e52e21ac90 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 20 Sep 2009 22:06:03 -0600 Subject: Revert "mesa: move _mesa_meta_init/free() calls to core Mesa" This reverts commit 651cffd626a82d9bf539437ca4bdf8ea4b396fab. The commit inadvertantly introduced a new gallium dependency on the meta code. --- src/mesa/drivers/dri/intel/intel_context.c | 5 +++++ src/mesa/drivers/dri/radeon/radeon_common_context.c | 5 +++++ src/mesa/drivers/x11/xm_api.c | 7 +++++++ src/mesa/main/context.c | 5 ----- 4 files changed, 17 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index ab1cf40387..03db8b1c68 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -38,6 +38,7 @@ #include "swrast_setup/swrast_setup.h" #include "tnl/tnl.h" #include "drivers/common/driverfuncs.h" +#include "drivers/common/meta.h" #include "i830_dri.h" @@ -711,6 +712,8 @@ intelInitContext(struct intel_context *intel, _swrast_allow_pixel_fog(ctx, GL_FALSE); _swrast_allow_vertex_fog(ctx, GL_TRUE); + _mesa_meta_init(ctx); + intel->hw_stencil = mesaVis->stencilBits && mesaVis->depthBits == 24; intel->hw_stipple = 1; @@ -814,6 +817,8 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv) INTEL_FIREVERTICES(intel); + _mesa_meta_free(&intel->ctx); + meta_destroy_metaops(&intel->meta); intel->vtbl.destroy(intel); diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index d4bea86796..1c53c04da7 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -37,6 +37,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "utils.h" #include "vblank.h" #include "drirenderbuffer.h" +#include "drivers/common/meta.h" #include "main/context.h" #include "main/framebuffer.h" #include "main/renderbuffer.h" @@ -208,6 +209,8 @@ GLboolean radeonInitContext(radeonContextPtr radeon, meta_init_metaops(ctx, &radeon->meta); + _mesa_meta_init(ctx); + /* DRI fields */ radeon->dri.context = driContextPriv; radeon->dri.screen = sPriv; @@ -303,6 +306,8 @@ void radeonDestroyContext(__DRIcontextPrivate *driContextPriv ) assert(radeon); + _mesa_meta_free(radeon->glCtx); + if (radeon == current) { radeon_firevertices(radeon); _mesa_make_current(NULL, NULL, NULL); diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 90efd86a6b..662c61ae7e 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -79,6 +79,7 @@ #include "tnl/t_context.h" #include "tnl/t_pipeline.h" #include "drivers/common/driverfuncs.h" +#include "drivers/common/meta.h" /** * Global X driver lock @@ -1647,6 +1648,9 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) xmesa_register_swrast_functions( mesaCtx ); _swsetup_Wakeup(mesaCtx); + if (TEST_META_FUNCS) + _mesa_meta_init(mesaCtx); + return c; } @@ -1661,6 +1665,9 @@ void XMesaDestroyContext( XMesaContext c ) FXdestroyContext( XMESA_BUFFER(mesaCtx->DrawBuffer) ); #endif + if (TEST_META_FUNCS) + _mesa_meta_free( mesaCtx ); + _swsetup_DestroyContext( mesaCtx ); _swrast_DestroyContext( mesaCtx ); _tnl_DestroyContext( mesaCtx ); diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 4c69e688da..f6d4ac4595 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -149,7 +149,6 @@ #include "version.h" #include "viewport.h" #include "vtxfmt.h" -#include "drivers/common/meta.h" #include "glapi/glthread.h" #include "glapi/glapioffsets.h" #include "glapi/glapitable.h" @@ -927,8 +926,6 @@ _mesa_initialize_context(GLcontext *ctx, _mesa_initialize_context_extra(ctx); #endif - _mesa_meta_init(ctx); - ctx->FirstTimeCurrent = GL_TRUE; return GL_TRUE; @@ -994,8 +991,6 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_make_current(ctx, NULL, NULL); } - _mesa_meta_free(ctx); - /* unreference WinSysDraw/Read buffers */ _mesa_reference_framebuffer(&ctx->WinSysDrawBuffer, NULL); _mesa_reference_framebuffer(&ctx->WinSysReadBuffer, NULL); -- cgit v1.2.3 From 1eda10d073b17e1d2ba1089eae378b6e257614be Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 20 Sep 2009 22:08:21 -0600 Subject: Revert "scons: add meta.c to sources" This reverts commit 41fefe88c50376a57876b498c8619c8c9f535de6. --- src/mesa/SConscript | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src') diff --git a/src/mesa/SConscript b/src/mesa/SConscript index fbe5be0dcd..cad5676320 100644 --- a/src/mesa/SConscript +++ b/src/mesa/SConscript @@ -234,16 +234,11 @@ if env['platform'] != 'winddk': 'shader/slang/slang_utility.c', ] - driver_sources = [ - 'drivers/common/meta.c' - ] - mesa_sources = ( main_sources + math_sources + vbo_sources + vf_sources + - driver_soruces + statetracker_sources + shader_sources + slang_sources -- cgit v1.2.3 From a1cf9b6abe0250f1496cea2cf49e29430ceab028 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 20 Sep 2009 22:08:30 -0600 Subject: Revert "st/mesa: Compile in meta.c." This reverts commit 6c5726cd39ab12b86fae391d075fa74bc24b615c. --- src/mesa/sources.mak | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index c8d2f5a1a7..7107538cee 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -333,7 +333,6 @@ MESA_GALLIUM_SOURCES = \ $(VBO_SOURCES) \ $(STATETRACKER_SOURCES) \ $(SHADER_SOURCES) \ - drivers/common/meta.c \ ppc/common_ppc.c \ x86/common_x86.c \ $(SLANG_SOURCES) -- cgit v1.2.3 From 1741bc1a79b6a243e841bca704f1a720b028124a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 20 Sep 2009 22:13:09 -0600 Subject: osmesa: call _mesa_meta_init/free() --- src/mesa/drivers/osmesa/osmesa.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index 904659e345..692657a5df 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -50,6 +50,7 @@ #include "tnl/t_context.h" #include "tnl/t_pipeline.h" #include "drivers/common/driverfuncs.h" +#include "drivers/common/meta.h" #include "vbo/vbo.h" @@ -1258,6 +1259,8 @@ OSMesaCreateContextExt( GLenum format, GLint depthBits, GLint stencilBits, osmesa->bInd = bind; osmesa->aInd = aind; + _mesa_meta_init(&osmesa->mesa); + /* Initialize the software rasterizer and helper modules. */ { GLcontext *ctx = &osmesa->mesa; @@ -1304,6 +1307,8 @@ OSMesaDestroyContext( OSMesaContext osmesa ) if (osmesa->rb) _mesa_reference_renderbuffer(&osmesa->rb, NULL); + _mesa_meta_free( &osmesa->mesa ); + _swsetup_DestroyContext( &osmesa->mesa ); _tnl_DestroyContext( &osmesa->mesa ); _vbo_DestroyContext( &osmesa->mesa ); -- cgit v1.2.3 From 4a4914e4146b78e99277ab494226136a4e68cdb4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 20 Sep 2009 22:13:28 -0600 Subject: dri/swrast: call _mesa_meta_init/free() --- src/mesa/drivers/dri/swrast/swrast.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index 3016987d56..cd499cd5d2 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -43,6 +43,7 @@ #include "tnl/t_pipeline.h" #include "vbo/vbo.h" #include "drivers/common/driverfuncs.h" +#include "drivers/common/meta.h" #include "utils.h" #include "swrast_priv.h" @@ -649,6 +650,8 @@ driCreateNewContext(__DRIscreen *screen, const __DRIconfig *config, _mesa_enable_2_0_extensions(mesaCtx); _mesa_enable_2_1_extensions(mesaCtx); + _mesa_meta_init(mesaCtx); + return ctx; } @@ -660,6 +663,7 @@ driDestroyContext(__DRIcontext *ctx) if (ctx) { mesaCtx = &ctx->Base; + _mesa_meta_free(mesaCtx); _swsetup_DestroyContext( mesaCtx ); _swrast_DestroyContext( mesaCtx ); _tnl_DestroyContext( mesaCtx ); -- cgit v1.2.3 From 2c1937480a68b066a1a0b8ee3770e675bfad859b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 20 Sep 2009 22:19:06 -0600 Subject: xlib: always call _mesa_meta_init/free() --- src/mesa/drivers/x11/xm_api.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 662c61ae7e..79b058634c 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -1648,8 +1648,7 @@ XMesaContext XMesaCreateContext( XMesaVisual v, XMesaContext share_list ) xmesa_register_swrast_functions( mesaCtx ); _swsetup_Wakeup(mesaCtx); - if (TEST_META_FUNCS) - _mesa_meta_init(mesaCtx); + _mesa_meta_init(mesaCtx); return c; } @@ -1665,8 +1664,7 @@ void XMesaDestroyContext( XMesaContext c ) FXdestroyContext( XMESA_BUFFER(mesaCtx->DrawBuffer) ); #endif - if (TEST_META_FUNCS) - _mesa_meta_free( mesaCtx ); + _mesa_meta_free( mesaCtx ); _swsetup_DestroyContext( mesaCtx ); _swrast_DestroyContext( mesaCtx ); -- cgit v1.2.3 From e3384a0d533fe69c1b26f1b03e98beac0b42ccfb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 20 Sep 2009 22:19:28 -0600 Subject: windows: call _mesa_meta_init/free() --- src/mesa/drivers/windows/gdi/wmesa.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c index e1971db693..8929b22af1 100644 --- a/src/mesa/drivers/windows/gdi/wmesa.c +++ b/src/mesa/drivers/windows/gdi/wmesa.c @@ -12,6 +12,7 @@ #include "framebuffer.h" #include "renderbuffer.h" #include "drivers/common/driverfuncs.h" +#include "drivers/common/meta.h" #include "vbo/vbo.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" @@ -1515,6 +1516,8 @@ WMesaContext WMesaCreateContext(HDC hDC, _mesa_enable_2_0_extensions(ctx); _mesa_enable_2_1_extensions(ctx); + _mesa_meta_init(ctx); + /* Initialize the software rasterizer and helper modules. */ if (!_swrast_CreateContext(ctx) || !_vbo_CreateContext(ctx) || @@ -1558,6 +1561,8 @@ void WMesaDestroyContext( WMesaContext pwc ) DeleteObject(pwc->clearPen); DeleteObject(pwc->clearBrush); + _mesa_meta_free(ctx); + _swsetup_DestroyContext(ctx); _tnl_DestroyContext(ctx); _vbo_DestroyContext(ctx); -- cgit v1.2.3 From 344e2fd1f2aa580e13faf398b5d0179479cd5e76 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Mon, 21 Sep 2009 14:46:50 +1000 Subject: nouveau: drm_api create_screen()'s 'arg' argument can be NULL --- src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c index 091cbbcfed..117ca6059b 100644 --- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c +++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c @@ -112,7 +112,7 @@ nouveau_drm_create_screen(struct drm_api *api, int fd, return NULL; } - if (arg->mode == DRM_CREATE_DRI1) { + if (arg && arg->mode == DRM_CREATE_DRI1) { struct nouveau_dri *nvdri = dri1->ddx_info; enum pipe_format format; -- cgit v1.2.3 From 774db70506670b4f4121b6697ac39abd184a56d9 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Mon, 21 Sep 2009 14:51:25 +1000 Subject: nouveau: allow building modesetting_drv.so --- src/gallium/winsys/drm/nouveau/xorg/Makefile | 61 +++++++++ src/gallium/winsys/drm/nouveau/xorg/nouveau_xorg.c | 149 +++++++++++++++++++++ 2 files changed, 210 insertions(+) create mode 100644 src/gallium/winsys/drm/nouveau/xorg/Makefile create mode 100644 src/gallium/winsys/drm/nouveau/xorg/nouveau_xorg.c (limited to 'src') diff --git a/src/gallium/winsys/drm/nouveau/xorg/Makefile b/src/gallium/winsys/drm/nouveau/xorg/Makefile new file mode 100644 index 0000000000..f0d3b337e8 --- /dev/null +++ b/src/gallium/winsys/drm/nouveau/xorg/Makefile @@ -0,0 +1,61 @@ +TARGET = modesetting_drv.so +CFILES = $(wildcard ./*.c) +OBJECTS = $(patsubst ./%.c,./%.o,$(CFILES)) +TOP = ../../../../../.. + +include $(TOP)/configs/current + +INCLUDES = \ + $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \ + -I../gem \ + -I$(TOP)/src/gallium/include \ + -I$(TOP)/src/gallium/drivers \ + -I$(TOP)/src/gallium/auxiliary \ + -I$(TOP)/src/mesa \ + -I$(TOP)/include \ + -I$(TOP)/src/egl/main + +LIBS = \ + $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a \ + $(TOP)/src/gallium/winsys/drm/nouveau/drm/libnouveaudrm.a \ + $(TOP)/src/gallium/drivers/nv04/libnv04.a \ + $(TOP)/src/gallium/drivers/nv10/libnv10.a \ + $(TOP)/src/gallium/drivers/nv20/libnv20.a \ + $(TOP)/src/gallium/drivers/nv30/libnv30.a \ + $(TOP)/src/gallium/drivers/nv40/libnv40.a \ + $(TOP)/src/gallium/drivers/nv50/libnv50.a \ + $(TOP)/src/gallium/drivers/nouveau/libnouveau.a \ + $(GALLIUM_AUXILIARIES) + +DRIVER_DEFINES = \ + -DHAVE_CONFIG_H + + +############################################# + + + +all default: $(TARGET) + +$(TARGET): $(OBJECTS) Makefile $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a $(LIBS) + $(TOP)/bin/mklib -noprefix -o $@ \ + $(OBJECTS) $(LIBS) $(shell pkg-config --libs libdrm) -ldrm_nouveau + +clean: + rm -rf $(OBJECTS) $(TARGET) + +install: + $(INSTALL) -d $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR) + $(MINSTALL) -m 755 $(TARGET) $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR) + + +############################################## + + +.c.o: + $(CC) -c $(CFLAGS) $(INCLUDES) $(DRIVER_DEFINES) $< -o $@ + + +############################################## + +.PHONY = all clean install diff --git a/src/gallium/winsys/drm/nouveau/xorg/nouveau_xorg.c b/src/gallium/winsys/drm/nouveau/xorg/nouveau_xorg.c new file mode 100644 index 0000000000..a669b3080a --- /dev/null +++ b/src/gallium/winsys/drm/nouveau/xorg/nouveau_xorg.c @@ -0,0 +1,149 @@ +/* + * 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. + * + * + * Author: Alan Hourihane + * Author: Jakob Bornecrantz + * + */ + +#include "../../../../state_trackers/xorg/xorg_winsys.h" + +static void nouveau_xorg_identify(int flags); +static Bool nouveau_xorg_pci_probe(DriverPtr driver, int entity_num, + struct pci_device *device, + intptr_t match_data); + +static const struct pci_id_match nouveau_xorg_device_match[] = { + { 0x10de, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, + 0x00030000, 0x00ffffff, 0 }, + { 0x12d2, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, + 0x00030000, 0x00ffffff, 0 }, + {0, 0, 0}, +}; + +static SymTabRec nouveau_xorg_chipsets[] = { + {PCI_MATCH_ANY, "NVIDIA Graphics Device"}, + {-1, NULL} +}; + +static PciChipsets nouveau_xorg_pci_devices[] = { + {PCI_MATCH_ANY, PCI_MATCH_ANY, NULL}, + {-1, -1, NULL} +}; + +static XF86ModuleVersionInfo nouveau_xorg_version = { + "modesetting", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XORG_VERSION_CURRENT, + 0, 1, 0, /* major, minor, patch */ + ABI_CLASS_VIDEODRV, + ABI_VIDEODRV_VERSION, + MOD_CLASS_VIDEODRV, + {0, 0, 0, 0} +}; + +/* + * Xorg driver exported structures + */ + +_X_EXPORT DriverRec modesetting = { + 1, + "modesetting", + nouveau_xorg_identify, + NULL, + xorg_tracker_available_options, + NULL, + 0, + NULL, + nouveau_xorg_device_match, + nouveau_xorg_pci_probe +}; + +static MODULESETUPPROTO(nouveau_xorg_setup); + +_X_EXPORT XF86ModuleData modesettingModuleData = { + &nouveau_xorg_version, + nouveau_xorg_setup, + NULL +}; + +/* + * Xorg driver functions + */ + +static pointer +nouveau_xorg_setup(pointer module, pointer opts, int *errmaj, int *errmin) +{ + static Bool setupDone = 0; + + /* This module should be loaded only once, but check to be sure. + */ + if (!setupDone) { + setupDone = 1; + xf86AddDriver(&modesetting, module, HaveDriverFuncs); + + /* + * The return value must be non-NULL on success even though there + * is no TearDownProc. + */ + return (pointer) 1; + } else { + if (errmaj) + *errmaj = LDR_ONCEONLY; + return NULL; + } +} + +static void +nouveau_xorg_identify(int flags) +{ + xf86PrintChipsets("modesetting", "Driver for Modesetting Kernel Drivers", + nouveau_xorg_chipsets); +} + +static Bool +nouveau_xorg_pci_probe(DriverPtr driver, + int entity_num, struct pci_device *device, intptr_t match_data) +{ + ScrnInfoPtr scrn = NULL; + EntityInfoPtr entity; + + scrn = xf86ConfigPciEntity(scrn, 0, entity_num, nouveau_xorg_pci_devices, + NULL, NULL, NULL, NULL, NULL); + if (scrn != NULL) { + scrn->driverVersion = 1; + scrn->driverName = "i915"; + scrn->name = "modesetting"; + scrn->Probe = NULL; + + entity = xf86GetEntityInfo(entity_num); + + /* Use all the functions from the xorg tracker */ + xorg_tracker_set_functions(scrn); + } + return scrn != NULL; +} -- cgit v1.2.3 From 999592745f40a96a7307da374cab4d68254acf75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Mon, 21 Sep 2009 10:08:11 +0200 Subject: intel: Fix crash in intel_flush(). Since commit 2921a2555d0a76fa649b23c31e3264bbc78b2ff5 ('intel: Deassociated drawables from private context struct in intelUnbindContext'), intel->driDrawable may be NULL in intel_flush(). --- src/mesa/drivers/dri/intel/intel_context.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 7fa70e428d..e593b236a7 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -500,7 +500,8 @@ intel_flush(GLcontext *ctx, GLboolean needs_mi_flush) if (screen->dri2.loader && (screen->dri2.loader->base.version >= 2) - && (screen->dri2.loader->flushFrontBuffer != NULL)) { + && (screen->dri2.loader->flushFrontBuffer != NULL) && + intel->driDrawable && intel->driDrawable->loaderPrivate) { (*screen->dri2.loader->flushFrontBuffer)(intel->driDrawable, intel->driDrawable->loaderPrivate); -- cgit v1.2.3 From 736e1ae42fd61f2b9f982b0491ca7daea7e615ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Wed, 9 Sep 2009 19:56:57 +0200 Subject: r300: Fix handling of NV_vertex_program parameters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The handling is a bit inefficient, unfortunately, but I don't want to make any intrusive changes for Mesa 7.6. Signed-off-by: Nicolai Hähnle --- .../drivers/dri/r300/compiler/radeon_program.c | 35 ++++++++++++++++++---- src/mesa/shader/program.c | 1 + 2 files changed, 30 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.c b/src/mesa/drivers/dri/r300/compiler/radeon_program.c index bbbf0dd776..b636f90a96 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.c @@ -150,14 +150,37 @@ void rc_mesa_to_rc_program(struct radeon_compiler * c, struct gl_program * progr c->Program.InputsRead = program->InputsRead; c->Program.OutputsWritten = program->OutputsWritten; - for(i = 0; i < program->Parameters->NumParameters; ++i) { - struct rc_constant constant; + int isNVProgram = 0; - constant.Type = RC_CONSTANT_EXTERNAL; - constant.Size = 4; - constant.u.External = i; + if (program->Target == GL_VERTEX_PROGRAM_ARB) { + struct gl_vertex_program * vp = (struct gl_vertex_program *) program; + isNVProgram = vp->IsNVProgram; + } + + if (isNVProgram) { + /* NV_vertex_program has a fixed-sized constant environment. + * This could be handled more efficiently for programs that + * do not use relative addressing. + */ + for(i = 0; i < 96; ++i) { + struct rc_constant constant; - rc_constants_add(&c->Program.Constants, &constant); + constant.Type = RC_CONSTANT_EXTERNAL; + constant.Size = 4; + constant.u.External = i; + + rc_constants_add(&c->Program.Constants, &constant); + } + } else { + for(i = 0; i < program->Parameters->NumParameters; ++i) { + struct rc_constant constant; + + constant.Type = RC_CONSTANT_EXTERNAL; + constant.Size = 4; + constant.u.External = i; + + rc_constants_add(&c->Program.Constants, &constant); + } } } diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 963478fccd..2cd6eb8a38 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -502,6 +502,7 @@ _mesa_clone_program(GLcontext *ctx, const struct gl_program *prog) = (const struct gl_vertex_program *) prog; struct gl_vertex_program *vpc = (struct gl_vertex_program *) clone; vpc->IsPositionInvariant = vp->IsPositionInvariant; + vpc->IsNVProgram = vp->IsNVProgram; } break; case GL_FRAGMENT_PROGRAM_ARB: -- cgit v1.2.3 From 526430ade1d7ec0e1b3743d69e1ee9fb89cbaa2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Mon, 21 Sep 2009 12:50:33 +0200 Subject: r300: Zero-initialize register for NV_vertex_program MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle --- src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c | 1 + src/mesa/drivers/dri/r300/r300_vertprog.c | 31 ++++++++++++++++++++++ 2 files changed, 32 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c index 93a516105e..dad27fc98e 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c @@ -89,6 +89,7 @@ static unsigned long t_dst_index(struct r300_vertex_program_code *vp, static unsigned long t_src_class(gl_register_file file) { switch (file) { + case PROGRAM_BUILTIN: case PROGRAM_TEMPORARY: return PVS_SRC_REG_TEMPORARY; case PROGRAM_INPUT: diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index dd0f27f9cb..0cb7dde985 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -203,6 +203,34 @@ static void t_inputs_outputs(struct r300_vertex_program_compiler * c) } } +/** + * The NV_vertex_program spec mandates that all registers be + * initialized to zero. We do this here unconditionally. + * + * \note We rely on dead-code elimination in the compiler. + */ +static void initialize_NV_registers(struct radeon_compiler * compiler) +{ + unsigned int reg; + struct rc_instruction * inst; + + for(reg = 0; reg < 12; ++reg) { + inst = rc_insert_new_instruction(compiler, &compiler->Program.Instructions); + inst->I.Opcode = OPCODE_MOV; + inst->I.DstReg.File = PROGRAM_TEMPORARY; + inst->I.DstReg.Index = reg; + inst->I.SrcReg[0].File = PROGRAM_BUILTIN; + inst->I.SrcReg[0].Swizzle = SWIZZLE_0000; + } + + inst = rc_insert_new_instruction(compiler, &compiler->Program.Instructions); + inst->I.Opcode = OPCODE_ARL; + inst->I.DstReg.File = PROGRAM_ADDRESS; + inst->I.DstReg.Index = 0; + inst->I.DstReg.WriteMask = WRITEMASK_X; + inst->I.SrcReg[0].File = PROGRAM_BUILTIN; + inst->I.SrcReg[0].Swizzle = SWIZZLE_0000; +} static struct r300_vertex_program *build_program(GLcontext *ctx, struct r300_vertex_program_key *wanted_key, @@ -234,6 +262,9 @@ static struct r300_vertex_program *build_program(GLcontext *ctx, rc_mesa_to_rc_program(&compiler.Base, &vp->Base->Base); + if (mesa_vp->IsNVProgram) + initialize_NV_registers(&compiler.Base); + rc_move_output(&compiler.Base, VERT_RESULT_PSIZ, VERT_RESULT_PSIZ, WRITEMASK_X); if (vp->key.WPosAttr != FRAG_ATTRIB_MAX) { -- cgit v1.2.3 From 2d729e6e3bcb0af84790cafb9824a3937954e078 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Mon, 21 Sep 2009 10:14:25 -0400 Subject: r600: fix some issues with LIT instruction - MUL_LIT is ALU.Trans instruction - some Trans instructions can take 3 arguments - don't clobber dst.x, use dst.z as temp, it'll get written correct value in last insn - respect source swizzles --- src/mesa/drivers/dri/r600/r700_assembler.c | 69 ++++++++++++++++-------------- 1 file changed, 36 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index efeccb25f1..f46bc32201 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -2024,7 +2024,7 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) return GL_FALSE; } - if (pAsm->D.dst.math == 0) + if (uNumSrc > 1) { // Process source 1 current_source_index = 1; @@ -2880,6 +2880,11 @@ GLboolean assemble_LIT(r700_AssemblerBase *pAsm) return GL_FALSE; } + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + /* dst.y = max(src.x, 0.0) */ pAsm->D.dst.opcode = SQ_OP2_INST_MAX; pAsm->D.dst.rtype = dstType; @@ -2891,11 +2896,6 @@ GLboolean assemble_LIT(r700_AssemblerBase *pAsm) pAsm->S[0].src.rtype = srcType; pAsm->S[0].src.reg = srcReg; setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - noneg_PVSSRC(&(pAsm->S[0].src)); - pAsm->S[0].src.swizzlex = SQ_SEL_X; - pAsm->S[0].src.swizzley = SQ_SEL_X; - pAsm->S[0].src.swizzlez = SQ_SEL_X; - pAsm->S[0].src.swizzlew = SQ_SEL_X; pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; pAsm->S[1].src.reg = tmp; setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); @@ -2909,34 +2909,47 @@ GLboolean assemble_LIT(r700_AssemblerBase *pAsm) return GL_FALSE; } - /* before: dst.w = log(src.y) - * after : dst.x = log(src.y) - * why change dest register is that dst.w has been initialized as 1 before - */ + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + + swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_Y, SQ_SEL_Y, SQ_SEL_Y, SQ_SEL_Y); + + /* dst.z = log(src.y) */ pAsm->D.dst.opcode = SQ_OP2_INST_LOG_CLAMPED; pAsm->D.dst.math = 1; pAsm->D.dst.rtype = dstType; pAsm->D.dst.reg = dstReg; - pAsm->D.dst.writex = 1; + pAsm->D.dst.writex = 0; pAsm->D.dst.writey = 0; - pAsm->D.dst.writez = 0; + pAsm->D.dst.writez = 1; pAsm->D.dst.writew = 0; pAsm->S[0].src.rtype = srcType; pAsm->S[0].src.reg = srcReg; setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - noneg_PVSSRC(&(pAsm->S[0].src)); - pAsm->S[0].src.swizzlex = SQ_SEL_Y; - pAsm->S[0].src.swizzley = SQ_SEL_Y; - pAsm->S[0].src.swizzlez = SQ_SEL_Y; - pAsm->S[0].src.swizzlew = SQ_SEL_Y; if( GL_FALSE == next_ins(pAsm) ) { return GL_FALSE; } - /* before: tmp.x = amd MUL_LIT(src.w, dst.w, src.x ) */ - /* after : tmp.x = amd MUL_LIT(src.w, dst.x, src.x ) */ + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + + if( GL_FALSE == assemble_src(pAsm, 0, 2) ) + { + return GL_FALSE; + } + + swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_W, SQ_SEL_W, SQ_SEL_W, SQ_SEL_W); + + swizzleagain_PVSSRC(&(pAsm->S[2].src), SQ_SEL_X, SQ_SEL_X, SQ_SEL_X, SQ_SEL_X); + + /* tmp.x = amd MUL_LIT(src.w, dst.z, src.x ) */ pAsm->D.dst.opcode = SQ_OP3_INST_MUL_LIT; + pAsm->D.dst.math = 1; pAsm->D.dst.op3 = 1; pAsm->D.dst.rtype = DST_REG_TEMPORARY; pAsm->D.dst.reg = tmp; @@ -2948,29 +2961,19 @@ GLboolean assemble_LIT(r700_AssemblerBase *pAsm) pAsm->S[0].src.rtype = srcType; pAsm->S[0].src.reg = srcReg; setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - noneg_PVSSRC(&(pAsm->S[0].src)); - pAsm->S[0].src.swizzlex = SQ_SEL_W; - pAsm->S[0].src.swizzley = SQ_SEL_W; - pAsm->S[0].src.swizzlez = SQ_SEL_W; - pAsm->S[0].src.swizzlew = SQ_SEL_W; pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; pAsm->S[1].src.reg = dstReg; setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); noneg_PVSSRC(&(pAsm->S[1].src)); - pAsm->S[1].src.swizzlex = SQ_SEL_X; - pAsm->S[1].src.swizzley = SQ_SEL_X; - pAsm->S[1].src.swizzlez = SQ_SEL_X; - pAsm->S[1].src.swizzlew = SQ_SEL_X; + pAsm->S[1].src.swizzlex = SQ_SEL_Z; + pAsm->S[1].src.swizzley = SQ_SEL_Z; + pAsm->S[1].src.swizzlez = SQ_SEL_Z; + pAsm->S[1].src.swizzlew = SQ_SEL_Z; pAsm->S[2].src.rtype = srcType; pAsm->S[2].src.reg = srcReg; setaddrmode_PVSSRC(&(pAsm->S[2].src), ADDR_ABSOLUTE); - noneg_PVSSRC(&(pAsm->S[2].src)); - pAsm->S[2].src.swizzlex = SQ_SEL_X; - pAsm->S[2].src.swizzley = SQ_SEL_X; - pAsm->S[2].src.swizzlez = SQ_SEL_X; - pAsm->S[2].src.swizzlew = SQ_SEL_X; if( GL_FALSE == next_ins(pAsm) ) { -- cgit v1.2.3 From 077e3de98977ca0046d4f09eb7936f6006719739 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 21 Sep 2009 08:32:43 -0600 Subject: swrast: fix cube face selection If arx and ary are equal, we still want to choose from one of them, and not arz. This is the same as Michal's softpipe fix. --- src/mesa/swrast/s_texfilter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index dd59314cd9..ea749c0113 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -1863,7 +1863,7 @@ choose_cube_face(const struct gl_texture_object *texObj, GLuint face; GLfloat sc, tc, ma; - if (arx > ary && arx > arz) { + if (arx >= ary && arx >= arz) { if (rx >= 0.0F) { face = FACE_POS_X; sc = -rz; @@ -1877,7 +1877,7 @@ choose_cube_face(const struct gl_texture_object *texObj, ma = arx; } } - else if (ary > arx && ary > arz) { + else if (ary >= arx && ary >= arz) { if (ry >= 0.0F) { face = FACE_POS_Y; sc = rx; -- cgit v1.2.3 From 5a0b29050f22b4475426a6f05a0338a7cdf546a0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 21 Sep 2009 08:34:00 -0600 Subject: softpipe: Fix cube face selection. If arx and ary are equal, we still want to choose from one of them, and not arz. (cherry picked from commit de685b37a91bc95dd4093a44a49b7b47385b1f7c) --- src/gallium/drivers/softpipe/sp_tex_sample.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 5de358dae9..81793ef736 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -464,7 +464,7 @@ choose_cube_face(float rx, float ry, float rz, float *newS, float *newT) unsigned face; float sc, tc, ma; - if (arx > ary && arx > arz) { + if (arx >= ary && arx >= arz) { if (rx >= 0.0F) { face = PIPE_TEX_FACE_POS_X; sc = -rz; @@ -478,7 +478,7 @@ choose_cube_face(float rx, float ry, float rz, float *newS, float *newT) ma = arx; } } - else if (ary > arx && ary > arz) { + else if (ary >= arx && ary >= arz) { if (ry >= 0.0F) { face = PIPE_TEX_FACE_POS_Y; sc = rx; -- cgit v1.2.3 From 496137d8eb85e78fab748f184b392f99b17059ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Mon, 21 Sep 2009 17:28:37 +0200 Subject: gallium debug: Add gcc printf hint to debug_printf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This causes gcc to issue warnings when format parameters do not match up with the format string in calls to debug_printf. Signed-off-by: Nicolai Hähnle --- src/gallium/auxiliary/util/u_debug.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h index 1380d98d7e..b82e7cb4d4 100644 --- a/src/gallium/auxiliary/util/u_debug.h +++ b/src/gallium/auxiliary/util/u_debug.h @@ -65,6 +65,11 @@ extern "C" { #define __FUNCTION__ "???" #endif +#if defined(__GNUC__) +#define _util_printf_format(fmt, list) __attribute__ ((format (printf, fmt, list))) +#else +#define _util_printf_format(fmt, list) +#endif void _debug_vprintf(const char *format, va_list ap); @@ -82,13 +87,16 @@ _debug_printf(const char *format, ...) /** * Print debug messages. * - * The actual channel used to output debug message is platform specific. To - * avoid misformating or truncation, follow these rules of thumb: + * The actual channel used to output debug message is platform specific. To + * avoid misformating or truncation, follow these rules of thumb: * - output whole lines - * - avoid outputing large strings (512 bytes is the current maximum length + * - avoid outputing large strings (512 bytes is the current maximum length * that is guaranteed to be printed in all platforms) */ #if !defined(PIPE_OS_HAIKU) +static INLINE void +debug_printf(const char *format, ...) _util_printf_format(1,2); + static INLINE void debug_printf(const char *format, ...) { -- cgit v1.2.3 From 9ca94f91a3b48350b02a8fec5ecf60a819a24de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Mon, 21 Sep 2009 17:35:10 +0200 Subject: r300g: Fix bad formatting parameters in calls to debug_printf MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle --- src/gallium/drivers/r300/r300_texture.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 6e8c368320..7c041d17f7 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -48,7 +48,7 @@ static void r300_setup_texture_state(struct r300_texture* tex, state->format2 |= R500_TXHEIGHT_BIT11; } - debug_printf("r300: Set texture state (%dx%d, pitch %d, %d levels)\n", + debug_printf("r300: Set texture state (%dx%d, %d levels)\n", width, height, levels); } @@ -62,7 +62,7 @@ unsigned r300_texture_get_stride(struct r300_texture* tex, unsigned level) return tex->stride_override; if (level > tex->tex.last_level) { - debug_printf("%s: level (%u) > last_level (%u)\n", level, tex->tex.last_level); + debug_printf("%s: level (%u) > last_level (%u)\n", __FUNCTION__, level, tex->tex.last_level); return 0; } -- cgit v1.2.3 From 2b83483fb43386bd4b8d199d371a3e513828695f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 20 May 2009 14:05:03 -0700 Subject: intel: Mark the FBO as incomplete if there's no intel_renderbuffer for it. This happens to rendering with textures with a border, which had resulted in a segfault on dereferencing the irb. (cherry-picked from commit 8bba183b9eeb162661a287bf2e118c6dd419dd24) --- src/mesa/drivers/dri/intel/intel_fbo.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 30f58b1f44..ed7c78e06c 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -680,6 +680,11 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) if (rb == NULL) continue; + if (irb == NULL) { + fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED_EXT; + continue; + } + switch (irb->texformat->MesaFormat) { case MESA_FORMAT_ARGB8888: case MESA_FORMAT_RGB565: -- cgit v1.2.3 From 734a498ed47b35c9e8e7172d19465aca640fa323 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Mon, 21 Sep 2009 19:57:57 +0100 Subject: mesa: Ensure TGSI tokens are freed with gallium's free. To avoid breaking the gallium's builtin malloc debugging. --- src/mesa/state_tracker/st_cb_program.c | 9 +++++---- src/mesa/state_tracker/st_mesa_to_tgsi.c | 11 +++++++++++ src/mesa/state_tracker/st_mesa_to_tgsi.h | 3 +++ src/mesa/state_tracker/st_program.c | 2 +- 4 files changed, 20 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c index 4398ab2839..b2d5c39a3a 100644 --- a/src/mesa/state_tracker/st_cb_program.c +++ b/src/mesa/state_tracker/st_cb_program.c @@ -45,6 +45,7 @@ #include "st_context.h" #include "st_program.h" #include "st_atom_shader.h" +#include "st_mesa_to_tgsi.h" #include "st_cb_program.h" @@ -152,7 +153,7 @@ st_delete_program(GLcontext *ctx, struct gl_program *prog) } if (stvp->state.tokens) { - _mesa_free((void *) stvp->state.tokens); + st_free_tokens(stvp->state.tokens); stvp->state.tokens = NULL; } } @@ -167,7 +168,7 @@ st_delete_program(GLcontext *ctx, struct gl_program *prog) } if (stfp->state.tokens) { - _mesa_free((void *) stfp->state.tokens); + st_free_tokens(stfp->state.tokens); stfp->state.tokens = NULL; } @@ -214,7 +215,7 @@ static void st_program_string_notify( GLcontext *ctx, } if (stfp->state.tokens) { - _mesa_free((void *) stfp->state.tokens); + st_free_tokens(stfp->state.tokens); stfp->state.tokens = NULL; } @@ -242,7 +243,7 @@ static void st_program_string_notify( GLcontext *ctx, } if (stvp->state.tokens) { - _mesa_free((void *) stvp->state.tokens); + st_free_tokens(stvp->state.tokens); stvp->state.tokens = NULL; } diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 04be57f8ff..b0a1b529f1 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -869,3 +869,14 @@ out: return tokens; } + + +/** + * Tokens cannot be free with _mesa_free otherwise the builtin gallium + * malloc debugging will get confused. + */ +void +st_free_tokens(const struct tgsi_token *tokens) +{ + FREE((void *)tokens); +} diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.h b/src/mesa/state_tracker/st_mesa_to_tgsi.h index 679d0ddd41..c0d1ff59e1 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.h +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.h @@ -56,6 +56,9 @@ st_translate_mesa_program( const ubyte outputSemanticIndex[], const GLbitfield outputFlags[] ); +void +st_free_tokens(const struct tgsi_token *tokens); + #if defined __cplusplus } /* extern "C" */ diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 5f9d2a6dad..927f60cc7e 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -317,7 +317,7 @@ st_translate_vertex_program(struct st_context *st, /* free old shader state, if any */ if (stvp->state.tokens) { - _mesa_free((void *) stvp->state.tokens); + st_free_tokens(stvp->state.tokens); stvp->state.tokens = NULL; } if (stvp->driver_shader) { -- cgit v1.2.3 From ab4ec85f6c04fdb5fabb0c74593643c31f630ac3 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 19 Sep 2009 18:46:51 +0200 Subject: r300: fix a typo --- src/mesa/drivers/dri/r300/r300_render.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index b5ddfdc9f8..3cd38753b8 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -475,7 +475,7 @@ void r300SwitchFallback(GLcontext *ctx, uint32_t bit, GLboolean mode) /* update only if we have disabled all tcl fallbacks */ if (rmesa->options.hw_tcl_enabled) { - if ((old_fallback & R300_RASTER_FALLBACK_MASK) == bit) { + if ((old_fallback & R300_TCL_FALLBACK_MASK) == bit) { R300_STATECHANGE(rmesa, vap_cntl_status); rmesa->hw.vap_cntl_status.cmd[1] &= ~R300_VAP_TCL_BYPASS; } -- cgit v1.2.3 From db928a5e9155001fd441a32aa5af7d59af02ca5d Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 19 Sep 2009 18:47:36 +0200 Subject: mesa: add some debug info to teximage.c --- src/mesa/main/teximage.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) (limited to 'src') diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 8228303040..a8160c2735 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -36,6 +36,7 @@ #if FEATURE_convolve #include "convolve.h" #endif +#include "enums.h" #include "fbobject.h" #include "framebuffer.h" #include "hash.h" @@ -2131,6 +2132,13 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glTexImage1D %s %d %s %d %d %s %s %p\n", + _mesa_lookup_enum_by_nr(target), level, + _mesa_lookup_enum_by_nr(internalFormat), width, border, + _mesa_lookup_enum_by_nr(format), + _mesa_lookup_enum_by_nr(type), pixels); + internalFormat = override_internal_format(internalFormat, width, 1); #if FEATURE_convolve @@ -2230,6 +2238,13 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glTexImage2D %s %d %s %d %d %d %s %s %p\n", + _mesa_lookup_enum_by_nr(target), level, + _mesa_lookup_enum_by_nr(internalFormat), width, height, + border, _mesa_lookup_enum_by_nr(format), + _mesa_lookup_enum_by_nr(type), pixels); + internalFormat = override_internal_format(internalFormat, width, height); #if FEATURE_convolve @@ -2346,6 +2361,13 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glTexImage3D %s %d %s %d %d %d %d %s %s %p\n", + _mesa_lookup_enum_by_nr(target), level, + _mesa_lookup_enum_by_nr(internalFormat), width, height, + depth, border, _mesa_lookup_enum_by_nr(format), + _mesa_lookup_enum_by_nr(type), pixels); + internalFormat = override_internal_format(internalFormat, width, height); if (target == GL_TEXTURE_3D || @@ -2455,6 +2477,12 @@ _mesa_TexSubImage1D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glTexSubImage1D %s %d %d %d %s %s %p\n", + _mesa_lookup_enum_by_nr(target), level, + xoffset, width, _mesa_lookup_enum_by_nr(format), + _mesa_lookup_enum_by_nr(type), pixels); + if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) _mesa_update_state(ctx); @@ -2515,6 +2543,13 @@ _mesa_TexSubImage2D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glTexSubImage2D %s %d %d %d %d %d %s %s %p\n", + _mesa_lookup_enum_by_nr(target), level, + xoffset, yoffset, width, height, + _mesa_lookup_enum_by_nr(format), + _mesa_lookup_enum_by_nr(type), pixels); + if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) _mesa_update_state(ctx); @@ -2575,6 +2610,13 @@ _mesa_TexSubImage3D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glTexSubImage3D %s %d %d %d %d %d %d %d %s %s %p\n", + _mesa_lookup_enum_by_nr(target), level, + xoffset, yoffset, zoffset, width, height, depth, + _mesa_lookup_enum_by_nr(format), + _mesa_lookup_enum_by_nr(type), pixels); + if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) _mesa_update_state(ctx); @@ -2631,6 +2673,12 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glCopyTexImage1D %s %d %s %d %d %d %d\n", + _mesa_lookup_enum_by_nr(target), level, + _mesa_lookup_enum_by_nr(internalFormat), + x, y, width, border); + if (ctx->NewState & NEW_COPY_TEX_STATE) _mesa_update_state(ctx); @@ -2696,6 +2744,12 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glCopyTexImage2D %s %d %s %d %d %d %d %d\n", + _mesa_lookup_enum_by_nr(target), level, + _mesa_lookup_enum_by_nr(internalFormat), + x, y, width, height, border); + if (ctx->NewState & NEW_COPY_TEX_STATE) _mesa_update_state(ctx); @@ -2764,6 +2818,11 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glCopyTexSubImage1D %s %d %d %d %d %d\n", + _mesa_lookup_enum_by_nr(target), + level, xoffset, x, y, width); + if (ctx->NewState & NEW_COPY_TEX_STATE) _mesa_update_state(ctx); @@ -2819,6 +2878,11 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glCopyTexSubImage2D %s %d %d %d %d %d %d %d\n", + _mesa_lookup_enum_by_nr(target), + level, xoffset, yoffset, x, y, width, height); + if (ctx->NewState & NEW_COPY_TEX_STATE) _mesa_update_state(ctx); @@ -2874,6 +2938,11 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glCopyTexSubImage3D %s %d %d %d %d %d %d %d %d\n", + _mesa_lookup_enum_by_nr(target), + level, xoffset, yoffset, zoffset, x, y, width, height); + if (ctx->NewState & NEW_COPY_TEX_STATE) _mesa_update_state(ctx); @@ -3122,6 +3191,12 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glCompressedTexImage1DARB %s %d %s %d %d %d %p\n", + _mesa_lookup_enum_by_nr(target), level, + _mesa_lookup_enum_by_nr(internalFormat), + width, border, imageSize, data); + if (target == GL_TEXTURE_1D) { /* non-proxy target */ struct gl_texture_unit *texUnit; @@ -3216,6 +3291,12 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glCompressedTexImage2DARB %s %d %s %d %d %d %d %p\n", + _mesa_lookup_enum_by_nr(target), level, + _mesa_lookup_enum_by_nr(internalFormat), + width, height, border, imageSize, data); + if (target == GL_TEXTURE_2D || (ctx->Extensions.ARB_texture_cube_map && target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && @@ -3315,6 +3396,12 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glCompressedTexImage3DARB %s %d %s %d %d %d %d %d %p\n", + _mesa_lookup_enum_by_nr(target), level, + _mesa_lookup_enum_by_nr(internalFormat), + width, height, depth, border, imageSize, data); + if (target == GL_TEXTURE_3D) { /* non-proxy target */ struct gl_texture_unit *texUnit; -- cgit v1.2.3 From ff5535c5219047fc56f89c55ee44899d218dc234 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 20 Sep 2009 13:54:59 +0200 Subject: radeon: update buffer map/unmap code for changes introduced in 92033a9516942d7272ce4bf36ecd422009bbaf60 and 822c7964819ca1fcc270880d4ca8b3de8a4276d0 --- src/mesa/drivers/dri/radeon/radeon_buffer_objects.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c index a24b6dac26..8fac5c6c51 100644 --- a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c +++ b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c @@ -187,7 +187,11 @@ radeonMapBuffer(GLcontext * ctx, radeon_bo_map(radeon_obj->bo, access == GL_WRITE_ONLY_ARB); - return obj->Pointer = radeon_obj->bo->ptr; + obj->Pointer = radeon_obj->bo->ptr; + obj->Length = obj->Size; + obj->Offset = 0; + + return obj->Pointer; } @@ -203,9 +207,12 @@ radeonUnmapBuffer(GLcontext * ctx, if (radeon_obj->bo != NULL) { radeon_bo_unmap(radeon_obj->bo); - obj->Pointer = NULL; } + obj->Pointer = NULL; + obj->Offset = 0; + obj->Length = 0; + return GL_TRUE; } -- cgit v1.2.3 From 44d260329efaea2bc844afa42fb1b4f882ab74fd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 21 Sep 2009 14:07:35 -0600 Subject: mesa: make max_buffer_index() a non-static function --- src/mesa/main/api_validate.c | 16 ++++++++-------- src/mesa/main/api_validate.h | 6 ++++++ 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 2df4f17389..507e21fe81 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -54,10 +54,10 @@ index_bytes(GLenum type, GLsizei count) /** * Find the max index in the given element/index buffer */ -static GLuint -max_buffer_index(GLcontext *ctx, GLuint count, GLenum type, - const void *indices, - struct gl_buffer_object *elementBuf) +GLuint +_mesa_max_buffer_index(GLcontext *ctx, GLuint count, GLenum type, + const void *indices, + struct gl_buffer_object *elementBuf) { const GLubyte *map = NULL; GLuint max = 0; @@ -179,8 +179,8 @@ _mesa_validate_DrawElements(GLcontext *ctx, if (ctx->Const.CheckArrayBounds) { /* find max array index */ - GLuint max = max_buffer_index(ctx, count, type, indices, - ctx->Array.ElementArrayBufferObj); + GLuint max = _mesa_max_buffer_index(ctx, count, type, indices, + ctx->Array.ElementArrayBufferObj); if (max >= ctx->Array.ArrayObj->_MaxElement) { /* the max element is out of bounds of one or more enabled arrays */ _mesa_warning(ctx, "glDrawElements() index=%u is " @@ -251,8 +251,8 @@ _mesa_validate_DrawRangeElements(GLcontext *ctx, GLenum mode, } if (ctx->Const.CheckArrayBounds) { - GLuint max = max_buffer_index(ctx, count, type, indices, - ctx->Array.ElementArrayBufferObj); + GLuint max = _mesa_max_buffer_index(ctx, count, type, indices, + ctx->Array.ElementArrayBufferObj); if (max >= ctx->Array.ArrayObj->_MaxElement) { /* the max element is out of bounds of one or more enabled arrays */ return GL_FALSE; diff --git a/src/mesa/main/api_validate.h b/src/mesa/main/api_validate.h index 10f0c34e66..ff82a2966c 100644 --- a/src/mesa/main/api_validate.h +++ b/src/mesa/main/api_validate.h @@ -30,6 +30,12 @@ #include "mtypes.h" + +extern GLuint +_mesa_max_buffer_index(GLcontext *ctx, GLuint count, GLenum type, + const void *indices, + struct gl_buffer_object *elementBuf); + extern GLboolean _mesa_validate_DrawArrays(GLcontext *ctx, GLenum mode, GLint start, GLsizei count); -- cgit v1.2.3 From 2655d437569c5bce7c56782792cbd4460b9f758b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 21 Sep 2009 14:23:07 -0600 Subject: mesa: refine the error checking vbo_exec_DrawRangeElements() If the 'end' index is out of bounds issue a warning as before. But instead of just no-op'ing the draw call, examine the actual array indices to see if they're OK. If the max array index is out of bounds, issue another warning and no-op the draw call. Otherwise, draw normally. This is a debug build-only feature since it could impact performance. This "fixes" the missing torus in the OGL Distilled / Picking demo. --- src/mesa/vbo/vbo_exec_array.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 12911f5750..3f0656a816 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -677,9 +677,10 @@ vbo_exec_DrawRangeElements(GLenum mode, /* the max element is out of bounds of one or more enabled arrays */ _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, count %d, " "type 0x%x, indices=%p)\n" - "\tindex=%u is out of bounds (max=%u) " - "Element Buffer %u (size %d)", - start, end, count, type, indices, end, + "\tend is out of bounds (max=%u) " + "Element Buffer %u (size %d)\n" + "\tThis should probably be fixed in the application.", + start, end, count, type, indices, ctx->Array.ArrayObj->_MaxElement - 1, ctx->Array.ElementArrayBufferObj->Name, ctx->Array.ElementArrayBufferObj->Size); @@ -689,7 +690,33 @@ vbo_exec_DrawRangeElements(GLenum mode, if (0) _mesa_print_arrays(ctx); - return; + +#ifdef DEBUG + /* 'end' was out of bounds, but now let's check the actual array + * indexes to see if any of them are out of bounds. If so, warn + * and skip the draw to avoid potential segfault, etc. + */ + { + GLuint max = _mesa_max_buffer_index(ctx, count, type, indices, + ctx->Array.ElementArrayBufferObj); + if (max >= ctx->Array.ArrayObj->_MaxElement) { + _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, " + "count %d, type 0x%x, indices=%p)\n" + "\tindex=%u is out of bounds (max=%u) " + "Element Buffer %u (size %d)\n" + "\tSkipping the glDrawRangeElements() call", + start, end, count, type, indices, max, + ctx->Array.ArrayObj->_MaxElement - 1, + ctx->Array.ElementArrayBufferObj->Name, + ctx->Array.ElementArrayBufferObj->Size); + return; + } + /* XXX we could also find the min index and compare to 'start' + * to see if start is correct. But it's more likely to get the + * upper bound wrong. + */ + } +#endif } else if (0) { _mesa_printf("glDraw[Range]Elements" -- cgit v1.2.3 From 1869bdabbac0926c7da8bfd9e22616cab9457126 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Mon, 21 Sep 2009 16:30:14 -0400 Subject: r600: various cleanups - max texture size is 8k, but mesa doesn't support that at the moment. - attempt to set shader limits to what the hw actually supports - clean up some old r300 cruft - no need to explicitly disable irqs. This is fixed in the drm now. Signed-off-by: Alex Deucher --- src/mesa/drivers/dri/r600/r600_context.c | 43 +++++++++++----------- src/mesa/drivers/dri/r600/r600_context.h | 19 ---------- .../drivers/dri/radeon/radeon_common_context.c | 7 +--- 3 files changed, 24 insertions(+), 45 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index f8fd9c13d7..6a90a5bcd1 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -284,8 +284,8 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual, ctx->Const.MaxTextureMaxAnisotropy = 16.0; ctx->Const.MaxTextureLodBias = 16.0; - ctx->Const.MaxTextureLevels = 13; - ctx->Const.MaxTextureRectSize = 4096; + ctx->Const.MaxTextureLevels = 13; /* hw support 14 */ + ctx->Const.MaxTextureRectSize = 4096; /* hw support 8192 */ ctx->Const.MinPointSize = 0x0001 / 8.0; ctx->Const.MinPointSizeAA = 0x0001 / 8.0; @@ -331,25 +331,26 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual, _tnl_allow_vertex_fog(ctx, GL_TRUE); /* currently bogus data */ - ctx->Const.VertexProgram.MaxInstructions = VSF_MAX_FRAGMENT_LENGTH / 4; - ctx->Const.VertexProgram.MaxNativeInstructions = - VSF_MAX_FRAGMENT_LENGTH / 4; - ctx->Const.VertexProgram.MaxNativeAttribs = 16; /* r420 */ - ctx->Const.VertexProgram.MaxTemps = 32; - ctx->Const.VertexProgram.MaxNativeTemps = - /*VSF_MAX_FRAGMENT_TEMPS */ 32; - ctx->Const.VertexProgram.MaxNativeParameters = 256; /* r420 */ - ctx->Const.VertexProgram.MaxNativeAddressRegs = 1; - - ctx->Const.FragmentProgram.MaxNativeTemps = PFS_NUM_TEMP_REGS; - ctx->Const.FragmentProgram.MaxNativeAttribs = 11; /* copy i915... */ - ctx->Const.FragmentProgram.MaxNativeParameters = PFS_NUM_CONST_REGS; - ctx->Const.FragmentProgram.MaxNativeAluInstructions = PFS_MAX_ALU_INST; - ctx->Const.FragmentProgram.MaxNativeTexInstructions = PFS_MAX_TEX_INST; - ctx->Const.FragmentProgram.MaxNativeInstructions = - PFS_MAX_ALU_INST + PFS_MAX_TEX_INST; - ctx->Const.FragmentProgram.MaxNativeTexIndirections = - PFS_MAX_TEX_INDIRECT; + ctx->Const.VertexProgram.MaxInstructions = 8192; /* in theory no limit */ + ctx->Const.VertexProgram.MaxNativeInstructions = 8192; + ctx->Const.VertexProgram.MaxNativeAttribs = 160; + ctx->Const.VertexProgram.MaxTemps = 256; /* 256 for reg-based constants, inline consts also supported */ + ctx->Const.VertexProgram.MaxNativeTemps = 256; + ctx->Const.VertexProgram.MaxNativeParameters = 256; /* ??? */ + ctx->Const.VertexProgram.MaxNativeAddressRegs = 1; /* ??? */ + + ctx->Const.FragmentProgram.MaxNativeTemps = 256; + ctx->Const.FragmentProgram.MaxNativeAttribs = 32; + ctx->Const.FragmentProgram.MaxNativeParameters = 256; + ctx->Const.FragmentProgram.MaxNativeAluInstructions = 8192; + /* 8 per clause on r6xx, 16 on rv670/r7xx */ + if ((screen->chip_family == CHIP_FAMILY_RV670) || + (screen->chip_family >= CHIP_FAMILY_RV770)) + ctx->Const.FragmentProgram.MaxNativeTexInstructions = 16; + else + ctx->Const.FragmentProgram.MaxNativeTexInstructions = 8; + ctx->Const.FragmentProgram.MaxNativeInstructions = 8192; + ctx->Const.FragmentProgram.MaxNativeTexIndirections = 8; /* ??? */ ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* and these are?? */ ctx->VertexProgram._MaintainTnlProgram = GL_TRUE; ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; diff --git a/src/mesa/drivers/dri/r600/r600_context.h b/src/mesa/drivers/dri/r600/r600_context.h index c59df7505a..9397ecde81 100644 --- a/src/mesa/drivers/dri/r600/r600_context.h +++ b/src/mesa/drivers/dri/r600/r600_context.h @@ -86,29 +86,10 @@ extern int hw_tcl_on; #include "tnl_dd/t_dd_vertex.h" #undef TAG -#define PFS_MAX_ALU_INST 64 -#define PFS_MAX_TEX_INST 64 -#define PFS_MAX_TEX_INDIRECT 4 -#define PFS_NUM_TEMP_REGS 32 -#define PFS_NUM_CONST_REGS 16 - -#define R600_MAX_AOS_ARRAYS 16 - -#define REG_COORDS 0 -#define REG_COLOR0 1 -#define REG_TEX0 2 - #define R600_FALLBACK_NONE 0 #define R600_FALLBACK_TCL 1 #define R600_FALLBACK_RAST 2 -enum -{ - NO_SHIFT = 0, - LEFT_SHIFT = 1, - RIGHT_SHIFT = 2, -}; - struct r600_hw_state { struct radeon_state_atom sq; struct radeon_state_atom db; diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index 1c53c04da7..6b9b1e3c5e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -227,11 +227,8 @@ GLboolean radeonInitContext(radeonContextPtr radeon, fthrottle_mode = driQueryOptioni(&radeon->optionCache, "fthrottle_mode"); radeon->iw.irq_seq = -1; radeon->irqsEmitted = 0; - if (IS_R600_CLASS(radeon->radeonScreen)) - radeon->do_irqs = 0; - else - radeon->do_irqs = (fthrottle_mode == DRI_CONF_FTHROTTLE_IRQS && - radeon->radeonScreen->irq); + radeon->do_irqs = (fthrottle_mode == DRI_CONF_FTHROTTLE_IRQS && + radeon->radeonScreen->irq); radeon->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS); -- cgit v1.2.3 From c63e78b3e583e39ef296f1c2c9a34c90eb221503 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Mon, 21 Sep 2009 16:48:55 -0400 Subject: r600: fix typo in the last commit 128 gprs, 256 reg-based consts --- src/mesa/drivers/dri/r600/r600_context.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index 6a90a5bcd1..354b263f5c 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -330,16 +330,16 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual, _tnl_allow_pixel_fog(ctx, GL_FALSE); _tnl_allow_vertex_fog(ctx, GL_TRUE); - /* currently bogus data */ + /* 256 for reg-based consts, inline consts also supported */ ctx->Const.VertexProgram.MaxInstructions = 8192; /* in theory no limit */ ctx->Const.VertexProgram.MaxNativeInstructions = 8192; ctx->Const.VertexProgram.MaxNativeAttribs = 160; - ctx->Const.VertexProgram.MaxTemps = 256; /* 256 for reg-based constants, inline consts also supported */ - ctx->Const.VertexProgram.MaxNativeTemps = 256; - ctx->Const.VertexProgram.MaxNativeParameters = 256; /* ??? */ + ctx->Const.VertexProgram.MaxTemps = 128; + ctx->Const.VertexProgram.MaxNativeTemps = 128; + ctx->Const.VertexProgram.MaxNativeParameters = 256; ctx->Const.VertexProgram.MaxNativeAddressRegs = 1; /* ??? */ - ctx->Const.FragmentProgram.MaxNativeTemps = 256; + ctx->Const.FragmentProgram.MaxNativeTemps = 128; ctx->Const.FragmentProgram.MaxNativeAttribs = 32; ctx->Const.FragmentProgram.MaxNativeParameters = 256; ctx->Const.FragmentProgram.MaxNativeAluInstructions = 8192; -- cgit v1.2.3 From d504a7669d7b71229c2d15503a095d71ee1584e6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 21 Sep 2009 08:32:43 -0600 Subject: swrast: fix cube face selection If arx and ary are equal, we still want to choose from one of them, and not arz. This is the same as Michal's softpipe fix. --- src/mesa/swrast/s_texfilter.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 6b1f934647..efe6f23474 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -1862,7 +1862,7 @@ choose_cube_face(const struct gl_texture_object *texObj, GLuint face; GLfloat sc, tc, ma; - if (arx > ary && arx > arz) { + if (arx >= ary && arx >= arz) { if (rx >= 0.0F) { face = FACE_POS_X; sc = -rz; @@ -1876,7 +1876,7 @@ choose_cube_face(const struct gl_texture_object *texObj, ma = arx; } } - else if (ary > arx && ary > arz) { + else if (ary >= arx && ary >= arz) { if (ry >= 0.0F) { face = FACE_POS_Y; sc = rx; -- cgit v1.2.3 From b1c9c5a800a485e3e066312f5736c93ef2774c9b Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 19 Sep 2009 18:46:51 +0200 Subject: r300: fix a typo --- src/mesa/drivers/dri/r300/r300_render.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index b5ddfdc9f8..3cd38753b8 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -475,7 +475,7 @@ void r300SwitchFallback(GLcontext *ctx, uint32_t bit, GLboolean mode) /* update only if we have disabled all tcl fallbacks */ if (rmesa->options.hw_tcl_enabled) { - if ((old_fallback & R300_RASTER_FALLBACK_MASK) == bit) { + if ((old_fallback & R300_TCL_FALLBACK_MASK) == bit) { R300_STATECHANGE(rmesa, vap_cntl_status); rmesa->hw.vap_cntl_status.cmd[1] &= ~R300_VAP_TCL_BYPASS; } -- cgit v1.2.3 From d100cbf721010f4eacc87507cc87c5314150d493 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 19 Sep 2009 18:47:36 +0200 Subject: mesa: add some debug info to teximage.c --- src/mesa/main/teximage.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) (limited to 'src') diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index b0aa04e9aa..b555624d88 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -36,6 +36,7 @@ #if FEATURE_convolve #include "convolve.h" #endif +#include "enums.h" #include "fbobject.h" #include "framebuffer.h" #include "hash.h" @@ -2148,6 +2149,13 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glTexImage1D %s %d %s %d %d %s %s %p\n", + _mesa_lookup_enum_by_nr(target), level, + _mesa_lookup_enum_by_nr(internalFormat), width, border, + _mesa_lookup_enum_by_nr(format), + _mesa_lookup_enum_by_nr(type), pixels); + internalFormat = override_internal_format(internalFormat, width, 1); #if FEATURE_convolve @@ -2247,6 +2255,13 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glTexImage2D %s %d %s %d %d %d %s %s %p\n", + _mesa_lookup_enum_by_nr(target), level, + _mesa_lookup_enum_by_nr(internalFormat), width, height, + border, _mesa_lookup_enum_by_nr(format), + _mesa_lookup_enum_by_nr(type), pixels); + internalFormat = override_internal_format(internalFormat, width, height); #if FEATURE_convolve @@ -2363,6 +2378,13 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glTexImage3D %s %d %s %d %d %d %d %s %s %p\n", + _mesa_lookup_enum_by_nr(target), level, + _mesa_lookup_enum_by_nr(internalFormat), width, height, + depth, border, _mesa_lookup_enum_by_nr(format), + _mesa_lookup_enum_by_nr(type), pixels); + internalFormat = override_internal_format(internalFormat, width, height); if (target == GL_TEXTURE_3D || @@ -2472,6 +2494,12 @@ _mesa_TexSubImage1D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glTexSubImage1D %s %d %d %d %s %s %p\n", + _mesa_lookup_enum_by_nr(target), level, + xoffset, width, _mesa_lookup_enum_by_nr(format), + _mesa_lookup_enum_by_nr(type), pixels); + if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) _mesa_update_state(ctx); @@ -2533,6 +2561,13 @@ _mesa_TexSubImage2D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glTexSubImage2D %s %d %d %d %d %d %s %s %p\n", + _mesa_lookup_enum_by_nr(target), level, + xoffset, yoffset, width, height, + _mesa_lookup_enum_by_nr(format), + _mesa_lookup_enum_by_nr(type), pixels); + if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) _mesa_update_state(ctx); @@ -2594,6 +2629,13 @@ _mesa_TexSubImage3D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glTexSubImage3D %s %d %d %d %d %d %d %d %s %s %p\n", + _mesa_lookup_enum_by_nr(target), level, + xoffset, yoffset, zoffset, width, height, depth, + _mesa_lookup_enum_by_nr(format), + _mesa_lookup_enum_by_nr(type), pixels); + if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) _mesa_update_state(ctx); @@ -2652,6 +2694,12 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glCopyTexImage1D %s %d %s %d %d %d %d\n", + _mesa_lookup_enum_by_nr(target), level, + _mesa_lookup_enum_by_nr(internalFormat), + x, y, width, border); + if (ctx->NewState & NEW_COPY_TEX_STATE) _mesa_update_state(ctx); @@ -2718,6 +2766,12 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glCopyTexImage2D %s %d %s %d %d %d %d %d\n", + _mesa_lookup_enum_by_nr(target), level, + _mesa_lookup_enum_by_nr(internalFormat), + x, y, width, height, border); + if (ctx->NewState & NEW_COPY_TEX_STATE) _mesa_update_state(ctx); @@ -2787,6 +2841,11 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glCopyTexSubImage1D %s %d %d %d %d %d\n", + _mesa_lookup_enum_by_nr(target), + level, xoffset, x, y, width); + if (ctx->NewState & NEW_COPY_TEX_STATE) _mesa_update_state(ctx); @@ -2844,6 +2903,11 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glCopyTexSubImage2D %s %d %d %d %d %d %d %d\n", + _mesa_lookup_enum_by_nr(target), + level, xoffset, yoffset, x, y, width, height); + if (ctx->NewState & NEW_COPY_TEX_STATE) _mesa_update_state(ctx); @@ -2904,6 +2968,11 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glCopyTexSubImage3D %s %d %d %d %d %d %d %d %d\n", + _mesa_lookup_enum_by_nr(target), + level, xoffset, yoffset, zoffset, x, y, width, height); + if (ctx->NewState & NEW_COPY_TEX_STATE) _mesa_update_state(ctx); @@ -3155,6 +3224,12 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glCompressedTexImage1DARB %s %d %s %d %d %d %p\n", + _mesa_lookup_enum_by_nr(target), level, + _mesa_lookup_enum_by_nr(internalFormat), + width, border, imageSize, data); + if (target == GL_TEXTURE_1D) { /* non-proxy target */ struct gl_texture_unit *texUnit; @@ -3250,6 +3325,12 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glCompressedTexImage2DARB %s %d %s %d %d %d %d %p\n", + _mesa_lookup_enum_by_nr(target), level, + _mesa_lookup_enum_by_nr(internalFormat), + width, height, border, imageSize, data); + if (target == GL_TEXTURE_2D || (ctx->Extensions.ARB_texture_cube_map && target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && @@ -3350,6 +3431,12 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glCompressedTexImage3DARB %s %d %s %d %d %d %d %d %p\n", + _mesa_lookup_enum_by_nr(target), level, + _mesa_lookup_enum_by_nr(internalFormat), + width, height, depth, border, imageSize, data); + if (target == GL_TEXTURE_3D) { /* non-proxy target */ struct gl_texture_unit *texUnit; -- cgit v1.2.3 From 4916a5a2e72b05c176809dd0db5066a966a45b80 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 20 Sep 2009 13:54:59 +0200 Subject: radeon: update buffer map/unmap code for changes introduced in 92033a9516942d7272ce4bf36ecd422009bbaf60 and 822c7964819ca1fcc270880d4ca8b3de8a4276d0 --- src/mesa/drivers/dri/radeon/radeon_buffer_objects.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c index a24b6dac26..8fac5c6c51 100644 --- a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c +++ b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c @@ -187,7 +187,11 @@ radeonMapBuffer(GLcontext * ctx, radeon_bo_map(radeon_obj->bo, access == GL_WRITE_ONLY_ARB); - return obj->Pointer = radeon_obj->bo->ptr; + obj->Pointer = radeon_obj->bo->ptr; + obj->Length = obj->Size; + obj->Offset = 0; + + return obj->Pointer; } @@ -203,9 +207,12 @@ radeonUnmapBuffer(GLcontext * ctx, if (radeon_obj->bo != NULL) { radeon_bo_unmap(radeon_obj->bo); - obj->Pointer = NULL; } + obj->Pointer = NULL; + obj->Offset = 0; + obj->Length = 0; + return GL_TRUE; } -- cgit v1.2.3 From e5d29ebb5e5dd923c9c60972170d072120007aab Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 21 Sep 2009 14:07:35 -0600 Subject: mesa: make max_buffer_index() a non-static function --- src/mesa/main/api_validate.c | 45 ++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/api_validate.h | 6 ++++++ 2 files changed, 51 insertions(+) (limited to 'src') diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c index 4a1448deee..e71e5a6ce8 100644 --- a/src/mesa/main/api_validate.c +++ b/src/mesa/main/api_validate.c @@ -51,6 +51,51 @@ index_bytes(GLenum type, GLsizei count) } +/** + * Find the max index in the given element/index buffer + */ +GLuint +_mesa_max_buffer_index(GLcontext *ctx, GLuint count, GLenum type, + const void *indices, + struct gl_buffer_object *elementBuf) +{ + const GLubyte *map = NULL; + GLuint max = 0; + GLuint i; + + if (_mesa_is_bufferobj(elementBuf)) { + /* elements are in a user-defined buffer object. need to map it */ + map = ctx->Driver.MapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER, + GL_READ_ONLY, elementBuf); + /* Actual address is the sum of pointers */ + indices = (const GLvoid *) ADD_POINTERS(map, (const GLubyte *) indices); + } + + if (type == GL_UNSIGNED_INT) { + for (i = 0; i < count; i++) + if (((GLuint *) indices)[i] > max) + max = ((GLuint *) indices)[i]; + } + else if (type == GL_UNSIGNED_SHORT) { + for (i = 0; i < count; i++) + if (((GLushort *) indices)[i] > max) + max = ((GLushort *) indices)[i]; + } + else { + ASSERT(type == GL_UNSIGNED_BYTE); + for (i = 0; i < count; i++) + if (((GLubyte *) indices)[i] > max) + max = ((GLubyte *) indices)[i]; + } + + if (map) { + ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, elementBuf); + } + + return max; +} + + /** * Check if OK to draw arrays/elements. */ diff --git a/src/mesa/main/api_validate.h b/src/mesa/main/api_validate.h index 1d3ae157d7..6064d15fe6 100644 --- a/src/mesa/main/api_validate.h +++ b/src/mesa/main/api_validate.h @@ -30,6 +30,12 @@ #include "mtypes.h" + +extern GLuint +_mesa_max_buffer_index(GLcontext *ctx, GLuint count, GLenum type, + const void *indices, + struct gl_buffer_object *elementBuf); + extern GLboolean _mesa_validate_DrawArrays(GLcontext *ctx, GLenum mode, GLint start, GLsizei count); -- cgit v1.2.3 From 40603526f478a59b89a4c0a07c75a97dfe56b8c3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 21 Sep 2009 14:23:07 -0600 Subject: mesa: refine the error checking vbo_exec_DrawRangeElements() If the 'end' index is out of bounds issue a warning as before. But instead of just no-op'ing the draw call, examine the actual array indices to see if they're OK. If the max array index is out of bounds, issue another warning and no-op the draw call. Otherwise, draw normally. This is a debug build-only feature since it could impact performance. This "fixes" the missing torus in the OGL Distilled / Picking demo. --- src/mesa/vbo/vbo_exec_array.c | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index b9550d6106..7eca7f5057 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -680,11 +680,12 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, if (end >= ctx->Array.ArrayObj->_MaxElement) { /* the max element is out of bounds of one or more enabled arrays */ - _mesa_warning(ctx, "glDraw[Range]Elements{,BaseVertex}(start %u, end %u, " - "count %d, type 0x%x, indices=%p, base=%d)\n" - "\tindex=%u is out of bounds (max=%u) " - "Element Buffer %u (size %d)", - start, end, count, type, indices, end, basevertex, + _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, count %d, " + "type 0x%x, indices=%p)\n" + "\tend is out of bounds (max=%u) " + "Element Buffer %u (size %d)\n" + "\tThis should probably be fixed in the application.", + start, end, count, type, indices, ctx->Array.ArrayObj->_MaxElement - 1, ctx->Array.ElementArrayBufferObj->Name, ctx->Array.ElementArrayBufferObj->Size); @@ -694,7 +695,33 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, if (0) _mesa_print_arrays(ctx); - return; + +#ifdef DEBUG + /* 'end' was out of bounds, but now let's check the actual array + * indexes to see if any of them are out of bounds. If so, warn + * and skip the draw to avoid potential segfault, etc. + */ + { + GLuint max = _mesa_max_buffer_index(ctx, count, type, indices, + ctx->Array.ElementArrayBufferObj); + if (max >= ctx->Array.ArrayObj->_MaxElement) { + _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, " + "count %d, type 0x%x, indices=%p)\n" + "\tindex=%u is out of bounds (max=%u) " + "Element Buffer %u (size %d)\n" + "\tSkipping the glDrawRangeElements() call", + start, end, count, type, indices, max, + ctx->Array.ArrayObj->_MaxElement - 1, + ctx->Array.ElementArrayBufferObj->Name, + ctx->Array.ElementArrayBufferObj->Size); + return; + } + /* XXX we could also find the min index and compare to 'start' + * to see if start is correct. But it's more likely to get the + * upper bound wrong. + */ + } +#endif } else if (0) { _mesa_printf("glDraw[Range]Elements{,BaseVertex}" -- cgit v1.2.3 From 83019ffc0708708af7ee1ddbf3cbf949bcf076bd Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Mon, 21 Sep 2009 17:03:58 -0400 Subject: selinux: Fix mmap() return value check --- src/mesa/main/execmem.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/main/execmem.c b/src/mesa/main/execmem.c index 57c1e117c8..4c6139985f 100644 --- a/src/mesa/main/execmem.c +++ b/src/mesa/main/execmem.c @@ -80,11 +80,10 @@ init_heap(void) exec_heap = mmInit( 0, EXEC_HEAP_SIZE ); if (!exec_mem) - exec_mem = (unsigned char *) mmap(0, EXEC_HEAP_SIZE, - PROT_EXEC | PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + exec_mem = mmap(NULL, EXEC_HEAP_SIZE, PROT_EXEC | PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - return (exec_mem != NULL); + return (exec_mem != MAP_FAILED); } -- cgit v1.2.3 From 972e995b148c220d32f2bf8c0a17c138deec6506 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 21 Sep 2009 16:07:14 -0600 Subject: vbo: disable the GL_ARB_draw_elements_base_vertex rebase path This was introduced with commit 92d7ed8a20d4a018ce5324e6537ae7b478b9e5bf. It causes rendering of stray polygons (with sw rendering at least) when running the OGL Distilled / Picking demo (click on an object). This needs additional debugging to fix/restore. Found one suspect thing: in _tnl_draw_prims() there's some mixed signed/ unsigned arithmetic/comparing at line 422 that may be incorrect. --- src/mesa/vbo/vbo_rebase.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/vbo/vbo_rebase.c b/src/mesa/vbo/vbo_rebase.c index 799a25fc1c..55a82ee369 100644 --- a/src/mesa/vbo/vbo_rebase.c +++ b/src/mesa/vbo/vbo_rebase.c @@ -127,7 +127,10 @@ void vbo_rebase_prims( GLcontext *ctx, _mesa_printf("%s %d..%d\n", __FUNCTION__, min_index, max_index); - if (ib && ctx->Extensions.ARB_draw_elements_base_vertex) { + /* XXX this path is disabled for now. + * There's rendering corruption in some apps when it's enabled. + */ + if (0 && ib && ctx->Extensions.ARB_draw_elements_base_vertex) { /* If we can just tell the hardware or the TNL to interpret our * indices with a different base, do so. */ -- cgit v1.2.3 From e8573033058a13bd39a0b85f48b6db64b04c65e0 Mon Sep 17 00:00:00 2001 From: Tormod Volden Date: Sun, 20 Sep 2009 20:20:01 +0200 Subject: GLX: Warn only once about applications calling GLX 1.3 functions The warnings introduced in 1f309c40b8065b8729fce631540c66e4b50b84df would pour out generously from some applications. This patch adds a "warn once" wrapper macro, heavily inspired by src/mesa/drivers/dri/r600/radeon_debug.h Signed-off-by: Tormod Volden Reviewed-by: Ian Romanick --- src/glx/x11/glx_pbuffer.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/glx/x11/glx_pbuffer.c b/src/glx/x11/glx_pbuffer.c index 37459f846b..0ff25bff9e 100644 --- a/src/glx/x11/glx_pbuffer.c +++ b/src/glx/x11/glx_pbuffer.c @@ -39,6 +39,13 @@ #include "glxextensions.h" #include "glcontextmodes.h" +#define WARN_ONCE_GLX_1_3(a, b) { \ + static int warned=1; \ + if(warned) { \ + warn_GLX_1_3((a), b ); \ + warned=0; \ + } \ + } /** * Emit a warning when clients use GLX 1.3 functions on pre-1.3 systems. @@ -576,7 +583,7 @@ glXCreatePbuffer(Display * dpy, GLXFBConfig config, const int *attrib_list) width = 0; height = 0; - warn_GLX_1_3(dpy, __func__); + WARN_ONCE_GLX_1_3(dpy, __func__); for (i = 0; attrib_list[i * 2]; i++) { switch (attrib_list[i * 2]) { @@ -611,7 +618,7 @@ PUBLIC void glXQueryDrawable(Display * dpy, GLXDrawable drawable, int attribute, unsigned int *value) { - warn_GLX_1_3(dpy, __func__); + WARN_ONCE_GLX_1_3(dpy, __func__); GetDrawableAttribute(dpy, drawable, attribute, value); } @@ -665,7 +672,7 @@ PUBLIC GLXPixmap glXCreatePixmap(Display * dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list) { - warn_GLX_1_3(dpy, __func__); + WARN_ONCE_GLX_1_3(dpy, __func__); return CreateDrawable(dpy, (__GLcontextModes *) config, (Drawable) pixmap, attrib_list, X_GLXCreatePixmap); @@ -676,7 +683,7 @@ PUBLIC GLXWindow glXCreateWindow(Display * dpy, GLXFBConfig config, Window win, const int *attrib_list) { - warn_GLX_1_3(dpy, __func__); + WARN_ONCE_GLX_1_3(dpy, __func__); return CreateDrawable(dpy, (__GLcontextModes *) config, (Drawable) win, attrib_list, X_GLXCreateWindow); @@ -686,7 +693,7 @@ glXCreateWindow(Display * dpy, GLXFBConfig config, Window win, PUBLIC void glXDestroyPixmap(Display * dpy, GLXPixmap pixmap) { - warn_GLX_1_3(dpy, __func__); + WARN_ONCE_GLX_1_3(dpy, __func__); DestroyDrawable(dpy, (GLXDrawable) pixmap, X_GLXDestroyPixmap); } @@ -695,7 +702,7 @@ glXDestroyPixmap(Display * dpy, GLXPixmap pixmap) PUBLIC void glXDestroyWindow(Display * dpy, GLXWindow win) { - warn_GLX_1_3(dpy, __func__); + WARN_ONCE_GLX_1_3(dpy, __func__); DestroyDrawable(dpy, (GLXDrawable) win, X_GLXDestroyWindow); } @@ -717,3 +724,4 @@ GLX_ALIAS_VOID(glXGetSelectedEventSGIX, (Display * dpy, GLXDrawable drawable, unsigned long *mask), (dpy, drawable, mask), glXGetSelectedEvent) + -- cgit v1.2.3 From 9a3333f43600ed4b9a17e49f79004f0c8d289378 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 21 Sep 2009 16:51:34 -0600 Subject: vbo: restore some lost warning output --- src/mesa/vbo/vbo_exec_array.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 7eca7f5057..ee37eeb937 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -681,11 +681,11 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, if (end >= ctx->Array.ArrayObj->_MaxElement) { /* the max element is out of bounds of one or more enabled arrays */ _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, count %d, " - "type 0x%x, indices=%p)\n" + "type 0x%x, indices %p, base %d)\n" "\tend is out of bounds (max=%u) " "Element Buffer %u (size %d)\n" "\tThis should probably be fixed in the application.", - start, end, count, type, indices, + start, end, count, type, indices, basevertex, ctx->Array.ArrayObj->_MaxElement - 1, ctx->Array.ElementArrayBufferObj->Name, ctx->Array.ElementArrayBufferObj->Size); @@ -706,11 +706,12 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, ctx->Array.ElementArrayBufferObj); if (max >= ctx->Array.ArrayObj->_MaxElement) { _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, " - "count %d, type 0x%x, indices=%p)\n" + "count %d, type 0x%x, indices %p, base %p)\n" "\tindex=%u is out of bounds (max=%u) " "Element Buffer %u (size %d)\n" "\tSkipping the glDrawRangeElements() call", - start, end, count, type, indices, max, + start, end, count, type, indices, basevertex, + max, ctx->Array.ArrayObj->_MaxElement - 1, ctx->Array.ElementArrayBufferObj->Name, ctx->Array.ElementArrayBufferObj->Size); -- cgit v1.2.3 From 94a020cfe6cb1da04695897eed38b530af31f524 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 21 Sep 2009 16:54:35 -0600 Subject: vbo: added comment about max array index --- src/mesa/vbo/vbo_exec_array.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index ee37eeb937..668dc6eb24 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -678,6 +678,12 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, type, indices, basevertex )) return; + /* NOTE: It's important that 'end' is a reasonable value. + * in _tnl_draw_prims(), we use end to determine how many vertices + * to transform. If it's too large, we can unnecessarily split prims + * or we can read/write out of memory in several different places! + */ + if (end >= ctx->Array.ArrayObj->_MaxElement) { /* the max element is out of bounds of one or more enabled arrays */ _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, count %d, " -- cgit v1.2.3 From e369294f760efd89754f4f66a1080bcf384ba4c6 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 22 Sep 2009 10:55:41 -0700 Subject: i915g: Do propper references of surfaces in context --- src/gallium/drivers/i915simple/i915_context.c | 7 +++++++ src/gallium/drivers/i915simple/i915_state.c | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/i915simple/i915_context.c b/src/gallium/drivers/i915simple/i915_context.c index b43f735245..e745f3342d 100644 --- a/src/gallium/drivers/i915simple/i915_context.c +++ b/src/gallium/drivers/i915simple/i915_context.c @@ -175,12 +175,19 @@ i915_is_buffer_referenced(struct pipe_context *pipe, static void i915_destroy(struct pipe_context *pipe) { struct i915_context *i915 = i915_context(pipe); + int i; draw_destroy(i915->draw); if(i915->batch) i915->iws->batchbuffer_destroy(i915->batch); + /* unbind framebuffer */ + for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { + pipe_surface_reference(&i915->framebuffer.cbufs[i], NULL); + } + pipe_surface_reference(&i915->framebuffer.zsbuf, NULL); + FREE(i915); } diff --git a/src/gallium/drivers/i915simple/i915_state.c b/src/gallium/drivers/i915simple/i915_state.c index 0087dfa410..7d48e6e84d 100644 --- a/src/gallium/drivers/i915simple/i915_state.c +++ b/src/gallium/drivers/i915simple/i915_state.c @@ -588,9 +588,17 @@ static void i915_set_framebuffer_state(struct pipe_context *pipe, const struct pipe_framebuffer_state *fb) { struct i915_context *i915 = i915_context(pipe); + int i; + draw_flush(i915->draw); - i915->framebuffer = *fb; /* struct copy */ + i915->framebuffer.width = fb->width; + i915->framebuffer.height = fb->height; + i915->framebuffer.nr_cbufs = fb->nr_cbufs; + for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { + pipe_surface_reference(&i915->framebuffer.cbufs[i], fb->cbufs[i]); + } + pipe_surface_reference(&i915->framebuffer.zsbuf, fb->zsbuf); i915->dirty |= I915_NEW_FRAMEBUFFER; } -- cgit v1.2.3 From 19798e17feb3616ec301ada306a6fa3765077f56 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 22 Sep 2009 11:00:58 -0700 Subject: i915g: Activate trace --- src/gallium/winsys/drm/intel/gem/intel_drm_api.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/intel/gem/intel_drm_api.c b/src/gallium/winsys/drm/intel/gem/intel_drm_api.c index 4c5a1d2ea8..0fd5cdd969 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_drm_api.c +++ b/src/gallium/winsys/drm/intel/gem/intel_drm_api.c @@ -7,6 +7,7 @@ #include "i915simple/i915_context.h" #include "i915simple/i915_screen.h" +#include "trace/tr_drm.h" /* * Helper functions @@ -198,5 +199,5 @@ struct drm_api intel_drm_api = struct drm_api * drm_api_create() { - return &intel_drm_api; + return trace_drm_create(&intel_drm_api); } -- cgit v1.2.3 From bade906ed131e35ed1782f4687760dcdca233299 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 22 Sep 2009 10:59:26 -0700 Subject: st/xorg: Fix two leeks We where leaking both surfaces in the composit code and textures from pixmaps. --- src/gallium/state_trackers/xorg/xorg_composite.c | 3 +++ src/gallium/state_trackers/xorg/xorg_exa.c | 2 ++ 2 files changed, 5 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 66ca4cb590..ed649a9d65 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -359,6 +359,9 @@ bind_framebuffer_state(struct exa_context *exa, struct exa_pixmap_priv *pDst) state.zsbuf = 0; cso_set_framebuffer(exa->cso, &state); + + /* we do fire and forget for the framebuffer, this is the forget part */ + pipe_surface_reference(&surface, NULL); } enum AxisOrientation { diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index dea9f4c2bc..6507b2950e 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -671,6 +671,8 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, #endif pipe_texture_reference(&priv->tex, texture); + /* the texture we create has one reference */ + pipe_texture_reference(&texture, NULL); } return TRUE; -- cgit v1.2.3 From b626176f0613852df908b4b0552b9b67d5830b4e Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 22 Sep 2009 19:26:08 +0100 Subject: softpipe: fix occlusion counting --- src/gallium/drivers/softpipe/sp_quad_depth_test.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c index 9cffea2c9e..ce1bab9341 100644 --- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c +++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c @@ -631,7 +631,7 @@ alpha_test_quads(struct quad_stage *qs, } } -static unsigned mask_count[0x8] = +static unsigned mask_count[16] = { 0, /* 0x0 */ 1, /* 0x1 */ @@ -641,6 +641,14 @@ static unsigned mask_count[0x8] = 2, /* 0x5 */ 2, /* 0x6 */ 3, /* 0x7 */ + 1, /* 0x8 */ + 2, /* 0x9 */ + 2, /* 0xa */ + 3, /* 0xb */ + 2, /* 0xc */ + 3, /* 0xd */ + 3, /* 0xe */ + 4, /* 0xf */ }; @@ -693,13 +701,17 @@ depth_test_quads_fallback(struct quad_stage *qs, qs->softpipe->depth_stencil->depth.writemask) write_depth_stencil_values(&data, quads[i]); - qs->softpipe->occlusion_count += mask_count[quads[i]->inout.mask]; quads[pass++] = quads[i]; } nr = pass; } + if (qs->softpipe->active_query_count) { + for (i = 0; i < nr; i++) + qs->softpipe->occlusion_count += mask_count[quads[i]->inout.mask]; + } + if (nr) qs->next->run(qs->next, quads, nr); } @@ -883,6 +895,8 @@ choose_depth_test(struct quad_stage *qs, boolean depthwrite = qs->softpipe->depth_stencil->depth.writemask; + boolean occlusion = qs->softpipe->active_query_count; + if (!alpha && !depth && @@ -893,6 +907,7 @@ choose_depth_test(struct quad_stage *qs, interp_depth && depth && depthwrite && + !occlusion && !stencil) { switch (depthfunc) { -- cgit v1.2.3 From b1139e9ad827d86886772a9c9d83dbb0071c702c Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 22 Sep 2009 19:38:34 +0100 Subject: softpipe: fix polygon stipple --- src/gallium/drivers/softpipe/sp_context.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 6b75ee6002..c4b8b33c6a 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -262,10 +262,8 @@ softpipe_create( struct pipe_screen *screen ) draw_install_aaline_stage(softpipe->draw, &softpipe->pipe); draw_install_aapoint_stage(softpipe->draw, &softpipe->pipe); -#if USE_DRAW_STAGE_PSTIPPLE /* Do polygon stipple w/ texture map + frag prog? */ draw_install_pstipple_stage(softpipe->draw, &softpipe->pipe); -#endif sp_init_surface_functions(softpipe); -- cgit v1.2.3 From 8cc12ffb34769a84050be034d19921af811a3406 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Tue, 22 Sep 2009 20:57:05 +0200 Subject: r300: Fix crash reported in bug #24066 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle --- src/mesa/drivers/dri/r300/r300_vertprog.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 0cb7dde985..2f7b67c143 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -43,6 +43,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "compiler/radeon_compiler.h" #include "compiler/radeon_nqssadce.h" #include "r300_context.h" +#include "r300_fragprog_common.h" #include "r300_state.h" /** @@ -298,6 +299,20 @@ struct r300_vertex_program * r300SelectAndTranslateVertexShader(GLcontext *ctx) struct r300_vertex_program *vp; vpc = (struct r300_vertex_program_cont *)ctx->VertexProgram._Current; + + if (!r300->selected_fp) { + /* This can happen when GetProgramiv is called to check + * whether the program runs natively. + * + * To be honest, this is not a very good solution, + * but solving the problem of reporting good values + * for those queries is tough anyway considering that + * we recompile vertex programs based on the precise + * fragment program that is in use. + */ + r300SelectAndTranslateFragmentShader(ctx); + } + wanted_key.FpReads = r300->selected_fp->InputsRead; wanted_key.FogAttr = r300->selected_fp->fog_attr; wanted_key.WPosAttr = r300->selected_fp->wpos_attr; -- cgit v1.2.3 From 52cadf7592c980eb9cebb1e2b50b552bb61d9f21 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 22 Sep 2009 13:14:55 -0600 Subject: mesa: fix error message text --- src/mesa/main/bufferobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index c8d160baa9..2d1be5b776 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -1040,7 +1040,7 @@ _mesa_MapBufferARB(GLenum target, GLenum access) ASSERT(ctx->Driver.MapBuffer); bufObj->Pointer = ctx->Driver.MapBuffer( ctx, target, access, bufObj ); if (!bufObj->Pointer) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(access)"); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(map failed)"); } bufObj->Access = access; -- cgit v1.2.3 From bc7546476078dd520af4853f6f0d3f577ec670ec Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 22 Sep 2009 13:19:05 -0600 Subject: glx: include string.h to silence missing memset() prototype warning --- src/glx/x11/glxhash.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/glx/x11/glxhash.c b/src/glx/x11/glxhash.c index 7d28ada49c..6f2c51d39d 100644 --- a/src/glx/x11/glxhash.c +++ b/src/glx/x11/glxhash.c @@ -77,6 +77,7 @@ #include #include +#include #define HASH_MAGIC 0xdeadbeef #define HASH_DEBUG 0 -- cgit v1.2.3 From 207764894b6d565568bc46722e4c239d839a62fc Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 22 Sep 2009 20:47:07 +0100 Subject: softpipe: set quad->facing value --- src/gallium/drivers/softpipe/sp_setup.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c index bc8366b0e6..ade125662a 100644 --- a/src/gallium/drivers/softpipe/sp_setup.c +++ b/src/gallium/drivers/softpipe/sp_setup.c @@ -240,6 +240,7 @@ static void flush_spans( struct setup_context *setup ) if (quadmask) { setup->quad[q].input.x0 = lx; setup->quad[q].input.y0 = setup->span.y; + setup->quad[q].input.facing = setup->facing; setup->quad[q].inout.mask = quadmask; setup->quad_ptrs[q] = &setup->quad[q]; q++; -- cgit v1.2.3 From fe9ca0f718cbc467e5cee99a2c20a5f257ed2fe1 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 22 Sep 2009 20:47:37 +0100 Subject: softpipe: need to write depth/stencil values even when stencil fails --- src/gallium/drivers/softpipe/sp_quad_depth_test.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_quad_depth_test.c b/src/gallium/drivers/softpipe/sp_quad_depth_test.c index ce1bab9341..0ca86c4e1c 100644 --- a/src/gallium/drivers/softpipe/sp_quad_depth_test.c +++ b/src/gallium/drivers/softpipe/sp_quad_depth_test.c @@ -498,7 +498,7 @@ depth_test_quad(struct quad_stage *qs, * Do stencil (and depth) testing. Stenciling depends on the outcome of * depth testing. */ -static boolean +static void depth_stencil_test_quad(struct quad_stage *qs, struct depth_data *data, struct quad_header *quad) @@ -545,13 +545,13 @@ depth_stencil_test_quad(struct quad_stage *qs, /* update stencil buffer values according to z pass/fail result */ if (zFailOp != PIPE_STENCIL_OP_KEEP) { - const unsigned failMask = origMask & ~quad->inout.mask; - apply_stencil_op(data, failMask, zFailOp, ref, wrtMask); + const unsigned zFailMask = origMask & ~quad->inout.mask; + apply_stencil_op(data, zFailMask, zFailOp, ref, wrtMask); } if (zPassOp != PIPE_STENCIL_OP_KEEP) { - const unsigned passMask = origMask & quad->inout.mask; - apply_stencil_op(data, passMask, zPassOp, ref, wrtMask); + const unsigned zPassMask = origMask & quad->inout.mask; + apply_stencil_op(data, zPassMask, zPassOp, ref, wrtMask); } } else { @@ -559,8 +559,6 @@ depth_stencil_test_quad(struct quad_stage *qs, apply_stencil_op(data, quad->inout.mask, zPassOp, ref, wrtMask); } } - - return quad->inout.mask != 0; } @@ -689,17 +687,17 @@ depth_test_quads_fallback(struct quad_stage *qs, } if (qs->softpipe->depth_stencil->stencil[0].enabled) { - if (!depth_stencil_test_quad(qs, &data, quads[i])) - continue; + depth_stencil_test_quad(qs, &data, quads[i]); + write_depth_stencil_values(&data, quads[i]); } else { if (!depth_test_quad(qs, &data, quads[i])) continue; + + if (qs->softpipe->depth_stencil->depth.writemask) + write_depth_stencil_values(&data, quads[i]); } - if (qs->softpipe->depth_stencil->stencil[0].enabled || - qs->softpipe->depth_stencil->depth.writemask) - write_depth_stencil_values(&data, quads[i]); quads[pass++] = quads[i]; } -- cgit v1.2.3 From f338de4018f2cfcb462f98c7d76bf6cc36ab6f47 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 22 Sep 2009 13:47:49 -0600 Subject: mesa: fix more buffer object error messages --- src/mesa/main/bufferobj.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index b95e00af5b..189b5e1655 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -1173,7 +1173,7 @@ _mesa_BufferDataARB(GLenum target, GLsizeiptrARB size, ASSERT(ctx->Driver.BufferData); if (!ctx->Driver.BufferData( ctx, target, size, data, usage, bufObj )) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBufferDataARB(access)"); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBufferDataARB()"); } } @@ -1262,7 +1262,7 @@ _mesa_MapBufferARB(GLenum target, GLenum access) ASSERT(ctx->Driver.MapBuffer); map = ctx->Driver.MapBuffer( ctx, target, access, bufObj ); if (!map) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(access)"); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(map failed)"); return NULL; } else { @@ -1593,7 +1593,7 @@ _mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, map = ctx->Driver.MapBufferRange(ctx, target, offset, length, access, bufObj); if (!map) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(access)"); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glMapBufferARB(map failed)"); } else { /* The driver callback should have set all these fields. -- cgit v1.2.3 From 81283b0bf0a8f7b31517adc224c20531e27fab42 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Tue, 22 Sep 2009 16:39:11 -0400 Subject: r600 : add draw_prim support. --- src/mesa/drivers/dri/r600/Makefile | 1 + src/mesa/drivers/dri/r600/r600_context.c | 3 + src/mesa/drivers/dri/r600/r600_context.h | 32 ++ src/mesa/drivers/dri/r600/r700_assembler.c | 127 ++++ src/mesa/drivers/dri/r600/r700_assembler.h | 8 + src/mesa/drivers/dri/r600/r700_chip.c | 100 +++- src/mesa/drivers/dri/r600/r700_render.c | 667 +++++++++++++++++++++- src/mesa/drivers/dri/r600/r700_shader.c | 90 +++ src/mesa/drivers/dri/r600/r700_shader.h | 1 + src/mesa/drivers/dri/r600/r700_state.c | 20 +- src/mesa/drivers/dri/r600/r700_state.h | 1 + src/mesa/drivers/dri/r600/r700_vertprog.c | 195 ++++++- src/mesa/drivers/dri/r600/r700_vertprog.h | 17 +- src/mesa/drivers/dri/r600/radeon_buffer_objects.c | 1 + src/mesa/drivers/dri/r600/radeon_buffer_objects.h | 1 + 15 files changed, 1217 insertions(+), 47 deletions(-) create mode 120000 src/mesa/drivers/dri/r600/radeon_buffer_objects.c create mode 120000 src/mesa/drivers/dri/r600/radeon_buffer_objects.h (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/Makefile b/src/mesa/drivers/dri/r600/Makefile index 36bf773c05..7d5a7b1ab6 100644 --- a/src/mesa/drivers/dri/r600/Makefile +++ b/src/mesa/drivers/dri/r600/Makefile @@ -29,6 +29,7 @@ COMMON_SOURCES = \ RADEON_COMMON_SOURCES = \ radeon_bo_legacy.c \ radeon_common_context.c \ + radeon_buffer_objects.c \ radeon_common.c \ radeon_cs_legacy.c \ radeon_dma.c \ diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index 354b263f5c..6fc6d9d7bf 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -257,6 +257,7 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual, r600InitTextureFuncs(&functions); r700InitShaderFuncs(&functions); r700InitIoctlFuncs(&functions); + radeonInitBufferObjectFuncs(&functions); if (!radeonInitContext(&r600->radeon, &functions, glVisual, driContextPriv, @@ -375,6 +376,8 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual, _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); } + r700InitDraw(ctx); + radeon_fbo_init(&r600->radeon); radeonInitSpanFuncs( ctx ); diff --git a/src/mesa/drivers/dri/r600/r600_context.h b/src/mesa/drivers/dri/r600/r600_context.h index 9397ecde81..a296ea23fa 100644 --- a/src/mesa/drivers/dri/r600/r600_context.h +++ b/src/mesa/drivers/dri/r600/r600_context.h @@ -126,6 +126,34 @@ struct r600_hw_state { struct radeon_state_atom tx_brdr_clr; }; +typedef struct StreamDesc +{ + GLint size; //number of data element + GLenum type; //data element type + GLsizei stride; + + struct radeon_bo *bo; + GLint bo_offset; + + GLuint dwords; + GLuint dst_loc; + GLuint _signed; + GLboolean normalize; + GLboolean is_named_bo; + GLubyte element; +} StreamDesc; + +typedef struct r700_index_buffer +{ + struct radeon_bo *bo; + int bo_offset; + + GLboolean is_32bit; + GLuint count; + + GLboolean bHostIb; +} r700_index_buffer; + /** * \brief R600 context structure. */ @@ -144,6 +172,9 @@ struct r600_context { GLvector4f dummy_attrib[_TNL_ATTRIB_MAX]; GLvector4f *temp_attrib[_TNL_ATTRIB_MAX]; + GLint nNumActiveAos; + StreamDesc stream_desc[VERT_ATTRIB_MAX]; + struct r700_index_buffer ind_buf; }; #define R700_CONTEXT(ctx) ((context_t *)(ctx->DriverCtx)) @@ -177,6 +208,7 @@ extern GLboolean r700SyncSurf(context_t *context, extern void r700SetupStreams(GLcontext * ctx); extern void r700Start3D(context_t *context); extern void r600InitAtoms(context_t *context); +extern void r700InitDraw(GLcontext *ctx); #define RADEON_D_CAPTURE 0 #define RADEON_D_PLAYBACK 1 diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index f46bc32201..81269350e4 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -786,6 +786,133 @@ GLboolean assemble_vfetch_instruction(r700_AssemblerBase* pAsm, return GL_TRUE; } +GLboolean assemble_vfetch_instruction2(r700_AssemblerBase* pAsm, + GLuint destination_register, + GLenum type, + GLint size, + GLubyte element, + GLuint _signed, + GLboolean normalize, + VTX_FETCH_METHOD * pFetchMethod) +{ + GLuint client_size_inbyte; + GLuint data_format; + GLuint mega_fetch_count; + GLuint is_mega_fetch_flag; + + R700VertexGenericFetch* vfetch_instruction_ptr; + R700VertexGenericFetch* assembled_vfetch_instruction_ptr + = pAsm->vfetch_instruction_ptr_array[element]; + + if (assembled_vfetch_instruction_ptr == NULL) + { + vfetch_instruction_ptr = (R700VertexGenericFetch*) CALLOC_STRUCT(R700VertexGenericFetch); + if (vfetch_instruction_ptr == NULL) + { + return GL_FALSE; + } + Init_R700VertexGenericFetch(vfetch_instruction_ptr); + } + else + { + vfetch_instruction_ptr = assembled_vfetch_instruction_ptr; + } + + data_format = GetSurfaceFormat(type, size, &client_size_inbyte); + + if(GL_TRUE == pFetchMethod->bEnableMini) //More conditions here + { + //TODO : mini fetch + } + else + { + mega_fetch_count = MEGA_FETCH_BYTES - 1; + is_mega_fetch_flag = 0x1; + pFetchMethod->mega_fetch_remainder = MEGA_FETCH_BYTES - client_size_inbyte; + } + + vfetch_instruction_ptr->m_Word0.f.vtx_inst = SQ_VTX_INST_FETCH; + vfetch_instruction_ptr->m_Word0.f.fetch_type = SQ_VTX_FETCH_VERTEX_DATA; + vfetch_instruction_ptr->m_Word0.f.fetch_whole_quad = 0x0; + + vfetch_instruction_ptr->m_Word0.f.buffer_id = element; + vfetch_instruction_ptr->m_Word0.f.src_gpr = 0x0; + vfetch_instruction_ptr->m_Word0.f.src_rel = SQ_ABSOLUTE; + vfetch_instruction_ptr->m_Word0.f.src_sel_x = SQ_SEL_X; + vfetch_instruction_ptr->m_Word0.f.mega_fetch_count = mega_fetch_count; + + vfetch_instruction_ptr->m_Word1.f.dst_sel_x = (size < 1) ? SQ_SEL_0 : SQ_SEL_X; + vfetch_instruction_ptr->m_Word1.f.dst_sel_y = (size < 2) ? SQ_SEL_0 : SQ_SEL_Y; + vfetch_instruction_ptr->m_Word1.f.dst_sel_z = (size < 3) ? SQ_SEL_0 : SQ_SEL_Z; + vfetch_instruction_ptr->m_Word1.f.dst_sel_w = (size < 4) ? SQ_SEL_1 : SQ_SEL_W; + + vfetch_instruction_ptr->m_Word1.f.use_const_fields = 1; + vfetch_instruction_ptr->m_Word1.f.data_format = data_format; + vfetch_instruction_ptr->m_Word2.f.endian_swap = SQ_ENDIAN_NONE; + + if(1 == _signed) + { + vfetch_instruction_ptr->m_Word1.f.format_comp_all = SQ_FORMAT_COMP_SIGNED; + } + else + { + vfetch_instruction_ptr->m_Word1.f.format_comp_all = SQ_FORMAT_COMP_UNSIGNED; + } + + if(GL_TRUE == normalize) + { + vfetch_instruction_ptr->m_Word1.f.num_format_all = SQ_NUM_FORMAT_NORM; + } + else + { + vfetch_instruction_ptr->m_Word1.f.num_format_all = SQ_NUM_FORMAT_INT; + } + + // Destination register + vfetch_instruction_ptr->m_Word1_GPR.f.dst_gpr = destination_register; + vfetch_instruction_ptr->m_Word1_GPR.f.dst_rel = SQ_ABSOLUTE; + + vfetch_instruction_ptr->m_Word2.f.offset = 0; + vfetch_instruction_ptr->m_Word2.f.const_buf_no_stride = 0x0; + + vfetch_instruction_ptr->m_Word2.f.mega_fetch = is_mega_fetch_flag; + + if (assembled_vfetch_instruction_ptr == NULL) + { + if ( GL_FALSE == add_vfetch_instruction(pAsm, (R700VertexInstruction *)vfetch_instruction_ptr) ) + { + return GL_FALSE; + } + + if (pAsm->vfetch_instruction_ptr_array[element] != NULL) + { + return GL_FALSE; + } + else + { + pAsm->vfetch_instruction_ptr_array[element] = vfetch_instruction_ptr; + } + } + + return GL_TRUE; +} + +GLboolean cleanup_vfetch_instructions(r700_AssemblerBase* pAsm) +{ + GLint i; + pAsm->cf_current_clause_type = CF_EMPTY_CLAUSE; + pAsm->cf_current_vtx_clause_ptr = NULL; + + for (i=0; ivfetch_instruction_ptr_array[ i ] = NULL; + } + + cleanup_vfetch_shaderinst(pAsm->pR700Shader); + + return GL_TRUE; +} + GLuint gethelpr(r700_AssemblerBase* pAsm) { GLuint r = pAsm->uHelpReg; diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index f9c4d849c6..4e6e20011a 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -411,6 +411,14 @@ GLboolean assemble_vfetch_instruction(r700_AssemblerBase* pAsm, GLuint number_of_elements, GLenum dataElementType, VTX_FETCH_METHOD* pFetchMethod); +GLboolean assemble_vfetch_instruction2(r700_AssemblerBase* pAsm, + GLuint destination_register, + GLenum type, + GLint size, + GLubyte element, + GLuint _signed, + GLboolean normalize, + VTX_FETCH_METHOD * pFetchMethod); GLuint gethelpr(r700_AssemblerBase* pAsm); void resethelpr(r700_AssemblerBase* pAsm); void checkop_init(r700_AssemblerBase* pAsm); diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index 06d7e9c9ab..783427a94c 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -208,6 +208,80 @@ static void r700SetupVTXConstants(GLcontext * ctx, } +extern int getTypeSize(GLenum type); +static void r700SetupVTXConstants2(GLcontext * ctx, + void * pAos, + StreamDesc * pStreamDesc) +{ + context_t *context = R700_CONTEXT(ctx); + struct radeon_aos * paos = (struct radeon_aos *)pAos; + unsigned int nVBsize; + BATCH_LOCALS(&context->radeon); + + unsigned int uSQ_VTX_CONSTANT_WORD0_0; + unsigned int uSQ_VTX_CONSTANT_WORD1_0; + unsigned int uSQ_VTX_CONSTANT_WORD2_0 = 0; + unsigned int uSQ_VTX_CONSTANT_WORD3_0 = 0; + unsigned int uSQ_VTX_CONSTANT_WORD6_0 = 0; + + if (!paos->bo) + return; + + if ((context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV610) || + (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV620) || + (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RS780) || + (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RS880) || + (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV710)) + r700SyncSurf(context, paos->bo, RADEON_GEM_DOMAIN_GTT, 0, TC_ACTION_ENA_bit); + else + r700SyncSurf(context, paos->bo, RADEON_GEM_DOMAIN_GTT, 0, VC_ACTION_ENA_bit); + + if(0 == pStreamDesc->stride) + { + nVBsize = paos->count * pStreamDesc->size * getTypeSize(pStreamDesc->type); + } + else + { + nVBsize = paos->count * pStreamDesc->stride; + } + + uSQ_VTX_CONSTANT_WORD0_0 = paos->offset; + uSQ_VTX_CONSTANT_WORD1_0 = nVBsize - 1; + + SETfield(uSQ_VTX_CONSTANT_WORD2_0, 0, BASE_ADDRESS_HI_shift, BASE_ADDRESS_HI_mask); /* TODO */ + SETfield(uSQ_VTX_CONSTANT_WORD2_0, pStreamDesc->stride, SQ_VTX_CONSTANT_WORD2_0__STRIDE_shift, + SQ_VTX_CONSTANT_WORD2_0__STRIDE_mask); + SETfield(uSQ_VTX_CONSTANT_WORD2_0, GetSurfaceFormat(pStreamDesc->type, pStreamDesc->size, NULL), + SQ_VTX_CONSTANT_WORD2_0__DATA_FORMAT_shift, + SQ_VTX_CONSTANT_WORD2_0__DATA_FORMAT_mask); /* TODO : trace back api for initial data type, not only GL_FLOAT */ + SETfield(uSQ_VTX_CONSTANT_WORD2_0, SQ_NUM_FORMAT_SCALED, + SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask); + SETbit(uSQ_VTX_CONSTANT_WORD2_0, SQ_VTX_CONSTANT_WORD2_0__FORMAT_COMP_ALL_bit); + + SETfield(uSQ_VTX_CONSTANT_WORD3_0, 1, MEM_REQUEST_SIZE_shift, MEM_REQUEST_SIZE_mask); + SETfield(uSQ_VTX_CONSTANT_WORD6_0, SQ_TEX_VTX_VALID_BUFFER, + SQ_TEX_RESOURCE_WORD6_0__TYPE_shift, SQ_TEX_RESOURCE_WORD6_0__TYPE_mask); + + BEGIN_BATCH_NO_AUTOSTATE(9 + 2); + + R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_RESOURCE, 7)); + R600_OUT_BATCH((pStreamDesc->element + SQ_FETCH_RESOURCE_VS_OFFSET) * FETCH_RESOURCE_STRIDE); + R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD0_0); + R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD1_0); + R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD2_0); + R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD3_0); + R600_OUT_BATCH(0); + R600_OUT_BATCH(0); + R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD6_0); + R600_OUT_BATCH_RELOC(uSQ_VTX_CONSTANT_WORD0_0, + paos->bo, + uSQ_VTX_CONSTANT_WORD0_0, + RADEON_GEM_DOMAIN_GTT, 0, 0); + END_BATCH(); + COMMIT_BATCH(); + +} + void r700SetupStreams(GLcontext *ctx) { context_t *context = R700_CONTEXT(ctx); @@ -256,14 +330,24 @@ static void r700SendVTXState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); for(i=0; imesa_program->Base.InputsRead & (1 << i)) { - /* currently aos are packed */ - r700SetupVTXConstants(ctx, - i, - (void*)(&context->radeon.tcl.aos[j]), - (unsigned int)context->radeon.tcl.aos[j].components, - (unsigned int)context->radeon.tcl.aos[j].stride * 4, - (unsigned int)context->radeon.tcl.aos[j].count); + if(vp->mesa_program->Base.InputsRead & (1 << i)) + { + if(1 == context->selected_vp->uiVersion) + { + /* currently aos are packed */ + r700SetupVTXConstants(ctx, + i, + (void*)(&context->radeon.tcl.aos[j]), + (unsigned int)context->radeon.tcl.aos[j].components, + (unsigned int)context->radeon.tcl.aos[j].stride * 4, + (unsigned int)context->radeon.tcl.aos[j].count); + } + else + { /* context->selected_vp->uiVersion == 2 : aos not always packed */ + r700SetupVTXConstants2(ctx, + (void*)(&context->radeon.tcl.aos[j]), + &(context->stream_desc[j])); + } j++; } } diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index b1c3648ca5..b58859b6ba 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -43,6 +43,7 @@ #include "tnl/t_context.h" #include "tnl/t_vertex.h" #include "tnl/t_pipeline.h" +#include "vbo/vbo_context.h" #include "r600_context.h" #include "r600_cmdbuf.h" @@ -53,6 +54,7 @@ #include "r700_fragprog.h" #include "r700_state.h" +#include "radeon_buffer_objects.h" #include "radeon_common_context.h" void r700WaitForIdle(context_t *context); @@ -270,46 +272,82 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim if (type < 0 || num_indices <= 0) return; - total_emit = 3 /* VGT_PRIMITIVE_TYPE */ - + 2 /* VGT_INDEX_TYPE */ - + 2 /* NUM_INSTANCES */ - + num_indices + 3; /* DRAW_INDEX_IMMD */ + total_emit = 3 /* VGT_PRIMITIVE_TYPE */ + + 2 /* VGT_INDEX_TYPE */ + + 2 /* NUM_INSTANCES */ + + num_indices + 3; /* DRAW_INDEX_IMMD */ - BEGIN_BATCH_NO_AUTOSTATE(total_emit); + BEGIN_BATCH_NO_AUTOSTATE(total_emit); // prim - SETfield(vgt_primitive_type, type, - VGT_PRIMITIVE_TYPE__PRIM_TYPE_shift, VGT_PRIMITIVE_TYPE__PRIM_TYPE_mask); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CONFIG_REG, 1)); - R600_OUT_BATCH(mmVGT_PRIMITIVE_TYPE - ASIC_CONFIG_BASE_INDEX); - R600_OUT_BATCH(vgt_primitive_type); + SETfield(vgt_primitive_type, type, + VGT_PRIMITIVE_TYPE__PRIM_TYPE_shift, VGT_PRIMITIVE_TYPE__PRIM_TYPE_mask); + R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CONFIG_REG, 1)); + R600_OUT_BATCH(mmVGT_PRIMITIVE_TYPE - ASIC_CONFIG_BASE_INDEX); + R600_OUT_BATCH(vgt_primitive_type); // index type - SETfield(vgt_index_type, DI_INDEX_SIZE_32_BIT, INDEX_TYPE_shift, INDEX_TYPE_mask); - R600_OUT_BATCH(CP_PACKET3(R600_IT_INDEX_TYPE, 0)); - R600_OUT_BATCH(vgt_index_type); + SETfield(vgt_index_type, DI_INDEX_SIZE_32_BIT, INDEX_TYPE_shift, INDEX_TYPE_mask); + R600_OUT_BATCH(CP_PACKET3(R600_IT_INDEX_TYPE, 0)); + R600_OUT_BATCH(vgt_index_type); // num instances R600_OUT_BATCH(CP_PACKET3(R600_IT_NUM_INSTANCES, 0)); R600_OUT_BATCH(1); // draw packet - vgt_num_indices = num_indices; - SETfield(vgt_draw_initiator, DI_SRC_SEL_IMMEDIATE, SOURCE_SELECT_shift, SOURCE_SELECT_mask); + vgt_num_indices = num_indices; + SETfield(vgt_draw_initiator, DI_SRC_SEL_IMMEDIATE, SOURCE_SELECT_shift, SOURCE_SELECT_mask); SETfield(vgt_draw_initiator, DI_MAJOR_MODE_0, MAJOR_MODE_shift, MAJOR_MODE_mask); - R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX_IMMD, (num_indices + 1))); - R600_OUT_BATCH(vgt_num_indices); - R600_OUT_BATCH(vgt_draw_initiator); + R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX_IMMD, (num_indices + 1))); + R600_OUT_BATCH(vgt_num_indices); + R600_OUT_BATCH(vgt_draw_initiator); + if(NULL == context->ind_buf.bo) + { for (i = start; i < (start + num_indices); i++) { - if(vb->Elts) - R600_OUT_BATCH(vb->Elts[i]); - else - R600_OUT_BATCH(i); + if(vb->Elts) + { + R600_OUT_BATCH(vb->Elts[i]); + } + else + R600_OUT_BATCH(i); } - END_BATCH(); - COMMIT_BATCH(); + } + else + { + if(GL_TRUE == context->ind_buf.bHostIb) + { + if(GL_TRUE != context->ind_buf.is_32bit) + { + GLushort * pIndex = (GLushort*)ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); + pIndex += start; + for (i = 0; i < num_indices; i++) + { + R600_OUT_BATCH(*pIndex); + pIndex++; + } + } + else + { + GLuint * pIndex = (GLuint*)ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); + pIndex += start; + + for (i = 0; i < num_indices; i++) + { + R600_OUT_BATCH(*pIndex); + pIndex++; + } + } + } + else + { + /* TODO : hw ib draw */ + } + } + END_BATCH(); + COMMIT_BATCH(); } /* start 3d, idle, cb/db flush */ @@ -477,4 +515,585 @@ const struct tnl_pipeline_stage *r700_pipeline[] = 0, }; +#define CONVERT( TYPE, MACRO ) do { \ + GLuint i, j, sz; \ + sz = input->Size; \ + if (input->Normalized) { \ + for (i = 0; i < count; i++) { \ + const TYPE *in = (TYPE *)src_ptr; \ + for (j = 0; j < sz; j++) { \ + *dst_ptr++ = MACRO(*in); \ + in++; \ + } \ + src_ptr += stride; \ + } \ + } else { \ + for (i = 0; i < count; i++) { \ + const TYPE *in = (TYPE *)src_ptr; \ + for (j = 0; j < sz; j++) { \ + *dst_ptr++ = (GLfloat)(*in); \ + in++; \ + } \ + src_ptr += stride; \ + } \ + } \ +} while (0) + +/** + * Convert attribute data type to float + * If the attribute uses named buffer object replace the bo with newly allocated bo + */ +static void r700ConvertAttrib(GLcontext *ctx, int count, + const struct gl_client_array *input, + struct StreamDesc *attr) +{ + context_t *context = R700_CONTEXT(ctx); + const GLvoid *src_ptr; + GLboolean mapped_named_bo = GL_FALSE; + GLfloat *dst_ptr; + GLuint stride; + + stride = (input->StrideB == 0) ? getTypeSize(input->Type) * input->Size : input->StrideB; + + /* Convert value for first element only */ + if (input->StrideB == 0) + { + count = 1; + } + + if (input->BufferObj->Name) + { + if (!input->BufferObj->Pointer) + { + ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER, GL_READ_ONLY_ARB, input->BufferObj); + mapped_named_bo = GL_TRUE; + } + + src_ptr = ADD_POINTERS(input->BufferObj->Pointer, input->Ptr); + } + else + { + src_ptr = input->Ptr; + } + + radeonAllocDmaRegion(&context->radeon, &attr->bo, &attr->bo_offset, + sizeof(GLfloat) * input->Size * count, 32); + dst_ptr = (GLfloat *)ADD_POINTERS(attr->bo->ptr, attr->bo_offset); + + assert(src_ptr != NULL); + + switch (input->Type) + { + case GL_DOUBLE: + CONVERT(GLdouble, (GLfloat)); + break; + case GL_UNSIGNED_INT: + CONVERT(GLuint, UINT_TO_FLOAT); + break; + case GL_INT: + CONVERT(GLint, INT_TO_FLOAT); + break; + case GL_UNSIGNED_SHORT: + CONVERT(GLushort, USHORT_TO_FLOAT); + break; + case GL_SHORT: + CONVERT(GLshort, SHORT_TO_FLOAT); + break; + case GL_UNSIGNED_BYTE: + assert(input->Format != GL_BGRA); + CONVERT(GLubyte, UBYTE_TO_FLOAT); + break; + case GL_BYTE: + CONVERT(GLbyte, BYTE_TO_FLOAT); + break; + default: + assert(0); + break; + } + + if (mapped_named_bo) + { + ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER, input->BufferObj); + } +} + +static void r700AlignDataToDword(GLcontext *ctx, + const struct gl_client_array *input, + int count, + struct StreamDesc *attr) +{ + context_t *context = R700_CONTEXT(ctx); + const int dst_stride = (input->StrideB + 3) & ~3; + const int size = getTypeSize(input->Type) * input->Size * count; + GLboolean mapped_named_bo = GL_FALSE; + + radeonAllocDmaRegion(&context->radeon, &attr->bo, &attr->bo_offset, size, 32); + + if (!input->BufferObj->Pointer) + { + ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER, GL_READ_ONLY_ARB, input->BufferObj); + mapped_named_bo = GL_TRUE; + } + + { + GLvoid *src_ptr = ADD_POINTERS(input->BufferObj->Pointer, input->Ptr); + GLvoid *dst_ptr = ADD_POINTERS(attr->bo->ptr, attr->bo_offset); + int i; + + for (i = 0; i < count; ++i) + { + _mesa_memcpy(dst_ptr, src_ptr, input->StrideB); + src_ptr += input->StrideB; + dst_ptr += dst_stride; + } + } + + if (mapped_named_bo) + { + ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER, input->BufferObj); + } + + attr->stride = dst_stride; +} + +static void r700SetupStreams2(GLcontext *ctx, const struct gl_client_array *input[], int count) +{ + context_t *context = R700_CONTEXT(ctx); + GLuint stride; + int ret; + int i, index; + + R600_STATECHANGE(context, vtx); + + for(index = 0; index < context->nNumActiveAos; index++) + { + struct radeon_aos *aos = &context->radeon.tcl.aos[index]; + i = context->stream_desc[index].element; + + stride = (input[i]->StrideB == 0) ? getTypeSize(input[i]->Type) * input[i]->Size : input[i]->StrideB; + + if (input[i]->Type == GL_DOUBLE || input[i]->Type == GL_UNSIGNED_INT || input[i]->Type == GL_INT || +#if MESA_BIG_ENDIAN + getTypeSize(input[i]->Type) != 4 || +#endif + stride < 4) + { + r700ConvertAttrib(ctx, count, input[i], &context->stream_desc[index]); + } + else + { + if (input[i]->BufferObj->Name) + { + if (stride % 4 != 0) + { + assert(((intptr_t) input[i]->Ptr) % input[i]->StrideB == 0); + r700AlignDataToDword(ctx, input[i], count, &context->stream_desc[index]); + context->stream_desc[index].is_named_bo = GL_FALSE; + } + else + { + context->stream_desc[index].stride = input[i]->StrideB; + context->stream_desc[index].bo_offset = (intptr_t) input[i]->Ptr; + context->stream_desc[index].bo = get_radeon_buffer_object(input[i]->BufferObj)->bo; + context->stream_desc[index].is_named_bo = GL_TRUE; + } + } + else + { + int size; + int local_count = count; + uint32_t *dst; + + if (input[i]->StrideB == 0) + { + size = getTypeSize(input[i]->Type) * input[i]->Size; + local_count = 1; + } + else + { + size = getTypeSize(input[i]->Type) * input[i]->Size * local_count; + } + + radeonAllocDmaRegion(&context->radeon, &context->stream_desc[index].bo, + &context->stream_desc[index].bo_offset, size, 32); + assert(context->stream_desc[index].bo->ptr != NULL); + dst = (uint32_t *)ADD_POINTERS(context->stream_desc[index].bo->ptr, + context->stream_desc[index].bo_offset); + + switch (context->stream_desc[index].dwords) + { + case 1: + radeonEmitVec4(dst, input[i]->Ptr, input[i]->StrideB, local_count); + context->stream_desc[index].stride = 4; + break; + case 2: + radeonEmitVec8(dst, input[i]->Ptr, input[i]->StrideB, local_count); + context->stream_desc[index].stride = 8; + break; + case 3: + radeonEmitVec12(dst, input[i]->Ptr, input[i]->StrideB, local_count); + context->stream_desc[index].stride = 12; + break; + case 4: + radeonEmitVec16(dst, input[i]->Ptr, input[i]->StrideB, local_count); + context->stream_desc[index].stride = 16; + break; + default: + assert(0); + break; + } + } + } + + aos->count = context->stream_desc[index].stride == 0 ? 1 : count; + aos->stride = context->stream_desc[index].stride / sizeof(float); + aos->components = context->stream_desc[index].dwords; + aos->bo = context->stream_desc[index].bo; + aos->offset = context->stream_desc[index].bo_offset; + + if(context->stream_desc[index].is_named_bo) + { + radeon_cs_space_add_persistent_bo(context->radeon.cmdbuf.cs, + context->stream_desc[index].bo, + RADEON_GEM_DOMAIN_GTT, 0); + } + } + + context->radeon.tcl.aos_count = context->nNumActiveAos; + ret = radeon_cs_space_check_with_bo(context->radeon.cmdbuf.cs, + first_elem(&context->radeon.dma.reserved)->bo, + RADEON_GEM_DOMAIN_GTT, 0); +} + +static void r700FreeData(GLcontext *ctx) +{ + /* Need to zero tcl.aos[n].bo and tcl.elt_dma_bo + * to prevent double unref in radeonReleaseArrays + * called during context destroy + */ + context_t *context = R700_CONTEXT(ctx); + + int i; + + for (i = 0; i < context->nNumActiveAos; i++) + { + if (!context->stream_desc[i].is_named_bo) + { + radeon_bo_unref(context->stream_desc[i].bo); + } + context->radeon.tcl.aos[i].bo = NULL; + } + + if (context->ind_buf.bo != NULL) + { + if(context->ind_buf.bHostIb != GL_TRUE) + { + radeon_bo_unref(context->ind_buf.bo); + } + else + { + FREE(context->ind_buf.bo->ptr); + FREE(context->ind_buf.bo); + context->ind_buf.bo = NULL; + } + } +} + +static void r700FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf) +{ + context_t *context = R700_CONTEXT(ctx); + GLvoid *src_ptr; + GLuint *out; + int i; + GLboolean mapped_named_bo = GL_FALSE; + + if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer) + { + ctx->Driver.MapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER, GL_READ_ONLY_ARB, mesa_ind_buf->obj); + mapped_named_bo = GL_TRUE; + assert(mesa_ind_buf->obj->Pointer != NULL); + } + src_ptr = ADD_POINTERS(mesa_ind_buf->obj->Pointer, mesa_ind_buf->ptr); + + if (mesa_ind_buf->type == GL_UNSIGNED_BYTE) + { + GLuint size = sizeof(GLushort) * ((mesa_ind_buf->count + 1) & ~1); + GLubyte *in = (GLubyte *)src_ptr; + + if(context->ind_buf.bHostIb != GL_TRUE) + { + radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo, + &context->ind_buf.bo_offset, size, 4); + + assert(context->ind_buf.bo->ptr != NULL); + out = (GLuint *)ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); + } + else + { + context->ind_buf.bo = MALLOC_STRUCT(radeon_bo); + context->ind_buf.bo->ptr = ALIGN_MALLOC(size, 4); + context->ind_buf.bo_offset = 0; + out = (GLuint *)context->ind_buf.bo->ptr; + } + + for (i = 0; i + 1 < mesa_ind_buf->count; i += 2) + { + *out++ = in[i] | in[i + 1] << 16; + } + + if (i < mesa_ind_buf->count) + { + *out++ = in[i]; + } + +#if MESA_BIG_ENDIAN + } + else + { /* if (mesa_ind_buf->type == GL_UNSIGNED_SHORT) */ + GLushort *in = (GLushort *)src_ptr; + GLuint size = sizeof(GLushort) * ((mesa_ind_buf->count + 1) & ~1); + + if(context->ind_buf.bHostIb != GL_TRUE) + { + radeonAllocDmaRegion(&context->radeon, &r300->ind_buf.bo, + &context->ind_buf.bo_offset, size, 4); + + assert(context->ind_buf.bo->ptr != NULL); + out = (GLuint *)ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); + } + else + { + context->ind_buf.bo = MALLOC_STRUCT(radeon_bo); + context->ind_buf.bo->ptr = ALIGN_MALLOC(size, 4); + context->ind_buf.bo_offset = 0; + out = (GLuint *)context->ind_buf.bo->ptr; + } + + for (i = 0; i + 1 < mesa_ind_buf->count; i += 2) + { + *out++ = in[i] | in[i + 1] << 16; + } + + if (i < mesa_ind_buf->count) + { + *out++ = in[i]; + } +#endif + } + + context->ind_buf.is_32bit = GL_FALSE; + context->ind_buf.count = mesa_ind_buf->count; + + if (mapped_named_bo) + { + ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER, mesa_ind_buf->obj); + } +} + +static void r700SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *mesa_ind_buf) +{ + context_t *context = R700_CONTEXT(ctx); + + if (!mesa_ind_buf) { + context->ind_buf.bo = NULL; + return; + } + + context->ind_buf.bHostIb = GL_TRUE; + +#if MESA_BIG_ENDIAN + if (mesa_ind_buf->type == GL_UNSIGNED_INT) + { +#else + if (mesa_ind_buf->type != GL_UNSIGNED_BYTE) + { +#endif + const GLvoid *src_ptr; + GLvoid *dst_ptr; + GLboolean mapped_named_bo = GL_FALSE; + + if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer) + { + ctx->Driver.MapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER, GL_READ_ONLY_ARB, mesa_ind_buf->obj); + assert(mesa_ind_buf->obj->Pointer != NULL); + mapped_named_bo = GL_TRUE; + } + + src_ptr = ADD_POINTERS(mesa_ind_buf->obj->Pointer, mesa_ind_buf->ptr); + + const GLuint size = mesa_ind_buf->count * getTypeSize(mesa_ind_buf->type); + + if(context->ind_buf.bHostIb != GL_TRUE) + { + radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo, + &context->ind_buf.bo_offset, size, 4); + assert(context->ind_buf.bo->ptr != NULL); + dst_ptr = ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); + } + else + { + context->ind_buf.bo = MALLOC_STRUCT(radeon_bo); + context->ind_buf.bo->ptr = ALIGN_MALLOC(size, 4); + context->ind_buf.bo_offset = 0; + dst_ptr = context->ind_buf.bo->ptr; + } + + _mesa_memcpy(dst_ptr, src_ptr, size); + + context->ind_buf.is_32bit = (mesa_ind_buf->type == GL_UNSIGNED_INT); + context->ind_buf.count = mesa_ind_buf->count; + + if (mapped_named_bo) + { + ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER, mesa_ind_buf->obj); + } + } + else + { + r700FixupIndexBuffer(ctx, mesa_ind_buf); + } +} + +static GLboolean r700TryDrawPrims(GLcontext *ctx, + const struct gl_client_array *arrays[], + const struct _mesa_prim *prim, + GLuint nr_prims, + const struct _mesa_index_buffer *ib, + GLuint min_index, + GLuint max_index ) +{ + context_t *context = R700_CONTEXT(ctx); + radeonContextPtr radeon = &context->radeon; + GLuint i, id = 0; + GLboolean bValidedbuffer; + struct radeon_renderbuffer *rrb; + + if (ctx->NewState) + { + _mesa_update_state( ctx ); + } + + bValidedbuffer = r600ValidateBuffers(ctx); + + /* always emit CB base to prevent + * lock ups on some chips. + */ + R600_STATECHANGE(context, cb_target); + /* mark vtx as dirty since it changes per-draw */ + R600_STATECHANGE(context, vtx); + + _tnl_UpdateFixedFunctionProgram(ctx); + r700SetVertexFormat(ctx, arrays, max_index + 1); + r700SetupStreams2(ctx, arrays, max_index + 1); + r700UpdateShaders2(ctx); + + r700SetScissor(context); + + r700SetupVertexProgram(ctx); + + r700SetupFragmentProgram(ctx); + + r600UpdateTextureState(ctx); + + GLuint emit_end = r700PredictRenderSize(ctx) + + context->radeon.cmdbuf.cs->cdw; + + r700SetupIndexBuffer(ctx, ib); + + radeonEmitState(radeon); + + for (i = 0; i < nr_prims; ++i) + { + r700RunRenderPrimitive(ctx, + prim[i].start, + prim[i].start + prim[i].count, + prim[i].mode); + } + + /* Flush render op cached for last several quads. */ + r700WaitForIdleClean(context); + + rrb = radeon_get_colorbuffer(&context->radeon); + if (rrb && rrb->bo) + r700SyncSurf(context, rrb->bo, 0, RADEON_GEM_DOMAIN_VRAM, + CB_ACTION_ENA_bit | (1 << (id + 6))); + + rrb = radeon_get_depthbuffer(&context->radeon); + if (rrb && rrb->bo) + r700SyncSurf(context, rrb->bo, 0, RADEON_GEM_DOMAIN_VRAM, + DB_ACTION_ENA_bit | DB_DEST_BASE_ENA_bit); + + r700FreeData(ctx); + + if (emit_end < context->radeon.cmdbuf.cs->cdw) + { + WARN_ONCE("Rendering was %d commands larger than predicted size." + " We might overflow command buffer.\n", context->radeon.cmdbuf.cs->cdw - emit_end); + } + + return GL_TRUE; +} + +static void r700DrawPrimsRe(GLcontext *ctx, + const struct gl_client_array *arrays[], + const struct _mesa_prim *prim, + GLuint nr_prims, + const struct _mesa_index_buffer *ib, + GLboolean index_bounds_valid, + GLuint min_index, + GLuint max_index) +{ + GLboolean retval = GL_FALSE; + + /* This check should get folded into just the places that + * min/max index are really needed. + */ + if (!index_bounds_valid) { + vbo_get_minmax_index(ctx, prim, ib, &min_index, &max_index); + } + + if (min_index) { + vbo_rebase_prims( ctx, arrays, prim, nr_prims, ib, min_index, max_index, r700DrawPrimsRe ); + return; + } + + /* Make an attempt at drawing */ + retval = r700TryDrawPrims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); + + /* If failed run tnl pipeline - it should take care of fallbacks */ + if (!retval) + _tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); +} + +static void r700DrawPrims(GLcontext *ctx, + const struct gl_client_array *arrays[], + const struct _mesa_prim *prim, + GLuint nr_prims, + const struct _mesa_index_buffer *ib, + GLboolean index_bounds_valid, + GLuint min_index, + GLuint max_index) +{ + context_t *context = R700_CONTEXT(ctx); + + /* For non indexed drawing, using tnl pipe. */ + if(!ib) + { + context->ind_buf.bo = NULL; + + _tnl_vbo_draw_prims(ctx, arrays, prim, nr_prims, ib, + index_bounds_valid, min_index, max_index); + return; + } + + r700DrawPrimsRe(ctx, arrays, prim, nr_prims, ib, index_bounds_valid, min_index, max_index); +} + +void r700InitDraw(GLcontext *ctx) +{ + struct vbo_context *vbo = vbo_context(ctx); + + vbo->draw_prims = r700DrawPrims; +} + diff --git a/src/mesa/drivers/dri/r600/r700_shader.c b/src/mesa/drivers/dri/r600/r700_shader.c index b4fd51c137..955ea4e4e1 100644 --- a/src/mesa/drivers/dri/r600/r700_shader.c +++ b/src/mesa/drivers/dri/r600/r700_shader.c @@ -60,6 +60,55 @@ void AddInstToList(TypedShaderList * plstCFInstructions, R700ShaderInstruction * plstCFInstructions->uNumOfNode++; } +void TakeInstOutFromList(TypedShaderList * plstCFInstructions, R700ShaderInstruction * pInst) +{ + GLuint ulIndex = 0; + GLboolean bFound = GL_FALSE; + R700ShaderInstruction * pPrevInst = NULL; + R700ShaderInstruction * pCurInst = plstCFInstructions->pHead; + + /* Need go thro list to make sure pInst is there. */ + while(NULL != pCurInst) + { + if(pCurInst == pInst) + { + bFound = GL_TRUE; + break; + } + + pPrevInst = pCurInst; + pCurInst = pCurInst->pNextInst; + } + if(GL_TRUE == bFound) + { + plstCFInstructions->uNumOfNode--; + + pCurInst = pInst->pNextInst; + ulIndex = pInst->m_uIndex; + while(NULL != pCurInst) + { + pCurInst->m_uIndex = ulIndex; + ulIndex++; + pCurInst = pCurInst->pNextInst; + } + + if(plstCFInstructions->pHead == pInst) + { + plstCFInstructions->pHead = pInst->pNextInst; + } + if(plstCFInstructions->pTail == pInst) + { + plstCFInstructions->pTail = pPrevInst; + } + if(NULL != pPrevInst) + { + pPrevInst->pNextInst = pInst->pNextInst; + } + + FREE(pInst); + } +} + void Init_R700_Shader(R700_Shader * pShader) { pShader->Type = R700_SHADER_INVALID; @@ -488,6 +537,47 @@ void DebugPrint(void) { } +void cleanup_vfetch_shaderinst(R700_Shader *pShader) +{ + R700ShaderInstruction *pInst; + R700ShaderInstruction *pInstToFree; + R700VertexInstruction *pVTXInst; + R700ControlFlowInstruction *pCFInst; + + pInst = pShader->lstVTXInstructions.pHead; + while(NULL != pInst) + { + pVTXInst = (R700VertexInstruction *)pInst; + pShader->uShaderBinaryDWORDSize -= GetInstructionSize(pVTXInst->m_ShaderInstType); + + if(NULL != pVTXInst->m_pLinkedGenericClause) + { + pCFInst = (R700ControlFlowInstruction*)(pVTXInst->m_pLinkedGenericClause); + + TakeInstOutFromList(&(pShader->lstCFInstructions), + (R700ShaderInstruction*)pCFInst); + + pShader->uShaderBinaryDWORDSize -= GetInstructionSize(pCFInst->m_ShaderInstType); + } + + pInst = pInst->pNextInst; + }; + + //destroy each item in pShader->lstVTXInstructions; + pInst = pShader->lstVTXInstructions.pHead; + while(NULL != pInst) + { + pInstToFree = pInst; + pInst = pInst->pNextInst; + FREE(pInstToFree); + }; + + //set NULL pShader->lstVTXInstructions + pShader->lstVTXInstructions.pHead=NULL; + pShader->lstVTXInstructions.pTail=NULL; + pShader->lstVTXInstructions.uNumOfNode=0; +} + void Clean_Up_Shader(R700_Shader *pShader) { FREE(pShader->pProgram); diff --git a/src/mesa/drivers/dri/r600/r700_shader.h b/src/mesa/drivers/dri/r600/r700_shader.h index bfd01e1a93..997cb05aaf 100644 --- a/src/mesa/drivers/dri/r600/r700_shader.h +++ b/src/mesa/drivers/dri/r600/r700_shader.h @@ -143,6 +143,7 @@ void LoadProgram(R700_Shader *pShader); void UpdateShaderRegisters(R700_Shader *pShader); void DeleteInstructions(R700_Shader *pShader); void DebugPrint(void); +void cleanup_vfetch_shaderinst(R700_Shader *pShader); void Clean_Up_Shader(R700_Shader *pShader); diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index fc0b511684..1043eabb14 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -92,7 +92,25 @@ void r700UpdateShaders (GLcontext * ctx) //---------------------------------- } } - r700SelectVertexShader(ctx); + r700SelectVertexShader(ctx, 1); + r700UpdateStateParameters(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + context->radeon.NewGLState = 0; +} + +void r700UpdateShaders2(GLcontext * ctx) +{ + context_t *context = R700_CONTEXT(ctx); + + /* should only happenen once, just after context is created */ + /* TODO: shouldn't we fallback to sw here? */ + if (!ctx->FragmentProgram._Current) { + _mesa_fprintf(stderr, "No ctx->FragmentProgram._Current!!\n"); + return; + } + + r700SelectFragmentShader(ctx); + + r700SelectVertexShader(ctx, 2); r700UpdateStateParameters(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); context->radeon.NewGLState = 0; } diff --git a/src/mesa/drivers/dri/r600/r700_state.h b/src/mesa/drivers/dri/r600/r700_state.h index 0f53d5b4c5..209189d8d7 100644 --- a/src/mesa/drivers/dri/r600/r700_state.h +++ b/src/mesa/drivers/dri/r600/r700_state.h @@ -35,6 +35,7 @@ extern void r700UpdateStateParameters(GLcontext * ctx, GLuint new_state); extern void r700UpdateShaders (GLcontext * ctx); +extern void r700UpdateShaders2(GLcontext * ctx); extern void r700UpdateViewportOffset(GLcontext * ctx); diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c index 9ee26286d9..e7a209be9d 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.c +++ b/src/mesa/drivers/dri/r600/r700_vertprog.c @@ -159,7 +159,35 @@ GLboolean Process_Vertex_Program_Vfetch_Instructions( return GL_TRUE; } -void Map_Vertex_Program(struct r700_vertex_program *vp, +GLboolean Process_Vertex_Program_Vfetch_Instructions2( + GLcontext *ctx, + struct r700_vertex_program *vp, + struct gl_vertex_program *mesa_vp) +{ + int i; + context_t *context = R700_CONTEXT(ctx); + + VTX_FETCH_METHOD vtxFetchMethod; + vtxFetchMethod.bEnableMini = GL_FALSE; + vtxFetchMethod.mega_fetch_remainder = 0; + + for(i=0; inNumActiveAos; i++) + { + assemble_vfetch_instruction2(&vp->r700AsmCode, + vp->r700AsmCode.ucVP_AttributeMap[context->stream_desc[i].element], + context->stream_desc[i].type, + context->stream_desc[i].size, + context->stream_desc[i].element, + context->stream_desc[i]._signed, + context->stream_desc[i].normalize, + &vtxFetchMethod); + } + + return GL_TRUE; +} + +void Map_Vertex_Program(GLcontext *ctx, + struct r700_vertex_program *vp, struct gl_vertex_program *mesa_vp) { GLuint ui; @@ -175,11 +203,22 @@ void Map_Vertex_Program(struct r700_vertex_program *vp, pAsm->number_used_registers += num_inputs; // Create VFETCH instructions for inputs - if (GL_TRUE != Process_Vertex_Program_Vfetch_Instructions(vp, mesa_vp) ) - { - radeon_error("Calling Process_Vertex_Program_Vfetch_Instructions return error. \n"); - return; //error - } + if(1 == vp->uiVersion) + { + if (GL_TRUE != Process_Vertex_Program_Vfetch_Instructions(vp, mesa_vp) ) + { + radeon_error("Calling Process_Vertex_Program_Vfetch_Instructions return error. \n"); + return; + } + } + else + { + if (GL_TRUE != Process_Vertex_Program_Vfetch_Instructions2(ctx, vp, mesa_vp) ) + { + radeon_error("Calling Process_Vertex_Program_Vfetch_Instructions2 return error. \n"); + return; + } + } // Map Outputs pAsm->number_of_exports = Map_Vertex_Output(pAsm, mesa_vp, pAsm->number_used_registers); @@ -261,7 +300,8 @@ GLboolean Find_Instruction_Dependencies_vp(struct r700_vertex_program *vp, } struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, - struct gl_vertex_program *mesa_vp) + struct gl_vertex_program *mesa_vp, + GLint nVer) { context_t *context = R700_CONTEXT(ctx); struct r700_vertex_program *vp; @@ -271,6 +311,7 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, unsigned int i; vp = _mesa_calloc(sizeof(*vp)); + vp->uiVersion = nVer; vp->mesa_program = (struct gl_vertex_program *)_mesa_clone_program(ctx, &mesa_vp->Base); if (mesa_vp->IsPositionInvariant) @@ -296,7 +337,7 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, //Init_Program Init_r700_AssemblerBase(SPT_VP, &(vp->r700AsmCode), &(vp->r700Shader) ); - Map_Vertex_Program( vp, vp->mesa_program ); + Map_Vertex_Program(ctx, vp, vp->mesa_program ); if(GL_FALSE == Find_Instruction_Dependencies_vp(vp, vp->mesa_program)) { @@ -325,7 +366,7 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, return vp; } -void r700SelectVertexShader(GLcontext *ctx) +void r700SelectVertexShader(GLcontext *ctx, GLint nVersion) { context_t *context = R700_CONTEXT(ctx); struct r700_vertex_program_cont *vpc; @@ -365,7 +406,7 @@ void r700SelectVertexShader(GLcontext *ctx) } } - vp = r700TranslateVertexShader(ctx, &(vpc->mesa_program) ); + vp = r700TranslateVertexShader(ctx, &(vpc->mesa_program), nVersion); if(!vp) { radeon_error("Failed to translate vertex shader. \n"); @@ -377,6 +418,140 @@ void r700SelectVertexShader(GLcontext *ctx) return; } +int getTypeSize(GLenum type) +{ + switch (type) + { + case GL_DOUBLE: + return sizeof(GLdouble); + case GL_FLOAT: + return sizeof(GLfloat); + case GL_INT: + return sizeof(GLint); + case GL_UNSIGNED_INT: + return sizeof(GLuint); + case GL_SHORT: + return sizeof(GLshort); + case GL_UNSIGNED_SHORT: + return sizeof(GLushort); + case GL_BYTE: + return sizeof(GLbyte); + case GL_UNSIGNED_BYTE: + return sizeof(GLubyte); + default: + assert(0); + return 0; + } +} + +static void r700TranslateAttrib(GLcontext *ctx, GLuint unLoc, int count, const struct gl_client_array *input) +{ + context_t *context = R700_CONTEXT(ctx); + + StreamDesc * pStreamDesc = &(context->stream_desc[context->nNumActiveAos]); + + GLuint stride; + + stride = (input->StrideB == 0) ? getTypeSize(input->Type) * input->Size + : input->StrideB; + + if (input->Type == GL_DOUBLE || input->Type == GL_UNSIGNED_INT || input->Type == GL_INT || +#if MESA_BIG_ENDIAN + getTypeSize(input->Type) != 4 || +#endif + stride < 4) + { + pStreamDesc->type = GL_FLOAT; + + if (input->StrideB == 0) + { + pStreamDesc->stride = 0; + } + else + { + pStreamDesc->stride = sizeof(GLfloat) * input->Size; + } + pStreamDesc->dwords = input->Size; + pStreamDesc->is_named_bo = GL_FALSE; + } + else + { + pStreamDesc->type = input->Type; + pStreamDesc->dwords = (getTypeSize(input->Type) * input->Size + 3)/ 4; + if (!input->BufferObj->Name) + { + if (input->StrideB == 0) + { + pStreamDesc->stride = 0; + } + else + { + pStreamDesc->stride = (getTypeSize(pStreamDesc->type) * input->Size + 3) & ~3; + } + + pStreamDesc->is_named_bo = GL_FALSE; + } + } + + pStreamDesc->size = input->Size; + pStreamDesc->dst_loc = context->nNumActiveAos; + pStreamDesc->element = unLoc; + + switch (pStreamDesc->type) + { //GetSurfaceFormat + case GL_FLOAT: + pStreamDesc->_signed = 0; + pStreamDesc->normalize = GL_FALSE; + break; + case GL_SHORT: + pStreamDesc->_signed = 1; + pStreamDesc->normalize = input->Normalized; + break; + case GL_BYTE: + pStreamDesc->_signed = 1; + pStreamDesc->normalize = input->Normalized; + break; + case GL_UNSIGNED_SHORT: + pStreamDesc->_signed = 0; + pStreamDesc->normalize = input->Normalized; + break; + case GL_UNSIGNED_BYTE: + pStreamDesc->_signed = 0; + pStreamDesc->normalize = input->Normalized; + break; + default: + case GL_INT: + case GL_UNSIGNED_INT: + case GL_DOUBLE: + assert(0); + break; + } + context->nNumActiveAos++; +} + +void r700SetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], int count) +{ + context_t *context = R700_CONTEXT(ctx); + struct r700_vertex_program *vpc + = (struct r700_vertex_program *)ctx->VertexProgram._Current; + + struct gl_vertex_program * mesa_vp = (struct gl_vertex_program *)&(vpc->mesa_program); + unsigned int unLoc = 0; + unsigned int unBit = mesa_vp->Base.InputsRead; + context->nNumActiveAos = 0; + + while(unBit) + { + if(unBit & 1) + { + r700TranslateAttrib(ctx, unLoc, count, arrays[unLoc]); + } + + unBit >>= 1; + ++unLoc; + } +} + void * r700GetActiveVpShaderBo(GLcontext * ctx) { context_t *context = R700_CONTEXT(ctx); diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.h b/src/mesa/drivers/dri/r600/r700_vertprog.h index c48764c43b..f9a3e395ee 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.h +++ b/src/mesa/drivers/dri/r600/r700_vertprog.h @@ -52,7 +52,7 @@ struct r700_vertex_program GLboolean translated; GLboolean loaded; - GLboolean needUpdateVF; + GLint uiVersion; void * shaderbo; @@ -76,19 +76,28 @@ unsigned int Map_Vertex_Input(r700_AssemblerBase *pAsm, GLboolean Process_Vertex_Program_Vfetch_Instructions( struct r700_vertex_program *vp, struct gl_vertex_program *mesa_vp); -void Map_Vertex_Program(struct r700_vertex_program *vp, +GLboolean Process_Vertex_Program_Vfetch_Instructions2( + GLcontext *ctx, + struct r700_vertex_program *vp, + struct gl_vertex_program *mesa_vp); +void Map_Vertex_Program(GLcontext *ctx, + struct r700_vertex_program *vp, struct gl_vertex_program *mesa_vp); GLboolean Find_Instruction_Dependencies_vp(struct r700_vertex_program *vp, struct gl_vertex_program *mesa_vp); struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, - struct gl_vertex_program *mesa_vp); + struct gl_vertex_program *mesa_vp, + GLint nVer); /* Interface */ -extern void r700SelectVertexShader(GLcontext *ctx); +extern void r700SelectVertexShader(GLcontext *ctx, GLint nVersion); +extern void r700SetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], int count); extern GLboolean r700SetupVertexProgram(GLcontext * ctx); extern void * r700GetActiveVpShaderBo(GLcontext * ctx); +extern int getTypeSize(GLenum type); + #endif /* _R700_VERTPROG_H_ */ diff --git a/src/mesa/drivers/dri/r600/radeon_buffer_objects.c b/src/mesa/drivers/dri/r600/radeon_buffer_objects.c new file mode 120000 index 0000000000..f6a5f66470 --- /dev/null +++ b/src/mesa/drivers/dri/r600/radeon_buffer_objects.c @@ -0,0 +1 @@ +../radeon/radeon_buffer_objects.c \ No newline at end of file diff --git a/src/mesa/drivers/dri/r600/radeon_buffer_objects.h b/src/mesa/drivers/dri/r600/radeon_buffer_objects.h new file mode 120000 index 0000000000..2f134fd17b --- /dev/null +++ b/src/mesa/drivers/dri/r600/radeon_buffer_objects.h @@ -0,0 +1 @@ +../radeon/radeon_buffer_objects.h \ No newline at end of file -- cgit v1.2.3 From 98d5ec10d0918f6619e7b2285278b83e9de6d86f Mon Sep 17 00:00:00 2001 From: Richard Li Date: Tue, 22 Sep 2009 17:26:23 -0400 Subject: r600 : add draw_prim support, make up one lost change. --- src/mesa/drivers/dri/r600/r600_context.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index 6fc6d9d7bf..969144ba12 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -59,6 +59,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_debug.h" #include "r600_context.h" #include "radeon_common_context.h" +#include "radeon_buffer_objects.h" #include "radeon_span.h" #include "r600_cmdbuf.h" #include "r600_emit.h" -- cgit v1.2.3 From 926b965ed53efc06a9d7cc6e07eff853b263960a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 22 Sep 2009 15:58:12 -0600 Subject: mesa: don't re-use the meta glDrawPixels VBO; create a new one each time This should help to work around bugs 24083 and 23670. --- src/mesa/drivers/common/meta.c | 52 ++++++++++++++++++------------------------ 1 file changed, 22 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index ddd476eba1..2741a41bf3 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -174,7 +174,6 @@ struct copypix_state struct drawpix_state { GLuint ArrayObj; - GLuint VBO; GLuint StencilFP; /**< Fragment program for drawing stencil images */ GLuint DepthFP; /**< Fragment program for drawing depth images */ @@ -262,7 +261,6 @@ _mesa_meta_free(GLcontext *ctx) _mesa_DeleteVertexArraysAPPLE(1, &meta->CopyPix.ArrayObj); /* glDrawPixels */ - _mesa_DeleteBuffersARB(1, & meta->DrawPix.VBO); _mesa_DeleteVertexArraysAPPLE(1, &meta->DrawPix.ArrayObj); _mesa_DeletePrograms(1, &meta->DrawPix.DepthFP); _mesa_DeletePrograms(1, &meta->DrawPix.StencilFP); @@ -1430,6 +1428,7 @@ _mesa_meta_draw_pixels(GLcontext *ctx, GLenum texIntFormat; GLboolean fallback, newTex; GLbitfield metaExtraSave = 0x0; + GLuint vbo; /* * Determine if we can do the glDrawPixels with texture mapping. @@ -1509,32 +1508,6 @@ _mesa_meta_draw_pixels(GLcontext *ctx, META_VIEWPORT | metaExtraSave)); - if (drawpix->ArrayObj == 0) { - /* one-time setup */ - - /* create vertex array object */ - _mesa_GenVertexArrays(1, &drawpix->ArrayObj); - _mesa_BindVertexArray(drawpix->ArrayObj); - - /* create vertex array buffer */ - _mesa_GenBuffersARB(1, &drawpix->VBO); - _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, drawpix->VBO); - _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), - NULL, GL_DYNAMIC_DRAW_ARB); - - /* setup vertex arrays */ - _mesa_VertexPointer(3, GL_FLOAT, sizeof(verts[0]), - (void *) (0 * sizeof(GLfloat))); - _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(verts[0]), - (void *) (3 * sizeof(GLfloat))); - _mesa_EnableClientState(GL_VERTEX_ARRAY); - _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); - } - else { - _mesa_BindVertexArray(drawpix->ArrayObj); - _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, drawpix->VBO); - } - newTex = alloc_texture(tex, width, height, texIntFormat); /* vertex positions, texcoords (after texture allocation!) */ @@ -1565,10 +1538,27 @@ _mesa_meta_draw_pixels(GLcontext *ctx, verts[3][2] = z; verts[3][3] = 0.0F; verts[3][4] = tex->Ttop; + } - /* upload new vertex data */ - _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts); + if (drawpix->ArrayObj == 0) { + /* one-time setup: create vertex array object */ + _mesa_GenVertexArrays(1, &drawpix->ArrayObj); } + _mesa_BindVertexArray(drawpix->ArrayObj); + + /* create vertex array buffer */ + _mesa_GenBuffersARB(1, &vbo); + _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, vbo); + _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), + verts, GL_DYNAMIC_DRAW_ARB); + + /* setup vertex arrays */ + _mesa_VertexPointer(3, GL_FLOAT, sizeof(verts[0]), + (void *) (0 * sizeof(GLfloat))); + _mesa_TexCoordPointer(2, GL_FLOAT, sizeof(verts[0]), + (void *) (3 * sizeof(GLfloat))); + _mesa_EnableClientState(GL_VERTEX_ARRAY); + _mesa_EnableClientState(GL_TEXTURE_COORD_ARRAY); /* set given unpack params */ ctx->Unpack = *unpack; @@ -1639,6 +1629,8 @@ _mesa_meta_draw_pixels(GLcontext *ctx, _mesa_Disable(tex->Target); + _mesa_DeleteBuffersARB(1, &vbo); + /* restore unpack params */ ctx->Unpack = unpackSave; -- cgit v1.2.3 From 0670df5cb20c0b6630ab29511d9b2cbe18b47f65 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 22 Sep 2009 16:42:15 -0600 Subject: softpipe: disable a _debug_printf() --- src/gallium/drivers/softpipe/sp_state_derived.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index 2a40589e84..856c9ce176 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -203,7 +203,9 @@ update_tgsi_samplers( struct softpipe_context *softpipe ) struct softpipe_texture *spt = softpipe_texture(tc->texture); if (spt->timestamp != tc->timestamp) { sp_tex_tile_cache_validate_texture( tc ); + /* _debug_printf("INV %d %d\n", tc->timestamp, spt->timestamp); + */ tc->timestamp = spt->timestamp; } } -- cgit v1.2.3 From 5dbedf3d7e99efe35fad308d382670e44cd60e25 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 22 Sep 2009 16:59:28 -0600 Subject: softpipe: additional assertions --- src/gallium/drivers/softpipe/sp_tex_sample.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 50460df7cd..be210d5671 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -938,6 +938,7 @@ img_filter_2d_nearest(struct tgsi_sampler *tgsi_sampler, height = texture->height[level0]; assert(width > 0); + assert(height > 0); addr.value = 0; addr.bits.level = samp->level; @@ -983,6 +984,7 @@ img_filter_cube_nearest(struct tgsi_sampler *tgsi_sampler, height = texture->height[level0]; assert(width > 0); + assert(height > 0); addr.value = 0; addr.bits.level = samp->level; @@ -1104,6 +1106,7 @@ img_filter_2d_linear(struct tgsi_sampler *tgsi_sampler, height = texture->height[level0]; assert(width > 0); + assert(height > 0); addr.value = 0; addr.bits.level = samp->level; @@ -1151,6 +1154,7 @@ img_filter_cube_linear(struct tgsi_sampler *tgsi_sampler, height = texture->height[level0]; assert(width > 0); + assert(height > 0); addr.value = 0; addr.bits.level = samp->level; -- cgit v1.2.3 From 75276ea316610a5737f2115326482024aa09d02a Mon Sep 17 00:00:00 2001 From: root Date: Tue, 22 Sep 2009 20:14:05 -0600 Subject: softpipe: fix bugs in POT texture sampling when texture is not square Before, if level was greater than the logbase2(base size) we were doing a negative bit shift and winding up with garbage values. --- src/gallium/drivers/softpipe/sp_tex_sample.c | 34 +++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index be210d5671..ba9b91a378 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -732,6 +732,20 @@ get_texel_3d(const struct sp_sampler_varient *samp, } +/** + * Given the logbase2 of a mipmap's base level size and a mipmap level, + * return the size (in texels) of that mipmap level. + * For example, if level[0].width = 256 then base_pot will be 8. + * If level = 2, then we'll return 64 (the width at level=2). + * Return 1 if level > base_pot. + */ +static INLINE unsigned +pot_level_size(unsigned base_pot, unsigned level) +{ + return (base_pot >= level) ? (1 << (base_pot - level)) : 1; +} + + /* Some image-filter fastpaths: */ static INLINE void @@ -745,8 +759,8 @@ img_filter_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler, const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); unsigned j; unsigned level = samp->level; - unsigned xpot = 1 << (samp->xpot - level); - unsigned ypot = 1 << (samp->ypot - level); + unsigned xpot = pot_level_size(samp->xpot, level); + unsigned ypot = pot_level_size(samp->ypot, level); unsigned xmax = (xpot - 1) & (TILE_SIZE - 1); /* MIN2(TILE_SIZE, xpot) - 1; */ unsigned ymax = (ypot - 1) & (TILE_SIZE - 1); /* MIN2(TILE_SIZE, ypot) - 1; */ union tex_tile_address addr; @@ -807,8 +821,8 @@ img_filter_2d_nearest_repeat_POT(struct tgsi_sampler *tgsi_sampler, const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); unsigned j; unsigned level = samp->level; - unsigned xpot = 1 << (samp->xpot - level); - unsigned ypot = 1 << (samp->ypot - level); + unsigned xpot = pot_level_size(samp->xpot, level); + unsigned ypot = pot_level_size(samp->ypot, level); union tex_tile_address addr; addr.value = 0; @@ -846,8 +860,8 @@ img_filter_2d_nearest_clamp_POT(struct tgsi_sampler *tgsi_sampler, const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); unsigned j; unsigned level = samp->level; - unsigned xpot = 1 << (samp->xpot - level); - unsigned ypot = 1 << (samp->ypot - level); + unsigned xpot = pot_level_size(samp->xpot, level); + unsigned ypot = pot_level_size(samp->ypot, level); union tex_tile_address addr; addr.value = 0; @@ -1311,6 +1325,14 @@ mip_filter_nearest(struct tgsi_sampler *tgsi_sampler, samp->level = MIN2(samp->level, (int)texture->last_level); samp->min_img_filter( tgsi_sampler, s, t, p, 0, rgba ); } + +#if 0 + printf("RGBA %g %g %g %g, %g %g %g %g, %g %g %g %g, %g %g %g %g\n", + rgba[0][0], rgba[1][0], rgba[2][0], rgba[3][0], + rgba[0][1], rgba[1][1], rgba[2][1], rgba[3][1], + rgba[0][2], rgba[1][2], rgba[2][2], rgba[3][2], + rgba[0][3], rgba[1][3], rgba[2][3], rgba[3][3]); +#endif } -- cgit v1.2.3 From 21a949365d1de2f1fea6cb87c6f389e30156566f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 22 Sep 2009 17:16:35 +0100 Subject: gallium: Update vendor string. --- src/gallium/drivers/cell/ppu/cell_screen.c | 2 +- src/gallium/drivers/i915simple/i915_screen.c | 2 +- src/gallium/drivers/i965simple/brw_screen.c | 2 +- src/gallium/drivers/softpipe/sp_screen.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/cell/ppu/cell_screen.c b/src/gallium/drivers/cell/ppu/cell_screen.c index 9161747fdb..d185c6b849 100644 --- a/src/gallium/drivers/cell/ppu/cell_screen.c +++ b/src/gallium/drivers/cell/ppu/cell_screen.c @@ -41,7 +41,7 @@ static const char * cell_get_vendor(struct pipe_screen *screen) { - return "Tungsten Graphics, Inc."; + return "VMware, Inc."; } diff --git a/src/gallium/drivers/i915simple/i915_screen.c b/src/gallium/drivers/i915simple/i915_screen.c index a1dd43c1bc..c66558c320 100644 --- a/src/gallium/drivers/i915simple/i915_screen.c +++ b/src/gallium/drivers/i915simple/i915_screen.c @@ -46,7 +46,7 @@ static const char * i915_get_vendor(struct pipe_screen *screen) { - return "Tungsten Graphics, Inc."; + return "VMware, Inc."; } static const char * diff --git a/src/gallium/drivers/i965simple/brw_screen.c b/src/gallium/drivers/i965simple/brw_screen.c index fb68fd624b..4a84c4db23 100644 --- a/src/gallium/drivers/i965simple/brw_screen.c +++ b/src/gallium/drivers/i965simple/brw_screen.c @@ -39,7 +39,7 @@ static const char * brw_get_vendor( struct pipe_screen *screen ) { - return "Tungsten Graphics, Inc."; + return "VMware, Inc."; } diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index ce77018415..6cf45cded2 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -40,7 +40,7 @@ static const char * softpipe_get_vendor(struct pipe_screen *screen) { - return "Tungsten Graphics, Inc."; + return "VMware, Inc."; } -- cgit v1.2.3 From 8d1af5991d739e33962e8ca52c6a5ce1c9204ce6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 22 Sep 2009 17:25:22 +0100 Subject: wgl: Fix debug_printf format specifiers. --- src/gallium/state_trackers/wgl/icd/stw_icd.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/wgl/icd/stw_icd.c b/src/gallium/state_trackers/wgl/icd/stw_icd.c index 347f40aa06..7dc6841fed 100644 --- a/src/gallium/state_trackers/wgl/icd/stw_icd.c +++ b/src/gallium/state_trackers/wgl/icd/stw_icd.c @@ -59,7 +59,7 @@ DrvCreateLayerContext( r = stw_create_layer_context( hdc, iLayerPlane ); if (DBG) - debug_printf( "%s( %p, %i ) = %u\n", + debug_printf( "%s( %p, %i ) = %lu\n", __FUNCTION__, hdc, iLayerPlane, r ); return r; @@ -81,7 +81,7 @@ DrvDeleteContext( r = stw_delete_context( dhglrc ); if (DBG) - debug_printf( "%s( %u ) = %u\n", + debug_printf( "%s( %lu ) = %u\n", __FUNCTION__, dhglrc, r ); return r; @@ -113,7 +113,7 @@ DrvDescribePixelFormat( r = stw_pixelformat_describe( hdc, iPixelFormat, cjpfd, ppfd ); if (DBG) - debug_printf( "%s( %p, %d, %u, %p ) = %d\n", + debug_printf( "%s( %p, %i, %lu, %p ) = %li\n", __FUNCTION__, hdc, iPixelFormat, cjpfd, ppfd, r ); return r; @@ -537,7 +537,7 @@ DrvSetContext( r = NULL; if (DBG) - debug_printf( "%s( 0x%p, %u, 0x%p ) = %p\n", + debug_printf( "%s( 0x%p, %lu, 0x%p ) = %p\n", __FUNCTION__, hdc, dhglrc, pfnSetProcTable, r ); return r; @@ -567,7 +567,7 @@ DrvSetPixelFormat( r = stw_pixelformat_set( hdc, iPixelFormat ); if (DBG) - debug_printf( "%s( %p, %d ) = %s\n", __FUNCTION__, hdc, iPixelFormat, r ? "TRUE" : "FALSE" ); + debug_printf( "%s( %p, %li ) = %s\n", __FUNCTION__, hdc, iPixelFormat, r ? "TRUE" : "FALSE" ); return r; } @@ -609,7 +609,7 @@ DrvValidateVersion( ULONG ulVersion ) { if (DBG) - debug_printf( "%s( %u )\n", __FUNCTION__, ulVersion ); + debug_printf( "%s( %lu )\n", __FUNCTION__, ulVersion ); /* TODO: get the expected version from the winsys */ -- cgit v1.2.3 From f724036f0045bd28f323af3666c43b3ef03b6886 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 22 Sep 2009 17:40:20 +0100 Subject: wgl: Flatten the source tree. It is easier to have the WGL API on top of the ICD callbacks as Microsoft's own implementation does, than to have a seperate shared entity. This source reorganization is in antecipation of that. --- src/gallium/state_trackers/wgl/SConscript | 26 +- src/gallium/state_trackers/wgl/icd/stw_icd.c | 617 --------------------- src/gallium/state_trackers/wgl/icd/stw_icd.h | 489 ---------------- .../state_trackers/wgl/shared/stw_arbpixelformat.c | 483 ---------------- .../state_trackers/wgl/shared/stw_context.c | 382 ------------- .../state_trackers/wgl/shared/stw_context.h | 43 -- src/gallium/state_trackers/wgl/shared/stw_device.c | 225 -------- src/gallium/state_trackers/wgl/shared/stw_device.h | 77 --- .../wgl/shared/stw_extensionsstring.c | 59 -- .../state_trackers/wgl/shared/stw_extgallium.c | 79 --- .../state_trackers/wgl/shared/stw_extgallium.h | 47 -- .../wgl/shared/stw_extswapinterval.c | 57 -- .../state_trackers/wgl/shared/stw_framebuffer.c | 493 ---------------- .../state_trackers/wgl/shared/stw_framebuffer.h | 148 ----- .../state_trackers/wgl/shared/stw_getprocaddress.c | 86 --- .../state_trackers/wgl/shared/stw_pixelformat.c | 370 ------------ .../state_trackers/wgl/shared/stw_pixelformat.h | 65 --- src/gallium/state_trackers/wgl/shared/stw_public.h | 73 --- src/gallium/state_trackers/wgl/shared/stw_tls.c | 139 ----- src/gallium/state_trackers/wgl/shared/stw_tls.h | 59 -- src/gallium/state_trackers/wgl/shared/stw_winsys.h | 65 --- src/gallium/state_trackers/wgl/stw_context.c | 382 +++++++++++++ src/gallium/state_trackers/wgl/stw_context.h | 43 ++ src/gallium/state_trackers/wgl/stw_device.c | 225 ++++++++ src/gallium/state_trackers/wgl/stw_device.h | 77 +++ .../state_trackers/wgl/stw_ext_extensionsstring.c | 59 ++ src/gallium/state_trackers/wgl/stw_ext_gallium.c | 80 +++ src/gallium/state_trackers/wgl/stw_ext_gallium.h | 47 ++ .../state_trackers/wgl/stw_ext_pixelformat.c | 483 ++++++++++++++++ .../state_trackers/wgl/stw_ext_swapinterval.c | 57 ++ src/gallium/state_trackers/wgl/stw_framebuffer.c | 493 ++++++++++++++++ src/gallium/state_trackers/wgl/stw_framebuffer.h | 148 +++++ .../state_trackers/wgl/stw_getprocaddress.c | 86 +++ src/gallium/state_trackers/wgl/stw_icd.c | 617 +++++++++++++++++++++ src/gallium/state_trackers/wgl/stw_icd.h | 489 ++++++++++++++++ src/gallium/state_trackers/wgl/stw_pixelformat.c | 370 ++++++++++++ src/gallium/state_trackers/wgl/stw_pixelformat.h | 65 +++ src/gallium/state_trackers/wgl/stw_public.h | 73 +++ src/gallium/state_trackers/wgl/stw_tls.c | 139 +++++ src/gallium/state_trackers/wgl/stw_tls.h | 59 ++ src/gallium/state_trackers/wgl/stw_wgl.c | 329 +++++++++++ src/gallium/state_trackers/wgl/stw_wgl.h | 63 +++ src/gallium/state_trackers/wgl/stw_winsys.h | 65 +++ src/gallium/state_trackers/wgl/wgl/stw_wgl.c | 329 ----------- src/gallium/state_trackers/wgl/wgl/stw_wgl.h | 63 --- 45 files changed, 4461 insertions(+), 4462 deletions(-) delete mode 100644 src/gallium/state_trackers/wgl/icd/stw_icd.c delete mode 100644 src/gallium/state_trackers/wgl/icd/stw_icd.h delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_context.c delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_context.h delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_device.c delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_device.h delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_extensionsstring.c delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_extgallium.c delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_extgallium.h delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_extswapinterval.c delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_framebuffer.c delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_framebuffer.h delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_pixelformat.c delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_pixelformat.h delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_public.h delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_tls.c delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_tls.h delete mode 100644 src/gallium/state_trackers/wgl/shared/stw_winsys.h create mode 100644 src/gallium/state_trackers/wgl/stw_context.c create mode 100644 src/gallium/state_trackers/wgl/stw_context.h create mode 100644 src/gallium/state_trackers/wgl/stw_device.c create mode 100644 src/gallium/state_trackers/wgl/stw_device.h create mode 100644 src/gallium/state_trackers/wgl/stw_ext_extensionsstring.c create mode 100644 src/gallium/state_trackers/wgl/stw_ext_gallium.c create mode 100644 src/gallium/state_trackers/wgl/stw_ext_gallium.h create mode 100644 src/gallium/state_trackers/wgl/stw_ext_pixelformat.c create mode 100644 src/gallium/state_trackers/wgl/stw_ext_swapinterval.c create mode 100644 src/gallium/state_trackers/wgl/stw_framebuffer.c create mode 100644 src/gallium/state_trackers/wgl/stw_framebuffer.h create mode 100644 src/gallium/state_trackers/wgl/stw_getprocaddress.c create mode 100644 src/gallium/state_trackers/wgl/stw_icd.c create mode 100644 src/gallium/state_trackers/wgl/stw_icd.h create mode 100644 src/gallium/state_trackers/wgl/stw_pixelformat.c create mode 100644 src/gallium/state_trackers/wgl/stw_pixelformat.h create mode 100644 src/gallium/state_trackers/wgl/stw_public.h create mode 100644 src/gallium/state_trackers/wgl/stw_tls.c create mode 100644 src/gallium/state_trackers/wgl/stw_tls.h create mode 100644 src/gallium/state_trackers/wgl/stw_wgl.c create mode 100644 src/gallium/state_trackers/wgl/stw_wgl.h create mode 100644 src/gallium/state_trackers/wgl/stw_winsys.h delete mode 100644 src/gallium/state_trackers/wgl/wgl/stw_wgl.c delete mode 100644 src/gallium/state_trackers/wgl/wgl/stw_wgl.h (limited to 'src') diff --git a/src/gallium/state_trackers/wgl/SConscript b/src/gallium/state_trackers/wgl/SConscript index 69b88618ec..2e9aacb6e2 100644 --- a/src/gallium/state_trackers/wgl/SConscript +++ b/src/gallium/state_trackers/wgl/SConscript @@ -18,20 +18,18 @@ if env['platform'] in ['windows']: ]) sources = [ - 'icd/stw_icd.c', - - 'wgl/stw_wgl.c', - - 'shared/stw_context.c', - 'shared/stw_device.c', - 'shared/stw_framebuffer.c', - 'shared/stw_pixelformat.c', - 'shared/stw_extensionsstring.c', - 'shared/stw_extswapinterval.c', - 'shared/stw_getprocaddress.c', - 'shared/stw_extgallium.c', - 'shared/stw_arbpixelformat.c', - 'shared/stw_tls.c', + 'stw_context.c', + 'stw_device.c', + 'stw_ext_extensionsstring.c', + 'stw_ext_gallium.c', + 'stw_ext_pixelformat.c', + 'stw_ext_swapinterval.c', + 'stw_framebuffer.c', + 'stw_getprocaddress.c', + 'stw_icd.c', + 'stw_pixelformat.c', + 'stw_tls.c', + 'stw_wgl.c', ] wgl = env.ConvenienceLibrary( diff --git a/src/gallium/state_trackers/wgl/icd/stw_icd.c b/src/gallium/state_trackers/wgl/icd/stw_icd.c deleted file mode 100644 index 7dc6841fed..0000000000 --- a/src/gallium/state_trackers/wgl/icd/stw_icd.c +++ /dev/null @@ -1,617 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include -#include - -#include "GL/gl.h" - -#include "util/u_debug.h" -#include "pipe/p_thread.h" - -#include "shared/stw_public.h" -#include "icd/stw_icd.h" - -#define DBG 0 - - -BOOL APIENTRY -DrvCopyContext( - DHGLRC dhrcSource, - DHGLRC dhrcDest, - UINT fuMask ) -{ - return stw_copy_context(dhrcSource, dhrcDest, fuMask); -} - - -DHGLRC APIENTRY -DrvCreateLayerContext( - HDC hdc, - INT iLayerPlane ) -{ - DHGLRC r; - - r = stw_create_layer_context( hdc, iLayerPlane ); - - if (DBG) - debug_printf( "%s( %p, %i ) = %lu\n", - __FUNCTION__, hdc, iLayerPlane, r ); - - return r; -} - -DHGLRC APIENTRY -DrvCreateContext( - HDC hdc ) -{ - return DrvCreateLayerContext( hdc, 0 ); -} - -BOOL APIENTRY -DrvDeleteContext( - DHGLRC dhglrc ) -{ - BOOL r; - - r = stw_delete_context( dhglrc ); - - if (DBG) - debug_printf( "%s( %lu ) = %u\n", - __FUNCTION__, dhglrc, r ); - - return r; -} - -BOOL APIENTRY -DrvDescribeLayerPlane( - HDC hdc, - INT iPixelFormat, - INT iLayerPlane, - UINT nBytes, - LPLAYERPLANEDESCRIPTOR plpd ) -{ - if (DBG) - debug_printf( "%s\n", __FUNCTION__ ); - - return FALSE; -} - -LONG APIENTRY -DrvDescribePixelFormat( - HDC hdc, - INT iPixelFormat, - ULONG cjpfd, - PIXELFORMATDESCRIPTOR *ppfd ) -{ - LONG r; - - r = stw_pixelformat_describe( hdc, iPixelFormat, cjpfd, ppfd ); - - if (DBG) - debug_printf( "%s( %p, %i, %lu, %p ) = %li\n", - __FUNCTION__, hdc, iPixelFormat, cjpfd, ppfd, r ); - - return r; -} - -int APIENTRY -DrvGetLayerPaletteEntries( - HDC hdc, - INT iLayerPlane, - INT iStart, - INT cEntries, - COLORREF *pcr ) -{ - if (DBG) - debug_printf( "%s\n", __FUNCTION__ ); - - return 0; -} - -PROC APIENTRY -DrvGetProcAddress( - LPCSTR lpszProc ) -{ - PROC r; - - r = stw_get_proc_address( lpszProc ); - - if (DBG) - debug_printf( "%s( \"%s\" ) = %p\n", __FUNCTION__, lpszProc, r ); - - return r; -} - -BOOL APIENTRY -DrvRealizeLayerPalette( - HDC hdc, - INT iLayerPlane, - BOOL bRealize ) -{ - if (DBG) - debug_printf( "%s\n", __FUNCTION__ ); - - return FALSE; -} - -BOOL APIENTRY -DrvReleaseContext( - DHGLRC dhglrc ) -{ - return stw_release_context(dhglrc); -} - -void APIENTRY -DrvSetCallbackProcs( - INT nProcs, - PROC *pProcs ) -{ - if (DBG) - debug_printf( "%s( %d, %p )\n", __FUNCTION__, nProcs, pProcs ); - - return; -} - - -/** - * Although WGL allows different dispatch entrypoints per context - */ -static const GLCLTPROCTABLE cpt = -{ - OPENGL_VERSION_110_ENTRIES, - { - &glNewList, - &glEndList, - &glCallList, - &glCallLists, - &glDeleteLists, - &glGenLists, - &glListBase, - &glBegin, - &glBitmap, - &glColor3b, - &glColor3bv, - &glColor3d, - &glColor3dv, - &glColor3f, - &glColor3fv, - &glColor3i, - &glColor3iv, - &glColor3s, - &glColor3sv, - &glColor3ub, - &glColor3ubv, - &glColor3ui, - &glColor3uiv, - &glColor3us, - &glColor3usv, - &glColor4b, - &glColor4bv, - &glColor4d, - &glColor4dv, - &glColor4f, - &glColor4fv, - &glColor4i, - &glColor4iv, - &glColor4s, - &glColor4sv, - &glColor4ub, - &glColor4ubv, - &glColor4ui, - &glColor4uiv, - &glColor4us, - &glColor4usv, - &glEdgeFlag, - &glEdgeFlagv, - &glEnd, - &glIndexd, - &glIndexdv, - &glIndexf, - &glIndexfv, - &glIndexi, - &glIndexiv, - &glIndexs, - &glIndexsv, - &glNormal3b, - &glNormal3bv, - &glNormal3d, - &glNormal3dv, - &glNormal3f, - &glNormal3fv, - &glNormal3i, - &glNormal3iv, - &glNormal3s, - &glNormal3sv, - &glRasterPos2d, - &glRasterPos2dv, - &glRasterPos2f, - &glRasterPos2fv, - &glRasterPos2i, - &glRasterPos2iv, - &glRasterPos2s, - &glRasterPos2sv, - &glRasterPos3d, - &glRasterPos3dv, - &glRasterPos3f, - &glRasterPos3fv, - &glRasterPos3i, - &glRasterPos3iv, - &glRasterPos3s, - &glRasterPos3sv, - &glRasterPos4d, - &glRasterPos4dv, - &glRasterPos4f, - &glRasterPos4fv, - &glRasterPos4i, - &glRasterPos4iv, - &glRasterPos4s, - &glRasterPos4sv, - &glRectd, - &glRectdv, - &glRectf, - &glRectfv, - &glRecti, - &glRectiv, - &glRects, - &glRectsv, - &glTexCoord1d, - &glTexCoord1dv, - &glTexCoord1f, - &glTexCoord1fv, - &glTexCoord1i, - &glTexCoord1iv, - &glTexCoord1s, - &glTexCoord1sv, - &glTexCoord2d, - &glTexCoord2dv, - &glTexCoord2f, - &glTexCoord2fv, - &glTexCoord2i, - &glTexCoord2iv, - &glTexCoord2s, - &glTexCoord2sv, - &glTexCoord3d, - &glTexCoord3dv, - &glTexCoord3f, - &glTexCoord3fv, - &glTexCoord3i, - &glTexCoord3iv, - &glTexCoord3s, - &glTexCoord3sv, - &glTexCoord4d, - &glTexCoord4dv, - &glTexCoord4f, - &glTexCoord4fv, - &glTexCoord4i, - &glTexCoord4iv, - &glTexCoord4s, - &glTexCoord4sv, - &glVertex2d, - &glVertex2dv, - &glVertex2f, - &glVertex2fv, - &glVertex2i, - &glVertex2iv, - &glVertex2s, - &glVertex2sv, - &glVertex3d, - &glVertex3dv, - &glVertex3f, - &glVertex3fv, - &glVertex3i, - &glVertex3iv, - &glVertex3s, - &glVertex3sv, - &glVertex4d, - &glVertex4dv, - &glVertex4f, - &glVertex4fv, - &glVertex4i, - &glVertex4iv, - &glVertex4s, - &glVertex4sv, - &glClipPlane, - &glColorMaterial, - &glCullFace, - &glFogf, - &glFogfv, - &glFogi, - &glFogiv, - &glFrontFace, - &glHint, - &glLightf, - &glLightfv, - &glLighti, - &glLightiv, - &glLightModelf, - &glLightModelfv, - &glLightModeli, - &glLightModeliv, - &glLineStipple, - &glLineWidth, - &glMaterialf, - &glMaterialfv, - &glMateriali, - &glMaterialiv, - &glPointSize, - &glPolygonMode, - &glPolygonStipple, - &glScissor, - &glShadeModel, - &glTexParameterf, - &glTexParameterfv, - &glTexParameteri, - &glTexParameteriv, - &glTexImage1D, - &glTexImage2D, - &glTexEnvf, - &glTexEnvfv, - &glTexEnvi, - &glTexEnviv, - &glTexGend, - &glTexGendv, - &glTexGenf, - &glTexGenfv, - &glTexGeni, - &glTexGeniv, - &glFeedbackBuffer, - &glSelectBuffer, - &glRenderMode, - &glInitNames, - &glLoadName, - &glPassThrough, - &glPopName, - &glPushName, - &glDrawBuffer, - &glClear, - &glClearAccum, - &glClearIndex, - &glClearColor, - &glClearStencil, - &glClearDepth, - &glStencilMask, - &glColorMask, - &glDepthMask, - &glIndexMask, - &glAccum, - &glDisable, - &glEnable, - &glFinish, - &glFlush, - &glPopAttrib, - &glPushAttrib, - &glMap1d, - &glMap1f, - &glMap2d, - &glMap2f, - &glMapGrid1d, - &glMapGrid1f, - &glMapGrid2d, - &glMapGrid2f, - &glEvalCoord1d, - &glEvalCoord1dv, - &glEvalCoord1f, - &glEvalCoord1fv, - &glEvalCoord2d, - &glEvalCoord2dv, - &glEvalCoord2f, - &glEvalCoord2fv, - &glEvalMesh1, - &glEvalPoint1, - &glEvalMesh2, - &glEvalPoint2, - &glAlphaFunc, - &glBlendFunc, - &glLogicOp, - &glStencilFunc, - &glStencilOp, - &glDepthFunc, - &glPixelZoom, - &glPixelTransferf, - &glPixelTransferi, - &glPixelStoref, - &glPixelStorei, - &glPixelMapfv, - &glPixelMapuiv, - &glPixelMapusv, - &glReadBuffer, - &glCopyPixels, - &glReadPixels, - &glDrawPixels, - &glGetBooleanv, - &glGetClipPlane, - &glGetDoublev, - &glGetError, - &glGetFloatv, - &glGetIntegerv, - &glGetLightfv, - &glGetLightiv, - &glGetMapdv, - &glGetMapfv, - &glGetMapiv, - &glGetMaterialfv, - &glGetMaterialiv, - &glGetPixelMapfv, - &glGetPixelMapuiv, - &glGetPixelMapusv, - &glGetPolygonStipple, - &glGetString, - &glGetTexEnvfv, - &glGetTexEnviv, - &glGetTexGendv, - &glGetTexGenfv, - &glGetTexGeniv, - &glGetTexImage, - &glGetTexParameterfv, - &glGetTexParameteriv, - &glGetTexLevelParameterfv, - &glGetTexLevelParameteriv, - &glIsEnabled, - &glIsList, - &glDepthRange, - &glFrustum, - &glLoadIdentity, - &glLoadMatrixf, - &glLoadMatrixd, - &glMatrixMode, - &glMultMatrixf, - &glMultMatrixd, - &glOrtho, - &glPopMatrix, - &glPushMatrix, - &glRotated, - &glRotatef, - &glScaled, - &glScalef, - &glTranslated, - &glTranslatef, - &glViewport, - &glArrayElement, - &glBindTexture, - &glColorPointer, - &glDisableClientState, - &glDrawArrays, - &glDrawElements, - &glEdgeFlagPointer, - &glEnableClientState, - &glIndexPointer, - &glIndexub, - &glIndexubv, - &glInterleavedArrays, - &glNormalPointer, - &glPolygonOffset, - &glTexCoordPointer, - &glVertexPointer, - &glAreTexturesResident, - &glCopyTexImage1D, - &glCopyTexImage2D, - &glCopyTexSubImage1D, - &glCopyTexSubImage2D, - &glDeleteTextures, - &glGenTextures, - &glGetPointerv, - &glIsTexture, - &glPrioritizeTextures, - &glTexSubImage1D, - &glTexSubImage2D, - &glPopClientAttrib, - &glPushClientAttrib - } -}; - - -PGLCLTPROCTABLE APIENTRY -DrvSetContext( - HDC hdc, - DHGLRC dhglrc, - PFN_SETPROCTABLE pfnSetProcTable ) -{ - PGLCLTPROCTABLE r = (PGLCLTPROCTABLE)&cpt; - - if (!stw_make_current( hdc, dhglrc )) - r = NULL; - - if (DBG) - debug_printf( "%s( 0x%p, %lu, 0x%p ) = %p\n", - __FUNCTION__, hdc, dhglrc, pfnSetProcTable, r ); - - return r; -} - -int APIENTRY -DrvSetLayerPaletteEntries( - HDC hdc, - INT iLayerPlane, - INT iStart, - INT cEntries, - CONST COLORREF *pcr ) -{ - if (DBG) - debug_printf( "%s\n", __FUNCTION__ ); - - return 0; -} - -BOOL APIENTRY -DrvSetPixelFormat( - HDC hdc, - LONG iPixelFormat ) -{ - BOOL r; - - r = stw_pixelformat_set( hdc, iPixelFormat ); - - if (DBG) - debug_printf( "%s( %p, %li ) = %s\n", __FUNCTION__, hdc, iPixelFormat, r ? "TRUE" : "FALSE" ); - - return r; -} - -BOOL APIENTRY -DrvShareLists( - DHGLRC dhglrc1, - DHGLRC dhglrc2 ) -{ - if (DBG) - debug_printf( "%s\n", __FUNCTION__ ); - - return stw_share_lists(dhglrc1, dhglrc2); -} - -BOOL APIENTRY -DrvSwapBuffers( - HDC hdc ) -{ - if (DBG) - debug_printf( "%s( %p )\n", __FUNCTION__, hdc ); - - return stw_swap_buffers( hdc ); -} - -BOOL APIENTRY -DrvSwapLayerBuffers( - HDC hdc, - UINT fuPlanes ) -{ - if (DBG) - debug_printf( "%s\n", __FUNCTION__ ); - - return stw_swap_layer_buffers( hdc, fuPlanes ); -} - -BOOL APIENTRY -DrvValidateVersion( - ULONG ulVersion ) -{ - if (DBG) - debug_printf( "%s( %lu )\n", __FUNCTION__, ulVersion ); - - /* TODO: get the expected version from the winsys */ - - return ulVersion == 1; -} diff --git a/src/gallium/state_trackers/wgl/icd/stw_icd.h b/src/gallium/state_trackers/wgl/icd/stw_icd.h deleted file mode 100644 index cbc1a66548..0000000000 --- a/src/gallium/state_trackers/wgl/icd/stw_icd.h +++ /dev/null @@ -1,489 +0,0 @@ -/************************************************************************** - * - * 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. - * - **************************************************************************/ - -#ifndef STW_ICD_H -#define STW_ICD_H - - -#include - -#include "GL/gl.h" - - -typedef ULONG DHGLRC; - -#define OPENGL_VERSION_110_ENTRIES 336 - -struct __GLdispatchTableRec -{ - void (GLAPIENTRY * NewList)(GLuint, GLenum); - void (GLAPIENTRY * EndList)(void); - void (GLAPIENTRY * CallList)(GLuint); - void (GLAPIENTRY * CallLists)(GLsizei, GLenum, const GLvoid *); - void (GLAPIENTRY * DeleteLists)(GLuint, GLsizei); - GLuint (GLAPIENTRY * GenLists)(GLsizei); - void (GLAPIENTRY * ListBase)(GLuint); - void (GLAPIENTRY * Begin)(GLenum); - void (GLAPIENTRY * Bitmap)(GLsizei, GLsizei, GLfloat, GLfloat, GLfloat, GLfloat, const GLubyte *); - void (GLAPIENTRY * Color3b)(GLbyte, GLbyte, GLbyte); - void (GLAPIENTRY * Color3bv)(const GLbyte *); - void (GLAPIENTRY * Color3d)(GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * Color3dv)(const GLdouble *); - void (GLAPIENTRY * Color3f)(GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * Color3fv)(const GLfloat *); - void (GLAPIENTRY * Color3i)(GLint, GLint, GLint); - void (GLAPIENTRY * Color3iv)(const GLint *); - void (GLAPIENTRY * Color3s)(GLshort, GLshort, GLshort); - void (GLAPIENTRY * Color3sv)(const GLshort *); - void (GLAPIENTRY * Color3ub)(GLubyte, GLubyte, GLubyte); - void (GLAPIENTRY * Color3ubv)(const GLubyte *); - void (GLAPIENTRY * Color3ui)(GLuint, GLuint, GLuint); - void (GLAPIENTRY * Color3uiv)(const GLuint *); - void (GLAPIENTRY * Color3us)(GLushort, GLushort, GLushort); - void (GLAPIENTRY * Color3usv)(const GLushort *); - void (GLAPIENTRY * Color4b)(GLbyte, GLbyte, GLbyte, GLbyte); - void (GLAPIENTRY * Color4bv)(const GLbyte *); - void (GLAPIENTRY * Color4d)(GLdouble, GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * Color4dv)(const GLdouble *); - void (GLAPIENTRY * Color4f)(GLfloat, GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * Color4fv)(const GLfloat *); - void (GLAPIENTRY * Color4i)(GLint, GLint, GLint, GLint); - void (GLAPIENTRY * Color4iv)(const GLint *); - void (GLAPIENTRY * Color4s)(GLshort, GLshort, GLshort, GLshort); - void (GLAPIENTRY * Color4sv)(const GLshort *); - void (GLAPIENTRY * Color4ub)(GLubyte, GLubyte, GLubyte, GLubyte); - void (GLAPIENTRY * Color4ubv)(const GLubyte *); - void (GLAPIENTRY * Color4ui)(GLuint, GLuint, GLuint, GLuint); - void (GLAPIENTRY * Color4uiv)(const GLuint *); - void (GLAPIENTRY * Color4us)(GLushort, GLushort, GLushort, GLushort); - void (GLAPIENTRY * Color4usv)(const GLushort *); - void (GLAPIENTRY * EdgeFlag)(GLboolean); - void (GLAPIENTRY * EdgeFlagv)(const GLboolean *); - void (GLAPIENTRY * End)(void); - void (GLAPIENTRY * Indexd)(GLdouble); - void (GLAPIENTRY * Indexdv)(const GLdouble *); - void (GLAPIENTRY * Indexf)(GLfloat); - void (GLAPIENTRY * Indexfv)(const GLfloat *); - void (GLAPIENTRY * Indexi)(GLint); - void (GLAPIENTRY * Indexiv)(const GLint *); - void (GLAPIENTRY * Indexs)(GLshort); - void (GLAPIENTRY * Indexsv)(const GLshort *); - void (GLAPIENTRY * Normal3b)(GLbyte, GLbyte, GLbyte); - void (GLAPIENTRY * Normal3bv)(const GLbyte *); - void (GLAPIENTRY * Normal3d)(GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * Normal3dv)(const GLdouble *); - void (GLAPIENTRY * Normal3f)(GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * Normal3fv)(const GLfloat *); - void (GLAPIENTRY * Normal3i)(GLint, GLint, GLint); - void (GLAPIENTRY * Normal3iv)(const GLint *); - void (GLAPIENTRY * Normal3s)(GLshort, GLshort, GLshort); - void (GLAPIENTRY * Normal3sv)(const GLshort *); - void (GLAPIENTRY * RasterPos2d)(GLdouble, GLdouble); - void (GLAPIENTRY * RasterPos2dv)(const GLdouble *); - void (GLAPIENTRY * RasterPos2f)(GLfloat, GLfloat); - void (GLAPIENTRY * RasterPos2fv)(const GLfloat *); - void (GLAPIENTRY * RasterPos2i)(GLint, GLint); - void (GLAPIENTRY * RasterPos2iv)(const GLint *); - void (GLAPIENTRY * RasterPos2s)(GLshort, GLshort); - void (GLAPIENTRY * RasterPos2sv)(const GLshort *); - void (GLAPIENTRY * RasterPos3d)(GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * RasterPos3dv)(const GLdouble *); - void (GLAPIENTRY * RasterPos3f)(GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * RasterPos3fv)(const GLfloat *); - void (GLAPIENTRY * RasterPos3i)(GLint, GLint, GLint); - void (GLAPIENTRY * RasterPos3iv)(const GLint *); - void (GLAPIENTRY * RasterPos3s)(GLshort, GLshort, GLshort); - void (GLAPIENTRY * RasterPos3sv)(const GLshort *); - void (GLAPIENTRY * RasterPos4d)(GLdouble, GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * RasterPos4dv)(const GLdouble *); - void (GLAPIENTRY * RasterPos4f)(GLfloat, GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * RasterPos4fv)(const GLfloat *); - void (GLAPIENTRY * RasterPos4i)(GLint, GLint, GLint, GLint); - void (GLAPIENTRY * RasterPos4iv)(const GLint *); - void (GLAPIENTRY * RasterPos4s)(GLshort, GLshort, GLshort, GLshort); - void (GLAPIENTRY * RasterPos4sv)(const GLshort *); - void (GLAPIENTRY * Rectd)(GLdouble, GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * Rectdv)(const GLdouble *, const GLdouble *); - void (GLAPIENTRY * Rectf)(GLfloat, GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * Rectfv)(const GLfloat *, const GLfloat *); - void (GLAPIENTRY * Recti)(GLint, GLint, GLint, GLint); - void (GLAPIENTRY * Rectiv)(const GLint *, const GLint *); - void (GLAPIENTRY * Rects)(GLshort, GLshort, GLshort, GLshort); - void (GLAPIENTRY * Rectsv)(const GLshort *, const GLshort *); - void (GLAPIENTRY * TexCoord1d)(GLdouble); - void (GLAPIENTRY * TexCoord1dv)(const GLdouble *); - void (GLAPIENTRY * TexCoord1f)(GLfloat); - void (GLAPIENTRY * TexCoord1fv)(const GLfloat *); - void (GLAPIENTRY * TexCoord1i)(GLint); - void (GLAPIENTRY * TexCoord1iv)(const GLint *); - void (GLAPIENTRY * TexCoord1s)(GLshort); - void (GLAPIENTRY * TexCoord1sv)(const GLshort *); - void (GLAPIENTRY * TexCoord2d)(GLdouble, GLdouble); - void (GLAPIENTRY * TexCoord2dv)(const GLdouble *); - void (GLAPIENTRY * TexCoord2f)(GLfloat, GLfloat); - void (GLAPIENTRY * TexCoord2fv)(const GLfloat *); - void (GLAPIENTRY * TexCoord2i)(GLint, GLint); - void (GLAPIENTRY * TexCoord2iv)(const GLint *); - void (GLAPIENTRY * TexCoord2s)(GLshort, GLshort); - void (GLAPIENTRY * TexCoord2sv)(const GLshort *); - void (GLAPIENTRY * TexCoord3d)(GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * TexCoord3dv)(const GLdouble *); - void (GLAPIENTRY * TexCoord3f)(GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * TexCoord3fv)(const GLfloat *); - void (GLAPIENTRY * TexCoord3i)(GLint, GLint, GLint); - void (GLAPIENTRY * TexCoord3iv)(const GLint *); - void (GLAPIENTRY * TexCoord3s)(GLshort, GLshort, GLshort); - void (GLAPIENTRY * TexCoord3sv)(const GLshort *); - void (GLAPIENTRY * TexCoord4d)(GLdouble, GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * TexCoord4dv)(const GLdouble *); - void (GLAPIENTRY * TexCoord4f)(GLfloat, GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * TexCoord4fv)(const GLfloat *); - void (GLAPIENTRY * TexCoord4i)(GLint, GLint, GLint, GLint); - void (GLAPIENTRY * TexCoord4iv)(const GLint *); - void (GLAPIENTRY * TexCoord4s)(GLshort, GLshort, GLshort, GLshort); - void (GLAPIENTRY * TexCoord4sv)(const GLshort *); - void (GLAPIENTRY * Vertex2d)(GLdouble, GLdouble); - void (GLAPIENTRY * Vertex2dv)(const GLdouble *); - void (GLAPIENTRY * Vertex2f)(GLfloat, GLfloat); - void (GLAPIENTRY * Vertex2fv)(const GLfloat *); - void (GLAPIENTRY * Vertex2i)(GLint, GLint); - void (GLAPIENTRY * Vertex2iv)(const GLint *); - void (GLAPIENTRY * Vertex2s)(GLshort, GLshort); - void (GLAPIENTRY * Vertex2sv)(const GLshort *); - void (GLAPIENTRY * Vertex3d)(GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * Vertex3dv)(const GLdouble *); - void (GLAPIENTRY * Vertex3f)(GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * Vertex3fv)(const GLfloat *); - void (GLAPIENTRY * Vertex3i)(GLint, GLint, GLint); - void (GLAPIENTRY * Vertex3iv)(const GLint *); - void (GLAPIENTRY * Vertex3s)(GLshort, GLshort, GLshort); - void (GLAPIENTRY * Vertex3sv)(const GLshort *); - void (GLAPIENTRY * Vertex4d)(GLdouble, GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * Vertex4dv)(const GLdouble *); - void (GLAPIENTRY * Vertex4f)(GLfloat, GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * Vertex4fv)(const GLfloat *); - void (GLAPIENTRY * Vertex4i)(GLint, GLint, GLint, GLint); - void (GLAPIENTRY * Vertex4iv)(const GLint *); - void (GLAPIENTRY * Vertex4s)(GLshort, GLshort, GLshort, GLshort); - void (GLAPIENTRY * Vertex4sv)(const GLshort *); - void (GLAPIENTRY * ClipPlane)(GLenum, const GLdouble *); - void (GLAPIENTRY * ColorMaterial)(GLenum, GLenum); - void (GLAPIENTRY * CullFace)(GLenum); - void (GLAPIENTRY * Fogf)(GLenum, GLfloat); - void (GLAPIENTRY * Fogfv)(GLenum, const GLfloat *); - void (GLAPIENTRY * Fogi)(GLenum, GLint); - void (GLAPIENTRY * Fogiv)(GLenum, const GLint *); - void (GLAPIENTRY * FrontFace)(GLenum); - void (GLAPIENTRY * Hint)(GLenum, GLenum); - void (GLAPIENTRY * Lightf)(GLenum, GLenum, GLfloat); - void (GLAPIENTRY * Lightfv)(GLenum, GLenum, const GLfloat *); - void (GLAPIENTRY * Lighti)(GLenum, GLenum, GLint); - void (GLAPIENTRY * Lightiv)(GLenum, GLenum, const GLint *); - void (GLAPIENTRY * LightModelf)(GLenum, GLfloat); - void (GLAPIENTRY * LightModelfv)(GLenum, const GLfloat *); - void (GLAPIENTRY * LightModeli)(GLenum, GLint); - void (GLAPIENTRY * LightModeliv)(GLenum, const GLint *); - void (GLAPIENTRY * LineStipple)(GLint, GLushort); - void (GLAPIENTRY * LineWidth)(GLfloat); - void (GLAPIENTRY * Materialf)(GLenum, GLenum, GLfloat); - void (GLAPIENTRY * Materialfv)(GLenum, GLenum, const GLfloat *); - void (GLAPIENTRY * Materiali)(GLenum, GLenum, GLint); - void (GLAPIENTRY * Materialiv)(GLenum, GLenum, const GLint *); - void (GLAPIENTRY * PointSize)(GLfloat); - void (GLAPIENTRY * PolygonMode)(GLenum, GLenum); - void (GLAPIENTRY * PolygonStipple)(const GLubyte *); - void (GLAPIENTRY * Scissor)(GLint, GLint, GLsizei, GLsizei); - void (GLAPIENTRY * ShadeModel)(GLenum); - void (GLAPIENTRY * TexParameterf)(GLenum, GLenum, GLfloat); - void (GLAPIENTRY * TexParameterfv)(GLenum, GLenum, const GLfloat *); - void (GLAPIENTRY * TexParameteri)(GLenum, GLenum, GLint); - void (GLAPIENTRY * TexParameteriv)(GLenum, GLenum, const GLint *); - void (GLAPIENTRY * TexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *); - void (GLAPIENTRY * TexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); - void (GLAPIENTRY * TexEnvf)(GLenum, GLenum, GLfloat); - void (GLAPIENTRY * TexEnvfv)(GLenum, GLenum, const GLfloat *); - void (GLAPIENTRY * TexEnvi)(GLenum, GLenum, GLint); - void (GLAPIENTRY * TexEnviv)(GLenum, GLenum, const GLint *); - void (GLAPIENTRY * TexGend)(GLenum, GLenum, GLdouble); - void (GLAPIENTRY * TexGendv)(GLenum, GLenum, const GLdouble *); - void (GLAPIENTRY * TexGenf)(GLenum, GLenum, GLfloat); - void (GLAPIENTRY * TexGenfv)(GLenum, GLenum, const GLfloat *); - void (GLAPIENTRY * TexGeni)(GLenum, GLenum, GLint); - void (GLAPIENTRY * TexGeniv)(GLenum, GLenum, const GLint *); - void (GLAPIENTRY * FeedbackBuffer)(GLsizei, GLenum, GLfloat *); - void (GLAPIENTRY * SelectBuffer)(GLsizei, GLuint *); - GLint (GLAPIENTRY * RenderMode)(GLenum); - void (GLAPIENTRY * InitNames)(void); - void (GLAPIENTRY * LoadName)(GLuint); - void (GLAPIENTRY * PassThrough)(GLfloat); - void (GLAPIENTRY * PopName)(void); - void (GLAPIENTRY * PushName)(GLuint); - void (GLAPIENTRY * DrawBuffer)(GLenum); - void (GLAPIENTRY * Clear)(GLbitfield); - void (GLAPIENTRY * ClearAccum)(GLfloat, GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * ClearIndex)(GLfloat); - void (GLAPIENTRY * ClearColor)(GLclampf, GLclampf, GLclampf, GLclampf); - void (GLAPIENTRY * ClearStencil)(GLint); - void (GLAPIENTRY * ClearDepth)(GLclampd); - void (GLAPIENTRY * StencilMask)(GLuint); - void (GLAPIENTRY * ColorMask)(GLboolean, GLboolean, GLboolean, GLboolean); - void (GLAPIENTRY * DepthMask)(GLboolean); - void (GLAPIENTRY * IndexMask)(GLuint); - void (GLAPIENTRY * Accum)(GLenum, GLfloat); - void (GLAPIENTRY * Disable)(GLenum); - void (GLAPIENTRY * Enable)(GLenum); - void (GLAPIENTRY * Finish)(void); - void (GLAPIENTRY * Flush)(void); - void (GLAPIENTRY * PopAttrib)(void); - void (GLAPIENTRY * PushAttrib)(GLbitfield); - void (GLAPIENTRY * Map1d)(GLenum, GLdouble, GLdouble, GLint, GLint, const GLdouble *); - void (GLAPIENTRY * Map1f)(GLenum, GLfloat, GLfloat, GLint, GLint, const GLfloat *); - void (GLAPIENTRY * Map2d)(GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *); - void (GLAPIENTRY * Map2f)(GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *); - void (GLAPIENTRY * MapGrid1d)(GLint, GLdouble, GLdouble); - void (GLAPIENTRY * MapGrid1f)(GLint, GLfloat, GLfloat); - void (GLAPIENTRY * MapGrid2d)(GLint, GLdouble, GLdouble, GLint, GLdouble, GLdouble); - void (GLAPIENTRY * MapGrid2f)(GLint, GLfloat, GLfloat, GLint, GLfloat, GLfloat); - void (GLAPIENTRY * EvalCoord1d)(GLdouble); - void (GLAPIENTRY * EvalCoord1dv)(const GLdouble *); - void (GLAPIENTRY * EvalCoord1f)(GLfloat); - void (GLAPIENTRY * EvalCoord1fv)(const GLfloat *); - void (GLAPIENTRY * EvalCoord2d)(GLdouble, GLdouble); - void (GLAPIENTRY * EvalCoord2dv)(const GLdouble *); - void (GLAPIENTRY * EvalCoord2f)(GLfloat, GLfloat); - void (GLAPIENTRY * EvalCoord2fv)(const GLfloat *); - void (GLAPIENTRY * EvalMesh1)(GLenum, GLint, GLint); - void (GLAPIENTRY * EvalPoint1)(GLint); - void (GLAPIENTRY * EvalMesh2)(GLenum, GLint, GLint, GLint, GLint); - void (GLAPIENTRY * EvalPoint2)(GLint, GLint); - void (GLAPIENTRY * AlphaFunc)(GLenum, GLclampf); - void (GLAPIENTRY * BlendFunc)(GLenum, GLenum); - void (GLAPIENTRY * LogicOp)(GLenum); - void (GLAPIENTRY * StencilFunc)(GLenum, GLint, GLuint); - void (GLAPIENTRY * StencilOp)(GLenum, GLenum, GLenum); - void (GLAPIENTRY * DepthFunc)(GLenum); - void (GLAPIENTRY * PixelZoom)(GLfloat, GLfloat); - void (GLAPIENTRY * PixelTransferf)(GLenum, GLfloat); - void (GLAPIENTRY * PixelTransferi)(GLenum, GLint); - void (GLAPIENTRY * PixelStoref)(GLenum, GLfloat); - void (GLAPIENTRY * PixelStorei)(GLenum, GLint); - void (GLAPIENTRY * PixelMapfv)(GLenum, GLint, const GLfloat *); - void (GLAPIENTRY * PixelMapuiv)(GLenum, GLint, const GLuint *); - void (GLAPIENTRY * PixelMapusv)(GLenum, GLint, const GLushort *); - void (GLAPIENTRY * ReadBuffer)(GLenum); - void (GLAPIENTRY * CopyPixels)(GLint, GLint, GLsizei, GLsizei, GLenum); - void (GLAPIENTRY * ReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *); - void (GLAPIENTRY * DrawPixels)(GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); - void (GLAPIENTRY * GetBooleanv)(GLenum, GLboolean *); - void (GLAPIENTRY * GetClipPlane)(GLenum, GLdouble *); - void (GLAPIENTRY * GetDoublev)(GLenum, GLdouble *); - GLenum (GLAPIENTRY * GetError)(void); - void (GLAPIENTRY * GetFloatv)(GLenum, GLfloat *); - void (GLAPIENTRY * GetIntegerv)(GLenum, GLint *); - void (GLAPIENTRY * GetLightfv)(GLenum, GLenum, GLfloat *); - void (GLAPIENTRY * GetLightiv)(GLenum, GLenum, GLint *); - void (GLAPIENTRY * GetMapdv)(GLenum, GLenum, GLdouble *); - void (GLAPIENTRY * GetMapfv)(GLenum, GLenum, GLfloat *); - void (GLAPIENTRY * GetMapiv)(GLenum, GLenum, GLint *); - void (GLAPIENTRY * GetMaterialfv)(GLenum, GLenum, GLfloat *); - void (GLAPIENTRY * GetMaterialiv)(GLenum, GLenum, GLint *); - void (GLAPIENTRY * GetPixelMapfv)(GLenum, GLfloat *); - void (GLAPIENTRY * GetPixelMapuiv)(GLenum, GLuint *); - void (GLAPIENTRY * GetPixelMapusv)(GLenum, GLushort *); - void (GLAPIENTRY * GetPolygonStipple)(GLubyte *); - const GLubyte * (GLAPIENTRY * GetString)(GLenum); - void (GLAPIENTRY * GetTexEnvfv)(GLenum, GLenum, GLfloat *); - void (GLAPIENTRY * GetTexEnviv)(GLenum, GLenum, GLint *); - void (GLAPIENTRY * GetTexGendv)(GLenum, GLenum, GLdouble *); - void (GLAPIENTRY * GetTexGenfv)(GLenum, GLenum, GLfloat *); - void (GLAPIENTRY * GetTexGeniv)(GLenum, GLenum, GLint *); - void (GLAPIENTRY * GetTexImage)(GLenum, GLint, GLenum, GLenum, GLvoid *); - void (GLAPIENTRY * GetTexParameterfv)(GLenum, GLenum, GLfloat *); - void (GLAPIENTRY * GetTexParameteriv)(GLenum, GLenum, GLint *); - void (GLAPIENTRY * GetTexLevelParameterfv)(GLenum, GLint, GLenum, GLfloat *); - void (GLAPIENTRY * GetTexLevelParameteriv)(GLenum, GLint, GLenum, GLint *); - GLboolean (GLAPIENTRY * IsEnabled)(GLenum); - GLboolean (GLAPIENTRY * IsList)(GLuint); - void (GLAPIENTRY * DepthRange)(GLclampd, GLclampd); - void (GLAPIENTRY * Frustum)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * LoadIdentity)(void); - void (GLAPIENTRY * LoadMatrixf)(const GLfloat *); - void (GLAPIENTRY * LoadMatrixd)(const GLdouble *); - void (GLAPIENTRY * MatrixMode)(GLenum); - void (GLAPIENTRY * MultMatrixf)(const GLfloat *); - void (GLAPIENTRY * MultMatrixd)(const GLdouble *); - void (GLAPIENTRY * Ortho)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * PopMatrix)(void); - void (GLAPIENTRY * PushMatrix)(void); - void (GLAPIENTRY * Rotated)(GLdouble, GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * Rotatef)(GLfloat, GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * Scaled)(GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * Scalef)(GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * Translated)(GLdouble, GLdouble, GLdouble); - void (GLAPIENTRY * Translatef)(GLfloat, GLfloat, GLfloat); - void (GLAPIENTRY * Viewport)(GLint, GLint, GLsizei, GLsizei); - void (GLAPIENTRY * ArrayElement)(GLint); - void (GLAPIENTRY * BindTexture)(GLenum, GLuint); - void (GLAPIENTRY * ColorPointer)(GLint, GLenum, GLsizei, const GLvoid *); - void (GLAPIENTRY * DisableClientState)(GLenum); - void (GLAPIENTRY * DrawArrays)(GLenum, GLint, GLsizei); - void (GLAPIENTRY * DrawElements)(GLenum, GLsizei, GLenum, const GLvoid *); - void (GLAPIENTRY * EdgeFlagPointer)(GLsizei, const GLvoid *); - void (GLAPIENTRY * EnableClientState)(GLenum); - void (GLAPIENTRY * IndexPointer)(GLenum, GLsizei, const GLvoid *); - void (GLAPIENTRY * Indexub)(GLubyte); - void (GLAPIENTRY * Indexubv)(const GLubyte *); - void (GLAPIENTRY * InterleavedArrays)(GLenum, GLsizei, const GLvoid *); - void (GLAPIENTRY * NormalPointer)(GLenum, GLsizei, const GLvoid *); - void (GLAPIENTRY * PolygonOffset)(GLfloat, GLfloat); - void (GLAPIENTRY * TexCoordPointer)(GLint, GLenum, GLsizei, const GLvoid *); - void (GLAPIENTRY * VertexPointer)(GLint, GLenum, GLsizei, const GLvoid *); - GLboolean (GLAPIENTRY * AreTexturesResident)(GLsizei, const GLuint *, GLboolean *); - void (GLAPIENTRY * CopyTexImage1D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); - void (GLAPIENTRY * CopyTexImage2D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); - void (GLAPIENTRY * CopyTexSubImage1D)(GLenum, GLint, GLint, GLint, GLint, GLsizei); - void (GLAPIENTRY * CopyTexSubImage2D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); - void (GLAPIENTRY * DeleteTextures)(GLsizei, const GLuint *); - void (GLAPIENTRY * GenTextures)(GLsizei, GLuint *); - void (GLAPIENTRY * GetPointerv)(GLenum, GLvoid **); - GLboolean (GLAPIENTRY * IsTexture)(GLuint); - void (GLAPIENTRY * PrioritizeTextures)(GLsizei, const GLuint *, const GLclampf *); - void (GLAPIENTRY * TexSubImage1D)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *); - void (GLAPIENTRY * TexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); - void (GLAPIENTRY * PopClientAttrib)(void); - void (GLAPIENTRY * PushClientAttrib)(GLbitfield); -}; - -typedef struct __GLdispatchTableRec GLDISPATCHTABLE; - -typedef struct _GLCLTPROCTABLE -{ - int cEntries; - GLDISPATCHTABLE glDispatchTable; -} GLCLTPROCTABLE, * PGLCLTPROCTABLE; - -typedef VOID (APIENTRY * PFN_SETPROCTABLE)(PGLCLTPROCTABLE); - -BOOL APIENTRY -DrvCopyContext( - DHGLRC dhrcSource, - DHGLRC dhrcDest, - UINT fuMask ); - -DHGLRC APIENTRY -DrvCreateLayerContext( - HDC hdc, - INT iLayerPlane ); - -DHGLRC APIENTRY -DrvCreateContext( - HDC hdc ); - -BOOL APIENTRY -DrvDeleteContext( - DHGLRC dhglrc ); - -BOOL APIENTRY -DrvDescribeLayerPlane( - HDC hdc, - INT iPixelFormat, - INT iLayerPlane, - UINT nBytes, - LPLAYERPLANEDESCRIPTOR plpd ); - -LONG APIENTRY -DrvDescribePixelFormat( - HDC hdc, - INT iPixelFormat, - ULONG cjpfd, - PIXELFORMATDESCRIPTOR *ppfd ); - -int APIENTRY -DrvGetLayerPaletteEntries( - HDC hdc, - INT iLayerPlane, - INT iStart, - INT cEntries, - COLORREF *pcr ); - -PROC APIENTRY -DrvGetProcAddress( - LPCSTR lpszProc ); - -BOOL APIENTRY -DrvRealizeLayerPalette( - HDC hdc, - INT iLayerPlane, - BOOL bRealize ); - -BOOL APIENTRY -DrvReleaseContext( - DHGLRC dhglrc ); - -void APIENTRY -DrvSetCallbackProcs( - INT nProcs, - PROC *pProcs ); - -PGLCLTPROCTABLE APIENTRY -DrvSetContext( - HDC hdc, - DHGLRC dhglrc, - PFN_SETPROCTABLE pfnSetProcTable ); - -int APIENTRY -DrvSetLayerPaletteEntries( - HDC hdc, - INT iLayerPlane, - INT iStart, - INT cEntries, - CONST COLORREF *pcr ); - -BOOL APIENTRY -DrvSetPixelFormat( - HDC hdc, - LONG iPixelFormat ); - -BOOL APIENTRY -DrvShareLists( - DHGLRC dhglrc1, - DHGLRC dhglrc2 ); - -BOOL APIENTRY -DrvSwapBuffers( - HDC hdc ); - -BOOL APIENTRY -DrvSwapLayerBuffers( - HDC hdc, - UINT fuPlanes ); - -BOOL APIENTRY -DrvValidateVersion( - ULONG ulVersion ); - -#endif /* STW_ICD_H */ diff --git a/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c deleted file mode 100644 index 0e2d407699..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_arbpixelformat.c +++ /dev/null @@ -1,483 +0,0 @@ -/************************************************************************** - * - * 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. - * - **************************************************************************/ - -/** - * @file - * - * WGL_ARB_pixel_format extension implementation. - * - * @sa http://www.opengl.org/registry/specs/ARB/wgl_pixel_format.txt - */ - - -#include - -#define WGL_WGLEXT_PROTOTYPES - -#include -#include - -#include "pipe/p_compiler.h" -#include "util/u_memory.h" -#include "stw_public.h" -#include "stw_pixelformat.h" - - -static boolean -stw_query_attrib( - int iPixelFormat, - int iLayerPlane, - int attrib, - int *pvalue ) -{ - uint count; - uint index; - const struct stw_pixelformat_info *pfi; - - count = stw_pixelformat_get_extended_count(); - - if (attrib == WGL_NUMBER_PIXEL_FORMATS_ARB) { - *pvalue = (int) count; - return TRUE; - } - - index = (uint) iPixelFormat - 1; - if (index >= count) - return FALSE; - - pfi = stw_pixelformat_get_info( index ); - - switch (attrib) { - case WGL_DRAW_TO_WINDOW_ARB: - *pvalue = pfi->pfd.dwFlags & PFD_DRAW_TO_WINDOW ? TRUE : FALSE; - return TRUE; - - case WGL_DRAW_TO_BITMAP_ARB: - *pvalue = pfi->pfd.dwFlags & PFD_DRAW_TO_BITMAP ? TRUE : FALSE; - return TRUE; - - case WGL_NEED_PALETTE_ARB: - *pvalue = pfi->pfd.dwFlags & PFD_NEED_PALETTE ? TRUE : FALSE; - return TRUE; - - case WGL_NEED_SYSTEM_PALETTE_ARB: - *pvalue = pfi->pfd.dwFlags & PFD_NEED_SYSTEM_PALETTE ? TRUE : FALSE; - return TRUE; - - case WGL_SWAP_METHOD_ARB: - *pvalue = pfi->pfd.dwFlags & PFD_SWAP_COPY ? WGL_SWAP_COPY_ARB : WGL_SWAP_UNDEFINED_ARB; - return TRUE; - - case WGL_SWAP_LAYER_BUFFERS_ARB: - *pvalue = FALSE; - return TRUE; - - case WGL_NUMBER_OVERLAYS_ARB: - *pvalue = 0; - return TRUE; - - case WGL_NUMBER_UNDERLAYS_ARB: - *pvalue = 0; - return TRUE; - } - - if (iLayerPlane != 0) - return FALSE; - - switch (attrib) { - case WGL_ACCELERATION_ARB: - *pvalue = WGL_FULL_ACCELERATION_ARB; - break; - - case WGL_TRANSPARENT_ARB: - *pvalue = FALSE; - break; - - case WGL_TRANSPARENT_RED_VALUE_ARB: - case WGL_TRANSPARENT_GREEN_VALUE_ARB: - case WGL_TRANSPARENT_BLUE_VALUE_ARB: - case WGL_TRANSPARENT_ALPHA_VALUE_ARB: - case WGL_TRANSPARENT_INDEX_VALUE_ARB: - break; - - case WGL_SHARE_DEPTH_ARB: - case WGL_SHARE_STENCIL_ARB: - case WGL_SHARE_ACCUM_ARB: - *pvalue = TRUE; - break; - - case WGL_SUPPORT_GDI_ARB: - *pvalue = pfi->pfd.dwFlags & PFD_SUPPORT_GDI ? TRUE : FALSE; - break; - - case WGL_SUPPORT_OPENGL_ARB: - *pvalue = pfi->pfd.dwFlags & PFD_SUPPORT_OPENGL ? TRUE : FALSE; - break; - - case WGL_DOUBLE_BUFFER_ARB: - *pvalue = pfi->pfd.dwFlags & PFD_DOUBLEBUFFER ? TRUE : FALSE; - break; - - case WGL_STEREO_ARB: - *pvalue = pfi->pfd.dwFlags & PFD_STEREO ? TRUE : FALSE; - break; - - case WGL_PIXEL_TYPE_ARB: - switch (pfi->pfd.iPixelType) { - case PFD_TYPE_RGBA: - *pvalue = WGL_TYPE_RGBA_ARB; - break; - case PFD_TYPE_COLORINDEX: - *pvalue = WGL_TYPE_COLORINDEX_ARB; - break; - default: - return FALSE; - } - break; - - case WGL_COLOR_BITS_ARB: - *pvalue = pfi->pfd.cColorBits; - break; - - case WGL_RED_BITS_ARB: - *pvalue = pfi->pfd.cRedBits; - break; - - case WGL_RED_SHIFT_ARB: - *pvalue = pfi->pfd.cRedShift; - break; - - case WGL_GREEN_BITS_ARB: - *pvalue = pfi->pfd.cGreenBits; - break; - - case WGL_GREEN_SHIFT_ARB: - *pvalue = pfi->pfd.cGreenShift; - break; - - case WGL_BLUE_BITS_ARB: - *pvalue = pfi->pfd.cBlueBits; - break; - - case WGL_BLUE_SHIFT_ARB: - *pvalue = pfi->pfd.cBlueShift; - break; - - case WGL_ALPHA_BITS_ARB: - *pvalue = pfi->pfd.cAlphaBits; - break; - - case WGL_ALPHA_SHIFT_ARB: - *pvalue = pfi->pfd.cAlphaShift; - break; - - case WGL_ACCUM_BITS_ARB: - *pvalue = pfi->pfd.cAccumBits; - break; - - case WGL_ACCUM_RED_BITS_ARB: - *pvalue = pfi->pfd.cAccumRedBits; - break; - - case WGL_ACCUM_GREEN_BITS_ARB: - *pvalue = pfi->pfd.cAccumGreenBits; - break; - - case WGL_ACCUM_BLUE_BITS_ARB: - *pvalue = pfi->pfd.cAccumBlueBits; - break; - - case WGL_ACCUM_ALPHA_BITS_ARB: - *pvalue = pfi->pfd.cAccumAlphaBits; - break; - - case WGL_DEPTH_BITS_ARB: - *pvalue = pfi->pfd.cDepthBits; - break; - - case WGL_STENCIL_BITS_ARB: - *pvalue = pfi->pfd.cStencilBits; - break; - - case WGL_AUX_BUFFERS_ARB: - *pvalue = pfi->pfd.cAuxBuffers; - break; - - case WGL_SAMPLE_BUFFERS_ARB: - *pvalue = pfi->numSampleBuffers; - break; - - case WGL_SAMPLES_ARB: - *pvalue = pfi->numSamples; - break; - - default: - return FALSE; - } - - return TRUE; -} - -struct attrib_match_info -{ - int attribute; - int weight; - BOOL exact; -}; - -static const struct attrib_match_info attrib_match[] = { - - /* WGL_ARB_pixel_format */ - { WGL_DRAW_TO_WINDOW_ARB, 0, TRUE }, - { WGL_DRAW_TO_BITMAP_ARB, 0, TRUE }, - { WGL_ACCELERATION_ARB, 0, TRUE }, - { WGL_NEED_PALETTE_ARB, 0, TRUE }, - { WGL_NEED_SYSTEM_PALETTE_ARB, 0, TRUE }, - { WGL_SWAP_LAYER_BUFFERS_ARB, 0, TRUE }, - { WGL_SWAP_METHOD_ARB, 0, TRUE }, - { WGL_NUMBER_OVERLAYS_ARB, 4, FALSE }, - { WGL_NUMBER_UNDERLAYS_ARB, 4, FALSE }, - /*{ WGL_SHARE_DEPTH_ARB, 0, TRUE },*/ /* no overlays -- ignore */ - /*{ WGL_SHARE_STENCIL_ARB, 0, TRUE },*/ /* no overlays -- ignore */ - /*{ WGL_SHARE_ACCUM_ARB, 0, TRUE },*/ /* no overlays -- ignore */ - { WGL_SUPPORT_GDI_ARB, 0, TRUE }, - { WGL_SUPPORT_OPENGL_ARB, 0, TRUE }, - { WGL_DOUBLE_BUFFER_ARB, 0, TRUE }, - { WGL_STEREO_ARB, 0, TRUE }, - { WGL_PIXEL_TYPE_ARB, 0, TRUE }, - { WGL_COLOR_BITS_ARB, 1, FALSE }, - { WGL_RED_BITS_ARB, 1, FALSE }, - { WGL_GREEN_BITS_ARB, 1, FALSE }, - { WGL_BLUE_BITS_ARB, 1, FALSE }, - { WGL_ALPHA_BITS_ARB, 1, FALSE }, - { WGL_ACCUM_BITS_ARB, 1, FALSE }, - { WGL_ACCUM_RED_BITS_ARB, 1, FALSE }, - { WGL_ACCUM_GREEN_BITS_ARB, 1, FALSE }, - { WGL_ACCUM_BLUE_BITS_ARB, 1, FALSE }, - { WGL_ACCUM_ALPHA_BITS_ARB, 1, FALSE }, - { WGL_DEPTH_BITS_ARB, 1, FALSE }, - { WGL_STENCIL_BITS_ARB, 1, FALSE }, - { WGL_AUX_BUFFERS_ARB, 2, FALSE }, - - /* WGL_ARB_multisample */ - { WGL_SAMPLE_BUFFERS_ARB, 2, FALSE }, - { WGL_SAMPLES_ARB, 2, FALSE } -}; - -struct stw_pixelformat_score -{ - int points; - uint index; -}; - -static BOOL -score_pixelformats( - struct stw_pixelformat_score *scores, - uint count, - int attribute, - int expected_value ) -{ - uint i; - const struct attrib_match_info *ami = NULL; - uint index; - - /* Find out if a given attribute should be considered for score calculation. - */ - for (i = 0; i < sizeof( attrib_match ) / sizeof( attrib_match[0] ); i++) { - if (attrib_match[i].attribute == attribute) { - ami = &attrib_match[i]; - break; - } - } - if (ami == NULL) - return TRUE; - - /* Iterate all pixelformats, query the requested attribute and calculate - * score points. - */ - for (index = 0; index < count; index++) { - int actual_value; - - if (!stw_query_attrib( index + 1, 0, attribute, &actual_value )) - return FALSE; - - if (ami->exact) { - /* For an exact match criteria, if the actual and expected values differ, - * the score is set to 0 points, effectively removing the pixelformat - * from a list of matching pixelformats. - */ - if (actual_value != expected_value) - scores[index].points = 0; - } - else { - /* For a minimum match criteria, if the actual value is smaller than the expected - * value, the pixelformat is rejected (score set to 0). However, if the actual - * value is bigger, the pixelformat is given a penalty to favour pixelformats that - * more closely match the expected values. - */ - if (actual_value < expected_value) - scores[index].points = 0; - else if (actual_value > expected_value) - scores[index].points -= (actual_value - expected_value) * ami->weight; - } - } - - return TRUE; -} - -WINGDIAPI BOOL APIENTRY -wglChoosePixelFormatARB( - HDC hdc, - const int *piAttribIList, - const FLOAT *pfAttribFList, - UINT nMaxFormats, - int *piFormats, - UINT *nNumFormats ) -{ - uint count; - struct stw_pixelformat_score *scores; - uint i; - - *nNumFormats = 0; - - /* Allocate and initialize pixelformat score table -- better matches - * have higher scores. Start with a high score and take out penalty - * points for a mismatch when the match does not have to be exact. - * Set a score to 0 if there is a mismatch for an exact match criteria. - */ - count = stw_pixelformat_get_extended_count(); - scores = (struct stw_pixelformat_score *) MALLOC( count * sizeof( struct stw_pixelformat_score ) ); - if (scores == NULL) - return FALSE; - for (i = 0; i < count; i++) { - scores[i].points = 0x7fffffff; - scores[i].index = i; - } - - /* Given the attribute list calculate a score for each pixelformat. - */ - if (piAttribIList != NULL) { - while (*piAttribIList != 0) { - if (!score_pixelformats( scores, count, piAttribIList[0], piAttribIList[1] )) { - FREE( scores ); - return FALSE; - } - piAttribIList += 2; - } - } - if (pfAttribFList != NULL) { - while (*pfAttribFList != 0) { - if (!score_pixelformats( scores, count, (int) pfAttribFList[0], (int) pfAttribFList[1] )) { - FREE( scores ); - return FALSE; - } - pfAttribFList += 2; - } - } - - /* Bubble-sort the resulting scores. Pixelformats with higher scores go first. - * TODO: Find out if there are any patent issues with it. - */ - if (count > 1) { - uint n = count; - boolean swapped; - - do { - swapped = FALSE; - for (i = 1; i < n; i++) { - if (scores[i - 1].points < scores[i].points) { - struct stw_pixelformat_score score = scores[i - 1]; - - scores[i - 1] = scores[i]; - scores[i] = score; - swapped = TRUE; - } - } - n--; - } - while (swapped); - } - - /* Return a list of pixelformats that are the best match. - * Reject pixelformats with non-positive scores. - */ - for (i = 0; i < count; i++) { - if (scores[i].points > 0) { - if (*nNumFormats < nMaxFormats) - piFormats[*nNumFormats] = scores[i].index + 1; - (*nNumFormats)++; - } - } - - FREE( scores ); - return TRUE; -} - -WINGDIAPI BOOL APIENTRY -wglGetPixelFormatAttribfvARB( - HDC hdc, - int iPixelFormat, - int iLayerPlane, - UINT nAttributes, - const int *piAttributes, - FLOAT *pfValues ) -{ - UINT i; - - (void) hdc; - - for (i = 0; i < nAttributes; i++) { - int value; - - if (!stw_query_attrib( iPixelFormat, iLayerPlane, piAttributes[i], &value )) - return FALSE; - pfValues[i] = (FLOAT) value; - } - - return TRUE; -} - -WINGDIAPI BOOL APIENTRY -wglGetPixelFormatAttribivARB( - HDC hdc, - int iPixelFormat, - int iLayerPlane, - UINT nAttributes, - const int *piAttributes, - int *piValues ) -{ - UINT i; - - (void) hdc; - - for (i = 0; i < nAttributes; i++) { - if (!stw_query_attrib( iPixelFormat, iLayerPlane, piAttributes[i], &piValues[i] )) - return FALSE; - } - - return TRUE; -} diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.c b/src/gallium/state_trackers/wgl/shared/stw_context.c deleted file mode 100644 index 4968ecc692..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_context.c +++ /dev/null @@ -1,382 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include - -#include "main/mtypes.h" -#include "main/context.h" -#include "pipe/p_compiler.h" -#include "pipe/p_context.h" -#include "state_tracker/st_context.h" -#include "state_tracker/st_public.h" - -#ifdef DEBUG -#include "trace/tr_screen.h" -#include "trace/tr_context.h" -#endif - -#include "shared/stw_device.h" -#include "shared/stw_winsys.h" -#include "shared/stw_framebuffer.h" -#include "shared/stw_pixelformat.h" -#include "stw_public.h" -#include "stw_context.h" -#include "stw_tls.h" - - -static INLINE struct stw_context * -stw_context(GLcontext *glctx) -{ - if(!glctx) - return NULL; - assert(glctx->DriverCtx); - return (struct stw_context *)glctx->DriverCtx; -} - -static INLINE struct stw_context * -stw_current_context(void) -{ - /* We must check if multiple threads are being used or GET_CURRENT_CONTEXT - * might return the current context of the thread first seen. */ - _glapi_check_multithread(); - - { - GET_CURRENT_CONTEXT( glctx ); - return stw_context(glctx); - } -} - -BOOL -stw_copy_context( - UINT_PTR hglrcSrc, - UINT_PTR hglrcDst, - UINT mask ) -{ - struct stw_context *src; - struct stw_context *dst; - BOOL ret = FALSE; - - pipe_mutex_lock( stw_dev->ctx_mutex ); - - src = stw_lookup_context_locked( hglrcSrc ); - dst = stw_lookup_context_locked( hglrcDst ); - - if (src && dst) { - /* FIXME */ - assert(0); - (void) src; - (void) dst; - (void) mask; - } - - pipe_mutex_unlock( stw_dev->ctx_mutex ); - - return ret; -} - -BOOL -stw_share_lists( - UINT_PTR hglrc1, - UINT_PTR hglrc2 ) -{ - struct stw_context *ctx1; - struct stw_context *ctx2; - BOOL ret = FALSE; - - pipe_mutex_lock( stw_dev->ctx_mutex ); - - ctx1 = stw_lookup_context_locked( hglrc1 ); - ctx2 = stw_lookup_context_locked( hglrc2 ); - - if (ctx1 && ctx2 && - ctx1->iPixelFormat == ctx2->iPixelFormat) { - ret = _mesa_share_state(ctx2->st->ctx, ctx1->st->ctx); - } - - pipe_mutex_unlock( stw_dev->ctx_mutex ); - - return ret; -} - -static void -stw_viewport(GLcontext * glctx, GLint x, GLint y, - GLsizei width, GLsizei height) -{ - struct stw_context *ctx = (struct stw_context *)glctx->DriverCtx; - struct stw_framebuffer *fb; - - fb = stw_framebuffer_from_hdc( ctx->hdc ); - if(fb) { - stw_framebuffer_update(fb); - stw_framebuffer_release(fb); - } -} - -UINT_PTR -stw_create_layer_context( - HDC hdc, - int iLayerPlane ) -{ - int iPixelFormat; - const struct stw_pixelformat_info *pfi; - GLvisual visual; - struct stw_context *ctx = NULL; - struct pipe_screen *screen = NULL; - struct pipe_context *pipe = NULL; - - if(!stw_dev) - return 0; - - if (iLayerPlane != 0) - return 0; - - iPixelFormat = GetPixelFormat(hdc); - if(!iPixelFormat) - return 0; - - pfi = stw_pixelformat_get_info( iPixelFormat - 1 ); - stw_pixelformat_visual(&visual, pfi); - - ctx = CALLOC_STRUCT( stw_context ); - if (ctx == NULL) - goto no_ctx; - - ctx->hdc = hdc; - ctx->iPixelFormat = iPixelFormat; - - screen = stw_dev->screen; - -#ifdef DEBUG - /* Unwrap screen */ - if(stw_dev->trace_running) - screen = trace_screen(screen)->screen; -#endif - - pipe = stw_dev->stw_winsys->create_context( screen ); - if (pipe == NULL) - goto no_pipe; - -#ifdef DEBUG - /* Wrap context */ - if(stw_dev->trace_running) - pipe = trace_context_create(stw_dev->screen, pipe); -#endif - - /* pass to stw_flush_frontbuffer as context_private */ - assert(!pipe->priv); - pipe->priv = hdc; - - ctx->st = st_create_context( pipe, &visual, NULL ); - if (ctx->st == NULL) - goto no_st_ctx; - - ctx->st->ctx->DriverCtx = ctx; - ctx->st->ctx->Driver.Viewport = stw_viewport; - - pipe_mutex_lock( stw_dev->ctx_mutex ); - ctx->hglrc = handle_table_add(stw_dev->ctx_table, ctx); - pipe_mutex_unlock( stw_dev->ctx_mutex ); - if (!ctx->hglrc) - goto no_hglrc; - - return ctx->hglrc; - -no_hglrc: - st_destroy_context(ctx->st); - goto no_pipe; /* st_context_destroy already destroys pipe */ -no_st_ctx: - pipe->destroy( pipe ); -no_pipe: - FREE(ctx); -no_ctx: - return 0; -} - -BOOL -stw_delete_context( - UINT_PTR hglrc ) -{ - struct stw_context *ctx ; - BOOL ret = FALSE; - - if (!stw_dev) - return FALSE; - - pipe_mutex_lock( stw_dev->ctx_mutex ); - ctx = stw_lookup_context_locked(hglrc); - handle_table_remove(stw_dev->ctx_table, hglrc); - pipe_mutex_unlock( stw_dev->ctx_mutex ); - - if (ctx) { - struct stw_context *curctx = stw_current_context(); - - /* Unbind current if deleting current context. */ - if (curctx == ctx) - st_make_current( NULL, NULL, NULL ); - - st_destroy_context(ctx->st); - FREE(ctx); - - ret = TRUE; - } - - return ret; -} - -BOOL -stw_release_context( - UINT_PTR hglrc ) -{ - struct stw_context *ctx; - - if (!stw_dev) - return FALSE; - - pipe_mutex_lock( stw_dev->ctx_mutex ); - ctx = stw_lookup_context_locked( hglrc ); - pipe_mutex_unlock( stw_dev->ctx_mutex ); - - if (!ctx) - return FALSE; - - /* The expectation is that ctx is the same context which is - * current for this thread. We should check that and return False - * if not the case. - */ - if (ctx != stw_current_context()) - return FALSE; - - if (stw_make_current( NULL, 0 ) == FALSE) - return FALSE; - - return TRUE; -} - - -UINT_PTR -stw_get_current_context( void ) -{ - struct stw_context *ctx; - - ctx = stw_current_context(); - if(!ctx) - return 0; - - return ctx->hglrc; -} - -HDC -stw_get_current_dc( void ) -{ - struct stw_context *ctx; - - ctx = stw_current_context(); - if(!ctx) - return NULL; - - return ctx->hdc; -} - -BOOL -stw_make_current( - HDC hdc, - UINT_PTR hglrc ) -{ - struct stw_context *curctx = NULL; - struct stw_context *ctx = NULL; - struct stw_framebuffer *fb = NULL; - - if (!stw_dev) - goto fail; - - curctx = stw_current_context(); - if (curctx != NULL) { - if (curctx->hglrc != hglrc) - st_flush(curctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); - - /* Return if already current. */ - if (curctx->hglrc == hglrc && curctx->hdc == hdc) { - ctx = curctx; - fb = stw_framebuffer_from_hdc( hdc ); - goto success; - } - } - - if (hdc == NULL || hglrc == 0) { - return st_make_current( NULL, NULL, NULL ); - } - - pipe_mutex_lock( stw_dev->ctx_mutex ); - ctx = stw_lookup_context_locked( hglrc ); - pipe_mutex_unlock( stw_dev->ctx_mutex ); - if(!ctx) - goto fail; - - fb = stw_framebuffer_from_hdc( hdc ); - if(!fb) { - /* Applications should call SetPixelFormat before creating a context, - * but not all do, and the opengl32 runtime seems to use a default pixel - * format in some cases, so we must create a framebuffer for those here - */ - int iPixelFormat = GetPixelFormat(hdc); - if(iPixelFormat) - fb = stw_framebuffer_create( hdc, iPixelFormat ); - if(!fb) - goto fail; - } - - if(fb->iPixelFormat != ctx->iPixelFormat) - goto fail; - - /* Lazy allocation of the frame buffer */ - if(!stw_framebuffer_allocate(fb)) - goto fail; - - /* Bind the new framebuffer */ - ctx->hdc = hdc; - - /* pass to stw_flush_frontbuffer as context_private */ - ctx->st->pipe->priv = hdc; - - if(!st_make_current( ctx->st, fb->stfb, fb->stfb )) - goto fail; - -success: - assert(fb); - if(fb) { - stw_framebuffer_update(fb); - stw_framebuffer_release(fb); - } - - return TRUE; - -fail: - if(fb) - stw_framebuffer_release(fb); - st_make_current( NULL, NULL, NULL ); - return FALSE; -} diff --git a/src/gallium/state_trackers/wgl/shared/stw_context.h b/src/gallium/state_trackers/wgl/shared/stw_context.h deleted file mode 100644 index 166471de5e..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_context.h +++ /dev/null @@ -1,43 +0,0 @@ -/************************************************************************** - * - * 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. - * - **************************************************************************/ - -#ifndef STW_CONTEXT_H -#define STW_CONTEXT_H - -#include - -struct st_context; - -struct stw_context -{ - struct st_context *st; - UINT_PTR hglrc; - int iPixelFormat; - HDC hdc; -}; - -#endif /* STW_CONTEXT_H */ diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.c b/src/gallium/state_trackers/wgl/shared/stw_device.c deleted file mode 100644 index 0b6954915a..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_device.c +++ /dev/null @@ -1,225 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include - -#include "glapi/glthread.h" -#include "util/u_debug.h" -#include "pipe/p_screen.h" -#include "state_tracker/st_public.h" - -#ifdef DEBUG -#include "trace/tr_screen.h" -#include "trace/tr_texture.h" -#endif - -#include "shared/stw_device.h" -#include "shared/stw_winsys.h" -#include "shared/stw_pixelformat.h" -#include "shared/stw_public.h" -#include "shared/stw_tls.h" -#include "shared/stw_framebuffer.h" - -#ifdef WIN32_THREADS -extern _glthread_Mutex OneTimeLock; -extern void FreeAllTSD(void); -#endif - - -struct stw_device *stw_dev = NULL; - - -/** - * XXX: Dispatch pipe_screen::flush_front_buffer to our - * stw_winsys::flush_front_buffer. - */ -static void -stw_flush_frontbuffer(struct pipe_screen *screen, - struct pipe_surface *surface, - void *context_private ) -{ - const struct stw_winsys *stw_winsys = stw_dev->stw_winsys; - HDC hdc = (HDC)context_private; - struct stw_framebuffer *fb; - - fb = stw_framebuffer_from_hdc( hdc ); - /* fb can be NULL if window was destroyed already */ - if (fb) { -#if DEBUG - { - struct pipe_surface *surface2; - - if(!st_get_framebuffer_surface( fb->stfb, ST_SURFACE_FRONT_LEFT, &surface2 )) - assert(0); - else - assert(surface2 == surface); - } -#endif - -#ifdef DEBUG - if(stw_dev->trace_running) { - screen = trace_screen(screen)->screen; - surface = trace_surface(surface)->surface; - } -#endif - } - - stw_winsys->flush_frontbuffer(screen, surface, hdc); - - if(fb) { - stw_framebuffer_update(fb); - stw_framebuffer_release(fb); - } -} - - -boolean -stw_init(const struct stw_winsys *stw_winsys) -{ - static struct stw_device stw_dev_storage; - struct pipe_screen *screen; - - debug_printf("%s\n", __FUNCTION__); - - assert(!stw_dev); - - stw_tls_init(); - - stw_dev = &stw_dev_storage; - memset(stw_dev, 0, sizeof(*stw_dev)); - -#ifdef DEBUG - stw_dev->memdbg_no = debug_memory_begin(); -#endif - - stw_dev->stw_winsys = stw_winsys; - -#ifdef WIN32_THREADS - _glthread_INIT_MUTEX(OneTimeLock); -#endif - - screen = stw_winsys->create_screen(); - if(!screen) - goto error1; - -#ifdef DEBUG - stw_dev->screen = trace_screen_create(screen); - stw_dev->trace_running = stw_dev->screen != screen ? TRUE : FALSE; -#else - stw_dev->screen = screen; -#endif - - stw_dev->screen->flush_frontbuffer = &stw_flush_frontbuffer; - - pipe_mutex_init( stw_dev->ctx_mutex ); - pipe_mutex_init( stw_dev->fb_mutex ); - - stw_dev->ctx_table = handle_table_create(); - if (!stw_dev->ctx_table) { - goto error1; - } - - stw_pixelformat_init(); - - return TRUE; - -error1: - stw_dev = NULL; - return FALSE; -} - - -boolean -stw_init_thread(void) -{ - return stw_tls_init_thread(); -} - - -void -stw_cleanup_thread(void) -{ - stw_tls_cleanup_thread(); -} - - -void -stw_cleanup(void) -{ - unsigned i; - - debug_printf("%s\n", __FUNCTION__); - - if (!stw_dev) - return; - - pipe_mutex_lock( stw_dev->ctx_mutex ); - { - /* Ensure all contexts are destroyed */ - i = handle_table_get_first_handle(stw_dev->ctx_table); - while (i) { - stw_delete_context(i); - i = handle_table_get_next_handle(stw_dev->ctx_table, i); - } - handle_table_destroy(stw_dev->ctx_table); - } - pipe_mutex_unlock( stw_dev->ctx_mutex ); - - stw_framebuffer_cleanup(); - - pipe_mutex_destroy( stw_dev->fb_mutex ); - pipe_mutex_destroy( stw_dev->ctx_mutex ); - - stw_dev->screen->destroy(stw_dev->screen); - -#ifdef WIN32_THREADS - _glthread_DESTROY_MUTEX(OneTimeLock); - FreeAllTSD(); -#endif - -#ifdef DEBUG - debug_memory_end(stw_dev->memdbg_no); -#endif - - stw_tls_cleanup(); - - stw_dev = NULL; -} - - -struct stw_context * -stw_lookup_context_locked( UINT_PTR dhglrc ) -{ - if (dhglrc == 0) - return NULL; - - if (stw_dev == NULL) - return NULL; - - return (struct stw_context *) handle_table_get(stw_dev->ctx_table, dhglrc); -} - diff --git a/src/gallium/state_trackers/wgl/shared/stw_device.h b/src/gallium/state_trackers/wgl/shared/stw_device.h deleted file mode 100644 index e1bb9518dd..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_device.h +++ /dev/null @@ -1,77 +0,0 @@ -/************************************************************************** - * - * 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. - * - **************************************************************************/ - -#ifndef STW_DEVICE_H_ -#define STW_DEVICE_H_ - - -#include - -#include "pipe/p_compiler.h" -#include "pipe/p_thread.h" -#include "util/u_handle_table.h" -#include "stw_pixelformat.h" - - -#define STW_MAX_PIXELFORMATS 256 - - -struct pipe_screen; -struct stw_framebuffer; - -struct stw_device -{ - const struct stw_winsys *stw_winsys; - - struct pipe_screen *screen; - -#ifdef DEBUG - boolean trace_running; -#endif - - struct stw_pixelformat_info pixelformats[STW_MAX_PIXELFORMATS]; - unsigned pixelformat_count; - unsigned pixelformat_extended_count; - - pipe_mutex ctx_mutex; - struct handle_table *ctx_table; - - pipe_mutex fb_mutex; - struct stw_framebuffer *fb_head; - -#ifdef DEBUG - unsigned long memdbg_no; -#endif -}; - -struct stw_context * -stw_lookup_context_locked( UINT_PTR hglrc ); - -extern struct stw_device *stw_dev; - - -#endif /* STW_DEVICE_H_ */ diff --git a/src/gallium/state_trackers/wgl/shared/stw_extensionsstring.c b/src/gallium/state_trackers/wgl/shared/stw_extensionsstring.c deleted file mode 100644 index 62c859e1f9..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_extensionsstring.c +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include - -#define WGL_WGLEXT_PROTOTYPES - -#include -#include - - -static const char *stw_extension_string = - "WGL_ARB_extensions_string " - "WGL_ARB_multisample " - "WGL_ARB_pixel_format " -/* "WGL_EXT_swap_interval " */ - "WGL_EXT_extensions_string"; - - -WINGDIAPI const char * APIENTRY -wglGetExtensionsStringARB( - HDC hdc ) -{ - (void) hdc; - - return stw_extension_string; -} - - -WINGDIAPI const char * APIENTRY -wglGetExtensionsStringEXT( void ) -{ - return stw_extension_string; -} diff --git a/src/gallium/state_trackers/wgl/shared/stw_extgallium.c b/src/gallium/state_trackers/wgl/shared/stw_extgallium.c deleted file mode 100644 index fc22737d7e..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_extgallium.c +++ /dev/null @@ -1,79 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#include "pipe/p_screen.h" -#include "stw_public.h" -#include "stw_device.h" -#include "stw_winsys.h" - -#ifdef DEBUG -#include "trace/tr_screen.h" -#include "trace/tr_context.h" -#endif - - -struct pipe_screen * APIENTRY -wglGetGalliumScreenMESA(void) -{ - return stw_dev ? stw_dev->screen : NULL; -} - - -/* XXX: Unify with stw_create_layer_context */ -struct pipe_context * APIENTRY -wglCreateGalliumContextMESA(void) -{ - struct pipe_screen *screen = NULL; - struct pipe_context *pipe = NULL; - - if(!stw_dev) - return NULL; - - screen = stw_dev->screen; - -#ifdef DEBUG - /* Unwrap screen */ - if(stw_dev->trace_running) - screen = trace_screen(screen)->screen; -#endif - - pipe = stw_dev->stw_winsys->create_context( screen ); - if (pipe == NULL) - goto no_pipe; - -#ifdef DEBUG - /* Wrap context */ - if(stw_dev->trace_running) - pipe = trace_context_create(stw_dev->screen, pipe); -#endif - - return pipe; - -no_pipe: - return NULL; -} diff --git a/src/gallium/state_trackers/wgl/shared/stw_extgallium.h b/src/gallium/state_trackers/wgl/shared/stw_extgallium.h deleted file mode 100644 index cc35f2bb7f..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_extgallium.h +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************** - * - * 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 STW_EXTGALLIUM_H_ -#define STW_EXTGALLIUM_H_ - - -#include - - -struct pipe_screen; -struct pipe_context; - - -struct pipe_screen * APIENTRY -wglGetGalliumScreenMESA(void); - - -struct pipe_context * APIENTRY -wglCreateGalliumContextMESA(void); - - -#endif /* STW_EXTGALLIUM_H_ */ diff --git a/src/gallium/state_trackers/wgl/shared/stw_extswapinterval.c b/src/gallium/state_trackers/wgl/shared/stw_extswapinterval.c deleted file mode 100644 index 9eac6a1d09..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_extswapinterval.c +++ /dev/null @@ -1,57 +0,0 @@ -/************************************************************************** - * - * Copyright 2009 VMware, Inc. - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include - -#define WGL_WGLEXT_PROTOTYPES - -#include -#include -#include "util/u_debug.h" - -/* A dummy implementation of this extension. - * - * Required as some applications retrieve and call these functions - * regardless of the fact that we don't advertise the extension and - * further more the results of wglGetProcAddress are NULL. - */ -WINGDIAPI BOOL APIENTRY -wglSwapIntervalEXT(int interval) -{ - (void) interval; - debug_printf("%s: %d\n", __FUNCTION__, interval); - return TRUE; -} - -WINGDIAPI int APIENTRY -wglGetSwapIntervalEXT(void) -{ - return 0; -} - - diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c deleted file mode 100644 index b8956bb550..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.c +++ /dev/null @@ -1,493 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include - -#include "main/context.h" -#include "pipe/p_format.h" -#include "pipe/p_screen.h" -#include "state_tracker/st_context.h" -#include "state_tracker/st_public.h" - -#ifdef DEBUG -#include "trace/tr_screen.h" -#include "trace/tr_texture.h" -#endif - -#include "stw_framebuffer.h" -#include "stw_device.h" -#include "stw_public.h" -#include "stw_winsys.h" -#include "stw_tls.h" - - -/** - * Search the framebuffer with the matching HWND while holding the - * stw_dev::fb_mutex global lock. - */ -static INLINE struct stw_framebuffer * -stw_framebuffer_from_hwnd_locked( - HWND hwnd ) -{ - struct stw_framebuffer *fb; - - for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next) - if (fb->hWnd == hwnd) { - pipe_mutex_lock(fb->mutex); - break; - } - - return fb; -} - - -/** - * Destroy this framebuffer. Both stw_dev::fb_mutex and stw_framebuffer::mutex - * must be held, by this order. Obviously no further access to fb can be done - * after this. - */ -static INLINE void -stw_framebuffer_destroy_locked( - struct stw_framebuffer *fb ) -{ - struct stw_framebuffer **link; - - link = &stw_dev->fb_head; - while (*link != fb) - link = &(*link)->next; - assert(*link); - *link = fb->next; - fb->next = NULL; - - st_unreference_framebuffer(fb->stfb); - - pipe_mutex_unlock( fb->mutex ); - - pipe_mutex_destroy( fb->mutex ); - - FREE( fb ); -} - - -void -stw_framebuffer_release( - struct stw_framebuffer *fb) -{ - assert(fb); - pipe_mutex_unlock( fb->mutex ); -} - - -static INLINE void -stw_framebuffer_get_size( struct stw_framebuffer *fb ) -{ - unsigned width, height; - RECT rect; - - assert(fb->hWnd); - - GetClientRect( fb->hWnd, &rect ); - width = rect.right - rect.left; - height = rect.bottom - rect.top; - - if(width < 1) - width = 1; - if(height < 1) - height = 1; - - if(width != fb->width || height != fb->height) { - fb->must_resize = TRUE; - fb->width = width; - fb->height = height; - } -} - - -/** - * @sa http://msdn.microsoft.com/en-us/library/ms644975(VS.85).aspx - * @sa http://msdn.microsoft.com/en-us/library/ms644960(VS.85).aspx - */ -LRESULT CALLBACK -stw_call_window_proc( - int nCode, - WPARAM wParam, - LPARAM lParam ) -{ - struct stw_tls_data *tls_data; - PCWPSTRUCT pParams = (PCWPSTRUCT)lParam; - struct stw_framebuffer *fb; - - tls_data = stw_tls_get_data(); - if(!tls_data) - return 0; - - if (nCode < 0) - return CallNextHookEx(tls_data->hCallWndProcHook, nCode, wParam, lParam); - - if (pParams->message == WM_WINDOWPOSCHANGED) { - /* We handle WM_WINDOWPOSCHANGED instead of WM_SIZE because according to - * http://blogs.msdn.com/oldnewthing/archive/2008/01/15/7113860.aspx - * WM_SIZE is generated from WM_WINDOWPOSCHANGED by DefWindowProc so it - * can be masked out by the application. */ - LPWINDOWPOS lpWindowPos = (LPWINDOWPOS)pParams->lParam; - if((lpWindowPos->flags & SWP_SHOWWINDOW) || - !(lpWindowPos->flags & SWP_NOSIZE)) { - fb = stw_framebuffer_from_hwnd( pParams->hwnd ); - if(fb) { - /* Size in WINDOWPOS includes the window frame, so get the size - * of the client area via GetClientRect. */ - stw_framebuffer_get_size(fb); - stw_framebuffer_release(fb); - } - } - } - else if (pParams->message == WM_DESTROY) { - pipe_mutex_lock( stw_dev->fb_mutex ); - fb = stw_framebuffer_from_hwnd_locked( pParams->hwnd ); - if(fb) - stw_framebuffer_destroy_locked(fb); - pipe_mutex_unlock( stw_dev->fb_mutex ); - } - - return CallNextHookEx(tls_data->hCallWndProcHook, nCode, wParam, lParam); -} - - -struct stw_framebuffer * -stw_framebuffer_create( - HDC hdc, - int iPixelFormat ) -{ - HWND hWnd; - struct stw_framebuffer *fb; - const struct stw_pixelformat_info *pfi; - - /* We only support drawing to a window. */ - hWnd = WindowFromDC( hdc ); - if(!hWnd) - return NULL; - - fb = CALLOC_STRUCT( stw_framebuffer ); - if (fb == NULL) - return NULL; - - fb->hDC = hdc; - fb->hWnd = hWnd; - fb->iPixelFormat = iPixelFormat; - - fb->pfi = pfi = stw_pixelformat_get_info( iPixelFormat - 1 ); - - stw_pixelformat_visual(&fb->visual, pfi); - - stw_framebuffer_get_size(fb); - - pipe_mutex_init( fb->mutex ); - - /* This is the only case where we lock the stw_framebuffer::mutex before - * stw_dev::fb_mutex, since no other thread can know about this framebuffer - * and we must prevent any other thread from destroying it before we return. - */ - pipe_mutex_lock( fb->mutex ); - - pipe_mutex_lock( stw_dev->fb_mutex ); - fb->next = stw_dev->fb_head; - stw_dev->fb_head = fb; - pipe_mutex_unlock( stw_dev->fb_mutex ); - - return fb; -} - - -BOOL -stw_framebuffer_allocate( - struct stw_framebuffer *fb) -{ - assert(fb); - - if(!fb->stfb) { - const struct stw_pixelformat_info *pfi = fb->pfi; - enum pipe_format colorFormat, depthFormat, stencilFormat; - - colorFormat = pfi->color_format; - - assert(pf_layout( pfi->depth_stencil_format ) == PIPE_FORMAT_LAYOUT_RGBAZS ); - - if(pf_get_component_bits( pfi->depth_stencil_format, PIPE_FORMAT_COMP_Z )) - depthFormat = pfi->depth_stencil_format; - else - depthFormat = PIPE_FORMAT_NONE; - - if(pf_get_component_bits( pfi->depth_stencil_format, PIPE_FORMAT_COMP_S )) - stencilFormat = pfi->depth_stencil_format; - else - stencilFormat = PIPE_FORMAT_NONE; - - assert(fb->must_resize); - assert(fb->width); - assert(fb->height); - - fb->stfb = st_create_framebuffer( - &fb->visual, - colorFormat, - depthFormat, - stencilFormat, - fb->width, - fb->height, - (void *) fb ); - - // to notify the context - fb->must_resize = TRUE; - } - - return fb->stfb ? TRUE : FALSE; -} - - -/** - * Update the framebuffer's size if necessary. - */ -void -stw_framebuffer_update( - struct stw_framebuffer *fb) -{ - assert(fb->stfb); - assert(fb->height); - assert(fb->width); - - /* XXX: It would be nice to avoid checking the size again -- in theory - * stw_call_window_proc would have cought the resize and stored the right - * size already, but unfortunately threads created before the DllMain is - * called don't get a DLL_THREAD_ATTACH notification, and there is no way - * to know of their existing without using the not very portable PSAPI. - */ - stw_framebuffer_get_size(fb); - - if(fb->must_resize) { - st_resize_framebuffer(fb->stfb, fb->width, fb->height); - fb->must_resize = FALSE; - } -} - - -void -stw_framebuffer_cleanup( void ) -{ - struct stw_framebuffer *fb; - struct stw_framebuffer *next; - - pipe_mutex_lock( stw_dev->fb_mutex ); - - fb = stw_dev->fb_head; - while (fb) { - next = fb->next; - - pipe_mutex_lock(fb->mutex); - stw_framebuffer_destroy_locked(fb); - - fb = next; - } - stw_dev->fb_head = NULL; - - pipe_mutex_unlock( stw_dev->fb_mutex ); -} - - -/** - * Given an hdc, return the corresponding stw_framebuffer. - */ -static INLINE struct stw_framebuffer * -stw_framebuffer_from_hdc_locked( - HDC hdc ) -{ - HWND hwnd; - struct stw_framebuffer *fb; - - /* - * Some applications create and use several HDCs for the same window, so - * looking up the framebuffer by the HDC is not reliable. Use HWND whenever - * possible. - */ - hwnd = WindowFromDC(hdc); - if(hwnd) - return stw_framebuffer_from_hwnd_locked(hwnd); - - for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next) - if (fb->hDC == hdc) { - pipe_mutex_lock(fb->mutex); - break; - } - - return fb; -} - - -/** - * Given an hdc, return the corresponding stw_framebuffer. - */ -struct stw_framebuffer * -stw_framebuffer_from_hdc( - HDC hdc ) -{ - struct stw_framebuffer *fb; - - pipe_mutex_lock( stw_dev->fb_mutex ); - fb = stw_framebuffer_from_hdc_locked(hdc); - pipe_mutex_unlock( stw_dev->fb_mutex ); - - return fb; -} - - -/** - * Given an hdc, return the corresponding stw_framebuffer. - */ -struct stw_framebuffer * -stw_framebuffer_from_hwnd( - HWND hwnd ) -{ - struct stw_framebuffer *fb; - - pipe_mutex_lock( stw_dev->fb_mutex ); - fb = stw_framebuffer_from_hwnd_locked(hwnd); - pipe_mutex_unlock( stw_dev->fb_mutex ); - - return fb; -} - - -BOOL -stw_pixelformat_set( - HDC hdc, - int iPixelFormat ) -{ - uint count; - uint index; - struct stw_framebuffer *fb; - - index = (uint) iPixelFormat - 1; - count = stw_pixelformat_get_extended_count(); - if (index >= count) - return FALSE; - - fb = stw_framebuffer_from_hdc_locked(hdc); - if(fb) { - /* SetPixelFormat must be called only once */ - stw_framebuffer_release( fb ); - return FALSE; - } - - fb = stw_framebuffer_create(hdc, iPixelFormat); - if(!fb) { - return FALSE; - } - - stw_framebuffer_release( fb ); - - /* Some applications mistakenly use the undocumented wglSetPixelFormat - * function instead of SetPixelFormat, so we call SetPixelFormat here to - * avoid opengl32.dll's wglCreateContext to fail */ - if (GetPixelFormat(hdc) == 0) { - SetPixelFormat(hdc, iPixelFormat, NULL); - } - - return TRUE; -} - - -int -stw_pixelformat_get( - HDC hdc ) -{ - int iPixelFormat = 0; - struct stw_framebuffer *fb; - - fb = stw_framebuffer_from_hdc(hdc); - if(fb) { - iPixelFormat = fb->iPixelFormat; - stw_framebuffer_release(fb); - } - - return iPixelFormat; -} - - -BOOL -stw_swap_buffers( - HDC hdc ) -{ - struct stw_framebuffer *fb; - struct pipe_screen *screen; - struct pipe_surface *surface; - - fb = stw_framebuffer_from_hdc( hdc ); - if (fb == NULL) - return FALSE; - - if (!(fb->pfi->pfd.dwFlags & PFD_DOUBLEBUFFER)) { - stw_framebuffer_release(fb); - return TRUE; - } - - /* If we're swapping the buffer associated with the current context - * we have to flush any pending rendering commands first. - */ - st_notify_swapbuffers( fb->stfb ); - - screen = stw_dev->screen; - - if(!st_get_framebuffer_surface( fb->stfb, ST_SURFACE_BACK_LEFT, &surface )) { - /* FIXME: this shouldn't happen, but does on glean */ - stw_framebuffer_release(fb); - return FALSE; - } - -#ifdef DEBUG - if(stw_dev->trace_running) { - screen = trace_screen(screen)->screen; - surface = trace_surface(surface)->surface; - } -#endif - - stw_dev->stw_winsys->flush_frontbuffer( screen, surface, hdc ); - - stw_framebuffer_update(fb); - stw_framebuffer_release(fb); - - return TRUE; -} - - -BOOL -stw_swap_layer_buffers( - HDC hdc, - UINT fuPlanes ) -{ - if(fuPlanes & WGL_SWAP_MAIN_PLANE) - return stw_swap_buffers(hdc); - - return FALSE; -} diff --git a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h b/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h deleted file mode 100644 index 13d29f37e4..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_framebuffer.h +++ /dev/null @@ -1,148 +0,0 @@ -/************************************************************************** - * - * 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. - * - **************************************************************************/ - -#ifndef STW_FRAMEBUFFER_H -#define STW_FRAMEBUFFER_H - -#include - -#include "main/mtypes.h" - -#include "pipe/p_thread.h" - -struct stw_pixelformat_info; - -/** - * Windows framebuffer, derived from gl_framebuffer. - */ -struct stw_framebuffer -{ - /** - * This mutex has two purposes: - * - protect the access to the mutable data members below - * - prevent the the framebuffer from being deleted while being accessed. - * - * It is OK to lock this mutex while holding the stw_device::fb_mutex lock, - * but the opposite must never happen. - */ - pipe_mutex mutex; - - /* - * Immutable members. - * - * Note that even access to immutable members implies acquiring the mutex - * above, to prevent the framebuffer from being destroyed. - */ - - HDC hDC; - HWND hWnd; - - int iPixelFormat; - const struct stw_pixelformat_info *pfi; - GLvisual visual; - - /* - * Mutable members. - */ - - struct st_framebuffer *stfb; - - /* FIXME: Make this work for multiple contexts bound to the same framebuffer */ - boolean must_resize; - unsigned width; - unsigned height; - - /** - * This is protected by stw_device::fb_mutex, not the mutex above. - * - * Deletions must be done by first acquiring stw_device::fb_mutex, and then - * acquiring the stw_framebuffer::mutex of the framebuffer to be deleted. - * This ensures that nobody else is reading/writing to the. - * - * It is not necessary to aquire the mutex above to navigate the linked list - * given that deletions are done with stw_device::fb_mutex held, so no other - * thread can delete. - */ - struct stw_framebuffer *next; -}; - - -/** - * Create a new framebuffer object which will correspond to the given HDC. - * - * This function will acquire stw_framebuffer::mutex. stw_framebuffer_release - * must be called when done - */ -struct stw_framebuffer * -stw_framebuffer_create( - HDC hdc, - int iPixelFormat ); - -/** - * Search a framebuffer with a matching HWND. - * - * This function will acquire stw_framebuffer::mutex. stw_framebuffer_release - * must be called when done - */ -struct stw_framebuffer * -stw_framebuffer_from_hwnd( - HWND hwnd ); - -/** - * Search a framebuffer with a matching HDC. - * - * This function will acquire stw_framebuffer::mutex. stw_framebuffer_release - * must be called when done - */ -struct stw_framebuffer * -stw_framebuffer_from_hdc( - HDC hdc ); - -BOOL -stw_framebuffer_allocate( - struct stw_framebuffer *fb ); - -void -stw_framebuffer_update( - struct stw_framebuffer *fb); - -/** - * Release stw_framebuffer::mutex lock. This framebuffer must not be accessed - * after calling this function, as it may have been deleted by another thread - * in the meanwhile. - */ -void -stw_framebuffer_release( - struct stw_framebuffer *fb); - -/** - * Cleanup any existing framebuffers when exiting application. - */ -void -stw_framebuffer_cleanup(void); - -#endif /* STW_FRAMEBUFFER_H */ diff --git a/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c b/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c deleted file mode 100644 index 879ced925a..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_getprocaddress.c +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include - -#define WGL_WGLEXT_PROTOTYPES - -#include -#include - -#include "glapi/glapi.h" -#include "stw_public.h" -#include "stw_extgallium.h" - -struct stw_extension_entry -{ - const char *name; - PROC proc; -}; - -#define STW_EXTENSION_ENTRY(P) { #P, (PROC) P } - -static const struct stw_extension_entry stw_extension_entries[] = { - - /* WGL_ARB_extensions_string */ - STW_EXTENSION_ENTRY( wglGetExtensionsStringARB ), - - /* WGL_ARB_pixel_format */ - STW_EXTENSION_ENTRY( wglChoosePixelFormatARB ), - STW_EXTENSION_ENTRY( wglGetPixelFormatAttribfvARB ), - STW_EXTENSION_ENTRY( wglGetPixelFormatAttribivARB ), - - /* WGL_EXT_extensions_string */ - STW_EXTENSION_ENTRY( wglGetExtensionsStringEXT ), - - /* WGL_EXT_swap_interval */ - STW_EXTENSION_ENTRY( wglGetSwapIntervalEXT ), - STW_EXTENSION_ENTRY( wglSwapIntervalEXT ), - - /* WGL_EXT_gallium ? */ - STW_EXTENSION_ENTRY( wglGetGalliumScreenMESA ), - STW_EXTENSION_ENTRY( wglCreateGalliumContextMESA ), - - { NULL, NULL } -}; - -PROC -stw_get_proc_address( - LPCSTR lpszProc ) -{ - const struct stw_extension_entry *entry; - - if (lpszProc[0] == 'w' && lpszProc[1] == 'g' && lpszProc[2] == 'l') - for (entry = stw_extension_entries; entry->name; entry++) - if (strcmp( lpszProc, entry->name ) == 0) - return entry->proc; - - if (lpszProc[0] == 'g' && lpszProc[1] == 'l') - return (PROC) _glapi_get_proc_address( lpszProc ); - - return NULL; -} diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c deleted file mode 100644 index c296744838..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.c +++ /dev/null @@ -1,370 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include "main/mtypes.h" -#include "main/context.h" - -#include "pipe/p_format.h" -#include "pipe/p_defines.h" -#include "pipe/p_screen.h" - -#include "util/u_debug.h" - -#include "stw_device.h" -#include "stw_pixelformat.h" -#include "stw_public.h" -#include "stw_tls.h" - - -struct stw_pf_color_info -{ - enum pipe_format format; - struct { - unsigned char red; - unsigned char green; - unsigned char blue; - unsigned char alpha; - } bits; - struct { - unsigned char red; - unsigned char green; - unsigned char blue; - unsigned char alpha; - } shift; -}; - -struct stw_pf_depth_info -{ - enum pipe_format format; - struct { - unsigned char depth; - unsigned char stencil; - } bits; -}; - - -/* NOTE: order matters, since in otherwise equal circumstances the first - * format listed will get chosen */ - -static const struct stw_pf_color_info -stw_pf_color[] = { - /* no-alpha */ - { PIPE_FORMAT_X8R8G8B8_UNORM, { 8, 8, 8, 0}, {16, 8, 0, 0} }, - { PIPE_FORMAT_B8G8R8X8_UNORM, { 8, 8, 8, 0}, { 8, 16, 24, 0} }, - { PIPE_FORMAT_R5G6B5_UNORM, { 5, 6, 5, 0}, {11, 5, 0, 0} }, - /* alpha */ - { PIPE_FORMAT_A8R8G8B8_UNORM, { 8, 8, 8, 8}, {16, 8, 0, 24} }, - { PIPE_FORMAT_B8G8R8A8_UNORM, { 8, 8, 8, 8}, { 8, 16, 24, 0} }, -#if 0 - { PIPE_FORMAT_A2B10G10R10_UNORM, {10, 10, 10, 2}, { 0, 10, 20, 30} }, -#endif - { PIPE_FORMAT_A1R5G5B5_UNORM, { 5, 5, 5, 1}, {10, 5, 0, 15} }, - { PIPE_FORMAT_A4R4G4B4_UNORM, { 4, 4, 4, 4}, {16, 4, 0, 12} } -}; - - -static const struct stw_pf_depth_info -stw_pf_depth_stencil[] = { - /* pure depth */ - { PIPE_FORMAT_Z32_UNORM, {32, 0} }, - { PIPE_FORMAT_Z24X8_UNORM, {24, 0} }, - { PIPE_FORMAT_X8Z24_UNORM, {24, 0} }, - { PIPE_FORMAT_Z16_UNORM, {16, 0} }, - /* pure stencil */ - { PIPE_FORMAT_S8_UNORM, { 0, 8} }, - /* combined depth-stencil */ - { PIPE_FORMAT_S8Z24_UNORM, {24, 8} }, - { PIPE_FORMAT_Z24S8_UNORM, {24, 8} } -}; - - -static const boolean -stw_pf_doublebuffer[] = { - FALSE, - TRUE, -}; - - -const unsigned -stw_pf_multisample[] = { - 0, - 4 -}; - - -static void -stw_pixelformat_add( - struct stw_device *stw_dev, - const struct stw_pf_color_info *color, - const struct stw_pf_depth_info *depth, - unsigned accum, - boolean doublebuffer, - unsigned samples ) -{ - boolean extended = FALSE; - struct stw_pixelformat_info *pfi; - - assert(stw_dev->pixelformat_extended_count < STW_MAX_PIXELFORMATS); - if(stw_dev->pixelformat_extended_count >= STW_MAX_PIXELFORMATS) - return; - - assert(pf_layout( color->format ) == PIPE_FORMAT_LAYOUT_RGBAZS ); - assert(pf_get_component_bits( color->format, PIPE_FORMAT_COMP_R ) == color->bits.red ); - assert(pf_get_component_bits( color->format, PIPE_FORMAT_COMP_G ) == color->bits.green ); - assert(pf_get_component_bits( color->format, PIPE_FORMAT_COMP_B ) == color->bits.blue ); - assert(pf_get_component_bits( color->format, PIPE_FORMAT_COMP_A ) == color->bits.alpha ); - assert(pf_layout( depth->format ) == PIPE_FORMAT_LAYOUT_RGBAZS ); - assert(pf_get_component_bits( depth->format, PIPE_FORMAT_COMP_Z ) == depth->bits.depth ); - assert(pf_get_component_bits( depth->format, PIPE_FORMAT_COMP_S ) == depth->bits.stencil ); - - pfi = &stw_dev->pixelformats[stw_dev->pixelformat_extended_count]; - - memset(pfi, 0, sizeof *pfi); - - pfi->color_format = color->format; - pfi->depth_stencil_format = depth->format; - - pfi->pfd.nSize = sizeof pfi->pfd; - pfi->pfd.nVersion = 1; - - pfi->pfd.dwFlags = PFD_SUPPORT_OPENGL; - - /* TODO: also support non-native pixel formats */ - pfi->pfd.dwFlags |= PFD_DRAW_TO_WINDOW ; - - if (doublebuffer) - pfi->pfd.dwFlags |= PFD_DOUBLEBUFFER | PFD_SWAP_COPY; - - pfi->pfd.iPixelType = PFD_TYPE_RGBA; - - pfi->pfd.cColorBits = color->bits.red + color->bits.green + color->bits.blue + color->bits.alpha; - pfi->pfd.cRedBits = color->bits.red; - pfi->pfd.cRedShift = color->shift.red; - pfi->pfd.cGreenBits = color->bits.green; - pfi->pfd.cGreenShift = color->shift.green; - pfi->pfd.cBlueBits = color->bits.blue; - pfi->pfd.cBlueShift = color->shift.blue; - pfi->pfd.cAlphaBits = color->bits.alpha; - pfi->pfd.cAlphaShift = color->shift.alpha; - pfi->pfd.cAccumBits = 4*accum; - pfi->pfd.cAccumRedBits = accum; - pfi->pfd.cAccumGreenBits = accum; - pfi->pfd.cAccumBlueBits = accum; - pfi->pfd.cAccumAlphaBits = accum; - pfi->pfd.cDepthBits = depth->bits.depth; - pfi->pfd.cStencilBits = depth->bits.stencil; - pfi->pfd.cAuxBuffers = 0; - pfi->pfd.iLayerType = 0; - pfi->pfd.bReserved = 0; - pfi->pfd.dwLayerMask = 0; - pfi->pfd.dwVisibleMask = 0; - pfi->pfd.dwDamageMask = 0; - - if(samples) { - pfi->numSampleBuffers = 1; - pfi->numSamples = samples; - extended = TRUE; - } - - ++stw_dev->pixelformat_extended_count; - - if(!extended) { - ++stw_dev->pixelformat_count; - assert(stw_dev->pixelformat_count == stw_dev->pixelformat_extended_count); - } -} - -void -stw_pixelformat_init( void ) -{ - struct pipe_screen *screen = stw_dev->screen; - unsigned i, j, k, l; - - assert( !stw_dev->pixelformat_count ); - assert( !stw_dev->pixelformat_extended_count ); - - for(i = 0; i < Elements(stw_pf_multisample); ++i) { - unsigned samples = stw_pf_multisample[i]; - - /* FIXME: re-enabled MSAA when we can query it */ - if(samples) - continue; - - for(j = 0; j < Elements(stw_pf_color); ++j) { - const struct stw_pf_color_info *color = &stw_pf_color[j]; - - if(!screen->is_format_supported(screen, color->format, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) - continue; - - for(k = 0; k < Elements(stw_pf_doublebuffer); ++k) { - unsigned doublebuffer = stw_pf_doublebuffer[k]; - - for(l = 0; l < Elements(stw_pf_depth_stencil); ++l) { - const struct stw_pf_depth_info *depth = &stw_pf_depth_stencil[l]; - - if(!screen->is_format_supported(screen, depth->format, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0)) - continue; - - stw_pixelformat_add( stw_dev, color, depth, 0, doublebuffer, samples ); - stw_pixelformat_add( stw_dev, color, depth, 16, doublebuffer, samples ); - } - } - } - } - - assert( stw_dev->pixelformat_count <= stw_dev->pixelformat_extended_count ); - assert( stw_dev->pixelformat_extended_count <= STW_MAX_PIXELFORMATS ); -} - -uint -stw_pixelformat_get_count( void ) -{ - return stw_dev->pixelformat_count; -} - -uint -stw_pixelformat_get_extended_count( void ) -{ - return stw_dev->pixelformat_extended_count; -} - -const struct stw_pixelformat_info * -stw_pixelformat_get_info( uint index ) -{ - assert( index < stw_dev->pixelformat_extended_count ); - - return &stw_dev->pixelformats[index]; -} - - -void -stw_pixelformat_visual(GLvisual *visual, - const struct stw_pixelformat_info *pfi ) -{ - memset(visual, 0, sizeof *visual); - _mesa_initialize_visual( - visual, - (pfi->pfd.iPixelType == PFD_TYPE_RGBA) ? GL_TRUE : GL_FALSE, - (pfi->pfd.dwFlags & PFD_DOUBLEBUFFER) ? GL_TRUE : GL_FALSE, - (pfi->pfd.dwFlags & PFD_STEREO) ? GL_TRUE : GL_FALSE, - pfi->pfd.cRedBits, - pfi->pfd.cGreenBits, - pfi->pfd.cBlueBits, - pfi->pfd.cAlphaBits, - (pfi->pfd.iPixelType == PFD_TYPE_COLORINDEX) ? pfi->pfd.cColorBits : 0, - pfi->pfd.cDepthBits, - pfi->pfd.cStencilBits, - pfi->pfd.cAccumRedBits, - pfi->pfd.cAccumGreenBits, - pfi->pfd.cAccumBlueBits, - pfi->pfd.cAccumAlphaBits, - pfi->numSamples ); -} - - -int -stw_pixelformat_describe( - HDC hdc, - int iPixelFormat, - UINT nBytes, - LPPIXELFORMATDESCRIPTOR ppfd ) -{ - uint count; - uint index; - const struct stw_pixelformat_info *pfi; - - (void) hdc; - - count = stw_pixelformat_get_extended_count(); - index = (uint) iPixelFormat - 1; - - if (ppfd == NULL) - return count; - if (index >= count || nBytes != sizeof( PIXELFORMATDESCRIPTOR )) - return 0; - - pfi = stw_pixelformat_get_info( index ); - - memcpy(ppfd, &pfi->pfd, sizeof( PIXELFORMATDESCRIPTOR )); - - return count; -} - -/* Only used by the wgl code, but have it here to avoid exporting the - * pixelformat.h functionality. - */ -int stw_pixelformat_choose( HDC hdc, - CONST PIXELFORMATDESCRIPTOR *ppfd ) -{ - uint count; - uint index; - uint bestindex; - uint bestdelta; - - (void) hdc; - - count = stw_pixelformat_get_count(); - bestindex = count; - bestdelta = ~0U; - - for (index = 0; index < count; index++) { - uint delta = 0; - const struct stw_pixelformat_info *pfi = stw_pixelformat_get_info( index ); - - if (!(ppfd->dwFlags & PFD_DOUBLEBUFFER_DONTCARE) && - !!(ppfd->dwFlags & PFD_DOUBLEBUFFER) != - !!(pfi->pfd.dwFlags & PFD_DOUBLEBUFFER)) - continue; - - /* FIXME: Take in account individual channel bits */ - if (ppfd->cColorBits != pfi->pfd.cColorBits) - delta += 8; - - if (ppfd->cDepthBits != pfi->pfd.cDepthBits) - delta += 4; - - if (ppfd->cStencilBits != pfi->pfd.cStencilBits) - delta += 2; - - if (ppfd->cAlphaBits != pfi->pfd.cAlphaBits) - delta++; - - if (delta < bestdelta) { - bestindex = index; - bestdelta = delta; - if (bestdelta == 0) - break; - } - } - - if (bestindex == count) - return 0; - - return bestindex + 1; -} diff --git a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h b/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h deleted file mode 100644 index bec429231b..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_pixelformat.h +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************** - * - * 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. - * - **************************************************************************/ - -#ifndef STW_PIXELFORMAT_H -#define STW_PIXELFORMAT_H - -#include - -#include "main/mtypes.h" - -#include "pipe/p_compiler.h" -#include "pipe/p_format.h" - -struct stw_pixelformat_info -{ - enum pipe_format color_format; - enum pipe_format depth_stencil_format; - - PIXELFORMATDESCRIPTOR pfd; - - unsigned numSampleBuffers; - unsigned numSamples; -}; - -void -stw_pixelformat_init( void ); - -uint -stw_pixelformat_get_count( void ); - -uint -stw_pixelformat_get_extended_count( void ); - -const struct stw_pixelformat_info * -stw_pixelformat_get_info( uint index ); - -void -stw_pixelformat_visual(GLvisual *visual, - const struct stw_pixelformat_info *pfi ); - -#endif /* STW_PIXELFORMAT_H */ diff --git a/src/gallium/state_trackers/wgl/shared/stw_public.h b/src/gallium/state_trackers/wgl/shared/stw_public.h deleted file mode 100644 index 7fe9cfb356..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_public.h +++ /dev/null @@ -1,73 +0,0 @@ -/************************************************************************** - * - * 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. - * - **************************************************************************/ - -#ifndef STW_PUBLIC_H -#define STW_PUBLIC_H - -#include - -BOOL stw_copy_context( UINT_PTR hglrcSrc, - UINT_PTR hglrcDst, - UINT mask ); - -UINT_PTR stw_create_layer_context( HDC hdc, - int iLayerPlane ); - -BOOL stw_share_lists( UINT_PTR hglrc1, UINT_PTR hglrc2 ); - -BOOL stw_delete_context( UINT_PTR hglrc ); - -BOOL -stw_release_context( UINT_PTR dhglrc ); - -UINT_PTR stw_get_current_context( void ); - -HDC stw_get_current_dc( void ); - -BOOL stw_make_current( HDC hdc, UINT_PTR hglrc ); - -BOOL stw_swap_buffers( HDC hdc ); - -BOOL -stw_swap_layer_buffers( HDC hdc, UINT fuPlanes ); - -PROC stw_get_proc_address( LPCSTR lpszProc ); - -int stw_pixelformat_describe( HDC hdc, - int iPixelFormat, - UINT nBytes, - LPPIXELFORMATDESCRIPTOR ppfd ); - -int stw_pixelformat_get( HDC hdc ); - -BOOL stw_pixelformat_set( HDC hdc, - int iPixelFormat ); - -int stw_pixelformat_choose( HDC hdc, - CONST PIXELFORMATDESCRIPTOR *ppfd ); - -#endif diff --git a/src/gallium/state_trackers/wgl/shared/stw_tls.c b/src/gallium/state_trackers/wgl/shared/stw_tls.c deleted file mode 100644 index 4bd6a9289c..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_tls.c +++ /dev/null @@ -1,139 +0,0 @@ -/************************************************************************** - * - * 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. - * - **************************************************************************/ - -#include - -#include "pipe/p_compiler.h" -#include "util/u_memory.h" -#include "stw_tls.h" - -static DWORD tlsIndex = TLS_OUT_OF_INDEXES; - -boolean -stw_tls_init(void) -{ - tlsIndex = TlsAlloc(); - if (tlsIndex == TLS_OUT_OF_INDEXES) { - return FALSE; - } - - return TRUE; -} - -static INLINE struct stw_tls_data * -stw_tls_data_create() -{ - struct stw_tls_data *data; - - data = CALLOC_STRUCT(stw_tls_data); - if (!data) - goto no_data; - - data->hCallWndProcHook = SetWindowsHookEx(WH_CALLWNDPROC, - stw_call_window_proc, - NULL, - GetCurrentThreadId()); - if(data->hCallWndProcHook == NULL) - goto no_hook; - - TlsSetValue(tlsIndex, data); - - return data; - -no_hook: - FREE(data); -no_data: - return NULL; -} - -boolean -stw_tls_init_thread(void) -{ - struct stw_tls_data *data; - - if (tlsIndex == TLS_OUT_OF_INDEXES) { - return FALSE; - } - - data = stw_tls_data_create(); - if(!data) - return FALSE; - - return TRUE; -} - -void -stw_tls_cleanup_thread(void) -{ - struct stw_tls_data *data; - - if (tlsIndex == TLS_OUT_OF_INDEXES) { - return; - } - - data = (struct stw_tls_data *) TlsGetValue(tlsIndex); - if(data) { - TlsSetValue(tlsIndex, NULL); - - if(data->hCallWndProcHook) { - UnhookWindowsHookEx(data->hCallWndProcHook); - data->hCallWndProcHook = NULL; - } - - FREE(data); - } -} - -void -stw_tls_cleanup(void) -{ - if (tlsIndex != TLS_OUT_OF_INDEXES) { - TlsFree(tlsIndex); - tlsIndex = TLS_OUT_OF_INDEXES; - } -} - -struct stw_tls_data * -stw_tls_get_data(void) -{ - struct stw_tls_data *data; - - if (tlsIndex == TLS_OUT_OF_INDEXES) { - return NULL; - } - - data = (struct stw_tls_data *) TlsGetValue(tlsIndex); - if(!data) { - /* DllMain is called with DLL_THREAD_ATTACH only by threads created after - * the DLL is loaded by the process */ - data = stw_tls_data_create(); - if(!data) - return NULL; - } - - return data; -} diff --git a/src/gallium/state_trackers/wgl/shared/stw_tls.h b/src/gallium/state_trackers/wgl/shared/stw_tls.h deleted file mode 100644 index fbf8b1cbee..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_tls.h +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************** - * - * 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. - * - **************************************************************************/ - -#ifndef STW_TLS_H -#define STW_TLS_H - -#include - -struct stw_tls_data -{ - HHOOK hCallWndProcHook; -}; - -boolean -stw_tls_init(void); - -boolean -stw_tls_init_thread(void); - -void -stw_tls_cleanup_thread(void); - -void -stw_tls_cleanup(void); - -struct stw_tls_data * -stw_tls_get_data(void); - -LRESULT CALLBACK -stw_call_window_proc( - int nCode, - WPARAM wParam, - LPARAM lParam ); - -#endif /* STW_TLS_H */ diff --git a/src/gallium/state_trackers/wgl/shared/stw_winsys.h b/src/gallium/state_trackers/wgl/shared/stw_winsys.h deleted file mode 100644 index c0bf82c9ed..0000000000 --- a/src/gallium/state_trackers/wgl/shared/stw_winsys.h +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************** - * - * 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. - * - **************************************************************************/ - -#ifndef STW_WINSYS_H -#define STW_WINSYS_H - -#include /* for HDC */ - -#include "pipe/p_compiler.h" - -struct pipe_screen; -struct pipe_context; -struct pipe_surface; - -struct stw_winsys -{ - struct pipe_screen * - (*create_screen)( void ); - - struct pipe_context * - (*create_context)( struct pipe_screen *screen ); - - void - (*flush_frontbuffer)( struct pipe_screen *screen, - struct pipe_surface *surf, - HDC hDC ); -}; - -boolean -stw_init(const struct stw_winsys *stw_winsys); - -boolean -stw_init_thread(void); - -void -stw_cleanup_thread(void); - -void -stw_cleanup(void); - -#endif /* STW_WINSYS_H */ diff --git a/src/gallium/state_trackers/wgl/stw_context.c b/src/gallium/state_trackers/wgl/stw_context.c new file mode 100644 index 0000000000..ead2c13cbf --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_context.c @@ -0,0 +1,382 @@ +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include + +#include "main/mtypes.h" +#include "main/context.h" +#include "pipe/p_compiler.h" +#include "pipe/p_context.h" +#include "state_tracker/st_context.h" +#include "state_tracker/st_public.h" + +#ifdef DEBUG +#include "trace/tr_screen.h" +#include "trace/tr_context.h" +#endif + +#include "stw_device.h" +#include "stw_winsys.h" +#include "stw_framebuffer.h" +#include "stw_pixelformat.h" +#include "stw_public.h" +#include "stw_context.h" +#include "stw_tls.h" + + +static INLINE struct stw_context * +stw_context(GLcontext *glctx) +{ + if(!glctx) + return NULL; + assert(glctx->DriverCtx); + return (struct stw_context *)glctx->DriverCtx; +} + +static INLINE struct stw_context * +stw_current_context(void) +{ + /* We must check if multiple threads are being used or GET_CURRENT_CONTEXT + * might return the current context of the thread first seen. */ + _glapi_check_multithread(); + + { + GET_CURRENT_CONTEXT( glctx ); + return stw_context(glctx); + } +} + +BOOL +stw_copy_context( + UINT_PTR hglrcSrc, + UINT_PTR hglrcDst, + UINT mask ) +{ + struct stw_context *src; + struct stw_context *dst; + BOOL ret = FALSE; + + pipe_mutex_lock( stw_dev->ctx_mutex ); + + src = stw_lookup_context_locked( hglrcSrc ); + dst = stw_lookup_context_locked( hglrcDst ); + + if (src && dst) { + /* FIXME */ + assert(0); + (void) src; + (void) dst; + (void) mask; + } + + pipe_mutex_unlock( stw_dev->ctx_mutex ); + + return ret; +} + +BOOL +stw_share_lists( + UINT_PTR hglrc1, + UINT_PTR hglrc2 ) +{ + struct stw_context *ctx1; + struct stw_context *ctx2; + BOOL ret = FALSE; + + pipe_mutex_lock( stw_dev->ctx_mutex ); + + ctx1 = stw_lookup_context_locked( hglrc1 ); + ctx2 = stw_lookup_context_locked( hglrc2 ); + + if (ctx1 && ctx2 && + ctx1->iPixelFormat == ctx2->iPixelFormat) { + ret = _mesa_share_state(ctx2->st->ctx, ctx1->st->ctx); + } + + pipe_mutex_unlock( stw_dev->ctx_mutex ); + + return ret; +} + +static void +stw_viewport(GLcontext * glctx, GLint x, GLint y, + GLsizei width, GLsizei height) +{ + struct stw_context *ctx = (struct stw_context *)glctx->DriverCtx; + struct stw_framebuffer *fb; + + fb = stw_framebuffer_from_hdc( ctx->hdc ); + if(fb) { + stw_framebuffer_update(fb); + stw_framebuffer_release(fb); + } +} + +UINT_PTR +stw_create_layer_context( + HDC hdc, + int iLayerPlane ) +{ + int iPixelFormat; + const struct stw_pixelformat_info *pfi; + GLvisual visual; + struct stw_context *ctx = NULL; + struct pipe_screen *screen = NULL; + struct pipe_context *pipe = NULL; + + if(!stw_dev) + return 0; + + if (iLayerPlane != 0) + return 0; + + iPixelFormat = GetPixelFormat(hdc); + if(!iPixelFormat) + return 0; + + pfi = stw_pixelformat_get_info( iPixelFormat - 1 ); + stw_pixelformat_visual(&visual, pfi); + + ctx = CALLOC_STRUCT( stw_context ); + if (ctx == NULL) + goto no_ctx; + + ctx->hdc = hdc; + ctx->iPixelFormat = iPixelFormat; + + screen = stw_dev->screen; + +#ifdef DEBUG + /* Unwrap screen */ + if(stw_dev->trace_running) + screen = trace_screen(screen)->screen; +#endif + + pipe = stw_dev->stw_winsys->create_context( screen ); + if (pipe == NULL) + goto no_pipe; + +#ifdef DEBUG + /* Wrap context */ + if(stw_dev->trace_running) + pipe = trace_context_create(stw_dev->screen, pipe); +#endif + + /* pass to stw_flush_frontbuffer as context_private */ + assert(!pipe->priv); + pipe->priv = hdc; + + ctx->st = st_create_context( pipe, &visual, NULL ); + if (ctx->st == NULL) + goto no_st_ctx; + + ctx->st->ctx->DriverCtx = ctx; + ctx->st->ctx->Driver.Viewport = stw_viewport; + + pipe_mutex_lock( stw_dev->ctx_mutex ); + ctx->hglrc = handle_table_add(stw_dev->ctx_table, ctx); + pipe_mutex_unlock( stw_dev->ctx_mutex ); + if (!ctx->hglrc) + goto no_hglrc; + + return ctx->hglrc; + +no_hglrc: + st_destroy_context(ctx->st); + goto no_pipe; /* st_context_destroy already destroys pipe */ +no_st_ctx: + pipe->destroy( pipe ); +no_pipe: + FREE(ctx); +no_ctx: + return 0; +} + +BOOL +stw_delete_context( + UINT_PTR hglrc ) +{ + struct stw_context *ctx ; + BOOL ret = FALSE; + + if (!stw_dev) + return FALSE; + + pipe_mutex_lock( stw_dev->ctx_mutex ); + ctx = stw_lookup_context_locked(hglrc); + handle_table_remove(stw_dev->ctx_table, hglrc); + pipe_mutex_unlock( stw_dev->ctx_mutex ); + + if (ctx) { + struct stw_context *curctx = stw_current_context(); + + /* Unbind current if deleting current context. */ + if (curctx == ctx) + st_make_current( NULL, NULL, NULL ); + + st_destroy_context(ctx->st); + FREE(ctx); + + ret = TRUE; + } + + return ret; +} + +BOOL +stw_release_context( + UINT_PTR hglrc ) +{ + struct stw_context *ctx; + + if (!stw_dev) + return FALSE; + + pipe_mutex_lock( stw_dev->ctx_mutex ); + ctx = stw_lookup_context_locked( hglrc ); + pipe_mutex_unlock( stw_dev->ctx_mutex ); + + if (!ctx) + return FALSE; + + /* The expectation is that ctx is the same context which is + * current for this thread. We should check that and return False + * if not the case. + */ + if (ctx != stw_current_context()) + return FALSE; + + if (stw_make_current( NULL, 0 ) == FALSE) + return FALSE; + + return TRUE; +} + + +UINT_PTR +stw_get_current_context( void ) +{ + struct stw_context *ctx; + + ctx = stw_current_context(); + if(!ctx) + return 0; + + return ctx->hglrc; +} + +HDC +stw_get_current_dc( void ) +{ + struct stw_context *ctx; + + ctx = stw_current_context(); + if(!ctx) + return NULL; + + return ctx->hdc; +} + +BOOL +stw_make_current( + HDC hdc, + UINT_PTR hglrc ) +{ + struct stw_context *curctx = NULL; + struct stw_context *ctx = NULL; + struct stw_framebuffer *fb = NULL; + + if (!stw_dev) + goto fail; + + curctx = stw_current_context(); + if (curctx != NULL) { + if (curctx->hglrc != hglrc) + st_flush(curctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); + + /* Return if already current. */ + if (curctx->hglrc == hglrc && curctx->hdc == hdc) { + ctx = curctx; + fb = stw_framebuffer_from_hdc( hdc ); + goto success; + } + } + + if (hdc == NULL || hglrc == 0) { + return st_make_current( NULL, NULL, NULL ); + } + + pipe_mutex_lock( stw_dev->ctx_mutex ); + ctx = stw_lookup_context_locked( hglrc ); + pipe_mutex_unlock( stw_dev->ctx_mutex ); + if(!ctx) + goto fail; + + fb = stw_framebuffer_from_hdc( hdc ); + if(!fb) { + /* Applications should call SetPixelFormat before creating a context, + * but not all do, and the opengl32 runtime seems to use a default pixel + * format in some cases, so we must create a framebuffer for those here + */ + int iPixelFormat = GetPixelFormat(hdc); + if(iPixelFormat) + fb = stw_framebuffer_create( hdc, iPixelFormat ); + if(!fb) + goto fail; + } + + if(fb->iPixelFormat != ctx->iPixelFormat) + goto fail; + + /* Lazy allocation of the frame buffer */ + if(!stw_framebuffer_allocate(fb)) + goto fail; + + /* Bind the new framebuffer */ + ctx->hdc = hdc; + + /* pass to stw_flush_frontbuffer as context_private */ + ctx->st->pipe->priv = hdc; + + if(!st_make_current( ctx->st, fb->stfb, fb->stfb )) + goto fail; + +success: + assert(fb); + if(fb) { + stw_framebuffer_update(fb); + stw_framebuffer_release(fb); + } + + return TRUE; + +fail: + if(fb) + stw_framebuffer_release(fb); + st_make_current( NULL, NULL, NULL ); + return FALSE; +} diff --git a/src/gallium/state_trackers/wgl/stw_context.h b/src/gallium/state_trackers/wgl/stw_context.h new file mode 100644 index 0000000000..166471de5e --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_context.h @@ -0,0 +1,43 @@ +/************************************************************************** + * + * 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. + * + **************************************************************************/ + +#ifndef STW_CONTEXT_H +#define STW_CONTEXT_H + +#include + +struct st_context; + +struct stw_context +{ + struct st_context *st; + UINT_PTR hglrc; + int iPixelFormat; + HDC hdc; +}; + +#endif /* STW_CONTEXT_H */ diff --git a/src/gallium/state_trackers/wgl/stw_device.c b/src/gallium/state_trackers/wgl/stw_device.c new file mode 100644 index 0000000000..cbc3570cb9 --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_device.c @@ -0,0 +1,225 @@ +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include + +#include "glapi/glthread.h" +#include "util/u_debug.h" +#include "pipe/p_screen.h" +#include "state_tracker/st_public.h" + +#ifdef DEBUG +#include "trace/tr_screen.h" +#include "trace/tr_texture.h" +#endif + +#include "stw_device.h" +#include "stw_winsys.h" +#include "stw_pixelformat.h" +#include "stw_public.h" +#include "stw_tls.h" +#include "stw_framebuffer.h" + +#ifdef WIN32_THREADS +extern _glthread_Mutex OneTimeLock; +extern void FreeAllTSD(void); +#endif + + +struct stw_device *stw_dev = NULL; + + +/** + * XXX: Dispatch pipe_screen::flush_front_buffer to our + * stw_winsys::flush_front_buffer. + */ +static void +stw_flush_frontbuffer(struct pipe_screen *screen, + struct pipe_surface *surface, + void *context_private ) +{ + const struct stw_winsys *stw_winsys = stw_dev->stw_winsys; + HDC hdc = (HDC)context_private; + struct stw_framebuffer *fb; + + fb = stw_framebuffer_from_hdc( hdc ); + /* fb can be NULL if window was destroyed already */ + if (fb) { +#if DEBUG + { + struct pipe_surface *surface2; + + if(!st_get_framebuffer_surface( fb->stfb, ST_SURFACE_FRONT_LEFT, &surface2 )) + assert(0); + else + assert(surface2 == surface); + } +#endif + +#ifdef DEBUG + if(stw_dev->trace_running) { + screen = trace_screen(screen)->screen; + surface = trace_surface(surface)->surface; + } +#endif + } + + stw_winsys->flush_frontbuffer(screen, surface, hdc); + + if(fb) { + stw_framebuffer_update(fb); + stw_framebuffer_release(fb); + } +} + + +boolean +stw_init(const struct stw_winsys *stw_winsys) +{ + static struct stw_device stw_dev_storage; + struct pipe_screen *screen; + + debug_printf("%s\n", __FUNCTION__); + + assert(!stw_dev); + + stw_tls_init(); + + stw_dev = &stw_dev_storage; + memset(stw_dev, 0, sizeof(*stw_dev)); + +#ifdef DEBUG + stw_dev->memdbg_no = debug_memory_begin(); +#endif + + stw_dev->stw_winsys = stw_winsys; + +#ifdef WIN32_THREADS + _glthread_INIT_MUTEX(OneTimeLock); +#endif + + screen = stw_winsys->create_screen(); + if(!screen) + goto error1; + +#ifdef DEBUG + stw_dev->screen = trace_screen_create(screen); + stw_dev->trace_running = stw_dev->screen != screen ? TRUE : FALSE; +#else + stw_dev->screen = screen; +#endif + + stw_dev->screen->flush_frontbuffer = &stw_flush_frontbuffer; + + pipe_mutex_init( stw_dev->ctx_mutex ); + pipe_mutex_init( stw_dev->fb_mutex ); + + stw_dev->ctx_table = handle_table_create(); + if (!stw_dev->ctx_table) { + goto error1; + } + + stw_pixelformat_init(); + + return TRUE; + +error1: + stw_dev = NULL; + return FALSE; +} + + +boolean +stw_init_thread(void) +{ + return stw_tls_init_thread(); +} + + +void +stw_cleanup_thread(void) +{ + stw_tls_cleanup_thread(); +} + + +void +stw_cleanup(void) +{ + unsigned i; + + debug_printf("%s\n", __FUNCTION__); + + if (!stw_dev) + return; + + pipe_mutex_lock( stw_dev->ctx_mutex ); + { + /* Ensure all contexts are destroyed */ + i = handle_table_get_first_handle(stw_dev->ctx_table); + while (i) { + stw_delete_context(i); + i = handle_table_get_next_handle(stw_dev->ctx_table, i); + } + handle_table_destroy(stw_dev->ctx_table); + } + pipe_mutex_unlock( stw_dev->ctx_mutex ); + + stw_framebuffer_cleanup(); + + pipe_mutex_destroy( stw_dev->fb_mutex ); + pipe_mutex_destroy( stw_dev->ctx_mutex ); + + stw_dev->screen->destroy(stw_dev->screen); + +#ifdef WIN32_THREADS + _glthread_DESTROY_MUTEX(OneTimeLock); + FreeAllTSD(); +#endif + +#ifdef DEBUG + debug_memory_end(stw_dev->memdbg_no); +#endif + + stw_tls_cleanup(); + + stw_dev = NULL; +} + + +struct stw_context * +stw_lookup_context_locked( UINT_PTR dhglrc ) +{ + if (dhglrc == 0) + return NULL; + + if (stw_dev == NULL) + return NULL; + + return (struct stw_context *) handle_table_get(stw_dev->ctx_table, dhglrc); +} + diff --git a/src/gallium/state_trackers/wgl/stw_device.h b/src/gallium/state_trackers/wgl/stw_device.h new file mode 100644 index 0000000000..e1bb9518dd --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_device.h @@ -0,0 +1,77 @@ +/************************************************************************** + * + * 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. + * + **************************************************************************/ + +#ifndef STW_DEVICE_H_ +#define STW_DEVICE_H_ + + +#include + +#include "pipe/p_compiler.h" +#include "pipe/p_thread.h" +#include "util/u_handle_table.h" +#include "stw_pixelformat.h" + + +#define STW_MAX_PIXELFORMATS 256 + + +struct pipe_screen; +struct stw_framebuffer; + +struct stw_device +{ + const struct stw_winsys *stw_winsys; + + struct pipe_screen *screen; + +#ifdef DEBUG + boolean trace_running; +#endif + + struct stw_pixelformat_info pixelformats[STW_MAX_PIXELFORMATS]; + unsigned pixelformat_count; + unsigned pixelformat_extended_count; + + pipe_mutex ctx_mutex; + struct handle_table *ctx_table; + + pipe_mutex fb_mutex; + struct stw_framebuffer *fb_head; + +#ifdef DEBUG + unsigned long memdbg_no; +#endif +}; + +struct stw_context * +stw_lookup_context_locked( UINT_PTR hglrc ); + +extern struct stw_device *stw_dev; + + +#endif /* STW_DEVICE_H_ */ diff --git a/src/gallium/state_trackers/wgl/stw_ext_extensionsstring.c b/src/gallium/state_trackers/wgl/stw_ext_extensionsstring.c new file mode 100644 index 0000000000..62c859e1f9 --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_ext_extensionsstring.c @@ -0,0 +1,59 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include + +#define WGL_WGLEXT_PROTOTYPES + +#include +#include + + +static const char *stw_extension_string = + "WGL_ARB_extensions_string " + "WGL_ARB_multisample " + "WGL_ARB_pixel_format " +/* "WGL_EXT_swap_interval " */ + "WGL_EXT_extensions_string"; + + +WINGDIAPI const char * APIENTRY +wglGetExtensionsStringARB( + HDC hdc ) +{ + (void) hdc; + + return stw_extension_string; +} + + +WINGDIAPI const char * APIENTRY +wglGetExtensionsStringEXT( void ) +{ + return stw_extension_string; +} diff --git a/src/gallium/state_trackers/wgl/stw_ext_gallium.c b/src/gallium/state_trackers/wgl/stw_ext_gallium.c new file mode 100644 index 0000000000..13a42fee25 --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_ext_gallium.c @@ -0,0 +1,80 @@ +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#include "pipe/p_screen.h" +#include "stw_public.h" +#include "stw_device.h" +#include "stw_winsys.h" +#include "stw_ext_gallium.h" + +#ifdef DEBUG +#include "trace/tr_screen.h" +#include "trace/tr_context.h" +#endif + + +struct pipe_screen * APIENTRY +wglGetGalliumScreenMESA(void) +{ + return stw_dev ? stw_dev->screen : NULL; +} + + +/* XXX: Unify with stw_create_layer_context */ +struct pipe_context * APIENTRY +wglCreateGalliumContextMESA(void) +{ + struct pipe_screen *screen = NULL; + struct pipe_context *pipe = NULL; + + if(!stw_dev) + return NULL; + + screen = stw_dev->screen; + +#ifdef DEBUG + /* Unwrap screen */ + if(stw_dev->trace_running) + screen = trace_screen(screen)->screen; +#endif + + pipe = stw_dev->stw_winsys->create_context( screen ); + if (pipe == NULL) + goto no_pipe; + +#ifdef DEBUG + /* Wrap context */ + if(stw_dev->trace_running) + pipe = trace_context_create(stw_dev->screen, pipe); +#endif + + return pipe; + +no_pipe: + return NULL; +} diff --git a/src/gallium/state_trackers/wgl/stw_ext_gallium.h b/src/gallium/state_trackers/wgl/stw_ext_gallium.h new file mode 100644 index 0000000000..cc35f2bb7f --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_ext_gallium.h @@ -0,0 +1,47 @@ +/************************************************************************** + * + * 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 STW_EXTGALLIUM_H_ +#define STW_EXTGALLIUM_H_ + + +#include + + +struct pipe_screen; +struct pipe_context; + + +struct pipe_screen * APIENTRY +wglGetGalliumScreenMESA(void); + + +struct pipe_context * APIENTRY +wglCreateGalliumContextMESA(void); + + +#endif /* STW_EXTGALLIUM_H_ */ diff --git a/src/gallium/state_trackers/wgl/stw_ext_pixelformat.c b/src/gallium/state_trackers/wgl/stw_ext_pixelformat.c new file mode 100644 index 0000000000..0e2d407699 --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_ext_pixelformat.c @@ -0,0 +1,483 @@ +/************************************************************************** + * + * 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. + * + **************************************************************************/ + +/** + * @file + * + * WGL_ARB_pixel_format extension implementation. + * + * @sa http://www.opengl.org/registry/specs/ARB/wgl_pixel_format.txt + */ + + +#include + +#define WGL_WGLEXT_PROTOTYPES + +#include +#include + +#include "pipe/p_compiler.h" +#include "util/u_memory.h" +#include "stw_public.h" +#include "stw_pixelformat.h" + + +static boolean +stw_query_attrib( + int iPixelFormat, + int iLayerPlane, + int attrib, + int *pvalue ) +{ + uint count; + uint index; + const struct stw_pixelformat_info *pfi; + + count = stw_pixelformat_get_extended_count(); + + if (attrib == WGL_NUMBER_PIXEL_FORMATS_ARB) { + *pvalue = (int) count; + return TRUE; + } + + index = (uint) iPixelFormat - 1; + if (index >= count) + return FALSE; + + pfi = stw_pixelformat_get_info( index ); + + switch (attrib) { + case WGL_DRAW_TO_WINDOW_ARB: + *pvalue = pfi->pfd.dwFlags & PFD_DRAW_TO_WINDOW ? TRUE : FALSE; + return TRUE; + + case WGL_DRAW_TO_BITMAP_ARB: + *pvalue = pfi->pfd.dwFlags & PFD_DRAW_TO_BITMAP ? TRUE : FALSE; + return TRUE; + + case WGL_NEED_PALETTE_ARB: + *pvalue = pfi->pfd.dwFlags & PFD_NEED_PALETTE ? TRUE : FALSE; + return TRUE; + + case WGL_NEED_SYSTEM_PALETTE_ARB: + *pvalue = pfi->pfd.dwFlags & PFD_NEED_SYSTEM_PALETTE ? TRUE : FALSE; + return TRUE; + + case WGL_SWAP_METHOD_ARB: + *pvalue = pfi->pfd.dwFlags & PFD_SWAP_COPY ? WGL_SWAP_COPY_ARB : WGL_SWAP_UNDEFINED_ARB; + return TRUE; + + case WGL_SWAP_LAYER_BUFFERS_ARB: + *pvalue = FALSE; + return TRUE; + + case WGL_NUMBER_OVERLAYS_ARB: + *pvalue = 0; + return TRUE; + + case WGL_NUMBER_UNDERLAYS_ARB: + *pvalue = 0; + return TRUE; + } + + if (iLayerPlane != 0) + return FALSE; + + switch (attrib) { + case WGL_ACCELERATION_ARB: + *pvalue = WGL_FULL_ACCELERATION_ARB; + break; + + case WGL_TRANSPARENT_ARB: + *pvalue = FALSE; + break; + + case WGL_TRANSPARENT_RED_VALUE_ARB: + case WGL_TRANSPARENT_GREEN_VALUE_ARB: + case WGL_TRANSPARENT_BLUE_VALUE_ARB: + case WGL_TRANSPARENT_ALPHA_VALUE_ARB: + case WGL_TRANSPARENT_INDEX_VALUE_ARB: + break; + + case WGL_SHARE_DEPTH_ARB: + case WGL_SHARE_STENCIL_ARB: + case WGL_SHARE_ACCUM_ARB: + *pvalue = TRUE; + break; + + case WGL_SUPPORT_GDI_ARB: + *pvalue = pfi->pfd.dwFlags & PFD_SUPPORT_GDI ? TRUE : FALSE; + break; + + case WGL_SUPPORT_OPENGL_ARB: + *pvalue = pfi->pfd.dwFlags & PFD_SUPPORT_OPENGL ? TRUE : FALSE; + break; + + case WGL_DOUBLE_BUFFER_ARB: + *pvalue = pfi->pfd.dwFlags & PFD_DOUBLEBUFFER ? TRUE : FALSE; + break; + + case WGL_STEREO_ARB: + *pvalue = pfi->pfd.dwFlags & PFD_STEREO ? TRUE : FALSE; + break; + + case WGL_PIXEL_TYPE_ARB: + switch (pfi->pfd.iPixelType) { + case PFD_TYPE_RGBA: + *pvalue = WGL_TYPE_RGBA_ARB; + break; + case PFD_TYPE_COLORINDEX: + *pvalue = WGL_TYPE_COLORINDEX_ARB; + break; + default: + return FALSE; + } + break; + + case WGL_COLOR_BITS_ARB: + *pvalue = pfi->pfd.cColorBits; + break; + + case WGL_RED_BITS_ARB: + *pvalue = pfi->pfd.cRedBits; + break; + + case WGL_RED_SHIFT_ARB: + *pvalue = pfi->pfd.cRedShift; + break; + + case WGL_GREEN_BITS_ARB: + *pvalue = pfi->pfd.cGreenBits; + break; + + case WGL_GREEN_SHIFT_ARB: + *pvalue = pfi->pfd.cGreenShift; + break; + + case WGL_BLUE_BITS_ARB: + *pvalue = pfi->pfd.cBlueBits; + break; + + case WGL_BLUE_SHIFT_ARB: + *pvalue = pfi->pfd.cBlueShift; + break; + + case WGL_ALPHA_BITS_ARB: + *pvalue = pfi->pfd.cAlphaBits; + break; + + case WGL_ALPHA_SHIFT_ARB: + *pvalue = pfi->pfd.cAlphaShift; + break; + + case WGL_ACCUM_BITS_ARB: + *pvalue = pfi->pfd.cAccumBits; + break; + + case WGL_ACCUM_RED_BITS_ARB: + *pvalue = pfi->pfd.cAccumRedBits; + break; + + case WGL_ACCUM_GREEN_BITS_ARB: + *pvalue = pfi->pfd.cAccumGreenBits; + break; + + case WGL_ACCUM_BLUE_BITS_ARB: + *pvalue = pfi->pfd.cAccumBlueBits; + break; + + case WGL_ACCUM_ALPHA_BITS_ARB: + *pvalue = pfi->pfd.cAccumAlphaBits; + break; + + case WGL_DEPTH_BITS_ARB: + *pvalue = pfi->pfd.cDepthBits; + break; + + case WGL_STENCIL_BITS_ARB: + *pvalue = pfi->pfd.cStencilBits; + break; + + case WGL_AUX_BUFFERS_ARB: + *pvalue = pfi->pfd.cAuxBuffers; + break; + + case WGL_SAMPLE_BUFFERS_ARB: + *pvalue = pfi->numSampleBuffers; + break; + + case WGL_SAMPLES_ARB: + *pvalue = pfi->numSamples; + break; + + default: + return FALSE; + } + + return TRUE; +} + +struct attrib_match_info +{ + int attribute; + int weight; + BOOL exact; +}; + +static const struct attrib_match_info attrib_match[] = { + + /* WGL_ARB_pixel_format */ + { WGL_DRAW_TO_WINDOW_ARB, 0, TRUE }, + { WGL_DRAW_TO_BITMAP_ARB, 0, TRUE }, + { WGL_ACCELERATION_ARB, 0, TRUE }, + { WGL_NEED_PALETTE_ARB, 0, TRUE }, + { WGL_NEED_SYSTEM_PALETTE_ARB, 0, TRUE }, + { WGL_SWAP_LAYER_BUFFERS_ARB, 0, TRUE }, + { WGL_SWAP_METHOD_ARB, 0, TRUE }, + { WGL_NUMBER_OVERLAYS_ARB, 4, FALSE }, + { WGL_NUMBER_UNDERLAYS_ARB, 4, FALSE }, + /*{ WGL_SHARE_DEPTH_ARB, 0, TRUE },*/ /* no overlays -- ignore */ + /*{ WGL_SHARE_STENCIL_ARB, 0, TRUE },*/ /* no overlays -- ignore */ + /*{ WGL_SHARE_ACCUM_ARB, 0, TRUE },*/ /* no overlays -- ignore */ + { WGL_SUPPORT_GDI_ARB, 0, TRUE }, + { WGL_SUPPORT_OPENGL_ARB, 0, TRUE }, + { WGL_DOUBLE_BUFFER_ARB, 0, TRUE }, + { WGL_STEREO_ARB, 0, TRUE }, + { WGL_PIXEL_TYPE_ARB, 0, TRUE }, + { WGL_COLOR_BITS_ARB, 1, FALSE }, + { WGL_RED_BITS_ARB, 1, FALSE }, + { WGL_GREEN_BITS_ARB, 1, FALSE }, + { WGL_BLUE_BITS_ARB, 1, FALSE }, + { WGL_ALPHA_BITS_ARB, 1, FALSE }, + { WGL_ACCUM_BITS_ARB, 1, FALSE }, + { WGL_ACCUM_RED_BITS_ARB, 1, FALSE }, + { WGL_ACCUM_GREEN_BITS_ARB, 1, FALSE }, + { WGL_ACCUM_BLUE_BITS_ARB, 1, FALSE }, + { WGL_ACCUM_ALPHA_BITS_ARB, 1, FALSE }, + { WGL_DEPTH_BITS_ARB, 1, FALSE }, + { WGL_STENCIL_BITS_ARB, 1, FALSE }, + { WGL_AUX_BUFFERS_ARB, 2, FALSE }, + + /* WGL_ARB_multisample */ + { WGL_SAMPLE_BUFFERS_ARB, 2, FALSE }, + { WGL_SAMPLES_ARB, 2, FALSE } +}; + +struct stw_pixelformat_score +{ + int points; + uint index; +}; + +static BOOL +score_pixelformats( + struct stw_pixelformat_score *scores, + uint count, + int attribute, + int expected_value ) +{ + uint i; + const struct attrib_match_info *ami = NULL; + uint index; + + /* Find out if a given attribute should be considered for score calculation. + */ + for (i = 0; i < sizeof( attrib_match ) / sizeof( attrib_match[0] ); i++) { + if (attrib_match[i].attribute == attribute) { + ami = &attrib_match[i]; + break; + } + } + if (ami == NULL) + return TRUE; + + /* Iterate all pixelformats, query the requested attribute and calculate + * score points. + */ + for (index = 0; index < count; index++) { + int actual_value; + + if (!stw_query_attrib( index + 1, 0, attribute, &actual_value )) + return FALSE; + + if (ami->exact) { + /* For an exact match criteria, if the actual and expected values differ, + * the score is set to 0 points, effectively removing the pixelformat + * from a list of matching pixelformats. + */ + if (actual_value != expected_value) + scores[index].points = 0; + } + else { + /* For a minimum match criteria, if the actual value is smaller than the expected + * value, the pixelformat is rejected (score set to 0). However, if the actual + * value is bigger, the pixelformat is given a penalty to favour pixelformats that + * more closely match the expected values. + */ + if (actual_value < expected_value) + scores[index].points = 0; + else if (actual_value > expected_value) + scores[index].points -= (actual_value - expected_value) * ami->weight; + } + } + + return TRUE; +} + +WINGDIAPI BOOL APIENTRY +wglChoosePixelFormatARB( + HDC hdc, + const int *piAttribIList, + const FLOAT *pfAttribFList, + UINT nMaxFormats, + int *piFormats, + UINT *nNumFormats ) +{ + uint count; + struct stw_pixelformat_score *scores; + uint i; + + *nNumFormats = 0; + + /* Allocate and initialize pixelformat score table -- better matches + * have higher scores. Start with a high score and take out penalty + * points for a mismatch when the match does not have to be exact. + * Set a score to 0 if there is a mismatch for an exact match criteria. + */ + count = stw_pixelformat_get_extended_count(); + scores = (struct stw_pixelformat_score *) MALLOC( count * sizeof( struct stw_pixelformat_score ) ); + if (scores == NULL) + return FALSE; + for (i = 0; i < count; i++) { + scores[i].points = 0x7fffffff; + scores[i].index = i; + } + + /* Given the attribute list calculate a score for each pixelformat. + */ + if (piAttribIList != NULL) { + while (*piAttribIList != 0) { + if (!score_pixelformats( scores, count, piAttribIList[0], piAttribIList[1] )) { + FREE( scores ); + return FALSE; + } + piAttribIList += 2; + } + } + if (pfAttribFList != NULL) { + while (*pfAttribFList != 0) { + if (!score_pixelformats( scores, count, (int) pfAttribFList[0], (int) pfAttribFList[1] )) { + FREE( scores ); + return FALSE; + } + pfAttribFList += 2; + } + } + + /* Bubble-sort the resulting scores. Pixelformats with higher scores go first. + * TODO: Find out if there are any patent issues with it. + */ + if (count > 1) { + uint n = count; + boolean swapped; + + do { + swapped = FALSE; + for (i = 1; i < n; i++) { + if (scores[i - 1].points < scores[i].points) { + struct stw_pixelformat_score score = scores[i - 1]; + + scores[i - 1] = scores[i]; + scores[i] = score; + swapped = TRUE; + } + } + n--; + } + while (swapped); + } + + /* Return a list of pixelformats that are the best match. + * Reject pixelformats with non-positive scores. + */ + for (i = 0; i < count; i++) { + if (scores[i].points > 0) { + if (*nNumFormats < nMaxFormats) + piFormats[*nNumFormats] = scores[i].index + 1; + (*nNumFormats)++; + } + } + + FREE( scores ); + return TRUE; +} + +WINGDIAPI BOOL APIENTRY +wglGetPixelFormatAttribfvARB( + HDC hdc, + int iPixelFormat, + int iLayerPlane, + UINT nAttributes, + const int *piAttributes, + FLOAT *pfValues ) +{ + UINT i; + + (void) hdc; + + for (i = 0; i < nAttributes; i++) { + int value; + + if (!stw_query_attrib( iPixelFormat, iLayerPlane, piAttributes[i], &value )) + return FALSE; + pfValues[i] = (FLOAT) value; + } + + return TRUE; +} + +WINGDIAPI BOOL APIENTRY +wglGetPixelFormatAttribivARB( + HDC hdc, + int iPixelFormat, + int iLayerPlane, + UINT nAttributes, + const int *piAttributes, + int *piValues ) +{ + UINT i; + + (void) hdc; + + for (i = 0; i < nAttributes; i++) { + if (!stw_query_attrib( iPixelFormat, iLayerPlane, piAttributes[i], &piValues[i] )) + return FALSE; + } + + return TRUE; +} diff --git a/src/gallium/state_trackers/wgl/stw_ext_swapinterval.c b/src/gallium/state_trackers/wgl/stw_ext_swapinterval.c new file mode 100644 index 0000000000..9eac6a1d09 --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_ext_swapinterval.c @@ -0,0 +1,57 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include + +#define WGL_WGLEXT_PROTOTYPES + +#include +#include +#include "util/u_debug.h" + +/* A dummy implementation of this extension. + * + * Required as some applications retrieve and call these functions + * regardless of the fact that we don't advertise the extension and + * further more the results of wglGetProcAddress are NULL. + */ +WINGDIAPI BOOL APIENTRY +wglSwapIntervalEXT(int interval) +{ + (void) interval; + debug_printf("%s: %d\n", __FUNCTION__, interval); + return TRUE; +} + +WINGDIAPI int APIENTRY +wglGetSwapIntervalEXT(void) +{ + return 0; +} + + diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.c b/src/gallium/state_trackers/wgl/stw_framebuffer.c new file mode 100644 index 0000000000..b8956bb550 --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c @@ -0,0 +1,493 @@ +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include + +#include "main/context.h" +#include "pipe/p_format.h" +#include "pipe/p_screen.h" +#include "state_tracker/st_context.h" +#include "state_tracker/st_public.h" + +#ifdef DEBUG +#include "trace/tr_screen.h" +#include "trace/tr_texture.h" +#endif + +#include "stw_framebuffer.h" +#include "stw_device.h" +#include "stw_public.h" +#include "stw_winsys.h" +#include "stw_tls.h" + + +/** + * Search the framebuffer with the matching HWND while holding the + * stw_dev::fb_mutex global lock. + */ +static INLINE struct stw_framebuffer * +stw_framebuffer_from_hwnd_locked( + HWND hwnd ) +{ + struct stw_framebuffer *fb; + + for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next) + if (fb->hWnd == hwnd) { + pipe_mutex_lock(fb->mutex); + break; + } + + return fb; +} + + +/** + * Destroy this framebuffer. Both stw_dev::fb_mutex and stw_framebuffer::mutex + * must be held, by this order. Obviously no further access to fb can be done + * after this. + */ +static INLINE void +stw_framebuffer_destroy_locked( + struct stw_framebuffer *fb ) +{ + struct stw_framebuffer **link; + + link = &stw_dev->fb_head; + while (*link != fb) + link = &(*link)->next; + assert(*link); + *link = fb->next; + fb->next = NULL; + + st_unreference_framebuffer(fb->stfb); + + pipe_mutex_unlock( fb->mutex ); + + pipe_mutex_destroy( fb->mutex ); + + FREE( fb ); +} + + +void +stw_framebuffer_release( + struct stw_framebuffer *fb) +{ + assert(fb); + pipe_mutex_unlock( fb->mutex ); +} + + +static INLINE void +stw_framebuffer_get_size( struct stw_framebuffer *fb ) +{ + unsigned width, height; + RECT rect; + + assert(fb->hWnd); + + GetClientRect( fb->hWnd, &rect ); + width = rect.right - rect.left; + height = rect.bottom - rect.top; + + if(width < 1) + width = 1; + if(height < 1) + height = 1; + + if(width != fb->width || height != fb->height) { + fb->must_resize = TRUE; + fb->width = width; + fb->height = height; + } +} + + +/** + * @sa http://msdn.microsoft.com/en-us/library/ms644975(VS.85).aspx + * @sa http://msdn.microsoft.com/en-us/library/ms644960(VS.85).aspx + */ +LRESULT CALLBACK +stw_call_window_proc( + int nCode, + WPARAM wParam, + LPARAM lParam ) +{ + struct stw_tls_data *tls_data; + PCWPSTRUCT pParams = (PCWPSTRUCT)lParam; + struct stw_framebuffer *fb; + + tls_data = stw_tls_get_data(); + if(!tls_data) + return 0; + + if (nCode < 0) + return CallNextHookEx(tls_data->hCallWndProcHook, nCode, wParam, lParam); + + if (pParams->message == WM_WINDOWPOSCHANGED) { + /* We handle WM_WINDOWPOSCHANGED instead of WM_SIZE because according to + * http://blogs.msdn.com/oldnewthing/archive/2008/01/15/7113860.aspx + * WM_SIZE is generated from WM_WINDOWPOSCHANGED by DefWindowProc so it + * can be masked out by the application. */ + LPWINDOWPOS lpWindowPos = (LPWINDOWPOS)pParams->lParam; + if((lpWindowPos->flags & SWP_SHOWWINDOW) || + !(lpWindowPos->flags & SWP_NOSIZE)) { + fb = stw_framebuffer_from_hwnd( pParams->hwnd ); + if(fb) { + /* Size in WINDOWPOS includes the window frame, so get the size + * of the client area via GetClientRect. */ + stw_framebuffer_get_size(fb); + stw_framebuffer_release(fb); + } + } + } + else if (pParams->message == WM_DESTROY) { + pipe_mutex_lock( stw_dev->fb_mutex ); + fb = stw_framebuffer_from_hwnd_locked( pParams->hwnd ); + if(fb) + stw_framebuffer_destroy_locked(fb); + pipe_mutex_unlock( stw_dev->fb_mutex ); + } + + return CallNextHookEx(tls_data->hCallWndProcHook, nCode, wParam, lParam); +} + + +struct stw_framebuffer * +stw_framebuffer_create( + HDC hdc, + int iPixelFormat ) +{ + HWND hWnd; + struct stw_framebuffer *fb; + const struct stw_pixelformat_info *pfi; + + /* We only support drawing to a window. */ + hWnd = WindowFromDC( hdc ); + if(!hWnd) + return NULL; + + fb = CALLOC_STRUCT( stw_framebuffer ); + if (fb == NULL) + return NULL; + + fb->hDC = hdc; + fb->hWnd = hWnd; + fb->iPixelFormat = iPixelFormat; + + fb->pfi = pfi = stw_pixelformat_get_info( iPixelFormat - 1 ); + + stw_pixelformat_visual(&fb->visual, pfi); + + stw_framebuffer_get_size(fb); + + pipe_mutex_init( fb->mutex ); + + /* This is the only case where we lock the stw_framebuffer::mutex before + * stw_dev::fb_mutex, since no other thread can know about this framebuffer + * and we must prevent any other thread from destroying it before we return. + */ + pipe_mutex_lock( fb->mutex ); + + pipe_mutex_lock( stw_dev->fb_mutex ); + fb->next = stw_dev->fb_head; + stw_dev->fb_head = fb; + pipe_mutex_unlock( stw_dev->fb_mutex ); + + return fb; +} + + +BOOL +stw_framebuffer_allocate( + struct stw_framebuffer *fb) +{ + assert(fb); + + if(!fb->stfb) { + const struct stw_pixelformat_info *pfi = fb->pfi; + enum pipe_format colorFormat, depthFormat, stencilFormat; + + colorFormat = pfi->color_format; + + assert(pf_layout( pfi->depth_stencil_format ) == PIPE_FORMAT_LAYOUT_RGBAZS ); + + if(pf_get_component_bits( pfi->depth_stencil_format, PIPE_FORMAT_COMP_Z )) + depthFormat = pfi->depth_stencil_format; + else + depthFormat = PIPE_FORMAT_NONE; + + if(pf_get_component_bits( pfi->depth_stencil_format, PIPE_FORMAT_COMP_S )) + stencilFormat = pfi->depth_stencil_format; + else + stencilFormat = PIPE_FORMAT_NONE; + + assert(fb->must_resize); + assert(fb->width); + assert(fb->height); + + fb->stfb = st_create_framebuffer( + &fb->visual, + colorFormat, + depthFormat, + stencilFormat, + fb->width, + fb->height, + (void *) fb ); + + // to notify the context + fb->must_resize = TRUE; + } + + return fb->stfb ? TRUE : FALSE; +} + + +/** + * Update the framebuffer's size if necessary. + */ +void +stw_framebuffer_update( + struct stw_framebuffer *fb) +{ + assert(fb->stfb); + assert(fb->height); + assert(fb->width); + + /* XXX: It would be nice to avoid checking the size again -- in theory + * stw_call_window_proc would have cought the resize and stored the right + * size already, but unfortunately threads created before the DllMain is + * called don't get a DLL_THREAD_ATTACH notification, and there is no way + * to know of their existing without using the not very portable PSAPI. + */ + stw_framebuffer_get_size(fb); + + if(fb->must_resize) { + st_resize_framebuffer(fb->stfb, fb->width, fb->height); + fb->must_resize = FALSE; + } +} + + +void +stw_framebuffer_cleanup( void ) +{ + struct stw_framebuffer *fb; + struct stw_framebuffer *next; + + pipe_mutex_lock( stw_dev->fb_mutex ); + + fb = stw_dev->fb_head; + while (fb) { + next = fb->next; + + pipe_mutex_lock(fb->mutex); + stw_framebuffer_destroy_locked(fb); + + fb = next; + } + stw_dev->fb_head = NULL; + + pipe_mutex_unlock( stw_dev->fb_mutex ); +} + + +/** + * Given an hdc, return the corresponding stw_framebuffer. + */ +static INLINE struct stw_framebuffer * +stw_framebuffer_from_hdc_locked( + HDC hdc ) +{ + HWND hwnd; + struct stw_framebuffer *fb; + + /* + * Some applications create and use several HDCs for the same window, so + * looking up the framebuffer by the HDC is not reliable. Use HWND whenever + * possible. + */ + hwnd = WindowFromDC(hdc); + if(hwnd) + return stw_framebuffer_from_hwnd_locked(hwnd); + + for (fb = stw_dev->fb_head; fb != NULL; fb = fb->next) + if (fb->hDC == hdc) { + pipe_mutex_lock(fb->mutex); + break; + } + + return fb; +} + + +/** + * Given an hdc, return the corresponding stw_framebuffer. + */ +struct stw_framebuffer * +stw_framebuffer_from_hdc( + HDC hdc ) +{ + struct stw_framebuffer *fb; + + pipe_mutex_lock( stw_dev->fb_mutex ); + fb = stw_framebuffer_from_hdc_locked(hdc); + pipe_mutex_unlock( stw_dev->fb_mutex ); + + return fb; +} + + +/** + * Given an hdc, return the corresponding stw_framebuffer. + */ +struct stw_framebuffer * +stw_framebuffer_from_hwnd( + HWND hwnd ) +{ + struct stw_framebuffer *fb; + + pipe_mutex_lock( stw_dev->fb_mutex ); + fb = stw_framebuffer_from_hwnd_locked(hwnd); + pipe_mutex_unlock( stw_dev->fb_mutex ); + + return fb; +} + + +BOOL +stw_pixelformat_set( + HDC hdc, + int iPixelFormat ) +{ + uint count; + uint index; + struct stw_framebuffer *fb; + + index = (uint) iPixelFormat - 1; + count = stw_pixelformat_get_extended_count(); + if (index >= count) + return FALSE; + + fb = stw_framebuffer_from_hdc_locked(hdc); + if(fb) { + /* SetPixelFormat must be called only once */ + stw_framebuffer_release( fb ); + return FALSE; + } + + fb = stw_framebuffer_create(hdc, iPixelFormat); + if(!fb) { + return FALSE; + } + + stw_framebuffer_release( fb ); + + /* Some applications mistakenly use the undocumented wglSetPixelFormat + * function instead of SetPixelFormat, so we call SetPixelFormat here to + * avoid opengl32.dll's wglCreateContext to fail */ + if (GetPixelFormat(hdc) == 0) { + SetPixelFormat(hdc, iPixelFormat, NULL); + } + + return TRUE; +} + + +int +stw_pixelformat_get( + HDC hdc ) +{ + int iPixelFormat = 0; + struct stw_framebuffer *fb; + + fb = stw_framebuffer_from_hdc(hdc); + if(fb) { + iPixelFormat = fb->iPixelFormat; + stw_framebuffer_release(fb); + } + + return iPixelFormat; +} + + +BOOL +stw_swap_buffers( + HDC hdc ) +{ + struct stw_framebuffer *fb; + struct pipe_screen *screen; + struct pipe_surface *surface; + + fb = stw_framebuffer_from_hdc( hdc ); + if (fb == NULL) + return FALSE; + + if (!(fb->pfi->pfd.dwFlags & PFD_DOUBLEBUFFER)) { + stw_framebuffer_release(fb); + return TRUE; + } + + /* If we're swapping the buffer associated with the current context + * we have to flush any pending rendering commands first. + */ + st_notify_swapbuffers( fb->stfb ); + + screen = stw_dev->screen; + + if(!st_get_framebuffer_surface( fb->stfb, ST_SURFACE_BACK_LEFT, &surface )) { + /* FIXME: this shouldn't happen, but does on glean */ + stw_framebuffer_release(fb); + return FALSE; + } + +#ifdef DEBUG + if(stw_dev->trace_running) { + screen = trace_screen(screen)->screen; + surface = trace_surface(surface)->surface; + } +#endif + + stw_dev->stw_winsys->flush_frontbuffer( screen, surface, hdc ); + + stw_framebuffer_update(fb); + stw_framebuffer_release(fb); + + return TRUE; +} + + +BOOL +stw_swap_layer_buffers( + HDC hdc, + UINT fuPlanes ) +{ + if(fuPlanes & WGL_SWAP_MAIN_PLANE) + return stw_swap_buffers(hdc); + + return FALSE; +} diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.h b/src/gallium/state_trackers/wgl/stw_framebuffer.h new file mode 100644 index 0000000000..13d29f37e4 --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_framebuffer.h @@ -0,0 +1,148 @@ +/************************************************************************** + * + * 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. + * + **************************************************************************/ + +#ifndef STW_FRAMEBUFFER_H +#define STW_FRAMEBUFFER_H + +#include + +#include "main/mtypes.h" + +#include "pipe/p_thread.h" + +struct stw_pixelformat_info; + +/** + * Windows framebuffer, derived from gl_framebuffer. + */ +struct stw_framebuffer +{ + /** + * This mutex has two purposes: + * - protect the access to the mutable data members below + * - prevent the the framebuffer from being deleted while being accessed. + * + * It is OK to lock this mutex while holding the stw_device::fb_mutex lock, + * but the opposite must never happen. + */ + pipe_mutex mutex; + + /* + * Immutable members. + * + * Note that even access to immutable members implies acquiring the mutex + * above, to prevent the framebuffer from being destroyed. + */ + + HDC hDC; + HWND hWnd; + + int iPixelFormat; + const struct stw_pixelformat_info *pfi; + GLvisual visual; + + /* + * Mutable members. + */ + + struct st_framebuffer *stfb; + + /* FIXME: Make this work for multiple contexts bound to the same framebuffer */ + boolean must_resize; + unsigned width; + unsigned height; + + /** + * This is protected by stw_device::fb_mutex, not the mutex above. + * + * Deletions must be done by first acquiring stw_device::fb_mutex, and then + * acquiring the stw_framebuffer::mutex of the framebuffer to be deleted. + * This ensures that nobody else is reading/writing to the. + * + * It is not necessary to aquire the mutex above to navigate the linked list + * given that deletions are done with stw_device::fb_mutex held, so no other + * thread can delete. + */ + struct stw_framebuffer *next; +}; + + +/** + * Create a new framebuffer object which will correspond to the given HDC. + * + * This function will acquire stw_framebuffer::mutex. stw_framebuffer_release + * must be called when done + */ +struct stw_framebuffer * +stw_framebuffer_create( + HDC hdc, + int iPixelFormat ); + +/** + * Search a framebuffer with a matching HWND. + * + * This function will acquire stw_framebuffer::mutex. stw_framebuffer_release + * must be called when done + */ +struct stw_framebuffer * +stw_framebuffer_from_hwnd( + HWND hwnd ); + +/** + * Search a framebuffer with a matching HDC. + * + * This function will acquire stw_framebuffer::mutex. stw_framebuffer_release + * must be called when done + */ +struct stw_framebuffer * +stw_framebuffer_from_hdc( + HDC hdc ); + +BOOL +stw_framebuffer_allocate( + struct stw_framebuffer *fb ); + +void +stw_framebuffer_update( + struct stw_framebuffer *fb); + +/** + * Release stw_framebuffer::mutex lock. This framebuffer must not be accessed + * after calling this function, as it may have been deleted by another thread + * in the meanwhile. + */ +void +stw_framebuffer_release( + struct stw_framebuffer *fb); + +/** + * Cleanup any existing framebuffers when exiting application. + */ +void +stw_framebuffer_cleanup(void); + +#endif /* STW_FRAMEBUFFER_H */ diff --git a/src/gallium/state_trackers/wgl/stw_getprocaddress.c b/src/gallium/state_trackers/wgl/stw_getprocaddress.c new file mode 100644 index 0000000000..57ce63ec02 --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_getprocaddress.c @@ -0,0 +1,86 @@ +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include + +#define WGL_WGLEXT_PROTOTYPES + +#include +#include + +#include "glapi/glapi.h" +#include "stw_public.h" +#include "stw_ext_gallium.h" + +struct stw_extension_entry +{ + const char *name; + PROC proc; +}; + +#define STW_EXTENSION_ENTRY(P) { #P, (PROC) P } + +static const struct stw_extension_entry stw_extension_entries[] = { + + /* WGL_ARB_extensions_string */ + STW_EXTENSION_ENTRY( wglGetExtensionsStringARB ), + + /* WGL_ARB_pixel_format */ + STW_EXTENSION_ENTRY( wglChoosePixelFormatARB ), + STW_EXTENSION_ENTRY( wglGetPixelFormatAttribfvARB ), + STW_EXTENSION_ENTRY( wglGetPixelFormatAttribivARB ), + + /* WGL_EXT_extensions_string */ + STW_EXTENSION_ENTRY( wglGetExtensionsStringEXT ), + + /* WGL_EXT_swap_interval */ + STW_EXTENSION_ENTRY( wglGetSwapIntervalEXT ), + STW_EXTENSION_ENTRY( wglSwapIntervalEXT ), + + /* WGL_EXT_gallium ? */ + STW_EXTENSION_ENTRY( wglGetGalliumScreenMESA ), + STW_EXTENSION_ENTRY( wglCreateGalliumContextMESA ), + + { NULL, NULL } +}; + +PROC +stw_get_proc_address( + LPCSTR lpszProc ) +{ + const struct stw_extension_entry *entry; + + if (lpszProc[0] == 'w' && lpszProc[1] == 'g' && lpszProc[2] == 'l') + for (entry = stw_extension_entries; entry->name; entry++) + if (strcmp( lpszProc, entry->name ) == 0) + return entry->proc; + + if (lpszProc[0] == 'g' && lpszProc[1] == 'l') + return (PROC) _glapi_get_proc_address( lpszProc ); + + return NULL; +} diff --git a/src/gallium/state_trackers/wgl/stw_icd.c b/src/gallium/state_trackers/wgl/stw_icd.c new file mode 100644 index 0000000000..dc5ba9161e --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_icd.c @@ -0,0 +1,617 @@ +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include +#include + +#include "GL/gl.h" + +#include "util/u_debug.h" +#include "pipe/p_thread.h" + +#include "stw_public.h" +#include "stw_icd.h" + +#define DBG 0 + + +BOOL APIENTRY +DrvCopyContext( + DHGLRC dhrcSource, + DHGLRC dhrcDest, + UINT fuMask ) +{ + return stw_copy_context(dhrcSource, dhrcDest, fuMask); +} + + +DHGLRC APIENTRY +DrvCreateLayerContext( + HDC hdc, + INT iLayerPlane ) +{ + DHGLRC r; + + r = stw_create_layer_context( hdc, iLayerPlane ); + + if (DBG) + debug_printf( "%s( %p, %i ) = %lu\n", + __FUNCTION__, hdc, iLayerPlane, r ); + + return r; +} + +DHGLRC APIENTRY +DrvCreateContext( + HDC hdc ) +{ + return DrvCreateLayerContext( hdc, 0 ); +} + +BOOL APIENTRY +DrvDeleteContext( + DHGLRC dhglrc ) +{ + BOOL r; + + r = stw_delete_context( dhglrc ); + + if (DBG) + debug_printf( "%s( %lu ) = %u\n", + __FUNCTION__, dhglrc, r ); + + return r; +} + +BOOL APIENTRY +DrvDescribeLayerPlane( + HDC hdc, + INT iPixelFormat, + INT iLayerPlane, + UINT nBytes, + LPLAYERPLANEDESCRIPTOR plpd ) +{ + if (DBG) + debug_printf( "%s\n", __FUNCTION__ ); + + return FALSE; +} + +LONG APIENTRY +DrvDescribePixelFormat( + HDC hdc, + INT iPixelFormat, + ULONG cjpfd, + PIXELFORMATDESCRIPTOR *ppfd ) +{ + LONG r; + + r = stw_pixelformat_describe( hdc, iPixelFormat, cjpfd, ppfd ); + + if (DBG) + debug_printf( "%s( %p, %i, %lu, %p ) = %li\n", + __FUNCTION__, hdc, iPixelFormat, cjpfd, ppfd, r ); + + return r; +} + +int APIENTRY +DrvGetLayerPaletteEntries( + HDC hdc, + INT iLayerPlane, + INT iStart, + INT cEntries, + COLORREF *pcr ) +{ + if (DBG) + debug_printf( "%s\n", __FUNCTION__ ); + + return 0; +} + +PROC APIENTRY +DrvGetProcAddress( + LPCSTR lpszProc ) +{ + PROC r; + + r = stw_get_proc_address( lpszProc ); + + if (DBG) + debug_printf( "%s( \"%s\" ) = %p\n", __FUNCTION__, lpszProc, r ); + + return r; +} + +BOOL APIENTRY +DrvRealizeLayerPalette( + HDC hdc, + INT iLayerPlane, + BOOL bRealize ) +{ + if (DBG) + debug_printf( "%s\n", __FUNCTION__ ); + + return FALSE; +} + +BOOL APIENTRY +DrvReleaseContext( + DHGLRC dhglrc ) +{ + return stw_release_context(dhglrc); +} + +void APIENTRY +DrvSetCallbackProcs( + INT nProcs, + PROC *pProcs ) +{ + if (DBG) + debug_printf( "%s( %d, %p )\n", __FUNCTION__, nProcs, pProcs ); + + return; +} + + +/** + * Although WGL allows different dispatch entrypoints per context + */ +static const GLCLTPROCTABLE cpt = +{ + OPENGL_VERSION_110_ENTRIES, + { + &glNewList, + &glEndList, + &glCallList, + &glCallLists, + &glDeleteLists, + &glGenLists, + &glListBase, + &glBegin, + &glBitmap, + &glColor3b, + &glColor3bv, + &glColor3d, + &glColor3dv, + &glColor3f, + &glColor3fv, + &glColor3i, + &glColor3iv, + &glColor3s, + &glColor3sv, + &glColor3ub, + &glColor3ubv, + &glColor3ui, + &glColor3uiv, + &glColor3us, + &glColor3usv, + &glColor4b, + &glColor4bv, + &glColor4d, + &glColor4dv, + &glColor4f, + &glColor4fv, + &glColor4i, + &glColor4iv, + &glColor4s, + &glColor4sv, + &glColor4ub, + &glColor4ubv, + &glColor4ui, + &glColor4uiv, + &glColor4us, + &glColor4usv, + &glEdgeFlag, + &glEdgeFlagv, + &glEnd, + &glIndexd, + &glIndexdv, + &glIndexf, + &glIndexfv, + &glIndexi, + &glIndexiv, + &glIndexs, + &glIndexsv, + &glNormal3b, + &glNormal3bv, + &glNormal3d, + &glNormal3dv, + &glNormal3f, + &glNormal3fv, + &glNormal3i, + &glNormal3iv, + &glNormal3s, + &glNormal3sv, + &glRasterPos2d, + &glRasterPos2dv, + &glRasterPos2f, + &glRasterPos2fv, + &glRasterPos2i, + &glRasterPos2iv, + &glRasterPos2s, + &glRasterPos2sv, + &glRasterPos3d, + &glRasterPos3dv, + &glRasterPos3f, + &glRasterPos3fv, + &glRasterPos3i, + &glRasterPos3iv, + &glRasterPos3s, + &glRasterPos3sv, + &glRasterPos4d, + &glRasterPos4dv, + &glRasterPos4f, + &glRasterPos4fv, + &glRasterPos4i, + &glRasterPos4iv, + &glRasterPos4s, + &glRasterPos4sv, + &glRectd, + &glRectdv, + &glRectf, + &glRectfv, + &glRecti, + &glRectiv, + &glRects, + &glRectsv, + &glTexCoord1d, + &glTexCoord1dv, + &glTexCoord1f, + &glTexCoord1fv, + &glTexCoord1i, + &glTexCoord1iv, + &glTexCoord1s, + &glTexCoord1sv, + &glTexCoord2d, + &glTexCoord2dv, + &glTexCoord2f, + &glTexCoord2fv, + &glTexCoord2i, + &glTexCoord2iv, + &glTexCoord2s, + &glTexCoord2sv, + &glTexCoord3d, + &glTexCoord3dv, + &glTexCoord3f, + &glTexCoord3fv, + &glTexCoord3i, + &glTexCoord3iv, + &glTexCoord3s, + &glTexCoord3sv, + &glTexCoord4d, + &glTexCoord4dv, + &glTexCoord4f, + &glTexCoord4fv, + &glTexCoord4i, + &glTexCoord4iv, + &glTexCoord4s, + &glTexCoord4sv, + &glVertex2d, + &glVertex2dv, + &glVertex2f, + &glVertex2fv, + &glVertex2i, + &glVertex2iv, + &glVertex2s, + &glVertex2sv, + &glVertex3d, + &glVertex3dv, + &glVertex3f, + &glVertex3fv, + &glVertex3i, + &glVertex3iv, + &glVertex3s, + &glVertex3sv, + &glVertex4d, + &glVertex4dv, + &glVertex4f, + &glVertex4fv, + &glVertex4i, + &glVertex4iv, + &glVertex4s, + &glVertex4sv, + &glClipPlane, + &glColorMaterial, + &glCullFace, + &glFogf, + &glFogfv, + &glFogi, + &glFogiv, + &glFrontFace, + &glHint, + &glLightf, + &glLightfv, + &glLighti, + &glLightiv, + &glLightModelf, + &glLightModelfv, + &glLightModeli, + &glLightModeliv, + &glLineStipple, + &glLineWidth, + &glMaterialf, + &glMaterialfv, + &glMateriali, + &glMaterialiv, + &glPointSize, + &glPolygonMode, + &glPolygonStipple, + &glScissor, + &glShadeModel, + &glTexParameterf, + &glTexParameterfv, + &glTexParameteri, + &glTexParameteriv, + &glTexImage1D, + &glTexImage2D, + &glTexEnvf, + &glTexEnvfv, + &glTexEnvi, + &glTexEnviv, + &glTexGend, + &glTexGendv, + &glTexGenf, + &glTexGenfv, + &glTexGeni, + &glTexGeniv, + &glFeedbackBuffer, + &glSelectBuffer, + &glRenderMode, + &glInitNames, + &glLoadName, + &glPassThrough, + &glPopName, + &glPushName, + &glDrawBuffer, + &glClear, + &glClearAccum, + &glClearIndex, + &glClearColor, + &glClearStencil, + &glClearDepth, + &glStencilMask, + &glColorMask, + &glDepthMask, + &glIndexMask, + &glAccum, + &glDisable, + &glEnable, + &glFinish, + &glFlush, + &glPopAttrib, + &glPushAttrib, + &glMap1d, + &glMap1f, + &glMap2d, + &glMap2f, + &glMapGrid1d, + &glMapGrid1f, + &glMapGrid2d, + &glMapGrid2f, + &glEvalCoord1d, + &glEvalCoord1dv, + &glEvalCoord1f, + &glEvalCoord1fv, + &glEvalCoord2d, + &glEvalCoord2dv, + &glEvalCoord2f, + &glEvalCoord2fv, + &glEvalMesh1, + &glEvalPoint1, + &glEvalMesh2, + &glEvalPoint2, + &glAlphaFunc, + &glBlendFunc, + &glLogicOp, + &glStencilFunc, + &glStencilOp, + &glDepthFunc, + &glPixelZoom, + &glPixelTransferf, + &glPixelTransferi, + &glPixelStoref, + &glPixelStorei, + &glPixelMapfv, + &glPixelMapuiv, + &glPixelMapusv, + &glReadBuffer, + &glCopyPixels, + &glReadPixels, + &glDrawPixels, + &glGetBooleanv, + &glGetClipPlane, + &glGetDoublev, + &glGetError, + &glGetFloatv, + &glGetIntegerv, + &glGetLightfv, + &glGetLightiv, + &glGetMapdv, + &glGetMapfv, + &glGetMapiv, + &glGetMaterialfv, + &glGetMaterialiv, + &glGetPixelMapfv, + &glGetPixelMapuiv, + &glGetPixelMapusv, + &glGetPolygonStipple, + &glGetString, + &glGetTexEnvfv, + &glGetTexEnviv, + &glGetTexGendv, + &glGetTexGenfv, + &glGetTexGeniv, + &glGetTexImage, + &glGetTexParameterfv, + &glGetTexParameteriv, + &glGetTexLevelParameterfv, + &glGetTexLevelParameteriv, + &glIsEnabled, + &glIsList, + &glDepthRange, + &glFrustum, + &glLoadIdentity, + &glLoadMatrixf, + &glLoadMatrixd, + &glMatrixMode, + &glMultMatrixf, + &glMultMatrixd, + &glOrtho, + &glPopMatrix, + &glPushMatrix, + &glRotated, + &glRotatef, + &glScaled, + &glScalef, + &glTranslated, + &glTranslatef, + &glViewport, + &glArrayElement, + &glBindTexture, + &glColorPointer, + &glDisableClientState, + &glDrawArrays, + &glDrawElements, + &glEdgeFlagPointer, + &glEnableClientState, + &glIndexPointer, + &glIndexub, + &glIndexubv, + &glInterleavedArrays, + &glNormalPointer, + &glPolygonOffset, + &glTexCoordPointer, + &glVertexPointer, + &glAreTexturesResident, + &glCopyTexImage1D, + &glCopyTexImage2D, + &glCopyTexSubImage1D, + &glCopyTexSubImage2D, + &glDeleteTextures, + &glGenTextures, + &glGetPointerv, + &glIsTexture, + &glPrioritizeTextures, + &glTexSubImage1D, + &glTexSubImage2D, + &glPopClientAttrib, + &glPushClientAttrib + } +}; + + +PGLCLTPROCTABLE APIENTRY +DrvSetContext( + HDC hdc, + DHGLRC dhglrc, + PFN_SETPROCTABLE pfnSetProcTable ) +{ + PGLCLTPROCTABLE r = (PGLCLTPROCTABLE)&cpt; + + if (!stw_make_current( hdc, dhglrc )) + r = NULL; + + if (DBG) + debug_printf( "%s( 0x%p, %lu, 0x%p ) = %p\n", + __FUNCTION__, hdc, dhglrc, pfnSetProcTable, r ); + + return r; +} + +int APIENTRY +DrvSetLayerPaletteEntries( + HDC hdc, + INT iLayerPlane, + INT iStart, + INT cEntries, + CONST COLORREF *pcr ) +{ + if (DBG) + debug_printf( "%s\n", __FUNCTION__ ); + + return 0; +} + +BOOL APIENTRY +DrvSetPixelFormat( + HDC hdc, + LONG iPixelFormat ) +{ + BOOL r; + + r = stw_pixelformat_set( hdc, iPixelFormat ); + + if (DBG) + debug_printf( "%s( %p, %li ) = %s\n", __FUNCTION__, hdc, iPixelFormat, r ? "TRUE" : "FALSE" ); + + return r; +} + +BOOL APIENTRY +DrvShareLists( + DHGLRC dhglrc1, + DHGLRC dhglrc2 ) +{ + if (DBG) + debug_printf( "%s\n", __FUNCTION__ ); + + return stw_share_lists(dhglrc1, dhglrc2); +} + +BOOL APIENTRY +DrvSwapBuffers( + HDC hdc ) +{ + if (DBG) + debug_printf( "%s( %p )\n", __FUNCTION__, hdc ); + + return stw_swap_buffers( hdc ); +} + +BOOL APIENTRY +DrvSwapLayerBuffers( + HDC hdc, + UINT fuPlanes ) +{ + if (DBG) + debug_printf( "%s\n", __FUNCTION__ ); + + return stw_swap_layer_buffers( hdc, fuPlanes ); +} + +BOOL APIENTRY +DrvValidateVersion( + ULONG ulVersion ) +{ + if (DBG) + debug_printf( "%s( %lu )\n", __FUNCTION__, ulVersion ); + + /* TODO: get the expected version from the winsys */ + + return ulVersion == 1; +} diff --git a/src/gallium/state_trackers/wgl/stw_icd.h b/src/gallium/state_trackers/wgl/stw_icd.h new file mode 100644 index 0000000000..cbc1a66548 --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_icd.h @@ -0,0 +1,489 @@ +/************************************************************************** + * + * 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. + * + **************************************************************************/ + +#ifndef STW_ICD_H +#define STW_ICD_H + + +#include + +#include "GL/gl.h" + + +typedef ULONG DHGLRC; + +#define OPENGL_VERSION_110_ENTRIES 336 + +struct __GLdispatchTableRec +{ + void (GLAPIENTRY * NewList)(GLuint, GLenum); + void (GLAPIENTRY * EndList)(void); + void (GLAPIENTRY * CallList)(GLuint); + void (GLAPIENTRY * CallLists)(GLsizei, GLenum, const GLvoid *); + void (GLAPIENTRY * DeleteLists)(GLuint, GLsizei); + GLuint (GLAPIENTRY * GenLists)(GLsizei); + void (GLAPIENTRY * ListBase)(GLuint); + void (GLAPIENTRY * Begin)(GLenum); + void (GLAPIENTRY * Bitmap)(GLsizei, GLsizei, GLfloat, GLfloat, GLfloat, GLfloat, const GLubyte *); + void (GLAPIENTRY * Color3b)(GLbyte, GLbyte, GLbyte); + void (GLAPIENTRY * Color3bv)(const GLbyte *); + void (GLAPIENTRY * Color3d)(GLdouble, GLdouble, GLdouble); + void (GLAPIENTRY * Color3dv)(const GLdouble *); + void (GLAPIENTRY * Color3f)(GLfloat, GLfloat, GLfloat); + void (GLAPIENTRY * Color3fv)(const GLfloat *); + void (GLAPIENTRY * Color3i)(GLint, GLint, GLint); + void (GLAPIENTRY * Color3iv)(const GLint *); + void (GLAPIENTRY * Color3s)(GLshort, GLshort, GLshort); + void (GLAPIENTRY * Color3sv)(const GLshort *); + void (GLAPIENTRY * Color3ub)(GLubyte, GLubyte, GLubyte); + void (GLAPIENTRY * Color3ubv)(const GLubyte *); + void (GLAPIENTRY * Color3ui)(GLuint, GLuint, GLuint); + void (GLAPIENTRY * Color3uiv)(const GLuint *); + void (GLAPIENTRY * Color3us)(GLushort, GLushort, GLushort); + void (GLAPIENTRY * Color3usv)(const GLushort *); + void (GLAPIENTRY * Color4b)(GLbyte, GLbyte, GLbyte, GLbyte); + void (GLAPIENTRY * Color4bv)(const GLbyte *); + void (GLAPIENTRY * Color4d)(GLdouble, GLdouble, GLdouble, GLdouble); + void (GLAPIENTRY * Color4dv)(const GLdouble *); + void (GLAPIENTRY * Color4f)(GLfloat, GLfloat, GLfloat, GLfloat); + void (GLAPIENTRY * Color4fv)(const GLfloat *); + void (GLAPIENTRY * Color4i)(GLint, GLint, GLint, GLint); + void (GLAPIENTRY * Color4iv)(const GLint *); + void (GLAPIENTRY * Color4s)(GLshort, GLshort, GLshort, GLshort); + void (GLAPIENTRY * Color4sv)(const GLshort *); + void (GLAPIENTRY * Color4ub)(GLubyte, GLubyte, GLubyte, GLubyte); + void (GLAPIENTRY * Color4ubv)(const GLubyte *); + void (GLAPIENTRY * Color4ui)(GLuint, GLuint, GLuint, GLuint); + void (GLAPIENTRY * Color4uiv)(const GLuint *); + void (GLAPIENTRY * Color4us)(GLushort, GLushort, GLushort, GLushort); + void (GLAPIENTRY * Color4usv)(const GLushort *); + void (GLAPIENTRY * EdgeFlag)(GLboolean); + void (GLAPIENTRY * EdgeFlagv)(const GLboolean *); + void (GLAPIENTRY * End)(void); + void (GLAPIENTRY * Indexd)(GLdouble); + void (GLAPIENTRY * Indexdv)(const GLdouble *); + void (GLAPIENTRY * Indexf)(GLfloat); + void (GLAPIENTRY * Indexfv)(const GLfloat *); + void (GLAPIENTRY * Indexi)(GLint); + void (GLAPIENTRY * Indexiv)(const GLint *); + void (GLAPIENTRY * Indexs)(GLshort); + void (GLAPIENTRY * Indexsv)(const GLshort *); + void (GLAPIENTRY * Normal3b)(GLbyte, GLbyte, GLbyte); + void (GLAPIENTRY * Normal3bv)(const GLbyte *); + void (GLAPIENTRY * Normal3d)(GLdouble, GLdouble, GLdouble); + void (GLAPIENTRY * Normal3dv)(const GLdouble *); + void (GLAPIENTRY * Normal3f)(GLfloat, GLfloat, GLfloat); + void (GLAPIENTRY * Normal3fv)(const GLfloat *); + void (GLAPIENTRY * Normal3i)(GLint, GLint, GLint); + void (GLAPIENTRY * Normal3iv)(const GLint *); + void (GLAPIENTRY * Normal3s)(GLshort, GLshort, GLshort); + void (GLAPIENTRY * Normal3sv)(const GLshort *); + void (GLAPIENTRY * RasterPos2d)(GLdouble, GLdouble); + void (GLAPIENTRY * RasterPos2dv)(const GLdouble *); + void (GLAPIENTRY * RasterPos2f)(GLfloat, GLfloat); + void (GLAPIENTRY * RasterPos2fv)(const GLfloat *); + void (GLAPIENTRY * RasterPos2i)(GLint, GLint); + void (GLAPIENTRY * RasterPos2iv)(const GLint *); + void (GLAPIENTRY * RasterPos2s)(GLshort, GLshort); + void (GLAPIENTRY * RasterPos2sv)(const GLshort *); + void (GLAPIENTRY * RasterPos3d)(GLdouble, GLdouble, GLdouble); + void (GLAPIENTRY * RasterPos3dv)(const GLdouble *); + void (GLAPIENTRY * RasterPos3f)(GLfloat, GLfloat, GLfloat); + void (GLAPIENTRY * RasterPos3fv)(const GLfloat *); + void (GLAPIENTRY * RasterPos3i)(GLint, GLint, GLint); + void (GLAPIENTRY * RasterPos3iv)(const GLint *); + void (GLAPIENTRY * RasterPos3s)(GLshort, GLshort, GLshort); + void (GLAPIENTRY * RasterPos3sv)(const GLshort *); + void (GLAPIENTRY * RasterPos4d)(GLdouble, GLdouble, GLdouble, GLdouble); + void (GLAPIENTRY * RasterPos4dv)(const GLdouble *); + void (GLAPIENTRY * RasterPos4f)(GLfloat, GLfloat, GLfloat, GLfloat); + void (GLAPIENTRY * RasterPos4fv)(const GLfloat *); + void (GLAPIENTRY * RasterPos4i)(GLint, GLint, GLint, GLint); + void (GLAPIENTRY * RasterPos4iv)(const GLint *); + void (GLAPIENTRY * RasterPos4s)(GLshort, GLshort, GLshort, GLshort); + void (GLAPIENTRY * RasterPos4sv)(const GLshort *); + void (GLAPIENTRY * Rectd)(GLdouble, GLdouble, GLdouble, GLdouble); + void (GLAPIENTRY * Rectdv)(const GLdouble *, const GLdouble *); + void (GLAPIENTRY * Rectf)(GLfloat, GLfloat, GLfloat, GLfloat); + void (GLAPIENTRY * Rectfv)(const GLfloat *, const GLfloat *); + void (GLAPIENTRY * Recti)(GLint, GLint, GLint, GLint); + void (GLAPIENTRY * Rectiv)(const GLint *, const GLint *); + void (GLAPIENTRY * Rects)(GLshort, GLshort, GLshort, GLshort); + void (GLAPIENTRY * Rectsv)(const GLshort *, const GLshort *); + void (GLAPIENTRY * TexCoord1d)(GLdouble); + void (GLAPIENTRY * TexCoord1dv)(const GLdouble *); + void (GLAPIENTRY * TexCoord1f)(GLfloat); + void (GLAPIENTRY * TexCoord1fv)(const GLfloat *); + void (GLAPIENTRY * TexCoord1i)(GLint); + void (GLAPIENTRY * TexCoord1iv)(const GLint *); + void (GLAPIENTRY * TexCoord1s)(GLshort); + void (GLAPIENTRY * TexCoord1sv)(const GLshort *); + void (GLAPIENTRY * TexCoord2d)(GLdouble, GLdouble); + void (GLAPIENTRY * TexCoord2dv)(const GLdouble *); + void (GLAPIENTRY * TexCoord2f)(GLfloat, GLfloat); + void (GLAPIENTRY * TexCoord2fv)(const GLfloat *); + void (GLAPIENTRY * TexCoord2i)(GLint, GLint); + void (GLAPIENTRY * TexCoord2iv)(const GLint *); + void (GLAPIENTRY * TexCoord2s)(GLshort, GLshort); + void (GLAPIENTRY * TexCoord2sv)(const GLshort *); + void (GLAPIENTRY * TexCoord3d)(GLdouble, GLdouble, GLdouble); + void (GLAPIENTRY * TexCoord3dv)(const GLdouble *); + void (GLAPIENTRY * TexCoord3f)(GLfloat, GLfloat, GLfloat); + void (GLAPIENTRY * TexCoord3fv)(const GLfloat *); + void (GLAPIENTRY * TexCoord3i)(GLint, GLint, GLint); + void (GLAPIENTRY * TexCoord3iv)(const GLint *); + void (GLAPIENTRY * TexCoord3s)(GLshort, GLshort, GLshort); + void (GLAPIENTRY * TexCoord3sv)(const GLshort *); + void (GLAPIENTRY * TexCoord4d)(GLdouble, GLdouble, GLdouble, GLdouble); + void (GLAPIENTRY * TexCoord4dv)(const GLdouble *); + void (GLAPIENTRY * TexCoord4f)(GLfloat, GLfloat, GLfloat, GLfloat); + void (GLAPIENTRY * TexCoord4fv)(const GLfloat *); + void (GLAPIENTRY * TexCoord4i)(GLint, GLint, GLint, GLint); + void (GLAPIENTRY * TexCoord4iv)(const GLint *); + void (GLAPIENTRY * TexCoord4s)(GLshort, GLshort, GLshort, GLshort); + void (GLAPIENTRY * TexCoord4sv)(const GLshort *); + void (GLAPIENTRY * Vertex2d)(GLdouble, GLdouble); + void (GLAPIENTRY * Vertex2dv)(const GLdouble *); + void (GLAPIENTRY * Vertex2f)(GLfloat, GLfloat); + void (GLAPIENTRY * Vertex2fv)(const GLfloat *); + void (GLAPIENTRY * Vertex2i)(GLint, GLint); + void (GLAPIENTRY * Vertex2iv)(const GLint *); + void (GLAPIENTRY * Vertex2s)(GLshort, GLshort); + void (GLAPIENTRY * Vertex2sv)(const GLshort *); + void (GLAPIENTRY * Vertex3d)(GLdouble, GLdouble, GLdouble); + void (GLAPIENTRY * Vertex3dv)(const GLdouble *); + void (GLAPIENTRY * Vertex3f)(GLfloat, GLfloat, GLfloat); + void (GLAPIENTRY * Vertex3fv)(const GLfloat *); + void (GLAPIENTRY * Vertex3i)(GLint, GLint, GLint); + void (GLAPIENTRY * Vertex3iv)(const GLint *); + void (GLAPIENTRY * Vertex3s)(GLshort, GLshort, GLshort); + void (GLAPIENTRY * Vertex3sv)(const GLshort *); + void (GLAPIENTRY * Vertex4d)(GLdouble, GLdouble, GLdouble, GLdouble); + void (GLAPIENTRY * Vertex4dv)(const GLdouble *); + void (GLAPIENTRY * Vertex4f)(GLfloat, GLfloat, GLfloat, GLfloat); + void (GLAPIENTRY * Vertex4fv)(const GLfloat *); + void (GLAPIENTRY * Vertex4i)(GLint, GLint, GLint, GLint); + void (GLAPIENTRY * Vertex4iv)(const GLint *); + void (GLAPIENTRY * Vertex4s)(GLshort, GLshort, GLshort, GLshort); + void (GLAPIENTRY * Vertex4sv)(const GLshort *); + void (GLAPIENTRY * ClipPlane)(GLenum, const GLdouble *); + void (GLAPIENTRY * ColorMaterial)(GLenum, GLenum); + void (GLAPIENTRY * CullFace)(GLenum); + void (GLAPIENTRY * Fogf)(GLenum, GLfloat); + void (GLAPIENTRY * Fogfv)(GLenum, const GLfloat *); + void (GLAPIENTRY * Fogi)(GLenum, GLint); + void (GLAPIENTRY * Fogiv)(GLenum, const GLint *); + void (GLAPIENTRY * FrontFace)(GLenum); + void (GLAPIENTRY * Hint)(GLenum, GLenum); + void (GLAPIENTRY * Lightf)(GLenum, GLenum, GLfloat); + void (GLAPIENTRY * Lightfv)(GLenum, GLenum, const GLfloat *); + void (GLAPIENTRY * Lighti)(GLenum, GLenum, GLint); + void (GLAPIENTRY * Lightiv)(GLenum, GLenum, const GLint *); + void (GLAPIENTRY * LightModelf)(GLenum, GLfloat); + void (GLAPIENTRY * LightModelfv)(GLenum, const GLfloat *); + void (GLAPIENTRY * LightModeli)(GLenum, GLint); + void (GLAPIENTRY * LightModeliv)(GLenum, const GLint *); + void (GLAPIENTRY * LineStipple)(GLint, GLushort); + void (GLAPIENTRY * LineWidth)(GLfloat); + void (GLAPIENTRY * Materialf)(GLenum, GLenum, GLfloat); + void (GLAPIENTRY * Materialfv)(GLenum, GLenum, const GLfloat *); + void (GLAPIENTRY * Materiali)(GLenum, GLenum, GLint); + void (GLAPIENTRY * Materialiv)(GLenum, GLenum, const GLint *); + void (GLAPIENTRY * PointSize)(GLfloat); + void (GLAPIENTRY * PolygonMode)(GLenum, GLenum); + void (GLAPIENTRY * PolygonStipple)(const GLubyte *); + void (GLAPIENTRY * Scissor)(GLint, GLint, GLsizei, GLsizei); + void (GLAPIENTRY * ShadeModel)(GLenum); + void (GLAPIENTRY * TexParameterf)(GLenum, GLenum, GLfloat); + void (GLAPIENTRY * TexParameterfv)(GLenum, GLenum, const GLfloat *); + void (GLAPIENTRY * TexParameteri)(GLenum, GLenum, GLint); + void (GLAPIENTRY * TexParameteriv)(GLenum, GLenum, const GLint *); + void (GLAPIENTRY * TexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *); + void (GLAPIENTRY * TexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *); + void (GLAPIENTRY * TexEnvf)(GLenum, GLenum, GLfloat); + void (GLAPIENTRY * TexEnvfv)(GLenum, GLenum, const GLfloat *); + void (GLAPIENTRY * TexEnvi)(GLenum, GLenum, GLint); + void (GLAPIENTRY * TexEnviv)(GLenum, GLenum, const GLint *); + void (GLAPIENTRY * TexGend)(GLenum, GLenum, GLdouble); + void (GLAPIENTRY * TexGendv)(GLenum, GLenum, const GLdouble *); + void (GLAPIENTRY * TexGenf)(GLenum, GLenum, GLfloat); + void (GLAPIENTRY * TexGenfv)(GLenum, GLenum, const GLfloat *); + void (GLAPIENTRY * TexGeni)(GLenum, GLenum, GLint); + void (GLAPIENTRY * TexGeniv)(GLenum, GLenum, const GLint *); + void (GLAPIENTRY * FeedbackBuffer)(GLsizei, GLenum, GLfloat *); + void (GLAPIENTRY * SelectBuffer)(GLsizei, GLuint *); + GLint (GLAPIENTRY * RenderMode)(GLenum); + void (GLAPIENTRY * InitNames)(void); + void (GLAPIENTRY * LoadName)(GLuint); + void (GLAPIENTRY * PassThrough)(GLfloat); + void (GLAPIENTRY * PopName)(void); + void (GLAPIENTRY * PushName)(GLuint); + void (GLAPIENTRY * DrawBuffer)(GLenum); + void (GLAPIENTRY * Clear)(GLbitfield); + void (GLAPIENTRY * ClearAccum)(GLfloat, GLfloat, GLfloat, GLfloat); + void (GLAPIENTRY * ClearIndex)(GLfloat); + void (GLAPIENTRY * ClearColor)(GLclampf, GLclampf, GLclampf, GLclampf); + void (GLAPIENTRY * ClearStencil)(GLint); + void (GLAPIENTRY * ClearDepth)(GLclampd); + void (GLAPIENTRY * StencilMask)(GLuint); + void (GLAPIENTRY * ColorMask)(GLboolean, GLboolean, GLboolean, GLboolean); + void (GLAPIENTRY * DepthMask)(GLboolean); + void (GLAPIENTRY * IndexMask)(GLuint); + void (GLAPIENTRY * Accum)(GLenum, GLfloat); + void (GLAPIENTRY * Disable)(GLenum); + void (GLAPIENTRY * Enable)(GLenum); + void (GLAPIENTRY * Finish)(void); + void (GLAPIENTRY * Flush)(void); + void (GLAPIENTRY * PopAttrib)(void); + void (GLAPIENTRY * PushAttrib)(GLbitfield); + void (GLAPIENTRY * Map1d)(GLenum, GLdouble, GLdouble, GLint, GLint, const GLdouble *); + void (GLAPIENTRY * Map1f)(GLenum, GLfloat, GLfloat, GLint, GLint, const GLfloat *); + void (GLAPIENTRY * Map2d)(GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *); + void (GLAPIENTRY * Map2f)(GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *); + void (GLAPIENTRY * MapGrid1d)(GLint, GLdouble, GLdouble); + void (GLAPIENTRY * MapGrid1f)(GLint, GLfloat, GLfloat); + void (GLAPIENTRY * MapGrid2d)(GLint, GLdouble, GLdouble, GLint, GLdouble, GLdouble); + void (GLAPIENTRY * MapGrid2f)(GLint, GLfloat, GLfloat, GLint, GLfloat, GLfloat); + void (GLAPIENTRY * EvalCoord1d)(GLdouble); + void (GLAPIENTRY * EvalCoord1dv)(const GLdouble *); + void (GLAPIENTRY * EvalCoord1f)(GLfloat); + void (GLAPIENTRY * EvalCoord1fv)(const GLfloat *); + void (GLAPIENTRY * EvalCoord2d)(GLdouble, GLdouble); + void (GLAPIENTRY * EvalCoord2dv)(const GLdouble *); + void (GLAPIENTRY * EvalCoord2f)(GLfloat, GLfloat); + void (GLAPIENTRY * EvalCoord2fv)(const GLfloat *); + void (GLAPIENTRY * EvalMesh1)(GLenum, GLint, GLint); + void (GLAPIENTRY * EvalPoint1)(GLint); + void (GLAPIENTRY * EvalMesh2)(GLenum, GLint, GLint, GLint, GLint); + void (GLAPIENTRY * EvalPoint2)(GLint, GLint); + void (GLAPIENTRY * AlphaFunc)(GLenum, GLclampf); + void (GLAPIENTRY * BlendFunc)(GLenum, GLenum); + void (GLAPIENTRY * LogicOp)(GLenum); + void (GLAPIENTRY * StencilFunc)(GLenum, GLint, GLuint); + void (GLAPIENTRY * StencilOp)(GLenum, GLenum, GLenum); + void (GLAPIENTRY * DepthFunc)(GLenum); + void (GLAPIENTRY * PixelZoom)(GLfloat, GLfloat); + void (GLAPIENTRY * PixelTransferf)(GLenum, GLfloat); + void (GLAPIENTRY * PixelTransferi)(GLenum, GLint); + void (GLAPIENTRY * PixelStoref)(GLenum, GLfloat); + void (GLAPIENTRY * PixelStorei)(GLenum, GLint); + void (GLAPIENTRY * PixelMapfv)(GLenum, GLint, const GLfloat *); + void (GLAPIENTRY * PixelMapuiv)(GLenum, GLint, const GLuint *); + void (GLAPIENTRY * PixelMapusv)(GLenum, GLint, const GLushort *); + void (GLAPIENTRY * ReadBuffer)(GLenum); + void (GLAPIENTRY * CopyPixels)(GLint, GLint, GLsizei, GLsizei, GLenum); + void (GLAPIENTRY * ReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *); + void (GLAPIENTRY * DrawPixels)(GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); + void (GLAPIENTRY * GetBooleanv)(GLenum, GLboolean *); + void (GLAPIENTRY * GetClipPlane)(GLenum, GLdouble *); + void (GLAPIENTRY * GetDoublev)(GLenum, GLdouble *); + GLenum (GLAPIENTRY * GetError)(void); + void (GLAPIENTRY * GetFloatv)(GLenum, GLfloat *); + void (GLAPIENTRY * GetIntegerv)(GLenum, GLint *); + void (GLAPIENTRY * GetLightfv)(GLenum, GLenum, GLfloat *); + void (GLAPIENTRY * GetLightiv)(GLenum, GLenum, GLint *); + void (GLAPIENTRY * GetMapdv)(GLenum, GLenum, GLdouble *); + void (GLAPIENTRY * GetMapfv)(GLenum, GLenum, GLfloat *); + void (GLAPIENTRY * GetMapiv)(GLenum, GLenum, GLint *); + void (GLAPIENTRY * GetMaterialfv)(GLenum, GLenum, GLfloat *); + void (GLAPIENTRY * GetMaterialiv)(GLenum, GLenum, GLint *); + void (GLAPIENTRY * GetPixelMapfv)(GLenum, GLfloat *); + void (GLAPIENTRY * GetPixelMapuiv)(GLenum, GLuint *); + void (GLAPIENTRY * GetPixelMapusv)(GLenum, GLushort *); + void (GLAPIENTRY * GetPolygonStipple)(GLubyte *); + const GLubyte * (GLAPIENTRY * GetString)(GLenum); + void (GLAPIENTRY * GetTexEnvfv)(GLenum, GLenum, GLfloat *); + void (GLAPIENTRY * GetTexEnviv)(GLenum, GLenum, GLint *); + void (GLAPIENTRY * GetTexGendv)(GLenum, GLenum, GLdouble *); + void (GLAPIENTRY * GetTexGenfv)(GLenum, GLenum, GLfloat *); + void (GLAPIENTRY * GetTexGeniv)(GLenum, GLenum, GLint *); + void (GLAPIENTRY * GetTexImage)(GLenum, GLint, GLenum, GLenum, GLvoid *); + void (GLAPIENTRY * GetTexParameterfv)(GLenum, GLenum, GLfloat *); + void (GLAPIENTRY * GetTexParameteriv)(GLenum, GLenum, GLint *); + void (GLAPIENTRY * GetTexLevelParameterfv)(GLenum, GLint, GLenum, GLfloat *); + void (GLAPIENTRY * GetTexLevelParameteriv)(GLenum, GLint, GLenum, GLint *); + GLboolean (GLAPIENTRY * IsEnabled)(GLenum); + GLboolean (GLAPIENTRY * IsList)(GLuint); + void (GLAPIENTRY * DepthRange)(GLclampd, GLclampd); + void (GLAPIENTRY * Frustum)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble); + void (GLAPIENTRY * LoadIdentity)(void); + void (GLAPIENTRY * LoadMatrixf)(const GLfloat *); + void (GLAPIENTRY * LoadMatrixd)(const GLdouble *); + void (GLAPIENTRY * MatrixMode)(GLenum); + void (GLAPIENTRY * MultMatrixf)(const GLfloat *); + void (GLAPIENTRY * MultMatrixd)(const GLdouble *); + void (GLAPIENTRY * Ortho)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble); + void (GLAPIENTRY * PopMatrix)(void); + void (GLAPIENTRY * PushMatrix)(void); + void (GLAPIENTRY * Rotated)(GLdouble, GLdouble, GLdouble, GLdouble); + void (GLAPIENTRY * Rotatef)(GLfloat, GLfloat, GLfloat, GLfloat); + void (GLAPIENTRY * Scaled)(GLdouble, GLdouble, GLdouble); + void (GLAPIENTRY * Scalef)(GLfloat, GLfloat, GLfloat); + void (GLAPIENTRY * Translated)(GLdouble, GLdouble, GLdouble); + void (GLAPIENTRY * Translatef)(GLfloat, GLfloat, GLfloat); + void (GLAPIENTRY * Viewport)(GLint, GLint, GLsizei, GLsizei); + void (GLAPIENTRY * ArrayElement)(GLint); + void (GLAPIENTRY * BindTexture)(GLenum, GLuint); + void (GLAPIENTRY * ColorPointer)(GLint, GLenum, GLsizei, const GLvoid *); + void (GLAPIENTRY * DisableClientState)(GLenum); + void (GLAPIENTRY * DrawArrays)(GLenum, GLint, GLsizei); + void (GLAPIENTRY * DrawElements)(GLenum, GLsizei, GLenum, const GLvoid *); + void (GLAPIENTRY * EdgeFlagPointer)(GLsizei, const GLvoid *); + void (GLAPIENTRY * EnableClientState)(GLenum); + void (GLAPIENTRY * IndexPointer)(GLenum, GLsizei, const GLvoid *); + void (GLAPIENTRY * Indexub)(GLubyte); + void (GLAPIENTRY * Indexubv)(const GLubyte *); + void (GLAPIENTRY * InterleavedArrays)(GLenum, GLsizei, const GLvoid *); + void (GLAPIENTRY * NormalPointer)(GLenum, GLsizei, const GLvoid *); + void (GLAPIENTRY * PolygonOffset)(GLfloat, GLfloat); + void (GLAPIENTRY * TexCoordPointer)(GLint, GLenum, GLsizei, const GLvoid *); + void (GLAPIENTRY * VertexPointer)(GLint, GLenum, GLsizei, const GLvoid *); + GLboolean (GLAPIENTRY * AreTexturesResident)(GLsizei, const GLuint *, GLboolean *); + void (GLAPIENTRY * CopyTexImage1D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint); + void (GLAPIENTRY * CopyTexImage2D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint); + void (GLAPIENTRY * CopyTexSubImage1D)(GLenum, GLint, GLint, GLint, GLint, GLsizei); + void (GLAPIENTRY * CopyTexSubImage2D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei); + void (GLAPIENTRY * DeleteTextures)(GLsizei, const GLuint *); + void (GLAPIENTRY * GenTextures)(GLsizei, GLuint *); + void (GLAPIENTRY * GetPointerv)(GLenum, GLvoid **); + GLboolean (GLAPIENTRY * IsTexture)(GLuint); + void (GLAPIENTRY * PrioritizeTextures)(GLsizei, const GLuint *, const GLclampf *); + void (GLAPIENTRY * TexSubImage1D)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *); + void (GLAPIENTRY * TexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *); + void (GLAPIENTRY * PopClientAttrib)(void); + void (GLAPIENTRY * PushClientAttrib)(GLbitfield); +}; + +typedef struct __GLdispatchTableRec GLDISPATCHTABLE; + +typedef struct _GLCLTPROCTABLE +{ + int cEntries; + GLDISPATCHTABLE glDispatchTable; +} GLCLTPROCTABLE, * PGLCLTPROCTABLE; + +typedef VOID (APIENTRY * PFN_SETPROCTABLE)(PGLCLTPROCTABLE); + +BOOL APIENTRY +DrvCopyContext( + DHGLRC dhrcSource, + DHGLRC dhrcDest, + UINT fuMask ); + +DHGLRC APIENTRY +DrvCreateLayerContext( + HDC hdc, + INT iLayerPlane ); + +DHGLRC APIENTRY +DrvCreateContext( + HDC hdc ); + +BOOL APIENTRY +DrvDeleteContext( + DHGLRC dhglrc ); + +BOOL APIENTRY +DrvDescribeLayerPlane( + HDC hdc, + INT iPixelFormat, + INT iLayerPlane, + UINT nBytes, + LPLAYERPLANEDESCRIPTOR plpd ); + +LONG APIENTRY +DrvDescribePixelFormat( + HDC hdc, + INT iPixelFormat, + ULONG cjpfd, + PIXELFORMATDESCRIPTOR *ppfd ); + +int APIENTRY +DrvGetLayerPaletteEntries( + HDC hdc, + INT iLayerPlane, + INT iStart, + INT cEntries, + COLORREF *pcr ); + +PROC APIENTRY +DrvGetProcAddress( + LPCSTR lpszProc ); + +BOOL APIENTRY +DrvRealizeLayerPalette( + HDC hdc, + INT iLayerPlane, + BOOL bRealize ); + +BOOL APIENTRY +DrvReleaseContext( + DHGLRC dhglrc ); + +void APIENTRY +DrvSetCallbackProcs( + INT nProcs, + PROC *pProcs ); + +PGLCLTPROCTABLE APIENTRY +DrvSetContext( + HDC hdc, + DHGLRC dhglrc, + PFN_SETPROCTABLE pfnSetProcTable ); + +int APIENTRY +DrvSetLayerPaletteEntries( + HDC hdc, + INT iLayerPlane, + INT iStart, + INT cEntries, + CONST COLORREF *pcr ); + +BOOL APIENTRY +DrvSetPixelFormat( + HDC hdc, + LONG iPixelFormat ); + +BOOL APIENTRY +DrvShareLists( + DHGLRC dhglrc1, + DHGLRC dhglrc2 ); + +BOOL APIENTRY +DrvSwapBuffers( + HDC hdc ); + +BOOL APIENTRY +DrvSwapLayerBuffers( + HDC hdc, + UINT fuPlanes ); + +BOOL APIENTRY +DrvValidateVersion( + ULONG ulVersion ); + +#endif /* STW_ICD_H */ diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.c b/src/gallium/state_trackers/wgl/stw_pixelformat.c new file mode 100644 index 0000000000..c296744838 --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_pixelformat.c @@ -0,0 +1,370 @@ +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include "main/mtypes.h" +#include "main/context.h" + +#include "pipe/p_format.h" +#include "pipe/p_defines.h" +#include "pipe/p_screen.h" + +#include "util/u_debug.h" + +#include "stw_device.h" +#include "stw_pixelformat.h" +#include "stw_public.h" +#include "stw_tls.h" + + +struct stw_pf_color_info +{ + enum pipe_format format; + struct { + unsigned char red; + unsigned char green; + unsigned char blue; + unsigned char alpha; + } bits; + struct { + unsigned char red; + unsigned char green; + unsigned char blue; + unsigned char alpha; + } shift; +}; + +struct stw_pf_depth_info +{ + enum pipe_format format; + struct { + unsigned char depth; + unsigned char stencil; + } bits; +}; + + +/* NOTE: order matters, since in otherwise equal circumstances the first + * format listed will get chosen */ + +static const struct stw_pf_color_info +stw_pf_color[] = { + /* no-alpha */ + { PIPE_FORMAT_X8R8G8B8_UNORM, { 8, 8, 8, 0}, {16, 8, 0, 0} }, + { PIPE_FORMAT_B8G8R8X8_UNORM, { 8, 8, 8, 0}, { 8, 16, 24, 0} }, + { PIPE_FORMAT_R5G6B5_UNORM, { 5, 6, 5, 0}, {11, 5, 0, 0} }, + /* alpha */ + { PIPE_FORMAT_A8R8G8B8_UNORM, { 8, 8, 8, 8}, {16, 8, 0, 24} }, + { PIPE_FORMAT_B8G8R8A8_UNORM, { 8, 8, 8, 8}, { 8, 16, 24, 0} }, +#if 0 + { PIPE_FORMAT_A2B10G10R10_UNORM, {10, 10, 10, 2}, { 0, 10, 20, 30} }, +#endif + { PIPE_FORMAT_A1R5G5B5_UNORM, { 5, 5, 5, 1}, {10, 5, 0, 15} }, + { PIPE_FORMAT_A4R4G4B4_UNORM, { 4, 4, 4, 4}, {16, 4, 0, 12} } +}; + + +static const struct stw_pf_depth_info +stw_pf_depth_stencil[] = { + /* pure depth */ + { PIPE_FORMAT_Z32_UNORM, {32, 0} }, + { PIPE_FORMAT_Z24X8_UNORM, {24, 0} }, + { PIPE_FORMAT_X8Z24_UNORM, {24, 0} }, + { PIPE_FORMAT_Z16_UNORM, {16, 0} }, + /* pure stencil */ + { PIPE_FORMAT_S8_UNORM, { 0, 8} }, + /* combined depth-stencil */ + { PIPE_FORMAT_S8Z24_UNORM, {24, 8} }, + { PIPE_FORMAT_Z24S8_UNORM, {24, 8} } +}; + + +static const boolean +stw_pf_doublebuffer[] = { + FALSE, + TRUE, +}; + + +const unsigned +stw_pf_multisample[] = { + 0, + 4 +}; + + +static void +stw_pixelformat_add( + struct stw_device *stw_dev, + const struct stw_pf_color_info *color, + const struct stw_pf_depth_info *depth, + unsigned accum, + boolean doublebuffer, + unsigned samples ) +{ + boolean extended = FALSE; + struct stw_pixelformat_info *pfi; + + assert(stw_dev->pixelformat_extended_count < STW_MAX_PIXELFORMATS); + if(stw_dev->pixelformat_extended_count >= STW_MAX_PIXELFORMATS) + return; + + assert(pf_layout( color->format ) == PIPE_FORMAT_LAYOUT_RGBAZS ); + assert(pf_get_component_bits( color->format, PIPE_FORMAT_COMP_R ) == color->bits.red ); + assert(pf_get_component_bits( color->format, PIPE_FORMAT_COMP_G ) == color->bits.green ); + assert(pf_get_component_bits( color->format, PIPE_FORMAT_COMP_B ) == color->bits.blue ); + assert(pf_get_component_bits( color->format, PIPE_FORMAT_COMP_A ) == color->bits.alpha ); + assert(pf_layout( depth->format ) == PIPE_FORMAT_LAYOUT_RGBAZS ); + assert(pf_get_component_bits( depth->format, PIPE_FORMAT_COMP_Z ) == depth->bits.depth ); + assert(pf_get_component_bits( depth->format, PIPE_FORMAT_COMP_S ) == depth->bits.stencil ); + + pfi = &stw_dev->pixelformats[stw_dev->pixelformat_extended_count]; + + memset(pfi, 0, sizeof *pfi); + + pfi->color_format = color->format; + pfi->depth_stencil_format = depth->format; + + pfi->pfd.nSize = sizeof pfi->pfd; + pfi->pfd.nVersion = 1; + + pfi->pfd.dwFlags = PFD_SUPPORT_OPENGL; + + /* TODO: also support non-native pixel formats */ + pfi->pfd.dwFlags |= PFD_DRAW_TO_WINDOW ; + + if (doublebuffer) + pfi->pfd.dwFlags |= PFD_DOUBLEBUFFER | PFD_SWAP_COPY; + + pfi->pfd.iPixelType = PFD_TYPE_RGBA; + + pfi->pfd.cColorBits = color->bits.red + color->bits.green + color->bits.blue + color->bits.alpha; + pfi->pfd.cRedBits = color->bits.red; + pfi->pfd.cRedShift = color->shift.red; + pfi->pfd.cGreenBits = color->bits.green; + pfi->pfd.cGreenShift = color->shift.green; + pfi->pfd.cBlueBits = color->bits.blue; + pfi->pfd.cBlueShift = color->shift.blue; + pfi->pfd.cAlphaBits = color->bits.alpha; + pfi->pfd.cAlphaShift = color->shift.alpha; + pfi->pfd.cAccumBits = 4*accum; + pfi->pfd.cAccumRedBits = accum; + pfi->pfd.cAccumGreenBits = accum; + pfi->pfd.cAccumBlueBits = accum; + pfi->pfd.cAccumAlphaBits = accum; + pfi->pfd.cDepthBits = depth->bits.depth; + pfi->pfd.cStencilBits = depth->bits.stencil; + pfi->pfd.cAuxBuffers = 0; + pfi->pfd.iLayerType = 0; + pfi->pfd.bReserved = 0; + pfi->pfd.dwLayerMask = 0; + pfi->pfd.dwVisibleMask = 0; + pfi->pfd.dwDamageMask = 0; + + if(samples) { + pfi->numSampleBuffers = 1; + pfi->numSamples = samples; + extended = TRUE; + } + + ++stw_dev->pixelformat_extended_count; + + if(!extended) { + ++stw_dev->pixelformat_count; + assert(stw_dev->pixelformat_count == stw_dev->pixelformat_extended_count); + } +} + +void +stw_pixelformat_init( void ) +{ + struct pipe_screen *screen = stw_dev->screen; + unsigned i, j, k, l; + + assert( !stw_dev->pixelformat_count ); + assert( !stw_dev->pixelformat_extended_count ); + + for(i = 0; i < Elements(stw_pf_multisample); ++i) { + unsigned samples = stw_pf_multisample[i]; + + /* FIXME: re-enabled MSAA when we can query it */ + if(samples) + continue; + + for(j = 0; j < Elements(stw_pf_color); ++j) { + const struct stw_pf_color_info *color = &stw_pf_color[j]; + + if(!screen->is_format_supported(screen, color->format, PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) + continue; + + for(k = 0; k < Elements(stw_pf_doublebuffer); ++k) { + unsigned doublebuffer = stw_pf_doublebuffer[k]; + + for(l = 0; l < Elements(stw_pf_depth_stencil); ++l) { + const struct stw_pf_depth_info *depth = &stw_pf_depth_stencil[l]; + + if(!screen->is_format_supported(screen, depth->format, PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0)) + continue; + + stw_pixelformat_add( stw_dev, color, depth, 0, doublebuffer, samples ); + stw_pixelformat_add( stw_dev, color, depth, 16, doublebuffer, samples ); + } + } + } + } + + assert( stw_dev->pixelformat_count <= stw_dev->pixelformat_extended_count ); + assert( stw_dev->pixelformat_extended_count <= STW_MAX_PIXELFORMATS ); +} + +uint +stw_pixelformat_get_count( void ) +{ + return stw_dev->pixelformat_count; +} + +uint +stw_pixelformat_get_extended_count( void ) +{ + return stw_dev->pixelformat_extended_count; +} + +const struct stw_pixelformat_info * +stw_pixelformat_get_info( uint index ) +{ + assert( index < stw_dev->pixelformat_extended_count ); + + return &stw_dev->pixelformats[index]; +} + + +void +stw_pixelformat_visual(GLvisual *visual, + const struct stw_pixelformat_info *pfi ) +{ + memset(visual, 0, sizeof *visual); + _mesa_initialize_visual( + visual, + (pfi->pfd.iPixelType == PFD_TYPE_RGBA) ? GL_TRUE : GL_FALSE, + (pfi->pfd.dwFlags & PFD_DOUBLEBUFFER) ? GL_TRUE : GL_FALSE, + (pfi->pfd.dwFlags & PFD_STEREO) ? GL_TRUE : GL_FALSE, + pfi->pfd.cRedBits, + pfi->pfd.cGreenBits, + pfi->pfd.cBlueBits, + pfi->pfd.cAlphaBits, + (pfi->pfd.iPixelType == PFD_TYPE_COLORINDEX) ? pfi->pfd.cColorBits : 0, + pfi->pfd.cDepthBits, + pfi->pfd.cStencilBits, + pfi->pfd.cAccumRedBits, + pfi->pfd.cAccumGreenBits, + pfi->pfd.cAccumBlueBits, + pfi->pfd.cAccumAlphaBits, + pfi->numSamples ); +} + + +int +stw_pixelformat_describe( + HDC hdc, + int iPixelFormat, + UINT nBytes, + LPPIXELFORMATDESCRIPTOR ppfd ) +{ + uint count; + uint index; + const struct stw_pixelformat_info *pfi; + + (void) hdc; + + count = stw_pixelformat_get_extended_count(); + index = (uint) iPixelFormat - 1; + + if (ppfd == NULL) + return count; + if (index >= count || nBytes != sizeof( PIXELFORMATDESCRIPTOR )) + return 0; + + pfi = stw_pixelformat_get_info( index ); + + memcpy(ppfd, &pfi->pfd, sizeof( PIXELFORMATDESCRIPTOR )); + + return count; +} + +/* Only used by the wgl code, but have it here to avoid exporting the + * pixelformat.h functionality. + */ +int stw_pixelformat_choose( HDC hdc, + CONST PIXELFORMATDESCRIPTOR *ppfd ) +{ + uint count; + uint index; + uint bestindex; + uint bestdelta; + + (void) hdc; + + count = stw_pixelformat_get_count(); + bestindex = count; + bestdelta = ~0U; + + for (index = 0; index < count; index++) { + uint delta = 0; + const struct stw_pixelformat_info *pfi = stw_pixelformat_get_info( index ); + + if (!(ppfd->dwFlags & PFD_DOUBLEBUFFER_DONTCARE) && + !!(ppfd->dwFlags & PFD_DOUBLEBUFFER) != + !!(pfi->pfd.dwFlags & PFD_DOUBLEBUFFER)) + continue; + + /* FIXME: Take in account individual channel bits */ + if (ppfd->cColorBits != pfi->pfd.cColorBits) + delta += 8; + + if (ppfd->cDepthBits != pfi->pfd.cDepthBits) + delta += 4; + + if (ppfd->cStencilBits != pfi->pfd.cStencilBits) + delta += 2; + + if (ppfd->cAlphaBits != pfi->pfd.cAlphaBits) + delta++; + + if (delta < bestdelta) { + bestindex = index; + bestdelta = delta; + if (bestdelta == 0) + break; + } + } + + if (bestindex == count) + return 0; + + return bestindex + 1; +} diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.h b/src/gallium/state_trackers/wgl/stw_pixelformat.h new file mode 100644 index 0000000000..bec429231b --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_pixelformat.h @@ -0,0 +1,65 @@ +/************************************************************************** + * + * 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. + * + **************************************************************************/ + +#ifndef STW_PIXELFORMAT_H +#define STW_PIXELFORMAT_H + +#include + +#include "main/mtypes.h" + +#include "pipe/p_compiler.h" +#include "pipe/p_format.h" + +struct stw_pixelformat_info +{ + enum pipe_format color_format; + enum pipe_format depth_stencil_format; + + PIXELFORMATDESCRIPTOR pfd; + + unsigned numSampleBuffers; + unsigned numSamples; +}; + +void +stw_pixelformat_init( void ); + +uint +stw_pixelformat_get_count( void ); + +uint +stw_pixelformat_get_extended_count( void ); + +const struct stw_pixelformat_info * +stw_pixelformat_get_info( uint index ); + +void +stw_pixelformat_visual(GLvisual *visual, + const struct stw_pixelformat_info *pfi ); + +#endif /* STW_PIXELFORMAT_H */ diff --git a/src/gallium/state_trackers/wgl/stw_public.h b/src/gallium/state_trackers/wgl/stw_public.h new file mode 100644 index 0000000000..7fe9cfb356 --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_public.h @@ -0,0 +1,73 @@ +/************************************************************************** + * + * 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. + * + **************************************************************************/ + +#ifndef STW_PUBLIC_H +#define STW_PUBLIC_H + +#include + +BOOL stw_copy_context( UINT_PTR hglrcSrc, + UINT_PTR hglrcDst, + UINT mask ); + +UINT_PTR stw_create_layer_context( HDC hdc, + int iLayerPlane ); + +BOOL stw_share_lists( UINT_PTR hglrc1, UINT_PTR hglrc2 ); + +BOOL stw_delete_context( UINT_PTR hglrc ); + +BOOL +stw_release_context( UINT_PTR dhglrc ); + +UINT_PTR stw_get_current_context( void ); + +HDC stw_get_current_dc( void ); + +BOOL stw_make_current( HDC hdc, UINT_PTR hglrc ); + +BOOL stw_swap_buffers( HDC hdc ); + +BOOL +stw_swap_layer_buffers( HDC hdc, UINT fuPlanes ); + +PROC stw_get_proc_address( LPCSTR lpszProc ); + +int stw_pixelformat_describe( HDC hdc, + int iPixelFormat, + UINT nBytes, + LPPIXELFORMATDESCRIPTOR ppfd ); + +int stw_pixelformat_get( HDC hdc ); + +BOOL stw_pixelformat_set( HDC hdc, + int iPixelFormat ); + +int stw_pixelformat_choose( HDC hdc, + CONST PIXELFORMATDESCRIPTOR *ppfd ); + +#endif diff --git a/src/gallium/state_trackers/wgl/stw_tls.c b/src/gallium/state_trackers/wgl/stw_tls.c new file mode 100644 index 0000000000..4bd6a9289c --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_tls.c @@ -0,0 +1,139 @@ +/************************************************************************** + * + * 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. + * + **************************************************************************/ + +#include + +#include "pipe/p_compiler.h" +#include "util/u_memory.h" +#include "stw_tls.h" + +static DWORD tlsIndex = TLS_OUT_OF_INDEXES; + +boolean +stw_tls_init(void) +{ + tlsIndex = TlsAlloc(); + if (tlsIndex == TLS_OUT_OF_INDEXES) { + return FALSE; + } + + return TRUE; +} + +static INLINE struct stw_tls_data * +stw_tls_data_create() +{ + struct stw_tls_data *data; + + data = CALLOC_STRUCT(stw_tls_data); + if (!data) + goto no_data; + + data->hCallWndProcHook = SetWindowsHookEx(WH_CALLWNDPROC, + stw_call_window_proc, + NULL, + GetCurrentThreadId()); + if(data->hCallWndProcHook == NULL) + goto no_hook; + + TlsSetValue(tlsIndex, data); + + return data; + +no_hook: + FREE(data); +no_data: + return NULL; +} + +boolean +stw_tls_init_thread(void) +{ + struct stw_tls_data *data; + + if (tlsIndex == TLS_OUT_OF_INDEXES) { + return FALSE; + } + + data = stw_tls_data_create(); + if(!data) + return FALSE; + + return TRUE; +} + +void +stw_tls_cleanup_thread(void) +{ + struct stw_tls_data *data; + + if (tlsIndex == TLS_OUT_OF_INDEXES) { + return; + } + + data = (struct stw_tls_data *) TlsGetValue(tlsIndex); + if(data) { + TlsSetValue(tlsIndex, NULL); + + if(data->hCallWndProcHook) { + UnhookWindowsHookEx(data->hCallWndProcHook); + data->hCallWndProcHook = NULL; + } + + FREE(data); + } +} + +void +stw_tls_cleanup(void) +{ + if (tlsIndex != TLS_OUT_OF_INDEXES) { + TlsFree(tlsIndex); + tlsIndex = TLS_OUT_OF_INDEXES; + } +} + +struct stw_tls_data * +stw_tls_get_data(void) +{ + struct stw_tls_data *data; + + if (tlsIndex == TLS_OUT_OF_INDEXES) { + return NULL; + } + + data = (struct stw_tls_data *) TlsGetValue(tlsIndex); + if(!data) { + /* DllMain is called with DLL_THREAD_ATTACH only by threads created after + * the DLL is loaded by the process */ + data = stw_tls_data_create(); + if(!data) + return NULL; + } + + return data; +} diff --git a/src/gallium/state_trackers/wgl/stw_tls.h b/src/gallium/state_trackers/wgl/stw_tls.h new file mode 100644 index 0000000000..fbf8b1cbee --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_tls.h @@ -0,0 +1,59 @@ +/************************************************************************** + * + * 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. + * + **************************************************************************/ + +#ifndef STW_TLS_H +#define STW_TLS_H + +#include + +struct stw_tls_data +{ + HHOOK hCallWndProcHook; +}; + +boolean +stw_tls_init(void); + +boolean +stw_tls_init_thread(void); + +void +stw_tls_cleanup_thread(void); + +void +stw_tls_cleanup(void); + +struct stw_tls_data * +stw_tls_get_data(void); + +LRESULT CALLBACK +stw_call_window_proc( + int nCode, + WPARAM wParam, + LPARAM lParam ); + +#endif /* STW_TLS_H */ diff --git a/src/gallium/state_trackers/wgl/stw_wgl.c b/src/gallium/state_trackers/wgl/stw_wgl.c new file mode 100644 index 0000000000..d4b2f51f4c --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_wgl.c @@ -0,0 +1,329 @@ +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include + +#include "util/u_debug.h" +#include "stw_public.h" +#include "stw_wgl.h" + + +WINGDIAPI BOOL APIENTRY +wglCopyContext( + HGLRC hglrcSrc, + HGLRC hglrcDst, + UINT mask ) +{ + return stw_copy_context( (UINT_PTR)hglrcSrc, + (UINT_PTR)hglrcDst, + mask ); +} + +WINGDIAPI HGLRC APIENTRY +wglCreateContext( + HDC hdc ) +{ + return wglCreateLayerContext(hdc, 0); +} + +WINGDIAPI HGLRC APIENTRY +wglCreateLayerContext( + HDC hdc, + int iLayerPlane ) +{ + return (HGLRC) stw_create_layer_context( hdc, iLayerPlane ); +} + +WINGDIAPI BOOL APIENTRY +wglDeleteContext( + HGLRC hglrc ) +{ + return stw_delete_context( (UINT_PTR)hglrc ); +} + + +WINGDIAPI HGLRC APIENTRY +wglGetCurrentContext( VOID ) +{ + return (HGLRC)stw_get_current_context(); +} + +WINGDIAPI HDC APIENTRY +wglGetCurrentDC( VOID ) +{ + return stw_get_current_dc(); +} + +WINGDIAPI BOOL APIENTRY +wglMakeCurrent( + HDC hdc, + HGLRC hglrc ) +{ + return stw_make_current( hdc, (UINT_PTR)hglrc ); +} + + +WINGDIAPI BOOL APIENTRY +wglSwapBuffers( + HDC hdc ) +{ + return stw_swap_buffers( hdc ); +} + + +WINGDIAPI BOOL APIENTRY +wglSwapLayerBuffers( + HDC hdc, + UINT fuPlanes ) +{ + return stw_swap_layer_buffers( hdc, fuPlanes ); +} + +WINGDIAPI PROC APIENTRY +wglGetProcAddress( + LPCSTR lpszProc ) +{ + return stw_get_proc_address( lpszProc ); +} + + +WINGDIAPI int APIENTRY +wglChoosePixelFormat( + HDC hdc, + CONST PIXELFORMATDESCRIPTOR *ppfd ) +{ + if (ppfd->nSize != sizeof( PIXELFORMATDESCRIPTOR ) || ppfd->nVersion != 1) + return 0; + if (ppfd->iPixelType != PFD_TYPE_RGBA) + return 0; + if (!(ppfd->dwFlags & PFD_DRAW_TO_WINDOW)) + return 0; + if (!(ppfd->dwFlags & PFD_SUPPORT_OPENGL)) + return 0; + if (ppfd->dwFlags & PFD_DRAW_TO_BITMAP) + return 0; + if (ppfd->dwFlags & PFD_SUPPORT_GDI) + return 0; + if (!(ppfd->dwFlags & PFD_STEREO_DONTCARE) && (ppfd->dwFlags & PFD_STEREO)) + return 0; + + return stw_pixelformat_choose( hdc, ppfd ); +} + +WINGDIAPI int APIENTRY +wglDescribePixelFormat( + HDC hdc, + int iPixelFormat, + UINT nBytes, + LPPIXELFORMATDESCRIPTOR ppfd ) +{ + return stw_pixelformat_describe( hdc, iPixelFormat, nBytes, ppfd ); +} + +WINGDIAPI int APIENTRY +wglGetPixelFormat( + HDC hdc ) +{ + return stw_pixelformat_get( hdc ); +} + +WINGDIAPI BOOL APIENTRY +wglSetPixelFormat( + HDC hdc, + int iPixelFormat, + const PIXELFORMATDESCRIPTOR *ppfd ) +{ + if (ppfd->nSize != sizeof( PIXELFORMATDESCRIPTOR )) + return FALSE; + + return stw_pixelformat_set( hdc, iPixelFormat ); +} + + +WINGDIAPI BOOL APIENTRY +wglUseFontBitmapsA( + HDC hdc, + DWORD first, + DWORD count, + DWORD listBase ) +{ + (void) hdc; + (void) first; + (void) count; + (void) listBase; + + assert( 0 ); + + return FALSE; +} + +WINGDIAPI BOOL APIENTRY +wglShareLists( + HGLRC hglrc1, + HGLRC hglrc2 ) +{ + return stw_share_lists( (UINT_PTR)hglrc1, (UINT_PTR)hglrc2);; +} + +WINGDIAPI BOOL APIENTRY +wglUseFontBitmapsW( + HDC hdc, + DWORD first, + DWORD count, + DWORD listBase ) +{ + (void) hdc; + (void) first; + (void) count; + (void) listBase; + + assert( 0 ); + + return FALSE; +} + +WINGDIAPI BOOL APIENTRY +wglUseFontOutlinesA( + HDC hdc, + DWORD first, + DWORD count, + DWORD listBase, + FLOAT deviation, + FLOAT extrusion, + int format, + LPGLYPHMETRICSFLOAT lpgmf ) +{ + (void) hdc; + (void) first; + (void) count; + (void) listBase; + (void) deviation; + (void) extrusion; + (void) format; + (void) lpgmf; + + assert( 0 ); + + return FALSE; +} + +WINGDIAPI BOOL APIENTRY +wglUseFontOutlinesW( + HDC hdc, + DWORD first, + DWORD count, + DWORD listBase, + FLOAT deviation, + FLOAT extrusion, + int format, + LPGLYPHMETRICSFLOAT lpgmf ) +{ + (void) hdc; + (void) first; + (void) count; + (void) listBase; + (void) deviation; + (void) extrusion; + (void) format; + (void) lpgmf; + + assert( 0 ); + + return FALSE; +} + +WINGDIAPI BOOL APIENTRY +wglDescribeLayerPlane( + HDC hdc, + int iPixelFormat, + int iLayerPlane, + UINT nBytes, + LPLAYERPLANEDESCRIPTOR plpd ) +{ + (void) hdc; + (void) iPixelFormat; + (void) iLayerPlane; + (void) nBytes; + (void) plpd; + + assert( 0 ); + + return FALSE; +} + +WINGDIAPI int APIENTRY +wglSetLayerPaletteEntries( + HDC hdc, + int iLayerPlane, + int iStart, + int cEntries, + CONST COLORREF *pcr ) +{ + (void) hdc; + (void) iLayerPlane; + (void) iStart; + (void) cEntries; + (void) pcr; + + assert( 0 ); + + return 0; +} + +WINGDIAPI int APIENTRY +wglGetLayerPaletteEntries( + HDC hdc, + int iLayerPlane, + int iStart, + int cEntries, + COLORREF *pcr ) +{ + (void) hdc; + (void) iLayerPlane; + (void) iStart; + (void) cEntries; + (void) pcr; + + assert( 0 ); + + return 0; +} + +WINGDIAPI BOOL APIENTRY +wglRealizeLayerPalette( + HDC hdc, + int iLayerPlane, + BOOL bRealize ) +{ + (void) hdc; + (void) iLayerPlane; + (void) bRealize; + + assert( 0 ); + + return FALSE; +} diff --git a/src/gallium/state_trackers/wgl/stw_wgl.h b/src/gallium/state_trackers/wgl/stw_wgl.h new file mode 100644 index 0000000000..a98179944a --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_wgl.h @@ -0,0 +1,63 @@ +/************************************************************************** + * + * 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 STW_WGL_H_ +#define STW_WGL_H_ + + +#include + +#include + + +/* + * Undeclared APIs exported by opengl32.dll + */ + +WINGDIAPI BOOL WINAPI +wglSwapBuffers(HDC hdc); + +WINGDIAPI int WINAPI +wglChoosePixelFormat(HDC hdc, + CONST PIXELFORMATDESCRIPTOR *ppfd); + +WINGDIAPI int WINAPI +wglDescribePixelFormat(HDC hdc, + int iPixelFormat, + UINT nBytes, + LPPIXELFORMATDESCRIPTOR ppfd); + +WINGDIAPI int WINAPI +wglGetPixelFormat(HDC hdc); + +WINGDIAPI BOOL WINAPI +wglSetPixelFormat(HDC hdc, + int iPixelFormat, + CONST PIXELFORMATDESCRIPTOR *ppfd); + + +#endif /* STW_WGL_H_ */ diff --git a/src/gallium/state_trackers/wgl/stw_winsys.h b/src/gallium/state_trackers/wgl/stw_winsys.h new file mode 100644 index 0000000000..c0bf82c9ed --- /dev/null +++ b/src/gallium/state_trackers/wgl/stw_winsys.h @@ -0,0 +1,65 @@ +/************************************************************************** + * + * 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. + * + **************************************************************************/ + +#ifndef STW_WINSYS_H +#define STW_WINSYS_H + +#include /* for HDC */ + +#include "pipe/p_compiler.h" + +struct pipe_screen; +struct pipe_context; +struct pipe_surface; + +struct stw_winsys +{ + struct pipe_screen * + (*create_screen)( void ); + + struct pipe_context * + (*create_context)( struct pipe_screen *screen ); + + void + (*flush_frontbuffer)( struct pipe_screen *screen, + struct pipe_surface *surf, + HDC hDC ); +}; + +boolean +stw_init(const struct stw_winsys *stw_winsys); + +boolean +stw_init_thread(void); + +void +stw_cleanup_thread(void); + +void +stw_cleanup(void); + +#endif /* STW_WINSYS_H */ diff --git a/src/gallium/state_trackers/wgl/wgl/stw_wgl.c b/src/gallium/state_trackers/wgl/wgl/stw_wgl.c deleted file mode 100644 index a131292f7a..0000000000 --- a/src/gallium/state_trackers/wgl/wgl/stw_wgl.c +++ /dev/null @@ -1,329 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include - -#include "util/u_debug.h" -#include "shared/stw_public.h" -#include "stw_wgl.h" - - -WINGDIAPI BOOL APIENTRY -wglCopyContext( - HGLRC hglrcSrc, - HGLRC hglrcDst, - UINT mask ) -{ - return stw_copy_context( (UINT_PTR)hglrcSrc, - (UINT_PTR)hglrcDst, - mask ); -} - -WINGDIAPI HGLRC APIENTRY -wglCreateContext( - HDC hdc ) -{ - return wglCreateLayerContext(hdc, 0); -} - -WINGDIAPI HGLRC APIENTRY -wglCreateLayerContext( - HDC hdc, - int iLayerPlane ) -{ - return (HGLRC) stw_create_layer_context( hdc, iLayerPlane ); -} - -WINGDIAPI BOOL APIENTRY -wglDeleteContext( - HGLRC hglrc ) -{ - return stw_delete_context( (UINT_PTR)hglrc ); -} - - -WINGDIAPI HGLRC APIENTRY -wglGetCurrentContext( VOID ) -{ - return (HGLRC)stw_get_current_context(); -} - -WINGDIAPI HDC APIENTRY -wglGetCurrentDC( VOID ) -{ - return stw_get_current_dc(); -} - -WINGDIAPI BOOL APIENTRY -wglMakeCurrent( - HDC hdc, - HGLRC hglrc ) -{ - return stw_make_current( hdc, (UINT_PTR)hglrc ); -} - - -WINGDIAPI BOOL APIENTRY -wglSwapBuffers( - HDC hdc ) -{ - return stw_swap_buffers( hdc ); -} - - -WINGDIAPI BOOL APIENTRY -wglSwapLayerBuffers( - HDC hdc, - UINT fuPlanes ) -{ - return stw_swap_layer_buffers( hdc, fuPlanes ); -} - -WINGDIAPI PROC APIENTRY -wglGetProcAddress( - LPCSTR lpszProc ) -{ - return stw_get_proc_address( lpszProc ); -} - - -WINGDIAPI int APIENTRY -wglChoosePixelFormat( - HDC hdc, - CONST PIXELFORMATDESCRIPTOR *ppfd ) -{ - if (ppfd->nSize != sizeof( PIXELFORMATDESCRIPTOR ) || ppfd->nVersion != 1) - return 0; - if (ppfd->iPixelType != PFD_TYPE_RGBA) - return 0; - if (!(ppfd->dwFlags & PFD_DRAW_TO_WINDOW)) - return 0; - if (!(ppfd->dwFlags & PFD_SUPPORT_OPENGL)) - return 0; - if (ppfd->dwFlags & PFD_DRAW_TO_BITMAP) - return 0; - if (ppfd->dwFlags & PFD_SUPPORT_GDI) - return 0; - if (!(ppfd->dwFlags & PFD_STEREO_DONTCARE) && (ppfd->dwFlags & PFD_STEREO)) - return 0; - - return stw_pixelformat_choose( hdc, ppfd ); -} - -WINGDIAPI int APIENTRY -wglDescribePixelFormat( - HDC hdc, - int iPixelFormat, - UINT nBytes, - LPPIXELFORMATDESCRIPTOR ppfd ) -{ - return stw_pixelformat_describe( hdc, iPixelFormat, nBytes, ppfd ); -} - -WINGDIAPI int APIENTRY -wglGetPixelFormat( - HDC hdc ) -{ - return stw_pixelformat_get( hdc ); -} - -WINGDIAPI BOOL APIENTRY -wglSetPixelFormat( - HDC hdc, - int iPixelFormat, - const PIXELFORMATDESCRIPTOR *ppfd ) -{ - if (ppfd->nSize != sizeof( PIXELFORMATDESCRIPTOR )) - return FALSE; - - return stw_pixelformat_set( hdc, iPixelFormat ); -} - - -WINGDIAPI BOOL APIENTRY -wglUseFontBitmapsA( - HDC hdc, - DWORD first, - DWORD count, - DWORD listBase ) -{ - (void) hdc; - (void) first; - (void) count; - (void) listBase; - - assert( 0 ); - - return FALSE; -} - -WINGDIAPI BOOL APIENTRY -wglShareLists( - HGLRC hglrc1, - HGLRC hglrc2 ) -{ - return stw_share_lists( (UINT_PTR)hglrc1, (UINT_PTR)hglrc2);; -} - -WINGDIAPI BOOL APIENTRY -wglUseFontBitmapsW( - HDC hdc, - DWORD first, - DWORD count, - DWORD listBase ) -{ - (void) hdc; - (void) first; - (void) count; - (void) listBase; - - assert( 0 ); - - return FALSE; -} - -WINGDIAPI BOOL APIENTRY -wglUseFontOutlinesA( - HDC hdc, - DWORD first, - DWORD count, - DWORD listBase, - FLOAT deviation, - FLOAT extrusion, - int format, - LPGLYPHMETRICSFLOAT lpgmf ) -{ - (void) hdc; - (void) first; - (void) count; - (void) listBase; - (void) deviation; - (void) extrusion; - (void) format; - (void) lpgmf; - - assert( 0 ); - - return FALSE; -} - -WINGDIAPI BOOL APIENTRY -wglUseFontOutlinesW( - HDC hdc, - DWORD first, - DWORD count, - DWORD listBase, - FLOAT deviation, - FLOAT extrusion, - int format, - LPGLYPHMETRICSFLOAT lpgmf ) -{ - (void) hdc; - (void) first; - (void) count; - (void) listBase; - (void) deviation; - (void) extrusion; - (void) format; - (void) lpgmf; - - assert( 0 ); - - return FALSE; -} - -WINGDIAPI BOOL APIENTRY -wglDescribeLayerPlane( - HDC hdc, - int iPixelFormat, - int iLayerPlane, - UINT nBytes, - LPLAYERPLANEDESCRIPTOR plpd ) -{ - (void) hdc; - (void) iPixelFormat; - (void) iLayerPlane; - (void) nBytes; - (void) plpd; - - assert( 0 ); - - return FALSE; -} - -WINGDIAPI int APIENTRY -wglSetLayerPaletteEntries( - HDC hdc, - int iLayerPlane, - int iStart, - int cEntries, - CONST COLORREF *pcr ) -{ - (void) hdc; - (void) iLayerPlane; - (void) iStart; - (void) cEntries; - (void) pcr; - - assert( 0 ); - - return 0; -} - -WINGDIAPI int APIENTRY -wglGetLayerPaletteEntries( - HDC hdc, - int iLayerPlane, - int iStart, - int cEntries, - COLORREF *pcr ) -{ - (void) hdc; - (void) iLayerPlane; - (void) iStart; - (void) cEntries; - (void) pcr; - - assert( 0 ); - - return 0; -} - -WINGDIAPI BOOL APIENTRY -wglRealizeLayerPalette( - HDC hdc, - int iLayerPlane, - BOOL bRealize ) -{ - (void) hdc; - (void) iLayerPlane; - (void) bRealize; - - assert( 0 ); - - return FALSE; -} diff --git a/src/gallium/state_trackers/wgl/wgl/stw_wgl.h b/src/gallium/state_trackers/wgl/wgl/stw_wgl.h deleted file mode 100644 index a98179944a..0000000000 --- a/src/gallium/state_trackers/wgl/wgl/stw_wgl.h +++ /dev/null @@ -1,63 +0,0 @@ -/************************************************************************** - * - * 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 STW_WGL_H_ -#define STW_WGL_H_ - - -#include - -#include - - -/* - * Undeclared APIs exported by opengl32.dll - */ - -WINGDIAPI BOOL WINAPI -wglSwapBuffers(HDC hdc); - -WINGDIAPI int WINAPI -wglChoosePixelFormat(HDC hdc, - CONST PIXELFORMATDESCRIPTOR *ppfd); - -WINGDIAPI int WINAPI -wglDescribePixelFormat(HDC hdc, - int iPixelFormat, - UINT nBytes, - LPPIXELFORMATDESCRIPTOR ppfd); - -WINGDIAPI int WINAPI -wglGetPixelFormat(HDC hdc); - -WINGDIAPI BOOL WINAPI -wglSetPixelFormat(HDC hdc, - int iPixelFormat, - CONST PIXELFORMATDESCRIPTOR *ppfd); - - -#endif /* STW_WGL_H_ */ -- cgit v1.2.3 From f8c11526c0034faca7b7e3ab01ab85206847f441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 22 Sep 2009 17:42:47 +0100 Subject: gdi: Update for WGL statetracker source reorg. --- src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c | 2 +- src/gallium/winsys/gdi/gdi_softpipe_winsys.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c b/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c index c0c33b45d5..9d0daf77e9 100644 --- a/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c +++ b/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c @@ -43,7 +43,7 @@ #include "util/u_memory.h" #include "llvmpipe/lp_winsys.h" #include "llvmpipe/lp_texture.h" -#include "shared/stw_winsys.h" +#include "stw_winsys.h" struct gdi_llvmpipe_displaytarget diff --git a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c index 66120a6a98..d82c8d6773 100644 --- a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c +++ b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c @@ -46,7 +46,7 @@ #include "util/u_memory.h" #include "softpipe/sp_winsys.h" #include "softpipe/sp_texture.h" -#include "shared/stw_winsys.h" +#include "stw_winsys.h" struct gdi_softpipe_buffer -- cgit v1.2.3 From 31f1571d1f6e325c16833afbb6e15b61561e5f1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 22 Sep 2009 18:51:41 +0100 Subject: wgl: Eliminate the shared layer; implement WGL API on top of the ICD callbacks. While the WGL API has been stale for decades now, the ICD interface has been updated with new Windows versions, so it is much easier to define everything in terms of the ICD interfaces, which is pretty much what Microsoft's opengl32.dll does anyway. --- src/gallium/state_trackers/wgl/SConscript | 1 - src/gallium/state_trackers/wgl/stw_context.c | 441 +++++++++++++-- src/gallium/state_trackers/wgl/stw_context.h | 8 +- src/gallium/state_trackers/wgl/stw_device.c | 23 +- src/gallium/state_trackers/wgl/stw_device.h | 5 +- src/gallium/state_trackers/wgl/stw_ext_gallium.c | 1 - .../state_trackers/wgl/stw_ext_pixelformat.c | 1 - src/gallium/state_trackers/wgl/stw_framebuffer.c | 18 +- .../state_trackers/wgl/stw_getprocaddress.c | 5 +- src/gallium/state_trackers/wgl/stw_icd.c | 617 --------------------- src/gallium/state_trackers/wgl/stw_pixelformat.c | 60 +- src/gallium/state_trackers/wgl/stw_pixelformat.h | 7 + src/gallium/state_trackers/wgl/stw_public.h | 73 --- src/gallium/state_trackers/wgl/stw_wgl.c | 63 +-- 14 files changed, 525 insertions(+), 798 deletions(-) delete mode 100644 src/gallium/state_trackers/wgl/stw_icd.c delete mode 100644 src/gallium/state_trackers/wgl/stw_public.h (limited to 'src') diff --git a/src/gallium/state_trackers/wgl/SConscript b/src/gallium/state_trackers/wgl/SConscript index 2e9aacb6e2..b05944a33b 100644 --- a/src/gallium/state_trackers/wgl/SConscript +++ b/src/gallium/state_trackers/wgl/SConscript @@ -26,7 +26,6 @@ if env['platform'] in ['windows']: 'stw_ext_swapinterval.c', 'stw_framebuffer.c', 'stw_getprocaddress.c', - 'stw_icd.c', 'stw_pixelformat.c', 'stw_tls.c', 'stw_wgl.c', diff --git a/src/gallium/state_trackers/wgl/stw_context.c b/src/gallium/state_trackers/wgl/stw_context.c index ead2c13cbf..f2f0264844 100644 --- a/src/gallium/state_trackers/wgl/stw_context.c +++ b/src/gallium/state_trackers/wgl/stw_context.c @@ -39,11 +39,11 @@ #include "trace/tr_context.h" #endif +#include "stw_icd.h" #include "stw_device.h" #include "stw_winsys.h" #include "stw_framebuffer.h" #include "stw_pixelformat.h" -#include "stw_public.h" #include "stw_context.h" #include "stw_tls.h" @@ -70,11 +70,11 @@ stw_current_context(void) } } -BOOL -stw_copy_context( - UINT_PTR hglrcSrc, - UINT_PTR hglrcDst, - UINT mask ) +BOOL APIENTRY +DrvCopyContext( + DHGLRC dhrcSource, + DHGLRC dhrcDest, + UINT fuMask ) { struct stw_context *src; struct stw_context *dst; @@ -82,15 +82,15 @@ stw_copy_context( pipe_mutex_lock( stw_dev->ctx_mutex ); - src = stw_lookup_context_locked( hglrcSrc ); - dst = stw_lookup_context_locked( hglrcDst ); + src = stw_lookup_context_locked( dhrcSource ); + dst = stw_lookup_context_locked( dhrcDest ); if (src && dst) { /* FIXME */ assert(0); (void) src; (void) dst; - (void) mask; + (void) fuMask; } pipe_mutex_unlock( stw_dev->ctx_mutex ); @@ -98,10 +98,10 @@ stw_copy_context( return ret; } -BOOL -stw_share_lists( - UINT_PTR hglrc1, - UINT_PTR hglrc2 ) +BOOL APIENTRY +DrvShareLists( + DHGLRC dhglrc1, + DHGLRC dhglrc2 ) { struct stw_context *ctx1; struct stw_context *ctx2; @@ -109,8 +109,8 @@ stw_share_lists( pipe_mutex_lock( stw_dev->ctx_mutex ); - ctx1 = stw_lookup_context_locked( hglrc1 ); - ctx2 = stw_lookup_context_locked( hglrc2 ); + ctx1 = stw_lookup_context_locked( dhglrc1 ); + ctx2 = stw_lookup_context_locked( dhglrc2 ); if (ctx1 && ctx2 && ctx1->iPixelFormat == ctx2->iPixelFormat) { @@ -136,10 +136,17 @@ stw_viewport(GLcontext * glctx, GLint x, GLint y, } } -UINT_PTR -stw_create_layer_context( +DHGLRC APIENTRY +DrvCreateContext( + HDC hdc ) +{ + return DrvCreateLayerContext( hdc, 0 ); +} + +DHGLRC APIENTRY +DrvCreateLayerContext( HDC hdc, - int iLayerPlane ) + INT iLayerPlane ) { int iPixelFormat; const struct stw_pixelformat_info *pfi; @@ -198,12 +205,12 @@ stw_create_layer_context( ctx->st->ctx->Driver.Viewport = stw_viewport; pipe_mutex_lock( stw_dev->ctx_mutex ); - ctx->hglrc = handle_table_add(stw_dev->ctx_table, ctx); + ctx->dhglrc = handle_table_add(stw_dev->ctx_table, ctx); pipe_mutex_unlock( stw_dev->ctx_mutex ); - if (!ctx->hglrc) + if (!ctx->dhglrc) goto no_hglrc; - return ctx->hglrc; + return ctx->dhglrc; no_hglrc: st_destroy_context(ctx->st); @@ -216,9 +223,9 @@ no_ctx: return 0; } -BOOL -stw_delete_context( - UINT_PTR hglrc ) +BOOL APIENTRY +DrvDeleteContext( + DHGLRC dhglrc ) { struct stw_context *ctx ; BOOL ret = FALSE; @@ -227,8 +234,8 @@ stw_delete_context( return FALSE; pipe_mutex_lock( stw_dev->ctx_mutex ); - ctx = stw_lookup_context_locked(hglrc); - handle_table_remove(stw_dev->ctx_table, hglrc); + ctx = stw_lookup_context_locked(dhglrc); + handle_table_remove(stw_dev->ctx_table, dhglrc); pipe_mutex_unlock( stw_dev->ctx_mutex ); if (ctx) { @@ -247,9 +254,9 @@ stw_delete_context( return ret; } -BOOL -stw_release_context( - UINT_PTR hglrc ) +BOOL APIENTRY +DrvReleaseContext( + DHGLRC dhglrc ) { struct stw_context *ctx; @@ -257,7 +264,7 @@ stw_release_context( return FALSE; pipe_mutex_lock( stw_dev->ctx_mutex ); - ctx = stw_lookup_context_locked( hglrc ); + ctx = stw_lookup_context_locked( dhglrc ); pipe_mutex_unlock( stw_dev->ctx_mutex ); if (!ctx) @@ -277,7 +284,7 @@ stw_release_context( } -UINT_PTR +DHGLRC stw_get_current_context( void ) { struct stw_context *ctx; @@ -286,7 +293,7 @@ stw_get_current_context( void ) if(!ctx) return 0; - return ctx->hglrc; + return ctx->dhglrc; } HDC @@ -304,7 +311,7 @@ stw_get_current_dc( void ) BOOL stw_make_current( HDC hdc, - UINT_PTR hglrc ) + DHGLRC dhglrc ) { struct stw_context *curctx = NULL; struct stw_context *ctx = NULL; @@ -315,23 +322,23 @@ stw_make_current( curctx = stw_current_context(); if (curctx != NULL) { - if (curctx->hglrc != hglrc) + if (curctx->dhglrc != dhglrc) st_flush(curctx->st, PIPE_FLUSH_RENDER_CACHE, NULL); /* Return if already current. */ - if (curctx->hglrc == hglrc && curctx->hdc == hdc) { + if (curctx->dhglrc == dhglrc && curctx->hdc == hdc) { ctx = curctx; fb = stw_framebuffer_from_hdc( hdc ); goto success; } } - if (hdc == NULL || hglrc == 0) { + if (hdc == NULL || dhglrc == 0) { return st_make_current( NULL, NULL, NULL ); } pipe_mutex_lock( stw_dev->ctx_mutex ); - ctx = stw_lookup_context_locked( hglrc ); + ctx = stw_lookup_context_locked( dhglrc ); pipe_mutex_unlock( stw_dev->ctx_mutex ); if(!ctx) goto fail; @@ -380,3 +387,363 @@ fail: st_make_current( NULL, NULL, NULL ); return FALSE; } + +/** + * Although WGL allows different dispatch entrypoints per context + */ +static const GLCLTPROCTABLE cpt = +{ + OPENGL_VERSION_110_ENTRIES, + { + &glNewList, + &glEndList, + &glCallList, + &glCallLists, + &glDeleteLists, + &glGenLists, + &glListBase, + &glBegin, + &glBitmap, + &glColor3b, + &glColor3bv, + &glColor3d, + &glColor3dv, + &glColor3f, + &glColor3fv, + &glColor3i, + &glColor3iv, + &glColor3s, + &glColor3sv, + &glColor3ub, + &glColor3ubv, + &glColor3ui, + &glColor3uiv, + &glColor3us, + &glColor3usv, + &glColor4b, + &glColor4bv, + &glColor4d, + &glColor4dv, + &glColor4f, + &glColor4fv, + &glColor4i, + &glColor4iv, + &glColor4s, + &glColor4sv, + &glColor4ub, + &glColor4ubv, + &glColor4ui, + &glColor4uiv, + &glColor4us, + &glColor4usv, + &glEdgeFlag, + &glEdgeFlagv, + &glEnd, + &glIndexd, + &glIndexdv, + &glIndexf, + &glIndexfv, + &glIndexi, + &glIndexiv, + &glIndexs, + &glIndexsv, + &glNormal3b, + &glNormal3bv, + &glNormal3d, + &glNormal3dv, + &glNormal3f, + &glNormal3fv, + &glNormal3i, + &glNormal3iv, + &glNormal3s, + &glNormal3sv, + &glRasterPos2d, + &glRasterPos2dv, + &glRasterPos2f, + &glRasterPos2fv, + &glRasterPos2i, + &glRasterPos2iv, + &glRasterPos2s, + &glRasterPos2sv, + &glRasterPos3d, + &glRasterPos3dv, + &glRasterPos3f, + &glRasterPos3fv, + &glRasterPos3i, + &glRasterPos3iv, + &glRasterPos3s, + &glRasterPos3sv, + &glRasterPos4d, + &glRasterPos4dv, + &glRasterPos4f, + &glRasterPos4fv, + &glRasterPos4i, + &glRasterPos4iv, + &glRasterPos4s, + &glRasterPos4sv, + &glRectd, + &glRectdv, + &glRectf, + &glRectfv, + &glRecti, + &glRectiv, + &glRects, + &glRectsv, + &glTexCoord1d, + &glTexCoord1dv, + &glTexCoord1f, + &glTexCoord1fv, + &glTexCoord1i, + &glTexCoord1iv, + &glTexCoord1s, + &glTexCoord1sv, + &glTexCoord2d, + &glTexCoord2dv, + &glTexCoord2f, + &glTexCoord2fv, + &glTexCoord2i, + &glTexCoord2iv, + &glTexCoord2s, + &glTexCoord2sv, + &glTexCoord3d, + &glTexCoord3dv, + &glTexCoord3f, + &glTexCoord3fv, + &glTexCoord3i, + &glTexCoord3iv, + &glTexCoord3s, + &glTexCoord3sv, + &glTexCoord4d, + &glTexCoord4dv, + &glTexCoord4f, + &glTexCoord4fv, + &glTexCoord4i, + &glTexCoord4iv, + &glTexCoord4s, + &glTexCoord4sv, + &glVertex2d, + &glVertex2dv, + &glVertex2f, + &glVertex2fv, + &glVertex2i, + &glVertex2iv, + &glVertex2s, + &glVertex2sv, + &glVertex3d, + &glVertex3dv, + &glVertex3f, + &glVertex3fv, + &glVertex3i, + &glVertex3iv, + &glVertex3s, + &glVertex3sv, + &glVertex4d, + &glVertex4dv, + &glVertex4f, + &glVertex4fv, + &glVertex4i, + &glVertex4iv, + &glVertex4s, + &glVertex4sv, + &glClipPlane, + &glColorMaterial, + &glCullFace, + &glFogf, + &glFogfv, + &glFogi, + &glFogiv, + &glFrontFace, + &glHint, + &glLightf, + &glLightfv, + &glLighti, + &glLightiv, + &glLightModelf, + &glLightModelfv, + &glLightModeli, + &glLightModeliv, + &glLineStipple, + &glLineWidth, + &glMaterialf, + &glMaterialfv, + &glMateriali, + &glMaterialiv, + &glPointSize, + &glPolygonMode, + &glPolygonStipple, + &glScissor, + &glShadeModel, + &glTexParameterf, + &glTexParameterfv, + &glTexParameteri, + &glTexParameteriv, + &glTexImage1D, + &glTexImage2D, + &glTexEnvf, + &glTexEnvfv, + &glTexEnvi, + &glTexEnviv, + &glTexGend, + &glTexGendv, + &glTexGenf, + &glTexGenfv, + &glTexGeni, + &glTexGeniv, + &glFeedbackBuffer, + &glSelectBuffer, + &glRenderMode, + &glInitNames, + &glLoadName, + &glPassThrough, + &glPopName, + &glPushName, + &glDrawBuffer, + &glClear, + &glClearAccum, + &glClearIndex, + &glClearColor, + &glClearStencil, + &glClearDepth, + &glStencilMask, + &glColorMask, + &glDepthMask, + &glIndexMask, + &glAccum, + &glDisable, + &glEnable, + &glFinish, + &glFlush, + &glPopAttrib, + &glPushAttrib, + &glMap1d, + &glMap1f, + &glMap2d, + &glMap2f, + &glMapGrid1d, + &glMapGrid1f, + &glMapGrid2d, + &glMapGrid2f, + &glEvalCoord1d, + &glEvalCoord1dv, + &glEvalCoord1f, + &glEvalCoord1fv, + &glEvalCoord2d, + &glEvalCoord2dv, + &glEvalCoord2f, + &glEvalCoord2fv, + &glEvalMesh1, + &glEvalPoint1, + &glEvalMesh2, + &glEvalPoint2, + &glAlphaFunc, + &glBlendFunc, + &glLogicOp, + &glStencilFunc, + &glStencilOp, + &glDepthFunc, + &glPixelZoom, + &glPixelTransferf, + &glPixelTransferi, + &glPixelStoref, + &glPixelStorei, + &glPixelMapfv, + &glPixelMapuiv, + &glPixelMapusv, + &glReadBuffer, + &glCopyPixels, + &glReadPixels, + &glDrawPixels, + &glGetBooleanv, + &glGetClipPlane, + &glGetDoublev, + &glGetError, + &glGetFloatv, + &glGetIntegerv, + &glGetLightfv, + &glGetLightiv, + &glGetMapdv, + &glGetMapfv, + &glGetMapiv, + &glGetMaterialfv, + &glGetMaterialiv, + &glGetPixelMapfv, + &glGetPixelMapuiv, + &glGetPixelMapusv, + &glGetPolygonStipple, + &glGetString, + &glGetTexEnvfv, + &glGetTexEnviv, + &glGetTexGendv, + &glGetTexGenfv, + &glGetTexGeniv, + &glGetTexImage, + &glGetTexParameterfv, + &glGetTexParameteriv, + &glGetTexLevelParameterfv, + &glGetTexLevelParameteriv, + &glIsEnabled, + &glIsList, + &glDepthRange, + &glFrustum, + &glLoadIdentity, + &glLoadMatrixf, + &glLoadMatrixd, + &glMatrixMode, + &glMultMatrixf, + &glMultMatrixd, + &glOrtho, + &glPopMatrix, + &glPushMatrix, + &glRotated, + &glRotatef, + &glScaled, + &glScalef, + &glTranslated, + &glTranslatef, + &glViewport, + &glArrayElement, + &glBindTexture, + &glColorPointer, + &glDisableClientState, + &glDrawArrays, + &glDrawElements, + &glEdgeFlagPointer, + &glEnableClientState, + &glIndexPointer, + &glIndexub, + &glIndexubv, + &glInterleavedArrays, + &glNormalPointer, + &glPolygonOffset, + &glTexCoordPointer, + &glVertexPointer, + &glAreTexturesResident, + &glCopyTexImage1D, + &glCopyTexImage2D, + &glCopyTexSubImage1D, + &glCopyTexSubImage2D, + &glDeleteTextures, + &glGenTextures, + &glGetPointerv, + &glIsTexture, + &glPrioritizeTextures, + &glTexSubImage1D, + &glTexSubImage2D, + &glPopClientAttrib, + &glPushClientAttrib + } +}; + +PGLCLTPROCTABLE APIENTRY +DrvSetContext( + HDC hdc, + DHGLRC dhglrc, + PFN_SETPROCTABLE pfnSetProcTable ) +{ + PGLCLTPROCTABLE r = (PGLCLTPROCTABLE)&cpt; + + if (!stw_make_current( hdc, dhglrc )) + r = NULL; + + return r; +} diff --git a/src/gallium/state_trackers/wgl/stw_context.h b/src/gallium/state_trackers/wgl/stw_context.h index 166471de5e..256c27e21e 100644 --- a/src/gallium/state_trackers/wgl/stw_context.h +++ b/src/gallium/state_trackers/wgl/stw_context.h @@ -35,9 +35,15 @@ struct st_context; struct stw_context { struct st_context *st; - UINT_PTR hglrc; + DHGLRC dhglrc; int iPixelFormat; HDC hdc; }; +DHGLRC stw_get_current_context( void ); + +HDC stw_get_current_dc( void ); + +BOOL stw_make_current( HDC hdc, DHGLRC dhglrc ); + #endif /* STW_CONTEXT_H */ diff --git a/src/gallium/state_trackers/wgl/stw_device.c b/src/gallium/state_trackers/wgl/stw_device.c index cbc3570cb9..a1a5b892ef 100644 --- a/src/gallium/state_trackers/wgl/stw_device.c +++ b/src/gallium/state_trackers/wgl/stw_device.c @@ -40,7 +40,7 @@ #include "stw_device.h" #include "stw_winsys.h" #include "stw_pixelformat.h" -#include "stw_public.h" +#include "stw_icd.h" #include "stw_tls.h" #include "stw_framebuffer.h" @@ -182,7 +182,7 @@ stw_cleanup(void) /* Ensure all contexts are destroyed */ i = handle_table_get_first_handle(stw_dev->ctx_table); while (i) { - stw_delete_context(i); + DrvDeleteContext(i); i = handle_table_get_next_handle(stw_dev->ctx_table, i); } handle_table_destroy(stw_dev->ctx_table); @@ -212,7 +212,7 @@ stw_cleanup(void) struct stw_context * -stw_lookup_context_locked( UINT_PTR dhglrc ) +stw_lookup_context_locked( DHGLRC dhglrc ) { if (dhglrc == 0) return NULL; @@ -223,3 +223,20 @@ stw_lookup_context_locked( UINT_PTR dhglrc ) return (struct stw_context *) handle_table_get(stw_dev->ctx_table, dhglrc); } + +void APIENTRY +DrvSetCallbackProcs( + INT nProcs, + PROC *pProcs ) +{ + return; +} + + +BOOL APIENTRY +DrvValidateVersion( + ULONG ulVersion ) +{ + /* TODO: get the expected version from the winsys */ + return ulVersion == 1; +} diff --git a/src/gallium/state_trackers/wgl/stw_device.h b/src/gallium/state_trackers/wgl/stw_device.h index e1bb9518dd..5e4e3d6180 100644 --- a/src/gallium/state_trackers/wgl/stw_device.h +++ b/src/gallium/state_trackers/wgl/stw_device.h @@ -29,11 +29,10 @@ #define STW_DEVICE_H_ -#include - #include "pipe/p_compiler.h" #include "pipe/p_thread.h" #include "util/u_handle_table.h" +#include "stw_icd.h" #include "stw_pixelformat.h" @@ -69,7 +68,7 @@ struct stw_device }; struct stw_context * -stw_lookup_context_locked( UINT_PTR hglrc ); +stw_lookup_context_locked( DHGLRC hglrc ); extern struct stw_device *stw_dev; diff --git a/src/gallium/state_trackers/wgl/stw_ext_gallium.c b/src/gallium/state_trackers/wgl/stw_ext_gallium.c index 13a42fee25..fb30ec5dba 100644 --- a/src/gallium/state_trackers/wgl/stw_ext_gallium.c +++ b/src/gallium/state_trackers/wgl/stw_ext_gallium.c @@ -27,7 +27,6 @@ #include "pipe/p_screen.h" -#include "stw_public.h" #include "stw_device.h" #include "stw_winsys.h" #include "stw_ext_gallium.h" diff --git a/src/gallium/state_trackers/wgl/stw_ext_pixelformat.c b/src/gallium/state_trackers/wgl/stw_ext_pixelformat.c index 0e2d407699..8a9995aba8 100644 --- a/src/gallium/state_trackers/wgl/stw_ext_pixelformat.c +++ b/src/gallium/state_trackers/wgl/stw_ext_pixelformat.c @@ -43,7 +43,6 @@ #include "pipe/p_compiler.h" #include "util/u_memory.h" -#include "stw_public.h" #include "stw_pixelformat.h" diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.c b/src/gallium/state_trackers/wgl/stw_framebuffer.c index b8956bb550..123b841c8f 100644 --- a/src/gallium/state_trackers/wgl/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c @@ -38,9 +38,9 @@ #include "trace/tr_texture.h" #endif +#include "stw_icd.h" #include "stw_framebuffer.h" #include "stw_device.h" -#include "stw_public.h" #include "stw_winsys.h" #include "stw_tls.h" @@ -379,10 +379,10 @@ stw_framebuffer_from_hwnd( } -BOOL -stw_pixelformat_set( +BOOL APIENTRY +DrvSetPixelFormat( HDC hdc, - int iPixelFormat ) + LONG iPixelFormat ) { uint count; uint index; @@ -435,8 +435,8 @@ stw_pixelformat_get( } -BOOL -stw_swap_buffers( +BOOL APIENTRY +DrvSwapBuffers( HDC hdc ) { struct stw_framebuffer *fb; @@ -481,13 +481,13 @@ stw_swap_buffers( } -BOOL -stw_swap_layer_buffers( +BOOL APIENTRY +DrvSwapLayerBuffers( HDC hdc, UINT fuPlanes ) { if(fuPlanes & WGL_SWAP_MAIN_PLANE) - return stw_swap_buffers(hdc); + return DrvSwapBuffers(hdc); return FALSE; } diff --git a/src/gallium/state_trackers/wgl/stw_getprocaddress.c b/src/gallium/state_trackers/wgl/stw_getprocaddress.c index 57ce63ec02..8875dc22f3 100644 --- a/src/gallium/state_trackers/wgl/stw_getprocaddress.c +++ b/src/gallium/state_trackers/wgl/stw_getprocaddress.c @@ -33,7 +33,6 @@ #include #include "glapi/glapi.h" -#include "stw_public.h" #include "stw_ext_gallium.h" struct stw_extension_entry @@ -68,8 +67,8 @@ static const struct stw_extension_entry stw_extension_entries[] = { { NULL, NULL } }; -PROC -stw_get_proc_address( +PROC APIENTRY +DrvGetProcAddress( LPCSTR lpszProc ) { const struct stw_extension_entry *entry; diff --git a/src/gallium/state_trackers/wgl/stw_icd.c b/src/gallium/state_trackers/wgl/stw_icd.c deleted file mode 100644 index dc5ba9161e..0000000000 --- a/src/gallium/state_trackers/wgl/stw_icd.c +++ /dev/null @@ -1,617 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include -#include - -#include "GL/gl.h" - -#include "util/u_debug.h" -#include "pipe/p_thread.h" - -#include "stw_public.h" -#include "stw_icd.h" - -#define DBG 0 - - -BOOL APIENTRY -DrvCopyContext( - DHGLRC dhrcSource, - DHGLRC dhrcDest, - UINT fuMask ) -{ - return stw_copy_context(dhrcSource, dhrcDest, fuMask); -} - - -DHGLRC APIENTRY -DrvCreateLayerContext( - HDC hdc, - INT iLayerPlane ) -{ - DHGLRC r; - - r = stw_create_layer_context( hdc, iLayerPlane ); - - if (DBG) - debug_printf( "%s( %p, %i ) = %lu\n", - __FUNCTION__, hdc, iLayerPlane, r ); - - return r; -} - -DHGLRC APIENTRY -DrvCreateContext( - HDC hdc ) -{ - return DrvCreateLayerContext( hdc, 0 ); -} - -BOOL APIENTRY -DrvDeleteContext( - DHGLRC dhglrc ) -{ - BOOL r; - - r = stw_delete_context( dhglrc ); - - if (DBG) - debug_printf( "%s( %lu ) = %u\n", - __FUNCTION__, dhglrc, r ); - - return r; -} - -BOOL APIENTRY -DrvDescribeLayerPlane( - HDC hdc, - INT iPixelFormat, - INT iLayerPlane, - UINT nBytes, - LPLAYERPLANEDESCRIPTOR plpd ) -{ - if (DBG) - debug_printf( "%s\n", __FUNCTION__ ); - - return FALSE; -} - -LONG APIENTRY -DrvDescribePixelFormat( - HDC hdc, - INT iPixelFormat, - ULONG cjpfd, - PIXELFORMATDESCRIPTOR *ppfd ) -{ - LONG r; - - r = stw_pixelformat_describe( hdc, iPixelFormat, cjpfd, ppfd ); - - if (DBG) - debug_printf( "%s( %p, %i, %lu, %p ) = %li\n", - __FUNCTION__, hdc, iPixelFormat, cjpfd, ppfd, r ); - - return r; -} - -int APIENTRY -DrvGetLayerPaletteEntries( - HDC hdc, - INT iLayerPlane, - INT iStart, - INT cEntries, - COLORREF *pcr ) -{ - if (DBG) - debug_printf( "%s\n", __FUNCTION__ ); - - return 0; -} - -PROC APIENTRY -DrvGetProcAddress( - LPCSTR lpszProc ) -{ - PROC r; - - r = stw_get_proc_address( lpszProc ); - - if (DBG) - debug_printf( "%s( \"%s\" ) = %p\n", __FUNCTION__, lpszProc, r ); - - return r; -} - -BOOL APIENTRY -DrvRealizeLayerPalette( - HDC hdc, - INT iLayerPlane, - BOOL bRealize ) -{ - if (DBG) - debug_printf( "%s\n", __FUNCTION__ ); - - return FALSE; -} - -BOOL APIENTRY -DrvReleaseContext( - DHGLRC dhglrc ) -{ - return stw_release_context(dhglrc); -} - -void APIENTRY -DrvSetCallbackProcs( - INT nProcs, - PROC *pProcs ) -{ - if (DBG) - debug_printf( "%s( %d, %p )\n", __FUNCTION__, nProcs, pProcs ); - - return; -} - - -/** - * Although WGL allows different dispatch entrypoints per context - */ -static const GLCLTPROCTABLE cpt = -{ - OPENGL_VERSION_110_ENTRIES, - { - &glNewList, - &glEndList, - &glCallList, - &glCallLists, - &glDeleteLists, - &glGenLists, - &glListBase, - &glBegin, - &glBitmap, - &glColor3b, - &glColor3bv, - &glColor3d, - &glColor3dv, - &glColor3f, - &glColor3fv, - &glColor3i, - &glColor3iv, - &glColor3s, - &glColor3sv, - &glColor3ub, - &glColor3ubv, - &glColor3ui, - &glColor3uiv, - &glColor3us, - &glColor3usv, - &glColor4b, - &glColor4bv, - &glColor4d, - &glColor4dv, - &glColor4f, - &glColor4fv, - &glColor4i, - &glColor4iv, - &glColor4s, - &glColor4sv, - &glColor4ub, - &glColor4ubv, - &glColor4ui, - &glColor4uiv, - &glColor4us, - &glColor4usv, - &glEdgeFlag, - &glEdgeFlagv, - &glEnd, - &glIndexd, - &glIndexdv, - &glIndexf, - &glIndexfv, - &glIndexi, - &glIndexiv, - &glIndexs, - &glIndexsv, - &glNormal3b, - &glNormal3bv, - &glNormal3d, - &glNormal3dv, - &glNormal3f, - &glNormal3fv, - &glNormal3i, - &glNormal3iv, - &glNormal3s, - &glNormal3sv, - &glRasterPos2d, - &glRasterPos2dv, - &glRasterPos2f, - &glRasterPos2fv, - &glRasterPos2i, - &glRasterPos2iv, - &glRasterPos2s, - &glRasterPos2sv, - &glRasterPos3d, - &glRasterPos3dv, - &glRasterPos3f, - &glRasterPos3fv, - &glRasterPos3i, - &glRasterPos3iv, - &glRasterPos3s, - &glRasterPos3sv, - &glRasterPos4d, - &glRasterPos4dv, - &glRasterPos4f, - &glRasterPos4fv, - &glRasterPos4i, - &glRasterPos4iv, - &glRasterPos4s, - &glRasterPos4sv, - &glRectd, - &glRectdv, - &glRectf, - &glRectfv, - &glRecti, - &glRectiv, - &glRects, - &glRectsv, - &glTexCoord1d, - &glTexCoord1dv, - &glTexCoord1f, - &glTexCoord1fv, - &glTexCoord1i, - &glTexCoord1iv, - &glTexCoord1s, - &glTexCoord1sv, - &glTexCoord2d, - &glTexCoord2dv, - &glTexCoord2f, - &glTexCoord2fv, - &glTexCoord2i, - &glTexCoord2iv, - &glTexCoord2s, - &glTexCoord2sv, - &glTexCoord3d, - &glTexCoord3dv, - &glTexCoord3f, - &glTexCoord3fv, - &glTexCoord3i, - &glTexCoord3iv, - &glTexCoord3s, - &glTexCoord3sv, - &glTexCoord4d, - &glTexCoord4dv, - &glTexCoord4f, - &glTexCoord4fv, - &glTexCoord4i, - &glTexCoord4iv, - &glTexCoord4s, - &glTexCoord4sv, - &glVertex2d, - &glVertex2dv, - &glVertex2f, - &glVertex2fv, - &glVertex2i, - &glVertex2iv, - &glVertex2s, - &glVertex2sv, - &glVertex3d, - &glVertex3dv, - &glVertex3f, - &glVertex3fv, - &glVertex3i, - &glVertex3iv, - &glVertex3s, - &glVertex3sv, - &glVertex4d, - &glVertex4dv, - &glVertex4f, - &glVertex4fv, - &glVertex4i, - &glVertex4iv, - &glVertex4s, - &glVertex4sv, - &glClipPlane, - &glColorMaterial, - &glCullFace, - &glFogf, - &glFogfv, - &glFogi, - &glFogiv, - &glFrontFace, - &glHint, - &glLightf, - &glLightfv, - &glLighti, - &glLightiv, - &glLightModelf, - &glLightModelfv, - &glLightModeli, - &glLightModeliv, - &glLineStipple, - &glLineWidth, - &glMaterialf, - &glMaterialfv, - &glMateriali, - &glMaterialiv, - &glPointSize, - &glPolygonMode, - &glPolygonStipple, - &glScissor, - &glShadeModel, - &glTexParameterf, - &glTexParameterfv, - &glTexParameteri, - &glTexParameteriv, - &glTexImage1D, - &glTexImage2D, - &glTexEnvf, - &glTexEnvfv, - &glTexEnvi, - &glTexEnviv, - &glTexGend, - &glTexGendv, - &glTexGenf, - &glTexGenfv, - &glTexGeni, - &glTexGeniv, - &glFeedbackBuffer, - &glSelectBuffer, - &glRenderMode, - &glInitNames, - &glLoadName, - &glPassThrough, - &glPopName, - &glPushName, - &glDrawBuffer, - &glClear, - &glClearAccum, - &glClearIndex, - &glClearColor, - &glClearStencil, - &glClearDepth, - &glStencilMask, - &glColorMask, - &glDepthMask, - &glIndexMask, - &glAccum, - &glDisable, - &glEnable, - &glFinish, - &glFlush, - &glPopAttrib, - &glPushAttrib, - &glMap1d, - &glMap1f, - &glMap2d, - &glMap2f, - &glMapGrid1d, - &glMapGrid1f, - &glMapGrid2d, - &glMapGrid2f, - &glEvalCoord1d, - &glEvalCoord1dv, - &glEvalCoord1f, - &glEvalCoord1fv, - &glEvalCoord2d, - &glEvalCoord2dv, - &glEvalCoord2f, - &glEvalCoord2fv, - &glEvalMesh1, - &glEvalPoint1, - &glEvalMesh2, - &glEvalPoint2, - &glAlphaFunc, - &glBlendFunc, - &glLogicOp, - &glStencilFunc, - &glStencilOp, - &glDepthFunc, - &glPixelZoom, - &glPixelTransferf, - &glPixelTransferi, - &glPixelStoref, - &glPixelStorei, - &glPixelMapfv, - &glPixelMapuiv, - &glPixelMapusv, - &glReadBuffer, - &glCopyPixels, - &glReadPixels, - &glDrawPixels, - &glGetBooleanv, - &glGetClipPlane, - &glGetDoublev, - &glGetError, - &glGetFloatv, - &glGetIntegerv, - &glGetLightfv, - &glGetLightiv, - &glGetMapdv, - &glGetMapfv, - &glGetMapiv, - &glGetMaterialfv, - &glGetMaterialiv, - &glGetPixelMapfv, - &glGetPixelMapuiv, - &glGetPixelMapusv, - &glGetPolygonStipple, - &glGetString, - &glGetTexEnvfv, - &glGetTexEnviv, - &glGetTexGendv, - &glGetTexGenfv, - &glGetTexGeniv, - &glGetTexImage, - &glGetTexParameterfv, - &glGetTexParameteriv, - &glGetTexLevelParameterfv, - &glGetTexLevelParameteriv, - &glIsEnabled, - &glIsList, - &glDepthRange, - &glFrustum, - &glLoadIdentity, - &glLoadMatrixf, - &glLoadMatrixd, - &glMatrixMode, - &glMultMatrixf, - &glMultMatrixd, - &glOrtho, - &glPopMatrix, - &glPushMatrix, - &glRotated, - &glRotatef, - &glScaled, - &glScalef, - &glTranslated, - &glTranslatef, - &glViewport, - &glArrayElement, - &glBindTexture, - &glColorPointer, - &glDisableClientState, - &glDrawArrays, - &glDrawElements, - &glEdgeFlagPointer, - &glEnableClientState, - &glIndexPointer, - &glIndexub, - &glIndexubv, - &glInterleavedArrays, - &glNormalPointer, - &glPolygonOffset, - &glTexCoordPointer, - &glVertexPointer, - &glAreTexturesResident, - &glCopyTexImage1D, - &glCopyTexImage2D, - &glCopyTexSubImage1D, - &glCopyTexSubImage2D, - &glDeleteTextures, - &glGenTextures, - &glGetPointerv, - &glIsTexture, - &glPrioritizeTextures, - &glTexSubImage1D, - &glTexSubImage2D, - &glPopClientAttrib, - &glPushClientAttrib - } -}; - - -PGLCLTPROCTABLE APIENTRY -DrvSetContext( - HDC hdc, - DHGLRC dhglrc, - PFN_SETPROCTABLE pfnSetProcTable ) -{ - PGLCLTPROCTABLE r = (PGLCLTPROCTABLE)&cpt; - - if (!stw_make_current( hdc, dhglrc )) - r = NULL; - - if (DBG) - debug_printf( "%s( 0x%p, %lu, 0x%p ) = %p\n", - __FUNCTION__, hdc, dhglrc, pfnSetProcTable, r ); - - return r; -} - -int APIENTRY -DrvSetLayerPaletteEntries( - HDC hdc, - INT iLayerPlane, - INT iStart, - INT cEntries, - CONST COLORREF *pcr ) -{ - if (DBG) - debug_printf( "%s\n", __FUNCTION__ ); - - return 0; -} - -BOOL APIENTRY -DrvSetPixelFormat( - HDC hdc, - LONG iPixelFormat ) -{ - BOOL r; - - r = stw_pixelformat_set( hdc, iPixelFormat ); - - if (DBG) - debug_printf( "%s( %p, %li ) = %s\n", __FUNCTION__, hdc, iPixelFormat, r ? "TRUE" : "FALSE" ); - - return r; -} - -BOOL APIENTRY -DrvShareLists( - DHGLRC dhglrc1, - DHGLRC dhglrc2 ) -{ - if (DBG) - debug_printf( "%s\n", __FUNCTION__ ); - - return stw_share_lists(dhglrc1, dhglrc2); -} - -BOOL APIENTRY -DrvSwapBuffers( - HDC hdc ) -{ - if (DBG) - debug_printf( "%s( %p )\n", __FUNCTION__, hdc ); - - return stw_swap_buffers( hdc ); -} - -BOOL APIENTRY -DrvSwapLayerBuffers( - HDC hdc, - UINT fuPlanes ) -{ - if (DBG) - debug_printf( "%s\n", __FUNCTION__ ); - - return stw_swap_layer_buffers( hdc, fuPlanes ); -} - -BOOL APIENTRY -DrvValidateVersion( - ULONG ulVersion ) -{ - if (DBG) - debug_printf( "%s( %lu )\n", __FUNCTION__, ulVersion ); - - /* TODO: get the expected version from the winsys */ - - return ulVersion == 1; -} diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.c b/src/gallium/state_trackers/wgl/stw_pixelformat.c index c296744838..9b591d5751 100644 --- a/src/gallium/state_trackers/wgl/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/stw_pixelformat.c @@ -34,9 +34,9 @@ #include "util/u_debug.h" +#include "stw_icd.h" #include "stw_device.h" #include "stw_pixelformat.h" -#include "stw_public.h" #include "stw_tls.h" @@ -288,12 +288,12 @@ stw_pixelformat_visual(GLvisual *visual, } -int -stw_pixelformat_describe( +LONG APIENTRY +DrvDescribePixelFormat( HDC hdc, - int iPixelFormat, - UINT nBytes, - LPPIXELFORMATDESCRIPTOR ppfd ) + INT iPixelFormat, + ULONG cjpfd, + PIXELFORMATDESCRIPTOR *ppfd ) { uint count; uint index; @@ -306,7 +306,7 @@ stw_pixelformat_describe( if (ppfd == NULL) return count; - if (index >= count || nBytes != sizeof( PIXELFORMATDESCRIPTOR )) + if (index >= count || cjpfd != sizeof( PIXELFORMATDESCRIPTOR )) return 0; pfi = stw_pixelformat_get_info( index ); @@ -316,6 +316,52 @@ stw_pixelformat_describe( return count; } +BOOL APIENTRY +DrvDescribeLayerPlane( + HDC hdc, + INT iPixelFormat, + INT iLayerPlane, + UINT nBytes, + LPLAYERPLANEDESCRIPTOR plpd ) +{ + assert(0); + return FALSE; +} + +int APIENTRY +DrvGetLayerPaletteEntries( + HDC hdc, + INT iLayerPlane, + INT iStart, + INT cEntries, + COLORREF *pcr ) +{ + assert(0); + return 0; +} + +int APIENTRY +DrvSetLayerPaletteEntries( + HDC hdc, + INT iLayerPlane, + INT iStart, + INT cEntries, + CONST COLORREF *pcr ) +{ + assert(0); + return 0; +} + +BOOL APIENTRY +DrvRealizeLayerPalette( + HDC hdc, + INT iLayerPlane, + BOOL bRealize ) +{ + assert(0); + return FALSE; +} + /* Only used by the wgl code, but have it here to avoid exporting the * pixelformat.h functionality. */ diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.h b/src/gallium/state_trackers/wgl/stw_pixelformat.h index bec429231b..2fa7e22c43 100644 --- a/src/gallium/state_trackers/wgl/stw_pixelformat.h +++ b/src/gallium/state_trackers/wgl/stw_pixelformat.h @@ -62,4 +62,11 @@ void stw_pixelformat_visual(GLvisual *visual, const struct stw_pixelformat_info *pfi ); +int +stw_pixelformat_choose( HDC hdc, + CONST PIXELFORMATDESCRIPTOR *ppfd ); + +int +stw_pixelformat_get(HDC hdc); + #endif /* STW_PIXELFORMAT_H */ diff --git a/src/gallium/state_trackers/wgl/stw_public.h b/src/gallium/state_trackers/wgl/stw_public.h deleted file mode 100644 index 7fe9cfb356..0000000000 --- a/src/gallium/state_trackers/wgl/stw_public.h +++ /dev/null @@ -1,73 +0,0 @@ -/************************************************************************** - * - * 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. - * - **************************************************************************/ - -#ifndef STW_PUBLIC_H -#define STW_PUBLIC_H - -#include - -BOOL stw_copy_context( UINT_PTR hglrcSrc, - UINT_PTR hglrcDst, - UINT mask ); - -UINT_PTR stw_create_layer_context( HDC hdc, - int iLayerPlane ); - -BOOL stw_share_lists( UINT_PTR hglrc1, UINT_PTR hglrc2 ); - -BOOL stw_delete_context( UINT_PTR hglrc ); - -BOOL -stw_release_context( UINT_PTR dhglrc ); - -UINT_PTR stw_get_current_context( void ); - -HDC stw_get_current_dc( void ); - -BOOL stw_make_current( HDC hdc, UINT_PTR hglrc ); - -BOOL stw_swap_buffers( HDC hdc ); - -BOOL -stw_swap_layer_buffers( HDC hdc, UINT fuPlanes ); - -PROC stw_get_proc_address( LPCSTR lpszProc ); - -int stw_pixelformat_describe( HDC hdc, - int iPixelFormat, - UINT nBytes, - LPPIXELFORMATDESCRIPTOR ppfd ); - -int stw_pixelformat_get( HDC hdc ); - -BOOL stw_pixelformat_set( HDC hdc, - int iPixelFormat ); - -int stw_pixelformat_choose( HDC hdc, - CONST PIXELFORMATDESCRIPTOR *ppfd ); - -#endif diff --git a/src/gallium/state_trackers/wgl/stw_wgl.c b/src/gallium/state_trackers/wgl/stw_wgl.c index d4b2f51f4c..bb199fdd25 100644 --- a/src/gallium/state_trackers/wgl/stw_wgl.c +++ b/src/gallium/state_trackers/wgl/stw_wgl.c @@ -28,7 +28,9 @@ #include #include "util/u_debug.h" -#include "stw_public.h" +#include "stw_icd.h" +#include "stw_context.h" +#include "stw_pixelformat.h" #include "stw_wgl.h" @@ -38,16 +40,16 @@ wglCopyContext( HGLRC hglrcDst, UINT mask ) { - return stw_copy_context( (UINT_PTR)hglrcSrc, - (UINT_PTR)hglrcDst, - mask ); + return DrvCopyContext( (DHGLRC)(UINT_PTR)hglrcSrc, + (DHGLRC)(UINT_PTR)hglrcDst, + mask ); } WINGDIAPI HGLRC APIENTRY wglCreateContext( HDC hdc ) { - return wglCreateLayerContext(hdc, 0); + return (HGLRC) DrvCreateContext(hdc); } WINGDIAPI HGLRC APIENTRY @@ -55,21 +57,21 @@ wglCreateLayerContext( HDC hdc, int iLayerPlane ) { - return (HGLRC) stw_create_layer_context( hdc, iLayerPlane ); + return (HGLRC) DrvCreateLayerContext( hdc, iLayerPlane ); } WINGDIAPI BOOL APIENTRY wglDeleteContext( HGLRC hglrc ) { - return stw_delete_context( (UINT_PTR)hglrc ); + return DrvDeleteContext((DHGLRC)(UINT_PTR)hglrc ); } WINGDIAPI HGLRC APIENTRY wglGetCurrentContext( VOID ) { - return (HGLRC)stw_get_current_context(); + return (HGLRC)(UINT_PTR)stw_get_current_context(); } WINGDIAPI HDC APIENTRY @@ -83,7 +85,7 @@ wglMakeCurrent( HDC hdc, HGLRC hglrc ) { - return stw_make_current( hdc, (UINT_PTR)hglrc ); + return DrvSetContext( hdc, (DHGLRC)(UINT_PTR)hglrc, NULL ) ? TRUE : FALSE; } @@ -91,7 +93,7 @@ WINGDIAPI BOOL APIENTRY wglSwapBuffers( HDC hdc ) { - return stw_swap_buffers( hdc ); + return DrvSwapBuffers( hdc ); } @@ -100,14 +102,14 @@ wglSwapLayerBuffers( HDC hdc, UINT fuPlanes ) { - return stw_swap_layer_buffers( hdc, fuPlanes ); + return DrvSwapLayerBuffers( hdc, fuPlanes ); } WINGDIAPI PROC APIENTRY wglGetProcAddress( LPCSTR lpszProc ) { - return stw_get_proc_address( lpszProc ); + return DrvGetProcAddress( lpszProc ); } @@ -141,7 +143,7 @@ wglDescribePixelFormat( UINT nBytes, LPPIXELFORMATDESCRIPTOR ppfd ) { - return stw_pixelformat_describe( hdc, iPixelFormat, nBytes, ppfd ); + return DrvDescribePixelFormat( hdc, iPixelFormat, nBytes, ppfd ); } WINGDIAPI int APIENTRY @@ -160,7 +162,7 @@ wglSetPixelFormat( if (ppfd->nSize != sizeof( PIXELFORMATDESCRIPTOR )) return FALSE; - return stw_pixelformat_set( hdc, iPixelFormat ); + return DrvSetPixelFormat( hdc, iPixelFormat ); } @@ -186,7 +188,8 @@ wglShareLists( HGLRC hglrc1, HGLRC hglrc2 ) { - return stw_share_lists( (UINT_PTR)hglrc1, (UINT_PTR)hglrc2);; + return DrvShareLists((DHGLRC)(UINT_PTR)hglrc1, + (DHGLRC)(UINT_PTR)hglrc2); } WINGDIAPI BOOL APIENTRY @@ -264,15 +267,7 @@ wglDescribeLayerPlane( UINT nBytes, LPLAYERPLANEDESCRIPTOR plpd ) { - (void) hdc; - (void) iPixelFormat; - (void) iLayerPlane; - (void) nBytes; - (void) plpd; - - assert( 0 ); - - return FALSE; + return DrvDescribeLayerPlane(hdc, iPixelFormat, iLayerPlane, nBytes, plpd); } WINGDIAPI int APIENTRY @@ -283,15 +278,7 @@ wglSetLayerPaletteEntries( int cEntries, CONST COLORREF *pcr ) { - (void) hdc; - (void) iLayerPlane; - (void) iStart; - (void) cEntries; - (void) pcr; - - assert( 0 ); - - return 0; + return DrvSetLayerPaletteEntries(hdc, iLayerPlane, iStart, cEntries, pcr); } WINGDIAPI int APIENTRY @@ -302,15 +289,7 @@ wglGetLayerPaletteEntries( int cEntries, COLORREF *pcr ) { - (void) hdc; - (void) iLayerPlane; - (void) iStart; - (void) cEntries; - (void) pcr; - - assert( 0 ); - - return 0; + return DrvGetLayerPaletteEntries(hdc, iLayerPlane, iStart, cEntries, pcr); } WINGDIAPI BOOL APIENTRY -- cgit v1.2.3 From 5a7f7085303c1337466e231f8fb12b9c4113f4ad Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Tue, 22 Sep 2009 17:49:53 -0400 Subject: st/xorg: keep the user buffer contents around Michel noticed that they were getting out of scope --- src/gallium/state_trackers/xorg/xorg_composite.c | 67 +++++++++++------------- src/gallium/state_trackers/xorg/xorg_exa.h | 5 +- 2 files changed, 34 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index ed649a9d65..a870ad1049 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -150,24 +150,22 @@ setup_vertex_data0(struct exa_context *ctx, int srcX, int srcY, int maskX, int maskY, int dstX, int dstY, int width, int height) { - float vertices[4][2][4]; - /* 1st vertex */ - setup_vertex0(vertices[0], dstX, dstY, + setup_vertex0(ctx->vertices2[0], dstX, dstY, ctx->solid_color); /* 2nd vertex */ - setup_vertex0(vertices[1], dstX + width, dstY, + setup_vertex0(ctx->vertices2[1], dstX + width, dstY, ctx->solid_color); /* 3rd vertex */ - setup_vertex0(vertices[2], dstX + width, dstY + height, + setup_vertex0(ctx->vertices2[2], dstX + width, dstY + height, ctx->solid_color); /* 4th vertex */ - setup_vertex0(vertices[3], dstX, dstY + height, + setup_vertex0(ctx->vertices2[3], dstX, dstY + height, ctx->solid_color); return pipe_user_buffer_create(ctx->pipe->screen, - vertices, - sizeof(vertices)); + ctx->vertices2, + sizeof(ctx->vertices2)); } static INLINE void @@ -189,7 +187,6 @@ setup_vertex_data1(struct exa_context *ctx, int srcX, int srcY, int maskX, int maskY, int dstX, int dstY, int width, int height) { - float vertices[4][2][4]; float s0, t0, s1, t1; struct pipe_texture *src = ctx->bound_textures[0]; @@ -199,21 +196,21 @@ setup_vertex_data1(struct exa_context *ctx, t1 = srcY + height / src->height[0]; /* 1st vertex */ - setup_vertex1(vertices[0], dstX, dstY, + setup_vertex1(ctx->vertices2[0], dstX, dstY, s0, t0); /* 2nd vertex */ - setup_vertex1(vertices[1], dstX + width, dstY, + setup_vertex1(ctx->vertices2[1], dstX + width, dstY, s1, t0); /* 3rd vertex */ - setup_vertex1(vertices[2], dstX + width, dstY + height, + setup_vertex1(ctx->vertices2[2], dstX + width, dstY + height, s1, t1); /* 4th vertex */ - setup_vertex1(vertices[3], dstX, dstY + height, + setup_vertex1(ctx->vertices2[3], dstX, dstY + height, s0, t1); return pipe_user_buffer_create(ctx->pipe->screen, - vertices, - sizeof(vertices)); + ctx->vertices2, + sizeof(ctx->vertices2)); } static struct pipe_buffer * @@ -222,24 +219,22 @@ setup_vertex_data_tex(struct exa_context *ctx, float s0, float t0, float s1, float t1, float z) { - float vertices[4][2][4]; - /* 1st vertex */ - setup_vertex1(vertices[0], x0, y0, + setup_vertex1(ctx->vertices2[0], x0, y0, s0, t0); /* 2nd vertex */ - setup_vertex1(vertices[1], x1, y0, + setup_vertex1(ctx->vertices2[1], x1, y0, s1, t0); /* 3rd vertex */ - setup_vertex1(vertices[2], x1, y1, + setup_vertex1(ctx->vertices2[2], x1, y1, s1, t1); /* 4th vertex */ - setup_vertex1(vertices[3], x0, y1, + setup_vertex1(ctx->vertices2[3], x0, y1, s0, t1); return pipe_user_buffer_create(ctx->pipe->screen, - vertices, - sizeof(vertices)); + ctx->vertices2, + sizeof(ctx->vertices2)); } @@ -269,7 +264,6 @@ setup_vertex_data2(struct exa_context *ctx, int srcX, int srcY, int maskX, int maskY, int dstX, int dstY, int width, int height) { - float vertices[4][3][4]; float st0[4], st1[4]; struct pipe_texture *src = ctx->bound_textures[0]; struct pipe_texture *mask = ctx->bound_textures[0]; @@ -285,21 +279,21 @@ setup_vertex_data2(struct exa_context *ctx, st1[3] = maskY + height / mask->height[0]; /* 1st vertex */ - setup_vertex2(vertices[0], dstX, dstY, + setup_vertex2(ctx->vertices3[0], dstX, dstY, st0[0], st0[1], st1[0], st1[1]); /* 2nd vertex */ - setup_vertex2(vertices[1], dstX + width, dstY, + setup_vertex2(ctx->vertices3[1], dstX + width, dstY, st0[2], st0[1], st1[2], st1[1]); /* 3rd vertex */ - setup_vertex2(vertices[2], dstX + width, dstY + height, + setup_vertex2(ctx->vertices3[2], dstX + width, dstY + height, st0[2], st0[3], st1[2], st1[3]); /* 4th vertex */ - setup_vertex2(vertices[3], dstX, dstY + height, + setup_vertex2(ctx->vertices3[3], dstX, dstY + height, st0[0], st0[3], st1[0], st1[3]); return pipe_user_buffer_create(ctx->pipe->screen, - vertices, - sizeof(vertices)); + ctx->vertices3, + sizeof(ctx->vertices3)); } boolean xorg_composite_accelerated(int op, @@ -687,24 +681,23 @@ void xorg_solid(struct exa_context *exa, { struct pipe_context *pipe = exa->pipe; struct pipe_buffer *buf = 0; - float vertices[4][2][4]; /* 1st vertex */ - setup_vertex0(vertices[0], x0, y0, + setup_vertex0(exa->vertices2[0], x0, y0, exa->solid_color); /* 2nd vertex */ - setup_vertex0(vertices[1], x1, y0, + setup_vertex0(exa->vertices2[1], x1, y0, exa->solid_color); /* 3rd vertex */ - setup_vertex0(vertices[2], x1, y1, + setup_vertex0(exa->vertices2[2], x1, y1, exa->solid_color); /* 4th vertex */ - setup_vertex0(vertices[3], x0, y1, + setup_vertex0(exa->vertices2[3], x0, y1, exa->solid_color); buf = pipe_user_buffer_create(exa->pipe->screen, - vertices, - sizeof(vertices)); + exa->vertices2, + sizeof(exa->vertices2)); if (buf) { diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h index 43949b04a4..65ae5b308c 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.h +++ b/src/gallium/state_trackers/xorg/xorg_exa.h @@ -32,8 +32,11 @@ struct exa_context struct exa_pixmap_priv *src; struct exa_pixmap_priv *dst; } copy; -}; + /* we should combine these two */ + float vertices2[4][2][4]; + float vertices3[4][2][4]; +}; struct exa_pixmap_priv { -- cgit v1.2.3 From 1ddb217d8ed976da7049255ad3c346d961b96901 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 23 Sep 2009 12:05:13 -0400 Subject: st/xorg: fix a typo it'd be too easy, eh --- src/gallium/state_trackers/xorg/xorg_exa.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h index 65ae5b308c..fe1f1cd103 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.h +++ b/src/gallium/state_trackers/xorg/xorg_exa.h @@ -35,7 +35,7 @@ struct exa_context /* we should combine these two */ float vertices2[4][2][4]; - float vertices3[4][2][4]; + float vertices3[4][3][4]; }; struct exa_pixmap_priv -- cgit v1.2.3 From a1fa770c01d913658900de1c267fb4c41bc6300d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 17 Sep 2009 19:18:39 +0100 Subject: gallium/include: update some comments --- src/gallium/include/pipe/p_state.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 2187f5b367..b59d6b7ae3 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -114,11 +114,29 @@ struct pipe_rasterizer_state * the vertex shader, clipping and viewport processing. Note that * a vertex shader is still needed though, to indicate the mapping * from vertex elements to fragment shader input semantics. + * + * XXX: considered for removal. */ unsigned bypass_vs_clip_and_viewport:1; - unsigned flatshade_first:1; /**< take color attribute from the first vertex of a primitive */ - unsigned gl_rasterization_rules:1; /**< enable tweaks for GL rasterization? */ + /** + * Use the first vertex of a primitive as the provoking vertex for + * flat shading. + */ + unsigned flatshade_first:1; + + /** + * When true, triangle rasterization uses (0.5, 0.5) pixel centers + * for determining pixel ownership. + * + * When false, triangle rasterization uses (0,0) pixel centers for + * determining pixel ownership. + * + * Triangle rasterization always uses a 'top,left' rule for pixel + * ownership, this just alters which point we consider the pixel + * center for that test. + */ + unsigned gl_rasterization_rules:1; float line_width; float point_size; /**< used when no per-vertex size */ -- cgit v1.2.3 From 84b956c29be7eb547130974df9ceb3d2f3354526 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 22 Sep 2009 15:35:05 -0600 Subject: softpipe: increase MAX_WIDTH/HEIGTH 4096 to match max texture size --- src/gallium/drivers/softpipe/sp_tile_cache.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index 1f9b8f1f4f..a524275a71 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -44,8 +44,8 @@ /** XXX move these */ -#define MAX_WIDTH 2048 -#define MAX_HEIGHT 2048 +#define MAX_WIDTH 4096 +#define MAX_HEIGHT 4096 struct softpipe_tile_cache -- cgit v1.2.3 From e41707becaffd604fedc885719e5b061a4a5b363 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 23 Sep 2009 10:50:38 -0600 Subject: softpipe: added max texture/surface size sanity check --- src/gallium/drivers/softpipe/sp_tile_cache.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index a524275a71..461cbb9f95 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -116,6 +116,12 @@ sp_create_tile_cache( struct pipe_screen *screen ) { struct softpipe_tile_cache *tc; uint pos; + int maxLevels, maxTexSize; + + /* sanity checking: max sure MAX_WIDTH/HEIGHT >= largest texture image */ + maxLevels = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS); + maxTexSize = 1 << (maxLevels - 1); + assert(MAX_WIDTH >= maxTexSize); tc = CALLOC_STRUCT( softpipe_tile_cache ); if (tc) { -- cgit v1.2.3 From b26f1df920a712da66c72f801e3292bf44ea9a83 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 23 Sep 2009 11:04:07 -0600 Subject: llvmpipe: increase MAX_WIDTH/HEIGHT to match max texture size --- src/gallium/drivers/llvmpipe/lp_tile_cache.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_tile_cache.h b/src/gallium/drivers/llvmpipe/lp_tile_cache.h index 6d8ba5ece7..936fc8f0fa 100644 --- a/src/gallium/drivers/llvmpipe/lp_tile_cache.h +++ b/src/gallium/drivers/llvmpipe/lp_tile_cache.h @@ -51,8 +51,8 @@ struct llvmpipe_cached_tile /** XXX move these */ -#define MAX_WIDTH 2048 -#define MAX_HEIGHT 2048 +#define MAX_WIDTH 4096 +#define MAX_HEIGHT 4096 struct llvmpipe_tile_cache -- cgit v1.2.3 From 5244ce786a3e115fac1675450c3df8ee11e20030 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 23 Sep 2009 11:04:57 -0600 Subject: llvmpipe: added max texture/surface size sanity check Carried over from softpipe driver. --- src/gallium/drivers/llvmpipe/lp_tile_cache.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_tile_cache.c b/src/gallium/drivers/llvmpipe/lp_tile_cache.c index 2e576e6039..73460106f3 100644 --- a/src/gallium/drivers/llvmpipe/lp_tile_cache.c +++ b/src/gallium/drivers/llvmpipe/lp_tile_cache.c @@ -48,6 +48,12 @@ struct llvmpipe_tile_cache * lp_create_tile_cache( struct pipe_screen *screen ) { struct llvmpipe_tile_cache *tc; + int maxLevels, maxTexSize; + + /* sanity checking: max sure MAX_WIDTH/HEIGHT >= largest texture image */ + maxLevels = screen->get_param(screen, PIPE_CAP_MAX_TEXTURE_2D_LEVELS); + maxTexSize = 1 << (maxLevels - 1); + assert(MAX_WIDTH >= maxTexSize); tc = CALLOC_STRUCT( llvmpipe_tile_cache ); if(!tc) -- cgit v1.2.3 From e2329f2795d48d11131e9ac105e7aa3fd2c229c1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 23 Sep 2009 11:35:33 -0600 Subject: softpipe: white-space/formatting fixes and updated comments --- src/gallium/drivers/softpipe/sp_tex_sample.c | 173 ++++++++++++++------------- 1 file changed, 87 insertions(+), 86 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 21031c11b8..f74b86b3c2 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -115,11 +115,9 @@ lerp_3d(float a, float b, float c, * \return integer texture index */ static void -wrap_nearest_repeat(const float s[4], unsigned size, - int icoord[4]) +wrap_nearest_repeat(const float s[4], unsigned size, int icoord[4]) { uint ch; - /* s limited to [0,1) */ /* i limited to [0,size-1] */ for (ch = 0; ch < 4; ch++) { @@ -130,8 +128,7 @@ wrap_nearest_repeat(const float s[4], unsigned size, static void -wrap_nearest_clamp(const float s[4], unsigned size, - int icoord[4]) +wrap_nearest_clamp(const float s[4], unsigned size, int icoord[4]) { uint ch; /* s limited to [0,1] */ @@ -148,8 +145,7 @@ wrap_nearest_clamp(const float s[4], unsigned size, static void -wrap_nearest_clamp_to_edge(const float s[4], unsigned size, - int icoord[4]) +wrap_nearest_clamp_to_edge(const float s[4], unsigned size, int icoord[4]) { uint ch; /* s limited to [min,max] */ @@ -168,8 +164,7 @@ wrap_nearest_clamp_to_edge(const float s[4], unsigned size, static void -wrap_nearest_clamp_to_border(const float s[4], unsigned size, - int icoord[4]) +wrap_nearest_clamp_to_border(const float s[4], unsigned size, int icoord[4]) { uint ch; /* s limited to [min,max] */ @@ -186,9 +181,9 @@ wrap_nearest_clamp_to_border(const float s[4], unsigned size, } } + static void -wrap_nearest_mirror_repeat(const float s[4], unsigned size, - int icoord[4]) +wrap_nearest_mirror_repeat(const float s[4], unsigned size, int icoord[4]) { uint ch; const float min = 1.0F / (2.0F * size); @@ -209,9 +204,9 @@ wrap_nearest_mirror_repeat(const float s[4], unsigned size, } } + static void -wrap_nearest_mirror_clamp(const float s[4], unsigned size, - int icoord[4]) +wrap_nearest_mirror_clamp(const float s[4], unsigned size, int icoord[4]) { uint ch; for (ch = 0; ch < 4; ch++) { @@ -227,9 +222,10 @@ wrap_nearest_mirror_clamp(const float s[4], unsigned size, } } + static void wrap_nearest_mirror_clamp_to_edge(const float s[4], unsigned size, - int icoord[4]) + int icoord[4]) { uint ch; /* s limited to [min,max] */ @@ -284,7 +280,6 @@ wrap_linear_repeat(const float s[4], unsigned size, int icoord0[4], int icoord1[4], float w[4]) { uint ch; - for (ch = 0; ch < 4; ch++) { float u = s[ch] * size - 0.5F; icoord0[ch] = REMAINDER(util_ifloor(u), size); @@ -293,6 +288,7 @@ wrap_linear_repeat(const float s[4], unsigned size, } } + static void wrap_linear_clamp(const float s[4], unsigned size, int icoord0[4], int icoord1[4], float w[4]) @@ -307,6 +303,7 @@ wrap_linear_clamp(const float s[4], unsigned size, } } + static void wrap_linear_clamp_to_edge(const float s[4], unsigned size, int icoord0[4], int icoord1[4], float w[4]) @@ -325,6 +322,7 @@ wrap_linear_clamp_to_edge(const float s[4], unsigned size, } } + static void wrap_linear_clamp_to_border(const float s[4], unsigned size, int icoord0[4], int icoord1[4], float w[4]) @@ -365,6 +363,7 @@ wrap_linear_mirror_repeat(const float s[4], unsigned size, } } + static void wrap_linear_mirror_clamp(const float s[4], unsigned size, int icoord0[4], int icoord1[4], float w[4]) @@ -383,6 +382,7 @@ wrap_linear_mirror_clamp(const float s[4], unsigned size, } } + static void wrap_linear_mirror_clamp_to_edge(const float s[4], unsigned size, int icoord0[4], int icoord1[4], float w[4]) @@ -405,6 +405,7 @@ wrap_linear_mirror_clamp_to_edge(const float s[4], unsigned size, } } + static void wrap_linear_mirror_clamp_to_border(const float s[4], unsigned size, int icoord0[4], int icoord1[4], float w[4]) @@ -433,8 +434,7 @@ wrap_linear_mirror_clamp_to_border(const float s[4], unsigned size, * Only a subset of wrap modes supported. */ static void -wrap_nearest_unorm_clamp(const float s[4], unsigned size, - int icoord[4]) +wrap_nearest_unorm_clamp(const float s[4], unsigned size, int icoord[4]) { uint ch; for (ch = 0; ch < 4; ch++) { @@ -443,11 +443,13 @@ wrap_nearest_unorm_clamp(const float s[4], unsigned size, } } -/* Handles clamp_to_edge and clamp_to_border: + +/** + * Handles clamp_to_edge and clamp_to_border: */ static void wrap_nearest_unorm_clamp_to_border(const float s[4], unsigned size, - int icoord[4]) + int icoord[4]) { uint ch; for (ch = 0; ch < 4; ch++) { @@ -462,7 +464,7 @@ wrap_nearest_unorm_clamp_to_border(const float s[4], unsigned size, */ static void wrap_linear_unorm_clamp(const float s[4], unsigned size, - int icoord0[4], int icoord1[4], float w[4]) + int icoord0[4], int icoord1[4], float w[4]) { uint ch; for (ch = 0; ch < 4; ch++) { @@ -474,9 +476,10 @@ wrap_linear_unorm_clamp(const float s[4], unsigned size, } } + static void -wrap_linear_unorm_clamp_to_border( const float s[4], unsigned size, - int icoord0[4], int icoord1[4], float w[4]) +wrap_linear_unorm_clamp_to_border(const float s[4], unsigned size, + int icoord0[4], int icoord1[4], float w[4]) { uint ch; for (ch = 0; ch < 4; ch++) { @@ -492,8 +495,6 @@ wrap_linear_unorm_clamp_to_border( const float s[4], unsigned size, - - /** * Examine the quad's texture coordinates to compute the partial * derivatives w.r.t X and Y, then compute lambda (level of detail). @@ -519,6 +520,7 @@ compute_lambda_1d(const struct sp_sampler_varient *samp, return lambda; } + static float compute_lambda_2d(const struct sp_sampler_varient *samp, const float s[QUAD_SIZE], @@ -576,7 +578,10 @@ compute_lambda_3d(const struct sp_sampler_varient *samp, } - +/** + * Compute lambda for a vertex texture sampler. + * Since there aren't derivatives to use, just return the LOD bias. + */ static float compute_lambda_vert(const struct sp_sampler_varient *samp, const float s[QUAD_SIZE], @@ -698,7 +703,7 @@ get_texel_quad_2d(const struct sp_sampler_varient *samp, */ static INLINE const float * get_texel_3d_no_border(const struct sp_sampler_varient *samp, - union tex_tile_address addr, int x, int y, int z) + union tex_tile_address addr, int x, int y, int z) { const struct softpipe_tex_cached_tile *tile; @@ -716,7 +721,7 @@ get_texel_3d_no_border(const struct sp_sampler_varient *samp, static INLINE const float * get_texel_3d(const struct sp_sampler_varient *samp, - union tex_tile_address addr, int x, int y, int z ) + union tex_tile_address addr, int x, int y, int z) { const struct pipe_texture *texture = samp->texture; unsigned level = addr.bits.level; @@ -750,11 +755,11 @@ pot_level_size(unsigned base_pot, unsigned level) */ static INLINE void img_filter_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE]) + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) { const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); unsigned j; @@ -768,7 +773,6 @@ img_filter_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler, addr.value = 0; addr.bits.level = samp->level; - for (j = 0; j < QUAD_SIZE; j++) { int c; @@ -788,18 +792,15 @@ img_filter_2d_linear_repeat_POT(struct tgsi_sampler *tgsi_sampler, /* Can we fetch all four at once: */ - if (x0 < xmax && y0 < ymax) - { + if (x0 < xmax && y0 < ymax) { get_texel_quad_2d_no_border_single_tile(samp, addr, x0, y0, tx); } - else - { + else { unsigned x1 = (x0 + 1) & (xpot - 1); unsigned y1 = (y0 + 1) & (ypot - 1); get_texel_quad_2d_no_border(samp, addr, x0, y0, x1, y1, tx); } - /* interpolate R, G, B, A */ for (c = 0; c < 4; c++) { rgba[c][j] = lerp_2d(xw, yw, @@ -896,6 +897,7 @@ img_filter_2d_nearest_clamp_POT(struct tgsi_sampler *tgsi_sampler, } } + static void img_filter_1d_nearest(struct tgsi_sampler *tgsi_sampler, const float s[QUAD_SIZE], @@ -969,20 +971,22 @@ img_filter_2d_nearest(struct tgsi_sampler *tgsi_sampler, } } -static inline union tex_tile_address face( union tex_tile_address addr, - unsigned face ) + +static inline union tex_tile_address +face(union tex_tile_address addr, unsigned face ) { addr.bits.face = face; return addr; } + static void img_filter_cube_nearest(struct tgsi_sampler *tgsi_sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE]) + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) { const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); const struct pipe_texture *texture = samp->texture; @@ -992,7 +996,6 @@ img_filter_cube_nearest(struct tgsi_sampler *tgsi_sampler, int x[4], y[4]; union tex_tile_address addr; - level0 = samp->level; width = texture->width[level0]; height = texture->height[level0]; @@ -1073,7 +1076,6 @@ img_filter_1d_linear(struct tgsi_sampler *tgsi_sampler, float xw[4]; /* weights */ union tex_tile_address addr; - level0 = samp->level; width = texture->width[level0]; @@ -1084,7 +1086,6 @@ img_filter_1d_linear(struct tgsi_sampler *tgsi_sampler, samp->linear_texcoord_s(s, width, x0, x1, xw); - for (j = 0; j < QUAD_SIZE; j++) { const float *tx0 = get_texel_2d(samp, addr, x0[j], 0); const float *tx1 = get_texel_2d(samp, addr, x1[j], 0); @@ -1114,7 +1115,6 @@ img_filter_2d_linear(struct tgsi_sampler *tgsi_sampler, float xw[4], yw[4]; /* weights */ union tex_tile_address addr; - level0 = samp->level; width = texture->width[level0]; height = texture->height[level0]; @@ -1147,11 +1147,11 @@ img_filter_2d_linear(struct tgsi_sampler *tgsi_sampler, static void img_filter_cube_linear(struct tgsi_sampler *tgsi_sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE]) + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) { const struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); const struct pipe_texture *texture = samp->texture; @@ -1162,7 +1162,6 @@ img_filter_cube_linear(struct tgsi_sampler *tgsi_sampler, float xw[4], yw[4]; /* weights */ union tex_tile_address addr; - level0 = samp->level; width = texture->width[level0]; height = texture->height[level0]; @@ -1251,18 +1250,13 @@ img_filter_3d_linear(struct tgsi_sampler *tgsi_sampler, } - - - - - static void mip_filter_linear(struct tgsi_sampler *tgsi_sampler, - const float s[QUAD_SIZE], - const float t[QUAD_SIZE], - const float p[QUAD_SIZE], - float lodbias, - float rgba[NUM_CHANNELS][QUAD_SIZE]) + const float s[QUAD_SIZE], + const float t[QUAD_SIZE], + const float p[QUAD_SIZE], + float lodbias, + float rgba[NUM_CHANNELS][QUAD_SIZE]) { struct sp_sampler_varient *samp = sp_sampler_varient(tgsi_sampler); const struct pipe_texture *texture = samp->texture; @@ -1301,7 +1295,6 @@ mip_filter_linear(struct tgsi_sampler *tgsi_sampler, } - static void mip_filter_nearest(struct tgsi_sampler *tgsi_sampler, const float s[QUAD_SIZE], @@ -1357,7 +1350,8 @@ mip_filter_none(struct tgsi_sampler *tgsi_sampler, -/* Specialized version of mip_filter_linear with hard-wired calls to +/** + * Specialized version of mip_filter_linear with hard-wired calls to * 2d lambda calculation and 2d_linear_repeat_POT img filters. */ static void @@ -1409,7 +1403,8 @@ mip_filter_linear_2d_linear_repeat_POT( -/* Compare stage in the little sampling pipeline. +/** + * Do shadow/depth comparisons. */ static void sample_compare(struct tgsi_sampler *tgsi_sampler, @@ -1426,7 +1421,6 @@ sample_compare(struct tgsi_sampler *tgsi_sampler, samp->mip_filter( tgsi_sampler, s, t, p, lodbias, rgba ); - /** * Compare texcoord 'p' (aka R) against texture value 'rgba[0]' * When we sampled the depth texture, the depth value was put into all @@ -1493,7 +1487,10 @@ sample_compare(struct tgsi_sampler *tgsi_sampler, } } -/* Calculate cube faces. + +/** + * Compute which cube face is referenced by each texcoord and put that + * info into the sampler faces[] array. Then sample the cube faces */ static void sample_cube(struct tgsi_sampler *tgsi_sampler, @@ -1586,8 +1583,8 @@ sample_cube(struct tgsi_sampler *tgsi_sampler, - -static wrap_nearest_func get_nearest_unorm_wrap( unsigned mode ) +static wrap_nearest_func +get_nearest_unorm_wrap(unsigned mode) { switch (mode) { case PIPE_TEX_WRAP_CLAMP: @@ -1602,7 +1599,8 @@ static wrap_nearest_func get_nearest_unorm_wrap( unsigned mode ) } -static wrap_nearest_func get_nearest_wrap( unsigned mode ) +static wrap_nearest_func +get_nearest_wrap(unsigned mode) { switch (mode) { case PIPE_TEX_WRAP_REPEAT: @@ -1627,7 +1625,9 @@ static wrap_nearest_func get_nearest_wrap( unsigned mode ) } } -static wrap_linear_func get_linear_unorm_wrap( unsigned mode ) + +static wrap_linear_func +get_linear_unorm_wrap(unsigned mode) { switch (mode) { case PIPE_TEX_WRAP_CLAMP: @@ -1641,7 +1641,9 @@ static wrap_linear_func get_linear_unorm_wrap( unsigned mode ) } } -static wrap_linear_func get_linear_wrap( unsigned mode ) + +static wrap_linear_func +get_linear_wrap(unsigned mode) { switch (mode) { case PIPE_TEX_WRAP_REPEAT: @@ -1666,7 +1668,9 @@ static wrap_linear_func get_linear_wrap( unsigned mode ) } } -static compute_lambda_func get_lambda_func( const union sp_sampler_key key ) + +static compute_lambda_func +get_lambda_func(const union sp_sampler_key key) { if (key.bits.processor == TGSI_PROCESSOR_VERTEX) return compute_lambda_vert; @@ -1685,9 +1689,11 @@ static compute_lambda_func get_lambda_func( const union sp_sampler_key key ) } } -static filter_func get_img_filter( const union sp_sampler_key key, - unsigned filter, - const struct pipe_sampler_state *sampler ) + +static filter_func +get_img_filter(const union sp_sampler_key key, + unsigned filter, + const struct pipe_sampler_state *sampler) { switch (key.bits.target) { case PIPE_TEXTURE_1D: @@ -1774,7 +1780,8 @@ sp_sampler_varient_destroy( struct sp_sampler_varient *samp ) } -/* Create a sampler varient for a given set of non-orthogonal state. Currently the +/** + * Create a sampler varient for a given set of non-orthogonal state. */ struct sp_sampler_varient * sp_create_sampler_varient( const struct pipe_sampler_state *sampler, @@ -1871,9 +1878,3 @@ sp_create_sampler_varient( const struct pipe_sampler_state *sampler, return samp; } - - - - - - -- cgit v1.2.3 From b4a40d10524a4be6a59805589ee4209ebdb1de4f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 23 Sep 2009 11:51:52 -0600 Subject: softpipe: replace macros with inline functions And update comments. --- src/gallium/drivers/softpipe/sp_tex_sample.c | 53 +++++++++++++++++----------- 1 file changed, 32 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index f74b86b3c2..2092a69740 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -46,13 +46,18 @@ /* - * Note, the FRAC macro has to work perfectly. Otherwise you'll sometimes - * see 1-pixel bands of improperly weighted linear-filtered textures. + * Return fractional part of 'f'. Used for computing interpolation weights. + * Need to be careful with negative values. + * Note, if this function isn't perfect you'll sometimes see 1-pixel bands + * of improperly weighted linear-filtered textures. * The tests/texwrap.c demo is a good test. - * Also note, FRAC(x) doesn't truly return the fractional part of x for x < 0. - * Instead, if x < 0 then FRAC(x) = 1 - true_frac(x). */ -#define FRAC(f) ((f) - util_ifloor(f)) +static INLINE float +frac(float f) +{ + return f - util_ifloor(f); +} + /** @@ -99,10 +104,16 @@ lerp_3d(float a, float b, float c, /** - * If A is a signed integer, A % B doesn't give the right value for A < 0 - * (in terms of texture repeat). Just casting to unsigned fixes that. + * Compute coord % size for repeat wrap modes. + * Note that if coord is a signed integer, coord % size doesn't give + * the right value for coord < 0 (in terms of texture repeat). Just + * casting to unsigned fixes that. */ -#define REMAINDER(A, B) ((unsigned) (A) % (unsigned) (B)) +static INLINE int +repeat(int coord, unsigned size) +{ + return (int) ((unsigned) coord % size); +} /** @@ -122,7 +133,7 @@ wrap_nearest_repeat(const float s[4], unsigned size, int icoord[4]) /* i limited to [0,size-1] */ for (ch = 0; ch < 4; ch++) { int i = util_ifloor(s[ch] * size); - icoord[ch] = REMAINDER(i, size); + icoord[ch] = repeat(i, size); } } @@ -282,9 +293,9 @@ wrap_linear_repeat(const float s[4], unsigned size, uint ch; for (ch = 0; ch < 4; ch++) { float u = s[ch] * size - 0.5F; - icoord0[ch] = REMAINDER(util_ifloor(u), size); - icoord1[ch] = REMAINDER(icoord0[ch] + 1, size); - w[ch] = FRAC(u); + icoord0[ch] = repeat(util_ifloor(u), size); + icoord1[ch] = repeat(icoord0[ch] + 1, size); + w[ch] = frac(u); } } @@ -299,7 +310,7 @@ wrap_linear_clamp(const float s[4], unsigned size, u = u * size - 0.5f; icoord0[ch] = util_ifloor(u); icoord1[ch] = icoord0[ch] + 1; - w[ch] = FRAC(u); + w[ch] = frac(u); } } @@ -318,7 +329,7 @@ wrap_linear_clamp_to_edge(const float s[4], unsigned size, icoord0[ch] = 0; if (icoord1[ch] >= (int) size) icoord1[ch] = size - 1; - w[ch] = FRAC(u); + w[ch] = frac(u); } } @@ -335,7 +346,7 @@ wrap_linear_clamp_to_border(const float s[4], unsigned size, u = u * size - 0.5f; icoord0[ch] = util_ifloor(u); icoord1[ch] = icoord0[ch] + 1; - w[ch] = FRAC(u); + w[ch] = frac(u); } } @@ -359,7 +370,7 @@ wrap_linear_mirror_repeat(const float s[4], unsigned size, icoord0[ch] = 0; if (icoord1[ch] >= (int) size) icoord1[ch] = size - 1; - w[ch] = FRAC(u); + w[ch] = frac(u); } } @@ -378,7 +389,7 @@ wrap_linear_mirror_clamp(const float s[4], unsigned size, u -= 0.5F; icoord0[ch] = util_ifloor(u); icoord1[ch] = icoord0[ch] + 1; - w[ch] = FRAC(u); + w[ch] = frac(u); } } @@ -401,7 +412,7 @@ wrap_linear_mirror_clamp_to_edge(const float s[4], unsigned size, icoord0[ch] = 0; if (icoord1[ch] >= (int) size) icoord1[ch] = size - 1; - w[ch] = FRAC(u); + w[ch] = frac(u); } } @@ -424,7 +435,7 @@ wrap_linear_mirror_clamp_to_border(const float s[4], unsigned size, u -= 0.5F; icoord0[ch] = util_ifloor(u); icoord1[ch] = icoord0[ch] + 1; - w[ch] = FRAC(u); + w[ch] = frac(u); } } @@ -472,7 +483,7 @@ wrap_linear_unorm_clamp(const float s[4], unsigned size, float u = CLAMP(s[ch] - 0.5F, 0.0f, (float) size - 1.0f); icoord0[ch] = util_ifloor(u); icoord1[ch] = icoord0[ch] + 1; - w[ch] = FRAC(u); + w[ch] = frac(u); } } @@ -489,7 +500,7 @@ wrap_linear_unorm_clamp_to_border(const float s[4], unsigned size, icoord1[ch] = icoord0[ch] + 1; if (icoord1[ch] > (int) size - 1) icoord1[ch] = size - 1; - w[ch] = FRAC(u); + w[ch] = frac(u); } } -- cgit v1.2.3 From 35af3f94a36d1850c8fbab3d1d0a23a904466429 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 23 Sep 2009 11:08:12 -0600 Subject: llvmpipe: move tile cache datatypes into .c file since they're private --- src/gallium/drivers/llvmpipe/lp_tile_cache.c | 37 ++++++++++++++++++++++++++++ src/gallium/drivers/llvmpipe/lp_tile_cache.h | 37 +--------------------------- 2 files changed, 38 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_tile_cache.c b/src/gallium/drivers/llvmpipe/lp_tile_cache.c index 73460106f3..0c06b659a1 100644 --- a/src/gallium/drivers/llvmpipe/lp_tile_cache.c +++ b/src/gallium/drivers/llvmpipe/lp_tile_cache.c @@ -44,6 +44,43 @@ #include "lp_tile_cache.h" +#define MAX_WIDTH 4096 +#define MAX_HEIGHT 4096 + + +enum llvmpipe_tile_status +{ + LP_TILE_STATUS_UNDEFINED = 0, + LP_TILE_STATUS_CLEAR = 1, + LP_TILE_STATUS_DEFINED = 2 +}; + + +struct llvmpipe_cached_tile +{ + enum llvmpipe_tile_status status; + + /** color in SOA format */ + uint8_t *color; +}; + + +struct llvmpipe_tile_cache +{ + struct pipe_screen *screen; + struct pipe_surface *surface; /**< the surface we're caching */ + struct pipe_transfer *transfer; + void *transfer_map; + + struct llvmpipe_cached_tile entries[MAX_WIDTH/TILE_SIZE][MAX_HEIGHT/TILE_SIZE]; + + uint8_t clear_color[4]; /**< for color bufs */ + uint clear_val; /**< for z+stencil, or packed color clear value */ + + struct llvmpipe_cached_tile *last_tile; /**< most recently retrieved tile */ +}; + + struct llvmpipe_tile_cache * lp_create_tile_cache( struct pipe_screen *screen ) { diff --git a/src/gallium/drivers/llvmpipe/lp_tile_cache.h b/src/gallium/drivers/llvmpipe/lp_tile_cache.h index 936fc8f0fa..161bab3799 100644 --- a/src/gallium/drivers/llvmpipe/lp_tile_cache.h +++ b/src/gallium/drivers/llvmpipe/lp_tile_cache.h @@ -33,42 +33,7 @@ #include "lp_tile_soa.h" -enum llvmpipe_tile_status -{ - LP_TILE_STATUS_UNDEFINED = 0, - LP_TILE_STATUS_CLEAR = 1, - LP_TILE_STATUS_DEFINED = 2 -}; - - -struct llvmpipe_cached_tile -{ - enum llvmpipe_tile_status status; - - /** color in SOA format */ - uint8_t *color; -}; - - -/** XXX move these */ -#define MAX_WIDTH 4096 -#define MAX_HEIGHT 4096 - - -struct llvmpipe_tile_cache -{ - struct pipe_screen *screen; - struct pipe_surface *surface; /**< the surface we're caching */ - struct pipe_transfer *transfer; - void *transfer_map; - - struct llvmpipe_cached_tile entries[MAX_WIDTH/TILE_SIZE][MAX_HEIGHT/TILE_SIZE]; - - uint8_t clear_color[4]; /**< for color bufs */ - uint clear_val; /**< for z+stencil, or packed color clear value */ - - struct llvmpipe_cached_tile *last_tile; /**< most recently retrieved tile */ -}; +struct llvmpipe_tile_cache; /* opaque */ extern struct llvmpipe_tile_cache * -- cgit v1.2.3 From be66ff51ec98cf583044b3e53a49c41edd803134 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 23 Sep 2009 14:40:45 +0100 Subject: st/mesa: trim calculated userbuffer size In get_array_bounds we were previously defining a user buffer sized as (nr_vertices * stride). The trouble is that if the vertex data occupies less than stride bytes, the extra tailing (stride - size) bytes may extend outside the memory actually allocated by the app and caused a segfault. To fix this, define a the buffer bounds to be: ptr .. ptr + (nr-1)*stride + element_size --- src/mesa/state_tracker/st_draw.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 225541a30b..11699d5b1b 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -317,23 +317,29 @@ get_arrays_bounds(const struct st_vertex_program *vp, const GLubyte **low, const GLubyte **high) { const GLubyte *low_addr = NULL; + const GLubyte *high_addr = NULL; GLuint attr; - GLint stride; for (attr = 0; attr < vp->num_inputs; attr++) { const GLuint mesaAttr = vp->index_to_input[attr]; + const GLint stride = arrays[mesaAttr]->StrideB; const GLubyte *start = arrays[mesaAttr]->Ptr; - stride = arrays[mesaAttr]->StrideB; + const unsigned sz = (arrays[mesaAttr]->Size * + _mesa_sizeof_type(arrays[mesaAttr]->Type)); + const GLubyte *end = start + (max_index * stride) + sz; + if (attr == 0) { low_addr = start; + high_addr = end; } else { low_addr = MIN2(low_addr, start); + high_addr = MAX2(high_addr, end); } } *low = low_addr; - *high = low_addr + (max_index + 1) * stride; + *high = high_addr; } -- cgit v1.2.3 From 2d2f49c91952e18f3362346e19b45c72b1f6db32 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Wed, 23 Sep 2009 14:20:59 +0300 Subject: r600: add support for CUBE textures, also TXP seems to work here ... --- src/mesa/drivers/dri/r600/r700_assembler.c | 306 ++++++++++++++++++++++++----- src/mesa/drivers/dri/r600/r700_assembler.h | 4 + 2 files changed, 263 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 81269350e4..dc25f3b418 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -213,7 +213,7 @@ GLboolean is_reduction_opcode(PVSDWORD* dest) { if (dest->dst.op3 == 0) { - if ( (dest->dst.opcode == SQ_OP2_INST_DOT4 || dest->dst.opcode == SQ_OP2_INST_DOT4_IEEE) ) + if ( (dest->dst.opcode == SQ_OP2_INST_DOT4 || dest->dst.opcode == SQ_OP2_INST_DOT4_IEEE || dest->dst.opcode == SQ_OP2_INST_CUBE) ) { return GL_TRUE; } @@ -350,6 +350,7 @@ unsigned int r700GetNumOperands(r700_AssemblerBase* pAsm) case SQ_OP2_INST_PRED_SETNE: case SQ_OP2_INST_DOT4: case SQ_OP2_INST_DOT4_IEEE: + case SQ_OP2_INST_CUBE: return 2; case SQ_OP2_INST_MOV: @@ -469,6 +470,9 @@ int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700 pAsm->number_of_inputs = 0; + pAsm->is_tex = GL_FALSE; + pAsm->need_tex_barrier = GL_FALSE; + return 0; } @@ -682,7 +686,7 @@ GLboolean add_tex_instruction(r700_AssemblerBase* pAsm, // If this clause constains any TEX instruction that is dependent on a previous instruction, // set the barrier bit - if( pAsm->pInstDeps[pAsm->uiCurInst].nDstDep > (-1) ) + if( pAsm->pInstDeps[pAsm->uiCurInst].nDstDep > (-1) || pAsm->need_tex_barrier == GL_TRUE ) { pAsm->cf_current_tex_clause_ptr->m_Word1.f.barrier = 0x1; } @@ -1279,42 +1283,48 @@ GLboolean tex_src(r700_AssemblerBase *pAsm) GLboolean bValidTexCoord = GL_FALSE; + if(pAsm->aArgSubst[1] >= 0) + { + bValidTexCoord = GL_TRUE; + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = pAsm->aArgSubst[1]; + } + else + { switch (pILInst->SrcReg[0].File) { - case PROGRAM_CONSTANT: - case PROGRAM_LOCAL_PARAM: - case PROGRAM_ENV_PARAM: - case PROGRAM_STATE_VAR: - bValidTexCoord = GL_TRUE; - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = pAsm->aArgSubst[1]; - break; - case PROGRAM_TEMPORARY: - bValidTexCoord = GL_TRUE; - pAsm->S[0].src.reg = pILInst->SrcReg[0].Index + - pAsm->starting_temp_register_number; - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - break; - case PROGRAM_INPUT: - switch (pILInst->SrcReg[0].Index) - { - case FRAG_ATTRIB_COL0: - case FRAG_ATTRIB_COL1: - case FRAG_ATTRIB_TEX0: - case FRAG_ATTRIB_TEX1: - case FRAG_ATTRIB_TEX2: - case FRAG_ATTRIB_TEX3: - case FRAG_ATTRIB_TEX4: - case FRAG_ATTRIB_TEX5: - case FRAG_ATTRIB_TEX6: - case FRAG_ATTRIB_TEX7: - bValidTexCoord = GL_TRUE; - pAsm->S[0].src.reg = - pAsm->uiFP_AttributeMap[pILInst->SrcReg[0].Index]; - pAsm->S[0].src.rtype = SRC_REG_INPUT; - break; - } - break; + case PROGRAM_CONSTANT: + case PROGRAM_LOCAL_PARAM: + case PROGRAM_ENV_PARAM: + case PROGRAM_STATE_VAR: + break; + case PROGRAM_TEMPORARY: + bValidTexCoord = GL_TRUE; + pAsm->S[0].src.reg = pILInst->SrcReg[0].Index + + pAsm->starting_temp_register_number; + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + break; + case PROGRAM_INPUT: + switch (pILInst->SrcReg[0].Index) + { + case FRAG_ATTRIB_COL0: + case FRAG_ATTRIB_COL1: + case FRAG_ATTRIB_TEX0: + case FRAG_ATTRIB_TEX1: + case FRAG_ATTRIB_TEX2: + case FRAG_ATTRIB_TEX3: + case FRAG_ATTRIB_TEX4: + case FRAG_ATTRIB_TEX5: + case FRAG_ATTRIB_TEX6: + case FRAG_ATTRIB_TEX7: + bValidTexCoord = GL_TRUE; + pAsm->S[0].src.reg = + pAsm->uiFP_AttributeMap[pILInst->SrcReg[0].Index]; + pAsm->S[0].src.rtype = SRC_REG_INPUT; + break; + } + break; + } } if(GL_TRUE == bValidTexCoord) @@ -2082,7 +2092,9 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) { is_single_scalar_operation = GL_FALSE; number_of_scalar_operations = 4; - + +/* current assembler doesn't do more than 1 register per source */ +#if 0 /* check read port, only very preliminary algorithm, not count in src0/1 same comp case and prev slot repeat case; also not count relative addressing. TODO: improve performance. */ @@ -2117,6 +2129,7 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) { bSplitInst = GL_TRUE; } +#endif } contiguous_slots_needed = 0; @@ -2337,9 +2350,7 @@ GLboolean next_ins(r700_AssemblerBase *pAsm) { struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); - if( GL_TRUE == IsTex(pILInst->Opcode) && - /* handle const moves to temp register */ - !(pAsm->D.dst.opcode == SQ_OP2_INST_MOV) ) + if( GL_TRUE == pAsm->is_tex ) { if (pILInst->TexSrcTarget == TEXTURE_RECT_INDEX) { if( GL_FALSE == assemble_tex_instruction(pAsm, GL_FALSE) ) @@ -2383,7 +2394,8 @@ GLboolean next_ins(r700_AssemblerBase *pAsm) pAsm->S[0].bits = 0; pAsm->S[1].bits = 0; pAsm->S[2].bits = 0; - + pAsm->is_tex = GL_FALSE; + pAsm->need_tex_barrier = GL_FALSE; return GL_TRUE; } @@ -3506,7 +3518,10 @@ GLboolean assemble_STP(r700_AssemblerBase *pAsm) GLboolean assemble_TEX(r700_AssemblerBase *pAsm) { GLboolean src_const; + GLboolean need_barrier = GL_FALSE; + checkop1(pAsm); + switch (pAsm->pILInst[pAsm->uiCurInst].SrcReg[0].File) { case PROGRAM_CONSTANT: @@ -3526,20 +3541,18 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) { if ( GL_FALSE == mov_temp(pAsm, 0) ) return GL_FALSE; + need_barrier = GL_TRUE; } switch (pAsm->pILInst[pAsm->uiCurInst].Opcode) { case OPCODE_TEX: - pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE; break; case OPCODE_TXB: radeon_error("do not support TXB yet\n"); return GL_FALSE; break; case OPCODE_TXP: - /* TODO : tex proj version : divid first 3 components by 4th */ - pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE; break; default: radeon_error("Internal error: bad texture op (not TEX)\n"); @@ -3547,6 +3560,190 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) break; } + if (pAsm->pILInst[pAsm->uiCurInst].Opcode == OPCODE_TXP) + { + GLuint tmp = gethelpr(pAsm); + pAsm->D.dst.opcode = SQ_OP2_INST_RECIP_IEEE; + pAsm->D.dst.math = 1; + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp; + pAsm->D.dst.writew = 1; + + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_W, SQ_SEL_W, SQ_SEL_W, SQ_SEL_W); + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + pAsm->D.dst.opcode = SQ_OP2_INST_MUL; + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp; + pAsm->D.dst.writex = 1; + pAsm->D.dst.writey = 1; + pAsm->D.dst.writez = 1; + pAsm->D.dst.writew = 0; + + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); + pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[1].src.reg = tmp; + setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_W); + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + pAsm->aArgSubst[1] = tmp; + need_barrier = GL_TRUE; + } + + if (pAsm->pILInst[pAsm->uiCurInst].TexSrcTarget == TEXTURE_CUBE_INDEX ) + { + GLuint tmp1 = gethelpr(pAsm); + GLuint tmp2 = gethelpr(pAsm); + + /* tmp1.xyzw = CUBE(R0.zzxy, R0.yxzz) */ + pAsm->D.dst.opcode = SQ_OP2_INST_CUBE; + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp1; + nomask_PVSDST(&(pAsm->D.dst)); + + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + + if( GL_FALSE == assemble_src(pAsm, 0, 1) ) + { + return GL_FALSE; + } + + swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_Z, SQ_SEL_Z, SQ_SEL_X, SQ_SEL_Y); + swizzleagain_PVSSRC(&(pAsm->S[1].src), SQ_SEL_Y, SQ_SEL_X, SQ_SEL_Z, SQ_SEL_Z); + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + /* tmp1.z = ABS(tmp1.z) dont have abs support in assembler currently + * have to do explicit instruction + */ + pAsm->D.dst.opcode = SQ_OP2_INST_MAX; + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp1; + pAsm->D.dst.writez = 1; + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp1; + noswizzle_PVSSRC(&(pAsm->S[0].src)); + pAsm->S[1].bits = pAsm->S[0].bits; + flipneg_PVSSRC(&(pAsm->S[1].src)); + + next_ins(pAsm); + + /* tmp1.z = RCP_e(|tmp1.z|) */ + pAsm->D.dst.opcode = SQ_OP2_INST_RECIP_IEEE; + pAsm->D.dst.math = 1; + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp1; + pAsm->D.dst.writez = 1; + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp1; + pAsm->S[0].src.swizzlex = SQ_SEL_Z; + + next_ins(pAsm); + + /* MULADD R0.x, R0.x, PS1, (0x3FC00000, 1.5f).x + * MULADD R0.y, R0.y, PS1, (0x3FC00000, 1.5f).x + * muladd has no writemask, have to use another temp + * also no support for imm constants, so add 1 here + */ + pAsm->D.dst.opcode = SQ_OP3_INST_MULADD; + pAsm->D.dst.op3 = 1; + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp2; + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp1; + noswizzle_PVSSRC(&(pAsm->S[0].src)); + setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); + pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[1].src.reg = tmp1; + setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_Z); + setaddrmode_PVSSRC(&(pAsm->S[2].src), ADDR_ABSOLUTE); + pAsm->S[2].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[2].src.reg = tmp1; + setswizzle_PVSSRC(&(pAsm->S[2].src), SQ_SEL_1); + + next_ins(pAsm); + + /* ADD the remaining .5 */ + pAsm->D.dst.opcode = SQ_OP2_INST_ADD; + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp2; + pAsm->D.dst.writex = 1; + pAsm->D.dst.writey = 1; + pAsm->D.dst.writez = 0; + pAsm->D.dst.writew = 0; + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp2; + noswizzle_PVSSRC(&(pAsm->S[0].src)); + setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); + pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[1].src.reg = 252; // SQ_ALU_SRC_0_5 + noswizzle_PVSSRC(&(pAsm->S[1].src)); + + next_ins(pAsm); + + /* tmp1.xy = temp2.xy */ + pAsm->D.dst.opcode = SQ_OP2_INST_MOV; + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp1; + pAsm->D.dst.writex = 1; + pAsm->D.dst.writey = 1; + pAsm->D.dst.writez = 0; + pAsm->D.dst.writew = 0; + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp2; + noswizzle_PVSSRC(&(pAsm->S[0].src)); + + next_ins(pAsm); + pAsm->aArgSubst[1] = tmp1; + need_barrier = GL_TRUE; + + } + + pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE; + pAsm->is_tex = GL_TRUE; + if ( GL_TRUE == need_barrier ) + { + pAsm->need_tex_barrier = GL_TRUE; + } // Set src1 to tex unit id pAsm->S[1].src.reg = pAsm->pILInst[pAsm->uiCurInst].TexSrcUnit; pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; @@ -3567,10 +3764,25 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) return GL_FALSE; } - if ( GL_FALSE == next_ins(pAsm) ) + if(pAsm->pILInst[pAsm->uiCurInst].Opcode == OPCODE_TXP) { - return GL_FALSE; + /* hopefully did swizzles before */ + noswizzle_PVSSRC(&(pAsm->S[0].src)); } + + if(pAsm->pILInst[pAsm->uiCurInst].TexSrcTarget == TEXTURE_CUBE_INDEX) + { + /* SAMPLE dst, tmp.yxwy, CUBE */ + pAsm->S[0].src.swizzlex = SQ_SEL_Y; + pAsm->S[0].src.swizzley = SQ_SEL_X; + pAsm->S[0].src.swizzlez = SQ_SEL_W; + pAsm->S[0].src.swizzlew = SQ_SEL_Y; + } + + if ( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } return GL_TRUE; } diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index 4e6e20011a..bd6df94ff9 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -374,6 +374,10 @@ typedef struct r700_AssemblerBase struct prog_instruction * pILInst; GLuint uiCurInst; GLboolean bR6xx; + /* helper to decide which type of instruction to assemble */ + GLboolean is_tex; + /* we inserted helper intructions and need barrier on next TEX ins */ + GLboolean need_tex_barrier; } r700_AssemblerBase; //Internal use -- cgit v1.2.3 From ec205bbd577a2619e4b1910527e5e5d1d7426ddb Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 23 Sep 2009 14:56:56 -0400 Subject: r600: fix some warnings --- src/mesa/drivers/dri/r600/r700_assembler.c | 6 +++--- src/mesa/drivers/dri/r600/r700_assembler.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index dc25f3b418..903b6968be 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -2078,9 +2078,9 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) GLuint contiguous_slots_needed; GLuint uNumSrc = r700GetNumOperands(pAsm); - GLuint channel_swizzle, j; - GLuint chan_counter[4] = {0, 0, 0, 0}; - PVSSRC * pSource[3]; + //GLuint channel_swizzle, j; + //GLuint chan_counter[4] = {0, 0, 0, 0}; + //PVSSRC * pSource[3]; GLboolean bSplitInst = GL_FALSE; if (1 == pAsm->D.dst.math) diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index bd6df94ff9..0d4283e4ba 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -423,6 +423,7 @@ GLboolean assemble_vfetch_instruction2(r700_AssemblerBase* pAsm, GLuint _signed, GLboolean normalize, VTX_FETCH_METHOD * pFetchMethod); +GLboolean cleanup_vfetch_instructions(r700_AssemblerBase* pAsm); GLuint gethelpr(r700_AssemblerBase* pAsm); void resethelpr(r700_AssemblerBase* pAsm); void checkop_init(r700_AssemblerBase* pAsm); -- cgit v1.2.3 From 53051b8cb5b4804e3eab21262c91ea59f1ea24b8 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 23 Sep 2009 15:02:19 -0400 Subject: r600: fix copy/paste typo --- src/mesa/drivers/dri/r600/r700_render.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index b58859b6ba..daa05f653d 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -855,7 +855,7 @@ static void r700FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer if(context->ind_buf.bHostIb != GL_TRUE) { - radeonAllocDmaRegion(&context->radeon, &r300->ind_buf.bo, + radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo, &context->ind_buf.bo_offset, size, 4); assert(context->ind_buf.bo->ptr != NULL); -- cgit v1.2.3 From 8abe77a75a681637cb00017711f5009601bcd348 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 23 Sep 2009 15:22:19 -0400 Subject: Finish removing glcore --- src/mesa/drivers/dri/glcore/Makefile | 84 ------------------------------------ 1 file changed, 84 deletions(-) delete mode 100644 src/mesa/drivers/dri/glcore/Makefile (limited to 'src') diff --git a/src/mesa/drivers/dri/glcore/Makefile b/src/mesa/drivers/dri/glcore/Makefile deleted file mode 100644 index ac7e1de928..0000000000 --- a/src/mesa/drivers/dri/glcore/Makefile +++ /dev/null @@ -1,84 +0,0 @@ -# src/mesa/drivers/dri/glcore/Makefile - -TOP = ../../../../.. -include $(TOP)/configs/current - -LIBNAME = glcore_dri.so - -DRIVER_SOURCES = glcore_driver.c \ - $(TOP)/src/mesa/drivers/common/driverfuncs.c \ - ../common/dri_util.c - -C_SOURCES = \ - $(DRIVER_SOURCES) \ - $(DRI_SOURCES) - - -# Include directories -INCLUDE_DIRS = \ - -I. \ - -I../common \ - -I../dri_client \ - -I../dri_client/imports \ - -Iserver \ - -I$(TOP)/include \ - -I$(DRM_SOURCE_PATH)/shared-core \ - -I$(TOP)/src/mesa \ - -I$(TOP)/src/mesa/main \ - -I$(TOP)/src/mesa/glapi \ - -I$(TOP)/src/mesa/math \ - -I$(TOP)/src/mesa/transform \ - -I$(TOP)/src/mesa/shader \ - -I$(TOP)/src/mesa/swrast \ - -I$(TOP)/src/mesa/swrast_setup - -# Core Mesa objects -MESA_MODULES = $(TOP)/src/mesa/libmesa.a - -# Libraries that the driver shared lib depends on -LIB_DEPS = -lm -lpthread -lc -# LIB_DEPS = -lGL -lm -lpthread -lc - - -ASM_SOURCES = - -OBJECTS = $(C_SOURCES:.c=.o) \ - $(ASM_SOURCES:.S=.o) - - -##### RULES ##### - -.c.o: - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(DEFINES) $< -o $@ - -.S.o: - $(CC) -c $(INCLUDE_DIRS) $(CFLAGS) $(DEFINES) $< -o $@ - - -##### TARGETS ##### - -default: depend $(TOP)/$(LIB_DIR)/$(LIBNAME) - - -$(TOP)/$(LIB_DIR)/$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(WINOBJ) Makefile - CC="$(CC)" CXX="$(CXX)" $(TOP)/bin/mklib -o $(LIBNAME) -noprefix -install $(TOP)/$(LIB_DIR) \ - $(OBJECTS) $(WINLIB) $(LIB_DEPS) $(WINOBJ) $(MESA_MODULES) - - -depend: $(C_SOURCES) $(ASM_SOURCES) - rm -f depend - touch depend - $(MKDEP) $(MKDEP_OPTIONS) $(INCLUDE_DIRS) $(C_SOURCES) $(ASM_SOURCES) \ - > /dev/null - - -# Emacs tags -tags: - etags `find . -name \*.[ch]` `find ../include` - - -clean: - -rm -f *.o server/*.o - - -include depend -- cgit v1.2.3 From ad935c3f4708417641dd3c257912ccce11485acc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 23 Sep 2009 12:54:14 -0600 Subject: swrast: fix typo in partial derivatives parameter passing --- src/mesa/swrast/s_fragprog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c index b71fb9eae9..144f78b024 100644 --- a/src/mesa/swrast/s_fragprog.c +++ b/src/mesa/swrast/s_fragprog.c @@ -108,7 +108,7 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4], lambda = _swrast_compute_lambda(texdx[0], texdy[0], /* ds/dx, ds/dy */ texdx[1], texdy[1], /* dt/dx, dt/dy */ - texdx[3], texdy[2], /* dq/dx, dq/dy */ + texdx[3], texdy[3], /* dq/dx, dq/dy */ texW, texH, texcoord[0], texcoord[1], texcoord[3], 1.0F / texcoord[3]) + lodBias; -- cgit v1.2.3 From 890f37d4d96471a5c3d8ae286dfc13ad18ff78e5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 23 Sep 2009 13:34:30 -0600 Subject: mesa: don't bias LOD in shader interpreter; do it in swrast --- src/mesa/shader/prog_execute.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c index 68a59350a1..7cb463cd07 100644 --- a/src/mesa/shader/prog_execute.c +++ b/src/mesa/shader/prog_execute.c @@ -1527,17 +1527,12 @@ _mesa_execute_program(GLcontext * ctx, case OPCODE_TXB: /* GL_ARB_fragment_program only */ /* Texel lookup with LOD bias */ { - 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); /* texcoord[3] is the bias to add to lambda */ - lodBias = texUnit->LodBias + texcoord[3]; - if (texUnit->_Current) { - lodBias += texUnit->_Current->LodBias; - } + lodBias = texcoord[3]; fetch_texel(ctx, machine, inst, texcoord, lodBias, color); -- cgit v1.2.3 From 2acd5de22651a3461c0576107c8e8fab1f01469a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 23 Sep 2009 13:35:03 -0600 Subject: swrast: add lod bias when texture sampling Mostly fixes progs/demos/lodbias when MESA_TEX_PROG=1. But the LOD still seems off by -1 or so. May be an issue with the params passed to _swrast_compute_lambda() --- src/mesa/swrast/s_fragprog.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c index 144f78b024..b326acf3e3 100644 --- a/src/mesa/swrast/s_fragprog.c +++ b/src/mesa/swrast/s_fragprog.c @@ -89,6 +89,8 @@ fetch_texel_lod( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lambda, * Fetch a texel with the given partial derivatives to compute a level * of detail in the mipmap. * Called via machine->FetchTexelDeriv() + * \param lodBias the lod bias which may be specified by a TXB instruction, + * otherwise zero. */ static void fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4], @@ -96,7 +98,8 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4], GLfloat lodBias, GLuint unit, GLfloat color[4] ) { SWcontext *swrast = SWRAST_CONTEXT(ctx); - const struct gl_texture_object *texObj = ctx->Texture.Unit[unit]._Current; + const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; + const struct gl_texture_object *texObj = texUnit->_Current; if (texObj) { const struct gl_texture_image *texImg = @@ -111,7 +114,9 @@ fetch_texel_deriv( GLcontext *ctx, const GLfloat texcoord[4], texdx[3], texdy[3], /* dq/dx, dq/dy */ texW, texH, texcoord[0], texcoord[1], texcoord[3], - 1.0F / texcoord[3]) + lodBias; + 1.0F / texcoord[3]); + + lambda += lodBias + texUnit->LodBias + texObj->LodBias; lambda = CLAMP(lambda, texObj->MinLod, texObj->MaxLod); -- cgit v1.2.3 From 8a2b0f6415654c03cd399e59b0946ab90dc44331 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Wed, 23 Sep 2009 16:10:20 -0400 Subject: r600 : add hw index buffer draw support. --- src/mesa/drivers/dri/r600/r700_render.c | 73 +++++++++++++++++++++++++++------ 1 file changed, 61 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index daa05f653d..1f7a76e538 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -262,6 +262,16 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *vb = &tnl->vb; + GLboolean bUseDrawIndex; + if( (NULL != context->ind_buf.bo) && (GL_TRUE != context->ind_buf.bHostIb) ) + { + bUseDrawIndex = GL_TRUE; + } + else + { + bUseDrawIndex = GL_FALSE; + } + type = r700PrimitiveType(prim); num_indices = r700NumVerts(end - start, prim); @@ -272,10 +282,20 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim if (type < 0 || num_indices <= 0) return; - total_emit = 3 /* VGT_PRIMITIVE_TYPE */ - + 2 /* VGT_INDEX_TYPE */ - + 2 /* NUM_INSTANCES */ + if(GL_TRUE == bUseDrawIndex) + { + total_emit = 3 /* VGT_PRIMITIVE_TYPE */ + + 2 /* VGT_INDEX_TYPE */ + + 2 /* NUM_INSTANCES */ + + 5+2; /* DRAW_INDEX */ + } + else + { + total_emit = 3 /* VGT_PRIMITIVE_TYPE */ + + 2 /* VGT_INDEX_TYPE */ + + 2 /* NUM_INSTANCES */ + num_indices + 3; /* DRAW_INDEX_IMMD */ + } BEGIN_BATCH_NO_AUTOSTATE(total_emit); // prim @@ -287,6 +307,15 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim // index type SETfield(vgt_index_type, DI_INDEX_SIZE_32_BIT, INDEX_TYPE_shift, INDEX_TYPE_mask); + + if(GL_TRUE == bUseDrawIndex) + { + if(GL_TRUE != context->ind_buf.is_32bit) + { + SETfield(vgt_index_type, DI_INDEX_SIZE_16_BIT, INDEX_TYPE_shift, INDEX_TYPE_mask); + } + } + R600_OUT_BATCH(CP_PACKET3(R600_IT_INDEX_TYPE, 0)); R600_OUT_BATCH(vgt_index_type); @@ -296,12 +325,36 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim // draw packet vgt_num_indices = num_indices; - SETfield(vgt_draw_initiator, DI_SRC_SEL_IMMEDIATE, SOURCE_SELECT_shift, SOURCE_SELECT_mask); + + if(GL_TRUE == bUseDrawIndex) + { + SETfield(vgt_draw_initiator, DI_SRC_SEL_DMA, SOURCE_SELECT_shift, SOURCE_SELECT_mask); + } + else + { + SETfield(vgt_draw_initiator, DI_SRC_SEL_IMMEDIATE, SOURCE_SELECT_shift, SOURCE_SELECT_mask); + } + SETfield(vgt_draw_initiator, DI_MAJOR_MODE_0, MAJOR_MODE_shift, MAJOR_MODE_mask); - R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX_IMMD, (num_indices + 1))); - R600_OUT_BATCH(vgt_num_indices); - R600_OUT_BATCH(vgt_draw_initiator); + if(GL_TRUE == bUseDrawIndex) + { + R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX, 3)); + R600_OUT_BATCH(context->ind_buf.bo_offset); + R600_OUT_BATCH(0); + R600_OUT_BATCH(vgt_num_indices); + R600_OUT_BATCH(vgt_draw_initiator); + R600_OUT_BATCH_RELOC(context->ind_buf.bo_offset, + context->ind_buf.bo, + context->ind_buf.bo_offset, + RADEON_GEM_DOMAIN_GTT, 0, 0); + } + else + { + R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX_IMMD, (num_indices + 1))); + R600_OUT_BATCH(vgt_num_indices); + R600_OUT_BATCH(vgt_draw_initiator); + } if(NULL == context->ind_buf.bo) { @@ -340,10 +393,6 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim } } } - else - { - /* TODO : hw ib draw */ - } } END_BATCH(); @@ -899,7 +948,7 @@ static void r700SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer return; } - context->ind_buf.bHostIb = GL_TRUE; + context->ind_buf.bHostIb = GL_FALSE; #if MESA_BIG_ENDIAN if (mesa_ind_buf->type == GL_UNSIGNED_INT) -- cgit v1.2.3 From 20e77382935b24e9e2be89cd2b686fa2f1f67635 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 23 Sep 2009 16:54:12 -0400 Subject: r600: fix r700PredictRenderSize for draw prims path --- src/mesa/drivers/dri/r600/r700_render.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index 1f7a76e538..bdf0bfc0e4 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -402,12 +402,10 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim /* start 3d, idle, cb/db flush */ #define PRE_EMIT_STATE_BUFSZ 10 + 5 + 14 -static GLuint r700PredictRenderSize(GLcontext* ctx) +static GLuint r700PredictRenderSize(GLcontext* ctx, GLuint nr_prims) { context_t *context = R700_CONTEXT(ctx); - TNLcontext *tnl = TNL_CONTEXT(ctx); struct r700_vertex_program *vp = context->selected_vp; - struct vertex_buffer *vb = &tnl->vb; GLboolean flushed; GLuint dwords, i; GLuint state_size; @@ -415,8 +413,15 @@ static GLuint r700PredictRenderSize(GLcontext* ctx) context->radeon.tcl.aos_count = _mesa_bitcount(vp->mesa_program->Base.InputsRead); dwords = PRE_EMIT_STATE_BUFSZ; - for (i = 0; i < vb->PrimitiveCount; i++) - dwords += vb->Primitive[i].count + 10; + if (nr_prims) + dwords += nr_prims * 14; + else { + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *vb = &tnl->vb; + + for (i = 0; i < vb->PrimitiveCount; i++) + dwords += vb->Primitive[i].count + 10; + } state_size = radeonCountStateEmitSize(&context->radeon); flushed = rcommonEnsureCmdBufSpace(&context->radeon, dwords + state_size, __FUNCTION__); @@ -456,7 +461,7 @@ static GLboolean r700RunRender(GLcontext * ctx, r700SetupFragmentProgram(ctx); r600UpdateTextureState(ctx); - GLuint emit_end = r700PredictRenderSize(ctx) + GLuint emit_end = r700PredictRenderSize(ctx, 0) + context->radeon.cmdbuf.cs->cdw; r700SetupStreams(ctx); @@ -1044,7 +1049,7 @@ static GLboolean r700TryDrawPrims(GLcontext *ctx, r600UpdateTextureState(ctx); - GLuint emit_end = r700PredictRenderSize(ctx) + GLuint emit_end = r700PredictRenderSize(ctx, nr_prims) + context->radeon.cmdbuf.cs->cdw; r700SetupIndexBuffer(ctx, ib); -- cgit v1.2.3 From 84c7afd9e0f2df72d90dd82d38384c4f2f45173e Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 19 Sep 2009 18:45:59 +0200 Subject: r300: fallback to software rendering if we are out of free texcoords Fixes #22741 --- src/mesa/drivers/dri/r300/r300_fragprog_common.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c index 469c278b51..0bdc90b4a8 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c @@ -99,8 +99,8 @@ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler, { int i; + fp->wpos_attr = FRAG_ATTRIB_MAX; if (!(compiler->Base.Program.InputsRead & FRAG_BIT_WPOS)) { - fp->wpos_attr = FRAG_ATTRIB_MAX; return; } @@ -112,6 +112,13 @@ static void insert_WPOS_trailer(struct r300_fragment_program_compiler *compiler, } } + /* No free texcoord found, fall-back to software rendering */ + if (fp->wpos_attr == FRAG_ATTRIB_MAX) + { + compiler->Base.Error = 1; + return; + } + rc_transform_fragment_wpos(&compiler->Base, FRAG_ATTRIB_WPOS, fp->wpos_attr); } @@ -127,8 +134,8 @@ static void rewriteFog(struct r300_fragment_program_compiler *compiler, struct r struct prog_src_register src; int i; + fp->fog_attr = FRAG_ATTRIB_MAX; if (!(compiler->Base.Program.InputsRead & FRAG_BIT_FOGC)) { - fp->fog_attr = FRAG_ATTRIB_MAX; return; } @@ -140,6 +147,13 @@ static void rewriteFog(struct r300_fragment_program_compiler *compiler, struct r } } + /* No free texcoord found, fall-back to software rendering */ + if (fp->fog_attr == FRAG_ATTRIB_MAX) + { + compiler->Base.Error = 1; + return; + } + memset(&src, 0, sizeof(src)); src.File = PROGRAM_INPUT; src.Index = fp->fog_attr; -- cgit v1.2.3 From 1bf0651d9b58a5c150fcf37016ae1bda425bb05a Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 23 Sep 2009 19:42:07 -0400 Subject: r600: fix up ordering of functions in draw prims path Shaders and IB need to be updated and allocated before calling validatebuffers. --- src/mesa/drivers/dri/r600/r700_render.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index bdf0bfc0e4..bbe364bc6a 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -1019,7 +1019,6 @@ static GLboolean r700TryDrawPrims(GLcontext *ctx, context_t *context = R700_CONTEXT(ctx); radeonContextPtr radeon = &context->radeon; GLuint i, id = 0; - GLboolean bValidedbuffer; struct radeon_renderbuffer *rrb; if (ctx->NewState) @@ -1027,7 +1026,13 @@ static GLboolean r700TryDrawPrims(GLcontext *ctx, _mesa_update_state( ctx ); } - bValidedbuffer = r600ValidateBuffers(ctx); + _tnl_UpdateFixedFunctionProgram(ctx); + r700SetVertexFormat(ctx, arrays, max_index + 1); + r700SetupIndexBuffer(ctx, ib); + /* shaders need to be updated before buffers are validated */ + r700UpdateShaders2(ctx); + if (!r600ValidateBuffers(ctx)) + return GL_FALSE; /* always emit CB base to prevent * lock ups on some chips. @@ -1036,34 +1041,28 @@ static GLboolean r700TryDrawPrims(GLcontext *ctx, /* mark vtx as dirty since it changes per-draw */ R600_STATECHANGE(context, vtx); - _tnl_UpdateFixedFunctionProgram(ctx); - r700SetVertexFormat(ctx, arrays, max_index + 1); - r700SetupStreams2(ctx, arrays, max_index + 1); - r700UpdateShaders2(ctx); - r700SetScissor(context); - r700SetupVertexProgram(ctx); - r700SetupFragmentProgram(ctx); - r600UpdateTextureState(ctx); GLuint emit_end = r700PredictRenderSize(ctx, nr_prims) + context->radeon.cmdbuf.cs->cdw; - r700SetupIndexBuffer(ctx, ib); + r700SetupStreams2(ctx, arrays, max_index + 1); radeonEmitState(radeon); - for (i = 0; i < nr_prims; ++i) + radeon_debug_add_indent(); + for (i = 0; i < nr_prims; ++i) { - r700RunRenderPrimitive(ctx, - prim[i].start, - prim[i].start + prim[i].count, + r700RunRenderPrimitive(ctx, + prim[i].start, + prim[i].start + prim[i].count, prim[i].mode); } - + radeon_debug_remove_indent(); + /* Flush render op cached for last several quads. */ r700WaitForIdleClean(context); -- cgit v1.2.3 From 622bdecabd73167d2f2f3aff0e223a8c64433f99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 24 Sep 2009 12:36:11 +0100 Subject: mesa: Fix missing finite symbol error on Windows. Caused by some weird logic regarding the __WIN32__ define which made the finite definition dependent on the header include order. --- src/mesa/main/compiler.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h index 9319505a75..380663ec97 100644 --- a/src/mesa/main/compiler.h +++ b/src/mesa/main/compiler.h @@ -107,8 +107,7 @@ extern "C" { /** * finite macro. */ -#if defined(_WIN32) && !defined(__WIN32__) && !defined(__CYGWIN__) && !defined(BUILD_FOR_SNAP) -# define __WIN32__ +#if defined(_MSC_VER) # define finite _finite #elif defined(__WATCOMC__) # define finite _finite -- cgit v1.2.3 From 4e5ed05b025b9b6a1a6dabba72fce3d918e77044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 24 Sep 2009 13:08:34 +0100 Subject: wgl: DWM integration. --- src/gallium/state_trackers/wgl/opengl32.def | 1 + src/gallium/state_trackers/wgl/opengl32.mingw.def | 1 + src/gallium/state_trackers/wgl/stw_device.c | 52 +++--- src/gallium/state_trackers/wgl/stw_device.h | 4 + src/gallium/state_trackers/wgl/stw_framebuffer.c | 194 ++++++++++++++++++---- src/gallium/state_trackers/wgl/stw_framebuffer.h | 16 ++ src/gallium/state_trackers/wgl/stw_icd.h | 114 ++++++++++++- src/gallium/state_trackers/wgl/stw_pixelformat.c | 7 +- src/gallium/state_trackers/wgl/stw_pixelformat.h | 4 + src/gallium/state_trackers/wgl/stw_winsys.h | 54 +++++- 10 files changed, 380 insertions(+), 67 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/wgl/opengl32.def b/src/gallium/state_trackers/wgl/opengl32.def index 596417ed84..5daa6ddd41 100644 --- a/src/gallium/state_trackers/wgl/opengl32.def +++ b/src/gallium/state_trackers/wgl/opengl32.def @@ -376,6 +376,7 @@ EXPORTS DrvDescribePixelFormat DrvGetLayerPaletteEntries DrvGetProcAddress + DrvPresentBuffers DrvRealizeLayerPalette DrvReleaseContext DrvSetCallbackProcs diff --git a/src/gallium/state_trackers/wgl/opengl32.mingw.def b/src/gallium/state_trackers/wgl/opengl32.mingw.def index 1f03ea3b37..6ebb31a6f1 100644 --- a/src/gallium/state_trackers/wgl/opengl32.mingw.def +++ b/src/gallium/state_trackers/wgl/opengl32.mingw.def @@ -375,6 +375,7 @@ EXPORTS DrvDescribePixelFormat = DrvDescribePixelFormat@16 DrvGetLayerPaletteEntries = DrvGetLayerPaletteEntries@20 DrvGetProcAddress = DrvGetProcAddress@4 + DrvPresentBuffers = DrvPresentBuffers@8 DrvRealizeLayerPalette = DrvRealizeLayerPalette@12 DrvReleaseContext = DrvReleaseContext@4 DrvSetCallbackProcs = DrvSetCallbackProcs@8 diff --git a/src/gallium/state_trackers/wgl/stw_device.c b/src/gallium/state_trackers/wgl/stw_device.c index a1a5b892ef..985b8f0456 100644 --- a/src/gallium/state_trackers/wgl/stw_device.c +++ b/src/gallium/state_trackers/wgl/stw_device.c @@ -29,6 +29,7 @@ #include "glapi/glthread.h" #include "util/u_debug.h" +#include "util/u_math.h" #include "pipe/p_screen.h" #include "state_tracker/st_public.h" @@ -62,38 +63,28 @@ stw_flush_frontbuffer(struct pipe_screen *screen, struct pipe_surface *surface, void *context_private ) { - const struct stw_winsys *stw_winsys = stw_dev->stw_winsys; HDC hdc = (HDC)context_private; struct stw_framebuffer *fb; fb = stw_framebuffer_from_hdc( hdc ); - /* fb can be NULL if window was destroyed already */ - if (fb) { + if (!fb) { + /* fb can be NULL if window was destroyed already */ + return; + } + #if DEBUG - { - struct pipe_surface *surface2; - - if(!st_get_framebuffer_surface( fb->stfb, ST_SURFACE_FRONT_LEFT, &surface2 )) - assert(0); - else - assert(surface2 == surface); - } -#endif + { + /* ensure that a random surface was not passed to us */ + struct pipe_surface *surface2; -#ifdef DEBUG - if(stw_dev->trace_running) { - screen = trace_screen(screen)->screen; - surface = trace_surface(surface)->surface; - } -#endif - } - - stw_winsys->flush_frontbuffer(screen, surface, hdc); - - if(fb) { - stw_framebuffer_update(fb); - stw_framebuffer_release(fb); + if(!st_get_framebuffer_surface( fb->stfb, ST_SURFACE_FRONT_LEFT, &surface2 )) + assert(0); + else + assert(surface2 == surface); } +#endif + + stw_framebuffer_present_locked(hdc, fb, ST_SURFACE_FRONT_LEFT); } @@ -126,6 +117,9 @@ stw_init(const struct stw_winsys *stw_winsys) if(!screen) goto error1; + if(stw_winsys->get_adapter_luid) + stw_winsys->get_adapter_luid(screen, &stw_dev->AdapterLuid); + #ifdef DEBUG stw_dev->screen = trace_screen_create(screen); stw_dev->trace_running = stw_dev->screen != screen ? TRUE : FALSE; @@ -229,6 +223,14 @@ DrvSetCallbackProcs( INT nProcs, PROC *pProcs ) { + size_t size; + + if (stw_dev == NULL) + return; + + size = MIN2(nProcs * sizeof *pProcs, sizeof stw_dev->callbacks); + memcpy(&stw_dev->callbacks, pProcs, size); + return; } diff --git a/src/gallium/state_trackers/wgl/stw_device.h b/src/gallium/state_trackers/wgl/stw_device.h index 5e4e3d6180..0bf3b0da82 100644 --- a/src/gallium/state_trackers/wgl/stw_device.h +++ b/src/gallium/state_trackers/wgl/stw_device.h @@ -52,10 +52,14 @@ struct stw_device boolean trace_running; #endif + LUID AdapterLuid; + struct stw_pixelformat_info pixelformats[STW_MAX_PIXELFORMATS]; unsigned pixelformat_count; unsigned pixelformat_extended_count; + GLCALLBACKTABLE callbacks; + pipe_mutex ctx_mutex; struct handle_table *ctx_table; diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.c b/src/gallium/state_trackers/wgl/stw_framebuffer.c index 123b841c8f..8a3e11b6b4 100644 --- a/src/gallium/state_trackers/wgl/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c @@ -1,8 +1,8 @@ /************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * + * Copyright 2008-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 @@ -10,19 +10,19 @@ * 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 + * 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 @@ -83,6 +83,9 @@ stw_framebuffer_destroy_locked( *link = fb->next; fb->next = NULL; + if(fb->shared_surface) + stw_dev->stw_winsys->shared_surface_close(stw_dev->screen, fb->shared_surface); + st_unreference_framebuffer(fb->stfb); pipe_mutex_unlock( fb->mutex ); @@ -106,13 +109,18 @@ static INLINE void stw_framebuffer_get_size( struct stw_framebuffer *fb ) { unsigned width, height; - RECT rect; + RECT client_rect; + RECT window_rect; + POINT client_pos; assert(fb->hWnd); - GetClientRect( fb->hWnd, &rect ); - width = rect.right - rect.left; - height = rect.bottom - rect.top; + /* Get the client area size. */ + GetClientRect( fb->hWnd, &client_rect ); + assert(client_rect.left == 0); + assert(client_rect.top == 0); + width = client_rect.right - client_rect.left; + height = client_rect.bottom - client_rect.top; if(width < 1) width = 1; @@ -124,6 +132,31 @@ stw_framebuffer_get_size( struct stw_framebuffer *fb ) fb->width = width; fb->height = height; } + + client_pos.x = 0; + client_pos.y = 0; + ClientToScreen(fb->hWnd, &client_pos); + + GetWindowRect(fb->hWnd, &window_rect); + + fb->client_rect.left = client_pos.x - window_rect.left; + fb->client_rect.top = client_pos.y - window_rect.top; + fb->client_rect.right = fb->client_rect.left + fb->width; + fb->client_rect.bottom = fb->client_rect.top + fb->height; + +#if 0 + debug_printf("\n"); + debug_printf("%s: client_position = (%i, %i)\n", + __FUNCTION__, client_pos.x, client_pos.y); + debug_printf("%s: window_rect = (%i, %i) - (%i, %i)\n", + __FUNCTION__, + window_rect.left, window_rect.top, + window_rect.right, window_rect.bottom); + debug_printf("%s: client_rect = (%i, %i) - (%i, %i)\n", + __FUNCTION__, + fb->client_rect.left, fb->client_rect.top, + fb->client_rect.right, fb->client_rect.bottom); +#endif } @@ -155,6 +188,7 @@ stw_call_window_proc( * can be masked out by the application. */ LPWINDOWPOS lpWindowPos = (LPWINDOWPOS)pParams->lParam; if((lpWindowPos->flags & SWP_SHOWWINDOW) || + !(lpWindowPos->flags & SWP_NOMOVE) || !(lpWindowPos->flags & SWP_NOSIZE)) { fb = stw_framebuffer_from_hwnd( pParams->hwnd ); if(fb) { @@ -436,34 +470,23 @@ stw_pixelformat_get( BOOL APIENTRY -DrvSwapBuffers( - HDC hdc ) +DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data) { struct stw_framebuffer *fb; struct pipe_screen *screen; struct pipe_surface *surface; + unsigned surface_index; + BOOL ret = FALSE; fb = stw_framebuffer_from_hdc( hdc ); if (fb == NULL) return FALSE; - if (!(fb->pfi->pfd.dwFlags & PFD_DOUBLEBUFFER)) { - stw_framebuffer_release(fb); - return TRUE; - } - - /* If we're swapping the buffer associated with the current context - * we have to flush any pending rendering commands first. - */ - st_notify_swapbuffers( fb->stfb ); - screen = stw_dev->screen; - - if(!st_get_framebuffer_surface( fb->stfb, ST_SURFACE_BACK_LEFT, &surface )) { - /* FIXME: this shouldn't happen, but does on glean */ - stw_framebuffer_release(fb); - return FALSE; - } + + surface_index = (unsigned)(uintptr_t)data->pPrivateData; + if(!st_get_framebuffer_surface( fb->stfb, surface_index, &surface )) + goto fail; #ifdef DEBUG if(stw_dev->trace_running) { @@ -472,12 +495,117 @@ DrvSwapBuffers( } #endif - stw_dev->stw_winsys->flush_frontbuffer( screen, surface, hdc ); - + if(data->hSharedSurface != fb->hSharedSurface) { + if(fb->shared_surface) { + stw_dev->stw_winsys->shared_surface_close(screen, fb->shared_surface); + fb->shared_surface = NULL; + } + + fb->hSharedSurface = data->hSharedSurface; + + if(data->hSharedSurface && + stw_dev->stw_winsys->shared_surface_open) { + fb->shared_surface = stw_dev->stw_winsys->shared_surface_open(screen, fb->hSharedSurface); + } + } + + if(fb->shared_surface) { + stw_dev->stw_winsys->compose(screen, + surface, + fb->shared_surface, + &fb->client_rect, + data->PresentHistoryToken); + } + else { + stw_dev->stw_winsys->present( screen, surface, hdc ); + } + + ret = TRUE; + +fail: + stw_framebuffer_update(fb); + stw_framebuffer_release(fb); - - return TRUE; + + return ret; +} + + +/** + * Queue a composition. + * + * It will drop the lock on success. + */ +BOOL +stw_framebuffer_present_locked(HDC hdc, + struct stw_framebuffer *fb, + unsigned surface_index) +{ + if(stw_dev->callbacks.wglCbPresentBuffers && + stw_dev->stw_winsys->compose) { + GLCBPRESENTBUFFERSDATA data; + + memset(&data, 0, sizeof data); + data.magic1 = 2; + data.magic2 = 0; + data.AdapterLuid = stw_dev->AdapterLuid; + data.rect = fb->client_rect; + data.pPrivateData = (void *)(uintptr_t)surface_index; + + stw_framebuffer_release(fb); + + return stw_dev->callbacks.wglCbPresentBuffers(hdc, &data); + } + else { + struct pipe_screen *screen = stw_dev->screen; + struct pipe_surface *surface; + + if(!st_get_framebuffer_surface( fb->stfb, surface_index, &surface )) { + /* FIXME: this shouldn't happen, but does on glean */ + stw_framebuffer_release(fb); + return FALSE; + } + +#ifdef DEBUG + if(stw_dev->trace_running) { + screen = trace_screen(screen)->screen; + surface = trace_surface(surface)->surface; + } +#endif + + stw_dev->stw_winsys->present( screen, surface, hdc ); + + stw_framebuffer_update(fb); + + stw_framebuffer_release(fb); + + return TRUE; + } +} + + +BOOL APIENTRY +DrvSwapBuffers( + HDC hdc ) +{ + struct stw_framebuffer *fb; + + fb = stw_framebuffer_from_hdc( hdc ); + if (fb == NULL) + return FALSE; + + if (!(fb->pfi->pfd.dwFlags & PFD_DOUBLEBUFFER)) { + stw_framebuffer_release(fb); + return TRUE; + } + + /* If we're swapping the buffer associated with the current context + * we have to flush any pending rendering commands first. + */ + st_notify_swapbuffers( fb->stfb ); + + return stw_framebuffer_present_locked(hdc, fb, ST_SURFACE_BACK_LEFT); } diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.h b/src/gallium/state_trackers/wgl/stw_framebuffer.h index 13d29f37e4..5afbe74908 100644 --- a/src/gallium/state_trackers/wgl/stw_framebuffer.h +++ b/src/gallium/state_trackers/wgl/stw_framebuffer.h @@ -73,9 +73,20 @@ struct stw_framebuffer /* FIXME: Make this work for multiple contexts bound to the same framebuffer */ boolean must_resize; + unsigned width; unsigned height; + /** + * Client area rectangle, relative to the window upper-left corner. + * + * @sa GLCBPRESENTBUFFERSDATA::rect. + */ + RECT client_rect; + + HANDLE hSharedSurface; + struct stw_shared_surface *shared_surface; + /** * This is protected by stw_device::fb_mutex, not the mutex above. * @@ -126,6 +137,11 @@ BOOL stw_framebuffer_allocate( struct stw_framebuffer *fb ); +BOOL +stw_framebuffer_present_locked(HDC hdc, + struct stw_framebuffer *fb, + unsigned surface_index); + void stw_framebuffer_update( struct stw_framebuffer *fb); diff --git a/src/gallium/state_trackers/wgl/stw_icd.h b/src/gallium/state_trackers/wgl/stw_icd.h index cbc1a66548..02eb543fef 100644 --- a/src/gallium/state_trackers/wgl/stw_icd.h +++ b/src/gallium/state_trackers/wgl/stw_icd.h @@ -1,6 +1,6 @@ /************************************************************************** * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2008-2009 Vmware, Inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -18,7 +18,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. @@ -388,6 +388,113 @@ typedef struct _GLCLTPROCTABLE typedef VOID (APIENTRY * PFN_SETPROCTABLE)(PGLCLTPROCTABLE); +/** + * Presentation data passed to opengl32!wglCbPresentBuffers. + * + * Pure software drivers don't need to worry about this -- if they stick to the + * GDI API then will integrate with the Desktop Window Manager (DWM) without + * problems. Hardware drivers, however, cannot present directly to the primary + * surface while the DWM is active, as DWM gets exclusive access to the primary + * surface. + * + * Proper DWM integration requires: + * - advertise the PFD_SUPPORT_COMPOSITION flag + * - redirect glFlush/glfinish/wglSwapBuffers into a surface shared with the + * DWM process. + * + * @sa http://www.opengl.org/pipeline/article/vol003_7/ + * @sa http://blogs.msdn.com/greg_schechter/archive/2006/05/02/588934.aspx + */ +typedef struct _GLCBPRESENTBUFFERSDATA +{ + /** + * wglCbPresentBuffers enforces this to be 2. + */ + DWORD magic1; + + /** + * wglCbPresentBuffers enforces to be 0 or 1, but it is most commonly + * set to 0. + */ + DWORD magic2; + + /** + * Locally unique identifier (LUID) of the graphics adapter. + * + * This should contain the value returned by D3DKMTOpenAdapterFromHdc. It + * is passed to dwmapi!DwmpDxGetWindowSharedSurface in order to obtain + * the shared surface handle for the bound drawable (window). + * + * @sa http://msdn.microsoft.com/en-us/library/ms799177.aspx + */ + LUID AdapterLuid; + + /** + * This is passed unmodified to DrvPresentBuffers + */ + LPVOID pPrivateData; + + /** + * Client area rectangle to update, relative to the window upper-left corner. + */ + RECT rect; +} GLCBPRESENTBUFFERSDATA, *PGLCBPRESENTBUFFERSDATA; + +/** + * Callbacks supplied to DrvSetCallbackProcs by the OpenGL runtime. + * + * Pointers to several callback functions in opengl32.dll. + */ +typedef struct _GLCALLBACKTABLE +{ + /** Unused */ + PROC wglCbSetCurrentValue; + + /** Unused */ + PROC wglCbGetCurrentValue; + + /** Unused */ + PROC wglCbGetDhglrc; + + /** Unused */ + PROC wglCbGetDdHandle; + + /** + * Queue a present composition. + * + * Makes the runtime call DrvPresentBuffers with the composition information. + */ + BOOL (APIENTRY *wglCbPresentBuffers)(HDC hdc, PGLCBPRESENTBUFFERSDATA data); + +} GLCALLBACKTABLE; + +typedef struct _GLPRESENTBUFFERSDATA +{ + /** + * The shared surface handle. + * + * Return by dwmapi!DwmpDxGetWindowSharedSurface. + * + * @sa http://channel9.msdn.com/forums/TechOff/251261-Help-Getting-the-shared-window-texture-out-of-DWM-/ + */ + HANDLE hSharedSurface; + + LUID AdapterLuid; + + /** + * Present history token. + * + * This is returned by dwmapi!DwmpDxGetWindowSharedSurface and + * should be passed to D3DKMTRender in D3DKMT_RENDER::PresentHistoryToken. + * + * @sa http://msdn.microsoft.com/en-us/library/ms799176.aspx + */ + ULONGLONG PresentHistoryToken; + + /** Same as GLCBPRESENTBUFFERSDATA::pPrivateData */ + LPVOID pPrivateData; +} GLPRESENTBUFFERSDATA, *PGLPRESENTBUFFERSDATA; + BOOL APIENTRY DrvCopyContext( DHGLRC dhrcSource, @@ -434,6 +541,9 @@ PROC APIENTRY DrvGetProcAddress( LPCSTR lpszProc ); +BOOL APIENTRY +DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data); + BOOL APIENTRY DrvRealizeLayerPalette( HDC hdc, diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.c b/src/gallium/state_trackers/wgl/stw_pixelformat.c index 9b591d5751..7abe5d9f7f 100644 --- a/src/gallium/state_trackers/wgl/stw_pixelformat.c +++ b/src/gallium/state_trackers/wgl/stw_pixelformat.c @@ -154,8 +154,11 @@ stw_pixelformat_add( pfi->pfd.dwFlags = PFD_SUPPORT_OPENGL; /* TODO: also support non-native pixel formats */ - pfi->pfd.dwFlags |= PFD_DRAW_TO_WINDOW ; - + pfi->pfd.dwFlags |= PFD_DRAW_TO_WINDOW; + + /* See http://www.opengl.org/pipeline/article/vol003_7/ */ + pfi->pfd.dwFlags |= PFD_SUPPORT_COMPOSITION; + if (doublebuffer) pfi->pfd.dwFlags |= PFD_DOUBLEBUFFER | PFD_SWAP_COPY; diff --git a/src/gallium/state_trackers/wgl/stw_pixelformat.h b/src/gallium/state_trackers/wgl/stw_pixelformat.h index 2fa7e22c43..3a690b35ba 100644 --- a/src/gallium/state_trackers/wgl/stw_pixelformat.h +++ b/src/gallium/state_trackers/wgl/stw_pixelformat.h @@ -30,6 +30,10 @@ #include +#ifndef PFD_SUPPORT_COMPOSITION +#define PFD_SUPPORT_COMPOSITION 0x00008000 +#endif + #include "main/mtypes.h" #include "pipe/p_compiler.h" diff --git a/src/gallium/state_trackers/wgl/stw_winsys.h b/src/gallium/state_trackers/wgl/stw_winsys.h index c0bf82c9ed..1ead47d6e6 100644 --- a/src/gallium/state_trackers/wgl/stw_winsys.h +++ b/src/gallium/state_trackers/wgl/stw_winsys.h @@ -1,6 +1,6 @@ /************************************************************************** * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2008-2009 Vmware, Inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -18,7 +18,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. @@ -36,6 +36,8 @@ struct pipe_screen; struct pipe_context; struct pipe_surface; +struct stw_shared_surface; + struct stw_winsys { struct pipe_screen * @@ -44,10 +46,52 @@ struct stw_winsys struct pipe_context * (*create_context)( struct pipe_screen *screen ); + /** + * Present the color buffer to the window associated with the device context. + */ + void + (*present)( struct pipe_screen *screen, + struct pipe_surface *surf, + HDC hDC ); + + /** + * Locally unique identifier (LUID) of the graphics adapter. + * + * @sa GLCBPRESENTBUFFERSDATA::AdapterLuid; + */ + boolean + (*get_adapter_luid)( struct pipe_screen *screen, + LUID *pAdapterLuid ); + + /** + * Open a shared surface (optional). + * + * @sa GLCBPRESENTBUFFERSDATA::hSharedSurface; + */ + struct stw_shared_surface * + (*shared_surface_open)(struct pipe_screen *screen, + HANDLE hSharedSurface); + + /** + * Open a shared surface (optional). + */ + void + (*shared_surface_close)(struct pipe_screen *screen, + struct stw_shared_surface *surface); + + /** + * Compose into a shared (optional). + * + * Blit the color buffer into a shared surface. + * + * @sa GLPRESENTBUFFERSDATA::PresentHistoryToken. + */ void - (*flush_frontbuffer)( struct pipe_screen *screen, - struct pipe_surface *surf, - HDC hDC ); + (*compose)( struct pipe_screen *screen, + struct pipe_surface *src, + struct stw_shared_surface *dest, + LPCRECT pRect, + ULONGLONG PresentHistoryToken ); }; boolean -- cgit v1.2.3 From 86962d6f6eb74cc426f57b760cc0cdcb9fec3eef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 24 Sep 2009 13:09:40 +0100 Subject: gdi: Update for WGL state tracker interface changes. --- src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c | 12 ++++++++---- src/gallium/winsys/gdi/gdi_softpipe_winsys.c | 12 ++++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c b/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c index 9d0daf77e9..e8bc0f55ac 100644 --- a/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c +++ b/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c @@ -234,9 +234,9 @@ gdi_llvmpipe_context_create(struct pipe_screen *screen) static void -gdi_llvmpipe_flush_frontbuffer(struct pipe_screen *screen, - struct pipe_surface *surface, - HDC hDC) +gdi_llvmpipe_present(struct pipe_screen *screen, + struct pipe_surface *surface, + HDC hDC) { struct llvmpipe_texture *texture; struct gdi_llvmpipe_displaytarget *gdt; @@ -254,7 +254,11 @@ gdi_llvmpipe_flush_frontbuffer(struct pipe_screen *screen, static const struct stw_winsys stw_winsys = { &gdi_llvmpipe_screen_create, &gdi_llvmpipe_context_create, - &gdi_llvmpipe_flush_frontbuffer + &gdi_llvmpipe_present, + NULL, /* get_adapter_luid */ + NULL, /* shared_surface_open */ + NULL, /* shared_surface_close */ + NULL /* compose */ }; diff --git a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c index d82c8d6773..5e0ccf32f4 100644 --- a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c +++ b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c @@ -269,9 +269,9 @@ gdi_softpipe_context_create(struct pipe_screen *screen) static void -gdi_softpipe_flush_frontbuffer(struct pipe_screen *screen, - struct pipe_surface *surface, - HDC hDC) +gdi_softpipe_present(struct pipe_screen *screen, + struct pipe_surface *surface, + HDC hDC) { struct softpipe_texture *texture; struct gdi_softpipe_buffer *buffer; @@ -304,7 +304,11 @@ gdi_softpipe_flush_frontbuffer(struct pipe_screen *screen, static const struct stw_winsys stw_winsys = { &gdi_softpipe_screen_create, &gdi_softpipe_context_create, - &gdi_softpipe_flush_frontbuffer + &gdi_softpipe_present, + NULL, /* get_adapter_luid */ + NULL, /* shared_surface_open */ + NULL, /* shared_surface_close */ + NULL /* compose */ }; -- cgit v1.2.3 From cbab3d7f2a77f187fb688593c17396d4967c75b5 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Tue, 8 Sep 2009 16:03:25 -0400 Subject: r600: fix dri2 clipping --- src/mesa/drivers/dri/r600/r700_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index 1f4724e838..2a0b419256 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -1272,8 +1272,8 @@ void r700SetScissor(context_t *context) //--------------- if (context->radeon.radeonScreen->driScreen->dri2.enabled) { x1 = 0; y1 = 0; - x2 = rrb->base.Width - 1; - y2 = rrb->base.Height - 1; + x2 = rrb->base.Width; + y2 = rrb->base.Height; } else { x1 = rrb->dPriv->x; y1 = rrb->dPriv->y; -- cgit v1.2.3 From b1e417413f2da8aad1872fa009949da101156431 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 9 Sep 2009 15:02:16 +1000 Subject: r600: don't setup hardware state if TFP if we have a BO here it means TFP and we should have set it up already. tested by b0le on #radeon --- src/mesa/drivers/dri/r600/r600_texstate.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c index 49b603b65e..6436a5d7e9 100644 --- a/src/mesa/drivers/dri/r600/r600_texstate.c +++ b/src/mesa/drivers/dri/r600/r600_texstate.c @@ -565,6 +565,10 @@ static void setup_hardware_state(context_t *rmesa, struct gl_texture_object *tex int firstlevel = t->mt ? t->mt->firstLevel : 0; GLuint uTexelPitch, row_align; + if ( t->bo ) { + return GL_TRUE; + } + firstImage = t->base.Image[0][firstlevel]; if (!t->image_override) { -- cgit v1.2.3 From 65b01d449cc594e1c7e1a44c5d87fdc698300e9a Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 9 Sep 2009 01:41:46 -0400 Subject: r600: fix ftp for dri1 We use t->bo for dri1 since r600 uses CS for dri1. --- src/mesa/drivers/dri/r600/r600_texstate.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c index 6436a5d7e9..f30dd11230 100644 --- a/src/mesa/drivers/dri/r600/r600_texstate.c +++ b/src/mesa/drivers/dri/r600/r600_texstate.c @@ -565,9 +565,10 @@ static void setup_hardware_state(context_t *rmesa, struct gl_texture_object *tex int firstlevel = t->mt ? t->mt->firstLevel : 0; GLuint uTexelPitch, row_align; - if ( t->bo ) { - return GL_TRUE; - } + if (rmesa->radeon.radeonScreen->driScreen->dri2.enabled && + t->image_override && + t->bo) + return; firstImage = t->base.Image[0][firstlevel]; -- cgit v1.2.3 From 6552a103f903a2b767464cd2d267f706a6baf7d5 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 9 Sep 2009 11:14:17 -0400 Subject: r600: check if textures are actually enabled before submission noticed by taiu on IRC. --- src/mesa/drivers/dri/r600/r600_texstate.c | 2 +- src/mesa/drivers/dri/r600/r700_chip.c | 118 ++++++++++++++++-------------- 2 files changed, 64 insertions(+), 56 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c index f30dd11230..bcb8d7c73d 100644 --- a/src/mesa/drivers/dri/r600/r600_texstate.c +++ b/src/mesa/drivers/dri/r600/r600_texstate.c @@ -69,7 +69,7 @@ void r600UpdateTextureState(GLcontext * ctx) for (unit = 0; unit < R700_MAX_TEXTURE_UNITS; unit++) { texUnit = &ctx->Texture.Unit[unit]; t = radeon_tex_obj(ctx->Texture.Unit[unit]._Current); - + r700->textures[unit] = NULL; if (texUnit->_ReallyEnabled) { if (!t) continue; diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index 37bff56f5a..312cacffda 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -52,38 +52,40 @@ static void r700SendTexState(GLcontext *ctx, struct radeon_state_atom *atom) radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); for (i = 0; i < R700_TEXTURE_NUMBERUNITS; i++) { - radeonTexObj *t = r700->textures[i]; - if (t) { - if (!t->image_override) - bo = t->mt->bo; - else - bo = t->bo; - if (bo) { - - r700SyncSurf(context, bo, - RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, - 0, TC_ACTION_ENA_bit); - - BEGIN_BATCH_NO_AUTOSTATE(9 + 4); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_RESOURCE, 7)); - R600_OUT_BATCH(i * 7); - R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE0); - R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE1); - R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE2); - R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE3); - R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE4); - R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE5); - R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE6); - R600_OUT_BATCH_RELOC(r700->textures[i]->SQ_TEX_RESOURCE2, - bo, - 0, - RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); - R600_OUT_BATCH_RELOC(r700->textures[i]->SQ_TEX_RESOURCE3, - bo, - r700->textures[i]->SQ_TEX_RESOURCE3, - RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); - END_BATCH(); - COMMIT_BATCH(); + if (ctx->Texture.Unit[i]._ReallyEnabled) { + radeonTexObj *t = r700->textures[i]; + if (t) { + if (!t->image_override) + bo = t->mt->bo; + else + bo = t->bo; + if (bo) { + + r700SyncSurf(context, bo, + RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, + 0, TC_ACTION_ENA_bit); + + BEGIN_BATCH_NO_AUTOSTATE(9 + 4); + R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_RESOURCE, 7)); + R600_OUT_BATCH(i * 7); + R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE0); + R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE1); + R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE2); + R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE3); + R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE4); + R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE5); + R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE6); + R600_OUT_BATCH_RELOC(r700->textures[i]->SQ_TEX_RESOURCE2, + bo, + 0, + RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); + R600_OUT_BATCH_RELOC(r700->textures[i]->SQ_TEX_RESOURCE3, + bo, + r700->textures[i]->SQ_TEX_RESOURCE3, + RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); + END_BATCH(); + COMMIT_BATCH(); + } } } } @@ -98,16 +100,18 @@ static void r700SendTexSamplerState(GLcontext *ctx, struct radeon_state_atom *at radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); for (i = 0; i < R700_TEXTURE_NUMBERUNITS; i++) { - radeonTexObj *t = r700->textures[i]; - if (t) { - BEGIN_BATCH_NO_AUTOSTATE(5); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_SAMPLER, 3)); - R600_OUT_BATCH(i * 3); - R600_OUT_BATCH(r700->textures[i]->SQ_TEX_SAMPLER0); - R600_OUT_BATCH(r700->textures[i]->SQ_TEX_SAMPLER1); - R600_OUT_BATCH(r700->textures[i]->SQ_TEX_SAMPLER2); - END_BATCH(); - COMMIT_BATCH(); + if (ctx->Texture.Unit[i]._ReallyEnabled) { + radeonTexObj *t = r700->textures[i]; + if (t) { + BEGIN_BATCH_NO_AUTOSTATE(5); + R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_SAMPLER, 3)); + R600_OUT_BATCH(i * 3); + R600_OUT_BATCH(r700->textures[i]->SQ_TEX_SAMPLER0); + R600_OUT_BATCH(r700->textures[i]->SQ_TEX_SAMPLER1); + R600_OUT_BATCH(r700->textures[i]->SQ_TEX_SAMPLER2); + END_BATCH(); + COMMIT_BATCH(); + } } } } @@ -121,16 +125,18 @@ static void r700SendTexBorderColorState(GLcontext *ctx, struct radeon_state_atom radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); for (i = 0; i < R700_TEXTURE_NUMBERUNITS; i++) { - radeonTexObj *t = r700->textures[i]; - if (t) { - BEGIN_BATCH_NO_AUTOSTATE(2 + 4); - R600_OUT_BATCH_REGSEQ((TD_PS_SAMPLER0_BORDER_RED + (i * 16)), 4); - R600_OUT_BATCH(r700->textures[i]->TD_PS_SAMPLER0_BORDER_RED); - R600_OUT_BATCH(r700->textures[i]->TD_PS_SAMPLER0_BORDER_GREEN); - R600_OUT_BATCH(r700->textures[i]->TD_PS_SAMPLER0_BORDER_BLUE); - R600_OUT_BATCH(r700->textures[i]->TD_PS_SAMPLER0_BORDER_ALPHA); - END_BATCH(); - COMMIT_BATCH(); + if (ctx->Texture.Unit[i]._ReallyEnabled) { + radeonTexObj *t = r700->textures[i]; + if (t) { + BEGIN_BATCH_NO_AUTOSTATE(2 + 4); + R600_OUT_BATCH_REGSEQ((TD_PS_SAMPLER0_BORDER_RED + (i * 16)), 4); + R600_OUT_BATCH(r700->textures[i]->TD_PS_SAMPLER0_BORDER_RED); + R600_OUT_BATCH(r700->textures[i]->TD_PS_SAMPLER0_BORDER_GREEN); + R600_OUT_BATCH(r700->textures[i]->TD_PS_SAMPLER0_BORDER_BLUE); + R600_OUT_BATCH(r700->textures[i]->TD_PS_SAMPLER0_BORDER_ALPHA); + END_BATCH(); + COMMIT_BATCH(); + } } } } @@ -1176,9 +1182,11 @@ static int check_tx(GLcontext *ctx, struct radeon_state_atom *atom) R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); for (i = 0; i < R700_TEXTURE_NUMBERUNITS; i++) { - radeonTexObj *t = r700->textures[i]; - if (t) - count++; + if (ctx->Texture.Unit[i]._ReallyEnabled) { + radeonTexObj *t = r700->textures[i]; + if (t) + count++; + } } radeon_print(RADEON_STATE, RADEON_TRACE, "%s %d\n", __func__, count); return count * 31; -- cgit v1.2.3 From 9edd1a441c3c0c3f018ae561cd5711398ca56f95 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Fri, 11 Sep 2009 10:59:05 -0400 Subject: r600: enable caching of vertex programs --- src/mesa/drivers/dri/r600/r600_context.h | 3 + src/mesa/drivers/dri/r600/r700_chip.c | 10 ++- src/mesa/drivers/dri/r600/r700_oglprog.c | 36 ++++++----- src/mesa/drivers/dri/r600/r700_render.c | 9 +-- src/mesa/drivers/dri/r600/r700_vertprog.c | 103 ++++++++++++++++++++---------- src/mesa/drivers/dri/r600/r700_vertprog.h | 11 +++- 6 files changed, 110 insertions(+), 62 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_context.h b/src/mesa/drivers/dri/r600/r600_context.h index 8ae05a301c..c59df7505a 100644 --- a/src/mesa/drivers/dri/r600/r600_context.h +++ b/src/mesa/drivers/dri/r600/r600_context.h @@ -51,6 +51,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r700_chip.h" #include "r600_tex.h" #include "r700_oglprog.h" +#include "r700_vertprog.h" struct r600_context; typedef struct r600_context context_t; @@ -155,6 +156,8 @@ struct r600_context { struct r600_hw_state atoms; + struct r700_vertex_program *selected_vp; + /* Vertex buffers */ GLvector4f dummy_attrib[_TNL_ATTRIB_MAX]; diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index 312cacffda..1b56059197 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -211,8 +211,7 @@ static void r700SetupVTXConstants(GLcontext * ctx, void r700SetupStreams(GLcontext *ctx) { context_t *context = R700_CONTEXT(ctx); - struct r700_vertex_program *vpc - = (struct r700_vertex_program *)ctx->VertexProgram._Current; + struct r700_vertex_program *vp = context->selected_vp; TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *vb = &tnl->vb; unsigned int i, j = 0; @@ -221,7 +220,7 @@ void r700SetupStreams(GLcontext *ctx) R600_STATECHANGE(context, vtx); for(i=0; imesa_program.Base.InputsRead & (1 << i)) { + if(vp->mesa_program->Base.InputsRead & (1 << i)) { rcommon_emit_vector(ctx, &context->radeon.tcl.aos[j], vb->AttribPtr[i]->data, @@ -237,8 +236,7 @@ void r700SetupStreams(GLcontext *ctx) static void r700SendVTXState(GLcontext *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); - struct r700_vertex_program *vpc - = (struct r700_vertex_program *)ctx->VertexProgram._Current; + struct r700_vertex_program *vp = context->selected_vp; unsigned int i, j = 0; BATCH_LOCALS(&context->radeon); radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); @@ -258,7 +256,7 @@ static void r700SendVTXState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); for(i=0; imesa_program.Base.InputsRead & (1 << i)) { + if(vp->mesa_program->Base.InputsRead & (1 << i)) { /* currently aos are packed */ r700SetupVTXConstants(ctx, i, diff --git a/src/mesa/drivers/dri/r600/r700_oglprog.c b/src/mesa/drivers/dri/r600/r700_oglprog.c index 3c8c1fd7a3..5290ef31be 100644 --- a/src/mesa/drivers/dri/r600/r700_oglprog.c +++ b/src/mesa/drivers/dri/r600/r700_oglprog.c @@ -46,7 +46,7 @@ static struct gl_program *r700NewProgram(GLcontext * ctx, { struct gl_program *pProgram = NULL; - struct r700_vertex_program *vp; + struct r700_vertex_program_cont *vpc; struct r700_fragment_program *fp; radeon_print(RADEON_SHADER, RADEON_VERBOSE, @@ -56,16 +56,11 @@ static struct gl_program *r700NewProgram(GLcontext * ctx, { case GL_VERTEX_STATE_PROGRAM_NV: case GL_VERTEX_PROGRAM_ARB: - vp = CALLOC_STRUCT(r700_vertex_program); + vpc = CALLOC_STRUCT(r700_vertex_program_cont); pProgram = _mesa_init_vertex_program(ctx, - &vp->mesa_program, + &vpc->mesa_program, target, id); - vp->translated = GL_FALSE; - vp->loaded = GL_FALSE; - - vp->shaderbo = NULL; - break; case GL_FRAGMENT_PROGRAM_NV: case GL_FRAGMENT_PROGRAM_ARB: @@ -89,7 +84,8 @@ static struct gl_program *r700NewProgram(GLcontext * ctx, static void r700DeleteProgram(GLcontext * ctx, struct gl_program *prog) { - struct r700_vertex_program * vp; + struct r700_vertex_program_cont * vpc; + struct r700_vertex_program *vp, *tmp; struct r700_fragment_program * fp; radeon_print(RADEON_SHADER, RADEON_VERBOSE, @@ -99,14 +95,20 @@ static void r700DeleteProgram(GLcontext * ctx, struct gl_program *prog) { case GL_VERTEX_STATE_PROGRAM_NV: case GL_VERTEX_PROGRAM_ARB: - vp = (struct r700_vertex_program*)prog; - /* Release DMA region */ - - r600DeleteShader(ctx, vp->shaderbo); - - /* Clean up */ - Clean_Up_Assembler(&(vp->r700AsmCode)); - Clean_Up_Shader(&(vp->r700Shader)); + vpc = (struct r700_vertex_program_cont*)prog; + vp = vpc->progs; + while (vp) { + tmp = vp->next; + /* Release DMA region */ + + r600DeleteShader(ctx, vp->shaderbo); + + /* Clean up */ + Clean_Up_Assembler(&(vp->r700AsmCode)); + Clean_Up_Shader(&(vp->r700Shader)); + _mesa_free(vp); + vp = tmp; + } break; case GL_FRAGMENT_PROGRAM_NV: case GL_FRAGMENT_PROGRAM_ARB: diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index 3566bf3ca7..b1c3648ca5 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -319,14 +319,13 @@ static GLuint r700PredictRenderSize(GLcontext* ctx) { context_t *context = R700_CONTEXT(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); - struct r700_vertex_program *vpc - = (struct r700_vertex_program *)ctx->VertexProgram._Current; + struct r700_vertex_program *vp = context->selected_vp; struct vertex_buffer *vb = &tnl->vb; GLboolean flushed; GLuint dwords, i; GLuint state_size; /* pre calculate aos count so state prediction works */ - context->radeon.tcl.aos_count = _mesa_bitcount(vpc->mesa_program.Base.InputsRead); + context->radeon.tcl.aos_count = _mesa_bitcount(vp->mesa_program->Base.InputsRead); dwords = PRE_EMIT_STATE_BUFSZ; for (i = 0; i < vb->PrimitiveCount; i++) @@ -365,7 +364,6 @@ static GLboolean r700RunRender(GLcontext * ctx, /* mark vtx as dirty since it changes per-draw */ R600_STATECHANGE(context, vtx); - r700UpdateShaders(ctx); r700SetScissor(context); r700SetupVertexProgram(ctx); r700SetupFragmentProgram(ctx); @@ -427,7 +425,10 @@ static GLboolean r700RunTCLRender(GLcontext * ctx, /*----------------------*/ /* TODO : sw fallback */ + /* Need shader bo's setup before bo check */ + r700UpdateShaders(ctx); /** + * Ensure all enabled and complete textures are uploaded along with any buffers being used. */ if(!r600ValidateBuffers(ctx)) diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c index d107f99e7b..8c2b0071df 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.c +++ b/src/mesa/drivers/dri/r600/r700_vertprog.c @@ -35,6 +35,7 @@ #include "main/mtypes.h" #include "tnl/t_context.h" +#include "shader/program.h" #include "shader/prog_parameter.h" #include "shader/prog_statevars.h" @@ -258,28 +259,54 @@ GLboolean Find_Instruction_Dependencies_vp(struct r700_vertex_program *vp, return GL_TRUE; } -GLboolean r700TranslateVertexShader(struct r700_vertex_program *vp, - struct gl_vertex_program *mesa_vp) +struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, + struct gl_vertex_program *mesa_vp) { + context_t *context = R700_CONTEXT(ctx); + struct r700_vertex_program *vp; + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *vb = &tnl->vb; + unsigned int unBit; + unsigned int i; + + vp = _mesa_calloc(sizeof(*vp)); + vp->mesa_program = (struct gl_vertex_program *)_mesa_clone_program(ctx, &mesa_vp->Base); + + for(i=0; imesa_program->Base.InputsRead & unBit) /* ctx->Array.ArrayObj->xxxxxxx */ + { + vp->aos_desc[i].size = vb->AttribPtr[i]->size; + vp->aos_desc[i].stride = vb->AttribPtr[i]->size * sizeof(GL_FLOAT);/* when emit array, data is packed. vb->AttribPtr[i]->stride;*/ + vp->aos_desc[i].type = GL_FLOAT; + } + } + + if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) + { + vp->r700AsmCode.bR6xx = 1; + } + //Init_Program Init_r700_AssemblerBase(SPT_VP, &(vp->r700AsmCode), &(vp->r700Shader) ); Map_Vertex_Program( vp, mesa_vp ); if(GL_FALSE == Find_Instruction_Dependencies_vp(vp, mesa_vp)) { - return GL_FALSE; + return NULL; } if(GL_FALSE == AssembleInstr(mesa_vp->Base.NumInstructions, &(mesa_vp->Base.Instructions[0]), &(vp->r700AsmCode)) ) { - return GL_FALSE; + return NULL; } if(GL_FALSE == Process_Vertex_Exports(&(vp->r700AsmCode), mesa_vp->Base.OutputsWritten) ) { - return GL_FALSE; + return NULL; } vp->r700Shader.nRegs = (vp->r700AsmCode.number_used_registers == 0) ? 0 @@ -289,72 +316,82 @@ GLboolean r700TranslateVertexShader(struct r700_vertex_program *vp, vp->translated = GL_TRUE; - return GL_TRUE; + return vp; } void r700SelectVertexShader(GLcontext *ctx) { context_t *context = R700_CONTEXT(ctx); - struct r700_vertex_program *vpc - = (struct r700_vertex_program *)ctx->VertexProgram._Current; + struct r700_vertex_program_cont *vpc; + struct r700_vertex_program *vp; TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *vb = &tnl->vb; unsigned int unBit; unsigned int i; + GLboolean match; + vpc = (struct r700_vertex_program_cont *)ctx->VertexProgram._Current; + +#if 0 if (context->radeon.NewGLState & (_NEW_PROGRAM_CONSTANTS|_NEW_PROGRAM)) { vpc->needUpdateVF = 1; } +#endif - if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) + for (vp = vpc->progs; vp; vp = vp->next) { - vpc->r700AsmCode.bR6xx = 1; - } - + match = GL_TRUE; for(i=0; imesa_program.Base.InputsRead & unBit) /* ctx->Array.ArrayObj->xxxxxxx */ + if(vpc->mesa_program.Base.InputsRead & unBit) { - vpc->aos_desc[i].size = vb->AttribPtr[i]->size; - vpc->aos_desc[i].stride = vb->AttribPtr[i]->size * sizeof(GL_FLOAT);/* when emit array, data is packed. vb->AttribPtr[i]->stride;*/ - vpc->aos_desc[i].type = GL_FLOAT; + if (vp->aos_desc[i].size != vb->AttribPtr[i]->size) + match = GL_FALSE; + break; } } - - if(GL_FALSE == vpc->translated) { - r700TranslateVertexShader(vpc, &(vpc->mesa_program) ); + if (match) + { + context->selected_vp = vp; + return; } + } + + vp = r700TranslateVertexShader(ctx, &(vpc->mesa_program) ); + if(!vp) + { + radeon_error("Failed to translate vertex shader. \n"); + return; + } + vp->next = vpc->progs; + vpc->progs = vp; + context->selected_vp = vp; + return; } void * r700GetActiveVpShaderBo(GLcontext * ctx) { - struct r700_vertex_program *vp - = (struct r700_vertex_program *)ctx->VertexProgram._Current; + context_t *context = R700_CONTEXT(ctx); + struct r700_vertex_program *vp = context->selected_vp;; - return vp->shaderbo; + if (vp) + return vp->shaderbo; + else + return NULL; } GLboolean r700SetupVertexProgram(GLcontext * ctx) { context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); - struct r700_vertex_program *vp - = (struct r700_vertex_program *)ctx->VertexProgram._Current; + struct r700_vertex_program *vp = context->selected_vp; struct gl_program_parameter_list *paramList; unsigned int unNumParamData; unsigned int ui; - if (vp->needUpdateVF) - { - vp->loaded = GL_FALSE; - vp->r700Shader.bNeedsAssembly = GL_TRUE; - Process_Vertex_Program_Vfetch_Instructions(vp, &(vp->mesa_program)); - r600DeleteShader(ctx, vp->shaderbo); - } - if(GL_FALSE == vp->loaded) { if(vp->r700Shader.bNeedsAssembly == GL_TRUE) @@ -410,7 +447,7 @@ GLboolean r700SetupVertexProgram(GLcontext * ctx) */ /* sent out shader constants. */ - paramList = vp->mesa_program.Base.Parameters; + paramList = vp->mesa_program->Base.Parameters; if(NULL != paramList) { _mesa_load_state_parameters(ctx, paramList); diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.h b/src/mesa/drivers/dri/r600/r700_vertprog.h index e2e65021fd..c48764c43b 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.h +++ b/src/mesa/drivers/dri/r600/r700_vertprog.h @@ -43,7 +43,7 @@ typedef struct ArrayDesc //TEMP struct r700_vertex_program { - struct gl_vertex_program mesa_program; /* Must be first */ + struct gl_vertex_program *mesa_program; /* Must be first */ struct r700_vertex_program *next; @@ -59,6 +59,13 @@ struct r700_vertex_program ArrayDesc aos_desc[VERT_ATTRIB_MAX]; }; +struct r700_vertex_program_cont +{ + struct gl_vertex_program mesa_program; + + struct r700_vertex_program *progs; +}; + //Internal unsigned int Map_Vertex_Output(r700_AssemblerBase *pAsm, struct gl_vertex_program *mesa_vp, @@ -74,7 +81,7 @@ void Map_Vertex_Program(struct r700_vertex_program *vp, GLboolean Find_Instruction_Dependencies_vp(struct r700_vertex_program *vp, struct gl_vertex_program *mesa_vp); -GLboolean r700TranslateVertexShader(struct r700_vertex_program *vp, +struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, struct gl_vertex_program *mesa_vp); /* Interface */ -- cgit v1.2.3 From 7f5a958c80f0fcd7681d515fd1c1b8bc00524a7a Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Fri, 11 Sep 2009 15:59:55 -0400 Subject: r600: fix texcoords from constants with some minor updates from Richard. --- src/mesa/drivers/dri/r600/r700_assembler.c | 92 +++++++++++++++++------------- 1 file changed, 52 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 2d8480daaf..fda6692725 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -1149,41 +1149,49 @@ GLboolean tex_dst(r700_AssemblerBase *pAsm) GLboolean tex_src(r700_AssemblerBase *pAsm) { struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); - + GLboolean bValidTexCoord = GL_FALSE; - switch (pILInst->SrcReg[0].File) - { + switch (pILInst->SrcReg[0].File) { + case PROGRAM_CONSTANT: + case PROGRAM_LOCAL_PARAM: + case PROGRAM_ENV_PARAM: + case PROGRAM_STATE_VAR: + bValidTexCoord = GL_TRUE; + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = pAsm->aArgSubst[1]; + break; case PROGRAM_TEMPORARY: - bValidTexCoord = GL_TRUE; - - pAsm->S[0].src.reg = pILInst->SrcReg[0].Index + pAsm->starting_temp_register_number; - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - - break; + bValidTexCoord = GL_TRUE; + pAsm->S[0].src.reg = pILInst->SrcReg[0].Index + + pAsm->starting_temp_register_number; + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + break; case PROGRAM_INPUT: - switch (pILInst->SrcReg[0].Index) - { - case FRAG_ATTRIB_COL0: - case FRAG_ATTRIB_COL1: - case FRAG_ATTRIB_TEX0: - case FRAG_ATTRIB_TEX1: - case FRAG_ATTRIB_TEX2: - case FRAG_ATTRIB_TEX3: - case FRAG_ATTRIB_TEX4: - case FRAG_ATTRIB_TEX5: - case FRAG_ATTRIB_TEX6: - case FRAG_ATTRIB_TEX7: - bValidTexCoord = GL_TRUE; - - pAsm->S[0].src.reg = pAsm->uiFP_AttributeMap[pILInst->SrcReg[0].Index]; - pAsm->S[0].src.rtype = SRC_REG_INPUT; - } - break; + switch (pILInst->SrcReg[0].Index) + { + case FRAG_ATTRIB_COL0: + case FRAG_ATTRIB_COL1: + case FRAG_ATTRIB_TEX0: + case FRAG_ATTRIB_TEX1: + case FRAG_ATTRIB_TEX2: + case FRAG_ATTRIB_TEX3: + case FRAG_ATTRIB_TEX4: + case FRAG_ATTRIB_TEX5: + case FRAG_ATTRIB_TEX6: + case FRAG_ATTRIB_TEX7: + bValidTexCoord = GL_TRUE; + pAsm->S[0].src.reg = + pAsm->uiFP_AttributeMap[pILInst->SrcReg[0].Index]; + pAsm->S[0].src.rtype = SRC_REG_INPUT; + break; + } + break; } if(GL_TRUE == bValidTexCoord) - { + { setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); } else @@ -1201,7 +1209,7 @@ GLboolean tex_src(r700_AssemblerBase *pAsm) pAsm->S[0].src.negy = (pILInst->SrcReg[0].Negate >> 1) & 0x1; pAsm->S[0].src.negz = (pILInst->SrcReg[0].Negate >> 2) & 0x1; pAsm->S[0].src.negw = (pILInst->SrcReg[0].Negate >> 3) & 0x1; - + return GL_TRUE; } @@ -2202,7 +2210,9 @@ GLboolean next_ins(r700_AssemblerBase *pAsm) { struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); - if( GL_TRUE == IsTex(pILInst->Opcode) ) + if( GL_TRUE == IsTex(pILInst->Opcode) && + /* handle const moves to temp register */ + !(pAsm->D.dst.opcode == SQ_OP2_INST_MOV) ) { if (pILInst->TexSrcTarget == TEXTURE_RECT_INDEX) { if( GL_FALSE == assemble_tex_instruction(pAsm, GL_FALSE) ) @@ -3374,28 +3384,30 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) case PROGRAM_ENV_PARAM: case PROGRAM_STATE_VAR: src_const = GL_TRUE; + break; case PROGRAM_TEMPORARY: case PROGRAM_INPUT: src_const = GL_FALSE; + break; } - if (GL_TRUE == src_const) + if (GL_TRUE == src_const) { - radeon_error("TODO: Texture coordinates from a constant register not supported.\n"); - return GL_FALSE; + if ( GL_FALSE == mov_temp(pAsm, 0) ) + return GL_FALSE; } - switch (pAsm->pILInst[pAsm->uiCurInst].Opcode) + switch (pAsm->pILInst[pAsm->uiCurInst].Opcode) { case OPCODE_TEX: - pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE; + pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE; break; - case OPCODE_TXB: + case OPCODE_TXB: radeon_error("do not support TXB yet\n"); return GL_FALSE; break; - case OPCODE_TXP: - /* TODO : tex proj version : divid first 3 components by 4th */ + case OPCODE_TXP: + /* TODO : tex proj version : divid first 3 components by 4th */ pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE; break; default: @@ -3418,13 +3430,13 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) { return GL_FALSE; } - + if( GL_FALSE == tex_src(pAsm) ) { return GL_FALSE; } - if ( GL_FALSE == next_ins(pAsm) ) + if ( GL_FALSE == next_ins(pAsm) ) { return GL_FALSE; } -- cgit v1.2.3 From 93a7ea6ba0d5700e18b28c23da226e055f7c2fa1 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Mon, 14 Sep 2009 17:08:26 -0400 Subject: r600: fix warning Noticed by rnoland on IRC. --- src/mesa/drivers/dri/r600/r700_assembler.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index fda6692725..efeccb25f1 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -3387,6 +3387,7 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) break; case PROGRAM_TEMPORARY: case PROGRAM_INPUT: + default: src_const = GL_FALSE; break; } -- cgit v1.2.3 From 9437ac9bccd294bd5a8b838e7ca7597e5dc6d5b0 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Mon, 14 Sep 2009 18:05:15 -0400 Subject: r600: add span support for 1D tiles 1D tile span support for depth/stencil/color/textures Z and stencil buffers are always tiled, so this fixes sw access to Z and stencil buffers. color and textures are currently linear, but this adds span support when we implement 1D tiling. This fixes the text in progs/demos/engine and progs/tests/z* --- src/mesa/drivers/dri/r600/r600_reg_auto_r6xx.h | 2 + src/mesa/drivers/dri/r600/r700_chip.c | 2 +- src/mesa/drivers/dri/radeon/radeon_span.c | 220 +++++++++++++++++++++++++ 3 files changed, 223 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_reg_auto_r6xx.h b/src/mesa/drivers/dri/r600/r600_reg_auto_r6xx.h index 9d5aa3c7e4..edd85b0fac 100644 --- a/src/mesa/drivers/dri/r600/r600_reg_auto_r6xx.h +++ b/src/mesa/drivers/dri/r600/r600_reg_auto_r6xx.h @@ -1366,6 +1366,7 @@ enum { DB_DEPTH_INFO__READ_SIZE_bit = 1 << 3, DB_DEPTH_INFO__ARRAY_MODE_mask = 0x0f << 15, DB_DEPTH_INFO__ARRAY_MODE_shift = 15, + ARRAY_1D_TILED_THIN1 = 0x02, ARRAY_2D_TILED_THIN1 = 0x04, TILE_SURFACE_ENABLE_bit = 1 << 25, TILE_COMPACT_bit = 1 << 26, @@ -1449,6 +1450,7 @@ enum { CB_COLOR0_INFO__ARRAY_MODE_shift = 8, ARRAY_LINEAR_GENERAL = 0x00, ARRAY_LINEAR_ALIGNED = 0x01, +/* ARRAY_1D_TILED_THIN1 = 0x02, */ /* ARRAY_2D_TILED_THIN1 = 0x04, */ NUMBER_TYPE_mask = 0x07 << 12, NUMBER_TYPE_shift = 12, diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index 1b56059197..06d7e9c9ab 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -351,7 +351,7 @@ static void r700SetDepthTarget(context_t *context) SETfield(r700->DB_DEPTH_INFO.u32All, DEPTH_16, DB_DEPTH_INFO__FORMAT_shift, DB_DEPTH_INFO__FORMAT_mask); } - SETfield(r700->DB_DEPTH_INFO.u32All, ARRAY_2D_TILED_THIN1, + SETfield(r700->DB_DEPTH_INFO.u32All, ARRAY_1D_TILED_THIN1, DB_DEPTH_INFO__ARRAY_MODE_shift, DB_DEPTH_INFO__ARRAY_MODE_mask); /* r700->DB_PREFETCH_LIMIT.bits.DEPTH_HEIGHT_TILE_MAX = (context->currentDraw->h >> 3) - 1; */ /* z buffer sie may much bigger than what need, so use actual used h. */ } diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c index 4e100d854e..aa2035338c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.c +++ b/src/mesa/drivers/dri/radeon/radeon_span.c @@ -106,6 +106,142 @@ static GLubyte *r200_depth_4byte(const struct radeon_renderbuffer * rrb, } #endif +/* r600 tiling + * two main types: + * - 1D (akin to macro-linear/micro-tiled on older asics) + * - 2D (akin to macro-tiled/micro-tiled on older asics) + * only 1D tiling is implemented below + */ +#if defined(RADEON_COMMON_FOR_R600) +static GLint r600_1d_tile_helper(const struct radeon_renderbuffer * rrb, + GLint x, GLint y, GLint is_depth, GLint is_stencil) +{ + GLint element_bytes = rrb->cpp; + GLint num_samples = 1; + GLint tile_width = 8; + GLint tile_height = 8; + GLint tile_thickness = 1; + GLint pitch_elements = rrb->pitch / element_bytes; + GLint height = rrb->base.Height; + GLint z = 0; + GLint sample_number = 0; + /* */ + GLint tile_bytes; + GLint tiles_per_row; + GLint tiles_per_slice; + GLint slice_offset; + GLint tile_row_index; + GLint tile_column_index; + GLint tile_offset; + GLint pixel_number = 0; + GLint element_offset; + GLint offset = 0; + + tile_bytes = tile_width * tile_height * tile_thickness * element_bytes * num_samples; + tiles_per_row = pitch_elements /tile_width; + tiles_per_slice = tiles_per_row * (height / tile_height); + slice_offset = (z / tile_thickness) * tiles_per_slice * tile_bytes; + tile_row_index = y / tile_height; + tile_column_index = x / tile_width; + tile_offset = ((tile_row_index * tiles_per_row) + tile_column_index) * tile_bytes; + + if (is_depth) { + GLint pixel_offset = 0; + + pixel_number |= ((x >> 0) & 1) << 0; // pn[0] = x[0] + pixel_number |= ((y >> 0) & 1) << 1; // pn[1] = y[0] + pixel_number |= ((x >> 1) & 1) << 2; // pn[2] = x[1] + pixel_number |= ((y >> 1) & 1) << 3; // pn[3] = y[1] + pixel_number |= ((x >> 2) & 1) << 4; // pn[4] = x[2] + pixel_number |= ((y >> 2) & 1) << 5; // pn[5] = y[2] + switch (element_bytes) { + case 2: + pixel_offset = pixel_number * element_bytes * num_samples; + element_offset = pixel_offset + (sample_number * element_bytes); + break; + case 4: + /* stencil and depth data are stored separately within a tile. + * stencil is stored in a contiguous tile before the depth tile. + * stencil element is 1 byte, depth element is 3 bytes. + * stencil tile is 64 bytes. + */ + if (is_stencil) + pixel_offset = pixel_number * 1 * num_samples; + else + pixel_offset = (pixel_number * 3 * num_samples) + 64; + break; + } + element_offset = pixel_offset + (sample_number * element_bytes); + } else { + GLint sample_offset; + + switch (element_bytes) { + case 1: + pixel_number |= ((x >> 0) & 1) << 0; // pn[0] = x[0] + pixel_number |= ((x >> 1) & 1) << 1; // pn[1] = x[1] + pixel_number |= ((x >> 2) & 1) << 2; // pn[2] = x[2] + pixel_number |= ((y >> 1) & 1) << 3; // pn[3] = y[1] + pixel_number |= ((y >> 0) & 1) << 4; // pn[4] = y[0] + pixel_number |= ((y >> 2) & 1) << 5; // pn[5] = y[2] + break; + case 2: + pixel_number |= ((x >> 0) & 1) << 0; // pn[0] = x[0] + pixel_number |= ((x >> 1) & 1) << 1; // pn[1] = x[1] + pixel_number |= ((x >> 2) & 1) << 2; // pn[2] = x[2] + pixel_number |= ((y >> 0) & 1) << 3; // pn[3] = y[0] + pixel_number |= ((y >> 1) & 1) << 4; // pn[4] = y[1] + pixel_number |= ((y >> 2) & 1) << 5; // pn[5] = y[2] + break; + case 4: + pixel_number |= ((x >> 0) & 1) << 0; // pn[0] = x[0] + pixel_number |= ((x >> 1) & 1) << 1; // pn[1] = x[1] + pixel_number |= ((y >> 0) & 1) << 2; // pn[2] = y[0] + pixel_number |= ((x >> 2) & 1) << 3; // pn[3] = x[2] + pixel_number |= ((y >> 1) & 1) << 4; // pn[4] = y[1] + pixel_number |= ((y >> 2) & 1) << 5; // pn[5] = y[2] + break; + } + sample_offset = sample_number * (tile_bytes / num_samples); + element_offset = sample_offset + (pixel_number * element_bytes); + } + offset = slice_offset + tile_offset + element_offset; + return offset; +} + +/* depth buffers */ +static GLubyte *r600_ptr_depth(const struct radeon_renderbuffer * rrb, + GLint x, GLint y) +{ + GLubyte *ptr = rrb->bo->ptr; + GLint offset = r600_1d_tile_helper(rrb, x, y, 1, 0); + return &ptr[offset]; +} + +static GLubyte *r600_ptr_stencil(const struct radeon_renderbuffer * rrb, + GLint x, GLint y) +{ + GLubyte *ptr = rrb->bo->ptr; + GLint offset = r600_1d_tile_helper(rrb, x, y, 1, 1); + return &ptr[offset]; +} + +static GLubyte *r600_ptr_color(const struct radeon_renderbuffer * rrb, + GLint x, GLint y) +{ + GLubyte *ptr = rrb->bo->ptr; + uint32_t mask = RADEON_BO_FLAGS_MACRO_TILE | RADEON_BO_FLAGS_MICRO_TILE; + GLint offset; + + if (rrb->has_surface || !(rrb->bo->flags & mask)) { + offset = x * rrb->cpp + y * rrb->pitch; + } else { + offset = r600_1d_tile_helper(rrb, x, y, 0, 0); + } + return &ptr[offset]; +} + +#endif + /* radeon tiling on r300-r500 has 4 states, macro-linear/micro-linear macro-linear/micro-tiled @@ -270,7 +406,11 @@ s8z24_to_z24s8(uint32_t val) #define TAG(x) radeon##x##_RGB565 #define TAG2(x,y) radeon##x##_RGB565##y +#if defined(RADEON_COMMON_FOR_R600) +#define GET_PTR(X,Y) r600_ptr_color(rrb, (X) + x_off, (Y) + y_off) +#else #define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off) +#endif #include "spantmp2.h" /* 16 bit, ARGB1555 color spanline and pixel functions @@ -280,7 +420,11 @@ s8z24_to_z24s8(uint32_t val) #define TAG(x) radeon##x##_ARGB1555 #define TAG2(x,y) radeon##x##_ARGB1555##y +#if defined(RADEON_COMMON_FOR_R600) +#define GET_PTR(X,Y) r600_ptr_color(rrb, (X) + x_off, (Y) + y_off) +#else #define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off) +#endif #include "spantmp2.h" /* 16 bit, RGBA4 color spanline and pixel functions @@ -290,7 +434,11 @@ s8z24_to_z24s8(uint32_t val) #define TAG(x) radeon##x##_ARGB4444 #define TAG2(x,y) radeon##x##_ARGB4444##y +#if defined(RADEON_COMMON_FOR_R600) +#define GET_PTR(X,Y) r600_ptr_color(rrb, (X) + x_off, (Y) + y_off) +#else #define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off) +#endif #include "spantmp2.h" /* 32 bit, xRGB8888 color spanline and pixel functions @@ -300,11 +448,19 @@ s8z24_to_z24s8(uint32_t val) #define TAG(x) radeon##x##_xRGB8888 #define TAG2(x,y) radeon##x##_xRGB8888##y +#if defined(RADEON_COMMON_FOR_R600) +#define GET_VALUE(_x, _y) ((*(GLuint*)(r600_ptr_color(rrb, _x + x_off, _y + y_off)) | 0xff000000)) +#define PUT_VALUE(_x, _y, d) { \ + GLuint *_ptr = (GLuint*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \ + *_ptr = d; \ +} while (0) +#else #define GET_VALUE(_x, _y) ((*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off)) | 0xff000000)) #define PUT_VALUE(_x, _y, d) { \ GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ *_ptr = d; \ } while (0) +#endif #include "spantmp2.h" /* 32 bit, ARGB8888 color spanline and pixel functions @@ -314,11 +470,19 @@ s8z24_to_z24s8(uint32_t val) #define TAG(x) radeon##x##_ARGB8888 #define TAG2(x,y) radeon##x##_ARGB8888##y +#if defined(RADEON_COMMON_FOR_R600) +#define GET_VALUE(_x, _y) (*(GLuint*)(r600_ptr_color(rrb, _x + x_off, _y + y_off))) +#define PUT_VALUE(_x, _y, d) { \ + GLuint *_ptr = (GLuint*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \ + *_ptr = d; \ +} while (0) +#else #define GET_VALUE(_x, _y) (*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))) #define PUT_VALUE(_x, _y, d) { \ GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ *_ptr = d; \ } while (0) +#endif #include "spantmp2.h" /* ================================================================ @@ -342,6 +506,9 @@ s8z24_to_z24s8(uint32_t val) #if defined(RADEON_COMMON_FOR_R200) #define WRITE_DEPTH( _x, _y, d ) \ *(GLushort *)r200_depth_2byte(rrb, _x + x_off, _y + y_off) = d +#elif defined(RADEON_COMMON_FOR_R600) +#define WRITE_DEPTH( _x, _y, d ) \ + *(GLushort *)r600_ptr_depth(rrb, _x + x_off, _y + y_off) = d #else #define WRITE_DEPTH( _x, _y, d ) \ *(GLushort *)radeon_ptr_2byte_8x2(rrb, _x + x_off, _y + y_off) = d @@ -350,6 +517,9 @@ s8z24_to_z24s8(uint32_t val) #if defined(RADEON_COMMON_FOR_R200) #define READ_DEPTH( d, _x, _y ) \ d = *(GLushort *)r200_depth_2byte(rrb, _x + x_off, _y + y_off) +#elif defined(RADEON_COMMON_FOR_R600) +#define READ_DEPTH( d, _x, _y ) \ + d = *(GLushort *)r600_ptr_depth(rrb, _x + x_off, _y + y_off) #else #define READ_DEPTH( d, _x, _y ) \ d = *(GLushort *)radeon_ptr_2byte_8x2(rrb, _x + x_off, _y + y_off) @@ -374,6 +544,15 @@ do { \ tmp |= ((d << 8) & 0xffffff00); \ *_ptr = tmp; \ } while (0) +#elif defined(RADEON_COMMON_FOR_R600) +#define WRITE_DEPTH( _x, _y, d ) \ +do { \ + GLuint *_ptr = (GLuint*)r600_ptr_depth( rrb, _x + x_off, _y + y_off ); \ + GLuint tmp = *_ptr; \ + tmp &= 0xff000000; \ + tmp |= ((d) & 0x00ffffff); \ + *_ptr = tmp; \ +} while (0) #elif defined(RADEON_COMMON_FOR_R200) #define WRITE_DEPTH( _x, _y, d ) \ do { \ @@ -399,6 +578,11 @@ do { \ do { \ d = (*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off)) & 0xffffff00) >> 8; \ }while(0) +#elif defined(RADEON_COMMON_FOR_R600) +#define READ_DEPTH( d, _x, _y ) \ + do { \ + d = (*(GLuint*)(r600_ptr_depth(rrb, _x + x_off, _y + y_off)) & 0x00ffffff); \ + }while(0) #elif defined(RADEON_COMMON_FOR_R200) #define READ_DEPTH( d, _x, _y ) \ do { \ @@ -426,6 +610,20 @@ do { \ GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ *_ptr = d; \ } while (0) +#elif defined(RADEON_COMMON_FOR_R600) +#define WRITE_DEPTH( _x, _y, d ) \ +do { \ + GLuint *_ptr = (GLuint*)r600_ptr_depth( rrb, _x + x_off, _y + y_off ); \ + GLuint tmp = *_ptr; \ + tmp &= 0xff000000; \ + tmp |= (((d) >> 8) & 0x00ffffff); \ + *_ptr = tmp; \ + _ptr = (GLuint*)r600_ptr_stencil(rrb, _x + x_off, _y + y_off); \ + tmp = *_ptr; \ + tmp &= 0xffffff00; \ + tmp |= (d) & 0xff; \ + *_ptr = tmp; \ +} while (0) #elif defined(RADEON_COMMON_FOR_R200) #define WRITE_DEPTH( _x, _y, d ) \ do { \ @@ -447,6 +645,12 @@ do { \ do { \ d = (*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))); \ }while(0) +#elif defined(RADEON_COMMON_FOR_R600) +#define READ_DEPTH( d, _x, _y ) \ + do { \ + d = ((*(GLuint*)(r600_ptr_depth(rrb, _x + x_off, _y + y_off))) << 8) & 0xffffff00; \ + d |= (*(GLuint*)(r600_ptr_stencil(rrb, _x + x_off, _y + y_off))) & 0x000000ff; \ + }while(0) #elif defined(RADEON_COMMON_FOR_R200) #define READ_DEPTH( d, _x, _y ) \ do { \ @@ -476,6 +680,15 @@ do { \ tmp |= (d) & 0xff; \ *_ptr = tmp; \ } while (0) +#elif defined(RADEON_COMMON_FOR_R600) +#define WRITE_STENCIL( _x, _y, d ) \ +do { \ + GLuint *_ptr = (GLuint*)r600_ptr_stencil(rrb, _x + x_off, _y + y_off); \ + GLuint tmp = *_ptr; \ + tmp &= 0xffffff00; \ + tmp |= (d) & 0xff; \ + *_ptr = tmp; \ +} while (0) #elif defined(RADEON_COMMON_FOR_R200) #define WRITE_STENCIL( _x, _y, d ) \ do { \ @@ -503,6 +716,13 @@ do { \ GLuint tmp = *_ptr; \ d = tmp & 0x000000ff; \ } while (0) +#elif defined(RADEON_COMMON_FOR_R600) +#define READ_STENCIL( d, _x, _y ) \ +do { \ + GLuint *_ptr = (GLuint*)r600_ptr_stencil( rrb, _x + x_off, _y + y_off ); \ + GLuint tmp = *_ptr; \ + d = tmp & 0x000000ff; \ +} while (0) #elif defined(RADEON_COMMON_FOR_R200) #define READ_STENCIL( d, _x, _y ) \ do { \ -- cgit v1.2.3 From 2cd2dc34ac93dd929ec8f01cf1f7f8dfa6b34d0d Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Tue, 15 Sep 2009 11:27:51 -0400 Subject: r600: support position_invariant programs --- src/mesa/drivers/dri/r600/r700_vertprog.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c index 8c2b0071df..9ee26286d9 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.c +++ b/src/mesa/drivers/dri/r600/r700_vertprog.c @@ -42,6 +42,7 @@ #include "radeon_debug.h" #include "r600_context.h" #include "r600_cmdbuf.h" +#include "shader/programopt.c" #include "r700_debug.h" #include "r700_vertprog.h" @@ -272,6 +273,11 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, vp = _mesa_calloc(sizeof(*vp)); vp->mesa_program = (struct gl_vertex_program *)_mesa_clone_program(ctx, &mesa_vp->Base); + if (mesa_vp->IsPositionInvariant) + { + _mesa_insert_mvp_code(ctx, vp->mesa_program); + } + for(i=0; ir700AsmCode), &(vp->r700Shader) ); - Map_Vertex_Program( vp, mesa_vp ); + Map_Vertex_Program( vp, vp->mesa_program ); - if(GL_FALSE == Find_Instruction_Dependencies_vp(vp, mesa_vp)) + if(GL_FALSE == Find_Instruction_Dependencies_vp(vp, vp->mesa_program)) { return NULL; } - if(GL_FALSE == AssembleInstr(mesa_vp->Base.NumInstructions, - &(mesa_vp->Base.Instructions[0]), + if(GL_FALSE == AssembleInstr(vp->mesa_program->Base.NumInstructions, + &(vp->mesa_program->Base.Instructions[0]), &(vp->r700AsmCode)) ) { return NULL; } - if(GL_FALSE == Process_Vertex_Exports(&(vp->r700AsmCode), mesa_vp->Base.OutputsWritten) ) + if(GL_FALSE == Process_Vertex_Exports(&(vp->r700AsmCode), vp->mesa_program->Base.OutputsWritten) ) { return NULL; } @@ -329,23 +335,23 @@ void r700SelectVertexShader(GLcontext *ctx) unsigned int unBit; unsigned int i; GLboolean match; + GLbitfield InputsRead; vpc = (struct r700_vertex_program_cont *)ctx->VertexProgram._Current; -#if 0 - if (context->radeon.NewGLState & (_NEW_PROGRAM_CONSTANTS|_NEW_PROGRAM)) + InputsRead = vpc->mesa_program.Base.InputsRead; + if (vpc->mesa_program.IsPositionInvariant) { - vpc->needUpdateVF = 1; - } -#endif - + InputsRead |= VERT_BIT_POS; + } + for (vp = vpc->progs; vp; vp = vp->next) { match = GL_TRUE; for(i=0; imesa_program.Base.InputsRead & unBit) + if(InputsRead & unBit) { if (vp->aos_desc[i].size != vb->AttribPtr[i]->size) match = GL_FALSE; -- cgit v1.2.3 From dbec27be856584bc5205c7eeeca2b7e98299d4cb Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Tue, 15 Sep 2009 16:58:37 -0400 Subject: r600: minor span cleanups --- src/mesa/drivers/dri/radeon/radeon_span.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c index aa2035338c..9959da011e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.c +++ b/src/mesa/drivers/dri/radeon/radeon_span.c @@ -113,8 +113,8 @@ static GLubyte *r200_depth_4byte(const struct radeon_renderbuffer * rrb, * only 1D tiling is implemented below */ #if defined(RADEON_COMMON_FOR_R600) -static GLint r600_1d_tile_helper(const struct radeon_renderbuffer * rrb, - GLint x, GLint y, GLint is_depth, GLint is_stencil) +static inline GLint r600_1d_tile_helper(const struct radeon_renderbuffer * rrb, + GLint x, GLint y, GLint is_depth, GLint is_stencil) { GLint element_bytes = rrb->cpp; GLint num_samples = 1; @@ -138,7 +138,7 @@ static GLint r600_1d_tile_helper(const struct radeon_renderbuffer * rrb, GLint offset = 0; tile_bytes = tile_width * tile_height * tile_thickness * element_bytes * num_samples; - tiles_per_row = pitch_elements /tile_width; + tiles_per_row = pitch_elements / tile_width; tiles_per_slice = tiles_per_row * (height / tile_height); slice_offset = (z / tile_thickness) * tiles_per_slice * tile_bytes; tile_row_index = y / tile_height; @@ -157,7 +157,6 @@ static GLint r600_1d_tile_helper(const struct radeon_renderbuffer * rrb, switch (element_bytes) { case 2: pixel_offset = pixel_number * element_bytes * num_samples; - element_offset = pixel_offset + (sample_number * element_bytes); break; case 4: /* stencil and depth data are stored separately within a tile. -- cgit v1.2.3 From ec14d59afa952b4e53ad268971098584686a6fca Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Tue, 15 Sep 2009 17:12:03 -0400 Subject: radeon: don't build non-r600 span code on r600 --- src/mesa/drivers/dri/radeon/radeon_span.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c index 9959da011e..d603f52df7 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.c +++ b/src/mesa/drivers/dri/radeon/radeon_span.c @@ -239,7 +239,7 @@ static GLubyte *r600_ptr_color(const struct radeon_renderbuffer * rrb, return &ptr[offset]; } -#endif +#else /* radeon tiling on r300-r500 has 4 states, macro-linear/micro-linear @@ -332,7 +332,10 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, return &ptr[offset]; } +#endif + #ifndef COMPILE_R300 +#ifndef COMPILE_R600 static uint32_t z24s8_to_s8z24(uint32_t val) { @@ -345,6 +348,7 @@ s8z24_to_z24s8(uint32_t val) return (val >> 24) | (val << 8); } #endif +#endif /* * Note that all information needed to access pixels in a renderbuffer -- cgit v1.2.3 From 095db818c6c7ed5706b5f31d17d0cb19c03cb67a Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Sat, 19 Sep 2009 14:46:06 -0400 Subject: r600: fix polygon offset --- src/mesa/drivers/dri/r600/r700_state.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index 2a0b419256..d8190efe47 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -1122,20 +1122,25 @@ static void r700PolygonOffset(GLcontext * ctx, GLfloat factor, GLfloat units) // context_t *context = R700_CONTEXT(ctx); R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); GLfloat constant = units; + GLchar depth = 0; + + R600_STATECHANGE(context, poly); switch (ctx->Visual.depthBits) { case 16: constant *= 4.0; + depth = -16; break; case 24: constant *= 2.0; + depth = -24; break; } factor *= 12.0; - - R600_STATECHANGE(context, poly); - + SETfield(r700->PA_SU_POLY_OFFSET_DB_FMT_CNTL.u32All, depth, + POLY_OFFSET_NEG_NUM_DB_BITS_shift, POLY_OFFSET_NEG_NUM_DB_BITS_mask); + //r700->PA_SU_POLY_OFFSET_CLAMP.f32All = constant; //??? r700->PA_SU_POLY_OFFSET_FRONT_SCALE.f32All = factor; r700->PA_SU_POLY_OFFSET_FRONT_OFFSET.f32All = constant; r700->PA_SU_POLY_OFFSET_BACK_SCALE.f32All = factor; -- cgit v1.2.3 From 48559c76056e09ca4f9e4f39e9008f6d32ecd5b0 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Sat, 19 Sep 2009 15:18:42 -0400 Subject: r600: fix point sizes registers takes radius --- src/mesa/drivers/dri/r600/r700_state.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index d8190efe47..8571563149 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -837,9 +837,9 @@ static void r700PointSize(GLcontext * ctx, GLfloat size) size = CLAMP(size, ctx->Const.MinPointSize, ctx->Const.MaxPointSize); /* format is 12.4 fixed point */ - SETfield(r700->PA_SU_POINT_SIZE.u32All, (int)(size * 16), + SETfield(r700->PA_SU_POINT_SIZE.u32All, (int)(size * 8.0), PA_SU_POINT_SIZE__HEIGHT_shift, PA_SU_POINT_SIZE__HEIGHT_mask); - SETfield(r700->PA_SU_POINT_SIZE.u32All, (int)(size * 16), + SETfield(r700->PA_SU_POINT_SIZE.u32All, (int)(size * 8.0), PA_SU_POINT_SIZE__WIDTH_shift, PA_SU_POINT_SIZE__WIDTH_mask); } @@ -854,11 +854,11 @@ static void r700PointParameter(GLcontext * ctx, GLenum pname, const GLfloat * pa /* format is 12.4 fixed point */ switch (pname) { case GL_POINT_SIZE_MIN: - SETfield(r700->PA_SU_POINT_MINMAX.u32All, (int)(ctx->Point.MinSize * 16.0), + SETfield(r700->PA_SU_POINT_MINMAX.u32All, (int)(ctx->Point.MinSize * 8.0), MIN_SIZE_shift, MIN_SIZE_mask); break; case GL_POINT_SIZE_MAX: - SETfield(r700->PA_SU_POINT_MINMAX.u32All, (int)(ctx->Point.MaxSize * 16.0), + SETfield(r700->PA_SU_POINT_MINMAX.u32All, (int)(ctx->Point.MaxSize * 8.0), MAX_SIZE_shift, MAX_SIZE_mask); break; case GL_POINT_DISTANCE_ATTENUATION: -- cgit v1.2.3 From ed91d103477d563f73be3555d1022ec9af073467 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Mon, 21 Sep 2009 10:14:25 -0400 Subject: r600: fix some issues with LIT instruction - MUL_LIT is ALU.Trans instruction - some Trans instructions can take 3 arguments - don't clobber dst.x, use dst.z as temp, it'll get written correct value in last insn - respect source swizzles --- src/mesa/drivers/dri/r600/r700_assembler.c | 69 ++++++++++++++++-------------- 1 file changed, 36 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index efeccb25f1..f46bc32201 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -2024,7 +2024,7 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) return GL_FALSE; } - if (pAsm->D.dst.math == 0) + if (uNumSrc > 1) { // Process source 1 current_source_index = 1; @@ -2880,6 +2880,11 @@ GLboolean assemble_LIT(r700_AssemblerBase *pAsm) return GL_FALSE; } + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + /* dst.y = max(src.x, 0.0) */ pAsm->D.dst.opcode = SQ_OP2_INST_MAX; pAsm->D.dst.rtype = dstType; @@ -2891,11 +2896,6 @@ GLboolean assemble_LIT(r700_AssemblerBase *pAsm) pAsm->S[0].src.rtype = srcType; pAsm->S[0].src.reg = srcReg; setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - noneg_PVSSRC(&(pAsm->S[0].src)); - pAsm->S[0].src.swizzlex = SQ_SEL_X; - pAsm->S[0].src.swizzley = SQ_SEL_X; - pAsm->S[0].src.swizzlez = SQ_SEL_X; - pAsm->S[0].src.swizzlew = SQ_SEL_X; pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; pAsm->S[1].src.reg = tmp; setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); @@ -2909,34 +2909,47 @@ GLboolean assemble_LIT(r700_AssemblerBase *pAsm) return GL_FALSE; } - /* before: dst.w = log(src.y) - * after : dst.x = log(src.y) - * why change dest register is that dst.w has been initialized as 1 before - */ + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + + swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_Y, SQ_SEL_Y, SQ_SEL_Y, SQ_SEL_Y); + + /* dst.z = log(src.y) */ pAsm->D.dst.opcode = SQ_OP2_INST_LOG_CLAMPED; pAsm->D.dst.math = 1; pAsm->D.dst.rtype = dstType; pAsm->D.dst.reg = dstReg; - pAsm->D.dst.writex = 1; + pAsm->D.dst.writex = 0; pAsm->D.dst.writey = 0; - pAsm->D.dst.writez = 0; + pAsm->D.dst.writez = 1; pAsm->D.dst.writew = 0; pAsm->S[0].src.rtype = srcType; pAsm->S[0].src.reg = srcReg; setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - noneg_PVSSRC(&(pAsm->S[0].src)); - pAsm->S[0].src.swizzlex = SQ_SEL_Y; - pAsm->S[0].src.swizzley = SQ_SEL_Y; - pAsm->S[0].src.swizzlez = SQ_SEL_Y; - pAsm->S[0].src.swizzlew = SQ_SEL_Y; if( GL_FALSE == next_ins(pAsm) ) { return GL_FALSE; } - /* before: tmp.x = amd MUL_LIT(src.w, dst.w, src.x ) */ - /* after : tmp.x = amd MUL_LIT(src.w, dst.x, src.x ) */ + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + + if( GL_FALSE == assemble_src(pAsm, 0, 2) ) + { + return GL_FALSE; + } + + swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_W, SQ_SEL_W, SQ_SEL_W, SQ_SEL_W); + + swizzleagain_PVSSRC(&(pAsm->S[2].src), SQ_SEL_X, SQ_SEL_X, SQ_SEL_X, SQ_SEL_X); + + /* tmp.x = amd MUL_LIT(src.w, dst.z, src.x ) */ pAsm->D.dst.opcode = SQ_OP3_INST_MUL_LIT; + pAsm->D.dst.math = 1; pAsm->D.dst.op3 = 1; pAsm->D.dst.rtype = DST_REG_TEMPORARY; pAsm->D.dst.reg = tmp; @@ -2948,29 +2961,19 @@ GLboolean assemble_LIT(r700_AssemblerBase *pAsm) pAsm->S[0].src.rtype = srcType; pAsm->S[0].src.reg = srcReg; setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - noneg_PVSSRC(&(pAsm->S[0].src)); - pAsm->S[0].src.swizzlex = SQ_SEL_W; - pAsm->S[0].src.swizzley = SQ_SEL_W; - pAsm->S[0].src.swizzlez = SQ_SEL_W; - pAsm->S[0].src.swizzlew = SQ_SEL_W; pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; pAsm->S[1].src.reg = dstReg; setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); noneg_PVSSRC(&(pAsm->S[1].src)); - pAsm->S[1].src.swizzlex = SQ_SEL_X; - pAsm->S[1].src.swizzley = SQ_SEL_X; - pAsm->S[1].src.swizzlez = SQ_SEL_X; - pAsm->S[1].src.swizzlew = SQ_SEL_X; + pAsm->S[1].src.swizzlex = SQ_SEL_Z; + pAsm->S[1].src.swizzley = SQ_SEL_Z; + pAsm->S[1].src.swizzlez = SQ_SEL_Z; + pAsm->S[1].src.swizzlew = SQ_SEL_Z; pAsm->S[2].src.rtype = srcType; pAsm->S[2].src.reg = srcReg; setaddrmode_PVSSRC(&(pAsm->S[2].src), ADDR_ABSOLUTE); - noneg_PVSSRC(&(pAsm->S[2].src)); - pAsm->S[2].src.swizzlex = SQ_SEL_X; - pAsm->S[2].src.swizzley = SQ_SEL_X; - pAsm->S[2].src.swizzlez = SQ_SEL_X; - pAsm->S[2].src.swizzlew = SQ_SEL_X; if( GL_FALSE == next_ins(pAsm) ) { -- cgit v1.2.3 From 28308c92605229129a12a2273dda47c6a2ca4790 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Mon, 21 Sep 2009 16:30:14 -0400 Subject: r600: various cleanups - max texture size is 8k, but mesa doesn't support that at the moment. - attempt to set shader limits to what the hw actually supports - clean up some old r300 cruft - no need to explicitly disable irqs. This is fixed in the drm now. Signed-off-by: Alex Deucher --- src/mesa/drivers/dri/r600/r600_context.c | 43 +++++++++++----------- src/mesa/drivers/dri/r600/r600_context.h | 19 ---------- .../drivers/dri/radeon/radeon_common_context.c | 7 +--- 3 files changed, 24 insertions(+), 45 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index 251c124cbf..414c5aec59 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -281,8 +281,8 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual, ctx->Const.MaxTextureMaxAnisotropy = 16.0; ctx->Const.MaxTextureLodBias = 16.0; - ctx->Const.MaxTextureLevels = 13; - ctx->Const.MaxTextureRectSize = 4096; + ctx->Const.MaxTextureLevels = 13; /* hw support 14 */ + ctx->Const.MaxTextureRectSize = 4096; /* hw support 8192 */ ctx->Const.MinPointSize = 0x0001 / 8.0; ctx->Const.MinPointSizeAA = 0x0001 / 8.0; @@ -328,25 +328,26 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual, _tnl_allow_vertex_fog(ctx, GL_TRUE); /* currently bogus data */ - ctx->Const.VertexProgram.MaxInstructions = VSF_MAX_FRAGMENT_LENGTH / 4; - ctx->Const.VertexProgram.MaxNativeInstructions = - VSF_MAX_FRAGMENT_LENGTH / 4; - ctx->Const.VertexProgram.MaxNativeAttribs = 16; /* r420 */ - ctx->Const.VertexProgram.MaxTemps = 32; - ctx->Const.VertexProgram.MaxNativeTemps = - /*VSF_MAX_FRAGMENT_TEMPS */ 32; - ctx->Const.VertexProgram.MaxNativeParameters = 256; /* r420 */ - ctx->Const.VertexProgram.MaxNativeAddressRegs = 1; - - ctx->Const.FragmentProgram.MaxNativeTemps = PFS_NUM_TEMP_REGS; - ctx->Const.FragmentProgram.MaxNativeAttribs = 11; /* copy i915... */ - ctx->Const.FragmentProgram.MaxNativeParameters = PFS_NUM_CONST_REGS; - ctx->Const.FragmentProgram.MaxNativeAluInstructions = PFS_MAX_ALU_INST; - ctx->Const.FragmentProgram.MaxNativeTexInstructions = PFS_MAX_TEX_INST; - ctx->Const.FragmentProgram.MaxNativeInstructions = - PFS_MAX_ALU_INST + PFS_MAX_TEX_INST; - ctx->Const.FragmentProgram.MaxNativeTexIndirections = - PFS_MAX_TEX_INDIRECT; + ctx->Const.VertexProgram.MaxInstructions = 8192; /* in theory no limit */ + ctx->Const.VertexProgram.MaxNativeInstructions = 8192; + ctx->Const.VertexProgram.MaxNativeAttribs = 160; + ctx->Const.VertexProgram.MaxTemps = 256; /* 256 for reg-based constants, inline consts also supported */ + ctx->Const.VertexProgram.MaxNativeTemps = 256; + ctx->Const.VertexProgram.MaxNativeParameters = 256; /* ??? */ + ctx->Const.VertexProgram.MaxNativeAddressRegs = 1; /* ??? */ + + ctx->Const.FragmentProgram.MaxNativeTemps = 256; + ctx->Const.FragmentProgram.MaxNativeAttribs = 32; + ctx->Const.FragmentProgram.MaxNativeParameters = 256; + ctx->Const.FragmentProgram.MaxNativeAluInstructions = 8192; + /* 8 per clause on r6xx, 16 on rv670/r7xx */ + if ((screen->chip_family == CHIP_FAMILY_RV670) || + (screen->chip_family >= CHIP_FAMILY_RV770)) + ctx->Const.FragmentProgram.MaxNativeTexInstructions = 16; + else + ctx->Const.FragmentProgram.MaxNativeTexInstructions = 8; + ctx->Const.FragmentProgram.MaxNativeInstructions = 8192; + ctx->Const.FragmentProgram.MaxNativeTexIndirections = 8; /* ??? */ ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* and these are?? */ ctx->VertexProgram._MaintainTnlProgram = GL_TRUE; ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; diff --git a/src/mesa/drivers/dri/r600/r600_context.h b/src/mesa/drivers/dri/r600/r600_context.h index c59df7505a..9397ecde81 100644 --- a/src/mesa/drivers/dri/r600/r600_context.h +++ b/src/mesa/drivers/dri/r600/r600_context.h @@ -86,29 +86,10 @@ extern int hw_tcl_on; #include "tnl_dd/t_dd_vertex.h" #undef TAG -#define PFS_MAX_ALU_INST 64 -#define PFS_MAX_TEX_INST 64 -#define PFS_MAX_TEX_INDIRECT 4 -#define PFS_NUM_TEMP_REGS 32 -#define PFS_NUM_CONST_REGS 16 - -#define R600_MAX_AOS_ARRAYS 16 - -#define REG_COORDS 0 -#define REG_COLOR0 1 -#define REG_TEX0 2 - #define R600_FALLBACK_NONE 0 #define R600_FALLBACK_TCL 1 #define R600_FALLBACK_RAST 2 -enum -{ - NO_SHIFT = 0, - LEFT_SHIFT = 1, - RIGHT_SHIFT = 2, -}; - struct r600_hw_state { struct radeon_state_atom sq; struct radeon_state_atom db; diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index 71ee06d9a7..330721acee 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -227,11 +227,8 @@ GLboolean radeonInitContext(radeonContextPtr radeon, fthrottle_mode = driQueryOptioni(&radeon->optionCache, "fthrottle_mode"); radeon->iw.irq_seq = -1; radeon->irqsEmitted = 0; - if (IS_R600_CLASS(radeon->radeonScreen)) - radeon->do_irqs = 0; - else - radeon->do_irqs = (fthrottle_mode == DRI_CONF_FTHROTTLE_IRQS && - radeon->radeonScreen->irq); + radeon->do_irqs = (fthrottle_mode == DRI_CONF_FTHROTTLE_IRQS && + radeon->radeonScreen->irq); radeon->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS); -- cgit v1.2.3 From 639fb1472d09281a8df3792c9bcbc59cd4424688 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Mon, 21 Sep 2009 16:48:55 -0400 Subject: r600: fix typo in the last commit 128 gprs, 256 reg-based consts --- src/mesa/drivers/dri/r600/r600_context.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index 414c5aec59..e0b77d4385 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -327,16 +327,16 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual, _tnl_allow_pixel_fog(ctx, GL_FALSE); _tnl_allow_vertex_fog(ctx, GL_TRUE); - /* currently bogus data */ + /* 256 for reg-based consts, inline consts also supported */ ctx->Const.VertexProgram.MaxInstructions = 8192; /* in theory no limit */ ctx->Const.VertexProgram.MaxNativeInstructions = 8192; ctx->Const.VertexProgram.MaxNativeAttribs = 160; - ctx->Const.VertexProgram.MaxTemps = 256; /* 256 for reg-based constants, inline consts also supported */ - ctx->Const.VertexProgram.MaxNativeTemps = 256; - ctx->Const.VertexProgram.MaxNativeParameters = 256; /* ??? */ + ctx->Const.VertexProgram.MaxTemps = 128; + ctx->Const.VertexProgram.MaxNativeTemps = 128; + ctx->Const.VertexProgram.MaxNativeParameters = 256; ctx->Const.VertexProgram.MaxNativeAddressRegs = 1; /* ??? */ - ctx->Const.FragmentProgram.MaxNativeTemps = 256; + ctx->Const.FragmentProgram.MaxNativeTemps = 128; ctx->Const.FragmentProgram.MaxNativeAttribs = 32; ctx->Const.FragmentProgram.MaxNativeParameters = 256; ctx->Const.FragmentProgram.MaxNativeAluInstructions = 8192; -- cgit v1.2.3 From 2058dfaa47704abc62aa5aa9719013624f26764d Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Wed, 23 Sep 2009 14:20:59 +0300 Subject: r600: add support for CUBE textures, also TXP seems to work here ... --- src/mesa/drivers/dri/r600/r700_assembler.c | 306 ++++++++++++++++++++++++----- src/mesa/drivers/dri/r600/r700_assembler.h | 4 + 2 files changed, 263 insertions(+), 47 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index f46bc32201..00eda544d4 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -213,7 +213,7 @@ GLboolean is_reduction_opcode(PVSDWORD* dest) { if (dest->dst.op3 == 0) { - if ( (dest->dst.opcode == SQ_OP2_INST_DOT4 || dest->dst.opcode == SQ_OP2_INST_DOT4_IEEE) ) + if ( (dest->dst.opcode == SQ_OP2_INST_DOT4 || dest->dst.opcode == SQ_OP2_INST_DOT4_IEEE || dest->dst.opcode == SQ_OP2_INST_CUBE) ) { return GL_TRUE; } @@ -350,6 +350,7 @@ unsigned int r700GetNumOperands(r700_AssemblerBase* pAsm) case SQ_OP2_INST_PRED_SETNE: case SQ_OP2_INST_DOT4: case SQ_OP2_INST_DOT4_IEEE: + case SQ_OP2_INST_CUBE: return 2; case SQ_OP2_INST_MOV: @@ -469,6 +470,9 @@ int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700 pAsm->number_of_inputs = 0; + pAsm->is_tex = GL_FALSE; + pAsm->need_tex_barrier = GL_FALSE; + return 0; } @@ -682,7 +686,7 @@ GLboolean add_tex_instruction(r700_AssemblerBase* pAsm, // If this clause constains any TEX instruction that is dependent on a previous instruction, // set the barrier bit - if( pAsm->pInstDeps[pAsm->uiCurInst].nDstDep > (-1) ) + if( pAsm->pInstDeps[pAsm->uiCurInst].nDstDep > (-1) || pAsm->need_tex_barrier == GL_TRUE ) { pAsm->cf_current_tex_clause_ptr->m_Word1.f.barrier = 0x1; } @@ -1152,42 +1156,48 @@ GLboolean tex_src(r700_AssemblerBase *pAsm) GLboolean bValidTexCoord = GL_FALSE; + if(pAsm->aArgSubst[1] >= 0) + { + bValidTexCoord = GL_TRUE; + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = pAsm->aArgSubst[1]; + } + else + { switch (pILInst->SrcReg[0].File) { - case PROGRAM_CONSTANT: - case PROGRAM_LOCAL_PARAM: - case PROGRAM_ENV_PARAM: - case PROGRAM_STATE_VAR: - bValidTexCoord = GL_TRUE; - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = pAsm->aArgSubst[1]; - break; - case PROGRAM_TEMPORARY: - bValidTexCoord = GL_TRUE; - pAsm->S[0].src.reg = pILInst->SrcReg[0].Index + - pAsm->starting_temp_register_number; - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - break; - case PROGRAM_INPUT: - switch (pILInst->SrcReg[0].Index) - { - case FRAG_ATTRIB_COL0: - case FRAG_ATTRIB_COL1: - case FRAG_ATTRIB_TEX0: - case FRAG_ATTRIB_TEX1: - case FRAG_ATTRIB_TEX2: - case FRAG_ATTRIB_TEX3: - case FRAG_ATTRIB_TEX4: - case FRAG_ATTRIB_TEX5: - case FRAG_ATTRIB_TEX6: - case FRAG_ATTRIB_TEX7: - bValidTexCoord = GL_TRUE; - pAsm->S[0].src.reg = - pAsm->uiFP_AttributeMap[pILInst->SrcReg[0].Index]; - pAsm->S[0].src.rtype = SRC_REG_INPUT; - break; - } - break; + case PROGRAM_CONSTANT: + case PROGRAM_LOCAL_PARAM: + case PROGRAM_ENV_PARAM: + case PROGRAM_STATE_VAR: + break; + case PROGRAM_TEMPORARY: + bValidTexCoord = GL_TRUE; + pAsm->S[0].src.reg = pILInst->SrcReg[0].Index + + pAsm->starting_temp_register_number; + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + break; + case PROGRAM_INPUT: + switch (pILInst->SrcReg[0].Index) + { + case FRAG_ATTRIB_COL0: + case FRAG_ATTRIB_COL1: + case FRAG_ATTRIB_TEX0: + case FRAG_ATTRIB_TEX1: + case FRAG_ATTRIB_TEX2: + case FRAG_ATTRIB_TEX3: + case FRAG_ATTRIB_TEX4: + case FRAG_ATTRIB_TEX5: + case FRAG_ATTRIB_TEX6: + case FRAG_ATTRIB_TEX7: + bValidTexCoord = GL_TRUE; + pAsm->S[0].src.reg = + pAsm->uiFP_AttributeMap[pILInst->SrcReg[0].Index]; + pAsm->S[0].src.rtype = SRC_REG_INPUT; + break; + } + break; + } } if(GL_TRUE == bValidTexCoord) @@ -1955,7 +1965,9 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) { is_single_scalar_operation = GL_FALSE; number_of_scalar_operations = 4; - + +/* current assembler doesn't do more than 1 register per source */ +#if 0 /* check read port, only very preliminary algorithm, not count in src0/1 same comp case and prev slot repeat case; also not count relative addressing. TODO: improve performance. */ @@ -1990,6 +2002,7 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) { bSplitInst = GL_TRUE; } +#endif } contiguous_slots_needed = 0; @@ -2210,9 +2223,7 @@ GLboolean next_ins(r700_AssemblerBase *pAsm) { struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); - if( GL_TRUE == IsTex(pILInst->Opcode) && - /* handle const moves to temp register */ - !(pAsm->D.dst.opcode == SQ_OP2_INST_MOV) ) + if( GL_TRUE == pAsm->is_tex ) { if (pILInst->TexSrcTarget == TEXTURE_RECT_INDEX) { if( GL_FALSE == assemble_tex_instruction(pAsm, GL_FALSE) ) @@ -2256,7 +2267,8 @@ GLboolean next_ins(r700_AssemblerBase *pAsm) pAsm->S[0].bits = 0; pAsm->S[1].bits = 0; pAsm->S[2].bits = 0; - + pAsm->is_tex = GL_FALSE; + pAsm->need_tex_barrier = GL_FALSE; return GL_TRUE; } @@ -3379,7 +3391,10 @@ GLboolean assemble_STP(r700_AssemblerBase *pAsm) GLboolean assemble_TEX(r700_AssemblerBase *pAsm) { GLboolean src_const; + GLboolean need_barrier = GL_FALSE; + checkop1(pAsm); + switch (pAsm->pILInst[pAsm->uiCurInst].SrcReg[0].File) { case PROGRAM_CONSTANT: @@ -3399,20 +3414,18 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) { if ( GL_FALSE == mov_temp(pAsm, 0) ) return GL_FALSE; + need_barrier = GL_TRUE; } switch (pAsm->pILInst[pAsm->uiCurInst].Opcode) { case OPCODE_TEX: - pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE; break; case OPCODE_TXB: radeon_error("do not support TXB yet\n"); return GL_FALSE; break; case OPCODE_TXP: - /* TODO : tex proj version : divid first 3 components by 4th */ - pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE; break; default: radeon_error("Internal error: bad texture op (not TEX)\n"); @@ -3420,6 +3433,190 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) break; } + if (pAsm->pILInst[pAsm->uiCurInst].Opcode == OPCODE_TXP) + { + GLuint tmp = gethelpr(pAsm); + pAsm->D.dst.opcode = SQ_OP2_INST_RECIP_IEEE; + pAsm->D.dst.math = 1; + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp; + pAsm->D.dst.writew = 1; + + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_W, SQ_SEL_W, SQ_SEL_W, SQ_SEL_W); + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + pAsm->D.dst.opcode = SQ_OP2_INST_MUL; + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp; + pAsm->D.dst.writex = 1; + pAsm->D.dst.writey = 1; + pAsm->D.dst.writez = 1; + pAsm->D.dst.writew = 0; + + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); + pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[1].src.reg = tmp; + setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_W); + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + pAsm->aArgSubst[1] = tmp; + need_barrier = GL_TRUE; + } + + if (pAsm->pILInst[pAsm->uiCurInst].TexSrcTarget == TEXTURE_CUBE_INDEX ) + { + GLuint tmp1 = gethelpr(pAsm); + GLuint tmp2 = gethelpr(pAsm); + + /* tmp1.xyzw = CUBE(R0.zzxy, R0.yxzz) */ + pAsm->D.dst.opcode = SQ_OP2_INST_CUBE; + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp1; + nomask_PVSDST(&(pAsm->D.dst)); + + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + + if( GL_FALSE == assemble_src(pAsm, 0, 1) ) + { + return GL_FALSE; + } + + swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_Z, SQ_SEL_Z, SQ_SEL_X, SQ_SEL_Y); + swizzleagain_PVSSRC(&(pAsm->S[1].src), SQ_SEL_Y, SQ_SEL_X, SQ_SEL_Z, SQ_SEL_Z); + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + /* tmp1.z = ABS(tmp1.z) dont have abs support in assembler currently + * have to do explicit instruction + */ + pAsm->D.dst.opcode = SQ_OP2_INST_MAX; + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp1; + pAsm->D.dst.writez = 1; + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp1; + noswizzle_PVSSRC(&(pAsm->S[0].src)); + pAsm->S[1].bits = pAsm->S[0].bits; + flipneg_PVSSRC(&(pAsm->S[1].src)); + + next_ins(pAsm); + + /* tmp1.z = RCP_e(|tmp1.z|) */ + pAsm->D.dst.opcode = SQ_OP2_INST_RECIP_IEEE; + pAsm->D.dst.math = 1; + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp1; + pAsm->D.dst.writez = 1; + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp1; + pAsm->S[0].src.swizzlex = SQ_SEL_Z; + + next_ins(pAsm); + + /* MULADD R0.x, R0.x, PS1, (0x3FC00000, 1.5f).x + * MULADD R0.y, R0.y, PS1, (0x3FC00000, 1.5f).x + * muladd has no writemask, have to use another temp + * also no support for imm constants, so add 1 here + */ + pAsm->D.dst.opcode = SQ_OP3_INST_MULADD; + pAsm->D.dst.op3 = 1; + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp2; + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp1; + noswizzle_PVSSRC(&(pAsm->S[0].src)); + setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); + pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[1].src.reg = tmp1; + setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_Z); + setaddrmode_PVSSRC(&(pAsm->S[2].src), ADDR_ABSOLUTE); + pAsm->S[2].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[2].src.reg = tmp1; + setswizzle_PVSSRC(&(pAsm->S[2].src), SQ_SEL_1); + + next_ins(pAsm); + + /* ADD the remaining .5 */ + pAsm->D.dst.opcode = SQ_OP2_INST_ADD; + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp2; + pAsm->D.dst.writex = 1; + pAsm->D.dst.writey = 1; + pAsm->D.dst.writez = 0; + pAsm->D.dst.writew = 0; + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp2; + noswizzle_PVSSRC(&(pAsm->S[0].src)); + setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); + pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[1].src.reg = 252; // SQ_ALU_SRC_0_5 + noswizzle_PVSSRC(&(pAsm->S[1].src)); + + next_ins(pAsm); + + /* tmp1.xy = temp2.xy */ + pAsm->D.dst.opcode = SQ_OP2_INST_MOV; + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp1; + pAsm->D.dst.writex = 1; + pAsm->D.dst.writey = 1; + pAsm->D.dst.writez = 0; + pAsm->D.dst.writew = 0; + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp2; + noswizzle_PVSSRC(&(pAsm->S[0].src)); + + next_ins(pAsm); + pAsm->aArgSubst[1] = tmp1; + need_barrier = GL_TRUE; + + } + + pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE; + pAsm->is_tex = GL_TRUE; + if ( GL_TRUE == need_barrier ) + { + pAsm->need_tex_barrier = GL_TRUE; + } // Set src1 to tex unit id pAsm->S[1].src.reg = pAsm->pILInst[pAsm->uiCurInst].TexSrcUnit; pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; @@ -3440,10 +3637,25 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) return GL_FALSE; } - if ( GL_FALSE == next_ins(pAsm) ) + if(pAsm->pILInst[pAsm->uiCurInst].Opcode == OPCODE_TXP) { - return GL_FALSE; + /* hopefully did swizzles before */ + noswizzle_PVSSRC(&(pAsm->S[0].src)); } + + if(pAsm->pILInst[pAsm->uiCurInst].TexSrcTarget == TEXTURE_CUBE_INDEX) + { + /* SAMPLE dst, tmp.yxwy, CUBE */ + pAsm->S[0].src.swizzlex = SQ_SEL_Y; + pAsm->S[0].src.swizzley = SQ_SEL_X; + pAsm->S[0].src.swizzlez = SQ_SEL_W; + pAsm->S[0].src.swizzlew = SQ_SEL_Y; + } + + if ( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } return GL_TRUE; } diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index f9c4d849c6..73bb8bac55 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -374,6 +374,10 @@ typedef struct r700_AssemblerBase struct prog_instruction * pILInst; GLuint uiCurInst; GLboolean bR6xx; + /* helper to decide which type of instruction to assemble */ + GLboolean is_tex; + /* we inserted helper intructions and need barrier on next TEX ins */ + GLboolean need_tex_barrier; } r700_AssemblerBase; //Internal use -- cgit v1.2.3 From 41c5f113b5d41649db2027c3f32deaf4d38035ce Mon Sep 17 00:00:00 2001 From: Richard Li Date: Thu, 24 Sep 2009 10:12:40 -0400 Subject: r600 : disable draw_prim for now. --- src/mesa/drivers/dri/r600/r700_render.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index bbe364bc6a..5627984cf9 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -1145,8 +1145,11 @@ static void r700DrawPrims(GLcontext *ctx, void r700InitDraw(GLcontext *ctx) { struct vbo_context *vbo = vbo_context(ctx); - + + /* to be enabled */ + /* vbo->draw_prims = r700DrawPrims; + */ } -- cgit v1.2.3 From e8e6d8853df19f7a32fb0e4f670259ee65e88b29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 24 Sep 2009 15:27:03 +0100 Subject: softpipe: Update SConscript. --- src/gallium/drivers/softpipe/SConscript | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/SConscript b/src/gallium/drivers/softpipe/SConscript index 153fe44546..950c3d9955 100644 --- a/src/gallium/drivers/softpipe/SConscript +++ b/src/gallium/drivers/softpipe/SConscript @@ -7,22 +7,16 @@ softpipe = env.ConvenienceLibrary( source = [ 'sp_fs_exec.c', 'sp_fs_sse.c', - 'sp_fs_llvm.c', 'sp_clear.c', 'sp_context.c', 'sp_draw_arrays.c', 'sp_flush.c', 'sp_prim_vbuf.c', 'sp_setup.c', - 'sp_quad_alpha_test.c', 'sp_quad_blend.c', 'sp_quad_pipe.c', - 'sp_quad_coverage.c', 'sp_quad_depth_test.c', - 'sp_quad_earlyz.c', 'sp_quad_fs.c', - 'sp_quad_occlusion.c', - 'sp_quad_stencil.c', 'sp_quad_stipple.c', 'sp_query.c', 'sp_screen.c', -- cgit v1.2.3 From 9659aa6482291d1530c74450612bcd952f542e01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 24 Sep 2009 15:27:19 +0100 Subject: softpipe: Use portable INLINE macro. --- src/gallium/drivers/softpipe/sp_tex_sample.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index 2092a69740..c22ee86b66 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -983,7 +983,7 @@ img_filter_2d_nearest(struct tgsi_sampler *tgsi_sampler, } -static inline union tex_tile_address +static INLINE union tex_tile_address face(union tex_tile_address addr, unsigned face ) { addr.bits.face = face; -- cgit v1.2.3 From 5f06064b616099712dbb2854351d0740c1dbfc60 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Thu, 24 Sep 2009 11:26:15 -0400 Subject: r600 : fix draw_prim bug: vertex fetcher setting. --- src/mesa/drivers/dri/r600/r700_chip.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index 783427a94c..e3b8a4081a 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -254,9 +254,22 @@ static void r700SetupVTXConstants2(GLcontext * ctx, SETfield(uSQ_VTX_CONSTANT_WORD2_0, GetSurfaceFormat(pStreamDesc->type, pStreamDesc->size, NULL), SQ_VTX_CONSTANT_WORD2_0__DATA_FORMAT_shift, SQ_VTX_CONSTANT_WORD2_0__DATA_FORMAT_mask); /* TODO : trace back api for initial data type, not only GL_FLOAT */ - SETfield(uSQ_VTX_CONSTANT_WORD2_0, SQ_NUM_FORMAT_SCALED, - SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask); - SETbit(uSQ_VTX_CONSTANT_WORD2_0, SQ_VTX_CONSTANT_WORD2_0__FORMAT_COMP_ALL_bit); + + if(GL_TRUE == pStreamDesc->normalize) + { + SETfield(uSQ_VTX_CONSTANT_WORD2_0, SQ_NUM_FORMAT_NORM, + SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask); + } + //else + //{ + // SETfield(uSQ_VTX_CONSTANT_WORD2_0, SQ_NUM_FORMAT_INT, + // SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask); + //} + + if(1 == pStreamDesc->_signed) + { + SETbit(uSQ_VTX_CONSTANT_WORD2_0, SQ_VTX_CONSTANT_WORD2_0__FORMAT_COMP_ALL_bit); + } SETfield(uSQ_VTX_CONSTANT_WORD3_0, 1, MEM_REQUEST_SIZE_shift, MEM_REQUEST_SIZE_mask); SETfield(uSQ_VTX_CONSTANT_WORD6_0, SQ_TEX_VTX_VALID_BUFFER, -- cgit v1.2.3 From cd362334adfee077faa3b7cb4e0d7994d5a5cf56 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 24 Sep 2009 16:44:58 +0100 Subject: draw: fix warning --- src/gallium/auxiliary/draw/draw_pt_post_vs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pt_post_vs.c b/src/gallium/auxiliary/draw/draw_pt_post_vs.c index 00d7197b13..e25f16c354 100644 --- a/src/gallium/auxiliary/draw/draw_pt_post_vs.c +++ b/src/gallium/auxiliary/draw/draw_pt_post_vs.c @@ -104,7 +104,7 @@ static boolean post_vs_cliptest_viewport_gl( struct pt_post_vs *pvs, unsigned clipped = 0; unsigned j; - if (0) debug_printf("%s\n"); + if (0) debug_printf("%s\n", __FUNCTION__); for (j = 0; j < count; j++) { float *position = out->data[pos]; -- cgit v1.2.3 From 0c55dd8094cad716c4b30316b5c8f0d9a0b72905 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 24 Sep 2009 16:48:49 +0100 Subject: pipebuffer: fix warnings --- src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c index 109ac7c9d6..d01f866622 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c @@ -542,7 +542,7 @@ fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list) debug_printf("%10p %7u %7u\n", fenced_buf, fenced_buf->base.base.size, - fenced_buf->base.base.reference.count); + p_atomic_read(&fenced_buf->base.base.reference.count)); curr = next; next = curr->next; } @@ -556,7 +556,7 @@ fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list) debug_printf("%10p %7u %7u %10p %s\n", fenced_buf, fenced_buf->base.base.size, - fenced_buf->base.base.reference.count, + p_atomic_read(&fenced_buf->base.base.reference.count), fenced_buf->fence, signaled == 0 ? "y" : "n"); curr = next; -- cgit v1.2.3 From fca7f384418fa6e353d41b2e05117e0553526053 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 24 Sep 2009 16:49:05 +0100 Subject: pipebuffer: fix printf warnings --- src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c index 1b4df28c70..6e3214ca9c 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_debug.c @@ -350,7 +350,7 @@ pb_debug_manager_dump(struct pb_debug_manager *mgr) buf = LIST_ENTRY(struct pb_debug_buffer, curr, head); debug_printf("buffer = %p\n", buf); - debug_printf(" .size = %p\n", buf->base.base.size); + debug_printf(" .size = 0x%x\n", buf->base.base.size); debug_backtrace_dump(buf->create_backtrace, PB_DEBUG_CREATE_BACKTRACE); curr = next; -- cgit v1.2.3 From d3beaf2f32044b36e2ffaf27679ddd1e5115df3f Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 24 Sep 2009 16:49:27 +0100 Subject: softpipe: fix compiler warnings --- src/gallium/drivers/softpipe/sp_tex_tile_cache.h | 2 +- src/gallium/drivers/softpipe/sp_tile_cache.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.h b/src/gallium/drivers/softpipe/sp_tex_tile_cache.h index 04e65ce220..ac6886a3df 100644 --- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.h +++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.h @@ -116,7 +116,7 @@ extern const struct softpipe_tex_cached_tile * sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc, union tex_tile_address addr ); -static INLINE const union tex_tile_address +static INLINE union tex_tile_address tex_tile_address( unsigned x, unsigned y, unsigned z, diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.h b/src/gallium/drivers/softpipe/sp_tile_cache.h index f21c74cb9c..a12092702a 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.h +++ b/src/gallium/drivers/softpipe/sp_tile_cache.h @@ -128,7 +128,7 @@ sp_find_cached_tile(struct softpipe_tile_cache *tc, union tile_address addr ); -static INLINE const union tile_address +static INLINE union tile_address tile_address( unsigned x, unsigned y ) { -- cgit v1.2.3 From 90dcfb3b47c13044d671b8a1ab0c96ab2d21ea4d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 24 Sep 2009 16:49:40 +0100 Subject: trace: fix printf warnings --- src/gallium/drivers/trace/tr_context.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index ae0af4d055..4940ce62a6 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -125,11 +125,11 @@ trace_context_draw_block(struct trace_context *tr_ctx, int flag) } else if ((tr_ctx->draw_rule.blocker & flag) && (tr_ctx->draw_blocker & 4)) { boolean block = FALSE; - debug_printf("%s (%lu %lu) (%lu %lu) (%lu %u) (%lu %u)\n", __FUNCTION__, - tr_ctx->draw_rule.fs, tr_ctx->curr.fs, - tr_ctx->draw_rule.vs, tr_ctx->curr.vs, - tr_ctx->draw_rule.surf, 0, - tr_ctx->draw_rule.tex, 0); + debug_printf("%s (%p %p) (%p %p) (%p %u) (%p %u)\n", __FUNCTION__, + tr_ctx->draw_rule.fs, tr_ctx->curr.fs, + tr_ctx->draw_rule.vs, tr_ctx->curr.vs, + tr_ctx->draw_rule.surf, 0, + tr_ctx->draw_rule.tex, 0); if (tr_ctx->draw_rule.fs && tr_ctx->draw_rule.fs == tr_ctx->curr.fs) block = TRUE; -- cgit v1.2.3 From e44c084be536c021985a8908db4300c764c63bbc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 23 Sep 2009 15:44:02 -0600 Subject: glsl: fix missing initializers warning --- src/mesa/shader/slang/slang_builtin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_builtin.c b/src/mesa/shader/slang/slang_builtin.c index bef0f85653..e5809509c9 100644 --- a/src/mesa/shader/slang/slang_builtin.c +++ b/src/mesa/shader/slang/slang_builtin.c @@ -741,7 +741,7 @@ static const struct input_info vertInputs[] = { { "gl_MultiTexCoord5", VERT_ATTRIB_TEX5, GL_FLOAT_VEC4, SWIZZLE_NOOP }, { "gl_MultiTexCoord6", VERT_ATTRIB_TEX6, GL_FLOAT_VEC4, SWIZZLE_NOOP }, { "gl_MultiTexCoord7", VERT_ATTRIB_TEX7, GL_FLOAT_VEC4, SWIZZLE_NOOP }, - { NULL, 0, SWIZZLE_NOOP } + { NULL, 0, GL_NONE, SWIZZLE_NOOP } }; /** Predefined fragment shader inputs */ @@ -754,7 +754,7 @@ static const struct input_info fragInputs[] = { { "gl_FogFragCoord", FRAG_ATTRIB_FOGC, GL_FLOAT, SWIZZLE_XXXX }, { "gl_FrontFacing", FRAG_ATTRIB_FACE, GL_FLOAT, SWIZZLE_XXXX }, { "gl_PointCoord", FRAG_ATTRIB_PNTC, GL_FLOAT_VEC2, SWIZZLE_XYZW }, - { NULL, 0, SWIZZLE_NOOP } + { NULL, 0, GL_NONE, SWIZZLE_NOOP } }; -- cgit v1.2.3 From 00ddd4f9e9680132872f98f2d18b52dfc30c6f2f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 23 Sep 2009 15:44:18 -0600 Subject: glsl: init var to silence warning --- src/mesa/shader/slang/slang_codegen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 349f432dec..703af9f874 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -2775,7 +2775,7 @@ _slang_gen_while(slang_assemble_ctx * A, slang_operation *oper) * body code (child[1]) */ slang_ir_node *loop, *breakIf, *body; - GLboolean isConst, constTrue; + GLboolean isConst, constTrue = GL_FALSE; if (!A->EmitContReturn) { /* We don't want to emit CONT instructions. If this while-loop has -- cgit v1.2.3 From a491e25b1fa8683f538ed0d67a6389f2cdf7e4bc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 23 Sep 2009 15:44:37 -0600 Subject: mesa: added default case return to silence warning --- src/mesa/main/texenvprogram.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 2f3e47e69e..d7e77e759e 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -276,6 +276,7 @@ need_saturate( GLuint mode ) return GL_TRUE; default: assert(0); + return GL_FALSE; } } -- cgit v1.2.3 From a64d4516a0d6219dec0b5b0622215918469faecc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 24 Sep 2009 10:26:56 -0600 Subject: tgsi/sse: Pass the lodbias, not zero. More comments. This fixes the glean/glsl1 "texture2D(), with bias" test when using SSE. --- src/gallium/auxiliary/tgsi/tgsi_sse2.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index 3cdf8b9f35..1e719940ec 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -1431,11 +1431,11 @@ fetch_texel( struct tgsi_sampler **sampler, { float rgba[NUM_CHANNELS][QUAD_SIZE]; (*sampler)->get_samples(*sampler, - &store[0], - &store[4], - &store[8], - 0.0f, /*store[12], lodbias */ - rgba); + &store[0], /* s */ + &store[4], /* t */ + &store[8], /* r */ + store[12], /* lodbias */ + rgba); /* results */ memcpy( store, rgba, 16 * sizeof(float)); } -- cgit v1.2.3 From 35cd0bbfb171d200b8100e9f79a55c9981c946aa Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 24 Sep 2009 09:51:05 -0600 Subject: tgsi/sse: implement SEQ, SGT, SLE, SNE --- src/gallium/auxiliary/tgsi/tgsi_sse2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index 501fc05e72..fe76c8c840 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -2291,7 +2291,7 @@ emit_instruction( break; case TGSI_OPCODE_SEQ: - return 0; + emit_setcc( func, inst, cc_Equal ); break; case TGSI_OPCODE_SFL: @@ -2299,7 +2299,7 @@ emit_instruction( break; case TGSI_OPCODE_SGT: - return 0; + emit_setcc( func, inst, cc_NotLessThanEqual ); break; case TGSI_OPCODE_SIN: @@ -2311,11 +2311,11 @@ emit_instruction( break; case TGSI_OPCODE_SLE: - return 0; + emit_setcc( func, inst, cc_LessThanEqual ); break; case TGSI_OPCODE_SNE: - return 0; + emit_setcc( func, inst, cc_NotEqual ); break; case TGSI_OPCODE_STR: -- cgit v1.2.3 From f85816354c9538e3b1082f019c4c65c56a8bd77f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 24 Sep 2009 09:54:36 -0600 Subject: tgsi/sse: remove old comments --- src/gallium/auxiliary/tgsi/tgsi_sse2.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index fe76c8c840..6f1532ad20 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -1855,7 +1855,6 @@ emit_instruction( break; case TGSI_OPCODE_RCP: - /* TGSI_OPCODE_RECIP */ FETCH( func, *inst, 0, 0, CHAN_X ); emit_rcp( func, 0, 0 ); FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) { @@ -1864,7 +1863,6 @@ emit_instruction( break; case TGSI_OPCODE_RSQ: - /* TGSI_OPCODE_RECIPSQRT */ FETCH( func, *inst, 0, 0, CHAN_X ); emit_abs( func, 0 ); emit_rsqrt( func, 1, 0 ); @@ -1962,7 +1960,6 @@ emit_instruction( break; case TGSI_OPCODE_DP3: - /* TGSI_OPCODE_DOT3 */ FETCH( func, *inst, 0, 0, CHAN_X ); FETCH( func, *inst, 1, 1, CHAN_X ); emit_mul( func, 0, 1 ); @@ -1980,7 +1977,6 @@ emit_instruction( break; case TGSI_OPCODE_DP4: - /* TGSI_OPCODE_DOT4 */ FETCH( func, *inst, 0, 0, CHAN_X ); FETCH( func, *inst, 1, 1, CHAN_X ); emit_mul( func, 0, 1 ); @@ -2051,17 +2047,14 @@ emit_instruction( break; case TGSI_OPCODE_SLT: - /* TGSI_OPCODE_SETLT */ emit_setcc( func, inst, cc_LessThan ); break; case TGSI_OPCODE_SGE: - /* TGSI_OPCODE_SETGE */ emit_setcc( func, inst, cc_NotLessThan ); break; case TGSI_OPCODE_MAD: - /* TGSI_OPCODE_MADD */ FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( func, *inst, 0, 0, chan_index ); FETCH( func, *inst, 1, 1, chan_index ); @@ -2379,7 +2372,6 @@ emit_instruction( break; case TGSI_OPCODE_SSG: - /* TGSI_OPCODE_SGN */ FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( func, *inst, 0, 0, chan_index ); emit_sgn( func, 0, 0 ); -- cgit v1.2.3 From 6be2bc56af5c0d281d07e427863789e949904db1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 24 Sep 2009 10:47:42 -0600 Subject: gallium/trace: casts to silence warnings --- src/gallium/drivers/trace/tr_context.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 4940ce62a6..bf470b46ae 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -126,10 +126,10 @@ trace_context_draw_block(struct trace_context *tr_ctx, int flag) (tr_ctx->draw_blocker & 4)) { boolean block = FALSE; debug_printf("%s (%p %p) (%p %p) (%p %u) (%p %u)\n", __FUNCTION__, - tr_ctx->draw_rule.fs, tr_ctx->curr.fs, - tr_ctx->draw_rule.vs, tr_ctx->curr.vs, - tr_ctx->draw_rule.surf, 0, - tr_ctx->draw_rule.tex, 0); + (void *) tr_ctx->draw_rule.fs, (void *) tr_ctx->curr.fs, + (void *) tr_ctx->draw_rule.vs, (void *) tr_ctx->curr.vs, + (void *) tr_ctx->draw_rule.surf, 0, + (void *) tr_ctx->draw_rule.tex, 0); if (tr_ctx->draw_rule.fs && tr_ctx->draw_rule.fs == tr_ctx->curr.fs) block = TRUE; -- cgit v1.2.3 From 1d2dca194cebe6e25735b6820f85b8d1231aae63 Mon Sep 17 00:00:00 2001 From: Pauli Nieminen Date: Thu, 24 Sep 2009 19:58:09 +0300 Subject: radeon: Fix scissors for r600 KMS. Radeon generic scissors code had problem that some of code was using exclusive and some inclusive bottom right corner. Only r600 driver is using exclusive coordinate so changed generic code to pass inclusive coordinate and r600 driver changes BR coordinate to be exclusive. --- src/mesa/drivers/dri/r600/r700_state.c | 5 +++-- src/mesa/drivers/dri/radeon/radeon_common.c | 8 ++++---- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index 8571563149..124469b5a6 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -1269,10 +1269,11 @@ void r700SetScissor(context_t *context) //--------------- return; } if (context->radeon.state.scissor.enabled) { + /* r600 has exclusive scissors */ x1 = context->radeon.state.scissor.rect.x1; y1 = context->radeon.state.scissor.rect.y1; - x2 = context->radeon.state.scissor.rect.x2; - y2 = context->radeon.state.scissor.rect.y2; + x2 = context->radeon.state.scissor.rect.x2 + 1; + y2 = context->radeon.state.scissor.rect.y2 + 1; } else { if (context->radeon.radeonScreen->driScreen->dri2.enabled) { x1 = 0; diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index a4c7b40798..9817ff856b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -232,13 +232,13 @@ void radeonUpdateScissor( GLcontext *ctx ) __DRIdrawablePrivate *dPriv = radeon_get_drawable(rmesa); x1 += dPriv->x; - x2 += dPriv->x + 1; + x2 += dPriv->x; min_x += dPriv->x; - max_x += dPriv->x + 1; + max_x += dPriv->x; y1 += dPriv->y; - y2 += dPriv->y + 1; + y2 += dPriv->y; min_y += dPriv->y; - max_y += dPriv->y + 1; + max_y += dPriv->y; } rmesa->state.scissor.rect.x1 = CLAMP(x1, min_x, max_x); -- cgit v1.2.3 From 1a816117258e594a073f6925edfcd2387071904d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 24 Sep 2009 12:35:51 -0600 Subject: vbo: limit number of warnings to 10 Otherwise some apps will emit tons of warnings. --- src/mesa/vbo/vbo_exec_array.c | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 3f0656a816..39c2957631 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -667,6 +667,7 @@ vbo_exec_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) { + static GLuint warnCount = 0; GET_CURRENT_CONTEXT(ctx); if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, @@ -675,15 +676,19 @@ vbo_exec_DrawRangeElements(GLenum mode, if (end >= ctx->Array.ArrayObj->_MaxElement) { /* the max element is out of bounds of one or more enabled arrays */ - _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, count %d, " - "type 0x%x, indices=%p)\n" - "\tend is out of bounds (max=%u) " - "Element Buffer %u (size %d)\n" - "\tThis should probably be fixed in the application.", - start, end, count, type, indices, - ctx->Array.ArrayObj->_MaxElement - 1, - ctx->Array.ElementArrayBufferObj->Name, - ctx->Array.ElementArrayBufferObj->Size); + warnCount++; + + if (warnCount < 10) { + _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, count %d, " + "type 0x%x, indices=%p)\n" + "\tend is out of bounds (max=%u) " + "Element Buffer %u (size %d)\n" + "\tThis should probably be fixed in the application.", + start, end, count, type, indices, + ctx->Array.ArrayObj->_MaxElement - 1, + ctx->Array.ElementArrayBufferObj->Name, + ctx->Array.ElementArrayBufferObj->Size); + } if (0) dump_element_buffer(ctx, type); @@ -700,15 +705,17 @@ vbo_exec_DrawRangeElements(GLenum mode, GLuint max = _mesa_max_buffer_index(ctx, count, type, indices, ctx->Array.ElementArrayBufferObj); if (max >= ctx->Array.ArrayObj->_MaxElement) { - _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, " - "count %d, type 0x%x, indices=%p)\n" - "\tindex=%u is out of bounds (max=%u) " - "Element Buffer %u (size %d)\n" - "\tSkipping the glDrawRangeElements() call", - start, end, count, type, indices, max, - ctx->Array.ArrayObj->_MaxElement - 1, - ctx->Array.ElementArrayBufferObj->Name, - ctx->Array.ElementArrayBufferObj->Size); + if (warnCount < 10) { + _mesa_warning(ctx, "glDraw[Range]Elements(start %u, end %u, " + "count %d, type 0x%x, indices=%p)\n" + "\tindex=%u is out of bounds (max=%u) " + "Element Buffer %u (size %d)\n" + "\tSkipping the glDrawRangeElements() call", + start, end, count, type, indices, max, + ctx->Array.ArrayObj->_MaxElement - 1, + ctx->Array.ElementArrayBufferObj->Name, + ctx->Array.ElementArrayBufferObj->Size); + } return; } /* XXX we could also find the min index and compare to 'start' -- cgit v1.2.3 From 964792b0250ece9fe585a4a02544f0e9c4d453a0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 24 Sep 2009 12:37:06 -0600 Subject: mesa: added comment --- src/mesa/shader/prog_parameter.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c index 6b9e73b2cb..2f029b02e5 100644 --- a/src/mesa/shader/prog_parameter.c +++ b/src/mesa/shader/prog_parameter.c @@ -100,6 +100,7 @@ _mesa_free_parameter_list(struct gl_program_parameter_list *paramList) * \param type type of parameter, such as * \param name the parameter name, will be duplicated/copied! * \param size number of elements in 'values' vector (1..4, or more) + * \param datatype GL_FLOAT, GL_FLOAT_VECx, GL_INT, GL_INT_VECx or GL_NONE. * \param values initial parameter value, up to 4 GLfloats, or NULL * \param state state indexes, or NULL * \return index of new parameter in the list, or -1 if error (out of mem) -- cgit v1.2.3 From f0339f502cf96499bc5cac8c0611f76f3fd39461 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 24 Sep 2009 12:37:34 -0600 Subject: mesa: replace assertion with no-op function assignment --- src/mesa/main/texrender.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c index cc74d58fbd..53be83b05c 100644 --- a/src/mesa/main/texrender.c +++ b/src/mesa/main/texrender.c @@ -397,6 +397,14 @@ texture_put_mono_values(GLcontext *ctx, struct gl_renderbuffer *rb, } +static void +store_nop(struct gl_texture_image *texImage, + GLint col, GLint row, GLint img, + const void *texel) +{ +} + + static void delete_texture_wrapper(struct gl_renderbuffer *rb) { @@ -462,7 +470,10 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att) ASSERT(trb->TexImage); trb->Store = trb->TexImage->TexFormat->StoreTexel; - ASSERT(trb->Store); + if (!trb->Store) { + /* we'll never draw into some textures (compressed formats) */ + trb->Store = store_nop; + } if (att->Texture->Target == GL_TEXTURE_1D_ARRAY_EXT) { trb->Yoffset = att->Zoffset; -- cgit v1.2.3 From b849c6f1b3b38a68fae32d4dea16dd7431e41b6e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 24 Sep 2009 12:41:14 -0600 Subject: intel: use default array/element buffers in intel_generate_mipmap() If there happened to be a bound VBO when intel_generate_mipmap() was called we blew up because of a bad vertex array pointer. Fixes regnumonline, bug 23859. --- src/mesa/drivers/dri/intel/intel_generatemipmap.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_generatemipmap.c b/src/mesa/drivers/dri/intel/intel_generatemipmap.c index fe986092db..12059e122c 100644 --- a/src/mesa/drivers/dri/intel/intel_generatemipmap.c +++ b/src/mesa/drivers/dri/intel/intel_generatemipmap.c @@ -125,6 +125,8 @@ intel_generate_mipmap_2d(GLcontext *ctx, GLuint fb_name; GLboolean success = GL_FALSE; struct gl_framebuffer *saved_fbo = NULL; + struct gl_buffer_object *saved_array_buffer = NULL; + struct gl_buffer_object *saved_element_buffer = NULL; _mesa_PushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT | GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT | @@ -133,6 +135,16 @@ intel_generate_mipmap_2d(GLcontext *ctx, old_active_texture = ctx->Texture.CurrentUnit; _mesa_reference_framebuffer(&saved_fbo, ctx->DrawBuffer); + /* use default array/index buffers */ + _mesa_reference_buffer_object(ctx, &saved_array_buffer, + ctx->Array.ArrayBufferObj); + _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, + ctx->Shared->NullBufferObj); + _mesa_reference_buffer_object(ctx, &saved_element_buffer, + ctx->Array.ElementArrayBufferObj); + _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj, + ctx->Shared->NullBufferObj); + _mesa_Disable(GL_POLYGON_STIPPLE); _mesa_Disable(GL_DEPTH_TEST); _mesa_Disable(GL_STENCIL_TEST); @@ -205,6 +217,15 @@ fail: meta_restore_fragment_program(&intel->meta); meta_restore_vertex_program(&intel->meta); + /* restore array/index buffers */ + _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, + saved_array_buffer); + _mesa_reference_buffer_object(ctx, &saved_array_buffer, NULL); + _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj, + saved_element_buffer); + _mesa_reference_buffer_object(ctx, &saved_element_buffer, NULL); + + _mesa_DeleteFramebuffersEXT(1, &fb_name); _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture); if (saved_fbo) -- cgit v1.2.3 From adfa778c8ea436d6e62c37327b44f6ff359ed63f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 24 Sep 2009 14:19:06 -0600 Subject: mesa: remove rgbMode check in enable_texture() If the currently bound FBO isn't yet validated it's possible for rgbMode to be zero so we'll lose the texture enable. This could fix some FBO rendering glitches, but I don't know of any specific instances. --- src/mesa/main/enable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index f432be183c..47d19ab932 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -231,7 +231,7 @@ enable_texture(GLcontext *ctx, GLboolean state, GLbitfield bit) const GLuint newenabled = (!state) ? (texUnit->Enabled & ~bit) : (texUnit->Enabled | bit); - if (!ctx->DrawBuffer->Visual.rgbMode || texUnit->Enabled == newenabled) + if (texUnit->Enabled == newenabled) return GL_FALSE; FLUSH_VERTICES(ctx, _NEW_TEXTURE); -- cgit v1.2.3 From 60b152a1b366b1c9b9326dda1d91ab600fbb0d86 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 24 Sep 2009 14:24:14 -0600 Subject: mesa: remove glEnable(GL_DEPTH_BOUNDS_TEST_EXT) check/warning At the time of the enable there may not be a Z buffer, but one may be attached to the FBO later. --- src/mesa/main/enable.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src') diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 47d19ab932..d1b21756fe 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -933,11 +933,6 @@ _mesa_set_enable(GLcontext *ctx, GLenum cap, GLboolean state) /* GL_EXT_depth_bounds_test */ case GL_DEPTH_BOUNDS_TEST_EXT: CHECK_EXTENSION(EXT_depth_bounds_test, cap); - if (state && ctx->DrawBuffer->Visual.depthBits == 0) { - _mesa_warning(ctx, - "glEnable(GL_DEPTH_BOUNDS_TEST_EXT) but no depth buffer"); - return; - } if (ctx->Depth.BoundsTest == state) return; FLUSH_VERTICES(ctx, _NEW_DEPTH); -- cgit v1.2.3 From 601769a2c0071e23ade32de4e8911d75d7f324d2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 23 Sep 2009 16:49:52 -0700 Subject: mesa: Initialize NV_vertex_program fields for the parameter lists and such. This helps let drivers treat NV_vp like ARB_vp. --- src/mesa/shader/nvprogram.c | 28 ++++++++++++++++++++++++++++ src/mesa/shader/nvprogram.h | 2 ++ src/mesa/shader/nvvertparse.c | 25 +++++++++++++++++++++++++ 3 files changed, 55 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/nvprogram.c b/src/mesa/shader/nvprogram.c index d6469b17be..fdb2f4210a 100644 --- a/src/mesa/shader/nvprogram.c +++ b/src/mesa/shader/nvprogram.c @@ -511,6 +511,34 @@ _mesa_GetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid **pointer) +void +_mesa_setup_nv_temporary_count(GLcontext *ctx, struct gl_program *program) +{ + int i; + + program->NumTemporaries = 0; + for (i = 0; i < program->NumInstructions; i++) { + struct prog_instruction *inst = &program->Instructions[i]; + + if (inst->DstReg.File == PROGRAM_TEMPORARY) { + program->NumTemporaries = MAX2(program->NumTemporaries, + inst->DstReg.Index + 1); + } + if (inst->SrcReg[0].File == PROGRAM_TEMPORARY) { + program->NumTemporaries = MAX2(program->NumTemporaries, + inst->SrcReg[0].Index + 1); + } + if (inst->SrcReg[1].File == PROGRAM_TEMPORARY) { + program->NumTemporaries = MAX2(program->NumTemporaries, + inst->SrcReg[1].Index + 1); + } + if (inst->SrcReg[2].File == PROGRAM_TEMPORARY) { + program->NumTemporaries = MAX2(program->NumTemporaries, + inst->SrcReg[2].Index + 1); + } + } +} + /** * Load/parse/compile a program. * \note Called from the GL API dispatcher. diff --git a/src/mesa/shader/nvprogram.h b/src/mesa/shader/nvprogram.h index bfac165b5e..0ed143d52f 100644 --- a/src/mesa/shader/nvprogram.h +++ b/src/mesa/shader/nvprogram.h @@ -103,5 +103,7 @@ extern void GLAPIENTRY _mesa_GetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte *name, GLdouble *params); +extern void +_mesa_setup_nv_temporary_count(GLcontext *ctx, struct gl_program *program); #endif diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/shader/nvvertparse.c index f5e2df2670..a94e6b8b80 100644 --- a/src/mesa/shader/nvvertparse.c +++ b/src/mesa/shader/nvvertparse.c @@ -44,6 +44,7 @@ #include "nvprogram.h" #include "nvvertparse.h" #include "prog_instruction.h" +#include "prog_parameter.h" #include "prog_print.h" #include "program.h" @@ -1345,6 +1346,9 @@ _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget, if (Parse_Program(&parseState, instBuffer)) { + gl_state_index state_tokens[STATE_LENGTH] = {0, 0, 0, 0, 0}; + int i; + /* successful parse! */ if (parseState.isStateProgram) { @@ -1398,6 +1402,27 @@ _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget, _mesa_fprint_program_opt(stdout, &program->Base, PROG_PRINT_NV, 0); _mesa_printf("------------------------------\n"); #endif + + if (program->Base.Parameters) + _mesa_free_parameter_list(program->Base.Parameters); + + program->Base.Parameters = _mesa_new_parameter_list (); + program->Base.NumParameters = 0; + + state_tokens[0] = STATE_VERTEX_PROGRAM; + state_tokens[1] = STATE_ENV; + /* Add refs to all of the potential params, in order. If we want to not + * upload everything, _mesa_layout_parameters is the answer. + */ + for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS; i++) { + state_tokens[2] = i; + int index = _mesa_add_state_reference(program->Base.Parameters, + state_tokens); + assert(index == i); + } + program->Base.NumParameters = program->Base.Parameters->NumParameters; + + _mesa_setup_nv_temporary_count(ctx, &program->Base); } else { /* Error! */ -- cgit v1.2.3 From 9018a7dd175caa9a0fbf940b7e66aa9411d2d965 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 24 Sep 2009 10:40:32 -0700 Subject: i965: Load NV program matrices when required. --- src/mesa/drivers/dri/i965/brw_curbe.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 0b0e6931a0..4be6c77aa1 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -248,6 +248,9 @@ static void prepare_constant_buffer(struct brw_context *brw) GLuint offset = brw->curbe.vs_start * 16; GLuint nr = brw->vs.prog_data->nr_params / 4; + if (brw->vertex_program->IsNVProgram) + _mesa_load_tracked_matrices(ctx); + /* Updates the ParamaterValues[i] pointers for all parameters of the * basic type of PROGRAM_STATE_VAR. */ -- cgit v1.2.3 From a9a47afe7e87075432ce2d393b55409fcb7149ac Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 23 Sep 2009 16:50:59 -0700 Subject: i965: Remove assert about NV_vp now that it somewhat works. --- src/mesa/drivers/dri/i965/brw_vs.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index e3111c6680..f0c79efbd9 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -90,8 +90,6 @@ static void brw_upload_vs_prog(struct brw_context *brw) struct brw_vertex_program *vp = (struct brw_vertex_program *)brw->vertex_program; - assert (vp && !vp->program.IsNVProgram); - memset(&key, 0, sizeof(key)); /* Just upload the program verbatim for now. Always send it all -- cgit v1.2.3 From 726a04a2cd1bf159a6c40584b4b2b9bc5948a82e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 24 Sep 2009 11:58:33 -0700 Subject: i965: Emit zero initialization for NV VP temporaries as required. This is similar to what r300 does inside the driver, but I've added it as a generic option since it seems most hardware will want it. Fixes piglit nv-init-zero-reg.vpfp and nv-init-zero-addr.vpfp. --- src/mesa/drivers/dri/i965/brw_context.c | 1 + src/mesa/main/mtypes.h | 1 + src/mesa/shader/nvprogram.c | 44 +++++++++++++++++++++++++++++++++ src/mesa/shader/nvprogram.h | 4 +++ src/mesa/shader/nvvertparse.c | 1 + 5 files changed, 51 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 3c5b848319..c300c33adc 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -125,6 +125,7 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis, /* We want the GLSL compiler to emit code that uses condition codes */ ctx->Shader.EmitCondCodes = GL_TRUE; + ctx->Shader.EmitNVTempInitialization = GL_TRUE; ctx->Const.VertexProgram.MaxNativeInstructions = (16 * 1024); ctx->Const.VertexProgram.MaxAluInstructions = 0; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 6b64bf8139..f8e4e41583 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2079,6 +2079,7 @@ struct gl_shader_state GLboolean EmitContReturn; /**< Emit CONT/RET opcodes? */ GLboolean EmitCondCodes; /**< Use condition codes? */ GLboolean EmitComments; /**< Annotated instructions */ + GLboolean EmitNVTempInitialization; /**< 0-fill NV temp registers */ void *MemPool; GLbitfield Flags; /**< Mask of GLSL_x flags */ struct gl_sl_pragmas DefaultPragmas; /**< Default #pragma settings */ diff --git a/src/mesa/shader/nvprogram.c b/src/mesa/shader/nvprogram.c index fdb2f4210a..471a7358a2 100644 --- a/src/mesa/shader/nvprogram.c +++ b/src/mesa/shader/nvprogram.c @@ -509,7 +509,51 @@ _mesa_GetVertexAttribPointervNV(GLuint index, GLenum pname, GLvoid **pointer) *pointer = (GLvoid *) ctx->Array.ArrayObj->VertexAttrib[index].Ptr; } +void +_mesa_emit_nv_temp_initialization(GLcontext *ctx, + struct gl_program *program) +{ + struct prog_instruction *inst; + int i; + + if (!ctx->Shader.EmitNVTempInitialization) + return; + /* We'll swizzle up a zero temporary so we can use it for the + * ARL. + */ + if (program->NumTemporaries == 0) + program->NumTemporaries = 1; + + _mesa_insert_instructions(program, 0, program->NumTemporaries + 1); + + for (i = 0; i < program->NumTemporaries; i++) { + struct prog_instruction *inst = &program->Instructions[i]; + + inst->Opcode = OPCODE_SWZ; + inst->DstReg.File = PROGRAM_TEMPORARY; + inst->DstReg.Index = i; + inst->DstReg.WriteMask = WRITEMASK_XYZW; + inst->SrcReg[0].File = PROGRAM_TEMPORARY; + inst->SrcReg[0].Index = 0; + inst->SrcReg[0].Swizzle = MAKE_SWIZZLE4(SWIZZLE_ZERO, + SWIZZLE_ZERO, + SWIZZLE_ZERO, + SWIZZLE_ZERO); + } + + inst = &program->Instructions[i]; + inst->Opcode = OPCODE_ARL; + inst->DstReg.File = PROGRAM_ADDRESS; + inst->DstReg.Index = 0; + inst->DstReg.WriteMask = WRITEMASK_XYZW; + inst->SrcReg[0].File = PROGRAM_TEMPORARY; + inst->SrcReg[0].Index = 0; + inst->SrcReg[0].Swizzle = SWIZZLE_XXXX; + + if (program->NumAddressRegs == 0) + program->NumAddressRegs = 1; +} void _mesa_setup_nv_temporary_count(GLcontext *ctx, struct gl_program *program) diff --git a/src/mesa/shader/nvprogram.h b/src/mesa/shader/nvprogram.h index 0ed143d52f..8ee59661bd 100644 --- a/src/mesa/shader/nvprogram.h +++ b/src/mesa/shader/nvprogram.h @@ -106,4 +106,8 @@ _mesa_GetProgramNamedParameterdvNV(GLuint id, GLsizei len, const GLubyte *name, extern void _mesa_setup_nv_temporary_count(GLcontext *ctx, struct gl_program *program); +extern void +_mesa_emit_nv_temp_initialization(GLcontext *ctx, + struct gl_program *program); + #endif diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/shader/nvvertparse.c index a94e6b8b80..6ab8a14cb9 100644 --- a/src/mesa/shader/nvvertparse.c +++ b/src/mesa/shader/nvvertparse.c @@ -1423,6 +1423,7 @@ _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget, program->Base.NumParameters = program->Base.Parameters->NumParameters; _mesa_setup_nv_temporary_count(ctx, &program->Base); + _mesa_emit_nv_temp_initialization(ctx, &program->Base); } else { /* Error! */ -- cgit v1.2.3 From 1730b8db1237485778abdc4ae37e122414b5423b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 24 Sep 2009 15:59:57 -0600 Subject: softpipe: Increase GL_MAX_3D_TEXTURE_SIZE to 256. --- src/gallium/drivers/softpipe/sp_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index cc39d33ede..2e2668dfe4 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -84,7 +84,7 @@ softpipe_get_param(struct pipe_screen *screen, int param) case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: return 12; /* max 2Kx2K */ case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: - return 8; /* max 128x128x128 */ + return 9; /* max 256x256x256 */ case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: return 12; /* max 2Kx2K */ case PIPE_CAP_TGSI_CONT_SUPPORTED: -- cgit v1.2.3 From a665a3416e5a99dc84691c7f113a11190375f340 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 24 Sep 2009 16:07:45 -0600 Subject: llvmpipe: increase max 3D texture size to 256 --- src/gallium/drivers/llvmpipe/lp_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index ff7ef8658a..0518927458 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -82,7 +82,7 @@ llvmpipe_get_param(struct pipe_screen *screen, int param) case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: return 13; /* max 4Kx4K */ case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: - return 8; /* max 128x128x128 */ + return 9; /* max 256x256x256 */ case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: return 13; /* max 4Kx4K */ case PIPE_CAP_TGSI_CONT_SUPPORTED: -- cgit v1.2.3 From 01249c6d5653a0e66027202f44de2457be5942a5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 24 Sep 2009 16:08:47 -0600 Subject: llvmpipe: add missing __FUNCTION__ parameter to debug_printf() calls --- src/gallium/drivers/llvmpipe/lp_bld_arit.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.c b/src/gallium/drivers/llvmpipe/lp_bld_arit.c index 0b115fc9b0..31433318a7 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_arit.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.c @@ -918,7 +918,8 @@ lp_build_pow(struct lp_build_context *bld, { /* TODO: optimize the constant case */ if(LLVMIsConstant(x) && LLVMIsConstant(y)) - debug_printf("%s: inefficient/imprecise constant arithmetic\n"); + debug_printf("%s: inefficient/imprecise constant arithmetic\n", + __FUNCTION__); return lp_build_exp2(bld, lp_build_mul(bld, lp_build_log2(bld, x), y)); } @@ -972,7 +973,8 @@ lp_build_polynomial(struct lp_build_context *bld, /* TODO: optimize the constant case */ if(LLVMIsConstant(x)) - debug_printf("%s: inefficient/imprecise constant arithmetic\n"); + debug_printf("%s: inefficient/imprecise constant arithmetic\n", + __FUNCTION__); for (i = num_coeffs; i--; ) { LLVMValueRef coeff = lp_build_const_scalar(type, coeffs[i]); @@ -1026,7 +1028,8 @@ lp_build_exp2_approx(struct lp_build_context *bld, if(p_exp2_int_part || p_frac_part || p_exp2) { /* TODO: optimize the constant case */ if(LLVMIsConstant(x)) - debug_printf("%s: inefficient/imprecise constant arithmetic\n"); + debug_printf("%s: inefficient/imprecise constant arithmetic\n", + __FUNCTION__); assert(type.floating && type.width == 32); @@ -1125,7 +1128,8 @@ lp_build_log2_approx(struct lp_build_context *bld, if(p_exp || p_floor_log2 || p_log2) { /* TODO: optimize the constant case */ if(LLVMIsConstant(x)) - debug_printf("%s: inefficient/imprecise constant arithmetic\n"); + debug_printf("%s: inefficient/imprecise constant arithmetic\n", + __FUNCTION__); assert(type.floating && type.width == 32); -- cgit v1.2.3 From 53d2fa46e7fa19d0cb7dec74efcd407ab6163c80 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 23 Sep 2009 09:00:58 -0400 Subject: st/xorg: add easier way of disabling/enabling acceleration --- src/gallium/state_trackers/xorg/xorg_composite.c | 5 ++--- src/gallium/state_trackers/xorg/xorg_exa.c | 23 ++++++++++++++++------- 2 files changed, 18 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index a870ad1049..bb50289ac6 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -388,7 +388,7 @@ bind_viewport_state(struct exa_context *exa, struct exa_pixmap_priv *pDst) int width = pDst->tex->width[0]; int height = pDst->tex->height[0]; - debug_printf("Bind viewport (%d, %d)\n", width, height); + /*debug_printf("Bind viewport (%d, %d)\n", width, height);*/ set_viewport(exa, width, height, Y0_TOP); } @@ -672,7 +672,7 @@ boolean xorg_solid_bind_state(struct exa_context *exa, cso_set_vertex_shader_handle(exa->cso, shader.vs); cso_set_fragment_shader_handle(exa->cso, shader.fs); - return FALSE; + return TRUE; } void xorg_solid(struct exa_context *exa, @@ -701,7 +701,6 @@ void xorg_solid(struct exa_context *exa, if (buf) { - debug_printf("Drawing buf is %p\n", buf); util_draw_vertex_buffer(pipe, buf, 0, PIPE_PRIM_TRIANGLE_FAN, 4, /* verts */ diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 6507b2950e..deae9d80fd 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -48,6 +48,7 @@ #include "util/u_rect.h" #define DEBUG_SOLID 0 +#define DISABLE_ACCEL 1 /* * Helper functions @@ -281,8 +282,8 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap); struct exa_context *exa = ms->exa; -#if 0 - debug_printf("ExaPrepareSolid - test\n"); +#if 1 + debug_printf("ExaPrepareSolid(0x%x)\n", fg); #endif if (!EXA_PM_IS_SOLID(&pPixmap->drawable, planeMask)) return FALSE; @@ -306,11 +307,11 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) fg = 0xffff0000; #endif -#if 1 - debug_printf(" ExaPrepareSolid(0x%x)\n", fg); -#endif - +#if DISABLE_ACCEL + return FALSE; +#else return xorg_solid_bind_state(exa, priv, fg); +#endif } static void @@ -403,8 +404,11 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, exa->copy.src = src_priv; exa->copy.dst = priv; - /*XXX disabled until some issues with syncing are fixed */ +#if DISABLE_ACCEL return FALSE; +#else + return TRUE; +#endif } static void @@ -437,11 +441,16 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, debug_printf("ExaPrepareComposite\n"); +#if DISABLE_ACCEL + (void) exa; + return FALSE; +#else return xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture, pDstPicture, exaGetPixmapDriverPrivate(pSrc), exaGetPixmapDriverPrivate(pMask), exaGetPixmapDriverPrivate(pDst)); +#endif } static void -- cgit v1.2.3 From 80965fca743c3101af731080cb81dec705cd931b Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 23 Sep 2009 12:06:13 -0400 Subject: st/xorg: fills are supported plussome minor clenups --- src/gallium/state_trackers/xorg/xorg_composite.c | 7 ------- src/gallium/state_trackers/xorg/xorg_exa.c | 11 +++++++---- 2 files changed, 7 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index bb50289ac6..f8a3d7ba8a 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -305,17 +305,10 @@ boolean xorg_composite_accelerated(int op, unsigned accel_ops_count = sizeof(accelerated_ops)/sizeof(struct acceleration_info); - - /*FIXME: currently accel is disabled */ - return FALSE; - if (pSrcPicture) { /* component alpha not supported */ if (pSrcPicture->componentAlpha) return FALSE; - /* fills not supported */ - if (pSrcPicture->pSourcePict) - return FALSE; } for (i = 0; i < accel_ops_count; ++i) { diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index deae9d80fd..1bb274e6bd 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -473,10 +473,13 @@ ExaCheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture) { - return xorg_composite_accelerated(op, - pSrcPicture, - pMaskPicture, - pDstPicture); + boolean accelerated = xorg_composite_accelerated(op, + pSrcPicture, + pMaskPicture, + pDstPicture); + debug_printf("ExaCheckComposite(%d, %p, %p, %p) = %d\n", + op, pSrcPicture, pMaskPicture, pDstPicture, accelerated); + return accelerated; } static void * -- cgit v1.2.3 From 228aa45fcbb65205937f74853801643d676db675 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Thu, 24 Sep 2009 19:20:08 -0400 Subject: st/xorg: start working on the Xv acceleration code --- src/gallium/state_trackers/xorg/xorg_tracker.h | 6 + src/gallium/state_trackers/xorg/xorg_xv.c | 212 +++++++++++++++++++++++++ 2 files changed, 218 insertions(+) create mode 100644 src/gallium/state_trackers/xorg/xorg_xv.c (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h index b1ab783a15..2f7050bcb7 100644 --- a/src/gallium/state_trackers/xorg/xorg_tracker.h +++ b/src/gallium/state_trackers/xorg/xorg_tracker.h @@ -151,5 +151,11 @@ crtc_cursor_destroy(xf86CrtcPtr crtc); void output_init(ScrnInfoPtr pScrn); +/*********************************************************************** + * xorg_xv.c + */ +void +xorg_init_video(ScreenPtr pScreen); + #endif /* _XORG_TRACKER_H_ */ diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c new file mode 100644 index 0000000000..88955d47fd --- /dev/null +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -0,0 +1,212 @@ +#include "xorg_tracker.h" + +#include +#include +#include + +/*XXX get these from pipe's texture limits */ +#define IMAGE_MAX_WIDTH 2048 +#define IMAGE_MAX_HEIGHT 2048 + +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +static Atom xvBrightness, xvContrast; + +#define NUM_TEXTURED_ATTRIBUTES 2 +static XF86AttributeRec TexturedAttributes[NUM_TEXTURED_ATTRIBUTES] = { + {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"}, + {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"} +}; + +#define NUM_FORMATS 3 +static XF86VideoFormatRec Formats[NUM_FORMATS] = { + {15, TrueColor}, {16, TrueColor}, {24, TrueColor} +}; + +static XF86VideoEncodingRec DummyEncoding[1] = { + { + 0, + "XV_IMAGE", + IMAGE_MAX_WIDTH, IMAGE_MAX_HEIGHT, + {1, 1} + } +}; + +#define NUM_IMAGES 2 +static XF86ImageRec Images[NUM_IMAGES] = { + XVIMAGE_UYVY, + XVIMAGE_YUY2, +}; + +struct xorg_xv_port_priv { + RegionRec clip; +}; + + +static void +stop_video(ScrnInfoPtr pScrn, pointer data, Bool shutdown) +{ +} + +static int +set_port_attribute(ScrnInfoPtr pScrn, + Atom attribute, INT32 value, pointer data) +{ + return 0; +} + +static int +get_port_attribute(ScrnInfoPtr pScrn, + Atom attribute, INT32 * value, pointer data) +{ + return 0; +} + +static void +query_best_size(ScrnInfoPtr pScrn, + Bool motion, + short vid_w, short vid_h, + short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, pointer data) +{ +} + +static int +put_image(ScrnInfoPtr pScrn, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + int id, unsigned char *buf, + short width, short height, + Bool sync, RegionPtr clipBoxes, pointer data, + DrawablePtr pDraw) +{ + return 0; +} + +static int +query_image_attributes(ScrnInfoPtr pScrn, + int id, + unsigned short *w, unsigned short *h, + int *pitches, int *offsets) +{ + return 0; +} + +static struct xorg_xv_port_priv * +port_priv_create(ScreenPtr pScreen) +{ + /*ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];*/ + /*modesettingPtr ms = modesettingPTR(pScrn);*/ + struct xorg_xv_port_priv *priv = NULL; + + priv = calloc(1, sizeof(struct xorg_xv_port_priv)); + + if (!priv) + return NULL; + + REGION_NULL(pScreen, &priv->clip); + + return priv; +} + +static XF86VideoAdaptorPtr +xorg_setup_textured_adapter(ScreenPtr pScreen) +{ + /*ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];*/ + /*modesettingPtr ms = modesettingPTR(pScrn);*/ + XF86VideoAdaptorPtr adapt; + XF86AttributePtr attrs; + DevUnion *dev_unions; + int nports = 16, i; + int nattributes; + + nattributes = NUM_TEXTURED_ATTRIBUTES; + + adapt = calloc(1, sizeof(XF86VideoAdaptorRec)); + dev_unions = calloc(nports, sizeof(DevUnion)); + attrs = calloc(nattributes, sizeof(XF86AttributeRec)); + if (adapt == NULL || dev_unions == NULL || attrs == NULL) { + free(adapt); + free(dev_unions); + free(attrs); + return NULL; + } + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = 0; + adapt->name = "Gallium3D Textured Video"; + adapt->nEncodings = 1; + adapt->pEncodings = DummyEncoding; + adapt->nFormats = NUM_FORMATS; + adapt->pFormats = Formats; + adapt->nPorts = 0; + adapt->pPortPrivates = dev_unions; + adapt->nAttributes = nattributes; + adapt->pAttributes = attrs; + memcpy(attrs, TexturedAttributes, nattributes * sizeof(XF86AttributeRec)); + adapt->nImages = NUM_IMAGES; + adapt->pImages = Images; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = stop_video; + adapt->SetPortAttribute = set_port_attribute; + adapt->GetPortAttribute = get_port_attribute; + adapt->QueryBestSize = query_best_size; + adapt->PutImage = put_image; + adapt->QueryImageAttributes = query_image_attributes; + + for (i = 0; i < nports; i++) { + struct xorg_xv_port_priv *priv = + port_priv_create(pScreen); + + adapt->pPortPrivates[i].ptr = (pointer) (priv); + adapt->nPorts++; + } + + return adapt; +} + +void +xorg_init_video(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + /*modesettingPtr ms = modesettingPTR(pScrn);*/ + XF86VideoAdaptorPtr *adaptors, *new_adaptors = NULL; + XF86VideoAdaptorPtr textured_adapter; + int num_adaptors; + + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); + new_adaptors = malloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr *)); + if (new_adaptors == NULL) + return; + + memcpy(new_adaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr)); + adaptors = new_adaptors; + + /* Add the adaptors supported by our hardware. First, set up the atoms + * that will be used by both output adaptors. + */ + xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); + xvContrast = MAKE_ATOM("XV_CONTRAST"); + + textured_adapter = xorg_setup_textured_adapter(pScreen); + + debug_assert(textured_adapter); + + if (textured_adapter) { + adaptors[num_adaptors++] = textured_adapter; + } + + if (num_adaptors) { + xf86XVScreenInit(pScreen, adaptors, num_adaptors); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Disabling Xv because no adaptors could be initialized.\n"); + } + + free(adaptors); +} -- cgit v1.2.3 From 54107a097904129ff794534542acd09ed152ea2e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 24 Sep 2009 14:53:49 -0700 Subject: i965: Clean up some mess with the batch cache. Its flagging of extra state that's already flagged by the vtbl new_batch when appropriate was confusing my tracking down of the OA clear bug. --- src/mesa/drivers/dri/i965/brw_state.h | 5 +---- src/mesa/drivers/dri/i965/brw_state_batch.c | 15 ++------------- src/mesa/drivers/dri/i965/brw_state_upload.c | 3 ++- 3 files changed, 5 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index 78572356a3..5335eac895 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -86,9 +86,6 @@ const struct brw_tracked_state brw_psp_urb_cbs; const struct brw_tracked_state brw_pipe_control; -const struct brw_tracked_state brw_clear_surface_cache; -const struct brw_tracked_state brw_clear_batch_cache; - const struct brw_tracked_state brw_drawing_rect; const struct brw_tracked_state brw_indices; const struct brw_tracked_state brw_vertices; @@ -165,7 +162,7 @@ GLboolean brw_cached_batch_struct( struct brw_context *brw, const void *data, GLuint sz ); void brw_destroy_batch_cache( struct brw_context *brw ); -void brw_clear_batch_cache_flush( struct brw_context *brw ); +void brw_clear_batch_cache( struct brw_context *brw ); /* brw_wm_surface_state.c */ dri_bo * diff --git a/src/mesa/drivers/dri/i965/brw_state_batch.c b/src/mesa/drivers/dri/i965/brw_state_batch.c index 811940edc0..7821898cf9 100644 --- a/src/mesa/drivers/dri/i965/brw_state_batch.c +++ b/src/mesa/drivers/dri/i965/brw_state_batch.c @@ -79,7 +79,7 @@ GLboolean brw_cached_batch_struct( struct brw_context *brw, return GL_TRUE; } -static void clear_batch_cache( struct brw_context *brw ) +void brw_clear_batch_cache( struct brw_context *brw ) { struct brw_cached_batch_item *item = brw->cached_batch_items; @@ -93,18 +93,7 @@ static void clear_batch_cache( struct brw_context *brw ) brw->cached_batch_items = NULL; } -void brw_clear_batch_cache_flush( struct brw_context *brw ) -{ - clear_batch_cache(brw); - - brw->state.dirty.mesa |= ~0; - brw->state.dirty.brw |= ~0; - brw->state.dirty.cache |= ~0; -} - - - void brw_destroy_batch_cache( struct brw_context *brw ) { - clear_batch_cache(brw); + brw_clear_batch_cache(brw); } diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 414620d0b3..b817b741e7 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -287,6 +287,7 @@ void brw_validate_state( struct brw_context *brw ) if (brw->emit_state_always) { state->mesa |= ~0; state->brw |= ~0; + state->cache |= ~0; } if (brw->fragment_program != ctx->FragmentProgram._Current) { @@ -305,7 +306,7 @@ void brw_validate_state( struct brw_context *brw ) return; if (brw->state.dirty.brw & BRW_NEW_CONTEXT) - brw_clear_batch_cache_flush(brw); + brw_clear_batch_cache(brw); brw->intel.Fallback = 0; -- cgit v1.2.3 From cc8084932cc552587e3036dbbf62c77db3b4a08e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 24 Sep 2009 16:15:52 -0700 Subject: intel: Flush the batch when we're about to subdata into a VBO. This fixes the clears in openarena with the new metaops clear code, and the new piglit vbo-subdata-sync test. Bug #23857. --- src/mesa/drivers/dri/intel/intel_buffer_objects.c | 6 +++++- src/mesa/drivers/dri/intel/intel_clear.c | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index c55c5c426e..7f6fb66d52 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -207,8 +207,12 @@ intel_bufferobj_subdata(GLcontext * ctx, if (intel_obj->sys_buffer) memcpy((char *)intel_obj->sys_buffer + offset, data, size); - else + else { + /* Flush any existing batchbuffer that might reference this data. */ + intelFlush(ctx); + dri_bo_subdata(intel_obj->buffer, offset, size, data); + } } diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index 9010b910c7..1b0e221789 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -173,7 +173,6 @@ intelClear(GLcontext *ctx, GLbitfield mask) } _mesa_meta_clear(&intel->ctx, tri_mask); - intel_batchbuffer_flush(intel->batch); } if (swrast_mask) { -- cgit v1.2.3 From 09af58d7ed7dfa8f2ce2b881bb849064e136c830 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 24 Sep 2009 18:27:20 -0700 Subject: NV fp lexer: Add UP4B and UP4UB instructions that were previously missing --- src/mesa/shader/lex.yy.c | 1351 ++++++++++++++++++++------------------- src/mesa/shader/program_lexer.l | 2 + 2 files changed, 686 insertions(+), 667 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/lex.yy.c b/src/mesa/shader/lex.yy.c index 3c4e97b650..3c86913fdf 100644 --- a/src/mesa/shader/lex.yy.c +++ b/src/mesa/shader/lex.yy.c @@ -357,8 +357,8 @@ static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner ); *yy_cp = '\0'; \ yyg->yy_c_buf_p = yy_cp; -#define YY_NUM_RULES 168 -#define YY_END_OF_BUFFER 169 +#define YY_NUM_RULES 170 +#define YY_END_OF_BUFFER 171 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -366,100 +366,101 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static yyconst flex_int16_t yy_accept[836] = +static yyconst flex_int16_t yy_accept[850] = { 0, - 0, 0, 169, 167, 165, 164, 167, 167, 137, 163, - 139, 139, 139, 139, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 165, 0, 0, 166, 137, - 0, 138, 140, 160, 160, 0, 0, 0, 0, 160, - 0, 0, 0, 0, 0, 0, 0, 117, 161, 118, - 119, 151, 151, 151, 151, 0, 139, 0, 125, 126, - 127, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 159, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 158, 158, 0, 0, 0, + 0, 0, 171, 169, 167, 166, 169, 169, 139, 165, + 141, 141, 141, 141, 139, 139, 139, 139, 139, 139, + 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, + 139, 139, 139, 139, 139, 167, 0, 0, 168, 139, + 0, 140, 142, 162, 162, 0, 0, 0, 0, 162, + 0, 0, 0, 0, 0, 0, 0, 119, 163, 120, + 121, 153, 153, 153, 153, 0, 141, 0, 127, 128, + 129, 139, 139, 139, 139, 139, 139, 139, 139, 139, + 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, + 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, + + 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, + 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, + 139, 139, 139, 139, 139, 139, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 161, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 160, 160, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 157, 157, 157, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 148, 148, 148, 149, 149, 150, 141, - 140, 141, 0, 142, 11, 12, 137, 13, 137, 137, - 14, 15, 137, 16, 17, 18, 19, 20, 21, 6, + 159, 159, 159, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 150, 150, 150, 151, 151, 152, 143, + 142, 143, 0, 144, 11, 12, 139, 13, 139, 139, + 14, 15, 139, 16, 17, 18, 19, 20, 21, 6, 22, 23, 24, 25, 26, 28, 27, 29, 30, 31, - 32, 33, 34, 35, 137, 137, 137, 137, 137, 40, - 41, 137, 42, 43, 44, 45, 46, 47, 48, 137, - 49, 50, 51, 52, 53, 54, 55, 137, 56, 57, - 58, 59, 137, 62, 63, 137, 137, 137, 137, 137, - 137, 0, 0, 0, 0, 140, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 78, 79, 81, 0, - 156, 0, 0, 0, 0, 0, 0, 95, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 155, 154, - 154, 107, 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 145, 145, 146, 147, 0, 143, 11, 11, - 137, 12, 12, 12, 137, 137, 137, 137, 137, 15, - 15, 137, 128, 16, 16, 137, 17, 17, 137, 18, - 18, 137, 19, 19, 137, 20, 20, 137, 21, 21, - 137, 22, 22, 137, 24, 24, 137, 25, 25, 137, - 28, 28, 137, 27, 27, 137, 30, 30, 137, 31, - 31, 137, 32, 32, 137, 33, 33, 137, 34, 34, - 137, 35, 35, 137, 137, 137, 137, 36, 137, 38, - 137, 40, 40, 137, 41, 41, 137, 129, 42, 42, - 137, 43, 43, 137, 137, 45, 45, 137, 46, 46, - - 137, 47, 47, 137, 48, 48, 137, 137, 49, 49, - 137, 50, 50, 137, 51, 51, 137, 52, 52, 137, - 53, 53, 137, 54, 54, 137, 137, 10, 56, 137, - 57, 137, 58, 137, 59, 137, 60, 137, 62, 62, - 137, 137, 137, 137, 137, 137, 137, 137, 0, 162, - 0, 0, 0, 71, 72, 0, 0, 0, 0, 0, - 0, 0, 83, 0, 0, 0, 0, 0, 0, 0, + 32, 33, 34, 35, 139, 139, 139, 139, 139, 40, + 41, 139, 42, 43, 44, 45, 46, 47, 48, 139, + 49, 50, 51, 52, 53, 54, 55, 139, 56, 57, + 58, 59, 139, 139, 64, 65, 139, 139, 139, 139, + 139, 139, 0, 0, 0, 0, 142, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 80, 81, 83, + 0, 158, 0, 0, 0, 0, 0, 0, 97, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 157, + 156, 156, 109, 0, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 147, 147, 148, 149, 0, 145, 11, + 11, 139, 12, 12, 12, 139, 139, 139, 139, 139, + 15, 15, 139, 130, 16, 16, 139, 17, 17, 139, + 18, 18, 139, 19, 19, 139, 20, 20, 139, 21, + 21, 139, 22, 22, 139, 24, 24, 139, 25, 25, + 139, 28, 28, 139, 27, 27, 139, 30, 30, 139, + 31, 31, 139, 32, 32, 139, 33, 33, 139, 34, + 34, 139, 35, 35, 139, 139, 139, 139, 36, 139, + 38, 139, 40, 40, 139, 41, 41, 139, 131, 42, + 42, 139, 43, 43, 139, 139, 45, 45, 139, 46, + + 46, 139, 47, 47, 139, 48, 48, 139, 139, 49, + 49, 139, 50, 50, 139, 51, 51, 139, 52, 52, + 139, 53, 53, 139, 54, 54, 139, 139, 10, 56, + 139, 57, 139, 58, 139, 59, 139, 60, 139, 62, + 139, 64, 64, 139, 139, 139, 139, 139, 139, 139, + 139, 0, 164, 0, 0, 0, 73, 74, 0, 0, + 0, 0, 0, 0, 0, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 153, 0, 0, 0, 111, 0, 113, 0, 0, - 0, 0, 0, 0, 152, 144, 137, 137, 137, 4, - - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 9, 37, 39, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 60, 137, 61, - 137, 137, 137, 137, 137, 67, 137, 137, 0, 0, - 0, 0, 0, 73, 74, 0, 0, 0, 0, 82, - 0, 0, 86, 89, 0, 0, 0, 0, 0, 0, - 0, 100, 101, 0, 0, 0, 0, 106, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 137, 137, - - 137, 137, 137, 137, 5, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 7, 8, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 61, 137, - 137, 137, 137, 137, 68, 137, 64, 0, 0, 0, - 0, 122, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 92, 0, 96, 97, 0, 99, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 115, 116, 0, - 0, 123, 11, 3, 12, 133, 134, 137, 14, 15, - - 16, 17, 18, 19, 20, 21, 22, 24, 25, 28, - 27, 30, 31, 32, 33, 34, 35, 40, 41, 42, - 43, 44, 45, 46, 47, 48, 137, 137, 137, 49, - 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, - 137, 137, 62, 63, 137, 66, 124, 0, 0, 69, - 0, 75, 0, 0, 0, 84, 0, 0, 0, 0, - 0, 0, 98, 0, 0, 104, 91, 0, 0, 0, - 0, 0, 0, 120, 0, 137, 130, 131, 137, 60, - 137, 65, 0, 0, 0, 0, 77, 80, 85, 0, - 0, 90, 0, 0, 0, 103, 0, 0, 0, 0, - - 112, 114, 0, 137, 137, 61, 2, 1, 0, 76, - 0, 88, 0, 94, 102, 0, 0, 109, 110, 121, - 137, 132, 0, 87, 0, 105, 108, 137, 70, 93, - 137, 137, 135, 136, 0 + 0, 0, 0, 0, 155, 0, 0, 0, 113, 0, + 115, 0, 0, 0, 0, 0, 0, 154, 146, 139, + + 139, 139, 4, 139, 139, 139, 139, 139, 139, 139, + 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, + 139, 139, 139, 139, 139, 139, 9, 37, 39, 139, + 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, + 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, + 60, 139, 61, 62, 139, 63, 139, 139, 139, 139, + 139, 69, 139, 139, 0, 0, 0, 0, 0, 75, + 76, 0, 0, 0, 0, 84, 0, 0, 88, 91, + 0, 0, 0, 0, 0, 0, 0, 102, 103, 0, + 0, 0, 0, 108, 0, 0, 0, 0, 0, 0, + + 0, 0, 0, 0, 139, 139, 139, 139, 139, 139, + 5, 139, 139, 139, 139, 139, 139, 139, 139, 139, + 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, + 7, 8, 139, 139, 139, 139, 139, 139, 139, 139, + 139, 139, 139, 139, 139, 139, 139, 139, 139, 139, + 139, 139, 139, 139, 61, 139, 139, 63, 139, 139, + 139, 139, 139, 70, 139, 66, 0, 0, 0, 0, + 124, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 94, 0, 98, 99, 0, 101, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 117, 118, 0, 0, + + 125, 11, 3, 12, 135, 136, 139, 14, 15, 16, + 17, 18, 19, 20, 21, 22, 24, 25, 28, 27, + 30, 31, 32, 33, 34, 35, 40, 41, 42, 43, + 44, 45, 46, 47, 48, 139, 139, 139, 49, 50, + 51, 52, 53, 54, 55, 56, 57, 58, 59, 139, + 139, 139, 139, 64, 65, 139, 68, 126, 0, 0, + 71, 0, 77, 0, 0, 0, 86, 0, 0, 0, + 0, 0, 0, 100, 0, 0, 106, 93, 0, 0, + 0, 0, 0, 0, 122, 0, 139, 132, 133, 139, + 60, 139, 62, 139, 67, 0, 0, 0, 0, 79, + + 82, 87, 0, 0, 92, 0, 0, 0, 105, 0, + 0, 0, 0, 114, 116, 0, 139, 139, 61, 63, + 2, 1, 0, 78, 0, 90, 0, 96, 104, 0, + 0, 111, 112, 123, 139, 134, 0, 89, 0, 107, + 110, 139, 72, 95, 139, 139, 137, 138, 0 } ; static yyconst flex_int32_t yy_ec[256] = @@ -505,199 +506,203 @@ static yyconst flex_int32_t yy_meta[68] = 2, 2, 2, 2, 2, 2, 2 } ; -static yyconst flex_int16_t yy_base[839] = +static yyconst flex_int16_t yy_base[853] = { 0, - 0, 0, 1283, 1284, 66, 1284, 1277, 1278, 0, 69, - 85, 128, 140, 152, 151, 58, 56, 63, 76, 1256, - 158, 160, 39, 163, 173, 189, 52, 1249, 76, 1219, - 1218, 1230, 1214, 1228, 1227, 105, 1256, 1268, 1284, 0, - 225, 1284, 218, 160, 157, 20, 123, 66, 119, 192, - 1228, 1214, 54, 162, 1212, 1224, 194, 1284, 200, 195, - 98, 227, 196, 231, 235, 293, 305, 316, 1284, 1284, - 1284, 1233, 1246, 1240, 223, 1229, 1232, 1228, 1243, 107, - 298, 1225, 1239, 246, 1225, 1238, 1229, 1242, 1219, 1230, - 1221, 182, 1222, 1213, 1222, 1213, 1212, 1213, 144, 1207, - - 1213, 1224, 1215, 1209, 1206, 1207, 1211, 289, 1220, 1207, - 302, 1214, 1201, 1215, 1191, 65, 315, 1218, 1210, 1209, - 1185, 1170, 1165, 1182, 1158, 1163, 1189, 279, 1178, 293, - 1173, 342, 299, 1175, 1156, 317, 1166, 1162, 1157, 207, - 1163, 1149, 1165, 1162, 1153, 320, 324, 1155, 1144, 1158, - 1161, 1143, 1158, 1145, 1142, 1149, 284, 1157, 227, 288, - 327, 342, 345, 1134, 1151, 1152, 1145, 1127, 318, 1128, - 1150, 1141, 330, 341, 345, 349, 353, 357, 361, 1284, - 419, 430, 436, 442, 440, 441, 1174, 0, 1173, 1156, - 1146, 443, 1166, 444, 451, 468, 470, 472, 471, 0, + 0, 0, 1299, 1300, 66, 1300, 1293, 1294, 0, 69, + 85, 128, 140, 152, 151, 58, 56, 63, 76, 1272, + 158, 160, 39, 163, 173, 189, 52, 1265, 76, 1235, + 1234, 1246, 1230, 1244, 1243, 105, 1272, 1284, 1300, 0, + 225, 1300, 218, 160, 157, 20, 123, 66, 119, 192, + 1244, 1230, 54, 162, 1228, 1240, 194, 1300, 200, 195, + 98, 227, 196, 231, 235, 293, 305, 316, 1300, 1300, + 1300, 1249, 1262, 1256, 223, 1245, 1248, 1244, 1259, 107, + 298, 1241, 1255, 246, 1241, 1254, 1245, 1258, 1235, 1246, + 1237, 182, 1238, 1229, 1238, 1229, 1228, 1229, 144, 1223, + + 1229, 1240, 1231, 1225, 1222, 1223, 1227, 289, 1236, 1223, + 302, 1230, 1217, 1231, 1207, 65, 315, 276, 1227, 1226, + 1202, 1187, 1182, 1199, 1175, 1180, 1206, 279, 1195, 293, + 1190, 342, 299, 1192, 1173, 317, 1183, 1179, 1174, 207, + 1180, 1166, 1182, 1179, 1170, 320, 324, 1172, 1161, 1175, + 1178, 1160, 1175, 1162, 1159, 1166, 284, 1174, 227, 288, + 327, 342, 345, 1151, 1168, 1169, 1162, 1144, 318, 1145, + 1167, 1158, 330, 341, 345, 349, 353, 357, 361, 1300, + 419, 430, 436, 442, 440, 441, 1191, 0, 1190, 1173, + 1163, 443, 1183, 444, 451, 468, 470, 472, 471, 0, 496, 0, 497, 498, 0, 499, 500, 0, 524, 525, - 526, 536, 537, 553, 1161, 1154, 1167, 354, 356, 561, - 563, 1148, 564, 565, 1140, 580, 590, 591, 592, 1161, - 593, 617, 618, 619, 629, 630, 1138, 1148, 247, 330, - 362, 419, 445, 646, 1136, 1128, 1127, 1112, 1112, 1111, - 1110, 1153, 1125, 1113, 662, 669, 643, 1117, 487, 1114, - 1108, 1108, 1102, 1115, 1115, 1100, 1284, 1284, 1115, 1103, - 646, 1110, 135, 1107, 1113, 561, 1108, 1284, 1099, 1106, - 1105, 1108, 1094, 1093, 1097, 1092, 330, 1097, 650, 653, - 665, 1284, 1089, 1087, 1087, 1095, 1096, 1078, 670, 1083, - - 1089, 432, 460, 486, 579, 655, 715, 722, 1095, 682, - 1102, 1093, 697, 721, 1100, 1099, 1092, 1106, 1096, 1087, - 699, 1094, 0, 1085, 724, 1092, 1083, 725, 1090, 1081, - 726, 1088, 1079, 727, 1086, 1077, 728, 1084, 1075, 729, - 1082, 1073, 730, 1080, 1071, 731, 1078, 1069, 732, 1076, - 1067, 733, 1074, 1065, 734, 1072, 1063, 735, 1070, 1061, - 736, 1068, 1059, 737, 1066, 1057, 738, 1064, 1055, 739, - 1062, 1053, 740, 1060, 1063, 1056, 1063, 0, 1056, 0, - 1071, 1046, 741, 1053, 1044, 742, 1051, 0, 1042, 743, - 1049, 1040, 745, 1047, 1046, 1037, 746, 1044, 1035, 767, - - 1042, 1033, 770, 1040, 1031, 771, 1038, 1041, 1028, 772, - 1035, 1026, 773, 1033, 1024, 774, 1031, 1022, 775, 1029, - 1020, 776, 1027, 1018, 777, 1025, 1024, 0, 1015, 1022, - 1013, 1020, 1011, 1018, 1009, 1016, 778, 1015, 1006, 779, - 1013, 1012, 990, 984, 989, 995, 978, 993, 424, 1284, - 992, 982, 986, 1284, 1284, 976, 985, 971, 988, 971, - 974, 968, 1284, 969, 968, 965, 972, 965, 973, 969, - 979, 976, 958, 964, 971, 955, 954, 972, 954, 966, - 965, 1284, 964, 954, 958, 1284, 945, 1284, 950, 950, - 958, 941, 942, 952, 1284, 1284, 984, 966, 982, 0, - - 788, 980, 980, 979, 978, 977, 976, 975, 974, 973, - 972, 971, 970, 969, 968, 967, 966, 965, 964, 963, - 962, 949, 942, 0, 0, 0, 959, 958, 957, 956, - 955, 954, 953, 952, 951, 929, 949, 948, 947, 946, - 945, 944, 943, 942, 941, 940, 939, 913, 920, 783, - 936, 935, 904, 907, 887, 0, 888, 881, 888, 887, - 888, 880, 898, 1284, 1284, 880, 878, 888, 881, 1284, - 876, 893, 345, 1284, 884, 868, 869, 878, 869, 868, - 868, 1284, 867, 876, 866, 882, 879, 1284, 878, 876, - 865, 866, 862, 854, 861, 856, 857, 852, 878, 878, - - 876, 890, 889, 884, 0, 872, 871, 870, 869, 868, - 867, 866, 865, 864, 863, 862, 861, 860, 859, 858, - 857, 856, 855, 854, 0, 0, 853, 852, 851, 850, - 849, 848, 847, 846, 845, 791, 844, 843, 842, 841, - 840, 839, 838, 837, 836, 835, 834, 851, 825, 832, - 830, 829, 807, 807, 0, 814, 0, 848, 847, 796, - 814, 1284, 809, 804, 797, 793, 805, 795, 793, 789, - 805, 796, 795, 1284, 1284, 798, 1284, 793, 786, 775, - 786, 778, 782, 795, 790, 793, 775, 1284, 1284, 787, - 776, 1284, 0, 0, 0, 0, 0, 815, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 526, 536, 537, 553, 1178, 1171, 1184, 354, 356, 561, + 563, 1165, 564, 565, 1157, 580, 590, 591, 592, 1178, + 593, 617, 618, 619, 629, 630, 1155, 1165, 330, 362, + 419, 483, 445, 364, 646, 1153, 1145, 1144, 1129, 1129, + 1128, 1127, 1170, 1142, 1130, 662, 669, 643, 1134, 487, + 1131, 1125, 1125, 1119, 1132, 1132, 1117, 1300, 1300, 1132, + 1120, 646, 1127, 135, 1124, 1130, 561, 1125, 1300, 1116, + 1123, 1122, 1125, 1111, 1110, 1114, 1109, 448, 1114, 650, + 653, 665, 1300, 1106, 1104, 1104, 1112, 1113, 1095, 670, + + 1100, 1106, 486, 579, 655, 661, 668, 726, 732, 1112, + 682, 1119, 1110, 688, 730, 1117, 1116, 1109, 1123, 1113, + 1104, 712, 1111, 0, 1102, 731, 1109, 1100, 733, 1107, + 1098, 734, 1105, 1096, 736, 1103, 1094, 737, 1101, 1092, + 738, 1099, 1090, 739, 1097, 1088, 740, 1095, 1086, 741, + 1093, 1084, 742, 1091, 1082, 743, 1089, 1080, 744, 1087, + 1078, 745, 1085, 1076, 746, 1083, 1074, 747, 1081, 1072, + 748, 1079, 1070, 749, 1077, 1080, 1073, 1080, 0, 1073, + 0, 1088, 1063, 750, 1070, 1061, 751, 1068, 0, 1059, + 752, 1066, 1057, 755, 1064, 1063, 1054, 758, 1061, 1052, + + 776, 1059, 1050, 777, 1057, 1048, 779, 1055, 1058, 1045, + 780, 1052, 1043, 782, 1050, 1041, 783, 1048, 1039, 784, + 1046, 1037, 785, 1044, 1035, 786, 1042, 1041, 0, 1032, + 1039, 1030, 1037, 1028, 1035, 1026, 1033, 787, 1032, 788, + 1047, 1022, 789, 1029, 1028, 1006, 1000, 1005, 1011, 994, + 1009, 424, 1300, 1008, 998, 1002, 1300, 1300, 992, 1001, + 987, 1004, 987, 990, 984, 1300, 985, 984, 981, 988, + 981, 989, 985, 995, 992, 974, 980, 987, 971, 970, + 988, 970, 982, 981, 1300, 980, 970, 974, 1300, 961, + 1300, 966, 966, 974, 957, 958, 968, 1300, 1300, 1000, + + 982, 998, 0, 798, 996, 996, 995, 994, 993, 992, + 991, 990, 989, 988, 987, 986, 985, 984, 983, 982, + 981, 980, 979, 978, 965, 958, 0, 0, 0, 975, + 974, 973, 972, 971, 970, 969, 968, 967, 945, 965, + 964, 963, 962, 961, 960, 959, 958, 957, 956, 955, + 929, 936, 793, 927, 934, 794, 950, 949, 918, 921, + 901, 0, 902, 895, 902, 901, 902, 894, 912, 1300, + 1300, 894, 892, 902, 895, 1300, 890, 907, 516, 1300, + 898, 882, 883, 892, 883, 882, 882, 1300, 881, 890, + 880, 896, 893, 1300, 892, 890, 879, 880, 876, 868, + + 875, 870, 871, 866, 892, 892, 890, 904, 903, 898, + 0, 886, 885, 884, 883, 882, 881, 880, 879, 878, + 877, 876, 875, 874, 873, 872, 871, 870, 869, 868, + 0, 0, 867, 866, 865, 864, 863, 862, 861, 860, + 859, 804, 858, 857, 856, 855, 854, 853, 852, 851, + 850, 849, 848, 865, 839, 846, 862, 836, 843, 841, + 840, 818, 818, 0, 825, 0, 859, 858, 807, 825, + 1300, 820, 815, 808, 804, 816, 806, 804, 800, 816, + 807, 806, 1300, 1300, 809, 1300, 804, 797, 786, 797, + 789, 793, 806, 801, 804, 786, 1300, 1300, 798, 787, + + 1300, 0, 0, 0, 0, 0, 826, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 811, 803, 790, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 775, 791, 0, 0, 745, 0, 0, 796, 795, 1284, - 737, 1284, 655, 655, 661, 1284, 644, 658, 643, 644, - 635, 620, 1284, 598, 608, 1284, 1284, 604, 586, 579, - 567, 567, 574, 1284, 557, 582, 0, 0, 582, 0, - 565, 0, 582, 580, 539, 525, 1284, 1284, 1284, 527, - 527, 1284, 525, 497, 499, 1284, 478, 451, 439, 441, - - 1284, 1284, 431, 441, 366, 0, 1284, 1284, 21, 1284, - 144, 1284, 176, 1284, 1284, 182, 187, 1284, 1284, 1284, - 220, 0, 235, 1284, 245, 1284, 1284, 424, 1284, 1284, - 327, 373, 0, 0, 1284, 824, 396, 827 + 0, 0, 0, 0, 0, 814, 813, 802, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 785, + 798, 779, 792, 0, 0, 656, 0, 0, 706, 702, + 1300, 649, 1300, 648, 648, 654, 1300, 637, 645, 610, + 612, 608, 608, 1300, 572, 583, 1300, 1300, 577, 573, + 560, 557, 542, 555, 1300, 539, 573, 0, 0, 572, + 0, 555, 0, 546, 0, 562, 551, 495, 479, 1300, + + 1300, 1300, 481, 481, 1300, 480, 443, 31, 1300, 141, + 166, 171, 186, 1300, 1300, 211, 236, 276, 0, 0, + 1300, 1300, 290, 1300, 325, 1300, 346, 1300, 1300, 343, + 341, 1300, 1300, 1300, 365, 0, 380, 1300, 371, 1300, + 1300, 486, 1300, 1300, 451, 458, 0, 0, 1300, 836, + 503, 839 } ; -static yyconst flex_int16_t yy_def[839] = +static yyconst flex_int16_t yy_def[853] = { 0, - 835, 1, 835, 835, 835, 835, 835, 836, 837, 835, - 835, 835, 835, 835, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 835, 835, 836, 835, 837, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 838, 835, 835, 835, 835, - 835, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - - 835, 835, 835, 835, 835, 835, 835, 835, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 837, 837, 837, 837, - - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 837, 837, - - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 837, 837, 837, 837, 837, 837, 837, 837, - - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 837, 837, 837, - 837, 837, 837, 837, 837, 837, 837, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 837, 837, 837, 837, 837, - 837, 837, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - - 835, 835, 835, 837, 837, 837, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 837, 837, 835, 835, 835, 835, 835, 837, 835, 835, - 837, 837, 837, 837, 0, 835, 835, 835 + 849, 1, 849, 849, 849, 849, 849, 850, 851, 849, + 849, 849, 849, 849, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 849, 849, 850, 849, 851, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 852, 849, 849, 849, 849, + 849, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + + 849, 849, 849, 849, 849, 849, 849, 849, 849, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 851, + + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + + 849, 849, 849, 849, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + + 849, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 851, 851, 851, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 851, 851, 851, 851, + 851, 851, 851, 851, 851, 849, 849, 849, 849, 849, + + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 851, 851, 851, 851, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 851, 851, 849, 849, 849, 849, + 849, 851, 849, 849, 851, 851, 851, 851, 0, 849, + 849, 849 } ; -static yyconst flex_int16_t yy_nxt[1352] = +static yyconst flex_int16_t yy_nxt[1368] = { 0, 4, 5, 6, 5, 7, 8, 9, 4, 10, 11, 12, 13, 14, 11, 11, 15, 9, 16, 17, 18, @@ -706,7 +711,7 @@ static yyconst flex_int16_t yy_nxt[1352] = 9, 9, 9, 9, 9, 9, 30, 9, 9, 9, 9, 9, 9, 9, 9, 9, 31, 9, 32, 33, 34, 9, 35, 9, 9, 9, 9, 36, 96, 36, - 41, 116, 137, 97, 80, 138, 823, 42, 43, 43, + 41, 116, 137, 97, 80, 138, 829, 42, 43, 43, 43, 43, 43, 43, 77, 81, 78, 119, 82, 117, 83, 238, 79, 66, 67, 67, 67, 67, 67, 67, @@ -718,139 +723,140 @@ static yyconst flex_int16_t yy_nxt[1352] = 67, 67, 67, 67, 67, 218, 171, 219, 70, 68, 66, 67, 67, 67, 67, 67, 67, 72, 139, 73, 71, 68, 140, 68, 144, 92, 74, 145, 98, 88, - 464, 89, 75, 93, 76, 68, 90, 99, 94, 91, - 101, 100, 102, 103, 95, 465, 824, 68, 136, 133, + 467, 89, 75, 93, 76, 68, 90, 99, 94, 91, + 101, 100, 102, 103, 95, 468, 830, 68, 136, 133, 210, 133, 133, 152, 133, 104, 105, 133, 106, 107, 108, 109, 110, 134, 111, 133, 112, 153, 133, 211, - 135, 825, 113, 114, 154, 115, 41, 43, 43, 43, - 43, 43, 43, 146, 147, 157, 826, 132, 165, 133, - 166, 161, 162, 167, 168, 827, 158, 163, 188, 159, - 133, 169, 160, 264, 189, 164, 828, 201, 133, 174, - 173, 175, 176, 132, 429, 265, 128, 129, 46, 47, - 48, 49, 172, 51, 52, 202, 284, 53, 54, 55, - 56, 57, 58, 130, 60, 61, 285, 430, 131, 829, + 135, 831, 113, 114, 154, 115, 41, 43, 43, 43, + 43, 43, 43, 146, 147, 157, 832, 132, 165, 133, + 166, 161, 162, 167, 168, 833, 158, 163, 188, 159, + 133, 169, 160, 265, 189, 164, 834, 201, 133, 174, + 173, 175, 176, 132, 835, 266, 128, 129, 46, 47, + 48, 49, 172, 51, 52, 202, 285, 53, 54, 55, + 56, 57, 58, 130, 60, 61, 286, 243, 131, 244, 173, 173, 173, 173, 177, 173, 173, 178, 179, 173, - 173, 173, 181, 181, 181, 181, 181, 181, 228, 830, + 173, 173, 181, 181, 181, 181, 181, 181, 228, 836, 196, 197, 182, 66, 67, 67, 67, 67, 67, 67, 198, 232, 229, 183, 68, 184, 184, 184, 184, 184, - 184, 240, 134, 241, 254, 233, 281, 286, 182, 135, - 257, 257, 282, 287, 242, 833, 257, 431, 164, 255, - 68, 256, 256, 256, 256, 256, 256, 257, 257, 257, - 260, 257, 257, 297, 257, 271, 257, 257, 257, 257, - 432, 257, 380, 298, 257, 257, 378, 479, 257, 433, - 480, 288, 257, 289, 257, 257, 290, 291, 379, 257, - 381, 834, 257, 302, 302, 302, 302, 40, 669, 822, - - 257, 670, 434, 257, 302, 302, 302, 302, 303, 302, - 302, 304, 305, 302, 302, 302, 302, 302, 302, 302, - 306, 302, 302, 302, 302, 302, 302, 302, 43, 43, - 43, 43, 43, 43, 831, 832, 435, 307, 132, 308, - 308, 308, 308, 308, 308, 184, 184, 184, 184, 184, - 184, 184, 184, 184, 184, 184, 184, 309, 312, 436, - 320, 324, 310, 313, 132, 321, 325, 437, 327, 821, - 559, 310, 314, 328, 321, 325, 820, 310, 313, 438, - 311, 315, 328, 322, 326, 330, 560, 333, 339, 336, - 331, 329, 334, 340, 337, 495, 495, 495, 495, 331, - - 819, 334, 340, 337, 818, 331, 817, 334, 332, 337, - 335, 341, 338, 342, 345, 348, 351, 354, 343, 346, - 349, 352, 355, 495, 495, 495, 495, 343, 346, 349, - 352, 355, 452, 816, 346, 349, 344, 347, 350, 353, - 356, 357, 360, 363, 815, 453, 358, 361, 364, 496, - 495, 495, 495, 366, 369, 358, 361, 364, 367, 370, - 814, 358, 361, 364, 359, 362, 365, 367, 370, 813, - 372, 812, 811, 367, 370, 373, 368, 371, 382, 810, - 385, 389, 392, 383, 373, 386, 390, 393, 809, 808, - 373, 807, 383, 374, 386, 390, 393, 396, 806, 805, - - 804, 384, 397, 387, 391, 394, 468, 399, 402, 405, - 409, 397, 400, 403, 406, 410, 803, 397, 802, 469, - 398, 400, 403, 406, 410, 801, 800, 400, 403, 406, - 401, 404, 407, 411, 412, 415, 418, 799, 798, 413, - 416, 419, 495, 495, 495, 495, 421, 424, 413, 416, - 419, 422, 425, 797, 413, 416, 419, 414, 417, 420, - 422, 425, 796, 439, 795, 794, 422, 425, 440, 423, - 426, 256, 256, 256, 256, 256, 256, 440, 256, 256, - 256, 256, 256, 256, 450, 450, 441, 450, 450, 793, - 450, 450, 450, 450, 450, 450, 792, 450, 791, 309, - - 450, 450, 790, 789, 450, 788, 482, 450, 450, 787, - 786, 450, 450, 489, 312, 490, 320, 491, 495, 495, - 495, 495, 311, 450, 308, 308, 308, 308, 308, 308, - 492, 308, 308, 308, 308, 308, 308, 315, 312, 322, - 498, 324, 327, 330, 333, 336, 339, 342, 345, 348, - 351, 354, 357, 360, 363, 366, 369, 372, 382, 385, - 389, 315, 392, 396, 326, 329, 332, 335, 338, 341, - 344, 347, 350, 353, 356, 359, 362, 365, 368, 371, - 374, 384, 387, 391, 399, 394, 398, 402, 405, 409, - 412, 415, 418, 421, 424, 548, 439, 785, 602, 603, - - 649, 727, 728, 784, 783, 782, 781, 401, 780, 779, - 404, 407, 411, 414, 417, 420, 423, 426, 549, 441, - 604, 778, 729, 650, 38, 38, 38, 180, 180, 777, - 776, 775, 774, 773, 772, 771, 770, 769, 768, 767, - 766, 765, 764, 763, 762, 761, 760, 759, 758, 757, - 756, 755, 754, 753, 752, 751, 750, 749, 748, 747, - 746, 745, 744, 743, 742, 650, 741, 740, 739, 738, - 737, 736, 735, 734, 733, 732, 731, 730, 726, 725, - 724, 723, 722, 721, 720, 719, 718, 717, 716, 715, - 714, 713, 712, 711, 710, 709, 708, 707, 706, 705, - - 704, 703, 702, 701, 700, 699, 698, 697, 696, 695, - 694, 693, 692, 691, 690, 689, 688, 687, 686, 685, - 684, 683, 682, 681, 680, 679, 678, 677, 676, 675, - 674, 673, 672, 671, 668, 667, 666, 665, 664, 663, - 662, 661, 660, 659, 658, 657, 656, 655, 654, 653, - 652, 651, 648, 549, 647, 646, 645, 644, 643, 642, - 641, 640, 639, 638, 637, 636, 635, 634, 633, 632, - 631, 630, 629, 628, 627, 626, 625, 624, 623, 622, - 621, 620, 619, 618, 617, 616, 615, 614, 613, 612, - 611, 610, 609, 608, 607, 606, 605, 601, 600, 599, - - 598, 597, 596, 595, 594, 593, 592, 591, 590, 589, - 588, 587, 586, 585, 584, 583, 582, 581, 580, 579, - 578, 577, 576, 575, 574, 573, 572, 571, 570, 569, - 568, 567, 566, 565, 564, 563, 562, 561, 558, 557, - 556, 555, 554, 553, 552, 551, 441, 550, 547, 436, - 546, 434, 545, 432, 544, 430, 543, 542, 426, 541, - 423, 540, 420, 539, 417, 538, 414, 537, 411, 536, - 535, 407, 534, 404, 533, 401, 532, 398, 531, 530, - 394, 529, 391, 528, 387, 527, 384, 526, 525, 524, - 523, 522, 521, 374, 520, 371, 519, 368, 518, 365, - - 517, 362, 516, 359, 515, 356, 514, 353, 513, 350, - 512, 347, 511, 344, 510, 341, 509, 338, 508, 335, - 507, 332, 506, 329, 505, 326, 504, 322, 503, 502, - 501, 500, 499, 315, 497, 311, 494, 493, 488, 487, - 486, 485, 484, 483, 481, 478, 477, 476, 475, 474, - 473, 472, 471, 470, 467, 466, 463, 462, 461, 460, - 459, 458, 457, 456, 455, 454, 451, 288, 260, 449, - 448, 447, 446, 445, 444, 443, 442, 428, 427, 408, - 395, 388, 377, 376, 375, 323, 319, 318, 317, 316, - 301, 300, 299, 296, 295, 294, 293, 292, 283, 280, - - 279, 278, 277, 276, 275, 274, 273, 272, 270, 269, - 268, 267, 266, 263, 262, 261, 259, 258, 172, 253, - 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, - 237, 236, 235, 234, 231, 230, 227, 226, 225, 224, - 223, 222, 221, 220, 217, 216, 215, 214, 213, 212, - 209, 208, 207, 206, 205, 204, 203, 200, 199, 193, - 192, 191, 190, 187, 186, 185, 156, 155, 149, 148, - 39, 127, 126, 125, 124, 123, 122, 121, 118, 87, - 39, 37, 835, 3, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835 + 184, 240, 134, 241, 255, 233, 282, 287, 182, 135, + 258, 258, 283, 288, 242, 837, 258, 430, 164, 256, + 68, 257, 257, 257, 257, 257, 257, 258, 258, 258, + 261, 258, 258, 298, 258, 272, 258, 258, 258, 258, + 431, 258, 381, 299, 258, 258, 379, 838, 258, 432, + 440, 289, 258, 290, 258, 258, 291, 292, 380, 258, + 382, 839, 258, 303, 303, 303, 303, 840, 441, 841, + + 258, 842, 433, 258, 303, 303, 303, 303, 304, 303, + 303, 305, 306, 303, 303, 303, 303, 303, 303, 303, + 307, 303, 303, 303, 303, 303, 303, 303, 43, 43, + 43, 43, 43, 43, 843, 844, 434, 308, 132, 309, + 309, 309, 309, 309, 309, 184, 184, 184, 184, 184, + 184, 184, 184, 184, 184, 184, 184, 310, 313, 435, + 321, 325, 311, 314, 132, 322, 326, 438, 328, 847, + 565, 311, 315, 329, 322, 326, 848, 311, 314, 439, + 312, 316, 329, 323, 327, 331, 566, 334, 340, 337, + 332, 330, 335, 341, 338, 482, 845, 846, 483, 332, + + 436, 335, 341, 338, 40, 332, 828, 335, 333, 338, + 336, 342, 339, 343, 346, 349, 352, 355, 344, 347, + 350, 353, 356, 437, 827, 826, 825, 344, 347, 350, + 353, 356, 455, 824, 347, 350, 345, 348, 351, 354, + 357, 358, 361, 364, 823, 456, 359, 362, 365, 498, + 498, 498, 498, 367, 370, 359, 362, 365, 368, 371, + 822, 359, 362, 365, 360, 363, 366, 368, 371, 678, + 373, 821, 679, 368, 371, 374, 369, 372, 383, 820, + 386, 390, 393, 384, 374, 387, 391, 394, 819, 818, + 374, 817, 384, 375, 387, 391, 394, 397, 816, 815, + + 814, 385, 398, 388, 392, 395, 471, 400, 403, 406, + 410, 398, 401, 404, 407, 411, 813, 398, 812, 472, + 399, 401, 404, 407, 411, 811, 810, 401, 404, 407, + 402, 405, 408, 412, 413, 416, 419, 809, 808, 414, + 417, 420, 498, 498, 498, 498, 422, 425, 414, 417, + 420, 423, 426, 807, 414, 417, 420, 415, 418, 421, + 423, 426, 806, 442, 805, 804, 423, 426, 443, 424, + 427, 257, 257, 257, 257, 257, 257, 443, 257, 257, + 257, 257, 257, 257, 453, 453, 444, 453, 453, 803, + 453, 453, 453, 453, 453, 453, 802, 453, 801, 310, + + 453, 453, 800, 799, 453, 313, 485, 453, 453, 798, + 797, 453, 453, 492, 796, 493, 795, 494, 499, 498, + 498, 498, 312, 453, 498, 498, 498, 498, 316, 321, + 495, 498, 498, 498, 498, 309, 309, 309, 309, 309, + 309, 309, 309, 309, 309, 309, 309, 313, 325, 501, + 328, 331, 323, 334, 337, 340, 343, 346, 349, 352, + 355, 358, 361, 364, 367, 370, 373, 383, 386, 390, + 316, 327, 393, 330, 333, 397, 336, 339, 342, 345, + 348, 351, 354, 357, 360, 363, 366, 369, 372, 375, + 385, 388, 392, 400, 403, 395, 406, 410, 399, 413, + + 416, 419, 422, 425, 551, 554, 442, 794, 608, 609, + 655, 658, 793, 792, 736, 737, 402, 405, 791, 408, + 412, 790, 415, 418, 421, 424, 427, 552, 555, 444, + 610, 789, 788, 656, 659, 738, 38, 38, 38, 180, + 180, 787, 786, 785, 784, 783, 782, 781, 780, 779, + 778, 777, 776, 775, 774, 773, 772, 771, 770, 769, + 768, 767, 766, 765, 764, 763, 762, 761, 760, 759, + 758, 757, 756, 755, 754, 753, 659, 752, 751, 656, + 750, 749, 748, 747, 746, 745, 744, 743, 742, 741, + 740, 739, 735, 734, 733, 732, 731, 730, 729, 728, + + 727, 726, 725, 724, 723, 722, 721, 720, 719, 718, + 717, 716, 715, 714, 713, 712, 711, 710, 709, 708, + 707, 706, 705, 704, 703, 702, 701, 700, 699, 698, + 697, 696, 695, 694, 693, 692, 691, 690, 689, 688, + 687, 686, 685, 684, 683, 682, 681, 680, 677, 676, + 675, 674, 673, 672, 671, 670, 669, 668, 667, 666, + 665, 664, 663, 662, 661, 660, 657, 555, 654, 552, + 653, 652, 651, 650, 649, 648, 647, 646, 645, 644, + 643, 642, 641, 640, 639, 638, 637, 636, 635, 634, + 633, 632, 631, 630, 629, 628, 627, 626, 625, 624, + + 623, 622, 621, 620, 619, 618, 617, 616, 615, 614, + 613, 612, 611, 607, 606, 605, 604, 603, 602, 601, + 600, 599, 598, 597, 596, 595, 594, 593, 592, 591, + 590, 589, 588, 587, 586, 585, 584, 583, 582, 581, + 580, 579, 578, 577, 576, 575, 574, 573, 572, 571, + 570, 569, 568, 567, 564, 563, 562, 561, 560, 559, + 558, 557, 444, 556, 553, 550, 437, 549, 435, 548, + 433, 547, 431, 546, 545, 427, 544, 424, 543, 421, + 542, 418, 541, 415, 540, 412, 539, 538, 408, 537, + 405, 536, 402, 535, 399, 534, 533, 395, 532, 392, + + 531, 388, 530, 385, 529, 528, 527, 526, 525, 524, + 375, 523, 372, 522, 369, 521, 366, 520, 363, 519, + 360, 518, 357, 517, 354, 516, 351, 515, 348, 514, + 345, 513, 342, 512, 339, 511, 336, 510, 333, 509, + 330, 508, 327, 507, 323, 506, 505, 504, 503, 502, + 316, 500, 312, 497, 496, 491, 490, 489, 488, 487, + 486, 484, 481, 480, 479, 478, 477, 476, 475, 474, + 473, 470, 469, 466, 465, 464, 463, 462, 461, 460, + 459, 458, 457, 454, 289, 261, 452, 451, 450, 449, + 448, 447, 446, 445, 429, 428, 409, 396, 389, 378, + + 377, 376, 324, 320, 319, 318, 317, 302, 301, 300, + 297, 296, 295, 294, 293, 284, 281, 280, 279, 278, + 277, 276, 275, 274, 273, 271, 270, 269, 268, 267, + 264, 263, 262, 260, 259, 172, 254, 253, 252, 251, + 250, 249, 248, 247, 246, 245, 237, 236, 235, 234, + 231, 230, 227, 226, 225, 224, 223, 222, 221, 220, + 217, 216, 215, 214, 213, 212, 209, 208, 207, 206, + 205, 204, 203, 200, 199, 193, 192, 191, 190, 187, + 186, 185, 156, 155, 149, 148, 39, 127, 126, 125, + 124, 123, 122, 121, 118, 87, 39, 37, 849, 3, + + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849 } ; -static yyconst flex_int16_t yy_chk[1352] = +static yyconst flex_int16_t yy_chk[1368] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -859,7 +865,7 @@ static yyconst flex_int16_t yy_chk[1352] = 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 23, 5, - 10, 27, 46, 23, 17, 46, 809, 10, 10, 10, + 10, 27, 46, 23, 17, 46, 808, 10, 10, 10, 10, 10, 10, 10, 16, 17, 16, 29, 17, 27, 18, 116, 16, 11, 11, 11, 11, 11, 11, 11, @@ -871,136 +877,137 @@ static yyconst flex_int16_t yy_chk[1352] = 13, 13, 13, 13, 13, 99, 61, 99, 13, 13, 14, 14, 14, 14, 14, 14, 14, 15, 47, 15, 14, 14, 47, 12, 49, 22, 15, 49, 24, 21, - 273, 21, 15, 22, 15, 13, 21, 24, 22, 21, - 25, 24, 25, 25, 22, 273, 811, 14, 45, 45, + 274, 21, 15, 22, 15, 13, 21, 24, 22, 21, + 25, 24, 25, 25, 22, 274, 810, 14, 45, 45, 92, 44, 44, 54, 45, 25, 26, 44, 26, 26, 26, 26, 26, 44, 26, 45, 26, 54, 44, 92, - 44, 813, 26, 26, 54, 26, 41, 43, 43, 43, - 43, 43, 43, 50, 50, 57, 816, 43, 60, 50, - 60, 59, 59, 60, 60, 817, 57, 59, 75, 57, - 50, 60, 57, 140, 75, 59, 821, 84, 59, 63, - 63, 63, 63, 43, 239, 140, 41, 41, 41, 41, + 44, 811, 26, 26, 54, 26, 41, 43, 43, 43, + 43, 43, 43, 50, 50, 57, 812, 43, 60, 50, + 60, 59, 59, 60, 60, 813, 57, 59, 75, 57, + 50, 60, 57, 140, 75, 59, 816, 84, 59, 63, + 63, 63, 63, 43, 817, 140, 41, 41, 41, 41, 41, 41, 62, 41, 41, 84, 159, 41, 41, 41, - 41, 41, 41, 41, 41, 41, 159, 239, 41, 823, + 41, 41, 41, 41, 41, 41, 159, 118, 41, 118, 62, 62, 62, 62, 64, 64, 64, 64, 65, 65, - 65, 65, 66, 66, 66, 66, 66, 66, 108, 825, + 65, 65, 66, 66, 66, 66, 66, 66, 108, 818, 81, 81, 66, 67, 67, 67, 67, 67, 67, 67, 81, 111, 108, 68, 67, 68, 68, 68, 68, 68, 68, 117, 128, 117, 130, 111, 157, 160, 66, 128, - 133, 133, 157, 160, 117, 831, 133, 240, 130, 132, + 133, 133, 157, 160, 117, 823, 133, 239, 130, 132, 67, 132, 132, 132, 132, 132, 132, 133, 136, 136, 136, 146, 146, 169, 136, 147, 147, 146, 161, 161, - 240, 147, 219, 169, 161, 136, 218, 287, 146, 241, - 287, 161, 147, 162, 162, 161, 163, 163, 218, 162, - 219, 832, 163, 173, 173, 173, 173, 837, 573, 805, + 239, 147, 219, 169, 161, 136, 218, 825, 146, 240, + 244, 161, 147, 162, 162, 161, 163, 163, 218, 162, + 219, 827, 163, 173, 173, 173, 173, 830, 244, 831, - 162, 573, 241, 163, 174, 174, 174, 174, 175, 175, + 162, 835, 240, 163, 174, 174, 174, 174, 175, 175, 175, 175, 176, 176, 176, 176, 177, 177, 177, 177, 178, 178, 178, 178, 179, 179, 179, 179, 181, 181, - 181, 181, 181, 181, 828, 828, 242, 182, 181, 182, + 181, 181, 181, 181, 837, 839, 241, 182, 181, 182, 182, 182, 182, 182, 182, 183, 183, 183, 183, 183, - 183, 184, 184, 184, 184, 184, 184, 185, 186, 242, - 192, 194, 185, 186, 181, 192, 194, 243, 195, 804, - 449, 185, 186, 195, 192, 194, 803, 185, 186, 243, - 185, 186, 195, 192, 194, 196, 449, 197, 199, 198, - 196, 195, 197, 199, 198, 302, 302, 302, 302, 196, + 183, 184, 184, 184, 184, 184, 184, 185, 186, 241, + 192, 194, 185, 186, 181, 192, 194, 243, 195, 845, + 452, 185, 186, 195, 192, 194, 846, 185, 186, 243, + 185, 186, 195, 192, 194, 196, 452, 197, 199, 198, + 196, 195, 197, 199, 198, 288, 842, 842, 288, 196, - 800, 197, 199, 198, 799, 196, 798, 197, 196, 198, + 242, 197, 199, 198, 851, 196, 807, 197, 196, 198, 197, 199, 198, 201, 203, 204, 206, 207, 201, 203, - 204, 206, 207, 303, 303, 303, 303, 201, 203, 204, - 206, 207, 259, 797, 203, 204, 201, 203, 204, 206, - 207, 209, 210, 211, 795, 259, 209, 210, 211, 304, - 304, 304, 304, 212, 213, 209, 210, 211, 212, 213, - 794, 209, 210, 211, 209, 210, 211, 212, 213, 793, - 214, 791, 790, 212, 213, 214, 212, 213, 220, 786, - 221, 223, 224, 220, 214, 221, 223, 224, 785, 784, - 214, 783, 220, 214, 221, 223, 224, 226, 781, 779, - - 776, 220, 226, 221, 223, 224, 276, 227, 228, 229, - 231, 226, 227, 228, 229, 231, 775, 226, 773, 276, - 226, 227, 228, 229, 231, 772, 771, 227, 228, 229, - 227, 228, 229, 231, 232, 233, 234, 770, 769, 232, - 233, 234, 305, 305, 305, 305, 235, 236, 232, 233, - 234, 235, 236, 768, 232, 233, 234, 232, 233, 234, - 235, 236, 765, 244, 764, 762, 235, 236, 244, 235, - 236, 255, 255, 255, 255, 255, 255, 244, 256, 256, - 256, 256, 256, 256, 257, 257, 244, 271, 271, 761, - 257, 289, 289, 271, 290, 290, 760, 289, 759, 310, - - 290, 257, 758, 757, 271, 755, 291, 291, 289, 754, - 753, 290, 291, 299, 313, 299, 321, 299, 306, 306, - 306, 306, 310, 291, 307, 307, 307, 307, 307, 307, - 299, 308, 308, 308, 308, 308, 308, 313, 314, 321, - 314, 325, 328, 331, 334, 337, 340, 343, 346, 349, - 352, 355, 358, 361, 364, 367, 370, 373, 383, 386, - 390, 314, 393, 397, 325, 328, 331, 334, 337, 340, - 343, 346, 349, 352, 355, 358, 361, 364, 367, 370, - 373, 383, 386, 390, 400, 393, 397, 403, 406, 410, - 413, 416, 419, 422, 425, 437, 440, 751, 501, 501, - - 550, 636, 636, 749, 748, 745, 742, 400, 741, 729, - 403, 406, 410, 413, 416, 419, 422, 425, 437, 440, - 501, 728, 636, 550, 836, 836, 836, 838, 838, 727, - 698, 691, 690, 687, 686, 685, 684, 683, 682, 681, - 680, 679, 678, 676, 673, 672, 671, 670, 669, 668, - 667, 666, 665, 664, 663, 661, 660, 659, 658, 656, + 204, 206, 207, 242, 806, 804, 803, 201, 203, 204, + 206, 207, 260, 799, 203, 204, 201, 203, 204, 206, + 207, 209, 210, 211, 798, 260, 209, 210, 211, 303, + 303, 303, 303, 212, 213, 209, 210, 211, 212, 213, + 797, 209, 210, 211, 209, 210, 211, 212, 213, 579, + 214, 796, 579, 212, 213, 214, 212, 213, 220, 794, + 221, 223, 224, 220, 214, 221, 223, 224, 792, 790, + 214, 787, 220, 214, 221, 223, 224, 226, 786, 784, + + 783, 220, 226, 221, 223, 224, 277, 227, 228, 229, + 231, 226, 227, 228, 229, 231, 782, 226, 781, 277, + 226, 227, 228, 229, 231, 780, 779, 227, 228, 229, + 227, 228, 229, 231, 232, 233, 234, 776, 775, 232, + 233, 234, 304, 304, 304, 304, 235, 236, 232, 233, + 234, 235, 236, 773, 232, 233, 234, 232, 233, 234, + 235, 236, 772, 245, 771, 770, 235, 236, 245, 235, + 236, 256, 256, 256, 256, 256, 256, 245, 257, 257, + 257, 257, 257, 257, 258, 258, 245, 272, 272, 769, + 258, 290, 290, 272, 291, 291, 768, 290, 766, 311, + + 291, 258, 765, 764, 272, 314, 292, 292, 290, 762, + 760, 291, 292, 300, 759, 300, 756, 300, 305, 305, + 305, 305, 311, 292, 306, 306, 306, 306, 314, 322, + 300, 307, 307, 307, 307, 308, 308, 308, 308, 308, + 308, 309, 309, 309, 309, 309, 309, 315, 326, 315, + 329, 332, 322, 335, 338, 341, 344, 347, 350, 353, + 356, 359, 362, 365, 368, 371, 374, 384, 387, 391, + 315, 326, 394, 329, 332, 398, 335, 338, 341, 344, + 347, 350, 353, 356, 359, 362, 365, 368, 371, 374, + 384, 387, 391, 401, 404, 394, 407, 411, 398, 414, + + 417, 420, 423, 426, 438, 440, 443, 753, 504, 504, + 553, 556, 752, 751, 642, 642, 401, 404, 750, 407, + 411, 738, 414, 417, 420, 423, 426, 438, 440, 443, + 504, 737, 736, 553, 556, 642, 850, 850, 850, 852, + 852, 707, 700, 699, 696, 695, 694, 693, 692, 691, + 690, 689, 688, 687, 685, 682, 681, 680, 679, 678, + 677, 676, 675, 674, 673, 672, 670, 669, 668, 667, + 665, 663, 662, 661, 660, 659, 658, 657, 656, 655, 654, 653, 652, 651, 650, 649, 648, 647, 646, 645, - 644, 643, 642, 641, 640, 639, 638, 637, 635, 634, - 633, 632, 631, 630, 629, 628, 627, 624, 623, 622, - 621, 620, 619, 618, 617, 616, 615, 614, 613, 612, + 644, 643, 641, 640, 639, 638, 637, 636, 635, 634, - 611, 610, 609, 608, 607, 606, 604, 603, 602, 601, - 600, 599, 598, 597, 596, 595, 594, 593, 592, 591, - 590, 589, 587, 586, 585, 584, 583, 581, 580, 579, - 578, 577, 576, 575, 572, 571, 569, 568, 567, 566, - 563, 562, 561, 560, 559, 558, 557, 555, 554, 553, - 552, 551, 549, 548, 547, 546, 545, 544, 543, 542, - 541, 540, 539, 538, 537, 536, 535, 534, 533, 532, - 531, 530, 529, 528, 527, 523, 522, 521, 520, 519, - 518, 517, 516, 515, 514, 513, 512, 511, 510, 509, - 508, 507, 506, 505, 504, 503, 502, 499, 498, 497, - - 494, 493, 492, 491, 490, 489, 487, 485, 484, 483, - 481, 480, 479, 478, 477, 476, 475, 474, 473, 472, - 471, 470, 469, 468, 467, 466, 465, 464, 462, 461, - 460, 459, 458, 457, 456, 453, 452, 451, 448, 447, - 446, 445, 444, 443, 442, 441, 439, 438, 436, 435, - 434, 433, 432, 431, 430, 429, 427, 426, 424, 423, - 421, 420, 418, 417, 415, 414, 412, 411, 409, 408, - 407, 405, 404, 402, 401, 399, 398, 396, 395, 394, - 392, 391, 389, 387, 385, 384, 382, 381, 379, 377, - 376, 375, 374, 372, 371, 369, 368, 366, 365, 363, - - 362, 360, 359, 357, 356, 354, 353, 351, 350, 348, - 347, 345, 344, 342, 341, 339, 338, 336, 335, 333, - 332, 330, 329, 327, 326, 324, 322, 320, 319, 318, - 317, 316, 315, 312, 311, 309, 301, 300, 298, 297, - 296, 295, 294, 293, 288, 286, 285, 284, 283, 282, - 281, 280, 279, 277, 275, 274, 272, 270, 269, 266, - 265, 264, 263, 262, 261, 260, 258, 254, 253, 252, - 251, 250, 249, 248, 247, 246, 245, 238, 237, 230, - 225, 222, 217, 216, 215, 193, 191, 190, 189, 187, - 172, 171, 170, 168, 167, 166, 165, 164, 158, 156, - - 155, 154, 153, 152, 151, 150, 149, 148, 145, 144, - 143, 142, 141, 139, 138, 137, 135, 134, 131, 129, - 127, 126, 125, 124, 123, 122, 121, 120, 119, 118, - 115, 114, 113, 112, 110, 109, 107, 106, 105, 104, - 103, 102, 101, 100, 98, 97, 96, 95, 94, 93, - 91, 90, 89, 88, 87, 86, 85, 83, 82, 79, - 78, 77, 76, 74, 73, 72, 56, 55, 52, 51, - 38, 37, 35, 34, 33, 32, 31, 30, 28, 20, - 8, 7, 3, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, - 835 + 633, 630, 629, 628, 627, 626, 625, 624, 623, 622, + 621, 620, 619, 618, 617, 616, 615, 614, 613, 612, + 610, 609, 608, 607, 606, 605, 604, 603, 602, 601, + 600, 599, 598, 597, 596, 595, 593, 592, 591, 590, + 589, 587, 586, 585, 584, 583, 582, 581, 578, 577, + 575, 574, 573, 572, 569, 568, 567, 566, 565, 564, + 563, 561, 560, 559, 558, 557, 555, 554, 552, 551, + 550, 549, 548, 547, 546, 545, 544, 543, 542, 541, + 540, 539, 538, 537, 536, 535, 534, 533, 532, 531, + 530, 526, 525, 524, 523, 522, 521, 520, 519, 518, + + 517, 516, 515, 514, 513, 512, 511, 510, 509, 508, + 507, 506, 505, 502, 501, 500, 497, 496, 495, 494, + 493, 492, 490, 488, 487, 486, 484, 483, 482, 481, + 480, 479, 478, 477, 476, 475, 474, 473, 472, 471, + 470, 469, 468, 467, 465, 464, 463, 462, 461, 460, + 459, 456, 455, 454, 451, 450, 449, 448, 447, 446, + 445, 444, 442, 441, 439, 437, 436, 435, 434, 433, + 432, 431, 430, 428, 427, 425, 424, 422, 421, 419, + 418, 416, 415, 413, 412, 410, 409, 408, 406, 405, + 403, 402, 400, 399, 397, 396, 395, 393, 392, 390, + + 388, 386, 385, 383, 382, 380, 378, 377, 376, 375, + 373, 372, 370, 369, 367, 366, 364, 363, 361, 360, + 358, 357, 355, 354, 352, 351, 349, 348, 346, 345, + 343, 342, 340, 339, 337, 336, 334, 333, 331, 330, + 328, 327, 325, 323, 321, 320, 319, 318, 317, 316, + 313, 312, 310, 302, 301, 299, 298, 297, 296, 295, + 294, 289, 287, 286, 285, 284, 283, 282, 281, 280, + 278, 276, 275, 273, 271, 270, 267, 266, 265, 264, + 263, 262, 261, 259, 255, 254, 253, 252, 251, 250, + 249, 248, 247, 246, 238, 237, 230, 225, 222, 217, + + 216, 215, 193, 191, 190, 189, 187, 172, 171, 170, + 168, 167, 166, 165, 164, 158, 156, 155, 154, 153, + 152, 151, 150, 149, 148, 145, 144, 143, 142, 141, + 139, 138, 137, 135, 134, 131, 129, 127, 126, 125, + 124, 123, 122, 121, 120, 119, 115, 114, 113, 112, + 110, 109, 107, 106, 105, 104, 103, 102, 101, 100, + 98, 97, 96, 95, 94, 93, 91, 90, 89, 88, + 87, 86, 85, 83, 82, 79, 78, 77, 76, 74, + 73, 72, 56, 55, 52, 51, 38, 37, 35, 34, + 33, 32, 31, 30, 28, 20, 8, 7, 3, 849, + + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849, 849, 849, 849, + 849, 849, 849, 849, 849, 849, 849 } ; /* The intent behind this definition is that it'll catch @@ -1153,7 +1160,7 @@ handle_ident(struct asm_parser_state *state, const char *text, YYSTYPE *lval) } while(0); #define YY_EXTRA_TYPE struct asm_parser_state * -#line 1157 "lex.yy.c" +#line 1164 "lex.yy.c" #define INITIAL 0 @@ -1402,7 +1409,7 @@ YY_DECL #line 156 "program_lexer.l" -#line 1406 "lex.yy.c" +#line 1413 "lex.yy.c" yylval = yylval_param; @@ -1459,13 +1466,13 @@ yy_match: while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 836 ) + if ( yy_current_state >= 850 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } - while ( yy_base[yy_current_state] != 1284 ); + while ( yy_base[yy_current_state] != 1300 ); yy_find_action: yy_act = yy_accept[yy_current_state]; @@ -1799,445 +1806,455 @@ YY_RULE_SETUP YY_BREAK case 62: YY_RULE_SETUP -#line 236 "program_lexer.l" -{ return_opcode(require_NV_fp, TRI_OP, X2D, 3); } +#line 235 "program_lexer.l" +{ return_opcode(require_NV_fp, SCALAR_OP, UP4B, 4); } YY_BREAK case 63: YY_RULE_SETUP -#line 237 "program_lexer.l" -{ return_opcode( 1, BIN_OP, XPD, 3); } +#line 236 "program_lexer.l" +{ return_opcode(require_NV_fp, SCALAR_OP, UP4UB, 5); } YY_BREAK case 64: YY_RULE_SETUP -#line 239 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); } +#line 238 "program_lexer.l" +{ return_opcode(require_NV_fp, TRI_OP, X2D, 3); } YY_BREAK case 65: YY_RULE_SETUP -#line 240 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); } +#line 239 "program_lexer.l" +{ return_opcode( 1, BIN_OP, XPD, 3); } YY_BREAK case 66: YY_RULE_SETUP #line 241 "program_lexer.l" -{ return PROGRAM; } +{ return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); } YY_BREAK case 67: YY_RULE_SETUP #line 242 "program_lexer.l" -{ return STATE; } +{ return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); } YY_BREAK case 68: YY_RULE_SETUP #line 243 "program_lexer.l" -{ return RESULT; } +{ return PROGRAM; } YY_BREAK case 69: YY_RULE_SETUP -#line 245 "program_lexer.l" -{ return AMBIENT; } +#line 244 "program_lexer.l" +{ return STATE; } YY_BREAK case 70: YY_RULE_SETUP -#line 246 "program_lexer.l" -{ return ATTENUATION; } +#line 245 "program_lexer.l" +{ return RESULT; } YY_BREAK case 71: YY_RULE_SETUP #line 247 "program_lexer.l" -{ return BACK; } +{ return AMBIENT; } YY_BREAK case 72: YY_RULE_SETUP #line 248 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, CLIP); } +{ return ATTENUATION; } YY_BREAK case 73: YY_RULE_SETUP #line 249 "program_lexer.l" -{ return COLOR; } +{ return BACK; } YY_BREAK case 74: YY_RULE_SETUP #line 250 "program_lexer.l" -{ return_token_or_DOT(require_ARB_fp, DEPTH); } +{ return_token_or_DOT(require_ARB_vp, CLIP); } YY_BREAK case 75: YY_RULE_SETUP #line 251 "program_lexer.l" -{ return DIFFUSE; } +{ return COLOR; } YY_BREAK case 76: YY_RULE_SETUP #line 252 "program_lexer.l" -{ return DIRECTION; } +{ return_token_or_DOT(require_ARB_fp, DEPTH); } YY_BREAK case 77: YY_RULE_SETUP #line 253 "program_lexer.l" -{ return EMISSION; } +{ return DIFFUSE; } YY_BREAK case 78: YY_RULE_SETUP #line 254 "program_lexer.l" -{ return ENV; } +{ return DIRECTION; } YY_BREAK case 79: YY_RULE_SETUP #line 255 "program_lexer.l" -{ return EYE; } +{ return EMISSION; } YY_BREAK case 80: YY_RULE_SETUP #line 256 "program_lexer.l" -{ return FOGCOORD; } +{ return ENV; } YY_BREAK case 81: YY_RULE_SETUP #line 257 "program_lexer.l" -{ return FOG; } +{ return EYE; } YY_BREAK case 82: YY_RULE_SETUP #line 258 "program_lexer.l" -{ return FRONT; } +{ return FOGCOORD; } YY_BREAK case 83: YY_RULE_SETUP #line 259 "program_lexer.l" -{ return HALF; } +{ return FOG; } YY_BREAK case 84: YY_RULE_SETUP #line 260 "program_lexer.l" -{ return INVERSE; } +{ return FRONT; } YY_BREAK case 85: YY_RULE_SETUP #line 261 "program_lexer.l" -{ return INVTRANS; } +{ return HALF; } YY_BREAK case 86: YY_RULE_SETUP #line 262 "program_lexer.l" -{ return LIGHT; } +{ return INVERSE; } YY_BREAK case 87: YY_RULE_SETUP #line 263 "program_lexer.l" -{ return LIGHTMODEL; } +{ return INVTRANS; } YY_BREAK case 88: YY_RULE_SETUP #line 264 "program_lexer.l" -{ return LIGHTPROD; } +{ return LIGHT; } YY_BREAK case 89: YY_RULE_SETUP #line 265 "program_lexer.l" -{ return LOCAL; } +{ return LIGHTMODEL; } YY_BREAK case 90: YY_RULE_SETUP #line 266 "program_lexer.l" -{ return MATERIAL; } +{ return LIGHTPROD; } YY_BREAK case 91: YY_RULE_SETUP #line 267 "program_lexer.l" -{ return MAT_PROGRAM; } +{ return LOCAL; } YY_BREAK case 92: YY_RULE_SETUP #line 268 "program_lexer.l" -{ return MATRIX; } +{ return MATERIAL; } YY_BREAK case 93: YY_RULE_SETUP #line 269 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, MATRIXINDEX); } +{ return MAT_PROGRAM; } YY_BREAK case 94: YY_RULE_SETUP #line 270 "program_lexer.l" -{ return MODELVIEW; } +{ return MATRIX; } YY_BREAK case 95: YY_RULE_SETUP #line 271 "program_lexer.l" -{ return MVP; } +{ return_token_or_DOT(require_ARB_vp, MATRIXINDEX); } YY_BREAK case 96: YY_RULE_SETUP #line 272 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, NORMAL); } +{ return MODELVIEW; } YY_BREAK case 97: YY_RULE_SETUP #line 273 "program_lexer.l" -{ return OBJECT; } +{ return MVP; } YY_BREAK case 98: YY_RULE_SETUP #line 274 "program_lexer.l" -{ return PALETTE; } +{ return_token_or_DOT(require_ARB_vp, NORMAL); } YY_BREAK case 99: YY_RULE_SETUP #line 275 "program_lexer.l" -{ return PARAMS; } +{ return OBJECT; } YY_BREAK case 100: YY_RULE_SETUP #line 276 "program_lexer.l" -{ return PLANE; } +{ return PALETTE; } YY_BREAK case 101: YY_RULE_SETUP #line 277 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, POINT_TOK); } +{ return PARAMS; } YY_BREAK case 102: YY_RULE_SETUP #line 278 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, POINTSIZE); } +{ return PLANE; } YY_BREAK case 103: YY_RULE_SETUP #line 279 "program_lexer.l" -{ return POSITION; } +{ return_token_or_DOT(require_ARB_vp, POINT_TOK); } YY_BREAK case 104: YY_RULE_SETUP #line 280 "program_lexer.l" -{ return PRIMARY; } +{ return_token_or_DOT(require_ARB_vp, POINTSIZE); } YY_BREAK case 105: YY_RULE_SETUP #line 281 "program_lexer.l" -{ return PROJECTION; } +{ return POSITION; } YY_BREAK case 106: YY_RULE_SETUP #line 282 "program_lexer.l" -{ return_token_or_DOT(require_ARB_fp, RANGE); } +{ return PRIMARY; } YY_BREAK case 107: YY_RULE_SETUP #line 283 "program_lexer.l" -{ return ROW; } +{ return PROJECTION; } YY_BREAK case 108: YY_RULE_SETUP #line 284 "program_lexer.l" -{ return SCENECOLOR; } +{ return_token_or_DOT(require_ARB_fp, RANGE); } YY_BREAK case 109: YY_RULE_SETUP #line 285 "program_lexer.l" -{ return SECONDARY; } +{ return ROW; } YY_BREAK case 110: YY_RULE_SETUP #line 286 "program_lexer.l" -{ return SHININESS; } +{ return SCENECOLOR; } YY_BREAK case 111: YY_RULE_SETUP #line 287 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, SIZE_TOK); } +{ return SECONDARY; } YY_BREAK case 112: YY_RULE_SETUP #line 288 "program_lexer.l" -{ return SPECULAR; } +{ return SHININESS; } YY_BREAK case 113: YY_RULE_SETUP #line 289 "program_lexer.l" -{ return SPOT; } +{ return_token_or_DOT(require_ARB_vp, SIZE_TOK); } YY_BREAK case 114: YY_RULE_SETUP #line 290 "program_lexer.l" -{ return TEXCOORD; } +{ return SPECULAR; } YY_BREAK case 115: YY_RULE_SETUP #line 291 "program_lexer.l" -{ return_token_or_DOT(require_ARB_fp, TEXENV); } +{ return SPOT; } YY_BREAK case 116: YY_RULE_SETUP #line 292 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, TEXGEN); } +{ return TEXCOORD; } YY_BREAK case 117: YY_RULE_SETUP #line 293 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, TEXGEN_Q); } +{ return_token_or_DOT(require_ARB_fp, TEXENV); } YY_BREAK case 118: YY_RULE_SETUP #line 294 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, TEXGEN_S); } +{ return_token_or_DOT(require_ARB_vp, TEXGEN); } YY_BREAK case 119: YY_RULE_SETUP #line 295 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, TEXGEN_T); } +{ return_token_or_DOT(require_ARB_vp, TEXGEN_Q); } YY_BREAK case 120: YY_RULE_SETUP #line 296 "program_lexer.l" -{ return TEXTURE; } +{ return_token_or_DOT(require_ARB_vp, TEXGEN_S); } YY_BREAK case 121: YY_RULE_SETUP #line 297 "program_lexer.l" -{ return TRANSPOSE; } +{ return_token_or_DOT(require_ARB_vp, TEXGEN_T); } YY_BREAK case 122: YY_RULE_SETUP #line 298 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, VTXATTRIB); } +{ return TEXTURE; } YY_BREAK case 123: YY_RULE_SETUP #line 299 "program_lexer.l" -{ return_token_or_DOT(require_ARB_vp, WEIGHT); } +{ return TRANSPOSE; } YY_BREAK case 124: YY_RULE_SETUP -#line 301 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp, TEXTURE_UNIT); } +#line 300 "program_lexer.l" +{ return_token_or_DOT(require_ARB_vp, VTXATTRIB); } YY_BREAK case 125: YY_RULE_SETUP -#line 302 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_1D); } +#line 301 "program_lexer.l" +{ return_token_or_DOT(require_ARB_vp, WEIGHT); } YY_BREAK case 126: YY_RULE_SETUP #line 303 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_2D); } +{ return_token_or_IDENTIFIER(require_ARB_fp, TEXTURE_UNIT); } YY_BREAK case 127: YY_RULE_SETUP #line 304 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_3D); } +{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_1D); } YY_BREAK case 128: YY_RULE_SETUP #line 305 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_CUBE); } +{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_2D); } YY_BREAK case 129: YY_RULE_SETUP #line 306 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp && require_rect, TEX_RECT); } +{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_3D); } YY_BREAK case 130: YY_RULE_SETUP #line 307 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW1D); } +{ return_token_or_IDENTIFIER(require_ARB_fp, TEX_CUBE); } YY_BREAK case 131: YY_RULE_SETUP #line 308 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW2D); } +{ return_token_or_IDENTIFIER(require_ARB_fp && require_rect, TEX_RECT); } YY_BREAK case 132: YY_RULE_SETUP #line 309 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_rect, TEX_SHADOWRECT); } +{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW1D); } YY_BREAK case 133: YY_RULE_SETUP #line 310 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY1D); } +{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW2D); } YY_BREAK case 134: YY_RULE_SETUP #line 311 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY2D); } +{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_rect, TEX_SHADOWRECT); } YY_BREAK case 135: YY_RULE_SETUP #line 312 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW1D); } +{ return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY1D); } YY_BREAK case 136: YY_RULE_SETUP #line 313 "program_lexer.l" -{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); } +{ return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY2D); } YY_BREAK case 137: YY_RULE_SETUP -#line 315 "program_lexer.l" -{ return handle_ident(yyextra, yytext, yylval); } +#line 314 "program_lexer.l" +{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW1D); } YY_BREAK case 138: YY_RULE_SETUP -#line 317 "program_lexer.l" -{ return DOT_DOT; } +#line 315 "program_lexer.l" +{ return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); } YY_BREAK case 139: YY_RULE_SETUP +#line 317 "program_lexer.l" +{ return handle_ident(yyextra, yytext, yylval); } + YY_BREAK +case 140: +YY_RULE_SETUP #line 319 "program_lexer.l" +{ return DOT_DOT; } + YY_BREAK +case 141: +YY_RULE_SETUP +#line 321 "program_lexer.l" { yylval->integer = strtol(yytext, NULL, 10); return INTEGER; } YY_BREAK -case 140: +case 142: YY_RULE_SETUP -#line 323 "program_lexer.l" +#line 325 "program_lexer.l" { yylval->real = strtod(yytext, NULL); return REAL; } YY_BREAK -case 141: -/* rule 141 can match eol */ +case 143: +/* rule 143 can match eol */ *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 327 "program_lexer.l" +#line 329 "program_lexer.l" { yylval->real = strtod(yytext, NULL); return REAL; } YY_BREAK -case 142: +case 144: YY_RULE_SETUP -#line 331 "program_lexer.l" +#line 333 "program_lexer.l" { yylval->real = strtod(yytext, NULL); return REAL; } YY_BREAK -case 143: +case 145: YY_RULE_SETUP -#line 335 "program_lexer.l" +#line 337 "program_lexer.l" { yylval->real = strtod(yytext, NULL); return REAL; } YY_BREAK -case 144: +case 146: YY_RULE_SETUP -#line 340 "program_lexer.l" +#line 342 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; return MASK4; } YY_BREAK -case 145: +case 147: YY_RULE_SETUP -#line 346 "program_lexer.l" +#line 348 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2245,27 +2262,27 @@ YY_RULE_SETUP return MASK3; } YY_BREAK -case 146: +case 148: YY_RULE_SETUP -#line 352 "program_lexer.l" +#line 354 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; return MASK3; } YY_BREAK -case 147: +case 149: YY_RULE_SETUP -#line 357 "program_lexer.l" +#line 359 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; return MASK3; } YY_BREAK -case 148: +case 150: YY_RULE_SETUP -#line 363 "program_lexer.l" +#line 365 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2273,9 +2290,9 @@ YY_RULE_SETUP return MASK2; } YY_BREAK -case 149: +case 151: YY_RULE_SETUP -#line 369 "program_lexer.l" +#line 371 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2283,18 +2300,18 @@ YY_RULE_SETUP return MASK2; } YY_BREAK -case 150: +case 152: YY_RULE_SETUP -#line 375 "program_lexer.l" +#line 377 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; return MASK2; } YY_BREAK -case 151: +case 153: YY_RULE_SETUP -#line 381 "program_lexer.l" +#line 383 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2302,9 +2319,9 @@ YY_RULE_SETUP return MASK1; } YY_BREAK -case 152: +case 154: YY_RULE_SETUP -#line 388 "program_lexer.l" +#line 390 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2314,18 +2331,18 @@ YY_RULE_SETUP return SWIZZLE; } YY_BREAK -case 153: +case 155: YY_RULE_SETUP -#line 397 "program_lexer.l" +#line 399 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; return_token_or_DOT(require_ARB_fp, MASK4); } YY_BREAK -case 154: +case 156: YY_RULE_SETUP -#line 403 "program_lexer.l" +#line 405 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2333,27 +2350,27 @@ YY_RULE_SETUP return_token_or_DOT(require_ARB_fp, MASK3); } YY_BREAK -case 155: +case 157: YY_RULE_SETUP -#line 409 "program_lexer.l" +#line 411 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; return_token_or_DOT(require_ARB_fp, MASK3); } YY_BREAK -case 156: +case 158: YY_RULE_SETUP -#line 414 "program_lexer.l" +#line 416 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; return_token_or_DOT(require_ARB_fp, MASK3); } YY_BREAK -case 157: +case 159: YY_RULE_SETUP -#line 420 "program_lexer.l" +#line 422 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2361,9 +2378,9 @@ YY_RULE_SETUP return_token_or_DOT(require_ARB_fp, MASK2); } YY_BREAK -case 158: +case 160: YY_RULE_SETUP -#line 426 "program_lexer.l" +#line 428 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2371,18 +2388,18 @@ YY_RULE_SETUP return_token_or_DOT(require_ARB_fp, MASK2); } YY_BREAK -case 159: +case 161: YY_RULE_SETUP -#line 432 "program_lexer.l" +#line 434 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; return_token_or_DOT(require_ARB_fp, MASK2); } YY_BREAK -case 160: +case 162: YY_RULE_SETUP -#line 438 "program_lexer.l" +#line 440 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2390,9 +2407,9 @@ YY_RULE_SETUP return_token_or_DOT(require_ARB_fp, MASK1); } YY_BREAK -case 161: +case 163: YY_RULE_SETUP -#line 446 "program_lexer.l" +#line 448 "program_lexer.l" { if (require_ARB_vp) { return TEXGEN_R; @@ -2404,9 +2421,9 @@ YY_RULE_SETUP } } YY_BREAK -case 162: +case 164: YY_RULE_SETUP -#line 457 "program_lexer.l" +#line 459 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2416,15 +2433,15 @@ YY_RULE_SETUP return_token_or_DOT(require_ARB_fp, SWIZZLE); } YY_BREAK -case 163: +case 165: YY_RULE_SETUP -#line 466 "program_lexer.l" +#line 468 "program_lexer.l" { return DOT; } YY_BREAK -case 164: -/* rule 164 can match eol */ +case 166: +/* rule 166 can match eol */ YY_RULE_SETUP -#line 468 "program_lexer.l" +#line 470 "program_lexer.l" { yylloc->first_line++; yylloc->first_column = 1; @@ -2433,30 +2450,30 @@ YY_RULE_SETUP yylloc->position++; } YY_BREAK -case 165: +case 167: YY_RULE_SETUP -#line 475 "program_lexer.l" +#line 477 "program_lexer.l" /* eat whitespace */ ; YY_BREAK -case 166: +case 168: *yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 476 "program_lexer.l" +#line 478 "program_lexer.l" /* eat comments */ ; YY_BREAK -case 167: +case 169: YY_RULE_SETUP -#line 477 "program_lexer.l" +#line 479 "program_lexer.l" { return yytext[0]; } YY_BREAK -case 168: +case 170: YY_RULE_SETUP -#line 478 "program_lexer.l" +#line 480 "program_lexer.l" ECHO; YY_BREAK -#line 2460 "lex.yy.c" +#line 2477 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -2750,7 +2767,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 836 ) + if ( yy_current_state >= 850 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; @@ -2779,11 +2796,11 @@ static int yy_get_next_buffer (yyscan_t yyscanner) while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; - if ( yy_current_state >= 836 ) + if ( yy_current_state >= 850 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; - yy_is_jam = (yy_current_state == 835); + yy_is_jam = (yy_current_state == 849); return yy_is_jam ? 0 : yy_current_state; } @@ -3631,7 +3648,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 478 "program_lexer.l" +#line 480 "program_lexer.l" diff --git a/src/mesa/shader/program_lexer.l b/src/mesa/shader/program_lexer.l index 750c6acf42..8498c3d8fc 100644 --- a/src/mesa/shader/program_lexer.l +++ b/src/mesa/shader/program_lexer.l @@ -232,6 +232,8 @@ TXP{cc}{sat} { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, 3); } UP2H{cc}{sat} { return_opcode(require_NV_fp, SCALAR_OP, UP2H, 4); } UP2US{cc}{sat} { return_opcode(require_NV_fp, SCALAR_OP, UP2US, 5); } +UP4B{cc}{sat} { return_opcode(require_NV_fp, SCALAR_OP, UP4B, 4); } +UP4UB{cc}{sat} { return_opcode(require_NV_fp, SCALAR_OP, UP4UB, 5); } X2D{szf}{cc}{sat} { return_opcode(require_NV_fp, TRI_OP, X2D, 3); } XPD{sat} { return_opcode( 1, BIN_OP, XPD, 3); } -- cgit v1.2.3 From e33ea11c143596d511331aceabbf60016869c304 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 24 Sep 2009 13:38:27 -0600 Subject: mesa: remove: unused gl_vertex_program::TnlData field --- src/mesa/main/mtypes.h | 1 - src/mesa/shader/program.c | 7 ------- 2 files changed, 8 deletions(-) (limited to 'src') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 54fa8981dd..4757c3efa5 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1834,7 +1834,6 @@ struct gl_vertex_program struct gl_program Base; /**< base class */ GLboolean IsNVProgram; /**< is this a GL_NV_vertex_program program? */ GLboolean IsPositionInvariant; - void *TnlData; /**< should probably use Base.DriverData */ }; diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 2cd6eb8a38..532adf4d36 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -351,13 +351,6 @@ _mesa_delete_program(GLcontext *ctx, struct gl_program *prog) _mesa_free_parameter_list(prog->Attributes); } - /* XXX this is a little ugly */ - if (prog->Target == GL_VERTEX_PROGRAM_ARB) { - struct gl_vertex_program *vprog = (struct gl_vertex_program *) prog; - if (vprog->TnlData) - _mesa_free(vprog->TnlData); - } - _mesa_free(prog); } -- cgit v1.2.3 From 0876618a8d118b39b80963cc0d5e7a118961aa83 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 24 Sep 2009 19:33:22 -0600 Subject: mesa: _mesa_meta_GenerateMipmap() now working Handles GL_TEXTURE_1D, GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP. But GL_TEXTURE_3D and texture borders not supported yet. --- src/mesa/drivers/common/meta.c | 205 ++++++++++++++++++++++++++++++++++------- 1 file changed, 172 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 21756786c5..b445323aab 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -1939,6 +1939,10 @@ _mesa_meta_Bitmap(GLcontext *ctx, } +/** + * Called via ctx->Driver.GenerateMipmap() + * Note: texture borders and 3D texture support not yet complete. + */ void _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, struct gl_texture_object *texObj) @@ -1952,13 +1956,20 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, const GLuint maxLevel = texObj->MaxLevel; const GLenum minFilterSave = texObj->MinFilter; const GLenum magFilterSave = texObj->MagFilter; + const GLint baseLevelSave = texObj->BaseLevel; + const GLint maxLevelSave = texObj->MaxLevel; + const GLboolean genMipmapSave = texObj->GenerateMipmap; + const GLenum wrapSSave = texObj->WrapS; + const GLenum wrapTSave = texObj->WrapT; + const GLenum wrapRSave = texObj->WrapR; const GLuint fboSave = ctx->DrawBuffer->Name; GLenum faceTarget; - GLuint level; + GLuint dstLevel; GLuint border = 0; /* check for fallbacks */ - if (!ctx->Extensions.EXT_framebuffer_object) { + if (!ctx->Extensions.EXT_framebuffer_object || + target == GL_TEXTURE_3D) { _mesa_generate_mipmap(ctx, target, texObj); return; } @@ -2007,12 +2018,16 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, GL_FALSE); + _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + _mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + _mesa_TexParameteri(target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE); + _mesa_set_enable(ctx, target, GL_TRUE); /* setup texcoords once (XXX what about border?) */ switch (faceTarget) { - case GL_TEXTURE_CUBE_MAP_POSITIVE_X: - break; + case GL_TEXTURE_1D: case GL_TEXTURE_2D: verts[0].s = 0.0F; verts[0].t = 0.0F; @@ -2027,63 +2042,180 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, verts[3].t = 1.0F; verts[3].r = 0.0F; break; + case GL_TEXTURE_3D: + abort(); + break; + default: + /* cube face */ + { + static const GLfloat st[4][2] = { + {0.0f, 0.0f}, {1.0f, 0.0f}, {1.0f, 1.0f}, {0.0f, 1.0f} + }; + GLuint i; + + /* loop over quad verts */ + for (i = 0; i < 4; i++) { + /* Compute sc = +/-scale and tc = +/-scale. + * Not +/-1 to avoid cube face selection ambiguity near the edges, + * though that can still sometimes happen with this scale factor... + */ + const GLfloat scale = 0.9999f; + const GLfloat sc = (2.0f * st[i][0] - 1.0f) * scale; + const GLfloat tc = (2.0f * st[i][1] - 1.0f) * scale; + + switch (faceTarget) { + case GL_TEXTURE_CUBE_MAP_POSITIVE_X: + verts[i].s = 1.0f; + verts[i].t = -tc; + verts[i].r = -sc; + break; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: + verts[i].s = -1.0f; + verts[i].t = -tc; + verts[i].r = sc; + break; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: + verts[i].s = sc; + verts[i].t = 1.0f; + verts[i].r = tc; + break; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: + verts[i].s = sc; + verts[i].t = -1.0f; + verts[i].r = -tc; + break; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: + verts[i].s = sc; + verts[i].t = -tc; + verts[i].r = 1.0f; + break; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: + verts[i].s = -sc; + verts[i].t = -tc; + verts[i].r = -1.0f; + break; + default: + assert(0); + } + } + } } + _mesa_set_enable(ctx, target, GL_TRUE); + + /* texture is already locked, unlock now */ + _mesa_unlock_texture(ctx, texObj); - for (level = baseLevel + 1; level <= maxLevel; level++) { + for (dstLevel = baseLevel + 1; dstLevel <= maxLevel; dstLevel++) { const struct gl_texture_image *srcImage; - const GLuint srcLevel = level - 1; - GLsizei srcWidth, srcHeight; - GLsizei newWidth, newHeight; + const GLuint srcLevel = dstLevel - 1; + GLsizei srcWidth, srcHeight, srcDepth; + GLsizei dstWidth, dstHeight, dstDepth; GLenum status; - srcImage = _mesa_select_tex_image(ctx, texObj, target, srcLevel); + srcImage = _mesa_select_tex_image(ctx, texObj, faceTarget, srcLevel); assert(srcImage->Border == 0); /* XXX we can fix this */ + /* src size w/out border */ srcWidth = srcImage->Width - 2 * border; srcHeight = srcImage->Height - 2 * border; + srcDepth = srcImage->Depth - 2 * border; - newWidth = MAX2(1, srcWidth / 2) + 2 * border; - newHeight = MAX2(1, srcHeight / 2) + 2 * border; + /* new dst size w/ border */ + dstWidth = MAX2(1, srcWidth / 2) + 2 * border; + dstHeight = MAX2(1, srcHeight / 2) + 2 * border; + dstDepth = MAX2(1, srcDepth / 2) + 2 * border; - if (newWidth == srcImage->Width && newHeight == srcImage->Height) { - break; + if (dstWidth == srcImage->Width && + dstHeight == srcImage->Height && + dstDepth == srcImage->Depth) { + /* all done */ + break; } - /* Create empty image */ - _mesa_TexImage2D(GL_TEXTURE_2D, level, srcImage->InternalFormat, - newWidth, newHeight, border, - GL_RGBA, GL_UNSIGNED_BYTE, NULL); + /* Create empty dest image */ + if (target == GL_TEXTURE_1D) { + _mesa_TexImage1D(target, dstLevel, srcImage->InternalFormat, + dstWidth, border, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + } + else if (target == GL_TEXTURE_3D) { + _mesa_TexImage3D(target, dstLevel, srcImage->InternalFormat, + dstWidth, dstHeight, dstDepth, border, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + } + else { + /* 2D or cube */ + _mesa_TexImage2D(faceTarget, dstLevel, srcImage->InternalFormat, + dstWidth, dstHeight, border, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + + if (target == GL_TEXTURE_CUBE_MAP) { + /* If texturing from a cube, we need to make sure all src faces + * have been defined (even if we're not sampling from them.) + * Otherwise the texture object will be 'incomplete' and + * texturing from it will not be allowed. + */ + GLuint face; + for (face = 0; face < 6; face++) { + if (!texObj->Image[face][srcLevel] || + texObj->Image[face][srcLevel]->Width != srcWidth) { + _mesa_TexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, + srcLevel, srcImage->InternalFormat, + srcWidth, srcHeight, border, + GL_RGBA, GL_UNSIGNED_BYTE, NULL); + } + } + } + } - /* vertex positions */ + /* setup vertex positions */ { verts[0].x = 0.0F; verts[0].y = 0.0F; - verts[1].x = (GLfloat) newWidth; + verts[1].x = (GLfloat) dstWidth; verts[1].y = 0.0F; - verts[2].x = (GLfloat) newWidth; - verts[2].y = (GLfloat) newHeight; + verts[2].x = (GLfloat) dstWidth; + verts[2].y = (GLfloat) dstHeight; verts[3].x = 0.0F; - verts[3].y = (GLfloat) newHeight; + verts[3].y = (GLfloat) dstHeight; /* upload new vertex data */ _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts); } /* limit sampling to src level */ - _mesa_TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, srcLevel); - _mesa_TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, srcLevel); - - /* Set to draw into the current level */ - _mesa_FramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, - GL_COLOR_ATTACHMENT0_EXT, - target, - texObj->Name, - level); + _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, srcLevel); + _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, srcLevel); + + /* Set to draw into the current dstLevel */ + if (target == GL_TEXTURE_1D) { + _mesa_FramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT, + GL_COLOR_ATTACHMENT0_EXT, + target, + texObj->Name, + dstLevel); + } + else if (target == GL_TEXTURE_3D) { + GLint zoffset = 0; /* XXX unfinished */ + _mesa_FramebufferTexture3DEXT(GL_FRAMEBUFFER_EXT, + GL_COLOR_ATTACHMENT0_EXT, + target, + texObj->Name, + dstLevel, zoffset); + } + else { + /* 2D / cube */ + _mesa_FramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, + GL_COLOR_ATTACHMENT0_EXT, + faceTarget, + texObj->Name, + dstLevel); + } - /* Choose to render to the color attachment. */ _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0_EXT); + /* sanity check */ status = _mesa_CheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT); if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { abort(); @@ -2093,12 +2225,19 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); } + _mesa_lock_texture(ctx, texObj); /* relock */ + _mesa_meta_end(ctx); _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilterSave); _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, magFilterSave); + _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, baseLevelSave); + _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave); + _mesa_TexParameteri(target, GL_GENERATE_MIPMAP, genMipmapSave); + _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, wrapSSave); + _mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, wrapTSave); + _mesa_TexParameteri(target, GL_TEXTURE_WRAP_R, wrapRSave); - /* restore (XXX add to meta_begin/end()? */ _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboSave); } -- cgit v1.2.3 From 126d62edd18f22ff9e744efea81e0383cd0a19c5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 24 Sep 2009 20:03:21 -0700 Subject: i915: Fix GetBufferSubData in the case of a system-memory BO. Bug #23760 (crashes in wine) --- src/mesa/drivers/dri/intel/intel_buffer_objects.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index 2e6b77824d..db0de0343a 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -209,7 +209,10 @@ intel_bufferobj_get_subdata(GLcontext * ctx, struct intel_buffer_object *intel_obj = intel_buffer_object(obj); assert(intel_obj); - dri_bo_get_subdata(intel_obj->buffer, offset, size, data); + if (intel_obj->sys_buffer) + memcpy(data, (char *)intel_obj->sys_buffer + offset, size); + else + dri_bo_get_subdata(intel_obj->buffer, offset, size, data); } -- cgit v1.2.3 From 17099f5e19dc0ce65cb4e4110d9d22de803c4e52 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 7 Sep 2009 17:51:33 +0800 Subject: mesa/main: Add comments to mfeatures.h. The comments document the conventions that a feature may follow. --- src/mesa/main/mfeatures.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src') diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index e23cdb1f42..6318934c6b 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -36,6 +36,38 @@ #define _HAVE_FULL_GL 1 #endif +/* assert that a feature is disabled and should never be used */ +#define ASSERT_NO_FEATURE() ASSERT(0) + +/** + * A feature can be anything. But most of them share certain characteristics. + * + * When a feature defines driver entries, they can be initialized by + * _MESA_INIT__FUNCTIONS + * + * When a feature defines vtxfmt entries, they can be initialized and + * installed by + * _MESA_INIT__VTXFMT + * _mesa_install__vtxfmt + * + * When a feature defines dispatch entries, they are initialized by + * _mesa_init__dispatch + * + * When a feature has states, they are initialized and freed by + * _mesa_init_ + * _mesa_free__data + * + * Except for states, the others compile to no-op when a feature is disabled. + * + * The GLAPIENTRYs and helper functions defined by a feature should also + * compile to no-op when it is disabled. But to save typings and to catch + * bugs, some of them may be unavailable, or compile to ASSERT_NO_FEATURE() + * when the feature is disabled. + * + * A feature following the conventions may be used without knowing if it is + * enabled or not. + */ + #define FEATURE_accum _HAVE_FULL_GL #define FEATURE_attrib_stack _HAVE_FULL_GL #define FEATURE_colortable _HAVE_FULL_GL -- cgit v1.2.3 From dbb8fb8de9a9deca0ae22015e4680f4e631d6d32 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 7 Sep 2009 16:59:27 +0800 Subject: mesa/main: Make FEATURE_pixel_transfer follow feature conventions. As shown in mfeatures.h, this allows users of pixel.h to work without knowing if the feature is available. --- src/mesa/main/api_exec.c | 16 +++------------- src/mesa/main/pixel.c | 40 +++++++++++++++++++++++++++++++--------- src/mesa/main/pixel.h | 47 +++++++++++++++++------------------------------ src/mesa/main/state.c | 4 ---- 4 files changed, 51 insertions(+), 56 deletions(-) (limited to 'src') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 02550ae108..39941a1b03 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -93,9 +93,7 @@ #include "macros.h" #include "matrix.h" #include "multisample.h" -#if FEATURE_pixel_transfer #include "pixel.h" -#endif #include "pixelstore.h" #include "points.h" #include "polygon.h" @@ -284,17 +282,9 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_MapGrid2f(exec, _mesa_MapGrid2f); #endif SET_MultMatrixd(exec, _mesa_MultMatrixd); -#if FEATURE_pixel_transfer - SET_GetPixelMapfv(exec, _mesa_GetPixelMapfv); - SET_GetPixelMapuiv(exec, _mesa_GetPixelMapuiv); - SET_GetPixelMapusv(exec, _mesa_GetPixelMapusv); - SET_PixelMapfv(exec, _mesa_PixelMapfv); - SET_PixelMapuiv(exec, _mesa_PixelMapuiv); - SET_PixelMapusv(exec, _mesa_PixelMapusv); - SET_PixelTransferf(exec, _mesa_PixelTransferf); - SET_PixelTransferi(exec, _mesa_PixelTransferi); - SET_PixelZoom(exec, _mesa_PixelZoom); -#endif + + _mesa_init_pixel_dispatch(exec); + SET_PixelStoref(exec, _mesa_PixelStoref); SET_PointSize(exec, _mesa_PointSize); SET_PolygonMode(exec, _mesa_PolygonMode); diff --git a/src/mesa/main/pixel.c b/src/mesa/main/pixel.c index fcef6dfd42..3820ebd889 100644 --- a/src/mesa/main/pixel.c +++ b/src/mesa/main/pixel.c @@ -36,13 +36,17 @@ #include "macros.h" #include "pixel.h" #include "mtypes.h" +#include "glapi/dispatch.h" + + +#if FEATURE_pixel_transfer /**********************************************************************/ /***** glPixelZoom *****/ /**********************************************************************/ -void GLAPIENTRY +static void GLAPIENTRY _mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor ) { GET_CURRENT_CONTEXT(ctx); @@ -163,7 +167,7 @@ validate_pbo_access(GLcontext *ctx, struct gl_pixelstore_attrib *pack, } -void GLAPIENTRY +static void GLAPIENTRY _mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values ) { GET_CURRENT_CONTEXT(ctx); @@ -205,7 +209,7 @@ _mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values ) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values ) { GLfloat fvalues[MAX_PIXEL_MAP_TABLE]; @@ -261,7 +265,7 @@ _mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values ) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values ) { GLfloat fvalues[MAX_PIXEL_MAP_TABLE]; @@ -317,7 +321,7 @@ _mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values ) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetPixelMapfv( GLenum map, GLfloat *values ) { GET_CURRENT_CONTEXT(ctx); @@ -362,7 +366,7 @@ _mesa_GetPixelMapfv( GLenum map, GLfloat *values ) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetPixelMapuiv( GLenum map, GLuint *values ) { GET_CURRENT_CONTEXT(ctx); @@ -406,7 +410,7 @@ _mesa_GetPixelMapuiv( GLenum map, GLuint *values ) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetPixelMapusv( GLenum map, GLushort *values ) { GET_CURRENT_CONTEXT(ctx); @@ -468,7 +472,7 @@ _mesa_GetPixelMapusv( GLenum map, GLushort *values ) * Implements glPixelTransfer[fi] whether called immediately or from a * display list. */ -void GLAPIENTRY +static void GLAPIENTRY _mesa_PixelTransferf( GLenum pname, GLfloat param ) { GET_CURRENT_CONTEXT(ctx); @@ -662,7 +666,7 @@ _mesa_PixelTransferf( GLenum pname, GLfloat param ) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_PixelTransferi( GLenum pname, GLint param ) { _mesa_PixelTransferf( pname, (GLfloat) param ); @@ -756,6 +760,24 @@ void _mesa_update_pixel( GLcontext *ctx, GLuint new_state ) } +void +_mesa_init_pixel_dispatch(struct _glapi_table *disp) +{ + SET_GetPixelMapfv(disp, _mesa_GetPixelMapfv); + SET_GetPixelMapuiv(disp, _mesa_GetPixelMapuiv); + SET_GetPixelMapusv(disp, _mesa_GetPixelMapusv); + SET_PixelMapfv(disp, _mesa_PixelMapfv); + SET_PixelMapuiv(disp, _mesa_PixelMapuiv); + SET_PixelMapusv(disp, _mesa_PixelMapusv); + SET_PixelTransferf(disp, _mesa_PixelTransferf); + SET_PixelTransferi(disp, _mesa_PixelTransferi); + SET_PixelZoom(disp, _mesa_PixelZoom); +} + + +#endif /* FEATURE_pixel_transfer */ + + /**********************************************************************/ /***** Initialization *****/ /**********************************************************************/ diff --git a/src/mesa/main/pixel.h b/src/mesa/main/pixel.h index cb6c5262a3..f4d3f1efdb 100644 --- a/src/mesa/main/pixel.h +++ b/src/mesa/main/pixel.h @@ -33,48 +33,35 @@ #define PIXEL_H -#include "mtypes.h" +#include "main/mtypes.h" -/** \name API functions */ -/*@{*/ +#if FEATURE_pixel_transfer -extern void GLAPIENTRY -_mesa_GetPixelMapfv( GLenum map, GLfloat *values ); - -extern void GLAPIENTRY -_mesa_GetPixelMapuiv( GLenum map, GLuint *values ); - -extern void GLAPIENTRY -_mesa_GetPixelMapusv( GLenum map, GLushort *values ); - -extern void GLAPIENTRY -_mesa_PixelMapfv( GLenum map, GLsizei mapsize, const GLfloat *values ); - -extern void GLAPIENTRY -_mesa_PixelMapuiv(GLenum map, GLsizei mapsize, const GLuint *values ); - -extern void GLAPIENTRY -_mesa_PixelMapusv(GLenum map, GLsizei mapsize, const GLushort *values ); +extern void +_mesa_update_pixel( GLcontext *ctx, GLuint newstate ); -extern void GLAPIENTRY -_mesa_PixelTransferf( GLenum pname, GLfloat param ); +extern void +_mesa_init_pixel_dispatch( struct _glapi_table * disp ); -extern void GLAPIENTRY -_mesa_PixelTransferi( GLenum pname, GLint param ); +#else /* FEATURE_pixel_transfer */ -extern void GLAPIENTRY -_mesa_PixelZoom( GLfloat xfactor, GLfloat yfactor ); +static INLINE void +_mesa_update_pixel(GLcontext *ctx, GLuint newstate) +{ +} -/*@}*/ +static INLINE void +_mesa_init_pixel_dispatch(struct _glapi_table *disp) +{ +} +#endif /* FEATURE_pixel_transfer */ -extern void -_mesa_update_pixel( GLcontext *ctx, GLuint newstate ); extern void _mesa_init_pixel( GLcontext * ctx ); /*@}*/ -#endif +#endif /* PIXEL_H */ diff --git a/src/mesa/main/state.c b/src/mesa/main/state.c index 140a998df2..f10e6b04b7 100644 --- a/src/mesa/main/state.c +++ b/src/mesa/main/state.c @@ -40,9 +40,7 @@ #include "framebuffer.h" #include "light.h" #include "matrix.h" -#if FEATURE_pixel_transfer #include "pixel.h" -#endif #include "shader/program.h" #include "shader/prog_parameter.h" #include "state.h" @@ -585,10 +583,8 @@ _mesa_update_state_locked( GLcontext *ctx ) if (new_state & (_NEW_STENCIL | _NEW_BUFFERS)) _mesa_update_stencil( ctx ); -#if FEATURE_pixel_transfer if (new_state & _MESA_NEW_TRANSFER_STATE) _mesa_update_pixel( ctx, new_state ); -#endif if (new_state & _DD_NEW_SEPARATE_SPECULAR) update_separate_specular( ctx ); -- cgit v1.2.3 From cb4f24e51d0f4f4b867b2c01ed26d2a5ce73aeab Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 7 Sep 2009 17:17:11 +0800 Subject: mesa/main: Make FEATURE_colortable follow feature conventions. As shown in mfeatures.h, this allows users of colortab.h to work without knowing if the feature is available. --- src/mesa/main/api_exec.c | 14 +--------- src/mesa/main/colortab.c | 37 ++++++++++++++++++++----- src/mesa/main/colortab.h | 71 ++++++++++++++++++++++-------------------------- src/mesa/main/context.c | 6 ---- src/mesa/main/texobj.c | 4 --- src/mesa/main/texstate.c | 6 ---- 6 files changed, 64 insertions(+), 74 deletions(-) (limited to 'src') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 39941a1b03..30c142e53a 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -54,9 +54,7 @@ #endif #include "clear.h" #include "clip.h" -#if FEATURE_colortable #include "colortab.h" -#endif #include "context.h" #if FEATURE_convolve #include "convolve.h" @@ -385,17 +383,7 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_BlendEquation(exec, _mesa_BlendEquation); SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT); -#if FEATURE_colortable - SET_ColorSubTable(exec, _mesa_ColorSubTable); - SET_ColorTable(exec, _mesa_ColorTable); - SET_ColorTableParameterfv(exec, _mesa_ColorTableParameterfv); - SET_ColorTableParameteriv(exec, _mesa_ColorTableParameteriv); - SET_CopyColorSubTable(exec, _mesa_CopyColorSubTable); - SET_CopyColorTable(exec, _mesa_CopyColorTable); - SET_GetColorTable(exec, _mesa_GetColorTable); - SET_GetColorTableParameterfv(exec, _mesa_GetColorTableParameterfv); - SET_GetColorTableParameteriv(exec, _mesa_GetColorTableParameteriv); -#endif + _mesa_init_colortable_dispatch(exec); #if FEATURE_convolve SET_ConvolutionFilter1D(exec, _mesa_ConvolutionFilter1D); diff --git a/src/mesa/main/colortab.c b/src/mesa/main/colortab.c index 5447eb18ef..5ede76c1fb 100644 --- a/src/mesa/main/colortab.c +++ b/src/mesa/main/colortab.c @@ -32,6 +32,10 @@ #include "state.h" #include "teximage.h" #include "texstate.h" +#include "glapi/dispatch.h" + + +#if FEATURE_colortable /** @@ -536,7 +540,7 @@ _mesa_ColorSubTable( GLenum target, GLsizei start, -void GLAPIENTRY +static void GLAPIENTRY _mesa_CopyColorTable(GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width) { @@ -552,7 +556,7 @@ _mesa_CopyColorTable(GLenum target, GLenum internalformat, -void GLAPIENTRY +static void GLAPIENTRY _mesa_CopyColorSubTable(GLenum target, GLsizei start, GLint x, GLint y, GLsizei width) { @@ -568,7 +572,7 @@ _mesa_CopyColorSubTable(GLenum target, GLsizei start, -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetColorTable( GLenum target, GLenum format, GLenum type, GLvoid *data ) { @@ -702,7 +706,7 @@ _mesa_GetColorTable( GLenum target, GLenum format, -void GLAPIENTRY +static void GLAPIENTRY _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) { GLfloat *scale, *bias; @@ -747,7 +751,7 @@ _mesa_ColorTableParameterfv(GLenum target, GLenum pname, const GLfloat *params) -void GLAPIENTRY +static void GLAPIENTRY _mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) { GLfloat fparams[4]; @@ -770,7 +774,7 @@ _mesa_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) { GET_CURRENT_CONTEXT(ctx); @@ -897,7 +901,7 @@ _mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ) -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) { GET_CURRENT_CONTEXT(ctx); @@ -1052,6 +1056,25 @@ _mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ) } } + +void +_mesa_init_colortable_dispatch(struct _glapi_table *disp) +{ + SET_ColorSubTable(disp, _mesa_ColorSubTable); + SET_ColorTable(disp, _mesa_ColorTable); + SET_ColorTableParameterfv(disp, _mesa_ColorTableParameterfv); + SET_ColorTableParameteriv(disp, _mesa_ColorTableParameteriv); + SET_CopyColorSubTable(disp, _mesa_CopyColorSubTable); + SET_CopyColorTable(disp, _mesa_CopyColorTable); + SET_GetColorTable(disp, _mesa_GetColorTable); + SET_GetColorTableParameterfv(disp, _mesa_GetColorTableParameterfv); + SET_GetColorTableParameteriv(disp, _mesa_GetColorTableParameteriv); +} + + +#endif /* FEATURE_colortable */ + + /**********************************************************************/ /***** Initialization *****/ /**********************************************************************/ diff --git a/src/mesa/main/colortab.h b/src/mesa/main/colortab.h index b6ff737a65..652fb58246 100644 --- a/src/mesa/main/colortab.h +++ b/src/mesa/main/colortab.h @@ -27,9 +27,16 @@ #define COLORTAB_H -#include "mtypes.h" +#include "main/mtypes.h" -#if _HAVE_FULL_GL +#if FEATURE_colortable + +#define _MESA_INIT_COLORTABLE_FUNCTIONS(driver, impl) \ + do { \ + (driver)->CopyColorTable = impl ## CopyColorTable; \ + (driver)->CopyColorSubTable = impl ## CopyColorSubTable; \ + (driver)->UpdateTexturePalette = impl ## UpdateTexturePalette; \ + } while (0) extern void GLAPIENTRY _mesa_ColorTable( GLenum target, GLenum internalformat, @@ -41,32 +48,35 @@ _mesa_ColorSubTable( GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *table ); -extern void GLAPIENTRY -_mesa_CopyColorSubTable(GLenum target, GLsizei start, - GLint x, GLint y, GLsizei width); - -extern void GLAPIENTRY -_mesa_CopyColorTable(GLenum target, GLenum internalformat, - GLint x, GLint y, GLsizei width); +extern void +_mesa_init_colortable_dispatch(struct _glapi_table *disp); -extern void GLAPIENTRY -_mesa_GetColorTable( GLenum target, GLenum format, - GLenum type, GLvoid *table ); +#else /* FEATURE_colortable */ -extern void GLAPIENTRY -_mesa_ColorTableParameterfv(GLenum target, GLenum pname, - const GLfloat *params); +#define _MESA_INIT_COLORTABLE_FUNCTIONS(driver, impl) do { } while (0) -extern void GLAPIENTRY -_mesa_ColorTableParameteriv(GLenum target, GLenum pname, - const GLint *params); +static INLINE void GLAPIENTRY +_mesa_ColorTable( GLenum target, GLenum internalformat, + GLsizei width, GLenum format, GLenum type, + const GLvoid *table ) +{ + ASSERT_NO_FEATURE(); +} -extern void GLAPIENTRY -_mesa_GetColorTableParameterfv( GLenum target, GLenum pname, GLfloat *params ); +static INLINE void GLAPIENTRY +_mesa_ColorSubTable( GLenum target, GLsizei start, + GLsizei count, GLenum format, GLenum type, + const GLvoid *table ) +{ + ASSERT_NO_FEATURE(); +} -extern void GLAPIENTRY -_mesa_GetColorTableParameteriv( GLenum target, GLenum pname, GLint *params ); +static INLINE void +_mesa_init_colortable_dispatch(struct _glapi_table *disp) +{ +} +#endif /* FEATURE_colortable */ extern void @@ -81,20 +91,5 @@ _mesa_init_colortables( GLcontext *ctx ); extern void _mesa_free_colortables_data( GLcontext *ctx ); -#else - -/** No-op */ -#define _mesa_init_colortable( p ) ((void) 0) - -/** No-op */ -#define _mesa_free_colortable_data( p ) ((void) 0) - -/** No-op */ -#define _mesa_init_colortables( p ) ((void)0) - -/** No-op */ -#define _mesa_free_colortables_data( p ) ((void)0) - -#endif -#endif +#endif /* COLORTAB_H */ diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index f6d4ac4595..1907c799df 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -90,9 +90,7 @@ #include "blend.h" #include "buffers.h" #include "bufferobj.h" -#if FEATURE_colortable #include "colortab.h" -#endif #include "context.h" #include "cpuinfo.h" #include "debug.h" @@ -686,9 +684,7 @@ init_attrib_groups(GLcontext *ctx) #endif _mesa_init_buffer_objects( ctx ); _mesa_init_color( ctx ); -#if FEATURE_colortable _mesa_init_colortables( ctx ); -#endif _mesa_init_current( ctx ); _mesa_init_depth( ctx ); _mesa_init_debug( ctx ); @@ -1015,9 +1011,7 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_free_texture_data( ctx ); _mesa_free_matrix_data( ctx ); _mesa_free_viewport_data( ctx ); -#if FEATURE_colortable _mesa_free_colortables_data( ctx ); -#endif _mesa_free_program_data(ctx); _mesa_free_shader_state(ctx); #if FEATURE_ARB_occlusion_query diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index d09c439250..678845ece0 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -29,9 +29,7 @@ #include "mfeatures.h" -#if FEATURE_colortable #include "colortab.h" -#endif #include "context.h" #include "enums.h" #include "fbobject.h" @@ -194,9 +192,7 @@ _mesa_delete_texture_object( GLcontext *ctx, struct gl_texture_object *texObj ) */ texObj->Target = 0x99; -#if FEATURE_colortable _mesa_free_colortable_data(&texObj->Palette); -#endif /* free the texture images */ for (face = 0; face < 6; face++) { diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 861c5f37c4..b9311d0ffc 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -31,9 +31,7 @@ #include "glheader.h" #include "mfeatures.h" #include "colormac.h" -#if FEATURE_colortable #include "colortab.h" -#endif #include "context.h" #include "enums.h" #include "macros.h" @@ -753,9 +751,7 @@ _mesa_init_texture(GLcontext *ctx) ctx->Texture.CurrentUnit = 0; /* multitexture */ ctx->Texture._EnabledUnits = 0x0; ctx->Texture.SharedPalette = GL_FALSE; -#if FEATURE_colortable _mesa_init_colortable(&ctx->Texture.Palette); -#endif for (u = 0; u < MAX_TEXTURE_UNITS; u++) init_texture_unit(ctx, u); @@ -796,10 +792,8 @@ _mesa_free_texture_data(GLcontext *ctx) for (tgt = 0; tgt < NUM_TEXTURE_TARGETS; tgt++) ctx->Driver.DeleteTexture(ctx, ctx->Texture.ProxyTex[tgt]); -#if FEATURE_colortable for (u = 0; u < MAX_TEXTURE_IMAGE_UNITS; u++) _mesa_free_colortable_data(&ctx->Texture.Unit[u].ColorTable); -#endif } -- cgit v1.2.3 From 5a1e25afac8eac5df1c0c9d3165b9812f54909a6 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 23 Sep 2009 16:56:20 +0800 Subject: mesa/main: Make FEATURE_convolve follow feature conventions. As shown in mfeatures.h, this allows users of convolve.h to work without knowing if the feature is available. --- src/mesa/main/api_exec.c | 19 +------- src/mesa/main/convolve.c | 48 ++++++++++++++----- src/mesa/main/convolve.h | 118 ++++++++++++++++++++++++++--------------------- src/mesa/main/teximage.c | 2 - src/mesa/main/texstore.c | 2 - 5 files changed, 103 insertions(+), 86 deletions(-) (limited to 'src') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 30c142e53a..6317639075 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -56,9 +56,7 @@ #include "clip.h" #include "colortab.h" #include "context.h" -#if FEATURE_convolve #include "convolve.h" -#endif #include "depth.h" #if FEATURE_dlist #include "dlist.h" @@ -384,21 +382,7 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_BlendEquationSeparateEXT(exec, _mesa_BlendEquationSeparateEXT); _mesa_init_colortable_dispatch(exec); - -#if FEATURE_convolve - SET_ConvolutionFilter1D(exec, _mesa_ConvolutionFilter1D); - SET_ConvolutionFilter2D(exec, _mesa_ConvolutionFilter2D); - SET_ConvolutionParameterf(exec, _mesa_ConvolutionParameterf); - SET_ConvolutionParameterfv(exec, _mesa_ConvolutionParameterfv); - SET_ConvolutionParameteri(exec, _mesa_ConvolutionParameteri); - SET_ConvolutionParameteriv(exec, _mesa_ConvolutionParameteriv); - SET_CopyConvolutionFilter1D(exec, _mesa_CopyConvolutionFilter1D); - SET_CopyConvolutionFilter2D(exec, _mesa_CopyConvolutionFilter2D); - SET_GetConvolutionFilter(exec, _mesa_GetConvolutionFilter); - SET_GetConvolutionParameterfv(exec, _mesa_GetConvolutionParameterfv); - SET_GetConvolutionParameteriv(exec, _mesa_GetConvolutionParameteriv); - SET_SeparableFilter2D(exec, _mesa_SeparableFilter2D); -#endif + _mesa_init_convolve_dispatch(exec); #if FEATURE_histogram SET_GetHistogram(exec, _mesa_GetHistogram); SET_GetHistogramParameterfv(exec, _mesa_GetHistogramParameterfv); @@ -406,7 +390,6 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_GetMinmax(exec, _mesa_GetMinmax); SET_GetMinmaxParameterfv(exec, _mesa_GetMinmaxParameterfv); SET_GetMinmaxParameteriv(exec, _mesa_GetMinmaxParameteriv); - SET_GetSeparableFilter(exec, _mesa_GetSeparableFilter); SET_Histogram(exec, _mesa_Histogram); SET_Minmax(exec, _mesa_Minmax); SET_ResetHistogram(exec, _mesa_ResetHistogram); diff --git a/src/mesa/main/convolve.c b/src/mesa/main/convolve.c index bf6f6619d4..8db3e79d38 100644 --- a/src/mesa/main/convolve.c +++ b/src/mesa/main/convolve.c @@ -40,6 +40,10 @@ #include "mtypes.h" #include "pixel.h" #include "state.h" +#include "glapi/dispatch.h" + + +#if FEATURE_convolve /* @@ -256,7 +260,7 @@ _mesa_ConvolutionFilter2D(GLenum target, GLenum internalFormat, GLsizei width, G } -void GLAPIENTRY +static void GLAPIENTRY _mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) { GET_CURRENT_CONTEXT(ctx); @@ -299,7 +303,7 @@ _mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) { GET_CURRENT_CONTEXT(ctx); @@ -351,7 +355,7 @@ _mesa_ConvolutionParameterfv(GLenum target, GLenum pname, const GLfloat *params) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) { GET_CURRENT_CONTEXT(ctx); @@ -394,7 +398,7 @@ _mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) { GET_CURRENT_CONTEXT(ctx); @@ -459,7 +463,7 @@ _mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width) { GLint baseFormat; @@ -491,7 +495,7 @@ _mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalFormat, GLint x, GLi } -void GLAPIENTRY +static void GLAPIENTRY _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height) { GLint baseFormat; @@ -527,7 +531,7 @@ _mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalFormat, GLint x, GLi } -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, GLvoid *image) { @@ -586,7 +590,7 @@ _mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, } -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); @@ -647,7 +651,7 @@ _mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); @@ -717,7 +721,7 @@ _mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span) { @@ -784,7 +788,7 @@ _mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, } -void GLAPIENTRY +static void GLAPIENTRY _mesa_SeparableFilter2D(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column) { const GLint colStart = MAX_CONVOLUTION_WIDTH * 4; @@ -1433,3 +1437,25 @@ _mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions, *height = *height - (MAX2(ctx->Separable2D.Height, 1) - 1); } } + + +void +_mesa_init_convolve_dispatch(struct _glapi_table *disp) +{ + SET_ConvolutionFilter1D(disp, _mesa_ConvolutionFilter1D); + SET_ConvolutionFilter2D(disp, _mesa_ConvolutionFilter2D); + SET_ConvolutionParameterf(disp, _mesa_ConvolutionParameterf); + SET_ConvolutionParameterfv(disp, _mesa_ConvolutionParameterfv); + SET_ConvolutionParameteri(disp, _mesa_ConvolutionParameteri); + SET_ConvolutionParameteriv(disp, _mesa_ConvolutionParameteriv); + SET_CopyConvolutionFilter1D(disp, _mesa_CopyConvolutionFilter1D); + SET_CopyConvolutionFilter2D(disp, _mesa_CopyConvolutionFilter2D); + SET_GetConvolutionFilter(disp, _mesa_GetConvolutionFilter); + SET_GetConvolutionParameterfv(disp, _mesa_GetConvolutionParameterfv); + SET_GetConvolutionParameteriv(disp, _mesa_GetConvolutionParameteriv); + SET_SeparableFilter2D(disp, _mesa_SeparableFilter2D); + SET_GetSeparableFilter(disp, _mesa_GetSeparableFilter); +} + + +#endif /* FEATURE_convolve */ diff --git a/src/mesa/main/convolve.h b/src/mesa/main/convolve.h index 4505cdae01..59492bc7c5 100644 --- a/src/mesa/main/convolve.h +++ b/src/mesa/main/convolve.h @@ -28,10 +28,17 @@ #define CONVOLVE_H -#include "mtypes.h" +#include "main/mtypes.h" -#if _HAVE_FULL_GL +#if FEATURE_convolve + +#define _MESA_INIT_CONVOLVE_FUNCTIONS(driver, impl) \ + do { \ + (driver)->CopyConvolutionFilter1D = impl ## CopyConvolutionFilter1D; \ + (driver)->CopyConvolutionFilter2D = impl ## CopyConvolutionFilter2D; \ + } while (0) + extern void GLAPIENTRY _mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image); @@ -41,74 +48,79 @@ _mesa_ConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image); -extern void GLAPIENTRY -_mesa_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat params); - -extern void GLAPIENTRY -_mesa_ConvolutionParameterfv(GLenum target, GLenum pname, - const GLfloat *params); - -extern void GLAPIENTRY -_mesa_ConvolutionParameteri(GLenum target, GLenum pname, GLint params); - -extern void GLAPIENTRY -_mesa_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params); - -extern void GLAPIENTRY -_mesa_CopyConvolutionFilter1D(GLenum target, GLenum internalformat, - GLint x, GLint y, GLsizei width); +extern void +_mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width, + const GLfloat *srcImage, GLfloat *dstImage); -extern void GLAPIENTRY -_mesa_CopyConvolutionFilter2D(GLenum target, GLenum internalformat, - GLint x, GLint y, GLsizei width, GLsizei height); +extern void +_mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height, + const GLfloat *srcImage, GLfloat *dstImage); -extern void GLAPIENTRY -_mesa_GetConvolutionFilter(GLenum target, GLenum format, GLenum type, - GLvoid *image); +extern void +_mesa_convolve_sep_image(const GLcontext *ctx, + GLsizei *width, GLsizei *height, + const GLfloat *srcImage, GLfloat *dstImage); -extern void GLAPIENTRY -_mesa_GetConvolutionParameterfv(GLenum target, GLenum pname, GLfloat *params); +extern void +_mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions, + GLsizei *width, GLsizei *height); -extern void GLAPIENTRY -_mesa_GetConvolutionParameteriv(GLenum target, GLenum pname, GLint *params); +extern void +_mesa_init_convolve_dispatch(struct _glapi_table *disp); -extern void GLAPIENTRY -_mesa_GetSeparableFilter(GLenum target, GLenum format, GLenum type, - GLvoid *row, GLvoid *column, GLvoid *span); +#else /* FEATURE_convolve */ -extern void GLAPIENTRY -_mesa_SeparableFilter2D(GLenum target, GLenum internalformat, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const GLvoid *row, const GLvoid *column); +#define _MESA_INIT_CONVOLVE_FUNCTIONS(driver, impl) do { } while (0) +static INLINE void GLAPIENTRY +_mesa_ConvolutionFilter1D(GLenum target, GLenum internalformat, GLsizei width, + GLenum format, GLenum type, const GLvoid *image) +{ + ASSERT_NO_FEATURE(); +} +static INLINE void GLAPIENTRY +_mesa_ConvolutionFilter2D(GLenum target, GLenum internalformat, GLsizei width, + GLsizei height, GLenum format, GLenum type, + const GLvoid *image) +{ + ASSERT_NO_FEATURE(); +} -extern void +static INLINE void _mesa_convolve_1d_image(const GLcontext *ctx, GLsizei *width, - const GLfloat *srcImage, GLfloat *dstImage); - + const GLfloat *srcImage, GLfloat *dstImage) +{ + ASSERT_NO_FEATURE(); +} -extern void +static INLINE void _mesa_convolve_2d_image(const GLcontext *ctx, GLsizei *width, GLsizei *height, - const GLfloat *srcImage, GLfloat *dstImage); + const GLfloat *srcImage, GLfloat *dstImage) +{ + ASSERT_NO_FEATURE(); +} -extern void +static INLINE void _mesa_convolve_sep_image(const GLcontext *ctx, GLsizei *width, GLsizei *height, - const GLfloat *srcImage, GLfloat *dstImage); - + const GLfloat *srcImage, GLfloat *dstImage) +{ + ASSERT_NO_FEATURE(); +} -extern void +static INLINE void _mesa_adjust_image_for_convolution(const GLcontext *ctx, GLuint dimensions, - GLsizei *width, GLsizei *height); + GLsizei *width, GLsizei *height) +{ +} + +static INLINE void +_mesa_init_convolve_dispatch(struct _glapi_table *disp) +{ +} -#else -#define _mesa_adjust_image_for_convolution(c, d, w, h) ((void)0) -#define _mesa_convolve_1d_image(c,w,s,d) ((void)0) -#define _mesa_convolve_2d_image(c,w,h,s,d) ((void)0) -#define _mesa_convolve_sep_image(c,w,h,s,d) ((void)0) -#endif +#endif /* FEATURE_convolve */ -#endif +#endif /* CONVOLVE_H */ diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index b555624d88..465da6b046 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -33,9 +33,7 @@ #include "glheader.h" #include "bufferobj.h" #include "context.h" -#if FEATURE_convolve #include "convolve.h" -#endif #include "enums.h" #include "fbobject.h" #include "framebuffer.h" diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index ab9973b810..f553a898f9 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -56,9 +56,7 @@ #include "bufferobj.h" #include "colormac.h" #include "context.h" -#if FEATURE_convolve #include "convolve.h" -#endif #include "image.h" #include "macros.h" #include "mipmap.h" -- cgit v1.2.3 From 16a6ca9b2bd4f91aad69d4a5d36402e70a46bd37 Mon Sep 17 00:00:00 2001 From: Cooper Yuan Date: Fri, 25 Sep 2009 15:15:20 +0800 Subject: r300g: add texture format for xvmc --- src/gallium/drivers/r300/r300_texture.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h index 3109af5bac..697669147d 100644 --- a/src/gallium/drivers/r300/r300_texture.h +++ b/src/gallium/drivers/r300/r300_texture.h @@ -72,6 +72,9 @@ static INLINE uint32_t r300_translate_texformat(enum pipe_format format) /* W24_FP */ case PIPE_FORMAT_Z24S8_UNORM: return R300_EASY_TX_FORMAT(X, X, X, X, W24_FP); + /* Z5_Y6_X5 */ + case PIPE_FORMAT_R16_SNORM: + return R300_EASY_TX_FORMAT(X, X, X, X, Z5Y6X5); default: debug_printf("r300: Implementation error: " "Got unsupported texture format %s in %s\n", -- cgit v1.2.3 From 1196f9fbd68d9f3d1acd3d097711b382d7489f41 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Thu, 24 Sep 2009 16:39:56 +0200 Subject: nv50: implement IF, ELSE, ENDIF opcodes --- src/gallium/drivers/nv50/nv50_program.c | 188 +++++++++++++++++++++++++------- 1 file changed, 146 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index eb90d5e66f..2ab2ac35c2 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -90,6 +90,9 @@ struct nv50_reg { int acc; /* instruction where this reg is last read (first insn == 1) */ }; +/* arbitrary limit */ +#define MAX_IF_DEPTH 4 + struct nv50_pc { struct nv50_program *p; @@ -121,6 +124,11 @@ struct nv50_pc { struct nv50_reg *iv_p; struct nv50_reg *iv_c; + struct nv50_program_exec *if_cond; + struct nv50_program_exec *if_insn[MAX_IF_DEPTH]; + struct nv50_program_exec *br_join[MAX_IF_DEPTH]; + int if_lvl; + /* current instruction and total number of insns */ unsigned insn_cur; unsigned insn_nr; @@ -890,6 +898,7 @@ emit_set(struct nv50_pc *pc, unsigned ccode, struct nv50_reg *dst, int wp, set_src_1(pc, src1, e); emit(pc, e); + pc->if_cond = pc->p->exec_tail; /* record for OPCODE_IF */ /* cvt.f32.u32/s32 (?) if we didn't only write the predicate */ if (rdst) @@ -1148,6 +1157,38 @@ emit_tex(struct nv50_pc *pc, struct nv50_reg **dst, unsigned mask, #endif } +static void +emit_branch(struct nv50_pc *pc, int pred, unsigned cc, + struct nv50_program_exec **join) +{ + struct nv50_program_exec *e = exec(pc); + + if (join) { + set_long(pc, e); + e->inst[0] |= 0xa0000002; + emit(pc, e); + *join = e; + e = exec(pc); + } + + set_long(pc, e); + e->inst[0] |= 0x10000002; + if (pred >= 0) + set_pred(pc, cc, pred, e); + emit(pc, e); +} + +static void +emit_nop(struct nv50_pc *pc) +{ + struct nv50_program_exec *e = exec(pc); + + e->inst[0] = 0xf0000000; + set_long(pc, e); + e->inst[1] = 0xe0000000; + emit(pc, e); +} + static void convert_to_long(struct nv50_pc *pc, struct nv50_program_exec *e) { @@ -1560,6 +1601,24 @@ nv50_program_tx_insn(struct nv50_pc *pc, if (mask & (1 << 0)) emit_mov_immdval(pc, dst[0], 1.0f); break; + case TGSI_OPCODE_ELSE: + emit_branch(pc, -1, 0, NULL); + pc->if_insn[--pc->if_lvl]->param.index = pc->p->exec_size; + pc->if_insn[pc->if_lvl++] = pc->p->exec_tail; + break; + case TGSI_OPCODE_ENDIF: + pc->if_insn[--pc->if_lvl]->param.index = pc->p->exec_size; + + if (pc->br_join[pc->if_lvl]) { + pc->br_join[pc->if_lvl]->param.index = pc->p->exec_size; + pc->br_join[pc->if_lvl] = NULL; + } + /* emit a NOP as join point, we could set it on the next + * one, but would have to make sure it is long and !immd + */ + emit_nop(pc); + pc->p->exec_tail->inst[1] |= 2; + break; case TGSI_OPCODE_EX2: emit_preex2(pc, temp, src[0][0]); emit_flop(pc, 6, brdc, temp); @@ -1580,6 +1639,13 @@ nv50_program_tx_insn(struct nv50_pc *pc, emit_sub(pc, dst[c], src[0][c], temp); } break; + case TGSI_OPCODE_IF: + /* emitting a join_at may not be necessary */ + assert(pc->if_lvl < MAX_IF_DEPTH); + set_pred_wr(pc, 1, 0, pc->if_cond); + emit_branch(pc, 0, 2, &pc->br_join[pc->if_lvl]); + pc->if_insn[pc->if_lvl++] = pc->p->exec_tail; + break; case TGSI_OPCODE_KIL: emit_kil(pc, src[0][0]); emit_kil(pc, src[0][1]); @@ -2237,6 +2303,8 @@ nv50_program_tx_prep(struct nv50_pc *pc) pc->result[i].rhw = rid++; if (p->info.writes_z) pc->result[2].rhw = rid; + + p->cfg.high_result = rid; } if (pc->immd_nr) { @@ -2362,12 +2430,75 @@ ctor_nv50_pc(struct nv50_pc *pc, struct nv50_program *p) return TRUE; } +static void +nv50_fp_move_results(struct nv50_pc *pc) +{ + struct nv50_reg reg; + unsigned i; + + ctor_reg(®, P_TEMP, -1, -1); + + for (i = 0; i < pc->result_nr * 4; ++i) { + if (pc->result[i].rhw < 0 || pc->result[i].hw < 0) + continue; + if (pc->result[i].rhw != pc->result[i].hw) { + reg.hw = pc->result[i].rhw; + emit_mov(pc, ®, &pc->result[i]); + } + } +} + +static void +nv50_program_fixup_insns(struct nv50_pc *pc) +{ + struct nv50_program_exec *e, *prev = NULL, **bra_list; + unsigned i, n, pos; + + bra_list = CALLOC(pc->p->exec_size, sizeof(struct nv50_program_exec *)); + + /* Collect branch instructions, we need to adjust their offsets + * when converting 32 bit instructions to 64 bit ones + */ + for (n = 0, e = pc->p->exec_head; e; e = e->next) + if (e->param.index >= 0 && !e->param.mask) + bra_list[n++] = e; + + /* Make sure we don't have any single 32 bit instructions. */ + for (e = pc->p->exec_head, pos = 0; e; e = e->next) { + pos += is_long(e) ? 2 : 1; + + if ((pos & 1) && (!e->next || is_long(e->next))) { + for (i = 0; i < n; ++i) + if (bra_list[i]->param.index >= pos) + bra_list[i]->param.index += 1; + convert_to_long(pc, e); + ++pos; + } + if (e->next) + prev = e; + } + + assert(!is_immd(pc->p->exec_head)); + assert(!is_immd(pc->p->exec_tail)); + + /* last instruction must be long so it can have the end bit set */ + if (!is_long(pc->p->exec_tail)) { + convert_to_long(pc, pc->p->exec_tail); + if (prev) + convert_to_long(pc, prev); + } + assert(!(pc->p->exec_tail->inst[1] & 2)); + /* set the end-bit */ + pc->p->exec_tail->inst[1] |= 1; + + FREE(bra_list); +} + static boolean nv50_program_tx(struct nv50_program *p) { struct tgsi_parse_context parse; struct nv50_pc *pc; - unsigned k; boolean ret; pc = CALLOC_STRUCT(nv50_pc); @@ -2405,48 +2536,10 @@ nv50_program_tx(struct nv50_program *p) } } - if (p->type == PIPE_SHADER_FRAGMENT) { - struct nv50_reg out; - ctor_reg(&out, P_TEMP, -1, -1); - - for (k = 0; k < pc->result_nr * 4; k++) { - if (pc->result[k].rhw == -1) - continue; - if (pc->result[k].hw != pc->result[k].rhw) { - out.hw = pc->result[k].rhw; - emit_mov(pc, &out, &pc->result[k]); - } - if (pc->p->cfg.high_result < (pc->result[k].rhw + 1)) - pc->p->cfg.high_result = pc->result[k].rhw + 1; - } - } - - /* look for single half instructions and make them long */ - struct nv50_program_exec *e, *e_prev; - - for (k = 0, e = pc->p->exec_head, e_prev = NULL; e; e = e->next) { - if (!is_long(e)) - k++; + if (pc->p->type == PIPE_SHADER_FRAGMENT) + nv50_fp_move_results(pc); - if (!e->next || is_long(e->next)) { - if (k & 1) - convert_to_long(pc, e); - k = 0; - } - - if (e->next) - e_prev = e; - } - - if (!is_long(pc->p->exec_tail)) { - /* this may occur if moving FP results */ - assert(e_prev && !is_long(e_prev)); - convert_to_long(pc, e_prev); - convert_to_long(pc, pc->p->exec_tail); - } - - assert(is_long(pc->p->exec_tail) && !is_immd(pc->p->exec_head)); - pc->p->exec_tail->inst[1] |= 0x00000001; + nv50_program_fixup_insns(pc); p->param_nr = pc->param_nr * 4; p->immd_nr = pc->immd_nr * 4; @@ -2558,6 +2651,17 @@ nv50_program_validate_code(struct nv50_context *nv50, struct nv50_program *p) if (e->param.index < 0) continue; + + if (e->param.mask == 0) { + assert(!(e->param.index & 1)); + /* seem to be 8 byte steps */ + ei = (e->param.index >> 1) + 0 /* START_ID */; + + e->inst[0] &= 0xf0000fff; + e->inst[0] |= ei << 12; + continue; + } + bs = (e->inst[1] >> 22) & 0x07; assert(bs < 2); ei = e->param.shift >> 5; -- cgit v1.2.3 From e2b8dc3e38d1efddf2ded2e47a9e3092455d0f8a Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Fri, 25 Sep 2009 10:24:40 +0200 Subject: nv50: implement BGNLOOP, BRK, ENDLOOP There's a good chance a loop won't execute correctly though since our TEMP allocation assumes programs to be executed linearly. Will fix later. --- src/gallium/drivers/nv50/nv50_program.c | 77 ++++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 2ab2ac35c2..8e66fdca49 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -90,8 +90,9 @@ struct nv50_reg { int acc; /* instruction where this reg is last read (first insn == 1) */ }; -/* arbitrary limit */ +/* arbitrary limits */ #define MAX_IF_DEPTH 4 +#define MAX_LOOP_DEPTH 4 struct nv50_pc { struct nv50_program *p; @@ -127,7 +128,9 @@ struct nv50_pc { struct nv50_program_exec *if_cond; struct nv50_program_exec *if_insn[MAX_IF_DEPTH]; struct nv50_program_exec *br_join[MAX_IF_DEPTH]; - int if_lvl; + struct nv50_program_exec *br_loop[MAX_LOOP_DEPTH]; /* for BRK branch */ + int if_lvl, loop_lvl; + unsigned loop_pos[MAX_LOOP_DEPTH]; /* current instruction and total number of insns */ unsigned insn_cur; @@ -204,6 +207,10 @@ alloc_reg(struct nv50_pc *pc, struct nv50_reg *reg) assert(0); } +/* XXX: For shaders that aren't executed linearly (e.g. shaders that + * contain loops), we need to assign all hw regs to TGSI TEMPs early, + * lest we risk temp_temps overwriting regs alloc'd "later". + */ static struct nv50_reg * alloc_temp(struct nv50_pc *pc, struct nv50_reg *dst) { @@ -1485,6 +1492,55 @@ nv50_tgsi_dst_revdep(unsigned op, int s, int c) } } +static INLINE boolean +has_pred(struct nv50_program_exec *e, unsigned cc) +{ + if (!is_long(e) || is_immd(e)) + return FALSE; + return ((e->inst[1] & 0x780) == (cc << 7)); +} + +/* on ENDIF see if we can do "@p0.neu single_op" instead of: + * join_at ENDIF + * @p0.eq bra ENDIF + * single_op + * ENDIF: nop.join + */ +static boolean +nv50_kill_branch(struct nv50_pc *pc) +{ + int lvl = pc->if_lvl; + + if (pc->if_insn[lvl]->next != pc->p->exec_tail) + return FALSE; + + /* if ccode == 'true', the BRA is from an ELSE and the predicate + * reg may no longer be valid, since we currently always use $p0 + */ + if (has_pred(pc->if_insn[lvl], 0xf)) + return FALSE; + assert(pc->if_insn[lvl] && pc->br_join[lvl]); + + /* We'll use the exec allocated for JOIN_AT (as we can't easily + * update prev's next); if exec_tail is BRK, update the pointer. + */ + if (pc->loop_lvl && pc->br_loop[pc->loop_lvl - 1] == pc->p->exec_tail) + pc->br_loop[pc->loop_lvl - 1] = pc->br_join[lvl]; + + pc->p->exec_size -= 4; /* remove JOIN_AT and BRA */ + + *pc->br_join[lvl] = *pc->p->exec_tail; + + FREE(pc->if_insn[lvl]); + FREE(pc->p->exec_tail); + + pc->p->exec_tail = pc->br_join[lvl]; + pc->p->exec_tail->next = NULL; + set_pred(pc, 0xd, 0, pc->p->exec_tail); + + return TRUE; +} + static boolean nv50_program_tx_insn(struct nv50_pc *pc, const struct tgsi_full_instruction *inst) @@ -1554,6 +1610,14 @@ nv50_program_tx_insn(struct nv50_pc *pc, emit_add(pc, dst[c], src[0][c], src[1][c]); } break; + case TGSI_OPCODE_BGNLOOP: + pc->loop_pos[pc->loop_lvl++] = pc->p->exec_size; + break; + case TGSI_OPCODE_BRK: + emit_branch(pc, -1, 0, NULL); + assert(pc->loop_lvl > 0); + pc->br_loop[pc->loop_lvl - 1] = pc->p->exec_tail; + break; case TGSI_OPCODE_CEIL: for (c = 0; c < 4; c++) { if (!(mask & (1 << c))) @@ -1609,6 +1673,10 @@ nv50_program_tx_insn(struct nv50_pc *pc, case TGSI_OPCODE_ENDIF: pc->if_insn[--pc->if_lvl]->param.index = pc->p->exec_size; + /* try to replace branch over 1 insn with a predicated insn */ + if (nv50_kill_branch(pc) == TRUE) + break; + if (pc->br_join[pc->if_lvl]) { pc->br_join[pc->if_lvl]->param.index = pc->p->exec_size; pc->br_join[pc->if_lvl] = NULL; @@ -1619,6 +1687,11 @@ nv50_program_tx_insn(struct nv50_pc *pc, emit_nop(pc); pc->p->exec_tail->inst[1] |= 2; break; + case TGSI_OPCODE_ENDLOOP: + emit_branch(pc, -1, 0, NULL); + pc->p->exec_tail->param.index = pc->loop_pos[--pc->loop_lvl]; + pc->br_loop[pc->loop_lvl]->param.index = pc->p->exec_size; + break; case TGSI_OPCODE_EX2: emit_preex2(pc, temp, src[0][0]); emit_flop(pc, 6, brdc, temp); -- cgit v1.2.3 From ef6805710d5c1b139695704051754f39654c8a2e Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Fri, 25 Sep 2009 10:33:02 +0200 Subject: nv50: fix CEIL and TRUNC Separated the integer rounding mode flag for cvt. --- src/gallium/drivers/nv50/nv50_program.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 8e66fdca49..2ad8cdf65c 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -825,7 +825,8 @@ emit_precossin(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src) #define CVT_F32_U32 0x64 #define CVT_S32_F32 0x8c #define CVT_S32_S32 0x0c -#define CVT_F32_F32_ROP 0xcc +#define CVT_NEG 0x20 +#define CVT_RI 0x08 static void emit_cvt(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src, @@ -933,7 +934,7 @@ map_tgsi_setop_cc(unsigned op) static INLINE void emit_flr(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src) { - emit_cvt(pc, dst, src, -1, CVTOP_FLOOR, CVT_F32_F32_ROP); + emit_cvt(pc, dst, src, -1, CVTOP_FLOOR, CVT_F32_F32 | CVT_RI); } static void @@ -1623,7 +1624,7 @@ nv50_program_tx_insn(struct nv50_pc *pc, if (!(mask & (1 << c))) continue; emit_cvt(pc, dst[c], src[0][c], -1, - CVTOP_CEIL, CVT_F32_F32); + CVTOP_CEIL, CVT_F32_F32 | CVT_RI); } break; case TGSI_OPCODE_COS: @@ -1843,7 +1844,7 @@ nv50_program_tx_insn(struct nv50_pc *pc, if (!(mask & (1 << c))) continue; emit_cvt(pc, dst[c], src[0][c], -1, - CVTOP_TRUNC, CVT_F32_F32); + CVTOP_TRUNC, CVT_F32_F32 | CVT_RI); } break; case TGSI_OPCODE_XPD: -- cgit v1.2.3 From 001daf78c87b2d194b51bc650bf9f917d4224e31 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Thu, 24 Sep 2009 17:24:48 +0200 Subject: nv50: RCP and RSQ cannot load from VP inputs --- src/gallium/drivers/nv50/nv50_program.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 2ad8cdf65c..272fd8d90b 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -573,6 +573,22 @@ check_swap_src_0_1(struct nv50_pc *pc, return FALSE; } +static void +set_src_0_restricted(struct nv50_pc *pc, struct nv50_reg *src, + struct nv50_program_exec *e) +{ + struct nv50_reg *temp; + + if (src->type != P_TEMP) { + temp = temp_temp(pc); + emit_mov(pc, temp, src); + src = temp; + } + + alloc_reg(pc, src); + e->inst[0] |= (src->hw << 9); +} + static void set_src_0(struct nv50_pc *pc, struct nv50_reg *src, struct nv50_program_exec *e) { @@ -775,7 +791,11 @@ emit_flop(struct nv50_pc *pc, unsigned sub, } set_dst(pc, dst, e); - set_src_0(pc, src, e); + + if (sub == 0 || sub == 2) + set_src_0_restricted(pc, src, e); + else + set_src_0(pc, src, e); emit(pc, e); } -- cgit v1.2.3 From 513cadf5afad18516f7299ade246f59d520753d0 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Thu, 24 Sep 2009 17:37:08 +0200 Subject: nv50: actually enable view volume clipping Until now, only primitives wholly outside the view volume were not drawn. This was only visibile when using a viewport smaller than the window size, naturally. --- src/gallium/drivers/nv50/nv50_state_validate.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index 5a3559ed18..4ed76973c4 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -312,7 +312,7 @@ scissor_uptodate: goto viewport_uptodate; nv50->state.viewport_bypass = bypass; - so = so_new(12, 0); + so = so_new(14, 0); if (!bypass) { so_method(so, tesla, NV50TCL_VIEWPORT_TRANSLATE(0), 3); so_data (so, fui(nv50->viewport.translate[0])); @@ -325,12 +325,21 @@ scissor_uptodate: so_method(so, tesla, NV50TCL_VIEWPORT_TRANSFORM_EN, 1); so_data (so, 1); + /* 0x0000 = remove whole primitive only (xyz) + * 0x1018 = remove whole primitive only (xy), clamp z + * 0x1080 = clip primitive (xyz) + * 0x1098 = clip primitive (xy), clamp z + */ + so_method(so, tesla, NV50TCL_VIEW_VOLUME_CLIP_CTRL, 1); + so_data (so, 0x1080); /* no idea what 0f90 does */ so_method(so, tesla, 0x0f90, 1); so_data (so, 0); } else { so_method(so, tesla, NV50TCL_VIEWPORT_TRANSFORM_EN, 1); so_data (so, 0); + so_method(so, tesla, NV50TCL_VIEW_VOLUME_CLIP_CTRL, 1); + so_data (so, 0x0000); so_method(so, tesla, 0x0f90, 1); so_data (so, 1); } -- cgit v1.2.3 From 5f4f7ad965c40327f16297606ed4f425598bfc2c Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Fri, 25 Sep 2009 10:53:01 +0200 Subject: nv50: fix TEX for WriteMask not equal 0xf If you e.g. only need alpha, it ends up in the first reg, not the last, as it would when reading rgb too. --- src/gallium/drivers/nv50/nv50_program.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 272fd8d90b..576d075318 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -1166,10 +1166,11 @@ emit_tex(struct nv50_pc *pc, struct nv50_reg **dst, unsigned mask, emit(pc, e); #if 1 - if (mask & 1) emit_mov(pc, dst[0], t[0]); - if (mask & 2) emit_mov(pc, dst[1], t[1]); - if (mask & 4) emit_mov(pc, dst[2], t[2]); - if (mask & 8) emit_mov(pc, dst[3], t[3]); + c = 0; + if (mask & 1) emit_mov(pc, dst[0], t[c++]); + if (mask & 2) emit_mov(pc, dst[1], t[c++]); + if (mask & 4) emit_mov(pc, dst[2], t[c++]); + if (mask & 8) emit_mov(pc, dst[3], t[c]); free_temp4(pc, t); #else -- cgit v1.2.3 From 46da1f2c9b67e3b4c3659f2d029140b639571407 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 25 Sep 2009 08:51:57 -0600 Subject: mesa: move declaration before code --- src/mesa/shader/nvvertparse.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/nvvertparse.c b/src/mesa/shader/nvvertparse.c index 6ab8a14cb9..8574016050 100644 --- a/src/mesa/shader/nvvertparse.c +++ b/src/mesa/shader/nvvertparse.c @@ -1415,9 +1415,10 @@ _mesa_parse_nv_vertex_program(GLcontext *ctx, GLenum dstTarget, * upload everything, _mesa_layout_parameters is the answer. */ for (i = 0; i < MAX_NV_VERTEX_PROGRAM_PARAMS; i++) { + GLint index; state_tokens[2] = i; - int index = _mesa_add_state_reference(program->Base.Parameters, - state_tokens); + index = _mesa_add_state_reference(program->Base.Parameters, + state_tokens); assert(index == i); } program->Base.NumParameters = program->Base.Parameters->NumParameters; -- cgit v1.2.3 From 02b81187dcf606ebf064ac23888e5c57d0528edf Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 25 Sep 2009 18:51:55 +0200 Subject: radeon: Fix newlines. --- src/mesa/drivers/dri/r600/r700_chip.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index e3b8a4081a..3b7f6fffe0 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -255,20 +255,20 @@ static void r700SetupVTXConstants2(GLcontext * ctx, SQ_VTX_CONSTANT_WORD2_0__DATA_FORMAT_shift, SQ_VTX_CONSTANT_WORD2_0__DATA_FORMAT_mask); /* TODO : trace back api for initial data type, not only GL_FLOAT */ - if(GL_TRUE == pStreamDesc->normalize) - { - SETfield(uSQ_VTX_CONSTANT_WORD2_0, SQ_NUM_FORMAT_NORM, - SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask); - } - //else - //{ - // SETfield(uSQ_VTX_CONSTANT_WORD2_0, SQ_NUM_FORMAT_INT, - // SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask); - //} - - if(1 == pStreamDesc->_signed) - { - SETbit(uSQ_VTX_CONSTANT_WORD2_0, SQ_VTX_CONSTANT_WORD2_0__FORMAT_COMP_ALL_bit); + if(GL_TRUE == pStreamDesc->normalize) + { + SETfield(uSQ_VTX_CONSTANT_WORD2_0, SQ_NUM_FORMAT_NORM, + SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask); + } + //else + //{ + // SETfield(uSQ_VTX_CONSTANT_WORD2_0, SQ_NUM_FORMAT_INT, + // SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask); + //} + + if(1 == pStreamDesc->_signed) + { + SETbit(uSQ_VTX_CONSTANT_WORD2_0, SQ_VTX_CONSTANT_WORD2_0__FORMAT_COMP_ALL_bit); } SETfield(uSQ_VTX_CONSTANT_WORD3_0, 1, MEM_REQUEST_SIZE_shift, MEM_REQUEST_SIZE_mask); -- cgit v1.2.3 From a0fbc01ceaef08b33f97936d8840a6f48ec1654d Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 25 Sep 2009 10:48:19 +0200 Subject: softpipe: Do not advertise support for L16 and YCBCR formats. --- src/gallium/drivers/softpipe/sp_screen.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 3c61357eba..81fb7aa20c 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -135,6 +135,9 @@ softpipe_is_format_supported( struct pipe_screen *screen, target == PIPE_TEXTURE_CUBE); switch(format) { + case PIPE_FORMAT_L16_UNORM: + case PIPE_FORMAT_YCBCR_REV: + case PIPE_FORMAT_YCBCR: case PIPE_FORMAT_DXT1_RGB: case PIPE_FORMAT_DXT1_RGBA: case PIPE_FORMAT_DXT3_RGBA: -- cgit v1.2.3 From 69c7fc128c59bf72df461dbd583bf9794d9ed34d Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 25 Sep 2009 10:57:33 +0200 Subject: softpipe: Grab fs output z from the correct file. --- src/gallium/drivers/softpipe/sp_fs_exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_fs_exec.c b/src/gallium/drivers/softpipe/sp_fs_exec.c index c469ac6340..4076114d39 100644 --- a/src/gallium/drivers/softpipe/sp_fs_exec.c +++ b/src/gallium/drivers/softpipe/sp_fs_exec.c @@ -151,7 +151,7 @@ exec_run( const struct sp_fragment_shader *base, { uint j; for (j = 0; j < 4; j++) { - quad->output.depth[j] = machine->Outputs[0].xyzw[2].f[j]; + quad->output.depth[j] = machine->Outputs[i].xyzw[2].f[j]; } } break; -- cgit v1.2.3 From 07f107467ed1e301b1362298c350ff3758a1f22f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 25 Sep 2009 20:38:49 +0200 Subject: st/xorg: Better checks for unsupported component alpha pictures. --- src/gallium/state_trackers/xorg/xorg_composite.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index f8a3d7ba8a..1bfcc28866 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -305,15 +305,15 @@ boolean xorg_composite_accelerated(int op, unsigned accel_ops_count = sizeof(accelerated_ops)/sizeof(struct acceleration_info); - if (pSrcPicture) { - /* component alpha not supported */ - if (pSrcPicture->componentAlpha) - return FALSE; - } - for (i = 0; i < accel_ops_count; ++i) { if (op == accelerated_ops[i].op) { - if (pMaskPicture && !accelerated_ops[i].with_mask) + /* Check for unsupported component alpha */ + if ((pSrcPicture->componentAlpha && + !accelerated_ops[i].component_alpha) || + (pMaskPicture && + (!accelerated_ops[i].with_mask || + (pMaskPicture->componentAlpha && + !accelerated_ops[i].component_alpha)))) return FALSE; return TRUE; } @@ -390,14 +390,9 @@ static void bind_blend_state(struct exa_context *exa, int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture) { - boolean component_alpha = (pSrcPicture) ? - pSrcPicture->componentAlpha : FALSE; struct xorg_composite_blend blend_opt; struct pipe_blend_state blend; - if (component_alpha) { - op = PictOpOver; - } blend_opt = blend_for_op(op); memset(&blend, 0, sizeof(struct pipe_blend_state)); -- cgit v1.2.3 From 7edda9350acbf84b63ad67af8053fb07785637cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 25 Sep 2009 20:38:49 +0200 Subject: st/xorg: Source-only pictures always have format PICT_a8r8g8b8. See xserver/render/picture.c:createSourcePicture(). This both simplifies the code and avoids a crash because pFormat is NULL. --- src/gallium/state_trackers/xorg/xorg_composite.c | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 1bfcc28866..2af557794d 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -57,24 +57,6 @@ pixel_to_float4(Pixel pixel, float *color) color[3] = ((float)a) / 255.; } -static INLINE void -render_pixel_to_float4(PictFormatPtr format, - CARD32 pixel, float *color) -{ - CARD32 r, g, b, a; - - debug_assert(format->type == PictTypeDirect); - - r = (pixel >> format->direct.red) & format->direct.redMask; - g = (pixel >> format->direct.green) & format->direct.greenMask; - b = (pixel >> format->direct.blue) & format->direct.blueMask; - a = (pixel >> format->direct.alpha) & format->direct.alphaMask; - color[0] = ((float)r) / ((float)format->direct.redMask); - color[1] = ((float)g) / ((float)format->direct.greenMask); - color[2] = ((float)b) / ((float)format->direct.blueMask); - color[3] = ((float)a) / ((float)format->direct.alphaMask); -} - struct acceleration_info { int op : 16; int with_mask : 1; @@ -433,9 +415,9 @@ bind_shaders(struct exa_context *exa, int op, if (pSrcPicture->pSourcePict->type == SourcePictTypeSolidFill) { fs_traits |= FS_SOLID_FILL; vs_traits |= VS_SOLID_FILL; - render_pixel_to_float4(pSrcPicture->pFormat, - pSrcPicture->pSourcePict->solidFill.color, - exa->solid_color); + debug_assert(pSrcPicture->format == PICT_a8r8g8b8); + pixel_to_float4(pSrcPicture->pSourcePict->solidFill.color, + exa->solid_color); exa->has_solid_color = TRUE; } else { debug_assert("!gradients not supported"); -- cgit v1.2.3 From 67fb13ba682951d3aa61efca25614cdde6bb70f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 25 Sep 2009 20:38:49 +0200 Subject: st/xorg: Bind rasterizer state for copies. --- src/gallium/state_trackers/xorg/xorg_composite.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 2af557794d..93e8c0c7fb 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -867,6 +867,8 @@ static void renderer_copy_texture(struct exa_context *exa, /* texture */ cso_set_sampler_textures(exa->cso, 1, &src); + bind_rasterizer_state(exa); + /* shaders */ shader = xorg_shaders_get(exa->shaders, VS_COMPOSITE, -- cgit v1.2.3 From b97547027e0f049d1ceef7863815d53e471fb18c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 25 Sep 2009 20:38:49 +0200 Subject: st/xorg: Use I8 format instead of A8 for depth 8 pixmaps. Seems to work better for Composite acceleration. --- src/gallium/state_trackers/xorg/xorg_exa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 1bb274e6bd..94f4ea2c38 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -75,7 +75,7 @@ exa_get_pipe_format(int depth, enum pipe_format *format, int *bbp) assert(*bbp == 16); break; case 8: - *format = PIPE_FORMAT_A8_UNORM; + *format = PIPE_FORMAT_I8_UNORM; assert(*bbp == 8); break; case 4: -- cgit v1.2.3 From ac2e0ddcd8f33505aee20e94dd64a804812f07fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 25 Sep 2009 20:38:49 +0200 Subject: st/xorg: Flesh out EXA PrepareComposite hook a little. Check that the formats are supported, and don't crash with source-only pictures. --- src/gallium/state_trackers/xorg/xorg_exa.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 94f4ea2c38..c3fff95466 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -438,17 +438,43 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum]; modesettingPtr ms = modesettingPTR(pScrn); struct exa_context *exa = ms->exa; + struct exa_pixmap_priv *priv; debug_printf("ExaPrepareComposite\n"); + priv = exaGetPixmapDriverPrivate(pDst); + if (!priv || !priv->tex || + !exa->scrn->is_format_supported(exa->scrn, priv->tex->format, + priv->tex->target, + PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) + return FALSE; + + if (pSrc) { + priv = exaGetPixmapDriverPrivate(pSrc); + if (!priv || !priv->tex || + !exa->scrn->is_format_supported(exa->scrn, priv->tex->format, + priv->tex->target, + PIPE_TEXTURE_USAGE_SAMPLER, 0)) + return FALSE; + } + + if (pMask) { + priv = exaGetPixmapDriverPrivate(pMask); + if (!priv || !priv->tex || + !exa->scrn->is_format_supported(exa->scrn, priv->tex->format, + priv->tex->target, + PIPE_TEXTURE_USAGE_SAMPLER, 0)) + return FALSE; + } + #if DISABLE_ACCEL (void) exa; return FALSE; #else return xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture, pDstPicture, - exaGetPixmapDriverPrivate(pSrc), - exaGetPixmapDriverPrivate(pMask), + pSrc ? exaGetPixmapDriverPrivate(pSrc) : NULL, + pMask ? exaGetPixmapDriverPrivate(pMask) : NULL, exaGetPixmapDriverPrivate(pDst)); #endif } -- cgit v1.2.3 From b0ddfe8a3dc3dfee87dd382a4aa7cbd03a395f37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 25 Sep 2009 20:38:49 +0200 Subject: st/xorg: Use generic semantic for Composite mask coordinates. --- src/gallium/state_trackers/xorg/xorg_exa_tgsi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c index 2daa5b5628..28954dc6f6 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c @@ -271,7 +271,7 @@ create_vs(struct pipe_context *pipe, if (has_mask) { src = ureg_DECL_vs_input(ureg, input_slot++); - dst = ureg_DECL_output(ureg, TGSI_SEMANTIC_POSITION, 2); + dst = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 2); ureg_MOV(ureg, dst, src); } @@ -330,7 +330,7 @@ create_fs(struct pipe_context *pipe, if (has_mask) { mask_sampler = ureg_DECL_sampler(ureg, 1); mask_pos = ureg_DECL_fs_input(ureg, - TGSI_SEMANTIC_POSITION, + TGSI_SEMANTIC_GENERIC, 1, TGSI_INTERPOLATE_PERSPECTIVE); } -- cgit v1.2.3 From 9c449502a2a92bc71bc438f366138ae82404c066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 25 Sep 2009 20:49:00 +0200 Subject: st/xorg: Make sure struct is fully initialized. gcc complained about a missing initializer. --- src/gallium/state_trackers/xorg/xorg_exa_tgsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c index 28954dc6f6..bb5a42af37 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c @@ -465,7 +465,7 @@ struct xorg_shader xorg_shaders_get(struct xorg_shaders *sc, unsigned vs_traits, unsigned fs_traits) { - struct xorg_shader shader = {0}; + struct xorg_shader shader = { NULL, NULL }; void *vs, *fs; vs = shader_from_cache(sc->exa->pipe, PIPE_SHADER_VERTEX, -- cgit v1.2.3 From 626553f327394b835cecaf4795692028c2378efa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 25 Sep 2009 20:49:53 +0200 Subject: st/xorg: Reject Composite acceleration for some cases not working yet. --- src/gallium/state_trackers/xorg/xorg_composite.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 93e8c0c7fb..a97cad48b5 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -287,6 +287,16 @@ boolean xorg_composite_accelerated(int op, unsigned accel_ops_count = sizeof(accelerated_ops)/sizeof(struct acceleration_info); + if (pSrcPicture->pSourcePict) { + /* Gradients not yet supported */ + if (pSrcPicture->pSourcePict->type != SourcePictTypeSolidFill) + return FALSE; + + /* Solid source with mask not yet handled properly */ + if (pMaskPicture) + return FALSE; + } + for (i = 0; i < accel_ops_count; ++i) { if (op == accelerated_ops[i].op) { /* Check for unsupported component alpha */ -- cgit v1.2.3 From 07e2d6edfac618729bc2321fd64e15f34360d5fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 25 Sep 2009 20:49:53 +0200 Subject: st/xorg: Flush render cache if but only if a source has pending write operations. --- src/gallium/state_trackers/xorg/xorg_composite.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index a97cad48b5..9d15a615f1 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -465,6 +465,12 @@ bind_samplers(struct exa_context *exa, int op, memset(&src_sampler, 0, sizeof(struct pipe_sampler_state)); memset(&mask_sampler, 0, sizeof(struct pipe_sampler_state)); + if ((pSrc && exa->pipe->is_texture_referenced(exa->pipe, pSrc->tex, 0, 0) & + PIPE_REFERENCED_FOR_WRITE) || + (pMask && exa->pipe->is_texture_referenced(exa->pipe, pMask->tex, 0, 0) & + PIPE_REFERENCED_FOR_WRITE)) + exa->pipe->flush(exa->pipe, PIPE_FLUSH_RENDER_CACHE, NULL); + if (pSrcPicture && pSrc) { unsigned src_wrap = render_repeat_to_gallium( pSrcPicture->repeatType); @@ -995,7 +1001,9 @@ void xorg_copy_pixmap(struct exa_context *ctx, struct pipe_texture *dst = dst_priv->tex; struct pipe_texture *src = src_priv->tex; - xorg_exa_finish(ctx); + if (ctx->pipe->is_texture_referenced(ctx->pipe, src, 0, 0) & + PIPE_REFERENCED_FOR_WRITE) + ctx->pipe->flush(ctx->pipe, PIPE_FLUSH_RENDER_CACHE, NULL); dst_loc[0] = dx; dst_loc[1] = dy; -- cgit v1.2.3 From c19482b16f164ce1b6625d18950a4644e5834373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 25 Sep 2009 20:49:53 +0200 Subject: st/xorg: Re-enable accelerated fills and copies. These seem to work well enough now with the new code. Composite acceleration isn't quite there yet and thus remains disabled in xorg_composite_bind_state() for now. --- src/gallium/state_trackers/xorg/xorg_exa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index c3fff95466..3f48ab98ac 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -48,7 +48,7 @@ #include "util/u_rect.h" #define DEBUG_SOLID 0 -#define DISABLE_ACCEL 1 +#define DISABLE_ACCEL 0 /* * Helper functions -- cgit v1.2.3 From 151e0c0aeaa78f4eb6a87d2b3dd86b4807db1523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 25 Sep 2009 20:59:44 +0200 Subject: intel: Handle GL_RGB8 for glCopyTex(Sub)Image. Avoids an unnecessary fallback. --- src/mesa/drivers/dri/intel/intel_tex_copy.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 028b49c14d..74f7f58bbe 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -74,6 +74,7 @@ get_teximage_source(struct intel_context *intel, GLenum internalFormat) case GL_RGBA: case GL_RGBA8: case GL_RGB: + case GL_RGB8: return intel_readbuf_region(intel); default: return NULL; -- cgit v1.2.3 From 07183b73ebafe2d1083f1c572978317768725b99 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 26 Sep 2009 16:39:13 +1000 Subject: r300g: fix texture pitch to correct value. pitch is pixels - 1, not bytes. --- src/gallium/drivers/r300/r300_texture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 7c041d17f7..e8078ea9f1 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -37,7 +37,7 @@ static void r300_setup_texture_state(struct r300_texture* tex, /* XXX */ state->format1 = r300_translate_texformat(tex->tex.format); - state->format2 = r300_texture_get_stride(tex, 0); + state->format2 = (r300_texture_get_stride(tex, 0) / tex->tex.block.size) - 1; /* Assume (somewhat foolishly) that oversized textures will * not be permitted by the state tracker. */ -- cgit v1.2.3 From 20d3c85128192b2d3f75b68f47ab9aadc2719c5a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 26 Sep 2009 18:24:34 +1000 Subject: r300g: add z16 unorm texture format --- src/gallium/drivers/r300/r300_texture.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h index 697669147d..78ee0f1611 100644 --- a/src/gallium/drivers/r300/r300_texture.h +++ b/src/gallium/drivers/r300/r300_texture.h @@ -75,6 +75,8 @@ static INLINE uint32_t r300_translate_texformat(enum pipe_format format) /* Z5_Y6_X5 */ case PIPE_FORMAT_R16_SNORM: return R300_EASY_TX_FORMAT(X, X, X, X, Z5Y6X5); + case PIPE_FORMAT_Z16_UNORM: + return R300_EASY_TX_FORMAT(X, X, X, X, X16); default: debug_printf("r300: Implementation error: " "Got unsupported texture format %s in %s\n", -- cgit v1.2.3 From 28f531e3fe95c9fad2bf2f09aef0343ab079bff2 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 26 Sep 2009 18:25:00 +1000 Subject: r300g: report GL1.5, enable cap bits for OQ and shadow. Its not like it works well on 1.3 so may as well reach for greater heights. Signed-off-by: Dave Airlie --- src/gallium/drivers/r300/r300_screen.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 3b5b1bbd37..8296d56840 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -101,11 +101,9 @@ static int r300_get_param(struct pipe_screen* pscreen, int param) case PIPE_CAP_MAX_RENDER_TARGETS: return 4; case PIPE_CAP_OCCLUSION_QUERY: - /* IN THEORY */ - return 0; + return 1; case PIPE_CAP_TEXTURE_SHADOW_MAP: - /* IN THEORY */ - return 0; + return 1; case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: if (r300screen->caps->is_r500) { /* 13 == 4096x4096 */ -- cgit v1.2.3 From 1df539ce87ab38ebae67d63a353b01f4cf5edc79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sat, 26 Sep 2009 09:33:32 +0100 Subject: llvmpipe: Allow building with LLVM 2.6 too. --- src/gallium/drivers/llvmpipe/lp_jit.c | 5 +++++ src/gallium/drivers/llvmpipe/lp_test_format.c | 5 +++++ src/gallium/drivers/llvmpipe/lp_test_main.c | 5 +++++ 3 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c index b4a22ff4a9..f7111c1e5c 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.c +++ b/src/gallium/drivers/llvmpipe/lp_jit.c @@ -147,6 +147,11 @@ lp_jit_screen_init(struct llvmpipe_screen *screen) { char *error = NULL; +#ifdef LLVM_NATIVE_ARCH + LLVMLinkInJIT(); + LLVMInitializeNativeTarget(); +#endif + screen->module = LLVMModuleCreateWithName("llvmpipe"); screen->provider = LLVMCreateModuleProviderForExistingModule(screen->module); diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c index d8455e5649..7d83f899e6 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_format.c +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c @@ -264,6 +264,11 @@ int main(int argc, char **argv) unsigned i; int ret; +#ifdef LLVM_NATIVE_ARCH + LLVMLinkInJIT(); + LLVMInitializeNativeTarget(); +#endif + for (i = 0; i < sizeof(test_cases)/sizeof(test_cases[0]); ++i) if(!test_format(&test_cases[i])) ret = 1; diff --git a/src/gallium/drivers/llvmpipe/lp_test_main.c b/src/gallium/drivers/llvmpipe/lp_test_main.c index 4592dc0b2d..f07fa256f1 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_main.c +++ b/src/gallium/drivers/llvmpipe/lp_test_main.c @@ -365,6 +365,11 @@ int main(int argc, char **argv) n = atoi(argv[i]); } +#ifdef LLVM_NATIVE_ARCH + LLVMLinkInJIT(); + LLVMInitializeNativeTarget(); +#endif + if(fp) { /* Warm up the caches */ test_some(0, NULL, 100); -- cgit v1.2.3 From ec9c02187e698c26d7df3e408c1173acca9ccdd0 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 26 Sep 2009 18:38:07 +1000 Subject: r300g: add missing break in OQ emit --- src/gallium/drivers/r300/r300_emit.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index a1b36ba2ed..77ce431cdc 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -381,6 +381,7 @@ void r300_emit_query_end(struct r300_context* r300, OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1); OUT_CS_RELOC(r300->oqbo, query->offset + (sizeof(uint32_t) * 0), 0, RADEON_GEM_DOMAIN_GTT, 0); + break; default: debug_printf("r300: Implementation error: Chipset reports %d" " pixel pipes!\n", caps->num_frag_pipes); -- cgit v1.2.3 From 9bf85f6b95cb684d16b6035381b1f8a9c44f473f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 26 Sep 2009 18:38:39 +1000 Subject: r300g: only pass complete texture state to hw setup function No point passing things twice here, also allows more state to be setup properly. --- src/gallium/drivers/r300/r300_texture.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index e8078ea9f1..2ec07b453d 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -22,34 +22,32 @@ #include "r300_texture.h" -static void r300_setup_texture_state(struct r300_texture* tex, - unsigned width, - unsigned height, - unsigned levels) +static void r300_setup_texture_state(struct r300_texture* tex) { struct r300_texture_state* state = &tex->state; + struct pipe_texture *pt = &tex->tex; - state->format0 = R300_TX_WIDTH((width - 1) & 0x7ff) | - R300_TX_HEIGHT((height - 1) & 0x7ff) | - R300_TX_NUM_LEVELS(levels) | + state->format0 = R300_TX_WIDTH((pt->width[0] - 1) & 0x7ff) | + R300_TX_HEIGHT((pt->height[0] - 1) & 0x7ff) | + R300_TX_NUM_LEVELS(pt->last_level) | R300_TX_PITCH_EN; /* XXX */ - state->format1 = r300_translate_texformat(tex->tex.format); + state->format1 = r300_translate_texformat(pt->format); - state->format2 = (r300_texture_get_stride(tex, 0) / tex->tex.block.size) - 1; + state->format2 = (r300_texture_get_stride(tex, 0) / pt->block.size) - 1; /* Assume (somewhat foolishly) that oversized textures will * not be permitted by the state tracker. */ - if (width > 2048) { + if (pt->width[0] > 2048) { state->format2 |= R500_TXWIDTH_BIT11; } - if (height > 2048) { + if (pt->height[0] > 2048) { state->format2 |= R500_TXHEIGHT_BIT11; } debug_printf("r300: Set texture state (%dx%d, %d levels)\n", - width, height, levels); + pt->width[0], pt->height[0], pt->last_level); } /** @@ -120,8 +118,7 @@ static struct pipe_texture* r300_setup_miptree(tex); - r300_setup_texture_state(tex, template->width[0], template->height[0], - template->last_level); + r300_setup_texture_state(tex); tex->buffer = screen->buffer_create(screen, 1024, PIPE_BUFFER_USAGE_PIXEL, @@ -204,7 +201,7 @@ static struct pipe_texture* tex->stride_override = *stride; /* XXX */ - r300_setup_texture_state(tex, tex->tex.width[0], tex->tex.height[0], 0); + r300_setup_texture_state(tex); pipe_buffer_reference(&tex->buffer, buffer); -- cgit v1.2.3 From eb5dd947fbed35478784e777fe2e59564fee051b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 26 Sep 2009 19:32:46 +1000 Subject: r300g: add tx depth support in register. also enable cube/3d bits in txformat reg --- src/gallium/drivers/r300/r300_reg.h | 1 + src/gallium/drivers/r300/r300_texture.c | 7 +++++++ 2 files changed, 8 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h index 03cd219cde..3abff5db62 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -1478,6 +1478,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_TX_PITCH_EN (1 << 31) # define R300_TX_WIDTH(x) ((x) << 0) # define R300_TX_HEIGHT(x) ((x) << 11) +# define R300_TX_DEPTH(x) ((x) << 22) # define R300_TX_NUM_LEVELS(x) ((x) << 26) #define R300_TX_FORMAT1_0 0x44C0 diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 2ec07b453d..ce60ded7ca 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -29,11 +29,18 @@ static void r300_setup_texture_state(struct r300_texture* tex) state->format0 = R300_TX_WIDTH((pt->width[0] - 1) & 0x7ff) | R300_TX_HEIGHT((pt->height[0] - 1) & 0x7ff) | + R300_TX_DEPTH(util_logbase2(pt->depth[0]) & 0xf) | R300_TX_NUM_LEVELS(pt->last_level) | R300_TX_PITCH_EN; /* XXX */ state->format1 = r300_translate_texformat(pt->format); + if (pt->target == PIPE_TEXTURE_CUBE) { + state->format1 |= R300_TX_FORMAT_CUBIC_MAP; + } + if (pt->target == PIPE_TEXTURE_3D) { + state->format1 |= R300_TX_FORMAT_3D; + } state->format2 = (r300_texture_get_stride(tex, 0) / pt->block.size) - 1; -- cgit v1.2.3 From 813870fd9588de101f68728507cff726d7513695 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 26 Sep 2009 12:21:03 -0600 Subject: mesa: initial check-in of new formats.[ch] files --- src/mesa/main/formats.c | 851 ++++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/formats.h | 213 ++++++++++++ 2 files changed, 1064 insertions(+) create mode 100644 src/mesa/main/formats.c create mode 100644 src/mesa/main/formats.h (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c new file mode 100644 index 0000000000..32884cb41d --- /dev/null +++ b/src/mesa/main/formats.c @@ -0,0 +1,851 @@ +/* + * Mesa 3-D graphics library + * Version: 7.7 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * 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"), + * 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. + */ + + +#include "formats.h" +#include "config.h" +#include "texstore.h" + + +/** + * Info about each format. + * These must be in the same order as the MESA_FORMAT_* enums so that + * we can do lookups without searching. + */ +static struct gl_format_info format_info[MESA_FORMAT_COUNT] = +{ + { + MESA_FORMAT_RGBA8888, /* Name */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_RGBA8888_REV, /* Name */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_ARGB8888, /* Name */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_ARGB8888_REV, /* Name */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_RGB888, /* Name */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 3 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_BGR888, /* Name */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 3 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_RGB565, /* Name */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 5, 6, 5, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_RGB565_REV, /* Name */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 5, 6, 5, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_RGBA4444, /* Name */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 4, 4, 4, 4, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_ARGB4444, /* Name */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 4, 4, 4, 4, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_ARGB4444_REV, /* Name */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 4, 4, 4, 4, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_RGBA5551, /* Name */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_ARGB1555, /* Name */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_ARGB1555_REV, /* Name */ + GL_RGBA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_AL88, /* Name */ + GL_LUMINANCE_ALPHA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */ + 8, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_AL88_REV, /* Name */ + GL_LUMINANCE_ALPHA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */ + 8, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_RGB332, /* Name */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 3, 3, 2, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 1 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_A8, /* Name */ + GL_ALPHA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 1 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_L8, /* Name */ + GL_LUMINANCE, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 8, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 1 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_I8, /* Name */ + GL_INTENSITY, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 8, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 1 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_CI8, /* Name */ + GL_COLOR_INDEX, /* BaseFormat */ + GL_UNSIGNED_INT, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 8, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 1 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_YCBCR, /* Name */ + GL_YCBCR_MESA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_YCBCR_REV, /* Name */ + GL_YCBCR_MESA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_Z24_S8, /* Name */ + GL_DEPTH_STENCIL, /* BaseFormat */ + GL_UNSIGNED_INT, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 24, 8, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_S8_Z24, /* Name */ + GL_DEPTH_STENCIL, /* BaseFormat */ + GL_UNSIGNED_INT, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 24, 8, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_Z16, /* Name */ + GL_DEPTH_COMPONENT, /* BaseFormat */ + GL_UNSIGNED_INT, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 16, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 2 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_Z32, /* Name */ + GL_DEPTH_COMPONENT, /* BaseFormat */ + GL_UNSIGNED_INT, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 32, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_S8, /* Name */ + GL_STENCIL_INDEX, /* BaseFormat */ + GL_UNSIGNED_INT, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 8, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 1 /* BlockWidth/Height,Bytes */ + }, + +#if FEATURE_EXT_texture_sRGB + { + MESA_FORMAT_SRGB8, + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 0, + 0, 0, 0, 0, 0, + 1, 1, 3 + }, + { + MESA_FORMAT_SRGBA8, + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 8, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_SARGB8, + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 8, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_SL8, + GL_LUMINANCE_ALPHA, + GL_UNSIGNED_NORMALIZED, + 0, 0, 0, 8, + 8, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_SLA8, + GL_LUMINANCE_ALPHA, + GL_UNSIGNED_NORMALIZED, + 0, 0, 0, 8, + 8, 0, 0, 0, 0, + 1, 1, 2 + }, +#if FEATURE_texture_s3tc + { + MESA_FORMAT_SRGB_DXT1, /* Name */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 4, 4, 4, 0, /* approx Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 4, 4, 8 /* 8 bytes per 4x4 block */ + }, + { + MESA_FORMAT_SRGBA_DXT1, + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, + 0, 0, 0, 0, 0, + 4, 4, 8 /* 8 bytes per 4x4 block */ + }, + { + MESA_FORMAT_SRGBA_DXT3, + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, + 0, 0, 0, 0, 0, + 4, 4, 16 /* 16 bytes per 4x4 block */ + }, + { + MESA_FORMAT_SRGBA_DXT5, + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, + 0, 0, 0, 0, 0, + 4, 4, 16 /* 16 bytes per 4x4 block */ + }, +#endif +#endif + +#if FEATURE_texture_fxt1 + { + MESA_FORMAT_RGB_FXT1, + GL_RGB, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 0, + 0, 0, 0, 0, 0, + 8, 4, 16 /* 16 bytes per 8x4 block */ + }, + { + MESA_FORMAT_RGBA_FXT1, + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 8, 8, 8, 8, + 0, 0, 0, 0, 0, + 8, 4, 16 /* 16 bytes per 8x4 block */ + }, +#endif + +#if FEATURE_texture_s3tc + { + MESA_FORMAT_RGB_DXT1, /* Name */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 4, 4, 4, 0, /* approx Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 4, 4, 8 /* 8 bytes per 4x4 block */ + }, + { + MESA_FORMAT_RGBA_DXT1, + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, + 0, 0, 0, 0, 0, + 4, 4, 8 /* 8 bytes per 4x4 block */ + }, + { + MESA_FORMAT_RGBA_DXT3, + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, + 0, 0, 0, 0, 0, + 4, 4, 16 /* 16 bytes per 4x4 block */ + }, + { + MESA_FORMAT_RGBA_DXT5, + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + 4, 4, 4, 4, + 0, 0, 0, 0, 0, + 4, 4, 16 /* 16 bytes per 4x4 block */ + }, +#endif + + { + MESA_FORMAT_RGBA, + GL_RGBA, + GL_UNSIGNED_NORMALIZED, + CHAN_BITS, CHAN_BITS, CHAN_BITS, CHAN_BITS, + 0, 0, 0, 0, 0, + 1, 1, 4 * CHAN_BITS / 8 + }, + { + MESA_FORMAT_RGB, + GL_RGB, + GL_UNSIGNED_NORMALIZED, + CHAN_BITS, CHAN_BITS, CHAN_BITS, 0, + 0, 0, 0, 0, 0, + 1, 1, 3 * CHAN_BITS / 8 + }, + { + MESA_FORMAT_ALPHA, + GL_ALPHA, + GL_UNSIGNED_NORMALIZED, + 0, 0, 0, CHAN_BITS, + 0, 0, 0, 0, 0, + 1, 1, 1 * CHAN_BITS / 8 + }, + { + MESA_FORMAT_LUMINANCE, + GL_LUMINANCE, + GL_UNSIGNED_NORMALIZED, + 0, 0, 0, 0, + CHAN_BITS, 0, 0, 0, 0, + 1, 1, 1 * CHAN_BITS / 8 + }, + { + MESA_FORMAT_LUMINANCE_ALPHA, + GL_LUMINANCE_ALPHA, + GL_UNSIGNED_NORMALIZED, + 0, 0, 0, CHAN_BITS, + CHAN_BITS, 0, 0, 0, 0, + 1, 1, 2 * CHAN_BITS / 8 + }, + { + MESA_FORMAT_INTENSITY, + GL_INTENSITY, + GL_UNSIGNED_NORMALIZED, + 0, 0, 0, 0, + 0, CHAN_BITS, 0, 0, 0, + 1, 1, 1 * CHAN_BITS / 8 + }, + { + MESA_FORMAT_RGBA_FLOAT32, + GL_RGBA, + GL_FLOAT, + 32, 32, 32, 32, + 0, 0, 0, 0, 0, + 1, 1, 16 + }, + { + MESA_FORMAT_RGBA_FLOAT16, + GL_RGBA, + GL_FLOAT, + 16, 16, 16, 16, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_RGB_FLOAT32, + GL_RGB, + GL_FLOAT, + 32, 32, 32, 0, + 0, 0, 0, 0, 0, + 1, 1, 12 + }, + { + MESA_FORMAT_RGB_FLOAT16, + GL_RGB, + GL_FLOAT, + 16, 16, 16, 0, + 0, 0, 0, 0, 0, + 1, 1, 6 + }, + { + MESA_FORMAT_ALPHA_FLOAT32, + GL_ALPHA, + GL_FLOAT, + 0, 0, 0, 32, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_ALPHA_FLOAT16, + GL_ALPHA, + GL_FLOAT, + 0, 0, 0, 16, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_LUMINANCE_FLOAT32, + GL_ALPHA, + GL_FLOAT, + 0, 0, 0, 0, + 32, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_LUMINANCE_FLOAT16, + GL_ALPHA, + GL_FLOAT, + 0, 0, 0, 0, + 16, 0, 0, 0, 0, + 1, 1, 2 + }, + { + MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, + GL_LUMINANCE_ALPHA, + GL_FLOAT, + 0, 0, 0, 32, + 32, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, + GL_LUMINANCE_ALPHA, + GL_FLOAT, + 0, 0, 0, 16, + 16, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_INTENSITY_FLOAT32, + GL_INTENSITY, + GL_FLOAT, + 0, 0, 0, 0, + 0, 32, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_INTENSITY_FLOAT16, + GL_INTENSITY, + GL_FLOAT, + 0, 0, 0, 0, + 0, 16, 0, 0, 0, + 1, 1, 2 + }, + + { + MESA_FORMAT_DUDV8, + GL_DUDV_ATI, + GL_SIGNED_NORMALIZED, + 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 2 + }, + + { + MESA_FORMAT_SIGNED_RGBA8888, + GL_RGBA, + GL_SIGNED_NORMALIZED, + 8, 8, 8, 8, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_SIGNED_RGBA8888_REV, + GL_RGBA, + GL_SIGNED_NORMALIZED, + 8, 8, 8, 8, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + +}; + + +static struct { + gl_format Name; + StoreTexImageFunc Store; +} +texstore_funcs[MESA_FORMAT_COUNT] = +{ + { MESA_FORMAT_RGBA, _mesa_texstore_rgba }, + { MESA_FORMAT_RGB, _mesa_texstore_rgba }, + { MESA_FORMAT_ALPHA, _mesa_texstore_rgba }, + { MESA_FORMAT_LUMINANCE, _mesa_texstore_rgba }, + { MESA_FORMAT_LUMINANCE_ALPHA, _mesa_texstore_rgba }, + { MESA_FORMAT_INTENSITY, _mesa_texstore_rgba }, + { MESA_FORMAT_SRGB8, _mesa_texstore_srgb8 }, + { MESA_FORMAT_SRGBA8, _mesa_texstore_srgba8 }, + { MESA_FORMAT_SARGB8, _mesa_texstore_sargb8 }, + { MESA_FORMAT_SL8, _mesa_texstore_sl8 }, + { MESA_FORMAT_SLA8, _mesa_texstore_sla8 }, + { MESA_FORMAT_RGBA_FLOAT32, _mesa_texstore_rgba_float32 }, + { MESA_FORMAT_RGBA_FLOAT16, _mesa_texstore_rgba_float16 }, + { MESA_FORMAT_RGB_FLOAT32, _mesa_texstore_rgba_float32 }, + { MESA_FORMAT_RGB_FLOAT16, _mesa_texstore_rgba_float16 }, + { MESA_FORMAT_ALPHA_FLOAT32, _mesa_texstore_rgba_float32 }, + { MESA_FORMAT_ALPHA_FLOAT16, _mesa_texstore_rgba_float16 }, + { MESA_FORMAT_LUMINANCE_FLOAT32, _mesa_texstore_rgba_float32 }, + { MESA_FORMAT_LUMINANCE_FLOAT16, _mesa_texstore_rgba_float16 }, + { MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, _mesa_texstore_rgba_float32 }, + { MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, _mesa_texstore_rgba_float16 }, + { MESA_FORMAT_INTENSITY_FLOAT32, _mesa_texstore_rgba_float32 }, + { MESA_FORMAT_INTENSITY_FLOAT16, _mesa_texstore_rgba_float16 }, + { MESA_FORMAT_DUDV8, _mesa_texstore_dudv8 }, + { MESA_FORMAT_SIGNED_RGBA8888, _mesa_texstore_signed_rgba8888 }, + { MESA_FORMAT_SIGNED_RGBA8888_REV, _mesa_texstore_signed_rgba8888 }, + { MESA_FORMAT_RGBA8888, _mesa_texstore_rgba8888 }, + { MESA_FORMAT_RGBA8888_REV, _mesa_texstore_rgba8888 }, + { MESA_FORMAT_ARGB8888, _mesa_texstore_argb8888 }, + { MESA_FORMAT_ARGB8888_REV, _mesa_texstore_argb8888 }, + { MESA_FORMAT_RGB888, _mesa_texstore_rgb888 }, + { MESA_FORMAT_BGR888, _mesa_texstore_bgr888 }, + { MESA_FORMAT_RGB565, _mesa_texstore_rgb565 }, + { MESA_FORMAT_RGB565_REV, _mesa_texstore_rgb565 }, + { MESA_FORMAT_RGBA4444, _mesa_texstore_rgba4444 }, + { MESA_FORMAT_ARGB4444, _mesa_texstore_argb4444 }, + { MESA_FORMAT_ARGB4444_REV, _mesa_texstore_argb4444 }, + { MESA_FORMAT_RGBA5551, _mesa_texstore_rgba5551 }, + { MESA_FORMAT_ARGB1555, _mesa_texstore_argb1555 }, + { MESA_FORMAT_ARGB1555_REV, _mesa_texstore_argb1555 }, + { MESA_FORMAT_AL88, _mesa_texstore_al88 }, + { MESA_FORMAT_AL88_REV, _mesa_texstore_al88 }, + { MESA_FORMAT_RGB332, _mesa_texstore_rgb332 }, + { MESA_FORMAT_A8, _mesa_texstore_a8 }, + { MESA_FORMAT_L8, _mesa_texstore_a8 }, + { MESA_FORMAT_I8, _mesa_texstore_a8 }, + { MESA_FORMAT_CI8, _mesa_texstore_ci8 }, + { MESA_FORMAT_YCBCR, _mesa_texstore_ycbcr }, + { MESA_FORMAT_YCBCR_REV, _mesa_texstore_ycbcr }, + { MESA_FORMAT_Z24_S8, _mesa_texstore_z24_s8 }, + { MESA_FORMAT_S8_Z24, _mesa_texstore_s8_z24 }, + { MESA_FORMAT_Z16, _mesa_texstore_z16 }, + { MESA_FORMAT_Z32, _mesa_texstore_z32 }, + { MESA_FORMAT_S8, NULL/*_mesa_texstore_s8*/ }, +}; + + +static const struct gl_format_info * +_mesa_get_format_info(gl_format format) +{ + const struct gl_format_info *info = &format_info[format]; + assert(info->Name == format); + return info; +} + + +GLuint +_mesa_get_format_bytes(gl_format format) +{ + const struct gl_format_info *info = _mesa_get_format_info(format); + ASSERT(info->BytesPerBlock); + return info->BytesPerBlock; +} + + +GLenum +_mesa_get_format_base_format(gl_format format) +{ + const struct gl_format_info *info = _mesa_get_format_info(format); + return info->BaseFormat; +} + + +GLboolean +_mesa_is_format_compressed(gl_format format) +{ + const struct gl_format_info *info = _mesa_get_format_info(format); + return info->BlockWidth > 1 || info->BlockHeight > 1; +} + + +/* XXX move to texstore.c */ +StoreTexImageFunc +_mesa_get_texstore_func(gl_format format) +{ + GLuint i; + for (i = 0; i < MESA_FORMAT_COUNT; i++) { + if (texstore_funcs[i].Name == format) + return texstore_funcs[i].Store; + } + return NULL; +} + + +/** + * Do sanity checking of the format info table. + */ +void +_mesa_test_formats(void) +{ + GLuint i; + + assert(Elements(format_info) == MESA_FORMAT_COUNT); + + for (i = 0; i < MESA_FORMAT_COUNT; i++) { + const struct gl_format_info *info = _mesa_get_format_info(i); + assert(info); + + assert(info->Name == i); + + if (info->BlockWidth == 1 && info->BlockHeight == 1) { + if (info->RedBits > 0) { + GLuint t = info->RedBits + info->GreenBits + + info->BlueBits + info->AlphaBits; + assert(t / 8 == info->BytesPerBlock); + } + } + + assert(info->DataType == GL_UNSIGNED_NORMALIZED || + info->DataType == GL_SIGNED_NORMALIZED || + info->DataType == GL_UNSIGNED_INT || + info->DataType == GL_FLOAT); + + if (info->BaseFormat == GL_RGB) { + assert(info->RedBits > 0); + assert(info->GreenBits > 0); + assert(info->BlueBits > 0); + assert(info->AlphaBits == 0); + assert(info->LuminanceBits == 0); + assert(info->IntensityBits == 0); + } + else if (info->BaseFormat == GL_RGBA) { + assert(info->RedBits > 0); + assert(info->GreenBits > 0); + assert(info->BlueBits > 0); + assert(info->AlphaBits > 0); + assert(info->LuminanceBits == 0); + assert(info->IntensityBits == 0); + } + else if (info->BaseFormat == GL_LUMINANCE) { + assert(info->RedBits == 0); + assert(info->GreenBits == 0); + assert(info->BlueBits == 0); + assert(info->AlphaBits == 0); + assert(info->LuminanceBits > 0); + assert(info->IntensityBits == 0); + } + else if (info->BaseFormat == GL_INTENSITY) { + assert(info->RedBits == 0); + assert(info->GreenBits == 0); + assert(info->BlueBits == 0); + assert(info->AlphaBits == 0); + assert(info->LuminanceBits == 0); + assert(info->IntensityBits > 0); + } + + } +} + + +/** + * XXX possible replacement for _mesa_format_to_type_and_comps() + * Used for mipmap generation. + */ +void +_mesa_format_to_type_and_comps2(gl_format format, + GLenum *datatype, GLuint *comps) +{ + const struct gl_format_info *info = _mesa_get_format_info(format); + + /* We use a bunch of heuristics here. If this gets too ugly we could + * just encode the info the in the gl_format_info structures. + */ + if (info->BaseFormat == GL_RGB || + info->BaseFormat == GL_RGBA || + info->BaseFormat == GL_ALPHA) { + *comps = ((info->RedBits > 0) + + (info->GreenBits > 0) + + (info->BlueBits > 0) + + (info->AlphaBits > 0)); + + if (info->DataType== GL_FLOAT) { + if (info->RedBits == 32) + *datatype = GL_FLOAT; + else + *datatype = GL_HALF_FLOAT; + } + else if (info->GreenBits == 3) { + *datatype = GL_UNSIGNED_BYTE_3_3_2; + } + else if (info->GreenBits == 4) { + *datatype = GL_UNSIGNED_SHORT_4_4_4_4; + } + else if (info->GreenBits == 6) { + *datatype = GL_UNSIGNED_SHORT_5_6_5; + } + else if (info->GreenBits == 5) { + *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV; + } + else if (info->RedBits == 8) { + *datatype = GL_UNSIGNED_BYTE; + } + else { + ASSERT(info->RedBits == 16); + *datatype = GL_UNSIGNED_SHORT; + } + } + else if (info->BaseFormat == GL_LUMINANCE || + info->BaseFormat == GL_LUMINANCE_ALPHA) { + *comps = ((info->LuminanceBits > 0) + + (info->AlphaBits > 0)); + if (info->LuminanceBits == 8) { + *datatype = GL_UNSIGNED_BYTE; + } + else if (info->LuminanceBits == 16) { + *datatype = GL_UNSIGNED_SHORT; + } + else { + *datatype = GL_FLOAT; + } + } + else if (info->BaseFormat == GL_INTENSITY) { + *comps = 1; + if (info->IntensityBits == 8) { + *datatype = GL_UNSIGNED_BYTE; + } + else if (info->IntensityBits == 16) { + *datatype = GL_UNSIGNED_SHORT; + } + else { + *datatype = GL_FLOAT; + } + } + else if (info->BaseFormat == GL_COLOR_INDEX) { + *comps = 1; + *datatype = GL_UNSIGNED_BYTE; + } + else if (info->BaseFormat == GL_DEPTH_COMPONENT) { + *comps = 1; + if (info->DepthBits == 16) { + *datatype = GL_UNSIGNED_SHORT; + } + else { + ASSERT(info->DepthBits == 32); + *datatype = GL_UNSIGNED_INT; + } + } + else if (info->BaseFormat == GL_DEPTH_STENCIL) { + *comps = 1; + *datatype = GL_UNSIGNED_INT; + } + else if (info->BaseFormat == GL_YCBCR_MESA) { + *comps = 2; + *datatype = GL_UNSIGNED_SHORT; + } + else if (info->BaseFormat == GL_DUDV_ATI) { + *comps = 2; + *datatype = GL_BYTE; + } + else { + /* any other formats? */ + ASSERT(0); + *comps = 1; + *datatype = GL_UNSIGNED_BYTE; + } +} + diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h new file mode 100644 index 0000000000..61bbd8e79a --- /dev/null +++ b/src/mesa/main/formats.h @@ -0,0 +1,213 @@ +/* + * Mesa 3-D graphics library + * Version: 7.7 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * 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"), + * 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. + */ + +/* + * Authors: + * Brian Paul + */ + + +#ifndef FORMATS_H +#define FORMATS_H + + +#include "main/mtypes.h" + + + +/** + * Mesa texture/renderbuffer image formats. + */ +typedef enum +{ + /** + * \name Basic hardware formats + */ + /*@{*/ + /* msb <------ TEXEL BITS -----------> lsb */ + /* ---- ---- ---- ---- ---- ---- ---- ---- */ + MESA_FORMAT_RGBA8888, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ + MESA_FORMAT_RGBA8888_REV, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_ARGB8888, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ + MESA_FORMAT_ARGB8888_REV, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */ + MESA_FORMAT_RGB888, /* RRRR RRRR GGGG GGGG BBBB BBBB */ + MESA_FORMAT_BGR888, /* BBBB BBBB GGGG GGGG RRRR RRRR */ + MESA_FORMAT_RGB565, /* RRRR RGGG GGGB BBBB */ + MESA_FORMAT_RGB565_REV, /* GGGB BBBB RRRR RGGG */ + MESA_FORMAT_RGBA4444, /* RRRR GGGG BBBB AAAA */ + MESA_FORMAT_ARGB4444, /* AAAA RRRR GGGG BBBB */ + MESA_FORMAT_ARGB4444_REV, /* GGGG BBBB AAAA RRRR */ + MESA_FORMAT_RGBA5551, /* RRRR RGGG GGBB BBBA */ + MESA_FORMAT_ARGB1555, /* ARRR RRGG GGGB BBBB */ + MESA_FORMAT_ARGB1555_REV, /* GGGB BBBB ARRR RRGG */ + MESA_FORMAT_AL88, /* AAAA AAAA LLLL LLLL */ + MESA_FORMAT_AL88_REV, /* LLLL LLLL AAAA AAAA */ + MESA_FORMAT_RGB332, /* RRRG GGBB */ + MESA_FORMAT_A8, /* AAAA AAAA */ + MESA_FORMAT_L8, /* LLLL LLLL */ + MESA_FORMAT_I8, /* IIII IIII */ + MESA_FORMAT_CI8, /* CCCC CCCC */ + MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */ + MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */ + MESA_FORMAT_Z24_S8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */ + MESA_FORMAT_S8_Z24, /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ + MESA_FORMAT_Z16, /* ZZZZ ZZZZ ZZZZ ZZZZ */ + MESA_FORMAT_Z32, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ + MESA_FORMAT_S8, /* SSSS SSSS */ + /*@}*/ + +#if FEATURE_EXT_texture_sRGB + /** + * \name 8-bit/channel sRGB formats + */ + /*@{*/ + MESA_FORMAT_SRGB8, + MESA_FORMAT_SRGBA8, + MESA_FORMAT_SARGB8, + MESA_FORMAT_SL8, + MESA_FORMAT_SLA8, +#if FEATURE_texture_s3tc + MESA_FORMAT_SRGB_DXT1, + MESA_FORMAT_SRGBA_DXT1, + MESA_FORMAT_SRGBA_DXT3, + MESA_FORMAT_SRGBA_DXT5, +#endif + /*@}*/ +#endif + + /** + * \name Compressed texture formats. + */ + /*@{*/ +#if FEATURE_texture_fxt1 + MESA_FORMAT_RGB_FXT1, + MESA_FORMAT_RGBA_FXT1, +#endif +#if FEATURE_texture_s3tc + MESA_FORMAT_RGB_DXT1, + MESA_FORMAT_RGBA_DXT1, + MESA_FORMAT_RGBA_DXT3, + MESA_FORMAT_RGBA_DXT5, +#endif + /*@}*/ + + /** + * \name Generic GLchan-based formats. (XXX obsolete!) + */ + /*@{*/ + MESA_FORMAT_RGBA, + MESA_FORMAT_RGB, + MESA_FORMAT_ALPHA, + MESA_FORMAT_LUMINANCE, + MESA_FORMAT_LUMINANCE_ALPHA, + MESA_FORMAT_INTENSITY, + /*@}*/ + + /** + * \name Floating point texture formats. + */ + /*@{*/ + MESA_FORMAT_RGBA_FLOAT32, + MESA_FORMAT_RGBA_FLOAT16, + MESA_FORMAT_RGB_FLOAT32, + MESA_FORMAT_RGB_FLOAT16, + MESA_FORMAT_ALPHA_FLOAT32, + MESA_FORMAT_ALPHA_FLOAT16, + MESA_FORMAT_LUMINANCE_FLOAT32, + MESA_FORMAT_LUMINANCE_FLOAT16, + MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, + MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, + MESA_FORMAT_INTENSITY_FLOAT32, + MESA_FORMAT_INTENSITY_FLOAT16, + /*@}*/ + + /** + * \name Signed fixed point texture formats. + */ + /*@{*/ + MESA_FORMAT_DUDV8, + MESA_FORMAT_SIGNED_RGBA8888, + MESA_FORMAT_SIGNED_RGBA8888_REV, + /*@}*/ + + MESA_FORMAT_COUNT, +} gl_format; + + +/** + * Information about texture formats. + */ +struct gl_format_info +{ + gl_format Name; + + /** + * Base format is one of GL_RGB, GL_RGBA, GL_ALPHA, GL_LUMINANCE, + * GL_LUMINANCE_ALPHA, GL_INTENSITY, GL_COLOR_INDEX, GL_DEPTH_COMPONENT. + */ + GLenum BaseFormat; + + /** + * Logical data type: one of GL_UNSIGNED_NORMALIZED, GL_SIGNED_NORMALED, + * GL_UNSIGNED_INT, GL_SIGNED_INT, GL_FLOAT. + */ + GLenum DataType; + + GLubyte RedBits; + GLubyte GreenBits; + GLubyte BlueBits; + GLubyte AlphaBits; + GLubyte LuminanceBits; + GLubyte IntensityBits; + GLubyte IndexBits; + GLubyte DepthBits; + GLubyte StencilBits; + + /** + * To describe compressed formats. If not compressed, Width=Height=1. + */ + GLubyte BlockWidth, BlockHeight; + GLubyte BytesPerBlock; +}; + + + +extern GLuint +_mesa_get_format_bytes(gl_format format); + +extern GLenum +_mesa_get_format_base_format(gl_format format); + +extern GLboolean +_mesa_is_format_compressed(gl_format format); + +extern void +_mesa_format_to_type_and_comps2(gl_format format, + GLenum *datatype, GLuint *comps); + +extern void +_mesa_test_formats(void); + +#endif /* FORMATS_H */ -- cgit v1.2.3 From 9e7b56c98006033daa206c51b320b1b6cbc2f281 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 26 Sep 2009 12:24:17 -0600 Subject: mesa: include formats.h --- src/mesa/main/texformat.h | 137 +--------------------------------------------- 1 file changed, 1 insertion(+), 136 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index 5aa1d756cb..b860a10d86 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -37,142 +37,7 @@ #include "mtypes.h" - - -/** - * Mesa internal texture image formats. - * All texture images are stored in one of these formats. - * - * NOTE: when you add a new format, be sure to update the do_row() - * function in texstore.c used for auto mipmap generation. - */ -enum _format { - /** - * \name Hardware-friendly formats. - * - * Drivers can override the default formats and convert texture images to - * one of these as required. The driver's - * dd_function_table::ChooseTextureFormat function will choose one of these - * formats. - * - * \note In the default case, some of these formats will be duplicates of - * the generic formats listed below. However, these formats guarantee their - * internal component sizes, while GLchan may vary between GLubyte, GLushort - * and GLfloat. - */ - /*@{*/ - /* msb <------ TEXEL BITS -----------> lsb */ - /* ---- ---- ---- ---- ---- ---- ---- ---- */ - MESA_FORMAT_RGBA8888, /* RRRR RRRR GGGG GGGG BBBB BBBB AAAA AAAA */ - MESA_FORMAT_RGBA8888_REV, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ - MESA_FORMAT_ARGB8888, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ - MESA_FORMAT_ARGB8888_REV, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */ - MESA_FORMAT_RGB888, /* RRRR RRRR GGGG GGGG BBBB BBBB */ - MESA_FORMAT_BGR888, /* BBBB BBBB GGGG GGGG RRRR RRRR */ - MESA_FORMAT_RGB565, /* RRRR RGGG GGGB BBBB */ - MESA_FORMAT_RGB565_REV, /* GGGB BBBB RRRR RGGG */ - MESA_FORMAT_RGBA4444, /* RRRR GGGG BBBB AAAA */ - MESA_FORMAT_ARGB4444, /* AAAA RRRR GGGG BBBB */ - MESA_FORMAT_ARGB4444_REV, /* GGGG BBBB AAAA RRRR */ - MESA_FORMAT_RGBA5551, /* RRRR RGGG GGBB BBBA */ - MESA_FORMAT_ARGB1555, /* ARRR RRGG GGGB BBBB */ - MESA_FORMAT_ARGB1555_REV, /* GGGB BBBB ARRR RRGG */ - MESA_FORMAT_AL88, /* AAAA AAAA LLLL LLLL */ - MESA_FORMAT_AL88_REV, /* LLLL LLLL AAAA AAAA */ - MESA_FORMAT_RGB332, /* RRRG GGBB */ - MESA_FORMAT_A8, /* AAAA AAAA */ - MESA_FORMAT_L8, /* LLLL LLLL */ - MESA_FORMAT_I8, /* IIII IIII */ - MESA_FORMAT_CI8, /* CCCC CCCC */ - MESA_FORMAT_YCBCR, /* YYYY YYYY UorV UorV */ - MESA_FORMAT_YCBCR_REV, /* UorV UorV YYYY YYYY */ - MESA_FORMAT_Z24_S8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */ - MESA_FORMAT_S8_Z24, /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ - MESA_FORMAT_Z16, /* ZZZZ ZZZZ ZZZZ ZZZZ */ - MESA_FORMAT_Z32, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ - /*@}*/ - -#if FEATURE_EXT_texture_sRGB - /** - * \name 8-bit/channel sRGB formats - */ - /*@{*/ - MESA_FORMAT_SRGB8, - MESA_FORMAT_SRGBA8, - MESA_FORMAT_SARGB8, - MESA_FORMAT_SL8, - MESA_FORMAT_SLA8, -#if FEATURE_texture_s3tc - MESA_FORMAT_SRGB_DXT1, - MESA_FORMAT_SRGBA_DXT1, - MESA_FORMAT_SRGBA_DXT3, - MESA_FORMAT_SRGBA_DXT5, -#endif - /*@}*/ -#endif - - /** - * \name Compressed texture formats. - */ - /*@{*/ -#if FEATURE_texture_fxt1 - MESA_FORMAT_RGB_FXT1, - MESA_FORMAT_RGBA_FXT1, -#endif -#if FEATURE_texture_s3tc - MESA_FORMAT_RGB_DXT1, - MESA_FORMAT_RGBA_DXT1, - MESA_FORMAT_RGBA_DXT3, - MESA_FORMAT_RGBA_DXT5, -#endif - /*@}*/ - - /** - * \name Generic GLchan-based formats. - * - * Software-oriented texture formats. Texels are arrays of GLchan - * values so there are no byte order issues. - * - * \note Because these are based on the GLchan data type, one cannot assume - * 8 bits per channel with these formats. If you require GLubyte channels, - * use one of the hardware formats above. - */ - /*@{*/ - MESA_FORMAT_RGBA, - MESA_FORMAT_RGB, - MESA_FORMAT_ALPHA, - MESA_FORMAT_LUMINANCE, - MESA_FORMAT_LUMINANCE_ALPHA, - MESA_FORMAT_INTENSITY, - /*@}*/ - - /** - * \name Floating point texture formats. - */ - /*@{*/ - MESA_FORMAT_RGBA_FLOAT32, - MESA_FORMAT_RGBA_FLOAT16, - MESA_FORMAT_RGB_FLOAT32, - MESA_FORMAT_RGB_FLOAT16, - MESA_FORMAT_ALPHA_FLOAT32, - MESA_FORMAT_ALPHA_FLOAT16, - MESA_FORMAT_LUMINANCE_FLOAT32, - MESA_FORMAT_LUMINANCE_FLOAT16, - MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, - MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, - MESA_FORMAT_INTENSITY_FLOAT32, - MESA_FORMAT_INTENSITY_FLOAT16, - /*@}*/ - - /** - * \name Signed fixed point texture formats. - */ - /*@{*/ - MESA_FORMAT_DUDV8, - MESA_FORMAT_SIGNED_RGBA8888, - MESA_FORMAT_SIGNED_RGBA8888_REV - /*@}*/ -}; +#include "formats.h" /** GLchan-valued formats */ -- cgit v1.2.3 From a7455f9fc64f0e2e09e65c0b7d76b539bce8a79b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 26 Sep 2009 12:25:02 -0600 Subject: mesa: added formats.c to build --- src/mesa/SConscript | 1 + src/mesa/sources.mak | 1 + 2 files changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/SConscript b/src/mesa/SConscript index cad5676320..6dfbd26d94 100644 --- a/src/mesa/SConscript +++ b/src/mesa/SConscript @@ -56,6 +56,7 @@ if env['platform'] != 'winddk': 'main/feedback.c', 'main/ffvertex_prog.c', 'main/fog.c', + 'main/formats.c', 'main/framebuffer.c', 'main/get.c', 'main/getstring.c', diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index 7107538cee..dab3e56038 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -33,6 +33,7 @@ MAIN_SOURCES = \ main/feedback.c \ main/ffvertex_prog.c \ main/fog.c \ + main/formats.c \ main/framebuffer.c \ main/get.c \ main/getstring.c \ -- cgit v1.2.3 From 22108bb571808542b89677752d62d3901698265f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 26 Sep 2009 12:26:18 -0600 Subject: mesa: begin removing dependencies on gl_texture_format in texstore code --- src/mesa/main/texstore.c | 241 ++++++++++++++++++++++++++++------------------- 1 file changed, 144 insertions(+), 97 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index f553a898f9..5b13581b3a 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -940,7 +940,8 @@ memcpy_texture(GLcontext *ctx, srcWidth, srcHeight, srcFormat, srcType); const GLubyte *srcImage = (const GLubyte *) _mesa_image_address(dimensions, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, 0, 0, 0); - const GLint bytesPerRow = srcWidth * dstFormat->TexelBytes; + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLint bytesPerRow = srcWidth * texelBytes; #if 0 /* XXX update/re-enable for dstImageOffsets array */ @@ -949,7 +950,7 @@ memcpy_texture(GLcontext *ctx, GLubyte *dstImage = (GLubyte *) dstAddr + dstZoffset * dstImageStride + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; if (dstRowStride == srcRowStride && dstRowStride == bytesPerRow && @@ -980,9 +981,9 @@ memcpy_texture(GLcontext *ctx, for (img = 0; img < srcDepth; img++) { const GLubyte *srcRow = srcImage; GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { ctx->Driver.TextureMemCpy(dstRow, srcRow, bytesPerRow); dstRow += dstRowStride; @@ -1008,6 +1009,8 @@ GLboolean _mesa_texstore_rgba(TEXSTORE_PARAMS) { const GLint components = _mesa_components_in_format(baseInternalFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); ASSERT(dstFormat == &_mesa_texformat_rgba || dstFormat == &_mesa_texformat_rgb || @@ -1021,7 +1024,7 @@ _mesa_texstore_rgba(TEXSTORE_PARAMS) baseInternalFormat == GL_LUMINANCE || baseInternalFormat == GL_LUMINANCE_ALPHA || baseInternalFormat == GL_INTENSITY); - ASSERT(dstFormat->TexelBytes == components * sizeof(GLchan)); + ASSERT(texelBytes == components * sizeof(GLchan)); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -1045,9 +1048,9 @@ _mesa_texstore_rgba(TEXSTORE_PARAMS) for (img = 0; img < srcDepth; img++) { GLchan *dstImage = (GLchan *) ((GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes); + + dstXoffset * texelBytes); const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); @@ -1121,7 +1124,7 @@ _mesa_texstore_rgba(TEXSTORE_PARAMS) /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -1134,9 +1137,9 @@ _mesa_texstore_rgba(TEXSTORE_PARAMS) bytesPerRow = srcWidth * components * sizeof(GLchan); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { _mesa_memcpy(dstRow, src, bytesPerRow); dstRow += dstRowStride; @@ -1157,9 +1160,10 @@ GLboolean _mesa_texstore_z32(TEXSTORE_PARAMS) { const GLuint depthScale = 0xffffffff; + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); (void) dims; ASSERT(dstFormat == &_mesa_texformat_z32); - ASSERT(dstFormat->TexelBytes == sizeof(GLuint)); + ASSERT(texelBytes == sizeof(GLuint)); if (ctx->Pixel.DepthScale == 1.0f && ctx->Pixel.DepthBias == 0.0f && @@ -1180,9 +1184,9 @@ _mesa_texstore_z32(TEXSTORE_PARAMS) GLint img, row; for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { const GLvoid *src = _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0); @@ -1205,9 +1209,10 @@ GLboolean _mesa_texstore_z16(TEXSTORE_PARAMS) { const GLuint depthScale = 0xffff; + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); (void) dims; ASSERT(dstFormat == &_mesa_texformat_z16); - ASSERT(dstFormat->TexelBytes == sizeof(GLushort)); + ASSERT(texelBytes == sizeof(GLushort)); if (ctx->Pixel.DepthScale == 1.0f && ctx->Pixel.DepthBias == 0.0f && @@ -1228,9 +1233,9 @@ _mesa_texstore_z16(TEXSTORE_PARAMS) GLint img, row; for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { const GLvoid *src = _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0); @@ -1252,9 +1257,12 @@ _mesa_texstore_z16(TEXSTORE_PARAMS) GLboolean _mesa_texstore_rgb565(TEXSTORE_PARAMS) { + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + ASSERT(dstFormat == &_mesa_texformat_rgb565 || dstFormat == &_mesa_texformat_rgb565_rev); - ASSERT(dstFormat->TexelBytes == 2); + ASSERT(texelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -1284,7 +1292,7 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) srcFormat, srcType, 0, 0, 0); GLubyte *dst = (GLubyte *) dstAddr + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; GLint row, col; for (row = 0; row < srcHeight; row++) { const GLubyte *srcUB = (const GLubyte *) src; @@ -1310,7 +1318,7 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -1321,9 +1329,9 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; /* check for byteswapped format */ @@ -1359,10 +1367,12 @@ GLboolean _mesa_texstore_rgba8888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); ASSERT(dstFormat == &_mesa_texformat_rgba8888 || dstFormat == &_mesa_texformat_rgba8888_rev); - ASSERT(dstFormat->TexelBytes == 4); + ASSERT(texelBytes == 4); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -1435,7 +1445,7 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -1446,9 +1456,9 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; if (dstFormat == &_mesa_texformat_rgba8888) { @@ -1482,10 +1492,12 @@ GLboolean _mesa_texstore_argb8888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); ASSERT(dstFormat == &_mesa_texformat_argb8888 || dstFormat == &_mesa_texformat_argb8888_rev); - ASSERT(dstFormat->TexelBytes == 4); + ASSERT(texelBytes == 4); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -1531,9 +1543,9 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLuint *d4 = (GLuint *) dstRow; for (col = 0; col < srcWidth; col++) { @@ -1567,9 +1579,9 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLuint *d4 = (GLuint *) dstRow; for (col = 0; col < srcWidth; col++) { @@ -1626,7 +1638,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -1637,9 +1649,9 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; if (dstFormat == &_mesa_texformat_argb8888) { @@ -1673,9 +1685,11 @@ GLboolean _mesa_texstore_rgb888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); ASSERT(dstFormat == &_mesa_texformat_rgb888); - ASSERT(dstFormat->TexelBytes == 3); + ASSERT(texelBytes == 3); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -1703,9 +1717,9 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { dstRow[col * 3 + 0] = srcRow[col * 4 + BCOMP]; @@ -1745,7 +1759,7 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -1756,9 +1770,9 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { #if 0 if (littleEndian) { @@ -1798,9 +1812,11 @@ GLboolean _mesa_texstore_bgr888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); ASSERT(dstFormat == &_mesa_texformat_bgr888); - ASSERT(dstFormat->TexelBytes == 3); + ASSERT(texelBytes == 3); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -1828,9 +1844,9 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { dstRow[col * 3 + 0] = srcRow[col * 4 + RCOMP]; @@ -1870,7 +1886,7 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -1881,9 +1897,9 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { dstRow[col * 3 + 0] = CHAN_TO_UBYTE(src[RCOMP]); @@ -1902,8 +1918,11 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) GLboolean _mesa_texstore_rgba4444(TEXSTORE_PARAMS) { + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + ASSERT(dstFormat == &_mesa_texformat_rgba4444); - ASSERT(dstFormat->TexelBytes == 2); + ASSERT(texelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -1923,7 +1942,7 @@ _mesa_texstore_rgba4444(TEXSTORE_PARAMS) /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -1934,9 +1953,9 @@ _mesa_texstore_rgba4444(TEXSTORE_PARAMS) _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; for (col = 0; col < srcWidth; col++) { @@ -1957,9 +1976,12 @@ _mesa_texstore_rgba4444(TEXSTORE_PARAMS) GLboolean _mesa_texstore_argb4444(TEXSTORE_PARAMS) { + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + ASSERT(dstFormat == &_mesa_texformat_argb4444 || dstFormat == &_mesa_texformat_argb4444_rev); - ASSERT(dstFormat->TexelBytes == 2); + ASSERT(texelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -1979,7 +2001,7 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS) /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -1990,9 +2012,9 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS) _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; if (dstFormat == &_mesa_texformat_argb4444) { @@ -2024,8 +2046,11 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS) GLboolean _mesa_texstore_rgba5551(TEXSTORE_PARAMS) { + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + ASSERT(dstFormat == &_mesa_texformat_rgba5551); - ASSERT(dstFormat->TexelBytes == 2); + ASSERT(texelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -2045,7 +2070,7 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS) /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2056,9 +2081,9 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS) _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; for (col = 0; col < srcWidth; col++) { @@ -2079,9 +2104,12 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS) GLboolean _mesa_texstore_argb1555(TEXSTORE_PARAMS) { + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + ASSERT(dstFormat == &_mesa_texformat_argb1555 || dstFormat == &_mesa_texformat_argb1555_rev); - ASSERT(dstFormat->TexelBytes == 2); + ASSERT(texelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -2101,7 +2129,7 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS) /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2112,9 +2140,9 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS) _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; if (dstFormat == &_mesa_texformat_argb1555) { @@ -2148,10 +2176,12 @@ GLboolean _mesa_texstore_al88(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); ASSERT(dstFormat == &_mesa_texformat_al88 || dstFormat == &_mesa_texformat_al88_rev); - ASSERT(dstFormat->TexelBytes == 2); + ASSERT(texelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -2204,7 +2234,7 @@ _mesa_texstore_al88(TEXSTORE_PARAMS) /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2215,9 +2245,9 @@ _mesa_texstore_al88(TEXSTORE_PARAMS) _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; if (dstFormat == &_mesa_texformat_al88) { @@ -2248,8 +2278,11 @@ _mesa_texstore_al88(TEXSTORE_PARAMS) GLboolean _mesa_texstore_rgb332(TEXSTORE_PARAMS) { + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + ASSERT(dstFormat == &_mesa_texformat_rgb332); - ASSERT(dstFormat->TexelBytes == 1); + ASSERT(texelBytes == 1); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -2267,7 +2300,7 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS) /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2278,9 +2311,9 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS) _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { dstRow[col] = PACK_COLOR_332( CHAN_TO_UBYTE(src[RCOMP]), @@ -2303,10 +2336,13 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS) GLboolean _mesa_texstore_a8(TEXSTORE_PARAMS) { + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + ASSERT(dstFormat == &_mesa_texformat_a8 || dstFormat == &_mesa_texformat_l8 || dstFormat == &_mesa_texformat_i8); - ASSERT(dstFormat->TexelBytes == 1); + ASSERT(texelBytes == 1); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -2353,7 +2389,7 @@ _mesa_texstore_a8(TEXSTORE_PARAMS) /* general path */ const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2364,9 +2400,9 @@ _mesa_texstore_a8(TEXSTORE_PARAMS) _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { for (col = 0; col < srcWidth; col++) { dstRow[col] = CHAN_TO_UBYTE(src[col]); @@ -2385,9 +2421,11 @@ _mesa_texstore_a8(TEXSTORE_PARAMS) GLboolean _mesa_texstore_ci8(TEXSTORE_PARAMS) { + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + (void) dims; (void) baseInternalFormat; ASSERT(dstFormat == &_mesa_texformat_ci8); - ASSERT(dstFormat->TexelBytes == 1); + ASSERT(texelBytes == 1); ASSERT(baseInternalFormat == GL_COLOR_INDEX); if (!ctx->_ImageTransferState && @@ -2407,9 +2445,9 @@ _mesa_texstore_ci8(TEXSTORE_PARAMS) GLint img, row; for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { const GLvoid *src = _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0); @@ -2431,11 +2469,13 @@ GLboolean _mesa_texstore_ycbcr(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + (void) ctx; (void) dims; (void) baseInternalFormat; ASSERT((dstFormat == &_mesa_texformat_ycbcr) || (dstFormat == &_mesa_texformat_ycbcr_rev)); - ASSERT(dstFormat->TexelBytes == 2); + ASSERT(texelBytes == 2); ASSERT(ctx->Extensions.MESA_ycbcr_texture); ASSERT(srcFormat == GL_YCBCR_MESA); ASSERT((srcType == GL_UNSIGNED_SHORT_8_8_MESA) || @@ -2459,9 +2499,9 @@ _mesa_texstore_ycbcr(TEXSTORE_PARAMS) GLint img, row; for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { _mesa_swap2((GLushort *) dstRow, srcWidth); dstRow += dstRowStride; @@ -2475,9 +2515,10 @@ GLboolean _mesa_texstore_dudv8(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); ASSERT(dstFormat == &_mesa_texformat_dudv8); - ASSERT(dstFormat->TexelBytes == 2); + ASSERT(texelBytes == 2); ASSERT(ctx->Extensions.ATI_envmap_bumpmap); ASSERT((srcFormat == GL_DU8DV8_ATI) || (srcFormat == GL_DUDV_ATI)); @@ -2550,11 +2591,11 @@ _mesa_texstore_dudv8(TEXSTORE_PARAMS) src = tempImage; dst = (GLbyte *) dstAddr + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { - memcpy(dst, src, srcWidth * dstFormat->TexelBytes); + memcpy(dst, src, srcWidth * texelBytes); dst += dstRowStride; - src += srcWidth * dstFormat->TexelBytes; + src += srcWidth * texelBytes; } _mesa_free((void *) tempImage); } @@ -2568,10 +2609,12 @@ GLboolean _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); ASSERT(dstFormat == &_mesa_texformat_signed_rgba8888 || dstFormat == &_mesa_texformat_signed_rgba8888_rev); - ASSERT(dstFormat->TexelBytes == 4); + ASSERT(texelBytes == 4); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -2638,7 +2681,7 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) /* general path */ const GLfloat *tempImage = make_temp_float_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2649,9 +2692,9 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; if (dstFormat == &_mesa_texformat_signed_rgba8888) { @@ -2876,7 +2919,9 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS) GLboolean _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) { - const GLint components = _mesa_components_in_format(dstFormat->BaseFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLint components = _mesa_components_in_format(baseFormat); ASSERT(dstFormat == &_mesa_texformat_rgba_float32 || dstFormat == &_mesa_texformat_rgb_float32 || @@ -2890,7 +2935,7 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) baseInternalFormat == GL_LUMINANCE || baseInternalFormat == GL_LUMINANCE_ALPHA || baseInternalFormat == GL_INTENSITY); - ASSERT(dstFormat->TexelBytes == components * sizeof(GLfloat)); + ASSERT(texelBytes == components * sizeof(GLfloat)); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -2908,7 +2953,7 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) /* general path */ const GLfloat *tempImage = make_temp_float_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2921,9 +2966,9 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) bytesPerRow = srcWidth * components * sizeof(GLfloat); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { _mesa_memcpy(dstRow, srcRow, bytesPerRow); dstRow += dstRowStride; @@ -2943,7 +2988,9 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) GLboolean _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) { - const GLint components = _mesa_components_in_format(dstFormat->BaseFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLint components = _mesa_components_in_format(baseFormat); ASSERT(dstFormat == &_mesa_texformat_rgba_float16 || dstFormat == &_mesa_texformat_rgb_float16 || @@ -2957,7 +3004,7 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) baseInternalFormat == GL_LUMINANCE || baseInternalFormat == GL_LUMINANCE_ALPHA || baseInternalFormat == GL_INTENSITY); - ASSERT(dstFormat->TexelBytes == components * sizeof(GLhalfARB)); + ASSERT(texelBytes == components * sizeof(GLhalfARB)); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && @@ -2975,7 +3022,7 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) /* general path */ const GLfloat *tempImage = make_temp_float_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + baseFormat, srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -2986,9 +3033,9 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLhalfARB *dstTexel = (GLhalfARB *) dstRow; GLint i; -- cgit v1.2.3 From 485105ed182e2e997b084f047e72d5a2c3460057 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 26 Sep 2009 12:32:13 -0600 Subject: mesa: move _mesa_get_texstore_func() to texstore.c --- src/mesa/main/formats.c | 75 ------------------------------------------ src/mesa/main/texstore.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/texstore.h | 5 +++ 3 files changed, 90 insertions(+), 75 deletions(-) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 32884cb41d..8aa0d107b7 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -566,68 +566,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }; -static struct { - gl_format Name; - StoreTexImageFunc Store; -} -texstore_funcs[MESA_FORMAT_COUNT] = -{ - { MESA_FORMAT_RGBA, _mesa_texstore_rgba }, - { MESA_FORMAT_RGB, _mesa_texstore_rgba }, - { MESA_FORMAT_ALPHA, _mesa_texstore_rgba }, - { MESA_FORMAT_LUMINANCE, _mesa_texstore_rgba }, - { MESA_FORMAT_LUMINANCE_ALPHA, _mesa_texstore_rgba }, - { MESA_FORMAT_INTENSITY, _mesa_texstore_rgba }, - { MESA_FORMAT_SRGB8, _mesa_texstore_srgb8 }, - { MESA_FORMAT_SRGBA8, _mesa_texstore_srgba8 }, - { MESA_FORMAT_SARGB8, _mesa_texstore_sargb8 }, - { MESA_FORMAT_SL8, _mesa_texstore_sl8 }, - { MESA_FORMAT_SLA8, _mesa_texstore_sla8 }, - { MESA_FORMAT_RGBA_FLOAT32, _mesa_texstore_rgba_float32 }, - { MESA_FORMAT_RGBA_FLOAT16, _mesa_texstore_rgba_float16 }, - { MESA_FORMAT_RGB_FLOAT32, _mesa_texstore_rgba_float32 }, - { MESA_FORMAT_RGB_FLOAT16, _mesa_texstore_rgba_float16 }, - { MESA_FORMAT_ALPHA_FLOAT32, _mesa_texstore_rgba_float32 }, - { MESA_FORMAT_ALPHA_FLOAT16, _mesa_texstore_rgba_float16 }, - { MESA_FORMAT_LUMINANCE_FLOAT32, _mesa_texstore_rgba_float32 }, - { MESA_FORMAT_LUMINANCE_FLOAT16, _mesa_texstore_rgba_float16 }, - { MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, _mesa_texstore_rgba_float32 }, - { MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, _mesa_texstore_rgba_float16 }, - { MESA_FORMAT_INTENSITY_FLOAT32, _mesa_texstore_rgba_float32 }, - { MESA_FORMAT_INTENSITY_FLOAT16, _mesa_texstore_rgba_float16 }, - { MESA_FORMAT_DUDV8, _mesa_texstore_dudv8 }, - { MESA_FORMAT_SIGNED_RGBA8888, _mesa_texstore_signed_rgba8888 }, - { MESA_FORMAT_SIGNED_RGBA8888_REV, _mesa_texstore_signed_rgba8888 }, - { MESA_FORMAT_RGBA8888, _mesa_texstore_rgba8888 }, - { MESA_FORMAT_RGBA8888_REV, _mesa_texstore_rgba8888 }, - { MESA_FORMAT_ARGB8888, _mesa_texstore_argb8888 }, - { MESA_FORMAT_ARGB8888_REV, _mesa_texstore_argb8888 }, - { MESA_FORMAT_RGB888, _mesa_texstore_rgb888 }, - { MESA_FORMAT_BGR888, _mesa_texstore_bgr888 }, - { MESA_FORMAT_RGB565, _mesa_texstore_rgb565 }, - { MESA_FORMAT_RGB565_REV, _mesa_texstore_rgb565 }, - { MESA_FORMAT_RGBA4444, _mesa_texstore_rgba4444 }, - { MESA_FORMAT_ARGB4444, _mesa_texstore_argb4444 }, - { MESA_FORMAT_ARGB4444_REV, _mesa_texstore_argb4444 }, - { MESA_FORMAT_RGBA5551, _mesa_texstore_rgba5551 }, - { MESA_FORMAT_ARGB1555, _mesa_texstore_argb1555 }, - { MESA_FORMAT_ARGB1555_REV, _mesa_texstore_argb1555 }, - { MESA_FORMAT_AL88, _mesa_texstore_al88 }, - { MESA_FORMAT_AL88_REV, _mesa_texstore_al88 }, - { MESA_FORMAT_RGB332, _mesa_texstore_rgb332 }, - { MESA_FORMAT_A8, _mesa_texstore_a8 }, - { MESA_FORMAT_L8, _mesa_texstore_a8 }, - { MESA_FORMAT_I8, _mesa_texstore_a8 }, - { MESA_FORMAT_CI8, _mesa_texstore_ci8 }, - { MESA_FORMAT_YCBCR, _mesa_texstore_ycbcr }, - { MESA_FORMAT_YCBCR_REV, _mesa_texstore_ycbcr }, - { MESA_FORMAT_Z24_S8, _mesa_texstore_z24_s8 }, - { MESA_FORMAT_S8_Z24, _mesa_texstore_s8_z24 }, - { MESA_FORMAT_Z16, _mesa_texstore_z16 }, - { MESA_FORMAT_Z32, _mesa_texstore_z32 }, - { MESA_FORMAT_S8, NULL/*_mesa_texstore_s8*/ }, -}; - static const struct gl_format_info * _mesa_get_format_info(gl_format format) @@ -663,19 +601,6 @@ _mesa_is_format_compressed(gl_format format) } -/* XXX move to texstore.c */ -StoreTexImageFunc -_mesa_get_texstore_func(gl_format format) -{ - GLuint i; - for (i = 0; i < MESA_FORMAT_COUNT; i++) { - if (texstore_funcs[i].Name == format) - return texstore_funcs[i].Store; - } - return NULL; -} - - /** * Do sanity checking of the format info table. */ diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 5b13581b3a..7f2e71585e 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3168,6 +3168,91 @@ _mesa_texstore_sla8(TEXSTORE_PARAMS) #endif /* FEATURE_EXT_texture_sRGB */ + + +/** + * Table mapping MESA_FORMAT_8 to _mesa_texstore_*() + * XXX this is somewhat temporary. + */ +static struct { + gl_format Name; + StoreTexImageFunc Store; +} +texstore_funcs[MESA_FORMAT_COUNT] = +{ + { MESA_FORMAT_RGBA, _mesa_texstore_rgba }, + { MESA_FORMAT_RGB, _mesa_texstore_rgba }, + { MESA_FORMAT_ALPHA, _mesa_texstore_rgba }, + { MESA_FORMAT_LUMINANCE, _mesa_texstore_rgba }, + { MESA_FORMAT_LUMINANCE_ALPHA, _mesa_texstore_rgba }, + { MESA_FORMAT_INTENSITY, _mesa_texstore_rgba }, + { MESA_FORMAT_SRGB8, _mesa_texstore_srgb8 }, + { MESA_FORMAT_SRGBA8, _mesa_texstore_srgba8 }, + { MESA_FORMAT_SARGB8, _mesa_texstore_sargb8 }, + { MESA_FORMAT_SL8, _mesa_texstore_sl8 }, + { MESA_FORMAT_SLA8, _mesa_texstore_sla8 }, + { MESA_FORMAT_RGBA_FLOAT32, _mesa_texstore_rgba_float32 }, + { MESA_FORMAT_RGBA_FLOAT16, _mesa_texstore_rgba_float16 }, + { MESA_FORMAT_RGB_FLOAT32, _mesa_texstore_rgba_float32 }, + { MESA_FORMAT_RGB_FLOAT16, _mesa_texstore_rgba_float16 }, + { MESA_FORMAT_ALPHA_FLOAT32, _mesa_texstore_rgba_float32 }, + { MESA_FORMAT_ALPHA_FLOAT16, _mesa_texstore_rgba_float16 }, + { MESA_FORMAT_LUMINANCE_FLOAT32, _mesa_texstore_rgba_float32 }, + { MESA_FORMAT_LUMINANCE_FLOAT16, _mesa_texstore_rgba_float16 }, + { MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, _mesa_texstore_rgba_float32 }, + { MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, _mesa_texstore_rgba_float16 }, + { MESA_FORMAT_INTENSITY_FLOAT32, _mesa_texstore_rgba_float32 }, + { MESA_FORMAT_INTENSITY_FLOAT16, _mesa_texstore_rgba_float16 }, + { MESA_FORMAT_DUDV8, _mesa_texstore_dudv8 }, + { MESA_FORMAT_SIGNED_RGBA8888, _mesa_texstore_signed_rgba8888 }, + { MESA_FORMAT_SIGNED_RGBA8888_REV, _mesa_texstore_signed_rgba8888 }, + { MESA_FORMAT_RGBA8888, _mesa_texstore_rgba8888 }, + { MESA_FORMAT_RGBA8888_REV, _mesa_texstore_rgba8888 }, + { MESA_FORMAT_ARGB8888, _mesa_texstore_argb8888 }, + { MESA_FORMAT_ARGB8888_REV, _mesa_texstore_argb8888 }, + { MESA_FORMAT_RGB888, _mesa_texstore_rgb888 }, + { MESA_FORMAT_BGR888, _mesa_texstore_bgr888 }, + { MESA_FORMAT_RGB565, _mesa_texstore_rgb565 }, + { MESA_FORMAT_RGB565_REV, _mesa_texstore_rgb565 }, + { MESA_FORMAT_RGBA4444, _mesa_texstore_rgba4444 }, + { MESA_FORMAT_ARGB4444, _mesa_texstore_argb4444 }, + { MESA_FORMAT_ARGB4444_REV, _mesa_texstore_argb4444 }, + { MESA_FORMAT_RGBA5551, _mesa_texstore_rgba5551 }, + { MESA_FORMAT_ARGB1555, _mesa_texstore_argb1555 }, + { MESA_FORMAT_ARGB1555_REV, _mesa_texstore_argb1555 }, + { MESA_FORMAT_AL88, _mesa_texstore_al88 }, + { MESA_FORMAT_AL88_REV, _mesa_texstore_al88 }, + { MESA_FORMAT_RGB332, _mesa_texstore_rgb332 }, + { MESA_FORMAT_A8, _mesa_texstore_a8 }, + { MESA_FORMAT_L8, _mesa_texstore_a8 }, + { MESA_FORMAT_I8, _mesa_texstore_a8 }, + { MESA_FORMAT_CI8, _mesa_texstore_ci8 }, + { MESA_FORMAT_YCBCR, _mesa_texstore_ycbcr }, + { MESA_FORMAT_YCBCR_REV, _mesa_texstore_ycbcr }, + { MESA_FORMAT_Z24_S8, _mesa_texstore_z24_s8 }, + { MESA_FORMAT_S8_Z24, _mesa_texstore_s8_z24 }, + { MESA_FORMAT_Z16, _mesa_texstore_z16 }, + { MESA_FORMAT_Z32, _mesa_texstore_z32 }, + { MESA_FORMAT_S8, NULL/*_mesa_texstore_s8*/ }, +}; + + +/** + * Return the StoreTexImageFunc pointer to store an image in the given format. + */ +StoreTexImageFunc +_mesa_get_texstore_func(gl_format format) +{ + GLuint i; + for (i = 0; i < MESA_FORMAT_COUNT; i++) { + if (texstore_funcs[i].Name == format) + return texstore_funcs[i].Store; + } + return NULL; +} + + + /** * Check if an unpack PBO is active prior to fetching a texture image. * If so, do bounds checking and map the buffer into main memory. diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h index 313f2d6a59..629854b446 100644 --- a/src/mesa/main/texstore.h +++ b/src/mesa/main/texstore.h @@ -37,6 +37,7 @@ #include "mtypes.h" +#include "formats.h" extern GLboolean _mesa_texstore_rgba(TEXSTORE_PARAMS); @@ -154,6 +155,10 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_image *texImage); +extern StoreTexImageFunc +_mesa_get_texstore_func(gl_format format); + + extern void _mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, -- cgit v1.2.3 From a77226071f6814a53358a5d6caff685889d0e4ec Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Sun, 27 Sep 2009 10:56:42 -0400 Subject: softpipe: Grab a ref when the fb is set. Nasty bug when the surface is freed and another is allocated right on top of it. The next time we set the fb state SP thinks it's the same surface and doesn't flush, and when the flush eventually happens the surface belongs to a completely different texture. --- src/gallium/drivers/softpipe/sp_context.c | 9 +++++++-- src/gallium/drivers/softpipe/sp_state_surface.c | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index e1e31ab047..94d000a5ac 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -94,12 +94,17 @@ softpipe_destroy( struct pipe_context *pipe ) softpipe->quad.depth_test->destroy( softpipe->quad.depth_test ); softpipe->quad.blend->destroy( softpipe->quad.blend ); - for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) + for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { sp_destroy_tile_cache(softpipe->cbuf_cache[i]); + pipe_surface_reference(&softpipe->framebuffer.cbufs[i], NULL); + } sp_destroy_tile_cache(softpipe->zsbuf_cache); + pipe_surface_reference(&softpipe->framebuffer.zsbuf, NULL); - for (i = 0; i < PIPE_MAX_SAMPLERS; i++) + for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { sp_destroy_tex_tile_cache(softpipe->tex_cache[i]); + pipe_texture_reference(&softpipe->texture[i], NULL); + } for (i = 0; i < Elements(softpipe->constants); i++) { if (softpipe->constants[i].buffer) { diff --git a/src/gallium/drivers/softpipe/sp_state_surface.c b/src/gallium/drivers/softpipe/sp_state_surface.c index c8f55c3cec..bc0e201130 100644 --- a/src/gallium/drivers/softpipe/sp_state_surface.c +++ b/src/gallium/drivers/softpipe/sp_state_surface.c @@ -56,7 +56,7 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe, sp_flush_tile_cache(sp->cbuf_cache[i]); /* assign new */ - sp->framebuffer.cbufs[i] = fb->cbufs[i]; + pipe_surface_reference(&sp->framebuffer.cbufs[i], fb->cbufs[i]); /* update cache */ sp_tile_cache_set_surface(sp->cbuf_cache[i], fb->cbufs[i]); @@ -71,7 +71,7 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe, sp_flush_tile_cache(sp->zsbuf_cache); /* assign new */ - sp->framebuffer.zsbuf = fb->zsbuf; + pipe_surface_reference(&sp->framebuffer.zsbuf, fb->zsbuf); /* update cache */ sp_tile_cache_set_surface(sp->zsbuf_cache, fb->zsbuf); -- cgit v1.2.3 From eea30906de37ea3b2f8a594c2b33b643d3dde987 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Sun, 27 Sep 2009 14:47:12 -0400 Subject: r600 : Enable draw_prim. --- src/mesa/drivers/dri/r600/r700_render.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index 5627984cf9..4949bf013d 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -1147,9 +1147,7 @@ void r700InitDraw(GLcontext *ctx) struct vbo_context *vbo = vbo_context(ctx); /* to be enabled */ - /* vbo->draw_prims = r700DrawPrims; - */ } -- cgit v1.2.3 From dd586078bef433d0830df0b60c768c617a8ae8cd Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 22 Sep 2009 20:22:13 -0700 Subject: st/egl: Remove buffer from screen It is no longer needed since the new drm api code, and it incorrectly checked if the buffer where there for testing completeness when it should have checked the texture instead. --- src/gallium/state_trackers/egl/egl_surface.c | 7 +++---- src/gallium/state_trackers/egl/egl_tracker.h | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c index 69e2d6b708..542ac56121 100644 --- a/src/gallium/state_trackers/egl/egl_surface.c +++ b/src/gallium/state_trackers/egl/egl_surface.c @@ -152,7 +152,6 @@ drm_takedown_shown_screen(_EGLDisplay *dpy, struct drm_screen *screen) pipe_surface_reference(&screen->surface, NULL); pipe_texture_reference(&screen->tex, NULL); - pipe_buffer_reference(&screen->buffer, NULL); screen->shown = 0; } @@ -250,8 +249,8 @@ drm_show_screen_surface_mesa(_EGLDriver *drv, _EGLDisplay *dpy, drm_create_texture(dpy, scrn, mode->Width, mode->Height); - if (!scrn->buffer) - return EGL_FALSE; + if (!scrn->tex) + goto err_tex; ret = drmModeAddFB(dev->drmFD, scrn->front.width, scrn->front.height, @@ -325,8 +324,8 @@ err_fb: err_bo: pipe_surface_reference(&scrn->surface, NULL); pipe_texture_reference(&scrn->tex, NULL); - pipe_buffer_reference(&scrn->buffer, NULL); +err_tex: return EGL_FALSE; } diff --git a/src/gallium/state_trackers/egl/egl_tracker.h b/src/gallium/state_trackers/egl/egl_tracker.h index dd4730f957..f280748d65 100644 --- a/src/gallium/state_trackers/egl/egl_tracker.h +++ b/src/gallium/state_trackers/egl/egl_tracker.h @@ -94,7 +94,6 @@ struct drm_screen * pipe */ - struct pipe_buffer *buffer; struct pipe_texture *tex; struct pipe_surface *surface; -- cgit v1.2.3 From c3663bdc35d393194da9fb3b4d5120ea70eb1bbe Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 22 Sep 2009 17:00:46 -0700 Subject: i915g: Enable reuse of buffers --- src/gallium/winsys/drm/intel/gem/intel_drm_api.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/winsys/drm/intel/gem/intel_drm_api.c b/src/gallium/winsys/drm/intel/gem/intel_drm_api.c index 0fd5cdd969..46fdc9f92b 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_drm_api.c +++ b/src/gallium/winsys/drm/intel/gem/intel_drm_api.c @@ -167,6 +167,7 @@ intel_drm_create_screen(struct drm_api *api, int drmFD, idws->base.destroy = intel_drm_winsys_destroy; idws->pools.gem = drm_intel_bufmgr_gem_init(idws->fd, idws->max_batch_size); + drm_intel_bufmgr_gem_enable_reuse(idws->pools.gem); idws->softpipe = FALSE; idws->dump_cmd = debug_get_bool_option("INTEL_DUMP_CMD", FALSE); -- cgit v1.2.3 From 60d72d9e45b08c14ea4195950302f93e52e03603 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 23 Sep 2009 11:53:50 -0700 Subject: i915g: Use boolean --- src/gallium/drivers/i915simple/i915_texture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/i915simple/i915_texture.c b/src/gallium/drivers/i915simple/i915_texture.c index 6a6c654271..1d0329817d 100644 --- a/src/gallium/drivers/i915simple/i915_texture.c +++ b/src/gallium/drivers/i915simple/i915_texture.c @@ -165,7 +165,7 @@ i915_scanout_layout(struct i915_texture *tex) struct pipe_texture *pt = &tex->base; if (pt->last_level > 0 || pt->block.size != 4) - return 0; + return FALSE; i915_miptree_set_level_info(tex, 0, 1, tex->base.width[0], -- cgit v1.2.3 From 5aecddc1532d6c7f5095145a50eed0405ea2bda4 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 23 Sep 2009 11:54:22 -0700 Subject: i915g: Make sure to map tiled buffers via the gtt --- src/gallium/winsys/drm/intel/gem/intel_drm_api.c | 5 +++++ src/gallium/winsys/drm/intel/gem/intel_drm_buffer.c | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/intel/gem/intel_drm_api.c b/src/gallium/winsys/drm/intel/gem/intel_drm_api.c index 46fdc9f92b..8b647a769b 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_drm_api.c +++ b/src/gallium/winsys/drm/intel/gem/intel_drm_api.c @@ -41,6 +41,7 @@ intel_drm_buffer_from_handle(struct intel_drm_winsys *idws, const char* name, unsigned handle) { struct intel_drm_buffer *buf = CALLOC_STRUCT(intel_drm_buffer); + uint32_t tile = 0, swizzle = 0; if (!buf) return NULL; @@ -53,6 +54,10 @@ intel_drm_buffer_from_handle(struct intel_drm_winsys *idws, if (!buf->bo) goto err; + drm_intel_bo_get_tiling(buf->bo, &tile, &swizzle); + if (tile != INTEL_TILE_NONE) + buf->map_gtt = TRUE; + return (struct intel_buffer *)buf; err: diff --git a/src/gallium/winsys/drm/intel/gem/intel_drm_buffer.c b/src/gallium/winsys/drm/intel/gem/intel_drm_buffer.c index 0030f915a3..327e19fcd6 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_drm_buffer.c +++ b/src/gallium/winsys/drm/intel/gem/intel_drm_buffer.c @@ -58,11 +58,17 @@ intel_drm_buffer_set_fence_reg(struct intel_winsys *iws, unsigned stride, enum intel_buffer_tile tile) { + struct intel_drm_buffer *buf = intel_drm_buffer(buffer); assert(I915_TILING_NONE == INTEL_TILE_NONE); assert(I915_TILING_X == INTEL_TILE_X); assert(I915_TILING_Y == INTEL_TILE_Y); - return drm_intel_bo_set_tiling(intel_bo(buffer), &tile, stride); + if (tile != INTEL_TILE_NONE) { + assert(buf->map_count == 0); + buf->map_gtt = TRUE; + } + + return drm_intel_bo_set_tiling(buf->bo, &tile, stride); } static void * -- cgit v1.2.3 From 973e9a774a176be3a8f0849892b568888d41e932 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 23 Sep 2009 11:57:18 -0700 Subject: i915g: Tile shared buffers as well --- src/gallium/drivers/i915simple/i915_texture.c | 47 +++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/i915simple/i915_texture.c b/src/gallium/drivers/i915simple/i915_texture.c index 1d0329817d..15ccc1fc73 100644 --- a/src/gallium/drivers/i915simple/i915_texture.c +++ b/src/gallium/drivers/i915simple/i915_texture.c @@ -191,6 +191,38 @@ i915_scanout_layout(struct i915_texture *tex) return TRUE; } +/** + * Special case to deal with shared textures. + */ +static boolean +i915_display_target_layout(struct i915_texture *tex) +{ + struct pipe_texture *pt = &tex->base; + + if (pt->last_level > 0 || pt->block.size != 4) + return FALSE; + + /* fallback to normal textures for small textures */ + if (tex->base.width[0] < 240) + return FALSE; + + i915_miptree_set_level_info(tex, 0, 1, + tex->base.width[0], + tex->base.height[0], + 1); + i915_miptree_set_image_offset(tex, 0, 0, 0, 0); + + tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size); + tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8); + tex->hw_tiled = INTEL_TILE_X; + + debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__, + tex->base.width[0], tex->base.height[0], pt->block.size, + tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy); + + return TRUE; +} + static void i915_miptree_layout_2d(struct i915_texture *tex) { @@ -201,6 +233,16 @@ i915_miptree_layout_2d(struct i915_texture *tex) unsigned nblocksx = pt->nblocksx[0]; unsigned nblocksy = pt->nblocksy[0]; + /* used for scanouts that need special layouts */ + if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_PRIMARY) + if (i915_scanout_layout(tex)) + return; + + /* for shared buffers we use some very like scanout */ + if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET) + if (i915_display_target_layout(tex)) + return; + tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4); tex->total_nblocksy = 0; @@ -351,6 +393,11 @@ i945_miptree_layout_2d(struct i915_texture *tex) if (i915_scanout_layout(tex)) return; + /* for shared buffers we use some very like scanout */ + if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET) + if (i915_display_target_layout(tex)) + return; + tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4); /* May need to adjust pitch to accomodate the placement of -- cgit v1.2.3 From 2d71b541d7de818f4cb47a61d3a86c0ffbb6163c Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 27 Sep 2009 13:11:49 -0700 Subject: i915g: Fix warning --- src/gallium/drivers/i915simple/i915_prim_vbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/i915simple/i915_prim_vbuf.c b/src/gallium/drivers/i915simple/i915_prim_vbuf.c index b3a7774fd6..aee8819ed9 100644 --- a/src/gallium/drivers/i915simple/i915_prim_vbuf.c +++ b/src/gallium/drivers/i915simple/i915_prim_vbuf.c @@ -198,7 +198,7 @@ i915_vbuf_render_map_vertices(struct vbuf_render *render) struct intel_winsys *iws = i915->iws; if (i915->vbo_flushed) - debug_printf("%s bad vbo flush occured stalling on hw\n"); + debug_printf("%s bad vbo flush occured stalling on hw\n", __func__); i915_render->vbo_ptr = iws->buffer_map(iws, i915_render->vbo, TRUE); -- cgit v1.2.3 From 48c45959ee106727fe9dd2d57bc0ca278710aab8 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 27 Sep 2009 13:12:11 -0700 Subject: i915g: Submit direct vertex buffers --- src/gallium/drivers/i915simple/i915_prim_vbuf.c | 33 +++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/i915simple/i915_prim_vbuf.c b/src/gallium/drivers/i915simple/i915_prim_vbuf.c index aee8819ed9..d50201642b 100644 --- a/src/gallium/drivers/i915simple/i915_prim_vbuf.c +++ b/src/gallium/drivers/i915simple/i915_prim_vbuf.c @@ -389,14 +389,43 @@ i915_vbuf_render_draw_arrays(struct vbuf_render *render, uint nr) { struct i915_vbuf_render *i915_render = i915_vbuf_render(render); + struct i915_context *i915 = i915_render->i915; if (i915_render->fallback) { draw_arrays_fallback(render, start, nr); return; } - /* JB: TODO submit direct cmds */ - draw_arrays_fallback(render, start, nr); + if (i915->dirty) + i915_update_derived(i915); + + if (i915->hardware_dirty) + i915_emit_hardware_state(i915); + + if (!BEGIN_BATCH(2, 0)) { + FLUSH_BATCH(NULL); + + /* Make sure state is re-emitted after a flush: + */ + i915_update_derived(i915); + i915_emit_hardware_state(i915); + i915->vbo_flushed = 1; + + if (!BEGIN_BATCH(2, 0)) { + assert(0); + goto out; + } + } + + OUT_BATCH(_3DPRIMITIVE | + PRIM_INDIRECT | + PRIM_INDIRECT_SEQUENTIAL | + i915_render->hwprim | + nr); + OUT_BATCH(start); /* Beginning vertex index */ + +out: + return; } /** -- cgit v1.2.3 From 225c3375fdfc4a3744c3a7a777664ef94923a2ce Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sun, 27 Sep 2009 20:31:55 +1000 Subject: r300g: silence compiler warning --- src/gallium/drivers/r300/r300_state_derived.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 5f6b225d34..62da8e293a 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -164,7 +164,7 @@ static void r300_vs_tab_routes(struct r300_context* r300, vinfo->hwfmt[3] |= (4 << (3 * i)); } - for (i; i < texs; i++) { + for (; i < texs; i++) { draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, draw_find_vs_output(r300->draw, TGSI_SEMANTIC_GENERIC, i)); vinfo->hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i); -- cgit v1.2.3 From b1252c7a342e24571ccf5fe94938bbabbdf9aa11 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sun, 27 Sep 2009 20:34:13 +1000 Subject: r300g: rewrite RS state setup. Not 100% sure this is correct, but its more correct than what was here previous however it may require changes in the input routing for the frag shader. --- src/gallium/drivers/r300/r300_state_derived.c | 37 ++++++++++----------------- 1 file changed, 13 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 62da8e293a..5493a098cb 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -334,48 +334,37 @@ static void r300_update_rs_block(struct r300_context* r300) struct r300_rs_block* rs = r300->rs_block; struct tgsi_shader_info* info = &r300->fs->info; int* tab = r300->vertex_info.fs_tab; - int col_count = 0, fp_offset = 0, i, memory_pos, tex_count = 0; - + int col_count = 0, fp_offset = 0, i, tex_count = 0; + int rs_tex_comp = 0; memset(rs, 0, sizeof(struct r300_rs_block)); if (r300_screen(r300->context.screen)->caps->is_r500) { for (i = 0; i < info->num_inputs; i++) { assert(tab[i] != -1); - memory_pos = tab[i] * 4; switch (info->input_semantic_name[i]) { case TGSI_SEMANTIC_COLOR: rs->ip[col_count] |= - R500_RS_COL_PTR(memory_pos) | + R500_RS_COL_PTR(col_count) | R500_RS_COL_FMT(R300_RS_COL_FMT_RGBA); col_count++; break; case TGSI_SEMANTIC_GENERIC: rs->ip[tex_count] |= - R500_RS_SEL_S(memory_pos) | - R500_RS_SEL_T(memory_pos + 1) | - R500_RS_SEL_R(memory_pos + 2) | - R500_RS_SEL_Q(memory_pos + 3); + R500_RS_SEL_S(rs_tex_comp) | + R500_RS_SEL_T(rs_tex_comp + 1) | + R500_RS_SEL_R(rs_tex_comp + 2) | + R500_RS_SEL_Q(rs_tex_comp + 3); tex_count++; + rs_tex_comp += 4; break; default: break; } } - if (col_count == 0) { - rs->ip[0] |= R500_RS_COL_FMT(R300_RS_COL_FMT_0001); - } - - if (tex_count == 0) { - rs->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); - } - /* Rasterize at least one color, or bad things happen. */ if ((col_count == 0) && (tex_count == 0)) { + rs->ip[0] |= R500_RS_COL_FMT(R300_RS_COL_FMT_0001); col_count++; } @@ -393,22 +382,22 @@ static void r300_update_rs_block(struct r300_context* r300) } else { for (i = 0; i < info->num_inputs; i++) { assert(tab[i] != -1); - memory_pos = tab[i] * 4; switch (info->input_semantic_name[i]) { case TGSI_SEMANTIC_COLOR: rs->ip[col_count] |= - R300_RS_COL_PTR(memory_pos) | + R300_RS_COL_PTR(col_count) | R300_RS_COL_FMT(R300_RS_COL_FMT_RGBA); col_count++; break; case TGSI_SEMANTIC_GENERIC: rs->ip[tex_count] |= - R300_RS_TEX_PTR(memory_pos) | + R300_RS_TEX_PTR(rs_tex_count) | R300_RS_SEL_S(R300_RS_SEL_C0) | R300_RS_SEL_T(R300_RS_SEL_C1) | R300_RS_SEL_R(R300_RS_SEL_C2) | R300_RS_SEL_Q(R300_RS_SEL_C3); tex_count++; + rs_tex_count+=4; break; default: break; @@ -445,7 +434,7 @@ static void r300_update_rs_block(struct r300_context* r300) } } - rs->count = (tex_count * 4) | (col_count << R300_IC_COUNT_SHIFT) | + rs->count = (rs_tex_comp) | (col_count << R300_IC_COUNT_SHIFT) | R300_HIRES_EN; rs->inst_count = MAX2(MAX2(col_count - 1, tex_count - 1), 0); -- cgit v1.2.3 From d85fe842b86aef522e0e749d9360d85052a6e8cc Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 28 Sep 2009 06:42:25 +1000 Subject: r300g: fix r300 rs path --- src/gallium/drivers/r300/r300_state_derived.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 5493a098cb..2bbbcdfd9c 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -391,13 +391,13 @@ static void r300_update_rs_block(struct r300_context* r300) break; case TGSI_SEMANTIC_GENERIC: rs->ip[tex_count] |= - R300_RS_TEX_PTR(rs_tex_count) | + R300_RS_TEX_PTR(rs_tex_comp) | R300_RS_SEL_S(R300_RS_SEL_C0) | R300_RS_SEL_T(R300_RS_SEL_C1) | R300_RS_SEL_R(R300_RS_SEL_C2) | R300_RS_SEL_Q(R300_RS_SEL_C3); tex_count++; - rs_tex_count+=4; + rs_tex_comp+=4; break; default: break; -- cgit v1.2.3 From a6eb593072298d60286f49a09e6d3a849b684dfb Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 27 Sep 2009 22:15:15 +0200 Subject: r300g: add some debugging info --- src/gallium/drivers/r300/r300_cs.h | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_cs.h b/src/gallium/drivers/r300/r300_cs.h index 0a7e470363..883f0a02dc 100644 --- a/src/gallium/drivers/r300/r300_cs.h +++ b/src/gallium/drivers/r300/r300_cs.h @@ -68,11 +68,17 @@ } while (0) #define OUT_CS(value) do { \ + if (VERY_VERBOSE_CS || VERY_VERBOSE_REGISTERS) { \ + DBG(cs_context_copy, DBG_CS, "r300: writing %08x\n", value); \ + } \ cs_winsys->write_cs_dword(cs_winsys, (value)); \ cs_count--; \ } while (0) #define OUT_CS_32F(value) do { \ + if (VERY_VERBOSE_CS || VERY_VERBOSE_REGISTERS) { \ + DBG(cs_context_copy, DBG_CS, "r300: writing %f\n", value); \ + } \ cs_winsys->write_cs_dword(cs_winsys, fui(value)); \ cs_count--; \ } while (0) @@ -82,8 +88,9 @@ DBG(cs_context_copy, DBG_CS, "r300: writing 0x%08X to register 0x%04X\n", \ value, register); \ assert(register); \ - OUT_CS(CP_PACKET0(register, 0)); \ - OUT_CS(value); \ + cs_winsys->write_cs_dword(cs_winsys, CP_PACKET0(register, 0)); \ + cs_winsys->write_cs_dword(cs_winsys, value); \ + cs_count -= 2; \ } while (0) /* Note: This expects count to be the number of registers, @@ -93,7 +100,8 @@ DBG(cs_context_copy, DBG_CS, "r300: writing register sequence of %d to 0x%04X\n", \ count, register); \ assert(register); \ - OUT_CS(CP_PACKET0(register, ((count) - 1))); \ + cs_winsys->write_cs_dword(cs_winsys, CP_PACKET0((register), ((count) - 1))); \ + cs_count--; \ } while (0) #define OUT_CS_RELOC(bo, offset, rd, wd, flags) do { \ @@ -101,9 +109,9 @@ "domains (%d, %d, %d)\n", \ bo, offset, rd, wd, flags); \ assert(bo); \ - OUT_CS(offset); \ + cs_winsys->write_cs_dword(cs_winsys, offset); \ cs_winsys->write_cs_reloc(cs_winsys, bo, rd, wd, flags); \ - cs_count -= 2; \ + cs_count -= 3; \ } while (0) #define END_CS do { \ @@ -131,24 +139,26 @@ DBG(cs_context_copy, DBG_CS, "r300: writing data sequence of %d to 0x%04X\n", \ count, register); \ assert(register); \ - OUT_CS(CP_PACKET0(register, ((count) - 1)) | RADEON_ONE_REG_WR); \ + cs_winsys->write_cs_dword(cs_winsys, CP_PACKET0((register), ((count) - 1)) | RADEON_ONE_REG_WR); \ + cs_count--; \ } while (0) #define CP_PACKET3(op, count) \ (RADEON_CP_PACKET3 | (op) | ((count) << 16)) #define OUT_CS_PKT3(op, count) do { \ - OUT_CS(CP_PACKET3(op, count)); \ + cs_winsys->write_cs_dword(cs_winsys, CP_PACKET3(op, count)); \ + cs_count--; \ } while (0) #define OUT_CS_INDEX_RELOC(bo, offset, count, rd, wd, flags) do { \ DBG(cs_context_copy, DBG_CS, "r300: writing relocation for index buffer %p," \ "offset %d\n", bo, offset); \ assert(bo); \ - OUT_CS(offset); \ - OUT_CS(count); \ + cs_winsys->write_cs_dword(cs_winsys, offset); \ + cs_winsys->write_cs_dword(cs_winsys, count); \ cs_winsys->write_cs_reloc(cs_winsys, bo, rd, wd, flags); \ - cs_count -= 2; \ + cs_count -= 4; \ } while (0) #endif /* R300_CS_H */ -- cgit v1.2.3 From 8c8b77a5f3ec1dac0bddc98da3ccbb64f58f22e0 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 27 Sep 2009 22:18:49 +0200 Subject: r300g: plug memory leak --- src/gallium/drivers/r300/r300_render.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 737396d8d9..16f6404012 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -81,6 +81,7 @@ static boolean r300_render_allocate_vertices(struct vbuf_render* render, if (size + r300render->vbo_offset > r300render->vbo_size) { + pipe_buffer_reference(&r300->vbo, NULL); r300render->vbo = pipe_buffer_create(screen, 64, PIPE_BUFFER_USAGE_VERTEX, @@ -129,7 +130,6 @@ static void r300_render_release_vertices(struct vbuf_render* render) r300render->vbo_offset += r300render->vbo_max_used; r300render->vbo_max_used = 0; - r300->vbo = NULL; } static boolean r300_render_set_primitive(struct vbuf_render* render, -- cgit v1.2.3 From bedc6b7bdff40156b66cb2473c47512e5c95bdab Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 27 Sep 2009 22:20:41 +0200 Subject: r300g: add some assertions Not sure why we are getting a shader with two inputs with position semantic, but we don't know how to handle it correctly so it's better to stop the app than lock the machine. --- src/gallium/drivers/r300/r300_state_derived.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 2bbbcdfd9c..083861a071 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -55,6 +55,7 @@ static void r300_vs_tab_routes(struct r300_context* r300, for (i = 0; i < info->num_inputs; i++) { switch (info->input_semantic_name[i]) { case TGSI_SEMANTIC_POSITION: + assert(pos == FALSE); pos = TRUE; tab[i] = 0; break; @@ -63,10 +64,12 @@ static void r300_vs_tab_routes(struct r300_context* r300, cols++; break; case TGSI_SEMANTIC_PSIZE: + assert(psize == FALSE); psize = TRUE; tab[i] = 15; break; case TGSI_SEMANTIC_FOG: + assert(fog == FALSE); fog = TRUE; /* Fall through */ case TGSI_SEMANTIC_GENERIC: -- cgit v1.2.3 From 98f6bea1685957fe9261e50f8a56f7dcb34f9b38 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 27 Sep 2009 22:28:46 +0200 Subject: r300g: don't force vertex position for HW TCL path It could be generated by vertex shader. --- src/gallium/drivers/r300/r300_state_derived.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 083861a071..ed5dc1b9ff 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -128,7 +128,9 @@ static void r300_vs_tab_routes(struct r300_context* r300, vinfo->hwfmt[0] = 0x5555; /* XXX this is classic Mesa bonghits */ - if (!pos) { + /* We need to add vertex position attribute only for SW TCL case, + * for HW TCL case it could be generated by vertex shader */ + if (!pos && !r300screen->caps->has_tcl) { debug_printf("r300: Forcing vertex position attribute emit...\n"); /* Make room for the position attribute * at the beginning of the tab. */ -- cgit v1.2.3 From 540039887ac19b5fdd099ccaad6b44b5db973c25 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 27 Sep 2009 22:30:45 +0200 Subject: r300g: fix erroneous condition --- src/gallium/drivers/r300/r300_state_derived.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index ed5dc1b9ff..5026afc830 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -50,7 +50,7 @@ static void r300_vs_tab_routes(struct r300_context* r300, assert(info->num_inputs <= 16); - if (!r300screen->caps->has_tcl || !r300->rs_state->enable_vte) + if (!r300screen->caps->has_tcl) { for (i = 0; i < info->num_inputs; i++) { switch (info->input_semantic_name[i]) { -- cgit v1.2.3 From 722b76156486bbb03f8504e8f7a5db05b9257da5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 17:01:41 -0600 Subject: mesa: use _mesa_get_texstore_func() to get texture image store func --- src/mesa/main/texstore.c | 136 ++++++++++++++++++++++++++++------------------- 1 file changed, 82 insertions(+), 54 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 7f2e71585e..f457e08a5b 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3501,15 +3501,19 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, else { const GLint dstRowStride = 0; GLboolean success; - ASSERT(texImage->TexFormat->StoreImage); - success = texImage->TexFormat->StoreImage(ctx, 1, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, 1, 1, - format, type, pixels, packing); + const StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + + ASSERT(storeImage); + + success = storeImage(ctx, 1, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, 1, 1, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); } @@ -3572,6 +3576,11 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, else { GLint dstRowStride; GLboolean success; + const StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + + ASSERT(storeImage); + if (texImage->IsCompressed) { dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); @@ -3579,15 +3588,15 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, else { dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes; } - ASSERT(texImage->TexFormat->StoreImage); - success = texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - format, type, pixels, packing); + + success = storeImage(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); } @@ -3646,6 +3655,11 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, else { GLint dstRowStride; GLboolean success; + const StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + + ASSERT(storeImage); + if (texImage->IsCompressed) { dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); @@ -3653,15 +3667,15 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, else { dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes; } - ASSERT(texImage->TexFormat->StoreImage); - success = texImage->TexFormat->StoreImage(ctx, 3, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, height, depth, - format, type, pixels, packing); + + success = storeImage(ctx, 3, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, height, depth, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D"); } @@ -3694,15 +3708,19 @@ _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, { const GLint dstRowStride = 0; GLboolean success; - ASSERT(texImage->TexFormat->StoreImage); - success = texImage->TexFormat->StoreImage(ctx, 1, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - xoffset, 0, 0, /* offsets */ - dstRowStride, - texImage->ImageOffsets, - width, 1, 1, - format, type, pixels, packing); + const StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + + ASSERT(storeImage); + + success = storeImage(ctx, 1, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + xoffset, 0, 0, /* offsets */ + dstRowStride, + texImage->ImageOffsets, + width, 1, 1, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage1D"); } @@ -3735,6 +3753,11 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, { GLint dstRowStride = 0; GLboolean success; + const StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + + ASSERT(storeImage); + if (texImage->IsCompressed) { dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, texImage->Width); @@ -3742,15 +3765,15 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, else { dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes; } - ASSERT(texImage->TexFormat->StoreImage); - success = texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - xoffset, yoffset, 0, - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - format, type, pixels, packing); + + success = storeImage(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + xoffset, yoffset, 0, + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D"); } @@ -3783,6 +3806,11 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, { GLint dstRowStride; GLboolean success; + const StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + + ASSERT(storeImage); + if (texImage->IsCompressed) { dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, texImage->Width); @@ -3790,15 +3818,15 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, else { dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes; } - ASSERT(texImage->TexFormat->StoreImage); - success = texImage->TexFormat->StoreImage(ctx, 3, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - xoffset, yoffset, zoffset, - dstRowStride, - texImage->ImageOffsets, - width, height, depth, - format, type, pixels, packing); + + success = storeImage(ctx, 3, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + xoffset, yoffset, zoffset, + dstRowStride, + texImage->ImageOffsets, + width, height, depth, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage3D"); } -- cgit v1.2.3 From 0f91e4461fb3a7410c948acde270d97caa851ed6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 17:07:22 -0600 Subject: mesa: minor clean-up in _mesa_texstore_srgb8() --- src/mesa/main/texstore.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index f457e08a5b..f4df71d769 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3058,16 +3058,14 @@ GLboolean _mesa_texstore_srgb8(TEXSTORE_PARAMS) { const struct gl_texture_format *newDstFormat; - StoreTexImageFunc store; GLboolean k; ASSERT(dstFormat == &_mesa_texformat_srgb8); /* reuse normal rgb texstore code */ newDstFormat = &_mesa_texformat_rgb888; - store = _mesa_texstore_rgb888; - k = store(ctx, dims, baseInternalFormat, + k = _mesa_texstore_rgb888(ctx, dims, baseInternalFormat, newDstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageOffsets, -- cgit v1.2.3 From da793b743462e84e3bca7a0ed7f24b4c942e0834 Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Sun, 27 Sep 2009 14:40:14 -0400 Subject: util: Add util_next_power_of_two() for rounding a uint up to a POT. --- src/gallium/auxiliary/util/u_math.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index cd6a9fcc09..75b075f160 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -470,6 +470,26 @@ util_logbase2(unsigned n) } +/** + * Returns the smallest power of two >= x + */ +static INLINE unsigned +util_next_power_of_two(unsigned x) +{ + unsigned i; + + if (x == 0) + return 1; + + --x; + + for (i = 1; i < sizeof(unsigned) * 8; i <<= 1) + x |= x >> i; + + return x + 1; +} + + /** * Clamp X to [MIN, MAX]. * This is a macro to allow float, int, uint, etc. types. -- cgit v1.2.3 From f547472bfa0a797adacc2a7688b4c1ba65381a80 Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Sun, 27 Sep 2009 19:49:06 -0400 Subject: g3dvl: pipe_video_context interface, softpipe impl, auxiliary libs --- src/gallium/SConscript | 1 + src/gallium/auxiliary/vl/Makefile | 12 + src/gallium/auxiliary/vl/SConscript | 12 + src/gallium/auxiliary/vl/vl_bitstream_parser.c | 144 ++ src/gallium/auxiliary/vl/vl_bitstream_parser.h | 36 + src/gallium/auxiliary/vl/vl_compositor.c | 590 ++++++++ src/gallium/auxiliary/vl/vl_compositor.h | 47 + src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 1662 ++++++++++++++++++++++ src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h | 93 ++ src/gallium/auxiliary/vl/vl_shader_build.c | 215 +++ src/gallium/auxiliary/vl/vl_shader_build.h | 61 + src/gallium/drivers/softpipe/Makefile | 3 +- src/gallium/drivers/softpipe/SConscript | 3 +- src/gallium/drivers/softpipe/sp_texture.c | 56 + src/gallium/drivers/softpipe/sp_texture.h | 16 + src/gallium/drivers/softpipe/sp_video_context.c | 273 ++++ src/gallium/drivers/softpipe/sp_video_context.h | 30 + src/gallium/include/pipe/p_defines.h | 24 + src/gallium/include/pipe/p_format.h | 18 + src/gallium/include/pipe/p_screen.h | 16 +- src/gallium/include/pipe/p_video_context.h | 92 ++ src/gallium/include/pipe/p_video_state.h | 158 ++ 22 files changed, 3559 insertions(+), 3 deletions(-) create mode 100644 src/gallium/auxiliary/vl/Makefile create mode 100644 src/gallium/auxiliary/vl/SConscript create mode 100644 src/gallium/auxiliary/vl/vl_bitstream_parser.c create mode 100644 src/gallium/auxiliary/vl/vl_bitstream_parser.h create mode 100644 src/gallium/auxiliary/vl/vl_compositor.c create mode 100644 src/gallium/auxiliary/vl/vl_compositor.h create mode 100644 src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c create mode 100644 src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h create mode 100644 src/gallium/auxiliary/vl/vl_shader_build.c create mode 100644 src/gallium/auxiliary/vl/vl_shader_build.h create mode 100644 src/gallium/drivers/softpipe/sp_video_context.c create mode 100644 src/gallium/drivers/softpipe/sp_video_context.h create mode 100644 src/gallium/include/pipe/p_video_context.h create mode 100644 src/gallium/include/pipe/p_video_state.h (limited to 'src') diff --git a/src/gallium/SConscript b/src/gallium/SConscript index 89c69d7205..8be84cddbe 100644 --- a/src/gallium/SConscript +++ b/src/gallium/SConscript @@ -23,6 +23,7 @@ SConscript([ 'auxiliary/pipebuffer/SConscript', 'auxiliary/indices/SConscript', 'auxiliary/rbug/SConscript', + 'auxiliary/vl/SConscript', ]) for driver in env['drivers']: diff --git a/src/gallium/auxiliary/vl/Makefile b/src/gallium/auxiliary/vl/Makefile new file mode 100644 index 0000000000..71bfb937ad --- /dev/null +++ b/src/gallium/auxiliary/vl/Makefile @@ -0,0 +1,12 @@ +TOP = ../../../.. +include $(TOP)/configs/current + +LIBNAME = vl + +C_SOURCES = \ + vl_bitstream_parser.c \ + vl_mpeg12_mc_renderer.c \ + vl_compositor.c \ + vl_shader_build.c + +include ../../Makefile.template diff --git a/src/gallium/auxiliary/vl/SConscript b/src/gallium/auxiliary/vl/SConscript new file mode 100644 index 0000000000..eb50940c35 --- /dev/null +++ b/src/gallium/auxiliary/vl/SConscript @@ -0,0 +1,12 @@ +Import('*') + +vl = env.ConvenienceLibrary( + target = 'vl', + source = [ + 'vl_bitstream_parser.c', + 'vl_mpeg12_mc_renderer.c', + 'vl_compositor.c', + 'vl_shader_build.c', + ]) + +auxiliaries.insert(0, vl) diff --git a/src/gallium/auxiliary/vl/vl_bitstream_parser.c b/src/gallium/auxiliary/vl/vl_bitstream_parser.c new file mode 100644 index 0000000000..356faa1348 --- /dev/null +++ b/src/gallium/auxiliary/vl/vl_bitstream_parser.c @@ -0,0 +1,144 @@ +#include "vl_bitstream_parser.h" +#include +#include +#include + +static unsigned +grab_bits(unsigned cursor, unsigned how_many_bits, unsigned bitstream_elt) +{ + unsigned excess_bits = sizeof(unsigned) * CHAR_BIT - how_many_bits - cursor; + + assert(cursor < sizeof(unsigned) * CHAR_BIT); + assert(how_many_bits > 0 && how_many_bits <= sizeof(unsigned) * CHAR_BIT); + assert(cursor + how_many_bits <= sizeof(unsigned) * CHAR_BIT); + + return (bitstream_elt << excess_bits) >> (excess_bits + cursor); +} + +static unsigned +show_bits(unsigned cursor, unsigned how_many_bits, const unsigned *bitstream) +{ + unsigned cur_int = cursor / (sizeof(unsigned) * CHAR_BIT); + unsigned cur_bit = cursor % (sizeof(unsigned) * CHAR_BIT); + + assert(bitstream); + + if (cur_bit + how_many_bits > sizeof(unsigned) * CHAR_BIT) + { + return grab_bits(cur_bit, sizeof(unsigned) * CHAR_BIT - cur_bit, + bitstream[cur_int]) | + grab_bits(0, cur_bit + how_many_bits - sizeof(unsigned) * CHAR_BIT, + bitstream[cur_int + 1]) << (sizeof(unsigned) * CHAR_BIT - cur_bit); + } + else + return grab_bits(cur_bit, how_many_bits, bitstream[cur_int]); +} + +bool vl_bitstream_parser_init(struct vl_bitstream_parser *parser, + unsigned num_bitstreams, + const void **bitstreams, + const unsigned *sizes) +{ + assert(parser); + assert(num_bitstreams); + assert(bitstreams); + assert(sizes); + + parser->num_bitstreams = num_bitstreams; + parser->bitstreams = (const unsigned**)bitstreams; + parser->sizes = sizes; + parser->cur_bitstream = 0; + parser->cursor = 0; + + return true; +} + +void vl_bitstream_parser_cleanup(struct vl_bitstream_parser *parser) +{ + assert(parser); +} + +unsigned +vl_bitstream_parser_get_bits(struct vl_bitstream_parser *parser, + unsigned how_many_bits) +{ + unsigned bits; + + assert(parser); + + bits = vl_bitstream_parser_show_bits(parser, how_many_bits); + + vl_bitstream_parser_forward(parser, how_many_bits); + + return bits; +} + +unsigned +vl_bitstream_parser_show_bits(struct vl_bitstream_parser *parser, + unsigned how_many_bits) +{ + unsigned bits = 0; + unsigned shift = 0; + unsigned cursor; + unsigned cur_bitstream; + + assert(parser); + + cursor = parser->cursor; + cur_bitstream = parser->cur_bitstream; + + while (1) + { + unsigned bits_left = parser->sizes[cur_bitstream] * CHAR_BIT - cursor; + unsigned bits_to_show = how_many_bits > bits_left ? bits_left : how_many_bits; + + bits |= show_bits(cursor, bits_to_show, + parser->bitstreams[cur_bitstream]) << shift; + + if (how_many_bits > bits_to_show) + { + how_many_bits -= bits_to_show; + cursor = 0; + ++cur_bitstream; + shift += bits_to_show; + } + else + break; + } + + return bits; +} + +void vl_bitstream_parser_forward(struct vl_bitstream_parser *parser, + unsigned how_many_bits) +{ + assert(parser); + assert(how_many_bits); + + parser->cursor += how_many_bits; + + while (parser->cursor > parser->sizes[parser->cur_bitstream] * CHAR_BIT) + { + parser->cursor -= parser->sizes[parser->cur_bitstream++] * CHAR_BIT; + assert(parser->cur_bitstream < parser->num_bitstreams); + } +} + +void vl_bitstream_parser_rewind(struct vl_bitstream_parser *parser, + unsigned how_many_bits) +{ + signed c; + + assert(parser); + assert(how_many_bits); + + c = parser->cursor - how_many_bits; + + while (c < 0) + { + c += parser->sizes[parser->cur_bitstream--] * CHAR_BIT; + assert(parser->cur_bitstream < parser->num_bitstreams); + } + + parser->cursor = (unsigned)c; +} diff --git a/src/gallium/auxiliary/vl/vl_bitstream_parser.h b/src/gallium/auxiliary/vl/vl_bitstream_parser.h new file mode 100644 index 0000000000..46bebf470f --- /dev/null +++ b/src/gallium/auxiliary/vl/vl_bitstream_parser.h @@ -0,0 +1,36 @@ +#ifndef vl_bitstream_parser_h +#define vl_bitstream_parser_h + +#include + +struct vl_bitstream_parser +{ + unsigned num_bitstreams; + const unsigned **bitstreams; + const unsigned *sizes; + unsigned cur_bitstream; + unsigned cursor; +}; + +bool vl_bitstream_parser_init(struct vl_bitstream_parser *parser, + unsigned num_bitstreams, + const void **bitstreams, + const unsigned *sizes); + +void vl_bitstream_parser_cleanup(struct vl_bitstream_parser *parser); + +unsigned +vl_bitstream_parser_get_bits(struct vl_bitstream_parser *parser, + unsigned how_many_bits); + +unsigned +vl_bitstream_parser_show_bits(struct vl_bitstream_parser *parser, + unsigned how_many_bits); + +void vl_bitstream_parser_forward(struct vl_bitstream_parser *parser, + unsigned how_many_bits); + +void vl_bitstream_parser_rewind(struct vl_bitstream_parser *parser, + unsigned how_many_bits); + +#endif /* vl_bitstream_parser_h */ diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c new file mode 100644 index 0000000000..0894421c0b --- /dev/null +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -0,0 +1,590 @@ +#include "vl_compositor.h" +#include +#include +#include +#include +#include +#include +#include "vl_shader_build.h" + +struct vertex2f +{ + float x, y; +}; + +struct vertex4f +{ + float x, y, z, w; +}; + +struct vertex_shader_consts +{ + struct vertex4f dst_scale; + struct vertex4f dst_trans; + struct vertex4f src_scale; + struct vertex4f src_trans; +}; + +struct fragment_shader_consts +{ + struct vertex4f bias; + float matrix[16]; +}; + +/* + * Represents 2 triangles in a strip in normalized coords. + * Used to render the surface onto the frame buffer. + */ +static const struct vertex2f surface_verts[4] = +{ + {0.0f, 0.0f}, + {0.0f, 1.0f}, + {1.0f, 0.0f}, + {1.0f, 1.0f} +}; + +/* + * Represents texcoords for the above. We can use the position values directly. + * TODO: Duplicate these in the shader, no need to create a buffer. + */ +static const struct vertex2f *surface_texcoords = surface_verts; + +/* + * Identity color conversion constants, for debugging + */ +static const struct fragment_shader_consts identity = +{ + { + 0.0f, 0.0f, 0.0f, 0.0f + }, + { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + } +}; + +/* + * Converts ITU-R BT.601 YCbCr pixels to RGB pixels where: + * Y is in [16,235], Cb and Cr are in [16,240] + * R, G, and B are in [16,235] + */ +static const struct fragment_shader_consts bt_601 = +{ + { + 0.0f, 0.501960784f, 0.501960784f, 0.0f + }, + { + 1.0f, 0.0f, 1.371f, 0.0f, + 1.0f, -0.336f, -0.698f, 0.0f, + 1.0f, 1.732f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + } +}; + +/* + * Converts ITU-R BT.601 YCbCr pixels to RGB pixels where: + * Y is in [16,235], Cb and Cr are in [16,240] + * R, G, and B are in [0,255] + */ +static const struct fragment_shader_consts bt_601_full = +{ + { + 0.062745098f, 0.501960784f, 0.501960784f, 0.0f + }, + { + 1.164f, 0.0f, 1.596f, 0.0f, + 1.164f, -0.391f, -0.813f, 0.0f, + 1.164f, 2.018f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + } +}; + +/* + * Converts ITU-R BT.709 YCbCr pixels to RGB pixels where: + * Y is in [16,235], Cb and Cr are in [16,240] + * R, G, and B are in [16,235] + */ +static const struct fragment_shader_consts bt_709 = +{ + { + 0.0f, 0.501960784f, 0.501960784f, 0.0f + }, + { + 1.0f, 0.0f, 1.540f, 0.0f, + 1.0f, -0.183f, -0.459f, 0.0f, + 1.0f, 1.816f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + } +}; + +/* + * Converts ITU-R BT.709 YCbCr pixels to RGB pixels where: + * Y is in [16,235], Cb and Cr are in [16,240] + * R, G, and B are in [0,255] + */ +const struct fragment_shader_consts bt_709_full = +{ + { + 0.062745098f, 0.501960784f, 0.501960784f, 0.0f + }, + { + 1.164f, 0.0f, 1.793f, 0.0f, + 1.164f, -0.213f, -0.534f, 0.0f, + 1.164f, 2.115f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f + } +}; + +static void +create_vert_shader(struct vl_compositor *c) +{ + const unsigned max_tokens = 50; + + struct pipe_shader_state vs; + struct tgsi_token *tokens; + struct tgsi_header *header; + + struct tgsi_full_declaration decl; + struct tgsi_full_instruction inst; + + unsigned ti; + + assert(c); + + tokens = (struct tgsi_token*)MALLOC(max_tokens * sizeof(struct tgsi_token)); + *(struct tgsi_version*)&tokens[0] = tgsi_build_version(); + header = (struct tgsi_header*)&tokens[1]; + *header = tgsi_build_header(); + *(struct tgsi_processor*)&tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_VERTEX, header); + + ti = 3; + + /* + * decl i0 ; Vertex pos + * decl i1 ; Vertex texcoords + */ + for (unsigned i = 0; i < 2; i++) + { + decl = vl_decl_input(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + } + + /* + * decl c0 ; Scaling vector to scale vertex pos rect to destination size + * decl c1 ; Translation vector to move vertex pos rect into position + * decl c2 ; Scaling vector to scale texcoord rect to source size + * decl c3 ; Translation vector to move texcoord rect into position + */ + decl = vl_decl_constants(TGSI_SEMANTIC_GENERIC, 0, 0, 3); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + + /* + * decl o0 ; Vertex pos + * decl o1 ; Vertex texcoords + */ + for (unsigned i = 0; i < 2; i++) + { + decl = vl_decl_output(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + } + + /* decl t0, t1 */ + decl = vl_decl_temps(0, 1); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + + /* + * mad o0, i0, c0, c1 ; Scale and translate unit output rect to destination size and pos + * mad o1, i1, c2, c3 ; Scale and translate unit texcoord rect to source size and pos + */ + for (unsigned i = 0; i < 2; ++i) + { + inst = vl_inst4(TGSI_OPCODE_MAD, TGSI_FILE_OUTPUT, i, TGSI_FILE_INPUT, i, TGSI_FILE_CONSTANT, i * 2, TGSI_FILE_CONSTANT, i * 2 + 1); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + } + + /* end */ + inst = vl_end(); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + + assert(ti <= max_tokens); + + vs.tokens = tokens; + c->vertex_shader = c->pipe->create_vs_state(c->pipe, &vs); + FREE(tokens); +} + +static void +create_frag_shader(struct vl_compositor *c) +{ + const unsigned max_tokens = 50; + + struct pipe_shader_state fs; + struct tgsi_token *tokens; + struct tgsi_header *header; + + struct tgsi_full_declaration decl; + struct tgsi_full_instruction inst; + + unsigned ti; + + assert(c); + + tokens = (struct tgsi_token*)MALLOC(max_tokens * sizeof(struct tgsi_token)); + *(struct tgsi_version*)&tokens[0] = tgsi_build_version(); + header = (struct tgsi_header*)&tokens[1]; + *header = tgsi_build_header(); + *(struct tgsi_processor*)&tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_FRAGMENT, header); + + ti = 3; + + /* decl i0 ; Texcoords for s0 */ + decl = vl_decl_interpolated_input(TGSI_SEMANTIC_GENERIC, 1, 0, 0, TGSI_INTERPOLATE_LINEAR); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + + /* + * decl c0 ; Bias vector for CSC + * decl c1-c4 ; CSC matrix c1-c4 + */ + decl = vl_decl_constants(TGSI_SEMANTIC_GENERIC, 0, 0, 4); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + + /* decl o0 ; Fragment color */ + decl = vl_decl_output(TGSI_SEMANTIC_COLOR, 0, 0, 0); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + + /* decl t0 */ + decl = vl_decl_temps(0, 0); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + + /* decl s0 ; Sampler for tex containing picture to display */ + decl = vl_decl_samplers(0, 0); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + + /* tex2d t0, i0, s0 ; Read src pixel */ + inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_INPUT, 0, TGSI_FILE_SAMPLER, 0); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + + /* sub t0, t0, c0 ; Subtract bias vector from pixel */ + inst = vl_inst3(TGSI_OPCODE_SUB, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_CONSTANT, 0); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + + /* + * dp4 o0.x, t0, c1 ; Multiply pixel by the color conversion matrix + * dp4 o0.y, t0, c2 + * dp4 o0.z, t0, c3 + */ + for (unsigned i = 0; i < 3; ++i) + { + inst = vl_inst3(TGSI_OPCODE_DP4, TGSI_FILE_OUTPUT, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_CONSTANT, i + 1); + inst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + } + + /* end */ + inst = vl_end(); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + + assert(ti <= max_tokens); + + fs.tokens = tokens; + c->fragment_shader = c->pipe->create_fs_state(c->pipe, &fs); + FREE(tokens); +} + +static bool +init_pipe_state(struct vl_compositor *c) +{ + struct pipe_sampler_state sampler; + + assert(c); + + c->fb_state.nr_cbufs = 1; + c->fb_state.zsbuf = NULL; + + 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_img_filter = PIPE_TEX_FILTER_LINEAR; + sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE; + sampler.mag_img_filter = PIPE_TEX_FILTER_LINEAR; + sampler.compare_mode = PIPE_TEX_COMPARE_NONE; + sampler.compare_func = PIPE_FUNC_ALWAYS; + sampler.normalized_coords = 1; + /*sampler.prefilter = ;*/ + /*sampler.lod_bias = ;*/ + /*sampler.min_lod = ;*/ + /*sampler.max_lod = ;*/ + /*sampler.border_color[i] = ;*/ + /*sampler.max_anisotropy = ;*/ + c->sampler = c->pipe->create_sampler_state(c->pipe, &sampler); + + return true; +} + +static void cleanup_pipe_state(struct vl_compositor *c) +{ + assert(c); + + c->pipe->delete_sampler_state(c->pipe, c->sampler); +} + +static bool +init_shaders(struct vl_compositor *c) +{ + assert(c); + + create_vert_shader(c); + create_frag_shader(c); + + return true; +} + +static void cleanup_shaders(struct vl_compositor *c) +{ + assert(c); + + c->pipe->delete_vs_state(c->pipe, c->vertex_shader); + c->pipe->delete_fs_state(c->pipe, c->fragment_shader); +} + +static bool +init_buffers(struct vl_compositor *c) +{ + assert(c); + + /* + * Create our vertex buffer and vertex buffer element + * VB contains 4 vertices that render a quad covering the entire window + * to display a rendered surface + * Quad is rendered as a tri strip + */ + c->vertex_bufs[0].stride = sizeof(struct vertex2f); + c->vertex_bufs[0].max_index = 3; + c->vertex_bufs[0].buffer_offset = 0; + c->vertex_bufs[0].buffer = pipe_buffer_create + ( + c->pipe->screen, + 1, + PIPE_BUFFER_USAGE_VERTEX, + sizeof(struct vertex2f) * 4 + ); + + memcpy + ( + pipe_buffer_map(c->pipe->screen, c->vertex_bufs[0].buffer, PIPE_BUFFER_USAGE_CPU_WRITE), + surface_verts, + sizeof(struct vertex2f) * 4 + ); + + pipe_buffer_unmap(c->pipe->screen, c->vertex_bufs[0].buffer); + + c->vertex_elems[0].src_offset = 0; + c->vertex_elems[0].vertex_buffer_index = 0; + c->vertex_elems[0].nr_components = 2; + c->vertex_elems[0].src_format = PIPE_FORMAT_R32G32_FLOAT; + + /* + * Create our texcoord buffer and texcoord buffer element + * Texcoord buffer contains the TCs for mapping the rendered surface to the 4 vertices + */ + c->vertex_bufs[1].stride = sizeof(struct vertex2f); + c->vertex_bufs[1].max_index = 3; + c->vertex_bufs[1].buffer_offset = 0; + c->vertex_bufs[1].buffer = pipe_buffer_create + ( + c->pipe->screen, + 1, + PIPE_BUFFER_USAGE_VERTEX, + sizeof(struct vertex2f) * 4 + ); + + memcpy + ( + pipe_buffer_map(c->pipe->screen, c->vertex_bufs[1].buffer, PIPE_BUFFER_USAGE_CPU_WRITE), + surface_texcoords, + sizeof(struct vertex2f) * 4 + ); + + pipe_buffer_unmap(c->pipe->screen, c->vertex_bufs[1].buffer); + + c->vertex_elems[1].src_offset = 0; + c->vertex_elems[1].vertex_buffer_index = 1; + c->vertex_elems[1].nr_components = 2; + c->vertex_elems[1].src_format = PIPE_FORMAT_R32G32_FLOAT; + + /* + * Create our vertex shader's constant buffer + * Const buffer contains scaling and translation vectors + */ + c->vs_const_buf.buffer = pipe_buffer_create + ( + c->pipe->screen, + 1, + PIPE_BUFFER_USAGE_CONSTANT | PIPE_BUFFER_USAGE_DISCARD, + sizeof(struct vertex_shader_consts) + ); + + /* + * Create our fragment shader's constant buffer + * Const buffer contains the color conversion matrix and bias vectors + */ + c->fs_const_buf.buffer = pipe_buffer_create + ( + c->pipe->screen, + 1, + PIPE_BUFFER_USAGE_CONSTANT, + sizeof(struct fragment_shader_consts) + ); + + /* + * TODO: Refactor this into a seperate function, + * allow changing the CSC matrix at runtime to switch between regular & full versions + */ + memcpy + ( + pipe_buffer_map(c->pipe->screen, c->fs_const_buf.buffer, PIPE_BUFFER_USAGE_CPU_WRITE), + &bt_601_full, + sizeof(struct fragment_shader_consts) + ); + + pipe_buffer_unmap(c->pipe->screen, c->fs_const_buf.buffer); + + return true; +} + +static void +cleanup_buffers(struct vl_compositor *c) +{ + assert(c); + + for (unsigned i = 0; i < 2; ++i) + pipe_buffer_reference(&c->vertex_bufs[i].buffer, NULL); + + pipe_buffer_reference(&c->vs_const_buf.buffer, NULL); + pipe_buffer_reference(&c->fs_const_buf.buffer, NULL); +} + +bool vl_compositor_init(struct vl_compositor *compositor, struct pipe_context *pipe) +{ + assert(compositor); + + memset(compositor, 0, sizeof(struct vl_compositor)); + + compositor->pipe = pipe; + + if (!init_pipe_state(compositor)) + return false; + if (!init_shaders(compositor)) + { + cleanup_pipe_state(compositor); + return false; + } + if (!init_buffers(compositor)) + { + cleanup_shaders(compositor); + cleanup_pipe_state(compositor); + return false; + } + + return true; +} + +void vl_compositor_cleanup(struct vl_compositor *compositor) +{ + assert(compositor); + + cleanup_buffers(compositor); + cleanup_shaders(compositor); + cleanup_pipe_state(compositor); +} + +void vl_compositor_render(struct vl_compositor *compositor, + /*struct pipe_texture *backround, + struct pipe_video_rect *backround_area,*/ + struct pipe_texture *src_surface, + enum pipe_mpeg12_picture_type picture_type, + /*unsigned num_past_surfaces, + struct pipe_texture *past_surfaces, + unsigned num_future_surfaces, + struct pipe_texture *future_surfaces,*/ + struct pipe_video_rect *src_area, + struct pipe_texture *dst_surface, + struct pipe_video_rect *dst_area, + /*unsigned num_layers, + struct pipe_texture *layers, + struct pipe_video_rect *layer_src_areas, + struct pipe_video_rect *layer_dst_areas*/ + struct pipe_fence_handle **fence) +{ + struct vertex_shader_consts *vs_consts; + + assert(compositor); + assert(src_surface); + assert(src_area); + assert(dst_surface); + assert(dst_area); + assert(picture_type == PIPE_MPEG12_PICTURE_TYPE_FRAME); + + compositor->fb_state.width = dst_surface->width[0]; + compositor->fb_state.height = dst_surface->height[0]; + compositor->fb_state.cbufs[0] = compositor->pipe->screen->get_tex_surface + ( + compositor->pipe->screen, + dst_surface, + 0, 0, 0, PIPE_BUFFER_USAGE_GPU_READ | PIPE_BUFFER_USAGE_GPU_WRITE + ); + + compositor->viewport.scale[0] = compositor->fb_state.width; + compositor->viewport.scale[1] = compositor->fb_state.height; + compositor->viewport.scale[2] = 1; + compositor->viewport.scale[3] = 1; + compositor->viewport.translate[0] = 0; + compositor->viewport.translate[1] = 0; + compositor->viewport.translate[2] = 0; + compositor->viewport.translate[3] = 0; + + compositor->pipe->set_framebuffer_state(compositor->pipe, &compositor->fb_state); + compositor->pipe->set_viewport_state(compositor->pipe, &compositor->viewport); + compositor->pipe->bind_sampler_states(compositor->pipe, 1, &compositor->sampler); + compositor->pipe->set_sampler_textures(compositor->pipe, 1, &src_surface); + compositor->pipe->bind_vs_state(compositor->pipe, compositor->vertex_shader); + compositor->pipe->bind_fs_state(compositor->pipe, compositor->fragment_shader); + compositor->pipe->set_vertex_buffers(compositor->pipe, 2, compositor->vertex_bufs); + compositor->pipe->set_vertex_elements(compositor->pipe, 2, compositor->vertex_elems); + compositor->pipe->set_constant_buffer(compositor->pipe, PIPE_SHADER_VERTEX, 0, &compositor->vs_const_buf); + compositor->pipe->set_constant_buffer(compositor->pipe, PIPE_SHADER_FRAGMENT, 0, &compositor->fs_const_buf); + + vs_consts = pipe_buffer_map + ( + compositor->pipe->screen, + compositor->vs_const_buf.buffer, + PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_DISCARD + ); + + vs_consts->dst_scale.x = dst_area->w / (float)compositor->fb_state.cbufs[0]->width; + vs_consts->dst_scale.y = dst_area->h / (float)compositor->fb_state.cbufs[0]->height; + vs_consts->dst_scale.z = 1; + vs_consts->dst_scale.w = 1; + vs_consts->dst_trans.x = dst_area->x / (float)compositor->fb_state.cbufs[0]->width; + vs_consts->dst_trans.y = dst_area->y / (float)compositor->fb_state.cbufs[0]->height; + vs_consts->dst_trans.z = 0; + vs_consts->dst_trans.w = 0; + + vs_consts->src_scale.x = src_area->w / (float)src_surface->width[0]; + vs_consts->src_scale.y = src_area->h / (float)src_surface->height[0]; + vs_consts->src_scale.z = 1; + vs_consts->src_scale.w = 1; + vs_consts->src_trans.x = src_area->x / (float)src_surface->width[0]; + vs_consts->src_trans.y = src_area->y / (float)src_surface->height[0]; + vs_consts->src_trans.z = 0; + vs_consts->src_trans.w = 0; + + pipe_buffer_unmap(compositor->pipe->screen, compositor->vs_const_buf.buffer); + + compositor->pipe->draw_arrays(compositor->pipe, PIPE_PRIM_TRIANGLE_STRIP, 0, 4); + compositor->pipe->flush(compositor->pipe, PIPE_FLUSH_RENDER_CACHE, fence); + + pipe_surface_reference(&compositor->fb_state.cbufs[0], NULL); +} diff --git a/src/gallium/auxiliary/vl/vl_compositor.h b/src/gallium/auxiliary/vl/vl_compositor.h new file mode 100644 index 0000000000..2af41e1981 --- /dev/null +++ b/src/gallium/auxiliary/vl/vl_compositor.h @@ -0,0 +1,47 @@ +#ifndef vl_compositor_h +#define vl_compositor_h + +#include +#include +#include + +struct pipe_context; +struct pipe_texture; + +struct vl_compositor +{ + struct pipe_context *pipe; + + struct pipe_framebuffer_state fb_state; + void *sampler; + void *vertex_shader; + void *fragment_shader; + struct pipe_viewport_state viewport; + struct pipe_vertex_buffer vertex_bufs[2]; + struct pipe_vertex_element vertex_elems[2]; + struct pipe_constant_buffer vs_const_buf, fs_const_buf; +}; + +bool vl_compositor_init(struct vl_compositor *compositor, struct pipe_context *pipe); + +void vl_compositor_cleanup(struct vl_compositor *compositor); + +void vl_compositor_render(struct vl_compositor *compositor, + /*struct pipe_texture *backround, + struct pipe_video_rect *backround_area,*/ + struct pipe_texture *src_surface, + enum pipe_mpeg12_picture_type picture_type, + /*unsigned num_past_surfaces, + struct pipe_texture *past_surfaces, + unsigned num_future_surfaces, + struct pipe_texture *future_surfaces,*/ + struct pipe_video_rect *src_area, + struct pipe_texture *dst_surface, + struct pipe_video_rect *dst_area, + /*unsigned num_layers, + struct pipe_texture *layers, + struct pipe_video_rect *layer_src_areas, + struct pipe_video_rect *layer_dst_areas,*/ + struct pipe_fence_handle **fence); + +#endif /* vl_compositor_h */ diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c new file mode 100644 index 0000000000..7e73c5ced9 --- /dev/null +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -0,0 +1,1662 @@ +#include "vl_mpeg12_mc_renderer.h" +#include +#include +#include +#include +#include +#include +#include +#include "vl_shader_build.h" + +#define DEFAULT_BUF_ALIGNMENT 1 +#define MACROBLOCK_WIDTH 16 +#define MACROBLOCK_HEIGHT 16 +#define BLOCK_WIDTH 8 +#define BLOCK_HEIGHT 8 +#define ZERO_BLOCK_NIL -1.0f +#define ZERO_BLOCK_IS_NIL(zb) ((zb).x < 0.0f) + +struct vertex2f +{ + float x, y; +}; + +struct vertex4f +{ + float x, y, z, w; +}; + +struct vertex_shader_consts +{ + struct vertex4f denorm; +}; + +struct fragment_shader_consts +{ + struct vertex4f multiplier; + struct vertex4f div; +}; + +/* + * Muliplier renormalizes block samples from 16 bits to 12 bits. + * Divider is used when calculating Y % 2 for choosing top or bottom + * field for P or B macroblocks. + * TODO: Use immediates. + */ +static const struct fragment_shader_consts fs_consts = { + {32767.0f / 255.0f, 32767.0f / 255.0f, 32767.0f / 255.0f, 0.0f}, + {0.5f, 2.0f, 0.0f, 0.0f} +}; + +struct vert_stream_0 +{ + struct vertex2f pos; + struct vertex2f luma_tc; + struct vertex2f cb_tc; + struct vertex2f cr_tc; +}; + +enum MACROBLOCK_TYPE +{ + MACROBLOCK_TYPE_INTRA, + MACROBLOCK_TYPE_FWD_FRAME_PRED, + MACROBLOCK_TYPE_FWD_FIELD_PRED, + MACROBLOCK_TYPE_BKWD_FRAME_PRED, + MACROBLOCK_TYPE_BKWD_FIELD_PRED, + MACROBLOCK_TYPE_BI_FRAME_PRED, + MACROBLOCK_TYPE_BI_FIELD_PRED, + + NUM_MACROBLOCK_TYPES +}; + +static void +create_intra_vert_shader(struct vl_mpeg12_mc_renderer *r) +{ + const unsigned max_tokens = 50; + + struct pipe_shader_state vs; + struct tgsi_token *tokens; + struct tgsi_header *header; + + struct tgsi_full_declaration decl; + struct tgsi_full_instruction inst; + + unsigned ti; + + assert(r); + + tokens = (struct tgsi_token *) malloc(max_tokens * sizeof(struct tgsi_token)); + *(struct tgsi_version *) &tokens[0] = tgsi_build_version(); + header = (struct tgsi_header *) &tokens[1]; + *header = tgsi_build_header(); + *(struct tgsi_processor *) &tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_VERTEX, header); + + ti = 3; + + /* + * decl i0 ; Vertex pos + * decl i1 ; Luma texcoords + * decl i2 ; Chroma Cb texcoords + * decl i3 ; Chroma Cr texcoords + */ + for (unsigned i = 0; i < 4; i++) + { + decl = vl_decl_input(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + } + + /* + * decl o0 ; Vertex pos + * decl o1 ; Luma texcoords + * decl o2 ; Chroma Cb texcoords + * decl o3 ; Chroma Cr texcoords + */ + for (unsigned i = 0; i < 4; i++) + { + decl = vl_decl_output(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + } + + /* + * mov o0, i0 ; Move input vertex pos to output + * mov o1, i1 ; Move input luma texcoords to output + * mov o2, i2 ; Move input chroma Cb texcoords to output + * mov o3, i3 ; Move input chroma Cr texcoords to output + */ + for (unsigned i = 0; i < 4; ++i) + { + inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_OUTPUT, i, TGSI_FILE_INPUT, i); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + } + + /* end */ + inst = vl_end(); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + + assert(ti <= max_tokens); + + vs.tokens = tokens; + r->i_vs = r->pipe->create_vs_state(r->pipe, &vs); + free(tokens); +} + +static void +create_intra_frag_shader(struct vl_mpeg12_mc_renderer *r) +{ + const unsigned max_tokens = 100; + + struct pipe_shader_state fs; + struct tgsi_token *tokens; + struct tgsi_header *header; + + struct tgsi_full_declaration decl; + struct tgsi_full_instruction inst; + + unsigned ti; + + assert(r); + + tokens = (struct tgsi_token *) malloc(max_tokens * sizeof(struct tgsi_token)); + *(struct tgsi_version *) &tokens[0] = tgsi_build_version(); + header = (struct tgsi_header *) &tokens[1]; + *header = tgsi_build_header(); + *(struct tgsi_processor *) &tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_FRAGMENT, header); + + ti = 3; + + /* + * decl i0 ; Luma texcoords + * decl i1 ; Chroma Cb texcoords + * decl i2 ; Chroma Cr texcoords + */ + for (unsigned i = 0; i < 3; ++i) + { + decl = vl_decl_interpolated_input(TGSI_SEMANTIC_GENERIC, i + 1, i, i, TGSI_INTERPOLATE_LINEAR); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + } + + /* decl c0 ; Scaling factor, rescales 16-bit snorm to 9-bit snorm */ + decl = vl_decl_constants(TGSI_SEMANTIC_GENERIC, 0, 0, 0); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + + /* decl o0 ; Fragment color */ + decl = vl_decl_output(TGSI_SEMANTIC_COLOR, 0, 0, 0); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + + /* decl t0, t1 */ + decl = vl_decl_temps(0, 1); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + + /* + * decl s0 ; Sampler for luma texture + * decl s1 ; Sampler for chroma Cb texture + * decl s2 ; Sampler for chroma Cr texture + */ + for (unsigned i = 0; i < 3; ++i) + { + decl = vl_decl_samplers(i, i); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + } + + /* + * tex2d t1, i0, s0 ; Read texel from luma texture + * mov t0.x, t1.x ; Move luma sample into .x component + * tex2d t1, i1, s1 ; Read texel from chroma Cb texture + * mov t0.y, t1.x ; Move Cb sample into .y component + * tex2d t1, i2, s2 ; Read texel from chroma Cr texture + * mov t0.z, t1.x ; Move Cr sample into .z component + */ + for (unsigned i = 0; i < 3; ++i) + { + inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_INPUT, i, TGSI_FILE_SAMPLER, i); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + + inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1); + inst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; + inst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; + inst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; + inst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + } + + /* mul o0, t0, c0 ; Rescale texel to correct range */ + inst = vl_inst3(TGSI_OPCODE_MUL, TGSI_FILE_OUTPUT, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_CONSTANT, 0); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + + /* end */ + inst = vl_end(); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + + assert(ti <= max_tokens); + + fs.tokens = tokens; + r->i_fs = r->pipe->create_fs_state(r->pipe, &fs); + free(tokens); +} + +static void +create_frame_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) +{ + const unsigned max_tokens = 100; + + struct pipe_shader_state vs; + struct tgsi_token *tokens; + struct tgsi_header *header; + + struct tgsi_full_declaration decl; + struct tgsi_full_instruction inst; + + unsigned ti; + + assert(r); + + tokens = (struct tgsi_token *) malloc(max_tokens * sizeof(struct tgsi_token)); + *(struct tgsi_version *) &tokens[0] = tgsi_build_version(); + header = (struct tgsi_header *) &tokens[1]; + *header = tgsi_build_header(); + *(struct tgsi_processor *) &tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_VERTEX, header); + + ti = 3; + + /* + * decl i0 ; Vertex pos + * decl i1 ; Luma texcoords + * decl i2 ; Chroma Cb texcoords + * decl i3 ; Chroma Cr texcoords + * decl i4 ; Ref surface top field texcoords + * decl i5 ; Ref surface bottom field texcoords (unused, packed in the same stream) + */ + for (unsigned i = 0; i < 6; i++) + { + decl = vl_decl_input(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + } + + /* + * decl o0 ; Vertex pos + * decl o1 ; Luma texcoords + * decl o2 ; Chroma Cb texcoords + * decl o3 ; Chroma Cr texcoords + * decl o4 ; Ref macroblock texcoords + */ + for (unsigned i = 0; i < 5; i++) + { + decl = vl_decl_output(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + } + + /* + * mov o0, i0 ; Move input vertex pos to output + * mov o1, i1 ; Move input luma texcoords to output + * mov o2, i2 ; Move input chroma Cb texcoords to output + * mov o3, i3 ; Move input chroma Cr texcoords to output + */ + for (unsigned i = 0; i < 4; ++i) + { + inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_OUTPUT, i, TGSI_FILE_INPUT, i); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + } + + /* add o4, i0, i4 ; Translate vertex pos by motion vec to form ref macroblock texcoords */ + inst = vl_inst3(TGSI_OPCODE_ADD, TGSI_FILE_OUTPUT, 4, TGSI_FILE_INPUT, 0, TGSI_FILE_INPUT, 4); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + + /* end */ + inst = vl_end(); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + + assert(ti <= max_tokens); + + vs.tokens = tokens; + r->p_vs[0] = r->pipe->create_vs_state(r->pipe, &vs); + free(tokens); +} + +static void +create_field_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) +{ + assert(false); +} + +static void +create_frame_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) +{ + const unsigned max_tokens = 100; + + struct pipe_shader_state fs; + struct tgsi_token *tokens; + struct tgsi_header *header; + + struct tgsi_full_declaration decl; + struct tgsi_full_instruction inst; + + unsigned ti; + + assert(r); + + tokens = (struct tgsi_token *) malloc(max_tokens * sizeof(struct tgsi_token)); + *(struct tgsi_version *) &tokens[0] = tgsi_build_version(); + header = (struct tgsi_header *) &tokens[1]; + *header = tgsi_build_header(); + *(struct tgsi_processor *) &tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_FRAGMENT, header); + + ti = 3; + + /* + * decl i0 ; Luma texcoords + * decl i1 ; Chroma Cb texcoords + * decl i2 ; Chroma Cr texcoords + * decl i3 ; Ref macroblock texcoords + */ + for (unsigned i = 0; i < 4; ++i) + { + decl = vl_decl_interpolated_input(TGSI_SEMANTIC_GENERIC, i + 1, i, i, TGSI_INTERPOLATE_LINEAR); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + } + + /* decl c0 ; Scaling factor, rescales 16-bit snorm to 9-bit snorm */ + decl = vl_decl_constants(TGSI_SEMANTIC_GENERIC, 0, 0, 0); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + + /* decl o0 ; Fragment color */ + decl = vl_decl_output(TGSI_SEMANTIC_COLOR, 0, 0, 0); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + + /* decl t0, t1 */ + decl = vl_decl_temps(0, 1); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + + /* + * decl s0 ; Sampler for luma texture + * decl s1 ; Sampler for chroma Cb texture + * decl s2 ; Sampler for chroma Cr texture + * decl s3 ; Sampler for ref surface texture + */ + for (unsigned i = 0; i < 4; ++i) + { + decl = vl_decl_samplers(i, i); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + } + + /* + * tex2d t1, i0, s0 ; Read texel from luma texture + * mov t0.x, t1.x ; Move luma sample into .x component + * tex2d t1, i1, s1 ; Read texel from chroma Cb texture + * mov t0.y, t1.x ; Move Cb sample into .y component + * tex2d t1, i2, s2 ; Read texel from chroma Cr texture + * mov t0.z, t1.x ; Move Cr sample into .z component + */ + for (unsigned i = 0; i < 3; ++i) + { + inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_INPUT, i, TGSI_FILE_SAMPLER, i); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + + inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1); + inst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; + inst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; + inst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; + inst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + } + + /* mul t0, t0, c0 ; Rescale texel to correct range */ + inst = vl_inst3(TGSI_OPCODE_MUL, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_CONSTANT, 0); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + + /* tex2d t1, i3, s3 ; Read texel from ref macroblock */ + inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_INPUT, 3, TGSI_FILE_SAMPLER, 3); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + + /* add o0, t0, t1 ; Add ref and differential to form final output */ + inst = vl_inst3(TGSI_OPCODE_ADD, TGSI_FILE_OUTPUT, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + + /* end */ + inst = vl_end(); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + + assert(ti <= max_tokens); + + fs.tokens = tokens; + r->p_fs[0] = r->pipe->create_fs_state(r->pipe, &fs); + free(tokens); +} + +static void +create_field_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) +{ + assert(false); +} + +static void +create_frame_bi_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) +{ + const unsigned max_tokens = 100; + + struct pipe_shader_state vs; + struct tgsi_token *tokens; + struct tgsi_header *header; + + struct tgsi_full_declaration decl; + struct tgsi_full_instruction inst; + + unsigned ti; + + assert(r); + + tokens = (struct tgsi_token *) malloc(max_tokens * sizeof(struct tgsi_token)); + *(struct tgsi_version *) &tokens[0] = tgsi_build_version(); + header = (struct tgsi_header *) &tokens[1]; + *header = tgsi_build_header(); + *(struct tgsi_processor *) &tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_VERTEX, header); + + ti = 3; + + /* + * decl i0 ; Vertex pos + * decl i1 ; Luma texcoords + * decl i2 ; Chroma Cb texcoords + * decl i3 ; Chroma Cr texcoords + * decl i4 ; First ref macroblock top field texcoords + * decl i5 ; First ref macroblock bottom field texcoords (unused, packed in the same stream) + * decl i6 ; Second ref macroblock top field texcoords + * decl i7 ; Second ref macroblock bottom field texcoords (unused, packed in the same stream) + */ + for (unsigned i = 0; i < 8; i++) + { + decl = vl_decl_input(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + } + + /* + * decl o0 ; Vertex pos + * decl o1 ; Luma texcoords + * decl o2 ; Chroma Cb texcoords + * decl o3 ; Chroma Cr texcoords + * decl o4 ; First ref macroblock texcoords + * decl o5 ; Second ref macroblock texcoords + */ + for (unsigned i = 0; i < 6; i++) + { + decl = vl_decl_output(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + } + + /* + * mov o0, i0 ; Move input vertex pos to output + * mov o1, i1 ; Move input luma texcoords to output + * mov o2, i2 ; Move input chroma Cb texcoords to output + * mov o3, i3 ; Move input chroma Cr texcoords to output + */ + for (unsigned i = 0; i < 4; ++i) + { + inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_OUTPUT, i, TGSI_FILE_INPUT, i); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + } + + /* + * add o4, i0, i4 ; Translate vertex pos by motion vec to form first ref macroblock texcoords + * add o5, i0, i6 ; Translate vertex pos by motion vec to form second ref macroblock texcoords + */ + for (unsigned i = 0; i < 2; ++i) + { + inst = vl_inst3(TGSI_OPCODE_ADD, TGSI_FILE_OUTPUT, i + 4, TGSI_FILE_INPUT, 0, TGSI_FILE_INPUT, (i + 2) * 2); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + } + + /* end */ + inst = vl_end(); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + + assert(ti <= max_tokens); + + vs.tokens = tokens; + r->b_vs[0] = r->pipe->create_vs_state(r->pipe, &vs); + free(tokens); +} + +static void +create_field_bi_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) +{ + assert(false); +} + +static void +create_frame_bi_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) +{ + const unsigned max_tokens = 100; + + struct pipe_shader_state fs; + struct tgsi_token *tokens; + struct tgsi_header *header; + + struct tgsi_full_declaration decl; + struct tgsi_full_instruction inst; + + unsigned ti; + + assert(r); + + tokens = (struct tgsi_token *) malloc(max_tokens * sizeof(struct tgsi_token)); + *(struct tgsi_version *) &tokens[0] = tgsi_build_version(); + header = (struct tgsi_header *) &tokens[1]; + *header = tgsi_build_header(); + *(struct tgsi_processor *) &tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_FRAGMENT, header); + + ti = 3; + + /* + * decl i0 ; Luma texcoords + * decl i1 ; Chroma Cb texcoords + * decl i2 ; Chroma Cr texcoords + * decl i3 ; First ref macroblock texcoords + * decl i4 ; Second ref macroblock texcoords + */ + for (unsigned i = 0; i < 5; ++i) + { + decl = vl_decl_interpolated_input(TGSI_SEMANTIC_GENERIC, i + 1, i, i, TGSI_INTERPOLATE_LINEAR); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + } + + /* + * decl c0 ; Scaling factor, rescales 16-bit snorm to 9-bit snorm + * decl c1 ; Constant 1/2 in .x channel to use as weight to blend past and future texels + */ + decl = vl_decl_constants(TGSI_SEMANTIC_GENERIC, 0, 0, 1); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + + /* decl o0 ; Fragment color */ + decl = vl_decl_output(TGSI_SEMANTIC_COLOR, 0, 0, 0); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + + /* decl t0-t2 */ + decl = vl_decl_temps(0, 2); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + + /* + * decl s0 ; Sampler for luma texture + * decl s1 ; Sampler for chroma Cb texture + * decl s2 ; Sampler for chroma Cr texture + * decl s3 ; Sampler for first ref surface texture + * decl s4 ; Sampler for second ref surface texture + */ + for (unsigned i = 0; i < 5; ++i) + { + decl = vl_decl_samplers(i, i); + ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); + } + + /* + * tex2d t1, i0, s0 ; Read texel from luma texture + * mov t0.x, t1.x ; Move luma sample into .x component + * tex2d t1, i1, s1 ; Read texel from chroma Cb texture + * mov t0.y, t1.x ; Move Cb sample into .y component + * tex2d t1, i2, s2 ; Read texel from chroma Cr texture + * mov t0.z, t1.x ; Move Cr sample into .z component + */ + for (unsigned i = 0; i < 3; ++i) + { + inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_INPUT, i, TGSI_FILE_SAMPLER, i); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + + inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1); + inst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; + inst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; + inst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; + inst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + } + + /* mul t0, t0, c0 ; Rescale texel to correct range */ + inst = vl_inst3(TGSI_OPCODE_MUL, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_CONSTANT, 0); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + + /* + * tex2d t1, i3, s3 ; Read texel from first ref macroblock + * tex2d t2, i4, s4 ; Read texel from second ref macroblock + */ + for (unsigned i = 0; i < 2; ++i) + { + inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, i + 1, TGSI_FILE_INPUT, i + 3, TGSI_FILE_SAMPLER, i + 3); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + } + + /* lerp t1, c1.x, t1, t2 ; Blend past and future texels */ + inst = vl_inst4(TGSI_OPCODE_LRP, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_CONSTANT, 1, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_TEMPORARY, 2); + inst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; + inst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; + inst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; + inst.FullSrcRegisters[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_X; + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + + /* add o0, t0, t1 ; Add past/future ref and differential to form final output */ + inst = vl_inst3(TGSI_OPCODE_ADD, TGSI_FILE_OUTPUT, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + + /* end */ + inst = vl_end(); + ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); + + assert(ti <= max_tokens); + + fs.tokens = tokens; + r->b_fs[0] = r->pipe->create_fs_state(r->pipe, &fs); + free(tokens); +} + +static void +create_field_bi_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) +{ + assert(false); +} + +static void +xfer_buffers_map(struct vl_mpeg12_mc_renderer *r) +{ + assert(r); + + for (unsigned i = 0; i < 3; ++i) + { + r->tex_transfer[i] = r->pipe->screen->get_tex_transfer + ( + r->pipe->screen, r->textures.all[i], + 0, 0, 0, PIPE_TRANSFER_WRITE, 0, 0, + r->textures.all[i]->width[0], r->textures.all[i]->height[0] + ); + + r->texels[i] = r->pipe->screen->transfer_map(r->pipe->screen, r->tex_transfer[i]); + } +} + +static void +xfer_buffers_unmap(struct vl_mpeg12_mc_renderer *r) +{ + assert(r); + + for (unsigned i = 0; i < 3; ++i) + { + r->pipe->screen->transfer_unmap(r->pipe->screen, r->tex_transfer[i]); + r->pipe->screen->tex_transfer_destroy(r->tex_transfer[i]); + } +} + +static bool +init_pipe_state(struct vl_mpeg12_mc_renderer *r) +{ + struct pipe_sampler_state sampler; + unsigned filters[5]; + + assert(r); + + r->viewport.scale[0] = r->pot_buffers ? + util_next_power_of_two(r->picture_width) : r->picture_width; + r->viewport.scale[1] = r->pot_buffers ? + util_next_power_of_two(r->picture_height) : r->picture_height; + r->viewport.scale[2] = 1; + r->viewport.scale[3] = 1; + r->viewport.translate[0] = 0; + r->viewport.translate[1] = 0; + r->viewport.translate[2] = 0; + r->viewport.translate[3] = 0; + + r->fb_state.width = r->pot_buffers ? + util_next_power_of_two(r->picture_width) : r->picture_width; + r->fb_state.height = r->pot_buffers ? + util_next_power_of_two(r->picture_height) : r->picture_height; + r->fb_state.nr_cbufs = 1; + r->fb_state.zsbuf = NULL; + + /* Luma filter */ + filters[0] = PIPE_TEX_FILTER_NEAREST; + /* Chroma filters */ + if (r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_444 || + r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE) + { + filters[1] = PIPE_TEX_FILTER_NEAREST; + filters[2] = PIPE_TEX_FILTER_NEAREST; + } + else + { + filters[1] = PIPE_TEX_FILTER_LINEAR; + filters[2] = PIPE_TEX_FILTER_LINEAR; + } + /* Fwd, bkwd ref filters */ + filters[3] = PIPE_TEX_FILTER_LINEAR; + filters[4] = PIPE_TEX_FILTER_LINEAR; + + for (unsigned i = 0; i < 5; ++i) + { + 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_img_filter = filters[i]; + sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE; + sampler.mag_img_filter = filters[i]; + sampler.compare_mode = PIPE_TEX_COMPARE_NONE; + sampler.compare_func = PIPE_FUNC_ALWAYS; + sampler.normalized_coords = 1; + /*sampler.prefilter = ; */ + /*sampler.shadow_ambient = ; */ + /*sampler.lod_bias = ; */ + sampler.min_lod = 0; + /*sampler.max_lod = ; */ + /*sampler.border_color[i] = ; */ + /*sampler.max_anisotropy = ; */ + r->samplers.all[i] = r->pipe->create_sampler_state(r->pipe, &sampler); + } + + return true; +} + +static void +cleanup_pipe_state(struct vl_mpeg12_mc_renderer *r) +{ + assert(r); + + for (unsigned i = 0; i < 5; ++i) + r->pipe->delete_sampler_state(r->pipe, r->samplers.all[i]); +} + +static bool +init_shaders(struct vl_mpeg12_mc_renderer *r) +{ + assert(r); + + create_intra_vert_shader(r); + create_intra_frag_shader(r); + create_frame_pred_vert_shader(r); + create_frame_pred_frag_shader(r); + create_frame_bi_pred_vert_shader(r); + create_frame_bi_pred_frag_shader(r); + + return true; +} + +static void +cleanup_shaders(struct vl_mpeg12_mc_renderer *r) +{ + assert(r); + + r->pipe->delete_vs_state(r->pipe, r->i_vs); + r->pipe->delete_fs_state(r->pipe, r->i_fs); + r->pipe->delete_vs_state(r->pipe, r->p_vs[0]); + r->pipe->delete_fs_state(r->pipe, r->p_fs[0]); + r->pipe->delete_vs_state(r->pipe, r->b_vs[0]); + r->pipe->delete_fs_state(r->pipe, r->b_fs[0]); +} + +static bool +init_buffers(struct vl_mpeg12_mc_renderer *r) +{ + struct pipe_texture template; + + const unsigned mbw = + align(r->picture_width, MACROBLOCK_WIDTH) / MACROBLOCK_WIDTH; + const unsigned mbh = + align(r->picture_height, MACROBLOCK_HEIGHT) / MACROBLOCK_HEIGHT; + + assert(r); + + r->macroblocks_per_batch = + mbw * (r->bufmode == VL_MPEG12_MC_RENDERER_BUFFER_PICTURE ? mbh : 1); + r->num_macroblocks = 0; + r->macroblock_buf = MALLOC(r->macroblocks_per_batch * sizeof(struct pipe_mpeg12_macroblock)); + + memset(&template, 0, sizeof(struct pipe_texture)); + template.target = PIPE_TEXTURE_2D; + /* TODO: Accomodate HW that can't do this and also for cases when this isn't precise enough */ + template.format = PIPE_FORMAT_R16_SNORM; + template.last_level = 0; + template.width[0] = r->pot_buffers ? + util_next_power_of_two(r->picture_width) : r->picture_width; + template.height[0] = r->pot_buffers ? + util_next_power_of_two(r->picture_height) : r->picture_height; + template.depth[0] = 1; + pf_get_block(template.format, &template.block); + template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_DYNAMIC; + + r->textures.individual.y = r->pipe->screen->texture_create(r->pipe->screen, &template); + + if (r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420) + { + template.width[0] = r->pot_buffers ? + util_next_power_of_two(r->picture_width / 2) : + r->picture_width / 2; + template.height[0] = r->pot_buffers ? + util_next_power_of_two(r->picture_height / 2) : + r->picture_height / 2; + } + else if (r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_422) + template.height[0] = r->pot_buffers ? + util_next_power_of_two(r->picture_height / 2) : + r->picture_height / 2; + + r->textures.individual.cb = + r->pipe->screen->texture_create(r->pipe->screen, &template); + r->textures.individual.cr = + r->pipe->screen->texture_create(r->pipe->screen, &template); + + r->vertex_bufs.individual.ycbcr.stride = sizeof(struct vertex2f) * 4; + r->vertex_bufs.individual.ycbcr.max_index = 24 * r->macroblocks_per_batch - 1; + r->vertex_bufs.individual.ycbcr.buffer_offset = 0; + r->vertex_bufs.individual.ycbcr.buffer = pipe_buffer_create + ( + r->pipe->screen, + DEFAULT_BUF_ALIGNMENT, + PIPE_BUFFER_USAGE_VERTEX | PIPE_BUFFER_USAGE_DISCARD, + sizeof(struct vertex2f) * 4 * 24 * r->macroblocks_per_batch + ); + + for (unsigned i = 1; i < 3; ++i) + { + r->vertex_bufs.all[i].stride = sizeof(struct vertex2f) * 2; + r->vertex_bufs.all[i].max_index = 24 * r->macroblocks_per_batch - 1; + r->vertex_bufs.all[i].buffer_offset = 0; + r->vertex_bufs.all[i].buffer = pipe_buffer_create + ( + r->pipe->screen, + DEFAULT_BUF_ALIGNMENT, + PIPE_BUFFER_USAGE_VERTEX | PIPE_BUFFER_USAGE_DISCARD, + sizeof(struct vertex2f) * 2 * 24 * r->macroblocks_per_batch + ); + } + + /* Position element */ + r->vertex_elems[0].src_offset = 0; + r->vertex_elems[0].vertex_buffer_index = 0; + r->vertex_elems[0].nr_components = 2; + r->vertex_elems[0].src_format = PIPE_FORMAT_R32G32_FLOAT; + + /* Luma, texcoord element */ + r->vertex_elems[1].src_offset = sizeof(struct vertex2f); + r->vertex_elems[1].vertex_buffer_index = 0; + r->vertex_elems[1].nr_components = 2; + r->vertex_elems[1].src_format = PIPE_FORMAT_R32G32_FLOAT; + + /* Chroma Cr texcoord element */ + r->vertex_elems[2].src_offset = sizeof(struct vertex2f) * 2; + r->vertex_elems[2].vertex_buffer_index = 0; + r->vertex_elems[2].nr_components = 2; + r->vertex_elems[2].src_format = PIPE_FORMAT_R32G32_FLOAT; + + /* Chroma Cb texcoord element */ + r->vertex_elems[3].src_offset = sizeof(struct vertex2f) * 3; + r->vertex_elems[3].vertex_buffer_index = 0; + r->vertex_elems[3].nr_components = 2; + r->vertex_elems[3].src_format = PIPE_FORMAT_R32G32_FLOAT; + + /* First ref surface top field texcoord element */ + r->vertex_elems[4].src_offset = 0; + r->vertex_elems[4].vertex_buffer_index = 1; + r->vertex_elems[4].nr_components = 2; + r->vertex_elems[4].src_format = PIPE_FORMAT_R32G32_FLOAT; + + /* First ref surface bottom field texcoord element */ + r->vertex_elems[5].src_offset = sizeof(struct vertex2f); + r->vertex_elems[5].vertex_buffer_index = 1; + r->vertex_elems[5].nr_components = 2; + r->vertex_elems[5].src_format = PIPE_FORMAT_R32G32_FLOAT; + + /* Second ref surface top field texcoord element */ + r->vertex_elems[6].src_offset = 0; + r->vertex_elems[6].vertex_buffer_index = 2; + r->vertex_elems[6].nr_components = 2; + r->vertex_elems[6].src_format = PIPE_FORMAT_R32G32_FLOAT; + + /* Second ref surface bottom field texcoord element */ + r->vertex_elems[7].src_offset = sizeof(struct vertex2f); + r->vertex_elems[7].vertex_buffer_index = 2; + r->vertex_elems[7].nr_components = 2; + r->vertex_elems[7].src_format = PIPE_FORMAT_R32G32_FLOAT; + + r->vs_const_buf.buffer = pipe_buffer_create + ( + r->pipe->screen, + DEFAULT_BUF_ALIGNMENT, + PIPE_BUFFER_USAGE_CONSTANT | PIPE_BUFFER_USAGE_DISCARD, + sizeof(struct vertex_shader_consts) + ); + + r->fs_const_buf.buffer = pipe_buffer_create + ( + r->pipe->screen, + DEFAULT_BUF_ALIGNMENT, + PIPE_BUFFER_USAGE_CONSTANT, sizeof(struct fragment_shader_consts) + ); + + memcpy + ( + pipe_buffer_map(r->pipe->screen, r->fs_const_buf.buffer, PIPE_BUFFER_USAGE_CPU_WRITE), + &fs_consts, sizeof(struct fragment_shader_consts) + ); + + pipe_buffer_unmap(r->pipe->screen, r->fs_const_buf.buffer); + + return true; +} + +static void +cleanup_buffers(struct vl_mpeg12_mc_renderer *r) +{ + assert(r); + + pipe_buffer_reference(&r->vs_const_buf.buffer, NULL); + pipe_buffer_reference(&r->fs_const_buf.buffer, NULL); + + for (unsigned i = 0; i < 3; ++i) + pipe_buffer_reference(&r->vertex_bufs.all[i].buffer, NULL); + + for (unsigned i = 0; i < 3; ++i) + pipe_texture_reference(&r->textures.all[i], NULL); + + FREE(r->macroblock_buf); +} + +static enum MACROBLOCK_TYPE +get_macroblock_type(struct pipe_mpeg12_macroblock *mb) +{ + assert(mb); + + switch (mb->mb_type) + { + case PIPE_MPEG12_MACROBLOCK_TYPE_INTRA: + return MACROBLOCK_TYPE_INTRA; + case PIPE_MPEG12_MACROBLOCK_TYPE_FWD: + return mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME ? + MACROBLOCK_TYPE_FWD_FRAME_PRED : MACROBLOCK_TYPE_FWD_FIELD_PRED; + case PIPE_MPEG12_MACROBLOCK_TYPE_BKWD: + return mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME ? + MACROBLOCK_TYPE_BKWD_FRAME_PRED : MACROBLOCK_TYPE_BKWD_FIELD_PRED; + case PIPE_MPEG12_MACROBLOCK_TYPE_BI: + return mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME ? + MACROBLOCK_TYPE_BI_FRAME_PRED : MACROBLOCK_TYPE_BI_FIELD_PRED; + default: + assert(0); + } + + /* Unreachable */ + return -1; +} + +/* XXX: One of these days this will have to be killed with fire */ +#define SET_BLOCK(vb, cbp, mbx, mby, unitx, unity, ofsx, ofsy, hx, hy, lm, cbm, crm, use_zb, zb) \ + do { \ + (vb)[0].pos.x = (mbx) * (unitx) + (ofsx); (vb)[0].pos.y = (mby) * (unity) + (ofsy); \ + (vb)[1].pos.x = (mbx) * (unitx) + (ofsx); (vb)[1].pos.y = (mby) * (unity) + (ofsy) + (hy); \ + (vb)[2].pos.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[2].pos.y = (mby) * (unity) + (ofsy); \ + (vb)[3].pos.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[3].pos.y = (mby) * (unity) + (ofsy); \ + (vb)[4].pos.x = (mbx) * (unitx) + (ofsx); (vb)[4].pos.y = (mby) * (unity) + (ofsy) + (hy); \ + (vb)[5].pos.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[5].pos.y = (mby) * (unity) + (ofsy) + (hy); \ + \ + if (!use_zb || (cbp) & (lm)) \ + { \ + (vb)[0].luma_tc.x = (mbx) * (unitx) + (ofsx); (vb)[0].luma_tc.y = (mby) * (unity) + (ofsy); \ + (vb)[1].luma_tc.x = (mbx) * (unitx) + (ofsx); (vb)[1].luma_tc.y = (mby) * (unity) + (ofsy) + (hy); \ + (vb)[2].luma_tc.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[2].luma_tc.y = (mby) * (unity) + (ofsy); \ + (vb)[3].luma_tc.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[3].luma_tc.y = (mby) * (unity) + (ofsy); \ + (vb)[4].luma_tc.x = (mbx) * (unitx) + (ofsx); (vb)[4].luma_tc.y = (mby) * (unity) + (ofsy) + (hy); \ + (vb)[5].luma_tc.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[5].luma_tc.y = (mby) * (unity) + (ofsy) + (hy); \ + } \ + else \ + { \ + (vb)[0].luma_tc.x = (zb)[0].x; (vb)[0].luma_tc.y = (zb)[0].y; \ + (vb)[1].luma_tc.x = (zb)[0].x; (vb)[1].luma_tc.y = (zb)[0].y + (hy); \ + (vb)[2].luma_tc.x = (zb)[0].x + (hx); (vb)[2].luma_tc.y = (zb)[0].y; \ + (vb)[3].luma_tc.x = (zb)[0].x + (hx); (vb)[3].luma_tc.y = (zb)[0].y; \ + (vb)[4].luma_tc.x = (zb)[0].x; (vb)[4].luma_tc.y = (zb)[0].y + (hy); \ + (vb)[5].luma_tc.x = (zb)[0].x + (hx); (vb)[5].luma_tc.y = (zb)[0].y + (hy); \ + } \ + \ + if (!use_zb || (cbp) & (cbm)) \ + { \ + (vb)[0].cb_tc.x = (mbx) * (unitx) + (ofsx); (vb)[0].cb_tc.y = (mby) * (unity) + (ofsy); \ + (vb)[1].cb_tc.x = (mbx) * (unitx) + (ofsx); (vb)[1].cb_tc.y = (mby) * (unity) + (ofsy) + (hy); \ + (vb)[2].cb_tc.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[2].cb_tc.y = (mby) * (unity) + (ofsy); \ + (vb)[3].cb_tc.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[3].cb_tc.y = (mby) * (unity) + (ofsy); \ + (vb)[4].cb_tc.x = (mbx) * (unitx) + (ofsx); (vb)[4].cb_tc.y = (mby) * (unity) + (ofsy) + (hy); \ + (vb)[5].cb_tc.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[5].cb_tc.y = (mby) * (unity) + (ofsy) + (hy); \ + } \ + else \ + { \ + (vb)[0].cb_tc.x = (zb)[1].x; (vb)[0].cb_tc.y = (zb)[1].y; \ + (vb)[1].cb_tc.x = (zb)[1].x; (vb)[1].cb_tc.y = (zb)[1].y + (hy); \ + (vb)[2].cb_tc.x = (zb)[1].x + (hx); (vb)[2].cb_tc.y = (zb)[1].y; \ + (vb)[3].cb_tc.x = (zb)[1].x + (hx); (vb)[3].cb_tc.y = (zb)[1].y; \ + (vb)[4].cb_tc.x = (zb)[1].x; (vb)[4].cb_tc.y = (zb)[1].y + (hy); \ + (vb)[5].cb_tc.x = (zb)[1].x + (hx); (vb)[5].cb_tc.y = (zb)[1].y + (hy); \ + } \ + \ + if (!use_zb || (cbp) & (crm)) \ + { \ + (vb)[0].cr_tc.x = (mbx) * (unitx) + (ofsx); (vb)[0].cr_tc.y = (mby) * (unity) + (ofsy); \ + (vb)[1].cr_tc.x = (mbx) * (unitx) + (ofsx); (vb)[1].cr_tc.y = (mby) * (unity) + (ofsy) + (hy); \ + (vb)[2].cr_tc.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[2].cr_tc.y = (mby) * (unity) + (ofsy); \ + (vb)[3].cr_tc.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[3].cr_tc.y = (mby) * (unity) + (ofsy); \ + (vb)[4].cr_tc.x = (mbx) * (unitx) + (ofsx); (vb)[4].cr_tc.y = (mby) * (unity) + (ofsy) + (hy); \ + (vb)[5].cr_tc.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[5].cr_tc.y = (mby) * (unity) + (ofsy) + (hy); \ + } \ + else \ + { \ + (vb)[0].cr_tc.x = (zb)[2].x; (vb)[0].cr_tc.y = (zb)[2].y; \ + (vb)[1].cr_tc.x = (zb)[2].x; (vb)[1].cr_tc.y = (zb)[2].y + (hy); \ + (vb)[2].cr_tc.x = (zb)[2].x + (hx); (vb)[2].cr_tc.y = (zb)[2].y; \ + (vb)[3].cr_tc.x = (zb)[2].x + (hx); (vb)[3].cr_tc.y = (zb)[2].y; \ + (vb)[4].cr_tc.x = (zb)[2].x; (vb)[4].cr_tc.y = (zb)[2].y + (hy); \ + (vb)[5].cr_tc.x = (zb)[2].x + (hx); (vb)[5].cr_tc.y = (zb)[2].y + (hy); \ + } \ + } while (0) + +static void +gen_macroblock_verts(struct vl_mpeg12_mc_renderer *r, + struct pipe_mpeg12_macroblock *mb, unsigned pos, + struct vert_stream_0 *ycbcr_vb, struct vertex2f **ref_vb) +{ + struct vertex2f mo_vec[2]; + + assert(r); + assert(mb); + assert(ycbcr_vb); + assert(pos < r->macroblocks_per_batch); + + switch (mb->mb_type) + { + case PIPE_MPEG12_MACROBLOCK_TYPE_BI: + { + struct vertex2f *vb; + + assert(ref_vb && ref_vb[1]); + + vb = ref_vb[1] + pos * 2 * 24; + + mo_vec[0].x = mb->pmv[0][1][0] * 0.5f * r->surface_tex_inv_size.x; + mo_vec[0].y = mb->pmv[0][1][1] * 0.5f * r->surface_tex_inv_size.y; + + if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME) + { + for (unsigned i = 0; i < 24 * 2; i += 2) + { + vb[i].x = mo_vec[0].x; + vb[i].y = mo_vec[0].y; + } + } + else + { + mo_vec[1].x = mb->pmv[1][1][0] * 0.5f * r->surface_tex_inv_size.x; + mo_vec[1].y = mb->pmv[1][1][1] * 0.5f * r->surface_tex_inv_size.y; + + for (unsigned i = 0; i < 24 * 2; i += 2) + { + vb[i].x = mo_vec[0].x; + vb[i].y = mo_vec[0].y; + vb[i + 1].x = mo_vec[1].x; + vb[i + 1].y = mo_vec[1].y; + } + } + + /* fall-through */ + } + case PIPE_MPEG12_MACROBLOCK_TYPE_FWD: + case PIPE_MPEG12_MACROBLOCK_TYPE_BKWD: + { + struct vertex2f *vb; + + assert(ref_vb && ref_vb[0]); + + vb = ref_vb[0] + pos * 2 * 24; + + if (mb->mb_type == PIPE_MPEG12_MACROBLOCK_TYPE_BKWD) + { + mo_vec[0].x = mb->pmv[0][1][0] * 0.5f * r->surface_tex_inv_size.x; + mo_vec[0].y = mb->pmv[0][1][1] * 0.5f * r->surface_tex_inv_size.y; + + if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FIELD) + { + mo_vec[1].x = mb->pmv[1][1][0] * 0.5f * r->surface_tex_inv_size.x; + mo_vec[1].y = mb->pmv[1][1][1] * 0.5f * r->surface_tex_inv_size.y; + } + } + else + { + mo_vec[0].x = mb->pmv[0][0][0] * 0.5f * r->surface_tex_inv_size.x; + mo_vec[0].y = mb->pmv[0][0][1] * 0.5f * r->surface_tex_inv_size.y; + + if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FIELD) + { + mo_vec[1].x = mb->pmv[1][0][0] * 0.5f * r->surface_tex_inv_size.x; + mo_vec[1].y = mb->pmv[1][0][1] * 0.5f * r->surface_tex_inv_size.y; + } + } + + if (mb->mb_type == PIPE_MPEG12_MOTION_TYPE_FRAME) + { + for (unsigned i = 0; i < 24 * 2; i += 2) + { + vb[i].x = mo_vec[0].x; + vb[i].y = mo_vec[0].y; + } + } + else + { + for (unsigned i = 0; i < 24 * 2; i += 2) + { + vb[i].x = mo_vec[0].x; + vb[i].y = mo_vec[0].y; + vb[i + 1].x = mo_vec[1].x; + vb[i + 1].y = mo_vec[1].y; + } + } + + /* fall-through */ + } + case PIPE_MPEG12_MACROBLOCK_TYPE_INTRA: + { + const struct vertex2f unit = + { + r->surface_tex_inv_size.x * MACROBLOCK_WIDTH, + r->surface_tex_inv_size.y * MACROBLOCK_HEIGHT + }; + const struct vertex2f half = + { + r->surface_tex_inv_size.x * (MACROBLOCK_WIDTH / 2), + r->surface_tex_inv_size.y * (MACROBLOCK_HEIGHT / 2) + }; + const bool use_zb = r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE; + + struct vert_stream_0 *vb = ycbcr_vb + pos * 24; + + SET_BLOCK(vb, mb->cbp, mb->mbx, mb->mby, + unit.x, unit.y, 0, 0, half.x, half.y, + 32, 2, 1, use_zb, r->zero_block); + + SET_BLOCK(vb + 6, mb->cbp, mb->mbx, mb->mby, + unit.x, unit.y, half.x, 0, half.x, half.y, + 16, 2, 1, use_zb, r->zero_block); + + SET_BLOCK(vb + 12, mb->cbp, mb->mbx, mb->mby, + unit.x, unit.y, 0, half.y, half.x, half.y, + 8, 2, 1, use_zb, r->zero_block); + + SET_BLOCK(vb + 18, mb->cbp, mb->mbx, mb->mby, + unit.x, unit.y, half.x, half.y, half.x, half.y, + 4, 2, 1, use_zb, r->zero_block); + + break; + } + default: + assert(0); + } +} + +static void +gen_macroblock_stream(struct vl_mpeg12_mc_renderer *r, + unsigned *num_macroblocks) +{ + unsigned offset[NUM_MACROBLOCK_TYPES]; + struct vert_stream_0 *ycbcr_vb; + struct vertex2f *ref_vb[2]; + + assert(r); + assert(num_macroblocks); + + for (unsigned i = 0; i < r->num_macroblocks; ++i) + { + enum MACROBLOCK_TYPE mb_type = get_macroblock_type(&r->macroblock_buf[i]); + ++num_macroblocks[mb_type]; + } + + offset[0] = 0; + + for (unsigned i = 1; i < NUM_MACROBLOCK_TYPES; ++i) + offset[i] = offset[i - 1] + num_macroblocks[i - 1]; + + ycbcr_vb = (struct vert_stream_0 *)pipe_buffer_map + ( + r->pipe->screen, + r->vertex_bufs.individual.ycbcr.buffer, + PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_DISCARD + ); + + for (unsigned i = 0; i < 2; ++i) + ref_vb[i] = (struct vertex2f *)pipe_buffer_map + ( + r->pipe->screen, + r->vertex_bufs.individual.ref[i].buffer, + PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_DISCARD + ); + + for (unsigned i = 0; i < r->num_macroblocks; ++i) + { + enum MACROBLOCK_TYPE mb_type = get_macroblock_type(&r->macroblock_buf[i]); + + gen_macroblock_verts(r, &r->macroblock_buf[i], offset[mb_type], + ycbcr_vb, ref_vb); + + ++offset[mb_type]; + } + + pipe_buffer_unmap(r->pipe->screen, r->vertex_bufs.individual.ycbcr.buffer); + for (unsigned i = 0; i < 2; ++i) + pipe_buffer_unmap(r->pipe->screen, r->vertex_bufs.individual.ref[i].buffer); +} + +static void +flush(struct vl_mpeg12_mc_renderer *r) +{ + unsigned num_macroblocks[NUM_MACROBLOCK_TYPES] = { 0 }; + unsigned vb_start = 0; + struct vertex_shader_consts *vs_consts; + + assert(r); + assert(r->num_macroblocks == r->macroblocks_per_batch); + + gen_macroblock_stream(r, num_macroblocks); + + r->fb_state.cbufs[0] = r->pipe->screen->get_tex_surface + ( + r->pipe->screen, r->surface, + 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE + ); + + r->pipe->set_framebuffer_state(r->pipe, &r->fb_state); + r->pipe->set_viewport_state(r->pipe, &r->viewport); + + vs_consts = pipe_buffer_map + ( + r->pipe->screen, r->vs_const_buf.buffer, + PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_DISCARD + ); + + vs_consts->denorm.x = r->surface->width[0]; + vs_consts->denorm.y = r->surface->height[0]; + + pipe_buffer_unmap(r->pipe->screen, r->vs_const_buf.buffer); + + r->pipe->set_constant_buffer(r->pipe, PIPE_SHADER_VERTEX, 0, + &r->vs_const_buf); + r->pipe->set_constant_buffer(r->pipe, PIPE_SHADER_FRAGMENT, 0, + &r->fs_const_buf); + + if (num_macroblocks[MACROBLOCK_TYPE_INTRA] > 0) + { + r->pipe->set_vertex_buffers(r->pipe, 1, r->vertex_bufs.all); + r->pipe->set_vertex_elements(r->pipe, 4, r->vertex_elems); + r->pipe->set_sampler_textures(r->pipe, 3, r->textures.all); + r->pipe->bind_sampler_states(r->pipe, 3, r->samplers.all); + r->pipe->bind_vs_state(r->pipe, r->i_vs); + r->pipe->bind_fs_state(r->pipe, r->i_fs); + + r->pipe->draw_arrays(r->pipe, PIPE_PRIM_TRIANGLES, vb_start, + num_macroblocks[MACROBLOCK_TYPE_INTRA] * 24); + vb_start += num_macroblocks[MACROBLOCK_TYPE_INTRA] * 24; + } + + if (num_macroblocks[MACROBLOCK_TYPE_FWD_FRAME_PRED] > 0) + { + r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all); + r->pipe->set_vertex_elements(r->pipe, 6, r->vertex_elems); + r->textures.individual.ref[0] = r->past; + r->pipe->set_sampler_textures(r->pipe, 4, r->textures.all); + r->pipe->bind_sampler_states(r->pipe, 4, r->samplers.all); + r->pipe->bind_vs_state(r->pipe, r->p_vs[0]); + r->pipe->bind_fs_state(r->pipe, r->p_fs[0]); + + r->pipe->draw_arrays(r->pipe, PIPE_PRIM_TRIANGLES, vb_start, + num_macroblocks[MACROBLOCK_TYPE_FWD_FRAME_PRED] * 24); + vb_start += num_macroblocks[MACROBLOCK_TYPE_FWD_FRAME_PRED] * 24; + } + + if (false /*num_macroblocks[MACROBLOCK_TYPE_FWD_FIELD_PRED] > 0 */ ) + { + r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all); + r->pipe->set_vertex_elements(r->pipe, 6, r->vertex_elems); + r->textures.individual.ref[0] = r->past; + r->pipe->set_sampler_textures(r->pipe, 4, r->textures.all); + r->pipe->bind_sampler_states(r->pipe, 4, r->samplers.all); + r->pipe->bind_vs_state(r->pipe, r->p_vs[1]); + r->pipe->bind_fs_state(r->pipe, r->p_fs[1]); + + r->pipe->draw_arrays(r->pipe, PIPE_PRIM_TRIANGLES, vb_start, + num_macroblocks[MACROBLOCK_TYPE_FWD_FIELD_PRED] * 24); + vb_start += num_macroblocks[MACROBLOCK_TYPE_FWD_FIELD_PRED] * 24; + } + + if (num_macroblocks[MACROBLOCK_TYPE_BKWD_FRAME_PRED] > 0) + { + r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all); + r->pipe->set_vertex_elements(r->pipe, 6, r->vertex_elems); + r->textures.individual.ref[0] = r->future; + r->pipe->set_sampler_textures(r->pipe, 4, r->textures.all); + r->pipe->bind_sampler_states(r->pipe, 4, r->samplers.all); + r->pipe->bind_vs_state(r->pipe, r->p_vs[0]); + r->pipe->bind_fs_state(r->pipe, r->p_fs[0]); + + r->pipe->draw_arrays(r->pipe, PIPE_PRIM_TRIANGLES, vb_start, + num_macroblocks[MACROBLOCK_TYPE_BKWD_FRAME_PRED] * 24); + vb_start += num_macroblocks[MACROBLOCK_TYPE_BKWD_FRAME_PRED] * 24; + } + + if (false /*num_macroblocks[MACROBLOCK_TYPE_BKWD_FIELD_PRED] > 0 */ ) + { + r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all); + r->pipe->set_vertex_elements(r->pipe, 6, r->vertex_elems); + r->textures.individual.ref[0] = r->future; + r->pipe->set_sampler_textures(r->pipe, 4, r->textures.all); + r->pipe->bind_sampler_states(r->pipe, 4, r->samplers.all); + r->pipe->bind_vs_state(r->pipe, r->p_vs[1]); + r->pipe->bind_fs_state(r->pipe, r->p_fs[1]); + + r->pipe->draw_arrays(r->pipe, PIPE_PRIM_TRIANGLES, vb_start, + num_macroblocks[MACROBLOCK_TYPE_BKWD_FIELD_PRED] * 24); + vb_start += num_macroblocks[MACROBLOCK_TYPE_BKWD_FIELD_PRED] * 24; + } + + if (num_macroblocks[MACROBLOCK_TYPE_BI_FRAME_PRED] > 0) + { + r->pipe->set_vertex_buffers(r->pipe, 3, r->vertex_bufs.all); + r->pipe->set_vertex_elements(r->pipe, 8, r->vertex_elems); + r->textures.individual.ref[0] = r->past; + r->textures.individual.ref[1] = r->future; + r->pipe->set_sampler_textures(r->pipe, 5, r->textures.all); + r->pipe->bind_sampler_states(r->pipe, 5, r->samplers.all); + r->pipe->bind_vs_state(r->pipe, r->b_vs[0]); + r->pipe->bind_fs_state(r->pipe, r->b_fs[0]); + + r->pipe->draw_arrays(r->pipe, PIPE_PRIM_TRIANGLES, vb_start, + num_macroblocks[MACROBLOCK_TYPE_BI_FRAME_PRED] * 24); + vb_start += num_macroblocks[MACROBLOCK_TYPE_BI_FRAME_PRED] * 24; + } + + if (false /*num_macroblocks[MACROBLOCK_TYPE_BI_FIELD_PRED] > 0 */ ) + { + r->pipe->set_vertex_buffers(r->pipe, 3, r->vertex_bufs.all); + r->pipe->set_vertex_elements(r->pipe, 8, r->vertex_elems); + r->textures.individual.ref[0] = r->past; + r->textures.individual.ref[1] = r->future; + r->pipe->set_sampler_textures(r->pipe, 5, r->textures.all); + r->pipe->bind_sampler_states(r->pipe, 5, r->samplers.all); + r->pipe->bind_vs_state(r->pipe, r->b_vs[1]); + r->pipe->bind_fs_state(r->pipe, r->b_fs[1]); + + r->pipe->draw_arrays(r->pipe, PIPE_PRIM_TRIANGLES, vb_start, + num_macroblocks[MACROBLOCK_TYPE_BI_FIELD_PRED] * 24); + vb_start += num_macroblocks[MACROBLOCK_TYPE_BI_FIELD_PRED] * 24; + } + + r->pipe->flush(r->pipe, PIPE_FLUSH_RENDER_CACHE, r->fence); + pipe_surface_reference(&r->fb_state.cbufs[0], NULL); + + if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE) + for (unsigned i = 0; i < 3; ++i) + r->zero_block[i].x = ZERO_BLOCK_NIL; + + r->num_macroblocks = 0; +} + +static void +grab_frame_coded_block(short *src, short *dst, unsigned dst_pitch) +{ + assert(src); + assert(dst); + + for (unsigned y = 0; y < BLOCK_HEIGHT; ++y) + memcpy(dst + y * dst_pitch, src + y * BLOCK_WIDTH, BLOCK_WIDTH * 2); +} + +static void +grab_field_coded_block(short *src, short *dst, unsigned dst_pitch) +{ + assert(src); + assert(dst); + + for (unsigned y = 0; y < BLOCK_HEIGHT; ++y) + memcpy(dst + y * dst_pitch * 2, src + y * BLOCK_WIDTH, BLOCK_WIDTH * 2); +} + +static void +fill_zero_block(short *dst, unsigned dst_pitch) +{ + assert(dst); + + for (unsigned y = 0; y < BLOCK_HEIGHT; ++y) + memset(dst + y * dst_pitch, 0, BLOCK_WIDTH * 2); +} + +static void +grab_blocks(struct vl_mpeg12_mc_renderer *r, unsigned mbx, unsigned mby, + enum pipe_mpeg12_dct_type dct_type, unsigned cbp, short *blocks) +{ + unsigned tex_pitch; + short *texels; + unsigned tb = 0, sb = 0; + unsigned mbpx = mbx * MACROBLOCK_WIDTH, mbpy = mby * MACROBLOCK_HEIGHT; + + assert(r); + assert(blocks); + + tex_pitch = r->tex_transfer[0]->stride / r->tex_transfer[0]->block.size; + texels = r->texels[0] + mbpy * tex_pitch + mbpx; + + for (unsigned y = 0; y < 2; ++y) + { + for (unsigned x = 0; x < 2; ++x, ++tb) + { + if ((cbp >> (5 - tb)) & 1) + { + if (dct_type == PIPE_MPEG12_DCT_TYPE_FRAME) + { + grab_frame_coded_block(blocks + sb * BLOCK_WIDTH * BLOCK_HEIGHT, + texels + y * tex_pitch * BLOCK_WIDTH + + x * BLOCK_WIDTH, tex_pitch); + } + else + { + grab_field_coded_block(blocks + sb * BLOCK_WIDTH * BLOCK_HEIGHT, + texels + y * tex_pitch + x * BLOCK_WIDTH, + tex_pitch); + } + + ++sb; + } + else if (r->eb_handling != VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_NONE) + { + if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ALL || + ZERO_BLOCK_IS_NIL(r->zero_block[0])) + { + fill_zero_block(texels + y * tex_pitch * BLOCK_WIDTH + x * BLOCK_WIDTH, tex_pitch); + if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE) + { + r->zero_block[0].x = (mbpx + x * 8) * r->surface_tex_inv_size.x; + r->zero_block[0].y = (mbpy + y * 8) * r->surface_tex_inv_size.y; + } + } + } + } + } + + /* TODO: Implement 422, 444 */ + assert(r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420); + + mbpx /= 2; + mbpy /= 2; + + for (tb = 0; tb < 2; ++tb) + { + tex_pitch = r->tex_transfer[tb + 1]->stride / r->tex_transfer[tb + 1]->block.size; + texels = r->texels[tb + 1] + mbpy * tex_pitch + mbpx; + + if ((cbp >> (1 - tb)) & 1) + { + grab_frame_coded_block(blocks + sb * BLOCK_WIDTH * BLOCK_HEIGHT, texels, tex_pitch); + ++sb; + } + else if (r->eb_handling != VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_NONE) + { + if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ALL || + ZERO_BLOCK_IS_NIL(r->zero_block[tb + 1])) + { + fill_zero_block(texels, tex_pitch); + if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE) + { + r->zero_block[tb + 1].x = (mbpx << 1) * r->surface_tex_inv_size.x; + r->zero_block[tb + 1].y = (mbpy << 1) * r->surface_tex_inv_size.y; + } + } + } + } +} + +static void +grab_macroblock(struct vl_mpeg12_mc_renderer *r, + struct pipe_mpeg12_macroblock *mb) +{ + assert(r); + assert(mb); + assert(r->num_macroblocks < r->macroblocks_per_batch); + + memcpy(&r->macroblock_buf[r->num_macroblocks], mb, + sizeof(struct pipe_mpeg12_macroblock)); + + grab_blocks(r, mb->mbx, mb->mby, mb->dct_type, mb->cbp, mb->blocks); + + ++r->num_macroblocks; +} + +bool +vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer *renderer, + struct pipe_context *pipe, + unsigned picture_width, + unsigned picture_height, + enum pipe_video_chroma_format chroma_format, + enum VL_MPEG12_MC_RENDERER_BUFFER_MODE bufmode, + enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK eb_handling, + bool pot_buffers) +{ + assert(renderer); + assert(pipe); + /* TODO: Implement other policies */ + assert(bufmode == VL_MPEG12_MC_RENDERER_BUFFER_PICTURE); + /* TODO: Implement this */ + /* XXX: XFER_ALL sampling issue at block edges when using bilinear filtering */ + assert(eb_handling != VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_NONE); + /* TODO: Non-pot buffers untested, probably doesn't work without changes to texcoord generation, vert shader, etc */ + assert(pot_buffers); + + memset(renderer, 0, sizeof(struct vl_mpeg12_mc_renderer)); + + renderer->pipe = pipe; + renderer->picture_width = picture_width; + renderer->picture_height = picture_height; + renderer->chroma_format = chroma_format; + renderer->bufmode = bufmode; + renderer->eb_handling = eb_handling; + renderer->pot_buffers = pot_buffers; + + if (!init_pipe_state(renderer)) + return false; + if (!init_shaders(renderer)) + { + cleanup_pipe_state(renderer); + return false; + } + if (!init_buffers(renderer)) + { + cleanup_shaders(renderer); + cleanup_pipe_state(renderer); + return false; + } + + renderer->surface = NULL; + renderer->past = NULL; + renderer->future = NULL; + for (unsigned i = 0; i < 3; ++i) + renderer->zero_block[i].x = ZERO_BLOCK_NIL; + renderer->num_macroblocks = 0; + + xfer_buffers_map(renderer); + + return true; +} + +void +vl_mpeg12_mc_renderer_cleanup(struct vl_mpeg12_mc_renderer *renderer) +{ + assert(renderer); + + xfer_buffers_unmap(renderer); + + cleanup_pipe_state(renderer); + cleanup_shaders(renderer); + cleanup_buffers(renderer); +} + +void +vl_mpeg12_mc_renderer_render_macroblocks(struct vl_mpeg12_mc_renderer + *renderer, + struct pipe_texture *surface, + struct pipe_texture *past, + struct pipe_texture *future, + unsigned num_macroblocks, + struct pipe_mpeg12_macroblock + *mpeg12_macroblocks, + struct pipe_fence_handle **fence) +{ + bool new_surface = false; + + assert(renderer); + assert(surface); + assert(num_macroblocks); + assert(mpeg12_macroblocks); + + if (renderer->surface) + { + if (surface != renderer->surface) + { + if (renderer->num_macroblocks > 0) + { + xfer_buffers_unmap(renderer); + flush(renderer); + } + + new_surface = true; + } + + /* If the surface we're rendering hasn't changed the ref frames shouldn't change. */ + assert(surface != renderer->surface || renderer->past == past); + assert(surface != renderer->surface || renderer->future == future); + } + else + new_surface = true; + + if (new_surface) + { + renderer->surface = surface; + renderer->past = past; + renderer->future = future; + renderer->fence = fence; + renderer->surface_tex_inv_size.x = 1.0f / surface->width[0]; + renderer->surface_tex_inv_size.y = 1.0f / surface->height[0]; + } + + while (num_macroblocks) + { + unsigned left_in_batch = renderer->macroblocks_per_batch - renderer->num_macroblocks; + unsigned num_to_submit = MIN2(num_macroblocks, left_in_batch); + + for (unsigned i = 0; i < num_to_submit; ++i) + { + assert(mpeg12_macroblocks[i].base.codec == PIPE_VIDEO_CODEC_MPEG12); + grab_macroblock(renderer, &mpeg12_macroblocks[i]); + } + + num_macroblocks -= num_to_submit; + + if (renderer->num_macroblocks == renderer->macroblocks_per_batch) + { + xfer_buffers_unmap(renderer); + flush(renderer); + xfer_buffers_map(renderer); + /* Next time we get this surface it may have new ref frames */ + renderer->surface = NULL; + } + } +} diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h new file mode 100644 index 0000000000..dfe0f7a24b --- /dev/null +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h @@ -0,0 +1,93 @@ +#ifndef vl_mpeg12_mc_renderer_h +#define vl_mpeg12_mc_renderer_h + +#include +#include +#include + +struct pipe_context; +struct pipe_video_surface; +struct pipe_macroblock; + +/* A slice is video-width (rounded up to a multiple of macroblock width) x macroblock height */ +enum VL_MPEG12_MC_RENDERER_BUFFER_MODE +{ + VL_MPEG12_MC_RENDERER_BUFFER_SLICE, /* Saves memory at the cost of smaller batches */ + VL_MPEG12_MC_RENDERER_BUFFER_PICTURE /* Larger batches, more memory */ +}; + +enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK +{ + VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ALL, /* Waste of memory bandwidth */ + VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE, /* Can only do point-filtering when interpolating subsampled chroma channels */ + VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_NONE /* Needs conditional texel fetch! */ +}; + +struct vl_mpeg12_mc_renderer +{ + struct pipe_context *pipe; + unsigned picture_width; + unsigned picture_height; + enum pipe_video_chroma_format chroma_format; + enum VL_MPEG12_MC_RENDERER_BUFFER_MODE bufmode; + enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK eb_handling; + bool pot_buffers; + unsigned macroblocks_per_batch; + + struct pipe_viewport_state viewport; + struct pipe_constant_buffer vs_const_buf; + struct pipe_constant_buffer fs_const_buf; + struct pipe_framebuffer_state fb_state; + struct pipe_vertex_element vertex_elems[8]; + + union + { + void *all[5]; + struct { void *y, *cb, *cr, *ref[2]; } individual; + } samplers; + + void *i_vs, *p_vs[2], *b_vs[2]; + void *i_fs, *p_fs[2], *b_fs[2]; + + union + { + struct pipe_texture *all[5]; + struct { struct pipe_texture *y, *cb, *cr, *ref[2]; } individual; + } textures; + + union + { + struct pipe_vertex_buffer all[3]; + struct { struct pipe_vertex_buffer ycbcr, ref[2]; } individual; + } vertex_bufs; + + struct pipe_texture *surface, *past, *future; + struct pipe_fence_handle **fence; + unsigned num_macroblocks; + struct pipe_mpeg12_macroblock *macroblock_buf; + struct pipe_transfer *tex_transfer[3]; + short *texels[3]; + struct { float x, y; } surface_tex_inv_size; + struct { float x, y; } zero_block[3]; +}; + +bool vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer *renderer, + struct pipe_context *pipe, + unsigned picture_width, + unsigned picture_height, + enum pipe_video_chroma_format chroma_format, + enum VL_MPEG12_MC_RENDERER_BUFFER_MODE bufmode, + enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK eb_handling, + bool pot_buffers); + +void vl_mpeg12_mc_renderer_cleanup(struct vl_mpeg12_mc_renderer *renderer); + +void vl_mpeg12_mc_renderer_render_macroblocks(struct vl_mpeg12_mc_renderer *renderer, + struct pipe_texture *surface, + struct pipe_texture *past, + struct pipe_texture *future, + unsigned num_macroblocks, + struct pipe_mpeg12_macroblock *mpeg12_macroblocks, + struct pipe_fence_handle **fence); + +#endif /* vl_mpeg12_mc_renderer_h */ diff --git a/src/gallium/auxiliary/vl/vl_shader_build.c b/src/gallium/auxiliary/vl/vl_shader_build.c new file mode 100644 index 0000000000..5a4a5ab72c --- /dev/null +++ b/src/gallium/auxiliary/vl/vl_shader_build.c @@ -0,0 +1,215 @@ +#include "vl_shader_build.h" +#include +#include +#include + +struct tgsi_full_declaration vl_decl_input(unsigned int name, unsigned int index, unsigned int first, unsigned int last) +{ + struct tgsi_full_declaration decl = tgsi_default_full_declaration(); + + decl.Declaration.File = TGSI_FILE_INPUT; + decl.Declaration.Semantic = 1; + decl.Semantic.SemanticName = name; + decl.Semantic.SemanticIndex = index; + decl.DeclarationRange.First = first; + decl.DeclarationRange.Last = last; + + return decl; +} + +struct tgsi_full_declaration vl_decl_interpolated_input +( + unsigned int name, + unsigned int index, + unsigned int first, + unsigned int last, + int interpolation +) +{ + struct tgsi_full_declaration decl = tgsi_default_full_declaration(); + + assert + ( + interpolation == TGSI_INTERPOLATE_CONSTANT || + interpolation == TGSI_INTERPOLATE_LINEAR || + interpolation == TGSI_INTERPOLATE_PERSPECTIVE + ); + + decl.Declaration.File = TGSI_FILE_INPUT; + decl.Declaration.Semantic = 1; + decl.Semantic.SemanticName = name; + decl.Semantic.SemanticIndex = index; + decl.Declaration.Interpolate = interpolation;; + decl.DeclarationRange.First = first; + decl.DeclarationRange.Last = last; + + return decl; +} + +struct tgsi_full_declaration vl_decl_constants(unsigned int name, unsigned int index, unsigned int first, unsigned int last) +{ + struct tgsi_full_declaration decl = tgsi_default_full_declaration(); + + decl.Declaration.File = TGSI_FILE_CONSTANT; + decl.Declaration.Semantic = 1; + decl.Semantic.SemanticName = name; + decl.Semantic.SemanticIndex = index; + decl.DeclarationRange.First = first; + decl.DeclarationRange.Last = last; + + return decl; +} + +struct tgsi_full_declaration vl_decl_output(unsigned int name, unsigned int index, unsigned int first, unsigned int last) +{ + struct tgsi_full_declaration decl = tgsi_default_full_declaration(); + + decl.Declaration.File = TGSI_FILE_OUTPUT; + decl.Declaration.Semantic = 1; + decl.Semantic.SemanticName = name; + decl.Semantic.SemanticIndex = index; + decl.DeclarationRange.First = first; + decl.DeclarationRange.Last = last; + + return decl; +} + +struct tgsi_full_declaration vl_decl_temps(unsigned int first, unsigned int last) +{ + struct tgsi_full_declaration decl = tgsi_default_full_declaration(); + + decl = tgsi_default_full_declaration(); + decl.Declaration.File = TGSI_FILE_TEMPORARY; + decl.DeclarationRange.First = first; + decl.DeclarationRange.Last = last; + + return decl; +} + +struct tgsi_full_declaration vl_decl_samplers(unsigned int first, unsigned int last) +{ + struct tgsi_full_declaration decl = tgsi_default_full_declaration(); + + decl = tgsi_default_full_declaration(); + decl.Declaration.File = TGSI_FILE_SAMPLER; + decl.DeclarationRange.First = first; + decl.DeclarationRange.Last = last; + + return decl; +} + +struct tgsi_full_instruction vl_inst2 +( + int opcode, + enum tgsi_file_type dst_file, + unsigned int dst_index, + enum tgsi_file_type src_file, + unsigned int src_index +) +{ + struct tgsi_full_instruction inst = tgsi_default_full_instruction(); + + inst.Instruction.Opcode = opcode; + inst.Instruction.NumDstRegs = 1; + inst.FullDstRegisters[0].DstRegister.File = dst_file; + inst.FullDstRegisters[0].DstRegister.Index = dst_index; + inst.Instruction.NumSrcRegs = 1; + inst.FullSrcRegisters[0].SrcRegister.File = src_file; + inst.FullSrcRegisters[0].SrcRegister.Index = src_index; + + return inst; +} + +struct tgsi_full_instruction vl_inst3 +( + int opcode, + enum tgsi_file_type dst_file, + unsigned int dst_index, + enum tgsi_file_type src1_file, + unsigned int src1_index, + enum tgsi_file_type src2_file, + unsigned int src2_index +) +{ + struct tgsi_full_instruction inst = tgsi_default_full_instruction(); + + inst.Instruction.Opcode = opcode; + inst.Instruction.NumDstRegs = 1; + inst.FullDstRegisters[0].DstRegister.File = dst_file; + inst.FullDstRegisters[0].DstRegister.Index = dst_index; + inst.Instruction.NumSrcRegs = 2; + inst.FullSrcRegisters[0].SrcRegister.File = src1_file; + inst.FullSrcRegisters[0].SrcRegister.Index = src1_index; + inst.FullSrcRegisters[1].SrcRegister.File = src2_file; + inst.FullSrcRegisters[1].SrcRegister.Index = src2_index; + + return inst; +} + +struct tgsi_full_instruction vl_tex +( + int tex, + enum tgsi_file_type dst_file, + unsigned int dst_index, + enum tgsi_file_type src1_file, + unsigned int src1_index, + enum tgsi_file_type src2_file, + unsigned int src2_index +) +{ + struct tgsi_full_instruction inst = tgsi_default_full_instruction(); + + inst.Instruction.Opcode = TGSI_OPCODE_TEX; + inst.Instruction.NumDstRegs = 1; + inst.FullDstRegisters[0].DstRegister.File = dst_file; + inst.FullDstRegisters[0].DstRegister.Index = dst_index; + inst.Instruction.NumSrcRegs = 2; + inst.InstructionExtTexture.Texture = tex; + inst.FullSrcRegisters[0].SrcRegister.File = src1_file; + inst.FullSrcRegisters[0].SrcRegister.Index = src1_index; + inst.FullSrcRegisters[1].SrcRegister.File = src2_file; + inst.FullSrcRegisters[1].SrcRegister.Index = src2_index; + + return inst; +} + +struct tgsi_full_instruction vl_inst4 +( + int opcode, + enum tgsi_file_type dst_file, + unsigned int dst_index, + enum tgsi_file_type src1_file, + unsigned int src1_index, + enum tgsi_file_type src2_file, + unsigned int src2_index, + enum tgsi_file_type src3_file, + unsigned int src3_index +) +{ + struct tgsi_full_instruction inst = tgsi_default_full_instruction(); + + inst.Instruction.Opcode = opcode; + inst.Instruction.NumDstRegs = 1; + inst.FullDstRegisters[0].DstRegister.File = dst_file; + inst.FullDstRegisters[0].DstRegister.Index = dst_index; + inst.Instruction.NumSrcRegs = 3; + inst.FullSrcRegisters[0].SrcRegister.File = src1_file; + inst.FullSrcRegisters[0].SrcRegister.Index = src1_index; + inst.FullSrcRegisters[1].SrcRegister.File = src2_file; + inst.FullSrcRegisters[1].SrcRegister.Index = src2_index; + inst.FullSrcRegisters[2].SrcRegister.File = src3_file; + inst.FullSrcRegisters[2].SrcRegister.Index = src3_index; + + return inst; +} + +struct tgsi_full_instruction vl_end(void) +{ + struct tgsi_full_instruction inst = tgsi_default_full_instruction(); + + inst.Instruction.Opcode = TGSI_OPCODE_END; + inst.Instruction.NumDstRegs = 0; + inst.Instruction.NumSrcRegs = 0; + + return inst; +} diff --git a/src/gallium/auxiliary/vl/vl_shader_build.h b/src/gallium/auxiliary/vl/vl_shader_build.h new file mode 100644 index 0000000000..c6c60b5552 --- /dev/null +++ b/src/gallium/auxiliary/vl/vl_shader_build.h @@ -0,0 +1,61 @@ +#ifndef vl_shader_build_h +#define vl_shader_build_h + +#include + +struct tgsi_full_declaration vl_decl_input(unsigned int name, unsigned int index, unsigned int first, unsigned int last); +struct tgsi_full_declaration vl_decl_interpolated_input +( + unsigned int name, + unsigned int index, + unsigned int first, + unsigned int last, + int interpolation +); +struct tgsi_full_declaration vl_decl_constants(unsigned int name, unsigned int index, unsigned int first, unsigned int last); +struct tgsi_full_declaration vl_decl_output(unsigned int name, unsigned int index, unsigned int first, unsigned int last); +struct tgsi_full_declaration vl_decl_temps(unsigned int first, unsigned int last); +struct tgsi_full_declaration vl_decl_samplers(unsigned int first, unsigned int last); +struct tgsi_full_instruction vl_inst2 +( + int opcode, + enum tgsi_file_type dst_file, + unsigned int dst_index, + enum tgsi_file_type src_file, + unsigned int src_index +); +struct tgsi_full_instruction vl_inst3 +( + int opcode, + enum tgsi_file_type dst_file, + unsigned int dst_index, + enum tgsi_file_type src1_file, + unsigned int src1_index, + enum tgsi_file_type src2_file, + unsigned int src2_index +); +struct tgsi_full_instruction vl_tex +( + int tex, + enum tgsi_file_type dst_file, + unsigned int dst_index, + enum tgsi_file_type src1_file, + unsigned int src1_index, + enum tgsi_file_type src2_file, + unsigned int src2_index +); +struct tgsi_full_instruction vl_inst4 +( + int opcode, + enum tgsi_file_type dst_file, + unsigned int dst_index, + enum tgsi_file_type src1_file, + unsigned int src1_index, + enum tgsi_file_type src2_file, + unsigned int src2_index, + enum tgsi_file_type src3_file, + unsigned int src3_index +); +struct tgsi_full_instruction vl_end(void); + +#endif diff --git a/src/gallium/drivers/softpipe/Makefile b/src/gallium/drivers/softpipe/Makefile index 6ab3753762..bcb887a0b2 100644 --- a/src/gallium/drivers/softpipe/Makefile +++ b/src/gallium/drivers/softpipe/Makefile @@ -31,6 +31,7 @@ C_SOURCES = \ sp_tex_sample.c \ sp_tex_tile_cache.c \ sp_tile_cache.c \ - sp_surface.c + sp_surface.c \ + sp_video_context.c include ../../Makefile.template diff --git a/src/gallium/drivers/softpipe/SConscript b/src/gallium/drivers/softpipe/SConscript index 950c3d9955..aac9edf44e 100644 --- a/src/gallium/drivers/softpipe/SConscript +++ b/src/gallium/drivers/softpipe/SConscript @@ -33,6 +33,7 @@ softpipe = env.ConvenienceLibrary( 'sp_tex_tile_cache.c', 'sp_texture.c', 'sp_tile_cache.c', + 'sp_video_context.c', ]) -Export('softpipe') \ No newline at end of file +Export('softpipe') diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 49b51afda7..45289380d0 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -381,6 +381,59 @@ softpipe_transfer_unmap(struct pipe_screen *screen, } } +static struct pipe_video_surface* +softpipe_video_surface_create(struct pipe_screen *screen, + enum pipe_video_chroma_format chroma_format, + unsigned width, unsigned height) +{ + struct softpipe_video_surface *sp_vsfc; + struct pipe_texture template; + + assert(screen); + assert(width && height); + + sp_vsfc = CALLOC_STRUCT(softpipe_video_surface); + if (!sp_vsfc) + return NULL; + + pipe_reference_init(&sp_vsfc->base.reference, 1); + sp_vsfc->base.screen = screen; + sp_vsfc->base.chroma_format = chroma_format; + /*sp_vsfc->base.surface_format = PIPE_VIDEO_SURFACE_FORMAT_VUYA;*/ + sp_vsfc->base.width = width; + sp_vsfc->base.height = height; + + memset(&template, 0, sizeof(struct pipe_texture)); + template.target = PIPE_TEXTURE_2D; + template.format = PIPE_FORMAT_X8R8G8B8_UNORM; + template.last_level = 0; + /* vl_mpeg12_mc_renderer expects this when it's initialized with pot_buffers=true */ + template.width[0] = util_next_power_of_two(width); + template.height[0] = util_next_power_of_two(height); + template.depth[0] = 1; + pf_get_block(template.format, &template.block); + template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_RENDER_TARGET; + + sp_vsfc->tex = screen->texture_create(screen, &template); + if (!sp_vsfc->tex) + { + FREE(sp_vsfc); + return NULL; + } + + return &sp_vsfc->base; +} + + +static void +softpipe_video_surface_destroy(struct pipe_video_surface *vsfc) +{ + struct softpipe_video_surface *sp_vsfc = softpipe_video_surface(vsfc); + + pipe_texture_reference(&sp_vsfc->tex, NULL); + FREE(sp_vsfc); +} + void softpipe_init_screen_texture_funcs(struct pipe_screen *screen) @@ -396,6 +449,9 @@ softpipe_init_screen_texture_funcs(struct pipe_screen *screen) screen->tex_transfer_destroy = softpipe_tex_transfer_destroy; screen->transfer_map = softpipe_transfer_map; screen->transfer_unmap = softpipe_transfer_unmap; + + screen->video_surface_create = softpipe_video_surface_create; + screen->video_surface_destroy = softpipe_video_surface_destroy; } diff --git a/src/gallium/drivers/softpipe/sp_texture.h b/src/gallium/drivers/softpipe/sp_texture.h index 2537ab6a40..2ef64e1e7c 100644 --- a/src/gallium/drivers/softpipe/sp_texture.h +++ b/src/gallium/drivers/softpipe/sp_texture.h @@ -30,6 +30,7 @@ #include "pipe/p_state.h" +#include "pipe/p_video_state.h" struct pipe_context; @@ -62,6 +63,15 @@ struct softpipe_transfer unsigned long offset; }; +struct softpipe_video_surface +{ + struct pipe_video_surface base; + + /* The data is held here: + */ + struct pipe_texture *tex; +}; + /** cast wrappers */ static INLINE struct softpipe_texture * @@ -76,6 +86,12 @@ softpipe_transfer(struct pipe_transfer *pt) return (struct softpipe_transfer *) pt; } +static INLINE struct softpipe_video_surface * +softpipe_video_surface(struct pipe_video_surface *pvs) +{ + return (struct softpipe_video_surface *) pvs; +} + extern void softpipe_init_screen_texture_funcs(struct pipe_screen *screen); diff --git a/src/gallium/drivers/softpipe/sp_video_context.c b/src/gallium/drivers/softpipe/sp_video_context.c new file mode 100644 index 0000000000..1b47bbede2 --- /dev/null +++ b/src/gallium/drivers/softpipe/sp_video_context.c @@ -0,0 +1,273 @@ +#include "sp_video_context.h" +#include +#include +#include "softpipe/sp_winsys.h" +#include "softpipe/sp_texture.h" + +static void +sp_mpeg12_destroy(struct pipe_video_context *vpipe) +{ + struct sp_mpeg12_context *ctx = (struct sp_mpeg12_context*)vpipe; + + assert(vpipe); + + /* Asserted in softpipe_delete_fs_state() for some reason */ + ctx->pipe->bind_vs_state(ctx->pipe, NULL); + ctx->pipe->bind_fs_state(ctx->pipe, NULL); + + ctx->pipe->delete_blend_state(ctx->pipe, ctx->blend); + ctx->pipe->delete_rasterizer_state(ctx->pipe, ctx->rast); + ctx->pipe->delete_depth_stencil_alpha_state(ctx->pipe, ctx->dsa); + + pipe_video_surface_reference(&ctx->decode_target, NULL); + vl_compositor_cleanup(&ctx->compositor); + vl_mpeg12_mc_renderer_cleanup(&ctx->mc_renderer); + ctx->pipe->destroy(ctx->pipe); + + FREE(ctx); +} + +static void +sp_mpeg12_decode_macroblocks(struct pipe_video_context *vpipe, + struct pipe_video_surface *past, + struct pipe_video_surface *future, + unsigned num_macroblocks, + struct pipe_macroblock *macroblocks, + struct pipe_fence_handle **fence) +{ + struct sp_mpeg12_context *ctx = (struct sp_mpeg12_context*)vpipe; + struct pipe_mpeg12_macroblock *mpeg12_macroblocks = (struct pipe_mpeg12_macroblock*)macroblocks; + + assert(vpipe); + assert(num_macroblocks); + assert(macroblocks); + assert(macroblocks->codec == PIPE_VIDEO_CODEC_MPEG12); + assert(ctx->decode_target); + + vl_mpeg12_mc_renderer_render_macroblocks(&ctx->mc_renderer, + softpipe_video_surface(ctx->decode_target)->tex, + past ? softpipe_video_surface(past)->tex : NULL, + future ? softpipe_video_surface(future)->tex : NULL, + num_macroblocks, mpeg12_macroblocks, fence); +} + +static void +sp_mpeg12_clear_surface(struct pipe_video_context *vpipe, + unsigned x, unsigned y, + unsigned width, unsigned height, + unsigned value, + struct pipe_surface *surface) +{ + struct sp_mpeg12_context *ctx = (struct sp_mpeg12_context*)vpipe; + + assert(vpipe); + assert(surface); + + ctx->pipe->surface_fill(ctx->pipe, surface, x, y, width, height, value); +} + +static void +sp_mpeg12_render_picture(struct pipe_video_context *vpipe, + /*struct pipe_surface *backround, + struct pipe_video_rect *backround_area,*/ + struct pipe_video_surface *src_surface, + enum pipe_mpeg12_picture_type picture_type, + /*unsigned num_past_surfaces, + struct pipe_video_surface *past_surfaces, + unsigned num_future_surfaces, + struct pipe_video_surface *future_surfaces,*/ + struct pipe_video_rect *src_area, + struct pipe_surface *dst_surface, + struct pipe_video_rect *dst_area, + /*unsigned num_layers, + struct pipe_surface *layers, + struct pipe_video_rect *layer_src_areas, + struct pipe_video_rect *layer_dst_areas*/ + struct pipe_fence_handle **fence) +{ + struct sp_mpeg12_context *ctx = (struct sp_mpeg12_context*)vpipe; + + assert(vpipe); + assert(src_surface); + assert(src_area); + assert(dst_surface); + assert(dst_area); + + vl_compositor_render(&ctx->compositor, softpipe_video_surface(src_surface)->tex, + picture_type, src_area, dst_surface->texture, dst_area, fence); +} + +static void +sp_mpeg12_set_decode_target(struct pipe_video_context *vpipe, + struct pipe_video_surface *dt) +{ + struct sp_mpeg12_context *ctx = (struct sp_mpeg12_context*)vpipe; + + assert(vpipe); + assert(dt); + + pipe_video_surface_reference(&ctx->decode_target, dt); +} + +static bool +init_pipe_state(struct sp_mpeg12_context *ctx) +{ + struct pipe_rasterizer_state rast; + struct pipe_blend_state blend; + struct pipe_depth_stencil_alpha_state dsa; + + assert(ctx); + + rast.flatshade = 1; + rast.flatshade_first = 0; + rast.light_twoside = 0; + rast.front_winding = PIPE_WINDING_CCW; + rast.cull_mode = PIPE_WINDING_CW; + rast.fill_cw = PIPE_POLYGON_MODE_FILL; + rast.fill_ccw = PIPE_POLYGON_MODE_FILL; + rast.offset_cw = 0; + rast.offset_ccw = 0; + rast.scissor = 0; + rast.poly_smooth = 0; + rast.poly_stipple_enable = 0; + rast.point_sprite = 0; + rast.point_size_per_vertex = 0; + rast.multisample = 0; + rast.line_smooth = 0; + rast.line_stipple_enable = 0; + rast.line_stipple_factor = 0; + rast.line_stipple_pattern = 0; + rast.line_last_pixel = 0; + rast.bypass_vs_clip_and_viewport = 0; + rast.line_width = 1; + rast.point_smooth = 0; + rast.point_size = 1; + rast.offset_units = 1; + rast.offset_scale = 1; + /*rast.sprite_coord_mode[i] = ;*/ + ctx->rast = ctx->pipe->create_rasterizer_state(ctx->pipe, &rast); + ctx->pipe->bind_rasterizer_state(ctx->pipe, ctx->rast); + + blend.blend_enable = 0; + blend.rgb_func = PIPE_BLEND_ADD; + blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE; + blend.rgb_dst_factor = PIPE_BLENDFACTOR_ONE; + blend.alpha_func = PIPE_BLEND_ADD; + blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE; + blend.alpha_dst_factor = PIPE_BLENDFACTOR_ONE; + blend.logicop_enable = 0; + blend.logicop_func = PIPE_LOGICOP_CLEAR; + /* Needed to allow color writes to FB, even if blending disabled */ + blend.colormask = PIPE_MASK_RGBA; + blend.dither = 0; + ctx->blend = ctx->pipe->create_blend_state(ctx->pipe, &blend); + ctx->pipe->bind_blend_state(ctx->pipe, ctx->blend); + + dsa.depth.enabled = 0; + dsa.depth.writemask = 0; + dsa.depth.func = PIPE_FUNC_ALWAYS; + dsa.depth.occlusion_count = 0; + for (unsigned i = 0; i < 2; ++i) + { + dsa.stencil[i].enabled = 0; + dsa.stencil[i].func = PIPE_FUNC_ALWAYS; + dsa.stencil[i].fail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[i].zpass_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[i].zfail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[i].ref_value = 0; + dsa.stencil[i].valuemask = 0; + dsa.stencil[i].writemask = 0; + } + dsa.alpha.enabled = 0; + dsa.alpha.func = PIPE_FUNC_ALWAYS; + dsa.alpha.ref_value = 0; + ctx->dsa = ctx->pipe->create_depth_stencil_alpha_state(ctx->pipe, &dsa); + ctx->pipe->bind_depth_stencil_alpha_state(ctx->pipe, ctx->dsa); + + return true; +} + +static struct pipe_video_context * +sp_mpeg12_create(struct pipe_screen *screen, enum pipe_video_profile profile, + enum pipe_video_chroma_format chroma_format, + unsigned width, unsigned height) +{ + struct sp_mpeg12_context *ctx; + + assert(u_reduce_video_profile(profile) == PIPE_VIDEO_CODEC_MPEG12); + + ctx = CALLOC_STRUCT(sp_mpeg12_context); + + if (!ctx) + return NULL; + + ctx->base.profile = profile; + ctx->base.chroma_format = chroma_format; + ctx->base.width = width; + ctx->base.height = height; + + ctx->base.screen = screen; + ctx->base.destroy = sp_mpeg12_destroy; + ctx->base.decode_macroblocks = sp_mpeg12_decode_macroblocks; + ctx->base.clear_surface = sp_mpeg12_clear_surface; + ctx->base.render_picture = sp_mpeg12_render_picture; + ctx->base.set_decode_target = sp_mpeg12_set_decode_target; + + ctx->pipe = softpipe_create(screen); + if (!ctx->pipe) + { + FREE(ctx); + return NULL; + } + + /* TODO: Use slice buffering for softpipe when implemented, no advantage to buffering an entire picture */ + if (!vl_mpeg12_mc_renderer_init(&ctx->mc_renderer, ctx->pipe, + width, height, chroma_format, + VL_MPEG12_MC_RENDERER_BUFFER_PICTURE, + /* TODO: Use XFER_NONE when implemented */ + VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE, + true)) + { + ctx->pipe->destroy(ctx->pipe); + FREE(ctx); + return NULL; + } + + if (!vl_compositor_init(&ctx->compositor, ctx->pipe)) + { + vl_mpeg12_mc_renderer_cleanup(&ctx->mc_renderer); + ctx->pipe->destroy(ctx->pipe); + FREE(ctx); + return NULL; + } + + if (!init_pipe_state(ctx)) + { + vl_compositor_cleanup(&ctx->compositor); + vl_mpeg12_mc_renderer_cleanup(&ctx->mc_renderer); + ctx->pipe->destroy(ctx->pipe); + FREE(ctx); + return NULL; + } + + return &ctx->base; +} + +struct pipe_video_context * +sp_video_create(struct pipe_screen *screen, enum pipe_video_profile profile, + enum pipe_video_chroma_format chroma_format, + unsigned width, unsigned height) +{ + assert(screen); + assert(width && height); + + switch (u_reduce_video_profile(profile)) + { + case PIPE_VIDEO_CODEC_MPEG12: + return sp_mpeg12_create(screen, profile, + chroma_format, + width, height); + default: + return NULL; + } +} diff --git a/src/gallium/drivers/softpipe/sp_video_context.h b/src/gallium/drivers/softpipe/sp_video_context.h new file mode 100644 index 0000000000..a70ce9f476 --- /dev/null +++ b/src/gallium/drivers/softpipe/sp_video_context.h @@ -0,0 +1,30 @@ +#ifndef SP_VIDEO_CONTEXT_H +#define SP_VIDEO_CONTEXT_H + +#include +#include +#include + +struct pipe_screen; +struct pipe_context; +struct pipe_video_surface; + +struct sp_mpeg12_context +{ + struct pipe_video_context base; + struct pipe_context *pipe; + struct pipe_video_surface *decode_target; + struct vl_mpeg12_mc_renderer mc_renderer; + struct vl_compositor compositor; + + void *rast; + void *dsa; + void *blend; +}; + +struct pipe_video_context * +sp_video_create(struct pipe_screen *screen, enum pipe_video_profile profile, + enum pipe_video_chroma_format chroma_format, + unsigned width, unsigned height); + +#endif /* SP_VIDEO_CONTEXT_H */ diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index f252d6df00..1980831dd9 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -315,6 +315,30 @@ enum pipe_transfer_usage { #define PIPE_REFERENCED_FOR_READ (1 << 0) #define PIPE_REFERENCED_FOR_WRITE (1 << 1) + +enum pipe_video_codec +{ + PIPE_VIDEO_CODEC_MPEG12, /**< MPEG1, MPEG2 */ + PIPE_VIDEO_CODEC_MPEG4, /**< DIVX, XVID */ + PIPE_VIDEO_CODEC_VC1, /**< WMV */ + PIPE_VIDEO_CODEC_MPEG4_AVC /**< H.264 */ +}; + +enum pipe_video_profile +{ + PIPE_VIDEO_PROFILE_MPEG1, + PIPE_VIDEO_PROFILE_MPEG2_SIMPLE, + PIPE_VIDEO_PROFILE_MPEG2_MAIN, + PIPE_VIDEO_PROFILE_MPEG4_SIMPLE, + PIPE_VIDEO_PROFILE_MPEG4_ADVANCED_SIMPLE, + PIPE_VIDEO_PROFILE_VC1_SIMPLE, + PIPE_VIDEO_PROFILE_VC1_MAIN, + PIPE_VIDEO_PROFILE_VC1_ADVANCED, + PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE, + PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN, + PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH +}; + #ifdef __cplusplus } #endif diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index c4469d4a9e..af23080920 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -613,6 +613,24 @@ pf_has_alpha( enum pipe_format format ) } } +enum pipe_video_chroma_format +{ + PIPE_VIDEO_CHROMA_FORMAT_420, + PIPE_VIDEO_CHROMA_FORMAT_422, + PIPE_VIDEO_CHROMA_FORMAT_444 +}; + +#if 0 +enum pipe_video_surface_format +{ + PIPE_VIDEO_SURFACE_FORMAT_NV12, /**< Planar; Y plane, UV plane */ + PIPE_VIDEO_SURFACE_FORMAT_YV12, /**< Planar; Y plane, U plane, V plane */ + PIPE_VIDEO_SURFACE_FORMAT_YUYV, /**< Interleaved; Y,U,Y,V,Y,U,Y,V */ + PIPE_VIDEO_SURFACE_FORMAT_UYVY, /**< Interleaved; U,Y,V,Y,U,Y,V,Y */ + PIPE_VIDEO_SURFACE_FORMAT_VUYA /**< Packed; A31-24|Y23-16|U15-8|V7-0 */ +}; +#endif + #ifdef __cplusplus } #endif diff --git a/src/gallium/include/pipe/p_screen.h b/src/gallium/include/pipe/p_screen.h index 3f30c52a16..f0a4de5df3 100644 --- a/src/gallium/include/pipe/p_screen.h +++ b/src/gallium/include/pipe/p_screen.h @@ -53,7 +53,10 @@ extern "C" { struct pipe_fence_handle; struct pipe_winsys; struct pipe_buffer; - +struct pipe_texture; +struct pipe_surface; +struct pipe_video_surface; +struct pipe_transfer; /** @@ -252,6 +255,17 @@ struct pipe_screen { void (*buffer_destroy)( struct pipe_buffer *buf ); + /** + * Create a video surface suitable for use as a decoding target by the + * driver's pipe_video_context. + */ + struct pipe_video_surface* + (*video_surface_create)( struct pipe_screen *screen, + enum pipe_video_chroma_format chroma_format, + unsigned width, unsigned height ); + + void (*video_surface_destroy)( struct pipe_video_surface *vsfc ); + /** * Do any special operations to ensure frontbuffer contents are diff --git a/src/gallium/include/pipe/p_video_context.h b/src/gallium/include/pipe/p_video_context.h new file mode 100644 index 0000000000..937705ac50 --- /dev/null +++ b/src/gallium/include/pipe/p_video_context.h @@ -0,0 +1,92 @@ +#ifndef PIPE_VIDEO_CONTEXT_H +#define PIPE_VIDEO_CONTEXT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +struct pipe_screen; +struct pipe_buffer; +struct pipe_surface; +struct pipe_video_surface; +struct pipe_macroblock; +struct pipe_picture_desc; +struct pipe_fence_handle; + +/** + * Gallium video rendering context + */ +struct pipe_video_context +{ + struct pipe_screen *screen; + enum pipe_video_profile profile; + enum pipe_video_chroma_format chroma_format; + unsigned width; + unsigned height; + + void *priv; /**< context private data (for DRI for example) */ + + void (*destroy)(struct pipe_video_context *vpipe); + + /** + * Picture decoding and displaying + */ + /*@{*/ + void (*decode_bitstream)(struct pipe_video_context *vpipe, + unsigned num_bufs, + struct pipe_buffer **bitstream_buf); + + void (*decode_macroblocks)(struct pipe_video_context *vpipe, + struct pipe_video_surface *past, + struct pipe_video_surface *future, + unsigned num_macroblocks, + struct pipe_macroblock *macroblocks, + struct pipe_fence_handle **fence); + + void (*clear_surface)(struct pipe_video_context *vpipe, + unsigned x, unsigned y, + unsigned width, unsigned height, + unsigned value, + struct pipe_surface *surface); + + void (*render_picture)(struct pipe_video_context *vpipe, + /*struct pipe_surface *backround, + struct pipe_video_rect *backround_area,*/ + struct pipe_video_surface *src_surface, + enum pipe_mpeg12_picture_type picture_type, + /*unsigned num_past_surfaces, + struct pipe_video_surface *past_surfaces, + unsigned num_future_surfaces, + struct pipe_video_surface *future_surfaces,*/ + struct pipe_video_rect *src_area, + struct pipe_surface *dst_surface, + struct pipe_video_rect *dst_area, + /*unsigned num_layers, + struct pipe_texture *layers, + struct pipe_video_rect *layer_src_areas, + struct pipe_video_rect *layer_dst_areas,*/ + struct pipe_fence_handle **fence); + /*@}*/ + + /** + * Parameter-like states (or properties) + */ + /*@{*/ + void (*set_picture_desc)(struct pipe_video_context *vpipe, + const struct pipe_picture_desc *desc); + + void (*set_decode_target)(struct pipe_video_context *vpipe, + struct pipe_video_surface *dt); + + /* TODO: Interface for CSC matrix, scaling modes, post-processing, etc. */ + /*@}*/ +}; + + +#ifdef __cplusplus +} +#endif + +#endif /* PIPE_VIDEO_CONTEXT_H */ diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h new file mode 100644 index 0000000000..a0128fbd48 --- /dev/null +++ b/src/gallium/include/pipe/p_video_state.h @@ -0,0 +1,158 @@ +#ifndef PIPE_VIDEO_STATE_H +#define PIPE_VIDEO_STATE_H + +/* u_reduce_video_profile() needs these */ +#include +#include + +#include +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +struct pipe_video_surface +{ + struct pipe_reference reference; + struct pipe_screen *screen; + enum pipe_video_chroma_format chroma_format; + /*enum pipe_video_surface_format surface_format;*/ + unsigned width; + unsigned height; +}; + +static INLINE void +pipe_video_surface_reference(struct pipe_video_surface **ptr, struct pipe_video_surface *surf) +{ + struct pipe_video_surface *old_surf = *ptr; + + if (pipe_reference((struct pipe_reference **)ptr, &surf->reference)) + old_surf->screen->video_surface_destroy(old_surf); +} + +struct pipe_video_rect +{ + unsigned x, y, w, h; +}; + +static INLINE enum pipe_video_codec +u_reduce_video_profile(enum pipe_video_profile profile) +{ + switch (profile) + { + case PIPE_VIDEO_PROFILE_MPEG1: + case PIPE_VIDEO_PROFILE_MPEG2_SIMPLE: + case PIPE_VIDEO_PROFILE_MPEG2_MAIN: + return PIPE_VIDEO_CODEC_MPEG12; + + case PIPE_VIDEO_PROFILE_MPEG4_SIMPLE: + case PIPE_VIDEO_PROFILE_MPEG4_ADVANCED_SIMPLE: + return PIPE_VIDEO_CODEC_MPEG4; + + case PIPE_VIDEO_PROFILE_VC1_SIMPLE: + case PIPE_VIDEO_PROFILE_VC1_MAIN: + case PIPE_VIDEO_PROFILE_VC1_ADVANCED: + return PIPE_VIDEO_CODEC_VC1; + + case PIPE_VIDEO_PROFILE_MPEG4_AVC_BASELINE: + case PIPE_VIDEO_PROFILE_MPEG4_AVC_MAIN: + case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH: + return PIPE_VIDEO_CODEC_MPEG4_AVC; + + default: + assert(false); + } + + return -1; +} + +enum pipe_mpeg12_picture_type +{ + PIPE_MPEG12_PICTURE_TYPE_FIELD_TOP, + PIPE_MPEG12_PICTURE_TYPE_FIELD_BOTTOM, + PIPE_MPEG12_PICTURE_TYPE_FRAME +}; + +enum pipe_mpeg12_macroblock_type +{ + PIPE_MPEG12_MACROBLOCK_TYPE_INTRA, + PIPE_MPEG12_MACROBLOCK_TYPE_FWD, + PIPE_MPEG12_MACROBLOCK_TYPE_BKWD, + PIPE_MPEG12_MACROBLOCK_TYPE_BI, + + PIPE_MPEG12_MACROBLOCK_NUM_TYPES +}; + +enum pipe_mpeg12_motion_type +{ + PIPE_MPEG12_MOTION_TYPE_FIELD, + PIPE_MPEG12_MOTION_TYPE_FRAME, + PIPE_MPEG12_MOTION_TYPE_DUALPRIME, + PIPE_MPEG12_MOTION_TYPE_16x8 +}; + +enum pipe_mpeg12_dct_type +{ + PIPE_MPEG12_DCT_TYPE_FIELD, + PIPE_MPEG12_DCT_TYPE_FRAME +}; + +struct pipe_macroblock +{ + enum pipe_video_codec codec; +}; + +struct pipe_mpeg12_macroblock +{ + struct pipe_macroblock base; + + unsigned mbx; + unsigned mby; + enum pipe_mpeg12_macroblock_type mb_type; + enum pipe_mpeg12_motion_type mo_type; + enum pipe_mpeg12_dct_type dct_type; + signed pmv[2][2][2]; + unsigned cbp; + void *blocks; +}; + +#if 0 +struct pipe_picture_desc +{ + enum pipe_video_format format; +}; + +struct pipe_mpeg12_picture_desc +{ + struct pipe_picture_desc base; + + /* TODO: Use bitfields where possible? */ + struct pipe_surface *forward_reference; + struct pipe_surface *backward_reference; + unsigned picture_coding_type; + unsigned fcode; + unsigned intra_dc_precision; + unsigned picture_structure; + unsigned top_field_first; + unsigned frame_pred_frame_dct; + unsigned concealment_motion_vectors; + unsigned q_scale_type; + unsigned intra_vlc_format; + unsigned alternate_scan; + unsigned full_pel_forward_vector; + unsigned full_pel_backward_vector; + struct pipe_buffer *intra_quantizer_matrix; + struct pipe_buffer *non_intra_quantizer_matrix; + struct pipe_buffer *chroma_intra_quantizer_matrix; + struct pipe_buffer *chroma_non_intra_quantizer_matrix; +}; +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* PIPE_VIDEO_STATE_H */ -- cgit v1.2.3 From 7116ae857c6ef3809c712e96b28bd69d92b3cd33 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:08:49 -0600 Subject: mesa: make some s3tc/fxt1 functions public --- src/mesa/main/texcompress_fxt1.c | 45 ++++++++++--------- src/mesa/main/texcompress_fxt1.h | 51 +++++++++++++++++++++ src/mesa/main/texcompress_s3tc.c | 97 ++++++++++++++++++++-------------------- src/mesa/main/texcompress_s3tc.h | 73 ++++++++++++++++++++++++++++++ 4 files changed, 196 insertions(+), 70 deletions(-) create mode 100644 src/mesa/main/texcompress_fxt1.h create mode 100644 src/mesa/main/texcompress_s3tc.h (limited to 'src') diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index fc151605c9..e3ac37999c 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -37,6 +37,7 @@ #include "image.h" #include "mipmap.h" #include "texcompress.h" +#include "texcompress_fxt1.h" #include "texformat.h" #include "texstore.h" @@ -64,8 +65,8 @@ _mesa_init_texture_fxt1( GLcontext *ctx ) /** * Called via TexFormat->StoreImage to store an RGB_FXT1 texture. */ -static GLboolean -texstore_rgb_fxt1(TEXSTORE_PARAMS) +GLboolean +_mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS) { const GLchan *pixels; GLint srcRowStride; @@ -121,8 +122,8 @@ texstore_rgb_fxt1(TEXSTORE_PARAMS) /** * Called via TexFormat->StoreImage to store an RGBA_FXT1 texture. */ -static GLboolean -texstore_rgba_fxt1(TEXSTORE_PARAMS) +GLboolean +_mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) { const GLchan *pixels; GLint srcRowStride; @@ -175,18 +176,18 @@ texstore_rgba_fxt1(TEXSTORE_PARAMS) } -static void -fetch_texel_2d_rgba_fxt1( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +void +_mesa_fetch_texel_2d_rgba_fxt1( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) { (void) k; fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, texel); } -static void -fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +void +_mesa_fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { /* just sample as GLchan and convert to float here */ GLchan rgba[4]; @@ -199,9 +200,9 @@ fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage, } -static void -fetch_texel_2d_rgb_fxt1( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) +void +_mesa_fetch_texel_2d_rgb_fxt1( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel ) { (void) k; fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, texel); @@ -209,9 +210,9 @@ fetch_texel_2d_rgb_fxt1( const struct gl_texture_image *texImage, } -static void -fetch_texel_2d_f_rgb_fxt1( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +void +_mesa_fetch_texel_2d_f_rgb_fxt1( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { /* just sample as GLchan and convert to float here */ GLchan rgba[4]; @@ -239,12 +240,12 @@ const struct gl_texture_format _mesa_texformat_rgb_fxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - texstore_rgb_fxt1, /* StoreTexImageFunc */ + _mesa_texstore_rgb_fxt1, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ - fetch_texel_2d_rgb_fxt1, /* FetchTexel2D */ + _mesa_fetch_texel_2d_rgb_fxt1, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - fetch_texel_2d_f_rgb_fxt1, /* FetchTexel2Df */ + _mesa_fetch_texel_2d_f_rgb_fxt1, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; @@ -263,12 +264,12 @@ const struct gl_texture_format _mesa_texformat_rgba_fxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - texstore_rgba_fxt1, /* StoreTexImageFunc */ + _mesa_texstore_rgba_fxt1, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ - fetch_texel_2d_rgba_fxt1, /* FetchTexel2D */ + _mesa_fetch_texel_2d_rgba_fxt1, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - fetch_texel_2d_f_rgba_fxt1, /* FetchTexel2Df */ + _mesa_fetch_texel_2d_f_rgba_fxt1, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; diff --git a/src/mesa/main/texcompress_fxt1.h b/src/mesa/main/texcompress_fxt1.h new file mode 100644 index 0000000000..a9ddce9a8c --- /dev/null +++ b/src/mesa/main/texcompress_fxt1.h @@ -0,0 +1,51 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef TEXCOMPRESS_FXT1_H +#define TEXCOMPRESS_FXT1_H + +extern GLboolean +_mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS); + +extern GLboolean +_mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS); + +extern void +_mesa_fetch_texel_2d_rgba_fxt1(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel); + +extern void +_mesa_fetch_texel_2d_f_rgba_fxt1(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel); + +extern void +_mesa_fetch_texel_2d_rgb_fxt1(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texel); + +extern void +_mesa_fetch_texel_2d_f_rgb_fxt1(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel); + + +#endif /* TEXCOMPRESS_FXT1_H */ diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index a1c0f18f36..c880119c3c 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -41,6 +41,7 @@ #include "dlopen.h" #include "image.h" #include "texcompress.h" +#include "texcompress_s3tc.h" #include "texformat.h" #include "texstore.h" @@ -155,8 +156,8 @@ _mesa_init_texture_s3tc( GLcontext *ctx ) /** * Called via TexFormat->StoreImage to store an RGB_DXT1 texture. */ -static GLboolean -texstore_rgb_dxt1(TEXSTORE_PARAMS) +GLboolean +_mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS) { const GLchan *pixels; GLint srcRowStride; @@ -218,8 +219,8 @@ texstore_rgb_dxt1(TEXSTORE_PARAMS) /** * Called via TexFormat->StoreImage to store an RGBA_DXT1 texture. */ -static GLboolean -texstore_rgba_dxt1(TEXSTORE_PARAMS) +GLboolean +_mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS) { const GLchan *pixels; GLint srcRowStride; @@ -280,8 +281,8 @@ texstore_rgba_dxt1(TEXSTORE_PARAMS) /** * Called via TexFormat->StoreImage to store an RGBA_DXT3 texture. */ -static GLboolean -texstore_rgba_dxt3(TEXSTORE_PARAMS) +GLboolean +_mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS) { const GLchan *pixels; GLint srcRowStride; @@ -341,8 +342,8 @@ texstore_rgba_dxt3(TEXSTORE_PARAMS) /** * Called via TexFormat->StoreImage to store an RGBA_DXT5 texture. */ -static GLboolean -texstore_rgba_dxt5(TEXSTORE_PARAMS) +GLboolean +_mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS) { const GLchan *pixels; GLint srcRowStride; @@ -414,9 +415,9 @@ fetch_texel_2d_rgb_dxt1( const struct gl_texture_image *texImage, } -static void -fetch_texel_2d_f_rgb_dxt1( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +void +_mesa_fetch_texel_2d_f_rgb_dxt1(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { /* just sample as GLchan and convert to float here */ GLchan rgba[4]; @@ -442,9 +443,9 @@ fetch_texel_2d_rgba_dxt1( const struct gl_texture_image *texImage, } -static void -fetch_texel_2d_f_rgba_dxt1( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +void +_mesa_fetch_texel_2d_f_rgba_dxt1(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { /* just sample as GLchan and convert to float here */ GLchan rgba[4]; @@ -471,9 +472,9 @@ fetch_texel_2d_rgba_dxt3( const struct gl_texture_image *texImage, } -static void -fetch_texel_2d_f_rgba_dxt3( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +void +_mesa_fetch_texel_2d_f_rgba_dxt3(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { /* just sample as GLchan and convert to float here */ GLchan rgba[4]; @@ -499,9 +500,9 @@ fetch_texel_2d_rgba_dxt5( const struct gl_texture_image *texImage, } -static void -fetch_texel_2d_f_rgba_dxt5( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +void +_mesa_fetch_texel_2d_f_rgba_dxt5(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { /* just sample as GLchan and convert to float here */ GLchan rgba[4]; @@ -513,9 +514,9 @@ fetch_texel_2d_f_rgba_dxt5( const struct gl_texture_image *texImage, } #if FEATURE_EXT_texture_sRGB -static void -fetch_texel_2d_f_srgb_dxt1( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +void +_mesa_fetch_texel_2d_f_srgb_dxt1( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) { /* just sample as GLchan and convert to float here */ GLchan rgba[4]; @@ -526,9 +527,9 @@ fetch_texel_2d_f_srgb_dxt1( const struct gl_texture_image *texImage, texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]); } -static void -fetch_texel_2d_f_srgba_dxt1( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +void +_mesa_fetch_texel_2d_f_srgba_dxt1(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { /* just sample as GLchan and convert to float here */ GLchan rgba[4]; @@ -539,9 +540,9 @@ fetch_texel_2d_f_srgba_dxt1( const struct gl_texture_image *texImage, texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]); } -static void -fetch_texel_2d_f_srgba_dxt3( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +void +_mesa_fetch_texel_2d_f_srgba_dxt3(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { /* just sample as GLchan and convert to float here */ GLchan rgba[4]; @@ -552,9 +553,9 @@ fetch_texel_2d_f_srgba_dxt3( const struct gl_texture_image *texImage, texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]); } -static void -fetch_texel_2d_f_srgba_dxt5( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) +void +_mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel) { /* just sample as GLchan and convert to float here */ GLchan rgba[4]; @@ -580,12 +581,12 @@ const struct gl_texture_format _mesa_texformat_rgb_dxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - texstore_rgb_dxt1, /* StoreTexImageFunc */ + _mesa_texstore_rgb_dxt1, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ fetch_texel_2d_rgb_dxt1, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - fetch_texel_2d_f_rgb_dxt1, /* FetchTexel2Df */ + _mesa_fetch_texel_2d_f_rgb_dxt1, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; @@ -604,12 +605,12 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - texstore_rgba_dxt1, /* StoreTexImageFunc */ + _mesa_texstore_rgba_dxt1, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ fetch_texel_2d_rgba_dxt1, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - fetch_texel_2d_f_rgba_dxt1, /* FetchTexel2Df */ + _mesa_fetch_texel_2d_f_rgba_dxt1, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; @@ -628,12 +629,12 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt3 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - texstore_rgba_dxt3, /* StoreTexImageFunc */ + _mesa_texstore_rgba_dxt3, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ fetch_texel_2d_rgba_dxt3, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - fetch_texel_2d_f_rgba_dxt3, /* FetchTexel2Df */ + _mesa_fetch_texel_2d_f_rgba_dxt3, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; @@ -652,12 +653,12 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt5 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - texstore_rgba_dxt5, /* StoreTexImageFunc */ + _mesa_texstore_rgba_dxt5, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ fetch_texel_2d_rgba_dxt5, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - fetch_texel_2d_f_rgba_dxt5, /* FetchTexel2Df */ + _mesa_fetch_texel_2d_f_rgba_dxt5, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; @@ -677,12 +678,12 @@ const struct gl_texture_format _mesa_texformat_srgb_dxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - texstore_rgb_dxt1, /* StoreTexImageFunc */ + _mesa_texstore_rgb_dxt1, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - fetch_texel_2d_f_srgb_dxt1, /* FetchTexel2Df */ + _mesa_fetch_texel_2d_f_srgb_dxt1, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; @@ -701,12 +702,12 @@ const struct gl_texture_format _mesa_texformat_srgba_dxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - texstore_rgba_dxt1, /* StoreTexImageFunc */ + _mesa_texstore_rgba_dxt1, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - fetch_texel_2d_f_srgba_dxt1, /* FetchTexel2Df */ + _mesa_fetch_texel_2d_f_srgba_dxt1, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; @@ -725,12 +726,12 @@ const struct gl_texture_format _mesa_texformat_srgba_dxt3 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - texstore_rgba_dxt3, /* StoreTexImageFunc */ + _mesa_texstore_rgba_dxt3, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - fetch_texel_2d_f_srgba_dxt3, /* FetchTexel2Df */ + _mesa_fetch_texel_2d_f_srgba_dxt3, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; @@ -749,12 +750,12 @@ const struct gl_texture_format _mesa_texformat_srgba_dxt5 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - texstore_rgba_dxt5, /* StoreTexImageFunc */ + _mesa_texstore_rgba_dxt5, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - fetch_texel_2d_f_srgba_dxt5, /* FetchTexel2Df */ + _mesa_fetch_texel_2d_f_srgba_dxt5, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; diff --git a/src/mesa/main/texcompress_s3tc.h b/src/mesa/main/texcompress_s3tc.h new file mode 100644 index 0000000000..866bb0e3d3 --- /dev/null +++ b/src/mesa/main/texcompress_s3tc.h @@ -0,0 +1,73 @@ +/* + * Mesa 3-D graphics library + * Version: 7.1 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +#ifndef TEXCOMPRESS_S3TC_H +#define TEXCOMPRESS_S3TC_H + +extern GLboolean +_mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS); + +extern GLboolean +_mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS); + +extern GLboolean +_mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS); + +extern GLboolean +_mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS); + +extern void +_mesa_fetch_texel_2d_f_rgb_dxt1(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel); + +extern void +_mesa_fetch_texel_2d_f_rgba_dxt1(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel); + +extern void +_mesa_fetch_texel_2d_f_rgba_dxt3(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel); + +extern void +_mesa_fetch_texel_2d_f_rgba_dxt5(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel); + +extern void +_mesa_fetch_texel_2d_f_srgb_dxt1(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel); + +extern void +_mesa_fetch_texel_2d_f_srgba_dxt1(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel); + +extern void +_mesa_fetch_texel_2d_f_srgba_dxt3(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel); + +extern void +_mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel); + + +#endif /* TEXCOMPRESS_S3TC_H */ -- cgit v1.2.3 From da5722bea6e2f613933d3e3da214da8cd0047d2e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:09:23 -0600 Subject: mesa: use new look-up table to get texel fetch/store funcs --- src/mesa/main/texformat.c | 822 +++++++++++++++++++++++++++++++++++++--------- src/mesa/main/texformat.h | 6 + src/mesa/main/texstore.c | 22 +- 3 files changed, 671 insertions(+), 179 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index c709004784..b6c0a252d3 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -34,6 +34,9 @@ #include "colormac.h" #include "context.h" +#include "texcompress.h" +#include "texcompress_fxt1.h" +#include "texcompress_s3tc.h" #include "texformat.h" #include "texstore.h" @@ -157,9 +160,9 @@ const struct gl_texture_format _mesa_texformat_rgba = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_rgba, /* FetchTexel1Df */ - fetch_texel_2d_f_rgba, /* FetchTexel2Df */ - fetch_texel_3d_f_rgba, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_rgba /* StoreTexel */ }; @@ -181,9 +184,9 @@ const struct gl_texture_format _mesa_texformat_rgb = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_rgb, /* FetchTexel1Df */ - fetch_texel_2d_f_rgb, /* FetchTexel2Df */ - fetch_texel_3d_f_rgb, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_rgb /* StoreTexel */ }; @@ -205,9 +208,9 @@ const struct gl_texture_format _mesa_texformat_alpha = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_alpha, /* FetchTexel1Df */ - fetch_texel_2d_f_alpha, /* FetchTexel2Df */ - fetch_texel_3d_f_alpha, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_alpha /* StoreTexel */ }; @@ -229,9 +232,9 @@ const struct gl_texture_format _mesa_texformat_luminance = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_luminance, /* FetchTexel1Df */ - fetch_texel_2d_f_luminance, /* FetchTexel2Df */ - fetch_texel_3d_f_luminance, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_luminance /* StoreTexel */ }; @@ -253,9 +256,9 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha = { 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 */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_luminance_alpha /* StoreTexel */ }; @@ -277,9 +280,9 @@ const struct gl_texture_format _mesa_texformat_intensity = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_intensity, /* FetchTexel1Df */ - fetch_texel_2d_f_intensity, /* FetchTexel2Df */ - fetch_texel_3d_f_intensity, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_intensity /* StoreTexel */ }; @@ -304,9 +307,9 @@ const struct gl_texture_format _mesa_texformat_srgb8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_srgb8, /* FetchTexel1Df */ - fetch_texel_2d_srgb8, /* FetchTexel2Df */ - fetch_texel_3d_srgb8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_srgb8 /* StoreTexel */ }; @@ -328,9 +331,9 @@ const struct gl_texture_format _mesa_texformat_srgba8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_srgba8, /* FetchTexel1Df */ - fetch_texel_2d_srgba8, /* FetchTexel2Df */ - fetch_texel_3d_srgba8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_srgba8 /* StoreTexel */ }; @@ -352,9 +355,9 @@ const struct gl_texture_format _mesa_texformat_sargb8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_sargb8, /* FetchTexel1Df */ - fetch_texel_2d_sargb8, /* FetchTexel2Df */ - fetch_texel_3d_sargb8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_sargb8 /* StoreTexel */ }; @@ -376,9 +379,9 @@ const struct gl_texture_format _mesa_texformat_sl8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_sl8, /* FetchTexel1Df */ - fetch_texel_2d_sl8, /* FetchTexel2Df */ - fetch_texel_3d_sl8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_sl8 /* StoreTexel */ }; @@ -401,9 +404,9 @@ const struct gl_texture_format _mesa_texformat_sla8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_sla8, /* FetchTexel1Df */ - fetch_texel_2d_sla8, /* FetchTexel2Df */ - fetch_texel_3d_sla8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_sla8 /* StoreTexel */ }; @@ -427,9 +430,9 @@ const struct gl_texture_format _mesa_texformat_rgba_float32 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ - fetch_texel_1d_f_rgba_f32, /* FetchTexel1Df */ - fetch_texel_2d_f_rgba_f32, /* FetchTexel2Df */ - fetch_texel_3d_f_rgba_f32, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ store_texel_rgba_f32 /* StoreTexel */ }; @@ -451,9 +454,9 @@ const struct gl_texture_format _mesa_texformat_rgba_float16 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ - fetch_texel_1d_f_rgba_f16, /* FetchTexel1Df */ - fetch_texel_2d_f_rgba_f16, /* FetchTexel2Df */ - fetch_texel_3d_f_rgba_f16, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ store_texel_rgba_f16 /* StoreTexel */ }; @@ -475,9 +478,9 @@ const struct gl_texture_format _mesa_texformat_rgb_float32 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ - fetch_texel_1d_f_rgb_f32, /* FetchTexel1Df */ - fetch_texel_2d_f_rgb_f32, /* FetchTexel2Df */ - fetch_texel_3d_f_rgb_f32, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ store_texel_rgb_f32 /* StoreTexel */ }; @@ -499,9 +502,9 @@ const struct gl_texture_format _mesa_texformat_rgb_float16 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ - fetch_texel_1d_f_rgb_f16, /* FetchTexel1Df */ - fetch_texel_2d_f_rgb_f16, /* FetchTexel2Df */ - fetch_texel_3d_f_rgb_f16, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ store_texel_rgb_f16 /* StoreTexel */ }; @@ -523,9 +526,9 @@ const struct gl_texture_format _mesa_texformat_alpha_float32 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ - fetch_texel_1d_f_alpha_f32, /* FetchTexel1Df */ - fetch_texel_2d_f_alpha_f32, /* FetchTexel2Df */ - fetch_texel_3d_f_alpha_f32, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ store_texel_alpha_f32 /* StoreTexel */ }; @@ -547,9 +550,9 @@ const struct gl_texture_format _mesa_texformat_alpha_float16 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ - fetch_texel_1d_f_alpha_f16, /* FetchTexel1Df */ - fetch_texel_2d_f_alpha_f16, /* FetchTexel2Df */ - fetch_texel_3d_f_alpha_f16, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ store_texel_alpha_f16 /* StoreTexel */ }; @@ -571,9 +574,9 @@ const struct gl_texture_format _mesa_texformat_luminance_float32 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_luminance_f32, /* FetchTexel1Df */ - fetch_texel_2d_f_luminance_f32, /* FetchTexel2Df */ - fetch_texel_3d_f_luminance_f32, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_luminance_f32 /* StoreTexel */ }; @@ -595,9 +598,9 @@ const struct gl_texture_format _mesa_texformat_luminance_float16 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_luminance_f16, /* FetchTexel1Df */ - fetch_texel_2d_f_luminance_f16, /* FetchTexel2Df */ - fetch_texel_3d_f_luminance_f16, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_luminance_f16 /* StoreTexel */ }; @@ -619,9 +622,9 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_luminance_alpha_f32,/* FetchTexel1Df */ - fetch_texel_2d_f_luminance_alpha_f32,/* FetchTexel2Df */ - fetch_texel_3d_f_luminance_alpha_f32,/* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_luminance_alpha_f32 /* StoreTexel */ }; @@ -643,9 +646,9 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_luminance_alpha_f16,/* FetchTexel1Df */ - fetch_texel_2d_f_luminance_alpha_f16,/* FetchTexel2Df */ - fetch_texel_3d_f_luminance_alpha_f16,/* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_luminance_alpha_f16 /* StoreTexel */ }; @@ -667,9 +670,9 @@ const struct gl_texture_format _mesa_texformat_intensity_float32 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_intensity_f32, /* FetchTexel1Df */ - fetch_texel_2d_f_intensity_f32, /* FetchTexel2Df */ - fetch_texel_3d_f_intensity_f32, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_intensity_f32 /* StoreTexel */ }; @@ -691,9 +694,9 @@ const struct gl_texture_format _mesa_texformat_intensity_float16 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_intensity_f16, /* FetchTexel1Df */ - fetch_texel_2d_f_intensity_f16, /* FetchTexel2Df */ - fetch_texel_3d_f_intensity_f16, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_intensity_f16 /* StoreTexel */ }; @@ -717,9 +720,9 @@ const struct gl_texture_format _mesa_texformat_dudv8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_dudv8, /* FetchTexel1Df */ - fetch_texel_2d_dudv8, /* FetchTexel2Df */ - fetch_texel_3d_dudv8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ NULL /* StoreTexel */ }; @@ -741,9 +744,9 @@ const struct gl_texture_format _mesa_texformat_signed_rgba8888 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_signed_rgba8888, /* FetchTexel1Df */ - fetch_texel_2d_signed_rgba8888, /* FetchTexel2Df */ - fetch_texel_3d_signed_rgba8888, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_signed_rgba8888 /* StoreTexel */ }; @@ -765,9 +768,9 @@ const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev = { 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 */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_signed_rgba8888_rev /* StoreTexel */ }; @@ -796,9 +799,9 @@ const struct gl_texture_format _mesa_texformat_rgba8888 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_rgba8888, /* FetchTexel1Df */ - fetch_texel_2d_f_rgba8888, /* FetchTexel2Df */ - fetch_texel_3d_f_rgba8888, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_rgba8888 /* StoreTexel */ }; @@ -820,9 +823,9 @@ const struct gl_texture_format _mesa_texformat_rgba8888_rev = { 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 */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_rgba8888_rev /* StoreTexel */ }; @@ -844,9 +847,9 @@ const struct gl_texture_format _mesa_texformat_argb8888 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_argb8888, /* FetchTexel1Df */ - fetch_texel_2d_f_argb8888, /* FetchTexel2Df */ - fetch_texel_3d_f_argb8888, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_argb8888 /* StoreTexel */ }; @@ -868,9 +871,9 @@ const struct gl_texture_format _mesa_texformat_argb8888_rev = { 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 */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_argb8888_rev /* StoreTexel */ }; @@ -892,9 +895,9 @@ const struct gl_texture_format _mesa_texformat_rgb888 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_rgb888, /* FetchTexel1Df */ - fetch_texel_2d_f_rgb888, /* FetchTexel2Df */ - fetch_texel_3d_f_rgb888, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_rgb888 /* StoreTexel */ }; @@ -916,9 +919,9 @@ const struct gl_texture_format _mesa_texformat_bgr888 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_bgr888, /* FetchTexel1Df */ - fetch_texel_2d_f_bgr888, /* FetchTexel2Df */ - fetch_texel_3d_f_bgr888, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_bgr888 /* StoreTexel */ }; @@ -940,9 +943,9 @@ const struct gl_texture_format _mesa_texformat_rgb565 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_rgb565, /* FetchTexel1Df */ - fetch_texel_2d_f_rgb565, /* FetchTexel2Df */ - fetch_texel_3d_f_rgb565, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_rgb565 /* StoreTexel */ }; @@ -964,9 +967,9 @@ const struct gl_texture_format _mesa_texformat_rgb565_rev = { 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 */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_rgb565_rev /* StoreTexel */ }; @@ -988,9 +991,9 @@ const struct gl_texture_format _mesa_texformat_rgba4444 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_rgba4444, /* FetchTexel1Df */ - fetch_texel_2d_f_rgba4444, /* FetchTexel2Df */ - fetch_texel_3d_f_rgba4444, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_rgba4444 /* StoreTexel */ }; @@ -1012,9 +1015,9 @@ const struct gl_texture_format _mesa_texformat_argb4444 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_argb4444, /* FetchTexel1Df */ - fetch_texel_2d_f_argb4444, /* FetchTexel2Df */ - fetch_texel_3d_f_argb4444, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_argb4444 /* StoreTexel */ }; @@ -1036,9 +1039,9 @@ const struct gl_texture_format _mesa_texformat_argb4444_rev = { 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 */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_argb4444_rev /* StoreTexel */ }; @@ -1060,9 +1063,9 @@ const struct gl_texture_format _mesa_texformat_rgba5551 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_rgba5551, /* FetchTexel1Df */ - fetch_texel_2d_f_rgba5551, /* FetchTexel2Df */ - fetch_texel_3d_f_rgba5551, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_rgba5551 /* StoreTexel */ }; @@ -1084,9 +1087,9 @@ const struct gl_texture_format _mesa_texformat_argb1555 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_argb1555, /* FetchTexel1Df */ - fetch_texel_2d_f_argb1555, /* FetchTexel2Df */ - fetch_texel_3d_f_argb1555, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_argb1555 /* StoreTexel */ }; @@ -1108,9 +1111,9 @@ const struct gl_texture_format _mesa_texformat_argb1555_rev = { 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 */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_argb1555_rev /* StoreTexel */ }; @@ -1132,9 +1135,9 @@ const struct gl_texture_format _mesa_texformat_al88 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_al88, /* FetchTexel1Df */ - fetch_texel_2d_f_al88, /* FetchTexel2Df */ - fetch_texel_3d_f_al88, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_al88 /* StoreTexel */ }; @@ -1156,9 +1159,9 @@ const struct gl_texture_format _mesa_texformat_al88_rev = { 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 */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_al88_rev /* StoreTexel */ }; @@ -1180,9 +1183,9 @@ const struct gl_texture_format _mesa_texformat_rgb332 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_rgb332, /* FetchTexel1Df */ - fetch_texel_2d_f_rgb332, /* FetchTexel2Df */ - fetch_texel_3d_f_rgb332, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_rgb332 /* StoreTexel */ }; @@ -1204,9 +1207,9 @@ const struct gl_texture_format _mesa_texformat_a8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_a8, /* FetchTexel1Df */ - fetch_texel_2d_f_a8, /* FetchTexel2Df */ - fetch_texel_3d_f_a8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_a8 /* StoreTexel */ }; @@ -1228,9 +1231,9 @@ const struct gl_texture_format _mesa_texformat_l8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_l8, /* FetchTexel1Df */ - fetch_texel_2d_f_l8, /* FetchTexel2Df */ - fetch_texel_3d_f_l8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_l8 /* StoreTexel */ }; @@ -1252,9 +1255,9 @@ const struct gl_texture_format _mesa_texformat_i8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_i8, /* FetchTexel1Df */ - fetch_texel_2d_f_i8, /* FetchTexel2Df */ - fetch_texel_3d_f_i8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_i8 /* StoreTexel */ }; @@ -1276,9 +1279,9 @@ const struct gl_texture_format _mesa_texformat_ci8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_ci8, /* FetchTexel1Df */ - fetch_texel_2d_f_ci8, /* FetchTexel2Df */ - fetch_texel_3d_f_ci8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_ci8 /* StoreTexel */ }; @@ -1300,9 +1303,9 @@ const struct gl_texture_format _mesa_texformat_ycbcr = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_ycbcr, /* FetchTexel1Df */ - fetch_texel_2d_f_ycbcr, /* FetchTexel2Df */ - fetch_texel_3d_f_ycbcr, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_ycbcr /* StoreTexel */ }; @@ -1324,9 +1327,9 @@ const struct gl_texture_format _mesa_texformat_ycbcr_rev = { 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 */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_ycbcr_rev /* StoreTexel */ }; @@ -1348,9 +1351,9 @@ const struct gl_texture_format _mesa_texformat_z24_s8 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_z24_s8, /* FetchTexel1Df */ - fetch_texel_2d_f_z24_s8, /* FetchTexel2Df */ - fetch_texel_3d_f_z24_s8, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_z24_s8 /* StoreTexel */ }; @@ -1372,9 +1375,9 @@ const struct gl_texture_format _mesa_texformat_s8_z24 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ - fetch_texel_1d_f_s8_z24, /* FetchTexel1Df */ - fetch_texel_2d_f_s8_z24, /* FetchTexel2Df */ - fetch_texel_3d_f_s8_z24, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel2Df */ + NULL, /* FetchTexel3Df */ store_texel_s8_z24 /* StoreTexel */ }; @@ -1396,9 +1399,9 @@ const struct gl_texture_format _mesa_texformat_z16 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ - fetch_texel_1d_f_z16, /* FetchTexel1Df */ - fetch_texel_2d_f_z16, /* FetchTexel2Df */ - fetch_texel_3d_f_z16, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ store_texel_z16 /* StoreTexel */ }; @@ -1420,9 +1423,9 @@ const struct gl_texture_format _mesa_texformat_z32 = { NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ - fetch_texel_1d_f_z32, /* FetchTexel1Df */ - fetch_texel_2d_f_z32, /* FetchTexel2Df */ - fetch_texel_3d_f_z32, /* FetchTexel3Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ store_texel_z32 /* StoreTexel */ }; @@ -1449,11 +1452,11 @@ const struct gl_texture_format _mesa_null_texformat = { 0, /* TexelBytes */ NULL, /* StoreTexImageFunc */ fetch_null_texel, /* FetchTexel1D */ - fetch_null_texel, /* FetchTexel2D */ - fetch_null_texel, /* FetchTexel3D */ + fetch_null_texel, /* FetchTexel1D */ + fetch_null_texel, /* FetchTexel1D */ + fetch_null_texelf, /* FetchTexel1Df */ + fetch_null_texelf, /* FetchTexel1Df */ fetch_null_texelf, /* FetchTexel1Df */ - fetch_null_texelf, /* FetchTexel2Df */ - fetch_null_texelf, /* FetchTexel3Df */ store_null_texel /* StoreTexel */ }; @@ -1987,3 +1990,496 @@ _mesa_format_to_type_and_comps(const struct gl_texture_format *format, *comps = 1; } } + + + +/** + * Table to map MESA_FORMAT_ to texel fetch/store funcs. + * XXX this is somewhat temporary. + */ +static struct { + GLuint Name; + FetchTexelFuncF Fetch1D; + FetchTexelFuncF Fetch2D; + FetchTexelFuncF Fetch3D; + StoreTexelFunc StoreTexel; +} +texfetch_funcs[MESA_FORMAT_COUNT] = +{ + { + MESA_FORMAT_RGBA, + fetch_texel_1d_f_rgba, + fetch_texel_2d_f_rgba, + fetch_texel_3d_f_rgba, + store_texel_rgba + }, + { + MESA_FORMAT_RGB, + fetch_texel_1d_f_rgb, + fetch_texel_2d_f_rgb, + fetch_texel_3d_f_rgb, + store_texel_rgb + }, + { + MESA_FORMAT_ALPHA, + fetch_texel_1d_f_alpha, + fetch_texel_2d_f_alpha, + fetch_texel_3d_f_alpha, + store_texel_alpha + }, + { + MESA_FORMAT_LUMINANCE, + fetch_texel_1d_f_luminance, + fetch_texel_2d_f_luminance, + fetch_texel_3d_f_luminance, + store_texel_luminance + }, + { + MESA_FORMAT_LUMINANCE_ALPHA, + fetch_texel_1d_f_luminance_alpha, + fetch_texel_2d_f_luminance_alpha, + fetch_texel_3d_f_luminance_alpha, + store_texel_luminance_alpha + }, + { + MESA_FORMAT_INTENSITY, + fetch_texel_1d_f_intensity, + fetch_texel_2d_f_intensity, + fetch_texel_3d_f_intensity, + store_texel_intensity + }, + { + MESA_FORMAT_SRGB8, + fetch_texel_1d_srgb8, + fetch_texel_2d_srgb8, + fetch_texel_3d_srgb8, + store_texel_srgb8 + }, + { + MESA_FORMAT_SRGBA8, + fetch_texel_1d_srgba8, + fetch_texel_2d_srgba8, + fetch_texel_3d_srgba8, + store_texel_srgba8 + }, + { + MESA_FORMAT_SARGB8, + fetch_texel_1d_sargb8, + fetch_texel_2d_sargb8, + fetch_texel_3d_sargb8, + store_texel_sargb8 + }, + { + MESA_FORMAT_SL8, + fetch_texel_1d_sl8, + fetch_texel_2d_sl8, + fetch_texel_3d_sl8, + store_texel_sl8 + }, + { + MESA_FORMAT_SLA8, + fetch_texel_1d_sla8, + fetch_texel_2d_sla8, + fetch_texel_3d_sla8, + store_texel_sla8 + }, + { + MESA_FORMAT_RGB_FXT1, + NULL, + _mesa_fetch_texel_2d_f_rgb_fxt1, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_FXT1, + NULL, + _mesa_fetch_texel_2d_f_rgba_fxt1, + NULL, + NULL + }, + { + MESA_FORMAT_RGB_DXT1, + NULL, + _mesa_fetch_texel_2d_f_rgb_dxt1, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_DXT1, + NULL, + _mesa_fetch_texel_2d_f_rgba_dxt1, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_DXT3, + NULL, + _mesa_fetch_texel_2d_f_rgba_dxt3, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_DXT5, + NULL, + _mesa_fetch_texel_2d_f_rgba_dxt5, + NULL, + NULL + }, + { + MESA_FORMAT_SRGB_DXT1, + NULL, + _mesa_fetch_texel_2d_f_srgb_dxt1, + NULL, + NULL + }, + { + MESA_FORMAT_SRGBA_DXT1, + NULL, + _mesa_fetch_texel_2d_f_srgba_dxt1, + NULL, + NULL + }, + { + MESA_FORMAT_SRGBA_DXT3, + NULL, + _mesa_fetch_texel_2d_f_srgba_dxt3, + NULL, + NULL + }, + { + MESA_FORMAT_SRGBA_DXT5, + NULL, + _mesa_fetch_texel_2d_f_srgba_dxt5, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_FLOAT32, + fetch_texel_1d_f_rgba_f32, + fetch_texel_2d_f_rgba_f32, + fetch_texel_3d_f_rgba_f32, + store_texel_rgba_f32 + }, + { + MESA_FORMAT_RGBA_FLOAT16, + fetch_texel_1d_f_rgba_f16, + fetch_texel_2d_f_rgba_f16, + fetch_texel_3d_f_rgba_f16, + store_texel_rgba_f16 + }, + { + MESA_FORMAT_RGB_FLOAT32, + fetch_texel_1d_f_rgb_f32, + fetch_texel_2d_f_rgb_f32, + fetch_texel_3d_f_rgb_f32, + store_texel_rgb_f32 + }, + { + MESA_FORMAT_RGB_FLOAT16, + fetch_texel_1d_f_rgb_f16, + fetch_texel_2d_f_rgb_f16, + fetch_texel_3d_f_rgb_f16, + store_texel_rgb_f16 + }, + { + MESA_FORMAT_ALPHA_FLOAT32, + fetch_texel_1d_f_alpha_f32, + fetch_texel_2d_f_alpha_f32, + fetch_texel_3d_f_alpha_f32, + store_texel_alpha_f32 + }, + { + MESA_FORMAT_ALPHA_FLOAT16, + fetch_texel_1d_f_alpha_f16, + fetch_texel_2d_f_alpha_f16, + fetch_texel_3d_f_alpha_f16, + store_texel_alpha_f16 + }, + { + MESA_FORMAT_LUMINANCE_FLOAT32, + fetch_texel_1d_f_luminance_f32, + fetch_texel_2d_f_luminance_f32, + fetch_texel_3d_f_luminance_f32, + store_texel_luminance_f32 + }, + { + MESA_FORMAT_LUMINANCE_FLOAT16, + fetch_texel_1d_f_luminance_f16, + fetch_texel_2d_f_luminance_f16, + fetch_texel_3d_f_luminance_f16, + store_texel_luminance_f16 + }, + { + MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, + fetch_texel_1d_f_luminance_alpha_f32, + fetch_texel_2d_f_luminance_alpha_f32, + fetch_texel_3d_f_luminance_alpha_f32, + store_texel_luminance_alpha_f32 + }, + { + MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, + fetch_texel_1d_f_luminance_alpha_f16, + fetch_texel_2d_f_luminance_alpha_f16, + fetch_texel_3d_f_luminance_alpha_f16, + store_texel_luminance_alpha_f16 + }, + { + MESA_FORMAT_INTENSITY_FLOAT32, + fetch_texel_1d_f_intensity_f32, + fetch_texel_2d_f_intensity_f32, + fetch_texel_3d_f_intensity_f32, + store_texel_intensity_f32 + }, + { + MESA_FORMAT_INTENSITY_FLOAT16, + fetch_texel_1d_f_intensity_f16, + fetch_texel_2d_f_intensity_f16, + fetch_texel_3d_f_intensity_f16, + store_texel_intensity_f16 + }, + { + MESA_FORMAT_DUDV8, + fetch_texel_1d_dudv8, + fetch_texel_2d_dudv8, + fetch_texel_3d_dudv8, + NULL + }, + { + MESA_FORMAT_SIGNED_RGBA8888, + fetch_texel_1d_signed_rgba8888, + fetch_texel_2d_signed_rgba8888, + fetch_texel_3d_signed_rgba8888, + store_texel_signed_rgba8888 + }, + { + MESA_FORMAT_SIGNED_RGBA8888_REV, + fetch_texel_1d_signed_rgba8888_rev, + fetch_texel_2d_signed_rgba8888_rev, + fetch_texel_3d_signed_rgba8888_rev, + store_texel_signed_rgba8888_rev + }, + { + MESA_FORMAT_RGBA8888, + fetch_texel_1d_f_rgba8888, + fetch_texel_2d_f_rgba8888, + fetch_texel_3d_f_rgba8888, + store_texel_rgba8888 + }, + { + MESA_FORMAT_RGBA8888_REV, + fetch_texel_1d_f_rgba8888_rev, + fetch_texel_2d_f_rgba8888_rev, + fetch_texel_3d_f_rgba8888_rev, + store_texel_rgba8888_rev + }, + { + MESA_FORMAT_ARGB8888, + fetch_texel_1d_f_argb8888, + fetch_texel_2d_f_argb8888, + fetch_texel_3d_f_argb8888, + store_texel_argb8888 + }, + { + MESA_FORMAT_ARGB8888_REV, + fetch_texel_1d_f_argb8888_rev, + fetch_texel_2d_f_argb8888_rev, + fetch_texel_3d_f_argb8888_rev, + store_texel_argb8888_rev + }, + { + MESA_FORMAT_RGB888, + fetch_texel_1d_f_rgb888, + fetch_texel_2d_f_rgb888, + fetch_texel_3d_f_rgb888, + store_texel_rgb888 + }, + { + MESA_FORMAT_BGR888, + fetch_texel_1d_f_bgr888, + fetch_texel_2d_f_bgr888, + fetch_texel_3d_f_bgr888, + store_texel_bgr888 + }, + { + MESA_FORMAT_RGB565, + fetch_texel_1d_f_rgb565, + fetch_texel_2d_f_rgb565, + fetch_texel_3d_f_rgb565, + store_texel_rgb565 + }, + { + MESA_FORMAT_RGB565_REV, + fetch_texel_1d_f_rgb565_rev, + fetch_texel_2d_f_rgb565_rev, + fetch_texel_3d_f_rgb565_rev, + store_texel_rgb565_rev + }, + { + MESA_FORMAT_RGBA4444, + fetch_texel_1d_f_rgba4444, + fetch_texel_2d_f_rgba4444, + fetch_texel_3d_f_rgba4444, + store_texel_rgba4444 + }, + { + MESA_FORMAT_ARGB4444, + fetch_texel_1d_f_argb4444, + fetch_texel_2d_f_argb4444, + fetch_texel_3d_f_argb4444, + store_texel_argb4444 + }, + { + MESA_FORMAT_ARGB4444_REV, + fetch_texel_1d_f_argb4444_rev, + fetch_texel_2d_f_argb4444_rev, + fetch_texel_3d_f_argb4444_rev, + store_texel_argb4444_rev + }, + { + MESA_FORMAT_RGBA5551, + fetch_texel_1d_f_rgba5551, + fetch_texel_2d_f_rgba5551, + fetch_texel_3d_f_rgba5551, + store_texel_rgba5551 + }, + { + MESA_FORMAT_ARGB1555, + fetch_texel_1d_f_argb1555, + fetch_texel_2d_f_argb1555, + fetch_texel_3d_f_argb1555, + store_texel_argb1555 + }, + { + MESA_FORMAT_ARGB1555_REV, + fetch_texel_1d_f_argb1555_rev, + fetch_texel_2d_f_argb1555_rev, + fetch_texel_3d_f_argb1555_rev, + store_texel_argb1555_rev + }, + { + MESA_FORMAT_AL88, + fetch_texel_1d_f_al88, + fetch_texel_2d_f_al88, + fetch_texel_3d_f_al88, + store_texel_al88 + }, + { + MESA_FORMAT_AL88_REV, + fetch_texel_1d_f_al88_rev, + fetch_texel_2d_f_al88_rev, + fetch_texel_3d_f_al88_rev, + store_texel_al88_rev + }, + { + MESA_FORMAT_RGB332, + fetch_texel_1d_f_rgb332, + fetch_texel_2d_f_rgb332, + fetch_texel_3d_f_rgb332, + store_texel_rgb332 + }, + { + MESA_FORMAT_A8, + fetch_texel_1d_f_a8, + fetch_texel_2d_f_a8, + fetch_texel_3d_f_a8, + store_texel_a8 + }, + { + MESA_FORMAT_L8, + fetch_texel_1d_f_l8, + fetch_texel_2d_f_l8, + fetch_texel_3d_f_l8, + store_texel_l8 + }, + { + MESA_FORMAT_I8, + fetch_texel_1d_f_i8, + fetch_texel_2d_f_i8, + fetch_texel_3d_f_i8, + store_texel_i8 + }, + { + MESA_FORMAT_CI8, + fetch_texel_1d_f_ci8, + fetch_texel_2d_f_ci8, + fetch_texel_3d_f_ci8, + store_texel_ci8 + }, + { + MESA_FORMAT_YCBCR, + fetch_texel_1d_f_ycbcr, + fetch_texel_2d_f_ycbcr, + fetch_texel_3d_f_ycbcr, + store_texel_ycbcr + }, + { + MESA_FORMAT_YCBCR_REV, + fetch_texel_1d_f_ycbcr_rev, + fetch_texel_2d_f_ycbcr_rev, + fetch_texel_3d_f_ycbcr_rev, + store_texel_ycbcr_rev + }, + { + MESA_FORMAT_Z24_S8, + fetch_texel_1d_f_z24_s8, + fetch_texel_2d_f_z24_s8, + fetch_texel_3d_f_z24_s8, + store_texel_z24_s8 + }, + { + MESA_FORMAT_S8_Z24, + fetch_texel_1d_f_s8_z24, + fetch_texel_2d_f_s8_z24, + fetch_texel_3d_f_s8_z24, + store_texel_s8_z24 + }, + { + MESA_FORMAT_Z16, + fetch_texel_1d_f_z16, + fetch_texel_2d_f_z16, + fetch_texel_3d_f_z16, + store_texel_z16 + }, + { + MESA_FORMAT_Z32, + fetch_texel_1d_f_z32, + fetch_texel_2d_f_z32, + fetch_texel_3d_f_z32, + store_texel_z32 + } +}; + + +FetchTexelFuncF +_mesa_get_texel_fetch_func(GLuint format, GLuint dims) +{ + GLuint i; + /* XXX replace loop with direct table lookup */ + for (i = 0; i < MESA_FORMAT_COUNT; i++) { + if (texfetch_funcs[i].Name == format) { + switch (dims) { + case 1: + return texfetch_funcs[i].Fetch1D; + case 2: + return texfetch_funcs[i].Fetch2D; + case 3: + return texfetch_funcs[i].Fetch3D; + } + } + } + return NULL; +} + + +StoreTexelFunc +_mesa_get_texel_store_func(GLuint format) +{ + GLuint i; + /* XXX replace loop with direct table lookup */ + for (i = 0; i < MESA_FORMAT_COUNT; i++) { + if (texfetch_funcs[i].Name == format) { + return texfetch_funcs[i].StoreTexel; + } + } + return NULL; +} diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index b860a10d86..39d5ec640a 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -154,5 +154,11 @@ extern void _mesa_format_to_type_and_comps(const struct gl_texture_format *format, GLenum *datatype, GLuint *comps); +extern FetchTexelFuncF +_mesa_get_texel_fetch_func(GLuint format, GLuint dims); + +extern StoreTexelFunc +_mesa_get_texel_store_func(GLuint format); + #endif diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index f4df71d769..33edf8a56a 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -62,6 +62,8 @@ #include "mipmap.h" #include "imports.h" #include "texcompress.h" +#include "texcompress_fxt1.h" +#include "texcompress_s3tc.h" #include "texformat.h" #include "teximage.h" #include "texstore.h" @@ -3227,6 +3229,8 @@ texstore_funcs[MESA_FORMAT_COUNT] = { MESA_FORMAT_CI8, _mesa_texstore_ci8 }, { MESA_FORMAT_YCBCR, _mesa_texstore_ycbcr }, { MESA_FORMAT_YCBCR_REV, _mesa_texstore_ycbcr }, + { MESA_FORMAT_RGB_FXT1, _mesa_texstore_rgb_fxt1 }, + { MESA_FORMAT_RGBA_FXT1, _mesa_texstore_rgba_fxt1 }, { MESA_FORMAT_Z24_S8, _mesa_texstore_z24_s8 }, { MESA_FORMAT_S8_Z24, _mesa_texstore_s8_z24 }, { MESA_FORMAT_Z16, _mesa_texstore_z16 }, @@ -3399,22 +3403,8 @@ _mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims) ASSERT(dims == 1 || dims == 2 || dims == 3); ASSERT(texImage->TexFormat); - switch (dims) { - case 1: - texImage->FetchTexelc = texImage->TexFormat->FetchTexel1D; - texImage->FetchTexelf = texImage->TexFormat->FetchTexel1Df; - break; - case 2: - texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D; - texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df; - break; - case 3: - texImage->FetchTexelc = texImage->TexFormat->FetchTexel3D; - texImage->FetchTexelf = texImage->TexFormat->FetchTexel3Df; - break; - default: - ; - } + texImage->FetchTexelf = + _mesa_get_texel_fetch_func(texImage->TexFormat->MesaFormat, dims); /* now check if we need to use a float/chan adaptor */ if (!texImage->FetchTexelc) { -- cgit v1.2.3 From 431ba64222ad5365dfcdac1f06d80f0e7a26dbfd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:17:32 -0600 Subject: mesa: use _mesa_get_texel_store_func() --- src/mesa/main/texformat.c | 104 +++++++++++++++++++++++----------------------- src/mesa/main/texrender.c | 2 +- 2 files changed, 53 insertions(+), 53 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index b6c0a252d3..85a7fe6e2c 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -163,7 +163,7 @@ const struct gl_texture_format _mesa_texformat_rgba = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_rgba /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb = { @@ -187,7 +187,7 @@ const struct gl_texture_format _mesa_texformat_rgb = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_rgb /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_alpha = { @@ -211,7 +211,7 @@ const struct gl_texture_format _mesa_texformat_alpha = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_alpha /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance = { @@ -235,7 +235,7 @@ const struct gl_texture_format _mesa_texformat_luminance = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_luminance /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_alpha = { @@ -259,7 +259,7 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_luminance_alpha /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_intensity = { @@ -283,7 +283,7 @@ const struct gl_texture_format _mesa_texformat_intensity = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_intensity /* StoreTexel */ + NULL /* StoreTexel */ }; @@ -310,7 +310,7 @@ const struct gl_texture_format _mesa_texformat_srgb8 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_srgb8 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_srgba8 = { @@ -334,7 +334,7 @@ const struct gl_texture_format _mesa_texformat_srgba8 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_srgba8 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_sargb8 = { @@ -358,7 +358,7 @@ const struct gl_texture_format _mesa_texformat_sargb8 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_sargb8 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_sl8 = { @@ -382,7 +382,7 @@ const struct gl_texture_format _mesa_texformat_sl8 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_sl8 /* StoreTexel */ + NULL /* StoreTexel */ }; /* Note: this format name looks like a misnomer, make it sal8? */ @@ -407,7 +407,7 @@ const struct gl_texture_format _mesa_texformat_sla8 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_sla8 /* StoreTexel */ + NULL /* StoreTexel */ }; #endif /* FEATURE_EXT_texture_sRGB */ @@ -433,7 +433,7 @@ const struct gl_texture_format _mesa_texformat_rgba_float32 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ - store_texel_rgba_f32 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba_float16 = { @@ -457,7 +457,7 @@ const struct gl_texture_format _mesa_texformat_rgba_float16 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ - store_texel_rgba_f16 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb_float32 = { @@ -481,7 +481,7 @@ const struct gl_texture_format _mesa_texformat_rgb_float32 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ - store_texel_rgb_f32 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb_float16 = { @@ -505,7 +505,7 @@ const struct gl_texture_format _mesa_texformat_rgb_float16 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ - store_texel_rgb_f16 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_alpha_float32 = { @@ -529,7 +529,7 @@ const struct gl_texture_format _mesa_texformat_alpha_float32 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ - store_texel_alpha_f32 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_alpha_float16 = { @@ -553,7 +553,7 @@ const struct gl_texture_format _mesa_texformat_alpha_float16 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ - store_texel_alpha_f16 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_float32 = { @@ -577,7 +577,7 @@ const struct gl_texture_format _mesa_texformat_luminance_float32 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_luminance_f32 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_float16 = { @@ -601,7 +601,7 @@ const struct gl_texture_format _mesa_texformat_luminance_float16 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_luminance_f16 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = { @@ -625,7 +625,7 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_luminance_alpha_f32 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = { @@ -649,7 +649,7 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_luminance_alpha_f16 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_intensity_float32 = { @@ -673,7 +673,7 @@ const struct gl_texture_format _mesa_texformat_intensity_float32 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_intensity_f32 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_intensity_float16 = { @@ -697,7 +697,7 @@ const struct gl_texture_format _mesa_texformat_intensity_float16 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_intensity_f16 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_dudv8 = { @@ -747,7 +747,7 @@ const struct gl_texture_format _mesa_texformat_signed_rgba8888 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_signed_rgba8888 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev = { @@ -771,7 +771,7 @@ const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_signed_rgba8888_rev /* StoreTexel */ + NULL /* StoreTexel */ }; /*@}*/ @@ -802,7 +802,7 @@ const struct gl_texture_format _mesa_texformat_rgba8888 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_rgba8888 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba8888_rev = { @@ -826,7 +826,7 @@ const struct gl_texture_format _mesa_texformat_rgba8888_rev = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_rgba8888_rev /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb8888 = { @@ -850,7 +850,7 @@ const struct gl_texture_format _mesa_texformat_argb8888 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_argb8888 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb8888_rev = { @@ -874,7 +874,7 @@ const struct gl_texture_format _mesa_texformat_argb8888_rev = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_argb8888_rev /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb888 = { @@ -898,7 +898,7 @@ const struct gl_texture_format _mesa_texformat_rgb888 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_rgb888 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_bgr888 = { @@ -922,7 +922,7 @@ const struct gl_texture_format _mesa_texformat_bgr888 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_bgr888 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb565 = { @@ -946,7 +946,7 @@ const struct gl_texture_format _mesa_texformat_rgb565 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_rgb565 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb565_rev = { @@ -970,7 +970,7 @@ const struct gl_texture_format _mesa_texformat_rgb565_rev = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_rgb565_rev /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba4444 = { @@ -994,7 +994,7 @@ const struct gl_texture_format _mesa_texformat_rgba4444 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_rgba4444 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb4444 = { @@ -1018,7 +1018,7 @@ const struct gl_texture_format _mesa_texformat_argb4444 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_argb4444 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb4444_rev = { @@ -1042,7 +1042,7 @@ const struct gl_texture_format _mesa_texformat_argb4444_rev = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_argb4444_rev /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba5551 = { @@ -1066,7 +1066,7 @@ const struct gl_texture_format _mesa_texformat_rgba5551 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_rgba5551 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb1555 = { @@ -1090,7 +1090,7 @@ const struct gl_texture_format _mesa_texformat_argb1555 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_argb1555 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb1555_rev = { @@ -1114,7 +1114,7 @@ const struct gl_texture_format _mesa_texformat_argb1555_rev = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_argb1555_rev /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_al88 = { @@ -1138,7 +1138,7 @@ const struct gl_texture_format _mesa_texformat_al88 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_al88 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_al88_rev = { @@ -1162,7 +1162,7 @@ const struct gl_texture_format _mesa_texformat_al88_rev = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_al88_rev /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb332 = { @@ -1186,7 +1186,7 @@ const struct gl_texture_format _mesa_texformat_rgb332 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_rgb332 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_a8 = { @@ -1210,7 +1210,7 @@ const struct gl_texture_format _mesa_texformat_a8 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_a8 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_l8 = { @@ -1234,7 +1234,7 @@ const struct gl_texture_format _mesa_texformat_l8 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_l8 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_i8 = { @@ -1258,7 +1258,7 @@ const struct gl_texture_format _mesa_texformat_i8 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_i8 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_ci8 = { @@ -1282,7 +1282,7 @@ const struct gl_texture_format _mesa_texformat_ci8 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_ci8 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_ycbcr = { @@ -1306,7 +1306,7 @@ const struct gl_texture_format _mesa_texformat_ycbcr = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_ycbcr /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_ycbcr_rev = { @@ -1330,7 +1330,7 @@ const struct gl_texture_format _mesa_texformat_ycbcr_rev = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_ycbcr_rev /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_z24_s8 = { @@ -1354,7 +1354,7 @@ const struct gl_texture_format _mesa_texformat_z24_s8 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_z24_s8 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_s8_z24 = { @@ -1378,7 +1378,7 @@ const struct gl_texture_format _mesa_texformat_s8_z24 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel2Df */ NULL, /* FetchTexel3Df */ - store_texel_s8_z24 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_z16 = { @@ -1402,7 +1402,7 @@ const struct gl_texture_format _mesa_texformat_z16 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ - store_texel_z16 /* StoreTexel */ + NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_z32 = { @@ -1426,7 +1426,7 @@ const struct gl_texture_format _mesa_texformat_z32 = { NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ NULL, /* FetchTexel1Df */ - store_texel_z32 /* StoreTexel */ + NULL /* StoreTexel */ }; /*@}*/ diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c index 53be83b05c..50e09c5d15 100644 --- a/src/mesa/main/texrender.c +++ b/src/mesa/main/texrender.c @@ -469,7 +469,7 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att) trb->TexImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel]; ASSERT(trb->TexImage); - trb->Store = trb->TexImage->TexFormat->StoreTexel; + trb->Store = _mesa_get_texel_store_func(trb->TexImage->TexFormat->MesaFormat); if (!trb->Store) { /* we'll never draw into some textures (compressed formats) */ trb->Store = store_nop; -- cgit v1.2.3 From e44c85637a3298918e292e9ddba812856cf92924 Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Sun, 27 Sep 2009 20:18:02 -0400 Subject: g3dvl: Implement XvMC using pipe_video_context. --- src/gallium/winsys/g3dvl/Makefile | 11 + src/gallium/winsys/g3dvl/vl_winsys.h | 21 +- src/gallium/winsys/g3dvl/xlib/Makefile | 74 ++++ src/gallium/winsys/g3dvl/xlib/xsp_winsys.c | 307 +++++++++++++++ src/xvmc/Makefile | 90 ++--- src/xvmc/SConscript | 21 + src/xvmc/attributes.c | 15 +- src/xvmc/block.c | 90 ++--- src/xvmc/context.c | 369 +++++++++--------- src/xvmc/subpicture.c | 322 +++++++--------- src/xvmc/surface.c | 595 ++++++++++++++++------------- src/xvmc/tests/Makefile | 23 +- src/xvmc/tests/test_rendering.c | 3 + src/xvmc/tests/test_surface.c | 19 +- src/xvmc/tests/xvmc_bench.c | 2 + src/xvmc/xvmc_private.h | 31 ++ 16 files changed, 1209 insertions(+), 784 deletions(-) create mode 100644 src/gallium/winsys/g3dvl/Makefile create mode 100644 src/gallium/winsys/g3dvl/xlib/Makefile create mode 100644 src/gallium/winsys/g3dvl/xlib/xsp_winsys.c create mode 100644 src/xvmc/SConscript create mode 100644 src/xvmc/xvmc_private.h (limited to 'src') diff --git a/src/gallium/winsys/g3dvl/Makefile b/src/gallium/winsys/g3dvl/Makefile new file mode 100644 index 0000000000..424ddea87a --- /dev/null +++ b/src/gallium/winsys/g3dvl/Makefile @@ -0,0 +1,11 @@ +TOP = ../../../.. +include $(TOP)/configs/current + +SUBDIRS = $(GALLIUM_WINSYS_DIRS) + +default install clean: + @for dir in $(SUBDIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) $@) || exit 1; \ + fi \ + done diff --git a/src/gallium/winsys/g3dvl/vl_winsys.h b/src/gallium/winsys/g3dvl/vl_winsys.h index c83db28dd9..4f7a243361 100644 --- a/src/gallium/winsys/g3dvl/vl_winsys.h +++ b/src/gallium/winsys/g3dvl/vl_winsys.h @@ -2,13 +2,22 @@ #define vl_winsys_h #include +#include +#include -struct pipe_context; +struct pipe_screen; +struct pipe_video_context; -struct pipe_context* create_pipe_context(Display *display, int screen); -int destroy_pipe_context(struct pipe_context *pipe); -int bind_pipe_drawable(struct pipe_context *pipe, Drawable drawable); -int unbind_pipe_drawable(struct pipe_context *pipe); +struct pipe_screen* +vl_screen_create(Display *display, int screen); -#endif +struct pipe_video_context* +vl_video_create(struct pipe_screen *screen, + enum pipe_video_profile profile, + enum pipe_video_chroma_format chroma_format, + unsigned width, unsigned height); + +Drawable +vl_video_bind_drawable(struct pipe_video_context *vpipe, Drawable drawable); +#endif diff --git a/src/gallium/winsys/g3dvl/xlib/Makefile b/src/gallium/winsys/g3dvl/xlib/Makefile new file mode 100644 index 0000000000..d4cbf0e2bb --- /dev/null +++ b/src/gallium/winsys/g3dvl/xlib/Makefile @@ -0,0 +1,74 @@ +# This makefile produces a "stand-alone" libXvMCg3dvl.so which is +# based on Xlib (no DRI HW acceleration) + +TOP = ../../../../.. +include $(TOP)/configs/current + +XVMC_MAJOR = 1 +XVMC_MINOR = 0 +XVMC_LIB = XvMCg3dvl +XVMC_LIB_NAME = lib$(XVMC_LIB).so +XVMC_LIB_DEPS = $(EXTRA_LIB_PATH) -lXvMC -lXv -lX11 -lm + +INCLUDES = -I$(TOP)/src/gallium/include \ + -I$(TOP)/src/gallium/auxiliary \ + -I$(TOP)/src/gallium/drivers \ + -I$(TOP)/src/gallium/winsys/g3dvl + +DEFINES += -DGALLIUM_SOFTPIPE \ + -DGALLIUM_TRACE + +SOURCES = xsp_winsys.c + +# XXX: Hack, if we include libXvMCapi.a in LIBS none of the symbols are +# pulled in by the linker because xsp_winsys.c doesn't refer to them +OBJECTS = $(SOURCES:.c=.o) $(TOP)/src/xvmc/*.o + +LIBS = $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ + $(TOP)/src/gallium/auxiliary/vl/libvl.a \ + $(TOP)/src/gallium/auxiliary/tgsi/libtgsi.a \ + $(TOP)/src/gallium/auxiliary/draw/libdraw.a \ + $(TOP)/src/gallium/auxiliary/translate/libtranslate.a \ + $(TOP)/src/gallium/auxiliary/cso_cache/libcso_cache.a \ + $(TOP)/src/gallium/auxiliary/rtasm/librtasm.a \ + $(TOP)/src/gallium/auxiliary/util/libutil.a + +.c.o: + $(CC) -c $(INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@ + +.S.o: + $(CC) -c $(INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@ + +.PHONY: default $(TOP)/$(LIB_DIR)/gallium clean + +default: depend $(TOP)/$(LIB_DIR)/gallium $(TOP)/$(LIB_DIR)/gallium/$(XVMC_LIB_NAME) + +$(TOP)/$(LIB_DIR)/gallium: + @mkdir -p $(TOP)/$(LIB_DIR)/gallium + +# Make the libXvMCg3dvl.so library +$(TOP)/$(LIB_DIR)/gallium/$(XVMC_LIB_NAME): $(OBJECTS) $(LIBS) Makefile + $(MKLIB) -o $(XVMC_LIB) -linker '$(CC)' -ldflags '$(LDFLAGS)' \ + -major $(XVMC_MAJOR) -minor $(XVMC_MINOR) $(MKLIB_OPTIONS) \ + -install $(TOP)/$(LIB_DIR)/gallium -id $(INSTALL_LIB_DIR)/lib$(XVMC_LIB).1.dylib \ + $(XVMC_LIB_DEPS) $(OBJECTS) $(LIBS) + +depend: $(SOURCES) Makefile + $(RM) depend + touch depend + $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDES) $(SOURCES) + +#install: default +# $(INSTALL) -d $(INSTALL_DIR)/include/GL +# $(INSTALL) -d $(INSTALL_DIR)/$(LIB_DIR) +# $(INSTALL) -m 644 $(TOP)/include/GL/*.h $(INSTALL_DIR)/include/GL +# @if [ -e $(TOP)/$(LIB_DIR)/$(GL_LIB_NAME) ]; then \ +# $(INSTALL) $(TOP)/$(LIB_DIR)/libGL* $(INSTALL_DIR)/$(LIB_DIR); \ +# fi + +clean: Makefile + $(RM) $(TOP)/$(LIB_DIR)/gallium/$(XVMC_LIB_NAME) + $(RM) *.o *~ + $(RM) depend depend.bak + +-include depend diff --git a/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c b/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c new file mode 100644 index 0000000000..37eee79c5d --- /dev/null +++ b/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c @@ -0,0 +1,307 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* pipe_winsys implementation */ + +struct xsp_pipe_winsys +{ + struct pipe_winsys base; + Display *display; + int screen; + XImage *fbimage; +}; + +struct xsp_context +{ + Drawable drawable; + + void (*pipe_destroy)(struct pipe_video_context *vpipe); +}; + +struct xsp_buffer +{ + struct pipe_buffer base; + boolean is_user_buffer; + void *data; + void *mapped_data; +}; + +static struct pipe_buffer* xsp_buffer_create(struct pipe_winsys *pws, unsigned alignment, unsigned usage, unsigned size) +{ + struct xsp_buffer *buffer; + + assert(pws); + + buffer = calloc(1, sizeof(struct xsp_buffer)); + pipe_reference_init(&buffer->base.reference, 1); + buffer->base.alignment = alignment; + buffer->base.usage = usage; + buffer->base.size = size; + buffer->data = align_malloc(size, alignment); + + return (struct pipe_buffer*)buffer; +} + +static struct pipe_buffer* xsp_user_buffer_create(struct pipe_winsys *pws, void *data, unsigned size) +{ + struct xsp_buffer *buffer; + + assert(pws); + + buffer = calloc(1, sizeof(struct xsp_buffer)); + pipe_reference_init(&buffer->base.reference, 1); + buffer->base.size = size; + buffer->is_user_buffer = TRUE; + buffer->data = data; + + return (struct pipe_buffer*)buffer; +} + +static void* xsp_buffer_map(struct pipe_winsys *pws, struct pipe_buffer *buffer, unsigned flags) +{ + struct xsp_buffer *xsp_buf = (struct xsp_buffer*)buffer; + + assert(pws); + assert(buffer); + + xsp_buf->mapped_data = xsp_buf->data; + + return xsp_buf->mapped_data; +} + +static void xsp_buffer_unmap(struct pipe_winsys *pws, struct pipe_buffer *buffer) +{ + struct xsp_buffer *xsp_buf = (struct xsp_buffer*)buffer; + + assert(pws); + assert(buffer); + + xsp_buf->mapped_data = NULL; +} + +static void xsp_buffer_destroy(struct pipe_buffer *buffer) +{ + struct xsp_buffer *xsp_buf = (struct xsp_buffer*)buffer; + + assert(buffer); + + if (!xsp_buf->is_user_buffer) + align_free(xsp_buf->data); + + free(xsp_buf); +} + +static struct pipe_buffer* xsp_surface_buffer_create +( + struct pipe_winsys *pws, + unsigned width, + unsigned height, + enum pipe_format format, + unsigned usage, + unsigned tex_usage, + unsigned *stride +) +{ + const unsigned int ALIGNMENT = 1; + struct pipe_format_block block; + unsigned nblocksx, nblocksy; + + pf_get_block(format, &block); + nblocksx = pf_get_nblocksx(&block, width); + nblocksy = pf_get_nblocksy(&block, height); + *stride = align(nblocksx * block.size, ALIGNMENT); + + return pws->buffer_create(pws, ALIGNMENT, + usage, + *stride * nblocksy); +} + +static void xsp_fence_reference(struct pipe_winsys *pws, struct pipe_fence_handle **ptr, struct pipe_fence_handle *fence) +{ + assert(pws); + assert(ptr); + assert(fence); +} + +static int xsp_fence_signalled(struct pipe_winsys *pws, struct pipe_fence_handle *fence, unsigned flag) +{ + assert(pws); + assert(fence); + + return 0; +} + +static int xsp_fence_finish(struct pipe_winsys *pws, struct pipe_fence_handle *fence, unsigned flag) +{ + assert(pws); + assert(fence); + + return 0; +} + +static void xsp_flush_frontbuffer(struct pipe_winsys *pws, struct pipe_surface *surface, void *context_private) +{ + struct xsp_pipe_winsys *xsp_winsys; + struct xsp_context *xsp_context; + + assert(pws); + assert(surface); + assert(context_private); + + xsp_winsys = (struct xsp_pipe_winsys*)pws; + xsp_context = (struct xsp_context*)context_private; + xsp_winsys->fbimage->width = surface->width; + xsp_winsys->fbimage->height = surface->height; + xsp_winsys->fbimage->bytes_per_line = surface->width * (xsp_winsys->fbimage->bits_per_pixel >> 3); + xsp_winsys->fbimage->data = (char*)((struct xsp_buffer *)softpipe_texture(surface->texture)->buffer)->data + surface->offset; + + XPutImage + ( + xsp_winsys->display, xsp_context->drawable, + XDefaultGC(xsp_winsys->display, xsp_winsys->screen), + xsp_winsys->fbimage, 0, 0, 0, 0, + surface->width, surface->height + ); + XFlush(xsp_winsys->display); +} + +static const char* xsp_get_name(struct pipe_winsys *pws) +{ + assert(pws); + return "X11 SoftPipe"; +} + +static void xsp_destroy(struct pipe_winsys *pws) +{ + struct xsp_pipe_winsys *xsp_winsys = (struct xsp_pipe_winsys*)pws; + + assert(pws); + + /* XDestroyImage() wants to free the data as well */ + xsp_winsys->fbimage->data = NULL; + + XDestroyImage(xsp_winsys->fbimage); + FREE(xsp_winsys); +} + +/* Called through pipe_video_context::destroy() */ +static void xsp_pipe_destroy(struct pipe_video_context *vpipe) +{ + struct xsp_context *xsp_context; + + assert(vpipe); + + xsp_context = vpipe->priv; + + /* Call the original destroy */ + xsp_context->pipe_destroy(vpipe); + + FREE(xsp_context); +} + +/* Show starts here */ + +Drawable +vl_video_bind_drawable(struct pipe_video_context *vpipe, Drawable drawable) +{ + struct xsp_context *xsp_context; + Drawable old_drawable; + + assert(vpipe); + + xsp_context = vpipe->priv; + old_drawable = xsp_context->drawable; + xsp_context->drawable = drawable; + + return old_drawable; +} + +struct pipe_screen* +vl_screen_create(Display *display, int screen) +{ + struct xsp_pipe_winsys *xsp_winsys; + + assert(display); + + xsp_winsys = CALLOC_STRUCT(xsp_pipe_winsys); + if (!xsp_winsys) + return NULL; + + xsp_winsys->base.buffer_create = xsp_buffer_create; + xsp_winsys->base.user_buffer_create = xsp_user_buffer_create; + xsp_winsys->base.buffer_map = xsp_buffer_map; + xsp_winsys->base.buffer_unmap = xsp_buffer_unmap; + xsp_winsys->base.buffer_destroy = xsp_buffer_destroy; + xsp_winsys->base.surface_buffer_create = xsp_surface_buffer_create; + xsp_winsys->base.fence_reference = xsp_fence_reference; + xsp_winsys->base.fence_signalled = xsp_fence_signalled; + xsp_winsys->base.fence_finish = xsp_fence_finish; + xsp_winsys->base.flush_frontbuffer = xsp_flush_frontbuffer; + xsp_winsys->base.get_name = xsp_get_name; + xsp_winsys->base.destroy = xsp_destroy; + xsp_winsys->display = display; + xsp_winsys->screen = screen; + xsp_winsys->fbimage = XCreateImage + ( + display, + XDefaultVisual(display, screen), + XDefaultDepth(display, screen), + ZPixmap, + 0, + NULL, + 0, /* Don't know the width and height until flush_frontbuffer */ + 0, + 32, + 0 + ); + + if (!xsp_winsys->fbimage) + { + FREE(xsp_winsys); + return NULL; + } + + XInitImage(xsp_winsys->fbimage); + + return softpipe_create_screen(&xsp_winsys->base); +} + +struct pipe_video_context* +vl_video_create(struct pipe_screen *screen, + enum pipe_video_profile profile, + enum pipe_video_chroma_format chroma_format, + unsigned width, unsigned height) +{ + struct pipe_video_context *vpipe; + struct xsp_context *xsp_context; + + assert(screen); + assert(width && height); + + vpipe = sp_video_create(screen, profile, chroma_format, width, height); + if (!vpipe) + return NULL; + + xsp_context = CALLOC_STRUCT(xsp_context); + if (!xsp_context) + { + vpipe->destroy(vpipe); + return NULL; + } + + /* Override this so we can free our xsp_context when the pipe is freed */ + xsp_context->pipe_destroy = vpipe->destroy; + vpipe->destroy = xsp_pipe_destroy; + + vpipe->priv = xsp_context; + + return vpipe; +} diff --git a/src/xvmc/Makefile b/src/xvmc/Makefile index 7badcfd264..e7636e65c6 100644 --- a/src/xvmc/Makefile +++ b/src/xvmc/Makefile @@ -1,73 +1,45 @@ -TARGET = libXvMCg3dvl.so -SONAME = libXvMCg3dvl.so.1 -GALLIUMDIR = ../gallium +TOP = ../.. +include $(TOP)/configs/current -OBJECTS = block.o surface.o context.o subpicture.o attributes.o +#DEFINES += -DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" -ifeq (${DRIVER}, softpipe) -OBJECTS += ${GALLIUMDIR}/winsys/g3dvl/xsp_winsys.o -endif +SOURCES = block.c \ + surface.c \ + context.c \ + subpicture.c \ + attributes.c -CFLAGS += -g -fPIC -Wall -Werror=implicit-function-declaration \ - -I${GALLIUMDIR}/state_trackers/g3dvl \ - -I${GALLIUMDIR}/winsys/g3dvl \ - -I${GALLIUMDIR}/include \ - -I${GALLIUMDIR}/auxiliary \ - -I${GALLIUMDIR}/drivers +OBJECTS = $(SOURCES:.c=.o) -ifeq (${DRIVER}, softpipe) -LDFLAGS += -L${GALLIUMDIR}/state_trackers/g3dvl \ - -L${GALLIUMDIR}/drivers/softpipe \ - -L${GALLIUMDIR}/auxiliary/tgsi \ - -L${GALLIUMDIR}/auxiliary/draw \ - -L${GALLIUMDIR}/auxiliary/translate \ - -L${GALLIUMDIR}/auxiliary/cso_cache \ - -L${GALLIUMDIR}/auxiliary/util \ - -L${GALLIUMDIR}/auxiliary/rtasm -else -LDFLAGS += -L${GALLIUMDIR}/state_trackers/g3dvl \ - -L${GALLIUMDIR}/winsys/g3dvl/nouveau \ - -L${GALLIUMDIR}/auxiliary/util -endif +INCLUDES = -I$(TOP)/src/gallium/include \ + -I$(TOP)/src/gallium/auxiliary \ + -I$(TOP)/src/gallium/winsys/g3dvl -ifeq (${DRIVER}, softpipe) -LIBS += -lg3dvl -lsoftpipe -ldraw -ltgsi -ltranslate -lrtasm -lcso_cache -lutil -lm -else -LIBS += -lg3dvl -lnouveau_dri -lutil -endif +##### RULES ##### -############################################# +.c.o: + $(CC) -c $(INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@ -ifeq (${DRIVER}, softpipe) -.PHONY = all clean g3dvl -else -.PHONY = all clean g3dvl nouveau_winsys -endif +.S.o: + $(CC) -c $(INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@ -all: ${TARGET} +##### TARGETS ##### -ifeq (${DRIVER}, softpipe) -${TARGET}: ${OBJECTS} g3dvl - $(CC) ${LDFLAGS} -shared -Wl,-soname,${SONAME} -o $@ ${OBJECTS} ${LIBS} +.PHONY: default clean -g3dvl: - cd ${GALLIUMDIR}/state_trackers/g3dvl; ${MAKE} +default: depend libXvMCapi.a -clean: - cd ${GALLIUMDIR}/state_trackers/g3dvl; ${MAKE} clean - rm -rf ${OBJECTS} ${TARGET} -else -${TARGET}: ${OBJECTS} g3dvl nouveau_winsys - $(CC) ${LDFLAGS} -shared -Wl,-soname,${SONAME} -o $@ ${OBJECTS} ${LIBS} +libXvMCapi.a: $(OBJECTS) Makefile + $(MKLIB) -o XvMCapi $(MKLIB_OPTIONS) -static $(OBJECTS) -g3dvl: - cd ${GALLIUMDIR}/state_trackers/g3dvl; ${MAKE} +depend: $(SOURCES) Makefile + $(RM) depend + touch depend + $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDES) $(SOURCES) -nouveau_winsys: - cd ${GALLIUMDIR}/winsys/g3dvl/nouveau; ${MAKE} +clean: Makefile + $(RM) libXvMCapi.a + $(RM) *.o *~ + $(RM) depend depend.bak -clean: - cd ${GALLIUMDIR}/state_trackers/g3dvl; ${MAKE} clean - cd ${GALLIUMDIR}/winsys/g3dvl/nouveau; ${MAKE} clean - rm -rf ${OBJECTS} ${TARGET} -endif +-include depend diff --git a/src/xvmc/SConscript b/src/xvmc/SConscript new file mode 100644 index 0000000000..53e04183e4 --- /dev/null +++ b/src/xvmc/SConscript @@ -0,0 +1,21 @@ +Import('*') + +if env['platform'] not in ['linux']: + Return() + +env = env.Clone() + +env.AppendUnique(CPPPATH = [ + '#/src/gallium/winsys/g3dvl', +]) + +XvMCapi = env.StaticLibrary( + target = 'XvMCapi', + source = [ + 'block.c', + 'surface.c', + 'context.c', + 'subpicture.c', + 'attributes.c', + ], +) diff --git a/src/xvmc/attributes.c b/src/xvmc/attributes.c index 674524b8b8..638da0b577 100644 --- a/src/xvmc/attributes.c +++ b/src/xvmc/attributes.c @@ -1,20 +1,19 @@ #include #include #include -#include +#include -XvAttribute* XvMCQueryAttributes(Display *display, XvMCContext *context, int *number) +XvAttribute* XvMCQueryAttributes(Display *dpy, XvMCContext *context, int *number) { - return NULL; + return NULL; } -Status XvMCSetAttribute(Display *display, XvMCContext *context, Atom attribute, int value) +Status XvMCSetAttribute(Display *dpy, XvMCContext *context, Atom attribute, int value) { - return BadImplementation; + return BadImplementation; } -Status XvMCGetAttribute(Display *display, XvMCContext *context, Atom attribute, int *value) +Status XvMCGetAttribute(Display *dpy, XvMCContext *context, Atom attribute, int *value) { - return BadImplementation; + return BadImplementation; } - diff --git a/src/xvmc/block.c b/src/xvmc/block.c index b38a89be09..78fddfb79e 100644 --- a/src/xvmc/block.c +++ b/src/xvmc/block.c @@ -1,79 +1,61 @@ #include #include -#include +#include #include -#include -#include -#include +#include "xvmc_private.h" -#define BLOCK_SIZE (64 * 2) - -Status XvMCCreateBlocks(Display *display, XvMCContext *context, unsigned int num_blocks, XvMCBlockArray *blocks) +Status XvMCCreateBlocks(Display *dpy, XvMCContext *context, unsigned int num_blocks, XvMCBlockArray *blocks) { - struct vlContext *vl_ctx; - - assert(display); - - if (!context) - return XvMCBadContext; - if (num_blocks == 0) - return BadValue; + assert(dpy); - assert(blocks); + if (!context) + return XvMCBadContext; + if (num_blocks == 0) + return BadValue; - vl_ctx = context->privData; - assert(display == vlGetNativeDisplay(vlGetDisplay(vlContextGetScreen(vl_ctx)))); + assert(blocks); - blocks->context_id = context->context_id; - blocks->num_blocks = num_blocks; - blocks->blocks = MALLOC(BLOCK_SIZE * num_blocks); - /* Since we don't have a VL type for blocks, set privData to the display so we can catch mismatches */ - blocks->privData = display; + blocks->context_id = context->context_id; + blocks->num_blocks = num_blocks; + blocks->blocks = MALLOC(BLOCK_SIZE_BYTES * num_blocks); + blocks->privData = NULL; - return Success; + return Success; } -Status XvMCDestroyBlocks(Display *display, XvMCBlockArray *blocks) +Status XvMCDestroyBlocks(Display *dpy, XvMCBlockArray *blocks) { - assert(display); - assert(blocks); - assert(display == blocks->privData); - FREE(blocks->blocks); + assert(dpy); + assert(blocks); + FREE(blocks->blocks); - return Success; + return Success; } -Status XvMCCreateMacroBlocks(Display *display, XvMCContext *context, unsigned int num_blocks, XvMCMacroBlockArray *blocks) +Status XvMCCreateMacroBlocks(Display *dpy, XvMCContext *context, unsigned int num_blocks, XvMCMacroBlockArray *blocks) { - struct vlContext *vl_ctx; - - assert(display); - - if (!context) - return XvMCBadContext; - if (num_blocks == 0) - return BadValue; + assert(dpy); - assert(blocks); + if (!context) + return XvMCBadContext; + if (num_blocks == 0) + return BadValue; - vl_ctx = context->privData; - assert(display == vlGetNativeDisplay(vlGetDisplay(vlContextGetScreen(vl_ctx)))); + assert(blocks); - blocks->context_id = context->context_id; - blocks->num_blocks = num_blocks; - blocks->macro_blocks = MALLOC(sizeof(XvMCMacroBlock) * num_blocks); - /* Since we don't have a VL type for blocks, set privData to the display so we can catch mismatches */ - blocks->privData = display; + blocks->context_id = context->context_id; + blocks->num_blocks = num_blocks; + blocks->macro_blocks = MALLOC(sizeof(XvMCMacroBlock) * num_blocks); + blocks->privData = NULL; - return Success; + return Success; } -Status XvMCDestroyMacroBlocks(Display *display, XvMCMacroBlockArray *blocks) +Status XvMCDestroyMacroBlocks(Display *dpy, XvMCMacroBlockArray *blocks) { - assert(display); - assert(blocks); - assert(display == blocks->privData); - FREE(blocks->macro_blocks); + assert(dpy); + assert(blocks); + FREE(blocks->macro_blocks); - return Success; + return Success; } diff --git a/src/xvmc/context.c b/src/xvmc/context.c index 9c2b6648bb..33f47838f5 100644 --- a/src/xvmc/context.c +++ b/src/xvmc/context.c @@ -1,210 +1,203 @@ #include -#include -#include #include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include +#include +#include "xvmc_private.h" -static Status Validate -( - Display *display, - XvPortID port, - int surface_type_id, - unsigned int width, - unsigned int height, - int flags, - int *found_port, - int *chroma_format, - int *mc_type -) +static Status Validate(Display *dpy, XvPortID port, int surface_type_id, + unsigned int width, unsigned int height, int flags, + bool *found_port, int *screen, int *chroma_format, int *mc_type) { - unsigned int found_surface = 0; - XvAdaptorInfo *adaptor_info; - unsigned int num_adaptors; - int num_types; - unsigned int max_width, max_height; - Status ret; - unsigned int i, j, k; - - assert(display && chroma_format); - - *found_port = 0; - - ret = XvQueryAdaptors(display, XDefaultRootWindow(display), &num_adaptors, &adaptor_info); - if (ret != Success) - return ret; - - /* Scan through all adaptors looking for this port and surface */ - for (i = 0; i < num_adaptors && !*found_port; ++i) - { - /* Scan through all ports of this adaptor looking for our port */ - for (j = 0; j < adaptor_info[i].num_ports && !*found_port; ++j) - { - /* If this is our port, scan through all its surfaces looking for our surface */ - if (adaptor_info[i].base_id + j == port) - { - XvMCSurfaceInfo *surface_info; - - *found_port = 1; - surface_info = XvMCListSurfaceTypes(display, adaptor_info[i].base_id, &num_types); - - if (surface_info) - { - for (k = 0; k < num_types && !found_surface; ++k) - { - if (surface_info[k].surface_type_id == surface_type_id) - { - found_surface = 1; - max_width = surface_info[k].max_width; - max_height = surface_info[k].max_height; - *chroma_format = surface_info[k].chroma_format; - *mc_type = surface_info[k].mc_type; - } - } - - XFree(surface_info); - } - else - { - XvFreeAdaptorInfo(adaptor_info); - return BadAlloc; - } - } - } - } - - XvFreeAdaptorInfo(adaptor_info); - - if (!*found_port) - return XvBadPort; - if (!found_surface) - return BadMatch; - if (width > max_width || height > max_height) - return BadValue; - if (flags != XVMC_DIRECT && flags != 0) - return BadValue; - - return Success; + bool found_surface = false; + XvAdaptorInfo *adaptor_info; + unsigned int num_adaptors; + int num_types; + unsigned int max_width, max_height; + Status ret; + + assert(dpy); + assert(found_port); + assert(screen); + assert(chroma_format); + assert(mc_type); + + *found_port = false; + + for (unsigned int i = 0; i < XScreenCount(dpy); ++i) + { + ret = XvQueryAdaptors(dpy, XRootWindow(dpy, i), &num_adaptors, &adaptor_info); + if (ret != Success) + return ret; + + for (unsigned int j = 0; j < num_adaptors && !*found_port; ++j) + { + for (unsigned int k = 0; k < adaptor_info[j].num_ports && !*found_port; ++k) + { + XvMCSurfaceInfo *surface_info; + + if (adaptor_info[j].base_id + k != port) + continue; + + *found_port = true; + + surface_info = XvMCListSurfaceTypes(dpy, adaptor_info[j].base_id, &num_types); + if (!surface_info) + { + XvFreeAdaptorInfo(adaptor_info); + return BadAlloc; + } + + for (unsigned int l = 0; l < num_types && !found_surface; ++l) + { + if (surface_info[l].surface_type_id != surface_type_id) + continue; + + found_surface = true; + max_width = surface_info[l].max_width; + max_height = surface_info[l].max_height; + *chroma_format = surface_info[l].chroma_format; + *mc_type = surface_info[l].mc_type; + *screen = i; + } + + XFree(surface_info); + } + } + + XvFreeAdaptorInfo(adaptor_info); + } + + if (!*found_port) + return XvBadPort; + if (!found_surface) + return BadMatch; + if (width > max_width || height > max_height) + return BadValue; + if (flags != XVMC_DIRECT && flags != 0) + return BadValue; + + return Success; } -static enum vlProfile ProfileToVL(int xvmc_profile) +static enum pipe_video_profile ProfileToPipe(int xvmc_profile) { - if (xvmc_profile & XVMC_MPEG_1) - assert(0); - else if (xvmc_profile & XVMC_MPEG_2) - return vlProfileMpeg2Main; - else if (xvmc_profile & XVMC_H263) - assert(0); - else if (xvmc_profile & XVMC_MPEG_4) - assert(0); - else - assert(0); - - return -1; + if (xvmc_profile & XVMC_MPEG_1) + assert(0); + if (xvmc_profile & XVMC_MPEG_2) + return PIPE_VIDEO_PROFILE_MPEG2_MAIN; + if (xvmc_profile & XVMC_H263) + assert(0); + if (xvmc_profile & XVMC_MPEG_4) + assert(0); + + assert(0); + + return -1; } -static enum vlEntryPoint EntryToVL(int xvmc_entry) +static enum pipe_video_chroma_format FormatToPipe(int xvmc_format) { - return xvmc_entry & XVMC_IDCT ? vlEntryPointIDCT : vlEntryPointMC; + switch (xvmc_format) + { + case XVMC_CHROMA_FORMAT_420: + return PIPE_VIDEO_CHROMA_FORMAT_420; + case XVMC_CHROMA_FORMAT_422: + return PIPE_VIDEO_CHROMA_FORMAT_422; + case XVMC_CHROMA_FORMAT_444: + return PIPE_VIDEO_CHROMA_FORMAT_444; + default: + assert(0); + } + + return -1; } -static enum vlFormat FormatToVL(int xvmc_format) +Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id, + int width, int height, int flags, XvMCContext *context) { - switch (xvmc_format) - { - case XVMC_CHROMA_FORMAT_420: - return vlFormatYCbCr420; - case XVMC_CHROMA_FORMAT_422: - return vlFormatYCbCr422; - case XVMC_CHROMA_FORMAT_444: - return vlFormatYCbCr444; - default: - assert(0); - } - - return -1; + bool found_port; + int scrn; + int chroma_format; + int mc_type; + Status ret; + struct pipe_screen *screen; + struct pipe_video_context *vpipe; + XvMCContextPrivate *context_priv; + + assert(dpy); + + if (!context) + return XvMCBadContext; + + ret = Validate(dpy, port, surface_type_id, width, height, flags, + &found_port, &scrn, &chroma_format, &mc_type); + + /* Success and XvBadPort have the same value */ + if (ret != Success || !found_port) + return ret; + + context_priv = CALLOC(1, sizeof(XvMCContextPrivate)); + if (!context_priv) + return BadAlloc; + + /* TODO: Reuse screen if process creates another context */ + screen = vl_screen_create(dpy, scrn); + + if (!screen) + { + FREE(context_priv); + return BadAlloc; + } + + vpipe = vl_video_create(screen, ProfileToPipe(mc_type), + FormatToPipe(chroma_format), width, height); + + if (!vpipe) + { + screen->destroy(screen); + FREE(context_priv); + return BadAlloc; + } + + context_priv->vpipe = vpipe; + + context->context_id = XAllocID(dpy); + context->surface_type_id = surface_type_id; + context->width = width; + context->height = height; + context->flags = flags; + context->port = port; + context->privData = context_priv; + + SyncHandle(); + + return Success; } -Status XvMCCreateContext(Display *display, XvPortID port, int surface_type_id, int width, int height, int flags, XvMCContext *context) +Status XvMCDestroyContext(Display *dpy, XvMCContext *context) { - int found_port; - int chroma_format; - int mc_type; - Status ret; - struct vlDisplay *vl_dpy; - struct vlScreen *vl_scrn; - struct vlContext *vl_ctx; - struct pipe_context *pipe; - Display *dpy = display; - - assert(display); - - if (!context) - return XvMCBadContext; - - ret = Validate(display, port, surface_type_id, width, height, flags, &found_port, &chroma_format, &mc_type); - - /* XXX: Success and XvBadPort have the same value */ - if (ret != Success || !found_port) - return ret; - - /* XXX: Assumes default screen, should check which screen port is on */ - pipe = create_pipe_context(display, XDefaultScreen(display)); - - assert(pipe); - - vlCreateDisplay(display, &vl_dpy); - vlCreateScreen(vl_dpy, XDefaultScreen(display), pipe->screen, &vl_scrn); - vlCreateContext - ( - vl_scrn, - pipe, - width, - height, - FormatToVL(chroma_format), - ProfileToVL(mc_type), - EntryToVL(mc_type), - &vl_ctx - ); - - context->context_id = XAllocID(display); - context->surface_type_id = surface_type_id; - context->width = width; - context->height = height; - context->flags = flags; - context->port = port; - context->privData = vl_ctx; - - SyncHandle(); - return Success; -} - -Status XvMCDestroyContext(Display *display, XvMCContext *context) -{ - struct vlContext *vl_ctx; - struct vlScreen *vl_screen; - struct vlDisplay *vl_dpy; - struct pipe_context *pipe; - - assert(display); - - if (!context) - return XvMCBadContext; + struct pipe_screen *screen; + struct pipe_video_context *vpipe; + XvMCContextPrivate *context_priv; - vl_ctx = context->privData; + assert(dpy); - assert(display == vlGetNativeDisplay(vlGetDisplay(vlContextGetScreen(vl_ctx)))); + if (!context || !context->privData) + return XvMCBadContext; - pipe = vlGetPipeContext(vl_ctx); - vl_screen = vlContextGetScreen(vl_ctx); - vl_dpy = vlGetDisplay(vl_screen); - vlDestroyContext(vl_ctx); - vlDestroyScreen(vl_screen); - vlDestroyDisplay(vl_dpy); - destroy_pipe_context(pipe); + context_priv = context->privData; + vpipe = context_priv->vpipe; + pipe_surface_reference(&context_priv->backbuffer, NULL); + screen = vpipe->screen; + vpipe->destroy(vpipe); + screen->destroy(screen); + FREE(context_priv); + context->privData = NULL; - return Success; + return Success; } diff --git a/src/xvmc/subpicture.c b/src/xvmc/subpicture.c index 09e9c98e6a..78ba618f5a 100644 --- a/src/xvmc/subpicture.c +++ b/src/xvmc/subpicture.c @@ -1,218 +1,168 @@ #include -#include -#include -#include #include +#include -Status XvMCCreateSubpicture -( - Display *display, - XvMCContext *context, - XvMCSubpicture *subpicture, - unsigned short width, - unsigned short height, - int xvimage_id -) +Status XvMCCreateSubpicture(Display *dpy, XvMCContext *context, XvMCSubpicture *subpicture, + unsigned short width, unsigned short height, int xvimage_id) { - Display *dpy = display; - assert(display); - - if (!context) - return XvMCBadContext; - - assert(subpicture); - - if (width > 2048 || height > 2048) - return BadValue; - - if (xvimage_id != 123) - return BadMatch; - - subpicture->subpicture_id = XAllocID(display); - subpicture->context_id = context->context_id; - subpicture->xvimage_id = xvimage_id; - subpicture->width = width; - subpicture->height = height; - subpicture->num_palette_entries = 0; - subpicture->entry_bytes = 0; - subpicture->component_order[0] = 0; - subpicture->component_order[1] = 0; - subpicture->component_order[2] = 0; - subpicture->component_order[3] = 0; - /* TODO: subpicture->privData = ;*/ - - SyncHandle(); - return Success; + assert(dpy); + + if (!context) + return XvMCBadContext; + + assert(subpicture); + + /*if (width > || height > ) + return BadValue;*/ + + /*if (xvimage_id != ) + return BadMatch;*/ + + subpicture->subpicture_id = XAllocID(dpy); + subpicture->context_id = context->context_id; + subpicture->xvimage_id = xvimage_id; + subpicture->width = width; + subpicture->height = height; + subpicture->num_palette_entries = 0; + subpicture->entry_bytes = 0; + subpicture->component_order[0] = 0; + subpicture->component_order[1] = 0; + subpicture->component_order[2] = 0; + subpicture->component_order[3] = 0; + /* TODO: subpicture->privData = ;*/ + + SyncHandle(); + + return Success; } -Status XvMCClearSubpicture -( - Display *display, - XvMCSubpicture *subpicture, - short x, - short y, - unsigned short width, - unsigned short height, - unsigned int color -) +Status XvMCClearSubpicture(Display *dpy, XvMCSubpicture *subpicture, short x, short y, + unsigned short width, unsigned short height, unsigned int color) { - assert(display); - - if (!subpicture) - return XvMCBadSubpicture; - - /* TODO: Assert clear rect is within bounds? Or clip? */ - - return Success; + assert(dpy); + + if (!subpicture) + return XvMCBadSubpicture; + + /* TODO: Assert clear rect is within bounds? Or clip? */ + + return Success; } -Status XvMCCompositeSubpicture -( - Display *display, - XvMCSubpicture *subpicture, - XvImage *image, - short srcx, - short srcy, - unsigned short width, - unsigned short height, - short dstx, - short dsty -) +Status XvMCCompositeSubpicture(Display *dpy, XvMCSubpicture *subpicture, XvImage *image, + short srcx, short srcy, unsigned short width, unsigned short height, + short dstx, short dsty) { - assert(display); - - if (!subpicture) - return XvMCBadSubpicture; - - assert(image); - - if (subpicture->xvimage_id != image->id) - return BadMatch; - - /* TODO: Assert rects are within bounds? Or clip? */ - - return Success; + assert(dpy); + + if (!subpicture) + return XvMCBadSubpicture; + + assert(image); + + if (subpicture->xvimage_id != image->id) + return BadMatch; + + /* TODO: Assert rects are within bounds? Or clip? */ + + return Success; } -Status XvMCDestroySubpicture(Display *display, XvMCSubpicture *subpicture) +Status XvMCDestroySubpicture(Display *dpy, XvMCSubpicture *subpicture) { - assert(display); - - if (!subpicture) - return XvMCBadSubpicture; - - return BadImplementation; + assert(dpy); + + if (!subpicture) + return XvMCBadSubpicture; + + return BadImplementation; } -Status XvMCSetSubpicturePalette(Display *display, XvMCSubpicture *subpicture, unsigned char *palette) +Status XvMCSetSubpicturePalette(Display *dpy, XvMCSubpicture *subpicture, unsigned char *palette) { - assert(display); - - if (!subpicture) - return XvMCBadSubpicture; - - assert(palette); - - /* We don't support paletted subpictures */ - return BadMatch; + assert(dpy); + + if (!subpicture) + return XvMCBadSubpicture; + + assert(palette); + + /* We don't support paletted subpictures */ + return BadMatch; } -Status XvMCBlendSubpicture -( - Display *display, - XvMCSurface *target_surface, - XvMCSubpicture *subpicture, - short subx, - short suby, - unsigned short subw, - unsigned short subh, - short surfx, - short surfy, - unsigned short surfw, - unsigned short surfh -) +Status XvMCBlendSubpicture(Display *dpy, XvMCSurface *target_surface, XvMCSubpicture *subpicture, + short subx, short suby, unsigned short subw, unsigned short subh, + short surfx, short surfy, unsigned short surfw, unsigned short surfh) { - assert(display); - - if (!target_surface) - return XvMCBadSurface; - - if (!subpicture) - return XvMCBadSubpicture; - - if (target_surface->context_id != subpicture->context_id) - return BadMatch; - - /* TODO: Assert rects are within bounds? Or clip? */ - return Success; + assert(dpy); + + if (!target_surface) + return XvMCBadSurface; + + if (!subpicture) + return XvMCBadSubpicture; + + if (target_surface->context_id != subpicture->context_id) + return BadMatch; + + /* TODO: Assert rects are within bounds? Or clip? */ + return Success; } -Status XvMCBlendSubpicture2 -( - Display *display, - XvMCSurface *source_surface, - XvMCSurface *target_surface, - XvMCSubpicture *subpicture, - short subx, - short suby, - unsigned short subw, - unsigned short subh, - short surfx, - short surfy, - unsigned short surfw, - unsigned short surfh -) +Status XvMCBlendSubpicture2(Display *dpy, XvMCSurface *source_surface, XvMCSurface *target_surface, + XvMCSubpicture *subpicture, short subx, short suby, unsigned short subw, unsigned short subh, + short surfx, short surfy, unsigned short surfw, unsigned short surfh) { - assert(display); - - if (!source_surface || !target_surface) - return XvMCBadSurface; - - if (!subpicture) - return XvMCBadSubpicture; - - if (source_surface->context_id != subpicture->context_id) - return BadMatch; - - if (source_surface->context_id != subpicture->context_id) - return BadMatch; - - /* TODO: Assert rects are within bounds? Or clip? */ - return Success; + assert(dpy); + + if (!source_surface || !target_surface) + return XvMCBadSurface; + + if (!subpicture) + return XvMCBadSubpicture; + + if (source_surface->context_id != subpicture->context_id) + return BadMatch; + + if (source_surface->context_id != subpicture->context_id) + return BadMatch; + + /* TODO: Assert rects are within bounds? Or clip? */ + return Success; } -Status XvMCSyncSubpicture(Display *display, XvMCSubpicture *subpicture) +Status XvMCSyncSubpicture(Display *dpy, XvMCSubpicture *subpicture) { - assert(display); - - if (!subpicture) - return XvMCBadSubpicture; - - return Success; + assert(dpy); + + if (!subpicture) + return XvMCBadSubpicture; + + return Success; } -Status XvMCFlushSubpicture(Display *display, XvMCSubpicture *subpicture) +Status XvMCFlushSubpicture(Display *dpy, XvMCSubpicture *subpicture) { - assert(display); - - if (!subpicture) - return XvMCBadSubpicture; - - return Success; + assert(dpy); + + if (!subpicture) + return XvMCBadSubpicture; + + return Success; } -Status XvMCGetSubpictureStatus(Display *display, XvMCSubpicture *subpicture, int *status) +Status XvMCGetSubpictureStatus(Display *dpy, XvMCSubpicture *subpicture, int *status) { - assert(display); - - if (!subpicture) - return XvMCBadSubpicture; - - assert(status); - - /* TODO */ - *status = 0; - - return Success; -} + assert(dpy); + if (!subpicture) + return XvMCBadSubpicture; + + assert(status); + + /* TODO */ + *status = 0; + + return Success; +} diff --git a/src/xvmc/surface.c b/src/xvmc/surface.c index fea351b84f..0467c4d07d 100644 --- a/src/xvmc/surface.c +++ b/src/xvmc/surface.c @@ -1,290 +1,369 @@ #include -#include -#include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include "xvmc_private.h" -static enum vlMacroBlockType TypeToVL(int xvmc_mb_type) +static enum pipe_mpeg12_macroblock_type TypeToPipe(int xvmc_mb_type) { - if (xvmc_mb_type & XVMC_MB_TYPE_INTRA) - return vlMacroBlockTypeIntra; - if ((xvmc_mb_type & (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) == XVMC_MB_TYPE_MOTION_FORWARD) - return vlMacroBlockTypeFwdPredicted; - if ((xvmc_mb_type & (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) == XVMC_MB_TYPE_MOTION_BACKWARD) - return vlMacroBlockTypeBkwdPredicted; - if ((xvmc_mb_type & (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) == (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) - return vlMacroBlockTypeBiPredicted; - - assert(0); - - return -1; + if (xvmc_mb_type & XVMC_MB_TYPE_INTRA) + return PIPE_MPEG12_MACROBLOCK_TYPE_INTRA; + if ((xvmc_mb_type & (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) == XVMC_MB_TYPE_MOTION_FORWARD) + return PIPE_MPEG12_MACROBLOCK_TYPE_FWD; + if ((xvmc_mb_type & (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) == XVMC_MB_TYPE_MOTION_BACKWARD) + return PIPE_MPEG12_MACROBLOCK_TYPE_BKWD; + if ((xvmc_mb_type & (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) == (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) + return PIPE_MPEG12_MACROBLOCK_TYPE_BI; + + assert(0); + + return -1; } -static enum vlPictureType PictureToVL(int xvmc_pic) +static enum pipe_mpeg12_picture_type PictureToPipe(int xvmc_pic) { - switch (xvmc_pic) - { - case XVMC_TOP_FIELD: - return vlPictureTypeTopField; - case XVMC_BOTTOM_FIELD: - return vlPictureTypeBottomField; - case XVMC_FRAME_PICTURE: - return vlPictureTypeFrame; - default: - assert(0); - } - - return -1; + switch (xvmc_pic) + { + case XVMC_TOP_FIELD: + return PIPE_MPEG12_PICTURE_TYPE_FIELD_TOP; + case XVMC_BOTTOM_FIELD: + return PIPE_MPEG12_PICTURE_TYPE_FIELD_BOTTOM; + case XVMC_FRAME_PICTURE: + return PIPE_MPEG12_PICTURE_TYPE_FRAME; + default: + assert(0); + } + + return -1; } -static enum vlMotionType MotionToVL(int xvmc_motion_type, int xvmc_dct_type) +static enum pipe_mpeg12_motion_type MotionToPipe(int xvmc_motion_type, int xvmc_dct_type) { - switch (xvmc_motion_type) - { - case XVMC_PREDICTION_FRAME: - return xvmc_dct_type == XVMC_DCT_TYPE_FIELD ? vlMotionType16x8 : vlMotionTypeFrame; - case XVMC_PREDICTION_FIELD: - return vlMotionTypeField; - case XVMC_PREDICTION_DUAL_PRIME: - return vlMotionTypeDualPrime; - default: - assert(0); - } - - return -1; + switch (xvmc_motion_type) + { + case XVMC_PREDICTION_FRAME: + return xvmc_dct_type == XVMC_DCT_TYPE_FIELD ? + PIPE_MPEG12_MOTION_TYPE_16x8 : PIPE_MPEG12_MOTION_TYPE_FRAME; + case XVMC_PREDICTION_FIELD: + return PIPE_MPEG12_MOTION_TYPE_FIELD; + case XVMC_PREDICTION_DUAL_PRIME: + return PIPE_MPEG12_MOTION_TYPE_DUALPRIME; + default: + assert(0); + } + + return -1; } -Status XvMCCreateSurface(Display *display, XvMCContext *context, XvMCSurface *surface) +static bool +CreateOrResizeBackBuffer(struct pipe_video_context *vpipe, unsigned int width, unsigned int height, + struct pipe_surface **backbuffer) { - struct vlContext *vl_ctx; - struct vlSurface *vl_sfc; - Display *dpy = display; - - assert(display); - - if (!context) - return XvMCBadContext; - if (!surface) - return XvMCBadSurface; - - vl_ctx = context->privData; - - assert(display == vlGetNativeDisplay(vlGetDisplay(vlContextGetScreen(vl_ctx)))); - - if (vlCreateSurface(vlContextGetScreen(vl_ctx), - context->width, context->height, - vlGetPictureFormat(vl_ctx), - &vl_sfc)) - { - return BadAlloc; - } - - vlBindToContext(vl_sfc, vl_ctx); + struct pipe_texture template; + struct pipe_texture *tex; + + assert(vpipe); + + if (*backbuffer) + { + if ((*backbuffer)->width != width || (*backbuffer)->height != height) + pipe_surface_reference(backbuffer, NULL); + else + return true; + } + + memset(&template, 0, sizeof(struct pipe_texture)); + template.target = PIPE_TEXTURE_2D; + /* XXX: Needs to match the drawable's format? */ + template.format = PIPE_FORMAT_X8R8G8B8_UNORM; + template.last_level = 0; + template.width[0] = width; + template.height[0] = height; + template.depth[0] = 1; + pf_get_block(template.format, &template.block); + template.tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET; + + tex = vpipe->screen->texture_create(vpipe->screen, &template); + if (!tex) + return false; + + *backbuffer = vpipe->screen->get_tex_surface(vpipe->screen, tex, 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_READ | + PIPE_BUFFER_USAGE_GPU_WRITE); + pipe_texture_reference(&tex, NULL); + + if (!*backbuffer) + return false; + + /* Clear the backbuffer in case the video doesn't cover the whole window */ + /* FIXME: Need to clear every time a frame moves and leaves dirty rects */ + vpipe->clear_surface(vpipe, 0, 0, width, height, 0, *backbuffer); + + return true; +} - surface->surface_id = XAllocID(display); - surface->context_id = context->context_id; - surface->surface_type_id = context->surface_type_id; - surface->width = context->width; - surface->height = context->height; - surface->privData = vl_sfc; +static void +MacroBlocksToPipe(const XvMCMacroBlockArray *xvmc_macroblocks, + const XvMCBlockArray *xvmc_blocks, + unsigned int first_macroblock, + unsigned int num_macroblocks, + struct pipe_mpeg12_macroblock *pipe_macroblocks) +{ + unsigned int i, j, k, l; + XvMCMacroBlock *xvmc_mb; + + assert(xvmc_macroblocks); + assert(xvmc_blocks); + assert(pipe_macroblocks); + assert(num_macroblocks); + + xvmc_mb = xvmc_macroblocks->macro_blocks + first_macroblock; + + for (i = 0; i < num_macroblocks; ++i) + { + pipe_macroblocks->base.codec = PIPE_VIDEO_CODEC_MPEG12; + pipe_macroblocks->mbx = xvmc_mb->x; + pipe_macroblocks->mby = xvmc_mb->y; + pipe_macroblocks->mb_type = TypeToPipe(xvmc_mb->macroblock_type); + if (pipe_macroblocks->mb_type != PIPE_MPEG12_MACROBLOCK_TYPE_INTRA) + pipe_macroblocks->mo_type = MotionToPipe(xvmc_mb->motion_type, xvmc_mb->dct_type); + /* Get rid of Valgrind 'undefined' warnings */ + else + pipe_macroblocks->mo_type = -1; + pipe_macroblocks->dct_type = xvmc_mb->dct_type == XVMC_DCT_TYPE_FIELD ? + PIPE_MPEG12_DCT_TYPE_FIELD : PIPE_MPEG12_DCT_TYPE_FRAME; + + for (j = 0; j < 2; ++j) + for (k = 0; k < 2; ++k) + for (l = 0; l < 2; ++l) + pipe_macroblocks->pmv[j][k][l] = xvmc_mb->PMV[j][k][l]; + + pipe_macroblocks->cbp = xvmc_mb->coded_block_pattern; + pipe_macroblocks->blocks = xvmc_blocks->blocks + xvmc_mb->index * BLOCK_SIZE_SAMPLES; + + ++pipe_macroblocks; + ++xvmc_mb; + } +} - SyncHandle(); - return Success; +Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surface) +{ + XvMCContextPrivate *context_priv; + struct pipe_video_context *vpipe; + XvMCSurfacePrivate *surface_priv; + struct pipe_video_surface *vsfc; + + assert(dpy); + + if (!context) + return XvMCBadContext; + if (!surface) + return XvMCBadSurface; + + context_priv = context->privData; + vpipe = context_priv->vpipe; + + surface_priv = CALLOC(1, sizeof(XvMCSurfacePrivate)); + if (!surface_priv) + return BadAlloc; + + vsfc = vpipe->screen->video_surface_create(vpipe->screen, vpipe->chroma_format, + vpipe->width, vpipe->height); + if (!vsfc) + { + FREE(surface_priv); + return BadAlloc; + } + + surface_priv->pipe_vsfc = vsfc; + surface_priv->context = context; + + surface->surface_id = XAllocID(dpy); + surface->context_id = context->context_id; + surface->surface_type_id = context->surface_type_id; + surface->width = context->width; + surface->height = context->height; + surface->privData = surface_priv; + + SyncHandle(); + + return Success; } -Status XvMCRenderSurface -( - Display *display, - XvMCContext *context, - unsigned int picture_structure, - XvMCSurface *target_surface, - XvMCSurface *past_surface, - XvMCSurface *future_surface, - unsigned int flags, - unsigned int num_macroblocks, - unsigned int first_macroblock, - XvMCMacroBlockArray *macroblocks, - XvMCBlockArray *blocks +Status XvMCRenderSurface(Display *dpy, XvMCContext *context, unsigned int picture_structure, + XvMCSurface *target_surface, XvMCSurface *past_surface, XvMCSurface *future_surface, + unsigned int flags, unsigned int num_macroblocks, unsigned int first_macroblock, + XvMCMacroBlockArray *macroblocks, XvMCBlockArray *blocks ) { - struct vlContext *vl_ctx; - struct vlSurface *target_vl_surface; - struct vlSurface *past_vl_surface; - struct vlSurface *future_vl_surface; - struct vlMpeg2MacroBlockBatch batch; - struct vlMpeg2MacroBlock vl_macroblocks[num_macroblocks]; - unsigned int i; - - assert(display); - - if (!context) - return XvMCBadContext; - if (!target_surface) - return XvMCBadSurface; - - if - ( - picture_structure != XVMC_TOP_FIELD && - picture_structure != XVMC_BOTTOM_FIELD && - picture_structure != XVMC_FRAME_PICTURE - ) - return BadValue; - if (future_surface && !past_surface) - return BadMatch; - - vl_ctx = context->privData; - - assert(display == vlGetNativeDisplay(vlGetDisplay(vlContextGetScreen(vl_ctx)))); - - target_vl_surface = target_surface->privData; - past_vl_surface = past_surface ? past_surface->privData : NULL; - future_vl_surface = future_surface ? future_surface->privData : NULL; - - assert(context->context_id == target_surface->context_id); - assert(!past_surface || context->context_id == past_surface->context_id); - assert(!future_surface || context->context_id == future_surface->context_id); - - assert(macroblocks); - assert(blocks); - - assert(macroblocks->context_id == context->context_id); - assert(blocks->context_id == context->context_id); - - assert(flags == 0 || flags == XVMC_SECOND_FIELD); - - batch.past_surface = past_vl_surface; - batch.future_surface = future_vl_surface; - batch.picture_type = PictureToVL(picture_structure); - batch.field_order = flags & XVMC_SECOND_FIELD ? vlFieldOrderSecond : vlFieldOrderFirst; - batch.num_macroblocks = num_macroblocks; - batch.macroblocks = vl_macroblocks; - - for (i = 0; i < num_macroblocks; ++i) - { - unsigned int j = first_macroblock + i; - - unsigned int k, l, m; - - batch.macroblocks[i].mbx = macroblocks->macro_blocks[j].x; - batch.macroblocks[i].mby = macroblocks->macro_blocks[j].y; - batch.macroblocks[i].mb_type = TypeToVL(macroblocks->macro_blocks[j].macroblock_type); - if (batch.macroblocks[i].mb_type != vlMacroBlockTypeIntra) - batch.macroblocks[i].mo_type = MotionToVL(macroblocks->macro_blocks[j].motion_type, macroblocks->macro_blocks[j].dct_type); - batch.macroblocks[i].dct_type = macroblocks->macro_blocks[j].dct_type == XVMC_DCT_TYPE_FIELD ? vlDCTTypeFieldCoded : vlDCTTypeFrameCoded; - - for (k = 0; k < 2; ++k) - for (l = 0; l < 2; ++l) - for (m = 0; m < 2; ++m) - batch.macroblocks[i].PMV[k][l][m] = macroblocks->macro_blocks[j].PMV[k][l][m]; - - batch.macroblocks[i].cbp = macroblocks->macro_blocks[j].coded_block_pattern; - batch.macroblocks[i].blocks = blocks->blocks + (macroblocks->macro_blocks[j].index * 64); - } - - vlRenderMacroBlocksMpeg2(&batch, target_vl_surface); - - return Success; + struct pipe_video_context *vpipe; + struct pipe_surface *t_vsfc; + struct pipe_surface *p_vsfc; + struct pipe_surface *f_vsfc; + XvMCContextPrivate *context_priv; + XvMCSurfacePrivate *target_surface_priv; + XvMCSurfacePrivate *past_surface_priv; + XvMCSurfacePrivate *future_surface_priv; + struct pipe_mpeg12_macroblock pipe_macroblocks[num_macroblocks]; + + assert(dpy); + + if (!context || !context->privData) + return XvMCBadContext; + if (!target_surface || !target_surface->privData) + return XvMCBadSurface; + + if (picture_structure != XVMC_TOP_FIELD && + picture_structure != XVMC_BOTTOM_FIELD && + picture_structure != XVMC_FRAME_PICTURE) + return BadValue; + /* Bkwd pred equivalent to fwd (past && !future) */ + if (future_surface && !past_surface) + return BadMatch; + + assert(context->context_id == target_surface->context_id); + assert(!past_surface || context->context_id == past_surface->context_id); + assert(!future_surface || context->context_id == future_surface->context_id); + + assert(macroblocks); + assert(blocks); + + assert(macroblocks->context_id == context->context_id); + assert(blocks->context_id == context->context_id); + + assert(flags == 0 || flags == XVMC_SECOND_FIELD); + + target_surface_priv = target_surface->privData; + past_surface_priv = past_surface ? past_surface->privData : NULL; + future_surface_priv = future_surface ? future_surface->privData : NULL; + + assert(target_surface_priv->context == context); + assert(!past_surface || past_surface_priv->context == context); + assert(!future_surface || future_surface_priv->context == context); + + context_priv = context->privData; + vpipe = context_priv->vpipe; + + t_vsfc = target_surface_priv->pipe_vsfc; + p_vsfc = past_surface ? past_surface_priv->pipe_vsfc : NULL; + f_vsfc = future_surface ? future_surface_priv->pipe_vsfc : NULL; + + MacroBlocksToPipe(macroblocks, blocks, first_macroblock, + num_macroblocks, pipe_macroblocks); + + vpipe->set_decode_target(vpipe, t_vsfc); + vpipe->decode_macroblocks(vpipe, p_vsfc, f_vsfc, num_macroblocks, + &pipe_macroblocks->base, target_surface_priv->render_fence); + + return Success; } -Status XvMCFlushSurface(Display *display, XvMCSurface *surface) +Status XvMCFlushSurface(Display *dpy, XvMCSurface *surface) { +#if 0 struct vlSurface *vl_sfc; - assert(display); + assert(dpy); if (!surface) return XvMCBadSurface; vl_sfc = surface->privData; - assert(display == vlGetNativeDisplay(vlGetDisplay(vlSurfaceGetScreen(vl_sfc)))); - vlSurfaceFlush(vl_sfc); - - return Success; +#endif + return Success; } -Status XvMCSyncSurface(Display *display, XvMCSurface *surface) +Status XvMCSyncSurface(Display *dpy, XvMCSurface *surface) { +#if 0 struct vlSurface *vl_sfc; - assert(display); + assert(dpy); if (!surface) return XvMCBadSurface; vl_sfc = surface->privData; - assert(display == vlGetNativeDisplay(vlGetDisplay(vlSurfaceGetScreen(vl_sfc)))); - vlSurfaceSync(vl_sfc); - - return Success; +#endif + return Success; } -Status XvMCPutSurface -( - Display *display, - XvMCSurface *surface, - Drawable drawable, - short srcx, - short srcy, - unsigned short srcw, - unsigned short srch, - short destx, - short desty, - unsigned short destw, - unsigned short desth, - int flags -) +Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable, + short srcx, short srcy, unsigned short srcw, unsigned short srch, + short destx, short desty, unsigned short destw, unsigned short desth, + int flags) { - Window root; - int x, y; - unsigned int width, height; - unsigned int border_width; - unsigned int depth; - struct vlSurface *vl_sfc; - - assert(display); - - if (!surface) - return XvMCBadSurface; - - if (XGetGeometry(display, drawable, &root, &x, &y, &width, &height, &border_width, &depth) == BadDrawable) - return BadDrawable; - - assert(flags == XVMC_TOP_FIELD || flags == XVMC_BOTTOM_FIELD || flags == XVMC_FRAME_PICTURE); - - /* TODO: Correct for negative srcx,srcy & destx,desty by clipping */ - - assert(srcx + srcw - 1 < surface->width); - assert(srcy + srch - 1 < surface->height); - /* XXX: Some apps (mplayer) hit these asserts because they call - * this function after the window has been resized by the WM - * but before they've handled the corresponding XEvent and - * know about the new dimensions. The output will be clipped - * for a few frames until the app updates destw and desth. - */ - /*assert(destx + destw - 1 < width); - assert(desty + desth - 1 < height);*/ - - vl_sfc = surface->privData; - - vlPutPicture(vl_sfc, drawable, srcx, srcy, srcw, srch, destx, desty, destw, desth, width, height, PictureToVL(flags)); - - return Success; + Window root; + int x, y; + unsigned int width, height; + unsigned int border_width; + unsigned int depth; + struct pipe_video_context *vpipe; + XvMCSurfacePrivate *surface_priv; + XvMCContextPrivate *context_priv; + XvMCContext *context; + struct pipe_video_rect src_rect = {srcx, srcy, srcw, srch}; + struct pipe_video_rect dst_rect = {destx, desty, destw, desth}; + + assert(dpy); + + if (!surface || !surface->privData) + return XvMCBadSurface; + + if (XGetGeometry(dpy, drawable, &root, &x, &y, &width, &height, &border_width, &depth) == BadDrawable) + return BadDrawable; + + assert(flags == XVMC_TOP_FIELD || flags == XVMC_BOTTOM_FIELD || flags == XVMC_FRAME_PICTURE); + assert(srcx + srcw - 1 < surface->width); + assert(srcy + srch - 1 < surface->height); + /* + * Some apps (mplayer) hit these asserts because they call + * this function after the window has been resized by the WM + * but before they've handled the corresponding XEvent and + * know about the new dimensions. The output should be clipped + * until the app updates destw and desth. + */ + /* + assert(destx + destw - 1 < width); + assert(desty + desth - 1 < height); + */ + + surface_priv = surface->privData; + context = surface_priv->context; + context_priv = context->privData; + vpipe = context_priv->vpipe; + + if (!CreateOrResizeBackBuffer(vpipe, width, height, &context_priv->backbuffer)) + return BadAlloc; + + vpipe->render_picture(vpipe, surface_priv->pipe_vsfc, PictureToPipe(flags), &src_rect, + context_priv->backbuffer, &dst_rect, surface_priv->disp_fence); + + vl_video_bind_drawable(vpipe, drawable); + + vpipe->screen->flush_frontbuffer + ( + vpipe->screen, + context_priv->backbuffer, + vpipe->priv + ); + + return Success; } -Status XvMCGetSurfaceStatus(Display *display, XvMCSurface *surface, int *status) +Status XvMCGetSurfaceStatus(Display *dpy, XvMCSurface *surface, int *status) { +#if 0 struct vlSurface *vl_sfc; enum vlResourceStatus res_status; - assert(display); + assert(dpy); if (!surface) return XvMCBadSurface; @@ -293,8 +372,6 @@ Status XvMCGetSurfaceStatus(Display *display, XvMCSurface *surface, int *status) vl_sfc = surface->privData; - assert(display == vlGetNativeDisplay(vlGetDisplay(vlSurfaceGetScreen(vl_sfc)))); - vlSurfaceGetStatus(vl_sfc, &res_status); switch (res_status) @@ -317,42 +394,36 @@ Status XvMCGetSurfaceStatus(Display *display, XvMCSurface *surface, int *status) default: assert(0); } - - return Success; +#endif + *status = 0; + return Success; } -Status XvMCDestroySurface(Display *display, XvMCSurface *surface) +Status XvMCDestroySurface(Display *dpy, XvMCSurface *surface) { - struct vlSurface *vl_sfc; + XvMCSurfacePrivate *surface_priv; - assert(display); + assert(dpy); - if (!surface) - return XvMCBadSurface; + if (!surface || !surface->privData) + return XvMCBadSurface; - vl_sfc = surface->privData; + surface_priv = surface->privData; + pipe_video_surface_reference(&surface_priv->pipe_vsfc, NULL); + FREE(surface_priv); + surface->privData = NULL; - assert(display == vlGetNativeDisplay(vlGetDisplay(vlSurfaceGetScreen(vl_sfc)))); - - vlDestroySurface(vl_sfc); - - return Success; + return Success; } -Status XvMCHideSurface(Display *display, XvMCSurface *surface) +Status XvMCHideSurface(Display *dpy, XvMCSurface *surface) { - struct vlSurface *vl_sfc; - - assert(display); - - if (!surface) - return XvMCBadSurface; - - vl_sfc = surface->privData; + assert(dpy); - assert(display == vlGetNativeDisplay(vlGetDisplay(vlSurfaceGetScreen(vl_sfc)))); + if (!surface || !surface->privData) + return XvMCBadSurface; - /* No op, only for overlaid rendering */ + /* No op, only for overlaid rendering */ - return Success; + return Success; } diff --git a/src/xvmc/tests/Makefile b/src/xvmc/tests/Makefile index de095161d2..11b2e1a812 100644 --- a/src/xvmc/tests/Makefile +++ b/src/xvmc/tests/Makefile @@ -1,27 +1,28 @@ -CFLAGS += -g -Wall -LDFLAGS += -LIBS += -lXvMCW -lXvMC -lXv +TOP = ../../.. +include $(TOP)/configs/current + +LIBS = -lXvMCW -lXvMC -lXv -lX11 ############################################# -.PHONY = all clean +.PHONY: default clean -all: test_context test_surface test_blocks test_rendering xvmc_bench +default: test_context test_surface test_blocks test_rendering xvmc_bench test_context: test_context.o testlib.o - $(CC) ${LDFLAGS} -o $@ $^ ${LIBS} + $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) test_surface: test_surface.o testlib.o - $(CC) ${LDFLAGS} -o $@ $^ ${LIBS} + $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) test_blocks: test_blocks.o testlib.o - $(CC) ${LDFLAGS} -o $@ $^ ${LIBS} + $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) test_rendering: test_rendering.o testlib.o - $(CC) ${LDFLAGS} -o $@ $^ ${LIBS} + $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) xvmc_bench: xvmc_bench.o testlib.o - $(CC) ${LDFLAGS} -o $@ $^ ${LIBS} + $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) clean: - rm -rf *.o test_context test_surface test_blocks test_rendering xvmc_bench + $(RM) -rf *.o test_context test_surface test_blocks test_rendering xvmc_bench diff --git a/src/xvmc/tests/test_rendering.c b/src/xvmc/tests/test_rendering.c index 1e7467a3aa..6d720dfcdc 100644 --- a/src/xvmc/tests/test_rendering.c +++ b/src/xvmc/tests/test_rendering.c @@ -23,6 +23,9 @@ #define DEFAULT_OUTPUT_HEIGHT INPUT_HEIGHT #define DEFAULT_ACCEPTABLE_ERR 0.01 +void ParseArgs(int argc, char **argv, unsigned int *output_width, unsigned int *output_height, double *acceptable_error, int *prompt); +void Gradient(short *block, unsigned int start, unsigned int stop, int horizontal); + void ParseArgs(int argc, char **argv, unsigned int *output_width, unsigned int *output_height, double *acceptable_error, int *prompt) { int fail = 0; diff --git a/src/xvmc/tests/test_surface.c b/src/xvmc/tests/test_surface.c index 25ebdcc4fc..06948201ac 100644 --- a/src/xvmc/tests/test_surface.c +++ b/src/xvmc/tests/test_surface.c @@ -6,7 +6,7 @@ int main(int argc, char **argv) { const unsigned int width = 16, height = 16; const unsigned int mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2}; - + Display *display; XvPortID port_num; int surface_type_id; @@ -14,9 +14,9 @@ int main(int argc, char **argv) int colorkey; XvMCContext context; XvMCSurface surface = {0}; - + display = XOpenDisplay(NULL); - + if (!GetPort ( display, @@ -34,15 +34,15 @@ int main(int argc, char **argv) XCloseDisplay(display); error(1, 0, "Error, unable to find a good port.\n"); } - + if (is_overlay) { Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0); XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey); } - + assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, XVMC_DIRECT, &context) == Success); - + /* Test NULL context */ assert(XvMCCreateSurface(display, NULL, &surface) == XvMCBadContext); /* Test NULL surface */ @@ -61,12 +61,11 @@ int main(int argc, char **argv) assert(XvMCDestroySurface(display, &surface) == Success); /* Test NULL surface */ assert(XvMCDestroySurface(display, NULL) == XvMCBadSurface); - + assert(XvMCDestroyContext(display, &context) == Success); - + XvUngrabPort(display, port_num, CurrentTime); XCloseDisplay(display); - + return 0; } - diff --git a/src/xvmc/tests/xvmc_bench.c b/src/xvmc/tests/xvmc_bench.c index d5a39ecf17..97adcfc58a 100644 --- a/src/xvmc/tests/xvmc_bench.c +++ b/src/xvmc/tests/xvmc_bench.c @@ -32,6 +32,8 @@ struct Config unsigned int reps; }; +void ParseArgs(int argc, char **argv, struct Config *config); + void ParseArgs(int argc, char **argv, struct Config *config) { int fail = 0; diff --git a/src/xvmc/xvmc_private.h b/src/xvmc/xvmc_private.h new file mode 100644 index 0000000000..1e3dd561c6 --- /dev/null +++ b/src/xvmc/xvmc_private.h @@ -0,0 +1,31 @@ +#ifndef xvmc_private_h +#define xvmc_private_h + +#include +#include + +#define BLOCK_SIZE_SAMPLES 64 +#define BLOCK_SIZE_BYTES (BLOCK_SIZE_SAMPLES * 2) + +struct pipe_video_context; +struct pipe_surface; +struct pipe_fence_handle; + +typedef struct +{ + struct pipe_video_context *vpipe; + struct pipe_surface *backbuffer; +} XvMCContextPrivate; + +typedef struct +{ + struct pipe_video_surface *pipe_vsfc; + struct pipe_fence_handle *render_fence; + struct pipe_fence_handle *disp_fence; + + /* Some XvMC functions take a surface but not a context, + so we keep track of which context each surface belongs to. */ + XvMCContext *context; +} XvMCSurfacePrivate; + +#endif /* xvmc_private_h */ -- cgit v1.2.3 From 8abb984dc93235e00b5006187bf177da5db257e1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:19:24 -0600 Subject: mesa: null-out StoreTexImageFunc fields --- src/mesa/main/texformat.c | 106 +++++++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 53 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 85a7fe6e2c..2169d294c6 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -156,7 +156,7 @@ const struct gl_texture_format _mesa_texformat_rgba = { 0, /* DepthBits */ 0, /* StencilBits */ 4 * sizeof(GLchan), /* TexelBytes */ - _mesa_texstore_rgba, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -180,7 +180,7 @@ const struct gl_texture_format _mesa_texformat_rgb = { 0, /* DepthBits */ 0, /* StencilBits */ 3 * sizeof(GLchan), /* TexelBytes */ - _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -204,7 +204,7 @@ const struct gl_texture_format _mesa_texformat_alpha = { 0, /* DepthBits */ 0, /* StencilBits */ sizeof(GLchan), /* TexelBytes */ - _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -228,7 +228,7 @@ const struct gl_texture_format _mesa_texformat_luminance = { 0, /* DepthBits */ 0, /* StencilBits */ sizeof(GLchan), /* TexelBytes */ - _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -252,7 +252,7 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha = { 0, /* DepthBits */ 0, /* StencilBits */ 2 * sizeof(GLchan), /* TexelBytes */ - _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -276,7 +276,7 @@ const struct gl_texture_format _mesa_texformat_intensity = { 0, /* DepthBits */ 0, /* StencilBits */ sizeof(GLchan), /* TexelBytes */ - _mesa_texstore_rgba,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -303,7 +303,7 @@ const struct gl_texture_format _mesa_texformat_srgb8 = { 0, /* DepthBits */ 0, /* StencilBits */ 3, /* TexelBytes */ - _mesa_texstore_srgb8, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -327,7 +327,7 @@ const struct gl_texture_format _mesa_texformat_srgba8 = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - _mesa_texstore_srgba8, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -351,7 +351,7 @@ const struct gl_texture_format _mesa_texformat_sargb8 = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - _mesa_texstore_sargb8, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -375,7 +375,7 @@ const struct gl_texture_format _mesa_texformat_sl8 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - _mesa_texstore_sl8, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -400,7 +400,7 @@ const struct gl_texture_format _mesa_texformat_sla8 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_sla8, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -426,7 +426,7 @@ const struct gl_texture_format _mesa_texformat_rgba_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 4 * sizeof(GLfloat), /* TexelBytes */ - _mesa_texstore_rgba_float32, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ @@ -450,7 +450,7 @@ const struct gl_texture_format _mesa_texformat_rgba_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 4 * sizeof(GLhalfARB), /* TexelBytes */ - _mesa_texstore_rgba_float16, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ @@ -474,7 +474,7 @@ const struct gl_texture_format _mesa_texformat_rgb_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 3 * sizeof(GLfloat), /* TexelBytes */ - _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ @@ -498,7 +498,7 @@ const struct gl_texture_format _mesa_texformat_rgb_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 3 * sizeof(GLhalfARB), /* TexelBytes */ - _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ @@ -522,7 +522,7 @@ const struct gl_texture_format _mesa_texformat_alpha_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLfloat), /* TexelBytes */ - _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ @@ -546,7 +546,7 @@ const struct gl_texture_format _mesa_texformat_alpha_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLhalfARB), /* TexelBytes */ - _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ @@ -570,7 +570,7 @@ const struct gl_texture_format _mesa_texformat_luminance_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLfloat), /* TexelBytes */ - _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -594,7 +594,7 @@ const struct gl_texture_format _mesa_texformat_luminance_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLhalfARB), /* TexelBytes */ - _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -618,7 +618,7 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 2 * sizeof(GLfloat), /* TexelBytes */ - _mesa_texstore_rgba_float32, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -642,7 +642,7 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 2 * sizeof(GLhalfARB), /* TexelBytes */ - _mesa_texstore_rgba_float16, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -666,7 +666,7 @@ const struct gl_texture_format _mesa_texformat_intensity_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLfloat), /* TexelBytes */ - _mesa_texstore_rgba_float32,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -690,7 +690,7 @@ const struct gl_texture_format _mesa_texformat_intensity_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLhalfARB), /* TexelBytes */ - _mesa_texstore_rgba_float16,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -716,7 +716,7 @@ const struct gl_texture_format _mesa_texformat_dudv8 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_dudv8, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -740,7 +740,7 @@ const struct gl_texture_format _mesa_texformat_signed_rgba8888 = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - _mesa_texstore_signed_rgba8888, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -764,7 +764,7 @@ const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - _mesa_texstore_signed_rgba8888, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -795,7 +795,7 @@ const struct gl_texture_format _mesa_texformat_rgba8888 = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - _mesa_texstore_rgba8888, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -819,7 +819,7 @@ const struct gl_texture_format _mesa_texformat_rgba8888_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - _mesa_texstore_rgba8888, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -843,7 +843,7 @@ const struct gl_texture_format _mesa_texformat_argb8888 = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - _mesa_texstore_argb8888, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -867,7 +867,7 @@ const struct gl_texture_format _mesa_texformat_argb8888_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - _mesa_texstore_argb8888, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -891,7 +891,7 @@ const struct gl_texture_format _mesa_texformat_rgb888 = { 0, /* DepthBits */ 0, /* StencilBits */ 3, /* TexelBytes */ - _mesa_texstore_rgb888, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -915,7 +915,7 @@ const struct gl_texture_format _mesa_texformat_bgr888 = { 0, /* DepthBits */ 0, /* StencilBits */ 3, /* TexelBytes */ - _mesa_texstore_bgr888, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -939,7 +939,7 @@ const struct gl_texture_format _mesa_texformat_rgb565 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_rgb565, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -963,7 +963,7 @@ const struct gl_texture_format _mesa_texformat_rgb565_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_rgb565, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -987,7 +987,7 @@ const struct gl_texture_format _mesa_texformat_rgba4444 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_rgba4444, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1011,7 +1011,7 @@ const struct gl_texture_format _mesa_texformat_argb4444 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_argb4444, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1035,7 +1035,7 @@ const struct gl_texture_format _mesa_texformat_argb4444_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_argb4444, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1059,7 +1059,7 @@ const struct gl_texture_format _mesa_texformat_rgba5551 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_rgba5551, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1083,7 +1083,7 @@ const struct gl_texture_format _mesa_texformat_argb1555 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_argb1555, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1107,7 +1107,7 @@ const struct gl_texture_format _mesa_texformat_argb1555_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_argb1555, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1131,7 +1131,7 @@ const struct gl_texture_format _mesa_texformat_al88 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_al88, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1155,7 +1155,7 @@ const struct gl_texture_format _mesa_texformat_al88_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_al88, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1179,7 +1179,7 @@ const struct gl_texture_format _mesa_texformat_rgb332 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - _mesa_texstore_rgb332, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1203,7 +1203,7 @@ const struct gl_texture_format _mesa_texformat_a8 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - _mesa_texstore_a8, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1227,7 +1227,7 @@ const struct gl_texture_format _mesa_texformat_l8 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1251,7 +1251,7 @@ const struct gl_texture_format _mesa_texformat_i8 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - _mesa_texstore_a8,/*yes*/ /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1275,7 +1275,7 @@ const struct gl_texture_format _mesa_texformat_ci8 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - _mesa_texstore_ci8, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1299,7 +1299,7 @@ const struct gl_texture_format _mesa_texformat_ycbcr = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_ycbcr, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1323,7 +1323,7 @@ const struct gl_texture_format _mesa_texformat_ycbcr_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - _mesa_texstore_ycbcr, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1347,7 +1347,7 @@ const struct gl_texture_format _mesa_texformat_z24_s8 = { 24, /* DepthBits */ 8, /* StencilBits */ 4, /* TexelBytes */ - _mesa_texstore_z24_s8, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1371,7 +1371,7 @@ const struct gl_texture_format _mesa_texformat_s8_z24 = { 24, /* DepthBits */ 8, /* StencilBits */ 4, /* TexelBytes */ - _mesa_texstore_s8_z24, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /* FetchTexel3D */ @@ -1395,7 +1395,7 @@ const struct gl_texture_format _mesa_texformat_z16 = { sizeof(GLushort) * 8, /* DepthBits */ 0, /* StencilBits */ sizeof(GLushort), /* TexelBytes */ - _mesa_texstore_z16, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ @@ -1419,7 +1419,7 @@ const struct gl_texture_format _mesa_texformat_z32 = { sizeof(GLuint) * 8, /* DepthBits */ 0, /* StencilBits */ sizeof(GLuint), /* TexelBytes */ - _mesa_texstore_z32, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ NULL, /* FetchTexel1D */ -- cgit v1.2.3 From e07862d2c949bcae7c71e9fc8e90e4694ed25bb3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:27:59 -0600 Subject: st/mesa: use _mesa_get_texstore_func() --- src/mesa/state_tracker/st_cb_drawpixels.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 99f3ba678b..c56f987628 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -35,6 +35,7 @@ #include "main/bufferobj.h" #include "main/macros.h" #include "main/texformat.h" +#include "main/texstore.h" #include "main/state.h" #include "shader/program.h" #include "shader/prog_parameter.h" @@ -391,6 +392,8 @@ make_texture(struct st_context *st, GLboolean success; GLubyte *dest; const GLbitfield imageTransferStateSave = ctx->_ImageTransferState; + const StoreTexImageFunc storeImage = + _mesa_get_texstore_func(mformat->MesaFormat); /* we'll do pixel transfer in a fragment shader */ ctx->_ImageTransferState = 0x0; @@ -402,21 +405,22 @@ make_texture(struct st_context *st, /* map texture transfer */ dest = screen->transfer_map(screen, transfer); + /* Put image into texture transfer. * Note that the image is actually going to be upside down in * the texture. We deal with that with texcoords. */ - success = mformat->StoreImage(ctx, 2, /* dims */ - baseFormat, /* baseInternalFormat */ - mformat, /* gl_texture_format */ - dest, /* dest */ - 0, 0, 0, /* dstX/Y/Zoffset */ - transfer->stride, /* dstRowStride, bytes */ - &dstImageOffsets, /* dstImageOffsets */ - width, height, 1, /* size */ - format, type, /* src format/type */ - pixels, /* data source */ - unpack); + success = storeImage(ctx, 2, /* dims */ + baseFormat, /* baseInternalFormat */ + mformat, /* gl_texture_format */ + dest, /* dest */ + 0, 0, 0, /* dstX/Y/Zoffset */ + transfer->stride, /* dstRowStride, bytes */ + &dstImageOffsets, /* dstImageOffsets */ + width, height, 1, /* size */ + format, type, /* src format/type */ + pixels, /* data source */ + unpack); /* unmap */ screen->transfer_unmap(screen, transfer); -- cgit v1.2.3 From f76cbac04abf26617bd65b50e923db8728a4f33f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:28:22 -0600 Subject: mesa: use _mesa_get_texstore_func() --- src/mesa/main/mipmap.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 3dca09d9f2..5b70200cd5 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -32,6 +32,7 @@ #include "texcompress.h" #include "texformat.h" #include "teximage.h" +#include "texstore.h" #include "image.h" @@ -1665,16 +1666,21 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, const GLenum srcFormat = convertFormat->BaseFormat; GLint dstRowStride = _mesa_compressed_row_stride(dstImage->TexFormat->MesaFormat, dstWidth); + const StoreTexImageFunc storeImage = + _mesa_get_texstore_func(dstImage->TexFormat->MesaFormat); + ASSERT(srcFormat == GL_RGB || srcFormat == GL_RGBA); - dstImage->TexFormat->StoreImage(ctx, 2, dstImage->_BaseFormat, - dstImage->TexFormat, - dstImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, 0, /* strides */ - dstWidth, dstHeight, 1, /* size */ - srcFormat, CHAN_TYPE, - dstData, /* src data, actually */ - &ctx->DefaultPacking); + + storeImage(ctx, 2, dstImage->_BaseFormat, + dstImage->TexFormat, + dstImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, 0, /* strides */ + dstWidth, dstHeight, 1, /* size */ + srcFormat, CHAN_TYPE, + dstData, /* src data, actually */ + &ctx->DefaultPacking); + /* swap src and dest pointers */ temp = (GLubyte *) srcData; srcData = dstData; -- cgit v1.2.3 From 9525b92efbe0d2b44b3b5518464ca28575188bf7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:28:48 -0600 Subject: mesa: NULL-out unused texformat field initializers --- src/mesa/main/texcompress_fxt1.c | 12 ++++++------ src/mesa/main/texcompress_s3tc.c | 40 ++++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index e3ac37999c..cee1b468af 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -240,12 +240,12 @@ const struct gl_texture_format _mesa_texformat_rgb_fxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - _mesa_texstore_rgb_fxt1, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ - _mesa_fetch_texel_2d_rgb_fxt1, /* FetchTexel2D */ + NULL, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - _mesa_fetch_texel_2d_f_rgb_fxt1, /* FetchTexel2Df */ + NULL, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; @@ -264,12 +264,12 @@ const struct gl_texture_format _mesa_texformat_rgba_fxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - _mesa_texstore_rgba_fxt1, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ - _mesa_fetch_texel_2d_rgba_fxt1, /* FetchTexel2D */ + NULL, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - _mesa_fetch_texel_2d_f_rgba_fxt1, /* FetchTexel2Df */ + NULL, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index c880119c3c..14046bd266 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -581,12 +581,12 @@ const struct gl_texture_format _mesa_texformat_rgb_dxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - _mesa_texstore_rgb_dxt1, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ - fetch_texel_2d_rgb_dxt1, /* FetchTexel2D */ + NULL, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - _mesa_fetch_texel_2d_f_rgb_dxt1, /* FetchTexel2Df */ + NULL, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; @@ -605,12 +605,12 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - _mesa_texstore_rgba_dxt1, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ - fetch_texel_2d_rgba_dxt1, /* FetchTexel2D */ + NULL, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - _mesa_fetch_texel_2d_f_rgba_dxt1, /* FetchTexel2Df */ + NULL, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; @@ -629,12 +629,12 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt3 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - _mesa_texstore_rgba_dxt3, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ - fetch_texel_2d_rgba_dxt3, /* FetchTexel2D */ + NULL, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - _mesa_fetch_texel_2d_f_rgba_dxt3, /* FetchTexel2Df */ + NULL, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; @@ -653,12 +653,12 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt5 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - _mesa_texstore_rgba_dxt5, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ - fetch_texel_2d_rgba_dxt5, /* FetchTexel2D */ + NULL, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - _mesa_fetch_texel_2d_f_rgba_dxt5, /* FetchTexel2Df */ + NULL, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; @@ -678,12 +678,12 @@ const struct gl_texture_format _mesa_texformat_srgb_dxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - _mesa_texstore_rgb_dxt1, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - _mesa_fetch_texel_2d_f_srgb_dxt1, /* FetchTexel2Df */ + NULL, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; @@ -702,12 +702,12 @@ const struct gl_texture_format _mesa_texformat_srgba_dxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - _mesa_texstore_rgba_dxt1, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - _mesa_fetch_texel_2d_f_srgba_dxt1, /* FetchTexel2Df */ + NULL, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; @@ -726,12 +726,12 @@ const struct gl_texture_format _mesa_texformat_srgba_dxt3 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - _mesa_texstore_rgba_dxt3, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - _mesa_fetch_texel_2d_f_srgba_dxt3, /* FetchTexel2Df */ + NULL, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; @@ -750,12 +750,12 @@ const struct gl_texture_format _mesa_texformat_srgba_dxt5 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - _mesa_texstore_rgba_dxt5, /* StoreTexImageFunc */ + NULL, /* StoreTexImageFunc */ NULL, /*impossible*/ /* FetchTexel1D */ NULL, /* FetchTexel2D */ NULL, /*impossible*/ /* FetchTexel3D */ NULL, /*impossible*/ /* FetchTexel1Df */ - _mesa_fetch_texel_2d_f_srgba_dxt5, /* FetchTexel2Df */ + NULL, /* FetchTexel2Df */ NULL, /*impossible*/ /* FetchTexel3Df */ NULL /* StoreTexel */ }; -- cgit v1.2.3 From d73cd703161dab3f2a6890bbe62d92fd548c1ed6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:34:12 -0600 Subject: glide: use _mesa_get_texstore_func() --- src/mesa/drivers/glide/fxddtex.c | 86 ++++++++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index f3cd908181..a63301d964 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -42,6 +42,7 @@ #include "main/enums.h" #include "main/image.h" #include "main/teximage.h" +#include "main/texstore.h" #include "main/texformat.h" #include "main/texcompress.h" #include "main/texobj.h" @@ -135,15 +136,18 @@ _mesa_halve2x2_teximage2d ( GLcontext *ctx, } if (bpt) { + StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + src = _s; dst = _d; - texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, dstImage, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstWidth * bpt, - 0, /* dstImageStride */ - dstWidth, dstHeight, 1, - GL_BGRA, CHAN_TYPE, dst, &ctx->DefaultPacking); + storeImage(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, dstImage, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstWidth * bpt, + 0, /* dstImageStride */ + dstWidth, dstHeight, 1, + GL_BGRA, CHAN_TYPE, dst, &ctx->DefaultPacking); FREE(dst); FREE(src); } @@ -1234,18 +1238,21 @@ adjust2DRatio (GLcontext *ctx, if (!texImage->IsCompressed) { GLubyte *destAddr; + StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + tempImage = MALLOC(width * height * texelBytes); if (!tempImage) { return GL_FALSE; } - texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, tempImage, - 0, 0, 0, /* dstX/Y/Zoffset */ - width * texelBytes, /* dstRowStride */ - 0, /* dstImageStride */ - width, height, 1, - format, type, pixels, packing); + storeImage(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, tempImage, + 0, 0, 0, /* dstX/Y/Zoffset */ + width * texelBytes, /* dstRowStride */ + 0, /* dstImageStride */ + width, height, 1, + format, type, pixels, packing); /* now rescale */ /* compute address of dest subimage within the overal tex image */ @@ -1262,6 +1269,9 @@ adjust2DRatio (GLcontext *ctx, } else { const GLint rawBytes = 4; GLvoid *rawImage = MALLOC(width * height * rawBytes); + StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + if (!rawImage) { return GL_FALSE; } @@ -1283,13 +1293,13 @@ adjust2DRatio (GLcontext *ctx, width, height, /* src */ newWidth, newHeight, /* dst */ rawImage /*src*/, tempImage /*dst*/ ); - texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, texImage->Data, - xoffset * mml->wScale, yoffset * mml->hScale, 0, /* dstX/Y/Zoffset */ - dstRowStride, - 0, /* dstImageStride */ - newWidth, newHeight, 1, - GL_RGBA, CHAN_TYPE, tempImage, &ctx->DefaultPacking); + storeImage(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, texImage->Data, + xoffset * mml->wScale, yoffset * mml->hScale, 0, /* dstX/Y/Zoffset */ + dstRowStride, + 0, /* dstImageStride */ + newWidth, newHeight, 1, + GL_RGBA, CHAN_TYPE, tempImage, &ctx->DefaultPacking); FREE(rawImage); } @@ -1430,13 +1440,16 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, else { /* no rescaling needed */ /* unpack image, apply transfer ops and store in texImage->Data */ - texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, texImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - 0, /* dstImageStride */ - width, height, 1, - format, type, pixels, packing); + StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + + storeImage(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + 0, /* dstImageStride */ + width, height, 1, + format, type, pixels, packing); } /* GL_SGIS_generate_mipmap */ @@ -1543,13 +1556,16 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, } else { /* no rescaling needed */ - texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, (GLubyte *) texImage->Data, - xoffset, yoffset, 0, /* dstX/Y/Zoffset */ - dstRowStride, - 0, /* dstImageStride */ - width, height, 1, - format, type, pixels, packing); + StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + + storeImage(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, (GLubyte *) texImage->Data, + xoffset, yoffset, 0, /* dstX/Y/Zoffset */ + dstRowStride, + 0, /* dstImageStride */ + width, height, 1, + format, type, pixels, packing); } /* GL_SGIS_generate_mipmap */ -- cgit v1.2.3 From f782f90c45fc9a483483ebd36c1971ecd0c7988d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:38:50 -0600 Subject: mesa: use _mesa_get_texstore_func() --- src/mesa/drivers/dri/intel/intel_tex_image.c | 20 ++++--- src/mesa/drivers/dri/intel/intel_tex_subimage.c | 19 ++++--- src/mesa/drivers/dri/radeon/radeon_texture.c | 9 ++- src/mesa/drivers/dri/tdfx/tdfx_tex.c | 73 +++++++++++++++---------- src/mesa/drivers/dri/unichrome/via_tex.c | 23 ++++---- 5 files changed, 87 insertions(+), 57 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 66201b1f46..aa36390689 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -8,6 +8,7 @@ #include "main/context.h" #include "main/texcompress.h" #include "main/texformat.h" +#include "main/texstore.h" #include "main/texgetimage.h" #include "main/texobj.h" #include "main/texstore.h" @@ -513,6 +514,9 @@ intelTexImage(GLcontext * ctx, * conversion and copy: */ if (pixels) { + StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + if (compressed) { if (intelImage->mt) { struct intel_region *dst = intelImage->mt->region; @@ -525,14 +529,14 @@ intelTexImage(GLcontext * ctx, 0, 0); } else memcpy(texImage->Data, pixels, imageSize); - } else if (!texImage->TexFormat->StoreImage(ctx, dims, - texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, height, depth, - format, type, pixels, unpack)) { + } else if (!storeImage(ctx, dims, + texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, height, depth, + format, type, pixels, unpack)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); } } diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c index 751ec2c98c..f75d2ae004 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c @@ -109,14 +109,17 @@ intelTexSubimage(GLcontext * ctx, memcpy(texImage->Data, pixels, imageSize); } else { - if (!texImage->TexFormat->StoreImage(ctx, dims, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - xoffset, yoffset, zoffset, - dstRowStride, - texImage->ImageOffsets, - width, height, depth, - format, type, pixels, packing)) { + StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + + if (!storeImage(ctx, dims, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + xoffset, yoffset, zoffset, + dstRowStride, + texImage->ImageOffsets, + width, height, depth, + format, type, pixels, packing)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "intelTexSubImage"); } } diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 049284ef8c..4a22131486 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -624,6 +624,8 @@ static void radeon_teximage( } else { GLuint dstRowStride; GLuint *dstImageOffsets; + StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); if (image->mt) { radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel]; @@ -646,7 +648,7 @@ static void radeon_teximage( dstImageOffsets = texImage->ImageOffsets; } - if (!texImage->TexFormat->StoreImage(ctx, dims, + if (!storeImage(ctx, dims, texImage->_BaseFormat, texImage->TexFormat, texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ @@ -778,7 +780,10 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve copy_rows(img_start, dstRowStride, pixels, srcRowStride, rows, bytesPerRow); } else { - if (!texImage->TexFormat->StoreImage(ctx, dims, texImage->_BaseFormat, + StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + + if (!storeImage(ctx, dims, texImage->_BaseFormat, texImage->TexFormat, texImage->Data, xoffset, yoffset, zoffset, dstRowStride, diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index f6a48b3ae1..91650088b9 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -138,9 +138,12 @@ _mesa_halve2x2_teximage2d ( GLcontext *ctx, } if (bpt) { + StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + src = _s; dst = _d; - texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, + storeImage(ctx, 2, texImage->_BaseFormat, texImage->TexFormat, dstImage, 0, 0, 0, /* dstX/Y/Zoffset */ dstWidth * bpt, @@ -1228,18 +1231,21 @@ adjust2DRatio (GLcontext *ctx, if (!texImage->IsCompressed) { GLubyte *destAddr; + StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + tempImage = MALLOC(width * height * texelBytes); if (!tempImage) { return GL_FALSE; } - texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, tempImage, - 0, 0, 0, /* dstX/Y/Zoffset */ - width * texelBytes, /* dstRowStride */ - &dstImageOffsets, - width, height, 1, - format, type, pixels, packing); + storeImage(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, tempImage, + 0, 0, 0, /* dstX/Y/Zoffset */ + width * texelBytes, /* dstRowStride */ + &dstImageOffsets, + width, height, 1, + format, type, pixels, packing); /* now rescale */ /* compute address of dest subimage within the overal tex image */ @@ -1256,6 +1262,9 @@ adjust2DRatio (GLcontext *ctx, } else { const GLint rawBytes = 4; GLvoid *rawImage = MALLOC(width * height * rawBytes); + StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + if (!rawImage) { return GL_FALSE; } @@ -1278,13 +1287,13 @@ adjust2DRatio (GLcontext *ctx, width, height, /* src */ newWidth, newHeight, /* dst */ rawImage /*src*/, tempImage /*dst*/ ); - texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, texImage->Data, - xoffset * mml->wScale, yoffset * mml->hScale, 0, /* dstX/Y/Zoffset */ - dstRowStride, - &dstImageOffsets, - newWidth, newHeight, 1, - GL_RGBA, CHAN_TYPE, tempImage, &ctx->DefaultPacking); + storeImage(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, texImage->Data, + xoffset * mml->wScale, yoffset * mml->hScale, 0, /* dstX/Y/Zoffset */ + dstRowStride, + &dstImageOffsets, + newWidth, newHeight, 1, + GL_RGBA, CHAN_TYPE, tempImage, &ctx->DefaultPacking); FREE(rawImage); } @@ -1437,13 +1446,16 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, else { /* no rescaling needed */ /* unpack image, apply transfer ops and store in texImage->Data */ - texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, texImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - format, type, pixels, packing); + StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + + storeImage(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + format, type, pixels, packing); } } @@ -1507,13 +1519,16 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, } else { /* no rescaling needed */ - texImage->TexFormat->StoreImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, texImage->Data, - xoffset, yoffset, 0, - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - format, type, pixels, packing); + StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + + storeImage(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, texImage->Data, + xoffset, yoffset, 0, + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + format, type, pixels, packing); } ti->reloadImages = GL_TRUE; /* signal the image needs to be reloaded */ diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index 54073e7691..388fd9392c 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -797,22 +797,25 @@ static void viaTexImage(GLcontext *ctx, else { GLint dstRowStride; GLboolean success; + StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + if (texImage->IsCompressed) { dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); } else { dstRowStride = postConvWidth * texImage->TexFormat->TexelBytes; } - ASSERT(texImage->TexFormat->StoreImage); - success = texImage->TexFormat->StoreImage(ctx, dims, - texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - format, type, pixels, packing); + ASSERT(storeImage); + success = storeImage(ctx, dims, + texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); } -- cgit v1.2.3 From adce34e23b431e184c4a511464f5cb0281c74db5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:39:17 -0600 Subject: st/mesa: use _mesa_get_texstore_func() --- src/mesa/state_tracker/st_cb_texture.c | 84 +++++++++++++++++++--------------- 1 file changed, 47 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 3520c986b4..62ebdd8056 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -417,7 +417,7 @@ compress_with_blit(GLcontext * ctx, struct pipe_surface *dst_surface; struct pipe_transfer *tex_xfer; void *map; - + StoreTexImageFunc storeImage; if (!stImage->pt) { /* XXX: Can this happen? Should we assert? */ @@ -464,15 +464,18 @@ compress_with_blit(GLcontext * ctx, 0, 0, width, height); /* x, y, w, h */ map = screen->transfer_map(screen, tex_xfer); - mesa_format->StoreImage(ctx, 2, GL_RGBA, mesa_format, - map, /* dest ptr */ - 0, 0, 0, /* dest x/y/z offset */ - tex_xfer->stride, /* dest row stride (bytes) */ - dstImageOffsets, /* image offsets (for 3D only) */ - width, height, 1, /* size */ - format, type, /* source format/type */ - pixels, /* source data */ - unpack); /* source data packing */ + storeImage = _mesa_get_texstore_func(mesa_format->MesaFormat); + + + storeImage(ctx, 2, GL_RGBA, mesa_format, + map, /* dest ptr */ + 0, 0, 0, /* dest x/y/z offset */ + tex_xfer->stride, /* dest row stride (bytes) */ + dstImageOffsets, /* image offsets (for 3D only) */ + width, height, 1, /* size */ + format, type, /* source format/type */ + pixels, /* source data */ + unpack); /* source data packing */ screen->transfer_unmap(screen, tex_xfer); screen->tex_transfer_destroy(tex_xfer); @@ -734,17 +737,19 @@ st_TexImage(GLcontext * ctx, _mesa_image_image_stride(unpack, width, height, format, type); GLint i; const GLubyte *src = (const GLubyte *) pixels; + StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); for (i = 0; i < depth; i++) { - if (!texImage->TexFormat->StoreImage(ctx, dims, - texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - format, type, src, unpack)) { + if (!storeImage(ctx, dims, + texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + format, type, src, unpack)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); } @@ -1051,6 +1056,9 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, const GLubyte *src; /* init to silence warning only: */ enum pipe_transfer_usage transfer_usage = PIPE_TRANSFER_WRITE; + StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); + DBG("%s target %s level %d offset %d,%d %dx%d\n", __FUNCTION__, _mesa_lookup_enum_by_nr(target), @@ -1107,14 +1115,14 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, dstRowStride = stImage->transfer->stride; for (i = 0; i < depth; i++) { - if (!texImage->TexFormat->StoreImage(ctx, dims, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - 0, 0, 0, - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - format, type, src, packing)) { + if (!storeImage(ctx, dims, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + 0, 0, 0, + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + format, type, src, packing)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage"); } @@ -1353,6 +1361,8 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, const GLint dstRowStride = stImage->transfer->stride; struct gl_texture_image *texImage = &stImage->base; struct gl_pixelstore_attrib unpack = ctx->DefaultPacking; + StoreTexImageFunc storeImage = + _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { unpack.Invert = GL_TRUE; @@ -1370,16 +1380,16 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, * is actually RGBA but the user created the texture as GL_RGB we * need to fill-in/override the alpha channel with 1.0. */ - texImage->TexFormat->StoreImage(ctx, dims, - texImage->_BaseFormat, - texImage->TexFormat, - texDest, - 0, 0, 0, - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - GL_RGBA, GL_FLOAT, tempSrc, /* src */ - &unpack); + storeImage(ctx, dims, + texImage->_BaseFormat, + texImage->TexFormat, + texDest, + 0, 0, 0, + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + GL_RGBA, GL_FLOAT, tempSrc, /* src */ + &unpack); } else { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage"); -- cgit v1.2.3 From 05e73cc8e23e348ea8243dd2584a44ee5d3a4dd2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:39:48 -0600 Subject: mesa: replace function pointer types with void * These fields are no longer used and will be removed soon. --- src/mesa/main/mtypes.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index d7bf7689f3..8468f74ca1 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1203,21 +1203,21 @@ struct gl_texture_format GLuint TexelBytes; /**< Bytes per texel, 0 if compressed format */ - StoreTexImageFunc StoreImage; + void *StoreImage; /** * \name Texel fetch function pointers */ /*@{*/ - FetchTexelFuncC FetchTexel1D; - FetchTexelFuncC FetchTexel2D; - FetchTexelFuncC FetchTexel3D; - FetchTexelFuncF FetchTexel1Df; - FetchTexelFuncF FetchTexel2Df; - FetchTexelFuncF FetchTexel3Df; + void *FetchTexel1D; + void *FetchTexel2D; + void *FetchTexel3D; + void *FetchTexel1Df; + void *FetchTexel2Df; + void *FetchTexel3Df; /*@}*/ - StoreTexelFunc StoreTexel; + void *toreTexel; }; -- cgit v1.2.3 From 27e201e9c4dd66bbf8fd2bc3ac3292550b94a14a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:49:14 -0600 Subject: mesa: rework null texel fetch/store funcs --- src/mesa/main/texformat.c | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 2169d294c6..8eb777b939 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -90,17 +90,6 @@ nonlinear_to_linear(GLubyte cs8) * * Have to have this so the FetchTexel function pointer is never NULL. */ -static void fetch_null_texel( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - (void) texImage; (void) i; (void) j; (void) k; - texel[RCOMP] = 0; - texel[GCOMP] = 0; - texel[BCOMP] = 0; - texel[ACOMP] = 0; - _mesa_warning(NULL, "fetch_null_texel() called!"); -} - static void fetch_null_texelf( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { @@ -1451,13 +1440,13 @@ const struct gl_texture_format _mesa_null_texformat = { 0, /* StencilBits */ 0, /* TexelBytes */ NULL, /* StoreTexImageFunc */ - fetch_null_texel, /* FetchTexel1D */ - fetch_null_texel, /* FetchTexel1D */ - fetch_null_texel, /* FetchTexel1D */ - fetch_null_texelf, /* FetchTexel1Df */ - fetch_null_texelf, /* FetchTexel1Df */ - fetch_null_texelf, /* FetchTexel1Df */ - store_null_texel /* StoreTexel */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel1D */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ + NULL, /* FetchTexel1Df */ + NULL, /* StoreTexel */ }; /*@}*/ @@ -2453,18 +2442,25 @@ texfetch_funcs[MESA_FORMAT_COUNT] = FetchTexelFuncF _mesa_get_texel_fetch_func(GLuint format, GLuint dims) { + FetchTexelFuncF f; GLuint i; /* XXX replace loop with direct table lookup */ for (i = 0; i < MESA_FORMAT_COUNT; i++) { if (texfetch_funcs[i].Name == format) { switch (dims) { case 1: - return texfetch_funcs[i].Fetch1D; + f = texfetch_funcs[i].Fetch1D; + break; case 2: - return texfetch_funcs[i].Fetch2D; + f = texfetch_funcs[i].Fetch2D; + break; case 3: - return texfetch_funcs[i].Fetch3D; + f = texfetch_funcs[i].Fetch3D; + break; } + if (!f) + f = fetch_null_texelf; + return f; } } return NULL; @@ -2478,7 +2474,10 @@ _mesa_get_texel_store_func(GLuint format) /* XXX replace loop with direct table lookup */ for (i = 0; i < MESA_FORMAT_COUNT; i++) { if (texfetch_funcs[i].Name == format) { - return texfetch_funcs[i].StoreTexel; + if (texfetch_funcs[i].StoreTexel) + return texfetch_funcs[i].StoreTexel; + else + return store_null_texel; } } return NULL; -- cgit v1.2.3 From cccdc43fa9a8c49cdbdb545de8ff91c528b1ed47 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:50:04 -0600 Subject: mesa: move StoreTexImageFunc to texstore.h --- src/mesa/main/mtypes.h | 35 ----------------------------------- src/mesa/main/texcompress_fxt1.h | 2 ++ src/mesa/main/texcompress_s3tc.h | 2 ++ src/mesa/main/texstore.h | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 8468f74ca1..20fa6d8e3c 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1136,41 +1136,6 @@ typedef void (*StoreTexelFunc)(struct gl_texture_image *texImage, const void *texel); -/** - * This macro defines the (many) parameters to the texstore functions. - * \param dims either 1 or 2 or 3 - * \param baseInternalFormat user-specified base internal format - * \param dstFormat destination Mesa texture format - * \param dstAddr destination image address - * \param dstX/Y/Zoffset destination x/y/z offset (ala TexSubImage), in texels - * \param dstRowStride destination image row stride, in bytes - * \param dstImageOffsets offset of each 2D slice within 3D texture, in texels - * \param srcWidth/Height/Depth source image size, in pixels - * \param srcFormat incoming image format - * \param srcType incoming image data type - * \param srcAddr source image address - * \param srcPacking source image packing parameters - */ -#define TEXSTORE_PARAMS \ - GLcontext *ctx, GLuint dims, \ - GLenum baseInternalFormat, \ - const struct gl_texture_format *dstFormat, \ - GLvoid *dstAddr, \ - GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \ - GLint dstRowStride, const GLuint *dstImageOffsets, \ - GLint srcWidth, GLint srcHeight, GLint srcDepth, \ - GLenum srcFormat, GLenum srcType, \ - const GLvoid *srcAddr, \ - const struct gl_pixelstore_attrib *srcPacking - - - -/** - * Texture image storage function. - */ -typedef GLboolean (*StoreTexImageFunc)(TEXSTORE_PARAMS); - - /** * Texture format record */ diff --git a/src/mesa/main/texcompress_fxt1.h b/src/mesa/main/texcompress_fxt1.h index a9ddce9a8c..b74f955fcd 100644 --- a/src/mesa/main/texcompress_fxt1.h +++ b/src/mesa/main/texcompress_fxt1.h @@ -25,6 +25,8 @@ #ifndef TEXCOMPRESS_FXT1_H #define TEXCOMPRESS_FXT1_H +#include "texstore.h" + extern GLboolean _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS); diff --git a/src/mesa/main/texcompress_s3tc.h b/src/mesa/main/texcompress_s3tc.h index 866bb0e3d3..4041d244d1 100644 --- a/src/mesa/main/texcompress_s3tc.h +++ b/src/mesa/main/texcompress_s3tc.h @@ -25,6 +25,8 @@ #ifndef TEXCOMPRESS_S3TC_H #define TEXCOMPRESS_S3TC_H +#include "texstore.h" + extern GLboolean _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS); diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h index 629854b446..771493cec6 100644 --- a/src/mesa/main/texstore.h +++ b/src/mesa/main/texstore.h @@ -40,6 +40,42 @@ #include "formats.h" +/** + * This macro defines the (many) parameters to the texstore functions. + * \param dims either 1 or 2 or 3 + * \param baseInternalFormat user-specified base internal format + * \param dstFormat destination Mesa texture format + * \param dstAddr destination image address + * \param dstX/Y/Zoffset destination x/y/z offset (ala TexSubImage), in texels + * \param dstRowStride destination image row stride, in bytes + * \param dstImageOffsets offset of each 2D slice within 3D texture, in texels + * \param srcWidth/Height/Depth source image size, in pixels + * \param srcFormat incoming image format + * \param srcType incoming image data type + * \param srcAddr source image address + * \param srcPacking source image packing parameters + */ +#define TEXSTORE_PARAMS \ + GLcontext *ctx, GLuint dims, \ + GLenum baseInternalFormat, \ + const struct gl_texture_format *dstFormat, \ + GLvoid *dstAddr, \ + GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \ + GLint dstRowStride, const GLuint *dstImageOffsets, \ + GLint srcWidth, GLint srcHeight, GLint srcDepth, \ + GLenum srcFormat, GLenum srcType, \ + const GLvoid *srcAddr, \ + const struct gl_pixelstore_attrib *srcPacking + + + +/** + * Texture image storage function. + */ +typedef GLboolean (*StoreTexImageFunc)(TEXSTORE_PARAMS); + + + extern GLboolean _mesa_texstore_rgba(TEXSTORE_PARAMS); extern GLboolean _mesa_texstore_color_index(TEXSTORE_PARAMS); extern GLboolean _mesa_texstore_rgba8888(TEXSTORE_PARAMS); -- cgit v1.2.3 From e8eed5003b01fe8a4349711382411ac80b1c0aa3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:53:22 -0600 Subject: mesa: added MESA_FORMAT_NONE --- src/mesa/main/formats.c | 11 +++++++++++ src/mesa/main/formats.h | 1 + 2 files changed, 12 insertions(+) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 8aa0d107b7..5c2bf5ece3 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -36,6 +36,14 @@ */ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = { + { + MESA_FORMAT_NONE, /* Name */ + GL_NONE, /* BaseFormat */ + GL_NONE, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 0, 0, 0 /* BlockWidth/Height,Bytes */ + }, { MESA_FORMAT_RGBA8888, /* Name */ GL_RGBA, /* BaseFormat */ @@ -617,6 +625,9 @@ _mesa_test_formats(void) assert(info->Name == i); + if (info->Name == MESA_FORMAT_NONE) + continue; + if (info->BlockWidth == 1 && info->BlockHeight == 1) { if (info->RedBits > 0) { GLuint t = info->RedBits + info->GreenBits diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 61bbd8e79a..e79991ad41 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -42,6 +42,7 @@ */ typedef enum { + MESA_FORMAT_NONE = 0, /** * \name Basic hardware formats */ -- cgit v1.2.3 From a608257a02d2ba4e8119be462bbd40ed238b184a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 18:57:02 -0600 Subject: mesa: remove unused gl_texture_format fields --- src/mesa/main/mtypes.h | 16 -- src/mesa/main/texcompress_fxt1.c | 20 +- src/mesa/main/texcompress_s3tc.c | 64 ------ src/mesa/main/texformat.c | 432 --------------------------------------- 4 files changed, 2 insertions(+), 530 deletions(-) (limited to 'src') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 20fa6d8e3c..d448e3e158 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1167,22 +1167,6 @@ struct gl_texture_format /*@}*/ GLuint TexelBytes; /**< Bytes per texel, 0 if compressed format */ - - void *StoreImage; - - /** - * \name Texel fetch function pointers - */ - /*@{*/ - void *FetchTexel1D; - void *FetchTexel2D; - void *FetchTexel3D; - void *FetchTexel1Df; - void *FetchTexel2Df; - void *FetchTexel3Df; - /*@}*/ - - void *toreTexel; }; diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index cee1b468af..1a103ff14e 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -239,15 +239,7 @@ const struct gl_texture_format _mesa_texformat_rgb_fxt1 = { 0, /* IndexBits */ 0, /* DepthBits */ 0, /* StencilBits */ - 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /*impossible*/ /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /*impossible*/ /* FetchTexel3D */ - NULL, /*impossible*/ /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /*impossible*/ /* FetchTexel3Df */ - NULL /* StoreTexel */ + 0 /* TexelBytes */ }; const struct gl_texture_format _mesa_texformat_rgba_fxt1 = { @@ -263,15 +255,7 @@ const struct gl_texture_format _mesa_texformat_rgba_fxt1 = { 0, /* IndexBits */ 0, /* DepthBits */ 0, /* StencilBits */ - 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /*impossible*/ /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /*impossible*/ /* FetchTexel3D */ - NULL, /*impossible*/ /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /*impossible*/ /* FetchTexel3Df */ - NULL /* StoreTexel */ + 0 /* TexelBytes */ }; diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index 14046bd266..86492d05fb 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -581,14 +581,6 @@ const struct gl_texture_format _mesa_texformat_rgb_dxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /*impossible*/ /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /*impossible*/ /* FetchTexel3D */ - NULL, /*impossible*/ /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /*impossible*/ /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba_dxt1 = { @@ -605,14 +597,6 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /*impossible*/ /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /*impossible*/ /* FetchTexel3D */ - NULL, /*impossible*/ /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /*impossible*/ /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba_dxt3 = { @@ -629,14 +613,6 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt3 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /*impossible*/ /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /*impossible*/ /* FetchTexel3D */ - NULL, /*impossible*/ /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /*impossible*/ /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba_dxt5 = { @@ -653,14 +629,6 @@ const struct gl_texture_format _mesa_texformat_rgba_dxt5 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /*impossible*/ /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /*impossible*/ /* FetchTexel3D */ - NULL, /*impossible*/ /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /*impossible*/ /* FetchTexel3Df */ - NULL /* StoreTexel */ }; #if FEATURE_EXT_texture_sRGB @@ -678,14 +646,6 @@ const struct gl_texture_format _mesa_texformat_srgb_dxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /*impossible*/ /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /*impossible*/ /* FetchTexel3D */ - NULL, /*impossible*/ /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /*impossible*/ /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_srgba_dxt1 = { @@ -702,14 +662,6 @@ const struct gl_texture_format _mesa_texformat_srgba_dxt1 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /*impossible*/ /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /*impossible*/ /* FetchTexel3D */ - NULL, /*impossible*/ /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /*impossible*/ /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_srgba_dxt3 = { @@ -726,14 +678,6 @@ const struct gl_texture_format _mesa_texformat_srgba_dxt3 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /*impossible*/ /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /*impossible*/ /* FetchTexel3D */ - NULL, /*impossible*/ /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /*impossible*/ /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_srgba_dxt5 = { @@ -750,13 +694,5 @@ const struct gl_texture_format _mesa_texformat_srgba_dxt5 = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /*impossible*/ /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /*impossible*/ /* FetchTexel3D */ - NULL, /*impossible*/ /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /*impossible*/ /* FetchTexel3Df */ - NULL /* StoreTexel */ }; #endif diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 8eb777b939..dae98bcc6f 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -145,14 +145,6 @@ const struct gl_texture_format _mesa_texformat_rgba = { 0, /* DepthBits */ 0, /* StencilBits */ 4 * sizeof(GLchan), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb = { @@ -169,14 +161,6 @@ const struct gl_texture_format _mesa_texformat_rgb = { 0, /* DepthBits */ 0, /* StencilBits */ 3 * sizeof(GLchan), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_alpha = { @@ -193,14 +177,6 @@ const struct gl_texture_format _mesa_texformat_alpha = { 0, /* DepthBits */ 0, /* StencilBits */ sizeof(GLchan), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance = { @@ -217,14 +193,6 @@ const struct gl_texture_format _mesa_texformat_luminance = { 0, /* DepthBits */ 0, /* StencilBits */ sizeof(GLchan), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_alpha = { @@ -241,14 +209,6 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha = { 0, /* DepthBits */ 0, /* StencilBits */ 2 * sizeof(GLchan), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_intensity = { @@ -265,14 +225,6 @@ const struct gl_texture_format _mesa_texformat_intensity = { 0, /* DepthBits */ 0, /* StencilBits */ sizeof(GLchan), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; @@ -292,14 +244,6 @@ const struct gl_texture_format _mesa_texformat_srgb8 = { 0, /* DepthBits */ 0, /* StencilBits */ 3, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_srgba8 = { @@ -316,14 +260,6 @@ const struct gl_texture_format _mesa_texformat_srgba8 = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_sargb8 = { @@ -340,14 +276,6 @@ const struct gl_texture_format _mesa_texformat_sargb8 = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_sl8 = { @@ -364,14 +292,6 @@ const struct gl_texture_format _mesa_texformat_sl8 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; /* Note: this format name looks like a misnomer, make it sal8? */ @@ -389,14 +309,6 @@ const struct gl_texture_format _mesa_texformat_sla8 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; #endif /* FEATURE_EXT_texture_sRGB */ @@ -415,14 +327,6 @@ const struct gl_texture_format _mesa_texformat_rgba_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 4 * sizeof(GLfloat), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba_float16 = { @@ -439,14 +343,6 @@ const struct gl_texture_format _mesa_texformat_rgba_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 4 * sizeof(GLhalfARB), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb_float32 = { @@ -463,14 +359,6 @@ const struct gl_texture_format _mesa_texformat_rgb_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 3 * sizeof(GLfloat), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb_float16 = { @@ -487,14 +375,6 @@ const struct gl_texture_format _mesa_texformat_rgb_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 3 * sizeof(GLhalfARB), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_alpha_float32 = { @@ -511,14 +391,6 @@ const struct gl_texture_format _mesa_texformat_alpha_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLfloat), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_alpha_float16 = { @@ -535,14 +407,6 @@ const struct gl_texture_format _mesa_texformat_alpha_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLhalfARB), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_float32 = { @@ -559,14 +423,6 @@ const struct gl_texture_format _mesa_texformat_luminance_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLfloat), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_float16 = { @@ -583,14 +439,6 @@ const struct gl_texture_format _mesa_texformat_luminance_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLhalfARB), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = { @@ -607,14 +455,6 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 2 * sizeof(GLfloat), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = { @@ -631,14 +471,6 @@ const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 2 * sizeof(GLhalfARB), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_intensity_float32 = { @@ -655,14 +487,6 @@ const struct gl_texture_format _mesa_texformat_intensity_float32 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLfloat), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_intensity_float16 = { @@ -679,14 +503,6 @@ const struct gl_texture_format _mesa_texformat_intensity_float16 = { 0, /* DepthBits */ 0, /* StencilBits */ 1 * sizeof(GLhalfARB), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_dudv8 = { @@ -705,14 +521,6 @@ const struct gl_texture_format _mesa_texformat_dudv8 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_signed_rgba8888 = { @@ -729,14 +537,6 @@ const struct gl_texture_format _mesa_texformat_signed_rgba8888 = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev = { @@ -753,14 +553,6 @@ const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; /*@}*/ @@ -784,14 +576,6 @@ const struct gl_texture_format _mesa_texformat_rgba8888 = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba8888_rev = { @@ -808,14 +592,6 @@ const struct gl_texture_format _mesa_texformat_rgba8888_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb8888 = { @@ -832,14 +608,6 @@ const struct gl_texture_format _mesa_texformat_argb8888 = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb8888_rev = { @@ -856,14 +624,6 @@ const struct gl_texture_format _mesa_texformat_argb8888_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 4, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb888 = { @@ -880,14 +640,6 @@ const struct gl_texture_format _mesa_texformat_rgb888 = { 0, /* DepthBits */ 0, /* StencilBits */ 3, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_bgr888 = { @@ -904,14 +656,6 @@ const struct gl_texture_format _mesa_texformat_bgr888 = { 0, /* DepthBits */ 0, /* StencilBits */ 3, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb565 = { @@ -928,14 +672,6 @@ const struct gl_texture_format _mesa_texformat_rgb565 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb565_rev = { @@ -952,14 +688,6 @@ const struct gl_texture_format _mesa_texformat_rgb565_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba4444 = { @@ -976,14 +704,6 @@ const struct gl_texture_format _mesa_texformat_rgba4444 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb4444 = { @@ -1000,14 +720,6 @@ const struct gl_texture_format _mesa_texformat_argb4444 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb4444_rev = { @@ -1024,14 +736,6 @@ const struct gl_texture_format _mesa_texformat_argb4444_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgba5551 = { @@ -1048,14 +752,6 @@ const struct gl_texture_format _mesa_texformat_rgba5551 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb1555 = { @@ -1072,14 +768,6 @@ const struct gl_texture_format _mesa_texformat_argb1555 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_argb1555_rev = { @@ -1096,14 +784,6 @@ const struct gl_texture_format _mesa_texformat_argb1555_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_al88 = { @@ -1120,14 +800,6 @@ const struct gl_texture_format _mesa_texformat_al88 = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_al88_rev = { @@ -1144,14 +816,6 @@ const struct gl_texture_format _mesa_texformat_al88_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_rgb332 = { @@ -1168,14 +832,6 @@ const struct gl_texture_format _mesa_texformat_rgb332 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_a8 = { @@ -1192,14 +848,6 @@ const struct gl_texture_format _mesa_texformat_a8 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_l8 = { @@ -1216,14 +864,6 @@ const struct gl_texture_format _mesa_texformat_l8 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_i8 = { @@ -1240,14 +880,6 @@ const struct gl_texture_format _mesa_texformat_i8 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_ci8 = { @@ -1264,14 +896,6 @@ const struct gl_texture_format _mesa_texformat_ci8 = { 0, /* DepthBits */ 0, /* StencilBits */ 1, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_ycbcr = { @@ -1288,14 +912,6 @@ const struct gl_texture_format _mesa_texformat_ycbcr = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_ycbcr_rev = { @@ -1312,14 +928,6 @@ const struct gl_texture_format _mesa_texformat_ycbcr_rev = { 0, /* DepthBits */ 0, /* StencilBits */ 2, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_z24_s8 = { @@ -1336,14 +944,6 @@ const struct gl_texture_format _mesa_texformat_z24_s8 = { 24, /* DepthBits */ 8, /* StencilBits */ 4, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_s8_z24 = { @@ -1360,14 +960,6 @@ const struct gl_texture_format _mesa_texformat_s8_z24 = { 24, /* DepthBits */ 8, /* StencilBits */ 4, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel2D */ - NULL, /* FetchTexel3D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel2Df */ - NULL, /* FetchTexel3Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_z16 = { @@ -1384,14 +976,6 @@ const struct gl_texture_format _mesa_texformat_z16 = { sizeof(GLushort) * 8, /* DepthBits */ 0, /* StencilBits */ sizeof(GLushort), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL /* StoreTexel */ }; const struct gl_texture_format _mesa_texformat_z32 = { @@ -1408,14 +992,6 @@ const struct gl_texture_format _mesa_texformat_z32 = { sizeof(GLuint) * 8, /* DepthBits */ 0, /* StencilBits */ sizeof(GLuint), /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL /* StoreTexel */ }; /*@}*/ @@ -1439,14 +1015,6 @@ const struct gl_texture_format _mesa_null_texformat = { 0, /* DepthBits */ 0, /* StencilBits */ 0, /* TexelBytes */ - NULL, /* StoreTexImageFunc */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1D */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL, /* FetchTexel1Df */ - NULL, /* StoreTexel */ }; /*@}*/ -- cgit v1.2.3 From c28d78f8324cfc17936af63c258a1cc55d590d60 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 19:07:44 -0600 Subject: mesa: added _mesa_get_format_bits() --- src/mesa/main/formats.c | 31 +++++++++++++++++++++++++++++++ src/mesa/main/formats.h | 4 ++++ 2 files changed, 35 insertions(+) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 5c2bf5ece3..62a2d70744 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -24,6 +24,7 @@ */ +#include "imports.h" #include "formats.h" #include "config.h" #include "texstore.h" @@ -785,3 +786,33 @@ _mesa_format_to_type_and_comps2(gl_format format, } } + +GLint +_mesa_get_format_bits(gl_format format, GLenum pname) +{ + const struct gl_format_info *info = _mesa_get_format_info(format); + + switch (pname) { + case GL_TEXTURE_RED_SIZE: + return info->RedBits; + case GL_TEXTURE_GREEN_SIZE: + return info->GreenBits; + case GL_TEXTURE_BLUE_SIZE: + return info->BlueBits; + case GL_TEXTURE_ALPHA_SIZE: + return info->AlphaBits; + case GL_TEXTURE_INTENSITY_SIZE: + return info->IntensityBits; + case GL_TEXTURE_LUMINANCE_SIZE: + return info->LuminanceBits; + case GL_TEXTURE_INDEX_SIZE_EXT: + return info->IndexBits; + case GL_TEXTURE_DEPTH_SIZE_ARB: + return info->DepthBits; + case GL_TEXTURE_STENCIL_SIZE_EXT: + return info->StencilBits; + default: + _mesa_problem(NULL, "bad pname in _mesa_get_format_bits()"); + return 0; + } +} diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index e79991ad41..441cf3eac6 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -208,6 +208,10 @@ extern void _mesa_format_to_type_and_comps2(gl_format format, GLenum *datatype, GLuint *comps); +extern GLint +_mesa_get_format_bits(gl_format format, GLenum pname); + + extern void _mesa_test_formats(void); -- cgit v1.2.3 From b64d478a5bd4af4128938782d787abe02a0896ee Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 19:38:21 -0600 Subject: mesa: use _mesa_get_format_bits() --- src/mesa/main/texparam.c | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index b2fbe2205b..1a88ad53b4 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -31,9 +31,10 @@ #include "main/glheader.h" +#include "main/colormac.h" #include "main/context.h" #include "main/enums.h" -#include "main/colormac.h" +#include "main/formats.h" #include "main/macros.h" #include "main/texcompress.h" #include "main/texparam.h" @@ -782,20 +783,10 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, *params = img->Border; break; case GL_TEXTURE_RED_SIZE: - if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA) - *params = img->TexFormat->RedBits; - else - *params = 0; - break; case GL_TEXTURE_GREEN_SIZE: - if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA) - *params = img->TexFormat->GreenBits; - else - *params = 0; - break; case GL_TEXTURE_BLUE_SIZE: if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA) - *params = img->TexFormat->BlueBits; + *params = _mesa_get_format_bits(img->TexFormat->MesaFormat, pname); else *params = 0; break; @@ -803,36 +794,44 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, if (img->_BaseFormat == GL_ALPHA || img->_BaseFormat == GL_LUMINANCE_ALPHA || img->_BaseFormat == GL_RGBA) - *params = img->TexFormat->AlphaBits; + *params = _mesa_get_format_bits(img->TexFormat->MesaFormat, pname); else *params = 0; break; case GL_TEXTURE_INTENSITY_SIZE: if (img->_BaseFormat != GL_INTENSITY) *params = 0; - else if (img->TexFormat->IntensityBits > 0) - *params = img->TexFormat->IntensityBits; - else /* intensity probably stored as rgb texture */ - *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits); + else { + *params = _mesa_get_format_bits(img->TexFormat->MesaFormat, pname); + if (*params == 0) { + /* intensity probably stored as rgb texture */ + *params = MIN2(_mesa_get_format_bits(img->TexFormat->MesaFormat, GL_TEXTURE_RED_SIZE), + _mesa_get_format_bits(img->TexFormat->MesaFormat, GL_TEXTURE_GREEN_SIZE)); + } + } break; case GL_TEXTURE_LUMINANCE_SIZE: if (img->_BaseFormat != GL_LUMINANCE && img->_BaseFormat != GL_LUMINANCE_ALPHA) *params = 0; - else if (img->TexFormat->LuminanceBits > 0) - *params = img->TexFormat->LuminanceBits; - else /* luminance probably stored as rgb texture */ - *params = MIN2(img->TexFormat->RedBits, img->TexFormat->GreenBits); + else { + *params = _mesa_get_format_bits(img->TexFormat->MesaFormat, pname); + if (img->TexFormat->LuminanceBits == 0) { + /* luminance probably stored as rgb texture */ + *params = MIN2(_mesa_get_format_bits(img->TexFormat->MesaFormat, GL_TEXTURE_RED_SIZE), + _mesa_get_format_bits(img->TexFormat->MesaFormat, GL_TEXTURE_GREEN_SIZE)); + } + } break; case GL_TEXTURE_INDEX_SIZE_EXT: if (img->_BaseFormat == GL_COLOR_INDEX) - *params = img->TexFormat->IndexBits; + *params = _mesa_get_format_bits(img->TexFormat->MesaFormat, pname); else *params = 0; break; case GL_TEXTURE_DEPTH_SIZE_ARB: if (ctx->Extensions.ARB_depth_texture) - *params = img->TexFormat->DepthBits; + *params = _mesa_get_format_bits(img->TexFormat->MesaFormat, pname); else _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); @@ -840,7 +839,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, case GL_TEXTURE_STENCIL_SIZE_EXT: if (ctx->Extensions.EXT_packed_depth_stencil || ctx->Extensions.ARB_framebuffer_object) { - *params = img->TexFormat->StencilBits; + *params = _mesa_get_format_bits(img->TexFormat->MesaFormat, pname); } else { _mesa_error(ctx, GL_INVALID_ENUM, -- cgit v1.2.3 From 5ab5f16919f6aaa19f5c92fd562e43dee18e30bc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 19:42:36 -0600 Subject: mesa: added _mesa_get_format_datatype() --- src/mesa/main/formats.c | 8 ++++++++ src/mesa/main/formats.h | 3 +++ 2 files changed, 11 insertions(+) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 62a2d70744..afa2398ed4 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -816,3 +816,11 @@ _mesa_get_format_bits(gl_format format, GLenum pname) return 0; } } + + +GLenum +_mesa_get_format_datatype(gl_format format) +{ + const struct gl_format_info *info = _mesa_get_format_info(format); + return info->DataType; +} diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 441cf3eac6..ad93fef2fc 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -211,6 +211,9 @@ _mesa_format_to_type_and_comps2(gl_format format, extern GLint _mesa_get_format_bits(gl_format format, GLenum pname); +extern GLenum +_mesa_get_format_datatype(gl_format format); + extern void _mesa_test_formats(void); -- cgit v1.2.3 From db8aca3a398e16f7dc23d3321787274d07d13138 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 19:49:51 -0600 Subject: mesa: use _mesa_get_format_bytes() --- src/mesa/main/mipmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 5b70200cd5..faa6c47cb7 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -28,6 +28,7 @@ */ #include "imports.h" +#include "formats.h" #include "mipmap.h" #include "texcompress.h" #include "texformat.h" @@ -1641,7 +1642,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, ASSERT(dstData); } else { - bytesPerTexel = dstImage->TexFormat->TexelBytes; + bytesPerTexel = _mesa_get_format_bytes(dstImage->TexFormat->MesaFormat); ASSERT(dstWidth * dstHeight * dstDepth * bytesPerTexel > 0); dstImage->Data = _mesa_alloc_texmemory(dstWidth * dstHeight * dstDepth * bytesPerTexel); -- cgit v1.2.3 From 2de768328067fa42501bdd4b753490e7a00167a4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 19:51:45 -0600 Subject: mesa: use _mesa_get_format_base_format() --- src/mesa/drivers/common/meta.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index b445323aab..94cfdfe533 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -43,6 +43,7 @@ #include "main/depth.h" #include "main/enable.h" #include "main/fbobject.h" +#include "main/formats.h" #include "main/image.h" #include "main/macros.h" #include "main/matrix.h" @@ -2406,7 +2407,7 @@ copy_tex_sub_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_select_tex_image(ctx, texObj, target, level); - format = texImage->TexFormat->BaseFormat; + format = _mesa_get_format_base_format(texImage->TexFormat->MesaFormat); type = get_temp_image_type(ctx, format); bpp = _mesa_bytes_per_pixel(format, type); if (bpp <= 0) { -- cgit v1.2.3 From 21db8959c1134b43c9fe6d6179ee8fd9cde0b911 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 19:53:54 -0600 Subject: glide: use _mesa_get_format_bytes() --- src/mesa/drivers/glide/fxddtex.c | 5 +++-- src/mesa/drivers/glide/fxsetup.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index a63301d964..035c2ab92a 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -40,6 +40,7 @@ #include "fxdrv.h" #include "main/enums.h" +#include "main/formats.h" #include "main/image.h" #include "main/teximage.h" #include "main/texstore.h" @@ -1396,7 +1397,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, internalFormat, format, type); assert(texImage->TexFormat); - texelBytes = texImage->TexFormat->TexelBytes; + texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); /*if (!fxMesa->HaveTexFmt) assert(texelBytes == 1 || texelBytes == 2);*/ mml->glideFormat = fxGlideFormat(texImage->TexFormat->MesaFormat); @@ -1531,7 +1532,7 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, assert(texImage->Data); /* must have an existing texture image! */ assert(texImage->_BaseFormat); - texelBytes = texImage->TexFormat->TexelBytes; + texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); if (texImage->IsCompressed) { dstRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, mml->width); } else { diff --git a/src/mesa/drivers/glide/fxsetup.c b/src/mesa/drivers/glide/fxsetup.c index d48726a62a..9bf37967cd 100644 --- a/src/mesa/drivers/glide/fxsetup.c +++ b/src/mesa/drivers/glide/fxsetup.c @@ -42,6 +42,7 @@ #include "fxdrv.h" #include "main/enums.h" +#include "main/formats.h" #include "main/texstore.h" #include "tnl/tnl.h" #include "tnl/t_context.h" @@ -91,7 +92,7 @@ fxTexValidate(GLcontext * ctx, struct gl_texture_object *tObj) GLint _w, _h, maxSize = 1 << fxMesa->textureMaxLod; if ((mml->width > maxSize) || (mml->height > maxSize)) { /* need to rescale */ - GLint texelBytes = texImage->TexFormat->TexelBytes; + GLint texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); GLvoid *texImage_Data = texImage->Data; _w = MIN2(texImage->Width, maxSize); _h = MIN2(texImage->Height, maxSize); -- cgit v1.2.3 From 97c28bb63a4e1029eaf36d23b780f4d3396118a0 Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Sun, 27 Sep 2009 21:54:20 -0400 Subject: g3dvl: Move XvMC under the Xorg state tracker. --- src/gallium/state_trackers/xorg/xvmc/Makefile | 16 + src/gallium/state_trackers/xorg/xvmc/SConscript | 27 ++ src/gallium/state_trackers/xorg/xvmc/attributes.c | 19 + src/gallium/state_trackers/xorg/xvmc/block.c | 61 +++ src/gallium/state_trackers/xorg/xvmc/context.c | 203 ++++++++++ src/gallium/state_trackers/xorg/xvmc/subpicture.c | 168 ++++++++ src/gallium/state_trackers/xorg/xvmc/surface.c | 429 +++++++++++++++++++++ .../state_trackers/xorg/xvmc/tests/.gitignore | 5 + .../state_trackers/xorg/xvmc/tests/Makefile | 28 ++ .../state_trackers/xorg/xvmc/tests/test_blocks.c | 84 ++++ .../state_trackers/xorg/xvmc/tests/test_context.c | 92 +++++ .../xorg/xvmc/tests/test_rendering.c | 290 ++++++++++++++ .../state_trackers/xorg/xvmc/tests/test_surface.c | 71 ++++ .../state_trackers/xorg/xvmc/tests/testlib.c | 119 ++++++ .../state_trackers/xorg/xvmc/tests/testlib.h | 42 ++ .../state_trackers/xorg/xvmc/tests/xvmc_bench.c | 273 +++++++++++++ .../state_trackers/xorg/xvmc/xvmc_private.h | 31 ++ src/gallium/winsys/g3dvl/xlib/Makefile | 4 +- src/xvmc/Makefile | 45 --- src/xvmc/SConscript | 21 - src/xvmc/attributes.c | 19 - src/xvmc/block.c | 61 --- src/xvmc/context.c | 203 ---------- src/xvmc/subpicture.c | 168 -------- src/xvmc/surface.c | 429 --------------------- src/xvmc/tests/.gitignore | 5 - src/xvmc/tests/Makefile | 28 -- src/xvmc/tests/test_blocks.c | 84 ---- src/xvmc/tests/test_context.c | 92 ----- src/xvmc/tests/test_rendering.c | 290 -------------- src/xvmc/tests/test_surface.c | 71 ---- src/xvmc/tests/testlib.c | 119 ------ src/xvmc/tests/testlib.h | 42 -- src/xvmc/tests/xvmc_bench.c | 273 ------------- src/xvmc/xvmc_private.h | 31 -- 35 files changed, 1960 insertions(+), 1983 deletions(-) create mode 100644 src/gallium/state_trackers/xorg/xvmc/Makefile create mode 100644 src/gallium/state_trackers/xorg/xvmc/SConscript create mode 100644 src/gallium/state_trackers/xorg/xvmc/attributes.c create mode 100644 src/gallium/state_trackers/xorg/xvmc/block.c create mode 100644 src/gallium/state_trackers/xorg/xvmc/context.c create mode 100644 src/gallium/state_trackers/xorg/xvmc/subpicture.c create mode 100644 src/gallium/state_trackers/xorg/xvmc/surface.c create mode 100644 src/gallium/state_trackers/xorg/xvmc/tests/.gitignore create mode 100644 src/gallium/state_trackers/xorg/xvmc/tests/Makefile create mode 100644 src/gallium/state_trackers/xorg/xvmc/tests/test_blocks.c create mode 100644 src/gallium/state_trackers/xorg/xvmc/tests/test_context.c create mode 100644 src/gallium/state_trackers/xorg/xvmc/tests/test_rendering.c create mode 100644 src/gallium/state_trackers/xorg/xvmc/tests/test_surface.c create mode 100644 src/gallium/state_trackers/xorg/xvmc/tests/testlib.c create mode 100644 src/gallium/state_trackers/xorg/xvmc/tests/testlib.h create mode 100644 src/gallium/state_trackers/xorg/xvmc/tests/xvmc_bench.c create mode 100644 src/gallium/state_trackers/xorg/xvmc/xvmc_private.h delete mode 100644 src/xvmc/Makefile delete mode 100644 src/xvmc/SConscript delete mode 100644 src/xvmc/attributes.c delete mode 100644 src/xvmc/block.c delete mode 100644 src/xvmc/context.c delete mode 100644 src/xvmc/subpicture.c delete mode 100644 src/xvmc/surface.c delete mode 100644 src/xvmc/tests/.gitignore delete mode 100644 src/xvmc/tests/Makefile delete mode 100644 src/xvmc/tests/test_blocks.c delete mode 100644 src/xvmc/tests/test_context.c delete mode 100644 src/xvmc/tests/test_rendering.c delete mode 100644 src/xvmc/tests/test_surface.c delete mode 100644 src/xvmc/tests/testlib.c delete mode 100644 src/xvmc/tests/testlib.h delete mode 100644 src/xvmc/tests/xvmc_bench.c delete mode 100644 src/xvmc/xvmc_private.h (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xvmc/Makefile b/src/gallium/state_trackers/xorg/xvmc/Makefile new file mode 100644 index 0000000000..126dc6d58f --- /dev/null +++ b/src/gallium/state_trackers/xorg/xvmc/Makefile @@ -0,0 +1,16 @@ +TOP = ../../../../.. +include $(TOP)/configs/current + +LIBNAME = xvmctracker + +LIBRARY_INCLUDES = \ + $(shell pkg-config --cflags-only-I xvmc) \ + -I$(TOP)/src/gallium/winsys/g3dvl + +C_SOURCES = block.c \ + surface.c \ + context.c \ + subpicture.c \ + attributes.c + +include ../../../Makefile.template diff --git a/src/gallium/state_trackers/xorg/xvmc/SConscript b/src/gallium/state_trackers/xorg/xvmc/SConscript new file mode 100644 index 0000000000..cb25d68bd8 --- /dev/null +++ b/src/gallium/state_trackers/xorg/xvmc/SConscript @@ -0,0 +1,27 @@ +####################################################################### +# SConscript for xvmc state_tracker + +Import('*') + +if 'xorg/xvmc' in env['statetrackers']: + + env = env.Clone() + + env.Append(CPPPATH = [ + '#/src/gallium/include', + '#/src/gallium/auxiliary', + '#/src/gallium/winsys/g3dvl', + ]) + + env.ParseConfig('pkg-config --cflags --libs xvmc') + + st_xvmc = env.ConvenienceLibrary( + target = 'st_xvmc', + source = [ 'block.c', + 'surface.c', + 'context.c', + 'subpicture.c', + 'attributes.c', + ] + ) + Export('st_xvmc') diff --git a/src/gallium/state_trackers/xorg/xvmc/attributes.c b/src/gallium/state_trackers/xorg/xvmc/attributes.c new file mode 100644 index 0000000000..638da0b577 --- /dev/null +++ b/src/gallium/state_trackers/xorg/xvmc/attributes.c @@ -0,0 +1,19 @@ +#include +#include +#include +#include + +XvAttribute* XvMCQueryAttributes(Display *dpy, XvMCContext *context, int *number) +{ + return NULL; +} + +Status XvMCSetAttribute(Display *dpy, XvMCContext *context, Atom attribute, int value) +{ + return BadImplementation; +} + +Status XvMCGetAttribute(Display *dpy, XvMCContext *context, Atom attribute, int *value) +{ + return BadImplementation; +} diff --git a/src/gallium/state_trackers/xorg/xvmc/block.c b/src/gallium/state_trackers/xorg/xvmc/block.c new file mode 100644 index 0000000000..78fddfb79e --- /dev/null +++ b/src/gallium/state_trackers/xorg/xvmc/block.c @@ -0,0 +1,61 @@ +#include +#include +#include +#include +#include "xvmc_private.h" + +Status XvMCCreateBlocks(Display *dpy, XvMCContext *context, unsigned int num_blocks, XvMCBlockArray *blocks) +{ + assert(dpy); + + if (!context) + return XvMCBadContext; + if (num_blocks == 0) + return BadValue; + + assert(blocks); + + blocks->context_id = context->context_id; + blocks->num_blocks = num_blocks; + blocks->blocks = MALLOC(BLOCK_SIZE_BYTES * num_blocks); + blocks->privData = NULL; + + return Success; +} + +Status XvMCDestroyBlocks(Display *dpy, XvMCBlockArray *blocks) +{ + assert(dpy); + assert(blocks); + FREE(blocks->blocks); + + return Success; +} + +Status XvMCCreateMacroBlocks(Display *dpy, XvMCContext *context, unsigned int num_blocks, XvMCMacroBlockArray *blocks) +{ + assert(dpy); + + if (!context) + return XvMCBadContext; + if (num_blocks == 0) + return BadValue; + + assert(blocks); + + blocks->context_id = context->context_id; + blocks->num_blocks = num_blocks; + blocks->macro_blocks = MALLOC(sizeof(XvMCMacroBlock) * num_blocks); + blocks->privData = NULL; + + return Success; +} + +Status XvMCDestroyMacroBlocks(Display *dpy, XvMCMacroBlockArray *blocks) +{ + assert(dpy); + assert(blocks); + FREE(blocks->macro_blocks); + + return Success; +} diff --git a/src/gallium/state_trackers/xorg/xvmc/context.c b/src/gallium/state_trackers/xorg/xvmc/context.c new file mode 100644 index 0000000000..33f47838f5 --- /dev/null +++ b/src/gallium/state_trackers/xorg/xvmc/context.c @@ -0,0 +1,203 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "xvmc_private.h" + +static Status Validate(Display *dpy, XvPortID port, int surface_type_id, + unsigned int width, unsigned int height, int flags, + bool *found_port, int *screen, int *chroma_format, int *mc_type) +{ + bool found_surface = false; + XvAdaptorInfo *adaptor_info; + unsigned int num_adaptors; + int num_types; + unsigned int max_width, max_height; + Status ret; + + assert(dpy); + assert(found_port); + assert(screen); + assert(chroma_format); + assert(mc_type); + + *found_port = false; + + for (unsigned int i = 0; i < XScreenCount(dpy); ++i) + { + ret = XvQueryAdaptors(dpy, XRootWindow(dpy, i), &num_adaptors, &adaptor_info); + if (ret != Success) + return ret; + + for (unsigned int j = 0; j < num_adaptors && !*found_port; ++j) + { + for (unsigned int k = 0; k < adaptor_info[j].num_ports && !*found_port; ++k) + { + XvMCSurfaceInfo *surface_info; + + if (adaptor_info[j].base_id + k != port) + continue; + + *found_port = true; + + surface_info = XvMCListSurfaceTypes(dpy, adaptor_info[j].base_id, &num_types); + if (!surface_info) + { + XvFreeAdaptorInfo(adaptor_info); + return BadAlloc; + } + + for (unsigned int l = 0; l < num_types && !found_surface; ++l) + { + if (surface_info[l].surface_type_id != surface_type_id) + continue; + + found_surface = true; + max_width = surface_info[l].max_width; + max_height = surface_info[l].max_height; + *chroma_format = surface_info[l].chroma_format; + *mc_type = surface_info[l].mc_type; + *screen = i; + } + + XFree(surface_info); + } + } + + XvFreeAdaptorInfo(adaptor_info); + } + + if (!*found_port) + return XvBadPort; + if (!found_surface) + return BadMatch; + if (width > max_width || height > max_height) + return BadValue; + if (flags != XVMC_DIRECT && flags != 0) + return BadValue; + + return Success; +} + +static enum pipe_video_profile ProfileToPipe(int xvmc_profile) +{ + if (xvmc_profile & XVMC_MPEG_1) + assert(0); + if (xvmc_profile & XVMC_MPEG_2) + return PIPE_VIDEO_PROFILE_MPEG2_MAIN; + if (xvmc_profile & XVMC_H263) + assert(0); + if (xvmc_profile & XVMC_MPEG_4) + assert(0); + + assert(0); + + return -1; +} + +static enum pipe_video_chroma_format FormatToPipe(int xvmc_format) +{ + switch (xvmc_format) + { + case XVMC_CHROMA_FORMAT_420: + return PIPE_VIDEO_CHROMA_FORMAT_420; + case XVMC_CHROMA_FORMAT_422: + return PIPE_VIDEO_CHROMA_FORMAT_422; + case XVMC_CHROMA_FORMAT_444: + return PIPE_VIDEO_CHROMA_FORMAT_444; + default: + assert(0); + } + + return -1; +} + +Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id, + int width, int height, int flags, XvMCContext *context) +{ + bool found_port; + int scrn; + int chroma_format; + int mc_type; + Status ret; + struct pipe_screen *screen; + struct pipe_video_context *vpipe; + XvMCContextPrivate *context_priv; + + assert(dpy); + + if (!context) + return XvMCBadContext; + + ret = Validate(dpy, port, surface_type_id, width, height, flags, + &found_port, &scrn, &chroma_format, &mc_type); + + /* Success and XvBadPort have the same value */ + if (ret != Success || !found_port) + return ret; + + context_priv = CALLOC(1, sizeof(XvMCContextPrivate)); + if (!context_priv) + return BadAlloc; + + /* TODO: Reuse screen if process creates another context */ + screen = vl_screen_create(dpy, scrn); + + if (!screen) + { + FREE(context_priv); + return BadAlloc; + } + + vpipe = vl_video_create(screen, ProfileToPipe(mc_type), + FormatToPipe(chroma_format), width, height); + + if (!vpipe) + { + screen->destroy(screen); + FREE(context_priv); + return BadAlloc; + } + + context_priv->vpipe = vpipe; + + context->context_id = XAllocID(dpy); + context->surface_type_id = surface_type_id; + context->width = width; + context->height = height; + context->flags = flags; + context->port = port; + context->privData = context_priv; + + SyncHandle(); + + return Success; +} + +Status XvMCDestroyContext(Display *dpy, XvMCContext *context) +{ + struct pipe_screen *screen; + struct pipe_video_context *vpipe; + XvMCContextPrivate *context_priv; + + assert(dpy); + + if (!context || !context->privData) + return XvMCBadContext; + + context_priv = context->privData; + vpipe = context_priv->vpipe; + pipe_surface_reference(&context_priv->backbuffer, NULL); + screen = vpipe->screen; + vpipe->destroy(vpipe); + screen->destroy(screen); + FREE(context_priv); + context->privData = NULL; + + return Success; +} diff --git a/src/gallium/state_trackers/xorg/xvmc/subpicture.c b/src/gallium/state_trackers/xorg/xvmc/subpicture.c new file mode 100644 index 0000000000..78ba618f5a --- /dev/null +++ b/src/gallium/state_trackers/xorg/xvmc/subpicture.c @@ -0,0 +1,168 @@ +#include +#include +#include + +Status XvMCCreateSubpicture(Display *dpy, XvMCContext *context, XvMCSubpicture *subpicture, + unsigned short width, unsigned short height, int xvimage_id) +{ + assert(dpy); + + if (!context) + return XvMCBadContext; + + assert(subpicture); + + /*if (width > || height > ) + return BadValue;*/ + + /*if (xvimage_id != ) + return BadMatch;*/ + + subpicture->subpicture_id = XAllocID(dpy); + subpicture->context_id = context->context_id; + subpicture->xvimage_id = xvimage_id; + subpicture->width = width; + subpicture->height = height; + subpicture->num_palette_entries = 0; + subpicture->entry_bytes = 0; + subpicture->component_order[0] = 0; + subpicture->component_order[1] = 0; + subpicture->component_order[2] = 0; + subpicture->component_order[3] = 0; + /* TODO: subpicture->privData = ;*/ + + SyncHandle(); + + return Success; +} + +Status XvMCClearSubpicture(Display *dpy, XvMCSubpicture *subpicture, short x, short y, + unsigned short width, unsigned short height, unsigned int color) +{ + assert(dpy); + + if (!subpicture) + return XvMCBadSubpicture; + + /* TODO: Assert clear rect is within bounds? Or clip? */ + + return Success; +} + +Status XvMCCompositeSubpicture(Display *dpy, XvMCSubpicture *subpicture, XvImage *image, + short srcx, short srcy, unsigned short width, unsigned short height, + short dstx, short dsty) +{ + assert(dpy); + + if (!subpicture) + return XvMCBadSubpicture; + + assert(image); + + if (subpicture->xvimage_id != image->id) + return BadMatch; + + /* TODO: Assert rects are within bounds? Or clip? */ + + return Success; +} + +Status XvMCDestroySubpicture(Display *dpy, XvMCSubpicture *subpicture) +{ + assert(dpy); + + if (!subpicture) + return XvMCBadSubpicture; + + return BadImplementation; +} + +Status XvMCSetSubpicturePalette(Display *dpy, XvMCSubpicture *subpicture, unsigned char *palette) +{ + assert(dpy); + + if (!subpicture) + return XvMCBadSubpicture; + + assert(palette); + + /* We don't support paletted subpictures */ + return BadMatch; +} + +Status XvMCBlendSubpicture(Display *dpy, XvMCSurface *target_surface, XvMCSubpicture *subpicture, + short subx, short suby, unsigned short subw, unsigned short subh, + short surfx, short surfy, unsigned short surfw, unsigned short surfh) +{ + assert(dpy); + + if (!target_surface) + return XvMCBadSurface; + + if (!subpicture) + return XvMCBadSubpicture; + + if (target_surface->context_id != subpicture->context_id) + return BadMatch; + + /* TODO: Assert rects are within bounds? Or clip? */ + return Success; +} + +Status XvMCBlendSubpicture2(Display *dpy, XvMCSurface *source_surface, XvMCSurface *target_surface, + XvMCSubpicture *subpicture, short subx, short suby, unsigned short subw, unsigned short subh, + short surfx, short surfy, unsigned short surfw, unsigned short surfh) +{ + assert(dpy); + + if (!source_surface || !target_surface) + return XvMCBadSurface; + + if (!subpicture) + return XvMCBadSubpicture; + + if (source_surface->context_id != subpicture->context_id) + return BadMatch; + + if (source_surface->context_id != subpicture->context_id) + return BadMatch; + + /* TODO: Assert rects are within bounds? Or clip? */ + return Success; +} + +Status XvMCSyncSubpicture(Display *dpy, XvMCSubpicture *subpicture) +{ + assert(dpy); + + if (!subpicture) + return XvMCBadSubpicture; + + return Success; +} + +Status XvMCFlushSubpicture(Display *dpy, XvMCSubpicture *subpicture) +{ + assert(dpy); + + if (!subpicture) + return XvMCBadSubpicture; + + return Success; +} + +Status XvMCGetSubpictureStatus(Display *dpy, XvMCSubpicture *subpicture, int *status) +{ + assert(dpy); + + if (!subpicture) + return XvMCBadSubpicture; + + assert(status); + + /* TODO */ + *status = 0; + + return Success; +} diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c new file mode 100644 index 0000000000..0467c4d07d --- /dev/null +++ b/src/gallium/state_trackers/xorg/xvmc/surface.c @@ -0,0 +1,429 @@ +#include +#include +#include +#include +#include +#include +#include "xvmc_private.h" + +static enum pipe_mpeg12_macroblock_type TypeToPipe(int xvmc_mb_type) +{ + if (xvmc_mb_type & XVMC_MB_TYPE_INTRA) + return PIPE_MPEG12_MACROBLOCK_TYPE_INTRA; + if ((xvmc_mb_type & (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) == XVMC_MB_TYPE_MOTION_FORWARD) + return PIPE_MPEG12_MACROBLOCK_TYPE_FWD; + if ((xvmc_mb_type & (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) == XVMC_MB_TYPE_MOTION_BACKWARD) + return PIPE_MPEG12_MACROBLOCK_TYPE_BKWD; + if ((xvmc_mb_type & (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) == (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) + return PIPE_MPEG12_MACROBLOCK_TYPE_BI; + + assert(0); + + return -1; +} + +static enum pipe_mpeg12_picture_type PictureToPipe(int xvmc_pic) +{ + switch (xvmc_pic) + { + case XVMC_TOP_FIELD: + return PIPE_MPEG12_PICTURE_TYPE_FIELD_TOP; + case XVMC_BOTTOM_FIELD: + return PIPE_MPEG12_PICTURE_TYPE_FIELD_BOTTOM; + case XVMC_FRAME_PICTURE: + return PIPE_MPEG12_PICTURE_TYPE_FRAME; + default: + assert(0); + } + + return -1; +} + +static enum pipe_mpeg12_motion_type MotionToPipe(int xvmc_motion_type, int xvmc_dct_type) +{ + switch (xvmc_motion_type) + { + case XVMC_PREDICTION_FRAME: + return xvmc_dct_type == XVMC_DCT_TYPE_FIELD ? + PIPE_MPEG12_MOTION_TYPE_16x8 : PIPE_MPEG12_MOTION_TYPE_FRAME; + case XVMC_PREDICTION_FIELD: + return PIPE_MPEG12_MOTION_TYPE_FIELD; + case XVMC_PREDICTION_DUAL_PRIME: + return PIPE_MPEG12_MOTION_TYPE_DUALPRIME; + default: + assert(0); + } + + return -1; +} + +static bool +CreateOrResizeBackBuffer(struct pipe_video_context *vpipe, unsigned int width, unsigned int height, + struct pipe_surface **backbuffer) +{ + struct pipe_texture template; + struct pipe_texture *tex; + + assert(vpipe); + + if (*backbuffer) + { + if ((*backbuffer)->width != width || (*backbuffer)->height != height) + pipe_surface_reference(backbuffer, NULL); + else + return true; + } + + memset(&template, 0, sizeof(struct pipe_texture)); + template.target = PIPE_TEXTURE_2D; + /* XXX: Needs to match the drawable's format? */ + template.format = PIPE_FORMAT_X8R8G8B8_UNORM; + template.last_level = 0; + template.width[0] = width; + template.height[0] = height; + template.depth[0] = 1; + pf_get_block(template.format, &template.block); + template.tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET; + + tex = vpipe->screen->texture_create(vpipe->screen, &template); + if (!tex) + return false; + + *backbuffer = vpipe->screen->get_tex_surface(vpipe->screen, tex, 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_READ | + PIPE_BUFFER_USAGE_GPU_WRITE); + pipe_texture_reference(&tex, NULL); + + if (!*backbuffer) + return false; + + /* Clear the backbuffer in case the video doesn't cover the whole window */ + /* FIXME: Need to clear every time a frame moves and leaves dirty rects */ + vpipe->clear_surface(vpipe, 0, 0, width, height, 0, *backbuffer); + + return true; +} + +static void +MacroBlocksToPipe(const XvMCMacroBlockArray *xvmc_macroblocks, + const XvMCBlockArray *xvmc_blocks, + unsigned int first_macroblock, + unsigned int num_macroblocks, + struct pipe_mpeg12_macroblock *pipe_macroblocks) +{ + unsigned int i, j, k, l; + XvMCMacroBlock *xvmc_mb; + + assert(xvmc_macroblocks); + assert(xvmc_blocks); + assert(pipe_macroblocks); + assert(num_macroblocks); + + xvmc_mb = xvmc_macroblocks->macro_blocks + first_macroblock; + + for (i = 0; i < num_macroblocks; ++i) + { + pipe_macroblocks->base.codec = PIPE_VIDEO_CODEC_MPEG12; + pipe_macroblocks->mbx = xvmc_mb->x; + pipe_macroblocks->mby = xvmc_mb->y; + pipe_macroblocks->mb_type = TypeToPipe(xvmc_mb->macroblock_type); + if (pipe_macroblocks->mb_type != PIPE_MPEG12_MACROBLOCK_TYPE_INTRA) + pipe_macroblocks->mo_type = MotionToPipe(xvmc_mb->motion_type, xvmc_mb->dct_type); + /* Get rid of Valgrind 'undefined' warnings */ + else + pipe_macroblocks->mo_type = -1; + pipe_macroblocks->dct_type = xvmc_mb->dct_type == XVMC_DCT_TYPE_FIELD ? + PIPE_MPEG12_DCT_TYPE_FIELD : PIPE_MPEG12_DCT_TYPE_FRAME; + + for (j = 0; j < 2; ++j) + for (k = 0; k < 2; ++k) + for (l = 0; l < 2; ++l) + pipe_macroblocks->pmv[j][k][l] = xvmc_mb->PMV[j][k][l]; + + pipe_macroblocks->cbp = xvmc_mb->coded_block_pattern; + pipe_macroblocks->blocks = xvmc_blocks->blocks + xvmc_mb->index * BLOCK_SIZE_SAMPLES; + + ++pipe_macroblocks; + ++xvmc_mb; + } +} + +Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surface) +{ + XvMCContextPrivate *context_priv; + struct pipe_video_context *vpipe; + XvMCSurfacePrivate *surface_priv; + struct pipe_video_surface *vsfc; + + assert(dpy); + + if (!context) + return XvMCBadContext; + if (!surface) + return XvMCBadSurface; + + context_priv = context->privData; + vpipe = context_priv->vpipe; + + surface_priv = CALLOC(1, sizeof(XvMCSurfacePrivate)); + if (!surface_priv) + return BadAlloc; + + vsfc = vpipe->screen->video_surface_create(vpipe->screen, vpipe->chroma_format, + vpipe->width, vpipe->height); + if (!vsfc) + { + FREE(surface_priv); + return BadAlloc; + } + + surface_priv->pipe_vsfc = vsfc; + surface_priv->context = context; + + surface->surface_id = XAllocID(dpy); + surface->context_id = context->context_id; + surface->surface_type_id = context->surface_type_id; + surface->width = context->width; + surface->height = context->height; + surface->privData = surface_priv; + + SyncHandle(); + + return Success; +} + +Status XvMCRenderSurface(Display *dpy, XvMCContext *context, unsigned int picture_structure, + XvMCSurface *target_surface, XvMCSurface *past_surface, XvMCSurface *future_surface, + unsigned int flags, unsigned int num_macroblocks, unsigned int first_macroblock, + XvMCMacroBlockArray *macroblocks, XvMCBlockArray *blocks +) +{ + struct pipe_video_context *vpipe; + struct pipe_surface *t_vsfc; + struct pipe_surface *p_vsfc; + struct pipe_surface *f_vsfc; + XvMCContextPrivate *context_priv; + XvMCSurfacePrivate *target_surface_priv; + XvMCSurfacePrivate *past_surface_priv; + XvMCSurfacePrivate *future_surface_priv; + struct pipe_mpeg12_macroblock pipe_macroblocks[num_macroblocks]; + + assert(dpy); + + if (!context || !context->privData) + return XvMCBadContext; + if (!target_surface || !target_surface->privData) + return XvMCBadSurface; + + if (picture_structure != XVMC_TOP_FIELD && + picture_structure != XVMC_BOTTOM_FIELD && + picture_structure != XVMC_FRAME_PICTURE) + return BadValue; + /* Bkwd pred equivalent to fwd (past && !future) */ + if (future_surface && !past_surface) + return BadMatch; + + assert(context->context_id == target_surface->context_id); + assert(!past_surface || context->context_id == past_surface->context_id); + assert(!future_surface || context->context_id == future_surface->context_id); + + assert(macroblocks); + assert(blocks); + + assert(macroblocks->context_id == context->context_id); + assert(blocks->context_id == context->context_id); + + assert(flags == 0 || flags == XVMC_SECOND_FIELD); + + target_surface_priv = target_surface->privData; + past_surface_priv = past_surface ? past_surface->privData : NULL; + future_surface_priv = future_surface ? future_surface->privData : NULL; + + assert(target_surface_priv->context == context); + assert(!past_surface || past_surface_priv->context == context); + assert(!future_surface || future_surface_priv->context == context); + + context_priv = context->privData; + vpipe = context_priv->vpipe; + + t_vsfc = target_surface_priv->pipe_vsfc; + p_vsfc = past_surface ? past_surface_priv->pipe_vsfc : NULL; + f_vsfc = future_surface ? future_surface_priv->pipe_vsfc : NULL; + + MacroBlocksToPipe(macroblocks, blocks, first_macroblock, + num_macroblocks, pipe_macroblocks); + + vpipe->set_decode_target(vpipe, t_vsfc); + vpipe->decode_macroblocks(vpipe, p_vsfc, f_vsfc, num_macroblocks, + &pipe_macroblocks->base, target_surface_priv->render_fence); + + return Success; +} + +Status XvMCFlushSurface(Display *dpy, XvMCSurface *surface) +{ +#if 0 + struct vlSurface *vl_sfc; + + assert(dpy); + + if (!surface) + return XvMCBadSurface; + + vl_sfc = surface->privData; + + vlSurfaceFlush(vl_sfc); +#endif + return Success; +} + +Status XvMCSyncSurface(Display *dpy, XvMCSurface *surface) +{ +#if 0 + struct vlSurface *vl_sfc; + + assert(dpy); + + if (!surface) + return XvMCBadSurface; + + vl_sfc = surface->privData; + + vlSurfaceSync(vl_sfc); +#endif + return Success; +} + +Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable, + short srcx, short srcy, unsigned short srcw, unsigned short srch, + short destx, short desty, unsigned short destw, unsigned short desth, + int flags) +{ + Window root; + int x, y; + unsigned int width, height; + unsigned int border_width; + unsigned int depth; + struct pipe_video_context *vpipe; + XvMCSurfacePrivate *surface_priv; + XvMCContextPrivate *context_priv; + XvMCContext *context; + struct pipe_video_rect src_rect = {srcx, srcy, srcw, srch}; + struct pipe_video_rect dst_rect = {destx, desty, destw, desth}; + + assert(dpy); + + if (!surface || !surface->privData) + return XvMCBadSurface; + + if (XGetGeometry(dpy, drawable, &root, &x, &y, &width, &height, &border_width, &depth) == BadDrawable) + return BadDrawable; + + assert(flags == XVMC_TOP_FIELD || flags == XVMC_BOTTOM_FIELD || flags == XVMC_FRAME_PICTURE); + assert(srcx + srcw - 1 < surface->width); + assert(srcy + srch - 1 < surface->height); + /* + * Some apps (mplayer) hit these asserts because they call + * this function after the window has been resized by the WM + * but before they've handled the corresponding XEvent and + * know about the new dimensions. The output should be clipped + * until the app updates destw and desth. + */ + /* + assert(destx + destw - 1 < width); + assert(desty + desth - 1 < height); + */ + + surface_priv = surface->privData; + context = surface_priv->context; + context_priv = context->privData; + vpipe = context_priv->vpipe; + + if (!CreateOrResizeBackBuffer(vpipe, width, height, &context_priv->backbuffer)) + return BadAlloc; + + vpipe->render_picture(vpipe, surface_priv->pipe_vsfc, PictureToPipe(flags), &src_rect, + context_priv->backbuffer, &dst_rect, surface_priv->disp_fence); + + vl_video_bind_drawable(vpipe, drawable); + + vpipe->screen->flush_frontbuffer + ( + vpipe->screen, + context_priv->backbuffer, + vpipe->priv + ); + + return Success; +} + +Status XvMCGetSurfaceStatus(Display *dpy, XvMCSurface *surface, int *status) +{ +#if 0 + struct vlSurface *vl_sfc; + enum vlResourceStatus res_status; + + assert(dpy); + + if (!surface) + return XvMCBadSurface; + + assert(status); + + vl_sfc = surface->privData; + + vlSurfaceGetStatus(vl_sfc, &res_status); + + switch (res_status) + { + case vlResourceStatusFree: + { + *status = 0; + break; + } + case vlResourceStatusRendering: + { + *status = XVMC_RENDERING; + break; + } + case vlResourceStatusDisplaying: + { + *status = XVMC_DISPLAYING; + break; + } + default: + assert(0); + } +#endif + *status = 0; + return Success; +} + +Status XvMCDestroySurface(Display *dpy, XvMCSurface *surface) +{ + XvMCSurfacePrivate *surface_priv; + + assert(dpy); + + if (!surface || !surface->privData) + return XvMCBadSurface; + + surface_priv = surface->privData; + pipe_video_surface_reference(&surface_priv->pipe_vsfc, NULL); + FREE(surface_priv); + surface->privData = NULL; + + return Success; +} + +Status XvMCHideSurface(Display *dpy, XvMCSurface *surface) +{ + assert(dpy); + + if (!surface || !surface->privData) + return XvMCBadSurface; + + /* No op, only for overlaid rendering */ + + return Success; +} diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/.gitignore b/src/gallium/state_trackers/xorg/xvmc/tests/.gitignore new file mode 100644 index 0000000000..e1d2f9023d --- /dev/null +++ b/src/gallium/state_trackers/xorg/xvmc/tests/.gitignore @@ -0,0 +1,5 @@ +test_context +test_surface +test_blocks +test_rendering +xvmc_bench diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/Makefile b/src/gallium/state_trackers/xorg/xvmc/tests/Makefile new file mode 100644 index 0000000000..c875dd7605 --- /dev/null +++ b/src/gallium/state_trackers/xorg/xvmc/tests/Makefile @@ -0,0 +1,28 @@ +TOP = ../../../../../.. +include $(TOP)/configs/current + +LIBS = -lXvMCW -lXvMC -lXv -lX11 + +############################################# + +.PHONY: default clean + +default: test_context test_surface test_blocks test_rendering xvmc_bench + +test_context: test_context.o testlib.o + $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) + +test_surface: test_surface.o testlib.o + $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) + +test_blocks: test_blocks.o testlib.o + $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) + +test_rendering: test_rendering.o testlib.o + $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) + +xvmc_bench: xvmc_bench.o testlib.o + $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) + +clean: + $(RM) -rf *.o test_context test_surface test_blocks test_rendering xvmc_bench diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/test_blocks.c b/src/gallium/state_trackers/xorg/xvmc/tests/test_blocks.c new file mode 100644 index 0000000000..dc80adfa65 --- /dev/null +++ b/src/gallium/state_trackers/xorg/xvmc/tests/test_blocks.c @@ -0,0 +1,84 @@ +#include +#include +#include "testlib.h" + +int main(int argc, char **argv) +{ + const unsigned int width = 16, height = 16; + const unsigned int min_required_blocks = 1, min_required_macroblocks = 1; + const unsigned int mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2}; + + Display *display; + XvPortID port_num; + int surface_type_id; + unsigned int is_overlay, intra_unsigned; + int colorkey; + XvMCContext context; + XvMCSurface surface; + XvMCBlockArray blocks = {0}; + XvMCMacroBlockArray macroblocks = {0}; + + display = XOpenDisplay(NULL); + + if (!GetPort + ( + display, + width, + height, + XVMC_CHROMA_FORMAT_420, + mc_types, + 2, + &port_num, + &surface_type_id, + &is_overlay, + &intra_unsigned + )) + { + XCloseDisplay(display); + error(1, 0, "Error, unable to find a good port.\n"); + } + + if (is_overlay) + { + Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0); + XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey); + } + + assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, XVMC_DIRECT, &context) == Success); + assert(XvMCCreateSurface(display, &context, &surface) == Success); + + /* Test NULL context */ + assert(XvMCCreateBlocks(display, NULL, 1, &blocks) == XvMCBadContext); + /* Test 0 blocks */ + assert(XvMCCreateBlocks(display, &context, 0, &blocks) == BadValue); + /* Test valid params */ + assert(XvMCCreateBlocks(display, &context, min_required_blocks, &blocks) == Success); + /* Test context id assigned and correct */ + assert(blocks.context_id == context.context_id); + /* Test number of blocks assigned and correct */ + assert(blocks.num_blocks == min_required_blocks); + /* Test block pointer valid */ + assert(blocks.blocks != NULL); + /* Test NULL context */ + assert(XvMCCreateMacroBlocks(display, NULL, 1, ¯oblocks) == XvMCBadContext); + /* Test 0 macroblocks */ + assert(XvMCCreateMacroBlocks(display, &context, 0, ¯oblocks) == BadValue); + /* Test valid params */ + assert(XvMCCreateMacroBlocks(display, &context, min_required_macroblocks, ¯oblocks) == Success); + /* Test context id assigned and correct */ + assert(macroblocks.context_id == context.context_id); + /* Test macroblock pointer valid */ + assert(macroblocks.macro_blocks != NULL); + /* Test valid params */ + assert(XvMCDestroyMacroBlocks(display, ¯oblocks) == Success); + /* Test valid params */ + assert(XvMCDestroyBlocks(display, &blocks) == Success); + + assert(XvMCDestroySurface(display, &surface) == Success); + assert(XvMCDestroyContext(display, &context) == Success); + + XvUngrabPort(display, port_num, CurrentTime); + XCloseDisplay(display); + + return 0; +} diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/test_context.c b/src/gallium/state_trackers/xorg/xvmc/tests/test_context.c new file mode 100644 index 0000000000..53f7449cd0 --- /dev/null +++ b/src/gallium/state_trackers/xorg/xvmc/tests/test_context.c @@ -0,0 +1,92 @@ +#include +#include +#include "testlib.h" + +int main(int argc, char **argv) +{ + const unsigned int width = 16, height = 16; + const unsigned int mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2}; + + Display *display; + XvPortID port_num; + int surface_type_id; + unsigned int is_overlay, intra_unsigned; + int colorkey; + XvMCContext context = {0}; + + display = XOpenDisplay(NULL); + + if (!GetPort + ( + display, + width, + height, + XVMC_CHROMA_FORMAT_420, + mc_types, + 2, + &port_num, + &surface_type_id, + &is_overlay, + &intra_unsigned + )) + { + XCloseDisplay(display); + error(1, 0, "Error, unable to find a good port.\n"); + } + + if (is_overlay) + { + Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0); + XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey); + } + + /* Test NULL context */ + /* XXX: XvMCBadContext not a valid return for XvMCCreateContext in the XvMC API, but openChrome driver returns it */ + assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, XVMC_DIRECT, NULL) == XvMCBadContext); + /* Test invalid port */ + /* XXX: Success and XvBadPort have the same value, if this call actually gets passed the validation step as of now we'll crash later */ + assert(XvMCCreateContext(display, -1, surface_type_id, width, height, XVMC_DIRECT, &context) == XvBadPort); + /* Test invalid surface */ + assert(XvMCCreateContext(display, port_num, -1, width, height, XVMC_DIRECT, &context) == BadMatch); + /* Test invalid flags */ + assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, -1, &context) == BadValue); + /* Test huge width */ + assert(XvMCCreateContext(display, port_num, surface_type_id, 16384, height, XVMC_DIRECT, &context) == BadValue); + /* Test huge height */ + assert(XvMCCreateContext(display, port_num, surface_type_id, width, 16384, XVMC_DIRECT, &context) == BadValue); + /* Test huge width & height */ + assert(XvMCCreateContext(display, port_num, surface_type_id, 16384, 16384, XVMC_DIRECT, &context) == BadValue); + /* Test valid params */ + assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, XVMC_DIRECT, &context) == Success); + /* Test context id assigned */ + assert(context.context_id != 0); + /* Test surface type id assigned and correct */ + assert(context.surface_type_id == surface_type_id); + /* Test width & height assigned and correct */ + assert(context.width == width && context.height == height); + /* Test port assigned and correct */ + assert(context.port == port_num); + /* Test flags assigned and correct */ + assert(context.flags == XVMC_DIRECT); + /* Test NULL context */ + assert(XvMCDestroyContext(display, NULL) == XvMCBadContext); + /* Test valid params */ + assert(XvMCDestroyContext(display, &context) == Success); + /* Test awkward but valid width */ + assert(XvMCCreateContext(display, port_num, surface_type_id, width + 1, height, XVMC_DIRECT, &context) == Success); + assert(context.width >= width + 1); + assert(XvMCDestroyContext(display, &context) == Success); + /* Test awkward but valid height */ + assert(XvMCCreateContext(display, port_num, surface_type_id, width, height + 1, XVMC_DIRECT, &context) == Success); + assert(context.height >= height + 1); + assert(XvMCDestroyContext(display, &context) == Success); + /* Test awkward but valid width & height */ + assert(XvMCCreateContext(display, port_num, surface_type_id, width + 1, height + 1, XVMC_DIRECT, &context) == Success); + assert(context.width >= width + 1 && context.height >= height + 1); + assert(XvMCDestroyContext(display, &context) == Success); + + XvUngrabPort(display, port_num, CurrentTime); + XCloseDisplay(display); + + return 0; +} diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/test_rendering.c b/src/gallium/state_trackers/xorg/xvmc/tests/test_rendering.c new file mode 100644 index 0000000000..6d720dfcdc --- /dev/null +++ b/src/gallium/state_trackers/xorg/xvmc/tests/test_rendering.c @@ -0,0 +1,290 @@ +#include +#include +#include +#include +#include "testlib.h" + +#define BLOCK_WIDTH 8 +#define BLOCK_HEIGHT 8 +#define BLOCK_SIZE (BLOCK_WIDTH * BLOCK_HEIGHT) +#define MACROBLOCK_WIDTH 16 +#define MACROBLOCK_HEIGHT 16 +#define MACROBLOCK_WIDTH_IN_BLOCKS (MACROBLOCK_WIDTH / BLOCK_WIDTH) +#define MACROBLOCK_HEIGHT_IN_BLOCKS (MACROBLOCK_HEIGHT / BLOCK_HEIGHT) +#define BLOCKS_PER_MACROBLOCK 6 + +#define INPUT_WIDTH 16 +#define INPUT_HEIGHT 16 +#define INPUT_WIDTH_IN_MACROBLOCKS (INPUT_WIDTH / MACROBLOCK_WIDTH) +#define INPUT_HEIGHT_IN_MACROBLOCKS (INPUT_HEIGHT / MACROBLOCK_HEIGHT) +#define NUM_MACROBLOCKS (INPUT_WIDTH_IN_MACROBLOCKS * INPUT_HEIGHT_IN_MACROBLOCKS) + +#define DEFAULT_OUTPUT_WIDTH INPUT_WIDTH +#define DEFAULT_OUTPUT_HEIGHT INPUT_HEIGHT +#define DEFAULT_ACCEPTABLE_ERR 0.01 + +void ParseArgs(int argc, char **argv, unsigned int *output_width, unsigned int *output_height, double *acceptable_error, int *prompt); +void Gradient(short *block, unsigned int start, unsigned int stop, int horizontal); + +void ParseArgs(int argc, char **argv, unsigned int *output_width, unsigned int *output_height, double *acceptable_error, int *prompt) +{ + int fail = 0; + int i; + + *output_width = DEFAULT_OUTPUT_WIDTH; + *output_height = DEFAULT_OUTPUT_WIDTH; + *acceptable_error = DEFAULT_ACCEPTABLE_ERR; + *prompt = 1; + + for (i = 1; i < argc && !fail; ++i) + { + if (!strcmp(argv[i], "-w")) + { + if (sscanf(argv[++i], "%u", output_width) != 1) + fail = 1; + } + else if (!strcmp(argv[i], "-h")) + { + if (sscanf(argv[++i], "%u", output_height) != 1) + fail = 1; + } + else if (!strcmp(argv[i], "-e")) + { + if (sscanf(argv[++i], "%lf", acceptable_error) != 1) + fail = 1; + } + else if (strcmp(argv[i], "-n")) + *prompt = 0; + else + fail = 1; + } + + if (fail) + error + ( + 1, 0, + "Bad argument.\n" + "\n" + "Usage: %s [options]\n" + "\t-w \tOutput width\n" + "\t-h \tOutput height\n" + "\t-e \tAcceptable margin of error per pixel, from 0 to 1\n" + "\t-n\tDon't prompt for quit\n", + argv[0] + ); +} + +void Gradient(short *block, unsigned int start, unsigned int stop, int horizontal) +{ + unsigned int x, y; + unsigned int range = stop - start; + + if (horizontal) + { + for (y = 0; y < BLOCK_HEIGHT; ++y) + for (x = 0; x < BLOCK_WIDTH; ++x) + block[y * BLOCK_WIDTH + x] = (short)(start + range * (x / (float)(BLOCK_WIDTH - 1))); + } + else + { + for (y = 0; y < BLOCK_HEIGHT; ++y) + for (x = 0; x < BLOCK_WIDTH; ++x) + block[y * BLOCK_WIDTH + x] = (short)(start + range * (y / (float)(BLOCK_HEIGHT - 1))); + } +} + +int main(int argc, char **argv) +{ + unsigned int output_width; + unsigned int output_height; + double acceptable_error; + int prompt; + Display *display; + Window root, window; + const unsigned int mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2}; + XvPortID port_num; + int surface_type_id; + unsigned int is_overlay, intra_unsigned; + int colorkey; + XvMCContext context; + XvMCSurface surface; + XvMCBlockArray block_array; + XvMCMacroBlockArray mb_array; + int mbx, mby, bx, by; + XvMCMacroBlock *mb; + short *blocks; + int quit = 0; + + ParseArgs(argc, argv, &output_width, &output_height, &acceptable_error, &prompt); + + display = XOpenDisplay(NULL); + + if (!GetPort + ( + display, + INPUT_WIDTH, + INPUT_HEIGHT, + XVMC_CHROMA_FORMAT_420, + mc_types, + 2, + &port_num, + &surface_type_id, + &is_overlay, + &intra_unsigned + )) + { + XCloseDisplay(display); + error(1, 0, "Error, unable to find a good port.\n"); + } + + if (is_overlay) + { + Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0); + XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey); + } + + root = XDefaultRootWindow(display); + window = XCreateSimpleWindow(display, root, 0, 0, output_width, output_height, 0, 0, colorkey); + + assert(XvMCCreateContext(display, port_num, surface_type_id, INPUT_WIDTH, INPUT_HEIGHT, XVMC_DIRECT, &context) == Success); + assert(XvMCCreateSurface(display, &context, &surface) == Success); + assert(XvMCCreateBlocks(display, &context, NUM_MACROBLOCKS * BLOCKS_PER_MACROBLOCK, &block_array) == Success); + assert(XvMCCreateMacroBlocks(display, &context, NUM_MACROBLOCKS, &mb_array) == Success); + + mb = mb_array.macro_blocks; + blocks = block_array.blocks; + + for (mby = 0; mby < INPUT_HEIGHT_IN_MACROBLOCKS; ++mby) + for (mbx = 0; mbx < INPUT_WIDTH_IN_MACROBLOCKS; ++mbx) + { + mb->x = mbx; + mb->y = mby; + mb->macroblock_type = XVMC_MB_TYPE_INTRA; + /*mb->motion_type = ;*/ + /*mb->motion_vertical_field_select = ;*/ + mb->dct_type = XVMC_DCT_TYPE_FRAME; + /*mb->PMV[0][0][0] = ; + mb->PMV[0][0][1] = ; + mb->PMV[0][1][0] = ; + mb->PMV[0][1][1] = ; + mb->PMV[1][0][0] = ; + mb->PMV[1][0][1] = ; + mb->PMV[1][1][0] = ; + mb->PMV[1][1][1] = ;*/ + mb->index = (mby * INPUT_WIDTH_IN_MACROBLOCKS + mbx) * BLOCKS_PER_MACROBLOCK; + mb->coded_block_pattern = 0x3F; + + mb++; + + for (by = 0; by < MACROBLOCK_HEIGHT_IN_BLOCKS; ++by) + for (bx = 0; bx < MACROBLOCK_WIDTH_IN_BLOCKS; ++bx) + { + const int start = 16, stop = 235, range = stop - start; + + Gradient + ( + blocks, + (short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH) / (float)(INPUT_WIDTH - 1))), + (short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH + BLOCK_WIDTH - 1) / (float)(INPUT_WIDTH - 1))), + 1 + ); + + blocks += BLOCK_SIZE; + } + + for (by = 0; by < MACROBLOCK_HEIGHT_IN_BLOCKS / 2; ++by) + for (bx = 0; bx < MACROBLOCK_WIDTH_IN_BLOCKS / 2; ++bx) + { + const int start = 16, stop = 240, range = stop - start; + + Gradient + ( + blocks, + (short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH) / (float)(INPUT_WIDTH - 1))), + (short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH + BLOCK_WIDTH - 1) / (float)(INPUT_WIDTH - 1))), + 1 + ); + + blocks += BLOCK_SIZE; + + Gradient + ( + blocks, + (short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH) / (float)(INPUT_WIDTH - 1))), + (short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH + BLOCK_WIDTH - 1) / (float)(INPUT_WIDTH - 1))), + 1 + ); + + blocks += BLOCK_SIZE; + } + } + + XSelectInput(display, window, ExposureMask | KeyPressMask); + XMapWindow(display, window); + XSync(display, 0); + + /* Test NULL context */ + assert(XvMCRenderSurface(display, NULL, XVMC_FRAME_PICTURE, &surface, NULL, NULL, 0, NUM_MACROBLOCKS, 0, &mb_array, &block_array) == XvMCBadContext); + /* Test NULL surface */ + assert(XvMCRenderSurface(display, &context, XVMC_FRAME_PICTURE, NULL, NULL, NULL, 0, NUM_MACROBLOCKS, 0, &mb_array, &block_array) == XvMCBadSurface); + /* Test bad picture structure */ + assert(XvMCRenderSurface(display, &context, 0, &surface, NULL, NULL, 0, NUM_MACROBLOCKS, 0, &mb_array, &block_array) == BadValue); + /* Test valid params */ + assert(XvMCRenderSurface(display, &context, XVMC_FRAME_PICTURE, &surface, NULL, NULL, 0, NUM_MACROBLOCKS, 0, &mb_array, &block_array) == Success); + + /* Test NULL surface */ + assert(XvMCPutSurface(display, NULL, window, 0, 0, INPUT_WIDTH, INPUT_HEIGHT, 0, 0, output_width, output_height, XVMC_FRAME_PICTURE) == XvMCBadSurface); + /* Test bad window */ + /* XXX: X halts with a bad drawable for some reason, doesn't return BadDrawable as expected */ + /*assert(XvMCPutSurface(display, &surface, 0, 0, 0, width, height, 0, 0, width, height, XVMC_FRAME_PICTURE) == BadDrawable);*/ + + if (prompt) + { + puts("Press any button to quit..."); + + while (!quit) + { + if (XPending(display) > 0) + { + XEvent event; + + XNextEvent(display, &event); + + switch (event.type) + { + case Expose: + { + /* Test valid params */ + assert + ( + XvMCPutSurface + ( + display, &surface, window, + 0, 0, INPUT_WIDTH, INPUT_HEIGHT, + 0, 0, output_width, output_height, + XVMC_FRAME_PICTURE + ) == Success + ); + break; + } + case KeyPress: + { + quit = 1; + break; + } + } + } + } + } + + assert(XvMCDestroyBlocks(display, &block_array) == Success); + assert(XvMCDestroyMacroBlocks(display, &mb_array) == Success); + assert(XvMCDestroySurface(display, &surface) == Success); + assert(XvMCDestroyContext(display, &context) == Success); + + XvUngrabPort(display, port_num, CurrentTime); + XDestroyWindow(display, window); + XCloseDisplay(display); + + return 0; +} diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/test_surface.c b/src/gallium/state_trackers/xorg/xvmc/tests/test_surface.c new file mode 100644 index 0000000000..06948201ac --- /dev/null +++ b/src/gallium/state_trackers/xorg/xvmc/tests/test_surface.c @@ -0,0 +1,71 @@ +#include +#include +#include "testlib.h" + +int main(int argc, char **argv) +{ + const unsigned int width = 16, height = 16; + const unsigned int mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2}; + + Display *display; + XvPortID port_num; + int surface_type_id; + unsigned int is_overlay, intra_unsigned; + int colorkey; + XvMCContext context; + XvMCSurface surface = {0}; + + display = XOpenDisplay(NULL); + + if (!GetPort + ( + display, + width, + height, + XVMC_CHROMA_FORMAT_420, + mc_types, + 2, + &port_num, + &surface_type_id, + &is_overlay, + &intra_unsigned + )) + { + XCloseDisplay(display); + error(1, 0, "Error, unable to find a good port.\n"); + } + + if (is_overlay) + { + Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0); + XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey); + } + + assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, XVMC_DIRECT, &context) == Success); + + /* Test NULL context */ + assert(XvMCCreateSurface(display, NULL, &surface) == XvMCBadContext); + /* Test NULL surface */ + assert(XvMCCreateSurface(display, &context, NULL) == XvMCBadSurface); + /* Test valid params */ + assert(XvMCCreateSurface(display, &context, &surface) == Success); + /* Test surface id assigned */ + assert(surface.surface_id != 0); + /* Test context id assigned and correct */ + assert(surface.context_id == context.context_id); + /* Test surface type id assigned and correct */ + assert(surface.surface_type_id == surface_type_id); + /* Test width & height assigned and correct */ + assert(surface.width == width && surface.height == height); + /* Test valid params */ + assert(XvMCDestroySurface(display, &surface) == Success); + /* Test NULL surface */ + assert(XvMCDestroySurface(display, NULL) == XvMCBadSurface); + + assert(XvMCDestroyContext(display, &context) == Success); + + XvUngrabPort(display, port_num, CurrentTime); + XCloseDisplay(display); + + return 0; +} diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/testlib.c b/src/gallium/state_trackers/xorg/xvmc/tests/testlib.c new file mode 100644 index 0000000000..59a03ca813 --- /dev/null +++ b/src/gallium/state_trackers/xorg/xvmc/tests/testlib.c @@ -0,0 +1,119 @@ +#include "testlib.h" +#include + +/* +void test(int pred, const char *pred_string, const char *doc_string, const char *file, unsigned int line) +{ + fputs(doc_string, stderr); + if (!pred) + fprintf(stderr, " FAIL!\n\t\"%s\" at %s:%u\n", pred_string, file, line); + else + fputs(" PASS!\n", stderr); +} +*/ + +int GetPort +( + Display *display, + unsigned int width, + unsigned int height, + unsigned int chroma_format, + const unsigned int *mc_types, + unsigned int num_mc_types, + XvPortID *port_id, + int *surface_type_id, + unsigned int *is_overlay, + unsigned int *intra_unsigned +) +{ + unsigned int found_port = 0; + XvAdaptorInfo *adaptor_info; + unsigned int num_adaptors; + int num_types; + int ev_base, err_base; + unsigned int i, j, k, l; + + if (!XvMCQueryExtension(display, &ev_base, &err_base)) + return 0; + if (XvQueryAdaptors(display, XDefaultRootWindow(display), &num_adaptors, &adaptor_info) != Success) + return 0; + + for (i = 0; i < num_adaptors && !found_port; ++i) + { + if (adaptor_info[i].type & XvImageMask) + { + XvMCSurfaceInfo *surface_info = XvMCListSurfaceTypes(display, adaptor_info[i].base_id, &num_types); + + if (surface_info) + { + for (j = 0; j < num_types && !found_port; ++j) + { + if + ( + surface_info[j].chroma_format == chroma_format && + surface_info[j].max_width >= width && + surface_info[j].max_height >= height + ) + { + for (k = 0; k < num_mc_types && !found_port; ++k) + { + if (surface_info[j].mc_type == mc_types[k]) + { + for (l = 0; l < adaptor_info[i].num_ports && !found_port; ++l) + { + if (XvGrabPort(display, adaptor_info[i].base_id + l, CurrentTime) == Success) + { + *port_id = adaptor_info[i].base_id + l; + *surface_type_id = surface_info[j].surface_type_id; + *is_overlay = surface_info[j].flags & XVMC_OVERLAID_SURFACE; + *intra_unsigned = surface_info[j].flags & XVMC_INTRA_UNSIGNED; + found_port = 1; + } + } + } + } + } + } + + XFree(surface_info); + } + } + } + + XvFreeAdaptorInfo(adaptor_info); + + return found_port; +} + +unsigned int align(unsigned int value, unsigned int alignment) +{ + return (value + alignment - 1) & ~(alignment - 1); +} + +/* From the glibc manual */ +int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y) +{ + /* Perform the carry for the later subtraction by updating y. */ + if (x->tv_usec < y->tv_usec) + { + int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1; + y->tv_usec -= 1000000 * nsec; + y->tv_sec += nsec; + } + if (x->tv_usec - y->tv_usec > 1000000) + { + int nsec = (x->tv_usec - y->tv_usec) / 1000000; + y->tv_usec += 1000000 * nsec; + y->tv_sec -= nsec; + } + + /* + * Compute the time remaining to wait. + * tv_usec is certainly positive. + */ + result->tv_sec = x->tv_sec - y->tv_sec; + result->tv_usec = x->tv_usec - y->tv_usec; + + /* Return 1 if result is negative. */ + return x->tv_sec < y->tv_sec; +} diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/testlib.h b/src/gallium/state_trackers/xorg/xvmc/tests/testlib.h new file mode 100644 index 0000000000..af71ad74e1 --- /dev/null +++ b/src/gallium/state_trackers/xorg/xvmc/tests/testlib.h @@ -0,0 +1,42 @@ +#ifndef testlib_h +#define testlib_h + +/* +#define TEST(pred, doc) test(pred, #pred, doc, __FILE__, __LINE__) + +void test(int pred, const char *pred_string, const char *doc_string, const char *file, unsigned int line); +*/ + +#include +#include +#include + +/* + * display: IN A valid X display + * width, height: IN Surface size that the port must display + * chroma_format: IN Chroma format that the port must display + * mc_types, num_mc_types: IN List of MC types that the port must support, first port that matches the first mc_type will be returned + * port_id: OUT Your port's ID + * surface_type_id: OUT Your port's surface ID + * is_overlay: OUT If 1, port uses overlay surfaces, you need to set a colorkey + * intra_unsigned: OUT If 1, port uses unsigned values for intra-coded blocks + */ +int GetPort +( + Display *display, + unsigned int width, + unsigned int height, + unsigned int chroma_format, + const unsigned int *mc_types, + unsigned int num_mc_types, + XvPortID *port_id, + int *surface_type_id, + unsigned int *is_overlay, + unsigned int *intra_unsigned +); + +unsigned int align(unsigned int value, unsigned int alignment); + +int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y); + +#endif diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/xvmc_bench.c b/src/gallium/state_trackers/xorg/xvmc/tests/xvmc_bench.c new file mode 100644 index 0000000000..97adcfc58a --- /dev/null +++ b/src/gallium/state_trackers/xorg/xvmc/tests/xvmc_bench.c @@ -0,0 +1,273 @@ +#include +#include +#include +#include +#include +#include "testlib.h" + +#define MACROBLOCK_WIDTH 16 +#define MACROBLOCK_HEIGHT 16 +#define BLOCKS_PER_MACROBLOCK 6 + +#define DEFAULT_INPUT_WIDTH 720 +#define DEFAULT_INPUT_HEIGHT 480 +#define DEFAULT_REPS 100 + +#define PIPELINE_STEP_MC 1 +#define PIPELINE_STEP_CSC 2 +#define PIPELINE_STEP_SWAP 4 + +#define MB_TYPE_I 1 +#define MB_TYPE_P 2 +#define MB_TYPE_B 4 + +struct Config +{ + unsigned int input_width; + unsigned int input_height; + unsigned int output_width; + unsigned int output_height; + unsigned int pipeline; + unsigned int mb_types; + unsigned int reps; +}; + +void ParseArgs(int argc, char **argv, struct Config *config); + +void ParseArgs(int argc, char **argv, struct Config *config) +{ + int fail = 0; + int i; + + config->input_width = DEFAULT_INPUT_WIDTH; + config->input_height = DEFAULT_INPUT_HEIGHT; + config->output_width = 0; + config->output_height = 0; + config->pipeline = 0; + config->mb_types = 0; + config->reps = DEFAULT_REPS; + + for (i = 1; i < argc && !fail; ++i) + { + if (!strcmp(argv[i], "-iw")) + { + if (sscanf(argv[++i], "%u", &config->input_width) != 1) + fail = 1; + } + else if (!strcmp(argv[i], "-ih")) + { + if (sscanf(argv[++i], "%u", &config->input_height) != 1) + fail = 1; + } + else if (!strcmp(argv[i], "-ow")) + { + if (sscanf(argv[++i], "%u", &config->output_width) != 1) + fail = 1; + } + else if (!strcmp(argv[i], "-oh")) + { + if (sscanf(argv[++i], "%u", &config->output_height) != 1) + fail = 1; + } + else if (!strcmp(argv[i], "-p")) + { + char *token = strtok(argv[++i], ","); + + while (token && !fail) + { + if (!strcmp(token, "mc")) + config->pipeline |= PIPELINE_STEP_MC; + else if (!strcmp(token, "csc")) + config->pipeline |= PIPELINE_STEP_CSC; + else if (!strcmp(token, "swp")) + config->pipeline |= PIPELINE_STEP_SWAP; + else + fail = 1; + + if (!fail) + token = strtok(NULL, ","); + } + } + else if (!strcmp(argv[i], "-mb")) + { + char *token = strtok(argv[++i], ","); + + while (token && !fail) + { + if (strcmp(token, "i")) + config->mb_types |= MB_TYPE_I; + else if (strcmp(token, "p")) + config->mb_types |= MB_TYPE_P; + else if (strcmp(token, "b")) + config->mb_types |= MB_TYPE_B; + else + fail = 1; + + if (!fail) + token = strtok(NULL, ","); + } + } + else if (!strcmp(argv[i], "-r")) + { + if (sscanf(argv[++i], "%u", &config->reps) != 1) + fail = 1; + } + else + fail = 1; + } + + if (fail) + error + ( + 1, 0, + "Bad argument.\n" + "\n" + "Usage: %s [options]\n" + "\t-iw \tInput width\n" + "\t-ih \tInput height\n" + "\t-ow \tOutput width\n" + "\t-oh \tOutput height\n" + "\t-p \tPipeline to test\n" + "\t-mb \tMacroBlock types to use\n" + "\t-r \tRepetitions\n\n" + "\tPipeline steps: mc,csc,swap\n" + "\tMB types: i,p,b\n", + argv[0] + ); + + if (config->output_width == 0) + config->output_width = config->input_width; + if (config->output_height == 0) + config->output_height = config->input_height; + if (!config->pipeline) + config->pipeline = PIPELINE_STEP_MC | PIPELINE_STEP_CSC | PIPELINE_STEP_SWAP; + if (!config->mb_types) + config->mb_types = MB_TYPE_I | MB_TYPE_P | MB_TYPE_B; +} + +int main(int argc, char **argv) +{ + struct Config config; + Display *display; + Window root, window; + const unsigned int mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2}; + XvPortID port_num; + int surface_type_id; + unsigned int is_overlay, intra_unsigned; + int colorkey; + XvMCContext context; + XvMCSurface surface; + XvMCBlockArray block_array; + XvMCMacroBlockArray mb_array; + unsigned int mbw, mbh; + unsigned int mbx, mby; + unsigned int reps; + struct timeval start, stop, diff; + double diff_secs; + + ParseArgs(argc, argv, &config); + + mbw = align(config.input_width, MACROBLOCK_WIDTH) / MACROBLOCK_WIDTH; + mbh = align(config.input_height, MACROBLOCK_HEIGHT) / MACROBLOCK_HEIGHT; + + display = XOpenDisplay(NULL); + + if (!GetPort + ( + display, + config.input_width, + config.input_height, + XVMC_CHROMA_FORMAT_420, + mc_types, + 2, + &port_num, + &surface_type_id, + &is_overlay, + &intra_unsigned + )) + { + XCloseDisplay(display); + error(1, 0, "Error, unable to find a good port.\n"); + } + + if (is_overlay) + { + Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0); + XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey); + } + + root = XDefaultRootWindow(display); + window = XCreateSimpleWindow(display, root, 0, 0, config.output_width, config.output_height, 0, 0, colorkey); + + assert(XvMCCreateContext(display, port_num, surface_type_id, config.input_width, config.input_height, XVMC_DIRECT, &context) == Success); + assert(XvMCCreateSurface(display, &context, &surface) == Success); + assert(XvMCCreateBlocks(display, &context, mbw * mbh * BLOCKS_PER_MACROBLOCK, &block_array) == Success); + assert(XvMCCreateMacroBlocks(display, &context, mbw * mbh, &mb_array) == Success); + + for (mby = 0; mby < mbh; ++mby) + for (mbx = 0; mbx < mbw; ++mbx) + { + mb_array.macro_blocks[mby * mbw + mbx].x = mbx; + mb_array.macro_blocks[mby * mbw + mbx].y = mby; + mb_array.macro_blocks[mby * mbw + mbx].macroblock_type = XVMC_MB_TYPE_INTRA; + /*mb->motion_type = ;*/ + /*mb->motion_vertical_field_select = ;*/ + mb_array.macro_blocks[mby * mbw + mbx].dct_type = XVMC_DCT_TYPE_FRAME; + /*mb->PMV[0][0][0] = ; + mb->PMV[0][0][1] = ; + mb->PMV[0][1][0] = ; + mb->PMV[0][1][1] = ; + mb->PMV[1][0][0] = ; + mb->PMV[1][0][1] = ; + mb->PMV[1][1][0] = ; + mb->PMV[1][1][1] = ;*/ + mb_array.macro_blocks[mby * mbw + mbx].index = (mby * mbw + mbx) * BLOCKS_PER_MACROBLOCK; + mb_array.macro_blocks[mby * mbw + mbx].coded_block_pattern = 0x3F; + } + + XSelectInput(display, window, ExposureMask | KeyPressMask); + XMapWindow(display, window); + XSync(display, 0); + + gettimeofday(&start, NULL); + + for (reps = 0; reps < config.reps; ++reps) + { + if (config.pipeline & PIPELINE_STEP_MC) + { + assert(XvMCRenderSurface(display, &context, XVMC_FRAME_PICTURE, &surface, NULL, NULL, 0, mbw * mbh, 0, &mb_array, &block_array) == Success); + assert(XvMCFlushSurface(display, &surface) == Success); + } + if (config.pipeline & PIPELINE_STEP_CSC) + assert(XvMCPutSurface(display, &surface, window, 0, 0, config.input_width, config.input_height, 0, 0, config.output_width, config.output_height, XVMC_FRAME_PICTURE) == Success); + } + + gettimeofday(&stop, NULL); + + timeval_subtract(&diff, &stop, &start); + diff_secs = (double)diff.tv_sec + (double)diff.tv_usec / 1000000.0; + + printf("XvMC Benchmark\n"); + printf("Input: %u,%u\nOutput: %u,%u\n", config.input_width, config.input_height, config.output_width, config.output_height); + printf("Pipeline: "); + if (config.pipeline & PIPELINE_STEP_MC) + printf("|mc|"); + if (config.pipeline & PIPELINE_STEP_CSC) + printf("|csc|"); + if (config.pipeline & PIPELINE_STEP_SWAP) + printf("|swap|"); + printf("\n"); + printf("Reps: %u\n", config.reps); + printf("Total time: %.2lf (%.2lf reps / sec)\n", diff_secs, config.reps / diff_secs); + + assert(XvMCDestroyBlocks(display, &block_array) == Success); + assert(XvMCDestroyMacroBlocks(display, &mb_array) == Success); + assert(XvMCDestroySurface(display, &surface) == Success); + assert(XvMCDestroyContext(display, &context) == Success); + + XvUngrabPort(display, port_num, CurrentTime); + XDestroyWindow(display, window); + XCloseDisplay(display); + + return 0; +} diff --git a/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h b/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h new file mode 100644 index 0000000000..1e3dd561c6 --- /dev/null +++ b/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h @@ -0,0 +1,31 @@ +#ifndef xvmc_private_h +#define xvmc_private_h + +#include +#include + +#define BLOCK_SIZE_SAMPLES 64 +#define BLOCK_SIZE_BYTES (BLOCK_SIZE_SAMPLES * 2) + +struct pipe_video_context; +struct pipe_surface; +struct pipe_fence_handle; + +typedef struct +{ + struct pipe_video_context *vpipe; + struct pipe_surface *backbuffer; +} XvMCContextPrivate; + +typedef struct +{ + struct pipe_video_surface *pipe_vsfc; + struct pipe_fence_handle *render_fence; + struct pipe_fence_handle *disp_fence; + + /* Some XvMC functions take a surface but not a context, + so we keep track of which context each surface belongs to. */ + XvMCContext *context; +} XvMCSurfacePrivate; + +#endif /* xvmc_private_h */ diff --git a/src/gallium/winsys/g3dvl/xlib/Makefile b/src/gallium/winsys/g3dvl/xlib/Makefile index d4cbf0e2bb..cf765ef51a 100644 --- a/src/gallium/winsys/g3dvl/xlib/Makefile +++ b/src/gallium/winsys/g3dvl/xlib/Makefile @@ -20,9 +20,9 @@ DEFINES += -DGALLIUM_SOFTPIPE \ SOURCES = xsp_winsys.c -# XXX: Hack, if we include libXvMCapi.a in LIBS none of the symbols are +# XXX: Hack, if we include libxvmctracker.a in LIBS none of the symbols are # pulled in by the linker because xsp_winsys.c doesn't refer to them -OBJECTS = $(SOURCES:.c=.o) $(TOP)/src/xvmc/*.o +OBJECTS = $(SOURCES:.c=.o) $(TOP)/src/gallium/state_trackers/xorg/xvmc/*.o LIBS = $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ $(TOP)/src/gallium/auxiliary/vl/libvl.a \ diff --git a/src/xvmc/Makefile b/src/xvmc/Makefile deleted file mode 100644 index e7636e65c6..0000000000 --- a/src/xvmc/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -TOP = ../.. -include $(TOP)/configs/current - -#DEFINES += -DDEFAULT_DRIVER_DIR=\"$(DRI_DRIVER_SEARCH_DIR)\" - -SOURCES = block.c \ - surface.c \ - context.c \ - subpicture.c \ - attributes.c - -OBJECTS = $(SOURCES:.c=.o) - -INCLUDES = -I$(TOP)/src/gallium/include \ - -I$(TOP)/src/gallium/auxiliary \ - -I$(TOP)/src/gallium/winsys/g3dvl - -##### RULES ##### - -.c.o: - $(CC) -c $(INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@ - -.S.o: - $(CC) -c $(INCLUDES) $(DEFINES) $(CFLAGS) $< -o $@ - -##### TARGETS ##### - -.PHONY: default clean - -default: depend libXvMCapi.a - -libXvMCapi.a: $(OBJECTS) Makefile - $(MKLIB) -o XvMCapi $(MKLIB_OPTIONS) -static $(OBJECTS) - -depend: $(SOURCES) Makefile - $(RM) depend - touch depend - $(MKDEP) $(MKDEP_OPTIONS) $(DEFINES) $(INCLUDES) $(SOURCES) - -clean: Makefile - $(RM) libXvMCapi.a - $(RM) *.o *~ - $(RM) depend depend.bak - --include depend diff --git a/src/xvmc/SConscript b/src/xvmc/SConscript deleted file mode 100644 index 53e04183e4..0000000000 --- a/src/xvmc/SConscript +++ /dev/null @@ -1,21 +0,0 @@ -Import('*') - -if env['platform'] not in ['linux']: - Return() - -env = env.Clone() - -env.AppendUnique(CPPPATH = [ - '#/src/gallium/winsys/g3dvl', -]) - -XvMCapi = env.StaticLibrary( - target = 'XvMCapi', - source = [ - 'block.c', - 'surface.c', - 'context.c', - 'subpicture.c', - 'attributes.c', - ], -) diff --git a/src/xvmc/attributes.c b/src/xvmc/attributes.c deleted file mode 100644 index 638da0b577..0000000000 --- a/src/xvmc/attributes.c +++ /dev/null @@ -1,19 +0,0 @@ -#include -#include -#include -#include - -XvAttribute* XvMCQueryAttributes(Display *dpy, XvMCContext *context, int *number) -{ - return NULL; -} - -Status XvMCSetAttribute(Display *dpy, XvMCContext *context, Atom attribute, int value) -{ - return BadImplementation; -} - -Status XvMCGetAttribute(Display *dpy, XvMCContext *context, Atom attribute, int *value) -{ - return BadImplementation; -} diff --git a/src/xvmc/block.c b/src/xvmc/block.c deleted file mode 100644 index 78fddfb79e..0000000000 --- a/src/xvmc/block.c +++ /dev/null @@ -1,61 +0,0 @@ -#include -#include -#include -#include -#include "xvmc_private.h" - -Status XvMCCreateBlocks(Display *dpy, XvMCContext *context, unsigned int num_blocks, XvMCBlockArray *blocks) -{ - assert(dpy); - - if (!context) - return XvMCBadContext; - if (num_blocks == 0) - return BadValue; - - assert(blocks); - - blocks->context_id = context->context_id; - blocks->num_blocks = num_blocks; - blocks->blocks = MALLOC(BLOCK_SIZE_BYTES * num_blocks); - blocks->privData = NULL; - - return Success; -} - -Status XvMCDestroyBlocks(Display *dpy, XvMCBlockArray *blocks) -{ - assert(dpy); - assert(blocks); - FREE(blocks->blocks); - - return Success; -} - -Status XvMCCreateMacroBlocks(Display *dpy, XvMCContext *context, unsigned int num_blocks, XvMCMacroBlockArray *blocks) -{ - assert(dpy); - - if (!context) - return XvMCBadContext; - if (num_blocks == 0) - return BadValue; - - assert(blocks); - - blocks->context_id = context->context_id; - blocks->num_blocks = num_blocks; - blocks->macro_blocks = MALLOC(sizeof(XvMCMacroBlock) * num_blocks); - blocks->privData = NULL; - - return Success; -} - -Status XvMCDestroyMacroBlocks(Display *dpy, XvMCMacroBlockArray *blocks) -{ - assert(dpy); - assert(blocks); - FREE(blocks->macro_blocks); - - return Success; -} diff --git a/src/xvmc/context.c b/src/xvmc/context.c deleted file mode 100644 index 33f47838f5..0000000000 --- a/src/xvmc/context.c +++ /dev/null @@ -1,203 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "xvmc_private.h" - -static Status Validate(Display *dpy, XvPortID port, int surface_type_id, - unsigned int width, unsigned int height, int flags, - bool *found_port, int *screen, int *chroma_format, int *mc_type) -{ - bool found_surface = false; - XvAdaptorInfo *adaptor_info; - unsigned int num_adaptors; - int num_types; - unsigned int max_width, max_height; - Status ret; - - assert(dpy); - assert(found_port); - assert(screen); - assert(chroma_format); - assert(mc_type); - - *found_port = false; - - for (unsigned int i = 0; i < XScreenCount(dpy); ++i) - { - ret = XvQueryAdaptors(dpy, XRootWindow(dpy, i), &num_adaptors, &adaptor_info); - if (ret != Success) - return ret; - - for (unsigned int j = 0; j < num_adaptors && !*found_port; ++j) - { - for (unsigned int k = 0; k < adaptor_info[j].num_ports && !*found_port; ++k) - { - XvMCSurfaceInfo *surface_info; - - if (adaptor_info[j].base_id + k != port) - continue; - - *found_port = true; - - surface_info = XvMCListSurfaceTypes(dpy, adaptor_info[j].base_id, &num_types); - if (!surface_info) - { - XvFreeAdaptorInfo(adaptor_info); - return BadAlloc; - } - - for (unsigned int l = 0; l < num_types && !found_surface; ++l) - { - if (surface_info[l].surface_type_id != surface_type_id) - continue; - - found_surface = true; - max_width = surface_info[l].max_width; - max_height = surface_info[l].max_height; - *chroma_format = surface_info[l].chroma_format; - *mc_type = surface_info[l].mc_type; - *screen = i; - } - - XFree(surface_info); - } - } - - XvFreeAdaptorInfo(adaptor_info); - } - - if (!*found_port) - return XvBadPort; - if (!found_surface) - return BadMatch; - if (width > max_width || height > max_height) - return BadValue; - if (flags != XVMC_DIRECT && flags != 0) - return BadValue; - - return Success; -} - -static enum pipe_video_profile ProfileToPipe(int xvmc_profile) -{ - if (xvmc_profile & XVMC_MPEG_1) - assert(0); - if (xvmc_profile & XVMC_MPEG_2) - return PIPE_VIDEO_PROFILE_MPEG2_MAIN; - if (xvmc_profile & XVMC_H263) - assert(0); - if (xvmc_profile & XVMC_MPEG_4) - assert(0); - - assert(0); - - return -1; -} - -static enum pipe_video_chroma_format FormatToPipe(int xvmc_format) -{ - switch (xvmc_format) - { - case XVMC_CHROMA_FORMAT_420: - return PIPE_VIDEO_CHROMA_FORMAT_420; - case XVMC_CHROMA_FORMAT_422: - return PIPE_VIDEO_CHROMA_FORMAT_422; - case XVMC_CHROMA_FORMAT_444: - return PIPE_VIDEO_CHROMA_FORMAT_444; - default: - assert(0); - } - - return -1; -} - -Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id, - int width, int height, int flags, XvMCContext *context) -{ - bool found_port; - int scrn; - int chroma_format; - int mc_type; - Status ret; - struct pipe_screen *screen; - struct pipe_video_context *vpipe; - XvMCContextPrivate *context_priv; - - assert(dpy); - - if (!context) - return XvMCBadContext; - - ret = Validate(dpy, port, surface_type_id, width, height, flags, - &found_port, &scrn, &chroma_format, &mc_type); - - /* Success and XvBadPort have the same value */ - if (ret != Success || !found_port) - return ret; - - context_priv = CALLOC(1, sizeof(XvMCContextPrivate)); - if (!context_priv) - return BadAlloc; - - /* TODO: Reuse screen if process creates another context */ - screen = vl_screen_create(dpy, scrn); - - if (!screen) - { - FREE(context_priv); - return BadAlloc; - } - - vpipe = vl_video_create(screen, ProfileToPipe(mc_type), - FormatToPipe(chroma_format), width, height); - - if (!vpipe) - { - screen->destroy(screen); - FREE(context_priv); - return BadAlloc; - } - - context_priv->vpipe = vpipe; - - context->context_id = XAllocID(dpy); - context->surface_type_id = surface_type_id; - context->width = width; - context->height = height; - context->flags = flags; - context->port = port; - context->privData = context_priv; - - SyncHandle(); - - return Success; -} - -Status XvMCDestroyContext(Display *dpy, XvMCContext *context) -{ - struct pipe_screen *screen; - struct pipe_video_context *vpipe; - XvMCContextPrivate *context_priv; - - assert(dpy); - - if (!context || !context->privData) - return XvMCBadContext; - - context_priv = context->privData; - vpipe = context_priv->vpipe; - pipe_surface_reference(&context_priv->backbuffer, NULL); - screen = vpipe->screen; - vpipe->destroy(vpipe); - screen->destroy(screen); - FREE(context_priv); - context->privData = NULL; - - return Success; -} diff --git a/src/xvmc/subpicture.c b/src/xvmc/subpicture.c deleted file mode 100644 index 78ba618f5a..0000000000 --- a/src/xvmc/subpicture.c +++ /dev/null @@ -1,168 +0,0 @@ -#include -#include -#include - -Status XvMCCreateSubpicture(Display *dpy, XvMCContext *context, XvMCSubpicture *subpicture, - unsigned short width, unsigned short height, int xvimage_id) -{ - assert(dpy); - - if (!context) - return XvMCBadContext; - - assert(subpicture); - - /*if (width > || height > ) - return BadValue;*/ - - /*if (xvimage_id != ) - return BadMatch;*/ - - subpicture->subpicture_id = XAllocID(dpy); - subpicture->context_id = context->context_id; - subpicture->xvimage_id = xvimage_id; - subpicture->width = width; - subpicture->height = height; - subpicture->num_palette_entries = 0; - subpicture->entry_bytes = 0; - subpicture->component_order[0] = 0; - subpicture->component_order[1] = 0; - subpicture->component_order[2] = 0; - subpicture->component_order[3] = 0; - /* TODO: subpicture->privData = ;*/ - - SyncHandle(); - - return Success; -} - -Status XvMCClearSubpicture(Display *dpy, XvMCSubpicture *subpicture, short x, short y, - unsigned short width, unsigned short height, unsigned int color) -{ - assert(dpy); - - if (!subpicture) - return XvMCBadSubpicture; - - /* TODO: Assert clear rect is within bounds? Or clip? */ - - return Success; -} - -Status XvMCCompositeSubpicture(Display *dpy, XvMCSubpicture *subpicture, XvImage *image, - short srcx, short srcy, unsigned short width, unsigned short height, - short dstx, short dsty) -{ - assert(dpy); - - if (!subpicture) - return XvMCBadSubpicture; - - assert(image); - - if (subpicture->xvimage_id != image->id) - return BadMatch; - - /* TODO: Assert rects are within bounds? Or clip? */ - - return Success; -} - -Status XvMCDestroySubpicture(Display *dpy, XvMCSubpicture *subpicture) -{ - assert(dpy); - - if (!subpicture) - return XvMCBadSubpicture; - - return BadImplementation; -} - -Status XvMCSetSubpicturePalette(Display *dpy, XvMCSubpicture *subpicture, unsigned char *palette) -{ - assert(dpy); - - if (!subpicture) - return XvMCBadSubpicture; - - assert(palette); - - /* We don't support paletted subpictures */ - return BadMatch; -} - -Status XvMCBlendSubpicture(Display *dpy, XvMCSurface *target_surface, XvMCSubpicture *subpicture, - short subx, short suby, unsigned short subw, unsigned short subh, - short surfx, short surfy, unsigned short surfw, unsigned short surfh) -{ - assert(dpy); - - if (!target_surface) - return XvMCBadSurface; - - if (!subpicture) - return XvMCBadSubpicture; - - if (target_surface->context_id != subpicture->context_id) - return BadMatch; - - /* TODO: Assert rects are within bounds? Or clip? */ - return Success; -} - -Status XvMCBlendSubpicture2(Display *dpy, XvMCSurface *source_surface, XvMCSurface *target_surface, - XvMCSubpicture *subpicture, short subx, short suby, unsigned short subw, unsigned short subh, - short surfx, short surfy, unsigned short surfw, unsigned short surfh) -{ - assert(dpy); - - if (!source_surface || !target_surface) - return XvMCBadSurface; - - if (!subpicture) - return XvMCBadSubpicture; - - if (source_surface->context_id != subpicture->context_id) - return BadMatch; - - if (source_surface->context_id != subpicture->context_id) - return BadMatch; - - /* TODO: Assert rects are within bounds? Or clip? */ - return Success; -} - -Status XvMCSyncSubpicture(Display *dpy, XvMCSubpicture *subpicture) -{ - assert(dpy); - - if (!subpicture) - return XvMCBadSubpicture; - - return Success; -} - -Status XvMCFlushSubpicture(Display *dpy, XvMCSubpicture *subpicture) -{ - assert(dpy); - - if (!subpicture) - return XvMCBadSubpicture; - - return Success; -} - -Status XvMCGetSubpictureStatus(Display *dpy, XvMCSubpicture *subpicture, int *status) -{ - assert(dpy); - - if (!subpicture) - return XvMCBadSubpicture; - - assert(status); - - /* TODO */ - *status = 0; - - return Success; -} diff --git a/src/xvmc/surface.c b/src/xvmc/surface.c deleted file mode 100644 index 0467c4d07d..0000000000 --- a/src/xvmc/surface.c +++ /dev/null @@ -1,429 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "xvmc_private.h" - -static enum pipe_mpeg12_macroblock_type TypeToPipe(int xvmc_mb_type) -{ - if (xvmc_mb_type & XVMC_MB_TYPE_INTRA) - return PIPE_MPEG12_MACROBLOCK_TYPE_INTRA; - if ((xvmc_mb_type & (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) == XVMC_MB_TYPE_MOTION_FORWARD) - return PIPE_MPEG12_MACROBLOCK_TYPE_FWD; - if ((xvmc_mb_type & (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) == XVMC_MB_TYPE_MOTION_BACKWARD) - return PIPE_MPEG12_MACROBLOCK_TYPE_BKWD; - if ((xvmc_mb_type & (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) == (XVMC_MB_TYPE_MOTION_FORWARD | XVMC_MB_TYPE_MOTION_BACKWARD)) - return PIPE_MPEG12_MACROBLOCK_TYPE_BI; - - assert(0); - - return -1; -} - -static enum pipe_mpeg12_picture_type PictureToPipe(int xvmc_pic) -{ - switch (xvmc_pic) - { - case XVMC_TOP_FIELD: - return PIPE_MPEG12_PICTURE_TYPE_FIELD_TOP; - case XVMC_BOTTOM_FIELD: - return PIPE_MPEG12_PICTURE_TYPE_FIELD_BOTTOM; - case XVMC_FRAME_PICTURE: - return PIPE_MPEG12_PICTURE_TYPE_FRAME; - default: - assert(0); - } - - return -1; -} - -static enum pipe_mpeg12_motion_type MotionToPipe(int xvmc_motion_type, int xvmc_dct_type) -{ - switch (xvmc_motion_type) - { - case XVMC_PREDICTION_FRAME: - return xvmc_dct_type == XVMC_DCT_TYPE_FIELD ? - PIPE_MPEG12_MOTION_TYPE_16x8 : PIPE_MPEG12_MOTION_TYPE_FRAME; - case XVMC_PREDICTION_FIELD: - return PIPE_MPEG12_MOTION_TYPE_FIELD; - case XVMC_PREDICTION_DUAL_PRIME: - return PIPE_MPEG12_MOTION_TYPE_DUALPRIME; - default: - assert(0); - } - - return -1; -} - -static bool -CreateOrResizeBackBuffer(struct pipe_video_context *vpipe, unsigned int width, unsigned int height, - struct pipe_surface **backbuffer) -{ - struct pipe_texture template; - struct pipe_texture *tex; - - assert(vpipe); - - if (*backbuffer) - { - if ((*backbuffer)->width != width || (*backbuffer)->height != height) - pipe_surface_reference(backbuffer, NULL); - else - return true; - } - - memset(&template, 0, sizeof(struct pipe_texture)); - template.target = PIPE_TEXTURE_2D; - /* XXX: Needs to match the drawable's format? */ - template.format = PIPE_FORMAT_X8R8G8B8_UNORM; - template.last_level = 0; - template.width[0] = width; - template.height[0] = height; - template.depth[0] = 1; - pf_get_block(template.format, &template.block); - template.tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET; - - tex = vpipe->screen->texture_create(vpipe->screen, &template); - if (!tex) - return false; - - *backbuffer = vpipe->screen->get_tex_surface(vpipe->screen, tex, 0, 0, 0, - PIPE_BUFFER_USAGE_GPU_READ | - PIPE_BUFFER_USAGE_GPU_WRITE); - pipe_texture_reference(&tex, NULL); - - if (!*backbuffer) - return false; - - /* Clear the backbuffer in case the video doesn't cover the whole window */ - /* FIXME: Need to clear every time a frame moves and leaves dirty rects */ - vpipe->clear_surface(vpipe, 0, 0, width, height, 0, *backbuffer); - - return true; -} - -static void -MacroBlocksToPipe(const XvMCMacroBlockArray *xvmc_macroblocks, - const XvMCBlockArray *xvmc_blocks, - unsigned int first_macroblock, - unsigned int num_macroblocks, - struct pipe_mpeg12_macroblock *pipe_macroblocks) -{ - unsigned int i, j, k, l; - XvMCMacroBlock *xvmc_mb; - - assert(xvmc_macroblocks); - assert(xvmc_blocks); - assert(pipe_macroblocks); - assert(num_macroblocks); - - xvmc_mb = xvmc_macroblocks->macro_blocks + first_macroblock; - - for (i = 0; i < num_macroblocks; ++i) - { - pipe_macroblocks->base.codec = PIPE_VIDEO_CODEC_MPEG12; - pipe_macroblocks->mbx = xvmc_mb->x; - pipe_macroblocks->mby = xvmc_mb->y; - pipe_macroblocks->mb_type = TypeToPipe(xvmc_mb->macroblock_type); - if (pipe_macroblocks->mb_type != PIPE_MPEG12_MACROBLOCK_TYPE_INTRA) - pipe_macroblocks->mo_type = MotionToPipe(xvmc_mb->motion_type, xvmc_mb->dct_type); - /* Get rid of Valgrind 'undefined' warnings */ - else - pipe_macroblocks->mo_type = -1; - pipe_macroblocks->dct_type = xvmc_mb->dct_type == XVMC_DCT_TYPE_FIELD ? - PIPE_MPEG12_DCT_TYPE_FIELD : PIPE_MPEG12_DCT_TYPE_FRAME; - - for (j = 0; j < 2; ++j) - for (k = 0; k < 2; ++k) - for (l = 0; l < 2; ++l) - pipe_macroblocks->pmv[j][k][l] = xvmc_mb->PMV[j][k][l]; - - pipe_macroblocks->cbp = xvmc_mb->coded_block_pattern; - pipe_macroblocks->blocks = xvmc_blocks->blocks + xvmc_mb->index * BLOCK_SIZE_SAMPLES; - - ++pipe_macroblocks; - ++xvmc_mb; - } -} - -Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surface) -{ - XvMCContextPrivate *context_priv; - struct pipe_video_context *vpipe; - XvMCSurfacePrivate *surface_priv; - struct pipe_video_surface *vsfc; - - assert(dpy); - - if (!context) - return XvMCBadContext; - if (!surface) - return XvMCBadSurface; - - context_priv = context->privData; - vpipe = context_priv->vpipe; - - surface_priv = CALLOC(1, sizeof(XvMCSurfacePrivate)); - if (!surface_priv) - return BadAlloc; - - vsfc = vpipe->screen->video_surface_create(vpipe->screen, vpipe->chroma_format, - vpipe->width, vpipe->height); - if (!vsfc) - { - FREE(surface_priv); - return BadAlloc; - } - - surface_priv->pipe_vsfc = vsfc; - surface_priv->context = context; - - surface->surface_id = XAllocID(dpy); - surface->context_id = context->context_id; - surface->surface_type_id = context->surface_type_id; - surface->width = context->width; - surface->height = context->height; - surface->privData = surface_priv; - - SyncHandle(); - - return Success; -} - -Status XvMCRenderSurface(Display *dpy, XvMCContext *context, unsigned int picture_structure, - XvMCSurface *target_surface, XvMCSurface *past_surface, XvMCSurface *future_surface, - unsigned int flags, unsigned int num_macroblocks, unsigned int first_macroblock, - XvMCMacroBlockArray *macroblocks, XvMCBlockArray *blocks -) -{ - struct pipe_video_context *vpipe; - struct pipe_surface *t_vsfc; - struct pipe_surface *p_vsfc; - struct pipe_surface *f_vsfc; - XvMCContextPrivate *context_priv; - XvMCSurfacePrivate *target_surface_priv; - XvMCSurfacePrivate *past_surface_priv; - XvMCSurfacePrivate *future_surface_priv; - struct pipe_mpeg12_macroblock pipe_macroblocks[num_macroblocks]; - - assert(dpy); - - if (!context || !context->privData) - return XvMCBadContext; - if (!target_surface || !target_surface->privData) - return XvMCBadSurface; - - if (picture_structure != XVMC_TOP_FIELD && - picture_structure != XVMC_BOTTOM_FIELD && - picture_structure != XVMC_FRAME_PICTURE) - return BadValue; - /* Bkwd pred equivalent to fwd (past && !future) */ - if (future_surface && !past_surface) - return BadMatch; - - assert(context->context_id == target_surface->context_id); - assert(!past_surface || context->context_id == past_surface->context_id); - assert(!future_surface || context->context_id == future_surface->context_id); - - assert(macroblocks); - assert(blocks); - - assert(macroblocks->context_id == context->context_id); - assert(blocks->context_id == context->context_id); - - assert(flags == 0 || flags == XVMC_SECOND_FIELD); - - target_surface_priv = target_surface->privData; - past_surface_priv = past_surface ? past_surface->privData : NULL; - future_surface_priv = future_surface ? future_surface->privData : NULL; - - assert(target_surface_priv->context == context); - assert(!past_surface || past_surface_priv->context == context); - assert(!future_surface || future_surface_priv->context == context); - - context_priv = context->privData; - vpipe = context_priv->vpipe; - - t_vsfc = target_surface_priv->pipe_vsfc; - p_vsfc = past_surface ? past_surface_priv->pipe_vsfc : NULL; - f_vsfc = future_surface ? future_surface_priv->pipe_vsfc : NULL; - - MacroBlocksToPipe(macroblocks, blocks, first_macroblock, - num_macroblocks, pipe_macroblocks); - - vpipe->set_decode_target(vpipe, t_vsfc); - vpipe->decode_macroblocks(vpipe, p_vsfc, f_vsfc, num_macroblocks, - &pipe_macroblocks->base, target_surface_priv->render_fence); - - return Success; -} - -Status XvMCFlushSurface(Display *dpy, XvMCSurface *surface) -{ -#if 0 - struct vlSurface *vl_sfc; - - assert(dpy); - - if (!surface) - return XvMCBadSurface; - - vl_sfc = surface->privData; - - vlSurfaceFlush(vl_sfc); -#endif - return Success; -} - -Status XvMCSyncSurface(Display *dpy, XvMCSurface *surface) -{ -#if 0 - struct vlSurface *vl_sfc; - - assert(dpy); - - if (!surface) - return XvMCBadSurface; - - vl_sfc = surface->privData; - - vlSurfaceSync(vl_sfc); -#endif - return Success; -} - -Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable, - short srcx, short srcy, unsigned short srcw, unsigned short srch, - short destx, short desty, unsigned short destw, unsigned short desth, - int flags) -{ - Window root; - int x, y; - unsigned int width, height; - unsigned int border_width; - unsigned int depth; - struct pipe_video_context *vpipe; - XvMCSurfacePrivate *surface_priv; - XvMCContextPrivate *context_priv; - XvMCContext *context; - struct pipe_video_rect src_rect = {srcx, srcy, srcw, srch}; - struct pipe_video_rect dst_rect = {destx, desty, destw, desth}; - - assert(dpy); - - if (!surface || !surface->privData) - return XvMCBadSurface; - - if (XGetGeometry(dpy, drawable, &root, &x, &y, &width, &height, &border_width, &depth) == BadDrawable) - return BadDrawable; - - assert(flags == XVMC_TOP_FIELD || flags == XVMC_BOTTOM_FIELD || flags == XVMC_FRAME_PICTURE); - assert(srcx + srcw - 1 < surface->width); - assert(srcy + srch - 1 < surface->height); - /* - * Some apps (mplayer) hit these asserts because they call - * this function after the window has been resized by the WM - * but before they've handled the corresponding XEvent and - * know about the new dimensions. The output should be clipped - * until the app updates destw and desth. - */ - /* - assert(destx + destw - 1 < width); - assert(desty + desth - 1 < height); - */ - - surface_priv = surface->privData; - context = surface_priv->context; - context_priv = context->privData; - vpipe = context_priv->vpipe; - - if (!CreateOrResizeBackBuffer(vpipe, width, height, &context_priv->backbuffer)) - return BadAlloc; - - vpipe->render_picture(vpipe, surface_priv->pipe_vsfc, PictureToPipe(flags), &src_rect, - context_priv->backbuffer, &dst_rect, surface_priv->disp_fence); - - vl_video_bind_drawable(vpipe, drawable); - - vpipe->screen->flush_frontbuffer - ( - vpipe->screen, - context_priv->backbuffer, - vpipe->priv - ); - - return Success; -} - -Status XvMCGetSurfaceStatus(Display *dpy, XvMCSurface *surface, int *status) -{ -#if 0 - struct vlSurface *vl_sfc; - enum vlResourceStatus res_status; - - assert(dpy); - - if (!surface) - return XvMCBadSurface; - - assert(status); - - vl_sfc = surface->privData; - - vlSurfaceGetStatus(vl_sfc, &res_status); - - switch (res_status) - { - case vlResourceStatusFree: - { - *status = 0; - break; - } - case vlResourceStatusRendering: - { - *status = XVMC_RENDERING; - break; - } - case vlResourceStatusDisplaying: - { - *status = XVMC_DISPLAYING; - break; - } - default: - assert(0); - } -#endif - *status = 0; - return Success; -} - -Status XvMCDestroySurface(Display *dpy, XvMCSurface *surface) -{ - XvMCSurfacePrivate *surface_priv; - - assert(dpy); - - if (!surface || !surface->privData) - return XvMCBadSurface; - - surface_priv = surface->privData; - pipe_video_surface_reference(&surface_priv->pipe_vsfc, NULL); - FREE(surface_priv); - surface->privData = NULL; - - return Success; -} - -Status XvMCHideSurface(Display *dpy, XvMCSurface *surface) -{ - assert(dpy); - - if (!surface || !surface->privData) - return XvMCBadSurface; - - /* No op, only for overlaid rendering */ - - return Success; -} diff --git a/src/xvmc/tests/.gitignore b/src/xvmc/tests/.gitignore deleted file mode 100644 index e1d2f9023d..0000000000 --- a/src/xvmc/tests/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -test_context -test_surface -test_blocks -test_rendering -xvmc_bench diff --git a/src/xvmc/tests/Makefile b/src/xvmc/tests/Makefile deleted file mode 100644 index 11b2e1a812..0000000000 --- a/src/xvmc/tests/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -TOP = ../../.. -include $(TOP)/configs/current - -LIBS = -lXvMCW -lXvMC -lXv -lX11 - -############################################# - -.PHONY: default clean - -default: test_context test_surface test_blocks test_rendering xvmc_bench - -test_context: test_context.o testlib.o - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) - -test_surface: test_surface.o testlib.o - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) - -test_blocks: test_blocks.o testlib.o - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) - -test_rendering: test_rendering.o testlib.o - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) - -xvmc_bench: xvmc_bench.o testlib.o - $(CC) $(LDFLAGS) -o $@ $^ $(LIBS) - -clean: - $(RM) -rf *.o test_context test_surface test_blocks test_rendering xvmc_bench diff --git a/src/xvmc/tests/test_blocks.c b/src/xvmc/tests/test_blocks.c deleted file mode 100644 index dc80adfa65..0000000000 --- a/src/xvmc/tests/test_blocks.c +++ /dev/null @@ -1,84 +0,0 @@ -#include -#include -#include "testlib.h" - -int main(int argc, char **argv) -{ - const unsigned int width = 16, height = 16; - const unsigned int min_required_blocks = 1, min_required_macroblocks = 1; - const unsigned int mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2}; - - Display *display; - XvPortID port_num; - int surface_type_id; - unsigned int is_overlay, intra_unsigned; - int colorkey; - XvMCContext context; - XvMCSurface surface; - XvMCBlockArray blocks = {0}; - XvMCMacroBlockArray macroblocks = {0}; - - display = XOpenDisplay(NULL); - - if (!GetPort - ( - display, - width, - height, - XVMC_CHROMA_FORMAT_420, - mc_types, - 2, - &port_num, - &surface_type_id, - &is_overlay, - &intra_unsigned - )) - { - XCloseDisplay(display); - error(1, 0, "Error, unable to find a good port.\n"); - } - - if (is_overlay) - { - Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0); - XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey); - } - - assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, XVMC_DIRECT, &context) == Success); - assert(XvMCCreateSurface(display, &context, &surface) == Success); - - /* Test NULL context */ - assert(XvMCCreateBlocks(display, NULL, 1, &blocks) == XvMCBadContext); - /* Test 0 blocks */ - assert(XvMCCreateBlocks(display, &context, 0, &blocks) == BadValue); - /* Test valid params */ - assert(XvMCCreateBlocks(display, &context, min_required_blocks, &blocks) == Success); - /* Test context id assigned and correct */ - assert(blocks.context_id == context.context_id); - /* Test number of blocks assigned and correct */ - assert(blocks.num_blocks == min_required_blocks); - /* Test block pointer valid */ - assert(blocks.blocks != NULL); - /* Test NULL context */ - assert(XvMCCreateMacroBlocks(display, NULL, 1, ¯oblocks) == XvMCBadContext); - /* Test 0 macroblocks */ - assert(XvMCCreateMacroBlocks(display, &context, 0, ¯oblocks) == BadValue); - /* Test valid params */ - assert(XvMCCreateMacroBlocks(display, &context, min_required_macroblocks, ¯oblocks) == Success); - /* Test context id assigned and correct */ - assert(macroblocks.context_id == context.context_id); - /* Test macroblock pointer valid */ - assert(macroblocks.macro_blocks != NULL); - /* Test valid params */ - assert(XvMCDestroyMacroBlocks(display, ¯oblocks) == Success); - /* Test valid params */ - assert(XvMCDestroyBlocks(display, &blocks) == Success); - - assert(XvMCDestroySurface(display, &surface) == Success); - assert(XvMCDestroyContext(display, &context) == Success); - - XvUngrabPort(display, port_num, CurrentTime); - XCloseDisplay(display); - - return 0; -} diff --git a/src/xvmc/tests/test_context.c b/src/xvmc/tests/test_context.c deleted file mode 100644 index 53f7449cd0..0000000000 --- a/src/xvmc/tests/test_context.c +++ /dev/null @@ -1,92 +0,0 @@ -#include -#include -#include "testlib.h" - -int main(int argc, char **argv) -{ - const unsigned int width = 16, height = 16; - const unsigned int mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2}; - - Display *display; - XvPortID port_num; - int surface_type_id; - unsigned int is_overlay, intra_unsigned; - int colorkey; - XvMCContext context = {0}; - - display = XOpenDisplay(NULL); - - if (!GetPort - ( - display, - width, - height, - XVMC_CHROMA_FORMAT_420, - mc_types, - 2, - &port_num, - &surface_type_id, - &is_overlay, - &intra_unsigned - )) - { - XCloseDisplay(display); - error(1, 0, "Error, unable to find a good port.\n"); - } - - if (is_overlay) - { - Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0); - XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey); - } - - /* Test NULL context */ - /* XXX: XvMCBadContext not a valid return for XvMCCreateContext in the XvMC API, but openChrome driver returns it */ - assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, XVMC_DIRECT, NULL) == XvMCBadContext); - /* Test invalid port */ - /* XXX: Success and XvBadPort have the same value, if this call actually gets passed the validation step as of now we'll crash later */ - assert(XvMCCreateContext(display, -1, surface_type_id, width, height, XVMC_DIRECT, &context) == XvBadPort); - /* Test invalid surface */ - assert(XvMCCreateContext(display, port_num, -1, width, height, XVMC_DIRECT, &context) == BadMatch); - /* Test invalid flags */ - assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, -1, &context) == BadValue); - /* Test huge width */ - assert(XvMCCreateContext(display, port_num, surface_type_id, 16384, height, XVMC_DIRECT, &context) == BadValue); - /* Test huge height */ - assert(XvMCCreateContext(display, port_num, surface_type_id, width, 16384, XVMC_DIRECT, &context) == BadValue); - /* Test huge width & height */ - assert(XvMCCreateContext(display, port_num, surface_type_id, 16384, 16384, XVMC_DIRECT, &context) == BadValue); - /* Test valid params */ - assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, XVMC_DIRECT, &context) == Success); - /* Test context id assigned */ - assert(context.context_id != 0); - /* Test surface type id assigned and correct */ - assert(context.surface_type_id == surface_type_id); - /* Test width & height assigned and correct */ - assert(context.width == width && context.height == height); - /* Test port assigned and correct */ - assert(context.port == port_num); - /* Test flags assigned and correct */ - assert(context.flags == XVMC_DIRECT); - /* Test NULL context */ - assert(XvMCDestroyContext(display, NULL) == XvMCBadContext); - /* Test valid params */ - assert(XvMCDestroyContext(display, &context) == Success); - /* Test awkward but valid width */ - assert(XvMCCreateContext(display, port_num, surface_type_id, width + 1, height, XVMC_DIRECT, &context) == Success); - assert(context.width >= width + 1); - assert(XvMCDestroyContext(display, &context) == Success); - /* Test awkward but valid height */ - assert(XvMCCreateContext(display, port_num, surface_type_id, width, height + 1, XVMC_DIRECT, &context) == Success); - assert(context.height >= height + 1); - assert(XvMCDestroyContext(display, &context) == Success); - /* Test awkward but valid width & height */ - assert(XvMCCreateContext(display, port_num, surface_type_id, width + 1, height + 1, XVMC_DIRECT, &context) == Success); - assert(context.width >= width + 1 && context.height >= height + 1); - assert(XvMCDestroyContext(display, &context) == Success); - - XvUngrabPort(display, port_num, CurrentTime); - XCloseDisplay(display); - - return 0; -} diff --git a/src/xvmc/tests/test_rendering.c b/src/xvmc/tests/test_rendering.c deleted file mode 100644 index 6d720dfcdc..0000000000 --- a/src/xvmc/tests/test_rendering.c +++ /dev/null @@ -1,290 +0,0 @@ -#include -#include -#include -#include -#include "testlib.h" - -#define BLOCK_WIDTH 8 -#define BLOCK_HEIGHT 8 -#define BLOCK_SIZE (BLOCK_WIDTH * BLOCK_HEIGHT) -#define MACROBLOCK_WIDTH 16 -#define MACROBLOCK_HEIGHT 16 -#define MACROBLOCK_WIDTH_IN_BLOCKS (MACROBLOCK_WIDTH / BLOCK_WIDTH) -#define MACROBLOCK_HEIGHT_IN_BLOCKS (MACROBLOCK_HEIGHT / BLOCK_HEIGHT) -#define BLOCKS_PER_MACROBLOCK 6 - -#define INPUT_WIDTH 16 -#define INPUT_HEIGHT 16 -#define INPUT_WIDTH_IN_MACROBLOCKS (INPUT_WIDTH / MACROBLOCK_WIDTH) -#define INPUT_HEIGHT_IN_MACROBLOCKS (INPUT_HEIGHT / MACROBLOCK_HEIGHT) -#define NUM_MACROBLOCKS (INPUT_WIDTH_IN_MACROBLOCKS * INPUT_HEIGHT_IN_MACROBLOCKS) - -#define DEFAULT_OUTPUT_WIDTH INPUT_WIDTH -#define DEFAULT_OUTPUT_HEIGHT INPUT_HEIGHT -#define DEFAULT_ACCEPTABLE_ERR 0.01 - -void ParseArgs(int argc, char **argv, unsigned int *output_width, unsigned int *output_height, double *acceptable_error, int *prompt); -void Gradient(short *block, unsigned int start, unsigned int stop, int horizontal); - -void ParseArgs(int argc, char **argv, unsigned int *output_width, unsigned int *output_height, double *acceptable_error, int *prompt) -{ - int fail = 0; - int i; - - *output_width = DEFAULT_OUTPUT_WIDTH; - *output_height = DEFAULT_OUTPUT_WIDTH; - *acceptable_error = DEFAULT_ACCEPTABLE_ERR; - *prompt = 1; - - for (i = 1; i < argc && !fail; ++i) - { - if (!strcmp(argv[i], "-w")) - { - if (sscanf(argv[++i], "%u", output_width) != 1) - fail = 1; - } - else if (!strcmp(argv[i], "-h")) - { - if (sscanf(argv[++i], "%u", output_height) != 1) - fail = 1; - } - else if (!strcmp(argv[i], "-e")) - { - if (sscanf(argv[++i], "%lf", acceptable_error) != 1) - fail = 1; - } - else if (strcmp(argv[i], "-n")) - *prompt = 0; - else - fail = 1; - } - - if (fail) - error - ( - 1, 0, - "Bad argument.\n" - "\n" - "Usage: %s [options]\n" - "\t-w \tOutput width\n" - "\t-h \tOutput height\n" - "\t-e \tAcceptable margin of error per pixel, from 0 to 1\n" - "\t-n\tDon't prompt for quit\n", - argv[0] - ); -} - -void Gradient(short *block, unsigned int start, unsigned int stop, int horizontal) -{ - unsigned int x, y; - unsigned int range = stop - start; - - if (horizontal) - { - for (y = 0; y < BLOCK_HEIGHT; ++y) - for (x = 0; x < BLOCK_WIDTH; ++x) - block[y * BLOCK_WIDTH + x] = (short)(start + range * (x / (float)(BLOCK_WIDTH - 1))); - } - else - { - for (y = 0; y < BLOCK_HEIGHT; ++y) - for (x = 0; x < BLOCK_WIDTH; ++x) - block[y * BLOCK_WIDTH + x] = (short)(start + range * (y / (float)(BLOCK_HEIGHT - 1))); - } -} - -int main(int argc, char **argv) -{ - unsigned int output_width; - unsigned int output_height; - double acceptable_error; - int prompt; - Display *display; - Window root, window; - const unsigned int mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2}; - XvPortID port_num; - int surface_type_id; - unsigned int is_overlay, intra_unsigned; - int colorkey; - XvMCContext context; - XvMCSurface surface; - XvMCBlockArray block_array; - XvMCMacroBlockArray mb_array; - int mbx, mby, bx, by; - XvMCMacroBlock *mb; - short *blocks; - int quit = 0; - - ParseArgs(argc, argv, &output_width, &output_height, &acceptable_error, &prompt); - - display = XOpenDisplay(NULL); - - if (!GetPort - ( - display, - INPUT_WIDTH, - INPUT_HEIGHT, - XVMC_CHROMA_FORMAT_420, - mc_types, - 2, - &port_num, - &surface_type_id, - &is_overlay, - &intra_unsigned - )) - { - XCloseDisplay(display); - error(1, 0, "Error, unable to find a good port.\n"); - } - - if (is_overlay) - { - Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0); - XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey); - } - - root = XDefaultRootWindow(display); - window = XCreateSimpleWindow(display, root, 0, 0, output_width, output_height, 0, 0, colorkey); - - assert(XvMCCreateContext(display, port_num, surface_type_id, INPUT_WIDTH, INPUT_HEIGHT, XVMC_DIRECT, &context) == Success); - assert(XvMCCreateSurface(display, &context, &surface) == Success); - assert(XvMCCreateBlocks(display, &context, NUM_MACROBLOCKS * BLOCKS_PER_MACROBLOCK, &block_array) == Success); - assert(XvMCCreateMacroBlocks(display, &context, NUM_MACROBLOCKS, &mb_array) == Success); - - mb = mb_array.macro_blocks; - blocks = block_array.blocks; - - for (mby = 0; mby < INPUT_HEIGHT_IN_MACROBLOCKS; ++mby) - for (mbx = 0; mbx < INPUT_WIDTH_IN_MACROBLOCKS; ++mbx) - { - mb->x = mbx; - mb->y = mby; - mb->macroblock_type = XVMC_MB_TYPE_INTRA; - /*mb->motion_type = ;*/ - /*mb->motion_vertical_field_select = ;*/ - mb->dct_type = XVMC_DCT_TYPE_FRAME; - /*mb->PMV[0][0][0] = ; - mb->PMV[0][0][1] = ; - mb->PMV[0][1][0] = ; - mb->PMV[0][1][1] = ; - mb->PMV[1][0][0] = ; - mb->PMV[1][0][1] = ; - mb->PMV[1][1][0] = ; - mb->PMV[1][1][1] = ;*/ - mb->index = (mby * INPUT_WIDTH_IN_MACROBLOCKS + mbx) * BLOCKS_PER_MACROBLOCK; - mb->coded_block_pattern = 0x3F; - - mb++; - - for (by = 0; by < MACROBLOCK_HEIGHT_IN_BLOCKS; ++by) - for (bx = 0; bx < MACROBLOCK_WIDTH_IN_BLOCKS; ++bx) - { - const int start = 16, stop = 235, range = stop - start; - - Gradient - ( - blocks, - (short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH) / (float)(INPUT_WIDTH - 1))), - (short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH + BLOCK_WIDTH - 1) / (float)(INPUT_WIDTH - 1))), - 1 - ); - - blocks += BLOCK_SIZE; - } - - for (by = 0; by < MACROBLOCK_HEIGHT_IN_BLOCKS / 2; ++by) - for (bx = 0; bx < MACROBLOCK_WIDTH_IN_BLOCKS / 2; ++bx) - { - const int start = 16, stop = 240, range = stop - start; - - Gradient - ( - blocks, - (short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH) / (float)(INPUT_WIDTH - 1))), - (short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH + BLOCK_WIDTH - 1) / (float)(INPUT_WIDTH - 1))), - 1 - ); - - blocks += BLOCK_SIZE; - - Gradient - ( - blocks, - (short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH) / (float)(INPUT_WIDTH - 1))), - (short)(start + range * ((mbx * MACROBLOCK_WIDTH + bx * BLOCK_WIDTH + BLOCK_WIDTH - 1) / (float)(INPUT_WIDTH - 1))), - 1 - ); - - blocks += BLOCK_SIZE; - } - } - - XSelectInput(display, window, ExposureMask | KeyPressMask); - XMapWindow(display, window); - XSync(display, 0); - - /* Test NULL context */ - assert(XvMCRenderSurface(display, NULL, XVMC_FRAME_PICTURE, &surface, NULL, NULL, 0, NUM_MACROBLOCKS, 0, &mb_array, &block_array) == XvMCBadContext); - /* Test NULL surface */ - assert(XvMCRenderSurface(display, &context, XVMC_FRAME_PICTURE, NULL, NULL, NULL, 0, NUM_MACROBLOCKS, 0, &mb_array, &block_array) == XvMCBadSurface); - /* Test bad picture structure */ - assert(XvMCRenderSurface(display, &context, 0, &surface, NULL, NULL, 0, NUM_MACROBLOCKS, 0, &mb_array, &block_array) == BadValue); - /* Test valid params */ - assert(XvMCRenderSurface(display, &context, XVMC_FRAME_PICTURE, &surface, NULL, NULL, 0, NUM_MACROBLOCKS, 0, &mb_array, &block_array) == Success); - - /* Test NULL surface */ - assert(XvMCPutSurface(display, NULL, window, 0, 0, INPUT_WIDTH, INPUT_HEIGHT, 0, 0, output_width, output_height, XVMC_FRAME_PICTURE) == XvMCBadSurface); - /* Test bad window */ - /* XXX: X halts with a bad drawable for some reason, doesn't return BadDrawable as expected */ - /*assert(XvMCPutSurface(display, &surface, 0, 0, 0, width, height, 0, 0, width, height, XVMC_FRAME_PICTURE) == BadDrawable);*/ - - if (prompt) - { - puts("Press any button to quit..."); - - while (!quit) - { - if (XPending(display) > 0) - { - XEvent event; - - XNextEvent(display, &event); - - switch (event.type) - { - case Expose: - { - /* Test valid params */ - assert - ( - XvMCPutSurface - ( - display, &surface, window, - 0, 0, INPUT_WIDTH, INPUT_HEIGHT, - 0, 0, output_width, output_height, - XVMC_FRAME_PICTURE - ) == Success - ); - break; - } - case KeyPress: - { - quit = 1; - break; - } - } - } - } - } - - assert(XvMCDestroyBlocks(display, &block_array) == Success); - assert(XvMCDestroyMacroBlocks(display, &mb_array) == Success); - assert(XvMCDestroySurface(display, &surface) == Success); - assert(XvMCDestroyContext(display, &context) == Success); - - XvUngrabPort(display, port_num, CurrentTime); - XDestroyWindow(display, window); - XCloseDisplay(display); - - return 0; -} diff --git a/src/xvmc/tests/test_surface.c b/src/xvmc/tests/test_surface.c deleted file mode 100644 index 06948201ac..0000000000 --- a/src/xvmc/tests/test_surface.c +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include -#include "testlib.h" - -int main(int argc, char **argv) -{ - const unsigned int width = 16, height = 16; - const unsigned int mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2}; - - Display *display; - XvPortID port_num; - int surface_type_id; - unsigned int is_overlay, intra_unsigned; - int colorkey; - XvMCContext context; - XvMCSurface surface = {0}; - - display = XOpenDisplay(NULL); - - if (!GetPort - ( - display, - width, - height, - XVMC_CHROMA_FORMAT_420, - mc_types, - 2, - &port_num, - &surface_type_id, - &is_overlay, - &intra_unsigned - )) - { - XCloseDisplay(display); - error(1, 0, "Error, unable to find a good port.\n"); - } - - if (is_overlay) - { - Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0); - XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey); - } - - assert(XvMCCreateContext(display, port_num, surface_type_id, width, height, XVMC_DIRECT, &context) == Success); - - /* Test NULL context */ - assert(XvMCCreateSurface(display, NULL, &surface) == XvMCBadContext); - /* Test NULL surface */ - assert(XvMCCreateSurface(display, &context, NULL) == XvMCBadSurface); - /* Test valid params */ - assert(XvMCCreateSurface(display, &context, &surface) == Success); - /* Test surface id assigned */ - assert(surface.surface_id != 0); - /* Test context id assigned and correct */ - assert(surface.context_id == context.context_id); - /* Test surface type id assigned and correct */ - assert(surface.surface_type_id == surface_type_id); - /* Test width & height assigned and correct */ - assert(surface.width == width && surface.height == height); - /* Test valid params */ - assert(XvMCDestroySurface(display, &surface) == Success); - /* Test NULL surface */ - assert(XvMCDestroySurface(display, NULL) == XvMCBadSurface); - - assert(XvMCDestroyContext(display, &context) == Success); - - XvUngrabPort(display, port_num, CurrentTime); - XCloseDisplay(display); - - return 0; -} diff --git a/src/xvmc/tests/testlib.c b/src/xvmc/tests/testlib.c deleted file mode 100644 index 59a03ca813..0000000000 --- a/src/xvmc/tests/testlib.c +++ /dev/null @@ -1,119 +0,0 @@ -#include "testlib.h" -#include - -/* -void test(int pred, const char *pred_string, const char *doc_string, const char *file, unsigned int line) -{ - fputs(doc_string, stderr); - if (!pred) - fprintf(stderr, " FAIL!\n\t\"%s\" at %s:%u\n", pred_string, file, line); - else - fputs(" PASS!\n", stderr); -} -*/ - -int GetPort -( - Display *display, - unsigned int width, - unsigned int height, - unsigned int chroma_format, - const unsigned int *mc_types, - unsigned int num_mc_types, - XvPortID *port_id, - int *surface_type_id, - unsigned int *is_overlay, - unsigned int *intra_unsigned -) -{ - unsigned int found_port = 0; - XvAdaptorInfo *adaptor_info; - unsigned int num_adaptors; - int num_types; - int ev_base, err_base; - unsigned int i, j, k, l; - - if (!XvMCQueryExtension(display, &ev_base, &err_base)) - return 0; - if (XvQueryAdaptors(display, XDefaultRootWindow(display), &num_adaptors, &adaptor_info) != Success) - return 0; - - for (i = 0; i < num_adaptors && !found_port; ++i) - { - if (adaptor_info[i].type & XvImageMask) - { - XvMCSurfaceInfo *surface_info = XvMCListSurfaceTypes(display, adaptor_info[i].base_id, &num_types); - - if (surface_info) - { - for (j = 0; j < num_types && !found_port; ++j) - { - if - ( - surface_info[j].chroma_format == chroma_format && - surface_info[j].max_width >= width && - surface_info[j].max_height >= height - ) - { - for (k = 0; k < num_mc_types && !found_port; ++k) - { - if (surface_info[j].mc_type == mc_types[k]) - { - for (l = 0; l < adaptor_info[i].num_ports && !found_port; ++l) - { - if (XvGrabPort(display, adaptor_info[i].base_id + l, CurrentTime) == Success) - { - *port_id = adaptor_info[i].base_id + l; - *surface_type_id = surface_info[j].surface_type_id; - *is_overlay = surface_info[j].flags & XVMC_OVERLAID_SURFACE; - *intra_unsigned = surface_info[j].flags & XVMC_INTRA_UNSIGNED; - found_port = 1; - } - } - } - } - } - } - - XFree(surface_info); - } - } - } - - XvFreeAdaptorInfo(adaptor_info); - - return found_port; -} - -unsigned int align(unsigned int value, unsigned int alignment) -{ - return (value + alignment - 1) & ~(alignment - 1); -} - -/* From the glibc manual */ -int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y) -{ - /* Perform the carry for the later subtraction by updating y. */ - if (x->tv_usec < y->tv_usec) - { - int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1; - y->tv_usec -= 1000000 * nsec; - y->tv_sec += nsec; - } - if (x->tv_usec - y->tv_usec > 1000000) - { - int nsec = (x->tv_usec - y->tv_usec) / 1000000; - y->tv_usec += 1000000 * nsec; - y->tv_sec -= nsec; - } - - /* - * Compute the time remaining to wait. - * tv_usec is certainly positive. - */ - result->tv_sec = x->tv_sec - y->tv_sec; - result->tv_usec = x->tv_usec - y->tv_usec; - - /* Return 1 if result is negative. */ - return x->tv_sec < y->tv_sec; -} diff --git a/src/xvmc/tests/testlib.h b/src/xvmc/tests/testlib.h deleted file mode 100644 index af71ad74e1..0000000000 --- a/src/xvmc/tests/testlib.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef testlib_h -#define testlib_h - -/* -#define TEST(pred, doc) test(pred, #pred, doc, __FILE__, __LINE__) - -void test(int pred, const char *pred_string, const char *doc_string, const char *file, unsigned int line); -*/ - -#include -#include -#include - -/* - * display: IN A valid X display - * width, height: IN Surface size that the port must display - * chroma_format: IN Chroma format that the port must display - * mc_types, num_mc_types: IN List of MC types that the port must support, first port that matches the first mc_type will be returned - * port_id: OUT Your port's ID - * surface_type_id: OUT Your port's surface ID - * is_overlay: OUT If 1, port uses overlay surfaces, you need to set a colorkey - * intra_unsigned: OUT If 1, port uses unsigned values for intra-coded blocks - */ -int GetPort -( - Display *display, - unsigned int width, - unsigned int height, - unsigned int chroma_format, - const unsigned int *mc_types, - unsigned int num_mc_types, - XvPortID *port_id, - int *surface_type_id, - unsigned int *is_overlay, - unsigned int *intra_unsigned -); - -unsigned int align(unsigned int value, unsigned int alignment); - -int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y); - -#endif diff --git a/src/xvmc/tests/xvmc_bench.c b/src/xvmc/tests/xvmc_bench.c deleted file mode 100644 index 97adcfc58a..0000000000 --- a/src/xvmc/tests/xvmc_bench.c +++ /dev/null @@ -1,273 +0,0 @@ -#include -#include -#include -#include -#include -#include "testlib.h" - -#define MACROBLOCK_WIDTH 16 -#define MACROBLOCK_HEIGHT 16 -#define BLOCKS_PER_MACROBLOCK 6 - -#define DEFAULT_INPUT_WIDTH 720 -#define DEFAULT_INPUT_HEIGHT 480 -#define DEFAULT_REPS 100 - -#define PIPELINE_STEP_MC 1 -#define PIPELINE_STEP_CSC 2 -#define PIPELINE_STEP_SWAP 4 - -#define MB_TYPE_I 1 -#define MB_TYPE_P 2 -#define MB_TYPE_B 4 - -struct Config -{ - unsigned int input_width; - unsigned int input_height; - unsigned int output_width; - unsigned int output_height; - unsigned int pipeline; - unsigned int mb_types; - unsigned int reps; -}; - -void ParseArgs(int argc, char **argv, struct Config *config); - -void ParseArgs(int argc, char **argv, struct Config *config) -{ - int fail = 0; - int i; - - config->input_width = DEFAULT_INPUT_WIDTH; - config->input_height = DEFAULT_INPUT_HEIGHT; - config->output_width = 0; - config->output_height = 0; - config->pipeline = 0; - config->mb_types = 0; - config->reps = DEFAULT_REPS; - - for (i = 1; i < argc && !fail; ++i) - { - if (!strcmp(argv[i], "-iw")) - { - if (sscanf(argv[++i], "%u", &config->input_width) != 1) - fail = 1; - } - else if (!strcmp(argv[i], "-ih")) - { - if (sscanf(argv[++i], "%u", &config->input_height) != 1) - fail = 1; - } - else if (!strcmp(argv[i], "-ow")) - { - if (sscanf(argv[++i], "%u", &config->output_width) != 1) - fail = 1; - } - else if (!strcmp(argv[i], "-oh")) - { - if (sscanf(argv[++i], "%u", &config->output_height) != 1) - fail = 1; - } - else if (!strcmp(argv[i], "-p")) - { - char *token = strtok(argv[++i], ","); - - while (token && !fail) - { - if (!strcmp(token, "mc")) - config->pipeline |= PIPELINE_STEP_MC; - else if (!strcmp(token, "csc")) - config->pipeline |= PIPELINE_STEP_CSC; - else if (!strcmp(token, "swp")) - config->pipeline |= PIPELINE_STEP_SWAP; - else - fail = 1; - - if (!fail) - token = strtok(NULL, ","); - } - } - else if (!strcmp(argv[i], "-mb")) - { - char *token = strtok(argv[++i], ","); - - while (token && !fail) - { - if (strcmp(token, "i")) - config->mb_types |= MB_TYPE_I; - else if (strcmp(token, "p")) - config->mb_types |= MB_TYPE_P; - else if (strcmp(token, "b")) - config->mb_types |= MB_TYPE_B; - else - fail = 1; - - if (!fail) - token = strtok(NULL, ","); - } - } - else if (!strcmp(argv[i], "-r")) - { - if (sscanf(argv[++i], "%u", &config->reps) != 1) - fail = 1; - } - else - fail = 1; - } - - if (fail) - error - ( - 1, 0, - "Bad argument.\n" - "\n" - "Usage: %s [options]\n" - "\t-iw \tInput width\n" - "\t-ih \tInput height\n" - "\t-ow \tOutput width\n" - "\t-oh \tOutput height\n" - "\t-p \tPipeline to test\n" - "\t-mb \tMacroBlock types to use\n" - "\t-r \tRepetitions\n\n" - "\tPipeline steps: mc,csc,swap\n" - "\tMB types: i,p,b\n", - argv[0] - ); - - if (config->output_width == 0) - config->output_width = config->input_width; - if (config->output_height == 0) - config->output_height = config->input_height; - if (!config->pipeline) - config->pipeline = PIPELINE_STEP_MC | PIPELINE_STEP_CSC | PIPELINE_STEP_SWAP; - if (!config->mb_types) - config->mb_types = MB_TYPE_I | MB_TYPE_P | MB_TYPE_B; -} - -int main(int argc, char **argv) -{ - struct Config config; - Display *display; - Window root, window; - const unsigned int mc_types[2] = {XVMC_MOCOMP | XVMC_MPEG_2, XVMC_IDCT | XVMC_MPEG_2}; - XvPortID port_num; - int surface_type_id; - unsigned int is_overlay, intra_unsigned; - int colorkey; - XvMCContext context; - XvMCSurface surface; - XvMCBlockArray block_array; - XvMCMacroBlockArray mb_array; - unsigned int mbw, mbh; - unsigned int mbx, mby; - unsigned int reps; - struct timeval start, stop, diff; - double diff_secs; - - ParseArgs(argc, argv, &config); - - mbw = align(config.input_width, MACROBLOCK_WIDTH) / MACROBLOCK_WIDTH; - mbh = align(config.input_height, MACROBLOCK_HEIGHT) / MACROBLOCK_HEIGHT; - - display = XOpenDisplay(NULL); - - if (!GetPort - ( - display, - config.input_width, - config.input_height, - XVMC_CHROMA_FORMAT_420, - mc_types, - 2, - &port_num, - &surface_type_id, - &is_overlay, - &intra_unsigned - )) - { - XCloseDisplay(display); - error(1, 0, "Error, unable to find a good port.\n"); - } - - if (is_overlay) - { - Atom xv_colorkey = XInternAtom(display, "XV_COLORKEY", 0); - XvGetPortAttribute(display, port_num, xv_colorkey, &colorkey); - } - - root = XDefaultRootWindow(display); - window = XCreateSimpleWindow(display, root, 0, 0, config.output_width, config.output_height, 0, 0, colorkey); - - assert(XvMCCreateContext(display, port_num, surface_type_id, config.input_width, config.input_height, XVMC_DIRECT, &context) == Success); - assert(XvMCCreateSurface(display, &context, &surface) == Success); - assert(XvMCCreateBlocks(display, &context, mbw * mbh * BLOCKS_PER_MACROBLOCK, &block_array) == Success); - assert(XvMCCreateMacroBlocks(display, &context, mbw * mbh, &mb_array) == Success); - - for (mby = 0; mby < mbh; ++mby) - for (mbx = 0; mbx < mbw; ++mbx) - { - mb_array.macro_blocks[mby * mbw + mbx].x = mbx; - mb_array.macro_blocks[mby * mbw + mbx].y = mby; - mb_array.macro_blocks[mby * mbw + mbx].macroblock_type = XVMC_MB_TYPE_INTRA; - /*mb->motion_type = ;*/ - /*mb->motion_vertical_field_select = ;*/ - mb_array.macro_blocks[mby * mbw + mbx].dct_type = XVMC_DCT_TYPE_FRAME; - /*mb->PMV[0][0][0] = ; - mb->PMV[0][0][1] = ; - mb->PMV[0][1][0] = ; - mb->PMV[0][1][1] = ; - mb->PMV[1][0][0] = ; - mb->PMV[1][0][1] = ; - mb->PMV[1][1][0] = ; - mb->PMV[1][1][1] = ;*/ - mb_array.macro_blocks[mby * mbw + mbx].index = (mby * mbw + mbx) * BLOCKS_PER_MACROBLOCK; - mb_array.macro_blocks[mby * mbw + mbx].coded_block_pattern = 0x3F; - } - - XSelectInput(display, window, ExposureMask | KeyPressMask); - XMapWindow(display, window); - XSync(display, 0); - - gettimeofday(&start, NULL); - - for (reps = 0; reps < config.reps; ++reps) - { - if (config.pipeline & PIPELINE_STEP_MC) - { - assert(XvMCRenderSurface(display, &context, XVMC_FRAME_PICTURE, &surface, NULL, NULL, 0, mbw * mbh, 0, &mb_array, &block_array) == Success); - assert(XvMCFlushSurface(display, &surface) == Success); - } - if (config.pipeline & PIPELINE_STEP_CSC) - assert(XvMCPutSurface(display, &surface, window, 0, 0, config.input_width, config.input_height, 0, 0, config.output_width, config.output_height, XVMC_FRAME_PICTURE) == Success); - } - - gettimeofday(&stop, NULL); - - timeval_subtract(&diff, &stop, &start); - diff_secs = (double)diff.tv_sec + (double)diff.tv_usec / 1000000.0; - - printf("XvMC Benchmark\n"); - printf("Input: %u,%u\nOutput: %u,%u\n", config.input_width, config.input_height, config.output_width, config.output_height); - printf("Pipeline: "); - if (config.pipeline & PIPELINE_STEP_MC) - printf("|mc|"); - if (config.pipeline & PIPELINE_STEP_CSC) - printf("|csc|"); - if (config.pipeline & PIPELINE_STEP_SWAP) - printf("|swap|"); - printf("\n"); - printf("Reps: %u\n", config.reps); - printf("Total time: %.2lf (%.2lf reps / sec)\n", diff_secs, config.reps / diff_secs); - - assert(XvMCDestroyBlocks(display, &block_array) == Success); - assert(XvMCDestroyMacroBlocks(display, &mb_array) == Success); - assert(XvMCDestroySurface(display, &surface) == Success); - assert(XvMCDestroyContext(display, &context) == Success); - - XvUngrabPort(display, port_num, CurrentTime); - XDestroyWindow(display, window); - XCloseDisplay(display); - - return 0; -} diff --git a/src/xvmc/xvmc_private.h b/src/xvmc/xvmc_private.h deleted file mode 100644 index 1e3dd561c6..0000000000 --- a/src/xvmc/xvmc_private.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef xvmc_private_h -#define xvmc_private_h - -#include -#include - -#define BLOCK_SIZE_SAMPLES 64 -#define BLOCK_SIZE_BYTES (BLOCK_SIZE_SAMPLES * 2) - -struct pipe_video_context; -struct pipe_surface; -struct pipe_fence_handle; - -typedef struct -{ - struct pipe_video_context *vpipe; - struct pipe_surface *backbuffer; -} XvMCContextPrivate; - -typedef struct -{ - struct pipe_video_surface *pipe_vsfc; - struct pipe_fence_handle *render_fence; - struct pipe_fence_handle *disp_fence; - - /* Some XvMC functions take a surface but not a context, - so we keep track of which context each surface belongs to. */ - XvMCContext *context; -} XvMCSurfacePrivate; - -#endif /* xvmc_private_h */ -- cgit v1.2.3 From b58bc12ed4a3de6c828bd26c4820d7ddbb1eabd6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 19:58:18 -0600 Subject: via: use mesa texture format helper functions --- src/mesa/drivers/dri/unichrome/via_tex.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index 388fd9392c..02a0043bbe 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -30,6 +30,7 @@ #include "main/macros.h" #include "main/mtypes.h" #include "main/enums.h" +#include "main/formats.h" #include "main/colortab.h" #include "main/convolve.h" #include "main/context.h" @@ -689,15 +690,9 @@ static void viaTexImage(GLcontext *ctx, assert(texImage->TexFormat); - if (dims == 1) { - texImage->FetchTexelc = texImage->TexFormat->FetchTexel1D; - texImage->FetchTexelf = texImage->TexFormat->FetchTexel1Df; - } - else { - texImage->FetchTexelc = texImage->TexFormat->FetchTexel2D; - texImage->FetchTexelf = texImage->TexFormat->FetchTexel2Df; - } - texelBytes = texImage->TexFormat->TexelBytes; + _mesa_set_fetch_functions(texImage, dims); + + texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); if (texelBytes == 0) { /* compressed format */ @@ -804,7 +799,7 @@ static void viaTexImage(GLcontext *ctx, dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); } else { - dstRowStride = postConvWidth * texImage->TexFormat->TexelBytes; + dstRowStride = postConvWidth * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); } ASSERT(storeImage); success = storeImage(ctx, dims, -- cgit v1.2.3 From e0bc4533ebccbfb844522e2b6ddd171b97d693e8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 20:07:41 -0600 Subject: mesa/drivers: use _mesa_get_format_bytes() --- src/mesa/drivers/dri/intel/intel_tex_image.c | 5 ++--- src/mesa/drivers/dri/intel/intel_tex_subimage.c | 2 +- src/mesa/drivers/dri/mga/mgatexmem.c | 2 +- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 2 +- src/mesa/drivers/dri/radeon/radeon_texture.c | 12 ++++++------ src/mesa/drivers/dri/sis/sis_tex.c | 4 ++-- src/mesa/drivers/dri/tdfx/tdfx_tex.c | 4 ++-- 7 files changed, 15 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index aa36390689..5c98860cda 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -333,8 +333,7 @@ intelTexImage(GLcontext * ctx, _mesa_set_fetch_functions(texImage, dims); - if (texImage->TexFormat->TexelBytes == 0) { - /* must be a compressed format */ + if (_mesa_is_format_compressed(texImage->TexFormat->MesaFormat)) { texelBytes = 0; texImage->IsCompressed = GL_TRUE; texImage->CompressedSize = @@ -342,7 +341,7 @@ intelTexImage(GLcontext * ctx, texImage->Height, texImage->Depth, texImage->TexFormat->MesaFormat); } else { - texelBytes = texImage->TexFormat->TexelBytes; + texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); /* Minimum pitch of 32 bytes */ if (postConvWidth * texelBytes < 32) { diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c index f75d2ae004..c8de38bc72 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c @@ -91,7 +91,7 @@ intelTexSubimage(GLcontext * ctx, assert(dims != 3); } else { - dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes; + dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); } } diff --git a/src/mesa/drivers/dri/mga/mgatexmem.c b/src/mesa/drivers/dri/mga/mgatexmem.c index 9a2d62b53b..86816c0d81 100644 --- a/src/mesa/drivers/dri/mga/mgatexmem.c +++ b/src/mesa/drivers/dri/mga/mgatexmem.c @@ -137,7 +137,7 @@ static void mgaUploadSubImage( mgaContextPtr mmesa, * directly used by the hardware for texturing. */ - texelBytes = texImage->TexFormat->TexelBytes; + texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); length = texImage->Width * texImage->Height * texelBytes; if ( t->base.heap->heapId == MGA_CARD_HEAP ) { unsigned tex_offset = 0; diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index 38db305e2a..11c21037c4 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -325,7 +325,7 @@ GLboolean radeon_miptree_matches_image(radeon_mipmap_tree *mt, if (!texImage->IsCompressed && !mt->compressed && - texImage->TexFormat->TexelBytes != mt->bpp) + _mesa_get_format_bytes(texImage->TexFormat->MesaFormat) != mt->bpp) return GL_FALSE; lvl = &mt->levels[level - mt->firstLevel]; diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 4a22131486..a35c783d2e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -544,7 +544,7 @@ static void radeon_teximage( texImage->TexFormat = radeonChooseTextureFormat(ctx, internalFormat, format, type, 0); _mesa_set_fetch_functions(texImage, dims); - if (texImage->TexFormat->TexelBytes == 0) { + if (_mesa_is_format_compressed(texImage->TexFormat->MesaFormat)) { texelBytes = 0; texImage->IsCompressed = GL_TRUE; texImage->CompressedSize = @@ -555,7 +555,7 @@ static void radeon_teximage( texImage->IsCompressed = GL_FALSE; texImage->CompressedSize = 0; - texelBytes = texImage->TexFormat->TexelBytes; + texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); /* Minimum pitch of 32 bytes */ if (postConvWidth * texelBytes < 32) { postConvWidth = 32 / texelBytes; @@ -593,7 +593,7 @@ static void radeon_teximage( if (texImage->IsCompressed) { size = texImage->CompressedSize; } else { - size = texImage->Width * texImage->Height * texImage->Depth * texImage->TexFormat->TexelBytes; + size = texImage->Width * texImage->Height * texImage->Depth * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); } texImage->Data = _mesa_alloc_texmemory(size); } @@ -631,7 +631,7 @@ static void radeon_teximage( radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel]; dstRowStride = lvl->rowstride; } else { - dstRowStride = texImage->Width * texImage->TexFormat->TexelBytes; + dstRowStride = texImage->Width * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); } if (dims == 3) { @@ -642,7 +642,7 @@ static void radeon_teximage( _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); for (i = 0; i < depth; ++i) { - dstImageOffsets[i] = dstRowStride/texImage->TexFormat->TexelBytes * height * i; + dstImageOffsets[i] = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat->MesaFormat) * height * i; } } else { dstImageOffsets = texImage->ImageOffsets; @@ -757,7 +757,7 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel]; dstRowStride = lvl->rowstride; } else { - dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes; + dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); } if (compressed) { diff --git a/src/mesa/drivers/dri/sis/sis_tex.c b/src/mesa/drivers/dri/sis/sis_tex.c index 28ced6cfd5..f40a873209 100644 --- a/src/mesa/drivers/dri/sis/sis_tex.c +++ b/src/mesa/drivers/dri/sis/sis_tex.c @@ -425,7 +425,7 @@ static void sisTexSubImage1D( GLcontext *ctx, /* Upload the texture */ WaitEngIdle(smesa); - texelBytes = texImage->TexFormat->TexelBytes; + texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); copySize = width * texelBytes; src = (char *)texImage->Data + xoffset * texelBytes; @@ -513,7 +513,7 @@ static void sisTexSubImage2D( GLcontext *ctx, /* Upload the texture */ WaitEngIdle(smesa); - texelBytes = texImage->TexFormat->TexelBytes; + texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); copySize = width * texelBytes; src = (char *)texImage->Data + (xoffset + yoffset * texImage->Width) * diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index 91650088b9..e87ee9eba2 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -1407,7 +1407,7 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, mml->glideFormat = fxGlideFormat(mesaFormat); ti->info.format = mml->glideFormat; texImage->FetchTexelc = fxFetchFunction(mesaFormat); - texelBytes = texImage->TexFormat->TexelBytes; + texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); if (texImage->IsCompressed) { texImage->CompressedSize = _mesa_compressed_texture_size(ctx, @@ -1494,7 +1494,7 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, assert(texImage->Data); /* must have an existing texture image! */ assert(texImage->_BaseFormat); - texelBytes = texImage->TexFormat->TexelBytes; + texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); if (texImage->IsCompressed) { dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, mml->width); } else { -- cgit v1.2.3 From 9fbb8884f034e0d691fed0e099d4d796f3b42848 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 20:24:59 -0600 Subject: mesa/drivers: use _mesa_get_format_bytes() --- src/mesa/drivers/dri/i810/i810texmem.c | 59 +++++++++++++----------- src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 2 +- src/mesa/drivers/dri/intel/intel_tex_image.c | 10 +++- src/mesa/drivers/dri/intel/intel_tex_validate.c | 3 +- src/mesa/drivers/dri/mach64/mach64_texmem.c | 16 +++++-- src/mesa/drivers/dri/mach64/mach64_texstate.c | 2 +- src/mesa/drivers/dri/mga/mga_texstate.c | 2 +- src/mesa/drivers/dri/r128/r128_texmem.c | 8 ++-- src/mesa/drivers/dri/r128/r128_texstate.c | 2 +- src/mesa/drivers/dri/r200/r200_texstate.c | 2 +- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 9 +++- src/mesa/drivers/dri/radeon/radeon_texstate.c | 2 +- src/mesa/drivers/dri/radeon/radeon_texture.c | 2 +- src/mesa/drivers/dri/sis/sis_tex.c | 2 +- 14 files changed, 72 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i810/i810texmem.c b/src/mesa/drivers/dri/i810/i810texmem.c index 5ad66dbf5c..8cbe38f5fc 100644 --- a/src/mesa/drivers/dri/i810/i810texmem.c +++ b/src/mesa/drivers/dri/i810/i810texmem.c @@ -92,44 +92,47 @@ static void i810UploadTexLevel( i810ContextPtr imesa, { const struct gl_texture_image *image = t->image[hwlevel].image; int j; + GLuint texelBytes; if (!image || !image->Data) return; - if (image->Width * image->TexFormat->TexelBytes == t->Pitch) { + texelBytes = _mesa_get_format_bytes(image->TexFormat->MesaFormat); + + if (image->Width * texelBytes == t->Pitch) { GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[hwlevel].offset); GLubyte *src = (GLubyte *)image->Data; memcpy( dst, src, t->Pitch * image->Height ); } - else switch (image->TexFormat->TexelBytes) { - case 1: - { - GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[hwlevel].offset); - GLubyte *src = (GLubyte *)image->Data; - - for (j = 0 ; j < image->Height ; j++, dst += t->Pitch) { - __memcpy(dst, src, image->Width ); - src += image->Width; - } + else { + switch (texelBytes) { + case 1: + { + GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[hwlevel].offset); + GLubyte *src = (GLubyte *)image->Data; + + for (j = 0 ; j < image->Height ; j++, dst += t->Pitch) { + __memcpy(dst, src, image->Width ); + src += image->Width; + } + } + break; + case 2: + { + GLushort *dst = (GLushort *)(t->BufAddr + t->image[hwlevel].offset); + GLushort *src = (GLushort *)image->Data; + + for (j = 0 ; j < image->Height ; j++, dst += (t->Pitch/2)) { + __memcpy(dst, src, image->Width * 2 ); + src += image->Width; + } + } + break; + default: + fprintf(stderr, "%s: Not supported texel size %d\n", + __FUNCTION__, texelBytes); } - break; - - case 2: - { - GLushort *dst = (GLushort *)(t->BufAddr + t->image[hwlevel].offset); - GLushort *src = (GLushort *)image->Data; - - for (j = 0 ; j < image->Height ; j++, dst += (t->Pitch/2)) { - __memcpy(dst, src, image->Width * 2 ); - src += image->Width; - } - } - break; - - default: - fprintf(stderr, "%s: Not supported texel size %d\n", - __FUNCTION__, image->TexFormat->TexelBytes); } } diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index c985da5aa2..188333c75f 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -307,7 +307,7 @@ intel_miptree_match_image(struct intel_mipmap_tree *mt, if (!image->IsCompressed && !mt->compressed && - image->TexFormat->TexelBytes != mt->cpp) + _mesa_get_format_bytes(image->TexFormat->MesaFormat) != mt->cpp) return GL_FALSE; /* Test image dimensions against the base level image adjusted for diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 5c98860cda..3bafbba371 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -70,6 +70,7 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, GLuint depth = intelImage->base.Depth; GLuint l2width, l2height, l2depth; GLuint i, comp_byte = 0; + GLuint texelBytes; DBG("%s\n", __FUNCTION__); @@ -126,6 +127,9 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, assert(!intelObj->mt); if (intelImage->base.IsCompressed) comp_byte = intel_compressed_num_bytes(intelImage->base.TexFormat->MesaFormat); + + texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat->MesaFormat); + intelObj->mt = intel_miptree_create(intel, intelObj->base.Target, intelImage->base._BaseFormat, @@ -135,7 +139,7 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, width, height, depth, - intelImage->base.TexFormat->TexelBytes, + texelBytes, comp_byte, expect_accelerated_upload); @@ -399,12 +403,14 @@ intelTexImage(GLcontext * ctx, assert(intelImage->mt); } else if (intelImage->base.Border == 0) { int comp_byte = 0; + GLuint texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat->MesaFormat); if (intelImage->base.IsCompressed) { comp_byte = intel_compressed_num_bytes(intelImage->base.TexFormat->MesaFormat); } + /* Didn't fit in the object miptree, but it's suitable for inclusion in * a miptree, so create one just for our level and store it in the image. * It'll get moved into the object miptree at validate time. @@ -414,7 +420,7 @@ intelTexImage(GLcontext * ctx, internalFormat, level, level, width, height, depth, - intelImage->base.TexFormat->TexelBytes, + texelBytes, comp_byte, pixels == NULL); } diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c index a284d5475f..0393d7915a 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_validate.c +++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c @@ -169,7 +169,8 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) comp_byte = intel_compressed_num_bytes(firstImage->base.TexFormat->MesaFormat); cpp = comp_byte; } - else cpp = firstImage->base.TexFormat->TexelBytes; + else + cpp = _mesa_get_format_bytes(firstImage->base.TexFormat->MesaFormat); /* Check tree can hold all active levels. Check tree matches * target, imageFormat, etc. diff --git a/src/mesa/drivers/dri/mach64/mach64_texmem.c b/src/mesa/drivers/dri/mach64/mach64_texmem.c index 734e547952..843b231051 100644 --- a/src/mesa/drivers/dri/mach64/mach64_texmem.c +++ b/src/mesa/drivers/dri/mach64/mach64_texmem.c @@ -76,6 +76,7 @@ static void mach64UploadAGPSubImage( mach64ContextPtr mmesa, struct gl_texture_image *image; int texelsPerDword = 0; int dwords; + GLuint texelBytes; /* Ensure we have a valid texture to upload */ if ( ( level < 0 ) || ( level > mmesa->glCtx->Const.MaxTextureLevels ) ) @@ -85,7 +86,9 @@ static void mach64UploadAGPSubImage( mach64ContextPtr mmesa, if ( !image ) return; - switch ( image->TexFormat->TexelBytes ) { + texelBytes = _mesa_get_format_bytes(image->TexFormat->MesaFormat); + + switch ( texelBytes ) { case 1: texelsPerDword = 4; break; case 2: texelsPerDword = 2; break; case 4: texelsPerDword = 1; break; @@ -118,8 +121,8 @@ static void mach64UploadAGPSubImage( mach64ContextPtr mmesa, { CARD32 *dst = (CARD32 *)((char *)mach64Screen->agpTextures.map + t->base.memBlock->ofs); const GLubyte *src = (const GLubyte *) image->Data + - (y * image->Width + x) * image->TexFormat->TexelBytes; - const GLuint bytes = width * height * image->TexFormat->TexelBytes; + (y * image->Width + x) * texelBytes; + const GLuint bytes = width * height * texelBytes; memcpy(dst, src, bytes); } @@ -140,6 +143,7 @@ static void mach64UploadLocalSubImage( mach64ContextPtr mmesa, const int maxdwords = (MACH64_BUFFER_MAX_DWORDS - (MACH64_HOSTDATA_BLIT_OFFSET / 4)); CARD32 pitch, offset; int i; + GLuint texelBytes; /* Ensure we have a valid texture to upload */ if ( ( level < 0 ) || ( level > mmesa->glCtx->Const.MaxTextureLevels ) ) @@ -149,7 +153,9 @@ static void mach64UploadLocalSubImage( mach64ContextPtr mmesa, if ( !image ) return; - switch ( image->TexFormat->TexelBytes ) { + texelBytes = _mesa_get_format_bytes(image->TexFormat->MesaFormat); + + switch ( texelBytes ) { case 1: texelsPerDword = 4; break; case 2: texelsPerDword = 2; break; case 4: texelsPerDword = 1; break; @@ -259,7 +265,7 @@ static void mach64UploadLocalSubImage( mach64ContextPtr mmesa, { const GLubyte *src = (const GLubyte *) image->Data + - (y * image->Width + x) * image->TexFormat->TexelBytes; + (y * image->Width + x) * texelBytes; mach64FireBlitLocked( mmesa, (void *)src, offset, pitch, format, x, y, width, height ); diff --git a/src/mesa/drivers/dri/mach64/mach64_texstate.c b/src/mesa/drivers/dri/mach64/mach64_texstate.c index fd2369dd88..ff03b0c40a 100644 --- a/src/mesa/drivers/dri/mach64/mach64_texstate.c +++ b/src/mesa/drivers/dri/mach64/mach64_texstate.c @@ -89,7 +89,7 @@ static void mach64SetTexImages( mach64ContextPtr mmesa, totalSize = ( baseImage->Height * baseImage->Width * - baseImage->TexFormat->TexelBytes ); + _mesa_get_format_bytes(baseImage->TexFormat->MesaFormat) ); totalSize = (totalSize + 31) & ~31; diff --git a/src/mesa/drivers/dri/mga/mga_texstate.c b/src/mesa/drivers/dri/mga/mga_texstate.c index ad765d1dd7..8f78ab9bd4 100644 --- a/src/mesa/drivers/dri/mga/mga_texstate.c +++ b/src/mesa/drivers/dri/mga/mga_texstate.c @@ -131,7 +131,7 @@ mgaSetTexImages( mgaContextPtr mmesa, break; size = texImage->Width * texImage->Height * - baseImage->TexFormat->TexelBytes; + _mesa_get_format_bytes(baseImage->TexFormat->MesaFormat); t->offsets[i] = totalSize; t->base.dirty_images[0] |= (1<TexFormat->TexelBytes ) { + switch ( _mesa_get_format_bytes(image->TexFormat->MesaFormat) ) { case 1: texelsPerDword = 4; break; case 2: texelsPerDword = 2; break; case 4: texelsPerDword = 1; break; @@ -215,9 +215,11 @@ static void uploadSubImage( r128ContextPtr rmesa, r128TexObjPtr t, /* Copy the next chunck of the texture image into the blit buffer */ { + const GLuint texelBytes = + _mesa_get_format_bytes(image->TexFormat->MesaFormat); const GLubyte *src = (const GLubyte *) image->Data + - (y * image->Width + x) * image->TexFormat->TexelBytes; - const GLuint bytes = width * height * image->TexFormat->TexelBytes; + (y * image->Width + x) * texelBytes; + const GLuint bytes = width * height * texelBytes; memcpy(dst, src, bytes); } diff --git a/src/mesa/drivers/dri/r128/r128_texstate.c b/src/mesa/drivers/dri/r128/r128_texstate.c index a9c9568003..9f4f9aea2d 100644 --- a/src/mesa/drivers/dri/r128/r128_texstate.c +++ b/src/mesa/drivers/dri/r128/r128_texstate.c @@ -123,7 +123,7 @@ static void r128SetTexImages( r128ContextPtr rmesa, totalSize += (tObj->Image[0][i]->Height * tObj->Image[0][i]->Width * - tObj->Image[0][i]->TexFormat->TexelBytes); + _mesa_get_format_bytes(tObj->Image[0][i]->TexFormat->MesaFormat)); /* Offsets must be 32-byte aligned for host data blits and tiling */ totalSize = (totalSize + 31) & ~31; diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index c94834752e..03f0613e7a 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -1437,7 +1437,7 @@ static void setup_hardware_state(r200ContextPtr rmesa, radeonTexObj *t) log2Width = firstImage->WidthLog2; log2Height = firstImage->HeightLog2; log2Depth = firstImage->DepthLog2; - texelBytes = firstImage->TexFormat->TexelBytes; + texelBytes = _mesa_get_format_bytes(firstImage->TexFormat->MesaFormat); if (!t->image_override) { diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index 11c21037c4..851474f871 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -347,6 +347,7 @@ GLboolean radeon_miptree_matches_texture(radeon_mipmap_tree *mt, struct gl_textu GLuint compressed; GLuint numfaces = 1; GLuint firstLevel, lastLevel; + GLuint texelBytes; calculate_first_last_level(texObj, &firstLevel, &lastLevel, 0, texObj->BaseLevel); if (texObj->Target == GL_TEXTURE_CUBE_MAP) @@ -354,6 +355,7 @@ GLboolean radeon_miptree_matches_texture(radeon_mipmap_tree *mt, struct gl_textu firstImage = texObj->Image[0][firstLevel]; compressed = firstImage->IsCompressed ? firstImage->TexFormat->MesaFormat : 0; + texelBytes = _mesa_get_format_bytes(firstImage->TexFormat->MesaFormat); return (mt->firstLevel == firstLevel && mt->lastLevel == lastLevel && @@ -361,7 +363,7 @@ GLboolean radeon_miptree_matches_texture(radeon_mipmap_tree *mt, struct gl_textu mt->height0 == firstImage->Height && mt->depth0 == firstImage->Depth && mt->compressed == compressed && - (!mt->compressed ? (mt->bpp == firstImage->TexFormat->TexelBytes) : 1)); + (!mt->compressed ? (mt->bpp == texelBytes) : 1)); } @@ -375,6 +377,7 @@ void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t, GLuint compressed = image->base.IsCompressed ? image->base.TexFormat->MesaFormat : 0; GLuint numfaces = 1; GLuint firstLevel, lastLevel; + GLuint texelBytes; assert(!t->mt); @@ -385,11 +388,13 @@ void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t, if (level != firstLevel || face >= numfaces) return; + texelBytes = _mesa_get_format_bytes(image->base.TexFormat->MesaFormat); + t->mt = radeon_miptree_create(rmesa, t, t->base.Target, image->base.InternalFormat, firstLevel, lastLevel, image->base.Width, image->base.Height, image->base.Depth, - image->base.TexFormat->TexelBytes, t->tile_bits, compressed); + texelBytes, t->tile_bits, compressed); } /* Although we use the image_offset[] array to store relative offsets diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index ae41b90efe..a00497a8f9 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -1031,7 +1031,7 @@ static GLboolean setup_hardware_state(r100ContextPtr rmesa, radeonTexObj *t, int log2Width = firstImage->WidthLog2; log2Height = firstImage->HeightLog2; log2Depth = firstImage->DepthLog2; - texelBytes = firstImage->TexFormat->TexelBytes; + texelBytes = _mesa_get_format_bytes(firstImage->TexFormat->MesaFormat); if (!t->image_override) { if (VALID_FORMAT(firstImage->TexFormat->MesaFormat)) { diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index a35c783d2e..416ca1974b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -900,7 +900,7 @@ static void migrate_image_to_miptree(radeon_mipmap_tree *mt, radeon_texture_imag srcrowstride = _mesa_compressed_row_stride(image->base.TexFormat->MesaFormat, image->base.Width); } else { height = image->base.Height * image->base.Depth; - srcrowstride = image->base.Width * image->base.TexFormat->TexelBytes; + srcrowstride = image->base.Width * _mesa_get_format_bytes(image->base.TexFormat->MesaFormat); } // if (mt->tilebits) diff --git a/src/mesa/drivers/dri/sis/sis_tex.c b/src/mesa/drivers/dri/sis/sis_tex.c index f40a873209..38a309d41f 100644 --- a/src/mesa/drivers/dri/sis/sis_tex.c +++ b/src/mesa/drivers/dri/sis/sis_tex.c @@ -107,7 +107,7 @@ sisAllocTexImage( sisContextPtr smesa, sisTexObjPtr t, int level, } assert(t->format == image->_BaseFormat); - texel_size = image->TexFormat->TexelBytes; + texel_size = _mesa_get_format_bytes(image->TexFormat->MesaFormat); size = image->Width * image->Height * texel_size + TEXTURE_HW_PLUS; addr = sisAllocFB( smesa, size, &t->image[level].handle ); -- cgit v1.2.3 From ddffe4546a81216cde4376ee49cbaa021f4d04bb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 20:40:35 -0600 Subject: drivers: use more mesa format functions --- src/mesa/drivers/dri/intel/intel_fbo.c | 15 +++++++++------ src/mesa/drivers/dri/intel/intel_tex_image.c | 5 ++--- src/mesa/drivers/dri/r300/r300_tex.c | 7 +++++-- src/mesa/drivers/dri/r300/r300_texstate.c | 2 +- src/mesa/drivers/dri/r600/r600_tex.c | 6 ++++-- src/mesa/drivers/dri/radeon/radeon_fbo.c | 19 +++++++++++-------- 6 files changed, 32 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 8dfb24290d..0a3d0654d7 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -466,6 +466,7 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb, struct gl_texture_image *texImage) { irb->texformat = texImage->TexFormat; + gl_format texFormat; if (texImage->TexFormat == &_mesa_texformat_argb8888) { irb->Base._ActualFormat = GL_RGBA8; @@ -509,15 +510,17 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb, return GL_FALSE; } + texFormat = texImage->TexFormat->MesaFormat; + irb->Base.InternalFormat = irb->Base._ActualFormat; irb->Base.Width = texImage->Width; irb->Base.Height = texImage->Height; - irb->Base.RedBits = texImage->TexFormat->RedBits; - irb->Base.GreenBits = texImage->TexFormat->GreenBits; - irb->Base.BlueBits = texImage->TexFormat->BlueBits; - irb->Base.AlphaBits = texImage->TexFormat->AlphaBits; - irb->Base.DepthBits = texImage->TexFormat->DepthBits; - irb->Base.StencilBits = texImage->TexFormat->StencilBits; + irb->Base.RedBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE); + irb->Base.GreenBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE); + irb->Base.BlueBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE); + irb->Base.AlphaBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE); + irb->Base.DepthBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE_ARB); + irb->Base.StencilBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_STENCIL_SIZE_EXT); irb->Base.Delete = intel_delete_renderbuffer; irb->Base.AllocStorage = intel_nop_alloc_storage; diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 3bafbba371..a9f031a3cb 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -404,19 +404,18 @@ intelTexImage(GLcontext * ctx, } else if (intelImage->base.Border == 0) { int comp_byte = 0; GLuint texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat->MesaFormat); - + GLenum baseFormat = _mesa_get_format_base_format(intelImage->base.TexFormat->MesaFormat); if (intelImage->base.IsCompressed) { comp_byte = intel_compressed_num_bytes(intelImage->base.TexFormat->MesaFormat); } - /* Didn't fit in the object miptree, but it's suitable for inclusion in * a miptree, so create one just for our level and store it in the image. * It'll get moved into the object miptree at validate time. */ intelImage->mt = intel_miptree_create(intel, target, - intelImage->base.TexFormat->BaseFormat, + baseFormat, internalFormat, level, level, width, height, depth, diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c index 433e5a87d4..10daeca9e6 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.c +++ b/src/mesa/drivers/dri/r300/r300_tex.c @@ -196,6 +196,7 @@ static void r300TexParameter(GLcontext * ctx, GLenum target, GLenum pname, const GLfloat * params) { radeonTexObj* t = radeon_tex_obj(texObj); + GLenum texBaseFormat; if (RADEON_DEBUG & (RADEON_STATE | RADEON_TEXTURE)) { fprintf(stderr, "%s( %s )\n", __FUNCTION__, @@ -238,8 +239,10 @@ static void r300TexParameter(GLcontext * ctx, GLenum target, case GL_DEPTH_TEXTURE_MODE: if (!texObj->Image[0][texObj->BaseLevel]) return; - if (texObj->Image[0][texObj->BaseLevel]->TexFormat->BaseFormat - == GL_DEPTH_COMPONENT) { + texBaseFormat = texObj->Image[0][texObj->BaseLevel]->_BaseFormat; + + if (texBaseFormat == GL_DEPTH_COMPONENT || + texBaseFormat == GL_DEPTH_STENCIL) { r300SetDepthTexMode(texObj); break; } else { diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index f030451b28..cc40e0d1dc 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -209,7 +209,7 @@ static void setup_hardware_state(r300ContextPtr rmesa, radeonTexObj *t) if (!t->image_override && VALID_FORMAT(firstImage->TexFormat->MesaFormat)) { - if (firstImage->TexFormat->BaseFormat == GL_DEPTH_COMPONENT) { + if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) { r300SetDepthTexMode(&t->base); } else { t->pp_txformat = tx_table[firstImage->TexFormat->MesaFormat].format; diff --git a/src/mesa/drivers/dri/r600/r600_tex.c b/src/mesa/drivers/dri/r600/r600_tex.c index d105b90cd1..47081c968e 100644 --- a/src/mesa/drivers/dri/r600/r600_tex.c +++ b/src/mesa/drivers/dri/r600/r600_tex.c @@ -286,6 +286,7 @@ static void r600TexParameter(GLcontext * ctx, GLenum target, GLenum pname, const GLfloat * params) { radeonTexObj* t = radeon_tex_obj(texObj); + GLenum baseFormat; radeon_print(RADEON_STATE | RADEON_TEXTURE, RADEON_VERBOSE, "%s( %s )\n", __FUNCTION__, @@ -327,8 +328,9 @@ static void r600TexParameter(GLcontext * ctx, GLenum target, case GL_DEPTH_TEXTURE_MODE: if (!texObj->Image[0][texObj->BaseLevel]) return; - if (texObj->Image[0][texObj->BaseLevel]->TexFormat->BaseFormat - == GL_DEPTH_COMPONENT) { + baseFormat = texObj->Image[0][texObj->BaseLevel]->_BaseFormat; + if (baseFormat == GL_DEPTH_COMPONENT || + baseFormat == GL_DEPTH_STENCIL) { r600SetDepthTexMode(texObj); break; } else { diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 7ac53ec0ca..f19170b612 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -387,6 +387,8 @@ radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb, struct gl_texture_image *texImage) { int retry = 0; + gl_format texFormat; + restart: if (texImage->TexFormat == &_mesa_texformat_argb8888) { rrb->cpp = 4; @@ -438,24 +440,25 @@ restart: return GL_FALSE; } texImage->TexFormat = radeonChooseTextureFormat(ctx, texImage->InternalFormat, 0, - texImage->TexFormat->DataType, + _mesa_get_format_datatype(texImage->TexFormat->MesaFormat), 1); retry++; goto restart; } + texFormat = texImage->TexFormat->MesaFormat; + rrb->pitch = texImage->Width * rrb->cpp; rrb->base.InternalFormat = rrb->base._ActualFormat; rrb->base.Width = texImage->Width; rrb->base.Height = texImage->Height; - rrb->base.RedBits = texImage->TexFormat->RedBits; - rrb->base.GreenBits = texImage->TexFormat->GreenBits; - rrb->base.BlueBits = texImage->TexFormat->BlueBits; - rrb->base.AlphaBits = texImage->TexFormat->AlphaBits; - rrb->base.DepthBits = texImage->TexFormat->DepthBits; - rrb->base.StencilBits = texImage->TexFormat->StencilBits; - + rrb->Base.RedBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE); + rrb->Base.GreenBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE); + rrb->Base.BlueBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE); + rrb->Base.AlphaBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE); + rrb->Base.DepthBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE_ARB); + rrb->Base.StencilBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_STENCIL_SIZE_EXT); rrb->base.Delete = radeon_delete_renderbuffer; rrb->base.AllocStorage = radeon_nop_alloc_storage; -- cgit v1.2.3 From 5978cbdf7728df7952c9c04165ece23394a5fb95 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 20:40:53 -0600 Subject: mesa: code movement --- src/mesa/main/formats.c | 78 ++++++++++++++++++++++++------------------------- src/mesa/main/formats.h | 13 ++++----- 2 files changed, 45 insertions(+), 46 deletions(-) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index afa2398ed4..2ad5685883 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -594,6 +594,45 @@ _mesa_get_format_bytes(gl_format format) } +GLint +_mesa_get_format_bits(gl_format format, GLenum pname) +{ + const struct gl_format_info *info = _mesa_get_format_info(format); + + switch (pname) { + case GL_TEXTURE_RED_SIZE: + return info->RedBits; + case GL_TEXTURE_GREEN_SIZE: + return info->GreenBits; + case GL_TEXTURE_BLUE_SIZE: + return info->BlueBits; + case GL_TEXTURE_ALPHA_SIZE: + return info->AlphaBits; + case GL_TEXTURE_INTENSITY_SIZE: + return info->IntensityBits; + case GL_TEXTURE_LUMINANCE_SIZE: + return info->LuminanceBits; + case GL_TEXTURE_INDEX_SIZE_EXT: + return info->IndexBits; + case GL_TEXTURE_DEPTH_SIZE_ARB: + return info->DepthBits; + case GL_TEXTURE_STENCIL_SIZE_EXT: + return info->StencilBits; + default: + _mesa_problem(NULL, "bad pname in _mesa_get_format_bits()"); + return 0; + } +} + + +GLenum +_mesa_get_format_datatype(gl_format format) +{ + const struct gl_format_info *info = _mesa_get_format_info(format); + return info->DataType; +} + + GLenum _mesa_get_format_base_format(gl_format format) { @@ -785,42 +824,3 @@ _mesa_format_to_type_and_comps2(gl_format format, *datatype = GL_UNSIGNED_BYTE; } } - - -GLint -_mesa_get_format_bits(gl_format format, GLenum pname) -{ - const struct gl_format_info *info = _mesa_get_format_info(format); - - switch (pname) { - case GL_TEXTURE_RED_SIZE: - return info->RedBits; - case GL_TEXTURE_GREEN_SIZE: - return info->GreenBits; - case GL_TEXTURE_BLUE_SIZE: - return info->BlueBits; - case GL_TEXTURE_ALPHA_SIZE: - return info->AlphaBits; - case GL_TEXTURE_INTENSITY_SIZE: - return info->IntensityBits; - case GL_TEXTURE_LUMINANCE_SIZE: - return info->LuminanceBits; - case GL_TEXTURE_INDEX_SIZE_EXT: - return info->IndexBits; - case GL_TEXTURE_DEPTH_SIZE_ARB: - return info->DepthBits; - case GL_TEXTURE_STENCIL_SIZE_EXT: - return info->StencilBits; - default: - _mesa_problem(NULL, "bad pname in _mesa_get_format_bits()"); - return 0; - } -} - - -GLenum -_mesa_get_format_datatype(gl_format format) -{ - const struct gl_format_info *info = _mesa_get_format_info(format); - return info->DataType; -} diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index ad93fef2fc..dbde28e727 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -198,6 +198,12 @@ struct gl_format_info extern GLuint _mesa_get_format_bytes(gl_format format); +extern GLint +_mesa_get_format_bits(gl_format format, GLenum pname); + +extern GLenum +_mesa_get_format_datatype(gl_format format); + extern GLenum _mesa_get_format_base_format(gl_format format); @@ -208,13 +214,6 @@ extern void _mesa_format_to_type_and_comps2(gl_format format, GLenum *datatype, GLuint *comps); -extern GLint -_mesa_get_format_bits(gl_format format, GLenum pname); - -extern GLenum -_mesa_get_format_datatype(gl_format format); - - extern void _mesa_test_formats(void); -- cgit v1.2.3 From 5cf5d4be21bdac203dc244e9b773a852ddb1baf1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 20:51:18 -0600 Subject: mesa: use more format helper functions --- src/mesa/main/fbobject.c | 14 +++++++++----- src/mesa/main/texgetimage.c | 30 ++++++++++++++++++------------ 2 files changed, 27 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 13f49da5a7..04419da6e5 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -35,6 +35,7 @@ #include "buffers.h" #include "context.h" #include "fbobject.h" +#include "formats.h" #include "framebuffer.h" #include "hash.h" #include "macros.h" @@ -356,6 +357,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, if (att->Type == GL_TEXTURE) { const struct gl_texture_object *texObj = att->Texture; struct gl_texture_image *texImage; + GLenum baseFormat; if (!texObj) { att_incomplete("no texobj"); @@ -382,26 +384,28 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, return; } + baseFormat = _mesa_get_format_base_format(texImage->TexFormat->MesaFormat); + if (format == GL_COLOR) { - if (texImage->TexFormat->BaseFormat != GL_RGB && - texImage->TexFormat->BaseFormat != GL_RGBA) { + if (baseFormat != GL_RGB && + baseFormat != GL_RGBA) { att_incomplete("bad format"); att->Complete = GL_FALSE; return; } - if (texImage->TexFormat->TexelBytes == 0) { + if (_mesa_is_format_compressed(texImage->TexFormat->MesaFormat)) { att_incomplete("compressed internalformat"); att->Complete = GL_FALSE; return; } } else if (format == GL_DEPTH) { - if (texImage->TexFormat->BaseFormat == GL_DEPTH_COMPONENT) { + if (baseFormat == GL_DEPTH_COMPONENT) { /* OK */ } else if (ctx->Extensions.EXT_packed_depth_stencil && ctx->Extensions.ARB_depth_texture && - texImage->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT) { + baseFormat == GL_DEPTH_STENCIL_EXT) { /* OK */ } else { diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 14d6fc7659..2575d0d868 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -160,15 +160,16 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, if (format == GL_COLOR_INDEX) { GLuint indexRow[MAX_WIDTH]; GLint col; + GLuint indexBits = _mesa_get_format_bits(texImage->TexFormat->MesaFormat, GL_TEXTURE_INDEX_SIZE_EXT); /* Can't use FetchTexel here because that returns RGBA */ - if (texImage->TexFormat->IndexBits == 8) { + if (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) { + else if (indexBits == 16) { const GLushort *src = (const GLushort *) texImage->Data; src += width * (img * texImage->Height + row); for (col = 0; col < width; col++) { @@ -257,6 +258,8 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, GLfloat rgba[MAX_WIDTH][4]; GLint col; GLbitfield transferOps = 0x0; + GLenum dataType = + _mesa_get_format_datatype(texImage->TexFormat->MesaFormat); /* clamp does not apply to GetTexImage (final conversion)? * Looks like we need clamp though when going from format @@ -265,8 +268,8 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, 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)) + (dataType == GL_FLOAT || + dataType == GL_SIGNED_NORMALIZED)) transferOps |= IMAGE_CLAMP_BIT; for (col = 0; col < width; col++) { @@ -372,6 +375,7 @@ getteximage_error_check(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_object *texObj; struct gl_texture_image *texImage; const GLuint maxLevels = _mesa_max_texture_levels(ctx, target); + GLenum baseFormat; if (maxLevels == 0) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target=0x%x)", target); @@ -434,40 +438,42 @@ getteximage_error_check(GLcontext *ctx, GLenum target, GLint level, /* out of memory */ return GL_TRUE; } + + baseFormat = _mesa_get_format_base_format(texImage->TexFormat->MesaFormat); /* Make sure the requested image format is compatible with the * texture's format. Note that a color index texture can be converted * to RGBA so that combo is allowed. */ if (_mesa_is_color_format(format) - && !_mesa_is_color_format(texImage->TexFormat->BaseFormat) - && !_mesa_is_index_format(texImage->TexFormat->BaseFormat)) { + && !_mesa_is_color_format(baseFormat) + && !_mesa_is_index_format(baseFormat)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); return GL_TRUE; } else if (_mesa_is_index_format(format) - && !_mesa_is_index_format(texImage->TexFormat->BaseFormat)) { + && !_mesa_is_index_format(baseFormat)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); return GL_TRUE; } else if (_mesa_is_depth_format(format) - && !_mesa_is_depth_format(texImage->TexFormat->BaseFormat) - && !_mesa_is_depthstencil_format(texImage->TexFormat->BaseFormat)) { + && !_mesa_is_depth_format(baseFormat) + && !_mesa_is_depthstencil_format(baseFormat)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); return GL_TRUE; } else if (_mesa_is_ycbcr_format(format) - && !_mesa_is_ycbcr_format(texImage->TexFormat->BaseFormat)) { + && !_mesa_is_ycbcr_format(baseFormat)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); return GL_TRUE; } else if (_mesa_is_depthstencil_format(format) - && !_mesa_is_depthstencil_format(texImage->TexFormat->BaseFormat)) { + && !_mesa_is_depthstencil_format(baseFormat)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); return GL_TRUE; } else if (_mesa_is_dudv_format(format) - && !_mesa_is_dudv_format(texImage->TexFormat->BaseFormat)) { + && !_mesa_is_dudv_format(baseFormat)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetTexImage(format mismatch)"); return GL_TRUE; } -- cgit v1.2.3 From af0adb585223f6227f4c5c8564df8d7f6622d30f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 20:56:04 -0600 Subject: mesa: use more mesa format functions --- src/mesa/main/texparam.c | 48 +++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 1a88ad53b4..5f2c890ec8 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -727,6 +727,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, const struct gl_texture_image *img = NULL; GLboolean isProxy; GLint maxLevels; + gl_format texFormat; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -764,6 +765,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, goto out; } + texFormat = img->TexFormat->MesaFormat; + isProxy = _mesa_is_proxy_texture(target); switch (pname) { @@ -786,7 +789,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, case GL_TEXTURE_GREEN_SIZE: case GL_TEXTURE_BLUE_SIZE: if (img->_BaseFormat == GL_RGB || img->_BaseFormat == GL_RGBA) - *params = _mesa_get_format_bits(img->TexFormat->MesaFormat, pname); + *params = _mesa_get_format_bits(texFormat, pname); else *params = 0; break; @@ -794,7 +797,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, if (img->_BaseFormat == GL_ALPHA || img->_BaseFormat == GL_LUMINANCE_ALPHA || img->_BaseFormat == GL_RGBA) - *params = _mesa_get_format_bits(img->TexFormat->MesaFormat, pname); + *params = _mesa_get_format_bits(texFormat, pname); else *params = 0; break; @@ -802,11 +805,11 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, if (img->_BaseFormat != GL_INTENSITY) *params = 0; else { - *params = _mesa_get_format_bits(img->TexFormat->MesaFormat, pname); + *params = _mesa_get_format_bits(texFormat, pname); if (*params == 0) { /* intensity probably stored as rgb texture */ - *params = MIN2(_mesa_get_format_bits(img->TexFormat->MesaFormat, GL_TEXTURE_RED_SIZE), - _mesa_get_format_bits(img->TexFormat->MesaFormat, GL_TEXTURE_GREEN_SIZE)); + *params = MIN2(_mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE), + _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE)); } } break; @@ -815,23 +818,23 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, img->_BaseFormat != GL_LUMINANCE_ALPHA) *params = 0; else { - *params = _mesa_get_format_bits(img->TexFormat->MesaFormat, pname); + *params = _mesa_get_format_bits(texFormat, pname); if (img->TexFormat->LuminanceBits == 0) { /* luminance probably stored as rgb texture */ - *params = MIN2(_mesa_get_format_bits(img->TexFormat->MesaFormat, GL_TEXTURE_RED_SIZE), - _mesa_get_format_bits(img->TexFormat->MesaFormat, GL_TEXTURE_GREEN_SIZE)); + *params = MIN2(_mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE), + _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE)); } } break; case GL_TEXTURE_INDEX_SIZE_EXT: if (img->_BaseFormat == GL_COLOR_INDEX) - *params = _mesa_get_format_bits(img->TexFormat->MesaFormat, pname); + *params = _mesa_get_format_bits(texFormat, pname); else *params = 0; break; case GL_TEXTURE_DEPTH_SIZE_ARB: if (ctx->Extensions.ARB_depth_texture) - *params = _mesa_get_format_bits(img->TexFormat->MesaFormat, pname); + *params = _mesa_get_format_bits(texFormat, pname); else _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexLevelParameter[if]v(pname)"); @@ -839,7 +842,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, case GL_TEXTURE_STENCIL_SIZE_EXT: if (ctx->Extensions.EXT_packed_depth_stencil || ctx->Extensions.ARB_framebuffer_object) { - *params = _mesa_get_format_bits(img->TexFormat->MesaFormat, pname); + *params = _mesa_get_format_bits(texFormat, pname); } else { _mesa_error(ctx, GL_INVALID_ENUM, @@ -855,7 +858,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, */ *params = _mesa_compressed_texture_size(ctx, img->Width, img->Height, img->Depth, - img->TexFormat->MesaFormat); + texFormat); } else { _mesa_error(ctx, GL_INVALID_OPERATION, @@ -869,7 +872,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, /* GL_ARB_texture_float */ case GL_TEXTURE_RED_TYPE_ARB: if (ctx->Extensions.ARB_texture_float) { - *params = img->TexFormat->RedBits ? img->TexFormat->DataType : GL_NONE; + *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE) ? + _mesa_get_format_datatype(texFormat) : GL_NONE; } else { _mesa_error(ctx, GL_INVALID_ENUM, @@ -878,7 +882,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, break; case GL_TEXTURE_GREEN_TYPE_ARB: if (ctx->Extensions.ARB_texture_float) { - *params = img->TexFormat->GreenBits ? img->TexFormat->DataType : GL_NONE; + *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE) ? + _mesa_get_format_datatype(texFormat) : GL_NONE; } else { _mesa_error(ctx, GL_INVALID_ENUM, @@ -887,7 +892,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, break; case GL_TEXTURE_BLUE_TYPE_ARB: if (ctx->Extensions.ARB_texture_float) { - *params = img->TexFormat->BlueBits ? img->TexFormat->DataType : GL_NONE; + *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE) ? + _mesa_get_format_datatype(texFormat) : GL_NONE; } else { _mesa_error(ctx, GL_INVALID_ENUM, @@ -896,7 +902,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, break; case GL_TEXTURE_ALPHA_TYPE_ARB: if (ctx->Extensions.ARB_texture_float) { - *params = img->TexFormat->AlphaBits ? img->TexFormat->DataType : GL_NONE; + *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE) ? + _mesa_get_format_datatype(texFormat) : GL_NONE; } else { _mesa_error(ctx, GL_INVALID_ENUM, @@ -905,7 +912,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, break; case GL_TEXTURE_LUMINANCE_TYPE_ARB: if (ctx->Extensions.ARB_texture_float) { - *params = img->TexFormat->LuminanceBits ? img->TexFormat->DataType : GL_NONE; + *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_LUMINANCE_SIZE) ? + _mesa_get_format_datatype(texFormat) : GL_NONE; } else { _mesa_error(ctx, GL_INVALID_ENUM, @@ -914,7 +922,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, break; case GL_TEXTURE_INTENSITY_TYPE_ARB: if (ctx->Extensions.ARB_texture_float) { - *params = img->TexFormat->IntensityBits ? img->TexFormat->DataType : GL_NONE; + *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_INTENSITY_SIZE) ? + _mesa_get_format_datatype(texFormat) : GL_NONE; } else { _mesa_error(ctx, GL_INVALID_ENUM, @@ -923,7 +932,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, break; case GL_TEXTURE_DEPTH_TYPE_ARB: if (ctx->Extensions.ARB_texture_float) { - *params = img->TexFormat->DepthBits ? img->TexFormat->DataType : GL_NONE; + *params = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE) ? + _mesa_get_format_datatype(texFormat) : GL_NONE; } else { _mesa_error(ctx, GL_INVALID_ENUM, -- cgit v1.2.3 From a2b663fe38a6e42786092412402aacf8f6d071f8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 20:58:05 -0600 Subject: mesa: use more mesa format functions --- src/mesa/main/texrender.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c index 50e09c5d15..11073f76bf 100644 --- a/src/mesa/main/texrender.c +++ b/src/mesa/main/texrender.c @@ -462,6 +462,7 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att) { struct texture_renderbuffer *trb = (struct texture_renderbuffer *) att->Renderbuffer; + gl_format texFormat; (void) ctx; ASSERT(trb); @@ -484,6 +485,8 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att) trb->Zoffset = att->Zoffset; } + texFormat = trb->TexImage->TexFormat->MesaFormat; + trb->Base.Width = trb->TexImage->Width; trb->Base.Height = trb->TexImage->Height; trb->Base.InternalFormat = trb->TexImage->InternalFormat; @@ -513,12 +516,12 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att) #endif trb->Base.Data = trb->TexImage->Data; - trb->Base.RedBits = trb->TexImage->TexFormat->RedBits; - trb->Base.GreenBits = trb->TexImage->TexFormat->GreenBits; - trb->Base.BlueBits = trb->TexImage->TexFormat->BlueBits; - trb->Base.AlphaBits = trb->TexImage->TexFormat->AlphaBits; - trb->Base.DepthBits = trb->TexImage->TexFormat->DepthBits; - trb->Base.StencilBits = trb->TexImage->TexFormat->StencilBits; + trb->Base.RedBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE); + trb->Base.GreenBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE); + trb->Base.BlueBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE); + trb->Base.AlphaBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE); + trb->Base.DepthBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE_ARB); + trb->Base.StencilBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_STENCIL_SIZE_EXT); } -- cgit v1.2.3 From 5767a677a0129015dcc568b6f5d2d323fae8a63f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 20:59:28 -0600 Subject: mesa: fix GL_TEXTURE_LUMINANCE_SIZE query --- src/mesa/main/texparam.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 5f2c890ec8..d38d5a4c23 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -819,7 +819,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, *params = 0; else { *params = _mesa_get_format_bits(texFormat, pname); - if (img->TexFormat->LuminanceBits == 0) { + if (*params == 0) { /* luminance probably stored as rgb texture */ *params = MIN2(_mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE), _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE)); -- cgit v1.2.3 From e987ea9d2181acec2fc70538ffbb92d7ab15d918 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 21:07:57 -0600 Subject: mesa: use more mesa format functions --- src/mesa/main/texstore.c | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 33edf8a56a..6ebc9d6cc3 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3352,10 +3352,12 @@ fetch_texel_float_to_chan(const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texelOut) { GLfloat temp[4]; + GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat->MesaFormat); + ASSERT(texImage->FetchTexelf); texImage->FetchTexelf(texImage, i, j, k, temp); - if (texImage->TexFormat->BaseFormat == GL_DEPTH_COMPONENT || - texImage->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT) { + if (baseFormat == GL_DEPTH_COMPONENT || + baseFormat == GL_DEPTH_STENCIL_EXT) { /* just one channel */ UNCLAMPED_FLOAT_TO_CHAN(texelOut[0], temp[0]); } @@ -3377,10 +3379,12 @@ fetch_texel_chan_to_float(const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texelOut) { GLchan temp[4]; + GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat->MesaFormat); + ASSERT(texImage->FetchTexelc); texImage->FetchTexelc(texImage, i, j, k, temp); - if (texImage->TexFormat->BaseFormat == GL_DEPTH_COMPONENT || - texImage->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT) { + if (baseFormat == GL_DEPTH_COMPONENT || + baseFormat == GL_DEPTH_STENCIL_EXT) { /* just one channel */ texelOut[0] = CHAN_TO_FLOAT(temp[0]); } @@ -3423,9 +3427,10 @@ _mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims) static void compute_texture_size(GLcontext *ctx, struct gl_texture_image *texImage) { - if (texImage->TexFormat->TexelBytes == 0) { - /* must be a compressed format */ - texImage->IsCompressed = GL_TRUE; + texImage->IsCompressed = + _mesa_is_format_compressed(texImage->TexFormat->MesaFormat); + + if (texImage->IsCompressed) { texImage->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, texImage->Width, texImage->Height, texImage->Depth, @@ -3433,7 +3438,6 @@ compute_texture_size(GLcontext *ctx, struct gl_texture_image *texImage) } else { /* non-compressed format */ - texImage->IsCompressed = GL_FALSE; texImage->CompressedSize = 0; } } @@ -3471,7 +3475,7 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, if (texImage->IsCompressed) sizeInBytes = texImage->CompressedSize; else - sizeInBytes = texImage->Width * texImage->TexFormat->TexelBytes; + sizeInBytes = texImage->Width * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); texImage->Data = _mesa_alloc_texmemory(sizeInBytes); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); @@ -3540,7 +3544,7 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, _mesa_set_fetch_functions(texImage, 2); compute_texture_size(ctx, texImage); - texelBytes = texImage->TexFormat->TexelBytes; + texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); /* allocate memory */ if (texImage->IsCompressed) @@ -3574,7 +3578,7 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); } else { - dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes; + dstRowStride = texImage->RowStride * texelBytes; } success = storeImage(ctx, 2, texImage->_BaseFormat, @@ -3619,7 +3623,7 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, _mesa_set_fetch_functions(texImage, 3); compute_texture_size(ctx, texImage); - texelBytes = texImage->TexFormat->TexelBytes; + texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); /* allocate memory */ if (texImage->IsCompressed) @@ -3653,7 +3657,7 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); } else { - dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes; + dstRowStride = texImage->RowStride * texelBytes; } success = storeImage(ctx, 3, texImage->_BaseFormat, @@ -3751,7 +3755,8 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, texImage->Width); } else { - dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes; + dstRowStride = texImage->RowStride * + _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); } success = storeImage(ctx, 2, texImage->_BaseFormat, @@ -3804,7 +3809,8 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, texImage->Width); } else { - dstRowStride = texImage->RowStride * texImage->TexFormat->TexelBytes; + dstRowStride = texImage->RowStride * + _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); } success = storeImage(ctx, 3, texImage->_BaseFormat, @@ -3964,7 +3970,7 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, GLint i, rows; GLubyte *dest; const GLubyte *src; - const GLuint mesaFormat = texImage->TexFormat->MesaFormat; + const gl_format texFormat = texImage->TexFormat->MesaFormat; (void) format; @@ -3981,12 +3987,12 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, if (!data) return; - srcRowStride = _mesa_compressed_row_stride(mesaFormat, width); + srcRowStride = _mesa_compressed_row_stride(texFormat, width); src = (const GLubyte *) data; - destRowStride = _mesa_compressed_row_stride(mesaFormat, texImage->Width); + destRowStride = _mesa_compressed_row_stride(texFormat, texImage->Width); dest = _mesa_compressed_image_address(xoffset, yoffset, 0, - texImage->TexFormat->MesaFormat, + texFormat, texImage->Width, (GLubyte *) texImage->Data); -- cgit v1.2.3 From 4fc344790d0fefa3c38c63cadc4ee6a52633b006 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 21:13:46 -0600 Subject: mesa: update comments --- src/mesa/main/texcompress_fxt1.c | 4 ++-- src/mesa/main/texcompress_s3tc.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index 1a103ff14e..c401f82be0 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -63,7 +63,7 @@ _mesa_init_texture_fxt1( GLcontext *ctx ) /** - * Called via TexFormat->StoreImage to store an RGB_FXT1 texture. + * Store user's image in rgb_fxt1 format. */ GLboolean _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS) @@ -120,7 +120,7 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS) /** - * Called via TexFormat->StoreImage to store an RGBA_FXT1 texture. + * Store user's image in rgba_fxt1 format. */ GLboolean _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index 86492d05fb..2294fdca73 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -154,7 +154,7 @@ _mesa_init_texture_s3tc( GLcontext *ctx ) } /** - * Called via TexFormat->StoreImage to store an RGB_DXT1 texture. + * Store user's image in rgb_dxt1 format. */ GLboolean _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS) @@ -217,7 +217,7 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS) /** - * Called via TexFormat->StoreImage to store an RGBA_DXT1 texture. + * Store user's image in rgba_dxt1 format. */ GLboolean _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS) @@ -279,7 +279,7 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS) /** - * Called via TexFormat->StoreImage to store an RGBA_DXT3 texture. + * Store user's image in rgba_dxt3 format. */ GLboolean _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS) @@ -340,7 +340,7 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS) /** - * Called via TexFormat->StoreImage to store an RGBA_DXT5 texture. + * Store user's image in rgba_dxt5 format. */ GLboolean _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS) -- cgit v1.2.3 From ef089604a9cdcb4efa0850de393e04aa8d002fae Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 21:14:12 -0600 Subject: mesa: use texture format functions --- src/mesa/state_tracker/st_atom_sampler.c | 2 +- src/mesa/state_tracker/st_cb_texture.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index 50ce82811c..6611956ae8 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -209,7 +209,7 @@ update_samplers(struct st_context *st) } xlate_border_color(texobj->BorderColor, - teximg ? teximg->TexFormat->BaseFormat : GL_RGBA, + teximg ? teximg->_BaseFormat : GL_RGBA, sampler->border_color); sampler->max_anisotropy = texobj->MaxAnisotropy; diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 62ebdd8056..8bbffc3ff6 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -563,7 +563,7 @@ st_TexImage(GLcontext * ctx, _mesa_set_fetch_functions(texImage, dims); - if (texImage->TexFormat->TexelBytes == 0) { + if (_mesa_is_format_compressed(texImage->TexFormat->MesaFormat)) { /* must be a compressed format */ texelBytes = 0; texImage->IsCompressed = GL_TRUE; @@ -573,7 +573,7 @@ st_TexImage(GLcontext * ctx, texImage->TexFormat->MesaFormat); } else { - texelBytes = texImage->TexFormat->TexelBytes; + texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); /* Minimum pitch of 32 bytes */ if (postConvWidth * texelBytes < 32) { @@ -1838,7 +1838,7 @@ st_finalize_texture(GLcontext *ctx, cpp = compressed_num_bytes(firstImage->base.TexFormat->MesaFormat); } else { - cpp = firstImage->base.TexFormat->TexelBytes; + cpp = _mesa_get_format_bytes(firstImage->base.TexFormat->MesaFormat); } /* If we already have a gallium texture, check that it matches the texture -- cgit v1.2.3 From 749e50442a2a4e6a15434dfed47a9b87df353fa6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 21:14:43 -0600 Subject: mesa: fix render buffer _BaseFormat assignment --- src/mesa/main/texrender.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c index 11073f76bf..54e5668abc 100644 --- a/src/mesa/main/texrender.c +++ b/src/mesa/main/texrender.c @@ -507,13 +507,7 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att) trb->Base._ActualFormat = trb->TexImage->InternalFormat; trb->Base.DataType = CHAN_TYPE; } - trb->Base._BaseFormat = trb->TexImage->TexFormat->BaseFormat; -#if 0 - /* fix/avoid this assertion someday */ - ASSERT(trb->Base._BaseFormat == GL_RGB || - trb->Base._BaseFormat == GL_RGBA || - trb->Base._BaseFormat == GL_DEPTH_COMPONENT); -#endif + trb->Base._BaseFormat = trb->TexImage->_BaseFormat; trb->Base.Data = trb->TexImage->Data; trb->Base.RedBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE); -- cgit v1.2.3 From d52d51ab8ae1240f77b6c18c3e99be4bf4868037 Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Sun, 27 Sep 2009 23:14:52 -0400 Subject: g3dvl: Formatting and cleanups. --- src/gallium/auxiliary/vl/vl_bitstream_parser.c | 24 +- src/gallium/auxiliary/vl/vl_compositor.c | 62 ++--- src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 216 +++++---------- src/gallium/auxiliary/vl/vl_shader_build.c | 6 +- src/gallium/drivers/softpipe/sp_texture.c | 3 +- src/gallium/drivers/softpipe/sp_video_context.c | 332 +++++++++++------------ src/gallium/drivers/softpipe/sp_video_context.h | 16 +- src/gallium/state_trackers/xorg/xvmc/context.c | 26 +- src/gallium/state_trackers/xorg/xvmc/surface.c | 85 ++---- 9 files changed, 313 insertions(+), 457 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/vl/vl_bitstream_parser.c b/src/gallium/auxiliary/vl/vl_bitstream_parser.c index 356faa1348..7883b95bbe 100644 --- a/src/gallium/auxiliary/vl/vl_bitstream_parser.c +++ b/src/gallium/auxiliary/vl/vl_bitstream_parser.c @@ -23,12 +23,12 @@ show_bits(unsigned cursor, unsigned how_many_bits, const unsigned *bitstream) assert(bitstream); - if (cur_bit + how_many_bits > sizeof(unsigned) * CHAR_BIT) - { - return grab_bits(cur_bit, sizeof(unsigned) * CHAR_BIT - cur_bit, - bitstream[cur_int]) | - grab_bits(0, cur_bit + how_many_bits - sizeof(unsigned) * CHAR_BIT, - bitstream[cur_int + 1]) << (sizeof(unsigned) * CHAR_BIT - cur_bit); + if (cur_bit + how_many_bits > sizeof(unsigned) * CHAR_BIT) { + unsigned lower = grab_bits(cur_bit, sizeof(unsigned) * CHAR_BIT - cur_bit, + bitstream[cur_int]); + unsigned upper = grab_bits(0, cur_bit + how_many_bits - sizeof(unsigned) * CHAR_BIT, + bitstream[cur_int + 1]) + return lower | upper << (sizeof(unsigned) * CHAR_BIT - cur_bit); } else return grab_bits(cur_bit, how_many_bits, bitstream[cur_int]); @@ -87,16 +87,14 @@ vl_bitstream_parser_show_bits(struct vl_bitstream_parser *parser, cursor = parser->cursor; cur_bitstream = parser->cur_bitstream; - while (1) - { + while (1) { unsigned bits_left = parser->sizes[cur_bitstream] * CHAR_BIT - cursor; unsigned bits_to_show = how_many_bits > bits_left ? bits_left : how_many_bits; bits |= show_bits(cursor, bits_to_show, parser->bitstreams[cur_bitstream]) << shift; - if (how_many_bits > bits_to_show) - { + if (how_many_bits > bits_to_show) { how_many_bits -= bits_to_show; cursor = 0; ++cur_bitstream; @@ -117,8 +115,7 @@ void vl_bitstream_parser_forward(struct vl_bitstream_parser *parser, parser->cursor += how_many_bits; - while (parser->cursor > parser->sizes[parser->cur_bitstream] * CHAR_BIT) - { + while (parser->cursor > parser->sizes[parser->cur_bitstream] * CHAR_BIT) { parser->cursor -= parser->sizes[parser->cur_bitstream++] * CHAR_BIT; assert(parser->cur_bitstream < parser->num_bitstreams); } @@ -134,8 +131,7 @@ void vl_bitstream_parser_rewind(struct vl_bitstream_parser *parser, c = parser->cursor - how_many_bits; - while (c < 0) - { + while (c < 0) { c += parser->sizes[parser->cur_bitstream--] * CHAR_BIT; assert(parser->cur_bitstream < parser->num_bitstreams); } diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index 0894421c0b..bca03cd401 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -162,30 +162,28 @@ create_vert_shader(struct vl_compositor *c) ti = 3; /* - * decl i0 ; Vertex pos - * decl i1 ; Vertex texcoords + * decl i0 ; Vertex pos + * decl i1 ; Vertex texcoords */ - for (unsigned i = 0; i < 2; i++) - { + for (unsigned i = 0; i < 2; i++) { decl = vl_decl_input(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } /* - * decl c0 ; Scaling vector to scale vertex pos rect to destination size - * decl c1 ; Translation vector to move vertex pos rect into position - * decl c2 ; Scaling vector to scale texcoord rect to source size - * decl c3 ; Translation vector to move texcoord rect into position + * decl c0 ; Scaling vector to scale vertex pos rect to destination size + * decl c1 ; Translation vector to move vertex pos rect into position + * decl c2 ; Scaling vector to scale texcoord rect to source size + * decl c3 ; Translation vector to move texcoord rect into position */ decl = vl_decl_constants(TGSI_SEMANTIC_GENERIC, 0, 0, 3); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); /* - * decl o0 ; Vertex pos - * decl o1 ; Vertex texcoords + * decl o0 ; Vertex pos + * decl o1 ; Vertex texcoords */ - for (unsigned i = 0; i < 2; i++) - { + for (unsigned i = 0; i < 2; i++) { decl = vl_decl_output(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -195,11 +193,10 @@ create_vert_shader(struct vl_compositor *c) ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); /* - * mad o0, i0, c0, c1 ; Scale and translate unit output rect to destination size and pos - * mad o1, i1, c2, c3 ; Scale and translate unit texcoord rect to source size and pos + * mad o0, i0, c0, c1 ; Scale and translate unit output rect to destination size and pos + * mad o1, i1, c2, c3 ; Scale and translate unit texcoord rect to source size and pos */ - for (unsigned i = 0; i < 2; ++i) - { + for (unsigned i = 0; i < 2; ++i) { inst = vl_inst4(TGSI_OPCODE_MAD, TGSI_FILE_OUTPUT, i, TGSI_FILE_INPUT, i, TGSI_FILE_CONSTANT, i * 2, TGSI_FILE_CONSTANT, i * 2 + 1); ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } @@ -239,18 +236,18 @@ create_frag_shader(struct vl_compositor *c) ti = 3; - /* decl i0 ; Texcoords for s0 */ + /* decl i0 ; Texcoords for s0 */ decl = vl_decl_interpolated_input(TGSI_SEMANTIC_GENERIC, 1, 0, 0, TGSI_INTERPOLATE_LINEAR); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); /* - * decl c0 ; Bias vector for CSC - * decl c1-c4 ; CSC matrix c1-c4 + * decl c0 ; Bias vector for CSC + * decl c1-c4 ; CSC matrix c1-c4 */ decl = vl_decl_constants(TGSI_SEMANTIC_GENERIC, 0, 0, 4); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - /* decl o0 ; Fragment color */ + /* decl o0 ; Fragment color */ decl = vl_decl_output(TGSI_SEMANTIC_COLOR, 0, 0, 0); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); @@ -258,25 +255,24 @@ create_frag_shader(struct vl_compositor *c) decl = vl_decl_temps(0, 0); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - /* decl s0 ; Sampler for tex containing picture to display */ + /* decl s0 ; Sampler for tex containing picture to display */ decl = vl_decl_samplers(0, 0); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - /* tex2d t0, i0, s0 ; Read src pixel */ + /* tex2d t0, i0, s0 ; Read src pixel */ inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_INPUT, 0, TGSI_FILE_SAMPLER, 0); ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - /* sub t0, t0, c0 ; Subtract bias vector from pixel */ + /* sub t0, t0, c0 ; Subtract bias vector from pixel */ inst = vl_inst3(TGSI_OPCODE_SUB, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_CONSTANT, 0); ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); /* - * dp4 o0.x, t0, c1 ; Multiply pixel by the color conversion matrix + * dp4 o0.x, t0, c1 ; Multiply pixel by the color conversion matrix * dp4 o0.y, t0, c2 * dp4 o0.z, t0, c3 */ - for (unsigned i = 0; i < 3; ++i) - { + for (unsigned i = 0; i < 3; ++i) { inst = vl_inst3(TGSI_OPCODE_DP4, TGSI_FILE_OUTPUT, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_CONSTANT, i + 1); inst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); @@ -365,10 +361,10 @@ init_buffers(struct vl_compositor *c) c->vertex_bufs[0].buffer_offset = 0; c->vertex_bufs[0].buffer = pipe_buffer_create ( - c->pipe->screen, - 1, - PIPE_BUFFER_USAGE_VERTEX, - sizeof(struct vertex2f) * 4 + c->pipe->screen, + 1, + PIPE_BUFFER_USAGE_VERTEX, + sizeof(struct vertex2f) * 4 ); memcpy @@ -476,13 +472,11 @@ bool vl_compositor_init(struct vl_compositor *compositor, struct pipe_context *p if (!init_pipe_state(compositor)) return false; - if (!init_shaders(compositor)) - { + if (!init_shaders(compositor)) { cleanup_pipe_state(compositor); return false; } - if (!init_buffers(compositor)) - { + if (!init_buffers(compositor)) { cleanup_shaders(compositor); cleanup_pipe_state(compositor); return false; diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index 7e73c5ced9..b728067d79 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -99,8 +99,7 @@ create_intra_vert_shader(struct vl_mpeg12_mc_renderer *r) * decl i2 ; Chroma Cb texcoords * decl i3 ; Chroma Cr texcoords */ - for (unsigned i = 0; i < 4; i++) - { + for (unsigned i = 0; i < 4; i++) { decl = vl_decl_input(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -111,8 +110,7 @@ create_intra_vert_shader(struct vl_mpeg12_mc_renderer *r) * decl o2 ; Chroma Cb texcoords * decl o3 ; Chroma Cr texcoords */ - for (unsigned i = 0; i < 4; i++) - { + for (unsigned i = 0; i < 4; i++) { decl = vl_decl_output(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -123,8 +121,7 @@ create_intra_vert_shader(struct vl_mpeg12_mc_renderer *r) * mov o2, i2 ; Move input chroma Cb texcoords to output * mov o3, i3 ; Move input chroma Cr texcoords to output */ - for (unsigned i = 0; i < 4; ++i) - { + for (unsigned i = 0; i < 4; ++i) { inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_OUTPUT, i, TGSI_FILE_INPUT, i); ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } @@ -169,8 +166,7 @@ create_intra_frag_shader(struct vl_mpeg12_mc_renderer *r) * decl i1 ; Chroma Cb texcoords * decl i2 ; Chroma Cr texcoords */ - for (unsigned i = 0; i < 3; ++i) - { + for (unsigned i = 0; i < 3; ++i) { decl = vl_decl_interpolated_input(TGSI_SEMANTIC_GENERIC, i + 1, i, i, TGSI_INTERPOLATE_LINEAR); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -192,8 +188,7 @@ create_intra_frag_shader(struct vl_mpeg12_mc_renderer *r) * decl s1 ; Sampler for chroma Cb texture * decl s2 ; Sampler for chroma Cr texture */ - for (unsigned i = 0; i < 3; ++i) - { + for (unsigned i = 0; i < 3; ++i) { decl = vl_decl_samplers(i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -206,8 +201,7 @@ create_intra_frag_shader(struct vl_mpeg12_mc_renderer *r) * tex2d t1, i2, s2 ; Read texel from chroma Cr texture * mov t0.z, t1.x ; Move Cr sample into .z component */ - for (unsigned i = 0; i < 3; ++i) - { + for (unsigned i = 0; i < 3; ++i) { inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_INPUT, i, TGSI_FILE_SAMPLER, i); ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); @@ -266,8 +260,7 @@ create_frame_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) * decl i4 ; Ref surface top field texcoords * decl i5 ; Ref surface bottom field texcoords (unused, packed in the same stream) */ - for (unsigned i = 0; i < 6; i++) - { + for (unsigned i = 0; i < 6; i++) { decl = vl_decl_input(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -279,8 +272,7 @@ create_frame_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) * decl o3 ; Chroma Cr texcoords * decl o4 ; Ref macroblock texcoords */ - for (unsigned i = 0; i < 5; i++) - { + for (unsigned i = 0; i < 5; i++) { decl = vl_decl_output(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -291,8 +283,7 @@ create_frame_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) * mov o2, i2 ; Move input chroma Cb texcoords to output * mov o3, i3 ; Move input chroma Cr texcoords to output */ - for (unsigned i = 0; i < 4; ++i) - { + for (unsigned i = 0; i < 4; ++i) { inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_OUTPUT, i, TGSI_FILE_INPUT, i); ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } @@ -348,8 +339,7 @@ create_frame_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) * decl i2 ; Chroma Cr texcoords * decl i3 ; Ref macroblock texcoords */ - for (unsigned i = 0; i < 4; ++i) - { + for (unsigned i = 0; i < 4; ++i) { decl = vl_decl_interpolated_input(TGSI_SEMANTIC_GENERIC, i + 1, i, i, TGSI_INTERPOLATE_LINEAR); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -372,8 +362,7 @@ create_frame_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) * decl s2 ; Sampler for chroma Cr texture * decl s3 ; Sampler for ref surface texture */ - for (unsigned i = 0; i < 4; ++i) - { + for (unsigned i = 0; i < 4; ++i) { decl = vl_decl_samplers(i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -386,8 +375,7 @@ create_frame_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) * tex2d t1, i2, s2 ; Read texel from chroma Cr texture * mov t0.z, t1.x ; Move Cr sample into .z component */ - for (unsigned i = 0; i < 3; ++i) - { + for (unsigned i = 0; i < 3; ++i) { inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_INPUT, i, TGSI_FILE_SAMPLER, i); ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); @@ -462,8 +450,7 @@ create_frame_bi_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) * decl i6 ; Second ref macroblock top field texcoords * decl i7 ; Second ref macroblock bottom field texcoords (unused, packed in the same stream) */ - for (unsigned i = 0; i < 8; i++) - { + for (unsigned i = 0; i < 8; i++) { decl = vl_decl_input(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -476,8 +463,7 @@ create_frame_bi_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) * decl o4 ; First ref macroblock texcoords * decl o5 ; Second ref macroblock texcoords */ - for (unsigned i = 0; i < 6; i++) - { + for (unsigned i = 0; i < 6; i++) { decl = vl_decl_output(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -488,8 +474,7 @@ create_frame_bi_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) * mov o2, i2 ; Move input chroma Cb texcoords to output * mov o3, i3 ; Move input chroma Cr texcoords to output */ - for (unsigned i = 0; i < 4; ++i) - { + for (unsigned i = 0; i < 4; ++i) { inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_OUTPUT, i, TGSI_FILE_INPUT, i); ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } @@ -498,8 +483,7 @@ create_frame_bi_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) * add o4, i0, i4 ; Translate vertex pos by motion vec to form first ref macroblock texcoords * add o5, i0, i6 ; Translate vertex pos by motion vec to form second ref macroblock texcoords */ - for (unsigned i = 0; i < 2; ++i) - { + for (unsigned i = 0; i < 2; ++i) { inst = vl_inst3(TGSI_OPCODE_ADD, TGSI_FILE_OUTPUT, i + 4, TGSI_FILE_INPUT, 0, TGSI_FILE_INPUT, (i + 2) * 2); ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } @@ -552,8 +536,7 @@ create_frame_bi_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) * decl i3 ; First ref macroblock texcoords * decl i4 ; Second ref macroblock texcoords */ - for (unsigned i = 0; i < 5; ++i) - { + for (unsigned i = 0; i < 5; ++i) { decl = vl_decl_interpolated_input(TGSI_SEMANTIC_GENERIC, i + 1, i, i, TGSI_INTERPOLATE_LINEAR); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -580,8 +563,7 @@ create_frame_bi_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) * decl s3 ; Sampler for first ref surface texture * decl s4 ; Sampler for second ref surface texture */ - for (unsigned i = 0; i < 5; ++i) - { + for (unsigned i = 0; i < 5; ++i) { decl = vl_decl_samplers(i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -594,8 +576,7 @@ create_frame_bi_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) * tex2d t1, i2, s2 ; Read texel from chroma Cr texture * mov t0.z, t1.x ; Move Cr sample into .z component */ - for (unsigned i = 0; i < 3; ++i) - { + for (unsigned i = 0; i < 3; ++i) { inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_INPUT, i, TGSI_FILE_SAMPLER, i); ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); @@ -615,8 +596,7 @@ create_frame_bi_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) * tex2d t1, i3, s3 ; Read texel from first ref macroblock * tex2d t2, i4, s4 ; Read texel from second ref macroblock */ - for (unsigned i = 0; i < 2; ++i) - { + for (unsigned i = 0; i < 2; ++i) { inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, i + 1, TGSI_FILE_INPUT, i + 3, TGSI_FILE_SAMPLER, i + 3); ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } @@ -655,8 +635,7 @@ xfer_buffers_map(struct vl_mpeg12_mc_renderer *r) { assert(r); - for (unsigned i = 0; i < 3; ++i) - { + for (unsigned i = 0; i < 3; ++i) { r->tex_transfer[i] = r->pipe->screen->get_tex_transfer ( r->pipe->screen, r->textures.all[i], @@ -673,8 +652,7 @@ xfer_buffers_unmap(struct vl_mpeg12_mc_renderer *r) { assert(r); - for (unsigned i = 0; i < 3; ++i) - { + for (unsigned i = 0; i < 3; ++i) { r->pipe->screen->transfer_unmap(r->pipe->screen, r->tex_transfer[i]); r->pipe->screen->tex_transfer_destroy(r->tex_transfer[i]); } @@ -710,13 +688,11 @@ init_pipe_state(struct vl_mpeg12_mc_renderer *r) filters[0] = PIPE_TEX_FILTER_NEAREST; /* Chroma filters */ if (r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_444 || - r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE) - { + r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE) { filters[1] = PIPE_TEX_FILTER_NEAREST; filters[2] = PIPE_TEX_FILTER_NEAREST; } - else - { + else { filters[1] = PIPE_TEX_FILTER_LINEAR; filters[2] = PIPE_TEX_FILTER_LINEAR; } @@ -724,8 +700,7 @@ init_pipe_state(struct vl_mpeg12_mc_renderer *r) filters[3] = PIPE_TEX_FILTER_LINEAR; filters[4] = PIPE_TEX_FILTER_LINEAR; - for (unsigned i = 0; i < 5; ++i) - { + for (unsigned i = 0; i < 5; ++i) { 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; @@ -817,8 +792,7 @@ init_buffers(struct vl_mpeg12_mc_renderer *r) r->textures.individual.y = r->pipe->screen->texture_create(r->pipe->screen, &template); - if (r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420) - { + if (r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420) { template.width[0] = r->pot_buffers ? util_next_power_of_two(r->picture_width / 2) : r->picture_width / 2; @@ -847,8 +821,7 @@ init_buffers(struct vl_mpeg12_mc_renderer *r) sizeof(struct vertex2f) * 4 * 24 * r->macroblocks_per_batch ); - for (unsigned i = 1; i < 3; ++i) - { + for (unsigned i = 1; i < 3; ++i) { r->vertex_bufs.all[i].stride = sizeof(struct vertex2f) * 2; r->vertex_bufs.all[i].max_index = 24 * r->macroblocks_per_batch - 1; r->vertex_bufs.all[i].buffer_offset = 0; @@ -957,8 +930,7 @@ get_macroblock_type(struct pipe_mpeg12_macroblock *mb) { assert(mb); - switch (mb->mb_type) - { + switch (mb->mb_type) { case PIPE_MPEG12_MACROBLOCK_TYPE_INTRA: return MACROBLOCK_TYPE_INTRA; case PIPE_MPEG12_MACROBLOCK_TYPE_FWD: @@ -1058,8 +1030,7 @@ gen_macroblock_verts(struct vl_mpeg12_mc_renderer *r, assert(ycbcr_vb); assert(pos < r->macroblocks_per_batch); - switch (mb->mb_type) - { + switch (mb->mb_type) { case PIPE_MPEG12_MACROBLOCK_TYPE_BI: { struct vertex2f *vb; @@ -1071,21 +1042,17 @@ gen_macroblock_verts(struct vl_mpeg12_mc_renderer *r, mo_vec[0].x = mb->pmv[0][1][0] * 0.5f * r->surface_tex_inv_size.x; mo_vec[0].y = mb->pmv[0][1][1] * 0.5f * r->surface_tex_inv_size.y; - if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME) - { - for (unsigned i = 0; i < 24 * 2; i += 2) - { + if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME) { + for (unsigned i = 0; i < 24 * 2; i += 2) { vb[i].x = mo_vec[0].x; vb[i].y = mo_vec[0].y; } } - else - { + else { mo_vec[1].x = mb->pmv[1][1][0] * 0.5f * r->surface_tex_inv_size.x; mo_vec[1].y = mb->pmv[1][1][1] * 0.5f * r->surface_tex_inv_size.y; - for (unsigned i = 0; i < 24 * 2; i += 2) - { + for (unsigned i = 0; i < 24 * 2; i += 2) { vb[i].x = mo_vec[0].x; vb[i].y = mo_vec[0].y; vb[i + 1].x = mo_vec[1].x; @@ -1104,41 +1071,33 @@ gen_macroblock_verts(struct vl_mpeg12_mc_renderer *r, vb = ref_vb[0] + pos * 2 * 24; - if (mb->mb_type == PIPE_MPEG12_MACROBLOCK_TYPE_BKWD) - { + if (mb->mb_type == PIPE_MPEG12_MACROBLOCK_TYPE_BKWD) { mo_vec[0].x = mb->pmv[0][1][0] * 0.5f * r->surface_tex_inv_size.x; mo_vec[0].y = mb->pmv[0][1][1] * 0.5f * r->surface_tex_inv_size.y; - if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FIELD) - { + if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FIELD) { mo_vec[1].x = mb->pmv[1][1][0] * 0.5f * r->surface_tex_inv_size.x; mo_vec[1].y = mb->pmv[1][1][1] * 0.5f * r->surface_tex_inv_size.y; } } - else - { + else { mo_vec[0].x = mb->pmv[0][0][0] * 0.5f * r->surface_tex_inv_size.x; mo_vec[0].y = mb->pmv[0][0][1] * 0.5f * r->surface_tex_inv_size.y; - if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FIELD) - { + if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FIELD) { mo_vec[1].x = mb->pmv[1][0][0] * 0.5f * r->surface_tex_inv_size.x; mo_vec[1].y = mb->pmv[1][0][1] * 0.5f * r->surface_tex_inv_size.y; } } - if (mb->mb_type == PIPE_MPEG12_MOTION_TYPE_FRAME) - { - for (unsigned i = 0; i < 24 * 2; i += 2) - { + if (mb->mb_type == PIPE_MPEG12_MOTION_TYPE_FRAME) { + for (unsigned i = 0; i < 24 * 2; i += 2) { vb[i].x = mo_vec[0].x; vb[i].y = mo_vec[0].y; } } - else - { - for (unsigned i = 0; i < 24 * 2; i += 2) - { + else { + for (unsigned i = 0; i < 24 * 2; i += 2) { vb[i].x = mo_vec[0].x; vb[i].y = mo_vec[0].y; vb[i + 1].x = mo_vec[1].x; @@ -1198,8 +1157,7 @@ gen_macroblock_stream(struct vl_mpeg12_mc_renderer *r, assert(r); assert(num_macroblocks); - for (unsigned i = 0; i < r->num_macroblocks; ++i) - { + for (unsigned i = 0; i < r->num_macroblocks; ++i) { enum MACROBLOCK_TYPE mb_type = get_macroblock_type(&r->macroblock_buf[i]); ++num_macroblocks[mb_type]; } @@ -1224,8 +1182,7 @@ gen_macroblock_stream(struct vl_mpeg12_mc_renderer *r, PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_DISCARD ); - for (unsigned i = 0; i < r->num_macroblocks; ++i) - { + for (unsigned i = 0; i < r->num_macroblocks; ++i) { enum MACROBLOCK_TYPE mb_type = get_macroblock_type(&r->macroblock_buf[i]); gen_macroblock_verts(r, &r->macroblock_buf[i], offset[mb_type], @@ -1276,8 +1233,7 @@ flush(struct vl_mpeg12_mc_renderer *r) r->pipe->set_constant_buffer(r->pipe, PIPE_SHADER_FRAGMENT, 0, &r->fs_const_buf); - if (num_macroblocks[MACROBLOCK_TYPE_INTRA] > 0) - { + if (num_macroblocks[MACROBLOCK_TYPE_INTRA] > 0) { r->pipe->set_vertex_buffers(r->pipe, 1, r->vertex_bufs.all); r->pipe->set_vertex_elements(r->pipe, 4, r->vertex_elems); r->pipe->set_sampler_textures(r->pipe, 3, r->textures.all); @@ -1290,8 +1246,7 @@ flush(struct vl_mpeg12_mc_renderer *r) vb_start += num_macroblocks[MACROBLOCK_TYPE_INTRA] * 24; } - if (num_macroblocks[MACROBLOCK_TYPE_FWD_FRAME_PRED] > 0) - { + if (num_macroblocks[MACROBLOCK_TYPE_FWD_FRAME_PRED] > 0) { r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all); r->pipe->set_vertex_elements(r->pipe, 6, r->vertex_elems); r->textures.individual.ref[0] = r->past; @@ -1305,8 +1260,7 @@ flush(struct vl_mpeg12_mc_renderer *r) vb_start += num_macroblocks[MACROBLOCK_TYPE_FWD_FRAME_PRED] * 24; } - if (false /*num_macroblocks[MACROBLOCK_TYPE_FWD_FIELD_PRED] > 0 */ ) - { + if (false /*num_macroblocks[MACROBLOCK_TYPE_FWD_FIELD_PRED] > 0 */ ) { r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all); r->pipe->set_vertex_elements(r->pipe, 6, r->vertex_elems); r->textures.individual.ref[0] = r->past; @@ -1320,8 +1274,7 @@ flush(struct vl_mpeg12_mc_renderer *r) vb_start += num_macroblocks[MACROBLOCK_TYPE_FWD_FIELD_PRED] * 24; } - if (num_macroblocks[MACROBLOCK_TYPE_BKWD_FRAME_PRED] > 0) - { + if (num_macroblocks[MACROBLOCK_TYPE_BKWD_FRAME_PRED] > 0) { r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all); r->pipe->set_vertex_elements(r->pipe, 6, r->vertex_elems); r->textures.individual.ref[0] = r->future; @@ -1335,8 +1288,7 @@ flush(struct vl_mpeg12_mc_renderer *r) vb_start += num_macroblocks[MACROBLOCK_TYPE_BKWD_FRAME_PRED] * 24; } - if (false /*num_macroblocks[MACROBLOCK_TYPE_BKWD_FIELD_PRED] > 0 */ ) - { + if (false /*num_macroblocks[MACROBLOCK_TYPE_BKWD_FIELD_PRED] > 0 */ ) { r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all); r->pipe->set_vertex_elements(r->pipe, 6, r->vertex_elems); r->textures.individual.ref[0] = r->future; @@ -1350,8 +1302,7 @@ flush(struct vl_mpeg12_mc_renderer *r) vb_start += num_macroblocks[MACROBLOCK_TYPE_BKWD_FIELD_PRED] * 24; } - if (num_macroblocks[MACROBLOCK_TYPE_BI_FRAME_PRED] > 0) - { + if (num_macroblocks[MACROBLOCK_TYPE_BI_FRAME_PRED] > 0) { r->pipe->set_vertex_buffers(r->pipe, 3, r->vertex_bufs.all); r->pipe->set_vertex_elements(r->pipe, 8, r->vertex_elems); r->textures.individual.ref[0] = r->past; @@ -1366,8 +1317,7 @@ flush(struct vl_mpeg12_mc_renderer *r) vb_start += num_macroblocks[MACROBLOCK_TYPE_BI_FRAME_PRED] * 24; } - if (false /*num_macroblocks[MACROBLOCK_TYPE_BI_FIELD_PRED] > 0 */ ) - { + if (false /*num_macroblocks[MACROBLOCK_TYPE_BI_FIELD_PRED] > 0 */ ) { r->pipe->set_vertex_buffers(r->pipe, 3, r->vertex_bufs.all); r->pipe->set_vertex_elements(r->pipe, 8, r->vertex_elems); r->textures.individual.ref[0] = r->past; @@ -1436,20 +1386,15 @@ grab_blocks(struct vl_mpeg12_mc_renderer *r, unsigned mbx, unsigned mby, tex_pitch = r->tex_transfer[0]->stride / r->tex_transfer[0]->block.size; texels = r->texels[0] + mbpy * tex_pitch + mbpx; - for (unsigned y = 0; y < 2; ++y) - { - for (unsigned x = 0; x < 2; ++x, ++tb) - { - if ((cbp >> (5 - tb)) & 1) - { - if (dct_type == PIPE_MPEG12_DCT_TYPE_FRAME) - { + for (unsigned y = 0; y < 2; ++y) { + for (unsigned x = 0; x < 2; ++x, ++tb) { + if ((cbp >> (5 - tb)) & 1) { + if (dct_type == PIPE_MPEG12_DCT_TYPE_FRAME) { grab_frame_coded_block(blocks + sb * BLOCK_WIDTH * BLOCK_HEIGHT, texels + y * tex_pitch * BLOCK_WIDTH + x * BLOCK_WIDTH, tex_pitch); } - else - { + else { grab_field_coded_block(blocks + sb * BLOCK_WIDTH * BLOCK_HEIGHT, texels + y * tex_pitch + x * BLOCK_WIDTH, tex_pitch); @@ -1457,14 +1402,11 @@ grab_blocks(struct vl_mpeg12_mc_renderer *r, unsigned mbx, unsigned mby, ++sb; } - else if (r->eb_handling != VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_NONE) - { + else if (r->eb_handling != VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_NONE) { if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ALL || - ZERO_BLOCK_IS_NIL(r->zero_block[0])) - { + ZERO_BLOCK_IS_NIL(r->zero_block[0])) { fill_zero_block(texels + y * tex_pitch * BLOCK_WIDTH + x * BLOCK_WIDTH, tex_pitch); - if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE) - { + if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE) { r->zero_block[0].x = (mbpx + x * 8) * r->surface_tex_inv_size.x; r->zero_block[0].y = (mbpy + y * 8) * r->surface_tex_inv_size.y; } @@ -1479,24 +1421,19 @@ grab_blocks(struct vl_mpeg12_mc_renderer *r, unsigned mbx, unsigned mby, mbpx /= 2; mbpy /= 2; - for (tb = 0; tb < 2; ++tb) - { + for (tb = 0; tb < 2; ++tb) { tex_pitch = r->tex_transfer[tb + 1]->stride / r->tex_transfer[tb + 1]->block.size; texels = r->texels[tb + 1] + mbpy * tex_pitch + mbpx; - if ((cbp >> (1 - tb)) & 1) - { + if ((cbp >> (1 - tb)) & 1) { grab_frame_coded_block(blocks + sb * BLOCK_WIDTH * BLOCK_HEIGHT, texels, tex_pitch); ++sb; } - else if (r->eb_handling != VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_NONE) - { + else if (r->eb_handling != VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_NONE) { if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ALL || - ZERO_BLOCK_IS_NIL(r->zero_block[tb + 1])) - { + ZERO_BLOCK_IS_NIL(r->zero_block[tb + 1])) { fill_zero_block(texels, tex_pitch); - if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE) - { + if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE) { r->zero_block[tb + 1].x = (mbpx << 1) * r->surface_tex_inv_size.x; r->zero_block[tb + 1].y = (mbpy << 1) * r->surface_tex_inv_size.y; } @@ -1553,13 +1490,11 @@ vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer *renderer, if (!init_pipe_state(renderer)) return false; - if (!init_shaders(renderer)) - { + if (!init_shaders(renderer)) { cleanup_pipe_state(renderer); return false; } - if (!init_buffers(renderer)) - { + if (!init_buffers(renderer)) { cleanup_shaders(renderer); cleanup_pipe_state(renderer); return false; @@ -1607,12 +1542,9 @@ vl_mpeg12_mc_renderer_render_macroblocks(struct vl_mpeg12_mc_renderer assert(num_macroblocks); assert(mpeg12_macroblocks); - if (renderer->surface) - { - if (surface != renderer->surface) - { - if (renderer->num_macroblocks > 0) - { + if (renderer->surface) { + if (surface != renderer->surface) { + if (renderer->num_macroblocks > 0) { xfer_buffers_unmap(renderer); flush(renderer); } @@ -1627,8 +1559,7 @@ vl_mpeg12_mc_renderer_render_macroblocks(struct vl_mpeg12_mc_renderer else new_surface = true; - if (new_surface) - { + if (new_surface) { renderer->surface = surface; renderer->past = past; renderer->future = future; @@ -1637,21 +1568,18 @@ vl_mpeg12_mc_renderer_render_macroblocks(struct vl_mpeg12_mc_renderer renderer->surface_tex_inv_size.y = 1.0f / surface->height[0]; } - while (num_macroblocks) - { + while (num_macroblocks) { unsigned left_in_batch = renderer->macroblocks_per_batch - renderer->num_macroblocks; unsigned num_to_submit = MIN2(num_macroblocks, left_in_batch); - for (unsigned i = 0; i < num_to_submit; ++i) - { + for (unsigned i = 0; i < num_to_submit; ++i) { assert(mpeg12_macroblocks[i].base.codec == PIPE_VIDEO_CODEC_MPEG12); grab_macroblock(renderer, &mpeg12_macroblocks[i]); } num_macroblocks -= num_to_submit; - if (renderer->num_macroblocks == renderer->macroblocks_per_batch) - { + if (renderer->num_macroblocks == renderer->macroblocks_per_batch) { xfer_buffers_unmap(renderer); flush(renderer); xfer_buffers_map(renderer); diff --git a/src/gallium/auxiliary/vl/vl_shader_build.c b/src/gallium/auxiliary/vl/vl_shader_build.c index 5a4a5ab72c..9ad1e052c6 100644 --- a/src/gallium/auxiliary/vl/vl_shader_build.c +++ b/src/gallium/auxiliary/vl/vl_shader_build.c @@ -30,9 +30,9 @@ struct tgsi_full_declaration vl_decl_interpolated_input assert ( - interpolation == TGSI_INTERPOLATE_CONSTANT || - interpolation == TGSI_INTERPOLATE_LINEAR || - interpolation == TGSI_INTERPOLATE_PERSPECTIVE + interpolation == TGSI_INTERPOLATE_CONSTANT || + interpolation == TGSI_INTERPOLATE_LINEAR || + interpolation == TGSI_INTERPOLATE_PERSPECTIVE ); decl.Declaration.File = TGSI_FILE_INPUT; diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 45289380d0..1c64d58372 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -415,8 +415,7 @@ softpipe_video_surface_create(struct pipe_screen *screen, template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_RENDER_TARGET; sp_vsfc->tex = screen->texture_create(screen, &template); - if (!sp_vsfc->tex) - { + if (!sp_vsfc->tex) { FREE(sp_vsfc); return NULL; } diff --git a/src/gallium/drivers/softpipe/sp_video_context.c b/src/gallium/drivers/softpipe/sp_video_context.c index 1b47bbede2..3be33fbbdf 100644 --- a/src/gallium/drivers/softpipe/sp_video_context.c +++ b/src/gallium/drivers/softpipe/sp_video_context.c @@ -7,24 +7,24 @@ static void sp_mpeg12_destroy(struct pipe_video_context *vpipe) { - struct sp_mpeg12_context *ctx = (struct sp_mpeg12_context*)vpipe; + struct sp_mpeg12_context *ctx = (struct sp_mpeg12_context*)vpipe; - assert(vpipe); + assert(vpipe); - /* Asserted in softpipe_delete_fs_state() for some reason */ - ctx->pipe->bind_vs_state(ctx->pipe, NULL); - ctx->pipe->bind_fs_state(ctx->pipe, NULL); + /* Asserted in softpipe_delete_fs_state() for some reason */ + ctx->pipe->bind_vs_state(ctx->pipe, NULL); + ctx->pipe->bind_fs_state(ctx->pipe, NULL); - ctx->pipe->delete_blend_state(ctx->pipe, ctx->blend); - ctx->pipe->delete_rasterizer_state(ctx->pipe, ctx->rast); - ctx->pipe->delete_depth_stencil_alpha_state(ctx->pipe, ctx->dsa); + ctx->pipe->delete_blend_state(ctx->pipe, ctx->blend); + ctx->pipe->delete_rasterizer_state(ctx->pipe, ctx->rast); + ctx->pipe->delete_depth_stencil_alpha_state(ctx->pipe, ctx->dsa); - pipe_video_surface_reference(&ctx->decode_target, NULL); - vl_compositor_cleanup(&ctx->compositor); - vl_mpeg12_mc_renderer_cleanup(&ctx->mc_renderer); - ctx->pipe->destroy(ctx->pipe); + pipe_video_surface_reference(&ctx->decode_target, NULL); + vl_compositor_cleanup(&ctx->compositor); + vl_mpeg12_mc_renderer_cleanup(&ctx->mc_renderer); + ctx->pipe->destroy(ctx->pipe); - FREE(ctx); + FREE(ctx); } static void @@ -35,20 +35,20 @@ sp_mpeg12_decode_macroblocks(struct pipe_video_context *vpipe, struct pipe_macroblock *macroblocks, struct pipe_fence_handle **fence) { - struct sp_mpeg12_context *ctx = (struct sp_mpeg12_context*)vpipe; - struct pipe_mpeg12_macroblock *mpeg12_macroblocks = (struct pipe_mpeg12_macroblock*)macroblocks; + struct sp_mpeg12_context *ctx = (struct sp_mpeg12_context*)vpipe; + struct pipe_mpeg12_macroblock *mpeg12_macroblocks = (struct pipe_mpeg12_macroblock*)macroblocks; - assert(vpipe); - assert(num_macroblocks); - assert(macroblocks); - assert(macroblocks->codec == PIPE_VIDEO_CODEC_MPEG12); - assert(ctx->decode_target); + assert(vpipe); + assert(num_macroblocks); + assert(macroblocks); + assert(macroblocks->codec == PIPE_VIDEO_CODEC_MPEG12); + assert(ctx->decode_target); - vl_mpeg12_mc_renderer_render_macroblocks(&ctx->mc_renderer, - softpipe_video_surface(ctx->decode_target)->tex, - past ? softpipe_video_surface(past)->tex : NULL, - future ? softpipe_video_surface(future)->tex : NULL, - num_macroblocks, mpeg12_macroblocks, fence); + vl_mpeg12_mc_renderer_render_macroblocks(&ctx->mc_renderer, + softpipe_video_surface(ctx->decode_target)->tex, + past ? softpipe_video_surface(past)->tex : NULL, + future ? softpipe_video_surface(future)->tex : NULL, + num_macroblocks, mpeg12_macroblocks, fence); } static void @@ -58,12 +58,12 @@ sp_mpeg12_clear_surface(struct pipe_video_context *vpipe, unsigned value, struct pipe_surface *surface) { - struct sp_mpeg12_context *ctx = (struct sp_mpeg12_context*)vpipe; + struct sp_mpeg12_context *ctx = (struct sp_mpeg12_context*)vpipe; - assert(vpipe); - assert(surface); + assert(vpipe); + assert(surface); - ctx->pipe->surface_fill(ctx->pipe, surface, x, y, width, height, value); + ctx->pipe->surface_fill(ctx->pipe, surface, x, y, width, height, value); } static void @@ -85,106 +85,105 @@ sp_mpeg12_render_picture(struct pipe_video_context *vpipe, struct pipe_video_rect *layer_dst_areas*/ struct pipe_fence_handle **fence) { - struct sp_mpeg12_context *ctx = (struct sp_mpeg12_context*)vpipe; + struct sp_mpeg12_context *ctx = (struct sp_mpeg12_context*)vpipe; - assert(vpipe); - assert(src_surface); - assert(src_area); - assert(dst_surface); - assert(dst_area); + assert(vpipe); + assert(src_surface); + assert(src_area); + assert(dst_surface); + assert(dst_area); - vl_compositor_render(&ctx->compositor, softpipe_video_surface(src_surface)->tex, - picture_type, src_area, dst_surface->texture, dst_area, fence); + vl_compositor_render(&ctx->compositor, softpipe_video_surface(src_surface)->tex, + picture_type, src_area, dst_surface->texture, dst_area, fence); } static void sp_mpeg12_set_decode_target(struct pipe_video_context *vpipe, struct pipe_video_surface *dt) { - struct sp_mpeg12_context *ctx = (struct sp_mpeg12_context*)vpipe; + struct sp_mpeg12_context *ctx = (struct sp_mpeg12_context*)vpipe; - assert(vpipe); - assert(dt); + assert(vpipe); + assert(dt); - pipe_video_surface_reference(&ctx->decode_target, dt); + pipe_video_surface_reference(&ctx->decode_target, dt); } static bool init_pipe_state(struct sp_mpeg12_context *ctx) { - struct pipe_rasterizer_state rast; - struct pipe_blend_state blend; - struct pipe_depth_stencil_alpha_state dsa; + struct pipe_rasterizer_state rast; + struct pipe_blend_state blend; + struct pipe_depth_stencil_alpha_state dsa; - assert(ctx); + assert(ctx); - rast.flatshade = 1; - rast.flatshade_first = 0; - rast.light_twoside = 0; - rast.front_winding = PIPE_WINDING_CCW; - rast.cull_mode = PIPE_WINDING_CW; - rast.fill_cw = PIPE_POLYGON_MODE_FILL; - rast.fill_ccw = PIPE_POLYGON_MODE_FILL; - rast.offset_cw = 0; - rast.offset_ccw = 0; - rast.scissor = 0; - rast.poly_smooth = 0; - rast.poly_stipple_enable = 0; - rast.point_sprite = 0; - rast.point_size_per_vertex = 0; - rast.multisample = 0; - rast.line_smooth = 0; - rast.line_stipple_enable = 0; - rast.line_stipple_factor = 0; - rast.line_stipple_pattern = 0; - rast.line_last_pixel = 0; - rast.bypass_vs_clip_and_viewport = 0; - rast.line_width = 1; - rast.point_smooth = 0; - rast.point_size = 1; - rast.offset_units = 1; - rast.offset_scale = 1; - /*rast.sprite_coord_mode[i] = ;*/ - ctx->rast = ctx->pipe->create_rasterizer_state(ctx->pipe, &rast); - ctx->pipe->bind_rasterizer_state(ctx->pipe, ctx->rast); + rast.flatshade = 1; + rast.flatshade_first = 0; + rast.light_twoside = 0; + rast.front_winding = PIPE_WINDING_CCW; + rast.cull_mode = PIPE_WINDING_CW; + rast.fill_cw = PIPE_POLYGON_MODE_FILL; + rast.fill_ccw = PIPE_POLYGON_MODE_FILL; + rast.offset_cw = 0; + rast.offset_ccw = 0; + rast.scissor = 0; + rast.poly_smooth = 0; + rast.poly_stipple_enable = 0; + rast.point_sprite = 0; + rast.point_size_per_vertex = 0; + rast.multisample = 0; + rast.line_smooth = 0; + rast.line_stipple_enable = 0; + rast.line_stipple_factor = 0; + rast.line_stipple_pattern = 0; + rast.line_last_pixel = 0; + rast.bypass_vs_clip_and_viewport = 0; + rast.line_width = 1; + rast.point_smooth = 0; + rast.point_size = 1; + rast.offset_units = 1; + rast.offset_scale = 1; + /*rast.sprite_coord_mode[i] = ;*/ + ctx->rast = ctx->pipe->create_rasterizer_state(ctx->pipe, &rast); + ctx->pipe->bind_rasterizer_state(ctx->pipe, ctx->rast); - blend.blend_enable = 0; - blend.rgb_func = PIPE_BLEND_ADD; - blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE; - blend.rgb_dst_factor = PIPE_BLENDFACTOR_ONE; - blend.alpha_func = PIPE_BLEND_ADD; - blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE; - blend.alpha_dst_factor = PIPE_BLENDFACTOR_ONE; - blend.logicop_enable = 0; - blend.logicop_func = PIPE_LOGICOP_CLEAR; - /* Needed to allow color writes to FB, even if blending disabled */ - blend.colormask = PIPE_MASK_RGBA; - blend.dither = 0; - ctx->blend = ctx->pipe->create_blend_state(ctx->pipe, &blend); - ctx->pipe->bind_blend_state(ctx->pipe, ctx->blend); + blend.blend_enable = 0; + blend.rgb_func = PIPE_BLEND_ADD; + blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE; + blend.rgb_dst_factor = PIPE_BLENDFACTOR_ONE; + blend.alpha_func = PIPE_BLEND_ADD; + blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE; + blend.alpha_dst_factor = PIPE_BLENDFACTOR_ONE; + blend.logicop_enable = 0; + blend.logicop_func = PIPE_LOGICOP_CLEAR; + /* Needed to allow color writes to FB, even if blending disabled */ + blend.colormask = PIPE_MASK_RGBA; + blend.dither = 0; + ctx->blend = ctx->pipe->create_blend_state(ctx->pipe, &blend); + ctx->pipe->bind_blend_state(ctx->pipe, ctx->blend); - dsa.depth.enabled = 0; - dsa.depth.writemask = 0; - dsa.depth.func = PIPE_FUNC_ALWAYS; - dsa.depth.occlusion_count = 0; - for (unsigned i = 0; i < 2; ++i) - { - dsa.stencil[i].enabled = 0; - dsa.stencil[i].func = PIPE_FUNC_ALWAYS; - dsa.stencil[i].fail_op = PIPE_STENCIL_OP_KEEP; - dsa.stencil[i].zpass_op = PIPE_STENCIL_OP_KEEP; - dsa.stencil[i].zfail_op = PIPE_STENCIL_OP_KEEP; - dsa.stencil[i].ref_value = 0; - dsa.stencil[i].valuemask = 0; - dsa.stencil[i].writemask = 0; - } - dsa.alpha.enabled = 0; - dsa.alpha.func = PIPE_FUNC_ALWAYS; - dsa.alpha.ref_value = 0; - ctx->dsa = ctx->pipe->create_depth_stencil_alpha_state(ctx->pipe, &dsa); - ctx->pipe->bind_depth_stencil_alpha_state(ctx->pipe, ctx->dsa); + dsa.depth.enabled = 0; + dsa.depth.writemask = 0; + dsa.depth.func = PIPE_FUNC_ALWAYS; + dsa.depth.occlusion_count = 0; + for (unsigned i = 0; i < 2; ++i) { + dsa.stencil[i].enabled = 0; + dsa.stencil[i].func = PIPE_FUNC_ALWAYS; + dsa.stencil[i].fail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[i].zpass_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[i].zfail_op = PIPE_STENCIL_OP_KEEP; + dsa.stencil[i].ref_value = 0; + dsa.stencil[i].valuemask = 0; + dsa.stencil[i].writemask = 0; + } + dsa.alpha.enabled = 0; + dsa.alpha.func = PIPE_FUNC_ALWAYS; + dsa.alpha.ref_value = 0; + ctx->dsa = ctx->pipe->create_depth_stencil_alpha_state(ctx->pipe, &dsa); + ctx->pipe->bind_depth_stencil_alpha_state(ctx->pipe, ctx->dsa); - return true; + return true; } static struct pipe_video_context * @@ -192,65 +191,61 @@ sp_mpeg12_create(struct pipe_screen *screen, enum pipe_video_profile profile, enum pipe_video_chroma_format chroma_format, unsigned width, unsigned height) { - struct sp_mpeg12_context *ctx; + struct sp_mpeg12_context *ctx; - assert(u_reduce_video_profile(profile) == PIPE_VIDEO_CODEC_MPEG12); + assert(u_reduce_video_profile(profile) == PIPE_VIDEO_CODEC_MPEG12); - ctx = CALLOC_STRUCT(sp_mpeg12_context); + ctx = CALLOC_STRUCT(sp_mpeg12_context); - if (!ctx) - return NULL; + if (!ctx) + return NULL; - ctx->base.profile = profile; - ctx->base.chroma_format = chroma_format; - ctx->base.width = width; - ctx->base.height = height; + ctx->base.profile = profile; + ctx->base.chroma_format = chroma_format; + ctx->base.width = width; + ctx->base.height = height; - ctx->base.screen = screen; - ctx->base.destroy = sp_mpeg12_destroy; - ctx->base.decode_macroblocks = sp_mpeg12_decode_macroblocks; - ctx->base.clear_surface = sp_mpeg12_clear_surface; - ctx->base.render_picture = sp_mpeg12_render_picture; - ctx->base.set_decode_target = sp_mpeg12_set_decode_target; + ctx->base.screen = screen; + ctx->base.destroy = sp_mpeg12_destroy; + ctx->base.decode_macroblocks = sp_mpeg12_decode_macroblocks; + ctx->base.clear_surface = sp_mpeg12_clear_surface; + ctx->base.render_picture = sp_mpeg12_render_picture; + ctx->base.set_decode_target = sp_mpeg12_set_decode_target; - ctx->pipe = softpipe_create(screen); - if (!ctx->pipe) - { - FREE(ctx); - return NULL; - } + ctx->pipe = softpipe_create(screen); + if (!ctx->pipe) { + FREE(ctx); + return NULL; + } - /* TODO: Use slice buffering for softpipe when implemented, no advantage to buffering an entire picture */ - if (!vl_mpeg12_mc_renderer_init(&ctx->mc_renderer, ctx->pipe, - width, height, chroma_format, - VL_MPEG12_MC_RENDERER_BUFFER_PICTURE, - /* TODO: Use XFER_NONE when implemented */ - VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE, - true)) - { - ctx->pipe->destroy(ctx->pipe); - FREE(ctx); - return NULL; - } + /* TODO: Use slice buffering for softpipe when implemented, no advantage to buffering an entire picture */ + if (!vl_mpeg12_mc_renderer_init(&ctx->mc_renderer, ctx->pipe, + width, height, chroma_format, + VL_MPEG12_MC_RENDERER_BUFFER_PICTURE, + /* TODO: Use XFER_NONE when implemented */ + VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE, + true)) { + ctx->pipe->destroy(ctx->pipe); + FREE(ctx); + return NULL; + } - if (!vl_compositor_init(&ctx->compositor, ctx->pipe)) - { - vl_mpeg12_mc_renderer_cleanup(&ctx->mc_renderer); - ctx->pipe->destroy(ctx->pipe); - FREE(ctx); - return NULL; - } + if (!vl_compositor_init(&ctx->compositor, ctx->pipe)) { + vl_mpeg12_mc_renderer_cleanup(&ctx->mc_renderer); + ctx->pipe->destroy(ctx->pipe); + FREE(ctx); + return NULL; + } - if (!init_pipe_state(ctx)) - { - vl_compositor_cleanup(&ctx->compositor); - vl_mpeg12_mc_renderer_cleanup(&ctx->mc_renderer); - ctx->pipe->destroy(ctx->pipe); - FREE(ctx); - return NULL; - } + if (!init_pipe_state(ctx)) { + vl_compositor_cleanup(&ctx->compositor); + vl_mpeg12_mc_renderer_cleanup(&ctx->mc_renderer); + ctx->pipe->destroy(ctx->pipe); + FREE(ctx); + return NULL; + } - return &ctx->base; + return &ctx->base; } struct pipe_video_context * @@ -258,16 +253,15 @@ sp_video_create(struct pipe_screen *screen, enum pipe_video_profile profile, enum pipe_video_chroma_format chroma_format, unsigned width, unsigned height) { - assert(screen); - assert(width && height); + assert(screen); + assert(width && height); - switch (u_reduce_video_profile(profile)) - { - case PIPE_VIDEO_CODEC_MPEG12: - return sp_mpeg12_create(screen, profile, - chroma_format, - width, height); - default: - return NULL; - } + switch (u_reduce_video_profile(profile)) { + case PIPE_VIDEO_CODEC_MPEG12: + return sp_mpeg12_create(screen, profile, + chroma_format, + width, height); + default: + return NULL; + } } diff --git a/src/gallium/drivers/softpipe/sp_video_context.h b/src/gallium/drivers/softpipe/sp_video_context.h index a70ce9f476..2c7691c7cb 100644 --- a/src/gallium/drivers/softpipe/sp_video_context.h +++ b/src/gallium/drivers/softpipe/sp_video_context.h @@ -11,15 +11,15 @@ struct pipe_video_surface; struct sp_mpeg12_context { - struct pipe_video_context base; - struct pipe_context *pipe; - struct pipe_video_surface *decode_target; - struct vl_mpeg12_mc_renderer mc_renderer; - struct vl_compositor compositor; + struct pipe_video_context base; + struct pipe_context *pipe; + struct pipe_video_surface *decode_target; + struct vl_mpeg12_mc_renderer mc_renderer; + struct vl_compositor compositor; - void *rast; - void *dsa; - void *blend; + void *rast; + void *dsa; + void *blend; }; struct pipe_video_context * diff --git a/src/gallium/state_trackers/xorg/xvmc/context.c b/src/gallium/state_trackers/xorg/xvmc/context.c index 33f47838f5..ff2bd295ec 100644 --- a/src/gallium/state_trackers/xorg/xvmc/context.c +++ b/src/gallium/state_trackers/xorg/xvmc/context.c @@ -28,16 +28,13 @@ static Status Validate(Display *dpy, XvPortID port, int surface_type_id, *found_port = false; - for (unsigned int i = 0; i < XScreenCount(dpy); ++i) - { + for (unsigned int i = 0; i < XScreenCount(dpy); ++i) { ret = XvQueryAdaptors(dpy, XRootWindow(dpy, i), &num_adaptors, &adaptor_info); if (ret != Success) return ret; - for (unsigned int j = 0; j < num_adaptors && !*found_port; ++j) - { - for (unsigned int k = 0; k < adaptor_info[j].num_ports && !*found_port; ++k) - { + for (unsigned int j = 0; j < num_adaptors && !*found_port; ++j) { + for (unsigned int k = 0; k < adaptor_info[j].num_ports && !*found_port; ++k) { XvMCSurfaceInfo *surface_info; if (adaptor_info[j].base_id + k != port) @@ -46,14 +43,12 @@ static Status Validate(Display *dpy, XvPortID port, int surface_type_id, *found_port = true; surface_info = XvMCListSurfaceTypes(dpy, adaptor_info[j].base_id, &num_types); - if (!surface_info) - { + if (!surface_info) { XvFreeAdaptorInfo(adaptor_info); return BadAlloc; } - for (unsigned int l = 0; l < num_types && !found_surface; ++l) - { + for (unsigned int l = 0; l < num_types && !found_surface; ++l) { if (surface_info[l].surface_type_id != surface_type_id) continue; @@ -65,7 +60,7 @@ static Status Validate(Display *dpy, XvPortID port, int surface_type_id, *screen = i; } - XFree(surface_info); + XFree(surface_info); } } @@ -102,8 +97,7 @@ static enum pipe_video_profile ProfileToPipe(int xvmc_profile) static enum pipe_video_chroma_format FormatToPipe(int xvmc_format) { - switch (xvmc_format) - { + switch (xvmc_format) { case XVMC_CHROMA_FORMAT_420: return PIPE_VIDEO_CHROMA_FORMAT_420; case XVMC_CHROMA_FORMAT_422: @@ -148,8 +142,7 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id, /* TODO: Reuse screen if process creates another context */ screen = vl_screen_create(dpy, scrn); - if (!screen) - { + if (!screen) { FREE(context_priv); return BadAlloc; } @@ -157,8 +150,7 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id, vpipe = vl_video_create(screen, ProfileToPipe(mc_type), FormatToPipe(chroma_format), width, height); - if (!vpipe) - { + if (!vpipe) { screen->destroy(screen); FREE(context_priv); return BadAlloc; diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c index 0467c4d07d..6b7dbf11dc 100644 --- a/src/gallium/state_trackers/xorg/xvmc/surface.c +++ b/src/gallium/state_trackers/xorg/xvmc/surface.c @@ -24,8 +24,7 @@ static enum pipe_mpeg12_macroblock_type TypeToPipe(int xvmc_mb_type) static enum pipe_mpeg12_picture_type PictureToPipe(int xvmc_pic) { - switch (xvmc_pic) - { + switch (xvmc_pic) { case XVMC_TOP_FIELD: return PIPE_MPEG12_PICTURE_TYPE_FIELD_TOP; case XVMC_BOTTOM_FIELD: @@ -41,8 +40,7 @@ static enum pipe_mpeg12_picture_type PictureToPipe(int xvmc_pic) static enum pipe_mpeg12_motion_type MotionToPipe(int xvmc_motion_type, int xvmc_dct_type) { - switch (xvmc_motion_type) - { + switch (xvmc_motion_type) { case XVMC_PREDICTION_FRAME: return xvmc_dct_type == XVMC_DCT_TYPE_FIELD ? PIPE_MPEG12_MOTION_TYPE_16x8 : PIPE_MPEG12_MOTION_TYPE_FRAME; @@ -66,8 +64,7 @@ CreateOrResizeBackBuffer(struct pipe_video_context *vpipe, unsigned int width, u assert(vpipe); - if (*backbuffer) - { + if (*backbuffer) { if ((*backbuffer)->width != width || (*backbuffer)->height != height) pipe_surface_reference(backbuffer, NULL); else @@ -121,8 +118,7 @@ MacroBlocksToPipe(const XvMCMacroBlockArray *xvmc_macroblocks, xvmc_mb = xvmc_macroblocks->macro_blocks + first_macroblock; - for (i = 0; i < num_macroblocks; ++i) - { + for (i = 0; i < num_macroblocks; ++i) { pipe_macroblocks->base.codec = PIPE_VIDEO_CODEC_MPEG12; pipe_macroblocks->mbx = xvmc_mb->x; pipe_macroblocks->mby = xvmc_mb->y; @@ -171,8 +167,7 @@ Status XvMCCreateSurface(Display *dpy, XvMCContext *context, XvMCSurface *surfac vsfc = vpipe->screen->video_surface_create(vpipe->screen, vpipe->chroma_format, vpipe->width, vpipe->height); - if (!vsfc) - { + if (!vsfc) { FREE(surface_priv); return BadAlloc; } @@ -262,35 +257,21 @@ Status XvMCRenderSurface(Display *dpy, XvMCContext *context, unsigned int pictur Status XvMCFlushSurface(Display *dpy, XvMCSurface *surface) { -#if 0 - struct vlSurface *vl_sfc; - - assert(dpy); - - if (!surface) - return XvMCBadSurface; + assert(dpy); - vl_sfc = surface->privData; + if (!surface) + return XvMCBadSurface; - vlSurfaceFlush(vl_sfc); -#endif return Success; } Status XvMCSyncSurface(Display *dpy, XvMCSurface *surface) { -#if 0 - struct vlSurface *vl_sfc; - - assert(dpy); - - if (!surface) - return XvMCBadSurface; + assert(dpy); - vl_sfc = surface->privData; + if (!surface) + return XvMCBadSurface; - vlSurfaceSync(vl_sfc); -#endif return Success; } @@ -359,43 +340,15 @@ Status XvMCPutSurface(Display *dpy, XvMCSurface *surface, Drawable drawable, Status XvMCGetSurfaceStatus(Display *dpy, XvMCSurface *surface, int *status) { -#if 0 - struct vlSurface *vl_sfc; - enum vlResourceStatus res_status; - - assert(dpy); - - if (!surface) - return XvMCBadSurface; - - assert(status); - - vl_sfc = surface->privData; - - vlSurfaceGetStatus(vl_sfc, &res_status); - - switch (res_status) - { - case vlResourceStatusFree: - { - *status = 0; - break; - } - case vlResourceStatusRendering: - { - *status = XVMC_RENDERING; - break; - } - case vlResourceStatusDisplaying: - { - *status = XVMC_DISPLAYING; - break; - } - default: - assert(0); - } -#endif + assert(dpy); + + if (!surface) + return XvMCBadSurface; + + assert(status); + *status = 0; + return Success; } -- cgit v1.2.3 From bd00a7fa4bb4bb71cd2eaf7ebb6749a709b5fdb9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 21:22:57 -0600 Subject: mesa: sort texstore_funcs[] array, remove search loop --- src/mesa/main/texstore.c | 73 ++++++++++++++++++++++++++++-------------------- 1 file changed, 42 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 6ebc9d6cc3..d47f71d0e2 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3180,32 +3180,7 @@ static struct { } texstore_funcs[MESA_FORMAT_COUNT] = { - { MESA_FORMAT_RGBA, _mesa_texstore_rgba }, - { MESA_FORMAT_RGB, _mesa_texstore_rgba }, - { MESA_FORMAT_ALPHA, _mesa_texstore_rgba }, - { MESA_FORMAT_LUMINANCE, _mesa_texstore_rgba }, - { MESA_FORMAT_LUMINANCE_ALPHA, _mesa_texstore_rgba }, - { MESA_FORMAT_INTENSITY, _mesa_texstore_rgba }, - { MESA_FORMAT_SRGB8, _mesa_texstore_srgb8 }, - { MESA_FORMAT_SRGBA8, _mesa_texstore_srgba8 }, - { MESA_FORMAT_SARGB8, _mesa_texstore_sargb8 }, - { MESA_FORMAT_SL8, _mesa_texstore_sl8 }, - { MESA_FORMAT_SLA8, _mesa_texstore_sla8 }, - { MESA_FORMAT_RGBA_FLOAT32, _mesa_texstore_rgba_float32 }, - { MESA_FORMAT_RGBA_FLOAT16, _mesa_texstore_rgba_float16 }, - { MESA_FORMAT_RGB_FLOAT32, _mesa_texstore_rgba_float32 }, - { MESA_FORMAT_RGB_FLOAT16, _mesa_texstore_rgba_float16 }, - { MESA_FORMAT_ALPHA_FLOAT32, _mesa_texstore_rgba_float32 }, - { MESA_FORMAT_ALPHA_FLOAT16, _mesa_texstore_rgba_float16 }, - { MESA_FORMAT_LUMINANCE_FLOAT32, _mesa_texstore_rgba_float32 }, - { MESA_FORMAT_LUMINANCE_FLOAT16, _mesa_texstore_rgba_float16 }, - { MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, _mesa_texstore_rgba_float32 }, - { MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, _mesa_texstore_rgba_float16 }, - { MESA_FORMAT_INTENSITY_FLOAT32, _mesa_texstore_rgba_float32 }, - { MESA_FORMAT_INTENSITY_FLOAT16, _mesa_texstore_rgba_float16 }, - { MESA_FORMAT_DUDV8, _mesa_texstore_dudv8 }, - { MESA_FORMAT_SIGNED_RGBA8888, _mesa_texstore_signed_rgba8888 }, - { MESA_FORMAT_SIGNED_RGBA8888_REV, _mesa_texstore_signed_rgba8888 }, + { MESA_FORMAT_NONE, NULL }, { MESA_FORMAT_RGBA8888, _mesa_texstore_rgba8888 }, { MESA_FORMAT_RGBA8888_REV, _mesa_texstore_rgba8888 }, { MESA_FORMAT_ARGB8888, _mesa_texstore_argb8888 }, @@ -3229,13 +3204,47 @@ texstore_funcs[MESA_FORMAT_COUNT] = { MESA_FORMAT_CI8, _mesa_texstore_ci8 }, { MESA_FORMAT_YCBCR, _mesa_texstore_ycbcr }, { MESA_FORMAT_YCBCR_REV, _mesa_texstore_ycbcr }, - { MESA_FORMAT_RGB_FXT1, _mesa_texstore_rgb_fxt1 }, - { MESA_FORMAT_RGBA_FXT1, _mesa_texstore_rgba_fxt1 }, { MESA_FORMAT_Z24_S8, _mesa_texstore_z24_s8 }, { MESA_FORMAT_S8_Z24, _mesa_texstore_s8_z24 }, { MESA_FORMAT_Z16, _mesa_texstore_z16 }, { MESA_FORMAT_Z32, _mesa_texstore_z32 }, { MESA_FORMAT_S8, NULL/*_mesa_texstore_s8*/ }, + { MESA_FORMAT_SRGB8, _mesa_texstore_srgb8 }, + { MESA_FORMAT_SRGBA8, _mesa_texstore_srgba8 }, + { MESA_FORMAT_SARGB8, _mesa_texstore_sargb8 }, + { MESA_FORMAT_SL8, _mesa_texstore_sl8 }, + { MESA_FORMAT_SLA8, _mesa_texstore_sla8 }, + { MESA_FORMAT_SRGB_DXT1, _mesa_texstore_rgb_dxt1 }, + { MESA_FORMAT_SRGBA_DXT1, _mesa_texstore_rgba_dxt1 }, + { MESA_FORMAT_SRGBA_DXT3, _mesa_texstore_rgba_dxt3 }, + { MESA_FORMAT_SRGBA_DXT5, _mesa_texstore_rgba_dxt5 }, + { MESA_FORMAT_RGB_FXT1, _mesa_texstore_rgb_fxt1 }, + { MESA_FORMAT_RGBA_FXT1, _mesa_texstore_rgba_fxt1 }, + { MESA_FORMAT_RGB_DXT1, _mesa_texstore_rgb_dxt1 }, + { MESA_FORMAT_RGBA_DXT1, _mesa_texstore_rgba_dxt1 }, + { MESA_FORMAT_RGBA_DXT3, _mesa_texstore_rgba_dxt3 }, + { MESA_FORMAT_RGBA_DXT5, _mesa_texstore_rgba_dxt5 }, + { MESA_FORMAT_RGBA, _mesa_texstore_rgba }, + { MESA_FORMAT_RGB, _mesa_texstore_rgba }, + { MESA_FORMAT_ALPHA, _mesa_texstore_rgba }, + { MESA_FORMAT_LUMINANCE, _mesa_texstore_rgba }, + { MESA_FORMAT_LUMINANCE_ALPHA, _mesa_texstore_rgba }, + { MESA_FORMAT_INTENSITY, _mesa_texstore_rgba }, + { MESA_FORMAT_RGBA_FLOAT32, _mesa_texstore_rgba_float32 }, + { MESA_FORMAT_RGBA_FLOAT16, _mesa_texstore_rgba_float16 }, + { MESA_FORMAT_RGB_FLOAT32, _mesa_texstore_rgba_float32 }, + { MESA_FORMAT_RGB_FLOAT16, _mesa_texstore_rgba_float16 }, + { MESA_FORMAT_ALPHA_FLOAT32, _mesa_texstore_rgba_float32 }, + { MESA_FORMAT_ALPHA_FLOAT16, _mesa_texstore_rgba_float16 }, + { MESA_FORMAT_LUMINANCE_FLOAT32, _mesa_texstore_rgba_float32 }, + { MESA_FORMAT_LUMINANCE_FLOAT16, _mesa_texstore_rgba_float16 }, + { MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, _mesa_texstore_rgba_float32 }, + { MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, _mesa_texstore_rgba_float16 }, + { MESA_FORMAT_INTENSITY_FLOAT32, _mesa_texstore_rgba_float32 }, + { MESA_FORMAT_INTENSITY_FLOAT16, _mesa_texstore_rgba_float16 }, + { MESA_FORMAT_DUDV8, _mesa_texstore_dudv8 }, + { MESA_FORMAT_SIGNED_RGBA8888, _mesa_texstore_signed_rgba8888 }, + { MESA_FORMAT_SIGNED_RGBA8888_REV, _mesa_texstore_signed_rgba8888 }, }; @@ -3246,11 +3255,13 @@ StoreTexImageFunc _mesa_get_texstore_func(gl_format format) { GLuint i; +#ifdef DEBUG for (i = 0; i < MESA_FORMAT_COUNT; i++) { - if (texstore_funcs[i].Name == format) - return texstore_funcs[i].Store; + ASSERT(texstore_funcs[i].Name == i); } - return NULL; +#endif + ASSERT(texstore_funcs[format].Name == format); + return texstore_funcs[format].Store; } -- cgit v1.2.3 From 729ff875f4c951798d2372940608201a6b195ca6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 27 Sep 2009 21:32:12 -0600 Subject: mesa: change _mesa_format_to_type_and_comps() format parameter type --- src/mesa/main/mipmap.c | 10 +++++----- src/mesa/main/texformat.c | 7 +++---- src/mesa/main/texformat.h | 2 +- src/mesa/state_tracker/st_gen_mipmap.c | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index faa6c47cb7..0950d8abea 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1495,7 +1495,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, struct gl_texture_object *texObj) { const struct gl_texture_image *srcImage; - const struct gl_texture_format *convertFormat; + gl_format convertFormat; const GLubyte *srcData = NULL; GLubyte *dstData = NULL; GLint level, maxLevels; @@ -1521,11 +1521,11 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, texObj->Target == GL_TEXTURE_CUBE_MAP_ARB); if (srcImage->_BaseFormat == GL_RGB) { - convertFormat = &_mesa_texformat_rgb; + convertFormat = MESA_FORMAT_RGB; components = 3; } else if (srcImage->_BaseFormat == GL_RGBA) { - convertFormat = &_mesa_texformat_rgba; + convertFormat = MESA_FORMAT_RGBA; components = 4; } else { @@ -1561,7 +1561,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, } else { /* uncompressed */ - convertFormat = srcImage->TexFormat; + convertFormat = srcImage->TexFormat->MesaFormat; } _mesa_format_to_type_and_comps(convertFormat, &datatype, &comps); @@ -1664,7 +1664,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, if (dstImage->IsCompressed) { GLubyte *temp; /* compress image from dstData into dstImage->Data */ - const GLenum srcFormat = convertFormat->BaseFormat; + const GLenum srcFormat = _mesa_get_format_base_format(convertFormat); GLint dstRowStride = _mesa_compressed_row_stride(dstImage->TexFormat->MesaFormat, dstWidth); const StoreTexImageFunc storeImage = diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index dae98bcc6f..60b2065a6c 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -1351,14 +1351,13 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, /** - * Return datatype and number of components per texel for the - * given gl_texture_format. + * Return datatype and number of components per texel for the given gl_format. */ void -_mesa_format_to_type_and_comps(const struct gl_texture_format *format, +_mesa_format_to_type_and_comps(gl_format format, GLenum *datatype, GLuint *comps) { - switch (format->MesaFormat) { + switch (format) { case MESA_FORMAT_RGBA8888: case MESA_FORMAT_RGBA8888_REV: case MESA_FORMAT_ARGB8888: diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index 39d5ec640a..638eadff97 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -151,7 +151,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, extern void -_mesa_format_to_type_and_comps(const struct gl_texture_format *format, +_mesa_format_to_type_and_comps(gl_format format, GLenum *datatype, GLuint *comps); extern FetchTexelFuncF diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index 58f6933652..63a6956a7a 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -115,7 +115,7 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, assert(target != GL_TEXTURE_3D); /* not done yet */ - _mesa_format_to_type_and_comps(texObj->Image[face][baseLevel]->TexFormat, + _mesa_format_to_type_and_comps(texObj->Image[face][baseLevel]->TexFormat->MesaFormat, &datatype, &comps); for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) { -- cgit v1.2.3 From c0745670d830a644c1b398fb0c6bda165c1095fa Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Sun, 27 Sep 2009 23:54:36 -0400 Subject: g3dvl: Missing semicolon. --- src/gallium/auxiliary/vl/vl_bitstream_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/vl/vl_bitstream_parser.c b/src/gallium/auxiliary/vl/vl_bitstream_parser.c index 7883b95bbe..45826bad45 100644 --- a/src/gallium/auxiliary/vl/vl_bitstream_parser.c +++ b/src/gallium/auxiliary/vl/vl_bitstream_parser.c @@ -27,7 +27,7 @@ show_bits(unsigned cursor, unsigned how_many_bits, const unsigned *bitstream) unsigned lower = grab_bits(cur_bit, sizeof(unsigned) * CHAR_BIT - cur_bit, bitstream[cur_int]); unsigned upper = grab_bits(0, cur_bit + how_many_bits - sizeof(unsigned) * CHAR_BIT, - bitstream[cur_int + 1]) + bitstream[cur_int + 1]); return lower | upper << (sizeof(unsigned) * CHAR_BIT - cur_bit); } else -- cgit v1.2.3 From 70c44073ad3f333ed40c5c297a934a359c839e94 Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Mon, 28 Sep 2009 00:17:33 -0400 Subject: xvmc: Fail on unsupported formats, operations. --- src/gallium/state_trackers/xorg/xvmc/context.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xvmc/context.c b/src/gallium/state_trackers/xorg/xvmc/context.c index ff2bd295ec..6d90dfc367 100644 --- a/src/gallium/state_trackers/xorg/xvmc/context.c +++ b/src/gallium/state_trackers/xorg/xvmc/context.c @@ -7,11 +7,13 @@ #include #include #include +#include #include "xvmc_private.h" static Status Validate(Display *dpy, XvPortID port, int surface_type_id, unsigned int width, unsigned int height, int flags, - bool *found_port, int *screen, int *chroma_format, int *mc_type) + bool *found_port, int *screen, int *chroma_format, + int *mc_type, int *surface_flags) { bool found_surface = false; XvAdaptorInfo *adaptor_info; @@ -25,6 +27,7 @@ static Status Validate(Display *dpy, XvPortID port, int surface_type_id, assert(screen); assert(chroma_format); assert(mc_type); + assert(surface_flags); *found_port = false; @@ -57,6 +60,7 @@ static Status Validate(Display *dpy, XvPortID port, int surface_type_id, max_height = surface_info[l].max_height; *chroma_format = surface_info[l].chroma_format; *mc_type = surface_info[l].mc_type; + *surface_flags = surface_info[l].flags; *screen = i; } @@ -118,6 +122,7 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id, int scrn; int chroma_format; int mc_type; + int surface_flags; Status ret; struct pipe_screen *screen; struct pipe_video_context *vpipe; @@ -129,12 +134,26 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id, return XvMCBadContext; ret = Validate(dpy, port, surface_type_id, width, height, flags, - &found_port, &scrn, &chroma_format, &mc_type); + &found_port, &scrn, &chroma_format, &mc_type, &surface_flags); /* Success and XvBadPort have the same value */ if (ret != Success || !found_port) return ret; + /* XXX: Current limits */ + if (chroma_format != XVMC_CHROMA_FORMAT_420) { + debug_printf("[XvMCg3dvl] Cannot decode requested surface type. Unsupported chroma format.\n"); + return BadImplementation; + } + if (mc_type != (XVMC_MOCOMP | XVMC_MPEG_2)) { + debug_printf("[XvMCg3dvl] Cannot decode requested surface type. Non-MPEG2/Mocomp acceleration unsupported.\n"); + return BadImplementation; + } + if (!(surface_flags & XVMC_INTRA_UNSIGNED)) { + debug_printf("[XvMCg3dvl] Cannot decode requested surface type. Signed intra unsupported.\n"); + return BadImplementation; + } + context_priv = CALLOC(1, sizeof(XvMCContextPrivate)); if (!context_priv) return BadAlloc; -- cgit v1.2.3 From 99e1745af9a6a1fe1ebc65b17afb5f1a975348d2 Mon Sep 17 00:00:00 2001 From: Cooper Yuan Date: Mon, 28 Sep 2009 17:55:38 +0800 Subject: r300g: fix r300g cause GPU hang issue. why there are two input position semantic tags is that ureg doesn't set vs input semantic due to commit: 6d8dbd3d1ec888 so use vs input index instead of semantic name. --- src/gallium/drivers/r300/r300_state_derived.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 5026afc830..02b7ab9107 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -50,12 +50,11 @@ static void r300_vs_tab_routes(struct r300_context* r300, assert(info->num_inputs <= 16); - if (!r300screen->caps->has_tcl) + if (!r300screen->caps->has_tcl || !r300->rs_state->enable_vte) { for (i = 0; i < info->num_inputs; i++) { - switch (info->input_semantic_name[i]) { + switch (r300->vs->code.inputs[i]) { case TGSI_SEMANTIC_POSITION: - assert(pos == FALSE); pos = TRUE; tab[i] = 0; break; -- cgit v1.2.3 From 22658c165077c8449d52ea9c3ab7b3bbb5e38468 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Mon, 28 Sep 2009 13:02:42 +0100 Subject: g3dvl: Fix MSVC build. pipe/p_compiler for integer types. No declarations out of scope. --- src/gallium/auxiliary/vl/vl_bitstream_parser.h | 2 +- src/gallium/auxiliary/vl/vl_compositor.c | 16 ++- src/gallium/auxiliary/vl/vl_compositor.h | 2 +- src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 125 +++++++++++++++-------- src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h | 2 +- 5 files changed, 95 insertions(+), 52 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/vl/vl_bitstream_parser.h b/src/gallium/auxiliary/vl/vl_bitstream_parser.h index 46bebf470f..91ebaab45b 100644 --- a/src/gallium/auxiliary/vl/vl_bitstream_parser.h +++ b/src/gallium/auxiliary/vl/vl_bitstream_parser.h @@ -1,7 +1,7 @@ #ifndef vl_bitstream_parser_h #define vl_bitstream_parser_h -#include +#include "pipe/p_compiler.h" struct vl_bitstream_parser { diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index bca03cd401..6431da6611 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -151,6 +151,8 @@ create_vert_shader(struct vl_compositor *c) unsigned ti; + unsigned i; + assert(c); tokens = (struct tgsi_token*)MALLOC(max_tokens * sizeof(struct tgsi_token)); @@ -165,7 +167,7 @@ create_vert_shader(struct vl_compositor *c) * decl i0 ; Vertex pos * decl i1 ; Vertex texcoords */ - for (unsigned i = 0; i < 2; i++) { + for (i = 0; i < 2; i++) { decl = vl_decl_input(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -183,7 +185,7 @@ create_vert_shader(struct vl_compositor *c) * decl o0 ; Vertex pos * decl o1 ; Vertex texcoords */ - for (unsigned i = 0; i < 2; i++) { + for (i = 0; i < 2; i++) { decl = vl_decl_output(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -196,7 +198,7 @@ create_vert_shader(struct vl_compositor *c) * mad o0, i0, c0, c1 ; Scale and translate unit output rect to destination size and pos * mad o1, i1, c2, c3 ; Scale and translate unit texcoord rect to source size and pos */ - for (unsigned i = 0; i < 2; ++i) { + for (i = 0; i < 2; ++i) { inst = vl_inst4(TGSI_OPCODE_MAD, TGSI_FILE_OUTPUT, i, TGSI_FILE_INPUT, i, TGSI_FILE_CONSTANT, i * 2, TGSI_FILE_CONSTANT, i * 2 + 1); ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } @@ -226,6 +228,8 @@ create_frag_shader(struct vl_compositor *c) unsigned ti; + unsigned i; + assert(c); tokens = (struct tgsi_token*)MALLOC(max_tokens * sizeof(struct tgsi_token)); @@ -272,7 +276,7 @@ create_frag_shader(struct vl_compositor *c) * dp4 o0.y, t0, c2 * dp4 o0.z, t0, c3 */ - for (unsigned i = 0; i < 3; ++i) { + for (i = 0; i < 3; ++i) { inst = vl_inst3(TGSI_OPCODE_DP4, TGSI_FILE_OUTPUT, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_CONSTANT, i + 1); inst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); @@ -453,9 +457,11 @@ init_buffers(struct vl_compositor *c) static void cleanup_buffers(struct vl_compositor *c) { + unsigned i; + assert(c); - for (unsigned i = 0; i < 2; ++i) + for (i = 0; i < 2; ++i) pipe_buffer_reference(&c->vertex_bufs[i].buffer, NULL); pipe_buffer_reference(&c->vs_const_buf.buffer, NULL); diff --git a/src/gallium/auxiliary/vl/vl_compositor.h b/src/gallium/auxiliary/vl/vl_compositor.h index 2af41e1981..19ad66d9c6 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.h +++ b/src/gallium/auxiliary/vl/vl_compositor.h @@ -1,7 +1,7 @@ #ifndef vl_compositor_h #define vl_compositor_h -#include +#include #include #include diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index b728067d79..9b69f2956c 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -83,6 +83,8 @@ create_intra_vert_shader(struct vl_mpeg12_mc_renderer *r) unsigned ti; + unsigned i; + assert(r); tokens = (struct tgsi_token *) malloc(max_tokens * sizeof(struct tgsi_token)); @@ -99,7 +101,7 @@ create_intra_vert_shader(struct vl_mpeg12_mc_renderer *r) * decl i2 ; Chroma Cb texcoords * decl i3 ; Chroma Cr texcoords */ - for (unsigned i = 0; i < 4; i++) { + for (i = 0; i < 4; i++) { decl = vl_decl_input(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -110,7 +112,7 @@ create_intra_vert_shader(struct vl_mpeg12_mc_renderer *r) * decl o2 ; Chroma Cb texcoords * decl o3 ; Chroma Cr texcoords */ - for (unsigned i = 0; i < 4; i++) { + for (i = 0; i < 4; i++) { decl = vl_decl_output(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -121,7 +123,7 @@ create_intra_vert_shader(struct vl_mpeg12_mc_renderer *r) * mov o2, i2 ; Move input chroma Cb texcoords to output * mov o3, i3 ; Move input chroma Cr texcoords to output */ - for (unsigned i = 0; i < 4; ++i) { + for (i = 0; i < 4; ++i) { inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_OUTPUT, i, TGSI_FILE_INPUT, i); ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } @@ -151,6 +153,8 @@ create_intra_frag_shader(struct vl_mpeg12_mc_renderer *r) unsigned ti; + unsigned i; + assert(r); tokens = (struct tgsi_token *) malloc(max_tokens * sizeof(struct tgsi_token)); @@ -166,7 +170,7 @@ create_intra_frag_shader(struct vl_mpeg12_mc_renderer *r) * decl i1 ; Chroma Cb texcoords * decl i2 ; Chroma Cr texcoords */ - for (unsigned i = 0; i < 3; ++i) { + for (i = 0; i < 3; ++i) { decl = vl_decl_interpolated_input(TGSI_SEMANTIC_GENERIC, i + 1, i, i, TGSI_INTERPOLATE_LINEAR); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -188,7 +192,7 @@ create_intra_frag_shader(struct vl_mpeg12_mc_renderer *r) * decl s1 ; Sampler for chroma Cb texture * decl s2 ; Sampler for chroma Cr texture */ - for (unsigned i = 0; i < 3; ++i) { + for (i = 0; i < 3; ++i) { decl = vl_decl_samplers(i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -201,7 +205,7 @@ create_intra_frag_shader(struct vl_mpeg12_mc_renderer *r) * tex2d t1, i2, s2 ; Read texel from chroma Cr texture * mov t0.z, t1.x ; Move Cr sample into .z component */ - for (unsigned i = 0; i < 3; ++i) { + for (i = 0; i < 3; ++i) { inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_INPUT, i, TGSI_FILE_SAMPLER, i); ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); @@ -242,6 +246,8 @@ create_frame_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) unsigned ti; + unsigned i; + assert(r); tokens = (struct tgsi_token *) malloc(max_tokens * sizeof(struct tgsi_token)); @@ -260,7 +266,7 @@ create_frame_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) * decl i4 ; Ref surface top field texcoords * decl i5 ; Ref surface bottom field texcoords (unused, packed in the same stream) */ - for (unsigned i = 0; i < 6; i++) { + for (i = 0; i < 6; i++) { decl = vl_decl_input(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -272,7 +278,7 @@ create_frame_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) * decl o3 ; Chroma Cr texcoords * decl o4 ; Ref macroblock texcoords */ - for (unsigned i = 0; i < 5; i++) { + for (i = 0; i < 5; i++) { decl = vl_decl_output(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -283,7 +289,7 @@ create_frame_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) * mov o2, i2 ; Move input chroma Cb texcoords to output * mov o3, i3 ; Move input chroma Cr texcoords to output */ - for (unsigned i = 0; i < 4; ++i) { + for (i = 0; i < 4; ++i) { inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_OUTPUT, i, TGSI_FILE_INPUT, i); ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } @@ -323,6 +329,8 @@ create_frame_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) unsigned ti; + unsigned i; + assert(r); tokens = (struct tgsi_token *) malloc(max_tokens * sizeof(struct tgsi_token)); @@ -339,7 +347,7 @@ create_frame_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) * decl i2 ; Chroma Cr texcoords * decl i3 ; Ref macroblock texcoords */ - for (unsigned i = 0; i < 4; ++i) { + for (i = 0; i < 4; ++i) { decl = vl_decl_interpolated_input(TGSI_SEMANTIC_GENERIC, i + 1, i, i, TGSI_INTERPOLATE_LINEAR); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -362,7 +370,7 @@ create_frame_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) * decl s2 ; Sampler for chroma Cr texture * decl s3 ; Sampler for ref surface texture */ - for (unsigned i = 0; i < 4; ++i) { + for (i = 0; i < 4; ++i) { decl = vl_decl_samplers(i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -375,7 +383,7 @@ create_frame_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) * tex2d t1, i2, s2 ; Read texel from chroma Cr texture * mov t0.z, t1.x ; Move Cr sample into .z component */ - for (unsigned i = 0; i < 3; ++i) { + for (i = 0; i < 3; ++i) { inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_INPUT, i, TGSI_FILE_SAMPLER, i); ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); @@ -430,6 +438,8 @@ create_frame_bi_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) unsigned ti; + unsigned i; + assert(r); tokens = (struct tgsi_token *) malloc(max_tokens * sizeof(struct tgsi_token)); @@ -450,7 +460,7 @@ create_frame_bi_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) * decl i6 ; Second ref macroblock top field texcoords * decl i7 ; Second ref macroblock bottom field texcoords (unused, packed in the same stream) */ - for (unsigned i = 0; i < 8; i++) { + for (i = 0; i < 8; i++) { decl = vl_decl_input(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -463,7 +473,7 @@ create_frame_bi_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) * decl o4 ; First ref macroblock texcoords * decl o5 ; Second ref macroblock texcoords */ - for (unsigned i = 0; i < 6; i++) { + for (i = 0; i < 6; i++) { decl = vl_decl_output(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -474,7 +484,7 @@ create_frame_bi_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) * mov o2, i2 ; Move input chroma Cb texcoords to output * mov o3, i3 ; Move input chroma Cr texcoords to output */ - for (unsigned i = 0; i < 4; ++i) { + for (i = 0; i < 4; ++i) { inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_OUTPUT, i, TGSI_FILE_INPUT, i); ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } @@ -483,7 +493,7 @@ create_frame_bi_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) * add o4, i0, i4 ; Translate vertex pos by motion vec to form first ref macroblock texcoords * add o5, i0, i6 ; Translate vertex pos by motion vec to form second ref macroblock texcoords */ - for (unsigned i = 0; i < 2; ++i) { + for (i = 0; i < 2; ++i) { inst = vl_inst3(TGSI_OPCODE_ADD, TGSI_FILE_OUTPUT, i + 4, TGSI_FILE_INPUT, 0, TGSI_FILE_INPUT, (i + 2) * 2); ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } @@ -519,6 +529,8 @@ create_frame_bi_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) unsigned ti; + unsigned i; + assert(r); tokens = (struct tgsi_token *) malloc(max_tokens * sizeof(struct tgsi_token)); @@ -536,7 +548,7 @@ create_frame_bi_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) * decl i3 ; First ref macroblock texcoords * decl i4 ; Second ref macroblock texcoords */ - for (unsigned i = 0; i < 5; ++i) { + for (i = 0; i < 5; ++i) { decl = vl_decl_interpolated_input(TGSI_SEMANTIC_GENERIC, i + 1, i, i, TGSI_INTERPOLATE_LINEAR); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -563,7 +575,7 @@ create_frame_bi_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) * decl s3 ; Sampler for first ref surface texture * decl s4 ; Sampler for second ref surface texture */ - for (unsigned i = 0; i < 5; ++i) { + for (i = 0; i < 5; ++i) { decl = vl_decl_samplers(i, i); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); } @@ -576,7 +588,7 @@ create_frame_bi_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) * tex2d t1, i2, s2 ; Read texel from chroma Cr texture * mov t0.z, t1.x ; Move Cr sample into .z component */ - for (unsigned i = 0; i < 3; ++i) { + for (i = 0; i < 3; ++i) { inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_INPUT, i, TGSI_FILE_SAMPLER, i); ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); @@ -596,7 +608,7 @@ create_frame_bi_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) * tex2d t1, i3, s3 ; Read texel from first ref macroblock * tex2d t2, i4, s4 ; Read texel from second ref macroblock */ - for (unsigned i = 0; i < 2; ++i) { + for (i = 0; i < 2; ++i) { inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, i + 1, TGSI_FILE_INPUT, i + 3, TGSI_FILE_SAMPLER, i + 3); ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } @@ -633,9 +645,11 @@ create_field_bi_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) static void xfer_buffers_map(struct vl_mpeg12_mc_renderer *r) { + unsigned i; + assert(r); - for (unsigned i = 0; i < 3; ++i) { + for (i = 0; i < 3; ++i) { r->tex_transfer[i] = r->pipe->screen->get_tex_transfer ( r->pipe->screen, r->textures.all[i], @@ -650,9 +664,11 @@ xfer_buffers_map(struct vl_mpeg12_mc_renderer *r) static void xfer_buffers_unmap(struct vl_mpeg12_mc_renderer *r) { + unsigned i; + assert(r); - for (unsigned i = 0; i < 3; ++i) { + for (i = 0; i < 3; ++i) { r->pipe->screen->transfer_unmap(r->pipe->screen, r->tex_transfer[i]); r->pipe->screen->tex_transfer_destroy(r->tex_transfer[i]); } @@ -663,6 +679,7 @@ init_pipe_state(struct vl_mpeg12_mc_renderer *r) { struct pipe_sampler_state sampler; unsigned filters[5]; + unsigned i; assert(r); @@ -700,7 +717,7 @@ init_pipe_state(struct vl_mpeg12_mc_renderer *r) filters[3] = PIPE_TEX_FILTER_LINEAR; filters[4] = PIPE_TEX_FILTER_LINEAR; - for (unsigned i = 0; i < 5; ++i) { + for (i = 0; i < 5; ++i) { 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; @@ -726,9 +743,11 @@ init_pipe_state(struct vl_mpeg12_mc_renderer *r) static void cleanup_pipe_state(struct vl_mpeg12_mc_renderer *r) { + unsigned i; + assert(r); - for (unsigned i = 0; i < 5; ++i) + for (i = 0; i < 5; ++i) r->pipe->delete_sampler_state(r->pipe, r->samplers.all[i]); } @@ -770,6 +789,8 @@ init_buffers(struct vl_mpeg12_mc_renderer *r) const unsigned mbh = align(r->picture_height, MACROBLOCK_HEIGHT) / MACROBLOCK_HEIGHT; + unsigned i; + assert(r); r->macroblocks_per_batch = @@ -821,7 +842,7 @@ init_buffers(struct vl_mpeg12_mc_renderer *r) sizeof(struct vertex2f) * 4 * 24 * r->macroblocks_per_batch ); - for (unsigned i = 1; i < 3; ++i) { + for (i = 1; i < 3; ++i) { r->vertex_bufs.all[i].stride = sizeof(struct vertex2f) * 2; r->vertex_bufs.all[i].max_index = 24 * r->macroblocks_per_batch - 1; r->vertex_bufs.all[i].buffer_offset = 0; @@ -911,15 +932,17 @@ init_buffers(struct vl_mpeg12_mc_renderer *r) static void cleanup_buffers(struct vl_mpeg12_mc_renderer *r) { + unsigned i; + assert(r); pipe_buffer_reference(&r->vs_const_buf.buffer, NULL); pipe_buffer_reference(&r->fs_const_buf.buffer, NULL); - for (unsigned i = 0; i < 3; ++i) + for (i = 0; i < 3; ++i) pipe_buffer_reference(&r->vertex_bufs.all[i].buffer, NULL); - for (unsigned i = 0; i < 3; ++i) + for (i = 0; i < 3; ++i) pipe_texture_reference(&r->textures.all[i], NULL); FREE(r->macroblock_buf); @@ -1025,6 +1048,8 @@ gen_macroblock_verts(struct vl_mpeg12_mc_renderer *r, { struct vertex2f mo_vec[2]; + unsigned i; + assert(r); assert(mb); assert(ycbcr_vb); @@ -1043,7 +1068,7 @@ gen_macroblock_verts(struct vl_mpeg12_mc_renderer *r, mo_vec[0].y = mb->pmv[0][1][1] * 0.5f * r->surface_tex_inv_size.y; if (mb->mo_type == PIPE_MPEG12_MOTION_TYPE_FRAME) { - for (unsigned i = 0; i < 24 * 2; i += 2) { + for (i = 0; i < 24 * 2; i += 2) { vb[i].x = mo_vec[0].x; vb[i].y = mo_vec[0].y; } @@ -1052,7 +1077,7 @@ gen_macroblock_verts(struct vl_mpeg12_mc_renderer *r, mo_vec[1].x = mb->pmv[1][1][0] * 0.5f * r->surface_tex_inv_size.x; mo_vec[1].y = mb->pmv[1][1][1] * 0.5f * r->surface_tex_inv_size.y; - for (unsigned i = 0; i < 24 * 2; i += 2) { + for (i = 0; i < 24 * 2; i += 2) { vb[i].x = mo_vec[0].x; vb[i].y = mo_vec[0].y; vb[i + 1].x = mo_vec[1].x; @@ -1091,13 +1116,13 @@ gen_macroblock_verts(struct vl_mpeg12_mc_renderer *r, } if (mb->mb_type == PIPE_MPEG12_MOTION_TYPE_FRAME) { - for (unsigned i = 0; i < 24 * 2; i += 2) { + for (i = 0; i < 24 * 2; i += 2) { vb[i].x = mo_vec[0].x; vb[i].y = mo_vec[0].y; } } else { - for (unsigned i = 0; i < 24 * 2; i += 2) { + for (i = 0; i < 24 * 2; i += 2) { vb[i].x = mo_vec[0].x; vb[i].y = mo_vec[0].y; vb[i + 1].x = mo_vec[1].x; @@ -1153,18 +1178,19 @@ gen_macroblock_stream(struct vl_mpeg12_mc_renderer *r, unsigned offset[NUM_MACROBLOCK_TYPES]; struct vert_stream_0 *ycbcr_vb; struct vertex2f *ref_vb[2]; + unsigned i; assert(r); assert(num_macroblocks); - for (unsigned i = 0; i < r->num_macroblocks; ++i) { + for (i = 0; i < r->num_macroblocks; ++i) { enum MACROBLOCK_TYPE mb_type = get_macroblock_type(&r->macroblock_buf[i]); ++num_macroblocks[mb_type]; } offset[0] = 0; - for (unsigned i = 1; i < NUM_MACROBLOCK_TYPES; ++i) + for (i = 1; i < NUM_MACROBLOCK_TYPES; ++i) offset[i] = offset[i - 1] + num_macroblocks[i - 1]; ycbcr_vb = (struct vert_stream_0 *)pipe_buffer_map @@ -1174,7 +1200,7 @@ gen_macroblock_stream(struct vl_mpeg12_mc_renderer *r, PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_DISCARD ); - for (unsigned i = 0; i < 2; ++i) + for (i = 0; i < 2; ++i) ref_vb[i] = (struct vertex2f *)pipe_buffer_map ( r->pipe->screen, @@ -1182,7 +1208,7 @@ gen_macroblock_stream(struct vl_mpeg12_mc_renderer *r, PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_DISCARD ); - for (unsigned i = 0; i < r->num_macroblocks; ++i) { + for (i = 0; i < r->num_macroblocks; ++i) { enum MACROBLOCK_TYPE mb_type = get_macroblock_type(&r->macroblock_buf[i]); gen_macroblock_verts(r, &r->macroblock_buf[i], offset[mb_type], @@ -1192,7 +1218,7 @@ gen_macroblock_stream(struct vl_mpeg12_mc_renderer *r, } pipe_buffer_unmap(r->pipe->screen, r->vertex_bufs.individual.ycbcr.buffer); - for (unsigned i = 0; i < 2; ++i) + for (i = 0; i < 2; ++i) pipe_buffer_unmap(r->pipe->screen, r->vertex_bufs.individual.ref[i].buffer); } @@ -1202,6 +1228,7 @@ flush(struct vl_mpeg12_mc_renderer *r) unsigned num_macroblocks[NUM_MACROBLOCK_TYPES] = { 0 }; unsigned vb_start = 0; struct vertex_shader_consts *vs_consts; + unsigned i; assert(r); assert(r->num_macroblocks == r->macroblocks_per_batch); @@ -1336,7 +1363,7 @@ flush(struct vl_mpeg12_mc_renderer *r) pipe_surface_reference(&r->fb_state.cbufs[0], NULL); if (r->eb_handling == VL_MPEG12_MC_RENDERER_EMPTY_BLOCK_XFER_ONE) - for (unsigned i = 0; i < 3; ++i) + for (i = 0; i < 3; ++i) r->zero_block[i].x = ZERO_BLOCK_NIL; r->num_macroblocks = 0; @@ -1345,29 +1372,35 @@ flush(struct vl_mpeg12_mc_renderer *r) static void grab_frame_coded_block(short *src, short *dst, unsigned dst_pitch) { + unsigned y; + assert(src); assert(dst); - for (unsigned y = 0; y < BLOCK_HEIGHT; ++y) + for (y = 0; y < BLOCK_HEIGHT; ++y) memcpy(dst + y * dst_pitch, src + y * BLOCK_WIDTH, BLOCK_WIDTH * 2); } static void grab_field_coded_block(short *src, short *dst, unsigned dst_pitch) { + unsigned y; + assert(src); assert(dst); - for (unsigned y = 0; y < BLOCK_HEIGHT; ++y) + for (y = 0; y < BLOCK_HEIGHT; ++y) memcpy(dst + y * dst_pitch * 2, src + y * BLOCK_WIDTH, BLOCK_WIDTH * 2); } static void fill_zero_block(short *dst, unsigned dst_pitch) { + unsigned y; + assert(dst); - for (unsigned y = 0; y < BLOCK_HEIGHT; ++y) + for (y = 0; y < BLOCK_HEIGHT; ++y) memset(dst + y * dst_pitch, 0, BLOCK_WIDTH * 2); } @@ -1379,6 +1412,7 @@ grab_blocks(struct vl_mpeg12_mc_renderer *r, unsigned mbx, unsigned mby, short *texels; unsigned tb = 0, sb = 0; unsigned mbpx = mbx * MACROBLOCK_WIDTH, mbpy = mby * MACROBLOCK_HEIGHT; + unsigned x, y; assert(r); assert(blocks); @@ -1386,8 +1420,8 @@ grab_blocks(struct vl_mpeg12_mc_renderer *r, unsigned mbx, unsigned mby, tex_pitch = r->tex_transfer[0]->stride / r->tex_transfer[0]->block.size; texels = r->texels[0] + mbpy * tex_pitch + mbpx; - for (unsigned y = 0; y < 2; ++y) { - for (unsigned x = 0; x < 2; ++x, ++tb) { + for (y = 0; y < 2; ++y) { + for (x = 0; x < 2; ++x, ++tb) { if ((cbp >> (5 - tb)) & 1) { if (dct_type == PIPE_MPEG12_DCT_TYPE_FRAME) { grab_frame_coded_block(blocks + sb * BLOCK_WIDTH * BLOCK_HEIGHT, @@ -1468,6 +1502,8 @@ vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer *renderer, enum VL_MPEG12_MC_RENDERER_EMPTY_BLOCK eb_handling, bool pot_buffers) { + unsigned i; + assert(renderer); assert(pipe); /* TODO: Implement other policies */ @@ -1503,7 +1539,7 @@ vl_mpeg12_mc_renderer_init(struct vl_mpeg12_mc_renderer *renderer, renderer->surface = NULL; renderer->past = NULL; renderer->future = NULL; - for (unsigned i = 0; i < 3; ++i) + for (i = 0; i < 3; ++i) renderer->zero_block[i].x = ZERO_BLOCK_NIL; renderer->num_macroblocks = 0; @@ -1571,8 +1607,9 @@ vl_mpeg12_mc_renderer_render_macroblocks(struct vl_mpeg12_mc_renderer while (num_macroblocks) { unsigned left_in_batch = renderer->macroblocks_per_batch - renderer->num_macroblocks; unsigned num_to_submit = MIN2(num_macroblocks, left_in_batch); + unsigned i; - for (unsigned i = 0; i < num_to_submit; ++i) { + for (i = 0; i < num_to_submit; ++i) { assert(mpeg12_macroblocks[i].base.codec == PIPE_VIDEO_CODEC_MPEG12); grab_macroblock(renderer, &mpeg12_macroblocks[i]); } diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h index dfe0f7a24b..0c2f679664 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h @@ -1,7 +1,7 @@ #ifndef vl_mpeg12_mc_renderer_h #define vl_mpeg12_mc_renderer_h -#include +#include #include #include -- cgit v1.2.3 From 56870534803982a73019ddd77dab300d146f77c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Mon, 28 Sep 2009 13:03:03 +0100 Subject: softpipe: Fix MSVC build. --- src/gallium/drivers/softpipe/sp_video_context.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_video_context.c b/src/gallium/drivers/softpipe/sp_video_context.c index 3be33fbbdf..ccb29726b6 100644 --- a/src/gallium/drivers/softpipe/sp_video_context.c +++ b/src/gallium/drivers/softpipe/sp_video_context.c @@ -115,6 +115,7 @@ init_pipe_state(struct sp_mpeg12_context *ctx) struct pipe_rasterizer_state rast; struct pipe_blend_state blend; struct pipe_depth_stencil_alpha_state dsa; + unsigned i; assert(ctx); @@ -167,7 +168,7 @@ init_pipe_state(struct sp_mpeg12_context *ctx) dsa.depth.writemask = 0; dsa.depth.func = PIPE_FUNC_ALWAYS; dsa.depth.occlusion_count = 0; - for (unsigned i = 0; i < 2; ++i) { + for (i = 0; i < 2; ++i) { dsa.stencil[i].enabled = 0; dsa.stencil[i].func = PIPE_FUNC_ALWAYS; dsa.stencil[i].fail_op = PIPE_STENCIL_OP_KEEP; -- cgit v1.2.3 From 9871521b302117682afbefa7316a41a1a00485b2 Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Sun, 27 Sep 2009 10:56:42 -0400 Subject: llvmpipe: Grab a ref when the fb is set. Based on softpipe commit a77226071f6814a53358a5d6caff685889d0e4ec. --- src/gallium/drivers/llvmpipe/lp_context.c | 9 +++++++-- src/gallium/drivers/llvmpipe/lp_state_surface.c | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index a4b2bd8c2a..202cb8ef43 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -107,11 +107,16 @@ static void llvmpipe_destroy( struct pipe_context *pipe ) if (llvmpipe->draw) draw_destroy( llvmpipe->draw ); - for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) + for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { lp_destroy_tile_cache(llvmpipe->cbuf_cache[i]); + pipe_surface_reference(&llvmpipe->framebuffer.cbufs[i], NULL); + } + pipe_surface_reference(&llvmpipe->framebuffer.zsbuf, NULL); - for (i = 0; i < PIPE_MAX_SAMPLERS; i++) + for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { lp_destroy_tex_tile_cache(llvmpipe->tex_cache[i]); + pipe_texture_reference(&llvmpipe->texture[i], NULL); + } for (i = 0; i < Elements(llvmpipe->constants); i++) { if (llvmpipe->constants[i].buffer) { diff --git a/src/gallium/drivers/llvmpipe/lp_state_surface.c b/src/gallium/drivers/llvmpipe/lp_state_surface.c index 177a26b7b1..2c29144c03 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_surface.c +++ b/src/gallium/drivers/llvmpipe/lp_state_surface.c @@ -56,7 +56,7 @@ llvmpipe_set_framebuffer_state(struct pipe_context *pipe, lp_flush_tile_cache(lp->cbuf_cache[i]); /* assign new */ - lp->framebuffer.cbufs[i] = fb->cbufs[i]; + pipe_surface_reference(&lp->framebuffer.cbufs[i], fb->cbufs[i]); /* update cache */ lp_tile_cache_set_surface(lp->cbuf_cache[i], fb->cbufs[i]); @@ -81,7 +81,7 @@ llvmpipe_set_framebuffer_state(struct pipe_context *pipe, } /* assign new */ - lp->framebuffer.zsbuf = fb->zsbuf; + pipe_surface_reference(&lp->framebuffer.zsbuf, fb->zsbuf); /* Tell draw module how deep the Z/depth buffer is */ if (lp->framebuffer.zsbuf) { -- cgit v1.2.3 From eb82373abb08171d7fcb15b5f4f229fc9ca9aa91 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 28 Sep 2009 09:22:33 -0600 Subject: mesa: use _mesa_get_current_tex_unit() helper --- src/mesa/main/enable.c | 4 ++-- src/mesa/main/fbobject.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 8e6b01f73b..4383aed669 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -37,6 +37,7 @@ #include "mtypes.h" #include "enums.h" #include "api_arrayelt.h" +#include "texstate.h" @@ -228,8 +229,7 @@ get_texcoord_unit(GLcontext *ctx) static GLboolean enable_texture(GLcontext *ctx, GLboolean state, GLbitfield texBit) { - const GLuint curr = ctx->Texture.CurrentUnit; - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[curr]; + struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); const GLbitfield newenabled = state ? (texUnit->Enabled | texBit) : (texUnit->Enabled & ~texBit); diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 13f49da5a7..680fd22ba8 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -44,6 +44,7 @@ #include "teximage.h" #include "texobj.h" #include "texstore.h" +#include "texstate.h" /** Set this to 1 to help debug FBO incompleteness problems */ @@ -1955,7 +1956,7 @@ _mesa_GenerateMipmapEXT(GLenum target) return; } - texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + texUnit = _mesa_get_current_tex_unit(ctx); texObj = _mesa_select_tex_object(ctx, texUnit, target); _mesa_lock_texture(ctx, texObj); -- cgit v1.2.3 From 41d0606b7f4666c31db31bec3c54934ef6cd16e7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 25 Sep 2009 17:19:25 -0600 Subject: gallium/util: add sanity check assertions --- src/gallium/auxiliary/util/u_gen_mipmap.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index 833c0b8338..2f24a5a1c9 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -1519,6 +1519,17 @@ util_gen_mipmap(struct gen_mipmap_state *ctx, uint zslice = 0; uint offset; + /* The texture object should have room for the levels which we're + * about to generate. + */ + assert(lastLevel <= pt->last_level); + + /* If this fails, why are we here? */ + assert(lastLevel > baseLevel); + + assert(filter == PIPE_TEX_FILTER_LINEAR || + filter == PIPE_TEX_FILTER_NEAREST); + /* check if we can render in the texture's format */ if (!screen->is_format_supported(screen, pt->format, PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) { -- cgit v1.2.3 From e3a6f57ad6c0e7bda5d45eb146194ed39f45abdd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 28 Sep 2009 09:28:50 -0600 Subject: st/mesa: fix/simplify st_texture_object::lastLevel calculation Don't compute the st_texture_object::lastLevel field based on the texture filters. Use the _MaxLevel value that core Mesa computes for us. When called from the GenerateMipmap path, we'll use the lastLevel field as-is. --- src/mesa/state_tracker/st_cb_texture.c | 62 +++++----------------------------- 1 file changed, 9 insertions(+), 53 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index cfa33d48e1..085da3eab4 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1708,53 +1708,6 @@ st_CopyTexSubImage3D(GLcontext * ctx, GLenum target, GLint level, } -/** - * Compute which mipmap levels that really need to be sent to the hardware. - * This depends on the base image size, GL_TEXTURE_MIN_LOD, - * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL. - */ -static void -calculate_first_last_level(struct st_texture_object *stObj) -{ - struct gl_texture_object *tObj = &stObj->base; - - /* These must be signed values. MinLod and MaxLod can be negative numbers, - * and having firstLevel and lastLevel as signed prevents the need for - * extra sign checks. - */ - GLint firstLevel; - GLint lastLevel; - - /* Yes, this looks overly complicated, but it's all needed. - */ - switch (tObj->Target) { - case GL_TEXTURE_1D: - case GL_TEXTURE_2D: - case GL_TEXTURE_3D: - case GL_TEXTURE_CUBE_MAP: - if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) { - /* GL_NEAREST and GL_LINEAR only care about GL_TEXTURE_BASE_LEVEL. - */ - firstLevel = lastLevel = tObj->BaseLevel; - } - else { - firstLevel = 0; - lastLevel = MIN2(tObj->MaxLevel, - (int) tObj->Image[0][tObj->BaseLevel]->WidthLog2); - } - break; - case GL_TEXTURE_RECTANGLE_NV: - case GL_TEXTURE_4D_SGIS: - firstLevel = lastLevel = 0; - break; - default: - return; - } - - stObj->lastLevel = lastLevel; -} - - static void copy_image_data_to_texture(struct st_context *st, struct st_texture_object *stObj, @@ -1818,13 +1771,16 @@ st_finalize_texture(GLcontext *ctx, *needFlush = GL_FALSE; - /* We know/require this is true by now: - */ - assert(stObj->base._Complete); + if (stObj->base._Complete) { + /* The texture is complete and we know exactly how many mipmap levels + * are present/needed. This is conditional because we may be called + * from the st_generate_mipmap() function when the texture object is + * incomplete. In that case, we'll have set stObj->lastLevel before + * we get here. + */ + stObj->lastLevel = stObj->base._MaxLevel - stObj->base.BaseLevel; + } - /* What levels must the texture include at a minimum? - */ - calculate_first_last_level(stObj); firstImage = st_texture_image(stObj->base.Image[0][stObj->base.BaseLevel]); /* If both firstImage and stObj point to a texture which can contain -- cgit v1.2.3 From c7fddaf6122da489f4430f6bc2211bcb4740f416 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 25 Sep 2009 17:24:27 -0600 Subject: st/mesa: fix st_generate_mipmap() issues The main issue is we didn't always have a gallium texture object with enough space to store the to-be-generated mipmap levels. When that's the case, allocate a new gallium texture and use st_texure_finalize() to copy images from the old texture to the new one. We also had the baseLevel parameter to st_render_mipmap() wrong. --- src/mesa/state_tracker/st_gen_mipmap.c | 82 +++++++++++++++++++++++++++++++++- 1 file changed, 80 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index 58f6933652..f75b2348b8 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -27,6 +27,7 @@ #include "main/imports.h" +#include "main/macros.h" #include "main/mipmap.h" #include "main/teximage.h" #include "main/texformat.h" @@ -161,6 +162,43 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, } +/** + * Compute the expected number of mipmap levels in the texture given + * the width/height/depth of the base image and the GL_TEXTURE_BASE_LEVEL/ + * GL_TEXTURE_MAX_LEVEL settings. This will tell us how many mipmap + * level should be generated. + */ +static GLuint +compute_num_levels(GLcontext *ctx, + struct gl_texture_object *texObj, + GLenum target) +{ + if (target == GL_TEXTURE_RECTANGLE_ARB) { + return 1; + } + else { + const GLuint maxLevels = texObj->MaxLevel - texObj->BaseLevel + 1; + const struct gl_texture_image *baseImage = + _mesa_get_tex_image(ctx, texObj, target, texObj->BaseLevel); + GLuint size, numLevels; + + size = MAX2(baseImage->Width2, baseImage->Height2); + size = MAX2(size, baseImage->Depth2); + + numLevels = 0; + + while (size > 0) { + numLevels++; + size >>= 1; + } + + numLevels = MIN2(numLevels, maxLevels); + + return numLevels; + } +} + + void st_generate_mipmap(GLcontext *ctx, GLenum target, struct gl_texture_object *texObj) @@ -174,9 +212,49 @@ st_generate_mipmap(GLcontext *ctx, GLenum target, if (!pt) return; - lastLevel = pt->last_level; + /* find expected last mipmap level */ + lastLevel = compute_num_levels(ctx, texObj, target) - 1; + + if (pt->last_level < lastLevel) { + /* The current gallium texture doesn't have space for all the + * mipmap levels we need to generate. So allocate a new texture. + */ + struct st_texture_object *stObj = st_texture_object(texObj); + struct pipe_texture *oldTex = stObj->pt; + GLboolean needFlush; + + /* create new texture with space for more levels */ + stObj->pt = st_texture_create(st, + oldTex->target, + oldTex->format, + lastLevel, + oldTex->width[0], + oldTex->height[0], + oldTex->depth[0], + oldTex->tex_usage); + + /* The texture isn't in a "complete" state yet so set the expected + * lastLevel here, since it won't get done in st_finalize_texture(). + */ + stObj->lastLevel = lastLevel; + + /* This will copy the old texture's base image into the new texture + * which we just allocated. + */ + st_finalize_texture(ctx, st->pipe, texObj, &needFlush); + + /* release the old tex (will likely be freed too) */ + pipe_texture_reference(&oldTex, NULL); + + pt = stObj->pt; + } + + assert(lastLevel <= pt->last_level); - if (!st_render_mipmap(st, target, pt, baseLevel, lastLevel)) { + /* Recall that the Mesa BaseLevel image is stored in the gallium + * texture's level[0] position. So pass baseLevel=0 here. + */ + if (!st_render_mipmap(st, target, pt, 0, lastLevel)) { fallback_generate_mipmap(ctx, target, texObj); } -- cgit v1.2.3 From d09941c8cc2d4620eb774744c8878921b9dc3bcc Mon Sep 17 00:00:00 2001 From: Robert Noland Date: Tue, 22 Sep 2009 11:49:57 -0700 Subject: Fix build on non GLIBC platforms (FreeBSD at least) Build was broken by commit 9666529b5a5be1fcde82caadc2fe2efa5ea81e49 I'm not certain that this is entirely the correct fix since the demo from bug #23774 seemed to work before the commit that broke the build. Signed-off-by: Robert Noland Signed-off-by: Brian Paul --- src/glx/x11/glxhash.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/glx/x11/glxhash.c b/src/glx/x11/glxhash.c index 6f2c51d39d..b76ec32345 100644 --- a/src/glx/x11/glxhash.c +++ b/src/glx/x11/glxhash.c @@ -88,6 +88,12 @@ #define HASH_ALLOC malloc #define HASH_FREE free +#ifndef __GLIBC__ +#define HASH_RANDOM_DECL char *ps, rs[256] +#define HASH_RANDOM_INIT(seed) ps = initstate(seed, rs, sizeof(rs)) +#define HASH_RANDOM random() +#define HASH_RANDOM_DESTROY setstate(ps) +#else #define HASH_RANDOM_DECL struct random_data rd; int32_t rv; char rs[256] #define HASH_RANDOM_INIT(seed) \ do { \ @@ -96,6 +102,7 @@ } while(0) #define HASH_RANDOM ((void) random_r(&rd, &rv), rv) #define HASH_RANDOM_DESTROY +#endif typedef struct __glxHashBucket { -- cgit v1.2.3 From 05bad193f56d48384097e37e47fae3fdda85f144 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 28 Sep 2009 10:03:58 -0600 Subject: st/mesa: check gl_texture_object::GenerateMipmap field when allocating texmem In guess_and_alloc_texture() use the gl_texture_object::GenerateMipmap field as another hint as to whether to allocate space for a whole mipmap. --- src/mesa/state_tracker/st_cb_texture.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index c0fba8641b..771a0e2bbd 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -328,10 +328,13 @@ guess_and_alloc_texture(struct st_context *st, stObj->base.MinFilter == GL_LINEAR || stImage->base._BaseFormat == GL_DEPTH_COMPONENT || stImage->base._BaseFormat == GL_DEPTH_STENCIL_EXT) && + !stObj->base.GenerateMipmap && stImage->level == firstLevel) { + /* only alloc space for a single mipmap level */ lastLevel = firstLevel; } else { + /* alloc space for a full mipmap */ GLuint l2width = util_logbase2(width); GLuint l2height = util_logbase2(height); GLuint l2depth = util_logbase2(depth); -- cgit v1.2.3 From f0dc37870577378b51c1f8f223932a24909c5db1 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 28 Sep 2009 11:22:54 -0700 Subject: Prep for 7.6 release --- src/mesa/main/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index d4d3dd1a94..0ccdbf94a1 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -32,7 +32,7 @@ #define MESA_MAJOR 7 #define MESA_MINOR 6 #define MESA_PATCH 0 -#define MESA_VERSION_STRING "7.6-devel" +#define MESA_VERSION_STRING "7.6" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -- cgit v1.2.3 From 8b23755ce978247a92c00e390de2e459c0a9d5ad Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 21 Sep 2009 17:13:31 -0700 Subject: intel: Remove some dead metaops code. --- src/mesa/drivers/dri/i965/brw_context.h | 4 --- src/mesa/drivers/dri/i965/brw_tex.c | 32 ------------------------ src/mesa/drivers/dri/i965/brw_vtbl.c | 2 -- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 13 ++-------- src/mesa/drivers/dri/intel/intel_context.h | 3 --- src/mesa/drivers/dri/intel/intel_pixel.c | 14 ----------- src/mesa/drivers/dri/intel/intel_pixel.h | 2 -- 7 files changed, 2 insertions(+), 68 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index a5209ac41b..fa3e32c7ff 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -705,10 +705,6 @@ void brw_debug_batch(struct intel_context *intel); /*====================================================================== * brw_tex.c */ -void brwUpdateTextureState( struct intel_context *intel ); -void brw_FrameBufferTexInit( struct brw_context *brw, - struct intel_region *region ); -void brw_FrameBufferTexDestroy( struct brw_context *brw ); void brw_validate_textures( struct brw_context *brw ); diff --git a/src/mesa/drivers/dri/i965/brw_tex.c b/src/mesa/drivers/dri/i965/brw_tex.c index 71bff166dd..e911b105b2 100644 --- a/src/mesa/drivers/dri/i965/brw_tex.c +++ b/src/mesa/drivers/dri/i965/brw_tex.c @@ -39,38 +39,6 @@ #include "intel_tex.h" #include "brw_context.h" - -void brw_FrameBufferTexInit( struct brw_context *brw, - struct intel_region *region ) -{ - struct intel_context *intel = &brw->intel; - GLcontext *ctx = &intel->ctx; - struct gl_texture_object *obj; - struct gl_texture_image *img; - - intel->frame_buffer_texobj = obj = - ctx->Driver.NewTextureObject( ctx, (GLuint) -1, GL_TEXTURE_2D ); - - obj->MinFilter = GL_NEAREST; - obj->MagFilter = GL_NEAREST; - - img = ctx->Driver.NewTextureImage( ctx ); - - _mesa_init_teximage_fields( ctx, GL_TEXTURE_2D, img, - region->pitch, region->height, 1, 0, - region->cpp == 4 ? GL_RGBA : GL_RGB ); - - _mesa_set_tex_image( obj, GL_TEXTURE_2D, 0, img ); -} - -void brw_FrameBufferTexDestroy( struct brw_context *brw ) -{ - if (brw->intel.frame_buffer_texobj != NULL) - brw->intel.ctx.Driver.DeleteTexture( &brw->intel.ctx, - brw->intel.frame_buffer_texobj ); - brw->intel.frame_buffer_texobj = NULL; -} - /** * Finalizes all textures, completing any rendering that needs to be done * to prepare them. diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c index ac11790151..124fde25fe 100644 --- a/src/mesa/drivers/dri/i965/brw_vtbl.c +++ b/src/mesa/drivers/dri/i965/brw_vtbl.c @@ -69,8 +69,6 @@ static void brw_destroy_context( struct intel_context *intel ) _mesa_free(brw->wm.compile_data); - brw_FrameBufferTexDestroy( brw ); - for (i = 0; i < brw->state.nr_color_regions; i++) intel_region_release(&brw->state.color_regions[i]); brw->state.nr_color_regions = 0; 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 51539ac1e7..4f651170c6 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -724,17 +724,8 @@ static void prepare_wm_surfaces(struct brw_context *brw ) /* _NEW_TEXTURE, BRW_NEW_TEXDATA */ if (texUnit->_ReallyEnabled) { - if (texUnit->_Current == intel->frame_buffer_texobj) { - /* render to texture */ - dri_bo_unreference(brw->wm.surf_bo[surf]); - brw->wm.surf_bo[surf] = brw->wm.surf_bo[0]; - dri_bo_reference(brw->wm.surf_bo[surf]); - brw->wm.nr_surfaces = surf + 1; - } else { - /* regular texture */ - brw_update_texture_surface(ctx, i); - brw->wm.nr_surfaces = surf + 1; - } + brw_update_texture_surface(ctx, i); + brw->wm.nr_surfaces = surf + 1; } else { dri_bo_unreference(brw->wm.surf_bo[surf]); brw->wm.surf_bo[surf] = NULL; diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 03e7cf39d6..c743ab1c24 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -254,9 +254,6 @@ struct intel_context intel_line_func draw_line; intel_tri_func draw_tri; - /* These refer to the current drawing buffer: - */ - struct gl_texture_object *frame_buffer_texobj; /** * Set to true if a single constant cliprect should be used in the * batchbuffer. Otherwise, cliprects must be calculated at batchbuffer diff --git a/src/mesa/drivers/dri/intel/intel_pixel.c b/src/mesa/drivers/dri/intel/intel_pixel.c index a300141655..993e427a99 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel.c +++ b/src/mesa/drivers/dri/intel/intel_pixel.c @@ -129,20 +129,6 @@ intel_check_blit_fragment_ops(GLcontext * ctx, GLboolean src_alpha_is_one) return GL_TRUE; } - -GLboolean -intel_check_meta_tex_fragment_ops(GLcontext * ctx) -{ - if (ctx->NewState) - _mesa_update_state(ctx); - - /* Some of _ImageTransferState (scale, bias) could be done with - * fragment programs on i915. - */ - return !(ctx->_ImageTransferState || ctx->Fog.Enabled || /* not done yet */ - ctx->Texture._EnabledUnits || ctx->FragmentProgram._Enabled); -} - /* The intel_region struct doesn't really do enough to capture the * format of the pixels in the region. For now this code assumes that * the region is a display surface and hence is either ARGB8888 or diff --git a/src/mesa/drivers/dri/intel/intel_pixel.h b/src/mesa/drivers/dri/intel/intel_pixel.h index 96a6dd17b2..743b6497c5 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel.h +++ b/src/mesa/drivers/dri/intel/intel_pixel.h @@ -34,8 +34,6 @@ void intelInitPixelFuncs(struct dd_function_table *functions); GLboolean intel_check_blit_fragment_ops(GLcontext * ctx, GLboolean src_alpha_is_one); -GLboolean intel_check_meta_tex_fragment_ops(GLcontext * ctx); - GLboolean intel_check_blit_format(struct intel_region *region, GLenum format, GLenum type); -- cgit v1.2.3 From e885cb48a0b9292b3df9204f1c2783bf1fe29a28 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 28 Sep 2009 11:42:31 -0700 Subject: intel: Drop my generatemipmap code in favor of the new shared code. --- src/mesa/drivers/common/driverfuncs.c | 2 +- src/mesa/drivers/dri/i915/Makefile | 1 - src/mesa/drivers/dri/i915/intel_generatemipmap.c | 1 - src/mesa/drivers/dri/i965/Makefile | 1 - src/mesa/drivers/dri/i965/intel_generatemipmap.c | 1 - src/mesa/drivers/dri/intel/intel_generatemipmap.c | 300 ---------------------- src/mesa/drivers/dri/intel/intel_tex.c | 1 - src/mesa/drivers/dri/intel/intel_tex.h | 3 - 8 files changed, 1 insertion(+), 309 deletions(-) delete mode 120000 src/mesa/drivers/dri/i915/intel_generatemipmap.c delete mode 120000 src/mesa/drivers/dri/i965/intel_generatemipmap.c delete mode 100644 src/mesa/drivers/dri/intel/intel_generatemipmap.c (limited to 'src') diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index f09106b77c..0f8447cb70 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -106,7 +106,7 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->CopyTexSubImage1D = _mesa_meta_CopyTexSubImage1D; driver->CopyTexSubImage2D = _mesa_meta_CopyTexSubImage2D; driver->CopyTexSubImage3D = _mesa_meta_CopyTexSubImage3D; - driver->GenerateMipmap = _mesa_generate_mipmap; + driver->GenerateMipmap = _mesa_meta_GenerateMipmap; driver->TestProxyTexImage = _mesa_test_proxy_teximage; driver->CompressedTexImage1D = _mesa_store_compressed_teximage1d; driver->CompressedTexImage2D = _mesa_store_compressed_teximage2d; diff --git a/src/mesa/drivers/dri/i915/Makefile b/src/mesa/drivers/dri/i915/Makefile index 9d049dea8f..393312e732 100644 --- a/src/mesa/drivers/dri/i915/Makefile +++ b/src/mesa/drivers/dri/i915/Makefile @@ -19,7 +19,6 @@ DRIVER_SOURCES = \ intel_batchbuffer.c \ intel_clear.c \ intel_extensions.c \ - intel_generatemipmap.c \ intel_mipmap_tree.c \ intel_tex_layout.c \ intel_tex_image.c \ diff --git a/src/mesa/drivers/dri/i915/intel_generatemipmap.c b/src/mesa/drivers/dri/i915/intel_generatemipmap.c deleted file mode 120000 index 4c6b37ada0..0000000000 --- a/src/mesa/drivers/dri/i915/intel_generatemipmap.c +++ /dev/null @@ -1 +0,0 @@ -../intel/intel_generatemipmap.c \ No newline at end of file diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile index 6e9a9a29a3..57dcc91586 100644 --- a/src/mesa/drivers/dri/i965/Makefile +++ b/src/mesa/drivers/dri/i965/Makefile @@ -14,7 +14,6 @@ DRIVER_SOURCES = \ intel_decode.c \ intel_extensions.c \ intel_fbo.c \ - intel_generatemipmap.c \ intel_mipmap_tree.c \ intel_regions.c \ intel_screen.c \ diff --git a/src/mesa/drivers/dri/i965/intel_generatemipmap.c b/src/mesa/drivers/dri/i965/intel_generatemipmap.c deleted file mode 120000 index 4c6b37ada0..0000000000 --- a/src/mesa/drivers/dri/i965/intel_generatemipmap.c +++ /dev/null @@ -1 +0,0 @@ -../intel/intel_generatemipmap.c \ No newline at end of file diff --git a/src/mesa/drivers/dri/intel/intel_generatemipmap.c b/src/mesa/drivers/dri/intel/intel_generatemipmap.c deleted file mode 100644 index 5958b36c97..0000000000 --- a/src/mesa/drivers/dri/intel/intel_generatemipmap.c +++ /dev/null @@ -1,300 +0,0 @@ -/* - * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. - * Copyright © 2009 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - * - * Authors: - * Eric Anholt - * - */ - -#include "main/glheader.h" -#include "main/enums.h" -#include "main/image.h" -#include "main/mtypes.h" -#include "main/macros.h" -#include "main/bufferobj.h" -#include "main/teximage.h" -#include "main/texenv.h" -#include "main/texobj.h" -#include "main/texstate.h" -#include "main/texparam.h" -#include "main/varray.h" -#include "main/attrib.h" -#include "main/enable.h" -#include "main/buffers.h" -#include "main/fbobject.h" -#include "main/framebuffer.h" -#include "main/renderbuffer.h" -#include "main/depth.h" -#include "main/hash.h" -#include "main/mipmap.h" -#include "main/blend.h" -#include "glapi/dispatch.h" -#include "swrast/swrast.h" - -#include "intel_screen.h" -#include "intel_context.h" -#include "intel_batchbuffer.h" -#include "intel_pixel.h" -#include "intel_tex.h" -#include "intel_mipmap_tree.h" - -static const char *intel_fp_tex2d = - "!!ARBfp1.0\n" - "TEX result.color, fragment.texcoord[0], texture[0], 2D;\n" - "END\n"; - -static GLboolean -intel_generate_mipmap_level(GLcontext *ctx, GLuint tex_name, - int level, int width, int height) -{ - struct intel_context *intel = intel_context(ctx); - GLfloat vertices[4][2]; - GLint status; - - /* Set to source from the previous level */ - _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_BASE_LEVEL, level - 1); - _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, level - 1); - - /* Set to draw into the current level */ - _mesa_FramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, - GL_COLOR_ATTACHMENT0_EXT, - GL_TEXTURE_2D, - tex_name, - level); - /* Choose to render to the color attachment. */ - _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0_EXT); - - status = _mesa_CheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT); - if (status != GL_FRAMEBUFFER_COMPLETE_EXT) - return GL_FALSE; - - meta_set_passthrough_transform(&intel->meta); - - /* XXX: Doing it right would involve setting up the transformation to do - * 0-1 mapping or something, and not changing the vertex data. - */ - vertices[0][0] = 0; - vertices[0][1] = 0; - vertices[1][0] = width; - vertices[1][1] = 0; - vertices[2][0] = width; - vertices[2][1] = height; - vertices[3][0] = 0; - vertices[3][1] = height; - - _mesa_VertexPointer(2, GL_FLOAT, 2 * sizeof(GLfloat), &vertices); - _mesa_Enable(GL_VERTEX_ARRAY); - meta_set_default_texrect(&intel->meta); - - _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); - - meta_restore_texcoords(&intel->meta); - meta_restore_transform(&intel->meta); - - return GL_TRUE; -} - -static GLboolean -intel_generate_mipmap_2d(GLcontext *ctx, - GLenum target, - struct gl_texture_object *texObj) -{ - struct intel_context *intel = intel_context(ctx); - GLint old_active_texture; - int level, max_levels, start_level, end_level; - GLuint fb_name; - GLboolean success = GL_FALSE; - struct gl_framebuffer *saved_fbo = NULL; - struct gl_buffer_object *saved_array_buffer = NULL; - struct gl_buffer_object *saved_element_buffer = NULL; - - _mesa_PushAttrib(GL_ENABLE_BIT | GL_TEXTURE_BIT | - GL_CURRENT_BIT | GL_COLOR_BUFFER_BIT | - GL_DEPTH_BUFFER_BIT); - _mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT); - old_active_texture = ctx->Texture.CurrentUnit; - _mesa_reference_framebuffer(&saved_fbo, ctx->DrawBuffer); - - /* use default array/index buffers */ - _mesa_reference_buffer_object(ctx, &saved_array_buffer, - ctx->Array.ArrayBufferObj); - _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, - ctx->Shared->NullBufferObj); - _mesa_reference_buffer_object(ctx, &saved_element_buffer, - ctx->Array.ElementArrayBufferObj); - _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj, - ctx->Shared->NullBufferObj); - - _mesa_Disable(GL_POLYGON_STIPPLE); - _mesa_Disable(GL_DEPTH_TEST); - _mesa_Disable(GL_STENCIL_TEST); - _mesa_ColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - _mesa_DepthMask(GL_FALSE); - - /* Bind the given texture to GL_TEXTURE_2D with linear filtering for our - * minification. - */ - _mesa_ActiveTextureARB(GL_TEXTURE0_ARB); - _mesa_Enable(GL_TEXTURE_2D); - _mesa_BindTexture(GL_TEXTURE_2D, texObj->Name); - _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, - GL_LINEAR_MIPMAP_NEAREST); - _mesa_TexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - - /* Bind the new renderbuffer to the color attachment point. */ - _mesa_GenFramebuffersEXT(1, &fb_name); - _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, fb_name); - - meta_set_fragment_program(&intel->meta, &intel->meta.tex2d_fp, - intel_fp_tex2d); - meta_set_passthrough_vertex_program(&intel->meta); - - max_levels = _mesa_max_texture_levels(ctx, texObj->Target); - start_level = texObj->BaseLevel; - end_level = texObj->MaxLevel; - - /* Loop generating level+1 from level. */ - for (level = start_level; level < end_level && level < max_levels - 1; level++) { - const struct gl_texture_image *srcImage; - int width, height; - - srcImage = _mesa_select_tex_image(ctx, texObj, target, level); - if (srcImage->Border != 0) - goto fail; - - width = srcImage->Width / 2; - if (width < 1) - width = 1; - height = srcImage->Height / 2; - if (height < 1) - height = 1; - - if (width == srcImage->Width && - height == srcImage->Height) { - /* Neither _mesa_max_texture_levels nor texObj->MaxLevel are the - * maximum texture level for the object, so break out when we've gone - * over the edge. - */ - break; - } - - /* Make sure that there's space allocated for the target level. - * We could skip this if there's already space allocated and save some - * time. - */ - _mesa_TexImage2D(GL_TEXTURE_2D, level + 1, srcImage->InternalFormat, - width, height, 0, - GL_RGBA, GL_UNSIGNED_INT, NULL); - - if (!intel_generate_mipmap_level(ctx, texObj->Name, level + 1, - width, height)) - goto fail; - } - - success = GL_TRUE; - -fail: - meta_restore_fragment_program(&intel->meta); - meta_restore_vertex_program(&intel->meta); - - /* restore array/index buffers */ - _mesa_reference_buffer_object(ctx, &ctx->Array.ArrayBufferObj, - saved_array_buffer); - _mesa_reference_buffer_object(ctx, &saved_array_buffer, NULL); - _mesa_reference_buffer_object(ctx, &ctx->Array.ElementArrayBufferObj, - saved_element_buffer); - _mesa_reference_buffer_object(ctx, &saved_element_buffer, NULL); - - - _mesa_DeleteFramebuffersEXT(1, &fb_name); - _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture); - if (saved_fbo) - _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, saved_fbo->Name); - _mesa_reference_framebuffer(&saved_fbo, NULL); - _mesa_PopClientAttrib(); - _mesa_PopAttrib(); - - return success; -} - - -/** - * Generate new mipmap data from BASE+1 to BASE+p (the minimally-sized mipmap - * level). - * - * The texture object's miptree must be mapped. - * - * This function should also include an accelerated path. - */ -void -intel_generate_mipmap(GLcontext *ctx, GLenum target, - struct gl_texture_object *texObj) -{ - struct intel_context *intel = intel_context(ctx); - struct intel_texture_object *intelObj = intel_texture_object(texObj); - GLuint nr_faces = (intelObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1; - int face, i; - - /* HW path */ - if (target == GL_TEXTURE_2D && - ctx->Extensions.EXT_framebuffer_object && - ctx->Extensions.ARB_fragment_program && - ctx->Extensions.ARB_vertex_program) { - GLboolean success; - - /* We'll be accessing this texture using GL entrypoints, which should - * be resilient against other access to this texture. - */ - _mesa_unlock_texture(ctx, texObj); - success = intel_generate_mipmap_2d(ctx, target, texObj); - _mesa_lock_texture(ctx, texObj); - - if (success) - return; - } - - /* SW path */ - intel_tex_map_level_images(intel, intelObj, texObj->BaseLevel); - _mesa_generate_mipmap(ctx, target, texObj); - intel_tex_unmap_level_images(intel, intelObj, texObj->BaseLevel); - - /* Update the level information in our private data in the new images, since - * it didn't get set as part of a normal TexImage path. - */ - for (face = 0; face < nr_faces; face++) { - for (i = texObj->BaseLevel + 1; i < texObj->MaxLevel; i++) { - struct intel_texture_image *intelImage; - - intelImage = intel_texture_image(texObj->Image[face][i]); - if (intelImage == NULL) - break; - - intelImage->level = i; - intelImage->face = face; - /* Unreference the miptree to signal that the new Data is a bare - * pointer from mesa. - */ - intel_miptree_release(intel, &intelImage->mt); - } - } -} diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c index df63f29a42..f5d877edc3 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -162,7 +162,6 @@ void intelInitTextureFuncs(struct dd_function_table *functions) { functions->ChooseTextureFormat = intelChooseTextureFormat; - functions->GenerateMipmap = intel_generate_mipmap; functions->NewTextureObject = intelNewTextureObject; functions->NewTextureImage = intelNewTextureImage; diff --git a/src/mesa/drivers/dri/intel/intel_tex.h b/src/mesa/drivers/dri/intel/intel_tex.h index 471aa2a240..57ed0b1aab 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.h +++ b/src/mesa/drivers/dri/intel/intel_tex.h @@ -71,7 +71,4 @@ void intel_tex_unmap_images(struct intel_context *intel, int intel_compressed_num_bytes(GLuint mesaFormat); -void intel_generate_mipmap(GLcontext *ctx, GLenum target, - struct gl_texture_object *texObj); - #endif -- cgit v1.2.3 From d492e7b017178c03b4979cf4ff266162d83c4f37 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 28 Sep 2009 14:03:40 -0700 Subject: meta: Fix invalid PBO access from DrawPixels when trying to just alloc. This whole reuse of buffers (TexSubImage instead of TexImage, SubData instead of Data) is bad for hardware drivers, but it's even worse when we accidentally try to access the 2x2 PBO to fill the new 16x16 texture we're creating, producing GL errors. Fixes piglit pbo-drawpixels. Bug #14163. --- src/mesa/drivers/common/meta.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index b445323aab..a152087a3a 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -974,7 +974,8 @@ setup_copypix_texture(struct temp_texture *tex, * Setup/load texture for glDrawPixels. */ static void -setup_drawpix_texture(struct temp_texture *tex, +setup_drawpix_texture(GLcontext *ctx, + struct temp_texture *tex, GLboolean newTex, GLenum texIntFormat, GLsizei width, GLsizei height, @@ -995,9 +996,17 @@ setup_drawpix_texture(struct temp_texture *tex, tex->Width, tex->Height, 0, format, type, pixels); } else { + struct gl_buffer_object *save_unpack_obj = NULL; + + _mesa_reference_buffer_object(ctx, &save_unpack_obj, + ctx->Unpack.BufferObj); + _mesa_BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0); /* create empty texture */ _mesa_TexImage2D(tex->Target, 0, tex->IntFormat, tex->Width, tex->Height, 0, format, type, NULL); + if (save_unpack_obj != NULL) + _mesa_BindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, + save_unpack_obj->Name); /* load image */ _mesa_TexSubImage2D(tex->Target, 0, 0, 0, width, height, format, type, pixels); @@ -1162,7 +1171,7 @@ _mesa_meta_BlitFramebuffer(GLcontext *ctx, _mesa_ReadPixels(srcX, srcY, srcW, srcH, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, tmp); - setup_drawpix_texture(tex, newTex, GL_DEPTH_COMPONENT, srcW, srcH, + setup_drawpix_texture(ctx, tex, newTex, GL_DEPTH_COMPONENT, srcW, srcH, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, tmp); _mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, blit->DepthFP); @@ -1725,7 +1734,7 @@ _mesa_meta_DrawPixels(GLcontext *ctx, if (!drawpix->StencilFP) init_draw_stencil_pixels(ctx); - setup_drawpix_texture(tex, newTex, texIntFormat, width, height, + setup_drawpix_texture(ctx, tex, newTex, texIntFormat, width, height, GL_ALPHA, type, pixels); _mesa_ColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); @@ -1768,14 +1777,14 @@ _mesa_meta_DrawPixels(GLcontext *ctx, _mesa_ProgramLocalParameter4fvARB(GL_FRAGMENT_PROGRAM_ARB, 0, ctx->Current.RasterColor); - setup_drawpix_texture(tex, newTex, texIntFormat, width, height, + setup_drawpix_texture(ctx, tex, newTex, texIntFormat, width, height, format, type, pixels); _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); } else { /* Drawing RGBA */ - setup_drawpix_texture(tex, newTex, texIntFormat, width, height, + setup_drawpix_texture(ctx, tex, newTex, texIntFormat, width, height, format, type, pixels); _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); } @@ -1923,7 +1932,7 @@ _mesa_meta_Bitmap(GLcontext *ctx, _mesa_set_enable(ctx, GL_ALPHA_TEST, GL_TRUE); _mesa_AlphaFunc(GL_GREATER, 0.0); - setup_drawpix_texture(tex, newTex, texIntFormat, width, height, + setup_drawpix_texture(ctx, tex, newTex, texIntFormat, width, height, GL_ALPHA, GL_UNSIGNED_BYTE, bitmap8); _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); -- cgit v1.2.3 From 660ca9c5a23240abca084089a626d4a94ef0799f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 28 Sep 2009 21:40:50 -0600 Subject: mesa: new _mesa_texstore() function --- src/mesa/main/texstore.c | 147 +++++++++++++++++++++++------------------------ src/mesa/main/texstore.h | 3 + 2 files changed, 76 insertions(+), 74 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index d47f71d0e2..880801464a 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3265,6 +3265,28 @@ _mesa_get_texstore_func(gl_format format) } +/** + * Store user data into texture memory. + * Called via glTex[Sub]Image1/2/3D() + */ +GLboolean +_mesa_texstore(TEXSTORE_PARAMS) +{ + StoreTexImageFunc storeImage; + GLboolean success; + + storeImage = _mesa_get_texstore_func(dstFormat->MesaFormat); + + assert(storeImage); + + success = storeImage(ctx, dims, baseInternalFormat, + dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, dstImageOffsets, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, srcPacking); + return success; +} + /** * Check if an unpack PBO is active prior to fetching a texture image. @@ -3504,19 +3526,15 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, else { const GLint dstRowStride = 0; GLboolean success; - const StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - - ASSERT(storeImage); - - success = storeImage(ctx, 1, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, 1, 1, - format, type, pixels, packing); + + success = _mesa_texstore(ctx, 1, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, 1, 1, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); } @@ -3579,10 +3597,6 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, else { GLint dstRowStride; GLboolean success; - const StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - - ASSERT(storeImage); if (texImage->IsCompressed) { dstRowStride @@ -3592,14 +3606,15 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, dstRowStride = texImage->RowStride * texelBytes; } - success = storeImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - format, type, pixels, packing); + success = _mesa_texstore(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + format, type, pixels, packing); + if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); } @@ -3658,10 +3673,6 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, else { GLint dstRowStride; GLboolean success; - const StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - - ASSERT(storeImage); if (texImage->IsCompressed) { dstRowStride @@ -3671,14 +3682,14 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, dstRowStride = texImage->RowStride * texelBytes; } - success = storeImage(ctx, 3, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, height, depth, - format, type, pixels, packing); + success = _mesa_texstore(ctx, 3, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, height, depth, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D"); } @@ -3711,19 +3722,15 @@ _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, { const GLint dstRowStride = 0; GLboolean success; - const StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - - ASSERT(storeImage); - - success = storeImage(ctx, 1, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - xoffset, 0, 0, /* offsets */ - dstRowStride, - texImage->ImageOffsets, - width, 1, 1, - format, type, pixels, packing); + + success = _mesa_texstore(ctx, 1, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + xoffset, 0, 0, /* offsets */ + dstRowStride, + texImage->ImageOffsets, + width, 1, 1, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage1D"); } @@ -3756,10 +3763,6 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, { GLint dstRowStride = 0; GLboolean success; - const StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - - ASSERT(storeImage); if (texImage->IsCompressed) { dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, @@ -3770,14 +3773,14 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); } - success = storeImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - xoffset, yoffset, 0, - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - format, type, pixels, packing); + success = _mesa_texstore(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + xoffset, yoffset, 0, + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D"); } @@ -3810,10 +3813,6 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, { GLint dstRowStride; GLboolean success; - const StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - - ASSERT(storeImage); if (texImage->IsCompressed) { dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, @@ -3824,14 +3823,14 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); } - success = storeImage(ctx, 3, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - xoffset, yoffset, zoffset, - dstRowStride, - texImage->ImageOffsets, - width, height, depth, - format, type, pixels, packing); + success = _mesa_texstore(ctx, 3, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + xoffset, yoffset, zoffset, + dstRowStride, + texImage->ImageOffsets, + width, height, depth, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage3D"); } diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h index 771493cec6..8183c632df 100644 --- a/src/mesa/main/texstore.h +++ b/src/mesa/main/texstore.h @@ -194,6 +194,9 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, extern StoreTexImageFunc _mesa_get_texstore_func(gl_format format); +extern GLboolean +_mesa_texstore(TEXSTORE_PARAMS); + extern void _mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level, -- cgit v1.2.3 From 0b1f4dc0fa62c46030b39a0f7027dd1b0ef966fd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 28 Sep 2009 21:41:11 -0600 Subject: drivers: use new _mesa_texstore() function --- src/mesa/drivers/dri/intel/intel_tex_image.c | 26 ++++---- src/mesa/drivers/dri/intel/intel_tex_subimage.c | 23 ++++--- src/mesa/drivers/dri/radeon/radeon_texture.c | 40 ++++++------ src/mesa/drivers/dri/tdfx/tdfx_tex.c | 83 +++++++++++-------------- src/mesa/drivers/dri/unichrome/via_tex.c | 21 +++---- 5 files changed, 87 insertions(+), 106 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index a9f031a3cb..0e13f600a6 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -518,9 +518,6 @@ intelTexImage(GLcontext * ctx, * conversion and copy: */ if (pixels) { - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - if (compressed) { if (intelImage->mt) { struct intel_region *dst = intelImage->mt->region; @@ -531,17 +528,20 @@ intelTexImage(GLcontext * ctx, pixels, srcRowStride, 0, 0); - } else + } + else { memcpy(texImage->Data, pixels, imageSize); - } else if (!storeImage(ctx, dims, - texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, height, depth, - format, type, pixels, unpack)) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); + } + } + else if (!_mesa_texstore(ctx, dims, + texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, height, depth, + format, type, pixels, unpack)) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); } } diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c index c8de38bc72..ad5c2271a1 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c @@ -105,21 +105,20 @@ intelTexSubimage(GLcontext * ctx, xoffset, yoffset / 4, (width + 3) & ~3, (height + 3) / 4, pixels, (width + 3) & ~3, 0, 0); - } else + } + else { memcpy(texImage->Data, pixels, imageSize); + } } else { - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - - if (!storeImage(ctx, dims, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - xoffset, yoffset, zoffset, - dstRowStride, - texImage->ImageOffsets, - width, height, depth, - format, type, pixels, packing)) { + if (!_mesa_texstore(ctx, dims, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + xoffset, yoffset, zoffset, + dstRowStride, + texImage->ImageOffsets, + width, height, depth, + format, type, pixels, packing)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "intelTexSubImage"); } } diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 416ca1974b..3ff8cad93e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -624,8 +624,6 @@ static void radeon_teximage( } else { GLuint dstRowStride; GLuint *dstImageOffsets; - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); if (image->mt) { radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel]; @@ -648,15 +646,16 @@ static void radeon_teximage( dstImageOffsets = texImage->ImageOffsets; } - if (!storeImage(ctx, dims, - texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - dstImageOffsets, - width, height, depth, - format, type, pixels, packing)) + if (!_mesa_texstore(ctx, dims, + texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + dstImageOffsets, + width, height, depth, + format, type, pixels, packing)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); + } if (dims == 3) _mesa_free(dstImageOffsets); @@ -779,18 +778,17 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve copy_rows(img_start, dstRowStride, pixels, srcRowStride, rows, bytesPerRow); - } else { - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - - if (!storeImage(ctx, dims, texImage->_BaseFormat, - texImage->TexFormat, texImage->Data, - xoffset, yoffset, zoffset, - dstRowStride, - texImage->ImageOffsets, - width, height, depth, - format, type, pixels, packing)) + } + else { + if (!_mesa_texstore(ctx, dims, texImage->_BaseFormat, + texImage->TexFormat, texImage->Data, + xoffset, yoffset, zoffset, + dstRowStride, + texImage->ImageOffsets, + width, height, depth, + format, type, pixels, packing)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage"); + } } } diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index e87ee9eba2..84fe6984de 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -138,18 +138,15 @@ _mesa_halve2x2_teximage2d ( GLcontext *ctx, } if (bpt) { - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - src = _s; dst = _d; - storeImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, dstImage, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstWidth * bpt, - &dstImageOffsets, - dstWidth, dstHeight, 1, - GL_BGRA, CHAN_TYPE, dst, &ctx->DefaultPacking); + _mesa_texstore(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, dstImage, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstWidth * bpt, + &dstImageOffsets, + dstWidth, dstHeight, 1, + GL_BGRA, CHAN_TYPE, dst, &ctx->DefaultPacking); FREE(dst); FREE(src); } @@ -1231,21 +1228,19 @@ adjust2DRatio (GLcontext *ctx, if (!texImage->IsCompressed) { GLubyte *destAddr; - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); tempImage = MALLOC(width * height * texelBytes); if (!tempImage) { return GL_FALSE; } - storeImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, tempImage, - 0, 0, 0, /* dstX/Y/Zoffset */ - width * texelBytes, /* dstRowStride */ - &dstImageOffsets, - width, height, 1, - format, type, pixels, packing); + _mesa_texstore(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, tempImage, + 0, 0, 0, /* dstX/Y/Zoffset */ + width * texelBytes, /* dstRowStride */ + &dstImageOffsets, + width, height, 1, + format, type, pixels, packing); /* now rescale */ /* compute address of dest subimage within the overal tex image */ @@ -1262,8 +1257,6 @@ adjust2DRatio (GLcontext *ctx, } else { const GLint rawBytes = 4; GLvoid *rawImage = MALLOC(width * height * rawBytes); - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); if (!rawImage) { return GL_FALSE; @@ -1287,13 +1280,13 @@ adjust2DRatio (GLcontext *ctx, width, height, /* src */ newWidth, newHeight, /* dst */ rawImage /*src*/, tempImage /*dst*/ ); - storeImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, texImage->Data, - xoffset * mml->wScale, yoffset * mml->hScale, 0, /* dstX/Y/Zoffset */ - dstRowStride, - &dstImageOffsets, - newWidth, newHeight, 1, - GL_RGBA, CHAN_TYPE, tempImage, &ctx->DefaultPacking); + _mesa_texstore(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, texImage->Data, + xoffset * mml->wScale, yoffset * mml->hScale, 0, /* dstX/Y/Zoffset */ + dstRowStride, + &dstImageOffsets, + newWidth, newHeight, 1, + GL_RGBA, CHAN_TYPE, tempImage, &ctx->DefaultPacking); FREE(rawImage); } @@ -1446,16 +1439,13 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, else { /* no rescaling needed */ /* unpack image, apply transfer ops and store in texImage->Data */ - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - - storeImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, texImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - format, type, pixels, packing); + _mesa_texstore(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + format, type, pixels, packing); } } @@ -1519,16 +1509,13 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, } else { /* no rescaling needed */ - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - - storeImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, texImage->Data, - xoffset, yoffset, 0, - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - format, type, pixels, packing); + _mesa_texstore(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, texImage->Data, + xoffset, yoffset, 0, + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + format, type, pixels, packing); } ti->reloadImages = GL_TRUE; /* signal the image needs to be reloaded */ diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index 02a0043bbe..f700994025 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -792,8 +792,6 @@ static void viaTexImage(GLcontext *ctx, else { GLint dstRowStride; GLboolean success; - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); if (texImage->IsCompressed) { dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); @@ -801,16 +799,15 @@ static void viaTexImage(GLcontext *ctx, else { dstRowStride = postConvWidth * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); } - ASSERT(storeImage); - success = storeImage(ctx, dims, - texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - format, type, pixels, packing); + success = _mesa_texstore(ctx, dims, + texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); } -- cgit v1.2.3 From b436d729d1a2aacc13e274883b4dbdd104bdd1ad Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 28 Sep 2009 21:46:34 -0600 Subject: drivers: use _mesa_texstore --- src/mesa/drivers/dri/tdfx/tdfx_tex.c | 28 ++++++++++++++-------------- src/mesa/drivers/glide/fxddtex.c | 30 +++++++++++++++--------------- 2 files changed, 29 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index 84fe6984de..51d86aea37 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -93,13 +93,13 @@ _mesa_halve2x2_teximage2d ( GLcontext *ctx, } _s = src = MALLOC(srcRowStride * srcHeight); _d = dst = MALLOC(dstWidth * bytesPerPixel * dstHeight); - _mesa_texstore_rgba8888(ctx, 2, GL_RGBA, - &_mesa_texformat_rgba8888_rev, src, - 0, 0, 0, /* dstX/Y/Zoffset */ - srcRowStride, /* dstRowStride */ - &dstImageOffsets, - srcWidth, srcHeight, 1, - texImage->_BaseFormat, _t, srcImage, &ctx->DefaultPacking); + _mesa_texstore(ctx, 2, GL_RGBA, + &_mesa_texformat_rgba8888_rev, src, + 0, 0, 0, /* dstX/Y/Zoffset */ + srcRowStride, /* dstRowStride */ + &dstImageOffsets, + srcWidth, srcHeight, 1, + texImage->_BaseFormat, _t, srcImage, &ctx->DefaultPacking); } if (srcHeight == 1) { @@ -1267,13 +1267,13 @@ adjust2DRatio (GLcontext *ctx, return GL_FALSE; } /* unpack image, apply transfer ops and store in rawImage */ - _mesa_texstore_rgba8888(ctx, 2, GL_RGBA, - &_mesa_texformat_rgba8888_rev, rawImage, - 0, 0, 0, /* dstX/Y/Zoffset */ - width * rawBytes, /* dstRowStride */ - &dstImageOffsets, - width, height, 1, - format, type, pixels, packing); + _mesa_texstore(ctx, 2, GL_RGBA, + &_mesa_texformat_rgba8888_rev, rawImage, + 0, 0, 0, /* dstX/Y/Zoffset */ + width * rawBytes, /* dstRowStride */ + &dstImageOffsets, + width, height, 1, + format, type, pixels, packing); _mesa_rescale_teximage2d(rawBytes, width, newWidth * rawBytes, /* dst stride */ diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index 035c2ab92a..551ddb0fc7 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -91,14 +91,14 @@ _mesa_halve2x2_teximage2d ( GLcontext *ctx, } _s = src = MALLOC(srcRowStride * srcHeight); _d = dst = MALLOC(dstWidth * bytesPerPixel * dstHeight); - _mesa_texstore_rgba8888(ctx, 2, GL_RGBA, - &_mesa_texformat_rgba8888_rev, src, - 0, 0, 0, /* dstX/Y/Zoffset */ - srcRowStride, /* dstRowStride */ - 0, /* dstImageStride */ - srcWidth, srcHeight, 1, - texImage->_BaseFormat, _t, - srcImage, &ctx->DefaultPacking); + _mesa_texstore(ctx, 2, GL_RGBA, + &_mesa_texformat_rgba8888_rev, src, + 0, 0, 0, /* dstX/Y/Zoffset */ + srcRowStride, /* dstRowStride */ + 0, /* dstImageStride */ + srcWidth, srcHeight, 1, + texImage->_BaseFormat, _t, + srcImage, &ctx->DefaultPacking); } if (srcHeight == 1) { @@ -1281,13 +1281,13 @@ adjust2DRatio (GLcontext *ctx, return GL_FALSE; } /* unpack image, apply transfer ops and store in rawImage */ - _mesa_texstore_rgba8888(ctx, 2, GL_RGBA, - &_mesa_texformat_rgba8888_rev, rawImage, - 0, 0, 0, /* dstX/Y/Zoffset */ - width * rawBytes, /* dstRowStride */ - 0, /* dstImageStride */ - width, height, 1, - format, type, pixels, packing); + _mesa_texstore(ctx, 2, GL_RGBA, + &_mesa_texformat_rgba8888_rev, rawImage, + 0, 0, 0, /* dstX/Y/Zoffset */ + width * rawBytes, /* dstRowStride */ + 0, /* dstImageStride */ + width, height, 1, + format, type, pixels, packing); _mesa_rescale_teximage2d(rawBytes, width, newWidth * rawBytes, /* dst stride */ -- cgit v1.2.3 From cb0ef0cbf8116ebb8317b5711e1f119369bdf8f7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 28 Sep 2009 21:49:10 -0600 Subject: glide: use _mesa_texstore() --- src/mesa/drivers/glide/fxddtex.c | 83 +++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index 551ddb0fc7..354015af1d 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -137,18 +137,15 @@ _mesa_halve2x2_teximage2d ( GLcontext *ctx, } if (bpt) { - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - src = _s; dst = _d; - storeImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, dstImage, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstWidth * bpt, - 0, /* dstImageStride */ - dstWidth, dstHeight, 1, - GL_BGRA, CHAN_TYPE, dst, &ctx->DefaultPacking); + _mesa_texstore(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, dstImage, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstWidth * bpt, + 0, /* dstImageStride */ + dstWidth, dstHeight, 1, + GL_BGRA, CHAN_TYPE, dst, &ctx->DefaultPacking); FREE(dst); FREE(src); } @@ -1239,21 +1236,19 @@ adjust2DRatio (GLcontext *ctx, if (!texImage->IsCompressed) { GLubyte *destAddr; - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); tempImage = MALLOC(width * height * texelBytes); if (!tempImage) { return GL_FALSE; } - storeImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, tempImage, - 0, 0, 0, /* dstX/Y/Zoffset */ - width * texelBytes, /* dstRowStride */ - 0, /* dstImageStride */ - width, height, 1, - format, type, pixels, packing); + _mesa_texstore(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, tempImage, + 0, 0, 0, /* dstX/Y/Zoffset */ + width * texelBytes, /* dstRowStride */ + 0, /* dstImageStride */ + width, height, 1, + format, type, pixels, packing); /* now rescale */ /* compute address of dest subimage within the overal tex image */ @@ -1270,8 +1265,6 @@ adjust2DRatio (GLcontext *ctx, } else { const GLint rawBytes = 4; GLvoid *rawImage = MALLOC(width * height * rawBytes); - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); if (!rawImage) { return GL_FALSE; @@ -1294,13 +1287,13 @@ adjust2DRatio (GLcontext *ctx, width, height, /* src */ newWidth, newHeight, /* dst */ rawImage /*src*/, tempImage /*dst*/ ); - storeImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, texImage->Data, - xoffset * mml->wScale, yoffset * mml->hScale, 0, /* dstX/Y/Zoffset */ - dstRowStride, - 0, /* dstImageStride */ - newWidth, newHeight, 1, - GL_RGBA, CHAN_TYPE, tempImage, &ctx->DefaultPacking); + _mesa_texstore(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, texImage->Data, + xoffset * mml->wScale, yoffset * mml->hScale, 0, /* dstX/Y/Zoffset */ + dstRowStride, + 0, /* dstImageStride */ + newWidth, newHeight, 1, + GL_RGBA, CHAN_TYPE, tempImage, &ctx->DefaultPacking); FREE(rawImage); } @@ -1441,16 +1434,13 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, else { /* no rescaling needed */ /* unpack image, apply transfer ops and store in texImage->Data */ - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - - storeImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, texImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - 0, /* dstImageStride */ - width, height, 1, - format, type, pixels, packing); + _mesa_texstore(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + 0, /* dstImageStride */ + width, height, 1, + format, type, pixels, packing); } /* GL_SGIS_generate_mipmap */ @@ -1557,16 +1547,13 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, } else { /* no rescaling needed */ - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - - storeImage(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, (GLubyte *) texImage->Data, - xoffset, yoffset, 0, /* dstX/Y/Zoffset */ - dstRowStride, - 0, /* dstImageStride */ - width, height, 1, - format, type, pixels, packing); + _mesa_texstore(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, (GLubyte *) texImage->Data, + xoffset, yoffset, 0, /* dstX/Y/Zoffset */ + dstRowStride, + 0, /* dstImageStride */ + width, height, 1, + format, type, pixels, packing); } /* GL_SGIS_generate_mipmap */ -- cgit v1.2.3 From 49263e08561e3380115f9e09056190f67fcb1890 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 28 Sep 2009 21:49:38 -0600 Subject: mesa: make individual texstore functions static --- src/mesa/main/texstore.c | 57 ++++++++++++++++++++++++------------------------ src/mesa/main/texstore.h | 43 ------------------------------------ 2 files changed, 28 insertions(+), 72 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 880801464a..e8c3e23b5b 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1007,7 +1007,7 @@ memcpy_texture(GLcontext *ctx, * _mesa_texformat_intensity * */ -GLboolean +static GLboolean _mesa_texstore_rgba(TEXSTORE_PARAMS) { const GLint components = _mesa_components_in_format(baseInternalFormat); @@ -1158,7 +1158,7 @@ _mesa_texstore_rgba(TEXSTORE_PARAMS) /** * Store a 32-bit integer depth component texture image. */ -GLboolean +static GLboolean _mesa_texstore_z32(TEXSTORE_PARAMS) { const GLuint depthScale = 0xffffffff; @@ -1207,7 +1207,7 @@ _mesa_texstore_z32(TEXSTORE_PARAMS) /** * Store a 16-bit integer depth component texture image. */ -GLboolean +static GLboolean _mesa_texstore_z16(TEXSTORE_PARAMS) { const GLuint depthScale = 0xffff; @@ -1256,7 +1256,7 @@ _mesa_texstore_z16(TEXSTORE_PARAMS) /** * Store an rgb565 or rgb565_rev texture image. */ -GLboolean +static GLboolean _mesa_texstore_rgb565(TEXSTORE_PARAMS) { const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); @@ -1365,7 +1365,7 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) /** * Store a texture in MESA_FORMAT_RGBA8888 or MESA_FORMAT_RGBA8888_REV. */ -GLboolean +static GLboolean _mesa_texstore_rgba8888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); @@ -1490,7 +1490,7 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) } -GLboolean +static GLboolean _mesa_texstore_argb8888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); @@ -1683,7 +1683,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) } -GLboolean +static GLboolean _mesa_texstore_rgb888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); @@ -1810,7 +1810,7 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) } -GLboolean +static GLboolean _mesa_texstore_bgr888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); @@ -1917,7 +1917,7 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) return GL_TRUE; } -GLboolean +static GLboolean _mesa_texstore_rgba4444(TEXSTORE_PARAMS) { const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); @@ -1975,7 +1975,7 @@ _mesa_texstore_rgba4444(TEXSTORE_PARAMS) return GL_TRUE; } -GLboolean +static GLboolean _mesa_texstore_argb4444(TEXSTORE_PARAMS) { const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); @@ -2045,7 +2045,7 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS) return GL_TRUE; } -GLboolean +static GLboolean _mesa_texstore_rgba5551(TEXSTORE_PARAMS) { const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); @@ -2103,7 +2103,7 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS) return GL_TRUE; } -GLboolean +static GLboolean _mesa_texstore_argb1555(TEXSTORE_PARAMS) { const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); @@ -2174,7 +2174,7 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS) } -GLboolean +static GLboolean _mesa_texstore_al88(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); @@ -2277,7 +2277,7 @@ _mesa_texstore_al88(TEXSTORE_PARAMS) } -GLboolean +static GLboolean _mesa_texstore_rgb332(TEXSTORE_PARAMS) { const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); @@ -2335,7 +2335,7 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS) /** * Texstore for _mesa_texformat_a8, _mesa_texformat_l8, _mesa_texformat_i8. */ -GLboolean +static GLboolean _mesa_texstore_a8(TEXSTORE_PARAMS) { const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); @@ -2420,7 +2420,7 @@ _mesa_texstore_a8(TEXSTORE_PARAMS) -GLboolean +static GLboolean _mesa_texstore_ci8(TEXSTORE_PARAMS) { const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); @@ -2467,7 +2467,7 @@ _mesa_texstore_ci8(TEXSTORE_PARAMS) /** * Texstore for _mesa_texformat_ycbcr or _mesa_texformat_ycbcr_rev. */ -GLboolean +static GLboolean _mesa_texstore_ycbcr(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); @@ -2513,7 +2513,7 @@ _mesa_texstore_ycbcr(TEXSTORE_PARAMS) return GL_TRUE; } -GLboolean +static GLboolean _mesa_texstore_dudv8(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); @@ -2607,7 +2607,7 @@ _mesa_texstore_dudv8(TEXSTORE_PARAMS) /** * Store a texture in MESA_FORMAT_SIGNED_RGBA8888 or MESA_FORMAT_SIGNED_RGBA8888_REV */ -GLboolean +static GLboolean _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); @@ -2728,7 +2728,7 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) /** * Store a combined depth/stencil texture image. */ -GLboolean +static GLboolean _mesa_texstore_z24_s8(TEXSTORE_PARAMS) { const GLfloat depthScale = (GLfloat) 0xffffff; @@ -2829,7 +2829,7 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS) /** * Store a combined depth/stencil texture image. */ -GLboolean +static GLboolean _mesa_texstore_s8_z24(TEXSTORE_PARAMS) { const GLuint depthScale = 0xffffff; @@ -2918,7 +2918,7 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS) * _mesa_texformat_luminance_alpha_float32 * _mesa_texformat_intensity_float32 */ -GLboolean +static GLboolean _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) { const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); @@ -2987,7 +2987,7 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) /** * As above, but store 16-bit floats. */ -GLboolean +static GLboolean _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) { const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); @@ -3056,7 +3056,7 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) #if FEATURE_EXT_texture_sRGB -GLboolean +static GLboolean _mesa_texstore_srgb8(TEXSTORE_PARAMS) { const struct gl_texture_format *newDstFormat; @@ -3078,7 +3078,7 @@ _mesa_texstore_srgb8(TEXSTORE_PARAMS) } -GLboolean +static GLboolean _mesa_texstore_srgba8(TEXSTORE_PARAMS) { const struct gl_texture_format *newDstFormat; @@ -3088,7 +3088,6 @@ _mesa_texstore_srgba8(TEXSTORE_PARAMS) /* reuse normal rgba texstore code */ newDstFormat = &_mesa_texformat_rgba8888; - k = _mesa_texstore_rgba8888(ctx, dims, baseInternalFormat, newDstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, @@ -3100,7 +3099,7 @@ _mesa_texstore_srgba8(TEXSTORE_PARAMS) } -GLboolean +static GLboolean _mesa_texstore_sargb8(TEXSTORE_PARAMS) { const struct gl_texture_format *newDstFormat; @@ -3122,7 +3121,7 @@ _mesa_texstore_sargb8(TEXSTORE_PARAMS) } -GLboolean +static GLboolean _mesa_texstore_sl8(TEXSTORE_PARAMS) { const struct gl_texture_format *newDstFormat; @@ -3144,7 +3143,7 @@ _mesa_texstore_sl8(TEXSTORE_PARAMS) } -GLboolean +static GLboolean _mesa_texstore_sla8(TEXSTORE_PARAMS) { const struct gl_texture_format *newDstFormat; diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h index 8183c632df..ad4773533e 100644 --- a/src/mesa/main/texstore.h +++ b/src/mesa/main/texstore.h @@ -75,49 +75,6 @@ typedef GLboolean (*StoreTexImageFunc)(TEXSTORE_PARAMS); - -extern GLboolean _mesa_texstore_rgba(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_color_index(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_rgba8888(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_argb8888(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_rgb888(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_bgr888(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_rgb565(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_rgb565_rev(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_rgba4444(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_argb4444(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_argb4444_rev(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_rgba5551(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_argb1555(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_argb1555_rev(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_al88(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_al88_rev(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_rgb332(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_a8(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_ci8(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_ycbcr(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_z24_s8(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_s8_z24(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_z16(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_z32(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_rgba_float32(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_rgba_float16(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS); -#if FEATURE_EXT_texture_sRGB -extern GLboolean _mesa_texstore_srgb8(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_srgba8(TEXSTORE_PARAMS); -extern GLboolean _mesa_texstore_sargb8(TEXSTORE_PARAMS); -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, GLenum logicalBaseFormat, -- cgit v1.2.3 From 6480210b89dc8ae0990c450d27870c7b7930f251 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 28 Sep 2009 21:52:23 -0600 Subject: st/mesa: use _mesa_texstore() --- src/mesa/state_tracker/st_cb_drawpixels.c | 24 ++++----- src/mesa/state_tracker/st_cb_texture.c | 83 ++++++++++++++----------------- 2 files changed, 47 insertions(+), 60 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index c56f987628..6da57e817b 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -392,8 +392,6 @@ make_texture(struct st_context *st, GLboolean success; GLubyte *dest; const GLbitfield imageTransferStateSave = ctx->_ImageTransferState; - const StoreTexImageFunc storeImage = - _mesa_get_texstore_func(mformat->MesaFormat); /* we'll do pixel transfer in a fragment shader */ ctx->_ImageTransferState = 0x0; @@ -410,17 +408,17 @@ make_texture(struct st_context *st, * Note that the image is actually going to be upside down in * the texture. We deal with that with texcoords. */ - success = storeImage(ctx, 2, /* dims */ - baseFormat, /* baseInternalFormat */ - mformat, /* gl_texture_format */ - dest, /* dest */ - 0, 0, 0, /* dstX/Y/Zoffset */ - transfer->stride, /* dstRowStride, bytes */ - &dstImageOffsets, /* dstImageOffsets */ - width, height, 1, /* size */ - format, type, /* src format/type */ - pixels, /* data source */ - unpack); + success = _mesa_texstore(ctx, 2, /* dims */ + baseFormat, /* baseInternalFormat */ + mformat, /* gl_texture_format */ + dest, /* dest */ + 0, 0, 0, /* dstX/Y/Zoffset */ + transfer->stride, /* dstRowStride, bytes */ + &dstImageOffsets, /* dstImageOffsets */ + width, height, 1, /* size */ + format, type, /* src format/type */ + pixels, /* data source */ + unpack); /* unmap */ screen->transfer_unmap(screen, transfer); diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 8bbffc3ff6..d96484c439 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -417,7 +417,6 @@ compress_with_blit(GLcontext * ctx, struct pipe_surface *dst_surface; struct pipe_transfer *tex_xfer; void *map; - StoreTexImageFunc storeImage; if (!stImage->pt) { /* XXX: Can this happen? Should we assert? */ @@ -464,18 +463,15 @@ compress_with_blit(GLcontext * ctx, 0, 0, width, height); /* x, y, w, h */ map = screen->transfer_map(screen, tex_xfer); - storeImage = _mesa_get_texstore_func(mesa_format->MesaFormat); - - - storeImage(ctx, 2, GL_RGBA, mesa_format, - map, /* dest ptr */ - 0, 0, 0, /* dest x/y/z offset */ - tex_xfer->stride, /* dest row stride (bytes) */ - dstImageOffsets, /* image offsets (for 3D only) */ - width, height, 1, /* size */ - format, type, /* source format/type */ - pixels, /* source data */ - unpack); /* source data packing */ + _mesa_texstore(ctx, 2, GL_RGBA, mesa_format, + map, /* dest ptr */ + 0, 0, 0, /* dest x/y/z offset */ + tex_xfer->stride, /* dest row stride (bytes) */ + dstImageOffsets, /* image offsets (for 3D only) */ + width, height, 1, /* size */ + format, type, /* source format/type */ + pixels, /* source data */ + unpack); /* source data packing */ screen->transfer_unmap(screen, tex_xfer); screen->tex_transfer_destroy(tex_xfer); @@ -737,19 +733,17 @@ st_TexImage(GLcontext * ctx, _mesa_image_image_stride(unpack, width, height, format, type); GLint i; const GLubyte *src = (const GLubyte *) pixels; - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); for (i = 0; i < depth; i++) { - if (!storeImage(ctx, dims, - texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - format, type, src, unpack)) { + if (!_mesa_texstore(ctx, dims, + texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + format, type, src, unpack)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); } @@ -1056,9 +1050,6 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, const GLubyte *src; /* init to silence warning only: */ enum pipe_transfer_usage transfer_usage = PIPE_TRANSFER_WRITE; - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); - DBG("%s target %s level %d offset %d,%d %dx%d\n", __FUNCTION__, _mesa_lookup_enum_by_nr(target), @@ -1115,14 +1106,14 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, dstRowStride = stImage->transfer->stride; for (i = 0; i < depth; i++) { - if (!storeImage(ctx, dims, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - 0, 0, 0, - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - format, type, src, packing)) { + if (!_mesa_texstore(ctx, dims, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + 0, 0, 0, + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + format, type, src, packing)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage"); } @@ -1361,8 +1352,6 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, const GLint dstRowStride = stImage->transfer->stride; struct gl_texture_image *texImage = &stImage->base; struct gl_pixelstore_attrib unpack = ctx->DefaultPacking; - StoreTexImageFunc storeImage = - _mesa_get_texstore_func(texImage->TexFormat->MesaFormat); if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { unpack.Invert = GL_TRUE; @@ -1380,16 +1369,16 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, * is actually RGBA but the user created the texture as GL_RGB we * need to fill-in/override the alpha channel with 1.0. */ - storeImage(ctx, dims, - texImage->_BaseFormat, - texImage->TexFormat, - texDest, - 0, 0, 0, - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - GL_RGBA, GL_FLOAT, tempSrc, /* src */ - &unpack); + _mesa_texstore(ctx, dims, + texImage->_BaseFormat, + texImage->TexFormat, + texDest, + 0, 0, 0, + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + GL_RGBA, GL_FLOAT, tempSrc, /* src */ + &unpack); } else { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage"); -- cgit v1.2.3 From 0a306daf71588fc4ccfdc14450f8cd4ce00f9833 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 28 Sep 2009 21:52:43 -0600 Subject: mesa: use _mesa_texstore() --- src/mesa/main/mipmap.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 0950d8abea..c02c705228 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1667,20 +1667,17 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, const GLenum srcFormat = _mesa_get_format_base_format(convertFormat); GLint dstRowStride = _mesa_compressed_row_stride(dstImage->TexFormat->MesaFormat, dstWidth); - const StoreTexImageFunc storeImage = - _mesa_get_texstore_func(dstImage->TexFormat->MesaFormat); - ASSERT(srcFormat == GL_RGB || srcFormat == GL_RGBA); - storeImage(ctx, 2, dstImage->_BaseFormat, - dstImage->TexFormat, - dstImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, 0, /* strides */ - dstWidth, dstHeight, 1, /* size */ - srcFormat, CHAN_TYPE, - dstData, /* src data, actually */ - &ctx->DefaultPacking); + _mesa_texstore(ctx, 2, dstImage->_BaseFormat, + dstImage->TexFormat, + dstImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, 0, /* strides */ + dstWidth, dstHeight, 1, /* size */ + srcFormat, CHAN_TYPE, + dstData, /* src data, actually */ + &ctx->DefaultPacking); /* swap src and dest pointers */ temp = (GLubyte *) srcData; -- cgit v1.2.3 From e2e7bd6c1f979179e6840cf0e8db72fc72751650 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 28 Sep 2009 21:55:47 -0600 Subject: mesa: move StoreTexImageFunc typedef to .c file --- src/mesa/main/texstore.c | 8 +++++++- src/mesa/main/texstore.h | 14 ++------------ 2 files changed, 9 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index e8c3e23b5b..ca298bb237 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -76,6 +76,12 @@ enum { }; +/** + * Texture image storage function. + */ +typedef GLboolean (*StoreTexImageFunc)(TEXSTORE_PARAMS); + + /** * Return GL_TRUE if the given image format is one that be converted * to another format by swizzling. @@ -3250,7 +3256,7 @@ texstore_funcs[MESA_FORMAT_COUNT] = /** * Return the StoreTexImageFunc pointer to store an image in the given format. */ -StoreTexImageFunc +static StoreTexImageFunc _mesa_get_texstore_func(gl_format format) { GLuint i; diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h index ad4773533e..4a217df103 100644 --- a/src/mesa/main/texstore.h +++ b/src/mesa/main/texstore.h @@ -68,11 +68,8 @@ const struct gl_pixelstore_attrib *srcPacking - -/** - * Texture image storage function. - */ -typedef GLboolean (*StoreTexImageFunc)(TEXSTORE_PARAMS); +extern GLboolean +_mesa_texstore(TEXSTORE_PARAMS); extern GLchan * @@ -148,13 +145,6 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_image *texImage); -extern StoreTexImageFunc -_mesa_get_texstore_func(gl_format format); - -extern GLboolean -_mesa_texstore(TEXSTORE_PARAMS); - - extern void _mesa_store_compressed_teximage1d(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, -- cgit v1.2.3 From e226bf8a5d1e916b6c99397987eea4f31ee5de3b Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 27 Sep 2009 14:03:24 -0700 Subject: st/xorg: Make debug printing optional --- src/gallium/state_trackers/xorg/xorg_composite.c | 2 +- src/gallium/state_trackers/xorg/xorg_exa.c | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 9d15a615f1..7037d17e43 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -829,7 +829,7 @@ static void renderer_copy_texture(struct exa_context *exa, t1 = 1; #endif -#if 1 +#if 0 debug_printf("copy texture src=[%f, %f, %f, %f], dst=[%f, %f, %f, %f], tex=[%f, %f, %f, %f]\n", sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, s0, t0, s1, t1); diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 3f48ab98ac..f3d7d6eddd 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -47,6 +47,7 @@ #include "util/u_rect.h" +#define DEBUG_PRINT 0 #define DEBUG_SOLID 0 #define DISABLE_ACCEL 0 @@ -282,7 +283,7 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap); struct exa_context *exa = ms->exa; -#if 1 +#if DEBUG_PRINT debug_printf("ExaPrepareSolid(0x%x)\n", fg); #endif if (!EXA_PM_IS_SOLID(&pPixmap->drawable, planeMask)) @@ -322,7 +323,9 @@ ExaSolid(PixmapPtr pPixmap, int x0, int y0, int x1, int y1) struct exa_context *exa = ms->exa; struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap); +#if DEBUG_PRINT debug_printf("\tExaSolid(%d, %d, %d, %d)\n", x0, y0, x1, y1); +#endif #if 0 if (x0 == 0 && y0 == 0 && @@ -376,7 +379,9 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pDstPixmap); struct exa_pixmap_priv *src_priv = exaGetPixmapDriverPrivate(pSrcPixmap); +#if DEBUG_PRINT debug_printf("ExaPrepareCopy\n"); +#endif if (alu != GXcopy) return FALSE; @@ -420,8 +425,10 @@ ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY, struct exa_context *exa = ms->exa; struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pDstPixmap); +#if DEBUG_PRINT debug_printf("\tExaCopy(srcx=%d, srcy=%d, dstX=%d, dstY=%d, w=%d, h=%d)\n", srcX, srcY, dstX, dstY, width, height); +#endif debug_assert(priv == exa->copy.dst); @@ -440,7 +447,9 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, struct exa_context *exa = ms->exa; struct exa_pixmap_priv *priv; +#if DEBUG_PRINT debug_printf("ExaPrepareComposite\n"); +#endif priv = exaGetPixmapDriverPrivate(pDst); if (!priv || !priv->tex || @@ -488,7 +497,9 @@ ExaComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, struct exa_context *exa = ms->exa; struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pDst); +#if DEBUG_PRINT debug_printf("\tExaComposite\n"); +#endif xorg_composite(exa, priv, srcX, srcY, maskX, maskY, dstX, dstY, width, height); @@ -503,8 +514,10 @@ ExaCheckComposite(int op, pSrcPicture, pMaskPicture, pDstPicture); +#if DEBUG_PRINT debug_printf("ExaCheckComposite(%d, %p, %p, %p) = %d\n", op, pSrcPicture, pMaskPicture, pDstPicture, accelerated); +#endif return accelerated; } -- cgit v1.2.3 From 3a8d525373c50c6cdc9ae5dd00e7298ab58df8c6 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 28 Sep 2009 11:19:26 -0700 Subject: st/xorg: Add debug for fallbacks --- src/gallium/state_trackers/xorg/xorg_driver.c | 1 + src/gallium/state_trackers/xorg/xorg_exa.c | 77 ++++++++++++++------------ src/gallium/state_trackers/xorg/xorg_exa.h | 9 +++ src/gallium/state_trackers/xorg/xorg_tracker.h | 1 + 4 files changed, 54 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 643b6b3b9e..3dff8d859e 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -558,6 +558,7 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86SetBlackWhitePixels(pScreen); ms->exa = xorg_exa_init(pScrn); + ms->debug_fallback = debug_get_option_bool("XORG_DEBUG_FALLBACK", TRUE); miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index f3d7d6eddd..b54e31a701 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -286,23 +286,23 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) #if DEBUG_PRINT debug_printf("ExaPrepareSolid(0x%x)\n", fg); #endif - if (!EXA_PM_IS_SOLID(&pPixmap->drawable, planeMask)) - return FALSE; + if (!exa->pipe) + XORG_FALLBACK("solid accle not enabled"); if (!priv || !priv->tex) - return FALSE; + XORG_FALLBACK("solid !priv || !priv->tex"); - if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, - priv->tex->target, - PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) - return FALSE; + if (!EXA_PM_IS_SOLID(&pPixmap->drawable, planeMask)) + XORG_FALLBACK("solid planeMask is not solid"); if (alu != GXcopy) - return FALSE; - - if (!exa->pipe) - return FALSE; + XORG_FALLBACK("solid not GXcopy"); + if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, + priv->tex->target, + PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) { + XORG_FALLBACK("solid bad format %s", pf_name(priv->tex->format)); + } #if DEBUG_SOLID fg = 0xffff0000; @@ -382,29 +382,30 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, #if DEBUG_PRINT debug_printf("ExaPrepareCopy\n"); #endif + if (!exa->pipe) + XORG_FALLBACK("copy accle not enabled"); - if (alu != GXcopy) - return FALSE; + if (!priv || !src_priv) + XORG_FALLBACK("copy !priv || !src_priv"); + + if (!priv->tex || !src_priv->tex) + XORG_FALLBACK("copy !priv->tex || !src_priv->tex"); if (!EXA_PM_IS_SOLID(&pSrcPixmap->drawable, planeMask)) - return FALSE; + XORG_FALLBACK("copy planeMask is not solid"); - if (!priv || !src_priv) - return FALSE; + if (alu != GXcopy) + XORG_FALLBACK("copy alu not GXcopy"); if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, priv->tex->target, - PIPE_TEXTURE_USAGE_RENDER_TARGET, 0) || - !exa->scrn->is_format_supported(exa->scrn, src_priv->tex->format, + PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) + XORG_FALLBACK("copy pDst format %s", pf_name(priv->tex->format)); + + if (!exa->scrn->is_format_supported(exa->scrn, src_priv->tex->format, src_priv->tex->target, PIPE_TEXTURE_USAGE_SAMPLER, 0)) - return FALSE; - - if (!priv->tex || !src_priv->tex) - return FALSE; - - if (!exa->pipe) - return FALSE; + XORG_FALLBACK("copy pSrc format %s", pf_name(src_priv->tex->format)); exa->copy.src = src_priv; exa->copy.dst = priv; @@ -450,30 +451,38 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, #if DEBUG_PRINT debug_printf("ExaPrepareComposite\n"); #endif + if (!exa->pipe) + XORG_FALLBACK("comp accle not enabled"); priv = exaGetPixmapDriverPrivate(pDst); - if (!priv || !priv->tex || - !exa->scrn->is_format_supported(exa->scrn, priv->tex->format, + if (!priv || !priv->tex) + XORG_FALLBACK("comp pDst %s", !priv ? "!priv" : "!priv->tex"); + + if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, priv->tex->target, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) - return FALSE; + XORG_FALLBACK("copy pDst format: %s", pf_name(priv->tex->format)); if (pSrc) { priv = exaGetPixmapDriverPrivate(pSrc); - if (!priv || !priv->tex || - !exa->scrn->is_format_supported(exa->scrn, priv->tex->format, + if (!priv || !priv->tex) + XORG_FALLBACK("comp pSrc %s", !priv ? "!priv" : "!priv->tex"); + + if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, priv->tex->target, PIPE_TEXTURE_USAGE_SAMPLER, 0)) - return FALSE; + XORG_FALLBACK("copy pSrc format: %s", pf_name(priv->tex->format)); } if (pMask) { priv = exaGetPixmapDriverPrivate(pMask); - if (!priv || !priv->tex || - !exa->scrn->is_format_supported(exa->scrn, priv->tex->format, + if (!priv || !priv->tex) + XORG_FALLBACK("comp pMask %s", !priv ? "!priv" : "!priv->tex"); + + if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, priv->tex->target, PIPE_TEXTURE_USAGE_SAMPLER, 0)) - return FALSE; + XORG_FALLBACK("copy pMask format: %s", pf_name(priv->tex->format)); } #if DISABLE_ACCEL diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h index fe1f1cd103..d3f25ca844 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.h +++ b/src/gallium/state_trackers/xorg/xorg_exa.h @@ -50,6 +50,15 @@ struct exa_pixmap_priv unsigned map_count; }; +#define XORG_FALLBACK(s, arg...) \ +do { \ + if (ms->debug_fallback) { \ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, \ + "fallback: " s "\n", ##arg); \ + } \ + return FALSE; \ +} while(0) + struct pipe_surface * exa_gpu_surface(struct exa_context *exa, struct exa_pixmap_priv *priv); diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h index 2f7050bcb7..db2f16f63e 100644 --- a/src/gallium/state_trackers/xorg/xorg_tracker.h +++ b/src/gallium/state_trackers/xorg/xorg_tracker.h @@ -94,6 +94,7 @@ typedef struct _modesettingRec /* exa */ void *exa; Bool noEvict; + Bool debug_fallback; #ifdef DRM_MODE_FEATURE_DIRTYFB DamagePtr damage; -- cgit v1.2.3 From a230ad2bc440e9d332482ea453e7ab7f4a5b8bd2 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Tue, 29 Sep 2009 09:46:29 +0300 Subject: r600: clear position enable bit when when wpos is not used by FP Makes doom3 alot nicer.. --- src/mesa/drivers/dri/r600/r700_fragprog.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c index 78ce3ae436..62a1ea1a22 100644 --- a/src/mesa/drivers/dri/r600/r700_fragprog.c +++ b/src/mesa/drivers/dri/r600/r700_fragprog.c @@ -341,6 +341,11 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx) SETbit(r700->SPI_PS_IN_CONTROL_0.u32All, POSITION_ENA_bit); SETbit(r700->SPI_INPUT_Z.u32All, PROVIDE_Z_TO_SPI_bit); } + else + { + CLEARbit(r700->SPI_PS_IN_CONTROL_0.u32All, POSITION_ENA_bit); + CLEARbit(r700->SPI_INPUT_Z.u32All, PROVIDE_Z_TO_SPI_bit); + } ui = (unNumOfReg < ui) ? ui : unNumOfReg; -- cgit v1.2.3 From 7c5f3c3d8a63b0feee154092153e958fa4f24abd Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Mon, 28 Sep 2009 10:42:35 +0300 Subject: r600: user correct alpha blend factor Signed-off-by: Dave Airlie --- src/mesa/drivers/dri/r600/r700_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index fbff109455..3ad6d74f53 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -493,10 +493,10 @@ static void r700SetBlendState(GLcontext * ctx) eqn, COLOR_COMB_FCN_shift, COLOR_COMB_FCN_mask); SETfield(blend_reg, - blend_factor(ctx->Color.BlendSrcRGB, GL_TRUE), + blend_factor(ctx->Color.BlendSrcA, GL_TRUE), ALPHA_SRCBLEND_shift, ALPHA_SRCBLEND_mask); SETfield(blend_reg, - blend_factor(ctx->Color.BlendDstRGB, GL_FALSE), + blend_factor(ctx->Color.BlendDstA, GL_FALSE), ALPHA_DESTBLEND_shift, ALPHA_DESTBLEND_mask); switch (ctx->Color.BlendEquationA) { -- cgit v1.2.3 From ac9c8b6359be770f1ed3e97100c497bd91338874 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Mon, 28 Sep 2009 11:23:49 +0300 Subject: r600: use CB_TARGET_MASK instead of CB_SHADER_MASK for setting color mask makes blend functions work better Signed-off-by: Dave Airlie --- src/mesa/drivers/dri/r600/r700_state.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index 3ad6d74f53..7e8b48f91e 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -771,9 +771,9 @@ static void r700ColorMask(GLcontext * ctx, (b ? 4 : 0) | (a ? 8 : 0)); - if (mask != r700->CB_SHADER_MASK.u32All) { + if (mask != r700->CB_TARGET_MASK.u32All) { R600_STATECHANGE(context, cb); - SETfield(r700->CB_SHADER_MASK.u32All, mask, OUTPUT0_ENABLE_shift, OUTPUT0_ENABLE_mask); + SETfield(r700->CB_TARGET_MASK.u32All, mask, TARGET0_ENABLE_shift, TARGET0_ENABLE_mask); } } @@ -1780,7 +1780,7 @@ void r700InitState(GLcontext * ctx) //------------------- r700->CB_CLRCMP_MSK.u32All = 0xFFFFFFFF; /* screen/window/view */ - SETfield(r700->CB_TARGET_MASK.u32All, 0xF, (4 * id), TARGET0_ENABLE_mask); + SETfield(r700->CB_SHADER_MASK.u32All, 0xF, (4 * id), OUTPUT0_ENABLE_mask); context->radeon.hw.all_dirty = GL_TRUE; -- cgit v1.2.3 From 7db33440a800f134204a1ee7d2d595da1771c3ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Mon, 28 Sep 2009 19:01:49 +0100 Subject: g3dvl: Define PIPE_VIDEO_CODEC_UNKNOWN for failures. gcc 4.4 seems particularly picky with int -> enum conversions. --- src/gallium/include/pipe/p_defines.h | 1 + src/gallium/include/pipe/p_video_state.h | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 1980831dd9..ad42beff47 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -318,6 +318,7 @@ enum pipe_transfer_usage { enum pipe_video_codec { + PIPE_VIDEO_CODEC_UNKNOWN = 0, PIPE_VIDEO_CODEC_MPEG12, /**< MPEG1, MPEG2 */ PIPE_VIDEO_CODEC_MPEG4, /**< DIVX, XVID */ PIPE_VIDEO_CODEC_VC1, /**< WMV */ diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h index a0128fbd48..b71e959e6f 100644 --- a/src/gallium/include/pipe/p_video_state.h +++ b/src/gallium/include/pipe/p_video_state.h @@ -63,10 +63,9 @@ u_reduce_video_profile(enum pipe_video_profile profile) return PIPE_VIDEO_CODEC_MPEG4_AVC; default: - assert(false); + assert(0); + return PIPE_VIDEO_CODEC_UNKNOWN; } - - return -1; } enum pipe_mpeg12_picture_type -- cgit v1.2.3 From bd2e36a38fe1e0b61a97338c342aa0e7aee334db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Mon, 28 Sep 2009 19:02:34 +0100 Subject: g3dvl: assert.h -> util/u_debug.h --- src/gallium/include/pipe/p_video_state.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h index b71e959e6f..2a7422bf04 100644 --- a/src/gallium/include/pipe/p_video_state.h +++ b/src/gallium/include/pipe/p_video_state.h @@ -2,8 +2,8 @@ #define PIPE_VIDEO_STATE_H /* u_reduce_video_profile() needs these */ -#include #include +#include #include #include -- cgit v1.2.3 From 57d0fcba67f637b89b020371b91a3c7cd7b048c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Mon, 28 Sep 2009 19:44:30 +0100 Subject: python: Update for surface_buffer_create change. --- src/gallium/state_trackers/python/st_softpipe_winsys.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/state_trackers/python/st_softpipe_winsys.c b/src/gallium/state_trackers/python/st_softpipe_winsys.c index f0a4826a00..f0abd12e3d 100644 --- a/src/gallium/state_trackers/python/st_softpipe_winsys.c +++ b/src/gallium/state_trackers/python/st_softpipe_winsys.c @@ -172,6 +172,7 @@ st_softpipe_surface_buffer_create(struct pipe_winsys *winsys, unsigned width, unsigned height, enum pipe_format format, unsigned usage, + unsigned tex_usage, unsigned *stride) { const unsigned alignment = 64; -- cgit v1.2.3 From 60f3f22a52422b11cc71149a28e24a14a9251205 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 29 Sep 2009 10:38:47 +0100 Subject: i915: Fix MSVC build. --- src/gallium/drivers/i915simple/i915_prim_vbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/i915simple/i915_prim_vbuf.c b/src/gallium/drivers/i915simple/i915_prim_vbuf.c index d50201642b..8a3e466c84 100644 --- a/src/gallium/drivers/i915simple/i915_prim_vbuf.c +++ b/src/gallium/drivers/i915simple/i915_prim_vbuf.c @@ -198,7 +198,7 @@ i915_vbuf_render_map_vertices(struct vbuf_render *render) struct intel_winsys *iws = i915->iws; if (i915->vbo_flushed) - debug_printf("%s bad vbo flush occured stalling on hw\n", __func__); + debug_printf("%s bad vbo flush occured stalling on hw\n", __FUNCTION__); i915_render->vbo_ptr = iws->buffer_map(iws, i915_render->vbo, TRUE); -- cgit v1.2.3 From 8210abb113462c781a8f3ffee3406493c108a2f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 29 Sep 2009 13:17:36 +0100 Subject: gallium: New PIPE_OS_UNIX to simplify code that is portable to all unices. --- src/gallium/include/pipe/p_config.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/gallium/include/pipe/p_config.h b/src/gallium/include/pipe/p_config.h index de99957d9d..78fe1f4c87 100644 --- a/src/gallium/include/pipe/p_config.h +++ b/src/gallium/include/pipe/p_config.h @@ -122,18 +122,22 @@ #if defined(__linux__) #define PIPE_OS_LINUX +#define PIPE_OS_UNIX #endif #if defined(__FreeBSD__) #define PIPE_OS_BSD +#define PIPE_OS_UNIX #endif #if defined(__sun) #define PIPE_OS_SOLARIS +#define PIPE_OS_UNIX #endif #if defined(__APPLE__) #define PIPE_OS_APPLE +#define PIPE_OS_UNIX #endif #if defined(_WIN32) || defined(WIN32) @@ -142,6 +146,7 @@ #if defined(__HAIKU__) #define PIPE_OS_HAIKU +#define PIPE_OS_UNIX #endif /* -- cgit v1.2.3 From a81fb2a0d2c9a94fa362705edd1281fa7699d093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 29 Sep 2009 13:25:08 +0100 Subject: util: Cleanup u_cpu_detect, build. Support X86_64 and detect SSE4.1 too. I was waiting for the need to use this code to arise, and it finally came. I've tested building this on Linux and Windows, both x86 and x64_64. But it might break other platforms. Please bear with me and help me fix it. Many thanks to Dennis Smit who submitted this, and Eric Anholt whose work this was based on. --- src/gallium/auxiliary/util/Makefile | 1 + src/gallium/auxiliary/util/SConscript | 1 + src/gallium/auxiliary/util/u_cpu_detect.c | 741 +++++++++++++++--------------- src/gallium/auxiliary/util/u_cpu_detect.h | 82 ++-- 4 files changed, 410 insertions(+), 415 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/Makefile b/src/gallium/auxiliary/util/Makefile index ae8d330a78..1d8bb55bbd 100644 --- a/src/gallium/auxiliary/util/Makefile +++ b/src/gallium/auxiliary/util/Makefile @@ -10,6 +10,7 @@ C_SOURCES = \ u_debug_stack.c \ u_blit.c \ u_cache.c \ + u_cpu_detect.c \ u_draw_quad.c \ u_format.c \ u_format_access.c \ diff --git a/src/gallium/auxiliary/util/SConscript b/src/gallium/auxiliary/util/SConscript index 28a5ab4256..2187935fa4 100644 --- a/src/gallium/auxiliary/util/SConscript +++ b/src/gallium/auxiliary/util/SConscript @@ -24,6 +24,7 @@ util = env.ConvenienceLibrary( 'u_bitmask.c', 'u_blit.c', 'u_cache.c', + 'u_cpu_detect.c', 'u_debug.c', 'u_debug_dump.c', 'u_debug_memory.c', diff --git a/src/gallium/auxiliary/util/u_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c index d9f2f8fc28..ecfb96138d 100644 --- a/src/gallium/auxiliary/util/u_cpu_detect.c +++ b/src/gallium/auxiliary/util/u_cpu_detect.c @@ -24,23 +24,21 @@ * **************************************************************************/ -/* - * Based on the work of Eric Anholt +/** + * @file + * CPU feature detection. + * + * @author Dennis Smit + * @author Based on the work of Eric Anholt */ -/* FIXME: clean this entire file up */ +#include "pipe/p_config.h" +#include "u_debug.h" #include "u_cpu_detect.h" -#ifdef __linux__ -#define OS_LINUX -#endif -#ifdef WIN32 -#define OS_WIN32 -#endif - -#if defined(ARCH_POWERPC) -#if defined(OS_DARWIN) +#if defined(PIPE_ARCH_PPC) +#if defined(PIPE_OS_DARWIN) #include #else #include @@ -48,137 +46,140 @@ #endif #endif -#if defined(OS_NETBSD) || defined(OS_OPENBSD) +#if defined(PIPE_OS_NETBSD) || defined(PIPE_OS_OPENBSD) #include #include #include #endif -#if defined(OS_FREEBSD) +#if defined(PIPE_OS_FREEBSD) #include #include #endif -#if defined(OS_LINUX) +#if defined(PIPE_OS_LINUX) #include #endif -#if defined(OS_WIN32) -#include +#ifdef PIPE_OS_UNIX +#include #endif -#include -#include -#include -#include +#if defined(PIPE_OS_WINDOWS) +#include +#endif -static struct cpu_detect_caps __cpu_detect_caps; -static int __cpu_detect_initialized = 0; +struct util_cpu_caps util_cpu_caps; static int has_cpuid(void); static int cpuid(unsigned int ax, unsigned int *p); +#if defined(PIPE_ARCH_X86) + /* The sigill handlers */ -#if defined(ARCH_X86) /* x86 (linux katmai handler check thing) */ -#if defined(OS_LINUX) && defined(_POSIX_SOURCE) && defined(X86_FXSR_MAGIC) -static void sigill_handler_sse(int signal, struct sigcontext sc) +#if defined(PIPE_OS_LINUX) //&& defined(_POSIX_SOURCE) && defined(X86_FXSR_MAGIC) +static void +sigill_handler_sse(int signal, struct sigcontext sc) { - /* Both the "xorps %%xmm0,%%xmm0" and "divps %xmm0,%%xmm1" - * instructions are 3 bytes long. We must increment the instruction - * pointer manually to avoid repeated execution of the offending - * instruction. - * - * If the SIGILL is caused by a divide-by-zero when unmasked - * exceptions aren't supported, the SIMD FPU status and control - * word will be restored at the end of the test, so we don't need - * to worry about doing it here. Besides, we may not be able to... - */ - sc.eip += 3; - - __cpu_detect_caps.hasSSE=0; + /* Both the "xorps %%xmm0,%%xmm0" and "divps %xmm0,%%xmm1" + * instructions are 3 bytes long. We must increment the instruction + * pointer manually to avoid repeated execution of the offending + * instruction. + * + * If the SIGILL is caused by a divide-by-zero when unmasked + * exceptions aren't supported, the SIMD FPU status and control + * word will be restored at the end of the test, so we don't need + * to worry about doing it here. Besides, we may not be able to... + */ + sc.eip += 3; + + util_cpu_caps.has_sse=0; } -static void sigfpe_handler_sse(int signal, struct sigcontext sc) +static void +sigfpe_handler_sse(int signal, struct sigcontext sc) { - if (sc.fpstate->magic != 0xffff) { - /* Our signal context has the extended FPU state, so reset the - * divide-by-zero exception mask and clear the divide-by-zero - * exception bit. - */ - sc.fpstate->mxcsr |= 0x00000200; - sc.fpstate->mxcsr &= 0xfffffffb; - } else { - /* If we ever get here, we're completely hosed. - */ - } + if (sc.fpstate->magic != 0xffff) { + /* Our signal context has the extended FPU state, so reset the + * divide-by-zero exception mask and clear the divide-by-zero + * exception bit. + */ + sc.fpstate->mxcsr |= 0x00000200; + sc.fpstate->mxcsr &= 0xfffffffb; + } else { + /* If we ever get here, we're completely hosed. + */ + } } -#endif -#endif /* OS_LINUX && _POSIX_SOURCE && X86_FXSR_MAGIC */ +#endif /* PIPE_OS_LINUX && _POSIX_SOURCE && X86_FXSR_MAGIC */ -#if defined(OS_WIN32) -LONG CALLBACK win32_sig_handler_sse(EXCEPTION_POINTERS* ep) +#if defined(PIPE_OS_WINDOWS) +static LONG CALLBACK +win32_sig_handler_sse(EXCEPTION_POINTERS* ep) { - if(ep->ExceptionRecord->ExceptionCode==EXCEPTION_ILLEGAL_INSTRUCTION){ - ep->ContextRecord->Eip +=3; - __cpu_detect_caps.hasSSE=0; - return EXCEPTION_CONTINUE_EXECUTION; - } - return EXCEPTION_CONTINUE_SEARCH; + if(ep->ExceptionRecord->ExceptionCode==EXCEPTION_ILLEGAL_INSTRUCTION){ + ep->ContextRecord->Eip +=3; + util_cpu_caps.has_sse=0; + return EXCEPTION_CONTINUE_EXECUTION; + } + return EXCEPTION_CONTINUE_SEARCH; } -#endif /* OS_WIN32 */ +#endif /* PIPE_OS_WINDOWS */ + +#endif /* PIPE_ARCH_X86 */ -#if defined(ARCH_POWERPC) && !defined(OS_DARWIN) +#if defined(PIPE_ARCH_PPC) && !defined(PIPE_OS_DARWIN) static sigjmp_buf __lv_powerpc_jmpbuf; static volatile sig_atomic_t __lv_powerpc_canjump = 0; -static void sigill_handler (int sig); - -static void sigill_handler (int sig) +static void +sigill_handler(int sig) { - if (!__lv_powerpc_canjump) { - signal (sig, SIG_DFL); - raise (sig); - } + if (!__lv_powerpc_canjump) { + signal (sig, SIG_DFL); + raise (sig); + } - __lv_powerpc_canjump = 0; - siglongjmp(__lv_powerpc_jmpbuf, 1); + __lv_powerpc_canjump = 0; + siglongjmp(__lv_powerpc_jmpbuf, 1); } -static void check_os_altivec_support(void) +static void +check_os_altivec_support(void) { -#if defined(OS_DARWIN) - int sels[2] = {CTL_HW, HW_VECTORUNIT}; - int has_vu = 0; - int len = sizeof (has_vu); - int err; - - err = sysctl(sels, 2, &has_vu, &len, NULL, 0); - - if (err == 0) { - if (has_vu != 0) { - __cpu_detect_caps.hasAltiVec = 1; - } - } -#else /* !OS_DARWIN */ - /* no Darwin, do it the brute-force way */ - /* this is borrowed from the libmpeg2 library */ - signal(SIGILL, sigill_handler); - if (sigsetjmp(__lv_powerpc_jmpbuf, 1)) { - signal(SIGILL, SIG_DFL); - } else { - __lv_powerpc_canjump = 1; - - __asm __volatile - ("mtspr 256, %0\n\t" - "vand %%v0, %%v0, %%v0" - : - : "r" (-1)); - - signal(SIGILL, SIG_DFL); - __cpu_detect_caps.hasAltiVec = 1; - } +#if defined(PIPE_OS_DARWIN) + int sels[2] = {CTL_HW, HW_VECTORUNIT}; + int has_vu = 0; + int len = sizeof (has_vu); + int err; + + err = sysctl(sels, 2, &has_vu, &len, NULL, 0); + + if (err == 0) { + if (has_vu != 0) { + util_cpu_caps.has_altivec = 1; + } + } +#else /* !PIPE_OS_DARWIN */ + /* no Darwin, do it the brute-force way */ + /* this is borrowed from the libmpeg2 library */ + signal(SIGILL, sigill_handler); + if (sigsetjmp(__lv_powerpc_jmpbuf, 1)) { + signal(SIGILL, SIG_DFL); + } else { + __lv_powerpc_canjump = 1; + + __asm __volatile + ("mtspr 256, %0\n\t" + "vand %%v0, %%v0, %%v0" + : + : "r" (-1)); + + signal(SIGILL, SIG_DFL); + util_cpu_caps.has_altivec = 1; + } #endif } #endif @@ -189,318 +190,312 @@ static void check_os_altivec_support(void) * and RedHat patched 2.2 kernels that have broken exception handling * support for user space apps that do SSE. */ -static void check_os_katmai_support(void) +static void +check_os_katmai_support(void) { -#if defined(ARCH_X86) -#if defined(OS_FREEBSD) - int has_sse=0, ret; - int len = sizeof (has_sse); - - ret = sysctlbyname("hw.instruction_sse", &has_sse, &len, NULL, 0); - if (ret || !has_sse) - __cpu_detect_caps.hasSSE=0; - -#elif defined(OS_NETBSD) || defined(OS_OPENBSD) - int has_sse, has_sse2, ret, mib[2]; - int varlen; - - mib[0] = CTL_MACHDEP; - mib[1] = CPU_SSE; - varlen = sizeof (has_sse); - - ret = sysctl(mib, 2, &has_sse, &varlen, NULL, 0); - if (ret < 0 || !has_sse) { - __cpu_detect_caps.hasSSE = 0; - } else { - __cpu_detect_caps.hasSSE = 1; - } - - mib[1] = CPU_SSE2; - varlen = sizeof (has_sse2); - ret = sysctl(mib, 2, &has_sse2, &varlen, NULL, 0); - if (ret < 0 || !has_sse2) { - __cpu_detect_caps.hasSSE2 = 0; - } else { - __cpu_detect_caps.hasSSE2 = 1; - } - __cpu_detect_caps.hasSSE = 0; /* FIXME ?!?!? */ - -#elif defined(OS_WIN32) - LPTOP_LEVEL_EXCEPTION_FILTER exc_fil; - if (__cpu_detect_caps.hasSSE) { - exc_fil = SetUnhandledExceptionFilter(win32_sig_handler_sse); - __asm __volatile ("xorps %xmm0, %xmm0"); - SetUnhandledExceptionFilter(exc_fil); - } -#elif defined(OS_LINUX) - struct sigaction saved_sigill; - struct sigaction saved_sigfpe; - - /* Save the original signal handlers. - */ - sigaction(SIGILL, NULL, &saved_sigill); - sigaction(SIGFPE, NULL, &saved_sigfpe); - - signal(SIGILL, (void (*)(int))sigill_handler_sse); - signal(SIGFPE, (void (*)(int))sigfpe_handler_sse); - - /* Emulate test for OSFXSR in CR4. The OS will set this bit if it - * supports the extended FPU save and restore required for SSE. If - * we execute an SSE instruction on a PIII and get a SIGILL, the OS - * doesn't support Streaming SIMD Exceptions, even if the processor - * does. - */ - if (__cpu_detect_caps.hasSSE) { - __asm __volatile ("xorps %xmm1, %xmm0"); - } - - /* Emulate test for OSXMMEXCPT in CR4. The OS will set this bit if - * it supports unmasked SIMD FPU exceptions. If we unmask the - * exceptions, do a SIMD divide-by-zero and get a SIGILL, the OS - * doesn't support unmasked SIMD FPU exceptions. If we get a SIGFPE - * as expected, we're okay but we need to clean up after it. - * - * Are we being too stringent in our requirement that the OS support - * unmasked exceptions? Certain RedHat 2.2 kernels enable SSE by - * setting CR4.OSFXSR but don't support unmasked exceptions. Win98 - * doesn't even support them. We at least know the user-space SSE - * support is good in kernels that do support unmasked exceptions, - * and therefore to be safe I'm going to leave this test in here. - */ - if (__cpu_detect_caps.hasSSE) { - // test_os_katmai_exception_support(); - } - - /* Restore the original signal handlers. - */ - sigaction(SIGILL, &saved_sigill, NULL); - sigaction(SIGFPE, &saved_sigfpe, NULL); +#if defined(PIPE_ARCH_X86) +#if defined(PIPE_OS_FREEBSD) + int has_sse=0, ret; + int len = sizeof (has_sse); + + ret = sysctlbyname("hw.instruction_sse", &has_sse, &len, NULL, 0); + if (ret || !has_sse) + util_cpu_caps.has_sse=0; + +#elif defined(PIPE_OS_NETBSD) || defined(PIPE_OS_OPENBSD) + int has_sse, has_sse2, ret, mib[2]; + int varlen; + + mib[0] = CTL_MACHDEP; + mib[1] = CPU_SSE; + varlen = sizeof (has_sse); + + ret = sysctl(mib, 2, &has_sse, &varlen, NULL, 0); + if (ret < 0 || !has_sse) { + util_cpu_caps.has_sse = 0; + } else { + util_cpu_caps.has_sse = 1; + } + + mib[1] = CPU_SSE2; + varlen = sizeof (has_sse2); + ret = sysctl(mib, 2, &has_sse2, &varlen, NULL, 0); + if (ret < 0 || !has_sse2) { + util_cpu_caps.has_sse2 = 0; + } else { + util_cpu_caps.has_sse2 = 1; + } + util_cpu_caps.has_sse = 0; /* FIXME ?!?!? */ + +#elif defined(PIPE_OS_WINDOWS) + LPTOP_LEVEL_EXCEPTION_FILTER exc_fil; + if (util_cpu_caps.has_sse) { + exc_fil = SetUnhandledExceptionFilter(win32_sig_handler_sse); +#if defined(PIPE_CC_GCC) + __asm __volatile ("xorps %xmm0, %xmm0"); +#elif defined(PIPE_CC_MSVC) + __asm { + xorps xmm0, xmm0 // executing SSE instruction + } +#else +#error Unsupported compiler +#endif + SetUnhandledExceptionFilter(exc_fil); + } +#elif defined(PIPE_OS_LINUX) + struct sigaction saved_sigill; + struct sigaction saved_sigfpe; + + /* Save the original signal handlers. + */ + sigaction(SIGILL, NULL, &saved_sigill); + sigaction(SIGFPE, NULL, &saved_sigfpe); + + signal(SIGILL, (void (*)(int))sigill_handler_sse); + signal(SIGFPE, (void (*)(int))sigfpe_handler_sse); + + /* Emulate test for OSFXSR in CR4. The OS will set this bit if it + * supports the extended FPU save and restore required for SSE. If + * we execute an SSE instruction on a PIII and get a SIGILL, the OS + * doesn't support Streaming SIMD Exceptions, even if the processor + * does. + */ + if (util_cpu_caps.has_sse) { + __asm __volatile ("xorps %xmm1, %xmm0"); + } + + /* Emulate test for OSXMMEXCPT in CR4. The OS will set this bit if + * it supports unmasked SIMD FPU exceptions. If we unmask the + * exceptions, do a SIMD divide-by-zero and get a SIGILL, the OS + * doesn't support unmasked SIMD FPU exceptions. If we get a SIGFPE + * as expected, we're okay but we need to clean up after it. + * + * Are we being too stringent in our requirement that the OS support + * unmasked exceptions? Certain RedHat 2.2 kernels enable SSE by + * setting CR4.OSFXSR but don't support unmasked exceptions. Win98 + * doesn't even support them. We at least know the user-space SSE + * support is good in kernels that do support unmasked exceptions, + * and therefore to be safe I'm going to leave this test in here. + */ + if (util_cpu_caps.has_sse) { + // test_os_katmai_exception_support(); + } + + /* Restore the original signal handlers. + */ + sigaction(SIGILL, &saved_sigill, NULL); + sigaction(SIGFPE, &saved_sigfpe, NULL); #else - /* We can't use POSIX signal handling to test the availability of - * SSE, so we disable it by default. - */ - __cpu_detect_caps.hasSSE = 0; + /* We can't use POSIX signal handling to test the availability of + * SSE, so we disable it by default. + */ + util_cpu_caps.has_sse = 0; #endif /* __linux__ */ #endif + +#if defined(PIPE_ARCH_X86_64) + util_cpu_caps.has_sse = 1; +#endif } static int has_cpuid(void) { -#if defined(ARCH_X86) - int a, c; - - __asm __volatile - ("pushf\n" - "popl %0\n" - "movl %0, %1\n" - "xorl $0x200000, %0\n" - "push %0\n" - "popf\n" - "pushf\n" - "popl %0\n" - : "=a" (a), "=c" (c) - : - : "cc"); - - return a != c; +#if defined(PIPE_ARCH_X86) +#if defined(PIPE_OS_GCC) + int a, c; + + __asm __volatile + ("pushf\n" + "popl %0\n" + "movl %0, %1\n" + "xorl $0x200000, %0\n" + "push %0\n" + "popf\n" + "pushf\n" + "popl %0\n" + : "=a" (a), "=c" (c) + : + : "cc"); + + return a != c; +#else + /* FIXME */ + return 1; +#endif +#elif defined(PIPE_ARCH_X86_64) + return 1; #else - return 0; + return 0; #endif } -static int cpuid(unsigned int ax, unsigned int *p) +static INLINE int +cpuid(unsigned int ax, unsigned int *p) { -#if defined(ARCH_X86) - unsigned int flags; - - __asm __volatile - ("movl %%ebx, %%esi\n\t" - "cpuid\n\t" - "xchgl %%ebx, %%esi" - : "=a" (p[0]), "=S" (p[1]), - "=c" (p[2]), "=d" (p[3]) - : "0" (ax)); - - return 0; -#else - return -1; + int ret = -1; + +#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) +#if defined(PIPE_CC_GCC) + __asm __volatile + ("movl %%ebx, %%esi\n\t" + "cpuid\n\t" + "xchgl %%ebx, %%esi" + : "=a" (p[0]), "=S" (p[1]), + "=c" (p[2]), "=d" (p[3]) + : "0" (ax)); + + ret = 0; +#elif defined(PIPE_CC_MSVC) + __cpuid(ax, p); + + ret = 0; +#endif #endif + + return ret; } -void cpu_detect_initialize() +void +util_cpu_detect(void) { - unsigned int regs[4]; - unsigned int regs2[4]; - - int mib[2], ncpu; - int len; - - memset(&__cpu_detect_caps, 0, sizeof (struct cpu_detect_caps)); - - /* Check for arch type */ -#if defined(ARCH_MIPS) - __cpu_detect_caps.type = CPU_DETECT_TYPE_MIPS; -#elif defined(ARCH_ALPHA) - __cpu_detect_caps.type = CPU_DETECT_TYPE_ALPHA; -#elif defined(ARCH_SPARC) - __cpu_detect_caps.type = CPU_DETECT_TYPE_SPARC; -#elif defined(ARCH_X86) - __cpu_detect_caps.type = CPU_DETECT_TYPE_X86; -#elif defined(ARCH_POWERPC) - __cpu_detect_caps.type = CPU_DETECT_TYPE_POWERPC; + static boolean util_cpu_detect_initialized = FALSE; + + if(util_cpu_detect_initialized) + return; + + memset(&util_cpu_caps, 0, sizeof util_cpu_caps); + + /* Check for arch type */ +#if defined(PIPE_ARCH_MIPS) + util_cpu_caps.arch = UTIL_CPU_ARCH_MIPS; +#elif defined(PIPE_ARCH_ALPHA) + util_cpu_caps.arch = UTIL_CPU_ARCH_ALPHA; +#elif defined(PIPE_ARCH_SPARC) + util_cpu_caps.arch = UTIL_CPU_ARCH_SPARC; +#elif defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) + util_cpu_caps.arch = UTIL_CPU_ARCH_X86; +#elif defined(PIPE_ARCH_PPC) + util_cpu_caps.arch = UTIL_CPU_ARCH_POWERPC; #else - __cpu_detect_caps.type = CPU_DETECT_TYPE_OTHER; + util_cpu_caps.arch = UTIL_CPU_ARCH_UNKNOWN; #endif - /* Count the number of CPUs in system */ -#if !defined(OS_WIN32) && !defined(OS_UNKNOWN) && defined(_SC_NPROCESSORS_ONLN) - __cpu_detect_caps.nrcpu = sysconf(_SC_NPROCESSORS_ONLN); - if (__cpu_detect_caps.nrcpu == -1) - __cpu_detect_caps.nrcpu = 1; - -#elif defined(OS_NETBSD) || defined(OS_FREEBSD) || defined(OS_OPENBSD) + /* Count the number of CPUs in system */ +#if !defined(PIPE_OS_WINDOWS) && !defined(PIPE_OS_UNKNOWN) && defined(_SC_NPROCESSORS_ONLN) + util_cpu_caps.nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); + if (util_cpu_caps.nr_cpus == -1) + util_cpu_caps.nr_cpus = 1; - mib[0] = CTL_HW; - mib[1] = HW_NCPU; +#elif defined(PIPE_OS_NETBSD) || defined(PIPE_OS_FREEBSD) || defined(PIPE_OS_OPENBSD) + { + int mib[2], ncpu; + int len; - len = sizeof (ncpu); - sysctl(mib, 2, &ncpu, &len, NULL, 0); - __cpu_detect_caps.nrcpu = ncpu; + mib[0] = CTL_HW; + mib[1] = HW_NCPU; + len = sizeof (ncpu); + sysctl(mib, 2, &ncpu, &len, NULL, 0); + util_cpu_caps.nr_cpus = ncpu; + } #else - __cpu_detect_caps.nrcpu = 1; + util_cpu_caps.nr_cpus = 1; #endif -#if defined(ARCH_X86) - /* No cpuid, old 486 or lower */ - if (has_cpuid() == 0) - return; +#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) + if (has_cpuid()) { + unsigned int regs[4]; + unsigned int regs2[4]; - __cpu_detect_caps.cacheline = 32; + util_cpu_caps.cacheline = 32; - /* Get max cpuid level */ - cpuid(0x00000000, regs); + /* Get max cpuid level */ + cpuid(0x00000000, regs); - if (regs[0] >= 0x00000001) { - unsigned int cacheline; + if (regs[0] >= 0x00000001) { + unsigned int cacheline; - cpuid (0x00000001, regs2); + cpuid (0x00000001, regs2); - __cpu_detect_caps.x86cpuType = (regs2[0] >> 8) & 0xf; - if (__cpu_detect_caps.x86cpuType == 0xf) - __cpu_detect_caps.x86cpuType = 8 + ((regs2[0] >> 20) & 255); /* use extended family (P4, IA64) */ + util_cpu_caps.x86_cpu_type = (regs2[0] >> 8) & 0xf; + if (util_cpu_caps.x86_cpu_type == 0xf) + util_cpu_caps.x86_cpu_type = 8 + ((regs2[0] >> 20) & 255); /* use extended family (P4, IA64) */ - /* general feature flags */ - __cpu_detect_caps.hasTSC = (regs2[3] & (1 << 8 )) >> 8; /* 0x0000010 */ - __cpu_detect_caps.hasMMX = (regs2[3] & (1 << 23 )) >> 23; /* 0x0800000 */ - __cpu_detect_caps.hasSSE = (regs2[3] & (1 << 25 )) >> 25; /* 0x2000000 */ - __cpu_detect_caps.hasSSE2 = (regs2[3] & (1 << 26 )) >> 26; /* 0x4000000 */ - __cpu_detect_caps.hasSSE3 = (regs2[2] & (1)); /* 0x0000001 */ - __cpu_detect_caps.hasSSSE3 = (regs2[2] & (1 << 9 )) >> 9; /* 0x0000020 */ - __cpu_detect_caps.hasMMX2 = __cpu_detect_caps.hasSSE; /* SSE cpus supports mmxext too */ + /* general feature flags */ + util_cpu_caps.has_tsc = (regs2[3] & (1 << 8 )) >> 8; /* 0x0000010 */ + util_cpu_caps.has_mmx = (regs2[3] & (1 << 23 )) >> 23; /* 0x0800000 */ + util_cpu_caps.has_sse = (regs2[3] & (1 << 25 )) >> 25; /* 0x2000000 */ + util_cpu_caps.has_sse2 = (regs2[3] & (1 << 26 )) >> 26; /* 0x4000000 */ + util_cpu_caps.has_sse3 = (regs2[2] & (1)); /* 0x0000001 */ + util_cpu_caps.has_ssse3 = (regs2[2] & (1 << 9 )) >> 9; /* 0x0000020 */ + util_cpu_caps.has_sse4_1 = (regs2[2] & (1 << 19)) >> 19; + util_cpu_caps.has_mmx2 = util_cpu_caps.has_sse; /* SSE cpus supports mmxext too */ - cacheline = ((regs2[1] >> 8) & 0xFF) * 8; - if (cacheline > 0) - __cpu_detect_caps.cacheline = cacheline; - } + cacheline = ((regs2[1] >> 8) & 0xFF) * 8; + if (cacheline > 0) + util_cpu_caps.cacheline = cacheline; + } - cpuid(0x80000000, regs); + cpuid(0x80000000, regs); - if (regs[0] >= 0x80000001) { + if (regs[0] >= 0x80000001) { - cpuid(0x80000001, regs2); + cpuid(0x80000001, regs2); - __cpu_detect_caps.hasMMX |= (regs2[3] & (1 << 23 )) >> 23; /* 0x0800000 */ - __cpu_detect_caps.hasMMX2 |= (regs2[3] & (1 << 22 )) >> 22; /* 0x400000 */ - __cpu_detect_caps.has3DNow = (regs2[3] & (1 << 31 )) >> 31; /* 0x80000000 */ - __cpu_detect_caps.has3DNowExt = (regs2[3] & (1 << 30 )) >> 30; - } + util_cpu_caps.has_mmx |= (regs2[3] & (1 << 23 )) >> 23; /* 0x0800000 */ + util_cpu_caps.has_mmx2 |= (regs2[3] & (1 << 22 )) >> 22; /* 0x400000 */ + util_cpu_caps.has_3dnow = (regs2[3] & (1 << 31 )) >> 31; /* 0x80000000 */ + util_cpu_caps.has_3dnow_ext = (regs2[3] & (1 << 30 )) >> 30; + } - if (regs[0] >= 0x80000006) { - cpuid(0x80000006, regs2); - __cpu_detect_caps.cacheline = regs2[2] & 0xFF; - } + if (regs[0] >= 0x80000006) { + cpuid(0x80000006, regs2); + util_cpu_caps.cacheline = regs2[2] & 0xFF; + } +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_FREEBSD) || defined(PIPE_OS_NETBSD) || defined(PIPE_OS_CYGWIN) || defined(PIPE_OS_OPENBSD) + if (util_cpu_caps.has_sse) + check_os_katmai_support(); -#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_NETBSD) || defined(OS_CYGWIN) || defined(OS_OPENBSD) - if (__cpu_detect_caps.hasSSE) - check_os_katmai_support(); - - if (!__cpu_detect_caps.hasSSE) { - __cpu_detect_caps.hasSSE2 = 0; - __cpu_detect_caps.hasSSE3 = 0; - __cpu_detect_caps.hasSSSE3 = 0; - } + if (!util_cpu_caps.has_sse) { + util_cpu_caps.has_sse2 = 0; + util_cpu_caps.has_sse3 = 0; + util_cpu_caps.has_ssse3 = 0; + } #else - __cpu_detect_caps.hasSSE = 0; - __cpu_detect_caps.hasSSE2 = 0; - __cpu_detect_caps.hasSSE3 = 0; - __cpu_detect_caps.hasSSSE3 = 0; + util_cpu_caps.has_sse = 0; + util_cpu_caps.has_sse2 = 0; + util_cpu_caps.has_sse3 = 0; + util_cpu_caps.has_ssse3 = 0; +#endif + } +#endif /* PIPE_ARCH_X86 || PIPE_ARCH_X86_64 */ + +#if defined(PIPE_ARCH_PPC) + check_os_altivec_support(); +#endif /* PIPE_ARCH_PPC */ + +#ifdef DEBUG + debug_printf("util_cpu_caps.arch = %i\n", util_cpu_caps.arch); + debug_printf("util_cpu_caps.nr_cpus = %u\n", util_cpu_caps.nr_cpus); + + debug_printf("util_cpu_caps.x86_cpu_type = %u\n", util_cpu_caps.x86_cpu_type); + debug_printf("util_cpu_caps.cacheline = %u\n", util_cpu_caps.cacheline); + + debug_printf("util_cpu_caps.has_tsc = %u\n", util_cpu_caps.has_tsc); + debug_printf("util_cpu_caps.has_mmx = %u\n", util_cpu_caps.has_mmx); + debug_printf("util_cpu_caps.has_mmx2 = %u\n", util_cpu_caps.has_mmx2); + debug_printf("util_cpu_caps.has_sse = %u\n", util_cpu_caps.has_sse); + debug_printf("util_cpu_caps.has_sse2 = %u\n", util_cpu_caps.has_sse2); + debug_printf("util_cpu_caps.has_sse3 = %u\n", util_cpu_caps.has_sse3); + debug_printf("util_cpu_caps.has_ssse3 = %u\n", util_cpu_caps.has_ssse3); + debug_printf("util_cpu_caps.has_sse4_1 = %u\n", util_cpu_caps.has_sse4_1); + debug_printf("util_cpu_caps.has_3dnow = %u\n", util_cpu_caps.has_3dnow); + debug_printf("util_cpu_caps.has_3dnow_ext = %u\n", util_cpu_caps.has_3dnow_ext); + debug_printf("util_cpu_caps.has_altivec = %u\n", util_cpu_caps.has_altivec); #endif -#endif /* ARCH_X86 */ - -#if defined(ARCH_POWERPC) - check_os_altivec_support(); -#endif /* ARCH_POWERPC */ - - __cpu_detect_initialized = 1; -} - -struct cpu_detect_caps *cpu_detect_get_caps() -{ - return &__cpu_detect_caps; -} - -/* The getters and setters for feature flags */ -int cpu_detect_get_tsc() -{ - return __cpu_detect_caps.hasTSC; -} - -int cpu_detect_get_mmx() -{ - return __cpu_detect_caps.hasMMX; -} - -int cpu_detect_get_mmx2() -{ - return __cpu_detect_caps.hasMMX2; -} - -int cpu_detect_get_sse() -{ - return __cpu_detect_caps.hasSSE; -} - -int cpu_detect_get_sse2() -{ - return __cpu_detect_caps.hasSSE2; -} - -int cpu_detect_get_sse3() -{ - return __cpu_detect_caps.hasSSE3; -} - -int cpu_detect_get_ssse3() -{ - return __cpu_detect_caps.hasSSSE3; -} - -int cpu_detect_get_3dnow() -{ - return __cpu_detect_caps.has3DNow; -} - -int cpu_detect_get_3dnow2() -{ - return __cpu_detect_caps.has3DNowExt; -} -int cpu_detect_get_altivec() -{ - return __cpu_detect_caps.hasAltiVec; + util_cpu_detect_initialized = TRUE; } - diff --git a/src/gallium/auxiliary/util/u_cpu_detect.h b/src/gallium/auxiliary/util/u_cpu_detect.h index 1612d49286..7ea0121c07 100644 --- a/src/gallium/auxiliary/util/u_cpu_detect.h +++ b/src/gallium/auxiliary/util/u_cpu_detect.h @@ -24,55 +24,53 @@ * ***************************************************************************/ -/* - * Based on the work of Eric Anholt +/** + * @file + * CPU feature detection. + * + * @author Dennis Smit + * @author Based on the work of Eric Anholt */ -#ifndef _CPU_DETECT_H -#define _CPU_DETECT_H +#ifndef _UTIL_CPU_DETECT_H +#define _UTIL_CPU_DETECT_H + +#include "pipe/p_compiler.h" -typedef enum { - CPU_DETECT_TYPE_MIPS, - CPU_DETECT_TYPE_ALPHA, - CPU_DETECT_TYPE_SPARC, - CPU_DETECT_TYPE_X86, - CPU_DETECT_TYPE_POWERPC, - CPU_DETECT_TYPE_OTHER -} cpu_detect_type; +enum util_cpu_arch { + UTIL_CPU_ARCH_UNKNOWN = 0, + UTIL_CPU_ARCH_MIPS, + UTIL_CPU_ARCH_ALPHA, + UTIL_CPU_ARCH_SPARC, + UTIL_CPU_ARCH_X86, + UTIL_CPU_ARCH_POWERPC +}; -struct cpu_detect_caps { - cpu_detect_type type; - int nrcpu; +struct util_cpu_caps { + enum util_cpu_arch arch; + unsigned nr_cpus; - /* Feature flags */ - int x86cpuType; - int cacheline; + /* Feature flags */ + int x86_cpu_type; + unsigned cacheline; - int hasTSC; - int hasMMX; - int hasMMX2; - int hasSSE; - int hasSSE2; - int hasSSE3; - int hasSSSE3; - int has3DNow; - int has3DNowExt; - int hasAltiVec; + unsigned has_tsc:1; + unsigned has_mmx:1; + unsigned has_mmx2:1; + unsigned has_sse:1; + unsigned has_sse2:1; + unsigned has_sse3:1; + unsigned has_ssse3:1; + unsigned has_sse4_1:1; + unsigned has_3dnow:1; + unsigned has_3dnow_ext:1; + unsigned has_altivec:1; }; -/* prototypes */ -void cpu_detect_initialize(void); -struct cpu_detect_caps *cpu_detect_get_caps(void); +extern struct util_cpu_caps +util_cpu_caps; + +void util_cpu_detect(void); -int cpu_detect_get_tsc(void); -int cpu_detect_get_mmx(void); -int cpu_detect_get_mmx2(void); -int cpu_detect_get_sse(void); -int cpu_detect_get_sse2(void); -int cpu_detect_get_sse3(void); -int cpu_detect_get_ssse3(void); -int cpu_detect_get_3dnow(void); -int cpu_detect_get_3dnow2(void); -int cpu_detect_get_altivec(void); -#endif /* _CPU_DETECT_H */ +#endif /* _UTIL_CPU_DETECT_H */ -- cgit v1.2.3 From 7cda8ea44c2b65265cefa79bd29a4990ac81cee6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 29 Sep 2009 13:58:58 +0100 Subject: llvmpipe: Emit SSE intrinsics based on runtime cpu capability check. Note that llvmpipe still doesn't run on any processor yet: if you don't have a recent processor with SSE4.1 you will still likely end up hitting a code path for which a generic non-sse4 version is not implemented yet. --- src/gallium/drivers/llvmpipe/lp_bld_arit.c | 72 +++++++++++------------------ src/gallium/drivers/llvmpipe/lp_bld_conv.c | 7 ++- src/gallium/drivers/llvmpipe/lp_bld_logic.c | 6 ++- src/gallium/drivers/llvmpipe/lp_jit.c | 3 ++ 4 files changed, 37 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.c b/src/gallium/drivers/llvmpipe/lp_bld_arit.c index 31433318a7..e8c5fa3c2a 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_arit.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.c @@ -48,6 +48,7 @@ #include "util/u_memory.h" #include "util/u_debug.h" #include "util/u_string.h" +#include "util/u_cpu_detect.h" #include "lp_bld_type.h" #include "lp_bld_const.h" @@ -119,30 +120,28 @@ lp_build_max_simple(struct lp_build_context *bld, /* TODO: optimize the constant case */ -#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) if(type.width * type.length == 128) { if(type.floating) { - if(type.width == 32) + if(type.width == 32 && util_cpu_caps.has_sse) intrinsic = "llvm.x86.sse.max.ps"; - if(type.width == 64) + if(type.width == 64 && util_cpu_caps.has_sse2) intrinsic = "llvm.x86.sse2.max.pd"; } else { - if(type.width == 8 && !type.sign) + if(type.width == 8 && !type.sign && util_cpu_caps.has_sse2) intrinsic = "llvm.x86.sse2.pmaxu.b"; - if(type.width == 8 && type.sign) + if(type.width == 8 && type.sign && util_cpu_caps.has_sse4_1) intrinsic = "llvm.x86.sse41.pmaxsb"; - if(type.width == 16 && !type.sign) + if(type.width == 16 && !type.sign && util_cpu_caps.has_sse4_1) intrinsic = "llvm.x86.sse41.pmaxuw"; - if(type.width == 16 && type.sign) + if(type.width == 16 && type.sign && util_cpu_caps.has_sse2) intrinsic = "llvm.x86.sse2.pmaxs.w"; - if(type.width == 32 && !type.sign) + if(type.width == 32 && !type.sign && util_cpu_caps.has_sse4_1) intrinsic = "llvm.x86.sse41.pmaxud"; - if(type.width == 32 && type.sign) + if(type.width == 32 && type.sign && util_cpu_caps.has_sse4_1) intrinsic = "llvm.x86.sse41.pmaxsd"; } } -#endif if(intrinsic) return lp_build_intrinsic_binary(bld->builder, intrinsic, lp_build_vec_type(bld->type), a, b); @@ -204,15 +203,14 @@ lp_build_add(struct lp_build_context *bld, if(a == bld->one || b == bld->one) return bld->one; -#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) - if(type.width * type.length == 128 && + if(util_cpu_caps.has_sse2 && + type.width * type.length == 128 && !type.floating && !type.fixed) { if(type.width == 8) intrinsic = type.sign ? "llvm.x86.sse2.padds.b" : "llvm.x86.sse2.paddus.b"; if(type.width == 16) intrinsic = type.sign ? "llvm.x86.sse2.padds.w" : "llvm.x86.sse2.paddus.w"; } -#endif if(intrinsic) return lp_build_intrinsic_binary(bld->builder, intrinsic, lp_build_vec_type(bld->type), a, b); @@ -257,15 +255,14 @@ lp_build_sub(struct lp_build_context *bld, if(b == bld->one) return bld->zero; -#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) - if(type.width * type.length == 128 && + if(util_cpu_caps.has_sse2 && + type.width * type.length == 128 && !type.floating && !type.fixed) { if(type.width == 8) intrinsic = type.sign ? "llvm.x86.sse2.psubs.b" : "llvm.x86.sse2.psubus.b"; if(type.width == 16) intrinsic = type.sign ? "llvm.x86.sse2.psubs.w" : "llvm.x86.sse2.psubus.w"; } -#endif if(intrinsic) return lp_build_intrinsic_binary(bld->builder, intrinsic, lp_build_vec_type(bld->type), a, b); @@ -419,8 +416,7 @@ lp_build_mul(struct lp_build_context *bld, return bld->undef; if(!type.floating && !type.fixed && type.norm) { -#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) - if(type.width == 8 && type.length == 16) { + if(util_cpu_caps.has_sse2 && type.width == 8 && type.length == 16) { LLVMTypeRef i16x8 = LLVMVectorType(LLVMInt16Type(), 8); LLVMTypeRef i8x16 = LLVMVectorType(LLVMInt8Type(), 16); static LLVMValueRef ml = NULL; @@ -456,7 +452,6 @@ lp_build_mul(struct lp_build_context *bld, return ab; } -#endif /* FIXME */ assert(0); @@ -493,10 +488,8 @@ lp_build_div(struct lp_build_context *bld, if(LLVMIsConstant(a) && LLVMIsConstant(b)) return LLVMConstFDiv(a, b); -#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) - if(type.width == 32 && type.length == 4) + if(util_cpu_caps.has_sse && type.width == 32 && type.length == 4) return lp_build_mul(bld, a, lp_build_rcp(bld, b)); -#endif return LLVMBuildFDiv(bld->builder, a, b, ""); } @@ -606,8 +599,7 @@ lp_build_abs(struct lp_build_context *bld, return a; } -#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) - if(type.width*type.length == 128) { + if(type.width*type.length == 128 && util_cpu_caps.has_ssse3) { switch(type.width) { case 8: return lp_build_intrinsic_unary(bld->builder, "llvm.x86.ssse3.pabs.b.128", vec_type, a); @@ -617,7 +609,6 @@ lp_build_abs(struct lp_build_context *bld, return lp_build_intrinsic_unary(bld->builder, "llvm.x86.ssse3.pabs.d.128", vec_type, a); } } -#endif return lp_build_max(bld, a, LLVMBuildNeg(bld->builder, a, "")); } @@ -710,9 +701,8 @@ lp_build_round(struct lp_build_context *bld, assert(type.floating); -#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) - return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_NEAREST); -#endif + if(util_cpu_caps.has_sse4_1) + return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_NEAREST); /* FIXME */ assert(0); @@ -728,9 +718,8 @@ lp_build_floor(struct lp_build_context *bld, assert(type.floating); -#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) - return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_FLOOR); -#endif + if(util_cpu_caps.has_sse4_1) + return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_FLOOR); /* FIXME */ assert(0); @@ -746,9 +735,8 @@ lp_build_ceil(struct lp_build_context *bld, assert(type.floating); -#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) - return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_CEIL); -#endif + if(util_cpu_caps.has_sse4_1) + return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_CEIL); /* FIXME */ assert(0); @@ -764,9 +752,8 @@ lp_build_trunc(struct lp_build_context *bld, assert(type.floating); -#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) - return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_TRUNCATE); -#endif + if(util_cpu_caps.has_sse4_1) + return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_TRUNCATE); /* FIXME */ assert(0); @@ -837,11 +824,9 @@ lp_build_rcp(struct lp_build_context *bld, if(LLVMIsConstant(a)) return LLVMConstFDiv(bld->one, a); - /* XXX: is this really necessary? */ -#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) - if(type.width == 32 && type.length == 4) + if(util_cpu_caps.has_sse && type.width == 32 && type.length == 4) + /* FIXME: improve precision */ return lp_build_intrinsic_unary(bld->builder, "llvm.x86.sse.rcp.ps", lp_build_vec_type(type), a); -#endif return LLVMBuildFDiv(bld->builder, bld->one, a, ""); } @@ -858,11 +843,8 @@ lp_build_rsqrt(struct lp_build_context *bld, assert(type.floating); - /* XXX: is this really necessary? */ -#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) - if(type.width == 32 && type.length == 4) + if(util_cpu_caps.has_sse && type.width == 32 && type.length == 4) return lp_build_intrinsic_unary(bld->builder, "llvm.x86.sse.rsqrt.ps", lp_build_vec_type(type), a); -#endif return lp_build_rcp(bld, lp_build_sqrt(bld, a)); } diff --git a/src/gallium/drivers/llvmpipe/lp_bld_conv.c b/src/gallium/drivers/llvmpipe/lp_bld_conv.c index 186cac70f6..20c8710214 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_conv.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_conv.c @@ -63,6 +63,7 @@ #include "util/u_debug.h" #include "util/u_math.h" +#include "util/u_cpu_detect.h" #include "lp_bld_type.h" #include "lp_bld_const.h" @@ -334,8 +335,7 @@ lp_build_pack2(LLVMBuilderRef builder, assert(!src_type.floating); assert(!dst_type.floating); -#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) - if(src_type.width * src_type.length == 128) { + if(util_cpu_caps.has_sse2 && src_type.width * src_type.length == 128) { /* All X86 non-interleaved pack instructions all take signed inputs and * saturate them, so saturate beforehand. */ if(!src_type.sign && !clamped) { @@ -349,7 +349,7 @@ lp_build_pack2(LLVMBuilderRef builder, switch(src_type.width) { case 32: - if(dst_type.sign) + if(dst_type.sign || !util_cpu_caps.has_sse4_1) res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packssdw.128", src_vec_type, lo, hi); else /* PACKUSDW is the only instrinsic with a consistent signature */ @@ -372,7 +372,6 @@ lp_build_pack2(LLVMBuilderRef builder, res = LLVMBuildBitCast(builder, res, dst_vec_type, ""); return res; } -#endif lo = LLVMBuildBitCast(builder, lo, dst_vec_type, ""); hi = LLVMBuildBitCast(builder, hi, dst_vec_type, ""); diff --git a/src/gallium/drivers/llvmpipe/lp_bld_logic.c b/src/gallium/drivers/llvmpipe/lp_bld_logic.c index 6b6f820769..db22a8028a 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_logic.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_logic.c @@ -33,6 +33,8 @@ */ +#include "util/u_cpu_detect.h" + #include "lp_bld_type.h" #include "lp_bld_const.h" #include "lp_bld_intr.h" @@ -65,7 +67,7 @@ lp_build_cmp(struct lp_build_context *bld, #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) if(type.width * type.length == 128) { - if(type.floating) { + if(type.floating && util_cpu_caps.has_sse) { LLVMValueRef args[3]; unsigned cc; boolean swap; @@ -114,7 +116,7 @@ lp_build_cmp(struct lp_build_context *bld, res = LLVMBuildBitCast(bld->builder, res, int_vec_type, ""); return res; } - else { + else if(util_cpu_caps.has_sse2) { static const struct { unsigned swap:1; unsigned eq:1; diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c index f7111c1e5c..5d2cf01e5b 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.c +++ b/src/gallium/drivers/llvmpipe/lp_jit.c @@ -36,6 +36,7 @@ #include #include "util/u_memory.h" +#include "util/u_cpu_detect.h" #include "lp_screen.h" #include "lp_bld_intr.h" #include "lp_jit.h" @@ -147,6 +148,8 @@ lp_jit_screen_init(struct llvmpipe_screen *screen) { char *error = NULL; + util_cpu_detect(); + #ifdef LLVM_NATIVE_ARCH LLVMLinkInJIT(); LLVMInitializeNativeTarget(); -- cgit v1.2.3 From 358c5a8fd1d518930c3e87316a2c743a661ac553 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 25 Sep 2009 22:54:34 +0800 Subject: egl: Introduce config keys. Config keys are almost config attributes. A valid config attribute is a valid config key, but a valid config key may not be a valid config attribute. This commit does not distinguish the differences. Signed-off-by: Chia-I Wu --- src/egl/drivers/demo/demo.c | 2 +- src/egl/main/eglconfig.c | 26 ++++---------- src/egl/main/eglconfig.h | 86 +++++++++++++++++++++++++++++++++++++------- src/egl/main/eglconfigutil.h | 8 ++--- 4 files changed, 84 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/egl/drivers/demo/demo.c b/src/egl/drivers/demo/demo.c index aea4894448..0933c0bdaa 100644 --- a/src/egl/drivers/demo/demo.c +++ b/src/egl/drivers/demo/demo.c @@ -177,7 +177,7 @@ demoCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, Nat } } - if (conf->Attrib[EGL_SURFACE_TYPE - FIRST_ATTRIB] == 0) { + if (GET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE) == 0) { _eglError(EGL_BAD_MATCH, "eglCreatePixmapSurface"); return NULL; } diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c index d47b99eed4..5f57c9dacd 100644 --- a/src/egl/main/eglconfig.c +++ b/src/egl/main/eglconfig.c @@ -17,15 +17,6 @@ #define MIN2(A, B) (((A) < (B)) ? (A) : (B)) -void -_eglSetConfigAttrib(_EGLConfig *config, EGLint attr, EGLint val) -{ - assert(attr >= FIRST_ATTRIB); - assert(attr < FIRST_ATTRIB + MAX_ATTRIBS); - config->Attrib[attr - FIRST_ATTRIB] = val; -} - - /** * Init the given _EGLconfig to default values. * \param id the configuration's ID. @@ -128,21 +119,16 @@ _eglParseConfigAttribs(_EGLConfig *config, const EGLint *attrib_list) EGLint i; /* set all config attribs to EGL_DONT_CARE */ - for (i = 0; i < MAX_ATTRIBS; i++) { - config->Attrib[i] = EGL_DONT_CARE; - } + _eglResetConfigKeys(config, EGL_DONT_CARE); /* by default choose windows unless otherwise specified */ - config->Attrib[EGL_SURFACE_TYPE - FIRST_ATTRIB] = EGL_WINDOW_BIT; + SET_CONFIG_ATTRIB(config, EGL_SURFACE_TYPE, EGL_WINDOW_BIT); for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) { const EGLint attr = attrib_list[i]; if (attr >= EGL_BUFFER_SIZE && attr <= EGL_MAX_SWAP_INTERVAL) { - EGLint k = attr - FIRST_ATTRIB; - assert(k >= 0); - assert(k < MAX_ATTRIBS); - config->Attrib[k] = attrib_list[++i]; + SET_CONFIG_ATTRIB(config, attr, attrib_list[++i]); } #ifdef EGL_VERSION_1_2 else if (attr == EGL_COLOR_BUFFER_TYPE) { @@ -368,9 +354,9 @@ EGLBoolean _eglGetConfigAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, EGLint attribute, EGLint *value) { - const EGLint k = attribute - FIRST_ATTRIB; - if (k >= 0 && k < MAX_ATTRIBS) { - *value = conf->Attrib[k]; + const EGLint k = attribute - _EGL_CONFIG_FIRST_ATTRIB; + if (k >= 0 && k < _EGL_CONFIG_NUM_ATTRIBS) { + *value = GET_CONFIG_ATTRIB(conf, k); return EGL_TRUE; } else { diff --git a/src/egl/main/eglconfig.h b/src/egl/main/eglconfig.h index 36ed96ae95..b07632a92e 100644 --- a/src/egl/main/eglconfig.h +++ b/src/egl/main/eglconfig.h @@ -2,27 +2,93 @@ #define EGLCONFIG_INCLUDED +#include #include "egltypedefs.h" -#include -#define MAX_ATTRIBS 128 -#define FIRST_ATTRIB EGL_BUFFER_SIZE +#define _EGL_CONFIG_FIRST_ATTRIB EGL_BUFFER_SIZE +#define _EGL_CONFIG_LAST_ATTRIB EGL_CONFORMANT +#define _EGL_CONFIG_NUM_ATTRIBS \ + (_EGL_CONFIG_LAST_ATTRIB - _EGL_CONFIG_FIRST_ATTRIB + 1) + +#define _EGL_CONFIG_STORAGE_SIZE _EGL_CONFIG_NUM_ATTRIBS struct _egl_config { EGLConfig Handle; /* the public/opaque handle which names this config */ - EGLint Attrib[MAX_ATTRIBS]; + EGLint Storage[_EGL_CONFIG_STORAGE_SIZE]; }; -#define SET_CONFIG_ATTRIB(CONF, ATTR, VAL) \ - assert((ATTR) - FIRST_ATTRIB < MAX_ATTRIBS); \ - ((CONF)->Attrib[(ATTR) - FIRST_ATTRIB] = VAL) +#define SET_CONFIG_ATTRIB(CONF, ATTR, VAL) _eglSetConfigKey(CONF, ATTR, VAL) +#define GET_CONFIG_ATTRIB(CONF, ATTR) _eglGetConfigKey(CONF, ATTR) -#define GET_CONFIG_ATTRIB(CONF, ATTR) ((CONF)->Attrib[(ATTR) - FIRST_ATTRIB]) +/** + * Given a key, return an index into the storage of the config. + * Return -1 if the key is invalid. + */ +static INLINE EGLint +_eglIndexConfig(const _EGLConfig *conf, EGLint key) +{ + (void) conf; + if (key >= _EGL_CONFIG_FIRST_ATTRIB && + key < _EGL_CONFIG_FIRST_ATTRIB + _EGL_CONFIG_NUM_ATTRIBS) + return key - _EGL_CONFIG_FIRST_ATTRIB; + else + return -1; +} + + +/** + * Reset all keys in the config to a given value. + */ +static INLINE void +_eglResetConfigKeys(_EGLConfig *conf, EGLint val) +{ + EGLint i; + for (i = 0; i < _EGL_CONFIG_NUM_ATTRIBS; i++) + conf->Storage[i] = val; +} + + +/** + * Update a config for a given key. + */ +static INLINE void +_eglSetConfigKey(_EGLConfig *conf, EGLint key, EGLint val) +{ + EGLint idx = _eglIndexConfig(conf, key); + assert(idx >= 0); + conf->Storage[idx] = val; +} + + +/** + * Return the value for a given key. + */ +static INLINE EGLint +_eglGetConfigKey(const _EGLConfig *conf, EGLint key) +{ + EGLint idx = _eglIndexConfig(conf, key); + assert(idx >= 0); + return conf->Storage[idx]; +} + + +/** + * Set a given attribute. + * + * Because _eglGetConfigAttrib is already used as a fallback driver + * function, this function is not considered to have a good name. + * SET_CONFIG_ATTRIB is preferred over this function. + */ +static INLINE void +_eglSetConfigAttrib(_EGLConfig *conf, EGLint attr, EGLint val) +{ + SET_CONFIG_ATTRIB(conf, attr, val); +} extern void @@ -57,8 +123,4 @@ extern EGLBoolean _eglGetConfigs(_EGLDriver *drv, _EGLDisplay *dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); -extern void -_eglSetConfigAttrib(_EGLConfig *config, EGLint attr, EGLint val); - - #endif /* EGLCONFIG_INCLUDED */ diff --git a/src/egl/main/eglconfigutil.h b/src/egl/main/eglconfigutil.h index c477b94737..820244611c 100644 --- a/src/egl/main/eglconfigutil.h +++ b/src/egl/main/eglconfigutil.h @@ -1,12 +1,10 @@ - #ifndef EGLCONFIGUTIL_INCLUDED #define EGLCONFIGUTIL_INCLUDED -#include "eglconfig.h" + +#include "GLES/gl.h" #include "GL/internal/glcore.h" -#if (!defined(WIN32) && !defined(_WIN32_WCE)) -#include "stdint.h" -#endif +#include "eglconfig.h" extern void -- cgit v1.2.3 From 95cdd697e7e72cec1d0fe79c59a8ba7b8cef8571 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 25 Sep 2009 23:24:03 +0800 Subject: egl: Rework configuration management. This mainly implements the algorithms for configuration selection and sorting, described in the spec. User errors should also be correctly detected and reported. Signed-off-by: Chia-I Wu --- src/egl/main/eglconfig.c | 838 ++++++++++++++++++++++++++++++++++++----------- src/egl/main/eglconfig.h | 22 +- 2 files changed, 661 insertions(+), 199 deletions(-) (limited to 'src') diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c index 5f57c9dacd..b342aae33e 100644 --- a/src/egl/main/eglconfig.c +++ b/src/egl/main/eglconfig.c @@ -15,33 +15,30 @@ #define MIN2(A, B) (((A) < (B)) ? (A) : (B)) +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) /** * Init the given _EGLconfig to default values. * \param id the configuration's ID. + * + * Note that id must be positive for the config to be valid. + * It is also recommended that when there are N configs, their + * IDs are from 1 to N respectively. */ void _eglInitConfig(_EGLConfig *config, EGLint id) { memset(config, 0, sizeof(*config)); config->Handle = (EGLConfig) _eglUIntToPointer((unsigned int) id); - _eglSetConfigAttrib(config, EGL_CONFIG_ID, id); - _eglSetConfigAttrib(config, EGL_BIND_TO_TEXTURE_RGB, EGL_DONT_CARE); - _eglSetConfigAttrib(config, EGL_BIND_TO_TEXTURE_RGBA, EGL_DONT_CARE); - _eglSetConfigAttrib(config, EGL_CONFIG_CAVEAT, EGL_DONT_CARE); - _eglSetConfigAttrib(config, EGL_NATIVE_RENDERABLE, EGL_DONT_CARE); - _eglSetConfigAttrib(config, EGL_NATIVE_VISUAL_TYPE, EGL_DONT_CARE); - _eglSetConfigAttrib(config, EGL_MIN_SWAP_INTERVAL, EGL_DONT_CARE); - _eglSetConfigAttrib(config, EGL_MAX_SWAP_INTERVAL, EGL_DONT_CARE); - _eglSetConfigAttrib(config, EGL_SURFACE_TYPE, EGL_WINDOW_BIT); - _eglSetConfigAttrib(config, EGL_TRANSPARENT_TYPE, EGL_NONE); - _eglSetConfigAttrib(config, EGL_TRANSPARENT_RED_VALUE, EGL_DONT_CARE); - _eglSetConfigAttrib(config, EGL_TRANSPARENT_GREEN_VALUE, EGL_DONT_CARE); - _eglSetConfigAttrib(config, EGL_TRANSPARENT_BLUE_VALUE, EGL_DONT_CARE); + + /* some attributes take non-zero default values */ + SET_CONFIG_ATTRIB(config, EGL_CONFIG_ID, id); + SET_CONFIG_ATTRIB(config, EGL_CONFIG_CAVEAT, EGL_NONE); + SET_CONFIG_ATTRIB(config, EGL_TRANSPARENT_TYPE, EGL_NONE); + SET_CONFIG_ATTRIB(config, EGL_NATIVE_VISUAL_TYPE, EGL_NONE); #ifdef EGL_VERSION_1_2 - _eglSetConfigAttrib(config, EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER); - _eglSetConfigAttrib(config, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT); + SET_CONFIG_ATTRIB(config, EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER); #endif /* EGL_VERSION_1_2 */ } @@ -84,13 +81,8 @@ _eglAddConfig(_EGLDisplay *display, _EGLConfig *config) _EGLConfig **newConfigs; EGLint n; - /* do some sanity checks on the config's attribs */ + /* sanity check */ assert(GET_CONFIG_ATTRIB(config, EGL_CONFIG_ID) > 0); - assert(GET_CONFIG_ATTRIB(config, EGL_RENDERABLE_TYPE) != 0x0); - assert(GET_CONFIG_ATTRIB(config, EGL_SURFACE_TYPE) != 0x0); - assert(GET_CONFIG_ATTRIB(config, EGL_RED_SIZE) > 0); - assert(GET_CONFIG_ATTRIB(config, EGL_GREEN_SIZE) > 0); - assert(GET_CONFIG_ATTRIB(config, EGL_BLUE_SIZE) > 0); n = display->NumConfigs; @@ -109,194 +101,621 @@ _eglAddConfig(_EGLDisplay *display, _EGLConfig *config) } +enum { + /* types */ + ATTRIB_TYPE_INTEGER, + ATTRIB_TYPE_BOOLEAN, + ATTRIB_TYPE_BITMASK, + ATTRIB_TYPE_ENUM, + ATTRIB_TYPE_PSEUDO, /* non-queryable */ + ATTRIB_TYPE_PLATFORM, /* platform-dependent */ + /* criteria */ + ATTRIB_CRITERION_EXACT, + ATTRIB_CRITERION_ATLEAST, + ATTRIB_CRITERION_MASK, + ATTRIB_CRITERION_SPECIAL, + ATTRIB_CRITERION_IGNORE, +}; + + +/* EGL spec Table 3.1 and 3.4 */ +static const struct { + EGLint attr; + EGLint type; + EGLint criterion; + EGLint default_value; +} _eglValidationTable[] = +{ + { EGL_BUFFER_SIZE, ATTRIB_TYPE_INTEGER, + ATTRIB_CRITERION_ATLEAST, + 0 }, + { EGL_RED_SIZE, ATTRIB_TYPE_INTEGER, + ATTRIB_CRITERION_ATLEAST, + 0 }, + { EGL_GREEN_SIZE, ATTRIB_TYPE_INTEGER, + ATTRIB_CRITERION_ATLEAST, + 0 }, + { EGL_BLUE_SIZE, ATTRIB_TYPE_INTEGER, + ATTRIB_CRITERION_ATLEAST, + 0 }, + { EGL_LUMINANCE_SIZE, ATTRIB_TYPE_INTEGER, + ATTRIB_CRITERION_ATLEAST, + 0 }, + { EGL_ALPHA_SIZE, ATTRIB_TYPE_INTEGER, + ATTRIB_CRITERION_ATLEAST, + 0 }, + { EGL_ALPHA_MASK_SIZE, ATTRIB_TYPE_INTEGER, + ATTRIB_CRITERION_ATLEAST, + 0 }, + { EGL_BIND_TO_TEXTURE_RGB, ATTRIB_TYPE_BOOLEAN, + ATTRIB_CRITERION_EXACT, + EGL_DONT_CARE }, + { EGL_BIND_TO_TEXTURE_RGBA, ATTRIB_TYPE_BOOLEAN, + ATTRIB_CRITERION_EXACT, + EGL_DONT_CARE }, + { EGL_COLOR_BUFFER_TYPE, ATTRIB_TYPE_ENUM, + ATTRIB_CRITERION_EXACT, + EGL_RGB_BUFFER }, + { EGL_CONFIG_CAVEAT, ATTRIB_TYPE_ENUM, + ATTRIB_CRITERION_EXACT, + EGL_DONT_CARE }, + { EGL_CONFIG_ID, ATTRIB_TYPE_INTEGER, + ATTRIB_CRITERION_EXACT, + EGL_DONT_CARE }, + { EGL_CONFORMANT, ATTRIB_TYPE_BITMASK, + ATTRIB_CRITERION_MASK, + 0 }, + { EGL_DEPTH_SIZE, ATTRIB_TYPE_INTEGER, + ATTRIB_CRITERION_ATLEAST, + 0 }, + { EGL_LEVEL, ATTRIB_TYPE_PLATFORM, + ATTRIB_CRITERION_EXACT, + 0 }, + { EGL_MAX_PBUFFER_WIDTH, ATTRIB_TYPE_INTEGER, + ATTRIB_CRITERION_IGNORE, + 0 }, + { EGL_MAX_PBUFFER_HEIGHT, ATTRIB_TYPE_INTEGER, + ATTRIB_CRITERION_IGNORE, + 0 }, + { EGL_MAX_PBUFFER_PIXELS, ATTRIB_TYPE_INTEGER, + ATTRIB_CRITERION_IGNORE, + 0 }, + { EGL_MAX_SWAP_INTERVAL, ATTRIB_TYPE_INTEGER, + ATTRIB_CRITERION_EXACT, + EGL_DONT_CARE }, + { EGL_MIN_SWAP_INTERVAL, ATTRIB_TYPE_INTEGER, + ATTRIB_CRITERION_EXACT, + EGL_DONT_CARE }, + { EGL_NATIVE_RENDERABLE, ATTRIB_TYPE_BOOLEAN, + ATTRIB_CRITERION_EXACT, + EGL_DONT_CARE }, + { EGL_NATIVE_VISUAL_ID, ATTRIB_TYPE_PLATFORM, + ATTRIB_CRITERION_IGNORE, + 0 }, + { EGL_NATIVE_VISUAL_TYPE, ATTRIB_TYPE_PLATFORM, + ATTRIB_CRITERION_EXACT, + EGL_DONT_CARE }, + { EGL_RENDERABLE_TYPE, ATTRIB_TYPE_BITMASK, + ATTRIB_CRITERION_MASK, + EGL_OPENGL_ES_BIT }, + { EGL_SAMPLE_BUFFERS, ATTRIB_TYPE_INTEGER, + ATTRIB_CRITERION_ATLEAST, + 0 }, + { EGL_SAMPLES, ATTRIB_TYPE_INTEGER, + ATTRIB_CRITERION_ATLEAST, + 0 }, + { EGL_STENCIL_SIZE, ATTRIB_TYPE_INTEGER, + ATTRIB_CRITERION_ATLEAST, + 0 }, + { EGL_SURFACE_TYPE, ATTRIB_TYPE_BITMASK, + ATTRIB_CRITERION_MASK, + EGL_WINDOW_BIT }, + { EGL_TRANSPARENT_TYPE, ATTRIB_TYPE_ENUM, + ATTRIB_CRITERION_EXACT, + EGL_NONE }, + { EGL_TRANSPARENT_RED_VALUE, ATTRIB_TYPE_INTEGER, + ATTRIB_CRITERION_EXACT, + EGL_DONT_CARE }, + { EGL_TRANSPARENT_GREEN_VALUE, ATTRIB_TYPE_INTEGER, + ATTRIB_CRITERION_EXACT, + EGL_DONT_CARE }, + { EGL_TRANSPARENT_BLUE_VALUE, ATTRIB_TYPE_INTEGER, + ATTRIB_CRITERION_EXACT, + EGL_DONT_CARE }, + /* these are not real attributes */ + { EGL_MATCH_NATIVE_PIXMAP, ATTRIB_TYPE_PSEUDO, + ATTRIB_CRITERION_SPECIAL, + EGL_NONE }, + { EGL_PRESERVED_RESOURCES, ATTRIB_TYPE_PSEUDO, + ATTRIB_CRITERION_IGNORE, + 0 }, + { EGL_NONE, ATTRIB_TYPE_PSEUDO, + ATTRIB_CRITERION_IGNORE, + 0 } +}; + + /** - * Parse the attrib_list to fill in the fields of the given _eglConfig - * Return EGL_FALSE if any errors, EGL_TRUE otherwise. + * Return true if a config is valid. When for_matching is true, + * EGL_DONT_CARE is accepted as a valid attribute value, and checks + * for conflicting attribute values are skipped. + * + * Note that some attributes are platform-dependent and are not + * checked. */ EGLBoolean -_eglParseConfigAttribs(_EGLConfig *config, const EGLint *attrib_list) +_eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching) { - EGLint i; - - /* set all config attribs to EGL_DONT_CARE */ - _eglResetConfigKeys(config, EGL_DONT_CARE); - - /* by default choose windows unless otherwise specified */ - SET_CONFIG_ATTRIB(config, EGL_SURFACE_TYPE, EGL_WINDOW_BIT); - - for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) { - const EGLint attr = attrib_list[i]; - if (attr >= EGL_BUFFER_SIZE && - attr <= EGL_MAX_SWAP_INTERVAL) { - SET_CONFIG_ATTRIB(config, attr, attrib_list[++i]); - } -#ifdef EGL_VERSION_1_2 - else if (attr == EGL_COLOR_BUFFER_TYPE) { - EGLint bufType = attrib_list[++i]; - if (bufType != EGL_RGB_BUFFER && bufType != EGL_LUMINANCE_BUFFER) { - _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig"); - return EGL_FALSE; + EGLint i, attr, val; + EGLBoolean valid = EGL_TRUE; + EGLint red_size = 0, green_size = 0, blue_size = 0, luminance_size = 0; + EGLint alpha_size = 0, buffer_size = 0; + + /* all attributes should have been listed */ + assert(ARRAY_SIZE(_eglValidationTable) == _EGL_CONFIG_NUM_ATTRIBS); + + /* check attributes by their types */ + for (i = 0; i < ARRAY_SIZE(_eglValidationTable); i++) { + EGLint mask; + + attr = _eglValidationTable[i].attr; + val = GET_CONFIG_ATTRIB(conf, attr); + + switch (_eglValidationTable[i].type) { + case ATTRIB_TYPE_INTEGER: + switch (attr) { + case EGL_CONFIG_ID: + /* config id must be positive */ + if (val <= 0) + valid = EGL_FALSE; + break; + case EGL_SAMPLE_BUFFERS: + /* there can be at most 1 sample buffer */ + if (val > 1) + valid = EGL_FALSE; + break; + case EGL_RED_SIZE: + red_size = val; + break; + case EGL_GREEN_SIZE: + green_size = val; + break; + case EGL_BLUE_SIZE: + blue_size = val; + break; + case EGL_LUMINANCE_SIZE: + luminance_size = val; + break; + case EGL_ALPHA_SIZE: + alpha_size = val; + break; + case EGL_BUFFER_SIZE: + buffer_size = val; + break; } - _eglSetConfigAttrib(config, EGL_COLOR_BUFFER_TYPE, bufType); - } - else if (attr == EGL_RENDERABLE_TYPE) { - EGLint renType = attrib_list[++i]; - if (renType & ~(EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT | EGL_OPENVG_BIT)) { - _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig"); - return EGL_FALSE; + if (val < 0) + valid = EGL_FALSE; + break; + case ATTRIB_TYPE_BOOLEAN: + if (val != EGL_TRUE && val != EGL_FALSE) + valid = EGL_FALSE; + break; + case ATTRIB_TYPE_ENUM: + switch (attr) { + case EGL_CONFIG_CAVEAT: + if (val != EGL_NONE && val != EGL_SLOW_CONFIG && + val != EGL_NON_CONFORMANT_CONFIG) + valid = EGL_FALSE; + break; + case EGL_TRANSPARENT_TYPE: + if (val != EGL_NONE && val != EGL_TRANSPARENT_RGB) + valid = EGL_FALSE; + break; + case EGL_COLOR_BUFFER_TYPE: + if (val != EGL_RGB_BUFFER && val != EGL_LUMINANCE_BUFFER) + valid = EGL_FALSE; + break; + default: + assert(0); + break; } - _eglSetConfigAttrib(config, EGL_RENDERABLE_TYPE, renType); - } - else if (attr == EGL_ALPHA_MASK_SIZE || - attr == EGL_LUMINANCE_SIZE) { - EGLint value = attrib_list[++i]; - _eglSetConfigAttrib(config, attr, value); + break; + case ATTRIB_TYPE_BITMASK: + switch (attr) { + case EGL_SURFACE_TYPE: + mask = EGL_PBUFFER_BIT | + EGL_PIXMAP_BIT | + EGL_WINDOW_BIT | + EGL_VG_COLORSPACE_LINEAR_BIT | + EGL_VG_ALPHA_FORMAT_PRE_BIT | + EGL_MULTISAMPLE_RESOLVE_BOX_BIT | + EGL_SWAP_BEHAVIOR_PRESERVED_BIT; + break; + case EGL_RENDERABLE_TYPE: + case EGL_CONFORMANT: + mask = EGL_OPENGL_ES_BIT | + EGL_OPENVG_BIT | + EGL_OPENGL_ES2_BIT | + EGL_OPENGL_BIT; + break; + default: + assert(0); + break; + } + if (val & ~mask) + valid = EGL_FALSE; + break; + case ATTRIB_TYPE_PLATFORM: + /* unable to check platform-dependent attributes here */ + break; + case ATTRIB_TYPE_PSEUDO: + /* pseudo attributes should not be set */ + if (val != 0) + valid = EGL_FALSE; + break; + default: + assert(0); + break; } -#endif /* EGL_VERSION_1_2 */ - else { - _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig"); - return EGL_FALSE; + + if (!valid && for_matching) { + /* accept EGL_DONT_CARE as a valid value */ + if (val == EGL_DONT_CARE) + valid = EGL_TRUE; + if (_eglValidationTable[i].criterion == ATTRIB_CRITERION_SPECIAL) + valid = EGL_TRUE; } + if (!valid) + break; } - return EGL_TRUE; -} + /* any invalid attribute value should have been catched */ + if (!valid || for_matching) + return valid; + + /* now check for conflicting attribute values */ + + switch (GET_CONFIG_ATTRIB(conf, EGL_COLOR_BUFFER_TYPE)) { + case EGL_RGB_BUFFER: + if (luminance_size) + valid = EGL_FALSE; + if (red_size + green_size + blue_size + alpha_size != buffer_size) + valid = EGL_FALSE; + break; + case EGL_LUMINANCE_BUFFER: + if (red_size || green_size || blue_size) + valid = EGL_FALSE; + if (luminance_size + alpha_size != buffer_size) + valid = EGL_FALSE; + break; + } -#define EXACT 1 -#define ATLEAST 2 -#define MASK 3 -#define SMALLER 4 -#define SPECIAL 5 -#define NONE 6 + val = GET_CONFIG_ATTRIB(conf, EGL_SAMPLE_BUFFERS); + if (!val && GET_CONFIG_ATTRIB(conf, EGL_SAMPLES)) + valid = EGL_FALSE; -struct sort_info { - EGLint Attribute; - EGLint MatchCriteria; - EGLint SortOrder; -}; + val = GET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE); + if (!(val & EGL_WINDOW_BIT)) { + if (GET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_ID) != 0 || + GET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE) != EGL_NONE) + valid = EGL_FALSE; + } + if (!(val & EGL_PBUFFER_BIT)) { + if (GET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGB) || + GET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGBA)) + valid = EGL_FALSE; + } + + return valid; +} -/* This encodes the info from Table 3.5 of the EGL spec, ordered by - * Sort Priority. + +/** + * Return true if a config matches the criteria. This and + * _eglParseConfigAttribList together implement the algorithm + * described in "Selection of EGLConfigs". * - * XXX To do: EGL 1.2 attribs + * Note that attributes that are special (currently, only + * EGL_MATCH_NATIVE_PIXMAP) are ignored. */ -static struct sort_info SortInfo[] = { - { EGL_CONFIG_CAVEAT, EXACT, SPECIAL }, - { EGL_RED_SIZE, ATLEAST, SPECIAL }, - { EGL_GREEN_SIZE, ATLEAST, SPECIAL }, - { EGL_BLUE_SIZE, ATLEAST, SPECIAL }, - { EGL_ALPHA_SIZE, ATLEAST, SPECIAL }, - { EGL_BUFFER_SIZE, ATLEAST, SMALLER }, - { EGL_SAMPLE_BUFFERS, ATLEAST, SMALLER }, - { EGL_SAMPLES, ATLEAST, SMALLER }, - { EGL_DEPTH_SIZE, ATLEAST, SMALLER }, - { EGL_STENCIL_SIZE, ATLEAST, SMALLER }, - { EGL_NATIVE_VISUAL_TYPE, EXACT, SPECIAL }, - { EGL_CONFIG_ID, EXACT, SMALLER }, - { EGL_BIND_TO_TEXTURE_RGB, EXACT, NONE }, - { EGL_BIND_TO_TEXTURE_RGBA, EXACT, NONE }, - { EGL_LEVEL, EXACT, NONE }, - { EGL_NATIVE_RENDERABLE, EXACT, NONE }, - { EGL_MAX_SWAP_INTERVAL, EXACT, NONE }, - { EGL_MIN_SWAP_INTERVAL, EXACT, NONE }, - { EGL_SURFACE_TYPE, MASK, NONE }, - { EGL_TRANSPARENT_TYPE, EXACT, NONE }, - { EGL_TRANSPARENT_RED_VALUE, EXACT, NONE }, - { EGL_TRANSPARENT_GREEN_VALUE, EXACT, NONE }, - { EGL_TRANSPARENT_BLUE_VALUE, EXACT, NONE }, - { 0, 0, 0 } -}; +EGLBoolean +_eglMatchConfig(const _EGLConfig *conf, const _EGLConfig *criteria) +{ + EGLint attr, val, i; + EGLBoolean matched = EGL_TRUE; + + for (i = 0; i < ARRAY_SIZE(_eglValidationTable); i++) { + EGLint cmp; + if (_eglValidationTable[i].criterion == ATTRIB_CRITERION_IGNORE) + continue; + + attr = _eglValidationTable[i].attr; + cmp = GET_CONFIG_ATTRIB(criteria, attr); + if (cmp == EGL_DONT_CARE) + continue; + + val = GET_CONFIG_ATTRIB(conf, attr); + switch (_eglValidationTable[i].criterion) { + case ATTRIB_CRITERION_EXACT: + if (val != cmp) + matched = EGL_FALSE; + break; + case ATTRIB_CRITERION_ATLEAST: + if (val < cmp) + matched = EGL_FALSE; + break; + case ATTRIB_CRITERION_MASK: + if ((val & cmp) != cmp) + matched = EGL_FALSE; + break; + case ATTRIB_CRITERION_SPECIAL: + /* ignored here */ + break; + default: + assert(0); + break; + } + + if (!matched) + break; + } + + return matched; +} /** - * Return EGL_TRUE if the attributes of c meet or exceed the minimums - * specified by min. + * Initialize a criteria config from the given attribute list. + * Return EGL_FALSE if any of the attribute is invalid. */ -static EGLBoolean -_eglConfigQualifies(const _EGLConfig *c, const _EGLConfig *min) +EGLBoolean +_eglParseConfigAttribList(_EGLConfig *conf, const EGLint *attrib_list) { - EGLint i; - for (i = 0; SortInfo[i].Attribute != 0; i++) { - const EGLint mv = GET_CONFIG_ATTRIB(min, SortInfo[i].Attribute); - if (mv != EGL_DONT_CARE) { - const EGLint cv = GET_CONFIG_ATTRIB(c, SortInfo[i].Attribute); - if (SortInfo[i].MatchCriteria == EXACT) { - if (cv != mv) { - return EGL_FALSE; - } - } - else if (SortInfo[i].MatchCriteria == ATLEAST) { - if (cv < mv) { - return EGL_FALSE; - } - } - else { - assert(SortInfo[i].MatchCriteria == MASK); - if ((mv & cv) != mv) { - return EGL_FALSE; - } + EGLint attr, val, i; + EGLint config_id = 0, level = 0; + EGLBoolean has_native_visual_type = EGL_FALSE; + EGLBoolean has_transparent_color = EGL_FALSE; + + /* reset to default values */ + for (i = 0; i < ARRAY_SIZE(_eglValidationTable); i++) { + attr = _eglValidationTable[i].attr; + val = _eglValidationTable[i].default_value; + SET_CONFIG_ATTRIB(conf, attr, val); + } + + /* parse the list */ + for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i += 2) { + EGLint idx; + + attr = attrib_list[i]; + val = attrib_list[i + 1]; + + idx = _eglIndexConfig(conf, attr); + if (idx < 0) + return EGL_FALSE; + conf->Storage[idx] = val; + + /* rememeber some attributes for post-processing */ + switch (attr) { + case EGL_CONFIG_ID: + config_id = val; + break; + case EGL_LEVEL: + level = val; + break; + case EGL_NATIVE_VISUAL_TYPE: + has_native_visual_type = EGL_TRUE; + break; + case EGL_TRANSPARENT_RED_VALUE: + case EGL_TRANSPARENT_GREEN_VALUE: + case EGL_TRANSPARENT_BLUE_VALUE: + has_transparent_color = EGL_TRUE; + break; + default: + break; + } + } + + if (!_eglValidateConfig(conf, EGL_TRUE)) + return EGL_FALSE; + + /* the spec says that EGL_LEVEL cannot be EGL_DONT_CARE */ + if (level == EGL_DONT_CARE) + return EGL_FALSE; + + /* ignore other attributes when EGL_CONFIG_ID is given */ + if (config_id > 0) { + _eglResetConfigKeys(conf, EGL_DONT_CARE); + SET_CONFIG_ATTRIB(conf, EGL_CONFIG_ID, config_id); + } + else { + if (has_native_visual_type) { + val = GET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE); + if (!(val & EGL_WINDOW_BIT)) + SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE, EGL_DONT_CARE); + } + + if (has_transparent_color) { + val = GET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_TYPE); + if (val == EGL_NONE) { + SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_RED_VALUE, + EGL_DONT_CARE); + SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_GREEN_VALUE, + EGL_DONT_CARE); + SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_BLUE_VALUE, + EGL_DONT_CARE); } } } + return EGL_TRUE; } /** - * Compare configs 'a' and 'b' and return -1 if a belongs before b, - * 1 if a belongs after b, or 0 if they're equal. - * Used by qsort(). + * Decide the ordering of conf1 and conf2, under the given criteria. + * When compare_id is true, this implements the algorithm described + * in "Sorting of EGLConfigs". When compare_id is false, + * EGL_CONFIG_ID is not compared. + * + * It returns a negative integer if conf1 is considered to come + * before conf2; a positive integer if conf2 is considered to come + * before conf1; zero if the ordering cannot be decided. + * + * Note that EGL_NATIVE_VISUAL_TYPE is platform-dependent and is + * ignored here. */ -static int -_eglCompareConfigs(const void *a, const void *b) +EGLint +_eglCompareConfigs(const _EGLConfig *conf1, const _EGLConfig *conf2, + const _EGLConfig *criteria, EGLBoolean compare_id) { - const _EGLConfig *aConfig = (const _EGLConfig *) a; - const _EGLConfig *bConfig = (const _EGLConfig *) b; + const EGLint compare_attribs[] = { + EGL_BUFFER_SIZE, + EGL_SAMPLE_BUFFERS, + EGL_SAMPLES, + EGL_DEPTH_SIZE, + EGL_STENCIL_SIZE, + EGL_ALPHA_MASK_SIZE, + }; + EGLint val1, val2; + EGLBoolean rgb_buffer; EGLint i; - for (i = 0; SortInfo[i].Attribute != 0; i++) { - const EGLint aVal = GET_CONFIG_ATTRIB(aConfig, SortInfo[i].Attribute); - const EGLint bVal = GET_CONFIG_ATTRIB(bConfig, SortInfo[i].Attribute); - if (SortInfo[i].SortOrder == SMALLER) { - if (aVal < bVal) - return -1; - else if (aVal > bVal) - return 1; - /* else, continue examining attribute values */ - } - else if (SortInfo[i].SortOrder == SPECIAL) { - if (SortInfo[i].Attribute == EGL_CONFIG_CAVEAT) { - /* values are EGL_NONE, SLOW_CONFIG, or NON_CONFORMANT_CONFIG */ - if (aVal < bVal) - return -1; - else if (aVal > bVal) - return 1; + if (conf1 == conf2) + return 0; + + /* the enum values have the desired ordering */ + assert(EGL_NONE < EGL_SLOW_CONFIG); + assert(EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG); + val1 = GET_CONFIG_ATTRIB(conf1, EGL_CONFIG_CAVEAT); + val2 = GET_CONFIG_ATTRIB(conf2, EGL_CONFIG_CAVEAT); + if (val1 != val2) + return (val1 - val2); + + /* the enum values have the desired ordering */ + assert(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER); + val1 = GET_CONFIG_ATTRIB(conf1, EGL_COLOR_BUFFER_TYPE); + val2 = GET_CONFIG_ATTRIB(conf2, EGL_COLOR_BUFFER_TYPE); + if (val1 != val2) + return (val1 - val2); + rgb_buffer = (val1 == EGL_RGB_BUFFER); + + if (criteria) { + val1 = val2 = 0; + if (rgb_buffer) { + if (GET_CONFIG_ATTRIB(criteria, EGL_RED_SIZE) > 0) { + val1 += GET_CONFIG_ATTRIB(conf1, EGL_RED_SIZE); + val2 += GET_CONFIG_ATTRIB(conf2, EGL_RED_SIZE); } - else if (SortInfo[i].Attribute == EGL_RED_SIZE || - SortInfo[i].Attribute == EGL_GREEN_SIZE || - SortInfo[i].Attribute == EGL_BLUE_SIZE || - SortInfo[i].Attribute == EGL_ALPHA_SIZE) { - if (aVal > bVal) - return -1; - else if (aVal < bVal) - return 1; + if (GET_CONFIG_ATTRIB(criteria, EGL_GREEN_SIZE) > 0) { + val1 += GET_CONFIG_ATTRIB(conf1, EGL_GREEN_SIZE); + val2 += GET_CONFIG_ATTRIB(conf2, EGL_GREEN_SIZE); } - else { - assert(SortInfo[i].Attribute == EGL_NATIVE_VISUAL_TYPE); - if (aVal < bVal) - return -1; - else if (aVal > bVal) - return 1; + if (GET_CONFIG_ATTRIB(criteria, EGL_BLUE_SIZE) > 0) { + val1 += GET_CONFIG_ATTRIB(conf1, EGL_BLUE_SIZE); + val2 += GET_CONFIG_ATTRIB(conf2, EGL_BLUE_SIZE); } } else { - assert(SortInfo[i].SortOrder == NONE); - /* continue examining attribute values */ + if (GET_CONFIG_ATTRIB(criteria, EGL_LUMINANCE_SIZE) > 0) { + val1 += GET_CONFIG_ATTRIB(conf1, EGL_LUMINANCE_SIZE); + val2 += GET_CONFIG_ATTRIB(conf2, EGL_LUMINANCE_SIZE); + } + } + if (GET_CONFIG_ATTRIB(criteria, EGL_ALPHA_SIZE) > 0) { + val1 += GET_CONFIG_ATTRIB(conf1, EGL_ALPHA_SIZE); + val2 += GET_CONFIG_ATTRIB(conf2, EGL_ALPHA_SIZE); } } + else { + /* assume the default criteria, which gives no specific ordering */ + val1 = val2 = 0; + } + + /* for color bits, larger one is preferred */ + if (val1 != val2) + return (val2 - val1); + + for (i = 0; i < ARRAY_SIZE(compare_attribs); i++) { + val1 = GET_CONFIG_ATTRIB(conf1, compare_attribs[i]); + val2 = GET_CONFIG_ATTRIB(conf2, compare_attribs[i]); + if (val1 != val2) + return (val1 - val2); + } + + /* EGL_NATIVE_VISUAL_TYPE cannot be compared here */ + + if (compare_id) { + val1 = GET_CONFIG_ATTRIB(conf1, EGL_CONFIG_ID); + val2 = GET_CONFIG_ATTRIB(conf2, EGL_CONFIG_ID); + assert(val1 != val2); + } + else { + val1 = val2 = 0; + } + + return (val1 - val2); +} + + +static INLINE +void _eglSwapConfigs(const _EGLConfig **conf1, const _EGLConfig **conf2) +{ + const _EGLConfig *tmp = *conf1; + *conf1 = *conf2; + *conf2 = tmp; +} + + +/** + * Quick sort an array of configs. This differs from the standard + * qsort() in that the compare function accepts an additional + * argument. + */ +void +_eglSortConfigs(const _EGLConfig **configs, EGLint count, + EGLint (*compare)(const _EGLConfig *, const _EGLConfig *, + void *), + void *priv_data) +{ + const EGLint pivot = 0; + EGLint i, j; + + if (count <= 1) + return; + + _eglSwapConfigs(&configs[pivot], &configs[count / 2]); + i = 1; + j = count - 1; + do { + while (i < count && compare(configs[i], configs[pivot], priv_data) < 0) + i++; + while (compare(configs[j], configs[pivot], priv_data) > 0) + j--; + if (i < j) { + _eglSwapConfigs(&configs[i], &configs[j]); + i++; + j--; + } + else if (i == j) { + i++; + j--; + break; + } + } while (i <= j); + _eglSwapConfigs(&configs[pivot], &configs[j]); + + _eglSortConfigs(configs, j, compare, priv_data); + _eglSortConfigs(configs + i, count - i, compare, priv_data); +} + - /* all attributes identical */ - return 0; +static int +_eglFallbackCompare(const _EGLConfig *conf1, const _EGLConfig *conf2, + void *priv_data) +{ + const _EGLConfig *criteria = (const _EGLConfig *) priv_data; + return _eglCompareConfigs(conf1, conf2, criteria, EGL_TRUE); } @@ -310,33 +729,33 @@ _eglChooseConfig(_EGLDriver *drv, _EGLDisplay *disp, const EGLint *attrib_list, _EGLConfig **configList, criteria; EGLint i, count; - /* parse the attrib_list to initialize criteria */ - if (!_eglParseConfigAttribs(&criteria, attrib_list)) { - return EGL_FALSE; - } + if (!num_configs) + return _eglError(EGL_BAD_PARAMETER, "eglChooseConfigs"); + + _eglInitConfig(&criteria, 0); + if (!_eglParseConfigAttribList(&criteria, attrib_list)) + return _eglError(EGL_BAD_ATTRIBUTE, "eglChooseConfig"); /* allocate array of config pointers */ - configList = (_EGLConfig **) malloc(config_size * sizeof(_EGLConfig *)); - if (!configList) { - _eglError(EGL_BAD_CONFIG, "eglChooseConfig(out of memory)"); - return EGL_FALSE; - } + configList = (_EGLConfig **) + malloc(disp->NumConfigs * sizeof(_EGLConfig *)); + if (!configList) + return _eglError(EGL_BAD_ALLOC, "eglChooseConfig(out of memory)"); - /* make array of pointers to qualifying configs */ - for (i = count = 0; i < disp->NumConfigs && count < config_size; i++) { - if (_eglConfigQualifies(disp->Configs[i], &criteria)) { + /* perform selection of configs */ + count = 0; + for (i = 0; i < disp->NumConfigs; i++) { + if (_eglMatchConfig(disp->Configs[i], &criteria)) configList[count++] = disp->Configs[i]; - } } - /* sort array of pointers */ - qsort(configList, count, sizeof(_EGLConfig *), _eglCompareConfigs); - - /* copy config handles to output array */ - if (configs) { - for (i = 0; i < count; i++) { + /* perform sorting of configs */ + if (configs && count) { + _eglSortConfigs((const _EGLConfig **) configList, count, + _eglFallbackCompare, (void *) &criteria); + count = MIN2(count, config_size); + for (i = 0; i < count; i++) configs[i] = configList[i]->Handle; - } } free(configList); @@ -347,6 +766,28 @@ _eglChooseConfig(_EGLDriver *drv, _EGLDisplay *disp, const EGLint *attrib_list, } +static INLINE EGLBoolean +_eglIsConfigAttribValid(_EGLConfig *conf, EGLint attr) +{ + if (_eglIndexConfig(conf, attr) < 0) + return EGL_FALSE; + + /* there are some holes in the range */ + switch (attr) { + case EGL_PRESERVED_RESOURCES: + case EGL_NONE: +#ifdef EGL_VERSION_1_4 + case EGL_MATCH_NATIVE_PIXMAP: +#endif + return EGL_FALSE; + default: + break; + } + + return EGL_TRUE; +} + + /** * Fallback for eglGetConfigAttrib. */ @@ -354,15 +795,13 @@ EGLBoolean _eglGetConfigAttrib(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, EGLint attribute, EGLint *value) { - const EGLint k = attribute - _EGL_CONFIG_FIRST_ATTRIB; - if (k >= 0 && k < _EGL_CONFIG_NUM_ATTRIBS) { - *value = GET_CONFIG_ATTRIB(conf, k); - return EGL_TRUE; - } - else { - _eglError(EGL_BAD_ATTRIBUTE, "eglGetConfigAttrib"); - return EGL_FALSE; - } + if (!_eglIsConfigAttribValid(conf, attribute)) + return _eglError(EGL_BAD_ATTRIBUTE, "eglGetConfigAttrib"); + if (!value) + return _eglError(EGL_BAD_PARAMETER, "eglGetConfigAttrib"); + + *value = GET_CONFIG_ATTRIB(conf, attribute); + return EGL_TRUE; } @@ -373,6 +812,9 @@ EGLBoolean _eglGetConfigs(_EGLDriver *drv, _EGLDisplay *disp, EGLConfig *configs, EGLint config_size, EGLint *num_config) { + if (!num_config) + return _eglError(EGL_BAD_PARAMETER, "eglGetConfigs"); + if (configs) { EGLint i; *num_config = MIN2(disp->NumConfigs, config_size); diff --git a/src/egl/main/eglconfig.h b/src/egl/main/eglconfig.h index b07632a92e..e09d58980d 100644 --- a/src/egl/main/eglconfig.h +++ b/src/egl/main/eglconfig.h @@ -108,7 +108,27 @@ _eglAddConfig(_EGLDisplay *display, _EGLConfig *config); extern EGLBoolean -_eglParseConfigAttribs(_EGLConfig *config, const EGLint *attrib_list); +_eglValidateConfig(const _EGLConfig *conf, EGLBoolean for_matching); + + +extern EGLBoolean +_eglMatchConfig(const _EGLConfig *conf, const _EGLConfig *criteria); + + +extern EGLBoolean +_eglParseConfigAttribList(_EGLConfig *conf, const EGLint *attrib_list); + + +extern EGLint +_eglCompareConfigs(const _EGLConfig *conf1, const _EGLConfig *conf2, + const _EGLConfig *criteria, EGLBoolean compare_id); + + +extern void +_eglSortConfigs(const _EGLConfig **configs, EGLint count, + EGLint (*compare)(const _EGLConfig *, const _EGLConfig *, + void *), + void *priv_data); extern EGLBoolean -- cgit v1.2.3 From 56822b0812cd500bd54bb7c4b573c54547efb657 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 25 Sep 2009 23:43:49 +0800 Subject: egl: Rework config lookup. Make it similiar to how contexts and surfaces are looked up. It should be slightly faster, and work better with multiple displays. Signed-off-by: Chia-I Wu --- src/egl/main/eglconfig.c | 92 +++++++++++++++++++++++------------------------ src/egl/main/eglconfig.h | 49 +++++++++++++++++++++---- src/egl/main/egldisplay.h | 1 + 3 files changed, 89 insertions(+), 53 deletions(-) (limited to 'src') diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c index b342aae33e..2c8d1c4055 100644 --- a/src/egl/main/eglconfig.c +++ b/src/egl/main/eglconfig.c @@ -30,7 +30,6 @@ void _eglInitConfig(_EGLConfig *config, EGLint id) { memset(config, 0, sizeof(*config)); - config->Handle = (EGLConfig) _eglUIntToPointer((unsigned int) id); /* some attributes take non-zero default values */ SET_CONFIG_ATTRIB(config, EGL_CONFIG_ID, id); @@ -44,63 +43,63 @@ _eglInitConfig(_EGLConfig *config, EGLint id) /** - * Return the public handle for an internal _EGLConfig. - * This is the inverse of _eglLookupConfig(). + * Link a config to a display and return the handle of the link. + * The handle can be passed to client directly. + * + * Note that we just save the ptr to the config (we don't copy the config). */ EGLConfig -_eglGetConfigHandle(_EGLConfig *config) +_eglAddConfig(_EGLDisplay *dpy, _EGLConfig *conf) { - return config ? config->Handle : 0; -} + _EGLConfig **configs; + /* sanity check */ + assert(GET_CONFIG_ATTRIB(conf, EGL_CONFIG_ID) > 0); -/** - * Given an EGLConfig handle, return the corresponding _EGLConfig object. - * This is the inverse of _eglGetConfigHandle(). - */ -_EGLConfig * -_eglLookupConfig(EGLConfig config, _EGLDisplay *disp) -{ - EGLint i; - for (i = 0; i < disp->NumConfigs; i++) { - if (disp->Configs[i]->Handle == config) { - return disp->Configs[i]; - } + configs = dpy->Configs; + if (dpy->NumConfigs >= dpy->MaxConfigs) { + EGLint new_size = dpy->MaxConfigs + 16; + assert(dpy->NumConfigs < new_size); + + configs = realloc(dpy->Configs, new_size * sizeof(dpy->Configs[0])); + if (!configs) + return (EGLConfig) NULL; + + dpy->Configs = configs; + dpy->MaxConfigs = new_size; } - return NULL; + + conf->Display = dpy; + dpy->Configs[dpy->NumConfigs++] = conf; + + return (EGLConfig) conf; } -/** - * Add the given _EGLConfig to the given display. - * Note that we just save the ptr to the config (we don't copy the config). - */ -_EGLConfig * -_eglAddConfig(_EGLDisplay *display, _EGLConfig *config) +#ifndef _EGL_SKIP_HANDLE_CHECK + + +EGLBoolean +_eglCheckConfigHandle(EGLConfig config, _EGLDisplay *dpy) { - _EGLConfig **newConfigs; - EGLint n; + _EGLConfig *conf = NULL; + EGLint i; - /* sanity check */ - assert(GET_CONFIG_ATTRIB(config, EGL_CONFIG_ID) > 0); - - n = display->NumConfigs; - - /* realloc array of ptrs */ - newConfigs = (_EGLConfig **) realloc(display->Configs, - (n + 1) * sizeof(_EGLConfig *)); - if (newConfigs) { - display->Configs = newConfigs; - display->Configs[n] = config; - display->NumConfigs++; - return config; - } - else { - return NULL; + for (i = 0; dpy && i < dpy->NumConfigs; i++) { + conf = dpy->Configs[i]; + if (conf == (_EGLConfig *) config) { + assert(conf->Display == dpy); + break; + } } + + return (conf != NULL); } +#endif /* _EGL_SKIP_HANDLE_CHECK */ + + enum { /* types */ ATTRIB_TYPE_INTEGER, @@ -755,7 +754,7 @@ _eglChooseConfig(_EGLDriver *drv, _EGLDisplay *disp, const EGLint *attrib_list, _eglFallbackCompare, (void *) &criteria); count = MIN2(count, config_size); for (i = 0; i < count; i++) - configs[i] = configList[i]->Handle; + configs[i] = _eglGetConfigHandle(configList[i]); } free(configList); @@ -818,9 +817,8 @@ _eglGetConfigs(_EGLDriver *drv, _EGLDisplay *disp, EGLConfig *configs, if (configs) { EGLint i; *num_config = MIN2(disp->NumConfigs, config_size); - for (i = 0; i < *num_config; i++) { - configs[i] = disp->Configs[i]->Handle; - } + for (i = 0; i < *num_config; i++) + configs[i] = _eglGetConfigHandle(disp->Configs[i]); } else { /* just return total number of supported configs */ diff --git a/src/egl/main/eglconfig.h b/src/egl/main/eglconfig.h index e09d58980d..6b8a259984 100644 --- a/src/egl/main/eglconfig.h +++ b/src/egl/main/eglconfig.h @@ -16,7 +16,7 @@ struct _egl_config { - EGLConfig Handle; /* the public/opaque handle which names this config */ + _EGLDisplay *Display; EGLint Storage[_EGL_CONFIG_STORAGE_SIZE]; }; @@ -96,15 +96,52 @@ _eglInitConfig(_EGLConfig *config, EGLint id); extern EGLConfig -_eglGetConfigHandle(_EGLConfig *config); +_eglAddConfig(_EGLDisplay *dpy, _EGLConfig *conf); -extern _EGLConfig * -_eglLookupConfig(EGLConfig config, _EGLDisplay *dpy); +#ifndef _EGL_SKIP_HANDLE_CHECK -extern _EGLConfig * -_eglAddConfig(_EGLDisplay *display, _EGLConfig *config); +extern EGLBoolean +_eglCheckConfigHandle(EGLConfig config, _EGLDisplay *dpy); + + +#else + + +static INLINE EGLBoolean +_eglCheckConfigHandle(EGLConfig config, _EGLDisplay *dpy) +{ + _EGLConfig *conf = (_EGLConfig *) config; + return (dpy && conf && conf->Display == dpy); +} + + +#endif /* _EGL_SKIP_HANDLE_CHECK */ + + +/** + * Lookup a handle to find the linked config. + * Return NULL if the handle has no corresponding linked config. + */ +static INLINE _EGLConfig * +_eglLookupConfig(EGLConfig config, _EGLDisplay *dpy) +{ + _EGLConfig *conf = (_EGLConfig *) config; + if (!_eglCheckConfigHandle(config, dpy)) + conf = NULL; + return conf; +} + + +/** + * Return the handle of a linked config, or NULL. + */ +static INLINE EGLConfig +_eglGetConfigHandle(_EGLConfig *conf) +{ + return (EGLConfig) ((conf && conf->Display) ? conf : NULL); +} extern EGLBoolean diff --git a/src/egl/main/egldisplay.h b/src/egl/main/egldisplay.h index 6575fdf198..ea4e35a8b3 100644 --- a/src/egl/main/egldisplay.h +++ b/src/egl/main/egldisplay.h @@ -44,6 +44,7 @@ struct _egl_display EGLint NumScreens; _EGLScreen **Screens; /* array [NumScreens] */ + EGLint MaxConfigs; EGLint NumConfigs; _EGLConfig **Configs; /* array [NumConfigs] of ptr to _EGLConfig */ -- cgit v1.2.3 From 55893b9439754c5213a9c182ee84f6c2554a0281 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 27 Sep 2009 16:14:36 +0800 Subject: egl: Add a function to convert __GLcontextModes to _EGLConfig. _eglConfigFromContextModesRec is used to convert a __GLcontextModes to a _EGLConfig. Note that the config is not validated. An invalid mode is likely to give an invalid config. Signed-off-by: Chia-I Wu --- src/egl/main/eglconfigutil.c | 72 ++++++++++++++++++++++++++++++++++++++++++++ src/egl/main/eglconfigutil.h | 5 +++ 2 files changed, 77 insertions(+) (limited to 'src') diff --git a/src/egl/main/eglconfigutil.c b/src/egl/main/eglconfigutil.c index c9d00e7982..a5fcdcd287 100644 --- a/src/egl/main/eglconfigutil.c +++ b/src/egl/main/eglconfigutil.c @@ -52,6 +52,78 @@ _eglConfigToContextModesRec(const _EGLConfig *config, __GLcontextModes *mode) } +/** + * Convert a __GLcontextModes object to an _EGLConfig. + */ +EGLBoolean +_eglConfigFromContextModesRec(_EGLConfig *conf, const __GLcontextModes *m, + EGLint conformant, EGLint renderable_type) +{ + EGLint config_caveat, surface_type; + + /* must be RGBA */ + if (!m->rgbMode || !(m->renderType & GLX_RGBA_BIT)) + return EGL_FALSE; + + config_caveat = EGL_NONE; + if (m->visualRating == GLX_SLOW_CONFIG) + config_caveat = EGL_SLOW_CONFIG; + + if (m->visualRating == GLX_NON_CONFORMANT_CONFIG) + conformant &= ~EGL_OPENGL_BIT; + if (!(conformant & EGL_OPENGL_ES_BIT)) + config_caveat = EGL_NON_CONFORMANT_CONFIG; + + surface_type = 0; + if (m->drawableType & GLX_WINDOW_BIT) + surface_type |= EGL_WINDOW_BIT; + if (m->drawableType & GLX_PIXMAP_BIT) + surface_type |= EGL_PIXMAP_BIT; + if (m->drawableType & GLX_PBUFFER_BIT) + surface_type |= EGL_PBUFFER_BIT; + + SET_CONFIG_ATTRIB(conf, EGL_BUFFER_SIZE, m->rgbBits); + SET_CONFIG_ATTRIB(conf, EGL_RED_SIZE, m->redBits); + SET_CONFIG_ATTRIB(conf, EGL_GREEN_SIZE, m->greenBits); + SET_CONFIG_ATTRIB(conf, EGL_BLUE_SIZE, m->blueBits); + SET_CONFIG_ATTRIB(conf, EGL_ALPHA_SIZE, m->alphaBits); + + SET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGB, m->bindToTextureRgb); + SET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGBA, m->bindToTextureRgba); + SET_CONFIG_ATTRIB(conf, EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER); + SET_CONFIG_ATTRIB(conf, EGL_CONFIG_CAVEAT, config_caveat); + + SET_CONFIG_ATTRIB(conf, EGL_CONFORMANT, conformant); + SET_CONFIG_ATTRIB(conf, EGL_DEPTH_SIZE, m->depthBits); + SET_CONFIG_ATTRIB(conf, EGL_LEVEL, m->level); + SET_CONFIG_ATTRIB(conf, EGL_MAX_PBUFFER_WIDTH, m->maxPbufferWidth); + SET_CONFIG_ATTRIB(conf, EGL_MAX_PBUFFER_HEIGHT, m->maxPbufferHeight); + SET_CONFIG_ATTRIB(conf, EGL_MAX_PBUFFER_PIXELS, m->maxPbufferPixels); + + SET_CONFIG_ATTRIB(conf, EGL_NATIVE_RENDERABLE, m->xRenderable); + SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_ID, m->visualID); + SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE, m->visualType); + SET_CONFIG_ATTRIB(conf, EGL_RENDERABLE_TYPE, renderable_type); + SET_CONFIG_ATTRIB(conf, EGL_SAMPLE_BUFFERS, m->sampleBuffers); + SET_CONFIG_ATTRIB(conf, EGL_SAMPLES, m->samples); + SET_CONFIG_ATTRIB(conf, EGL_STENCIL_SIZE, m->stencilBits); + + SET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE, surface_type); + + /* what to do with GLX_TRANSPARENT_INDEX? */ + if (m->transparentPixel == GLX_TRANSPARENT_RGB) { + SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_TYPE, EGL_TRANSPARENT_RGB); + SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_RED_VALUE, m->transparentRed); + SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_GREEN_VALUE, m->transparentGreen); + SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_BLUE_VALUE, m->transparentBlue); + } + else { + SET_CONFIG_ATTRIB(conf, EGL_TRANSPARENT_TYPE, EGL_NONE); + } + + return EGL_TRUE; +} + /** * Creates a set of \c _EGLConfigs that a driver will expose. diff --git a/src/egl/main/eglconfigutil.h b/src/egl/main/eglconfigutil.h index 820244611c..ad85079890 100644 --- a/src/egl/main/eglconfigutil.h +++ b/src/egl/main/eglconfigutil.h @@ -11,6 +11,11 @@ extern void _eglConfigToContextModesRec(const _EGLConfig *config, __GLcontextModes *mode); +extern EGLBoolean +_eglConfigFromContextModesRec(_EGLConfig *conf, const __GLcontextModes *m, + EGLint conformant, EGLint renderable_type); + + extern EGLBoolean _eglFillInConfigs( _EGLConfig *configs, EGLenum fb_format, EGLenum fb_type, -- cgit v1.2.3 From d845f2754bb8c0677323a5922cb90f9ea42bdb1f Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 27 Sep 2009 17:00:51 +0800 Subject: egl: Add support for querying render buffer. Signed-off-by: Chia-I Wu --- src/egl/main/eglcontext.c | 40 +++++++++++++++++++++++++++++++++------- src/egl/main/eglcontext.h | 3 +++ 2 files changed, 36 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/egl/main/eglcontext.c b/src/egl/main/eglcontext.c index b094f49bfc..ee4b1b59f5 100644 --- a/src/egl/main/eglcontext.c +++ b/src/egl/main/eglcontext.c @@ -45,6 +45,7 @@ _eglInitContext(_EGLDriver *drv, _EGLContext *ctx, ctx->DrawSurface = EGL_NO_SURFACE; ctx->ReadSurface = EGL_NO_SURFACE; ctx->ClientAPI = api; + ctx->WindowRenderBuffer = EGL_NONE; return EGL_TRUE; } @@ -87,6 +88,24 @@ _eglDestroyContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx) } +#ifdef EGL_VERSION_1_2 +static EGLint +_eglQueryContextRenderBuffer(_EGLContext *ctx) +{ + _EGLSurface *surf = ctx->DrawSurface; + EGLint rb; + + if (!surf) + return EGL_NONE; + if (surf->Type == EGL_WINDOW_BIT && ctx->WindowRenderBuffer != EGL_NONE) + rb = ctx->WindowRenderBuffer; + else + rb = surf->RenderBuffer; + return rb; +} +#endif /* EGL_VERSION_1_2 */ + + EGLBoolean _eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *c, EGLint attribute, EGLint *value) @@ -94,22 +113,29 @@ _eglQueryContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *c, (void) drv; (void) dpy; + if (!value) + return _eglError(EGL_BAD_PARAMETER, "eglQueryContext"); + switch (attribute) { case EGL_CONFIG_ID: *value = GET_CONFIG_ATTRIB(c->Config, EGL_CONFIG_ID); - return EGL_TRUE; + break; + case EGL_CONTEXT_CLIENT_VERSION: + *value = c->ClientVersion; + break; #ifdef EGL_VERSION_1_2 case EGL_CONTEXT_CLIENT_TYPE: *value = c->ClientAPI; - return EGL_TRUE; + break; + case EGL_RENDER_BUFFER: + *value = _eglQueryContextRenderBuffer(c); + break; #endif /* EGL_VERSION_1_2 */ - case EGL_CONTEXT_CLIENT_VERSION: - *value = c->ClientVersion; - return EGL_TRUE; default: - _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext"); - return EGL_FALSE; + return _eglError(EGL_BAD_ATTRIBUTE, "eglQueryContext"); } + + return EGL_TRUE; } diff --git a/src/egl/main/eglcontext.h b/src/egl/main/eglcontext.h index 647f24488f..45c7b4717b 100644 --- a/src/egl/main/eglcontext.h +++ b/src/egl/main/eglcontext.h @@ -24,6 +24,9 @@ struct _egl_context EGLint ClientAPI; /**< EGL_OPENGL_ES_API, EGL_OPENGL_API, EGL_OPENVG_API */ EGLint ClientVersion; /**< 1 = OpenGLES 1.x, 2 = OpenGLES 2.x */ + + /* The real render buffer when a window surface is bound */ + EGLint WindowRenderBuffer; }; -- cgit v1.2.3 From 170bd0c8827f6f65c7bfa5a7fb68ba0678ed57ba Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 27 Sep 2009 16:40:43 +0800 Subject: egl_xdri: Report full list of supported configs. Call _eglConfigFromContextModesRec to convert __GLcontextModes to _EGLConfig. Single-buffered configs are no longer skipped. Signed-off-by: Chia-I Wu --- src/egl/drivers/xdri/egl_xdri.c | 97 ++++++++++++++++++++++++++++------------- 1 file changed, 66 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/egl/drivers/xdri/egl_xdri.c b/src/egl/drivers/xdri/egl_xdri.c index 518091a2d1..d2affc66dd 100644 --- a/src/egl/drivers/xdri/egl_xdri.c +++ b/src/egl/drivers/xdri/egl_xdri.c @@ -48,6 +48,7 @@ #include "glapi/glapi.h" /* for glapi functions */ #include "eglconfig.h" +#include "eglconfigutil.h" #include "eglcontext.h" #include "egldisplay.h" #include "egldriver.h" @@ -104,6 +105,7 @@ struct xdri_egl_config _EGLConfig Base; /**< base class */ const __GLcontextModes *mode; /**< corresponding GLX mode */ + EGLint window_render_buffer; }; @@ -162,46 +164,76 @@ get_drawable_size(Display *dpy, Drawable d, uint *width, uint *height) } +static EGLBoolean +convert_config(_EGLConfig *conf, EGLint id, const __GLcontextModes *m) +{ + static const EGLint all_apis = (EGL_OPENGL_ES_BIT | + EGL_OPENGL_ES2_BIT | + EGL_OPENVG_BIT | + EGL_OPENGL_BIT); + EGLint val; + + _eglInitConfig(conf, id); + if (!_eglConfigFromContextModesRec(conf, m, all_apis, all_apis)) + return EGL_FALSE; + + if (m->doubleBufferMode) { + /* pixmap and pbuffer surfaces are always single-buffered */ + val = GET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE); + val &= ~(EGL_PIXMAP_BIT | EGL_PBUFFER_BIT); + SET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE, val); + } + else { + /* EGL requires OpenGL ES context to be double-buffered */ + val = GET_CONFIG_ATTRIB(conf, EGL_RENDERABLE_TYPE); + val &= ~(EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT); + SET_CONFIG_ATTRIB(conf, EGL_RENDERABLE_TYPE, val); + } + /* skip "empty" config */ + if (!val) + return EGL_FALSE; + + val = GET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE); + if (!(val & EGL_PBUFFER_BIT)) { + /* bind-to-texture cannot be EGL_TRUE without pbuffer bit */ + SET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGB, EGL_FALSE); + SET_CONFIG_ATTRIB(conf, EGL_BIND_TO_TEXTURE_RGBA, EGL_FALSE); + } + + /* EGL_NATIVE_RENDERABLE is a boolean */ + val = GET_CONFIG_ATTRIB(conf, EGL_NATIVE_RENDERABLE); + if (val != EGL_TRUE) + SET_CONFIG_ATTRIB(conf, EGL_NATIVE_RENDERABLE, EGL_FALSE); + + return _eglValidateConfig(conf, EGL_FALSE); +} + + /** * Produce a set of EGL configs. */ static EGLint create_configs(_EGLDisplay *disp, const __GLcontextModes *m, EGLint first_id) { - static const EGLint all_apis = (EGL_OPENGL_ES_BIT | - EGL_OPENGL_ES2_BIT | - EGL_OPENVG_BIT | - EGL_OPENGL_BIT); int id = first_id; for (; m; m = m->next) { - /* add double buffered visual */ - if (m->doubleBufferMode) { - struct xdri_egl_config *config = CALLOC_STRUCT(xdri_egl_config); - - _eglInitConfig(&config->Base, id++); - - SET_CONFIG_ATTRIB(&config->Base, EGL_BUFFER_SIZE, m->rgbBits); - SET_CONFIG_ATTRIB(&config->Base, EGL_RED_SIZE, m->redBits); - SET_CONFIG_ATTRIB(&config->Base, EGL_GREEN_SIZE, m->greenBits); - SET_CONFIG_ATTRIB(&config->Base, EGL_BLUE_SIZE, m->blueBits); - SET_CONFIG_ATTRIB(&config->Base, EGL_ALPHA_SIZE, m->alphaBits); - SET_CONFIG_ATTRIB(&config->Base, EGL_DEPTH_SIZE, m->depthBits); - SET_CONFIG_ATTRIB(&config->Base, EGL_STENCIL_SIZE, m->stencilBits); - SET_CONFIG_ATTRIB(&config->Base, EGL_SAMPLES, m->samples); - SET_CONFIG_ATTRIB(&config->Base, EGL_SAMPLE_BUFFERS, m->sampleBuffers); - SET_CONFIG_ATTRIB(&config->Base, EGL_NATIVE_VISUAL_ID, m->visualID); - SET_CONFIG_ATTRIB(&config->Base, EGL_NATIVE_VISUAL_TYPE, m->visualType); - SET_CONFIG_ATTRIB(&config->Base, EGL_CONFORMANT, all_apis); - SET_CONFIG_ATTRIB(&config->Base, EGL_RENDERABLE_TYPE, all_apis); - SET_CONFIG_ATTRIB(&config->Base, EGL_SURFACE_TYPE, EGL_WINDOW_BIT); - - /* XXX possibly other things to init... */ - - /* Ptr from EGL config to GLcontextMode. Used in CreateContext(). */ - config->mode = m; - - _eglAddConfig(disp, &config->Base); + struct xdri_egl_config *xdri_conf; + _EGLConfig conf; + EGLint rb; + + if (!convert_config(&conf, id, m)) + continue; + + rb = (m->doubleBufferMode) ? EGL_BACK_BUFFER : EGL_SINGLE_BUFFER; + + xdri_conf = CALLOC_STRUCT(xdri_egl_config); + if (xdri_conf) { + memcpy(&xdri_conf->Base, &conf, sizeof(conf)); + xdri_conf->mode = m; + xdri_conf->window_render_buffer = rb; + _eglAddConfig(disp, &xdri_conf->Base); + id++; } } @@ -363,6 +395,9 @@ xdri_eglCreateContext(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, return NULL; } + /* the config decides the render buffer for the context */ + xdri_ctx->Base.WindowRenderBuffer = xdri_config->window_render_buffer; + xdri_ctx->driContext = psc->driScreen->createContext(psc, xdri_config->mode, -- cgit v1.2.3 From fbddc75aa2f6542117783b8024f9ebd2f0309e1f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 29 Sep 2009 08:21:54 -0600 Subject: softpipe: Grab a ref when the fb is set. Nasty bug when the surface is freed and another is allocated right on top of it. The next time we set the fb state SP thinks it's the same surface and doesn't flush, and when the flush eventually happens the surface belongs to a completely different texture. (cherry picked from commit a77226071f6814a53358a5d6caff685889d0e4ec) Conflicts: src/gallium/drivers/softpipe/sp_context.c --- src/gallium/drivers/softpipe/sp_context.c | 9 +++++++-- src/gallium/drivers/softpipe/sp_state_surface.c | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 86df320ea8..b4650c0dc5 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -105,12 +105,17 @@ static void softpipe_destroy( struct pipe_context *pipe ) softpipe->quad[i].output->destroy( softpipe->quad[i].output ); } - for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) + for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { sp_destroy_tile_cache(softpipe->cbuf_cache[i]); + pipe_surface_reference(&softpipe->framebuffer.cbufs[i], NULL); + } sp_destroy_tile_cache(softpipe->zsbuf_cache); + pipe_surface_reference(&softpipe->framebuffer.zsbuf, NULL); - for (i = 0; i < PIPE_MAX_SAMPLERS; i++) + for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { sp_destroy_tile_cache(softpipe->tex_cache[i]); + pipe_texture_reference(&softpipe->texture[i], NULL); + } for (i = 0; i < Elements(softpipe->constants); i++) { if (softpipe->constants[i].buffer) { diff --git a/src/gallium/drivers/softpipe/sp_state_surface.c b/src/gallium/drivers/softpipe/sp_state_surface.c index 7c06d864a7..181bff8f75 100644 --- a/src/gallium/drivers/softpipe/sp_state_surface.c +++ b/src/gallium/drivers/softpipe/sp_state_surface.c @@ -56,7 +56,7 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe, sp_flush_tile_cache(sp, sp->cbuf_cache[i]); /* assign new */ - sp->framebuffer.cbufs[i] = fb->cbufs[i]; + pipe_surface_reference(&sp->framebuffer.cbufs[i], fb->cbufs[i]); /* update cache */ sp_tile_cache_set_surface(sp->cbuf_cache[i], fb->cbufs[i]); @@ -71,7 +71,7 @@ softpipe_set_framebuffer_state(struct pipe_context *pipe, sp_flush_tile_cache(sp, sp->zsbuf_cache); /* assign new */ - sp->framebuffer.zsbuf = fb->zsbuf; + pipe_surface_reference(&sp->framebuffer.zsbuf, fb->zsbuf); /* update cache */ sp_tile_cache_set_surface(sp->zsbuf_cache, fb->zsbuf); -- cgit v1.2.3 From 564df9dc5f6335eb8dc68f3c69cf054d2142663c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 29 Sep 2009 08:50:56 -0600 Subject: softpipe: initialize the clear_flags bitvector in sp_create_tile_cache() This silences tons of valgrind warnings in programs that don't call glClear(), such as progs/demos/gamma. --- src/gallium/drivers/softpipe/sp_tile_cache.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index 461cbb9f95..5f7864e671 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -130,6 +130,11 @@ sp_create_tile_cache( struct pipe_screen *screen ) tc->entries[pos].x = tc->entries[pos].y = -1; } + +#if TILE_CLEAR_OPTIMIZATION + /* set flags to indicate all the tiles are cleared */ + memset(tc->clear_flags, 255, sizeof(tc->clear_flags)); +#endif } return tc; } -- cgit v1.2.3 From 9b5541617fd16d4b1de474a766717edf72112d21 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 29 Sep 2009 09:32:37 -0600 Subject: mesa: work-around glXCopyContext() bug in _mesa_copy_texture_state() See bug 24217. --- src/mesa/main/texstate.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 861c5f37c4..8292d43eb6 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -99,16 +99,22 @@ _mesa_copy_texture_state( const GLcontext *src, GLcontext *dst ) dst->Texture.Unit[u].BumpTarget = src->Texture.Unit[u].BumpTarget; COPY_4V(dst->Texture.Unit[u].RotMatrix, src->Texture.Unit[u].RotMatrix); + /* + * XXX strictly speaking, we should compare texture names/ids and + * bind textures in the dest context according to id. For now, only + * copy bindings if the contexts share the same pool of textures to + * avoid refcounting bugs. + */ + if (dst->Shared == src->Shared) { + /* copy texture object bindings, not contents of texture objects */ + _mesa_lock_context_textures(dst); - /* copy texture object bindings, not contents of texture objects */ - _mesa_lock_context_textures(dst); - - for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) { - _mesa_reference_texobj(&dst->Texture.Unit[u].CurrentTex[tex], - src->Texture.Unit[u].CurrentTex[tex]); + for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) { + _mesa_reference_texobj(&dst->Texture.Unit[u].CurrentTex[tex], + src->Texture.Unit[u].CurrentTex[tex]); + } + _mesa_unlock_context_textures(dst); } - - _mesa_unlock_context_textures(dst); } } -- cgit v1.2.3 From 69a3043f4109463f35e87102e509e0a4599cd09a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 29 Sep 2009 09:36:06 -0600 Subject: mesa: bump version to 7.6.1 --- src/mesa/main/version.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index 0ccdbf94a1..f24e11cc51 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.6 + * Version: 7.6.1 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * Copyright (C) 2009 VMware, Inc. All Rights Reserved. @@ -31,8 +31,8 @@ /* Mesa version */ #define MESA_MAJOR 7 #define MESA_MINOR 6 -#define MESA_PATCH 0 -#define MESA_VERSION_STRING "7.6" +#define MESA_PATCH 1 +#define MESA_VERSION_STRING "7.6.1-devel" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -- cgit v1.2.3 From ef9cd84521cbbc622c3c37af04b8d10934903ae8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 29 Sep 2009 09:58:47 -0600 Subject: glx: indentation fixes --- src/glx/x11/glxcmds.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index ea55cc49ef..af3e559f99 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -1575,7 +1575,7 @@ GLX_ALIAS(Display *, glXGetCurrentDisplayEXT, (void), (), * This function dynamically determines whether to use the EXT_import_context * version of the protocol or the GLX 1.3 version of the protocol. */ - static int __glXQueryContextInfo(Display * dpy, GLXContext ctx) +static int __glXQueryContextInfo(Display * dpy, GLXContext ctx) { __GLXdisplayPrivate *priv = __glXInitialize(dpy); xGLXQueryContextReply reply; @@ -1713,7 +1713,7 @@ GLX_ALIAS(int, glXQueryContextInfoEXT, (Display * dpy, GLXContext ctx, int attribute, int *value), (dpy, ctx, attribute, value), glXQueryContext) - PUBLIC GLXContextID glXGetContextIDEXT(const GLXContext ctx) +PUBLIC GLXContextID glXGetContextIDEXT(const GLXContext ctx) { return ctx->xid; } @@ -2159,18 +2159,19 @@ GLX_ALIAS(int, glXGetFBConfigAttribSGIX, (Display * dpy, GLXFBConfigSGIX config, int attribute, int *value), (dpy, config, attribute, value), glXGetFBConfigAttrib) - PUBLIC GLX_ALIAS(GLXFBConfigSGIX *, glXChooseFBConfigSGIX, - (Display * dpy, int screen, int *attrib_list, - int *nelements), (dpy, screen, attrib_list, nelements), - glXChooseFBConfig) +PUBLIC GLX_ALIAS(GLXFBConfigSGIX *, glXChooseFBConfigSGIX, + (Display * dpy, int screen, int *attrib_list, + int *nelements), (dpy, screen, attrib_list, nelements), + glXChooseFBConfig) - PUBLIC GLX_ALIAS(XVisualInfo *, glXGetVisualFromFBConfigSGIX, - (Display * dpy, GLXFBConfigSGIX config), - (dpy, config), glXGetVisualFromFBConfig) +PUBLIC GLX_ALIAS(XVisualInfo *, glXGetVisualFromFBConfigSGIX, + (Display * dpy, GLXFBConfigSGIX config), + (dpy, config), glXGetVisualFromFBConfig) - PUBLIC GLXPixmap glXCreateGLXPixmapWithConfigSGIX(Display * dpy, - GLXFBConfigSGIX config, - Pixmap pixmap) +PUBLIC GLXPixmap +glXCreateGLXPixmapWithConfigSGIX(Display * dpy, + GLXFBConfigSGIX config, + Pixmap pixmap) { xGLXVendorPrivateWithReplyReq *vpreq; xGLXCreateGLXPixmapWithConfigSGIXReq *req; -- cgit v1.2.3 From 741c40a232637c933c9273bbdef905397e54bc94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 29 Sep 2009 16:59:13 +0100 Subject: llvmpipe: Implement non SSE4.1 versions of floor and round. --- src/gallium/drivers/llvmpipe/lp_bld_arit.c | 177 +++++++++++++++++++---- src/gallium/drivers/llvmpipe/lp_bld_arit.h | 13 +- src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c | 4 +- 3 files changed, 159 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.c b/src/gallium/drivers/llvmpipe/lp_bld_arit.c index e8c5fa3c2a..f878706ad1 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_arit.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.c @@ -675,6 +675,8 @@ lp_build_round_sse41(struct lp_build_context *bld, assert(type.floating); assert(type.width*type.length == 128); + assert(lp_check_value(type, a)); + assert(util_cpu_caps.has_sse4_1); switch(type.width) { case 32: @@ -693,6 +695,28 @@ lp_build_round_sse41(struct lp_build_context *bld, } +LLVMValueRef +lp_build_trunc(struct lp_build_context *bld, + LLVMValueRef a) +{ + const struct lp_type type = bld->type; + + assert(type.floating); + assert(lp_check_value(type, a)); + + if(util_cpu_caps.has_sse4_1) + return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_TRUNCATE); + else { + LLVMTypeRef vec_type = lp_build_vec_type(type); + LLVMTypeRef int_vec_type = lp_build_int_vec_type(type); + LLVMValueRef res; + res = LLVMBuildFPToSI(bld->builder, a, int_vec_type, ""); + res = LLVMBuildSIToFP(bld->builder, res, vec_type, ""); + return res; + } +} + + LLVMValueRef lp_build_round(struct lp_build_context *bld, LLVMValueRef a) @@ -700,13 +724,17 @@ lp_build_round(struct lp_build_context *bld, const struct lp_type type = bld->type; assert(type.floating); + assert(lp_check_value(type, a)); if(util_cpu_caps.has_sse4_1) return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_NEAREST); - - /* FIXME */ - assert(0); - return bld->undef; + else { + LLVMTypeRef vec_type = lp_build_vec_type(type); + LLVMValueRef res; + res = lp_build_iround(bld, a); + res = LLVMBuildSIToFP(bld->builder, res, vec_type, ""); + return res; + } } @@ -720,10 +748,13 @@ lp_build_floor(struct lp_build_context *bld, if(util_cpu_caps.has_sse4_1) return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_FLOOR); - - /* FIXME */ - assert(0); - return bld->undef; + else { + LLVMTypeRef vec_type = lp_build_vec_type(type); + LLVMValueRef res; + res = lp_build_ifloor(bld, a); + res = LLVMBuildSIToFP(bld->builder, res, vec_type, ""); + return res; + } } @@ -734,47 +765,74 @@ lp_build_ceil(struct lp_build_context *bld, const struct lp_type type = bld->type; assert(type.floating); + assert(lp_check_value(type, a)); if(util_cpu_caps.has_sse4_1) return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_CEIL); - - /* FIXME */ - assert(0); - return bld->undef; + else { + LLVMTypeRef vec_type = lp_build_vec_type(type); + LLVMValueRef res; + res = lp_build_iceil(bld, a); + res = LLVMBuildSIToFP(bld->builder, res, vec_type, ""); + return res; + } } +/** + * Convert to integer, through whichever rounding method that's fastest, + * typically truncating to zero. + */ LLVMValueRef -lp_build_trunc(struct lp_build_context *bld, - LLVMValueRef a) +lp_build_itrunc(struct lp_build_context *bld, + LLVMValueRef a) { const struct lp_type type = bld->type; + LLVMTypeRef int_vec_type = lp_build_int_vec_type(type); assert(type.floating); + assert(lp_check_value(type, a)); - if(util_cpu_caps.has_sse4_1) - return lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_TRUNCATE); - - /* FIXME */ - assert(0); - return bld->undef; + return LLVMBuildFPToSI(bld->builder, a, int_vec_type, ""); } -/** - * Convert to integer, through whichever rounding method that's fastest, - * typically truncating to zero. - */ LLVMValueRef -lp_build_int(struct lp_build_context *bld, - LLVMValueRef a) +lp_build_iround(struct lp_build_context *bld, + LLVMValueRef a) { const struct lp_type type = bld->type; LLVMTypeRef int_vec_type = lp_build_int_vec_type(type); + LLVMValueRef res; assert(type.floating); + assert(lp_check_value(type, a)); - return LLVMBuildFPToSI(bld->builder, a, int_vec_type, ""); + if(util_cpu_caps.has_sse4_1) { + res = lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_NEAREST); + } + else { + LLVMTypeRef vec_type = lp_build_vec_type(type); + LLVMValueRef mask = lp_build_int_const_scalar(type, (unsigned long long)1 << (type.width - 1)); + LLVMValueRef sign; + LLVMValueRef half; + + /* get sign bit */ + sign = LLVMBuildBitCast(bld->builder, a, int_vec_type, ""); + sign = LLVMBuildAnd(bld->builder, sign, mask, ""); + + /* sign * 0.5 */ + half = lp_build_const_scalar(type, 0.5); + half = LLVMBuildBitCast(bld->builder, half, int_vec_type, ""); + half = LLVMBuildOr(bld->builder, sign, half, ""); + half = LLVMBuildBitCast(bld->builder, half, vec_type, ""); + + res = LLVMBuildAdd(bld->builder, a, half, ""); + } + + res = LLVMBuildFPToSI(bld->builder, res, int_vec_type, ""); + + return res; } @@ -782,9 +840,68 @@ LLVMValueRef lp_build_ifloor(struct lp_build_context *bld, LLVMValueRef a) { - a = lp_build_floor(bld, a); - a = lp_build_int(bld, a); - return a; + const struct lp_type type = bld->type; + LLVMTypeRef int_vec_type = lp_build_int_vec_type(type); + LLVMValueRef res; + + assert(type.floating); + assert(lp_check_value(type, a)); + + if(util_cpu_caps.has_sse4_1) { + res = lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_FLOOR); + } + else { + /* Take the sign bit and add it to 1 constant */ + LLVMTypeRef vec_type = lp_build_vec_type(type); + unsigned mantissa = lp_mantissa(type); + LLVMValueRef mask = lp_build_int_const_scalar(type, (unsigned long long)1 << (type.width - 1)); + LLVMValueRef sign; + LLVMValueRef offset; + + /* sign = a < 0 ? ~0 : 0 */ + sign = LLVMBuildBitCast(bld->builder, a, int_vec_type, ""); + sign = LLVMBuildAnd(bld->builder, sign, mask, ""); + sign = LLVMBuildAShr(bld->builder, sign, lp_build_int_const_scalar(type, type.width - 1), ""); + + /* offset = -0.99999(9)f */ + offset = lp_build_const_scalar(type, -(double)(((unsigned long long)1 << mantissa) - 1)/((unsigned long long)1 << mantissa)); + offset = LLVMConstBitCast(offset, int_vec_type); + + /* offset = a < 0 ? -0.99999(9)f : 0.0f */ + offset = LLVMBuildAnd(bld->builder, offset, sign, ""); + offset = LLVMBuildBitCast(bld->builder, offset, vec_type, ""); + + res = LLVMBuildAdd(bld->builder, a, offset, ""); + } + + res = LLVMBuildFPToSI(bld->builder, res, int_vec_type, ""); + + return res; +} + + +LLVMValueRef +lp_build_iceil(struct lp_build_context *bld, + LLVMValueRef a) +{ + const struct lp_type type = bld->type; + LLVMTypeRef int_vec_type = lp_build_int_vec_type(type); + LLVMValueRef res; + + assert(type.floating); + assert(lp_check_value(type, a)); + + if(util_cpu_caps.has_sse4_1) { + res = lp_build_round_sse41(bld, a, LP_BUILD_ROUND_SSE41_CEIL); + } + else { + assert(0); + res = bld->undef; + } + + res = LLVMBuildFPToSI(bld->builder, res, int_vec_type, ""); + + return res; } diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.h b/src/gallium/drivers/llvmpipe/lp_bld_arit.h index d68a97c4b8..095a8e1cab 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_arit.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.h @@ -126,11 +126,18 @@ lp_build_trunc(struct lp_build_context *bld, LLVMValueRef a); LLVMValueRef -lp_build_int(struct lp_build_context *bld, - LLVMValueRef a); +lp_build_ifloor(struct lp_build_context *bld, + LLVMValueRef a); +LLVMValueRef +lp_build_iceil(struct lp_build_context *bld, + LLVMValueRef a); LLVMValueRef -lp_build_ifloor(struct lp_build_context *bld, +lp_build_iround(struct lp_build_context *bld, + LLVMValueRef a); + +LLVMValueRef +lp_build_itrunc(struct lp_build_context *bld, LLVMValueRef a); LLVMValueRef diff --git a/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c index 8ca1be6f1b..1a47ca32d2 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c @@ -274,8 +274,8 @@ lp_build_sample_2d_linear_soa(struct lp_build_sample_context *bld, s_fpart = lp_build_sub(&bld->coord_bld, s, s_ipart); t_fpart = lp_build_sub(&bld->coord_bld, t, t_ipart); - x0 = lp_build_int(&bld->coord_bld, s_ipart); - y0 = lp_build_int(&bld->coord_bld, t_ipart); + x0 = lp_build_itrunc(&bld->coord_bld, s_ipart); + y0 = lp_build_itrunc(&bld->coord_bld, t_ipart); x0 = lp_build_sample_wrap(bld, x0, width, bld->static_state->pot_width, bld->static_state->wrap_s); y0 = lp_build_sample_wrap(bld, y0, height, bld->static_state->pot_height, bld->static_state->wrap_t); -- cgit v1.2.3 From 754f48871c3be671031d9a495fc96a42b71da349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 29 Sep 2009 17:21:34 +0100 Subject: llvmpipe: Runtime cpu checks for lp_build_min_simple too. --- src/gallium/drivers/llvmpipe/lp_bld_arit.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.c b/src/gallium/drivers/llvmpipe/lp_bld_arit.c index f878706ad1..d27ef0de04 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_arit.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.c @@ -54,6 +54,7 @@ #include "lp_bld_const.h" #include "lp_bld_intr.h" #include "lp_bld_logic.h" +#include "lp_bld_debug.h" #include "lp_bld_arit.h" @@ -72,30 +73,28 @@ lp_build_min_simple(struct lp_build_context *bld, /* TODO: optimize the constant case */ -#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) if(type.width * type.length == 128) { if(type.floating) { - if(type.width == 32) + if(type.width == 32 && util_cpu_caps.has_sse) intrinsic = "llvm.x86.sse.min.ps"; - if(type.width == 64) + if(type.width == 64 && util_cpu_caps.has_sse2) intrinsic = "llvm.x86.sse2.min.pd"; } else { - if(type.width == 8 && !type.sign) + if(type.width == 8 && !type.sign && util_cpu_caps.has_sse2) intrinsic = "llvm.x86.sse2.pminu.b"; - if(type.width == 8 && type.sign) + if(type.width == 8 && type.sign && util_cpu_caps.has_sse4_1) intrinsic = "llvm.x86.sse41.pminsb"; - if(type.width == 16 && !type.sign) + if(type.width == 16 && !type.sign && util_cpu_caps.has_sse4_1) intrinsic = "llvm.x86.sse41.pminuw"; - if(type.width == 16 && type.sign) + if(type.width == 16 && type.sign && util_cpu_caps.has_sse2) intrinsic = "llvm.x86.sse2.pmins.w"; - if(type.width == 32 && !type.sign) + if(type.width == 32 && !type.sign && util_cpu_caps.has_sse4_1) intrinsic = "llvm.x86.sse41.pminud"; - if(type.width == 32 && type.sign) + if(type.width == 32 && type.sign && util_cpu_caps.has_sse4_1) intrinsic = "llvm.x86.sse41.pminsd"; } } -#endif if(intrinsic) return lp_build_intrinsic_binary(bld->builder, intrinsic, lp_build_vec_type(bld->type), a, b); -- cgit v1.2.3 From a02ecdf8c2fc5783a4bc82e8cd9d36f0dec7ccec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 29 Sep 2009 17:22:39 +0100 Subject: llvmpipe: First verify LLVM IR, only then run optimizing passes. --- src/gallium/drivers/llvmpipe/lp_state_fs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 9faed5a0b1..d5ce6993c5 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -582,6 +582,11 @@ generate_fragment(struct llvmpipe_context *lp, * Translate the LLVM IR into machine code. */ + if(LLVMVerifyFunction(variant->function, LLVMPrintMessageAction)) { + LLVMDumpValue(variant->function); + abort(); + } + LLVMRunFunctionPassManager(screen->pass, variant->function); #ifdef DEBUG @@ -589,11 +594,6 @@ generate_fragment(struct llvmpipe_context *lp, debug_printf("\n"); #endif - if(LLVMVerifyFunction(variant->function, LLVMPrintMessageAction)) { - LLVMDumpValue(variant->function); - abort(); - } - variant->jit_function = (lp_jit_frag_func)LLVMGetPointerToGlobal(screen->engine, variant->function); #ifdef DEBUG -- cgit v1.2.3 From baddcbc5225e12052b3bc8c07a8b65243d76574d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 29 Sep 2009 17:26:20 +0100 Subject: llvmpipe: Workaround for bug in llvm 2.5. The combination of fptosi and sitofp (necessary for trunc/floor/ceil/round implementation) somehow becomes invalid code. Skip the instruction combining pass when SSE4.1 is not available. --- src/gallium/drivers/llvmpipe/lp_jit.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c index 5d2cf01e5b..1126bf90b9 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.c +++ b/src/gallium/drivers/llvmpipe/lp_jit.c @@ -150,6 +150,12 @@ lp_jit_screen_init(struct llvmpipe_screen *screen) util_cpu_detect(); +#if 0 + /* For simulating less capable machines */ + util_cpu_caps.has_sse3 = 0; + util_cpu_caps.has_sse4_1 = 0; +#endif + #ifdef LLVM_NATIVE_ARCH LLVMLinkInJIT(); LLVMInitializeNativeTarget(); @@ -171,8 +177,15 @@ lp_jit_screen_init(struct llvmpipe_screen *screen) LLVMAddTargetData(screen->target, screen->pass); /* These are the passes currently listed in llvm-c/Transforms/Scalar.h, * but there are more on SVN. */ + /* TODO: Add more passes */ LLVMAddConstantPropagationPass(screen->pass); - LLVMAddInstructionCombiningPass(screen->pass); + if(util_cpu_caps.has_sse4_1) { + /* FIXME: There is a bug in this pass, whereby the combination of fptosi + * and sitofp (necessary for trunc/floor/ceil/round implementation) + * somehow becomes invalid code. + */ + LLVMAddInstructionCombiningPass(screen->pass); + } LLVMAddPromoteMemoryToRegisterPass(screen->pass); LLVMAddGVNPass(screen->pass); LLVMAddCFGSimplificationPass(screen->pass); -- cgit v1.2.3 From c7aee65bb96df3f8e8421b5125dca84c028e9073 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 28 Sep 2009 15:26:12 -0600 Subject: mesa: added _mesa_nop_vertex/fragment_program() For debug/test purposes. --- src/mesa/shader/programopt.c | 91 ++++++++++++++++++++++++++++++++++++++++++++ src/mesa/shader/programopt.h | 7 ++++ 2 files changed, 98 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c index f70c75cec8..3b8529592d 100644 --- a/src/mesa/shader/programopt.c +++ b/src/mesa/shader/programopt.c @@ -573,3 +573,94 @@ _mesa_remove_output_reads(struct gl_program *prog, gl_register_file type) } } } + + +/** + * Make the given fragment program into a "no-op" shader. + * Actually, just copy the incoming fragment color (or texcoord) + * to the output color. + * This is for debug/test purposes. + */ +void +_mesa_nop_fragment_program(GLcontext *ctx, struct gl_fragment_program *prog) +{ + struct prog_instruction *inst; + GLuint inputAttr; + + inst = _mesa_alloc_instructions(2); + if (!inst) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "_mesa_nop_fragment_program"); + return; + } + + _mesa_init_instructions(inst, 2); + + inst[0].Opcode = OPCODE_MOV; + inst[0].DstReg.File = PROGRAM_OUTPUT; + inst[0].DstReg.Index = FRAG_RESULT_COLOR; + inst[0].SrcReg[0].File = PROGRAM_INPUT; + if (prog->Base.InputsRead & FRAG_BIT_COL0) + inputAttr = FRAG_ATTRIB_COL0; + else + inputAttr = FRAG_ATTRIB_TEX0; + inst[0].SrcReg[0].Index = inputAttr; + + inst[1].Opcode = OPCODE_END; + + _mesa_free_instructions(prog->Base.Instructions, + prog->Base.NumInstructions); + + prog->Base.Instructions = inst; + prog->Base.NumInstructions = 2; + prog->Base.InputsRead = 1 << inputAttr; + prog->Base.OutputsWritten = 1 << FRAG_RESULT_COLOR; +} + + +/** + * \sa _mesa_nop_fragment_program + * Replace the given vertex program with a "no-op" program that just + * transforms vertex position and emits color. + */ +void +_mesa_nop_vertex_program(GLcontext *ctx, struct gl_vertex_program *prog) +{ + struct prog_instruction *inst; + GLuint inputAttr; + + /* + * Start with a simple vertex program that emits color. + */ + inst = _mesa_alloc_instructions(2); + if (!inst) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "_mesa_nop_vertex_program"); + return; + } + + _mesa_init_instructions(inst, 2); + + inst[0].Opcode = OPCODE_MOV; + inst[0].DstReg.File = PROGRAM_OUTPUT; + inst[0].DstReg.Index = VERT_RESULT_COL0; + inst[0].SrcReg[0].File = PROGRAM_INPUT; + if (prog->Base.InputsRead & VERT_BIT_COLOR0) + inputAttr = VERT_ATTRIB_COLOR0; + else + inputAttr = VERT_ATTRIB_TEX0; + inst[0].SrcReg[0].Index = inputAttr; + + inst[1].Opcode = OPCODE_END; + + _mesa_free_instructions(prog->Base.Instructions, + prog->Base.NumInstructions); + + prog->Base.Instructions = inst; + prog->Base.NumInstructions = 2; + prog->Base.InputsRead = 1 << inputAttr; + prog->Base.OutputsWritten = 1 << VERT_RESULT_COL0; + + /* + * Now insert code to do standard modelview/projection transformation. + */ + _mesa_insert_mvp_code(ctx, prog); +} diff --git a/src/mesa/shader/programopt.h b/src/mesa/shader/programopt.h index 96acaf9566..21fac07849 100644 --- a/src/mesa/shader/programopt.h +++ b/src/mesa/shader/programopt.h @@ -42,4 +42,11 @@ _mesa_count_texture_instructions(struct gl_program *prog); extern void _mesa_remove_output_reads(struct gl_program *prog, gl_register_file type); +extern void +_mesa_nop_fragment_program(GLcontext *ctx, struct gl_fragment_program *prog); + +extern void +_mesa_nop_vertex_program(GLcontext *ctx, struct gl_vertex_program *prog); + + #endif /* PROGRAMOPT_H */ -- cgit v1.2.3 From cb0de06301cd086a02ca709917819119dc1a8fd9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 29 Sep 2009 10:22:32 -0600 Subject: mesa: added nopfrag/nopvert options for MESA_GLSL These options can be used to force vertex/fragment shaders to be no-op shaders (actually, simple pass-through shaders). For debug/test purposes. --- src/mesa/main/mtypes.h | 2 ++ src/mesa/shader/shader_api.c | 4 ++++ src/mesa/shader/slang/slang_compile.c | 10 ++++++++++ 3 files changed, 16 insertions(+) (limited to 'src') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index d7bf7689f3..d005064645 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2066,6 +2066,8 @@ struct gl_shader_program #define GLSL_OPT 0x4 /**< Force optimizations (override pragmas) */ #define GLSL_NO_OPT 0x8 /**< Force no optimizations (override pragmas) */ #define GLSL_UNIFORMS 0x10 /**< Print glUniform calls */ +#define GLSL_NOP_VERT 0x20 /**< Force no-op vertex shaders */ +#define GLSL_NOP_FRAG 0x40 /**< Force no-op fragment shaders */ /** diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 178b7d0dba..6b19b4c46b 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -380,6 +380,10 @@ get_shader_flags(void) flags |= GLSL_DUMP; if (_mesa_strstr(env, "log")) flags |= GLSL_LOG; + if (_mesa_strstr(env, "nopvert")) + flags |= GLSL_NOP_VERT; + if (_mesa_strstr(env, "nopfrag")) + flags |= GLSL_NOP_FRAG; if (_mesa_strstr(env, "nopt")) flags |= GLSL_NO_OPT; else if (_mesa_strstr(env, "opt")) diff --git a/src/mesa/shader/slang/slang_compile.c b/src/mesa/shader/slang/slang_compile.c index c1b97c7cb7..a270888443 100644 --- a/src/mesa/shader/slang/slang_compile.c +++ b/src/mesa/shader/slang/slang_compile.c @@ -2814,6 +2814,16 @@ _slang_compile(GLcontext *ctx, struct gl_shader *shader) (ctx->Shader.Flags & GLSL_NO_OPT) == 0) { _mesa_optimize_program(ctx, shader->Program); } + if ((ctx->Shader.Flags & GLSL_NOP_VERT) && + shader->Program->Target == GL_VERTEX_PROGRAM_ARB) { + _mesa_nop_vertex_program(ctx, + (struct gl_vertex_program *) shader->Program); + } + if ((ctx->Shader.Flags & GLSL_NOP_FRAG) && + shader->Program->Target == GL_FRAGMENT_PROGRAM_ARB) { + _mesa_nop_fragment_program(ctx, + (struct gl_fragment_program *) shader->Program); + } } if (ctx->Shader.Flags & GLSL_LOG) { -- cgit v1.2.3 From 86ee448047e4f7be722b69da5296ccafc2307145 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 29 Sep 2009 12:16:12 -0600 Subject: mesa/xlib: fix GLX_RENDER_TYPE query Return GLX_RGBA_TYPE or GLX_COLOR_INDEX_TYPE. --- src/mesa/drivers/x11/fakeglx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index 34e0b8bc8d..eb7c4f6417 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -2477,9 +2477,9 @@ Fake_glXQueryContext( Display *dpy, GLXContext ctx, int attribute, int *value ) break; case GLX_RENDER_TYPE: if (xmctx->xm_visual->mesa_visual.rgbMode) - *value = GLX_RGBA_BIT; + *value = GLX_RGBA_TYPE; else - *value = GLX_COLOR_INDEX_BIT; + *value = GLX_COLOR_INDEX_TYPE; break; case GLX_SCREEN: *value = 0; -- cgit v1.2.3 From a6b84aef4ad3a7bac40704146a98977c62bfb6e8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 29 Sep 2009 12:17:11 -0600 Subject: gallium/xlib: fix GLX_RENDER_TYPE query Return GLX_RGBA_TYPE or GLX_COLOR_INDEX_TYPE. --- src/gallium/state_trackers/glx/xlib/glx_api.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c index d1a98f8991..65012e9253 100644 --- a/src/gallium/state_trackers/glx/xlib/glx_api.c +++ b/src/gallium/state_trackers/glx/xlib/glx_api.c @@ -1538,9 +1538,9 @@ get_config( XMesaVisual xmvis, int attrib, int *value, GLboolean fbconfig ) if (!fbconfig) return GLX_BAD_ATTRIBUTE; if (xmvis->mesa_visual.rgbMode) - *value = GLX_RGBA_BIT; + *value = GLX_RGBA_TYPE; else - *value = GLX_COLOR_INDEX_BIT; + *value = GLX_COLOR_INDEX_TYPE; break; case GLX_X_RENDERABLE_SGIX: if (!fbconfig) @@ -2120,9 +2120,9 @@ glXQueryContext( Display *dpy, GLXContext ctx, int attribute, int *value ) break; case GLX_RENDER_TYPE: if (xmctx->xm_visual->mesa_visual.rgbMode) - *value = GLX_RGBA_BIT; + *value = GLX_RGBA_TYPE; else - *value = GLX_COLOR_INDEX_BIT; + *value = GLX_COLOR_INDEX_TYPE; break; case GLX_SCREEN: *value = 0; -- cgit v1.2.3 From 3c794e45b02c66ce3f52fe359f733e4d7d2ce315 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 29 Sep 2009 18:51:49 -0600 Subject: glsl: add support for CMP instruction --- src/mesa/shader/slang/slang_codegen.c | 1 + src/mesa/shader/slang/slang_emit.c | 1 + src/mesa/shader/slang/slang_ir.c | 1 + src/mesa/shader/slang/slang_ir.h | 1 + 4 files changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 703af9f874..344dfdc680 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -422,6 +422,7 @@ static slang_asm_info AsmInfo[] = { { "vec4_lrp", IR_LRP, 1, 3 }, { "vec4_min", IR_MIN, 1, 2 }, { "vec4_max", IR_MAX, 1, 2 }, + { "vec4_cmp", IR_CMP, 1, 3 }, { "vec4_clamp", IR_CLAMP, 1, 3 }, { "vec4_seq", IR_SEQUAL, 1, 2 }, { "vec4_sne", IR_SNEQUAL, 1, 2 }, diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 3f455e0640..3af301eacd 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -2287,6 +2287,7 @@ emit(slang_emit_info *emitInfo, slang_ir_node *n) case IR_POW: /* trinary operators */ case IR_LRP: + case IR_CMP: return emit_arith(emitInfo, n); case IR_EQUAL: diff --git a/src/mesa/shader/slang/slang_ir.c b/src/mesa/shader/slang/slang_ir.c index 1c7f7474e7..62603503dd 100644 --- a/src/mesa/shader/slang/slang_ir.c +++ b/src/mesa/shader/slang/slang_ir.c @@ -80,6 +80,7 @@ static const slang_ir_info IrInfo[] = { { IR_NOISE4, "IR_NOISE4", OPCODE_NOISE4, 1, 1 }, /* other */ + { IR_CMP, "IR_CMP", OPCODE_CMP, 4, 3 }, /* compare/select */ { IR_SEQ, "IR_SEQ", OPCODE_NOP, 0, 0 }, { IR_SCOPE, "IR_SCOPE", OPCODE_NOP, 0, 0 }, { IR_LABEL, "IR_LABEL", OPCODE_NOP, 0, 0 }, diff --git a/src/mesa/shader/slang/slang_ir.h b/src/mesa/shader/slang/slang_ir.h index e796693ed5..166b4e8043 100644 --- a/src/mesa/shader/slang/slang_ir.h +++ b/src/mesa/shader/slang/slang_ir.h @@ -91,6 +91,7 @@ typedef enum IR_CLAMP, IR_MIN, IR_MAX, + IR_CMP, /* = (op0 < 0) ? op1 : op2 */ IR_SEQUAL, /* Set if args are equal (vector) */ IR_SNEQUAL, /* Set if args are not equal (vector) */ IR_SGE, /* Set if greater or equal (vector) */ -- cgit v1.2.3 From 65765c9f2c5d3568608bde57db0bf44d6b724755 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 29 Sep 2009 18:57:13 -0600 Subject: glsl: rewrite sqrt(x) intrinsic to handle x=0 Since sqrt() is basically implemented in terms of RSQ/RCP we'll do a divide by zero if x=0 and wind up with unpredictable results. Now use CMP instruction to test for x<=0 and return zero in that case. --- .../shader/slang/library/slang_common_builtin.gc | 76 ++++++++++++---------- 1 file changed, 42 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/slang/library/slang_common_builtin.gc b/src/mesa/shader/slang/library/slang_common_builtin.gc index 9764fc25b0..56de47ee8d 100644 --- a/src/mesa/shader/slang/library/slang_common_builtin.gc +++ b/src/mesa/shader/slang/library/slang_common_builtin.gc @@ -602,42 +602,50 @@ vec4 exp2(const vec4 a) float sqrt(const float x) { + const float nx = -x; float r; __asm float_rsq r, x; - __asm float_rcp __retVal, r; -} - -vec2 sqrt(const vec2 v) -{ - float r; - __asm float_rsq r, v.x; - __asm float_rcp __retVal.x, r; - __asm float_rsq r, v.y; - __asm float_rcp __retVal.y, r; -} - -vec3 sqrt(const vec3 v) -{ - float r; - __asm float_rsq r, v.x; - __asm float_rcp __retVal.x, r; - __asm float_rsq r, v.y; - __asm float_rcp __retVal.y, r; - __asm float_rsq r, v.z; - __asm float_rcp __retVal.z, r; -} - -vec4 sqrt(const vec4 v) -{ - float r; - __asm float_rsq r, v.x; - __asm float_rcp __retVal.x, r; - __asm float_rsq r, v.y; - __asm float_rcp __retVal.y, r; - __asm float_rsq r, v.z; - __asm float_rcp __retVal.z, r; - __asm float_rsq r, v.w; - __asm float_rcp __retVal.w, r; + __asm float_rcp r, r; + __asm vec4_cmp __retVal, nx, r, 0.0; +} + +vec2 sqrt(const vec2 x) +{ + const vec2 nx = -x, zero = vec2(0.0); + vec2 r; + __asm float_rsq r.x, x.x; + __asm float_rsq r.y, x.y; + __asm float_rcp r.x, r.x; + __asm float_rcp r.y, r.y; + __asm vec4_cmp __retVal, nx, r, zero; +} + +vec3 sqrt(const vec3 x) +{ + const vec3 nx = -x, zero = vec3(0.0); + vec3 r; + __asm float_rsq r.x, x.x; + __asm float_rsq r.y, x.y; + __asm float_rsq r.z, x.z; + __asm float_rcp r.x, r.x; + __asm float_rcp r.y, r.y; + __asm float_rcp r.z, r.z; + __asm vec4_cmp __retVal, nx, r, zero; +} + +vec4 sqrt(const vec4 x) +{ + const vec4 nx = -x, zero = vec4(0.0); + vec4 r; + __asm float_rsq r.x, x.x; + __asm float_rsq r.y, x.y; + __asm float_rsq r.z, x.z; + __asm float_rsq r.w, x.w; + __asm float_rcp r.x, r.x; + __asm float_rcp r.y, r.y; + __asm float_rcp r.z, r.z; + __asm float_rcp r.w, r.w; + __asm vec4_cmp __retVal, nx, r, zero; } -- cgit v1.2.3 From 322bc403bc7aacb58c39527f5f7a324e0c63c73d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 29 Sep 2009 18:59:37 -0600 Subject: glsl: regenerated file --- .../shader/slang/library/slang_common_builtin_gc.h | 106 +++++++++++---------- 1 file changed, 57 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/slang/library/slang_common_builtin_gc.h b/src/mesa/shader/slang/library/slang_common_builtin_gc.h index 78a7b83ec1..3c3666e4ea 100644 --- a/src/mesa/shader/slang/library/slang_common_builtin_gc.h +++ b/src/mesa/shader/slang/library/slang_common_builtin_gc.h @@ -307,55 +307,63 @@ 0,0,18,97,0,59,121,0,0,0,4,102,108,111,97,116,95,101,120,112,50,0,18,95,95,114,101,116,86,97,108,0, 59,122,0,0,18,97,0,59,122,0,0,0,4,102,108,111,97,116,95,101,120,112,50,0,18,95,95,114,101,116,86, 97,108,0,59,119,0,0,18,97,0,59,119,0,0,0,0,1,90,95,0,0,9,0,0,115,113,114,116,0,1,1,0,0,9,0,120,0,0, -0,1,3,2,90,95,0,0,9,0,1,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114,0,0,18,120,0,0,0,4, -102,108,111,97,116,95,114,99,112,0,18,95,95,114,101,116,86,97,108,0,0,18,114,0,0,0,0,1,90,95,0,0, -10,0,0,115,113,114,116,0,1,1,0,0,10,0,118,0,0,0,1,3,2,90,95,0,0,9,0,1,114,0,0,0,4,102,108,111,97, -116,95,114,115,113,0,18,114,0,0,18,118,0,59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,95, -95,114,101,116,86,97,108,0,59,120,0,0,18,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114,0, -0,18,118,0,59,121,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,95,95,114,101,116,86,97,108,0,59, -121,0,0,18,114,0,0,0,0,1,90,95,0,0,11,0,0,115,113,114,116,0,1,1,0,0,11,0,118,0,0,0,1,3,2,90,95,0,0, -9,0,1,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114,0,0,18,118,0,59,120,0,0,0,4,102,108, -111,97,116,95,114,99,112,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,114,0,0,0,4,102,108,111, -97,116,95,114,115,113,0,18,114,0,0,18,118,0,59,121,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18, -95,95,114,101,116,86,97,108,0,59,121,0,0,18,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114, -0,0,18,118,0,59,122,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,95,95,114,101,116,86,97,108,0,59, -122,0,0,18,114,0,0,0,0,1,90,95,0,0,12,0,0,115,113,114,116,0,1,1,0,0,12,0,118,0,0,0,1,3,2,90,95,0,0, -9,0,1,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114,0,0,18,118,0,59,120,0,0,0,4,102,108, -111,97,116,95,114,99,112,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,114,0,0,0,4,102,108,111, -97,116,95,114,115,113,0,18,114,0,0,18,118,0,59,121,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18, -95,95,114,101,116,86,97,108,0,59,121,0,0,18,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114, -0,0,18,118,0,59,122,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,95,95,114,101,116,86,97,108,0,59, -122,0,0,18,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114,0,0,18,118,0,59,119,0,0,0,4,102, -108,111,97,116,95,114,99,112,0,18,95,95,114,101,116,86,97,108,0,59,119,0,0,18,114,0,0,0,0,1,90,95, -0,0,9,0,0,105,110,118,101,114,115,101,115,113,114,116,0,1,1,0,0,9,0,120,0,0,0,1,4,102,108,111,97, -116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,120,0,0,0,0,1,90,95,0,0,10,0,0, -105,110,118,101,114,115,101,115,113,114,116,0,1,1,0,0,10,0,118,0,0,0,1,4,102,108,111,97,116,95,114, -115,113,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,118,0,59,120,0,0,0,4,102,108,111,97,116, -95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,118,0,59,121,0,0,0,0,1,90,95,0,0, -11,0,0,105,110,118,101,114,115,101,115,113,114,116,0,1,1,0,0,11,0,118,0,0,0,1,4,102,108,111,97,116, -95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,118,0,59,120,0,0,0,4,102,108,111, -97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,118,0,59,121,0,0,0,4,102, -108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,118,0,59,122,0,0,0, -0,1,90,95,0,0,12,0,0,105,110,118,101,114,115,101,115,113,114,116,0,1,1,0,0,12,0,118,0,0,0,1,4,102, -108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,118,0,59,120,0,0,0, -4,102,108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,118,0,59,121, -0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,118,0, -59,122,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,119,0,0,18, -118,0,59,119,0,0,0,0,1,90,95,0,0,9,0,0,110,111,114,109,97,108,105,122,101,0,1,1,0,0,9,0,120,0,0,0, -1,9,18,95,95,114,101,116,86,97,108,0,17,49,0,48,0,0,20,0,0,1,90,95,0,0,10,0,0,110,111,114,109,97, -108,105,122,101,0,1,1,0,0,10,0,118,0,0,0,1,3,2,90,95,1,0,9,0,1,115,0,2,58,105,110,118,101,114,115, -101,115,113,114,116,0,0,58,100,111,116,0,0,18,118,0,0,18,118,0,0,0,0,0,0,0,4,118,101,99,52,95,109, -117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,118,0,0,18,115,0, -0,0,0,1,90,95,0,0,11,0,0,110,111,114,109,97,108,105,122,101,0,1,1,0,0,11,0,118,0,0,0,1,3,2,90,95,0, -0,9,0,1,116,109,112,0,0,0,4,118,101,99,51,95,100,111,116,0,18,116,109,112,0,0,18,118,0,0,18,118,0, -0,0,4,102,108,111,97,116,95,114,115,113,0,18,116,109,112,0,0,18,116,109,112,0,0,0,4,118,101,99,52, -95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,118,0, -0,18,116,109,112,0,0,0,0,1,90,95,0,0,12,0,0,110,111,114,109,97,108,105,122,101,0,1,1,0,0,12,0,118, -0,0,0,1,3,2,90,95,0,0,9,0,1,116,109,112,0,0,0,4,118,101,99,52,95,100,111,116,0,18,116,109,112,0,0, -18,118,0,0,18,118,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,116,109,112,0,0,18,116,109,112,0, -0,0,4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120, -121,122,0,0,18,118,0,0,18,116,109,112,0,0,0,0,1,90,95,0,0,9,0,0,97,98,115,0,1,1,0,0,9,0,97,0,0,0,1, -4,118,101,99,52,95,97,98,115,0,18,95,95,114,101,116,86,97,108,0,0,18,97,0,0,0,0,1,90,95,0,0,10,0,0, +0,1,3,2,90,95,1,0,9,0,1,110,120,0,2,18,120,0,54,0,0,3,2,90,95,0,0,9,0,1,114,0,0,0,4,102,108,111,97, +116,95,114,115,113,0,18,114,0,0,18,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,114,0,0,18, +114,0,0,0,4,118,101,99,52,95,99,109,112,0,18,95,95,114,101,116,86,97,108,0,0,18,110,120,0,0,18,114, +0,0,17,48,0,48,0,0,0,0,0,1,90,95,0,0,10,0,0,115,113,114,116,0,1,1,0,0,10,0,120,0,0,0,1,3,2,90,95,1, +0,10,0,1,110,120,0,2,18,120,0,54,0,1,1,122,101,114,111,0,2,58,118,101,99,50,0,0,17,48,0,48,0,0,0,0, +0,0,3,2,90,95,0,0,10,0,1,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114,0,59,120,0,0,18, +120,0,59,120,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114,0,59,121,0,0,18,120,0,59,121,0,0,0, +4,102,108,111,97,116,95,114,99,112,0,18,114,0,59,120,0,0,18,114,0,59,120,0,0,0,4,102,108,111,97, +116,95,114,99,112,0,18,114,0,59,121,0,0,18,114,0,59,121,0,0,0,4,118,101,99,52,95,99,109,112,0,18, +95,95,114,101,116,86,97,108,0,0,18,110,120,0,0,18,114,0,0,18,122,101,114,111,0,0,0,0,1,90,95,0,0, +11,0,0,115,113,114,116,0,1,1,0,0,11,0,120,0,0,0,1,3,2,90,95,1,0,11,0,1,110,120,0,2,18,120,0,54,0,1, +1,122,101,114,111,0,2,58,118,101,99,51,0,0,17,48,0,48,0,0,0,0,0,0,3,2,90,95,0,0,11,0,1,114,0,0,0,4, +102,108,111,97,116,95,114,115,113,0,18,114,0,59,120,0,0,18,120,0,59,120,0,0,0,4,102,108,111,97,116, +95,114,115,113,0,18,114,0,59,121,0,0,18,120,0,59,121,0,0,0,4,102,108,111,97,116,95,114,115,113,0, +18,114,0,59,122,0,0,18,120,0,59,122,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,114,0,59,120,0,0, +18,114,0,59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,114,0,59,121,0,0,18,114,0,59,121,0,0, +0,4,102,108,111,97,116,95,114,99,112,0,18,114,0,59,122,0,0,18,114,0,59,122,0,0,0,4,118,101,99,52, +95,99,109,112,0,18,95,95,114,101,116,86,97,108,0,0,18,110,120,0,0,18,114,0,0,18,122,101,114,111,0, +0,0,0,1,90,95,0,0,12,0,0,115,113,114,116,0,1,1,0,0,12,0,120,0,0,0,1,3,2,90,95,1,0,12,0,1,110,120,0, +2,18,120,0,54,0,1,1,122,101,114,111,0,2,58,118,101,99,52,0,0,17,48,0,48,0,0,0,0,0,0,3,2,90,95,0,0, +12,0,1,114,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,114,0,59,120,0,0,18,120,0,59,120,0,0,0,4, +102,108,111,97,116,95,114,115,113,0,18,114,0,59,121,0,0,18,120,0,59,121,0,0,0,4,102,108,111,97,116, +95,114,115,113,0,18,114,0,59,122,0,0,18,120,0,59,122,0,0,0,4,102,108,111,97,116,95,114,115,113,0, +18,114,0,59,119,0,0,18,120,0,59,119,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,114,0,59,120,0,0, +18,114,0,59,120,0,0,0,4,102,108,111,97,116,95,114,99,112,0,18,114,0,59,121,0,0,18,114,0,59,121,0,0, +0,4,102,108,111,97,116,95,114,99,112,0,18,114,0,59,122,0,0,18,114,0,59,122,0,0,0,4,102,108,111,97, +116,95,114,99,112,0,18,114,0,59,119,0,0,18,114,0,59,119,0,0,0,4,118,101,99,52,95,99,109,112,0,18, +95,95,114,101,116,86,97,108,0,0,18,110,120,0,0,18,114,0,0,18,122,101,114,111,0,0,0,0,1,90,95,0,0,9, +0,0,105,110,118,101,114,115,101,115,113,114,116,0,1,1,0,0,9,0,120,0,0,0,1,4,102,108,111,97,116,95, +114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,120,0,0,0,0,1,90,95,0,0,10,0,0,105, +110,118,101,114,115,101,115,113,114,116,0,1,1,0,0,10,0,118,0,0,0,1,4,102,108,111,97,116,95,114,115, +113,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,118,0,59,120,0,0,0,4,102,108,111,97,116,95, +114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,118,0,59,121,0,0,0,0,1,90,95,0,0,11,0, +0,105,110,118,101,114,115,101,115,113,114,116,0,1,1,0,0,11,0,118,0,0,0,1,4,102,108,111,97,116,95, +114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,118,0,59,120,0,0,0,4,102,108,111,97, +116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,118,0,59,121,0,0,0,4,102,108, +111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,118,0,59,122,0,0,0,0,1, +90,95,0,0,12,0,0,105,110,118,101,114,115,101,115,113,114,116,0,1,1,0,0,12,0,118,0,0,0,1,4,102,108, +111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,120,0,0,18,118,0,59,120,0,0,0,4, +102,108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,121,0,0,18,118,0,59,121,0, +0,0,4,102,108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,122,0,0,18,118,0,59, +122,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,95,95,114,101,116,86,97,108,0,59,119,0,0,18,118, +0,59,119,0,0,0,0,1,90,95,0,0,9,0,0,110,111,114,109,97,108,105,122,101,0,1,1,0,0,9,0,120,0,0,0,1,9, +18,95,95,114,101,116,86,97,108,0,17,49,0,48,0,0,20,0,0,1,90,95,0,0,10,0,0,110,111,114,109,97,108, +105,122,101,0,1,1,0,0,10,0,118,0,0,0,1,3,2,90,95,1,0,9,0,1,115,0,2,58,105,110,118,101,114,115,101, +115,113,114,116,0,0,58,100,111,116,0,0,18,118,0,0,18,118,0,0,0,0,0,0,0,4,118,101,99,52,95,109,117, +108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,0,0,18,118,0,0,18,115,0,0,0, +0,1,90,95,0,0,11,0,0,110,111,114,109,97,108,105,122,101,0,1,1,0,0,11,0,118,0,0,0,1,3,2,90,95,0,0,9, +0,1,116,109,112,0,0,0,4,118,101,99,51,95,100,111,116,0,18,116,109,112,0,0,18,118,0,0,18,118,0,0,0, +4,102,108,111,97,116,95,114,115,113,0,18,116,109,112,0,0,18,116,109,112,0,0,0,4,118,101,99,52,95, +109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,118,0,0, +18,116,109,112,0,0,0,0,1,90,95,0,0,12,0,0,110,111,114,109,97,108,105,122,101,0,1,1,0,0,12,0,118,0, +0,0,1,3,2,90,95,0,0,9,0,1,116,109,112,0,0,0,4,118,101,99,52,95,100,111,116,0,18,116,109,112,0,0,18, +118,0,0,18,118,0,0,0,4,102,108,111,97,116,95,114,115,113,0,18,116,109,112,0,0,18,116,109,112,0,0,0, +4,118,101,99,52,95,109,117,108,116,105,112,108,121,0,18,95,95,114,101,116,86,97,108,0,59,120,121, +122,0,0,18,118,0,0,18,116,109,112,0,0,0,0,1,90,95,0,0,9,0,0,97,98,115,0,1,1,0,0,9,0,97,0,0,0,1,4, +118,101,99,52,95,97,98,115,0,18,95,95,114,101,116,86,97,108,0,0,18,97,0,0,0,0,1,90,95,0,0,10,0,0, 97,98,115,0,1,1,0,0,10,0,97,0,0,0,1,4,118,101,99,52,95,97,98,115,0,18,95,95,114,101,116,86,97,108, 0,59,120,121,0,0,18,97,0,0,0,0,1,90,95,0,0,11,0,0,97,98,115,0,1,1,0,0,11,0,97,0,0,0,1,4,118,101,99, 52,95,97,98,115,0,18,95,95,114,101,116,86,97,108,0,59,120,121,122,0,0,18,97,0,0,0,0,1,90,95,0,0,12, -- cgit v1.2.3 From dd81cc885c3d0619921a7de7e00618e412c05697 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 30 Sep 2009 11:32:36 +0800 Subject: st/egl: Fix a crash when unbinding current context. This fixes a NULL-pointer dereference when eglMakeCurrent(dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT) is called. Signed-off-by: Chia-I Wu --- src/gallium/state_trackers/egl/egl_context.c | 6 ------ src/gallium/state_trackers/egl/egl_surface.c | 11 ++++------- src/gallium/state_trackers/egl/egl_tracker.h | 1 - 3 files changed, 4 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/egl/egl_context.c b/src/gallium/state_trackers/egl/egl_context.c index c4f7361ca0..288186ad72 100644 --- a/src/gallium/state_trackers/egl/egl_context.c +++ b/src/gallium/state_trackers/egl/egl_context.c @@ -160,18 +160,12 @@ drm_make_current(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw, _EGLSurfa if (!drawSurf || !readSurf) return EGL_FALSE; - drawSurf->user = ctx; - readSurf->user = ctx; - st_make_current(ctx->st, drawSurf->stfb, readSurf->stfb); /* st_resize_framebuffer needs a bound context to work */ st_resize_framebuffer(drawSurf->stfb, drawSurf->w, drawSurf->h); st_resize_framebuffer(readSurf->stfb, readSurf->w, readSurf->h); } else { - drawSurf->user = NULL; - readSurf->user = NULL; - st_make_current(NULL, NULL, NULL); } diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c index 542ac56121..7911a8834e 100644 --- a/src/gallium/state_trackers/egl/egl_surface.c +++ b/src/gallium/state_trackers/egl/egl_surface.c @@ -352,24 +352,21 @@ drm_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw) if (!surf) return EGL_FALSE; - /* error checking */ - if (!_eglSwapBuffers(drv, dpy, draw)) - return EGL_FALSE; - st_get_framebuffer_surface(surf->stfb, ST_SURFACE_BACK_LEFT, &back_surf); if (back_surf) { + struct drm_context *ctx = lookup_drm_context(draw->Binding); st_notify_swapbuffers(surf->stfb); - if (surf->screen) { - surf->user->pipe->surface_copy(surf->user->pipe, + if (ctx && surf->screen) { + ctx->pipe->surface_copy(ctx->pipe, surf->screen->surface, 0, 0, back_surf, 0, 0, surf->w, surf->h); - surf->user->pipe->flush(surf->user->pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE, NULL); + ctx->pipe->flush(ctx->pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE, NULL); #ifdef DRM_MODE_FEATURE_DIRTYFB /* TODO query connector property to see if this is needed */ diff --git a/src/gallium/state_trackers/egl/egl_tracker.h b/src/gallium/state_trackers/egl/egl_tracker.h index f280748d65..73eb1a1226 100644 --- a/src/gallium/state_trackers/egl/egl_tracker.h +++ b/src/gallium/state_trackers/egl/egl_tracker.h @@ -69,7 +69,6 @@ struct drm_surface * drm */ - struct drm_context *user; struct drm_screen *screen; int w; -- cgit v1.2.3 From 4b95481e951424e24c9ab817998ae50b54ab9f84 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 30 Sep 2009 11:36:01 +0800 Subject: st/egl: Fix a double free in drm_destroy_context. st_destroy_context has destroyed the pipe context for us. Signed-off-by: Chia-I Wu --- src/gallium/state_trackers/egl/egl_context.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/egl/egl_context.c b/src/gallium/state_trackers/egl/egl_context.c index 288186ad72..e21a4a1095 100644 --- a/src/gallium/state_trackers/egl/egl_context.c +++ b/src/gallium/state_trackers/egl/egl_context.c @@ -138,7 +138,6 @@ drm_destroy_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *context) struct drm_context *c = lookup_drm_context(context); if (!_eglIsContextBound(&c->base)) { st_destroy_context(c->st); - c->pipe->destroy(c->pipe); free(c); } return EGL_TRUE; -- cgit v1.2.3 From a833ff0f53da6e365d917bb0081d909a809b6ec1 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 7 Sep 2009 17:51:42 +0800 Subject: mesa/main: Make FEATURE_accum follow feature conventions. As shown in mfeatures.h, this allows users of accum.h to work without knowing if the feature is available. --- src/mesa/main/accum.c | 16 +++++++++++++++- src/mesa/main/accum.h | 39 +++++++++++++++++++++++++++------------ src/mesa/main/api_exec.c | 9 +++------ src/mesa/main/context.c | 4 ---- 4 files changed, 45 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c index 2345695f3c..032e13b96e 100644 --- a/src/mesa/main/accum.c +++ b/src/mesa/main/accum.c @@ -29,6 +29,10 @@ #include "macros.h" #include "state.h" #include "mtypes.h" +#include "glapi/dispatch.h" + + +#if FEATURE_accum void GLAPIENTRY @@ -51,7 +55,7 @@ _mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_Accum( GLenum op, GLfloat value ) { GET_CURRENT_CONTEXT(ctx); @@ -99,6 +103,16 @@ _mesa_Accum( GLenum op, GLfloat value ) } +void +_mesa_init_accum_dispatch(struct _glapi_table *disp) +{ + SET_Accum(disp, _mesa_Accum); + SET_ClearAccum(disp, _mesa_ClearAccum); +} + + +#endif /* FEATURE_accum */ + void _mesa_init_accum( GLcontext *ctx ) diff --git a/src/mesa/main/accum.h b/src/mesa/main/accum.h index ce92688a5b..63740f07ed 100644 --- a/src/mesa/main/accum.h +++ b/src/mesa/main/accum.h @@ -38,25 +38,40 @@ #define ACCUM_H -#include "mtypes.h" +#include "main/mtypes.h" -#if _HAVE_FULL_GL - -extern void GLAPIENTRY -_mesa_Accum( GLenum op, GLfloat value ); +#if FEATURE_accum +#define _MESA_INIT_ACCUM_FUNCTIONS(driver, impl) \ + do { \ + (driver)->Accum = impl ## Accum; \ + } while (0) extern void GLAPIENTRY _mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ); -extern void -_mesa_init_accum( GLcontext *ctx ); +extern void +_mesa_init_accum_dispatch(struct _glapi_table *disp); + +#else /* FEATURE_accum */ -#else +#define _MESA_INIT_ACCUM_FUNCTIONS(driver, impl) do { } while (0) -/** No-op */ -#define _mesa_init_accum( c ) ((void)0) +static INLINE void +_mesa_ClearAccum( GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha ) +{ + /* this is used in _mesa_PopAttrib */ + ASSERT_NO_FEATURE(); +} -#endif +static INLINE void +_mesa_init_accum_dispatch(struct _glapi_table *disp) +{ +} + +#endif /* FEATURE_accum */ + +extern void +_mesa_init_accum( GLcontext *ctx ); -#endif +#endif /* ACCUM_H */ diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 6317639075..9ffac7905a 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -30,9 +30,7 @@ #include "mfeatures.h" -#if FEATURE_accum #include "accum.h" -#endif #include "api_loopback.h" #include "api_exec.h" #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program @@ -193,10 +191,9 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_TexParameteri(exec, _mesa_TexParameteri); SET_Translatef(exec, _mesa_Translatef); SET_Viewport(exec, _mesa_Viewport); -#if FEATURE_accum - SET_Accum(exec, _mesa_Accum); - SET_ClearAccum(exec, _mesa_ClearAccum); -#endif + + _mesa_init_accum_dispatch(exec); + #if FEATURE_dlist SET_CallList(exec, _mesa_CallList); SET_CallLists(exec, _mesa_CallLists); diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 1907c799df..df194c3edb 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -79,9 +79,7 @@ #include "glheader.h" #include "mfeatures.h" #include "imports.h" -#if FEATURE_accum #include "accum.h" -#endif #include "api_exec.h" #include "arrayobj.h" #if FEATURE_attrib_stack @@ -676,9 +674,7 @@ init_attrib_groups(GLcontext *ctx) _mesa_init_extensions( ctx ); /* Attribute Groups */ -#if FEATURE_accum _mesa_init_accum( ctx ); -#endif #if FEATURE_attrib_stack _mesa_init_attrib( ctx ); #endif -- cgit v1.2.3 From 2b36db496d34c60a3f987fa88d52bf5684713240 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 7 Sep 2009 18:20:10 +0800 Subject: mesa/main: Make FEATURE_attrib_stack follow feature conventions. As shown in mfeatures.h, this allows users of attrib.h to work without knowing if the feature is available. --- src/mesa/main/api_exec.c | 11 +++-------- src/mesa/main/attrib.c | 17 +++++++++++++++++ src/mesa/main/attrib.h | 38 +++++++++++++++++++++++++++----------- src/mesa/main/context.c | 6 ------ 4 files changed, 47 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 9ffac7905a..b363d4340e 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -39,9 +39,7 @@ #if FEATURE_ATI_fragment_shader #include "shader/atifragshader.h" #endif -#if FEATURE_attrib_stack #include "attrib.h" -#endif #include "blend.h" #if FEATURE_ARB_vertex_buffer_object #include "bufferobj.h" @@ -283,12 +281,9 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_PolygonMode(exec, _mesa_PolygonMode); SET_PolygonOffset(exec, _mesa_PolygonOffset); SET_PolygonStipple(exec, _mesa_PolygonStipple); -#if FEATURE_attrib_stack - SET_PopAttrib(exec, _mesa_PopAttrib); - SET_PushAttrib(exec, _mesa_PushAttrib); - SET_PopClientAttrib(exec, _mesa_PopClientAttrib); - SET_PushClientAttrib(exec, _mesa_PushClientAttrib); -#endif + + _mesa_init_attrib_dispatch(exec); + #if FEATURE_drawpix SET_RasterPos2f(exec, _mesa_RasterPos2f); SET_RasterPos2fv(exec, _mesa_RasterPos2fv); diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 0fb8fa3bba..246c5521b7 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -57,6 +57,7 @@ #include "varray.h" #include "viewport.h" #include "mtypes.h" +#include "glapi/dispatch.h" /** @@ -174,6 +175,9 @@ struct texture_state }; +#if FEATURE_attrib_stack + + /** * Allocate new attribute node of given type/kind. Attach payload data. * Insert it into the linked list named by 'head'. @@ -1464,6 +1468,19 @@ _mesa_PopClientAttrib(void) } +void +_mesa_init_attrib_dispatch(struct _glapi_table *disp) +{ + SET_PopAttrib(disp, _mesa_PopAttrib); + SET_PushAttrib(disp, _mesa_PushAttrib); + SET_PopClientAttrib(disp, _mesa_PopClientAttrib); + SET_PushClientAttrib(disp, _mesa_PushClientAttrib); +} + + +#endif /* FEATURE_attrib_stack */ + + /** * Free any attribute state data that might be attached to the context. */ diff --git a/src/mesa/main/attrib.h b/src/mesa/main/attrib.h index 2cf8fe6934..6b48a17663 100644 --- a/src/mesa/main/attrib.h +++ b/src/mesa/main/attrib.h @@ -26,10 +26,10 @@ #define ATTRIB_H -#include "mtypes.h" +#include "main/mtypes.h" -#if _HAVE_FULL_GL +#if FEATURE_attrib_stack extern void GLAPIENTRY _mesa_PushAttrib( GLbitfield mask ); @@ -43,18 +43,34 @@ _mesa_PushClientAttrib( GLbitfield mask ); extern void GLAPIENTRY _mesa_PopClientAttrib( void ); +extern void +_mesa_init_attrib_dispatch(struct _glapi_table *disp); + +#else /* FEATURE_attrib_stack */ + +static INLINE void +_mesa_PushClientAttrib( GLbitfield mask ) +{ + ASSERT_NO_FEATURE(); +} + +static INLINE void +_mesa_PopClientAttrib( void ) +{ + ASSERT_NO_FEATURE(); +} + +static INLINE void +_mesa_init_attrib_dispatch(struct _glapi_table *disp) +{ +} + +#endif /* FEATURE_attrib_stack */ + extern void _mesa_init_attrib( GLcontext *ctx ); extern void _mesa_free_attrib_data( GLcontext *ctx ); -#else - -/** No-op */ -#define _mesa_init_attrib( c ) ((void)0) -#define _mesa_free_attrib_data( c ) ((void)0) - -#endif - -#endif +#endif /* ATTRIB_H */ diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index df194c3edb..53a21ba4f5 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -82,9 +82,7 @@ #include "accum.h" #include "api_exec.h" #include "arrayobj.h" -#if FEATURE_attrib_stack #include "attrib.h" -#endif #include "blend.h" #include "buffers.h" #include "bufferobj.h" @@ -675,9 +673,7 @@ init_attrib_groups(GLcontext *ctx) /* Attribute Groups */ _mesa_init_accum( ctx ); -#if FEATURE_attrib_stack _mesa_init_attrib( ctx ); -#endif _mesa_init_buffer_objects( ctx ); _mesa_init_color( ctx ); _mesa_init_colortables( ctx ); @@ -997,9 +993,7 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._Current, NULL); _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL); -#if FEATURE_attrib_stack _mesa_free_attrib_data(ctx); -#endif _mesa_free_lighting_data( ctx ); #if FEATURE_evaluators _mesa_free_eval_data( ctx ); -- cgit v1.2.3 From cab7ea03688ec73dd71c0b969f2db30cabeb713c Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 7 Sep 2009 18:06:00 +0800 Subject: mesa/main: Make FEATURE_histogram follow feature conventions. As shown in mfeatures.h, this allows users of histogram.h to work without knowing if the feature is available. --- src/mesa/main/api_exec.c | 15 +-------------- src/mesa/main/context.c | 4 ---- src/mesa/main/histogram.c | 45 ++++++++++++++++++++++++++++++++++---------- src/mesa/main/histogram.h | 48 +++++++++++------------------------------------ 4 files changed, 47 insertions(+), 65 deletions(-) (limited to 'src') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index b363d4340e..6b529db5ec 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -76,9 +76,7 @@ #include "ffvertex_prog.h" #include "framebuffer.h" #include "hint.h" -#if FEATURE_histogram #include "histogram.h" -#endif #include "imports.h" #include "light.h" #include "lines.h" @@ -375,18 +373,7 @@ _mesa_init_exec_table(struct _glapi_table *exec) _mesa_init_colortable_dispatch(exec); _mesa_init_convolve_dispatch(exec); -#if FEATURE_histogram - SET_GetHistogram(exec, _mesa_GetHistogram); - SET_GetHistogramParameterfv(exec, _mesa_GetHistogramParameterfv); - SET_GetHistogramParameteriv(exec, _mesa_GetHistogramParameteriv); - SET_GetMinmax(exec, _mesa_GetMinmax); - SET_GetMinmaxParameterfv(exec, _mesa_GetMinmaxParameterfv); - SET_GetMinmaxParameteriv(exec, _mesa_GetMinmaxParameteriv); - SET_Histogram(exec, _mesa_Histogram); - SET_Minmax(exec, _mesa_Minmax); - SET_ResetHistogram(exec, _mesa_ResetHistogram); - SET_ResetMinmax(exec, _mesa_ResetMinmax); -#endif + _mesa_init_histogram_dispatch(exec); /* OpenGL 2.0 */ SET_StencilFuncSeparate(exec, _mesa_StencilFuncSeparate); diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 53a21ba4f5..a546e37b5f 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -106,9 +106,7 @@ #include "fog.h" #include "framebuffer.h" #include "get.h" -#if FEATURE_histogram #include "histogram.h" -#endif #include "hint.h" #include "hash.h" #include "light.h" @@ -693,9 +691,7 @@ init_attrib_groups(GLcontext *ctx) ctx->RenderMode = GL_RENDER; #endif _mesa_init_fog( ctx ); -#if FEATURE_histogram _mesa_init_histogram( ctx ); -#endif _mesa_init_hint( ctx ); _mesa_init_line( ctx ); _mesa_init_lighting( ctx ); diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c index ceb0d5a6a8..87816d3132 100644 --- a/src/mesa/main/histogram.c +++ b/src/mesa/main/histogram.c @@ -29,8 +29,11 @@ #include "context.h" #include "image.h" #include "histogram.h" +#include "glapi/dispatch.h" +#if FEATURE_histogram + /* * XXX the packed pixel formats haven't been tested. @@ -614,7 +617,11 @@ base_histogram_format( GLenum format ) */ -void GLAPIENTRY +/* this is defined below */ +static void GLAPIENTRY _mesa_ResetMinmax(GLenum target); + + +static void GLAPIENTRY _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) { GET_CURRENT_CONTEXT(ctx); @@ -677,7 +684,7 @@ _mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvo } -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values) { GET_CURRENT_CONTEXT(ctx); @@ -737,7 +744,7 @@ _mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, G } -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); @@ -784,7 +791,7 @@ _mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); @@ -831,7 +838,7 @@ _mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) { GET_CURRENT_CONTEXT(ctx); @@ -857,7 +864,7 @@ _mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) { GET_CURRENT_CONTEXT(ctx); @@ -883,7 +890,7 @@ _mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean sink) { GLuint i; @@ -966,7 +973,7 @@ _mesa_Histogram(GLenum target, GLsizei width, GLenum internalFormat, GLboolean s } -void GLAPIENTRY +static void GLAPIENTRY _mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) { GET_CURRENT_CONTEXT(ctx); @@ -994,7 +1001,7 @@ _mesa_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_ResetHistogram(GLenum target) { GLuint i; @@ -1020,7 +1027,7 @@ _mesa_ResetHistogram(GLenum target) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_ResetMinmax(GLenum target) { GET_CURRENT_CONTEXT(ctx); @@ -1043,6 +1050,24 @@ _mesa_ResetMinmax(GLenum target) } +void +_mesa_init_histogram_dispatch(struct _glapi_table *disp) +{ + SET_GetHistogram(disp, _mesa_GetHistogram); + SET_GetHistogramParameterfv(disp, _mesa_GetHistogramParameterfv); + SET_GetHistogramParameteriv(disp, _mesa_GetHistogramParameteriv); + SET_GetMinmax(disp, _mesa_GetMinmax); + SET_GetMinmaxParameterfv(disp, _mesa_GetMinmaxParameterfv); + SET_GetMinmaxParameteriv(disp, _mesa_GetMinmaxParameteriv); + SET_Histogram(disp, _mesa_Histogram); + SET_Minmax(disp, _mesa_Minmax); + SET_ResetHistogram(disp, _mesa_ResetHistogram); + SET_ResetMinmax(disp, _mesa_ResetMinmax); +} + + +#endif /* FEATURE_histogram */ + /**********************************************************************/ /***** Initialization *****/ diff --git a/src/mesa/main/histogram.h b/src/mesa/main/histogram.h index 367e9b11ba..dbae1bbd06 100644 --- a/src/mesa/main/histogram.h +++ b/src/mesa/main/histogram.h @@ -36,48 +36,22 @@ #ifndef HISTOGRAM_H #define HISTOGRAM_H -#include "glheader.h" -#include "mtypes.h" +#include "main/mtypes.h" -#if _HAVE_FULL_GL +#if FEATURE_histogram -extern void GLAPIENTRY -_mesa_GetMinmax(GLenum target, GLboolean reset, GLenum format, GLenum types, GLvoid *values); +extern void +_mesa_init_histogram_dispatch(struct _glapi_table *disp); -extern void GLAPIENTRY -_mesa_GetHistogram(GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values); +#else /* FEATURE_histogram */ -extern void GLAPIENTRY -_mesa_GetHistogramParameterfv(GLenum target, GLenum pname, GLfloat *params); +static INLINE void +_mesa_init_histogram_dispatch(struct _glapi_table *disp) +{ +} -extern void GLAPIENTRY -_mesa_GetHistogramParameteriv(GLenum target, GLenum pname, GLint *params); - -extern void GLAPIENTRY -_mesa_GetMinmaxParameterfv(GLenum target, GLenum pname, GLfloat *params); - -extern void GLAPIENTRY -_mesa_GetMinmaxParameteriv(GLenum target, GLenum pname, GLint *params); - -extern void GLAPIENTRY -_mesa_Histogram(GLenum target, GLsizei width, GLenum internalformat, GLboolean sink); - -extern void GLAPIENTRY -_mesa_Minmax(GLenum target, GLenum internalformat, GLboolean sink); - -extern void GLAPIENTRY -_mesa_ResetHistogram(GLenum target); - -extern void GLAPIENTRY -_mesa_ResetMinmax(GLenum target); +#endif /* FEATURE_histogram */ extern void _mesa_init_histogram( GLcontext * ctx ); -#else - -/** No-op */ -#define _mesa_init_histogram( c ) ((void) 0) - -#endif - -#endif +#endif /* HISTOGRAM_H */ -- cgit v1.2.3 From d25080074f2da1ebc47cdfb5c3491740a57ec03f Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 8 Sep 2009 10:05:36 +0800 Subject: mesa/main: New feature FEATURE_rastpos. It is separated from FEATURE_drawpix and made to follow the feature conventions. --- src/mesa/main/api_exec.c | 56 +--------------- src/mesa/main/context.c | 4 -- src/mesa/main/mfeatures.h | 2 +- src/mesa/main/rastpos.c | 162 +++++++++++++++++++++++++++++++-------------- src/mesa/main/rastpos.h | 163 +++++----------------------------------------- 5 files changed, 133 insertions(+), 254 deletions(-) (limited to 'src') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 6b529db5ec..8de0691851 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -59,8 +59,8 @@ #endif #if FEATURE_drawpix #include "drawpix.h" -#include "rastpos.h" #endif +#include "rastpos.h" #include "enable.h" #if FEATURE_evaluators #include "eval.h" @@ -281,33 +281,8 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_PolygonStipple(exec, _mesa_PolygonStipple); _mesa_init_attrib_dispatch(exec); + _mesa_init_rastpos_dispatch(exec); -#if FEATURE_drawpix - SET_RasterPos2f(exec, _mesa_RasterPos2f); - SET_RasterPos2fv(exec, _mesa_RasterPos2fv); - SET_RasterPos2i(exec, _mesa_RasterPos2i); - SET_RasterPos2iv(exec, _mesa_RasterPos2iv); - SET_RasterPos2d(exec, _mesa_RasterPos2d); - SET_RasterPos2dv(exec, _mesa_RasterPos2dv); - SET_RasterPos2s(exec, _mesa_RasterPos2s); - SET_RasterPos2sv(exec, _mesa_RasterPos2sv); - SET_RasterPos3d(exec, _mesa_RasterPos3d); - SET_RasterPos3dv(exec, _mesa_RasterPos3dv); - SET_RasterPos3f(exec, _mesa_RasterPos3f); - SET_RasterPos3fv(exec, _mesa_RasterPos3fv); - SET_RasterPos3i(exec, _mesa_RasterPos3i); - SET_RasterPos3iv(exec, _mesa_RasterPos3iv); - SET_RasterPos3s(exec, _mesa_RasterPos3s); - SET_RasterPos3sv(exec, _mesa_RasterPos3sv); - SET_RasterPos4d(exec, _mesa_RasterPos4d); - SET_RasterPos4dv(exec, _mesa_RasterPos4dv); - SET_RasterPos4f(exec, _mesa_RasterPos4f); - SET_RasterPos4fv(exec, _mesa_RasterPos4fv); - SET_RasterPos4i(exec, _mesa_RasterPos4i); - SET_RasterPos4iv(exec, _mesa_RasterPos4iv); - SET_RasterPos4s(exec, _mesa_RasterPos4s); - SET_RasterPos4sv(exec, _mesa_RasterPos4sv); -#endif SET_ReadPixels(exec, _mesa_ReadPixels); SET_Rotated(exec, _mesa_Rotated); SET_Scaled(exec, _mesa_Scaled); @@ -485,32 +460,7 @@ _mesa_init_exec_table(struct _glapi_table *exec) #endif /* 197. GL_MESA_window_pos */ -#if FEATURE_drawpix - SET_WindowPos2dMESA(exec, _mesa_WindowPos2dMESA); - SET_WindowPos2dvMESA(exec, _mesa_WindowPos2dvMESA); - SET_WindowPos2fMESA(exec, _mesa_WindowPos2fMESA); - SET_WindowPos2fvMESA(exec, _mesa_WindowPos2fvMESA); - SET_WindowPos2iMESA(exec, _mesa_WindowPos2iMESA); - SET_WindowPos2ivMESA(exec, _mesa_WindowPos2ivMESA); - SET_WindowPos2sMESA(exec, _mesa_WindowPos2sMESA); - SET_WindowPos2svMESA(exec, _mesa_WindowPos2svMESA); - SET_WindowPos3dMESA(exec, _mesa_WindowPos3dMESA); - SET_WindowPos3dvMESA(exec, _mesa_WindowPos3dvMESA); - SET_WindowPos3fMESA(exec, _mesa_WindowPos3fMESA); - SET_WindowPos3fvMESA(exec, _mesa_WindowPos3fvMESA); - SET_WindowPos3iMESA(exec, _mesa_WindowPos3iMESA); - SET_WindowPos3ivMESA(exec, _mesa_WindowPos3ivMESA); - SET_WindowPos3sMESA(exec, _mesa_WindowPos3sMESA); - SET_WindowPos3svMESA(exec, _mesa_WindowPos3svMESA); - SET_WindowPos4dMESA(exec, _mesa_WindowPos4dMESA); - SET_WindowPos4dvMESA(exec, _mesa_WindowPos4dvMESA); - SET_WindowPos4fMESA(exec, _mesa_WindowPos4fMESA); - SET_WindowPos4fvMESA(exec, _mesa_WindowPos4fvMESA); - SET_WindowPos4iMESA(exec, _mesa_WindowPos4iMESA); - SET_WindowPos4ivMESA(exec, _mesa_WindowPos4ivMESA); - SET_WindowPos4sMESA(exec, _mesa_WindowPos4sMESA); - SET_WindowPos4svMESA(exec, _mesa_WindowPos4svMESA); -#endif + /* part of _mesa_init_rastpos_dispatch(exec); */ /* 200. GL_IBM_multimode_draw_arrays */ #if _HAVE_FULL_GL diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index a546e37b5f..cd8fe0df8f 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -124,9 +124,7 @@ #if FEATURE_ARB_sync #include "syncobj.h" #endif -#if FEATURE_drawpix #include "rastpos.h" -#endif #include "scissor.h" #include "shared.h" #include "simple_list.h" @@ -708,9 +706,7 @@ init_attrib_groups(GLcontext *ctx) #if FEATURE_ARB_sync _mesa_init_sync( ctx ); #endif -#if FEATURE_drawpix _mesa_init_rastpos( ctx ); -#endif _mesa_init_scissor( ctx ); _mesa_init_shader_state( ctx ); _mesa_init_stencil( ctx ); diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index 6318934c6b..d3491b1d42 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -82,12 +82,12 @@ #define FEATURE_histogram _HAVE_FULL_GL #define FEATURE_pixel_transfer _HAVE_FULL_GL #define FEATURE_point_size_array 0 +#define FEATURE_rastpos _HAVE_FULL_GL #define FEATURE_texgen _HAVE_FULL_GL #define FEATURE_texture_fxt1 _HAVE_FULL_GL #define FEATURE_texture_s3tc _HAVE_FULL_GL #define FEATURE_userclip _HAVE_FULL_GL #define FEATURE_vertex_array_byte 0 -#define FEATURE_windowpos _HAVE_FULL_GL #define FEATURE_es2_glsl 0 #define FEATURE_ARB_occlusion_query _HAVE_FULL_GL diff --git a/src/mesa/main/rastpos.c b/src/mesa/main/rastpos.c index 9f309d6ab8..703b47ec74 100644 --- a/src/mesa/main/rastpos.c +++ b/src/mesa/main/rastpos.c @@ -34,6 +34,10 @@ #include "macros.h" #include "rastpos.h" #include "state.h" +#include "glapi/dispatch.h" + + +#if FEATURE_rastpos /** @@ -60,147 +64,147 @@ rasterpos(GLfloat x, GLfloat y, GLfloat z, GLfloat w) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos2d(GLdouble x, GLdouble y) { rasterpos((GLfloat)x, (GLfloat)y, (GLfloat)0.0, (GLfloat)1.0); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos2f(GLfloat x, GLfloat y) { rasterpos(x, y, 0.0F, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos2i(GLint x, GLint y) { rasterpos((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos2s(GLshort x, GLshort y) { rasterpos(x, y, 0.0F, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z) { rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z) { rasterpos(x, y, z, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos3i(GLint x, GLint y, GLint z) { rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos3s(GLshort x, GLshort y, GLshort z) { rasterpos(x, y, z, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { rasterpos(x, y, z, w); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w) { rasterpos((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w) { rasterpos(x, y, z, w); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos2dv(const GLdouble *v) { rasterpos((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos2fv(const GLfloat *v) { rasterpos(v[0], v[1], 0.0F, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos2iv(const GLint *v) { rasterpos((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos2sv(const GLshort *v) { rasterpos(v[0], v[1], 0.0F, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos3dv(const GLdouble *v) { rasterpos((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos3fv(const GLfloat *v) { rasterpos(v[0], v[1], v[2], 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos3iv(const GLint *v) { rasterpos((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos3sv(const GLshort *v) { rasterpos(v[0], v[1], v[2], 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos4dv(const GLdouble *v) { rasterpos((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos4fv(const GLfloat *v) { rasterpos(v[0], v[1], v[2], v[3]); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos4iv(const GLint *v) { rasterpos((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_RasterPos4sv(const GLshort *v) { rasterpos(v[0], v[1], v[2], v[3]); @@ -211,7 +215,7 @@ _mesa_RasterPos4sv(const GLshort *v) /*** GL_ARB_window_pos / GL_MESA_window_pos ***/ /**********************************************************************/ -#if FEATURE_drawpix + /** * All glWindowPosMESA and glWindowPosARB commands call this function to * update the current raster position. @@ -290,153 +294,152 @@ window_pos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos2dMESA(GLdouble x, GLdouble y) { window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos2fMESA(GLfloat x, GLfloat y) { window_pos4f(x, y, 0.0F, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos2iMESA(GLint x, GLint y) { window_pos4f((GLfloat) x, (GLfloat) y, 0.0F, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos2sMESA(GLshort x, GLshort y) { window_pos4f(x, y, 0.0F, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z) { window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z) { window_pos4f(x, y, z, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos3iMESA(GLint x, GLint y, GLint z) { window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z) { window_pos4f(x, y, z, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w) { window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { window_pos4f(x, y, z, w); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w) { window_pos4f((GLfloat) x, (GLfloat) y, (GLfloat) z, (GLfloat) w); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w) { window_pos4f(x, y, z, w); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos2dvMESA(const GLdouble *v) { window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos2fvMESA(const GLfloat *v) { window_pos4f(v[0], v[1], 0.0F, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos2ivMESA(const GLint *v) { window_pos4f((GLfloat) v[0], (GLfloat) v[1], 0.0F, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos2svMESA(const GLshort *v) { window_pos4f(v[0], v[1], 0.0F, 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos3dvMESA(const GLdouble *v) { window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos3fvMESA(const GLfloat *v) { window_pos4f(v[0], v[1], v[2], 1.0); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos3ivMESA(const GLint *v) { window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos3svMESA(const GLshort *v) { window_pos4f(v[0], v[1], v[2], 1.0F); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos4dvMESA(const GLdouble *v) { window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos4fvMESA(const GLfloat *v) { window_pos4f(v[0], v[1], v[2], v[3]); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos4ivMESA(const GLint *v) { window_pos4f((GLfloat) v[0], (GLfloat) v[1], (GLfloat) v[2], (GLfloat) v[3]); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_WindowPos4svMESA(const GLshort *v) { window_pos4f(v[0], v[1], v[2], v[3]); } -#endif #if 0 @@ -477,6 +480,65 @@ void glWindowPos4fMESA( GLfloat x, GLfloat y, GLfloat z, GLfloat w ) #endif +void +_mesa_init_rastpos_dispatch(struct _glapi_table *disp) +{ + SET_RasterPos2f(disp, _mesa_RasterPos2f); + SET_RasterPos2fv(disp, _mesa_RasterPos2fv); + SET_RasterPos2i(disp, _mesa_RasterPos2i); + SET_RasterPos2iv(disp, _mesa_RasterPos2iv); + SET_RasterPos2d(disp, _mesa_RasterPos2d); + SET_RasterPos2dv(disp, _mesa_RasterPos2dv); + SET_RasterPos2s(disp, _mesa_RasterPos2s); + SET_RasterPos2sv(disp, _mesa_RasterPos2sv); + SET_RasterPos3d(disp, _mesa_RasterPos3d); + SET_RasterPos3dv(disp, _mesa_RasterPos3dv); + SET_RasterPos3f(disp, _mesa_RasterPos3f); + SET_RasterPos3fv(disp, _mesa_RasterPos3fv); + SET_RasterPos3i(disp, _mesa_RasterPos3i); + SET_RasterPos3iv(disp, _mesa_RasterPos3iv); + SET_RasterPos3s(disp, _mesa_RasterPos3s); + SET_RasterPos3sv(disp, _mesa_RasterPos3sv); + SET_RasterPos4d(disp, _mesa_RasterPos4d); + SET_RasterPos4dv(disp, _mesa_RasterPos4dv); + SET_RasterPos4f(disp, _mesa_RasterPos4f); + SET_RasterPos4fv(disp, _mesa_RasterPos4fv); + SET_RasterPos4i(disp, _mesa_RasterPos4i); + SET_RasterPos4iv(disp, _mesa_RasterPos4iv); + SET_RasterPos4s(disp, _mesa_RasterPos4s); + SET_RasterPos4sv(disp, _mesa_RasterPos4sv); + + /* 197. GL_MESA_window_pos */ + SET_WindowPos2dMESA(disp, _mesa_WindowPos2dMESA); + SET_WindowPos2dvMESA(disp, _mesa_WindowPos2dvMESA); + SET_WindowPos2fMESA(disp, _mesa_WindowPos2fMESA); + SET_WindowPos2fvMESA(disp, _mesa_WindowPos2fvMESA); + SET_WindowPos2iMESA(disp, _mesa_WindowPos2iMESA); + SET_WindowPos2ivMESA(disp, _mesa_WindowPos2ivMESA); + SET_WindowPos2sMESA(disp, _mesa_WindowPos2sMESA); + SET_WindowPos2svMESA(disp, _mesa_WindowPos2svMESA); + SET_WindowPos3dMESA(disp, _mesa_WindowPos3dMESA); + SET_WindowPos3dvMESA(disp, _mesa_WindowPos3dvMESA); + SET_WindowPos3fMESA(disp, _mesa_WindowPos3fMESA); + SET_WindowPos3fvMESA(disp, _mesa_WindowPos3fvMESA); + SET_WindowPos3iMESA(disp, _mesa_WindowPos3iMESA); + SET_WindowPos3ivMESA(disp, _mesa_WindowPos3ivMESA); + SET_WindowPos3sMESA(disp, _mesa_WindowPos3sMESA); + SET_WindowPos3svMESA(disp, _mesa_WindowPos3svMESA); + SET_WindowPos4dMESA(disp, _mesa_WindowPos4dMESA); + SET_WindowPos4dvMESA(disp, _mesa_WindowPos4dvMESA); + SET_WindowPos4fMESA(disp, _mesa_WindowPos4fMESA); + SET_WindowPos4fvMESA(disp, _mesa_WindowPos4fvMESA); + SET_WindowPos4iMESA(disp, _mesa_WindowPos4iMESA); + SET_WindowPos4ivMESA(disp, _mesa_WindowPos4ivMESA); + SET_WindowPos4sMESA(disp, _mesa_WindowPos4sMESA); + SET_WindowPos4svMESA(disp, _mesa_WindowPos4svMESA); +} + + +#endif /* FEATURE_rastpos */ + + /**********************************************************************/ /** \name Initialization */ /**********************************************************************/ diff --git a/src/mesa/main/rastpos.h b/src/mesa/main/rastpos.h index 363f86ad87..b2127225b6 100644 --- a/src/mesa/main/rastpos.h +++ b/src/mesa/main/rastpos.h @@ -32,162 +32,33 @@ #define RASTPOS_H -#include "glheader.h" +#include "main/mtypes.h" -extern void GLAPIENTRY -_mesa_RasterPos2d(GLdouble x, GLdouble y); +#if FEATURE_rastpos -extern void GLAPIENTRY -_mesa_RasterPos2f(GLfloat x, GLfloat y); +#define _MESA_INIT_RASTPOS_FUNCTIONS(driver, impl) \ + do { \ + (driver)->RasterPos = impl ## RasterPos; \ + } while (0) -extern void GLAPIENTRY -_mesa_RasterPos2i(GLint x, GLint y); +extern void +_mesa_init_rastpos_dispatch(struct _glapi_table *disp); -extern void GLAPIENTRY -_mesa_RasterPos2s(GLshort x, GLshort y); +#else /* FEATURE_rastpos */ -extern void GLAPIENTRY -_mesa_RasterPos3d(GLdouble x, GLdouble y, GLdouble z); +#define _MESA_INIT_RASTPOS_FUNCTIONS(driver, impl) do { } while (0) -extern void GLAPIENTRY -_mesa_RasterPos3f(GLfloat x, GLfloat y, GLfloat z); +static INLINE void +_mesa_init_rastpos_dispatch(struct _glapi_table *disp) +{ +} -extern void GLAPIENTRY -_mesa_RasterPos3i(GLint x, GLint y, GLint z); - -extern void GLAPIENTRY -_mesa_RasterPos3s(GLshort x, GLshort y, GLshort z); - -extern void GLAPIENTRY -_mesa_RasterPos4d(GLdouble x, GLdouble y, GLdouble z, GLdouble w); - -extern void GLAPIENTRY -_mesa_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w); - -extern void GLAPIENTRY -_mesa_RasterPos4i(GLint x, GLint y, GLint z, GLint w); - -extern void GLAPIENTRY -_mesa_RasterPos4s(GLshort x, GLshort y, GLshort z, GLshort w); - -extern void GLAPIENTRY -_mesa_RasterPos2dv(const GLdouble *v); - -extern void GLAPIENTRY -_mesa_RasterPos2fv(const GLfloat *v); - -extern void GLAPIENTRY -_mesa_RasterPos2iv(const GLint *v); - -extern void GLAPIENTRY -_mesa_RasterPos2sv(const GLshort *v); - -extern void GLAPIENTRY -_mesa_RasterPos3dv(const GLdouble *v); - -extern void GLAPIENTRY -_mesa_RasterPos3fv(const GLfloat *v); - -extern void GLAPIENTRY -_mesa_RasterPos3iv(const GLint *v); - -extern void GLAPIENTRY -_mesa_RasterPos3sv(const GLshort *v); - -extern void GLAPIENTRY -_mesa_RasterPos4dv(const GLdouble *v); - -extern void GLAPIENTRY -_mesa_RasterPos4fv(const GLfloat *v); - -extern void GLAPIENTRY -_mesa_RasterPos4iv(const GLint *v); - -extern void GLAPIENTRY -_mesa_RasterPos4sv(const GLshort *v); - - -/**********************************************************************/ -/** \name GL_MESA_window_pos */ -/**********************************************************************/ -/*@{*/ - -extern void GLAPIENTRY -_mesa_WindowPos2dMESA(GLdouble x, GLdouble y); - -extern void GLAPIENTRY -_mesa_WindowPos2fMESA(GLfloat x, GLfloat y); - -extern void GLAPIENTRY -_mesa_WindowPos2iMESA(GLint x, GLint y); - -extern void GLAPIENTRY -_mesa_WindowPos2sMESA(GLshort x, GLshort y); - -extern void GLAPIENTRY -_mesa_WindowPos3dMESA(GLdouble x, GLdouble y, GLdouble z); - -extern void GLAPIENTRY -_mesa_WindowPos3fMESA(GLfloat x, GLfloat y, GLfloat z); - -extern void GLAPIENTRY -_mesa_WindowPos3iMESA(GLint x, GLint y, GLint z); - -extern void GLAPIENTRY -_mesa_WindowPos3sMESA(GLshort x, GLshort y, GLshort z); - -extern void GLAPIENTRY -_mesa_WindowPos4dMESA(GLdouble x, GLdouble y, GLdouble z, GLdouble w); - -extern void GLAPIENTRY -_mesa_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w); - -extern void GLAPIENTRY -_mesa_WindowPos4iMESA(GLint x, GLint y, GLint z, GLint w); - -extern void GLAPIENTRY -_mesa_WindowPos4sMESA(GLshort x, GLshort y, GLshort z, GLshort w); - -extern void GLAPIENTRY -_mesa_WindowPos2dvMESA(const GLdouble *v); - -extern void GLAPIENTRY -_mesa_WindowPos2fvMESA(const GLfloat *v); - -extern void GLAPIENTRY -_mesa_WindowPos2ivMESA(const GLint *v); - -extern void GLAPIENTRY -_mesa_WindowPos2svMESA(const GLshort *v); - -extern void GLAPIENTRY -_mesa_WindowPos3dvMESA(const GLdouble *v); - -extern void GLAPIENTRY -_mesa_WindowPos3fvMESA(const GLfloat *v); - -extern void GLAPIENTRY -_mesa_WindowPos3ivMESA(const GLint *v); - -extern void GLAPIENTRY -_mesa_WindowPos3svMESA(const GLshort *v); - -extern void GLAPIENTRY -_mesa_WindowPos4dvMESA(const GLdouble *v); - -extern void GLAPIENTRY -_mesa_WindowPos4fvMESA(const GLfloat *v); - -extern void GLAPIENTRY -_mesa_WindowPos4ivMESA(const GLint *v); - -extern void GLAPIENTRY -_mesa_WindowPos4svMESA(const GLshort *v); +#endif /* FEATURE_rastpos */ extern void -_mesa_init_rastpos( GLcontext * ctx ); +_mesa_init_rastpos(GLcontext *ctx); /*@}*/ -#endif +#endif /* RASTPOS_H */ -- cgit v1.2.3 From 67a2a4e901367418a5c28e7b0963bf9c0c4762ba Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 8 Sep 2009 10:15:06 +0800 Subject: mesa/main: Make FEATURE_drawpix follow feature conventions. As shown in mfeatures.h, this allows users of drawpix.h to work without knowing if the feature is available. --- src/mesa/main/api_exec.c | 10 +++------- src/mesa/main/drawpix.c | 26 ++++++++++++++++++-------- src/mesa/main/drawpix.h | 35 +++++++++++++++++++++-------------- 3 files changed, 42 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 8de0691851..5ddbf49759 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -57,9 +57,7 @@ #if FEATURE_dlist #include "dlist.h" #endif -#if FEATURE_drawpix #include "drawpix.h" -#endif #include "rastpos.h" #include "enable.h" #if FEATURE_evaluators @@ -209,11 +207,9 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_DepthFunc(exec, _mesa_DepthFunc); SET_DepthMask(exec, _mesa_DepthMask); SET_DepthRange(exec, _mesa_DepthRange); -#if FEATURE_drawpix - SET_Bitmap(exec, _mesa_Bitmap); - SET_CopyPixels(exec, _mesa_CopyPixels); - SET_DrawPixels(exec, _mesa_DrawPixels); -#endif + + _mesa_init_drawpix_dispatch(exec); + #if FEATURE_feedback SET_InitNames(exec, _mesa_InitNames); SET_FeedbackBuffer(exec, _mesa_FeedbackBuffer); diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index aef6585641..5d4b53af4c 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -33,8 +33,11 @@ #include "image.h" #include "readpix.h" #include "state.h" +#include "glapi/dispatch.h" +#if FEATURE_drawpix + /** * If a fragment program is enabled, check that it's valid. @@ -47,12 +50,10 @@ valid_fragment_program(GLcontext *ctx) } -#if _HAVE_FULL_GL - /* * Execute glDrawPixels */ -void GLAPIENTRY +static void GLAPIENTRY _mesa_DrawPixels( GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) { @@ -140,7 +141,7 @@ end: } -void GLAPIENTRY +static void GLAPIENTRY _mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, GLenum type ) { @@ -225,11 +226,8 @@ end: _mesa_set_vp_override(ctx, GL_FALSE); } -#endif /* _HAVE_FULL_GL */ - - -void GLAPIENTRY +static void GLAPIENTRY _mesa_Bitmap( GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap ) @@ -309,3 +307,15 @@ _mesa_Bitmap( GLsizei width, GLsizei height, ctx->Current.RasterPos[0] += xmove; ctx->Current.RasterPos[1] += ymove; } + + +void +_mesa_init_drawpix_dispatch(struct _glapi_table *disp) +{ + SET_Bitmap(disp, _mesa_Bitmap); + SET_CopyPixels(disp, _mesa_CopyPixels); + SET_DrawPixels(disp, _mesa_DrawPixels); +} + + +#endif /* FEATURE_drawpix */ diff --git a/src/mesa/main/drawpix.h b/src/mesa/main/drawpix.h index 6177adad6d..8ffb1a6d88 100644 --- a/src/mesa/main/drawpix.h +++ b/src/mesa/main/drawpix.h @@ -22,28 +22,35 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#ifndef DRAWPIX_H +#define DRAWPIX_H -#ifndef DRAWPIXELS_H -#define DRAWPIXELS_H +#include "main/mtypes.h" -#include "main/glheader.h" +#if FEATURE_drawpix -extern void GLAPIENTRY -_mesa_DrawPixels( GLsizei width, GLsizei height, - GLenum format, GLenum type, const GLvoid *pixels ); +#define _MESA_INIT_DRAWPIX_FUNCTIONS(driver, impl) \ + do { \ + (driver)->DrawPixels = impl ## DrawPixels; \ + (driver)->CopyPixels = impl ## CopyPixels; \ + (driver)->Bitmap = impl ## Bitmap; \ + } while (0) +extern void +_mesa_init_drawpix_dispatch(struct _glapi_table *disp); -extern void GLAPIENTRY -_mesa_CopyPixels( GLint srcx, GLint srcy, GLsizei width, GLsizei height, - GLenum type ); +#else /* FEATURE_drawpix */ +#define _MESA_INIT_DRAWPIX_FUNCTIONS(driver, impl) do { } while (0) -extern void GLAPIENTRY -_mesa_Bitmap( GLsizei width, GLsizei height, - GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, - const GLubyte *bitmap ); +static INLINE void +_mesa_init_drawpix_dispatch(struct _glapi_table *disp) +{ +} +#endif /* FEATURE_drawpix */ -#endif + +#endif /* DRAWPIX_H */ -- cgit v1.2.3 From 301a510092859d2e214d64f4ac2ebe03d591c64b Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 8 Sep 2009 10:52:01 +0800 Subject: mesa/main: Make FEATURE_feedback follow feature conventions. As shown in mfeatures.h, this allows users of feedback.h to work without knowing if the feature is available. --- src/mesa/main/api_exec.c | 13 +--------- src/mesa/main/context.c | 6 ----- src/mesa/main/feedback.c | 39 ++++++++++++++++++++---------- src/mesa/main/feedback.h | 62 ++++++++++++++++++++++++++++++++---------------- 4 files changed, 70 insertions(+), 50 deletions(-) (limited to 'src') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 5ddbf49759..a2f0dfabda 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -64,9 +64,7 @@ #include "eval.h" #endif #include "get.h" -#if FEATURE_feedback #include "feedback.h" -#endif #include "fog.h" #if FEATURE_EXT_framebuffer_object #include "fbobject.h" @@ -209,17 +207,8 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_DepthRange(exec, _mesa_DepthRange); _mesa_init_drawpix_dispatch(exec); + _mesa_init_feedback_dispatch(exec); -#if FEATURE_feedback - SET_InitNames(exec, _mesa_InitNames); - SET_FeedbackBuffer(exec, _mesa_FeedbackBuffer); - SET_LoadName(exec, _mesa_LoadName); - SET_PassThrough(exec, _mesa_PassThrough); - SET_PopName(exec, _mesa_PopName); - SET_PushName(exec, _mesa_PushName); - SET_SelectBuffer(exec, _mesa_SelectBuffer); - SET_RenderMode(exec, _mesa_RenderMode); -#endif SET_FogCoordPointerEXT(exec, _mesa_FogCoordPointerEXT); SET_Fogf(exec, _mesa_Fogf); SET_Fogfv(exec, _mesa_Fogfv); diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index cd8fe0df8f..17e98ffa30 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -100,9 +100,7 @@ #include "enums.h" #include "extensions.h" #include "fbobject.h" -#if FEATURE_feedback #include "feedback.h" -#endif #include "fog.h" #include "framebuffer.h" #include "get.h" @@ -683,11 +681,7 @@ init_attrib_groups(GLcontext *ctx) _mesa_init_eval( ctx ); #endif _mesa_init_fbobjects( ctx ); -#if FEATURE_feedback _mesa_init_feedback( ctx ); -#else - ctx->RenderMode = GL_RENDER; -#endif _mesa_init_fog( ctx ); _mesa_init_histogram( ctx ); _mesa_init_hint( ctx ); diff --git a/src/mesa/main/feedback.c b/src/mesa/main/feedback.c index 818a804540..fcdbb75fc4 100644 --- a/src/mesa/main/feedback.c +++ b/src/mesa/main/feedback.c @@ -36,9 +36,10 @@ #include "feedback.h" #include "macros.h" #include "mtypes.h" +#include "glapi/dispatch.h" -#if _HAVE_FULL_GL +#if FEATURE_feedback #define FB_3D 0x01 @@ -49,7 +50,7 @@ -void GLAPIENTRY +static void GLAPIENTRY _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ) { GET_CURRENT_CONTEXT(ctx); @@ -103,7 +104,7 @@ _mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_PassThrough( GLfloat token ) { GET_CURRENT_CONTEXT(ctx); @@ -153,9 +154,6 @@ _mesa_feedback_vertex(GLcontext *ctx, } -#endif /* _HAVE_FULL_GL */ - - /**********************************************************************/ /** \name Selection */ /*@{*/ @@ -173,7 +171,7 @@ _mesa_feedback_vertex(GLcontext *ctx, * Verifies we're not in selection mode, flushes the vertices and initialize * the fields in __GLcontextRec::Select with the given buffer. */ -void GLAPIENTRY +static void GLAPIENTRY _mesa_SelectBuffer( GLsizei size, GLuint *buffer ) { GET_CURRENT_CONTEXT(ctx); @@ -280,7 +278,7 @@ write_hit_record(GLcontext *ctx) * the hit record data in gl_selection. Marks new render mode in * __GLcontextRec::NewState. */ -void GLAPIENTRY +static void GLAPIENTRY _mesa_InitNames( void ) { GET_CURRENT_CONTEXT(ctx); @@ -311,7 +309,7 @@ _mesa_InitNames( void ) * * sa __GLcontextRec::Select. */ -void GLAPIENTRY +static void GLAPIENTRY _mesa_LoadName( GLuint name ) { GET_CURRENT_CONTEXT(ctx); @@ -350,7 +348,7 @@ _mesa_LoadName( GLuint name ) * * sa __GLcontextRec::Select. */ -void GLAPIENTRY +static void GLAPIENTRY _mesa_PushName( GLuint name ) { GET_CURRENT_CONTEXT(ctx); @@ -381,7 +379,7 @@ _mesa_PushName( GLuint name ) * * sa __GLcontextRec::Select. */ -void GLAPIENTRY +static void GLAPIENTRY _mesa_PopName( void ) { GET_CURRENT_CONTEXT(ctx); @@ -424,7 +422,7 @@ _mesa_PopName( void ) * __GLcontextRec::RenderMode and notifies the driver via the * dd_function_table::RenderMode callback. */ -GLint GLAPIENTRY +static GLint GLAPIENTRY _mesa_RenderMode( GLenum mode ) { GET_CURRENT_CONTEXT(ctx); @@ -507,6 +505,23 @@ _mesa_RenderMode( GLenum mode ) /*@}*/ +void +_mesa_init_feedback_dispatch(struct _glapi_table *disp) +{ + SET_InitNames(disp, _mesa_InitNames); + SET_FeedbackBuffer(disp, _mesa_FeedbackBuffer); + SET_LoadName(disp, _mesa_LoadName); + SET_PassThrough(disp, _mesa_PassThrough); + SET_PopName(disp, _mesa_PopName); + SET_PushName(disp, _mesa_PushName); + SET_SelectBuffer(disp, _mesa_SelectBuffer); + SET_RenderMode(disp, _mesa_RenderMode); +} + + +#endif /* FEATURE_feedback */ + + /**********************************************************************/ /** \name Initialization */ /*@{*/ diff --git a/src/mesa/main/feedback.h b/src/mesa/main/feedback.h index 72c2acd5ed..7a648f444f 100644 --- a/src/mesa/main/feedback.h +++ b/src/mesa/main/feedback.h @@ -27,11 +27,15 @@ #define FEEDBACK_H -#include "mtypes.h" +#include "main/mtypes.h" -extern void -_mesa_init_feedback( GLcontext *ctx ); +#if FEATURE_feedback + +#define _MESA_INIT_FEEDBACK_FUNCTIONS(driver, impl) \ + do { \ + (driver)->RenderMode = impl ## RenderMode; \ + } while (0) extern void _mesa_feedback_vertex( GLcontext *ctx, @@ -55,29 +59,47 @@ extern void _mesa_update_hitflag( GLcontext *ctx, GLfloat z ); -extern void GLAPIENTRY -_mesa_PassThrough( GLfloat token ); +extern void +_mesa_init_feedback_dispatch(struct _glapi_table *disp); + +#else /* FEATURE_feedback */ -extern void GLAPIENTRY -_mesa_FeedbackBuffer( GLsizei size, GLenum type, GLfloat *buffer ); +#define _MESA_INIT_FEEDBACK_FUNCTIONS(driver, impl) do { } while (0) -extern void GLAPIENTRY -_mesa_SelectBuffer( GLsizei size, GLuint *buffer ); +static INLINE void +_mesa_feedback_vertex( GLcontext *ctx, + const GLfloat win[4], + const GLfloat color[4], + GLfloat index, + const GLfloat texcoord[4] ) +{ + /* render mode is always GL_RENDER */ + ASSERT_NO_FEATURE(); +} -extern void GLAPIENTRY -_mesa_InitNames( void ); -extern void GLAPIENTRY -_mesa_LoadName( GLuint name ); +static INLINE void +_mesa_feedback_token( GLcontext *ctx, GLfloat token ) +{ + /* render mode is always GL_RENDER */ + ASSERT_NO_FEATURE(); +} -extern void GLAPIENTRY -_mesa_PushName( GLuint name ); +static INLINE void +_mesa_update_hitflag( GLcontext *ctx, GLfloat z ) +{ + /* render mode is always GL_RENDER */ + ASSERT_NO_FEATURE(); +} -extern void GLAPIENTRY -_mesa_PopName( void ); +static INLINE void +_mesa_init_feedback_dispatch(struct _glapi_table *disp) +{ +} -extern GLint GLAPIENTRY -_mesa_RenderMode( GLenum mode ); +#endif /* FEATURE_feedback */ +extern void +_mesa_init_feedback( GLcontext *ctx ); -#endif +#endif /* FEEDBACK_H */ -- cgit v1.2.3 From cc95de82e5939586771d478e662cb458bbc42c20 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 8 Sep 2009 11:01:19 +0800 Subject: mesa/main: Make FEATURE_texgen follow feature conventions. As shown in mfeatures.h, this allows users of texgen.h to work without knowing if the feature is available. --- src/mesa/main/api_exec.c | 14 +------------- src/mesa/main/texgen.c | 34 +++++++++++++++++++++++++++------- src/mesa/main/texgen.h | 43 ++++++++++++++++++++++++++----------------- 3 files changed, 54 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index a2f0dfabda..b7b9aa0bf2 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -93,9 +93,7 @@ #include "texenv.h" #include "texgetimage.h" #include "teximage.h" -#if FEATURE_texgen #include "texgen.h" -#endif #include "texobj.h" #include "texparam.h" #include "texstate.h" @@ -275,17 +273,7 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_TexEnvf(exec, _mesa_TexEnvf); SET_TexEnviv(exec, _mesa_TexEnviv); -#if FEATURE_texgen - SET_GetTexGendv(exec, _mesa_GetTexGendv); - SET_GetTexGenfv(exec, _mesa_GetTexGenfv); - SET_GetTexGeniv(exec, _mesa_GetTexGeniv); - SET_TexGend(exec, _mesa_TexGend); - SET_TexGendv(exec, _mesa_TexGendv); - SET_TexGenf(exec, _mesa_TexGenf); - SET_TexGenfv(exec, _mesa_TexGenfv); - SET_TexGeni(exec, _mesa_TexGeni); - SET_TexGeniv(exec, _mesa_TexGeniv); -#endif + _mesa_init_texgen_dispatch(exec); SET_TexImage1D(exec, _mesa_TexImage1D); SET_TexParameterf(exec, _mesa_TexParameterf); diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c index b3ecfc784e..733e129fcf 100644 --- a/src/mesa/main/texgen.c +++ b/src/mesa/main/texgen.c @@ -37,6 +37,10 @@ #include "main/texgen.h" #include "main/texstate.h" #include "math/m_matrix.h" +#include "glapi/dispatch.h" + + +#if FEATURE_texgen /** @@ -162,7 +166,7 @@ _mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) { GLfloat p[4]; @@ -179,7 +183,7 @@ _mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_TexGend(GLenum coord, GLenum pname, GLdouble param ) { GLfloat p = (GLfloat) param; @@ -187,7 +191,7 @@ _mesa_TexGend(GLenum coord, GLenum pname, GLdouble param ) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) { GLfloat p[4]; @@ -204,7 +208,7 @@ _mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ) { _mesa_TexGenfv(coord, pname, ¶m); @@ -219,7 +223,7 @@ _mesa_TexGeni( GLenum coord, GLenum pname, GLint param ) -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) { struct gl_texture_unit *texUnit; @@ -257,7 +261,7 @@ _mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ) -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) { struct gl_texture_unit *texUnit; @@ -295,7 +299,7 @@ _mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ) -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) { struct gl_texture_unit *texUnit; @@ -338,3 +342,19 @@ _mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ) } +void +_mesa_init_texgen_dispatch(struct _glapi_table *disp) +{ + SET_GetTexGendv(disp, _mesa_GetTexGendv); + SET_GetTexGenfv(disp, _mesa_GetTexGenfv); + SET_GetTexGeniv(disp, _mesa_GetTexGeniv); + SET_TexGend(disp, _mesa_TexGend); + SET_TexGendv(disp, _mesa_TexGendv); + SET_TexGenf(disp, _mesa_TexGenf); + SET_TexGenfv(disp, _mesa_TexGenfv); + SET_TexGeni(disp, _mesa_TexGeni); + SET_TexGeniv(disp, _mesa_TexGeniv); +} + + +#endif /* FEATURE_texgen */ diff --git a/src/mesa/main/texgen.h b/src/mesa/main/texgen.h index 073588efcd..f6924ef722 100644 --- a/src/mesa/main/texgen.h +++ b/src/mesa/main/texgen.h @@ -27,36 +27,45 @@ #define TEXGEN_H -#include "main/glheader.h" +#include "main/mtypes.h" -extern void GLAPIENTRY -_mesa_GetTexGendv( GLenum coord, GLenum pname, GLdouble *params ); +#if FEATURE_texgen -extern void GLAPIENTRY -_mesa_GetTexGenfv( GLenum coord, GLenum pname, GLfloat *params ); +#define _MESA_INIT_TEXGEN_FUNCTIONS(driver, impl) \ + do { \ + (driver)->TexGen = impl ## TexGen; \ + } while (0) extern void GLAPIENTRY -_mesa_GetTexGeniv( GLenum coord, GLenum pname, GLint *params ); +_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ); extern void GLAPIENTRY -_mesa_TexGend( GLenum coord, GLenum pname, GLdouble param ); +_mesa_TexGeni( GLenum coord, GLenum pname, GLint param ); -extern void GLAPIENTRY -_mesa_TexGendv( GLenum coord, GLenum pname, const GLdouble *params ); +extern void +_mesa_init_texgen_dispatch(struct _glapi_table *disp); -extern void GLAPIENTRY -_mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ); +#else /* FEATURE_texgen */ -extern void GLAPIENTRY -_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ); +#define _MESA_INIT_TEXGEN_FUNCTIONS(driver, impl) do { } while (0) -extern void GLAPIENTRY -_mesa_TexGeni( GLenum coord, GLenum pname, GLint param ); +static void +_mesa_TexGenfv( GLenum coord, GLenum pname, const GLfloat *params ) +{ +} -extern void GLAPIENTRY -_mesa_TexGeniv( GLenum coord, GLenum pname, const GLint *params ); +static void INLINE +_mesa_TexGeni( GLenum coord, GLenum pname, GLint param ) +{ +} + +static INLINE void +_mesa_init_texgen_dispatch(struct _glapi_table *disp) +{ +} +#endif /* FEATURE_texgen */ #endif /* TEXGEN_H */ -- cgit v1.2.3 From 80630d1fed6cd32e75f5e97e2cd27509be21d093 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 8 Sep 2009 14:32:08 +0800 Subject: mesa/main: New feature FEATURE_arrayelt. This allows the removal of AEcontext. --- src/mesa/main/api_arrayelt.c | 18 +++++++++++++++-- src/mesa/main/api_arrayelt.h | 47 +++++++++++++++++++++++++++++++++++++++++--- src/mesa/main/api_noop.c | 3 ++- src/mesa/main/dlist.c | 3 ++- src/mesa/main/mfeatures.h | 3 ++- src/mesa/main/vtxfmt.c | 4 +++- src/mesa/vbo/vbo_exec_api.c | 3 ++- src/mesa/vbo/vbo_save_api.c | 3 ++- 8 files changed, 73 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c index 2462a1b003..a058227110 100644 --- a/src/mesa/main/api_arrayelt.c +++ b/src/mesa/main/api_arrayelt.c @@ -71,6 +71,10 @@ typedef struct { */ #define TYPE_IDX(t) ( (t) == GL_DOUBLE ? 7 : (t) & 7 ) + +#if FEATURE_arrayelt + + static const int ColorFuncs[2][8] = { { _gloffset_Color3bv, @@ -1160,7 +1164,7 @@ static void _ae_update_state( GLcontext *ctx ) at->array = attribArray; /* Note: we can't grab the _glapi_Dispatch->VertexAttrib1fvNV * function pointer here (for float arrays) since the pointer may - * change from one execution of _ae_loopback_array_elt() to + * change from one execution of _ae_ArrayElement() to * the next. Doing so caused UT to break. */ if (ctx->VertexProgram._Enabled @@ -1254,7 +1258,7 @@ void _ae_unmap_vbos( GLcontext *ctx ) * for all enabled vertex arrays (for elt-th element). * Note: this may be called during display list construction. */ -void GLAPIENTRY _ae_loopback_array_elt( GLint elt ) +void GLAPIENTRY _ae_ArrayElement( GLint elt ) { GET_CURRENT_CONTEXT(ctx); const AEcontext *actx = AE_CONTEXT(ctx); @@ -1317,3 +1321,13 @@ void _ae_invalidate_state( GLcontext *ctx, GLuint new_state ) actx->NewState |= new_state; } } + + +void _mesa_install_arrayelt_vtxfmt(struct _glapi_table *disp, + const GLvertexformat *vfmt) +{ + SET_ArrayElement(disp, vfmt->ArrayElement); +} + + +#endif /* FEATURE_arrayelt */ diff --git a/src/mesa/main/api_arrayelt.h b/src/mesa/main/api_arrayelt.h index e621724fb2..d18c0792c3 100644 --- a/src/mesa/main/api_arrayelt.h +++ b/src/mesa/main/api_arrayelt.h @@ -27,16 +27,57 @@ #ifndef API_ARRAYELT_H #define API_ARRAYELT_H -#include "mtypes.h" + +#include "main/mtypes.h" + +#if FEATURE_arrayelt + +#define _MESA_INIT_ARRAYELT_VTXFMT(vfmt, impl) \ + do { \ + (vfmt)->ArrayElement = impl ## ArrayElement; \ + } while (0) extern GLboolean _ae_create_context( GLcontext *ctx ); extern void _ae_destroy_context( GLcontext *ctx ); extern void _ae_invalidate_state( GLcontext *ctx, GLuint new_state ); -extern void GLAPIENTRY _ae_loopback_array_elt( GLint elt ); +extern void GLAPIENTRY _ae_ArrayElement( GLint elt ); /* May optionally be called before a batch of element calls: */ extern void _ae_map_vbos( GLcontext *ctx ); extern void _ae_unmap_vbos( GLcontext *ctx ); -#endif +extern void +_mesa_install_arrayelt_vtxfmt(struct _glapi_table *disp, + const GLvertexformat *vfmt); + +#else /* FEATURE_arrayelt */ + +#define _MESA_INIT_ARRAYELT_VTXFMT(vfmt, impl) do { } while (0) + +static INLINE GLboolean +_ae_create_context( GLcontext *ctx ) +{ + return GL_TRUE; +} + +static INLINE void +_ae_destroy_context( GLcontext *ctx ) +{ +} + +static INLINE void +_ae_invalidate_state( GLcontext *ctx, GLuint new_state ) +{ +} + +static INLINE void +_mesa_install_arrayelt_vtxfmt(struct _glapi_table *disp, + const GLvertexformat *vfmt) +{ +} + +#endif /* FEATURE_arrayelt */ + + +#endif /* API_ARRAYELT_H */ diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c index 0b669e7e7f..162b685b02 100644 --- a/src/mesa/main/api_noop.c +++ b/src/mesa/main/api_noop.c @@ -992,7 +992,8 @@ _mesa_noop_EvalMesh2( GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2 ) void _mesa_noop_vtxfmt_init( GLvertexformat *vfmt ) { - vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */ + _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_); + vfmt->Begin = _mesa_noop_Begin; #if FEATURE_dlist vfmt->CallList = _mesa_CallList; diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 9c25de4187..e2b172595c 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -9291,7 +9291,8 @@ mesa_print_display_list(GLuint list) void _mesa_save_vtxfmt_init(GLvertexformat * vfmt) { - vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */ + _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_); + vfmt->Begin = save_Begin; vfmt->CallList = _mesa_save_CallList; vfmt->CallLists = _mesa_save_CallLists; diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index d3491b1d42..834b89e6e5 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -69,11 +69,12 @@ */ #define FEATURE_accum _HAVE_FULL_GL +#define FEATURE_arrayelt _HAVE_FULL_GL #define FEATURE_attrib_stack _HAVE_FULL_GL #define FEATURE_colortable _HAVE_FULL_GL #define FEATURE_convolve _HAVE_FULL_GL #define FEATURE_dispatch _HAVE_FULL_GL -#define FEATURE_dlist _HAVE_FULL_GL +#define FEATURE_dlist (_HAVE_FULL_GL && FEATURE_arrayelt) #define FEATURE_draw_read_buffer _HAVE_FULL_GL #define FEATURE_drawpix _HAVE_FULL_GL #define FEATURE_evaluators _HAVE_FULL_GL diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c index 91412f138a..de9479d6b0 100644 --- a/src/mesa/main/vtxfmt.c +++ b/src/mesa/main/vtxfmt.c @@ -27,6 +27,7 @@ */ #include "glheader.h" +#include "api_arrayelt.h" #include "api_loopback.h" #include "context.h" #include "imports.h" @@ -82,7 +83,8 @@ static void install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) { - SET_ArrayElement(tab, vfmt->ArrayElement); + _mesa_install_arrayelt_vtxfmt(tab, vfmt); + SET_Color3f(tab, vfmt->Color3f); SET_Color3fv(tab, vfmt->Color3fv); SET_Color4f(tab, vfmt->Color4f); diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 387d4ee3d4..238beee030 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -557,7 +557,8 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec ) { GLvertexformat *vfmt = &exec->vtxfmt; - vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */ + _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_); + vfmt->Begin = vbo_exec_Begin; #if FEATURE_dlist vfmt->CallList = _mesa_CallList; diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index 41cd21d04b..6e11344380 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -988,7 +988,8 @@ static void _save_vtxfmt_init( GLcontext *ctx ) struct vbo_save_context *save = &vbo_context(ctx)->save; GLvertexformat *vfmt = &save->vtxfmt; - vfmt->ArrayElement = _ae_loopback_array_elt; /* generic helper */ + _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_); + vfmt->Begin = _save_Begin; vfmt->Color3f = _save_Color3f; vfmt->Color3fv = _save_Color3fv; -- cgit v1.2.3 From 42fac11d437d6bf2cb27f9487dedf7fb396616d4 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 8 Sep 2009 17:45:59 +0800 Subject: mesa/main: New feature FEATURE_queryobj. It merges FEATURE_ARB_occlusion_query and FEATURE_EXT_timer_query, and follows the feature conventions. --- src/mesa/main/api_exec.c | 18 +---------- src/mesa/main/context.c | 10 ++----- src/mesa/main/dlist.c | 8 ++--- src/mesa/main/extensions.c | 2 +- src/mesa/main/mfeatures.h | 3 +- src/mesa/main/queryobj.c | 48 ++++++++++++++++++------------ src/mesa/main/queryobj.h | 59 +++++++++++++++++++++++++------------ src/mesa/state_tracker/st_context.c | 2 +- src/mesa/swrast/s_span.c | 4 --- 9 files changed, 79 insertions(+), 75 deletions(-) (limited to 'src') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index b7b9aa0bf2..3fe10f1207 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -83,9 +83,7 @@ #include "pixelstore.h" #include "points.h" #include "polygon.h" -#if FEATURE_ARB_occlusion_query || FEATURE_EXT_timer_query #include "queryobj.h" -#endif #include "readpix.h" #include "scissor.h" #include "state.h" @@ -625,16 +623,7 @@ _mesa_init_exec_table(struct _glapi_table *exec) #endif /* ARB 29. GL_ARB_occlusion_query */ -#if FEATURE_ARB_occlusion_query - SET_GenQueriesARB(exec, _mesa_GenQueriesARB); - SET_DeleteQueriesARB(exec, _mesa_DeleteQueriesARB); - SET_IsQueryARB(exec, _mesa_IsQueryARB); - SET_BeginQueryARB(exec, _mesa_BeginQueryARB); - SET_EndQueryARB(exec, _mesa_EndQueryARB); - SET_GetQueryivARB(exec, _mesa_GetQueryivARB); - SET_GetQueryObjectivARB(exec, _mesa_GetQueryObjectivARB); - SET_GetQueryObjectuivARB(exec, _mesa_GetQueryObjectuivARB); -#endif + _mesa_init_queryobj_dispatch(exec); /* ARB 37. GL_ARB_draw_buffers */ #if FEATURE_draw_read_buffer @@ -744,11 +733,6 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_GenerateMipmapEXT(exec, _mesa_GenerateMipmapEXT); #endif -#if FEATURE_EXT_timer_query - SET_GetQueryObjecti64vEXT(exec, _mesa_GetQueryObjecti64vEXT); - SET_GetQueryObjectui64vEXT(exec, _mesa_GetQueryObjectui64vEXT); -#endif - #if FEATURE_EXT_framebuffer_blit SET_BlitFramebufferEXT(exec, _mesa_BlitFramebufferEXT); #endif diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 17e98ffa30..6994f98504 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -116,9 +116,7 @@ #include "pixelstore.h" #include "points.h" #include "polygon.h" -#if FEATURE_ARB_occlusion_query #include "queryobj.h" -#endif #if FEATURE_ARB_sync #include "syncobj.h" #endif @@ -694,9 +692,7 @@ init_attrib_groups(GLcontext *ctx) _mesa_init_point( ctx ); _mesa_init_polygon( ctx ); _mesa_init_program( ctx ); -#if FEATURE_ARB_occlusion_query - _mesa_init_query( ctx ); -#endif + _mesa_init_queryobj( ctx ); #if FEATURE_ARB_sync _mesa_init_sync( ctx ); #endif @@ -990,9 +986,7 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_free_colortables_data( ctx ); _mesa_free_program_data(ctx); _mesa_free_shader_state(ctx); -#if FEATURE_ARB_occlusion_query - _mesa_free_query_data(ctx); -#endif + _mesa_free_queryobj_data(ctx); #if FEATURE_ARB_sync _mesa_free_sync_data(ctx); #endif diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index e2b172595c..35f9a3cf03 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -4856,7 +4856,7 @@ save_ProgramStringARB(GLenum target, GLenum format, GLsizei len, #endif /* FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program */ -#if FEATURE_ARB_occlusion_query +#if FEATURE_queryobj static void GLAPIENTRY save_BeginQueryARB(GLenum target, GLuint id) @@ -4890,7 +4890,7 @@ save_EndQueryARB(GLenum target) } } -#endif /* FEATURE_ARB_occlusion_query */ +#endif /* FEATURE_queryobj */ static void GLAPIENTRY @@ -7155,7 +7155,7 @@ execute_list(GLcontext *ctx, GLuint list) n[6].f)); break; #endif -#if FEATURE_ARB_occlusion_query +#if FEATURE_queryobj case OPCODE_BEGIN_QUERY_ARB: CALL_BeginQueryARB(ctx->Exec, (n[1].e, n[2].ui)); break; @@ -8924,7 +8924,7 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_UnmapBufferARB(table, _mesa_UnmapBufferARB); #endif -#if FEATURE_ARB_occlusion_query +#if FEATURE_queryobj SET_BeginQueryARB(table, save_BeginQueryARB); SET_EndQueryARB(table, save_EndQueryARB); SET_GenQueriesARB(table, _mesa_GenQueriesARB); diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 2992abd075..54cf37c5f4 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -215,7 +215,7 @@ _mesa_enable_sw_extensions(GLcontext *ctx) ctx->Extensions.ARB_imaging = GL_TRUE; ctx->Extensions.ARB_map_buffer_range = GL_TRUE; ctx->Extensions.ARB_multitexture = GL_TRUE; -#if FEATURE_ARB_occlusion_query +#if FEATURE_queryobj ctx->Extensions.ARB_occlusion_query = GL_TRUE; #endif ctx->Extensions.ARB_point_sprite = GL_TRUE; diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index 834b89e6e5..27799771a5 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -83,6 +83,7 @@ #define FEATURE_histogram _HAVE_FULL_GL #define FEATURE_pixel_transfer _HAVE_FULL_GL #define FEATURE_point_size_array 0 +#define FEATURE_queryobj _HAVE_FULL_GL #define FEATURE_rastpos _HAVE_FULL_GL #define FEATURE_texgen _HAVE_FULL_GL #define FEATURE_texture_fxt1 _HAVE_FULL_GL @@ -91,7 +92,6 @@ #define FEATURE_vertex_array_byte 0 #define FEATURE_es2_glsl 0 -#define FEATURE_ARB_occlusion_query _HAVE_FULL_GL #define FEATURE_ARB_fragment_program _HAVE_FULL_GL #define FEATURE_ARB_framebuffer_object _HAVE_FULL_GL #define FEATURE_ARB_map_buffer_range _HAVE_FULL_GL @@ -109,7 +109,6 @@ #define FEATURE_EXT_framebuffer_object _HAVE_FULL_GL #define FEATURE_EXT_pixel_buffer_object _HAVE_FULL_GL #define FEATURE_EXT_texture_sRGB _HAVE_FULL_GL -#define FEATURE_EXT_timer_query _HAVE_FULL_GL #define FEATURE_ATI_fragment_shader _HAVE_FULL_GL #define FEATURE_NV_fence _HAVE_FULL_GL #define FEATURE_NV_fragment_program _HAVE_FULL_GL diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index a73c6e0508..f6eb4ee7e1 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -29,6 +29,10 @@ #include "imports.h" #include "queryobj.h" #include "mtypes.h" +#include "glapi/dispatch.h" + + +#if FEATURE_queryobj /** @@ -216,7 +220,7 @@ _mesa_IsQueryARB(GLuint id) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_BeginQueryARB(GLenum target, GLuint id) { struct gl_query_object *q; @@ -236,7 +240,6 @@ _mesa_BeginQueryARB(GLenum target, GLuint id) return; } break; -#if FEATURE_EXT_timer_query case GL_TIME_ELAPSED_EXT: if (!ctx->Extensions.EXT_timer_query) { _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQueryARB(target)"); @@ -247,7 +250,6 @@ _mesa_BeginQueryARB(GLenum target, GLuint id) return; } break; -#endif default: _mesa_error(ctx, GL_INVALID_ENUM, "glBeginQueryARB(target)"); return; @@ -285,17 +287,15 @@ _mesa_BeginQueryARB(GLenum target, GLuint id) if (target == GL_SAMPLES_PASSED_ARB) { ctx->Query.CurrentOcclusionObject = q; } -#if FEATURE_EXT_timer_query else if (target == GL_TIME_ELAPSED_EXT) { ctx->Query.CurrentTimerObject = q; } -#endif ctx->Driver.BeginQuery(ctx, q); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_EndQueryARB(GLenum target) { struct gl_query_object *q; @@ -313,7 +313,6 @@ _mesa_EndQueryARB(GLenum target) q = ctx->Query.CurrentOcclusionObject; ctx->Query.CurrentOcclusionObject = NULL; break; -#if FEATURE_EXT_timer_query case GL_TIME_ELAPSED_EXT: if (!ctx->Extensions.EXT_timer_query) { _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)"); @@ -322,7 +321,6 @@ _mesa_EndQueryARB(GLenum target) q = ctx->Query.CurrentTimerObject; ctx->Query.CurrentTimerObject = NULL; break; -#endif default: _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)"); return; @@ -354,7 +352,6 @@ _mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params) } q = ctx->Query.CurrentOcclusionObject; break; -#if FEATURE_EXT_timer_query case GL_TIME_ELAPSED_EXT: if (!ctx->Extensions.EXT_timer_query) { _mesa_error(ctx, GL_INVALID_ENUM, "glEndQueryARB(target)"); @@ -362,7 +359,6 @@ _mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params) } q = ctx->Query.CurrentTimerObject; break; -#endif default: _mesa_error(ctx, GL_INVALID_ENUM, "glGetQueryivARB(target)"); return; @@ -462,12 +458,10 @@ _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params) } -#if FEATURE_EXT_timer_query - /** * New with GL_EXT_timer_query */ -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64EXT *params) { struct gl_query_object *q = NULL; @@ -504,7 +498,7 @@ _mesa_GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64EXT *params) /** * New with GL_EXT_timer_query */ -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64EXT *params) { struct gl_query_object *q = NULL; @@ -537,19 +531,35 @@ _mesa_GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64EXT *params) } } -#endif /* FEATURE_EXT_timer_query */ + +void +_mesa_init_queryobj_dispatch(struct _glapi_table *disp) +{ + SET_GenQueriesARB(disp, _mesa_GenQueriesARB); + SET_DeleteQueriesARB(disp, _mesa_DeleteQueriesARB); + SET_IsQueryARB(disp, _mesa_IsQueryARB); + SET_BeginQueryARB(disp, _mesa_BeginQueryARB); + SET_EndQueryARB(disp, _mesa_EndQueryARB); + SET_GetQueryivARB(disp, _mesa_GetQueryivARB); + SET_GetQueryObjectivARB(disp, _mesa_GetQueryObjectivARB); + SET_GetQueryObjectuivARB(disp, _mesa_GetQueryObjectuivARB); + + SET_GetQueryObjecti64vEXT(disp, _mesa_GetQueryObjecti64vEXT); + SET_GetQueryObjectui64vEXT(disp, _mesa_GetQueryObjectui64vEXT); +} + + +#endif /* FEATURE_queryobj */ /** * Allocate/init the context state related to query objects. */ void -_mesa_init_query(GLcontext *ctx) +_mesa_init_queryobj(GLcontext *ctx) { -#if FEATURE_ARB_occlusion_query ctx->Query.QueryObjects = _mesa_NewHashTable(); ctx->Query.CurrentOcclusionObject = NULL; -#endif } @@ -569,7 +579,7 @@ delete_queryobj_cb(GLuint id, void *data, void *userData) * Free the context state related to query objects. */ void -_mesa_free_query_data(GLcontext *ctx) +_mesa_free_queryobj_data(GLcontext *ctx) { _mesa_HashDeleteAll(ctx->Query.QueryObjects, delete_queryobj_cb, ctx); _mesa_DeleteHashTable(ctx->Query.QueryObjects); diff --git a/src/mesa/main/queryobj.h b/src/mesa/main/queryobj.h index ee775ef959..6cf3c76d74 100644 --- a/src/mesa/main/queryobj.h +++ b/src/mesa/main/queryobj.h @@ -23,19 +23,24 @@ */ -#ifndef OCCLUDE_H -#define OCCLUDE_H +#ifndef QUERYOBJ_H +#define QUERYOBJ_H -extern void -_mesa_init_query(GLcontext *ctx); +#include "main/mtypes.h" -extern void -_mesa_free_query_data(GLcontext *ctx); -extern void -_mesa_init_query_object_functions(struct dd_function_table *driver); +#if FEATURE_queryobj +#define _MESA_INIT_QUERYOBJ_FUNCTIONS(driver, impl) \ + do { \ + (driver)->NewQueryObject = impl ## NewQueryObject; \ + (driver)->DeleteQuery = impl ## DeleteQuery; \ + (driver)->BeginQuery = impl ## BeginQuery; \ + (driver)->EndQuery = impl ## EndQuery; \ + (driver)->WaitQuery = impl ## WaitQuery; \ + (driver)->CheckQuery = impl ## CheckQuery; \ + } while (0) extern void GLAPIENTRY _mesa_GenQueriesARB(GLsizei n, GLuint *ids); @@ -46,12 +51,6 @@ _mesa_DeleteQueriesARB(GLsizei n, const GLuint *ids); extern GLboolean GLAPIENTRY _mesa_IsQueryARB(GLuint id); -extern void GLAPIENTRY -_mesa_BeginQueryARB(GLenum target, GLuint id); - -extern void GLAPIENTRY -_mesa_EndQueryARB(GLenum target); - extern void GLAPIENTRY _mesa_GetQueryivARB(GLenum target, GLenum pname, GLint *params); @@ -61,11 +60,33 @@ _mesa_GetQueryObjectivARB(GLuint id, GLenum pname, GLint *params); extern void GLAPIENTRY _mesa_GetQueryObjectuivARB(GLuint id, GLenum pname, GLuint *params); -extern void GLAPIENTRY -_mesa_GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64EXT *params); +extern void +_mesa_init_query_object_functions(struct dd_function_table *driver); -extern void GLAPIENTRY -_mesa_GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64EXT *params); +extern void +_mesa_init_queryobj_dispatch(struct _glapi_table *disp); + +#else /* FEATURE_queryobj */ + +#define _MESA_INIT_QUERYOBJ_FUNCTIONS(driver, impl) do { } while (0) + +static INLINE void +_mesa_init_query_object_functions(struct dd_function_table *driver) +{ +} + +static INLINE void +_mesa_init_queryobj_dispatch(struct _glapi_table *disp) +{ +} + +#endif /* FEATURE_queryobj */ + +extern void +_mesa_init_queryobj(GLcontext *ctx); + +extern void +_mesa_free_queryobj_data(GLcontext *ctx); -#endif /* OCCLUDE_H */ +#endif /* QUERYOBJ_H */ diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 8514b6b375..96969c736c 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -332,7 +332,7 @@ void st_init_driver_functions(struct dd_function_table *functions) st_init_feedback_functions(functions); #endif st_init_program_functions(functions); -#if FEATURE_ARB_occlusion_query +#if FEATURE_queryobj st_init_query_functions(functions); #endif st_init_readpixels_functions(functions); diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index a45eac438e..704230d1d7 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -904,7 +904,6 @@ _swrast_write_index_span( GLcontext *ctx, SWspan *span) } } -#if FEATURE_ARB_occlusion_query if (ctx->Query.CurrentOcclusionObject) { /* update count of 'passed' fragments */ struct gl_query_object *q = ctx->Query.CurrentOcclusionObject; @@ -912,7 +911,6 @@ _swrast_write_index_span( GLcontext *ctx, SWspan *span) for (i = 0; i < span->end; i++) q->Result += span->array->mask[i]; } -#endif /* we have to wait until after occlusion to do this test */ if (ctx->Color.IndexMask == 0) { @@ -1376,7 +1374,6 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) } } -#if FEATURE_ARB_occlusion_query if (ctx->Query.CurrentOcclusionObject) { /* update count of 'passed' fragments */ struct gl_query_object *q = ctx->Query.CurrentOcclusionObject; @@ -1384,7 +1381,6 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) for (i = 0; i < span->end; i++) q->Result += span->array->mask[i]; } -#endif /* We had to wait until now to check for glColorMask(0,0,0,0) because of * the occlusion test. -- cgit v1.2.3 From aefa1f6ab1d9267b223b06ae205ab34c8e0d7c02 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 8 Sep 2009 10:25:22 +0800 Subject: mesa/main: Make FEATURE_evaluators follow feature conventions. As shown in mfeatures.h, this allows users of eval.h to work without knowing if the feature is available. --- src/mesa/main/api_exec.c | 18 ++-------- src/mesa/main/api_noop.c | 14 +++----- src/mesa/main/context.c | 6 ---- src/mesa/main/dlist.c | 19 ++++------ src/mesa/main/eval.c | 61 ++++++++++++++++++++++++++------ src/mesa/main/eval.h | 84 ++++++++++++++++++--------------------------- src/mesa/main/vtxfmt.c | 13 +++---- src/mesa/vbo/vbo_exec_api.c | 19 +++++----- src/mesa/vbo/vbo_save_api.c | 11 ++---- 9 files changed, 114 insertions(+), 131 deletions(-) (limited to 'src') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index 3fe10f1207..fc4de3c14c 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -60,9 +60,7 @@ #include "drawpix.h" #include "rastpos.h" #include "enable.h" -#if FEATURE_evaluators #include "eval.h" -#endif #include "get.h" #include "feedback.h" #include "fog.h" @@ -238,19 +236,9 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_Lighti(exec, _mesa_Lighti); SET_Lightiv(exec, _mesa_Lightiv); SET_LoadMatrixd(exec, _mesa_LoadMatrixd); -#if FEATURE_evaluators - SET_GetMapdv(exec, _mesa_GetMapdv); - SET_GetMapfv(exec, _mesa_GetMapfv); - SET_GetMapiv(exec, _mesa_GetMapiv); - SET_Map1d(exec, _mesa_Map1d); - SET_Map1f(exec, _mesa_Map1f); - SET_Map2d(exec, _mesa_Map2d); - SET_Map2f(exec, _mesa_Map2f); - SET_MapGrid1d(exec, _mesa_MapGrid1d); - SET_MapGrid1f(exec, _mesa_MapGrid1f); - SET_MapGrid2d(exec, _mesa_MapGrid2d); - SET_MapGrid2f(exec, _mesa_MapGrid2f); -#endif + + _mesa_init_eval_dispatch(exec); + SET_MultMatrixd(exec, _mesa_MultMatrixd); _mesa_init_pixel_dispatch(exec); diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c index 162b685b02..23c52177d8 100644 --- a/src/mesa/main/api_noop.c +++ b/src/mesa/main/api_noop.c @@ -33,6 +33,7 @@ #if FEATURE_dlist #include "dlist.h" #endif +#include "eval.h" #include "glapi/dispatch.h" @@ -1005,14 +1006,9 @@ _mesa_noop_vtxfmt_init( GLvertexformat *vfmt ) vfmt->Color4fv = _mesa_noop_Color4fv; vfmt->EdgeFlag = _mesa_noop_EdgeFlag; vfmt->End = _mesa_noop_End; -#if FEATURE_evaluators - vfmt->EvalCoord1f = _mesa_noop_EvalCoord1f; - vfmt->EvalCoord1fv = _mesa_noop_EvalCoord1fv; - vfmt->EvalCoord2f = _mesa_noop_EvalCoord2f; - vfmt->EvalCoord2fv = _mesa_noop_EvalCoord2fv; - vfmt->EvalPoint1 = _mesa_noop_EvalPoint1; - vfmt->EvalPoint2 = _mesa_noop_EvalPoint2; -#endif + + _MESA_INIT_EVAL_VTXFMT(vfmt, _mesa_noop_); + vfmt->FogCoordfEXT = _mesa_noop_FogCoordfEXT; vfmt->FogCoordfvEXT = _mesa_noop_FogCoordfvEXT; vfmt->Indexf = _mesa_noop_Indexf; @@ -1070,6 +1066,4 @@ _mesa_noop_vtxfmt_init( GLvertexformat *vfmt ) vfmt->DrawElementsBaseVertex = _mesa_noop_DrawElementsBaseVertex; vfmt->DrawRangeElementsBaseVertex = _mesa_noop_DrawRangeElementsBaseVertex; vfmt->MultiDrawElementsBaseVertex = _mesa_noop_MultiDrawElementsBaseVertex; - vfmt->EvalMesh1 = _mesa_noop_EvalMesh1; - vfmt->EvalMesh2 = _mesa_noop_EvalMesh2; } diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 6994f98504..03ee7fb04d 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -94,9 +94,7 @@ #if FEATURE_dlist #include "dlist.h" #endif -#if FEATURE_evaluators #include "eval.h" -#endif #include "enums.h" #include "extensions.h" #include "fbobject.h" @@ -675,9 +673,7 @@ init_attrib_groups(GLcontext *ctx) #if FEATURE_dlist _mesa_init_display_list( ctx ); #endif -#if FEATURE_evaluators _mesa_init_eval( ctx ); -#endif _mesa_init_fbobjects( ctx ); _mesa_init_feedback( ctx ); _mesa_init_fog( ctx ); @@ -977,9 +973,7 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_free_attrib_data(ctx); _mesa_free_lighting_data( ctx ); -#if FEATURE_evaluators _mesa_free_eval_data( ctx ); -#endif _mesa_free_texture_data( ctx ); _mesa_free_matrix_data( ctx ); _mesa_free_viewport_data( ctx ); diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 35f9a3cf03..189743e5f5 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1876,7 +1876,7 @@ save_Enable(GLenum cap) static void GLAPIENTRY -_mesa_save_EvalMesh1(GLenum mode, GLint i1, GLint i2) +save_EvalMesh1(GLenum mode, GLint i1, GLint i2) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1894,7 +1894,7 @@ _mesa_save_EvalMesh1(GLenum mode, GLint i1, GLint i2) static void GLAPIENTRY -_mesa_save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) +save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -8451,8 +8451,8 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_DrawPixels(table, save_DrawPixels); SET_Enable(table, save_Enable); SET_EndList(table, _mesa_EndList); - SET_EvalMesh1(table, _mesa_save_EvalMesh1); - SET_EvalMesh2(table, _mesa_save_EvalMesh2); + SET_EvalMesh1(table, save_EvalMesh1); + SET_EvalMesh2(table, save_EvalMesh2); SET_Finish(table, exec_Finish); SET_Flush(table, exec_Flush); SET_Fogf(table, save_Fogf); @@ -9302,12 +9302,9 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt) vfmt->Color4fv = save_Color4fv; vfmt->EdgeFlag = save_EdgeFlag; vfmt->End = save_End; - vfmt->EvalCoord1f = save_EvalCoord1f; - vfmt->EvalCoord1fv = save_EvalCoord1fv; - vfmt->EvalCoord2f = save_EvalCoord2f; - vfmt->EvalCoord2fv = save_EvalCoord2fv; - vfmt->EvalPoint1 = save_EvalPoint1; - vfmt->EvalPoint2 = save_EvalPoint2; + + _MESA_INIT_EVAL_VTXFMT(vfmt, save_); + vfmt->FogCoordfEXT = save_FogCoordfEXT; vfmt->FogCoordfvEXT = save_FogCoordfvEXT; vfmt->Indexf = save_Indexf; @@ -9356,8 +9353,6 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt) vfmt->VertexAttrib4fARB = save_VertexAttrib4fARB; vfmt->VertexAttrib4fvARB = save_VertexAttrib4fvARB; - vfmt->EvalMesh1 = _mesa_save_EvalMesh1; - vfmt->EvalMesh2 = _mesa_save_EvalMesh2; vfmt->Rectf = save_Rectf; /* The driver is required to implement these as diff --git a/src/mesa/main/eval.c b/src/mesa/main/eval.c index 3f89f9c1ea..95d6e23187 100644 --- a/src/mesa/main/eval.c +++ b/src/mesa/main/eval.c @@ -44,6 +44,10 @@ #include "eval.h" #include "macros.h" #include "mtypes.h" +#include "glapi/dispatch.h" + + +#if FEATURE_evaluators /* @@ -417,7 +421,7 @@ map1(GLenum target, GLfloat u1, GLfloat u2, GLint ustride, -void GLAPIENTRY +static void GLAPIENTRY _mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points ) { @@ -425,7 +429,7 @@ _mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, } -void GLAPIENTRY +static void GLAPIENTRY _mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points ) { @@ -516,7 +520,7 @@ map2( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, } -void GLAPIENTRY +static void GLAPIENTRY _mesa_Map2f( GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, @@ -527,7 +531,7 @@ _mesa_Map2f( GLenum target, } -void GLAPIENTRY +static void GLAPIENTRY _mesa_Map2d( GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, @@ -539,7 +543,7 @@ _mesa_Map2d( GLenum target, -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) { GET_CURRENT_CONTEXT(ctx); @@ -604,7 +608,7 @@ _mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) { GET_CURRENT_CONTEXT(ctx); @@ -669,7 +673,7 @@ _mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) { GET_CURRENT_CONTEXT(ctx); @@ -735,7 +739,7 @@ _mesa_GetMapiv( GLenum target, GLenum query, GLint *v ) -void GLAPIENTRY +static void GLAPIENTRY _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) { GET_CURRENT_CONTEXT(ctx); @@ -753,14 +757,14 @@ _mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ) } -void GLAPIENTRY +static void GLAPIENTRY _mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 ) { _mesa_MapGrid1f( un, (GLfloat) u1, (GLfloat) u2 ); } -void GLAPIENTRY +static void GLAPIENTRY _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2 ) { @@ -788,7 +792,7 @@ _mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, } -void GLAPIENTRY +static void GLAPIENTRY _mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2 ) { @@ -797,6 +801,41 @@ _mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, } +void +_mesa_install_eval_vtxfmt(struct _glapi_table *disp, + const GLvertexformat *vfmt) +{ + SET_EvalCoord1f(disp, vfmt->EvalCoord1f); + SET_EvalCoord1fv(disp, vfmt->EvalCoord1fv); + SET_EvalCoord2f(disp, vfmt->EvalCoord2f); + SET_EvalCoord2fv(disp, vfmt->EvalCoord2fv); + SET_EvalPoint1(disp, vfmt->EvalPoint1); + SET_EvalPoint2(disp, vfmt->EvalPoint2); + + SET_EvalMesh1(disp, vfmt->EvalMesh1); + SET_EvalMesh2(disp, vfmt->EvalMesh2); +} + + +void +_mesa_init_eval_dispatch(struct _glapi_table *disp) +{ + SET_GetMapdv(disp, _mesa_GetMapdv); + SET_GetMapfv(disp, _mesa_GetMapfv); + SET_GetMapiv(disp, _mesa_GetMapiv); + SET_Map1d(disp, _mesa_Map1d); + SET_Map1f(disp, _mesa_Map1f); + SET_Map2d(disp, _mesa_Map2d); + SET_Map2f(disp, _mesa_Map2f); + SET_MapGrid1d(disp, _mesa_MapGrid1d); + SET_MapGrid1f(disp, _mesa_MapGrid1f); + SET_MapGrid2d(disp, _mesa_MapGrid2d); + SET_MapGrid2f(disp, _mesa_MapGrid2f); +} + + +#endif /* FEATURE_evaluators */ + /**********************************************************************/ /***** Initialization *****/ diff --git a/src/mesa/main/eval.h b/src/mesa/main/eval.h index b3ff0a96f8..ffd1bab76d 100644 --- a/src/mesa/main/eval.h +++ b/src/mesa/main/eval.h @@ -37,13 +37,22 @@ #define EVAL_H -#include "mtypes.h" +#include "main/mtypes.h" -#if _HAVE_FULL_GL -extern void _mesa_init_eval( GLcontext *ctx ); -extern void _mesa_free_eval_data( GLcontext *ctx ); +#if FEATURE_evaluators +#define _MESA_INIT_EVAL_VTXFMT(vfmt, impl) \ + do { \ + (vfmt)->EvalCoord1f = impl ## EvalCoord1f; \ + (vfmt)->EvalCoord1fv = impl ## EvalCoord1fv; \ + (vfmt)->EvalCoord2f = impl ## EvalCoord2f; \ + (vfmt)->EvalCoord2fv = impl ## EvalCoord2fv; \ + (vfmt)->EvalPoint1 = impl ## EvalPoint1; \ + (vfmt)->EvalPoint2 = impl ## EvalPoint2; \ + (vfmt)->EvalMesh1 = impl ## EvalMesh1; \ + (vfmt)->EvalMesh2 = impl ## EvalMesh2; \ + } while (0) extern GLuint _mesa_evaluator_components( GLenum target ); @@ -70,59 +79,32 @@ extern GLfloat *_mesa_copy_map_points2d(GLenum target, GLint vstride, GLint vorder, const GLdouble *points ); +extern void +_mesa_install_eval_vtxfmt(struct _glapi_table *disp, + const GLvertexformat *vfmt); +extern void +_mesa_init_eval_dispatch(struct _glapi_table *disp); -extern void GLAPIENTRY -_mesa_Map1f( GLenum target, GLfloat u1, GLfloat u2, GLint stride, - GLint order, const GLfloat *points ); - -extern void GLAPIENTRY -_mesa_Map2f( GLenum target, - GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, - GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, - const GLfloat *points ); - -extern void GLAPIENTRY -_mesa_Map1d( GLenum target, GLdouble u1, GLdouble u2, GLint stride, - GLint order, const GLdouble *points ); - -extern void GLAPIENTRY -_mesa_Map2d( GLenum target, - GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, - GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, - const GLdouble *points ); - -extern void GLAPIENTRY -_mesa_MapGrid1f( GLint un, GLfloat u1, GLfloat u2 ); +#else /* FEATURE_evaluators */ -extern void GLAPIENTRY -_mesa_MapGrid1d( GLint un, GLdouble u1, GLdouble u2 ); +#define _MESA_INIT_EVAL_VTXFMT(vfmt, impl) do { } while (0) -extern void GLAPIENTRY -_mesa_MapGrid2f( GLint un, GLfloat u1, GLfloat u2, - GLint vn, GLfloat v1, GLfloat v2 ); +static INLINE void +_mesa_install_eval_vtxfmt(struct _glapi_table *disp, + const GLvertexformat *vfmt) +{ +} -extern void GLAPIENTRY -_mesa_MapGrid2d( GLint un, GLdouble u1, GLdouble u2, - GLint vn, GLdouble v1, GLdouble v2 ); +static INLINE void +_mesa_init_eval_dispatch(struct _glapi_table *disp) +{ +} -extern void GLAPIENTRY -_mesa_GetMapdv( GLenum target, GLenum query, GLdouble *v ); +#endif /* FEATURE_evaluators */ -extern void GLAPIENTRY -_mesa_GetMapfv( GLenum target, GLenum query, GLfloat *v ); - -extern void GLAPIENTRY -_mesa_GetMapiv( GLenum target, GLenum query, GLint *v ); - -#else - -/** No-op */ -#define _mesa_init_eval( c ) ((void)0) - -/** No-op */ -#define _mesa_free_eval_data( c ) ((void)0) +extern void _mesa_init_eval( GLcontext *ctx ); +extern void _mesa_free_eval_data( GLcontext *ctx ); -#endif -#endif +#endif /* EVAL_H */ diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c index de9479d6b0..c35e4dabe3 100644 --- a/src/mesa/main/vtxfmt.c +++ b/src/mesa/main/vtxfmt.c @@ -34,6 +34,7 @@ #include "mtypes.h" #include "state.h" #include "vtxfmt.h" +#include "eval.h" /* The neutral vertex format. This wraps all tnl module functions, @@ -90,12 +91,9 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) SET_Color4f(tab, vfmt->Color4f); SET_Color4fv(tab, vfmt->Color4fv); SET_EdgeFlag(tab, vfmt->EdgeFlag); - SET_EvalCoord1f(tab, vfmt->EvalCoord1f); - SET_EvalCoord1fv(tab, vfmt->EvalCoord1fv); - SET_EvalCoord2f(tab, vfmt->EvalCoord2f); - SET_EvalCoord2fv(tab, vfmt->EvalCoord2fv); - SET_EvalPoint1(tab, vfmt->EvalPoint1); - SET_EvalPoint2(tab, vfmt->EvalPoint2); + + _mesa_install_eval_vtxfmt(tab, vfmt); + SET_FogCoordfEXT(tab, vfmt->FogCoordfEXT); SET_FogCoordfvEXT(tab, vfmt->FogCoordfvEXT); SET_Indexf(tab, vfmt->Indexf); @@ -139,9 +137,6 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) SET_DrawElementsBaseVertex(tab, vfmt->DrawElementsBaseVertex); SET_DrawRangeElementsBaseVertex(tab, vfmt->DrawRangeElementsBaseVertex); SET_MultiDrawElementsBaseVertex(tab, vfmt->MultiDrawElementsBaseVertex); - SET_EvalMesh1(tab, vfmt->EvalMesh1); - SET_EvalMesh2(tab, vfmt->EvalMesh2); - ASSERT(tab->EvalMesh2); /* GL_NV_vertex_program */ SET_VertexAttrib1fNV(tab, vfmt->VertexAttrib1fNV); diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 238beee030..cfe8be77e5 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -38,6 +38,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #if FEATURE_dlist #include "main/dlist.h" #endif +#include "main/eval.h" #include "main/state.h" #include "main/light.h" #include "main/api_arrayelt.h" @@ -392,6 +393,7 @@ do { \ +#if FEATURE_evaluators /* Eval */ static void GLAPIENTRY vbo_exec_EvalCoord1f( GLfloat u ) @@ -485,6 +487,12 @@ static void GLAPIENTRY vbo_exec_EvalPoint2( GLint i, GLint j ) vbo_exec_EvalCoord2f( u, v ); } +/* use noop eval mesh */ +#define vbo_exec_EvalMesh1 _mesa_noop_EvalMesh1 +#define vbo_exec_EvalMesh2 _mesa_noop_EvalMesh2 + +#endif /* FEATURE_evaluators */ + /* Build a list of primitives on the fly. Keep * ctx->Driver.CurrentExecPrimitive uptodate as well. @@ -565,17 +573,10 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec ) vfmt->CallLists = _mesa_CallLists; #endif vfmt->End = vbo_exec_End; - vfmt->EvalCoord1f = vbo_exec_EvalCoord1f; - vfmt->EvalCoord1fv = vbo_exec_EvalCoord1fv; - vfmt->EvalCoord2f = vbo_exec_EvalCoord2f; - vfmt->EvalCoord2fv = vbo_exec_EvalCoord2fv; - vfmt->EvalPoint1 = vbo_exec_EvalPoint1; - vfmt->EvalPoint2 = vbo_exec_EvalPoint2; - vfmt->Rectf = _mesa_noop_Rectf; - vfmt->EvalMesh1 = _mesa_noop_EvalMesh1; - vfmt->EvalMesh2 = _mesa_noop_EvalMesh2; + _MESA_INIT_EVAL_VTXFMT(vfmt, vbo_exec_); + vfmt->Rectf = _mesa_noop_Rectf; /* from attrib_tmp.h: */ diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index 6e11344380..611460dc7b 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -72,6 +72,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/context.h" #include "main/dlist.h" #include "main/enums.h" +#include "main/eval.h" #include "main/macros.h" #include "main/api_noop.h" #include "main/api_validate.h" @@ -1050,18 +1051,12 @@ static void _save_vtxfmt_init( GLcontext *ctx ) */ vfmt->CallList = _save_CallList; /* inside begin/end */ vfmt->CallLists = _save_CallLists; /* inside begin/end */ - vfmt->EvalCoord1f = _save_EvalCoord1f; - vfmt->EvalCoord1fv = _save_EvalCoord1fv; - vfmt->EvalCoord2f = _save_EvalCoord2f; - vfmt->EvalCoord2fv = _save_EvalCoord2fv; - vfmt->EvalPoint1 = _save_EvalPoint1; - vfmt->EvalPoint2 = _save_EvalPoint2; + + _MESA_INIT_EVAL_VTXFMT(vfmt, _save_); /* These are all errors as we at least know we are in some sort of * begin/end pair: */ - vfmt->EvalMesh1 = _save_EvalMesh1; - vfmt->EvalMesh2 = _save_EvalMesh2; vfmt->Begin = _save_Begin; vfmt->Rectf = _save_Rectf; vfmt->DrawArrays = _save_DrawArrays; -- cgit v1.2.3 From a73ba2d31b87e974f6846a8aaced704634f6f657 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 9 Sep 2009 15:00:08 +0800 Subject: mesa/main: Make FEATURE_dlist follow feature conventions. As shown in mfeatures.h, this allows users of dlist.h to work without knowing if the feature is available. --- src/mesa/main/api_exec.c | 13 +------ src/mesa/main/api_noop.c | 9 ++--- src/mesa/main/context.c | 8 ++--- src/mesa/main/dlist.c | 64 ++++++++++++++++++++++++++--------- src/mesa/main/dlist.h | 82 ++++++++++++++++++++++++++------------------- src/mesa/main/shared.c | 4 --- src/mesa/main/vtxfmt.c | 6 ++-- src/mesa/vbo/vbo_exec_api.c | 7 +--- src/mesa/vbo/vbo_save_api.c | 3 +- 9 files changed, 110 insertions(+), 86 deletions(-) (limited to 'src') diff --git a/src/mesa/main/api_exec.c b/src/mesa/main/api_exec.c index fc4de3c14c..1559984f43 100644 --- a/src/mesa/main/api_exec.c +++ b/src/mesa/main/api_exec.c @@ -54,9 +54,7 @@ #include "context.h" #include "convolve.h" #include "depth.h" -#if FEATURE_dlist #include "dlist.h" -#endif #include "drawpix.h" #include "rastpos.h" #include "enable.h" @@ -179,17 +177,8 @@ _mesa_init_exec_table(struct _glapi_table *exec) SET_Viewport(exec, _mesa_Viewport); _mesa_init_accum_dispatch(exec); + _mesa_init_dlist_dispatch(exec); -#if FEATURE_dlist - SET_CallList(exec, _mesa_CallList); - SET_CallLists(exec, _mesa_CallLists); - SET_DeleteLists(exec, _mesa_DeleteLists); - SET_EndList(exec, _mesa_EndList); - SET_GenLists(exec, _mesa_GenLists); - SET_IsList(exec, _mesa_IsList); - SET_ListBase(exec, _mesa_ListBase); - SET_NewList(exec, _mesa_NewList); -#endif SET_ClearDepth(exec, _mesa_ClearDepth); SET_ClearIndex(exec, _mesa_ClearIndex); SET_ClipPlane(exec, _mesa_ClipPlane); diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c index 23c52177d8..06c287fd19 100644 --- a/src/mesa/main/api_noop.c +++ b/src/mesa/main/api_noop.c @@ -30,9 +30,7 @@ #include "context.h" #include "light.h" #include "macros.h" -#if FEATURE_dlist #include "dlist.h" -#endif #include "eval.h" #include "glapi/dispatch.h" @@ -996,10 +994,9 @@ _mesa_noop_vtxfmt_init( GLvertexformat *vfmt ) _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_); vfmt->Begin = _mesa_noop_Begin; -#if FEATURE_dlist - vfmt->CallList = _mesa_CallList; - vfmt->CallLists = _mesa_CallLists; -#endif + + _MESA_INIT_DLIST_VTXFMT(vfmt, _mesa_); + vfmt->Color3f = _mesa_noop_Color3f; vfmt->Color3fv = _mesa_noop_Color3fv; vfmt->Color4f = _mesa_noop_Color4f; diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 03ee7fb04d..11b1d24453 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -91,9 +91,7 @@ #include "cpuinfo.h" #include "debug.h" #include "depth.h" -#if FEATURE_dlist #include "dlist.h" -#endif #include "eval.h" #include "enums.h" #include "extensions.h" @@ -670,9 +668,7 @@ init_attrib_groups(GLcontext *ctx) _mesa_init_current( ctx ); _mesa_init_depth( ctx ); _mesa_init_debug( ctx ); -#if FEATURE_dlist _mesa_init_display_list( ctx ); -#endif _mesa_init_eval( ctx ); _mesa_init_fbobjects( ctx ); _mesa_init_feedback( ctx ); @@ -869,10 +865,12 @@ _mesa_initialize_context(GLcontext *ctx, _mesa_init_exec_table(ctx->Exec); #endif ctx->CurrentDispatch = ctx->Exec; + #if FEATURE_dlist - _mesa_init_dlist_table(ctx->Save); + _mesa_init_save_table(ctx->Save); _mesa_install_save_vtxfmt( ctx, &ctx->ListState.ListVtxfmt ); #endif + /* Neutral tnl module stuff */ _mesa_init_exec_vtxfmt( ctx ); ctx->TnlModule.Current = NULL; diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 189743e5f5..6354ed7474 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -73,6 +73,7 @@ #include "texstate.h" #include "mtypes.h" #include "varray.h" +#include "vtxfmt.h" #if FEATURE_ARB_vertex_program || FEATURE_ARB_fragment_program #include "shader/arbprogram.h" #include "shader/program.h" @@ -438,6 +439,10 @@ typedef union gl_dlist_node Node; */ static GLuint InstSize[OPCODE_END_OF_LIST + 1]; + +#if FEATURE_dlist + + void mesa_print_display_list(GLuint list); @@ -1047,8 +1052,8 @@ static void invalidate_saved_current_state( GLcontext *ctx ) ctx->Driver.CurrentSavePrimitive = PRIM_UNKNOWN; } -void GLAPIENTRY -_mesa_save_CallList(GLuint list) +static void GLAPIENTRY +save_CallList(GLuint list) { GET_CURRENT_CONTEXT(ctx); Node *n; @@ -1070,8 +1075,8 @@ _mesa_save_CallList(GLuint list) } -void GLAPIENTRY -_mesa_save_CallLists(GLsizei num, GLenum type, const GLvoid * lists) +static void GLAPIENTRY +save_CallLists(GLsizei num, GLenum type, const GLvoid * lists) { GET_CURRENT_CONTEXT(ctx); GLint i; @@ -7426,7 +7431,7 @@ execute_list(GLcontext *ctx, GLuint list) /** * Test if a display list number is valid. */ -GLboolean GLAPIENTRY +static GLboolean GLAPIENTRY _mesa_IsList(GLuint list) { GET_CURRENT_CONTEXT(ctx); @@ -7439,7 +7444,7 @@ _mesa_IsList(GLuint list) /** * Delete a sequence of consecutive display lists. */ -void GLAPIENTRY +static void GLAPIENTRY _mesa_DeleteLists(GLuint list, GLsizei range) { GET_CURRENT_CONTEXT(ctx); @@ -7461,7 +7466,7 @@ _mesa_DeleteLists(GLuint list, GLsizei range) * Return a display list number, n, such that lists n through n+range-1 * are free. */ -GLuint GLAPIENTRY +static GLuint GLAPIENTRY _mesa_GenLists(GLsizei range) { GET_CURRENT_CONTEXT(ctx); @@ -7501,7 +7506,7 @@ _mesa_GenLists(GLsizei range) /** * Begin a new display list. */ -void GLAPIENTRY +static void GLAPIENTRY _mesa_NewList(GLuint name, GLenum mode) { GET_CURRENT_CONTEXT(ctx); @@ -7551,7 +7556,7 @@ _mesa_NewList(GLuint name, GLenum mode) /** * End definition of current display list. */ -void GLAPIENTRY +static void GLAPIENTRY _mesa_EndList(void) { GET_CURRENT_CONTEXT(ctx); @@ -7685,7 +7690,7 @@ _mesa_CallLists(GLsizei n, GLenum type, const GLvoid * lists) /** * Set the offset added to list numbers in glCallLists. */ -void GLAPIENTRY +static void GLAPIENTRY _mesa_ListBase(GLuint base) { GET_CURRENT_CONTEXT(ctx); @@ -8420,7 +8425,7 @@ exec_MultiModeDrawElementsIBM(const GLenum * mode, * struct. */ void -_mesa_init_dlist_table(struct _glapi_table *table) +_mesa_init_save_table(struct _glapi_table *table) { _mesa_loopback_init_api_table(table); @@ -8429,8 +8434,8 @@ _mesa_init_dlist_table(struct _glapi_table *table) SET_AlphaFunc(table, save_AlphaFunc); SET_Bitmap(table, save_Bitmap); SET_BlendFunc(table, save_BlendFunc); - SET_CallList(table, _mesa_save_CallList); - SET_CallLists(table, _mesa_save_CallLists); + SET_CallList(table, save_CallList); + SET_CallLists(table, save_CallLists); SET_Clear(table, save_Clear); SET_ClearAccum(table, save_ClearAccum); SET_ClearColor(table, save_ClearColor); @@ -9294,8 +9299,9 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt) _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_); vfmt->Begin = save_Begin; - vfmt->CallList = _mesa_save_CallList; - vfmt->CallLists = _mesa_save_CallLists; + + _MESA_INIT_DLIST_VTXFMT(vfmt, save_); + vfmt->Color3f = save_Color3f; vfmt->Color3fv = save_Color3fv; vfmt->Color4f = save_Color4f; @@ -9373,6 +9379,32 @@ _mesa_save_vtxfmt_init(GLvertexformat * vfmt) } +void +_mesa_install_dlist_vtxfmt(struct _glapi_table *disp, + const GLvertexformat *vfmt) +{ + SET_CallList(disp, vfmt->CallList); + SET_CallLists(disp, vfmt->CallLists); +} + + +void _mesa_init_dlist_dispatch(struct _glapi_table *disp) +{ + SET_CallList(disp, _mesa_CallList); + SET_CallLists(disp, _mesa_CallLists); + + SET_DeleteLists(disp, _mesa_DeleteLists); + SET_EndList(disp, _mesa_EndList); + SET_GenLists(disp, _mesa_GenLists); + SET_IsList(disp, _mesa_IsList); + SET_ListBase(disp, _mesa_ListBase); + SET_NewList(disp, _mesa_NewList); +} + + +#endif /* FEATURE_dlist */ + + /** * Initialize display list state for given context. */ @@ -9397,5 +9429,7 @@ _mesa_init_display_list(GLcontext *ctx) /* Display List group */ ctx->List.ListBase = 0; +#if FEATURE_dlist _mesa_save_vtxfmt_init(&ctx->ListState.ListVtxfmt); +#endif } diff --git a/src/mesa/main/dlist.h b/src/mesa/main/dlist.h index ab7ec2c8db..af36991d5e 100644 --- a/src/mesa/main/dlist.h +++ b/src/mesa/main/dlist.h @@ -33,41 +33,34 @@ #define DLIST_H -#include "mtypes.h" +#include "main/mtypes.h" -#if _HAVE_FULL_GL +#if FEATURE_dlist -extern void -_mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist); +#define _MESA_INIT_DLIST_FUNCTIONS(driver, impl) \ + do { \ + (driver)->NewList = impl ## NewList; \ + (driver)->EndList = impl ## EndList; \ + (driver)->BeginCallList = impl ## BeginCallList; \ + (driver)->EndCallList = impl ## EndCallList; \ + (driver)->SaveFlushVertices = impl ## SaveFlushVertices; \ + (driver)->NotifySaveBegin = impl ## NotifyBegin; \ + } while (0) + +#define _MESA_INIT_DLIST_VTXFMT(vfmt, impl) \ + do { \ + (vfmt)->CallList = impl ## CallList; \ + (vfmt)->CallLists = impl ## CallLists; \ + } while (0) extern void GLAPIENTRY _mesa_CallList( GLuint list ); extern void GLAPIENTRY _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *lists ); -extern void GLAPIENTRY _mesa_DeleteLists( GLuint list, GLsizei range ); - -extern void GLAPIENTRY _mesa_EndList( void ); - -extern GLuint GLAPIENTRY _mesa_GenLists( GLsizei range ); - -extern GLboolean GLAPIENTRY _mesa_IsList( GLuint list ); - -extern void GLAPIENTRY _mesa_ListBase( GLuint base ); - -extern void GLAPIENTRY _mesa_NewList( GLuint list, GLenum mode ); - -extern void GLAPIENTRY _mesa_save_CallLists( GLsizei n, GLenum type, const GLvoid *lists ); - -extern void GLAPIENTRY _mesa_save_CallList( GLuint list ); - - - -extern void _mesa_init_dlist_table( struct _glapi_table *table ); extern void _mesa_compile_error( GLcontext *ctx, GLenum error, const char *s ); - extern void *_mesa_alloc_instruction(GLcontext *ctx, GLuint opcode, GLuint sz); extern GLint _mesa_alloc_opcode( GLcontext *ctx, GLuint sz, @@ -75,22 +68,43 @@ extern GLint _mesa_alloc_opcode( GLcontext *ctx, GLuint sz, void (*destroy)( GLcontext *, void * ), void (*print)( GLcontext *, void * ) ); -extern void _mesa_init_display_list( GLcontext * ctx ); +extern void _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist); extern void _mesa_save_vtxfmt_init( GLvertexformat *vfmt ); +extern void _mesa_init_save_table( struct _glapi_table *table ); + +extern void _mesa_install_dlist_vtxfmt(struct _glapi_table *disp, + const GLvertexformat *vfmt); + +extern void _mesa_init_dlist_dispatch(struct _glapi_table *disp); -#else +#else /* FEATURE_dlist */ -/** No-op */ -#define _mesa_init_dlist_table(t,ts) ((void)0) +#define _MESA_INIT_DLIST_FUNCTIONS(driver, impl) do { } while (0) +#define _MESA_INIT_DLIST_VTXFMT(vfmt, impl) do { } while (0) -/** No-op */ -#define _mesa_init_display_list(c) ((void)0) +static INLINE void +_mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist) +{ + /* there should be no list to delete */ + ASSERT_NO_FEATURE(); +} -/** No-op */ -#define _mesa_save_vtxfmt_init(v) ((void)0) +static INLINE void +_mesa_install_dlist_vtxfmt(struct _glapi_table *disp, + const GLvertexformat *vfmt) +{ +} + +static INLINE void +_mesa_init_dlist_dispatch(struct _glapi_table *disp) +{ +} + +#endif /* FEATURE_dlist */ + +extern void _mesa_init_display_list( GLcontext * ctx ); -#endif -#endif +#endif /* DLIST_H */ diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c index 643ad3354e..4d01e8abc6 100644 --- a/src/mesa/main/shared.c +++ b/src/mesa/main/shared.c @@ -37,9 +37,7 @@ #include "shared.h" #include "shader/program.h" #include "shader/shader_api.h" -#if FEATURE_dlist #include "dlist.h" -#endif #if FEATURE_ATI_fragment_shader #include "shader/atifragshader.h" #endif @@ -143,11 +141,9 @@ _mesa_alloc_shared_state(GLcontext *ctx) static void delete_displaylist_cb(GLuint id, void *data, void *userData) { -#if FEATURE_dlist struct gl_display_list *list = (struct gl_display_list *) data; GLcontext *ctx = (GLcontext *) userData; _mesa_delete_list(ctx, list); -#endif } diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c index c35e4dabe3..8336ff34d2 100644 --- a/src/mesa/main/vtxfmt.c +++ b/src/mesa/main/vtxfmt.c @@ -35,6 +35,7 @@ #include "state.h" #include "vtxfmt.h" #include "eval.h" +#include "dlist.h" /* The neutral vertex format. This wraps all tnl module functions, @@ -125,8 +126,9 @@ install_vtxfmt( struct _glapi_table *tab, const GLvertexformat *vfmt ) SET_Vertex3fv(tab, vfmt->Vertex3fv); SET_Vertex4f(tab, vfmt->Vertex4f); SET_Vertex4fv(tab, vfmt->Vertex4fv); - SET_CallList(tab, vfmt->CallList); - SET_CallLists(tab, vfmt->CallLists); + + _mesa_install_dlist_vtxfmt(tab, vfmt); + SET_Begin(tab, vfmt->Begin); SET_End(tab, vfmt->End); SET_Rectf(tab, vfmt->Rectf); diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index cfe8be77e5..3eb85789fa 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -35,9 +35,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/context.h" #include "main/macros.h" #include "main/vtxfmt.h" -#if FEATURE_dlist #include "main/dlist.h" -#endif #include "main/eval.h" #include "main/state.h" #include "main/light.h" @@ -568,12 +566,9 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec ) _MESA_INIT_ARRAYELT_VTXFMT(vfmt, _ae_); vfmt->Begin = vbo_exec_Begin; -#if FEATURE_dlist - vfmt->CallList = _mesa_CallList; - vfmt->CallLists = _mesa_CallLists; -#endif vfmt->End = vbo_exec_End; + _MESA_INIT_DLIST_VTXFMT(vfmt, _mesa_); _MESA_INIT_EVAL_VTXFMT(vfmt, vbo_exec_); vfmt->Rectf = _mesa_noop_Rectf; diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index 611460dc7b..4da248e2b8 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -1049,8 +1049,7 @@ static void _save_vtxfmt_init( GLcontext *ctx ) /* This will all require us to fallback to saving the list as opcodes: */ - vfmt->CallList = _save_CallList; /* inside begin/end */ - vfmt->CallLists = _save_CallLists; /* inside begin/end */ + _MESA_INIT_DLIST_VTXFMT(vfmt, _save_); /* inside begin/end */ _MESA_INIT_EVAL_VTXFMT(vfmt, _save_); -- cgit v1.2.3 From cef97267d696d37f4dccb22951499ca25d5d87ad Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 12 Sep 2009 18:59:13 +0800 Subject: mesa/main: New feature FEATURE_beginend. This feature corresponds to the Begin/End paradigm. Disabling this feature also eliminates the use of GLvertexformat completely. --- src/mesa/main/api_loopback.c | 7 ++++ src/mesa/main/api_loopback.h | 16 ++++++-- src/mesa/main/api_noop.c | 6 +++ src/mesa/main/api_noop.h | 9 +++-- src/mesa/main/mfeatures.h | 4 +- src/mesa/main/vtxfmt.c | 6 +++ src/mesa/main/vtxfmt.h | 28 ++++++++++++- src/mesa/vbo/vbo_exec.h | 18 +++++++++ src/mesa/vbo/vbo_exec_api.c | 94 +++++++++++++++++++++++++++++++++++++++++++- src/mesa/vbo/vbo_exec_draw.c | 6 +++ 10 files changed, 184 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/mesa/main/api_loopback.c b/src/mesa/main/api_loopback.c index 0e3f5ff957..3d466ac44a 100644 --- a/src/mesa/main/api_loopback.c +++ b/src/mesa/main/api_loopback.c @@ -77,6 +77,10 @@ #define FOGCOORDF(x) CALL_FogCoordfEXT(GET_DISPATCH(), (x)) #define SECONDARYCOLORF(a,b,c) CALL_SecondaryColor3fEXT(GET_DISPATCH(), (a,b,c)) + +#if FEATURE_beginend + + static void GLAPIENTRY loopback_Color3b_f( GLbyte red, GLbyte green, GLbyte blue ) { @@ -1655,3 +1659,6 @@ _mesa_loopback_init_api_table( struct _glapi_table *dest ) SET_VertexAttrib4NusvARB(dest, loopback_VertexAttrib4NusvARB); SET_VertexAttrib4NuivARB(dest, loopback_VertexAttrib4NuivARB); } + + +#endif /* FEATURE_beginend */ diff --git a/src/mesa/main/api_loopback.h b/src/mesa/main/api_loopback.h index 6f85bbc1d9..3140eb515e 100644 --- a/src/mesa/main/api_loopback.h +++ b/src/mesa/main/api_loopback.h @@ -27,11 +27,19 @@ #ifndef API_LOOPBACK_H #define API_LOOPBACK_H -#include "glheader.h" +#include "main/mtypes.h" - -struct _glapi_table; +#if FEATURE_beginend extern void _mesa_loopback_init_api_table( struct _glapi_table *dest ); -#endif +#else /* FEATURE_beginend */ + +static INLINE void +_mesa_loopback_init_api_table( struct _glapi_table *dest ) +{ +} + +#endif /* FEATURE_beginend */ + +#endif /* API_LOOPBACK_H */ diff --git a/src/mesa/main/api_noop.c b/src/mesa/main/api_noop.c index 06c287fd19..f72f957300 100644 --- a/src/mesa/main/api_noop.c +++ b/src/mesa/main/api_noop.c @@ -43,6 +43,9 @@ */ +#if FEATURE_beginend + + static void GLAPIENTRY _mesa_noop_EdgeFlag( GLboolean b ) { GET_CURRENT_CONTEXT(ctx); @@ -1064,3 +1067,6 @@ _mesa_noop_vtxfmt_init( GLvertexformat *vfmt ) vfmt->DrawRangeElementsBaseVertex = _mesa_noop_DrawRangeElementsBaseVertex; vfmt->MultiDrawElementsBaseVertex = _mesa_noop_MultiDrawElementsBaseVertex; } + + +#endif /* FEATURE_beginend */ diff --git a/src/mesa/main/api_noop.h b/src/mesa/main/api_noop.h index 1150984d64..e7fd49bafb 100644 --- a/src/mesa/main/api_noop.h +++ b/src/mesa/main/api_noop.h @@ -25,8 +25,9 @@ #ifndef _API_NOOP_H #define _API_NOOP_H -#include "mtypes.h" -#include "context.h" +#include "main/mtypes.h" + +#if FEATURE_beginend extern void GLAPIENTRY _mesa_noop_Rectf(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2); @@ -54,4 +55,6 @@ _mesa_noop_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, extern void _mesa_noop_vtxfmt_init(GLvertexformat *vfmt); -#endif +#endif /* FEATURE_beginend */ + +#endif /* _API_NOOP_H */ diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index 27799771a5..c2fb8404b1 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -71,10 +71,12 @@ #define FEATURE_accum _HAVE_FULL_GL #define FEATURE_arrayelt _HAVE_FULL_GL #define FEATURE_attrib_stack _HAVE_FULL_GL +/* this disables vtxfmt, api_loopback, and api_noop completely */ +#define FEATURE_beginend _HAVE_FULL_GL #define FEATURE_colortable _HAVE_FULL_GL #define FEATURE_convolve _HAVE_FULL_GL #define FEATURE_dispatch _HAVE_FULL_GL -#define FEATURE_dlist (_HAVE_FULL_GL && FEATURE_arrayelt) +#define FEATURE_dlist (_HAVE_FULL_GL && FEATURE_arrayelt && FEATURE_beginend) #define FEATURE_draw_read_buffer _HAVE_FULL_GL #define FEATURE_drawpix _HAVE_FULL_GL #define FEATURE_evaluators _HAVE_FULL_GL diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c index 8336ff34d2..c9eea8ab83 100644 --- a/src/mesa/main/vtxfmt.c +++ b/src/mesa/main/vtxfmt.c @@ -38,6 +38,9 @@ #include "dlist.h" +#if FEATURE_beginend + + /* The neutral vertex format. This wraps all tnl module functions, * verifying that the currently-installed module is valid and then * installing the function pointers in a lazy fashion. It records the @@ -195,3 +198,6 @@ void _mesa_restore_exec_vtxfmt( GLcontext *ctx ) tnl->SwapCount = 0; } + + +#endif /* FEATURE_beginend */ diff --git a/src/mesa/main/vtxfmt.h b/src/mesa/main/vtxfmt.h index 76f108e023..fb6c23abe9 100644 --- a/src/mesa/main/vtxfmt.h +++ b/src/mesa/main/vtxfmt.h @@ -33,6 +33,8 @@ #ifndef _VTXFMT_H_ #define _VTXFMT_H_ +#if FEATURE_beginend + extern void _mesa_init_exec_vtxfmt( GLcontext *ctx ); extern void _mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ); @@ -40,4 +42,28 @@ extern void _mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfm extern void _mesa_restore_exec_vtxfmt( GLcontext *ctx ); -#endif +#else /* FEATURE_beginend */ + +static INLINE void +_mesa_init_exec_vtxfmt( GLcontext *ctx ) +{ +} + +static INLINE void +_mesa_install_exec_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ) +{ +} + +static INLINE void +_mesa_install_save_vtxfmt( GLcontext *ctx, const GLvertexformat *vfmt ) +{ +} + +static INLINE void +_mesa_restore_exec_vtxfmt( GLcontext *ctx ) +{ +} + +#endif /* FEATURE_beginend */ + +#endif /* _VTXFMT_H_ */ diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h index e0f44892cf..516be0995b 100644 --- a/src/mesa/vbo/vbo_exec.h +++ b/src/mesa/vbo/vbo_exec.h @@ -161,8 +161,26 @@ void vbo_exec_array_destroy( struct vbo_exec_context *exec ); void vbo_exec_vtx_init( struct vbo_exec_context *exec ); void vbo_exec_vtx_destroy( struct vbo_exec_context *exec ); + +#if FEATURE_beginend + void vbo_exec_vtx_flush( struct vbo_exec_context *exec, GLboolean unmap ); void vbo_exec_vtx_map( struct vbo_exec_context *exec ); + +#else /* FEATURE_beginend */ + +static INLINE void +vbo_exec_vtx_flush( struct vbo_exec_context *exec, GLboolean unmap ) +{ +} + +static INLINE void +vbo_exec_vtx_map( struct vbo_exec_context *exec ) +{ +} + +#endif /* FEATURE_beginend */ + void vbo_exec_vtx_wrap( struct vbo_exec_context *exec ); void vbo_exec_eval_update( struct vbo_exec_context *exec ); diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 3eb85789fa..bfa6d76886 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -348,7 +348,7 @@ static void vbo_exec_fixup_vertex( GLcontext *ctx, } - +#if FEATURE_beginend /* */ @@ -635,6 +635,98 @@ static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec ) } +#else /* FEATURE_beginend */ + + +#define ATTR( A, N, V0, V1, V2, V3 ) \ +do { \ + struct vbo_exec_context *exec = &vbo_context(ctx)->exec; \ + \ + /* FLUSH_UPDATE_CURRENT needs to be set manually */ \ + exec->ctx->Driver.NeedFlush |= FLUSH_UPDATE_CURRENT; \ + \ + if (exec->vtx.active_sz[A] != N) \ + vbo_exec_fixup_vertex(ctx, A, N); \ + \ + { \ + GLfloat *dest = exec->vtx.attrptr[A]; \ + if (N>0) dest[0] = V0; \ + if (N>1) dest[1] = V1; \ + if (N>2) dest[2] = V2; \ + if (N>3) dest[3] = V3; \ + } \ +} while (0) + +#define ERROR() _mesa_error( ctx, GL_INVALID_ENUM, __FUNCTION__ ) +#define TAG(x) vbo_##x + +#include "vbo_attrib_tmp.h" + +static void vbo_exec_vtxfmt_init( struct vbo_exec_context *exec ) +{ + /* silence warnings */ + (void) vbo_Color3f; + (void) vbo_Color3fv; + (void) vbo_Color4f; + (void) vbo_Color4fv; + (void) vbo_FogCoordfEXT; + (void) vbo_FogCoordfvEXT; + (void) vbo_MultiTexCoord1f; + (void) vbo_MultiTexCoord1fv; + (void) vbo_MultiTexCoord2f; + (void) vbo_MultiTexCoord2fv; + (void) vbo_MultiTexCoord3f; + (void) vbo_MultiTexCoord3fv; + (void) vbo_MultiTexCoord4f; + (void) vbo_MultiTexCoord4fv; + (void) vbo_Normal3f; + (void) vbo_Normal3fv; + (void) vbo_SecondaryColor3fEXT; + (void) vbo_SecondaryColor3fvEXT; + (void) vbo_TexCoord1f; + (void) vbo_TexCoord1fv; + (void) vbo_TexCoord2f; + (void) vbo_TexCoord2fv; + (void) vbo_TexCoord3f; + (void) vbo_TexCoord3fv; + (void) vbo_TexCoord4f; + (void) vbo_TexCoord4fv; + (void) vbo_Vertex2f; + (void) vbo_Vertex2fv; + (void) vbo_Vertex3f; + (void) vbo_Vertex3fv; + (void) vbo_Vertex4f; + (void) vbo_Vertex4fv; + + (void) vbo_VertexAttrib1fARB; + (void) vbo_VertexAttrib1fvARB; + (void) vbo_VertexAttrib2fARB; + (void) vbo_VertexAttrib2fvARB; + (void) vbo_VertexAttrib3fARB; + (void) vbo_VertexAttrib3fvARB; + (void) vbo_VertexAttrib4fARB; + (void) vbo_VertexAttrib4fvARB; + + (void) vbo_VertexAttrib1fNV; + (void) vbo_VertexAttrib1fvNV; + (void) vbo_VertexAttrib2fNV; + (void) vbo_VertexAttrib2fvNV; + (void) vbo_VertexAttrib3fNV; + (void) vbo_VertexAttrib3fvNV; + (void) vbo_VertexAttrib4fNV; + (void) vbo_VertexAttrib4fvNV; + + (void) vbo_Materialfv; + + (void) vbo_EdgeFlag; + (void) vbo_Indexf; + (void) vbo_Indexfv; +} + + +#endif /* FEATURE_beginend */ + + /** * Tell the VBO module to use a real OpenGL vertex buffer object to * store accumulated immediate-mode vertex data. diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 0c258c535e..ee148df4a1 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -35,6 +35,9 @@ #include "vbo_context.h" +#if FEATURE_beginend + + static void vbo_exec_debug_verts( struct vbo_exec_context *exec ) { @@ -411,3 +414,6 @@ vbo_exec_vtx_flush( struct vbo_exec_context *exec, GLboolean unmap ) exec->vtx.prim_count = 0; exec->vtx.vert_count = 0; } + + +#endif /* FEATURE_beginend */ -- cgit v1.2.3 From 81a62edc088278e97288db7b17f6b485af8976b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Wed, 30 Sep 2009 18:01:46 +0200 Subject: st/xorg: Fix debug option function call typo. --- src/gallium/state_trackers/xorg/xorg_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 3dff8d859e..8c4cba035a 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -558,7 +558,7 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86SetBlackWhitePixels(pScreen); ms->exa = xorg_exa_init(pScrn); - ms->debug_fallback = debug_get_option_bool("XORG_DEBUG_FALLBACK", TRUE); + ms->debug_fallback = debug_get_bool_option("XORG_DEBUG_FALLBACK", TRUE); miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); -- cgit v1.2.3 From 49fbdd18ed738feaf73b7faba4d3577cd9cc3e59 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 12 Feb 2009 03:54:58 -0800 Subject: i965: Fix massive memory allocation for streaming texture usage. Once we've freed a miptree, we won't see any more state cache requests that would hit the things that pointed at it until we've let the miptree get released back into the BO cache to be reused. By leaving those surface state and binding table pointers that pointed at it around, we would end up with up to (500 * texture size) in memory uselessly consumed by the state cache. Bug #20057 Bug #23530 --- src/mesa/drivers/dri/i965/brw_state.h | 1 + src/mesa/drivers/dri/i965/brw_state_cache.c | 49 ++++++++++++++++++++++++++ src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 16 +++++++++ 3 files changed, 66 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index 5335eac895..d639656b9d 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -151,6 +151,7 @@ void brw_state_cache_check_size( struct brw_context *brw ); void brw_init_caches( struct brw_context *brw ); void brw_destroy_caches( struct brw_context *brw ); +void brw_state_cache_bo_delete(struct brw_cache *cache, dri_bo *bo); /*********************************************************************** * brw_state_batch.c diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c index e40d7a0416..f8e46aacf7 100644 --- a/src/mesa/drivers/dri/i965/brw_state_cache.c +++ b/src/mesa/drivers/dri/i965/brw_state_cache.c @@ -517,6 +517,55 @@ brw_clear_cache(struct brw_context *brw, struct brw_cache *cache) brw->state.dirty.cache |= ~0; } +/* Clear all entries from the cache that point to the given bo. + * + * This lets us release memory for reuse earlier for known-dead buffers, + * at the cost of walking the entire hash table. + */ +void +brw_state_cache_bo_delete(struct brw_cache *cache, dri_bo *bo) +{ + struct brw_cache_item **prev; + GLuint i; + + if (INTEL_DEBUG & DEBUG_STATE) + _mesa_printf("%s\n", __FUNCTION__); + + for (i = 0; i < cache->size; i++) { + for (prev = &cache->items[i]; *prev;) { + struct brw_cache_item *c = *prev; + int j; + + for (j = 0; j < c->nr_reloc_bufs; j++) { + if (c->reloc_bufs[j] == bo) + break; + } + + if (j != c->nr_reloc_bufs) { + + *prev = c->next; + + for (j = 0; j < c->nr_reloc_bufs; j++) + dri_bo_unreference(c->reloc_bufs[j]); + dri_bo_unreference(c->bo); + free((void *)c->key); + free(c); + cache->n_items--; + + /* Delete up the tree. Notably we're trying to get from + * a request to delete the surface, to deleting the surface state + * object, to deleting the binding table. We're slack and restart + * the deletion process when we do this because the other delete + * may kill our *prev. + */ + brw_state_cache_bo_delete(cache, c->bo); + prev = &cache->items[i]; + } else { + prev = &(*prev)->next; + } + } + } +} void brw_state_cache_check_size(struct brw_context *brw) diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index c985da5aa2..4f5101a312 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -29,6 +29,9 @@ #include "intel_mipmap_tree.h" #include "intel_regions.h" #include "intel_chipset.h" +#ifndef I915 +#include "brw_state.h" +#endif #include "main/enums.h" #define FILE_DEBUG_FLAG DEBUG_MIPTREE @@ -269,6 +272,19 @@ intel_miptree_release(struct intel_context *intel, DBG("%s deleting %p\n", __FUNCTION__, *mt); +#ifndef I915 + /* Free up cached binding tables holding a reference on our buffer, to + * avoid excessive memory consumption. + * + * This isn't as aggressive as we could be, as we'd like to do + * it from any time we free the last ref on a region. But intel_region.c + * is context-agnostic. Perhaps our constant state cache should be, as + * well. + */ + brw_state_cache_bo_delete(&brw_context(&intel->ctx)->surface_cache, + (*mt)->region->buffer); +#endif + intel_region_release(&((*mt)->region)); for (i = 0; i < MAX_TEXTURE_LEVELS; i++) -- cgit v1.2.3 From 521e4b9b7e3c79e7362f7cbd594a2e8cf74cdfe4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 29 Sep 2009 10:24:27 -0600 Subject: glx: fix glXQueryContext(GLX_RENDER_TYPE) The renderType parameter to CreateContext() was never used. Also, it was often passed as zero. Now when it's zero we check if the context is RGBA or CI mode and set it accordingly. Fixes bug 24211. --- src/glx/x11/glxcmds.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index af3e559f99..cd4aede74e 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -398,6 +398,10 @@ CreateContext(Display * dpy, XVisualInfo * vis, _XError(dpy, &error); return None; } + if (renderType == 0) { + /* Initialize renderType now */ + renderType = mode->rgbMode ? GLX_RGBA_TYPE : GLX_COLOR_INDEX_TYPE; + } } else { mode = fbconfig; @@ -484,6 +488,8 @@ CreateContext(Display * dpy, XVisualInfo * vis, gc->imported = GL_TRUE; } + gc->renderType = renderType; + return gc; } -- cgit v1.2.3 From 1f7c914ad0beea8a29c1a171c7cd1a12f2efe0fa Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 30 Sep 2009 20:28:45 -0600 Subject: mesa: replace gl_texture_format with gl_format Now gl_texture_image::TexFormat is a simple MESA_FORMAT_x enum. ctx->Driver.ChooseTexture format also returns a MESA_FORMAT_x. gl_texture_format will go away next. --- src/mesa/drivers/common/meta.c | 2 +- src/mesa/drivers/dri/common/texmem.c | 44 ++-- src/mesa/drivers/dri/common/texmem.h | 21 +- src/mesa/drivers/dri/i810/i810tex.c | 18 +- src/mesa/drivers/dri/i810/i810texmem.c | 2 +- src/mesa/drivers/dri/i810/i810texstate.c | 2 +- src/mesa/drivers/dri/i915/i830_texstate.c | 2 +- src/mesa/drivers/dri/i915/i830_vtbl.c | 4 +- src/mesa/drivers/dri/i915/i915_texstate.c | 6 +- src/mesa/drivers/dri/i915/i915_vtbl.c | 4 +- src/mesa/drivers/dri/i965/brw_wm.c | 2 +- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 7 +- src/mesa/drivers/dri/intel/intel_blit.c | 4 +- src/mesa/drivers/dri/intel/intel_fbo.c | 47 ++-- src/mesa/drivers/dri/intel/intel_fbo.h | 3 +- src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 2 +- src/mesa/drivers/dri/intel/intel_span.c | 2 +- src/mesa/drivers/dri/intel/intel_tex.h | 7 +- src/mesa/drivers/dri/intel/intel_tex_format.c | 72 ++--- src/mesa/drivers/dri/intel/intel_tex_image.c | 24 +- src/mesa/drivers/dri/intel/intel_tex_subimage.c | 4 +- src/mesa/drivers/dri/intel/intel_tex_validate.c | 4 +- src/mesa/drivers/dri/mach64/mach64_tex.c | 34 +-- src/mesa/drivers/dri/mach64/mach64_texmem.c | 4 +- src/mesa/drivers/dri/mach64/mach64_texstate.c | 4 +- src/mesa/drivers/dri/mga/mga_texstate.c | 8 +- src/mesa/drivers/dri/mga/mgatex.c | 46 ++-- src/mesa/drivers/dri/mga/mgatexmem.c | 2 +- src/mesa/drivers/dri/r128/r128_tex.c | 8 +- src/mesa/drivers/dri/r128/r128_texmem.c | 4 +- src/mesa/drivers/dri/r128/r128_texstate.c | 4 +- src/mesa/drivers/dri/r200/r200_texstate.c | 8 +- src/mesa/drivers/dri/r300/r300_texstate.c | 8 +- src/mesa/drivers/dri/r600/r600_texstate.c | 4 +- src/mesa/drivers/dri/radeon/radeon_fbo.c | 31 +-- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 10 +- src/mesa/drivers/dri/radeon/radeon_texstate.c | 8 +- src/mesa/drivers/dri/radeon/radeon_texture.c | 104 ++++---- src/mesa/drivers/dri/radeon/radeon_texture.h | 22 +- src/mesa/drivers/dri/savage/savagetex.c | 127 +++++---- src/mesa/drivers/dri/sis/sis_tex.c | 57 ++-- src/mesa/drivers/dri/tdfx/tdfx_tex.c | 81 +++--- src/mesa/drivers/dri/unichrome/via_tex.c | 68 ++--- src/mesa/drivers/glide/fxddtex.c | 48 ++-- src/mesa/drivers/x11/xm_dd.c | 6 +- src/mesa/main/dd.h | 4 +- src/mesa/main/debug.c | 2 +- src/mesa/main/fbobject.c | 4 +- src/mesa/main/mipmap.c | 8 +- src/mesa/main/mtypes.h | 2 +- src/mesa/main/texcompress_fxt1.c | 12 +- src/mesa/main/texcompress_s3tc.c | 24 +- src/mesa/main/texformat.c | 147 ++++++----- src/mesa/main/texformat.h | 6 +- src/mesa/main/texformat_tmp.h | 4 +- src/mesa/main/texgetimage.c | 14 +- src/mesa/main/teximage.c | 14 +- src/mesa/main/texparam.c | 2 +- src/mesa/main/texrender.c | 10 +- src/mesa/main/texstore.c | 322 +++++++++++------------ src/mesa/main/texstore.h | 2 +- src/mesa/state_tracker/st_cb_drawpixels.c | 4 +- src/mesa/state_tracker/st_cb_texture.c | 30 +-- src/mesa/state_tracker/st_format.c | 62 ++--- src/mesa/state_tracker/st_format.h | 3 +- src/mesa/state_tracker/st_gen_mipmap.c | 2 +- src/mesa/state_tracker/st_texture.c | 2 +- src/mesa/swrast/s_texfilter.c | 28 +- src/mesa/swrast/s_triangle.c | 4 +- 69 files changed, 869 insertions(+), 822 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 94cfdfe533..6b35dbb5ad 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2407,7 +2407,7 @@ copy_tex_sub_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_select_tex_image(ctx, texObj, target, level); - format = _mesa_get_format_base_format(texImage->TexFormat->MesaFormat); + format = _mesa_get_format_base_format(texImage->TexFormat); type = get_temp_image_type(ctx, format); bpp = _mesa_bytes_per_pixel(format, type); if (bpp <= 0) { diff --git a/src/mesa/drivers/dri/common/texmem.c b/src/mesa/drivers/dri/common/texmem.c index b64618a03c..c9c3324ed9 100644 --- a/src/mesa/drivers/dri/common/texmem.c +++ b/src/mesa/drivers/dri/common/texmem.c @@ -1306,16 +1306,16 @@ driCalculateTextureFirstLastLevel( driTextureObject * t ) * little-endian Mesa formats. */ /*@{*/ -const struct gl_texture_format *_dri_texformat_rgba8888 = NULL; -const struct gl_texture_format *_dri_texformat_argb8888 = NULL; -const struct gl_texture_format *_dri_texformat_rgb565 = NULL; -const struct gl_texture_format *_dri_texformat_argb4444 = NULL; -const struct gl_texture_format *_dri_texformat_argb1555 = NULL; -const struct gl_texture_format *_dri_texformat_al88 = NULL; -const struct gl_texture_format *_dri_texformat_a8 = &_mesa_texformat_a8; -const struct gl_texture_format *_dri_texformat_ci8 = &_mesa_texformat_ci8; -const struct gl_texture_format *_dri_texformat_i8 = &_mesa_texformat_i8; -const struct gl_texture_format *_dri_texformat_l8 = &_mesa_texformat_l8; +gl_format _dri_texformat_rgba8888 = MESA_FORMAT_NONE; +gl_format _dri_texformat_argb8888 = MESA_FORMAT_NONE; +gl_format _dri_texformat_rgb565 = MESA_FORMAT_NONE; +gl_format _dri_texformat_argb4444 = MESA_FORMAT_NONE; +gl_format _dri_texformat_argb1555 = MESA_FORMAT_NONE; +gl_format _dri_texformat_al88 = MESA_FORMAT_NONE; +gl_format _dri_texformat_a8 = MESA_FORMAT_NONE; +gl_format _dri_texformat_ci8 = MESA_FORMAT_NONE; +gl_format _dri_texformat_i8 = MESA_FORMAT_NONE; +gl_format _dri_texformat_l8 = MESA_FORMAT_NONE; /*@}*/ @@ -1329,19 +1329,19 @@ driInitTextureFormats(void) const GLubyte littleEndian = *((const GLubyte *) &ui); if (littleEndian) { - _dri_texformat_rgba8888 = &_mesa_texformat_rgba8888; - _dri_texformat_argb8888 = &_mesa_texformat_argb8888; - _dri_texformat_rgb565 = &_mesa_texformat_rgb565; - _dri_texformat_argb4444 = &_mesa_texformat_argb4444; - _dri_texformat_argb1555 = &_mesa_texformat_argb1555; - _dri_texformat_al88 = &_mesa_texformat_al88; + _dri_texformat_rgba8888 = MESA_FORMAT_RGBA8888; + _dri_texformat_argb8888 = MESA_FORMAT_ARGB8888; + _dri_texformat_rgb565 = MESA_FORMAT_RGB565; + _dri_texformat_argb4444 = MESA_FORMAT_ARGB4444; + _dri_texformat_argb1555 = MESA_FORMAT_ARGB1555; + _dri_texformat_al88 = MESA_FORMAT_AL88; } else { - _dri_texformat_rgba8888 = &_mesa_texformat_rgba8888_rev; - _dri_texformat_argb8888 = &_mesa_texformat_argb8888_rev; - _dri_texformat_rgb565 = &_mesa_texformat_rgb565_rev; - _dri_texformat_argb4444 = &_mesa_texformat_argb4444_rev; - _dri_texformat_argb1555 = &_mesa_texformat_argb1555_rev; - _dri_texformat_al88 = &_mesa_texformat_al88_rev; + _dri_texformat_rgba8888 = MESA_FORMAT_RGBA8888_REV; + _dri_texformat_argb8888 = MESA_FORMAT_ARGB8888_REV; + _dri_texformat_rgb565 = MESA_FORMAT_RGB565_REV; + _dri_texformat_argb4444 = MESA_FORMAT_ARGB4444_REV; + _dri_texformat_argb1555 = MESA_FORMAT_ARGB1555_REV; + _dri_texformat_al88 = MESA_FORMAT_AL88_REV; } } diff --git a/src/mesa/drivers/dri/common/texmem.h b/src/mesa/drivers/dri/common/texmem.h index 9c065da8b4..725ba2e119 100644 --- a/src/mesa/drivers/dri/common/texmem.h +++ b/src/mesa/drivers/dri/common/texmem.h @@ -39,6 +39,7 @@ #define DRI_TEXMEM_H #include "main/mtypes.h" +#include "main/formats.h" #include "main/mm.h" #include "xf86drm.h" @@ -317,16 +318,16 @@ GLboolean driValidateTextureHeaps( driTexHeap * const * texture_heaps, extern void driCalculateTextureFirstLastLevel( driTextureObject * t ); -extern const struct gl_texture_format *_dri_texformat_rgba8888; -extern const struct gl_texture_format *_dri_texformat_argb8888; -extern const struct gl_texture_format *_dri_texformat_rgb565; -extern const struct gl_texture_format *_dri_texformat_argb4444; -extern const struct gl_texture_format *_dri_texformat_argb1555; -extern const struct gl_texture_format *_dri_texformat_al88; -extern const struct gl_texture_format *_dri_texformat_a8; -extern const struct gl_texture_format *_dri_texformat_ci8; -extern const struct gl_texture_format *_dri_texformat_i8; -extern const struct gl_texture_format *_dri_texformat_l8; +extern gl_format _dri_texformat_rgba8888; +extern gl_format _dri_texformat_argb8888; +extern gl_format _dri_texformat_rgb565; +extern gl_format _dri_texformat_argb4444; +extern gl_format _dri_texformat_argb1555; +extern gl_format _dri_texformat_al88; +extern gl_format _dri_texformat_a8; +extern gl_format _dri_texformat_ci8; +extern gl_format _dri_texformat_i8; +extern gl_format _dri_texformat_l8; extern void driInitTextureFormats( void ); diff --git a/src/mesa/drivers/dri/i810/i810tex.c b/src/mesa/drivers/dri/i810/i810tex.c index cd6e1a8e6e..8166393eb1 100644 --- a/src/mesa/drivers/dri/i810/i810tex.c +++ b/src/mesa/drivers/dri/i810/i810tex.c @@ -440,7 +440,7 @@ static void i810DeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj ) * The i810 only supports 5 texture modes that are useful to Mesa. That * makes this routine pretty simple. */ -static const struct gl_texture_format * +static gl_format i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { @@ -458,9 +458,9 @@ i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, if ( ((format == GL_BGRA) && (type == GL_UNSIGNED_SHORT_1_5_5_5_REV)) || ((format == GL_RGBA) && (type == GL_UNSIGNED_SHORT_5_5_5_1)) || (internalFormat == GL_RGB5_A1) ) { - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; } - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case 3: case GL_RGB: @@ -472,7 +472,7 @@ i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_RGB10: case GL_RGB12: case GL_RGB16: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; case GL_ALPHA: case GL_ALPHA4: @@ -502,21 +502,21 @@ i810ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_INTENSITY12: case GL_INTENSITY16: case GL_COMPRESSED_INTENSITY: - return &_mesa_texformat_al88; + return MESA_FORMAT_AL88; case GL_YCBCR_MESA: if (type == GL_UNSIGNED_SHORT_8_8_MESA || type == GL_UNSIGNED_BYTE) - return &_mesa_texformat_ycbcr; + return MESA_FORMAT_YCBCR; else - return &_mesa_texformat_ycbcr_rev; + return MESA_FORMAT_YCBCR_REV; default: fprintf(stderr, "unexpected texture format in %s\n", __FUNCTION__); - return NULL; + return MESA_FORMAT_NONE; } - return NULL; /* never get here */ + return MESA_FORMAT_NONE; /* never get here */ } /** diff --git a/src/mesa/drivers/dri/i810/i810texmem.c b/src/mesa/drivers/dri/i810/i810texmem.c index 8cbe38f5fc..c2a5d95fc7 100644 --- a/src/mesa/drivers/dri/i810/i810texmem.c +++ b/src/mesa/drivers/dri/i810/i810texmem.c @@ -97,7 +97,7 @@ static void i810UploadTexLevel( i810ContextPtr imesa, if (!image || !image->Data) return; - texelBytes = _mesa_get_format_bytes(image->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(image->TexFormat); if (image->Width * texelBytes == t->Pitch) { GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[hwlevel].offset); diff --git a/src/mesa/drivers/dri/i810/i810texstate.c b/src/mesa/drivers/dri/i810/i810texstate.c index 0e09f54c41..b873ddbecb 100644 --- a/src/mesa/drivers/dri/i810/i810texstate.c +++ b/src/mesa/drivers/dri/i810/i810texstate.c @@ -53,7 +53,7 @@ static void i810SetTexImages( i810ContextPtr imesa, /* fprintf(stderr, "%s\n", __FUNCTION__); */ t->texelBytes = 2; - switch (baseImage->TexFormat->MesaFormat) { + switch (baseImage->TexFormat) { case MESA_FORMAT_ARGB1555: textureFormat = MI1_FMT_16BPP | MI1_PF_16BPP_ARGB1555; break; diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index 6f998fa6f7..837ae57074 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -166,7 +166,7 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) 0, intelObj-> firstLevel); - format = translate_texture_format(firstImage->TexFormat->MesaFormat, + format = translate_texture_format(firstImage->TexFormat, firstImage->InternalFormat); pitch = intelObj->mt->pitch * intelObj->mt->cpp; } diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index 983f6724c9..d53900b329 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -646,7 +646,7 @@ i830_state_draw_region(struct intel_context *intel, DSTORG_VERT_BIAS(0x8) | DEPTH_IS_Z); /* .5 */ if (irb != NULL) { - switch (irb->texformat->MesaFormat) { + switch (irb->texformat) { case MESA_FORMAT_ARGB8888: value |= DV_PF_8888; break; @@ -661,7 +661,7 @@ i830_state_draw_region(struct intel_context *intel, break; default: _mesa_problem(ctx, "Bad renderbuffer format: %d\n", - irb->texformat->MesaFormat); + irb->texformat); } } diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index 32d4b30cf9..d6f6cfdb49 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -177,7 +177,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) 0, intelObj-> firstLevel); - format = translate_texture_format(firstImage->TexFormat->MesaFormat, + format = translate_texture_format(firstImage->TexFormat, firstImage->InternalFormat, tObj->DepthMode); pitch = intelObj->mt->pitch * intelObj->mt->cpp; @@ -263,8 +263,8 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) /* YUV conversion: */ - if (firstImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR || - firstImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR_REV) + if (firstImage->TexFormat == MESA_FORMAT_YCBCR || + firstImage->TexFormat == MESA_FORMAT_YCBCR_REV) state[I915_TEXREG_SS2] |= SS2_COLORSPACE_CONVERSION; /* Shadow: diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index 9a723d3cd7..1c3da63da9 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -589,7 +589,7 @@ i915_state_draw_region(struct intel_context *intel, DSTORG_VERT_BIAS(0x8) | /* .5 */ LOD_PRECLAMP_OGL | TEX_DEFAULT_COLOR_OGL); if (irb != NULL) { - switch (irb->texformat->MesaFormat) { + switch (irb->texformat) { case MESA_FORMAT_ARGB8888: value |= DV_PF_8888; break; @@ -604,7 +604,7 @@ i915_state_draw_region(struct intel_context *intel, break; default: _mesa_problem(ctx, "Bad renderbuffer format: %d\n", - irb->texformat->MesaFormat); + irb->texformat); } } diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 2292de94c4..46df778bee 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -288,7 +288,7 @@ static void brw_wm_populate_key( struct brw_context *brw, const struct gl_texture_image *img = t->Image[0][t->BaseLevel]; if (img->InternalFormat == GL_YCBCR_MESA) { key->yuvtex_mask |= 1 << i; - if (img->TexFormat->MesaFormat == MESA_FORMAT_YCBCR) + if (img->TexFormat == MESA_FORMAT_YCBCR) key->yuvtex_swap_mask |= 1 << i; } 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 51539ac1e7..855fe7593d 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -287,7 +287,7 @@ brw_update_texture_surface( GLcontext *ctx, GLuint unit ) key.bo = NULL; key.offset = intelObj->textureOffset; } else { - key.format = firstImage->TexFormat->MesaFormat; + key.format = firstImage->TexFormat; key.internal_format = firstImage->InternalFormat; key.pitch = intelObj->mt->pitch; key.depth = firstImage->Depth; @@ -527,7 +527,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw, region_bo = region->buffer; key.surface_type = BRW_SURFACE_2D; - switch (irb->texformat->MesaFormat) { + switch (irb->texformat) { case MESA_FORMAT_ARGB8888: key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; break; @@ -541,8 +541,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw, key.surface_format = BRW_SURFACEFORMAT_B4G4R4A4_UNORM; break; default: - _mesa_problem(ctx, "Bad renderbuffer format: %d\n", - irb->texformat->MesaFormat); + _mesa_problem(ctx, "Bad renderbuffer format: %d\n", irb->texformat); } key.tiling = region->tiling; if (brw->intel.intelScreen->driScrnPriv->dri2.enabled) { diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index 43141c509c..799b22cc90 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -496,7 +496,7 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) CLAMPED_FLOAT_TO_UBYTE(clear[2], color[2]); CLAMPED_FLOAT_TO_UBYTE(clear[3], color[3]); - switch (irb->texformat->MesaFormat) { + switch (irb->texformat) { case MESA_FORMAT_ARGB8888: clearVal = intel->ClearColor8888; break; @@ -513,7 +513,7 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) break; default: _mesa_problem(ctx, "Unexpected renderbuffer format: %d\n", - irb->texformat->MesaFormat); + irb->texformat); clearVal = 0; } } diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 0a3d0654d7..1be381b9ea 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -120,7 +120,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->RedBits = 5; rb->GreenBits = 6; rb->BlueBits = 5; - irb->texformat = &_mesa_texformat_rgb565; + irb->texformat = MESA_FORMAT_RGB565; cpp = 2; break; case GL_RGB: @@ -134,7 +134,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->GreenBits = 8; rb->BlueBits = 8; rb->AlphaBits = 0; - irb->texformat = &_mesa_texformat_argb8888; /* XXX: Need xrgb8888 */ + irb->texformat = MESA_FORMAT_ARGB8888; /* XXX: Need xrgb8888 */ cpp = 4; break; case GL_RGBA: @@ -151,7 +151,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->GreenBits = 8; rb->BlueBits = 8; rb->AlphaBits = 8; - irb->texformat = &_mesa_texformat_argb8888; + irb->texformat = MESA_FORMAT_ARGB8888; cpp = 4; break; case GL_STENCIL_INDEX: @@ -164,14 +164,14 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->DataType = GL_UNSIGNED_INT_24_8_EXT; rb->StencilBits = 8; cpp = 4; - irb->texformat = &_mesa_texformat_s8_z24; + irb->texformat = MESA_FORMAT_S8_Z24; break; case GL_DEPTH_COMPONENT16: rb->_ActualFormat = GL_DEPTH_COMPONENT16; rb->DataType = GL_UNSIGNED_SHORT; rb->DepthBits = 16; cpp = 2; - irb->texformat = &_mesa_texformat_z16; + irb->texformat = MESA_FORMAT_Z16; break; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT24: @@ -180,7 +180,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->DataType = GL_UNSIGNED_INT_24_8_EXT; rb->DepthBits = 24; cpp = 4; - irb->texformat = &_mesa_texformat_s8_z24; + irb->texformat = MESA_FORMAT_S8_Z24; break; case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: @@ -189,7 +189,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->DepthBits = 24; rb->StencilBits = 8; cpp = 4; - irb->texformat = &_mesa_texformat_s8_z24; + irb->texformat = MESA_FORMAT_S8_Z24; break; default: _mesa_problem(ctx, @@ -331,7 +331,7 @@ intel_create_renderbuffer(GLenum intFormat) irb->Base.GreenBits = 6; irb->Base.BlueBits = 5; irb->Base.DataType = GL_UNSIGNED_BYTE; - irb->texformat = &_mesa_texformat_rgb565; + irb->texformat = MESA_FORMAT_RGB565; break; case GL_RGB8: irb->Base._ActualFormat = GL_RGB8; @@ -341,7 +341,7 @@ intel_create_renderbuffer(GLenum intFormat) irb->Base.BlueBits = 8; irb->Base.AlphaBits = 0; irb->Base.DataType = GL_UNSIGNED_BYTE; - irb->texformat = &_mesa_texformat_argb8888; /* XXX: Need xrgb8888 */ + irb->texformat = MESA_FORMAT_ARGB8888; /* XXX: NEED XRGB8888 */ break; case GL_RGBA8: irb->Base._ActualFormat = GL_RGBA8; @@ -351,28 +351,28 @@ intel_create_renderbuffer(GLenum intFormat) irb->Base.BlueBits = 8; irb->Base.AlphaBits = 8; irb->Base.DataType = GL_UNSIGNED_BYTE; - irb->texformat = &_mesa_texformat_argb8888; + irb->texformat = MESA_FORMAT_ARGB8888; break; case GL_STENCIL_INDEX8_EXT: irb->Base._ActualFormat = GL_STENCIL_INDEX8_EXT; irb->Base._BaseFormat = GL_STENCIL_INDEX; irb->Base.StencilBits = 8; irb->Base.DataType = GL_UNSIGNED_BYTE; - irb->texformat = &_mesa_texformat_s8_z24; + irb->texformat = MESA_FORMAT_S8_Z24; break; case GL_DEPTH_COMPONENT16: irb->Base._ActualFormat = GL_DEPTH_COMPONENT16; irb->Base._BaseFormat = GL_DEPTH_COMPONENT; irb->Base.DepthBits = 16; irb->Base.DataType = GL_UNSIGNED_SHORT; - irb->texformat = &_mesa_texformat_z16; + irb->texformat = MESA_FORMAT_Z16; break; case GL_DEPTH_COMPONENT24: irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; irb->Base._BaseFormat = GL_DEPTH_COMPONENT; irb->Base.DepthBits = 24; irb->Base.DataType = GL_UNSIGNED_INT; - irb->texformat = &_mesa_texformat_s8_z24; + irb->texformat = MESA_FORMAT_S8_Z24; break; case GL_DEPTH24_STENCIL8_EXT: irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; @@ -380,7 +380,7 @@ intel_create_renderbuffer(GLenum intFormat) irb->Base.DepthBits = 24; irb->Base.StencilBits = 8; irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT; - irb->texformat = &_mesa_texformat_s8_z24; + irb->texformat = MESA_FORMAT_S8_Z24; break; default: _mesa_problem(NULL, @@ -468,49 +468,48 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb, irb->texformat = texImage->TexFormat; gl_format texFormat; - if (texImage->TexFormat == &_mesa_texformat_argb8888) { + if (texImage->TexFormat == MESA_FORMAT_ARGB8888) { irb->Base._ActualFormat = GL_RGBA8; irb->Base._BaseFormat = GL_RGBA; irb->Base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGBA8 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_rgb565) { + else if (texImage->TexFormat == MESA_FORMAT_RGB565) { irb->Base._ActualFormat = GL_RGB5; irb->Base._BaseFormat = GL_RGB; irb->Base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGB5 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_argb1555) { + else if (texImage->TexFormat == MESA_FORMAT_ARGB1555) { irb->Base._ActualFormat = GL_RGB5_A1; irb->Base._BaseFormat = GL_RGBA; irb->Base.DataType = GL_UNSIGNED_BYTE; DBG("Render to ARGB1555 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_argb4444) { + else if (texImage->TexFormat == MESA_FORMAT_ARGB4444) { irb->Base._ActualFormat = GL_RGBA4; irb->Base._BaseFormat = GL_RGBA; irb->Base.DataType = GL_UNSIGNED_BYTE; DBG("Render to ARGB4444 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_z16) { + else if (texImage->TexFormat == MESA_FORMAT_Z16) { irb->Base._ActualFormat = GL_DEPTH_COMPONENT16; irb->Base._BaseFormat = GL_DEPTH_COMPONENT; irb->Base.DataType = GL_UNSIGNED_SHORT; DBG("Render to DEPTH16 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_s8_z24) { + else if (texImage->TexFormat == MESA_FORMAT_S8_Z24) { irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; irb->Base._BaseFormat = GL_DEPTH_STENCIL_EXT; irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT; DBG("Render to DEPTH_STENCIL texture OK\n"); } else { - DBG("Render to texture BAD FORMAT %d\n", - texImage->TexFormat->MesaFormat); + DBG("Render to texture BAD FORMAT %d\n", texImage->TexFormat); return GL_FALSE; } - texFormat = texImage->TexFormat->MesaFormat; + texFormat = texImage->TexFormat; irb->Base.InternalFormat = irb->Base._ActualFormat; irb->Base.Width = texImage->Width; @@ -690,7 +689,7 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) continue; } - switch (irb->texformat->MesaFormat) { + switch (irb->texformat) { case MESA_FORMAT_ARGB8888: case MESA_FORMAT_RGB565: case MESA_FORMAT_ARGB1555: diff --git a/src/mesa/drivers/dri/intel/intel_fbo.h b/src/mesa/drivers/dri/intel/intel_fbo.h index f0665af482..e0584e3494 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.h +++ b/src/mesa/drivers/dri/intel/intel_fbo.h @@ -28,6 +28,7 @@ #ifndef INTEL_FBO_H #define INTEL_FBO_H +#include "main/formats.h" #include "intel_screen.h" struct intel_context; @@ -61,7 +62,7 @@ struct intel_renderbuffer struct gl_renderbuffer Base; struct intel_region *region; - const struct gl_texture_format *texformat; + gl_format texformat; GLuint vbl_pending; /**< vblank sequence number of pending flip */ diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 188333c75f..6bb7481ae4 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -307,7 +307,7 @@ intel_miptree_match_image(struct intel_mipmap_tree *mt, if (!image->IsCompressed && !mt->compressed && - _mesa_get_format_bytes(image->TexFormat->MesaFormat) != mt->cpp) + _mesa_get_format_bytes(image->TexFormat) != mt->cpp) return GL_FALSE; /* Test image dimensions against the base level image adjusted for diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 28eabbc005..f754ce0cd1 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -578,7 +578,7 @@ intel_set_span_functions(struct intel_context *intel, else tiling = I915_TILING_NONE; - switch (irb->texformat->MesaFormat) { + switch (irb->texformat) { case MESA_FORMAT_RGB565: switch (tiling) { case I915_TILING_NONE: diff --git a/src/mesa/drivers/dri/intel/intel_tex.h b/src/mesa/drivers/dri/intel/intel_tex.h index 471aa2a240..f67e1db9e3 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.h +++ b/src/mesa/drivers/dri/intel/intel_tex.h @@ -29,6 +29,7 @@ #define INTELTEX_INC #include "main/mtypes.h" +#include "main/formats.h" #include "intel_context.h" #include "texmem.h" @@ -41,10 +42,8 @@ void intelInitTextureSubImageFuncs(struct dd_function_table *functions); void intelInitTextureCopyImageFuncs(struct dd_function_table *functions); -const struct gl_texture_format *intelChooseTextureFormat(GLcontext * ctx, - GLint internalFormat, - GLenum format, - GLenum type); +gl_format intelChooseTextureFormat(GLcontext *ctx, GLint internalFormat, + GLenum format, GLenum type); void intelSetTexOffset(__DRIcontext *pDRICtx, GLint texname, unsigned long long offset, GLint depth, GLuint pitch); diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c index 3322a71130..22c010bbd7 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_format.c +++ b/src/mesa/drivers/dri/intel/intel_tex_format.c @@ -16,7 +16,7 @@ * these if we take the step of simply swizzling the colors * immediately after sampling... */ -const struct gl_texture_format * +gl_format intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, GLenum format, GLenum type) { @@ -34,48 +34,48 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_COMPRESSED_RGBA: if (format == GL_BGRA) { if (type == GL_UNSIGNED_BYTE || type == GL_UNSIGNED_INT_8_8_8_8_REV) { - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; } else if (type == GL_UNSIGNED_SHORT_4_4_4_4_REV) { - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; } else if (type == GL_UNSIGNED_SHORT_1_5_5_5_REV) { - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; } } - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; case 3: case GL_RGB: case GL_COMPRESSED_RGB: if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) { - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; } - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565; case GL_RGBA8: case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; case GL_RGBA4: case GL_RGBA2: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_RGB5_A1: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; case GL_RGB5: case GL_RGB4: case GL_R3_G3_B2: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; case GL_ALPHA: case GL_ALPHA4: @@ -83,7 +83,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_ALPHA12: case GL_ALPHA16: case GL_COMPRESSED_ALPHA: - return &_mesa_texformat_a8; + return MESA_FORMAT_A8; case 1: case GL_LUMINANCE: @@ -92,7 +92,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_LUMINANCE12: case GL_LUMINANCE16: case GL_COMPRESSED_LUMINANCE: - return &_mesa_texformat_l8; + return MESA_FORMAT_L8; case 2: case GL_LUMINANCE_ALPHA: @@ -103,7 +103,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: case GL_COMPRESSED_LUMINANCE_ALPHA: - return &_mesa_texformat_al88; + return MESA_FORMAT_AL88; case GL_INTENSITY: case GL_INTENSITY4: @@ -111,41 +111,41 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_INTENSITY12: case GL_INTENSITY16: case GL_COMPRESSED_INTENSITY: - return &_mesa_texformat_i8; + return MESA_FORMAT_I8; case GL_YCBCR_MESA: if (type == GL_UNSIGNED_SHORT_8_8_MESA || type == GL_UNSIGNED_BYTE) - return &_mesa_texformat_ycbcr; + return MESA_FORMAT_YCBCR; else - return &_mesa_texformat_ycbcr_rev; + return MESA_FORMAT_YCBCR_REV; case GL_COMPRESSED_RGB_FXT1_3DFX: - return &_mesa_texformat_rgb_fxt1; + return MESA_FORMAT_RGB_FXT1; case GL_COMPRESSED_RGBA_FXT1_3DFX: - return &_mesa_texformat_rgba_fxt1; + return MESA_FORMAT_RGBA_FXT1; case GL_RGB_S3TC: case GL_RGB4_S3TC: case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: - return &_mesa_texformat_rgb_dxt1; + return MESA_FORMAT_RGB_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - return &_mesa_texformat_rgba_dxt1; + return MESA_FORMAT_RGBA_DXT1; case GL_RGBA_S3TC: case GL_RGBA4_S3TC: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: - return &_mesa_texformat_rgba_dxt3; + return MESA_FORMAT_RGBA_DXT3; case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - return &_mesa_texformat_rgba_dxt5; + return MESA_FORMAT_RGBA_DXT5; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT16: case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT32: #if 0 - return &_mesa_texformat_z16; + return MESA_FORMAT_Z16; #else /* fall-through. * 16bpp depth texture can't be paired with a stencil buffer so @@ -154,7 +154,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, #endif case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: - return &_mesa_texformat_s8_z24; + return MESA_FORMAT_S8_Z24; #ifndef I915 case GL_SRGB_EXT: @@ -165,41 +165,41 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_COMPRESSED_SRGB_ALPHA_EXT: case GL_COMPRESSED_SLUMINANCE_EXT: case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: - return &_mesa_texformat_sargb8; + return MESA_FORMAT_SARGB8; case GL_SLUMINANCE_EXT: case GL_SLUMINANCE8_EXT: if (IS_G4X(intel->intelScreen->deviceID)) - return &_mesa_texformat_sl8; + return MESA_FORMAT_SL8; else - return &_mesa_texformat_sargb8; + return MESA_FORMAT_SARGB8; case GL_SLUMINANCE_ALPHA_EXT: case GL_SLUMINANCE8_ALPHA8_EXT: if (IS_G4X(intel->intelScreen->deviceID)) - return &_mesa_texformat_sla8; + return MESA_FORMAT_SLA8; else - return &_mesa_texformat_sargb8; + return MESA_FORMAT_SARGB8; case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: - return &_mesa_texformat_srgb_dxt1; + return MESA_FORMAT_SRGB_DXT1; /* i915 could also do this */ case GL_DUDV_ATI: case GL_DU8DV8_ATI: - return &_mesa_texformat_dudv8; + return MESA_FORMAT_DUDV8; case GL_RGBA_SNORM: case GL_RGBA8_SNORM: - return &_mesa_texformat_signed_rgba8888_rev; + return MESA_FORMAT_SIGNED_RGBA8888_REV; #endif default: fprintf(stderr, "unexpected texture format %s in %s\n", _mesa_lookup_enum_by_nr(internalFormat), __FUNCTION__); - return NULL; + return MESA_FORMAT_NONE; } - return NULL; /* never get here */ + return MESA_FORMAT_NONE; /* never get here */ } int intel_compressed_num_bytes(GLuint mesaFormat) diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 0e13f600a6..bbbeac8f7f 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -126,9 +126,9 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, assert(!intelObj->mt); if (intelImage->base.IsCompressed) - comp_byte = intel_compressed_num_bytes(intelImage->base.TexFormat->MesaFormat); + comp_byte = intel_compressed_num_bytes(intelImage->base.TexFormat); - texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat); intelObj->mt = intel_miptree_create(intel, intelObj->base.Target, @@ -171,7 +171,7 @@ target_to_face(GLenum target) static GLboolean check_pbo_format(GLint internalFormat, GLenum format, GLenum type, - const struct gl_texture_format *mesa_format) + gl_format mesa_format) { switch (internalFormat) { case 4: @@ -179,12 +179,12 @@ check_pbo_format(GLint internalFormat, return (format == GL_BGRA && (type == GL_UNSIGNED_BYTE || type == GL_UNSIGNED_INT_8_8_8_8_REV) && - mesa_format == &_mesa_texformat_argb8888); + mesa_format == MESA_FORMAT_ARGB8888); case 3: case GL_RGB: return (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 && - mesa_format == &_mesa_texformat_rgb565); + mesa_format == MESA_FORMAT_RGB565); case GL_YCBCR_MESA: return (type == GL_UNSIGNED_SHORT_8_8_MESA || type == GL_UNSIGNED_BYTE); default: @@ -337,15 +337,15 @@ intelTexImage(GLcontext * ctx, _mesa_set_fetch_functions(texImage, dims); - if (_mesa_is_format_compressed(texImage->TexFormat->MesaFormat)) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { texelBytes = 0; texImage->IsCompressed = GL_TRUE; texImage->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, texImage->Width, texImage->Height, texImage->Depth, - texImage->TexFormat->MesaFormat); + texImage->TexFormat); } else { - texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* Minimum pitch of 32 bytes */ if (postConvWidth * texelBytes < 32) { @@ -403,11 +403,11 @@ intelTexImage(GLcontext * ctx, assert(intelImage->mt); } else if (intelImage->base.Border == 0) { int comp_byte = 0; - GLuint texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat->MesaFormat); - GLenum baseFormat = _mesa_get_format_base_format(intelImage->base.TexFormat->MesaFormat); + GLuint texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat); + GLenum baseFormat = _mesa_get_format_base_format(intelImage->base.TexFormat); if (intelImage->base.IsCompressed) { comp_byte = - intel_compressed_num_bytes(intelImage->base.TexFormat->MesaFormat); + intel_compressed_num_bytes(intelImage->base.TexFormat); } /* Didn't fit in the object miptree, but it's suitable for inclusion in @@ -497,7 +497,7 @@ intelTexImage(GLcontext * ctx, if (texImage->IsCompressed) { sizeInBytes = texImage->CompressedSize; dstRowStride = - _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); + _mesa_compressed_row_stride(texImage->TexFormat, width); assert(dims != 3); } else { diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c index ad5c2271a1..bba1b53009 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c @@ -87,11 +87,11 @@ intelTexSubimage(GLcontext * ctx, else { if (texImage->IsCompressed) { dstRowStride = - _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); + _mesa_compressed_row_stride(texImage->TexFormat, width); assert(dims != 3); } else { - dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat); } } diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c index 0393d7915a..0296c92523 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_validate.c +++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c @@ -166,11 +166,11 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) } if (firstImage->base.IsCompressed) { - comp_byte = intel_compressed_num_bytes(firstImage->base.TexFormat->MesaFormat); + comp_byte = intel_compressed_num_bytes(firstImage->base.TexFormat); cpp = comp_byte; } else - cpp = _mesa_get_format_bytes(firstImage->base.TexFormat->MesaFormat); + cpp = _mesa_get_format_bytes(firstImage->base.TexFormat); /* Check tree can hold all active levels. Check tree matches * target, imageFormat, etc. diff --git a/src/mesa/drivers/dri/mach64/mach64_tex.c b/src/mesa/drivers/dri/mach64/mach64_tex.c index 225d23179e..02433e5dd8 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tex.c +++ b/src/mesa/drivers/dri/mach64/mach64_tex.c @@ -138,7 +138,7 @@ mach64AllocTexObj( struct gl_texture_object *texObj ) /* Called by the _mesa_store_teximage[123]d() functions. */ -static const struct gl_texture_format * +static gl_format mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { @@ -167,15 +167,15 @@ mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_RGBA2: case GL_COMPRESSED_RGBA: if (mmesa->mach64Screen->cpp == 4) - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; else - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_RGB5_A1: if (mmesa->mach64Screen->cpp == 4) - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; else - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case GL_RGBA8: case GL_RGB10_A2: @@ -183,9 +183,9 @@ mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_RGBA16: case GL_RGBA4: if (mmesa->mach64Screen->cpp == 4) - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; else - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case 3: case GL_RGB: @@ -198,9 +198,9 @@ mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_RGB16: case GL_COMPRESSED_RGB: if (mmesa->mach64Screen->cpp == 4) - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; else - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; case 1: case GL_LUMINANCE: @@ -210,9 +210,9 @@ mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE16: case GL_COMPRESSED_LUMINANCE: if (mmesa->mach64Screen->cpp == 4) - return &_mesa_texformat_argb8888; /* inefficient but accurate */ + return MESA_FORMAT_ARGB8888; /* inefficient but accurate */ else - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case GL_INTENSITY4: case GL_INTENSITY: @@ -221,9 +221,9 @@ mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_INTENSITY16: case GL_COMPRESSED_INTENSITY: if (mmesa->mach64Screen->cpp == 4) - return &_mesa_texformat_argb8888; /* inefficient but accurate */ + return MESA_FORMAT_ARGB8888; /* inefficient but accurate */ else - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_COLOR_INDEX: case GL_COLOR_INDEX1_EXT: @@ -232,18 +232,18 @@ mach64ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_COLOR_INDEX8_EXT: case GL_COLOR_INDEX12_EXT: case GL_COLOR_INDEX16_EXT: - return &_mesa_texformat_ci8; + return MESA_FORMAT_CI8; case GL_YCBCR_MESA: if (type == GL_UNSIGNED_SHORT_8_8_APPLE || type == GL_UNSIGNED_BYTE) - return &_mesa_texformat_ycbcr; + return MESA_FORMAT_YCBCR; else - return &_mesa_texformat_ycbcr_rev; + return MESA_FORMAT_YCBCR_REV; default: _mesa_problem( ctx, "unexpected format in %s", __FUNCTION__ ); - return NULL; + return MESA_FORMAT_NONE; } } diff --git a/src/mesa/drivers/dri/mach64/mach64_texmem.c b/src/mesa/drivers/dri/mach64/mach64_texmem.c index 843b231051..e83aeae3e1 100644 --- a/src/mesa/drivers/dri/mach64/mach64_texmem.c +++ b/src/mesa/drivers/dri/mach64/mach64_texmem.c @@ -86,7 +86,7 @@ static void mach64UploadAGPSubImage( mach64ContextPtr mmesa, if ( !image ) return; - texelBytes = _mesa_get_format_bytes(image->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(image->TexFormat); switch ( texelBytes ) { case 1: texelsPerDword = 4; break; @@ -153,7 +153,7 @@ static void mach64UploadLocalSubImage( mach64ContextPtr mmesa, if ( !image ) return; - texelBytes = _mesa_get_format_bytes(image->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(image->TexFormat); switch ( texelBytes ) { case 1: texelsPerDword = 4; break; diff --git a/src/mesa/drivers/dri/mach64/mach64_texstate.c b/src/mesa/drivers/dri/mach64/mach64_texstate.c index ff03b0c40a..c333355324 100644 --- a/src/mesa/drivers/dri/mach64/mach64_texstate.c +++ b/src/mesa/drivers/dri/mach64/mach64_texstate.c @@ -55,7 +55,7 @@ static void mach64SetTexImages( mach64ContextPtr mmesa, if ( MACH64_DEBUG & DEBUG_VERBOSE_API ) fprintf( stderr, "%s( %p )\n", __FUNCTION__, tObj ); - switch (baseImage->TexFormat->MesaFormat) { + switch (baseImage->TexFormat) { case MESA_FORMAT_ARGB8888: t->textureFormat = MACH64_DATATYPE_ARGB8888; break; @@ -89,7 +89,7 @@ static void mach64SetTexImages( mach64ContextPtr mmesa, totalSize = ( baseImage->Height * baseImage->Width * - _mesa_get_format_bytes(baseImage->TexFormat->MesaFormat) ); + _mesa_get_format_bytes(baseImage->TexFormat) ); totalSize = (totalSize + 31) & ~31; diff --git a/src/mesa/drivers/dri/mga/mga_texstate.c b/src/mesa/drivers/dri/mga/mga_texstate.c index 8f78ab9bd4..d52f0fac75 100644 --- a/src/mesa/drivers/dri/mga/mga_texstate.c +++ b/src/mesa/drivers/dri/mga/mga_texstate.c @@ -94,14 +94,14 @@ mgaSetTexImages( mgaContextPtr mmesa, return; } #else - if ( (baseImage->TexFormat->MesaFormat >= TMC_nr_tformat) - || (TMC_tformat[ baseImage->TexFormat->MesaFormat ] == 0) ) + if ( (baseImage->TexFormat >= TMC_nr_tformat) + || (TMC_tformat[ baseImage->TexFormat ] == 0) ) { _mesa_problem(NULL, "unexpected texture format in %s", __FUNCTION__); return; } - txformat = TMC_tformat[ baseImage->TexFormat->MesaFormat ]; + txformat = TMC_tformat[ baseImage->TexFormat ]; #endif /* MGA_USE_TABLE_FOR_FORMAT */ @@ -131,7 +131,7 @@ mgaSetTexImages( mgaContextPtr mmesa, break; size = texImage->Width * texImage->Height * - _mesa_get_format_bytes(baseImage->TexFormat->MesaFormat); + _mesa_get_format_bytes(baseImage->TexFormat); t->offsets[i] = totalSize; t->base.dirty_images[0] |= (1<TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); length = texImage->Width * texImage->Height * texelBytes; if ( t->base.heap->heapId == MGA_CARD_HEAP ) { unsigned tex_offset = 0; diff --git a/src/mesa/drivers/dri/r128/r128_tex.c b/src/mesa/drivers/dri/r128/r128_tex.c index 0920270d7b..6acda445f7 100644 --- a/src/mesa/drivers/dri/r128/r128_tex.c +++ b/src/mesa/drivers/dri/r128/r128_tex.c @@ -178,7 +178,7 @@ static r128TexObjPtr r128AllocTexObj( struct gl_texture_object *texObj ) /* Called by the _mesa_store_teximage[123]d() functions. */ -static const struct gl_texture_format * +static gl_format r128ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { @@ -282,13 +282,13 @@ r128ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_YCBCR_MESA: if (type == GL_UNSIGNED_SHORT_8_8_APPLE || type == GL_UNSIGNED_BYTE) - return &_mesa_texformat_ycbcr; + return MESA_FORMAT_YCBCR; else - return &_mesa_texformat_ycbcr_rev; + return MESA_FORMAT_YCBCR_REV; default: _mesa_problem( ctx, "unexpected format in %s", __FUNCTION__ ); - return NULL; + return MESA_FORMAT_NONE; } } diff --git a/src/mesa/drivers/dri/r128/r128_texmem.c b/src/mesa/drivers/dri/r128/r128_texmem.c index c369e14bd5..84f8563b89 100644 --- a/src/mesa/drivers/dri/r128/r128_texmem.c +++ b/src/mesa/drivers/dri/r128/r128_texmem.c @@ -95,7 +95,7 @@ static void uploadSubImage( r128ContextPtr rmesa, r128TexObjPtr t, if ( !image ) return; - switch ( _mesa_get_format_bytes(image->TexFormat->MesaFormat) ) { + switch ( _mesa_get_format_bytes(image->TexFormat) ) { case 1: texelsPerDword = 4; break; case 2: texelsPerDword = 2; break; case 4: texelsPerDword = 1; break; @@ -216,7 +216,7 @@ static void uploadSubImage( r128ContextPtr rmesa, r128TexObjPtr t, /* Copy the next chunck of the texture image into the blit buffer */ { const GLuint texelBytes = - _mesa_get_format_bytes(image->TexFormat->MesaFormat); + _mesa_get_format_bytes(image->TexFormat); const GLubyte *src = (const GLubyte *) image->Data + (y * image->Width + x) * texelBytes; const GLuint bytes = width * height * texelBytes; diff --git a/src/mesa/drivers/dri/r128/r128_texstate.c b/src/mesa/drivers/dri/r128/r128_texstate.c index 9f4f9aea2d..2e71c25861 100644 --- a/src/mesa/drivers/dri/r128/r128_texstate.c +++ b/src/mesa/drivers/dri/r128/r128_texstate.c @@ -61,7 +61,7 @@ static void r128SetTexImages( r128ContextPtr rmesa, if ( R128_DEBUG & DEBUG_VERBOSE_API ) fprintf( stderr, "%s( %p )\n", __FUNCTION__, (void *) tObj ); - switch (baseImage->TexFormat->MesaFormat) { + switch (baseImage->TexFormat) { case MESA_FORMAT_ARGB8888: case MESA_FORMAT_ARGB8888_REV: t->textureFormat = R128_DATATYPE_ARGB8888; @@ -123,7 +123,7 @@ static void r128SetTexImages( r128ContextPtr rmesa, totalSize += (tObj->Image[0][i]->Height * tObj->Image[0][i]->Width * - _mesa_get_format_bytes(tObj->Image[0][i]->TexFormat->MesaFormat)); + _mesa_get_format_bytes(tObj->Image[0][i]->TexFormat)); /* Offsets must be 32-byte aligned for host data blits and tiling */ totalSize = (totalSize + 31) & ~31; diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index 03f0613e7a..daca318684 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -1437,11 +1437,11 @@ static void setup_hardware_state(r200ContextPtr rmesa, radeonTexObj *t) log2Width = firstImage->WidthLog2; log2Height = firstImage->HeightLog2; log2Depth = firstImage->DepthLog2; - texelBytes = _mesa_get_format_bytes(firstImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(firstImage->TexFormat); if (!t->image_override) { - if (VALID_FORMAT(firstImage->TexFormat->MesaFormat)) { + if (VALID_FORMAT(firstImage->TexFormat)) { const struct tx_table *table = _mesa_little_endian() ? tx_table_le : tx_table_be; @@ -1449,8 +1449,8 @@ static void setup_hardware_state(r200ContextPtr rmesa, radeonTexObj *t) R200_TXFORMAT_ALPHA_IN_MAP); t->pp_txfilter &= ~R200_YUV_TO_RGB; - t->pp_txformat |= table[ firstImage->TexFormat->MesaFormat ].format; - t->pp_txfilter |= table[ firstImage->TexFormat->MesaFormat ].filter; + t->pp_txformat |= table[ firstImage->TexFormat ].format; + t->pp_txfilter |= table[ firstImage->TexFormat ].filter; } else { _mesa_problem(NULL, "unexpected texture format in %s", __FUNCTION__); diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index cc40e0d1dc..cb826248f3 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -156,7 +156,7 @@ void r300SetDepthTexMode(struct gl_texture_object *tObj) t = radeon_tex_obj(tObj); - switch (tObj->Image[0][tObj->BaseLevel]->TexFormat->MesaFormat) { + switch (tObj->Image[0][tObj->BaseLevel]->TexFormat) { case MESA_FORMAT_Z16: format = formats[0]; break; @@ -208,14 +208,14 @@ static void setup_hardware_state(r300ContextPtr rmesa, radeonTexObj *t) firstImage = t->base.Image[0][firstlevel]; if (!t->image_override - && VALID_FORMAT(firstImage->TexFormat->MesaFormat)) { + && VALID_FORMAT(firstImage->TexFormat)) { if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) { r300SetDepthTexMode(&t->base); } else { - t->pp_txformat = tx_table[firstImage->TexFormat->MesaFormat].format; + t->pp_txformat = tx_table[firstImage->TexFormat].format; } - t->pp_txfilter |= tx_table[firstImage->TexFormat->MesaFormat].filter; + t->pp_txfilter |= tx_table[firstImage->TexFormat].filter; } else if (!t->image_override) { _mesa_problem(NULL, "unexpected texture format in %s", __FUNCTION__); diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c index 7d7e77d355..55b455edc0 100644 --- a/src/mesa/drivers/dri/r600/r600_texstate.c +++ b/src/mesa/drivers/dri/r600/r600_texstate.c @@ -591,7 +591,7 @@ void r600SetDepthTexMode(struct gl_texture_object *tObj) t = radeon_tex_obj(tObj); - r600GetTexFormat(tObj, tObj->Image[0][tObj->BaseLevel]->TexFormat->MesaFormat); + r600GetTexFormat(tObj, tObj->Image[0][tObj->BaseLevel]->TexFormat); } @@ -616,7 +616,7 @@ static void setup_hardware_state(context_t *rmesa, struct gl_texture_object *tex firstImage = t->base.Image[0][firstlevel]; if (!t->image_override) { - if (!r600GetTexFormat(texObj, firstImage->TexFormat->MesaFormat)) { + if (!r600GetTexFormat(texObj, firstImage->TexFormat)) { radeon_error("unexpected texture format in %s\n", __FUNCTION__); return; diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index f19170b612..90ea2ec335 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -390,42 +390,42 @@ radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb, gl_format texFormat; restart: - if (texImage->TexFormat == &_mesa_texformat_argb8888) { + if (texImage->TexFormat == MESA_FORMAT_ARGB8888) { rrb->cpp = 4; rrb->base._ActualFormat = GL_RGBA8; rrb->base._BaseFormat = GL_RGBA; rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGBA8 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_rgb565) { + else if (texImage->TexFormat == MESA_FORMAT_RGB565) { rrb->cpp = 2; rrb->base._ActualFormat = GL_RGB5; rrb->base._BaseFormat = GL_RGB; rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGB5 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_argb1555) { + else if (texImage->TexFormat == MESA_FORMAT_ARGB1555) { rrb->cpp = 2; rrb->base._ActualFormat = GL_RGB5_A1; rrb->base._BaseFormat = GL_RGBA; rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to ARGB1555 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_argb4444) { + else if (texImage->TexFormat == MESA_FORMAT_ARGB4444) { rrb->cpp = 2; rrb->base._ActualFormat = GL_RGBA4; rrb->base._BaseFormat = GL_RGBA; rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to ARGB1555 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_z16) { + else if (texImage->TexFormat == MESA_FORMAT_Z16) { rrb->cpp = 2; rrb->base._ActualFormat = GL_DEPTH_COMPONENT16; rrb->base._BaseFormat = GL_DEPTH_COMPONENT; rrb->base.DataType = GL_UNSIGNED_SHORT; DBG("Render to DEPTH16 texture OK\n"); } - else if (texImage->TexFormat == &_mesa_texformat_s8_z24) { + else if (texImage->TexFormat == MESA_FORMAT_S8_Z24) { rrb->cpp = 4; rrb->base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; rrb->base._BaseFormat = GL_DEPTH_STENCIL_EXT; @@ -436,29 +436,30 @@ restart: /* try redoing the FBO */ if (retry == 1) { DBG("Render to texture BAD FORMAT %d\n", - texImage->TexFormat->MesaFormat); + texImage->TexFormat); return GL_FALSE; } texImage->TexFormat = radeonChooseTextureFormat(ctx, texImage->InternalFormat, 0, - _mesa_get_format_datatype(texImage->TexFormat->MesaFormat), + _mesa_get_format_datatype(texImage->TexFormat), 1); retry++; goto restart; } - texFormat = texImage->TexFormat->MesaFormat; + texFormat = texImage->TexFormat; rrb->pitch = texImage->Width * rrb->cpp; rrb->base.InternalFormat = rrb->base._ActualFormat; rrb->base.Width = texImage->Width; rrb->base.Height = texImage->Height; - rrb->Base.RedBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE); - rrb->Base.GreenBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE); - rrb->Base.BlueBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE); - rrb->Base.AlphaBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE); - rrb->Base.DepthBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE_ARB); - rrb->Base.StencilBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_STENCIL_SIZE_EXT); + rrb->base.RedBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE); + rrb->base.GreenBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE); + rrb->base.BlueBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE); + rrb->base.AlphaBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE); + rrb->base.DepthBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE_ARB); + rrb->base.StencilBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_STENCIL_SIZE_EXT); + rrb->base.Delete = radeon_delete_renderbuffer; rrb->base.AllocStorage = radeon_nop_alloc_storage; diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index 851474f871..b602bfb4b0 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -325,7 +325,7 @@ GLboolean radeon_miptree_matches_image(radeon_mipmap_tree *mt, if (!texImage->IsCompressed && !mt->compressed && - _mesa_get_format_bytes(texImage->TexFormat->MesaFormat) != mt->bpp) + _mesa_get_format_bytes(texImage->TexFormat) != mt->bpp) return GL_FALSE; lvl = &mt->levels[level - mt->firstLevel]; @@ -354,8 +354,8 @@ GLboolean radeon_miptree_matches_texture(radeon_mipmap_tree *mt, struct gl_textu numfaces = 6; firstImage = texObj->Image[0][firstLevel]; - compressed = firstImage->IsCompressed ? firstImage->TexFormat->MesaFormat : 0; - texelBytes = _mesa_get_format_bytes(firstImage->TexFormat->MesaFormat); + compressed = firstImage->IsCompressed ? firstImage->TexFormat : 0; + texelBytes = _mesa_get_format_bytes(firstImage->TexFormat); return (mt->firstLevel == firstLevel && mt->lastLevel == lastLevel && @@ -374,7 +374,7 @@ GLboolean radeon_miptree_matches_texture(radeon_mipmap_tree *mt, struct gl_textu void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t, radeon_texture_image *image, GLuint face, GLuint level) { - GLuint compressed = image->base.IsCompressed ? image->base.TexFormat->MesaFormat : 0; + GLuint compressed = image->base.IsCompressed ? image->base.TexFormat : 0; GLuint numfaces = 1; GLuint firstLevel, lastLevel; GLuint texelBytes; @@ -388,7 +388,7 @@ void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t, if (level != firstLevel || face >= numfaces) return; - texelBytes = _mesa_get_format_bytes(image->base.TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(image->base.TexFormat); t->mt = radeon_miptree_create(rmesa, t, t->base.Target, image->base.InternalFormat, diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index a00497a8f9..1064602504 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -1031,18 +1031,18 @@ static GLboolean setup_hardware_state(r100ContextPtr rmesa, radeonTexObj *t, int log2Width = firstImage->WidthLog2; log2Height = firstImage->HeightLog2; log2Depth = firstImage->DepthLog2; - texelBytes = _mesa_get_format_bytes(firstImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(firstImage->TexFormat); if (!t->image_override) { - if (VALID_FORMAT(firstImage->TexFormat->MesaFormat)) { + if (VALID_FORMAT(firstImage->TexFormat)) { const struct tx_table *table = tx_table; t->pp_txformat &= ~(RADEON_TXFORMAT_FORMAT_MASK | RADEON_TXFORMAT_ALPHA_IN_MAP); t->pp_txfilter &= ~RADEON_YUV_TO_RGB; - t->pp_txformat |= table[ firstImage->TexFormat->MesaFormat ].format; - t->pp_txfilter |= table[ firstImage->TexFormat->MesaFormat ].filter; + t->pp_txformat |= table[ firstImage->TexFormat ].format; + t->pp_txfilter |= table[ firstImage->TexFormat ].filter; } else { _mesa_problem(NULL, "unexpected texture format in %s", __FUNCTION__); diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 3ff8cad93e..0378b3c9fc 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -256,9 +256,9 @@ void radeonGenerateMipmap(GLcontext* ctx, GLenum target, struct gl_texture_objec /* try to find a format which will only need a memcopy */ -static const struct gl_texture_format *radeonChoose8888TexFormat(radeonContextPtr rmesa, - GLenum srcFormat, - GLenum srcType, GLboolean fbo) +static gl_format radeonChoose8888TexFormat(radeonContextPtr rmesa, + GLenum srcFormat, + GLenum srcType, GLboolean fbo) { const GLuint ui = 1; const GLubyte littleEndian = *((const GLubyte *)&ui); @@ -271,37 +271,37 @@ static const struct gl_texture_format *radeonChoose8888TexFormat(radeonContextPt (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE && !littleEndian) || (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_INT_8_8_8_8_REV) || (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_BYTE && littleEndian)) { - return &_mesa_texformat_rgba8888; + return MESA_FORMAT_RGBA8888; } else if ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8_REV) || (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE && littleEndian) || (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_INT_8_8_8_8) || (srcFormat == GL_ABGR_EXT && srcType == GL_UNSIGNED_BYTE && !littleEndian)) { - return &_mesa_texformat_rgba8888_rev; + return MESA_FORMAT_RGBA8888_REV; } else if (IS_R200_CLASS(rmesa->radeonScreen)) { return _dri_texformat_argb8888; } else if (srcFormat == GL_BGRA && ((srcType == GL_UNSIGNED_BYTE && !littleEndian) || srcType == GL_UNSIGNED_INT_8_8_8_8)) { - return &_mesa_texformat_argb8888_rev; + return MESA_FORMAT_ARGB8888_REV; } else if (srcFormat == GL_BGRA && ((srcType == GL_UNSIGNED_BYTE && littleEndian) || srcType == GL_UNSIGNED_INT_8_8_8_8_REV)) { - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; } else return _dri_texformat_argb8888; } -const struct gl_texture_format *radeonChooseTextureFormat_mesa(GLcontext * ctx, - GLint internalFormat, - GLenum format, - GLenum type) +gl_format radeonChooseTextureFormat_mesa(GLcontext * ctx, + GLint internalFormat, + GLenum format, + GLenum type) { return radeonChooseTextureFormat(ctx, internalFormat, format, type, 0); } -const struct gl_texture_format *radeonChooseTextureFormat(GLcontext * ctx, - GLint internalFormat, - GLenum format, - GLenum type, GLboolean fbo) +gl_format radeonChooseTextureFormat(GLcontext * ctx, + GLint internalFormat, + GLenum format, + GLenum type, GLboolean fbo) { radeonContextPtr rmesa = RADEON_CONTEXT(ctx); const GLboolean do32bpt = @@ -425,50 +425,50 @@ const struct gl_texture_format *radeonChooseTextureFormat(GLcontext * ctx, case GL_YCBCR_MESA: if (type == GL_UNSIGNED_SHORT_8_8_APPLE || type == GL_UNSIGNED_BYTE) - return &_mesa_texformat_ycbcr; + return MESA_FORMAT_YCBCR; else - return &_mesa_texformat_ycbcr_rev; + return MESA_FORMAT_YCBCR_REV; case GL_RGB_S3TC: case GL_RGB4_S3TC: case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: - return &_mesa_texformat_rgb_dxt1; + return MESA_FORMAT_RGB_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - return &_mesa_texformat_rgba_dxt1; + return MESA_FORMAT_RGBA_DXT1; case GL_RGBA_S3TC: case GL_RGBA4_S3TC: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: - return &_mesa_texformat_rgba_dxt3; + return MESA_FORMAT_RGBA_DXT3; case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - return &_mesa_texformat_rgba_dxt5; + return MESA_FORMAT_RGBA_DXT5; case GL_ALPHA16F_ARB: - return &_mesa_texformat_alpha_float16; + return MESA_FORMAT_ALPHA_FLOAT16; case GL_ALPHA32F_ARB: - return &_mesa_texformat_alpha_float32; + return MESA_FORMAT_ALPHA_FLOAT32; case GL_LUMINANCE16F_ARB: - return &_mesa_texformat_luminance_float16; + return MESA_FORMAT_LUMINANCE_FLOAT16; case GL_LUMINANCE32F_ARB: - return &_mesa_texformat_luminance_float32; + return MESA_FORMAT_LUMINANCE_FLOAT32; case GL_LUMINANCE_ALPHA16F_ARB: - return &_mesa_texformat_luminance_alpha_float16; + return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16; case GL_LUMINANCE_ALPHA32F_ARB: - return &_mesa_texformat_luminance_alpha_float32; + return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32; case GL_INTENSITY16F_ARB: - return &_mesa_texformat_intensity_float16; + return MESA_FORMAT_INTENSITY_FLOAT16; case GL_INTENSITY32F_ARB: - return &_mesa_texformat_intensity_float32; + return MESA_FORMAT_INTENSITY_FLOAT32; case GL_RGB16F_ARB: - return &_mesa_texformat_rgba_float16; + return MESA_FORMAT_RGBA_FLOAT16; case GL_RGB32F_ARB: - return &_mesa_texformat_rgba_float32; + return MESA_FORMAT_RGBA_FLOAT32; case GL_RGBA16F_ARB: - return &_mesa_texformat_rgba_float16; + return MESA_FORMAT_RGBA_FLOAT16; case GL_RGBA32F_ARB: - return &_mesa_texformat_rgba_float32; + return MESA_FORMAT_RGBA_FLOAT32; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT16: @@ -476,7 +476,7 @@ const struct gl_texture_format *radeonChooseTextureFormat(GLcontext * ctx, case GL_DEPTH_COMPONENT32: case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: - return &_mesa_texformat_s8_z24; + return MESA_FORMAT_S8_Z24; /* EXT_texture_sRGB */ case GL_SRGB: @@ -485,26 +485,26 @@ const struct gl_texture_format *radeonChooseTextureFormat(GLcontext * ctx, case GL_SRGB8_ALPHA8: case GL_COMPRESSED_SRGB: case GL_COMPRESSED_SRGB_ALPHA: - return &_mesa_texformat_srgba8; + return MESA_FORMAT_SRGBA8; case GL_SLUMINANCE: case GL_SLUMINANCE8: case GL_COMPRESSED_SLUMINANCE: - return &_mesa_texformat_sl8; + return MESA_FORMAT_SL8; case GL_SLUMINANCE_ALPHA: case GL_SLUMINANCE8_ALPHA8: case GL_COMPRESSED_SLUMINANCE_ALPHA: - return &_mesa_texformat_sla8; + return MESA_FORMAT_SLA8; default: _mesa_problem(ctx, "unexpected internalFormat 0x%x in %s", (int)internalFormat, __func__); - return NULL; + return MESA_FORMAT_NONE; } - return NULL; /* never get here */ + return MESA_FORMAT_NONE; /* never get here */ } /** @@ -544,18 +544,18 @@ static void radeon_teximage( texImage->TexFormat = radeonChooseTextureFormat(ctx, internalFormat, format, type, 0); _mesa_set_fetch_functions(texImage, dims); - if (_mesa_is_format_compressed(texImage->TexFormat->MesaFormat)) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { texelBytes = 0; texImage->IsCompressed = GL_TRUE; texImage->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, texImage->Width, texImage->Height, texImage->Depth, - texImage->TexFormat->MesaFormat); + texImage->TexFormat); } else { texImage->IsCompressed = GL_FALSE; texImage->CompressedSize = 0; - texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* Minimum pitch of 32 bytes */ if (postConvWidth * texelBytes < 32) { postConvWidth = 32 / texelBytes; @@ -593,7 +593,7 @@ static void radeon_teximage( if (texImage->IsCompressed) { size = texImage->CompressedSize; } else { - size = texImage->Width * texImage->Height * texImage->Depth * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + size = texImage->Width * texImage->Height * texImage->Depth * _mesa_get_format_bytes(texImage->TexFormat); } texImage->Data = _mesa_alloc_texmemory(size); } @@ -613,7 +613,7 @@ static void radeon_teximage( if (compressed) { if (image->mt) { uint32_t srcRowStride, bytesPerRow, rows; - srcRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); + srcRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width); bytesPerRow = srcRowStride; rows = (height + 3) / 4; copy_rows(texImage->Data, image->mt->levels[level].rowstride, @@ -629,7 +629,7 @@ static void radeon_teximage( radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel]; dstRowStride = lvl->rowstride; } else { - dstRowStride = texImage->Width * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + dstRowStride = texImage->Width * _mesa_get_format_bytes(texImage->TexFormat); } if (dims == 3) { @@ -640,7 +640,7 @@ static void radeon_teximage( _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); for (i = 0; i < depth; ++i) { - dstImageOffsets[i] = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat->MesaFormat) * height * i; + dstImageOffsets[i] = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat) * height * i; } } else { dstImageOffsets = texImage->ImageOffsets; @@ -756,23 +756,23 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel]; dstRowStride = lvl->rowstride; } else { - dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat); } if (compressed) { uint32_t srcRowStride, bytesPerRow, rows; GLubyte *img_start; if (!image->mt) { - dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, texImage->Width); + dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, texImage->Width); img_start = _mesa_compressed_image_address(xoffset, yoffset, 0, - texImage->TexFormat->MesaFormat, + texImage->TexFormat, texImage->Width, texImage->Data); } else { uint32_t blocks_x = dstRowStride / (image->mt->bpp * 4); img_start = texImage->Data + image->mt->bpp * 4 * (blocks_x * (yoffset / 4) + xoffset / 4); } - srcRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); + srcRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width); bytesPerRow = srcRowStride; rows = (height + 3) / 4; @@ -895,10 +895,10 @@ static void migrate_image_to_miptree(radeon_mipmap_tree *mt, radeon_texture_imag /* need to confirm this value is correct */ if (mt->compressed) { height = (image->base.Height + 3) / 4; - srcrowstride = _mesa_compressed_row_stride(image->base.TexFormat->MesaFormat, image->base.Width); + srcrowstride = _mesa_compressed_row_stride(image->base.TexFormat, image->base.Width); } else { height = image->base.Height * image->base.Depth; - srcrowstride = image->base.Width * _mesa_get_format_bytes(image->base.TexFormat->MesaFormat); + srcrowstride = image->base.Width * _mesa_get_format_bytes(image->base.TexFormat); } // if (mt->tilebits) diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.h b/src/mesa/drivers/dri/radeon/radeon_texture.h index 888a55ba91..8995546d77 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.h +++ b/src/mesa/drivers/dri/radeon/radeon_texture.h @@ -30,6 +30,10 @@ #ifndef RADEON_TEXTURE_H #define RADEON_TEXTURE_H + +#include "main/formats.h" + + struct gl_texture_image *radeonNewTextureImage(GLcontext *ctx); void radeonFreeTexImageData(GLcontext *ctx, struct gl_texture_image *timage); @@ -40,14 +44,16 @@ void radeonUnmapTexture(GLcontext *ctx, struct gl_texture_object *texObj); void radeonGenerateMipmap(GLcontext* ctx, GLenum target, struct gl_texture_object *texObj); int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *texObj); GLuint radeon_face_for_target(GLenum target); -const struct gl_texture_format *radeonChooseTextureFormat_mesa(GLcontext * ctx, - GLint internalFormat, - GLenum format, - GLenum type); -const struct gl_texture_format *radeonChooseTextureFormat(GLcontext * ctx, - GLint internalFormat, - GLenum format, - GLenum type, GLboolean fbo); + +gl_format radeonChooseTextureFormat_mesa(GLcontext * ctx, + GLint internalFormat, + GLenum format, + GLenum type); + +gl_format radeonChooseTextureFormat(GLcontext * ctx, + GLint internalFormat, + GLenum format, + GLenum type, GLboolean fbo); void radeonTexImage1D(GLcontext * ctx, GLenum target, GLint level, GLint internalFormat, diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c index fe239e1b05..796da4fc0d 100644 --- a/src/mesa/drivers/dri/savage/savagetex.c +++ b/src/mesa/drivers/dri/savage/savagetex.c @@ -527,6 +527,11 @@ savageAllocTexObj( struct gl_texture_object *texObj ) * components to white. This way we get the correct result. */ +#if 0 +/* Using MESA_FORMAT_RGBA8888 to store alpha-only textures should + * work but is space inefficient. + */ + static GLboolean _savage_texstore_a1114444(TEXSTORE_PARAMS); @@ -590,10 +595,11 @@ _savage_texstore_a1114444(TEXSTORE_PARAMS) return GL_FALSE; _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { + GLuint texelBytes = _mesa_get_format_bytes(dstFormat); GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLushort *dstUI = (GLushort *) dstRow; for (col = 0; col < srcWidth; col++) { @@ -629,10 +635,11 @@ _savage_texstore_a1118888(TEXSTORE_PARAMS) return GL_FALSE; _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); for (img = 0; img < srcDepth; img++) { + GLuint texelBytes = _mesa_get_format_bytes(dstFormat); GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * dstFormat->TexelBytes + + dstImageOffsets[dstZoffset + img] * texelBytes + dstYoffset * dstRowStride - + dstXoffset * dstFormat->TexelBytes; + + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; for (col = 0; col < srcWidth; col++) { @@ -647,10 +654,11 @@ _savage_texstore_a1118888(TEXSTORE_PARAMS) return GL_TRUE; } +#endif /* Called by the _mesa_store_teximage[123]d() functions. */ -static const struct gl_texture_format * +static gl_format savageChooseTextureFormat( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { @@ -669,15 +677,15 @@ savageChooseTextureFormat( GLcontext *ctx, GLint internalFormat, switch ( type ) { case GL_UNSIGNED_INT_10_10_10_2: case GL_UNSIGNED_INT_2_10_10_10_REV: - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555; case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_4_4_4_4_REV: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_UNSIGNED_SHORT_5_5_5_1: case GL_UNSIGNED_SHORT_1_5_5_5_REV: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; default: - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; } case 3: @@ -686,129 +694,152 @@ savageChooseTextureFormat( GLcontext *ctx, GLint internalFormat, switch ( type ) { case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_4_4_4_4_REV: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_UNSIGNED_SHORT_5_5_5_1: case GL_UNSIGNED_SHORT_1_5_5_5_REV: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_5_6_5_REV: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; default: - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565; } case GL_RGBA8: case GL_RGBA12: case GL_RGBA16: return !force16bpt ? - &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; case GL_RGB10_A2: return !force16bpt ? - &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555; + MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555; case GL_RGBA4: case GL_RGBA2: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_RGB5_A1: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: - return !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565; + return !force16bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565; case GL_RGB5: case GL_RGB4: case GL_R3_G3_B2: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; case GL_ALPHA: case GL_COMPRESSED_ALPHA: - return isSavage4 ? &_mesa_texformat_a8 : ( +#if 0 + return isSavage4 ? MESA_FORMAT_a8 : ( do32bpt ? &_savage_texformat_a1118888 : &_savage_texformat_a1114444); +#else + if (isSavage4) + return MESA_FORMAT_A8; + else if (do32bpt) + return MESA_FORMAT_ARGB8888; + else + return MESA_FORMAT_ARGB4444; +#endif case GL_ALPHA4: - return isSavage4 ? &_mesa_texformat_a8 : &_savage_texformat_a1114444; +#if 0 + return isSavage4 ? MESA_FORMAT_a8 : &_savage_texformat_a1114444; +#else + if (isSavage4) + return MESA_FORMAT_A8; + else + return MESA_FORMAT_ARGB4444; +#endif case GL_ALPHA8: case GL_ALPHA12: case GL_ALPHA16: - return isSavage4 ? &_mesa_texformat_a8 : ( +#if 0 + return isSavage4 ? MESA_FORMAT_a8 : ( !force16bpt ? &_savage_texformat_a1118888 : &_savage_texformat_a1114444); - +#else + if (isSavage4) + return MESA_FORMAT_A8; + else if (force16bpt) + return MESA_FORMAT_ARGB4444; + else + return MESA_FORMAT_ARGB8888; +#endif case 1: case GL_LUMINANCE: case GL_COMPRESSED_LUMINANCE: /* no alpha, but use argb1555 in 16bit case to get pure grey values */ - return isSavage4 ? &_mesa_texformat_l8 : ( - do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555); + return isSavage4 ? MESA_FORMAT_L8 : ( + do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555); case GL_LUMINANCE4: - return isSavage4 ? &_mesa_texformat_l8 : &_mesa_texformat_argb1555; + return isSavage4 ? MESA_FORMAT_L8 : MESA_FORMAT_ARGB1555; case GL_LUMINANCE8: case GL_LUMINANCE12: case GL_LUMINANCE16: - return isSavage4 ? &_mesa_texformat_l8 : ( - !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555); + return isSavage4 ? MESA_FORMAT_L8 : ( + !force16bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555); case 2: case GL_LUMINANCE_ALPHA: case GL_COMPRESSED_LUMINANCE_ALPHA: /* Savage4 has a al44 texture format. But it's not supported by Mesa. */ - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; case GL_LUMINANCE4_ALPHA4: case GL_LUMINANCE6_ALPHA2: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_LUMINANCE8_ALPHA8: case GL_LUMINANCE12_ALPHA4: case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: - return !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + return !force16bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; #if 0 /* TFT_I8 produces garbage on ProSavageDDR and subsequent texture * disable keeps rendering garbage. Disabled for now. */ case GL_INTENSITY: case GL_COMPRESSED_INTENSITY: - return isSavage4 ? &_mesa_texformat_i8 : ( - do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444); + return isSavage4 ? MESA_FORMAT_i8 : ( + do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444); case GL_INTENSITY4: - return isSavage4 ? &_mesa_texformat_i8 : &_mesa_texformat_argb4444; + return isSavage4 ? MESA_FORMAT_i8 : MESA_FORMAT_ARGB4444; case GL_INTENSITY8: case GL_INTENSITY12: case GL_INTENSITY16: - return isSavage4 ? &_mesa_texformat_i8 : ( - !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444); + return isSavage4 ? MESA_FORMAT_i8 : ( + !force16bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444); #else case GL_INTENSITY: case GL_COMPRESSED_INTENSITY: - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; case GL_INTENSITY4: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_INTENSITY8: case GL_INTENSITY12: case GL_INTENSITY16: - return !force16bpt ? &_mesa_texformat_argb8888 : - &_mesa_texformat_argb4444; + return !force16bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; #endif case GL_RGB_S3TC: case GL_RGB4_S3TC: case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: - return &_mesa_texformat_rgb_dxt1; + return MESA_FORMAT_RGB_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - return &_mesa_texformat_rgba_dxt1; + return MESA_FORMAT_RGBA_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: - return &_mesa_texformat_rgba_dxt3; + return MESA_FORMAT_RGBA_DXT3; case GL_RGBA_S3TC: case GL_RGBA4_S3TC: if (!isSavage4) /* Not the best choice but Savage3D/MX/IX don't support DXT3 or DXT5. */ - return &_mesa_texformat_rgba_dxt1; + return MESA_FORMAT_RGBA_DXT1; /* fall through */ case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - return &_mesa_texformat_rgba_dxt5; + return MESA_FORMAT_RGBA_DXT5; /* case GL_COLOR_INDEX: @@ -822,7 +853,7 @@ savageChooseTextureFormat( GLcontext *ctx, GLint internalFormat, */ default: _mesa_problem(ctx, "unexpected texture format in %s", __FUNCTION__); - return NULL; + return MESA_FORMAT_NONE; } } @@ -837,7 +868,7 @@ static void savageSetTexImages( savageContextPtr imesa, assert(t); assert(image); - switch (image->TexFormat->MesaFormat) { + switch (image->TexFormat) { case MESA_FORMAT_ARGB8888: textureFormat = TFT_ARGB8888; t->texelBytes = tileIndex = 4; @@ -2083,6 +2114,7 @@ void savageDDInitTextureFuncs( struct dd_function_table *functions ) /* Texel fetching with our custom texture formats works just like * the standard argb formats. */ +#if 0 _savage_texformat_a1114444.FetchTexel1D = _mesa_texformat_argb4444.FetchTexel1D; _savage_texformat_a1114444.FetchTexel2D = _mesa_texformat_argb4444.FetchTexel2D; _savage_texformat_a1114444.FetchTexel3D = _mesa_texformat_argb4444.FetchTexel3D; @@ -2096,4 +2128,5 @@ void savageDDInitTextureFuncs( struct dd_function_table *functions ) _savage_texformat_a1118888.FetchTexel1Df= _mesa_texformat_argb8888.FetchTexel1Df; _savage_texformat_a1118888.FetchTexel2Df= _mesa_texformat_argb8888.FetchTexel2Df; _savage_texformat_a1118888.FetchTexel3Df= _mesa_texformat_argb8888.FetchTexel3Df; +#endif } diff --git a/src/mesa/drivers/dri/sis/sis_tex.c b/src/mesa/drivers/dri/sis/sis_tex.c index 38a309d41f..5dc05146b1 100644 --- a/src/mesa/drivers/dri/sis/sis_tex.c +++ b/src/mesa/drivers/dri/sis/sis_tex.c @@ -65,7 +65,7 @@ sisAllocTexImage( sisContextPtr smesa, sisTexObjPtr t, int level, if (t->format == 0) { t->format = image->_BaseFormat; - switch (image->TexFormat->MesaFormat) + switch (image->TexFormat) { case MESA_FORMAT_ARGB8888: t->hwformat = TEXEL_ARGB_8888_32; @@ -101,13 +101,12 @@ sisAllocTexImage( sisContextPtr smesa, sisTexObjPtr t, int level, t->hwformat = TEXEL_VUY422; break; default: - sis_fatal_error("Bad texture format 0x%x.\n", - image->TexFormat->MesaFormat); + sis_fatal_error("Bad texture format 0x%x.\n", image->TexFormat); } } assert(t->format == image->_BaseFormat); - texel_size = _mesa_get_format_bytes(image->TexFormat->MesaFormat); + texel_size = _mesa_get_format_bytes(image->TexFormat); size = image->Width * image->Height * texel_size + TEXTURE_HW_PLUS; addr = sisAllocFB( smesa, size, &t->image[level].handle ); @@ -230,7 +229,7 @@ static GLboolean sisIsTextureResident( GLcontext * ctx, return (texObj->DriverData != NULL); } -static const struct gl_texture_format * +static gl_format sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { @@ -248,15 +247,15 @@ sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat, switch ( type ) { case GL_UNSIGNED_INT_10_10_10_2: case GL_UNSIGNED_INT_2_10_10_10_REV: - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555; case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_4_4_4_4_REV: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_UNSIGNED_SHORT_5_5_5_1: case GL_UNSIGNED_SHORT_1_5_5_5_REV: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; default: - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; } case 3: @@ -265,46 +264,46 @@ sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat, switch ( type ) { case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_4_4_4_4_REV: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_UNSIGNED_SHORT_5_5_5_1: case GL_UNSIGNED_SHORT_1_5_5_5_REV: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_5_6_5_REV: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; default: - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565; } case GL_RGBA8: case GL_RGBA12: case GL_RGBA16: return !force16bpt ? - &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; case GL_RGB10_A2: return !force16bpt ? - &_mesa_texformat_argb8888 : &_mesa_texformat_argb1555; + MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB1555; case GL_RGBA4: case GL_RGBA2: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_RGB5_A1: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: - return !force16bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565; + return !force16bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565; case GL_RGB5: case GL_RGB4: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; case GL_R3_G3_B2: - return &_mesa_texformat_rgb332; + return MESA_FORMAT_RGB332; case GL_ALPHA: case GL_ALPHA4: /* FIXME: This could use its own texstore */ @@ -312,7 +311,7 @@ sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_ALPHA12: case GL_ALPHA16: case GL_COMPRESSED_ALPHA: - return &_mesa_texformat_a8; + return MESA_FORMAT_A8; case 1: case GL_LUMINANCE: @@ -321,7 +320,7 @@ sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12: case GL_LUMINANCE16: case GL_COMPRESSED_LUMINANCE: - return &_mesa_texformat_l8; + return MESA_FORMAT_L8; case 2: case GL_LUMINANCE_ALPHA: @@ -332,7 +331,7 @@ sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: case GL_COMPRESSED_LUMINANCE_ALPHA: - return &_mesa_texformat_al88; + return MESA_FORMAT_AL88; case GL_INTENSITY: case GL_INTENSITY4: @@ -340,19 +339,19 @@ sisChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_INTENSITY12: case GL_INTENSITY16: case GL_COMPRESSED_INTENSITY: - return &_mesa_texformat_i8; + return MESA_FORMAT_I8; case GL_YCBCR_MESA: if (type == GL_UNSIGNED_SHORT_8_8_APPLE || type == GL_UNSIGNED_BYTE) - return &_mesa_texformat_ycbcr; + return MESA_FORMAT_YCBCR; else - return &_mesa_texformat_ycbcr_rev; + return MESA_FORMAT_YCBCR_REV; default: _mesa_problem(ctx, "unexpected format in sisDDChooseTextureFormat: %d", internalFormat); - return NULL; + return MESA_FORMAT_NONE; } } @@ -425,7 +424,7 @@ static void sisTexSubImage1D( GLcontext *ctx, /* Upload the texture */ WaitEngIdle(smesa); - texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); copySize = width * texelBytes; src = (char *)texImage->Data + xoffset * texelBytes; @@ -513,7 +512,7 @@ static void sisTexSubImage2D( GLcontext *ctx, /* Upload the texture */ WaitEngIdle(smesa); - texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); copySize = width * texelBytes; src = (char *)texImage->Data + (xoffset + yoffset * texImage->Width) * diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index 51d86aea37..427d315a01 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -72,13 +72,13 @@ _mesa_halve2x2_teximage2d ( GLcontext *ctx, GLubyte *_d = NULL; GLenum _t = 0; - if (texImage->TexFormat->MesaFormat == MESA_FORMAT_RGB565) { + if (texImage->TexFormat == MESA_FORMAT_RGB565) { _t = GL_UNSIGNED_SHORT_5_6_5_REV; bpt = bytesPerPixel; - } else if (texImage->TexFormat->MesaFormat == MESA_FORMAT_ARGB4444) { + } else if (texImage->TexFormat == MESA_FORMAT_ARGB4444) { _t = GL_UNSIGNED_SHORT_4_4_4_4_REV; bpt = bytesPerPixel; - } else if (texImage->TexFormat->MesaFormat == MESA_FORMAT_ARGB1555) { + } else if (texImage->TexFormat == MESA_FORMAT_ARGB1555) { _t = GL_UNSIGNED_SHORT_1_5_5_5_REV; bpt = bytesPerPixel; } @@ -94,7 +94,7 @@ _mesa_halve2x2_teximage2d ( GLcontext *ctx, _s = src = MALLOC(srcRowStride * srcHeight); _d = dst = MALLOC(dstWidth * bytesPerPixel * dstHeight); _mesa_texstore(ctx, 2, GL_RGBA, - &_mesa_texformat_rgba8888_rev, src, + MESA_FORMAT_RGBA8888_REV, src, 0, 0, 0, /* dstX/Y/Zoffset */ srcRowStride, /* dstRowStride */ &dstImageOffsets, @@ -190,6 +190,7 @@ tdfxGenerateMipmap(GLcontext *ctx, GLenum target, const tdfxMipMapLevel *mml; texImage = _mesa_get_tex_image(ctx, texObj, target, level); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); assert(!texImage->IsCompressed); mml = TDFX_TEXIMAGE_DATA(texImage); @@ -760,7 +761,7 @@ fxTexusError(const char *string, FxBool fatal) #endif -static const struct gl_texture_format * +static gl_format tdfxChooseTextureFormat( GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType ) { @@ -774,7 +775,7 @@ tdfxChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_ALPHA12: case GL_ALPHA16: case GL_COMPRESSED_ALPHA: - return &_mesa_texformat_a8; + return MESA_FORMAT_A8; case 1: case GL_LUMINANCE: case GL_LUMINANCE4: @@ -782,7 +783,7 @@ tdfxChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12: case GL_LUMINANCE16: case GL_COMPRESSED_LUMINANCE: - return &_mesa_texformat_l8; + return MESA_FORMAT_L8; case 2: case GL_LUMINANCE_ALPHA: case GL_LUMINANCE4_ALPHA4: @@ -792,48 +793,47 @@ tdfxChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: case GL_COMPRESSED_LUMINANCE_ALPHA: - return &_mesa_texformat_al88; + return MESA_FORMAT_AL88; case GL_INTENSITY: case GL_INTENSITY4: case GL_INTENSITY8: case GL_INTENSITY12: case GL_INTENSITY16: case GL_COMPRESSED_INTENSITY: - return &_mesa_texformat_i8; + return MESA_FORMAT_I8; case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; case GL_COMPRESSED_RGB: /* intentional fall-through */ case 3: case GL_RGB: if ( srcFormat == GL_RGB && srcType == GL_UNSIGNED_SHORT_5_6_5 ) { - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; } /* intentional fall through */ case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: - return (allow32bpt) ? &_mesa_texformat_argb8888 - : &_mesa_texformat_rgb565; + return (allow32bpt) ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565; case GL_RGBA2: case GL_RGBA4: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_COMPRESSED_RGBA: /* intentional fall-through */ case 4: case GL_RGBA: if ( srcFormat == GL_BGRA ) { if ( srcType == GL_UNSIGNED_INT_8_8_8_8_REV ) { - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; } else if ( srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV ) { - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; } else if ( srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ) { - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; } } /* intentional fall through */ @@ -841,10 +841,9 @@ tdfxChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: - return allow32bpt ? &_mesa_texformat_argb8888 - : &_mesa_texformat_argb4444; + return allow32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; case GL_RGB5_A1: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case GL_COLOR_INDEX: case GL_COLOR_INDEX1_EXT: case GL_COLOR_INDEX2_EXT: @@ -852,29 +851,29 @@ tdfxChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_COLOR_INDEX8_EXT: case GL_COLOR_INDEX12_EXT: case GL_COLOR_INDEX16_EXT: - return &_mesa_texformat_ci8; + return MESA_FORMAT_CI8; /* GL_EXT_texture_compression_s3tc */ /* GL_S3_s3tc */ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_RGB_S3TC: case GL_RGB4_S3TC: - return &_mesa_texformat_rgb_dxt1; + return MESA_FORMAT_RGB_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - return &_mesa_texformat_rgba_dxt1; + return MESA_FORMAT_RGBA_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_RGBA_S3TC: case GL_RGBA4_S3TC: - return &_mesa_texformat_rgba_dxt3; + return MESA_FORMAT_RGBA_DXT3; case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - return &_mesa_texformat_rgba_dxt5; + return MESA_FORMAT_RGBA_DXT5; /* GL_3DFX_texture_compression_FXT1 */ case GL_COMPRESSED_RGB_FXT1_3DFX: - return &_mesa_texformat_rgb_fxt1; + return MESA_FORMAT_RGB_FXT1; case GL_COMPRESSED_RGBA_FXT1_3DFX: - return &_mesa_texformat_rgba_fxt1; + return MESA_FORMAT_RGBA_FXT1; default: _mesa_problem(ctx, "unexpected format in tdfxChooseTextureFormat"); - return NULL; + return MESA_FORMAT_NONE; } } @@ -1126,7 +1125,9 @@ fetch_rgb_dxt1(const struct gl_texture_image *texImage, i = i * mml->wScale; j = j * mml->hScale; + /* XXX Get fetch func from _mesa_get_texel_fetch_func() _mesa_texformat_rgb_dxt1.FetchTexel2D(texImage, i, j, k, rgba); + */ } @@ -1139,7 +1140,9 @@ fetch_rgba_dxt1(const struct gl_texture_image *texImage, i = i * mml->wScale; j = j * mml->hScale; + /* XXX Get fetch func from _mesa_get_texel_fetch_func() _mesa_texformat_rgba_dxt1.FetchTexel2D(texImage, i, j, k, rgba); + */ } @@ -1152,7 +1155,9 @@ fetch_rgba_dxt3(const struct gl_texture_image *texImage, i = i * mml->wScale; j = j * mml->hScale; + /* XXX Get fetch func from _mesa_get_texel_fetch_func() _mesa_texformat_rgba_dxt3.FetchTexel2D(texImage, i, j, k, rgba); + */ } @@ -1165,7 +1170,9 @@ fetch_rgba_dxt5(const struct gl_texture_image *texImage, i = i * mml->wScale; j = j * mml->hScale; + /* XXX Get fetch func from _mesa_get_texel_fetch_func() _mesa_texformat_rgba_dxt5.FetchTexel2D(texImage, i, j, k, rgba); + */ } @@ -1268,7 +1275,7 @@ adjust2DRatio (GLcontext *ctx, } /* unpack image, apply transfer ops and store in rawImage */ _mesa_texstore(ctx, 2, GL_RGBA, - &_mesa_texformat_rgba8888_rev, rawImage, + MESA_FORMAT_RGBA8888_REV, rawImage, 0, 0, 0, /* dstX/Y/Zoffset */ width * rawBytes, /* dstRowStride */ &dstImageOffsets, @@ -1396,11 +1403,11 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, internalFormat, format, type); assert(texImage->TexFormat); - mesaFormat = texImage->TexFormat->MesaFormat; + mesaFormat = texImage->TexFormat; mml->glideFormat = fxGlideFormat(mesaFormat); ti->info.format = mml->glideFormat; texImage->FetchTexelc = fxFetchFunction(mesaFormat); - texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); if (texImage->IsCompressed) { texImage->CompressedSize = _mesa_compressed_texture_size(ctx, @@ -1408,7 +1415,7 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, mml->height, 1, mesaFormat); - dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, mml->width); + dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, mml->width); texImage->Data = _mesa_alloc_texmemory(texImage->CompressedSize); } else { dstRowStride = mml->width * texelBytes; @@ -1484,9 +1491,9 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, assert(texImage->Data); /* must have an existing texture image! */ assert(texImage->_BaseFormat); - texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); if (texImage->IsCompressed) { - dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, mml->width); + dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, mml->width); } else { dstRowStride = mml->width * texelBytes; } @@ -1626,7 +1633,7 @@ tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target, /* Determine the appropriate Glide texel format, * given the user's internal texture format hint. */ - mesaFormat = texImage->TexFormat->MesaFormat; + mesaFormat = texImage->TexFormat; mml->glideFormat = fxGlideFormat(mesaFormat); ti->info.format = mml->glideFormat; texImage->FetchTexelc = fxFetchFunction(mesaFormat); @@ -1661,7 +1668,7 @@ tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target, * we replicate the data over the padded area. * For now, we take 2) + 3) but texelfetchers will be wrong! */ - const GLuint mesaFormat = texImage->TexFormat->MesaFormat; + const GLuint mesaFormat = texImage->TexFormat; GLuint srcRowStride = _mesa_compressed_row_stride(mesaFormat, width); GLuint destRowStride = _mesa_compressed_row_stride(mesaFormat, @@ -1698,7 +1705,7 @@ tdfxCompressedTexSubImage2D( GLcontext *ctx, GLenum target, GLint destRowStride, srcRowStride; GLint i, rows; GLubyte *dest; - const GLuint mesaFormat = texImage->TexFormat->MesaFormat; + const GLuint mesaFormat = texImage->TexFormat; if (TDFX_DEBUG & DEBUG_VERBOSE_DRI) { fprintf(stderr, "tdfxCompressedTexSubImage2D: id=%d\n", texObj->Name); diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index f700994025..b6be06d1ee 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -49,7 +49,7 @@ #include "via_ioctl.h" #include "via_3d_reg.h" -static const struct gl_texture_format * +static gl_format viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { @@ -66,56 +66,56 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, if ( format == GL_BGRA ) { if ( type == GL_UNSIGNED_INT_8_8_8_8_REV || type == GL_UNSIGNED_BYTE ) { - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; } else if ( type == GL_UNSIGNED_SHORT_4_4_4_4_REV ) { - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; } else if ( type == GL_UNSIGNED_SHORT_1_5_5_5_REV ) { - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; } } else if ( type == GL_UNSIGNED_BYTE || type == GL_UNSIGNED_INT_8_8_8_8_REV || type == GL_UNSIGNED_INT_8_8_8_8 ) { - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; } - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_argb4444; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB4444; case 3: case GL_RGB: case GL_COMPRESSED_RGB: if ( format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5 ) { - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; } else if ( type == GL_UNSIGNED_BYTE ) { - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; } - return do32bpt ? &_mesa_texformat_argb8888 : &_mesa_texformat_rgb565; + return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565; case GL_RGBA8: case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; case GL_RGBA4: case GL_RGBA2: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_RGB5_A1: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; case GL_RGB5: case GL_RGB4: case GL_R3_G3_B2: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; case GL_ALPHA: case GL_ALPHA4: @@ -123,7 +123,7 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, case GL_ALPHA12: case GL_ALPHA16: case GL_COMPRESSED_ALPHA: - return &_mesa_texformat_a8; + return MESA_FORMAT_A8; case 1: case GL_LUMINANCE: @@ -132,7 +132,7 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12: case GL_LUMINANCE16: case GL_COMPRESSED_LUMINANCE: - return &_mesa_texformat_l8; + return MESA_FORMAT_L8; case 2: case GL_LUMINANCE_ALPHA: @@ -143,7 +143,7 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: case GL_COMPRESSED_LUMINANCE_ALPHA: - return &_mesa_texformat_al88; + return MESA_FORMAT_AL88; case GL_INTENSITY: case GL_INTENSITY4: @@ -151,35 +151,35 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, case GL_INTENSITY12: case GL_INTENSITY16: case GL_COMPRESSED_INTENSITY: - return &_mesa_texformat_i8; + return MESA_FORMAT_I8; case GL_YCBCR_MESA: if (type == GL_UNSIGNED_SHORT_8_8_MESA || type == GL_UNSIGNED_BYTE) - return &_mesa_texformat_ycbcr; + return MESA_FORMAT_YCBCR; else - return &_mesa_texformat_ycbcr_rev; + return MESA_FORMAT_YCBCR_REV; case GL_COMPRESSED_RGB_FXT1_3DFX: - return &_mesa_texformat_rgb_fxt1; + return MESA_FORMAT_RGB_FXT1; case GL_COMPRESSED_RGBA_FXT1_3DFX: - return &_mesa_texformat_rgba_fxt1; + return MESA_FORMAT_RGBA_FXT1; case GL_RGB_S3TC: case GL_RGB4_S3TC: case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: - return &_mesa_texformat_rgb_dxt1; + return MESA_FORMAT_RGB_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - return &_mesa_texformat_rgba_dxt1; + return MESA_FORMAT_RGBA_DXT1; case GL_RGBA_S3TC: case GL_RGBA4_S3TC: case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: - return &_mesa_texformat_rgba_dxt3; + return MESA_FORMAT_RGBA_DXT3; case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - return &_mesa_texformat_rgba_dxt5; + return MESA_FORMAT_RGBA_DXT5; case GL_COLOR_INDEX: case GL_COLOR_INDEX1_EXT: @@ -188,16 +188,16 @@ viaChooseTexFormat( GLcontext *ctx, GLint internalFormat, case GL_COLOR_INDEX8_EXT: case GL_COLOR_INDEX12_EXT: case GL_COLOR_INDEX16_EXT: - return &_mesa_texformat_ci8; + return MESA_FORMAT_CI8; default: fprintf(stderr, "unexpected texture format %s in %s\n", _mesa_lookup_enum_by_nr(internalFormat), __FUNCTION__); - return NULL; + return MESA_FORMAT_NONE; } - return NULL; /* never get here */ + return MESA_FORMAT_NONE; /* never get here */ } static int logbase2(int n) @@ -458,7 +458,7 @@ static GLboolean viaSetTexImages(GLcontext *ctx, GLuint widthExp = 0; GLuint heightExp = 0; - switch (baseImage->image.TexFormat->MesaFormat) { + switch (baseImage->image.TexFormat) { case MESA_FORMAT_ARGB8888: texFormat = HC_HTXnFM_ARGB8888; break; @@ -692,7 +692,7 @@ static void viaTexImage(GLcontext *ctx, _mesa_set_fetch_functions(texImage, dims); - texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); if (texelBytes == 0) { /* compressed format */ @@ -700,7 +700,7 @@ static void viaTexImage(GLcontext *ctx, texImage->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, texImage->Width, texImage->Height, texImage->Depth, - texImage->TexFormat->MesaFormat); + texImage->TexFormat); } /* Minimum pitch of 32 bytes */ @@ -794,10 +794,10 @@ static void viaTexImage(GLcontext *ctx, GLboolean success; if (texImage->IsCompressed) { - dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); + dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width); } else { - dstRowStride = postConvWidth * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + dstRowStride = postConvWidth * _mesa_get_format_bytes(texImage->TexFormat); } success = _mesa_texstore(ctx, dims, texImage->_BaseFormat, diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index 354015af1d..a64b6a5553 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -1016,7 +1016,7 @@ PrintTexture(int w, int h, int c, const GLubyte * data) #endif -const struct gl_texture_format * +gl_format fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType ) { @@ -1033,31 +1033,31 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case 3: case GL_RGB: if ( srcFormat == GL_RGB && srcType == GL_UNSIGNED_SHORT_5_6_5 ) { - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; } /* intentional fall through */ case GL_RGB8: case GL_RGB10: case GL_RGB12: case GL_RGB16: - return (allow32bpt) ? &_mesa_texformat_argb8888 - : &_mesa_texformat_rgb565; + return (allow32bpt) ? MESA_FORMAT_ARGB8888 + : MESA_FORMAT_RGB565; case GL_RGBA2: case GL_RGBA4: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case GL_COMPRESSED_RGBA: /* intentional fall through */ case 4: case GL_RGBA: if ( srcFormat == GL_BGRA ) { if ( srcType == GL_UNSIGNED_INT_8_8_8_8_REV ) { - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; } else if ( srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV ) { - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; } else if ( srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV ) { - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; } } /* intentional fall through */ @@ -1065,15 +1065,15 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: - return (allow32bpt) ? &_mesa_texformat_argb8888 - : &_mesa_texformat_argb4444; + return (allow32bpt) ? MESA_FORMAT_ARGB8888 + : MESA_FORMAT_ARGB4444; case GL_INTENSITY: case GL_INTENSITY4: case GL_INTENSITY8: case GL_INTENSITY12: case GL_INTENSITY16: case GL_COMPRESSED_INTENSITY: - return &_mesa_texformat_i8; + return MESA_FORMAT_I8; case 1: case GL_LUMINANCE: case GL_LUMINANCE4: @@ -1081,14 +1081,14 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12: case GL_LUMINANCE16: case GL_COMPRESSED_LUMINANCE: - return &_mesa_texformat_l8; + return MESA_FORMAT_L8; case GL_ALPHA: case GL_ALPHA4: case GL_ALPHA8: case GL_ALPHA12: case GL_ALPHA16: case GL_COMPRESSED_ALPHA: - return &_mesa_texformat_a8; + return MESA_FORMAT_A8; case GL_COLOR_INDEX: case GL_COLOR_INDEX1_EXT: case GL_COLOR_INDEX2_EXT: @@ -1096,7 +1096,7 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_COLOR_INDEX8_EXT: case GL_COLOR_INDEX12_EXT: case GL_COLOR_INDEX16_EXT: - return &_mesa_texformat_ci8; + return MESA_FORMAT_CI8; case 2: case GL_LUMINANCE_ALPHA: case GL_LUMINANCE4_ALPHA4: @@ -1106,35 +1106,35 @@ fxDDChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: case GL_COMPRESSED_LUMINANCE_ALPHA: - return &_mesa_texformat_al88; + return MESA_FORMAT_AL88; case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; case GL_RGB5_A1: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; /* GL_EXT_texture_compression_s3tc */ /* GL_S3_s3tc */ case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_RGB_S3TC: case GL_RGB4_S3TC: - return &_mesa_texformat_rgb_dxt1; + return MESA_FORMAT_RGB_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - return &_mesa_texformat_rgba_dxt1; + return MESA_FORMAT_RGBA_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_RGBA_S3TC: case GL_RGBA4_S3TC: - return &_mesa_texformat_rgba_dxt3; + return MESA_FORMAT_RGBA_DXT3; case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - return &_mesa_texformat_rgba_dxt5; + return MESA_FORMAT_RGBA_DXT5; /* GL_3DFX_texture_compression_FXT1 */ case GL_COMPRESSED_RGB_FXT1_3DFX: - return &_mesa_texformat_rgb_fxt1; + return MESA_FORMAT_RGB_FXT1; case GL_COMPRESSED_RGBA_FXT1_3DFX: - return &_mesa_texformat_rgba_fxt1; + return MESA_FORMAT_RGBA_FXT1; default: _mesa_problem(NULL, "unexpected format in fxDDChooseTextureFormat"); - return NULL; + return MESA_FORMAT_NONE; } } diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index e2d4aa9b2d..5b00b5b82c 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -1019,15 +1019,15 @@ test_proxy_teximage(GLcontext *ctx, GLenum target, GLint level, /** * In SW, we don't really compress GL_COMPRESSED_RGB[A] textures! */ -static const struct gl_texture_format * +static gl_format choose_tex_format( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { switch (internalFormat) { case GL_COMPRESSED_RGB_ARB: - return &_mesa_texformat_rgb; + return MESA_FORMAT_RGB; case GL_COMPRESSED_RGBA_ARB: - return &_mesa_texformat_rgba; + return MESA_FORMAT_RGBA; default: return _mesa_choose_tex_format(ctx, internalFormat, format, type); } diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index ce5e158626..9131f20f52 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -184,8 +184,8 @@ struct dd_function_table { * functions. The driver should examine \p internalFormat and return a * pointer to an appropriate gl_texture_format. */ - const struct gl_texture_format *(*ChooseTextureFormat)( GLcontext *ctx, - GLint internalFormat, GLenum srcFormat, GLenum srcType ); + GLuint (*ChooseTextureFormat)( GLcontext *ctx, GLint internalFormat, + GLenum srcFormat, GLenum srcType ); /** * Called by glTexImage1D(). diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 8492c8561d..391180a7c6 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -315,7 +315,7 @@ dump_texture_cb(GLuint id, void *data, void *userData) if (texImg) { _mesa_printf(" Image %u: %d x %d x %d, format %u at %p\n", i, texImg->Width, texImg->Height, texImg->Depth, - texImg->TexFormat->MesaFormat, texImg->Data); + texImg->TexFormat, texImg->Data); if (DumpImages && !written) { GLuint face = 0; write_texture_image(texObj, face, i); diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 04419da6e5..6610725de8 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -384,7 +384,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, return; } - baseFormat = _mesa_get_format_base_format(texImage->TexFormat->MesaFormat); + baseFormat = _mesa_get_format_base_format(texImage->TexFormat); if (format == GL_COLOR) { if (baseFormat != GL_RGB && @@ -393,7 +393,7 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, att->Complete = GL_FALSE; return; } - if (_mesa_is_format_compressed(texImage->TexFormat->MesaFormat)) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { att_incomplete("compressed internalformat"); att->Complete = GL_FALSE; return; diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index c02c705228..7e99a5d3de 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1561,7 +1561,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, } else { /* uncompressed */ - convertFormat = srcImage->TexFormat->MesaFormat; + convertFormat = srcImage->TexFormat; } _mesa_format_to_type_and_comps(convertFormat, &datatype, &comps); @@ -1620,7 +1620,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, = ctx->Driver.CompressedTextureSize(ctx, dstImage->Width, dstImage->Height, dstImage->Depth, - dstImage->TexFormat->MesaFormat); + dstImage->TexFormat); ASSERT(dstImage->CompressedSize > 0); } @@ -1642,7 +1642,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, ASSERT(dstData); } else { - bytesPerTexel = _mesa_get_format_bytes(dstImage->TexFormat->MesaFormat); + bytesPerTexel = _mesa_get_format_bytes(dstImage->TexFormat); ASSERT(dstWidth * dstHeight * dstDepth * bytesPerTexel > 0); dstImage->Data = _mesa_alloc_texmemory(dstWidth * dstHeight * dstDepth * bytesPerTexel); @@ -1666,7 +1666,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, /* compress image from dstData into dstImage->Data */ const GLenum srcFormat = _mesa_get_format_base_format(convertFormat); GLint dstRowStride - = _mesa_compressed_row_stride(dstImage->TexFormat->MesaFormat, dstWidth); + = _mesa_compressed_row_stride(dstImage->TexFormat, dstWidth); ASSERT(srcFormat == GL_RGB || srcFormat == GL_RGBA); _mesa_texstore(ctx, 2, dstImage->_BaseFormat, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index d448e3e158..56d5e9fafd 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1200,7 +1200,7 @@ struct gl_texture_image GLboolean IsClientData; /**< Data owned by client? */ GLboolean _IsPowerOfTwo; /**< Are all dimensions powers of two? */ - const struct gl_texture_format *TexFormat; + GLuint TexFormat; /**< XXX Really gl_format */ struct gl_texture_object *TexObject; /**< Pointer back to parent object */ diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index c401f82be0..54e24fd297 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -74,7 +74,7 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS) const GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */ const GLchan *tempImage = NULL; - ASSERT(dstFormat == &_mesa_texformat_rgb_fxt1); + ASSERT(dstFormat == MESA_FORMAT_RGB_FXT1); ASSERT(dstXoffset % 8 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset == 0); @@ -88,7 +88,7 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS) /* convert image to RGB/GLchan */ tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + _mesa_get_format_base_format(dstFormat), srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -106,7 +106,7 @@ _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS) } dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat->MesaFormat, + dstFormat, texWidth, (GLubyte *) dstAddr); fxt1_encode(srcWidth, srcHeight, 3, pixels, srcRowStride, @@ -131,7 +131,7 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) GLint texWidth = dstRowStride * 8 / 16; /* a bit of a hack */ const GLchan *tempImage = NULL; - ASSERT(dstFormat == &_mesa_texformat_rgba_fxt1); + ASSERT(dstFormat == MESA_FORMAT_RGBA_FXT1); ASSERT(dstXoffset % 8 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset == 0); @@ -145,7 +145,7 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) /* convert image to RGBA/GLchan */ tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + _mesa_get_format_base_format(dstFormat), srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -163,7 +163,7 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) } dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat->MesaFormat, + dstFormat, texWidth, (GLubyte *) dstAddr); fxt1_encode(srcWidth, srcHeight, 4, pixels, srcRowStride, diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index 2294fdca73..69e43af0fd 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -165,7 +165,7 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS) const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */ const GLchan *tempImage = NULL; - ASSERT(dstFormat == &_mesa_texformat_rgb_dxt1); + ASSERT(dstFormat == MESA_FORMAT_RGB_DXT1); ASSERT(dstXoffset % 4 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); @@ -179,7 +179,7 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS) /* convert image to RGB/GLchan */ tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + _mesa_get_format_base_format(dstFormat), srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -197,7 +197,7 @@ _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS) } dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat->MesaFormat, + dstFormat, texWidth, (GLubyte *) dstAddr); if (ext_tx_compress_dxtn) { @@ -228,7 +228,7 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS) const GLint texWidth = dstRowStride * 4 / 8; /* a bit of a hack */ const GLchan *tempImage = NULL; - ASSERT(dstFormat == &_mesa_texformat_rgba_dxt1); + ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT1); ASSERT(dstXoffset % 4 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); @@ -242,7 +242,7 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS) /* convert image to RGBA/GLchan */ tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + _mesa_get_format_base_format(dstFormat), srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -260,7 +260,7 @@ _mesa_texstore_rgba_dxt1(TEXSTORE_PARAMS) } dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat->MesaFormat, + dstFormat, texWidth, (GLubyte *) dstAddr); if (ext_tx_compress_dxtn) { (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, @@ -290,7 +290,7 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS) const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */ const GLchan *tempImage = NULL; - ASSERT(dstFormat == &_mesa_texformat_rgba_dxt3); + ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT3); ASSERT(dstXoffset % 4 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); @@ -304,7 +304,7 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS) /* convert image to RGBA/GLchan */ tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + _mesa_get_format_base_format(dstFormat), srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -321,7 +321,7 @@ _mesa_texstore_rgba_dxt3(TEXSTORE_PARAMS) } dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat->MesaFormat, + dstFormat, texWidth, (GLubyte *) dstAddr); if (ext_tx_compress_dxtn) { (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, @@ -351,7 +351,7 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS) const GLint texWidth = dstRowStride * 4 / 16; /* a bit of a hack */ const GLchan *tempImage = NULL; - ASSERT(dstFormat == &_mesa_texformat_rgba_dxt5); + ASSERT(dstFormat == MESA_FORMAT_RGBA_DXT5); ASSERT(dstXoffset % 4 == 0); ASSERT(dstYoffset % 4 == 0); ASSERT(dstZoffset % 4 == 0); @@ -365,7 +365,7 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS) /* convert image to RGBA/GLchan */ tempImage = _mesa_make_temp_chan_image(ctx, dims, baseInternalFormat, - dstFormat->BaseFormat, + _mesa_get_format_base_format(dstFormat), srcWidth, srcHeight, srcDepth, srcFormat, srcType, srcAddr, srcPacking); @@ -382,7 +382,7 @@ _mesa_texstore_rgba_dxt5(TEXSTORE_PARAMS) } dst = _mesa_compressed_image_address(dstXoffset, dstYoffset, 0, - dstFormat->MesaFormat, + dstFormat, texWidth, (GLubyte *) dstAddr); if (ext_tx_compress_dxtn) { (*ext_tx_compress_dxtn)(4, srcWidth, srcHeight, pixels, diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 60b2065a6c..019193f134 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -130,7 +130,7 @@ static void store_null_texel(struct gl_texture_image *texImage, /***************************************************************/ /** \name Default GLchan-based formats */ /*@{*/ - +#if 0 const struct gl_texture_format _mesa_texformat_rgba = { MESA_FORMAT_RGBA, /* MesaFormat */ GL_RGBA, /* BaseFormat */ @@ -1016,6 +1016,7 @@ const struct gl_texture_format _mesa_null_texformat = { 0, /* StencilBits */ 0, /* TexelBytes */ }; +#endif /*@}*/ @@ -1035,7 +1036,7 @@ const struct gl_texture_format _mesa_null_texformat = { * This is called via dd_function_table::ChooseTextureFormat. Hardware drivers * will typically override this function with a specialized version. */ -const struct gl_texture_format * +gl_format _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ) { @@ -1049,15 +1050,15 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: - return &_mesa_texformat_rgba; + return MESA_FORMAT_RGBA; case GL_RGBA8: - return &_mesa_texformat_rgba8888; + return MESA_FORMAT_RGBA8888; case GL_RGB5_A1: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case GL_RGBA2: - return &_mesa_texformat_argb4444_rev; /* just to test another format*/ + return MESA_FORMAT_ARGB4444_REV; /* just to test another format*/ case GL_RGBA4: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; /* RGB formats */ case 3: @@ -1065,24 +1066,24 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_RGB10: case GL_RGB12: case GL_RGB16: - return &_mesa_texformat_rgb; + return MESA_FORMAT_RGB; case GL_RGB8: - return &_mesa_texformat_rgb888; + return MESA_FORMAT_RGB888; case GL_R3_G3_B2: - return &_mesa_texformat_rgb332; + return MESA_FORMAT_RGB332; case GL_RGB4: - return &_mesa_texformat_rgb565_rev; /* just to test another format */ + return MESA_FORMAT_RGB565_REV; /* just to test another format */ case GL_RGB5: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; /* Alpha formats */ case GL_ALPHA: case GL_ALPHA4: case GL_ALPHA12: case GL_ALPHA16: - return &_mesa_texformat_alpha; + return MESA_FORMAT_ALPHA; case GL_ALPHA8: - return &_mesa_texformat_a8; + return MESA_FORMAT_A8; /* Luminance formats */ case 1: @@ -1090,9 +1091,9 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE4: case GL_LUMINANCE12: case GL_LUMINANCE16: - return &_mesa_texformat_luminance; + return MESA_FORMAT_LUMINANCE; case GL_LUMINANCE8: - return &_mesa_texformat_l8; + return MESA_FORMAT_L8; /* Luminance/Alpha formats */ case 2: @@ -1102,17 +1103,17 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12_ALPHA4: case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: - return &_mesa_texformat_luminance_alpha; + return MESA_FORMAT_LUMINANCE_ALPHA; case GL_LUMINANCE8_ALPHA8: - return &_mesa_texformat_al88; + return MESA_FORMAT_AL88; case GL_INTENSITY: case GL_INTENSITY4: case GL_INTENSITY12: case GL_INTENSITY16: - return &_mesa_texformat_intensity; + return MESA_FORMAT_INTENSITY; case GL_INTENSITY8: - return &_mesa_texformat_i8; + return MESA_FORMAT_I8; case GL_COLOR_INDEX: case GL_COLOR_INDEX1_EXT: @@ -1121,7 +1122,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_COLOR_INDEX12_EXT: case GL_COLOR_INDEX16_EXT: case GL_COLOR_INDEX8_EXT: - return &_mesa_texformat_ci8; + return MESA_FORMAT_CI8; default: ; /* fallthrough */ @@ -1132,9 +1133,9 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT32: - return &_mesa_texformat_z32; + return MESA_FORMAT_Z32; case GL_DEPTH_COMPONENT16: - return &_mesa_texformat_z16; + return MESA_FORMAT_Z16; default: ; /* fallthrough */ } @@ -1142,35 +1143,35 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, switch (internalFormat) { case GL_COMPRESSED_ALPHA_ARB: - return &_mesa_texformat_alpha; + return MESA_FORMAT_ALPHA; case GL_COMPRESSED_LUMINANCE_ARB: - return &_mesa_texformat_luminance; + return MESA_FORMAT_LUMINANCE; case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: - return &_mesa_texformat_luminance_alpha; + return MESA_FORMAT_LUMINANCE_ALPHA; case GL_COMPRESSED_INTENSITY_ARB: - return &_mesa_texformat_intensity; + return MESA_FORMAT_INTENSITY; case GL_COMPRESSED_RGB_ARB: #if FEATURE_texture_fxt1 if (ctx->Extensions.TDFX_texture_compression_FXT1) - return &_mesa_texformat_rgb_fxt1; + return MESA_FORMAT_RGB_FXT1; #endif #if FEATURE_texture_s3tc if (ctx->Extensions.EXT_texture_compression_s3tc || ctx->Extensions.S3_s3tc) - return &_mesa_texformat_rgb_dxt1; + return MESA_FORMAT_RGB_DXT1; #endif - return &_mesa_texformat_rgb; + return MESA_FORMAT_RGB; case GL_COMPRESSED_RGBA_ARB: #if FEATURE_texture_fxt1 if (ctx->Extensions.TDFX_texture_compression_FXT1) - return &_mesa_texformat_rgba_fxt1; + return MESA_FORMAT_RGBA_FXT1; #endif #if FEATURE_texture_s3tc if (ctx->Extensions.EXT_texture_compression_s3tc || ctx->Extensions.S3_s3tc) - return &_mesa_texformat_rgba_dxt3; /* Not rgba_dxt1, see spec */ + return MESA_FORMAT_RGBA_DXT3; /* Not rgba_dxt1, see spec */ #endif - return &_mesa_texformat_rgba; + return MESA_FORMAT_RGBA; default: ; /* fallthrough */ } @@ -1178,9 +1179,9 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, if (ctx->Extensions.MESA_ycbcr_texture) { if (internalFormat == GL_YCBCR_MESA) { if (type == GL_UNSIGNED_SHORT_8_8_MESA) - return &_mesa_texformat_ycbcr; + return MESA_FORMAT_YCBCR; else - return &_mesa_texformat_ycbcr_rev; + return MESA_FORMAT_YCBCR_REV; } } @@ -1188,9 +1189,9 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, if (ctx->Extensions.TDFX_texture_compression_FXT1) { switch (internalFormat) { case GL_COMPRESSED_RGB_FXT1_3DFX: - return &_mesa_texformat_rgb_fxt1; + return MESA_FORMAT_RGB_FXT1; case GL_COMPRESSED_RGBA_FXT1_3DFX: - return &_mesa_texformat_rgba_fxt1; + return MESA_FORMAT_RGBA_FXT1; default: ; /* fallthrough */ } @@ -1201,13 +1202,13 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, if (ctx->Extensions.EXT_texture_compression_s3tc) { switch (internalFormat) { case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: - return &_mesa_texformat_rgb_dxt1; + return MESA_FORMAT_RGB_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - return &_mesa_texformat_rgba_dxt1; + return MESA_FORMAT_RGBA_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: - return &_mesa_texformat_rgba_dxt3; + return MESA_FORMAT_RGBA_DXT3; case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: - return &_mesa_texformat_rgba_dxt5; + return MESA_FORMAT_RGBA_DXT5; default: ; /* fallthrough */ } @@ -1217,10 +1218,10 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, switch (internalFormat) { case GL_RGB_S3TC: case GL_RGB4_S3TC: - return &_mesa_texformat_rgb_dxt1; + return MESA_FORMAT_RGB_DXT1; case GL_RGBA_S3TC: case GL_RGBA4_S3TC: - return &_mesa_texformat_rgba_dxt3; + return MESA_FORMAT_RGBA_DXT3; default: ; /* fallthrough */ } @@ -1230,29 +1231,29 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, if (ctx->Extensions.ARB_texture_float) { switch (internalFormat) { case GL_ALPHA16F_ARB: - return &_mesa_texformat_alpha_float16; + return MESA_FORMAT_ALPHA_FLOAT16; case GL_ALPHA32F_ARB: - return &_mesa_texformat_alpha_float32; + return MESA_FORMAT_ALPHA_FLOAT32; case GL_LUMINANCE16F_ARB: - return &_mesa_texformat_luminance_float16; + return MESA_FORMAT_LUMINANCE_FLOAT16; case GL_LUMINANCE32F_ARB: - return &_mesa_texformat_luminance_float32; + return MESA_FORMAT_LUMINANCE_FLOAT32; case GL_LUMINANCE_ALPHA16F_ARB: - return &_mesa_texformat_luminance_alpha_float16; + return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16; case GL_LUMINANCE_ALPHA32F_ARB: - return &_mesa_texformat_luminance_alpha_float32; + return MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32; case GL_INTENSITY16F_ARB: - return &_mesa_texformat_intensity_float16; + return MESA_FORMAT_INTENSITY_FLOAT16; case GL_INTENSITY32F_ARB: - return &_mesa_texformat_intensity_float32; + return MESA_FORMAT_INTENSITY_FLOAT32; case GL_RGB16F_ARB: - return &_mesa_texformat_rgb_float16; + return MESA_FORMAT_RGB_FLOAT16; case GL_RGB32F_ARB: - return &_mesa_texformat_rgb_float32; + return MESA_FORMAT_RGB_FLOAT32; case GL_RGBA16F_ARB: - return &_mesa_texformat_rgba_float16; + return MESA_FORMAT_RGBA_FLOAT16; case GL_RGBA32F_ARB: - return &_mesa_texformat_rgba_float32; + return MESA_FORMAT_RGBA_FLOAT32; default: ; /* fallthrough */ } @@ -1262,7 +1263,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, switch (internalFormat) { case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: - return &_mesa_texformat_z24_s8; + return MESA_FORMAT_Z24_S8; default: ; /* fallthrough */ } @@ -1272,7 +1273,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, switch (internalFormat) { case GL_DUDV_ATI: case GL_DU8DV8_ATI: - return &_mesa_texformat_dudv8; + return MESA_FORMAT_DUDV8; default: ; /* fallthrough */ } @@ -1282,7 +1283,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, switch (internalFormat) { case GL_RGBA_SNORM: case GL_RGBA8_SNORM: - return &_mesa_texformat_signed_rgba8888; + return MESA_FORMAT_SIGNED_RGBA8888; default: ; /* fallthrough */ } @@ -1294,48 +1295,48 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, switch (internalFormat) { case GL_SRGB_EXT: case GL_SRGB8_EXT: - return &_mesa_texformat_srgb8; + return MESA_FORMAT_SRGB8; case GL_SRGB_ALPHA_EXT: case GL_SRGB8_ALPHA8_EXT: - return &_mesa_texformat_srgba8; + return MESA_FORMAT_SRGBA8; case GL_SLUMINANCE_EXT: case GL_SLUMINANCE8_EXT: - return &_mesa_texformat_sl8; + return MESA_FORMAT_SL8; case GL_SLUMINANCE_ALPHA_EXT: case GL_SLUMINANCE8_ALPHA8_EXT: - return &_mesa_texformat_sla8; + return MESA_FORMAT_SLA8; case GL_COMPRESSED_SLUMINANCE_EXT: - return &_mesa_texformat_sl8; + return MESA_FORMAT_SL8; case GL_COMPRESSED_SLUMINANCE_ALPHA_EXT: - return &_mesa_texformat_sla8; + return MESA_FORMAT_SLA8; case GL_COMPRESSED_SRGB_EXT: #if FEATURE_texture_s3tc if (ctx->Extensions.EXT_texture_compression_s3tc) - return &_mesa_texformat_srgb_dxt1; + return MESA_FORMAT_SRGB_DXT1; #endif - return &_mesa_texformat_srgb8; + return MESA_FORMAT_SRGB8; case GL_COMPRESSED_SRGB_ALPHA_EXT: #if FEATURE_texture_s3tc if (ctx->Extensions.EXT_texture_compression_s3tc) - return &_mesa_texformat_srgba_dxt3; /* Not srgba_dxt1, see spec */ + return MESA_FORMAT_SRGBA_DXT3; /* Not srgba_dxt1, see spec */ #endif - return &_mesa_texformat_srgba8; + return MESA_FORMAT_SRGBA8; #if FEATURE_texture_s3tc case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: if (ctx->Extensions.EXT_texture_compression_s3tc) - return &_mesa_texformat_srgb_dxt1; + return MESA_FORMAT_SRGB_DXT1; break; case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: if (ctx->Extensions.EXT_texture_compression_s3tc) - return &_mesa_texformat_srgba_dxt1; + return MESA_FORMAT_SRGBA_DXT1; break; case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: if (ctx->Extensions.EXT_texture_compression_s3tc) - return &_mesa_texformat_srgba_dxt3; + return MESA_FORMAT_SRGBA_DXT3; break; case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: if (ctx->Extensions.EXT_texture_compression_s3tc) - return &_mesa_texformat_srgba_dxt5; + return MESA_FORMAT_SRGBA_DXT5; break; #endif default: @@ -1345,7 +1346,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, #endif /* FEATURE_EXT_texture_sRGB */ _mesa_problem(ctx, "unexpected format in _mesa_choose_tex_format()"); - return NULL; + return MESA_FORMAT_NONE; } diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index 638eadff97..9095726ac2 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -39,7 +39,7 @@ #include "mtypes.h" #include "formats.h" - +#if 0 /** GLchan-valued formats */ /*@{*/ extern const struct gl_texture_format _mesa_texformat_rgba; @@ -143,9 +143,9 @@ extern const struct gl_texture_format _mesa_texformat_rgba_dxt5; /*@{*/ extern const struct gl_texture_format _mesa_null_texformat; /*@}*/ +#endif - -extern const struct gl_texture_format * +extern gl_format _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ); diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index eb160deff9..cb8386bbc8 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -1424,7 +1424,7 @@ static void FETCH(f_z24_s8)( const struct gl_texture_image *texImage, const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); const GLfloat scale = 1.0F / (GLfloat) 0xffffff; texel[0] = ((*src) >> 8) * scale; - ASSERT(texImage->TexFormat->MesaFormat == MESA_FORMAT_Z24_S8); + ASSERT(texImage->TexFormat == MESA_FORMAT_Z24_S8); ASSERT(texel[0] >= 0.0F); ASSERT(texel[0] <= 1.0F); } @@ -1451,7 +1451,7 @@ static void FETCH(f_s8_z24)( const struct gl_texture_image *texImage, const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); const GLfloat scale = 1.0F / (GLfloat) 0xffffff; texel[0] = ((*src) & 0x00ffffff) * scale; - ASSERT(texImage->TexFormat->MesaFormat == MESA_FORMAT_S8_Z24); + ASSERT(texImage->TexFormat == MESA_FORMAT_S8_Z24); ASSERT(texel[0] >= 0.0F); ASSERT(texel[0] <= 1.0F); } diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 2575d0d868..e9e408d8c5 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -49,7 +49,7 @@ static GLboolean is_srgb_teximage(const struct gl_texture_image *texImage) { - switch (texImage->TexFormat->MesaFormat) { + switch (texImage->TexFormat) { case MESA_FORMAT_SRGB8: case MESA_FORMAT_SRGBA8: case MESA_FORMAT_SARGB8: @@ -160,7 +160,7 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, if (format == GL_COLOR_INDEX) { GLuint indexRow[MAX_WIDTH]; GLint col; - GLuint indexBits = _mesa_get_format_bits(texImage->TexFormat->MesaFormat, GL_TEXTURE_INDEX_SIZE_EXT); + GLuint indexBits = _mesa_get_format_bits(texImage->TexFormat, GL_TEXTURE_INDEX_SIZE_EXT); /* Can't use FetchTexel here because that returns RGBA */ if (indexBits == 8) { const GLubyte *src = (const GLubyte *) texImage->Data; @@ -210,9 +210,9 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, (const GLushort *) texImage->Data + row * rowstride, width * sizeof(GLushort)); /* check for byte swapping */ - if ((texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR + if ((texImage->TexFormat == MESA_FORMAT_YCBCR && type == GL_UNSIGNED_SHORT_8_8_REV_MESA) || - (texImage->TexFormat->MesaFormat == MESA_FORMAT_YCBCR_REV + (texImage->TexFormat == MESA_FORMAT_YCBCR_REV && type == GL_UNSIGNED_SHORT_8_8_MESA)) { if (!ctx->Pack.SwapBytes) _mesa_swap2((GLushort *) dest, width); @@ -259,7 +259,7 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, GLint col; GLbitfield transferOps = 0x0; GLenum dataType = - _mesa_get_format_datatype(texImage->TexFormat->MesaFormat); + _mesa_get_format_datatype(texImage->TexFormat); /* clamp does not apply to GetTexImage (final conversion)? * Looks like we need clamp though when going from format @@ -350,7 +350,7 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, /* 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); + texImage->TexFormat); /* just memcpy, no pixelstore or pixel transfer */ _mesa_memcpy(img, texImage->Data, size); @@ -439,7 +439,7 @@ getteximage_error_check(GLcontext *ctx, GLenum target, GLint level, return GL_TRUE; } - baseFormat = _mesa_get_format_base_format(texImage->TexFormat->MesaFormat); + baseFormat = _mesa_get_format_base_format(texImage->TexFormat); /* Make sure the requested image format is compatible with the * texture's format. Note that a color index texture can be converted diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 465da6b046..c4e5ce2682 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -900,7 +900,7 @@ clear_teximage_fields(struct gl_texture_image *img) img->HeightLog2 = 0; img->DepthLog2 = 0; img->Data = NULL; - img->TexFormat = &_mesa_null_texformat; + img->TexFormat = MESA_FORMAT_NONE; img->FetchTexelc = NULL; img->FetchTexelf = NULL; img->IsCompressed = 0; @@ -2232,8 +2232,8 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1, border, internalFormat); - texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, - internalFormat, format, type); + texImage->TexFormat = + ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type); } } else { @@ -2352,8 +2352,8 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, postConvHeight, 1, border, internalFormat); - texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, - internalFormat, format, type); + texImage->TexFormat = + ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type); } } else { @@ -2456,8 +2456,8 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, /* no error, set the tex image parameters */ _mesa_init_teximage_fields(ctx, target, texImage, width, height, depth, border, internalFormat); - texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, - internalFormat, format, type); + texImage->TexFormat = + ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type); } } else { diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index d38d5a4c23..a9df1dac15 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -765,7 +765,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, goto out; } - texFormat = img->TexFormat->MesaFormat; + texFormat = img->TexFormat; isProxy = _mesa_is_proxy_texture(target); diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c index 54e5668abc..81bb1d40ff 100644 --- a/src/mesa/main/texrender.c +++ b/src/mesa/main/texrender.c @@ -470,7 +470,7 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att) trb->TexImage = att->Texture->Image[att->CubeMapFace][att->TextureLevel]; ASSERT(trb->TexImage); - trb->Store = _mesa_get_texel_store_func(trb->TexImage->TexFormat->MesaFormat); + trb->Store = _mesa_get_texel_store_func(trb->TexImage->TexFormat); if (!trb->Store) { /* we'll never draw into some textures (compressed formats) */ trb->Store = store_nop; @@ -485,21 +485,21 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att) trb->Zoffset = att->Zoffset; } - texFormat = trb->TexImage->TexFormat->MesaFormat; + texFormat = trb->TexImage->TexFormat; trb->Base.Width = trb->TexImage->Width; trb->Base.Height = trb->TexImage->Height; trb->Base.InternalFormat = trb->TexImage->InternalFormat; /* XXX may need more special cases here */ - if (trb->TexImage->TexFormat->MesaFormat == MESA_FORMAT_Z24_S8) { + if (trb->TexImage->TexFormat == MESA_FORMAT_Z24_S8) { trb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; trb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT; } - else if (trb->TexImage->TexFormat->MesaFormat == MESA_FORMAT_Z16) { + else if (trb->TexImage->TexFormat == MESA_FORMAT_Z16) { trb->Base._ActualFormat = GL_DEPTH_COMPONENT; trb->Base.DataType = GL_UNSIGNED_SHORT; } - else if (trb->TexImage->TexFormat->MesaFormat == MESA_FORMAT_Z32) { + else if (trb->TexImage->TexFormat == MESA_FORMAT_Z32) { trb->Base._ActualFormat = GL_DEPTH_COMPONENT; trb->Base.DataType = GL_UNSIGNED_INT; } diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index ca298bb237..02e3df89cf 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -932,7 +932,7 @@ _mesa_swizzle_ubyte_image(GLcontext *ctx, static void memcpy_texture(GLcontext *ctx, GLuint dimensions, - const struct gl_texture_format *dstFormat, + gl_format dstFormat, GLvoid *dstAddr, GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, GLint dstRowStride, @@ -948,7 +948,7 @@ memcpy_texture(GLcontext *ctx, srcWidth, srcHeight, srcFormat, srcType); const GLubyte *srcImage = (const GLubyte *) _mesa_image_address(dimensions, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, 0, 0, 0); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); const GLint bytesPerRow = srcWidth * texelBytes; #if 0 @@ -1017,15 +1017,15 @@ static GLboolean _mesa_texstore_rgba(TEXSTORE_PARAMS) { const GLint components = _mesa_components_in_format(baseInternalFormat); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); - - ASSERT(dstFormat == &_mesa_texformat_rgba || - dstFormat == &_mesa_texformat_rgb || - dstFormat == &_mesa_texformat_alpha || - dstFormat == &_mesa_texformat_luminance || - dstFormat == &_mesa_texformat_luminance_alpha || - dstFormat == &_mesa_texformat_intensity); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + + ASSERT(dstFormat == MESA_FORMAT_RGBA || + dstFormat == MESA_FORMAT_RGB || + dstFormat == MESA_FORMAT_ALPHA || + dstFormat == MESA_FORMAT_LUMINANCE || + dstFormat == MESA_FORMAT_LUMINANCE_ALPHA || + dstFormat == MESA_FORMAT_INTENSITY); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_ALPHA || @@ -1048,7 +1048,7 @@ _mesa_texstore_rgba(TEXSTORE_PARAMS) } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_rgb && + dstFormat == MESA_FORMAT_RGB && srcFormat == GL_RGBA && srcType == CHAN_TYPE) { /* extract RGB from RGBA */ @@ -1089,27 +1089,27 @@ _mesa_texstore_rgba(TEXSTORE_PARAMS) /* dstmap - how to swizzle from RGBA to dst format: */ - if (dstFormat == &_mesa_texformat_rgba) { + if (dstFormat == MESA_FORMAT_RGBA) { dstmap = mappings[IDX_RGBA].from_rgba; components = 4; } - else if (dstFormat == &_mesa_texformat_rgb) { + else if (dstFormat == MESA_FORMAT_RGB) { dstmap = mappings[IDX_RGB].from_rgba; components = 3; } - else if (dstFormat == &_mesa_texformat_alpha) { + else if (dstFormat == MESA_FORMAT_ALPHA) { dstmap = mappings[IDX_ALPHA].from_rgba; components = 1; } - else if (dstFormat == &_mesa_texformat_luminance) { + else if (dstFormat == MESA_FORMAT_LUMINANCE) { dstmap = mappings[IDX_LUMINANCE].from_rgba; components = 1; } - else if (dstFormat == &_mesa_texformat_luminance_alpha) { + else if (dstFormat == MESA_FORMAT_LUMINANCE_ALPHA) { dstmap = mappings[IDX_LUMINANCE_ALPHA].from_rgba; components = 2; } - else if (dstFormat == &_mesa_texformat_intensity) { + else if (dstFormat == MESA_FORMAT_INTENSITY) { dstmap = mappings[IDX_INTENSITY].from_rgba; components = 1; } @@ -1168,9 +1168,9 @@ static GLboolean _mesa_texstore_z32(TEXSTORE_PARAMS) { const GLuint depthScale = 0xffffffff; - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); (void) dims; - ASSERT(dstFormat == &_mesa_texformat_z32); + ASSERT(dstFormat == MESA_FORMAT_Z32); ASSERT(texelBytes == sizeof(GLuint)); if (ctx->Pixel.DepthScale == 1.0f && @@ -1217,9 +1217,9 @@ static GLboolean _mesa_texstore_z16(TEXSTORE_PARAMS) { const GLuint depthScale = 0xffff; - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); (void) dims; - ASSERT(dstFormat == &_mesa_texformat_z16); + ASSERT(dstFormat == MESA_FORMAT_Z16); ASSERT(texelBytes == sizeof(GLushort)); if (ctx->Pixel.DepthScale == 1.0f && @@ -1265,16 +1265,16 @@ _mesa_texstore_z16(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgb565(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_rgb565 || - dstFormat == &_mesa_texformat_rgb565_rev); + ASSERT(dstFormat == MESA_FORMAT_RGB565 || + dstFormat == MESA_FORMAT_RGB565_REV); ASSERT(texelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_rgb565 && + dstFormat == MESA_FORMAT_RGB565 && baseInternalFormat == GL_RGB && srcFormat == GL_RGB && srcType == GL_UNSIGNED_SHORT_5_6_5) { @@ -1306,7 +1306,7 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) const GLubyte *srcUB = (const GLubyte *) src; GLushort *dstUS = (GLushort *) dst; /* check for byteswapped format */ - if (dstFormat == &_mesa_texformat_rgb565) { + if (dstFormat == MESA_FORMAT_RGB565) { for (col = 0; col < srcWidth; col++) { dstUS[col] = PACK_COLOR_565( srcUB[0], srcUB[1], srcUB[2] ); srcUB += 3; @@ -1343,7 +1343,7 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; /* check for byteswapped format */ - if (dstFormat == &_mesa_texformat_rgb565) { + if (dstFormat == MESA_FORMAT_RGB565) { for (col = 0; col < srcWidth; col++) { dstUS[col] = PACK_COLOR_565( CHAN_TO_UBYTE(src[RCOMP]), CHAN_TO_UBYTE(src[GCOMP]), @@ -1375,16 +1375,16 @@ static GLboolean _mesa_texstore_rgba8888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_rgba8888 || - dstFormat == &_mesa_texformat_rgba8888_rev); + ASSERT(dstFormat == MESA_FORMAT_RGBA8888 || + dstFormat == MESA_FORMAT_RGBA8888_REV); ASSERT(texelBytes == 4); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_rgba8888 && + dstFormat == MESA_FORMAT_RGBA8888 && baseInternalFormat == GL_RGBA && ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8) || (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE && !littleEndian) || @@ -1400,7 +1400,7 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_rgba8888_rev && + dstFormat == MESA_FORMAT_RGBA8888_REV && baseInternalFormat == GL_RGBA && ((srcFormat == GL_RGBA && srcType == GL_UNSIGNED_INT_8_8_8_8_REV) || (srcFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE && littleEndian) || @@ -1425,8 +1425,8 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) /* dstmap - how to swizzle from RGBA to dst format: */ - if ((littleEndian && dstFormat == &_mesa_texformat_rgba8888) || - (!littleEndian && dstFormat == &_mesa_texformat_rgba8888_rev)) { + if ((littleEndian && dstFormat == MESA_FORMAT_RGBA8888) || + (!littleEndian && dstFormat == MESA_FORMAT_RGBA8888_REV)) { dstmap[3] = 0; dstmap[2] = 1; dstmap[1] = 2; @@ -1469,7 +1469,7 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; - if (dstFormat == &_mesa_texformat_rgba8888) { + if (dstFormat == MESA_FORMAT_RGBA8888) { for (col = 0; col < srcWidth; col++) { dstUI[col] = PACK_COLOR_8888( CHAN_TO_UBYTE(src[RCOMP]), CHAN_TO_UBYTE(src[GCOMP]), @@ -1500,16 +1500,16 @@ static GLboolean _mesa_texstore_argb8888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_argb8888 || - dstFormat == &_mesa_texformat_argb8888_rev); + ASSERT(dstFormat == MESA_FORMAT_ARGB8888 || + dstFormat == MESA_FORMAT_ARGB8888_REV); ASSERT(texelBytes == 4); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_argb8888 && + dstFormat == MESA_FORMAT_ARGB8888 && baseInternalFormat == GL_RGBA && srcFormat == GL_BGRA && ((srcType == GL_UNSIGNED_BYTE && littleEndian) || @@ -1524,7 +1524,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_argb8888_rev && + dstFormat == MESA_FORMAT_ARGB8888_REV && baseInternalFormat == GL_RGBA && srcFormat == GL_BGRA && ((srcType == GL_UNSIGNED_BYTE && !littleEndian) || @@ -1539,7 +1539,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_argb8888 && + dstFormat == MESA_FORMAT_ARGB8888 && srcFormat == GL_RGB && (baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB) && @@ -1569,7 +1569,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_argb8888 && + dstFormat == MESA_FORMAT_ARGB8888 && srcFormat == GL_RGBA && baseInternalFormat == GL_RGBA && srcType == GL_UNSIGNED_BYTE) { @@ -1614,16 +1614,16 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) /* dstmap - how to swizzle from RGBA to dst format: */ - if ((littleEndian && dstFormat == &_mesa_texformat_argb8888) || - (!littleEndian && dstFormat == &_mesa_texformat_argb8888_rev)) { + if ((littleEndian && dstFormat == MESA_FORMAT_ARGB8888) || + (!littleEndian && dstFormat == MESA_FORMAT_ARGB8888_REV)) { dstmap[3] = 3; /* alpha */ dstmap[2] = 0; /* red */ dstmap[1] = 1; /* green */ dstmap[0] = 2; /* blue */ } else { - assert((littleEndian && dstFormat == &_mesa_texformat_argb8888_rev) || - (!littleEndian && dstFormat == &_mesa_texformat_argb8888)); + assert((littleEndian && dstFormat == MESA_FORMAT_ARGB8888_REV) || + (!littleEndian && dstFormat == MESA_FORMAT_ARGB8888)); dstmap[3] = 2; dstmap[2] = 1; dstmap[1] = 0; @@ -1662,7 +1662,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; - if (dstFormat == &_mesa_texformat_argb8888) { + if (dstFormat == MESA_FORMAT_ARGB8888) { for (col = 0; col < srcWidth; col++) { dstUI[col] = PACK_COLOR_8888( CHAN_TO_UBYTE(src[ACOMP]), CHAN_TO_UBYTE(src[RCOMP]), @@ -1693,10 +1693,10 @@ static GLboolean _mesa_texstore_rgb888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_rgb888); + ASSERT(dstFormat == MESA_FORMAT_RGB888); ASSERT(texelBytes == 3); if (!ctx->_ImageTransferState && @@ -1820,10 +1820,10 @@ static GLboolean _mesa_texstore_bgr888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_bgr888); + ASSERT(dstFormat == MESA_FORMAT_BGR888); ASSERT(texelBytes == 3); if (!ctx->_ImageTransferState && @@ -1926,15 +1926,15 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba4444(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_rgba4444); + ASSERT(dstFormat == MESA_FORMAT_RGBA4444); ASSERT(texelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_rgba4444 && + dstFormat == MESA_FORMAT_RGBA4444 && baseInternalFormat == GL_RGBA && srcFormat == GL_RGBA && srcType == GL_UNSIGNED_SHORT_4_4_4_4){ @@ -1984,16 +1984,16 @@ _mesa_texstore_rgba4444(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_argb4444(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_argb4444 || - dstFormat == &_mesa_texformat_argb4444_rev); + ASSERT(dstFormat == MESA_FORMAT_ARGB4444 || + dstFormat == MESA_FORMAT_ARGB4444_REV); ASSERT(texelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_argb4444 && + dstFormat == MESA_FORMAT_ARGB4444 && baseInternalFormat == GL_RGBA && srcFormat == GL_BGRA && srcType == GL_UNSIGNED_SHORT_4_4_4_4_REV) { @@ -2025,7 +2025,7 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS) + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; - if (dstFormat == &_mesa_texformat_argb4444) { + if (dstFormat == MESA_FORMAT_ARGB4444) { for (col = 0; col < srcWidth; col++) { dstUS[col] = PACK_COLOR_4444( CHAN_TO_UBYTE(src[ACOMP]), CHAN_TO_UBYTE(src[RCOMP]), @@ -2054,15 +2054,15 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba5551(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_rgba5551); + ASSERT(dstFormat == MESA_FORMAT_RGBA5551); ASSERT(texelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_rgba5551 && + dstFormat == MESA_FORMAT_RGBA5551 && baseInternalFormat == GL_RGBA && srcFormat == GL_RGBA && srcType == GL_UNSIGNED_SHORT_5_5_5_1) { @@ -2112,16 +2112,16 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_argb1555(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_argb1555 || - dstFormat == &_mesa_texformat_argb1555_rev); + ASSERT(dstFormat == MESA_FORMAT_ARGB1555 || + dstFormat == MESA_FORMAT_ARGB1555_REV); ASSERT(texelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_argb1555 && + dstFormat == MESA_FORMAT_ARGB1555 && baseInternalFormat == GL_RGBA && srcFormat == GL_BGRA && srcType == GL_UNSIGNED_SHORT_1_5_5_5_REV) { @@ -2153,7 +2153,7 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS) + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; - if (dstFormat == &_mesa_texformat_argb1555) { + if (dstFormat == MESA_FORMAT_ARGB1555) { for (col = 0; col < srcWidth; col++) { dstUS[col] = PACK_COLOR_1555( CHAN_TO_UBYTE(src[ACOMP]), CHAN_TO_UBYTE(src[RCOMP]), @@ -2184,16 +2184,16 @@ static GLboolean _mesa_texstore_al88(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_al88 || - dstFormat == &_mesa_texformat_al88_rev); + ASSERT(dstFormat == MESA_FORMAT_AL88 || + dstFormat == MESA_FORMAT_AL88_REV); ASSERT(texelBytes == 2); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_al88 && + dstFormat == MESA_FORMAT_AL88 && baseInternalFormat == GL_LUMINANCE_ALPHA && srcFormat == GL_LUMINANCE_ALPHA && srcType == GL_UNSIGNED_BYTE && @@ -2216,8 +2216,8 @@ _mesa_texstore_al88(TEXSTORE_PARAMS) /* dstmap - how to swizzle from RGBA to dst format: */ - if ((littleEndian && dstFormat == &_mesa_texformat_al88) || - (!littleEndian && dstFormat == &_mesa_texformat_al88_rev)) { + if ((littleEndian && dstFormat == MESA_FORMAT_AL88) || + (!littleEndian && dstFormat == MESA_FORMAT_AL88_REV)) { dstmap[0] = 0; dstmap[1] = 3; } @@ -2258,7 +2258,7 @@ _mesa_texstore_al88(TEXSTORE_PARAMS) + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLushort *dstUS = (GLushort *) dstRow; - if (dstFormat == &_mesa_texformat_al88) { + if (dstFormat == MESA_FORMAT_AL88) { for (col = 0; col < srcWidth; col++) { /* src[0] is luminance, src[1] is alpha */ dstUS[col] = PACK_COLOR_88( CHAN_TO_UBYTE(src[1]), @@ -2286,10 +2286,10 @@ _mesa_texstore_al88(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgb332(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_rgb332); + ASSERT(dstFormat == MESA_FORMAT_RGB332); ASSERT(texelBytes == 1); if (!ctx->_ImageTransferState && @@ -2344,12 +2344,12 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_a8(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_a8 || - dstFormat == &_mesa_texformat_l8 || - dstFormat == &_mesa_texformat_i8); + ASSERT(dstFormat == MESA_FORMAT_A8 || + dstFormat == MESA_FORMAT_L8 || + dstFormat == MESA_FORMAT_I8); ASSERT(texelBytes == 1); if (!ctx->_ImageTransferState && @@ -2373,7 +2373,7 @@ _mesa_texstore_a8(TEXSTORE_PARAMS) /* dstmap - how to swizzle from RGBA to dst format: */ - if (dstFormat == &_mesa_texformat_a8) { + if (dstFormat == MESA_FORMAT_A8) { dstmap[0] = 3; } else { @@ -2429,10 +2429,10 @@ _mesa_texstore_a8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_ci8(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); (void) dims; (void) baseInternalFormat; - ASSERT(dstFormat == &_mesa_texformat_ci8); + ASSERT(dstFormat == MESA_FORMAT_CI8); ASSERT(texelBytes == 1); ASSERT(baseInternalFormat == GL_COLOR_INDEX); @@ -2471,18 +2471,18 @@ _mesa_texstore_ci8(TEXSTORE_PARAMS) /** - * Texstore for _mesa_texformat_ycbcr or _mesa_texformat_ycbcr_rev. + * Texstore for _mesa_texformat_ycbcr or _mesa_texformat_ycbcr_REV. */ static GLboolean _mesa_texstore_ycbcr(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); (void) ctx; (void) dims; (void) baseInternalFormat; - ASSERT((dstFormat == &_mesa_texformat_ycbcr) || - (dstFormat == &_mesa_texformat_ycbcr_rev)); + ASSERT((dstFormat == MESA_FORMAT_YCBCR) || + (dstFormat == MESA_FORMAT_YCBCR_REV)); ASSERT(texelBytes == 2); ASSERT(ctx->Extensions.MESA_ycbcr_texture); ASSERT(srcFormat == GL_YCBCR_MESA); @@ -2502,7 +2502,7 @@ _mesa_texstore_ycbcr(TEXSTORE_PARAMS) /* XXX the logic here _might_ be wrong */ if (srcPacking->SwapBytes ^ (srcType == GL_UNSIGNED_SHORT_8_8_REV_MESA) ^ - (dstFormat == &_mesa_texformat_ycbcr_rev) ^ + (dstFormat == MESA_FORMAT_YCBCR_REV) ^ !littleEndian) { GLint img, row; for (img = 0; img < srcDepth; img++) { @@ -2523,9 +2523,9 @@ static GLboolean _mesa_texstore_dudv8(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_dudv8); + ASSERT(dstFormat == MESA_FORMAT_DUDV8); ASSERT(texelBytes == 2); ASSERT(ctx->Extensions.ATI_envmap_bumpmap); ASSERT((srcFormat == GL_DU8DV8_ATI) || @@ -2617,16 +2617,16 @@ static GLboolean _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == &_mesa_texformat_signed_rgba8888 || - dstFormat == &_mesa_texformat_signed_rgba8888_rev); + ASSERT(dstFormat == MESA_FORMAT_SIGNED_RGBA8888 || + dstFormat == MESA_FORMAT_SIGNED_RGBA8888_REV); ASSERT(texelBytes == 4); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_signed_rgba8888 && + dstFormat == MESA_FORMAT_SIGNED_RGBA8888 && baseInternalFormat == GL_RGBA && ((srcFormat == GL_RGBA && srcType == GL_BYTE && !littleEndian) || (srcFormat == GL_ABGR_EXT && srcType == GL_BYTE && littleEndian))) { @@ -2640,7 +2640,7 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == &_mesa_texformat_signed_rgba8888_rev && + dstFormat == MESA_FORMAT_SIGNED_RGBA8888_REV && baseInternalFormat == GL_RGBA && ((srcFormat == GL_RGBA && srcType == GL_BYTE && littleEndian) || (srcFormat == GL_ABGR_EXT && srcType == GL_BYTE && !littleEndian))) { @@ -2661,8 +2661,8 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) /* dstmap - how to swizzle from RGBA to dst format: */ - if ((littleEndian && dstFormat == &_mesa_texformat_signed_rgba8888) || - (!littleEndian && dstFormat == &_mesa_texformat_signed_rgba8888_rev)) { + if ((littleEndian && dstFormat == MESA_FORMAT_SIGNED_RGBA8888) || + (!littleEndian && dstFormat == MESA_FORMAT_SIGNED_RGBA8888_REV)) { dstmap[3] = 0; dstmap[2] = 1; dstmap[1] = 2; @@ -2705,7 +2705,7 @@ _mesa_texstore_signed_rgba8888(TEXSTORE_PARAMS) + dstXoffset * texelBytes; for (row = 0; row < srcHeight; row++) { GLuint *dstUI = (GLuint *) dstRow; - if (dstFormat == &_mesa_texformat_signed_rgba8888) { + if (dstFormat == MESA_FORMAT_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]), @@ -2743,7 +2743,7 @@ _mesa_texstore_z24_s8(TEXSTORE_PARAMS) / sizeof(GLuint); GLint img, row; - ASSERT(dstFormat == &_mesa_texformat_z24_s8); + ASSERT(dstFormat == MESA_FORMAT_Z24_S8); ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT); ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT); @@ -2844,7 +2844,7 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS) / sizeof(GLuint); GLint img, row; - ASSERT(dstFormat == &_mesa_texformat_s8_z24); + ASSERT(dstFormat == MESA_FORMAT_S8_Z24); ASSERT(srcFormat == GL_DEPTH_STENCIL_EXT || srcFormat == GL_DEPTH_COMPONENT); ASSERT(srcFormat != GL_DEPTH_STENCIL_EXT || srcType == GL_UNSIGNED_INT_24_8_EXT); @@ -2927,16 +2927,16 @@ _mesa_texstore_s8_z24(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); const GLint components = _mesa_components_in_format(baseFormat); - ASSERT(dstFormat == &_mesa_texformat_rgba_float32 || - dstFormat == &_mesa_texformat_rgb_float32 || - dstFormat == &_mesa_texformat_alpha_float32 || - dstFormat == &_mesa_texformat_luminance_float32 || - dstFormat == &_mesa_texformat_luminance_alpha_float32 || - dstFormat == &_mesa_texformat_intensity_float32); + ASSERT(dstFormat == MESA_FORMAT_RGBA_FLOAT32 || + dstFormat == MESA_FORMAT_RGB_FLOAT32 || + dstFormat == MESA_FORMAT_ALPHA_FLOAT32 || + dstFormat == MESA_FORMAT_LUMINANCE_FLOAT32 || + dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32 || + dstFormat == MESA_FORMAT_INTENSITY_FLOAT32); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_ALPHA || @@ -2996,16 +2996,16 @@ _mesa_texstore_rgba_float32(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) { - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat->MesaFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat->MesaFormat); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); const GLint components = _mesa_components_in_format(baseFormat); - ASSERT(dstFormat == &_mesa_texformat_rgba_float16 || - dstFormat == &_mesa_texformat_rgb_float16 || - dstFormat == &_mesa_texformat_alpha_float16 || - dstFormat == &_mesa_texformat_luminance_float16 || - dstFormat == &_mesa_texformat_luminance_alpha_float16 || - dstFormat == &_mesa_texformat_intensity_float16); + ASSERT(dstFormat == MESA_FORMAT_RGBA_FLOAT16 || + dstFormat == MESA_FORMAT_RGB_FLOAT16 || + dstFormat == MESA_FORMAT_ALPHA_FLOAT16 || + dstFormat == MESA_FORMAT_LUMINANCE_FLOAT16 || + dstFormat == MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16 || + dstFormat == MESA_FORMAT_INTENSITY_FLOAT16); ASSERT(baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB || baseInternalFormat == GL_ALPHA || @@ -3065,13 +3065,13 @@ _mesa_texstore_rgba_float16(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_srgb8(TEXSTORE_PARAMS) { - const struct gl_texture_format *newDstFormat; + gl_format newDstFormat; GLboolean k; - ASSERT(dstFormat == &_mesa_texformat_srgb8); + ASSERT(dstFormat == MESA_FORMAT_SRGB8); /* reuse normal rgb texstore code */ - newDstFormat = &_mesa_texformat_rgb888; + newDstFormat = MESA_FORMAT_RGB888; k = _mesa_texstore_rgb888(ctx, dims, baseInternalFormat, newDstFormat, dstAddr, @@ -3087,13 +3087,13 @@ _mesa_texstore_srgb8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_srgba8(TEXSTORE_PARAMS) { - const struct gl_texture_format *newDstFormat; + gl_format newDstFormat; GLboolean k; - ASSERT(dstFormat == &_mesa_texformat_srgba8); + ASSERT(dstFormat == MESA_FORMAT_SRGBA8); /* reuse normal rgba texstore code */ - newDstFormat = &_mesa_texformat_rgba8888; + newDstFormat = MESA_FORMAT_RGBA8888; k = _mesa_texstore_rgba8888(ctx, dims, baseInternalFormat, newDstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, @@ -3108,13 +3108,13 @@ _mesa_texstore_srgba8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_sargb8(TEXSTORE_PARAMS) { - const struct gl_texture_format *newDstFormat; + gl_format newDstFormat; GLboolean k; - ASSERT(dstFormat == &_mesa_texformat_sargb8); + ASSERT(dstFormat == MESA_FORMAT_SARGB8); /* reuse normal rgba texstore code */ - newDstFormat = &_mesa_texformat_argb8888; + newDstFormat = MESA_FORMAT_ARGB8888; k = _mesa_texstore_argb8888(ctx, dims, baseInternalFormat, newDstFormat, dstAddr, @@ -3130,12 +3130,12 @@ _mesa_texstore_sargb8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_sl8(TEXSTORE_PARAMS) { - const struct gl_texture_format *newDstFormat; + gl_format newDstFormat; GLboolean k; - ASSERT(dstFormat == &_mesa_texformat_sl8); + ASSERT(dstFormat == MESA_FORMAT_SL8); - newDstFormat = &_mesa_texformat_l8; + newDstFormat = MESA_FORMAT_L8; /* _mesa_textore_a8 handles luminance8 too */ k = _mesa_texstore_a8(ctx, dims, baseInternalFormat, @@ -3152,13 +3152,13 @@ _mesa_texstore_sl8(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_sla8(TEXSTORE_PARAMS) { - const struct gl_texture_format *newDstFormat; + gl_format newDstFormat; GLboolean k; - ASSERT(dstFormat == &_mesa_texformat_sla8); + ASSERT(dstFormat == MESA_FORMAT_SLA8); /* reuse normal luminance/alpha texstore code */ - newDstFormat = &_mesa_texformat_al88; + newDstFormat = MESA_FORMAT_AL88; k = _mesa_texstore_al88(ctx, dims, baseInternalFormat, newDstFormat, dstAddr, @@ -3280,7 +3280,7 @@ _mesa_texstore(TEXSTORE_PARAMS) StoreTexImageFunc storeImage; GLboolean success; - storeImage = _mesa_get_texstore_func(dstFormat->MesaFormat); + storeImage = _mesa_get_texstore_func(dstFormat); assert(storeImage); @@ -3390,7 +3390,7 @@ fetch_texel_float_to_chan(const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLchan *texelOut) { GLfloat temp[4]; - GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat->MesaFormat); + GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat); ASSERT(texImage->FetchTexelf); texImage->FetchTexelf(texImage, i, j, k, temp); @@ -3417,7 +3417,7 @@ fetch_texel_chan_to_float(const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texelOut) { GLchan temp[4]; - GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat->MesaFormat); + GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat); ASSERT(texImage->FetchTexelc); texImage->FetchTexelc(texImage, i, j, k, temp); @@ -3446,7 +3446,7 @@ _mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims) ASSERT(texImage->TexFormat); texImage->FetchTexelf = - _mesa_get_texel_fetch_func(texImage->TexFormat->MesaFormat, dims); + _mesa_get_texel_fetch_func(texImage->TexFormat, dims); /* now check if we need to use a float/chan adaptor */ if (!texImage->FetchTexelc) { @@ -3466,13 +3466,13 @@ static void compute_texture_size(GLcontext *ctx, struct gl_texture_image *texImage) { texImage->IsCompressed = - _mesa_is_format_compressed(texImage->TexFormat->MesaFormat); + _mesa_is_format_compressed(texImage->TexFormat); if (texImage->IsCompressed) { texImage->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, texImage->Width, texImage->Height, texImage->Depth, - texImage->TexFormat->MesaFormat); + texImage->TexFormat); } else { /* non-compressed format */ @@ -3513,7 +3513,7 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, if (texImage->IsCompressed) sizeInBytes = texImage->CompressedSize; else - sizeInBytes = texImage->Width * _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + sizeInBytes = texImage->Width * _mesa_get_format_bytes(texImage->TexFormat); texImage->Data = _mesa_alloc_texmemory(sizeInBytes); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); @@ -3578,7 +3578,7 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, _mesa_set_fetch_functions(texImage, 2); compute_texture_size(ctx, texImage); - texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* allocate memory */ if (texImage->IsCompressed) @@ -3605,7 +3605,7 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, if (texImage->IsCompressed) { dstRowStride - = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); + = _mesa_compressed_row_stride(texImage->TexFormat, width); } else { dstRowStride = texImage->RowStride * texelBytes; @@ -3654,7 +3654,7 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, _mesa_set_fetch_functions(texImage, 3); compute_texture_size(ctx, texImage); - texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* allocate memory */ if (texImage->IsCompressed) @@ -3681,7 +3681,7 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, if (texImage->IsCompressed) { dstRowStride - = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); + = _mesa_compressed_row_stride(texImage->TexFormat, width); } else { dstRowStride = texImage->RowStride * texelBytes; @@ -3770,12 +3770,12 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, GLboolean success; if (texImage->IsCompressed) { - dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, + dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, texImage->Width); } else { dstRowStride = texImage->RowStride * - _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + _mesa_get_format_bytes(texImage->TexFormat); } success = _mesa_texstore(ctx, 2, texImage->_BaseFormat, @@ -3820,12 +3820,12 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, GLboolean success; if (texImage->IsCompressed) { - dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, + dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, texImage->Width); } else { dstRowStride = texImage->RowStride * - _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + _mesa_get_format_bytes(texImage->TexFormat); } success = _mesa_texstore(ctx, 3, texImage->_BaseFormat, @@ -3985,7 +3985,7 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, GLint i, rows; GLubyte *dest; const GLubyte *src; - const gl_format texFormat = texImage->TexFormat->MesaFormat; + const gl_format texFormat = texImage->TexFormat; (void) format; diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h index 4a217df103..2db076dfff 100644 --- a/src/mesa/main/texstore.h +++ b/src/mesa/main/texstore.h @@ -58,7 +58,7 @@ #define TEXSTORE_PARAMS \ GLcontext *ctx, GLuint dims, \ GLenum baseInternalFormat, \ - const struct gl_texture_format *dstFormat, \ + gl_format dstFormat, \ GLvoid *dstAddr, \ GLint dstXoffset, GLint dstYoffset, GLint dstZoffset, \ GLint dstRowStride, const GLuint *dstImageOffsets, \ diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 6da57e817b..081c09c1fb 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -338,7 +338,7 @@ make_texture(struct st_context *st, GLcontext *ctx = st->ctx; struct pipe_context *pipe = st->pipe; struct pipe_screen *screen = pipe->screen; - const struct gl_texture_format *mformat; + gl_format mformat; struct pipe_texture *pt; enum pipe_format pipeFormat; GLuint cpp; @@ -350,7 +350,7 @@ make_texture(struct st_context *st, mformat = st_ChooseTextureFormat(ctx, baseFormat, format, type); assert(mformat); - pipeFormat = st_mesa_format_to_pipe_format(mformat->MesaFormat); + pipeFormat = st_mesa_format_to_pipe_format(mformat); assert(pipeFormat); cpp = st_sizeof_format(pipeFormat); diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index d96484c439..716fbc8b29 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -95,9 +95,9 @@ gl_target_to_pipe(GLenum target) * format. */ static GLuint -compressed_num_bytes(GLuint mesaFormat) +compressed_num_bytes(gl_format format) { - switch(mesaFormat) { + switch (format) { #if FEATURE_texture_fxt1 case MESA_FORMAT_RGB_FXT1: case MESA_FORMAT_RGBA_FXT1: @@ -117,9 +117,9 @@ compressed_num_bytes(GLuint mesaFormat) static GLboolean -is_compressed_mesa_format(const struct gl_texture_format *format) +is_compressed_mesa_format(gl_format format) { - switch (format->MesaFormat) { + switch (format) { case MESA_FORMAT_RGB_DXT1: case MESA_FORMAT_RGBA_DXT1: case MESA_FORMAT_RGBA_DXT3: @@ -338,7 +338,7 @@ guess_and_alloc_texture(struct st_context *st, lastLevel = firstLevel + MAX2(MAX2(l2width, l2height), l2depth); } - fmt = st_mesa_format_to_pipe_format(stImage->base.TexFormat->MesaFormat); + fmt = st_mesa_format_to_pipe_format(stImage->base.TexFormat); usage = default_usage(fmt); @@ -411,7 +411,7 @@ compress_with_blit(GLcontext * ctx, const GLuint dstImageOffsets[1] = {0}; struct st_texture_image *stImage = st_texture_image(texImage); struct pipe_screen *screen = ctx->st->pipe->screen; - const struct gl_texture_format *mesa_format; + gl_format mesa_format; struct pipe_texture templ; struct pipe_texture *src_tex; struct pipe_surface *dst_surface; @@ -443,7 +443,7 @@ compress_with_blit(GLcontext * ctx, */ memset(&templ, 0, sizeof(templ)); templ.target = PIPE_TEXTURE_2D; - templ.format = st_mesa_format_to_pipe_format(mesa_format->MesaFormat); + templ.format = st_mesa_format_to_pipe_format(mesa_format); pf_get_block(templ.format, &templ.block); templ.width[0] = width; templ.height[0] = height; @@ -559,17 +559,17 @@ st_TexImage(GLcontext * ctx, _mesa_set_fetch_functions(texImage, dims); - if (_mesa_is_format_compressed(texImage->TexFormat->MesaFormat)) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { /* must be a compressed format */ texelBytes = 0; texImage->IsCompressed = GL_TRUE; texImage->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, texImage->Width, texImage->Height, texImage->Depth, - texImage->TexFormat->MesaFormat); + texImage->TexFormat); } else { - texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); + texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* Minimum pitch of 32 bytes */ if (postConvWidth * texelBytes < 32) { @@ -699,7 +699,7 @@ st_TexImage(GLcontext * ctx, if (texImage->IsCompressed) { sizeInBytes = texImage->CompressedSize; dstRowStride = - _mesa_compressed_row_stride(texImage->TexFormat->MesaFormat, width); + _mesa_compressed_row_stride(texImage->TexFormat, width); assert(dims != 3); } else { @@ -1824,10 +1824,10 @@ st_finalize_texture(GLcontext *ctx, /* FIXME: determine format block instead of cpp */ if (firstImage->base.IsCompressed) { - cpp = compressed_num_bytes(firstImage->base.TexFormat->MesaFormat); + cpp = compressed_num_bytes(firstImage->base.TexFormat); } else { - cpp = _mesa_get_format_bytes(firstImage->base.TexFormat->MesaFormat); + cpp = _mesa_get_format_bytes(firstImage->base.TexFormat); } /* If we already have a gallium texture, check that it matches the texture @@ -1835,7 +1835,7 @@ st_finalize_texture(GLcontext *ctx, */ if (stObj->pt) { const enum pipe_format fmt = - st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat); + st_mesa_format_to_pipe_format(firstImage->base.TexFormat); if (stObj->pt->target != gl_target_to_pipe(stObj->base.Target) || stObj->pt->format != fmt || stObj->pt->last_level < stObj->lastLevel || @@ -1854,7 +1854,7 @@ st_finalize_texture(GLcontext *ctx, */ if (!stObj->pt) { const enum pipe_format fmt = - st_mesa_format_to_pipe_format(firstImage->base.TexFormat->MesaFormat); + st_mesa_format_to_pipe_format(firstImage->base.TexFormat); GLuint usage = default_usage(fmt); stObj->pt = st_texture_create(ctx->st, diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index dcb90a3107..6f76e2d8c0 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -629,74 +629,74 @@ st_choose_renderbuffer_format(struct pipe_context *pipe, GLenum internalFormat) } -static const struct gl_texture_format * +static gl_format translate_gallium_format_to_mesa_format(enum pipe_format format) { switch (format) { case PIPE_FORMAT_A8R8G8B8_UNORM: - return &_mesa_texformat_argb8888; + return MESA_FORMAT_ARGB8888; case PIPE_FORMAT_A1R5G5B5_UNORM: - return &_mesa_texformat_argb1555; + return MESA_FORMAT_ARGB1555; case PIPE_FORMAT_A4R4G4B4_UNORM: - return &_mesa_texformat_argb4444; + return MESA_FORMAT_ARGB4444; case PIPE_FORMAT_R5G6B5_UNORM: - return &_mesa_texformat_rgb565; + return MESA_FORMAT_RGB565; case PIPE_FORMAT_A8L8_UNORM: - return &_mesa_texformat_al88; + return MESA_FORMAT_AL88; case PIPE_FORMAT_A8_UNORM: - return &_mesa_texformat_a8; + return MESA_FORMAT_A8; case PIPE_FORMAT_L8_UNORM: - return &_mesa_texformat_l8; + return MESA_FORMAT_L8; case PIPE_FORMAT_I8_UNORM: - return &_mesa_texformat_i8; + return MESA_FORMAT_I8; case PIPE_FORMAT_Z16_UNORM: - return &_mesa_texformat_z16; + return MESA_FORMAT_Z16; case PIPE_FORMAT_Z32_UNORM: - return &_mesa_texformat_z32; + return MESA_FORMAT_Z32; case PIPE_FORMAT_Z24S8_UNORM: - return &_mesa_texformat_z24_s8; + return MESA_FORMAT_Z24_S8; case PIPE_FORMAT_S8Z24_UNORM: - return &_mesa_texformat_s8_z24; + return MESA_FORMAT_S8_Z24; case PIPE_FORMAT_YCBCR: - return &_mesa_texformat_ycbcr; + return MESA_FORMAT_YCBCR; case PIPE_FORMAT_YCBCR_REV: - return &_mesa_texformat_ycbcr_rev; + return MESA_FORMAT_YCBCR_REV; #if FEATURE_texture_s3tc case PIPE_FORMAT_DXT1_RGB: - return &_mesa_texformat_rgb_dxt1; + return MESA_FORMAT_RGB_DXT1; case PIPE_FORMAT_DXT1_RGBA: - return &_mesa_texformat_rgba_dxt1; + return MESA_FORMAT_RGBA_DXT1; case PIPE_FORMAT_DXT3_RGBA: - return &_mesa_texformat_rgba_dxt3; + return MESA_FORMAT_RGBA_DXT3; case PIPE_FORMAT_DXT5_RGBA: - return &_mesa_texformat_rgba_dxt5; + return MESA_FORMAT_RGBA_DXT5; #if FEATURE_EXT_texture_sRGB case PIPE_FORMAT_DXT1_SRGB: - return &_mesa_texformat_srgb_dxt1; + return MESA_FORMAT_SRGB_DXT1; case PIPE_FORMAT_DXT1_SRGBA: - return &_mesa_texformat_srgba_dxt1; + return MESA_FORMAT_SRGBA_DXT1; case PIPE_FORMAT_DXT3_SRGBA: - return &_mesa_texformat_srgba_dxt3; + return MESA_FORMAT_SRGBA_DXT3; case PIPE_FORMAT_DXT5_SRGBA: - return &_mesa_texformat_srgba_dxt5; + return MESA_FORMAT_SRGBA_DXT5; #endif #endif #if FEATURE_EXT_texture_sRGB case PIPE_FORMAT_A8L8_SRGB: - return &_mesa_texformat_sla8; + return MESA_FORMAT_SLA8; case PIPE_FORMAT_L8_SRGB: - return &_mesa_texformat_sl8; + return MESA_FORMAT_SL8; case PIPE_FORMAT_R8G8B8_SRGB: - return &_mesa_texformat_srgb8; + return MESA_FORMAT_SRGB8; case PIPE_FORMAT_R8G8B8A8_SRGB: - return &_mesa_texformat_srgba8; + return MESA_FORMAT_SRGBA8; case PIPE_FORMAT_A8R8G8B8_SRGB: - return &_mesa_texformat_sargb8; + return MESA_FORMAT_SARGB8; #endif /* XXX add additional cases */ default: assert(0); - return NULL; + return MESA_FORMAT_NONE; } } @@ -704,7 +704,7 @@ translate_gallium_format_to_mesa_format(enum pipe_format format) /** * Called via ctx->Driver.chooseTextureFormat(). */ -const struct gl_texture_format * +gl_format st_ChooseTextureFormat(GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type) { @@ -716,7 +716,7 @@ st_ChooseTextureFormat(GLcontext *ctx, GLint internalFormat, pFormat = st_choose_format(ctx->st->pipe, internalFormat, PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER); if (pFormat == PIPE_FORMAT_NONE) - return NULL; + return MESA_FORMAT_NONE; return translate_gallium_format_to_mesa_format(pFormat); } diff --git a/src/mesa/state_tracker/st_format.h b/src/mesa/state_tracker/st_format.h index 9d9e02fe9b..1a8c6ea98f 100644 --- a/src/mesa/state_tracker/st_format.h +++ b/src/mesa/state_tracker/st_format.h @@ -29,6 +29,7 @@ #ifndef ST_FORMAT_H #define ST_FORMAT_H +#include "main/formats.h" struct pipe_format_info { @@ -71,7 +72,7 @@ extern enum pipe_format st_choose_renderbuffer_format(struct pipe_context *pipe, GLenum internalFormat); -extern const struct gl_texture_format * +extern gl_format st_ChooseTextureFormat(GLcontext * ctx, GLint internalFormat, GLenum format, GLenum type); diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index 63a6956a7a..58f6933652 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -115,7 +115,7 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, assert(target != GL_TEXTURE_3D); /* not done yet */ - _mesa_format_to_type_and_comps(texObj->Image[face][baseLevel]->TexFormat->MesaFormat, + _mesa_format_to_type_and_comps(texObj->Image[face][baseLevel]->TexFormat, &datatype, &comps); for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) { diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index bbc2830e69..1790e1b28d 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -128,7 +128,7 @@ st_texture_match_image(const struct pipe_texture *pt, /* Check if this image's format matches the established texture's format. */ - if (st_mesa_format_to_pipe_format(image->TexFormat->MesaFormat) != pt->format) + if (st_mesa_format_to_pipe_format(image->TexFormat) != pt->format) return GL_FALSE; /* Test if this image's size matches what's expected in the diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 004d4e05ae..11c8f9256a 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -745,7 +745,7 @@ get_border_color(const struct gl_texture_object *tObj, const struct gl_texture_image *img, GLfloat rgba[4]) { - switch (img->TexFormat->BaseFormat) { + switch (img->_BaseFormat) { case GL_RGB: rgba[0] = tObj->BorderColor[0]; rgba[1] = tObj->BorderColor[1]; @@ -1152,7 +1152,7 @@ sample_2d_linear_repeat(GLcontext *ctx, ASSERT(tObj->WrapS == GL_REPEAT); ASSERT(tObj->WrapT == GL_REPEAT); ASSERT(img->Border == 0); - ASSERT(img->TexFormat->BaseFormat != GL_COLOR_INDEX); + ASSERT(img->_BaseFormat != GL_COLOR_INDEX); ASSERT(img->_IsPowerOfTwo); linear_repeat_texel_location(width, texcoord[0], &i0, &i1, &wi); @@ -1343,7 +1343,7 @@ opt_sample_rgb_2d(GLcontext *ctx, ASSERT(tObj->WrapS==GL_REPEAT); ASSERT(tObj->WrapT==GL_REPEAT); ASSERT(img->Border==0); - ASSERT(img->TexFormat->MesaFormat==MESA_FORMAT_RGB); + ASSERT(img->TexFormat == MESA_FORMAT_RGB); ASSERT(img->_IsPowerOfTwo); for (k=0; kWrapS==GL_REPEAT); ASSERT(tObj->WrapT==GL_REPEAT); ASSERT(img->Border==0); - ASSERT(img->TexFormat->MesaFormat==MESA_FORMAT_RGBA); + ASSERT(img->TexFormat == MESA_FORMAT_RGBA); ASSERT(img->_IsPowerOfTwo); for (i = 0; i < n; i++) { @@ -1414,7 +1414,7 @@ sample_lambda_2d(GLcontext *ctx, const GLboolean repeatNoBorderPOT = (tObj->WrapS == GL_REPEAT) && (tObj->WrapT == GL_REPEAT) && (tImg->Border == 0 && (tImg->Width == tImg->RowStride)) - && (tImg->TexFormat->BaseFormat != GL_COLOR_INDEX) + && (tImg->_BaseFormat != GL_COLOR_INDEX) && tImg->_IsPowerOfTwo; ASSERT(lambda != NULL); @@ -1427,7 +1427,7 @@ sample_lambda_2d(GLcontext *ctx, switch (tObj->MinFilter) { case GL_NEAREST: if (repeatNoBorderPOT) { - switch (tImg->TexFormat->MesaFormat) { + switch (tImg->TexFormat) { case MESA_FORMAT_RGB: opt_sample_rgb_2d(ctx, tObj, m, texcoords + minStart, NULL, rgba + minStart); @@ -1484,7 +1484,7 @@ sample_lambda_2d(GLcontext *ctx, switch (tObj->MagFilter) { case GL_NEAREST: if (repeatNoBorderPOT) { - switch (tImg->TexFormat->MesaFormat) { + switch (tImg->TexFormat) { case MESA_FORMAT_RGB: opt_sample_rgb_2d(ctx, tObj, m, texcoords + magStart, NULL, rgba + magStart); @@ -2152,7 +2152,7 @@ sample_nearest_rect(GLcontext *ctx, ASSERT(tObj->WrapT == GL_CLAMP || tObj->WrapT == GL_CLAMP_TO_EDGE || tObj->WrapT == GL_CLAMP_TO_BORDER); - ASSERT(img->TexFormat->BaseFormat != GL_COLOR_INDEX); + ASSERT(img->_BaseFormat != GL_COLOR_INDEX); for (i = 0; i < n; i++) { GLint row, col; @@ -2186,7 +2186,7 @@ sample_linear_rect(GLcontext *ctx, ASSERT(tObj->WrapT == GL_CLAMP || tObj->WrapT == GL_CLAMP_TO_EDGE || tObj->WrapT == GL_CLAMP_TO_BORDER); - ASSERT(img->TexFormat->BaseFormat != GL_COLOR_INDEX); + ASSERT(img->_BaseFormat != GL_COLOR_INDEX); for (i = 0; i < n; i++) { GLint i0, j0, i1, j1; @@ -2973,8 +2973,8 @@ sample_depth_texture( GLcontext *ctx, (void) lambda; - ASSERT(img->TexFormat->BaseFormat == GL_DEPTH_COMPONENT || - img->TexFormat->BaseFormat == GL_DEPTH_STENCIL_EXT); + ASSERT(img->_BaseFormat == GL_DEPTH_COMPONENT || + img->_BaseFormat == GL_DEPTH_STENCIL_EXT); ASSERT(tObj->Target == GL_TEXTURE_1D || tObj->Target == GL_TEXTURE_2D || @@ -3154,7 +3154,7 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, } else { const GLboolean needLambda = (GLboolean) (t->MinFilter != t->MagFilter); - const GLenum format = t->Image[0][t->BaseLevel]->TexFormat->BaseFormat; + const GLenum format = t->Image[0][t->BaseLevel]->_BaseFormat; switch (t->Target) { case GL_TEXTURE_1D: @@ -3189,14 +3189,14 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, t->WrapT == GL_REPEAT && img->_IsPowerOfTwo && img->Border == 0 && - img->TexFormat->MesaFormat == MESA_FORMAT_RGB) { + img->TexFormat == MESA_FORMAT_RGB) { return &opt_sample_rgb_2d; } else if (t->WrapS == GL_REPEAT && t->WrapT == GL_REPEAT && img->_IsPowerOfTwo && img->Border == 0 && - img->TexFormat->MesaFormat == MESA_FORMAT_RGBA) { + img->TexFormat == MESA_FORMAT_RGBA) { return &opt_sample_rgba_2d; } else { diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 1ab0e19f92..7b59763f11 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -1055,11 +1055,11 @@ _swrast_choose_triangle( GLcontext *ctx ) const struct gl_texture_object *texObj2D; const struct gl_texture_image *texImg; GLenum minFilter, magFilter, envMode; - GLint format; + gl_format format; texObj2D = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; texImg = texObj2D ? texObj2D->Image[0][texObj2D->BaseLevel] : NULL; - format = texImg ? texImg->TexFormat->MesaFormat : -1; + format = texImg ? texImg->TexFormat : -1; minFilter = texObj2D ? texObj2D->MinFilter : (GLenum) 0; magFilter = texObj2D ? texObj2D->MagFilter : (GLenum) 0; envMode = ctx->Texture.Unit[0].EnvMode; -- cgit v1.2.3 From bdc761b0f9c8856193de6e8617c566851d010783 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 30 Sep 2009 20:35:32 -0600 Subject: mesa: remove gl_texture_format --- src/mesa/main/mtypes.h | 34 -- src/mesa/main/texcompress_fxt1.c | 33 -- src/mesa/main/texcompress_s3tc.c | 129 ------ src/mesa/main/texformat.c | 908 --------------------------------------- src/mesa/main/texformat.h | 105 ----- 5 files changed, 1209 deletions(-) (limited to 'src') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 56d5e9fafd..1599a6f13f 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1136,40 +1136,6 @@ typedef void (*StoreTexelFunc)(struct gl_texture_image *texImage, const void *texel); -/** - * Texture format record - */ -struct gl_texture_format -{ - GLint MesaFormat; /**< One of the MESA_FORMAT_* values */ - - GLenum BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_ALPHA, - * GL_LUMINANCE, GL_LUMINANCE_ALPHA, - * GL_INTENSITY, GL_COLOR_INDEX or - * GL_DEPTH_COMPONENT. - */ - GLenum DataType; /**< GL_FLOAT or GL_UNSIGNED_NORMALIZED_ARB */ - - /** - * Bits per texel component. These are just rough approximations - * for compressed texture formats. - */ - /*@{*/ - GLubyte RedBits; - GLubyte GreenBits; - GLubyte BlueBits; - GLubyte AlphaBits; - GLubyte LuminanceBits; - GLubyte IntensityBits; - GLubyte IndexBits; - GLubyte DepthBits; - GLubyte StencilBits; /**< GL_EXT_packed_depth_stencil */ - /*@}*/ - - GLuint TexelBytes; /**< Bytes per texel, 0 if compressed format */ -}; - - /** * Texture image state. Describes the dimensions of a texture image, * the texel format and pointers to Texel Fetch functions. diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index 54e24fd297..7a30806b60 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -226,39 +226,6 @@ _mesa_fetch_texel_2d_f_rgb_fxt1( const struct gl_texture_image *texImage, -const struct gl_texture_format _mesa_texformat_rgb_fxt1 = { - MESA_FORMAT_RGB_FXT1, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /*approx*/ /* RedBits */ - 4, /*approx*/ /* GreenBits */ - 4, /*approx*/ /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0 /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgba_fxt1 = { - MESA_FORMAT_RGBA_FXT1, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /*approx*/ /* RedBits */ - 4, /*approx*/ /* GreenBits */ - 4, /*approx*/ /* BlueBits */ - 1, /*approx*/ /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0 /* TexelBytes */ -}; - - /***************************************************************************\ * FXT1 encoder * diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index 69e43af0fd..2f7168c622 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -567,132 +567,3 @@ _mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage, } #endif -const struct gl_texture_format _mesa_texformat_rgb_dxt1 = { - MESA_FORMAT_RGB_DXT1, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /*approx*/ /* RedBits */ - 4, /*approx*/ /* GreenBits */ - 4, /*approx*/ /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgba_dxt1 = { - MESA_FORMAT_RGBA_DXT1, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /*approx*/ /* RedBits */ - 4, /*approx*/ /* GreenBits */ - 4, /*approx*/ /* BlueBits */ - 1, /*approx*/ /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgba_dxt3 = { - MESA_FORMAT_RGBA_DXT3, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /*approx*/ /* RedBits */ - 4, /*approx*/ /* GreenBits */ - 4, /*approx*/ /* BlueBits */ - 4, /*approx*/ /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgba_dxt5 = { - MESA_FORMAT_RGBA_DXT5, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4,/*approx*/ /* RedBits */ - 4,/*approx*/ /* GreenBits */ - 4,/*approx*/ /* BlueBits */ - 4,/*approx*/ /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0, /* TexelBytes */ -}; - -#if FEATURE_EXT_texture_sRGB -const struct gl_texture_format _mesa_texformat_srgb_dxt1 = { - MESA_FORMAT_SRGB_DXT1, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /*approx*/ /* RedBits */ - 4, /*approx*/ /* GreenBits */ - 4, /*approx*/ /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_srgba_dxt1 = { - MESA_FORMAT_SRGBA_DXT1, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /*approx*/ /* RedBits */ - 4, /*approx*/ /* GreenBits */ - 4, /*approx*/ /* BlueBits */ - 1, /*approx*/ /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_srgba_dxt3 = { - MESA_FORMAT_SRGBA_DXT3, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /*approx*/ /* RedBits */ - 4, /*approx*/ /* GreenBits */ - 4, /*approx*/ /* BlueBits */ - 4, /*approx*/ /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_srgba_dxt5 = { - MESA_FORMAT_SRGBA_DXT5, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4,/*approx*/ /* RedBits */ - 4,/*approx*/ /* GreenBits */ - 4,/*approx*/ /* BlueBits */ - 4,/*approx*/ /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0, /* TexelBytes */ -}; -#endif diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 019193f134..9290210b3f 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -113,914 +113,6 @@ static void store_null_texel(struct gl_texture_image *texImage, } -/** - * Notes about the predefined gl_texture_formats: - * - * 1. There are 1D, 2D and 3D functions for fetching texels from texture - * images, returning both GLchan values and GLfloat values. (six - * functions in total) - * You don't have to provide both the GLchan and GLfloat functions; - * just one or the other is OK. Mesa will use an "adaptor" to convert - * between GLchan/GLfloat when needed. - * Since the adaptors have small performance penalty, we provide both - * GLchan and GLfloat functions for some common formats like RGB, RGBA. - */ - - -/***************************************************************/ -/** \name Default GLchan-based formats */ -/*@{*/ -#if 0 -const struct gl_texture_format _mesa_texformat_rgba = { - MESA_FORMAT_RGBA, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - CHAN_BITS, /* RedBits */ - CHAN_BITS, /* GreenBits */ - CHAN_BITS, /* BlueBits */ - CHAN_BITS, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 4 * sizeof(GLchan), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgb = { - MESA_FORMAT_RGB, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - CHAN_BITS, /* RedBits */ - CHAN_BITS, /* GreenBits */ - CHAN_BITS, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 3 * sizeof(GLchan), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_alpha = { - MESA_FORMAT_ALPHA, /* MesaFormat */ - GL_ALPHA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - CHAN_BITS, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - sizeof(GLchan), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_luminance = { - MESA_FORMAT_LUMINANCE, /* MesaFormat */ - GL_LUMINANCE, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - CHAN_BITS, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - sizeof(GLchan), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_luminance_alpha = { - MESA_FORMAT_LUMINANCE_ALPHA, /* MesaFormat */ - GL_LUMINANCE_ALPHA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - CHAN_BITS, /* AlphaBits */ - CHAN_BITS, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2 * sizeof(GLchan), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_intensity = { - MESA_FORMAT_INTENSITY, /* MesaFormat */ - GL_INTENSITY, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - CHAN_BITS, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - sizeof(GLchan), /* TexelBytes */ -}; - - -#if FEATURE_EXT_texture_sRGB - -const struct gl_texture_format _mesa_texformat_srgb8 = { - MESA_FORMAT_SRGB8, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 3, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_srgba8 = { - MESA_FORMAT_SRGBA8, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 8, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 4, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_sargb8 = { - MESA_FORMAT_SARGB8, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 8, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 4, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_sl8 = { - MESA_FORMAT_SL8, /* MesaFormat */ - GL_LUMINANCE, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 8, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1, /* TexelBytes */ -}; - -/* 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 */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 8, /* AlphaBits */ - 8, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -#endif /* FEATURE_EXT_texture_sRGB */ - -const struct gl_texture_format _mesa_texformat_rgba_float32 = { - MESA_FORMAT_RGBA_FLOAT32, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 8 * sizeof(GLfloat), /* RedBits */ - 8 * sizeof(GLfloat), /* GreenBits */ - 8 * sizeof(GLfloat), /* BlueBits */ - 8 * sizeof(GLfloat), /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 4 * sizeof(GLfloat), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgba_float16 = { - MESA_FORMAT_RGBA_FLOAT16, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 8 * sizeof(GLhalfARB), /* RedBits */ - 8 * sizeof(GLhalfARB), /* GreenBits */ - 8 * sizeof(GLhalfARB), /* BlueBits */ - 8 * sizeof(GLhalfARB), /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 4 * sizeof(GLhalfARB), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgb_float32 = { - MESA_FORMAT_RGB_FLOAT32, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 8 * sizeof(GLfloat), /* RedBits */ - 8 * sizeof(GLfloat), /* GreenBits */ - 8 * sizeof(GLfloat), /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 3 * sizeof(GLfloat), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgb_float16 = { - MESA_FORMAT_RGB_FLOAT16, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 8 * sizeof(GLhalfARB), /* RedBits */ - 8 * sizeof(GLhalfARB), /* GreenBits */ - 8 * sizeof(GLhalfARB), /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 3 * sizeof(GLhalfARB), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_alpha_float32 = { - MESA_FORMAT_ALPHA_FLOAT32, /* MesaFormat */ - GL_ALPHA, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 8 * sizeof(GLfloat), /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1 * sizeof(GLfloat), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_alpha_float16 = { - MESA_FORMAT_ALPHA_FLOAT16, /* MesaFormat */ - GL_ALPHA, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 8 * sizeof(GLhalfARB), /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1 * sizeof(GLhalfARB), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_luminance_float32 = { - MESA_FORMAT_LUMINANCE_FLOAT32, /* MesaFormat */ - GL_LUMINANCE, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 8 * sizeof(GLfloat), /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1 * sizeof(GLfloat), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_luminance_float16 = { - MESA_FORMAT_LUMINANCE_FLOAT16, /* MesaFormat */ - GL_LUMINANCE, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 8 * sizeof(GLhalfARB), /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1 * sizeof(GLhalfARB), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_luminance_alpha_float32 = { - MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, /* MesaFormat */ - GL_LUMINANCE_ALPHA, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 8 * sizeof(GLfloat), /* AlphaBits */ - 8 * sizeof(GLfloat), /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2 * sizeof(GLfloat), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_luminance_alpha_float16 = { - MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, /* MesaFormat */ - GL_LUMINANCE_ALPHA, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 8 * sizeof(GLhalfARB), /* AlphaBits */ - 8 * sizeof(GLhalfARB), /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2 * sizeof(GLhalfARB), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_intensity_float32 = { - MESA_FORMAT_INTENSITY_FLOAT32, /* MesaFormat */ - GL_INTENSITY, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 8 * sizeof(GLfloat), /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1 * sizeof(GLfloat), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_intensity_float16 = { - MESA_FORMAT_INTENSITY_FLOAT16, /* MesaFormat */ - GL_INTENSITY, /* BaseFormat */ - GL_FLOAT, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 8 * sizeof(GLhalfARB), /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1 * sizeof(GLhalfARB), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_dudv8 = { - MESA_FORMAT_DUDV8, /* MesaFormat */ - GL_DUDV_ATI, /* BaseFormat */ - GL_SIGNED_NORMALIZED, /* DataType */ - /* maybe should add dudvBits field, but spec seems to be - lacking the ability to query with GetTexLevelParameter anyway */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -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 */ -}; - -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 */ -}; - -/*@}*/ - - -/***************************************************************/ -/** \name Hardware formats */ -/*@{*/ - -const struct gl_texture_format _mesa_texformat_rgba8888 = { - MESA_FORMAT_RGBA8888, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 8, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 4, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgba8888_rev = { - MESA_FORMAT_RGBA8888_REV, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 8, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 4, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_argb8888 = { - MESA_FORMAT_ARGB8888, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 8, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 4, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_argb8888_rev = { - MESA_FORMAT_ARGB8888_REV, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 8, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 4, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgb888 = { - MESA_FORMAT_RGB888, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 3, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_bgr888 = { - MESA_FORMAT_BGR888, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 8, /* RedBits */ - 8, /* GreenBits */ - 8, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 3, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgb565 = { - MESA_FORMAT_RGB565, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 5, /* RedBits */ - 6, /* GreenBits */ - 5, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgb565_rev = { - MESA_FORMAT_RGB565_REV, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 5, /* RedBits */ - 6, /* GreenBits */ - 5, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgba4444 = { - MESA_FORMAT_RGBA4444, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /* RedBits */ - 4, /* GreenBits */ - 4, /* BlueBits */ - 4, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_argb4444 = { - MESA_FORMAT_ARGB4444, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /* RedBits */ - 4, /* GreenBits */ - 4, /* BlueBits */ - 4, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_argb4444_rev = { - MESA_FORMAT_ARGB4444_REV, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 4, /* RedBits */ - 4, /* GreenBits */ - 4, /* BlueBits */ - 4, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgba5551 = { - MESA_FORMAT_RGBA5551, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 5, /* RedBits */ - 5, /* GreenBits */ - 5, /* BlueBits */ - 1, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_argb1555 = { - MESA_FORMAT_ARGB1555, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 5, /* RedBits */ - 5, /* GreenBits */ - 5, /* BlueBits */ - 1, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_argb1555_rev = { - MESA_FORMAT_ARGB1555_REV, /* MesaFormat */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 5, /* RedBits */ - 5, /* GreenBits */ - 5, /* BlueBits */ - 1, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_al88 = { - MESA_FORMAT_AL88, /* MesaFormat */ - GL_LUMINANCE_ALPHA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 8, /* AlphaBits */ - 8, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_al88_rev = { - MESA_FORMAT_AL88_REV, /* MesaFormat */ - GL_LUMINANCE_ALPHA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 8, /* AlphaBits */ - 8, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_rgb332 = { - MESA_FORMAT_RGB332, /* MesaFormat */ - GL_RGB, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 3, /* RedBits */ - 3, /* GreenBits */ - 2, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_a8 = { - MESA_FORMAT_A8, /* MesaFormat */ - GL_ALPHA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 8, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_l8 = { - MESA_FORMAT_L8, /* MesaFormat */ - GL_LUMINANCE, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 8, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_i8 = { - MESA_FORMAT_I8, /* MesaFormat */ - GL_INTENSITY, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 8, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_ci8 = { - MESA_FORMAT_CI8, /* MesaFormat */ - GL_COLOR_INDEX, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 8, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 1, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_ycbcr = { - MESA_FORMAT_YCBCR, /* MesaFormat */ - GL_YCBCR_MESA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_ycbcr_rev = { - MESA_FORMAT_YCBCR_REV, /* MesaFormat */ - GL_YCBCR_MESA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 2, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_z24_s8 = { - MESA_FORMAT_Z24_S8, /* MesaFormat */ - GL_DEPTH_STENCIL_EXT, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 24, /* DepthBits */ - 8, /* StencilBits */ - 4, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_s8_z24 = { - MESA_FORMAT_S8_Z24, /* MesaFormat */ - GL_DEPTH_STENCIL_EXT, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 24, /* DepthBits */ - 8, /* StencilBits */ - 4, /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_z16 = { - MESA_FORMAT_Z16, /* MesaFormat */ - GL_DEPTH_COMPONENT, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - sizeof(GLushort) * 8, /* DepthBits */ - 0, /* StencilBits */ - sizeof(GLushort), /* TexelBytes */ -}; - -const struct gl_texture_format _mesa_texformat_z32 = { - MESA_FORMAT_Z32, /* MesaFormat */ - GL_DEPTH_COMPONENT, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED_ARB, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - sizeof(GLuint) * 8, /* DepthBits */ - 0, /* StencilBits */ - sizeof(GLuint), /* TexelBytes */ -}; - -/*@}*/ - - -/***************************************************************/ -/** \name Null format (useful for proxy textures) */ -/*@{*/ - -const struct gl_texture_format _mesa_null_texformat = { - -1, /* MesaFormat */ - 0, /* BaseFormat */ - GL_NONE, /* DataType */ - 0, /* RedBits */ - 0, /* GreenBits */ - 0, /* BlueBits */ - 0, /* AlphaBits */ - 0, /* LuminanceBits */ - 0, /* IntensityBits */ - 0, /* IndexBits */ - 0, /* DepthBits */ - 0, /* StencilBits */ - 0, /* TexelBytes */ -}; -#endif - -/*@}*/ - - /** * Choose an appropriate texture format given the format, type and * internalFormat parameters passed to glTexImage(). diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index 9095726ac2..ed6a3a3851 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -39,111 +39,6 @@ #include "mtypes.h" #include "formats.h" -#if 0 -/** GLchan-valued formats */ -/*@{*/ -extern const struct gl_texture_format _mesa_texformat_rgba; -extern const struct gl_texture_format _mesa_texformat_rgb; -extern const struct gl_texture_format _mesa_texformat_alpha; -extern const struct gl_texture_format _mesa_texformat_luminance; -extern const struct gl_texture_format _mesa_texformat_luminance_alpha; -extern const struct gl_texture_format _mesa_texformat_intensity; -/*@}*/ - -#if FEATURE_EXT_texture_sRGB -/** sRGB (nonlinear) formats */ -/*@{*/ -extern const struct gl_texture_format _mesa_texformat_srgb8; -extern const struct gl_texture_format _mesa_texformat_srgba8; -extern const struct gl_texture_format _mesa_texformat_sargb8; -extern const struct gl_texture_format _mesa_texformat_sl8; -extern const struct gl_texture_format _mesa_texformat_sla8; -#if FEATURE_texture_s3tc -extern const struct gl_texture_format _mesa_texformat_srgb_dxt1; -extern const struct gl_texture_format _mesa_texformat_srgba_dxt1; -extern const struct gl_texture_format _mesa_texformat_srgba_dxt3; -extern const struct gl_texture_format _mesa_texformat_srgba_dxt5; -#endif -/*@}*/ -#endif - -/** Floating point texture formats */ -/*@{*/ -extern const struct gl_texture_format _mesa_texformat_rgba_float32; -extern const struct gl_texture_format _mesa_texformat_rgba_float16; -extern const struct gl_texture_format _mesa_texformat_rgb_float32; -extern const struct gl_texture_format _mesa_texformat_rgb_float16; -extern const struct gl_texture_format _mesa_texformat_alpha_float32; -extern const struct gl_texture_format _mesa_texformat_alpha_float16; -extern const struct gl_texture_format _mesa_texformat_luminance_float32; -extern const struct gl_texture_format _mesa_texformat_luminance_float16; -extern const struct gl_texture_format _mesa_texformat_luminance_alpha_float32; -extern const struct gl_texture_format _mesa_texformat_luminance_alpha_float16; -extern const struct gl_texture_format _mesa_texformat_intensity_float32; -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; -extern const struct gl_texture_format _mesa_texformat_signed_rgba8888_rev; -/*@}*/ - -/** \name Assorted hardware-friendly formats */ -/*@{*/ -extern const struct gl_texture_format _mesa_texformat_rgba8888; -extern const struct gl_texture_format _mesa_texformat_rgba8888_rev; -extern const struct gl_texture_format _mesa_texformat_argb8888; -extern const struct gl_texture_format _mesa_texformat_argb8888_rev; -extern const struct gl_texture_format _mesa_texformat_rgb888; -extern const struct gl_texture_format _mesa_texformat_bgr888; -extern const struct gl_texture_format _mesa_texformat_rgb565; -extern const struct gl_texture_format _mesa_texformat_rgb565_rev; -extern const struct gl_texture_format _mesa_texformat_rgba4444; -extern const struct gl_texture_format _mesa_texformat_argb4444; -extern const struct gl_texture_format _mesa_texformat_argb4444_rev; -extern const struct gl_texture_format _mesa_texformat_argb1555; -extern const struct gl_texture_format _mesa_texformat_argb1555_rev; -extern const struct gl_texture_format _mesa_texformat_rgba5551; -extern const struct gl_texture_format _mesa_texformat_al88; -extern const struct gl_texture_format _mesa_texformat_al88_rev; -extern const struct gl_texture_format _mesa_texformat_rgb332; -extern const struct gl_texture_format _mesa_texformat_a8; -extern const struct gl_texture_format _mesa_texformat_l8; -extern const struct gl_texture_format _mesa_texformat_i8; -extern const struct gl_texture_format _mesa_texformat_ci8; -extern const struct gl_texture_format _mesa_texformat_z24_s8; -extern const struct gl_texture_format _mesa_texformat_s8_z24; -extern const struct gl_texture_format _mesa_texformat_z16; -extern const struct gl_texture_format _mesa_texformat_z32; -/*@}*/ - -/** \name YCbCr formats */ -/*@{*/ -extern const struct gl_texture_format _mesa_texformat_ycbcr; -extern const struct gl_texture_format _mesa_texformat_ycbcr_rev; -/*@}*/ - -/** \name Compressed formats */ -/*@{*/ -#if FEATURE_texture_fxt1 -extern const struct gl_texture_format _mesa_texformat_rgb_fxt1; -extern const struct gl_texture_format _mesa_texformat_rgba_fxt1; -#endif -#if FEATURE_texture_s3tc -extern const struct gl_texture_format _mesa_texformat_rgb_dxt1; -extern const struct gl_texture_format _mesa_texformat_rgba_dxt1; -extern const struct gl_texture_format _mesa_texformat_rgba_dxt3; -extern const struct gl_texture_format _mesa_texformat_rgba_dxt5; -#endif -/*@}*/ - -/** \name The null format */ -/*@{*/ -extern const struct gl_texture_format _mesa_null_texformat; -/*@}*/ -#endif extern gl_format _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, -- cgit v1.2.3 From 884d1abb2ac1a2ce872a5b09fd4228159defcf26 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 30 Sep 2009 20:36:25 -0600 Subject: st/mesa: update comment --- src/mesa/state_tracker/st_cb_drawpixels.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 081c09c1fb..3751c8717f 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -410,7 +410,7 @@ make_texture(struct st_context *st, */ success = _mesa_texstore(ctx, 2, /* dims */ baseFormat, /* baseInternalFormat */ - mformat, /* gl_texture_format */ + mformat, /* gl_format */ dest, /* dest */ 0, 0, 0, /* dstX/Y/Zoffset */ transfer->stride, /* dstRowStride, bytes */ -- cgit v1.2.3 From 74ae14a2bde4f87a554c3d96e6f4a9a02591308d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 30 Sep 2009 20:47:54 -0600 Subject: mesa: move texel fetch/store into new texfetch.[ch] files --- src/mesa/SConscript | 1 + src/mesa/main/texfetch.c | 616 ++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/texfetch.h | 41 +++ src/mesa/main/texformat.c | 584 +------------------------------------------ src/mesa/main/texformat.h | 22 +- src/mesa/main/texrender.c | 2 +- src/mesa/main/texstore.c | 1 + src/mesa/sources.mak | 1 + 8 files changed, 668 insertions(+), 600 deletions(-) create mode 100644 src/mesa/main/texfetch.c create mode 100644 src/mesa/main/texfetch.h (limited to 'src') diff --git a/src/mesa/SConscript b/src/mesa/SConscript index 6dfbd26d94..8066da729b 100644 --- a/src/mesa/SConscript +++ b/src/mesa/SConscript @@ -91,6 +91,7 @@ if env['platform'] != 'winddk': 'main/texcompress_fxt1.c', 'main/texenv.c', 'main/texenvprogram.c', + 'main/texfetch.c', 'main/texformat.c', 'main/texgen.c', 'main/texgetimage.c', diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c new file mode 100644 index 0000000000..20ee2527f5 --- /dev/null +++ b/src/mesa/main/texfetch.c @@ -0,0 +1,616 @@ +/* + * Mesa 3-D graphics library + * Version: 7.7 + * + * 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. + */ + + +/** + * \file texfetch.c + * + * Texel fetch/store functions + * + * \author Gareth Hughes + */ + + +#include "colormac.h" +#include "context.h" +#include "texcompress.h" +#include "texcompress_fxt1.h" +#include "texcompress_s3tc.h" +#include "texfetch.h" + + +#if FEATURE_EXT_texture_sRGB + +/** + * Convert an 8-bit sRGB value from non-linear space to a + * linear RGB value in [0, 1]. + * Implemented with a 256-entry lookup table. + */ +static INLINE GLfloat +nonlinear_to_linear(GLubyte cs8) +{ + static GLfloat table[256]; + static GLboolean tableReady = GL_FALSE; + if (!tableReady) { + /* compute lookup table now */ + GLuint i; + for (i = 0; i < 256; i++) { + const GLfloat cs = UBYTE_TO_FLOAT(i); + if (cs <= 0.04045) { + table[i] = cs / 12.92f; + } + else { + table[i] = (GLfloat) _mesa_pow((cs + 0.055) / 1.055, 2.4); + } + } + tableReady = GL_TRUE; + } + return table[cs8]; +} + + +#endif /* FEATURE_EXT_texture_sRGB */ + + +/* Texel fetch routines for all supported formats + */ +#define DIM 1 +#include "texformat_tmp.h" + +#define DIM 2 +#include "texformat_tmp.h" + +#define DIM 3 +#include "texformat_tmp.h" + +/** + * Null texel fetch function. + * + * Have to have this so the FetchTexel function pointer is never NULL. + */ +static void fetch_null_texelf( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + (void) texImage; (void) i; (void) j; (void) k; + texel[RCOMP] = 0.0; + texel[GCOMP] = 0.0; + texel[BCOMP] = 0.0; + texel[ACOMP] = 0.0; + _mesa_warning(NULL, "fetch_null_texelf() called!"); +} + +static void store_null_texel(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + (void) texImage; + (void) i; + (void) j; + (void) k; + (void) texel; + /* no-op */ +} + + + +/** + * Table to map MESA_FORMAT_ to texel fetch/store funcs. + * XXX this is somewhat temporary. + */ +static struct { + GLuint Name; + FetchTexelFuncF Fetch1D; + FetchTexelFuncF Fetch2D; + FetchTexelFuncF Fetch3D; + StoreTexelFunc StoreTexel; +} +texfetch_funcs[MESA_FORMAT_COUNT] = +{ + { + MESA_FORMAT_RGBA, + fetch_texel_1d_f_rgba, + fetch_texel_2d_f_rgba, + fetch_texel_3d_f_rgba, + store_texel_rgba + }, + { + MESA_FORMAT_RGB, + fetch_texel_1d_f_rgb, + fetch_texel_2d_f_rgb, + fetch_texel_3d_f_rgb, + store_texel_rgb + }, + { + MESA_FORMAT_ALPHA, + fetch_texel_1d_f_alpha, + fetch_texel_2d_f_alpha, + fetch_texel_3d_f_alpha, + store_texel_alpha + }, + { + MESA_FORMAT_LUMINANCE, + fetch_texel_1d_f_luminance, + fetch_texel_2d_f_luminance, + fetch_texel_3d_f_luminance, + store_texel_luminance + }, + { + MESA_FORMAT_LUMINANCE_ALPHA, + fetch_texel_1d_f_luminance_alpha, + fetch_texel_2d_f_luminance_alpha, + fetch_texel_3d_f_luminance_alpha, + store_texel_luminance_alpha + }, + { + MESA_FORMAT_INTENSITY, + fetch_texel_1d_f_intensity, + fetch_texel_2d_f_intensity, + fetch_texel_3d_f_intensity, + store_texel_intensity + }, + { + MESA_FORMAT_SRGB8, + fetch_texel_1d_srgb8, + fetch_texel_2d_srgb8, + fetch_texel_3d_srgb8, + store_texel_srgb8 + }, + { + MESA_FORMAT_SRGBA8, + fetch_texel_1d_srgba8, + fetch_texel_2d_srgba8, + fetch_texel_3d_srgba8, + store_texel_srgba8 + }, + { + MESA_FORMAT_SARGB8, + fetch_texel_1d_sargb8, + fetch_texel_2d_sargb8, + fetch_texel_3d_sargb8, + store_texel_sargb8 + }, + { + MESA_FORMAT_SL8, + fetch_texel_1d_sl8, + fetch_texel_2d_sl8, + fetch_texel_3d_sl8, + store_texel_sl8 + }, + { + MESA_FORMAT_SLA8, + fetch_texel_1d_sla8, + fetch_texel_2d_sla8, + fetch_texel_3d_sla8, + store_texel_sla8 + }, + { + MESA_FORMAT_RGB_FXT1, + NULL, + _mesa_fetch_texel_2d_f_rgb_fxt1, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_FXT1, + NULL, + _mesa_fetch_texel_2d_f_rgba_fxt1, + NULL, + NULL + }, + { + MESA_FORMAT_RGB_DXT1, + NULL, + _mesa_fetch_texel_2d_f_rgb_dxt1, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_DXT1, + NULL, + _mesa_fetch_texel_2d_f_rgba_dxt1, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_DXT3, + NULL, + _mesa_fetch_texel_2d_f_rgba_dxt3, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_DXT5, + NULL, + _mesa_fetch_texel_2d_f_rgba_dxt5, + NULL, + NULL + }, + { + MESA_FORMAT_SRGB_DXT1, + NULL, + _mesa_fetch_texel_2d_f_srgb_dxt1, + NULL, + NULL + }, + { + MESA_FORMAT_SRGBA_DXT1, + NULL, + _mesa_fetch_texel_2d_f_srgba_dxt1, + NULL, + NULL + }, + { + MESA_FORMAT_SRGBA_DXT3, + NULL, + _mesa_fetch_texel_2d_f_srgba_dxt3, + NULL, + NULL + }, + { + MESA_FORMAT_SRGBA_DXT5, + NULL, + _mesa_fetch_texel_2d_f_srgba_dxt5, + NULL, + NULL + }, + { + MESA_FORMAT_RGBA_FLOAT32, + fetch_texel_1d_f_rgba_f32, + fetch_texel_2d_f_rgba_f32, + fetch_texel_3d_f_rgba_f32, + store_texel_rgba_f32 + }, + { + MESA_FORMAT_RGBA_FLOAT16, + fetch_texel_1d_f_rgba_f16, + fetch_texel_2d_f_rgba_f16, + fetch_texel_3d_f_rgba_f16, + store_texel_rgba_f16 + }, + { + MESA_FORMAT_RGB_FLOAT32, + fetch_texel_1d_f_rgb_f32, + fetch_texel_2d_f_rgb_f32, + fetch_texel_3d_f_rgb_f32, + store_texel_rgb_f32 + }, + { + MESA_FORMAT_RGB_FLOAT16, + fetch_texel_1d_f_rgb_f16, + fetch_texel_2d_f_rgb_f16, + fetch_texel_3d_f_rgb_f16, + store_texel_rgb_f16 + }, + { + MESA_FORMAT_ALPHA_FLOAT32, + fetch_texel_1d_f_alpha_f32, + fetch_texel_2d_f_alpha_f32, + fetch_texel_3d_f_alpha_f32, + store_texel_alpha_f32 + }, + { + MESA_FORMAT_ALPHA_FLOAT16, + fetch_texel_1d_f_alpha_f16, + fetch_texel_2d_f_alpha_f16, + fetch_texel_3d_f_alpha_f16, + store_texel_alpha_f16 + }, + { + MESA_FORMAT_LUMINANCE_FLOAT32, + fetch_texel_1d_f_luminance_f32, + fetch_texel_2d_f_luminance_f32, + fetch_texel_3d_f_luminance_f32, + store_texel_luminance_f32 + }, + { + MESA_FORMAT_LUMINANCE_FLOAT16, + fetch_texel_1d_f_luminance_f16, + fetch_texel_2d_f_luminance_f16, + fetch_texel_3d_f_luminance_f16, + store_texel_luminance_f16 + }, + { + MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, + fetch_texel_1d_f_luminance_alpha_f32, + fetch_texel_2d_f_luminance_alpha_f32, + fetch_texel_3d_f_luminance_alpha_f32, + store_texel_luminance_alpha_f32 + }, + { + MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, + fetch_texel_1d_f_luminance_alpha_f16, + fetch_texel_2d_f_luminance_alpha_f16, + fetch_texel_3d_f_luminance_alpha_f16, + store_texel_luminance_alpha_f16 + }, + { + MESA_FORMAT_INTENSITY_FLOAT32, + fetch_texel_1d_f_intensity_f32, + fetch_texel_2d_f_intensity_f32, + fetch_texel_3d_f_intensity_f32, + store_texel_intensity_f32 + }, + { + MESA_FORMAT_INTENSITY_FLOAT16, + fetch_texel_1d_f_intensity_f16, + fetch_texel_2d_f_intensity_f16, + fetch_texel_3d_f_intensity_f16, + store_texel_intensity_f16 + }, + { + MESA_FORMAT_DUDV8, + fetch_texel_1d_dudv8, + fetch_texel_2d_dudv8, + fetch_texel_3d_dudv8, + NULL + }, + { + MESA_FORMAT_SIGNED_RGBA8888, + fetch_texel_1d_signed_rgba8888, + fetch_texel_2d_signed_rgba8888, + fetch_texel_3d_signed_rgba8888, + store_texel_signed_rgba8888 + }, + { + MESA_FORMAT_SIGNED_RGBA8888_REV, + fetch_texel_1d_signed_rgba8888_rev, + fetch_texel_2d_signed_rgba8888_rev, + fetch_texel_3d_signed_rgba8888_rev, + store_texel_signed_rgba8888_rev + }, + { + MESA_FORMAT_RGBA8888, + fetch_texel_1d_f_rgba8888, + fetch_texel_2d_f_rgba8888, + fetch_texel_3d_f_rgba8888, + store_texel_rgba8888 + }, + { + MESA_FORMAT_RGBA8888_REV, + fetch_texel_1d_f_rgba8888_rev, + fetch_texel_2d_f_rgba8888_rev, + fetch_texel_3d_f_rgba8888_rev, + store_texel_rgba8888_rev + }, + { + MESA_FORMAT_ARGB8888, + fetch_texel_1d_f_argb8888, + fetch_texel_2d_f_argb8888, + fetch_texel_3d_f_argb8888, + store_texel_argb8888 + }, + { + MESA_FORMAT_ARGB8888_REV, + fetch_texel_1d_f_argb8888_rev, + fetch_texel_2d_f_argb8888_rev, + fetch_texel_3d_f_argb8888_rev, + store_texel_argb8888_rev + }, + { + MESA_FORMAT_RGB888, + fetch_texel_1d_f_rgb888, + fetch_texel_2d_f_rgb888, + fetch_texel_3d_f_rgb888, + store_texel_rgb888 + }, + { + MESA_FORMAT_BGR888, + fetch_texel_1d_f_bgr888, + fetch_texel_2d_f_bgr888, + fetch_texel_3d_f_bgr888, + store_texel_bgr888 + }, + { + MESA_FORMAT_RGB565, + fetch_texel_1d_f_rgb565, + fetch_texel_2d_f_rgb565, + fetch_texel_3d_f_rgb565, + store_texel_rgb565 + }, + { + MESA_FORMAT_RGB565_REV, + fetch_texel_1d_f_rgb565_rev, + fetch_texel_2d_f_rgb565_rev, + fetch_texel_3d_f_rgb565_rev, + store_texel_rgb565_rev + }, + { + MESA_FORMAT_RGBA4444, + fetch_texel_1d_f_rgba4444, + fetch_texel_2d_f_rgba4444, + fetch_texel_3d_f_rgba4444, + store_texel_rgba4444 + }, + { + MESA_FORMAT_ARGB4444, + fetch_texel_1d_f_argb4444, + fetch_texel_2d_f_argb4444, + fetch_texel_3d_f_argb4444, + store_texel_argb4444 + }, + { + MESA_FORMAT_ARGB4444_REV, + fetch_texel_1d_f_argb4444_rev, + fetch_texel_2d_f_argb4444_rev, + fetch_texel_3d_f_argb4444_rev, + store_texel_argb4444_rev + }, + { + MESA_FORMAT_RGBA5551, + fetch_texel_1d_f_rgba5551, + fetch_texel_2d_f_rgba5551, + fetch_texel_3d_f_rgba5551, + store_texel_rgba5551 + }, + { + MESA_FORMAT_ARGB1555, + fetch_texel_1d_f_argb1555, + fetch_texel_2d_f_argb1555, + fetch_texel_3d_f_argb1555, + store_texel_argb1555 + }, + { + MESA_FORMAT_ARGB1555_REV, + fetch_texel_1d_f_argb1555_rev, + fetch_texel_2d_f_argb1555_rev, + fetch_texel_3d_f_argb1555_rev, + store_texel_argb1555_rev + }, + { + MESA_FORMAT_AL88, + fetch_texel_1d_f_al88, + fetch_texel_2d_f_al88, + fetch_texel_3d_f_al88, + store_texel_al88 + }, + { + MESA_FORMAT_AL88_REV, + fetch_texel_1d_f_al88_rev, + fetch_texel_2d_f_al88_rev, + fetch_texel_3d_f_al88_rev, + store_texel_al88_rev + }, + { + MESA_FORMAT_RGB332, + fetch_texel_1d_f_rgb332, + fetch_texel_2d_f_rgb332, + fetch_texel_3d_f_rgb332, + store_texel_rgb332 + }, + { + MESA_FORMAT_A8, + fetch_texel_1d_f_a8, + fetch_texel_2d_f_a8, + fetch_texel_3d_f_a8, + store_texel_a8 + }, + { + MESA_FORMAT_L8, + fetch_texel_1d_f_l8, + fetch_texel_2d_f_l8, + fetch_texel_3d_f_l8, + store_texel_l8 + }, + { + MESA_FORMAT_I8, + fetch_texel_1d_f_i8, + fetch_texel_2d_f_i8, + fetch_texel_3d_f_i8, + store_texel_i8 + }, + { + MESA_FORMAT_CI8, + fetch_texel_1d_f_ci8, + fetch_texel_2d_f_ci8, + fetch_texel_3d_f_ci8, + store_texel_ci8 + }, + { + MESA_FORMAT_YCBCR, + fetch_texel_1d_f_ycbcr, + fetch_texel_2d_f_ycbcr, + fetch_texel_3d_f_ycbcr, + store_texel_ycbcr + }, + { + MESA_FORMAT_YCBCR_REV, + fetch_texel_1d_f_ycbcr_rev, + fetch_texel_2d_f_ycbcr_rev, + fetch_texel_3d_f_ycbcr_rev, + store_texel_ycbcr_rev + }, + { + MESA_FORMAT_Z24_S8, + fetch_texel_1d_f_z24_s8, + fetch_texel_2d_f_z24_s8, + fetch_texel_3d_f_z24_s8, + store_texel_z24_s8 + }, + { + MESA_FORMAT_S8_Z24, + fetch_texel_1d_f_s8_z24, + fetch_texel_2d_f_s8_z24, + fetch_texel_3d_f_s8_z24, + store_texel_s8_z24 + }, + { + MESA_FORMAT_Z16, + fetch_texel_1d_f_z16, + fetch_texel_2d_f_z16, + fetch_texel_3d_f_z16, + store_texel_z16 + }, + { + MESA_FORMAT_Z32, + fetch_texel_1d_f_z32, + fetch_texel_2d_f_z32, + fetch_texel_3d_f_z32, + store_texel_z32 + } +}; + + +FetchTexelFuncF +_mesa_get_texel_fetch_func(gl_format format, GLuint dims) +{ + FetchTexelFuncF f; + GLuint i; + /* XXX replace loop with direct table lookup */ + for (i = 0; i < MESA_FORMAT_COUNT; i++) { + if (texfetch_funcs[i].Name == format) { + switch (dims) { + case 1: + f = texfetch_funcs[i].Fetch1D; + break; + case 2: + f = texfetch_funcs[i].Fetch2D; + break; + case 3: + f = texfetch_funcs[i].Fetch3D; + break; + } + if (!f) + f = fetch_null_texelf; + return f; + } + } + return NULL; +} + + +StoreTexelFunc +_mesa_get_texel_store_func(gl_format format) +{ + GLuint i; + /* XXX replace loop with direct table lookup */ + for (i = 0; i < MESA_FORMAT_COUNT; i++) { + if (texfetch_funcs[i].Name == format) { + if (texfetch_funcs[i].StoreTexel) + return texfetch_funcs[i].StoreTexel; + else + return store_null_texel; + } + } + return NULL; +} diff --git a/src/mesa/main/texfetch.h b/src/mesa/main/texfetch.h new file mode 100644 index 0000000000..a397b04600 --- /dev/null +++ b/src/mesa/main/texfetch.h @@ -0,0 +1,41 @@ +/* + * Mesa 3-D graphics library + * Version: 7.7 + * + * 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 TEXFETCH_H +#define TEXFETCH_H + +#include "mtypes.h" +#include "formats.h" + + +extern FetchTexelFuncF +_mesa_get_texel_fetch_func(gl_format format, GLuint dims); + +extern StoreTexelFunc +_mesa_get_texel_store_func(gl_format format); + + +#endif diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 9290210b3f..bee7f583cf 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.7 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. - * Copyright (c) 2008 VMware, Inc. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * 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"), @@ -29,88 +29,15 @@ * Texture formats. * * \author Gareth Hughes + * \author Brian Paul */ -#include "colormac.h" #include "context.h" #include "texcompress.h" #include "texcompress_fxt1.h" #include "texcompress_s3tc.h" #include "texformat.h" -#include "texstore.h" - - -#if FEATURE_EXT_texture_sRGB - -/** - * Convert an 8-bit sRGB value from non-linear space to a - * linear RGB value in [0, 1]. - * Implemented with a 256-entry lookup table. - */ -static INLINE GLfloat -nonlinear_to_linear(GLubyte cs8) -{ - static GLfloat table[256]; - static GLboolean tableReady = GL_FALSE; - if (!tableReady) { - /* compute lookup table now */ - GLuint i; - for (i = 0; i < 256; i++) { - const GLfloat cs = UBYTE_TO_FLOAT(i); - if (cs <= 0.04045) { - table[i] = cs / 12.92f; - } - else { - table[i] = (GLfloat) _mesa_pow((cs + 0.055) / 1.055, 2.4); - } - } - tableReady = GL_TRUE; - } - return table[cs8]; -} - - -#endif /* FEATURE_EXT_texture_sRGB */ - - -/* Texel fetch routines for all supported formats - */ -#define DIM 1 -#include "texformat_tmp.h" - -#define DIM 2 -#include "texformat_tmp.h" - -#define DIM 3 -#include "texformat_tmp.h" - -/** - * Null texel fetch function. - * - * Have to have this so the FetchTexel function pointer is never NULL. - */ -static void fetch_null_texelf( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - (void) texImage; (void) i; (void) j; (void) k; - texel[RCOMP] = 0.0; - texel[GCOMP] = 0.0; - texel[BCOMP] = 0.0; - texel[ACOMP] = 0.0; - _mesa_warning(NULL, "fetch_null_texelf() called!"); -} - -static void store_null_texel(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - (void) texImage; - (void) i; - (void) j; - (void) k; - (void) texel; - /* no-op */ -} /** @@ -639,506 +566,3 @@ _mesa_format_to_type_and_comps(gl_format format, *comps = 1; } } - - - -/** - * Table to map MESA_FORMAT_ to texel fetch/store funcs. - * XXX this is somewhat temporary. - */ -static struct { - GLuint Name; - FetchTexelFuncF Fetch1D; - FetchTexelFuncF Fetch2D; - FetchTexelFuncF Fetch3D; - StoreTexelFunc StoreTexel; -} -texfetch_funcs[MESA_FORMAT_COUNT] = -{ - { - MESA_FORMAT_RGBA, - fetch_texel_1d_f_rgba, - fetch_texel_2d_f_rgba, - fetch_texel_3d_f_rgba, - store_texel_rgba - }, - { - MESA_FORMAT_RGB, - fetch_texel_1d_f_rgb, - fetch_texel_2d_f_rgb, - fetch_texel_3d_f_rgb, - store_texel_rgb - }, - { - MESA_FORMAT_ALPHA, - fetch_texel_1d_f_alpha, - fetch_texel_2d_f_alpha, - fetch_texel_3d_f_alpha, - store_texel_alpha - }, - { - MESA_FORMAT_LUMINANCE, - fetch_texel_1d_f_luminance, - fetch_texel_2d_f_luminance, - fetch_texel_3d_f_luminance, - store_texel_luminance - }, - { - MESA_FORMAT_LUMINANCE_ALPHA, - fetch_texel_1d_f_luminance_alpha, - fetch_texel_2d_f_luminance_alpha, - fetch_texel_3d_f_luminance_alpha, - store_texel_luminance_alpha - }, - { - MESA_FORMAT_INTENSITY, - fetch_texel_1d_f_intensity, - fetch_texel_2d_f_intensity, - fetch_texel_3d_f_intensity, - store_texel_intensity - }, - { - MESA_FORMAT_SRGB8, - fetch_texel_1d_srgb8, - fetch_texel_2d_srgb8, - fetch_texel_3d_srgb8, - store_texel_srgb8 - }, - { - MESA_FORMAT_SRGBA8, - fetch_texel_1d_srgba8, - fetch_texel_2d_srgba8, - fetch_texel_3d_srgba8, - store_texel_srgba8 - }, - { - MESA_FORMAT_SARGB8, - fetch_texel_1d_sargb8, - fetch_texel_2d_sargb8, - fetch_texel_3d_sargb8, - store_texel_sargb8 - }, - { - MESA_FORMAT_SL8, - fetch_texel_1d_sl8, - fetch_texel_2d_sl8, - fetch_texel_3d_sl8, - store_texel_sl8 - }, - { - MESA_FORMAT_SLA8, - fetch_texel_1d_sla8, - fetch_texel_2d_sla8, - fetch_texel_3d_sla8, - store_texel_sla8 - }, - { - MESA_FORMAT_RGB_FXT1, - NULL, - _mesa_fetch_texel_2d_f_rgb_fxt1, - NULL, - NULL - }, - { - MESA_FORMAT_RGBA_FXT1, - NULL, - _mesa_fetch_texel_2d_f_rgba_fxt1, - NULL, - NULL - }, - { - MESA_FORMAT_RGB_DXT1, - NULL, - _mesa_fetch_texel_2d_f_rgb_dxt1, - NULL, - NULL - }, - { - MESA_FORMAT_RGBA_DXT1, - NULL, - _mesa_fetch_texel_2d_f_rgba_dxt1, - NULL, - NULL - }, - { - MESA_FORMAT_RGBA_DXT3, - NULL, - _mesa_fetch_texel_2d_f_rgba_dxt3, - NULL, - NULL - }, - { - MESA_FORMAT_RGBA_DXT5, - NULL, - _mesa_fetch_texel_2d_f_rgba_dxt5, - NULL, - NULL - }, - { - MESA_FORMAT_SRGB_DXT1, - NULL, - _mesa_fetch_texel_2d_f_srgb_dxt1, - NULL, - NULL - }, - { - MESA_FORMAT_SRGBA_DXT1, - NULL, - _mesa_fetch_texel_2d_f_srgba_dxt1, - NULL, - NULL - }, - { - MESA_FORMAT_SRGBA_DXT3, - NULL, - _mesa_fetch_texel_2d_f_srgba_dxt3, - NULL, - NULL - }, - { - MESA_FORMAT_SRGBA_DXT5, - NULL, - _mesa_fetch_texel_2d_f_srgba_dxt5, - NULL, - NULL - }, - { - MESA_FORMAT_RGBA_FLOAT32, - fetch_texel_1d_f_rgba_f32, - fetch_texel_2d_f_rgba_f32, - fetch_texel_3d_f_rgba_f32, - store_texel_rgba_f32 - }, - { - MESA_FORMAT_RGBA_FLOAT16, - fetch_texel_1d_f_rgba_f16, - fetch_texel_2d_f_rgba_f16, - fetch_texel_3d_f_rgba_f16, - store_texel_rgba_f16 - }, - { - MESA_FORMAT_RGB_FLOAT32, - fetch_texel_1d_f_rgb_f32, - fetch_texel_2d_f_rgb_f32, - fetch_texel_3d_f_rgb_f32, - store_texel_rgb_f32 - }, - { - MESA_FORMAT_RGB_FLOAT16, - fetch_texel_1d_f_rgb_f16, - fetch_texel_2d_f_rgb_f16, - fetch_texel_3d_f_rgb_f16, - store_texel_rgb_f16 - }, - { - MESA_FORMAT_ALPHA_FLOAT32, - fetch_texel_1d_f_alpha_f32, - fetch_texel_2d_f_alpha_f32, - fetch_texel_3d_f_alpha_f32, - store_texel_alpha_f32 - }, - { - MESA_FORMAT_ALPHA_FLOAT16, - fetch_texel_1d_f_alpha_f16, - fetch_texel_2d_f_alpha_f16, - fetch_texel_3d_f_alpha_f16, - store_texel_alpha_f16 - }, - { - MESA_FORMAT_LUMINANCE_FLOAT32, - fetch_texel_1d_f_luminance_f32, - fetch_texel_2d_f_luminance_f32, - fetch_texel_3d_f_luminance_f32, - store_texel_luminance_f32 - }, - { - MESA_FORMAT_LUMINANCE_FLOAT16, - fetch_texel_1d_f_luminance_f16, - fetch_texel_2d_f_luminance_f16, - fetch_texel_3d_f_luminance_f16, - store_texel_luminance_f16 - }, - { - MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, - fetch_texel_1d_f_luminance_alpha_f32, - fetch_texel_2d_f_luminance_alpha_f32, - fetch_texel_3d_f_luminance_alpha_f32, - store_texel_luminance_alpha_f32 - }, - { - MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, - fetch_texel_1d_f_luminance_alpha_f16, - fetch_texel_2d_f_luminance_alpha_f16, - fetch_texel_3d_f_luminance_alpha_f16, - store_texel_luminance_alpha_f16 - }, - { - MESA_FORMAT_INTENSITY_FLOAT32, - fetch_texel_1d_f_intensity_f32, - fetch_texel_2d_f_intensity_f32, - fetch_texel_3d_f_intensity_f32, - store_texel_intensity_f32 - }, - { - MESA_FORMAT_INTENSITY_FLOAT16, - fetch_texel_1d_f_intensity_f16, - fetch_texel_2d_f_intensity_f16, - fetch_texel_3d_f_intensity_f16, - store_texel_intensity_f16 - }, - { - MESA_FORMAT_DUDV8, - fetch_texel_1d_dudv8, - fetch_texel_2d_dudv8, - fetch_texel_3d_dudv8, - NULL - }, - { - MESA_FORMAT_SIGNED_RGBA8888, - fetch_texel_1d_signed_rgba8888, - fetch_texel_2d_signed_rgba8888, - fetch_texel_3d_signed_rgba8888, - store_texel_signed_rgba8888 - }, - { - MESA_FORMAT_SIGNED_RGBA8888_REV, - fetch_texel_1d_signed_rgba8888_rev, - fetch_texel_2d_signed_rgba8888_rev, - fetch_texel_3d_signed_rgba8888_rev, - store_texel_signed_rgba8888_rev - }, - { - MESA_FORMAT_RGBA8888, - fetch_texel_1d_f_rgba8888, - fetch_texel_2d_f_rgba8888, - fetch_texel_3d_f_rgba8888, - store_texel_rgba8888 - }, - { - MESA_FORMAT_RGBA8888_REV, - fetch_texel_1d_f_rgba8888_rev, - fetch_texel_2d_f_rgba8888_rev, - fetch_texel_3d_f_rgba8888_rev, - store_texel_rgba8888_rev - }, - { - MESA_FORMAT_ARGB8888, - fetch_texel_1d_f_argb8888, - fetch_texel_2d_f_argb8888, - fetch_texel_3d_f_argb8888, - store_texel_argb8888 - }, - { - MESA_FORMAT_ARGB8888_REV, - fetch_texel_1d_f_argb8888_rev, - fetch_texel_2d_f_argb8888_rev, - fetch_texel_3d_f_argb8888_rev, - store_texel_argb8888_rev - }, - { - MESA_FORMAT_RGB888, - fetch_texel_1d_f_rgb888, - fetch_texel_2d_f_rgb888, - fetch_texel_3d_f_rgb888, - store_texel_rgb888 - }, - { - MESA_FORMAT_BGR888, - fetch_texel_1d_f_bgr888, - fetch_texel_2d_f_bgr888, - fetch_texel_3d_f_bgr888, - store_texel_bgr888 - }, - { - MESA_FORMAT_RGB565, - fetch_texel_1d_f_rgb565, - fetch_texel_2d_f_rgb565, - fetch_texel_3d_f_rgb565, - store_texel_rgb565 - }, - { - MESA_FORMAT_RGB565_REV, - fetch_texel_1d_f_rgb565_rev, - fetch_texel_2d_f_rgb565_rev, - fetch_texel_3d_f_rgb565_rev, - store_texel_rgb565_rev - }, - { - MESA_FORMAT_RGBA4444, - fetch_texel_1d_f_rgba4444, - fetch_texel_2d_f_rgba4444, - fetch_texel_3d_f_rgba4444, - store_texel_rgba4444 - }, - { - MESA_FORMAT_ARGB4444, - fetch_texel_1d_f_argb4444, - fetch_texel_2d_f_argb4444, - fetch_texel_3d_f_argb4444, - store_texel_argb4444 - }, - { - MESA_FORMAT_ARGB4444_REV, - fetch_texel_1d_f_argb4444_rev, - fetch_texel_2d_f_argb4444_rev, - fetch_texel_3d_f_argb4444_rev, - store_texel_argb4444_rev - }, - { - MESA_FORMAT_RGBA5551, - fetch_texel_1d_f_rgba5551, - fetch_texel_2d_f_rgba5551, - fetch_texel_3d_f_rgba5551, - store_texel_rgba5551 - }, - { - MESA_FORMAT_ARGB1555, - fetch_texel_1d_f_argb1555, - fetch_texel_2d_f_argb1555, - fetch_texel_3d_f_argb1555, - store_texel_argb1555 - }, - { - MESA_FORMAT_ARGB1555_REV, - fetch_texel_1d_f_argb1555_rev, - fetch_texel_2d_f_argb1555_rev, - fetch_texel_3d_f_argb1555_rev, - store_texel_argb1555_rev - }, - { - MESA_FORMAT_AL88, - fetch_texel_1d_f_al88, - fetch_texel_2d_f_al88, - fetch_texel_3d_f_al88, - store_texel_al88 - }, - { - MESA_FORMAT_AL88_REV, - fetch_texel_1d_f_al88_rev, - fetch_texel_2d_f_al88_rev, - fetch_texel_3d_f_al88_rev, - store_texel_al88_rev - }, - { - MESA_FORMAT_RGB332, - fetch_texel_1d_f_rgb332, - fetch_texel_2d_f_rgb332, - fetch_texel_3d_f_rgb332, - store_texel_rgb332 - }, - { - MESA_FORMAT_A8, - fetch_texel_1d_f_a8, - fetch_texel_2d_f_a8, - fetch_texel_3d_f_a8, - store_texel_a8 - }, - { - MESA_FORMAT_L8, - fetch_texel_1d_f_l8, - fetch_texel_2d_f_l8, - fetch_texel_3d_f_l8, - store_texel_l8 - }, - { - MESA_FORMAT_I8, - fetch_texel_1d_f_i8, - fetch_texel_2d_f_i8, - fetch_texel_3d_f_i8, - store_texel_i8 - }, - { - MESA_FORMAT_CI8, - fetch_texel_1d_f_ci8, - fetch_texel_2d_f_ci8, - fetch_texel_3d_f_ci8, - store_texel_ci8 - }, - { - MESA_FORMAT_YCBCR, - fetch_texel_1d_f_ycbcr, - fetch_texel_2d_f_ycbcr, - fetch_texel_3d_f_ycbcr, - store_texel_ycbcr - }, - { - MESA_FORMAT_YCBCR_REV, - fetch_texel_1d_f_ycbcr_rev, - fetch_texel_2d_f_ycbcr_rev, - fetch_texel_3d_f_ycbcr_rev, - store_texel_ycbcr_rev - }, - { - MESA_FORMAT_Z24_S8, - fetch_texel_1d_f_z24_s8, - fetch_texel_2d_f_z24_s8, - fetch_texel_3d_f_z24_s8, - store_texel_z24_s8 - }, - { - MESA_FORMAT_S8_Z24, - fetch_texel_1d_f_s8_z24, - fetch_texel_2d_f_s8_z24, - fetch_texel_3d_f_s8_z24, - store_texel_s8_z24 - }, - { - MESA_FORMAT_Z16, - fetch_texel_1d_f_z16, - fetch_texel_2d_f_z16, - fetch_texel_3d_f_z16, - store_texel_z16 - }, - { - MESA_FORMAT_Z32, - fetch_texel_1d_f_z32, - fetch_texel_2d_f_z32, - fetch_texel_3d_f_z32, - store_texel_z32 - } -}; - - -FetchTexelFuncF -_mesa_get_texel_fetch_func(GLuint format, GLuint dims) -{ - FetchTexelFuncF f; - GLuint i; - /* XXX replace loop with direct table lookup */ - for (i = 0; i < MESA_FORMAT_COUNT; i++) { - if (texfetch_funcs[i].Name == format) { - switch (dims) { - case 1: - f = texfetch_funcs[i].Fetch1D; - break; - case 2: - f = texfetch_funcs[i].Fetch2D; - break; - case 3: - f = texfetch_funcs[i].Fetch3D; - break; - } - if (!f) - f = fetch_null_texelf; - return f; - } - } - return NULL; -} - - -StoreTexelFunc -_mesa_get_texel_store_func(GLuint format) -{ - GLuint i; - /* XXX replace loop with direct table lookup */ - for (i = 0; i < MESA_FORMAT_COUNT; i++) { - if (texfetch_funcs[i].Name == format) { - if (texfetch_funcs[i].StoreTexel) - return texfetch_funcs[i].StoreTexel; - else - return store_null_texel; - } - } - return NULL; -} diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index ed6a3a3851..0711b67da1 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -1,9 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 + * Version: 7.75 * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. - * Copyright (c) 2008 VMware, Inc. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * 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"), @@ -23,15 +23,6 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -/** - * \file texformat.h - * Texture formats definitions. - * - * \author Gareth Hughes - */ - - #ifndef TEXFORMAT_H #define TEXFORMAT_H @@ -49,11 +40,4 @@ extern void _mesa_format_to_type_and_comps(gl_format format, GLenum *datatype, GLuint *comps); -extern FetchTexelFuncF -_mesa_get_texel_fetch_func(GLuint format, GLuint dims); - -extern StoreTexelFunc -_mesa_get_texel_store_func(GLuint format); - - #endif diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c index 81bb1d40ff..f47478421a 100644 --- a/src/mesa/main/texrender.c +++ b/src/mesa/main/texrender.c @@ -1,7 +1,7 @@ #include "context.h" #include "fbobject.h" -#include "texformat.h" +#include "texfetch.h" #include "texrender.h" #include "renderbuffer.h" diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 02e3df89cf..d5bc16dee4 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -64,6 +64,7 @@ #include "texcompress.h" #include "texcompress_fxt1.h" #include "texcompress_s3tc.h" +#include "texfetch.h" #include "texformat.h" #include "teximage.h" #include "texstore.h" diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index dab3e56038..8959ff5356 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -68,6 +68,7 @@ MAIN_SOURCES = \ main/texcompress_fxt1.c \ main/texenv.c \ main/texenvprogram.c \ + main/texfetch.c \ main/texformat.c \ main/texgen.c \ main/texgetimage.c \ -- cgit v1.2.3 From 3fa7dbf368bb060220e9f78e666b00d6827166a6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 30 Sep 2009 21:00:16 -0600 Subject: mesa: remove GLchan-based formats; use hw 8-bit/channel formats instead Removed: MESA_FORMAT_RGBA, RGB, ALPHA, LUMINANCE, LUMINANCE_ALPHA, INTENSITY. --- src/mesa/drivers/x11/xm_dd.c | 4 +- src/mesa/main/formats.c | 48 ------------- src/mesa/main/formats.h | 13 +--- src/mesa/main/mipmap.c | 4 +- src/mesa/main/texfetch.c | 42 ----------- src/mesa/main/texformat.c | 37 ++-------- src/mesa/main/texformat_tmp.h | 146 ------------------------------------- src/mesa/main/texstore.c | 164 ------------------------------------------ src/mesa/swrast/s_texfilter.c | 36 +++++----- src/mesa/swrast/s_triangle.c | 12 ++-- 10 files changed, 35 insertions(+), 471 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 5b00b5b82c..d757e50b5a 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -1025,9 +1025,9 @@ choose_tex_format( GLcontext *ctx, GLint internalFormat, { switch (internalFormat) { case GL_COMPRESSED_RGB_ARB: - return MESA_FORMAT_RGB; + return MESA_FORMAT_RGB888; case GL_COMPRESSED_RGBA_ARB: - return MESA_FORMAT_RGBA; + return MESA_FORMAT_RGBA8888; default: return _mesa_choose_tex_format(ctx, internalFormat, format, type); } diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 2ad5685883..f915b1da91 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -401,54 +401,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, #endif - { - MESA_FORMAT_RGBA, - GL_RGBA, - GL_UNSIGNED_NORMALIZED, - CHAN_BITS, CHAN_BITS, CHAN_BITS, CHAN_BITS, - 0, 0, 0, 0, 0, - 1, 1, 4 * CHAN_BITS / 8 - }, - { - MESA_FORMAT_RGB, - GL_RGB, - GL_UNSIGNED_NORMALIZED, - CHAN_BITS, CHAN_BITS, CHAN_BITS, 0, - 0, 0, 0, 0, 0, - 1, 1, 3 * CHAN_BITS / 8 - }, - { - MESA_FORMAT_ALPHA, - GL_ALPHA, - GL_UNSIGNED_NORMALIZED, - 0, 0, 0, CHAN_BITS, - 0, 0, 0, 0, 0, - 1, 1, 1 * CHAN_BITS / 8 - }, - { - MESA_FORMAT_LUMINANCE, - GL_LUMINANCE, - GL_UNSIGNED_NORMALIZED, - 0, 0, 0, 0, - CHAN_BITS, 0, 0, 0, 0, - 1, 1, 1 * CHAN_BITS / 8 - }, - { - MESA_FORMAT_LUMINANCE_ALPHA, - GL_LUMINANCE_ALPHA, - GL_UNSIGNED_NORMALIZED, - 0, 0, 0, CHAN_BITS, - CHAN_BITS, 0, 0, 0, 0, - 1, 1, 2 * CHAN_BITS / 8 - }, - { - MESA_FORMAT_INTENSITY, - GL_INTENSITY, - GL_UNSIGNED_NORMALIZED, - 0, 0, 0, 0, - 0, CHAN_BITS, 0, 0, 0, - 1, 1, 1 * CHAN_BITS / 8 - }, { MESA_FORMAT_RGBA_FLOAT32, GL_RGBA, diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index dbde28e727..9235828a0f 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -43,6 +43,7 @@ typedef enum { MESA_FORMAT_NONE = 0, + /** * \name Basic hardware formats */ @@ -114,18 +115,6 @@ typedef enum #endif /*@}*/ - /** - * \name Generic GLchan-based formats. (XXX obsolete!) - */ - /*@{*/ - MESA_FORMAT_RGBA, - MESA_FORMAT_RGB, - MESA_FORMAT_ALPHA, - MESA_FORMAT_LUMINANCE, - MESA_FORMAT_LUMINANCE_ALPHA, - MESA_FORMAT_INTENSITY, - /*@}*/ - /** * \name Floating point texture formats. */ diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 7e99a5d3de..ccd153303d 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1521,11 +1521,11 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, texObj->Target == GL_TEXTURE_CUBE_MAP_ARB); if (srcImage->_BaseFormat == GL_RGB) { - convertFormat = MESA_FORMAT_RGB; + convertFormat = MESA_FORMAT_RGB888; components = 3; } else if (srcImage->_BaseFormat == GL_RGBA) { - convertFormat = MESA_FORMAT_RGBA; + convertFormat = MESA_FORMAT_RGBA8888; components = 4; } else { diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c index 20ee2527f5..8149166560 100644 --- a/src/mesa/main/texfetch.c +++ b/src/mesa/main/texfetch.c @@ -127,48 +127,6 @@ static struct { } texfetch_funcs[MESA_FORMAT_COUNT] = { - { - MESA_FORMAT_RGBA, - fetch_texel_1d_f_rgba, - fetch_texel_2d_f_rgba, - fetch_texel_3d_f_rgba, - store_texel_rgba - }, - { - MESA_FORMAT_RGB, - fetch_texel_1d_f_rgb, - fetch_texel_2d_f_rgb, - fetch_texel_3d_f_rgb, - store_texel_rgb - }, - { - MESA_FORMAT_ALPHA, - fetch_texel_1d_f_alpha, - fetch_texel_2d_f_alpha, - fetch_texel_3d_f_alpha, - store_texel_alpha - }, - { - MESA_FORMAT_LUMINANCE, - fetch_texel_1d_f_luminance, - fetch_texel_2d_f_luminance, - fetch_texel_3d_f_luminance, - store_texel_luminance - }, - { - MESA_FORMAT_LUMINANCE_ALPHA, - fetch_texel_1d_f_luminance_alpha, - fetch_texel_2d_f_luminance_alpha, - fetch_texel_3d_f_luminance_alpha, - store_texel_luminance_alpha - }, - { - MESA_FORMAT_INTENSITY, - fetch_texel_1d_f_intensity, - fetch_texel_2d_f_intensity, - fetch_texel_3d_f_intensity, - store_texel_intensity - }, { MESA_FORMAT_SRGB8, fetch_texel_1d_srgb8, diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index bee7f583cf..b1ae324050 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -69,7 +69,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: - return MESA_FORMAT_RGBA; case GL_RGBA8: return MESA_FORMAT_RGBA8888; case GL_RGB5_A1: @@ -85,7 +84,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_RGB10: case GL_RGB12: case GL_RGB16: - return MESA_FORMAT_RGB; case GL_RGB8: return MESA_FORMAT_RGB888; case GL_R3_G3_B2: @@ -100,7 +98,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_ALPHA4: case GL_ALPHA12: case GL_ALPHA16: - return MESA_FORMAT_ALPHA; case GL_ALPHA8: return MESA_FORMAT_A8; @@ -110,7 +107,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE4: case GL_LUMINANCE12: case GL_LUMINANCE16: - return MESA_FORMAT_LUMINANCE; case GL_LUMINANCE8: return MESA_FORMAT_L8; @@ -122,7 +118,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE12_ALPHA4: case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: - return MESA_FORMAT_LUMINANCE_ALPHA; case GL_LUMINANCE8_ALPHA8: return MESA_FORMAT_AL88; @@ -130,7 +125,6 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_INTENSITY4: case GL_INTENSITY12: case GL_INTENSITY16: - return MESA_FORMAT_INTENSITY; case GL_INTENSITY8: return MESA_FORMAT_I8; @@ -162,13 +156,13 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, switch (internalFormat) { case GL_COMPRESSED_ALPHA_ARB: - return MESA_FORMAT_ALPHA; + return MESA_FORMAT_A8; case GL_COMPRESSED_LUMINANCE_ARB: - return MESA_FORMAT_LUMINANCE; + return MESA_FORMAT_L8; case GL_COMPRESSED_LUMINANCE_ALPHA_ARB: - return MESA_FORMAT_LUMINANCE_ALPHA; + return MESA_FORMAT_AL88; case GL_COMPRESSED_INTENSITY_ARB: - return MESA_FORMAT_INTENSITY; + return MESA_FORMAT_I8; case GL_COMPRESSED_RGB_ARB: #if FEATURE_texture_fxt1 if (ctx->Extensions.TDFX_texture_compression_FXT1) @@ -179,7 +173,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, ctx->Extensions.S3_s3tc) return MESA_FORMAT_RGB_DXT1; #endif - return MESA_FORMAT_RGB; + return MESA_FORMAT_RGB888; case GL_COMPRESSED_RGBA_ARB: #if FEATURE_texture_fxt1 if (ctx->Extensions.TDFX_texture_compression_FXT1) @@ -190,7 +184,7 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, ctx->Extensions.S3_s3tc) return MESA_FORMAT_RGBA_DXT3; /* Not rgba_dxt1, see spec */ #endif - return MESA_FORMAT_RGBA; + return MESA_FORMAT_RGBA8888; default: ; /* fallthrough */ } @@ -504,25 +498,6 @@ _mesa_format_to_type_and_comps(gl_format format, return; #endif - case MESA_FORMAT_RGBA: - *datatype = CHAN_TYPE; - *comps = 4; - return; - case MESA_FORMAT_RGB: - *datatype = CHAN_TYPE; - *comps = 3; - return; - case MESA_FORMAT_LUMINANCE_ALPHA: - *datatype = CHAN_TYPE; - *comps = 2; - return; - case MESA_FORMAT_ALPHA: - case MESA_FORMAT_LUMINANCE: - case MESA_FORMAT_INTENSITY: - *datatype = CHAN_TYPE; - *comps = 1; - return; - case MESA_FORMAT_RGBA_FLOAT32: *datatype = GL_FLOAT; *comps = 4; diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index cb8386bbc8..939c4d0776 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -70,152 +70,6 @@ #endif -/* MESA_FORMAT_RGBA **********************************************************/ - -/* 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 ) -{ - const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 4); - texel[RCOMP] = CHAN_TO_FLOAT(src[0]); - texel[GCOMP] = CHAN_TO_FLOAT(src[1]); - texel[BCOMP] = CHAN_TO_FLOAT(src[2]); - texel[ACOMP] = CHAN_TO_FLOAT(src[3]); -} - -#if DIM == 3 -/* Store a GLchan RGBA texel */ -static void store_texel_rgba(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLchan *rgba = (const GLchan *) texel; - GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 4); - dst[0] = rgba[RCOMP]; - dst[1] = rgba[GCOMP]; - dst[2] = rgba[BCOMP]; - dst[3] = rgba[ACOMP]; -} -#endif - -/* MESA_FORMAT_RGB ***********************************************************/ - -/* 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 ) -{ - const GLchan *src = TEXEL_ADDR(GLchan, texImage, i, j, k, 3); - texel[RCOMP] = CHAN_TO_FLOAT(src[0]); - texel[GCOMP] = CHAN_TO_FLOAT(src[1]); - texel[BCOMP] = CHAN_TO_FLOAT(src[2]); - texel[ACOMP] = 1.0F; -} - -#if DIM == 3 -static void store_texel_rgb(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLchan *rgba = (const GLchan *) texel; - GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 3); - dst[0] = rgba[RCOMP]; - dst[1] = rgba[GCOMP]; - dst[2] = rgba[BCOMP]; -} -#endif - -/* MESA_FORMAT_ALPHA *********************************************************/ - -/* Fetch texel from 1D, 2D or 3D ALPHA texture, returning 4 GLchans */ -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.0F; - texel[ACOMP] = CHAN_TO_FLOAT(src[0]); -} - -#if DIM == 3 -static void store_texel_alpha(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLchan *rgba = (const GLchan *) texel; - GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 1); - dst[0] = rgba[ACOMP]; -} -#endif - -/* MESA_FORMAT_LUMINANCE *****************************************************/ - -/* Fetch texel from 1D, 2D or 3D LUMIN texture, returning 4 GLchans */ -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] = CHAN_TO_FLOAT(src[0]); - texel[ACOMP] = 1.0F; -} - -#if DIM == 3 -static void store_texel_luminance(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLchan *rgba = (const GLchan *) texel; - GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 1); - dst[0] = rgba[RCOMP]; -} -#endif - -/* MESA_FORMAT_LUMINANCE_ALPHA ***********************************************/ - -/* Fetch texel from 1D, 2D or 3D L_A texture, returning 4 GLchans */ -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] = - texel[GCOMP] = - texel[BCOMP] = CHAN_TO_FLOAT(src[0]); - texel[ACOMP] = CHAN_TO_FLOAT(src[1]); -} - -#if DIM == 3 -static void store_texel_luminance_alpha(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLchan *rgba = (const GLchan *) texel; - GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 2); - dst[0] = rgba[RCOMP]; - dst[1] = rgba[ACOMP]; -} -#endif - -/* MESA_FORMAT_INTENSITY *****************************************************/ - -/* Fetch texel from 1D, 2D or 3D INT. texture, returning 4 GLchans */ -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] = - texel[GCOMP] = - texel[BCOMP] = - texel[ACOMP] = CHAN_TO_FLOAT(src[0]); -} - -#if DIM == 3 -static void store_texel_intensity(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLchan *rgba = (const GLchan *) texel; - GLchan *dst = TEXEL_ADDR(GLchan, texImage, i, j, k, 1); - dst[0] = rgba[RCOMP]; -} -#endif - - /* MESA_FORMAT_Z32 ***********************************************************/ /* Fetch depth texel from 1D, 2D or 3D 32-bit depth texture, diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index d5bc16dee4..56d6c63906 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1004,164 +1004,6 @@ memcpy_texture(GLcontext *ctx, -/** - * Store an image in any of the formats: - * _mesa_texformat_rgba - * _mesa_texformat_rgb - * _mesa_texformat_alpha - * _mesa_texformat_luminance - * _mesa_texformat_luminance_alpha - * _mesa_texformat_intensity - * - */ -static GLboolean -_mesa_texstore_rgba(TEXSTORE_PARAMS) -{ - const GLint components = _mesa_components_in_format(baseInternalFormat); - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - - ASSERT(dstFormat == MESA_FORMAT_RGBA || - dstFormat == MESA_FORMAT_RGB || - dstFormat == MESA_FORMAT_ALPHA || - dstFormat == MESA_FORMAT_LUMINANCE || - dstFormat == MESA_FORMAT_LUMINANCE_ALPHA || - dstFormat == MESA_FORMAT_INTENSITY); - ASSERT(baseInternalFormat == GL_RGBA || - baseInternalFormat == GL_RGB || - baseInternalFormat == GL_ALPHA || - baseInternalFormat == GL_LUMINANCE || - baseInternalFormat == GL_LUMINANCE_ALPHA || - baseInternalFormat == GL_INTENSITY); - ASSERT(texelBytes == components * sizeof(GLchan)); - - if (!ctx->_ImageTransferState && - !srcPacking->SwapBytes && - baseInternalFormat == srcFormat && - srcType == CHAN_TYPE) { - /* 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 && - !srcPacking->SwapBytes && - dstFormat == MESA_FORMAT_RGB && - srcFormat == GL_RGBA && - srcType == CHAN_TYPE) { - /* extract RGB from RGBA */ - GLint img, row, col; - for (img = 0; img < srcDepth; img++) { - GLchan *dstImage = (GLchan *) - ((GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes - + dstYoffset * dstRowStride - + dstXoffset * texelBytes); - - const GLint srcRowStride = _mesa_image_row_stride(srcPacking, - srcWidth, srcFormat, srcType); - GLchan *srcRow = (GLchan *) _mesa_image_address(dims, srcPacking, - srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); - GLchan *dstRow = dstImage; - for (row = 0; row < srcHeight; row++) { - for (col = 0; col < srcWidth; col++) { - dstRow[col * 3 + RCOMP] = srcRow[col * 4 + RCOMP]; - dstRow[col * 3 + GCOMP] = srcRow[col * 4 + GCOMP]; - dstRow[col * 3 + BCOMP] = srcRow[col * 4 + BCOMP]; - } - dstRow += dstRowStride / sizeof(GLchan); - srcRow = (GLchan *) ((GLubyte *) srcRow + srcRowStride); - } - } - } - else if (!ctx->_ImageTransferState && - CHAN_TYPE == GL_UNSIGNED_BYTE && - (srcType == GL_UNSIGNED_BYTE || - srcType == GL_UNSIGNED_INT_8_8_8_8 || - srcType == GL_UNSIGNED_INT_8_8_8_8_REV) && - can_swizzle(baseInternalFormat) && - can_swizzle(srcFormat)) { - - const GLubyte *dstmap; - GLuint components; - - /* dstmap - how to swizzle from RGBA to dst format: - */ - if (dstFormat == MESA_FORMAT_RGBA) { - dstmap = mappings[IDX_RGBA].from_rgba; - components = 4; - } - else if (dstFormat == MESA_FORMAT_RGB) { - dstmap = mappings[IDX_RGB].from_rgba; - components = 3; - } - else if (dstFormat == MESA_FORMAT_ALPHA) { - dstmap = mappings[IDX_ALPHA].from_rgba; - components = 1; - } - else if (dstFormat == MESA_FORMAT_LUMINANCE) { - dstmap = mappings[IDX_LUMINANCE].from_rgba; - components = 1; - } - else if (dstFormat == MESA_FORMAT_LUMINANCE_ALPHA) { - dstmap = mappings[IDX_LUMINANCE_ALPHA].from_rgba; - components = 2; - } - else if (dstFormat == MESA_FORMAT_INTENSITY) { - dstmap = mappings[IDX_INTENSITY].from_rgba; - components = 1; - } - else { - _mesa_problem(ctx, "Unexpected dstFormat in _mesa_texstore_rgba"); - return GL_FALSE; - } - - _mesa_swizzle_ubyte_image(ctx, dims, - srcFormat, - srcType, - baseInternalFormat, - dstmap, components, - dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, dstImageOffsets, - srcWidth, srcHeight, srcDepth, srcAddr, - srcPacking); - } - else { - /* general path */ - const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, - baseInternalFormat, - baseFormat, - srcWidth, srcHeight, srcDepth, - srcFormat, srcType, srcAddr, - srcPacking); - const GLchan *src = tempImage; - GLint bytesPerRow; - GLint img, row; - if (!tempImage) - return GL_FALSE; - _mesa_adjust_image_for_convolution(ctx, dims, &srcWidth, &srcHeight); - bytesPerRow = srcWidth * components * sizeof(GLchan); - for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = (GLubyte *) dstAddr - + dstImageOffsets[dstZoffset + img] * texelBytes - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; - for (row = 0; row < srcHeight; row++) { - _mesa_memcpy(dstRow, src, bytesPerRow); - dstRow += dstRowStride; - src += srcWidth * components; - } - } - - _mesa_free((void *) tempImage); - } - return GL_TRUE; -} - - /** * Store a 32-bit integer depth component texture image. */ @@ -3230,12 +3072,6 @@ texstore_funcs[MESA_FORMAT_COUNT] = { MESA_FORMAT_RGBA_DXT1, _mesa_texstore_rgba_dxt1 }, { MESA_FORMAT_RGBA_DXT3, _mesa_texstore_rgba_dxt3 }, { MESA_FORMAT_RGBA_DXT5, _mesa_texstore_rgba_dxt5 }, - { MESA_FORMAT_RGBA, _mesa_texstore_rgba }, - { MESA_FORMAT_RGB, _mesa_texstore_rgba }, - { MESA_FORMAT_ALPHA, _mesa_texstore_rgba }, - { MESA_FORMAT_LUMINANCE, _mesa_texstore_rgba }, - { MESA_FORMAT_LUMINANCE_ALPHA, _mesa_texstore_rgba }, - { MESA_FORMAT_INTENSITY, _mesa_texstore_rgba }, { MESA_FORMAT_RGBA_FLOAT32, _mesa_texstore_rgba_float32 }, { MESA_FORMAT_RGBA_FLOAT16, _mesa_texstore_rgba_float16 }, { MESA_FORMAT_RGB_FLOAT32, _mesa_texstore_rgba_float32 }, diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 11c8f9256a..6cba8ed34b 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -1343,17 +1343,17 @@ opt_sample_rgb_2d(GLcontext *ctx, ASSERT(tObj->WrapS==GL_REPEAT); ASSERT(tObj->WrapT==GL_REPEAT); ASSERT(img->Border==0); - ASSERT(img->TexFormat == MESA_FORMAT_RGB); + ASSERT(img->TexFormat == MESA_FORMAT_RGB888); ASSERT(img->_IsPowerOfTwo); for (k=0; kData) + 3*pos; - rgba[k][RCOMP] = CHAN_TO_FLOAT(texel[0]); - rgba[k][GCOMP] = CHAN_TO_FLOAT(texel[1]); - rgba[k][BCOMP] = CHAN_TO_FLOAT(texel[2]); + GLubyte *texel = ((GLubyte *) img->Data) + 3*pos; + rgba[k][RCOMP] = UBYTE_TO_FLOAT(texel[0]); + rgba[k][GCOMP] = UBYTE_TO_FLOAT(texel[1]); + rgba[k][BCOMP] = UBYTE_TO_FLOAT(texel[2]); } } @@ -1384,18 +1384,18 @@ opt_sample_rgba_2d(GLcontext *ctx, ASSERT(tObj->WrapS==GL_REPEAT); ASSERT(tObj->WrapT==GL_REPEAT); ASSERT(img->Border==0); - ASSERT(img->TexFormat == MESA_FORMAT_RGBA); + ASSERT(img->TexFormat == MESA_FORMAT_RGBA8888); ASSERT(img->_IsPowerOfTwo); for (i = 0; i < n; i++) { const GLint col = IFLOOR(texcoords[i][0] * width) & colMask; const GLint row = IFLOOR(texcoords[i][1] * height) & rowMask; const GLint pos = (row << shift) | col; - const GLchan *texel = ((GLchan *) img->Data) + (pos << 2); /* pos*4 */ - rgba[i][RCOMP] = CHAN_TO_FLOAT(texel[0]); - rgba[i][GCOMP] = CHAN_TO_FLOAT(texel[1]); - rgba[i][BCOMP] = CHAN_TO_FLOAT(texel[2]); - rgba[i][ACOMP] = CHAN_TO_FLOAT(texel[3]); + const GLubyte *texel = ((GLubyte *) img->Data) + (pos << 2); /* pos*4 */ + rgba[i][RCOMP] = UBYTE_TO_FLOAT(texel[0]); + rgba[i][GCOMP] = UBYTE_TO_FLOAT(texel[1]); + rgba[i][BCOMP] = UBYTE_TO_FLOAT(texel[2]); + rgba[i][ACOMP] = UBYTE_TO_FLOAT(texel[3]); } } @@ -1428,11 +1428,11 @@ sample_lambda_2d(GLcontext *ctx, case GL_NEAREST: if (repeatNoBorderPOT) { switch (tImg->TexFormat) { - case MESA_FORMAT_RGB: + case MESA_FORMAT_RGB888: opt_sample_rgb_2d(ctx, tObj, m, texcoords + minStart, NULL, rgba + minStart); break; - case MESA_FORMAT_RGBA: + case MESA_FORMAT_RGBA8888: opt_sample_rgba_2d(ctx, tObj, m, texcoords + minStart, NULL, rgba + minStart); break; @@ -1485,11 +1485,11 @@ sample_lambda_2d(GLcontext *ctx, case GL_NEAREST: if (repeatNoBorderPOT) { switch (tImg->TexFormat) { - case MESA_FORMAT_RGB: + case MESA_FORMAT_RGB888: opt_sample_rgb_2d(ctx, tObj, m, texcoords + magStart, NULL, rgba + magStart); break; - case MESA_FORMAT_RGBA: + case MESA_FORMAT_RGBA8888: opt_sample_rgba_2d(ctx, tObj, m, texcoords + magStart, NULL, rgba + magStart); break; @@ -3137,7 +3137,7 @@ null_sample_func( GLcontext *ctx, rgba[i][RCOMP] = 0; rgba[i][GCOMP] = 0; rgba[i][BCOMP] = 0; - rgba[i][ACOMP] = CHAN_MAX; + rgba[i][ACOMP] = 1.0; } } @@ -3189,14 +3189,14 @@ _swrast_choose_texture_sample_func( GLcontext *ctx, t->WrapT == GL_REPEAT && img->_IsPowerOfTwo && img->Border == 0 && - img->TexFormat == MESA_FORMAT_RGB) { + img->TexFormat == MESA_FORMAT_RGB888) { return &opt_sample_rgb_2d; } else if (t->WrapS == GL_REPEAT && t->WrapT == GL_REPEAT && img->_IsPowerOfTwo && img->Border == 0 && - img->TexFormat == MESA_FORMAT_RGBA) { + img->TexFormat == MESA_FORMAT_RGBA8888) { return &opt_sample_rgba_2d; } else { diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 7b59763f11..6a61bec245 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -140,7 +140,7 @@ _swrast_culltriangle( GLcontext *ctx, const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ const GLint twidth_log2 = obj->Image[0][b]->WidthLog2; \ - const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data; \ + const GLubyte *texture = (const GLubyte *) obj->Image[0][b]->Data; \ const GLint smask = obj->Image[0][b]->Width - 1; \ const GLint tmask = obj->Image[0][b]->Height - 1; \ if (!rb || !texture) { \ @@ -149,7 +149,7 @@ _swrast_culltriangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ - GLchan rgb[MAX_WIDTH][3]; \ + GLubyte rgb[MAX_WIDTH][3]; \ span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \ span.intTex[1] -= FIXED_HALF; \ for (i = 0; i < span.end; i++) { \ @@ -192,7 +192,7 @@ _swrast_culltriangle( GLcontext *ctx, const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ const GLint twidth_log2 = obj->Image[0][b]->WidthLog2; \ - const GLchan *texture = (const GLchan *) obj->Image[0][b]->Data; \ + const GLubyte *texture = (const GLubyte *) obj->Image[0][b]->Data; \ const GLint smask = obj->Image[0][b]->Width - 1; \ const GLint tmask = obj->Image[0][b]->Height - 1; \ if (!rb || !texture) { \ @@ -201,7 +201,7 @@ _swrast_culltriangle( GLcontext *ctx, #define RENDER_SPAN( span ) \ GLuint i; \ - GLchan rgb[MAX_WIDTH][3]; \ + GLubyte rgb[MAX_WIDTH][3]; \ span.intTex[0] -= FIXED_HALF; /* off-by-one error? */ \ span.intTex[1] -= FIXED_HALF; \ for (i = 0; i < span.end; i++) { \ @@ -1075,7 +1075,7 @@ _swrast_choose_triangle( GLcontext *ctx ) && texImg->_IsPowerOfTwo && texImg->Border == 0 && texImg->Width == texImg->RowStride - && (format == MESA_FORMAT_RGB || format == MESA_FORMAT_RGBA) + && (format == MESA_FORMAT_RGB888 || format == MESA_FORMAT_RGBA8888) && minFilter == magFilter && ctx->Light.Model.ColorControl == GL_SINGLE_COLOR && !swrast->_FogEnabled @@ -1083,7 +1083,7 @@ _swrast_choose_triangle( GLcontext *ctx ) && ctx->Texture.Unit[0].EnvMode != GL_COMBINE4_NV) { if (ctx->Hint.PerspectiveCorrection==GL_FASTEST) { if (minFilter == GL_NEAREST - && format == MESA_FORMAT_RGB + && format == MESA_FORMAT_RGB888 && (envMode == GL_REPLACE || envMode == GL_DECAL) && ((swrast->_RasterMask == (DEPTH_BIT | TEXTURE_BIT) && ctx->Depth.Func == GL_LESS -- cgit v1.2.3 From 60843e3ee59b00cee4ec1048823d1dd24756d849 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 30 Sep 2009 21:04:14 -0600 Subject: mesa: remove MESA_FORMAT_RGBA4444 Not used by any hardware driver. ARGB4444 and ARGB4444_REV remain. --- src/mesa/main/formats.c | 8 ------ src/mesa/main/formats.h | 1 - src/mesa/main/texfetch.c | 7 ------ src/mesa/main/texformat_tmp.h | 24 ------------------ src/mesa/main/texstore.c | 58 ------------------------------------------- 5 files changed, 98 deletions(-) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index f915b1da91..dec3daee7c 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -109,14 +109,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 2 /* BlockWidth/Height,Bytes */ }, - { - MESA_FORMAT_RGBA4444, /* Name */ - GL_RGBA, /* BaseFormat */ - GL_UNSIGNED_NORMALIZED, /* DataType */ - 4, 4, 4, 4, /* Red/Green/Blue/AlphaBits */ - 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ - 1, 1, 2 /* BlockWidth/Height,Bytes */ - }, { MESA_FORMAT_ARGB4444, /* Name */ GL_RGBA, /* BaseFormat */ diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 9235828a0f..99a6534ff1 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -58,7 +58,6 @@ typedef enum MESA_FORMAT_BGR888, /* BBBB BBBB GGGG GGGG RRRR RRRR */ MESA_FORMAT_RGB565, /* RRRR RGGG GGGB BBBB */ MESA_FORMAT_RGB565_REV, /* GGGB BBBB RRRR RGGG */ - MESA_FORMAT_RGBA4444, /* RRRR GGGG BBBB AAAA */ MESA_FORMAT_ARGB4444, /* AAAA RRRR GGGG BBBB */ MESA_FORMAT_ARGB4444_REV, /* GGGG BBBB AAAA RRRR */ MESA_FORMAT_RGBA5551, /* RRRR RGGG GGBB BBBA */ diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c index 8149166560..3cc424fdc8 100644 --- a/src/mesa/main/texfetch.c +++ b/src/mesa/main/texfetch.c @@ -393,13 +393,6 @@ texfetch_funcs[MESA_FORMAT_COUNT] = fetch_texel_3d_f_rgb565_rev, store_texel_rgb565_rev }, - { - MESA_FORMAT_RGBA4444, - fetch_texel_1d_f_rgba4444, - fetch_texel_2d_f_rgba4444, - fetch_texel_3d_f_rgba4444, - store_texel_rgba4444 - }, { MESA_FORMAT_ARGB4444, fetch_texel_1d_f_argb4444, diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h index 939c4d0776..199849d6ac 100644 --- a/src/mesa/main/texformat_tmp.h +++ b/src/mesa/main/texformat_tmp.h @@ -641,30 +641,6 @@ static void store_texel_rgb565_rev(struct gl_texture_image *texImage, } #endif -/* MESA_FORMAT_RGBA4444 ******************************************************/ - -/* Fetch texel from 1D, 2D or 3D argb444 texture, return 4 GLchans */ -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] = ((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 -static void store_texel_rgba4444(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLubyte *rgba = (const GLubyte *) texel; - GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); - *dst = PACK_COLOR_4444(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]); -} -#endif - /* MESA_FORMAT_ARGB4444 ******************************************************/ diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 56d6c63906..48bee88e0f 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1766,63 +1766,6 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) return GL_TRUE; } -static GLboolean -_mesa_texstore_rgba4444(TEXSTORE_PARAMS) -{ - const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - - ASSERT(dstFormat == MESA_FORMAT_RGBA4444); - ASSERT(texelBytes == 2); - - if (!ctx->_ImageTransferState && - !srcPacking->SwapBytes && - dstFormat == MESA_FORMAT_RGBA4444 && - baseInternalFormat == GL_RGBA && - srcFormat == GL_RGBA && - srcType == GL_UNSIGNED_SHORT_4_4_4_4){ - /* simple memcpy path */ - memcpy_texture(ctx, dims, - dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, - dstRowStride, - dstImageOffsets, - srcWidth, srcHeight, srcDepth, srcFormat, srcType, - srcAddr, srcPacking); - } - else { - /* general path */ - const GLchan *tempImage = _mesa_make_temp_chan_image(ctx, dims, - baseInternalFormat, - baseFormat, - srcWidth, srcHeight, srcDepth, - srcFormat, srcType, srcAddr, - srcPacking); - const GLchan *src = 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] * texelBytes - + dstYoffset * dstRowStride - + dstXoffset * texelBytes; - for (row = 0; row < srcHeight; row++) { - GLushort *dstUS = (GLushort *) dstRow; - for (col = 0; col < srcWidth; col++) { - dstUS[col] = PACK_COLOR_4444( CHAN_TO_UBYTE(src[RCOMP]), - CHAN_TO_UBYTE(src[GCOMP]), - CHAN_TO_UBYTE(src[BCOMP]), - CHAN_TO_UBYTE(src[ACOMP]) ); - src += 4; - } - dstRow += dstRowStride; - } - } - _mesa_free((void *) tempImage); - } - return GL_TRUE; -} static GLboolean _mesa_texstore_argb4444(TEXSTORE_PARAMS) @@ -3037,7 +2980,6 @@ texstore_funcs[MESA_FORMAT_COUNT] = { MESA_FORMAT_BGR888, _mesa_texstore_bgr888 }, { MESA_FORMAT_RGB565, _mesa_texstore_rgb565 }, { MESA_FORMAT_RGB565_REV, _mesa_texstore_rgb565 }, - { MESA_FORMAT_RGBA4444, _mesa_texstore_rgba4444 }, { MESA_FORMAT_ARGB4444, _mesa_texstore_argb4444 }, { MESA_FORMAT_ARGB4444_REV, _mesa_texstore_argb4444 }, { MESA_FORMAT_RGBA5551, _mesa_texstore_rgba5551 }, -- cgit v1.2.3 From 3d6a20e5b6c7567ed64fceed7744cf39eea34400 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 30 Sep 2009 21:08:06 -0600 Subject: mesa: rename texformat_tmp.h to texfetch_tmp.h --- src/mesa/main/texfetch.c | 6 +- src/mesa/main/texfetch_tmp.h | 1302 ++++++++++++++++++++++++++++++++++++++++ src/mesa/main/texformat_tmp.h | 1304 ----------------------------------------- 3 files changed, 1305 insertions(+), 1307 deletions(-) create mode 100644 src/mesa/main/texfetch_tmp.h delete mode 100644 src/mesa/main/texformat_tmp.h (limited to 'src') diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c index 3cc424fdc8..62a8b53409 100644 --- a/src/mesa/main/texfetch.c +++ b/src/mesa/main/texfetch.c @@ -77,13 +77,13 @@ nonlinear_to_linear(GLubyte cs8) /* Texel fetch routines for all supported formats */ #define DIM 1 -#include "texformat_tmp.h" +#include "texfetch_tmp.h" #define DIM 2 -#include "texformat_tmp.h" +#include "texfetch_tmp.h" #define DIM 3 -#include "texformat_tmp.h" +#include "texfetch_tmp.h" /** * Null texel fetch function. diff --git a/src/mesa/main/texfetch_tmp.h b/src/mesa/main/texfetch_tmp.h new file mode 100644 index 0000000000..3ac932b979 --- /dev/null +++ b/src/mesa/main/texfetch_tmp.h @@ -0,0 +1,1302 @@ +/* + * Mesa 3-D graphics library + * Version: 7.7 + * + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * 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"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * \file texfetch_tmp.h + * Texel fetch functions template. + * + * This template file is used by texfetch.c to generate texel fetch functions + * for 1-D, 2-D and 3-D texture images. + * + * It should be expanded by defining \p DIM as the number texture dimensions + * (1, 2 or 3). According to the value of \p DIM a series of macros is defined + * for the texel lookup in the gl_texture_image::Data. + * + * \author Gareth Hughes + * \author Brian Paul + */ + + +#if DIM == 1 + +#define TEXEL_ADDR( type, image, i, j, k, size ) \ + ((void) (j), (void) (k), ((type *)(image)->Data + (i) * (size))) + +#define FETCH(x) fetch_texel_1d_##x + +#elif DIM == 2 + +#define TEXEL_ADDR( type, image, i, j, k, size ) \ + ((void) (k), \ + ((type *)(image)->Data + ((image)->RowStride * (j) + (i)) * (size))) + +#define FETCH(x) fetch_texel_2d_##x + +#elif DIM == 3 + +#define TEXEL_ADDR( type, image, i, j, k, size ) \ + ((type *)(image)->Data + ((image)->ImageOffsets[k] \ + + (image)->RowStride * (j) + (i)) * (size)) + +#define FETCH(x) fetch_texel_3d_##x + +#else +#error illegal number of texture dimensions +#endif + + +/* MESA_FORMAT_Z32 ***********************************************************/ + +/* Fetch depth texel from 1D, 2D or 3D 32-bit depth texture, + * returning 1 GLfloat. + * Note: no GLchan version of this function. + */ +static void FETCH(f_z32)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + texel[0] = src[0] * (1.0F / 0xffffffff); +} + +#if DIM == 3 +static void store_texel_z32(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLuint *depth = (const GLuint *) texel; + GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + dst[0] = *depth; +} +#endif + + +/* MESA_FORMAT_Z16 ***********************************************************/ + +/* Fetch depth texel from 1D, 2D or 3D 16-bit depth texture, + * returning 1 GLfloat. + * Note: no GLchan version of this function. + */ +static void FETCH(f_z16)(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); + texel[0] = src[0] * (1.0F / 65535.0F); +} + +#if DIM == 3 +static void store_texel_z16(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLushort *depth = (const GLushort *) texel; + GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + dst[0] = *depth; +} +#endif + + +/* MESA_FORMAT_RGBA_F32 ******************************************************/ + +/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT32 texture, returning 4 GLfloats. + */ +static void FETCH(f_rgba_f32)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 4); + texel[RCOMP] = src[0]; + texel[GCOMP] = src[1]; + texel[BCOMP] = src[2]; + texel[ACOMP] = src[3]; +} + +#if DIM == 3 +static void store_texel_rgba_f32(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLfloat *depth = (const GLfloat *) texel; + GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); + dst[0] = depth[RCOMP]; + dst[1] = depth[GCOMP]; + dst[2] = depth[BCOMP]; + dst[3] = depth[ACOMP]; +} +#endif + + +/* MESA_FORMAT_RGBA_F16 ******************************************************/ + +/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture, + * returning 4 GLfloats. + */ +static void FETCH(f_rgba_f16)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 4); + texel[RCOMP] = _mesa_half_to_float(src[0]); + texel[GCOMP] = _mesa_half_to_float(src[1]); + texel[BCOMP] = _mesa_half_to_float(src[2]); + texel[ACOMP] = _mesa_half_to_float(src[3]); +} + +#if DIM == 3 +static void store_texel_rgba_f16(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLfloat *depth = (const GLfloat *) texel; + GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); + dst[0] = _mesa_float_to_half(*depth); +} +#endif + +/* MESA_FORMAT_RGB_F32 *******************************************************/ + +/* Fetch texel from 1D, 2D or 3D RGB_FLOAT32 texture, + * returning 4 GLfloats. + */ +static void FETCH(f_rgb_f32)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 3); + texel[RCOMP] = src[0]; + texel[GCOMP] = src[1]; + texel[BCOMP] = src[2]; + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void store_texel_rgb_f32(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLfloat *depth = (const GLfloat *) texel; + GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); + dst[0] = *depth; +} +#endif + + +/* MESA_FORMAT_RGB_F16 *******************************************************/ + +/* Fetch texel from 1D, 2D or 3D RGB_FLOAT16 texture, + * returning 4 GLfloats. + */ +static void FETCH(f_rgb_f16)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 3); + texel[RCOMP] = _mesa_half_to_float(src[0]); + texel[GCOMP] = _mesa_half_to_float(src[1]); + texel[BCOMP] = _mesa_half_to_float(src[2]); + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void store_texel_rgb_f16(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLfloat *depth = (const GLfloat *) texel; + GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); + dst[0] = _mesa_float_to_half(*depth); +} +#endif + + +/* MESA_FORMAT_ALPHA_F32 *****************************************************/ + +/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT32 texture, + * returning 4 GLfloats. + */ +static void FETCH(f_alpha_f32)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = 0.0F; + texel[ACOMP] = src[0]; +} + +#if DIM == 3 +static void store_texel_alpha_f32(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLfloat *rgba = (const GLfloat *) texel; + GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); + dst[0] = rgba[ACOMP]; +} +#endif + + +/* MESA_FORMAT_ALPHA_F32 *****************************************************/ + +/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT16 texture, + * returning 4 GLfloats. + */ +static void FETCH(f_alpha_f16)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = 0.0F; + texel[ACOMP] = _mesa_half_to_float(src[0]); +} + +#if DIM == 3 +static void store_texel_alpha_f16(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLfloat *rgba = (const GLfloat *) texel; + GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); + dst[0] = _mesa_float_to_half(rgba[ACOMP]); +} +#endif + + +/* MESA_FORMAT_LUMINANCE_F32 *************************************************/ + +/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture, + * returning 4 GLfloats. + */ +static void FETCH(f_luminance_f32)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = src[0]; + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void store_texel_luminance_f32(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLfloat *rgba = (const GLfloat *) texel; + GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); + dst[0] = rgba[RCOMP]; +} +#endif + + +/* MESA_FORMAT_LUMINANCE_F16 *************************************************/ + +/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture, + * returning 4 GLfloats. + */ +static void FETCH(f_luminance_f16)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = _mesa_half_to_float(src[0]); + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void store_texel_luminance_f16(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLfloat *rgba = (const GLfloat *) texel; + GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); + dst[0] = _mesa_float_to_half(rgba[RCOMP]); +} +#endif + + +/* MESA_FORMAT_LUMINANCE_ALPHA_F32 *******************************************/ + +/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture, + * returning 4 GLfloats. + */ +static void FETCH(f_luminance_alpha_f32)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = src[0]; + texel[ACOMP] = src[1]; +} + +#if DIM == 3 +static void store_texel_luminance_alpha_f32(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLfloat *rgba = (const GLfloat *) texel; + GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2); + dst[0] = rgba[RCOMP]; + dst[1] = rgba[ACOMP]; +} +#endif + + +/* MESA_FORMAT_LUMINANCE_ALPHA_F16 *******************************************/ + +/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT16 texture, + * returning 4 GLfloats. + */ +static void FETCH(f_luminance_alpha_f16)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = _mesa_half_to_float(src[0]); + texel[ACOMP] = _mesa_half_to_float(src[1]); +} + +#if DIM == 3 +static void store_texel_luminance_alpha_f16(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLfloat *rgba = (const GLfloat *) texel; + GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2); + dst[0] = _mesa_float_to_half(rgba[RCOMP]); + dst[1] = _mesa_float_to_half(rgba[ACOMP]); +} +#endif + + +/* MESA_FORMAT_INTENSITY_F32 *************************************************/ + +/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT32 texture, + * returning 4 GLfloats. + */ +static void FETCH(f_intensity_f32)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = + texel[ACOMP] = src[0]; +} + +#if DIM == 3 +static void store_texel_intensity_f32(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLfloat *rgba = (const GLfloat *) texel; + GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); + dst[0] = rgba[RCOMP]; +} +#endif + + +/* MESA_FORMAT_INTENSITY_F16 *************************************************/ + +/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT16 texture, + * returning 4 GLfloats. + */ +static void FETCH(f_intensity_f16)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = + texel[ACOMP] = _mesa_half_to_float(src[0]); +} + +#if DIM == 3 +static void store_texel_intensity_f16(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLfloat *rgba = (const GLfloat *) texel; + GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); + dst[0] = _mesa_float_to_half(rgba[RCOMP]); +} +#endif + + + + +/* + * Begin Hardware formats + */ + +/* MESA_FORMAT_RGBA8888 ******************************************************/ + +/* 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_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) +{ + const GLubyte *rgba = (const GLubyte *) 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_RGBA888_REV ***************************************************/ + +/* Fetch texel from 1D, 2D or 3D abgr8888 texture, return 4 GLchans */ +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_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 +static void store_texel_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_ARGB8888 ******************************************************/ + +/* Fetch texel from 1D, 2D or 3D argb8888 texture, return 4 GLchans */ +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_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 +static void store_texel_argb8888(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(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); +} +#endif + + +/* MESA_FORMAT_ARGB8888_REV **************************************************/ + +/* 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_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 +static void store_texel_argb8888_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(rgba[BCOMP], rgba[GCOMP], rgba[RCOMP], rgba[ACOMP]); +} +#endif + + +/* MESA_FORMAT_RGB888 ********************************************************/ + +/* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */ +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_FLOAT( src[2] ); + texel[GCOMP] = UBYTE_TO_FLOAT( src[1] ); + texel[BCOMP] = UBYTE_TO_FLOAT( src[0] ); + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void store_texel_rgb888(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3); + dst[0] = rgba[BCOMP]; + dst[1] = rgba[GCOMP]; + dst[2] = rgba[RCOMP]; +} +#endif + + +/* MESA_FORMAT_BGR888 ********************************************************/ + +/* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLchans */ +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_FLOAT( src[0] ); + texel[GCOMP] = UBYTE_TO_FLOAT( src[1] ); + texel[BCOMP] = UBYTE_TO_FLOAT( src[2] ); + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void store_texel_bgr888(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3); + dst[0] = rgba[RCOMP]; + dst[1] = rgba[GCOMP]; + dst[2] = rgba[BCOMP]; +} +#endif + + +/* use color expansion like (g << 2) | (g >> 4) (does somewhat random rounding) + instead of slow (g << 2) * 255 / 252 (always rounds down) */ + +/* MESA_FORMAT_RGB565 ********************************************************/ + +/* Fetch texel from 1D, 2D or 3D rgb565 texture, return 4 GLchans */ +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] = ((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 +static void store_texel_rgb565(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + *dst = PACK_COLOR_565(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); +} +#endif + + +/* MESA_FORMAT_RGB565_REV ****************************************************/ + +/* Fetch texel from 1D, 2D or 3D rgb565_rev texture, return 4 GLchans */ +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_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 +static void store_texel_rgb565_rev(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + *dst = PACK_COLOR_565(rgba[BCOMP], rgba[GCOMP], rgba[RCOMP]); +} +#endif + + +/* MESA_FORMAT_ARGB4444 ******************************************************/ + +/* Fetch texel from 1D, 2D or 3D argb444 texture, return 4 GLchans */ +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] = ((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 +static void store_texel_argb4444(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + *dst = PACK_COLOR_4444(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); +} +#endif + + +/* MESA_FORMAT_ARGB4444_REV **************************************************/ + +/* Fetch texel from 1D, 2D or 3D argb4444_rev texture, return 4 GLchans */ +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] = ((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 +static void store_texel_argb4444_rev(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + *dst = PACK_COLOR_4444(rgba[ACOMP], rgba[BCOMP], rgba[GCOMP], rgba[RCOMP]); +} +#endif + +/* MESA_FORMAT_RGBA5551 ******************************************************/ + +/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */ +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] = ((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 +static void store_texel_rgba5551(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + *dst = PACK_COLOR_5551(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]); +} +#endif + +/* MESA_FORMAT_ARGB1555 ******************************************************/ + +/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */ +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] = ((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 +static void store_texel_argb1555(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + *dst = PACK_COLOR_1555(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); +} +#endif + + +/* MESA_FORMAT_ARGB1555_REV **************************************************/ + +/* Fetch texel from 1D, 2D or 3D argb1555_rev texture, return 4 GLchans */ +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_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 +static void store_texel_argb1555_rev(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + *dst = PACK_COLOR_1555_REV(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); +} +#endif + + +/* MESA_FORMAT_AL88 **********************************************************/ + +/* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLchans */ +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_FLOAT( s & 0xff ); + texel[ACOMP] = UBYTE_TO_FLOAT( s >> 8 ); +} + +#if DIM == 3 +static void store_texel_al88(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + *dst = PACK_COLOR_88(rgba[ACOMP], rgba[RCOMP]); +} +#endif + + +/* MESA_FORMAT_AL88_REV ******************************************************/ + +/* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLchans */ +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_FLOAT( s >> 8 ); + texel[ACOMP] = UBYTE_TO_FLOAT( s & 0xff ); +} + +#if DIM == 3 +static void store_texel_al88_rev(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + *dst = PACK_COLOR_88(rgba[RCOMP], rgba[ACOMP]); +} +#endif + + +/* MESA_FORMAT_RGB332 ********************************************************/ + +/* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLchans */ +static void FETCH(f_rgb332)( 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 GLubyte s = *src; + 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 +static void store_texel_rgb332(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); + *dst = PACK_COLOR_332(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); +} +#endif + + +/* MESA_FORMAT_A8 ************************************************************/ + +/* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */ +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.0F; + texel[ACOMP] = UBYTE_TO_FLOAT( src[0] ); +} + +#if DIM == 3 +static void store_texel_a8(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); + *dst = rgba[ACOMP]; +} +#endif + + +/* MESA_FORMAT_L8 ************************************************************/ + +/* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLchans */ +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_FLOAT( src[0] ); + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void store_texel_l8(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); + *dst = rgba[RCOMP]; +} +#endif + + +/* MESA_FORMAT_I8 ************************************************************/ + +/* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLchans */ +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_FLOAT( src[0] ); +} + +#if DIM == 3 +static void store_texel_i8(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); + *dst = rgba[RCOMP]; +} +#endif + + +/* MESA_FORMAT_CI8 ***********************************************************/ + +/* Fetch CI texel from 1D, 2D or 3D ci8 texture, lookup the index in a + * color table, and return 4 GLchans. + */ +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; + GLuint index; + GET_CURRENT_CONTEXT(ctx); + + if (ctx->Texture.SharedPalette) { + palette = &ctx->Texture.Palette; + } + else { + palette = &texImage->TexObject->Palette; + } + if (palette->Size == 0) + return; /* undefined results */ + + /* Mask the index against size of palette to avoid going out of bounds */ + index = (*src) & (palette->Size - 1); + + { + const GLfloat *table = palette->TableF; + switch (palette->_BaseFormat) { + case GL_ALPHA: + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = 0.0F; + texel[ACOMP] = table[index]; + break; + case GL_LUMINANCE: + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = table[index]; + texel[ACOMP] = 1.0F; + break; + case GL_INTENSITY: + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = + texel[ACOMP] = table[index]; + break; + case GL_LUMINANCE_ALPHA: + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = table[index * 2 + 0]; + texel[ACOMP] = table[index * 2 + 1]; + 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; + 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; + default: + _mesa_problem(ctx, "Bad palette format in fetch_texel_ci8"); + return; + } + } +} + +#if DIM == 3 +static void store_texel_ci8(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *index = (const GLubyte *) texel; + GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); + *dst = *index; +} +#endif + + +#if FEATURE_EXT_texture_sRGB + +/* Fetch texel from 1D, 2D or 3D srgb8 texture, return 4 GLfloats */ +/* Note: component order is same as for MESA_FORMAT_RGB888 */ +static void FETCH(srgb8)(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] = nonlinear_to_linear(src[2]); + texel[GCOMP] = nonlinear_to_linear(src[1]); + texel[BCOMP] = nonlinear_to_linear(src[0]); + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void store_texel_srgb8(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3); + dst[0] = rgba[BCOMP]; /* no conversion */ + dst[1] = rgba[GCOMP]; + dst[2] = rgba[RCOMP]; +} +#endif + +/* Fetch texel from 1D, 2D or 3D srgba8 texture, return 4 GLfloats */ +static void FETCH(srgba8)(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] = nonlinear_to_linear( (s >> 24) ); + texel[GCOMP] = nonlinear_to_linear( (s >> 16) & 0xff ); + texel[BCOMP] = nonlinear_to_linear( (s >> 8) & 0xff ); + texel[ACOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); /* linear! */ +} + +#if DIM == 3 +static void store_texel_srgba8(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(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]); +} +#endif + +/* Fetch texel from 1D, 2D or 3D sargb8 texture, return 4 GLfloats */ +static void FETCH(sargb8)(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] = nonlinear_to_linear( (s >> 16) & 0xff ); + texel[GCOMP] = nonlinear_to_linear( (s >> 8) & 0xff ); + texel[BCOMP] = nonlinear_to_linear( (s ) & 0xff ); + texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24) ); /* linear! */ +} + +#if DIM == 3 +static void store_texel_sargb8(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(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); +} +#endif + +/* Fetch texel from 1D, 2D or 3D sl8 texture, return 4 GLfloats */ +static void FETCH(sl8)(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] = nonlinear_to_linear(src[0]); + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void store_texel_sl8(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); + dst[0] = rgba[RCOMP]; +} +#endif + +/* Fetch texel from 1D, 2D or 3D sla8 texture, return 4 GLfloats */ +static void FETCH(sla8)(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 2); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = nonlinear_to_linear(src[0]); + texel[ACOMP] = UBYTE_TO_FLOAT(src[1]); /* linear */ +} + +#if DIM == 3 +static void store_texel_sla8(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLubyte *rgba = (const GLubyte *) texel; + GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 2); + dst[0] = rgba[RCOMP]; + dst[1] = rgba[ACOMP]; +} +#endif + +#endif /* FEATURE_EXT_texture_sRGB */ + + +/* MESA_FORMAT_DUDV8 ********************************************************/ + +/* this format by definition produces 0,0,0,1 as rgba values, + however we'll return the dudv values as rg and fix up elsewhere */ +static void FETCH(dudv8)(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLbyte *src = TEXEL_ADDR(GLbyte, texImage, i, j, k, 2); + texel[RCOMP] = BYTE_TO_FLOAT(src[0]); + texel[GCOMP] = BYTE_TO_FLOAT(src[1]); + texel[BCOMP] = 0; + texel[ACOMP] = 0; +} + +/* MESA_FORMAT_SIGNED_RGBA8888 ***********************************************/ + +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 + +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 *********************************************************/ + +/* 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 ) +{ + const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */ + const GLushort *src1 = src0 + 1; /* odd */ + const GLubyte y0 = (*src0 >> 8) & 0xff; /* luminance */ + const GLubyte cb = *src0 & 0xff; /* chroma U */ + const GLubyte y1 = (*src1 >> 8) & 0xff; /* luminance */ + const GLubyte cr = *src1 & 0xff; /* chroma V */ + const GLubyte y = (i & 1) ? y1 : y0; /* choose even/odd luminance */ + GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128); + GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128); + GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128); + r *= (1.0F / 255.0F); + g *= (1.0F / 255.0F); + b *= (1.0F / 255.0F); + texel[RCOMP] = CLAMP(r, 0.0F, 1.0F); + texel[GCOMP] = CLAMP(g, 0.0F, 1.0F); + texel[BCOMP] = CLAMP(b, 0.0F, 1.0F); + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void store_texel_ycbcr(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + (void) texImage; + (void) i; + (void) j; + (void) k; + (void) texel; + /* XXX to do */ +} +#endif + + +/* MESA_FORMAT_YCBCR_REV *****************************************************/ + +/* 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 ) +{ + const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */ + const GLushort *src1 = src0 + 1; /* odd */ + const GLubyte y0 = *src0 & 0xff; /* luminance */ + const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma V */ + const GLubyte y1 = *src1 & 0xff; /* luminance */ + const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma U */ + const GLubyte y = (i & 1) ? y1 : y0; /* choose even/odd luminance */ + GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128); + GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128); + GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128); + r *= (1.0F / 255.0F); + g *= (1.0F / 255.0F); + b *= (1.0F / 255.0F); + texel[RCOMP] = CLAMP(r, 0.0F, 1.0F); + texel[GCOMP] = CLAMP(g, 0.0F, 1.0F); + texel[BCOMP] = CLAMP(b, 0.0F, 1.0F); + texel[ACOMP] = 1.0F; +} + +#if DIM == 3 +static void store_texel_ycbcr_rev(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + (void) texImage; + (void) i; + (void) j; + (void) k; + (void) texel; + /* XXX to do */ +} +#endif + + +/* MESA_TEXFORMAT_Z24_S8 ***************************************************/ + +static void FETCH(f_z24_s8)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + /* only return Z, not stencil data */ + const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + const GLfloat scale = 1.0F / (GLfloat) 0xffffff; + texel[0] = ((*src) >> 8) * scale; + ASSERT(texImage->TexFormat == MESA_FORMAT_Z24_S8); + ASSERT(texel[0] >= 0.0F); + ASSERT(texel[0] <= 1.0F); +} + +#if DIM == 3 +static void store_texel_z24_s8(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + /* only store Z, not stencil */ + GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + GLfloat depth = *((GLfloat *) texel); + GLuint zi = ((GLuint) (depth * 0xffffff)) << 8; + *dst = zi | (*dst & 0xff); +} +#endif + + +/* MESA_TEXFORMAT_S8_Z24 ***************************************************/ + +static void FETCH(f_s8_z24)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + /* only return Z, not stencil data */ + const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + const GLfloat scale = 1.0F / (GLfloat) 0xffffff; + texel[0] = ((*src) & 0x00ffffff) * scale; + ASSERT(texImage->TexFormat == MESA_FORMAT_S8_Z24); + ASSERT(texel[0] >= 0.0F); + ASSERT(texel[0] <= 1.0F); +} + +#if DIM == 3 +static void store_texel_s8_z24(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + /* only store Z, not stencil */ + GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + GLfloat depth = *((GLfloat *) texel); + GLuint zi = (GLuint) (depth * 0xffffff); + *dst = zi | (*dst & 0xff000000); +} +#endif + + +#undef TEXEL_ADDR +#undef DIM +#undef FETCH diff --git a/src/mesa/main/texformat_tmp.h b/src/mesa/main/texformat_tmp.h deleted file mode 100644 index 199849d6ac..0000000000 --- a/src/mesa/main/texformat_tmp.h +++ /dev/null @@ -1,1304 +0,0 @@ -/* - * Mesa 3-D graphics library - * Version: 6.5.1 - * - * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. - * Copyright (c) 2008 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. - */ - - -/** - * \file texformat_tmp.h - * Texel fetch functions template. - * - * This template file is used by texformat.c to generate texel fetch functions - * for 1-D, 2-D and 3-D texture images. - * - * It should be expanded by defining \p DIM as the number texture dimensions - * (1, 2 or 3). According to the value of \p DIM a series of macros is defined - * for the texel lookup in the gl_texture_image::Data. - * - * \sa texformat.c and FetchTexel. - * - * \author Gareth Hughes - * \author Brian Paul - */ - - -#if DIM == 1 - -#define TEXEL_ADDR( type, image, i, j, k, size ) \ - ((void) (j), (void) (k), ((type *)(image)->Data + (i) * (size))) - -#define FETCH(x) fetch_texel_1d_##x - -#elif DIM == 2 - -#define TEXEL_ADDR( type, image, i, j, k, size ) \ - ((void) (k), \ - ((type *)(image)->Data + ((image)->RowStride * (j) + (i)) * (size))) - -#define FETCH(x) fetch_texel_2d_##x - -#elif DIM == 3 - -#define TEXEL_ADDR( type, image, i, j, k, size ) \ - ((type *)(image)->Data + ((image)->ImageOffsets[k] \ - + (image)->RowStride * (j) + (i)) * (size)) - -#define FETCH(x) fetch_texel_3d_##x - -#else -#error illegal number of texture dimensions -#endif - - -/* MESA_FORMAT_Z32 ***********************************************************/ - -/* Fetch depth texel from 1D, 2D or 3D 32-bit depth texture, - * returning 1 GLfloat. - * Note: no GLchan version of this function. - */ -static void FETCH(f_z32)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); - texel[0] = src[0] * (1.0F / 0xffffffff); -} - -#if DIM == 3 -static void store_texel_z32(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLuint *depth = (const GLuint *) texel; - GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); - dst[0] = *depth; -} -#endif - - -/* MESA_FORMAT_Z16 ***********************************************************/ - -/* Fetch depth texel from 1D, 2D or 3D 16-bit depth texture, - * returning 1 GLfloat. - * Note: no GLchan version of this function. - */ -static void FETCH(f_z16)(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); - texel[0] = src[0] * (1.0F / 65535.0F); -} - -#if DIM == 3 -static void store_texel_z16(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLushort *depth = (const GLushort *) texel; - GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); - dst[0] = *depth; -} -#endif - - -/* MESA_FORMAT_RGBA_F32 ******************************************************/ - -/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT32 texture, returning 4 GLfloats. - */ -static void FETCH(f_rgba_f32)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 4); - texel[RCOMP] = src[0]; - texel[GCOMP] = src[1]; - texel[BCOMP] = src[2]; - texel[ACOMP] = src[3]; -} - -#if DIM == 3 -static void store_texel_rgba_f32(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLfloat *depth = (const GLfloat *) texel; - GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); - dst[0] = depth[RCOMP]; - dst[1] = depth[GCOMP]; - dst[2] = depth[BCOMP]; - dst[3] = depth[ACOMP]; -} -#endif - - -/* MESA_FORMAT_RGBA_F16 ******************************************************/ - -/* Fetch texel from 1D, 2D or 3D RGBA_FLOAT16 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_rgba_f16)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 4); - texel[RCOMP] = _mesa_half_to_float(src[0]); - texel[GCOMP] = _mesa_half_to_float(src[1]); - texel[BCOMP] = _mesa_half_to_float(src[2]); - texel[ACOMP] = _mesa_half_to_float(src[3]); -} - -#if DIM == 3 -static void store_texel_rgba_f16(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLfloat *depth = (const GLfloat *) texel; - GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); - dst[0] = _mesa_float_to_half(*depth); -} -#endif - -/* MESA_FORMAT_RGB_F32 *******************************************************/ - -/* Fetch texel from 1D, 2D or 3D RGB_FLOAT32 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_rgb_f32)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 3); - texel[RCOMP] = src[0]; - texel[GCOMP] = src[1]; - texel[BCOMP] = src[2]; - texel[ACOMP] = 1.0F; -} - -#if DIM == 3 -static void store_texel_rgb_f32(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLfloat *depth = (const GLfloat *) texel; - GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); - dst[0] = *depth; -} -#endif - - -/* MESA_FORMAT_RGB_F16 *******************************************************/ - -/* Fetch texel from 1D, 2D or 3D RGB_FLOAT16 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_rgb_f16)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 3); - texel[RCOMP] = _mesa_half_to_float(src[0]); - texel[GCOMP] = _mesa_half_to_float(src[1]); - texel[BCOMP] = _mesa_half_to_float(src[2]); - texel[ACOMP] = 1.0F; -} - -#if DIM == 3 -static void store_texel_rgb_f16(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLfloat *depth = (const GLfloat *) texel; - GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); - dst[0] = _mesa_float_to_half(*depth); -} -#endif - - -/* MESA_FORMAT_ALPHA_F32 *****************************************************/ - -/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT32 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_alpha_f32)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = 0.0F; - texel[ACOMP] = src[0]; -} - -#if DIM == 3 -static void store_texel_alpha_f32(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLfloat *rgba = (const GLfloat *) texel; - GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); - dst[0] = rgba[ACOMP]; -} -#endif - - -/* MESA_FORMAT_ALPHA_F32 *****************************************************/ - -/* Fetch texel from 1D, 2D or 3D ALPHA_FLOAT16 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_alpha_f16)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = 0.0F; - texel[ACOMP] = _mesa_half_to_float(src[0]); -} - -#if DIM == 3 -static void store_texel_alpha_f16(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLfloat *rgba = (const GLfloat *) texel; - GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); - dst[0] = _mesa_float_to_half(rgba[ACOMP]); -} -#endif - - -/* MESA_FORMAT_LUMINANCE_F32 *************************************************/ - -/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT32 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_luminance_f32)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = src[0]; - texel[ACOMP] = 1.0F; -} - -#if DIM == 3 -static void store_texel_luminance_f32(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLfloat *rgba = (const GLfloat *) texel; - GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); - dst[0] = rgba[RCOMP]; -} -#endif - - -/* MESA_FORMAT_LUMINANCE_F16 *************************************************/ - -/* Fetch texel from 1D, 2D or 3D LUMINANCE_FLOAT16 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_luminance_f16)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = _mesa_half_to_float(src[0]); - texel[ACOMP] = 1.0F; -} - -#if DIM == 3 -static void store_texel_luminance_f16(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLfloat *rgba = (const GLfloat *) texel; - GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); - dst[0] = _mesa_float_to_half(rgba[RCOMP]); -} -#endif - - -/* MESA_FORMAT_LUMINANCE_ALPHA_F32 *******************************************/ - -/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT32 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_luminance_alpha_f32)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2); - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = src[0]; - texel[ACOMP] = src[1]; -} - -#if DIM == 3 -static void store_texel_luminance_alpha_f32(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLfloat *rgba = (const GLfloat *) texel; - GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 2); - dst[0] = rgba[RCOMP]; - dst[1] = rgba[ACOMP]; -} -#endif - - -/* MESA_FORMAT_LUMINANCE_ALPHA_F16 *******************************************/ - -/* Fetch texel from 1D, 2D or 3D LUMINANCE_ALPHA_FLOAT16 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_luminance_alpha_f16)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2); - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = _mesa_half_to_float(src[0]); - texel[ACOMP] = _mesa_half_to_float(src[1]); -} - -#if DIM == 3 -static void store_texel_luminance_alpha_f16(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLfloat *rgba = (const GLfloat *) texel; - GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 2); - dst[0] = _mesa_float_to_half(rgba[RCOMP]); - dst[1] = _mesa_float_to_half(rgba[ACOMP]); -} -#endif - - -/* MESA_FORMAT_INTENSITY_F32 *************************************************/ - -/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT32 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_intensity_f32)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLfloat *src = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = - texel[ACOMP] = src[0]; -} - -#if DIM == 3 -static void store_texel_intensity_f32(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLfloat *rgba = (const GLfloat *) texel; - GLfloat *dst = TEXEL_ADDR(GLfloat, texImage, i, j, k, 1); - dst[0] = rgba[RCOMP]; -} -#endif - - -/* MESA_FORMAT_INTENSITY_F16 *************************************************/ - -/* Fetch texel from 1D, 2D or 3D INTENSITY_FLOAT16 texture, - * returning 4 GLfloats. - */ -static void FETCH(f_intensity_f16)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLhalfARB *src = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = - texel[ACOMP] = _mesa_half_to_float(src[0]); -} - -#if DIM == 3 -static void store_texel_intensity_f16(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLfloat *rgba = (const GLfloat *) texel; - GLhalfARB *dst = TEXEL_ADDR(GLhalfARB, texImage, i, j, k, 1); - dst[0] = _mesa_float_to_half(rgba[RCOMP]); -} -#endif - - - - -/* - * Begin Hardware formats - */ - -/* MESA_FORMAT_RGBA8888 ******************************************************/ - -/* 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_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) -{ - const GLubyte *rgba = (const GLubyte *) 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_RGBA888_REV ***************************************************/ - -/* Fetch texel from 1D, 2D or 3D abgr8888 texture, return 4 GLchans */ -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_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 -static void store_texel_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_ARGB8888 ******************************************************/ - -/* Fetch texel from 1D, 2D or 3D argb8888 texture, return 4 GLchans */ -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_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 -static void store_texel_argb8888(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(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); -} -#endif - - -/* MESA_FORMAT_ARGB8888_REV **************************************************/ - -/* 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_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 -static void store_texel_argb8888_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(rgba[BCOMP], rgba[GCOMP], rgba[RCOMP], rgba[ACOMP]); -} -#endif - - -/* MESA_FORMAT_RGB888 ********************************************************/ - -/* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */ -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_FLOAT( src[2] ); - texel[GCOMP] = UBYTE_TO_FLOAT( src[1] ); - texel[BCOMP] = UBYTE_TO_FLOAT( src[0] ); - texel[ACOMP] = 1.0F; -} - -#if DIM == 3 -static void store_texel_rgb888(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLubyte *rgba = (const GLubyte *) texel; - GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3); - dst[0] = rgba[BCOMP]; - dst[1] = rgba[GCOMP]; - dst[2] = rgba[RCOMP]; -} -#endif - - -/* MESA_FORMAT_BGR888 ********************************************************/ - -/* Fetch texel from 1D, 2D or 3D bgr888 texture, return 4 GLchans */ -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_FLOAT( src[0] ); - texel[GCOMP] = UBYTE_TO_FLOAT( src[1] ); - texel[BCOMP] = UBYTE_TO_FLOAT( src[2] ); - texel[ACOMP] = 1.0F; -} - -#if DIM == 3 -static void store_texel_bgr888(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLubyte *rgba = (const GLubyte *) texel; - GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3); - dst[0] = rgba[RCOMP]; - dst[1] = rgba[GCOMP]; - dst[2] = rgba[BCOMP]; -} -#endif - - -/* use color expansion like (g << 2) | (g >> 4) (does somewhat random rounding) - instead of slow (g << 2) * 255 / 252 (always rounds down) */ - -/* MESA_FORMAT_RGB565 ********************************************************/ - -/* Fetch texel from 1D, 2D or 3D rgb565 texture, return 4 GLchans */ -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] = ((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 -static void store_texel_rgb565(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLubyte *rgba = (const GLubyte *) texel; - GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); - *dst = PACK_COLOR_565(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); -} -#endif - - -/* MESA_FORMAT_RGB565_REV ****************************************************/ - -/* Fetch texel from 1D, 2D or 3D rgb565_rev texture, return 4 GLchans */ -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_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 -static void store_texel_rgb565_rev(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLubyte *rgba = (const GLubyte *) texel; - GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); - *dst = PACK_COLOR_565(rgba[BCOMP], rgba[GCOMP], rgba[RCOMP]); -} -#endif - - -/* MESA_FORMAT_ARGB4444 ******************************************************/ - -/* Fetch texel from 1D, 2D or 3D argb444 texture, return 4 GLchans */ -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] = ((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 -static void store_texel_argb4444(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLubyte *rgba = (const GLubyte *) texel; - GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); - *dst = PACK_COLOR_4444(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); -} -#endif - - -/* MESA_FORMAT_ARGB4444_REV **************************************************/ - -/* Fetch texel from 1D, 2D or 3D argb4444_rev texture, return 4 GLchans */ -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] = ((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 -static void store_texel_argb4444_rev(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLubyte *rgba = (const GLubyte *) texel; - GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); - *dst = PACK_COLOR_4444(rgba[ACOMP], rgba[BCOMP], rgba[GCOMP], rgba[RCOMP]); -} -#endif - -/* MESA_FORMAT_RGBA5551 ******************************************************/ - -/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */ -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] = ((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 -static void store_texel_rgba5551(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLubyte *rgba = (const GLubyte *) texel; - GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); - *dst = PACK_COLOR_5551(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]); -} -#endif - -/* MESA_FORMAT_ARGB1555 ******************************************************/ - -/* Fetch texel from 1D, 2D or 3D argb1555 texture, return 4 GLchans */ -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] = ((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 -static void store_texel_argb1555(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLubyte *rgba = (const GLubyte *) texel; - GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); - *dst = PACK_COLOR_1555(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); -} -#endif - - -/* MESA_FORMAT_ARGB1555_REV **************************************************/ - -/* Fetch texel from 1D, 2D or 3D argb1555_rev texture, return 4 GLchans */ -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_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 -static void store_texel_argb1555_rev(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLubyte *rgba = (const GLubyte *) texel; - GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); - *dst = PACK_COLOR_1555_REV(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); -} -#endif - - -/* MESA_FORMAT_AL88 **********************************************************/ - -/* Fetch texel from 1D, 2D or 3D al88 texture, return 4 GLchans */ -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_FLOAT( s & 0xff ); - texel[ACOMP] = UBYTE_TO_FLOAT( s >> 8 ); -} - -#if DIM == 3 -static void store_texel_al88(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLubyte *rgba = (const GLubyte *) texel; - GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); - *dst = PACK_COLOR_88(rgba[ACOMP], rgba[RCOMP]); -} -#endif - - -/* MESA_FORMAT_AL88_REV ******************************************************/ - -/* Fetch texel from 1D, 2D or 3D al88_rev texture, return 4 GLchans */ -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_FLOAT( s >> 8 ); - texel[ACOMP] = UBYTE_TO_FLOAT( s & 0xff ); -} - -#if DIM == 3 -static void store_texel_al88_rev(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLubyte *rgba = (const GLubyte *) texel; - GLushort *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); - *dst = PACK_COLOR_88(rgba[RCOMP], rgba[ACOMP]); -} -#endif - - -/* MESA_FORMAT_RGB332 ********************************************************/ - -/* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLchans */ -static void FETCH(f_rgb332)( 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 GLubyte s = *src; - 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 -static void store_texel_rgb332(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLubyte *rgba = (const GLubyte *) texel; - GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); - *dst = PACK_COLOR_332(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); -} -#endif - - -/* MESA_FORMAT_A8 ************************************************************/ - -/* Fetch texel from 1D, 2D or 3D a8 texture, return 4 GLchans */ -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.0F; - texel[ACOMP] = UBYTE_TO_FLOAT( src[0] ); -} - -#if DIM == 3 -static void store_texel_a8(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLubyte *rgba = (const GLubyte *) texel; - GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); - *dst = rgba[ACOMP]; -} -#endif - - -/* MESA_FORMAT_L8 ************************************************************/ - -/* Fetch texel from 1D, 2D or 3D l8 texture, return 4 GLchans */ -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_FLOAT( src[0] ); - texel[ACOMP] = 1.0F; -} - -#if DIM == 3 -static void store_texel_l8(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLubyte *rgba = (const GLubyte *) texel; - GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); - *dst = rgba[RCOMP]; -} -#endif - - -/* MESA_FORMAT_I8 ************************************************************/ - -/* Fetch texel from 1D, 2D or 3D i8 texture, return 4 GLchans */ -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_FLOAT( src[0] ); -} - -#if DIM == 3 -static void store_texel_i8(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLubyte *rgba = (const GLubyte *) texel; - GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); - *dst = rgba[RCOMP]; -} -#endif - - -/* MESA_FORMAT_CI8 ***********************************************************/ - -/* Fetch CI texel from 1D, 2D or 3D ci8 texture, lookup the index in a - * color table, and return 4 GLchans. - */ -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; - GLuint index; - GET_CURRENT_CONTEXT(ctx); - - if (ctx->Texture.SharedPalette) { - palette = &ctx->Texture.Palette; - } - else { - palette = &texImage->TexObject->Palette; - } - if (palette->Size == 0) - return; /* undefined results */ - - /* Mask the index against size of palette to avoid going out of bounds */ - index = (*src) & (palette->Size - 1); - - { - const GLfloat *table = palette->TableF; - switch (palette->_BaseFormat) { - case GL_ALPHA: - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = 0.0F; - texel[ACOMP] = table[index]; - break; - case GL_LUMINANCE: - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = table[index]; - texel[ACOMP] = 1.0F; - break; - case GL_INTENSITY: - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = - texel[ACOMP] = table[index]; - break; - case GL_LUMINANCE_ALPHA: - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = table[index * 2 + 0]; - texel[ACOMP] = table[index * 2 + 1]; - 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; - 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; - default: - _mesa_problem(ctx, "Bad palette format in fetch_texel_ci8"); - return; - } - } -} - -#if DIM == 3 -static void store_texel_ci8(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLubyte *index = (const GLubyte *) texel; - GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); - *dst = *index; -} -#endif - - -#if FEATURE_EXT_texture_sRGB - -/* Fetch texel from 1D, 2D or 3D srgb8 texture, return 4 GLfloats */ -/* Note: component order is same as for MESA_FORMAT_RGB888 */ -static void FETCH(srgb8)(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] = nonlinear_to_linear(src[2]); - texel[GCOMP] = nonlinear_to_linear(src[1]); - texel[BCOMP] = nonlinear_to_linear(src[0]); - texel[ACOMP] = 1.0F; -} - -#if DIM == 3 -static void store_texel_srgb8(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLubyte *rgba = (const GLubyte *) texel; - GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 3); - dst[0] = rgba[BCOMP]; /* no conversion */ - dst[1] = rgba[GCOMP]; - dst[2] = rgba[RCOMP]; -} -#endif - -/* Fetch texel from 1D, 2D or 3D srgba8 texture, return 4 GLfloats */ -static void FETCH(srgba8)(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] = nonlinear_to_linear( (s >> 24) ); - texel[GCOMP] = nonlinear_to_linear( (s >> 16) & 0xff ); - texel[BCOMP] = nonlinear_to_linear( (s >> 8) & 0xff ); - texel[ACOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); /* linear! */ -} - -#if DIM == 3 -static void store_texel_srgba8(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(rgba[RCOMP], rgba[GCOMP], rgba[BCOMP], rgba[ACOMP]); -} -#endif - -/* Fetch texel from 1D, 2D or 3D sargb8 texture, return 4 GLfloats */ -static void FETCH(sargb8)(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] = nonlinear_to_linear( (s >> 16) & 0xff ); - texel[GCOMP] = nonlinear_to_linear( (s >> 8) & 0xff ); - texel[BCOMP] = nonlinear_to_linear( (s ) & 0xff ); - texel[ACOMP] = UBYTE_TO_FLOAT( (s >> 24) ); /* linear! */ -} - -#if DIM == 3 -static void store_texel_sargb8(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(rgba[ACOMP], rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); -} -#endif - -/* Fetch texel from 1D, 2D or 3D sl8 texture, return 4 GLfloats */ -static void FETCH(sl8)(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] = nonlinear_to_linear(src[0]); - texel[ACOMP] = 1.0F; -} - -#if DIM == 3 -static void store_texel_sl8(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLubyte *rgba = (const GLubyte *) texel; - GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 1); - dst[0] = rgba[RCOMP]; -} -#endif - -/* Fetch texel from 1D, 2D or 3D sla8 texture, return 4 GLfloats */ -static void FETCH(sla8)(const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLubyte *src = TEXEL_ADDR(GLubyte, texImage, i, j, k, 2); - texel[RCOMP] = - texel[GCOMP] = - texel[BCOMP] = nonlinear_to_linear(src[0]); - texel[ACOMP] = UBYTE_TO_FLOAT(src[1]); /* linear */ -} - -#if DIM == 3 -static void store_texel_sla8(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - const GLubyte *rgba = (const GLubyte *) texel; - GLubyte *dst = TEXEL_ADDR(GLubyte, texImage, i, j, k, 2); - dst[0] = rgba[RCOMP]; - dst[1] = rgba[ACOMP]; -} -#endif - -#endif /* FEATURE_EXT_texture_sRGB */ - - -/* MESA_FORMAT_DUDV8 ********************************************************/ - -/* this format by definition produces 0,0,0,1 as rgba values, - however we'll return the dudv values as rg and fix up elsewhere */ -static void FETCH(dudv8)(const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - const GLbyte *src = TEXEL_ADDR(GLbyte, texImage, i, j, k, 2); - texel[RCOMP] = BYTE_TO_FLOAT(src[0]); - texel[GCOMP] = BYTE_TO_FLOAT(src[1]); - texel[BCOMP] = 0; - texel[ACOMP] = 0; -} - -/* MESA_FORMAT_SIGNED_RGBA8888 ***********************************************/ - -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 - -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 *********************************************************/ - -/* 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 ) -{ - const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */ - const GLushort *src1 = src0 + 1; /* odd */ - const GLubyte y0 = (*src0 >> 8) & 0xff; /* luminance */ - const GLubyte cb = *src0 & 0xff; /* chroma U */ - const GLubyte y1 = (*src1 >> 8) & 0xff; /* luminance */ - const GLubyte cr = *src1 & 0xff; /* chroma V */ - const GLubyte y = (i & 1) ? y1 : y0; /* choose even/odd luminance */ - GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128); - GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128); - GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128); - r *= (1.0F / 255.0F); - g *= (1.0F / 255.0F); - b *= (1.0F / 255.0F); - texel[RCOMP] = CLAMP(r, 0.0F, 1.0F); - texel[GCOMP] = CLAMP(g, 0.0F, 1.0F); - texel[BCOMP] = CLAMP(b, 0.0F, 1.0F); - texel[ACOMP] = 1.0F; -} - -#if DIM == 3 -static void store_texel_ycbcr(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - (void) texImage; - (void) i; - (void) j; - (void) k; - (void) texel; - /* XXX to do */ -} -#endif - - -/* MESA_FORMAT_YCBCR_REV *****************************************************/ - -/* 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 ) -{ - const GLushort *src0 = TEXEL_ADDR(GLushort, texImage, (i & ~1), j, k, 1); /* even */ - const GLushort *src1 = src0 + 1; /* odd */ - const GLubyte y0 = *src0 & 0xff; /* luminance */ - const GLubyte cr = (*src0 >> 8) & 0xff; /* chroma V */ - const GLubyte y1 = *src1 & 0xff; /* luminance */ - const GLubyte cb = (*src1 >> 8) & 0xff; /* chroma U */ - const GLubyte y = (i & 1) ? y1 : y0; /* choose even/odd luminance */ - GLfloat r = 1.164F * (y - 16) + 1.596F * (cr - 128); - GLfloat g = 1.164F * (y - 16) - 0.813F * (cr - 128) - 0.391F * (cb - 128); - GLfloat b = 1.164F * (y - 16) + 2.018F * (cb - 128); - r *= (1.0F / 255.0F); - g *= (1.0F / 255.0F); - b *= (1.0F / 255.0F); - texel[RCOMP] = CLAMP(r, 0.0F, 1.0F); - texel[GCOMP] = CLAMP(g, 0.0F, 1.0F); - texel[BCOMP] = CLAMP(b, 0.0F, 1.0F); - texel[ACOMP] = 1.0F; -} - -#if DIM == 3 -static void store_texel_ycbcr_rev(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - (void) texImage; - (void) i; - (void) j; - (void) k; - (void) texel; - /* XXX to do */ -} -#endif - - -/* MESA_TEXFORMAT_Z24_S8 ***************************************************/ - -static void FETCH(f_z24_s8)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - /* only return Z, not stencil data */ - const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); - const GLfloat scale = 1.0F / (GLfloat) 0xffffff; - texel[0] = ((*src) >> 8) * scale; - ASSERT(texImage->TexFormat == MESA_FORMAT_Z24_S8); - ASSERT(texel[0] >= 0.0F); - ASSERT(texel[0] <= 1.0F); -} - -#if DIM == 3 -static void store_texel_z24_s8(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - /* only store Z, not stencil */ - GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); - GLfloat depth = *((GLfloat *) texel); - GLuint zi = ((GLuint) (depth * 0xffffff)) << 8; - *dst = zi | (*dst & 0xff); -} -#endif - - -/* MESA_TEXFORMAT_S8_Z24 ***************************************************/ - -static void FETCH(f_s8_z24)( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texel ) -{ - /* only return Z, not stencil data */ - const GLuint *src = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); - const GLfloat scale = 1.0F / (GLfloat) 0xffffff; - texel[0] = ((*src) & 0x00ffffff) * scale; - ASSERT(texImage->TexFormat == MESA_FORMAT_S8_Z24); - ASSERT(texel[0] >= 0.0F); - ASSERT(texel[0] <= 1.0F); -} - -#if DIM == 3 -static void store_texel_s8_z24(struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, const void *texel) -{ - /* only store Z, not stencil */ - GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); - GLfloat depth = *((GLfloat *) texel); - GLuint zi = (GLuint) (depth * 0xffffff); - *dst = zi | (*dst & 0xff000000); -} -#endif - - -#undef TEXEL_ADDR -#undef DIM -#undef FETCH -- cgit v1.2.3 From 8c36ca707ca8879d6f888de7733ffb6b04ddc48a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 30 Sep 2009 22:50:05 -0600 Subject: swrast: fix some texformat regressions Need to be careful with component ordering for MESA_FORMAT_RGB888 and MESA_FORMAT_RGBA8888. --- src/mesa/swrast/s_texfilter.c | 12 +++---- src/mesa/swrast/s_triangle.c | 78 ++++++++++++++++++++++++------------------- 2 files changed, 49 insertions(+), 41 deletions(-) (limited to 'src') diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 6cba8ed34b..db03c6aa39 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -1351,9 +1351,9 @@ opt_sample_rgb_2d(GLcontext *ctx, GLint j = IFLOOR(texcoords[k][1] * height) & rowMask; GLint pos = (j << shift) | i; GLubyte *texel = ((GLubyte *) img->Data) + 3*pos; - rgba[k][RCOMP] = UBYTE_TO_FLOAT(texel[0]); + rgba[k][RCOMP] = UBYTE_TO_FLOAT(texel[2]); rgba[k][GCOMP] = UBYTE_TO_FLOAT(texel[1]); - rgba[k][BCOMP] = UBYTE_TO_FLOAT(texel[2]); + rgba[k][BCOMP] = UBYTE_TO_FLOAT(texel[0]); } } @@ -1392,10 +1392,10 @@ opt_sample_rgba_2d(GLcontext *ctx, const GLint row = IFLOOR(texcoords[i][1] * height) & rowMask; const GLint pos = (row << shift) | col; const GLubyte *texel = ((GLubyte *) img->Data) + (pos << 2); /* pos*4 */ - rgba[i][RCOMP] = UBYTE_TO_FLOAT(texel[0]); - rgba[i][GCOMP] = UBYTE_TO_FLOAT(texel[1]); - rgba[i][BCOMP] = UBYTE_TO_FLOAT(texel[2]); - rgba[i][ACOMP] = UBYTE_TO_FLOAT(texel[3]); + rgba[i][RCOMP] = UBYTE_TO_FLOAT(texel[3]); + rgba[i][GCOMP] = UBYTE_TO_FLOAT(texel[2]); + rgba[i][BCOMP] = UBYTE_TO_FLOAT(texel[1]); + rgba[i][ACOMP] = UBYTE_TO_FLOAT(texel[0]); } } diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 6a61bec245..f28f2c9307 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -276,25 +276,29 @@ affine_span(GLcontext *ctx, SWspan *span, * unused variables (for instance tf,sf,ti,si in case of GL_NEAREST). */ -#define NEAREST_RGB \ - sample[RCOMP] = tex00[RCOMP]; \ - sample[GCOMP] = tex00[GCOMP]; \ - sample[BCOMP] = tex00[BCOMP]; \ - sample[ACOMP] = CHAN_MAX +#define NEAREST_RGB \ + sample[RCOMP] = tex00[2]; \ + sample[GCOMP] = tex00[1]; \ + sample[BCOMP] = tex00[0]; \ + sample[ACOMP] = CHAN_MAX; #define LINEAR_RGB \ - sample[RCOMP] = ilerp_2d(sf, tf, tex00[0], tex01[0], tex10[0], tex11[0]);\ + sample[RCOMP] = ilerp_2d(sf, tf, tex00[2], tex01[2], tex10[2], tex11[2]);\ sample[GCOMP] = ilerp_2d(sf, tf, tex00[1], tex01[1], tex10[1], tex11[1]);\ - sample[BCOMP] = ilerp_2d(sf, tf, tex00[2], tex01[2], tex10[2], tex11[2]);\ + sample[BCOMP] = ilerp_2d(sf, tf, tex00[0], tex01[0], tex10[0], tex11[0]);\ sample[ACOMP] = CHAN_MAX; -#define NEAREST_RGBA COPY_CHAN4(sample, tex00) +#define NEAREST_RGBA \ + sample[RCOMP] = tex00[3]; \ + sample[GCOMP] = tex00[2]; \ + sample[BCOMP] = tex00[1]; \ + sample[ACOMP] = tex00[0]; #define LINEAR_RGBA \ - sample[RCOMP] = ilerp_2d(sf, tf, tex00[0], tex01[0], tex10[0], tex11[0]);\ - sample[GCOMP] = ilerp_2d(sf, tf, tex00[1], tex01[1], tex10[1], tex11[1]);\ - sample[BCOMP] = ilerp_2d(sf, tf, tex00[2], tex01[2], tex10[2], tex11[2]);\ - sample[ACOMP] = ilerp_2d(sf, tf, tex00[3], tex01[3], tex10[3], tex11[3]) + sample[RCOMP] = ilerp_2d(sf, tf, tex00[3], tex01[3], tex10[3], tex11[3]);\ + sample[GCOMP] = ilerp_2d(sf, tf, tex00[2], tex01[2], tex10[2], tex11[2]);\ + sample[BCOMP] = ilerp_2d(sf, tf, tex00[1], tex01[1], tex10[1], tex11[1]);\ + sample[ACOMP] = ilerp_2d(sf, tf, tex00[0], tex01[0], tex10[0], tex11[0]) #define MODULATE \ dest[RCOMP] = span->red * (sample[RCOMP] + 1u) >> (FIXED_SHIFT + 8); \ @@ -345,7 +349,11 @@ affine_span(GLcontext *ctx, SWspan *span, dest[2] = sample[2]; \ dest[3] = FixedToInt(span->alpha); -#define NEAREST_RGBA_REPLACE COPY_CHAN4(dest, tex00) +#define NEAREST_RGBA_REPLACE \ + dest[RCOMP] = tex00[3]; \ + dest[GCOMP] = tex00[2]; \ + dest[BCOMP] = tex00[1]; \ + dest[ACOMP] = tex00[0] #define SPAN_NEAREST(DO_TEX, COMPS) \ for (i = 0; i < span->end; i++) { \ @@ -406,7 +414,7 @@ affine_span(GLcontext *ctx, SWspan *span, switch (info->filter) { case GL_NEAREST: switch (info->format) { - case GL_RGB: + case MESA_FORMAT_RGB888: switch (info->envmode) { case GL_MODULATE: SPAN_NEAREST(NEAREST_RGB;MODULATE,3); @@ -426,7 +434,7 @@ affine_span(GLcontext *ctx, SWspan *span, return; } break; - case GL_RGBA: + case MESA_FORMAT_RGBA8888: switch(info->envmode) { case GL_MODULATE: SPAN_NEAREST(NEAREST_RGBA;MODULATE,4); @@ -455,7 +463,7 @@ affine_span(GLcontext *ctx, SWspan *span, span->intTex[0] -= FIXED_HALF; span->intTex[1] -= FIXED_HALF; switch (info->format) { - case GL_RGB: + case MESA_FORMAT_RGB888: switch (info->envmode) { case GL_MODULATE: SPAN_LINEAR(LINEAR_RGB;MODULATE,3); @@ -475,7 +483,7 @@ affine_span(GLcontext *ctx, SWspan *span, return; } break; - case GL_RGBA: + case MESA_FORMAT_RGBA8888: switch (info->envmode) { case GL_MODULATE: SPAN_LINEAR(LINEAR_RGBA;MODULATE,4); @@ -537,7 +545,7 @@ affine_span(GLcontext *ctx, SWspan *span, info.twidth_log2 = obj->Image[0][b]->WidthLog2; \ info.smask = obj->Image[0][b]->Width - 1; \ info.tmask = obj->Image[0][b]->Height - 1; \ - info.format = obj->Image[0][b]->_BaseFormat; \ + info.format = obj->Image[0][b]->TexFormat; \ info.filter = obj->MinFilter; \ info.envmode = unit->EnvMode; \ span.arrayMask |= SPAN_RGBA; \ @@ -555,18 +563,18 @@ affine_span(GLcontext *ctx, SWspan *span, } \ \ switch (info.format) { \ - case GL_ALPHA: \ - case GL_LUMINANCE: \ - case GL_INTENSITY: \ + case MESA_FORMAT_A8: \ + case MESA_FORMAT_L8: \ + case MESA_FORMAT_I8: \ info.tbytesline = obj->Image[0][b]->Width; \ break; \ - case GL_LUMINANCE_ALPHA: \ + case MESA_FORMAT_AL88: \ info.tbytesline = obj->Image[0][b]->Width * 2; \ break; \ - case GL_RGB: \ + case MESA_FORMAT_RGB888: \ info.tbytesline = obj->Image[0][b]->Width * 3; \ break; \ - case GL_RGBA: \ + case MESA_FORMAT_RGBA8888: \ info.tbytesline = obj->Image[0][b]->Width * 4; \ break; \ default: \ @@ -680,7 +688,7 @@ fast_persp_span(GLcontext *ctx, SWspan *span, switch (info->filter) { case GL_NEAREST: switch (info->format) { - case GL_RGB: + case MESA_FORMAT_RGB888: switch (info->envmode) { case GL_MODULATE: SPAN_NEAREST(NEAREST_RGB;MODULATE,3); @@ -700,7 +708,7 @@ fast_persp_span(GLcontext *ctx, SWspan *span, return; } break; - case GL_RGBA: + case MESA_FORMAT_RGBA8888: switch(info->envmode) { case GL_MODULATE: SPAN_NEAREST(NEAREST_RGBA;MODULATE,4); @@ -727,7 +735,7 @@ fast_persp_span(GLcontext *ctx, SWspan *span, case GL_LINEAR: switch (info->format) { - case GL_RGB: + case MESA_FORMAT_RGB888: switch (info->envmode) { case GL_MODULATE: SPAN_LINEAR(LINEAR_RGB;MODULATE,3); @@ -747,7 +755,7 @@ fast_persp_span(GLcontext *ctx, SWspan *span, return; } break; - case GL_RGBA: + case MESA_FORMAT_RGBA8888: switch (info->envmode) { case GL_MODULATE: SPAN_LINEAR(LINEAR_RGBA;MODULATE,4); @@ -806,7 +814,7 @@ fast_persp_span(GLcontext *ctx, SWspan *span, info.twidth_log2 = obj->Image[0][b]->WidthLog2; \ info.smask = obj->Image[0][b]->Width - 1; \ info.tmask = obj->Image[0][b]->Height - 1; \ - info.format = obj->Image[0][b]->_BaseFormat; \ + info.format = obj->Image[0][b]->TexFormat; \ info.filter = obj->MinFilter; \ info.envmode = unit->EnvMode; \ \ @@ -823,18 +831,18 @@ fast_persp_span(GLcontext *ctx, SWspan *span, } \ \ switch (info.format) { \ - case GL_ALPHA: \ - case GL_LUMINANCE: \ - case GL_INTENSITY: \ + case MESA_FORMAT_A8: \ + case MESA_FORMAT_L8: \ + case MESA_FORMAT_I8: \ info.tbytesline = obj->Image[0][b]->Width; \ break; \ - case GL_LUMINANCE_ALPHA: \ + case MESA_FORMAT_AL88: \ info.tbytesline = obj->Image[0][b]->Width * 2; \ break; \ - case GL_RGB: \ + case MESA_FORMAT_RGB888: \ info.tbytesline = obj->Image[0][b]->Width * 3; \ break; \ - case GL_RGBA: \ + case MESA_FORMAT_RGBA8888: \ info.tbytesline = obj->Image[0][b]->Width * 4; \ break; \ default: \ -- cgit v1.2.3 From ae2daacbac7242938cffe0e2409071e030e00863 Mon Sep 17 00:00:00 2001 From: Cooper Yuan Date: Thu, 1 Oct 2009 17:54:27 +0800 Subject: st/mesa: fix non-mipmap lastLevel calculation. reviewed by Brian Paul. --- src/mesa/state_tracker/st_cb_texture.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 771a0e2bbd..9a634bb930 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1766,7 +1766,11 @@ st_finalize_texture(GLcontext *ctx, * incomplete. In that case, we'll have set stObj->lastLevel before * we get here. */ - stObj->lastLevel = stObj->base._MaxLevel - stObj->base.BaseLevel; + if (stObj->base.MinFilter == GL_LINEAR || + stObj->base.MinFilter == GL_NEAREST) + stObj->lastLevel = stObj->base.BaseLevel; + else + stObj->lastLevel = stObj->base._MaxLevel - stObj->base.BaseLevel; } firstImage = st_texture_image(stObj->base.Image[0][stObj->base.BaseLevel]); -- cgit v1.2.3 From 4456006ba626890172289111403e469f49106e18 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 1 Oct 2009 14:34:23 +0100 Subject: gallium: remove depth.occlusion_count flag This was redundant as drivers can just keep track of whether they are inside a begin/end query pair. We want to add more query types later and also support nested queries, none of which map well onto a flag like this. No driver appeared to be using the flag. --- src/gallium/drivers/llvmpipe/lp_bld_depth.c | 3 --- src/gallium/drivers/llvmpipe/lp_state_fs.c | 1 - src/gallium/drivers/softpipe/sp_video_context.c | 1 - src/gallium/include/pipe/p_state.h | 1 - src/gallium/state_trackers/g3dvl/vl_context.c | 1 - src/mesa/state_tracker/st_atom_depth.c | 4 ---- 6 files changed, 11 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c index 21c665c4d4..98ec1cb1b9 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c @@ -210,7 +210,4 @@ lp_build_depth_test(LLVMBuilderRef builder, dst = lp_build_select(&bld, z_bitmask, src, dst); LLVMBuildStore(builder, dst, dst_ptr); } - - /* FIXME */ - assert(!state->occlusion_count); } diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index d5ce6993c5..b00be0cc32 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -401,7 +401,6 @@ generate_fragment(struct llvmpipe_context *lp, if(key->depth.enabled) { debug_printf("depth.func = %s\n", debug_dump_func(key->depth.func, TRUE)); debug_printf("depth.writemask = %u\n", key->depth.writemask); - debug_printf("depth.occlusion_count = %u\n", key->depth.occlusion_count); } if(key->alpha.enabled) { debug_printf("alpha.func = %s\n", debug_dump_func(key->alpha.func, TRUE)); diff --git a/src/gallium/drivers/softpipe/sp_video_context.c b/src/gallium/drivers/softpipe/sp_video_context.c index ccb29726b6..7e9136d8e0 100644 --- a/src/gallium/drivers/softpipe/sp_video_context.c +++ b/src/gallium/drivers/softpipe/sp_video_context.c @@ -167,7 +167,6 @@ init_pipe_state(struct sp_mpeg12_context *ctx) dsa.depth.enabled = 0; dsa.depth.writemask = 0; dsa.depth.func = PIPE_FUNC_ALWAYS; - dsa.depth.occlusion_count = 0; for (i = 0; i < 2; ++i) { dsa.stencil[i].enabled = 0; dsa.stencil[i].func = PIPE_FUNC_ALWAYS; diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index b59d6b7ae3..287b424e4a 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -197,7 +197,6 @@ struct pipe_depth_state unsigned enabled:1; /**< depth test enabled? */ unsigned writemask:1; /**< allow depth buffer writes? */ unsigned func:3; /**< depth test func (PIPE_FUNC_x) */ - unsigned occlusion_count:1; /**< do occlusion counting? */ }; diff --git a/src/gallium/state_trackers/g3dvl/vl_context.c b/src/gallium/state_trackers/g3dvl/vl_context.c index 5cfd233c4c..cfbf618d74 100644 --- a/src/gallium/state_trackers/g3dvl/vl_context.c +++ b/src/gallium/state_trackers/g3dvl/vl_context.c @@ -69,7 +69,6 @@ static int vlInitCommon(struct vlContext *context) dsa.depth.enabled = 0; dsa.depth.writemask = 0; dsa.depth.func = PIPE_FUNC_ALWAYS; - dsa.depth.occlusion_count = 0; for (i = 0; i < 2; ++i) { dsa.stencil[i].enabled = 0; diff --git a/src/mesa/state_tracker/st_atom_depth.c b/src/mesa/state_tracker/st_atom_depth.c index 0aa128f947..88b80a07fc 100644 --- a/src/mesa/state_tracker/st_atom_depth.c +++ b/src/mesa/state_tracker/st_atom_depth.c @@ -104,10 +104,6 @@ update_depth_stencil_alpha(struct st_context *st) dsa->depth.func = st_compare_func_to_pipe(ctx->Depth.Func); } - if (ctx->Query.CurrentOcclusionObject && - ctx->Query.CurrentOcclusionObject->Active) - dsa->depth.occlusion_count = 1; - if (ctx->Stencil.Enabled && ctx->DrawBuffer->Visual.stencilBits > 0) { dsa->stencil[0].enabled = 1; dsa->stencil[0].func = st_compare_func_to_pipe(ctx->Stencil.Function[0]); -- cgit v1.2.3 From f8d8f4527884d018a51daf8cc6281b52ce083b9e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 30 Sep 2009 09:30:27 -0600 Subject: mesa: better debug message --- src/mesa/main/texobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 678845ece0..f8ce811eb2 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -491,7 +491,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, t->Image[face][baseLevel]->Width2 != w || t->Image[face][baseLevel]->Height2 != h) { t->_Complete = GL_FALSE; - incomplete(t, "Non-quare cubemap image"); + incomplete(t, "Cube face missing or mismatched size"); return; } } -- cgit v1.2.3 From 908ecb3faa6345392307a1d21b3bef9d5c513f12 Mon Sep 17 00:00:00 2001 From: Robert Noland Date: Wed, 30 Sep 2009 09:36:18 -0700 Subject: util: define PIPE_OS_FREEBSD to correct u_cpu_detect on FreeBSD. Since the various BSDs use some different features here, define PIPE_OS_OPENBSD and PIPE_OS_NETBSD as well Signed-off-by: Robert Noland --- src/gallium/include/pipe/p_config.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/gallium/include/pipe/p_config.h b/src/gallium/include/pipe/p_config.h index 78fe1f4c87..f6feea5f74 100644 --- a/src/gallium/include/pipe/p_config.h +++ b/src/gallium/include/pipe/p_config.h @@ -126,6 +126,19 @@ #endif #if defined(__FreeBSD__) +#define PIPE_OS_FREEBSD +#define PIPE_OS_BSD +#define PIPE_OS_UNIX +#endif + +#if defined(__OpenBSD__) +#define PIPE_OS_OPENBSD +#define PIPE_OS_BSD +#define PIPE_OS_UNIX +#endif + +#if defined(__NetBSD__) +#define PIPE_OS_NETBSD #define PIPE_OS_BSD #define PIPE_OS_UNIX #endif -- cgit v1.2.3 From 0b466c8705c9000c347760b5daafdf31c291736d Mon Sep 17 00:00:00 2001 From: Robert Noland Date: Wed, 30 Sep 2009 10:14:38 -0700 Subject: util: Enable sockets on BSD I think this should be safe for all of the BSDs. Signed-off-by: Robert Noland Signed-off-by: Brian Paul --- src/gallium/auxiliary/util/u_network.c | 6 +++--- src/gallium/auxiliary/util/u_network.h | 2 +- src/gallium/drivers/trace/tr_rbug.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_network.c b/src/gallium/auxiliary/util/u_network.c index bc4b758406..6269c72e12 100644 --- a/src/gallium/auxiliary/util/u_network.c +++ b/src/gallium/auxiliary/util/u_network.c @@ -6,7 +6,7 @@ #if defined(PIPE_SUBSYSTEM_WINDOWS_USER) # include # include -#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) +#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_BSD) # include # include # include @@ -54,7 +54,7 @@ u_socket_close(int s) if (s < 0) return; -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_BSD) shutdown(s, SHUT_RDWR); close(s); #elif defined(PIPE_SUBSYSTEM_WINDOWS_USER) @@ -169,7 +169,7 @@ u_socket_listen_on_port(uint16_t portnum) void u_socket_block(int s, boolean block) { -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) +#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_BSD) int old = fcntl(s, F_GETFL, 0); if (old == -1) return; diff --git a/src/gallium/auxiliary/util/u_network.h b/src/gallium/auxiliary/util/u_network.h index 8c778f492c..0aa898b967 100644 --- a/src/gallium/auxiliary/util/u_network.h +++ b/src/gallium/auxiliary/util/u_network.h @@ -6,7 +6,7 @@ #if defined(PIPE_SUBSYSTEM_WINDOWS_USER) # define PIPE_HAVE_SOCKETS -#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) +#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_HAIKU) || defined(PIPE_OS_BSD) # define PIPE_HAVE_SOCKETS #endif diff --git a/src/gallium/drivers/trace/tr_rbug.c b/src/gallium/drivers/trace/tr_rbug.c index e85ac15edc..81e0a6f3b0 100644 --- a/src/gallium/drivers/trace/tr_rbug.c +++ b/src/gallium/drivers/trace/tr_rbug.c @@ -44,7 +44,7 @@ #if defined(PIPE_SUBSYSTEM_WINDOWS_USER) # define sleep Sleep -#elif defined(PIPE_OS_LINUX) +#elif defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) void usleep(int); # define sleep usleep #else -- cgit v1.2.3 From e32a341be66391e0ea1cc6ce19bbd57997f46b6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 1 Oct 2009 16:45:11 +0200 Subject: st/xorg: Check that ms->api->destroy is not NULL before calling it. Fixes potential crash on X server shutdown. --- src/gallium/state_trackers/xorg/xorg_driver.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 8c4cba035a..4bc87aa613 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -726,8 +726,10 @@ CloseScreen(int scrnIndex, ScreenPtr pScreen) if (ms->exa) xorg_exa_close(pScrn); + if (ms->api->destroy) ms->api->destroy(ms->api); - ms->api = NULL; + ms->api = NULL; + drmClose(ms->fd); ms->fd = -1; -- cgit v1.2.3 From 18883cdf2334511005973155fc517eb678dc0043 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 1 Oct 2009 13:33:20 -0600 Subject: mesa: Return -FLT_MAX instead of 0 for LG2(0). lim x->0 log(x) = -inf so -FLT_MAX is a better approximation than 0 for LG2(0). --- src/mesa/shader/prog_execute.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c index 69b81e724a..192d39aed1 100644 --- a/src/mesa/shader/prog_execute.c +++ b/src/mesa/shader/prog_execute.c @@ -939,7 +939,7 @@ _mesa_execute_program(GLcontext * ctx, /* The fast LOG2 macro doesn't meet the precision requirements. */ if (a[0] == 0.0F) { - val = 0.0F; + val = -FLT_MAX; } else { val = log(a[0]) * 1.442695F; -- cgit v1.2.3 From 495628bc5c3879ee759f9a1bc7e2abc720df75a9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 13:34:49 -0600 Subject: st/mesa: fix non-mipmap lastLevel calculation. reviewed by Brian Paul. (cherry picked from master, commit ae2daacbac7242938cffe0e2409071e030e00863) --- src/mesa/state_tracker/st_cb_texture.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index b13e3774c8..50675b5896 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1775,7 +1775,11 @@ st_finalize_texture(GLcontext *ctx, * incomplete. In that case, we'll have set stObj->lastLevel before * we get here. */ - stObj->lastLevel = stObj->base._MaxLevel - stObj->base.BaseLevel; + if (stObj->base.MinFilter == GL_LINEAR || + stObj->base.MinFilter == GL_NEAREST) + stObj->lastLevel = stObj->base.BaseLevel; + else + stObj->lastLevel = stObj->base._MaxLevel - stObj->base.BaseLevel; } firstImage = st_texture_image(stObj->base.Image[0][stObj->base.BaseLevel]); -- cgit v1.2.3 From b154497bef386e5ed0d9a2f6e25a4141759c6846 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 14:49:04 -0600 Subject: st/mesa: silence hidden parameter warning --- src/mesa/state_tracker/st_cb_drawpixels.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index a9cafbf8cd..c655690603 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -598,15 +598,15 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, /* viewport state: viewport matching window dims */ { - const float width = (float) ctx->DrawBuffer->Width; - const float height = (float) ctx->DrawBuffer->Height; + const float w = (float) ctx->DrawBuffer->Width; + const float h = (float) ctx->DrawBuffer->Height; struct pipe_viewport_state vp; - vp.scale[0] = 0.5f * width; - vp.scale[1] = -0.5f * height; + vp.scale[0] = 0.5f * w; + vp.scale[1] = -0.5f * h; vp.scale[2] = 1.0f; vp.scale[3] = 1.0f; - vp.translate[0] = 0.5f * width; - vp.translate[1] = 0.5f * height; + vp.translate[0] = 0.5f * w; + vp.translate[1] = 0.5f * h; vp.translate[2] = 0.0f; vp.translate[3] = 0.0f; cso_set_viewport(cso, &vp); -- cgit v1.2.3 From b3e41e0d5e03b040768547293e05e6540d3c8e4d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 14:49:34 -0600 Subject: st/mesa: check for null before asserts, fix possible mem leak --- src/mesa/state_tracker/st_cb_fbo.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index fe0a121493..e8399ded7b 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -165,12 +165,12 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, strb->texture, 0, 0, 0, surface_usage ); - - assert(strb->surface->texture); - assert(strb->surface->format); - assert(strb->surface->width == width); - assert(strb->surface->height == height); - + if (strb->surface) { + assert(strb->surface->texture); + assert(strb->surface->format); + assert(strb->surface->width == width); + assert(strb->surface->height == height); + } return strb->surface != NULL; } @@ -298,6 +298,7 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw) default: _mesa_problem(NULL, "Unexpected format in st_new_renderbuffer_fb"); + _mesa_free(strb); return NULL; } -- cgit v1.2.3 From 9b27a0d063402e709ebc588aa3d927d461b96755 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 14:50:45 -0600 Subject: glsl: fix mem leak --- src/mesa/shader/slang/slang_link.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 8f2b40d5df..71038d2d94 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -670,6 +670,7 @@ get_main_shader(GLcontext *ctx, !shader->Main || shader->UnresolvedRefs) { link_error(shProg, "Unresolved symbols"); + _mesa_free_shader(ctx, shader); return NULL; } } -- cgit v1.2.3 From 7b568614a28cb0b0fec375e79aebf51a6f210b44 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 14:51:26 -0600 Subject: mesa: fix potential uninitialized memory reads --- src/mesa/main/dlist.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index b53c1733fb..41a5b61406 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1956,6 +1956,9 @@ save_Fogiv(GLenum pname, const GLint *params) case GL_FOG_END: case GL_FOG_INDEX: p[0] = (GLfloat) *params; + p[1] = 0.0f; + p[2] = 0.0f; + p[3] = 0.0f; break; case GL_FOG_COLOR: p[0] = INT_TO_FLOAT(params[0]); @@ -2244,6 +2247,9 @@ save_LightModeliv(GLenum pname, const GLint *params) case GL_LIGHT_MODEL_TWO_SIDE: case GL_LIGHT_MODEL_COLOR_CONTROL: fparam[0] = (GLfloat) params[0]; + fparam[1] = 0.0F; + fparam[2] = 0.0F; + fparam[3] = 0.0F; break; default: /* Error will be caught later in gl_LightModelfv */ -- cgit v1.2.3 From 63064cf7c3437e3ebb7ab36524f21472af7e47e9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 14:51:43 -0600 Subject: mesa: add missing return when out of memory --- src/mesa/main/context.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index f6d4ac4595..ac6540f4a0 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -898,6 +898,7 @@ _mesa_initialize_context(GLcontext *ctx, _mesa_free_shared_state(ctx, ctx->Shared); if (ctx->Exec) _mesa_free(ctx->Exec); + return GL_FALSE; } #if FEATURE_dispatch _mesa_init_exec_table(ctx->Exec); -- cgit v1.2.3 From 0f291f2efebe6cbdc4ca61e9f05ad6949aede3b9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 14:52:10 -0600 Subject: gallium/util: silence uninitialized var warning --- src/gallium/auxiliary/util/u_gen_mipmap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index 4e3d35f40e..aa823aa218 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -1427,6 +1427,7 @@ set_vertex_data(struct gen_mipmap_state *ctx, rz = -1.0f; break; default: + rx = ry = rz = 0.0f; assert(0); } -- cgit v1.2.3 From 05749542384abc4d4776bfe2a386b6396002e0df Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 14:52:28 -0600 Subject: mesa: fix mem leaks --- src/mesa/shader/prog_optimize.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c index be903106a0..9d937488e3 100644 --- a/src/mesa/shader/prog_optimize.c +++ b/src/mesa/shader/prog_optimize.c @@ -217,6 +217,7 @@ _mesa_remove_dead_code(struct gl_program *prog) if (inst->SrcReg[j].RelAddr) { if (dbg) _mesa_printf("abort remove dead code (indirect temp)\n"); + _mesa_free(removeInst); return; } @@ -232,6 +233,7 @@ _mesa_remove_dead_code(struct gl_program *prog) if (inst->DstReg.RelAddr) { if (dbg) _mesa_printf("abort remove dead code (indirect temp)\n"); + _mesa_free(removeInst); return; } @@ -422,6 +424,8 @@ _mesa_remove_extra_moves(struct gl_program *prog) /* now remove the instructions which aren't needed */ rem = remove_instructions(prog, removeInst); + _mesa_free(removeInst); + if (dbg) { _mesa_printf("Optimize: End remove extra moves. %u instructions removed\n", rem); /*_mesa_print_program(prog);*/ -- cgit v1.2.3 From 167ffa9e035befd12143db909af424e5de8f64e4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 14:55:13 -0600 Subject: mesa: fix memory leak when generating mipmaps for compressed textures --- src/mesa/main/mipmap.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 3dca09d9f2..4d3e62572d 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1510,7 +1510,9 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, /* Find convertFormat - the format that do_row() will process */ if (srcImage->IsCompressed) { - /* setup for compressed textures */ + /* setup for compressed textures - need to allocate temporary + * image buffers to hold uncompressed images. + */ GLuint row; GLint components, size; GLchan *dst; @@ -1587,11 +1589,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, &dstWidth, &dstHeight, &dstDepth); if (!nextLevel) { /* all done */ - if (srcImage->IsCompressed) { - _mesa_free((void *) srcData); - _mesa_free(dstData); - } - return; + break; } /* get dest gl_texture_image */ @@ -1682,6 +1680,12 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, } } /* loop over mipmap levels */ + + if (srcImage->IsCompressed) { + /* free uncompressed image buffers */ + _mesa_free((void *) srcData); + _mesa_free(dstData); + } } -- cgit v1.2.3 From 994d1db079b4947e6f10ab22a4b366a676382345 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 30 Jul 2009 12:32:40 -0700 Subject: i915: Let i915_program_error take a format string, and don't use _mesa_problem. It's misleading to report things like the program having too many native instructions as a Mesa implementation error, when the program may just be too big for the hardware. --- src/mesa/drivers/dri/i915/i915_fragprog.c | 17 ++++++++++------- src/mesa/drivers/dri/i915/i915_program.c | 17 +++++++++++++---- src/mesa/drivers/dri/i915/i915_program.h | 2 +- 3 files changed, 24 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index 2db10c60e9..beed8ef197 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -89,7 +89,8 @@ src_vector(struct i915_fragment_program *p, */ case PROGRAM_TEMPORARY: if (source->Index >= I915_MAX_TEMPORARY) { - i915_program_error(p, "Exceeded max temporary reg"); + i915_program_error(p, "Exceeded max temporary reg: %d/%d", + source->Index, I915_MAX_TEMPORARY); return 0; } src = UREG(REG_TYPE_R, source->Index); @@ -124,7 +125,7 @@ src_vector(struct i915_fragment_program *p, break; default: - i915_program_error(p, "Bad source->Index"); + i915_program_error(p, "Bad source->Index: %d", source->Index); return 0; } break; @@ -153,7 +154,7 @@ src_vector(struct i915_fragment_program *p, break; default: - i915_program_error(p, "Bad source->File"); + i915_program_error(p, "Bad source->File: %d", source->File); return 0; } @@ -186,13 +187,14 @@ get_result_vector(struct i915_fragment_program *p, p->depth_written = 1; return UREG(REG_TYPE_OD, 0); default: - i915_program_error(p, "Bad inst->DstReg.Index"); + i915_program_error(p, "Bad inst->DstReg.Index: %d", + inst->DstReg.Index); return 0; } case PROGRAM_TEMPORARY: return UREG(REG_TYPE_R, inst->DstReg.Index); default: - i915_program_error(p, "Bad inst->DstReg.File"); + i915_program_error(p, "Bad inst->DstReg.File: %d", inst->DstReg.File); return 0; } } @@ -231,7 +233,7 @@ translate_tex_src_target(struct i915_fragment_program *p, GLubyte bit) case TEXTURE_CUBE_INDEX: return D0_SAMPLE_TYPE_CUBE; default: - i915_program_error(p, "TexSrcBit"); + i915_program_error(p, "TexSrcBit: %d", bit); return 0; } } @@ -870,7 +872,8 @@ upload_program(struct i915_fragment_program *p) return; default: - i915_program_error(p, "bad opcode"); + i915_program_error(p, "bad opcode: %s", + _mesa_opcode_string(inst->Opcode)); return; } diff --git a/src/mesa/drivers/dri/i915/i915_program.c b/src/mesa/drivers/dri/i915/i915_program.c index e87700f8e0..85a1b0cf5d 100644 --- a/src/mesa/drivers/dri/i915/i915_program.c +++ b/src/mesa/drivers/dri/i915/i915_program.c @@ -424,12 +424,21 @@ i915_emit_param4fv(struct i915_fragment_program * p, const GLfloat * values) return 0; } - - +/* Warning the user about program errors seems to be quite valuable, from + * our bug reports. It unfortunately means piglit reporting errors + * when we fall back to software due to an unsupportable program, though. + */ void -i915_program_error(struct i915_fragment_program *p, const char *msg) +i915_program_error(struct i915_fragment_program *p, const char *fmt, ...) { - _mesa_problem(NULL, "i915_program_error: %s", msg); + va_list args; + + fprintf(stderr, "i915_program_error: "); + va_start(args, fmt); + vfprintf(stderr, fmt, args); + va_end(args); + + fprintf(stderr, "\n"); p->error = 1; } diff --git a/src/mesa/drivers/dri/i915/i915_program.h b/src/mesa/drivers/dri/i915/i915_program.h index 14a3f08801..1074d24f9e 100644 --- a/src/mesa/drivers/dri/i915/i915_program.h +++ b/src/mesa/drivers/dri/i915/i915_program.h @@ -145,7 +145,7 @@ extern GLuint i915_emit_param4fv(struct i915_fragment_program *p, const GLfloat * values); extern void i915_program_error(struct i915_fragment_program *p, - const char *msg); + const char *fmt, ...); extern void i915_init_program(struct i915_context *i915, struct i915_fragment_program *p); -- cgit v1.2.3 From 4ff816751f74b0645c198372937eec589c458a60 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 29 Jul 2009 22:39:15 -0700 Subject: i915: Bail when the fragment program has too many total instructions. Previously, we'd go trashing the heap. --- src/mesa/drivers/dri/i915/i915_program.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_program.c b/src/mesa/drivers/dri/i915/i915_program.c index 85a1b0cf5d..6ccc9eea3e 100644 --- a/src/mesa/drivers/dri/i915/i915_program.c +++ b/src/mesa/drivers/dri/i915/i915_program.c @@ -186,6 +186,11 @@ i915_emit_arith(struct i915_fragment_program * p, p->utemp_flag = old_utemp_flag; /* restore */ } + if (p->csr >= p->program + I915_PROGRAM_SIZE) { + i915_program_error(p, "Program contains too many instructions"); + return UREG_BAD; + } + *(p->csr++) = (op | A0_DEST(dest) | mask | saturate | A0_SRC0(src0)); *(p->csr++) = (A1_SRC0(src0) | A1_SRC1(src1)); *(p->csr++) = (A2_SRC1(src1) | A2_SRC2(src2)); @@ -270,6 +275,11 @@ GLuint i915_emit_texld( struct i915_fragment_program *p, p->register_phases[GET_UREG_NR(coord)] == p->nr_tex_indirect) p->nr_tex_indirect++; + if (p->csr >= p->program + I915_PROGRAM_SIZE) { + i915_program_error(p, "Program contains too many instructions"); + return UREG_BAD; + } + *(p->csr++) = (op | T0_DEST( dest ) | T0_SAMPLER( sampler )); -- cgit v1.2.3 From d6fbf87575a59e24c5d47b8b6b8700ee4583709b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 29 Jul 2009 22:46:14 -0700 Subject: Revert "i915: don't validate PS program when falling back to software" This reverts commit e7044d552c6d16389447880b8744a51de1cf0199. It prevented the driver from ever recovering from a software fallback due to a program error. The original bug it claimed to fix doesn't appear to exist post-revert. --- src/mesa/drivers/dri/i915/i915_vtbl.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index 9a723d3cd7..9e2523932f 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -54,8 +54,7 @@ i915_render_prevalidate(struct intel_context *intel) { struct i915_context *i915 = i915_context(&intel->ctx); - if (!intel->Fallback) - i915ValidateFragmentProgram(i915); + i915ValidateFragmentProgram(i915); } static void -- cgit v1.2.3 From 61b512c47c9888f3ff117faf3aceccfb52d59c3a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 29 Jul 2009 23:37:04 -0700 Subject: i915: Update and translate the fragment program along with state updates. Previously, we were doing it in the midst of the pipeline run, which gave an opportunity to enable/disable fallbacks, which is certainly the wrong time to be doing so. This manifested itself in a NULL dereference for PutRow after transitioning out of a fallback during a run_pipeline in glean glsl1. --- src/mesa/drivers/dri/i915/i915_context.c | 3 +++ src/mesa/drivers/dri/i915/i915_fragprog.c | 32 +++++++++++++++++++++---------- src/mesa/drivers/dri/i915/i915_program.c | 2 -- src/mesa/drivers/dri/i915/i915_program.h | 3 +-- 4 files changed, 26 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 3ab7d682ee..b342503772 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -40,6 +40,7 @@ #include "utils.h" #include "i915_reg.h" +#include "i915_program.h" #include "intel_regions.h" #include "intel_batchbuffer.h" @@ -80,6 +81,8 @@ i915InvalidateState(GLcontext * ctx, GLuint new_state) i915_update_stencil(ctx); if (new_state & (_NEW_LIGHT)) i915_update_provoking_vertex(ctx); + if (new_state & (_NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS)) + i915_update_program(ctx); } diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index beed8ef197..929a6eb835 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -1058,6 +1058,28 @@ i915ProgramStringNotify(GLcontext * ctx, _tnl_program_string(ctx, target, prog); } +void +i915_update_program(GLcontext *ctx) +{ + struct intel_context *intel = intel_context(ctx); + struct i915_context *i915 = i915_context(&intel->ctx); + struct i915_fragment_program *fp = + (struct i915_fragment_program *) ctx->FragmentProgram._Current; + + if (i915->current_program != fp) { + if (i915->current_program) { + i915->current_program->on_hardware = 0; + i915->current_program->params_uptodate = 0; + } + + i915->current_program = fp; + } + + if (!fp->translated) + translate_program(fp); + + FALLBACK(&i915->intel, I915_FALLBACK_PROGRAM, fp->error); +} void i915ValidateFragmentProgram(struct i915_context *i915) @@ -1075,16 +1097,6 @@ i915ValidateFragmentProgram(struct i915_context *i915) GLuint s2 = S2_TEXCOORD_NONE; int i, offset = 0; - if (i915->current_program != p) { - if (i915->current_program) { - i915->current_program->on_hardware = 0; - i915->current_program->params_uptodate = 0; - } - - i915->current_program = p; - } - - /* Important: */ VB->AttribPtr[VERT_ATTRIB_POS] = VB->NdcPtr; diff --git a/src/mesa/drivers/dri/i915/i915_program.c b/src/mesa/drivers/dri/i915/i915_program.c index 6ccc9eea3e..fd3019b234 100644 --- a/src/mesa/drivers/dri/i915/i915_program.c +++ b/src/mesa/drivers/dri/i915/i915_program.c @@ -530,8 +530,6 @@ i915_upload_program(struct i915_context *i915, GLuint program_size = p->csr - p->program; GLuint decl_size = p->decl - p->declarations; - FALLBACK(&i915->intel, I915_FALLBACK_PROGRAM, p->error); - /* Could just go straight to the batchbuffer from here: */ if (i915->state.ProgramSize != (program_size + decl_size) || diff --git a/src/mesa/drivers/dri/i915/i915_program.h b/src/mesa/drivers/dri/i915/i915_program.h index 1074d24f9e..0d17d04865 100644 --- a/src/mesa/drivers/dri/i915/i915_program.h +++ b/src/mesa/drivers/dri/i915/i915_program.h @@ -155,7 +155,6 @@ extern void i915_upload_program(struct i915_context *i915, extern void i915_fini_program(struct i915_fragment_program *p); - - +extern void i915_update_program(GLcontext *ctx); #endif -- cgit v1.2.3 From 96a3c69d48bb7c021181e061d010cca08198ae4c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 30 Jul 2009 00:03:21 -0700 Subject: i915: Increase maximum program size to the hardware limits. This fixes potential heap trashing if the program of choice exceeds limits, and fixes the native instructions limit being lower than what can be used by valid programs. --- src/mesa/drivers/dri/i915/i915_context.h | 15 ++++++++++----- src/mesa/drivers/dri/i915/i915_program.c | 8 ++++++-- 2 files changed, 16 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_context.h b/src/mesa/drivers/dri/i915/i915_context.h index 8de4a9d0d3..082d614442 100644 --- a/src/mesa/drivers/dri/i915/i915_context.h +++ b/src/mesa/drivers/dri/i915/i915_context.h @@ -121,10 +121,14 @@ enum { #define I915_MAX_CONSTANT 32 #define I915_CONSTANT_SIZE (2+(4*I915_MAX_CONSTANT)) +#define I915_MAX_INSN (I915_MAX_DECL_INSN + \ + I915_MAX_TEX_INSN + \ + I915_MAX_ALU_INSN) -#define I915_PROGRAM_SIZE 192 - -#define I915_MAX_INSN (I915_MAX_TEX_INSN+I915_MAX_ALU_INSN) +/* Maximum size of the program packet, which matches the limits on + * decl, tex, and ALU instructions. + */ +#define I915_PROGRAM_SIZE (I915_MAX_INSN * 3 + 1) /* Hardware version of a parsed fragment program. "Derived" from the * mesa fragment_program struct. @@ -154,8 +158,9 @@ struct i915_fragment_program */ GLcontext *ctx; - GLuint declarations[I915_PROGRAM_SIZE]; - GLuint program[I915_PROGRAM_SIZE]; + /* declarations contains the packet header. */ + GLuint declarations[I915_MAX_DECL_INSN * 3 + 1]; + GLuint program[(I915_MAX_TEX_INSN + I915_MAX_ALU_INSN) * 3]; GLfloat constant[I915_MAX_CONSTANT][4]; GLuint constant_flags[I915_MAX_CONSTANT]; diff --git a/src/mesa/drivers/dri/i915/i915_program.c b/src/mesa/drivers/dri/i915/i915_program.c index fd3019b234..e7908bd48f 100644 --- a/src/mesa/drivers/dri/i915/i915_program.c +++ b/src/mesa/drivers/dri/i915/i915_program.c @@ -130,6 +130,7 @@ i915_emit_decl(struct i915_fragment_program *p, *(p->decl++) = (D0_DCL | D0_DEST(reg) | d0_flags); *(p->decl++) = D1_MBZ; *(p->decl++) = D2_MBZ; + assert(p->decl <= p->declarations + ARRAY_SIZE(p->declarations)); p->nr_decl_insn++; return reg; @@ -186,7 +187,7 @@ i915_emit_arith(struct i915_fragment_program * p, p->utemp_flag = old_utemp_flag; /* restore */ } - if (p->csr >= p->program + I915_PROGRAM_SIZE) { + if (p->csr >= p->program + ARRAY_SIZE(p->program)) { i915_program_error(p, "Program contains too many instructions"); return UREG_BAD; } @@ -275,7 +276,7 @@ GLuint i915_emit_texld( struct i915_fragment_program *p, p->register_phases[GET_UREG_NR(coord)] == p->nr_tex_indirect) p->nr_tex_indirect++; - if (p->csr >= p->program + I915_PROGRAM_SIZE) { + if (p->csr >= p->program + ARRAY_SIZE(p->program)) { i915_program_error(p, "Program contains too many instructions"); return UREG_BAD; } @@ -530,6 +531,9 @@ i915_upload_program(struct i915_context *i915, GLuint program_size = p->csr - p->program; GLuint decl_size = p->decl - p->declarations; + if (p->error) + return; + /* Could just go straight to the batchbuffer from here: */ if (i915->state.ProgramSize != (program_size + decl_size) || -- cgit v1.2.3 From 7d4b7460b0e565d0574c00d1d40c426cfebc290d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 29 Jul 2009 12:15:14 -0700 Subject: i915: Enable ARB_vertex_shader for both i915 and i830. Since the TNL is all done in software anyway, it should be the same to the user who's probably using ARB_vertex_program otherwise, but gives them a nicer programming environment. --- src/mesa/drivers/dri/i915/intel_tris.c | 2 ++ src/mesa/drivers/dri/intel/intel_extensions.c | 8 +++--- src/mesa/drivers/dri/intel/intel_span.c | 37 +++++++++++++++++++++++++++ src/mesa/drivers/dri/intel/intel_span.h | 2 ++ 4 files changed, 45 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c index a905455342..0641e6df9d 100644 --- a/src/mesa/drivers/dri/i915/intel_tris.c +++ b/src/mesa/drivers/dri/i915/intel_tris.c @@ -1076,7 +1076,9 @@ intelRunPipeline(GLcontext * ctx) intel->NewGLState = 0; } + intel_map_vertex_shader_textures(ctx); _tnl_run_pipeline(ctx); + intel_unmap_vertex_shader_textures(ctx); _mesa_unlock_context_textures(ctx); } diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index 5431cf90a1..f10eda7cc7 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -80,6 +80,9 @@ static const struct dri_extension card_extensions[] = { { "GL_ARB_multitexture", NULL }, { "GL_ARB_point_parameters", GL_ARB_point_parameters_functions }, { "GL_ARB_point_sprite", NULL }, + { "GL_ARB_shader_objects", GL_ARB_shader_objects_functions }, + { "GL_ARB_shading_language_100", GL_VERSION_2_0_functions }, + { "GL_ARB_shading_language_120", GL_VERSION_2_1_functions }, { "GL_ARB_sync", GL_ARB_sync_functions }, { "GL_ARB_texture_border_clamp", NULL }, { "GL_ARB_texture_cube_map", NULL }, @@ -91,6 +94,7 @@ static const struct dri_extension card_extensions[] = { { "GL_ARB_texture_rectangle", NULL }, { "GL_ARB_vertex_array_object", GL_ARB_vertex_array_object_functions}, { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions }, + { "GL_ARB_vertex_shader", GL_ARB_vertex_shader_functions }, { "GL_ARB_window_pos", GL_ARB_window_pos_functions }, { "GL_EXT_blend_color", GL_EXT_blend_color_functions }, { "GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions }, @@ -150,13 +154,9 @@ static const struct dri_extension brw_extensions[] = { { "GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions }, { "GL_ARB_point_sprite", NULL }, { "GL_ARB_seamless_cube_map", NULL }, - { "GL_ARB_shader_objects", GL_ARB_shader_objects_functions }, - { "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 }, { "GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions }, { "GL_EXT_texture_sRGB", NULL }, diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 28eabbc005..dcfcad1d95 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -558,6 +558,43 @@ intelInitSpanFuncs(GLcontext * ctx) swdd->SpanRenderFinish = intelSpanRenderFinish; } +void +intel_map_vertex_shader_textures(GLcontext *ctx) +{ + struct intel_context *intel = intel_context(ctx); + int i; + + if (ctx->VertexProgram._Current == NULL) + return; + + for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) { + if (ctx->Texture.Unit[i]._ReallyEnabled && + ctx->VertexProgram._Current->Base.TexturesUsed[i] != 0) { + struct gl_texture_object *texObj = ctx->Texture.Unit[i]._Current; + + intel_tex_map_images(intel, intel_texture_object(texObj)); + } + } +} + +void +intel_unmap_vertex_shader_textures(GLcontext *ctx) +{ + struct intel_context *intel = intel_context(ctx); + int i; + + if (ctx->VertexProgram._Current == NULL) + return; + + for (i = 0; i < ctx->Const.MaxTextureImageUnits; i++) { + if (ctx->Texture.Unit[i]._ReallyEnabled && + ctx->VertexProgram._Current->Base.TexturesUsed[i] != 0) { + struct gl_texture_object *texObj = ctx->Texture.Unit[i]._Current; + + intel_tex_unmap_images(intel, intel_texture_object(texObj)); + } + } +} /** * Plug in appropriate span read/write functions for the given renderbuffer. diff --git a/src/mesa/drivers/dri/intel/intel_span.h b/src/mesa/drivers/dri/intel/intel_span.h index acbeb4abe1..bffe109aa5 100644 --- a/src/mesa/drivers/dri/intel/intel_span.h +++ b/src/mesa/drivers/dri/intel/intel_span.h @@ -36,5 +36,7 @@ void intel_renderbuffer_map(struct intel_context *intel, struct gl_renderbuffer *rb); void intel_renderbuffer_unmap(struct intel_context *intel, struct gl_renderbuffer *rb); +void intel_map_vertex_shader_textures(GLcontext *ctx); +void intel_unmap_vertex_shader_textures(GLcontext *ctx); #endif -- cgit v1.2.3 From f9f31b25740887373806cb489e5480dc9b261805 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 1 Oct 2009 14:00:28 -0700 Subject: i915: Add support for varying inputs. --- src/mesa/drivers/dri/i915/i915_context.c | 2 +- src/mesa/drivers/dri/i915/i915_fragprog.c | 23 ++++++++++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index b342503772..7d4c7cfbab 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -142,7 +142,7 @@ i915CreateContext(const __GLcontextModes * mesaVis, ctx->Const.MaxTextureUnits = I915_TEX_UNITS; ctx->Const.MaxTextureImageUnits = I915_TEX_UNITS; ctx->Const.MaxTextureCoordUnits = I915_TEX_UNITS; - + ctx->Const.MaxVarying = I915_TEX_UNITS; /* Advertise the full hardware capabilities. The new memory * manager should cope much better with overload situations: diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index 929a6eb835..66db7e1645 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -122,6 +122,19 @@ src_vector(struct i915_fragment_program *p, src = i915_emit_decl(p, REG_TYPE_T, T_TEX0 + (source->Index - FRAG_ATTRIB_TEX0), D0_CHANNEL_ALL); + break; + + case FRAG_ATTRIB_VAR0: + case FRAG_ATTRIB_VAR0 + 1: + case FRAG_ATTRIB_VAR0 + 2: + case FRAG_ATTRIB_VAR0 + 3: + case FRAG_ATTRIB_VAR0 + 4: + case FRAG_ATTRIB_VAR0 + 5: + case FRAG_ATTRIB_VAR0 + 6: + case FRAG_ATTRIB_VAR0 + 7: + src = i915_emit_decl(p, REG_TYPE_T, + T_TEX0 + (source->Index - FRAG_ATTRIB_VAR0), + D0_CHANNEL_ALL); break; default: @@ -909,7 +922,7 @@ check_wpos(struct i915_fragment_program *p) p->wpos_tex = -1; for (i = 0; i < p->ctx->Const.MaxTextureCoordUnits; i++) { - if (inputs & FRAG_BIT_TEX(i)) + if (inputs & (FRAG_BIT_TEX(i) | FRAG_BIT_VAR(i))) continue; else if (inputs & FRAG_BIT_WPOS) { p->wpos_tex = i; @@ -1140,6 +1153,14 @@ i915ValidateFragmentProgram(struct i915_context *i915) EMIT_ATTR(_TNL_ATTRIB_TEX0 + i, EMIT_SZ(sz), 0, sz * 4); } + else if (inputsRead & FRAG_BIT_VAR(i)) { + int sz = VB->AttribPtr[_TNL_ATTRIB_GENERIC0 + i]->size; + + s2 &= ~S2_TEXCOORD_FMT(i, S2_TEXCOORD_FMT0_MASK); + s2 |= S2_TEXCOORD_FMT(i, SZ_TO_HW(sz)); + + EMIT_ATTR(_TNL_ATTRIB_GENERIC0 + i, EMIT_SZ(sz), 0, sz * 4); + } else if (i == p->wpos_tex) { /* If WPOS is required, duplicate the XYZ position data in an -- cgit v1.2.3 From 67f4d626d39f2c340fa1632d3e4344c547301508 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 29 Jul 2009 20:44:39 -0700 Subject: i915: Add support or fallbacks for GLSL fragment shader opcodes. --- src/mesa/drivers/dri/i915/i915_fragprog.c | 162 +++++++++++++++++++++++++++++- 1 file changed, 158 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index 66db7e1645..d5659e762f 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -366,7 +366,7 @@ upload_program(struct i915_fragment_program *p) while (1) { GLuint src0, src1, src2, flags; - GLuint tmp = 0, consts0 = 0, consts1 = 0; + GLuint tmp = 0, dst, consts0 = 0, consts1 = 0; switch (inst->Opcode) { case OPCODE_ABS: @@ -518,6 +518,10 @@ upload_program(struct i915_fragment_program *p) EMIT_1ARG_ARITH(A0_FLR); break; + case OPCODE_TRUNC: + EMIT_1ARG_ARITH(A0_TRC); + break; + case OPCODE_FRC: EMIT_1ARG_ARITH(A0_FRC); break; @@ -531,6 +535,22 @@ upload_program(struct i915_fragment_program *p) 0, src0, T0_TEXKILL); break; + case OPCODE_KIL_NV: + if (inst->DstReg.CondMask == COND_TR) { + tmp = i915_get_utemp(p); + + i915_emit_texld(p, get_live_regs(p, inst), + tmp, A0_DEST_CHANNEL_ALL, + 0, /* use a dummy dest reg */ + swizzle(tmp, ONE, ONE, ONE, ONE), /* always */ + T0_TEXKILL); + } else { + p->error = 1; + i915_program_error(p, "Unsupported KIL_NV condition code: %d", + inst->DstReg.CondMask); + } + break; + case OPCODE_LG2: src0 = src_vector(p, &inst->SrcReg[0], program); @@ -630,6 +650,20 @@ upload_program(struct i915_fragment_program *p) EMIT_2ARG_ARITH(A0_MUL); break; + case OPCODE_NOISE1: + case OPCODE_NOISE2: + case OPCODE_NOISE3: + case OPCODE_NOISE4: + /* Don't implement noise because we just don't have the instructions + * to spare. We aren't the first vendor to do so. + */ + i915_program_error(p, "Stubbed-out noise functions"); + i915_emit_arith(p, + A0_MOV, + get_result_vector(p, inst), + get_result_flags(inst), 0, + swizzle(src0, ZERO, ZERO, ZERO, ZERO), 0, 0); + case OPCODE_POW: src0 = src_vector(p, &inst->SrcReg[0], program); src1 = src_vector(p, &inst->SrcReg[1], program); @@ -736,9 +770,38 @@ upload_program(struct i915_fragment_program *p) } break; - case OPCODE_SGE: - EMIT_2ARG_ARITH(A0_SGE); - break; + case OPCODE_SEQ: + tmp = i915_get_utemp(p); + flags = get_result_flags(inst); + dst = get_result_vector(p, inst); + + /* dst = src1 >= src2 */ + i915_emit_arith(p, + A0_SGE, + dst, + flags, 0, + src_vector(p, &inst->SrcReg[0], program), + src_vector(p, &inst->SrcReg[1], program), + 0); + /* tmp = src1 <= src2 */ + i915_emit_arith(p, + A0_SGE, + tmp, + flags, 0, + negate(src_vector(p, &inst->SrcReg[0], program), + 1, 1, 1, 1), + negate(src_vector(p, &inst->SrcReg[1], program), + 1, 1, 1, 1), + 0); + /* dst = tmp && dst */ + i915_emit_arith(p, + A0_MUL, + dst, + flags, 0, + dst, + tmp, + 0); + break; case OPCODE_SIN: src0 = src_vector(p, &inst->SrcReg[0], program); @@ -824,10 +887,71 @@ upload_program(struct i915_fragment_program *p) break; + case OPCODE_SGE: + EMIT_2ARG_ARITH(A0_SGE); + break; + + case OPCODE_SGT: + i915_emit_arith(p, + A0_SLT, + get_result_vector( p, inst ), + get_result_flags( inst ), 0, + negate(src_vector( p, &inst->SrcReg[0], program), + 1, 1, 1, 1), + negate(src_vector( p, &inst->SrcReg[1], program), + 1, 1, 1, 1), + 0); + break; + + case OPCODE_SLE: + i915_emit_arith(p, + A0_SGE, + get_result_vector( p, inst ), + get_result_flags( inst ), 0, + negate(src_vector( p, &inst->SrcReg[0], program), + 1, 1, 1, 1), + negate(src_vector( p, &inst->SrcReg[1], program), + 1, 1, 1, 1), + 0); + break; + case OPCODE_SLT: EMIT_2ARG_ARITH(A0_SLT); break; + case OPCODE_SNE: + tmp = i915_get_utemp(p); + flags = get_result_flags(inst); + dst = get_result_vector(p, inst); + + /* dst = src1 < src2 */ + i915_emit_arith(p, + A0_SLT, + dst, + flags, 0, + src_vector(p, &inst->SrcReg[0], program), + src_vector(p, &inst->SrcReg[1], program), + 0); + /* tmp = src1 > src2 */ + i915_emit_arith(p, + A0_SLT, + tmp, + flags, 0, + negate(src_vector(p, &inst->SrcReg[0], program), + 1, 1, 1, 1), + negate(src_vector(p, &inst->SrcReg[1], program), + 1, 1, 1, 1), + 0); + /* dst = tmp || dst */ + i915_emit_arith(p, + A0_ADD, + dst, + flags | A0_DEST_SATURATE, 0, + dst, + tmp, + 0); + break; + case OPCODE_SUB: src0 = src_vector(p, &inst->SrcReg[0], program); src1 = src_vector(p, &inst->SrcReg[1], program); @@ -884,6 +1008,36 @@ upload_program(struct i915_fragment_program *p) case OPCODE_END: return; + case OPCODE_BGNLOOP: + case OPCODE_BGNSUB: + case OPCODE_BRA: + case OPCODE_BRK: + case OPCODE_CAL: + case OPCODE_CONT: + case OPCODE_DDX: + case OPCODE_DDY: + case OPCODE_ELSE: + case OPCODE_ENDIF: + case OPCODE_ENDLOOP: + case OPCODE_ENDSUB: + case OPCODE_IF: + case OPCODE_RET: + p->error = 1; + i915_program_error(p, "Unsupported opcode: %s", + _mesa_opcode_string(inst->Opcode)); + return; + + case OPCODE_EXP: + case OPCODE_LOG: + /* These opcodes are claimed as GLSL, NV_vp, and ARB_vp in + * prog_instruction.h, but apparently GLSL doesn't ever emit them. + * Instead, it translates to EX2 or LG2. + */ + case OPCODE_TXD: + case OPCODE_TXL: + /* These opcodes are claimed by GLSL in prog_instruction.h, but + * only NV_vp/fp appears to emit them. + */ default: i915_program_error(p, "bad opcode: %s", _mesa_opcode_string(inst->Opcode)); -- cgit v1.2.3 From 862a2a55b35d1dec9224b025a6e7a0cf8593a6a7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 29 Jul 2009 13:00:09 -0700 Subject: i915: Add optional support for ARB_fragment_shader under a driconf option. Other vendors have enabled ARB_fragment_shader as part of OpenGL 2.0 enablement even on hardware like the 915 with no dynamic branching or dFdx/dFdy support. But for now we'll leave it disabled because we don't do any flattening of ifs or loops, which is rather restrictive. This support is not complete, and may be unstable depending on your shaders. It passes 10/15 of the piglit glsl tests, but hangs on glean glsl1. --- src/mesa/drivers/dri/i915/i915_fragprog.c | 1 + src/mesa/drivers/dri/intel/intel_context.h | 1 - src/mesa/drivers/dri/intel/intel_extensions.c | 10 +++++++++- src/mesa/drivers/dri/intel/intel_screen.c | 6 +++++- 4 files changed, 15 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index d5659e762f..d9c61446f5 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -160,6 +160,7 @@ src_vector(struct i915_fragment_program *p, case PROGRAM_CONSTANT: case PROGRAM_STATE_VAR: case PROGRAM_NAMED_PARAM: + case PROGRAM_UNIFORM: src = i915_emit_param4fv(p, program->Base.Parameters->ParameterValues[source-> diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index c743ab1c24..b104096912 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -293,7 +293,6 @@ struct intel_context GLboolean use_texture_tiling; GLboolean use_early_z; - drm_clip_rect_t fboRect; /**< cliprect for FBO rendering */ int perf_boxes; diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index f10eda7cc7..6831cbbfc8 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -182,6 +182,10 @@ static const struct dri_extension ttm_extensions[] = { { NULL, NULL } }; +static const struct dri_extension fragment_shader_extensions[] = { + { "GL_ARB_fragment_shader", NULL }, + { NULL, NULL } +}; /** * Initializes potential list of extensions if ctx == NULL, or actually enables @@ -205,6 +209,10 @@ intelInitExtensions(GLcontext *ctx, GLboolean enable_imaging) driInitExtensions(ctx, brw_extensions, GL_FALSE); if (intel == NULL || IS_915(intel->intelScreen->deviceID) - || IS_945(intel->intelScreen->deviceID)) + || IS_945(intel->intelScreen->deviceID)) { driInitExtensions(ctx, i915_extensions, GL_FALSE); + + if (intel == NULL || driQueryOptionb(&intel->optionCache, "fragment_shader")) + driInitExtensions(ctx, fragment_shader_extensions, GL_FALSE); + } } diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 1b8c56e68d..2478e63637 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -79,6 +79,10 @@ PUBLIC const char __driConfigOptions[] = DRI_CONF_DESC(en, "Enable early Z in classic mode (unstable, 945-only).") DRI_CONF_OPT_END + DRI_CONF_OPT_BEGIN(fragment_shader, bool, false) + DRI_CONF_DESC(en, "Enable limited ARB_fragment_shader support on 915/945.") + DRI_CONF_OPT_END + DRI_CONF_SECTION_END DRI_CONF_SECTION_QUALITY DRI_CONF_FORCE_S3TC_ENABLE(false) @@ -91,7 +95,7 @@ PUBLIC const char __driConfigOptions[] = DRI_CONF_SECTION_END DRI_CONF_END; -const GLuint __driNConfigOptions = 10; +const GLuint __driNConfigOptions = 11; #ifdef USE_NEW_INTERFACE static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; -- cgit v1.2.3 From 81aa5d717bd0098608e9cc292b316293800c7e11 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 29 Jul 2009 13:07:49 -0700 Subject: i915: Add stub ARB_occlusion_query support under a driconf debug option. This is useful for enabling our GLSL testcases using the 2.0 entrypoints even though we don't have full GL 2.0. --- src/mesa/drivers/dri/intel/intel_extensions.c | 5 +++++ src/mesa/drivers/dri/intel/intel_screen.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index 6831cbbfc8..2eb08a8f05 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -171,6 +171,7 @@ static const struct dri_extension brw_extensions[] = { static const struct dri_extension arb_oq_extensions[] = { + { "GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions }, { NULL, NULL } }; @@ -214,5 +215,9 @@ intelInitExtensions(GLcontext *ctx, GLboolean enable_imaging) if (intel == NULL || driQueryOptionb(&intel->optionCache, "fragment_shader")) driInitExtensions(ctx, fragment_shader_extensions, GL_FALSE); + + if (intel == NULL || driQueryOptionb(&intel->optionCache, + "stub_occlusion_query")) + driInitExtensions(ctx, arb_oq_extensions, GL_FALSE); } } diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 2478e63637..24f7fbc992 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -92,10 +92,14 @@ PUBLIC const char __driConfigOptions[] = DRI_CONF_NO_RAST(false) DRI_CONF_ALWAYS_FLUSH_BATCH(false) DRI_CONF_ALWAYS_FLUSH_CACHE(false) + + DRI_CONF_OPT_BEGIN(stub_occlusion_query, bool, false) + DRI_CONF_DESC(en, "Enable stub ARB_occlusion_query support on 915/945.") + DRI_CONF_OPT_END DRI_CONF_SECTION_END DRI_CONF_END; -const GLuint __driNConfigOptions = 11; +const GLuint __driNConfigOptions = 12; #ifdef USE_NEW_INTERFACE static PFNGLXCREATECONTEXTMODES create_context_modes = NULL; -- cgit v1.2.3 From 1c7ec97ec47f294dcfc0c6a87ee26bb3565f95d4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 15:59:13 -0600 Subject: mesa: added _mesa_format_image_size() --- src/mesa/main/formats.c | 27 +++++++++++++++++++++++++++ src/mesa/main/formats.h | 4 ++++ 2 files changed, 31 insertions(+) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index dec3daee7c..82843a3291 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -593,6 +593,33 @@ _mesa_is_format_compressed(gl_format format) } +/** + * Return number of bytes needed to store an image of the given size + * in the given format. + */ +GLuint +_mesa_format_image_size(gl_format format, GLsizei width, + GLsizei height, GLsizei depth) +{ + const struct gl_format_info *info = _mesa_get_format_info(format); + if (info->BlockWidth > 1 || info->BlockHeight > 1) { + /* compressed format */ + const GLuint bw = info->BlockWidth, bh = info->BlockHeight; + const GLuint wblocks = (width + bw - 1) / bw; + const GLuint hblocks = (height + bh - 1) / bh; + const GLuint sz = wblocks * hblocks * info->BytesPerBlock; + return sz; + } + else { + /* non-compressed */ + const GLuint sz = width * height * depth * info->BytesPerBlock; + return sz; + } +} + + + + /** * Do sanity checking of the format info table. */ diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 99a6534ff1..b91682809f 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -202,6 +202,10 @@ extern void _mesa_format_to_type_and_comps2(gl_format format, GLenum *datatype, GLuint *comps); +extern GLuint +_mesa_format_image_size(gl_format format, GLsizei width, + GLsizei height, GLsizei depth); + extern void _mesa_test_formats(void); -- cgit v1.2.3 From 040fd7ed44c21a1faaa6475888e9365e8f0de42b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 16:27:23 -0600 Subject: mesa: added _mesa_format_row_stride() --- src/mesa/main/formats.c | 22 +++++++++++++++++++++- src/mesa/main/formats.h | 4 ++++ 2 files changed, 25 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 82843a3291..ebe59f8960 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -602,12 +602,13 @@ _mesa_format_image_size(gl_format format, GLsizei width, GLsizei height, GLsizei depth) { const struct gl_format_info *info = _mesa_get_format_info(format); + /* Strictly speaking, a conditional isn't needed here */ if (info->BlockWidth > 1 || info->BlockHeight > 1) { /* compressed format */ const GLuint bw = info->BlockWidth, bh = info->BlockHeight; const GLuint wblocks = (width + bw - 1) / bw; const GLuint hblocks = (height + bh - 1) / bh; - const GLuint sz = wblocks * hblocks * info->BytesPerBlock; + const GLuint sz = wblocks * hblocks * info->BytesPerBlock; return sz; } else { @@ -619,6 +620,25 @@ _mesa_format_image_size(gl_format format, GLsizei width, +GLint +_mesa_format_row_stride(gl_format format, GLsizei width) +{ + const struct gl_format_info *info = _mesa_get_format_info(format); + /* Strictly speaking, a conditional isn't needed here */ + if (info->BlockWidth > 1 || info->BlockHeight > 1) { + /* compressed format */ + const GLuint bw = info->BlockWidth; + const GLuint wblocks = (width + bw - 1) / bw; + const GLint stride = wblocks * info->BytesPerBlock; + return stride; + } + else { + const GLint stride = width * info->BytesPerBlock; + return stride; + } +} + + /** * Do sanity checking of the format info table. diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index b91682809f..316ff1a8ec 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -206,6 +206,10 @@ extern GLuint _mesa_format_image_size(gl_format format, GLsizei width, GLsizei height, GLsizei depth); +extern GLint +_mesa_format_row_stride(gl_format format, GLsizei width); + + extern void _mesa_test_formats(void); -- cgit v1.2.3 From b6bdafdf2cf1110b4a5ca7cf9e1c3dcb124b800f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 16:29:44 -0600 Subject: mesa: remove gl_texture_image::IsCompressed field Use _mesa_is_format_compressed() instead. --- src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 6 +- src/mesa/drivers/dri/intel/intel_tex_image.c | 7 +- src/mesa/drivers/dri/intel/intel_tex_subimage.c | 2 +- src/mesa/drivers/dri/intel/intel_tex_validate.c | 4 +- src/mesa/drivers/dri/r200/r200_texstate.c | 2 +- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 9 +- src/mesa/drivers/dri/radeon/radeon_texstate.c | 4 +- src/mesa/drivers/dri/radeon/radeon_texture.c | 4 +- src/mesa/drivers/dri/tdfx/tdfx_tex.c | 13 +- src/mesa/drivers/dri/unichrome/via_tex.c | 5 +- src/mesa/drivers/glide/fxddtex.c | 19 +-- src/mesa/main/mipmap.c | 11 +- src/mesa/main/mtypes.h | 1 - src/mesa/main/texgetimage.c | 2 +- src/mesa/main/teximage.c | 6 +- src/mesa/main/texparam.c | 4 +- src/mesa/main/texstore.c | 207 ++++++++++------------- src/mesa/state_tracker/st_cb_texture.c | 5 +- 18 files changed, 140 insertions(+), 171 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 6bb7481ae4..a11869e7e8 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -293,6 +293,8 @@ intel_miptree_match_image(struct intel_mipmap_tree *mt, struct gl_texture_image *image, GLuint face, GLuint level) { + GLboolean isCompressed = _mesa_is_format_compressed(image->TexFormat); + /* Images with borders are never pulled into mipmap trees. */ if (image->Border || @@ -302,10 +304,10 @@ intel_miptree_match_image(struct intel_mipmap_tree *mt, return GL_FALSE; if (image->InternalFormat != mt->internal_format || - image->IsCompressed != mt->compressed) + isCompressed != mt->compressed) return GL_FALSE; - if (!image->IsCompressed && + if (!isCompressed && !mt->compressed && _mesa_get_format_bytes(image->TexFormat) != mt->cpp) return GL_FALSE; diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index bbbeac8f7f..29cca45148 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -125,7 +125,7 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, } assert(!intelObj->mt); - if (intelImage->base.IsCompressed) + if (_mesa_is_format_compressed(intelImage->base.TexFormat)) comp_byte = intel_compressed_num_bytes(intelImage->base.TexFormat); texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat); @@ -339,7 +339,6 @@ intelTexImage(GLcontext * ctx, if (_mesa_is_format_compressed(texImage->TexFormat)) { texelBytes = 0; - texImage->IsCompressed = GL_TRUE; texImage->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, texImage->Width, texImage->Height, texImage->Depth, @@ -405,7 +404,7 @@ intelTexImage(GLcontext * ctx, int comp_byte = 0; GLuint texelBytes = _mesa_get_format_bytes(intelImage->base.TexFormat); GLenum baseFormat = _mesa_get_format_base_format(intelImage->base.TexFormat); - if (intelImage->base.IsCompressed) { + if (_mesa_is_format_compressed(intelImage->base.TexFormat)) { comp_byte = intel_compressed_num_bytes(intelImage->base.TexFormat); } @@ -494,7 +493,7 @@ intelTexImage(GLcontext * ctx, } else { /* Allocate regular memory and store the image there temporarily. */ - if (texImage->IsCompressed) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { sizeInBytes = texImage->CompressedSize; dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width); diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c index bba1b53009..cc329dae58 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c @@ -85,7 +85,7 @@ intelTexSubimage(GLcontext * ctx, &dstRowStride, texImage->ImageOffsets); else { - if (texImage->IsCompressed) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width); assert(dims != 3); diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c index 0296c92523..d5b562f5e5 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_validate.c +++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c @@ -165,7 +165,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) intel_miptree_reference(&intelObj->mt, firstImage->mt); } - if (firstImage->base.IsCompressed) { + if (_mesa_is_format_compressed(firstImage->base.TexFormat)) { comp_byte = intel_compressed_num_bytes(firstImage->base.TexFormat); cpp = comp_byte; } @@ -190,7 +190,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) intelObj->mt->height0 != firstImage->base.Height || intelObj->mt->depth0 != firstImage->base.Depth || intelObj->mt->cpp != cpp || - intelObj->mt->compressed != firstImage->base.IsCompressed)) { + intelObj->mt->compressed != _mesa_is_format_compressed(firstImage->base.TexFormat))) { intel_miptree_release(intel, &intelObj->mt); } diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index daca318684..1a6fa9f548 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -1504,7 +1504,7 @@ static void setup_hardware_state(r200ContextPtr rmesa, radeonTexObj *t) | ((firstImage->Height - 1) << R200_PP_TX_HEIGHTMASK_SHIFT)); if ( !t->image_override ) { - if (firstImage->IsCompressed) + if (_mesa_is_format_compressed(firstImage->TexFormat)) t->pp_txpitch = (firstImage->Width + 63) & ~(63); else t->pp_txpitch = ((firstImage->Width * texelBytes) + 63) & ~(63); diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index b602bfb4b0..5429525587 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -314,16 +314,17 @@ static void calculate_first_last_level(struct gl_texture_object *tObj, GLboolean radeon_miptree_matches_image(radeon_mipmap_tree *mt, struct gl_texture_image *texImage, GLuint face, GLuint level) { + GLboolean isCompressed = _mesa_is_format_compressed(texImage->TexFormat); radeon_mipmap_level *lvl; if (face >= mt->faces || level < mt->firstLevel || level > mt->lastLevel) return GL_FALSE; if (texImage->InternalFormat != mt->internal_format || - texImage->IsCompressed != mt->compressed) + isCompressed != mt->compressed) return GL_FALSE; - if (!texImage->IsCompressed && + if (!isCompressed && !mt->compressed && _mesa_get_format_bytes(texImage->TexFormat) != mt->bpp) return GL_FALSE; @@ -354,7 +355,7 @@ GLboolean radeon_miptree_matches_texture(radeon_mipmap_tree *mt, struct gl_textu numfaces = 6; firstImage = texObj->Image[0][firstLevel]; - compressed = firstImage->IsCompressed ? firstImage->TexFormat : 0; + compressed = _mesa_is_format_compressed(firstImage->TexFormat) ? firstImage->TexFormat : 0; texelBytes = _mesa_get_format_bytes(firstImage->TexFormat); return (mt->firstLevel == firstLevel && @@ -374,7 +375,7 @@ GLboolean radeon_miptree_matches_texture(radeon_mipmap_tree *mt, struct gl_textu void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t, radeon_texture_image *image, GLuint face, GLuint level) { - GLuint compressed = image->base.IsCompressed ? image->base.TexFormat : 0; + GLuint compressed = _mesa_is_format_compressed(image->base.TexFormat) ? image->base.TexFormat : 0; GLuint numfaces = 1; GLuint firstLevel, lastLevel; GLuint texelBytes; diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index 1064602504..5d22a11859 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -81,8 +81,10 @@ struct tx_table { GLuint format, filter; }; +/* XXX verify this table against MESA_FORMAT_x values */ static const struct tx_table tx_table[] = { + 0, /* MESA_FORMAT_NONE */ _ALPHA(RGBA8888), _ALPHA_REV(RGBA8888), _ALPHA(ARGB8888), @@ -1083,7 +1085,7 @@ static GLboolean setup_hardware_state(r100ContextPtr rmesa, radeonTexObj *t, int | ((firstImage->Height - 1) << RADEON_TEX_VSIZE_SHIFT)); if ( !t->image_override ) { - if (firstImage->IsCompressed) + if (_mesa_is_format_compressed(firstImage->TexFormat)) t->pp_txpitch = (firstImage->Width + 63) & ~(63); else t->pp_txpitch = ((firstImage->Width * texelBytes) + 63) & ~(63); diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 0378b3c9fc..442116a2dd 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -546,13 +546,11 @@ static void radeon_teximage( if (_mesa_is_format_compressed(texImage->TexFormat)) { texelBytes = 0; - texImage->IsCompressed = GL_TRUE; texImage->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, texImage->Width, texImage->Height, texImage->Depth, texImage->TexFormat); } else { - texImage->IsCompressed = GL_FALSE; texImage->CompressedSize = 0; texelBytes = _mesa_get_format_bytes(texImage->TexFormat); @@ -590,7 +588,7 @@ static void radeon_teximage( dstRowStride = lvl->rowstride; } else { int size; - if (texImage->IsCompressed) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { size = texImage->CompressedSize; } else { size = texImage->Width * texImage->Height * texImage->Depth * _mesa_get_format_bytes(texImage->TexFormat); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index 427d315a01..8b68137eed 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -191,7 +191,6 @@ tdfxGenerateMipmap(GLcontext *ctx, GLenum target, texImage = _mesa_get_tex_image(ctx, texObj, target, level); texelBytes = _mesa_get_format_bytes(texImage->TexFormat); - assert(!texImage->IsCompressed); mml = TDFX_TEXIMAGE_DATA(texImage); @@ -1233,7 +1232,7 @@ adjust2DRatio (GLcontext *ctx, GLvoid *tempImage; GLuint dstImageOffsets = 0; - if (!texImage->IsCompressed) { + if (!_mesa_is_format_compressed(texImage->TexFormat)) { GLubyte *destAddr; tempImage = MALLOC(width * height * texelBytes); @@ -1366,7 +1365,7 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, * be correct, since it would mess with "compressedSize". * Ditto for GL_RGBA[4]_S3TC, which is always mapped to DXT3. */ - if (texImage->IsCompressed) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { switch (internalFormat) { case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_RGB_S3TC: @@ -1393,7 +1392,7 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, } if (texNapalm) { texImage->InternalFormat = internalFormat = texNapalm; - texImage->IsCompressed = GL_TRUE; + _mesa_is_format_compressed(texImage->TexFormat) = GL_TRUE; } } #endif @@ -1409,7 +1408,7 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, texImage->FetchTexelc = fxFetchFunction(mesaFormat); texelBytes = _mesa_get_format_bytes(texImage->TexFormat); - if (texImage->IsCompressed) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { texImage->CompressedSize = _mesa_compressed_texture_size(ctx, mml->width, mml->height, @@ -1492,7 +1491,7 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, assert(texImage->_BaseFormat); texelBytes = _mesa_get_format_bytes(texImage->TexFormat); - if (texImage->IsCompressed) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, mml->width); } else { dstRowStride = mml->width * texelBytes; @@ -1594,8 +1593,6 @@ tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target, return; } - assert(texImage->IsCompressed); - ti = TDFX_TEXTURE_DATA(texObj); if (!ti) { texObj->DriverData = fxAllocTexObjData(fxMesa); diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index b6be06d1ee..a4cf5466fd 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -696,7 +696,6 @@ static void viaTexImage(GLcontext *ctx, if (texelBytes == 0) { /* compressed format */ - texImage->IsCompressed = GL_TRUE; texImage->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, texImage->Width, texImage->Height, texImage->Depth, @@ -713,7 +712,7 @@ static void viaTexImage(GLcontext *ctx, viaImage->pitchLog2 = logbase2(postConvWidth * texelBytes); /* allocate memory */ - if (texImage->IsCompressed) + if (_mesa_is_format_compressed(texImage->TexFormat)) sizeInBytes = texImage->CompressedSize; else sizeInBytes = postConvWidth * postConvHeight * texelBytes; @@ -793,7 +792,7 @@ static void viaTexImage(GLcontext *ctx, GLint dstRowStride; GLboolean success; - if (texImage->IsCompressed) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width); } else { diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index a64b6a5553..a820cb818e 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -1234,7 +1234,7 @@ adjust2DRatio (GLcontext *ctx, const GLint newHeight = height * mml->hScale; GLvoid *tempImage; - if (!texImage->IsCompressed) { + if (!_mesa_is_format_compressed(texImage->TexFormat)) { GLubyte *destAddr; tempImage = MALLOC(width * height * texelBytes); @@ -1353,7 +1353,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, #if FX_COMPRESS_S3TC_AS_FXT1_HACK /* [koolsmoky] substitute FXT1 for DXTn and Legacy S3TC */ - if (!ctx->Mesa_DXTn && texImage->IsCompressed) { + if (!ctx->Mesa_DXTn && _mesa_is_format_compressed(texImage->TexFormat)) { switch (internalFormat) { case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_RGB_S3TC: @@ -1380,7 +1380,6 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, } if (texNapalm) { texImage->InternalFormat = internalFormat = texNapalm; - texImage->IsCompressed = GL_TRUE; } } #endif @@ -1397,7 +1396,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, /* allocate mipmap buffer */ assert(!texImage->Data); - if (texImage->IsCompressed) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { texImage->CompressedSize = _mesa_compressed_texture_size(ctx, mml->width, mml->height, @@ -1451,7 +1450,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; const GLint maxLevels = _mesa_max_texture_levels(ctx, texObj->Target); - assert(!texImage->IsCompressed); + assert(!_mesa_is_format_compressed(texImage->TexFormat)); while (level < texObj->MaxLevel && level < maxLevels - 1) { mipWidth = width / 2; @@ -1523,7 +1522,7 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, assert(texImage->_BaseFormat); texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); - if (texImage->IsCompressed) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { dstRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, mml->width); } else { dstRowStride = mml->width * texelBytes; @@ -1564,7 +1563,7 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; const GLint maxLevels = _mesa_max_texture_levels(ctx, texObj->Target); - assert(!texImage->IsCompressed); + assert(!_mesa_is_format_compressed(texImage->TexFormat)); width = texImage->Width; height = texImage->Height; @@ -1620,7 +1619,7 @@ fxDDCompressedTexImage2D (GLcontext *ctx, GLenum target, width, height); } - assert(texImage->IsCompressed); + assert(_mesa_is_format_compressed(texImage->TexFormat)); if (!fxIsTexSupported(target, internalFormat, texImage)) { _mesa_problem(NULL, "fx Driver: unsupported texture in fxDDCompressedTexImg()\n"); @@ -1712,7 +1711,7 @@ fxDDCompressedTexImage2D (GLcontext *ctx, GLenum target, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - assert(!texImage->IsCompressed); + assert(!_mesa_is_format_compressed(texImage->TexFormat)); } fxTexInvalidate(ctx, texObj); @@ -1777,7 +1776,7 @@ fxDDCompressedTexSubImage2D( GLcontext *ctx, GLenum target, /* GL_SGIS_generate_mipmap */ if (level == texObj->BaseLevel && texObj->GenerateMipmap) { - assert(!texImage->IsCompressed); + assert(!_mesa_is_format_compressed(texImage->TexFormat)); } if (ti->validated && ti->isInTM) diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index ccd153303d..f6d6ce33c8 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1511,7 +1511,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, ASSERT(maxLevels > 0); /* bad target */ /* Find convertFormat - the format that do_row() will process */ - if (srcImage->IsCompressed) { + if (_mesa_is_format_compressed(srcImage->TexFormat)) { /* setup for compressed textures */ GLuint row; GLint components, size; @@ -1589,7 +1589,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, &dstWidth, &dstHeight, &dstDepth); if (!nextLevel) { /* all done */ - if (srcImage->IsCompressed) { + if (_mesa_is_format_compressed(srcImage->TexFormat)) { _mesa_free((void *) srcData); _mesa_free(dstData); } @@ -1614,8 +1614,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, dstImage->TexFormat = srcImage->TexFormat; dstImage->FetchTexelc = srcImage->FetchTexelc; dstImage->FetchTexelf = srcImage->FetchTexelf; - dstImage->IsCompressed = srcImage->IsCompressed; - if (dstImage->IsCompressed) { + if (_mesa_is_format_compressed(dstImage->TexFormat)) { dstImage->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, dstImage->Width, dstImage->Height, @@ -1631,7 +1630,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, /* Alloc new teximage data buffer. * Setup src and dest data pointers. */ - if (dstImage->IsCompressed) { + if (_mesa_is_format_compressed(dstImage->TexFormat)) { dstImage->Data = _mesa_alloc_texmemory(dstImage->CompressedSize); if (!dstImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); @@ -1661,7 +1660,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, dstData, dstImage->RowStride); - if (dstImage->IsCompressed) { + if (_mesa_is_format_compressed(dstImage->TexFormat)) { GLubyte *temp; /* compress image from dstData into dstImage->Data */ const GLenum srcFormat = _mesa_get_format_base_format(convertFormat); diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 1599a6f13f..f084edb840 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1173,7 +1173,6 @@ struct gl_texture_image FetchTexelFuncC FetchTexelc; /**< GLchan texel fetch function pointer */ FetchTexelFuncF FetchTexelf; /**< Float texel fetch function pointer */ - GLboolean IsCompressed; /**< GL_ARB_texture_compression */ GLuint CompressedSize; /**< GL_ARB_texture_compression */ GLuint RowStride; /**< Padded width in units of texels */ diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index e9e408d8c5..3e3951b1c4 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -567,7 +567,7 @@ _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) { texImage = _mesa_select_tex_image(ctx, texObj, target, level); if (texImage) { - if (texImage->IsCompressed) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { /* this typically calls _mesa_get_compressed_teximage() */ ctx->Driver.GetCompressedTexImage(ctx, target, level, img, texObj, texImage); diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index c4e5ce2682..86f46b9551 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -903,7 +903,6 @@ clear_teximage_fields(struct gl_texture_image *img) img->TexFormat = MESA_FORMAT_NONE; img->FetchTexelc = NULL; img->FetchTexelf = NULL; - img->IsCompressed = 0; img->CompressedSize = 0; } @@ -967,7 +966,6 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2); - img->IsCompressed = GL_FALSE; img->CompressedSize = 0; if ((width == 1 || _mesa_is_pow_two(img->Width2)) && @@ -1589,7 +1587,7 @@ subtexture_error_check2( GLcontext *ctx, GLuint dimensions, } #endif - if (destTex->IsCompressed) { + if (_mesa_is_format_compressed(destTex->TexFormat)) { if (!target_can_be_compressed(ctx, target)) { _mesa_error(ctx, GL_INVALID_ENUM, "glTexSubImage%D(target)", dimensions); @@ -1951,7 +1949,7 @@ copytexsubimage_error_check2( GLcontext *ctx, GLuint dimensions, } } - if (teximage->IsCompressed) { + if (_mesa_is_format_compressed(teximage->TexFormat)) { if (!target_can_be_compressed(ctx, target)) { _mesa_error(ctx, GL_INVALID_ENUM, "glCopyTexSubImage%d(target)", dimensions); diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index a9df1dac15..a6b611dffb 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -852,7 +852,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, /* GL_ARB_texture_compression */ case GL_TEXTURE_COMPRESSED_IMAGE_SIZE: - if (img->IsCompressed && !isProxy) { + if (_mesa_is_format_compressed(img->TexFormat) && !isProxy) { /* Don't use ctx->Driver.CompressedTextureSize() since that * may returned a padded hardware size. */ @@ -866,7 +866,7 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, } break; case GL_TEXTURE_COMPRESSED: - *params = (GLint) img->IsCompressed; + *params = (GLint) _mesa_is_format_compressed(img->TexFormat); break; /* GL_ARB_texture_float */ diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 48bee88e0f..3e87e47cb1 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3244,10 +3244,7 @@ _mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims) static void compute_texture_size(GLcontext *ctx, struct gl_texture_image *texImage) { - texImage->IsCompressed = - _mesa_is_format_compressed(texImage->TexFormat); - - if (texImage->IsCompressed) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { texImage->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, texImage->Width, texImage->Height, texImage->Depth, @@ -3260,6 +3257,41 @@ compute_texture_size(GLcontext *ctx, struct gl_texture_image *texImage) } +/** Return texture size in bytes */ +static GLuint +texture_size(const struct gl_texture_image *texImage) +{ + GLuint sz; + + if (_mesa_is_format_compressed(texImage->TexFormat)) + sz = texImage->CompressedSize; + else + sz = texImage->Width * texImage->Height * texImage->Depth * + _mesa_get_format_bytes(texImage->TexFormat); + + return sz; +} + + +/** Return row stride in bytes */ +static GLuint +texture_row_stride(const struct gl_texture_image *texImage) +{ + GLuint stride; + + if (_mesa_is_format_compressed(texImage->TexFormat)) { + stride = _mesa_compressed_row_stride(texImage->TexFormat, + texImage->Width); + } + else { + GLuint texelBytes = _mesa_get_format_bytes(texImage->TexFormat); + stride = texImage->RowStride * texelBytes; + } + + return stride; +} + + /** * This is the software fallback for Driver.TexImage1D() @@ -3289,10 +3321,8 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, compute_texture_size(ctx, texImage); /* allocate memory */ - if (texImage->IsCompressed) - sizeInBytes = texImage->CompressedSize; - else - sizeInBytes = texImage->Width * _mesa_get_format_bytes(texImage->TexFormat); + sizeInBytes = texture_size(texImage); + texImage->Data = _mesa_alloc_texmemory(sizeInBytes); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); @@ -3309,16 +3339,14 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, } else { const GLint dstRowStride = 0; - GLboolean success; - - success = _mesa_texstore(ctx, 1, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, 1, 1, - format, type, pixels, packing); + GLboolean success = _mesa_texstore(ctx, 1, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, 1, 1, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); } @@ -3360,10 +3388,7 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* allocate memory */ - if (texImage->IsCompressed) - sizeInBytes = texImage->CompressedSize; - else - sizeInBytes = texImage->Width * texImage->Height * texelBytes; + sizeInBytes = texture_size(texImage); texImage->Data = _mesa_alloc_texmemory(sizeInBytes); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); @@ -3379,26 +3404,15 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, return; } else { - GLint dstRowStride; - GLboolean success; - - if (texImage->IsCompressed) { - dstRowStride - = _mesa_compressed_row_stride(texImage->TexFormat, width); - } - else { - dstRowStride = texImage->RowStride * texelBytes; - } - - success = _mesa_texstore(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - format, type, pixels, packing); - + GLint dstRowStride = texture_row_stride(texImage); + GLboolean success = _mesa_texstore(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage2D"); } @@ -3436,10 +3450,7 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* allocate memory */ - if (texImage->IsCompressed) - sizeInBytes = texImage->CompressedSize; - else - sizeInBytes = width * height * depth * texelBytes; + sizeInBytes = texture_size(texImage); texImage->Data = _mesa_alloc_texmemory(sizeInBytes); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D"); @@ -3455,25 +3466,15 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, return; } else { - GLint dstRowStride; - GLboolean success; - - if (texImage->IsCompressed) { - dstRowStride - = _mesa_compressed_row_stride(texImage->TexFormat, width); - } - else { - dstRowStride = texImage->RowStride * texelBytes; - } - - success = _mesa_texstore(ctx, 3, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - texImage->ImageOffsets, - width, height, depth, - format, type, pixels, packing); + GLint dstRowStride = texture_row_stride(texImage); + GLboolean success = _mesa_texstore(ctx, 3, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + 0, 0, 0, /* dstX/Y/Zoffset */ + dstRowStride, + texImage->ImageOffsets, + width, height, depth, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage3D"); } @@ -3505,16 +3506,14 @@ _mesa_store_texsubimage1d(GLcontext *ctx, GLenum target, GLint level, { const GLint dstRowStride = 0; - GLboolean success; - - success = _mesa_texstore(ctx, 1, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - xoffset, 0, 0, /* offsets */ - dstRowStride, - texImage->ImageOffsets, - width, 1, 1, - format, type, pixels, packing); + GLboolean success = _mesa_texstore(ctx, 1, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + xoffset, 0, 0, /* offsets */ + dstRowStride, + texImage->ImageOffsets, + width, 1, 1, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage1D"); } @@ -3545,26 +3544,15 @@ _mesa_store_texsubimage2d(GLcontext *ctx, GLenum target, GLint level, return; { - GLint dstRowStride = 0; - GLboolean success; - - if (texImage->IsCompressed) { - dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, - texImage->Width); - } - else { - dstRowStride = texImage->RowStride * - _mesa_get_format_bytes(texImage->TexFormat); - } - - success = _mesa_texstore(ctx, 2, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - xoffset, yoffset, 0, - dstRowStride, - texImage->ImageOffsets, - width, height, 1, - format, type, pixels, packing); + GLint dstRowStride = texture_row_stride(texImage); + GLboolean success = _mesa_texstore(ctx, 2, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + xoffset, yoffset, 0, + dstRowStride, + texImage->ImageOffsets, + width, height, 1, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage2D"); } @@ -3595,26 +3583,15 @@ _mesa_store_texsubimage3d(GLcontext *ctx, GLenum target, GLint level, return; { - GLint dstRowStride; - GLboolean success; - - if (texImage->IsCompressed) { - dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, - texImage->Width); - } - else { - dstRowStride = texImage->RowStride * - _mesa_get_format_bytes(texImage->TexFormat); - } - - success = _mesa_texstore(ctx, 3, texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, - xoffset, yoffset, zoffset, - dstRowStride, - texImage->ImageOffsets, - width, height, depth, - format, type, pixels, packing); + GLint dstRowStride = texture_row_stride(texImage); + GLboolean success = _mesa_texstore(ctx, 3, texImage->_BaseFormat, + texImage->TexFormat, + texImage->Data, + xoffset, yoffset, zoffset, + dstRowStride, + texImage->ImageOffsets, + width, height, depth, + format, type, pixels, packing); if (!success) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage3D"); } diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 716fbc8b29..b457a8dc6e 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -562,7 +562,6 @@ st_TexImage(GLcontext * ctx, if (_mesa_is_format_compressed(texImage->TexFormat)) { /* must be a compressed format */ texelBytes = 0; - texImage->IsCompressed = GL_TRUE; texImage->CompressedSize = ctx->Driver.CompressedTextureSize(ctx, texImage->Width, texImage->Height, texImage->Depth, @@ -696,7 +695,7 @@ st_TexImage(GLcontext * ctx, } else { /* Allocate regular memory and store the image there temporarily. */ - if (texImage->IsCompressed) { + if (_mesa_is_format_compressed(texImage->TexFormat)) { sizeInBytes = texImage->CompressedSize; dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width); @@ -1823,7 +1822,7 @@ st_finalize_texture(GLcontext *ctx, } /* FIXME: determine format block instead of cpp */ - if (firstImage->base.IsCompressed) { + if (_mesa_is_format_compressed(firstImage->base.TexFormat)) { cpp = compressed_num_bytes(firstImage->base.TexFormat); } else { -- cgit v1.2.3 From 354d66e2f58bb19efcd9a0f8b2398d3f1dc4248d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 16:30:47 -0600 Subject: mesa: simplify _mesa_compressed_texture_size() --- src/mesa/main/texcompress.c | 69 ++++++--------------------------------------- 1 file changed, 9 insertions(+), 60 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index c1b8c7675a..a2b1218d0c 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -34,6 +34,7 @@ #include "imports.h" #include "colormac.h" #include "context.h" +#include "formats.h" #include "image.h" #include "mipmap.h" #include "texcompress.h" @@ -116,9 +117,10 @@ _mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all) /** * Return number of bytes needed to store a texture of the given size - * using the specified compressed format. + * using the specified (compressed?) format. * This is called via the ctx->Driver.CompressedTextureSize function, - * unless a device driver overrides it. + * unless a device driver overrides it. A driver might override this + * if it needs to use an unusual or padded texture memory layout. * * \param width texture width in texels. * \param height texture height in texels. @@ -132,62 +134,7 @@ _mesa_compressed_texture_size( GLcontext *ctx, GLsizei width, GLsizei height, GLsizei depth, GLuint mesaFormat ) { - GLuint size; - - ASSERT(depth == 1); - (void) depth; - (void) size; - - switch (mesaFormat) { -#if FEATURE_texture_fxt1 - case MESA_FORMAT_RGB_FXT1: - case MESA_FORMAT_RGBA_FXT1: - /* round up width to next multiple of 8, height to next multiple of 4 */ - width = (width + 7) & ~7; - height = (height + 3) & ~3; - /* 16 bytes per 8x4 tile of RGB[A] texels */ - size = width * height / 2; - /* Textures smaller than 8x4 will effectively be made into 8x4 and - * take 16 bytes. - */ - return size; -#endif -#if FEATURE_texture_s3tc - case MESA_FORMAT_RGB_DXT1: - case MESA_FORMAT_RGBA_DXT1: -#if FEATURE_EXT_texture_sRGB - case MESA_FORMAT_SRGB_DXT1: - case MESA_FORMAT_SRGBA_DXT1: -#endif - /* round up width, height to next multiple of 4 */ - width = (width + 3) & ~3; - height = (height + 3) & ~3; - /* 8 bytes per 4x4 tile of RGB[A] texels */ - size = width * height / 2; - /* Textures smaller than 4x4 will effectively be made into 4x4 and - * take 8 bytes. - */ - return size; - case MESA_FORMAT_RGBA_DXT3: - case MESA_FORMAT_RGBA_DXT5: -#if FEATURE_EXT_texture_sRGB - case MESA_FORMAT_SRGBA_DXT3: - case MESA_FORMAT_SRGBA_DXT5: -#endif - /* round up width, height to next multiple of 4 */ - width = (width + 3) & ~3; - height = (height + 3) & ~3; - /* 16 bytes per 4x4 tile of RGBA texels */ - size = width * height; /* simple! */ - /* Textures smaller than 4x4 will effectively be made into 4x4 and - * take 16 bytes. - */ - return size; -#endif - default: - _mesa_problem(ctx, "bad mesaFormat in _mesa_compressed_texture_size"); - return 0; - } + return _mesa_format_image_size(mesaFormat, width, height, depth); } @@ -205,7 +152,7 @@ _mesa_compressed_texture_size_glenum(GLcontext *ctx, GLsizei width, GLsizei height, GLsizei depth, GLenum glformat) { - GLuint mesaFormat; + gl_format mesaFormat; switch (glformat) { #if FEATURE_texture_fxt1 @@ -252,7 +199,7 @@ _mesa_compressed_texture_size_glenum(GLcontext *ctx, return 0; } - return _mesa_compressed_texture_size(ctx, width, height, depth, mesaFormat); + return _mesa_format_image_size(mesaFormat, width, height, depth); } @@ -298,6 +245,8 @@ _mesa_compressed_row_stride(GLuint mesaFormat, GLsizei width) return 0; } + assert(stride == _mesa_format_row_stride(mesaFormat, width)); + return stride; } -- cgit v1.2.3 From 4208a8c02615841702619eb5891c0a61f96a5a00 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 16:41:24 -0600 Subject: savage: s/Xfree/_mesa_free/ --- src/mesa/drivers/dri/savage/savage_xmesa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index 931ceff0a8..06179edae3 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -436,7 +436,7 @@ savageCreateContext( const __GLcontextModes *mesaVis, if (ctx->Const.MaxTextureLevels <= 6) { /*spec requires at least 64x64*/ __driUtilMessage("Not enough texture memory. " "Falling back to indirect rendering."); - Xfree(imesa); + _mesa_free(imesa); return GL_FALSE; } -- cgit v1.2.3 From 073d55f5849c6338a6381e8bc51c074524b5687b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 16:41:47 -0600 Subject: radeon: fix tx_table[] entry XXX need to still verify that the table entries are in correct order. --- src/mesa/drivers/dri/radeon/radeon_texstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index 5d22a11859..cb17f48bf3 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -84,7 +84,7 @@ struct tx_table { /* XXX verify this table against MESA_FORMAT_x values */ static const struct tx_table tx_table[] = { - 0, /* MESA_FORMAT_NONE */ + _INVALID(NONE), /* MESA_FORMAT_NONE */ _ALPHA(RGBA8888), _ALPHA_REV(RGBA8888), _ALPHA(ARGB8888), -- cgit v1.2.3 From 4ca9ba254462b9be55b78df1d50519e10b2f4d73 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 16:42:37 -0600 Subject: mesa: move mesa_set_fetch_functions() --- src/mesa/drivers/dri/intel/intel_tex_image.c | 1 + src/mesa/drivers/dri/radeon/radeon_texture.c | 1 + src/mesa/drivers/dri/unichrome/via_tex.c | 1 + src/mesa/main/texfetch.c | 81 ++++++++++++++++++++++++++++ src/mesa/main/texfetch.h | 2 + src/mesa/main/texstore.c | 81 ---------------------------- src/mesa/main/texstore.h | 4 -- src/mesa/state_tracker/st_cb_texture.c | 1 + src/mesa/state_tracker/st_texture.c | 3 +- 9 files changed, 89 insertions(+), 86 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 29cca45148..9e13ba6871 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -7,6 +7,7 @@ #include "main/convolve.h" #include "main/context.h" #include "main/texcompress.h" +#include "main/texfetch.h" #include "main/texformat.h" #include "main/texstore.h" #include "main/texgetimage.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 442116a2dd..ce393ffeb6 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -34,6 +34,7 @@ #include "main/convolve.h" #include "main/mipmap.h" #include "main/texcompress.h" +#include "main/texfetch.h" #include "main/texformat.h" #include "main/texstore.h" #include "main/teximage.h" diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index a4cf5466fd..13458aba1c 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -37,6 +37,7 @@ #include "main/mipmap.h" #include "main/simple_list.h" #include "main/texcompress.h" +#include "main/texfetch.h" #include "main/texformat.h" #include "main/texobj.h" #include "main/texstore.h" diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c index 62a8b53409..3428f705be 100644 --- a/src/mesa/main/texfetch.c +++ b/src/mesa/main/texfetch.c @@ -565,3 +565,84 @@ _mesa_get_texel_store_func(gl_format format) } return NULL; } + + + +/** + * Adaptor for fetching a GLchan texel from a float-valued texture. + */ +static void +fetch_texel_float_to_chan(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLchan *texelOut) +{ + GLfloat temp[4]; + GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat); + + ASSERT(texImage->FetchTexelf); + texImage->FetchTexelf(texImage, i, j, k, temp); + if (baseFormat == GL_DEPTH_COMPONENT || + baseFormat == GL_DEPTH_STENCIL_EXT) { + /* just one channel */ + UNCLAMPED_FLOAT_TO_CHAN(texelOut[0], temp[0]); + } + else { + /* four channels */ + UNCLAMPED_FLOAT_TO_CHAN(texelOut[0], temp[0]); + UNCLAMPED_FLOAT_TO_CHAN(texelOut[1], temp[1]); + UNCLAMPED_FLOAT_TO_CHAN(texelOut[2], temp[2]); + UNCLAMPED_FLOAT_TO_CHAN(texelOut[3], temp[3]); + } +} + + +/** + * Adaptor for fetching a float texel from a GLchan-valued texture. + */ +static void +fetch_texel_chan_to_float(const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texelOut) +{ + GLchan temp[4]; + GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat); + + ASSERT(texImage->FetchTexelc); + texImage->FetchTexelc(texImage, i, j, k, temp); + if (baseFormat == GL_DEPTH_COMPONENT || + baseFormat == GL_DEPTH_STENCIL_EXT) { + /* just one channel */ + texelOut[0] = CHAN_TO_FLOAT(temp[0]); + } + else { + /* four channels */ + texelOut[0] = CHAN_TO_FLOAT(temp[0]); + texelOut[1] = CHAN_TO_FLOAT(temp[1]); + texelOut[2] = CHAN_TO_FLOAT(temp[2]); + texelOut[3] = CHAN_TO_FLOAT(temp[3]); + } +} + + +/** + * Initialize the texture image's FetchTexelc and FetchTexelf methods. + */ +void +_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims) +{ + ASSERT(dims == 1 || dims == 2 || dims == 3); + ASSERT(texImage->TexFormat); + + texImage->FetchTexelf = + _mesa_get_texel_fetch_func(texImage->TexFormat, dims); + + /* now check if we need to use a float/chan adaptor */ + if (!texImage->FetchTexelc) { + texImage->FetchTexelc = fetch_texel_float_to_chan; + } + else if (!texImage->FetchTexelf) { + texImage->FetchTexelf = fetch_texel_chan_to_float; + } + + + ASSERT(texImage->FetchTexelc); + ASSERT(texImage->FetchTexelf); +} diff --git a/src/mesa/main/texfetch.h b/src/mesa/main/texfetch.h index a397b04600..a9be530a06 100644 --- a/src/mesa/main/texfetch.h +++ b/src/mesa/main/texfetch.h @@ -37,5 +37,7 @@ _mesa_get_texel_fetch_func(gl_format format, GLuint dims); extern StoreTexelFunc _mesa_get_texel_store_func(gl_format format); +extern void +_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims); #endif diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 3e87e47cb1..07421b6657 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3160,87 +3160,6 @@ _mesa_unmap_teximage_pbo(GLcontext *ctx, } - -/** - * Adaptor for fetching a GLchan texel from a float-valued texture. - */ -static void -fetch_texel_float_to_chan(const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texelOut) -{ - GLfloat temp[4]; - GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat); - - ASSERT(texImage->FetchTexelf); - texImage->FetchTexelf(texImage, i, j, k, temp); - if (baseFormat == GL_DEPTH_COMPONENT || - baseFormat == GL_DEPTH_STENCIL_EXT) { - /* just one channel */ - UNCLAMPED_FLOAT_TO_CHAN(texelOut[0], temp[0]); - } - else { - /* four channels */ - UNCLAMPED_FLOAT_TO_CHAN(texelOut[0], temp[0]); - UNCLAMPED_FLOAT_TO_CHAN(texelOut[1], temp[1]); - UNCLAMPED_FLOAT_TO_CHAN(texelOut[2], temp[2]); - UNCLAMPED_FLOAT_TO_CHAN(texelOut[3], temp[3]); - } -} - - -/** - * Adaptor for fetching a float texel from a GLchan-valued texture. - */ -static void -fetch_texel_chan_to_float(const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLfloat *texelOut) -{ - GLchan temp[4]; - GLenum baseFormat = _mesa_get_format_base_format(texImage->TexFormat); - - ASSERT(texImage->FetchTexelc); - texImage->FetchTexelc(texImage, i, j, k, temp); - if (baseFormat == GL_DEPTH_COMPONENT || - baseFormat == GL_DEPTH_STENCIL_EXT) { - /* just one channel */ - texelOut[0] = CHAN_TO_FLOAT(temp[0]); - } - else { - /* four channels */ - texelOut[0] = CHAN_TO_FLOAT(temp[0]); - texelOut[1] = CHAN_TO_FLOAT(temp[1]); - texelOut[2] = CHAN_TO_FLOAT(temp[2]); - texelOut[3] = CHAN_TO_FLOAT(temp[3]); - } -} - - -/** - * Initialize the texture image's FetchTexelc and FetchTexelf methods. - */ -void -_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims) -{ - ASSERT(dims == 1 || dims == 2 || dims == 3); - ASSERT(texImage->TexFormat); - - texImage->FetchTexelf = - _mesa_get_texel_fetch_func(texImage->TexFormat, dims); - - /* now check if we need to use a float/chan adaptor */ - if (!texImage->FetchTexelc) { - texImage->FetchTexelc = fetch_texel_float_to_chan; - } - else if (!texImage->FetchTexelf) { - texImage->FetchTexelf = fetch_texel_chan_to_float; - } - - - ASSERT(texImage->FetchTexelc); - ASSERT(texImage->FetchTexelf); -} - - static void compute_texture_size(GLcontext *ctx, struct gl_texture_image *texImage) { diff --git a/src/mesa/main/texstore.h b/src/mesa/main/texstore.h index 2db076dfff..3211086dd6 100644 --- a/src/mesa/main/texstore.h +++ b/src/mesa/main/texstore.h @@ -82,10 +82,6 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, const struct gl_pixelstore_attrib *srcPacking); -extern void -_mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims); - - extern void _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, GLint internalFormat, diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index b457a8dc6e..2574eeb996 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/mipmap.h" #include "main/pixel.h" #include "main/texcompress.h" +#include "main/texfetch.h" #include "main/texformat.h" #include "main/texgetimage.h" #include "main/teximage.h" diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index 1790e1b28d..4a883f9f0a 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -32,8 +32,9 @@ #include "st_cb_fbo.h" #include "st_inlines.h" #include "main/enums.h" -#include "main/texobj.h" +#include "main/texfetch.h" #include "main/teximage.h" +#include "main/texobj.h" #include "main/texstore.h" #undef Elements /* fix re-defined macro warning */ -- cgit v1.2.3 From 8c92a531fb7e0d2de2a06610b2dff98eeb19c985 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 19:01:02 -0600 Subject: mesa: reformatting --- src/mesa/main/texgetimage.c | 12 ++++++------ src/mesa/main/texstore.c | 43 +++++++++++++++++++++---------------------- 2 files changed, 27 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 3e3951b1c4..341ce6103f 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -322,10 +322,15 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, { GLuint size; + /* 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); + if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { /* pack texture image into a PBO */ GLubyte *buf; - if ((const GLubyte *) img + texImage->CompressedSize > + if ((const GLubyte *) img + size > (const GLubyte *) ctx->Pack.BufferObj->Size) { _mesa_error(ctx, GL_INVALID_OPERATION, "glGetCompressedTexImage(invalid PBO access)"); @@ -347,11 +352,6 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, 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); - /* just memcpy, no pixelstore or pixel transfer */ _mesa_memcpy(img, texImage->Data, size); diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 07421b6657..0fa8c44817 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -440,8 +440,8 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, else { /* no convolution */ const GLint components = _mesa_components_in_format(logicalBaseFormat); - const GLint srcStride = _mesa_image_row_stride(srcPacking, - srcWidth, srcFormat, srcType); + const GLint srcStride = + _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); GLfloat *dst; GLint img, row; @@ -601,14 +601,13 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, dst = tempImage; for (img = 0; img < srcDepth; img++) { - const GLint srcStride = _mesa_image_row_stride(srcPacking, - srcWidth, srcFormat, - srcType); - const GLubyte *src - = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, - srcWidth, srcHeight, - srcFormat, srcType, - img, 0, 0); + const GLint srcStride = + _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); + const GLubyte *src = + (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, + srcWidth, srcHeight, + srcFormat, srcType, + img, 0, 0); for (row = 0; row < srcHeight; row++) { _mesa_unpack_color_span_chan(ctx, srcWidth, logicalBaseFormat, dst, srcFormat, srcType, src, srcPacking, @@ -1136,8 +1135,8 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_BYTE && dims == 2) { /* do optimized tex store */ - const GLint srcRowStride = _mesa_image_row_stride(srcPacking, srcWidth, - srcFormat, srcType); + const GLint srcRowStride = + _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); const GLubyte *src = (const GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, 0, 0, 0); @@ -1389,8 +1388,8 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) srcType == GL_UNSIGNED_BYTE) { int img, row, col; for (img = 0; img < srcDepth; img++) { - const GLint srcRowStride = _mesa_image_row_stride(srcPacking, - srcWidth, srcFormat, srcType); + const GLint srcRowStride = + _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); GLubyte *dstRow = (GLubyte *) dstAddr @@ -1425,8 +1424,8 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) * Strangely the same isn't required for the RGB path, above. */ for (img = 0; img < srcDepth; img++) { - const GLint srcRowStride = _mesa_image_row_stride(srcPacking, - srcWidth, srcFormat, srcType); + const GLint srcRowStride = + _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); GLubyte *dstRow = (GLubyte *) dstAddr @@ -1563,8 +1562,8 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) /* extract RGB from RGBA */ GLint img, row, col; for (img = 0; img < srcDepth; img++) { - const GLint srcRowStride = _mesa_image_row_stride(srcPacking, - srcWidth, srcFormat, srcType); + const GLint srcRowStride = + _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); GLubyte *dstRow = (GLubyte *) dstAddr @@ -1690,8 +1689,8 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) /* extract BGR from RGBA */ int img, row, col; for (img = 0; img < srcDepth; img++) { - const GLint srcRowStride = _mesa_image_row_stride(srcPacking, - srcWidth, srcFormat, srcType); + const GLint srcRowStride = + _mesa_image_row_stride(srcPacking, srcWidth, srcFormat, srcType); GLubyte *srcRow = (GLubyte *) _mesa_image_address(dims, srcPacking, srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, 0, 0); GLubyte *dstRow = (GLubyte *) dstAddr @@ -2358,8 +2357,8 @@ _mesa_texstore_dudv8(TEXSTORE_PARAMS) else { /* general path - note this is defined for 2d textures only */ const GLint components = _mesa_components_in_format(baseInternalFormat); - const GLint srcStride = _mesa_image_row_stride(srcPacking, - srcWidth, srcFormat, srcType); + const GLint srcStride = _mesa_image_row_stride(srcPacking, srcWidth, + srcFormat, srcType); GLbyte *tempImage, *dst, *src; GLint row; -- cgit v1.2.3 From e00da1476fcdf8e5877fc1e62118080f5c4193f0 Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Thu, 1 Oct 2009 21:53:17 -0400 Subject: g3dvl: Color space conv interface & vl impl. Interface is pipe_video_context::set_csc_matrix(). vl_csc.h defines some helpers to generate CSC matrices based on one of the color standard and a user defined ProcAmp (brightness, contrast, saturation, hue). --- src/gallium/auxiliary/vl/Makefile | 1 + src/gallium/auxiliary/vl/SConscript | 1 + src/gallium/auxiliary/vl/vl_compositor.c | 139 ++++-------------- src/gallium/auxiliary/vl/vl_compositor.h | 2 + src/gallium/auxiliary/vl/vl_csc.c | 179 ++++++++++++++++++++++++ src/gallium/auxiliary/vl/vl_csc.h | 26 ++++ src/gallium/drivers/softpipe/sp_video_context.c | 10 ++ src/gallium/include/pipe/p_video_context.h | 4 +- 8 files changed, 249 insertions(+), 113 deletions(-) create mode 100644 src/gallium/auxiliary/vl/vl_csc.c create mode 100644 src/gallium/auxiliary/vl/vl_csc.h (limited to 'src') diff --git a/src/gallium/auxiliary/vl/Makefile b/src/gallium/auxiliary/vl/Makefile index 71bfb937ad..4314c1e8d6 100644 --- a/src/gallium/auxiliary/vl/Makefile +++ b/src/gallium/auxiliary/vl/Makefile @@ -7,6 +7,7 @@ C_SOURCES = \ vl_bitstream_parser.c \ vl_mpeg12_mc_renderer.c \ vl_compositor.c \ + vl_csc.c \ vl_shader_build.c include ../../Makefile.template diff --git a/src/gallium/auxiliary/vl/SConscript b/src/gallium/auxiliary/vl/SConscript index eb50940c35..aed69f5efe 100644 --- a/src/gallium/auxiliary/vl/SConscript +++ b/src/gallium/auxiliary/vl/SConscript @@ -6,6 +6,7 @@ vl = env.ConvenienceLibrary( 'vl_bitstream_parser.c', 'vl_mpeg12_mc_renderer.c', 'vl_compositor.c', + 'vl_csc.c', 'vl_shader_build.c', ]) diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index 6431da6611..5d3458afd2 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -5,6 +5,7 @@ #include #include #include +#include "vl_csc.h" #include "vl_shader_build.h" struct vertex2f @@ -27,7 +28,6 @@ struct vertex_shader_consts struct fragment_shader_consts { - struct vertex4f bias; float matrix[16]; }; @@ -49,94 +49,6 @@ static const struct vertex2f surface_verts[4] = */ static const struct vertex2f *surface_texcoords = surface_verts; -/* - * Identity color conversion constants, for debugging - */ -static const struct fragment_shader_consts identity = -{ - { - 0.0f, 0.0f, 0.0f, 0.0f - }, - { - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - } -}; - -/* - * Converts ITU-R BT.601 YCbCr pixels to RGB pixels where: - * Y is in [16,235], Cb and Cr are in [16,240] - * R, G, and B are in [16,235] - */ -static const struct fragment_shader_consts bt_601 = -{ - { - 0.0f, 0.501960784f, 0.501960784f, 0.0f - }, - { - 1.0f, 0.0f, 1.371f, 0.0f, - 1.0f, -0.336f, -0.698f, 0.0f, - 1.0f, 1.732f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - } -}; - -/* - * Converts ITU-R BT.601 YCbCr pixels to RGB pixels where: - * Y is in [16,235], Cb and Cr are in [16,240] - * R, G, and B are in [0,255] - */ -static const struct fragment_shader_consts bt_601_full = -{ - { - 0.062745098f, 0.501960784f, 0.501960784f, 0.0f - }, - { - 1.164f, 0.0f, 1.596f, 0.0f, - 1.164f, -0.391f, -0.813f, 0.0f, - 1.164f, 2.018f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - } -}; - -/* - * Converts ITU-R BT.709 YCbCr pixels to RGB pixels where: - * Y is in [16,235], Cb and Cr are in [16,240] - * R, G, and B are in [16,235] - */ -static const struct fragment_shader_consts bt_709 = -{ - { - 0.0f, 0.501960784f, 0.501960784f, 0.0f - }, - { - 1.0f, 0.0f, 1.540f, 0.0f, - 1.0f, -0.183f, -0.459f, 0.0f, - 1.0f, 1.816f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - } -}; - -/* - * Converts ITU-R BT.709 YCbCr pixels to RGB pixels where: - * Y is in [16,235], Cb and Cr are in [16,240] - * R, G, and B are in [0,255] - */ -const struct fragment_shader_consts bt_709_full = -{ - { - 0.062745098f, 0.501960784f, 0.501960784f, 0.0f - }, - { - 1.164f, 0.0f, 1.793f, 0.0f, - 1.164f, -0.213f, -0.534f, 0.0f, - 1.164f, 2.115f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - } -}; - static void create_vert_shader(struct vl_compositor *c) { @@ -245,10 +157,9 @@ create_frag_shader(struct vl_compositor *c) ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); /* - * decl c0 ; Bias vector for CSC - * decl c1-c4 ; CSC matrix c1-c4 + * decl c0-c3 ; CSC matrix c0-c3 */ - decl = vl_decl_constants(TGSI_SEMANTIC_GENERIC, 0, 0, 4); + decl = vl_decl_constants(TGSI_SEMANTIC_GENERIC, 0, 0, 3); ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); /* decl o0 ; Fragment color */ @@ -267,17 +178,14 @@ create_frag_shader(struct vl_compositor *c) inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_INPUT, 0, TGSI_FILE_SAMPLER, 0); ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - /* sub t0, t0, c0 ; Subtract bias vector from pixel */ - inst = vl_inst3(TGSI_OPCODE_SUB, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_CONSTANT, 0); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - /* - * dp4 o0.x, t0, c1 ; Multiply pixel by the color conversion matrix - * dp4 o0.y, t0, c2 - * dp4 o0.z, t0, c3 + * dp4 o0.x, t0, c0 ; Multiply pixel by the color conversion matrix + * dp4 o0.y, t0, c1 + * dp4 o0.z, t0, c2 + * dp4 o0.w, t0, c3 */ - for (i = 0; i < 3; ++i) { - inst = vl_inst3(TGSI_OPCODE_DP4, TGSI_FILE_OUTPUT, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_CONSTANT, i + 1); + for (i = 0; i < 4; ++i) { + inst = vl_inst3(TGSI_OPCODE_DP4, TGSI_FILE_OUTPUT, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_CONSTANT, i); inst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } @@ -352,6 +260,8 @@ static void cleanup_shaders(struct vl_compositor *c) static bool init_buffers(struct vl_compositor *c) { + struct fragment_shader_consts fsc; + assert(c); /* @@ -438,18 +348,9 @@ init_buffers(struct vl_compositor *c) sizeof(struct fragment_shader_consts) ); - /* - * TODO: Refactor this into a seperate function, - * allow changing the CSC matrix at runtime to switch between regular & full versions - */ - memcpy - ( - pipe_buffer_map(c->pipe->screen, c->fs_const_buf.buffer, PIPE_BUFFER_USAGE_CPU_WRITE), - &bt_601_full, - sizeof(struct fragment_shader_consts) - ); + vl_csc_get_matrix(VL_CSC_COLOR_STANDARD_IDENTITY, NULL, true, fsc.matrix); - pipe_buffer_unmap(c->pipe->screen, c->fs_const_buf.buffer); + vl_compositor_set_csc_matrix(c, fsc.matrix); return true; } @@ -588,3 +489,17 @@ void vl_compositor_render(struct vl_compositor *compositor, pipe_surface_reference(&compositor->fb_state.cbufs[0], NULL); } + +void vl_compositor_set_csc_matrix(struct vl_compositor *compositor, const float *mat) +{ + assert(compositor); + + memcpy + ( + pipe_buffer_map(compositor->pipe->screen, compositor->fs_const_buf.buffer, PIPE_BUFFER_USAGE_CPU_WRITE), + mat, + sizeof(struct fragment_shader_consts) + ); + + pipe_buffer_unmap(compositor->pipe->screen, compositor->fs_const_buf.buffer); +} diff --git a/src/gallium/auxiliary/vl/vl_compositor.h b/src/gallium/auxiliary/vl/vl_compositor.h index 19ad66d9c6..975ea00bde 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.h +++ b/src/gallium/auxiliary/vl/vl_compositor.h @@ -44,4 +44,6 @@ void vl_compositor_render(struct vl_compositor *compositor, struct pipe_video_rect *layer_dst_areas,*/ struct pipe_fence_handle **fence); +void vl_compositor_set_csc_matrix(struct vl_compositor *compositor, const float *mat); + #endif /* vl_compositor_h */ diff --git a/src/gallium/auxiliary/vl/vl_csc.c b/src/gallium/auxiliary/vl/vl_csc.c new file mode 100644 index 0000000000..828cebe4ed --- /dev/null +++ b/src/gallium/auxiliary/vl/vl_csc.c @@ -0,0 +1,179 @@ +#include "vl_csc.h" +#include +#include + +/* + * Color space conversion formulas + * + * To convert YCbCr to RGB, + * vec4 ycbcr, rgb + * mat44 csc + * rgb = csc * ycbcr + * + * To calculate the color space conversion matrix csc with ProcAmp adjustments, + * mat44 csc, cstd, procamp, bias + * csc = cstd * (procamp * bias) + * + * Where cstd is a matrix corresponding to one of the color standards (BT.601, BT.709, etc) + * adjusted for the kind of YCbCr -> RGB mapping wanted (1:1, full), + * bias is a matrix corresponding to the kind of YCbCr -> RGB mapping wanted (1:1, full) + * + * To calculate procamp, + * mat44 procamp, hue, saturation, brightness, contrast + * procamp = brightness * (saturation * (contrast * hue)) + * Alternatively, + * procamp = saturation * (brightness * (contrast * hue)) + * + * contrast + * [ c, 0, 0, 0] + * [ 0, c, 0, 0] + * [ 0, 0, c, 0] + * [ 0, 0, 0, 1] + * + * brightness + * [ 1, 0, 0, b] + * [ 0, 1, 0, 0] + * [ 0, 0, 1, 0] + * [ 0, 0, 0, 1] + * + * saturation + * [ 1, 0, 0, 0] + * [ 0, s, 0, 0] + * [ 0, 0, s, 0] + * [ 0, 0, 0, 1] + * + * hue + * [ 1, 0, 0, 0] + * [ 0, cos(h), sin(h), 0] + * [ 0, -sin(h), cos(h), 0] + * [ 0, 0, 0, 1] + * + * procamp + * [ c, 0, 0, b] + * [ 0, c*s*cos(h), c*s*sin(h), 0] + * [ 0, -c*s*sin(h), c*s*cos(h), 0] + * [ 0, 0, 0, 1] + * + * bias + * [ 1, 0, 0, ybias] + * [ 0, 1, 0, cbbias] + * [ 0, 0, 1, crbias] + * [ 0, 0, 0, 1] + * + * csc + * [ c*cstd[ 0], c*cstd[ 1]*s*cos(h) - c*cstd[ 2]*s*sin(h), c*cstd[ 2]*s*cos(h) + c*cstd[ 1]*s*sin(h), cstd[ 3] + cstd[ 0]*(b + c*ybias) + cstd[ 1]*(c*cbbias*s*cos(h) + c*crbias*s*sin(h)) + cstd[ 2]*(c*crbias*s*cos(h) - c*cbbias*s*sin(h))] + * [ c*cstd[ 4], c*cstd[ 5]*s*cos(h) - c*cstd[ 6]*s*sin(h), c*cstd[ 6]*s*cos(h) + c*cstd[ 5]*s*sin(h), cstd[ 7] + cstd[ 4]*(b + c*ybias) + cstd[ 5]*(c*cbbias*s*cos(h) + c*crbias*s*sin(h)) + cstd[ 6]*(c*crbias*s*cos(h) - c*cbbias*s*sin(h))] + * [ c*cstd[ 8], c*cstd[ 9]*s*cos(h) - c*cstd[10]*s*sin(h), c*cstd[10]*s*cos(h) + c*cstd[ 9]*s*sin(h), cstd[11] + cstd[ 8]*(b + c*ybias) + cstd[ 9]*(c*cbbias*s*cos(h) + c*crbias*s*sin(h)) + cstd[10]*(c*crbias*s*cos(h) - c*cbbias*s*sin(h))] + * [ c*cstd[12], c*cstd[13]*s*cos(h) - c*cstd[14]*s*sin(h), c*cstd[14]*s*cos(h) + c*cstd[13]*s*sin(h), cstd[15] + cstd[12]*(b + c*ybias) + cstd[13]*(c*cbbias*s*cos(h) + c*crbias*s*sin(h)) + cstd[14]*(c*crbias*s*cos(h) - c*cbbias*s*sin(h))] + */ + +/* + * Converts ITU-R BT.601 YCbCr pixels to RGB pixels where: + * Y is in [16,235], Cb and Cr are in [16,240] + * R, G, and B are in [16,235] + */ +static const float bt_601[16] = +{ + 1.0f, 0.0f, 1.371f, 0.0f, + 1.0f, -0.336f, -0.698f, 0.0f, + 1.0f, 1.732f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f +}; + +/* + * Converts ITU-R BT.601 YCbCr pixels to RGB pixels where: + * Y is in [16,235], Cb and Cr are in [16,240] + * R, G, and B are in [0,255] + */ +static const float bt_601_full[16] = +{ + 1.164f, 0.0f, 1.596f, 0.0f, + 1.164f, -0.391f, -0.813f, 0.0f, + 1.164f, 2.018f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f +}; + +/* + * Converts ITU-R BT.709 YCbCr pixels to RGB pixels where: + * Y is in [16,235], Cb and Cr are in [16,240] + * R, G, and B are in [16,235] + */ +static const float bt_709[16] = +{ + 1.0f, 0.0f, 1.540f, 0.0f, + 1.0f, -0.183f, -0.459f, 0.0f, + 1.0f, 1.816f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f +}; + +/* + * Converts ITU-R BT.709 YCbCr pixels to RGB pixels where: + * Y is in [16,235], Cb and Cr are in [16,240] + * R, G, and B are in [0,255] + */ +static const float bt_709_full[16] = +{ + 1.164f, 0.0f, 1.793f, 0.0f, + 1.164f, -0.213f, -0.534f, 0.0f, + 1.164f, 2.115f, 0.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f +}; + +static const float identity[16] = +{ + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f +}; + +void vl_csc_get_matrix(enum VL_CSC_COLOR_STANDARD cs, + struct vl_procamp *procamp, + bool full_range, + float *matrix) +{ + float ybias = full_range ? -16.0f/255.0f : 0.0f; + float cbbias = -128.0f/255.0f; + float crbias = -128.0f/255.0f; + float c = procamp ? procamp->contrast : 1.0f; + float s = procamp ? procamp->saturation : 1.0f; + float b = procamp ? procamp->brightness : 0.0f; + float h = procamp ? procamp->hue : 0.0f; + const float *cstd; + + assert(matrix); + + switch (cs) { + case VL_CSC_COLOR_STANDARD_BT_601: + cstd = full_range ? &bt_601_full[0] : &bt_601[0]; + break; + case VL_CSC_COLOR_STANDARD_BT_709: + cstd = full_range ? &bt_709_full[0] : &bt_709[0]; + break; + case VL_CSC_COLOR_STANDARD_IDENTITY: + default: + assert(cs == VL_CSC_COLOR_STANDARD_IDENTITY); + memcpy(matrix, &identity[0], sizeof(float) * 16); + return; + } + + matrix[ 0] = c*cstd[ 0]; + matrix[ 1] = c*cstd[ 1]*s*cosf(h) - c*cstd[ 2]*s*sinf(h); + matrix[ 2] = c*cstd[ 2]*s*cosf(h) + c*cstd[ 1]*s*sinf(h); + matrix[ 3] = cstd[ 3] + cstd[ 0]*(b + c*ybias) + cstd[ 1]*(c*cbbias*s*cosf(h) + c*crbias*s*sinf(h)) + cstd[ 2]*(c*crbias*s*cosf(h) - c*cbbias*s*sinf(h)); + + matrix[ 4] = c*cstd[ 4]; + matrix[ 5] = c*cstd[ 5]*s*cosf(h) - c*cstd[ 6]*s*sinf(h); + matrix[ 6] = c*cstd[ 6]*s*cosf(h) + c*cstd[ 5]*s*sinf(h); + matrix[ 7] = cstd[ 7] + cstd[ 4]*(b + c*ybias) + cstd[ 5]*(c*cbbias*s*cosf(h) + c*crbias*s*sinf(h)) + cstd[ 6]*(c*crbias*s*cosf(h) - c*cbbias*s*sinf(h)); + + matrix[ 8] = c*cstd[ 8]; + matrix[ 9] = c*cstd[ 9]*s*cosf(h) - c*cstd[10]*s*sinf(h); + matrix[10] = c*cstd[10]*s*cosf(h) + c*cstd[ 9]*s*sinf(h); + matrix[11] = cstd[11] + cstd[ 8]*(b + c*ybias) + cstd[ 9]*(c*cbbias*s*cosf(h) + c*crbias*s*sinf(h)) + cstd[10]*(c*crbias*s*cosf(h) - c*cbbias*s*sinf(h)); + + matrix[12] = c*cstd[12]; + matrix[13] = c*cstd[13]*s*cos(h) - c*cstd[14]*s*sin(h); + matrix[14] = c*cstd[14]*s*cos(h) + c*cstd[13]*s*sin(h); + matrix[15] = cstd[15] + cstd[12]*(b + c*ybias) + cstd[13]*(c*cbbias*s*cos(h) + c*crbias*s*sin(h)) + cstd[14]*(c*crbias*s*cos(h) - c*cbbias*s*sin(h)); +} diff --git a/src/gallium/auxiliary/vl/vl_csc.h b/src/gallium/auxiliary/vl/vl_csc.h new file mode 100644 index 0000000000..c3b87d279c --- /dev/null +++ b/src/gallium/auxiliary/vl/vl_csc.h @@ -0,0 +1,26 @@ +#ifndef vl_csc_h +#define vl_csc_h + +#include + +struct vl_procamp +{ + float brightness; + float contrast; + float saturation; + float hue; +}; + +enum VL_CSC_COLOR_STANDARD +{ + VL_CSC_COLOR_STANDARD_IDENTITY, + VL_CSC_COLOR_STANDARD_BT_601, + VL_CSC_COLOR_STANDARD_BT_709 +}; + +void vl_csc_get_matrix(enum VL_CSC_COLOR_STANDARD cs, + struct vl_procamp *procamp, + bool full_range, + float *matrix); + +#endif /* vl_csc_h */ diff --git a/src/gallium/drivers/softpipe/sp_video_context.c b/src/gallium/drivers/softpipe/sp_video_context.c index 7e9136d8e0..00b4b7d560 100644 --- a/src/gallium/drivers/softpipe/sp_video_context.c +++ b/src/gallium/drivers/softpipe/sp_video_context.c @@ -109,6 +109,15 @@ sp_mpeg12_set_decode_target(struct pipe_video_context *vpipe, pipe_video_surface_reference(&ctx->decode_target, dt); } +static void sp_mpeg12_set_csc_matrix(struct pipe_video_context *vpipe, const float *mat) +{ + struct sp_mpeg12_context *ctx = (struct sp_mpeg12_context*)vpipe; + + assert(vpipe); + + vl_compositor_set_csc_matrix(&ctx->compositor, mat); +} + static bool init_pipe_state(struct sp_mpeg12_context *ctx) { @@ -211,6 +220,7 @@ sp_mpeg12_create(struct pipe_screen *screen, enum pipe_video_profile profile, ctx->base.clear_surface = sp_mpeg12_clear_surface; ctx->base.render_picture = sp_mpeg12_render_picture; ctx->base.set_decode_target = sp_mpeg12_set_decode_target; + ctx->base.set_csc_matrix = sp_mpeg12_set_csc_matrix; ctx->pipe = softpipe_create(screen); if (!ctx->pipe) { diff --git a/src/gallium/include/pipe/p_video_context.h b/src/gallium/include/pipe/p_video_context.h index 937705ac50..4d125fa4d5 100644 --- a/src/gallium/include/pipe/p_video_context.h +++ b/src/gallium/include/pipe/p_video_context.h @@ -80,7 +80,9 @@ struct pipe_video_context void (*set_decode_target)(struct pipe_video_context *vpipe, struct pipe_video_surface *dt); - /* TODO: Interface for CSC matrix, scaling modes, post-processing, etc. */ + void (*set_csc_matrix)(struct pipe_video_context *vpipe, const float *mat); + + /* TODO: Interface for scaling modes, post-processing, etc. */ /*@}*/ }; -- cgit v1.2.3 From 62db9b21da6ccad6301feae9b90d53d46224c854 Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Thu, 1 Oct 2009 22:01:18 -0400 Subject: st/xvmc: Set default CSC matrix to BT.601, no ProcAmp, full range RGB. --- src/gallium/state_trackers/xorg/xvmc/context.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xvmc/context.c b/src/gallium/state_trackers/xorg/xvmc/context.c index 6d90dfc367..a002a7c844 100644 --- a/src/gallium/state_trackers/xorg/xvmc/context.c +++ b/src/gallium/state_trackers/xorg/xvmc/context.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "xvmc_private.h" static Status Validate(Display *dpy, XvPortID port, int surface_type_id, @@ -127,6 +128,7 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id, struct pipe_screen *screen; struct pipe_video_context *vpipe; XvMCContextPrivate *context_priv; + float csc[16]; assert(dpy); @@ -175,6 +177,15 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id, return BadAlloc; } + /* TODO: Define some Xv attribs to allow users to specify color standard, procamp */ + vl_csc_get_matrix + ( + debug_get_bool_option("G3DVL_NO_CSC", FALSE) ? + VL_CSC_COLOR_STANDARD_IDENTITY : VL_CSC_COLOR_STANDARD_BT_601, + NULL, true, csc + ); + vpipe->set_csc_matrix(vpipe, csc); + context_priv->vpipe = vpipe; context->context_id = XAllocID(dpy); -- cgit v1.2.3 From fcb595c04f9ee275eae49b7bb7c61246671f5ce2 Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Thu, 1 Oct 2009 22:16:10 -0400 Subject: g3dvl: Copyright blocks. --- src/gallium/auxiliary/vl/vl_bitstream_parser.c | 27 ++++++++++++++++++++++ src/gallium/auxiliary/vl/vl_bitstream_parser.h | 27 ++++++++++++++++++++++ src/gallium/auxiliary/vl/vl_compositor.c | 27 ++++++++++++++++++++++ src/gallium/auxiliary/vl/vl_compositor.h | 27 ++++++++++++++++++++++ src/gallium/auxiliary/vl/vl_csc.c | 27 ++++++++++++++++++++++ src/gallium/auxiliary/vl/vl_csc.h | 27 ++++++++++++++++++++++ src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 27 ++++++++++++++++++++++ src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h | 27 ++++++++++++++++++++++ src/gallium/auxiliary/vl/vl_shader_build.c | 27 ++++++++++++++++++++++ src/gallium/auxiliary/vl/vl_shader_build.h | 27 ++++++++++++++++++++++ src/gallium/drivers/softpipe/sp_video_context.c | 27 ++++++++++++++++++++++ src/gallium/drivers/softpipe/sp_video_context.h | 27 ++++++++++++++++++++++ src/gallium/include/pipe/p_video_context.h | 27 ++++++++++++++++++++++ src/gallium/include/pipe/p_video_state.h | 27 ++++++++++++++++++++++ src/gallium/state_trackers/xorg/xvmc/attributes.c | 27 ++++++++++++++++++++++ src/gallium/state_trackers/xorg/xvmc/block.c | 27 ++++++++++++++++++++++ src/gallium/state_trackers/xorg/xvmc/context.c | 27 ++++++++++++++++++++++ src/gallium/state_trackers/xorg/xvmc/subpicture.c | 27 ++++++++++++++++++++++ src/gallium/state_trackers/xorg/xvmc/surface.c | 27 ++++++++++++++++++++++ .../state_trackers/xorg/xvmc/tests/test_blocks.c | 27 ++++++++++++++++++++++ .../state_trackers/xorg/xvmc/tests/test_context.c | 27 ++++++++++++++++++++++ .../xorg/xvmc/tests/test_rendering.c | 27 ++++++++++++++++++++++ .../state_trackers/xorg/xvmc/tests/test_surface.c | 27 ++++++++++++++++++++++ .../state_trackers/xorg/xvmc/tests/testlib.c | 27 ++++++++++++++++++++++ .../state_trackers/xorg/xvmc/tests/testlib.h | 27 ++++++++++++++++++++++ .../state_trackers/xorg/xvmc/tests/xvmc_bench.c | 27 ++++++++++++++++++++++ .../state_trackers/xorg/xvmc/xvmc_private.h | 27 ++++++++++++++++++++++ src/gallium/winsys/g3dvl/vl_winsys.h | 27 ++++++++++++++++++++++ src/gallium/winsys/g3dvl/xlib/xsp_winsys.c | 27 ++++++++++++++++++++++ 29 files changed, 783 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/vl/vl_bitstream_parser.c b/src/gallium/auxiliary/vl/vl_bitstream_parser.c index 45826bad45..3193ea5f41 100644 --- a/src/gallium/auxiliary/vl/vl_bitstream_parser.c +++ b/src/gallium/auxiliary/vl/vl_bitstream_parser.c @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #include "vl_bitstream_parser.h" #include #include diff --git a/src/gallium/auxiliary/vl/vl_bitstream_parser.h b/src/gallium/auxiliary/vl/vl_bitstream_parser.h index 91ebaab45b..30ec743fa7 100644 --- a/src/gallium/auxiliary/vl/vl_bitstream_parser.h +++ b/src/gallium/auxiliary/vl/vl_bitstream_parser.h @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #ifndef vl_bitstream_parser_h #define vl_bitstream_parser_h diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index 5d3458afd2..b36dbeb208 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #include "vl_compositor.h" #include #include diff --git a/src/gallium/auxiliary/vl/vl_compositor.h b/src/gallium/auxiliary/vl/vl_compositor.h index 975ea00bde..17e2afd353 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.h +++ b/src/gallium/auxiliary/vl/vl_compositor.h @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #ifndef vl_compositor_h #define vl_compositor_h diff --git a/src/gallium/auxiliary/vl/vl_csc.c b/src/gallium/auxiliary/vl/vl_csc.c index 828cebe4ed..5ecc43a5fa 100644 --- a/src/gallium/auxiliary/vl/vl_csc.c +++ b/src/gallium/auxiliary/vl/vl_csc.c @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #include "vl_csc.h" #include #include diff --git a/src/gallium/auxiliary/vl/vl_csc.h b/src/gallium/auxiliary/vl/vl_csc.h index c3b87d279c..722ca35f33 100644 --- a/src/gallium/auxiliary/vl/vl_csc.h +++ b/src/gallium/auxiliary/vl/vl_csc.h @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #ifndef vl_csc_h #define vl_csc_h diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index 9b69f2956c..6b3614821c 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #include "vl_mpeg12_mc_renderer.h" #include #include diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h index 0c2f679664..5d2c1273ee 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #ifndef vl_mpeg12_mc_renderer_h #define vl_mpeg12_mc_renderer_h diff --git a/src/gallium/auxiliary/vl/vl_shader_build.c b/src/gallium/auxiliary/vl/vl_shader_build.c index 9ad1e052c6..faa20a903c 100644 --- a/src/gallium/auxiliary/vl/vl_shader_build.c +++ b/src/gallium/auxiliary/vl/vl_shader_build.c @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #include "vl_shader_build.h" #include #include diff --git a/src/gallium/auxiliary/vl/vl_shader_build.h b/src/gallium/auxiliary/vl/vl_shader_build.h index c6c60b5552..5da71f8e13 100644 --- a/src/gallium/auxiliary/vl/vl_shader_build.h +++ b/src/gallium/auxiliary/vl/vl_shader_build.h @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #ifndef vl_shader_build_h #define vl_shader_build_h diff --git a/src/gallium/drivers/softpipe/sp_video_context.c b/src/gallium/drivers/softpipe/sp_video_context.c index 00b4b7d560..cae2d3efc5 100644 --- a/src/gallium/drivers/softpipe/sp_video_context.c +++ b/src/gallium/drivers/softpipe/sp_video_context.c @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #include "sp_video_context.h" #include #include diff --git a/src/gallium/drivers/softpipe/sp_video_context.h b/src/gallium/drivers/softpipe/sp_video_context.h index 2c7691c7cb..ccbd1ffe4c 100644 --- a/src/gallium/drivers/softpipe/sp_video_context.h +++ b/src/gallium/drivers/softpipe/sp_video_context.h @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #ifndef SP_VIDEO_CONTEXT_H #define SP_VIDEO_CONTEXT_H diff --git a/src/gallium/include/pipe/p_video_context.h b/src/gallium/include/pipe/p_video_context.h index 4d125fa4d5..6ae31418fa 100644 --- a/src/gallium/include/pipe/p_video_context.h +++ b/src/gallium/include/pipe/p_video_context.h @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #ifndef PIPE_VIDEO_CONTEXT_H #define PIPE_VIDEO_CONTEXT_H diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h index 2a7422bf04..4da26d608c 100644 --- a/src/gallium/include/pipe/p_video_state.h +++ b/src/gallium/include/pipe/p_video_state.h @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #ifndef PIPE_VIDEO_STATE_H #define PIPE_VIDEO_STATE_H diff --git a/src/gallium/state_trackers/xorg/xvmc/attributes.c b/src/gallium/state_trackers/xorg/xvmc/attributes.c index 638da0b577..79a67838e6 100644 --- a/src/gallium/state_trackers/xorg/xvmc/attributes.c +++ b/src/gallium/state_trackers/xorg/xvmc/attributes.c @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #include #include #include diff --git a/src/gallium/state_trackers/xorg/xvmc/block.c b/src/gallium/state_trackers/xorg/xvmc/block.c index 78fddfb79e..5102375fcf 100644 --- a/src/gallium/state_trackers/xorg/xvmc/block.c +++ b/src/gallium/state_trackers/xorg/xvmc/block.c @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #include #include #include diff --git a/src/gallium/state_trackers/xorg/xvmc/context.c b/src/gallium/state_trackers/xorg/xvmc/context.c index a002a7c844..942692d1bb 100644 --- a/src/gallium/state_trackers/xorg/xvmc/context.c +++ b/src/gallium/state_trackers/xorg/xvmc/context.c @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #include #include #include diff --git a/src/gallium/state_trackers/xorg/xvmc/subpicture.c b/src/gallium/state_trackers/xorg/xvmc/subpicture.c index 78ba618f5a..69898d5fcd 100644 --- a/src/gallium/state_trackers/xorg/xvmc/subpicture.c +++ b/src/gallium/state_trackers/xorg/xvmc/subpicture.c @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #include #include #include diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c index 6b7dbf11dc..bf9038f356 100644 --- a/src/gallium/state_trackers/xorg/xvmc/surface.c +++ b/src/gallium/state_trackers/xorg/xvmc/surface.c @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #include #include #include diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/test_blocks.c b/src/gallium/state_trackers/xorg/xvmc/tests/test_blocks.c index dc80adfa65..994e3ca4d1 100644 --- a/src/gallium/state_trackers/xorg/xvmc/tests/test_blocks.c +++ b/src/gallium/state_trackers/xorg/xvmc/tests/test_blocks.c @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #include #include #include "testlib.h" diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/test_context.c b/src/gallium/state_trackers/xorg/xvmc/tests/test_context.c index 53f7449cd0..3da957c933 100644 --- a/src/gallium/state_trackers/xorg/xvmc/tests/test_context.c +++ b/src/gallium/state_trackers/xorg/xvmc/tests/test_context.c @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #include #include #include "testlib.h" diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/test_rendering.c b/src/gallium/state_trackers/xorg/xvmc/tests/test_rendering.c index 6d720dfcdc..6058783a79 100644 --- a/src/gallium/state_trackers/xorg/xvmc/tests/test_rendering.c +++ b/src/gallium/state_trackers/xorg/xvmc/tests/test_rendering.c @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #include #include #include diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/test_surface.c b/src/gallium/state_trackers/xorg/xvmc/tests/test_surface.c index 06948201ac..b65eb265c0 100644 --- a/src/gallium/state_trackers/xorg/xvmc/tests/test_surface.c +++ b/src/gallium/state_trackers/xorg/xvmc/tests/test_surface.c @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #include #include #include "testlib.h" diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/testlib.c b/src/gallium/state_trackers/xorg/xvmc/tests/testlib.c index 59a03ca813..142c09bb59 100644 --- a/src/gallium/state_trackers/xorg/xvmc/tests/testlib.c +++ b/src/gallium/state_trackers/xorg/xvmc/tests/testlib.c @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #include "testlib.h" #include diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/testlib.h b/src/gallium/state_trackers/xorg/xvmc/tests/testlib.h index af71ad74e1..0438e52928 100644 --- a/src/gallium/state_trackers/xorg/xvmc/tests/testlib.h +++ b/src/gallium/state_trackers/xorg/xvmc/tests/testlib.h @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #ifndef testlib_h #define testlib_h diff --git a/src/gallium/state_trackers/xorg/xvmc/tests/xvmc_bench.c b/src/gallium/state_trackers/xorg/xvmc/tests/xvmc_bench.c index 97adcfc58a..bf94d85623 100644 --- a/src/gallium/state_trackers/xorg/xvmc/tests/xvmc_bench.c +++ b/src/gallium/state_trackers/xorg/xvmc/tests/xvmc_bench.c @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #include #include #include diff --git a/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h b/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h index 1e3dd561c6..42337631ca 100644 --- a/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h +++ b/src/gallium/state_trackers/xorg/xvmc/xvmc_private.h @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #ifndef xvmc_private_h #define xvmc_private_h diff --git a/src/gallium/winsys/g3dvl/vl_winsys.h b/src/gallium/winsys/g3dvl/vl_winsys.h index 4f7a243361..22119f9559 100644 --- a/src/gallium/winsys/g3dvl/vl_winsys.h +++ b/src/gallium/winsys/g3dvl/vl_winsys.h @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #ifndef vl_winsys_h #define vl_winsys_h diff --git a/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c b/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c index 37eee79c5d..0faad544d1 100644 --- a/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c +++ b/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c @@ -1,3 +1,30 @@ +/************************************************************************** + * + * Copyright 2009 Younes Manton. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + #include #include #include -- cgit v1.2.3 From 577f12fbba0b30925f43832ffd15214ca2218dca Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Thu, 1 Oct 2009 22:17:47 -0400 Subject: g3dvl: Delete state_trackers/g3dvl, other unused files. --- src/gallium/state_trackers/g3dvl/Makefile | 21 - src/gallium/state_trackers/g3dvl/vl_basic_csc.c | 720 ------------ src/gallium/state_trackers/g3dvl/vl_basic_csc.h | 13 - src/gallium/state_trackers/g3dvl/vl_context.c | 204 ---- src/gallium/state_trackers/g3dvl/vl_context.h | 73 -- src/gallium/state_trackers/g3dvl/vl_csc.h | 53 - src/gallium/state_trackers/g3dvl/vl_defs.h | 11 - src/gallium/state_trackers/g3dvl/vl_display.c | 48 - src/gallium/state_trackers/g3dvl/vl_display.h | 29 - .../state_trackers/g3dvl/vl_r16snorm_mc_buf.c | 1155 ------------------- .../state_trackers/g3dvl/vl_r16snorm_mc_buf.h | 18 - .../g3dvl/vl_r16snorm_mc_buf_shaders.inc | 1185 -------------------- src/gallium/state_trackers/g3dvl/vl_render.h | 38 - src/gallium/state_trackers/g3dvl/vl_screen.c | 115 -- src/gallium/state_trackers/g3dvl/vl_screen.h | 63 -- src/gallium/state_trackers/g3dvl/vl_shader_build.c | 215 ---- src/gallium/state_trackers/g3dvl/vl_shader_build.h | 61 - src/gallium/state_trackers/g3dvl/vl_surface.c | 242 ---- src/gallium/state_trackers/g3dvl/vl_surface.h | 86 -- src/gallium/state_trackers/g3dvl/vl_types.h | 115 -- src/gallium/state_trackers/g3dvl/vl_util.c | 16 - src/gallium/state_trackers/g3dvl/vl_util.h | 6 - src/gallium/winsys/g3dvl/xsp_winsys.c | 291 ----- 23 files changed, 4778 deletions(-) delete mode 100644 src/gallium/state_trackers/g3dvl/Makefile delete mode 100644 src/gallium/state_trackers/g3dvl/vl_basic_csc.c delete mode 100644 src/gallium/state_trackers/g3dvl/vl_basic_csc.h delete mode 100644 src/gallium/state_trackers/g3dvl/vl_context.c delete mode 100644 src/gallium/state_trackers/g3dvl/vl_context.h delete mode 100644 src/gallium/state_trackers/g3dvl/vl_csc.h delete mode 100644 src/gallium/state_trackers/g3dvl/vl_defs.h delete mode 100644 src/gallium/state_trackers/g3dvl/vl_display.c delete mode 100644 src/gallium/state_trackers/g3dvl/vl_display.h delete mode 100644 src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c delete mode 100644 src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.h delete mode 100644 src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf_shaders.inc delete mode 100644 src/gallium/state_trackers/g3dvl/vl_render.h delete mode 100644 src/gallium/state_trackers/g3dvl/vl_screen.c delete mode 100644 src/gallium/state_trackers/g3dvl/vl_screen.h delete mode 100644 src/gallium/state_trackers/g3dvl/vl_shader_build.c delete mode 100644 src/gallium/state_trackers/g3dvl/vl_shader_build.h delete mode 100644 src/gallium/state_trackers/g3dvl/vl_surface.c delete mode 100644 src/gallium/state_trackers/g3dvl/vl_surface.h delete mode 100644 src/gallium/state_trackers/g3dvl/vl_types.h delete mode 100644 src/gallium/state_trackers/g3dvl/vl_util.c delete mode 100644 src/gallium/state_trackers/g3dvl/vl_util.h delete mode 100644 src/gallium/winsys/g3dvl/xsp_winsys.c (limited to 'src') diff --git a/src/gallium/state_trackers/g3dvl/Makefile b/src/gallium/state_trackers/g3dvl/Makefile deleted file mode 100644 index f9f4d6be3c..0000000000 --- a/src/gallium/state_trackers/g3dvl/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -TARGET = libg3dvl.a -OBJECTS = vl_display.o vl_screen.o vl_context.o vl_surface.o vl_shader_build.o vl_util.o vl_basic_csc.o \ - vl_r16snorm_mc_buf.o -GALLIUMDIR = ../.. - -CFLAGS += -g -Wall -Werror-implicit-function-declaration -fPIC \ - -I${GALLIUMDIR}/include \ - -I${GALLIUMDIR}/auxiliary \ - -I${GALLIUMDIR}/winsys/g3dvl \ - -############################################# - -.PHONY = all clean - -all: ${TARGET} - -${TARGET}: ${OBJECTS} - ar rcs $@ $^ - -clean: - rm -rf ${OBJECTS} ${TARGET} diff --git a/src/gallium/state_trackers/g3dvl/vl_basic_csc.c b/src/gallium/state_trackers/g3dvl/vl_basic_csc.c deleted file mode 100644 index b1683b891b..0000000000 --- a/src/gallium/state_trackers/g3dvl/vl_basic_csc.c +++ /dev/null @@ -1,720 +0,0 @@ -#define VL_INTERNAL -#include "vl_basic_csc.h" -#include -#include -#include -#include -#include -#include -#include -#include "vl_csc.h" -#include "vl_surface.h" -#include "vl_shader_build.h" -#include "vl_types.h" - -struct vlVertexShaderConsts -{ - struct vlVertex4f dst_scale; - struct vlVertex4f dst_trans; - struct vlVertex4f src_scale; - struct vlVertex4f src_trans; -}; - -struct vlFragmentShaderConsts -{ - struct vlVertex4f bias; - float matrix[16]; -}; - -struct vlBasicCSC -{ - struct vlCSC base; - - struct pipe_context *pipe; - struct pipe_viewport_state viewport; - struct pipe_framebuffer_state framebuffer; - struct pipe_texture *framebuffer_tex; - void *sampler; - void *vertex_shader, *fragment_shader; - struct pipe_vertex_buffer vertex_bufs[2]; - struct pipe_vertex_element vertex_elems[2]; - struct pipe_constant_buffer vs_const_buf, fs_const_buf; -}; - -static int vlResizeFrameBuffer -( - struct vlCSC *csc, - unsigned int width, - unsigned int height -) -{ - struct vlBasicCSC *basic_csc; - struct pipe_context *pipe; - struct pipe_texture template; - float clear_color[4]; - - assert(csc); - - basic_csc = (struct vlBasicCSC*)csc; - pipe = basic_csc->pipe; - - if (basic_csc->framebuffer.width == width && basic_csc->framebuffer.height == height) - return 0; - - basic_csc->viewport.scale[0] = width; - basic_csc->viewport.scale[1] = height; - basic_csc->viewport.scale[2] = 1; - basic_csc->viewport.scale[3] = 1; - basic_csc->viewport.translate[0] = 0; - basic_csc->viewport.translate[1] = 0; - basic_csc->viewport.translate[2] = 0; - basic_csc->viewport.translate[3] = 0; - - clear_color[0] = 0.0f; - clear_color[1] = 0.0f; - clear_color[2] = 0.0f; - clear_color[3] = 0.0f; - - if (basic_csc->framebuffer_tex) - { - pipe_surface_reference(&basic_csc->framebuffer.cbufs[0], NULL); - pipe_texture_reference(&basic_csc->framebuffer_tex, NULL); - } - - memset(&template, 0, sizeof(struct pipe_texture)); - template.target = PIPE_TEXTURE_2D; - template.format = PIPE_FORMAT_A8R8G8B8_UNORM; - template.last_level = 0; - template.width[0] = width; - template.height[0] = height; - template.depth[0] = 1; - pf_get_block(template.format, &template.block); - template.tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET; - - basic_csc->framebuffer_tex = pipe->screen->texture_create(pipe->screen, &template); - - basic_csc->framebuffer.width = width; - basic_csc->framebuffer.height = height; - basic_csc->framebuffer.cbufs[0] = pipe->screen->get_tex_surface - ( - pipe->screen, - basic_csc->framebuffer_tex, - 0, 0, 0, PIPE_BUFFER_USAGE_GPU_READ | PIPE_BUFFER_USAGE_GPU_WRITE - ); - - /* Clear to black, in case video doesn't fill the entire window */ - pipe->set_framebuffer_state(pipe, &basic_csc->framebuffer); - pipe->clear(pipe, PIPE_CLEAR_COLOR, clear_color, 0.0f, 0); - - return 0; -} - -static int vlBegin -( - struct vlCSC *csc -) -{ - struct vlBasicCSC *basic_csc; - struct pipe_context *pipe; - - assert(csc); - - basic_csc = (struct vlBasicCSC*)csc; - pipe = basic_csc->pipe; - - pipe->set_framebuffer_state(pipe, &basic_csc->framebuffer); - pipe->set_viewport_state(pipe, &basic_csc->viewport); - pipe->bind_sampler_states(pipe, 1, (void**)&basic_csc->sampler); - /* Source texture set in vlPutPictureCSC() */ - pipe->bind_vs_state(pipe, basic_csc->vertex_shader); - pipe->bind_fs_state(pipe, basic_csc->fragment_shader); - pipe->set_vertex_buffers(pipe, 2, basic_csc->vertex_bufs); - pipe->set_vertex_elements(pipe, 2, basic_csc->vertex_elems); - pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, &basic_csc->vs_const_buf); - pipe->set_constant_buffer(pipe, PIPE_SHADER_FRAGMENT, 0, &basic_csc->fs_const_buf); - - return 0; -} - -static int vlPutPictureCSC -( - struct vlCSC *csc, - struct vlSurface *surface, - int srcx, - int srcy, - int srcw, - int srch, - int destx, - int desty, - int destw, - int desth, - enum vlPictureType picture_type -) -{ - struct vlBasicCSC *basic_csc; - struct pipe_context *pipe; - struct vlVertexShaderConsts *vs_consts; - - assert(csc); - assert(surface); - - basic_csc = (struct vlBasicCSC*)csc; - pipe = basic_csc->pipe; - - vs_consts = pipe_buffer_map - ( - pipe->screen, - basic_csc->vs_const_buf.buffer, - PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_DISCARD - ); - - vs_consts->dst_scale.x = destw / (float)basic_csc->framebuffer.cbufs[0]->width; - vs_consts->dst_scale.y = desth / (float)basic_csc->framebuffer.cbufs[0]->height; - vs_consts->dst_scale.z = 1; - vs_consts->dst_scale.w = 1; - vs_consts->dst_trans.x = destx / (float)basic_csc->framebuffer.cbufs[0]->width; - vs_consts->dst_trans.y = desty / (float)basic_csc->framebuffer.cbufs[0]->height; - vs_consts->dst_trans.z = 0; - vs_consts->dst_trans.w = 0; - - vs_consts->src_scale.x = srcw / (float)surface->texture->width[0]; - vs_consts->src_scale.y = srch / (float)surface->texture->height[0]; - vs_consts->src_scale.z = 1; - vs_consts->src_scale.w = 1; - vs_consts->src_trans.x = srcx / (float)surface->texture->width[0]; - vs_consts->src_trans.y = srcy / (float)surface->texture->height[0]; - vs_consts->src_trans.z = 0; - vs_consts->src_trans.w = 0; - - pipe_buffer_unmap(pipe->screen, basic_csc->vs_const_buf.buffer); - - pipe->set_sampler_textures(pipe, 1, &surface->texture); - pipe->draw_arrays(pipe, PIPE_PRIM_TRIANGLE_STRIP, 0, 4); - - return 0; -} - -static int vlEnd -( - struct vlCSC *csc -) -{ - assert(csc); - - return 0; -} - -static struct pipe_surface* vlGetFrameBuffer -( - struct vlCSC *csc -) -{ - struct vlBasicCSC *basic_csc; - - assert(csc); - - basic_csc = (struct vlBasicCSC*)csc; - - return basic_csc->framebuffer.cbufs[0]; -} - -static int vlDestroy -( - struct vlCSC *csc -) -{ - struct vlBasicCSC *basic_csc; - struct pipe_context *pipe; - unsigned int i; - - assert(csc); - - basic_csc = (struct vlBasicCSC*)csc; - pipe = basic_csc->pipe; - - if (basic_csc->framebuffer_tex) - { - pipe_surface_reference(&basic_csc->framebuffer.cbufs[0], NULL); - pipe_texture_reference(&basic_csc->framebuffer_tex, NULL); - } - - pipe->delete_sampler_state(pipe, basic_csc->sampler); - pipe->delete_vs_state(pipe, basic_csc->vertex_shader); - pipe->delete_fs_state(pipe, basic_csc->fragment_shader); - - for (i = 0; i < 2; ++i) - pipe_buffer_reference(&basic_csc->vertex_bufs[i].buffer, NULL); - - pipe_buffer_reference(&basic_csc->vs_const_buf.buffer, NULL); - pipe_buffer_reference(&basic_csc->fs_const_buf.buffer, NULL); - - FREE(basic_csc); - - return 0; -} - -/* - * Represents 2 triangles in a strip in normalized coords. - * Used to render the surface onto the frame buffer. - */ -static const struct vlVertex2f surface_verts[4] = -{ - {0.0f, 0.0f}, - {0.0f, 1.0f}, - {1.0f, 0.0f}, - {1.0f, 1.0f} -}; - -/* - * Represents texcoords for the above. We can use the position values directly. - * TODO: Duplicate these in the shader, no need to create a buffer. - */ -static const struct vlVertex2f *surface_texcoords = surface_verts; - -/* - * Identity color conversion constants, for debugging - */ -static const struct vlFragmentShaderConsts identity = -{ - { - 0.0f, 0.0f, 0.0f, 0.0f - }, - { - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - } -}; - -/* - * Converts ITU-R BT.601 YCbCr pixels to RGB pixels where: - * Y is in [16,235], Cb and Cr are in [16,240] - * R, G, and B are in [16,235] - */ -static const struct vlFragmentShaderConsts bt_601 = -{ - { - 0.0f, 0.501960784f, 0.501960784f, 0.0f - }, - { - 1.0f, 0.0f, 1.371f, 0.0f, - 1.0f, -0.336f, -0.698f, 0.0f, - 1.0f, 1.732f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - } -}; - -/* - * Converts ITU-R BT.601 YCbCr pixels to RGB pixels where: - * Y is in [16,235], Cb and Cr are in [16,240] - * R, G, and B are in [0,255] - */ -static const struct vlFragmentShaderConsts bt_601_full = -{ - { - 0.062745098f, 0.501960784f, 0.501960784f, 0.0f - }, - { - 1.164f, 0.0f, 1.596f, 0.0f, - 1.164f, -0.391f, -0.813f, 0.0f, - 1.164f, 2.018f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - } -}; - -/* - * Converts ITU-R BT.709 YCbCr pixels to RGB pixels where: - * Y is in [16,235], Cb and Cr are in [16,240] - * R, G, and B are in [16,235] - */ -static const struct vlFragmentShaderConsts bt_709 = -{ - { - 0.0f, 0.501960784f, 0.501960784f, 0.0f - }, - { - 1.0f, 0.0f, 1.540f, 0.0f, - 1.0f, -0.183f, -0.459f, 0.0f, - 1.0f, 1.816f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - } -}; - -/* - * Converts ITU-R BT.709 YCbCr pixels to RGB pixels where: - * Y is in [16,235], Cb and Cr are in [16,240] - * R, G, and B are in [0,255] - */ -const struct vlFragmentShaderConsts bt_709_full = -{ - { - 0.062745098f, 0.501960784f, 0.501960784f, 0.0f - }, - { - 1.164f, 0.0f, 1.793f, 0.0f, - 1.164f, -0.213f, -0.534f, 0.0f, - 1.164f, 2.115f, 0.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - } -}; - -static int vlCreateVertexShader -( - struct vlBasicCSC *csc -) -{ - const unsigned int max_tokens = 50; - - struct pipe_context *pipe; - struct pipe_shader_state vs; - struct tgsi_token *tokens; - struct tgsi_header *header; - - struct tgsi_full_declaration decl; - struct tgsi_full_instruction inst; - - unsigned int ti; - unsigned int i; - - assert(csc); - - pipe = csc->pipe; - tokens = (struct tgsi_token*)MALLOC(max_tokens * sizeof(struct tgsi_token)); - - /* Version */ - *(struct tgsi_version*)&tokens[0] = tgsi_build_version(); - /* Header */ - header = (struct tgsi_header*)&tokens[1]; - *header = tgsi_build_header(); - /* Processor */ - *(struct tgsi_processor*)&tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_VERTEX, header); - - ti = 3; - - /* - * decl i0 ; Vertex pos - * decl i1 ; Vertex texcoords - */ - for (i = 0; i < 2; i++) - { - decl = vl_decl_input(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - } - - /* - * decl c0 ; Scaling vector to scale vertex pos rect to destination size - * decl c1 ; Translation vector to move vertex pos rect into position - * decl c2 ; Scaling vector to scale texcoord rect to source size - * decl c3 ; Translation vector to move texcoord rect into position - */ - decl = vl_decl_constants(TGSI_SEMANTIC_GENERIC, 0, 0, 3); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* - * decl o0 ; Vertex pos - * decl o1 ; Vertex texcoords - */ - for (i = 0; i < 2; i++) - { - decl = vl_decl_output(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - } - - /* decl t0, t1 */ - decl = vl_decl_temps(0, 1); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* - * madd o0, i0, c0, c1 ; Scale and translate unit output rect to destination size and pos - * madd o1, i1, c2, c3 ; Scale and translate unit texcoord rect to source size and pos - */ - for (i = 0; i < 2; ++i) - { - inst = vl_inst4(TGSI_OPCODE_MAD, TGSI_FILE_OUTPUT, i, TGSI_FILE_INPUT, i, TGSI_FILE_CONSTANT, i * 2, TGSI_FILE_CONSTANT, i * 2 + 1); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - } - - /* end */ - inst = vl_end(); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - vs.tokens = tokens; - csc->vertex_shader = pipe->create_vs_state(pipe, &vs); - FREE(tokens); - - return 0; -} - -static int vlCreateFragmentShader -( - struct vlBasicCSC *csc -) -{ - const unsigned int max_tokens = 50; - - struct pipe_context *pipe; - struct pipe_shader_state fs; - struct tgsi_token *tokens; - struct tgsi_header *header; - - struct tgsi_full_declaration decl; - struct tgsi_full_instruction inst; - - unsigned int ti; - unsigned int i; - - assert(csc); - - pipe = csc->pipe; - tokens = (struct tgsi_token*)MALLOC(max_tokens * sizeof(struct tgsi_token)); - - /* Version */ - *(struct tgsi_version*)&tokens[0] = tgsi_build_version(); - /* Header */ - header = (struct tgsi_header*)&tokens[1]; - *header = tgsi_build_header(); - /* Processor */ - *(struct tgsi_processor*)&tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_FRAGMENT, header); - - ti = 3; - - /* decl i0 ; Texcoords for s0 */ - decl = vl_decl_interpolated_input(TGSI_SEMANTIC_GENERIC, 1, 0, 0, TGSI_INTERPOLATE_LINEAR); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* - * decl c0 ; Bias vector for CSC - * decl c1-c4 ; CSC matrix c1-c4 - */ - decl = vl_decl_constants(TGSI_SEMANTIC_GENERIC, 0, 0, 4); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* decl o0 ; Fragment color */ - decl = vl_decl_output(TGSI_SEMANTIC_COLOR, 0, 0, 0); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* decl t0 */ - decl = vl_decl_temps(0, 0); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* decl s0 ; Sampler for tex containing picture to display */ - decl = vl_decl_samplers(0, 0); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* tex2d t0, i0, s0 ; Read src pixel */ - inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_INPUT, 0, TGSI_FILE_SAMPLER, 0); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* sub t0, t0, c0 ; Subtract bias vector from pixel */ - inst = vl_inst3(TGSI_OPCODE_SUB, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_CONSTANT, 0); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* - * dp4 o0.x, t0, c1 ; Multiply pixel by the color conversion matrix - * dp4 o0.y, t0, c2 - * dp4 o0.z, t0, c3 - */ - for (i = 0; i < 3; ++i) - { - inst = vl_inst3(TGSI_OPCODE_DP4, TGSI_FILE_OUTPUT, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_CONSTANT, i + 1); - inst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - } - - /* end */ - inst = vl_end(); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - fs.tokens = tokens; - csc->fragment_shader = pipe->create_fs_state(pipe, &fs); - FREE(tokens); - - return 0; -} - -static int vlCreateDataBufs -( - struct vlBasicCSC *csc -) -{ - struct pipe_context *pipe; - - assert(csc); - - pipe = csc->pipe; - - /* - * Create our vertex buffer and vertex buffer element - * VB contains 4 vertices that render a quad covering the entire window - * to display a rendered surface - * Quad is rendered as a tri strip - */ - csc->vertex_bufs[0].stride = sizeof(struct vlVertex2f); - csc->vertex_bufs[0].max_index = 3; - csc->vertex_bufs[0].buffer_offset = 0; - csc->vertex_bufs[0].buffer = pipe_buffer_create - ( - pipe->screen, - 1, - PIPE_BUFFER_USAGE_VERTEX, - sizeof(struct vlVertex2f) * 4 - ); - - memcpy - ( - pipe_buffer_map(pipe->screen, csc->vertex_bufs[0].buffer, PIPE_BUFFER_USAGE_CPU_WRITE), - surface_verts, - sizeof(struct vlVertex2f) * 4 - ); - - pipe_buffer_unmap(pipe->screen, csc->vertex_bufs[0].buffer); - - csc->vertex_elems[0].src_offset = 0; - csc->vertex_elems[0].vertex_buffer_index = 0; - csc->vertex_elems[0].nr_components = 2; - csc->vertex_elems[0].src_format = PIPE_FORMAT_R32G32_FLOAT; - - /* - * Create our texcoord buffer and texcoord buffer element - * Texcoord buffer contains the TCs for mapping the rendered surface to the 4 vertices - */ - csc->vertex_bufs[1].stride = sizeof(struct vlVertex2f); - csc->vertex_bufs[1].max_index = 3; - csc->vertex_bufs[1].buffer_offset = 0; - csc->vertex_bufs[1].buffer = pipe_buffer_create - ( - pipe->screen, - 1, - PIPE_BUFFER_USAGE_VERTEX, - sizeof(struct vlVertex2f) * 4 - ); - - memcpy - ( - pipe_buffer_map(pipe->screen, csc->vertex_bufs[1].buffer, PIPE_BUFFER_USAGE_CPU_WRITE), - surface_texcoords, - sizeof(struct vlVertex2f) * 4 - ); - - pipe_buffer_unmap(pipe->screen, csc->vertex_bufs[1].buffer); - - csc->vertex_elems[1].src_offset = 0; - csc->vertex_elems[1].vertex_buffer_index = 1; - csc->vertex_elems[1].nr_components = 2; - csc->vertex_elems[1].src_format = PIPE_FORMAT_R32G32_FLOAT; - - /* - * Create our vertex shader's constant buffer - * Const buffer contains scaling and translation vectors - */ - csc->vs_const_buf.buffer = pipe_buffer_create - ( - pipe->screen, - 1, - PIPE_BUFFER_USAGE_CONSTANT | PIPE_BUFFER_USAGE_DISCARD, - sizeof(struct vlVertexShaderConsts) - ); - - /* - * Create our fragment shader's constant buffer - * Const buffer contains the color conversion matrix and bias vectors - */ - csc->fs_const_buf.buffer = pipe_buffer_create - ( - pipe->screen, - 1, - PIPE_BUFFER_USAGE_CONSTANT, - sizeof(struct vlFragmentShaderConsts) - ); - - /* - * TODO: Refactor this into a seperate function, - * allow changing the CSC matrix at runtime to switch between regular & full versions - */ - memcpy - ( - pipe_buffer_map(pipe->screen, csc->fs_const_buf.buffer, PIPE_BUFFER_USAGE_CPU_WRITE), - &bt_601_full, - sizeof(struct vlFragmentShaderConsts) - ); - - pipe_buffer_unmap(pipe->screen, csc->fs_const_buf.buffer); - - return 0; -} - -static int vlInit -( - struct vlBasicCSC *csc -) -{ - struct pipe_context *pipe; - struct pipe_sampler_state sampler; - - assert(csc); - - pipe = csc->pipe; - - /* Delay creating the FB until vlPutPictureCSC() so we know window size */ - csc->framebuffer_tex = NULL; - csc->framebuffer.width = 0; - csc->framebuffer.height = 0; - csc->framebuffer.nr_cbufs = 1; - csc->framebuffer.cbufs[0] = NULL; - csc->framebuffer.zsbuf = NULL; - - 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_img_filter = PIPE_TEX_FILTER_LINEAR; - sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE; - sampler.mag_img_filter = PIPE_TEX_FILTER_LINEAR; - sampler.compare_mode = PIPE_TEX_COMPARE_NONE; - sampler.compare_func = PIPE_FUNC_ALWAYS; - sampler.normalized_coords = 1; - /*sampler.prefilter = ;*/ - /*sampler.lod_bias = ;*/ - /*sampler.min_lod = ;*/ - /*sampler.max_lod = ;*/ - /*sampler.border_color[i] = ;*/ - /*sampler.max_anisotropy = ;*/ - csc->sampler = pipe->create_sampler_state(pipe, &sampler); - - vlCreateVertexShader(csc); - vlCreateFragmentShader(csc); - vlCreateDataBufs(csc); - - return 0; -} - -int vlCreateBasicCSC -( - struct pipe_context *pipe, - struct vlCSC **csc -) -{ - struct vlBasicCSC *basic_csc; - - assert(pipe); - assert(csc); - - basic_csc = CALLOC_STRUCT(vlBasicCSC); - - if (!basic_csc) - return 1; - - basic_csc->base.vlResizeFrameBuffer = &vlResizeFrameBuffer; - basic_csc->base.vlBegin = &vlBegin; - basic_csc->base.vlPutPicture = &vlPutPictureCSC; - basic_csc->base.vlEnd = &vlEnd; - basic_csc->base.vlGetFrameBuffer = &vlGetFrameBuffer; - basic_csc->base.vlDestroy = &vlDestroy; - basic_csc->pipe = pipe; - - vlInit(basic_csc); - - *csc = &basic_csc->base; - - return 0; -} diff --git a/src/gallium/state_trackers/g3dvl/vl_basic_csc.h b/src/gallium/state_trackers/g3dvl/vl_basic_csc.h deleted file mode 100644 index 2e17f1d814..0000000000 --- a/src/gallium/state_trackers/g3dvl/vl_basic_csc.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef vl_basic_csc_h -#define vl_basic_csc_h - -struct pipe_context; -struct vlCSC; - -int vlCreateBasicCSC -( - struct pipe_context *pipe, - struct vlCSC **csc -); - -#endif diff --git a/src/gallium/state_trackers/g3dvl/vl_context.c b/src/gallium/state_trackers/g3dvl/vl_context.c deleted file mode 100644 index cfbf618d74..0000000000 --- a/src/gallium/state_trackers/g3dvl/vl_context.c +++ /dev/null @@ -1,204 +0,0 @@ -#define VL_INTERNAL -#include "vl_context.h" -#include -#include -#include -#include -#include "vl_render.h" -#include "vl_r16snorm_mc_buf.h" -#include "vl_csc.h" -#include "vl_basic_csc.h" - -static int vlInitCommon(struct vlContext *context) -{ - struct pipe_context *pipe; - struct pipe_rasterizer_state rast; - struct pipe_blend_state blend; - struct pipe_depth_stencil_alpha_state dsa; - unsigned int i; - - assert(context); - - pipe = context->pipe; - - rast.flatshade = 1; - rast.flatshade_first = 0; - rast.light_twoside = 0; - rast.front_winding = PIPE_WINDING_CCW; - rast.cull_mode = PIPE_WINDING_CW; - rast.fill_cw = PIPE_POLYGON_MODE_FILL; - rast.fill_ccw = PIPE_POLYGON_MODE_FILL; - rast.offset_cw = 0; - rast.offset_ccw = 0; - rast.scissor = 0; - rast.poly_smooth = 0; - rast.poly_stipple_enable = 0; - rast.point_sprite = 0; - rast.point_size_per_vertex = 0; - rast.multisample = 0; - rast.line_smooth = 0; - rast.line_stipple_enable = 0; - rast.line_stipple_factor = 0; - rast.line_stipple_pattern = 0; - rast.line_last_pixel = 0; - rast.bypass_vs_clip_and_viewport = 0; - rast.line_width = 1; - rast.point_smooth = 0; - rast.point_size = 1; - rast.offset_units = 1; - rast.offset_scale = 1; - /*rast.sprite_coord_mode[i] = ;*/ - context->raster = pipe->create_rasterizer_state(pipe, &rast); - pipe->bind_rasterizer_state(pipe, context->raster); - - blend.blend_enable = 0; - blend.rgb_func = PIPE_BLEND_ADD; - blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE; - blend.rgb_dst_factor = PIPE_BLENDFACTOR_ONE; - blend.alpha_func = PIPE_BLEND_ADD; - blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE; - blend.alpha_dst_factor = PIPE_BLENDFACTOR_ONE; - blend.logicop_enable = 0; - blend.logicop_func = PIPE_LOGICOP_CLEAR; - /* Needed to allow color writes to FB, even if blending disabled */ - blend.colormask = PIPE_MASK_RGBA; - blend.dither = 0; - context->blend = pipe->create_blend_state(pipe, &blend); - pipe->bind_blend_state(pipe, context->blend); - - dsa.depth.enabled = 0; - dsa.depth.writemask = 0; - dsa.depth.func = PIPE_FUNC_ALWAYS; - for (i = 0; i < 2; ++i) - { - dsa.stencil[i].enabled = 0; - dsa.stencil[i].func = PIPE_FUNC_ALWAYS; - dsa.stencil[i].fail_op = PIPE_STENCIL_OP_KEEP; - dsa.stencil[i].zpass_op = PIPE_STENCIL_OP_KEEP; - dsa.stencil[i].zfail_op = PIPE_STENCIL_OP_KEEP; - dsa.stencil[i].ref_value = 0; - dsa.stencil[i].valuemask = 0; - dsa.stencil[i].writemask = 0; - } - dsa.alpha.enabled = 0; - dsa.alpha.func = PIPE_FUNC_ALWAYS; - dsa.alpha.ref_value = 0; - context->dsa = pipe->create_depth_stencil_alpha_state(pipe, &dsa); - pipe->bind_depth_stencil_alpha_state(pipe, context->dsa); - - return 0; -} - -int vlCreateContext -( - struct vlScreen *screen, - struct pipe_context *pipe, - unsigned int picture_width, - unsigned int picture_height, - enum vlFormat picture_format, - enum vlProfile profile, - enum vlEntryPoint entry_point, - struct vlContext **context -) -{ - struct vlContext *ctx; - - assert(screen); - assert(context); - assert(pipe); - - ctx = CALLOC_STRUCT(vlContext); - - if (!ctx) - return 1; - - ctx->screen = screen; - ctx->pipe = pipe; - ctx->picture_width = picture_width; - ctx->picture_height = picture_height; - ctx->picture_format = picture_format; - ctx->profile = profile; - ctx->entry_point = entry_point; - - vlInitCommon(ctx); - - vlCreateR16SNormBufferedMC(pipe, picture_width, picture_height, picture_format, &ctx->render); - vlCreateBasicCSC(pipe, &ctx->csc); - - *context = ctx; - - return 0; -} - -int vlDestroyContext -( - struct vlContext *context -) -{ - assert(context); - - /* XXX: Must unbind shaders before we can delete them for some reason */ - context->pipe->bind_vs_state(context->pipe, NULL); - context->pipe->bind_fs_state(context->pipe, NULL); - - context->render->vlDestroy(context->render); - context->csc->vlDestroy(context->csc); - - context->pipe->delete_blend_state(context->pipe, context->blend); - context->pipe->delete_rasterizer_state(context->pipe, context->raster); - context->pipe->delete_depth_stencil_alpha_state(context->pipe, context->dsa); - - FREE(context); - - return 0; -} - -struct vlScreen* vlContextGetScreen -( - struct vlContext *context -) -{ - assert(context); - - return context->screen; -} - -struct pipe_context* vlGetPipeContext -( - struct vlContext *context -) -{ - assert(context); - - return context->pipe; -} - -unsigned int vlGetPictureWidth -( - struct vlContext *context -) -{ - assert(context); - - return context->picture_width; -} - -unsigned int vlGetPictureHeight -( - struct vlContext *context -) -{ - assert(context); - - return context->picture_height; -} - -enum vlFormat vlGetPictureFormat -( - struct vlContext *context -) -{ - assert(context); - - return context->picture_format; -} diff --git a/src/gallium/state_trackers/g3dvl/vl_context.h b/src/gallium/state_trackers/g3dvl/vl_context.h deleted file mode 100644 index 3d14634c44..0000000000 --- a/src/gallium/state_trackers/g3dvl/vl_context.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef vl_context_h -#define vl_context_h - -#include "vl_types.h" - -struct pipe_context; - -#ifdef VL_INTERNAL -struct vlRender; -struct vlCSC; - -struct vlContext -{ - struct vlScreen *screen; - struct pipe_context *pipe; - unsigned int picture_width; - unsigned int picture_height; - enum vlFormat picture_format; - enum vlProfile profile; - enum vlEntryPoint entry_point; - - void *raster; - void *dsa; - void *blend; - - struct vlRender *render; - struct vlCSC *csc; -}; -#endif - -int vlCreateContext -( - struct vlScreen *screen, - struct pipe_context *pipe, - unsigned int picture_width, - unsigned int picture_height, - enum vlFormat picture_format, - enum vlProfile profile, - enum vlEntryPoint entry_point, - struct vlContext **context -); - -int vlDestroyContext -( - struct vlContext *context -); - -struct vlScreen* vlContextGetScreen -( - struct vlContext *context -); - -struct pipe_context* vlGetPipeContext -( - struct vlContext *context -); - -unsigned int vlGetPictureWidth -( - struct vlContext *context -); - -unsigned int vlGetPictureHeight -( - struct vlContext *context -); - -enum vlFormat vlGetPictureFormat -( - struct vlContext *context -); - -#endif diff --git a/src/gallium/state_trackers/g3dvl/vl_csc.h b/src/gallium/state_trackers/g3dvl/vl_csc.h deleted file mode 100644 index 36417a2792..0000000000 --- a/src/gallium/state_trackers/g3dvl/vl_csc.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef vl_csc_h -#define vl_csc_h - -#include "vl_types.h" - -struct pipe_surface; - -struct vlCSC -{ - int (*vlResizeFrameBuffer) - ( - struct vlCSC *csc, - unsigned int width, - unsigned int height - ); - - int (*vlBegin) - ( - struct vlCSC *csc - ); - - int (*vlPutPicture) - ( - struct vlCSC *csc, - struct vlSurface *surface, - int srcx, - int srcy, - int srcw, - int srch, - int destx, - int desty, - int destw, - int desth, - enum vlPictureType picture_type - ); - - int (*vlEnd) - ( - struct vlCSC *csc - ); - - struct pipe_surface* (*vlGetFrameBuffer) - ( - struct vlCSC *csc - ); - - int (*vlDestroy) - ( - struct vlCSC *csc - ); -}; - -#endif diff --git a/src/gallium/state_trackers/g3dvl/vl_defs.h b/src/gallium/state_trackers/g3dvl/vl_defs.h deleted file mode 100644 index d612d02502..0000000000 --- a/src/gallium/state_trackers/g3dvl/vl_defs.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef vl_defs_h -#define vl_defs_h - -#define VL_BLOCK_WIDTH 8 -#define VL_BLOCK_HEIGHT 8 -#define VL_BLOCK_SIZE (VL_BLOCK_WIDTH * VL_BLOCK_HEIGHT) -#define VL_MACROBLOCK_WIDTH 16 -#define VL_MACROBLOCK_HEIGHT 16 -#define VL_MACROBLOCK_SIZE (VL_MACROBLOCK_WIDTH * VL_MACROBLOCK_HEIGHT) - -#endif diff --git a/src/gallium/state_trackers/g3dvl/vl_display.c b/src/gallium/state_trackers/g3dvl/vl_display.c deleted file mode 100644 index dce06de758..0000000000 --- a/src/gallium/state_trackers/g3dvl/vl_display.c +++ /dev/null @@ -1,48 +0,0 @@ -#define VL_INTERNAL -#include "vl_display.h" -#include -#include - -int vlCreateDisplay -( - vlNativeDisplay native_display, - struct vlDisplay **display -) -{ - struct vlDisplay *dpy; - - assert(native_display); - assert(display); - - dpy = CALLOC_STRUCT(vlDisplay); - - if (!dpy) - return 1; - - dpy->native = native_display; - *display = dpy; - - return 0; -} - -int vlDestroyDisplay -( - struct vlDisplay *display -) -{ - assert(display); - - FREE(display); - - return 0; -} - -vlNativeDisplay vlGetNativeDisplay -( - struct vlDisplay *display -) -{ - assert(display); - - return display->native; -} diff --git a/src/gallium/state_trackers/g3dvl/vl_display.h b/src/gallium/state_trackers/g3dvl/vl_display.h deleted file mode 100644 index e11fd40799..0000000000 --- a/src/gallium/state_trackers/g3dvl/vl_display.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef vl_display_h -#define vl_display_h - -#include "vl_types.h" - -#ifdef VL_INTERNAL -struct vlDisplay -{ - vlNativeDisplay native; -}; -#endif - -int vlCreateDisplay -( - vlNativeDisplay native_display, - struct vlDisplay **display -); - -int vlDestroyDisplay -( - struct vlDisplay *display -); - -vlNativeDisplay vlGetNativeDisplay -( - struct vlDisplay *display -); - -#endif diff --git a/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c b/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c deleted file mode 100644 index 23631adb69..0000000000 --- a/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.c +++ /dev/null @@ -1,1155 +0,0 @@ -#define VL_INTERNAL -#include "vl_r16snorm_mc_buf.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "vl_render.h" -#include "vl_shader_build.h" -#include "vl_surface.h" -#include "vl_util.h" -#include "vl_types.h" -#include "vl_defs.h" - -const unsigned int DEFAULT_BUF_ALIGNMENT = 1; - -enum vlMacroBlockTypeEx -{ - vlMacroBlockExTypeIntra, - vlMacroBlockExTypeFwdPredictedFrame, - vlMacroBlockExTypeFwdPredictedField, - vlMacroBlockExTypeBkwdPredictedFrame, - vlMacroBlockExTypeBkwdPredictedField, - vlMacroBlockExTypeBiPredictedFrame, - vlMacroBlockExTypeBiPredictedField, - - vlNumMacroBlockExTypes -}; - -struct vlVertexShaderConsts -{ - struct vlVertex4f denorm; -}; - -struct vlFragmentShaderConsts -{ - struct vlVertex4f multiplier; - struct vlVertex4f div; -}; - -struct vlMacroBlockVertexStream0 -{ - struct vlVertex2f pos; - struct vlVertex2f luma_tc; - struct vlVertex2f cb_tc; - struct vlVertex2f cr_tc; -}; - -struct vlR16SnormBufferedMC -{ - struct vlRender base; - - unsigned int picture_width; - unsigned int picture_height; - enum vlFormat picture_format; - unsigned int macroblocks_per_picture; - - struct vlSurface *buffered_surface; - struct vlSurface *past_surface; - struct vlSurface *future_surface; - struct vlVertex2f surface_tex_inv_size; - struct vlVertex2f zero_block[3]; - unsigned int num_macroblocks; - struct vlMpeg2MacroBlock *macroblocks; - struct pipe_transfer *tex_transfer[3]; - short *texels[3]; - - struct pipe_context *pipe; - struct pipe_viewport_state viewport; - struct pipe_framebuffer_state render_target; - - union - { - void *all[5]; - struct - { - void *y; - void *cb; - void *cr; - void *ref[2]; - }; - } samplers; - - union - { - struct pipe_texture *all[5]; - struct - { - struct pipe_texture *y; - struct pipe_texture *cb; - struct pipe_texture *cr; - struct pipe_texture *ref[2]; - }; - } textures; - - union - { - struct pipe_vertex_buffer all[3]; - struct - { - struct pipe_vertex_buffer ycbcr; - struct pipe_vertex_buffer ref[2]; - }; - } vertex_bufs; - - void *i_vs, *p_vs[2], *b_vs[2]; - void *i_fs, *p_fs[2], *b_fs[2]; - struct pipe_vertex_element vertex_elems[8]; - struct pipe_constant_buffer vs_const_buf; - struct pipe_constant_buffer fs_const_buf; -}; - -static inline int vlBegin -( - struct vlRender *render -) -{ - assert(render); - - return 0; -} - -static inline int vlGrabFrameCodedBlock(short *src, short *dst, unsigned int dst_pitch) -{ - unsigned int y; - - for (y = 0; y < VL_BLOCK_HEIGHT; ++y) - memcpy - ( - dst + y * dst_pitch, - src + y * VL_BLOCK_WIDTH, - VL_BLOCK_WIDTH * 2 - ); - - return 0; -} - -static inline int vlGrabFieldCodedBlock(short *src, short *dst, unsigned int dst_pitch) -{ - unsigned int y; - - for (y = 0; y < VL_BLOCK_HEIGHT; ++y) - memcpy - ( - dst + y * dst_pitch * 2, - src + y * VL_BLOCK_WIDTH, - VL_BLOCK_WIDTH * 2 - ); - - return 0; -} - -static inline int vlGrabNoBlock(short *dst, unsigned int dst_pitch) -{ - unsigned int y; - - for (y = 0; y < VL_BLOCK_HEIGHT; ++y) - memset - ( - dst + y * dst_pitch, - 0, - VL_BLOCK_WIDTH * 2 - ); - - return 0; -} - -static inline int vlGrabBlocks -( - struct vlR16SnormBufferedMC *mc, - unsigned int mbx, - unsigned int mby, - enum vlDCTType dct_type, - unsigned int coded_block_pattern, - short *blocks -) -{ - short *texels; - unsigned int tex_pitch; - unsigned int x, y, tb = 0, sb = 0; - unsigned int mbpx = mbx * VL_MACROBLOCK_WIDTH, mbpy = mby * VL_MACROBLOCK_HEIGHT; - - assert(mc); - assert(blocks); - - tex_pitch = mc->tex_transfer[0]->stride / mc->tex_transfer[0]->block.size; - texels = mc->texels[0] + mbpy * tex_pitch + mbpx; - - for (y = 0; y < 2; ++y) - { - for (x = 0; x < 2; ++x, ++tb) - { - if ((coded_block_pattern >> (5 - tb)) & 1) - { - short *cur_block = blocks + sb * VL_BLOCK_WIDTH * VL_BLOCK_HEIGHT; - - if (dct_type == vlDCTTypeFrameCoded) - { - vlGrabFrameCodedBlock - ( - cur_block, - texels + y * tex_pitch * VL_BLOCK_HEIGHT + x * VL_BLOCK_WIDTH, - tex_pitch - ); - } - else - { - vlGrabFieldCodedBlock - ( - cur_block, - texels + y * tex_pitch + x * VL_BLOCK_WIDTH, - tex_pitch - ); - } - - ++sb; - } - else if (mc->zero_block[0].x < 0.0f) - { - vlGrabNoBlock(texels + y * tex_pitch * VL_BLOCK_HEIGHT + x * VL_BLOCK_WIDTH, tex_pitch); - - mc->zero_block[0].x = (mbpx + x * 8) * mc->surface_tex_inv_size.x; - mc->zero_block[0].y = (mbpy + y * 8) * mc->surface_tex_inv_size.y; - } - } - } - - /* TODO: Implement 422, 444 */ - mbpx >>= 1; - mbpy >>= 1; - - for (tb = 0; tb < 2; ++tb) - { - tex_pitch = mc->tex_transfer[tb + 1]->stride / mc->tex_transfer[tb + 1]->block.size; - texels = mc->texels[tb + 1] + mbpy * tex_pitch + mbpx; - - if ((coded_block_pattern >> (1 - tb)) & 1) - { - short *cur_block = blocks + sb * VL_BLOCK_WIDTH * VL_BLOCK_HEIGHT; - - vlGrabFrameCodedBlock - ( - cur_block, - texels, - tex_pitch - ); - - ++sb; - } - else if (mc->zero_block[tb + 1].x < 0.0f) - { - vlGrabNoBlock(texels, tex_pitch); - - mc->zero_block[tb + 1].x = (mbpx << 1) * mc->surface_tex_inv_size.x; - mc->zero_block[tb + 1].y = (mbpy << 1) * mc->surface_tex_inv_size.y; - } - } - - return 0; -} - -static inline enum vlMacroBlockTypeEx vlGetMacroBlockTypeEx(struct vlMpeg2MacroBlock *mb) -{ - assert(mb); - - switch (mb->mb_type) - { - case vlMacroBlockTypeIntra: - return vlMacroBlockExTypeIntra; - case vlMacroBlockTypeFwdPredicted: - return mb->mo_type == vlMotionTypeFrame ? - vlMacroBlockExTypeFwdPredictedFrame : vlMacroBlockExTypeFwdPredictedField; - case vlMacroBlockTypeBkwdPredicted: - return mb->mo_type == vlMotionTypeFrame ? - vlMacroBlockExTypeBkwdPredictedFrame : vlMacroBlockExTypeBkwdPredictedField; - case vlMacroBlockTypeBiPredicted: - return mb->mo_type == vlMotionTypeFrame ? - vlMacroBlockExTypeBiPredictedFrame : vlMacroBlockExTypeBiPredictedField; - default: - assert(0); - } - - /* Unreachable */ - return -1; -} - -static inline int vlGrabMacroBlock -( - struct vlR16SnormBufferedMC *mc, - struct vlMpeg2MacroBlock *macroblock -) -{ - assert(mc); - assert(macroblock); - assert(mc->num_macroblocks < mc->macroblocks_per_picture); - - mc->macroblocks[mc->num_macroblocks].mbx = macroblock->mbx; - mc->macroblocks[mc->num_macroblocks].mby = macroblock->mby; - mc->macroblocks[mc->num_macroblocks].mb_type = macroblock->mb_type; - mc->macroblocks[mc->num_macroblocks].mo_type = macroblock->mo_type; - mc->macroblocks[mc->num_macroblocks].dct_type = macroblock->dct_type; - mc->macroblocks[mc->num_macroblocks].PMV[0][0][0] = macroblock->PMV[0][0][0]; - mc->macroblocks[mc->num_macroblocks].PMV[0][0][1] = macroblock->PMV[0][0][1]; - mc->macroblocks[mc->num_macroblocks].PMV[0][1][0] = macroblock->PMV[0][1][0]; - mc->macroblocks[mc->num_macroblocks].PMV[0][1][1] = macroblock->PMV[0][1][1]; - mc->macroblocks[mc->num_macroblocks].PMV[1][0][0] = macroblock->PMV[1][0][0]; - mc->macroblocks[mc->num_macroblocks].PMV[1][0][1] = macroblock->PMV[1][0][1]; - mc->macroblocks[mc->num_macroblocks].PMV[1][1][0] = macroblock->PMV[1][1][0]; - mc->macroblocks[mc->num_macroblocks].PMV[1][1][1] = macroblock->PMV[1][1][1]; - mc->macroblocks[mc->num_macroblocks].cbp = macroblock->cbp; - mc->macroblocks[mc->num_macroblocks].blocks = macroblock->blocks; - - vlGrabBlocks - ( - mc, - macroblock->mbx, - macroblock->mby, - macroblock->dct_type, - macroblock->cbp, - macroblock->blocks - ); - - mc->num_macroblocks++; - - return 0; -} - -#define SET_BLOCK(vb, cbp, mbx, mby, unitx, unity, ofsx, ofsy, hx, hy, lm, cbm, crm, zb) \ - do { \ - (vb)[0].pos.x = (mbx) * (unitx) + (ofsx); (vb)[0].pos.y = (mby) * (unity) + (ofsy); \ - (vb)[1].pos.x = (mbx) * (unitx) + (ofsx); (vb)[1].pos.y = (mby) * (unity) + (ofsy) + (hy); \ - (vb)[2].pos.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[2].pos.y = (mby) * (unity) + (ofsy); \ - (vb)[3].pos.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[3].pos.y = (mby) * (unity) + (ofsy); \ - (vb)[4].pos.x = (mbx) * (unitx) + (ofsx); (vb)[4].pos.y = (mby) * (unity) + (ofsy) + (hy); \ - (vb)[5].pos.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[5].pos.y = (mby) * (unity) + (ofsy) + (hy); \ - \ - if ((cbp) & (lm)) \ - { \ - (vb)[0].luma_tc.x = (mbx) * (unitx) + (ofsx); (vb)[0].luma_tc.y = (mby) * (unity) + (ofsy); \ - (vb)[1].luma_tc.x = (mbx) * (unitx) + (ofsx); (vb)[1].luma_tc.y = (mby) * (unity) + (ofsy) + (hy); \ - (vb)[2].luma_tc.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[2].luma_tc.y = (mby) * (unity) + (ofsy); \ - (vb)[3].luma_tc.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[3].luma_tc.y = (mby) * (unity) + (ofsy); \ - (vb)[4].luma_tc.x = (mbx) * (unitx) + (ofsx); (vb)[4].luma_tc.y = (mby) * (unity) + (ofsy) + (hy); \ - (vb)[5].luma_tc.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[5].luma_tc.y = (mby) * (unity) + (ofsy) + (hy); \ - } \ - else \ - { \ - (vb)[0].luma_tc.x = (zb)[0].x; (vb)[0].luma_tc.y = (zb)[0].y; \ - (vb)[1].luma_tc.x = (zb)[0].x; (vb)[1].luma_tc.y = (zb)[0].y + (hy); \ - (vb)[2].luma_tc.x = (zb)[0].x + (hx); (vb)[2].luma_tc.y = (zb)[0].y; \ - (vb)[3].luma_tc.x = (zb)[0].x + (hx); (vb)[3].luma_tc.y = (zb)[0].y; \ - (vb)[4].luma_tc.x = (zb)[0].x; (vb)[4].luma_tc.y = (zb)[0].y + (hy); \ - (vb)[5].luma_tc.x = (zb)[0].x + (hx); (vb)[5].luma_tc.y = (zb)[0].y + (hy); \ - } \ - \ - if ((cbp) & (cbm)) \ - { \ - (vb)[0].cb_tc.x = (mbx) * (unitx) + (ofsx); (vb)[0].cb_tc.y = (mby) * (unity) + (ofsy); \ - (vb)[1].cb_tc.x = (mbx) * (unitx) + (ofsx); (vb)[1].cb_tc.y = (mby) * (unity) + (ofsy) + (hy); \ - (vb)[2].cb_tc.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[2].cb_tc.y = (mby) * (unity) + (ofsy); \ - (vb)[3].cb_tc.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[3].cb_tc.y = (mby) * (unity) + (ofsy); \ - (vb)[4].cb_tc.x = (mbx) * (unitx) + (ofsx); (vb)[4].cb_tc.y = (mby) * (unity) + (ofsy) + (hy); \ - (vb)[5].cb_tc.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[5].cb_tc.y = (mby) * (unity) + (ofsy) + (hy); \ - } \ - else \ - { \ - (vb)[0].cb_tc.x = (zb)[1].x; (vb)[0].cb_tc.y = (zb)[1].y; \ - (vb)[1].cb_tc.x = (zb)[1].x; (vb)[1].cb_tc.y = (zb)[1].y + (hy); \ - (vb)[2].cb_tc.x = (zb)[1].x + (hx); (vb)[2].cb_tc.y = (zb)[1].y; \ - (vb)[3].cb_tc.x = (zb)[1].x + (hx); (vb)[3].cb_tc.y = (zb)[1].y; \ - (vb)[4].cb_tc.x = (zb)[1].x; (vb)[4].cb_tc.y = (zb)[1].y + (hy); \ - (vb)[5].cb_tc.x = (zb)[1].x + (hx); (vb)[5].cb_tc.y = (zb)[1].y + (hy); \ - } \ - \ - if ((cbp) & (crm)) \ - { \ - (vb)[0].cr_tc.x = (mbx) * (unitx) + (ofsx); (vb)[0].cr_tc.y = (mby) * (unity) + (ofsy); \ - (vb)[1].cr_tc.x = (mbx) * (unitx) + (ofsx); (vb)[1].cr_tc.y = (mby) * (unity) + (ofsy) + (hy); \ - (vb)[2].cr_tc.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[2].cr_tc.y = (mby) * (unity) + (ofsy); \ - (vb)[3].cr_tc.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[3].cr_tc.y = (mby) * (unity) + (ofsy); \ - (vb)[4].cr_tc.x = (mbx) * (unitx) + (ofsx); (vb)[4].cr_tc.y = (mby) * (unity) + (ofsy) + (hy); \ - (vb)[5].cr_tc.x = (mbx) * (unitx) + (ofsx) + (hx); (vb)[5].cr_tc.y = (mby) * (unity) + (ofsy) + (hy); \ - } \ - else \ - { \ - (vb)[0].cr_tc.x = (zb)[2].x; (vb)[0].cr_tc.y = (zb)[2].y; \ - (vb)[1].cr_tc.x = (zb)[2].x; (vb)[1].cr_tc.y = (zb)[2].y + (hy); \ - (vb)[2].cr_tc.x = (zb)[2].x + (hx); (vb)[2].cr_tc.y = (zb)[2].y; \ - (vb)[3].cr_tc.x = (zb)[2].x + (hx); (vb)[3].cr_tc.y = (zb)[2].y; \ - (vb)[4].cr_tc.x = (zb)[2].x; (vb)[4].cr_tc.y = (zb)[2].y + (hy); \ - (vb)[5].cr_tc.x = (zb)[2].x + (hx); (vb)[5].cr_tc.y = (zb)[2].y + (hy); \ - } \ - } while (0) - -static inline int vlGenMacroblockVerts -( - struct vlR16SnormBufferedMC *mc, - struct vlMpeg2MacroBlock *macroblock, - unsigned int pos, - struct vlMacroBlockVertexStream0 *ycbcr_vb, - struct vlVertex2f **ref_vb -) -{ - struct vlVertex2f mo_vec[2]; - unsigned int i; - - assert(mc); - assert(macroblock); - assert(ycbcr_vb); - assert(pos < mc->macroblocks_per_picture); - - switch (macroblock->mb_type) - { - case vlMacroBlockTypeBiPredicted: - { - struct vlVertex2f *vb; - - assert(ref_vb && ref_vb[1]); - - vb = ref_vb[1] + pos * 2 * 24; - - mo_vec[0].x = macroblock->PMV[0][1][0] * 0.5f * mc->surface_tex_inv_size.x; - mo_vec[0].y = macroblock->PMV[0][1][1] * 0.5f * mc->surface_tex_inv_size.y; - - if (macroblock->mo_type == vlMotionTypeFrame) - { - for (i = 0; i < 24 * 2; i += 2) - { - vb[i].x = mo_vec[0].x; - vb[i].y = mo_vec[0].y; - } - } - else - { - mo_vec[1].x = macroblock->PMV[1][1][0] * 0.5f * mc->surface_tex_inv_size.x; - mo_vec[1].y = macroblock->PMV[1][1][1] * 0.5f * mc->surface_tex_inv_size.y; - - for (i = 0; i < 24 * 2; i += 2) - { - vb[i].x = mo_vec[0].x; - vb[i].y = mo_vec[0].y; - vb[i + 1].x = mo_vec[1].x; - vb[i + 1].y = mo_vec[1].y; - } - } - - /* fall-through */ - } - case vlMacroBlockTypeFwdPredicted: - case vlMacroBlockTypeBkwdPredicted: - { - struct vlVertex2f *vb; - - assert(ref_vb && ref_vb[0]); - - vb = ref_vb[0] + pos * 2 * 24; - - if (macroblock->mb_type == vlMacroBlockTypeBkwdPredicted) - { - mo_vec[0].x = macroblock->PMV[0][1][0] * 0.5f * mc->surface_tex_inv_size.x; - mo_vec[0].y = macroblock->PMV[0][1][1] * 0.5f * mc->surface_tex_inv_size.y; - - if (macroblock->mo_type == vlMotionTypeField) - { - mo_vec[1].x = macroblock->PMV[1][1][0] * 0.5f * mc->surface_tex_inv_size.x; - mo_vec[1].y = macroblock->PMV[1][1][1] * 0.5f * mc->surface_tex_inv_size.y; - } - } - else - { - mo_vec[0].x = macroblock->PMV[0][0][0] * 0.5f * mc->surface_tex_inv_size.x; - mo_vec[0].y = macroblock->PMV[0][0][1] * 0.5f * mc->surface_tex_inv_size.y; - - if (macroblock->mo_type == vlMotionTypeField) - { - mo_vec[1].x = macroblock->PMV[1][0][0] * 0.5f * mc->surface_tex_inv_size.x; - mo_vec[1].y = macroblock->PMV[1][0][1] * 0.5f * mc->surface_tex_inv_size.y; - } - } - - if (macroblock->mo_type == vlMotionTypeFrame) - { - for (i = 0; i < 24 * 2; i += 2) - { - vb[i].x = mo_vec[0].x; - vb[i].y = mo_vec[0].y; - } - } - else - { - for (i = 0; i < 24 * 2; i += 2) - { - vb[i].x = mo_vec[0].x; - vb[i].y = mo_vec[0].y; - vb[i + 1].x = mo_vec[1].x; - vb[i + 1].y = mo_vec[1].y; - } - } - - /* fall-through */ - } - case vlMacroBlockTypeIntra: - { - const struct vlVertex2f unit = - { - mc->surface_tex_inv_size.x * VL_MACROBLOCK_WIDTH, - mc->surface_tex_inv_size.y * VL_MACROBLOCK_HEIGHT - }; - const struct vlVertex2f half = - { - mc->surface_tex_inv_size.x * (VL_MACROBLOCK_WIDTH / 2), - mc->surface_tex_inv_size.y * (VL_MACROBLOCK_HEIGHT / 2) - }; - - struct vlMacroBlockVertexStream0 *vb; - - vb = ycbcr_vb + pos * 24; - - SET_BLOCK - ( - vb, - macroblock->cbp, macroblock->mbx, macroblock->mby, - unit.x, unit.y, 0, 0, half.x, half.y, - 32, 2, 1, mc->zero_block - ); - - SET_BLOCK - ( - vb + 6, - macroblock->cbp, macroblock->mbx, macroblock->mby, - unit.x, unit.y, half.x, 0, half.x, half.y, - 16, 2, 1, mc->zero_block - ); - - SET_BLOCK - ( - vb + 12, - macroblock->cbp, macroblock->mbx, macroblock->mby, - unit.x, unit.y, 0, half.y, half.x, half.y, - 8, 2, 1, mc->zero_block - ); - - SET_BLOCK - ( - vb + 18, - macroblock->cbp, macroblock->mbx, macroblock->mby, - unit.x, unit.y, half.x, half.y, half.x, half.y, - 4, 2, 1, mc->zero_block - ); - - break; - } - default: - assert(0); - } - - return 0; -} - -static int vlFlush -( - struct vlRender *render -) -{ - struct vlR16SnormBufferedMC *mc; - struct pipe_context *pipe; - struct vlVertexShaderConsts *vs_consts; - unsigned int num_macroblocks[vlNumMacroBlockExTypes] = {0}; - unsigned int offset[vlNumMacroBlockExTypes]; - unsigned int vb_start = 0; - unsigned int i; - - assert(render); - - mc = (struct vlR16SnormBufferedMC*)render; - - if (!mc->buffered_surface) - return 0; - - if (mc->num_macroblocks < mc->macroblocks_per_picture) - return 0; - - assert(mc->num_macroblocks <= mc->macroblocks_per_picture); - - pipe = mc->pipe; - - for (i = 0; i < mc->num_macroblocks; ++i) - { - enum vlMacroBlockTypeEx mb_type_ex = vlGetMacroBlockTypeEx(&mc->macroblocks[i]); - - num_macroblocks[mb_type_ex]++; - } - - offset[0] = 0; - - for (i = 1; i < vlNumMacroBlockExTypes; ++i) - offset[i] = offset[i - 1] + num_macroblocks[i - 1]; - - { - struct vlMacroBlockVertexStream0 *ycbcr_vb; - struct vlVertex2f *ref_vb[2]; - - ycbcr_vb = (struct vlMacroBlockVertexStream0*)pipe_buffer_map - ( - pipe->screen, - mc->vertex_bufs.ycbcr.buffer, - PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_DISCARD - ); - - for (i = 0; i < 2; ++i) - ref_vb[i] = (struct vlVertex2f*)pipe_buffer_map - ( - pipe->screen, - mc->vertex_bufs.ref[i].buffer, - PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_DISCARD - ); - - for (i = 0; i < mc->num_macroblocks; ++i) - { - enum vlMacroBlockTypeEx mb_type_ex = vlGetMacroBlockTypeEx(&mc->macroblocks[i]); - - vlGenMacroblockVerts(mc, &mc->macroblocks[i], offset[mb_type_ex], ycbcr_vb, ref_vb); - - offset[mb_type_ex]++; - } - - pipe_buffer_unmap(pipe->screen, mc->vertex_bufs.ycbcr.buffer); - for (i = 0; i < 2; ++i) - pipe_buffer_unmap(pipe->screen, mc->vertex_bufs.ref[i].buffer); - } - - for (i = 0; i < 3; ++i) - { - pipe->screen->transfer_unmap(pipe->screen, mc->tex_transfer[i]); - pipe->screen->tex_transfer_destroy(mc->tex_transfer[i]); - } - - mc->render_target.cbufs[0] = pipe->screen->get_tex_surface - ( - pipe->screen, - mc->buffered_surface->texture, - 0, 0, 0, PIPE_BUFFER_USAGE_GPU_READ | PIPE_BUFFER_USAGE_GPU_WRITE - ); - - pipe->set_framebuffer_state(pipe, &mc->render_target); - pipe->set_viewport_state(pipe, &mc->viewport); - vs_consts = pipe_buffer_map - ( - pipe->screen, - mc->vs_const_buf.buffer, - PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_DISCARD - ); - - vs_consts->denorm.x = mc->buffered_surface->texture->width[0]; - vs_consts->denorm.y = mc->buffered_surface->texture->height[0]; - - pipe_buffer_unmap(pipe->screen, mc->vs_const_buf.buffer); - pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, &mc->vs_const_buf); - pipe->set_constant_buffer(pipe, PIPE_SHADER_FRAGMENT, 0, &mc->fs_const_buf); - - if (num_macroblocks[vlMacroBlockExTypeIntra] > 0) - { - pipe->set_vertex_buffers(pipe, 1, mc->vertex_bufs.all); - pipe->set_vertex_elements(pipe, 4, mc->vertex_elems); - pipe->set_sampler_textures(pipe, 3, mc->textures.all); - pipe->bind_sampler_states(pipe, 3, mc->samplers.all); - pipe->bind_vs_state(pipe, mc->i_vs); - pipe->bind_fs_state(pipe, mc->i_fs); - - pipe->draw_arrays(pipe, PIPE_PRIM_TRIANGLES, vb_start, num_macroblocks[vlMacroBlockExTypeIntra] * 24); - vb_start += num_macroblocks[vlMacroBlockExTypeIntra] * 24; - } - - if (num_macroblocks[vlMacroBlockExTypeFwdPredictedFrame] > 0) - { - pipe->set_vertex_buffers(pipe, 2, mc->vertex_bufs.all); - pipe->set_vertex_elements(pipe, 6, mc->vertex_elems); - mc->textures.ref[0] = mc->past_surface->texture; - pipe->set_sampler_textures(pipe, 4, mc->textures.all); - pipe->bind_sampler_states(pipe, 4, mc->samplers.all); - pipe->bind_vs_state(pipe, mc->p_vs[0]); - pipe->bind_fs_state(pipe, mc->p_fs[0]); - - pipe->draw_arrays(pipe, PIPE_PRIM_TRIANGLES, vb_start, num_macroblocks[vlMacroBlockExTypeFwdPredictedFrame] * 24); - vb_start += num_macroblocks[vlMacroBlockExTypeFwdPredictedFrame] * 24; - } - - if (num_macroblocks[vlMacroBlockExTypeFwdPredictedField] > 0) - { - pipe->set_vertex_buffers(pipe, 2, mc->vertex_bufs.all); - pipe->set_vertex_elements(pipe, 6, mc->vertex_elems); - mc->textures.ref[0] = mc->past_surface->texture; - pipe->set_sampler_textures(pipe, 4, mc->textures.all); - pipe->bind_sampler_states(pipe, 4, mc->samplers.all); - pipe->bind_vs_state(pipe, mc->p_vs[1]); - pipe->bind_fs_state(pipe, mc->p_fs[1]); - - pipe->draw_arrays(pipe, PIPE_PRIM_TRIANGLES, vb_start, num_macroblocks[vlMacroBlockExTypeFwdPredictedField] * 24); - vb_start += num_macroblocks[vlMacroBlockExTypeFwdPredictedField] * 24; - } - - if (num_macroblocks[vlMacroBlockExTypeBkwdPredictedFrame] > 0) - { - pipe->set_vertex_buffers(pipe, 2, mc->vertex_bufs.all); - pipe->set_vertex_elements(pipe, 6, mc->vertex_elems); - mc->textures.ref[0] = mc->future_surface->texture; - pipe->set_sampler_textures(pipe, 4, mc->textures.all); - pipe->bind_sampler_states(pipe, 4, mc->samplers.all); - pipe->bind_vs_state(pipe, mc->p_vs[0]); - pipe->bind_fs_state(pipe, mc->p_fs[0]); - - pipe->draw_arrays(pipe, PIPE_PRIM_TRIANGLES, vb_start, num_macroblocks[vlMacroBlockExTypeBkwdPredictedFrame] * 24); - vb_start += num_macroblocks[vlMacroBlockExTypeBkwdPredictedFrame] * 24; - } - - if (num_macroblocks[vlMacroBlockExTypeBkwdPredictedField] > 0) - { - pipe->set_vertex_buffers(pipe, 2, mc->vertex_bufs.all); - pipe->set_vertex_elements(pipe, 6, mc->vertex_elems); - mc->textures.ref[0] = mc->future_surface->texture; - pipe->set_sampler_textures(pipe, 4, mc->textures.all); - pipe->bind_sampler_states(pipe, 4, mc->samplers.all); - pipe->bind_vs_state(pipe, mc->p_vs[1]); - pipe->bind_fs_state(pipe, mc->p_fs[1]); - - pipe->draw_arrays(pipe, PIPE_PRIM_TRIANGLES, vb_start, num_macroblocks[vlMacroBlockExTypeBkwdPredictedField] * 24); - vb_start += num_macroblocks[vlMacroBlockExTypeBkwdPredictedField] * 24; - } - - if (num_macroblocks[vlMacroBlockExTypeBiPredictedFrame] > 0) - { - pipe->set_vertex_buffers(pipe, 3, mc->vertex_bufs.all); - pipe->set_vertex_elements(pipe, 8, mc->vertex_elems); - mc->textures.ref[0] = mc->past_surface->texture; - mc->textures.ref[1] = mc->future_surface->texture; - pipe->set_sampler_textures(pipe, 5, mc->textures.all); - pipe->bind_sampler_states(pipe, 5, mc->samplers.all); - pipe->bind_vs_state(pipe, mc->b_vs[0]); - pipe->bind_fs_state(pipe, mc->b_fs[0]); - - pipe->draw_arrays(pipe, PIPE_PRIM_TRIANGLES, vb_start, num_macroblocks[vlMacroBlockExTypeBiPredictedFrame] * 24); - vb_start += num_macroblocks[vlMacroBlockExTypeBiPredictedFrame] * 24; - } - - if (num_macroblocks[vlMacroBlockExTypeBiPredictedField] > 0) - { - pipe->set_vertex_buffers(pipe, 3, mc->vertex_bufs.all); - pipe->set_vertex_elements(pipe, 8, mc->vertex_elems); - mc->textures.ref[0] = mc->past_surface->texture; - mc->textures.ref[1] = mc->future_surface->texture; - pipe->set_sampler_textures(pipe, 5, mc->textures.all); - pipe->bind_sampler_states(pipe, 5, mc->samplers.all); - pipe->bind_vs_state(pipe, mc->b_vs[1]); - pipe->bind_fs_state(pipe, mc->b_fs[1]); - - pipe->draw_arrays(pipe, PIPE_PRIM_TRIANGLES, vb_start, num_macroblocks[vlMacroBlockExTypeBiPredictedField] * 24); - vb_start += num_macroblocks[vlMacroBlockExTypeBiPredictedField] * 24; - } - - pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, &mc->buffered_surface->render_fence); - pipe_surface_reference(&mc->render_target.cbufs[0], NULL); - - for (i = 0; i < 3; ++i) - mc->zero_block[i].x = -1.0f; - - mc->buffered_surface = NULL; - mc->num_macroblocks = 0; - - return 0; -} - -static int vlRenderMacroBlocksMpeg2R16SnormBuffered -( - struct vlRender *render, - struct vlMpeg2MacroBlockBatch *batch, - struct vlSurface *surface -) -{ - struct vlR16SnormBufferedMC *mc; - bool new_surface = false; - unsigned int i; - - assert(render); - - mc = (struct vlR16SnormBufferedMC*)render; - - if (mc->buffered_surface) - { - if (mc->buffered_surface != surface) - { - vlFlush(&mc->base); - new_surface = true; - } - } - else - new_surface = true; - - if (new_surface) - { - mc->buffered_surface = surface; - mc->past_surface = batch->past_surface; - mc->future_surface = batch->future_surface; - mc->surface_tex_inv_size.x = 1.0f / surface->texture->width[0]; - mc->surface_tex_inv_size.y = 1.0f / surface->texture->height[0]; - - for (i = 0; i < 3; ++i) - { - mc->tex_transfer[i] = mc->pipe->screen->get_tex_transfer - ( - mc->pipe->screen, - mc->textures.all[i], - 0, 0, 0, PIPE_TRANSFER_WRITE, 0, 0, - surface->texture->width[0], - surface->texture->height[0] - ); - - mc->texels[i] = mc->pipe->screen->transfer_map(mc->pipe->screen, mc->tex_transfer[i]); - } - } - - for (i = 0; i < batch->num_macroblocks; ++i) - vlGrabMacroBlock(mc, &batch->macroblocks[i]); - - return 0; -} - -static inline int vlEnd -( - struct vlRender *render -) -{ - assert(render); - - return 0; -} - -static int vlDestroy -( - struct vlRender *render -) -{ - struct vlR16SnormBufferedMC *mc; - struct pipe_context *pipe; - unsigned int i; - - assert(render); - - mc = (struct vlR16SnormBufferedMC*)render; - pipe = mc->pipe; - - for (i = 0; i < 5; ++i) - pipe->delete_sampler_state(pipe, mc->samplers.all[i]); - - for (i = 0; i < 3; ++i) - pipe_buffer_reference(&mc->vertex_bufs.all[i].buffer, NULL); - - /* Textures 3 & 4 are not created directly, no need to release them here */ - for (i = 0; i < 3; ++i) - pipe_texture_reference(&mc->textures.all[i], NULL); - - pipe->delete_vs_state(pipe, mc->i_vs); - pipe->delete_fs_state(pipe, mc->i_fs); - - for (i = 0; i < 2; ++i) - { - pipe->delete_vs_state(pipe, mc->p_vs[i]); - pipe->delete_fs_state(pipe, mc->p_fs[i]); - pipe->delete_vs_state(pipe, mc->b_vs[i]); - pipe->delete_fs_state(pipe, mc->b_fs[i]); - } - - pipe_buffer_reference(&mc->vs_const_buf.buffer, NULL); - pipe_buffer_reference(&mc->fs_const_buf.buffer, NULL); - - FREE(mc->macroblocks); - FREE(mc); - - return 0; -} - -/* - * Muliplier renormalizes block samples from 16 bits to 12 bits. - * Divider is used when calculating Y % 2 for choosing top or bottom - * field for P or B macroblocks. - * TODO: Use immediates. - */ -static const struct vlFragmentShaderConsts fs_consts = -{ - {32767.0f / 255.0f, 32767.0f / 255.0f, 32767.0f / 255.0f, 0.0f}, - {0.5f, 2.0f, 0.0f, 0.0f} -}; - -#include "vl_r16snorm_mc_buf_shaders.inc" - -static int vlCreateDataBufs -( - struct vlR16SnormBufferedMC *mc -) -{ - const unsigned int mbw = align(mc->picture_width, VL_MACROBLOCK_WIDTH) / VL_MACROBLOCK_WIDTH; - const unsigned int mbh = align(mc->picture_height, VL_MACROBLOCK_HEIGHT) / VL_MACROBLOCK_HEIGHT; - - struct pipe_context *pipe; - unsigned int i; - - assert(mc); - - pipe = mc->pipe; - mc->macroblocks_per_picture = mbw * mbh; - - /* Create our vertex buffers */ - mc->vertex_bufs.ycbcr.stride = sizeof(struct vlVertex2f) * 4; - mc->vertex_bufs.ycbcr.max_index = 24 * mc->macroblocks_per_picture - 1; - mc->vertex_bufs.ycbcr.buffer_offset = 0; - mc->vertex_bufs.ycbcr.buffer = pipe_buffer_create - ( - pipe->screen, - DEFAULT_BUF_ALIGNMENT, - PIPE_BUFFER_USAGE_VERTEX | PIPE_BUFFER_USAGE_DISCARD, - sizeof(struct vlVertex2f) * 4 * 24 * mc->macroblocks_per_picture - ); - - for (i = 1; i < 3; ++i) - { - mc->vertex_bufs.all[i].stride = sizeof(struct vlVertex2f) * 2; - mc->vertex_bufs.all[i].max_index = 24 * mc->macroblocks_per_picture - 1; - mc->vertex_bufs.all[i].buffer_offset = 0; - mc->vertex_bufs.all[i].buffer = pipe_buffer_create - ( - pipe->screen, - DEFAULT_BUF_ALIGNMENT, - PIPE_BUFFER_USAGE_VERTEX | PIPE_BUFFER_USAGE_DISCARD, - sizeof(struct vlVertex2f) * 2 * 24 * mc->macroblocks_per_picture - ); - } - - /* Position element */ - mc->vertex_elems[0].src_offset = 0; - mc->vertex_elems[0].vertex_buffer_index = 0; - mc->vertex_elems[0].nr_components = 2; - mc->vertex_elems[0].src_format = PIPE_FORMAT_R32G32_FLOAT; - - /* Luma, texcoord element */ - mc->vertex_elems[1].src_offset = sizeof(struct vlVertex2f); - mc->vertex_elems[1].vertex_buffer_index = 0; - mc->vertex_elems[1].nr_components = 2; - mc->vertex_elems[1].src_format = PIPE_FORMAT_R32G32_FLOAT; - - /* Chroma Cr texcoord element */ - mc->vertex_elems[2].src_offset = sizeof(struct vlVertex2f) * 2; - mc->vertex_elems[2].vertex_buffer_index = 0; - mc->vertex_elems[2].nr_components = 2; - mc->vertex_elems[2].src_format = PIPE_FORMAT_R32G32_FLOAT; - - /* Chroma Cb texcoord element */ - mc->vertex_elems[3].src_offset = sizeof(struct vlVertex2f) * 3; - mc->vertex_elems[3].vertex_buffer_index = 0; - mc->vertex_elems[3].nr_components = 2; - mc->vertex_elems[3].src_format = PIPE_FORMAT_R32G32_FLOAT; - - /* First ref surface top field texcoord element */ - mc->vertex_elems[4].src_offset = 0; - mc->vertex_elems[4].vertex_buffer_index = 1; - mc->vertex_elems[4].nr_components = 2; - mc->vertex_elems[4].src_format = PIPE_FORMAT_R32G32_FLOAT; - - /* First ref surface bottom field texcoord element */ - mc->vertex_elems[5].src_offset = sizeof(struct vlVertex2f); - mc->vertex_elems[5].vertex_buffer_index = 1; - mc->vertex_elems[5].nr_components = 2; - mc->vertex_elems[5].src_format = PIPE_FORMAT_R32G32_FLOAT; - - /* Second ref surface top field texcoord element */ - mc->vertex_elems[6].src_offset = 0; - mc->vertex_elems[6].vertex_buffer_index = 2; - mc->vertex_elems[6].nr_components = 2; - mc->vertex_elems[6].src_format = PIPE_FORMAT_R32G32_FLOAT; - - /* Second ref surface bottom field texcoord element */ - mc->vertex_elems[7].src_offset = sizeof(struct vlVertex2f); - mc->vertex_elems[7].vertex_buffer_index = 2; - mc->vertex_elems[7].nr_components = 2; - mc->vertex_elems[7].src_format = PIPE_FORMAT_R32G32_FLOAT; - - /* Create our constant buffer */ - mc->vs_const_buf.buffer = pipe_buffer_create - ( - pipe->screen, - DEFAULT_BUF_ALIGNMENT, - PIPE_BUFFER_USAGE_CONSTANT | PIPE_BUFFER_USAGE_DISCARD, - sizeof(struct vlVertexShaderConsts) - ); - - mc->fs_const_buf.buffer = pipe_buffer_create - ( - pipe->screen, - DEFAULT_BUF_ALIGNMENT, - PIPE_BUFFER_USAGE_CONSTANT, - sizeof(struct vlFragmentShaderConsts) - ); - - memcpy - ( - pipe_buffer_map(pipe->screen, mc->fs_const_buf.buffer, PIPE_BUFFER_USAGE_CPU_WRITE), - &fs_consts, - sizeof(struct vlFragmentShaderConsts) - ); - - pipe_buffer_unmap(pipe->screen, mc->fs_const_buf.buffer); - - mc->macroblocks = MALLOC(sizeof(struct vlMpeg2MacroBlock) * mc->macroblocks_per_picture); - - return 0; -} - -static int vlInit -( - struct vlR16SnormBufferedMC *mc -) -{ - struct pipe_context *pipe; - struct pipe_sampler_state sampler; - struct pipe_texture template; - unsigned int filters[5]; - unsigned int i; - - assert(mc); - - pipe = mc->pipe; - - mc->buffered_surface = NULL; - mc->past_surface = NULL; - mc->future_surface = NULL; - for (i = 0; i < 3; ++i) - mc->zero_block[i].x = -1.0f; - mc->num_macroblocks = 0; - - /* For MC we render to textures, which are rounded up to nearest POT */ - mc->viewport.scale[0] = vlRoundUpPOT(mc->picture_width); - mc->viewport.scale[1] = vlRoundUpPOT(mc->picture_height); - mc->viewport.scale[2] = 1; - mc->viewport.scale[3] = 1; - mc->viewport.translate[0] = 0; - mc->viewport.translate[1] = 0; - mc->viewport.translate[2] = 0; - mc->viewport.translate[3] = 0; - - mc->render_target.width = vlRoundUpPOT(mc->picture_width); - mc->render_target.height = vlRoundUpPOT(mc->picture_height); - mc->render_target.nr_cbufs = 1; - /* FB for MC stage is a vlSurface created by the user, set at render time */ - mc->render_target.zsbuf = NULL; - - filters[0] = PIPE_TEX_FILTER_NEAREST; - /* FIXME: Linear causes discoloration around block edges */ - filters[1] = /*mc->picture_format == vlFormatYCbCr444 ?*/ PIPE_TEX_FILTER_NEAREST /*: PIPE_TEX_FILTER_LINEAR*/; - filters[2] = /*mc->picture_format == vlFormatYCbCr444 ?*/ PIPE_TEX_FILTER_NEAREST /*: PIPE_TEX_FILTER_LINEAR*/; - filters[3] = PIPE_TEX_FILTER_LINEAR; - filters[4] = PIPE_TEX_FILTER_LINEAR; - - for (i = 0; i < 5; ++i) - { - 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_img_filter = filters[i]; - sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE; - sampler.mag_img_filter = filters[i]; - sampler.compare_mode = PIPE_TEX_COMPARE_NONE; - sampler.compare_func = PIPE_FUNC_ALWAYS; - sampler.normalized_coords = 1; - /*sampler.prefilter = ;*/ - /*sampler.lod_bias = ;*/ - sampler.min_lod = 0; - /*sampler.max_lod = ;*/ - /*sampler.border_color[i] = ;*/ - /*sampler.max_anisotropy = ;*/ - mc->samplers.all[i] = pipe->create_sampler_state(pipe, &sampler); - } - - memset(&template, 0, sizeof(struct pipe_texture)); - template.target = PIPE_TEXTURE_2D; - template.format = PIPE_FORMAT_R16_SNORM; - template.last_level = 0; - template.width[0] = vlRoundUpPOT(mc->picture_width); - template.height[0] = vlRoundUpPOT(mc->picture_height); - template.depth[0] = 1; - pf_get_block(template.format, &template.block); - template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_DYNAMIC; - - mc->textures.y = pipe->screen->texture_create(pipe->screen, &template); - - if (mc->picture_format == vlFormatYCbCr420) - { - template.width[0] = vlRoundUpPOT(mc->picture_width / 2); - template.height[0] = vlRoundUpPOT(mc->picture_height / 2); - } - else if (mc->picture_format == vlFormatYCbCr422) - template.height[0] = vlRoundUpPOT(mc->picture_height / 2); - - mc->textures.cb = pipe->screen->texture_create(pipe->screen, &template); - mc->textures.cr = pipe->screen->texture_create(pipe->screen, &template); - - /* textures.all[3] & textures.all[4] are assigned from vlSurfaces for P and B macroblocks at render time */ - - vlCreateVertexShaderIMB(mc); - vlCreateFragmentShaderIMB(mc); - vlCreateVertexShaderFramePMB(mc); - vlCreateVertexShaderFieldPMB(mc); - vlCreateFragmentShaderFramePMB(mc); - vlCreateFragmentShaderFieldPMB(mc); - vlCreateVertexShaderFrameBMB(mc); - vlCreateVertexShaderFieldBMB(mc); - vlCreateFragmentShaderFrameBMB(mc); - vlCreateFragmentShaderFieldBMB(mc); - vlCreateDataBufs(mc); - - return 0; -} - -int vlCreateR16SNormBufferedMC -( - struct pipe_context *pipe, - unsigned int picture_width, - unsigned int picture_height, - enum vlFormat picture_format, - struct vlRender **render -) -{ - struct vlR16SnormBufferedMC *mc; - - assert(pipe); - assert(render); - - mc = CALLOC_STRUCT(vlR16SnormBufferedMC); - - mc->base.vlBegin = &vlBegin; - mc->base.vlRenderMacroBlocksMpeg2 = &vlRenderMacroBlocksMpeg2R16SnormBuffered; - mc->base.vlEnd = &vlEnd; - mc->base.vlFlush = &vlFlush; - mc->base.vlDestroy = &vlDestroy; - mc->pipe = pipe; - mc->picture_width = picture_width; - mc->picture_height = picture_height; - - vlInit(mc); - - *render = &mc->base; - - return 0; -} diff --git a/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.h b/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.h deleted file mode 100644 index 27177d64ca..0000000000 --- a/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef vl_r16snorm_mc_buf_h -#define vl_r16snorm_mc_buf_h - -#include "vl_types.h" - -struct pipe_context; -struct vlRender; - -int vlCreateR16SNormBufferedMC -( - struct pipe_context *pipe, - unsigned int picture_width, - unsigned int picture_height, - enum vlFormat picture_format, - struct vlRender **render -); - -#endif diff --git a/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf_shaders.inc b/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf_shaders.inc deleted file mode 100644 index 34d93e1df0..0000000000 --- a/src/gallium/state_trackers/g3dvl/vl_r16snorm_mc_buf_shaders.inc +++ /dev/null @@ -1,1185 +0,0 @@ -static int vlCreateVertexShaderIMB -( - struct vlR16SnormBufferedMC *mc -) -{ - const unsigned int max_tokens = 50; - - struct pipe_context *pipe; - struct pipe_shader_state vs; - struct tgsi_token *tokens; - struct tgsi_header *header; - - struct tgsi_full_declaration decl; - struct tgsi_full_instruction inst; - - unsigned int ti; - unsigned int i; - - assert(mc); - - pipe = mc->pipe; - tokens = (struct tgsi_token*)malloc(max_tokens * sizeof(struct tgsi_token)); - - /* Version */ - *(struct tgsi_version*)&tokens[0] = tgsi_build_version(); - /* Header */ - header = (struct tgsi_header*)&tokens[1]; - *header = tgsi_build_header(); - /* Processor */ - *(struct tgsi_processor*)&tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_VERTEX, header); - - ti = 3; - - /* - * decl i0 ; Vertex pos - * decl i1 ; Luma texcoords - * decl i2 ; Chroma Cb texcoords - * decl i3 ; Chroma Cr texcoords - */ - for (i = 0; i < 4; i++) - { - decl = vl_decl_input(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - } - - /* - * decl o0 ; Vertex pos - * decl o1 ; Luma texcoords - * decl o2 ; Chroma Cb texcoords - * decl o3 ; Chroma Cr texcoords - */ - for (i = 0; i < 4; i++) - { - decl = vl_decl_output(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - } - - /* - * mov o0, i0 ; Move input vertex pos to output - * mov o1, i1 ; Move input luma texcoords to output - * mov o2, i2 ; Move input chroma Cb texcoords to output - * mov o3, i3 ; Move input chroma Cr texcoords to output - */ - for (i = 0; i < 4; ++i) - { - inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_OUTPUT, i, TGSI_FILE_INPUT, i); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - } - - /* end */ - inst = vl_end(); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - vs.tokens = tokens; - mc->i_vs = pipe->create_vs_state(pipe, &vs); - free(tokens); - - return 0; -} - -static int vlCreateFragmentShaderIMB -( - struct vlR16SnormBufferedMC *mc -) -{ - const unsigned int max_tokens = 100; - - struct pipe_context *pipe; - struct pipe_shader_state fs; - struct tgsi_token *tokens; - struct tgsi_header *header; - - struct tgsi_full_declaration decl; - struct tgsi_full_instruction inst; - - unsigned int ti; - unsigned int i; - - assert(mc); - - pipe = mc->pipe; - tokens = (struct tgsi_token*)malloc(max_tokens * sizeof(struct tgsi_token)); - - /* Version */ - *(struct tgsi_version*)&tokens[0] = tgsi_build_version(); - /* Header */ - header = (struct tgsi_header*)&tokens[1]; - *header = tgsi_build_header(); - /* Processor */ - *(struct tgsi_processor*)&tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_FRAGMENT, header); - - ti = 3; - - /* - * decl i0 ; Luma texcoords - * decl i1 ; Chroma Cb texcoords - * decl i2 ; Chroma Cr texcoords - */ - for (i = 0; i < 3; ++i) - { - decl = vl_decl_interpolated_input(TGSI_SEMANTIC_GENERIC, i + 1, i, i, TGSI_INTERPOLATE_LINEAR); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - } - - /* decl c0 ; Scaling factor, rescales 16-bit snorm to 9-bit snorm */ - decl = vl_decl_constants(TGSI_SEMANTIC_GENERIC, 0, 0, 0); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* decl o0 ; Fragment color */ - decl = vl_decl_output(TGSI_SEMANTIC_COLOR, 0, 0, 0); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* decl t0, t1 */ - decl = vl_decl_temps(0, 1); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* - * decl s0 ; Sampler for luma texture - * decl s1 ; Sampler for chroma Cb texture - * decl s2 ; Sampler for chroma Cr texture - */ - for (i = 0; i < 3; ++i) - { - decl = vl_decl_samplers(i, i); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header,max_tokens - ti); - } - - /* - * tex2d t1, i0, s0 ; Read texel from luma texture - * mov t0.x, t1.x ; Move luma sample into .x component - * tex2d t1, i1, s1 ; Read texel from chroma Cb texture - * mov t0.y, t1.x ; Move Cb sample into .y component - * tex2d t1, i2, s2 ; Read texel from chroma Cr texture - * mov t0.z, t1.x ; Move Cr sample into .z component - */ - for (i = 0; i < 3; ++i) - { - inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_INPUT, i, TGSI_FILE_SAMPLER, i); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1); - inst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; - inst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - } - - /* mul o0, t0, c0 ; Rescale texel to correct range */ - inst = vl_inst3(TGSI_OPCODE_MUL, TGSI_FILE_OUTPUT, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_CONSTANT, 0); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* end */ - inst = vl_end(); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - fs.tokens = tokens; - mc->i_fs = pipe->create_fs_state(pipe, &fs); - free(tokens); - - return 0; -} - -static int vlCreateVertexShaderFramePMB -( - struct vlR16SnormBufferedMC *mc -) -{ - const unsigned int max_tokens = 100; - - struct pipe_context *pipe; - struct pipe_shader_state vs; - struct tgsi_token *tokens; - struct tgsi_header *header; - - struct tgsi_full_declaration decl; - struct tgsi_full_instruction inst; - - unsigned int ti; - unsigned int i; - - assert(mc); - - pipe = mc->pipe; - tokens = (struct tgsi_token*)malloc(max_tokens * sizeof(struct tgsi_token)); - - /* Version */ - *(struct tgsi_version*)&tokens[0] = tgsi_build_version(); - /* Header */ - header = (struct tgsi_header*)&tokens[1]; - *header = tgsi_build_header(); - /* Processor */ - *(struct tgsi_processor*)&tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_VERTEX, header); - - ti = 3; - - /* - * decl i0 ; Vertex pos - * decl i1 ; Luma texcoords - * decl i2 ; Chroma Cb texcoords - * decl i3 ; Chroma Cr texcoords - * decl i4 ; Ref surface top field texcoords - * decl i5 ; Ref surface bottom field texcoords (unused, packed in the same stream) - */ - for (i = 0; i < 6; i++) - { - decl = vl_decl_input(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - } - - /* - * decl o0 ; Vertex pos - * decl o1 ; Luma texcoords - * decl o2 ; Chroma Cb texcoords - * decl o3 ; Chroma Cr texcoords - * decl o4 ; Ref macroblock texcoords - */ - for (i = 0; i < 5; i++) - { - decl = vl_decl_output(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - } - - /* - * mov o0, i0 ; Move input vertex pos to output - * mov o1, i1 ; Move input luma texcoords to output - * mov o2, i2 ; Move input chroma Cb texcoords to output - * mov o3, i3 ; Move input chroma Cr texcoords to output - */ - for (i = 0; i < 4; ++i) - { - inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_OUTPUT, i, TGSI_FILE_INPUT, i); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - } - - /* add o4, i0, i4 ; Translate vertex pos by motion vec to form ref macroblock texcoords */ - inst = vl_inst3(TGSI_OPCODE_ADD, TGSI_FILE_OUTPUT, 4, TGSI_FILE_INPUT, 0, TGSI_FILE_INPUT, 4); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* end */ - inst = vl_end(); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - vs.tokens = tokens; - mc->p_vs[0] = pipe->create_vs_state(pipe, &vs); - free(tokens); - - return 0; -} - -static int vlCreateVertexShaderFieldPMB -( - struct vlR16SnormBufferedMC *mc -) -{ - const unsigned int max_tokens = 100; - - struct pipe_context *pipe; - struct pipe_shader_state vs; - struct tgsi_token *tokens; - struct tgsi_header *header; - - struct tgsi_full_declaration decl; - struct tgsi_full_instruction inst; - - unsigned int ti; - unsigned int i; - - assert(mc); - - pipe = mc->pipe; - tokens = (struct tgsi_token*)malloc(max_tokens * sizeof(struct tgsi_token)); - - /* Version */ - *(struct tgsi_version*)&tokens[0] = tgsi_build_version(); - /* Header */ - header = (struct tgsi_header*)&tokens[1]; - *header = tgsi_build_header(); - /* Processor */ - *(struct tgsi_processor*)&tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_VERTEX, header); - - ti = 3; - - /* - * decl i0 ; Vertex pos - * decl i1 ; Luma texcoords - * decl i2 ; Chroma Cb texcoords - * decl i3 ; Chroma Cr texcoords - * decl i4 ; Ref macroblock top field texcoords - * decl i5 ; Ref macroblock bottom field texcoords - */ - for (i = 0; i < 6; i++) - { - decl = vl_decl_input(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - } - - /* decl c0 ; Render target dimensions */ - decl = vl_decl_constants(TGSI_SEMANTIC_GENERIC, 0, 0, 0); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* - * decl o0 ; Vertex pos - * decl o1 ; Luma texcoords - * decl o2 ; Chroma Cb texcoords - * decl o3 ; Chroma Cr texcoords - * decl o4 ; Ref macroblock top field texcoords - * decl o5 ; Ref macroblock bottom field texcoords - * decl o6 ; Denormalized vertex pos - */ - for (i = 0; i < 7; i++) - { - decl = vl_decl_output(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - } - - /* - * mov o0, i0 ; Move input vertex pos to output - * mov o1, i1 ; Move input luma texcoords to output - * mov o2, i2 ; Move input chroma Cb texcoords to output - * mov o3, i3 ; Move input chroma Cr texcoords to output - */ - for (i = 0; i < 4; ++i) - { - inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_OUTPUT, i, TGSI_FILE_INPUT, i); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - } - - /* - * add o4, i0, i4 ; Translate vertex pos by motion vec to form top field macroblock texcoords - * add o5, i0, i5 ; Translate vertex pos by motion vec to form bottom field macroblock texcoords - */ - for (i = 0; i < 2; ++i) - { - inst = vl_inst3(TGSI_OPCODE_ADD, TGSI_FILE_OUTPUT, i + 4, TGSI_FILE_INPUT, 0, TGSI_FILE_INPUT, i + 4); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - } - - /* mul o6, i0, c0 ; Denorm vertex pos */ - inst = vl_inst3(TGSI_OPCODE_MUL, TGSI_FILE_OUTPUT, 6, TGSI_FILE_INPUT, 0, TGSI_FILE_CONSTANT, 0); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* end */ - inst = vl_end(); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - vs.tokens = tokens; - mc->p_vs[1] = pipe->create_vs_state(pipe, &vs); - free(tokens); - - return 0; -} - -static int vlCreateFragmentShaderFramePMB -( - struct vlR16SnormBufferedMC *mc -) -{ - const unsigned int max_tokens = 100; - - struct pipe_context *pipe; - struct pipe_shader_state fs; - struct tgsi_token *tokens; - struct tgsi_header *header; - - struct tgsi_full_declaration decl; - struct tgsi_full_instruction inst; - - unsigned int ti; - unsigned int i; - - assert(mc); - - pipe = mc->pipe; - tokens = (struct tgsi_token*)malloc(max_tokens * sizeof(struct tgsi_token)); - - /* Version */ - *(struct tgsi_version*)&tokens[0] = tgsi_build_version(); - /* Header */ - header = (struct tgsi_header*)&tokens[1]; - *header = tgsi_build_header(); - /* Processor */ - *(struct tgsi_processor*)&tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_FRAGMENT, header); - - ti = 3; - - /* - * decl i0 ; Luma texcoords - * decl i1 ; Chroma Cb texcoords - * decl i2 ; Chroma Cr texcoords - * decl i3 ; Ref macroblock texcoords - */ - for (i = 0; i < 4; ++i) - { - decl = vl_decl_interpolated_input(TGSI_SEMANTIC_GENERIC, i + 1, i, i, TGSI_INTERPOLATE_LINEAR); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - } - - /* decl c0 ; Scaling factor, rescales 16-bit snorm to 9-bit snorm */ - decl = vl_decl_constants(TGSI_SEMANTIC_GENERIC, 0, 0, 0); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* decl o0 ; Fragment color */ - decl = vl_decl_output(TGSI_SEMANTIC_COLOR, 0, 0, 0); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* decl t0, t1 */ - decl = vl_decl_temps(0, 1); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* - * decl s0 ; Sampler for luma texture - * decl s1 ; Sampler for chroma Cb texture - * decl s2 ; Sampler for chroma Cr texture - * decl s3 ; Sampler for ref surface texture - */ - for (i = 0; i < 4; ++i) - { - decl = vl_decl_samplers(i, i); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - } - - /* - * tex2d t1, i0, s0 ; Read texel from luma texture - * mov t0.x, t1.x ; Move luma sample into .x component - * tex2d t1, i1, s1 ; Read texel from chroma Cb texture - * mov t0.y, t1.x ; Move Cb sample into .y component - * tex2d t1, i2, s2 ; Read texel from chroma Cr texture - * mov t0.z, t1.x ; Move Cr sample into .z component - */ - for (i = 0; i < 3; ++i) - { - inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_INPUT, i, TGSI_FILE_SAMPLER, i); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1); - inst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; - inst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - } - - /* mul t0, t0, c0 ; Rescale texel to correct range */ - inst = vl_inst3(TGSI_OPCODE_MUL, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_CONSTANT, 0); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* tex2d t1, i3, s3 ; Read texel from ref macroblock */ - inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_INPUT, 3, TGSI_FILE_SAMPLER, 3); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* add o0, t0, t1 ; Add ref and differential to form final output */ - inst = vl_inst3(TGSI_OPCODE_ADD, TGSI_FILE_OUTPUT, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* end */ - inst = vl_end(); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - fs.tokens = tokens; - mc->p_fs[0] = pipe->create_fs_state(pipe, &fs); - free(tokens); - - return 0; -} - -static int vlCreateFragmentShaderFieldPMB -( - struct vlR16SnormBufferedMC *mc -) -{ - const unsigned int max_tokens = 200; - - struct pipe_context *pipe; - struct pipe_shader_state fs; - struct tgsi_token *tokens; - struct tgsi_header *header; - - struct tgsi_full_declaration decl; - struct tgsi_full_instruction inst; - - unsigned int ti; - unsigned int i; - - assert(mc); - - pipe = mc->pipe; - tokens = (struct tgsi_token*)malloc(max_tokens * sizeof(struct tgsi_token)); - - /* Version */ - *(struct tgsi_version*)&tokens[0] = tgsi_build_version(); - /* Header */ - header = (struct tgsi_header*)&tokens[1]; - *header = tgsi_build_header(); - /* Processor */ - *(struct tgsi_processor*)&tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_FRAGMENT, header); - - ti = 3; - - /* - * decl i0 ; Luma texcoords - * decl i1 ; Chroma Cb texcoords - * decl i2 ; Chroma Cr texcoords - * decl i3 ; Ref macroblock top field texcoords - * decl i4 ; Ref macroblock bottom field texcoords - * decl i5 ; Denormalized vertex pos - */ - for (i = 0; i < 6; ++i) - { - decl = vl_decl_interpolated_input(TGSI_SEMANTIC_GENERIC, i + 1, i, i, TGSI_INTERPOLATE_LINEAR); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - } - - /* - * decl c0 ; Scaling factor, rescales 16-bit snorm to 9-bit snorm - * decl c1 ; Constants 1/2 & 2 in .x, .y channels for Y-mod-2 top/bottom field selection - */ - decl = vl_decl_constants(TGSI_SEMANTIC_GENERIC, 0, 0, 1); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* decl o0 ; Fragment color */ - decl = vl_decl_output(TGSI_SEMANTIC_COLOR, 0, 0, 0); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* decl t0-t4 */ - decl = vl_decl_temps(0, 4); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* - * decl s0 ; Sampler for luma texture - * decl s1 ; Sampler for chroma Cb texture - * decl s2 ; Sampler for chroma Cr texture - * decl s3 ; Sampler for ref surface texture - */ - for (i = 0; i < 4; ++i) - { - decl = vl_decl_samplers(i, i); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - } - - /* - * tex2d t1, i0, s0 ; Read texel from luma texture - * mov t0.x, t1.x ; Move luma sample into .x component - * tex2d t1, i1, s1 ; Read texel from chroma Cb texture - * mov t0.y, t1.x ; Move Cb sample into .y component - * tex2d t1, i2, s2 ; Read texel from chroma Cr texture - * mov t0.z, t1.x ; Move Cr sample into .z component - */ - for (i = 0; i < 3; ++i) - { - inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_INPUT, i, TGSI_FILE_SAMPLER, i); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1); - inst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; - inst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - } - - /* mul t0, t0, c0 ; Rescale texel to correct range */ - inst = vl_inst3(TGSI_OPCODE_MUL, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_CONSTANT, 0); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* - * tex2d t1, i3, s3 ; Read texel from ref macroblock top field - * tex2d t2, i4, s3 ; Read texel from ref macroblock bottom field - */ - for (i = 0; i < 2; ++i) - { - inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, i + 1, TGSI_FILE_INPUT, i + 3, TGSI_FILE_SAMPLER, 3); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - } - - /* XXX: Pos values off by 0.5? */ - /* sub t4, i5.y, c1.x ; Sub 0.5 from denormalized pos */ - inst = vl_inst3(TGSI_OPCODE_SUB, TGSI_FILE_TEMPORARY, 4, TGSI_FILE_INPUT, 5, TGSI_FILE_CONSTANT, 1); - inst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_Y; - inst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_Y; - inst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_Y; - inst.FullSrcRegisters[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_Y; - inst.FullSrcRegisters[1].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[1].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[1].SrcRegister.SwizzleW = TGSI_SWIZZLE_X; - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* mul t3, t4, c1.x ; Multiply pos Y-coord by 1/2 */ - inst = vl_inst3(TGSI_OPCODE_MUL, TGSI_FILE_TEMPORARY, 3, TGSI_FILE_TEMPORARY, 4, TGSI_FILE_CONSTANT, 1); - inst.FullSrcRegisters[1].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[1].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[1].SrcRegister.SwizzleW = TGSI_SWIZZLE_X; - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* floor t3, t3 ; Get rid of fractional part */ - inst = vl_inst2(TGSI_OPCODE_FLR, TGSI_FILE_TEMPORARY, 3, TGSI_FILE_TEMPORARY, 3); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* mul t3, t3, c1.y ; Multiply by 2 */ - inst = vl_inst3(TGSI_OPCODE_MUL, TGSI_FILE_TEMPORARY, 3, TGSI_FILE_TEMPORARY, 3, TGSI_FILE_CONSTANT, 1); - inst.FullSrcRegisters[1].SrcRegister.SwizzleX = TGSI_SWIZZLE_Y; - inst.FullSrcRegisters[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_Y; - inst.FullSrcRegisters[1].SrcRegister.SwizzleZ = TGSI_SWIZZLE_Y; - inst.FullSrcRegisters[1].SrcRegister.SwizzleW = TGSI_SWIZZLE_Y; - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* sub t3, t4, t3 ; Subtract from original Y to get Y % 2 */ - inst = vl_inst3(TGSI_OPCODE_SUB, TGSI_FILE_TEMPORARY, 3, TGSI_FILE_TEMPORARY, 4, TGSI_FILE_TEMPORARY, 3); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* TODO: Move to conditional tex fetch on t3 instead of lerp */ - /* lerp t1, t3, t1, t2 ; Choose between top and bottom fields based on Y % 2 */ - inst = vl_inst4(TGSI_OPCODE_LRP, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_TEMPORARY, 3, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_TEMPORARY, 2); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* add o0, t0, t1 ; Add ref and differential to form final output */ - inst = vl_inst3(TGSI_OPCODE_ADD, TGSI_FILE_OUTPUT, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* end */ - inst = vl_end(); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - fs.tokens = tokens; - mc->p_fs[1] = pipe->create_fs_state(pipe, &fs); - free(tokens); - - return 0; -} - -static int vlCreateVertexShaderFrameBMB -( - struct vlR16SnormBufferedMC *mc -) -{ - const unsigned int max_tokens = 100; - - struct pipe_context *pipe; - struct pipe_shader_state vs; - struct tgsi_token *tokens; - struct tgsi_header *header; - - struct tgsi_full_declaration decl; - struct tgsi_full_instruction inst; - - unsigned int ti; - unsigned int i; - - assert(mc); - - pipe = mc->pipe; - tokens = (struct tgsi_token*)malloc(max_tokens * sizeof(struct tgsi_token)); - - /* Version */ - *(struct tgsi_version*)&tokens[0] = tgsi_build_version(); - /* Header */ - header = (struct tgsi_header*)&tokens[1]; - *header = tgsi_build_header(); - /* Processor */ - *(struct tgsi_processor*)&tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_VERTEX, header); - - ti = 3; - - /* - * decl i0 ; Vertex pos - * decl i1 ; Luma texcoords - * decl i2 ; Chroma Cb texcoords - * decl i3 ; Chroma Cr texcoords - * decl i4 ; First ref macroblock top field texcoords - * decl i5 ; First ref macroblock bottom field texcoords (unused, packed in the same stream) - * decl i6 ; Second ref macroblock top field texcoords - * decl i7 ; Second ref macroblock bottom field texcoords (unused, packed in the same stream) - */ - for (i = 0; i < 8; i++) - { - decl = vl_decl_input(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - } - - /* - * decl o0 ; Vertex pos - * decl o1 ; Luma texcoords - * decl o2 ; Chroma Cb texcoords - * decl o3 ; Chroma Cr texcoords - * decl o4 ; First ref macroblock texcoords - * decl o5 ; Second ref macroblock texcoords - */ - for (i = 0; i < 6; i++) - { - decl = vl_decl_output(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - } - - /* - * mov o0, i0 ; Move input vertex pos to output - * mov o1, i1 ; Move input luma texcoords to output - * mov o2, i2 ; Move input chroma Cb texcoords to output - * mov o3, i3 ; Move input chroma Cr texcoords to output - */ - for (i = 0; i < 4; ++i) - { - inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_OUTPUT, i, TGSI_FILE_INPUT, i); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - } - - /* - * add o4, i0, i4 ; Translate vertex pos by motion vec to form first ref macroblock texcoords - * add o5, i0, i6 ; Translate vertex pos by motion vec to form second ref macroblock texcoords - */ - for (i = 0; i < 2; ++i) - { - inst = vl_inst3(TGSI_OPCODE_ADD, TGSI_FILE_OUTPUT, i + 4, TGSI_FILE_INPUT, 0, TGSI_FILE_INPUT, (i + 2) * 2); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - } - - /* end */ - inst = vl_end(); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - vs.tokens = tokens; - mc->b_vs[0] = pipe->create_vs_state(pipe, &vs); - free(tokens); - - return 0; -} - -static int vlCreateVertexShaderFieldBMB -( - struct vlR16SnormBufferedMC *mc -) -{ - const unsigned int max_tokens = 100; - - struct pipe_context *pipe; - struct pipe_shader_state vs; - struct tgsi_token *tokens; - struct tgsi_header *header; - - struct tgsi_full_declaration decl; - struct tgsi_full_instruction inst; - - unsigned int ti; - unsigned int i; - - assert(mc); - - pipe = mc->pipe; - tokens = (struct tgsi_token*)malloc(max_tokens * sizeof(struct tgsi_token)); - - /* Version */ - *(struct tgsi_version*)&tokens[0] = tgsi_build_version(); - /* Header */ - header = (struct tgsi_header*)&tokens[1]; - *header = tgsi_build_header(); - /* Processor */ - *(struct tgsi_processor*)&tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_VERTEX, header); - - ti = 3; - - /* - * decl i0 ; Vertex pos - * decl i1 ; Luma texcoords - * decl i2 ; Chroma Cb texcoords - * decl i3 ; Chroma Cr texcoords - * decl i4 ; First ref macroblock top field texcoords - * decl i5 ; First ref macroblock bottom field texcoords - * decl i6 ; Second ref macroblock top field texcoords - * decl i7 ; Second ref macroblock bottom field texcoords - */ - for (i = 0; i < 8; i++) - { - decl = vl_decl_input(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - } - - /* decl c0 ; Render target dimensions */ - decl = vl_decl_constants(TGSI_SEMANTIC_GENERIC, 0, 0, 0); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* - * decl o0 ; Vertex pos - * decl o1 ; Luma texcoords - * decl o2 ; Chroma Cb texcoords - * decl o3 ; Chroma Cr texcoords - * decl o4 ; First ref macroblock top field texcoords - * decl o5 ; First ref macroblock Bottom field texcoords - * decl o6 ; Second ref macroblock top field texcoords - * decl o7 ; Second ref macroblock Bottom field texcoords - * decl o8 ; Denormalized vertex pos - */ - for (i = 0; i < 9; i++) - { - decl = vl_decl_output(i == 0 ? TGSI_SEMANTIC_POSITION : TGSI_SEMANTIC_GENERIC, i, i, i); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - } - - /* decl t0, t1 */ - decl = vl_decl_temps(0, 1); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* - * mov o0, i0 ; Move input vertex pos to output - * mov o1, i1 ; Move input luma texcoords to output - * mov o2, i2 ; Move input chroma Cb texcoords to output - * mov o3, i3 ; Move input chroma Cr texcoords to output - */ - for (i = 0; i < 4; ++i) - { - inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_OUTPUT, i, TGSI_FILE_INPUT, i); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - } - - /* - * add o4, i0, i4 ; Translate vertex pos by motion vec to form first top field macroblock texcoords - * add o5, i0, i5 ; Translate vertex pos by motion vec to form first bottom field macroblock texcoords - * add o6, i0, i6 ; Translate vertex pos by motion vec to form second top field macroblock texcoords - * add o7, i0, i7 ; Translate vertex pos by motion vec to form second bottom field macroblock texcoords - */ - for (i = 0; i < 4; ++i) - { - inst = vl_inst3(TGSI_OPCODE_ADD, TGSI_FILE_OUTPUT, i + 4, TGSI_FILE_INPUT, 0, TGSI_FILE_INPUT, i + 4); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - } - - /* mul o8, i0, c0 ; Denorm vertex pos */ - inst = vl_inst3(TGSI_OPCODE_MUL, TGSI_FILE_OUTPUT, 8, TGSI_FILE_INPUT, 0, TGSI_FILE_CONSTANT, 0); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* end */ - inst = vl_end(); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - vs.tokens = tokens; - mc->b_vs[1] = pipe->create_vs_state(pipe, &vs); - free(tokens); - - return 0; -} - -static int vlCreateFragmentShaderFrameBMB -( - struct vlR16SnormBufferedMC *mc -) -{ - const unsigned int max_tokens = 100; - - struct pipe_context *pipe; - struct pipe_shader_state fs; - struct tgsi_token *tokens; - struct tgsi_header *header; - - struct tgsi_full_declaration decl; - struct tgsi_full_instruction inst; - - unsigned int ti; - unsigned int i; - - assert(mc); - - pipe = mc->pipe; - tokens = (struct tgsi_token*)malloc(max_tokens * sizeof(struct tgsi_token)); - - /* Version */ - *(struct tgsi_version*)&tokens[0] = tgsi_build_version(); - /* Header */ - header = (struct tgsi_header*)&tokens[1]; - *header = tgsi_build_header(); - /* Processor */ - *(struct tgsi_processor*)&tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_FRAGMENT, header); - - ti = 3; - - /* - * decl i0 ; Luma texcoords - * decl i1 ; Chroma Cb texcoords - * decl i2 ; Chroma Cr texcoords - * decl i3 ; First ref macroblock texcoords - * decl i4 ; Second ref macroblock texcoords - */ - for (i = 0; i < 5; ++i) - { - decl = vl_decl_interpolated_input(TGSI_SEMANTIC_GENERIC, i + 1, i, i, TGSI_INTERPOLATE_LINEAR); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - } - - /* - * decl c0 ; Scaling factor, rescales 16-bit snorm to 9-bit snorm - * decl c1 ; Constant 1/2 in .x channel to use as weight to blend past and future texels - */ - decl = vl_decl_constants(TGSI_SEMANTIC_GENERIC, 0, 0, 1); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* decl o0 ; Fragment color */ - decl = vl_decl_output(TGSI_SEMANTIC_COLOR, 0, 0, 0); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* decl t0-t2 */ - decl = vl_decl_temps(0, 2); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* - * decl s0 ; Sampler for luma texture - * decl s1 ; Sampler for chroma Cb texture - * decl s2 ; Sampler for chroma Cr texture - * decl s3 ; Sampler for first ref surface texture - * decl s4 ; Sampler for second ref surface texture - */ - for (i = 0; i < 5; ++i) - { - decl = vl_decl_samplers(i, i); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - } - - /* - * tex2d t1, i0, s0 ; Read texel from luma texture - * mov t0.x, t1.x ; Move luma sample into .x component - * tex2d t1, i1, s1 ; Read texel from chroma Cb texture - * mov t0.y, t1.x ; Move Cb sample into .y component - * tex2d t1, i2, s2 ; Read texel from chroma Cr texture - * mov t0.z, t1.x ; Move Cr sample into .z component - */ - for (i = 0; i < 3; ++i) - { - inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_INPUT, i, TGSI_FILE_SAMPLER, i); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1); - inst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; - inst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - } - - /* mul t0, t0, c0 ; Rescale texel to correct range */ - inst = vl_inst3(TGSI_OPCODE_MUL, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_CONSTANT, 0); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* - * tex2d t1, i3, s3 ; Read texel from first ref macroblock - * tex2d t2, i4, s4 ; Read texel from second ref macroblock - */ - for (i = 0; i < 2; ++i) - { - inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, i + 1, TGSI_FILE_INPUT, i + 3, TGSI_FILE_SAMPLER, i + 3); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - } - - /* lerp t1, c1.x, t1, t2 ; Blend past and future texels */ - inst = vl_inst4(TGSI_OPCODE_LRP, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_CONSTANT, 1, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_TEMPORARY, 2); - inst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_X; - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* add o0, t0, t1 ; Add past/future ref and differential to form final output */ - inst = vl_inst3(TGSI_OPCODE_ADD, TGSI_FILE_OUTPUT, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* end */ - inst = vl_end(); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - fs.tokens = tokens; - mc->b_fs[0] = pipe->create_fs_state(pipe, &fs); - free(tokens); - - return 0; -} - -static int vlCreateFragmentShaderFieldBMB -( - struct vlR16SnormBufferedMC *mc -) -{ - const unsigned int max_tokens = 200; - - struct pipe_context *pipe; - struct pipe_shader_state fs; - struct tgsi_token *tokens; - struct tgsi_header *header; - - struct tgsi_full_declaration decl; - struct tgsi_full_instruction inst; - - unsigned int ti; - unsigned int i; - - assert(mc); - - pipe = mc->pipe; - tokens = (struct tgsi_token*)malloc(max_tokens * sizeof(struct tgsi_token)); - - /* Version */ - *(struct tgsi_version*)&tokens[0] = tgsi_build_version(); - /* Header */ - header = (struct tgsi_header*)&tokens[1]; - *header = tgsi_build_header(); - /* Processor */ - *(struct tgsi_processor*)&tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_FRAGMENT, header); - - ti = 3; - - /* - * decl i0 ; Luma texcoords - * decl i1 ; Chroma Cb texcoords - * decl i2 ; Chroma Cr texcoords - * decl i3 ; First ref macroblock top field texcoords - * decl i4 ; First ref macroblock bottom field texcoords - * decl i5 ; Second ref macroblock top field texcoords - * decl i6 ; Second ref macroblock bottom field texcoords - * decl i7 ; Denormalized vertex pos - */ - for (i = 0; i < 8; ++i) - { - decl = vl_decl_interpolated_input(TGSI_SEMANTIC_GENERIC, i + 1, i, i, TGSI_INTERPOLATE_LINEAR); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - } - - /* - * decl c0 ; Scaling factor, rescales 16-bit snorm to 9-bit snorm - * decl c1 ; Constants 1/2 & 2 in .x, .y channels to use as weight to blend past and future texels - * ; and for Y-mod-2 top/bottom field selection - */ - decl = vl_decl_constants(TGSI_SEMANTIC_GENERIC, 0, 0, 1); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* decl o0 ; Fragment color */ - decl = vl_decl_output(TGSI_SEMANTIC_COLOR, 0, 0, 0); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* decl t0-t5 */ - decl = vl_decl_temps(0, 5); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - - /* - * decl s0 ; Sampler for luma texture - * decl s1 ; Sampler for chroma Cb texture - * decl s2 ; Sampler for chroma Cr texture - * decl s3 ; Sampler for first ref surface texture - * decl s4 ; Sampler for second ref surface texture - */ - for (i = 0; i < 5; ++i) - { - decl = vl_decl_samplers(i, i); - ti += tgsi_build_full_declaration(&decl, &tokens[ti], header, max_tokens - ti); - } - - /* - * tex2d t1, i0, s0 ; Read texel from luma texture - * mov t0.x, t1.x ; Move luma sample into .x component - * tex2d t1, i1, s1 ; Read texel from chroma Cb texture - * mov t0.y, t1.x ; Move Cb sample into .y component - * tex2d t1, i2, s2 ; Read texel from chroma Cr texture - * mov t0.z, t1.x ; Move Cr sample into .z component - */ - for (i = 0; i < 3; ++i) - { - inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_INPUT, i, TGSI_FILE_SAMPLER, i); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1); - inst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; - inst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - } - - /* mul t0, t0, c0 ; Rescale texel to correct range */ - inst = vl_inst3(TGSI_OPCODE_MUL, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_CONSTANT, 0); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* XXX: Pos values off by 0.5? */ - /* sub t4, i7.y, c1.x ; Sub 0.5 from denormalized pos */ - inst = vl_inst3(TGSI_OPCODE_SUB, TGSI_FILE_TEMPORARY, 4, TGSI_FILE_INPUT, 7, TGSI_FILE_CONSTANT, 1); - inst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_Y; - inst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_Y; - inst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_Y; - inst.FullSrcRegisters[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_Y; - inst.FullSrcRegisters[1].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[1].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[1].SrcRegister.SwizzleW = TGSI_SWIZZLE_X; - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* mul t3, t4, c1.x ; Multiply pos Y-coord by 1/2 */ - inst = vl_inst3(TGSI_OPCODE_MUL, TGSI_FILE_TEMPORARY, 3, TGSI_FILE_TEMPORARY, 4, TGSI_FILE_CONSTANT, 1); - inst.FullSrcRegisters[1].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[1].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[1].SrcRegister.SwizzleW = TGSI_SWIZZLE_X; - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* floor t3, t3 ; Get rid of fractional part */ - inst = vl_inst2(TGSI_OPCODE_FLR, TGSI_FILE_TEMPORARY, 3, TGSI_FILE_TEMPORARY, 3); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* mul t3, t3, c1.y ; Multiply by 2 */ - inst = vl_inst3( TGSI_OPCODE_MUL, TGSI_FILE_TEMPORARY, 3, TGSI_FILE_TEMPORARY, 3, TGSI_FILE_CONSTANT, 1); - inst.FullSrcRegisters[1].SrcRegister.SwizzleX = TGSI_SWIZZLE_Y; - inst.FullSrcRegisters[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_Y; - inst.FullSrcRegisters[1].SrcRegister.SwizzleZ = TGSI_SWIZZLE_Y; - inst.FullSrcRegisters[1].SrcRegister.SwizzleW = TGSI_SWIZZLE_Y; - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* sub t3, t4, t3 ; Subtract from original Y to get Y % 2 */ - inst = vl_inst3(TGSI_OPCODE_SUB, TGSI_FILE_TEMPORARY, 3, TGSI_FILE_TEMPORARY, 4, TGSI_FILE_TEMPORARY, 3); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* - * tex2d t1, i3, s3 ; Read texel from past ref macroblock top field - * tex2d t2, i4, s3 ; Read texel from past ref macroblock bottom field - */ - for (i = 0; i < 2; ++i) - { - inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, i + 1, TGSI_FILE_INPUT, i + 3, TGSI_FILE_SAMPLER, 3); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - } - - /* TODO: Move to conditional tex fetch on t3 instead of lerp */ - /* lerp t1, t3, t1, t2 ; Choose between top and bottom fields based on Y % 2 */ - inst = vl_inst4(TGSI_OPCODE_LRP, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_TEMPORARY, 3, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_TEMPORARY, 2); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* - * tex2d t4, i5, s4 ; Read texel from future ref macroblock top field - * tex2d t5, i6, s4 ; Read texel from future ref macroblock bottom field - */ - for (i = 0; i < 2; ++i) - { - inst = vl_tex(TGSI_TEXTURE_2D, TGSI_FILE_TEMPORARY, i + 4, TGSI_FILE_INPUT, i + 5, TGSI_FILE_SAMPLER, 4); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - } - - /* TODO: Move to conditional tex fetch on t3 instead of lerp */ - /* lerp t2, t3, t4, t5 ; Choose between top and bottom fields based on Y % 2 */ - inst = vl_inst4(TGSI_OPCODE_LRP, TGSI_FILE_TEMPORARY, 2, TGSI_FILE_TEMPORARY, 3, TGSI_FILE_TEMPORARY, 4, TGSI_FILE_TEMPORARY, 5); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* lerp t1, c1.x, t1, t2 ; Blend past and future texels */ - inst = vl_inst4(TGSI_OPCODE_LRP, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_CONSTANT, 1, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_TEMPORARY, 2); - inst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_X; - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* add o0, t0, t1 ; Add past/future ref and differential to form final output */ - inst = vl_inst3(TGSI_OPCODE_ADD, TGSI_FILE_OUTPUT, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - /* end */ - inst = vl_end(); - ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); - - fs.tokens = tokens; - mc->b_fs[1] = pipe->create_fs_state(pipe, &fs); - free(tokens); - - return 0; -} diff --git a/src/gallium/state_trackers/g3dvl/vl_render.h b/src/gallium/state_trackers/g3dvl/vl_render.h deleted file mode 100644 index 166030b498..0000000000 --- a/src/gallium/state_trackers/g3dvl/vl_render.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef vl_render_h -#define vl_render_h - -#include "vl_types.h" - -struct pipe_surface; - -struct vlRender -{ - int (*vlBegin) - ( - struct vlRender *render - ); - - int (*vlRenderMacroBlocksMpeg2) - ( - struct vlRender *render, - struct vlMpeg2MacroBlockBatch *batch, - struct vlSurface *surface - ); - - int (*vlEnd) - ( - struct vlRender *render - ); - - int (*vlFlush) - ( - struct vlRender *render - ); - - int (*vlDestroy) - ( - struct vlRender *render - ); -}; - -#endif diff --git a/src/gallium/state_trackers/g3dvl/vl_screen.c b/src/gallium/state_trackers/g3dvl/vl_screen.c deleted file mode 100644 index ade8643a66..0000000000 --- a/src/gallium/state_trackers/g3dvl/vl_screen.c +++ /dev/null @@ -1,115 +0,0 @@ -#define VL_INTERNAL -#include "vl_screen.h" -#include -#include - -int vlCreateScreen -( - struct vlDisplay *display, - int screen, - struct pipe_screen *pscreen, - struct vlScreen **vl_screen -) -{ - struct vlScreen *scrn; - - assert(display); - assert(pscreen); - assert(vl_screen); - - scrn = CALLOC_STRUCT(vlScreen); - - if (!scrn) - return 1; - - scrn->display = display; - scrn->ordinal = screen; - scrn->pscreen = pscreen; - *vl_screen = scrn; - - return 0; -} - -int vlDestroyScreen -( - struct vlScreen *screen -) -{ - assert(screen); - - FREE(screen); - - return 0; -} - -struct vlDisplay* vlGetDisplay -( - struct vlScreen *screen -) -{ - assert(screen); - - return screen->display; -} - -struct pipe_screen* vlGetPipeScreen -( - struct vlScreen *screen -) -{ - assert(screen); - - return screen->pscreen; -} - -unsigned int vlGetMaxProfiles -( - struct vlScreen *screen -) -{ - assert(screen); - - return vlProfileCount; -} - -int vlQueryProfiles -( - struct vlScreen *screen, - enum vlProfile *profiles -) -{ - assert(screen); - assert(profiles); - - profiles[0] = vlProfileMpeg2Simple; - profiles[1] = vlProfileMpeg2Main; - - return 0; -} - -unsigned int vlGetMaxEntryPoints -( - struct vlScreen *screen -) -{ - assert(screen); - - return vlEntryPointCount; -} - -int vlQueryEntryPoints -( - struct vlScreen *screen, - enum vlProfile profile, - enum vlEntryPoint *entry_points -) -{ - assert(screen); - assert(entry_points); - - entry_points[0] = vlEntryPointIDCT; - entry_points[1] = vlEntryPointMC; - entry_points[2] = vlEntryPointCSC; - - return 0; -} diff --git a/src/gallium/state_trackers/g3dvl/vl_screen.h b/src/gallium/state_trackers/g3dvl/vl_screen.h deleted file mode 100644 index 98f3d429b6..0000000000 --- a/src/gallium/state_trackers/g3dvl/vl_screen.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef vl_screen_h -#define vl_screen_h - -#include "vl_types.h" - -struct pipe_screen; - -#ifdef VL_INTERNAL -struct vlScreen -{ - struct vlDisplay *display; - unsigned int ordinal; - struct pipe_screen *pscreen; -}; -#endif - -int vlCreateScreen -( - struct vlDisplay *display, - int screen, - struct pipe_screen *pscreen, - struct vlScreen **vl_screen -); - -int vlDestroyScreen -( - struct vlScreen *screen -); - -struct vlDisplay* vlGetDisplay -( - struct vlScreen *screen -); - -struct pipe_screen* vlGetPipeScreen -( - struct vlScreen *screen -); - -unsigned int vlGetMaxProfiles -( - struct vlScreen *screen -); - -int vlQueryProfiles -( - struct vlScreen *screen, - enum vlProfile *profiles -); - -unsigned int vlGetMaxEntryPoints -( - struct vlScreen *screen -); - -int vlQueryEntryPoints -( - struct vlScreen *screen, - enum vlProfile profile, - enum vlEntryPoint *entry_points -); - -#endif diff --git a/src/gallium/state_trackers/g3dvl/vl_shader_build.c b/src/gallium/state_trackers/g3dvl/vl_shader_build.c deleted file mode 100644 index 51f1721a33..0000000000 --- a/src/gallium/state_trackers/g3dvl/vl_shader_build.c +++ /dev/null @@ -1,215 +0,0 @@ -#include "vl_shader_build.h" -#include -#include -#include - -struct tgsi_full_declaration vl_decl_input(unsigned int name, unsigned int index, unsigned int first, unsigned int last) -{ - struct tgsi_full_declaration decl = tgsi_default_full_declaration(); - - decl.Declaration.File = TGSI_FILE_INPUT; - decl.Declaration.Semantic = 1; - decl.Semantic.SemanticName = name; - decl.Semantic.SemanticIndex = index; - decl.DeclarationRange.First = first; - decl.DeclarationRange.Last = last; - - return decl; -} - -struct tgsi_full_declaration vl_decl_interpolated_input -( - unsigned int name, - unsigned int index, - unsigned int first, - unsigned int last, - int interpolation -) -{ - struct tgsi_full_declaration decl = tgsi_default_full_declaration(); - - assert - ( - interpolation == TGSI_INTERPOLATE_CONSTANT || - interpolation == TGSI_INTERPOLATE_LINEAR || - interpolation == TGSI_INTERPOLATE_PERSPECTIVE - ); - - decl.Declaration.File = TGSI_FILE_INPUT; - decl.Declaration.Semantic = 1; - decl.Semantic.SemanticName = name; - decl.Semantic.SemanticIndex = index; - decl.Declaration.Interpolate = interpolation;; - decl.DeclarationRange.First = first; - decl.DeclarationRange.Last = last; - - return decl; -} - -struct tgsi_full_declaration vl_decl_constants(unsigned int name, unsigned int index, unsigned int first, unsigned int last) -{ - struct tgsi_full_declaration decl = tgsi_default_full_declaration(); - - decl.Declaration.File = TGSI_FILE_CONSTANT; - decl.Declaration.Semantic = 1; - decl.Semantic.SemanticName = name; - decl.Semantic.SemanticIndex = index; - decl.DeclarationRange.First = first; - decl.DeclarationRange.Last = last; - - return decl; -} - -struct tgsi_full_declaration vl_decl_output(unsigned int name, unsigned int index, unsigned int first, unsigned int last) -{ - struct tgsi_full_declaration decl = tgsi_default_full_declaration(); - - decl.Declaration.File = TGSI_FILE_OUTPUT; - decl.Declaration.Semantic = 1; - decl.Semantic.SemanticName = name; - decl.Semantic.SemanticIndex = index; - decl.DeclarationRange.First = first; - decl.DeclarationRange.Last = last; - - return decl; -} - -struct tgsi_full_declaration vl_decl_temps(unsigned int first, unsigned int last) -{ - struct tgsi_full_declaration decl = tgsi_default_full_declaration(); - - decl = tgsi_default_full_declaration(); - decl.Declaration.File = TGSI_FILE_TEMPORARY; - decl.DeclarationRange.First = first; - decl.DeclarationRange.Last = last; - - return decl; -} - -struct tgsi_full_declaration vl_decl_samplers(unsigned int first, unsigned int last) -{ - struct tgsi_full_declaration decl = tgsi_default_full_declaration(); - - decl = tgsi_default_full_declaration(); - decl.Declaration.File = TGSI_FILE_SAMPLER; - decl.DeclarationRange.First = first; - decl.DeclarationRange.Last = last; - - return decl; -} - -struct tgsi_full_instruction vl_inst2 -( - int opcode, - enum tgsi_file_type dst_file, - unsigned int dst_index, - enum tgsi_file_type src_file, - unsigned int src_index -) -{ - struct tgsi_full_instruction inst = tgsi_default_full_instruction(); - - inst.Instruction.Opcode = opcode; - inst.Instruction.NumDstRegs = 1; - inst.FullDstRegisters[0].DstRegister.File = dst_file; - inst.FullDstRegisters[0].DstRegister.Index = dst_index; - inst.Instruction.NumSrcRegs = 1; - inst.FullSrcRegisters[0].SrcRegister.File = src_file; - inst.FullSrcRegisters[0].SrcRegister.Index = src_index; - - return inst; -} - -struct tgsi_full_instruction vl_inst3 -( - int opcode, - enum tgsi_file_type dst_file, - unsigned int dst_index, - enum tgsi_file_type src1_file, - unsigned int src1_index, - enum tgsi_file_type src2_file, - unsigned int src2_index -) -{ - struct tgsi_full_instruction inst = tgsi_default_full_instruction(); - - inst.Instruction.Opcode = opcode; - inst.Instruction.NumDstRegs = 1; - inst.FullDstRegisters[0].DstRegister.File = dst_file; - inst.FullDstRegisters[0].DstRegister.Index = dst_index; - inst.Instruction.NumSrcRegs = 2; - inst.FullSrcRegisters[0].SrcRegister.File = src1_file; - inst.FullSrcRegisters[0].SrcRegister.Index = src1_index; - inst.FullSrcRegisters[1].SrcRegister.File = src2_file; - inst.FullSrcRegisters[1].SrcRegister.Index = src2_index; - - return inst; -} - -struct tgsi_full_instruction vl_tex -( - int tex, - enum tgsi_file_type dst_file, - unsigned int dst_index, - enum tgsi_file_type src1_file, - unsigned int src1_index, - enum tgsi_file_type src2_file, - unsigned int src2_index -) -{ - struct tgsi_full_instruction inst = tgsi_default_full_instruction(); - - inst.Instruction.Opcode = TGSI_OPCODE_TEX; - inst.Instruction.NumDstRegs = 1; - inst.FullDstRegisters[0].DstRegister.File = dst_file; - inst.FullDstRegisters[0].DstRegister.Index = dst_index; - inst.Instruction.NumSrcRegs = 2; - inst.InstructionExtTexture.Texture = tex; - inst.FullSrcRegisters[0].SrcRegister.File = src1_file; - inst.FullSrcRegisters[0].SrcRegister.Index = src1_index; - inst.FullSrcRegisters[1].SrcRegister.File = src2_file; - inst.FullSrcRegisters[1].SrcRegister.Index = src2_index; - - return inst; -} - -struct tgsi_full_instruction vl_inst4 -( - int opcode, - enum tgsi_file_type dst_file, - unsigned int dst_index, - enum tgsi_file_type src1_file, - unsigned int src1_index, - enum tgsi_file_type src2_file, - unsigned int src2_index, - enum tgsi_file_type src3_file, - unsigned int src3_index -) -{ - struct tgsi_full_instruction inst = tgsi_default_full_instruction(); - - inst.Instruction.Opcode = opcode; - inst.Instruction.NumDstRegs = 1; - inst.FullDstRegisters[0].DstRegister.File = dst_file; - inst.FullDstRegisters[0].DstRegister.Index = dst_index; - inst.Instruction.NumSrcRegs = 3; - inst.FullSrcRegisters[0].SrcRegister.File = src1_file; - inst.FullSrcRegisters[0].SrcRegister.Index = src1_index; - inst.FullSrcRegisters[1].SrcRegister.File = src2_file; - inst.FullSrcRegisters[1].SrcRegister.Index = src2_index; - inst.FullSrcRegisters[2].SrcRegister.File = src3_file; - inst.FullSrcRegisters[2].SrcRegister.Index = src3_index; - - return inst; -} - -struct tgsi_full_instruction vl_end(void) -{ - struct tgsi_full_instruction inst = tgsi_default_full_instruction(); - - inst.Instruction.Opcode = TGSI_OPCODE_END; - inst.Instruction.NumDstRegs = 0; - inst.Instruction.NumSrcRegs = 0; - - return inst; -} diff --git a/src/gallium/state_trackers/g3dvl/vl_shader_build.h b/src/gallium/state_trackers/g3dvl/vl_shader_build.h deleted file mode 100644 index dc615cb156..0000000000 --- a/src/gallium/state_trackers/g3dvl/vl_shader_build.h +++ /dev/null @@ -1,61 +0,0 @@ -#ifndef vl_shader_build_h -#define vl_shader_build_h - -#include - -struct tgsi_full_declaration vl_decl_input(unsigned int name, unsigned int index, unsigned int first, unsigned int last); -struct tgsi_full_declaration vl_decl_interpolated_input -( - unsigned int name, - unsigned int index, - unsigned int first, - unsigned int last, - int interpolation -); -struct tgsi_full_declaration vl_decl_constants(unsigned int name, unsigned int index, unsigned int first, unsigned int last); -struct tgsi_full_declaration vl_decl_output(unsigned int name, unsigned int index, unsigned int first, unsigned int last); -struct tgsi_full_declaration vl_decl_temps(unsigned int first, unsigned int last); -struct tgsi_full_declaration vl_decl_samplers(unsigned int first, unsigned int last); -struct tgsi_full_instruction vl_inst2 -( - int opcode, - enum tgsi_file_type dst_file, - unsigned int dst_index, - enum tgsi_file_type src_file, - unsigned int src_index -); -struct tgsi_full_instruction vl_inst3 -( - int opcode, - enum tgsi_file_type dst_file, - unsigned int dst_index, - enum tgsi_file_type src1_file, - unsigned int src1_index, - enum tgsi_file_type src2_file, - unsigned int src2_index -); -struct tgsi_full_instruction vl_tex -( - int tex, - enum tgsi_file_type dst_file, - unsigned int dst_index, - enum tgsi_file_type src1_file, - unsigned int src1_index, - enum tgsi_file_type src2_file, - unsigned int src2_index -); -struct tgsi_full_instruction vl_inst4 -( - int opcode, - enum tgsi_file_type dst_file, - unsigned int dst_index, - enum tgsi_file_type src1_file, - unsigned int src1_index, - enum tgsi_file_type src2_file, - unsigned int src2_index, - enum tgsi_file_type src3_file, - unsigned int src3_index -); -struct tgsi_full_instruction vl_end(void); - -#endif diff --git a/src/gallium/state_trackers/g3dvl/vl_surface.c b/src/gallium/state_trackers/g3dvl/vl_surface.c deleted file mode 100644 index 7f60852cae..0000000000 --- a/src/gallium/state_trackers/g3dvl/vl_surface.c +++ /dev/null @@ -1,242 +0,0 @@ -#define VL_INTERNAL -#include "vl_surface.h" -#include -#include -#include -#include -#include -#include -#include -#include "vl_screen.h" -#include "vl_context.h" -#include "vl_render.h" -#include "vl_csc.h" -#include "vl_util.h" - -int vlCreateSurface -( - struct vlScreen *screen, - unsigned int width, - unsigned int height, - enum vlFormat format, - struct vlSurface **surface -) -{ - struct vlSurface *sfc; - struct pipe_texture template; - - assert(screen); - assert(surface); - - sfc = CALLOC_STRUCT(vlSurface); - - if (!sfc) - return 1; - - sfc->screen = screen; - sfc->width = width; - sfc->height = height; - sfc->format = format; - - memset(&template, 0, sizeof(struct pipe_texture)); - template.target = PIPE_TEXTURE_2D; - template.format = PIPE_FORMAT_A8R8G8B8_UNORM; - template.last_level = 0; - template.width[0] = vlRoundUpPOT(sfc->width); - template.height[0] = vlRoundUpPOT(sfc->height); - template.depth[0] = 1; - pf_get_block(template.format, &template.block); - template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_RENDER_TARGET; - - sfc->texture = vlGetPipeScreen(screen)->texture_create(vlGetPipeScreen(screen), &template); - - if (!sfc->texture) - { - FREE(sfc); - return 1; - } - - *surface = sfc; - - return 0; -} - -int vlDestroySurface -( - struct vlSurface *surface -) -{ - assert(surface); - - pipe_texture_reference(&surface->texture, NULL); - FREE(surface); - - return 0; -} - -int vlRenderMacroBlocksMpeg2 -( - struct vlMpeg2MacroBlockBatch *batch, - struct vlSurface *surface -) -{ - assert(batch); - assert(surface); - assert(surface->context); - - surface->context->render->vlBegin(surface->context->render); - - surface->context->render->vlRenderMacroBlocksMpeg2 - ( - surface->context->render, - batch, - surface - ); - - surface->context->render->vlEnd(surface->context->render); - - return 0; -} - -int vlPutPicture -( - struct vlSurface *surface, - vlNativeDrawable drawable, - int srcx, - int srcy, - int srcw, - int srch, - int destx, - int desty, - int destw, - int desth, - int drawable_w, - int drawable_h, - enum vlPictureType picture_type -) -{ - struct vlCSC *csc; - struct pipe_context *pipe; - - assert(surface); - assert(surface->context); - - surface->context->render->vlFlush(surface->context->render); - - csc = surface->context->csc; - pipe = surface->context->pipe; - - csc->vlResizeFrameBuffer(csc, drawable_w, drawable_h); - - csc->vlBegin(csc); - - csc->vlPutPicture - ( - csc, - surface, - srcx, - srcy, - srcw, - srch, - destx, - desty, - destw, - desth, - picture_type - ); - - csc->vlEnd(csc); - - pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, &surface->disp_fence); - - bind_pipe_drawable(pipe, drawable); - - pipe->screen->flush_frontbuffer - ( - pipe->screen, - csc->vlGetFrameBuffer(csc), - pipe->priv - ); - - return 0; -} - -int vlSurfaceGetStatus -( - struct vlSurface *surface, - enum vlResourceStatus *status -) -{ - assert(surface); - assert(surface->context); - assert(status); - - if (surface->render_fence && !surface->context->pipe->screen->fence_signalled(surface->context->pipe->screen, surface->render_fence, 0)) - { - *status = vlResourceStatusRendering; - return 0; - } - - if (surface->disp_fence && !surface->context->pipe->screen->fence_signalled(surface->context->pipe->screen, surface->disp_fence, 0)) - { - *status = vlResourceStatusDisplaying; - return 0; - } - - *status = vlResourceStatusFree; - - return 0; -} - -int vlSurfaceFlush -( - struct vlSurface *surface -) -{ - assert(surface); - assert(surface->context); - - surface->context->render->vlFlush(surface->context->render); - - return 0; -} - -int vlSurfaceSync -( - struct vlSurface *surface -) -{ - assert(surface); - assert(surface->context); - assert(surface->render_fence); - - surface->context->pipe->screen->fence_finish(surface->context->pipe->screen, surface->render_fence, 0); - - return 0; -} - -struct vlScreen* vlSurfaceGetScreen -( - struct vlSurface *surface -) -{ - assert(surface); - - return surface->screen; -} - -struct vlContext* vlBindToContext -( - struct vlSurface *surface, - struct vlContext *context -) -{ - struct vlContext *old; - - assert(surface); - - old = surface->context; - surface->context = context; - - return old; -} diff --git a/src/gallium/state_trackers/g3dvl/vl_surface.h b/src/gallium/state_trackers/g3dvl/vl_surface.h deleted file mode 100644 index 133e1515ef..0000000000 --- a/src/gallium/state_trackers/g3dvl/vl_surface.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef vl_surface_h -#define vl_surface_h - -#include "vl_types.h" - -#ifdef VL_INTERNAL -struct pipe_texture; - -struct vlSurface -{ - struct vlScreen *screen; - struct vlContext *context; - unsigned int width; - unsigned int height; - enum vlFormat format; - struct pipe_texture *texture; - struct pipe_fence_handle *render_fence; - struct pipe_fence_handle *disp_fence; -}; -#endif - -int vlCreateSurface -( - struct vlScreen *screen, - unsigned int width, - unsigned int height, - enum vlFormat format, - struct vlSurface **surface -); - -int vlDestroySurface -( - struct vlSurface *surface -); - -int vlRenderMacroBlocksMpeg2 -( - struct vlMpeg2MacroBlockBatch *batch, - struct vlSurface *surface -); - -int vlPutPicture -( - struct vlSurface *surface, - vlNativeDrawable drawable, - int srcx, - int srcy, - int srcw, - int srch, - int destx, - int desty, - int destw, - int desth, - int drawable_w, - int drawable_h, - enum vlPictureType picture_type -); - -int vlSurfaceGetStatus -( - struct vlSurface *surface, - enum vlResourceStatus *status -); - -int vlSurfaceFlush -( - struct vlSurface *surface -); - -int vlSurfaceSync -( - struct vlSurface *surface -); - -struct vlScreen* vlSurfaceGetScreen -( - struct vlSurface *surface -); - -struct vlContext* vlBindToContext -( - struct vlSurface *surface, - struct vlContext *context -); - -#endif diff --git a/src/gallium/state_trackers/g3dvl/vl_types.h b/src/gallium/state_trackers/g3dvl/vl_types.h deleted file mode 100644 index 274e1f7437..0000000000 --- a/src/gallium/state_trackers/g3dvl/vl_types.h +++ /dev/null @@ -1,115 +0,0 @@ -#ifndef vl_types_h -#define vl_types_h - -#if 1 /*#ifdef X11*/ -#include - -typedef Display* vlNativeDisplay; -typedef Drawable vlNativeDrawable; -#endif - -struct vlDisplay; -struct vlScreen; -struct vlContext; -struct vlSurface; - -enum vlResourceStatus -{ - vlResourceStatusFree, - vlResourceStatusRendering, - vlResourceStatusDisplaying -}; - -enum vlProfile -{ - vlProfileMpeg2Simple, - vlProfileMpeg2Main, - - vlProfileCount -}; - -enum vlEntryPoint -{ - vlEntryPointIDCT, - vlEntryPointMC, - vlEntryPointCSC, - - vlEntryPointCount -}; - -enum vlFormat -{ - vlFormatYCbCr420, - vlFormatYCbCr422, - vlFormatYCbCr444 -}; - -enum vlPictureType -{ - vlPictureTypeTopField, - vlPictureTypeBottomField, - vlPictureTypeFrame -}; - -enum vlMotionType -{ - vlMotionTypeField, - vlMotionTypeFrame, - vlMotionTypeDualPrime, - vlMotionType16x8 -}; - -enum vlFieldOrder -{ - vlFieldOrderFirst, - vlFieldOrderSecond -}; - -enum vlDCTType -{ - vlDCTTypeFrameCoded, - vlDCTTypeFieldCoded -}; - -struct vlVertex2f -{ - float x, y; -}; - -struct vlVertex4f -{ - float x, y, z, w; -}; - -enum vlMacroBlockType -{ - vlMacroBlockTypeIntra, - vlMacroBlockTypeFwdPredicted, - vlMacroBlockTypeBkwdPredicted, - vlMacroBlockTypeBiPredicted, - - vlNumMacroBlockTypes -}; - -struct vlMpeg2MacroBlock -{ - unsigned int mbx, mby; - enum vlMacroBlockType mb_type; - enum vlMotionType mo_type; - enum vlDCTType dct_type; - int PMV[2][2][2]; - unsigned int cbp; - short *blocks; -}; - -struct vlMpeg2MacroBlockBatch -{ - struct vlSurface *past_surface; - struct vlSurface *future_surface; - enum vlPictureType picture_type; - enum vlFieldOrder field_order; - unsigned int num_macroblocks; - struct vlMpeg2MacroBlock *macroblocks; -}; - -#endif diff --git a/src/gallium/state_trackers/g3dvl/vl_util.c b/src/gallium/state_trackers/g3dvl/vl_util.c deleted file mode 100644 index 50aa9af66f..0000000000 --- a/src/gallium/state_trackers/g3dvl/vl_util.c +++ /dev/null @@ -1,16 +0,0 @@ -#include "vl_util.h" -#include - -unsigned int vlRoundUpPOT(unsigned int x) -{ - unsigned int i; - - assert(x > 0); - - --x; - - for (i = 1; i < sizeof(unsigned int) * 8; i <<= 1) - x |= x >> i; - - return x + 1; -} diff --git a/src/gallium/state_trackers/g3dvl/vl_util.h b/src/gallium/state_trackers/g3dvl/vl_util.h deleted file mode 100644 index bc98e79df4..0000000000 --- a/src/gallium/state_trackers/g3dvl/vl_util.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef vl_util_h -#define vl_util_h - -unsigned int vlRoundUpPOT(unsigned int x); - -#endif diff --git a/src/gallium/winsys/g3dvl/xsp_winsys.c b/src/gallium/winsys/g3dvl/xsp_winsys.c deleted file mode 100644 index 37d60ce540..0000000000 --- a/src/gallium/winsys/g3dvl/xsp_winsys.c +++ /dev/null @@ -1,291 +0,0 @@ -#include "vl_winsys.h" -#include -#include -#include -#include -#include -#include -#include -#include - -/* pipe_winsys implementation */ - -struct xsp_pipe_winsys -{ - struct pipe_winsys base; - XImage fbimage; -}; - -struct xsp_context -{ - Display *display; - int screen; - Drawable drawable; - int drawable_bound; -}; - -struct xsp_buffer -{ - struct pipe_buffer base; - boolean is_user_buffer; - void *data; - void *mapped_data; -}; - -static struct pipe_buffer* xsp_buffer_create(struct pipe_winsys *pws, unsigned alignment, unsigned usage, unsigned size) -{ - struct xsp_buffer *buffer; - - assert(pws); - - buffer = calloc(1, sizeof(struct xsp_buffer)); - pipe_reference_init(&buffer->base.reference, 1); - buffer->base.alignment = alignment; - buffer->base.usage = usage; - buffer->base.size = size; - buffer->data = align_malloc(size, alignment); - - return (struct pipe_buffer*)buffer; -} - -static struct pipe_buffer* xsp_user_buffer_create(struct pipe_winsys *pws, void *data, unsigned size) -{ - struct xsp_buffer *buffer; - - assert(pws); - - buffer = calloc(1, sizeof(struct xsp_buffer)); - pipe_reference_init(&buffer->base.reference, 1); - buffer->base.size = size; - buffer->is_user_buffer = TRUE; - buffer->data = data; - - return (struct pipe_buffer*)buffer; -} - -static void* xsp_buffer_map(struct pipe_winsys *pws, struct pipe_buffer *buffer, unsigned flags) -{ - struct xsp_buffer *xsp_buf = (struct xsp_buffer*)buffer; - - assert(pws); - assert(buffer); - - xsp_buf->mapped_data = xsp_buf->data; - - return xsp_buf->mapped_data; -} - -static void xsp_buffer_unmap(struct pipe_winsys *pws, struct pipe_buffer *buffer) -{ - struct xsp_buffer *xsp_buf = (struct xsp_buffer*)buffer; - - assert(pws); - assert(buffer); - - xsp_buf->mapped_data = NULL; -} - -static void xsp_buffer_destroy(struct pipe_winsys *pws, struct pipe_buffer *buffer) -{ - struct xsp_buffer *xsp_buf = (struct xsp_buffer*)buffer; - - assert(pws); - assert(buffer); - - if (!xsp_buf->is_user_buffer) - align_free(xsp_buf->data); - - free(xsp_buf); -} - -static struct pipe_buffer* xsp_surface_buffer_create -( - struct pipe_winsys *pws, - unsigned width, - unsigned height, - enum pipe_format format, - unsigned usage, - unsigned tex_usage, - unsigned *stride -) -{ - const unsigned int ALIGNMENT = 1; - struct pipe_format_block block; - unsigned nblocksx, nblocksy; - - pf_get_block(format, &block); - nblocksx = pf_get_nblocksx(&block, width); - nblocksy = pf_get_nblocksy(&block, height); - *stride = align(nblocksx * block.size, ALIGNMENT); - - return pws->buffer_create(pws, ALIGNMENT, - usage, - *stride * nblocksy); -} - -static void xsp_fence_reference(struct pipe_winsys *pws, struct pipe_fence_handle **ptr, struct pipe_fence_handle *fence) -{ - assert(pws); - assert(ptr); - assert(fence); -} - -static int xsp_fence_signalled(struct pipe_winsys *pws, struct pipe_fence_handle *fence, unsigned flag) -{ - assert(pws); - assert(fence); - - return 0; -} - -static int xsp_fence_finish(struct pipe_winsys *pws, struct pipe_fence_handle *fence, unsigned flag) -{ - assert(pws); - assert(fence); - - return 0; -} - -static void xsp_flush_frontbuffer(struct pipe_winsys *pws, struct pipe_surface *surface, void *context_private) -{ - struct xsp_pipe_winsys *xsp_winsys; - struct xsp_context *xsp_context; - - assert(pws); - assert(surface); - assert(context_private); - - xsp_winsys = (struct xsp_pipe_winsys*)pws; - xsp_context = (struct xsp_context*)context_private; - - if (!xsp_context->drawable_bound) - return; - - xsp_winsys->fbimage.width = surface->width; - xsp_winsys->fbimage.height = surface->height; - xsp_winsys->fbimage.bytes_per_line = surface->width * (xsp_winsys->fbimage.bits_per_pixel >> 3); - xsp_winsys->fbimage.data = ((struct xsp_buffer *)softpipe_texture(surface->texture)->buffer)->data + surface->offset; - - XPutImage - ( - xsp_context->display, - xsp_context->drawable, - XDefaultGC(xsp_context->display, xsp_context->screen), - &xsp_winsys->fbimage, - 0, - 0, - 0, - 0, - surface->width, - surface->height - ); - XFlush(xsp_context->display); -} - -static const char* xsp_get_name(struct pipe_winsys *pws) -{ - assert(pws); - return "X11 SoftPipe"; -} - -/* Show starts here */ - -int bind_pipe_drawable(struct pipe_context *pipe, Drawable drawable) -{ - struct xsp_context *xsp_context; - - assert(pipe); - - xsp_context = pipe->priv; - xsp_context->drawable = drawable; - xsp_context->drawable_bound = 1; - - return 0; -} - -int unbind_pipe_drawable(struct pipe_context *pipe) -{ - struct xsp_context *xsp_context; - - assert(pipe); - - xsp_context = pipe->priv; - xsp_context->drawable_bound = 0; - - return 0; -} - -struct pipe_context* create_pipe_context(Display *display, int screen) -{ - struct xsp_pipe_winsys *xsp_winsys; - struct xsp_context *xsp_context; - struct pipe_screen *sp_screen; - struct pipe_context *sp_pipe; - - assert(display); - - xsp_winsys = calloc(1, sizeof(struct xsp_pipe_winsys)); - xsp_winsys->base.buffer_create = xsp_buffer_create; - xsp_winsys->base.user_buffer_create = xsp_user_buffer_create; - xsp_winsys->base.buffer_map = xsp_buffer_map; - xsp_winsys->base.buffer_unmap = xsp_buffer_unmap; - xsp_winsys->base.buffer_destroy = xsp_buffer_destroy; - xsp_winsys->base.surface_buffer_create = xsp_surface_buffer_create; - xsp_winsys->base.fence_reference = xsp_fence_reference; - xsp_winsys->base.fence_signalled = xsp_fence_signalled; - xsp_winsys->base.fence_finish = xsp_fence_finish; - xsp_winsys->base.flush_frontbuffer = xsp_flush_frontbuffer; - xsp_winsys->base.get_name = xsp_get_name; - - { - /* XXX: Can't use the returned XImage* directly, - since we don't have control over winsys destruction - and we wouldn't be able to free it */ - XImage *template = XCreateImage - ( - display, - XDefaultVisual(display, XDefaultScreen(display)), - XDefaultDepth(display, XDefaultScreen(display)), - ZPixmap, - 0, - NULL, - 0, /* Don't know the width and height until flush_frontbuffer */ - 0, - 32, - 0 - ); - - memcpy(&xsp_winsys->fbimage, template, sizeof(XImage)); - XInitImage(&xsp_winsys->fbimage); - - XDestroyImage(template); - } - - sp_screen = softpipe_create_screen((struct pipe_winsys*)xsp_winsys); - sp_pipe = softpipe_create(sp_screen); - - xsp_context = calloc(1, sizeof(struct xsp_context)); - xsp_context->display = display; - xsp_context->screen = screen; - - sp_pipe->priv = xsp_context; - - return sp_pipe; -} - -int destroy_pipe_context(struct pipe_context *pipe) -{ - struct pipe_screen *screen; - struct pipe_winsys *winsys; - - assert(pipe); - - screen = pipe->screen; - winsys = pipe->winsys; - free(pipe->priv); - pipe->destroy(pipe); - screen->destroy(screen); - free(winsys); - - return 0; -} -- cgit v1.2.3 From f9f7646fe64364f74cc8dd1a6d5ca3a6700f142f Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Thu, 1 Oct 2009 22:25:46 -0400 Subject: g3dvl: Formatting. --- src/gallium/winsys/g3dvl/xlib/xsp_winsys.c | 347 ++++++++++++++--------------- 1 file changed, 172 insertions(+), 175 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c b/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c index 0faad544d1..0e5f5a587b 100644 --- a/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c +++ b/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c @@ -40,198 +40,197 @@ struct xsp_pipe_winsys { - struct pipe_winsys base; - Display *display; - int screen; - XImage *fbimage; + struct pipe_winsys base; + Display *display; + int screen; + XImage *fbimage; }; struct xsp_context { - Drawable drawable; + Drawable drawable; - void (*pipe_destroy)(struct pipe_video_context *vpipe); + void (*pipe_destroy)(struct pipe_video_context *vpipe); }; struct xsp_buffer { - struct pipe_buffer base; - boolean is_user_buffer; - void *data; - void *mapped_data; + struct pipe_buffer base; + boolean is_user_buffer; + void *data; + void *mapped_data; }; static struct pipe_buffer* xsp_buffer_create(struct pipe_winsys *pws, unsigned alignment, unsigned usage, unsigned size) { - struct xsp_buffer *buffer; + struct xsp_buffer *buffer; - assert(pws); + assert(pws); - buffer = calloc(1, sizeof(struct xsp_buffer)); - pipe_reference_init(&buffer->base.reference, 1); - buffer->base.alignment = alignment; - buffer->base.usage = usage; - buffer->base.size = size; - buffer->data = align_malloc(size, alignment); + buffer = calloc(1, sizeof(struct xsp_buffer)); + pipe_reference_init(&buffer->base.reference, 1); + buffer->base.alignment = alignment; + buffer->base.usage = usage; + buffer->base.size = size; + buffer->data = align_malloc(size, alignment); - return (struct pipe_buffer*)buffer; + return (struct pipe_buffer*)buffer; } static struct pipe_buffer* xsp_user_buffer_create(struct pipe_winsys *pws, void *data, unsigned size) { - struct xsp_buffer *buffer; + struct xsp_buffer *buffer; - assert(pws); + assert(pws); - buffer = calloc(1, sizeof(struct xsp_buffer)); - pipe_reference_init(&buffer->base.reference, 1); - buffer->base.size = size; - buffer->is_user_buffer = TRUE; - buffer->data = data; + buffer = calloc(1, sizeof(struct xsp_buffer)); + pipe_reference_init(&buffer->base.reference, 1); + buffer->base.size = size; + buffer->is_user_buffer = TRUE; + buffer->data = data; - return (struct pipe_buffer*)buffer; + return (struct pipe_buffer*)buffer; } static void* xsp_buffer_map(struct pipe_winsys *pws, struct pipe_buffer *buffer, unsigned flags) { - struct xsp_buffer *xsp_buf = (struct xsp_buffer*)buffer; + struct xsp_buffer *xsp_buf = (struct xsp_buffer*)buffer; - assert(pws); - assert(buffer); + assert(pws); + assert(buffer); - xsp_buf->mapped_data = xsp_buf->data; + xsp_buf->mapped_data = xsp_buf->data; - return xsp_buf->mapped_data; + return xsp_buf->mapped_data; } static void xsp_buffer_unmap(struct pipe_winsys *pws, struct pipe_buffer *buffer) { - struct xsp_buffer *xsp_buf = (struct xsp_buffer*)buffer; + struct xsp_buffer *xsp_buf = (struct xsp_buffer*)buffer; - assert(pws); - assert(buffer); + assert(pws); + assert(buffer); - xsp_buf->mapped_data = NULL; + xsp_buf->mapped_data = NULL; } static void xsp_buffer_destroy(struct pipe_buffer *buffer) { - struct xsp_buffer *xsp_buf = (struct xsp_buffer*)buffer; + struct xsp_buffer *xsp_buf = (struct xsp_buffer*)buffer; - assert(buffer); + assert(buffer); - if (!xsp_buf->is_user_buffer) - align_free(xsp_buf->data); + if (!xsp_buf->is_user_buffer) + align_free(xsp_buf->data); - free(xsp_buf); + free(xsp_buf); } static struct pipe_buffer* xsp_surface_buffer_create ( - struct pipe_winsys *pws, - unsigned width, - unsigned height, - enum pipe_format format, - unsigned usage, - unsigned tex_usage, - unsigned *stride + struct pipe_winsys *pws, + unsigned width, + unsigned height, + enum pipe_format format, + unsigned usage, + unsigned tex_usage, + unsigned *stride ) { - const unsigned int ALIGNMENT = 1; - struct pipe_format_block block; - unsigned nblocksx, nblocksy; - - pf_get_block(format, &block); - nblocksx = pf_get_nblocksx(&block, width); - nblocksy = pf_get_nblocksy(&block, height); - *stride = align(nblocksx * block.size, ALIGNMENT); - - return pws->buffer_create(pws, ALIGNMENT, - usage, - *stride * nblocksy); + const unsigned int ALIGNMENT = 1; + struct pipe_format_block block; + unsigned nblocksx, nblocksy; + + pf_get_block(format, &block); + nblocksx = pf_get_nblocksx(&block, width); + nblocksy = pf_get_nblocksy(&block, height); + *stride = align(nblocksx * block.size, ALIGNMENT); + + return pws->buffer_create(pws, ALIGNMENT, usage, + *stride * nblocksy); } static void xsp_fence_reference(struct pipe_winsys *pws, struct pipe_fence_handle **ptr, struct pipe_fence_handle *fence) { - assert(pws); - assert(ptr); - assert(fence); + assert(pws); + assert(ptr); + assert(fence); } static int xsp_fence_signalled(struct pipe_winsys *pws, struct pipe_fence_handle *fence, unsigned flag) { - assert(pws); - assert(fence); + assert(pws); + assert(fence); - return 0; + return 0; } static int xsp_fence_finish(struct pipe_winsys *pws, struct pipe_fence_handle *fence, unsigned flag) { - assert(pws); - assert(fence); + assert(pws); + assert(fence); - return 0; + return 0; } static void xsp_flush_frontbuffer(struct pipe_winsys *pws, struct pipe_surface *surface, void *context_private) { - struct xsp_pipe_winsys *xsp_winsys; - struct xsp_context *xsp_context; - - assert(pws); - assert(surface); - assert(context_private); - - xsp_winsys = (struct xsp_pipe_winsys*)pws; - xsp_context = (struct xsp_context*)context_private; - xsp_winsys->fbimage->width = surface->width; - xsp_winsys->fbimage->height = surface->height; - xsp_winsys->fbimage->bytes_per_line = surface->width * (xsp_winsys->fbimage->bits_per_pixel >> 3); - xsp_winsys->fbimage->data = (char*)((struct xsp_buffer *)softpipe_texture(surface->texture)->buffer)->data + surface->offset; - - XPutImage - ( - xsp_winsys->display, xsp_context->drawable, - XDefaultGC(xsp_winsys->display, xsp_winsys->screen), - xsp_winsys->fbimage, 0, 0, 0, 0, - surface->width, surface->height - ); - XFlush(xsp_winsys->display); + struct xsp_pipe_winsys *xsp_winsys; + struct xsp_context *xsp_context; + + assert(pws); + assert(surface); + assert(context_private); + + xsp_winsys = (struct xsp_pipe_winsys*)pws; + xsp_context = (struct xsp_context*)context_private; + xsp_winsys->fbimage->width = surface->width; + xsp_winsys->fbimage->height = surface->height; + xsp_winsys->fbimage->bytes_per_line = surface->width * (xsp_winsys->fbimage->bits_per_pixel >> 3); + xsp_winsys->fbimage->data = (char*)((struct xsp_buffer *)softpipe_texture(surface->texture)->buffer)->data + surface->offset; + + XPutImage + ( + xsp_winsys->display, xsp_context->drawable, + XDefaultGC(xsp_winsys->display, xsp_winsys->screen), + xsp_winsys->fbimage, 0, 0, 0, 0, + surface->width, surface->height + ); + XFlush(xsp_winsys->display); } static const char* xsp_get_name(struct pipe_winsys *pws) { - assert(pws); - return "X11 SoftPipe"; + assert(pws); + return "X11 SoftPipe"; } static void xsp_destroy(struct pipe_winsys *pws) { - struct xsp_pipe_winsys *xsp_winsys = (struct xsp_pipe_winsys*)pws; + struct xsp_pipe_winsys *xsp_winsys = (struct xsp_pipe_winsys*)pws; - assert(pws); + assert(pws); - /* XDestroyImage() wants to free the data as well */ - xsp_winsys->fbimage->data = NULL; + /* XDestroyImage() wants to free the data as well */ + xsp_winsys->fbimage->data = NULL; - XDestroyImage(xsp_winsys->fbimage); - FREE(xsp_winsys); + XDestroyImage(xsp_winsys->fbimage); + FREE(xsp_winsys); } /* Called through pipe_video_context::destroy() */ static void xsp_pipe_destroy(struct pipe_video_context *vpipe) { - struct xsp_context *xsp_context; + struct xsp_context *xsp_context; - assert(vpipe); + assert(vpipe); - xsp_context = vpipe->priv; + xsp_context = vpipe->priv; - /* Call the original destroy */ - xsp_context->pipe_destroy(vpipe); + /* Call the original destroy */ + xsp_context->pipe_destroy(vpipe); - FREE(xsp_context); + FREE(xsp_context); } /* Show starts here */ @@ -239,66 +238,65 @@ static void xsp_pipe_destroy(struct pipe_video_context *vpipe) Drawable vl_video_bind_drawable(struct pipe_video_context *vpipe, Drawable drawable) { - struct xsp_context *xsp_context; - Drawable old_drawable; + struct xsp_context *xsp_context; + Drawable old_drawable; - assert(vpipe); + assert(vpipe); - xsp_context = vpipe->priv; - old_drawable = xsp_context->drawable; - xsp_context->drawable = drawable; + xsp_context = vpipe->priv; + old_drawable = xsp_context->drawable; + xsp_context->drawable = drawable; - return old_drawable; + return old_drawable; } struct pipe_screen* vl_screen_create(Display *display, int screen) { - struct xsp_pipe_winsys *xsp_winsys; - - assert(display); - - xsp_winsys = CALLOC_STRUCT(xsp_pipe_winsys); - if (!xsp_winsys) - return NULL; - - xsp_winsys->base.buffer_create = xsp_buffer_create; - xsp_winsys->base.user_buffer_create = xsp_user_buffer_create; - xsp_winsys->base.buffer_map = xsp_buffer_map; - xsp_winsys->base.buffer_unmap = xsp_buffer_unmap; - xsp_winsys->base.buffer_destroy = xsp_buffer_destroy; - xsp_winsys->base.surface_buffer_create = xsp_surface_buffer_create; - xsp_winsys->base.fence_reference = xsp_fence_reference; - xsp_winsys->base.fence_signalled = xsp_fence_signalled; - xsp_winsys->base.fence_finish = xsp_fence_finish; - xsp_winsys->base.flush_frontbuffer = xsp_flush_frontbuffer; - xsp_winsys->base.get_name = xsp_get_name; - xsp_winsys->base.destroy = xsp_destroy; - xsp_winsys->display = display; - xsp_winsys->screen = screen; - xsp_winsys->fbimage = XCreateImage - ( - display, - XDefaultVisual(display, screen), - XDefaultDepth(display, screen), - ZPixmap, - 0, - NULL, - 0, /* Don't know the width and height until flush_frontbuffer */ - 0, - 32, - 0 - ); - - if (!xsp_winsys->fbimage) - { - FREE(xsp_winsys); - return NULL; - } - - XInitImage(xsp_winsys->fbimage); - - return softpipe_create_screen(&xsp_winsys->base); + struct xsp_pipe_winsys *xsp_winsys; + + assert(display); + + xsp_winsys = CALLOC_STRUCT(xsp_pipe_winsys); + if (!xsp_winsys) + return NULL; + + xsp_winsys->base.buffer_create = xsp_buffer_create; + xsp_winsys->base.user_buffer_create = xsp_user_buffer_create; + xsp_winsys->base.buffer_map = xsp_buffer_map; + xsp_winsys->base.buffer_unmap = xsp_buffer_unmap; + xsp_winsys->base.buffer_destroy = xsp_buffer_destroy; + xsp_winsys->base.surface_buffer_create = xsp_surface_buffer_create; + xsp_winsys->base.fence_reference = xsp_fence_reference; + xsp_winsys->base.fence_signalled = xsp_fence_signalled; + xsp_winsys->base.fence_finish = xsp_fence_finish; + xsp_winsys->base.flush_frontbuffer = xsp_flush_frontbuffer; + xsp_winsys->base.get_name = xsp_get_name; + xsp_winsys->base.destroy = xsp_destroy; + xsp_winsys->display = display; + xsp_winsys->screen = screen; + xsp_winsys->fbimage = XCreateImage + ( + display, + XDefaultVisual(display, screen), + XDefaultDepth(display, screen), + ZPixmap, + 0, + NULL, + 0, /* Don't know the width and height until flush_frontbuffer */ + 0, + 32, + 0 + ); + + if (!xsp_winsys->fbimage) { + FREE(xsp_winsys); + return NULL; + } + + XInitImage(xsp_winsys->fbimage); + + return softpipe_create_screen(&xsp_winsys->base); } struct pipe_video_context* @@ -307,28 +305,27 @@ vl_video_create(struct pipe_screen *screen, enum pipe_video_chroma_format chroma_format, unsigned width, unsigned height) { - struct pipe_video_context *vpipe; - struct xsp_context *xsp_context; + struct pipe_video_context *vpipe; + struct xsp_context *xsp_context; - assert(screen); - assert(width && height); + assert(screen); + assert(width && height); - vpipe = sp_video_create(screen, profile, chroma_format, width, height); - if (!vpipe) - return NULL; + vpipe = sp_video_create(screen, profile, chroma_format, width, height); + if (!vpipe) + return NULL; - xsp_context = CALLOC_STRUCT(xsp_context); - if (!xsp_context) - { - vpipe->destroy(vpipe); - return NULL; - } + xsp_context = CALLOC_STRUCT(xsp_context); + if (!xsp_context) { + vpipe->destroy(vpipe); + return NULL; + } - /* Override this so we can free our xsp_context when the pipe is freed */ - xsp_context->pipe_destroy = vpipe->destroy; - vpipe->destroy = xsp_pipe_destroy; + /* Override this so we can free our xsp_context when the pipe is freed */ + xsp_context->pipe_destroy = vpipe->destroy; + vpipe->destroy = xsp_pipe_destroy; - vpipe->priv = xsp_context; + vpipe->priv = xsp_context; - return vpipe; + return vpipe; } -- cgit v1.2.3 From 32aa40eee46fd0b15f3873069f2440ea2dd75408 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 1 Oct 2009 21:13:25 -0600 Subject: mesa: removed gl_texture_image::CompressedSize field Just call ctx->Driver.CompressedTextureSize() when we need to get the compressed image size. --- src/mesa/drivers/dri/intel/intel_tex_image.c | 13 +++++---- src/mesa/drivers/dri/radeon/radeon_texture.c | 13 ++++----- src/mesa/drivers/dri/tdfx/tdfx_tex.c | 29 +++++++++---------- src/mesa/drivers/dri/unichrome/via_tex.c | 5 ++-- src/mesa/main/dd.h | 2 +- src/mesa/main/mipmap.c | 23 ++++++++------- src/mesa/main/mtypes.h | 2 -- src/mesa/main/teximage.c | 3 -- src/mesa/main/texstore.c | 42 ++++------------------------ src/mesa/state_tracker/st_cb_texture.c | 10 +++---- 10 files changed, 53 insertions(+), 89 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 9e13ba6871..dd436becab 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -340,11 +340,8 @@ intelTexImage(GLcontext * ctx, if (_mesa_is_format_compressed(texImage->TexFormat)) { texelBytes = 0; - texImage->CompressedSize = - ctx->Driver.CompressedTextureSize(ctx, texImage->Width, - texImage->Height, texImage->Depth, - texImage->TexFormat); - } else { + } + else { texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* Minimum pitch of 32 bytes */ @@ -495,7 +492,11 @@ intelTexImage(GLcontext * ctx, else { /* Allocate regular memory and store the image there temporarily. */ if (_mesa_is_format_compressed(texImage->TexFormat)) { - sizeInBytes = texImage->CompressedSize; + sizeInBytes = ctx->Driver.CompressedTextureSize(ctx, + texImage->Width, + texImage->Height, + texImage->Depth, + texImage->TexFormat); dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width); assert(dims != 3); diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index ce393ffeb6..2c28011057 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -547,13 +547,7 @@ static void radeon_teximage( if (_mesa_is_format_compressed(texImage->TexFormat)) { texelBytes = 0; - texImage->CompressedSize = - ctx->Driver.CompressedTextureSize(ctx, texImage->Width, - texImage->Height, texImage->Depth, - texImage->TexFormat); } else { - texImage->CompressedSize = 0; - texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* Minimum pitch of 32 bytes */ if (postConvWidth * texelBytes < 32) { @@ -590,7 +584,12 @@ static void radeon_teximage( } else { int size; if (_mesa_is_format_compressed(texImage->TexFormat)) { - size = texImage->CompressedSize; + size = ctx->Driver.CompressedTextureSize(ctx, + texImage->Width, + texImage->Height, + texImage->Depth, + texImage->TexFormat); + } else { size = texImage->Width * texImage->Height * texImage->Depth * _mesa_get_format_bytes(texImage->TexFormat); } diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index 8b68137eed..5e9421aa2a 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -1409,13 +1409,13 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, texelBytes = _mesa_get_format_bytes(texImage->TexFormat); if (_mesa_is_format_compressed(texImage->TexFormat)) { - texImage->CompressedSize = _mesa_compressed_texture_size(ctx, - mml->width, - mml->height, - 1, - mesaFormat); + GLuint compressedSize = ctx->Driver.CompressedTextureSize(ctx, + mml->width, + mml->height, + 1, + mesaFormat); dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, mml->width); - texImage->Data = _mesa_alloc_texmemory(texImage->CompressedSize); + texImage->Data = _mesa_alloc_texmemory(compressedSize); } else { dstRowStride = mml->width * texelBytes; texImage->Data = _mesa_alloc_texmemory(mml->width * mml->height * texelBytes); @@ -1580,7 +1580,8 @@ tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target, tdfxContextPtr fxMesa = TDFX_CONTEXT(ctx); tdfxTexInfo *ti; tdfxMipMapLevel *mml; - GLuint mesaFormat; + gl_format mesaFormat; + GLuint compressedSize; if (TDFX_DEBUG & DEBUG_VERBOSE_DRI) { fprintf(stderr, "tdfxCompressedTexImage2D: id=%d int 0x%x %dx%d\n", @@ -1637,12 +1638,12 @@ tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target, /* allocate new storage for texture image, if needed */ if (!texImage->Data) { - texImage->CompressedSize = _mesa_compressed_texture_size(ctx, - mml->width, - mml->height, - 1, - mesaFormat); - texImage->Data = _mesa_alloc_texmemory(texImage->CompressedSize); + compressedSize = ctx->Driver.CompressedTextureSize(ctx, + mml->width, + mml->height, + 1, + mesaFormat); + texImage->Data = _mesa_alloc_texmemory(compressedSize); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D"); return; @@ -1677,7 +1678,7 @@ tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target, texImage->Data); ti->padded = GL_TRUE; } else { - MEMCPY(texImage->Data, data, texImage->CompressedSize); + MEMCPY(texImage->Data, data, compressedSize); } RevalidateTexture(ctx, texObj); diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index 13458aba1c..a99aa9debc 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -674,6 +674,7 @@ static void viaTexImage(GLcontext *ctx, struct via_texture_object *viaObj = (struct via_texture_object *)texObj; struct via_texture_image *viaImage = (struct via_texture_image *)texImage; int heaps[3], nheaps, i; + GLuint compressedSize; if (!is_empty_list(&vmesa->freed_tex_buffers)) { viaCheckBreadcrumb(vmesa, 0); @@ -697,7 +698,7 @@ static void viaTexImage(GLcontext *ctx, if (texelBytes == 0) { /* compressed format */ - texImage->CompressedSize = + compressedSize = ctx->Driver.CompressedTextureSize(ctx, texImage->Width, texImage->Height, texImage->Depth, texImage->TexFormat); @@ -714,7 +715,7 @@ static void viaTexImage(GLcontext *ctx, /* allocate memory */ if (_mesa_is_format_compressed(texImage->TexFormat)) - sizeInBytes = texImage->CompressedSize; + sizeInBytes = compressedSize; else sizeInBytes = postConvWidth * postConvHeight * texelBytes; diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 9131f20f52..64bf9cba19 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -481,7 +481,7 @@ struct dd_function_table { */ GLuint (*CompressedTextureSize)( GLcontext *ctx, GLsizei width, GLsizei height, GLsizei depth, - GLenum format ); + GLuint mesaFormat ); /*@}*/ /** diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index f6d6ce33c8..e24e7285c3 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1614,24 +1614,19 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, dstImage->TexFormat = srcImage->TexFormat; dstImage->FetchTexelc = srcImage->FetchTexelc; dstImage->FetchTexelf = srcImage->FetchTexelf; + + /* Alloc new teximage data buffer. + * Setup src and dest data pointers. + */ if (_mesa_is_format_compressed(dstImage->TexFormat)) { - dstImage->CompressedSize + GLuint dstCompressedSize = ctx->Driver.CompressedTextureSize(ctx, dstImage->Width, dstImage->Height, dstImage->Depth, dstImage->TexFormat); - ASSERT(dstImage->CompressedSize > 0); - } - - ASSERT(dstImage->TexFormat); - ASSERT(dstImage->FetchTexelc); - ASSERT(dstImage->FetchTexelf); + ASSERT(dstCompressedSize > 0); - /* Alloc new teximage data buffer. - * Setup src and dest data pointers. - */ - if (_mesa_is_format_compressed(dstImage->TexFormat)) { - dstImage->Data = _mesa_alloc_texmemory(dstImage->CompressedSize); + dstImage->Data = _mesa_alloc_texmemory(dstCompressedSize); if (!dstImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "generating mipmaps"); return; @@ -1653,6 +1648,10 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, dstData = (GLubyte *) dstImage->Data; } + ASSERT(dstImage->TexFormat); + ASSERT(dstImage->FetchTexelc); + ASSERT(dstImage->FetchTexelf); + _mesa_generate_mipmap_level(target, datatype, comps, border, srcWidth, srcHeight, srcDepth, srcData, srcImage->RowStride, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index f084edb840..8e6e0d09be 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1173,8 +1173,6 @@ struct gl_texture_image FetchTexelFuncC FetchTexelc; /**< GLchan texel fetch function pointer */ FetchTexelFuncF FetchTexelf; /**< Float texel fetch function pointer */ - GLuint CompressedSize; /**< GL_ARB_texture_compression */ - GLuint RowStride; /**< Padded width in units of texels */ GLuint *ImageOffsets; /**< if 3D texture: array [Depth] of offsets to each 2D slice in 'Data', in texels */ diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 86f46b9551..438a316b9c 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -903,7 +903,6 @@ clear_teximage_fields(struct gl_texture_image *img) img->TexFormat = MESA_FORMAT_NONE; img->FetchTexelc = NULL; img->FetchTexelf = NULL; - img->CompressedSize = 0; } @@ -966,8 +965,6 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, img->MaxLog2 = MAX2(img->WidthLog2, img->HeightLog2); - img->CompressedSize = 0; - if ((width == 1 || _mesa_is_pow_two(img->Width2)) && (height == 1 || _mesa_is_pow_two(img->Height2)) && (depth == 1 || _mesa_is_pow_two(img->Depth2))) diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 0fa8c44817..133b0370c8 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3159,34 +3159,12 @@ _mesa_unmap_teximage_pbo(GLcontext *ctx, } -static void -compute_texture_size(GLcontext *ctx, struct gl_texture_image *texImage) -{ - if (_mesa_is_format_compressed(texImage->TexFormat)) { - texImage->CompressedSize = - ctx->Driver.CompressedTextureSize(ctx, texImage->Width, - texImage->Height, texImage->Depth, - texImage->TexFormat); - } - else { - /* non-compressed format */ - texImage->CompressedSize = 0; - } -} - - /** Return texture size in bytes */ static GLuint texture_size(const struct gl_texture_image *texImage) { - GLuint sz; - - if (_mesa_is_format_compressed(texImage->TexFormat)) - sz = texImage->CompressedSize; - else - sz = texImage->Width * texImage->Height * texImage->Depth * - _mesa_get_format_bytes(texImage->TexFormat); - + GLuint sz = _mesa_format_image_size(texImage->TexFormat, texImage->Width, + texImage->Height, texImage->Depth); return sz; } @@ -3228,7 +3206,7 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - GLint sizeInBytes; + GLuint sizeInBytes; (void) border; texImage->TexFormat @@ -3236,11 +3214,9 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, ASSERT(texImage->TexFormat); _mesa_set_fetch_functions(texImage, 1); - compute_texture_size(ctx, texImage); /* allocate memory */ sizeInBytes = texture_size(texImage); - texImage->Data = _mesa_alloc_texmemory(sizeInBytes); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage1D"); @@ -3293,7 +3269,7 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - GLint texelBytes, sizeInBytes; + GLuint sizeInBytes; (void) border; texImage->TexFormat @@ -3301,9 +3277,6 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, ASSERT(texImage->TexFormat); _mesa_set_fetch_functions(texImage, 2); - compute_texture_size(ctx, texImage); - - texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* allocate memory */ sizeInBytes = texture_size(texImage); @@ -3355,7 +3328,7 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - GLint texelBytes, sizeInBytes; + GLuint sizeInBytes; (void) border; texImage->TexFormat @@ -3363,9 +3336,6 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, ASSERT(texImage->TexFormat); _mesa_set_fetch_functions(texImage, 3); - compute_texture_size(ctx, texImage); - - texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* allocate memory */ sizeInBytes = texture_size(texImage); @@ -3570,7 +3540,6 @@ _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level, ASSERT(texImage->TexFormat); _mesa_set_fetch_functions(texImage, 2); - compute_texture_size(ctx, texImage); /* allocate storage */ texImage->Data = _mesa_alloc_texmemory(imageSize); @@ -3586,7 +3555,6 @@ _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level, return; /* copy the data */ - ASSERT(texImage->CompressedSize == (GLuint) imageSize); MEMCPY(texImage->Data, data, imageSize); _mesa_unmap_teximage_pbo(ctx, &ctx->Unpack); diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 2574eeb996..dc3ab61425 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -563,10 +563,6 @@ st_TexImage(GLcontext * ctx, if (_mesa_is_format_compressed(texImage->TexFormat)) { /* must be a compressed format */ texelBytes = 0; - texImage->CompressedSize = - ctx->Driver.CompressedTextureSize(ctx, texImage->Width, - texImage->Height, texImage->Depth, - texImage->TexFormat); } else { texelBytes = _mesa_get_format_bytes(texImage->TexFormat); @@ -697,7 +693,11 @@ st_TexImage(GLcontext * ctx, else { /* Allocate regular memory and store the image there temporarily. */ if (_mesa_is_format_compressed(texImage->TexFormat)) { - sizeInBytes = texImage->CompressedSize; + sizeInBytes = ctx->Driver.CompressedTextureSize(ctx, + texImage->Width, + texImage->Height, + texImage->Depth, + texImage->TexFormat); dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width); assert(dims != 3); -- cgit v1.2.3 From 337480e1f85844b7bd4a4d47cef93a217e3ad464 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 2 Oct 2009 07:26:28 -0600 Subject: gallium: remove // comment and extra whitespace --- src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c index 44147aed9b..734c05f068 100644 --- a/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c +++ b/src/gallium/auxiliary/draw/draw_pt_fetch_shade_emit.c @@ -212,17 +212,10 @@ static void fse_prepare( struct draw_pt_middle_end *middle, struct draw_vertex_shader *vs = draw->vs.vertex_shader; vs->prepare(vs, draw); } - - - //return TRUE; } - - - - static void fse_run_linear( struct draw_pt_middle_end *middle, unsigned start, unsigned count ) -- cgit v1.2.3 From 389021220d27c376b81a6221a31d0ee33c24e67f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 2 Oct 2009 07:31:42 -0600 Subject: gallium: replace // comments with /* */ --- src/gallium/auxiliary/cso_cache/cso_context.c | 2 +- src/gallium/auxiliary/draw/draw_pt_post_vs.c | 2 +- src/gallium/auxiliary/draw/draw_vs_aos.c | 6 +++--- src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c | 2 +- src/gallium/auxiliary/translate/translate_generic.c | 2 +- src/gallium/auxiliary/util/u_cpu_detect.c | 2 +- src/gallium/auxiliary/util/u_debug_profile.c | 2 +- src/gallium/auxiliary/util/u_debug_symbol.c | 2 +- src/gallium/drivers/softpipe/sp_fs_sse.c | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 36c882acb7..4f13b3e2ba 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -268,7 +268,7 @@ void cso_release_all( struct cso_context *ctx ) void cso_destroy_context( struct cso_context *ctx ) { if (ctx) { - //cso_release_all( ctx ); + /*cso_release_all( ctx );*/ FREE( ctx ); } } diff --git a/src/gallium/auxiliary/draw/draw_pt_post_vs.c b/src/gallium/auxiliary/draw/draw_pt_post_vs.c index 00d7197b13..78953bccfc 100644 --- a/src/gallium/auxiliary/draw/draw_pt_post_vs.c +++ b/src/gallium/auxiliary/draw/draw_pt_post_vs.c @@ -210,7 +210,7 @@ void draw_pt_post_vs_prepare( struct pt_post_vs *pvs, pvs->run = post_vs_viewport; } else { - //if (opengl) + /* if (opengl) */ pvs->run = post_vs_cliptest_viewport_gl; } } diff --git a/src/gallium/auxiliary/draw/draw_vs_aos.c b/src/gallium/auxiliary/draw/draw_vs_aos.c index 62e04a65f3..645d7cccba 100644 --- a/src/gallium/auxiliary/draw/draw_vs_aos.c +++ b/src/gallium/auxiliary/draw/draw_vs_aos.c @@ -891,7 +891,7 @@ static void x87_emit_ex2( struct aos_compilation *cp ) struct x86_reg st1 = x86_make_reg(file_x87, 1); int stack = cp->func->x87_stack; -// set_fpu_round_neg_inf( cp ); + /* set_fpu_round_neg_inf( cp ); */ x87_fld(cp->func, st0); /* a a */ x87_fprndint( cp->func ); /* int(a) a*/ @@ -1759,14 +1759,14 @@ emit_instruction( struct aos_compilation *cp, return emit_SUB(cp, inst); case TGSI_OPCODE_LRP: -// return emit_LERP(cp, inst); + /*return emit_LERP(cp, inst);*/ return FALSE; case TGSI_OPCODE_FRC: return emit_FRC(cp, inst); case TGSI_OPCODE_CLAMP: -// return emit_CLAMP(cp, inst); + /*return emit_CLAMP(cp, inst);*/ return FALSE; case TGSI_OPCODE_FLR: diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c index 109ac7c9d6..0d30363484 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c @@ -584,7 +584,7 @@ fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list) } #ifdef DEBUG - //assert(!fenced_list->numUnfenced); + /*assert(!fenced_list->numUnfenced);*/ #endif pipe_mutex_unlock(fenced_list->mutex); diff --git a/src/gallium/auxiliary/translate/translate_generic.c b/src/gallium/auxiliary/translate/translate_generic.c index 8d39b64c6c..266e7ee81e 100644 --- a/src/gallium/auxiliary/translate/translate_generic.c +++ b/src/gallium/auxiliary/translate/translate_generic.c @@ -217,7 +217,7 @@ ATTRIB( R8G8_SNORM, 2, char, FROM_8_SNORM, TO_8_SNORM ) ATTRIB( R8_SNORM, 1, char, FROM_8_SNORM, TO_8_SNORM ) ATTRIB( A8R8G8B8_UNORM, 4, ubyte, FROM_8_UNORM, TO_8_UNORM ) -//ATTRIB( R8G8B8A8_UNORM, 4, ubyte, FROM_8_UNORM, TO_8_UNORM ) +/*ATTRIB( R8G8B8A8_UNORM, 4, ubyte, FROM_8_UNORM, TO_8_UNORM )*/ ATTRIB( R32G32B32A32_FIXED, 4, int, FROM_32_FIXED, TO_32_FIXED ) ATTRIB( R32G32B32_FIXED, 3, int, FROM_32_FIXED, TO_32_FIXED ) diff --git a/src/gallium/auxiliary/util/u_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c index d9f2f8fc28..f78706f447 100644 --- a/src/gallium/auxiliary/util/u_cpu_detect.c +++ b/src/gallium/auxiliary/util/u_cpu_detect.c @@ -268,7 +268,7 @@ static void check_os_katmai_support(void) * and therefore to be safe I'm going to leave this test in here. */ if (__cpu_detect_caps.hasSSE) { - // test_os_katmai_exception_support(); + /* test_os_katmai_exception_support(); */ } /* Restore the original signal handlers. diff --git a/src/gallium/auxiliary/util/u_debug_profile.c b/src/gallium/auxiliary/util/u_debug_profile.c index 6d8b244c3a..d765b50144 100644 --- a/src/gallium/auxiliary/util/u_debug_profile.c +++ b/src/gallium/auxiliary/util/u_debug_profile.c @@ -254,7 +254,7 @@ debug_profile_start(void) { WCHAR *p; - // increment starting from the less significant digit + /* increment starting from the less significant digit */ p = &wFileName[14]; while(1) { if(*p == '9') { diff --git a/src/gallium/auxiliary/util/u_debug_symbol.c b/src/gallium/auxiliary/util/u_debug_symbol.c index 811931f81b..417d0cf04c 100644 --- a/src/gallium/auxiliary/util/u_debug_symbol.c +++ b/src/gallium/auxiliary/util/u_debug_symbol.c @@ -214,7 +214,7 @@ 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 + DWORD dwDisplacement = 0; /* Displacement of the input address, relative to the start of the symbol */ hProcess = GetCurrentProcess(); diff --git a/src/gallium/drivers/softpipe/sp_fs_sse.c b/src/gallium/drivers/softpipe/sp_fs_sse.c index f4fa0905d7..31ccc3bda9 100644 --- a/src/gallium/drivers/softpipe/sp_fs_sse.c +++ b/src/gallium/drivers/softpipe/sp_fs_sse.c @@ -101,7 +101,7 @@ fs_sse_run( const struct sp_fragment_shader *base, machine->Consts, (const float (*)[4])shader->immediates, machine->InterpCoefs - // , &machine->QuadPos + /*, &machine->QuadPos*/ ); return ~(machine->Temps[TGSI_EXEC_TEMP_KILMASK_I].xyzw[TGSI_EXEC_TEMP_KILMASK_C].u[0]); -- cgit v1.2.3 From abc12d0636a5f7fb938c0305cb1b642d5ec0afce Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 2 Oct 2009 07:47:49 -0600 Subject: gallium/xlib: return GLX_RGBA_BIT or GLX_COLOR_INDEX_BIT in get_config() This reverts part of commit a6b84aef4ad3a7bac40704146a98977c62bfb6e8 --- src/gallium/state_trackers/glx/xlib/glx_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c index 65012e9253..7f04db2186 100644 --- a/src/gallium/state_trackers/glx/xlib/glx_api.c +++ b/src/gallium/state_trackers/glx/xlib/glx_api.c @@ -1538,9 +1538,9 @@ get_config( XMesaVisual xmvis, int attrib, int *value, GLboolean fbconfig ) if (!fbconfig) return GLX_BAD_ATTRIBUTE; if (xmvis->mesa_visual.rgbMode) - *value = GLX_RGBA_TYPE; + *value = GLX_RGBA_BIT; else - *value = GLX_COLOR_INDEX_TYPE; + *value = GLX_COLOR_INDEX_BIT; break; case GLX_X_RENDERABLE_SGIX: if (!fbconfig) -- cgit v1.2.3 From 584b0879ac2ec2420ea6866e47eb90e1a980e758 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 2 Oct 2009 07:51:15 -0600 Subject: xlib: use bitwise-and to test GLX_RGBA_BIT in choose_visual() The parameter is a bitmask. --- src/mesa/drivers/x11/fakeglx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index eb7c4f6417..6449dc88b0 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -1197,10 +1197,10 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig ) if (!fbConfig) return NULL; parselist++; - if (*parselist == GLX_RGBA_BIT) { + if (*parselist & GLX_RGBA_BIT) { rgb_flag = GL_TRUE; } - else if (*parselist == GLX_COLOR_INDEX_BIT) { + else if (*parselist & GLX_COLOR_INDEX_BIT) { rgb_flag = GL_FALSE; } else if (*parselist == 0) { -- cgit v1.2.3 From 85ee0ef9a72e4ffd6ed0a2442b1272a43508d257 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 2 Oct 2009 07:52:27 -0600 Subject: gallium/xlib: use bitwise-and to test GLX_RGBA_BIT in choose_visual() The parameter is a bitmask. --- src/gallium/state_trackers/glx/xlib/glx_api.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c index 7f04db2186..6cd7ede31c 100644 --- a/src/gallium/state_trackers/glx/xlib/glx_api.c +++ b/src/gallium/state_trackers/glx/xlib/glx_api.c @@ -850,10 +850,10 @@ choose_visual( Display *dpy, int screen, const int *list, GLboolean fbConfig ) if (!fbConfig) return NULL; parselist++; - if (*parselist == GLX_RGBA_BIT) { + if (*parselist & GLX_RGBA_BIT) { rgb_flag = GL_TRUE; } - else if (*parselist == GLX_COLOR_INDEX_BIT) { + else if (*parselist & GLX_COLOR_INDEX_BIT) { rgb_flag = GL_FALSE; } else if (*parselist == 0) { -- cgit v1.2.3 From f1cab802b8e78906413f219ad354f5d5500b4d3f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 2 Oct 2009 08:54:55 -0600 Subject: mesa: added _mesa_meta_check_generate_mipmap_fallback() --- src/mesa/drivers/common/meta.c | 27 ++++++++++++++++++++++++--- src/mesa/drivers/common/meta.h | 4 ++++ 2 files changed, 28 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index a152087a3a..20d47dc38b 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -1948,6 +1948,29 @@ _mesa_meta_Bitmap(GLcontext *ctx, } +/** + * Check if the call to _mesa_meta_GenerateMipmap() will require a + * software fallback. The fallback path will require that the texture + * images are mapped. + */ +GLboolean +_mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target, + struct gl_texture_object *texObj) +{ + struct gl_texture_image *baseImage = + _mesa_select_tex_image(ctx, texObj, target, texObj->BaseLevel); + + /* check for fallbacks */ + if (!ctx->Extensions.EXT_framebuffer_object || + target == GL_TEXTURE_3D || + !baseImage || + baseImage->IsCompressed) { + return GL_TRUE; + } + return GL_FALSE; +} + + /** * Called via ctx->Driver.GenerateMipmap() * Note: texture borders and 3D texture support not yet complete. @@ -1976,9 +1999,7 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, GLuint dstLevel; GLuint border = 0; - /* check for fallbacks */ - if (!ctx->Extensions.EXT_framebuffer_object || - target == GL_TEXTURE_3D) { + if (_mesa_meta_check_generate_mipmap_fallback(ctx, target, texObj)) { _mesa_generate_mipmap(ctx, target, texObj); return; } diff --git a/src/mesa/drivers/common/meta.h b/src/mesa/drivers/common/meta.h index 7f659528dc..6225b94189 100644 --- a/src/mesa/drivers/common/meta.h +++ b/src/mesa/drivers/common/meta.h @@ -60,6 +60,10 @@ _mesa_meta_Bitmap(GLcontext *ctx, const struct gl_pixelstore_attrib *unpack, const GLubyte *bitmap); +extern GLboolean +_mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target, + struct gl_texture_object *texObj); + extern void _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, struct gl_texture_object *texObj); -- cgit v1.2.3 From 7d4b348c67dbc2eff1d7dd0c043a76bc0eae57ab Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 2 Oct 2009 08:55:25 -0600 Subject: intel: wrap _mesa_meta_GenerateMipmap() Need to check if we'll take the software path so which requires mapping the src texture image. Fixes crash in piglit gen-compressed-teximage, bug 24219. However, the test still does not pass (it may never have). --- src/mesa/drivers/dri/intel/intel_tex.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c index f5d877edc3..3cbc379dbd 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -2,6 +2,7 @@ #include "main/texobj.h" #include "main/teximage.h" #include "main/mipmap.h" +#include "drivers/common/meta.h" #include "intel_context.h" #include "intel_mipmap_tree.h" #include "intel_tex.h" @@ -158,10 +159,36 @@ timed_memcpy(void *dest, const void *src, size_t n) } #endif /* DO_DEBUG */ + +/** + * Called via ctx->Driver.GenerateMipmap() + * This is basically a wrapper for _mesa_meta_GenerateMipmap() which checks + * if we'll be using software mipmap generation. In that case, we need to + * map/unmap the base level texture image. + */ +static void +intelGenerateMipmap(GLcontext *ctx, GLenum target, + struct gl_texture_object *texObj) +{ + if (_mesa_meta_check_generate_mipmap_fallback(ctx, target, texObj)) { + /* sw path: need to map texture images */ + struct intel_context *intel = intel_context(ctx); + struct intel_texture_object *intelObj = intel_texture_object(texObj); + intel_tex_map_level_images(intel, intelObj, texObj->BaseLevel); + _mesa_generate_mipmap(ctx, target, texObj); + intel_tex_unmap_level_images(intel, intelObj, texObj->BaseLevel); + } + else { + _mesa_meta_GenerateMipmap(ctx, target, texObj); + } +} + + void intelInitTextureFuncs(struct dd_function_table *functions) { functions->ChooseTextureFormat = intelChooseTextureFormat; + functions->GenerateMipmap = intelGenerateMipmap; functions->NewTextureObject = intelNewTextureObject; functions->NewTextureImage = intelNewTextureImage; -- cgit v1.2.3 From e1bddd159f364fa04ddec22f568fbfeb775d3b47 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 2 Oct 2009 09:55:07 -0600 Subject: mesa: fix incorrect default texture binding in unbind_texobj_from_texunits() If we deleted a currently bound texture, we were always reverting the texture binding to the default 1D texture rather than the proper default texture. --- src/mesa/main/texobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index d09c439250..da55ac8697 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -863,7 +863,7 @@ unbind_texobj_from_texunits(GLcontext *ctx, struct gl_texture_object *texObj) for (tex = 0; tex < NUM_TEXTURE_TARGETS; tex++) { if (texObj == unit->CurrentTex[tex]) { _mesa_reference_texobj(&unit->CurrentTex[tex], - ctx->Shared->DefaultTex[TEXTURE_1D_INDEX]); + ctx->Shared->DefaultTex[tex]); ASSERT(unit->CurrentTex[tex]); break; } -- cgit v1.2.3 From 47e41b024e325f69ed514e551a6824afa58f1db6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 2 Oct 2009 18:13:26 +0200 Subject: gallium: Preparations for adding more PIPE_TRANSFER_* usage flags. Always test for PIPE_TRANSFER_READ/WRITE using the bit-wise and operator, and add a pipe_transfer_buffer_flags() helper for getting the buffer usage flags corresponding to them. --- src/gallium/auxiliary/util/u_tile.c | 4 ++-- src/gallium/drivers/cell/ppu/cell_texture.c | 18 ++++----------- src/gallium/drivers/i915simple/i915_texture.c | 2 +- src/gallium/drivers/llvmpipe/lp_texture.c | 14 +++--------- src/gallium/drivers/nv04/nv04_transfer.c | 26 +++++----------------- src/gallium/drivers/nv10/nv10_transfer.c | 26 +++++----------------- src/gallium/drivers/nv20/nv20_transfer.c | 26 +++++----------------- src/gallium/drivers/nv30/nv30_transfer.c | 26 +++++----------------- src/gallium/drivers/nv40/nv40_transfer.c | 26 +++++----------------- src/gallium/drivers/nv50/nv50_transfer.c | 4 ++-- src/gallium/drivers/r300/r300_screen.c | 11 ++------- src/gallium/drivers/softpipe/sp_texture.c | 15 +++---------- src/gallium/drivers/trace/tr_screen.c | 2 +- src/gallium/include/pipe/p_inlines.h | 16 +++++++++++++ .../state_trackers/python/retrace/interpreter.py | 2 +- src/gallium/state_trackers/vega/st_inlines.h | 3 +-- src/mesa/state_tracker/st_cb_accum.c | 2 +- src/mesa/state_tracker/st_texture.c | 3 +-- 18 files changed, 63 insertions(+), 163 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c index 0d6489c26e..8a22f584be 100644 --- a/src/gallium/auxiliary/util/u_tile.c +++ b/src/gallium/auxiliary/util/u_tile.c @@ -1452,7 +1452,7 @@ pipe_put_tile_z(struct pipe_transfer *pt, case PIPE_FORMAT_S8Z24_UNORM: { uint *pDest = (uint *) (map + y * pt->stride + x*4); - assert(pt->usage == PIPE_TRANSFER_READ_WRITE); + assert((pt->usage & PIPE_TRANSFER_READ_WRITE) == PIPE_TRANSFER_READ_WRITE); for (i = 0; i < h; i++) { for (j = 0; j < w; j++) { /* convert 32-bit Z to 24-bit Z, preserve stencil */ @@ -1479,7 +1479,7 @@ pipe_put_tile_z(struct pipe_transfer *pt, case PIPE_FORMAT_Z24S8_UNORM: { uint *pDest = (uint *) (map + y * pt->stride + x*4); - assert(pt->usage == PIPE_TRANSFER_READ_WRITE); + assert((pt->usage & PIPE_TRANSFER_READ_WRITE) == PIPE_TRANSFER_READ_WRITE); for (i = 0; i < h; i++) { for (j = 0; j < w; j++) { /* convert 32-bit Z to 24-bit Z, preserve stencil */ diff --git a/src/gallium/drivers/cell/ppu/cell_texture.c b/src/gallium/drivers/cell/ppu/cell_texture.c index 6a63a0e6ce..ae4c61efb3 100644 --- a/src/gallium/drivers/cell/ppu/cell_texture.c +++ b/src/gallium/drivers/cell/ppu/cell_texture.c @@ -389,22 +389,14 @@ cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer) const uint texWidth = pt->width[level]; const uint texHeight = pt->height[level]; const uint stride = ct->stride[level]; - unsigned flags = 0x0; unsigned size; assert(transfer->texture); - if (transfer->usage != PIPE_TRANSFER_READ) { - flags |= PIPE_BUFFER_USAGE_CPU_WRITE; - } - - if (transfer->usage != PIPE_TRANSFER_WRITE) { - flags |= PIPE_BUFFER_USAGE_CPU_READ; - } - if (!ct->mapped) { /* map now */ - ct->mapped = pipe_buffer_map(screen, ct->buffer, flags); + ct->mapped = pipe_buffer_map(screen, ct->buffer, + pipe_transfer_buffer_flags(transfer)); } /* @@ -417,8 +409,7 @@ cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer) if (!ctrans->map) return NULL; /* out of memory */ - if (transfer->usage == PIPE_TRANSFER_READ || - transfer->usage == PIPE_TRANSFER_READ_WRITE) { + if (transfer->usage & PIPE_TRANSFER_READ) { /* need to untwiddle the texture to make a linear version */ const uint bpp = pf_get_size(ct->base.format); if (bpp == 4) { @@ -459,8 +450,7 @@ cell_transfer_unmap(struct pipe_screen *screen, PIPE_BUFFER_USAGE_CPU_READ); } - if (transfer->usage == PIPE_TRANSFER_WRITE || - transfer->usage == PIPE_TRANSFER_READ_WRITE) { + if (transfer->usage & PIPE_TRANSFER_WRITE) { /* The user wrote new texture data into the mapped buffer. * We need to convert the new linear data into the twiddled/tiled format. */ diff --git a/src/gallium/drivers/i915simple/i915_texture.c b/src/gallium/drivers/i915simple/i915_texture.c index 15ccc1fc73..286c9ace8e 100644 --- a/src/gallium/drivers/i915simple/i915_texture.c +++ b/src/gallium/drivers/i915simple/i915_texture.c @@ -859,7 +859,7 @@ i915_transfer_map(struct pipe_screen *screen, char *map; boolean write = FALSE; - if (transfer->usage != PIPE_TRANSFER_READ) + if (transfer->usage & PIPE_TRANSFER_WRITE) write = TRUE; map = iws->buffer_map(iws, tex->buffer, write); diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index 724d437833..08f0950d47 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -353,17 +353,9 @@ llvmpipe_transfer_map( struct pipe_screen *_screen, if(lpt->dt) { struct llvmpipe_winsys *winsys = screen->winsys; - unsigned flags = 0; - if (transfer->usage != PIPE_TRANSFER_READ) { - flags |= PIPE_BUFFER_USAGE_CPU_WRITE; - } - - if (transfer->usage != PIPE_TRANSFER_WRITE) { - flags |= PIPE_BUFFER_USAGE_CPU_READ; - } - - map = winsys->displaytarget_map(winsys, lpt->dt, flags); + map = winsys->displaytarget_map(winsys, lpt->dt, + pipe_transfer_buffer_flags(transfer)); if (map == NULL) return NULL; } @@ -373,7 +365,7 @@ llvmpipe_transfer_map( struct pipe_screen *_screen, /* May want to different things here depending on read/write nature * of the map: */ - if (transfer->texture && transfer->usage != PIPE_TRANSFER_READ) + if (transfer->texture && (transfer->usage & PIPE_TRANSFER_WRITE)) { /* Do something to notify sharing contexts of a texture change. * In llvmpipe, that would mean flushing the texture cache. diff --git a/src/gallium/drivers/nv04/nv04_transfer.c b/src/gallium/drivers/nv04/nv04_transfer.c index 854b855d64..6618660743 100644 --- a/src/gallium/drivers/nv04/nv04_transfer.c +++ b/src/gallium/drivers/nv04/nv04_transfer.c @@ -13,22 +13,6 @@ struct nv04_transfer { bool direct; }; -static unsigned nv04_usage_tx_to_buf(unsigned tx_usage) -{ - switch (tx_usage) { - case PIPE_TRANSFER_READ: - return PIPE_BUFFER_USAGE_CPU_READ; - case PIPE_TRANSFER_WRITE: - return PIPE_BUFFER_USAGE_CPU_WRITE; - case PIPE_TRANSFER_READ_WRITE: - return PIPE_BUFFER_USAGE_CPU_READ_WRITE; - default: - assert(0); - } - - return -1; -} - static void nv04_compatible_transfer_tex(struct pipe_texture *pt, unsigned level, struct pipe_texture *template) @@ -86,7 +70,7 @@ nv04_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->direct = true; tx->surface = pscreen->get_tex_surface(pscreen, pt, 0, 0, 0, - nv04_usage_tx_to_buf(usage)); + pipe_transfer_buffer_flags(&tx->base)); return &tx->base; } @@ -103,7 +87,7 @@ nv04_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->surface = pscreen->get_tex_surface(pscreen, tx_tex, face, level, zslice, - nv04_usage_tx_to_buf(usage)); + pipe_transfer_buffer_flags(&tx->base)); pipe_texture_reference(&tx_tex, NULL); @@ -114,7 +98,7 @@ nv04_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, return NULL; } - if (usage != PIPE_TRANSFER_WRITE) { + if (usage & PIPE_TRANSFER_READ) { struct nv04_screen *nvscreen = nv04_screen(pscreen); struct pipe_surface *src; @@ -140,7 +124,7 @@ nv04_transfer_del(struct pipe_transfer *ptx) { struct nv04_transfer *tx = (struct nv04_transfer *)ptx; - if (!tx->direct && ptx->usage != PIPE_TRANSFER_READ) { + if (!tx->direct && (ptx->usage & PIPE_TRANSFER_WRITE)) { struct pipe_screen *pscreen = ptx->texture->screen; struct nv04_screen *nvscreen = nv04_screen(pscreen); struct pipe_surface *dst; @@ -170,7 +154,7 @@ nv04_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) struct nv04_surface *ns = (struct nv04_surface *)tx->surface; struct nv04_miptree *mt = (struct nv04_miptree *)tx->surface->texture; void *map = pipe_buffer_map(pscreen, mt->buffer, - nv04_usage_tx_to_buf(ptx->usage)); + pipe_transfer_buffer_flags(ptx)); return map + ns->base.offset + ptx->y * ns->pitch + ptx->x * ptx->block.size; diff --git a/src/gallium/drivers/nv10/nv10_transfer.c b/src/gallium/drivers/nv10/nv10_transfer.c index c06b8d34c7..8feb85e4bd 100644 --- a/src/gallium/drivers/nv10/nv10_transfer.c +++ b/src/gallium/drivers/nv10/nv10_transfer.c @@ -13,22 +13,6 @@ struct nv10_transfer { bool direct; }; -static unsigned nv10_usage_tx_to_buf(unsigned tx_usage) -{ - switch (tx_usage) { - case PIPE_TRANSFER_READ: - return PIPE_BUFFER_USAGE_CPU_READ; - case PIPE_TRANSFER_WRITE: - return PIPE_BUFFER_USAGE_CPU_WRITE; - case PIPE_TRANSFER_READ_WRITE: - return PIPE_BUFFER_USAGE_CPU_READ_WRITE; - default: - assert(0); - } - - return -1; -} - static void nv10_compatible_transfer_tex(struct pipe_texture *pt, unsigned level, struct pipe_texture *template) @@ -86,7 +70,7 @@ nv10_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->direct = true; tx->surface = pscreen->get_tex_surface(pscreen, pt, 0, 0, 0, - nv10_usage_tx_to_buf(usage)); + pipe_transfer_buffer_flags(&tx->base)); return &tx->base; } @@ -103,7 +87,7 @@ nv10_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->surface = pscreen->get_tex_surface(pscreen, tx_tex, face, level, zslice, - nv10_usage_tx_to_buf(usage)); + pipe_transfer_buffer_flags(&tx->base)); pipe_texture_reference(&tx_tex, NULL); @@ -114,7 +98,7 @@ nv10_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, return NULL; } - if (usage != PIPE_TRANSFER_WRITE) { + if (usage & PIPE_TRANSFER_READ) { struct nv10_screen *nvscreen = nv10_screen(pscreen); struct pipe_surface *src; @@ -140,7 +124,7 @@ nv10_transfer_del(struct pipe_transfer *ptx) { struct nv10_transfer *tx = (struct nv10_transfer *)ptx; - if (!tx->direct && ptx->usage != PIPE_TRANSFER_READ) { + if (!tx->direct && (ptx->usage & PIPE_TRANSFER_WRITE)) { struct pipe_screen *pscreen = ptx->texture->screen; struct nv10_screen *nvscreen = nv10_screen(pscreen); struct pipe_surface *dst; @@ -170,7 +154,7 @@ nv10_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) struct nv04_surface *ns = (struct nv04_surface *)tx->surface; struct nv10_miptree *mt = (struct nv10_miptree *)tx->surface->texture; void *map = pipe_buffer_map(pscreen, mt->buffer, - nv10_usage_tx_to_buf(ptx->usage)); + pipe_transfer_buffer_flags(ptx)); return map + ns->base.offset + ptx->y * ns->pitch + ptx->x * ptx->block.size; diff --git a/src/gallium/drivers/nv20/nv20_transfer.c b/src/gallium/drivers/nv20/nv20_transfer.c index 5018995596..81b4f1a917 100644 --- a/src/gallium/drivers/nv20/nv20_transfer.c +++ b/src/gallium/drivers/nv20/nv20_transfer.c @@ -13,22 +13,6 @@ struct nv20_transfer { bool direct; }; -static unsigned nv20_usage_tx_to_buf(unsigned tx_usage) -{ - switch (tx_usage) { - case PIPE_TRANSFER_READ: - return PIPE_BUFFER_USAGE_CPU_READ; - case PIPE_TRANSFER_WRITE: - return PIPE_BUFFER_USAGE_CPU_WRITE; - case PIPE_TRANSFER_READ_WRITE: - return PIPE_BUFFER_USAGE_CPU_READ_WRITE; - default: - assert(0); - } - - return -1; -} - static void nv20_compatible_transfer_tex(struct pipe_texture *pt, unsigned level, struct pipe_texture *template) @@ -86,7 +70,7 @@ nv20_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->direct = true; tx->surface = pscreen->get_tex_surface(pscreen, pt, 0, 0, 0, - nv20_usage_tx_to_buf(usage)); + pipe_transfer_buffer_flags(&tx->base)); return &tx->base; } @@ -103,7 +87,7 @@ nv20_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->surface = pscreen->get_tex_surface(pscreen, tx_tex, face, level, zslice, - nv20_usage_tx_to_buf(usage)); + pipe_transfer_buffer_flags(&tx->base)); pipe_texture_reference(&tx_tex, NULL); @@ -114,7 +98,7 @@ nv20_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, return NULL; } - if (usage != PIPE_TRANSFER_WRITE) { + if (usage & PIPE_TRANSFER_READ) { struct nv20_screen *nvscreen = nv20_screen(pscreen); struct pipe_surface *src; @@ -140,7 +124,7 @@ nv20_transfer_del(struct pipe_transfer *ptx) { struct nv20_transfer *tx = (struct nv20_transfer *)ptx; - if (!tx->direct && ptx->usage != PIPE_TRANSFER_READ) { + if (!tx->direct && (ptx->usage = PIPE_TRANSFER_WRITE)) { struct pipe_screen *pscreen = ptx->texture->screen; struct nv20_screen *nvscreen = nv20_screen(pscreen); struct pipe_surface *dst; @@ -170,7 +154,7 @@ nv20_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) struct nv04_surface *ns = (struct nv04_surface *)tx->surface; struct nv20_miptree *mt = (struct nv20_miptree *)tx->surface->texture; void *map = pipe_buffer_map(pscreen, mt->buffer, - nv20_usage_tx_to_buf(ptx->usage)); + pipe_transfer_buffer_flags(ptx)); return map + ns->base.offset + ptx->y * ns->pitch + ptx->x * ptx->block.size; diff --git a/src/gallium/drivers/nv30/nv30_transfer.c b/src/gallium/drivers/nv30/nv30_transfer.c index 2367571878..98011decf7 100644 --- a/src/gallium/drivers/nv30/nv30_transfer.c +++ b/src/gallium/drivers/nv30/nv30_transfer.c @@ -13,22 +13,6 @@ struct nv30_transfer { bool direct; }; -static unsigned nv30_usage_tx_to_buf(unsigned tx_usage) -{ - switch (tx_usage) { - case PIPE_TRANSFER_READ: - return PIPE_BUFFER_USAGE_CPU_READ; - case PIPE_TRANSFER_WRITE: - return PIPE_BUFFER_USAGE_CPU_WRITE; - case PIPE_TRANSFER_READ_WRITE: - return PIPE_BUFFER_USAGE_CPU_READ_WRITE; - default: - assert(0); - } - - return -1; -} - static void nv30_compatible_transfer_tex(struct pipe_texture *pt, unsigned level, struct pipe_texture *template) @@ -86,7 +70,7 @@ nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->direct = true; tx->surface = pscreen->get_tex_surface(pscreen, pt, face, level, zslice, - nv30_usage_tx_to_buf(usage)); + pipe_transfer_buffer_flags(&tx->base)); return &tx->base; } @@ -103,7 +87,7 @@ nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->surface = pscreen->get_tex_surface(pscreen, tx_tex, 0, 0, 0, - nv30_usage_tx_to_buf(usage)); + pipe_transfer_buffer_flags(&tx->base)); pipe_texture_reference(&tx_tex, NULL); @@ -114,7 +98,7 @@ nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, return NULL; } - if (usage != PIPE_TRANSFER_WRITE) { + if (usage & PIPE_TRANSFER_READ) { struct nv30_screen *nvscreen = nv30_screen(pscreen); struct pipe_surface *src; @@ -140,7 +124,7 @@ nv30_transfer_del(struct pipe_transfer *ptx) { struct nv30_transfer *tx = (struct nv30_transfer *)ptx; - if (!tx->direct && ptx->usage != PIPE_TRANSFER_READ) { + if (!tx->direct && (ptx->usage & PIPE_TRANSFER_WRITE)) { struct pipe_screen *pscreen = ptx->texture->screen; struct nv30_screen *nvscreen = nv30_screen(pscreen); struct pipe_surface *dst; @@ -170,7 +154,7 @@ nv30_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) struct nv04_surface *ns = (struct nv04_surface *)tx->surface; struct nv30_miptree *mt = (struct nv30_miptree *)tx->surface->texture; void *map = pipe_buffer_map(pscreen, mt->buffer, - nv30_usage_tx_to_buf(ptx->usage)); + pipe_transfer_buffer_flags(ptx)); return map + ns->base.offset + ptx->y * ns->pitch + ptx->x * ptx->block.size; diff --git a/src/gallium/drivers/nv40/nv40_transfer.c b/src/gallium/drivers/nv40/nv40_transfer.c index 6d92ac3db9..92caee6f38 100644 --- a/src/gallium/drivers/nv40/nv40_transfer.c +++ b/src/gallium/drivers/nv40/nv40_transfer.c @@ -13,22 +13,6 @@ struct nv40_transfer { bool direct; }; -static unsigned nv40_usage_tx_to_buf(unsigned tx_usage) -{ - switch (tx_usage) { - case PIPE_TRANSFER_READ: - return PIPE_BUFFER_USAGE_CPU_READ; - case PIPE_TRANSFER_WRITE: - return PIPE_BUFFER_USAGE_CPU_WRITE; - case PIPE_TRANSFER_READ_WRITE: - return PIPE_BUFFER_USAGE_CPU_READ_WRITE; - default: - assert(0); - } - - return -1; -} - static void nv40_compatible_transfer_tex(struct pipe_texture *pt, unsigned level, struct pipe_texture *template) @@ -86,7 +70,7 @@ nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->direct = true; tx->surface = pscreen->get_tex_surface(pscreen, pt, face, level, zslice, - nv40_usage_tx_to_buf(usage)); + pipe_transfer_buffer_flags(&tx->base)); return &tx->base; } @@ -103,7 +87,7 @@ nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->surface = pscreen->get_tex_surface(pscreen, tx_tex, 0, 0, 0, - nv40_usage_tx_to_buf(usage)); + pipe_transfer_buffer_flags(&tx->base)); pipe_texture_reference(&tx_tex, NULL); @@ -114,7 +98,7 @@ nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, return NULL; } - if (usage != PIPE_TRANSFER_WRITE) { + if (usage & PIPE_TRANSFER_READ) { struct nv40_screen *nvscreen = nv40_screen(pscreen); struct pipe_surface *src; @@ -140,7 +124,7 @@ nv40_transfer_del(struct pipe_transfer *ptx) { struct nv40_transfer *tx = (struct nv40_transfer *)ptx; - if (!tx->direct && ptx->usage != PIPE_TRANSFER_READ) { + if (!tx->direct && (ptx->usage & PIPE_TRANSFER_WRITE)) { struct pipe_screen *pscreen = ptx->texture->screen; struct nv40_screen *nvscreen = nv40_screen(pscreen); struct pipe_surface *dst; @@ -170,7 +154,7 @@ nv40_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) struct nv04_surface *ns = (struct nv04_surface *)tx->surface; struct nv40_miptree *mt = (struct nv40_miptree *)tx->surface->texture; void *map = pipe_buffer_map(pscreen, mt->buffer, - nv40_usage_tx_to_buf(ptx->usage)); + pipe_transfer_buffer_flags(ptx)); return map + ns->base.offset + ptx->y * ns->pitch + ptx->x * ptx->block.size; diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c index bb7731855c..9c289026bb 100644 --- a/src/gallium/drivers/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nv50/nv50_transfer.c @@ -161,7 +161,7 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, return NULL; } - if (usage != PIPE_TRANSFER_WRITE) { + if (usage & PIPE_TRANSFER_READ) { nv50_transfer_rect_m2mf(pscreen, mt->base.bo, tx->level_offset, tx->level_pitch, tx->level_tiling, x, y, @@ -183,7 +183,7 @@ nv50_transfer_del(struct pipe_transfer *ptx) struct nv50_transfer *tx = (struct nv50_transfer *)ptx; struct nv50_miptree *mt = nv50_miptree(ptx->texture); - if (ptx->usage != PIPE_TRANSFER_READ) { + if (ptx->usage & PIPE_TRANSFER_WRITE) { struct pipe_screen *pscreen = ptx->texture->screen; nv50_transfer_rect_m2mf(pscreen, tx->bo, 0, tx->base.stride, tx->bo->tile_mode, 0, 0, diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 8296d56840..f2659ca61f 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -345,16 +345,9 @@ static void* r300_transfer_map(struct pipe_screen* screen, { struct r300_texture* tex = (struct r300_texture*)transfer->texture; char* map; - unsigned flags = 0; - if (transfer->usage != PIPE_TRANSFER_WRITE) { - flags |= PIPE_BUFFER_USAGE_CPU_READ; - } - if (transfer->usage != PIPE_TRANSFER_READ) { - flags |= PIPE_BUFFER_USAGE_CPU_WRITE; - } - - map = pipe_buffer_map(screen, tex->buffer, flags); + map = pipe_buffer_map(screen, tex->buffer, + pipe_transfer_buffer_flags(transfer)); if (!map) { return NULL; diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 1c64d58372..2e6c43c7ef 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -329,27 +329,18 @@ softpipe_transfer_map( struct pipe_screen *screen, { ubyte *map, *xfer_map; struct softpipe_texture *spt; - unsigned flags = 0; assert(transfer->texture); spt = softpipe_texture(transfer->texture); - if (transfer->usage != PIPE_TRANSFER_READ) { - flags |= PIPE_BUFFER_USAGE_CPU_WRITE; - } - - if (transfer->usage != PIPE_TRANSFER_WRITE) { - flags |= PIPE_BUFFER_USAGE_CPU_READ; - } - - map = pipe_buffer_map(screen, spt->buffer, flags); + map = pipe_buffer_map(screen, spt->buffer, pipe_transfer_buffer_flags(transfer)); if (map == NULL) return NULL; /* May want to different things here depending on read/write nature * of the map: */ - if (transfer->texture && transfer->usage != PIPE_TRANSFER_READ) { + if (transfer->texture && (transfer->usage & PIPE_TRANSFER_WRITE)) { /* Do something to notify sharing contexts of a texture change. * In softpipe, that would mean flushing the texture cache. */ @@ -375,7 +366,7 @@ softpipe_transfer_unmap(struct pipe_screen *screen, pipe_buffer_unmap( screen, spt->buffer ); - if (transfer->usage != PIPE_TRANSFER_READ) { + if (transfer->usage & PIPE_TRANSFER_WRITE) { /* Mark the texture as dirty to expire the tile caches. */ spt->timestamp++; } diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index 26f1c04594..ab605c7fc8 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -403,7 +403,7 @@ trace_screen_transfer_map(struct pipe_screen *_screen, map = screen->transfer_map(screen, transfer); if(map) { - if(transfer->usage != PIPE_TRANSFER_READ) { + if(transfer->usage & PIPE_TRANSFER_WRITE) { assert(!tr_trans->map); tr_trans->map = map; } diff --git a/src/gallium/include/pipe/p_inlines.h b/src/gallium/include/pipe/p_inlines.h index 30a4aaf409..5fbd62a03d 100644 --- a/src/gallium/include/pipe/p_inlines.h +++ b/src/gallium/include/pipe/p_inlines.h @@ -176,6 +176,22 @@ pipe_transfer_destroy( struct pipe_transfer *transf ) screen->tex_transfer_destroy(transf); } +static INLINE unsigned +pipe_transfer_buffer_flags( struct pipe_transfer *transf ) +{ + switch (transf->usage & PIPE_TRANSFER_READ_WRITE) { + case PIPE_TRANSFER_READ_WRITE: + return PIPE_BUFFER_USAGE_CPU_READ | PIPE_BUFFER_USAGE_CPU_WRITE; + case PIPE_TRANSFER_READ: + return PIPE_BUFFER_USAGE_CPU_READ; + case PIPE_TRANSFER_WRITE: + return PIPE_BUFFER_USAGE_CPU_WRITE; + default: + debug_assert(0); + return 0; + } +} + #ifdef __cplusplus } #endif diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index 6f0bd6ae52..f4ed2fde4d 100755 --- a/src/gallium/state_trackers/python/retrace/interpreter.py +++ b/src/gallium/state_trackers/python/retrace/interpreter.py @@ -314,7 +314,7 @@ class Screen(Object): if texture is None: return None transfer = Transfer(texture.get_surface(face, level, zslice), x, y, w, h) - if transfer and usage != gallium.PIPE_TRANSFER_WRITE: + if transfer and usage & gallium.PIPE_TRANSFER_READ if self.interpreter.options.all: self.interpreter.present(transfer.surface, 'transf_read', x, y, w, h) return transfer diff --git a/src/gallium/state_trackers/vega/st_inlines.h b/src/gallium/state_trackers/vega/st_inlines.h index 1f331dfcdb..610755e063 100644 --- a/src/gallium/state_trackers/vega/st_inlines.h +++ b/src/gallium/state_trackers/vega/st_inlines.h @@ -57,8 +57,7 @@ st_cond_flush_get_tex_transfer(struct vg_context *st, pipe->is_texture_referenced(pipe, pt, face, level); if (referenced && ((referenced & PIPE_REFERENCED_FOR_WRITE) || - usage == PIPE_TRANSFER_WRITE || - usage == PIPE_TRANSFER_READ_WRITE)) + (usage & PIPE_TRANSFER_WRITE))) vgFlush(); return screen->get_tex_transfer(screen, pt, face, level, zslice, usage, diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c index 95181578f6..3d1d0f71d5 100644 --- a/src/mesa/state_tracker/st_cb_accum.c +++ b/src/mesa/state_tracker/st_cb_accum.c @@ -241,7 +241,7 @@ accum_return(GLcontext *ctx, GLfloat value, xpos, ypos, width, height); - if (usage != PIPE_TRANSFER_WRITE) + if (usage & PIPE_TRANSFER_READ) pipe_get_tile_rgba(color_trans, 0, 0, width, height, buf); switch (acc_strb->format) { diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index bbc2830e69..ba8d1e8cc1 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -577,7 +577,6 @@ st_teximage_flush_before_map(struct st_context *st, pipe->is_texture_referenced(pipe, pt, face, level); if (referenced && ((referenced & PIPE_REFERENCED_FOR_WRITE) || - usage == PIPE_TRANSFER_WRITE || - usage == PIPE_TRANSFER_READ_WRITE)) + (usage & PIPE_TRANSFER_WRITE))) st_flush(st, PIPE_FLUSH_RENDER_CACHE, NULL); } -- cgit v1.2.3 From 9db647bb7ac5b8e560c49222b4e0c98a3acc4672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 2 Oct 2009 18:13:26 +0200 Subject: gallium: Add PIPE_TRANSFER_MAP_DIRECTLY usage flag. Asks the driver to map the texture storage directly or return NULL if that's not possible. --- src/gallium/include/pipe/p_defines.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index ad42beff47..f8fa1e3f49 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -193,7 +193,18 @@ enum pipe_texture_target { enum pipe_transfer_usage { PIPE_TRANSFER_READ = (1 << 0), PIPE_TRANSFER_WRITE = (1 << 1), - PIPE_TRANSFER_READ_WRITE = PIPE_TRANSFER_READ | PIPE_TRANSFER_WRITE /**< Read/modify/write */ + /** Read/modify/write */ + PIPE_TRANSFER_READ_WRITE = PIPE_TRANSFER_READ | PIPE_TRANSFER_WRITE, + /** + * The transfer should map the texture storage directly. The driver may + * return NULL if that isn't possible, and the state tracker needs to cope + * with that and use an alternative path without this flag. + * + * E.g. the state tracker could have a simpler path which maps textures and + * does read/modify/write cycles on them directly, and a more complicated + * path which uses minimal read and write transfers. + */ + PIPE_TRANSFER_MAP_DIRECTLY = (1 << 2) }; -- cgit v1.2.3 From 316b4ddcf770e453b888ff7fbf96cb0aec1ce106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 2 Oct 2009 18:13:26 +0200 Subject: st/xorg: Use PIPE_TRANSFER_MAP_DIRECTLY flag in EXA PrepareAccess hook. Propagate NULL return value. This also allows removing the DRM_MODE_FEATURE_DIRTYFB specific pixmap management hacks. --- src/gallium/state_trackers/xorg/xorg_exa.c | 93 +++++++++++------------------- 1 file changed, 34 insertions(+), 59 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index b54e31a701..f7949bafaa 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -202,7 +202,7 @@ ExaPrepareAccess(PixmapPtr pPix, int index) if (!priv->tex) return FALSE; - if (priv->map_count++ == 0) + if (priv->map_count == 0) { if (exa->pipe->is_texture_referenced(exa->pipe, priv->tex, 0, 0) & PIPE_REFERENCED_FOR_WRITE) @@ -210,14 +210,21 @@ ExaPrepareAccess(PixmapPtr pPix, int index) priv->map_transfer = exa->scrn->get_tex_transfer(exa->scrn, priv->tex, 0, 0, 0, +#ifdef EXA_MIXED_PIXMAPS + PIPE_TRANSFER_MAP_DIRECTLY | +#endif PIPE_TRANSFER_READ_WRITE, 0, 0, priv->tex->width[0], priv->tex->height[0]); + if (!priv->map_transfer) + return FALSE; pPix->devPrivate.ptr = exa->scrn->transfer_map(exa->scrn, priv->map_transfer); pPix->devKind = priv->map_transfer->stride; } + priv->map_count++; + return TRUE; } @@ -670,65 +677,33 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, priv->tex->height[0] != height || priv->tex_flags != priv->flags)) { struct pipe_texture *texture = NULL; - -#ifdef DRM_MODE_FEATURE_DIRTYFB - if (priv->flags) -#endif - { - struct pipe_texture template; - - memset(&template, 0, sizeof(template)); - template.target = PIPE_TEXTURE_2D; - exa_get_pipe_format(depth, &template.format, &bitsPerPixel); - pf_get_block(template.format, &template.block); - template.width[0] = width; - template.height[0] = height; - template.depth[0] = 1; - template.last_level = 0; - template.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET | priv->flags; - priv->tex_flags = priv->flags; - texture = exa->scrn->texture_create(exa->scrn, &template); - - if (priv->tex) { - struct pipe_surface *dst_surf; - struct pipe_surface *src_surf; - - dst_surf = exa->scrn->get_tex_surface( - exa->scrn, texture, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE); - src_surf = exa_gpu_surface(exa, priv); - exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf, - 0, 0, min(width, texture->width[0]), - min(height, texture->height[0])); - exa->scrn->tex_surface_destroy(dst_surf); - exa->scrn->tex_surface_destroy(src_surf); - } else if (pPixmap->devPrivate.ptr) { - struct pipe_transfer *transfer; - - if (priv->map_count != 0) - FatalError("doing ExaModifyPixmapHeader on mapped buffer\n"); - - transfer = - exa->scrn->get_tex_transfer(exa->scrn, texture, 0, 0, 0, - PIPE_TRANSFER_WRITE, - 0, 0, width, height); - util_copy_rect(exa->scrn->transfer_map(exa->scrn, transfer), - &texture->block, transfer->stride, 0, 0, - width, height, pPixmap->devPrivate.ptr, - pPixmap->devKind, 0, 0); - exa->scrn->transfer_unmap(exa->scrn, transfer); - exa->scrn->tex_transfer_destroy(transfer); - - xfree(pPixmap->devPrivate.ptr); - pPixmap->devPrivate.ptr = NULL; - } - } -#ifdef DRM_MODE_FEATURE_DIRTYFB - else { - xfree(pPixmap->devPrivate.ptr); - pPixmap->devPrivate.ptr = xalloc(pPixmap->drawable.height * - pPixmap->devKind); + struct pipe_texture template; + + memset(&template, 0, sizeof(template)); + template.target = PIPE_TEXTURE_2D; + exa_get_pipe_format(depth, &template.format, &bitsPerPixel); + pf_get_block(template.format, &template.block); + template.width[0] = width; + template.height[0] = height; + template.depth[0] = 1; + template.last_level = 0; + template.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET | priv->flags; + priv->tex_flags = priv->flags; + texture = exa->scrn->texture_create(exa->scrn, &template); + + if (priv->tex) { + struct pipe_surface *dst_surf; + struct pipe_surface *src_surf; + + dst_surf = exa->scrn->get_tex_surface( + exa->scrn, texture, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE); + src_surf = exa_gpu_surface(exa, priv); + exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf, + 0, 0, min(width, texture->width[0]), + min(height, texture->height[0])); + exa->scrn->tex_surface_destroy(dst_surf); + exa->scrn->tex_surface_destroy(src_surf); } -#endif pipe_texture_reference(&priv->tex, texture); /* the texture we create has one reference */ -- cgit v1.2.3 From 918199fb0f5d84121e0ac5821168cd0e886b22e9 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 2 Oct 2009 15:36:47 +0100 Subject: mesa/st: don't reuse vertex buffers for bitmap, clear quads Currently using max_slots > 1 will cause synchronous rendering if the driver flushes its command buffers between one bitmap and the next. Need to improve buffer_write to allow NO_WAIT (as well as no_flush) updates to buffers where we know there is no conflict with previous data. --- src/mesa/state_tracker/st_cb_bitmap.c | 13 ++++++++++++- src/mesa/state_tracker/st_cb_clear.c | 13 ++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 902fb38d1a..a22fa68299 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -330,7 +330,18 @@ setup_bitmap_vertex_data(struct st_context *st, const GLfloat clip_y0 = (GLfloat)(y0 / fb_height * 2.0 - 1.0); const GLfloat clip_x1 = (GLfloat)(x1 / fb_width * 2.0 - 1.0); const GLfloat clip_y1 = (GLfloat)(y1 / fb_height * 2.0 - 1.0); - const GLuint max_slots = 4096 / sizeof(st->bitmap.vertices); + + /* XXX: Need to improve buffer_write to allow NO_WAIT (as well as + * no_flush) updates to buffers where we know there is no conflict + * with previous data. Currently using max_slots > 1 will cause + * synchronous rendering if the driver flushes its command buffers + * between one bitmap and the next. Our flush hook below isn't + * sufficient to catch this as the driver doesn't tell us when it + * flushes its own command buffers. Until this gets fixed, pay the + * price of allocating a new buffer for each bitmap cache-flush to + * avoid synchronous rendering. + */ + const GLuint max_slots = 1; /* 4096 / sizeof(st->bitmap.vertices); */ GLuint i; if (st->bitmap.vbuf_slot >= max_slots) { diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 8a8c99f7e1..36510720a4 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -116,7 +116,18 @@ draw_quad(GLcontext *ctx, { struct st_context *st = ctx->st; struct pipe_context *pipe = st->pipe; - const GLuint max_slots = 1024 / sizeof(st->clear.vertices); + + /* XXX: Need to improve buffer_write to allow NO_WAIT (as well as + * no_flush) updates to buffers where we know there is no conflict + * with previous data. Currently using max_slots > 1 will cause + * synchronous rendering if the driver flushes its command buffers + * between one bitmap and the next. Our flush hook below isn't + * sufficient to catch this as the driver doesn't tell us when it + * flushes its own command buffers. Until this gets fixed, pay the + * price of allocating a new buffer for each bitmap cache-flush to + * avoid synchronous rendering. + */ + const GLuint max_slots = 1; /* 1024 / sizeof(st->clear.vertices); */ GLuint i; if (st->clear.vbuf_slot >= max_slots) { -- cgit v1.2.3 From 3f623cfffee8db83ba8e0302fc5e3d1f40d1b0b5 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Fri, 2 Oct 2009 14:25:52 -0400 Subject: r600: remove support for host-based ibs no longer used now that the hw supports this natively. Also, clean up some formatting. --- src/mesa/drivers/dri/r600/r600_context.h | 26 ++-- src/mesa/drivers/dri/r600/r700_render.c | 204 +++++++++++-------------------- 2 files changed, 80 insertions(+), 150 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_context.h b/src/mesa/drivers/dri/r600/r600_context.h index a296ea23fa..7f68820fda 100644 --- a/src/mesa/drivers/dri/r600/r600_context.h +++ b/src/mesa/drivers/dri/r600/r600_context.h @@ -126,32 +126,30 @@ struct r600_hw_state { struct radeon_state_atom tx_brdr_clr; }; -typedef struct StreamDesc +typedef struct StreamDesc { GLint size; //number of data element GLenum type; //data element type GLsizei stride; - struct radeon_bo *bo; - GLint bo_offset; + struct radeon_bo *bo; + GLint bo_offset; - GLuint dwords; + GLuint dwords; GLuint dst_loc; GLuint _signed; GLboolean normalize; - GLboolean is_named_bo; - GLubyte element; + GLboolean is_named_bo; + GLubyte element; } StreamDesc; -typedef struct r700_index_buffer +typedef struct r700_index_buffer { - struct radeon_bo *bo; - int bo_offset; + struct radeon_bo *bo; + int bo_offset; - GLboolean is_32bit; - GLuint count; - - GLboolean bHostIb; + GLboolean is_32bit; + GLuint count; } r700_index_buffer; /** @@ -172,7 +170,7 @@ struct r600_context { GLvector4f dummy_attrib[_TNL_ATTRIB_MAX]; GLvector4f *temp_attrib[_TNL_ATTRIB_MAX]; - GLint nNumActiveAos; + GLint nNumActiveAos; StreamDesc stream_desc[VERT_ATTRIB_MAX]; struct r700_index_buffer ind_buf; }; diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index 4949bf013d..0aef0b7ea1 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -251,19 +251,19 @@ static int r700NumVerts(int num_verts, int prim) static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim) { - context_t *context = R700_CONTEXT(ctx); - BATCH_LOCALS(&context->radeon); - int type, i, total_emit; - int num_indices; - uint32_t vgt_draw_initiator = 0; - uint32_t vgt_index_type = 0; - uint32_t vgt_primitive_type = 0; - uint32_t vgt_num_indices = 0; - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *vb = &tnl->vb; - + context_t *context = R700_CONTEXT(ctx); + BATCH_LOCALS(&context->radeon); + int type, i, total_emit; + int num_indices; + uint32_t vgt_draw_initiator = 0; + uint32_t vgt_index_type = 0; + uint32_t vgt_primitive_type = 0; + uint32_t vgt_num_indices = 0; + TNLcontext *tnl = TNL_CONTEXT(ctx); + struct vertex_buffer *vb = &tnl->vb; GLboolean bUseDrawIndex; - if( (NULL != context->ind_buf.bo) && (GL_TRUE != context->ind_buf.bHostIb) ) + + if(NULL != context->ind_buf.bo) { bUseDrawIndex = GL_TRUE; } @@ -272,35 +272,35 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim bUseDrawIndex = GL_FALSE; } - type = r700PrimitiveType(prim); - num_indices = r700NumVerts(end - start, prim); + type = r700PrimitiveType(prim); + num_indices = r700NumVerts(end - start, prim); - radeon_print(RADEON_RENDER, RADEON_TRACE, - "%s type %x num_indices %d\n", - __func__, type, num_indices); + radeon_print(RADEON_RENDER, RADEON_TRACE, + "%s type %x num_indices %d\n", + __func__, type, num_indices); - if (type < 0 || num_indices <= 0) - return; + if (type < 0 || num_indices <= 0) + return; if(GL_TRUE == bUseDrawIndex) { total_emit = 3 /* VGT_PRIMITIVE_TYPE */ - + 2 /* VGT_INDEX_TYPE */ - + 2 /* NUM_INSTANCES */ - + 5+2; /* DRAW_INDEX */ + + 2 /* VGT_INDEX_TYPE */ + + 2 /* NUM_INSTANCES */ + + 5 + 2; /* DRAW_INDEX */ } else { total_emit = 3 /* VGT_PRIMITIVE_TYPE */ - + 2 /* VGT_INDEX_TYPE */ - + 2 /* NUM_INSTANCES */ - + num_indices + 3; /* DRAW_INDEX_IMMD */ + + 2 /* VGT_INDEX_TYPE */ + + 2 /* NUM_INSTANCES */ + + num_indices + 3; /* DRAW_INDEX_IMMD */ } BEGIN_BATCH_NO_AUTOSTATE(total_emit); - // prim + // prim SETfield(vgt_primitive_type, type, - VGT_PRIMITIVE_TYPE__PRIM_TYPE_shift, VGT_PRIMITIVE_TYPE__PRIM_TYPE_mask); + VGT_PRIMITIVE_TYPE__PRIM_TYPE_shift, VGT_PRIMITIVE_TYPE__PRIM_TYPE_mask); R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CONFIG_REG, 1)); R600_OUT_BATCH(mmVGT_PRIMITIVE_TYPE - ASIC_CONFIG_BASE_INDEX); R600_OUT_BATCH(vgt_primitive_type); @@ -319,11 +319,11 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim R600_OUT_BATCH(CP_PACKET3(R600_IT_INDEX_TYPE, 0)); R600_OUT_BATCH(vgt_index_type); - // num instances - R600_OUT_BATCH(CP_PACKET3(R600_IT_NUM_INSTANCES, 0)); - R600_OUT_BATCH(1); + // num instances + R600_OUT_BATCH(CP_PACKET3(R600_IT_NUM_INSTANCES, 0)); + R600_OUT_BATCH(1); - // draw packet + // draw packet vgt_num_indices = num_indices; if(GL_TRUE == bUseDrawIndex) @@ -354,44 +354,17 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX_IMMD, (num_indices + 1))); R600_OUT_BATCH(vgt_num_indices); R600_OUT_BATCH(vgt_draw_initiator); - } - if(NULL == context->ind_buf.bo) - { - for (i = start; i < (start + num_indices); i++) { + for (i = start; i < (start + num_indices); i++) + { if(vb->Elts) { R600_OUT_BATCH(vb->Elts[i]); } else + { R600_OUT_BATCH(i); - } - } - else - { - if(GL_TRUE == context->ind_buf.bHostIb) - { - if(GL_TRUE != context->ind_buf.is_32bit) - { - GLushort * pIndex = (GLushort*)ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); - pIndex += start; - for (i = 0; i < num_indices; i++) - { - R600_OUT_BATCH(*pIndex); - pIndex++; - } - } - else - { - GLuint * pIndex = (GLuint*)ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); - pIndex += start; - - for (i = 0; i < num_indices; i++) - { - R600_OUT_BATCH(*pIndex); - pIndex++; - } - } + } } } @@ -826,30 +799,21 @@ static void r700FreeData(GLcontext *ctx) * called during context destroy */ context_t *context = R700_CONTEXT(ctx); - + int i; - for (i = 0; i < context->nNumActiveAos; i++) + for (i = 0; i < context->nNumActiveAos; i++) { - if (!context->stream_desc[i].is_named_bo) + if (!context->stream_desc[i].is_named_bo) { radeon_bo_unref(context->stream_desc[i].bo); } context->radeon.tcl.aos[i].bo = NULL; } - - if (context->ind_buf.bo != NULL) + + if (context->ind_buf.bo != NULL) { - if(context->ind_buf.bHostIb != GL_TRUE) - { radeon_bo_unref(context->ind_buf.bo); - } - else - { - FREE(context->ind_buf.bo->ptr); - FREE(context->ind_buf.bo); - context->ind_buf.bo = NULL; - } } } @@ -861,7 +825,7 @@ static void r700FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer int i; GLboolean mapped_named_bo = GL_FALSE; - if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer) + if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer) { ctx->Driver.MapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER, GL_READ_ONLY_ARB, mesa_ind_buf->obj); mapped_named_bo = GL_TRUE; @@ -869,66 +833,46 @@ static void r700FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer } src_ptr = ADD_POINTERS(mesa_ind_buf->obj->Pointer, mesa_ind_buf->ptr); - if (mesa_ind_buf->type == GL_UNSIGNED_BYTE) + if (mesa_ind_buf->type == GL_UNSIGNED_BYTE) { GLuint size = sizeof(GLushort) * ((mesa_ind_buf->count + 1) & ~1); GLubyte *in = (GLubyte *)src_ptr; - if(context->ind_buf.bHostIb != GL_TRUE) - { - radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo, - &context->ind_buf.bo_offset, size, 4); + radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo, + &context->ind_buf.bo_offset, size, 4); - assert(context->ind_buf.bo->ptr != NULL); - out = (GLuint *)ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); - } - else - { - context->ind_buf.bo = MALLOC_STRUCT(radeon_bo); - context->ind_buf.bo->ptr = ALIGN_MALLOC(size, 4); - context->ind_buf.bo_offset = 0; - out = (GLuint *)context->ind_buf.bo->ptr; - } + assert(context->ind_buf.bo->ptr != NULL); + out = (GLuint *)ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); - for (i = 0; i + 1 < mesa_ind_buf->count; i += 2) + for (i = 0; i + 1 < mesa_ind_buf->count; i += 2) { *out++ = in[i] | in[i + 1] << 16; } - if (i < mesa_ind_buf->count) + if (i < mesa_ind_buf->count) { *out++ = in[i]; } #if MESA_BIG_ENDIAN - } - else + } + else { /* if (mesa_ind_buf->type == GL_UNSIGNED_SHORT) */ GLushort *in = (GLushort *)src_ptr; GLuint size = sizeof(GLushort) * ((mesa_ind_buf->count + 1) & ~1); - if(context->ind_buf.bHostIb != GL_TRUE) - { - radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo, - &context->ind_buf.bo_offset, size, 4); + radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo, + &context->ind_buf.bo_offset, size, 4); - assert(context->ind_buf.bo->ptr != NULL); - out = (GLuint *)ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); - } - else - { - context->ind_buf.bo = MALLOC_STRUCT(radeon_bo); - context->ind_buf.bo->ptr = ALIGN_MALLOC(size, 4); - context->ind_buf.bo_offset = 0; - out = (GLuint *)context->ind_buf.bo->ptr; - } + assert(context->ind_buf.bo->ptr != NULL); + out = (GLuint *)ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); - for (i = 0; i + 1 < mesa_ind_buf->count; i += 2) + for (i = 0; i + 1 < mesa_ind_buf->count; i += 2) { *out++ = in[i] | in[i + 1] << 16; } - if (i < mesa_ind_buf->count) + if (i < mesa_ind_buf->count) { *out++ = in[i]; } @@ -938,7 +882,7 @@ static void r700FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer context->ind_buf.is_32bit = GL_FALSE; context->ind_buf.count = mesa_ind_buf->count; - if (mapped_named_bo) + if (mapped_named_bo) { ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER, mesa_ind_buf->obj); } @@ -953,20 +897,18 @@ static void r700SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer return; } - context->ind_buf.bHostIb = GL_FALSE; - #if MESA_BIG_ENDIAN - if (mesa_ind_buf->type == GL_UNSIGNED_INT) + if (mesa_ind_buf->type == GL_UNSIGNED_INT) { #else - if (mesa_ind_buf->type != GL_UNSIGNED_BYTE) + if (mesa_ind_buf->type != GL_UNSIGNED_BYTE) { #endif const GLvoid *src_ptr; GLvoid *dst_ptr; GLboolean mapped_named_bo = GL_FALSE; - if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer) + if (mesa_ind_buf->obj->Name && !mesa_ind_buf->obj->Pointer) { ctx->Driver.MapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER, GL_READ_ONLY_ARB, mesa_ind_buf->obj); assert(mesa_ind_buf->obj->Pointer != NULL); @@ -977,32 +919,22 @@ static void r700SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer const GLuint size = mesa_ind_buf->count * getTypeSize(mesa_ind_buf->type); - if(context->ind_buf.bHostIb != GL_TRUE) - { - radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo, - &context->ind_buf.bo_offset, size, 4); - assert(context->ind_buf.bo->ptr != NULL); - dst_ptr = ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); - } - else - { - context->ind_buf.bo = MALLOC_STRUCT(radeon_bo); - context->ind_buf.bo->ptr = ALIGN_MALLOC(size, 4); - context->ind_buf.bo_offset = 0; - dst_ptr = context->ind_buf.bo->ptr; - } + radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo, + &context->ind_buf.bo_offset, size, 4); + assert(context->ind_buf.bo->ptr != NULL); + dst_ptr = ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); _mesa_memcpy(dst_ptr, src_ptr, size); context->ind_buf.is_32bit = (mesa_ind_buf->type == GL_UNSIGNED_INT); context->ind_buf.count = mesa_ind_buf->count; - if (mapped_named_bo) + if (mapped_named_bo) { ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER, mesa_ind_buf->obj); } - } - else + } + else { r700FixupIndexBuffer(ctx, mesa_ind_buf); } @@ -1145,7 +1077,7 @@ static void r700DrawPrims(GLcontext *ctx, void r700InitDraw(GLcontext *ctx) { struct vbo_context *vbo = vbo_context(ctx); - + /* to be enabled */ vbo->draw_prims = r700DrawPrims; } -- cgit v1.2.3 From 3d78a86cd777aecce544d14b85177a71e9c142ce Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 1 Oct 2009 18:07:57 -0700 Subject: intel: Remove an unexplained flush from intelClearWithBlit. --- src/mesa/drivers/dri/intel/intel_blit.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index 43141c509c..9e114db6c7 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -371,8 +371,6 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) skipBuffers = BUFFER_BIT_STENCIL; } - /* XXX Move this flush/lock into the following conditional? */ - intelFlush(&intel->ctx); LOCK_HARDWARE(intel); intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off); -- cgit v1.2.3 From f019577f0c2ff83e20bd198a467ddb03579ddae3 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 1 Oct 2009 16:53:12 -0700 Subject: Revert "Flush driver, not just tnl module." This reverts commit df058298e1570eea8712f9bb051f674fab2eaf24. It didn't explain why it was required, doesnt appear to be required, and is a significant performance penalty for cairo-gl firefox. Conflicts: src/mesa/main/fbobject.c --- src/mesa/main/fbobject.c | 26 -------------------------- 1 file changed, 26 deletions(-) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 680fd22ba8..a73a7659ad 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -718,12 +718,6 @@ _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer) } FLUSH_CURRENT(ctx, _NEW_BUFFERS); - /* The above doesn't fully flush the drivers in the way that a - * glFlush does, but that is required here: - */ - if (ctx->Driver.Flush) - ctx->Driver.Flush(ctx); - if (renderbuffer) { newRb = _mesa_lookup_renderbuffer(ctx, renderbuffer); @@ -1294,11 +1288,6 @@ _mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers) ASSERT_OUTSIDE_BEGIN_END(ctx); FLUSH_CURRENT(ctx, _NEW_BUFFERS); - /* The above doesn't fully flush the drivers in the way that a - * glFlush does, but that is required here: - */ - if (ctx->Driver.Flush) - ctx->Driver.Flush(ctx); for (i = 0; i < n; i++) { if (framebuffers[i] > 0) { @@ -1532,11 +1521,6 @@ framebuffer_texture(GLcontext *ctx, const char *caller, GLenum target, } FLUSH_CURRENT(ctx, _NEW_BUFFERS); - /* The above doesn't fully flush the drivers in the way that a - * glFlush does, but that is required here: - */ - if (ctx->Driver.Flush) - ctx->Driver.Flush(ctx); _glthread_LOCK_MUTEX(fb->Mutex); if (texObj) { @@ -1713,11 +1697,6 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment, FLUSH_CURRENT(ctx, _NEW_BUFFERS); - /* The above doesn't fully flush the drivers in the way that a - * glFlush does, but that is required here: - */ - if (ctx->Driver.Flush) - ctx->Driver.Flush(ctx); assert(ctx->Driver.FramebufferRenderbuffer); ctx->Driver.FramebufferRenderbuffer(ctx, fb, attachment, rb); @@ -1794,11 +1773,6 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, } FLUSH_CURRENT(ctx, _NEW_BUFFERS); - /* The above doesn't fully flush the drivers in the way that a - * glFlush does, but that is required here: - */ - if (ctx->Driver.Flush) - ctx->Driver.Flush(ctx); switch (pname) { case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT: -- cgit v1.2.3 From 6d0fc3cfde3dd730de17e925c5594a8b317ba200 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 1 Oct 2009 17:59:05 -0700 Subject: mesa: Remove another unexplained Flush call, this time from BindFramebuffer. Combined with the previous fix, it takes cairo-gl firefox-talos-gfx time from 120 seconds to 90 seconds on my GM45. --- src/mesa/main/fbobject.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index a73a7659ad..6e767bb24d 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1207,9 +1207,6 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) } FLUSH_CURRENT(ctx, _NEW_BUFFERS); - if (ctx->Driver.Flush) { - ctx->Driver.Flush(ctx); - } if (framebuffer) { /* Binding a user-created framebuffer object */ -- cgit v1.2.3 From 4182b58169c1c37833c590d00d0a6a52b2b55326 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 2 Oct 2009 10:53:56 -0700 Subject: i965: Use a little stack space to avoid a malloc in wm_get_binding_table. --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') 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 4f651170c6..9c28a22a29 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -660,7 +660,7 @@ brw_wm_get_binding_table(struct brw_context *brw) if (bind_bo == NULL) { GLuint data_size = brw->wm.nr_surfaces * sizeof(GLuint); - uint32_t *data = malloc(data_size); + uint32_t data[BRW_WM_MAX_SURF]; int i; for (i = 0; i < brw->wm.nr_surfaces; i++) @@ -685,8 +685,6 @@ brw_wm_get_binding_table(struct brw_context *brw) brw->wm.surf_bo[i]); } } - - free(data); } return bind_bo; -- cgit v1.2.3 From be16acaafa2f28bb7d4551ed93d2e290c928006c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 2 Oct 2009 13:59:41 -0600 Subject: mesa: optimized _mesa_meta_BlitFramebuffer() for src=texture case If the src renderbuffer is actually a texture, we can directly use that texture as the src and avoid a copy. --- src/mesa/drivers/common/meta.c | 130 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 20d47dc38b..12e0bdde88 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -1053,6 +1053,124 @@ init_blit_depth_pixels(GLcontext *ctx) } +/** + * Try to do a glBiltFramebuffer using no-copy texturing. + * We can do this when the src renderbuffer is actually a texture. + * But if the src buffer == dst buffer we cannot do this. + * + * \return new buffer mask indicating the buffers left to blit using the + * normal path. + */ +static GLbitfield +blitframebuffer_texture(GLcontext *ctx, + GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, + GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter) +{ + if (mask & GL_COLOR_BUFFER_BIT) { + const struct gl_framebuffer *drawFb = ctx->DrawBuffer; + const struct gl_framebuffer *readFb = ctx->ReadBuffer; + const struct gl_renderbuffer_attachment *drawAtt = + &drawFb->Attachment[drawFb->_ColorDrawBufferIndexes[0]]; + const struct gl_renderbuffer_attachment *readAtt = + &readFb->Attachment[readFb->_ColorReadBufferIndex]; + + if (readAtt && readAtt->Texture) { + const struct gl_texture_object *texObj = readAtt->Texture; + const GLenum minFilterSave = texObj->MinFilter; + const GLenum magFilterSave = texObj->MagFilter; + const GLenum target = texObj->Target; + + if (drawAtt->Texture == readAtt->Texture) { + /* Can't use same texture as both the source and dest. We need + * to handle overlapping blits and besides, some hw may not + * support this. + */ + return mask; + } + + if (target != GL_TEXTURE_2D && target != GL_TEXTURE_RECTANGLE_ARB) { + /* Can't handle other texture types at this time */ + return mask; + } + + /* + printf("Blit from texture!\n"); + printf(" srcAtt %p dstAtt %p\n", readAtt, drawAtt); + printf(" srcTex %p dstText %p\n", texObj, drawAtt->Texture); + */ + + /* Prepare src texture state */ + _mesa_BindTexture(target, texObj->Name); + _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, filter); + _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, filter); + _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + /*_mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE, GL_FALSE);*/ + _mesa_set_enable(ctx, target, GL_TRUE); + + /* Prepare vertex data (the VBO was previously created and bound) */ + { + struct vertex { + GLfloat x, y, s, t; + }; + struct vertex verts[4]; + GLfloat s0, t0, s1, t1; + + if (target == GL_TEXTURE_2D) { + const struct gl_texture_image *texImage + = _mesa_select_tex_image(ctx, texObj, target, + readAtt->TextureLevel); + s0 = srcX0 / (float) texImage->Width; + s1 = srcX1 / (float) texImage->Width; + t0 = srcY0 / (float) texImage->Height; + t1 = srcY1 / (float) texImage->Height; + } + else { + assert(target == GL_TEXTURE_RECTANGLE_ARB); + s0 = srcX0; + s1 = srcX1; + t0 = srcY0; + t1 = srcY1; + } + + verts[0].x = (GLfloat) dstX0; + verts[0].y = (GLfloat) dstY0; + verts[1].x = (GLfloat) dstX1; + verts[1].y = (GLfloat) dstY0; + verts[2].x = (GLfloat) dstX1; + verts[2].y = (GLfloat) dstY1; + verts[3].x = (GLfloat) dstX0; + verts[3].y = (GLfloat) dstY1; + + verts[0].s = s0; + verts[0].t = t0; + verts[1].s = s1; + verts[1].t = t0; + verts[2].s = s1; + verts[2].t = t1; + verts[3].s = s0; + verts[3].t = t1; + + _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts); + } + + _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); + + /* Restore texture's filter state, the texture binding will + * be restored by _mesa_meta_end(). + */ + _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilterSave); + _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, magFilterSave); + + /* Done with color buffer */ + mask &= ~GL_COLOR_BUFFER_BIT; + } + } + + return mask; +} + + /** * Meta implementation of ctx->Driver.BlitFramebuffer() in terms * of texture mapping and polygon rendering. @@ -1124,6 +1242,18 @@ _mesa_meta_BlitFramebuffer(GLcontext *ctx, _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, blit->VBO); } + /* Try faster, direct texture approach first */ + mask = blitframebuffer_texture(ctx, srcX0, srcY0, srcX1, srcY1, + dstX0, dstY0, dstX1, dstY1, mask, filter); + if (mask == 0x0) { + _mesa_meta_end(ctx); + return; + } + + /* Continue with "normal" approach which involves copying the src rect + * into a temporary texture and is "blitted" by drawing a textured quad. + */ + newTex = alloc_texture(tex, srcW, srcH, GL_RGBA); /* vertex positions/texcoords (after texture allocation!) */ -- cgit v1.2.3 From bbe384c86afeaf5995cddd286a76e1fd789e18f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sat, 3 Oct 2009 01:26:38 +0200 Subject: r300: Workaround problem on R500 with very large fragment programs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The non-KMS interface is to blame here. In theory, a proper fix could be produced that works for the KMS interface only, but it require cleaning a lot of mess. Easier to just do it right in r300g. Signed-off-by: Nicolai Hähnle --- src/mesa/drivers/dri/r300/r300_context.c | 20 +++++++++++++++----- src/mesa/drivers/dri/r300/r300_fragprog_common.c | 13 +++++++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 2ea1b826de..9df3897e65 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -374,11 +374,21 @@ static void r300InitConstValues(GLcontext *ctx, radeonScreenPtr screen) if (screen->chip_family >= CHIP_FAMILY_RV515) { ctx->Const.FragmentProgram.MaxNativeTemps = R500_PFS_NUM_TEMP_REGS; ctx->Const.FragmentProgram.MaxNativeAttribs = 11; /* copy i915... */ - ctx->Const.FragmentProgram.MaxNativeParameters = R500_PFS_NUM_CONST_REGS; - ctx->Const.FragmentProgram.MaxNativeAluInstructions = R500_PFS_MAX_INST; - ctx->Const.FragmentProgram.MaxNativeTexInstructions = R500_PFS_MAX_INST; - ctx->Const.FragmentProgram.MaxNativeInstructions = R500_PFS_MAX_INST; - ctx->Const.FragmentProgram.MaxNativeTexIndirections = R500_PFS_MAX_INST; + + /* The hardware limits are higher than this, + * but the non-KMS DRM interface artificially limits us + * to this many instructions. + * + * We could of course work around it in the KMS path, + * but it would be a mess, so it seems wiser + * to leave it as is. Going forward, the Gallium driver + * will not be subject to these limitations. + */ + ctx->Const.FragmentProgram.MaxNativeParameters = 255; + ctx->Const.FragmentProgram.MaxNativeAluInstructions = 255; + ctx->Const.FragmentProgram.MaxNativeTexInstructions = 255; + ctx->Const.FragmentProgram.MaxNativeInstructions = 255; + ctx->Const.FragmentProgram.MaxNativeTexIndirections = 255; ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; } else { ctx->Const.FragmentProgram.MaxNativeTemps = R300_PFS_NUM_TEMP_REGS; diff --git a/src/mesa/drivers/dri/r300/r300_fragprog_common.c b/src/mesa/drivers/dri/r300/r300_fragprog_common.c index 0bdc90b4a8..70c9252894 100644 --- a/src/mesa/drivers/dri/r300/r300_fragprog_common.c +++ b/src/mesa/drivers/dri/r300/r300_fragprog_common.c @@ -239,6 +239,19 @@ static void translate_fragment_program(GLcontext *ctx, struct r300_fragment_prog rewriteFog(&compiler, fp); r3xx_compile_fragment_program(&compiler); + + if (compiler.is_r500) { + /* We need to support the non-KMS DRM interface, which + * artificially limits the number of instructions and + * constants which are available to us. + * + * See also the comment in r300_context.c where we + * set the MAX_NATIVE_xxx values. + */ + if (fp->code.code.r500.inst_end >= 255 || fp->code.constants.Count > 255) + rc_error(&compiler.Base, "Program is too big (upgrade to r300g to avoid this limitation).\n"); + } + fp->error = compiler.Base.Error; fp->InputsRead = compiler.Base.Program.InputsRead; -- cgit v1.2.3 From ebbd65eb0658adcb797e0788a3472a7b69b3bfc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sat, 3 Oct 2009 02:11:02 +0200 Subject: st/dri: Install ARB_vertex_array_object functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle --- src/gallium/state_trackers/dri/dri_extensions.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/dri/dri_extensions.c b/src/gallium/state_trackers/dri/dri_extensions.c index 4349a4d1d2..8c5cef68d3 100644 --- a/src/gallium/state_trackers/dri/dri_extensions.c +++ b/src/gallium/state_trackers/dri/dri_extensions.c @@ -39,6 +39,7 @@ #define need_GL_ARB_point_parameters #define need_GL_ARB_shader_objects #define need_GL_ARB_texture_compression +#define need_GL_ARB_vertex_array_object #define need_GL_ARB_vertex_buffer_object #define need_GL_ARB_vertex_program #define need_GL_ARB_vertex_shader @@ -79,6 +80,7 @@ const struct dri_extension card_extensions[] = { {"GL_ARB_texture_env_dot3", NULL}, {"GL_ARB_texture_mirrored_repeat", NULL}, {"GL_ARB_texture_rectangle", NULL}, + {"GL_ARB_vertex_array_object", GL_ARB_vertex_array_object_functions}, {"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions}, {"GL_ARB_vertex_shader", GL_ARB_vertex_shader_functions}, {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions}, -- cgit v1.2.3 From 751aa58e01bd2b4f35aa0e1477d77a0dc5490f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sat, 3 Oct 2009 17:24:04 +0200 Subject: r300g: Reset vbo_offset after allocation of a new buffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes the glxgears bug, among other things. Signed-off-by: Nicolai Hähnle --- src/gallium/drivers/r300/r300_render.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 16f6404012..69d162324a 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -79,13 +79,14 @@ static boolean r300_render_allocate_vertices(struct vbuf_render* render, struct pipe_screen* screen = r300->context.screen; size_t size = (size_t)vertex_size * (size_t)count; - if (size + r300render->vbo_offset > r300render->vbo_size) + if (size + r300render->vbo_offset > r300render->vbo_size) { pipe_buffer_reference(&r300->vbo, NULL); r300render->vbo = pipe_buffer_create(screen, 64, PIPE_BUFFER_USAGE_VERTEX, R300_MAX_VBO_SIZE); + r300render->vbo_offset = 0; r300render->vbo_size = R300_MAX_VBO_SIZE; } @@ -118,7 +119,7 @@ static void r300_render_unmap_vertices(struct vbuf_render* render, OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, max); END_CS; - r300render->vbo_max_used = MAX2(r300render->vbo_max_used, + r300render->vbo_max_used = MAX2(r300render->vbo_max_used, r300render->vertex_size * (max + 1)); pipe_buffer_unmap(screen, r300render->vbo); } -- cgit v1.2.3 From fce2095a90440d1c129583fb8b6c26a93d4bde13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sat, 3 Oct 2009 17:39:32 +0200 Subject: st/dri: Install APPLE_vertex_array_object functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Besides from being necessary to use that extension, it also fixes a crash when deleting the currently bound vertex array object. Signed-off-by: Nicolai Hähnle --- src/gallium/state_trackers/dri/dri_extensions.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/dri/dri_extensions.c b/src/gallium/state_trackers/dri/dri_extensions.c index 8c5cef68d3..f39a305531 100644 --- a/src/gallium/state_trackers/dri/dri_extensions.c +++ b/src/gallium/state_trackers/dri/dri_extensions.c @@ -53,6 +53,7 @@ #define need_GL_EXT_framebuffer_object #define need_GL_EXT_multi_draw_arrays #define need_GL_EXT_secondary_color +#define need_GL_APPLE_vertex_array_object #define need_GL_NV_vertex_program #define need_GL_VERSION_2_0 #define need_GL_VERSION_2_1 @@ -105,6 +106,7 @@ const struct dri_extension card_extensions[] = { {"GL_EXT_texture_lod_bias", NULL}, {"GL_3DFX_texture_compression_FXT1", NULL}, {"GL_APPLE_client_storage", NULL}, + {"GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions}, {"GL_MESA_pack_invert", NULL}, {"GL_MESA_ycbcr_texture", NULL}, {"GL_NV_blend_square", NULL}, -- cgit v1.2.3 From 26df8af4fe4173eb52132dc63ee789b80a7a4db2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sat, 3 Oct 2009 17:49:16 +0200 Subject: r300g: Remove an unnecessarily created pipe buffer (and thus fix a leak) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle --- src/gallium/drivers/r300/r300_render.c | 7 ------- 1 file changed, 7 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 69d162324a..ca44e0f661 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -223,13 +223,6 @@ static void r300_render_draw(struct vbuf_render* render, r300_prepare_render(r300render, count); - /* Send our indices into an index buffer. */ - index_buffer = pipe_buffer_create(screen, 64, PIPE_BUFFER_USAGE_VERTEX, - count * 2); - if (!index_buffer) { - return; - } - BEGIN_CS(2 + (count+1)/2); OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, (count+1)/2); OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (count << 16) | -- cgit v1.2.3 From 4a6759b7789dc703a8ee9f1cf08af22c6e8101fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Sat, 3 Oct 2009 18:01:57 +0200 Subject: meta: Make sure texImage->TexFormat is valid for CopyTex(Sub)Image. --- src/mesa/drivers/common/meta.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 12e0bdde88..e1732241b3 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -55,6 +55,7 @@ #include "main/stencil.h" #include "main/texobj.h" #include "main/texenv.h" +#include "main/texformat.h" #include "main/teximage.h" #include "main/texparam.h" #include "main/texstate.h" @@ -2471,6 +2472,12 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, return; } + if (texImage->TexFormat == &_mesa_null_texformat) + texImage->TexFormat = ctx->Driver.ChooseTextureFormat(ctx, + internalFormat, + format, + type); + _mesa_unlock_texture(ctx, texObj); /* need to unlock first */ /* -- cgit v1.2.3 From f741c1eed4559329a89fbf8da569889bbcdace26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Sat, 3 Oct 2009 18:01:58 +0200 Subject: swrast: Move up state validation in _swrast_ReadPixels. This ensures the driver won't map the wrong set of textures. --- src/mesa/swrast/s_readpix.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index 48b9408d24..a1aeb2e01f 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -555,15 +555,15 @@ _swrast_ReadPixels( GLcontext *ctx, SWcontext *swrast = SWRAST_CONTEXT(ctx); struct gl_pixelstore_attrib clippedPacking = *packing; + if (ctx->NewState) + _mesa_update_state(ctx); + /* Need to do swrast_render_start() before clipping or anything else * since this is where a driver may grab the hw lock and get an updated * window size. */ swrast_render_start(ctx); - if (ctx->NewState) - _mesa_update_state(ctx); - if (swrast->NewState) _swrast_validate_derived( ctx ); -- cgit v1.2.3 From b330cebe01c5574e203fa6b9d49fee4c01e1adb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Sat, 3 Oct 2009 18:01:58 +0200 Subject: radeon: Cope better with texture images with no miptrees. Fixes crash with compiz magnifier plugin. --- src/mesa/drivers/dri/radeon/radeon_texture.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 049284ef8c..7b7392b217 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -101,7 +101,12 @@ void radeonFreeTexImageData(GLcontext *ctx, struct gl_texture_image *timage) /* Set Data pointer and additional data for mapped texture image */ static void teximage_set_map_data(radeon_texture_image *image) { - radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel]; + radeon_mipmap_level *lvl; + + if (!image->mt) + return; + + lvl = &image->mt->levels[image->mtlevel]; image->base.Data = image->mt->bo->ptr + lvl->faces[image->mtface].offset; image->base.RowStride = lvl->rowstride / image->mt->bpp; @@ -969,7 +974,7 @@ int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *t radeon_texture_image *image = get_radeon_texture_image(texObj->Image[face][level]); if (RADEON_DEBUG & RADEON_TEXTURE) fprintf(stderr, " face %i, level %i... %p vs %p ", face, level, t->mt, image->mt); - if (t->mt == image->mt) { + if (t->mt == image->mt || (!image->mt && !image->base.Data)) { if (RADEON_DEBUG & RADEON_TEXTURE) fprintf(stderr, "OK\n"); -- cgit v1.2.3 From aa6aa77a1be91022933975dbccf8f2aabc584baa Mon Sep 17 00:00:00 2001 From: Sedat Dilek Date: Sat, 3 Oct 2009 18:01:58 +0200 Subject: r300g: Build in the trace and softpipe driver for xorg state tracker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Same as in src/gallium/winsys/drm/intel/xorg/Makefile Thanks MrCooper for explanations on IRC [ Summary amended by Michel Dänzer to clarify that this is related to the xorg state tracker ] --- src/gallium/winsys/drm/radeon/xorg/Makefile | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/winsys/drm/radeon/xorg/Makefile b/src/gallium/winsys/drm/radeon/xorg/Makefile index 0241625f69..9fa16dab24 100644 --- a/src/gallium/winsys/drm/radeon/xorg/Makefile +++ b/src/gallium/winsys/drm/radeon/xorg/Makefile @@ -20,6 +20,8 @@ LIBS = \ $(GALLIUMDIR)/state_trackers/xorg/libxorgtracker.a \ $(GALLIUMDIR)/winsys/drm/radeon/core/libradeonwinsys.a \ $(TOP)/src/gallium/drivers/r300/libr300.a \ + $(TOP)/src/gallium/drivers/trace/libtrace.a \ + $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ $(GALLIUM_AUXILIARIES) ############################################# -- cgit v1.2.3 From 59b20b760d63dad15d4d62a43bae8b7e26085c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sat, 3 Oct 2009 17:56:51 +0200 Subject: r300g: Fix memory leak in radeon_texture_from_shared_handle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle --- src/gallium/winsys/drm/radeon/core/radeon_drm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c index a4011db0b8..caab33de1c 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c @@ -107,13 +107,18 @@ radeon_texture_from_shared_handle(struct drm_api *api, unsigned handle) { struct pipe_buffer *buffer; + struct pipe_texture *blanket; buffer = radeon_buffer_from_handle(api, screen, name, handle); if (!buffer) { return NULL; } - return screen->texture_blanket(screen, templ, &stride, buffer); + blanket = screen->texture_blanket(screen, templ, &stride, buffer); + + pipe_buffer_reference(&buffer, NULL); + + return blanket; } static boolean radeon_shared_handle_from_texture(struct drm_api *api, -- cgit v1.2.3 From 81e5188f66248424d54fcf1d85a81510694bd472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sat, 3 Oct 2009 19:20:31 +0200 Subject: r300g: Do not abort on fragment program compiler error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle --- src/gallium/drivers/r300/r300_fs.c | 11 ++++++++--- src/gallium/drivers/r300/r300_fs.h | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c index a0e848a59a..546ad545a5 100644 --- a/src/gallium/drivers/r300/r300_fs.c +++ b/src/gallium/drivers/r300/r300_fs.c @@ -126,9 +126,14 @@ void r300_translate_fragment_shader(struct r300_context* r300, /* Invoke the compiler */ r3xx_compile_fragment_program(&compiler); if (compiler.Base.Error) { - /* Todo: Fail gracefully */ - fprintf(stderr, "r300 FP: Compiler error\n"); - abort(); + /* Todo: Fallback to software rendering gracefully? */ + fprintf(stderr, "r300 FP: Compiler error: %s\n", compiler.Base.ErrorMsg); + + if (compiler.is_r500) { + memcpy(compiler.code, &r5xx_passthrough_fragment_shader, sizeof(r5xx_passthrough_fragment_shader)); + } else { + memcpy(compiler.code, &r3xx_passthrough_fragment_shader, sizeof(r3xx_passthrough_fragment_shader)); + } } /* And, finally... */ diff --git a/src/gallium/drivers/r300/r300_fs.h b/src/gallium/drivers/r300/r300_fs.h index 9fab789402..967e9f697e 100644 --- a/src/gallium/drivers/r300/r300_fs.h +++ b/src/gallium/drivers/r300/r300_fs.h @@ -48,4 +48,4 @@ struct r300_fragment_shader { void r300_translate_fragment_shader(struct r300_context* r300, struct r300_fragment_shader* fs); - #endif /* R300_FS_H */ +#endif /* R300_FS_H */ -- cgit v1.2.3 From 7d2699aedc084d9cb9c2bd2f8bdb5f038271ac1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sat, 3 Oct 2009 16:18:57 +0200 Subject: prog_parameter: Document the fact that Size may be > 4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle --- src/mesa/shader/prog_parameter.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/prog_parameter.h b/src/mesa/shader/prog_parameter.h index d1fcf47e61..699cb0c735 100644 --- a/src/mesa/shader/prog_parameter.h +++ b/src/mesa/shader/prog_parameter.h @@ -56,7 +56,13 @@ struct gl_program_parameter const char *Name; /**< Null-terminated string */ gl_register_file Type; /**< PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */ GLenum DataType; /**< GL_FLOAT, GL_FLOAT_VEC2, etc */ - GLuint Size; /**< Number of components (1..4) */ + /** + * Number of components (1..4), or more. + * If the number of components is greater than 4, + * this parameter is part of a larger uniform like a GLSL matrix or array. + * The next program parameter's Size will be Size-4 of this parameter. + */ + GLuint Size; GLboolean Used; /**< Helper flag for GLSL uniform tracking */ GLboolean Initialized; /**< Has the ParameterValue[] been set? */ GLbitfield Flags; /**< Bitmask of PROG_PARAM_*_BIT */ -- cgit v1.2.3 From cbb57bf726619a34a244acaebf0dcd77750cba54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sat, 3 Oct 2009 19:42:22 +0100 Subject: llvmpipe: Fetch tile only if a color buffer is bound. --- src/gallium/drivers/llvmpipe/lp_setup.c | 10 ++++++++-- src/gallium/drivers/llvmpipe/lp_tile_cache.c | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 2d2fc19a65..60107214df 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -124,7 +124,7 @@ shade_quads(struct llvmpipe_context *llvmpipe, struct quad_header *quad = quads[0]; const unsigned x = quad->input.x0; const unsigned y = quad->input.y0; - uint8_t *tile = lp_get_cached_tile(llvmpipe->cbuf_cache[0], x, y); + uint8_t *tile; uint8_t *color; void *depth; uint32_t ALIGN16_ATTRIB mask[4][NUM_CHANNELS]; @@ -150,7 +150,13 @@ shade_quads(struct llvmpipe_context *llvmpipe, mask[q][chan_index] = quads[q]->inout.mask & (1 << chan_index) ? ~0 : 0; /* color buffer */ - color = &TILE_PIXEL(tile, x & (TILE_SIZE-1), y & (TILE_SIZE-1), 0); + if(llvmpipe->framebuffer.nr_cbufs >= 1 && + llvmpipe->framebuffer.cbufs[0]) { + tile = lp_get_cached_tile(llvmpipe->cbuf_cache[0], x, y); + color = &TILE_PIXEL(tile, x & (TILE_SIZE-1), y & (TILE_SIZE-1), 0); + } + else + color = NULL; /* depth buffer */ if(llvmpipe->zsbuf_map) { diff --git a/src/gallium/drivers/llvmpipe/lp_tile_cache.c b/src/gallium/drivers/llvmpipe/lp_tile_cache.c index 0c06b659a1..2ac8cb5c82 100644 --- a/src/gallium/drivers/llvmpipe/lp_tile_cache.c +++ b/src/gallium/drivers/llvmpipe/lp_tile_cache.c @@ -294,6 +294,9 @@ lp_get_cached_tile(struct llvmpipe_tile_cache *tc, struct llvmpipe_cached_tile *tile = &tc->entries[y/TILE_SIZE][x/TILE_SIZE]; struct pipe_transfer *pt = tc->transfer; + assert(tc->surface); + assert(tc->transfer); + switch(tile->status) { case LP_TILE_STATUS_CLEAR: /* don't get tile from framebuffer, just clear it */ -- cgit v1.2.3 From b7cf887ca74561469c144f1d12227e1bcf277e7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sat, 3 Oct 2009 21:28:59 +0200 Subject: r300/compiler: Introduce control flow instructions and refactor dataflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Note that control flow instruction support isn't actually fully functional yet. Signed-off-by: Nicolai Hähnle --- src/gallium/drivers/r300/r300_tgsi_to_rc.c | 6 +- src/mesa/drivers/dri/r300/compiler/Makefile | 3 +- src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c | 15 +- src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c | 18 +- .../drivers/dri/r300/compiler/radeon_dataflow.c | 74 ----- .../drivers/dri/r300/compiler/radeon_dataflow.h | 69 +--- .../dri/r300/compiler/radeon_dataflow_annotate.c | 365 --------------------- .../dri/r300/compiler/radeon_dataflow_deadcode.c | 253 ++++++++++++++ .../dri/r300/compiler/radeon_dataflow_dealias.c | 150 --------- .../dri/r300/compiler/radeon_dataflow_swizzles.c | 24 -- .../drivers/dri/r300/compiler/radeon_opcodes.c | 78 +++++ .../drivers/dri/r300/compiler/radeon_opcodes.h | 20 ++ .../drivers/dri/r300/compiler/radeon_program.c | 19 +- .../drivers/dri/r300/compiler/radeon_program.h | 71 ++-- .../dri/r300/compiler/radeon_program_print.c | 48 +-- 15 files changed, 434 insertions(+), 779 deletions(-) delete mode 100644 src/mesa/drivers/dri/r300/compiler/radeon_dataflow_annotate.c create mode 100644 src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c delete mode 100644 src/mesa/drivers/dri/r300/compiler/radeon_dataflow_dealias.c (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/src/gallium/drivers/r300/r300_tgsi_to_rc.c index 7f12008830..1246ffe8c2 100644 --- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c +++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c @@ -106,11 +106,11 @@ static unsigned translate_opcode(unsigned opcode) /* case TGSI_OPCODE_DP2: return RC_OPCODE_DP2; */ case TGSI_OPCODE_TXL: return RC_OPCODE_TXL; /* case TGSI_OPCODE_BRK: return RC_OPCODE_BRK; */ - /* case TGSI_OPCODE_IF: return RC_OPCODE_IF; */ + case TGSI_OPCODE_IF: return RC_OPCODE_IF; /* case TGSI_OPCODE_LOOP: return RC_OPCODE_LOOP; */ /* case TGSI_OPCODE_REP: return RC_OPCODE_REP; */ - /* case TGSI_OPCODE_ELSE: return RC_OPCODE_ELSE; */ - /* case TGSI_OPCODE_ENDIF: return RC_OPCODE_ENDIF; */ + case TGSI_OPCODE_ELSE: return RC_OPCODE_ELSE; + case TGSI_OPCODE_ENDIF: return RC_OPCODE_ENDIF; /* case TGSI_OPCODE_ENDLOOP: return RC_OPCODE_ENDLOOP; */ /* case TGSI_OPCODE_ENDREP: return RC_OPCODE_ENDREP; */ /* case TGSI_OPCODE_PUSHA: return RC_OPCODE_PUSHA; */ diff --git a/src/mesa/drivers/dri/r300/compiler/Makefile b/src/mesa/drivers/dri/r300/compiler/Makefile index 53fb7caa95..0d8dcb9f87 100644 --- a/src/mesa/drivers/dri/r300/compiler/Makefile +++ b/src/mesa/drivers/dri/r300/compiler/Makefile @@ -14,8 +14,7 @@ C_SOURCES = \ radeon_program_alu.c \ radeon_program_pair.c \ radeon_dataflow.c \ - radeon_dataflow_annotate.c \ - radeon_dataflow_dealias.c \ + radeon_dataflow_deadcode.c \ radeon_dataflow_swizzles.c \ r3xx_fragprog.c \ r300_fragprog.c \ diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c index bf9bea685a..590201a9ba 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c @@ -24,6 +24,7 @@ #include +#include "radeon_dataflow.h" #include "radeon_program_alu.h" #include "r300_fragprog.h" #include "r300_fragprog_swizzle.h" @@ -107,17 +108,23 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) if (c->Base.Debug) { fprintf(stderr, "Fragment Program: After native rewrite:\n"); - rc_print_program(&c->Base.Program, 0); + rc_print_program(&c->Base.Program); + fflush(stderr); + } + + rc_dataflow_deadcode(&c->Base, &dataflow_outputs_mark_use, c); + + if (c->Base.Debug) { + fprintf(stderr, "Fragment Program: After deadcode:\n"); + rc_print_program(&c->Base.Program); fflush(stderr); } - rc_dataflow_annotate(&c->Base, &dataflow_outputs_mark_use, c); - rc_dataflow_dealias(&c->Base); rc_dataflow_swizzles(&c->Base); if (c->Base.Debug) { fprintf(stderr, "Compiler: after dataflow passes:\n"); - rc_print_program(&c->Base.Program, 0); + rc_print_program(&c->Base.Program); fflush(stderr); } diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c index ac72f8cbb6..e1e735568d 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c @@ -588,7 +588,7 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler* compiler) if (compiler->Base.Debug) { fprintf(stderr, "Vertex program after native rewrite:\n"); - rc_print_program(&compiler->Base.Program, 0); + rc_print_program(&compiler->Base.Program); fflush(stderr); } @@ -605,21 +605,25 @@ void r3xx_compile_vertex_program(struct r300_vertex_program_compiler* compiler) if (compiler->Base.Debug) { fprintf(stderr, "Vertex program after source conflict resolve:\n"); - rc_print_program(&compiler->Base.Program, 0); + rc_print_program(&compiler->Base.Program); + fflush(stderr); + } + + rc_dataflow_deadcode(&compiler->Base, &dataflow_outputs_mark_used, compiler); + + if (compiler->Base.Debug) { + fprintf(stderr, "Vertex program after deadcode:\n"); + rc_print_program(&compiler->Base.Program); fflush(stderr); } - rc_dataflow_annotate(&compiler->Base, &dataflow_outputs_mark_used, compiler); - rc_dataflow_dealias(&compiler->Base); rc_dataflow_swizzles(&compiler->Base); - /* This invalidates dataflow annotations and should be replaced - * by a future generic register allocation pass. */ allocate_temporary_registers(compiler); if (compiler->Base.Debug) { fprintf(stderr, "Vertex program after dataflow:\n"); - rc_print_program(&compiler->Base.Program, 0); + rc_print_program(&compiler->Base.Program); fflush(stderr); } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c index af6777a7bd..a171d8ab54 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c @@ -30,77 +30,3 @@ #include "radeon_compiler.h" -static void add_ref_to_vector(struct rc_dataflow_ref * ref, struct rc_dataflow_vector * vector) -{ - ref->Vector = vector; - ref->Prev = &vector->Refs; - ref->Next = vector->Refs.Next; - ref->Prev->Next = ref; - ref->Next->Prev = ref; -} - -struct rc_dataflow_ref * rc_dataflow_create_ref(struct radeon_compiler * c, - struct rc_dataflow_vector * vector, struct rc_instruction * inst) -{ - struct rc_dataflow_ref * ref = memory_pool_malloc(&c->Pool, sizeof(struct rc_dataflow_ref)); - ref->ReadInstruction = inst; - ref->UseMask = 0; - - add_ref_to_vector(ref, vector); - - return ref; -} - -struct rc_dataflow_vector * rc_dataflow_create_vector(struct radeon_compiler * c, - rc_register_file file, unsigned int index, struct rc_instruction * inst) -{ - struct rc_dataflow_vector * vec = memory_pool_malloc(&c->Pool, sizeof(struct rc_dataflow_vector)); - - memset(vec, 0, sizeof(struct rc_dataflow_vector)); - vec->File = file; - vec->Index = index; - vec->WriteInstruction = inst; - - vec->Refs.Next = vec->Refs.Prev = &vec->Refs; - - return vec; -} - -void rc_dataflow_remove_ref(struct rc_dataflow_ref * ref) -{ - ref->Prev->Next = ref->Next; - ref->Next->Prev = ref->Prev; -} - -void rc_dataflow_remove_instruction(struct rc_instruction * inst) -{ - for(unsigned int i = 0; i < 3; ++i) { - if (inst->Dataflow.SrcReg[i]) { - rc_dataflow_remove_ref(inst->Dataflow.SrcReg[i]); - inst->Dataflow.SrcReg[i] = 0; - } - if (inst->Dataflow.SrcRegAddress[i]) { - rc_dataflow_remove_ref(inst->Dataflow.SrcRegAddress[i]); - inst->Dataflow.SrcRegAddress[i] = 0; - } - } - - if (inst->Dataflow.DstReg) { - while(inst->Dataflow.DstReg->Refs.Next != &inst->Dataflow.DstReg->Refs) { - struct rc_dataflow_ref * ref = inst->Dataflow.DstReg->Refs.Next; - rc_dataflow_remove_ref(ref); - if (inst->Dataflow.DstRegPrev) - add_ref_to_vector(ref, inst->Dataflow.DstRegPrev->Vector); - } - - inst->Dataflow.DstReg->WriteInstruction = 0; - inst->Dataflow.DstReg = 0; - } - - if (inst->Dataflow.DstRegPrev) { - rc_dataflow_remove_ref(inst->Dataflow.DstRegPrev); - inst->Dataflow.DstRegPrev = 0; - } - - inst->Dataflow.DstRegAliased = 0; -} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h index c9856affe8..76c323d057 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h @@ -34,79 +34,14 @@ struct radeon_compiler; struct rc_instruction; struct rc_swizzle_caps; -struct rc_dataflow_vector; - -struct rc_dataflow_ref { - struct rc_dataflow_vector * Vector; - - /** - * Linked list of references to the above-mentioned vector. - * The linked list is \em not sorted. - */ - /*@{*/ - struct rc_dataflow_ref * Prev; - struct rc_dataflow_ref * Next; - /*@}*/ - - unsigned int UseMask:4; - struct rc_instruction * ReadInstruction; -}; - -struct rc_dataflow_vector { - rc_register_file File:3; - unsigned int Index:RC_REGISTER_INDEX_BITS; - - /** For private use in compiler passes. MUST BE RESET TO 0 by the end of each pass. - * The annotate pass uses this bit to track whether a vector is in the - * update stack. - */ - unsigned int PassBit:1; - /** Which of the components have been written with useful values */ - unsigned int ValidMask:4; - /** Which of the components are used downstream */ - unsigned int UseMask:4; - /** The instruction that produced this vector */ - struct rc_instruction * WriteInstruction; - - /** Linked list of references to this vector */ - struct rc_dataflow_ref Refs; -}; - -struct rc_instruction_dataflow { - struct rc_dataflow_ref * SrcReg[3]; - struct rc_dataflow_ref * SrcRegAddress[3]; - - /** Reference the components of the destination register - * that are carried over without being overwritten */ - struct rc_dataflow_ref * DstRegPrev; - /** Indicates whether the destination register was in use - * before this instruction */ - unsigned int DstRegAliased:1; - struct rc_dataflow_vector * DstReg; -}; - -/** - * General functions for manipulating the dataflow structures. - */ -/*@{*/ -struct rc_dataflow_ref * rc_dataflow_create_ref(struct radeon_compiler * c, - struct rc_dataflow_vector * vector, struct rc_instruction * inst); -struct rc_dataflow_vector * rc_dataflow_create_vector(struct radeon_compiler * c, - rc_register_file file, unsigned int index, struct rc_instruction * inst); -void rc_dataflow_remove_ref(struct rc_dataflow_ref * ref); - -void rc_dataflow_remove_instruction(struct rc_instruction * inst); -/*@}*/ - /** - * Compiler passes based on dataflow structures. + * Compiler passes based on dataflow analysis. */ /*@{*/ typedef void (*rc_dataflow_mark_outputs_fn)(void * userdata, void * data, void (*mark_fn)(void * data, unsigned int index, unsigned int mask)); -void rc_dataflow_annotate(struct radeon_compiler * c, rc_dataflow_mark_outputs_fn dce, void * userdata); -void rc_dataflow_dealias(struct radeon_compiler * c); +void rc_dataflow_deadcode(struct radeon_compiler * c, rc_dataflow_mark_outputs_fn dce, void * userdata); void rc_dataflow_swizzles(struct radeon_compiler * c); /*@}*/ diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_annotate.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_annotate.c deleted file mode 100644 index 41d175a22f..0000000000 --- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_annotate.c +++ /dev/null @@ -1,365 +0,0 @@ -/* - * Copyright (C) 2009 Nicolai Haehnle. - * - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 "radeon_dataflow.h" - -#include "radeon_compiler.h" - - -struct dataflow_state { - struct radeon_compiler * C; - unsigned int DCE:1; - unsigned int UpdateRunning:1; - - struct rc_dataflow_vector * Input[RC_REGISTER_MAX_INDEX]; - struct rc_dataflow_vector * Output[RC_REGISTER_MAX_INDEX]; - struct rc_dataflow_vector * Temporary[RC_REGISTER_MAX_INDEX]; - struct rc_dataflow_vector * Address; - - struct rc_dataflow_vector ** UpdateStack; - unsigned int UpdateStackSize; - unsigned int UpdateStackReserved; -}; - -static void mark_vector_use(struct dataflow_state * s, struct rc_dataflow_vector * vector, unsigned int mask); - -static struct rc_dataflow_vector * get_register_contents(struct dataflow_state * s, - rc_register_file file, unsigned int index) -{ - if (file == RC_FILE_INPUT || file == RC_FILE_OUTPUT || file == RC_FILE_TEMPORARY) { - if (index >= RC_REGISTER_MAX_INDEX) - return 0; /* cannot happen, but be defensive */ - - if (file == RC_FILE_TEMPORARY) - return s->Temporary[index]; - if (file == RC_FILE_INPUT) - return s->Input[index]; - if (file == RC_FILE_OUTPUT) - return s->Output[index]; - } - - if (file == RC_FILE_ADDRESS) - return s->Address; - - return 0; /* can happen, constant register file */ -} - -static void mark_ref_use(struct dataflow_state * s, struct rc_dataflow_ref * ref, unsigned int mask) -{ - if (!(mask & ~ref->UseMask)) - return; - - ref->UseMask |= mask; - mark_vector_use(s, ref->Vector, ref->UseMask); -} - -static void mark_source_use(struct dataflow_state * s, struct rc_instruction * inst, - unsigned int src, unsigned int srcmask) -{ - unsigned int refmask = 0; - - for(unsigned int i = 0; i < 4; ++i) { - if (GET_BIT(srcmask, i)) - refmask |= 1 << GET_SWZ(inst->I.SrcReg[src].Swizzle, i); - } - - /* get rid of spurious bits from ZERO, ONE, etc. swizzles */ - refmask &= RC_MASK_XYZW; - - if (!refmask) - return; /* can happen if the swizzle contains constant components */ - - if (inst->Dataflow.SrcReg[src]) - mark_ref_use(s, inst->Dataflow.SrcReg[src], refmask); - - if (inst->Dataflow.SrcRegAddress[src]) - mark_ref_use(s, inst->Dataflow.SrcRegAddress[src], RC_MASK_X); -} - -static void compute_sources_for_writemask( - struct rc_instruction * inst, - unsigned int writemask, - unsigned int *srcmasks) -{ - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); - - srcmasks[0] = 0; - srcmasks[1] = 0; - srcmasks[2] = 0; - - if (inst->I.Opcode == RC_OPCODE_KIL) - srcmasks[0] |= RC_MASK_XYZW; - - if (!writemask) - return; - - if (opcode->IsComponentwise) { - for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) - srcmasks[src] |= writemask; - } else if (opcode->IsStandardScalar) { - for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) - srcmasks[src] |= RC_MASK_X; - } else { - switch(inst->I.Opcode) { - case RC_OPCODE_ARL: - srcmasks[0] |= RC_MASK_X; - break; - case RC_OPCODE_DP3: - srcmasks[0] |= RC_MASK_XYZ; - srcmasks[1] |= RC_MASK_XYZ; - break; - case RC_OPCODE_DP4: - srcmasks[0] |= RC_MASK_XYZW; - srcmasks[1] |= RC_MASK_XYZW; - break; - case RC_OPCODE_TEX: - case RC_OPCODE_TXB: - case RC_OPCODE_TXP: - srcmasks[0] |= RC_MASK_XYZW; - break; - case RC_OPCODE_DST: - srcmasks[0] |= 0x6; - srcmasks[1] |= 0xa; - break; - case RC_OPCODE_EXP: - case RC_OPCODE_LOG: - srcmasks[0] |= RC_MASK_XY; - break; - case RC_OPCODE_LIT: - srcmasks[0] |= 0xb; - break; - default: - break; - } - } -} - -static void mark_instruction_source_use(struct dataflow_state * s, - struct rc_instruction * inst, unsigned int writemask) -{ - unsigned int srcmasks[3]; - - compute_sources_for_writemask(inst, writemask, srcmasks); - - for(unsigned int src = 0; src < 3; ++src) - mark_source_use(s, inst, src, srcmasks[src]); -} - -static void run_update(struct dataflow_state * s) -{ - s->UpdateRunning = 1; - - while(s->UpdateStackSize) { - struct rc_dataflow_vector * vector = s->UpdateStack[--s->UpdateStackSize]; - vector->PassBit = 0; - - if (vector->WriteInstruction) { - struct rc_instruction * inst = vector->WriteInstruction; - - if (inst->Dataflow.DstRegPrev) { - unsigned int carryover = vector->UseMask & ~inst->I.DstReg.WriteMask; - - if (carryover) - mark_ref_use(s, inst->Dataflow.DstRegPrev, carryover); - } - - mark_instruction_source_use( - s, vector->WriteInstruction, - vector->UseMask & inst->I.DstReg.WriteMask); - } - } - - s->UpdateRunning = 0; -} - -static void mark_vector_use(struct dataflow_state * s, struct rc_dataflow_vector * vector, unsigned int mask) -{ - if (!(mask & ~vector->UseMask)) - return; /* no new used bits */ - - vector->UseMask |= mask; - if (vector->PassBit) - return; - - if (s->UpdateStackSize >= s->UpdateStackReserved) { - unsigned int new_reserve = 2 * s->UpdateStackReserved; - struct rc_dataflow_vector ** new_stack; - - if (!new_reserve) - new_reserve = 16; - - new_stack = memory_pool_malloc(&s->C->Pool, new_reserve * sizeof(struct rc_dataflow_vector *)); - memcpy(new_stack, s->UpdateStack, s->UpdateStackSize * sizeof(struct rc_dataflow_vector *)); - - s->UpdateStack = new_stack; - s->UpdateStackReserved = new_reserve; - } - - s->UpdateStack[s->UpdateStackSize++] = vector; - vector->PassBit = 1; - - if (!s->UpdateRunning) - run_update(s); -} - -static void annotate_instruction(struct dataflow_state * s, struct rc_instruction * inst) -{ - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); - unsigned int src; - - for(src = 0; src < opcode->NumSrcRegs; ++src) { - struct rc_dataflow_vector * vector = get_register_contents(s, inst->I.SrcReg[src].File, inst->I.SrcReg[src].Index); - if (vector) { - inst->Dataflow.SrcReg[src] = rc_dataflow_create_ref(s->C, vector, inst); - } - if (inst->I.SrcReg[src].RelAddr) { - struct rc_dataflow_vector * addr = get_register_contents(s, RC_FILE_ADDRESS, 0); - if (addr) - inst->Dataflow.SrcRegAddress[src] = rc_dataflow_create_ref(s->C, addr, inst); - } - } - - mark_instruction_source_use(s, inst, 0); /* for KIL */ - - if (opcode->HasDstReg) { - struct rc_dataflow_vector * oldvec = get_register_contents(s, inst->I.DstReg.File, inst->I.DstReg.Index); - struct rc_dataflow_vector * newvec = rc_dataflow_create_vector(s->C, inst->I.DstReg.File, inst->I.DstReg.Index, inst); - - newvec->ValidMask = inst->I.DstReg.WriteMask; - - if (oldvec) { - unsigned int carryover = oldvec->ValidMask & ~inst->I.DstReg.WriteMask; - - if (oldvec->ValidMask) - inst->Dataflow.DstRegAliased = 1; - - if (carryover) { - inst->Dataflow.DstRegPrev = rc_dataflow_create_ref(s->C, oldvec, inst); - newvec->ValidMask |= carryover; - - if (!s->DCE) - mark_ref_use(s, inst->Dataflow.DstRegPrev, carryover); - } - } - - inst->Dataflow.DstReg = newvec; - - if (newvec->File == RC_FILE_TEMPORARY) - s->Temporary[newvec->Index] = newvec; - else if (newvec->File == RC_FILE_OUTPUT) - s->Output[newvec->Index] = newvec; - else - s->Address = newvec; - - if (!s->DCE) - mark_vector_use(s, newvec, inst->I.DstReg.WriteMask); - } -} - -static void init_inputs(struct dataflow_state * s) -{ - unsigned int index; - - for(index = 0; index < 32; ++index) { - if (s->C->Program.InputsRead & (1 << index)) { - s->Input[index] = rc_dataflow_create_vector(s->C, RC_FILE_INPUT, index, 0); - s->Input[index]->ValidMask = RC_MASK_XYZW; - } - } -} - -static void mark_output_use(void * data, unsigned int index, unsigned int mask) -{ - struct dataflow_state * s = data; - struct rc_dataflow_vector * vec = s->Output[index]; - - if (vec) - mark_vector_use(s, vec, mask); -} - -void rc_dataflow_annotate(struct radeon_compiler * c, rc_dataflow_mark_outputs_fn dce, void * userdata) -{ - struct dataflow_state s; - struct rc_instruction * inst; - - memset(&s, 0, sizeof(s)); - s.C = c; - s.DCE = dce ? 1 : 0; - - init_inputs(&s); - - for(inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next) { - annotate_instruction(&s, inst); - } - - if (s.DCE) { - dce(userdata, &s, &mark_output_use); - - for(inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next) { - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); - - if (opcode->HasDstReg) { - unsigned int redundant_writes = inst->I.DstReg.WriteMask & ~inst->Dataflow.DstReg->UseMask; - - inst->I.DstReg.WriteMask &= ~redundant_writes; - - if (!inst->I.DstReg.WriteMask) { - struct rc_instruction * todelete = inst; - inst = inst->Prev; - rc_remove_instruction(todelete); - continue; - } - } - - unsigned int srcmasks[3]; - compute_sources_for_writemask(inst, inst->I.DstReg.WriteMask, srcmasks); - - for(unsigned int src = 0; src < 3; ++src) { - for(unsigned int chan = 0; chan < 4; ++chan) { - if (!GET_BIT(srcmasks[src], chan)) - SET_SWZ(inst->I.SrcReg[src].Swizzle, chan, RC_SWIZZLE_UNUSED); - } - - if (inst->Dataflow.SrcReg[src]) { - if (!inst->Dataflow.SrcReg[src]->UseMask) { - rc_dataflow_remove_ref(inst->Dataflow.SrcReg[src]); - inst->Dataflow.SrcReg[src] = 0; - } - } - - if (inst->Dataflow.SrcRegAddress[src]) { - if (!inst->Dataflow.SrcRegAddress[src]->UseMask) { - rc_dataflow_remove_ref(inst->Dataflow.SrcRegAddress[src]); - inst->Dataflow.SrcRegAddress[src] = 0; - } - } - } - } - - rc_calculate_inputs_outputs(c); - } -} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c new file mode 100644 index 0000000000..95af6fd411 --- /dev/null +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c @@ -0,0 +1,253 @@ +/* + * Copyright (C) 2009 Nicolai Haehnle. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 "radeon_dataflow.h" + +#include "radeon_compiler.h" + + +struct updatemask_state { + unsigned char Output[RC_REGISTER_MAX_INDEX]; + unsigned char Temporary[RC_REGISTER_MAX_INDEX]; + unsigned char Address; +}; + +struct instruction_state { + unsigned char WriteMask; + unsigned char SrcReg[3]; +}; + +struct branchinfo { + unsigned int HaveElse:1; + + struct updatemask_state StoreEndif; + struct updatemask_state StoreElse; +}; + +struct deadcode_state { + struct radeon_compiler * C; + struct instruction_state * Instructions; + + struct updatemask_state R; + + struct branchinfo * BranchStack; + unsigned int BranchStackSize; + unsigned int BranchStackReserved; +}; + + +static void or_updatemasks( + struct updatemask_state * dst, + struct updatemask_state * a, + struct updatemask_state * b) +{ + for(unsigned int i = 0; i < RC_REGISTER_MAX_INDEX; ++i) { + dst->Output[i] = a->Output[i] | b->Output[i]; + dst->Temporary[i] = a->Temporary[i] | b->Temporary[i]; + } + + dst->Address = a->Address | b->Address; +} + +static void push_branch(struct deadcode_state * s) +{ + if (s->BranchStackSize >= s->BranchStackReserved) { + unsigned int new_reserve = 2 * s->BranchStackReserved; + struct branchinfo * new_stack; + + if (!new_reserve) + new_reserve = 4; + + new_stack = memory_pool_malloc(&s->C->Pool, new_reserve * sizeof(struct branchinfo)); + memcpy(new_stack, s->BranchStack, s->BranchStackSize * sizeof(struct branchinfo)); + + s->BranchStack = new_stack; + s->BranchStackReserved = new_reserve; + } + + struct branchinfo * branch = &s->BranchStack[s->BranchStackSize++]; + branch->HaveElse = 0; + memcpy(&branch->StoreEndif, &s->R, sizeof(s->R)); +} + +static unsigned char * get_used_ptr(struct deadcode_state *s, rc_register_file file, unsigned int index) +{ + if (file == RC_FILE_OUTPUT || file == RC_FILE_TEMPORARY) { + if (index >= RC_REGISTER_MAX_INDEX) { + rc_error(s->C, "%s: index %i is out of bounds for file %i\n", __FUNCTION__, index, file); + return 0; + } + + if (file == RC_FILE_OUTPUT) + return &s->R.Output[index]; + else + return &s->R.Temporary[index]; + } else if (file == RC_FILE_ADDRESS) { + return &s->R.Address; + } + + return 0; +} + +static void mark_used(struct deadcode_state * s, rc_register_file file, unsigned int index, unsigned int mask) +{ + unsigned char * pused = get_used_ptr(s, file, index); + if (pused) + *pused |= mask; +} + +static void update_instruction(struct deadcode_state * s, struct rc_instruction * inst) +{ + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + struct instruction_state * insts = &s->Instructions[inst->IP]; + unsigned int usedmask = 0; + + if (opcode->HasDstReg) { + unsigned char * pused = get_used_ptr(s, inst->I.DstReg.File, inst->I.DstReg.Index); + if (pused) { + usedmask = *pused & inst->I.DstReg.WriteMask; + *pused &= ~usedmask; + } + } + + insts->WriteMask |= usedmask; + + unsigned int srcmasks[3]; + rc_compute_sources_for_writemask(opcode, usedmask, srcmasks); + + for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) { + unsigned int refmask = 0; + unsigned int newsrcmask = srcmasks[src] & ~insts->SrcReg[src]; + insts->SrcReg[src] |= newsrcmask; + + for(unsigned int chan = 0; chan < 4; ++chan) { + if (GET_BIT(newsrcmask, chan)) + refmask |= 1 << GET_SWZ(inst->I.SrcReg[src].Swizzle, chan); + } + + /* get rid of spurious bits from ZERO, ONE, etc. swizzles */ + refmask &= RC_MASK_XYZW; + + if (!refmask) + continue; + + mark_used(s, inst->I.SrcReg[src].File, inst->I.SrcReg[src].Index, refmask); + + if (inst->I.SrcReg[src].RelAddr) + mark_used(s, RC_FILE_ADDRESS, 0, RC_MASK_X); + } +} + +static void mark_output_use(void * data, unsigned int index, unsigned int mask) +{ + struct deadcode_state * s = data; + + mark_used(s, RC_FILE_OUTPUT, index, mask); +} + +void rc_dataflow_deadcode(struct radeon_compiler * c, rc_dataflow_mark_outputs_fn dce, void * userdata) +{ + struct deadcode_state s; + unsigned int nr_instructions; + + memset(&s, 0, sizeof(s)); + s.C = c; + + nr_instructions = rc_recompute_ips(c); + s.Instructions = memory_pool_malloc(&c->Pool, sizeof(struct instruction_state)*nr_instructions); + memset(s.Instructions, 0, sizeof(struct instruction_state)*nr_instructions); + + dce(userdata, &s, &mark_output_use); + + for(struct rc_instruction * inst = c->Program.Instructions.Prev; + inst != &c->Program.Instructions; + inst = inst->Prev) { + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + + if (opcode->IsControlFlow) { + if (opcode->Opcode == RC_OPCODE_ENDIF) { + push_branch(&s); + } else { + if (s.BranchStackSize) { + struct branchinfo * branch = &s.BranchStack[s.BranchStackSize-1]; + + if (opcode->Opcode == RC_OPCODE_IF) { + or_updatemasks(&s.R, + &s.R, + branch->HaveElse ? &branch->StoreElse : &branch->StoreEndif); + + s.BranchStackSize--; + } else if (opcode->Opcode == RC_OPCODE_ELSE) { + if (branch->HaveElse) { + rc_error(c, "%s: Multiple ELSE for one IF/ENDIF\n", __FUNCTION__); + } else { + memcpy(&branch->StoreElse, &s.R, sizeof(s.R)); + memcpy(&s.R, &branch->StoreEndif, sizeof(s.R)); + branch->HaveElse = 1; + } + } else { + rc_error(c, "%s: Unhandled control flow instruction %s\n", __FUNCTION__, opcode->Name); + } + } else { + rc_error(c, "%s: Unexpected control flow instruction\n", __FUNCTION__); + } + } + } + + update_instruction(&s, inst); + } + + unsigned int ip = 0; + for(struct rc_instruction * inst = c->Program.Instructions.Next; + inst != &c->Program.Instructions; + inst = inst->Next, ++ip) { + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + + if (opcode->HasDstReg) { + if (s.Instructions[ip].WriteMask) { + inst->I.DstReg.WriteMask = s.Instructions[ip].WriteMask; + } else { + struct rc_instruction * todelete = inst; + inst = inst->Prev; + rc_remove_instruction(todelete); + continue; + } + } + + unsigned int srcmasks[3]; + rc_compute_sources_for_writemask(opcode, s.Instructions[ip].WriteMask, srcmasks); + + for(unsigned int src = 0; src < 3; ++src) { + for(unsigned int chan = 0; chan < 4; ++chan) { + if (!GET_BIT(srcmasks[src], chan)) + SET_SWZ(inst->I.SrcReg[src].Swizzle, chan, RC_SWIZZLE_UNUSED); + } + } + } + + rc_calculate_inputs_outputs(c); +} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_dealias.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_dealias.c deleted file mode 100644 index 4596636970..0000000000 --- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_dealias.c +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (C) 2009 Nicolai Haehnle. - * - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial - * portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 "radeon_dataflow.h" - -#include "radeon_compiler.h" - - -#define DEALIAS_LIST_SIZE 128 - -struct dealias_state { - struct radeon_compiler * C; - - unsigned int OldIndex:RC_REGISTER_INDEX_BITS; - unsigned int NewIndex:RC_REGISTER_INDEX_BITS; - unsigned int DealiasFail:1; - - struct rc_dataflow_vector * List[DEALIAS_LIST_SIZE]; - unsigned int Length; -}; - -static void push_dealias_vector(struct dealias_state * s, struct rc_dataflow_vector * vec) -{ - if (s->Length >= DEALIAS_LIST_SIZE) { - rc_debug(s->C, "%s: list size exceeded\n", __FUNCTION__); - s->DealiasFail = 1; - return; - } - - if (rc_assert(s->C, vec->File == RC_FILE_TEMPORARY && vec->Index == s->OldIndex)) - return; - - s->List[s->Length++] = vec; -} - -static void run_dealias(struct dealias_state * s) -{ - unsigned int i; - - for(i = 0; i < s->Length && !s->DealiasFail; ++i) { - struct rc_dataflow_vector * vec = s->List[i]; - struct rc_dataflow_ref * ref; - - for(ref = vec->Refs.Next; ref != &vec->Refs; ref = ref->Next) { - if (ref->ReadInstruction->Dataflow.DstRegPrev == ref) - push_dealias_vector(s, ref->ReadInstruction->Dataflow.DstReg); - } - } - - if (s->DealiasFail) - return; - - for(i = 0; i < s->Length; ++i) { - struct rc_dataflow_vector * vec = s->List[i]; - struct rc_dataflow_ref * ref; - - vec->Index = s->NewIndex; - vec->WriteInstruction->I.DstReg.Index = s->NewIndex; - - for(ref = vec->Refs.Next; ref != &vec->Refs; ref = ref->Next) { - struct rc_instruction * inst = ref->ReadInstruction; - unsigned int i; - - for(i = 0; i < 3; ++i) { - if (inst->Dataflow.SrcReg[i] == ref) { - if (rc_assert(s->C, inst->I.SrcReg[i].File == RC_FILE_TEMPORARY && - inst->I.SrcReg[i].Index == s->OldIndex)) - return; - - inst->I.SrcReg[i].Index = s->NewIndex; - } - } - } - } -} - -/** - * Breaks register aliasing to reduce multiple assignments to a single register. - * - * This affects sequences like: - * MUL r0, ...; - * MAD r0, r1, r2, r0; - * In this example, a new register will be used for the destination of the - * second MAD. - * - * The purpose of this dealiasing is to make the resulting code more SSA-like - * and therefore make it easier to move instructions around. - * This is of crucial importance for R300 fragment programs, where de-aliasing - * can help to reduce texture indirections, but other targets can benefit from - * it as well. - * - * \note When compiling GLSL, there may be some benefit gained from breaking - * up vectors whose components are unrelated. This is not done yet and should - * be investigated at some point (of course, a matching pass to re-merge - * components would be required). - */ -void rc_dataflow_dealias(struct radeon_compiler * c) -{ - struct dealias_state s; - - memset(&s, 0, sizeof(s)); - s.C = c; - - struct rc_instruction * inst; - for(inst = c->Program.Instructions.Prev; inst != &c->Program.Instructions; inst = inst->Prev) { - if (!inst->Dataflow.DstRegAliased || inst->Dataflow.DstReg->File != RC_FILE_TEMPORARY) - continue; - - if (inst->Dataflow.DstReg->UseMask & ~inst->I.DstReg.WriteMask) - continue; - - s.OldIndex = inst->I.DstReg.Index; - s.NewIndex = rc_find_free_temporary(c); - s.DealiasFail = 0; - s.Length = 0; - - inst->Dataflow.DstRegAliased = 0; - if (inst->Dataflow.DstRegPrev) { - rc_dataflow_remove_ref(inst->Dataflow.DstRegPrev); - inst->Dataflow.DstRegPrev = 0; - } - - push_dealias_vector(&s, inst->Dataflow.DstReg); - run_dealias(&s); - } -} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c index 1aa91eff7c..fcef218b59 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c @@ -37,8 +37,6 @@ static void rewrite_source(struct radeon_compiler * c, struct rc_swizzle_split split; unsigned int tempreg = rc_find_free_temporary(c); unsigned int usemask; - struct rc_dataflow_ref * oldref = inst->Dataflow.SrcReg[src]; - struct rc_dataflow_vector * vector = 0; usemask = 0; for(unsigned int chan = 0; chan < 4; ++chan) { @@ -75,30 +73,8 @@ static void rewrite_source(struct radeon_compiler * c, else if (masked_negate == split.Phase[phase]) mov->I.SrcReg[0].Negate = RC_MASK_XYZW; - if (oldref) { - mov->Dataflow.SrcReg[0] = rc_dataflow_create_ref(c, oldref->Vector, mov); - mov->Dataflow.SrcReg[0]->UseMask = phase_refmask; - } - - mov->Dataflow.DstReg = rc_dataflow_create_vector(c, RC_FILE_TEMPORARY, tempreg, mov); - mov->Dataflow.DstReg->ValidMask = split.Phase[phase]; - - if (vector) { - mov->Dataflow.DstRegPrev = rc_dataflow_create_ref(c, vector, mov); - mov->Dataflow.DstRegPrev->UseMask = vector->ValidMask; - mov->Dataflow.DstReg->ValidMask |= vector->ValidMask; - mov->Dataflow.DstRegAliased = 1; - } - - mov->Dataflow.DstReg->UseMask = mov->Dataflow.DstReg->ValidMask; - vector = mov->Dataflow.DstReg; } - if (oldref) - rc_dataflow_remove_ref(oldref); - inst->Dataflow.SrcReg[src] = rc_dataflow_create_ref(c, vector, inst); - inst->Dataflow.SrcReg[src]->UseMask = usemask; - inst->I.SrcReg[src].File = RC_FILE_TEMPORARY; inst->I.SrcReg[src].Index = tempreg; inst->I.SrcReg[src].Swizzle = 0; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c index b7200990c2..e097a62b55 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c @@ -27,6 +27,8 @@ #include "radeon_opcodes.h" +#include "radeon_program_constants.h" + struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE] = { { .Opcode = RC_OPCODE_NOP, @@ -339,9 +341,85 @@ struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE] = { .NumSrcRegs = 1, .HasDstReg = 1 }, + { + .Opcode = RC_OPCODE_IF, + .Name = "IF", + .IsControlFlow = 1, + .NumSrcRegs = 1 + }, + { + .Opcode = RC_OPCODE_ELSE, + .Name = "ELSE", + .IsControlFlow = 1, + .NumSrcRegs = 0 + }, + { + .Opcode = RC_OPCODE_ENDIF, + .Name = "ENDIF", + .IsControlFlow = 1, + .NumSrcRegs = 0 + }, { .Opcode = RC_OPCODE_REPL_ALPHA, .Name = "REPL_ALPHA", .HasDstReg = 1 } }; + +void rc_compute_sources_for_writemask( + const struct rc_opcode_info * opcode, + unsigned int writemask, + unsigned int *srcmasks) +{ + srcmasks[0] = 0; + srcmasks[1] = 0; + srcmasks[2] = 0; + + if (opcode->Opcode == RC_OPCODE_KIL) + srcmasks[0] |= RC_MASK_XYZW; + else if (opcode->Opcode == RC_OPCODE_IF) + srcmasks[0] |= RC_MASK_X; + + if (!writemask) + return; + + if (opcode->IsComponentwise) { + for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) + srcmasks[src] |= writemask; + } else if (opcode->IsStandardScalar) { + for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) + srcmasks[src] |= RC_MASK_X; + } else { + switch(opcode->Opcode) { + case RC_OPCODE_ARL: + srcmasks[0] |= RC_MASK_X; + break; + case RC_OPCODE_DP3: + srcmasks[0] |= RC_MASK_XYZ; + srcmasks[1] |= RC_MASK_XYZ; + break; + case RC_OPCODE_DP4: + srcmasks[0] |= RC_MASK_XYZW; + srcmasks[1] |= RC_MASK_XYZW; + break; + case RC_OPCODE_TEX: + case RC_OPCODE_TXB: + case RC_OPCODE_TXP: + srcmasks[0] |= RC_MASK_XYZW; + break; + case RC_OPCODE_DST: + srcmasks[0] |= 0x6; + srcmasks[1] |= 0xa; + break; + case RC_OPCODE_EXP: + case RC_OPCODE_LOG: + srcmasks[0] |= RC_MASK_XY; + break; + case RC_OPCODE_LIT: + srcmasks[0] |= 0xb; + break; + default: + break; + } + } +} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h index 8e30bef1e3..f8ba5255ca 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h @@ -166,6 +166,18 @@ typedef enum { RC_OPCODE_TXL, RC_OPCODE_TXP, + /** branch instruction: + * If src0.x != 0.0, continue with the next instruction; + * otherwise, jump to matching RC_OPCODE_ELSE or RC_OPCODE_ENDIF. + */ + RC_OPCODE_IF, + + /** branch instruction: jump to matching RC_OPCODE_ENDIF */ + RC_OPCODE_ELSE, + + /** branch instruction: has no effect */ + RC_OPCODE_ENDIF, + /** special instruction, used in R300-R500 fragment program pair instructions * indicates that the result of the alpha operation shall be replicated * across all other channels */ @@ -188,6 +200,9 @@ struct rc_opcode_info { unsigned int NumSrcRegs:2; unsigned int HasDstReg:1; + /** true if this instruction affects control flow */ + unsigned int IsControlFlow:1; + /** true if this is a vector instruction that operates on components in parallel * without any cross-component interaction */ unsigned int IsComponentwise:1; @@ -207,4 +222,9 @@ static inline const struct rc_opcode_info * rc_get_opcode_info(rc_opcode opcode) return &rc_opcodes[opcode]; } +void rc_compute_sources_for_writemask( + const struct rc_opcode_info * opcode, + unsigned int writemask, + unsigned int *srcmasks); + #endif /* RADEON_OPCODES_H */ diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.c b/src/mesa/drivers/dri/r300/compiler/radeon_program.c index b97c48084b..a1ee7c0cab 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.c @@ -154,7 +154,24 @@ struct rc_instruction *rc_insert_new_instruction(struct radeon_compiler * c, str void rc_remove_instruction(struct rc_instruction * inst) { - rc_dataflow_remove_instruction(inst); inst->Prev->Next = inst->Next; inst->Next->Prev = inst->Prev; } + +/** + * Return the number of instructions in the program. + */ +unsigned int rc_recompute_ips(struct radeon_compiler * c) +{ + unsigned int ip = 0; + + for(struct rc_instruction * inst = c->Program.Instructions.Next; + inst != &c->Program.Instructions; + inst = inst->Next) { + inst->IP = ip++; + } + + c->Program.Instructions.IP = 0xcafedead; + + return ip; +} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.h b/src/mesa/drivers/dri/r300/compiler/radeon_program.h index d38c9a420c..efa2b0dfe3 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.h @@ -34,7 +34,6 @@ #include "radeon_opcodes.h" #include "radeon_code.h" #include "radeon_program_constants.h" -#include "radeon_dataflow.h" struct radeon_compiler; @@ -73,33 +72,33 @@ struct rc_dst_register { * instruction types may be valid. */ struct rc_sub_instruction { - struct rc_src_register SrcReg[3]; - struct rc_dst_register DstReg; - - /** - * Opcode of this instruction, according to \ref rc_opcode enums. - */ - rc_opcode Opcode:8; - - /** - * Saturate each value of the result to the range [0,1] or [-1,1], - * according to \ref rc_saturate_mode enums. - */ - rc_saturate_mode SaturateMode:2; - - /** - * \name Extra fields for TEX, TXB, TXD, TXL, TXP instructions. - */ - /*@{*/ - /** Source texture unit. */ - unsigned int TexSrcUnit:5; - - /** Source texture target, one of the \ref rc_texture_target enums */ - rc_texture_target TexSrcTarget:3; - - /** True if tex instruction should do shadow comparison */ - unsigned int TexShadow:1; - /*@}*/ + struct rc_src_register SrcReg[3]; + struct rc_dst_register DstReg; + + /** + * Opcode of this instruction, according to \ref rc_opcode enums. + */ + rc_opcode Opcode:8; + + /** + * Saturate each value of the result to the range [0,1] or [-1,1], + * according to \ref rc_saturate_mode enums. + */ + rc_saturate_mode SaturateMode:2; + + /** + * \name Extra fields for TEX, TXB, TXD, TXL, TXP instructions. + */ + /*@{*/ + /** Source texture unit. */ + unsigned int TexSrcUnit:5; + + /** Source texture target, one of the \ref rc_texture_target enums */ + rc_texture_target TexSrcTarget:3; + + /** True if tex instruction should do shadow comparison */ + unsigned int TexShadow:1; + /*@}*/ }; struct rc_instruction { @@ -109,13 +108,11 @@ struct rc_instruction { struct rc_sub_instruction I; /** - * Dataflow annotations. - * - * These are not supplied by the caller of the compiler, - * but filled in during compilation stages that make use of - * dataflow analysis. + * Warning: IPs are not stable. If you want to use them, + * you need to recompute them at the beginning of each pass + * using \ref rc_recompute_ips */ - struct rc_instruction_dataflow Dataflow; + unsigned int IP; }; struct rc_program { @@ -210,10 +207,8 @@ struct rc_instruction *rc_alloc_instruction(struct radeon_compiler * c); struct rc_instruction *rc_insert_new_instruction(struct radeon_compiler * c, struct rc_instruction * after); void rc_remove_instruction(struct rc_instruction * inst); -enum { - RC_PRINT_DATAFLOW = 0x1 -}; +unsigned int rc_recompute_ips(struct radeon_compiler * c); -void rc_print_program(const struct rc_program *prog, unsigned int flags); +void rc_print_program(const struct rc_program *prog); #endif diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c index 38060ea3ad..0485286451 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c @@ -24,11 +24,6 @@ #include -static void print_comment(FILE * f) -{ - fprintf(f, " # "); -} - static const char * textarget_to_string(rc_texture_target target) { switch(target) { @@ -121,19 +116,7 @@ static void rc_print_src_register(FILE * f, struct rc_src_register src) fprintf(f, "|"); } -static void rc_print_ref(FILE * f, struct rc_dataflow_ref * ref) -{ - fprintf(f, "ref(%p", ref->Vector); - - if (ref->UseMask != RC_MASK_XYZW) { - fprintf(f, "."); - rc_print_mask(f, ref->UseMask); - } - - fprintf(f, ")"); -} - -static void rc_print_instruction(FILE * f, unsigned int flags, struct rc_instruction * inst) +static void rc_print_instruction(FILE * f, struct rc_instruction * inst) { const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); unsigned int reg; @@ -169,45 +152,22 @@ static void rc_print_instruction(FILE * f, unsigned int flags, struct rc_instruc } fprintf(f, ";\n"); - - if (flags & RC_PRINT_DATAFLOW) { - print_comment(f); - - fprintf(f, "Dst = %p", inst->Dataflow.DstReg); - if (inst->Dataflow.DstRegAliased) - fprintf(f, " aliased"); - if (inst->Dataflow.DstRegPrev) { - fprintf(f, " from "); - rc_print_ref(f, inst->Dataflow.DstRegPrev); - } - - for(reg = 0; reg < opcode->NumSrcRegs; ++reg) { - fprintf(f, ", "); - if (inst->Dataflow.SrcReg[reg]) - rc_print_ref(f, inst->Dataflow.SrcReg[reg]); - else - fprintf(f, ""); - } - - fprintf(f, "\n"); - } } /** * Print program to stderr, default options. */ -void rc_print_program(const struct rc_program *prog, unsigned int flags) +void rc_print_program(const struct rc_program *prog) { unsigned int linenum = 0; struct rc_instruction *inst; - fprintf(stderr, "# Radeon Compiler Program%s\n", - flags & RC_PRINT_DATAFLOW ? " (with dataflow annotations)" : ""); + fprintf(stderr, "# Radeon Compiler Program\n"); for(inst = prog->Instructions.Next; inst != &prog->Instructions; inst = inst->Next) { fprintf(stderr, "%3d: ", linenum); - rc_print_instruction(stderr, flags, inst); + rc_print_instruction(stderr, inst); linenum++; } -- cgit v1.2.3 From 470ec8d42e1941c0ad773084693323f96a83e64d Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 2 Oct 2009 19:46:03 +0100 Subject: intel: Assert that relocation offsets are within the target This should catch the common programming error where we attempt to emit a relocation to beyond the end of the target buffer. Signed-off-by: Chris Wilson --- src/mesa/drivers/dri/intel/intel_batchbuffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h b/src/mesa/drivers/dri/intel/intel_batchbuffer.h index 51579df09e..9a619fbd5c 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.h +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.h @@ -157,7 +157,7 @@ intel_batchbuffer_require_space(struct intel_batchbuffer *batch, #define OUT_BATCH(d) intel_batchbuffer_emit_dword(intel->batch, d) #define OUT_RELOC(buf, read_domains, write_domain, delta) do { \ - assert((delta) >= 0); \ + assert((unsigned) (delta) <= buf->size); \ intel_batchbuffer_emit_reloc(intel->batch, buf, \ read_domains, write_domain, delta); \ } while (0) -- cgit v1.2.3 From f194d2737b059cf6b99caa18f8ec2d46a55ada88 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 3 Oct 2009 23:08:39 +0100 Subject: intel: Suppress a compiler warning for an pointer->int cast MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit intel_pixel_read.c: In function ‘do_blit_readpixels’: intel_pixel_read.c:221: warning: cast from pointer to integer of different size Cast via an intermediate (GLintptr) instead and hope the result fits within GLuint... [It should as we simply do not support textures *that* large!] Signed-off-by: Chris Wilson --- src/mesa/drivers/dri/intel/intel_pixel_read.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_pixel_read.c b/src/mesa/drivers/dri/intel/intel_pixel_read.c index bc67f6242a..44a8695286 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_read.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_read.c @@ -216,9 +216,8 @@ do_blit_readpixels(GLcontext * ctx, rowLength = -rowLength; } - /* XXX 64-bit cast? */ - dst_offset = (GLuint) _mesa_image_address(2, pack, pixels, width, height, - format, type, 0, 0, 0); + dst_offset = (GLintptr) _mesa_image_address(2, pack, pixels, width, height, + format, type, 0, 0, 0); /* Although the blits go on the command buffer, need to do this and -- cgit v1.2.3 From e6b137dcce58ca074458b184304573613917553f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sun, 4 Oct 2009 11:13:09 +0200 Subject: r300/compiler: Introduce aluresult register for branch operation support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle --- src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c | 3 +- src/mesa/drivers/dri/r300/compiler/r500_fragprog.c | 28 +++++++++ src/mesa/drivers/dri/r300/compiler/r500_fragprog.h | 5 ++ .../dri/r300/compiler/radeon_dataflow_deadcode.c | 66 ++++++++++++++++++---- .../drivers/dri/r300/compiler/radeon_program.h | 8 +++ .../dri/r300/compiler/radeon_program_constants.h | 21 ++++++- .../dri/r300/compiler/radeon_program_print.c | 38 ++++++++++++- 7 files changed, 154 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c index 590201a9ba..614c2e3d24 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c @@ -88,11 +88,12 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) if (c->is_r500) { struct radeon_program_transformation transformations[] = { { &r500_transform_TEX, c }, + { &r500_transform_IF, 0 }, { &radeonTransformALU, 0 }, { &radeonTransformDeriv, 0 }, { &radeonTransformTrigScale, 0 } }; - radeonLocalTransform(&c->Base, 4, transformations); + radeonLocalTransform(&c->Base, 5, transformations); c->Base.SwizzleCaps = &r500_swizzle_caps; } else { diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c index 971465e359..39f2445bd4 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c @@ -169,6 +169,34 @@ int r500_transform_TEX( return 1; } +/** + * Rewrite IF instructions to use the ALU result special register. + */ +int r500_transform_IF( + struct radeon_compiler * c, + struct rc_instruction * inst, + void* data) +{ + if (inst->I.Opcode != RC_OPCODE_IF) + return 0; + + struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst->Prev); + inst_mov->I.Opcode = RC_OPCODE_MOV; + inst_mov->I.DstReg.WriteMask = 0; + inst_mov->I.WriteALUResult = RC_ALURESULT_W; + inst_mov->I.ALUResultCompare = RC_COMPARE_FUNC_NOTEQUAL; + inst_mov->I.SrcReg[0] = inst->I.SrcReg[0]; + inst_mov->I.SrcReg[0].Swizzle = combine_swizzles4(inst_mov->I.SrcReg[0].Swizzle, + RC_SWIZZLE_UNUSED, RC_SWIZZLE_UNUSED, RC_SWIZZLE_UNUSED, RC_SWIZZLE_X); + + inst->I.SrcReg[0].File = RC_FILE_SPECIAL; + inst->I.SrcReg[0].Index = RC_SPECIAL_ALU_RESULT; + inst->I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZW; + inst->I.SrcReg[0].Negate = 0; + + return 1; +} + static int r500_swizzle_is_native(rc_opcode opcode, struct rc_src_register reg) { unsigned int relevant; diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.h b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.h index 92ac75d5fd..0918cdf518 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.h +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.h @@ -47,4 +47,9 @@ extern int r500_transform_TEX( struct rc_instruction * inst, void* data); +extern int r500_transform_IF( + struct radeon_compiler * c, + struct rc_instruction * inst, + void* data); + #endif diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c index 95af6fd411..2ae3c56689 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c @@ -34,10 +34,12 @@ struct updatemask_state { unsigned char Output[RC_REGISTER_MAX_INDEX]; unsigned char Temporary[RC_REGISTER_MAX_INDEX]; unsigned char Address; + unsigned char Special[RC_NUM_SPECIAL_REGISTERS]; }; struct instruction_state { - unsigned char WriteMask; + unsigned char WriteMask:4; + unsigned char WriteALUResult:1; unsigned char SrcReg[3]; }; @@ -70,6 +72,9 @@ static void or_updatemasks( dst->Temporary[i] = a->Temporary[i] | b->Temporary[i]; } + for(unsigned int i = 0; i < RC_NUM_SPECIAL_REGISTERS; ++i) + dst->Special[i] = a->Special[i] | b->Special[i]; + dst->Address = a->Address | b->Address; } @@ -108,6 +113,13 @@ static unsigned char * get_used_ptr(struct deadcode_state *s, rc_register_file f return &s->R.Temporary[index]; } else if (file == RC_FILE_ADDRESS) { return &s->R.Address; + } else if (file == RC_FILE_SPECIAL) { + if (index >= RC_NUM_SPECIAL_REGISTERS) { + rc_error(s->C, "%s: special file index %i out of bounds\n", __FUNCTION__, index); + return 0; + } + + return &s->R.Special[index]; } return 0; @@ -136,6 +148,19 @@ static void update_instruction(struct deadcode_state * s, struct rc_instruction insts->WriteMask |= usedmask; + if (inst->I.WriteALUResult) { + unsigned char * pused = get_used_ptr(s, RC_FILE_SPECIAL, RC_SPECIAL_ALU_RESULT); + if (pused && *pused) { + if (inst->I.WriteALUResult == RC_ALURESULT_X) + usedmask |= RC_MASK_X; + else if (inst->I.WriteALUResult == RC_ALURESULT_W) + usedmask |= RC_MASK_W; + + *pused = 0; + insts->WriteALUResult = 1; + } + } + unsigned int srcmasks[3]; rc_compute_sources_for_writemask(opcode, usedmask, srcmasks); @@ -225,21 +250,38 @@ void rc_dataflow_deadcode(struct radeon_compiler * c, rc_dataflow_mark_outputs_f for(struct rc_instruction * inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next, ++ip) { - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode);\ + int dead = 1; + + if (!opcode->HasDstReg) { + dead = 0; + } else { + inst->I.DstReg.WriteMask = s.Instructions[ip].WriteMask; + if (s.Instructions[ip].WriteMask) + dead = 0; + + if (s.Instructions[ip].WriteALUResult) + dead = 0; + else + inst->I.WriteALUResult = RC_ALURESULT_NONE; + } - if (opcode->HasDstReg) { - if (s.Instructions[ip].WriteMask) { - inst->I.DstReg.WriteMask = s.Instructions[ip].WriteMask; - } else { - struct rc_instruction * todelete = inst; - inst = inst->Prev; - rc_remove_instruction(todelete); - continue; - } + if (dead) { + struct rc_instruction * todelete = inst; + inst = inst->Prev; + rc_remove_instruction(todelete); + continue; } unsigned int srcmasks[3]; - rc_compute_sources_for_writemask(opcode, s.Instructions[ip].WriteMask, srcmasks); + unsigned int usemask = s.Instructions[ip].WriteMask; + + if (inst->I.WriteALUResult == RC_ALURESULT_X) + usemask |= RC_MASK_X; + else if (inst->I.WriteALUResult == RC_ALURESULT_W) + usemask |= RC_MASK_W; + + rc_compute_sources_for_writemask(opcode, usemask, srcmasks); for(unsigned int src = 0; src < 3; ++src) { for(unsigned int chan = 0; chan < 4; ++chan) { diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.h b/src/mesa/drivers/dri/r300/compiler/radeon_program.h index efa2b0dfe3..071b0a0ca9 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.h @@ -86,6 +86,14 @@ struct rc_sub_instruction { */ rc_saturate_mode SaturateMode:2; + /** + * Writing to the special register RC_SPECIAL_ALU_RESULT + */ + /*@{*/ + rc_write_aluresult WriteALUResult:2; + rc_compare_func ALUResultCompare:3; + /*@}*/ + /** * \name Extra fields for TEX, TXB, TXD, TXL, TXP instructions. */ diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_constants.h b/src/mesa/drivers/dri/r300/compiler/radeon_program_constants.h index 69994f9880..7c0d6720b1 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_constants.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_constants.h @@ -74,9 +74,22 @@ typedef enum { /** * Indicates a constant from the \ref rc_constant_list . */ - RC_FILE_CONSTANT + RC_FILE_CONSTANT, + + /** + * Indicates a special register, see RC_SPECIAL_xxx. + */ + RC_FILE_SPECIAL } rc_register_file; +enum { + /** R500 fragment program ALU result "register" */ + RC_SPECIAL_ALU_RESULT = 0, + + /** Must be last */ + RC_NUM_SPECIAL_REGISTERS +}; + #define RC_REGISTER_INDEX_BITS 10 #define RC_REGISTER_MAX_INDEX (1 << RC_REGISTER_INDEX_BITS) @@ -125,4 +138,10 @@ typedef enum { #define RC_MASK_XYZW (RC_MASK_X|RC_MASK_Y|RC_MASK_Z|RC_MASK_W) /*@}*/ +typedef enum { + RC_ALURESULT_NONE = 0, + RC_ALURESULT_X, + RC_ALURESULT_W +} rc_write_aluresult; + #endif /* RADEON_PROGRAM_CONSTANTS_H */ diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c index 0485286451..6645d7cacb 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c @@ -38,10 +38,36 @@ static const char * textarget_to_string(rc_texture_target target) } } +static void rc_print_comparefunc(FILE * f, const char * lhs, rc_compare_func func, const char * rhs) +{ + if (func == RC_COMPARE_FUNC_NEVER) { + fprintf(f, "false"); + } else if (func == RC_COMPARE_FUNC_ALWAYS) { + fprintf(f, "true"); + } else { + const char * op; + switch(func) { + case RC_COMPARE_FUNC_LESS: op = "<"; break; + case RC_COMPARE_FUNC_EQUAL: op = "=="; break; + case RC_COMPARE_FUNC_LEQUAL: op = "<="; break; + case RC_COMPARE_FUNC_GREATER: op = ">"; break; + case RC_COMPARE_FUNC_NOTEQUAL: op = "!="; break; + case RC_COMPARE_FUNC_GEQUAL: op = ">="; break; + default: op = "???"; break; + } + fprintf(f, "%s %s %s", lhs, op, rhs); + } +} + static void rc_print_register(FILE * f, rc_register_file file, int index, unsigned int reladdr) { if (file == RC_FILE_NONE) { fprintf(f, "none"); + } else if (file == RC_FILE_SPECIAL) { + switch(index) { + case RC_SPECIAL_ALU_RESULT: fprintf(f, "aluresult"); break; + default: fprintf(f, "special[%i]", index); break; + } } else { const char * filename; switch(file) { @@ -151,7 +177,17 @@ static void rc_print_instruction(FILE * f, struct rc_instruction * inst) inst->I.TexSrcUnit); } - fprintf(f, ";\n"); + fprintf(f, ";"); + + if (inst->I.WriteALUResult) { + fprintf(f, " [aluresult = ("); + rc_print_comparefunc(f, + (inst->I.WriteALUResult == RC_ALURESULT_X) ? "x" : "w", + inst->I.ALUResultCompare, "0"); + fprintf(f, ")]"); + } + + fprintf(f, "\n"); } /** -- cgit v1.2.3 From 995135479d5662d1b1970c0f233c3c3d944d8b4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sun, 4 Oct 2009 11:25:48 +0200 Subject: r300/compiler: Refactor to allow different instruction types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle --- src/gallium/drivers/r300/r300_tgsi_to_rc.c | 32 ++-- src/mesa/drivers/dri/r300/compiler/r300_fragprog.c | 144 ++++++++-------- src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c | 2 +- src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c | 90 +++++----- src/mesa/drivers/dri/r300/compiler/r500_fragprog.c | 144 ++++++++-------- .../drivers/dri/r300/compiler/radeon_compiler.c | 136 +++++++-------- .../dri/r300/compiler/radeon_dataflow_deadcode.c | 32 ++-- .../dri/r300/compiler/radeon_dataflow_swizzles.c | 40 ++--- .../drivers/dri/r300/compiler/radeon_program.c | 12 +- .../drivers/dri/r300/compiler/radeon_program.h | 10 +- .../drivers/dri/r300/compiler/radeon_program_alu.c | 186 ++++++++++----------- .../dri/r300/compiler/radeon_program_pair.c | 2 +- .../dri/r300/compiler/radeon_program_pair.h | 2 - .../dri/r300/compiler/radeon_program_print.c | 20 +-- src/mesa/drivers/dri/r300/r300_vertprog.c | 22 +-- src/mesa/drivers/dri/r300/radeon_mesa_to_rc.c | 18 +- 16 files changed, 449 insertions(+), 443 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/src/gallium/drivers/r300/r300_tgsi_to_rc.c index 1246ffe8c2..cc5e5c19e9 100644 --- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c +++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c @@ -226,31 +226,31 @@ static void transform_texture(struct rc_instruction * dst, struct tgsi_instructi { switch(src.Texture) { case TGSI_TEXTURE_1D: - dst->I.TexSrcTarget = RC_TEXTURE_1D; + dst->U.I.TexSrcTarget = RC_TEXTURE_1D; break; case TGSI_TEXTURE_2D: - dst->I.TexSrcTarget = RC_TEXTURE_2D; + dst->U.I.TexSrcTarget = RC_TEXTURE_2D; break; case TGSI_TEXTURE_3D: - dst->I.TexSrcTarget = RC_TEXTURE_3D; + dst->U.I.TexSrcTarget = RC_TEXTURE_3D; break; case TGSI_TEXTURE_CUBE: - dst->I.TexSrcTarget = RC_TEXTURE_CUBE; + dst->U.I.TexSrcTarget = RC_TEXTURE_CUBE; break; case TGSI_TEXTURE_RECT: - dst->I.TexSrcTarget = RC_TEXTURE_RECT; + dst->U.I.TexSrcTarget = RC_TEXTURE_RECT; break; case TGSI_TEXTURE_SHADOW1D: - dst->I.TexSrcTarget = RC_TEXTURE_1D; - dst->I.TexShadow = 1; + dst->U.I.TexSrcTarget = RC_TEXTURE_1D; + dst->U.I.TexShadow = 1; break; case TGSI_TEXTURE_SHADOW2D: - dst->I.TexSrcTarget = RC_TEXTURE_2D; - dst->I.TexShadow = 1; + dst->U.I.TexSrcTarget = RC_TEXTURE_2D; + dst->U.I.TexShadow = 1; break; case TGSI_TEXTURE_SHADOWRECT: - dst->I.TexSrcTarget = RC_TEXTURE_RECT; - dst->I.TexShadow = 1; + dst->U.I.TexSrcTarget = RC_TEXTURE_RECT; + dst->U.I.TexShadow = 1; break; } } @@ -263,17 +263,17 @@ static void transform_instruction(struct tgsi_to_rc * ttr, struct tgsi_full_inst struct rc_instruction * dst = rc_insert_new_instruction(ttr->compiler, ttr->compiler->Program.Instructions.Prev); int i; - dst->I.Opcode = translate_opcode(src->Instruction.Opcode); - dst->I.SaturateMode = translate_saturate(src->Instruction.Saturate); + dst->U.I.Opcode = translate_opcode(src->Instruction.Opcode); + dst->U.I.SaturateMode = translate_saturate(src->Instruction.Saturate); if (src->Instruction.NumDstRegs) - transform_dstreg(ttr, &dst->I.DstReg, &src->FullDstRegisters[0]); + transform_dstreg(ttr, &dst->U.I.DstReg, &src->FullDstRegisters[0]); for(i = 0; i < src->Instruction.NumSrcRegs; ++i) { if (src->FullSrcRegisters[i].SrcRegister.File == TGSI_FILE_SAMPLER) - dst->I.TexSrcUnit = src->FullSrcRegisters[i].SrcRegister.Index; + dst->U.I.TexSrcUnit = src->FullSrcRegisters[i].SrcRegister.Index; else - transform_srcreg(ttr, &dst->I.SrcReg[i], &src->FullSrcRegisters[i]); + transform_srcreg(ttr, &dst->U.I.SrcReg[i], &src->FullSrcRegisters[i]); } /* Texturing. */ diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog.c index 94f8fdfea3..aa69b0fc72 100644 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog.c @@ -55,75 +55,75 @@ int r300_transform_TEX( struct r300_fragment_program_compiler *compiler = (struct r300_fragment_program_compiler*)data; - if (inst->I.Opcode != RC_OPCODE_TEX && - inst->I.Opcode != RC_OPCODE_TXB && - inst->I.Opcode != RC_OPCODE_TXP && - inst->I.Opcode != RC_OPCODE_KIL) + if (inst->U.I.Opcode != RC_OPCODE_TEX && + inst->U.I.Opcode != RC_OPCODE_TXB && + inst->U.I.Opcode != RC_OPCODE_TXP && + inst->U.I.Opcode != RC_OPCODE_KIL) return 0; /* ARB_shadow & EXT_shadow_funcs */ - if (inst->I.Opcode != RC_OPCODE_KIL && - c->Program.ShadowSamplers & (1 << inst->I.TexSrcUnit)) { - rc_compare_func comparefunc = compiler->state.unit[inst->I.TexSrcUnit].texture_compare_func; + if (inst->U.I.Opcode != RC_OPCODE_KIL && + c->Program.ShadowSamplers & (1 << inst->U.I.TexSrcUnit)) { + rc_compare_func comparefunc = compiler->state.unit[inst->U.I.TexSrcUnit].texture_compare_func; if (comparefunc == RC_COMPARE_FUNC_NEVER || comparefunc == RC_COMPARE_FUNC_ALWAYS) { - inst->I.Opcode = RC_OPCODE_MOV; + inst->U.I.Opcode = RC_OPCODE_MOV; if (comparefunc == RC_COMPARE_FUNC_ALWAYS) { - inst->I.SrcReg[0].File = RC_FILE_NONE; - inst->I.SrcReg[0].Swizzle = RC_SWIZZLE_1111; + inst->U.I.SrcReg[0].File = RC_FILE_NONE; + inst->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_1111; } else { - inst->I.SrcReg[0] = shadow_ambient(c, inst->I.TexSrcUnit); + inst->U.I.SrcReg[0] = shadow_ambient(c, inst->U.I.TexSrcUnit); } return 1; } else { - rc_compare_func comparefunc = compiler->state.unit[inst->I.TexSrcUnit].texture_compare_func; - unsigned int depthmode = compiler->state.unit[inst->I.TexSrcUnit].depth_texture_mode; + rc_compare_func comparefunc = compiler->state.unit[inst->U.I.TexSrcUnit].texture_compare_func; + unsigned int depthmode = compiler->state.unit[inst->U.I.TexSrcUnit].depth_texture_mode; struct rc_instruction * inst_rcp = rc_insert_new_instruction(c, inst); struct rc_instruction * inst_mad = rc_insert_new_instruction(c, inst_rcp); struct rc_instruction * inst_cmp = rc_insert_new_instruction(c, inst_mad); int pass, fail; - inst_rcp->I.Opcode = RC_OPCODE_RCP; - inst_rcp->I.DstReg.File = RC_FILE_TEMPORARY; - inst_rcp->I.DstReg.Index = rc_find_free_temporary(c); - inst_rcp->I.DstReg.WriteMask = RC_MASK_W; - inst_rcp->I.SrcReg[0] = inst->I.SrcReg[0]; - inst_rcp->I.SrcReg[0].Swizzle = RC_SWIZZLE_WWWW; - - inst_cmp->I.DstReg = inst->I.DstReg; - inst->I.DstReg.File = RC_FILE_TEMPORARY; - inst->I.DstReg.Index = rc_find_free_temporary(c); - inst->I.DstReg.WriteMask = RC_MASK_XYZW; - - inst_mad->I.Opcode = RC_OPCODE_MAD; - inst_mad->I.DstReg.File = RC_FILE_TEMPORARY; - inst_mad->I.DstReg.Index = rc_find_free_temporary(c); - inst_mad->I.SrcReg[0] = inst->I.SrcReg[0]; - inst_mad->I.SrcReg[0].Swizzle = RC_SWIZZLE_ZZZZ; - inst_mad->I.SrcReg[1].File = RC_FILE_TEMPORARY; - inst_mad->I.SrcReg[1].Index = inst_rcp->I.DstReg.Index; - inst_mad->I.SrcReg[1].Swizzle = RC_SWIZZLE_WWWW; - inst_mad->I.SrcReg[2].File = RC_FILE_TEMPORARY; - inst_mad->I.SrcReg[2].Index = inst->I.DstReg.Index; + inst_rcp->U.I.Opcode = RC_OPCODE_RCP; + inst_rcp->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_rcp->U.I.DstReg.Index = rc_find_free_temporary(c); + inst_rcp->U.I.DstReg.WriteMask = RC_MASK_W; + inst_rcp->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + inst_rcp->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_WWWW; + + inst_cmp->U.I.DstReg = inst->U.I.DstReg; + inst->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst->U.I.DstReg.Index = rc_find_free_temporary(c); + inst->U.I.DstReg.WriteMask = RC_MASK_XYZW; + + inst_mad->U.I.Opcode = RC_OPCODE_MAD; + inst_mad->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mad->U.I.DstReg.Index = rc_find_free_temporary(c); + inst_mad->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + inst_mad->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_ZZZZ; + inst_mad->U.I.SrcReg[1].File = RC_FILE_TEMPORARY; + inst_mad->U.I.SrcReg[1].Index = inst_rcp->U.I.DstReg.Index; + inst_mad->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_WWWW; + inst_mad->U.I.SrcReg[2].File = RC_FILE_TEMPORARY; + inst_mad->U.I.SrcReg[2].Index = inst->U.I.DstReg.Index; if (depthmode == 0) /* GL_LUMINANCE */ - inst_mad->I.SrcReg[2].Swizzle = RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_Z); + inst_mad->U.I.SrcReg[2].Swizzle = RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_Z); else if (depthmode == 2) /* GL_ALPHA */ - inst_mad->I.SrcReg[2].Swizzle = RC_SWIZZLE_WWWW; + inst_mad->U.I.SrcReg[2].Swizzle = RC_SWIZZLE_WWWW; /* Recall that SrcReg[0] is tex, SrcReg[2] is r and: * r < tex <=> -tex+r < 0 * r >= tex <=> not (-tex+r < 0 */ if (comparefunc == RC_COMPARE_FUNC_LESS || comparefunc == RC_COMPARE_FUNC_GEQUAL) - inst_mad->I.SrcReg[2].Negate = inst_mad->I.SrcReg[2].Negate ^ RC_MASK_XYZW; + inst_mad->U.I.SrcReg[2].Negate = inst_mad->U.I.SrcReg[2].Negate ^ RC_MASK_XYZW; else - inst_mad->I.SrcReg[0].Negate = inst_mad->I.SrcReg[0].Negate ^ RC_MASK_XYZW; + inst_mad->U.I.SrcReg[0].Negate = inst_mad->U.I.SrcReg[0].Negate ^ RC_MASK_XYZW; - inst_cmp->I.Opcode = RC_OPCODE_CMP; + inst_cmp->U.I.Opcode = RC_OPCODE_CMP; /* DstReg has been filled out above */ - inst_cmp->I.SrcReg[0].File = RC_FILE_TEMPORARY; - inst_cmp->I.SrcReg[0].Index = inst_mad->I.DstReg.Index; + inst_cmp->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst_cmp->U.I.SrcReg[0].Index = inst_mad->U.I.DstReg.Index; if (comparefunc == RC_COMPARE_FUNC_LESS || comparefunc == RC_COMPARE_FUNC_GREATER) { pass = 1; @@ -133,9 +133,9 @@ int r300_transform_TEX( fail = 1; } - inst_cmp->I.SrcReg[pass].File = RC_FILE_NONE; - inst_cmp->I.SrcReg[pass].Swizzle = RC_SWIZZLE_1111; - inst_cmp->I.SrcReg[fail] = shadow_ambient(c, inst->I.TexSrcUnit); + inst_cmp->U.I.SrcReg[pass].File = RC_FILE_NONE; + inst_cmp->U.I.SrcReg[pass].Swizzle = RC_SWIZZLE_1111; + inst_cmp->U.I.SrcReg[fail] = shadow_ambient(c, inst->U.I.TexSrcUnit); } } @@ -143,49 +143,49 @@ int r300_transform_TEX( * instead of [0..Width]x[0..Height]. * Add a scaling instruction. */ - if (inst->I.Opcode != RC_OPCODE_KIL && inst->I.TexSrcTarget == RC_TEXTURE_RECT) { + if (inst->U.I.Opcode != RC_OPCODE_KIL && inst->U.I.TexSrcTarget == RC_TEXTURE_RECT) { struct rc_instruction * inst_mul = rc_insert_new_instruction(c, inst->Prev); - inst_mul->I.Opcode = RC_OPCODE_MUL; - inst_mul->I.DstReg.File = RC_FILE_TEMPORARY; - inst_mul->I.DstReg.Index = rc_find_free_temporary(c); - inst_mul->I.SrcReg[0] = inst->I.SrcReg[0]; - inst_mul->I.SrcReg[1].File = RC_FILE_CONSTANT; - inst_mul->I.SrcReg[1].Index = rc_constants_add_state(&c->Program.Constants, RC_STATE_R300_TEXRECT_FACTOR, inst->I.TexSrcUnit); + inst_mul->U.I.Opcode = RC_OPCODE_MUL; + inst_mul->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mul->U.I.DstReg.Index = rc_find_free_temporary(c); + inst_mul->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + inst_mul->U.I.SrcReg[1].File = RC_FILE_CONSTANT; + inst_mul->U.I.SrcReg[1].Index = rc_constants_add_state(&c->Program.Constants, RC_STATE_R300_TEXRECT_FACTOR, inst->U.I.TexSrcUnit); - reset_srcreg(&inst->I.SrcReg[0]); - inst->I.SrcReg[0].File = RC_FILE_TEMPORARY; - inst->I.SrcReg[0].Index = inst_mul->I.DstReg.Index; + reset_srcreg(&inst->U.I.SrcReg[0]); + inst->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst->U.I.SrcReg[0].Index = inst_mul->U.I.DstReg.Index; } /* Cannot write texture to output registers or with masks */ - if (inst->I.Opcode != RC_OPCODE_KIL && - (inst->I.DstReg.File != RC_FILE_TEMPORARY || inst->I.DstReg.WriteMask != RC_MASK_XYZW)) { + if (inst->U.I.Opcode != RC_OPCODE_KIL && + (inst->U.I.DstReg.File != RC_FILE_TEMPORARY || inst->U.I.DstReg.WriteMask != RC_MASK_XYZW)) { struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst); - inst_mov->I.Opcode = RC_OPCODE_MOV; - inst_mov->I.DstReg = inst->I.DstReg; - inst_mov->I.SrcReg[0].File = RC_FILE_TEMPORARY; - inst_mov->I.SrcReg[0].Index = rc_find_free_temporary(c); + inst_mov->U.I.Opcode = RC_OPCODE_MOV; + inst_mov->U.I.DstReg = inst->U.I.DstReg; + inst_mov->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst_mov->U.I.SrcReg[0].Index = rc_find_free_temporary(c); - inst->I.DstReg.File = RC_FILE_TEMPORARY; - inst->I.DstReg.Index = inst_mov->I.SrcReg[0].Index; - inst->I.DstReg.WriteMask = RC_MASK_XYZW; + inst->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst->U.I.DstReg.Index = inst_mov->U.I.SrcReg[0].Index; + inst->U.I.DstReg.WriteMask = RC_MASK_XYZW; } /* Cannot read texture coordinate from constants file */ - if (inst->I.SrcReg[0].File != RC_FILE_TEMPORARY && inst->I.SrcReg[0].File != RC_FILE_INPUT) { + if (inst->U.I.SrcReg[0].File != RC_FILE_TEMPORARY && inst->U.I.SrcReg[0].File != RC_FILE_INPUT) { struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst->Prev); - inst_mov->I.Opcode = RC_OPCODE_MOV; - inst_mov->I.DstReg.File = RC_FILE_TEMPORARY; - inst_mov->I.DstReg.Index = rc_find_free_temporary(c); - inst_mov->I.SrcReg[0] = inst->I.SrcReg[0]; + inst_mov->U.I.Opcode = RC_OPCODE_MOV; + inst_mov->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mov->U.I.DstReg.Index = rc_find_free_temporary(c); + inst_mov->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; - reset_srcreg(&inst->I.SrcReg[0]); - inst->I.SrcReg[0].File = RC_FILE_TEMPORARY; - inst->I.SrcReg[0].Index = inst_mov->I.DstReg.Index; + reset_srcreg(&inst->U.I.SrcReg[0]); + inst->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst->U.I.SrcReg[0].Index = inst_mov->U.I.DstReg.Index; } return 1; diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c index 614c2e3d24..746e4495fe 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c @@ -44,7 +44,7 @@ static void rewrite_depth_out(struct r300_fragment_program_compiler * c) struct rc_instruction *rci; for (rci = c->Base.Program.Instructions.Next; rci != &c->Base.Program.Instructions; rci = rci->Next) { - struct rc_sub_instruction * inst = &rci->I; + struct rc_sub_instruction * inst = &rci->U.I; if (inst->DstReg.File != RC_FILE_OUTPUT || inst->DstReg.Index != c->OutputDepth) continue; diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c index e1e735568d..1b2cb8dde7 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog.c @@ -341,7 +341,7 @@ static void translate_vertex_program(struct r300_vertex_program_compiler * compi compiler->SetHwInputOutput(compiler); for(rci = compiler->Base.Program.Instructions.Next; rci != &compiler->Base.Program.Instructions; rci = rci->Next) { - struct rc_sub_instruction *vpi = &rci->I; + struct rc_sub_instruction *vpi = &rci->U.I; unsigned int *inst = compiler->code->body.d + compiler->code->length; /* Skip instructions writing to non-existing destination */ @@ -405,19 +405,19 @@ static void allocate_temporary_registers(struct r300_vertex_program_compiler * c /* Pass 1: Count original temporaries and allocate structures */ for(inst = compiler->Base.Program.Instructions.Next; inst != &compiler->Base.Program.Instructions; inst = inst->Next) { - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); for (i = 0; i < opcode->NumSrcRegs; ++i) { - if (inst->I.SrcReg[i].File == RC_FILE_TEMPORARY) { - if (inst->I.SrcReg[i].Index >= num_orig_temps) - num_orig_temps = inst->I.SrcReg[i].Index + 1; + if (inst->U.I.SrcReg[i].File == RC_FILE_TEMPORARY) { + if (inst->U.I.SrcReg[i].Index >= num_orig_temps) + num_orig_temps = inst->U.I.SrcReg[i].Index + 1; } } if (opcode->HasDstReg) { - if (inst->I.DstReg.File == RC_FILE_TEMPORARY) { - if (inst->I.DstReg.Index >= num_orig_temps) - num_orig_temps = inst->I.DstReg.Index + 1; + if (inst->U.I.DstReg.File == RC_FILE_TEMPORARY) { + if (inst->U.I.DstReg.Index >= num_orig_temps) + num_orig_temps = inst->U.I.DstReg.Index + 1; } } } @@ -428,22 +428,22 @@ static void allocate_temporary_registers(struct r300_vertex_program_compiler * c /* Pass 2: Determine original temporary lifetimes */ for(inst = compiler->Base.Program.Instructions.Next; inst != &compiler->Base.Program.Instructions; inst = inst->Next) { - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); for (i = 0; i < opcode->NumSrcRegs; ++i) { - if (inst->I.SrcReg[i].File == RC_FILE_TEMPORARY) - ta[inst->I.SrcReg[i].Index].LastRead = inst; + if (inst->U.I.SrcReg[i].File == RC_FILE_TEMPORARY) + ta[inst->U.I.SrcReg[i].Index].LastRead = inst; } } /* Pass 3: Register allocation */ for(inst = compiler->Base.Program.Instructions.Next; inst != &compiler->Base.Program.Instructions; inst = inst->Next) { - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); for (i = 0; i < opcode->NumSrcRegs; ++i) { - if (inst->I.SrcReg[i].File == RC_FILE_TEMPORARY) { - unsigned int orig = inst->I.SrcReg[i].Index; - inst->I.SrcReg[i].Index = ta[orig].HwTemp; + if (inst->U.I.SrcReg[i].File == RC_FILE_TEMPORARY) { + unsigned int orig = inst->U.I.SrcReg[i].Index; + inst->U.I.SrcReg[i].Index = ta[orig].HwTemp; if (ta[orig].Allocated && inst == ta[orig].LastRead) hwtemps[ta[orig].HwTemp] = 0; @@ -451,8 +451,8 @@ static void allocate_temporary_registers(struct r300_vertex_program_compiler * c } if (opcode->HasDstReg) { - if (inst->I.DstReg.File == RC_FILE_TEMPORARY) { - unsigned int orig = inst->I.DstReg.Index; + if (inst->U.I.DstReg.File == RC_FILE_TEMPORARY) { + unsigned int orig = inst->U.I.DstReg.Index; if (!ta[orig].Allocated) { for(j = 0; j < VSF_MAX_FRAGMENT_TEMPS; ++j) { @@ -471,7 +471,7 @@ static void allocate_temporary_registers(struct r300_vertex_program_compiler * c } } - inst->I.DstReg.Index = ta[orig].HwTemp; + inst->U.I.DstReg.Index = ta[orig].HwTemp; } } } @@ -487,36 +487,36 @@ static int transform_source_conflicts( struct rc_instruction* inst, void* unused) { - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); if (opcode->NumSrcRegs == 3) { - if (t_src_conflict(inst->I.SrcReg[1], inst->I.SrcReg[2]) - || t_src_conflict(inst->I.SrcReg[0], inst->I.SrcReg[2])) { + if (t_src_conflict(inst->U.I.SrcReg[1], inst->U.I.SrcReg[2]) + || t_src_conflict(inst->U.I.SrcReg[0], inst->U.I.SrcReg[2])) { int tmpreg = rc_find_free_temporary(c); struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst->Prev); - inst_mov->I.Opcode = RC_OPCODE_MOV; - inst_mov->I.DstReg.File = RC_FILE_TEMPORARY; - inst_mov->I.DstReg.Index = tmpreg; - inst_mov->I.SrcReg[0] = inst->I.SrcReg[2]; - - reset_srcreg(&inst->I.SrcReg[2]); - inst->I.SrcReg[2].File = RC_FILE_TEMPORARY; - inst->I.SrcReg[2].Index = tmpreg; + inst_mov->U.I.Opcode = RC_OPCODE_MOV; + inst_mov->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mov->U.I.DstReg.Index = tmpreg; + inst_mov->U.I.SrcReg[0] = inst->U.I.SrcReg[2]; + + reset_srcreg(&inst->U.I.SrcReg[2]); + inst->U.I.SrcReg[2].File = RC_FILE_TEMPORARY; + inst->U.I.SrcReg[2].Index = tmpreg; } } if (opcode->NumSrcRegs >= 2) { - if (t_src_conflict(inst->I.SrcReg[1], inst->I.SrcReg[0])) { + if (t_src_conflict(inst->U.I.SrcReg[1], inst->U.I.SrcReg[0])) { int tmpreg = rc_find_free_temporary(c); struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst->Prev); - inst_mov->I.Opcode = RC_OPCODE_MOV; - inst_mov->I.DstReg.File = RC_FILE_TEMPORARY; - inst_mov->I.DstReg.Index = tmpreg; - inst_mov->I.SrcReg[0] = inst->I.SrcReg[1]; - - reset_srcreg(&inst->I.SrcReg[1]); - inst->I.SrcReg[1].File = RC_FILE_TEMPORARY; - inst->I.SrcReg[1].Index = tmpreg; + inst_mov->U.I.Opcode = RC_OPCODE_MOV; + inst_mov->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mov->U.I.DstReg.Index = tmpreg; + inst_mov->U.I.SrcReg[0] = inst->U.I.SrcReg[1]; + + reset_srcreg(&inst->U.I.SrcReg[1]); + inst->U.I.SrcReg[1].File = RC_FILE_TEMPORARY; + inst->U.I.SrcReg[1].Index = tmpreg; } } @@ -531,15 +531,15 @@ static void addArtificialOutputs(struct r300_vertex_program_compiler * compiler) if ((compiler->RequiredOutputs & (1 << i)) && !(compiler->Base.Program.OutputsWritten & (1 << i))) { struct rc_instruction * inst = rc_insert_new_instruction(&compiler->Base, compiler->Base.Program.Instructions.Prev); - inst->I.Opcode = RC_OPCODE_MOV; + inst->U.I.Opcode = RC_OPCODE_MOV; - inst->I.DstReg.File = RC_FILE_OUTPUT; - inst->I.DstReg.Index = i; - inst->I.DstReg.WriteMask = RC_MASK_XYZW; + inst->U.I.DstReg.File = RC_FILE_OUTPUT; + inst->U.I.DstReg.Index = i; + inst->U.I.DstReg.WriteMask = RC_MASK_XYZW; - inst->I.SrcReg[0].File = RC_FILE_CONSTANT; - inst->I.SrcReg[0].Index = 0; - inst->I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZW; + inst->U.I.SrcReg[0].File = RC_FILE_CONSTANT; + inst->U.I.SrcReg[0].Index = 0; + inst->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZW; compiler->Base.Program.OutputsWritten |= 1 << i; } diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c index 39f2445bd4..d87acecdab 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog.c @@ -54,75 +54,75 @@ int r500_transform_TEX( struct r300_fragment_program_compiler *compiler = (struct r300_fragment_program_compiler*)data; - if (inst->I.Opcode != RC_OPCODE_TEX && - inst->I.Opcode != RC_OPCODE_TXB && - inst->I.Opcode != RC_OPCODE_TXP && - inst->I.Opcode != RC_OPCODE_KIL) + if (inst->U.I.Opcode != RC_OPCODE_TEX && + inst->U.I.Opcode != RC_OPCODE_TXB && + inst->U.I.Opcode != RC_OPCODE_TXP && + inst->U.I.Opcode != RC_OPCODE_KIL) return 0; /* ARB_shadow & EXT_shadow_funcs */ - if (inst->I.Opcode != RC_OPCODE_KIL && - c->Program.ShadowSamplers & (1 << inst->I.TexSrcUnit)) { - rc_compare_func comparefunc = compiler->state.unit[inst->I.TexSrcUnit].texture_compare_func; + if (inst->U.I.Opcode != RC_OPCODE_KIL && + c->Program.ShadowSamplers & (1 << inst->U.I.TexSrcUnit)) { + rc_compare_func comparefunc = compiler->state.unit[inst->U.I.TexSrcUnit].texture_compare_func; if (comparefunc == RC_COMPARE_FUNC_NEVER || comparefunc == RC_COMPARE_FUNC_ALWAYS) { - inst->I.Opcode = RC_OPCODE_MOV; + inst->U.I.Opcode = RC_OPCODE_MOV; if (comparefunc == RC_COMPARE_FUNC_ALWAYS) { - inst->I.SrcReg[0].File = RC_FILE_NONE; - inst->I.SrcReg[0].Swizzle = RC_SWIZZLE_1111; + inst->U.I.SrcReg[0].File = RC_FILE_NONE; + inst->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_1111; } else { - inst->I.SrcReg[0] = shadow_ambient(c, inst->I.TexSrcUnit); + inst->U.I.SrcReg[0] = shadow_ambient(c, inst->U.I.TexSrcUnit); } return 1; } else { - rc_compare_func comparefunc = compiler->state.unit[inst->I.TexSrcUnit].texture_compare_func; - unsigned int depthmode = compiler->state.unit[inst->I.TexSrcUnit].depth_texture_mode; + rc_compare_func comparefunc = compiler->state.unit[inst->U.I.TexSrcUnit].texture_compare_func; + unsigned int depthmode = compiler->state.unit[inst->U.I.TexSrcUnit].depth_texture_mode; struct rc_instruction * inst_rcp = rc_insert_new_instruction(c, inst); struct rc_instruction * inst_mad = rc_insert_new_instruction(c, inst_rcp); struct rc_instruction * inst_cmp = rc_insert_new_instruction(c, inst_mad); int pass, fail; - inst_rcp->I.Opcode = RC_OPCODE_RCP; - inst_rcp->I.DstReg.File = RC_FILE_TEMPORARY; - inst_rcp->I.DstReg.Index = rc_find_free_temporary(c); - inst_rcp->I.DstReg.WriteMask = RC_MASK_W; - inst_rcp->I.SrcReg[0] = inst->I.SrcReg[0]; - inst_rcp->I.SrcReg[0].Swizzle = RC_SWIZZLE_WWWW; - - inst_cmp->I.DstReg = inst->I.DstReg; - inst->I.DstReg.File = RC_FILE_TEMPORARY; - inst->I.DstReg.Index = rc_find_free_temporary(c); - inst->I.DstReg.WriteMask = RC_MASK_XYZW; - - inst_mad->I.Opcode = RC_OPCODE_MAD; - inst_mad->I.DstReg.File = RC_FILE_TEMPORARY; - inst_mad->I.DstReg.Index = rc_find_free_temporary(c); - inst_mad->I.SrcReg[0] = inst->I.SrcReg[0]; - inst_mad->I.SrcReg[0].Swizzle = RC_SWIZZLE_ZZZZ; - inst_mad->I.SrcReg[1].File = RC_FILE_TEMPORARY; - inst_mad->I.SrcReg[1].Index = inst_rcp->I.DstReg.Index; - inst_mad->I.SrcReg[1].Swizzle = RC_SWIZZLE_WWWW; - inst_mad->I.SrcReg[2].File = RC_FILE_TEMPORARY; - inst_mad->I.SrcReg[2].Index = inst->I.DstReg.Index; + inst_rcp->U.I.Opcode = RC_OPCODE_RCP; + inst_rcp->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_rcp->U.I.DstReg.Index = rc_find_free_temporary(c); + inst_rcp->U.I.DstReg.WriteMask = RC_MASK_W; + inst_rcp->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + inst_rcp->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_WWWW; + + inst_cmp->U.I.DstReg = inst->U.I.DstReg; + inst->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst->U.I.DstReg.Index = rc_find_free_temporary(c); + inst->U.I.DstReg.WriteMask = RC_MASK_XYZW; + + inst_mad->U.I.Opcode = RC_OPCODE_MAD; + inst_mad->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mad->U.I.DstReg.Index = rc_find_free_temporary(c); + inst_mad->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + inst_mad->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_ZZZZ; + inst_mad->U.I.SrcReg[1].File = RC_FILE_TEMPORARY; + inst_mad->U.I.SrcReg[1].Index = inst_rcp->U.I.DstReg.Index; + inst_mad->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_WWWW; + inst_mad->U.I.SrcReg[2].File = RC_FILE_TEMPORARY; + inst_mad->U.I.SrcReg[2].Index = inst->U.I.DstReg.Index; if (depthmode == 0) /* GL_LUMINANCE */ - inst_mad->I.SrcReg[2].Swizzle = RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_Z); + inst_mad->U.I.SrcReg[2].Swizzle = RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_Z); else if (depthmode == 2) /* GL_ALPHA */ - inst_mad->I.SrcReg[2].Swizzle = RC_SWIZZLE_WWWW; + inst_mad->U.I.SrcReg[2].Swizzle = RC_SWIZZLE_WWWW; /* Recall that SrcReg[0] is tex, SrcReg[2] is r and: * r < tex <=> -tex+r < 0 * r >= tex <=> not (-tex+r < 0 */ if (comparefunc == RC_COMPARE_FUNC_LESS || comparefunc == RC_COMPARE_FUNC_GEQUAL) - inst_mad->I.SrcReg[2].Negate = inst_mad->I.SrcReg[2].Negate ^ RC_MASK_XYZW; + inst_mad->U.I.SrcReg[2].Negate = inst_mad->U.I.SrcReg[2].Negate ^ RC_MASK_XYZW; else - inst_mad->I.SrcReg[0].Negate = inst_mad->I.SrcReg[0].Negate ^ RC_MASK_XYZW; + inst_mad->U.I.SrcReg[0].Negate = inst_mad->U.I.SrcReg[0].Negate ^ RC_MASK_XYZW; - inst_cmp->I.Opcode = RC_OPCODE_CMP; + inst_cmp->U.I.Opcode = RC_OPCODE_CMP; /* DstReg has been filled out above */ - inst_cmp->I.SrcReg[0].File = RC_FILE_TEMPORARY; - inst_cmp->I.SrcReg[0].Index = inst_mad->I.DstReg.Index; + inst_cmp->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst_cmp->U.I.SrcReg[0].Index = inst_mad->U.I.DstReg.Index; if (comparefunc == RC_COMPARE_FUNC_LESS || comparefunc == RC_COMPARE_FUNC_GREATER) { pass = 1; @@ -132,38 +132,38 @@ int r500_transform_TEX( fail = 1; } - inst_cmp->I.SrcReg[pass].File = RC_FILE_NONE; - inst_cmp->I.SrcReg[pass].Swizzle = RC_SWIZZLE_1111; - inst_cmp->I.SrcReg[fail] = shadow_ambient(c, inst->I.TexSrcUnit); + inst_cmp->U.I.SrcReg[pass].File = RC_FILE_NONE; + inst_cmp->U.I.SrcReg[pass].Swizzle = RC_SWIZZLE_1111; + inst_cmp->U.I.SrcReg[fail] = shadow_ambient(c, inst->U.I.TexSrcUnit); } } /* Cannot write texture to output registers */ - if (inst->I.Opcode != RC_OPCODE_KIL && inst->I.DstReg.File != RC_FILE_TEMPORARY) { + if (inst->U.I.Opcode != RC_OPCODE_KIL && inst->U.I.DstReg.File != RC_FILE_TEMPORARY) { struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst); - inst_mov->I.Opcode = RC_OPCODE_MOV; - inst_mov->I.DstReg = inst->I.DstReg; - inst_mov->I.SrcReg[0].File = RC_FILE_TEMPORARY; - inst_mov->I.SrcReg[0].Index = rc_find_free_temporary(c); + inst_mov->U.I.Opcode = RC_OPCODE_MOV; + inst_mov->U.I.DstReg = inst->U.I.DstReg; + inst_mov->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst_mov->U.I.SrcReg[0].Index = rc_find_free_temporary(c); - inst->I.DstReg.File = RC_FILE_TEMPORARY; - inst->I.DstReg.Index = inst_mov->I.SrcReg[0].Index; - inst->I.DstReg.WriteMask = RC_MASK_XYZW; + inst->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst->U.I.DstReg.Index = inst_mov->U.I.SrcReg[0].Index; + inst->U.I.DstReg.WriteMask = RC_MASK_XYZW; } /* Cannot read texture coordinate from constants file */ - if (inst->I.SrcReg[0].File != RC_FILE_TEMPORARY && inst->I.SrcReg[0].File != RC_FILE_INPUT) { + if (inst->U.I.SrcReg[0].File != RC_FILE_TEMPORARY && inst->U.I.SrcReg[0].File != RC_FILE_INPUT) { struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst->Prev); - inst_mov->I.Opcode = RC_OPCODE_MOV; - inst_mov->I.DstReg.File = RC_FILE_TEMPORARY; - inst_mov->I.DstReg.Index = rc_find_free_temporary(c); - inst_mov->I.SrcReg[0] = inst->I.SrcReg[0]; + inst_mov->U.I.Opcode = RC_OPCODE_MOV; + inst_mov->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mov->U.I.DstReg.Index = rc_find_free_temporary(c); + inst_mov->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; - reset_srcreg(&inst->I.SrcReg[0]); - inst->I.SrcReg[0].File = RC_FILE_TEMPORARY; - inst->I.SrcReg[0].Index = inst_mov->I.DstReg.Index; + reset_srcreg(&inst->U.I.SrcReg[0]); + inst->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst->U.I.SrcReg[0].Index = inst_mov->U.I.DstReg.Index; } return 1; @@ -177,22 +177,22 @@ int r500_transform_IF( struct rc_instruction * inst, void* data) { - if (inst->I.Opcode != RC_OPCODE_IF) + if (inst->U.I.Opcode != RC_OPCODE_IF) return 0; struct rc_instruction * inst_mov = rc_insert_new_instruction(c, inst->Prev); - inst_mov->I.Opcode = RC_OPCODE_MOV; - inst_mov->I.DstReg.WriteMask = 0; - inst_mov->I.WriteALUResult = RC_ALURESULT_W; - inst_mov->I.ALUResultCompare = RC_COMPARE_FUNC_NOTEQUAL; - inst_mov->I.SrcReg[0] = inst->I.SrcReg[0]; - inst_mov->I.SrcReg[0].Swizzle = combine_swizzles4(inst_mov->I.SrcReg[0].Swizzle, + inst_mov->U.I.Opcode = RC_OPCODE_MOV; + inst_mov->U.I.DstReg.WriteMask = 0; + inst_mov->U.I.WriteALUResult = RC_ALURESULT_W; + inst_mov->U.I.ALUResultCompare = RC_COMPARE_FUNC_NOTEQUAL; + inst_mov->U.I.SrcReg[0] = inst->U.I.SrcReg[0]; + inst_mov->U.I.SrcReg[0].Swizzle = combine_swizzles4(inst_mov->U.I.SrcReg[0].Swizzle, RC_SWIZZLE_UNUSED, RC_SWIZZLE_UNUSED, RC_SWIZZLE_UNUSED, RC_SWIZZLE_X); - inst->I.SrcReg[0].File = RC_FILE_SPECIAL; - inst->I.SrcReg[0].Index = RC_SPECIAL_ALU_RESULT; - inst->I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZW; - inst->I.SrcReg[0].Negate = 0; + inst->U.I.SrcReg[0].File = RC_FILE_SPECIAL; + inst->U.I.SrcReg[0].Index = RC_SPECIAL_ALU_RESULT; + inst->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZW; + inst->U.I.SrcReg[0].Negate = 0; return 1; } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c index d0b78ec1c8..c0e7a7f7a0 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_compiler.c @@ -36,7 +36,7 @@ void rc_init(struct radeon_compiler * c) memory_pool_init(&c->Pool); c->Program.Instructions.Prev = &c->Program.Instructions; c->Program.Instructions.Next = &c->Program.Instructions; - c->Program.Instructions.I.Opcode = RC_OPCODE_ILLEGAL_OPCODE; + c->Program.Instructions.U.I.Opcode = RC_OPCODE_ILLEGAL_OPCODE; } void rc_destroy(struct radeon_compiler * c) @@ -113,17 +113,17 @@ void rc_calculate_inputs_outputs(struct radeon_compiler * c) for(inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next) { - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); int i; for (i = 0; i < opcode->NumSrcRegs; ++i) { - if (inst->I.SrcReg[i].File == RC_FILE_INPUT) - c->Program.InputsRead |= 1 << inst->I.SrcReg[i].Index; + if (inst->U.I.SrcReg[i].File == RC_FILE_INPUT) + c->Program.InputsRead |= 1 << inst->U.I.SrcReg[i].Index; } if (opcode->HasDstReg) { - if (inst->I.DstReg.File == RC_FILE_OUTPUT) - c->Program.OutputsWritten |= 1 << inst->I.DstReg.Index; + if (inst->U.I.DstReg.File == RC_FILE_OUTPUT) + c->Program.OutputsWritten |= 1 << inst->U.I.DstReg.Index; } } } @@ -139,17 +139,17 @@ void rc_move_input(struct radeon_compiler * c, unsigned input, struct rc_src_reg c->Program.InputsRead &= ~(1 << input); for(inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next) { - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); unsigned i; for(i = 0; i < opcode->NumSrcRegs; ++i) { - if (inst->I.SrcReg[i].File == RC_FILE_INPUT && inst->I.SrcReg[i].Index == input) { - inst->I.SrcReg[i].File = new_input.File; - inst->I.SrcReg[i].Index = new_input.Index; - inst->I.SrcReg[i].Swizzle = combine_swizzles(new_input.Swizzle, inst->I.SrcReg[i].Swizzle); - if (!inst->I.SrcReg[i].Abs) { - inst->I.SrcReg[i].Negate ^= new_input.Negate; - inst->I.SrcReg[i].Abs = new_input.Abs; + if (inst->U.I.SrcReg[i].File == RC_FILE_INPUT && inst->U.I.SrcReg[i].Index == input) { + inst->U.I.SrcReg[i].File = new_input.File; + inst->U.I.SrcReg[i].Index = new_input.Index; + inst->U.I.SrcReg[i].Swizzle = combine_swizzles(new_input.Swizzle, inst->U.I.SrcReg[i].Swizzle); + if (!inst->U.I.SrcReg[i].Abs) { + inst->U.I.SrcReg[i].Negate ^= new_input.Negate; + inst->U.I.SrcReg[i].Abs = new_input.Abs; } c->Program.InputsRead |= 1 << new_input.Index; @@ -171,12 +171,12 @@ void rc_move_output(struct radeon_compiler * c, unsigned output, unsigned new_ou c->Program.OutputsWritten &= ~(1 << output); for(inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next) { - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); if (opcode->HasDstReg) { - if (inst->I.DstReg.File == RC_FILE_OUTPUT && inst->I.DstReg.Index == output) { - inst->I.DstReg.Index = new_output; - inst->I.DstReg.WriteMask &= writemask; + if (inst->U.I.DstReg.File == RC_FILE_OUTPUT && inst->U.I.DstReg.Index == output) { + inst->U.I.DstReg.Index = new_output; + inst->U.I.DstReg.WriteMask &= writemask; c->Program.OutputsWritten |= 1 << new_output; } @@ -194,33 +194,33 @@ void rc_copy_output(struct radeon_compiler * c, unsigned output, unsigned dup_ou struct rc_instruction * inst; for(inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next) { - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); if (opcode->HasDstReg) { - if (inst->I.DstReg.File == RC_FILE_OUTPUT && inst->I.DstReg.Index == output) { - inst->I.DstReg.File = RC_FILE_TEMPORARY; - inst->I.DstReg.Index = tempreg; + if (inst->U.I.DstReg.File == RC_FILE_OUTPUT && inst->U.I.DstReg.Index == output) { + inst->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst->U.I.DstReg.Index = tempreg; } } } inst = rc_insert_new_instruction(c, c->Program.Instructions.Prev); - inst->I.Opcode = RC_OPCODE_MOV; - inst->I.DstReg.File = RC_FILE_OUTPUT; - inst->I.DstReg.Index = output; + inst->U.I.Opcode = RC_OPCODE_MOV; + inst->U.I.DstReg.File = RC_FILE_OUTPUT; + inst->U.I.DstReg.Index = output; - inst->I.SrcReg[0].File = RC_FILE_TEMPORARY; - inst->I.SrcReg[0].Index = tempreg; - inst->I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZW; + inst->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst->U.I.SrcReg[0].Index = tempreg; + inst->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZW; inst = rc_insert_new_instruction(c, c->Program.Instructions.Prev); - inst->I.Opcode = RC_OPCODE_MOV; - inst->I.DstReg.File = RC_FILE_OUTPUT; - inst->I.DstReg.Index = dup_output; + inst->U.I.Opcode = RC_OPCODE_MOV; + inst->U.I.DstReg.File = RC_FILE_OUTPUT; + inst->U.I.DstReg.Index = dup_output; - inst->I.SrcReg[0].File = RC_FILE_TEMPORARY; - inst->I.SrcReg[0].Index = tempreg; - inst->I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZW; + inst->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst->U.I.SrcReg[0].Index = tempreg; + inst->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZW; c->Program.OutputsWritten |= 1 << dup_output; } @@ -238,60 +238,60 @@ void rc_transform_fragment_wpos(struct radeon_compiler * c, unsigned wpos, unsig /* perspective divide */ struct rc_instruction * inst_rcp = rc_insert_new_instruction(c, &c->Program.Instructions); - inst_rcp->I.Opcode = RC_OPCODE_RCP; + inst_rcp->U.I.Opcode = RC_OPCODE_RCP; - inst_rcp->I.DstReg.File = RC_FILE_TEMPORARY; - inst_rcp->I.DstReg.Index = tempregi; - inst_rcp->I.DstReg.WriteMask = RC_MASK_W; + inst_rcp->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_rcp->U.I.DstReg.Index = tempregi; + inst_rcp->U.I.DstReg.WriteMask = RC_MASK_W; - inst_rcp->I.SrcReg[0].File = RC_FILE_INPUT; - inst_rcp->I.SrcReg[0].Index = new_input; - inst_rcp->I.SrcReg[0].Swizzle = RC_SWIZZLE_WWWW; + inst_rcp->U.I.SrcReg[0].File = RC_FILE_INPUT; + inst_rcp->U.I.SrcReg[0].Index = new_input; + inst_rcp->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_WWWW; struct rc_instruction * inst_mul = rc_insert_new_instruction(c, inst_rcp); - inst_mul->I.Opcode = RC_OPCODE_MUL; + inst_mul->U.I.Opcode = RC_OPCODE_MUL; - inst_mul->I.DstReg.File = RC_FILE_TEMPORARY; - inst_mul->I.DstReg.Index = tempregi; - inst_mul->I.DstReg.WriteMask = RC_MASK_XYZ; + inst_mul->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mul->U.I.DstReg.Index = tempregi; + inst_mul->U.I.DstReg.WriteMask = RC_MASK_XYZ; - inst_mul->I.SrcReg[0].File = RC_FILE_INPUT; - inst_mul->I.SrcReg[0].Index = new_input; + inst_mul->U.I.SrcReg[0].File = RC_FILE_INPUT; + inst_mul->U.I.SrcReg[0].Index = new_input; - inst_mul->I.SrcReg[1].File = RC_FILE_TEMPORARY; - inst_mul->I.SrcReg[1].Index = tempregi; - inst_mul->I.SrcReg[1].Swizzle = RC_SWIZZLE_WWWW; + inst_mul->U.I.SrcReg[1].File = RC_FILE_TEMPORARY; + inst_mul->U.I.SrcReg[1].Index = tempregi; + inst_mul->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_WWWW; /* viewport transformation */ struct rc_instruction * inst_mad = rc_insert_new_instruction(c, inst_mul); - inst_mad->I.Opcode = RC_OPCODE_MAD; + inst_mad->U.I.Opcode = RC_OPCODE_MAD; - inst_mad->I.DstReg.File = RC_FILE_TEMPORARY; - inst_mad->I.DstReg.Index = tempregi; - inst_mad->I.DstReg.WriteMask = RC_MASK_XYZ; + inst_mad->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst_mad->U.I.DstReg.Index = tempregi; + inst_mad->U.I.DstReg.WriteMask = RC_MASK_XYZ; - inst_mad->I.SrcReg[0].File = RC_FILE_TEMPORARY; - inst_mad->I.SrcReg[0].Index = tempregi; - inst_mad->I.SrcReg[0].Swizzle = RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_ZERO); + inst_mad->U.I.SrcReg[0].File = RC_FILE_TEMPORARY; + inst_mad->U.I.SrcReg[0].Index = tempregi; + inst_mad->U.I.SrcReg[0].Swizzle = RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_ZERO); - inst_mad->I.SrcReg[1].File = RC_FILE_CONSTANT; - inst_mad->I.SrcReg[1].Index = rc_constants_add_state(&c->Program.Constants, RC_STATE_R300_WINDOW_DIMENSION, 0); - inst_mad->I.SrcReg[1].Swizzle = RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_ZERO); + inst_mad->U.I.SrcReg[1].File = RC_FILE_CONSTANT; + inst_mad->U.I.SrcReg[1].Index = rc_constants_add_state(&c->Program.Constants, RC_STATE_R300_WINDOW_DIMENSION, 0); + inst_mad->U.I.SrcReg[1].Swizzle = RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_ZERO); - inst_mad->I.SrcReg[2].File = RC_FILE_CONSTANT; - inst_mad->I.SrcReg[2].Index = inst_mad->I.SrcReg[1].Index; - inst_mad->I.SrcReg[2].Swizzle = RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_ZERO); + inst_mad->U.I.SrcReg[2].File = RC_FILE_CONSTANT; + inst_mad->U.I.SrcReg[2].Index = inst_mad->U.I.SrcReg[1].Index; + inst_mad->U.I.SrcReg[2].Swizzle = RC_MAKE_SWIZZLE(RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_ZERO); struct rc_instruction * inst; for (inst = inst_mad->Next; inst != &c->Program.Instructions; inst = inst->Next) { - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); unsigned i; for(i = 0; i < opcode->NumSrcRegs; i++) { - if (inst->I.SrcReg[i].File == RC_FILE_INPUT && - inst->I.SrcReg[i].Index == wpos) { - inst->I.SrcReg[i].File = RC_FILE_TEMPORARY; - inst->I.SrcReg[i].Index = tempregi; + if (inst->U.I.SrcReg[i].File == RC_FILE_INPUT && + inst->U.I.SrcReg[i].Index == wpos) { + inst->U.I.SrcReg[i].File = RC_FILE_TEMPORARY; + inst->U.I.SrcReg[i].Index = tempregi; } } } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c index 2ae3c56689..f30b1ff067 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c @@ -134,26 +134,26 @@ static void mark_used(struct deadcode_state * s, rc_register_file file, unsigned static void update_instruction(struct deadcode_state * s, struct rc_instruction * inst) { - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); struct instruction_state * insts = &s->Instructions[inst->IP]; unsigned int usedmask = 0; if (opcode->HasDstReg) { - unsigned char * pused = get_used_ptr(s, inst->I.DstReg.File, inst->I.DstReg.Index); + unsigned char * pused = get_used_ptr(s, inst->U.I.DstReg.File, inst->U.I.DstReg.Index); if (pused) { - usedmask = *pused & inst->I.DstReg.WriteMask; + usedmask = *pused & inst->U.I.DstReg.WriteMask; *pused &= ~usedmask; } } insts->WriteMask |= usedmask; - if (inst->I.WriteALUResult) { + if (inst->U.I.WriteALUResult) { unsigned char * pused = get_used_ptr(s, RC_FILE_SPECIAL, RC_SPECIAL_ALU_RESULT); if (pused && *pused) { - if (inst->I.WriteALUResult == RC_ALURESULT_X) + if (inst->U.I.WriteALUResult == RC_ALURESULT_X) usedmask |= RC_MASK_X; - else if (inst->I.WriteALUResult == RC_ALURESULT_W) + else if (inst->U.I.WriteALUResult == RC_ALURESULT_W) usedmask |= RC_MASK_W; *pused = 0; @@ -171,7 +171,7 @@ static void update_instruction(struct deadcode_state * s, struct rc_instruction for(unsigned int chan = 0; chan < 4; ++chan) { if (GET_BIT(newsrcmask, chan)) - refmask |= 1 << GET_SWZ(inst->I.SrcReg[src].Swizzle, chan); + refmask |= 1 << GET_SWZ(inst->U.I.SrcReg[src].Swizzle, chan); } /* get rid of spurious bits from ZERO, ONE, etc. swizzles */ @@ -180,9 +180,9 @@ static void update_instruction(struct deadcode_state * s, struct rc_instruction if (!refmask) continue; - mark_used(s, inst->I.SrcReg[src].File, inst->I.SrcReg[src].Index, refmask); + mark_used(s, inst->U.I.SrcReg[src].File, inst->U.I.SrcReg[src].Index, refmask); - if (inst->I.SrcReg[src].RelAddr) + if (inst->U.I.SrcReg[src].RelAddr) mark_used(s, RC_FILE_ADDRESS, 0, RC_MASK_X); } } @@ -211,7 +211,7 @@ void rc_dataflow_deadcode(struct radeon_compiler * c, rc_dataflow_mark_outputs_f for(struct rc_instruction * inst = c->Program.Instructions.Prev; inst != &c->Program.Instructions; inst = inst->Prev) { - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); if (opcode->IsControlFlow) { if (opcode->Opcode == RC_OPCODE_ENDIF) { @@ -250,20 +250,20 @@ void rc_dataflow_deadcode(struct radeon_compiler * c, rc_dataflow_mark_outputs_f for(struct rc_instruction * inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next, ++ip) { - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode);\ + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode);\ int dead = 1; if (!opcode->HasDstReg) { dead = 0; } else { - inst->I.DstReg.WriteMask = s.Instructions[ip].WriteMask; + inst->U.I.DstReg.WriteMask = s.Instructions[ip].WriteMask; if (s.Instructions[ip].WriteMask) dead = 0; if (s.Instructions[ip].WriteALUResult) dead = 0; else - inst->I.WriteALUResult = RC_ALURESULT_NONE; + inst->U.I.WriteALUResult = RC_ALURESULT_NONE; } if (dead) { @@ -276,9 +276,9 @@ void rc_dataflow_deadcode(struct radeon_compiler * c, rc_dataflow_mark_outputs_f unsigned int srcmasks[3]; unsigned int usemask = s.Instructions[ip].WriteMask; - if (inst->I.WriteALUResult == RC_ALURESULT_X) + if (inst->U.I.WriteALUResult == RC_ALURESULT_X) usemask |= RC_MASK_X; - else if (inst->I.WriteALUResult == RC_ALURESULT_W) + else if (inst->U.I.WriteALUResult == RC_ALURESULT_W) usemask |= RC_MASK_W; rc_compute_sources_for_writemask(opcode, usemask, srcmasks); @@ -286,7 +286,7 @@ void rc_dataflow_deadcode(struct radeon_compiler * c, rc_dataflow_mark_outputs_f for(unsigned int src = 0; src < 3; ++src) { for(unsigned int chan = 0; chan < 4; ++chan) { if (!GET_BIT(srcmasks[src], chan)) - SET_SWZ(inst->I.SrcReg[src].Swizzle, chan, RC_SWIZZLE_UNUSED); + SET_SWZ(inst->U.I.SrcReg[src].Swizzle, chan, RC_SWIZZLE_UNUSED); } } } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c index fcef218b59..33acbd30f4 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_swizzles.c @@ -40,48 +40,48 @@ static void rewrite_source(struct radeon_compiler * c, usemask = 0; for(unsigned int chan = 0; chan < 4; ++chan) { - if (GET_SWZ(inst->I.SrcReg[src].Swizzle, chan) != RC_SWIZZLE_UNUSED) + if (GET_SWZ(inst->U.I.SrcReg[src].Swizzle, chan) != RC_SWIZZLE_UNUSED) usemask |= 1 << chan; } - c->SwizzleCaps->Split(inst->I.SrcReg[src], usemask, &split); + c->SwizzleCaps->Split(inst->U.I.SrcReg[src], usemask, &split); for(unsigned int phase = 0; phase < split.NumPhases; ++phase) { struct rc_instruction * mov = rc_insert_new_instruction(c, inst->Prev); unsigned int phase_refmask; unsigned int masked_negate; - mov->I.Opcode = RC_OPCODE_MOV; - mov->I.DstReg.File = RC_FILE_TEMPORARY; - mov->I.DstReg.Index = tempreg; - mov->I.DstReg.WriteMask = split.Phase[phase]; - mov->I.SrcReg[0] = inst->I.SrcReg[src]; + mov->U.I.Opcode = RC_OPCODE_MOV; + mov->U.I.DstReg.File = RC_FILE_TEMPORARY; + mov->U.I.DstReg.Index = tempreg; + mov->U.I.DstReg.WriteMask = split.Phase[phase]; + mov->U.I.SrcReg[0] = inst->U.I.SrcReg[src]; phase_refmask = 0; for(unsigned int chan = 0; chan < 4; ++chan) { if (!GET_BIT(split.Phase[phase], chan)) - SET_SWZ(mov->I.SrcReg[0].Swizzle, chan, RC_SWIZZLE_UNUSED); + SET_SWZ(mov->U.I.SrcReg[0].Swizzle, chan, RC_SWIZZLE_UNUSED); else - phase_refmask |= 1 << GET_SWZ(mov->I.SrcReg[0].Swizzle, chan); + phase_refmask |= 1 << GET_SWZ(mov->U.I.SrcReg[0].Swizzle, chan); } phase_refmask &= RC_MASK_XYZW; - masked_negate = split.Phase[phase] & mov->I.SrcReg[0].Negate; + masked_negate = split.Phase[phase] & mov->U.I.SrcReg[0].Negate; if (masked_negate == 0) - mov->I.SrcReg[0].Negate = 0; + mov->U.I.SrcReg[0].Negate = 0; else if (masked_negate == split.Phase[phase]) - mov->I.SrcReg[0].Negate = RC_MASK_XYZW; + mov->U.I.SrcReg[0].Negate = RC_MASK_XYZW; } - inst->I.SrcReg[src].File = RC_FILE_TEMPORARY; - inst->I.SrcReg[src].Index = tempreg; - inst->I.SrcReg[src].Swizzle = 0; - inst->I.SrcReg[src].Negate = RC_MASK_NONE; - inst->I.SrcReg[src].Abs = 0; + inst->U.I.SrcReg[src].File = RC_FILE_TEMPORARY; + inst->U.I.SrcReg[src].Index = tempreg; + inst->U.I.SrcReg[src].Swizzle = 0; + inst->U.I.SrcReg[src].Negate = RC_MASK_NONE; + inst->U.I.SrcReg[src].Abs = 0; for(unsigned int chan = 0; chan < 4; ++chan) { - SET_SWZ(inst->I.SrcReg[src].Swizzle, chan, + SET_SWZ(inst->U.I.SrcReg[src].Swizzle, chan, GET_BIT(usemask, chan) ? chan : RC_SWIZZLE_UNUSED); } } @@ -91,11 +91,11 @@ void rc_dataflow_swizzles(struct radeon_compiler * c) struct rc_instruction * inst; for(inst = c->Program.Instructions.Next; inst != &c->Program.Instructions; inst = inst->Next) { - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); unsigned int src; for(src = 0; src < opcode->NumSrcRegs; ++src) { - if (!c->SwizzleCaps->IsNative(inst->I.Opcode, inst->I.SrcReg[src])) + if (!c->SwizzleCaps->IsNative(inst->U.I.Opcode, inst->U.I.SrcReg[src])) rewrite_source(c, inst, src); } } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.c b/src/mesa/drivers/dri/r300/compiler/radeon_program.c index a1ee7c0cab..68a093b8c0 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.c @@ -98,7 +98,7 @@ unsigned int rc_find_free_temporary(struct radeon_compiler * c) memset(used, 0, sizeof(used)); for (struct rc_instruction * rcinst = c->Program.Instructions.Next; rcinst != &c->Program.Instructions; rcinst = rcinst->Next) { - const struct rc_sub_instruction *inst = &rcinst->I; + const struct rc_sub_instruction *inst = &rcinst->U.I; const struct rc_opcode_info *opcode = rc_get_opcode_info(inst->Opcode); unsigned int k; @@ -129,11 +129,11 @@ struct rc_instruction *rc_alloc_instruction(struct radeon_compiler * c) memset(inst, 0, sizeof(struct rc_instruction)); - inst->I.Opcode = RC_OPCODE_ILLEGAL_OPCODE; - inst->I.DstReg.WriteMask = RC_MASK_XYZW; - inst->I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZW; - inst->I.SrcReg[1].Swizzle = RC_SWIZZLE_XYZW; - inst->I.SrcReg[2].Swizzle = RC_SWIZZLE_XYZW; + inst->U.I.Opcode = RC_OPCODE_ILLEGAL_OPCODE; + inst->U.I.DstReg.WriteMask = RC_MASK_XYZW; + inst->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZW; + inst->U.I.SrcReg[1].Swizzle = RC_SWIZZLE_XYZW; + inst->U.I.SrcReg[2].Swizzle = RC_SWIZZLE_XYZW; return inst; } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.h b/src/mesa/drivers/dri/r300/compiler/radeon_program.h index 071b0a0ca9..067cb545fd 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.h @@ -109,11 +109,19 @@ struct rc_sub_instruction { /*@}*/ }; +typedef enum { + RC_INSTRUCTION_NORMAL = 0, + RC_INSTRUCTION_PAIR +} rc_instruction_type; + struct rc_instruction { struct rc_instruction * Prev; struct rc_instruction * Next; - struct rc_sub_instruction I; + rc_instruction_type Type; + union { + struct rc_sub_instruction I; + } U; /** * Warning: IPs are not stable. If you want to use them, diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c index e25bc4ec87..425b929668 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c @@ -45,10 +45,10 @@ static struct rc_instruction *emit1( { struct rc_instruction *fpi = rc_insert_new_instruction(c, after); - fpi->I.Opcode = Opcode; - fpi->I.SaturateMode = Saturate; - fpi->I.DstReg = DstReg; - fpi->I.SrcReg[0] = SrcReg; + fpi->U.I.Opcode = Opcode; + fpi->U.I.SaturateMode = Saturate; + fpi->U.I.DstReg = DstReg; + fpi->U.I.SrcReg[0] = SrcReg; return fpi; } @@ -59,11 +59,11 @@ static struct rc_instruction *emit2( { struct rc_instruction *fpi = rc_insert_new_instruction(c, after); - fpi->I.Opcode = Opcode; - fpi->I.SaturateMode = Saturate; - fpi->I.DstReg = DstReg; - fpi->I.SrcReg[0] = SrcReg0; - fpi->I.SrcReg[1] = SrcReg1; + fpi->U.I.Opcode = Opcode; + fpi->U.I.SaturateMode = Saturate; + fpi->U.I.DstReg = DstReg; + fpi->U.I.SrcReg[0] = SrcReg0; + fpi->U.I.SrcReg[1] = SrcReg1; return fpi; } @@ -75,12 +75,12 @@ static struct rc_instruction *emit3( { struct rc_instruction *fpi = rc_insert_new_instruction(c, after); - fpi->I.Opcode = Opcode; - fpi->I.SaturateMode = Saturate; - fpi->I.DstReg = DstReg; - fpi->I.SrcReg[0] = SrcReg0; - fpi->I.SrcReg[1] = SrcReg1; - fpi->I.SrcReg[2] = SrcReg2; + fpi->U.I.Opcode = Opcode; + fpi->U.I.SaturateMode = Saturate; + fpi->U.I.DstReg = DstReg; + fpi->U.I.SrcReg[0] = SrcReg0; + fpi->U.I.SrcReg[1] = SrcReg1; + fpi->U.I.SrcReg[2] = SrcReg2; return fpi; } @@ -168,36 +168,36 @@ static struct rc_src_register scalar(struct rc_src_register reg) static void transform_ABS(struct radeon_compiler* c, struct rc_instruction* inst) { - struct rc_src_register src = inst->I.SrcReg[0]; + struct rc_src_register src = inst->U.I.SrcReg[0]; src.Abs = 1; src.Negate = RC_MASK_NONE; - emit1(c, inst->Prev, RC_OPCODE_MOV, inst->I.SaturateMode, inst->I.DstReg, src); + emit1(c, inst->Prev, RC_OPCODE_MOV, inst->U.I.SaturateMode, inst->U.I.DstReg, src); rc_remove_instruction(inst); } static void transform_DP3(struct radeon_compiler* c, struct rc_instruction* inst) { - struct rc_src_register src0 = inst->I.SrcReg[0]; - struct rc_src_register src1 = inst->I.SrcReg[1]; + struct rc_src_register src0 = inst->U.I.SrcReg[0]; + struct rc_src_register src1 = inst->U.I.SrcReg[1]; src0.Negate &= ~RC_MASK_W; src0.Swizzle &= ~(7 << (3 * 3)); src0.Swizzle |= RC_SWIZZLE_ZERO << (3 * 3); src1.Negate &= ~RC_MASK_W; src1.Swizzle &= ~(7 << (3 * 3)); src1.Swizzle |= RC_SWIZZLE_ZERO << (3 * 3); - emit2(c, inst->Prev, RC_OPCODE_DP4, inst->I.SaturateMode, inst->I.DstReg, src0, src1); + emit2(c, inst->Prev, RC_OPCODE_DP4, inst->U.I.SaturateMode, inst->U.I.DstReg, src0, src1); rc_remove_instruction(inst); } static void transform_DPH(struct radeon_compiler* c, struct rc_instruction* inst) { - struct rc_src_register src0 = inst->I.SrcReg[0]; + struct rc_src_register src0 = inst->U.I.SrcReg[0]; src0.Negate &= ~RC_MASK_W; src0.Swizzle &= ~(7 << (3 * 3)); src0.Swizzle |= RC_SWIZZLE_ONE << (3 * 3); - emit2(c, inst->Prev, RC_OPCODE_DP4, inst->I.SaturateMode, inst->I.DstReg, src0, inst->I.SrcReg[1]); + emit2(c, inst->Prev, RC_OPCODE_DP4, inst->U.I.SaturateMode, inst->U.I.DstReg, src0, inst->U.I.SrcReg[1]); rc_remove_instruction(inst); } @@ -208,9 +208,9 @@ static void transform_DPH(struct radeon_compiler* c, static void transform_DST(struct radeon_compiler* c, struct rc_instruction* inst) { - emit2(c, inst->Prev, RC_OPCODE_MUL, inst->I.SaturateMode, inst->I.DstReg, - swizzle(inst->I.SrcReg[0], RC_SWIZZLE_ONE, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_ONE), - swizzle(inst->I.SrcReg[1], RC_SWIZZLE_ONE, RC_SWIZZLE_Y, RC_SWIZZLE_ONE, RC_SWIZZLE_W)); + emit2(c, inst->Prev, RC_OPCODE_MUL, inst->U.I.SaturateMode, inst->U.I.DstReg, + swizzle(inst->U.I.SrcReg[0], RC_SWIZZLE_ONE, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_ONE), + swizzle(inst->U.I.SrcReg[1], RC_SWIZZLE_ONE, RC_SWIZZLE_Y, RC_SWIZZLE_ONE, RC_SWIZZLE_W)); rc_remove_instruction(inst); } @@ -218,9 +218,9 @@ static void transform_FLR(struct radeon_compiler* c, struct rc_instruction* inst) { int tempreg = rc_find_free_temporary(c); - emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstreg(RC_FILE_TEMPORARY, tempreg), inst->I.SrcReg[0]); - emit2(c, inst->Prev, RC_OPCODE_ADD, inst->I.SaturateMode, inst->I.DstReg, - inst->I.SrcReg[0], negate(srcreg(RC_FILE_TEMPORARY, tempreg))); + emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstreg(RC_FILE_TEMPORARY, tempreg), inst->U.I.SrcReg[0]); + emit2(c, inst->Prev, RC_OPCODE_ADD, inst->U.I.SaturateMode, inst->U.I.DstReg, + inst->U.I.SrcReg[0], negate(srcreg(RC_FILE_TEMPORARY, tempreg))); rc_remove_instruction(inst); } @@ -252,19 +252,19 @@ static void transform_LIT(struct radeon_compiler* c, constant = rc_constants_add_immediate_scalar(&c->Program.Constants, -127.999999, &constant_swizzle); - if (inst->I.DstReg.WriteMask != RC_MASK_XYZW || inst->I.DstReg.File != RC_FILE_TEMPORARY) { + if (inst->U.I.DstReg.WriteMask != RC_MASK_XYZW || inst->U.I.DstReg.File != RC_FILE_TEMPORARY) { struct rc_instruction * inst_mov; inst_mov = emit1(c, inst, - RC_OPCODE_MOV, 0, inst->I.DstReg, + RC_OPCODE_MOV, 0, inst->U.I.DstReg, srcreg(RC_FILE_TEMPORARY, rc_find_free_temporary(c))); - inst->I.DstReg.File = RC_FILE_TEMPORARY; - inst->I.DstReg.Index = inst_mov->I.SrcReg[0].Index; - inst->I.DstReg.WriteMask = RC_MASK_XYZW; + inst->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst->U.I.DstReg.Index = inst_mov->U.I.SrcReg[0].Index; + inst->U.I.DstReg.WriteMask = RC_MASK_XYZW; } - temp = inst->I.DstReg.Index; + temp = inst->U.I.DstReg.Index; srctemp = srcreg(RC_FILE_TEMPORARY, temp); // tmp.x = max(0.0, Src.x); @@ -272,7 +272,7 @@ static void transform_LIT(struct radeon_compiler* c, // tmp.w = clamp(Src.z, -128+eps, 128-eps); emit2(c, inst->Prev, RC_OPCODE_MAX, 0, dstregtmpmask(temp, RC_MASK_XYW), - inst->I.SrcReg[0], + inst->U.I.SrcReg[0], swizzle(srcreg(RC_FILE_CONSTANT, constant), RC_SWIZZLE_ZERO, RC_SWIZZLE_ZERO, RC_SWIZZLE_ZERO, constant_swizzle&3)); emit2(c, inst->Prev, RC_OPCODE_MIN, 0, @@ -293,14 +293,14 @@ static void transform_LIT(struct radeon_compiler* c, swizzle(srctemp, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W)); // tmp.z = (tmp.x > 0) ? tmp.w : 0.0 - emit3(c, inst->Prev, RC_OPCODE_CMP, inst->I.SaturateMode, + emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, dstregtmpmask(temp, RC_MASK_Z), negate(swizzle(srctemp, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X)), swizzle(srctemp, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W), builtin_zero); // tmp.x, tmp.y, tmp.w = 1.0, tmp.x, 1.0 - emit1(c, inst->Prev, RC_OPCODE_MOV, inst->I.SaturateMode, + emit1(c, inst->Prev, RC_OPCODE_MOV, inst->U.I.SaturateMode, dstregtmpmask(temp, RC_MASK_XYW), swizzle(srctemp, RC_SWIZZLE_ONE, RC_SWIZZLE_X, RC_SWIZZLE_ONE, RC_SWIZZLE_ONE)); @@ -314,10 +314,10 @@ static void transform_LRP(struct radeon_compiler* c, emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), - inst->I.SrcReg[1], negate(inst->I.SrcReg[2])); - emit3(c, inst->Prev, RC_OPCODE_MAD, inst->I.SaturateMode, - inst->I.DstReg, - inst->I.SrcReg[0], srcreg(RC_FILE_TEMPORARY, tempreg), inst->I.SrcReg[2]); + inst->U.I.SrcReg[1], negate(inst->U.I.SrcReg[2])); + emit3(c, inst->Prev, RC_OPCODE_MAD, inst->U.I.SaturateMode, + inst->U.I.DstReg, + inst->U.I.SrcReg[0], srcreg(RC_FILE_TEMPORARY, tempreg), inst->U.I.SrcReg[2]); rc_remove_instruction(inst); } @@ -331,9 +331,9 @@ static void transform_POW(struct radeon_compiler* c, tempdst.WriteMask = RC_MASK_W; tempsrc.Swizzle = RC_SWIZZLE_WWWW; - emit1(c, inst->Prev, RC_OPCODE_LG2, 0, tempdst, scalar(inst->I.SrcReg[0])); - emit2(c, inst->Prev, RC_OPCODE_MUL, 0, tempdst, tempsrc, scalar(inst->I.SrcReg[1])); - emit1(c, inst->Prev, RC_OPCODE_EX2, inst->I.SaturateMode, inst->I.DstReg, tempsrc); + emit1(c, inst->Prev, RC_OPCODE_LG2, 0, tempdst, scalar(inst->U.I.SrcReg[0])); + emit2(c, inst->Prev, RC_OPCODE_MUL, 0, tempdst, tempsrc, scalar(inst->U.I.SrcReg[1])); + emit1(c, inst->Prev, RC_OPCODE_EX2, inst->U.I.SaturateMode, inst->U.I.DstReg, tempsrc); rc_remove_instruction(inst); } @@ -341,7 +341,7 @@ static void transform_POW(struct radeon_compiler* c, static void transform_RSQ(struct radeon_compiler* c, struct rc_instruction* inst) { - inst->I.SrcReg[0] = absolute(inst->I.SrcReg[0]); + inst->U.I.SrcReg[0] = absolute(inst->U.I.SrcReg[0]); } static void transform_SGE(struct radeon_compiler* c, @@ -349,8 +349,8 @@ static void transform_SGE(struct radeon_compiler* c, { int tempreg = rc_find_free_temporary(c); - emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), inst->I.SrcReg[0], negate(inst->I.SrcReg[1])); - emit3(c, inst->Prev, RC_OPCODE_CMP, inst->I.SaturateMode, inst->I.DstReg, + emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1])); + emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg, srcreg(RC_FILE_TEMPORARY, tempreg), builtin_zero, builtin_one); rc_remove_instruction(inst); @@ -361,8 +361,8 @@ static void transform_SLT(struct radeon_compiler* c, { int tempreg = rc_find_free_temporary(c); - emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), inst->I.SrcReg[0], negate(inst->I.SrcReg[1])); - emit3(c, inst->Prev, RC_OPCODE_CMP, inst->I.SaturateMode, inst->I.DstReg, + emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1])); + emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg, srcreg(RC_FILE_TEMPORARY, tempreg), builtin_one, builtin_zero); rc_remove_instruction(inst); @@ -371,14 +371,14 @@ static void transform_SLT(struct radeon_compiler* c, static void transform_SUB(struct radeon_compiler* c, struct rc_instruction* inst) { - inst->I.Opcode = RC_OPCODE_ADD; - inst->I.SrcReg[1] = negate(inst->I.SrcReg[1]); + inst->U.I.Opcode = RC_OPCODE_ADD; + inst->U.I.SrcReg[1] = negate(inst->U.I.SrcReg[1]); } static void transform_SWZ(struct radeon_compiler* c, struct rc_instruction* inst) { - inst->I.Opcode = RC_OPCODE_MOV; + inst->U.I.Opcode = RC_OPCODE_MOV; } static void transform_XPD(struct radeon_compiler* c, @@ -387,11 +387,11 @@ static void transform_XPD(struct radeon_compiler* c, int tempreg = rc_find_free_temporary(c); emit2(c, inst->Prev, RC_OPCODE_MUL, 0, dstreg(RC_FILE_TEMPORARY, tempreg), - swizzle(inst->I.SrcReg[0], RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_W), - swizzle(inst->I.SrcReg[1], RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_W)); - emit3(c, inst->Prev, RC_OPCODE_MAD, inst->I.SaturateMode, inst->I.DstReg, - swizzle(inst->I.SrcReg[0], RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_W), - swizzle(inst->I.SrcReg[1], RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_W), + swizzle(inst->U.I.SrcReg[0], RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_W), + swizzle(inst->U.I.SrcReg[1], RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_W)); + emit3(c, inst->Prev, RC_OPCODE_MAD, inst->U.I.SaturateMode, inst->U.I.DstReg, + swizzle(inst->U.I.SrcReg[0], RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_W), + swizzle(inst->U.I.SrcReg[1], RC_SWIZZLE_Z, RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_W), negate(srcreg(RC_FILE_TEMPORARY, tempreg))); rc_remove_instruction(inst); @@ -417,7 +417,7 @@ int radeonTransformALU( struct rc_instruction* inst, void* unused) { - switch(inst->I.Opcode) { + switch(inst->U.I.Opcode) { case RC_OPCODE_ABS: transform_ABS(c, inst); return 1; case RC_OPCODE_DPH: transform_DPH(c, inst); return 1; case RC_OPCODE_DST: transform_DST(c, inst); return 1; @@ -441,9 +441,9 @@ static void transform_r300_vertex_ABS(struct radeon_compiler* c, struct rc_instruction* inst) { /* Note: r500 can take absolute values, but r300 cannot. */ - inst->I.Opcode = RC_OPCODE_MAX; - inst->I.SrcReg[1] = inst->I.SrcReg[0]; - inst->I.SrcReg[1].Negate ^= RC_MASK_XYZW; + inst->U.I.Opcode = RC_OPCODE_MAX; + inst->U.I.SrcReg[1] = inst->U.I.SrcReg[0]; + inst->U.I.SrcReg[1].Negate ^= RC_MASK_XYZW; } /** @@ -455,7 +455,7 @@ int r300_transform_vertex_alu( struct rc_instruction* inst, void* unused) { - switch(inst->I.Opcode) { + switch(inst->U.I.Opcode) { case RC_OPCODE_ABS: transform_r300_vertex_ABS(c, inst); return 1; case RC_OPCODE_DP3: transform_DP3(c, inst); return 1; case RC_OPCODE_DPH: transform_DPH(c, inst); return 1; @@ -531,9 +531,9 @@ int radeonTransformTrigSimple(struct radeon_compiler* c, struct rc_instruction* inst, void* unused) { - if (inst->I.Opcode != RC_OPCODE_COS && - inst->I.Opcode != RC_OPCODE_SIN && - inst->I.Opcode != RC_OPCODE_SCS) + if (inst->U.I.Opcode != RC_OPCODE_COS && + inst->U.I.Opcode != RC_OPCODE_SIN && + inst->U.I.Opcode != RC_OPCODE_SCS) return 0; unsigned int constants[2]; @@ -541,12 +541,12 @@ int radeonTransformTrigSimple(struct radeon_compiler* c, sincos_constants(c, constants); - if (inst->I.Opcode == RC_OPCODE_COS) { + if (inst->U.I.Opcode == RC_OPCODE_COS) { // MAD tmp.x, src, 1/(2*PI), 0.75 // FRC tmp.x, tmp.x // MAD tmp.z, tmp.x, 2*PI, -PI emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_W), - swizzle(inst->I.SrcReg[0], RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X), + swizzle(inst->U.I.SrcReg[0], RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X), swizzle(srcreg(RC_FILE_CONSTANT, constants[1]), RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z), swizzle(srcreg(RC_FILE_CONSTANT, constants[1]), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X)); emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstregtmpmask(tempreg, RC_MASK_W), @@ -556,12 +556,12 @@ int radeonTransformTrigSimple(struct radeon_compiler* c, swizzle(srcreg(RC_FILE_CONSTANT, constants[1]), RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W), negate(swizzle(srcreg(RC_FILE_CONSTANT, constants[0]), RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z))); - sin_approx(c, inst, inst->I.DstReg, + sin_approx(c, inst, inst->U.I.DstReg, swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W), constants); - } else if (inst->I.Opcode == RC_OPCODE_SIN) { + } else if (inst->U.I.Opcode == RC_OPCODE_SIN) { emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_W), - swizzle(inst->I.SrcReg[0], RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X), + swizzle(inst->U.I.SrcReg[0], RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X), swizzle(srcreg(RC_FILE_CONSTANT, constants[1]), RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z), swizzle(srcreg(RC_FILE_CONSTANT, constants[1]), RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y)); emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstregtmpmask(tempreg, RC_MASK_W), @@ -571,12 +571,12 @@ int radeonTransformTrigSimple(struct radeon_compiler* c, swizzle(srcreg(RC_FILE_CONSTANT, constants[1]), RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W), negate(swizzle(srcreg(RC_FILE_CONSTANT, constants[0]), RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z))); - sin_approx(c, inst, inst->I.DstReg, + sin_approx(c, inst, inst->U.I.DstReg, swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W), constants); } else { emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_XY), - swizzle(inst->I.SrcReg[0], RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X), + swizzle(inst->U.I.SrcReg[0], RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X), swizzle(srcreg(RC_FILE_CONSTANT, constants[1]), RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z), swizzle(srcreg(RC_FILE_CONSTANT, constants[1]), RC_SWIZZLE_X, RC_SWIZZLE_Y, RC_SWIZZLE_Z, RC_SWIZZLE_W)); emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstregtmpmask(tempreg, RC_MASK_XY), @@ -586,14 +586,14 @@ int radeonTransformTrigSimple(struct radeon_compiler* c, swizzle(srcreg(RC_FILE_CONSTANT, constants[1]), RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W), negate(swizzle(srcreg(RC_FILE_CONSTANT, constants[0]), RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z, RC_SWIZZLE_Z))); - struct rc_dst_register dst = inst->I.DstReg; + struct rc_dst_register dst = inst->U.I.DstReg; - dst.WriteMask = inst->I.DstReg.WriteMask & RC_MASK_X; + dst.WriteMask = inst->U.I.DstReg.WriteMask & RC_MASK_X; sin_approx(c, inst, dst, swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X), constants); - dst.WriteMask = inst->I.DstReg.WriteMask & RC_MASK_Y; + dst.WriteMask = inst->U.I.DstReg.WriteMask & RC_MASK_Y; sin_approx(c, inst, dst, swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y), constants); @@ -617,9 +617,9 @@ int radeonTransformTrigScale(struct radeon_compiler* c, struct rc_instruction* inst, void* unused) { - if (inst->I.Opcode != RC_OPCODE_COS && - inst->I.Opcode != RC_OPCODE_SIN && - inst->I.Opcode != RC_OPCODE_SCS) + if (inst->U.I.Opcode != RC_OPCODE_COS && + inst->U.I.Opcode != RC_OPCODE_SIN && + inst->U.I.Opcode != RC_OPCODE_SCS) return 0; static const float RCP_2PI = 0.15915494309189535; @@ -631,28 +631,28 @@ int radeonTransformTrigScale(struct radeon_compiler* c, constant = rc_constants_add_immediate_scalar(&c->Program.Constants, RCP_2PI, &constant_swizzle); emit2(c, inst->Prev, RC_OPCODE_MUL, 0, dstregtmpmask(temp, RC_MASK_W), - swizzle(inst->I.SrcReg[0], RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X), + swizzle(inst->U.I.SrcReg[0], RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X), srcregswz(RC_FILE_CONSTANT, constant, constant_swizzle)); emit1(c, inst->Prev, RC_OPCODE_FRC, 0, dstregtmpmask(temp, RC_MASK_W), srcreg(RC_FILE_TEMPORARY, temp)); - if (inst->I.Opcode == RC_OPCODE_COS) { - emit1(c, inst->Prev, RC_OPCODE_COS, inst->I.SaturateMode, inst->I.DstReg, + if (inst->U.I.Opcode == RC_OPCODE_COS) { + emit1(c, inst->Prev, RC_OPCODE_COS, inst->U.I.SaturateMode, inst->U.I.DstReg, srcregswz(RC_FILE_TEMPORARY, temp, RC_SWIZZLE_WWWW)); - } else if (inst->I.Opcode == RC_OPCODE_SIN) { - emit1(c, inst->Prev, RC_OPCODE_SIN, inst->I.SaturateMode, - inst->I.DstReg, srcregswz(RC_FILE_TEMPORARY, temp, RC_SWIZZLE_WWWW)); - } else if (inst->I.Opcode == RC_OPCODE_SCS) { - struct rc_dst_register moddst = inst->I.DstReg; + } else if (inst->U.I.Opcode == RC_OPCODE_SIN) { + emit1(c, inst->Prev, RC_OPCODE_SIN, inst->U.I.SaturateMode, + inst->U.I.DstReg, srcregswz(RC_FILE_TEMPORARY, temp, RC_SWIZZLE_WWWW)); + } else if (inst->U.I.Opcode == RC_OPCODE_SCS) { + struct rc_dst_register moddst = inst->U.I.DstReg; - if (inst->I.DstReg.WriteMask & RC_MASK_X) { + if (inst->U.I.DstReg.WriteMask & RC_MASK_X) { moddst.WriteMask = RC_MASK_X; - emit1(c, inst->Prev, RC_OPCODE_COS, inst->I.SaturateMode, moddst, + emit1(c, inst->Prev, RC_OPCODE_COS, inst->U.I.SaturateMode, moddst, srcregswz(RC_FILE_TEMPORARY, temp, RC_SWIZZLE_WWWW)); } - if (inst->I.DstReg.WriteMask & RC_MASK_Y) { + if (inst->U.I.DstReg.WriteMask & RC_MASK_Y) { moddst.WriteMask = RC_MASK_Y; - emit1(c, inst->Prev, RC_OPCODE_SIN, inst->I.SaturateMode, moddst, + emit1(c, inst->Prev, RC_OPCODE_SIN, inst->U.I.SaturateMode, moddst, srcregswz(RC_FILE_TEMPORARY, temp, RC_SWIZZLE_WWWW)); } } @@ -674,11 +674,11 @@ int radeonTransformDeriv(struct radeon_compiler* c, struct rc_instruction* inst, void* unused) { - if (inst->I.Opcode != RC_OPCODE_DDX && inst->I.Opcode != RC_OPCODE_DDY) + if (inst->U.I.Opcode != RC_OPCODE_DDX && inst->U.I.Opcode != RC_OPCODE_DDY) return 0; - inst->I.SrcReg[1].Swizzle = RC_MAKE_SWIZZLE(RC_SWIZZLE_ONE, RC_SWIZZLE_ONE, RC_SWIZZLE_ONE, RC_SWIZZLE_ONE); - inst->I.SrcReg[1].Negate = RC_MASK_XYZW; + inst->U.I.SrcReg[1].Swizzle = RC_MAKE_SWIZZLE(RC_SWIZZLE_ONE, RC_SWIZZLE_ONE, RC_SWIZZLE_ONE, RC_SWIZZLE_ONE); + inst->U.I.SrcReg[1].Negate = RC_MASK_XYZW; return 1; } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c index 6cda208600..0d8d8e0b3b 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c @@ -341,7 +341,7 @@ static void scan_instructions(struct pair_state *s) struct pair_state_instruction *pairinst = memory_pool_malloc(&s->Compiler->Base.Pool, sizeof(*pairinst)); memset(pairinst, 0, sizeof(struct pair_state_instruction)); - pairinst->Instruction = source->I; + pairinst->Instruction = source->U.I; pairinst->IP = ip; final_rewrite(s, &pairinst->Instruction); classify_instruction(s, pairinst); diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h index da2bcc5d89..440069d558 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h @@ -28,8 +28,6 @@ #ifndef __RADEON_PROGRAM_PAIR_H_ #define __RADEON_PROGRAM_PAIR_H_ -#include "radeon_program.h" - struct r300_fragment_program_compiler; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c index 6645d7cacb..fe90a5900e 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c @@ -144,12 +144,12 @@ static void rc_print_src_register(FILE * f, struct rc_src_register src) static void rc_print_instruction(FILE * f, struct rc_instruction * inst) { - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->I.Opcode); + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); unsigned int reg; fprintf(f, "%s", opcode->Name); - switch(inst->I.SaturateMode) { + switch(inst->U.I.SaturateMode) { case RC_SATURATE_NONE: break; case RC_SATURATE_ZERO_ONE: fprintf(f, "_SAT"); break; case RC_SATURATE_MINUS_PLUS_ONE: fprintf(f, "_SAT2"); break; @@ -158,7 +158,7 @@ static void rc_print_instruction(FILE * f, struct rc_instruction * inst) if (opcode->HasDstReg) { fprintf(f, " "); - rc_print_dst_register(f, inst->I.DstReg); + rc_print_dst_register(f, inst->U.I.DstReg); if (opcode->NumSrcRegs) fprintf(f, ","); } @@ -167,23 +167,23 @@ static void rc_print_instruction(FILE * f, struct rc_instruction * inst) if (reg > 0) fprintf(f, ","); fprintf(f, " "); - rc_print_src_register(f, inst->I.SrcReg[reg]); + rc_print_src_register(f, inst->U.I.SrcReg[reg]); } if (opcode->HasTexture) { fprintf(f, ", %s%s[%u]", - textarget_to_string(inst->I.TexSrcTarget), - inst->I.TexShadow ? "SHADOW" : "", - inst->I.TexSrcUnit); + textarget_to_string(inst->U.I.TexSrcTarget), + inst->U.I.TexShadow ? "SHADOW" : "", + inst->U.I.TexSrcUnit); } fprintf(f, ";"); - if (inst->I.WriteALUResult) { + if (inst->U.I.WriteALUResult) { fprintf(f, " [aluresult = ("); rc_print_comparefunc(f, - (inst->I.WriteALUResult == RC_ALURESULT_X) ? "x" : "w", - inst->I.ALUResultCompare, "0"); + (inst->U.I.WriteALUResult == RC_ALURESULT_X) ? "x" : "w", + inst->U.I.ALUResultCompare, "0"); fprintf(f, ")]"); } diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index fb8d6bceda..43629d643b 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -217,20 +217,20 @@ static void initialize_NV_registers(struct radeon_compiler * compiler) for(reg = 0; reg < 12; ++reg) { inst = rc_insert_new_instruction(compiler, &compiler->Program.Instructions); - inst->I.Opcode = RC_OPCODE_MOV; - inst->I.DstReg.File = RC_FILE_TEMPORARY; - inst->I.DstReg.Index = reg; - inst->I.SrcReg[0].File = RC_FILE_NONE; - inst->I.SrcReg[0].Swizzle = RC_SWIZZLE_0000; + inst->U.I.Opcode = RC_OPCODE_MOV; + inst->U.I.DstReg.File = RC_FILE_TEMPORARY; + inst->U.I.DstReg.Index = reg; + inst->U.I.SrcReg[0].File = RC_FILE_NONE; + inst->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_0000; } inst = rc_insert_new_instruction(compiler, &compiler->Program.Instructions); - inst->I.Opcode = RC_OPCODE_ARL; - inst->I.DstReg.File = RC_FILE_ADDRESS; - inst->I.DstReg.Index = 0; - inst->I.DstReg.WriteMask = WRITEMASK_X; - inst->I.SrcReg[0].File = RC_FILE_NONE; - inst->I.SrcReg[0].Swizzle = RC_SWIZZLE_0000; + inst->U.I.Opcode = RC_OPCODE_ARL; + inst->U.I.DstReg.File = RC_FILE_ADDRESS; + inst->U.I.DstReg.Index = 0; + inst->U.I.DstReg.WriteMask = WRITEMASK_X; + inst->U.I.SrcReg[0].File = RC_FILE_NONE; + inst->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_0000; } static struct r300_vertex_program *build_program(GLcontext *ctx, diff --git a/src/mesa/drivers/dri/r300/radeon_mesa_to_rc.c b/src/mesa/drivers/dri/r300/radeon_mesa_to_rc.c index fb9bb9ce91..9f9dec840b 100644 --- a/src/mesa/drivers/dri/r300/radeon_mesa_to_rc.c +++ b/src/mesa/drivers/dri/r300/radeon_mesa_to_rc.c @@ -152,25 +152,25 @@ static void translate_instruction(struct radeon_compiler * c, const struct rc_opcode_info * opcode; unsigned int i; - dest->I.Opcode = translate_opcode(src->Opcode); - if (dest->I.Opcode == RC_OPCODE_ILLEGAL_OPCODE) { + dest->U.I.Opcode = translate_opcode(src->Opcode); + if (dest->U.I.Opcode == RC_OPCODE_ILLEGAL_OPCODE) { rc_error(c, "Unsupported opcode %i\n", src->Opcode); return; } - dest->I.SaturateMode = translate_saturate(src->SaturateMode); + dest->U.I.SaturateMode = translate_saturate(src->SaturateMode); - opcode = rc_get_opcode_info(dest->I.Opcode); + opcode = rc_get_opcode_info(dest->U.I.Opcode); for(i = 0; i < opcode->NumSrcRegs; ++i) - translate_srcreg(&dest->I.SrcReg[i], &src->SrcReg[i]); + translate_srcreg(&dest->U.I.SrcReg[i], &src->SrcReg[i]); if (opcode->HasDstReg) - translate_dstreg(&dest->I.DstReg, &src->DstReg); + translate_dstreg(&dest->U.I.DstReg, &src->DstReg); if (opcode->HasTexture) { - dest->I.TexSrcUnit = src->TexSrcUnit; - dest->I.TexSrcTarget = translate_tex_target(src->TexSrcTarget); - dest->I.TexShadow = src->TexShadow; + dest->U.I.TexSrcUnit = src->TexSrcUnit; + dest->U.I.TexSrcTarget = translate_tex_target(src->TexSrcTarget); + dest->U.I.TexShadow = src->TexShadow; } } -- cgit v1.2.3 From a30560e6f0fc8e3056f48a140c9c6b582f5e2e77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sun, 4 Oct 2009 16:49:53 +0200 Subject: r300/compiler: Refactor the radeon_pair code to support control flow instructions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle --- src/mesa/drivers/dri/r300/compiler/Makefile | 3 + .../drivers/dri/r300/compiler/r300_fragprog_emit.c | 77 +- src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c | 38 + .../drivers/dri/r300/compiler/r500_fragprog_emit.c | 67 +- .../drivers/dri/r300/compiler/radeon_dataflow.c | 132 ++- .../drivers/dri/r300/compiler/radeon_dataflow.h | 11 + .../drivers/dri/r300/compiler/radeon_opcodes.c | 4 + .../drivers/dri/r300/compiler/radeon_opcodes.h | 5 + .../dri/r300/compiler/radeon_pair_regalloc.c | 349 ++++++++ .../dri/r300/compiler/radeon_pair_schedule.c | 479 +++++++++++ .../dri/r300/compiler/radeon_pair_translate.c | 253 ++++++ .../drivers/dri/r300/compiler/radeon_program.c | 12 +- .../drivers/dri/r300/compiler/radeon_program.h | 3 + .../dri/r300/compiler/radeon_program_pair.c | 889 +-------------------- .../dri/r300/compiler/radeon_program_pair.h | 97 +-- .../dri/r300/compiler/radeon_program_print.c | 114 ++- 16 files changed, 1524 insertions(+), 1009 deletions(-) create mode 100644 src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c create mode 100644 src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c create mode 100644 src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/Makefile b/src/mesa/drivers/dri/r300/compiler/Makefile index 0d8dcb9f87..d83888d90a 100644 --- a/src/mesa/drivers/dri/r300/compiler/Makefile +++ b/src/mesa/drivers/dri/r300/compiler/Makefile @@ -13,6 +13,9 @@ C_SOURCES = \ radeon_opcodes.c \ radeon_program_alu.c \ radeon_program_pair.c \ + radeon_pair_translate.c \ + radeon_pair_schedule.c \ + radeon_pair_regalloc.c \ radeon_dataflow.c \ radeon_dataflow_deadcode.c \ radeon_dataflow_swizzles.c \ diff --git a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c index 2dad3dba4a..375838d98e 100644 --- a/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r300_fragprog_emit.c @@ -56,7 +56,6 @@ struct r300_emit_state { }; #define PROG_CODE \ - struct r300_emit_state * emit = (struct r300_emit_state*)data; \ struct r300_fragment_program_compiler *c = emit->compiler; \ struct r300_fragment_program_code *code = &c->code->code.r300 @@ -75,6 +74,18 @@ static void use_temporary(struct r300_fragment_program_code *code, unsigned int code->pixsize = index; } +static unsigned int use_source(struct r300_fragment_program_code* code, struct radeon_pair_instruction_source src) +{ + if (src.File == RC_FILE_CONSTANT) { + return src.Index | (1 << 5); + } else if (src.File == RC_FILE_TEMPORARY) { + use_temporary(code, src.Index); + return src.Index; + } + + return 0; +} + static unsigned int translate_rgb_opcode(struct r300_fragment_program_compiler * c, rc_opcode opcode) { @@ -120,7 +131,7 @@ static unsigned int translate_alpha_opcode(struct r300_fragment_program_compiler /** * Emit one paired ALU instruction. */ -static int emit_alu(void* data, struct radeon_pair_instruction* inst) +static int emit_alu(struct r300_emit_state * emit, struct rc_pair_instruction* inst) { PROG_CODE; @@ -136,14 +147,10 @@ static int emit_alu(void* data, struct radeon_pair_instruction* inst) code->alu.inst[ip].alpha_inst = translate_alpha_opcode(c, inst->Alpha.Opcode); for(j = 0; j < 3; ++j) { - unsigned int src = inst->RGB.Src[j].Index | (inst->RGB.Src[j].Constant << 5); - if (!inst->RGB.Src[j].Constant) - use_temporary(code, inst->RGB.Src[j].Index); + unsigned int src = use_source(code, inst->RGB.Src[j]); code->alu.inst[ip].rgb_addr |= src << (6*j); - src = inst->Alpha.Src[j].Index | (inst->Alpha.Src[j].Constant << 5); - if (!inst->Alpha.Src[j].Constant) - use_temporary(code, inst->Alpha.Src[j].Index); + src = use_source(code, inst->Alpha.Src[j]); code->alu.inst[ip].alpha_addr |= src << (6*j); unsigned int arg = r300FPTranslateRGBSwizzle(inst->RGB.Arg[j].Source, inst->RGB.Arg[j].Swizzle); @@ -203,7 +210,7 @@ static int finish_node(struct r300_emit_state * emit) if (code->alu.length == emit->node_first_alu) { /* Generate a single NOP for this node */ - struct radeon_pair_instruction inst; + struct rc_pair_instruction inst; memset(&inst, 0, sizeof(inst)); if (!emit_alu(emit, &inst)) return 0; @@ -248,7 +255,7 @@ static int finish_node(struct r300_emit_state * emit) * Begin a block of texture instructions. * Create the necessary indirection. */ -static int begin_tex(void* data) +static int begin_tex(struct r300_emit_state * emit) { PROG_CODE; @@ -273,7 +280,7 @@ static int begin_tex(void* data) } -static int emit_tex(void* data, struct radeon_pair_texture_instruction* inst) +static int emit_tex(struct r300_emit_state * emit, struct rc_instruction * inst) { PROG_CODE; @@ -282,31 +289,31 @@ static int emit_tex(void* data, struct radeon_pair_texture_instruction* inst) return 0; } - unsigned int unit = inst->TexSrcUnit; - unsigned int dest = inst->DestIndex; + unsigned int unit = inst->U.I.TexSrcUnit; + unsigned int dest = inst->U.I.DstReg.Index; unsigned int opcode; - switch(inst->Opcode) { - case RADEON_OPCODE_KIL: opcode = R300_TEX_OP_KIL; break; - case RADEON_OPCODE_TEX: opcode = R300_TEX_OP_LD; break; - case RADEON_OPCODE_TXB: opcode = R300_TEX_OP_TXB; break; - case RADEON_OPCODE_TXP: opcode = R300_TEX_OP_TXP; break; + switch(inst->U.I.Opcode) { + case RC_OPCODE_KIL: opcode = R300_TEX_OP_KIL; break; + case RC_OPCODE_TEX: opcode = R300_TEX_OP_LD; break; + case RC_OPCODE_TXB: opcode = R300_TEX_OP_TXB; break; + case RC_OPCODE_TXP: opcode = R300_TEX_OP_TXP; break; default: - error("Unknown texture opcode %i", inst->Opcode); + error("Unknown texture opcode %i", inst->U.I.Opcode); return 0; } - if (inst->Opcode == RADEON_OPCODE_KIL) { + if (inst->U.I.Opcode == RC_OPCODE_KIL) { unit = 0; dest = 0; } else { use_temporary(code, dest); } - use_temporary(code, inst->SrcIndex); + use_temporary(code, inst->U.I.SrcReg[0].Index); code->tex.inst[code->tex.length++] = - (inst->SrcIndex << R300_SRC_ADDR_SHIFT) | + (inst->U.I.SrcReg[0].Index << R300_SRC_ADDR_SHIFT) | (dest << R300_DST_ADDR_SHIFT) | (unit << R300_TEX_ID_SHIFT) | (opcode << R300_TEX_INST_SHIFT); @@ -314,13 +321,6 @@ static int emit_tex(void* data, struct radeon_pair_texture_instruction* inst) } -static const struct radeon_pair_handler pair_handler = { - .EmitPaired = &emit_alu, - .EmitTex = &emit_tex, - .BeginTexBlock = &begin_tex, - .MaxHwTemps = R300_PFS_NUM_TEMP_REGS -}; - /** * Final compilation step: Turn the intermediate radeon_program into * machine-readable instructions. @@ -335,7 +335,24 @@ void r300BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compi memset(code, 0, sizeof(struct r300_fragment_program_code)); - radeonPairProgram(compiler, &pair_handler, &emit); + for(struct rc_instruction * inst = compiler->Base.Program.Instructions.Next; + inst != &compiler->Base.Program.Instructions && !compiler->Base.Error; + inst = inst->Next) { + if (inst->Type == RC_INSTRUCTION_NORMAL) { + if (inst->U.I.Opcode == RC_OPCODE_BEGIN_TEX) { + begin_tex(&emit); + continue; + } + + emit_tex(&emit, inst); + } else { + emit_alu(&emit, &inst->U.P); + } + } + + if (code->pixsize >= R300_PFS_NUM_TEMP_REGS) + rc_error(&compiler->Base, "Too many hardware temporaries used.\n"); + if (compiler->Base.Error) return; diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c index 746e4495fe..5581f25352 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_fragprog.c @@ -114,6 +114,8 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) } rc_dataflow_deadcode(&c->Base, &dataflow_outputs_mark_use, c); + if (c->Base.Error) + return; if (c->Base.Debug) { fprintf(stderr, "Fragment Program: After deadcode:\n"); @@ -122,6 +124,8 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) } rc_dataflow_swizzles(&c->Base); + if (c->Base.Error) + return; if (c->Base.Debug) { fprintf(stderr, "Compiler: after dataflow passes:\n"); @@ -129,6 +133,40 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c) fflush(stderr); } + rc_pair_translate(c); + if (c->Base.Error) + return; + + if (c->Base.Debug) { + fprintf(stderr, "Compiler: after pair translate:\n"); + rc_print_program(&c->Base.Program); + fflush(stderr); + } + + rc_pair_schedule(c); + if (c->Base.Error) + return; + + if (c->Base.Debug) { + fprintf(stderr, "Compiler: after pair scheduling:\n"); + rc_print_program(&c->Base.Program); + fflush(stderr); + } + + if (c->is_r500) + rc_pair_regalloc(c, 128); + else + rc_pair_regalloc(c, R300_PFS_NUM_TEMP_REGS); + + if (c->Base.Error) + return; + + if (c->Base.Debug) { + fprintf(stderr, "Compiler: after pair register allocation:\n"); + rc_print_program(&c->Base.Program); + fflush(stderr); + } + if (c->is_r500) { r500BuildFragmentProgramHwCode(c); } else { diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c index 2f0c0d5283..8f618d88ad 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c @@ -37,10 +37,6 @@ * * \author Corbin Simpson * - * \todo Depth write, WPOS/FOGC inputs - * - * \todo FogOption - * */ #include "r500_fragprog.h" @@ -51,7 +47,6 @@ #define PROG_CODE \ - struct r300_fragment_program_compiler *c = (struct r300_fragment_program_compiler*)data; \ struct r500_fragment_program_code *code = &c->code->code.r500 #define error(fmt, args...) do { \ @@ -114,7 +109,7 @@ static unsigned int fix_hw_swizzle(unsigned int swz) return swz; } -static unsigned int translate_arg_rgb(struct radeon_pair_instruction *inst, int arg) +static unsigned int translate_arg_rgb(struct rc_pair_instruction *inst, int arg) { unsigned int t = inst->RGB.Arg[arg].Source; int comp; @@ -127,7 +122,7 @@ static unsigned int translate_arg_rgb(struct radeon_pair_instruction *inst, int return t; } -static unsigned int translate_arg_alpha(struct radeon_pair_instruction *inst, int i) +static unsigned int translate_arg_alpha(struct rc_pair_instruction *inst, int i) { unsigned int t = inst->Alpha.Arg[i].Source; t |= fix_hw_swizzle(inst->Alpha.Arg[i].Swizzle) << 2; @@ -144,16 +139,21 @@ static void use_temporary(struct r500_fragment_program_code* code, unsigned int static unsigned int use_source(struct r500_fragment_program_code* code, struct radeon_pair_instruction_source src) { - if (!src.Constant) + if (src.File == RC_FILE_CONSTANT) { + return src.Index | 0x100; + } else if (src.File == RC_FILE_TEMPORARY) { use_temporary(code, src.Index); - return src.Index | src.Constant << 8; + return src.Index; + } + + return 0; } /** * Emit a paired ALU instruction. */ -static int emit_paired(void *data, struct radeon_pair_instruction *inst) +static int emit_paired(struct r300_fragment_program_compiler *c, struct rc_pair_instruction *inst) { PROG_CODE; @@ -221,7 +221,7 @@ static unsigned int translate_strq_swizzle(unsigned int swizzle) /** * Emit a single TEX instruction */ -static int emit_tex(void *data, struct radeon_pair_texture_instruction *inst) +static int emit_tex(struct r300_fragment_program_compiler *c, struct rc_sub_instruction *inst) { PROG_CODE; @@ -233,46 +233,44 @@ static int emit_tex(void *data, struct radeon_pair_texture_instruction *inst) int ip = ++code->inst_end; code->inst[ip].inst0 = R500_INST_TYPE_TEX - | (inst->WriteMask << 11) + | (inst->DstReg.WriteMask << 11) | R500_INST_TEX_SEM_WAIT; code->inst[ip].inst1 = R500_TEX_ID(inst->TexSrcUnit) | R500_TEX_SEM_ACQUIRE | R500_TEX_IGNORE_UNCOVERED; if (inst->TexSrcTarget == RC_TEXTURE_RECT) - code->inst[ip].inst1 |= R500_TEX_UNSCALED; + code->inst[ip].inst1 |= R500_TEX_UNSCALED; switch (inst->Opcode) { - case RADEON_OPCODE_KIL: + case RC_OPCODE_KIL: code->inst[ip].inst1 |= R500_TEX_INST_TEXKILL; break; - case RADEON_OPCODE_TEX: + case RC_OPCODE_TEX: code->inst[ip].inst1 |= R500_TEX_INST_LD; break; - case RADEON_OPCODE_TXB: + case RC_OPCODE_TXB: code->inst[ip].inst1 |= R500_TEX_INST_LODBIAS; break; - case RADEON_OPCODE_TXP: + case RC_OPCODE_TXP: code->inst[ip].inst1 |= R500_TEX_INST_PROJ; break; default: error("emit_tex can't handle opcode %x\n", inst->Opcode); } - code->inst[ip].inst2 = R500_TEX_SRC_ADDR(inst->SrcIndex) - | (translate_strq_swizzle(inst->SrcSwizzle) << 8) - | R500_TEX_DST_ADDR(inst->DestIndex) + use_temporary(code, inst->SrcReg[0].Index); + if (inst->Opcode != RC_OPCODE_KIL) + use_temporary(code, inst->DstReg.Index); + + code->inst[ip].inst2 = R500_TEX_SRC_ADDR(inst->SrcReg[0].Index) + | (translate_strq_swizzle(inst->SrcReg[0].Swizzle) << 8) + | R500_TEX_DST_ADDR(inst->DstReg.Index) | R500_TEX_DST_R_SWIZ_R | R500_TEX_DST_G_SWIZ_G | R500_TEX_DST_B_SWIZ_B | R500_TEX_DST_A_SWIZ_A; return 1; } -static const struct radeon_pair_handler pair_handler = { - .EmitPaired = emit_paired, - .EmitTex = emit_tex, - .MaxHwTemps = 128 -}; - void r500BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compiler) { struct r500_fragment_program_code *code = &compiler->code->code.r500; @@ -281,7 +279,22 @@ void r500BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compi code->max_temp_idx = 1; code->inst_end = -1; - radeonPairProgram(compiler, &pair_handler, compiler); + for(struct rc_instruction * inst = compiler->Base.Program.Instructions.Next; + inst != &compiler->Base.Program.Instructions && !compiler->Base.Error; + inst = inst->Next) { + if (inst->Type == RC_INSTRUCTION_NORMAL) { + if (inst->U.I.Opcode == RC_OPCODE_BEGIN_TEX) + continue; + + emit_tex(compiler, &inst->U.I); + } else { + emit_paired(compiler, &inst->U.P); + } + } + + if (code->max_temp_idx >= 128) + rc_error(&compiler->Base, "Too many hardware temporaries used"); + if (compiler->Base.Error) return; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c index a171d8ab54..58dcb20d29 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c @@ -27,6 +27,136 @@ #include "radeon_dataflow.h" -#include "radeon_compiler.h" +#include "radeon_program.h" +static void reads_normal(struct rc_instruction * fullinst, rc_read_write_fn cb, void * userdata) +{ + struct rc_sub_instruction * inst = &fullinst->U.I; + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Opcode); + + for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) { + unsigned int refmask = 0; + + if (inst->SrcReg[src].File == RC_FILE_NONE) + return; + + for(unsigned int chan = 0; chan < 4; ++chan) + refmask |= 1 << GET_SWZ(inst->SrcReg[src].Swizzle, chan); + + refmask &= ~RC_MASK_XYZW; + + for(unsigned int chan = 0; chan < 4; ++chan) { + if (GET_BIT(refmask, chan)) { + cb(userdata, fullinst, inst->SrcReg[src].File, inst->SrcReg[src].Index, chan); + } + } + + if (refmask && inst->SrcReg[src].RelAddr) + cb(userdata, fullinst, RC_FILE_ADDRESS, 0, RC_MASK_X); + } +} + +static void reads_pair(struct rc_instruction * fullinst, rc_read_write_fn cb, void * userdata) +{ + struct rc_pair_instruction * inst = &fullinst->U.P; + unsigned int refmasks[3] = { 0, 0, 0 }; + + if (inst->RGB.Opcode != RC_OPCODE_NOP) { + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->RGB.Opcode); + + for(unsigned int arg = 0; arg < opcode->NumSrcRegs; ++arg) { + for(unsigned int chan = 0; chan < 3; ++chan) { + unsigned int swz = GET_SWZ(inst->RGB.Arg[arg].Swizzle, chan); + if (swz < 4) + refmasks[inst->RGB.Arg[arg].Source] |= 1 << swz; + } + } + } + + if (inst->Alpha.Opcode != RC_OPCODE_NOP) { + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Alpha.Opcode); + + for(unsigned int arg = 0; arg < opcode->NumSrcRegs; ++arg) { + if (inst->Alpha.Arg[arg].Swizzle < 4) + refmasks[inst->Alpha.Arg[arg].Source] |= 1 << inst->Alpha.Arg[arg].Swizzle; + } + } + + for(unsigned int src = 0; src < 3; ++src) { + if (inst->RGB.Src[src].Used) { + for(unsigned int chan = 0; chan < 3; ++chan) { + if (GET_BIT(refmasks[src], chan)) + cb(userdata, fullinst, inst->RGB.Src[src].File, inst->RGB.Src[src].Index, chan); + } + } + + if (inst->Alpha.Src[src].Used) { + if (GET_BIT(refmasks[src], 3)) + cb(userdata, fullinst, inst->Alpha.Src[src].File, inst->Alpha.Src[src].Index, 3); + } + } +} + +/** + * Calls a callback function for all sourced register channels. + * + * This is conservative, i.e. channels may be called multiple times, + * and the writemask of the instruction is not taken into account. + */ +void rc_for_all_reads(struct rc_instruction * inst, rc_read_write_fn cb, void * userdata) +{ + if (inst->Type == RC_INSTRUCTION_NORMAL) { + reads_normal(inst, cb, userdata); + } else { + reads_pair(inst, cb, userdata); + } +} + + + +static void writes_normal(struct rc_instruction * fullinst, rc_read_write_fn cb, void * userdata) +{ + struct rc_sub_instruction * inst = &fullinst->U.I; + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Opcode); + + if (opcode->HasDstReg) { + for(unsigned int chan = 0; chan < 4; ++chan) { + if (GET_BIT(inst->DstReg.WriteMask, chan)) + cb(userdata, fullinst, inst->DstReg.File, inst->DstReg.Index, chan); + } + } + + if (inst->WriteALUResult) + cb(userdata, fullinst, RC_FILE_SPECIAL, RC_SPECIAL_ALU_RESULT, 0); +} + +static void writes_pair(struct rc_instruction * fullinst, rc_read_write_fn cb, void * userdata) +{ + struct rc_pair_instruction * inst = &fullinst->U.P; + + for(unsigned int chan = 0; chan < 3; ++chan) { + if (GET_BIT(inst->RGB.WriteMask, chan)) + cb(userdata, fullinst, RC_FILE_TEMPORARY, inst->RGB.DestIndex, chan); + } + + if (inst->Alpha.WriteMask) + cb(userdata, fullinst, RC_FILE_TEMPORARY, inst->Alpha.DestIndex, 3); + + if (inst->WriteALUResult) + cb(userdata, fullinst, RC_FILE_SPECIAL, RC_SPECIAL_ALU_RESULT, 0); +} + +/** + * Calls a callback function for all written register channels. + * + * \warning Does not report output registers for paired instructions! + */ +void rc_for_all_writes(struct rc_instruction * inst, rc_read_write_fn cb, void * userdata) +{ + if (inst->Type == RC_INSTRUCTION_NORMAL) { + writes_normal(inst, cb, userdata); + } else { + writes_pair(inst, cb, userdata); + } +} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h index 76c323d057..5aa4cb64f3 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.h @@ -35,6 +35,17 @@ struct rc_instruction; struct rc_swizzle_caps; +/** + * Help analyze the register accesses of instructions. + */ +/*@{*/ +typedef void (*rc_read_write_fn)(void * userdata, struct rc_instruction * inst, + rc_register_file file, unsigned int index, unsigned int chan); +void rc_for_all_reads(struct rc_instruction * inst, rc_read_write_fn cb, void * userdata); +void rc_for_all_writes(struct rc_instruction * inst, rc_read_write_fn cb, void * userdata); +/*@}*/ + + /** * Compiler passes based on dataflow analysis. */ diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c index e097a62b55..a5072b5e1e 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c @@ -363,6 +363,10 @@ struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE] = { .Opcode = RC_OPCODE_REPL_ALPHA, .Name = "REPL_ALPHA", .HasDstReg = 1 + }, + { + .Opcode = RC_OPCODE_BEGIN_TEX, + .Name = "BEGIN_TEX" } }; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h index f8ba5255ca..c9c5b9f80f 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h @@ -183,6 +183,11 @@ typedef enum { * across all other channels */ RC_OPCODE_REPL_ALPHA, + /** special instruction, used in R300-R500 fragment programs + * to indicate the start of a block of texture instructions that + * can run simultaneously. */ + RC_OPCODE_BEGIN_TEX, + MAX_RC_OPCODE } rc_opcode; diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c new file mode 100644 index 0000000000..e39ac2f510 --- /dev/null +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c @@ -0,0 +1,349 @@ +/* + * Copyright (C) 2009 Nicolai Haehnle. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 "radeon_program_pair.h" + +#include + +#include "radeon_compiler.h" +#include "radeon_dataflow.h" + + +#define VERBOSE 0 + +#define DBG(...) do { if (VERBOSE) fprintf(stderr, __VA_ARGS__); } while(0) + + +struct live_intervals { + int Start; + int End; + struct live_intervals * Next; +}; + +struct register_info { + struct live_intervals Live; + + unsigned int Used:1; + unsigned int Allocated:1; + rc_register_file File:3; + unsigned int Index:RC_REGISTER_INDEX_BITS; +}; + +struct hardware_register { + struct live_intervals * Used; +}; + +struct regalloc_state { + struct radeon_compiler * C; + + struct register_info Input[RC_REGISTER_MAX_INDEX]; + struct register_info Temporary[RC_REGISTER_MAX_INDEX]; + + struct hardware_register * HwTemporary; + unsigned int NumHwTemporaries; +}; + +static void print_live_intervals(struct live_intervals * src) +{ + if (!src) { + DBG("(null)"); + return; + } + + while(src) { + DBG("(%i,%i)", src->Start, src->End); + src = src->Next; + } +} + +static void add_live_intervals(struct regalloc_state * s, + struct live_intervals ** dst, struct live_intervals * src) +{ + struct live_intervals ** dst_backup = dst; + + if (VERBOSE) { + DBG("add_live_intervals: "); + print_live_intervals(*dst); + DBG(" to "); + print_live_intervals(src); + DBG("\n"); + } + + while(src) { + if (*dst && (*dst)->End < src->Start) { + dst = &(*dst)->Next; + } else if (!*dst || (*dst)->Start > src->End) { + struct live_intervals * li = memory_pool_malloc(&s->C->Pool, sizeof(*li)); + li->Start = src->Start; + li->End = src->End; + li->Next = *dst; + *dst = li; + src = src->Next; + } else { + if (src->End > (*dst)->End) + (*dst)->End = src->End; + if (src->Start < (*dst)->Start) + (*dst)->Start = src->Start; + src = src->Next; + } + } + + if (VERBOSE) { + DBG(" result: "); + print_live_intervals(*dst_backup); + DBG("\n"); + } +} + +static int overlap_live_intervals(struct live_intervals * dst, struct live_intervals * src) +{ + if (VERBOSE) { + DBG("overlap_live_intervals: "); + print_live_intervals(dst); + DBG(" to "); + print_live_intervals(src); + DBG("\n"); + } + + while(src && dst) { + if (dst->End <= src->Start) { + dst = dst->Next; + } else if (dst->End <= src->End) { + DBG(" overlap\n"); + return 1; + } else if (dst->Start < src->End) { + DBG(" overlap\n"); + return 1; + } else { + src = src->Next; + } + } + + DBG(" no overlap\n"); + + return 0; +} + +static int try_add_live_intervals(struct regalloc_state * s, + struct live_intervals ** dst, struct live_intervals * src) +{ + if (overlap_live_intervals(*dst, src)) + return 0; + + add_live_intervals(s, dst, src); + return 1; +} + +static void scan_callback(void * data, struct rc_instruction * inst, + rc_register_file file, unsigned int index, unsigned int chan) +{ + struct regalloc_state * s = data; + struct register_info * reg; + + if (file == RC_FILE_TEMPORARY) + reg = &s->Temporary[index]; + else if (file == RC_FILE_INPUT) + reg = &s->Input[index]; + else + return; + + if (!reg->Used) { + reg->Used = 1; + if (file == RC_FILE_INPUT) + reg->Live.Start = -1; + else + reg->Live.Start = inst->IP; + } else { + if (inst->IP > reg->Live.End) + reg->Live.End = inst->IP; + } +} + +static void compute_live_intervals(struct regalloc_state * s) +{ + rc_recompute_ips(s->C); + + for(struct rc_instruction * inst = s->C->Program.Instructions.Next; + inst != &s->C->Program.Instructions; + inst = inst->Next) { + rc_for_all_reads(inst, scan_callback, s); + rc_for_all_writes(inst, scan_callback, s); + } +} + +static void rewrite_register(struct regalloc_state * s, + rc_register_file * file, unsigned int * index) +{ + const struct register_info * reg; + + if (*file == RC_FILE_TEMPORARY) + reg = &s->Temporary[*index]; + else if (*file == RC_FILE_INPUT) + reg = &s->Input[*index]; + else + return; + + if (reg->Allocated) { + *file = reg->File; + *index = reg->Index; + } +} + +static void rewrite_normal_instruction(struct regalloc_state * s, struct rc_sub_instruction * inst) +{ + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Opcode); + + if (opcode->HasDstReg) { + rc_register_file file = inst->DstReg.File; + unsigned int index = inst->DstReg.Index; + + rewrite_register(s, &file, &index); + + inst->DstReg.File = file; + inst->DstReg.Index = index; + } + + for(unsigned int src = 0; src < opcode->NumSrcRegs; ++src) { + rc_register_file file = inst->SrcReg[src].File; + unsigned int index = inst->SrcReg[src].Index; + + rewrite_register(s, &file, &index); + + inst->SrcReg[src].File = file; + inst->SrcReg[src].Index = index; + } +} + +static void rewrite_pair_instruction(struct regalloc_state * s, struct rc_pair_instruction * inst) +{ + if (inst->RGB.WriteMask) { + rc_register_file file = RC_FILE_TEMPORARY; + unsigned int index = inst->RGB.DestIndex; + + rewrite_register(s, &file, &index); + + inst->RGB.DestIndex = index; + } + + if (inst->Alpha.WriteMask) { + rc_register_file file = RC_FILE_TEMPORARY; + unsigned int index = inst->Alpha.DestIndex; + + rewrite_register(s, &file, &index); + + inst->Alpha.DestIndex = index; + } + + for(unsigned int src = 0; src < 3; ++src) { + if (inst->RGB.Src[src].Used) { + rc_register_file file = inst->RGB.Src[src].File; + unsigned int index = inst->RGB.Src[src].Index; + + rewrite_register(s, &file, &index); + + inst->RGB.Src[src].File = file; + inst->RGB.Src[src].Index = index; + } + + if (inst->Alpha.Src[src].Used) { + rc_register_file file = inst->Alpha.Src[src].File; + unsigned int index = inst->Alpha.Src[src].Index; + + rewrite_register(s, &file, &index); + + inst->Alpha.Src[src].File = file; + inst->Alpha.Src[src].Index = index; + } + } +} + +static void do_regalloc(struct regalloc_state * s) +{ + /* Simple and stupid greedy register allocation */ + for(unsigned int index = 0; index < RC_REGISTER_MAX_INDEX; ++index) { + struct register_info * reg = &s->Temporary[index]; + + if (!reg->Used) + continue; + + for(unsigned int hwreg = 0; hwreg < s->NumHwTemporaries; ++hwreg) { + if (try_add_live_intervals(s, &s->HwTemporary[hwreg].Used, ®->Live)) { + reg->Allocated = 1; + reg->File = RC_FILE_TEMPORARY; + reg->Index = hwreg; + goto success; + } + } + + rc_error(s->C, "Ran out of hardware temporaries\n"); + return; + + success:; + } + + /* Rewrite all instructions based on the translation table we built */ + for(struct rc_instruction * inst = s->C->Program.Instructions.Next; + inst != &s->C->Program.Instructions; + inst = inst->Next) { + if (inst->Type == RC_INSTRUCTION_NORMAL) + rewrite_normal_instruction(s, &inst->U.I); + else + rewrite_pair_instruction(s, &inst->U.P); + } +} + +static void alloc_input(void * data, unsigned int input, unsigned int hwreg) +{ + struct regalloc_state * s = data; + + if (!s->Input[input].Used) + return; + + add_live_intervals(s, &s->HwTemporary[hwreg].Used, &s->Input[input].Live); + + s->Input[input].Allocated = 1; + s->Input[input].File = RC_FILE_TEMPORARY; + s->Input[input].Index = hwreg; + +} + +void rc_pair_regalloc(struct r300_fragment_program_compiler *c, unsigned maxtemps) +{ + struct regalloc_state s; + + memset(&s, 0, sizeof(s)); + s.C = &c->Base; + s.NumHwTemporaries = maxtemps; + s.HwTemporary = memory_pool_malloc(&s.C->Pool, maxtemps*sizeof(struct hardware_register)); + memset(s.HwTemporary, 0, maxtemps*sizeof(struct hardware_register)); + + compute_live_intervals(&s); + + c->AllocateHwInputs(c, &alloc_input, &s); + + do_regalloc(&s); +} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c new file mode 100644 index 0000000000..8a4b5ac8a9 --- /dev/null +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c @@ -0,0 +1,479 @@ +/* + * Copyright (C) 2009 Nicolai Haehnle. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 "radeon_program_pair.h" + +#include + +#include "radeon_compiler.h" +#include "radeon_dataflow.h" + + +#define VERBOSE 0 + +#define DBG(...) do { if (VERBOSE) fprintf(stderr, __VA_ARGS__); } while(0) + +struct schedule_instruction { + struct rc_instruction * Instruction; + + /** Next instruction in the linked list of ready instructions. */ + struct schedule_instruction *NextReady; + + /** Values that this instruction reads and writes */ + struct reg_value * WriteValues[4]; + struct reg_value * ReadValues[12]; + unsigned int NumWriteValues:3; + unsigned int NumReadValues:4; + + /** + * Number of (read and write) dependencies that must be resolved before + * this instruction can be scheduled. + */ + unsigned int NumDependencies:5; +}; + + +/** + * Used to keep track of which instructions read a value. + */ +struct reg_value_reader { + struct schedule_instruction *Reader; + struct reg_value_reader *Next; +}; + +/** + * Used to keep track which values are stored in each component of a + * RC_FILE_TEMPORARY. + */ +struct reg_value { + struct schedule_instruction * Writer; + + /** + * Unordered linked list of instructions that read from this value. + * When this value becomes available, we increase all readers' + * dependency count. + */ + struct reg_value_reader *Readers; + + /** + * Number of readers of this value. This is decremented each time + * a reader of the value is committed. + * When the reader cound reaches zero, the dependency count + * of the instruction writing \ref Next is decremented. + */ + unsigned int NumReaders; + + struct reg_value *Next; /**< Pointer to the next value to be written to the same register */ +}; + +struct register_state { + struct reg_value * Values[4]; +}; + +struct schedule_state { + struct radeon_compiler * C; + struct schedule_instruction * Current; + + struct register_state Temporary[RC_REGISTER_MAX_INDEX]; + + /** + * Linked lists of instructions that can be scheduled right now, + * based on which ALU/TEX resources they require. + */ + /*@{*/ + struct schedule_instruction *ReadyFullALU; + struct schedule_instruction *ReadyRGB; + struct schedule_instruction *ReadyAlpha; + struct schedule_instruction *ReadyTEX; + /*@}*/ +}; + +static struct reg_value ** get_reg_valuep(struct schedule_state * s, + rc_register_file file, unsigned int index, unsigned int chan) +{ + if (file != RC_FILE_TEMPORARY) + return 0; + + if (index >= RC_REGISTER_MAX_INDEX) { + rc_error(s->C, "%s: index %i out of bounds\n", __FUNCTION__, index); + return 0; + } + + return &s->Temporary[index].Values[chan]; +} + +static struct reg_value * get_reg_value(struct schedule_state * s, + rc_register_file file, unsigned int index, unsigned int chan) +{ + struct reg_value ** pv = get_reg_valuep(s, file, index, chan); + if (!pv) + return 0; + return *pv; +} + +static void add_inst_to_list(struct schedule_instruction ** list, struct schedule_instruction * inst) +{ + inst->NextReady = *list; + *list = inst; +} + +static void instruction_ready(struct schedule_state * s, struct schedule_instruction * sinst) +{ + DBG("%i is now ready\n", sinst->Instruction->IP); + + if (sinst->Instruction->Type == RC_INSTRUCTION_NORMAL) + add_inst_to_list(&s->ReadyTEX, sinst); + else if (sinst->Instruction->U.P.Alpha.Opcode == RC_OPCODE_NOP) + add_inst_to_list(&s->ReadyRGB, sinst); + else if (sinst->Instruction->U.P.RGB.Opcode == RC_OPCODE_NOP) + add_inst_to_list(&s->ReadyAlpha, sinst); + else + add_inst_to_list(&s->ReadyFullALU, sinst); +} + +static void decrease_dependencies(struct schedule_state * s, struct schedule_instruction * sinst) +{ + assert(sinst->NumDependencies > 0); + sinst->NumDependencies--; + if (!sinst->NumDependencies) + instruction_ready(s, sinst); +} + +static void commit_instruction(struct schedule_state * s, struct schedule_instruction * sinst) +{ + DBG("%i: commit\n", sinst->Instruction->IP); + + for(unsigned int i = 0; i < sinst->NumReadValues; ++i) { + struct reg_value * v = sinst->ReadValues[i]; + assert(v->NumReaders > 0); + v->NumReaders--; + if (!v->NumReaders) { + if (v->Next) + decrease_dependencies(s, v->Next->Writer); + } + } + + for(unsigned int i = 0; i < sinst->NumWriteValues; ++i) { + struct reg_value * v = sinst->WriteValues[i]; + for(struct reg_value_reader * r = v->Readers; r; r = r->Next) { + decrease_dependencies(s, r->Reader); + } + } +} + +/** + * Emit all ready texture instructions in a single block. + * + * Emit as a single block to (hopefully) sample many textures in parallel, + * and to avoid hardware indirections on R300. + */ +static void emit_all_tex(struct schedule_state * s, struct rc_instruction * before) +{ + struct schedule_instruction *readytex; + + assert(s->ReadyTEX); + + /* Don't let the ready list change under us! */ + readytex = s->ReadyTEX; + s->ReadyTEX = 0; + + /* Node marker for R300 */ + struct rc_instruction * inst_begin = rc_insert_new_instruction(s->C, before->Prev); + inst_begin->U.I.Opcode = RC_OPCODE_BEGIN_TEX; + + /* Link texture instructions back in */ + while(readytex) { + struct schedule_instruction * tex = readytex; + readytex = readytex->NextReady; + + rc_insert_instruction(before->Prev, tex->Instruction); + commit_instruction(s, tex); + } +} + + +static int destructive_merge_instructions( + struct rc_pair_instruction * rgb, + struct rc_pair_instruction * alpha) +{ + assert(rgb->Alpha.Opcode == RC_OPCODE_NOP); + assert(alpha->RGB.Opcode == RC_OPCODE_NOP); + + /* Copy alpha args into rgb */ + const struct rc_opcode_info * opcode = rc_get_opcode_info(alpha->Alpha.Opcode); + + for(unsigned int arg = 0; arg < opcode->NumSrcRegs; ++arg) { + unsigned int srcrgb = 0; + unsigned int srcalpha = 0; + unsigned int oldsrc = alpha->Alpha.Arg[arg].Source; + rc_register_file file = 0; + unsigned int index = 0; + + if (alpha->Alpha.Arg[arg].Swizzle < 3) { + srcrgb = 1; + file = alpha->RGB.Src[oldsrc].File; + index = alpha->RGB.Src[oldsrc].Index; + } else if (alpha->Alpha.Arg[arg].Swizzle < 4) { + srcalpha = 1; + file = alpha->Alpha.Src[oldsrc].File; + index = alpha->Alpha.Src[oldsrc].Index; + } + + int source = rc_pair_alloc_source(rgb, srcrgb, srcalpha, file, index); + if (source < 0) + return 0; + + rgb->Alpha.Arg[arg].Source = source; + rgb->Alpha.Arg[arg].Swizzle = alpha->Alpha.Arg[arg].Swizzle; + rgb->Alpha.Arg[arg].Abs = alpha->Alpha.Arg[arg].Abs; + rgb->Alpha.Arg[arg].Negate = alpha->Alpha.Arg[arg].Negate; + } + + /* Copy alpha opcode into rgb */ + rgb->Alpha.Opcode = alpha->Alpha.Opcode; + rgb->Alpha.DestIndex = alpha->Alpha.DestIndex; + rgb->Alpha.WriteMask = alpha->Alpha.WriteMask; + rgb->Alpha.OutputWriteMask = alpha->Alpha.OutputWriteMask; + rgb->Alpha.DepthWriteMask = alpha->Alpha.DepthWriteMask; + rgb->Alpha.Saturate = alpha->Alpha.Saturate; + + /* Merge ALU result writing */ + if (alpha->WriteALUResult) { + if (rgb->WriteALUResult) + return 0; + + rgb->WriteALUResult = alpha->WriteALUResult; + rgb->ALUResultCompare = alpha->ALUResultCompare; + } + + return 1; +} + +/** + * Try to merge the given instructions into the rgb instructions. + * + * Return true on success; on failure, return false, and keep + * the instructions untouched. + */ +static int merge_instructions(struct rc_pair_instruction * rgb, struct rc_pair_instruction * alpha) +{ + struct rc_pair_instruction backup; + + memcpy(&backup, rgb, sizeof(struct rc_pair_instruction)); + + if (destructive_merge_instructions(rgb, alpha)) + return 1; + + memcpy(rgb, &backup, sizeof(struct rc_pair_instruction)); + return 0; +} + + +/** + * Find a good ALU instruction or pair of ALU instruction and emit it. + * + * Prefer emitting full ALU instructions, so that when we reach a point + * where no full ALU instruction can be emitted, we have more candidates + * for RGB/Alpha pairing. + */ +static void emit_one_alu(struct schedule_state *s, struct rc_instruction * before) +{ + struct schedule_instruction * sinst; + + if (s->ReadyFullALU || !(s->ReadyRGB && s->ReadyAlpha)) { + if (s->ReadyFullALU) { + sinst = s->ReadyFullALU; + s->ReadyFullALU = s->ReadyFullALU->NextReady; + } else if (s->ReadyRGB) { + sinst = s->ReadyRGB; + s->ReadyRGB = s->ReadyRGB->NextReady; + } else { + sinst = s->ReadyAlpha; + s->ReadyAlpha = s->ReadyAlpha->NextReady; + } + + rc_insert_instruction(before->Prev, sinst->Instruction); + commit_instruction(s, sinst); + } else { + struct schedule_instruction **prgb; + struct schedule_instruction **palpha; + + /* Some pairings might fail because they require too + * many source slots; try all possible pairings if necessary */ + for(prgb = &s->ReadyRGB; *prgb; prgb = &(*prgb)->NextReady) { + for(palpha = &s->ReadyAlpha; *palpha; palpha = &(*palpha)->NextReady) { + struct schedule_instruction * psirgb = *prgb; + struct schedule_instruction * psialpha = *palpha; + + if (!merge_instructions(&psirgb->Instruction->U.P, &psialpha->Instruction->U.P)) + continue; + + *prgb = (*prgb)->NextReady; + *palpha = (*palpha)->NextReady; + rc_insert_instruction(before->Prev, psirgb->Instruction); + commit_instruction(s, psirgb); + commit_instruction(s, psialpha); + goto success; + } + } + + /* No success in pairing; just take the first RGB instruction */ + sinst = s->ReadyRGB; + s->ReadyRGB = s->ReadyRGB->NextReady; + + rc_insert_instruction(before->Prev, sinst->Instruction); + commit_instruction(s, sinst); + success: ; + } +} + +static void scan_read(void * data, struct rc_instruction * inst, + rc_register_file file, unsigned int index, unsigned int chan) +{ + struct schedule_state * s = data; + struct reg_value * v = get_reg_value(s, file, index, chan); + + if (!v) + return; + + DBG("%i: read %i[%i] chan %i\n", s->Current->Instruction->IP, file, index, chan); + + struct reg_value_reader * reader = memory_pool_malloc(&s->C->Pool, sizeof(*reader)); + reader->Reader = s->Current; + reader->Next = v->Readers; + v->Readers = reader; + v->NumReaders++; + + s->Current->NumDependencies++; + + if (s->Current->NumReadValues >= 12) { + rc_error(s->C, "%s: NumReadValues overflow\n", __FUNCTION__); + } else { + s->Current->ReadValues[s->Current->NumReadValues++] = v; + } +} + +static void scan_write(void * data, struct rc_instruction * inst, + rc_register_file file, unsigned int index, unsigned int chan) +{ + struct schedule_state * s = data; + struct reg_value ** pv = get_reg_valuep(s, file, index, chan); + + if (!pv) + return; + + DBG("%i: write %i[%i] chan %i\n", s->Current->Instruction->IP, file, index, chan); + + struct reg_value * newv = memory_pool_malloc(&s->C->Pool, sizeof(*newv)); + memset(newv, 0, sizeof(*newv)); + + newv->Writer = s->Current; + + if (*pv) { + (*pv)->Next = newv; + s->Current->NumDependencies++; + } + + *pv = newv; + + if (s->Current->NumWriteValues >= 4) { + rc_error(s->C, "%s: NumWriteValues overflow\n", __FUNCTION__); + } else { + s->Current->WriteValues[s->Current->NumWriteValues++] = newv; + } +} + +static void schedule_block(struct r300_fragment_program_compiler * c, + struct rc_instruction * begin, struct rc_instruction * end) +{ + struct schedule_state s; + + memset(&s, 0, sizeof(s)); + s.C = &c->Base; + + /* Scan instructions for data dependencies */ + unsigned int ip = 0; + for(struct rc_instruction * inst = begin; inst != end; inst = inst->Next) { + s.Current = memory_pool_malloc(&c->Base.Pool, sizeof(*s.Current)); + memset(s.Current, 0, sizeof(struct schedule_instruction)); + + s.Current->Instruction = inst; + inst->IP = ip++; + + DBG("%i: Scanning\n", inst->IP); + + rc_for_all_reads(inst, &scan_read, &s); + rc_for_all_writes(inst, &scan_write, &s); + + DBG("%i: Has %i dependencies\n", inst->IP, s.Current->NumDependencies); + + if (!s.Current->NumDependencies) + instruction_ready(&s, s.Current); + } + + /* Temporarily unlink all instructions */ + begin->Prev->Next = end; + end->Prev = begin->Prev; + + /* Schedule instructions back */ + while(!s.C->Error && + (s.ReadyTEX || s.ReadyRGB || s.ReadyAlpha || s.ReadyFullALU)) { + if (s.ReadyTEX) + emit_all_tex(&s, end); + + while(!s.C->Error && (s.ReadyFullALU || s.ReadyRGB || s.ReadyAlpha)) + emit_one_alu(&s, end); + } +} + +static int is_controlflow(struct rc_instruction * inst) +{ + if (inst->Type == RC_INSTRUCTION_NORMAL) { + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); + return opcode->IsControlFlow; + } + return 0; +} + +void rc_pair_schedule(struct r300_fragment_program_compiler *c) +{ + struct rc_instruction * inst = c->Base.Program.Instructions.Next; + while(inst != &c->Base.Program.Instructions) { + if (is_controlflow(inst)) { + inst = inst->Next; + continue; + } + + struct rc_instruction * first = inst; + + while(inst != &c->Base.Program.Instructions && !is_controlflow(inst)) + inst = inst->Next; + + DBG("Schedule one block\n"); + schedule_block(c, first, inst); + } +} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c new file mode 100644 index 0000000000..c31891a62f --- /dev/null +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c @@ -0,0 +1,253 @@ +/* + * Copyright (C) 2009 Nicolai Haehnle. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 "radeon_program_pair.h" + +#include "radeon_compiler.h" + + +/** + * Finally rewrite ADD, MOV, MUL as the appropriate native instruction + * and reverse the order of arguments for CMP. + */ +static void final_rewrite(struct rc_sub_instruction *inst) +{ + struct rc_src_register tmp; + + switch(inst->Opcode) { + case RC_OPCODE_ADD: + inst->SrcReg[2] = inst->SrcReg[1]; + inst->SrcReg[1].File = RC_FILE_NONE; + inst->SrcReg[1].Swizzle = RC_SWIZZLE_1111; + inst->SrcReg[1].Negate = RC_MASK_NONE; + inst->Opcode = RC_OPCODE_MAD; + break; + case RC_OPCODE_CMP: + tmp = inst->SrcReg[2]; + inst->SrcReg[2] = inst->SrcReg[0]; + inst->SrcReg[0] = tmp; + break; + case RC_OPCODE_MOV: + /* AMD say we should use CMP. + * However, when we transform + * KIL -r0; + * into + * CMP tmp, -r0, -r0, 0; + * KIL tmp; + * we get incorrect behaviour on R500 when r0 == 0.0. + * It appears that the R500 KIL hardware treats -0.0 as less + * than zero. + */ + inst->SrcReg[1].File = RC_FILE_NONE; + inst->SrcReg[1].Swizzle = RC_SWIZZLE_1111; + inst->SrcReg[2].File = RC_FILE_NONE; + inst->SrcReg[2].Swizzle = RC_SWIZZLE_0000; + inst->Opcode = RC_OPCODE_MAD; + break; + case RC_OPCODE_MUL: + inst->SrcReg[2].File = RC_FILE_NONE; + inst->SrcReg[2].Swizzle = RC_SWIZZLE_0000; + inst->Opcode = RC_OPCODE_MAD; + break; + default: + /* nothing to do */ + break; + } +} + + +/** + * Classify an instruction according to which ALUs etc. it needs + */ +static void classify_instruction(struct rc_sub_instruction * inst, + int * needrgb, int * needalpha, int * istranscendent) +{ + *needrgb = (inst->DstReg.WriteMask & RC_MASK_XYZ) ? 1 : 0; + *needalpha = (inst->DstReg.WriteMask & RC_MASK_W) ? 1 : 0; + *istranscendent = 0; + + if (inst->WriteALUResult == RC_ALURESULT_X) + *needrgb = 1; + else if (inst->WriteALUResult == RC_ALURESULT_W) + *needalpha = 1; + + switch(inst->Opcode) { + case RC_OPCODE_ADD: + case RC_OPCODE_CMP: + case RC_OPCODE_DDX: + case RC_OPCODE_DDY: + case RC_OPCODE_FRC: + case RC_OPCODE_MAD: + case RC_OPCODE_MAX: + case RC_OPCODE_MIN: + case RC_OPCODE_MOV: + case RC_OPCODE_MUL: + break; + case RC_OPCODE_COS: + case RC_OPCODE_EX2: + case RC_OPCODE_LG2: + case RC_OPCODE_RCP: + case RC_OPCODE_RSQ: + case RC_OPCODE_SIN: + *istranscendent = 1; + *needalpha = 1; + break; + case RC_OPCODE_DP4: + *needalpha = 1; + /* fall through */ + case RC_OPCODE_DP3: + *needrgb = 1; + break; + default: + break; + } +} + + +/** + * Fill the given ALU instruction's opcodes and source operands into the given pair, + * if possible. + */ +static void set_pair_instruction(struct r300_fragment_program_compiler *c, + struct rc_pair_instruction * pair, + struct rc_sub_instruction * inst) +{ + memset(pair, 0, sizeof(struct rc_pair_instruction)); + + int needrgb, needalpha, istranscendent; + classify_instruction(inst, &needrgb, &needalpha, &istranscendent); + + if (needrgb) { + if (istranscendent) + pair->RGB.Opcode = RC_OPCODE_REPL_ALPHA; + else + pair->RGB.Opcode = inst->Opcode; + if (inst->SaturateMode == RC_SATURATE_ZERO_ONE) + pair->RGB.Saturate = 1; + } + if (needalpha) { + pair->Alpha.Opcode = inst->Opcode; + if (inst->SaturateMode == RC_SATURATE_ZERO_ONE) + pair->Alpha.Saturate = 1; + } + + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Opcode); + int nargs = opcode->NumSrcRegs; + int i; + + /* Special case for DDX/DDY (MDH/MDV). */ + if (inst->Opcode == RC_OPCODE_DDX || inst->Opcode == RC_OPCODE_DDY) { + nargs++; + } + + for(i = 0; i < opcode->NumSrcRegs; ++i) { + int source; + if (needrgb && !istranscendent) { + unsigned int srcrgb = 0; + unsigned int srcalpha = 0; + int j; + for(j = 0; j < 3; ++j) { + unsigned int swz = GET_SWZ(inst->SrcReg[i].Swizzle, j); + if (swz < 3) + srcrgb = 1; + else if (swz < 4) + srcalpha = 1; + } + source = rc_pair_alloc_source(pair, srcrgb, srcalpha, + inst->SrcReg[i].File, inst->SrcReg[i].Index); + pair->RGB.Arg[i].Source = source; + pair->RGB.Arg[i].Swizzle = inst->SrcReg[i].Swizzle & 0x1ff; + pair->RGB.Arg[i].Abs = inst->SrcReg[i].Abs; + pair->RGB.Arg[i].Negate = !!(inst->SrcReg[i].Negate & (RC_MASK_X | RC_MASK_Y | RC_MASK_Z)); + } + if (needalpha) { + unsigned int srcrgb = 0; + unsigned int srcalpha = 0; + unsigned int swz = GET_SWZ(inst->SrcReg[i].Swizzle, istranscendent ? 0 : 3); + if (swz < 3) + srcrgb = 1; + else if (swz < 4) + srcalpha = 1; + source = rc_pair_alloc_source(pair, srcrgb, srcalpha, + inst->SrcReg[i].File, inst->SrcReg[i].Index); + pair->Alpha.Arg[i].Source = source; + pair->Alpha.Arg[i].Swizzle = swz; + pair->Alpha.Arg[i].Abs = inst->SrcReg[i].Abs; + pair->Alpha.Arg[i].Negate = !!(inst->SrcReg[i].Negate & RC_MASK_W); + } + } + + /* Destination handling */ + if (inst->DstReg.File == RC_FILE_OUTPUT) { + if (inst->DstReg.Index == c->OutputColor) { + pair->RGB.OutputWriteMask |= inst->DstReg.WriteMask & RC_MASK_XYZ; + pair->Alpha.OutputWriteMask |= GET_BIT(inst->DstReg.WriteMask, 3); + } else if (inst->DstReg.Index == c->OutputDepth) { + pair->Alpha.DepthWriteMask |= GET_BIT(inst->DstReg.WriteMask, 3); + } + } else { + if (needrgb) { + pair->RGB.DestIndex = inst->DstReg.Index; + pair->RGB.WriteMask |= inst->DstReg.WriteMask & RC_MASK_XYZ; + } + if (needalpha) { + pair->Alpha.DestIndex = inst->DstReg.Index; + pair->Alpha.WriteMask |= GET_BIT(inst->DstReg.WriteMask, 3); + } + } + + if (inst->WriteALUResult) { + pair->WriteALUResult = inst->WriteALUResult; + pair->ALUResultCompare = inst->ALUResultCompare; + } +} + + +/** + * Translate all ALU instructions into corresponding pair instructions, + * performing no other changes. + */ +void rc_pair_translate(struct r300_fragment_program_compiler *c) +{ + for(struct rc_instruction * inst = c->Base.Program.Instructions.Next; + inst != &c->Base.Program.Instructions; + inst = inst->Next) { + if (inst->Type != RC_INSTRUCTION_NORMAL) + continue; + + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); + + if (opcode->HasTexture || opcode->IsControlFlow || opcode->Opcode == RC_OPCODE_KIL) + continue; + + struct rc_sub_instruction copy = inst->U.I; + + final_rewrite(©); + inst->Type = RC_INSTRUCTION_PAIR; + set_pair_instruction(c, &inst->U.P, ©); + } +} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.c b/src/mesa/drivers/dri/r300/compiler/radeon_program.c index 68a093b8c0..0dbc5380bb 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.c @@ -138,16 +138,20 @@ struct rc_instruction *rc_alloc_instruction(struct radeon_compiler * c) return inst; } - -struct rc_instruction *rc_insert_new_instruction(struct radeon_compiler * c, struct rc_instruction * after) +void rc_insert_instruction(struct rc_instruction * after, struct rc_instruction * inst) { - struct rc_instruction * inst = rc_alloc_instruction(c); - inst->Prev = after; inst->Next = after->Next; inst->Prev->Next = inst; inst->Next->Prev = inst; +} + +struct rc_instruction *rc_insert_new_instruction(struct radeon_compiler * c, struct rc_instruction * after) +{ + struct rc_instruction * inst = rc_alloc_instruction(c); + + rc_insert_instruction(after, inst); return inst; } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.h b/src/mesa/drivers/dri/r300/compiler/radeon_program.h index 067cb545fd..33db3ea0ff 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.h @@ -34,6 +34,7 @@ #include "radeon_opcodes.h" #include "radeon_code.h" #include "radeon_program_constants.h" +#include "radeon_program_pair.h" struct radeon_compiler; @@ -121,6 +122,7 @@ struct rc_instruction { rc_instruction_type Type; union { struct rc_sub_instruction I; + struct rc_pair_instruction P; } U; /** @@ -221,6 +223,7 @@ unsigned int rc_find_free_temporary(struct radeon_compiler * c); struct rc_instruction *rc_alloc_instruction(struct radeon_compiler * c); struct rc_instruction *rc_insert_new_instruction(struct radeon_compiler * c, struct rc_instruction * after); +void rc_insert_instruction(struct rc_instruction * after, struct rc_instruction * inst); void rc_remove_instruction(struct rc_instruction * inst); unsigned int rc_recompute_ips(struct radeon_compiler * c); diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c index 0d8d8e0b3b..ee839596aa 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Nicolai Haehnle. + * Copyright (C) 2008-2009 Nicolai Haehnle. * * All Rights Reserved. * @@ -25,581 +25,29 @@ * */ -/** - * @file - * - * Perform temporary register allocation and attempt to pair off instructions - * in RGB and Alpha pairs. Also attempts to optimize the TEX instruction - * vs. ALU instruction scheduling. - */ - #include "radeon_program_pair.h" -#include - -#include "memory_pool.h" -#include "radeon_compiler.h" - -#define error(fmt, args...) do { \ - rc_error(&s->Compiler->Base, "%s::%s(): " fmt "\n", \ - __FILE__, __FUNCTION__, ##args); \ -} while(0) - -struct pair_state_instruction { - struct rc_sub_instruction Instruction; - unsigned int IP; /**< Position of this instruction in original program */ - - unsigned int IsTex:1; /**< Is a texture instruction */ - unsigned int NeedRGB:1; /**< Needs the RGB ALU */ - unsigned int NeedAlpha:1; /**< Needs the Alpha ALU */ - unsigned int IsTranscendent:1; /**< Is a special transcendent instruction */ - - /** - * Number of (read and write) dependencies that must be resolved before - * this instruction can be scheduled. - */ - unsigned int NumDependencies:5; - - /** - * Next instruction in the linked list of ready instructions. - */ - struct pair_state_instruction *NextReady; - - /** - * Values that this instruction writes - */ - struct reg_value *Values[4]; -}; - - -/** - * Used to keep track of which instructions read a value. - */ -struct reg_value_reader { - struct pair_state_instruction *Reader; - struct reg_value_reader *Next; -}; - -/** - * Used to keep track which values are stored in each component of a - * RC_FILE_TEMPORARY. - */ -struct reg_value { - struct pair_state_instruction *Writer; - struct reg_value *Next; /**< Pointer to the next value to be written to the same RC_FILE_TEMPORARY component */ - - /** - * Unordered linked list of instructions that read from this value. - */ - struct reg_value_reader *Readers; - - /** - * Number of readers of this value. This is calculated during @ref scan_instructions - * and continually decremented during code emission. - * When this count reaches zero, the instruction that writes the @ref Next value - * can be scheduled. - */ - unsigned int NumReaders; -}; - -/** - * Used to translate a RC_FILE_INPUT or RC_FILE_TEMPORARY Mesa register - * to the proper hardware temporary. - */ -struct pair_register_translation { - unsigned int Allocated:1; - unsigned int HwIndex:8; - unsigned int RefCount:23; /**< # of times this occurs in an unscheduled instruction SrcReg or DstReg */ - - /** - * Notes the value that is currently contained in each component - * (only used for RC_FILE_TEMPORARY registers). - */ - struct reg_value *Value[4]; -}; - -struct pair_state { - struct r300_fragment_program_compiler * Compiler; - const struct radeon_pair_handler *Handler; - unsigned int Verbose; - void *UserData; - - /** - * Translate Mesa registers to hardware registers - */ - struct pair_register_translation Inputs[RC_REGISTER_MAX_INDEX]; - struct pair_register_translation Temps[RC_REGISTER_MAX_INDEX]; - - struct { - unsigned int RefCount; /**< # of times this occurs in an unscheduled SrcReg or DstReg */ - } HwTemps[128]; - - /** - * Linked list of instructions that can be scheduled right now, - * based on which ALU/TEX resources they require. - */ - struct pair_state_instruction *ReadyFullALU; - struct pair_state_instruction *ReadyRGB; - struct pair_state_instruction *ReadyAlpha; - struct pair_state_instruction *ReadyTEX; -}; - - -static struct pair_register_translation *get_register(struct pair_state *s, rc_register_file file, unsigned int index) -{ - switch(file) { - case RC_FILE_TEMPORARY: return &s->Temps[index]; - case RC_FILE_INPUT: return &s->Inputs[index]; - default: return 0; - } -} - -static void alloc_hw_reg(struct pair_state *s, rc_register_file file, unsigned int index, unsigned int hwindex) -{ - struct pair_register_translation *t = get_register(s, file, index); - assert(!s->HwTemps[hwindex].RefCount); - assert(!t->Allocated); - s->HwTemps[hwindex].RefCount = t->RefCount; - t->Allocated = 1; - t->HwIndex = hwindex; -} - -static unsigned int get_hw_reg(struct pair_state *s, rc_register_file file, unsigned int index) -{ - unsigned int hwindex; - - struct pair_register_translation *t = get_register(s, file, index); - if (!t) { - error("get_hw_reg: %i[%i]\n", file, index); - return 0; - } - - if (t->Allocated) - return t->HwIndex; - - for(hwindex = 0; hwindex < s->Handler->MaxHwTemps; ++hwindex) - if (!s->HwTemps[hwindex].RefCount) - break; - - if (hwindex >= s->Handler->MaxHwTemps) { - error("Ran out of hardware temporaries"); - return 0; - } - - alloc_hw_reg(s, file, index, hwindex); - return hwindex; -} - - -static void deref_hw_reg(struct pair_state *s, unsigned int hwindex) -{ - if (!s->HwTemps[hwindex].RefCount) { - error("Hwindex %i refcount error", hwindex); - return; - } - - s->HwTemps[hwindex].RefCount--; -} - -static void add_pairinst_to_list(struct pair_state_instruction **list, struct pair_state_instruction *pairinst) -{ - pairinst->NextReady = *list; - *list = pairinst; -} - -/** - * The given instruction has become ready. Link it into the ready - * instructions. - */ -static void instruction_ready(struct pair_state *s, struct pair_state_instruction *pairinst) -{ - if (s->Verbose) - fprintf(stderr, "instruction_ready(%i)\n", pairinst->IP); - - if (pairinst->IsTex) - add_pairinst_to_list(&s->ReadyTEX, pairinst); - else if (!pairinst->NeedAlpha) - add_pairinst_to_list(&s->ReadyRGB, pairinst); - else if (!pairinst->NeedRGB) - add_pairinst_to_list(&s->ReadyAlpha, pairinst); - else - add_pairinst_to_list(&s->ReadyFullALU, pairinst); -} - - -/** - * Finally rewrite ADD, MOV, MUL as the appropriate native instruction - * and reverse the order of arguments for CMP. - */ -static void final_rewrite(struct pair_state *s, struct rc_sub_instruction *inst) -{ - struct rc_src_register tmp; - - switch(inst->Opcode) { - case RC_OPCODE_ADD: - inst->SrcReg[2] = inst->SrcReg[1]; - inst->SrcReg[1].File = RC_FILE_NONE; - inst->SrcReg[1].Swizzle = RC_SWIZZLE_1111; - inst->SrcReg[1].Negate = RC_MASK_NONE; - inst->Opcode = RC_OPCODE_MAD; - break; - case RC_OPCODE_CMP: - tmp = inst->SrcReg[2]; - inst->SrcReg[2] = inst->SrcReg[0]; - inst->SrcReg[0] = tmp; - break; - case RC_OPCODE_MOV: - /* AMD say we should use CMP. - * However, when we transform - * KIL -r0; - * into - * CMP tmp, -r0, -r0, 0; - * KIL tmp; - * we get incorrect behaviour on R500 when r0 == 0.0. - * It appears that the R500 KIL hardware treats -0.0 as less - * than zero. - */ - inst->SrcReg[1].File = RC_FILE_NONE; - inst->SrcReg[1].Swizzle = RC_SWIZZLE_1111; - inst->SrcReg[2].File = RC_FILE_NONE; - inst->SrcReg[2].Swizzle = RC_SWIZZLE_0000; - inst->Opcode = RC_OPCODE_MAD; - break; - case RC_OPCODE_MUL: - inst->SrcReg[2].File = RC_FILE_NONE; - inst->SrcReg[2].Swizzle = RC_SWIZZLE_0000; - inst->Opcode = RC_OPCODE_MAD; - break; - default: - /* nothing to do */ - break; - } -} - - -/** - * Classify an instruction according to which ALUs etc. it needs - */ -static void classify_instruction(struct pair_state *s, - struct pair_state_instruction *psi) -{ - psi->NeedRGB = (psi->Instruction.DstReg.WriteMask & RC_MASK_XYZ) ? 1 : 0; - psi->NeedAlpha = (psi->Instruction.DstReg.WriteMask & RC_MASK_W) ? 1 : 0; - - switch(psi->Instruction.Opcode) { - case RC_OPCODE_ADD: - case RC_OPCODE_CMP: - case RC_OPCODE_DDX: - case RC_OPCODE_DDY: - case RC_OPCODE_FRC: - case RC_OPCODE_MAD: - case RC_OPCODE_MAX: - case RC_OPCODE_MIN: - case RC_OPCODE_MOV: - case RC_OPCODE_MUL: - break; - case RC_OPCODE_COS: - case RC_OPCODE_EX2: - case RC_OPCODE_LG2: - case RC_OPCODE_RCP: - case RC_OPCODE_RSQ: - case RC_OPCODE_SIN: - psi->IsTranscendent = 1; - psi->NeedAlpha = 1; - break; - case RC_OPCODE_DP4: - psi->NeedAlpha = 1; - /* fall through */ - case RC_OPCODE_DP3: - psi->NeedRGB = 1; - break; - case RC_OPCODE_KIL: - case RC_OPCODE_TEX: - case RC_OPCODE_TXB: - case RC_OPCODE_TXP: - psi->IsTex = 1; - break; - default: - error("Unknown opcode %d\n", psi->Instruction.Opcode); - break; - } -} - - -/** - * Count which (input, temporary) register is read and written how often, - * and scan the instruction stream to find dependencies. - */ -static void scan_instructions(struct pair_state *s) -{ - struct rc_instruction *source; - unsigned int ip; - - for(source = s->Compiler->Base.Program.Instructions.Next, ip = 0; - source != &s->Compiler->Base.Program.Instructions; - source = source->Next, ++ip) { - struct pair_state_instruction *pairinst = memory_pool_malloc(&s->Compiler->Base.Pool, sizeof(*pairinst)); - memset(pairinst, 0, sizeof(struct pair_state_instruction)); - - pairinst->Instruction = source->U.I; - pairinst->IP = ip; - final_rewrite(s, &pairinst->Instruction); - classify_instruction(s, pairinst); - - const struct rc_opcode_info * opcode = rc_get_opcode_info(pairinst->Instruction.Opcode); - int j; - for(j = 0; j < opcode->NumSrcRegs; j++) { - struct pair_register_translation *t = - get_register(s, pairinst->Instruction.SrcReg[j].File, pairinst->Instruction.SrcReg[j].Index); - if (!t) - continue; - - t->RefCount++; - - if (pairinst->Instruction.SrcReg[j].File == RC_FILE_TEMPORARY) { - int i; - for(i = 0; i < 4; ++i) { - unsigned int swz = GET_SWZ(pairinst->Instruction.SrcReg[j].Swizzle, i); - if (swz >= 4) - continue; /* constant or NIL swizzle */ - if (!t->Value[swz]) - continue; /* this is an undefined read */ - - /* Do not add a dependency if this instruction - * also rewrites the value. The code below adds - * a dependency for the DstReg, which is a superset - * of the SrcReg dependency. */ - if (pairinst->Instruction.DstReg.File == RC_FILE_TEMPORARY && - pairinst->Instruction.DstReg.Index == pairinst->Instruction.SrcReg[j].Index && - GET_BIT(pairinst->Instruction.DstReg.WriteMask, swz)) - continue; - - struct reg_value_reader* r = memory_pool_malloc(&s->Compiler->Base.Pool, sizeof(*r)); - pairinst->NumDependencies++; - t->Value[swz]->NumReaders++; - r->Reader = pairinst; - r->Next = t->Value[swz]->Readers; - t->Value[swz]->Readers = r; - } - } - } - - if (opcode->HasDstReg) { - struct pair_register_translation *t = - get_register(s, pairinst->Instruction.DstReg.File, pairinst->Instruction.DstReg.Index); - if (t) { - t->RefCount++; - - if (pairinst->Instruction.DstReg.File == RC_FILE_TEMPORARY) { - int j; - for(j = 0; j < 4; ++j) { - if (!GET_BIT(pairinst->Instruction.DstReg.WriteMask, j)) - continue; - - struct reg_value* v = memory_pool_malloc(&s->Compiler->Base.Pool, sizeof(*v)); - memset(v, 0, sizeof(struct reg_value)); - v->Writer = pairinst; - if (t->Value[j]) { - pairinst->NumDependencies++; - t->Value[j]->Next = v; - } - t->Value[j] = v; - pairinst->Values[j] = v; - } - } - } - } - - if (s->Verbose) - fprintf(stderr, "scan(%i): NumDeps = %i\n", ip, pairinst->NumDependencies); - - if (!pairinst->NumDependencies) - instruction_ready(s, pairinst); - } - - /* Clear the RC_FILE_TEMPORARY state */ - int i, j; - for(i = 0; i < RC_REGISTER_MAX_INDEX; ++i) { - for(j = 0; j < 4; ++j) - s->Temps[i].Value[j] = 0; - } -} - - -static void decrement_dependencies(struct pair_state *s, struct pair_state_instruction *pairinst) -{ - assert(pairinst->NumDependencies > 0); - if (!--pairinst->NumDependencies) - instruction_ready(s, pairinst); -} /** - * Update the dependency tracking state based on what the instruction - * at the given IP does. + * Return the source slot where we installed the given register access, + * or -1 if no slot was free anymore. */ -static void commit_instruction(struct pair_state *s, struct pair_state_instruction *pairinst) -{ - struct rc_sub_instruction *inst = &pairinst->Instruction; - - if (s->Verbose) - fprintf(stderr, "commit_instruction(%i)\n", pairinst->IP); - - if (inst->DstReg.File == RC_FILE_TEMPORARY) { - struct pair_register_translation *t = &s->Temps[inst->DstReg.Index]; - deref_hw_reg(s, t->HwIndex); - - int i; - for(i = 0; i < 4; ++i) { - if (!GET_BIT(inst->DstReg.WriteMask, i)) - continue; - - t->Value[i] = pairinst->Values[i]; - if (t->Value[i]->NumReaders) { - struct reg_value_reader *r; - for(r = pairinst->Values[i]->Readers; r; r = r->Next) - decrement_dependencies(s, r->Reader); - } else if (t->Value[i]->Next) { - /* This happens when the only reader writes - * the register at the same time */ - decrement_dependencies(s, t->Value[i]->Next->Writer); - } - } - } - - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Opcode); - int i; - for(i = 0; i < opcode->NumSrcRegs; i++) { - struct pair_register_translation *t = get_register(s, inst->SrcReg[i].File, inst->SrcReg[i].Index); - if (!t) - continue; - - deref_hw_reg(s, get_hw_reg(s, inst->SrcReg[i].File, inst->SrcReg[i].Index)); - - if (inst->SrcReg[i].File != RC_FILE_TEMPORARY) - continue; - - int j; - for(j = 0; j < 4; ++j) { - unsigned int swz = GET_SWZ(inst->SrcReg[i].Swizzle, j); - if (swz >= 4) - continue; - if (!t->Value[swz]) - continue; - - /* Do not free a dependency if this instruction - * also rewrites the value. See scan_instructions. */ - if (inst->DstReg.File == RC_FILE_TEMPORARY && - inst->DstReg.Index == inst->SrcReg[i].Index && - GET_BIT(inst->DstReg.WriteMask, swz)) - continue; - - if (!--t->Value[swz]->NumReaders) { - if (t->Value[swz]->Next) - decrement_dependencies(s, t->Value[swz]->Next->Writer); - } - } - } -} - - -/** - * Emit all ready texture instructions in a single block. - * - * Emit as a single block to (hopefully) sample many textures in parallel, - * and to avoid hardware indirections on R300. - * - * In R500, we don't really know when the result of a texture instruction - * arrives. So allocate all destinations first, to make sure they do not - * arrive early and overwrite a texture coordinate we're going to use later - * in the block. - */ -static void emit_all_tex(struct pair_state *s) -{ - struct pair_state_instruction *readytex; - struct pair_state_instruction *pairinst; - - assert(s->ReadyTEX); - - // Don't let the ready list change under us! - readytex = s->ReadyTEX; - s->ReadyTEX = 0; - - // Allocate destination hardware registers in one block to avoid conflicts. - for(pairinst = readytex; pairinst; pairinst = pairinst->NextReady) { - struct rc_sub_instruction *inst = &pairinst->Instruction; - if (inst->Opcode != RC_OPCODE_KIL) - get_hw_reg(s, inst->DstReg.File, inst->DstReg.Index); - } - - if (s->Compiler->Base.Debug) - fprintf(stderr, " BEGIN_TEX\n"); - - if (s->Handler->BeginTexBlock) - s->Compiler->Base.Error = s->Compiler->Base.Error || !s->Handler->BeginTexBlock(s->UserData); - - for(pairinst = readytex; pairinst; pairinst = pairinst->NextReady) { - struct rc_sub_instruction *inst = &pairinst->Instruction; - commit_instruction(s, pairinst); - - if (inst->Opcode != RC_OPCODE_KIL) - inst->DstReg.Index = get_hw_reg(s, inst->DstReg.File, inst->DstReg.Index); - inst->SrcReg[0].Index = get_hw_reg(s, inst->SrcReg[0].File, inst->SrcReg[0].Index); - - if (s->Compiler->Base.Debug) { - /* Should print the TEX instruction here */ - } - - struct radeon_pair_texture_instruction rpti; - - switch(inst->Opcode) { - case RC_OPCODE_TEX: rpti.Opcode = RADEON_OPCODE_TEX; break; - case RC_OPCODE_TXB: rpti.Opcode = RADEON_OPCODE_TXB; break; - case RC_OPCODE_TXP: rpti.Opcode = RADEON_OPCODE_TXP; break; - default: - case RC_OPCODE_KIL: rpti.Opcode = RADEON_OPCODE_KIL; break; - } - - rpti.DestIndex = inst->DstReg.Index; - rpti.WriteMask = inst->DstReg.WriteMask; - rpti.TexSrcUnit = inst->TexSrcUnit; - rpti.TexSrcTarget = inst->TexSrcTarget; - rpti.SrcIndex = inst->SrcReg[0].Index; - rpti.SrcSwizzle = inst->SrcReg[0].Swizzle; - - s->Compiler->Base.Error = s->Compiler->Base.Error || !s->Handler->EmitTex(s->UserData, &rpti); - } - - if (s->Compiler->Base.Debug) - fprintf(stderr, " END_TEX\n"); -} - - -static int alloc_pair_source(struct pair_state *s, struct radeon_pair_instruction *pair, - struct rc_src_register src, unsigned int rgb, unsigned int alpha) +int rc_pair_alloc_source(struct rc_pair_instruction *pair, + unsigned int rgb, unsigned int alpha, + rc_register_file file, unsigned int index) { int candidate = -1; int candidate_quality = -1; int i; - if (!rgb && !alpha) + if ((!rgb && !alpha) || file == RC_FILE_NONE) return 0; - unsigned int constant; - unsigned int index; - - if (src.File == RC_FILE_TEMPORARY || src.File == RC_FILE_INPUT) { - constant = 0; - index = get_hw_reg(s, src.File, src.Index); - } else { - constant = 1; - index = src.Index; - } - for(i = 0; i < 3; ++i) { int q = 0; if (rgb) { if (pair->RGB.Src[i].Used) { - if (pair->RGB.Src[i].Constant != constant || + if (pair->RGB.Src[i].File != file || pair->RGB.Src[i].Index != index) continue; q++; @@ -607,7 +55,7 @@ static int alloc_pair_source(struct pair_state *s, struct radeon_pair_instructio } if (alpha) { if (pair->Alpha.Src[i].Used) { - if (pair->Alpha.Src[i].Constant != constant || + if (pair->Alpha.Src[i].File != file || pair->Alpha.Src[i].Index != index) continue; q++; @@ -622,330 +70,15 @@ static int alloc_pair_source(struct pair_state *s, struct radeon_pair_instructio if (candidate >= 0) { if (rgb) { pair->RGB.Src[candidate].Used = 1; - pair->RGB.Src[candidate].Constant = constant; + pair->RGB.Src[candidate].File = file; pair->RGB.Src[candidate].Index = index; } if (alpha) { pair->Alpha.Src[candidate].Used = 1; - pair->Alpha.Src[candidate].Constant = constant; + pair->Alpha.Src[candidate].File = file; pair->Alpha.Src[candidate].Index = index; } } return candidate; } - -/** - * Fill the given ALU instruction's opcodes and source operands into the given pair, - * if possible. - */ -static int fill_instruction_into_pair( - struct pair_state *s, - struct radeon_pair_instruction *pair, - struct pair_state_instruction *pairinst) -{ - struct rc_sub_instruction *inst = &pairinst->Instruction; - - assert(!pairinst->NeedRGB || pair->RGB.Opcode == RC_OPCODE_NOP); - assert(!pairinst->NeedAlpha || pair->Alpha.Opcode == RC_OPCODE_NOP); - - if (pairinst->NeedRGB) { - if (pairinst->IsTranscendent) - pair->RGB.Opcode = RC_OPCODE_REPL_ALPHA; - else - pair->RGB.Opcode = inst->Opcode; - if (inst->SaturateMode == RC_SATURATE_ZERO_ONE) - pair->RGB.Saturate = 1; - } - if (pairinst->NeedAlpha) { - pair->Alpha.Opcode = inst->Opcode; - if (inst->SaturateMode == RC_SATURATE_ZERO_ONE) - pair->Alpha.Saturate = 1; - } - - const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Opcode); - int nargs = opcode->NumSrcRegs; - int i; - - /* Special case for DDX/DDY (MDH/MDV). */ - if (inst->Opcode == RC_OPCODE_DDX || inst->Opcode == RC_OPCODE_DDY) { - if (pair->RGB.Src[0].Used || pair->Alpha.Src[0].Used) - return 0; - else - nargs++; - } - - for(i = 0; i < nargs; ++i) { - int source; - if (pairinst->NeedRGB && !pairinst->IsTranscendent) { - unsigned int srcrgb = 0; - unsigned int srcalpha = 0; - int j; - for(j = 0; j < 3; ++j) { - unsigned int swz = GET_SWZ(inst->SrcReg[i].Swizzle, j); - if (swz < 3) - srcrgb = 1; - else if (swz < 4) - srcalpha = 1; - } - source = alloc_pair_source(s, pair, inst->SrcReg[i], srcrgb, srcalpha); - if (source < 0) - return 0; - pair->RGB.Arg[i].Source = source; - pair->RGB.Arg[i].Swizzle = inst->SrcReg[i].Swizzle & 0x1ff; - pair->RGB.Arg[i].Abs = inst->SrcReg[i].Abs; - pair->RGB.Arg[i].Negate = !!(inst->SrcReg[i].Negate & (RC_MASK_X | RC_MASK_Y | RC_MASK_Z)); - } - if (pairinst->NeedAlpha) { - unsigned int srcrgb = 0; - unsigned int srcalpha = 0; - unsigned int swz = GET_SWZ(inst->SrcReg[i].Swizzle, pairinst->IsTranscendent ? 0 : 3); - if (swz < 3) - srcrgb = 1; - else if (swz < 4) - srcalpha = 1; - source = alloc_pair_source(s, pair, inst->SrcReg[i], srcrgb, srcalpha); - if (source < 0) - return 0; - pair->Alpha.Arg[i].Source = source; - pair->Alpha.Arg[i].Swizzle = swz; - pair->Alpha.Arg[i].Abs = inst->SrcReg[i].Abs; - pair->Alpha.Arg[i].Negate = !!(inst->SrcReg[i].Negate & RC_MASK_W); - } - } - - return 1; -} - - -/** - * Fill in the destination register information. - * - * This is split from filling in source registers because we want - * to avoid allocating hardware temporaries for destinations until - * we are absolutely certain that we're going to emit a certain - * instruction pairing. - */ -static void fill_dest_into_pair( - struct pair_state *s, - struct radeon_pair_instruction *pair, - struct pair_state_instruction *pairinst) -{ - struct rc_sub_instruction *inst = &pairinst->Instruction; - - if (inst->DstReg.File == RC_FILE_OUTPUT) { - if (inst->DstReg.Index == s->Compiler->OutputColor) { - pair->RGB.OutputWriteMask |= inst->DstReg.WriteMask & RC_MASK_XYZ; - pair->Alpha.OutputWriteMask |= GET_BIT(inst->DstReg.WriteMask, 3); - } else if (inst->DstReg.Index == s->Compiler->OutputDepth) { - pair->Alpha.DepthWriteMask |= GET_BIT(inst->DstReg.WriteMask, 3); - } - } else { - unsigned int hwindex = get_hw_reg(s, inst->DstReg.File, inst->DstReg.Index); - if (pairinst->NeedRGB) { - pair->RGB.DestIndex = hwindex; - pair->RGB.WriteMask |= inst->DstReg.WriteMask & RC_MASK_XYZ; - } - if (pairinst->NeedAlpha) { - pair->Alpha.DestIndex = hwindex; - pair->Alpha.WriteMask |= GET_BIT(inst->DstReg.WriteMask, 3); - } - } -} - - -/** - * Find a good ALU instruction or pair of ALU instruction and emit it. - * - * Prefer emitting full ALU instructions, so that when we reach a point - * where no full ALU instruction can be emitted, we have more candidates - * for RGB/Alpha pairing. - */ -static void emit_alu(struct pair_state *s) -{ - struct radeon_pair_instruction pair; - struct pair_state_instruction *psi; - - if (s->ReadyFullALU || !(s->ReadyRGB && s->ReadyAlpha)) { - if (s->ReadyFullALU) { - psi = s->ReadyFullALU; - s->ReadyFullALU = s->ReadyFullALU->NextReady; - } else if (s->ReadyRGB) { - psi = s->ReadyRGB; - s->ReadyRGB = s->ReadyRGB->NextReady; - } else { - psi = s->ReadyAlpha; - s->ReadyAlpha = s->ReadyAlpha->NextReady; - } - - memset(&pair, 0, sizeof(pair)); - fill_instruction_into_pair(s, &pair, psi); - fill_dest_into_pair(s, &pair, psi); - commit_instruction(s, psi); - } else { - struct pair_state_instruction **prgb; - struct pair_state_instruction **palpha; - - /* Some pairings might fail because they require too - * many source slots; try all possible pairings if necessary */ - for(prgb = &s->ReadyRGB; *prgb; prgb = &(*prgb)->NextReady) { - for(palpha = &s->ReadyAlpha; *palpha; palpha = &(*palpha)->NextReady) { - struct pair_state_instruction * psirgb = *prgb; - struct pair_state_instruction * psialpha = *palpha; - memset(&pair, 0, sizeof(pair)); - fill_instruction_into_pair(s, &pair, psirgb); - if (!fill_instruction_into_pair(s, &pair, psialpha)) - continue; - *prgb = (*prgb)->NextReady; - *palpha = (*palpha)->NextReady; - fill_dest_into_pair(s, &pair, psirgb); - fill_dest_into_pair(s, &pair, psialpha); - commit_instruction(s, psirgb); - commit_instruction(s, psialpha); - goto success; - } - } - - /* No success in pairing; just take the first RGB instruction */ - psi = s->ReadyRGB; - s->ReadyRGB = s->ReadyRGB->NextReady; - - memset(&pair, 0, sizeof(pair)); - fill_instruction_into_pair(s, &pair, psi); - fill_dest_into_pair(s, &pair, psi); - commit_instruction(s, psi); - success: ; - } - - if (s->Compiler->Base.Debug) - radeonPrintPairInstruction(&pair); - - s->Compiler->Base.Error = s->Compiler->Base.Error || !s->Handler->EmitPaired(s->UserData, &pair); -} - -/* Callback function for assigning input registers to hardware registers */ -static void alloc_helper(void * data, unsigned input, unsigned hwreg) -{ - struct pair_state * s = data; - alloc_hw_reg(s, RC_FILE_INPUT, input, hwreg); -} - -void radeonPairProgram( - struct r300_fragment_program_compiler * compiler, - const struct radeon_pair_handler* handler, void *userdata) -{ - struct pair_state s; - - memset(&s, 0, sizeof(s)); - s.Compiler = compiler; - s.Handler = handler; - s.UserData = userdata; - s.Verbose = 0 && s.Compiler->Base.Debug; - - if (s.Compiler->Base.Debug) - fprintf(stderr, "Emit paired program\n"); - - scan_instructions(&s); - s.Compiler->AllocateHwInputs(s.Compiler, &alloc_helper, &s); - - while(!s.Compiler->Base.Error && - (s.ReadyTEX || s.ReadyRGB || s.ReadyAlpha || s.ReadyFullALU)) { - if (s.ReadyTEX) - emit_all_tex(&s); - - while(s.ReadyFullALU || s.ReadyRGB || s.ReadyAlpha) - emit_alu(&s); - } - - if (s.Compiler->Base.Debug) - fprintf(stderr, " END\n"); -} - - -static void print_pair_src(int i, struct radeon_pair_instruction_source* src) -{ - fprintf(stderr, " Src%i = %s[%i]", i, src->Constant ? "CNST" : "TEMP", src->Index); -} - -static const char* opcode_string(rc_opcode opcode) -{ - return rc_get_opcode_info(opcode)->Name; -} - -static int num_pairinst_args(rc_opcode opcode) -{ - return rc_get_opcode_info(opcode)->NumSrcRegs; -} - -static char swizzle_char(rc_swizzle swz) -{ - switch(swz) { - case RC_SWIZZLE_X: return 'x'; - case RC_SWIZZLE_Y: return 'y'; - case RC_SWIZZLE_Z: return 'z'; - case RC_SWIZZLE_W: return 'w'; - case RC_SWIZZLE_ZERO: return '0'; - case RC_SWIZZLE_ONE: return '1'; - case RC_SWIZZLE_HALF: return 'H'; - case RC_SWIZZLE_UNUSED: return '_'; - default: return '?'; - } -} - -void radeonPrintPairInstruction(struct radeon_pair_instruction *inst) -{ - int nargs; - int i; - - fprintf(stderr, " RGB: "); - for(i = 0; i < 3; ++i) { - if (inst->RGB.Src[i].Used) - print_pair_src(i, inst->RGB.Src + i); - } - fprintf(stderr, "\n"); - fprintf(stderr, " Alpha:"); - for(i = 0; i < 3; ++i) { - if (inst->Alpha.Src[i].Used) - print_pair_src(i, inst->Alpha.Src + i); - } - fprintf(stderr, "\n"); - - fprintf(stderr, " %s%s", opcode_string(inst->RGB.Opcode), inst->RGB.Saturate ? "_SAT" : ""); - if (inst->RGB.WriteMask) - fprintf(stderr, " TEMP[%i].%s%s%s", inst->RGB.DestIndex, - (inst->RGB.WriteMask & 1) ? "x" : "", - (inst->RGB.WriteMask & 2) ? "y" : "", - (inst->RGB.WriteMask & 4) ? "z" : ""); - if (inst->RGB.OutputWriteMask) - fprintf(stderr, " COLOR.%s%s%s", - (inst->RGB.OutputWriteMask & 1) ? "x" : "", - (inst->RGB.OutputWriteMask & 2) ? "y" : "", - (inst->RGB.OutputWriteMask & 4) ? "z" : ""); - nargs = num_pairinst_args(inst->RGB.Opcode); - for(i = 0; i < nargs; ++i) { - const char* abs = inst->RGB.Arg[i].Abs ? "|" : ""; - const char* neg = inst->RGB.Arg[i].Negate ? "-" : ""; - fprintf(stderr, ", %s%sSrc%i.%c%c%c%s", neg, abs, inst->RGB.Arg[i].Source, - swizzle_char(GET_SWZ(inst->RGB.Arg[i].Swizzle, 0)), - swizzle_char(GET_SWZ(inst->RGB.Arg[i].Swizzle, 1)), - swizzle_char(GET_SWZ(inst->RGB.Arg[i].Swizzle, 2)), - abs); - } - fprintf(stderr, "\n"); - - fprintf(stderr, " %s%s", opcode_string(inst->Alpha.Opcode), inst->Alpha.Saturate ? "_SAT" : ""); - if (inst->Alpha.WriteMask) - fprintf(stderr, " TEMP[%i].w", inst->Alpha.DestIndex); - if (inst->Alpha.OutputWriteMask) - fprintf(stderr, " COLOR.w"); - if (inst->Alpha.DepthWriteMask) - fprintf(stderr, " DEPTH.w"); - nargs = num_pairinst_args(inst->Alpha.Opcode); - for(i = 0; i < nargs; ++i) { - const char* abs = inst->Alpha.Arg[i].Abs ? "|" : ""; - const char* neg = inst->Alpha.Arg[i].Negate ? "-" : ""; - fprintf(stderr, ", %s%sSrc%i.%c%s", neg, abs, inst->Alpha.Arg[i].Source, - swizzle_char(inst->Alpha.Arg[i].Swizzle), abs); - } - fprintf(stderr, "\n"); -} diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h index 440069d558..1600598428 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.h @@ -28,22 +28,37 @@ #ifndef __RADEON_PROGRAM_PAIR_H_ #define __RADEON_PROGRAM_PAIR_H_ +#include "radeon_code.h" +#include "radeon_opcodes.h" +#include "radeon_program_constants.h" + struct r300_fragment_program_compiler; /** - * Represents a paired instruction, as found in R300 and R500 + * \file + * Represents a paired ALU instruction, as found in R300 and R500 * fragment programs. + * + * Note that this representation is taking some liberties as far + * as register files are concerned, to allow separate register + * allocation. + * + * Also note that there are some subtleties in that the semantics + * of certain opcodes are implicitly changed in this representation; + * see \ref rc_pair_translate */ + + struct radeon_pair_instruction_source { - unsigned int Index:8; - unsigned int Constant:1; unsigned int Used:1; + rc_register_file File:3; + unsigned int Index:RC_REGISTER_INDEX_BITS; }; struct radeon_pair_instruction_rgb { - unsigned int Opcode:8; - unsigned int DestIndex:8; + rc_opcode Opcode:8; + unsigned int DestIndex:RC_REGISTER_INDEX_BITS; unsigned int WriteMask:3; unsigned int OutputWriteMask:3; unsigned int Saturate:1; @@ -59,8 +74,8 @@ struct radeon_pair_instruction_rgb { }; struct radeon_pair_instruction_alpha { - unsigned int Opcode:8; - unsigned int DestIndex:8; + rc_opcode Opcode:8; + unsigned int DestIndex:RC_REGISTER_INDEX_BITS; unsigned int WriteMask:1; unsigned int OutputWriteMask:1; unsigned int DepthWriteMask:1; @@ -76,66 +91,34 @@ struct radeon_pair_instruction_alpha { } Arg[3]; }; -struct radeon_pair_instruction { +struct rc_pair_instruction { struct radeon_pair_instruction_rgb RGB; struct radeon_pair_instruction_alpha Alpha; -}; - -enum { - RADEON_OPCODE_TEX = 0, - RADEON_OPCODE_TXB, - RADEON_OPCODE_TXP, - RADEON_OPCODE_KIL + rc_write_aluresult WriteALUResult:2; + rc_compare_func ALUResultCompare:3; }; -struct radeon_pair_texture_instruction { - unsigned int Opcode:2; /**< one of RADEON_OPCODE_xxx */ - - unsigned int DestIndex:8; - unsigned int WriteMask:4; - unsigned int TexSrcUnit:5; - unsigned int TexSrcTarget:3; - - unsigned int SrcIndex:8; - unsigned int SrcSwizzle:12; -}; +/** + * General helper functions for dealing with the paired instruction format. + */ +/*@{*/ +int rc_pair_alloc_source(struct rc_pair_instruction *pair, + unsigned int rgb, unsigned int alpha, + rc_register_file file, unsigned int index); +/*@}*/ /** - * + * Compiler passes that operate with the paired format. */ -struct radeon_pair_handler { - /** - * Write a paired instruction to the hardware. - * - * @return 0 on error. - */ - int (*EmitPaired)(void*, struct radeon_pair_instruction*); - - /** - * Write a texture instruction to the hardware. - * Register indices have already been rewritten to the allocated - * hardware register numbers. - * - * @return 0 on error. - */ - int (*EmitTex)(void*, struct radeon_pair_texture_instruction*); - - /** - * Called before a block of contiguous, independent texture - * instructions is emitted. - */ - int (*BeginTexBlock)(void*); - - unsigned MaxHwTemps; -}; - -void radeonPairProgram( - struct r300_fragment_program_compiler * compiler, - const struct radeon_pair_handler*, void *userdata); +/*@{*/ +struct radeon_pair_handler; -void radeonPrintPairInstruction(struct radeon_pair_instruction *inst); +void rc_pair_translate(struct r300_fragment_program_compiler *c); +void rc_pair_schedule(struct r300_fragment_program_compiler *c); +void rc_pair_regalloc(struct r300_fragment_program_compiler *c, unsigned maxtemps); +/*@}*/ #endif /* __RADEON_PROGRAM_PAIR_H_ */ diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c index fe90a5900e..d863b82d53 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_print.c @@ -99,6 +99,21 @@ static void rc_print_dst_register(FILE * f, struct rc_dst_register dst) } } +static char rc_swizzle_char(unsigned int swz) +{ + switch(swz) { + case RC_SWIZZLE_X: return 'x'; + case RC_SWIZZLE_Y: return 'y'; + case RC_SWIZZLE_Z: return 'z'; + case RC_SWIZZLE_W: return 'w'; + case RC_SWIZZLE_ZERO: return '0'; + case RC_SWIZZLE_ONE: return '1'; + case RC_SWIZZLE_HALF: return 'H'; + case RC_SWIZZLE_UNUSED: return '_'; + } + return '?'; +} + static void rc_print_swizzle(FILE * f, unsigned int swizzle, unsigned int negate) { unsigned int comp; @@ -106,16 +121,7 @@ static void rc_print_swizzle(FILE * f, unsigned int swizzle, unsigned int negate rc_swizzle swz = GET_SWZ(swizzle, comp); if (GET_BIT(negate, comp)) fprintf(f, "-"); - switch(swz) { - case RC_SWIZZLE_X: fprintf(f, "x"); break; - case RC_SWIZZLE_Y: fprintf(f, "y"); break; - case RC_SWIZZLE_Z: fprintf(f, "z"); break; - case RC_SWIZZLE_W: fprintf(f, "w"); break; - case RC_SWIZZLE_ZERO: fprintf(f, "0"); break; - case RC_SWIZZLE_ONE: fprintf(f, "1"); break; - case RC_SWIZZLE_HALF: fprintf(f, "H"); break; - case RC_SWIZZLE_UNUSED: fprintf(f, "_"); break; - } + fprintf(f, "%c", rc_swizzle_char(swz)); } } @@ -142,7 +148,7 @@ static void rc_print_src_register(FILE * f, struct rc_src_register src) fprintf(f, "|"); } -static void rc_print_instruction(FILE * f, struct rc_instruction * inst) +static void rc_print_normal_instruction(FILE * f, struct rc_instruction * inst) { const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); unsigned int reg; @@ -190,6 +196,87 @@ static void rc_print_instruction(FILE * f, struct rc_instruction * inst) fprintf(f, "\n"); } +static void rc_print_pair_instruction(FILE * f, struct rc_instruction * fullinst) +{ + struct rc_pair_instruction * inst = &fullinst->U.P; + int printedsrc = 0; + + for(unsigned int src = 0; src < 3; ++src) { + if (inst->RGB.Src[src].Used) { + if (printedsrc) + fprintf(f, ", "); + fprintf(f, "src%i.xyz = ", src); + rc_print_register(f, inst->RGB.Src[src].File, inst->RGB.Src[src].Index, 0); + printedsrc = 1; + } + if (inst->Alpha.Src[src].Used) { + if (printedsrc) + fprintf(f, ", "); + fprintf(f, "src%i.w = ", src); + rc_print_register(f, inst->Alpha.Src[src].File, inst->Alpha.Src[src].Index, 0); + printedsrc = 1; + } + } + fprintf(f, "\n"); + + if (inst->RGB.Opcode != RC_OPCODE_NOP) { + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->RGB.Opcode); + + fprintf(f, " %s%s", opcode->Name, inst->RGB.Saturate ? "_SAT" : ""); + if (inst->RGB.WriteMask) + fprintf(f, " temp[%i].%s%s%s", inst->RGB.DestIndex, + (inst->RGB.WriteMask & 1) ? "x" : "", + (inst->RGB.WriteMask & 2) ? "y" : "", + (inst->RGB.WriteMask & 4) ? "z" : ""); + if (inst->RGB.OutputWriteMask) + fprintf(f, " color.%s%s%s", + (inst->RGB.OutputWriteMask & 1) ? "x" : "", + (inst->RGB.OutputWriteMask & 2) ? "y" : "", + (inst->RGB.OutputWriteMask & 4) ? "z" : ""); + if (inst->WriteALUResult == RC_ALURESULT_X) + fprintf(f, " aluresult"); + + for(unsigned int arg = 0; arg < opcode->NumSrcRegs; ++arg) { + const char* abs = inst->RGB.Arg[arg].Abs ? "|" : ""; + const char* neg = inst->RGB.Arg[arg].Negate ? "-" : ""; + fprintf(f, ", %s%ssrc%i.%c%c%c%s", neg, abs, inst->RGB.Arg[arg].Source, + rc_swizzle_char(GET_SWZ(inst->RGB.Arg[arg].Swizzle, 0)), + rc_swizzle_char(GET_SWZ(inst->RGB.Arg[arg].Swizzle, 1)), + rc_swizzle_char(GET_SWZ(inst->RGB.Arg[arg].Swizzle, 2)), + abs); + } + fprintf(f, "\n"); + } + + if (inst->Alpha.Opcode != RC_OPCODE_NOP) { + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Alpha.Opcode); + + fprintf(f, " %s%s", opcode->Name, inst->Alpha.Saturate ? "_SAT" : ""); + if (inst->Alpha.WriteMask) + fprintf(f, " temp[%i].w", inst->Alpha.DestIndex); + if (inst->Alpha.OutputWriteMask) + fprintf(f, " color.w"); + if (inst->Alpha.DepthWriteMask) + fprintf(f, " depth.w"); + if (inst->WriteALUResult == RC_ALURESULT_W) + fprintf(f, " aluresult"); + + for(unsigned int arg = 0; arg < opcode->NumSrcRegs; ++arg) { + const char* abs = inst->Alpha.Arg[arg].Abs ? "|" : ""; + const char* neg = inst->Alpha.Arg[arg].Negate ? "-" : ""; + fprintf(f, ", %s%ssrc%i.%c%s", neg, abs, inst->Alpha.Arg[arg].Source, + rc_swizzle_char(inst->Alpha.Arg[arg].Swizzle), abs); + } + fprintf(f, "\n"); + } + + if (inst->WriteALUResult) { + fprintf(f, " [aluresult = ("); + rc_print_comparefunc(f, "result", inst->ALUResultCompare, "0"); + fprintf(f, ")]\n"); + } +} + /** * Print program to stderr, default options. */ @@ -203,7 +290,10 @@ void rc_print_program(const struct rc_program *prog) for(inst = prog->Instructions.Next; inst != &prog->Instructions; inst = inst->Next) { fprintf(stderr, "%3d: ", linenum); - rc_print_instruction(stderr, inst); + if (inst->Type == RC_INSTRUCTION_PAIR) + rc_print_pair_instruction(stderr, inst); + else + rc_print_normal_instruction(stderr, inst); linenum++; } -- cgit v1.2.3 From 2a929a08ab4fa4501dca88cc988cbf469b7deeb5 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 30 Sep 2009 19:44:38 -0700 Subject: r300g: xRGB and RGBx formats. We now have 48 GLX visuals. Pretty soon, we'll have 90+ visuals, only five of which ever get tested. :3 --- src/gallium/drivers/r300/r300_screen.c | 2 ++ src/gallium/drivers/r300/r300_state_inlines.h | 9 +++++++++ src/gallium/drivers/r300/r300_texture.h | 4 ++++ 3 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index f2659ca61f..81d01b1320 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -205,7 +205,9 @@ static boolean check_tex_2d_format(enum pipe_format format, uint32_t usage, /* Colorbuffer or texture */ case PIPE_FORMAT_A8R8G8B8_UNORM: + case PIPE_FORMAT_X8R8G8B8_UNORM: case PIPE_FORMAT_R8G8B8A8_UNORM: + case PIPE_FORMAT_R8G8B8X8_UNORM: case PIPE_FORMAT_I8_UNORM: return usage & (PIPE_TEXTURE_USAGE_RENDER_TARGET | diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index 91b93fc367..88eb66b79e 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -292,6 +292,9 @@ 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_X8R8G8B8_UNORM: + case PIPE_FORMAT_R8G8B8A8_UNORM: + case PIPE_FORMAT_R8G8B8X8_UNORM: case PIPE_FORMAT_Z24S8_UNORM: return R300_COLOR_FORMAT_ARGB8888; /* XXX Not in pipe_format @@ -338,10 +341,16 @@ static INLINE uint32_t r300_translate_out_fmt(enum pipe_format format) { switch (format) { case PIPE_FORMAT_A8R8G8B8_UNORM: + case PIPE_FORMAT_X8R8G8B8_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; + case PIPE_FORMAT_R8G8B8A8_UNORM: + case PIPE_FORMAT_R8G8B8X8_UNORM: + return R300_US_OUT_FMT_C4_8 | + R300_C0_SEL_A | R300_C1_SEL_B | + R300_C2_SEL_G | R300_C3_SEL_R; default: debug_printf("r300: Implementation error: " "Got unsupported output format %s in %s\n", diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h index 78ee0f1611..bd87790bc3 100644 --- a/src/gallium/drivers/r300/r300_texture.h +++ b/src/gallium/drivers/r300/r300_texture.h @@ -48,6 +48,10 @@ static INLINE uint32_t r300_translate_texformat(enum pipe_format format) return R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8); case PIPE_FORMAT_R8G8B8A8_UNORM: return R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8); + case PIPE_FORMAT_X8R8G8B8_UNORM: + return R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8); + case PIPE_FORMAT_R8G8B8X8_UNORM: + return R300_EASY_TX_FORMAT(Y, Z, ONE, X, W8Z8Y8X8); case PIPE_FORMAT_A8R8G8B8_SRGB: return R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8) | R300_TX_FORMAT_GAMMA; -- cgit v1.2.3 From 12e89e0e511d996db8e6eb11253dad4cdfab2083 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sun, 4 Oct 2009 17:53:08 +0200 Subject: r300/compiler: Emit flow control instructions and ALU result writes on R500 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle --- .../drivers/dri/r300/compiler/r500_fragprog_emit.c | 180 ++++++++++++++++++++- src/mesa/drivers/dri/r300/compiler/radeon_code.h | 2 + .../dri/r300/compiler/radeon_dataflow_deadcode.c | 2 +- .../drivers/dri/r300/compiler/radeon_opcodes.c | 6 +- .../drivers/dri/r300/compiler/radeon_opcodes.h | 2 +- .../dri/r300/compiler/radeon_pair_schedule.c | 2 +- .../dri/r300/compiler/radeon_pair_translate.c | 2 +- src/mesa/drivers/dri/r300/r300_reg.h | 2 + 8 files changed, 183 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c index 8f618d88ad..b1b14394b6 100644 --- a/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c +++ b/src/mesa/drivers/dri/r300/compiler/r500_fragprog_emit.c @@ -55,6 +55,23 @@ } while(0) +struct branch_info { + int If; + int Else; + int Endif; +}; + +struct emit_state { + struct radeon_compiler * C; + struct r500_fragment_program_code * Code; + + struct branch_info * Branches; + unsigned int CurrentBranchDepth; + unsigned int BranchesReserved; + + unsigned int MaxBranchDepth; +}; + static unsigned int translate_rgb_op(struct r300_fragment_program_compiler *c, rc_opcode opcode) { switch(opcode) { @@ -131,6 +148,19 @@ static unsigned int translate_arg_alpha(struct rc_pair_instruction *inst, int i) return t; } +static uint32_t translate_alu_result_op(struct r300_fragment_program_compiler * c, rc_compare_func func) +{ + switch(func) { + case RC_COMPARE_FUNC_EQUAL: return R500_INST_ALU_RESULT_OP_EQ; + case RC_COMPARE_FUNC_LESS: return R500_INST_ALU_RESULT_OP_LT; + case RC_COMPARE_FUNC_GEQUAL: return R500_INST_ALU_RESULT_OP_GE; + case RC_COMPARE_FUNC_NOTEQUAL: return R500_INST_ALU_RESULT_OP_NE; + default: + rc_error(&c->Base, "%s: unsupported compare func %i\n", __FUNCTION__, func); + return 0; + } +} + static void use_temporary(struct r500_fragment_program_code* code, unsigned int index) { if (index > code->max_temp_idx) @@ -153,13 +183,13 @@ static unsigned int use_source(struct r500_fragment_program_code* code, struct r /** * Emit a paired ALU instruction. */ -static int emit_paired(struct r300_fragment_program_compiler *c, struct rc_pair_instruction *inst) +static void emit_paired(struct r300_fragment_program_compiler *c, struct rc_pair_instruction *inst) { PROG_CODE; if (code->inst_end >= 511) { error("emit_alu: Too many instructions"); - return 0; + return; } int ip = ++code->inst_end; @@ -167,10 +197,15 @@ static int emit_paired(struct r300_fragment_program_compiler *c, struct rc_pair_ code->inst[ip].inst5 = translate_rgb_op(c, inst->RGB.Opcode); code->inst[ip].inst4 = translate_alpha_op(c, inst->Alpha.Opcode); - if (inst->RGB.OutputWriteMask || inst->Alpha.OutputWriteMask || inst->Alpha.DepthWriteMask) + if (inst->RGB.OutputWriteMask || inst->Alpha.OutputWriteMask || inst->Alpha.DepthWriteMask) { code->inst[ip].inst0 = R500_INST_TYPE_OUT; - else + if (inst->WriteALUResult) { + error("%s: cannot write output and ALU result at the same time"); + return; + } + } else { code->inst[ip].inst0 = R500_INST_TYPE_ALU; + } code->inst[ip].inst0 |= R500_INST_TEX_SEM_WAIT; code->inst[ip].inst0 |= (inst->RGB.WriteMask << 11) | (inst->Alpha.WriteMask << 14); @@ -206,7 +241,16 @@ static int emit_paired(struct r300_fragment_program_compiler *c, struct rc_pair_ code->inst[ip].inst4 |= translate_arg_alpha(inst, 1) << R500_ALPHA_SEL_B_SHIFT; code->inst[ip].inst5 |= translate_arg_alpha(inst, 2) << R500_ALU_RGBA_ALPHA_SEL_C_SHIFT; - return 1; + if (inst->WriteALUResult) { + code->inst[ip].inst3 |= R500_ALU_RGB_WMASK; + + if (inst->WriteALUResult == RC_ALURESULT_X) + code->inst[ip].inst0 |= R500_INST_ALU_RESULT_SEL_RED; + else + code->inst[ip].inst0 |= R500_INST_ALU_RESULT_SEL_ALPHA; + + code->inst[ip].inst0 |= translate_alu_result_op(c, inst->ALUResultCompare); + } } static unsigned int translate_strq_swizzle(unsigned int swizzle) @@ -271,10 +315,118 @@ static int emit_tex(struct r300_fragment_program_compiler *c, struct rc_sub_inst return 1; } +static void grow_branches(struct emit_state * s) +{ + unsigned int newreserved = s->BranchesReserved * 2; + struct branch_info * newbranches; + + if (!newreserved) + newreserved = 4; + + newbranches = memory_pool_malloc(&s->C->Pool, newreserved*sizeof(struct branch_info)); + memcpy(newbranches, s->Branches, s->CurrentBranchDepth*sizeof(struct branch_info)); + + s->Branches = newbranches; + s->BranchesReserved = newreserved; +} + +static void emit_flowcontrol(struct emit_state * s, struct rc_instruction * inst) +{ + if (s->Code->inst_end >= 511) { + rc_error(s->C, "emit_tex: Too many instructions"); + return; + } + + unsigned int newip = ++s->Code->inst_end; + + s->Code->inst[newip].inst0 = R500_INST_TYPE_FC | R500_INST_ALU_WAIT; + + if (inst->U.I.Opcode == RC_OPCODE_IF) { + if (s->CurrentBranchDepth >= 32) { + rc_error(s->C, "Branch depth exceeds hardware limit"); + return; + } + + if (s->CurrentBranchDepth >= s->BranchesReserved) + grow_branches(s); + + struct branch_info * branch = &s->Branches[s->CurrentBranchDepth++]; + branch->If = newip; + branch->Else = -1; + branch->Endif = -1; + + if (s->CurrentBranchDepth > s->MaxBranchDepth) + s->MaxBranchDepth = s->CurrentBranchDepth; + + /* actual instruction is filled in at ENDIF time */ + } else if (inst->U.I.Opcode == RC_OPCODE_ELSE) { + if (!s->CurrentBranchDepth) { + rc_error(s->C, "%s: got ELSE outside a branch", __FUNCTION__); + return; + } + + struct branch_info * branch = &s->Branches[s->CurrentBranchDepth - 1]; + branch->Else = newip; + + /* actual instruction is filled in at ENDIF time */ + } else if (inst->U.I.Opcode == RC_OPCODE_ENDIF) { + if (!s->CurrentBranchDepth) { + rc_error(s->C, "%s: got ELSE outside a branch", __FUNCTION__); + return; + } + + struct branch_info * branch = &s->Branches[s->CurrentBranchDepth - 1]; + branch->Endif = newip; + + s->Code->inst[branch->If].inst2 = R500_FC_OP_JUMP + | R500_FC_A_OP_NONE /* no address stack */ + | R500_FC_JUMP_FUNC(0x0f) /* jump if ALU result is false */ + | R500_FC_B_OP0_INCR /* increment branch counter if stay */ + ; + + if (branch->Else >= 0) { + /* increment branch counter also if jump */ + s->Code->inst[branch->If].inst2 |= R500_FC_B_OP1_INCR; + s->Code->inst[branch->If].inst3 = R500_FC_JUMP_ADDR(branch->Else + 1); + + s->Code->inst[branch->Else].inst2 = R500_FC_OP_JUMP + | R500_FC_A_OP_NONE /* no address stack */ + | R500_FC_B_ELSE /* all active pixels want to jump */ + | R500_FC_B_OP0_NONE /* no counter op if stay */ + | R500_FC_B_OP1_DECR /* decrement branch counter if jump */ + | R500_FC_B_POP_CNT(1) + ; + s->Code->inst[branch->Else].inst3 = R500_FC_JUMP_ADDR(branch->Endif + 1); + } else { + /* don't touch branch counter on jump */ + s->Code->inst[branch->If].inst2 |= R500_FC_B_OP1_NONE; + s->Code->inst[branch->If].inst3 = R500_FC_JUMP_ADDR(branch->Endif + 1); + } + + s->Code->inst[branch->Endif].inst2 = R500_FC_OP_JUMP + | R500_FC_A_OP_NONE /* no address stack */ + | R500_FC_JUMP_ANY /* docs says set this, but I don't understand why */ + | R500_FC_B_OP0_DECR /* decrement branch counter if stay */ + | R500_FC_B_OP1_NONE /* no branch counter if stay */ + | R500_FC_B_POP_CNT(1) + ; + s->Code->inst[branch->Endif].inst3 = R500_FC_JUMP_ADDR(branch->Endif + 1); + + s->CurrentBranchDepth--; + } else { + rc_error(s->C, "%s: unknown opcode %i\n", __FUNCTION__, inst->U.I.Opcode); + } +} + void r500BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compiler) { + struct emit_state s; struct r500_fragment_program_code *code = &compiler->code->code.r500; + memset(&s, 0, sizeof(s)); + s.C = &compiler->Base; + s.Code = code; + memset(code, 0, sizeof(*code)); code->max_temp_idx = 1; code->inst_end = -1; @@ -283,10 +435,15 @@ void r500BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compi inst != &compiler->Base.Program.Instructions && !compiler->Base.Error; inst = inst->Next) { if (inst->Type == RC_INSTRUCTION_NORMAL) { - if (inst->U.I.Opcode == RC_OPCODE_BEGIN_TEX) - continue; + const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); - emit_tex(compiler, &inst->U.I); + if (opcode->IsFlowControl) { + emit_flowcontrol(&s, inst); + } else if (inst->U.I.Opcode == RC_OPCODE_BEGIN_TEX) { + continue; + } else { + emit_tex(compiler, &inst->U.I); + } } else { emit_paired(compiler, &inst->U.P); } @@ -309,4 +466,11 @@ void r500BuildFragmentProgramHwCode(struct r300_fragment_program_compiler *compi int ip = ++code->inst_end; code->inst[ip].inst0 = R500_INST_TYPE_OUT | R500_INST_TEX_SEM_WAIT; } + + if (s.MaxBranchDepth >= 4) { + if (code->max_temp_idx < 1) + code->max_temp_idx = 1; + + code->us_fc_ctrl |= R500_FC_FULL_FC_EN; + } } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_code.h b/src/mesa/drivers/dri/r300/compiler/radeon_code.h index 75069e841e..902b7cfa53 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_code.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_code.h @@ -182,6 +182,8 @@ struct r500_fragment_program_code { int inst_end; /* Number of instructions - 1; also, last instruction to be executed */ int max_temp_idx; + + uint32_t us_fc_ctrl; }; struct rX00_fragment_program_code { diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c index f30b1ff067..e0c66c4aeb 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow_deadcode.c @@ -213,7 +213,7 @@ void rc_dataflow_deadcode(struct radeon_compiler * c, rc_dataflow_mark_outputs_f inst = inst->Prev) { const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); - if (opcode->IsControlFlow) { + if (opcode->IsFlowControl) { if (opcode->Opcode == RC_OPCODE_ENDIF) { push_branch(&s); } else { diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c index a5072b5e1e..c1c0181fac 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.c @@ -344,19 +344,19 @@ struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE] = { { .Opcode = RC_OPCODE_IF, .Name = "IF", - .IsControlFlow = 1, + .IsFlowControl = 1, .NumSrcRegs = 1 }, { .Opcode = RC_OPCODE_ELSE, .Name = "ELSE", - .IsControlFlow = 1, + .IsFlowControl = 1, .NumSrcRegs = 0 }, { .Opcode = RC_OPCODE_ENDIF, .Name = "ENDIF", - .IsControlFlow = 1, + .IsFlowControl = 1, .NumSrcRegs = 0 }, { diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h index c9c5b9f80f..a3c5b86954 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_opcodes.h @@ -206,7 +206,7 @@ struct rc_opcode_info { unsigned int HasDstReg:1; /** true if this instruction affects control flow */ - unsigned int IsControlFlow:1; + unsigned int IsFlowControl:1; /** true if this is a vector instruction that operates on components in parallel * without any cross-component interaction */ diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c index 8a4b5ac8a9..ea01bb7881 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c @@ -454,7 +454,7 @@ static int is_controlflow(struct rc_instruction * inst) { if (inst->Type == RC_INSTRUCTION_NORMAL) { const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); - return opcode->IsControlFlow; + return opcode->IsFlowControl; } return 0; } diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c index c31891a62f..7211768272 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_translate.c @@ -241,7 +241,7 @@ void rc_pair_translate(struct r300_fragment_program_compiler *c) const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->U.I.Opcode); - if (opcode->HasTexture || opcode->IsControlFlow || opcode->Opcode == RC_OPCODE_KIL) + if (opcode->HasTexture || opcode->IsFlowControl || opcode->Opcode == RC_OPCODE_KIL) continue; struct rc_sub_instruction copy = inst->U.I; diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index b9ccd098dc..623da60333 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -3002,6 +3002,8 @@ enum { # define R500_INST_RGB_CLAMP (1 << 19) # define R500_INST_ALPHA_CLAMP (1 << 20) # define R500_INST_ALU_RESULT_SEL (1 << 21) +# define R500_INST_ALU_RESULT_SEL_RED (0 << 21) +# define R500_INST_ALU_RESULT_SEL_ALPHA (1 << 21) # define R500_INST_ALPHA_PRED_INV (1 << 22) # define R500_INST_ALU_RESULT_OP_EQ (0 << 23) # define R500_INST_ALU_RESULT_OP_LT (1 << 23) -- cgit v1.2.3 From a6b300ac98427eece73c312e6fc73f4127c6ab65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sun, 4 Oct 2009 18:26:15 +0200 Subject: r300/compiler Add support for more of the Sxx set instructions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle --- .../drivers/dri/r300/compiler/radeon_program_alu.c | 62 +++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c index 425b929668..0326d25233 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c @@ -344,6 +344,25 @@ static void transform_RSQ(struct radeon_compiler* c, inst->U.I.SrcReg[0] = absolute(inst->U.I.SrcReg[0]); } +static void transform_SEQ(struct radeon_compiler* c, + struct rc_instruction* inst) +{ + int tempreg = rc_find_free_temporary(c); + + emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1])); + emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg, + negate(absolute(srcreg(RC_FILE_TEMPORARY, tempreg))), builtin_zero, builtin_one); + + rc_remove_instruction(inst); +} + +static void transform_SFL(struct radeon_compiler* c, + struct rc_instruction* inst) +{ + emit1(c, inst->Prev, RC_OPCODE_MOV, inst->U.I.SaturateMode, inst->U.I.DstReg, builtin_zero); + rc_remove_instruction(inst); +} + static void transform_SGE(struct radeon_compiler* c, struct rc_instruction* inst) { @@ -356,6 +375,30 @@ static void transform_SGE(struct radeon_compiler* c, rc_remove_instruction(inst); } +static void transform_SGT(struct radeon_compiler* c, + struct rc_instruction* inst) +{ + int tempreg = rc_find_free_temporary(c); + + emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[1]); + emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg, + srcreg(RC_FILE_TEMPORARY, tempreg), builtin_one, builtin_zero); + + rc_remove_instruction(inst); +} + +static void transform_SLE(struct radeon_compiler* c, + struct rc_instruction* inst) +{ + int tempreg = rc_find_free_temporary(c); + + emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), negate(inst->U.I.SrcReg[0]), inst->U.I.SrcReg[1]); + emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg, + srcreg(RC_FILE_TEMPORARY, tempreg), builtin_zero, builtin_one); + + rc_remove_instruction(inst); +} + static void transform_SLT(struct radeon_compiler* c, struct rc_instruction* inst) { @@ -368,6 +411,18 @@ static void transform_SLT(struct radeon_compiler* c, rc_remove_instruction(inst); } +static void transform_SNE(struct radeon_compiler* c, + struct rc_instruction* inst) +{ + int tempreg = rc_find_free_temporary(c); + + emit2(c, inst->Prev, RC_OPCODE_ADD, 0, dstreg(RC_FILE_TEMPORARY, tempreg), inst->U.I.SrcReg[0], negate(inst->U.I.SrcReg[1])); + emit3(c, inst->Prev, RC_OPCODE_CMP, inst->U.I.SaturateMode, inst->U.I.DstReg, + negate(absolute(srcreg(RC_FILE_TEMPORARY, tempreg))), builtin_one, builtin_zero); + + rc_remove_instruction(inst); +} + static void transform_SUB(struct radeon_compiler* c, struct rc_instruction* inst) { @@ -403,7 +458,7 @@ static void transform_XPD(struct radeon_compiler* c, * no userData necessary. * * Eliminates the following ALU instructions: - * ABS, DPH, DST, FLR, LIT, LRP, POW, SGE, SLT, SUB, SWZ, XPD + * ABS, DPH, DST, FLR, LIT, LRP, POW, SEQ, SFL, SGE, SGT, SLE, SLT, SNE, SUB, SWZ, XPD * using: * MOV, ADD, MUL, MAD, FRC, DP3, LG2, EX2, CMP * @@ -426,8 +481,13 @@ int radeonTransformALU( case RC_OPCODE_LRP: transform_LRP(c, inst); return 1; case RC_OPCODE_POW: transform_POW(c, inst); return 1; case RC_OPCODE_RSQ: transform_RSQ(c, inst); return 1; + case RC_OPCODE_SEQ: transform_SEQ(c, inst); return 1; + case RC_OPCODE_SFL: transform_SFL(c, inst); return 1; case RC_OPCODE_SGE: transform_SGE(c, inst); return 1; + case RC_OPCODE_SGT: transform_SGT(c, inst); return 1; + case RC_OPCODE_SLE: transform_SLE(c, inst); return 1; case RC_OPCODE_SLT: transform_SLT(c, inst); return 1; + case RC_OPCODE_SNE: transform_SNE(c, inst); return 1; case RC_OPCODE_SUB: transform_SUB(c, inst); return 1; case RC_OPCODE_SWZ: transform_SWZ(c, inst); return 1; case RC_OPCODE_XPD: transform_XPD(c, inst); return 1; -- cgit v1.2.3 From cd0a39681377644b7d4574c9a33acbc9c844bb59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sat, 3 Oct 2009 22:15:17 +0100 Subject: llvmpipe: Adjust format assertion. We support array layout too -- if it has a single channel. --- src/gallium/drivers/llvmpipe/lp_bld_format_soa.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_format_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_format_soa.c index b5ff434e1a..66bebdcdec 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_format_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_format_soa.c @@ -119,7 +119,9 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder, unsigned chan; /* FIXME: Support more formats */ - assert(format_desc->layout == UTIL_FORMAT_LAYOUT_ARITH); + assert(format_desc->layout == UTIL_FORMAT_LAYOUT_ARITH || + (format_desc->layout == UTIL_FORMAT_LAYOUT_ARRAY && + format_desc->block.bits == format_desc->channel[0].size)); assert(format_desc->block.width == 1); assert(format_desc->block.height == 1); assert(format_desc->block.bits <= 32); @@ -195,10 +197,9 @@ lp_build_load_rgba_soa(LLVMBuilderRef builder, { LLVMValueRef packed; - assert(format_desc->layout == UTIL_FORMAT_LAYOUT_ARITH); assert(format_desc->block.width == 1); assert(format_desc->block.height == 1); - assert(format_desc->block.bits <= 32); + assert(format_desc->block.bits <= type.width); packed = lp_build_gather(builder, type.length, format_desc->block.bits, type.width, -- cgit v1.2.3 From 10981c0a767f146ca649e50af9871cd499b0617e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 4 Oct 2009 11:35:50 +0100 Subject: llvmpipe: Match header's protection macro with filename. --- src/gallium/drivers/llvmpipe/lp_bld_format.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_format.h b/src/gallium/drivers/llvmpipe/lp_bld_format.h index 6d3f692619..c087fc986e 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_format.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_format.h @@ -25,8 +25,8 @@ * **************************************************************************/ -#ifndef LP_BLD_H -#define LP_BLD_H +#ifndef LP_BLD_FORMAT_H +#define LP_BLD_FORMAT_H /** @@ -116,4 +116,4 @@ lp_build_load_rgba_soa(LLVMBuilderRef builder, LLVMValueRef offsets, LLVMValueRef *rgba); -#endif /* !LP_BLD_H */ +#endif /* !LP_BLD_FORMAT_H */ -- cgit v1.2.3 From eb2e41f0c636eb77634ec7ada93b869a43f11e9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 4 Oct 2009 11:36:42 +0100 Subject: llvmpipe: Remove loop testing from format testing. Loop building will be rewritten. --- src/gallium/drivers/llvmpipe/lp_test_format.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c index 7d83f899e6..ab80c0143f 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_format.c +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c @@ -37,7 +37,6 @@ #include "util/u_format.h" -#include "lp_bld_flow.h" #include "lp_bld_format.h" @@ -103,7 +102,6 @@ add_load_rgba_test(LLVMModuleRef module, LLVMBasicBlockRef block; LLVMBuilderRef builder; LLVMValueRef rgba; - struct lp_build_loop_state loop; args[0] = LLVMPointerType(LLVMInt8Type(), 0); args[1] = LLVMPointerType(LLVMVectorType(LLVMFloatType(), 4), 0); @@ -117,13 +115,9 @@ add_load_rgba_test(LLVMModuleRef module, builder = LLVMCreateBuilder(); LLVMPositionBuilderAtEnd(builder, block); - lp_build_loop_begin(builder, LLVMConstInt(LLVMInt32Type(), 1, 0), &loop); - rgba = lp_build_load_rgba_aos(builder, format, ptr); LLVMBuildStore(builder, rgba, rgba_ptr); - lp_build_loop_end(builder, LLVMConstInt(LLVMInt32Type(), 4, 0), NULL, &loop); - LLVMBuildRetVoid(builder); LLVMDisposeBuilder(builder); -- cgit v1.2.3 From 7a7dfb09aadf0509db4c1e2752fff5b75c59406b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 4 Oct 2009 12:49:31 +0100 Subject: util: Fix cpuid invocation for x86_64. --- src/gallium/auxiliary/util/u_cpu_detect.c | 34 +++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c index ecfb96138d..e26214cb91 100644 --- a/src/gallium/auxiliary/util/u_cpu_detect.c +++ b/src/gallium/auxiliary/util/u_cpu_detect.c @@ -336,22 +336,34 @@ cpuid(unsigned int ax, unsigned int *p) { int ret = -1; -#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) -#if defined(PIPE_CC_GCC) - __asm __volatile - ("movl %%ebx, %%esi\n\t" - "cpuid\n\t" - "xchgl %%ebx, %%esi" - : "=a" (p[0]), "=S" (p[1]), - "=c" (p[2]), "=d" (p[3]) - : "0" (ax)); - +#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86) + __asm __volatile ( + "movl %%ebx, %%esi\n\t" + "cpuid\n\t" + "xchgl %%ebx, %%esi" + : "=a" (p[0]), + "=S" (p[1]), + "=c" (p[2]), + "=d" (p[3]) + : "0" (ax) + ); + ret = 0; +#elif defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64) + __asm __volatile ( + "movq %%rbx, %%rsi\n\t" + "cpuid\n\t" + "xchgq %%rbx, %%rsi" + : "=a" (p[0]), + "=S" (p[1]), + "=c" (p[2]), + "=d" (p[3]) + : "0" (ax) + ); ret = 0; #elif defined(PIPE_CC_MSVC) __cpuid(ax, p); ret = 0; -#endif #endif return ret; -- cgit v1.2.3 From 589ec337f0080893baba996201cf65bb6e1a2fec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 4 Oct 2009 13:04:08 +0100 Subject: llvmpipe: Autogenerate lp_tile_soa.c from u_format.csv. This is just a temporary change until we code generate the tile read/write functions in runtime. The new code avoids an extra memcpy that exists in u_tile.c functions, from which lp_tile_soa.c was originally based. This achieves up to 5% improvement, particularly in frames with little geometry overlap. --- src/gallium/drivers/llvmpipe/.gitignore | 1 + src/gallium/drivers/llvmpipe/Makefile | 3 + src/gallium/drivers/llvmpipe/SConscript | 7 + src/gallium/drivers/llvmpipe/lp_tile_cache.c | 77 +-- src/gallium/drivers/llvmpipe/lp_tile_soa.c | 931 --------------------------- src/gallium/drivers/llvmpipe/lp_tile_soa.h | 16 +- src/gallium/drivers/llvmpipe/lp_tile_soa.py | 278 ++++++++ 7 files changed, 339 insertions(+), 974 deletions(-) create mode 100644 src/gallium/drivers/llvmpipe/.gitignore delete mode 100644 src/gallium/drivers/llvmpipe/lp_tile_soa.c create mode 100644 src/gallium/drivers/llvmpipe/lp_tile_soa.py (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/.gitignore b/src/gallium/drivers/llvmpipe/.gitignore new file mode 100644 index 0000000000..257b72d7b2 --- /dev/null +++ b/src/gallium/drivers/llvmpipe/.gitignore @@ -0,0 +1 @@ +lp_tile_soa.c diff --git a/src/gallium/drivers/llvmpipe/Makefile b/src/gallium/drivers/llvmpipe/Makefile index cd7b6356d2..21aff1967a 100644 --- a/src/gallium/drivers/llvmpipe/Makefile +++ b/src/gallium/drivers/llvmpipe/Makefile @@ -55,3 +55,6 @@ C_SOURCES = \ lp_tile_soa.c include ../../Makefile.template + +lp_tile_soa.c: lp_tile_soa.py ../../auxiliary/util/u_format_parse.py ../../auxiliary/util/u_format_access.py ../../auxiliary/util/u_format.csv + python lp_tile_soa.py ../../auxiliary/util/u_format.csv > $@ diff --git a/src/gallium/drivers/llvmpipe/SConscript b/src/gallium/drivers/llvmpipe/SConscript index f4a9a3b22e..13cd465838 100644 --- a/src/gallium/drivers/llvmpipe/SConscript +++ b/src/gallium/drivers/llvmpipe/SConscript @@ -9,6 +9,13 @@ if not env.has_key('LLVM_VERSION'): env.Tool('udis86') +env.CodeGenerate( + target = 'lp_tile_soa.c', + script = 'lp_tile_soa.py', + source = ['#src/gallium/auxiliary/util/u_format.csv'], + command = 'python $SCRIPT $SOURCE > $TARGET' +) + llvmpipe = env.ConvenienceLibrary( target = 'llvmpipe', source = [ diff --git a/src/gallium/drivers/llvmpipe/lp_tile_cache.c b/src/gallium/drivers/llvmpipe/lp_tile_cache.c index 2ac8cb5c82..68d3fa3282 100644 --- a/src/gallium/drivers/llvmpipe/lp_tile_cache.c +++ b/src/gallium/drivers/llvmpipe/lp_tile_cache.c @@ -241,42 +241,34 @@ lp_flush_tile_cache(struct llvmpipe_tile_cache *tc) for (x = 0; x < pt->width; x += TILE_SIZE) { struct llvmpipe_cached_tile *tile = &tc->entries[y/TILE_SIZE][x/TILE_SIZE]; - switch(tile->status) { - case LP_TILE_STATUS_UNDEFINED: - break; - - case LP_TILE_STATUS_CLEAR: { - /** - * Actually clear the tiles which were flagged as being in a clear state. - */ - - struct pipe_screen *screen = pt->texture->screen; - unsigned tw = TILE_SIZE; - unsigned th = TILE_SIZE; - void *dst; - - if (pipe_clip_tile(x, y, &tw, &th, pt)) - continue; - - dst = screen->transfer_map(screen, pt); - assert(dst); - if(!dst) - continue; - - util_fill_rect(dst, &pt->block, pt->stride, - x, y, tw, th, - tc->clear_val); - - screen->transfer_unmap(screen, pt); + if(tile->status != LP_TILE_STATUS_UNDEFINED) { + unsigned w = TILE_SIZE; + unsigned h = TILE_SIZE; + + if (!pipe_clip_tile(x, y, &w, &h, pt)) { + switch(tile->status) { + case LP_TILE_STATUS_CLEAR: + /* Actually clear the tiles which were flagged as being in a + * clear state. */ + util_fill_rect(tc->transfer_map, &pt->block, pt->stride, + x, y, w, h, + tc->clear_val); + break; + + case LP_TILE_STATUS_DEFINED: + lp_tile_write_4ub(pt->format, + tile->color, + tc->transfer_map, pt->stride, + x, y, w, h); + break; + + default: + assert(0); + break; + } + } tile->status = LP_TILE_STATUS_UNDEFINED; - break; - } - - case LP_TILE_STATUS_DEFINED: - lp_put_tile_rgba_soa(pt, x, y, tile->color); - tile->status = LP_TILE_STATUS_UNDEFINED; - break; } } } @@ -304,11 +296,22 @@ lp_get_cached_tile(struct llvmpipe_tile_cache *tc, tile->status = LP_TILE_STATUS_DEFINED; break; - case LP_TILE_STATUS_UNDEFINED: - /* get new tile data from transfer */ - lp_get_tile_rgba_soa(pt, x & ~(TILE_SIZE - 1), y & ~(TILE_SIZE - 1), tile->color); + case LP_TILE_STATUS_UNDEFINED: { + unsigned w = TILE_SIZE; + unsigned h = TILE_SIZE; + + x &= ~(TILE_SIZE - 1); + y &= ~(TILE_SIZE - 1); + + if (!pipe_clip_tile(x, y, &w, &h, tc->transfer)) + lp_tile_read_4ub(pt->format, + tile->color, + tc->transfer_map, tc->transfer->stride, + x, y, w, h); + tile->status = LP_TILE_STATUS_DEFINED; break; + } case LP_TILE_STATUS_DEFINED: /* nothing to do */ diff --git a/src/gallium/drivers/llvmpipe/lp_tile_soa.c b/src/gallium/drivers/llvmpipe/lp_tile_soa.c deleted file mode 100644 index 4e4ccb31cc..0000000000 --- a/src/gallium/drivers/llvmpipe/lp_tile_soa.c +++ /dev/null @@ -1,931 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * 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. - * - **************************************************************************/ - -/** - * RGBA/float tile get/put functions. - * Usable both by drivers and state trackers. - */ - - -#include "pipe/p_defines.h" -#include "pipe/p_inlines.h" - -#include "util/u_math.h" -#include "util/u_memory.h" -#include "util/u_rect.h" -#include "util/u_tile.h" -#include "lp_tile_cache.h" -#include "lp_tile_soa.h" - - -const unsigned char -tile_offset[TILE_VECTOR_HEIGHT][TILE_VECTOR_WIDTH] = { - { 0, 1, 4, 5, 8, 9, 12, 13}, - { 2, 3, 6, 7, 10, 11, 14, 15} -}; - - - -/*** PIPE_FORMAT_A8R8G8B8_UNORM ***/ - -static void -a8r8g8b8_get_tile_rgba(const unsigned *src, - unsigned w, unsigned h, - uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - const unsigned pixel = *src++; - TILE_PIXEL(p, j, i, 0) = (pixel >> 16) & 0xff; - TILE_PIXEL(p, j, i, 1) = (pixel >> 8) & 0xff; - TILE_PIXEL(p, j, i, 2) = (pixel >> 0) & 0xff; - TILE_PIXEL(p, j, i, 3) = (pixel >> 24) & 0xff; - } - } -} - - -static void -a8r8g8b8_put_tile_rgba(unsigned *dst, - unsigned w, unsigned h, - const uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - unsigned r, g, b, a; - r = TILE_PIXEL(p, j, i, 0); - g = TILE_PIXEL(p, j, i, 1); - b = TILE_PIXEL(p, j, i, 2); - a = TILE_PIXEL(p, j, i, 3); - *dst++ = (a << 24) | (r << 16) | (g << 8) | b; - } - } -} - - -/*** PIPE_FORMAT_A8R8G8B8_UNORM ***/ - -static void -x8r8g8b8_get_tile_rgba(const unsigned *src, - unsigned w, unsigned h, - uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - const unsigned pixel = *src++; - TILE_PIXEL(p, j, i, 0) = (pixel >> 16) & 0xff; - TILE_PIXEL(p, j, i, 1) = (pixel >> 8) & 0xff; - TILE_PIXEL(p, j, i, 2) = (pixel >> 0) & 0xff; - TILE_PIXEL(p, j, i, 3) = 0xff; - } - } -} - - -static void -x8r8g8b8_put_tile_rgba(unsigned *dst, - unsigned w, unsigned h, - const uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - unsigned r, g, b; - r = TILE_PIXEL(p, j, i, 0); - g = TILE_PIXEL(p, j, i, 1); - b = TILE_PIXEL(p, j, i, 2); - *dst++ = (0xff << 24) | (r << 16) | (g << 8) | b; - } - } -} - - -/*** PIPE_FORMAT_B8G8R8A8_UNORM ***/ - -static void -b8g8r8a8_get_tile_rgba(const unsigned *src, - unsigned w, unsigned h, - uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - const unsigned pixel = *src++; - TILE_PIXEL(p, j, i, 0) = (pixel >> 8) & 0xff; - TILE_PIXEL(p, j, i, 1) = (pixel >> 16) & 0xff; - TILE_PIXEL(p, j, i, 2) = (pixel >> 24) & 0xff; - TILE_PIXEL(p, j, i, 3) = (pixel >> 0) & 0xff; - } - } -} - - -static void -b8g8r8a8_put_tile_rgba(unsigned *dst, - unsigned w, unsigned h, - const uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - unsigned r, g, b, a; - r = TILE_PIXEL(p, j, i, 0); - g = TILE_PIXEL(p, j, i, 1); - b = TILE_PIXEL(p, j, i, 2); - a = TILE_PIXEL(p, j, i, 3); - *dst++ = (b << 24) | (g << 16) | (r << 8) | a; - } - } -} - - -/*** PIPE_FORMAT_A1R5G5B5_UNORM ***/ - -static void -a1r5g5b5_get_tile_rgba(const ushort *src, - unsigned w, unsigned h, - uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - const ushort pixel = *src++; - TILE_PIXEL(p, j, i, 0) = ((pixel >> 10) & 0x1f) * 255 / 31; - TILE_PIXEL(p, j, i, 1) = ((pixel >> 5) & 0x1f) * 255 / 31; - TILE_PIXEL(p, j, i, 2) = ((pixel ) & 0x1f) * 255 / 31; - TILE_PIXEL(p, j, i, 3) = ((pixel >> 15) ) * 255; - } - } -} - - -static void -a1r5g5b5_put_tile_rgba(ushort *dst, - unsigned w, unsigned h, - const uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - unsigned r, g, b, a; - r = TILE_PIXEL(p, j, i, 0); - g = TILE_PIXEL(p, j, i, 1); - b = TILE_PIXEL(p, j, i, 2); - a = TILE_PIXEL(p, j, i, 3); - r = r >> 3; /* 5 bits */ - g = g >> 3; /* 5 bits */ - b = b >> 3; /* 5 bits */ - a = a >> 7; /* 1 bit */ - *dst++ = (a << 15) | (r << 10) | (g << 5) | b; - } - } -} - - -/*** PIPE_FORMAT_A4R4G4B4_UNORM ***/ - -static void -a4r4g4b4_get_tile_rgba(const ushort *src, - unsigned w, unsigned h, - uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - const ushort pixel = *src++; - TILE_PIXEL(p, j, i, 0) = ((pixel >> 8) & 0xf) * 255 / 15; - TILE_PIXEL(p, j, i, 1) = ((pixel >> 4) & 0xf) * 255 / 15; - TILE_PIXEL(p, j, i, 2) = ((pixel ) & 0xf) * 255 / 15; - TILE_PIXEL(p, j, i, 3) = ((pixel >> 12) ) * 255 / 15; - } - } -} - - -static void -a4r4g4b4_put_tile_rgba(ushort *dst, - unsigned w, unsigned h, - const uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - unsigned r, g, b, a; - r = TILE_PIXEL(p, j, i, 0); - g = TILE_PIXEL(p, j, i, 1); - b = TILE_PIXEL(p, j, i, 2); - a = TILE_PIXEL(p, j, i, 3); - r >>= 4; - g >>= 4; - b >>= 4; - a >>= 4; - *dst++ = (a << 12) | (r << 16) | (g << 4) | b; - } - } -} - - -/*** PIPE_FORMAT_R5G6B5_UNORM ***/ - -static void -r5g6b5_get_tile_rgba(const ushort *src, - unsigned w, unsigned h, - uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - const ushort pixel = *src++; - TILE_PIXEL(p, j, i, 0) = ((pixel >> 11) & 0x1f) * 255 / 31; - TILE_PIXEL(p, j, i, 1) = ((pixel >> 5) & 0x3f) * 255 / 63; - TILE_PIXEL(p, j, i, 2) = ((pixel ) & 0x1f) * 255 / 31; - TILE_PIXEL(p, j, i, 3) = 255; - } - } -} - - -static void -r5g6b5_put_tile_rgba(ushort *dst, - unsigned w, unsigned h, - const uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - uint r = (uint) TILE_PIXEL(p, j, i, 0) * 31 / 255; - uint g = (uint) TILE_PIXEL(p, j, i, 1) * 63 / 255; - uint b = (uint) TILE_PIXEL(p, j, i, 2) * 31 / 255; - *dst++ = (r << 11) | (g << 5) | (b); - } - } -} - - - -/*** PIPE_FORMAT_Z16_UNORM ***/ - -/** - * Return each Z value as four floats in [0,1]. - */ -static void -z16_get_tile_rgba(const ushort *src, - unsigned w, unsigned h, - uint8_t *p) -{ - const float scale = 1.0f / 65535.0f; - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - TILE_PIXEL(p, j, i, 0) = - TILE_PIXEL(p, j, i, 1) = - TILE_PIXEL(p, j, i, 2) = - TILE_PIXEL(p, j, i, 3) = *src++ * scale; - } - } -} - - - - -/*** PIPE_FORMAT_L8_UNORM ***/ - -static void -l8_get_tile_rgba(const ubyte *src, - unsigned w, unsigned h, - uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++, src++) { - TILE_PIXEL(p, j, i, 0) = - TILE_PIXEL(p, j, i, 1) = - TILE_PIXEL(p, j, i, 2) = *src; - TILE_PIXEL(p, j, i, 3) = 255; - } - } -} - - -static void -l8_put_tile_rgba(ubyte *dst, - unsigned w, unsigned h, - const uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - unsigned r; - r = TILE_PIXEL(p, j, i, 0); - *dst++ = (ubyte) r; - } - } -} - - - -/*** PIPE_FORMAT_A8_UNORM ***/ - -static void -a8_get_tile_rgba(const ubyte *src, - unsigned w, unsigned h, - uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++, src++) { - TILE_PIXEL(p, j, i, 0) = - TILE_PIXEL(p, j, i, 1) = - TILE_PIXEL(p, j, i, 2) = 0; - TILE_PIXEL(p, j, i, 3) = *src; - } - } -} - - -static void -a8_put_tile_rgba(ubyte *dst, - unsigned w, unsigned h, - const uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - unsigned a; - a = TILE_PIXEL(p, j, i, 3); - *dst++ = (ubyte) a; - } - } -} - - - -/*** PIPE_FORMAT_R16_SNORM ***/ - -static void -r16_get_tile_rgba(const short *src, - unsigned w, unsigned h, - uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++, src++) { - TILE_PIXEL(p, j, i, 0) = MAX2(src[0] >> 7, 0); - TILE_PIXEL(p, j, i, 1) = - TILE_PIXEL(p, j, i, 2) = 0; - TILE_PIXEL(p, j, i, 3) = 255; - } - } -} - - -static void -r16_put_tile_rgba(short *dst, - unsigned w, unsigned h, - const uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++, dst++) { - dst[0] = TILE_PIXEL(p, j, i, 0) << 7; - } - } -} - - -/*** PIPE_FORMAT_R16G16B16A16_SNORM ***/ - -static void -r16g16b16a16_get_tile_rgba(const short *src, - unsigned w, unsigned h, - uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++, src += 4) { - TILE_PIXEL(p, j, i, 0) = src[0] >> 8; - TILE_PIXEL(p, j, i, 1) = src[1] >> 8; - TILE_PIXEL(p, j, i, 2) = src[2] >> 8; - TILE_PIXEL(p, j, i, 3) = src[3] >> 8; - } - } -} - - -static void -r16g16b16a16_put_tile_rgba(short *dst, - unsigned w, unsigned h, - const uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++, dst += 4) { - dst[0] = TILE_PIXEL(p, j, i, 0) << 8; - dst[1] = TILE_PIXEL(p, j, i, 1) << 8; - dst[2] = TILE_PIXEL(p, j, i, 2) << 8; - dst[3] = TILE_PIXEL(p, j, i, 3) << 8; - } - } -} - - - -/*** PIPE_FORMAT_I8_UNORM ***/ - -static void -i8_get_tile_rgba(const ubyte *src, - unsigned w, unsigned h, - uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++, src++) { - TILE_PIXEL(p, j, i, 0) = - TILE_PIXEL(p, j, i, 1) = - TILE_PIXEL(p, j, i, 2) = - TILE_PIXEL(p, j, i, 3) = *src; - } - } -} - - -static void -i8_put_tile_rgba(ubyte *dst, - unsigned w, unsigned h, - const uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - unsigned r; - r = TILE_PIXEL(p, j, i, 0); - *dst++ = (ubyte) r; - } - } -} - - -/*** PIPE_FORMAT_A8L8_UNORM ***/ - -static void -a8l8_get_tile_rgba(const ushort *src, - unsigned w, unsigned h, - uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - ushort ra = *src++; - TILE_PIXEL(p, j, i, 0) = - TILE_PIXEL(p, j, i, 1) = - TILE_PIXEL(p, j, i, 2) = ra & 0xff; - TILE_PIXEL(p, j, i, 3) = ra >> 8; - } - } -} - - -static void -a8l8_put_tile_rgba(ushort *dst, - unsigned w, unsigned h, - const uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - unsigned r, a; - r = TILE_PIXEL(p, j, i, 0); - a = TILE_PIXEL(p, j, i, 3); - *dst++ = (a << 8) | r; - } - } -} - - - - -/*** PIPE_FORMAT_Z32_UNORM ***/ - -/** - * Return each Z value as four floats in [0,1]. - */ -static void -z32_get_tile_rgba(const unsigned *src, - unsigned w, unsigned h, - uint8_t *p) -{ - const double scale = 1.0 / (double) 0xffffffff; - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - TILE_PIXEL(p, j, i, 0) = - TILE_PIXEL(p, j, i, 1) = - TILE_PIXEL(p, j, i, 2) = - TILE_PIXEL(p, j, i, 3) = (float) (*src++ * scale); - } - } -} - - -/*** PIPE_FORMAT_S8Z24_UNORM ***/ - -/** - * Return Z component as four float in [0,1]. Stencil part ignored. - */ -static void -s8z24_get_tile_rgba(const unsigned *src, - unsigned w, unsigned h, - uint8_t *p) -{ - const double scale = 1.0 / ((1 << 24) - 1); - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - TILE_PIXEL(p, j, i, 0) = - TILE_PIXEL(p, j, i, 1) = - TILE_PIXEL(p, j, i, 2) = - TILE_PIXEL(p, j, i, 3) = (float) (scale * (*src++ & 0xffffff)); - } - } -} - - -/*** PIPE_FORMAT_Z24S8_UNORM ***/ - -/** - * Return Z component as four float in [0,1]. Stencil part ignored. - */ -static void -z24s8_get_tile_rgba(const unsigned *src, - unsigned w, unsigned h, - uint8_t *p) -{ - const double scale = 1.0 / ((1 << 24) - 1); - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - TILE_PIXEL(p, j, i, 0) = - TILE_PIXEL(p, j, i, 1) = - TILE_PIXEL(p, j, i, 2) = - TILE_PIXEL(p, j, i, 3) = (float) (scale * (*src++ >> 8)); - } - } -} - - -/*** PIPE_FORMAT_Z32_FLOAT ***/ - -/** - * Return each Z value as four floats in [0,1]. - */ -static void -z32f_get_tile_rgba(const float *src, - unsigned w, unsigned h, - uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - TILE_PIXEL(p, j, i, 0) = - TILE_PIXEL(p, j, i, 1) = - TILE_PIXEL(p, j, i, 2) = - TILE_PIXEL(p, j, i, 3) = *src++; - } - } -} - - -/*** PIPE_FORMAT_YCBCR / PIPE_FORMAT_YCBCR_REV ***/ - -/** - * Convert YCbCr (or YCrCb) to RGBA. - */ -static void -ycbcr_get_tile_rgba(const ushort *src, - unsigned w, unsigned h, - uint8_t *p, - boolean rev) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - /* do two texels at a time */ - for (j = 0; j < (w & ~1); j += 2, src += 2) { - const ushort t0 = src[0]; - const ushort t1 = src[1]; - const ubyte y0 = (t0 >> 8) & 0xff; /* luminance */ - const ubyte y1 = (t1 >> 8) & 0xff; /* luminance */ - ubyte cb, cr; - float r, g, b; - - if (rev) { - cb = t1 & 0xff; /* chroma U */ - cr = t0 & 0xff; /* chroma V */ - } - else { - cb = t0 & 0xff; /* chroma U */ - cr = t1 & 0xff; /* chroma V */ - } - - /* even pixel: y0,cr,cb */ - r = 1.164f * (y0-16) + 1.596f * (cr-128); - g = 1.164f * (y0-16) - 0.813f * (cr-128) - 0.391f * (cb-128); - b = 1.164f * (y0-16) + 2.018f * (cb-128); - TILE_PIXEL(p, j, i, 0) = r; - TILE_PIXEL(p, j, i, 1) = g; - TILE_PIXEL(p, j, i, 2) = b; - TILE_PIXEL(p, j, i, 3) = 255; - - /* odd pixel: use y1,cr,cb */ - r = 1.164f * (y1-16) + 1.596f * (cr-128); - g = 1.164f * (y1-16) - 0.813f * (cr-128) - 0.391f * (cb-128); - b = 1.164f * (y1-16) + 2.018f * (cb-128); - TILE_PIXEL(p, j + 1, i, 0) = r; - TILE_PIXEL(p, j + 1, i, 1) = g; - TILE_PIXEL(p, j + 1, i, 2) = b; - TILE_PIXEL(p, j + 1, i, 3) = 255; - } - /* do the last texel */ - if (w & 1) { - const ushort t0 = src[0]; - const ushort t1 = src[1]; - const ubyte y0 = (t0 >> 8) & 0xff; /* luminance */ - ubyte cb, cr; - float r, g, b; - - if (rev) { - cb = t1 & 0xff; /* chroma U */ - cr = t0 & 0xff; /* chroma V */ - } - else { - cb = t0 & 0xff; /* chroma U */ - cr = t1 & 0xff; /* chroma V */ - } - - /* even pixel: y0,cr,cb */ - r = 1.164f * (y0-16) + 1.596f * (cr-128); - g = 1.164f * (y0-16) - 0.813f * (cr-128) - 0.391f * (cb-128); - b = 1.164f * (y0-16) + 2.018f * (cb-128); - TILE_PIXEL(p, j, i, 0) = r; - TILE_PIXEL(p, j, i, 1) = g; - TILE_PIXEL(p, j, i, 2) = b; - TILE_PIXEL(p, j, i, 3) = 255; - } - } -} - - -static void -fake_get_tile_rgba(const ushort *src, - unsigned w, unsigned h, - uint8_t *p) -{ - unsigned i, j; - - for (i = 0; i < h; i++) { - for (j = 0; j < w; j++) { - TILE_PIXEL(p, j, i, 0) = - TILE_PIXEL(p, j, i, 1) = - TILE_PIXEL(p, j, i, 2) = - TILE_PIXEL(p, j, i, 3) = (i ^ j) & 1 ? 255 : 0; - } - } -} - - -static void -lp_tile_raw_to_rgba_soa(enum pipe_format format, - void *src, - uint w, uint h, - uint8_t *p) -{ - switch (format) { - case PIPE_FORMAT_A8R8G8B8_UNORM: - a8r8g8b8_get_tile_rgba((unsigned *) src, w, h, p); - break; - case PIPE_FORMAT_X8R8G8B8_UNORM: - x8r8g8b8_get_tile_rgba((unsigned *) src, w, h, p); - break; - case PIPE_FORMAT_B8G8R8A8_UNORM: - b8g8r8a8_get_tile_rgba((unsigned *) src, w, h, p); - break; - case PIPE_FORMAT_A1R5G5B5_UNORM: - a1r5g5b5_get_tile_rgba((ushort *) src, w, h, p); - break; - case PIPE_FORMAT_A4R4G4B4_UNORM: - a4r4g4b4_get_tile_rgba((ushort *) src, w, h, p); - break; - case PIPE_FORMAT_R5G6B5_UNORM: - r5g6b5_get_tile_rgba((ushort *) src, w, h, p); - break; - case PIPE_FORMAT_L8_UNORM: - l8_get_tile_rgba((ubyte *) src, w, h, p); - break; - case PIPE_FORMAT_A8_UNORM: - a8_get_tile_rgba((ubyte *) src, w, h, p); - break; - case PIPE_FORMAT_I8_UNORM: - i8_get_tile_rgba((ubyte *) src, w, h, p); - break; - case PIPE_FORMAT_A8L8_UNORM: - a8l8_get_tile_rgba((ushort *) src, w, h, p); - break; - case PIPE_FORMAT_R16_SNORM: - r16_get_tile_rgba((short *) src, w, h, p); - break; - case PIPE_FORMAT_R16G16B16A16_SNORM: - r16g16b16a16_get_tile_rgba((short *) src, w, h, p); - break; - case PIPE_FORMAT_Z16_UNORM: - z16_get_tile_rgba((ushort *) src, w, h, p); - break; - case PIPE_FORMAT_Z32_UNORM: - z32_get_tile_rgba((unsigned *) src, w, h, p); - break; - case PIPE_FORMAT_S8Z24_UNORM: - case PIPE_FORMAT_X8Z24_UNORM: - s8z24_get_tile_rgba((unsigned *) src, w, h, p); - break; - case PIPE_FORMAT_Z24S8_UNORM: - case PIPE_FORMAT_Z24X8_UNORM: - z24s8_get_tile_rgba((unsigned *) src, w, h, p); - break; - case PIPE_FORMAT_Z32_FLOAT: - z32f_get_tile_rgba((float *) src, w, h, p); - break; - case PIPE_FORMAT_YCBCR: - ycbcr_get_tile_rgba((ushort *) src, w, h, p, FALSE); - break; - case PIPE_FORMAT_YCBCR_REV: - ycbcr_get_tile_rgba((ushort *) src, w, h, p, TRUE); - break; - default: - debug_printf("%s: unsupported format %s\n", __FUNCTION__, pf_name(format)); - fake_get_tile_rgba(src, w, h, p); - } -} - - -void -lp_get_tile_rgba_soa(struct pipe_transfer *pt, - uint x, uint y, - uint8_t *p) -{ - uint w = TILE_SIZE, h = TILE_SIZE; - void *packed; - - if (pipe_clip_tile(x, y, &w, &h, pt)) - return; - - packed = MALLOC(pf_get_nblocks(&pt->block, w, h) * pt->block.size); - - if (!packed) - return; - - if(pt->format == PIPE_FORMAT_YCBCR || pt->format == PIPE_FORMAT_YCBCR_REV) - assert((x & 1) == 0); - - pipe_get_tile_raw(pt, x, y, w, h, packed, 0); - - lp_tile_raw_to_rgba_soa(pt->format, packed, w, h, p); - - FREE(packed); -} - - -void -lp_put_tile_rgba_soa(struct pipe_transfer *pt, - uint x, uint y, - const uint8_t *p) -{ - uint w = TILE_SIZE, h = TILE_SIZE; - void *packed; - - if (pipe_clip_tile(x, y, &w, &h, pt)) - return; - - packed = MALLOC(pf_get_nblocks(&pt->block, w, h) * pt->block.size); - - if (!packed) - return; - - switch (pt->format) { - case PIPE_FORMAT_A8R8G8B8_UNORM: - a8r8g8b8_put_tile_rgba((unsigned *) packed, w, h, p); - break; - case PIPE_FORMAT_X8R8G8B8_UNORM: - x8r8g8b8_put_tile_rgba((unsigned *) packed, w, h, p); - break; - case PIPE_FORMAT_B8G8R8A8_UNORM: - b8g8r8a8_put_tile_rgba((unsigned *) packed, w, h, p); - break; - case PIPE_FORMAT_A1R5G5B5_UNORM: - a1r5g5b5_put_tile_rgba((ushort *) packed, w, h, p); - break; - case PIPE_FORMAT_R5G6B5_UNORM: - r5g6b5_put_tile_rgba((ushort *) packed, w, h, p); - break; - case PIPE_FORMAT_R8G8B8A8_UNORM: - assert(0); - break; - case PIPE_FORMAT_A4R4G4B4_UNORM: - a4r4g4b4_put_tile_rgba((ushort *) packed, w, h, p); - break; - case PIPE_FORMAT_L8_UNORM: - l8_put_tile_rgba((ubyte *) packed, w, h, p); - break; - case PIPE_FORMAT_A8_UNORM: - a8_put_tile_rgba((ubyte *) packed, w, h, p); - break; - case PIPE_FORMAT_I8_UNORM: - i8_put_tile_rgba((ubyte *) packed, w, h, p); - break; - case PIPE_FORMAT_A8L8_UNORM: - a8l8_put_tile_rgba((ushort *) packed, w, h, p); - break; - case PIPE_FORMAT_R16_SNORM: - r16_put_tile_rgba((short *) packed, w, h, p); - break; - case PIPE_FORMAT_R16G16B16A16_SNORM: - r16g16b16a16_put_tile_rgba((short *) packed, w, h, p); - break; - case PIPE_FORMAT_Z16_UNORM: - /*z16_put_tile_rgba((ushort *) packed, w, h, p);*/ - break; - case PIPE_FORMAT_Z32_UNORM: - /*z32_put_tile_rgba((unsigned *) packed, w, h, p);*/ - break; - case PIPE_FORMAT_S8Z24_UNORM: - case PIPE_FORMAT_X8Z24_UNORM: - /*s8z24_put_tile_rgba((unsigned *) packed, w, h, p);*/ - break; - case PIPE_FORMAT_Z24S8_UNORM: - case PIPE_FORMAT_Z24X8_UNORM: - /*z24s8_put_tile_rgba((unsigned *) packed, w, h, p);*/ - break; - default: - debug_printf("%s: unsupported format %s\n", __FUNCTION__, pf_name(pt->format)); - } - - pipe_put_tile_raw(pt, x, y, w, h, packed, 0); - - FREE(packed); -} - - diff --git a/src/gallium/drivers/llvmpipe/lp_tile_soa.h b/src/gallium/drivers/llvmpipe/lp_tile_soa.h index 3d8c703b73..040b01865d 100644 --- a/src/gallium/drivers/llvmpipe/lp_tile_soa.h +++ b/src/gallium/drivers/llvmpipe/lp_tile_soa.h @@ -64,14 +64,18 @@ tile_offset[TILE_VECTOR_HEIGHT][TILE_VECTOR_WIDTH]; void -lp_get_tile_rgba_soa(struct pipe_transfer *pt, - uint x, uint y, - uint8_t *p); +lp_tile_read_4ub(enum pipe_format format, + uint8_t *dst, + const void *src, unsigned src_stride, + unsigned x, unsigned y, unsigned w, unsigned h); + void -lp_put_tile_rgba_soa(struct pipe_transfer *pt, - uint x, uint y, - const uint8_t *p); +lp_tile_write_4ub(enum pipe_format format, + const uint8_t *src, + void *dst, unsigned dst_stride, + unsigned x, unsigned y, unsigned w, unsigned h); + #ifdef __cplusplus diff --git a/src/gallium/drivers/llvmpipe/lp_tile_soa.py b/src/gallium/drivers/llvmpipe/lp_tile_soa.py new file mode 100644 index 0000000000..004c5c979e --- /dev/null +++ b/src/gallium/drivers/llvmpipe/lp_tile_soa.py @@ -0,0 +1,278 @@ +#!/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. + * + **************************************************************************/ + +/** + * @file + * Pixel format accessor functions. + * + * @author Jose Fonseca + */ +''' + + +import sys +import os.path + +sys.path.insert(0, os.path.join(os.path.dirname(sys.argv[0]), '../../auxiliary/util')) + +from u_format_access import * + + +def generate_format_read(format, dst_type, dst_native_type, dst_suffix): + '''Generate the function to read pixels from a particular format''' + + name = short_name(format) + + src_native_type = native_type(format) + + print 'static void' + print 'lp_tile_%s_read_%s(%s *dst, const uint8_t *src, unsigned src_stride, unsigned x0, unsigned y0, unsigned w, unsigned h)' % (name, dst_suffix, dst_native_type) + print '{' + print ' unsigned x, y;' + print ' const uint8_t *src_row = src + y0*src_stride;' + print ' for (y = 0; y < h; ++y) {' + print ' const %s *src_pixel = (const %s *)(src_row + x0*%u);' % (src_native_type, src_native_type, format.stride()) + print ' for (x = 0; x < w; ++x) {' + + names = ['']*4 + if format.colorspace == 'rgb': + for i in range(4): + swizzle = format.out_swizzle[i] + if swizzle < 4: + names[swizzle] += 'rgba'[i] + elif format.colorspace == 'zs': + swizzle = format.out_swizzle[0] + if swizzle < 4: + names[swizzle] = 'z' + else: + assert False + else: + assert False + + if format.layout == ARITH: + print ' %s pixel = *src_pixel++;' % src_native_type + shift = 0; + for i in range(4): + src_type = format.in_types[i] + width = src_type.size + if names[i]: + value = 'pixel' + mask = (1 << width) - 1 + if shift: + value = '(%s >> %u)' % (value, shift) + if shift + width < format.block_size(): + value = '(%s & 0x%x)' % (value, mask) + value = conversion_expr(src_type, dst_type, dst_native_type, value) + print ' %s %s = %s;' % (dst_native_type, names[i], value) + shift += width + elif format.layout == ARRAY: + for i in range(4): + src_type = format.in_types[i] + if names[i]: + value = '(*src_pixel++)' + value = conversion_expr(src_type, dst_type, dst_native_type, value) + print ' %s %s = %s;' % (dst_native_type, names[i], value) + else: + assert False + + for i in range(4): + if format.colorspace == 'rgb': + swizzle = format.out_swizzle[i] + if swizzle < 4: + value = names[swizzle] + elif swizzle == SWIZZLE_0: + value = '0' + elif swizzle == SWIZZLE_1: + value = '1' + else: + assert False + elif format.colorspace == 'zs': + if i < 3: + value = 'z' + else: + value = '1' + else: + assert False + print ' TILE_PIXEL(dst, x, y, %u) = %s; /* %s */' % (i, value, 'rgba'[i]) + + print ' }' + print ' src_row += src_stride;' + print ' }' + print '}' + print + + +def generate_format_write(format, src_type, src_native_type, src_suffix): + '''Generate the function to write pixels to a particular format''' + + name = short_name(format) + + dst_native_type = native_type(format) + + print 'static void' + print 'lp_tile_%s_write_%s(const %s *src, uint8_t *dst, unsigned dst_stride, unsigned x0, unsigned y0, unsigned w, unsigned h)' % (name, src_suffix, src_native_type) + print '{' + print ' unsigned x, y;' + print ' uint8_t *dst_row = dst + y0*dst_stride;' + print ' for (y = 0; y < h; ++y) {' + print ' %s *dst_pixel = (%s *)(dst_row + x0*%u);' % (dst_native_type, dst_native_type, format.stride()) + print ' for (x = 0; x < w; ++x) {' + + inv_swizzle = [None]*4 + if format.colorspace == 'rgb': + for i in range(4): + swizzle = format.out_swizzle[i] + if swizzle < 4: + inv_swizzle[swizzle] = i + elif format.colorspace == 'zs': + swizzle = format.out_swizzle[0] + if swizzle < 4: + inv_swizzle[swizzle] = 0 + else: + assert False + + if format.layout == ARITH: + print ' %s pixel = 0;' % dst_native_type + shift = 0; + for i in range(4): + dst_type = format.in_types[i] + width = dst_type.size + if inv_swizzle[i] is not None: + value = 'TILE_PIXEL(src, x, y, %u)' % inv_swizzle[i] + value = conversion_expr(src_type, dst_type, dst_native_type, value) + if shift: + value = '(%s << %u)' % (value, shift) + print ' pixel |= %s;' % value + shift += width + print ' *dst_pixel++ = pixel;' + elif format.layout == ARRAY: + for i in range(4): + dst_type = format.in_types[i] + if inv_swizzle[i] is not None: + value = 'TILE_PIXEL(src, x, y, %u)' % inv_swizzle[i] + value = conversion_expr(src_type, dst_type, dst_native_type, value) + print ' *dst_pixel++ = %s;' % value + else: + assert False + + print ' }' + print ' dst_row += dst_stride;' + print ' }' + print '}' + print + + +def generate_read(formats, dst_type, dst_native_type, dst_suffix): + '''Generate the dispatch function to read pixels from any format''' + + for format in formats: + if is_format_supported(format): + generate_format_read(format, dst_type, dst_native_type, dst_suffix) + + print 'void' + print 'lp_tile_read_%s(enum pipe_format format, %s *dst, const void *src, unsigned src_stride, unsigned x, unsigned y, unsigned w, unsigned h)' % (dst_suffix, dst_native_type) + print '{' + print ' void (*func)(%s *dst, const uint8_t *src, unsigned src_stride, unsigned x0, unsigned y0, unsigned w, unsigned h);' % dst_native_type + print ' switch(format) {' + for format in formats: + if is_format_supported(format): + print ' case %s:' % format.name + print ' func = &lp_tile_%s_read_%s;' % (short_name(format), dst_suffix) + print ' break;' + print ' default:' + print ' debug_printf("unsupported format\\n");' + print ' return;' + print ' }' + print ' func(dst, (const uint8_t *)src, src_stride, x, y, w, h);' + print '}' + print + + +def generate_write(formats, src_type, src_native_type, src_suffix): + '''Generate the dispatch function to write pixels to any format''' + + for format in formats: + if is_format_supported(format): + generate_format_write(format, src_type, src_native_type, src_suffix) + + print 'void' + print 'lp_tile_write_%s(enum pipe_format format, const %s *src, void *dst, unsigned dst_stride, unsigned x, unsigned y, unsigned w, unsigned h)' % (src_suffix, src_native_type) + + print '{' + print ' void (*func)(const %s *src, uint8_t *dst, unsigned dst_stride, unsigned x0, unsigned y0, unsigned w, unsigned h);' % src_native_type + print ' switch(format) {' + for format in formats: + if is_format_supported(format): + print ' case %s:' % format.name + print ' func = &lp_tile_%s_write_%s;' % (short_name(format), src_suffix) + print ' break;' + print ' default:' + print ' debug_printf("unsupported format\\n");' + print ' return;' + print ' }' + print ' func(src, (uint8_t *)dst, dst_stride, x, y, w, h);' + print '}' + print + + +def main(): + formats = [] + for arg in sys.argv[1:]: + formats.extend(parse(arg)) + + print '/* This file is autogenerated by lp_tile_soa.py from u_format.csv. Do not edit directly. */' + print + # This will print the copyright message on the top of this file + print __doc__.strip() + print + print '#include "pipe/p_compiler.h"' + print '#include "util/u_format.h"' + print '#include "util/u_math.h"' + print '#include "lp_tile_soa.h"' + print + print 'const unsigned char' + print 'tile_offset[TILE_VECTOR_HEIGHT][TILE_VECTOR_WIDTH] = {' + print ' { 0, 1, 4, 5, 8, 9, 12, 13},' + print ' { 2, 3, 6, 7, 10, 11, 14, 15}' + print '};' + print + + generate_clamp() + + type = Type(UNSIGNED, True, 8) + native_type = 'uint8_t' + suffix = '4ub' + + generate_read(formats, type, native_type, suffix) + generate_write(formats, type, native_type, suffix) + + +if __name__ == '__main__': + main() -- cgit v1.2.3 From 77ef7050587bba43c219e9d22170237898b2bb23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 4 Oct 2009 13:25:24 +0100 Subject: llvmpipe: Ensure tile cache transfers are mapped before flushing it. --- src/gallium/drivers/llvmpipe/lp_flush.c | 8 ++++++-- src/gallium/drivers/llvmpipe/lp_state_surface.c | 1 + src/gallium/drivers/llvmpipe/lp_tile_cache.c | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_flush.c b/src/gallium/drivers/llvmpipe/lp_flush.c index b5c1c95bb7..cd8381fe30 100644 --- a/src/gallium/drivers/llvmpipe/lp_flush.c +++ b/src/gallium/drivers/llvmpipe/lp_flush.c @@ -58,8 +58,10 @@ llvmpipe_flush( struct pipe_context *pipe, * in the hope that a later clear will wipe them out. */ for (i = 0; i < llvmpipe->framebuffer.nr_cbufs; i++) - if (llvmpipe->cbuf_cache[i]) + if (llvmpipe->cbuf_cache[i]) { + lp_tile_cache_map_transfers(llvmpipe->cbuf_cache[i]); lp_flush_tile_cache(llvmpipe->cbuf_cache[i]); + } /* Need this call for hardware buffers before swapbuffers. * @@ -71,8 +73,10 @@ llvmpipe_flush( struct pipe_context *pipe, } else if (flags & PIPE_FLUSH_RENDER_CACHE) { for (i = 0; i < llvmpipe->framebuffer.nr_cbufs; i++) - if (llvmpipe->cbuf_cache[i]) + if (llvmpipe->cbuf_cache[i]) { + lp_tile_cache_map_transfers(llvmpipe->cbuf_cache[i]); lp_flush_tile_cache(llvmpipe->cbuf_cache[i]); + } /* FIXME: untile zsbuf! */ diff --git a/src/gallium/drivers/llvmpipe/lp_state_surface.c b/src/gallium/drivers/llvmpipe/lp_state_surface.c index 2c29144c03..c06ce8b75c 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_surface.c +++ b/src/gallium/drivers/llvmpipe/lp_state_surface.c @@ -53,6 +53,7 @@ llvmpipe_set_framebuffer_state(struct pipe_context *pipe, /* check if changing cbuf */ if (lp->framebuffer.cbufs[i] != fb->cbufs[i]) { /* flush old */ + lp_tile_cache_map_transfers(lp->cbuf_cache[i]); lp_flush_tile_cache(lp->cbuf_cache[i]); /* assign new */ diff --git a/src/gallium/drivers/llvmpipe/lp_tile_cache.c b/src/gallium/drivers/llvmpipe/lp_tile_cache.c index 68d3fa3282..ec3e002d62 100644 --- a/src/gallium/drivers/llvmpipe/lp_tile_cache.c +++ b/src/gallium/drivers/llvmpipe/lp_tile_cache.c @@ -236,6 +236,8 @@ lp_flush_tile_cache(struct llvmpipe_tile_cache *tc) if(!pt) return; + assert(tc->transfer_map); + /* push the tile to all positions marked as clear */ for (y = 0; y < pt->height; y += TILE_SIZE) { for (x = 0; x < pt->width; x += TILE_SIZE) { -- cgit v1.2.3 From 7a2271c65963c86ec1e5d9523b2eecf9ee59fe9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 4 Oct 2009 21:59:24 +0100 Subject: util: Make assert a no-op on non-debug builds. This ensures that an assertion like assert(expensive_test()); won't have any penalty on release builds. It also implies that no vital code should be in assert expressions. --- src/gallium/auxiliary/util/u_debug.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h index b82e7cb4d4..b8c56fd600 100644 --- a/src/gallium/auxiliary/util/u_debug.h +++ b/src/gallium/auxiliary/util/u_debug.h @@ -181,11 +181,14 @@ void _debug_assert_fail(const char *expr, * * Do not expect that the assert call terminates -- errors must be handled * regardless of assert behavior. + * + * For non debug builds the assert macro will expand to a no-op, so do not + * call functions with side effects in the assert expression. */ #ifdef DEBUG #define debug_assert(expr) ((expr) ? (void)0 : _debug_assert_fail(#expr, __FILE__, __LINE__, __FUNCTION__)) #else -#define debug_assert(expr) ((void)(expr)) +#define debug_assert(expr) ((void)0) #endif -- cgit v1.2.3 From 3856c3cc46813ad96ae6f02dec19460193d986ac Mon Sep 17 00:00:00 2001 From: Frederic Crozat Date: Sun, 4 Oct 2009 17:46:40 -0400 Subject: r200: remove subpixel offset from viewport Fixes bug fdo 20340 for r200. --- src/mesa/drivers/dri/r200/r200_state.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index 76852e315c..d28e96d9d9 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -1578,13 +1578,6 @@ static void r200ClearStencil( GLcontext *ctx, GLint s ) * Window position and viewport transformation */ -/* - * To correctly position primitives: - */ -#define SUBPIXEL_X 0.125 -#define SUBPIXEL_Y 0.125 - - /** * Called when window size or position changes or viewport or depth range * state is changed. We update the hardware viewport state here. @@ -1609,9 +1602,9 @@ void r200UpdateWindow( GLcontext *ctx ) } float_ui32_type sx = { v[MAT_SX] }; - float_ui32_type tx = { v[MAT_TX] + xoffset + SUBPIXEL_X }; + float_ui32_type tx = { v[MAT_TX] + xoffset }; float_ui32_type sy = { v[MAT_SY] * y_scale }; - float_ui32_type ty = { (v[MAT_TY] * y_scale) + y_bias + SUBPIXEL_Y }; + float_ui32_type ty = { (v[MAT_TY] * y_scale) + y_bias }; float_ui32_type sz = { v[MAT_SZ] * depthScale }; float_ui32_type tz = { v[MAT_TZ] * depthScale }; @@ -1680,8 +1673,8 @@ void r200UpdateViewportOffset( GLcontext *ctx ) float_ui32_type tx; float_ui32_type ty; - tx.f = v[MAT_TX] + xoffset + SUBPIXEL_X; - ty.f = (- v[MAT_TY]) + yoffset + SUBPIXEL_Y; + tx.f = v[MAT_TX] + xoffset; + ty.f = (- v[MAT_TY]) + yoffset; if ( rmesa->hw.vpt.cmd[VPT_SE_VPORT_XOFFSET] != tx.ui32 || rmesa->hw.vpt.cmd[VPT_SE_VPORT_YOFFSET] != ty.ui32 ) -- cgit v1.2.3 From 1336989ec60fff7bd590fefd28945a0e5dc536e3 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Mon, 5 Oct 2009 15:32:55 +1000 Subject: st/dri: no need to request fake front buffer, only handle it being returned The previous behaviour was incorrect, and resulted in EXT_tfp being broken for DDX drivers that implement the correct behaviour (intel/radeon/nouveau). In the cases where a fake front buffer is required, the X server will return one when requesting __DRI_BUFFER_FRONT_LEFT. The Xorg state tracker (aka modesetting_drv) is likely broken now until it's modified to match the other drivers. Signed-off-by: Ben Skeggs --- src/gallium/state_trackers/dri/dri_drawable.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index 5cec9e329d..6aafb384ef 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -179,7 +179,6 @@ dri_get_buffers(__DRIdrawablePrivate * dPriv) switch (buffers[i].attachment) { case __DRI_BUFFER_FRONT_LEFT: - continue; case __DRI_BUFFER_FAKE_FRONT_LEFT: index = ST_SURFACE_FRONT_LEFT; format = drawable->color_format; @@ -360,8 +359,6 @@ dri_create_buffer(__DRIscreenPrivate * sPriv, if (visual->doubleBufferMode) drawable->attachments[i++] = __DRI_BUFFER_BACK_LEFT; - else - drawable->attachments[i++] = __DRI_BUFFER_FAKE_FRONT_LEFT; if (visual->depthBits && visual->stencilBits) drawable->attachments[i++] = __DRI_BUFFER_DEPTH_STENCIL; else if (visual->depthBits) -- cgit v1.2.3 From 7aeaca33c331f70d507fc83583b13b8d9fc3e847 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Mon, 5 Oct 2009 14:42:45 +1000 Subject: mesa: fix return value when clipping {Read,Draw}Pixels height <= 0 Signed-off-by: Ben Skeggs --- src/mesa/main/image.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index baecbab0a3..139e56a96b 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -5511,7 +5511,7 @@ _mesa_clip_drawpixels(const GLcontext *ctx, } if (*height <= 0) - return GL_TRUE; + return GL_FALSE; return GL_TRUE; } @@ -5564,7 +5564,7 @@ _mesa_clip_readpixels(const GLcontext *ctx, *height -= (*srcY + *height - buffer->Height); if (*height <= 0) - return GL_TRUE; + return GL_FALSE; return GL_TRUE; } -- cgit v1.2.3 From 5313f1be11568b21f2e5fa5e8607bcbb422c3cab Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Mon, 5 Oct 2009 13:39:34 +1000 Subject: nouveau: return pitch value from local_handle_from_texture() Signed-off-by: Ben Skeggs --- src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c index 117ca6059b..8b531830f4 100644 --- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c +++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c @@ -245,6 +245,7 @@ nouveau_drm_handle_from_pt(struct drm_api *api, struct pipe_screen *pscreen, return false; *handle = mt->bo->handle; + *stride = mt->base.nblocksx[0] * mt->base.block.size; return true; } -- cgit v1.2.3 From 7bfc3172e88cc7ad8be9ab81de56f7e263c15824 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Mon, 5 Oct 2009 13:41:33 +1000 Subject: nv50: support PIPE_FORMAT_X8R8G8B8_UNORM Signed-off-by: Ben Skeggs --- src/gallium/drivers/nv50/nv50_screen.c | 2 ++ src/gallium/drivers/nv50/nv50_state_validate.c | 3 +++ src/gallium/drivers/nv50/nv50_tex.c | 7 +++++++ 3 files changed, 12 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index 3b08e1b89f..dd7baecba7 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -35,6 +35,7 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen, { if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) { switch (format) { + case PIPE_FORMAT_X8R8G8B8_UNORM: case PIPE_FORMAT_A8R8G8B8_UNORM: case PIPE_FORMAT_R5G6B5_UNORM: return TRUE; @@ -55,6 +56,7 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen, } else { switch (format) { case PIPE_FORMAT_A8R8G8B8_UNORM: + case PIPE_FORMAT_X8R8G8B8_UNORM: case PIPE_FORMAT_A1R5G5B5_UNORM: case PIPE_FORMAT_A4R4G4B4_UNORM: case PIPE_FORMAT_R5G6B5_UNORM: diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index 4ed76973c4..867b1ea872 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -57,6 +57,9 @@ nv50_state_validate_fb(struct nv50_context *nv50) case PIPE_FORMAT_A8R8G8B8_UNORM: so_data(so, NV50TCL_RT_FORMAT_A8R8G8B8_UNORM); break; + case PIPE_FORMAT_X8R8G8B8_UNORM: + so_data(so, NV50TCL_RT_FORMAT_X8R8G8B8_UNORM); + break; case PIPE_FORMAT_R5G6B5_UNORM: so_data(so, NV50TCL_RT_FORMAT_R5G6B5_UNORM); break; diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index 033cb50c11..21825a0411 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -37,6 +37,13 @@ nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so, NV50TIC_0_0_MAPB_C0 | NV50TIC_0_0_TYPEB_UNORM | NV50TIC_0_0_FMT_8_8_8_8); break; + case PIPE_FORMAT_X8R8G8B8_UNORM: + so_data(so, NV50TIC_0_0_MAPA_ONE | NV50TIC_0_0_TYPEA_UNORM | + NV50TIC_0_0_MAPR_C2 | NV50TIC_0_0_TYPER_UNORM | + NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM | + NV50TIC_0_0_MAPB_C0 | NV50TIC_0_0_TYPEB_UNORM | + NV50TIC_0_0_FMT_8_8_8_8); + break; case PIPE_FORMAT_A1R5G5B5_UNORM: so_data(so, NV50TIC_0_0_MAPA_C3 | NV50TIC_0_0_TYPEA_UNORM | NV50TIC_0_0_MAPR_C2 | NV50TIC_0_0_TYPER_UNORM | -- cgit v1.2.3 From d47de5054091a5d1fa9b19687ac80bcdc39a5f8f Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Mon, 5 Oct 2009 15:51:47 +1000 Subject: st/dri: avoid segfault if we can't get a pixmap's buffers Signed-off-by: Ben Skeggs --- src/gallium/state_trackers/dri/dri_drawable.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index 6aafb384ef..3f8dc8df75 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -249,6 +249,9 @@ void dri2_set_tex_buffer2(__DRIcontext *pDRICtx, GLint target, dri_get_buffers(drawable->dPriv); st_get_framebuffer_surface(drawable->stfb, ST_SURFACE_FRONT_LEFT, &ps); + if (!ps) + return; + st_bind_texture_surface(ps, target == GL_TEXTURE_2D ? ST_TEXTURE_2D : ST_TEXTURE_RECT, 0, drawable->color_format); } -- cgit v1.2.3 From 43750f1575e366e2a92b71bffceee90d7f1a2b3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Mon, 5 Oct 2009 12:31:51 +0200 Subject: Use _mesa_select_tex_image() rather than hardcoding face 0. Fixes crash loading a map in sauerbraten with hwmipmap 1 in ~/.sauerbraten/config.cfg. --- src/mesa/main/mipmap.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 4d3e62572d..c3928fa513 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1501,8 +1501,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, GLuint comps; ASSERT(texObj); - /* XXX choose cube map face here??? */ - srcImage = texObj->Image[0][texObj->BaseLevel]; + srcImage = _mesa_select_tex_image(ctx, texObj, target, texObj->BaseLevel); ASSERT(srcImage); maxLevels = _mesa_max_texture_levels(ctx, texObj->Target); -- cgit v1.2.3 From 0b032eabc77d0e28fc0746cbd8ffb94859fd130d Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Mon, 5 Oct 2009 12:53:40 +0300 Subject: r600: update vertex program selection for draw path --- src/mesa/drivers/dri/r600/r700_vertprog.c | 40 +++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c index e7a209be9d..d12c39c9f7 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.c +++ b/src/mesa/drivers/dri/r600/r700_vertprog.c @@ -319,8 +319,10 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, _mesa_insert_mvp_code(ctx, vp->mesa_program); } - for(i=0; imesa_program->Base.InputsRead & unBit) /* ctx->Array.ArrayObj->xxxxxxx */ { @@ -328,7 +330,17 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, vp->aos_desc[i].stride = vb->AttribPtr[i]->size * sizeof(GL_FLOAT);/* when emit array, data is packed. vb->AttribPtr[i]->stride;*/ vp->aos_desc[i].type = GL_FLOAT; } + } } + else + { + for(i=0; inNumActiveAos; i++) + { + vp->aos_desc[i].size = context->stream_desc[i].size; + vp->aos_desc[i].stride = context->stream_desc[i].stride; + vp->aos_desc[i].type = context->stream_desc[i].type; + } + } if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) { @@ -388,17 +400,35 @@ void r700SelectVertexShader(GLcontext *ctx, GLint nVersion) for (vp = vpc->progs; vp; vp = vp->next) { + if (vp->uiVersion != nVersion ) + continue; match = GL_TRUE; - for(i=0; iaos_desc[i].size != vb->AttribPtr[i]->size) - match = GL_FALSE; - break; + if (vp->aos_desc[i].size != vb->AttribPtr[i]->size) + { + match = GL_FALSE; + break; + } } + } } + else + { + for(i=0; inNumActiveAos; i++) + { + if (vp->aos_desc[i].size != context->stream_desc[i].size) + { + match = GL_FALSE; + break; + } + } + } if (match) { context->selected_vp = vp; -- cgit v1.2.3 From 6a085184ebf251f145181796e317ffa179a38bae Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 5 Oct 2009 15:46:47 +0100 Subject: util: add lost code to util_make_fragment_tex_shader_writemask() This got ported to ureg at some point, but lost the code that distinguishes it from regular util_make_fragment_tex_shader(). --- src/gallium/auxiliary/util/u_simple_shaders.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_simple_shaders.c b/src/gallium/auxiliary/util/u_simple_shaders.c index 0d706f9449..1c8b157d91 100644 --- a/src/gallium/auxiliary/util/u_simple_shaders.c +++ b/src/gallium/auxiliary/util/u_simple_shaders.c @@ -108,7 +108,15 @@ util_make_fragment_tex_shader_writemask(struct pipe_context *pipe, TGSI_SEMANTIC_COLOR, 0 ); - ureg_TEX( ureg, out, TGSI_TEXTURE_2D, tex, sampler ); + if (writemask != TGSI_WRITEMASK_XYZW) { + struct ureg_src imm = ureg_imm4f( ureg, 0, 0, 0, 1 ); + + ureg_MOV( ureg, out, imm ); + } + + ureg_TEX( ureg, + ureg_writemask(out, writemask), + TGSI_TEXTURE_2D, tex, sampler ); ureg_END( ureg ); return ureg_create_shader_and_destroy( ureg, pipe ); -- cgit v1.2.3 From b02ef740b90029bc40629e5b81270a8cf77101d3 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Mon, 5 Oct 2009 15:50:11 +0100 Subject: mesa/st: add ST_DEBUG environment variable At last it's possible to turn on tgsi dumps and other debugging in the state tracker without modifying sources... --- src/mesa/state_tracker/st_atom_constbuf.c | 3 ++- src/mesa/state_tracker/st_cb_accum.c | 11 ++++++++++ src/mesa/state_tracker/st_cb_drawpixels.c | 4 ++++ src/mesa/state_tracker/st_cb_readpixels.c | 4 ++++ src/mesa/state_tracker/st_cb_texture.c | 13 +++++++++++ src/mesa/state_tracker/st_context.c | 4 ++++ src/mesa/state_tracker/st_debug.c | 28 ++++++++++++++++++++++++ src/mesa/state_tracker/st_debug.h | 36 +++++++++++++++++++++++++++++++ src/mesa/state_tracker/st_gen_mipmap.c | 4 ++++ src/mesa/state_tracker/st_program.c | 20 +++++++++++------ 10 files changed, 119 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c index 5d4d8eee02..77153889b6 100644 --- a/src/mesa/state_tracker/st_atom_constbuf.c +++ b/src/mesa/state_tracker/st_atom_constbuf.c @@ -39,6 +39,7 @@ #include "pipe/p_defines.h" #include "pipe/p_inlines.h" +#include "st_debug.h" #include "st_context.h" #include "st_atom.h" #include "st_atom_constbuf.h" @@ -75,7 +76,7 @@ void st_upload_constants( struct st_context *st, PIPE_BUFFER_USAGE_CONSTANT, paramBytes ); - if (0) { + if (ST_DEBUG & DEBUG_CONSTANTS) { debug_printf("%s(shader=%d, numParams=%d, stateFlags=0x%x)\n", __FUNCTION__, shader_type, params->NumParameters, params->StateFlags); diff --git a/src/mesa/state_tracker/st_cb_accum.c b/src/mesa/state_tracker/st_cb_accum.c index 3d1d0f71d5..a6b9765452 100644 --- a/src/mesa/state_tracker/st_cb_accum.c +++ b/src/mesa/state_tracker/st_cb_accum.c @@ -34,6 +34,7 @@ #include "main/image.h" #include "main/macros.h" +#include "st_debug.h" #include "st_context.h" #include "st_cb_accum.h" #include "st_cb_fbo.h" @@ -136,6 +137,9 @@ accum_accum(struct st_context *st, GLfloat value, GLubyte *data = acc_strb->data; GLfloat *buf; + if (ST_DEBUG & DEBUG_FALLBACK) + debug_printf("%s: fallback processing\n", __FUNCTION__); + color_trans = st_cond_flush_get_tex_transfer(st, color_strb->texture, 0, 0, 0, PIPE_TRANSFER_READ, xpos, ypos, @@ -181,6 +185,10 @@ accum_load(struct st_context *st, GLfloat value, GLubyte *data = acc_strb->data; GLfloat *buf; + + if (ST_DEBUG & DEBUG_FALLBACK) + debug_printf("%s: fallback processing\n", __FUNCTION__); + color_trans = st_cond_flush_get_tex_transfer(st, color_strb->texture, 0, 0, 0, PIPE_TRANSFER_READ, xpos, ypos, @@ -228,6 +236,9 @@ accum_return(GLcontext *ctx, GLfloat value, const GLubyte *data = acc_strb->data; GLfloat *buf; + if (ST_DEBUG & DEBUG_FALLBACK) + debug_printf("%s: fallback processing\n", __FUNCTION__); + buf = (GLfloat *) _mesa_malloc(width * height * 4 * sizeof(GLfloat)); if (!colormask[0] || !colormask[1] || !colormask[2] || !colormask[3]) diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 99f3ba678b..91fc9f98f7 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -40,6 +40,7 @@ #include "shader/prog_parameter.h" #include "shader/prog_print.h" +#include "st_debug.h" #include "st_context.h" #include "st_atom.h" #include "st_atom_constbuf.h" @@ -1090,6 +1091,9 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, struct pipe_transfer *ptTex; enum pipe_transfer_usage transfer_usage; + if (ST_DEBUG & DEBUG_FALLBACK) + debug_printf("%s: fallback processing\n", __FUNCTION__); + if (type == GL_DEPTH && pf_is_depth_and_stencil(pt->format)) transfer_usage = PIPE_TRANSFER_READ_WRITE; else diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 75424aa2e7..772bb3bb69 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -43,6 +43,7 @@ #include "pipe/p_inlines.h" #include "util/u_tile.h" +#include "st_debug.h" #include "st_context.h" #include "st_cb_bitmap.h" #include "st_cb_readpixels.h" @@ -416,6 +417,9 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, yStep = 1; } + if (ST_DEBUG & DEBUG_FALLBACK) + debug_printf("%s: fallback processing\n", __FUNCTION__); + /* * Copy pixels from pipe_transfer to user memory */ diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 9a634bb930..b943787106 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -43,6 +43,7 @@ #include "main/texobj.h" #include "main/texstore.h" +#include "state_tracker/st_debug.h" #include "state_tracker/st_context.h" #include "state_tracker/st_cb_fbo.h" #include "state_tracker/st_cb_texture.h" @@ -903,6 +904,9 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level, GLvoid *dest = _mesa_image_address2d(&ctx->Pack, pixels, width, height, format, type, row, 0); + if (ST_DEBUG & DEBUG_FALLBACK) + debug_printf("%s: fallback format translation\n", __FUNCTION__); + /* get float[4] rgba row from surface */ pipe_get_tile_rgba(tex_xfer, 0, row, width, 1, rgba); @@ -1294,6 +1298,9 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, struct pipe_transfer *src_trans; GLvoid *texDest; enum pipe_transfer_usage transfer_usage; + + if (ST_DEBUG & DEBUG_FALLBACK) + debug_printf("%s: fallback processing\n", __FUNCTION__); assert(width <= MAX_WIDTH); @@ -1419,6 +1426,12 @@ compatible_src_dst_formats(const struct gl_renderbuffer *src, return TGSI_WRITEMASK_XYZ; /* A ==> 1.0 */ } else { + if (ST_DEBUG & DEBUG_FALLBACK) + debug_printf("%s failed for src %s, dst %s\n", + __FUNCTION__, + _mesa_lookup_enum_by_nr(srcFormat), + _mesa_lookup_enum_by_nr(dstLogicalFormat)); + /* Otherwise fail. */ return 0; diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 96969c736c..f0eddafd33 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -36,6 +36,7 @@ #include "shader/shader_api.h" #include "glapi/glapi.h" #include "st_public.h" +#include "st_debug.h" #include "st_context.h" #include "st_cb_accum.h" #include "st_cb_bitmap.h" @@ -113,6 +114,9 @@ st_create_context_priv( GLcontext *ctx, struct pipe_context *pipe ) st->ctx = ctx; st->pipe = pipe; + /* XXX: this is one-off, per-screen init: */ + st_debug_init(); + /* state tracker needs the VBO module */ _vbo_CreateContext(ctx); diff --git a/src/mesa/state_tracker/st_debug.c b/src/mesa/state_tracker/st_debug.c index c7d26ce33c..3009cde9d5 100644 --- a/src/mesa/state_tracker/st_debug.c +++ b/src/mesa/state_tracker/st_debug.c @@ -41,6 +41,32 @@ +#ifdef DEBUG +int ST_DEBUG = 0; + +static const struct debug_named_value st_debug_flags[] = { + { "mesa", DEBUG_MESA }, + { "tgsi", DEBUG_TGSI }, + { "pipe", DEBUG_PIPE }, + { "tex", DEBUG_TEX }, + { "fallback", DEBUG_FALLBACK }, + { "screen", DEBUG_SCREEN }, + { "query", DEBUG_QUERY }, + {NULL, 0} +}; +#endif + + +void +st_debug_init(void) +{ +#ifdef DEBUG + ST_DEBUG = debug_get_flags_option("ST_DEBUG", st_debug_flags, 0 ); +#endif +} + + + /** * Print current state. May be called from inside gdb to see currently * bound vertex/fragment shaders and associated constants. @@ -68,3 +94,5 @@ st_print_current(void) if (st->fp->Base.Base.Parameters) _mesa_print_parameter_list(st->fp->Base.Base.Parameters); } + + diff --git a/src/mesa/state_tracker/st_debug.h b/src/mesa/state_tracker/st_debug.h index 49d752e1b2..4a060d7759 100644 --- a/src/mesa/state_tracker/st_debug.h +++ b/src/mesa/state_tracker/st_debug.h @@ -29,8 +29,44 @@ #ifndef ST_DEBUG_H #define ST_DEBUG_H +#include "pipe/p_compiler.h" +#include "util/u_debug.h" + extern void st_print_current(void); +#define DEBUG_MESA 0x1 +#define DEBUG_TGSI 0x2 +#define DEBUG_CONSTANTS 0x4 +#define DEBUG_PIPE 0x8 +#define DEBUG_TEX 0x10 +#define DEBUG_FALLBACK 0x20 +#define DEBUG_QUERY 0x40 +#define DEBUG_SCREEN 0x80 + +#ifdef DEBUG +extern int ST_DEBUG; +#define DBSTR(x) x +#else +#define ST_DEBUG 0 +#define DBSTR(x) "" +#endif + +void st_debug_init( void ); + +static INLINE void +ST_DBG( unsigned flag, const char *fmt, ... ) +{ + if (ST_DEBUG & flag) + { + va_list args; + + va_start( args, fmt ); + debug_vprintf( fmt, args ); + va_end( args ); + } +} + + #endif /* ST_DEBUG_H */ diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index f75b2348b8..16ca2771b0 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -42,6 +42,7 @@ #include "cso_cache/cso_cache.h" #include "cso_cache/cso_context.h" +#include "st_debug.h" #include "st_context.h" #include "st_draw.h" #include "st_gen_mipmap.h" @@ -113,6 +114,9 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, uint dstLevel; GLenum datatype; GLuint comps; + + if (ST_DEBUG & DEBUG_FALLBACK) + debug_printf("%s: fallback processing\n", __FUNCTION__); assert(target != GL_TEXTURE_3D); /* not done yet */ diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 927f60cc7e..a9be80ce8f 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -42,6 +42,7 @@ #include "draw/draw_context.h" #include "tgsi/tgsi_dump.h" +#include "st_debug.h" #include "st_context.h" #include "st_atom.h" #include "st_program.h" @@ -49,9 +50,6 @@ #include "cso_cache/cso_context.h" -#define TGSI_DEBUG 0 - - /** * Translate a Mesa vertex shader into a TGSI shader. * \param outputMapping to map vertex program output registers (VERT_RESULT_x) @@ -346,11 +344,15 @@ st_translate_vertex_program(struct st_context *st, stvp->num_inputs = vs_num_inputs; stvp->driver_shader = pipe->create_vs_state(pipe, &stvp->state); - if (0) + if ((ST_DEBUG & DEBUG_TGSI) && (ST_DEBUG & DEBUG_MESA)) { _mesa_print_program(&stvp->Base.Base); + debug_printf("\n"); + } - if (TGSI_DEBUG) + if (ST_DEBUG & DEBUG_TGSI) { tgsi_dump( stvp->state.tokens, 0 ); + debug_printf("\n"); + } } @@ -526,11 +528,15 @@ st_translate_fragment_program(struct st_context *st, stfp->driver_shader = pipe->create_fs_state(pipe, &stfp->state); - if (0) + if ((ST_DEBUG & DEBUG_TGSI) && (ST_DEBUG & DEBUG_MESA)) { _mesa_print_program(&stfp->Base.Base); + debug_printf("\n"); + } - if (TGSI_DEBUG) + if (ST_DEBUG & DEBUG_TGSI) { tgsi_dump( stfp->state.tokens, 0/*TGSI_DUMP_VERBOSE*/ ); + debug_printf("\n"); + } } -- cgit v1.2.3 From 75e0a376cd32b127f3168c0af12992b5c8576e92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Mon, 5 Oct 2009 11:05:34 +0100 Subject: mesa: Copy textures' base format into wrapper renderbuffer. Otherwise st_copy_texsubimage will fallback to software blit due to inconsistent base formats. --- src/mesa/state_tracker/st_cb_fbo.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index fe0a121493..a049520901 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -383,6 +383,7 @@ st_render_texture(GLcontext *ctx, rb->Width = texImage->Width2; rb->Height = texImage->Height2; + rb->_BaseFormat = texImage->_BaseFormat; /*printf("***** render to texture level %d: %d x %d\n", att->TextureLevel, rb->Width, rb->Height);*/ /*printf("***** pipe texture %d x %d\n", pt->width[0], pt->height[0]);*/ -- cgit v1.2.3 From 6971be783b970f882e873fa40e2dccde4137201f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Mon, 5 Oct 2009 16:45:38 +0100 Subject: util: Improve the cpuid assembly. No need to save ebx on 64bit. Use just xchgl. Refer to gcc's cpuid.h header. Thanks to Uros Bizjak for pointing this out. --- src/gallium/auxiliary/util/u_cpu_detect.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c index e26214cb91..70ce25cfcf 100644 --- a/src/gallium/auxiliary/util/u_cpu_detect.c +++ b/src/gallium/auxiliary/util/u_cpu_detect.c @@ -73,7 +73,7 @@ struct util_cpu_caps util_cpu_caps; static int has_cpuid(void); -static int cpuid(unsigned int ax, unsigned int *p); +static int cpuid(uint32_t ax, uint32_t *p); #if defined(PIPE_ARCH_X86) @@ -331,18 +331,22 @@ static int has_cpuid(void) #endif } + +/** + * @sa cpuid.h included in gcc-4.3 onwards. + */ static INLINE int -cpuid(unsigned int ax, unsigned int *p) +cpuid(uint32_t ax, uint32_t *p) { int ret = -1; #if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86) __asm __volatile ( - "movl %%ebx, %%esi\n\t" + "xchgl %%ebx, %1\n\t" "cpuid\n\t" - "xchgl %%ebx, %%esi" + "xchgl %%ebx, %1" : "=a" (p[0]), - "=S" (p[1]), + "=m" (p[1]), "=c" (p[2]), "=d" (p[3]) : "0" (ax) @@ -350,11 +354,9 @@ cpuid(unsigned int ax, unsigned int *p) ret = 0; #elif defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64) __asm __volatile ( - "movq %%rbx, %%rsi\n\t" "cpuid\n\t" - "xchgq %%rbx, %%rsi" : "=a" (p[0]), - "=S" (p[1]), + "=b" (p[1]), "=c" (p[2]), "=d" (p[3]) : "0" (ax) @@ -418,8 +420,8 @@ util_cpu_detect(void) #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) if (has_cpuid()) { - unsigned int regs[4]; - unsigned int regs2[4]; + uint32_t regs[4]; + uint32_t regs2[4]; util_cpu_caps.cacheline = 32; -- cgit v1.2.3 From a8768bbc9de1441384cecc147d51c9ee6431b924 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 5 Oct 2009 11:10:31 -0600 Subject: mesa: fix return value when clipping {Read,Draw}Pixels height <= 0 Signed-off-by: Ben Skeggs (cherry picked from master, commit 7aeaca33c331f70d507fc83583b13b8d9fc3e847) --- src/mesa/main/image.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index baecbab0a3..139e56a96b 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -5511,7 +5511,7 @@ _mesa_clip_drawpixels(const GLcontext *ctx, } if (*height <= 0) - return GL_TRUE; + return GL_FALSE; return GL_TRUE; } @@ -5564,7 +5564,7 @@ _mesa_clip_readpixels(const GLcontext *ctx, *height -= (*srcY + *height - buffer->Height); if (*height <= 0) - return GL_TRUE; + return GL_FALSE; return GL_TRUE; } -- cgit v1.2.3 From 1f39d59a2996e2acf6893a8dd1a0293bd8790cc2 Mon Sep 17 00:00:00 2001 From: Joakim Sindholt Date: Mon, 5 Oct 2009 19:25:04 +0200 Subject: r300g: fix scons build So I didn't touch r300compiler, but r300g now compiles after having declarations and code untangled. As nha so gently points out, we shouldn't have to do this just to comply with MSVC compilers. --- src/gallium/drivers/r300/SConscript | 7 ++++++- src/gallium/drivers/r300/r300_debug.c | 7 ++++--- src/gallium/drivers/r300/r300_tgsi_to_rc.c | 7 ++++--- src/gallium/drivers/r300/r300_vs.c | 6 +++--- src/mesa/drivers/dri/r300/compiler/SConscript | 30 +++++++++++++++++++++++++++ 5 files changed, 47 insertions(+), 10 deletions(-) create mode 100755 src/mesa/drivers/dri/r300/compiler/SConscript (limited to 'src') diff --git a/src/gallium/drivers/r300/SConscript b/src/gallium/drivers/r300/SConscript index 493d7b28bc..b4c8ba2015 100644 --- a/src/gallium/drivers/r300/SConscript +++ b/src/gallium/drivers/r300/SConscript @@ -1,6 +1,10 @@ Import('*') +r300compiler = SConscript('#/src/mesa/drivers/dri/r300/compiler/SConscript') + env = env.Clone() +# add the paths for r300compiler +env.Append(CPPPATH = ['#/src/mesa/drivers/dri/r300/compiler', '#/include', '#/src/mesa']) r300 = env.ConvenienceLibrary( target = 'r300', @@ -23,7 +27,8 @@ r300 = env.ConvenienceLibrary( 'r300_vs.c', 'r300_surface.c', 'r300_texture.c', - ]) + 'r300_tgsi_to_rc.c', + ] + r300compiler) + r300compiler Export('r300') diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c index 15308dda1d..85d69c0747 100644 --- a/src/gallium/drivers/r300/r300_debug.c +++ b/src/gallium/drivers/r300/r300_debug.c @@ -48,6 +48,8 @@ void r300_init_debug(struct r300_context * ctx) { const char * options = debug_get_option("RADEON_DEBUG", 0); boolean printhint = false; + size_t length; + struct debug_option * opt; if (options) { while(*options) { @@ -56,8 +58,7 @@ void r300_init_debug(struct r300_context * ctx) continue; } - size_t length = strcspn(options, " ,"); - struct debug_option * opt; + length = strcspn(options, " ,"); for(opt = debug_options; opt->name; ++opt) { if (!strncmp(options, opt->name, length)) { @@ -81,7 +82,7 @@ void r300_init_debug(struct r300_context * ctx) if (printhint || ctx->debug & DBG_HELP) { debug_printf("You can enable debug output by setting the RADEON_DEBUG environment variable\n" "to a comma-separated list of debug options. Available options are:\n"); - for(struct debug_option * opt = debug_options; opt->name; ++opt) { + for(opt = debug_options; opt->name; ++opt) { debug_printf(" %s: %s\n", opt->name, opt->description); } } diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/src/gallium/drivers/r300/r300_tgsi_to_rc.c index 0913ca1bd5..4534a6dd80 100644 --- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c +++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c @@ -257,12 +257,13 @@ static void transform_texture(struct rc_instruction * dst, struct tgsi_instructi static void transform_instruction(struct tgsi_to_rc * ttr, struct tgsi_full_instruction * src) { + struct rc_instruction * dst; + int i; + if (src->Instruction.Opcode == TGSI_OPCODE_END) return; - struct rc_instruction * dst = rc_insert_new_instruction(ttr->compiler, ttr->compiler->Program.Instructions.Prev); - int i; - + dst = rc_insert_new_instruction(ttr->compiler, ttr->compiler->Program.Instructions.Prev); dst->I.Opcode = translate_opcode(src->Instruction.Opcode); dst->I.SaturateMode = translate_saturate(src->Instruction.Saturate); diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c index 12a6e37be6..8460cfaf51 100644 --- a/src/gallium/drivers/r300/r300_vs.c +++ b/src/gallium/drivers/r300/r300_vs.c @@ -35,6 +35,8 @@ static void set_vertex_inputs_outputs(struct r300_vertex_program_compiler * c) { struct r300_vertex_shader * vs = c->UserData; struct tgsi_shader_info* info = &vs->info; + struct tgsi_parse_context parser; + struct tgsi_full_declaration * decl; boolean pointsize = false; int out_colors = 0; int colors = 0; @@ -62,8 +64,6 @@ static void set_vertex_inputs_outputs(struct r300_vertex_program_compiler * c) } } - struct tgsi_parse_context parser; - tgsi_parse_init(&parser, vs->state.tokens); while (!tgsi_parse_end_of_tokens(&parser)) { @@ -72,7 +72,7 @@ static void set_vertex_inputs_outputs(struct r300_vertex_program_compiler * c) if (parser.FullToken.Token.Type != TGSI_TOKEN_TYPE_DECLARATION) continue; - struct tgsi_full_declaration * decl = &parser.FullToken.FullDeclaration; + decl = &parser.FullToken.FullDeclaration; if (decl->Declaration.File != TGSI_FILE_OUTPUT) continue; diff --git a/src/mesa/drivers/dri/r300/compiler/SConscript b/src/mesa/drivers/dri/r300/compiler/SConscript new file mode 100755 index 0000000000..48fd65fb71 --- /dev/null +++ b/src/mesa/drivers/dri/r300/compiler/SConscript @@ -0,0 +1,30 @@ +Import('*') + +env = env.Clone() +env.Append(CPPPATH = '#/include') +env.Append(CPPPATH = '#/src/mesa') + +# temporary fix +env['CFLAGS'] = str(env['CFLAGS']).replace('-Werror=declaration-after-statement', '') + +r300compiler = env.ConvenienceLibrary( + target = 'r300compiler', + source = [ + 'radeon_code.c', + 'radeon_compiler.c', + 'radeon_nqssadce.c', + 'radeon_program.c', + 'radeon_program_alu.c', + 'radeon_program_pair.c', + 'r3xx_fragprog.c', + 'r300_fragprog.c', + 'r300_fragprog_swizzle.c', + 'r300_fragprog_emit.c', + 'r500_fragprog.c', + 'r500_fragprog_emit.c', + 'r3xx_vertprog.c', + 'r3xx_vertprog_dump.c', + 'memory_pool.c', + ]) + +Return('r300compiler') -- cgit v1.2.3 From c4b821a4c64d75d944653d665bede946763ed95b Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 29 Sep 2009 10:22:15 -0700 Subject: i965g: Drop i965simple The driver never work with real hardware and has bitrotted for quite some time now, might as well drop it. If somebody wants to look at it just use git. --- src/gallium/drivers/i965simple/Makefile | 52 - src/gallium/drivers/i965simple/SConscript | 54 - src/gallium/drivers/i965simple/brw_batch.h | 59 - src/gallium/drivers/i965simple/brw_blit.c | 218 ---- src/gallium/drivers/i965simple/brw_blit.h | 33 - src/gallium/drivers/i965simple/brw_cc.c | 269 ---- src/gallium/drivers/i965simple/brw_clip.c | 206 --- src/gallium/drivers/i965simple/brw_clip.h | 170 --- src/gallium/drivers/i965simple/brw_clip_line.c | 245 ---- src/gallium/drivers/i965simple/brw_clip_point.c | 47 - src/gallium/drivers/i965simple/brw_clip_state.c | 93 -- src/gallium/drivers/i965simple/brw_clip_tri.c | 566 -------- src/gallium/drivers/i965simple/brw_clip_unfilled.c | 477 ------- src/gallium/drivers/i965simple/brw_clip_util.c | 351 ----- src/gallium/drivers/i965simple/brw_context.c | 139 -- src/gallium/drivers/i965simple/brw_context.h | 684 ---------- src/gallium/drivers/i965simple/brw_curbe.c | 369 ------ src/gallium/drivers/i965simple/brw_defines.h | 870 ------------- src/gallium/drivers/i965simple/brw_draw.c | 226 ---- src/gallium/drivers/i965simple/brw_draw.h | 55 - src/gallium/drivers/i965simple/brw_draw_upload.c | 300 ----- src/gallium/drivers/i965simple/brw_eu.c | 130 -- src/gallium/drivers/i965simple/brw_eu.h | 888 ------------- src/gallium/drivers/i965simple/brw_eu_debug.c | 90 -- src/gallium/drivers/i965simple/brw_eu_emit.c | 1080 ---------------- src/gallium/drivers/i965simple/brw_eu_util.c | 126 -- src/gallium/drivers/i965simple/brw_flush.c | 73 -- src/gallium/drivers/i965simple/brw_gs.c | 196 --- src/gallium/drivers/i965simple/brw_gs.h | 75 -- src/gallium/drivers/i965simple/brw_gs_emit.c | 148 --- src/gallium/drivers/i965simple/brw_gs_state.c | 90 -- src/gallium/drivers/i965simple/brw_misc_state.c | 488 ------- src/gallium/drivers/i965simple/brw_reg.h | 76 -- src/gallium/drivers/i965simple/brw_screen.c | 244 ---- src/gallium/drivers/i965simple/brw_screen.h | 68 - src/gallium/drivers/i965simple/brw_sf.c | 351 ----- src/gallium/drivers/i965simple/brw_sf.h | 122 -- src/gallium/drivers/i965simple/brw_sf_emit.c | 382 ------ src/gallium/drivers/i965simple/brw_sf_state.c | 181 --- src/gallium/drivers/i965simple/brw_shader_info.c | 48 - src/gallium/drivers/i965simple/brw_state.c | 469 ------- src/gallium/drivers/i965simple/brw_state.h | 151 --- src/gallium/drivers/i965simple/brw_state_batch.c | 113 -- src/gallium/drivers/i965simple/brw_state_cache.c | 443 ------- src/gallium/drivers/i965simple/brw_state_pool.c | 138 -- src/gallium/drivers/i965simple/brw_state_upload.c | 202 --- src/gallium/drivers/i965simple/brw_structs.h | 1348 -------------------- src/gallium/drivers/i965simple/brw_surface.c | 126 -- src/gallium/drivers/i965simple/brw_tex_layout.c | 380 ------ src/gallium/drivers/i965simple/brw_tex_layout.h | 44 - src/gallium/drivers/i965simple/brw_urb.c | 186 --- src/gallium/drivers/i965simple/brw_util.c | 104 -- src/gallium/drivers/i965simple/brw_util.h | 43 - src/gallium/drivers/i965simple/brw_vs.c | 120 -- src/gallium/drivers/i965simple/brw_vs.h | 82 -- src/gallium/drivers/i965simple/brw_vs_emit.c | 1330 ------------------- src/gallium/drivers/i965simple/brw_vs_state.c | 103 -- src/gallium/drivers/i965simple/brw_winsys.h | 209 --- src/gallium/drivers/i965simple/brw_wm.c | 209 --- src/gallium/drivers/i965simple/brw_wm.h | 142 --- src/gallium/drivers/i965simple/brw_wm_decl.c | 392 ------ src/gallium/drivers/i965simple/brw_wm_glsl.c | 1076 ---------------- src/gallium/drivers/i965simple/brw_wm_iz.c | 214 ---- .../drivers/i965simple/brw_wm_sampler_state.c | 275 ---- src/gallium/drivers/i965simple/brw_wm_state.c | 195 --- .../drivers/i965simple/brw_wm_surface_state.c | 305 ----- src/gallium/winsys/xlib/SConscript | 9 - src/gallium/winsys/xlib/xlib.c | 9 - src/gallium/winsys/xlib/xlib.h | 1 - src/gallium/winsys/xlib/xlib_brw.h | 30 - src/gallium/winsys/xlib/xlib_brw_aub.c | 399 ------ src/gallium/winsys/xlib/xlib_brw_aub.h | 114 -- src/gallium/winsys/xlib/xlib_brw_context.c | 209 --- src/gallium/winsys/xlib/xlib_brw_screen.c | 469 ------- 74 files changed, 19978 deletions(-) delete mode 100644 src/gallium/drivers/i965simple/Makefile delete mode 100644 src/gallium/drivers/i965simple/SConscript delete mode 100644 src/gallium/drivers/i965simple/brw_batch.h delete mode 100644 src/gallium/drivers/i965simple/brw_blit.c delete mode 100644 src/gallium/drivers/i965simple/brw_blit.h delete mode 100644 src/gallium/drivers/i965simple/brw_cc.c delete mode 100644 src/gallium/drivers/i965simple/brw_clip.c delete mode 100644 src/gallium/drivers/i965simple/brw_clip.h delete mode 100644 src/gallium/drivers/i965simple/brw_clip_line.c delete mode 100644 src/gallium/drivers/i965simple/brw_clip_point.c delete mode 100644 src/gallium/drivers/i965simple/brw_clip_state.c delete mode 100644 src/gallium/drivers/i965simple/brw_clip_tri.c delete mode 100644 src/gallium/drivers/i965simple/brw_clip_unfilled.c delete mode 100644 src/gallium/drivers/i965simple/brw_clip_util.c delete mode 100644 src/gallium/drivers/i965simple/brw_context.c delete mode 100644 src/gallium/drivers/i965simple/brw_context.h delete mode 100644 src/gallium/drivers/i965simple/brw_curbe.c delete mode 100644 src/gallium/drivers/i965simple/brw_defines.h delete mode 100644 src/gallium/drivers/i965simple/brw_draw.c delete mode 100644 src/gallium/drivers/i965simple/brw_draw.h delete mode 100644 src/gallium/drivers/i965simple/brw_draw_upload.c delete mode 100644 src/gallium/drivers/i965simple/brw_eu.c delete mode 100644 src/gallium/drivers/i965simple/brw_eu.h delete mode 100644 src/gallium/drivers/i965simple/brw_eu_debug.c delete mode 100644 src/gallium/drivers/i965simple/brw_eu_emit.c delete mode 100644 src/gallium/drivers/i965simple/brw_eu_util.c delete mode 100644 src/gallium/drivers/i965simple/brw_flush.c delete mode 100644 src/gallium/drivers/i965simple/brw_gs.c delete mode 100644 src/gallium/drivers/i965simple/brw_gs.h delete mode 100644 src/gallium/drivers/i965simple/brw_gs_emit.c delete mode 100644 src/gallium/drivers/i965simple/brw_gs_state.c delete mode 100644 src/gallium/drivers/i965simple/brw_misc_state.c delete mode 100644 src/gallium/drivers/i965simple/brw_reg.h delete mode 100644 src/gallium/drivers/i965simple/brw_screen.c delete mode 100644 src/gallium/drivers/i965simple/brw_screen.h delete mode 100644 src/gallium/drivers/i965simple/brw_sf.c delete mode 100644 src/gallium/drivers/i965simple/brw_sf.h delete mode 100644 src/gallium/drivers/i965simple/brw_sf_emit.c delete mode 100644 src/gallium/drivers/i965simple/brw_sf_state.c delete mode 100644 src/gallium/drivers/i965simple/brw_shader_info.c delete mode 100644 src/gallium/drivers/i965simple/brw_state.c delete mode 100644 src/gallium/drivers/i965simple/brw_state.h delete mode 100644 src/gallium/drivers/i965simple/brw_state_batch.c delete mode 100644 src/gallium/drivers/i965simple/brw_state_cache.c delete mode 100644 src/gallium/drivers/i965simple/brw_state_pool.c delete mode 100644 src/gallium/drivers/i965simple/brw_state_upload.c delete mode 100644 src/gallium/drivers/i965simple/brw_structs.h delete mode 100644 src/gallium/drivers/i965simple/brw_surface.c delete mode 100644 src/gallium/drivers/i965simple/brw_tex_layout.c delete mode 100644 src/gallium/drivers/i965simple/brw_tex_layout.h delete mode 100644 src/gallium/drivers/i965simple/brw_urb.c delete mode 100644 src/gallium/drivers/i965simple/brw_util.c delete mode 100644 src/gallium/drivers/i965simple/brw_util.h delete mode 100644 src/gallium/drivers/i965simple/brw_vs.c delete mode 100644 src/gallium/drivers/i965simple/brw_vs.h delete mode 100644 src/gallium/drivers/i965simple/brw_vs_emit.c delete mode 100644 src/gallium/drivers/i965simple/brw_vs_state.c delete mode 100644 src/gallium/drivers/i965simple/brw_winsys.h delete mode 100644 src/gallium/drivers/i965simple/brw_wm.c delete mode 100644 src/gallium/drivers/i965simple/brw_wm.h delete mode 100644 src/gallium/drivers/i965simple/brw_wm_decl.c delete mode 100644 src/gallium/drivers/i965simple/brw_wm_glsl.c delete mode 100644 src/gallium/drivers/i965simple/brw_wm_iz.c delete mode 100644 src/gallium/drivers/i965simple/brw_wm_sampler_state.c delete mode 100644 src/gallium/drivers/i965simple/brw_wm_state.c delete mode 100644 src/gallium/drivers/i965simple/brw_wm_surface_state.c delete mode 100644 src/gallium/winsys/xlib/xlib_brw.h delete mode 100644 src/gallium/winsys/xlib/xlib_brw_aub.c delete mode 100644 src/gallium/winsys/xlib/xlib_brw_aub.h delete mode 100644 src/gallium/winsys/xlib/xlib_brw_context.c delete mode 100644 src/gallium/winsys/xlib/xlib_brw_screen.c (limited to 'src') diff --git a/src/gallium/drivers/i965simple/Makefile b/src/gallium/drivers/i965simple/Makefile deleted file mode 100644 index 19182afa75..0000000000 --- a/src/gallium/drivers/i965simple/Makefile +++ /dev/null @@ -1,52 +0,0 @@ -TOP = ../../../.. -include $(TOP)/configs/current - -LIBNAME = i965simple - -C_SOURCES = \ - brw_blit.c \ - brw_flush.c \ - brw_screen.c \ - brw_surface.c \ - brw_cc.c \ - brw_clip.c \ - brw_clip_line.c \ - brw_clip_point.c \ - brw_clip_state.c \ - brw_clip_tri.c \ - brw_clip_util.c \ - brw_context.c \ - brw_curbe.c \ - brw_draw.c \ - brw_draw_upload.c \ - brw_eu.c \ - brw_eu_debug.c \ - brw_eu_emit.c \ - brw_eu_util.c \ - brw_gs.c \ - brw_gs_emit.c \ - brw_gs_state.c \ - brw_misc_state.c \ - brw_sf.c \ - brw_sf_emit.c \ - brw_sf_state.c \ - brw_state.c \ - brw_state_batch.c \ - brw_state_cache.c \ - brw_state_pool.c \ - brw_state_upload.c \ - brw_tex_layout.c \ - brw_urb.c \ - brw_util.c \ - brw_vs.c \ - brw_vs_emit.c \ - brw_vs_state.c \ - brw_wm.c \ - brw_wm_iz.c \ - brw_wm_decl.c \ - brw_wm_glsl.c \ - brw_wm_sampler_state.c \ - brw_wm_state.c \ - brw_wm_surface_state.c - -include ../../Makefile.template diff --git a/src/gallium/drivers/i965simple/SConscript b/src/gallium/drivers/i965simple/SConscript deleted file mode 100644 index 43fc2a4005..0000000000 --- a/src/gallium/drivers/i965simple/SConscript +++ /dev/null @@ -1,54 +0,0 @@ -Import('*') - -env = env.Clone() - -i965simple = env.ConvenienceLibrary( - target = 'i965simple', - source = [ - 'brw_blit.c', - 'brw_cc.c', - 'brw_clip.c', - 'brw_clip_line.c', - 'brw_clip_point.c', - 'brw_clip_state.c', - 'brw_clip_tri.c', - 'brw_clip_util.c', - 'brw_context.c', - 'brw_curbe.c', - 'brw_draw.c', - 'brw_draw_upload.c', - 'brw_eu.c', - 'brw_eu_debug.c', - 'brw_eu_emit.c', - 'brw_eu_util.c', - 'brw_flush.c', - 'brw_gs.c', - 'brw_gs_emit.c', - 'brw_gs_state.c', - 'brw_misc_state.c', - 'brw_screen.c', - 'brw_sf.c', - 'brw_sf_emit.c', - 'brw_sf_state.c', - 'brw_state.c', - 'brw_state_batch.c', - 'brw_state_cache.c', - 'brw_state_pool.c', - 'brw_state_upload.c', - 'brw_surface.c', - 'brw_tex_layout.c', - 'brw_urb.c', - 'brw_util.c', - 'brw_vs.c', - 'brw_vs_emit.c', - 'brw_vs_state.c', - 'brw_wm.c', - 'brw_wm_decl.c', - 'brw_wm_glsl.c', - 'brw_wm_iz.c', - 'brw_wm_sampler_state.c', - 'brw_wm_state.c', - 'brw_wm_surface_state.c', - ]) - -Export('i965simple') diff --git a/src/gallium/drivers/i965simple/brw_batch.h b/src/gallium/drivers/i965simple/brw_batch.h deleted file mode 100644 index 5f5932a488..0000000000 --- a/src/gallium/drivers/i965simple/brw_batch.h +++ /dev/null @@ -1,59 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef BRW_BATCH_H -#define BRW_BATCH_H - -#include "brw_winsys.h" - -#define BATCH_LOCALS - -#define INTEL_BATCH_NO_CLIPRECTS 0x1 -#define INTEL_BATCH_CLIPRECTS 0x2 - -#define BEGIN_BATCH( dwords, relocs ) \ - brw->winsys->batch_start(brw->winsys, dwords, relocs) - -#define OUT_BATCH( dword ) \ - brw->winsys->batch_dword(brw->winsys, dword) - -#define OUT_RELOC( buf, flags, delta ) \ - brw->winsys->batch_reloc(brw->winsys, buf, flags, delta) - -#define ADVANCE_BATCH() \ - brw->winsys->batch_end( brw->winsys ) - -/* XXX: this is bogus - need proper handling for out-of-memory in batchbuffer. - */ -#define FLUSH_BATCH(fence) do { \ - brw->winsys->batch_flush(brw->winsys, fence); \ - brw->hardware_dirty = ~0; \ -} while (0) - -#define BRW_BATCH_STRUCT(brw, s) brw_batchbuffer_data( brw->winsys, (s), sizeof(*(s))) - -#endif diff --git a/src/gallium/drivers/i965simple/brw_blit.c b/src/gallium/drivers/i965simple/brw_blit.c deleted file mode 100644 index 4d11f8d2ab..0000000000 --- a/src/gallium/drivers/i965simple/brw_blit.c +++ /dev/null @@ -1,218 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#include -#include - -#include "brw_batch.h" -#include "brw_blit.h" -#include "brw_context.h" -#include "brw_reg.h" - -#include "pipe/p_context.h" -#include "pipe/internal/p_winsys_screen.h" - -#define FILE_DEBUG_FLAG DEBUG_BLIT - -void brw_fill_blit(struct brw_context *brw, - unsigned cpp, - short dst_pitch, - struct pipe_buffer *dst_buffer, - unsigned dst_offset, - boolean dst_tiled, - short x, short y, - short w, short h, - unsigned color) -{ - unsigned BR13, CMD; - BATCH_LOCALS; - - dst_pitch *= cpp; - - switch(cpp) { - case 1: - case 2: - case 3: - BR13 = (0xF0 << 16) | (1<<24); - CMD = XY_COLOR_BLT_CMD; - break; - case 4: - BR13 = (0xF0 << 16) | (1<<24) | (1<<25); - CMD = XY_COLOR_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB; - break; - default: - return; - } - - if (dst_tiled) { - CMD |= XY_DST_TILED; - dst_pitch /= 4; - } - - BEGIN_BATCH(6, INTEL_BATCH_NO_CLIPRECTS); - OUT_BATCH( CMD ); - OUT_BATCH( dst_pitch | BR13 ); - OUT_BATCH( (y << 16) | x ); - OUT_BATCH( ((y+h) << 16) | (x+w) ); - OUT_RELOC( dst_buffer, BRW_BUFFER_ACCESS_WRITE, dst_offset ); - OUT_BATCH( color ); - ADVANCE_BATCH(); -} - -static unsigned translate_raster_op(unsigned logicop) -{ - switch(logicop) { - case PIPE_LOGICOP_CLEAR: return 0x00; - case PIPE_LOGICOP_AND: return 0x88; - case PIPE_LOGICOP_AND_REVERSE: return 0x44; - case PIPE_LOGICOP_COPY: return 0xCC; - case PIPE_LOGICOP_AND_INVERTED: return 0x22; - case PIPE_LOGICOP_NOOP: return 0xAA; - case PIPE_LOGICOP_XOR: return 0x66; - case PIPE_LOGICOP_OR: return 0xEE; - case PIPE_LOGICOP_NOR: return 0x11; - case PIPE_LOGICOP_EQUIV: return 0x99; - case PIPE_LOGICOP_INVERT: return 0x55; - case PIPE_LOGICOP_OR_REVERSE: return 0xDD; - case PIPE_LOGICOP_COPY_INVERTED: return 0x33; - case PIPE_LOGICOP_OR_INVERTED: return 0xBB; - case PIPE_LOGICOP_NAND: return 0x77; - case PIPE_LOGICOP_SET: return 0xFF; - default: return 0; - } -} - - -/* Copy BitBlt - */ -void brw_copy_blit(struct brw_context *brw, - unsigned do_flip, - unsigned cpp, - short src_pitch, - struct pipe_buffer *src_buffer, - unsigned src_offset, - boolean src_tiled, - short dst_pitch, - struct pipe_buffer *dst_buffer, - unsigned dst_offset, - boolean dst_tiled, - short src_x, short src_y, - short dst_x, short dst_y, - short w, short h, - unsigned logic_op) -{ - unsigned CMD, BR13; - int dst_y2 = dst_y + h; - int dst_x2 = dst_x + w; - BATCH_LOCALS; - - - DBG("%s src:buf(%d)/%d %d,%d dst:buf(%d)/%d %d,%d sz:%dx%d op:%d\n", - __FUNCTION__, - src_buffer, src_pitch, src_x, src_y, - dst_buffer, dst_pitch, dst_x, dst_y, - w,h,logic_op); - - assert( logic_op - PIPE_LOGICOP_CLEAR >= 0 ); - assert( logic_op - PIPE_LOGICOP_CLEAR < 0x10 ); - - src_pitch *= cpp; - dst_pitch *= cpp; - - switch(cpp) { - case 1: - case 2: - case 3: - BR13 = (translate_raster_op(logic_op) << 16) | (1<<24); - CMD = XY_SRC_COPY_BLT_CMD; - break; - case 4: - BR13 = (translate_raster_op(logic_op) << 16) | (1<<24) | - (1<<25); - CMD = XY_SRC_COPY_BLT_CMD | XY_BLT_WRITE_ALPHA | XY_BLT_WRITE_RGB; - break; - default: - return; - } - - if (src_tiled) { - CMD |= XY_SRC_TILED; - src_pitch /= 4; - } - - if (dst_tiled) { - CMD |= XY_DST_TILED; - dst_pitch /= 4; - } - - if (dst_y2 < dst_y || - dst_x2 < dst_x) { - return; - } - - dst_pitch &= 0xffff; - src_pitch &= 0xffff; - - /* Initial y values don't seem to work with negative pitches. If - * we adjust the offsets manually (below), it seems to work fine. - * - * On the other hand, if we always adjust, the hardware doesn't - * know which blit directions to use, so overlapping copypixels get - * the wrong result. - */ - if (dst_pitch > 0 && src_pitch > 0) { - BEGIN_BATCH(8, INTEL_BATCH_NO_CLIPRECTS); - OUT_BATCH( CMD ); - OUT_BATCH( dst_pitch | BR13 ); - OUT_BATCH( (dst_y << 16) | dst_x ); - OUT_BATCH( (dst_y2 << 16) | dst_x2 ); - OUT_RELOC( dst_buffer, BRW_BUFFER_ACCESS_WRITE, - dst_offset ); - OUT_BATCH( (src_y << 16) | src_x ); - OUT_BATCH( src_pitch ); - OUT_RELOC( src_buffer, BRW_BUFFER_ACCESS_READ, - src_offset ); - ADVANCE_BATCH(); - } - else { - BEGIN_BATCH(8, INTEL_BATCH_NO_CLIPRECTS); - OUT_BATCH( CMD ); - OUT_BATCH( (dst_pitch & 0xffff) | BR13 ); - OUT_BATCH( (0 << 16) | dst_x ); - OUT_BATCH( (h << 16) | dst_x2 ); - OUT_RELOC( dst_buffer, BRW_BUFFER_ACCESS_WRITE, - dst_offset + dst_y * dst_pitch ); - OUT_BATCH( (src_pitch & 0xffff) ); - OUT_RELOC( src_buffer, BRW_BUFFER_ACCESS_READ, - src_offset + src_y * src_pitch ); - ADVANCE_BATCH(); - } -} - - - diff --git a/src/gallium/drivers/i965simple/brw_blit.h b/src/gallium/drivers/i965simple/brw_blit.h deleted file mode 100644 index 111c5d91d3..0000000000 --- a/src/gallium/drivers/i965simple/brw_blit.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef BRW_BLIT_H -#define BRW_BLIT_H - -#include "pipe/p_compiler.h" - -struct pipe_buffer; -struct brw_context; - -void brw_fill_blit(struct brw_context *intel, - unsigned cpp, - short dst_pitch, - struct pipe_buffer *dst_buffer, - unsigned dst_offset, - boolean dst_tiled, - short x, short y, - short w, short h, - unsigned color); -void brw_copy_blit(struct brw_context *intel, - unsigned do_flip, - unsigned cpp, - short src_pitch, - struct pipe_buffer *src_buffer, - unsigned src_offset, - boolean src_tiled, - short dst_pitch, - struct pipe_buffer *dst_buffer, - unsigned dst_offset, - boolean dst_tiled, - short src_x, short src_y, - short dst_x, short dst_y, - short w, short h, - unsigned logic_op); -#endif diff --git a/src/gallium/drivers/i965simple/brw_cc.c b/src/gallium/drivers/i965simple/brw_cc.c deleted file mode 100644 index 3668123e2e..0000000000 --- a/src/gallium/drivers/i965simple/brw_cc.c +++ /dev/null @@ -1,269 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - -#include "util/u_math.h" -#include "util/u_memory.h" - -#include "brw_context.h" -#include "brw_state.h" -#include "brw_defines.h" -#include "brw_util.h" - - -static int brw_translate_compare_func(int func) -{ - switch(func) { - case PIPE_FUNC_NEVER: - return BRW_COMPAREFUNCTION_NEVER; - case PIPE_FUNC_LESS: - return BRW_COMPAREFUNCTION_LESS; - case PIPE_FUNC_LEQUAL: - return BRW_COMPAREFUNCTION_LEQUAL; - case PIPE_FUNC_GREATER: - return BRW_COMPAREFUNCTION_GREATER; - case PIPE_FUNC_GEQUAL: - return BRW_COMPAREFUNCTION_GEQUAL; - case PIPE_FUNC_NOTEQUAL: - return BRW_COMPAREFUNCTION_NOTEQUAL; - case PIPE_FUNC_EQUAL: - return BRW_COMPAREFUNCTION_EQUAL; - case PIPE_FUNC_ALWAYS: - return BRW_COMPAREFUNCTION_ALWAYS; - } - - debug_printf("Unknown value in %s: %x\n", __FUNCTION__, func); - return BRW_COMPAREFUNCTION_ALWAYS; -} - -static int brw_translate_stencil_op(int op) -{ - switch(op) { - case PIPE_STENCIL_OP_KEEP: - return BRW_STENCILOP_KEEP; - case PIPE_STENCIL_OP_ZERO: - return BRW_STENCILOP_ZERO; - case PIPE_STENCIL_OP_REPLACE: - return BRW_STENCILOP_REPLACE; - case PIPE_STENCIL_OP_INCR: - return BRW_STENCILOP_INCRSAT; - case PIPE_STENCIL_OP_DECR: - return BRW_STENCILOP_DECRSAT; - case PIPE_STENCIL_OP_INCR_WRAP: - return BRW_STENCILOP_INCR; - case PIPE_STENCIL_OP_DECR_WRAP: - return BRW_STENCILOP_DECR; - case PIPE_STENCIL_OP_INVERT: - return BRW_STENCILOP_INVERT; - default: - return BRW_STENCILOP_ZERO; - } -} - - -static int brw_translate_logic_op(int opcode) -{ - switch(opcode) { - case PIPE_LOGICOP_CLEAR: - return BRW_LOGICOPFUNCTION_CLEAR; - case PIPE_LOGICOP_AND: - return BRW_LOGICOPFUNCTION_AND; - case PIPE_LOGICOP_AND_REVERSE: - return BRW_LOGICOPFUNCTION_AND_REVERSE; - case PIPE_LOGICOP_COPY: - return BRW_LOGICOPFUNCTION_COPY; - case PIPE_LOGICOP_COPY_INVERTED: - return BRW_LOGICOPFUNCTION_COPY_INVERTED; - case PIPE_LOGICOP_AND_INVERTED: - return BRW_LOGICOPFUNCTION_AND_INVERTED; - case PIPE_LOGICOP_NOOP: - return BRW_LOGICOPFUNCTION_NOOP; - case PIPE_LOGICOP_XOR: - return BRW_LOGICOPFUNCTION_XOR; - case PIPE_LOGICOP_OR: - return BRW_LOGICOPFUNCTION_OR; - case PIPE_LOGICOP_OR_INVERTED: - return BRW_LOGICOPFUNCTION_OR_INVERTED; - case PIPE_LOGICOP_NOR: - return BRW_LOGICOPFUNCTION_NOR; - case PIPE_LOGICOP_EQUIV: - return BRW_LOGICOPFUNCTION_EQUIV; - case PIPE_LOGICOP_INVERT: - return BRW_LOGICOPFUNCTION_INVERT; - case PIPE_LOGICOP_OR_REVERSE: - return BRW_LOGICOPFUNCTION_OR_REVERSE; - case PIPE_LOGICOP_NAND: - return BRW_LOGICOPFUNCTION_NAND; - case PIPE_LOGICOP_SET: - return BRW_LOGICOPFUNCTION_SET; - default: - return BRW_LOGICOPFUNCTION_SET; - } -} - - -static void upload_cc_vp( struct brw_context *brw ) -{ - struct brw_cc_viewport ccv; - - memset(&ccv, 0, sizeof(ccv)); - - ccv.min_depth = 0.0; - ccv.max_depth = 1.0; - - brw->cc.vp_gs_offset = brw_cache_data( &brw->cache[BRW_CC_VP], &ccv ); -} - -const struct brw_tracked_state brw_cc_vp = { - .dirty = { - .brw = BRW_NEW_SCENE, - .cache = 0 - }, - .update = upload_cc_vp -}; - - -static void upload_cc_unit( struct brw_context *brw ) -{ - struct brw_cc_unit_state cc; - - memset(&cc, 0, sizeof(cc)); - - /* BRW_NEW_DEPTH_STENCIL */ - if (brw->attribs.DepthStencil->stencil[0].enabled) { - cc.cc0.stencil_enable = brw->attribs.DepthStencil->stencil[0].enabled; - cc.cc0.stencil_func = brw_translate_compare_func(brw->attribs.DepthStencil->stencil[0].func); - cc.cc0.stencil_fail_op = brw_translate_stencil_op(brw->attribs.DepthStencil->stencil[0].fail_op); - cc.cc0.stencil_pass_depth_fail_op = brw_translate_stencil_op( - brw->attribs.DepthStencil->stencil[0].zfail_op); - cc.cc0.stencil_pass_depth_pass_op = brw_translate_stencil_op( - brw->attribs.DepthStencil->stencil[0].zpass_op); - cc.cc1.stencil_ref = brw->attribs.DepthStencil->stencil[0].ref_value; - cc.cc1.stencil_write_mask = brw->attribs.DepthStencil->stencil[0].writemask; - cc.cc1.stencil_test_mask = brw->attribs.DepthStencil->stencil[0].valuemask; - - if (brw->attribs.DepthStencil->stencil[1].enabled) { - cc.cc0.bf_stencil_enable = brw->attribs.DepthStencil->stencil[1].enabled; - cc.cc0.bf_stencil_func = brw_translate_compare_func( - brw->attribs.DepthStencil->stencil[1].func); - cc.cc0.bf_stencil_fail_op = brw_translate_stencil_op( - brw->attribs.DepthStencil->stencil[1].fail_op); - cc.cc0.bf_stencil_pass_depth_fail_op = brw_translate_stencil_op( - brw->attribs.DepthStencil->stencil[1].zfail_op); - cc.cc0.bf_stencil_pass_depth_pass_op = brw_translate_stencil_op( - brw->attribs.DepthStencil->stencil[1].zpass_op); - cc.cc1.bf_stencil_ref = brw->attribs.DepthStencil->stencil[1].ref_value; - cc.cc2.bf_stencil_write_mask = brw->attribs.DepthStencil->stencil[1].writemask; - cc.cc2.bf_stencil_test_mask = brw->attribs.DepthStencil->stencil[1].valuemask; - } - - /* Not really sure about this: - */ - if (brw->attribs.DepthStencil->stencil[0].writemask || - brw->attribs.DepthStencil->stencil[1].writemask) - cc.cc0.stencil_write_enable = 1; - } - - /* BRW_NEW_BLEND */ - if (brw->attribs.Blend->logicop_enable) { - cc.cc2.logicop_enable = 1; - cc.cc5.logicop_func = brw_translate_logic_op( brw->attribs.Blend->logicop_func ); - } - else if (brw->attribs.Blend->blend_enable) { - int eqRGB = brw->attribs.Blend->rgb_func; - int eqA = brw->attribs.Blend->alpha_func; - int srcRGB = brw->attribs.Blend->rgb_src_factor; - int dstRGB = brw->attribs.Blend->rgb_dst_factor; - int srcA = brw->attribs.Blend->alpha_src_factor; - int dstA = brw->attribs.Blend->alpha_dst_factor; - - if (eqRGB == PIPE_BLEND_MIN || eqRGB == PIPE_BLEND_MAX) { - srcRGB = dstRGB = PIPE_BLENDFACTOR_ONE; - } - - if (eqA == PIPE_BLEND_MIN || eqA == PIPE_BLEND_MAX) { - srcA = dstA = PIPE_BLENDFACTOR_ONE; - } - - cc.cc6.dest_blend_factor = brw_translate_blend_factor(dstRGB); - cc.cc6.src_blend_factor = brw_translate_blend_factor(srcRGB); - cc.cc6.blend_function = brw_translate_blend_equation( eqRGB ); - - cc.cc5.ia_dest_blend_factor = brw_translate_blend_factor(dstA); - cc.cc5.ia_src_blend_factor = brw_translate_blend_factor(srcA); - cc.cc5.ia_blend_function = brw_translate_blend_equation( eqA ); - - cc.cc3.blend_enable = 1; - cc.cc3.ia_blend_enable = (srcA != srcRGB || - dstA != dstRGB || - eqA != eqRGB); - } - - /* BRW_NEW_ALPHATEST - */ - if (brw->attribs.DepthStencil->alpha.enabled) { - cc.cc3.alpha_test = 1; - cc.cc3.alpha_test_func = - brw_translate_compare_func(brw->attribs.DepthStencil->alpha.func); - - cc.cc7.alpha_ref.ub[0] = float_to_ubyte(brw->attribs.DepthStencil->alpha.ref_value); - - cc.cc3.alpha_test_format = BRW_ALPHATEST_FORMAT_UNORM8; - } - - if (brw->attribs.Blend->dither) { - cc.cc5.dither_enable = 1; - cc.cc6.y_dither_offset = 0; - cc.cc6.x_dither_offset = 0; - } - - if (brw->attribs.DepthStencil->depth.enabled) { - cc.cc2.depth_test = brw->attribs.DepthStencil->depth.enabled; - cc.cc2.depth_test_function = brw_translate_compare_func(brw->attribs.DepthStencil->depth.func); - cc.cc2.depth_write_enable = brw->attribs.DepthStencil->depth.writemask; - } - - /* CACHE_NEW_CC_VP */ - cc.cc4.cc_viewport_state_offset = brw->cc.vp_gs_offset >> 5; - - if (BRW_DEBUG & DEBUG_STATS) - cc.cc5.statistics_enable = 1; - - brw->cc.state_gs_offset = brw_cache_data( &brw->cache[BRW_CC_UNIT], &cc ); -} - -const struct brw_tracked_state brw_cc_unit = { - .dirty = { - .brw = BRW_NEW_DEPTH_STENCIL | BRW_NEW_BLEND | BRW_NEW_ALPHA_TEST, - .cache = CACHE_NEW_CC_VP - }, - .update = upload_cc_unit -}; - diff --git a/src/gallium/drivers/i965simple/brw_clip.c b/src/gallium/drivers/i965simple/brw_clip.c deleted file mode 100644 index 268124cc53..0000000000 --- a/src/gallium/drivers/i965simple/brw_clip.c +++ /dev/null @@ -1,206 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - -#include "brw_defines.h" -#include "brw_context.h" -#include "brw_eu.h" -#include "brw_util.h" -#include "brw_state.h" -#include "brw_clip.h" - -#define FRONT_UNFILLED_BIT 0x1 -#define BACK_UNFILLED_BIT 0x2 - - -static void compile_clip_prog( struct brw_context *brw, - struct brw_clip_prog_key *key ) -{ - struct brw_clip_compile c; - const unsigned *program; - unsigned program_size; - unsigned delta; - unsigned i; - - memset(&c, 0, sizeof(c)); - - /* Begin the compilation: - */ - brw_init_compile(&c.func); - - c.func.single_program_flow = 1; - - c.key = *key; - - - /* Need to locate the two positions present in vertex + header. - * These are currently hardcoded: - */ - c.header_position_offset = ATTR_SIZE; - - for (i = 0, delta = REG_SIZE; i < PIPE_MAX_SHADER_OUTPUTS; i++) - if (c.key.attrs & (1<primitive) { - case PIPE_PRIM_TRIANGLES: -#if 0 - if (key->do_unfilled) - brw_emit_unfilled_clip( &c ); - else -#endif - brw_emit_tri_clip( &c ); - break; - case PIPE_PRIM_LINES: - brw_emit_line_clip( &c ); - break; - case PIPE_PRIM_POINTS: - brw_emit_point_clip( &c ); - break; - default: - assert(0); - return; - } - - - - /* get the program - */ - program = brw_get_program(&c.func, &program_size); - - /* Upload - */ - brw->clip.prog_gs_offset = brw_upload_cache( &brw->cache[BRW_CLIP_PROG], - &c.key, - sizeof(c.key), - program, - program_size, - &c.prog_data, - &brw->clip.prog_data ); -} - - -static boolean search_cache( struct brw_context *brw, - struct brw_clip_prog_key *key ) -{ - return brw_search_cache(&brw->cache[BRW_CLIP_PROG], - key, sizeof(*key), - &brw->clip.prog_data, - &brw->clip.prog_gs_offset); -} - - - - -/* Calculate interpolants for triangle and line rasterization. - */ -static void upload_clip_prog(struct brw_context *brw) -{ - struct brw_clip_prog_key key; - - memset(&key, 0, sizeof(key)); - - /* Populate the key: - */ - /* BRW_NEW_REDUCED_PRIMITIVE */ - key.primitive = brw->reduced_primitive; - /* CACHE_NEW_VS_PROG */ - key.attrs = brw->vs.prog_data->outputs_written; - /* BRW_NEW_RASTER */ - key.do_flat_shading = (brw->attribs.Raster->flatshade); - /* BRW_NEW_CLIP */ - key.nr_userclip = brw->attribs.Clip.nr; /* XXX */ - -#if 0 - key.clip_mode = BRW_CLIPMODE_NORMAL; - - if (key.primitive == PIPE_PRIM_TRIANGLES) { - if (brw->attribs.Raster->cull_mode == PIPE_WINDING_BOTH) - key.clip_mode = BRW_CLIPMODE_REJECT_ALL; - else { - if (brw->attribs.Raster->fill_cw != PIPE_POLYGON_MODE_FILL || - brw->attribs.Raster->fill_ccw != PIPE_POLYGON_MODE_FILL) - key.do_unfilled = 1; - - /* Most cases the fixed function units will handle. Cases where - * one or more polygon faces are unfilled will require help: - */ - if (key.do_unfilled) { - key.clip_mode = BRW_CLIPMODE_CLIP_NON_REJECTED; - - if (brw->attribs.Raster->offset_cw || - brw->attribs.Raster->offset_ccw) { - key.offset_units = brw->attribs.Raster->offset_units; - key.offset_factor = brw->attribs.Raster->offset_scale; - } - key.fill_ccw = brw->attribs.Raster->fill_ccw; - key.fill_cw = brw->attribs.Raster->fill_cw; - key.offset_ccw = brw->attribs.Raster->offset_ccw; - key.offset_cw = brw->attribs.Raster->offset_cw; - if (brw->attribs.Raster->light_twoside && - key.fill_cw != CLIP_CULL) - key.copy_bfc_cw = 1; - } - } - } -#else - key.clip_mode = BRW_CLIPMODE_ACCEPT_ALL; -#endif - - if (!search_cache(brw, &key)) - compile_clip_prog( brw, &key ); -} - -const struct brw_tracked_state brw_clip_prog = { - .dirty = { - .brw = (BRW_NEW_RASTERIZER | - BRW_NEW_CLIP | - BRW_NEW_REDUCED_PRIMITIVE), - .cache = CACHE_NEW_VS_PROG - }, - .update = upload_clip_prog -}; diff --git a/src/gallium/drivers/i965simple/brw_clip.h b/src/gallium/drivers/i965simple/brw_clip.h deleted file mode 100644 index d70fc094ff..0000000000 --- a/src/gallium/drivers/i965simple/brw_clip.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - -#ifndef BRW_CLIP_H -#define BRW_CLIP_H - - -#include "brw_context.h" -#include "brw_eu.h" - -#define MAX_VERTS (3+6+6) - -/* Note that if unfilled primitives are being emitted, we have to fix - * up polygon offset and flatshading at this point: - */ -struct brw_clip_prog_key { - unsigned attrs:32; - unsigned primitive:4; - unsigned nr_userclip:3; - unsigned do_flat_shading:1; - unsigned do_unfilled:1; - unsigned fill_cw:2; /* includes cull information */ - unsigned fill_ccw:2; /* includes cull information */ - unsigned offset_cw:1; - unsigned offset_ccw:1; - unsigned pad0:17; - - unsigned copy_bfc_cw:1; - unsigned copy_bfc_ccw:1; - unsigned clip_mode:3; - unsigned pad1:27; - - float offset_factor; - float offset_units; -}; - - -#define CLIP_LINE 0 -#define CLIP_POINT 1 -#define CLIP_FILL 2 -#define CLIP_CULL 3 - - -#define PRIM_MASK (0x1f) - -struct brw_clip_compile { - struct brw_compile func; - struct brw_clip_prog_key key; - struct brw_clip_prog_data prog_data; - - struct { - struct brw_reg R0; - struct brw_reg vertex[MAX_VERTS]; - - struct brw_reg t; - struct brw_reg t0, t1; - struct brw_reg dp0, dp1; - - struct brw_reg dpPrev; - struct brw_reg dp; - struct brw_reg loopcount; - struct brw_reg nr_verts; - struct brw_reg planemask; - - struct brw_reg inlist; - struct brw_reg outlist; - struct brw_reg freelist; - - struct brw_reg dir; - struct brw_reg tmp0, tmp1; - struct brw_reg offset; - - struct brw_reg fixed_planes; - struct brw_reg plane_equation; - } reg; - - /* 3 different ways of expressing vertex size: - */ - unsigned nr_attrs; - unsigned nr_regs; - unsigned nr_bytes; - - unsigned first_tmp; - unsigned last_tmp; - - boolean need_direction; - - unsigned last_mrf; - - unsigned header_position_offset; - unsigned offset[PIPE_MAX_ATTRIBS]; -}; - -#define ATTR_SIZE (4*4) - -/* Points are only culled, so no need for a clip routine, however it - * works out easier to have a dummy one. - */ -void brw_emit_unfilled_clip( struct brw_clip_compile *c ); -void brw_emit_tri_clip( struct brw_clip_compile *c ); -void brw_emit_line_clip( struct brw_clip_compile *c ); -void brw_emit_point_clip( struct brw_clip_compile *c ); - -/* brw_clip_tri.c, for use by the unfilled clip routine: - */ -void brw_clip_tri_init_vertices( struct brw_clip_compile *c ); -void brw_clip_tri_flat_shade( struct brw_clip_compile *c ); -void brw_clip_tri( struct brw_clip_compile *c ); -void brw_clip_tri_emit_polygon( struct brw_clip_compile *c ); -void brw_clip_tri_alloc_regs( struct brw_clip_compile *c, - unsigned nr_verts ); - - -/* Utils: - */ - -void brw_clip_interp_vertex( struct brw_clip_compile *c, - struct brw_indirect dest_ptr, - struct brw_indirect v0_ptr, /* from */ - struct brw_indirect v1_ptr, /* to */ - struct brw_reg t0, - boolean force_edgeflag ); - -void brw_clip_init_planes( struct brw_clip_compile *c ); - -void brw_clip_emit_vue(struct brw_clip_compile *c, - struct brw_indirect vert, - boolean allocate, - boolean eot, - unsigned header); - -void brw_clip_kill_thread(struct brw_clip_compile *c); - -struct brw_reg brw_clip_plane_stride( struct brw_clip_compile *c ); -struct brw_reg brw_clip_plane0_address( struct brw_clip_compile *c ); - -void brw_clip_copy_colors( struct brw_clip_compile *c, - unsigned to, unsigned from ); - -void brw_clip_init_clipmask( struct brw_clip_compile *c ); - -#endif diff --git a/src/gallium/drivers/i965simple/brw_clip_line.c b/src/gallium/drivers/i965simple/brw_clip_line.c deleted file mode 100644 index 75d9e5fcda..0000000000 --- a/src/gallium/drivers/i965simple/brw_clip_line.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - -#include "brw_defines.h" -#include "brw_context.h" -#include "brw_eu.h" -#include "brw_util.h" -#include "brw_clip.h" - - - -static void brw_clip_line_alloc_regs( struct brw_clip_compile *c ) -{ - unsigned i = 0,j; - - /* Register usage is static, precompute here: - */ - c->reg.R0 = retype(brw_vec8_grf(i, 0), BRW_REGISTER_TYPE_UD); i++; - - if (c->key.nr_userclip) { - c->reg.fixed_planes = brw_vec4_grf(i, 0); - i += (6 + c->key.nr_userclip + 1) / 2; - - c->prog_data.curb_read_length = (6 + c->key.nr_userclip + 1) / 2; - } - else - c->prog_data.curb_read_length = 0; - - - /* Payload vertices plus space for more generated vertices: - */ - for (j = 0; j < 4; j++) { - c->reg.vertex[j] = brw_vec4_grf(i, 0); - i += c->nr_regs; - } - - c->reg.t = brw_vec1_grf(i, 0); - c->reg.t0 = brw_vec1_grf(i, 1); - c->reg.t1 = brw_vec1_grf(i, 2); - c->reg.planemask = retype(brw_vec1_grf(i, 3), BRW_REGISTER_TYPE_UD); - c->reg.plane_equation = brw_vec4_grf(i, 4); - i++; - - c->reg.dp0 = brw_vec1_grf(i, 0); /* fixme - dp4 will clobber r.1,2,3 */ - c->reg.dp1 = brw_vec1_grf(i, 4); - i++; - - if (!c->key.nr_userclip) { - c->reg.fixed_planes = brw_vec8_grf(i, 0); - i++; - } - - - c->first_tmp = i; - c->last_tmp = i; - - c->prog_data.urb_read_length = c->nr_regs; /* ? */ - c->prog_data.total_grf = i; -} - - - -/* Line clipping, more or less following the following algorithm: - * - * for (p=0;p t1) t1 = t; - * } else { - * float t = dp0 / (dp0 - dp1); - * if (t > t0) t0 = t; - * } - * - * if (t0 + t1 >= 1.0) - * return; - * } - * } - * - * interp( ctx, newvtx0, vtx0, vtx1, t0 ); - * interp( ctx, newvtx1, vtx1, vtx0, t1 ); - * - */ -static void clip_and_emit_line( struct brw_clip_compile *c ) -{ - struct brw_compile *p = &c->func; - struct brw_indirect vtx0 = brw_indirect(0, 0); - struct brw_indirect vtx1 = brw_indirect(1, 0); - struct brw_indirect newvtx0 = brw_indirect(2, 0); - struct brw_indirect newvtx1 = brw_indirect(3, 0); - struct brw_indirect plane_ptr = brw_indirect(4, 0); - struct brw_instruction *plane_loop; - struct brw_instruction *plane_active; - struct brw_instruction *is_negative; - struct brw_instruction *is_neg2; - struct brw_instruction *not_culled; - struct brw_reg v1_null_ud = retype(vec1(brw_null_reg()), BRW_REGISTER_TYPE_UD); - - brw_MOV(p, get_addr_reg(vtx0), brw_address(c->reg.vertex[0])); - brw_MOV(p, get_addr_reg(vtx1), brw_address(c->reg.vertex[1])); - brw_MOV(p, get_addr_reg(newvtx0), brw_address(c->reg.vertex[2])); - brw_MOV(p, get_addr_reg(newvtx1), brw_address(c->reg.vertex[3])); - brw_MOV(p, get_addr_reg(plane_ptr), brw_clip_plane0_address(c)); - - /* Note: init t0, t1 together: - */ - brw_MOV(p, vec2(c->reg.t0), brw_imm_f(0)); - - brw_clip_init_planes(c); - brw_clip_init_clipmask(c); - - /* -ve rhw workaround */ - brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); - brw_AND(p, brw_null_reg(), get_element_ud(c->reg.R0, 2), - brw_imm_ud(1<<20)); - brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud(0x3f)); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - - plane_loop = brw_DO(p, BRW_EXECUTE_1); - { - /* if (planemask & 1) - */ - brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); - brw_AND(p, v1_null_ud, c->reg.planemask, brw_imm_ud(1)); - - plane_active = brw_IF(p, BRW_EXECUTE_1); - { - if (c->key.nr_userclip) - brw_MOV(p, c->reg.plane_equation, deref_4f(plane_ptr, 0)); - else - brw_MOV(p, c->reg.plane_equation, deref_4b(plane_ptr, 0)); - -#if 0 - /* dp = DP4(vtx->position, plane) - */ - brw_DP4(p, vec4(c->reg.dp0), deref_4f(vtx0, c->offset[VERT_RESULT_HPOS]), c->reg.plane_equation); - - /* if (IS_NEGATIVE(dp1)) - */ - brw_set_conditionalmod(p, BRW_CONDITIONAL_L); - brw_DP4(p, vec4(c->reg.dp1), deref_4f(vtx1, c->offset[VERT_RESULT_HPOS]), c->reg.plane_equation); -#else - #warning "disabled" -#endif - is_negative = brw_IF(p, BRW_EXECUTE_1); - { - brw_ADD(p, c->reg.t, c->reg.dp1, negate(c->reg.dp0)); - brw_math_invert(p, c->reg.t, c->reg.t); - brw_MUL(p, c->reg.t, c->reg.t, c->reg.dp1); - - brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_G, c->reg.t, c->reg.t1 ); - brw_MOV(p, c->reg.t1, c->reg.t); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - } - is_negative = brw_ELSE(p, is_negative); - { - /* Coming back in. We know that both cannot be negative - * because the line would have been culled in that case. - */ - - /* If both are positive, do nothing */ - brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_L, c->reg.dp0, brw_imm_f(0.0)); - is_neg2 = brw_IF(p, BRW_EXECUTE_1); - { - brw_ADD(p, c->reg.t, c->reg.dp0, negate(c->reg.dp1)); - brw_math_invert(p, c->reg.t, c->reg.t); - brw_MUL(p, c->reg.t, c->reg.t, c->reg.dp0); - - brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_G, c->reg.t, c->reg.t0 ); - brw_MOV(p, c->reg.t0, c->reg.t); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - } - brw_ENDIF(p, is_neg2); - } - brw_ENDIF(p, is_negative); - } - brw_ENDIF(p, plane_active); - - /* plane_ptr++; - */ - brw_ADD(p, get_addr_reg(plane_ptr), get_addr_reg(plane_ptr), brw_clip_plane_stride(c)); - - /* while (planemask>>=1) != 0 - */ - brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); - brw_SHR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud(1)); - } - brw_WHILE(p, plane_loop); - - brw_ADD(p, c->reg.t, c->reg.t0, c->reg.t1); - brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_L, c->reg.t, brw_imm_f(1.0)); - not_culled = brw_IF(p, BRW_EXECUTE_1); - { - brw_clip_interp_vertex(c, newvtx0, vtx0, vtx1, c->reg.t0, FALSE); - brw_clip_interp_vertex(c, newvtx1, vtx1, vtx0, c->reg.t1, FALSE); - - brw_clip_emit_vue(c, newvtx0, 1, 0, (_3DPRIM_LINESTRIP << 2) | R02_PRIM_START); - brw_clip_emit_vue(c, newvtx1, 0, 1, (_3DPRIM_LINESTRIP << 2) | R02_PRIM_END); - } - brw_ENDIF(p, not_culled); - brw_clip_kill_thread(c); -} - - - -void brw_emit_line_clip( struct brw_clip_compile *c ) -{ - brw_clip_line_alloc_regs(c); - - if (c->key.do_flat_shading) - brw_clip_copy_colors(c, 0, 1); - - clip_and_emit_line(c); -} diff --git a/src/gallium/drivers/i965simple/brw_clip_point.c b/src/gallium/drivers/i965simple/brw_clip_point.c deleted file mode 100644 index 6fce7210d1..0000000000 --- a/src/gallium/drivers/i965simple/brw_clip_point.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - -#include "brw_defines.h" -#include "brw_context.h" -#include "brw_eu.h" -#include "brw_util.h" -#include "brw_clip.h" - - -/* Point clipping, nothing to do? - */ -void brw_emit_point_clip( struct brw_clip_compile *c ) -{ - /* Send an empty message to kill the thread: - */ - brw_clip_tri_alloc_regs(c, 0); - brw_clip_kill_thread(c); -} diff --git a/src/gallium/drivers/i965simple/brw_clip_state.c b/src/gallium/drivers/i965simple/brw_clip_state.c deleted file mode 100644 index 8e78dd51be..0000000000 --- a/src/gallium/drivers/i965simple/brw_clip_state.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - -#include "brw_context.h" -#include "brw_state.h" -#include "brw_defines.h" -#include "util/u_math.h" -#include "util/u_memory.h" - - -static void upload_clip_unit( struct brw_context *brw ) -{ - struct brw_clip_unit_state clip; - - memset(&clip, 0, sizeof(clip)); - - /* CACHE_NEW_CLIP_PROG */ - clip.thread0.grf_reg_count = - align(brw->clip.prog_data->total_grf, 16) / 16 - 1; - clip.thread0.kernel_start_pointer = brw->clip.prog_gs_offset >> 6; - clip.thread3.urb_entry_read_length = brw->clip.prog_data->urb_read_length; - clip.thread3.const_urb_entry_read_length = brw->clip.prog_data->curb_read_length; - clip.clip5.clip_mode = brw->clip.prog_data->clip_mode; - - /* BRW_NEW_CURBE_OFFSETS */ - clip.thread3.const_urb_entry_read_offset = brw->curbe.clip_start * 2; - - /* BRW_NEW_URB_FENCE */ - clip.thread4.nr_urb_entries = brw->urb.nr_clip_entries; - clip.thread4.urb_entry_allocation_size = brw->urb.vsize - 1; - clip.thread4.max_threads = 1; /* 2 threads */ - - if (BRW_DEBUG & DEBUG_STATS) - clip.thread4.stats_enable = 1; - - /* CONSTANT */ - clip.thread1.floating_point_mode = BRW_FLOATING_POINT_NON_IEEE_754; - clip.thread1.single_program_flow = 1; - clip.thread3.dispatch_grf_start_reg = 1; - clip.thread3.urb_entry_read_offset = 0; - clip.clip5.userclip_enable_flags = 0x7f; - clip.clip5.userclip_must_clip = 1; - clip.clip5.guard_band_enable = 0; - clip.clip5.viewport_z_clip_enable = 1; - clip.clip5.viewport_xy_clip_enable = 1; - clip.clip5.vertex_position_space = BRW_CLIP_NDCSPACE; - clip.clip5.api_mode = BRW_CLIP_API_OGL; - clip.clip6.clipper_viewport_state_ptr = 0; - clip.viewport_xmin = -1; - clip.viewport_xmax = 1; - clip.viewport_ymin = -1; - clip.viewport_ymax = 1; - - brw->clip.state_gs_offset = brw_cache_data( &brw->cache[BRW_CLIP_UNIT], &clip ); -} - - -const struct brw_tracked_state brw_clip_unit = { - .dirty = { - .brw = (BRW_NEW_CURBE_OFFSETS | - BRW_NEW_URB_FENCE), - .cache = CACHE_NEW_CLIP_PROG - }, - .update = upload_clip_unit -}; diff --git a/src/gallium/drivers/i965simple/brw_clip_tri.c b/src/gallium/drivers/i965simple/brw_clip_tri.c deleted file mode 100644 index c5da7b825e..0000000000 --- a/src/gallium/drivers/i965simple/brw_clip_tri.c +++ /dev/null @@ -1,566 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - -#include "brw_defines.h" -#include "brw_context.h" -#include "brw_eu.h" -#include "brw_util.h" -#include "brw_clip.h" - -static struct brw_reg get_tmp( struct brw_clip_compile *c ) -{ - struct brw_reg tmp = brw_vec4_grf(c->last_tmp, 0); - - if (++c->last_tmp > c->prog_data.total_grf) - c->prog_data.total_grf = c->last_tmp; - - return tmp; -} - -static void release_tmps( struct brw_clip_compile *c ) -{ - c->last_tmp = c->first_tmp; -} - - -void brw_clip_tri_alloc_regs( struct brw_clip_compile *c, - unsigned nr_verts ) -{ - unsigned i = 0,j; - - /* Register usage is static, precompute here: - */ - c->reg.R0 = retype(brw_vec8_grf(i, 0), BRW_REGISTER_TYPE_UD); i++; - - if (c->key.nr_userclip) { - c->reg.fixed_planes = brw_vec4_grf(i, 0); - i += (6 + c->key.nr_userclip + 1) / 2; - - c->prog_data.curb_read_length = (6 + c->key.nr_userclip + 1) / 2; - } - else - c->prog_data.curb_read_length = 0; - - - /* Payload vertices plus space for more generated vertices: - */ - for (j = 0; j < nr_verts; j++) { - c->reg.vertex[j] = brw_vec4_grf(i, 0); - i += c->nr_regs; - } - - if (c->nr_attrs & 1) { - for (j = 0; j < 3; j++) { - unsigned delta = c->nr_attrs*16 + 32; - brw_MOV(&c->func, byte_offset(c->reg.vertex[j], delta), brw_imm_f(0)); - } - } - - c->reg.t = brw_vec1_grf(i, 0); - c->reg.loopcount = retype(brw_vec1_grf(i, 1), BRW_REGISTER_TYPE_UD); - c->reg.nr_verts = retype(brw_vec1_grf(i, 2), BRW_REGISTER_TYPE_UD); - c->reg.planemask = retype(brw_vec1_grf(i, 3), BRW_REGISTER_TYPE_UD); - c->reg.plane_equation = brw_vec4_grf(i, 4); - i++; - - c->reg.dpPrev = brw_vec1_grf(i, 0); /* fixme - dp4 will clobber r.1,2,3 */ - c->reg.dp = brw_vec1_grf(i, 4); - i++; - - c->reg.inlist = brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, i, 0); - i++; - - c->reg.outlist = brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, i, 0); - i++; - - c->reg.freelist = brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, i, 0); - i++; - - if (!c->key.nr_userclip) { - c->reg.fixed_planes = brw_vec8_grf(i, 0); - i++; - } - - if (c->key.do_unfilled) { - c->reg.dir = brw_vec4_grf(i, 0); - c->reg.offset = brw_vec4_grf(i, 4); - i++; - c->reg.tmp0 = brw_vec4_grf(i, 0); - c->reg.tmp1 = brw_vec4_grf(i, 4); - i++; - } - - c->first_tmp = i; - c->last_tmp = i; - - c->prog_data.urb_read_length = c->nr_regs; /* ? */ - c->prog_data.total_grf = i; -} - - - -void brw_clip_tri_init_vertices( struct brw_clip_compile *c ) -{ - struct brw_compile *p = &c->func; - struct brw_reg tmp0 = c->reg.loopcount; /* handy temporary */ - struct brw_instruction *is_rev; - - /* Initial list of indices for incoming vertexes: - */ - brw_AND(p, tmp0, get_element_ud(c->reg.R0, 2), brw_imm_ud(PRIM_MASK)); - brw_CMP(p, - vec1(brw_null_reg()), - BRW_CONDITIONAL_EQ, - tmp0, - brw_imm_ud(_3DPRIM_TRISTRIP_REVERSE)); - - /* XXX: Is there an easier way to do this? Need to reverse every - * second tristrip element: Can ignore sometimes? - */ - is_rev = brw_IF(p, BRW_EXECUTE_1); - { - brw_MOV(p, get_element(c->reg.inlist, 0), brw_address(c->reg.vertex[1]) ); - brw_MOV(p, get_element(c->reg.inlist, 1), brw_address(c->reg.vertex[0]) ); - if (c->need_direction) - brw_MOV(p, c->reg.dir, brw_imm_f(-1)); - } - is_rev = brw_ELSE(p, is_rev); - { - brw_MOV(p, get_element(c->reg.inlist, 0), brw_address(c->reg.vertex[0]) ); - brw_MOV(p, get_element(c->reg.inlist, 1), brw_address(c->reg.vertex[1]) ); - if (c->need_direction) - brw_MOV(p, c->reg.dir, brw_imm_f(1)); - } - brw_ENDIF(p, is_rev); - - brw_MOV(p, get_element(c->reg.inlist, 2), brw_address(c->reg.vertex[2]) ); - brw_MOV(p, brw_vec8_grf(c->reg.outlist.nr, 0), brw_imm_f(0)); - brw_MOV(p, c->reg.nr_verts, brw_imm_ud(3)); -} - - - -void brw_clip_tri_flat_shade( struct brw_clip_compile *c ) -{ - struct brw_compile *p = &c->func; - struct brw_instruction *is_poly; - struct brw_reg tmp0 = c->reg.loopcount; /* handy temporary */ - - brw_AND(p, tmp0, get_element_ud(c->reg.R0, 2), brw_imm_ud(PRIM_MASK)); - brw_CMP(p, - vec1(brw_null_reg()), - BRW_CONDITIONAL_EQ, - tmp0, - brw_imm_ud(_3DPRIM_POLYGON)); - - is_poly = brw_IF(p, BRW_EXECUTE_1); - { - brw_clip_copy_colors(c, 1, 0); - brw_clip_copy_colors(c, 2, 0); - } - is_poly = brw_ELSE(p, is_poly); - { - brw_clip_copy_colors(c, 0, 2); - brw_clip_copy_colors(c, 1, 2); - } - brw_ENDIF(p, is_poly); -} - - - -/* Use mesa's clipping algorithms, translated to GEN4 assembly. - */ -void brw_clip_tri( struct brw_clip_compile *c ) -{ -#if 0 - struct brw_compile *p = &c->func; - struct brw_indirect vtx = brw_indirect(0, 0); - struct brw_indirect vtxPrev = brw_indirect(1, 0); - struct brw_indirect vtxOut = brw_indirect(2, 0); - struct brw_indirect plane_ptr = brw_indirect(3, 0); - struct brw_indirect inlist_ptr = brw_indirect(4, 0); - struct brw_indirect outlist_ptr = brw_indirect(5, 0); - struct brw_indirect freelist_ptr = brw_indirect(6, 0); - struct brw_instruction *plane_loop; - struct brw_instruction *plane_active; - struct brw_instruction *vertex_loop; - struct brw_instruction *next_test; - struct brw_instruction *prev_test; - - brw_MOV(p, get_addr_reg(vtxPrev), brw_address(c->reg.vertex[2]) ); - brw_MOV(p, get_addr_reg(plane_ptr), brw_clip_plane0_address(c)); - brw_MOV(p, get_addr_reg(inlist_ptr), brw_address(c->reg.inlist)); - brw_MOV(p, get_addr_reg(outlist_ptr), brw_address(c->reg.outlist)); - - brw_MOV(p, get_addr_reg(freelist_ptr), brw_address(c->reg.vertex[3]) ); - - plane_loop = brw_DO(p, BRW_EXECUTE_1); - { - /* if (planemask & 1) - */ - brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); - brw_AND(p, vec1(brw_null_reg()), c->reg.planemask, brw_imm_ud(1)); - - plane_active = brw_IF(p, BRW_EXECUTE_1); - { - /* vtxOut = freelist_ptr++ - */ - brw_MOV(p, get_addr_reg(vtxOut), get_addr_reg(freelist_ptr) ); - brw_ADD(p, get_addr_reg(freelist_ptr), get_addr_reg(freelist_ptr), brw_imm_uw(c->nr_regs * REG_SIZE)); - - if (c->key.nr_userclip) - brw_MOV(p, c->reg.plane_equation, deref_4f(plane_ptr, 0)); - else - brw_MOV(p, c->reg.plane_equation, deref_4b(plane_ptr, 0)); - - brw_MOV(p, c->reg.loopcount, c->reg.nr_verts); - brw_MOV(p, c->reg.nr_verts, brw_imm_ud(0)); - - vertex_loop = brw_DO(p, BRW_EXECUTE_1); - { - /* vtx = *input_ptr; - */ - brw_MOV(p, get_addr_reg(vtx), deref_1uw(inlist_ptr, 0)); - - /* IS_NEGATIVE(prev) */ - brw_set_conditionalmod(p, BRW_CONDITIONAL_L); - brw_DP4(p, vec4(c->reg.dpPrev), deref_4f(vtxPrev, c->offset[VERT_RESULT_HPOS]), c->reg.plane_equation); - prev_test = brw_IF(p, BRW_EXECUTE_1); - { - /* IS_POSITIVE(next) - */ - brw_set_conditionalmod(p, BRW_CONDITIONAL_GE); - brw_DP4(p, vec4(c->reg.dp), deref_4f(vtx, c->offset[VERT_RESULT_HPOS]), c->reg.plane_equation); - next_test = brw_IF(p, BRW_EXECUTE_1); - { - - /* Coming back in. - */ - brw_ADD(p, c->reg.t, c->reg.dpPrev, negate(c->reg.dp)); - brw_math_invert(p, c->reg.t, c->reg.t); - brw_MUL(p, c->reg.t, c->reg.t, c->reg.dpPrev); - - /* If (vtxOut == 0) vtxOut = vtxPrev - */ - brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_EQ, get_addr_reg(vtxOut), brw_imm_uw(0) ); - brw_MOV(p, get_addr_reg(vtxOut), get_addr_reg(vtxPrev) ); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - - brw_clip_interp_vertex(c, vtxOut, vtxPrev, vtx, c->reg.t, FALSE); - - /* *outlist_ptr++ = vtxOut; - * nr_verts++; - * vtxOut = 0; - */ - brw_MOV(p, deref_1uw(outlist_ptr, 0), get_addr_reg(vtxOut)); - brw_ADD(p, get_addr_reg(outlist_ptr), get_addr_reg(outlist_ptr), brw_imm_uw(sizeof(short))); - brw_ADD(p, c->reg.nr_verts, c->reg.nr_verts, brw_imm_ud(1)); - brw_MOV(p, get_addr_reg(vtxOut), brw_imm_uw(0) ); - } - brw_ENDIF(p, next_test); - - } - prev_test = brw_ELSE(p, prev_test); - { - /* *outlist_ptr++ = vtxPrev; - * nr_verts++; - */ - brw_MOV(p, deref_1uw(outlist_ptr, 0), get_addr_reg(vtxPrev)); - brw_ADD(p, get_addr_reg(outlist_ptr), get_addr_reg(outlist_ptr), brw_imm_uw(sizeof(short))); - brw_ADD(p, c->reg.nr_verts, c->reg.nr_verts, brw_imm_ud(1)); - - /* IS_NEGATIVE(next) - */ - brw_set_conditionalmod(p, BRW_CONDITIONAL_L); - brw_DP4(p, vec4(c->reg.dp), deref_4f(vtx, c->offset[VERT_RESULT_HPOS]), c->reg.plane_equation); - next_test = brw_IF(p, BRW_EXECUTE_1); - { - /* Going out of bounds. Avoid division by zero as we - * know dp != dpPrev from DIFFERENT_SIGNS, above. - */ - brw_ADD(p, c->reg.t, c->reg.dp, negate(c->reg.dpPrev)); - brw_math_invert(p, c->reg.t, c->reg.t); - brw_MUL(p, c->reg.t, c->reg.t, c->reg.dp); - - /* If (vtxOut == 0) vtxOut = vtx - */ - brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_EQ, get_addr_reg(vtxOut), brw_imm_uw(0) ); - brw_MOV(p, get_addr_reg(vtxOut), get_addr_reg(vtx) ); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - - brw_clip_interp_vertex(c, vtxOut, vtx, vtxPrev, c->reg.t, TRUE); - - /* *outlist_ptr++ = vtxOut; - * nr_verts++; - * vtxOut = 0; - */ - brw_MOV(p, deref_1uw(outlist_ptr, 0), get_addr_reg(vtxOut)); - brw_ADD(p, get_addr_reg(outlist_ptr), get_addr_reg(outlist_ptr), brw_imm_uw(sizeof(short))); - brw_ADD(p, c->reg.nr_verts, c->reg.nr_verts, brw_imm_ud(1)); - brw_MOV(p, get_addr_reg(vtxOut), brw_imm_uw(0) ); - } - brw_ENDIF(p, next_test); - } - brw_ENDIF(p, prev_test); - - /* vtxPrev = vtx; - * inlist_ptr++; - */ - brw_MOV(p, get_addr_reg(vtxPrev), get_addr_reg(vtx)); - brw_ADD(p, get_addr_reg(inlist_ptr), get_addr_reg(inlist_ptr), brw_imm_uw(sizeof(short))); - - /* while (--loopcount != 0) - */ - brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); - brw_ADD(p, c->reg.loopcount, c->reg.loopcount, brw_imm_d(-1)); - } - brw_WHILE(p, vertex_loop); - - /* vtxPrev = *(outlist_ptr-1) OR: outlist[nr_verts-1] - * inlist = outlist - * inlist_ptr = &inlist[0] - * outlist_ptr = &outlist[0] - */ - brw_ADD(p, get_addr_reg(outlist_ptr), get_addr_reg(outlist_ptr), brw_imm_w(-2)); - brw_MOV(p, get_addr_reg(vtxPrev), deref_1uw(outlist_ptr, 0)); - brw_MOV(p, brw_vec8_grf(c->reg.inlist.nr, 0), brw_vec8_grf(c->reg.outlist.nr, 0)); - brw_MOV(p, get_addr_reg(inlist_ptr), brw_address(c->reg.inlist)); - brw_MOV(p, get_addr_reg(outlist_ptr), brw_address(c->reg.outlist)); - } - brw_ENDIF(p, plane_active); - - /* plane_ptr++; - */ - brw_ADD(p, get_addr_reg(plane_ptr), get_addr_reg(plane_ptr), brw_clip_plane_stride(c)); - - /* nr_verts >= 3 - */ - brw_CMP(p, - vec1(brw_null_reg()), - BRW_CONDITIONAL_GE, - c->reg.nr_verts, - brw_imm_ud(3)); - - /* && (planemask>>=1) != 0 - */ - brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); - brw_SHR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud(1)); - } - brw_WHILE(p, plane_loop); -#else - #warning "disabled" -#endif -} - - - -void brw_clip_tri_emit_polygon(struct brw_clip_compile *c) -{ - struct brw_compile *p = &c->func; - struct brw_instruction *loop, *if_insn; - - /* for (loopcount = nr_verts-2; loopcount > 0; loopcount--) - */ - brw_set_conditionalmod(p, BRW_CONDITIONAL_G); - brw_ADD(p, - c->reg.loopcount, - c->reg.nr_verts, - brw_imm_d(-2)); - - if_insn = brw_IF(p, BRW_EXECUTE_1); - { - struct brw_indirect v0 = brw_indirect(0, 0); - struct brw_indirect vptr = brw_indirect(1, 0); - - brw_MOV(p, get_addr_reg(vptr), brw_address(c->reg.inlist)); - brw_MOV(p, get_addr_reg(v0), deref_1uw(vptr, 0)); - - brw_clip_emit_vue(c, v0, 1, 0, ((_3DPRIM_TRIFAN << 2) | R02_PRIM_START)); - - brw_ADD(p, get_addr_reg(vptr), get_addr_reg(vptr), brw_imm_uw(2)); - brw_MOV(p, get_addr_reg(v0), deref_1uw(vptr, 0)); - - loop = brw_DO(p, BRW_EXECUTE_1); - { - brw_clip_emit_vue(c, v0, 1, 0, (_3DPRIM_TRIFAN << 2)); - - brw_ADD(p, get_addr_reg(vptr), get_addr_reg(vptr), brw_imm_uw(2)); - brw_MOV(p, get_addr_reg(v0), deref_1uw(vptr, 0)); - - brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); - brw_ADD(p, c->reg.loopcount, c->reg.loopcount, brw_imm_d(-1)); - } - brw_WHILE(p, loop); - - brw_clip_emit_vue(c, v0, 0, 1, ((_3DPRIM_TRIFAN << 2) | R02_PRIM_END)); - } - brw_ENDIF(p, if_insn); -} - -static void do_clip_tri( struct brw_clip_compile *c ) -{ - brw_clip_init_planes(c); - - brw_clip_tri(c); -} - - -static void maybe_do_clip_tri( struct brw_clip_compile *c ) -{ - struct brw_compile *p = &c->func; - struct brw_instruction *do_clip; - - brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_NZ, c->reg.planemask, brw_imm_ud(0)); - do_clip = brw_IF(p, BRW_EXECUTE_1); - { - do_clip_tri(c); - } - brw_ENDIF(p, do_clip); -} - -static void brw_clip_test( struct brw_clip_compile *c ) -{ -#if 0 - struct brw_reg t = retype(get_tmp(c), BRW_REGISTER_TYPE_UD); - struct brw_reg t1 = retype(get_tmp(c), BRW_REGISTER_TYPE_UD); - struct brw_reg t2 = retype(get_tmp(c), BRW_REGISTER_TYPE_UD); - struct brw_reg t3 = retype(get_tmp(c), BRW_REGISTER_TYPE_UD); - - struct brw_reg v0 = get_tmp(c); - struct brw_reg v1 = get_tmp(c); - struct brw_reg v2 = get_tmp(c); - - struct brw_indirect vt0 = brw_indirect(0, 0); - struct brw_indirect vt1 = brw_indirect(1, 0); - struct brw_indirect vt2 = brw_indirect(2, 0); - - struct brw_compile *p = &c->func; - - brw_MOV(p, get_addr_reg(vt0), brw_address(c->reg.vertex[0])); - brw_MOV(p, get_addr_reg(vt1), brw_address(c->reg.vertex[1])); - brw_MOV(p, get_addr_reg(vt2), brw_address(c->reg.vertex[2])); - brw_MOV(p, v0, deref_4f(vt0, c->offset[VERT_RESULT_HPOS])); - brw_MOV(p, v1, deref_4f(vt1, c->offset[VERT_RESULT_HPOS])); - brw_MOV(p, v2, deref_4f(vt2, c->offset[VERT_RESULT_HPOS])); - - /* test nearz, xmin, ymin plane */ - brw_CMP(p, t1, BRW_CONDITIONAL_LE, negate(v0), get_element(v0, 3)); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - brw_CMP(p, t2, BRW_CONDITIONAL_LE, negate(v1), get_element(v1, 3)); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - brw_CMP(p, t3, BRW_CONDITIONAL_LE, negate(v2), get_element(v2, 3)); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - brw_XOR(p, t, t1, t2); - brw_XOR(p, t1, t2, t3); - brw_OR(p, t, t, t1); - - brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ, - get_element(t, 0), brw_imm_ud(0)); - brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<5))); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ, - get_element(t, 1), brw_imm_ud(0)); - brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<3))); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ, - get_element(t, 2), brw_imm_ud(0)); - brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<1))); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - - /* test farz, xmax, ymax plane */ - brw_CMP(p, t1, BRW_CONDITIONAL_L, v0, get_element(v0, 3)); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - brw_CMP(p, t2, BRW_CONDITIONAL_L, v1, get_element(v1, 3)); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - brw_CMP(p, t3, BRW_CONDITIONAL_L, v2, get_element(v2, 3)); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - - brw_XOR(p, t, t1, t2); - brw_XOR(p, t1, t2, t3); - brw_OR(p, t, t, t1); - - brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ, - get_element(t, 0), brw_imm_ud(0)); - brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<4))); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ, - get_element(t, 1), brw_imm_ud(0)); - brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<2))); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_NZ, - get_element(t, 2), brw_imm_ud(0)); - brw_OR(p, c->reg.planemask, c->reg.planemask, brw_imm_ud((1<<0))); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - - release_tmps(c); -#else - #warning "disabled" -#endif -} - - -void brw_emit_tri_clip( struct brw_clip_compile *c ) -{ - struct brw_instruction *neg_rhw; - struct brw_compile *p = &c->func; - brw_clip_tri_alloc_regs(c, 3 + c->key.nr_userclip + 6); - brw_clip_tri_init_vertices(c); - brw_clip_init_clipmask(c); - - /* if -ve rhw workaround bit is set, - do cliptest */ - brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); - brw_AND(p, brw_null_reg(), get_element_ud(c->reg.R0, 2), - brw_imm_ud(1<<20)); - neg_rhw = brw_IF(p, BRW_EXECUTE_1); - { - brw_clip_test(c); - } - brw_ENDIF(p, neg_rhw); - - /* Can't push into do_clip_tri because with polygon (or quad) - * flatshading, need to apply the flatshade here because we don't - * respect the PV when converting to trifan for emit: - */ - if (c->key.do_flat_shading) - brw_clip_tri_flat_shade(c); - - if (c->key.clip_mode == BRW_CLIPMODE_NORMAL) - do_clip_tri(c); - else - maybe_do_clip_tri(c); - - brw_clip_tri_emit_polygon(c); - - /* Send an empty message to kill the thread: - */ - brw_clip_kill_thread(c); -} diff --git a/src/gallium/drivers/i965simple/brw_clip_unfilled.c b/src/gallium/drivers/i965simple/brw_clip_unfilled.c deleted file mode 100644 index b774a76dd6..0000000000 --- a/src/gallium/drivers/i965simple/brw_clip_unfilled.c +++ /dev/null @@ -1,477 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - -#include "brw_defines.h" -#include "brw_context.h" -#include "brw_eu.h" -#include "brw_util.h" -#include "brw_clip.h" - - - -/* This is performed against the original triangles, so no indirection - * required: -BZZZT! - */ -static void compute_tri_direction( struct brw_clip_compile *c ) -{ - struct brw_compile *p = &c->func; - struct brw_reg e = c->reg.tmp0; - struct brw_reg f = c->reg.tmp1; - struct brw_reg v0 = byte_offset(c->reg.vertex[0], c->offset[VERT_RESULT_HPOS]); - struct brw_reg v1 = byte_offset(c->reg.vertex[1], c->offset[VERT_RESULT_HPOS]); - struct brw_reg v2 = byte_offset(c->reg.vertex[2], c->offset[VERT_RESULT_HPOS]); - - - /* Calculate the vectors of two edges of the triangle: - */ - brw_ADD(p, e, v0, negate(v2)); - brw_ADD(p, f, v1, negate(v2)); - - /* Take their crossproduct: - */ - brw_set_access_mode(p, BRW_ALIGN_16); - brw_MUL(p, vec4(brw_null_reg()), brw_swizzle(e, 1,2,0,3), brw_swizzle(f,2,0,1,3)); - brw_MAC(p, vec4(e), negate(brw_swizzle(e, 2,0,1,3)), brw_swizzle(f,1,2,0,3)); - brw_set_access_mode(p, BRW_ALIGN_1); - - brw_MUL(p, c->reg.dir, c->reg.dir, vec4(e)); -} - - -static void cull_direction( struct brw_clip_compile *c ) -{ - struct brw_compile *p = &c->func; - struct brw_instruction *ccw; - unsigned conditional; - - assert (!(c->key.fill_ccw == CLIP_CULL && - c->key.fill_cw == CLIP_CULL)); - - if (c->key.fill_ccw == CLIP_CULL) - conditional = BRW_CONDITIONAL_GE; - else - conditional = BRW_CONDITIONAL_L; - - brw_CMP(p, - vec1(brw_null_reg()), - conditional, - get_element(c->reg.dir, 2), - brw_imm_f(0)); - - ccw = brw_IF(p, BRW_EXECUTE_1); - { - brw_clip_kill_thread(c); - } - brw_ENDIF(p, ccw); -} - - - -static void copy_bfc( struct brw_clip_compile *c ) -{ - struct brw_compile *p = &c->func; - struct brw_instruction *ccw; - unsigned conditional; - - /* Do we have any colors to copy? - */ - if (!(c->offset[VERT_RESULT_COL0] && c->offset[VERT_RESULT_BFC0]) && - !(c->offset[VERT_RESULT_COL1] && c->offset[VERT_RESULT_BFC1])) - return; - - /* In some wierd degnerate cases we can end up testing the - * direction twice, once for culling and once for bfc copying. Oh - * well, that's what you get for setting wierd GL state. - */ - if (c->key.copy_bfc_ccw) - conditional = BRW_CONDITIONAL_GE; - else - conditional = BRW_CONDITIONAL_L; - - brw_CMP(p, - vec1(brw_null_reg()), - conditional, - get_element(c->reg.dir, 2), - brw_imm_f(0)); - - ccw = brw_IF(p, BRW_EXECUTE_1); - { - unsigned i; - - for (i = 0; i < 3; i++) { - if (c->offset[VERT_RESULT_COL0] && c->offset[VERT_RESULT_BFC0]) - brw_MOV(p, - byte_offset(c->reg.vertex[i], c->offset[VERT_RESULT_COL0]), - byte_offset(c->reg.vertex[i], c->offset[VERT_RESULT_BFC0])); - - if (c->offset[VERT_RESULT_COL1] && c->offset[VERT_RESULT_BFC1]) - brw_MOV(p, - byte_offset(c->reg.vertex[i], c->offset[VERT_RESULT_COL1]), - byte_offset(c->reg.vertex[i], c->offset[VERT_RESULT_BFC1])); - } - } - brw_ENDIF(p, ccw); -} - - - - -/* - float iz = 1.0 / dir.z; - float ac = dir.x * iz; - float bc = dir.y * iz; - offset = ctx->Polygon.OffsetUnits * DEPTH_SCALE; - offset += MAX2( abs(ac), abs(bc) ) * ctx->Polygon.OffsetFactor; - offset *= MRD; -*/ -static void compute_offset( struct brw_clip_compile *c ) -{ - struct brw_compile *p = &c->func; - struct brw_reg off = c->reg.offset; - struct brw_reg dir = c->reg.dir; - - brw_math_invert(p, get_element(off, 2), get_element(dir, 2)); - brw_MUL(p, vec2(off), dir, get_element(off, 2)); - - brw_CMP(p, - vec1(brw_null_reg()), - BRW_CONDITIONAL_GE, - brw_abs(get_element(off, 0)), - brw_abs(get_element(off, 1))); - - brw_SEL(p, vec1(off), brw_abs(get_element(off, 0)), brw_abs(get_element(off, 1))); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - - brw_MUL(p, vec1(off), off, brw_imm_f(c->key.offset_factor)); - brw_ADD(p, vec1(off), off, brw_imm_f(c->key.offset_units)); -} - - -static void merge_edgeflags( struct brw_clip_compile *c ) -{ - struct brw_compile *p = &c->func; - struct brw_instruction *is_poly; - struct brw_reg tmp0 = get_element_ud(c->reg.tmp0, 0); - - brw_AND(p, tmp0, get_element_ud(c->reg.R0, 2), brw_imm_ud(PRIM_MASK)); - brw_CMP(p, - vec1(brw_null_reg()), - BRW_CONDITIONAL_EQ, - tmp0, - brw_imm_ud(_3DPRIM_POLYGON)); - - /* Get away with using reg.vertex because we know that this is not - * a _3DPRIM_TRISTRIP_REVERSE: - */ - is_poly = brw_IF(p, BRW_EXECUTE_1); - { - brw_set_conditionalmod(p, BRW_CONDITIONAL_EQ); - brw_AND(p, vec1(brw_null_reg()), get_element_ud(c->reg.R0, 2), brw_imm_ud(1<<8)); - brw_MOV(p, byte_offset(c->reg.vertex[0], c->offset[VERT_RESULT_EDGE]), brw_imm_f(0)); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - - brw_set_conditionalmod(p, BRW_CONDITIONAL_EQ); - brw_AND(p, vec1(brw_null_reg()), get_element_ud(c->reg.R0, 2), brw_imm_ud(1<<9)); - brw_MOV(p, byte_offset(c->reg.vertex[2], c->offset[VERT_RESULT_EDGE]), brw_imm_f(0)); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - } - brw_ENDIF(p, is_poly); -} - - - -static void apply_one_offset( struct brw_clip_compile *c, - struct brw_indirect vert ) -{ - struct brw_compile *p = &c->func; - struct brw_reg pos = deref_4f(vert, c->offset[VERT_RESULT_HPOS]); - struct brw_reg z = get_element(pos, 2); - - brw_ADD(p, z, z, vec1(c->reg.offset)); -} - - - -/*********************************************************************** - * Output clipped polygon as an unfilled primitive: - */ -static void emit_lines(struct brw_clip_compile *c, - boolean do_offset) -{ - struct brw_compile *p = &c->func; - struct brw_instruction *loop; - struct brw_instruction *draw_edge; - struct brw_indirect v0 = brw_indirect(0, 0); - struct brw_indirect v1 = brw_indirect(1, 0); - struct brw_indirect v0ptr = brw_indirect(2, 0); - struct brw_indirect v1ptr = brw_indirect(3, 0); - - /* Need a seperate loop for offset: - */ - if (do_offset) { - brw_MOV(p, c->reg.loopcount, c->reg.nr_verts); - brw_MOV(p, get_addr_reg(v0ptr), brw_address(c->reg.inlist)); - - loop = brw_DO(p, BRW_EXECUTE_1); - { - brw_MOV(p, get_addr_reg(v0), deref_1uw(v0ptr, 0)); - brw_ADD(p, get_addr_reg(v0ptr), get_addr_reg(v0ptr), brw_imm_uw(2)); - - apply_one_offset(c, v0); - - brw_set_conditionalmod(p, BRW_CONDITIONAL_G); - brw_ADD(p, c->reg.loopcount, c->reg.loopcount, brw_imm_d(-1)); - } - brw_WHILE(p, loop); - } - - /* v1ptr = &inlist[nr_verts] - * *v1ptr = v0 - */ - brw_MOV(p, c->reg.loopcount, c->reg.nr_verts); - brw_MOV(p, get_addr_reg(v0ptr), brw_address(c->reg.inlist)); - brw_ADD(p, get_addr_reg(v1ptr), get_addr_reg(v0ptr), retype(c->reg.nr_verts, BRW_REGISTER_TYPE_UW)); - brw_ADD(p, get_addr_reg(v1ptr), get_addr_reg(v1ptr), retype(c->reg.nr_verts, BRW_REGISTER_TYPE_UW)); - brw_MOV(p, deref_1uw(v1ptr, 0), deref_1uw(v0ptr, 0)); - - loop = brw_DO(p, BRW_EXECUTE_1); - { - brw_MOV(p, get_addr_reg(v0), deref_1uw(v0ptr, 0)); - brw_MOV(p, get_addr_reg(v1), deref_1uw(v0ptr, 2)); - brw_ADD(p, get_addr_reg(v0ptr), get_addr_reg(v0ptr), brw_imm_uw(2)); - - /* draw edge if edgeflag != 0 */ - brw_CMP(p, - vec1(brw_null_reg()), BRW_CONDITIONAL_NZ, - deref_1f(v0, c->offset[VERT_RESULT_EDGE]), - brw_imm_f(0)); - draw_edge = brw_IF(p, BRW_EXECUTE_1); - { - brw_clip_emit_vue(c, v0, 1, 0, (_3DPRIM_LINESTRIP << 2) | R02_PRIM_START); - brw_clip_emit_vue(c, v1, 1, 0, (_3DPRIM_LINESTRIP << 2) | R02_PRIM_END); - } - brw_ENDIF(p, draw_edge); - - brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); - brw_ADD(p, c->reg.loopcount, c->reg.loopcount, brw_imm_d(-1)); - } - brw_WHILE(p, loop); -} - - - -static void emit_points(struct brw_clip_compile *c, - boolean do_offset ) -{ - struct brw_compile *p = &c->func; - struct brw_instruction *loop; - struct brw_instruction *draw_point; - - struct brw_indirect v0 = brw_indirect(0, 0); - struct brw_indirect v0ptr = brw_indirect(2, 0); - - brw_MOV(p, c->reg.loopcount, c->reg.nr_verts); - brw_MOV(p, get_addr_reg(v0ptr), brw_address(c->reg.inlist)); - - loop = brw_DO(p, BRW_EXECUTE_1); - { - brw_MOV(p, get_addr_reg(v0), deref_1uw(v0ptr, 0)); - brw_ADD(p, get_addr_reg(v0ptr), get_addr_reg(v0ptr), brw_imm_uw(2)); - - /* draw if edgeflag != 0 - */ - brw_CMP(p, - vec1(brw_null_reg()), BRW_CONDITIONAL_NZ, - deref_1f(v0, c->offset[VERT_RESULT_EDGE]), - brw_imm_f(0)); - draw_point = brw_IF(p, BRW_EXECUTE_1); - { - if (do_offset) - apply_one_offset(c, v0); - - brw_clip_emit_vue(c, v0, 1, 0, (_3DPRIM_POINTLIST << 2) | R02_PRIM_START | R02_PRIM_END); - } - brw_ENDIF(p, draw_point); - - brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); - brw_ADD(p, c->reg.loopcount, c->reg.loopcount, brw_imm_d(-1)); - } - brw_WHILE(p, loop); -} - - - - - - - -static void emit_primitives( struct brw_clip_compile *c, - unsigned mode, - boolean do_offset ) -{ - switch (mode) { - case CLIP_FILL: - brw_clip_tri_emit_polygon(c); - break; - - case CLIP_LINE: - emit_lines(c, do_offset); - break; - - case CLIP_POINT: - emit_points(c, do_offset); - break; - - case CLIP_CULL: - assert(0); - break; - } -} - - - -static void emit_unfilled_primitives( struct brw_clip_compile *c ) -{ - struct brw_compile *p = &c->func; - struct brw_instruction *ccw; - - /* Direction culling has already been done. - */ - if (c->key.fill_ccw != c->key.fill_cw && - c->key.fill_ccw != CLIP_CULL && - c->key.fill_cw != CLIP_CULL) - { - brw_CMP(p, - vec1(brw_null_reg()), - BRW_CONDITIONAL_GE, - get_element(c->reg.dir, 2), - brw_imm_f(0)); - - ccw = brw_IF(p, BRW_EXECUTE_1); - { - emit_primitives(c, c->key.fill_ccw, c->key.offset_ccw); - } - ccw = brw_ELSE(p, ccw); - { - emit_primitives(c, c->key.fill_cw, c->key.offset_cw); - } - brw_ENDIF(p, ccw); - } - else if (c->key.fill_cw != CLIP_CULL) { - emit_primitives(c, c->key.fill_cw, c->key.offset_cw); - } - else if (c->key.fill_ccw != CLIP_CULL) { - emit_primitives(c, c->key.fill_ccw, c->key.offset_ccw); - } -} - - - - -static void check_nr_verts( struct brw_clip_compile *c ) -{ - struct brw_compile *p = &c->func; - struct brw_instruction *if_insn; - - brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_L, c->reg.nr_verts, brw_imm_d(3)); - if_insn = brw_IF(p, BRW_EXECUTE_1); - { - brw_clip_kill_thread(c); - } - brw_ENDIF(p, if_insn); -} - - -void brw_emit_unfilled_clip( struct brw_clip_compile *c ) -{ - struct brw_compile *p = &c->func; - struct brw_instruction *do_clip; - - - c->need_direction = ((c->key.offset_ccw || c->key.offset_cw) || - (c->key.fill_ccw != c->key.fill_cw) || - c->key.fill_ccw == CLIP_CULL || - c->key.fill_cw == CLIP_CULL || - c->key.copy_bfc_cw || - c->key.copy_bfc_ccw); - - brw_clip_tri_alloc_regs(c, 3 + c->key.nr_userclip + 6); - brw_clip_tri_init_vertices(c); - - assert(c->offset[VERT_RESULT_EDGE]); - - if (c->key.fill_ccw == CLIP_CULL && - c->key.fill_cw == CLIP_CULL) { - brw_clip_kill_thread(c); - return; - } - - merge_edgeflags(c); - - /* Need to use the inlist indirection here: - */ - if (c->need_direction) - compute_tri_direction(c); - - if (c->key.fill_ccw == CLIP_CULL || - c->key.fill_cw == CLIP_CULL) - cull_direction(c); - - if (c->key.offset_ccw || - c->key.offset_cw) - compute_offset(c); - - if (c->key.copy_bfc_ccw || - c->key.copy_bfc_cw) - copy_bfc(c); - - /* Need to do this whether we clip or not: - */ - if (c->key.do_flat_shading) - brw_clip_tri_flat_shade(c); - - brw_clip_init_clipmask(c); - brw_CMP(p, vec1(brw_null_reg()), BRW_CONDITIONAL_NZ, c->reg.planemask, brw_imm_ud(0)); - do_clip = brw_IF(p, BRW_EXECUTE_1); - { - brw_clip_init_planes(c); - brw_clip_tri(c); - check_nr_verts(c); - } - brw_ENDIF(p, do_clip); - - emit_unfilled_primitives(c); - brw_clip_kill_thread(c); -} - - - diff --git a/src/gallium/drivers/i965simple/brw_clip_util.c b/src/gallium/drivers/i965simple/brw_clip_util.c deleted file mode 100644 index 6d58ceafff..0000000000 --- a/src/gallium/drivers/i965simple/brw_clip_util.c +++ /dev/null @@ -1,351 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#include "brw_defines.h" -#include "brw_context.h" -#include "brw_eu.h" -#include "brw_util.h" -#include "brw_clip.h" - - - - - -static struct brw_reg get_tmp( struct brw_clip_compile *c ) -{ - struct brw_reg tmp = brw_vec4_grf(c->last_tmp, 0); - - if (++c->last_tmp > c->prog_data.total_grf) - c->prog_data.total_grf = c->last_tmp; - - return tmp; -} - -static void release_tmp( struct brw_clip_compile *c, struct brw_reg tmp ) -{ - if (tmp.nr == c->last_tmp-1) - c->last_tmp--; -} - - -static struct brw_reg make_plane_ud(unsigned x, unsigned y, unsigned z, unsigned w) -{ - return brw_imm_ud((w<<24) | (z<<16) | (y<<8) | x); -} - - -void brw_clip_init_planes( struct brw_clip_compile *c ) -{ - struct brw_compile *p = &c->func; - - if (!c->key.nr_userclip) { - brw_MOV(p, get_element_ud(c->reg.fixed_planes, 0), make_plane_ud( 0, 0, 0xff, 1)); - brw_MOV(p, get_element_ud(c->reg.fixed_planes, 1), make_plane_ud( 0, 0, 1, 1)); - brw_MOV(p, get_element_ud(c->reg.fixed_planes, 2), make_plane_ud( 0, 0xff, 0, 1)); - brw_MOV(p, get_element_ud(c->reg.fixed_planes, 3), make_plane_ud( 0, 1, 0, 1)); - brw_MOV(p, get_element_ud(c->reg.fixed_planes, 4), make_plane_ud(0xff, 0, 0, 1)); - brw_MOV(p, get_element_ud(c->reg.fixed_planes, 5), make_plane_ud( 1, 0, 0, 1)); - } -} - - - -#define W 3 - -/* Project 'pos' to screen space (or back again), overwrite with results: - */ -static void brw_clip_project_position(struct brw_clip_compile *c, struct brw_reg pos ) -{ - struct brw_compile *p = &c->func; - - /* calc rhw - */ - brw_math_invert(p, get_element(pos, W), get_element(pos, W)); - - /* value.xyz *= value.rhw - */ - brw_set_access_mode(p, BRW_ALIGN_16); - brw_MUL(p, brw_writemask(pos, TGSI_WRITEMASK_XYZ), pos, brw_swizzle1(pos, W)); - brw_set_access_mode(p, BRW_ALIGN_1); -} - - -static void brw_clip_project_vertex( struct brw_clip_compile *c, - struct brw_indirect vert_addr ) -{ -#if 0 - struct brw_compile *p = &c->func; - struct brw_reg tmp = get_tmp(c); - - /* Fixup position. Extract from the original vertex and re-project - * to screen space: - */ - brw_MOV(p, tmp, deref_4f(vert_addr, c->offset[VERT_RESULT_HPOS])); - brw_clip_project_position(c, tmp); - brw_MOV(p, deref_4f(vert_addr, c->header_position_offset), tmp); - - release_tmp(c, tmp); -#else - #warning "disabled" -#endif -} - - - - -/* Interpolate between two vertices and put the result into a0.0. - * Increment a0.0 accordingly. - */ -void brw_clip_interp_vertex( struct brw_clip_compile *c, - struct brw_indirect dest_ptr, - struct brw_indirect v0_ptr, /* from */ - struct brw_indirect v1_ptr, /* to */ - struct brw_reg t0, - boolean force_edgeflag) -{ -#if 0 - struct brw_compile *p = &c->func; - struct brw_reg tmp = get_tmp(c); - unsigned i; - - /* Just copy the vertex header: - */ - brw_copy_indirect_to_indirect(p, dest_ptr, v0_ptr, 1); - - /* Iterate over each attribute (could be done in pairs?) - */ - for (i = 0; i < c->nr_attrs; i++) { - unsigned delta = i*16 + 32; - - if (delta == c->offset[VERT_RESULT_EDGE]) { - if (force_edgeflag) - brw_MOV(p, deref_4f(dest_ptr, delta), brw_imm_f(1)); - else - brw_MOV(p, deref_4f(dest_ptr, delta), deref_4f(v0_ptr, delta)); - } - else { - /* Interpolate: - * - * New = attr0 + t*attr1 - t*attr0 - */ - brw_MUL(p, - vec4(brw_null_reg()), - deref_4f(v1_ptr, delta), - t0); - - brw_MAC(p, - tmp, - negate(deref_4f(v0_ptr, delta)), - t0); - - brw_ADD(p, - deref_4f(dest_ptr, delta), - deref_4f(v0_ptr, delta), - tmp); - } - } - - if (i & 1) { - unsigned delta = i*16 + 32; - brw_MOV(p, deref_4f(dest_ptr, delta), brw_imm_f(0)); - } - - release_tmp(c, tmp); - - /* Recreate the projected (NDC) coordinate in the new vertex - * header: - */ - brw_clip_project_vertex(c, dest_ptr ); -#else - #warning "disabled" -#endif -} - - - - -#define MAX_MRF 16 - -void brw_clip_emit_vue(struct brw_clip_compile *c, - struct brw_indirect vert, - boolean allocate, - boolean eot, - unsigned header) -{ - struct brw_compile *p = &c->func; - unsigned start = c->last_mrf; - - assert(!(allocate && eot)); - - /* Cycle through mrf regs - probably futile as we have to wait for - * the allocation response anyway. Also, the order this function - * is invoked doesn't correspond to the order the instructions will - * be executed, so it won't have any effect in many cases. - */ -#if 0 - if (start + c->nr_regs + 1 >= MAX_MRF) - start = 0; - - c->last_mrf = start + c->nr_regs + 1; -#endif - - /* Copy the vertex from vertn into m1..mN+1: - */ - brw_copy_from_indirect(p, brw_message_reg(start+1), vert, c->nr_regs); - - /* Overwrite PrimType and PrimStart in the message header, for - * each vertex in turn: - */ - brw_MOV(p, get_element_ud(c->reg.R0, 2), brw_imm_ud(header)); - - - /* Send each vertex as a seperate write to the urb. This - * is different to the concept in brw_sf_emit.c, where - * subsequent writes are used to build up a single urb - * entry. Each of these writes instantiates a seperate - * urb entry - (I think... what about 'allocate'?) - */ - brw_urb_WRITE(p, - allocate ? c->reg.R0 : retype(brw_null_reg(), BRW_REGISTER_TYPE_UD), - start, - c->reg.R0, - allocate, - 1, /* used */ - c->nr_regs + 1, /* msg length */ - allocate ? 1 : 0, /* response_length */ - eot, /* eot */ - 1, /* writes_complete */ - 0, /* urb offset */ - BRW_URB_SWIZZLE_NONE); -} - - - -void brw_clip_kill_thread(struct brw_clip_compile *c) -{ - struct brw_compile *p = &c->func; - - /* Send an empty message to kill the thread and release any - * allocated urb entry: - */ - brw_urb_WRITE(p, - retype(brw_null_reg(), BRW_REGISTER_TYPE_UD), - 0, - c->reg.R0, - 0, /* allocate */ - 0, /* used */ - 0, /* msg len */ - 0, /* response len */ - 1, /* eot */ - 1, /* writes complete */ - 0, - BRW_URB_SWIZZLE_NONE); -} - - - - -struct brw_reg brw_clip_plane0_address( struct brw_clip_compile *c ) -{ - return brw_address(c->reg.fixed_planes); -} - - -struct brw_reg brw_clip_plane_stride( struct brw_clip_compile *c ) -{ - if (c->key.nr_userclip) { - return brw_imm_uw(16); - } - else { - return brw_imm_uw(4); - } -} - - -/* If flatshading, distribute color from provoking vertex prior to - * clipping. - */ -void brw_clip_copy_colors( struct brw_clip_compile *c, - unsigned to, unsigned from ) -{ -#if 0 - struct brw_compile *p = &c->func; - - if (c->offset[VERT_RESULT_COL0]) - brw_MOV(p, - byte_offset(c->reg.vertex[to], c->offset[VERT_RESULT_COL0]), - byte_offset(c->reg.vertex[from], c->offset[VERT_RESULT_COL0])); - - if (c->offset[VERT_RESULT_COL1]) - brw_MOV(p, - byte_offset(c->reg.vertex[to], c->offset[VERT_RESULT_COL1]), - byte_offset(c->reg.vertex[from], c->offset[VERT_RESULT_COL1])); - - if (c->offset[VERT_RESULT_BFC0]) - brw_MOV(p, - byte_offset(c->reg.vertex[to], c->offset[VERT_RESULT_BFC0]), - byte_offset(c->reg.vertex[from], c->offset[VERT_RESULT_BFC0])); - - if (c->offset[VERT_RESULT_BFC1]) - brw_MOV(p, - byte_offset(c->reg.vertex[to], c->offset[VERT_RESULT_BFC1]), - byte_offset(c->reg.vertex[from], c->offset[VERT_RESULT_BFC1])); -#else - #warning "disabled" -#endif -} - - - -void brw_clip_init_clipmask( struct brw_clip_compile *c ) -{ - struct brw_compile *p = &c->func; - struct brw_reg incoming = get_element_ud(c->reg.R0, 2); - - /* Shift so that lowest outcode bit is rightmost: - */ - brw_SHR(p, c->reg.planemask, incoming, brw_imm_ud(26)); - - if (c->key.nr_userclip) { - struct brw_reg tmp = retype(vec1(get_tmp(c)), BRW_REGISTER_TYPE_UD); - - /* Rearrange userclip outcodes so that they come directly after - * the fixed plane bits. - */ - brw_AND(p, tmp, incoming, brw_imm_ud(0x3f<<14)); - brw_SHR(p, tmp, tmp, brw_imm_ud(8)); - brw_OR(p, c->reg.planemask, c->reg.planemask, tmp); - - release_tmp(c, tmp); - } -} - diff --git a/src/gallium/drivers/i965simple/brw_context.c b/src/gallium/drivers/i965simple/brw_context.c deleted file mode 100644 index 9b33285bc7..0000000000 --- a/src/gallium/drivers/i965simple/brw_context.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#include "brw_context.h" -#include "brw_defines.h" -#include "brw_draw.h" -#include "brw_vs.h" -#include "brw_tex_layout.h" -#include "brw_winsys.h" - -#include "pipe/internal/p_winsys_screen.h" -#include "pipe/p_context.h" -#include "util/u_memory.h" -#include "pipe/p_screen.h" - - -#ifndef BRW_DEBUG -int BRW_DEBUG = (0); -#endif - - -static void brw_destroy(struct pipe_context *pipe) -{ - struct brw_context *brw = brw_context(pipe); - - if(brw->winsys->destroy) - brw->winsys->destroy(brw->winsys); - - FREE(brw); -} - - -static void brw_clear(struct pipe_context *pipe, struct pipe_surface *ps, - unsigned clearValue) -{ - int x, y, w, h; - /* FIXME: corny... */ - - x = 0; - y = 0; - w = ps->width; - h = ps->height; - - pipe->surface_fill(pipe, ps, x, y, w, h, clearValue); -} - -static unsigned int -brw_is_texture_referenced( struct pipe_context *pipe, - struct pipe_texture *texture, - unsigned face, unsigned level) -{ - /** - * FIXME: Optimize. - */ - - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -} - -static unsigned int -brw_is_buffer_referenced( struct pipe_context *pipe, - struct pipe_buffer *buf) -{ - /** - * FIXME: Optimize. - */ - - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -} - -struct pipe_context *brw_create(struct pipe_screen *screen, - struct brw_winsys *brw_winsys, - unsigned pci_id) -{ - struct brw_context *brw; - - debug_printf("%s: creating brw_context with pci id 0x%x\n", - __FUNCTION__, pci_id); - - brw = CALLOC_STRUCT(brw_context); - if (brw == NULL) - return NULL; - - brw->winsys = brw_winsys; - brw->pipe.winsys = screen->winsys; - brw->pipe.screen = screen; - - brw->pipe.destroy = brw_destroy; - brw->pipe.clear = brw_clear; - - brw->pipe.is_texture_referenced = brw_is_texture_referenced; - brw->pipe.is_buffer_referenced = brw_is_buffer_referenced; - - brw_init_surface_functions(brw); - brw_init_texture_functions(brw); - brw_init_state_functions(brw); - brw_init_flush_functions(brw); - brw_init_draw_functions( brw ); - - - brw_init_state( brw ); - - brw->pci_id = pci_id; - brw->dirty = ~0; - brw->hardware_dirty = ~0; - - memset(&brw->wm.bind, ~0, sizeof(brw->wm.bind)); - - return &brw->pipe; -} - diff --git a/src/gallium/drivers/i965simple/brw_context.h b/src/gallium/drivers/i965simple/brw_context.h deleted file mode 100644 index 3079485180..0000000000 --- a/src/gallium/drivers/i965simple/brw_context.h +++ /dev/null @@ -1,684 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#ifndef BRWCONTEXT_INC -#define BRWCONTEXT_INC - - -#include "pipe/p_context.h" -#include "pipe/p_defines.h" -#include "pipe/p_state.h" - -#include "tgsi/tgsi_scan.h" - -#include "brw_structs.h" -#include "brw_winsys.h" - - -/* Glossary: - * - * URB - uniform resource buffer. A mid-sized buffer which is - * partitioned between the fixed function units and used for passing - * values (vertices, primitives, constants) between them. - * - * CURBE - constant URB entry. An urb region (entry) used to hold - * constant values which the fixed function units can be instructed to - * preload into the GRF when spawining a thread. - * - * VUE - vertex URB entry. An urb entry holding a vertex and usually - * a vertex header. The header contains control information and - * things like primitive type, Begin/end flags and clip codes. - * - * PUE - primitive URB entry. An urb entry produced by the setup (SF) - * unit holding rasterization and interpolation parameters. - * - * GRF - general register file. One of several register files - * addressable by programmed threads. The inputs (r0, payload, curbe, - * urb) of the thread are preloaded to this area before the thread is - * spawned. The registers are individually 8 dwords wide and suitable - * for general usage. Registers holding thread input values are not - * special and may be overwritten. - * - * MRF - message register file. Threads communicate (and terminate) - * by sending messages. Message parameters are placed in contigous - * MRF registers. All program output is via these messages. URB - * entries are populated by sending a message to the shared URB - * function containing the new data, together with a control word, - * often an unmodified copy of R0. - * - * R0 - GRF register 0. Typically holds control information used when - * sending messages to other threads. - * - * EU or GEN4 EU: The name of the programmable subsystem of the - * i965 hardware. Threads are executed by the EU, the registers - * described above are part of the EU architecture. - * - * Fixed function units: - * - * CS - Command streamer. Notional first unit, little software - * interaction. Holds the URB entries used for constant data, ie the - * CURBEs. - * - * VF/VS - Vertex Fetch / Vertex Shader. The fixed function part of - * this unit is responsible for pulling vertices out of vertex buffers - * in vram and injecting them into the processing pipe as VUEs. If - * enabled, it first passes them to a VS thread which is a good place - * for the driver to implement any active vertex shader. - * - * GS - Geometry Shader. This corresponds to a new DX10 concept. If - * enabled, incoming strips etc are passed to GS threads in individual - * line/triangle/point units. The GS thread may perform arbitary - * computation and emit whatever primtives with whatever vertices it - * chooses. This makes GS an excellent place to implement GL's - * unfilled polygon modes, though of course it is capable of much - * more. Additionally, GS is used to translate away primitives not - * handled by latter units, including Quads and Lineloops. - * - * CS - Clipper. Mesa's clipping algorithms are imported to run on - * this unit. The fixed function part performs cliptesting against - * the 6 fixed clipplanes and makes descisions on whether or not the - * incoming primitive needs to be passed to a thread for clipping. - * User clip planes are handled via cooperation with the VS thread. - * - * SF - Strips Fans or Setup: Triangles are prepared for - * rasterization. Interpolation coefficients are calculated. - * Flatshading and two-side lighting usually performed here. - * - * WM - Windower. Interpolation of vertex attributes performed here. - * Fragment shader implemented here. SIMD aspects of EU taken full - * advantage of, as pixels are processed in blocks of 16. - * - * CC - Color Calculator. No EU threads associated with this unit. - * Handles blending and (presumably) depth and stencil testing. - */ - -#define BRW_MAX_CURBE (32*16) - -struct brw_context; -struct brw_winsys; - - -/* Raised when we receive new state across the pipe interface: - */ -#define BRW_NEW_VIEWPORT 0x1 -#define BRW_NEW_RASTERIZER 0x2 -#define BRW_NEW_FS 0x4 -#define BRW_NEW_BLEND 0x8 -#define BRW_NEW_CLIP 0x10 -#define BRW_NEW_SCISSOR 0x20 -#define BRW_NEW_STIPPLE 0x40 -#define BRW_NEW_FRAMEBUFFER 0x80 -#define BRW_NEW_ALPHA_TEST 0x100 -#define BRW_NEW_DEPTH_STENCIL 0x200 -#define BRW_NEW_SAMPLER 0x400 -#define BRW_NEW_TEXTURE 0x800 -#define BRW_NEW_CONSTANTS 0x1000 -#define BRW_NEW_VBO 0x2000 -#define BRW_NEW_VS 0x4000 - -/* Raised for other internal events: - */ -#define BRW_NEW_URB_FENCE 0x10000 -#define BRW_NEW_PSP 0x20000 -#define BRW_NEW_CURBE_OFFSETS 0x40000 -#define BRW_NEW_REDUCED_PRIMITIVE 0x80000 -#define BRW_NEW_PRIMITIVE 0x100000 -#define BRW_NEW_SCENE 0x200000 -#define BRW_NEW_SF_LINKAGE 0x400000 - -extern int BRW_DEBUG; - -#define DEBUG_TEXTURE 0x1 -#define DEBUG_STATE 0x2 -#define DEBUG_IOCTL 0x4 -#define DEBUG_PRIMS 0x8 -#define DEBUG_VERTS 0x10 -#define DEBUG_FALLBACKS 0x20 -#define DEBUG_VERBOSE 0x40 -#define DEBUG_DRI 0x80 -#define DEBUG_DMA 0x100 -#define DEBUG_SANITY 0x200 -#define DEBUG_SYNC 0x400 -#define DEBUG_SLEEP 0x800 -#define DEBUG_PIXEL 0x1000 -#define DEBUG_STATS 0x2000 -#define DEBUG_TILE 0x4000 -#define DEBUG_SINGLE_THREAD 0x8000 -#define DEBUG_WM 0x10000 -#define DEBUG_URB 0x20000 -#define DEBUG_VS 0x40000 -#define DEBUG_BATCH 0x80000 -#define DEBUG_BUFMGR 0x100000 -#define DEBUG_BLIT 0x200000 -#define DEBUG_REGION 0x400000 -#define DEBUG_MIPTREE 0x800000 - -#define DBG(...) do { \ - if (BRW_DEBUG & FILE_DEBUG_FLAG) \ - debug_printf(__VA_ARGS__); \ -} while(0) - -#define PRINT(...) do { \ - debug_printf(__VA_ARGS__); \ -} while(0) - -struct brw_state_flags { - unsigned cache; - unsigned brw; -}; - - -struct brw_vertex_program { - struct pipe_shader_state program; - struct tgsi_shader_info info; - int id; -}; - - -struct brw_fragment_program { - struct pipe_shader_state program; - struct tgsi_shader_info info; - - boolean UsesDepth; /* XXX add this to tgsi_shader_info? */ - int id; -}; - - -struct pipe_setup_linkage { - struct { - unsigned vp_output:5; - unsigned interp_mode:4; - unsigned bf_vp_output:5; - } fp_input[PIPE_MAX_SHADER_INPUTS]; - - unsigned fp_input_count:5; - unsigned max_vp_output:5; -}; - - - -struct brw_texture { - struct pipe_texture base; - - /* Derived from the above: - */ - unsigned stride; - unsigned depth_pitch; /* per-image on i945? */ - unsigned total_nblocksy; - - unsigned nr_images[PIPE_MAX_TEXTURE_LEVELS]; - - /* Explicitly store the offset of each image for each cube face or - * depth value. Pretty much have to accept that hardware formats - * are going to be so diverse that there is no unified way to - * compute the offsets of depth/cube images within a mipmap level, - * so have to store them as a lookup table: - */ - unsigned *image_offset[PIPE_MAX_TEXTURE_LEVELS]; /**< array [depth] of offsets */ - - /* Includes image offset tables: - */ - unsigned level_offset[PIPE_MAX_TEXTURE_LEVELS]; - - /* The data is held here: - */ - struct pipe_buffer *buffer; -}; - -/* Data about a particular attempt to compile a program. Note that - * there can be many of these, each in a different GL state - * corresponding to a different brw_wm_prog_key struct, with different - * compiled programs: - */ -/* Data about a particular attempt to compile a program. Note that - * there can be many of these, each in a different GL state - * corresponding to a different brw_wm_prog_key struct, with different - * compiled programs: - */ - -struct brw_wm_prog_data { - unsigned curb_read_length; - unsigned urb_read_length; - - unsigned first_curbe_grf; - unsigned total_grf; - unsigned total_scratch; - - /* Internally generated constants for the CURBE. These are loaded - * ahead of the data from the constant buffer. - */ - const float internal_const[8]; - unsigned nr_internal_consts; - unsigned max_const; - - boolean error; -}; - -struct brw_sf_prog_data { - unsigned urb_read_length; - unsigned total_grf; - - /* Each vertex may have upto 12 attributes, 4 components each, - * except WPOS which requires only 2. (11*4 + 2) == 44 ==> 11 - * rows. - * - * Actually we use 4 for each, so call it 12 rows. - */ - unsigned urb_entry_size; -}; - -struct brw_clip_prog_data { - unsigned curb_read_length; /* user planes? */ - unsigned clip_mode; - unsigned urb_read_length; - unsigned total_grf; -}; - -struct brw_gs_prog_data { - unsigned urb_read_length; - unsigned total_grf; -}; - -struct brw_vs_prog_data { - unsigned curb_read_length; - unsigned urb_read_length; - unsigned total_grf; - unsigned outputs_written; - - unsigned inputs_read; - - unsigned max_const; - - float imm_buf[PIPE_MAX_CONSTANT][4]; - unsigned num_imm; - unsigned num_consts; - - /* Used for calculating urb partitions: - */ - unsigned urb_entry_size; -}; - - -#define BRW_MAX_TEX_UNIT 8 -#define BRW_WM_MAX_SURF BRW_MAX_TEX_UNIT + 1 - -/* Create a fixed sized struct for caching binding tables: - */ -struct brw_surface_binding_table { - unsigned surf_ss_offset[BRW_WM_MAX_SURF]; -}; - - -struct brw_cache; - -struct brw_mem_pool { - struct pipe_buffer *buffer; - - unsigned size; - unsigned offset; /* offset of first free byte */ - - struct brw_context *brw; -}; - -struct brw_cache_item { - unsigned hash; - unsigned key_size; /* for variable-sized keys */ - const void *key; - - unsigned offset; /* offset within pool's buffer */ - unsigned data_size; - - struct brw_cache_item *next; -}; - - - -struct brw_cache { - unsigned id; - - const char *name; - - struct brw_context *brw; - struct brw_mem_pool *pool; - - struct brw_cache_item **items; - unsigned size, n_items; - - unsigned key_size; /* for fixed-size keys */ - unsigned aux_size; - - unsigned last_addr; /* offset of active item */ -}; - - - - -/* Considered adding a member to this struct to document which flags - * an update might raise so that ordering of the state atoms can be - * checked or derived at runtime. Dropped the idea in favor of having - * a debug mode where the state is monitored for flags which are - * raised that have already been tested against. - */ -struct brw_tracked_state { - struct brw_state_flags dirty; - void (*update)( struct brw_context *brw ); -}; - - -/* Flags for brw->state.cache. - */ -#define CACHE_NEW_CC_VP (1< 32. Wouldn't life - * be easier if C allowed arrays of packed elements? - */ -#define ATTRIB_BIT_DWORDS ((PIPE_MAX_ATTRIBS+31)/32) - - - - -struct brw_vertex_info { - unsigned varying; /* varying:1[PIPE_MAX_ATTRIBS] */ - unsigned sizes[ATTRIB_BIT_DWORDS * 2]; /* sizes:2[PIPE_MAX_ATTRIBS] */ -}; - - - - - -struct brw_context -{ - struct pipe_context pipe; - struct brw_winsys *winsys; - - unsigned primitive; - unsigned reduced_primitive; - - boolean emit_state_always; - - struct { - struct brw_state_flags dirty; - } state; - - - struct { - const struct pipe_blend_state *Blend; - const struct pipe_depth_stencil_alpha_state *DepthStencil; - const struct pipe_poly_stipple *PolygonStipple; - const struct pipe_rasterizer_state *Raster; - const struct pipe_sampler_state *Samplers[PIPE_MAX_SAMPLERS]; - const struct brw_vertex_program *VertexProgram; - const struct brw_fragment_program *FragmentProgram; - - struct pipe_clip_state Clip; - struct pipe_blend_color BlendColor; - struct pipe_scissor_state Scissor; - struct pipe_viewport_state Viewport; - struct pipe_framebuffer_state FrameBuffer; - - const struct pipe_constant_buffer *Constants[2]; - const struct brw_texture *Texture[PIPE_MAX_SAMPLERS]; - } attribs; - - unsigned num_samplers; - unsigned num_textures; - - struct brw_mem_pool pool[BRW_MAX_POOL]; - struct brw_cache cache[BRW_MAX_CACHE]; - struct brw_cached_batch_item *cached_batch_items; - - struct { - - /* Arrays with buffer objects to copy non-bufferobj arrays into - * for upload: - */ - const struct pipe_vertex_buffer *vbo_array[PIPE_MAX_ATTRIBS]; - - struct brw_vertex_element_state inputs[PIPE_MAX_ATTRIBS]; - -#define BRW_NR_UPLOAD_BUFS 17 -#define BRW_UPLOAD_INIT_SIZE (128*1024) - - /* Summary of size and varying of active arrays, so we can check - * for changes to this state: - */ - struct brw_vertex_info info; - } vb; - - - unsigned hardware_dirty; - unsigned dirty; - unsigned pci_id; - /* BRW_NEW_URB_ALLOCATIONS: - */ - struct { - unsigned vsize; /* vertex size plus header in urb registers */ - unsigned csize; /* constant buffer size in urb registers */ - unsigned sfsize; /* setup data size in urb registers */ - - boolean constrained; - - unsigned nr_vs_entries; - unsigned nr_gs_entries; - unsigned nr_clip_entries; - unsigned nr_sf_entries; - unsigned nr_cs_entries; - -/* unsigned vs_size; */ -/* unsigned gs_size; */ -/* unsigned clip_size; */ -/* unsigned sf_size; */ -/* unsigned cs_size; */ - - unsigned vs_start; - unsigned gs_start; - unsigned clip_start; - unsigned sf_start; - unsigned cs_start; - } urb; - - - /* BRW_NEW_CURBE_OFFSETS: - */ - struct { - unsigned wm_start; - unsigned wm_size; - unsigned clip_start; - unsigned clip_size; - unsigned vs_start; - unsigned vs_size; - unsigned total_size; - - unsigned gs_offset; - - float *last_buf; - unsigned last_bufsz; - } curbe; - - struct { - struct brw_vs_prog_data *prog_data; - - unsigned prog_gs_offset; - unsigned state_gs_offset; - } vs; - - struct { - struct brw_gs_prog_data *prog_data; - - boolean prog_active; - unsigned prog_gs_offset; - unsigned state_gs_offset; - } gs; - - struct { - struct brw_clip_prog_data *prog_data; - - unsigned prog_gs_offset; - unsigned vp_gs_offset; - unsigned state_gs_offset; - } clip; - - - struct { - struct brw_sf_prog_data *prog_data; - - struct pipe_setup_linkage linkage; - - unsigned prog_gs_offset; - unsigned vp_gs_offset; - unsigned state_gs_offset; - } sf; - - struct { - struct brw_wm_prog_data *prog_data; - -// struct brw_wm_compiler *compile_data; - - - /** - * Array of sampler state uploaded at sampler_gs_offset of BRW_SAMPLER - * cache - */ - struct brw_sampler_state sampler[BRW_MAX_TEX_UNIT]; - - unsigned render_surf; - unsigned nr_surfaces; - - unsigned max_threads; - struct pipe_buffer *scratch_buffer; - unsigned scratch_buffer_size; - - unsigned sampler_count; - unsigned sampler_gs_offset; - - struct brw_surface_binding_table bind; - unsigned bind_ss_offset; - - unsigned prog_gs_offset; - unsigned state_gs_offset; - } wm; - - - struct { - unsigned vp_gs_offset; - unsigned state_gs_offset; - } cc; - - - /* Used to give every program string a unique id - */ - unsigned program_id; -}; - - -#define BRW_PACKCOLOR8888(r,g,b,a) ((r<<24) | (g<<16) | (b<<8) | a) - - -/*====================================================================== - * brw_vtbl.c - */ -void brw_do_flush( struct brw_context *brw, - unsigned flags ); - - -/*====================================================================== - * brw_state.c - */ -void brw_validate_state(struct brw_context *brw); -void brw_init_state(struct brw_context *brw); -void brw_destroy_state(struct brw_context *brw); - - -/*====================================================================== - * brw_tex.c - */ -void brwUpdateTextureState( struct brw_context *brw ); - - -/* brw_urb.c - */ -void brw_upload_urb_fence(struct brw_context *brw); - -void brw_upload_constant_buffer_state(struct brw_context *brw); - -void brw_init_surface_functions(struct brw_context *brw); -void brw_init_state_functions(struct brw_context *brw); -void brw_init_flush_functions(struct brw_context *brw); -void brw_init_string_functions(struct brw_context *brw); - -/*====================================================================== - * Inline conversion functions. These are better-typed than the - * macros used previously: - */ -static inline struct brw_context * -brw_context( struct pipe_context *ctx ) -{ - return (struct brw_context *)ctx; -} - -#endif - diff --git a/src/gallium/drivers/i965simple/brw_curbe.c b/src/gallium/drivers/i965simple/brw_curbe.c deleted file mode 100644 index 904cde8e30..0000000000 --- a/src/gallium/drivers/i965simple/brw_curbe.c +++ /dev/null @@ -1,369 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - - -#include "brw_context.h" -#include "brw_defines.h" -#include "brw_state.h" -#include "brw_batch.h" -#include "brw_util.h" -#include "brw_wm.h" -#include "pipe/p_state.h" -#include "pipe/internal/p_winsys_screen.h" -#include "util/u_math.h" -#include "util/u_memory.h" - -#define FILE_DEBUG_FLAG DEBUG_FALLBACKS - -/* Partition the CURBE between the various users of constant values: - */ -static void calculate_curbe_offsets( struct brw_context *brw ) -{ - /* CACHE_NEW_WM_PROG */ - unsigned nr_fp_regs = align(brw->wm.prog_data->max_const, 16); - - /* BRW_NEW_VERTEX_PROGRAM */ - unsigned nr_vp_regs = align(brw->vs.prog_data->max_const, 16); - unsigned nr_clip_regs = 0; - unsigned total_regs; - -#if 0 - /* BRW_NEW_CLIP ? */ - if (brw->attribs.Transform->ClipPlanesEnabled) { - unsigned nr_planes = 6 + brw_count_bits(brw->attribs.Transform->ClipPlanesEnabled); - nr_clip_regs = align(nr_planes * 4, 16); - } -#endif - - - total_regs = nr_fp_regs + nr_vp_regs + nr_clip_regs; - - /* This can happen - what to do? Probably rather than falling - * back, the best thing to do is emit programs which code the - * constants as immediate values. Could do this either as a static - * cap on WM and VS, or adaptively. - * - * Unfortunately, this is currently dependent on the results of the - * program generation process (in the case of wm), so this would - * introduce the need to re-generate programs in the event of a - * curbe allocation failure. - */ - /* Max size is 32 - just large enough to - * hold the 128 parameters allowed by - * the fragment and vertex program - * api's. It's not clear what happens - * when both VP and FP want to use 128 - * parameters, though. - */ - assert(total_regs <= 32); - - /* Lazy resize: - */ - if (nr_fp_regs > brw->curbe.wm_size || - nr_vp_regs > brw->curbe.vs_size || - nr_clip_regs != brw->curbe.clip_size || - (total_regs < brw->curbe.total_size / 4 && - brw->curbe.total_size > 16)) { - - unsigned reg = 0; - - /* Calculate a new layout: - */ - reg = 0; - brw->curbe.wm_start = reg; - brw->curbe.wm_size = nr_fp_regs; reg += nr_fp_regs; - brw->curbe.clip_start = reg; - brw->curbe.clip_size = nr_clip_regs; reg += nr_clip_regs; - brw->curbe.vs_start = reg; - brw->curbe.vs_size = nr_vp_regs; reg += nr_vp_regs; - brw->curbe.total_size = reg; - -#if 0 - if (0) - DBG("curbe wm %d+%d clip %d+%d vs %d+%d\n", - brw->curbe.wm_start, - brw->curbe.wm_size, - brw->curbe.clip_start, - brw->curbe.clip_size, - brw->curbe.vs_start, - brw->curbe.vs_size ); -#endif - - brw->state.dirty.brw |= BRW_NEW_CURBE_OFFSETS; - } -} - - -const struct brw_tracked_state brw_curbe_offsets = { - .dirty = { - .brw = (BRW_NEW_CLIP | - BRW_NEW_VS), - .cache = CACHE_NEW_WM_PROG - }, - .update = calculate_curbe_offsets -}; - - - -/* Define the number of curbes within CS's urb allocation. Multiple - * urb entries -> multiple curbes. These will be used by - * fixed-function hardware in a double-buffering scheme to avoid a - * pipeline stall each time the contents of the curbe is changed. - */ -void brw_upload_constant_buffer_state(struct brw_context *brw) -{ - struct brw_constant_buffer_state cbs; - memset(&cbs, 0, sizeof(cbs)); - - /* It appears that this is the state packet for the CS unit, ie. the - * urb entries detailed here are housed in the CS range from the - * URB_FENCE command. - */ - cbs.header.opcode = CMD_CONST_BUFFER_STATE; - cbs.header.length = sizeof(cbs)/4 - 2; - - /* BRW_NEW_URB_FENCE */ - cbs.bits0.nr_urb_entries = brw->urb.nr_cs_entries; - cbs.bits0.urb_entry_size = brw->urb.csize - 1; - - assert(brw->urb.nr_cs_entries); - BRW_CACHED_BATCH_STRUCT(brw, &cbs); -} - - -static float fixed_plane[6][4] = { - { 0, 0, -1, 1 }, - { 0, 0, 1, 1 }, - { 0, -1, 0, 1 }, - { 0, 1, 0, 1 }, - {-1, 0, 0, 1 }, - { 1, 0, 0, 1 } -}; - -/* Upload a new set of constants. Too much variability to go into the - * cache mechanism, but maybe would benefit from a comparison against - * the current uploaded set of constants. - */ -static void upload_constant_buffer(struct brw_context *brw) -{ - struct brw_mem_pool *pool = &brw->pool[BRW_GS_POOL]; - unsigned sz = brw->curbe.total_size; - unsigned bufsz = sz * sizeof(float); - float *buf; - unsigned i; - - - if (sz == 0) { - struct brw_constant_buffer cb; - cb.header.opcode = CMD_CONST_BUFFER; - cb.header.length = sizeof(cb)/4 - 2; - cb.header.valid = 0; - cb.bits0.buffer_length = 0; - cb.bits0.buffer_address = 0; - BRW_BATCH_STRUCT(brw, &cb); - - if (brw->curbe.last_buf) { - free(brw->curbe.last_buf); - brw->curbe.last_buf = NULL; - brw->curbe.last_bufsz = 0; - } - - return; - } - - buf = (float *)malloc(bufsz); - - memset(buf, 0, bufsz); - - if (brw->curbe.wm_size) { - unsigned offset = brw->curbe.wm_start * 16; - - /* First the constant buffer constants: - */ - - /* Then any internally generated constants: - */ - for (i = 0; i < brw->wm.prog_data->nr_internal_consts; i++) - buf[offset + i] = brw->wm.prog_data->internal_const[i]; - - assert(brw->wm.prog_data->max_const == - brw->wm.prog_data->nr_internal_consts); - } - - - /* The clipplanes are actually delivered to both CLIP and VS units. - * VS uses them to calculate the outcode bitmasks. - */ - if (brw->curbe.clip_size) { - unsigned offset = brw->curbe.clip_start * 16; - unsigned j; - - /* If any planes are going this way, send them all this way: - */ - for (i = 0; i < 6; i++) { - buf[offset + i * 4 + 0] = fixed_plane[i][0]; - buf[offset + i * 4 + 1] = fixed_plane[i][1]; - buf[offset + i * 4 + 2] = fixed_plane[i][2]; - buf[offset + i * 4 + 3] = fixed_plane[i][3]; - } - - /* Clip planes: BRW_NEW_CLIP: - */ - for (j = 0; j < brw->attribs.Clip.nr; j++) { - buf[offset + i * 4 + 0] = brw->attribs.Clip.ucp[j][0]; - buf[offset + i * 4 + 1] = brw->attribs.Clip.ucp[j][1]; - buf[offset + i * 4 + 2] = brw->attribs.Clip.ucp[j][2]; - buf[offset + i * 4 + 3] = brw->attribs.Clip.ucp[j][3]; - i++; - } - } - - - if (brw->curbe.vs_size) { - unsigned offset = brw->curbe.vs_start * 16; - /*unsigned nr = vp->max_const;*/ - const struct pipe_constant_buffer *cbuffer = brw->attribs.Constants[0]; - struct pipe_winsys *ws = brw->pipe.winsys; - /* FIXME: buffer size is num_consts + num_immediates */ - if (brw->vs.prog_data->num_consts) { - /* map the vertex constant buffer and copy to curbe: */ - void *data = ws->buffer_map(ws, cbuffer->buffer, 0); - /* FIXME: this is wrong. the cbuffer->buffer->size currently - * represents size of consts + immediates. so if we'll - * have both we'll copy over the end of the buffer - * with the subsequent memcpy */ - memcpy(&buf[offset], data, cbuffer->buffer->size); - ws->buffer_unmap(ws, cbuffer->buffer); - offset += cbuffer->buffer->size; - } - /*immediates*/ - if (brw->vs.prog_data->num_imm) { - memcpy(&buf[offset], brw->vs.prog_data->imm_buf, - brw->vs.prog_data->num_imm * 4 * sizeof(float)); - } - } - - if (1) { - for (i = 0; i < sz; i+=4) - debug_printf("curbe %d.%d: %f %f %f %f\n", i/8, i&4, - buf[i+0], buf[i+1], buf[i+2], buf[i+3]); - - debug_printf("last_buf %p buf %p sz %d/%d cmp %d\n", - brw->curbe.last_buf, buf, - bufsz, brw->curbe.last_bufsz, - brw->curbe.last_buf ? memcmp(buf, brw->curbe.last_buf, bufsz) : -1); - } - - if (brw->curbe.last_buf && - bufsz == brw->curbe.last_bufsz && - memcmp(buf, brw->curbe.last_buf, bufsz) == 0) { - free(buf); -/* return; */ - } - else { - if (brw->curbe.last_buf) - free(brw->curbe.last_buf); - brw->curbe.last_buf = buf; - brw->curbe.last_bufsz = bufsz; - - - if (!brw_pool_alloc(pool, - bufsz, - 1 << 6, - &brw->curbe.gs_offset)) { - debug_printf("out of GS memory for curbe\n"); - assert(0); - return; - } - - - /* Copy data to the buffer: - */ - brw->winsys->buffer_subdata_typed(brw->winsys, - pool->buffer, - brw->curbe.gs_offset, - bufsz, - buf, - BRW_CONSTANT_BUFFER ); - } - - /* TODO: only emit the constant_buffer packet when necessary, ie: - - contents have changed - - offset has changed - - hw requirements due to other packets emitted. - */ - { - struct brw_constant_buffer cb; - - memset(&cb, 0, sizeof(cb)); - - cb.header.opcode = CMD_CONST_BUFFER; - cb.header.length = sizeof(cb)/4 - 2; - cb.header.valid = 1; - cb.bits0.buffer_length = sz - 1; - cb.bits0.buffer_address = brw->curbe.gs_offset >> 6; - - /* Because this provokes an action (ie copy the constants into the - * URB), it shouldn't be shortcircuited if identical to the - * previous time - because eg. the urb destination may have - * changed, or the urb contents different to last time. - * - * Note that the data referred to is actually copied internally, - * not just used in place according to passed pointer. - * - * It appears that the CS unit takes care of using each available - * URB entry (Const URB Entry == CURBE) in turn, and issuing - * flushes as necessary when doublebuffering of CURBEs isn't - * possible. - */ - BRW_BATCH_STRUCT(brw, &cb); - } -} - -/* This tracked state is unique in that the state it monitors varies - * dynamically depending on the parameters tracked by the fragment and - * vertex programs. This is the template used as a starting point, - * each context will maintain a copy of this internally and update as - * required. - */ -const struct brw_tracked_state brw_constant_buffer = { - .dirty = { - .brw = (BRW_NEW_CLIP | - BRW_NEW_CONSTANTS | - BRW_NEW_URB_FENCE | /* Implicit - hardware requires this, not used above */ - BRW_NEW_PSP | /* Implicit - hardware requires this, not used above */ - BRW_NEW_CURBE_OFFSETS), - .cache = (CACHE_NEW_WM_PROG) - }, - .update = upload_constant_buffer -}; - diff --git a/src/gallium/drivers/i965simple/brw_defines.h b/src/gallium/drivers/i965simple/brw_defines.h deleted file mode 100644 index 715d2d2d01..0000000000 --- a/src/gallium/drivers/i965simple/brw_defines.h +++ /dev/null @@ -1,870 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#ifndef BRW_DEFINES_H -#define BRW_DEFINES_H - -/* - */ -#define MI_NOOP 0x00 -#define MI_USER_INTERRUPT 0x02 -#define MI_WAIT_FOR_EVENT 0x03 -#define MI_FLUSH 0x04 -#define MI_REPORT_HEAD 0x07 -#define MI_ARB_ON_OFF 0x08 -#define MI_BATCH_BUFFER_END 0x0A -#define MI_OVERLAY_FLIP 0x11 -#define MI_LOAD_SCAN_LINES_INCL 0x12 -#define MI_LOAD_SCAN_LINES_EXCL 0x13 -#define MI_DISPLAY_BUFFER_INFO 0x14 -#define MI_SET_CONTEXT 0x18 -#define MI_STORE_DATA_IMM 0x20 -#define MI_STORE_DATA_INDEX 0x21 -#define MI_LOAD_REGISTER_IMM 0x22 -#define MI_STORE_REGISTER_MEM 0x24 -#define MI_BATCH_BUFFER_START 0x31 - -#define MI_SYNCHRONOUS_FLIP 0x0 -#define MI_ASYNCHRONOUS_FLIP 0x1 - -#define MI_BUFFER_SECURE 0x0 -#define MI_BUFFER_NONSECURE 0x1 - -#define MI_ARBITRATE_AT_CHAIN_POINTS 0x0 -#define MI_ARBITRATE_BETWEEN_INSTS 0x1 -#define MI_NO_ARBITRATION 0x3 - -#define MI_CONDITION_CODE_WAIT_DISABLED 0x0 -#define MI_CONDITION_CODE_WAIT_0 0x1 -#define MI_CONDITION_CODE_WAIT_1 0x2 -#define MI_CONDITION_CODE_WAIT_2 0x3 -#define MI_CONDITION_CODE_WAIT_3 0x4 -#define MI_CONDITION_CODE_WAIT_4 0x5 - -#define MI_DISPLAY_PIPE_A 0x0 -#define MI_DISPLAY_PIPE_B 0x1 - -#define MI_DISPLAY_PLANE_A 0x0 -#define MI_DISPLAY_PLANE_B 0x1 -#define MI_DISPLAY_PLANE_C 0x2 - -#define MI_STANDARD_FLIP 0x0 -#define MI_ENQUEUE_FLIP_PERFORM_BASE_FRAME_NUMBER_LOAD 0x1 -#define MI_ENQUEUE_FLIP_TARGET_FRAME_NUMBER_RELATIVE 0x2 -#define MI_ENQUEUE_FLIP_ABSOLUTE_TARGET_FRAME_NUMBER 0x3 - -#define MI_PHYSICAL_ADDRESS 0x0 -#define MI_VIRTUAL_ADDRESS 0x1 - -#define MI_BUFFER_MEMORY_MAIN 0x0 -#define MI_BUFFER_MEMORY_GTT 0x2 -#define MI_BUFFER_MEMORY_PER_PROCESS_GTT 0x3 - -#define MI_FLIP_CONTINUE 0x0 -#define MI_FLIP_ON 0x1 -#define MI_FLIP_OFF 0x2 - -#define MI_UNTRUSTED_REGISTER_SPACE 0x0 -#define MI_TRUSTED_REGISTER_SPACE 0x1 - -/* 3D state: - */ -#define _3DOP_3DSTATE_PIPELINED 0x0 -#define _3DOP_3DSTATE_NONPIPELINED 0x1 -#define _3DOP_3DCONTROL 0x2 -#define _3DOP_3DPRIMITIVE 0x3 - -#define _3DSTATE_PIPELINED_POINTERS 0x00 -#define _3DSTATE_BINDING_TABLE_POINTERS 0x01 -#define _3DSTATE_VERTEX_BUFFERS 0x08 -#define _3DSTATE_VERTEX_ELEMENTS 0x09 -#define _3DSTATE_INDEX_BUFFER 0x0A -#define _3DSTATE_VF_STATISTICS 0x0B -#define _3DSTATE_DRAWING_RECTANGLE 0x00 -#define _3DSTATE_CONSTANT_COLOR 0x01 -#define _3DSTATE_SAMPLER_PALETTE_LOAD 0x02 -#define _3DSTATE_CHROMA_KEY 0x04 -#define _3DSTATE_DEPTH_BUFFER 0x05 -#define _3DSTATE_POLY_STIPPLE_OFFSET 0x06 -#define _3DSTATE_POLY_STIPPLE_PATTERN 0x07 -#define _3DSTATE_LINE_STIPPLE 0x08 -#define _3DSTATE_GLOBAL_DEPTH_OFFSET_CLAMP 0x09 -#define _3DCONTROL 0x00 -#define _3DPRIMITIVE 0x00 - -#define PIPE_CONTROL_NOWRITE 0x00 -#define PIPE_CONTROL_WRITEIMMEDIATE 0x01 -#define PIPE_CONTROL_WRITEDEPTH 0x02 -#define PIPE_CONTROL_WRITETIMESTAMP 0x03 - -#define PIPE_CONTROL_GTTWRITE_PROCESS_LOCAL 0x00 -#define PIPE_CONTROL_GTTWRITE_GLOBAL 0x01 - -#define _3DPRIM_POINTLIST 0x01 -#define _3DPRIM_LINELIST 0x02 -#define _3DPRIM_LINESTRIP 0x03 -#define _3DPRIM_TRILIST 0x04 -#define _3DPRIM_TRISTRIP 0x05 -#define _3DPRIM_TRIFAN 0x06 -#define _3DPRIM_QUADLIST 0x07 -#define _3DPRIM_QUADSTRIP 0x08 -#define _3DPRIM_LINELIST_ADJ 0x09 -#define _3DPRIM_LINESTRIP_ADJ 0x0A -#define _3DPRIM_TRILIST_ADJ 0x0B -#define _3DPRIM_TRISTRIP_ADJ 0x0C -#define _3DPRIM_TRISTRIP_REVERSE 0x0D -#define _3DPRIM_POLYGON 0x0E -#define _3DPRIM_RECTLIST 0x0F -#define _3DPRIM_LINELOOP 0x10 -#define _3DPRIM_POINTLIST_BF 0x11 -#define _3DPRIM_LINESTRIP_CONT 0x12 -#define _3DPRIM_LINESTRIP_BF 0x13 -#define _3DPRIM_LINESTRIP_CONT_BF 0x14 -#define _3DPRIM_TRIFAN_NOSTIPPLE 0x15 - -#define _3DPRIM_VERTEXBUFFER_ACCESS_SEQUENTIAL 0 -#define _3DPRIM_VERTEXBUFFER_ACCESS_RANDOM 1 - -#define BRW_ANISORATIO_2 0 -#define BRW_ANISORATIO_4 1 -#define BRW_ANISORATIO_6 2 -#define BRW_ANISORATIO_8 3 -#define BRW_ANISORATIO_10 4 -#define BRW_ANISORATIO_12 5 -#define BRW_ANISORATIO_14 6 -#define BRW_ANISORATIO_16 7 - -#define BRW_BLENDFACTOR_ONE 0x1 -#define BRW_BLENDFACTOR_SRC_COLOR 0x2 -#define BRW_BLENDFACTOR_SRC_ALPHA 0x3 -#define BRW_BLENDFACTOR_DST_ALPHA 0x4 -#define BRW_BLENDFACTOR_DST_COLOR 0x5 -#define BRW_BLENDFACTOR_SRC_ALPHA_SATURATE 0x6 -#define BRW_BLENDFACTOR_CONST_COLOR 0x7 -#define BRW_BLENDFACTOR_CONST_ALPHA 0x8 -#define BRW_BLENDFACTOR_SRC1_COLOR 0x9 -#define BRW_BLENDFACTOR_SRC1_ALPHA 0x0A -#define BRW_BLENDFACTOR_ZERO 0x11 -#define BRW_BLENDFACTOR_INV_SRC_COLOR 0x12 -#define BRW_BLENDFACTOR_INV_SRC_ALPHA 0x13 -#define BRW_BLENDFACTOR_INV_DST_ALPHA 0x14 -#define BRW_BLENDFACTOR_INV_DST_COLOR 0x15 -#define BRW_BLENDFACTOR_INV_CONST_COLOR 0x17 -#define BRW_BLENDFACTOR_INV_CONST_ALPHA 0x18 -#define BRW_BLENDFACTOR_INV_SRC1_COLOR 0x19 -#define BRW_BLENDFACTOR_INV_SRC1_ALPHA 0x1A - -#define BRW_BLENDFUNCTION_ADD 0 -#define BRW_BLENDFUNCTION_SUBTRACT 1 -#define BRW_BLENDFUNCTION_REVERSE_SUBTRACT 2 -#define BRW_BLENDFUNCTION_MIN 3 -#define BRW_BLENDFUNCTION_MAX 4 - -#define BRW_ALPHATEST_FORMAT_UNORM8 0 -#define BRW_ALPHATEST_FORMAT_FLOAT32 1 - -#define BRW_CHROMAKEY_KILL_ON_ANY_MATCH 0 -#define BRW_CHROMAKEY_REPLACE_BLACK 1 - -#define BRW_CLIP_API_OGL 0 -#define BRW_CLIP_API_DX 1 - -#define BRW_CLIPMODE_NORMAL 0 -#define BRW_CLIPMODE_CLIP_ALL 1 -#define BRW_CLIPMODE_CLIP_NON_REJECTED 2 -#define BRW_CLIPMODE_REJECT_ALL 3 -#define BRW_CLIPMODE_ACCEPT_ALL 4 - -#define BRW_CLIP_NDCSPACE 0 -#define BRW_CLIP_SCREENSPACE 1 - -#define BRW_COMPAREFUNCTION_ALWAYS 0 -#define BRW_COMPAREFUNCTION_NEVER 1 -#define BRW_COMPAREFUNCTION_LESS 2 -#define BRW_COMPAREFUNCTION_EQUAL 3 -#define BRW_COMPAREFUNCTION_LEQUAL 4 -#define BRW_COMPAREFUNCTION_GREATER 5 -#define BRW_COMPAREFUNCTION_NOTEQUAL 6 -#define BRW_COMPAREFUNCTION_GEQUAL 7 - -#define BRW_COVERAGE_PIXELS_HALF 0 -#define BRW_COVERAGE_PIXELS_1 1 -#define BRW_COVERAGE_PIXELS_2 2 -#define BRW_COVERAGE_PIXELS_4 3 - -#define BRW_CULLMODE_BOTH 0 -#define BRW_CULLMODE_NONE 1 -#define BRW_CULLMODE_FRONT 2 -#define BRW_CULLMODE_BACK 3 - -#define BRW_DEFAULTCOLOR_R8G8B8A8_UNORM 0 -#define BRW_DEFAULTCOLOR_R32G32B32A32_FLOAT 1 - -#define BRW_DEPTHFORMAT_D32_FLOAT_S8X24_UINT 0 -#define BRW_DEPTHFORMAT_D32_FLOAT 1 -#define BRW_DEPTHFORMAT_D24_UNORM_S8_UINT 2 -#define BRW_DEPTHFORMAT_D16_UNORM 5 - -#define BRW_FLOATING_POINT_IEEE_754 0 -#define BRW_FLOATING_POINT_NON_IEEE_754 1 - -#define BRW_FRONTWINDING_CW 0 -#define BRW_FRONTWINDING_CCW 1 - -#define BRW_SPRITE_POINT_ENABLE 16 - -#define BRW_INDEX_BYTE 0 -#define BRW_INDEX_WORD 1 -#define BRW_INDEX_DWORD 2 - -#define BRW_LOGICOPFUNCTION_CLEAR 0 -#define BRW_LOGICOPFUNCTION_NOR 1 -#define BRW_LOGICOPFUNCTION_AND_INVERTED 2 -#define BRW_LOGICOPFUNCTION_COPY_INVERTED 3 -#define BRW_LOGICOPFUNCTION_AND_REVERSE 4 -#define BRW_LOGICOPFUNCTION_INVERT 5 -#define BRW_LOGICOPFUNCTION_XOR 6 -#define BRW_LOGICOPFUNCTION_NAND 7 -#define BRW_LOGICOPFUNCTION_AND 8 -#define BRW_LOGICOPFUNCTION_EQUIV 9 -#define BRW_LOGICOPFUNCTION_NOOP 10 -#define BRW_LOGICOPFUNCTION_OR_INVERTED 11 -#define BRW_LOGICOPFUNCTION_COPY 12 -#define BRW_LOGICOPFUNCTION_OR_REVERSE 13 -#define BRW_LOGICOPFUNCTION_OR 14 -#define BRW_LOGICOPFUNCTION_SET 15 - -#define BRW_MAPFILTER_NEAREST 0x0 -#define BRW_MAPFILTER_LINEAR 0x1 -#define BRW_MAPFILTER_ANISOTROPIC 0x2 - -#define BRW_MIPFILTER_NONE 0 -#define BRW_MIPFILTER_NEAREST 1 -#define BRW_MIPFILTER_LINEAR 3 - -#define BRW_POLYGON_FRONT_FACING 0 -#define BRW_POLYGON_BACK_FACING 1 - -#define BRW_PREFILTER_ALWAYS 0x0 -#define BRW_PREFILTER_NEVER 0x1 -#define BRW_PREFILTER_LESS 0x2 -#define BRW_PREFILTER_EQUAL 0x3 -#define BRW_PREFILTER_LEQUAL 0x4 -#define BRW_PREFILTER_GREATER 0x5 -#define BRW_PREFILTER_NOTEQUAL 0x6 -#define BRW_PREFILTER_GEQUAL 0x7 - -#define BRW_PROVOKING_VERTEX_0 0 -#define BRW_PROVOKING_VERTEX_1 1 -#define BRW_PROVOKING_VERTEX_2 2 - -#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 -#define BRW_RENDERTARGET_CLAMPRANGE_FORMAT 2 - -#define BRW_STENCILOP_KEEP 0 -#define BRW_STENCILOP_ZERO 1 -#define BRW_STENCILOP_REPLACE 2 -#define BRW_STENCILOP_INCRSAT 3 -#define BRW_STENCILOP_DECRSAT 4 -#define BRW_STENCILOP_INCR 5 -#define BRW_STENCILOP_DECR 6 -#define BRW_STENCILOP_INVERT 7 - -#define BRW_SURFACE_MIPMAPLAYOUT_BELOW 0 -#define BRW_SURFACE_MIPMAPLAYOUT_RIGHT 1 - -#define BRW_SURFACEFORMAT_R32G32B32A32_FLOAT 0x000 -#define BRW_SURFACEFORMAT_R32G32B32A32_SINT 0x001 -#define BRW_SURFACEFORMAT_R32G32B32A32_UINT 0x002 -#define BRW_SURFACEFORMAT_R32G32B32A32_UNORM 0x003 -#define BRW_SURFACEFORMAT_R32G32B32A32_SNORM 0x004 -#define BRW_SURFACEFORMAT_R64G64_FLOAT 0x005 -#define BRW_SURFACEFORMAT_R32G32B32X32_FLOAT 0x006 -#define BRW_SURFACEFORMAT_R32G32B32A32_SSCALED 0x007 -#define BRW_SURFACEFORMAT_R32G32B32A32_USCALED 0x008 -#define BRW_SURFACEFORMAT_R32G32B32_FLOAT 0x040 -#define BRW_SURFACEFORMAT_R32G32B32_SINT 0x041 -#define BRW_SURFACEFORMAT_R32G32B32_UINT 0x042 -#define BRW_SURFACEFORMAT_R32G32B32_UNORM 0x043 -#define BRW_SURFACEFORMAT_R32G32B32_SNORM 0x044 -#define BRW_SURFACEFORMAT_R32G32B32_SSCALED 0x045 -#define BRW_SURFACEFORMAT_R32G32B32_USCALED 0x046 -#define BRW_SURFACEFORMAT_R16G16B16A16_UNORM 0x080 -#define BRW_SURFACEFORMAT_R16G16B16A16_SNORM 0x081 -#define BRW_SURFACEFORMAT_R16G16B16A16_SINT 0x082 -#define BRW_SURFACEFORMAT_R16G16B16A16_UINT 0x083 -#define BRW_SURFACEFORMAT_R16G16B16A16_FLOAT 0x084 -#define BRW_SURFACEFORMAT_R32G32_FLOAT 0x085 -#define BRW_SURFACEFORMAT_R32G32_SINT 0x086 -#define BRW_SURFACEFORMAT_R32G32_UINT 0x087 -#define BRW_SURFACEFORMAT_R32_FLOAT_X8X24_TYPELESS 0x088 -#define BRW_SURFACEFORMAT_X32_TYPELESS_G8X24_UINT 0x089 -#define BRW_SURFACEFORMAT_L32A32_FLOAT 0x08A -#define BRW_SURFACEFORMAT_R32G32_UNORM 0x08B -#define BRW_SURFACEFORMAT_R32G32_SNORM 0x08C -#define BRW_SURFACEFORMAT_R64_FLOAT 0x08D -#define BRW_SURFACEFORMAT_R16G16B16X16_UNORM 0x08E -#define BRW_SURFACEFORMAT_R16G16B16X16_FLOAT 0x08F -#define BRW_SURFACEFORMAT_A32X32_FLOAT 0x090 -#define BRW_SURFACEFORMAT_L32X32_FLOAT 0x091 -#define BRW_SURFACEFORMAT_I32X32_FLOAT 0x092 -#define BRW_SURFACEFORMAT_R16G16B16A16_SSCALED 0x093 -#define BRW_SURFACEFORMAT_R16G16B16A16_USCALED 0x094 -#define BRW_SURFACEFORMAT_R32G32_SSCALED 0x095 -#define BRW_SURFACEFORMAT_R32G32_USCALED 0x096 -#define BRW_SURFACEFORMAT_B8G8R8A8_UNORM 0x0C0 -#define BRW_SURFACEFORMAT_B8G8R8A8_UNORM_SRGB 0x0C1 -#define BRW_SURFACEFORMAT_R10G10B10A2_UNORM 0x0C2 -#define BRW_SURFACEFORMAT_R10G10B10A2_UNORM_SRGB 0x0C3 -#define BRW_SURFACEFORMAT_R10G10B10A2_UINT 0x0C4 -#define BRW_SURFACEFORMAT_R10G10B10_SNORM_A2_UNORM 0x0C5 -#define BRW_SURFACEFORMAT_R8G8B8A8_UNORM 0x0C7 -#define BRW_SURFACEFORMAT_R8G8B8A8_UNORM_SRGB 0x0C8 -#define BRW_SURFACEFORMAT_R8G8B8A8_SNORM 0x0C9 -#define BRW_SURFACEFORMAT_R8G8B8A8_SINT 0x0CA -#define BRW_SURFACEFORMAT_R8G8B8A8_UINT 0x0CB -#define BRW_SURFACEFORMAT_R16G16_UNORM 0x0CC -#define BRW_SURFACEFORMAT_R16G16_SNORM 0x0CD -#define BRW_SURFACEFORMAT_R16G16_SINT 0x0CE -#define BRW_SURFACEFORMAT_R16G16_UINT 0x0CF -#define BRW_SURFACEFORMAT_R16G16_FLOAT 0x0D0 -#define BRW_SURFACEFORMAT_B10G10R10A2_UNORM 0x0D1 -#define BRW_SURFACEFORMAT_B10G10R10A2_UNORM_SRGB 0x0D2 -#define BRW_SURFACEFORMAT_R11G11B10_FLOAT 0x0D3 -#define BRW_SURFACEFORMAT_R32_SINT 0x0D6 -#define BRW_SURFACEFORMAT_R32_UINT 0x0D7 -#define BRW_SURFACEFORMAT_R32_FLOAT 0x0D8 -#define BRW_SURFACEFORMAT_R24_UNORM_X8_TYPELESS 0x0D9 -#define BRW_SURFACEFORMAT_X24_TYPELESS_G8_UINT 0x0DA -#define BRW_SURFACEFORMAT_L16A16_UNORM 0x0DF -#define BRW_SURFACEFORMAT_I24X8_UNORM 0x0E0 -#define BRW_SURFACEFORMAT_L24X8_UNORM 0x0E1 -#define BRW_SURFACEFORMAT_A24X8_UNORM 0x0E2 -#define BRW_SURFACEFORMAT_I32_FLOAT 0x0E3 -#define BRW_SURFACEFORMAT_L32_FLOAT 0x0E4 -#define BRW_SURFACEFORMAT_A32_FLOAT 0x0E5 -#define BRW_SURFACEFORMAT_B8G8R8X8_UNORM 0x0E9 -#define BRW_SURFACEFORMAT_B8G8R8X8_UNORM_SRGB 0x0EA -#define BRW_SURFACEFORMAT_R8G8B8X8_UNORM 0x0EB -#define BRW_SURFACEFORMAT_R8G8B8X8_UNORM_SRGB 0x0EC -#define BRW_SURFACEFORMAT_R9G9B9E5_SHAREDEXP 0x0ED -#define BRW_SURFACEFORMAT_B10G10R10X2_UNORM 0x0EE -#define BRW_SURFACEFORMAT_L16A16_FLOAT 0x0F0 -#define BRW_SURFACEFORMAT_R32_UNORM 0x0F1 -#define BRW_SURFACEFORMAT_R32_SNORM 0x0F2 -#define BRW_SURFACEFORMAT_R10G10B10X2_USCALED 0x0F3 -#define BRW_SURFACEFORMAT_R8G8B8A8_SSCALED 0x0F4 -#define BRW_SURFACEFORMAT_R8G8B8A8_USCALED 0x0F5 -#define BRW_SURFACEFORMAT_R16G16_SSCALED 0x0F6 -#define BRW_SURFACEFORMAT_R16G16_USCALED 0x0F7 -#define BRW_SURFACEFORMAT_R32_SSCALED 0x0F8 -#define BRW_SURFACEFORMAT_R32_USCALED 0x0F9 -#define BRW_SURFACEFORMAT_B5G6R5_UNORM 0x100 -#define BRW_SURFACEFORMAT_B5G6R5_UNORM_SRGB 0x101 -#define BRW_SURFACEFORMAT_B5G5R5A1_UNORM 0x102 -#define BRW_SURFACEFORMAT_B5G5R5A1_UNORM_SRGB 0x103 -#define BRW_SURFACEFORMAT_B4G4R4A4_UNORM 0x104 -#define BRW_SURFACEFORMAT_B4G4R4A4_UNORM_SRGB 0x105 -#define BRW_SURFACEFORMAT_R8G8_UNORM 0x106 -#define BRW_SURFACEFORMAT_R8G8_SNORM 0x107 -#define BRW_SURFACEFORMAT_R8G8_SINT 0x108 -#define BRW_SURFACEFORMAT_R8G8_UINT 0x109 -#define BRW_SURFACEFORMAT_R16_UNORM 0x10A -#define BRW_SURFACEFORMAT_R16_SNORM 0x10B -#define BRW_SURFACEFORMAT_R16_SINT 0x10C -#define BRW_SURFACEFORMAT_R16_UINT 0x10D -#define BRW_SURFACEFORMAT_R16_FLOAT 0x10E -#define BRW_SURFACEFORMAT_I16_UNORM 0x111 -#define BRW_SURFACEFORMAT_L16_UNORM 0x112 -#define BRW_SURFACEFORMAT_A16_UNORM 0x113 -#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_B5G5R5X1_UNORM_SRGB 0x11B -#define BRW_SURFACEFORMAT_R8G8_SSCALED 0x11C -#define BRW_SURFACEFORMAT_R8G8_USCALED 0x11D -#define BRW_SURFACEFORMAT_R16_SSCALED 0x11E -#define BRW_SURFACEFORMAT_R16_USCALED 0x11F -#define BRW_SURFACEFORMAT_R8_UNORM 0x140 -#define BRW_SURFACEFORMAT_R8_SNORM 0x141 -#define BRW_SURFACEFORMAT_R8_SINT 0x142 -#define BRW_SURFACEFORMAT_R8_UINT 0x143 -#define BRW_SURFACEFORMAT_A8_UNORM 0x144 -#define BRW_SURFACEFORMAT_I8_UNORM 0x145 -#define BRW_SURFACEFORMAT_L8_UNORM 0x146 -#define BRW_SURFACEFORMAT_P4A4_UNORM 0x147 -#define BRW_SURFACEFORMAT_A4P4_UNORM 0x148 -#define BRW_SURFACEFORMAT_R8_SSCALED 0x149 -#define BRW_SURFACEFORMAT_R8_USCALED 0x14A -#define BRW_SURFACEFORMAT_R1_UINT 0x181 -#define BRW_SURFACEFORMAT_YCRCB_NORMAL 0x182 -#define BRW_SURFACEFORMAT_YCRCB_SWAPUVY 0x183 -#define BRW_SURFACEFORMAT_BC1_UNORM 0x186 -#define BRW_SURFACEFORMAT_BC2_UNORM 0x187 -#define BRW_SURFACEFORMAT_BC3_UNORM 0x188 -#define BRW_SURFACEFORMAT_BC4_UNORM 0x189 -#define BRW_SURFACEFORMAT_BC5_UNORM 0x18A -#define BRW_SURFACEFORMAT_BC1_UNORM_SRGB 0x18B -#define BRW_SURFACEFORMAT_BC2_UNORM_SRGB 0x18C -#define BRW_SURFACEFORMAT_BC3_UNORM_SRGB 0x18D -#define BRW_SURFACEFORMAT_MONO8 0x18E -#define BRW_SURFACEFORMAT_YCRCB_SWAPUV 0x18F -#define BRW_SURFACEFORMAT_YCRCB_SWAPY 0x190 -#define BRW_SURFACEFORMAT_DXT1_RGB 0x191 -#define BRW_SURFACEFORMAT_FXT1 0x192 -#define BRW_SURFACEFORMAT_R8G8B8_UNORM 0x193 -#define BRW_SURFACEFORMAT_R8G8B8_SNORM 0x194 -#define BRW_SURFACEFORMAT_R8G8B8_SSCALED 0x195 -#define BRW_SURFACEFORMAT_R8G8B8_USCALED 0x196 -#define BRW_SURFACEFORMAT_R64G64B64A64_FLOAT 0x197 -#define BRW_SURFACEFORMAT_R64G64B64_FLOAT 0x198 -#define BRW_SURFACEFORMAT_BC4_SNORM 0x199 -#define BRW_SURFACEFORMAT_BC5_SNORM 0x19A -#define BRW_SURFACEFORMAT_R16G16B16_UNORM 0x19C -#define BRW_SURFACEFORMAT_R16G16B16_SNORM 0x19D -#define BRW_SURFACEFORMAT_R16G16B16_SSCALED 0x19E -#define BRW_SURFACEFORMAT_R16G16B16_USCALED 0x19F - -#define BRW_SURFACERETURNFORMAT_FLOAT32 0 -#define BRW_SURFACERETURNFORMAT_S1 1 - -#define BRW_SURFACE_1D 0 -#define BRW_SURFACE_2D 1 -#define BRW_SURFACE_3D 2 -#define BRW_SURFACE_CUBE 3 -#define BRW_SURFACE_BUFFER 4 -#define BRW_SURFACE_NULL 7 - -#define BRW_TEXCOORDMODE_WRAP 0 -#define BRW_TEXCOORDMODE_MIRROR 1 -#define BRW_TEXCOORDMODE_CLAMP 2 -#define BRW_TEXCOORDMODE_CUBE 3 -#define BRW_TEXCOORDMODE_CLAMP_BORDER 4 -#define BRW_TEXCOORDMODE_MIRROR_ONCE 5 - -#define BRW_THREAD_PRIORITY_NORMAL 0 -#define BRW_THREAD_PRIORITY_HIGH 1 - -#define BRW_TILEWALK_XMAJOR 0 -#define BRW_TILEWALK_YMAJOR 1 - -#define BRW_VERTEX_SUBPIXEL_PRECISION_8BITS 0 -#define BRW_VERTEX_SUBPIXEL_PRECISION_4BITS 1 - -#define BRW_VERTEXBUFFER_ACCESS_VERTEXDATA 0 -#define BRW_VERTEXBUFFER_ACCESS_INSTANCEDATA 1 - -#define BRW_VFCOMPONENT_NOSTORE 0 -#define BRW_VFCOMPONENT_STORE_SRC 1 -#define BRW_VFCOMPONENT_STORE_0 2 -#define BRW_VFCOMPONENT_STORE_1_FLT 3 -#define BRW_VFCOMPONENT_STORE_1_INT 4 -#define BRW_VFCOMPONENT_STORE_VID 5 -#define BRW_VFCOMPONENT_STORE_IID 6 -#define BRW_VFCOMPONENT_STORE_PID 7 - - - -/* Execution Unit (EU) defines - */ - -#define BRW_ALIGN_1 0 -#define BRW_ALIGN_16 1 - -#define BRW_ADDRESS_DIRECT 0 -#define BRW_ADDRESS_REGISTER_INDIRECT_REGISTER 1 - -#define BRW_CHANNEL_X 0 -#define BRW_CHANNEL_Y 1 -#define BRW_CHANNEL_Z 2 -#define BRW_CHANNEL_W 3 - -#define BRW_COMPRESSION_NONE 0 -#define BRW_COMPRESSION_2NDHALF 1 -#define BRW_COMPRESSION_COMPRESSED 2 - -#define BRW_CONDITIONAL_NONE 0 -#define BRW_CONDITIONAL_Z 1 -#define BRW_CONDITIONAL_NZ 2 -#define BRW_CONDITIONAL_EQ 1 /* Z */ -#define BRW_CONDITIONAL_NEQ 2 /* NZ */ -#define BRW_CONDITIONAL_G 3 -#define BRW_CONDITIONAL_GE 4 -#define BRW_CONDITIONAL_L 5 -#define BRW_CONDITIONAL_LE 6 -#define BRW_CONDITIONAL_C 7 -#define BRW_CONDITIONAL_O 8 - -#define BRW_DEBUG_NONE 0 -#define BRW_DEBUG_BREAKPOINT 1 - -#define BRW_DEPENDENCY_NORMAL 0 -#define BRW_DEPENDENCY_NOTCLEARED 1 -#define BRW_DEPENDENCY_NOTCHECKED 2 -#define BRW_DEPENDENCY_DISABLE 3 - -#define BRW_EXECUTE_1 0 -#define BRW_EXECUTE_2 1 -#define BRW_EXECUTE_4 2 -#define BRW_EXECUTE_8 3 -#define BRW_EXECUTE_16 4 -#define BRW_EXECUTE_32 5 - -#define BRW_HORIZONTAL_STRIDE_0 0 -#define BRW_HORIZONTAL_STRIDE_1 1 -#define BRW_HORIZONTAL_STRIDE_2 2 -#define BRW_HORIZONTAL_STRIDE_4 3 - -#define BRW_INSTRUCTION_NORMAL 0 -#define BRW_INSTRUCTION_SATURATE 1 - -#define BRW_MASK_ENABLE 0 -#define BRW_MASK_DISABLE 1 - -#define BRW_OPCODE_MOV 1 -#define BRW_OPCODE_SEL 2 -#define BRW_OPCODE_NOT 4 -#define BRW_OPCODE_AND 5 -#define BRW_OPCODE_OR 6 -#define BRW_OPCODE_XOR 7 -#define BRW_OPCODE_SHR 8 -#define BRW_OPCODE_SHL 9 -#define BRW_OPCODE_RSR 10 -#define BRW_OPCODE_RSL 11 -#define BRW_OPCODE_ASR 12 -#define BRW_OPCODE_CMP 16 -#define BRW_OPCODE_JMPI 32 -#define BRW_OPCODE_IF 34 -#define BRW_OPCODE_IFF 35 -#define BRW_OPCODE_ELSE 36 -#define BRW_OPCODE_ENDIF 37 -#define BRW_OPCODE_DO 38 -#define BRW_OPCODE_WHILE 39 -#define BRW_OPCODE_BREAK 40 -#define BRW_OPCODE_CONTINUE 41 -#define BRW_OPCODE_HALT 42 -#define BRW_OPCODE_MSAVE 44 -#define BRW_OPCODE_MRESTORE 45 -#define BRW_OPCODE_PUSH 46 -#define BRW_OPCODE_POP 47 -#define BRW_OPCODE_WAIT 48 -#define BRW_OPCODE_SEND 49 -#define BRW_OPCODE_ADD 64 -#define BRW_OPCODE_MUL 65 -#define BRW_OPCODE_AVG 66 -#define BRW_OPCODE_FRC 67 -#define BRW_OPCODE_RNDU 68 -#define BRW_OPCODE_RNDD 69 -#define BRW_OPCODE_RNDE 70 -#define BRW_OPCODE_RNDZ 71 -#define BRW_OPCODE_MAC 72 -#define BRW_OPCODE_MACH 73 -#define BRW_OPCODE_LZD 74 -#define BRW_OPCODE_SAD2 80 -#define BRW_OPCODE_SADA2 81 -#define BRW_OPCODE_DP4 84 -#define BRW_OPCODE_DPH 85 -#define BRW_OPCODE_DP3 86 -#define BRW_OPCODE_DP2 87 -#define BRW_OPCODE_DPA2 88 -#define BRW_OPCODE_LINE 89 -#define BRW_OPCODE_NOP 126 - -#define BRW_PREDICATE_NONE 0 -#define BRW_PREDICATE_NORMAL 1 -#define BRW_PREDICATE_ALIGN1_ANYV 2 -#define BRW_PREDICATE_ALIGN1_ALLV 3 -#define BRW_PREDICATE_ALIGN1_ANY2H 4 -#define BRW_PREDICATE_ALIGN1_ALL2H 5 -#define BRW_PREDICATE_ALIGN1_ANY4H 6 -#define BRW_PREDICATE_ALIGN1_ALL4H 7 -#define BRW_PREDICATE_ALIGN1_ANY8H 8 -#define BRW_PREDICATE_ALIGN1_ALL8H 9 -#define BRW_PREDICATE_ALIGN1_ANY16H 10 -#define BRW_PREDICATE_ALIGN1_ALL16H 11 -#define BRW_PREDICATE_ALIGN16_REPLICATE_X 2 -#define BRW_PREDICATE_ALIGN16_REPLICATE_Y 3 -#define BRW_PREDICATE_ALIGN16_REPLICATE_Z 4 -#define BRW_PREDICATE_ALIGN16_REPLICATE_W 5 -#define BRW_PREDICATE_ALIGN16_ANY4H 6 -#define BRW_PREDICATE_ALIGN16_ALL4H 7 - -#define BRW_ARCHITECTURE_REGISTER_FILE 0 -#define BRW_GENERAL_REGISTER_FILE 1 -#define BRW_MESSAGE_REGISTER_FILE 2 -#define BRW_IMMEDIATE_VALUE 3 - -#define BRW_REGISTER_TYPE_UD 0 -#define BRW_REGISTER_TYPE_D 1 -#define BRW_REGISTER_TYPE_UW 2 -#define BRW_REGISTER_TYPE_W 3 -#define BRW_REGISTER_TYPE_UB 4 -#define BRW_REGISTER_TYPE_B 5 -#define BRW_REGISTER_TYPE_VF 5 /* packed float vector, immediates only? */ -#define BRW_REGISTER_TYPE_HF 6 -#define BRW_REGISTER_TYPE_V 6 /* packed int vector, immediates only, uword dest only */ -#define BRW_REGISTER_TYPE_F 7 - -#define BRW_ARF_NULL 0x00 -#define BRW_ARF_ADDRESS 0x10 -#define BRW_ARF_ACCUMULATOR 0x20 -#define BRW_ARF_FLAG 0x30 -#define BRW_ARF_MASK 0x40 -#define BRW_ARF_MASK_STACK 0x50 -#define BRW_ARF_MASK_STACK_DEPTH 0x60 -#define BRW_ARF_STATE 0x70 -#define BRW_ARF_CONTROL 0x80 -#define BRW_ARF_NOTIFICATION_COUNT 0x90 -#define BRW_ARF_IP 0xA0 - -#define BRW_AMASK 0 -#define BRW_IMASK 1 -#define BRW_LMASK 2 -#define BRW_CMASK 3 - - - -#define BRW_THREAD_NORMAL 0 -#define BRW_THREAD_ATOMIC 1 -#define BRW_THREAD_SWITCH 2 - -#define BRW_VERTICAL_STRIDE_0 0 -#define BRW_VERTICAL_STRIDE_1 1 -#define BRW_VERTICAL_STRIDE_2 2 -#define BRW_VERTICAL_STRIDE_4 3 -#define BRW_VERTICAL_STRIDE_8 4 -#define BRW_VERTICAL_STRIDE_16 5 -#define BRW_VERTICAL_STRIDE_32 6 -#define BRW_VERTICAL_STRIDE_64 7 -#define BRW_VERTICAL_STRIDE_128 8 -#define BRW_VERTICAL_STRIDE_256 9 -#define BRW_VERTICAL_STRIDE_ONE_DIMENSIONAL 0xF - -#define BRW_WIDTH_1 0 -#define BRW_WIDTH_2 1 -#define BRW_WIDTH_4 2 -#define BRW_WIDTH_8 3 -#define BRW_WIDTH_16 4 - -#define BRW_STATELESS_BUFFER_BOUNDARY_1K 0 -#define BRW_STATELESS_BUFFER_BOUNDARY_2K 1 -#define BRW_STATELESS_BUFFER_BOUNDARY_4K 2 -#define BRW_STATELESS_BUFFER_BOUNDARY_8K 3 -#define BRW_STATELESS_BUFFER_BOUNDARY_16K 4 -#define BRW_STATELESS_BUFFER_BOUNDARY_32K 5 -#define BRW_STATELESS_BUFFER_BOUNDARY_64K 6 -#define BRW_STATELESS_BUFFER_BOUNDARY_128K 7 -#define BRW_STATELESS_BUFFER_BOUNDARY_256K 8 -#define BRW_STATELESS_BUFFER_BOUNDARY_512K 9 -#define BRW_STATELESS_BUFFER_BOUNDARY_1M 10 -#define BRW_STATELESS_BUFFER_BOUNDARY_2M 11 - -#define BRW_POLYGON_FACING_FRONT 0 -#define BRW_POLYGON_FACING_BACK 1 - -#define BRW_MESSAGE_TARGET_NULL 0 -#define BRW_MESSAGE_TARGET_MATH 1 -#define BRW_MESSAGE_TARGET_SAMPLER 2 -#define BRW_MESSAGE_TARGET_GATEWAY 3 -#define BRW_MESSAGE_TARGET_DATAPORT_READ 4 -#define BRW_MESSAGE_TARGET_DATAPORT_WRITE 5 -#define BRW_MESSAGE_TARGET_URB 6 -#define BRW_MESSAGE_TARGET_THREAD_SPAWNER 7 - -#define BRW_SAMPLER_RETURN_FORMAT_FLOAT32 0 -#define BRW_SAMPLER_RETURN_FORMAT_UINT32 2 -#define BRW_SAMPLER_RETURN_FORMAT_SINT32 3 - -#define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE 0 -#define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE 0 -#define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS 0 -#define BRW_SAMPLER_MESSAGE_SIMD8_KILLPIX 1 -#define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_LOD 1 -#define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_LOD 1 -#define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_GRADIENTS 2 -#define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_GRADIENTS 2 -#define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_COMPARE 0 -#define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE 2 -#define BRW_SAMPLER_MESSAGE_SIMD4X2_RESINFO 2 -#define BRW_SAMPLER_MESSAGE_SIMD8_RESINFO 2 -#define BRW_SAMPLER_MESSAGE_SIMD16_RESINFO 2 -#define BRW_SAMPLER_MESSAGE_SIMD4X2_LD 3 -#define BRW_SAMPLER_MESSAGE_SIMD8_LD 3 -#define BRW_SAMPLER_MESSAGE_SIMD16_LD 3 - -#define BRW_DATAPORT_OWORD_BLOCK_1_OWORDLOW 0 -#define BRW_DATAPORT_OWORD_BLOCK_1_OWORDHIGH 1 -#define BRW_DATAPORT_OWORD_BLOCK_2_OWORDS 2 -#define BRW_DATAPORT_OWORD_BLOCK_4_OWORDS 3 -#define BRW_DATAPORT_OWORD_BLOCK_8_OWORDS 4 - -#define BRW_DATAPORT_OWORD_DUAL_BLOCK_1OWORD 0 -#define BRW_DATAPORT_OWORD_DUAL_BLOCK_4OWORDS 2 - -#define BRW_DATAPORT_DWORD_SCATTERED_BLOCK_8DWORDS 2 -#define BRW_DATAPORT_DWORD_SCATTERED_BLOCK_16DWORDS 3 - -#define BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ 0 -#define BRW_DATAPORT_READ_MESSAGE_OWORD_DUAL_BLOCK_READ 1 -#define BRW_DATAPORT_READ_MESSAGE_DWORD_BLOCK_READ 2 -#define BRW_DATAPORT_READ_MESSAGE_DWORD_SCATTERED_READ 3 - -#define BRW_DATAPORT_READ_TARGET_DATA_CACHE 0 -#define BRW_DATAPORT_READ_TARGET_RENDER_CACHE 1 -#define BRW_DATAPORT_READ_TARGET_SAMPLER_CACHE 2 - -#define BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE 0 -#define BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE_REPLICATED 1 -#define BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD8_DUAL_SOURCE_SUBSPAN01 2 -#define BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD8_DUAL_SOURCE_SUBSPAN23 3 -#define BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD8_SINGLE_SOURCE_SUBSPAN01 4 - -#define BRW_DATAPORT_WRITE_MESSAGE_OWORD_BLOCK_WRITE 0 -#define BRW_DATAPORT_WRITE_MESSAGE_OWORD_DUAL_BLOCK_WRITE 1 -#define BRW_DATAPORT_WRITE_MESSAGE_DWORD_BLOCK_WRITE 2 -#define BRW_DATAPORT_WRITE_MESSAGE_DWORD_SCATTERED_WRITE 3 -#define BRW_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE 4 -#define BRW_DATAPORT_WRITE_MESSAGE_STREAMED_VERTEX_BUFFER_WRITE 5 -#define BRW_DATAPORT_WRITE_MESSAGE_FLUSH_RENDER_CACHE 7 - -#define BRW_MATH_FUNCTION_INV 1 -#define BRW_MATH_FUNCTION_LOG 2 -#define BRW_MATH_FUNCTION_EXP 3 -#define BRW_MATH_FUNCTION_SQRT 4 -#define BRW_MATH_FUNCTION_RSQ 5 -#define BRW_MATH_FUNCTION_SIN 6 /* was 7 */ -#define BRW_MATH_FUNCTION_COS 7 /* was 8 */ -#define BRW_MATH_FUNCTION_SINCOS 8 /* was 6 */ -#define BRW_MATH_FUNCTION_TAN 9 -#define BRW_MATH_FUNCTION_POW 10 -#define BRW_MATH_FUNCTION_INT_DIV_QUOTIENT_AND_REMAINDER 11 -#define BRW_MATH_FUNCTION_INT_DIV_QUOTIENT 12 -#define BRW_MATH_FUNCTION_INT_DIV_REMAINDER 13 - -#define BRW_MATH_INTEGER_UNSIGNED 0 -#define BRW_MATH_INTEGER_SIGNED 1 - -#define BRW_MATH_PRECISION_FULL 0 -#define BRW_MATH_PRECISION_PARTIAL 1 - -#define BRW_MATH_SATURATE_NONE 0 -#define BRW_MATH_SATURATE_SATURATE 1 - -#define BRW_MATH_DATA_VECTOR 0 -#define BRW_MATH_DATA_SCALAR 1 - -#define BRW_URB_OPCODE_WRITE 0 - -#define BRW_URB_SWIZZLE_NONE 0 -#define BRW_URB_SWIZZLE_INTERLEAVE 1 -#define BRW_URB_SWIZZLE_TRANSPOSE 2 - -#define BRW_SCRATCH_SPACE_SIZE_1K 0 -#define BRW_SCRATCH_SPACE_SIZE_2K 1 -#define BRW_SCRATCH_SPACE_SIZE_4K 2 -#define BRW_SCRATCH_SPACE_SIZE_8K 3 -#define BRW_SCRATCH_SPACE_SIZE_16K 4 -#define BRW_SCRATCH_SPACE_SIZE_32K 5 -#define BRW_SCRATCH_SPACE_SIZE_64K 6 -#define BRW_SCRATCH_SPACE_SIZE_128K 7 -#define BRW_SCRATCH_SPACE_SIZE_256K 8 -#define BRW_SCRATCH_SPACE_SIZE_512K 9 -#define BRW_SCRATCH_SPACE_SIZE_1M 10 -#define BRW_SCRATCH_SPACE_SIZE_2M 11 - - - - -#define CMD_URB_FENCE 0x6000 -#define CMD_CONST_BUFFER_STATE 0x6001 -#define CMD_CONST_BUFFER 0x6002 - -#define CMD_STATE_BASE_ADDRESS 0x6101 -#define CMD_STATE_INSN_POINTER 0x6102 -#define CMD_PIPELINE_SELECT 0x6104 - -#define CMD_PIPELINED_STATE_POINTERS 0x7800 -#define CMD_BINDING_TABLE_PTRS 0x7801 -#define CMD_VERTEX_BUFFER 0x7808 -#define CMD_VERTEX_ELEMENT 0x7809 -#define CMD_INDEX_BUFFER 0x780a -#define CMD_VF_STATISTICS 0x780b - -#define CMD_DRAW_RECT 0x7900 -#define CMD_BLEND_CONSTANT_COLOR 0x7901 -#define CMD_CHROMA_KEY 0x7904 -#define CMD_DEPTH_BUFFER 0x7905 -#define CMD_POLY_STIPPLE_OFFSET 0x7906 -#define CMD_POLY_STIPPLE_PATTERN 0x7907 -#define CMD_LINE_STIPPLE_PATTERN 0x7908 -#define CMD_GLOBAL_DEPTH_OFFSET_CLAMP 0x7909 - -#define CMD_PIPE_CONTROL 0x7a00 - -#define CMD_3D_PRIM 0x7b00 - -#define CMD_MI_FLUSH 0x0200 - - -/* Various values from the R0 vertex header: - */ -#define R02_PRIM_END 0x1 -#define R02_PRIM_START 0x2 - - - -#endif diff --git a/src/gallium/drivers/i965simple/brw_draw.c b/src/gallium/drivers/i965simple/brw_draw.c deleted file mode 100644 index 49d80cb41c..0000000000 --- a/src/gallium/drivers/i965simple/brw_draw.c +++ /dev/null @@ -1,226 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include - -#include "brw_batch.h" -#include "brw_draw.h" -#include "brw_defines.h" -#include "brw_context.h" -#include "brw_state.h" - -#include "pipe/p_context.h" -#include "pipe/internal/p_winsys_screen.h" -#include "util/u_prim.h" - -static unsigned hw_prim[PIPE_PRIM_POLYGON+1] = { - _3DPRIM_POINTLIST, - _3DPRIM_LINELIST, - _3DPRIM_LINELOOP, - _3DPRIM_LINESTRIP, - _3DPRIM_TRILIST, - _3DPRIM_TRISTRIP, - _3DPRIM_TRIFAN, - _3DPRIM_QUADLIST, - _3DPRIM_QUADSTRIP, - _3DPRIM_POLYGON -}; - - -/* When the primitive changes, set a state bit and re-validate. Not - * the nicest and would rather deal with this by having all the - * programs be immune to the active primitive (ie. cope with all - * possibilities). That may not be realistic however. - */ -static void brw_set_prim(struct brw_context *brw, int prim) -{ - PRINT("PRIM: %d\n", prim); - - /* Slight optimization to avoid the GS program when not needed: - */ - if (prim == PIPE_PRIM_QUAD_STRIP && - brw->attribs.Raster->flatshade && - brw->attribs.Raster->fill_cw == PIPE_POLYGON_MODE_FILL && - brw->attribs.Raster->fill_ccw == PIPE_POLYGON_MODE_FILL) - prim = PIPE_PRIM_TRIANGLE_STRIP; - - if (prim != brw->primitive) { - brw->primitive = prim; - brw->state.dirty.brw |= BRW_NEW_PRIMITIVE; - - if (u_reduced_prim(prim) != brw->reduced_primitive) { - brw->reduced_primitive = u_reduced_prim(prim); - brw->state.dirty.brw |= BRW_NEW_REDUCED_PRIMITIVE; - } - - brw_validate_state(brw); - } - -} - - -static unsigned trim(int prim, unsigned length) -{ - if (prim == PIPE_PRIM_QUAD_STRIP) - return length > 3 ? (length - length % 2) : 0; - else if (prim == PIPE_PRIM_QUADS) - return length - length % 4; - else - return length; -} - - - -static boolean brw_emit_prim( struct brw_context *brw, - boolean indexed, - unsigned start, - unsigned count ) - -{ - struct brw_3d_primitive prim_packet; - - if (BRW_DEBUG & DEBUG_PRIMS) - PRINT("PRIM: %d %d %d\n", brw->primitive, start, count); - - prim_packet.header.opcode = CMD_3D_PRIM; - prim_packet.header.length = sizeof(prim_packet)/4 - 2; - prim_packet.header.pad = 0; - prim_packet.header.topology = hw_prim[brw->primitive]; - prim_packet.header.indexed = indexed; - - prim_packet.verts_per_instance = trim(brw->primitive, count); - prim_packet.start_vert_location = start; - prim_packet.instance_count = 1; - prim_packet.start_instance_location = 0; - prim_packet.base_vert_location = 0; - - if (prim_packet.verts_per_instance == 0) - return TRUE; - - return brw_batchbuffer_data( brw->winsys, - &prim_packet, - sizeof(prim_packet) ); -} - - -/* May fail if out of video memory for texture or vbo upload, or on - * fallback conditions. - */ -static boolean brw_try_draw_elements( struct pipe_context *pipe, - struct pipe_buffer *index_buffer, - unsigned index_size, - unsigned mode, - unsigned start, - unsigned count ) -{ - struct brw_context *brw = brw_context(pipe); - - /* Set the first primitive ahead of validate_state: - */ - brw_set_prim(brw, mode); - - /* Upload index, vertex data: - */ - if (index_buffer && - !brw_upload_indices( brw, index_buffer, index_size, start, count )) - return FALSE; - - if (!brw_upload_vertex_buffers(brw)) - return FALSE; - - if (!brw_upload_vertex_elements( brw )) - return FALSE; - - /* XXX: Need to separate validate and upload of state. - */ - if (brw->state.dirty.brw) - brw_validate_state( brw ); - - if (!brw_emit_prim(brw, index_buffer != NULL, - start, count)) - return FALSE; - - return TRUE; -} - - - -static boolean brw_draw_elements( struct pipe_context *pipe, - struct pipe_buffer *indexBuffer, - unsigned indexSize, - unsigned mode, - unsigned start, - unsigned count ) -{ - if (!brw_try_draw_elements( pipe, - indexBuffer, - indexSize, - mode, start, count )) - { - /* flush ? */ - - if (!brw_try_draw_elements( pipe, - indexBuffer, - indexSize, - mode, start, - count )) { - assert(0); - return FALSE; - } - } - - return TRUE; -} - - - -static boolean brw_draw_arrays( struct pipe_context *pipe, - unsigned mode, - unsigned start, - unsigned count ) -{ - if (!brw_try_draw_elements( pipe, NULL, 0, mode, start, count )) { - /* flush ? */ - - if (!brw_try_draw_elements( pipe, NULL, 0, mode, start, count )) { - assert(0); - return FALSE; - } - } - - return TRUE; -} - - - -void brw_init_draw_functions( struct brw_context *brw ) -{ - brw->pipe.draw_arrays = brw_draw_arrays; - brw->pipe.draw_elements = brw_draw_elements; -} - - diff --git a/src/gallium/drivers/i965simple/brw_draw.h b/src/gallium/drivers/i965simple/brw_draw.h deleted file mode 100644 index 62fe0d5d0e..0000000000 --- a/src/gallium/drivers/i965simple/brw_draw.h +++ /dev/null @@ -1,55 +0,0 @@ - /************************************************************************** - * - * Copyright 2005 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. - * - **************************************************************************/ - -#ifndef BRW_DRAW_H -#define BRW_DRAW_H - -#include "pipe/p_context.h" - -struct brw_context; - - - -void brw_init_draw_functions( struct brw_context *brw ); - - -boolean brw_upload_vertices( struct brw_context *brw, - unsigned min_index, - unsigned max_index ); - -boolean brw_upload_indices(struct brw_context *brw, - const struct pipe_buffer *index_buffer, - int ib_size, int start, int count); - -boolean brw_upload_vertex_buffers( struct brw_context *brw ); -boolean brw_upload_vertex_elements( struct brw_context *brw ); - -unsigned brw_translate_surface_format( unsigned id ); - - - -#endif diff --git a/src/gallium/drivers/i965simple/brw_draw_upload.c b/src/gallium/drivers/i965simple/brw_draw_upload.c deleted file mode 100644 index 2d9ca3f2ea..0000000000 --- a/src/gallium/drivers/i965simple/brw_draw_upload.c +++ /dev/null @@ -1,300 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include - -#include "brw_batch.h" -#include "brw_draw.h" -#include "brw_defines.h" -#include "brw_context.h" -#include "brw_state.h" - - -struct brw_array_state { - union header_union header; - - struct { - union { - struct { - unsigned pitch:11; - unsigned pad:15; - unsigned access_type:1; - unsigned vb_index:5; - } bits; - unsigned dword; - } vb0; - - struct pipe_buffer *buffer; - unsigned offset; - - unsigned max_index; - unsigned instance_data_step_rate; - - } vb[BRW_VBP_MAX]; -}; - - - -unsigned brw_translate_surface_format( unsigned id ) -{ - switch (id) { - case PIPE_FORMAT_R64_FLOAT: - return BRW_SURFACEFORMAT_R64_FLOAT; - case PIPE_FORMAT_R64G64_FLOAT: - return BRW_SURFACEFORMAT_R64G64_FLOAT; - case PIPE_FORMAT_R64G64B64_FLOAT: - return BRW_SURFACEFORMAT_R64G64B64_FLOAT; - case PIPE_FORMAT_R64G64B64A64_FLOAT: - return BRW_SURFACEFORMAT_R64G64B64A64_FLOAT; - - case PIPE_FORMAT_R32_FLOAT: - return BRW_SURFACEFORMAT_R32_FLOAT; - case PIPE_FORMAT_R32G32_FLOAT: - return BRW_SURFACEFORMAT_R32G32_FLOAT; - case PIPE_FORMAT_R32G32B32_FLOAT: - return BRW_SURFACEFORMAT_R32G32B32_FLOAT; - case PIPE_FORMAT_R32G32B32A32_FLOAT: - return BRW_SURFACEFORMAT_R32G32B32A32_FLOAT; - - case PIPE_FORMAT_R32_UNORM: - return BRW_SURFACEFORMAT_R32_UNORM; - case PIPE_FORMAT_R32G32_UNORM: - return BRW_SURFACEFORMAT_R32G32_UNORM; - case PIPE_FORMAT_R32G32B32_UNORM: - return BRW_SURFACEFORMAT_R32G32B32_UNORM; - case PIPE_FORMAT_R32G32B32A32_UNORM: - return BRW_SURFACEFORMAT_R32G32B32A32_UNORM; - - case PIPE_FORMAT_R32_USCALED: - return BRW_SURFACEFORMAT_R32_USCALED; - case PIPE_FORMAT_R32G32_USCALED: - return BRW_SURFACEFORMAT_R32G32_USCALED; - case PIPE_FORMAT_R32G32B32_USCALED: - return BRW_SURFACEFORMAT_R32G32B32_USCALED; - case PIPE_FORMAT_R32G32B32A32_USCALED: - return BRW_SURFACEFORMAT_R32G32B32A32_USCALED; - - case PIPE_FORMAT_R32_SNORM: - return BRW_SURFACEFORMAT_R32_SNORM; - case PIPE_FORMAT_R32G32_SNORM: - return BRW_SURFACEFORMAT_R32G32_SNORM; - case PIPE_FORMAT_R32G32B32_SNORM: - return BRW_SURFACEFORMAT_R32G32B32_SNORM; - case PIPE_FORMAT_R32G32B32A32_SNORM: - return BRW_SURFACEFORMAT_R32G32B32A32_SNORM; - - case PIPE_FORMAT_R32_SSCALED: - return BRW_SURFACEFORMAT_R32_SSCALED; - case PIPE_FORMAT_R32G32_SSCALED: - return BRW_SURFACEFORMAT_R32G32_SSCALED; - case PIPE_FORMAT_R32G32B32_SSCALED: - return BRW_SURFACEFORMAT_R32G32B32_SSCALED; - case PIPE_FORMAT_R32G32B32A32_SSCALED: - return BRW_SURFACEFORMAT_R32G32B32A32_SSCALED; - - case PIPE_FORMAT_R16_UNORM: - return BRW_SURFACEFORMAT_R16_UNORM; - case PIPE_FORMAT_R16G16_UNORM: - return BRW_SURFACEFORMAT_R16G16_UNORM; - case PIPE_FORMAT_R16G16B16_UNORM: - return BRW_SURFACEFORMAT_R16G16B16_UNORM; - case PIPE_FORMAT_R16G16B16A16_UNORM: - return BRW_SURFACEFORMAT_R16G16B16A16_UNORM; - - case PIPE_FORMAT_R16_USCALED: - return BRW_SURFACEFORMAT_R16_USCALED; - case PIPE_FORMAT_R16G16_USCALED: - return BRW_SURFACEFORMAT_R16G16_USCALED; - case PIPE_FORMAT_R16G16B16_USCALED: - return BRW_SURFACEFORMAT_R16G16B16_USCALED; - case PIPE_FORMAT_R16G16B16A16_USCALED: - return BRW_SURFACEFORMAT_R16G16B16A16_USCALED; - - case PIPE_FORMAT_R16_SNORM: - return BRW_SURFACEFORMAT_R16_SNORM; - case PIPE_FORMAT_R16G16_SNORM: - return BRW_SURFACEFORMAT_R16G16_SNORM; - case PIPE_FORMAT_R16G16B16_SNORM: - return BRW_SURFACEFORMAT_R16G16B16_SNORM; - case PIPE_FORMAT_R16G16B16A16_SNORM: - return BRW_SURFACEFORMAT_R16G16B16A16_SNORM; - - case PIPE_FORMAT_R16_SSCALED: - return BRW_SURFACEFORMAT_R16_SSCALED; - case PIPE_FORMAT_R16G16_SSCALED: - return BRW_SURFACEFORMAT_R16G16_SSCALED; - case PIPE_FORMAT_R16G16B16_SSCALED: - return BRW_SURFACEFORMAT_R16G16B16_SSCALED; - case PIPE_FORMAT_R16G16B16A16_SSCALED: - return BRW_SURFACEFORMAT_R16G16B16A16_SSCALED; - - case PIPE_FORMAT_R8_UNORM: - return BRW_SURFACEFORMAT_R8_UNORM; - case PIPE_FORMAT_R8G8_UNORM: - return BRW_SURFACEFORMAT_R8G8_UNORM; - case PIPE_FORMAT_R8G8B8_UNORM: - return BRW_SURFACEFORMAT_R8G8B8_UNORM; - case PIPE_FORMAT_R8G8B8A8_UNORM: - return BRW_SURFACEFORMAT_R8G8B8A8_UNORM; - - case PIPE_FORMAT_R8_USCALED: - return BRW_SURFACEFORMAT_R8_USCALED; - case PIPE_FORMAT_R8G8_USCALED: - return BRW_SURFACEFORMAT_R8G8_USCALED; - case PIPE_FORMAT_R8G8B8_USCALED: - return BRW_SURFACEFORMAT_R8G8B8_USCALED; - case PIPE_FORMAT_R8G8B8A8_USCALED: - return BRW_SURFACEFORMAT_R8G8B8A8_USCALED; - - case PIPE_FORMAT_R8_SNORM: - return BRW_SURFACEFORMAT_R8_SNORM; - case PIPE_FORMAT_R8G8_SNORM: - return BRW_SURFACEFORMAT_R8G8_SNORM; - case PIPE_FORMAT_R8G8B8_SNORM: - return BRW_SURFACEFORMAT_R8G8B8_SNORM; - case PIPE_FORMAT_R8G8B8A8_SNORM: - return BRW_SURFACEFORMAT_R8G8B8A8_SNORM; - - case PIPE_FORMAT_R8_SSCALED: - return BRW_SURFACEFORMAT_R8_SSCALED; - case PIPE_FORMAT_R8G8_SSCALED: - return BRW_SURFACEFORMAT_R8G8_SSCALED; - case PIPE_FORMAT_R8G8B8_SSCALED: - return BRW_SURFACEFORMAT_R8G8B8_SSCALED; - case PIPE_FORMAT_R8G8B8A8_SSCALED: - return BRW_SURFACEFORMAT_R8G8B8A8_SSCALED; - - default: - assert(0); - return 0; - } -} - -static unsigned get_index_type(int type) -{ - switch (type) { - case 1: return BRW_INDEX_BYTE; - case 2: return BRW_INDEX_WORD; - case 4: return BRW_INDEX_DWORD; - default: assert(0); return 0; - } -} - - -boolean brw_upload_vertex_buffers( struct brw_context *brw ) -{ - struct brw_array_state vbp; - unsigned nr_enabled = 0; - unsigned i; - - memset(&vbp, 0, sizeof(vbp)); - - /* This is a hardware limit: - */ - - for (i = 0; i < BRW_VEP_MAX; i++) - { - if (brw->vb.vbo_array[i] == NULL) { - nr_enabled = i; - break; - } - - vbp.vb[i].vb0.bits.pitch = brw->vb.vbo_array[i]->stride; - vbp.vb[i].vb0.bits.pad = 0; - vbp.vb[i].vb0.bits.access_type = BRW_VERTEXBUFFER_ACCESS_VERTEXDATA; - vbp.vb[i].vb0.bits.vb_index = i; - vbp.vb[i].offset = brw->vb.vbo_array[i]->buffer_offset; - vbp.vb[i].buffer = brw->vb.vbo_array[i]->buffer; - vbp.vb[i].max_index = brw->vb.vbo_array[i]->max_index; - } - - - vbp.header.bits.length = (1 + nr_enabled * 4) - 2; - vbp.header.bits.opcode = CMD_VERTEX_BUFFER; - - BEGIN_BATCH(vbp.header.bits.length+2, 0); - OUT_BATCH( vbp.header.dword ); - - for (i = 0; i < nr_enabled; i++) { - OUT_BATCH( vbp.vb[i].vb0.dword ); - OUT_RELOC( vbp.vb[i].buffer, PIPE_BUFFER_USAGE_GPU_READ, - vbp.vb[i].offset); - OUT_BATCH( vbp.vb[i].max_index ); - OUT_BATCH( vbp.vb[i].instance_data_step_rate ); - } - ADVANCE_BATCH(); - return TRUE; -} - - - -boolean brw_upload_vertex_elements( struct brw_context *brw ) -{ - struct brw_vertex_element_packet vep; - - unsigned i; - unsigned nr_enabled = brw->attribs.VertexProgram->info.num_inputs; - - memset(&vep, 0, sizeof(vep)); - - for (i = 0; i < nr_enabled; i++) - vep.ve[i] = brw->vb.inputs[i]; - - - vep.header.length = (1 + nr_enabled * sizeof(vep.ve[0])/4) - 2; - vep.header.opcode = CMD_VERTEX_ELEMENT; - brw_cached_batch_struct(brw, &vep, 4 + nr_enabled * sizeof(vep.ve[0])); - - return TRUE; -} - -boolean brw_upload_indices( struct brw_context *brw, - const struct pipe_buffer *index_buffer, - int ib_size, int start, int count) -{ - /* Emit the indexbuffer packet: - */ - { - struct brw_indexbuffer ib; - - memset(&ib, 0, sizeof(ib)); - - ib.header.bits.opcode = CMD_INDEX_BUFFER; - ib.header.bits.length = sizeof(ib)/4 - 2; - ib.header.bits.index_format = get_index_type(ib_size); - ib.header.bits.cut_index_enable = 0; - - - BEGIN_BATCH(4, 0); - OUT_BATCH( ib.header.dword ); - OUT_RELOC( index_buffer, PIPE_BUFFER_USAGE_GPU_READ, start); - OUT_RELOC( index_buffer, PIPE_BUFFER_USAGE_GPU_READ, start + count); - OUT_BATCH( 0 ); - ADVANCE_BATCH(); - } - return TRUE; -} diff --git a/src/gallium/drivers/i965simple/brw_eu.c b/src/gallium/drivers/i965simple/brw_eu.c deleted file mode 100644 index e2002d1821..0000000000 --- a/src/gallium/drivers/i965simple/brw_eu.c +++ /dev/null @@ -1,130 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#include "brw_context.h" -#include "brw_defines.h" -#include "brw_eu.h" - - - -/* How does predicate control work when execution_size != 8? Do I - * need to test/set for 0xffff when execution_size is 16? - */ -void brw_set_predicate_control_flag_value( struct brw_compile *p, unsigned value ) -{ - p->current->header.predicate_control = BRW_PREDICATE_NONE; - - if (value != 0xff) { - if (value != p->flag_value) { - brw_push_insn_state(p); - brw_MOV(p, brw_flag_reg(), brw_imm_uw(value)); - p->flag_value = value; - brw_pop_insn_state(p); - } - - p->current->header.predicate_control = BRW_PREDICATE_NORMAL; - } -} - -void brw_set_predicate_control( struct brw_compile *p, unsigned pc ) -{ - p->current->header.predicate_control = pc; -} - -void brw_set_conditionalmod( struct brw_compile *p, unsigned conditional ) -{ - p->current->header.destreg__conditonalmod = conditional; -} - -void brw_set_access_mode( struct brw_compile *p, unsigned access_mode ) -{ - p->current->header.access_mode = access_mode; -} - -void brw_set_compression_control( struct brw_compile *p, boolean compression_control ) -{ - p->current->header.compression_control = compression_control; -} - -void brw_set_mask_control( struct brw_compile *p, unsigned value ) -{ - p->current->header.mask_control = value; -} - -void brw_set_saturate( struct brw_compile *p, unsigned value ) -{ - p->current->header.saturate = value; -} - -void brw_push_insn_state( struct brw_compile *p ) -{ - assert(p->current != &p->stack[BRW_EU_MAX_INSN_STACK-1]); - memcpy(p->current+1, p->current, sizeof(struct brw_instruction)); - p->current++; -} - -void brw_pop_insn_state( struct brw_compile *p ) -{ - assert(p->current != p->stack); - p->current--; -} - - -/*********************************************************************** - */ -void brw_init_compile( struct brw_compile *p ) -{ - p->nr_insn = 0; - p->current = p->stack; - memset(p->current, 0, sizeof(p->current[0])); - - /* Some defaults? - */ - brw_set_mask_control(p, BRW_MASK_ENABLE); /* what does this do? */ - brw_set_saturate(p, 0); - brw_set_compression_control(p, BRW_COMPRESSION_NONE); - brw_set_predicate_control_flag_value(p, 0xff); -} - - -const unsigned *brw_get_program( struct brw_compile *p, - unsigned *sz ) -{ - unsigned i; - - for (i = 0; i < 8; i++) - brw_NOP(p); - - *sz = p->nr_insn * sizeof(struct brw_instruction); - return (const unsigned *)p->store; -} - diff --git a/src/gallium/drivers/i965simple/brw_eu.h b/src/gallium/drivers/i965simple/brw_eu.h deleted file mode 100644 index 23151ae9ed..0000000000 --- a/src/gallium/drivers/i965simple/brw_eu.h +++ /dev/null @@ -1,888 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#ifndef BRW_EU_H -#define BRW_EU_H - -#include "brw_structs.h" -#include "brw_defines.h" - -#include "pipe/p_compiler.h" -#include "pipe/p_shader_tokens.h" - -#define BRW_SWIZZLE4(a,b,c,d) (((a)<<0) | ((b)<<2) | ((c)<<4) | ((d)<<6)) -#define BRW_GET_SWZ(swz, idx) (((swz) >> ((idx)*2)) & 0x3) - -#define BRW_SWIZZLE_NOOP BRW_SWIZZLE4(0,1,2,3) -#define BRW_SWIZZLE_XYZW BRW_SWIZZLE4(0,1,2,3) -#define BRW_SWIZZLE_XXXX BRW_SWIZZLE4(0,0,0,0) -#define BRW_SWIZZLE_XYXY BRW_SWIZZLE4(0,1,0,1) - - -#define REG_SIZE (8*4) - - -/* These aren't hardware structs, just something useful for us to pass around: - * - * Align1 operation has a lot of control over input ranges. Used in - * WM programs to implement shaders decomposed into "channel serial" - * or "structure of array" form: - */ -struct brw_reg -{ - unsigned type:4; - unsigned file:2; - unsigned nr:8; - unsigned subnr:5; /* :1 in align16 */ - unsigned negate:1; /* source only */ - unsigned abs:1; /* source only */ - unsigned vstride:4; /* source only */ - unsigned width:3; /* src only, align1 only */ - unsigned hstride:2; /* src only, align1 only */ - unsigned address_mode:1; /* relative addressing, hopefully! */ - unsigned pad0:1; - - union { - struct { - unsigned swizzle:8; /* src only, align16 only */ - unsigned writemask:4; /* dest only, align16 only */ - int indirect_offset:10; /* relative addressing offset */ - unsigned pad1:10; /* two dwords total */ - } bits; - - float f; - int d; - unsigned ud; - } dw1; -}; - - -struct brw_indirect { - unsigned addr_subnr:4; - int addr_offset:10; - unsigned pad:18; -}; - - -#define BRW_EU_MAX_INSN_STACK 5 -#define BRW_EU_MAX_INSN 1200 - -struct brw_compile { - struct brw_instruction store[BRW_EU_MAX_INSN]; - unsigned nr_insn; - - /* Allow clients to push/pop instruction state: - */ - struct brw_instruction stack[BRW_EU_MAX_INSN_STACK]; - struct brw_instruction *current; - - unsigned flag_value; - boolean single_program_flow; -}; - - - -static __inline int type_sz( unsigned type ) -{ - switch( type ) { - case BRW_REGISTER_TYPE_UD: - case BRW_REGISTER_TYPE_D: - case BRW_REGISTER_TYPE_F: - return 4; - case BRW_REGISTER_TYPE_HF: - case BRW_REGISTER_TYPE_UW: - case BRW_REGISTER_TYPE_W: - return 2; - case BRW_REGISTER_TYPE_UB: - case BRW_REGISTER_TYPE_B: - return 1; - default: - return 0; - } -} - -static __inline struct brw_reg brw_reg( unsigned file, - unsigned nr, - unsigned subnr, - unsigned type, - unsigned vstride, - unsigned width, - unsigned hstride, - unsigned swizzle, - unsigned writemask) -{ - - struct brw_reg reg; - reg.type = type; - reg.file = file; - reg.nr = nr; - reg.subnr = subnr * type_sz(type); - reg.negate = 0; - reg.abs = 0; - reg.vstride = vstride; - reg.width = width; - reg.hstride = hstride; - reg.address_mode = BRW_ADDRESS_DIRECT; - reg.pad0 = 0; - - /* Could do better: If the reg is r5.3<0;1,0>, we probably want to - * set swizzle and writemask to W, as the lower bits of subnr will - * be lost when converted to align16. This is probably too much to - * keep track of as you'd want it adjusted by suboffset(), etc. - * Perhaps fix up when converting to align16? - */ - reg.dw1.bits.swizzle = swizzle; - reg.dw1.bits.writemask = writemask; - reg.dw1.bits.indirect_offset = 0; - reg.dw1.bits.pad1 = 0; - return reg; -} - -static __inline struct brw_reg brw_vec16_reg( unsigned file, - unsigned nr, - unsigned subnr ) -{ - return brw_reg(file, - nr, - subnr, - BRW_REGISTER_TYPE_F, - BRW_VERTICAL_STRIDE_16, - BRW_WIDTH_16, - BRW_HORIZONTAL_STRIDE_1, - BRW_SWIZZLE_XYZW, - TGSI_WRITEMASK_XYZW); -} - -static __inline struct brw_reg brw_vec8_reg( unsigned file, - unsigned nr, - unsigned subnr ) -{ - return brw_reg(file, - nr, - subnr, - BRW_REGISTER_TYPE_F, - BRW_VERTICAL_STRIDE_8, - BRW_WIDTH_8, - BRW_HORIZONTAL_STRIDE_1, - BRW_SWIZZLE_XYZW, - TGSI_WRITEMASK_XYZW); -} - - -static __inline struct brw_reg brw_vec4_reg( unsigned file, - unsigned nr, - unsigned subnr ) -{ - return brw_reg(file, - nr, - subnr, - BRW_REGISTER_TYPE_F, - BRW_VERTICAL_STRIDE_4, - BRW_WIDTH_4, - BRW_HORIZONTAL_STRIDE_1, - BRW_SWIZZLE_XYZW, - TGSI_WRITEMASK_XYZW); -} - - -static __inline struct brw_reg brw_vec2_reg( unsigned file, - unsigned nr, - unsigned subnr ) -{ - return brw_reg(file, - nr, - subnr, - BRW_REGISTER_TYPE_F, - BRW_VERTICAL_STRIDE_2, - BRW_WIDTH_2, - BRW_HORIZONTAL_STRIDE_1, - BRW_SWIZZLE_XYXY, - TGSI_WRITEMASK_XY); -} - -static __inline struct brw_reg brw_vec1_reg( unsigned file, - unsigned nr, - unsigned subnr ) -{ - return brw_reg(file, - nr, - subnr, - BRW_REGISTER_TYPE_F, - BRW_VERTICAL_STRIDE_0, - BRW_WIDTH_1, - BRW_HORIZONTAL_STRIDE_0, - BRW_SWIZZLE_XXXX, - TGSI_WRITEMASK_X); -} - - -static __inline struct brw_reg retype( struct brw_reg reg, - unsigned type ) -{ - reg.type = type; - return reg; -} - -static __inline struct brw_reg suboffset( struct brw_reg reg, - unsigned delta ) -{ - reg.subnr += delta * type_sz(reg.type); - return reg; -} - - -static __inline struct brw_reg offset( struct brw_reg reg, - unsigned delta ) -{ - reg.nr += delta; - return reg; -} - - -static __inline struct brw_reg byte_offset( struct brw_reg reg, - unsigned bytes ) -{ - unsigned newoffset = reg.nr * REG_SIZE + reg.subnr + bytes; - reg.nr = newoffset / REG_SIZE; - reg.subnr = newoffset % REG_SIZE; - return reg; -} - - -static __inline struct brw_reg brw_uw16_reg( unsigned file, - unsigned nr, - unsigned subnr ) -{ - return suboffset(retype(brw_vec16_reg(file, nr, 0), BRW_REGISTER_TYPE_UW), subnr); -} - -static __inline struct brw_reg brw_uw8_reg( unsigned file, - unsigned nr, - unsigned subnr ) -{ - return suboffset(retype(brw_vec8_reg(file, nr, 0), BRW_REGISTER_TYPE_UW), subnr); -} - -static __inline struct brw_reg brw_uw1_reg( unsigned file, - unsigned nr, - unsigned subnr ) -{ - return suboffset(retype(brw_vec1_reg(file, nr, 0), BRW_REGISTER_TYPE_UW), subnr); -} - -static __inline struct brw_reg brw_imm_reg( unsigned type ) -{ - return brw_reg( BRW_IMMEDIATE_VALUE, - 0, - 0, - type, - BRW_VERTICAL_STRIDE_0, - BRW_WIDTH_1, - BRW_HORIZONTAL_STRIDE_0, - 0, - 0); -} - -static __inline struct brw_reg brw_imm_f( float f ) -{ - struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_F); - imm.dw1.f = f; - return imm; -} - -static __inline struct brw_reg brw_imm_d( int d ) -{ - struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_D); - imm.dw1.d = d; - return imm; -} - -static __inline struct brw_reg brw_imm_ud( unsigned ud ) -{ - struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_UD); - imm.dw1.ud = ud; - return imm; -} - -static __inline struct brw_reg brw_imm_uw( ushort uw ) -{ - struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_UW); - imm.dw1.ud = uw; - return imm; -} - -static __inline struct brw_reg brw_imm_w( short w ) -{ - struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_W); - imm.dw1.d = w; - return imm; -} - -/* brw_imm_b and brw_imm_ub aren't supported by hardware - the type - * numbers alias with _V and _VF below: - */ - -/* Vector of eight signed half-byte values: - */ -static __inline struct brw_reg brw_imm_v( unsigned v ) -{ - struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_V); - imm.vstride = BRW_VERTICAL_STRIDE_0; - imm.width = BRW_WIDTH_8; - imm.hstride = BRW_HORIZONTAL_STRIDE_1; - imm.dw1.ud = v; - return imm; -} - -/* Vector of four 8-bit float values: - */ -static __inline struct brw_reg brw_imm_vf( unsigned v ) -{ - struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_VF); - imm.vstride = BRW_VERTICAL_STRIDE_0; - imm.width = BRW_WIDTH_4; - imm.hstride = BRW_HORIZONTAL_STRIDE_1; - imm.dw1.ud = v; - return imm; -} - -#define VF_ZERO 0x0 -#define VF_ONE 0x30 -#define VF_NEG (1<<7) - -static __inline struct brw_reg brw_imm_vf4( unsigned v0, - unsigned v1, - unsigned v2, - unsigned v3) -{ - struct brw_reg imm = brw_imm_reg(BRW_REGISTER_TYPE_VF); - imm.vstride = BRW_VERTICAL_STRIDE_0; - imm.width = BRW_WIDTH_4; - imm.hstride = BRW_HORIZONTAL_STRIDE_1; - imm.dw1.ud = ((v0 << 0) | - (v1 << 8) | - (v2 << 16) | - (v3 << 24)); - return imm; -} - - -static __inline struct brw_reg brw_address( struct brw_reg reg ) -{ - return brw_imm_uw(reg.nr * REG_SIZE + reg.subnr); -} - - -static __inline struct brw_reg brw_vec1_grf( unsigned nr, - unsigned subnr ) -{ - return brw_vec1_reg(BRW_GENERAL_REGISTER_FILE, nr, subnr); -} - -static __inline struct brw_reg brw_vec8_grf( unsigned nr, - unsigned subnr ) -{ - return brw_vec8_reg(BRW_GENERAL_REGISTER_FILE, nr, subnr); -} - -static __inline struct brw_reg brw_vec4_grf( unsigned nr, - unsigned subnr ) -{ - return brw_vec4_reg(BRW_GENERAL_REGISTER_FILE, nr, subnr); -} - - -static __inline struct brw_reg brw_vec2_grf( unsigned nr, - unsigned subnr ) -{ - return brw_vec2_reg(BRW_GENERAL_REGISTER_FILE, nr, subnr); -} - -static __inline struct brw_reg brw_uw8_grf( unsigned nr, - unsigned subnr ) -{ - return brw_uw8_reg(BRW_GENERAL_REGISTER_FILE, nr, subnr); -} - -static __inline struct brw_reg brw_null_reg( void ) -{ - return brw_vec8_reg(BRW_ARCHITECTURE_REGISTER_FILE, - BRW_ARF_NULL, - 0); -} - -static __inline struct brw_reg brw_address_reg( unsigned subnr ) -{ - return brw_uw1_reg(BRW_ARCHITECTURE_REGISTER_FILE, - BRW_ARF_ADDRESS, - subnr); -} - -/* If/else instructions break in align16 mode if writemask & swizzle - * aren't xyzw. This goes against the convention for other scalar - * regs: - */ -static __inline struct brw_reg brw_ip_reg( void ) -{ - return brw_reg(BRW_ARCHITECTURE_REGISTER_FILE, - BRW_ARF_IP, - 0, - BRW_REGISTER_TYPE_UD, - BRW_VERTICAL_STRIDE_4, /* ? */ - BRW_WIDTH_1, - BRW_HORIZONTAL_STRIDE_0, - BRW_SWIZZLE_XYZW, /* NOTE! */ - TGSI_WRITEMASK_XYZW); /* NOTE! */ -} - -static __inline struct brw_reg brw_acc_reg( void ) -{ - return brw_vec8_reg(BRW_ARCHITECTURE_REGISTER_FILE, - BRW_ARF_ACCUMULATOR, - 0); -} - - -static __inline struct brw_reg brw_flag_reg( void ) -{ - return brw_uw1_reg(BRW_ARCHITECTURE_REGISTER_FILE, - BRW_ARF_FLAG, - 0); -} - - -static __inline struct brw_reg brw_mask_reg( unsigned subnr ) -{ - return brw_uw1_reg(BRW_ARCHITECTURE_REGISTER_FILE, - BRW_ARF_MASK, - subnr); -} - -static __inline struct brw_reg brw_message_reg( unsigned nr ) -{ - return brw_vec8_reg(BRW_MESSAGE_REGISTER_FILE, - nr, - 0); -} - - - - -/* This is almost always called with a numeric constant argument, so - * make things easy to evaluate at compile time: - */ -static __inline unsigned cvt( unsigned val ) -{ - switch (val) { - case 0: return 0; - case 1: return 1; - case 2: return 2; - case 4: return 3; - case 8: return 4; - case 16: return 5; - case 32: return 6; - } - return 0; -} - -static __inline struct brw_reg stride( struct brw_reg reg, - unsigned vstride, - unsigned width, - unsigned hstride ) -{ - - reg.vstride = cvt(vstride); - reg.width = cvt(width) - 1; - reg.hstride = cvt(hstride); - return reg; -} - -static __inline struct brw_reg vec16( struct brw_reg reg ) -{ - return stride(reg, 16,16,1); -} - -static __inline struct brw_reg vec8( struct brw_reg reg ) -{ - return stride(reg, 8,8,1); -} - -static __inline struct brw_reg vec4( struct brw_reg reg ) -{ - return stride(reg, 4,4,1); -} - -static __inline struct brw_reg vec2( struct brw_reg reg ) -{ - return stride(reg, 2,2,1); -} - -static __inline struct brw_reg vec1( struct brw_reg reg ) -{ - return stride(reg, 0,1,0); -} - -static __inline struct brw_reg get_element( struct brw_reg reg, unsigned elt ) -{ - return vec1(suboffset(reg, elt)); -} - -static __inline struct brw_reg get_element_ud( struct brw_reg reg, unsigned elt ) -{ - return vec1(suboffset(retype(reg, BRW_REGISTER_TYPE_UD), elt)); -} - - -static __inline struct brw_reg brw_swizzle( struct brw_reg reg, - unsigned x, - unsigned y, - unsigned z, - unsigned w) -{ - reg.dw1.bits.swizzle = BRW_SWIZZLE4(BRW_GET_SWZ(reg.dw1.bits.swizzle, x), - BRW_GET_SWZ(reg.dw1.bits.swizzle, y), - BRW_GET_SWZ(reg.dw1.bits.swizzle, z), - BRW_GET_SWZ(reg.dw1.bits.swizzle, w)); - return reg; -} - - -static __inline struct brw_reg brw_swizzle1( struct brw_reg reg, - unsigned x ) -{ - return brw_swizzle(reg, x, x, x, x); -} - -static __inline struct brw_reg brw_writemask( struct brw_reg reg, - unsigned mask ) -{ - reg.dw1.bits.writemask &= mask; - return reg; -} - -static __inline struct brw_reg brw_set_writemask( struct brw_reg reg, - unsigned mask ) -{ - reg.dw1.bits.writemask = mask; - return reg; -} - -static __inline struct brw_reg negate( struct brw_reg reg ) -{ - reg.negate ^= 1; - return reg; -} - -static __inline struct brw_reg brw_abs( struct brw_reg reg ) -{ - reg.abs = 1; - return reg; -} - -/*********************************************************************** - */ -static __inline struct brw_reg brw_vec4_indirect( unsigned subnr, - int offset ) -{ - struct brw_reg reg = brw_vec4_grf(0, 0); - reg.subnr = subnr; - reg.address_mode = BRW_ADDRESS_REGISTER_INDIRECT_REGISTER; - reg.dw1.bits.indirect_offset = offset; - return reg; -} - -static __inline struct brw_reg brw_vec1_indirect( unsigned subnr, - int offset ) -{ - struct brw_reg reg = brw_vec1_grf(0, 0); - reg.subnr = subnr; - reg.address_mode = BRW_ADDRESS_REGISTER_INDIRECT_REGISTER; - reg.dw1.bits.indirect_offset = offset; - return reg; -} - -static __inline struct brw_reg deref_4f(struct brw_indirect ptr, int offset) -{ - return brw_vec4_indirect(ptr.addr_subnr, ptr.addr_offset + offset); -} - -static __inline struct brw_reg deref_1f(struct brw_indirect ptr, int offset) -{ - return brw_vec1_indirect(ptr.addr_subnr, ptr.addr_offset + offset); -} - -static __inline struct brw_reg deref_4b(struct brw_indirect ptr, int offset) -{ - return retype(deref_4f(ptr, offset), BRW_REGISTER_TYPE_B); -} - -static __inline struct brw_reg deref_1uw(struct brw_indirect ptr, int offset) -{ - return retype(deref_1f(ptr, offset), BRW_REGISTER_TYPE_UW); -} - -static __inline struct brw_reg deref_1ud(struct brw_indirect ptr, int offset) -{ - return retype(deref_1f(ptr, offset), BRW_REGISTER_TYPE_UD); -} - -static __inline struct brw_reg get_addr_reg(struct brw_indirect ptr) -{ - return brw_address_reg(ptr.addr_subnr); -} - -static __inline struct brw_indirect brw_indirect_offset( struct brw_indirect ptr, int offset ) -{ - ptr.addr_offset += offset; - return ptr; -} - -static __inline struct brw_indirect brw_indirect( unsigned addr_subnr, int offset ) -{ - struct brw_indirect ptr; - ptr.addr_subnr = addr_subnr; - ptr.addr_offset = offset; - ptr.pad = 0; - return ptr; -} - -static __inline struct brw_instruction *current_insn( struct brw_compile *p) -{ - return &p->store[p->nr_insn]; -} - -void brw_pop_insn_state( struct brw_compile *p ); -void brw_push_insn_state( struct brw_compile *p ); -void brw_set_mask_control( struct brw_compile *p, unsigned value ); -void brw_set_saturate( struct brw_compile *p, unsigned value ); -void brw_set_access_mode( struct brw_compile *p, unsigned access_mode ); -void brw_set_compression_control( struct brw_compile *p, boolean control ); -void brw_set_predicate_control_flag_value( struct brw_compile *p, unsigned value ); -void brw_set_predicate_control( struct brw_compile *p, unsigned pc ); -void brw_set_conditionalmod( struct brw_compile *p, unsigned conditional ); - -void brw_init_compile( struct brw_compile *p ); -const unsigned *brw_get_program( struct brw_compile *p, unsigned *sz ); - - -struct brw_instruction *brw_alu1( struct brw_compile *p, - unsigned opcode, - struct brw_reg dest, - struct brw_reg src ); - -struct brw_instruction *brw_alu2(struct brw_compile *p, - unsigned opcode, - struct brw_reg dest, - struct brw_reg src0, - struct brw_reg src1 ); - -/* Helpers for regular instructions: - */ -#define ALU1(OP) \ -struct brw_instruction *brw_##OP(struct brw_compile *p, \ - struct brw_reg dest, \ - struct brw_reg src0); - -#define ALU2(OP) \ -struct brw_instruction *brw_##OP(struct brw_compile *p, \ - struct brw_reg dest, \ - struct brw_reg src0, \ - struct brw_reg src1); - -ALU1(MOV) -ALU2(SEL) -ALU1(NOT) -ALU2(AND) -ALU2(OR) -ALU2(XOR) -ALU2(SHR) -ALU2(SHL) -ALU2(RSR) -ALU2(RSL) -ALU2(ASR) -ALU2(JMPI) -ALU2(ADD) -ALU2(MUL) -ALU1(FRC) -ALU1(RNDD) -ALU2(MAC) -ALU2(MACH) -ALU1(LZD) -ALU2(DP4) -ALU2(DPH) -ALU2(DP3) -ALU2(DP2) -ALU2(LINE) - -#undef ALU1 -#undef ALU2 - - - -/* Helpers for SEND instruction: - */ -void brw_urb_WRITE(struct brw_compile *p, - struct brw_reg dest, - unsigned msg_reg_nr, - struct brw_reg src0, - boolean allocate, - boolean used, - unsigned msg_length, - unsigned response_length, - boolean eot, - boolean writes_complete, - unsigned offset, - unsigned swizzle); - -void brw_fb_WRITE(struct brw_compile *p, - struct brw_reg dest, - unsigned msg_reg_nr, - struct brw_reg src0, - unsigned binding_table_index, - unsigned msg_length, - unsigned response_length, - boolean eot); - -void brw_SAMPLE(struct brw_compile *p, - struct brw_reg dest, - unsigned msg_reg_nr, - struct brw_reg src0, - unsigned binding_table_index, - unsigned sampler, - unsigned writemask, - unsigned msg_type, - unsigned response_length, - unsigned msg_length, - boolean eot); - -void brw_math_16( struct brw_compile *p, - struct brw_reg dest, - unsigned function, - unsigned saturate, - unsigned msg_reg_nr, - struct brw_reg src, - unsigned precision ); - -void brw_math( struct brw_compile *p, - struct brw_reg dest, - unsigned function, - unsigned saturate, - unsigned msg_reg_nr, - struct brw_reg src, - unsigned data_type, - unsigned precision ); - -void brw_dp_READ_16( struct brw_compile *p, - struct brw_reg dest, - unsigned msg_reg_nr, - unsigned scratch_offset ); - -void brw_dp_WRITE_16( struct brw_compile *p, - struct brw_reg src, - unsigned msg_reg_nr, - unsigned scratch_offset ); - -/* If/else/endif. Works by manipulating the execution flags on each - * channel. - */ -struct brw_instruction *brw_IF(struct brw_compile *p, - unsigned execute_size); - -struct brw_instruction *brw_ELSE(struct brw_compile *p, - struct brw_instruction *if_insn); - -void brw_ENDIF(struct brw_compile *p, - struct brw_instruction *if_or_else_insn); - - -/* DO/WHILE loops: - */ -struct brw_instruction *brw_DO(struct brw_compile *p, - unsigned execute_size); - -struct brw_instruction *brw_WHILE(struct brw_compile *p, - struct brw_instruction *patch_insn); - -struct brw_instruction *brw_BREAK(struct brw_compile *p); -struct brw_instruction *brw_CONT(struct brw_compile *p); -/* Forward jumps: - */ -void brw_land_fwd_jump(struct brw_compile *p, - struct brw_instruction *jmp_insn); - - - -void brw_NOP(struct brw_compile *p); - -/* Special case: there is never a destination, execution size will be - * taken from src0: - */ -void brw_CMP(struct brw_compile *p, - struct brw_reg dest, - unsigned conditional, - struct brw_reg src0, - struct brw_reg src1); - -void brw_print_reg( struct brw_reg reg ); - - -/*********************************************************************** - * brw_eu_util.c: - */ - -void brw_copy_indirect_to_indirect(struct brw_compile *p, - struct brw_indirect dst_ptr, - struct brw_indirect src_ptr, - unsigned count); - -void brw_copy_from_indirect(struct brw_compile *p, - struct brw_reg dst, - struct brw_indirect ptr, - unsigned count); - -void brw_copy4(struct brw_compile *p, - struct brw_reg dst, - struct brw_reg src, - unsigned count); - -void brw_copy8(struct brw_compile *p, - struct brw_reg dst, - struct brw_reg src, - unsigned count); - -void brw_math_invert( struct brw_compile *p, - struct brw_reg dst, - struct brw_reg src); - -void brw_set_src1( struct brw_instruction *insn, - struct brw_reg reg ); -#endif diff --git a/src/gallium/drivers/i965simple/brw_eu_debug.c b/src/gallium/drivers/i965simple/brw_eu_debug.c deleted file mode 100644 index 4adfb0c02f..0000000000 --- a/src/gallium/drivers/i965simple/brw_eu_debug.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#include "util/u_debug.h" - -#include "brw_eu.h" - -void brw_print_reg( struct brw_reg hwreg ) -{ - static const char *file[] = { - "arf", - "grf", - "msg", - "imm" - }; - - static const char *type[] = { - "ud", - "d", - "uw", - "w", - "ub", - "vf", - "hf", - "f" - }; - - debug_printf("%s%s", - hwreg.abs ? "abs/" : "", - hwreg.negate ? "-" : ""); - - if (hwreg.file == BRW_GENERAL_REGISTER_FILE && - hwreg.nr % 2 == 0 && - hwreg.subnr == 0 && - hwreg.vstride == BRW_VERTICAL_STRIDE_8 && - hwreg.width == BRW_WIDTH_8 && - hwreg.hstride == BRW_HORIZONTAL_STRIDE_1 && - hwreg.type == BRW_REGISTER_TYPE_F) { - debug_printf("vec%d", hwreg.nr); - } - else if (hwreg.file == BRW_GENERAL_REGISTER_FILE && - hwreg.vstride == BRW_VERTICAL_STRIDE_0 && - hwreg.width == BRW_WIDTH_1 && - hwreg.hstride == BRW_HORIZONTAL_STRIDE_0 && - hwreg.type == BRW_REGISTER_TYPE_F) { - debug_printf("scl%d.%d", hwreg.nr, hwreg.subnr / 4); - } - else { - debug_printf("%s%d.%d<%d;%d,%d>:%s", - file[hwreg.file], - hwreg.nr, - hwreg.subnr / type_sz(hwreg.type), - hwreg.vstride ? (1<<(hwreg.vstride-1)) : 0, - 1< - */ - - -#include "brw_context.h" -#include "brw_defines.h" -#include "brw_eu.h" - - - - -/*********************************************************************** - * Internal helper for constructing instructions - */ - -static void guess_execution_size( struct brw_instruction *insn, - struct brw_reg reg ) -{ - if (reg.width == BRW_WIDTH_8 && - insn->header.compression_control == BRW_COMPRESSION_COMPRESSED) - insn->header.execution_size = BRW_EXECUTE_16; - else - insn->header.execution_size = reg.width; /* note - definitions are compatible */ -} - - -static void brw_set_dest( struct brw_instruction *insn, - struct brw_reg dest ) -{ - insn->bits1.da1.dest_reg_file = dest.file; - insn->bits1.da1.dest_reg_type = dest.type; - insn->bits1.da1.dest_address_mode = dest.address_mode; - - if (dest.address_mode == BRW_ADDRESS_DIRECT) { - insn->bits1.da1.dest_reg_nr = dest.nr; - - if (insn->header.access_mode == BRW_ALIGN_1) { - insn->bits1.da1.dest_subreg_nr = dest.subnr; - insn->bits1.da1.dest_horiz_stride = BRW_HORIZONTAL_STRIDE_1; - } - else { - insn->bits1.da16.dest_subreg_nr = dest.subnr / 16; - insn->bits1.da16.dest_writemask = dest.dw1.bits.writemask; - } - } - else { - insn->bits1.ia1.dest_subreg_nr = dest.subnr; - - /* These are different sizes in align1 vs align16: - */ - if (insn->header.access_mode == BRW_ALIGN_1) { - insn->bits1.ia1.dest_indirect_offset = dest.dw1.bits.indirect_offset; - insn->bits1.ia1.dest_horiz_stride = BRW_HORIZONTAL_STRIDE_1; - } - else { - insn->bits1.ia16.dest_indirect_offset = dest.dw1.bits.indirect_offset; - } - } - - /* NEW: Set the execution size based on dest.width and - * insn->compression_control: - */ - guess_execution_size(insn, dest); -} - -static void brw_set_src0( struct brw_instruction *insn, - struct brw_reg reg ) -{ - assert(reg.file != BRW_MESSAGE_REGISTER_FILE); - - insn->bits1.da1.src0_reg_file = reg.file; - insn->bits1.da1.src0_reg_type = reg.type; - insn->bits2.da1.src0_abs = reg.abs; - insn->bits2.da1.src0_negate = reg.negate; - insn->bits2.da1.src0_address_mode = reg.address_mode; - - if (reg.file == BRW_IMMEDIATE_VALUE) { - insn->bits3.ud = reg.dw1.ud; - - /* Required to set some fields in src1 as well: - */ - insn->bits1.da1.src1_reg_file = 0; /* arf */ - insn->bits1.da1.src1_reg_type = reg.type; - } - else - { - if (reg.address_mode == BRW_ADDRESS_DIRECT) { - if (insn->header.access_mode == BRW_ALIGN_1) { - insn->bits2.da1.src0_subreg_nr = reg.subnr; - insn->bits2.da1.src0_reg_nr = reg.nr; - } - else { - insn->bits2.da16.src0_subreg_nr = reg.subnr / 16; - insn->bits2.da16.src0_reg_nr = reg.nr; - } - } - else { - insn->bits2.ia1.src0_subreg_nr = reg.subnr; - - if (insn->header.access_mode == BRW_ALIGN_1) { - insn->bits2.ia1.src0_indirect_offset = reg.dw1.bits.indirect_offset; - } - else { - insn->bits2.ia16.src0_subreg_nr = reg.dw1.bits.indirect_offset; - } - } - - if (insn->header.access_mode == BRW_ALIGN_1) { - if (reg.width == BRW_WIDTH_1 && - insn->header.execution_size == BRW_EXECUTE_1) { - insn->bits2.da1.src0_horiz_stride = BRW_HORIZONTAL_STRIDE_0; - insn->bits2.da1.src0_width = BRW_WIDTH_1; - insn->bits2.da1.src0_vert_stride = BRW_VERTICAL_STRIDE_0; - } - else { - insn->bits2.da1.src0_horiz_stride = reg.hstride; - insn->bits2.da1.src0_width = reg.width; - insn->bits2.da1.src0_vert_stride = reg.vstride; - } - } - else { - insn->bits2.da16.src0_swz_x = BRW_GET_SWZ(reg.dw1.bits.swizzle, BRW_CHANNEL_X); - insn->bits2.da16.src0_swz_y = BRW_GET_SWZ(reg.dw1.bits.swizzle, BRW_CHANNEL_Y); - insn->bits2.da16.src0_swz_z = BRW_GET_SWZ(reg.dw1.bits.swizzle, BRW_CHANNEL_Z); - insn->bits2.da16.src0_swz_w = BRW_GET_SWZ(reg.dw1.bits.swizzle, BRW_CHANNEL_W); - - /* This is an oddity of the fact we're using the same - * descriptions for registers in align_16 as align_1: - */ - if (reg.vstride == BRW_VERTICAL_STRIDE_8) - insn->bits2.da16.src0_vert_stride = BRW_VERTICAL_STRIDE_4; - else - insn->bits2.da16.src0_vert_stride = reg.vstride; - } - } -} - - -void brw_set_src1( struct brw_instruction *insn, - struct brw_reg reg ) -{ - assert(reg.file != BRW_MESSAGE_REGISTER_FILE); - - insn->bits1.da1.src1_reg_file = reg.file; - insn->bits1.da1.src1_reg_type = reg.type; - insn->bits3.da1.src1_abs = reg.abs; - insn->bits3.da1.src1_negate = reg.negate; - - /* Only src1 can be immediate in two-argument instructions. - */ - assert(insn->bits1.da1.src0_reg_file != BRW_IMMEDIATE_VALUE); - - if (reg.file == BRW_IMMEDIATE_VALUE) { - insn->bits3.ud = reg.dw1.ud; - } - else { - /* This is a hardware restriction, which may or may not be lifted - * in the future: - */ - assert (reg.address_mode == BRW_ADDRESS_DIRECT); - //assert (reg.file == BRW_GENERAL_REGISTER_FILE); - - if (insn->header.access_mode == BRW_ALIGN_1) { - insn->bits3.da1.src1_subreg_nr = reg.subnr; - insn->bits3.da1.src1_reg_nr = reg.nr; - } - else { - insn->bits3.da16.src1_subreg_nr = reg.subnr / 16; - insn->bits3.da16.src1_reg_nr = reg.nr; - } - - if (insn->header.access_mode == BRW_ALIGN_1) { - if (reg.width == BRW_WIDTH_1 && - insn->header.execution_size == BRW_EXECUTE_1) { - insn->bits3.da1.src1_horiz_stride = BRW_HORIZONTAL_STRIDE_0; - insn->bits3.da1.src1_width = BRW_WIDTH_1; - insn->bits3.da1.src1_vert_stride = BRW_VERTICAL_STRIDE_0; - } - else { - insn->bits3.da1.src1_horiz_stride = reg.hstride; - insn->bits3.da1.src1_width = reg.width; - insn->bits3.da1.src1_vert_stride = reg.vstride; - } - } - else { - insn->bits3.da16.src1_swz_x = BRW_GET_SWZ(reg.dw1.bits.swizzle, BRW_CHANNEL_X); - insn->bits3.da16.src1_swz_y = BRW_GET_SWZ(reg.dw1.bits.swizzle, BRW_CHANNEL_Y); - insn->bits3.da16.src1_swz_z = BRW_GET_SWZ(reg.dw1.bits.swizzle, BRW_CHANNEL_Z); - insn->bits3.da16.src1_swz_w = BRW_GET_SWZ(reg.dw1.bits.swizzle, BRW_CHANNEL_W); - - /* This is an oddity of the fact we're using the same - * descriptions for registers in align_16 as align_1: - */ - if (reg.vstride == BRW_VERTICAL_STRIDE_8) - insn->bits3.da16.src1_vert_stride = BRW_VERTICAL_STRIDE_4; - else - insn->bits3.da16.src1_vert_stride = reg.vstride; - } - } -} - - - -static void brw_set_math_message( struct brw_instruction *insn, - unsigned msg_length, - unsigned response_length, - unsigned function, - unsigned integer_type, - boolean low_precision, - boolean saturate, - unsigned dataType ) -{ - brw_set_src1(insn, brw_imm_d(0)); - - insn->bits3.math.function = function; - insn->bits3.math.int_type = integer_type; - insn->bits3.math.precision = low_precision; - insn->bits3.math.saturate = saturate; - insn->bits3.math.data_type = dataType; - insn->bits3.math.response_length = response_length; - insn->bits3.math.msg_length = msg_length; - insn->bits3.math.msg_target = BRW_MESSAGE_TARGET_MATH; - insn->bits3.math.end_of_thread = 0; -} - -static void brw_set_urb_message( struct brw_instruction *insn, - boolean allocate, - boolean used, - unsigned msg_length, - unsigned response_length, - boolean end_of_thread, - boolean complete, - unsigned offset, - unsigned swizzle_control ) -{ - brw_set_src1(insn, brw_imm_d(0)); - - insn->bits3.urb.opcode = 0; /* ? */ - insn->bits3.urb.offset = offset; - insn->bits3.urb.swizzle_control = swizzle_control; - insn->bits3.urb.allocate = allocate; - insn->bits3.urb.used = used; /* ? */ - insn->bits3.urb.complete = complete; - insn->bits3.urb.response_length = response_length; - insn->bits3.urb.msg_length = msg_length; - insn->bits3.urb.msg_target = BRW_MESSAGE_TARGET_URB; - insn->bits3.urb.end_of_thread = end_of_thread; -} - -static void brw_set_dp_write_message( struct brw_instruction *insn, - unsigned binding_table_index, - unsigned msg_control, - unsigned msg_type, - unsigned msg_length, - unsigned pixel_scoreboard_clear, - unsigned response_length, - unsigned end_of_thread ) -{ - brw_set_src1(insn, brw_imm_d(0)); - - insn->bits3.dp_write.binding_table_index = binding_table_index; - insn->bits3.dp_write.msg_control = msg_control; - insn->bits3.dp_write.pixel_scoreboard_clear = pixel_scoreboard_clear; - insn->bits3.dp_write.msg_type = msg_type; - insn->bits3.dp_write.send_commit_msg = 0; - insn->bits3.dp_write.response_length = response_length; - insn->bits3.dp_write.msg_length = msg_length; - insn->bits3.dp_write.msg_target = BRW_MESSAGE_TARGET_DATAPORT_WRITE; - insn->bits3.urb.end_of_thread = end_of_thread; -} - -static void brw_set_dp_read_message( struct brw_instruction *insn, - unsigned binding_table_index, - unsigned msg_control, - unsigned msg_type, - unsigned target_cache, - unsigned msg_length, - unsigned response_length, - unsigned end_of_thread ) -{ - 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; -} - -static void brw_set_sampler_message( struct brw_instruction *insn, - unsigned binding_table_index, - unsigned sampler, - unsigned msg_type, - unsigned response_length, - unsigned msg_length, - boolean eot) -{ - brw_set_src1(insn, brw_imm_d(0)); - - insn->bits3.sampler.binding_table_index = binding_table_index; - insn->bits3.sampler.sampler = sampler; - insn->bits3.sampler.msg_type = msg_type; - insn->bits3.sampler.return_format = BRW_SAMPLER_RETURN_FORMAT_FLOAT32; - insn->bits3.sampler.response_length = response_length; - insn->bits3.sampler.msg_length = msg_length; - insn->bits3.sampler.end_of_thread = eot; - insn->bits3.sampler.msg_target = BRW_MESSAGE_TARGET_SAMPLER; -} - - - -static struct brw_instruction *next_insn( struct brw_compile *p, - unsigned opcode ) -{ - struct brw_instruction *insn; - - assert(p->nr_insn + 1 < BRW_EU_MAX_INSN); - - insn = &p->store[p->nr_insn++]; - memcpy(insn, p->current, sizeof(*insn)); - - /* Reset this one-shot flag: - */ - - if (p->current->header.destreg__conditonalmod) { - p->current->header.destreg__conditonalmod = 0; - p->current->header.predicate_control = BRW_PREDICATE_NORMAL; - } - - insn->header.opcode = opcode; - return insn; -} - - -struct brw_instruction *brw_alu1( struct brw_compile *p, - unsigned opcode, - struct brw_reg dest, - struct brw_reg src ) -{ - struct brw_instruction *insn = next_insn(p, opcode); - brw_set_dest(insn, dest); - brw_set_src0(insn, src); - return insn; -} - -struct brw_instruction *brw_alu2(struct brw_compile *p, - unsigned opcode, - struct brw_reg dest, - struct brw_reg src0, - struct brw_reg src1 ) -{ - struct brw_instruction *insn = next_insn(p, opcode); - brw_set_dest(insn, dest); - brw_set_src0(insn, src0); - brw_set_src1(insn, src1); - return insn; -} - - -/*********************************************************************** - * Convenience routines. - */ -#define ALU1(OP) \ -struct brw_instruction *brw_##OP(struct brw_compile *p, \ - struct brw_reg dest, \ - struct brw_reg src0) \ -{ \ - return brw_alu1(p, BRW_OPCODE_##OP, dest, src0); \ -} - -#define ALU2(OP) \ -struct brw_instruction *brw_##OP(struct brw_compile *p, \ - struct brw_reg dest, \ - struct brw_reg src0, \ - struct brw_reg src1) \ -{ \ - return brw_alu2(p, BRW_OPCODE_##OP, dest, src0, src1); \ -} - - -ALU1(MOV) -ALU2(SEL) -ALU1(NOT) -ALU2(AND) -ALU2(OR) -ALU2(XOR) -ALU2(SHR) -ALU2(SHL) -ALU2(RSR) -ALU2(RSL) -ALU2(ASR) -ALU2(ADD) -ALU2(MUL) -ALU1(FRC) -ALU1(RNDD) -ALU2(MAC) -ALU2(MACH) -ALU1(LZD) -ALU2(DP4) -ALU2(DPH) -ALU2(DP3) -ALU2(DP2) -ALU2(LINE) - - - - -void brw_NOP(struct brw_compile *p) -{ - struct brw_instruction *insn = next_insn(p, BRW_OPCODE_NOP); - brw_set_dest(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD)); - brw_set_src0(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD)); - brw_set_src1(insn, brw_imm_ud(0x0)); -} - - - - - -/*********************************************************************** - * Comparisons, if/else/endif - */ - -struct brw_instruction *brw_JMPI(struct brw_compile *p, - struct brw_reg dest, - struct brw_reg src0, - struct brw_reg src1) -{ - struct brw_instruction *insn = brw_alu2(p, BRW_OPCODE_JMPI, dest, src0, src1); - - p->current->header.predicate_control = BRW_PREDICATE_NONE; - - return insn; -} - -/* EU takes the value from the flag register and pushes it onto some - * sort of a stack (presumably merging with any flag value already on - * the stack). Within an if block, the flags at the top of the stack - * control execution on each channel of the unit, eg. on each of the - * 16 pixel values in our wm programs. - * - * When the matching 'else' instruction is reached (presumably by - * countdown of the instruction count patched in by our ELSE/ENDIF - * functions), the relevent flags are inverted. - * - * When the matching 'endif' instruction is reached, the flags are - * popped off. If the stack is now empty, normal execution resumes. - * - * No attempt is made to deal with stack overflow (14 elements?). - */ -struct brw_instruction *brw_IF(struct brw_compile *p, unsigned execute_size) -{ - struct brw_instruction *insn; - - if (p->single_program_flow) { - assert(execute_size == BRW_EXECUTE_1); - - insn = next_insn(p, BRW_OPCODE_ADD); - insn->header.predicate_inverse = 1; - } else { - insn = next_insn(p, BRW_OPCODE_IF); - } - - /* Override the defaults for this instruction: - */ - brw_set_dest(insn, brw_ip_reg()); - brw_set_src0(insn, brw_ip_reg()); - brw_set_src1(insn, brw_imm_d(0x0)); - - insn->header.execution_size = execute_size; - insn->header.compression_control = BRW_COMPRESSION_NONE; - insn->header.predicate_control = BRW_PREDICATE_NORMAL; - insn->header.mask_control = BRW_MASK_ENABLE; - - p->current->header.predicate_control = BRW_PREDICATE_NONE; - - return insn; -} - - -struct brw_instruction *brw_ELSE(struct brw_compile *p, - struct brw_instruction *if_insn) -{ - struct brw_instruction *insn; - - if (p->single_program_flow) { - insn = next_insn(p, BRW_OPCODE_ADD); - } else { - insn = next_insn(p, BRW_OPCODE_ELSE); - } - - brw_set_dest(insn, brw_ip_reg()); - brw_set_src0(insn, brw_ip_reg()); - brw_set_src1(insn, brw_imm_d(0x0)); - - insn->header.compression_control = BRW_COMPRESSION_NONE; - insn->header.execution_size = if_insn->header.execution_size; - insn->header.mask_control = BRW_MASK_ENABLE; - - /* Patch the if instruction to point at this instruction. - */ - if (p->single_program_flow) { - assert(if_insn->header.opcode == BRW_OPCODE_ADD); - - if_insn->bits3.ud = (insn - if_insn + 1) * 16; - } else { - assert(if_insn->header.opcode == BRW_OPCODE_IF); - - if_insn->bits3.if_else.jump_count = insn - if_insn; - if_insn->bits3.if_else.pop_count = 1; - if_insn->bits3.if_else.pad0 = 0; - } - - return insn; -} - -void brw_ENDIF(struct brw_compile *p, - struct brw_instruction *patch_insn) -{ - if (p->single_program_flow) { - /* In single program flow mode, there's no need to execute an ENDIF, - * since we don't need to do any stack operations, and if we're executing - * currently, we want to just continue executing. - */ - struct brw_instruction *next = &p->store[p->nr_insn]; - - assert(patch_insn->header.opcode == BRW_OPCODE_ADD); - - patch_insn->bits3.ud = (next - patch_insn) * 16; - } else { - struct brw_instruction *insn = next_insn(p, BRW_OPCODE_ENDIF); - - brw_set_dest(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD)); - brw_set_src0(insn, retype(brw_vec4_grf(0,0), BRW_REGISTER_TYPE_UD)); - brw_set_src1(insn, brw_imm_d(0x0)); - - insn->header.compression_control = BRW_COMPRESSION_NONE; - insn->header.execution_size = patch_insn->header.execution_size; - insn->header.mask_control = BRW_MASK_ENABLE; - - assert(patch_insn->bits3.if_else.jump_count == 0); - - /* Patch the if or else instructions to point at this or the next - * instruction respectively. - */ - if (patch_insn->header.opcode == BRW_OPCODE_IF) { - /* Automagically turn it into an IFF: - */ - patch_insn->header.opcode = BRW_OPCODE_IFF; - patch_insn->bits3.if_else.jump_count = insn - patch_insn + 1; - patch_insn->bits3.if_else.pop_count = 0; - patch_insn->bits3.if_else.pad0 = 0; - } else if (patch_insn->header.opcode == BRW_OPCODE_ELSE) { - patch_insn->bits3.if_else.jump_count = insn - patch_insn + 1; - patch_insn->bits3.if_else.pop_count = 1; - patch_insn->bits3.if_else.pad0 = 0; - } else { - assert(0); - } - - /* Also pop item off the stack in the endif instruction: - */ - insn->bits3.if_else.jump_count = 0; - insn->bits3.if_else.pop_count = 1; - insn->bits3.if_else.pad0 = 0; - } -} - -struct brw_instruction *brw_BREAK(struct brw_compile *p) -{ - struct brw_instruction *insn; - insn = next_insn(p, BRW_OPCODE_BREAK); - brw_set_dest(insn, brw_ip_reg()); - brw_set_src0(insn, brw_ip_reg()); - brw_set_src1(insn, brw_imm_d(0x0)); - insn->header.compression_control = BRW_COMPRESSION_NONE; - insn->header.execution_size = BRW_EXECUTE_8; - insn->header.mask_control = BRW_MASK_DISABLE; - insn->bits3.if_else.pad0 = 0; - return insn; -} - -struct brw_instruction *brw_CONT(struct brw_compile *p) -{ - struct brw_instruction *insn; - insn = next_insn(p, BRW_OPCODE_CONTINUE); - brw_set_dest(insn, brw_ip_reg()); - brw_set_src0(insn, brw_ip_reg()); - brw_set_src1(insn, brw_imm_d(0x0)); - insn->header.compression_control = BRW_COMPRESSION_NONE; - insn->header.execution_size = BRW_EXECUTE_8; - insn->header.mask_control = BRW_MASK_DISABLE; - insn->bits3.if_else.pad0 = 0; - return insn; -} - -/* DO/WHILE loop: - */ -struct brw_instruction *brw_DO(struct brw_compile *p, unsigned execute_size) -{ - if (p->single_program_flow) { - return &p->store[p->nr_insn]; - } else { - struct brw_instruction *insn = next_insn(p, BRW_OPCODE_DO); - - /* Override the defaults for this instruction: - */ - brw_set_dest(insn, brw_null_reg()); - brw_set_src0(insn, brw_null_reg()); - brw_set_src1(insn, brw_null_reg()); - - insn->header.compression_control = BRW_COMPRESSION_NONE; - insn->header.execution_size = execute_size; - insn->header.predicate_control = BRW_PREDICATE_NONE; - /* insn->header.mask_control = BRW_MASK_ENABLE; */ - insn->header.mask_control = BRW_MASK_DISABLE; - - return insn; - } -} - - - -struct brw_instruction *brw_WHILE(struct brw_compile *p, - struct brw_instruction *do_insn) -{ - struct brw_instruction *insn; - - if (p->single_program_flow) - insn = next_insn(p, BRW_OPCODE_ADD); - else - insn = next_insn(p, BRW_OPCODE_WHILE); - - brw_set_dest(insn, brw_ip_reg()); - brw_set_src0(insn, brw_ip_reg()); - brw_set_src1(insn, brw_imm_d(0x0)); - - insn->header.compression_control = BRW_COMPRESSION_NONE; - - if (p->single_program_flow) { - insn->header.execution_size = BRW_EXECUTE_1; - - insn->bits3.d = (do_insn - insn) * 16; - } else { - insn->header.execution_size = do_insn->header.execution_size; - - assert(do_insn->header.opcode == BRW_OPCODE_DO); - insn->bits3.if_else.jump_count = do_insn - insn; - insn->bits3.if_else.pop_count = 0; - insn->bits3.if_else.pad0 = 0; - } - -/* insn->header.mask_control = BRW_MASK_ENABLE; */ - - insn->header.mask_control = BRW_MASK_DISABLE; - p->current->header.predicate_control = BRW_PREDICATE_NONE; - return insn; -} - - -/* FORWARD JUMPS: - */ -void brw_land_fwd_jump(struct brw_compile *p, - struct brw_instruction *jmp_insn) -{ - struct brw_instruction *landing = &p->store[p->nr_insn]; - - assert(jmp_insn->header.opcode == BRW_OPCODE_JMPI); - assert(jmp_insn->bits1.da1.src1_reg_file = BRW_IMMEDIATE_VALUE); - - jmp_insn->bits3.ud = (landing - jmp_insn) - 1; -} - - - -/* To integrate with the above, it makes sense that the comparison - * instruction should populate the flag register. It might be simpler - * just to use the flag reg for most WM tasks? - */ -void brw_CMP(struct brw_compile *p, - struct brw_reg dest, - unsigned conditional, - struct brw_reg src0, - struct brw_reg src1) -{ - struct brw_instruction *insn = next_insn(p, BRW_OPCODE_CMP); - - insn->header.destreg__conditonalmod = conditional; - brw_set_dest(insn, dest); - brw_set_src0(insn, src0); - brw_set_src1(insn, src1); - -/* guess_execution_size(insn, src0); */ - - - /* Make it so that future instructions will use the computed flag - * value until brw_set_predicate_control_flag_value() is called - * again. - */ - if (dest.file == BRW_ARCHITECTURE_REGISTER_FILE && - dest.nr == 0) { - p->current->header.predicate_control = BRW_PREDICATE_NORMAL; - p->flag_value = 0xff; - } -} - - - -/*********************************************************************** - * Helpers for the various SEND message types: - */ - -/* Invert 8 values - */ -void brw_math( struct brw_compile *p, - struct brw_reg dest, - unsigned function, - unsigned saturate, - unsigned msg_reg_nr, - struct brw_reg src, - unsigned data_type, - unsigned precision ) -{ - struct brw_instruction *insn = next_insn(p, BRW_OPCODE_SEND); - unsigned msg_length = (function == BRW_MATH_FUNCTION_POW) ? 2 : 1; - unsigned response_length = (function == BRW_MATH_FUNCTION_SINCOS) ? 2 : 1; - - /* Example code doesn't set predicate_control for send - * instructions. - */ - insn->header.predicate_control = 0; - insn->header.destreg__conditonalmod = msg_reg_nr; - - brw_set_dest(insn, dest); - brw_set_src0(insn, src); - brw_set_math_message(insn, - msg_length, response_length, - function, - BRW_MATH_INTEGER_UNSIGNED, - precision, - saturate, - data_type); -} - -/* Use 2 send instructions to invert 16 elements - */ -void brw_math_16( struct brw_compile *p, - struct brw_reg dest, - unsigned function, - unsigned saturate, - unsigned msg_reg_nr, - struct brw_reg src, - unsigned precision ) -{ - struct brw_instruction *insn; - unsigned msg_length = (function == BRW_MATH_FUNCTION_POW) ? 2 : 1; - unsigned response_length = (function == BRW_MATH_FUNCTION_SINCOS) ? 2 : 1; - - /* First instruction: - */ - brw_push_insn_state(p); - brw_set_predicate_control_flag_value(p, 0xff); - brw_set_compression_control(p, BRW_COMPRESSION_NONE); - - insn = next_insn(p, BRW_OPCODE_SEND); - insn->header.destreg__conditonalmod = msg_reg_nr; - - brw_set_dest(insn, dest); - brw_set_src0(insn, src); - brw_set_math_message(insn, - msg_length, response_length, - function, - BRW_MATH_INTEGER_UNSIGNED, - precision, - saturate, - BRW_MATH_DATA_VECTOR); - - /* Second instruction: - */ - insn = next_insn(p, BRW_OPCODE_SEND); - insn->header.compression_control = BRW_COMPRESSION_2NDHALF; - insn->header.destreg__conditonalmod = msg_reg_nr+1; - - brw_set_dest(insn, offset(dest,1)); - brw_set_src0(insn, src); - brw_set_math_message(insn, - msg_length, response_length, - function, - BRW_MATH_INTEGER_UNSIGNED, - precision, - saturate, - BRW_MATH_DATA_VECTOR); - - brw_pop_insn_state(p); -} - - - - -void brw_dp_WRITE_16( struct brw_compile *p, - struct brw_reg src, - unsigned msg_reg_nr, - unsigned scratch_offset ) -{ - { - brw_push_insn_state(p); - brw_set_mask_control(p, BRW_MASK_DISABLE); - brw_set_compression_control(p, BRW_COMPRESSION_NONE); - - brw_MOV(p, - retype(brw_vec1_grf(0, 2), BRW_REGISTER_TYPE_D), - brw_imm_d(scratch_offset)); - - brw_pop_insn_state(p); - } - - { - unsigned msg_length = 3; - struct brw_reg dest = retype(brw_null_reg(), BRW_REGISTER_TYPE_UW); - 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; - - brw_set_dest(insn, dest); - brw_set_src0(insn, src); - - brw_set_dp_write_message(insn, - 255, /* bti */ - BRW_DATAPORT_OWORD_BLOCK_4_OWORDS, /* msg_control */ - BRW_DATAPORT_WRITE_MESSAGE_OWORD_BLOCK_WRITE, /* msg_type */ - msg_length, - 0, /* pixel scoreboard */ - 0, /* response_length */ - 0); /* eot */ - } - -} - - -void brw_dp_READ_16( struct brw_compile *p, - struct brw_reg dest, - unsigned msg_reg_nr, - unsigned scratch_offset ) -{ - { - brw_push_insn_state(p); - brw_set_compression_control(p, BRW_COMPRESSION_NONE); - brw_set_mask_control(p, BRW_MASK_DISABLE); - - brw_MOV(p, - retype(brw_vec1_grf(0, 2), BRW_REGISTER_TYPE_D), - 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; - - brw_set_dest(insn, dest); /* UW? */ - brw_set_src0(insn, retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW)); - - brw_set_dp_read_message(insn, - 255, /* bti */ - 3, /* msg_control */ - BRW_DATAPORT_READ_MESSAGE_OWORD_BLOCK_READ, /* msg_type */ - 1, /* target cache */ - 1, /* msg_length */ - 2, /* response_length */ - 0); /* eot */ - } -} - - -void brw_fb_WRITE(struct brw_compile *p, - struct brw_reg dest, - unsigned msg_reg_nr, - struct brw_reg src0, - unsigned binding_table_index, - unsigned msg_length, - unsigned response_length, - boolean eot) -{ - 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; - - brw_set_dest(insn, dest); - brw_set_src0(insn, src0); - brw_set_dp_write_message(insn, - binding_table_index, - BRW_DATAPORT_RENDER_TARGET_WRITE_SIMD16_SINGLE_SOURCE, /* msg_control */ - BRW_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_WRITE, /* msg_type */ - msg_length, - 1, /* pixel scoreboard */ - response_length, - eot); -} - - - -void brw_SAMPLE(struct brw_compile *p, - struct brw_reg dest, - unsigned msg_reg_nr, - struct brw_reg src0, - unsigned binding_table_index, - unsigned sampler, - unsigned writemask, - unsigned msg_type, - unsigned response_length, - unsigned msg_length, - boolean eot) -{ - boolean need_stall = 0; - - if(writemask == 0) { -/* debug_printf("%s: zero writemask??\n", __FUNCTION__); */ - return; - } - - /* Hardware doesn't do destination dependency checking on send - * instructions properly. Add a workaround which generates the - * dependency by other means. In practice it seems like this bug - * only crops up for texture samples, and only where registers are - * written by the send and then written again later without being - * read in between. Luckily for us, we already track that - * information and use it to modify the writemask for the - * instruction, so that is a guide for whether a workaround is - * needed. - */ - if (writemask != TGSI_WRITEMASK_XYZW) { - unsigned dst_offset = 0; - unsigned i, newmask = 0, len = 0; - - for (i = 0; i < 4; i++) { - if (writemask & (1<header.predicate_control = 0; /* XXX */ - insn->header.compression_control = BRW_COMPRESSION_NONE; - insn->header.destreg__conditonalmod = msg_reg_nr; - - brw_set_dest(insn, dest); - brw_set_src0(insn, src0); - brw_set_sampler_message(insn, - binding_table_index, - sampler, - msg_type, - response_length, - msg_length, - eot); - } - - if (need_stall) - { - struct brw_reg reg = vec8(offset(dest, response_length-1)); - - /* mov (8) r9.0<1>:f r9.0<8;8,1>:f { Align1 } - */ - brw_push_insn_state(p); - brw_set_compression_control(p, FALSE); - brw_MOV(p, reg, reg); - brw_pop_insn_state(p); - } - -} - -/* All these variables are pretty confusing - we might be better off - * using bitmasks and macros for this, in the old style. Or perhaps - * just having the caller instantiate the fields in dword3 itself. - */ -void brw_urb_WRITE(struct brw_compile *p, - struct brw_reg dest, - unsigned msg_reg_nr, - struct brw_reg src0, - boolean allocate, - boolean used, - unsigned msg_length, - unsigned response_length, - boolean eot, - boolean writes_complete, - unsigned offset, - unsigned swizzle) -{ - struct brw_instruction *insn = next_insn(p, BRW_OPCODE_SEND); - - assert(msg_length < 16); - - brw_set_dest(insn, dest); - brw_set_src0(insn, src0); - brw_set_src1(insn, brw_imm_d(0)); - - insn->header.destreg__conditonalmod = msg_reg_nr; - - brw_set_urb_message(insn, - allocate, - used, - msg_length, - response_length, - eot, - writes_complete, - offset, - swizzle); -} - diff --git a/src/gallium/drivers/i965simple/brw_eu_util.c b/src/gallium/drivers/i965simple/brw_eu_util.c deleted file mode 100644 index 3a65b141f0..0000000000 --- a/src/gallium/drivers/i965simple/brw_eu_util.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#include "brw_context.h" -#include "brw_defines.h" -#include "brw_eu.h" - - -void brw_math_invert( struct brw_compile *p, - struct brw_reg dst, - struct brw_reg src) -{ - brw_math( p, - dst, - BRW_MATH_FUNCTION_INV, - BRW_MATH_SATURATE_NONE, - 0, - src, - BRW_MATH_PRECISION_FULL, - BRW_MATH_DATA_VECTOR ); -} - - - -void brw_copy4(struct brw_compile *p, - struct brw_reg dst, - struct brw_reg src, - unsigned count) -{ - unsigned i; - - dst = vec4(dst); - src = vec4(src); - - for (i = 0; i < count; i++) - { - unsigned delta = i*32; - brw_MOV(p, byte_offset(dst, delta), byte_offset(src, delta)); - brw_MOV(p, byte_offset(dst, delta+16), byte_offset(src, delta+16)); - } -} - - -void brw_copy8(struct brw_compile *p, - struct brw_reg dst, - struct brw_reg src, - unsigned count) -{ - unsigned i; - - dst = vec8(dst); - src = vec8(src); - - for (i = 0; i < count; i++) - { - unsigned delta = i*32; - brw_MOV(p, byte_offset(dst, delta), byte_offset(src, delta)); - } -} - - -void brw_copy_indirect_to_indirect(struct brw_compile *p, - struct brw_indirect dst_ptr, - struct brw_indirect src_ptr, - unsigned count) -{ - unsigned i; - - for (i = 0; i < count; i++) - { - unsigned delta = i*32; - brw_MOV(p, deref_4f(dst_ptr, delta), deref_4f(src_ptr, delta)); - brw_MOV(p, deref_4f(dst_ptr, delta+16), deref_4f(src_ptr, delta+16)); - } -} - - -void brw_copy_from_indirect(struct brw_compile *p, - struct brw_reg dst, - struct brw_indirect ptr, - unsigned count) -{ - unsigned i; - - dst = vec4(dst); - - for (i = 0; i < count; i++) - { - unsigned delta = i*32; - brw_MOV(p, byte_offset(dst, delta), deref_4f(ptr, delta)); - brw_MOV(p, byte_offset(dst, delta+16), deref_4f(ptr, delta+16)); - } -} - - - - diff --git a/src/gallium/drivers/i965simple/brw_flush.c b/src/gallium/drivers/i965simple/brw_flush.c deleted file mode 100644 index e6001c30d9..0000000000 --- a/src/gallium/drivers/i965simple/brw_flush.c +++ /dev/null @@ -1,73 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * 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. - * - **************************************************************************/ - -/* Author: - * Keith Whitwell - */ - - -#include "pipe/p_defines.h" -#include "brw_context.h" -#include "brw_defines.h" -#include "brw_batch.h" - - -static void brw_flush( struct pipe_context *pipe, - unsigned flags, - struct pipe_fence_handle **fence ) -{ - struct brw_context *brw = brw_context(pipe); - - /* Do we need to emit an MI_FLUSH command to flush the hardware - * caches? - */ - if (flags & (PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE)) { - struct brw_mi_flush flush; - - memset(&flush, 0, sizeof(flush)); - flush.opcode = CMD_MI_FLUSH; - - if (!(flags & PIPE_FLUSH_RENDER_CACHE)) - flush.flags |= BRW_INHIBIT_FLUSH_RENDER_CACHE; - - if (flags & PIPE_FLUSH_TEXTURE_CACHE) - flush.flags |= BRW_FLUSH_READ_CACHE; - - BRW_BATCH_STRUCT(brw, &flush); - } - - /* If there are no flags, just flush pending commands to hardware: - */ - FLUSH_BATCH( fence ); -} - - - -void brw_init_flush_functions( struct brw_context *brw ) -{ - brw->pipe.flush = brw_flush; -} diff --git a/src/gallium/drivers/i965simple/brw_gs.c b/src/gallium/drivers/i965simple/brw_gs.c deleted file mode 100644 index de60868ccc..0000000000 --- a/src/gallium/drivers/i965simple/brw_gs.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - -#include "brw_defines.h" -#include "brw_context.h" -#include "brw_eu.h" -#include "brw_util.h" -#include "brw_state.h" -#include "brw_gs.h" - - - -static void compile_gs_prog( struct brw_context *brw, - struct brw_gs_prog_key *key ) -{ - struct brw_gs_compile c; - const unsigned *program; - unsigned program_size; - - memset(&c, 0, sizeof(c)); - - c.key = *key; - - /* Need to locate the two positions present in vertex + header. - * These are currently hardcoded: - */ - c.nr_attrs = brw_count_bits(c.key.attrs); - c.nr_regs = (c.nr_attrs + 1) / 2 + 1; /* are vertices packed, or reg-aligned? */ - c.nr_bytes = c.nr_regs * REG_SIZE; - - - /* Begin the compilation: - */ - brw_init_compile(&c.func); - - c.func.single_program_flow = 1; - - /* For some reason the thread is spawned with only 4 channels - * unmasked. - */ - brw_set_mask_control(&c.func, BRW_MASK_DISABLE); - - - /* Note that primitives which don't require a GS program have - * already been weeded out by this stage: - */ - switch (key->primitive) { - case PIPE_PRIM_QUADS: - brw_gs_quads( &c ); - break; - case PIPE_PRIM_QUAD_STRIP: - brw_gs_quad_strip( &c ); - break; - case PIPE_PRIM_LINE_LOOP: - brw_gs_lines( &c ); - break; - case PIPE_PRIM_LINES: - if (key->hint_gs_always) - brw_gs_lines( &c ); - else { - return; - } - break; - case PIPE_PRIM_TRIANGLES: - if (key->hint_gs_always) - brw_gs_tris( &c ); - else { - return; - } - break; - case PIPE_PRIM_POINTS: - if (key->hint_gs_always) - brw_gs_points( &c ); - else { - return; - } - break; - default: - return; - } - - /* get the program - */ - program = brw_get_program(&c.func, &program_size); - - /* Upload - */ - brw->gs.prog_gs_offset = brw_upload_cache( &brw->cache[BRW_GS_PROG], - &c.key, - sizeof(c.key), - program, - program_size, - &c.prog_data, - &brw->gs.prog_data ); -} - - -static boolean search_cache( struct brw_context *brw, - struct brw_gs_prog_key *key ) -{ - return brw_search_cache(&brw->cache[BRW_GS_PROG], - key, sizeof(*key), - &brw->gs.prog_data, - &brw->gs.prog_gs_offset); -} - - -static const int gs_prim[PIPE_PRIM_POLYGON+1] = { - PIPE_PRIM_POINTS, - PIPE_PRIM_LINES, - PIPE_PRIM_LINE_LOOP, - PIPE_PRIM_LINES, - PIPE_PRIM_TRIANGLES, - PIPE_PRIM_TRIANGLES, - PIPE_PRIM_TRIANGLES, - PIPE_PRIM_QUADS, - PIPE_PRIM_QUAD_STRIP, - PIPE_PRIM_TRIANGLES -}; - -static void populate_key( struct brw_context *brw, - struct brw_gs_prog_key *key ) -{ - memset(key, 0, sizeof(*key)); - - /* CACHE_NEW_VS_PROG */ - key->attrs = brw->vs.prog_data->outputs_written; - - /* BRW_NEW_PRIMITIVE */ - key->primitive = gs_prim[brw->primitive]; - - key->hint_gs_always = 0; /* debug code? */ - - key->need_gs_prog = (key->hint_gs_always || - brw->primitive == PIPE_PRIM_QUADS || - brw->primitive == PIPE_PRIM_QUAD_STRIP || - brw->primitive == PIPE_PRIM_LINE_LOOP); -} - -/* Calculate interpolants for triangle and line rasterization. - */ -static void upload_gs_prog( struct brw_context *brw ) -{ - struct brw_gs_prog_key key; - - /* Populate the key: - */ - populate_key(brw, &key); - - if (brw->gs.prog_active != key.need_gs_prog) { - brw->state.dirty.cache |= CACHE_NEW_GS_PROG; - brw->gs.prog_active = key.need_gs_prog; - } - - if (brw->gs.prog_active) { - if (!search_cache(brw, &key)) - compile_gs_prog( brw, &key ); - } -} - - -const struct brw_tracked_state brw_gs_prog = { - .dirty = { - .brw = BRW_NEW_PRIMITIVE, - .cache = CACHE_NEW_VS_PROG - }, - .update = upload_gs_prog -}; diff --git a/src/gallium/drivers/i965simple/brw_gs.h b/src/gallium/drivers/i965simple/brw_gs.h deleted file mode 100644 index f09141c6aa..0000000000 --- a/src/gallium/drivers/i965simple/brw_gs.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#ifndef BRW_GS_H -#define BRW_GS_H - - -#include "brw_context.h" -#include "brw_eu.h" - -#define MAX_GS_VERTS (4) - -struct brw_gs_prog_key { - unsigned attrs:32; - unsigned primitive:4; - unsigned hint_gs_always:1; - unsigned need_gs_prog:1; - unsigned pad:26; -}; - -struct brw_gs_compile { - struct brw_compile func; - struct brw_gs_prog_key key; - struct brw_gs_prog_data prog_data; - - struct { - struct brw_reg R0; - struct brw_reg vertex[MAX_GS_VERTS]; - } reg; - - /* 3 different ways of expressing vertex size: - */ - unsigned nr_attrs; - unsigned nr_regs; - unsigned nr_bytes; -}; - -#define ATTR_SIZE (4*4) - -void brw_gs_quads( struct brw_gs_compile *c ); -void brw_gs_quad_strip( struct brw_gs_compile *c ); -void brw_gs_tris( struct brw_gs_compile *c ); -void brw_gs_lines( struct brw_gs_compile *c ); -void brw_gs_points( struct brw_gs_compile *c ); - -#endif diff --git a/src/gallium/drivers/i965simple/brw_gs_emit.c b/src/gallium/drivers/i965simple/brw_gs_emit.c deleted file mode 100644 index c3cc90b10f..0000000000 --- a/src/gallium/drivers/i965simple/brw_gs_emit.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - -#include "brw_defines.h" -#include "brw_context.h" -#include "brw_eu.h" -#include "brw_util.h" -#include "brw_gs.h" - -static void brw_gs_alloc_regs( struct brw_gs_compile *c, - unsigned nr_verts ) -{ - unsigned i = 0,j; - - /* Register usage is static, precompute here: - */ - c->reg.R0 = retype(brw_vec8_grf(i, 0), BRW_REGISTER_TYPE_UD); i++; - - /* Payload vertices plus space for more generated vertices: - */ - for (j = 0; j < nr_verts; j++) { - c->reg.vertex[j] = brw_vec4_grf(i, 0); - i += c->nr_regs; - } - - c->prog_data.urb_read_length = c->nr_regs; - c->prog_data.total_grf = i; -} - - -static void brw_gs_emit_vue(struct brw_gs_compile *c, - struct brw_reg vert, - boolean last, - unsigned header) -{ - struct brw_compile *p = &c->func; - boolean allocate = !last; - - /* Overwrite PrimType and PrimStart in the message header, for - * each vertex in turn: - */ - brw_MOV(p, get_element_ud(c->reg.R0, 2), brw_imm_ud(header)); - - /* Copy the vertex from vertn into m1..mN+1: - */ - brw_copy8(p, brw_message_reg(1), vert, c->nr_regs); - - /* Send each vertex as a seperate write to the urb. This is - * different to the concept in brw_sf_emit.c, where subsequent - * writes are used to build up a single urb entry. Each of these - * writes instantiates a seperate urb entry, and a new one must be - * allocated each time. - */ - brw_urb_WRITE(p, - allocate ? c->reg.R0 : retype(brw_null_reg(), BRW_REGISTER_TYPE_UD), - 0, - c->reg.R0, - allocate, - 1, /* used */ - c->nr_regs + 1, /* msg length */ - allocate ? 1 : 0, /* response length */ - allocate ? 0 : 1, /* eot */ - 1, /* writes_complete */ - 0, /* urb offset */ - BRW_URB_SWIZZLE_NONE); -} - - - -void brw_gs_quads( struct brw_gs_compile *c ) -{ - brw_gs_alloc_regs(c, 4); - - /* Use polygons for correct edgeflag behaviour. Note that vertex 3 - * is the PV for quads, but vertex 0 for polygons: - */ - brw_gs_emit_vue(c, c->reg.vertex[3], 0, ((_3DPRIM_POLYGON << 2) | R02_PRIM_START)); - brw_gs_emit_vue(c, c->reg.vertex[0], 0, (_3DPRIM_POLYGON << 2)); - brw_gs_emit_vue(c, c->reg.vertex[1], 0, (_3DPRIM_POLYGON << 2)); - brw_gs_emit_vue(c, c->reg.vertex[2], 1, ((_3DPRIM_POLYGON << 2) | R02_PRIM_END)); -} - -void brw_gs_quad_strip( struct brw_gs_compile *c ) -{ - brw_gs_alloc_regs(c, 4); - - brw_gs_emit_vue(c, c->reg.vertex[2], 0, ((_3DPRIM_POLYGON << 2) | R02_PRIM_START)); - brw_gs_emit_vue(c, c->reg.vertex[3], 0, (_3DPRIM_POLYGON << 2)); - brw_gs_emit_vue(c, c->reg.vertex[0], 0, (_3DPRIM_POLYGON << 2)); - brw_gs_emit_vue(c, c->reg.vertex[1], 1, ((_3DPRIM_POLYGON << 2) | R02_PRIM_END)); -} - -void brw_gs_tris( struct brw_gs_compile *c ) -{ - brw_gs_alloc_regs(c, 3); - brw_gs_emit_vue(c, c->reg.vertex[0], 0, ((_3DPRIM_TRILIST << 2) | R02_PRIM_START)); - brw_gs_emit_vue(c, c->reg.vertex[1], 0, (_3DPRIM_TRILIST << 2)); - brw_gs_emit_vue(c, c->reg.vertex[2], 1, ((_3DPRIM_TRILIST << 2) | R02_PRIM_END)); -} - -void brw_gs_lines( struct brw_gs_compile *c ) -{ - brw_gs_alloc_regs(c, 2); - brw_gs_emit_vue(c, c->reg.vertex[0], 0, ((_3DPRIM_LINESTRIP << 2) | R02_PRIM_START)); - brw_gs_emit_vue(c, c->reg.vertex[1], 1, ((_3DPRIM_LINESTRIP << 2) | R02_PRIM_END)); -} - -void brw_gs_points( struct brw_gs_compile *c ) -{ - brw_gs_alloc_regs(c, 1); - brw_gs_emit_vue(c, c->reg.vertex[0], 1, ((_3DPRIM_POINTLIST << 2) | R02_PRIM_START | R02_PRIM_END)); -} - - - - - - - - diff --git a/src/gallium/drivers/i965simple/brw_gs_state.c b/src/gallium/drivers/i965simple/brw_gs_state.c deleted file mode 100644 index 5b8016b2e9..0000000000 --- a/src/gallium/drivers/i965simple/brw_gs_state.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - - -#include "brw_context.h" -#include "brw_state.h" -#include "brw_defines.h" -#include "util/u_math.h" -#include "util/u_memory.h" - - - -static void upload_gs_unit( struct brw_context *brw ) -{ - struct brw_gs_unit_state gs; - - memset(&gs, 0, sizeof(gs)); - - /* CACHE_NEW_GS_PROG */ - if (brw->gs.prog_active) { - gs.thread0.grf_reg_count = - align(brw->gs.prog_data->total_grf, 16) / 16 - 1; - gs.thread0.kernel_start_pointer = brw->gs.prog_gs_offset >> 6; - gs.thread3.urb_entry_read_length = brw->gs.prog_data->urb_read_length; - } - else { - gs.thread0.grf_reg_count = 0; - gs.thread0.kernel_start_pointer = 0; - gs.thread3.urb_entry_read_length = 1; - } - - /* BRW_NEW_URB_FENCE */ - gs.thread4.nr_urb_entries = brw->urb.nr_gs_entries; - gs.thread4.urb_entry_allocation_size = brw->urb.vsize - 1; - - gs.thread4.max_threads = 0; /* Hardware requirement */ - - if (BRW_DEBUG & DEBUG_STATS) - gs.thread4.stats_enable = 1; - - /* CONSTANT */ - gs.thread1.floating_point_mode = BRW_FLOATING_POINT_NON_IEEE_754; - gs.thread1.single_program_flow = 1; - gs.thread3.dispatch_grf_start_reg = 1; - gs.thread3.const_urb_entry_read_offset = 0; - gs.thread3.const_urb_entry_read_length = 0; - gs.thread3.urb_entry_read_offset = 0; - - - brw->gs.state_gs_offset = brw_cache_data( &brw->cache[BRW_GS_UNIT], &gs ); -} - - -const struct brw_tracked_state brw_gs_unit = { - .dirty = { - .brw = (BRW_NEW_CURBE_OFFSETS | - BRW_NEW_URB_FENCE), - .cache = CACHE_NEW_GS_PROG - }, - .update = upload_gs_unit -}; diff --git a/src/gallium/drivers/i965simple/brw_misc_state.c b/src/gallium/drivers/i965simple/brw_misc_state.c deleted file mode 100644 index 99ff4403a5..0000000000 --- a/src/gallium/drivers/i965simple/brw_misc_state.c +++ /dev/null @@ -1,488 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - -#include "brw_batch.h" -#include "brw_context.h" -#include "brw_state.h" -#include "brw_defines.h" - - - - - -/*********************************************************************** - * Blend color - */ - -static void upload_blend_constant_color(struct brw_context *brw) -{ - struct brw_blend_constant_color bcc; - - memset(&bcc, 0, sizeof(bcc)); - bcc.header.opcode = CMD_BLEND_CONSTANT_COLOR; - bcc.header.length = sizeof(bcc)/4-2; - bcc.blend_constant_color[0] = brw->attribs.BlendColor.color[0]; - bcc.blend_constant_color[1] = brw->attribs.BlendColor.color[1]; - bcc.blend_constant_color[2] = brw->attribs.BlendColor.color[2]; - bcc.blend_constant_color[3] = brw->attribs.BlendColor.color[3]; - - BRW_CACHED_BATCH_STRUCT(brw, &bcc); -} - - -const struct brw_tracked_state brw_blend_constant_color = { - .dirty = { - .brw = BRW_NEW_BLEND, - .cache = 0 - }, - .update = upload_blend_constant_color -}; - - -/*********************************************************************** - * Drawing rectangle - */ -static void upload_drawing_rect(struct brw_context *brw) -{ - struct brw_drawrect bdr; - - memset(&bdr, 0, sizeof(bdr)); - bdr.header.opcode = CMD_DRAW_RECT; - bdr.header.length = sizeof(bdr)/4 - 2; - bdr.xmin = 0; - bdr.ymin = 0; - bdr.xmax = brw->attribs.FrameBuffer.cbufs[0]->width; - bdr.ymax = brw->attribs.FrameBuffer.cbufs[0]->height; - bdr.xorg = 0; - bdr.yorg = 0; - - /* Can't use BRW_CACHED_BATCH_STRUCT because this is also emitted - * uncached in brw_draw.c: - */ - BRW_BATCH_STRUCT(brw, &bdr); -} - -const struct brw_tracked_state brw_drawing_rect = { - .dirty = { - .brw = BRW_NEW_SCENE, - .cache = 0 - }, - .update = upload_drawing_rect -}; - -/** - * Upload the binding table pointers, which point each stage's array of surface - * state pointers. - * - * The binding table pointers are relative to the surface state base address, - * which is the BRW_SS_POOL cache buffer. - */ -static void upload_binding_table_pointers(struct brw_context *brw) -{ - struct brw_binding_table_pointers btp; - memset(&btp, 0, sizeof(btp)); - - btp.header.opcode = CMD_BINDING_TABLE_PTRS; - btp.header.length = sizeof(btp)/4 - 2; - btp.vs = 0; - btp.gs = 0; - btp.clp = 0; - btp.sf = 0; - btp.wm = brw->wm.bind_ss_offset; - - BRW_CACHED_BATCH_STRUCT(brw, &btp); -} - -const struct brw_tracked_state brw_binding_table_pointers = { - .dirty = { - .brw = 0, - .cache = CACHE_NEW_SURF_BIND - }, - .update = upload_binding_table_pointers, -}; - - -/** - * Upload pointers to the per-stage state. - * - * The state pointers in this packet are all relative to the general state - * base address set by CMD_STATE_BASE_ADDRESS, which is the BRW_GS_POOL buffer. - */ -static void upload_pipelined_state_pointers(struct brw_context *brw ) -{ - struct brw_pipelined_state_pointers psp; - memset(&psp, 0, sizeof(psp)); - - psp.header.opcode = CMD_PIPELINED_STATE_POINTERS; - psp.header.length = sizeof(psp)/4 - 2; - - psp.vs.offset = brw->vs.state_gs_offset >> 5; - psp.sf.offset = brw->sf.state_gs_offset >> 5; - psp.wm.offset = brw->wm.state_gs_offset >> 5; - psp.cc.offset = brw->cc.state_gs_offset >> 5; - - /* GS gets turned on and off regularly. Need to re-emit URB fence - * after this occurs. - */ - if (brw->gs.prog_active) { - psp.gs.offset = brw->gs.state_gs_offset >> 5; - psp.gs.enable = 1; - } - - if (0) { - psp.clp.offset = brw->clip.state_gs_offset >> 5; - psp.clp.enable = 1; - } - - - if (BRW_CACHED_BATCH_STRUCT(brw, &psp)) - brw->state.dirty.brw |= BRW_NEW_PSP; -} - -const struct brw_tracked_state brw_pipelined_state_pointers = { - .dirty = { - .brw = 0, - .cache = (CACHE_NEW_VS_UNIT | - CACHE_NEW_GS_UNIT | - CACHE_NEW_GS_PROG | - CACHE_NEW_CLIP_UNIT | - CACHE_NEW_SF_UNIT | - CACHE_NEW_WM_UNIT | - CACHE_NEW_CC_UNIT) - }, - .update = upload_pipelined_state_pointers -}; - -static void upload_psp_urb_cbs(struct brw_context *brw ) -{ - upload_pipelined_state_pointers(brw); - brw_upload_urb_fence(brw); - brw_upload_constant_buffer_state(brw); -} - - -const struct brw_tracked_state brw_psp_urb_cbs = { - .dirty = { - .brw = BRW_NEW_URB_FENCE, - .cache = (CACHE_NEW_VS_UNIT | - CACHE_NEW_GS_UNIT | - CACHE_NEW_GS_PROG | - CACHE_NEW_CLIP_UNIT | - CACHE_NEW_SF_UNIT | - CACHE_NEW_WM_UNIT | - CACHE_NEW_CC_UNIT) - }, - .update = upload_psp_urb_cbs -}; - -/** - * Upload the depthbuffer offset and format. - * - * We have to do this per state validation as we need to emit the relocation - * in the batch buffer. - */ -static void upload_depthbuffer(struct brw_context *brw) -{ - struct pipe_surface *depth_surface = brw->attribs.FrameBuffer.zsbuf; - - BEGIN_BATCH(5, INTEL_BATCH_NO_CLIPRECTS); - OUT_BATCH(CMD_DEPTH_BUFFER << 16 | (5 - 2)); - if (depth_surface == NULL) { - OUT_BATCH((BRW_DEPTHFORMAT_D32_FLOAT << 18) | - (BRW_SURFACE_NULL << 29)); - OUT_BATCH(0); - OUT_BATCH(0); - OUT_BATCH(0); - } else { - unsigned int format; - struct brw_texture *tex = (struct brw_texture *)depth_surface->texture; - assert(depth_surface->block.width == 1); - assert(depth_surface->block.height == 1); - switch (depth_surface->block.size) { - case 2: - format = BRW_DEPTHFORMAT_D16_UNORM; - break; - case 4: - if (depth_surface->format == PIPE_FORMAT_Z32_FLOAT) - format = BRW_DEPTHFORMAT_D32_FLOAT; - else - format = BRW_DEPTHFORMAT_D24_UNORM_S8_UINT; - break; - default: - assert(0); - return; - } - - OUT_BATCH((depth_surface->stride - 1) | - (format << 18) | - (BRW_TILEWALK_YMAJOR << 26) | -// (depth_surface->region->tiled << 27) | - (BRW_SURFACE_2D << 29)); - OUT_RELOC(tex->buffer, - PIPE_BUFFER_USAGE_GPU_READ | PIPE_BUFFER_USAGE_GPU_WRITE, 0); - OUT_BATCH((BRW_SURFACE_MIPMAPLAYOUT_BELOW << 1) | - ((depth_surface->stride/depth_surface->block.size - 1) << 6) | - ((depth_surface->height - 1) << 19)); - OUT_BATCH(0); - } - ADVANCE_BATCH(); -} - -const struct brw_tracked_state brw_depthbuffer = { - .dirty = { - .brw = BRW_NEW_SCENE, - .cache = 0 - }, - .update = upload_depthbuffer, -}; - - - - -/*********************************************************************** - * Polygon stipple packet - */ - -static void upload_polygon_stipple(struct brw_context *brw) -{ - struct brw_polygon_stipple bps; - unsigned i; - - memset(&bps, 0, sizeof(bps)); - bps.header.opcode = CMD_POLY_STIPPLE_PATTERN; - bps.header.length = sizeof(bps)/4-2; - - /* XXX: state tracker should send *all* state down initially! - */ - if (brw->attribs.PolygonStipple) - for (i = 0; i < 32; i++) - bps.stipple[i] = brw->attribs.PolygonStipple->stipple[31 - i]; /* invert */ - - BRW_CACHED_BATCH_STRUCT(brw, &bps); -} - -const struct brw_tracked_state brw_polygon_stipple = { - .dirty = { - .brw = BRW_NEW_STIPPLE, - .cache = 0 - }, - .update = upload_polygon_stipple -}; - - -/*********************************************************************** - * Line stipple packet - */ - -static void upload_line_stipple(struct brw_context *brw) -{ - struct brw_line_stipple bls; - float tmp; - int tmpi; - - memset(&bls, 0, sizeof(bls)); - bls.header.opcode = CMD_LINE_STIPPLE_PATTERN; - bls.header.length = sizeof(bls)/4 - 2; - - bls.bits0.pattern = brw->attribs.Raster->line_stipple_pattern; - bls.bits1.repeat_count = brw->attribs.Raster->line_stipple_factor; - - tmp = 1.0 / (float) brw->attribs.Raster->line_stipple_factor; - tmpi = tmp * (1<<13); - - - bls.bits1.inverse_repeat_count = tmpi; - - BRW_CACHED_BATCH_STRUCT(brw, &bls); -} - -const struct brw_tracked_state brw_line_stipple = { - .dirty = { - .brw = BRW_NEW_STIPPLE, - .cache = 0 - }, - .update = upload_line_stipple -}; - - -/*********************************************************************** - * Misc constant state packets - */ - -static void upload_pipe_control(struct brw_context *brw) -{ - struct brw_pipe_control pc; - - return; - - memset(&pc, 0, sizeof(pc)); - - pc.header.opcode = CMD_PIPE_CONTROL; - pc.header.length = sizeof(pc)/4 - 2; - pc.header.post_sync_operation = PIPE_CONTROL_NOWRITE; - - pc.header.instruction_state_cache_flush_enable = 1; - - pc.bits1.dest_addr_type = PIPE_CONTROL_GTTWRITE_GLOBAL; - - BRW_BATCH_STRUCT(brw, &pc); -} - -const struct brw_tracked_state brw_pipe_control = { - .dirty = { - .brw = BRW_NEW_SCENE, - .cache = 0 - }, - .update = upload_pipe_control -}; - - -/*********************************************************************** - * Misc invarient state packets - */ - -static void upload_invarient_state( struct brw_context *brw ) -{ - { - struct brw_mi_flush flush; - - memset(&flush, 0, sizeof(flush)); - flush.opcode = CMD_MI_FLUSH; - flush.flags = BRW_FLUSH_STATE_CACHE | BRW_FLUSH_READ_CACHE; - BRW_BATCH_STRUCT(brw, &flush); - } - - { - /* 0x61040000 Pipeline Select */ - /* PipelineSelect : 0 */ - struct brw_pipeline_select ps; - - memset(&ps, 0, sizeof(ps)); - ps.header.opcode = CMD_PIPELINE_SELECT; - ps.header.pipeline_select = 0; - BRW_BATCH_STRUCT(brw, &ps); - } - - { - struct brw_global_depth_offset_clamp gdo; - memset(&gdo, 0, sizeof(gdo)); - - /* Disable depth offset clamping. - */ - gdo.header.opcode = CMD_GLOBAL_DEPTH_OFFSET_CLAMP; - gdo.header.length = sizeof(gdo)/4 - 2; - gdo.depth_offset_clamp = 0.0; - - BRW_BATCH_STRUCT(brw, &gdo); - } - - - /* 0x61020000 State Instruction Pointer */ - { - struct brw_system_instruction_pointer sip; - memset(&sip, 0, sizeof(sip)); - - sip.header.opcode = CMD_STATE_INSN_POINTER; - sip.header.length = 0; - sip.bits0.pad = 0; - sip.bits0.system_instruction_pointer = 0; - BRW_BATCH_STRUCT(brw, &sip); - } - - - { - struct brw_vf_statistics vfs; - memset(&vfs, 0, sizeof(vfs)); - - vfs.opcode = CMD_VF_STATISTICS; - if (BRW_DEBUG & DEBUG_STATS) - vfs.statistics_enable = 1; - - BRW_BATCH_STRUCT(brw, &vfs); - } - - - { - struct brw_polygon_stipple_offset bpso; - - memset(&bpso, 0, sizeof(bpso)); - bpso.header.opcode = CMD_POLY_STIPPLE_OFFSET; - bpso.header.length = sizeof(bpso)/4-2; - bpso.bits0.x_offset = 0; - bpso.bits0.y_offset = 0; - - BRW_BATCH_STRUCT(brw, &bpso); - } -} - -const struct brw_tracked_state brw_invarient_state = { - .dirty = { - .brw = BRW_NEW_SCENE, - .cache = 0 - }, - .update = upload_invarient_state -}; - -/** - * Define the base addresses which some state is referenced from. - * - * This allows us to avoid having to emit relocations in many places for - * cached state, and instead emit pointers inside of large, mostly-static - * state pools. This comes at the expense of memory, and more expensive cache - * misses. - */ -static void upload_state_base_address( struct brw_context *brw ) -{ - /* Output the structure (brw_state_base_address) directly to the - * batchbuffer, so we can emit relocations inline. - */ - BEGIN_BATCH(6, INTEL_BATCH_NO_CLIPRECTS); - OUT_BATCH(CMD_STATE_BASE_ADDRESS << 16 | (6 - 2)); - OUT_RELOC(brw->pool[BRW_GS_POOL].buffer, - PIPE_BUFFER_USAGE_GPU_READ, - 1); /* General state base address */ - OUT_RELOC(brw->pool[BRW_SS_POOL].buffer, - PIPE_BUFFER_USAGE_GPU_READ, - 1); /* Surface state base address */ - OUT_BATCH(1); /* Indirect object base address */ - OUT_BATCH(1); /* General state upper bound */ - OUT_BATCH(1); /* Indirect object upper bound */ - ADVANCE_BATCH(); -} - - -const struct brw_tracked_state brw_state_base_address = { - .dirty = { - .brw = BRW_NEW_SCENE, - .cache = 0 - }, - .update = upload_state_base_address -}; diff --git a/src/gallium/drivers/i965simple/brw_reg.h b/src/gallium/drivers/i965simple/brw_reg.h deleted file mode 100644 index 9e885c3b3b..0000000000 --- a/src/gallium/drivers/i965simple/brw_reg.h +++ /dev/null @@ -1,76 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#define CMD_MI (0x0 << 29) -#define CMD_2D (0x2 << 29) -#define CMD_3D (0x3 << 29) - -#define MI_BATCH_BUFFER_END (CMD_MI | 0xA << 23) - -/* Stalls command execution waiting for the given events to have occurred. */ -#define MI_WAIT_FOR_EVENT (CMD_MI | (0x3 << 23)) -#define MI_WAIT_FOR_PLANE_B_FLIP (1<<6) -#define MI_WAIT_FOR_PLANE_A_FLIP (1<<2) - -/* Primitive dispatch on 830-945 */ -#define _3DPRIMITIVE (CMD_3D | (0x1f << 24)) -#define PRIM_INDIRECT (1<<23) -#define PRIM_INLINE (0<<23) -#define PRIM_INDIRECT_SEQUENTIAL (0<<17) -#define PRIM_INDIRECT_ELTS (1<<17) - -#define PRIM3D_TRILIST (0x0<<18) -#define PRIM3D_TRISTRIP (0x1<<18) -#define PRIM3D_TRISTRIP_RVRSE (0x2<<18) -#define PRIM3D_TRIFAN (0x3<<18) -#define PRIM3D_POLY (0x4<<18) -#define PRIM3D_LINELIST (0x5<<18) -#define PRIM3D_LINESTRIP (0x6<<18) -#define PRIM3D_RECTLIST (0x7<<18) -#define PRIM3D_POINTLIST (0x8<<18) -#define PRIM3D_DIB (0x9<<18) -#define PRIM3D_MASK (0x1f<<18) - -#define XY_SETUP_BLT_CMD (CMD_2D | (0x01 << 22) | 6) - -#define XY_COLOR_BLT_CMD (CMD_2D | (0x50 << 22) | 4) - -#define XY_SRC_COPY_BLT_CMD (CMD_2D | (0x53 << 22) | 6) - -/* BR00 */ -#define XY_BLT_WRITE_ALPHA (1 << 21) -#define XY_BLT_WRITE_RGB (1 << 20) -#define XY_SRC_TILED (1 << 15) -#define XY_DST_TILED (1 << 11) - -/* BR13 */ -#define BR13_565 (0x1 << 24) -#define BR13_8888 (0x3 << 24) - -#define FENCE_LINEAR 0 -#define FENCE_XMAJOR 1 -#define FENCE_YMAJOR 2 diff --git a/src/gallium/drivers/i965simple/brw_screen.c b/src/gallium/drivers/i965simple/brw_screen.c deleted file mode 100644 index 4a84c4db23..0000000000 --- a/src/gallium/drivers/i965simple/brw_screen.c +++ /dev/null @@ -1,244 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#include "util/u_memory.h" -#include "pipe/internal/p_winsys_screen.h" -#include "util/u_string.h" -#include "util/u_simple_screen.h" - -#include "brw_context.h" -#include "brw_screen.h" -#include "brw_tex_layout.h" - - -static const char * -brw_get_vendor( struct pipe_screen *screen ) -{ - return "VMware, Inc."; -} - - -static const char * -brw_get_name( struct pipe_screen *screen ) -{ - static char buffer[128]; - const char *chipset; - - switch (brw_screen(screen)->pci_id) { - case PCI_CHIP_I965_Q: - chipset = "Intel(R) 965Q"; - break; - case PCI_CHIP_I965_G: - case PCI_CHIP_I965_G_1: - chipset = "Intel(R) 965G"; - break; - case PCI_CHIP_I965_GM: - chipset = "Intel(R) 965GM"; - break; - case PCI_CHIP_I965_GME: - chipset = "Intel(R) 965GME/GLE"; - break; - default: - chipset = "unknown"; - break; - } - - util_snprintf(buffer, sizeof(buffer), "i965 (chipset: %s)", chipset); - return buffer; -} - - -static int -brw_get_param(struct pipe_screen *screen, int param) -{ - switch (param) { - case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: - return 8; - case PIPE_CAP_NPOT_TEXTURES: - return 1; - case PIPE_CAP_TWO_SIDED_STENCIL: - return 1; - case PIPE_CAP_GLSL: - return 0; - case PIPE_CAP_ANISOTROPIC_FILTER: - return 0; - case PIPE_CAP_POINT_SPRITE: - return 0; - case PIPE_CAP_MAX_RENDER_TARGETS: - return 1; - case PIPE_CAP_OCCLUSION_QUERY: - return 0; - case PIPE_CAP_TEXTURE_SHADOW_MAP: - return 1; - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: - return 11; /* max 1024x1024 */ - case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: - return 8; /* max 128x128x128 */ - case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: - return 11; /* max 1024x1024 */ - default: - return 0; - } -} - - -static float -brw_get_paramf(struct pipe_screen *screen, int param) -{ - switch (param) { - case PIPE_CAP_MAX_LINE_WIDTH: - /* fall-through */ - case PIPE_CAP_MAX_LINE_WIDTH_AA: - return 7.5; - - case PIPE_CAP_MAX_POINT_WIDTH: - /* fall-through */ - case PIPE_CAP_MAX_POINT_WIDTH_AA: - return 255.0; - - case PIPE_CAP_MAX_TEXTURE_ANISOTROPY: - return 4.0; - - case PIPE_CAP_MAX_TEXTURE_LOD_BIAS: - return 16.0; - - default: - return 0; - } -} - - -static boolean -brw_is_format_supported( struct pipe_screen *screen, - enum pipe_format format, - enum pipe_texture_target target, - unsigned tex_usage, - unsigned geom_flags ) -{ -#if 0 - /* XXX: This is broken -- rewrite if still needed. */ - static const unsigned tex_supported[] = { - PIPE_FORMAT_R8G8B8A8_UNORM, - PIPE_FORMAT_A8R8G8B8_UNORM, - PIPE_FORMAT_R5G6B5_UNORM, - PIPE_FORMAT_L8_UNORM, - PIPE_FORMAT_A8_UNORM, - PIPE_FORMAT_I8_UNORM, - PIPE_FORMAT_L8A8_UNORM, - PIPE_FORMAT_YCBCR, - PIPE_FORMAT_YCBCR_REV, - PIPE_FORMAT_S8_Z24, - }; - - - /* Actually a lot more than this - add later: - */ - static const unsigned render_supported[] = { - PIPE_FORMAT_A8R8G8B8_UNORM, - PIPE_FORMAT_R5G6B5_UNORM, - }; - - /* - */ - static const unsigned z_stencil_supported[] = { - PIPE_FORMAT_Z16_UNORM, - PIPE_FORMAT_Z32_UNORM, - PIPE_FORMAT_S8Z24_UNORM, - }; - - switch (type) { - case PIPE_RENDER_FORMAT: - *numFormats = Elements(render_supported); - return render_supported; - - case PIPE_TEX_FORMAT: - *numFormats = Elements(tex_supported); - return render_supported; - - case PIPE_Z_STENCIL_FORMAT: - *numFormats = Elements(render_supported); - return render_supported; - - default: - *numFormats = 0; - return NULL; - } -#else - switch (format) { - case PIPE_FORMAT_A8R8G8B8_UNORM: - case PIPE_FORMAT_R5G6B5_UNORM: - case PIPE_FORMAT_S8Z24_UNORM: - return TRUE; - default: - return FALSE; - }; - return FALSE; -#endif -} - - -static void -brw_destroy_screen( struct pipe_screen *screen ) -{ - struct pipe_winsys *winsys = screen->winsys; - - if(winsys->destroy) - winsys->destroy(winsys); - - FREE(screen); -} - - -/** - * Create a new brw_screen object - */ -struct pipe_screen * -brw_create_screen(struct pipe_winsys *winsys, uint pci_id) -{ - struct brw_screen *brwscreen = CALLOC_STRUCT(brw_screen); - - if (!brwscreen) - return NULL; - - brwscreen->pci_id = pci_id; - - brwscreen->screen.winsys = winsys; - - brwscreen->screen.destroy = brw_destroy_screen; - - brwscreen->screen.get_name = brw_get_name; - brwscreen->screen.get_vendor = brw_get_vendor; - brwscreen->screen.get_param = brw_get_param; - brwscreen->screen.get_paramf = brw_get_paramf; - brwscreen->screen.is_format_supported = brw_is_format_supported; - - brw_init_screen_texture_funcs(&brwscreen->screen); - u_simple_screen_init(&brwscreen->screen); - - return &brwscreen->screen; -} diff --git a/src/gallium/drivers/i965simple/brw_screen.h b/src/gallium/drivers/i965simple/brw_screen.h deleted file mode 100644 index d3c70387e6..0000000000 --- a/src/gallium/drivers/i965simple/brw_screen.h +++ /dev/null @@ -1,68 +0,0 @@ -/************************************************************************** - * - * 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. - * - **************************************************************************/ - - -#ifndef BRW_SCREEN_H -#define BRW_SCREEN_H - - -#include "pipe/p_screen.h" - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * Subclass of pipe_screen - */ -struct brw_screen -{ - struct pipe_screen screen; - - uint pci_id; -}; - - -/** cast wrapper */ -static INLINE struct brw_screen * -brw_screen(struct pipe_screen *pscreen) -{ - return (struct brw_screen *) pscreen; -} - - -extern struct pipe_screen * -brw_create_screen(struct pipe_winsys *winsys, uint pci_id); - - -#ifdef __cplusplus -} -#endif - -#endif /* BRW_SCREEN_H */ diff --git a/src/gallium/drivers/i965simple/brw_sf.c b/src/gallium/drivers/i965simple/brw_sf.c deleted file mode 100644 index b82a2e143b..0000000000 --- a/src/gallium/drivers/i965simple/brw_sf.c +++ /dev/null @@ -1,351 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#include "brw_defines.h" -#include "brw_context.h" -#include "brw_eu.h" -#include "brw_util.h" -#include "brw_sf.h" -#include "brw_state.h" -#include "tgsi/tgsi_parse.h" - - -static void compile_sf_prog( struct brw_context *brw, - struct brw_sf_prog_key *key ) -{ - struct brw_sf_compile c; - const unsigned *program; - unsigned program_size; - - memset(&c, 0, sizeof(c)); - - /* Begin the compilation: - */ - brw_init_compile(&c.func); - - c.key = *key; - - - c.nr_attrs = c.key.vp_output_count; - c.nr_attr_regs = (c.nr_attrs+1)/2; - - c.nr_setup_attrs = c.key.fp_input_count + 1; /* +1 for position */ - c.nr_setup_regs = (c.nr_setup_attrs+1)/2; - - c.prog_data.urb_read_length = c.nr_attr_regs; - c.prog_data.urb_entry_size = c.nr_setup_regs * 2; - - - /* Which primitive? Or all three? - */ - switch (key->primitive) { - case SF_TRIANGLES: - c.nr_verts = 3; - brw_emit_tri_setup( &c ); - break; - case SF_LINES: - c.nr_verts = 2; - brw_emit_line_setup( &c ); - break; - case SF_POINTS: - c.nr_verts = 1; - brw_emit_point_setup( &c ); - break; - - case SF_UNFILLED_TRIS: - default: - assert(0); - return; - } - - - - /* get the program - */ - program = brw_get_program(&c.func, &program_size); - - /* Upload - */ - brw->sf.prog_gs_offset = brw_upload_cache( &brw->cache[BRW_SF_PROG], - &c.key, - sizeof(c.key), - program, - program_size, - &c.prog_data, - &brw->sf.prog_data ); -} - - -static boolean search_cache( struct brw_context *brw, - struct brw_sf_prog_key *key ) -{ - return brw_search_cache(&brw->cache[BRW_SF_PROG], - key, sizeof(*key), - &brw->sf.prog_data, - &brw->sf.prog_gs_offset); -} - - -/* Calculate interpolants for triangle and line rasterization. - */ -static void upload_sf_prog( struct brw_context *brw ) -{ - const struct brw_fragment_program *fs = brw->attribs.FragmentProgram; - struct brw_sf_prog_key key; - struct tgsi_parse_context parse; - int i, done = 0; - - - memset(&key, 0, sizeof(key)); - - /* Populate the key, noting state dependencies: - */ - /* CACHE_NEW_VS_PROG */ - key.vp_output_count = brw->vs.prog_data->outputs_written; - - /* BRW_NEW_FS */ - key.fp_input_count = brw->attribs.FragmentProgram->info.file_max[TGSI_FILE_INPUT] + 1; - - - /* BRW_NEW_REDUCED_PRIMITIVE */ - switch (brw->reduced_primitive) { - case PIPE_PRIM_TRIANGLES: -// if (key.attrs & (1<program.tokens ); - while( !done && - !tgsi_parse_end_of_tokens( &parse ) ) - { - tgsi_parse_token( &parse ); - - switch( parse.FullToken.Token.Type ) { - case TGSI_TOKEN_TYPE_DECLARATION: - if (parse.FullToken.FullDeclaration.Declaration.File == TGSI_FILE_INPUT) - { - int first = parse.FullToken.FullDeclaration.DeclarationRange.First; - int last = parse.FullToken.FullDeclaration.DeclarationRange.Last; - int interp_mode = parse.FullToken.FullDeclaration.Declaration.Interpolate; - //int semantic = parse.FullToken.FullDeclaration.Semantic.SemanticName; - //int semantic_index = parse.FullToken.FullDeclaration.Semantic.SemanticIndex; - - debug_printf("fs input %d..%d interp mode %d\n", first, last, interp_mode); - - switch (interp_mode) { - case TGSI_INTERPOLATE_CONSTANT: - for (i = first; i <= last; i++) - key.const_mask |= (1 << i); - break; - case TGSI_INTERPOLATE_LINEAR: - for (i = first; i <= last; i++) - key.linear_mask |= (1 << i); - break; - case TGSI_INTERPOLATE_PERSPECTIVE: - for (i = first; i <= last; i++) - key.persp_mask |= (1 << i); - break; - default: - break; - } - - /* Also need stuff for flat shading, twosided color. - */ - - } - break; - default: - done = 1; - break; - } - } - - /* Hack: Adjust for position. Optimize away when not required (ie - * for perspective interpolation). - */ - key.persp_mask <<= 1; - key.linear_mask <<= 1; - key.linear_mask |= 1; - key.const_mask <<= 1; - - debug_printf("key.persp_mask: %x\n", key.persp_mask); - debug_printf("key.linear_mask: %x\n", key.linear_mask); - debug_printf("key.const_mask: %x\n", key.const_mask); - - -// key.do_point_sprite = brw->attribs.Point->PointSprite; -// key.SpriteOrigin = brw->attribs.Point->SpriteOrigin; - -// key.do_flat_shading = (brw->attribs.Raster->flatshade); -// key.do_twoside_color = (brw->attribs.Light->Enabled && brw->attribs.Light->Model.TwoSide); - -// if (key.do_twoside_color) -// key.frontface_ccw = (brw->attribs.Polygon->FrontFace == GL_CCW); - - - if (!search_cache(brw, &key)) - compile_sf_prog( brw, &key ); -} - - -const struct brw_tracked_state brw_sf_prog = { - .dirty = { - .brw = (BRW_NEW_RASTERIZER | - BRW_NEW_REDUCED_PRIMITIVE | - BRW_NEW_VS | - BRW_NEW_FS), - .cache = 0, - }, - .update = upload_sf_prog -}; - - - -#if 0 -/* Build a struct like the one we'd like the state tracker to pass to - * us. - */ -static void update_sf_linkage( struct brw_context *brw ) -{ - const struct brw_vertex_program *vs = brw->attribs.VertexProgram; - const struct brw_fragment_program *fs = brw->attribs.FragmentProgram; - struct pipe_setup_linkage state; - struct tgsi_parse_context parse; - - int i, j; - int nr_vp_outputs = 0; - int done = 0; - - struct { - unsigned semantic:8; - unsigned semantic_index:16; - } fp_semantic[32], vp_semantic[32]; - - memset(&state, 0, sizeof(state)); - - state.fp_input_count = 0; - - - - - - - assert(state.fp_input_count == fs->program.num_inputs); - - - /* Then scan vp outputs - */ - done = 0; - tgsi_parse_init( &parse, vs->program.tokens ); - while( !done && - !tgsi_parse_end_of_tokens( &parse ) ) - { - tgsi_parse_token( &parse ); - - switch( parse.FullToken.Token.Type ) { - case TGSI_TOKEN_TYPE_DECLARATION: - if (parse.FullToken.FullDeclaration.Declaration.File == TGSI_FILE_INPUT) - { - int first = parse.FullToken.FullDeclaration.DeclarationRange.First; - int last = parse.FullToken.FullDeclaration.DeclarationRange.Last; - - for (i = first; i < last; i++) { - vp_semantic[i].semantic = - parse.FullToken.FullDeclaration.Semantic.SemanticName; - vp_semantic[i].semantic_index = - parse.FullToken.FullDeclaration.Semantic.SemanticIndex; - } - - assert(last > nr_vp_outputs); - nr_vp_outputs = last; - } - break; - default: - done = 1; - break; - } - } - - - /* Now match based on semantic information. - */ - for (i = 0; i< state.fp_input_count; i++) { - for (j = 0; j < nr_vp_outputs; j++) { - if (fp_semantic[i].semantic == vp_semantic[j].semantic && - fp_semantic[i].semantic_index == vp_semantic[j].semantic_index) { - state.fp_input[i].vp_output = j; - } - } - if (fp_semantic[i].semantic == TGSI_SEMANTIC_COLOR) { - for (j = 0; j < nr_vp_outputs; j++) { - if (TGSI_SEMANTIC_BCOLOR == vp_semantic[j].semantic && - fp_semantic[i].semantic_index == vp_semantic[j].semantic_index) { - state.fp_input[i].bf_vp_output = j; - } - } - } - } - - if (memcmp(&brw->sf.linkage, &state, sizeof(state)) != 0) { - brw->sf.linkage = state; - brw->state.dirty.brw |= BRW_NEW_SF_LINKAGE; - } -} - - -const struct brw_tracked_state brw_sf_linkage = { - .dirty = { - .brw = (BRW_NEW_VS | - BRW_NEW_FS), - .cache = 0, - }, - .update = update_sf_linkage -}; - - -#endif diff --git a/src/gallium/drivers/i965simple/brw_sf.h b/src/gallium/drivers/i965simple/brw_sf.h deleted file mode 100644 index b7ada47560..0000000000 --- a/src/gallium/drivers/i965simple/brw_sf.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#ifndef BRW_SF_H -#define BRW_SF_H - -#include "brw_context.h" -#include "brw_eu.h" - - -#define SF_POINTS 0 -#define SF_LINES 1 -#define SF_TRIANGLES 2 -#define SF_UNFILLED_TRIS 3 - - - -struct brw_sf_prog_key { - unsigned vp_output_count:5; - unsigned fp_input_count:5; - - unsigned primitive:2; - unsigned do_twoside_color:1; - unsigned do_flat_shading:1; - unsigned frontface_ccw:1; - unsigned do_point_sprite:1; - - /* Interpolation masks; - */ - unsigned linear_mask; - unsigned persp_mask; - unsigned const_mask; - - -// int SpriteOrigin; -}; - -struct brw_sf_point_tex { - boolean CoordReplace; -}; - -struct brw_sf_compile { - struct brw_compile func; - struct brw_sf_prog_key key; - struct brw_sf_prog_data prog_data; - - struct brw_reg pv; - struct brw_reg det; - struct brw_reg dx0; - struct brw_reg dx2; - struct brw_reg dy0; - struct brw_reg dy2; - - /* z and 1/w passed in seperately: - */ - struct brw_reg z[3]; - struct brw_reg inv_w[3]; - - /* The vertices: - */ - struct brw_reg vert[3]; - - /* Temporaries, allocated after last vertex reg. - */ - struct brw_reg inv_det; - struct brw_reg a1_sub_a0; - struct brw_reg a2_sub_a0; - struct brw_reg tmp; - - struct brw_reg m1Cx; - struct brw_reg m2Cy; - struct brw_reg m3C0; - - unsigned nr_verts; - unsigned nr_attrs; - unsigned nr_attr_regs; - unsigned nr_setup_attrs; - unsigned nr_setup_regs; -#if 0 - ubyte attr_to_idx[VERT_RESULT_MAX]; - ubyte idx_to_attr[VERT_RESULT_MAX]; - struct brw_sf_point_tex point_attrs[VERT_RESULT_MAX]; -#endif -}; - - -void brw_emit_tri_setup( struct brw_sf_compile *c ); -void brw_emit_line_setup( struct brw_sf_compile *c ); -void brw_emit_point_setup( struct brw_sf_compile *c ); -void brw_emit_point_sprite_setup( struct brw_sf_compile *c ); -void brw_emit_anyprim_setup( struct brw_sf_compile *c ); - -#endif diff --git a/src/gallium/drivers/i965simple/brw_sf_emit.c b/src/gallium/drivers/i965simple/brw_sf_emit.c deleted file mode 100644 index 78d6fa5e9e..0000000000 --- a/src/gallium/drivers/i965simple/brw_sf_emit.c +++ /dev/null @@ -1,382 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#include "brw_defines.h" -#include "brw_context.h" -#include "brw_eu.h" -#include "brw_util.h" -#include "brw_sf.h" - - - -/*********************************************************************** - * Triangle setup. - */ - - -static void alloc_regs( struct brw_sf_compile *c ) -{ - unsigned reg, i; - - /* Values computed by fixed function unit: - */ - c->pv = retype(brw_vec1_grf(1, 1), BRW_REGISTER_TYPE_UD); - c->det = brw_vec1_grf(1, 2); - c->dx0 = brw_vec1_grf(1, 3); - c->dx2 = brw_vec1_grf(1, 4); - c->dy0 = brw_vec1_grf(1, 5); - c->dy2 = brw_vec1_grf(1, 6); - - /* z and 1/w passed in seperately: - */ - c->z[0] = brw_vec1_grf(2, 0); - c->inv_w[0] = brw_vec1_grf(2, 1); - c->z[1] = brw_vec1_grf(2, 2); - c->inv_w[1] = brw_vec1_grf(2, 3); - c->z[2] = brw_vec1_grf(2, 4); - c->inv_w[2] = brw_vec1_grf(2, 5); - - /* The vertices: - */ - reg = 3; - for (i = 0; i < c->nr_verts; i++) { - c->vert[i] = brw_vec8_grf(reg, 0); - reg += c->nr_attr_regs; - } - - /* Temporaries, allocated after last vertex reg. - */ - c->inv_det = brw_vec1_grf(reg, 0); reg++; - c->a1_sub_a0 = brw_vec8_grf(reg, 0); reg++; - c->a2_sub_a0 = brw_vec8_grf(reg, 0); reg++; - c->tmp = brw_vec8_grf(reg, 0); reg++; - - /* Note grf allocation: - */ - c->prog_data.total_grf = reg; - - - /* Outputs of this program - interpolation coefficients for - * rasterization: - */ - c->m1Cx = brw_vec8_reg(BRW_MESSAGE_REGISTER_FILE, 1, 0); - c->m2Cy = brw_vec8_reg(BRW_MESSAGE_REGISTER_FILE, 2, 0); - c->m3C0 = brw_vec8_reg(BRW_MESSAGE_REGISTER_FILE, 3, 0); -} - - -static void copy_z_inv_w( struct brw_sf_compile *c ) -{ - struct brw_compile *p = &c->func; - unsigned i; - - brw_push_insn_state(p); - - /* Copy both scalars with a single MOV: - */ - for (i = 0; i < c->nr_verts; i++) - brw_MOV(p, vec2(suboffset(c->vert[i], 2)), vec2(c->z[i])); - - brw_pop_insn_state(p); -} - - -static void invert_det( struct brw_sf_compile *c) -{ - brw_math(&c->func, - c->inv_det, - BRW_MATH_FUNCTION_INV, - BRW_MATH_SATURATE_NONE, - 0, - c->det, - BRW_MATH_DATA_SCALAR, - BRW_MATH_PRECISION_FULL); - -} - -#define NON_PERPECTIVE_ATTRS (FRAG_BIT_WPOS | \ - FRAG_BIT_COL0 | \ - FRAG_BIT_COL1) - -static boolean calculate_masks( struct brw_sf_compile *c, - unsigned reg, - ushort *pc, - ushort *pc_persp, - ushort *pc_linear) -{ - boolean is_last_attr = (reg == c->nr_setup_regs - 1); - unsigned persp_mask = c->key.persp_mask; - unsigned linear_mask = c->key.linear_mask; - - debug_printf("persp_mask: %x\n", persp_mask); - debug_printf("linear_mask: %x\n", linear_mask); - - *pc_persp = 0; - *pc_linear = 0; - *pc = 0xf; - - if (persp_mask & (1 << (reg*2))) - *pc_persp = 0xf; - - if (linear_mask & (1 << (reg*2))) - *pc_linear = 0xf; - - /* Maybe only processs one attribute on the final round: - */ - if (reg*2+1 < c->nr_setup_attrs) { - *pc |= 0xf0; - - if (persp_mask & (1 << (reg*2+1))) - *pc_persp |= 0xf0; - - if (linear_mask & (1 << (reg*2+1))) - *pc_linear |= 0xf0; - } - - debug_printf("pc: %x\n", *pc); - debug_printf("pc_persp: %x\n", *pc_persp); - debug_printf("pc_linear: %x\n", *pc_linear); - - - return is_last_attr; -} - - - -void brw_emit_tri_setup( struct brw_sf_compile *c ) -{ - struct brw_compile *p = &c->func; - unsigned i; - - debug_printf("%s START ==============\n", __FUNCTION__); - - c->nr_verts = 3; - alloc_regs(c); - invert_det(c); - copy_z_inv_w(c); - - - for (i = 0; i < c->nr_setup_regs; i++) - { - /* Pair of incoming attributes: - */ - struct brw_reg a0 = offset(c->vert[0], i); - struct brw_reg a1 = offset(c->vert[1], i); - struct brw_reg a2 = offset(c->vert[2], i); - ushort pc = 0, pc_persp = 0, pc_linear = 0; - boolean last = calculate_masks(c, i, &pc, &pc_persp, &pc_linear); - - if (pc_persp) - { - brw_set_predicate_control_flag_value(p, pc_persp); - brw_MUL(p, a0, a0, c->inv_w[0]); - brw_MUL(p, a1, a1, c->inv_w[1]); - brw_MUL(p, a2, a2, c->inv_w[2]); - } - - - /* Calculate coefficients for interpolated values: - */ - if (pc_linear) - { - brw_set_predicate_control_flag_value(p, pc_linear); - - brw_ADD(p, c->a1_sub_a0, a1, negate(a0)); - brw_ADD(p, c->a2_sub_a0, a2, negate(a0)); - - /* calculate dA/dx - */ - brw_MUL(p, brw_null_reg(), c->a1_sub_a0, c->dy2); - brw_MAC(p, c->tmp, c->a2_sub_a0, negate(c->dy0)); - brw_MUL(p, c->m1Cx, c->tmp, c->inv_det); - - /* calculate dA/dy - */ - brw_MUL(p, brw_null_reg(), c->a2_sub_a0, c->dx0); - brw_MAC(p, c->tmp, c->a1_sub_a0, negate(c->dx2)); - brw_MUL(p, c->m2Cy, c->tmp, c->inv_det); - } - - { - brw_set_predicate_control_flag_value(p, pc); - /* start point for interpolation - */ - brw_MOV(p, c->m3C0, a0); - - /* Copy m0..m3 to URB. m0 is implicitly copied from r0 in - * the send instruction: - */ - brw_urb_WRITE(p, - brw_null_reg(), - 0, - brw_vec8_grf(0, 0), /* r0, will be copied to m0 */ - 0, /* allocate */ - 1, /* used */ - 4, /* msg len */ - 0, /* response len */ - last, /* eot */ - last, /* writes complete */ - i*4, /* offset */ - BRW_URB_SWIZZLE_TRANSPOSE); /* XXX: Swizzle control "SF to windower" */ - } - } - - debug_printf("%s DONE ==============\n", __FUNCTION__); - -} - - - -void brw_emit_line_setup( struct brw_sf_compile *c ) -{ - struct brw_compile *p = &c->func; - unsigned i; - - - c->nr_verts = 2; - alloc_regs(c); - invert_det(c); - copy_z_inv_w(c); - - for (i = 0; i < c->nr_setup_regs; i++) - { - /* Pair of incoming attributes: - */ - struct brw_reg a0 = offset(c->vert[0], i); - struct brw_reg a1 = offset(c->vert[1], i); - ushort pc, pc_persp, pc_linear; - boolean last = calculate_masks(c, i, &pc, &pc_persp, &pc_linear); - - if (pc_persp) - { - brw_set_predicate_control_flag_value(p, pc_persp); - brw_MUL(p, a0, a0, c->inv_w[0]); - brw_MUL(p, a1, a1, c->inv_w[1]); - } - - /* Calculate coefficients for position, color: - */ - if (pc_linear) { - brw_set_predicate_control_flag_value(p, pc_linear); - - brw_ADD(p, c->a1_sub_a0, a1, negate(a0)); - - brw_MUL(p, c->tmp, c->a1_sub_a0, c->dx0); - brw_MUL(p, c->m1Cx, c->tmp, c->inv_det); - - brw_MUL(p, c->tmp, c->a1_sub_a0, c->dy0); - brw_MUL(p, c->m2Cy, c->tmp, c->inv_det); - } - - { - brw_set_predicate_control_flag_value(p, pc); - - /* start point for interpolation - */ - brw_MOV(p, c->m3C0, a0); - - /* Copy m0..m3 to URB. - */ - brw_urb_WRITE(p, - brw_null_reg(), - 0, - brw_vec8_grf(0, 0), - 0, /* allocate */ - 1, /* used */ - 4, /* msg len */ - 0, /* response len */ - last, /* eot */ - last, /* writes complete */ - i*4, /* urb destination offset */ - BRW_URB_SWIZZLE_TRANSPOSE); - } - } -} - - -/* Points setup - several simplifications as all attributes are - * constant across the face of the point (point sprites excluded!) - */ -void brw_emit_point_setup( struct brw_sf_compile *c ) -{ - struct brw_compile *p = &c->func; - unsigned i; - - c->nr_verts = 1; - alloc_regs(c); - copy_z_inv_w(c); - - brw_MOV(p, c->m1Cx, brw_imm_ud(0)); /* zero - move out of loop */ - brw_MOV(p, c->m2Cy, brw_imm_ud(0)); /* zero - move out of loop */ - - for (i = 0; i < c->nr_setup_regs; i++) - { - struct brw_reg a0 = offset(c->vert[0], i); - ushort pc, pc_persp, pc_linear; - boolean last = calculate_masks(c, i, &pc, &pc_persp, &pc_linear); - - if (pc_persp) - { - /* This seems odd as the values are all constant, but the - * fragment shader will be expecting it: - */ - brw_set_predicate_control_flag_value(p, pc_persp); - brw_MUL(p, a0, a0, c->inv_w[0]); - } - - - /* The delta values are always zero, just send the starting - * coordinate. Again, this is to fit in with the interpolation - * code in the fragment shader. - */ - { - brw_set_predicate_control_flag_value(p, pc); - - brw_MOV(p, c->m3C0, a0); /* constant value */ - - /* Copy m0..m3 to URB. - */ - brw_urb_WRITE(p, - brw_null_reg(), - 0, - brw_vec8_grf(0, 0), - 0, /* allocate */ - 1, /* used */ - 4, /* msg len */ - 0, /* response len */ - last, /* eot */ - last, /* writes complete */ - i*4, /* urb destination offset */ - BRW_URB_SWIZZLE_TRANSPOSE); - } - } -} diff --git a/src/gallium/drivers/i965simple/brw_sf_state.c b/src/gallium/drivers/i965simple/brw_sf_state.c deleted file mode 100644 index 2a5de61c21..0000000000 --- a/src/gallium/drivers/i965simple/brw_sf_state.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#include "brw_context.h" -#include "brw_state.h" -#include "brw_defines.h" -#include "util/u_math.h" -#include "util/u_memory.h" - - -static void upload_sf_vp(struct brw_context *brw) -{ - struct brw_sf_viewport sfv; - - memset(&sfv, 0, sizeof(sfv)); - - - /* BRW_NEW_VIEWPORT */ - { - const float *scale = brw->attribs.Viewport.scale; - const float *trans = brw->attribs.Viewport.translate; - - sfv.viewport.m00 = scale[0]; - sfv.viewport.m11 = scale[1]; - sfv.viewport.m22 = scale[2]; - sfv.viewport.m30 = trans[0]; - sfv.viewport.m31 = trans[1]; - sfv.viewport.m32 = trans[2]; - } - - /* _NEW_SCISSOR */ - sfv.scissor.xmin = brw->attribs.Scissor.minx; - sfv.scissor.xmax = brw->attribs.Scissor.maxx - 1; - sfv.scissor.ymin = brw->attribs.Scissor.miny; - sfv.scissor.ymax = brw->attribs.Scissor.maxy - 1; - - brw->sf.vp_gs_offset = brw_cache_data( &brw->cache[BRW_SF_VP], &sfv ); -} - -const struct brw_tracked_state brw_sf_vp = { - .dirty = { - .brw = (BRW_NEW_SCISSOR | - BRW_NEW_VIEWPORT), - .cache = 0 - }, - .update = upload_sf_vp -}; - -static void upload_sf_unit( struct brw_context *brw ) -{ - struct brw_sf_unit_state sf; - memset(&sf, 0, sizeof(sf)); - - /* CACHE_NEW_SF_PROG */ - sf.thread0.grf_reg_count = align(brw->sf.prog_data->total_grf, 16) / 16 - 1; - sf.thread0.kernel_start_pointer = brw->sf.prog_gs_offset >> 6; - sf.thread3.urb_entry_read_length = brw->sf.prog_data->urb_read_length; - - sf.thread1.floating_point_mode = BRW_FLOATING_POINT_NON_IEEE_754; - sf.thread3.dispatch_grf_start_reg = 3; - sf.thread3.urb_entry_read_offset = 1; - - /* BRW_NEW_URB_FENCE */ - sf.thread4.nr_urb_entries = brw->urb.nr_sf_entries; - sf.thread4.urb_entry_allocation_size = brw->urb.sfsize - 1; - sf.thread4.max_threads = MIN2(12, brw->urb.nr_sf_entries / 2) - 1; - - if (BRW_DEBUG & DEBUG_SINGLE_THREAD) - sf.thread4.max_threads = 0; - - if (BRW_DEBUG & DEBUG_STATS) - sf.thread4.stats_enable = 1; - - /* CACHE_NEW_SF_VP */ - sf.sf5.sf_viewport_state_offset = brw->sf.vp_gs_offset >> 5; - sf.sf5.viewport_transform = 1; - - /* BRW_NEW_RASTER */ - if (brw->attribs.Raster->scissor) - sf.sf6.scissor = 1; - -#if 0 - if (brw->attribs.Polygon->FrontFace == GL_CCW) - sf.sf5.front_winding = BRW_FRONTWINDING_CCW; - else - sf.sf5.front_winding = BRW_FRONTWINDING_CW; - - - if (brw->attribs.Polygon->CullFlag) { - switch (brw->attribs.Polygon->CullFaceMode) { - case GL_FRONT: - sf.sf6.cull_mode = BRW_CULLMODE_FRONT; - break; - case GL_BACK: - sf.sf6.cull_mode = BRW_CULLMODE_BACK; - break; - case GL_FRONT_AND_BACK: - sf.sf6.cull_mode = BRW_CULLMODE_BOTH; - break; - default: - assert(0); - break; - } - } - else - sf.sf6.cull_mode = BRW_CULLMODE_NONE; -#else - sf.sf5.front_winding = BRW_FRONTWINDING_CCW; - sf.sf6.cull_mode = BRW_CULLMODE_NONE; -#endif - - sf.sf6.line_width = CLAMP(brw->attribs.Raster->line_width, 1.0, 5.0) * (1<<1); - - sf.sf6.line_endcap_aa_region_width = 1; - if (brw->attribs.Raster->line_smooth) - sf.sf6.aa_enable = 1; - else if (sf.sf6.line_width <= 0x2) - sf.sf6.line_width = 0; - - sf.sf6.point_rast_rule = 1; /* opengl conventions */ - - sf.sf7.sprite_point = brw->attribs.Raster->point_sprite; - sf.sf7.point_size = CLAMP(brw->attribs.Raster->line_width, 1.0, 255.0) * (1<<3); - sf.sf7.use_point_size_state = !brw->attribs.Raster->point_size_per_vertex; - - /* might be BRW_NEW_PRIMITIVE if we have to adjust pv for polygons: - */ - sf.sf7.trifan_pv = 2; - sf.sf7.linestrip_pv = 1; - sf.sf7.tristrip_pv = 2; - sf.sf7.line_last_pixel_enable = 0; - - /* Set bias for OpenGL rasterization rules: - */ - sf.sf6.dest_org_vbias = 0x8; - sf.sf6.dest_org_hbias = 0x8; - - brw->sf.state_gs_offset = brw_cache_data( &brw->cache[BRW_SF_UNIT], &sf ); -} - - -const struct brw_tracked_state brw_sf_unit = { - .dirty = { - .brw = (BRW_NEW_RASTERIZER | - BRW_NEW_URB_FENCE), - .cache = (CACHE_NEW_SF_VP | - CACHE_NEW_SF_PROG) - }, - .update = upload_sf_unit -}; - - diff --git a/src/gallium/drivers/i965simple/brw_shader_info.c b/src/gallium/drivers/i965simple/brw_shader_info.c deleted file mode 100644 index 86d877d7ef..0000000000 --- a/src/gallium/drivers/i965simple/brw_shader_info.c +++ /dev/null @@ -1,48 +0,0 @@ - -#include "brw_context.h" -#include "brw_state.h" -#include "util/u_memory.h" -#include "pipe/p_shader_tokens.h" -#include "tgsi/tgsi_parse.h" - - -/** - * XXX this obsolete new and no longer compiled. - */ -void brw_shader_info(const struct tgsi_token *tokens, - struct brw_shader_info *info ) -{ - struct tgsi_parse_context parse; - int done = 0; - - tgsi_parse_init( &parse, tokens ); - - while( !done && - !tgsi_parse_end_of_tokens( &parse ) ) - { - tgsi_parse_token( &parse ); - - switch( parse.FullToken.Token.Type ) { - case TGSI_TOKEN_TYPE_DECLARATION: - { - const struct tgsi_full_declaration *decl = &parse.FullToken.FullDeclaration; - unsigned last = decl->DeclarationRange.Last; - - // Broken by crazy wpos init: - //assert( info->nr_regs[decl->Declaration.File] <= last); - - info->nr_regs[decl->Declaration.File] = MAX2(info->nr_regs[decl->Declaration.File], - last+1); - break; - } - case TGSI_TOKEN_TYPE_IMMEDIATE: - case TGSI_TOKEN_TYPE_INSTRUCTION: - default: - done = 1; - break; - } - } - - tgsi_parse_free (&parse); - -} diff --git a/src/gallium/drivers/i965simple/brw_state.c b/src/gallium/drivers/i965simple/brw_state.c deleted file mode 100644 index b47f5373f3..0000000000 --- a/src/gallium/drivers/i965simple/brw_state.c +++ /dev/null @@ -1,469 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * 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: Zack Rusin - * Keith Whitwell - */ - - -#include "pipe/internal/p_winsys_screen.h" -#include "util/u_memory.h" -#include "pipe/p_inlines.h" -#include "pipe/p_shader_tokens.h" -#include "tgsi/tgsi_dump.h" -#include "tgsi/tgsi_parse.h" - -#include "brw_context.h" -#include "brw_defines.h" -#include "brw_state.h" -#include "brw_draw.h" - - -#define DUP( TYPE, VAL ) \ -do { \ - struct TYPE *x = malloc(sizeof(*x)); \ - memcpy(x, VAL, sizeof(*x) ); \ - return x; \ -} while (0) - -/************************************************************************ - * Blend - */ -static void * -brw_create_blend_state(struct pipe_context *pipe, - const struct pipe_blend_state *blend) -{ - DUP( pipe_blend_state, blend ); -} - -static void brw_bind_blend_state(struct pipe_context *pipe, - void *blend) -{ - struct brw_context *brw = brw_context(pipe); - - brw->attribs.Blend = (struct pipe_blend_state*)blend; - brw->state.dirty.brw |= BRW_NEW_BLEND; -} - - -static void brw_delete_blend_state(struct pipe_context *pipe, void *blend) -{ - free(blend); -} - -static void brw_set_blend_color( struct pipe_context *pipe, - const struct pipe_blend_color *blend_color ) -{ - struct brw_context *brw = brw_context(pipe); - - brw->attribs.BlendColor = *blend_color; - - brw->state.dirty.brw |= BRW_NEW_BLEND; -} - -/************************************************************************ - * Sampler - */ - -static void * -brw_create_sampler_state(struct pipe_context *pipe, - const struct pipe_sampler_state *sampler) -{ - DUP( pipe_sampler_state, sampler ); -} - -static void brw_bind_sampler_states(struct pipe_context *pipe, - unsigned num, void **sampler) -{ - struct brw_context *brw = brw_context(pipe); - - assert(num <= PIPE_MAX_SAMPLERS); - - /* Check for no-op */ - if (num == brw->num_samplers && - !memcmp(brw->attribs.Samplers, sampler, num * sizeof(void *))) - return; - - memcpy(brw->attribs.Samplers, sampler, num * sizeof(void *)); - memset(&brw->attribs.Samplers[num], 0, (PIPE_MAX_SAMPLERS - num) * - sizeof(void *)); - - brw->num_samplers = num; - - brw->state.dirty.brw |= BRW_NEW_SAMPLER; -} - -static void brw_delete_sampler_state(struct pipe_context *pipe, - void *sampler) -{ - free(sampler); -} - - -/************************************************************************ - * Depth stencil - */ - -static void * -brw_create_depth_stencil_state(struct pipe_context *pipe, - const struct pipe_depth_stencil_alpha_state *depth_stencil) -{ - DUP( pipe_depth_stencil_alpha_state, depth_stencil ); -} - -static void brw_bind_depth_stencil_state(struct pipe_context *pipe, - void *depth_stencil) -{ - struct brw_context *brw = brw_context(pipe); - - brw->attribs.DepthStencil = (const struct pipe_depth_stencil_alpha_state *)depth_stencil; - - brw->state.dirty.brw |= BRW_NEW_DEPTH_STENCIL; -} - -static void brw_delete_depth_stencil_state(struct pipe_context *pipe, - void *depth_stencil) -{ - free(depth_stencil); -} - -/************************************************************************ - * Scissor - */ -static void brw_set_scissor_state( struct pipe_context *pipe, - const struct pipe_scissor_state *scissor ) -{ - struct brw_context *brw = brw_context(pipe); - - memcpy( &brw->attribs.Scissor, scissor, sizeof(*scissor) ); - brw->state.dirty.brw |= BRW_NEW_SCISSOR; -} - - -/************************************************************************ - * Stipple - */ - -static void brw_set_polygon_stipple( struct pipe_context *pipe, - const struct pipe_poly_stipple *stipple ) -{ -} - - -/************************************************************************ - * Fragment shader - */ - -static void * brw_create_fs_state(struct pipe_context *pipe, - const struct pipe_shader_state *shader) -{ - struct brw_fragment_program *brw_fp = CALLOC_STRUCT(brw_fragment_program); - - brw_fp->program.tokens = tgsi_dup_tokens(shader->tokens); - brw_fp->id = brw_context(pipe)->program_id++; - - tgsi_scan_shader(shader->tokens, &brw_fp->info); - -#if 0 - brw_shader_info(shader->tokens, - &brw_fp->info2); -#endif - - tgsi_dump(shader->tokens, 0); - - - return (void *)brw_fp; -} - -static void brw_bind_fs_state(struct pipe_context *pipe, void *shader) -{ - struct brw_context *brw = brw_context(pipe); - - brw->attribs.FragmentProgram = (struct brw_fragment_program *)shader; - brw->state.dirty.brw |= BRW_NEW_FS; -} - -static void brw_delete_fs_state(struct pipe_context *pipe, void *shader) -{ - struct brw_fragment_program *brw_fp = (struct brw_fragment_program *) shader; - - FREE((void *) brw_fp->program.tokens); - FREE(brw_fp); -} - - -/************************************************************************ - * Vertex shader and other TNL state - */ - -static void *brw_create_vs_state(struct pipe_context *pipe, - const struct pipe_shader_state *shader) -{ - struct brw_vertex_program *brw_vp = CALLOC_STRUCT(brw_vertex_program); - - brw_vp->program.tokens = tgsi_dup_tokens(shader->tokens); - brw_vp->id = brw_context(pipe)->program_id++; - - tgsi_scan_shader(shader->tokens, &brw_vp->info); - -#if 0 - brw_shader_info(shader->tokens, - &brw_vp->info2); -#endif - tgsi_dump(shader->tokens, 0); - - return (void *)brw_vp; -} - -static void brw_bind_vs_state(struct pipe_context *pipe, void *vs) -{ - struct brw_context *brw = brw_context(pipe); - - brw->attribs.VertexProgram = (struct brw_vertex_program *)vs; - brw->state.dirty.brw |= BRW_NEW_VS; - - debug_printf("YYYYYYYYYYYYY BINDING VERTEX SHADER\n"); -} - -static void brw_delete_vs_state(struct pipe_context *pipe, void *shader) -{ - struct brw_vertex_program *brw_vp = (struct brw_vertex_program *) shader; - - FREE((void *) brw_vp->program.tokens); - FREE(brw_vp); -} - - -static void brw_set_clip_state( struct pipe_context *pipe, - const struct pipe_clip_state *clip ) -{ - struct brw_context *brw = brw_context(pipe); - - brw->attribs.Clip = *clip; -} - - -static void brw_set_viewport_state( struct pipe_context *pipe, - const struct pipe_viewport_state *viewport ) -{ - struct brw_context *brw = brw_context(pipe); - - brw->attribs.Viewport = *viewport; /* struct copy */ - brw->state.dirty.brw |= BRW_NEW_VIEWPORT; - - /* pass the viewport info to the draw module */ - //draw_set_viewport_state(brw->draw, viewport); -} - - -static void brw_set_vertex_buffers(struct pipe_context *pipe, - unsigned count, - const struct pipe_vertex_buffer *buffers) -{ - struct brw_context *brw = brw_context(pipe); - memcpy(brw->vb.vbo_array, buffers, count * sizeof(buffers[0])); -} - -static void brw_set_vertex_elements(struct pipe_context *pipe, - unsigned count, - const struct pipe_vertex_element *elements) -{ - /* flush ? */ - struct brw_context *brw = brw_context(pipe); - uint i; - - assert(count <= PIPE_MAX_ATTRIBS); - - for (i = 0; i < count; i++) { - struct brw_vertex_element_state el; - memset(&el, 0, sizeof(el)); - - el.ve0.src_offset = elements[i].src_offset; - el.ve0.src_format = brw_translate_surface_format(elements[i].src_format); - el.ve0.valid = 1; - el.ve0.vertex_buffer_index = elements[i].vertex_buffer_index; - - el.ve1.dst_offset = i * 4; - - el.ve1.vfcomponent3 = BRW_VFCOMPONENT_STORE_SRC; - el.ve1.vfcomponent2 = BRW_VFCOMPONENT_STORE_SRC; - el.ve1.vfcomponent1 = BRW_VFCOMPONENT_STORE_SRC; - el.ve1.vfcomponent0 = BRW_VFCOMPONENT_STORE_SRC; - - switch (elements[i].nr_components) { - case 1: el.ve1.vfcomponent1 = BRW_VFCOMPONENT_STORE_0; - case 2: el.ve1.vfcomponent2 = BRW_VFCOMPONENT_STORE_0; - case 3: el.ve1.vfcomponent3 = BRW_VFCOMPONENT_STORE_1_FLT; - break; - } - - brw->vb.inputs[i] = el; - } -} - - - -/************************************************************************ - * Constant buffers - */ - -static void brw_set_constant_buffer(struct pipe_context *pipe, - uint shader, uint index, - const struct pipe_constant_buffer *buf) -{ - struct brw_context *brw = brw_context(pipe); - - assert(buf == 0 || index == 0); - - brw->attribs.Constants[shader] = buf; - brw->state.dirty.brw |= BRW_NEW_CONSTANTS; -} - - -/************************************************************************ - * Texture surfaces - */ - - -static void brw_set_sampler_textures(struct pipe_context *pipe, - unsigned num, - struct pipe_texture **texture) -{ - struct brw_context *brw = brw_context(pipe); - uint i; - - assert(num <= PIPE_MAX_SAMPLERS); - - /* Check for no-op */ - if (num == brw->num_textures && - !memcmp(brw->attribs.Texture, texture, num * - sizeof(struct pipe_texture *))) - return; - - for (i = 0; i < num; i++) - pipe_texture_reference((struct pipe_texture **) &brw->attribs.Texture[i], - texture[i]); - - for (i = num; i < brw->num_textures; i++) - pipe_texture_reference((struct pipe_texture **) &brw->attribs.Texture[i], - NULL); - - brw->num_textures = num; - - brw->state.dirty.brw |= BRW_NEW_TEXTURE; -} - - -/************************************************************************ - * Render targets, etc - */ - -static void brw_set_framebuffer_state(struct pipe_context *pipe, - const struct pipe_framebuffer_state *fb) -{ - struct brw_context *brw = brw_context(pipe); - - brw->attribs.FrameBuffer = *fb; /* struct copy */ - - brw->state.dirty.brw |= BRW_NEW_FRAMEBUFFER; -} - - - -/************************************************************************ - * Rasterizer state - */ - -static void * -brw_create_rasterizer_state(struct pipe_context *pipe, - const struct pipe_rasterizer_state *rasterizer) -{ - DUP(pipe_rasterizer_state, rasterizer); -} - -static void brw_bind_rasterizer_state( struct pipe_context *pipe, - void *setup ) -{ - struct brw_context *brw = brw_context(pipe); - - brw->attribs.Raster = (struct pipe_rasterizer_state *)setup; - - /* Also pass-through to draw module: - */ - //draw_set_rasterizer_state(brw->draw, setup); - - brw->state.dirty.brw |= BRW_NEW_RASTERIZER; -} - -static void brw_delete_rasterizer_state(struct pipe_context *pipe, - void *setup) -{ - free(setup); -} - - - -void -brw_init_state_functions( struct brw_context *brw ) -{ - brw->pipe.create_blend_state = brw_create_blend_state; - brw->pipe.bind_blend_state = brw_bind_blend_state; - brw->pipe.delete_blend_state = brw_delete_blend_state; - - brw->pipe.create_sampler_state = brw_create_sampler_state; - brw->pipe.bind_sampler_states = brw_bind_sampler_states; - brw->pipe.delete_sampler_state = brw_delete_sampler_state; - - brw->pipe.create_depth_stencil_alpha_state = brw_create_depth_stencil_state; - brw->pipe.bind_depth_stencil_alpha_state = brw_bind_depth_stencil_state; - brw->pipe.delete_depth_stencil_alpha_state = brw_delete_depth_stencil_state; - - brw->pipe.create_rasterizer_state = brw_create_rasterizer_state; - brw->pipe.bind_rasterizer_state = brw_bind_rasterizer_state; - brw->pipe.delete_rasterizer_state = brw_delete_rasterizer_state; - brw->pipe.create_fs_state = brw_create_fs_state; - brw->pipe.bind_fs_state = brw_bind_fs_state; - brw->pipe.delete_fs_state = brw_delete_fs_state; - brw->pipe.create_vs_state = brw_create_vs_state; - brw->pipe.bind_vs_state = brw_bind_vs_state; - brw->pipe.delete_vs_state = brw_delete_vs_state; - - brw->pipe.set_blend_color = brw_set_blend_color; - brw->pipe.set_clip_state = brw_set_clip_state; - brw->pipe.set_constant_buffer = brw_set_constant_buffer; - brw->pipe.set_framebuffer_state = brw_set_framebuffer_state; - -// brw->pipe.set_feedback_state = brw_set_feedback_state; -// brw->pipe.set_feedback_buffer = brw_set_feedback_buffer; - - brw->pipe.set_polygon_stipple = brw_set_polygon_stipple; - brw->pipe.set_scissor_state = brw_set_scissor_state; - brw->pipe.set_sampler_textures = brw_set_sampler_textures; - brw->pipe.set_viewport_state = brw_set_viewport_state; - brw->pipe.set_vertex_buffers = brw_set_vertex_buffers; - brw->pipe.set_vertex_elements = brw_set_vertex_elements; -} diff --git a/src/gallium/drivers/i965simple/brw_state.h b/src/gallium/drivers/i965simple/brw_state.h deleted file mode 100644 index de0a6371b8..0000000000 --- a/src/gallium/drivers/i965simple/brw_state.h +++ /dev/null @@ -1,151 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#ifndef BRW_STATE_H -#define BRW_STATE_H - -#include "brw_context.h" -#include "brw_winsys.h" - - -const struct brw_tracked_state brw_blend_constant_color; -const struct brw_tracked_state brw_cc_unit; -const struct brw_tracked_state brw_cc_vp; -const struct brw_tracked_state brw_clip_prog; -const struct brw_tracked_state brw_clip_unit; -const struct brw_tracked_state brw_constant_buffer_state; -const struct brw_tracked_state brw_constant_buffer; -const struct brw_tracked_state brw_curbe_offsets; -const struct brw_tracked_state brw_invarient_state; -const struct brw_tracked_state brw_gs_prog; -const struct brw_tracked_state brw_gs_unit; -const struct brw_tracked_state brw_drawing_rect; -const struct brw_tracked_state brw_line_stipple; -const struct brw_tracked_state brw_pipelined_state_pointers; -const struct brw_tracked_state brw_binding_table_pointers; -const struct brw_tracked_state brw_depthbuffer; -const struct brw_tracked_state brw_polygon_stipple_offset; -const struct brw_tracked_state brw_polygon_stipple; -const struct brw_tracked_state brw_program_parameters; -const struct brw_tracked_state brw_recalculate_urb_fence; -const struct brw_tracked_state brw_sf_prog; -const struct brw_tracked_state brw_sf_unit; -const struct brw_tracked_state brw_sf_vp; -const struct brw_tracked_state brw_state_base_address; -const struct brw_tracked_state brw_urb_fence; -const struct brw_tracked_state brw_vertex_state; -const struct brw_tracked_state brw_vs_prog; -const struct brw_tracked_state brw_vs_unit; -const struct brw_tracked_state brw_wm_prog; -const struct brw_tracked_state brw_wm_samplers; -const struct brw_tracked_state brw_wm_surfaces; -const struct brw_tracked_state brw_wm_unit; - -const struct brw_tracked_state brw_psp_urb_cbs; - -const struct brw_tracked_state brw_active_vertprog; -const struct brw_tracked_state brw_tnl_vertprog; -const struct brw_tracked_state brw_pipe_control; - -const struct brw_tracked_state brw_clear_surface_cache; -const struct brw_tracked_state brw_clear_batch_cache; - -/*********************************************************************** - * brw_state_cache.c - */ -unsigned brw_cache_data(struct brw_cache *cache, - const void *data ); - -unsigned brw_cache_data_sz(struct brw_cache *cache, - const void *data, - unsigned data_sz); - -unsigned brw_upload_cache( struct brw_cache *cache, - const void *key, - unsigned key_sz, - const void *data, - unsigned data_sz, - const void *aux, - void *aux_return ); - -boolean brw_search_cache( struct brw_cache *cache, - const void *key, - unsigned key_size, - void *aux_return, - unsigned *offset_return); - -void brw_init_caches( struct brw_context *brw ); -void brw_destroy_caches( struct brw_context *brw ); - -static inline struct pipe_buffer *brw_cache_buffer(struct brw_context *brw, - enum brw_cache_id id) -{ - return brw->cache[id].pool->buffer; -} - -/*********************************************************************** - * brw_state_batch.c - */ -#define BRW_CACHED_BATCH_STRUCT(brw, s) brw_cached_batch_struct( brw, (s), sizeof(*(s)) ) - -boolean brw_cached_batch_struct( struct brw_context *brw, - const void *data, - unsigned sz ); - -void brw_destroy_batch_cache( struct brw_context *brw ); - - -/*********************************************************************** - * brw_state_pool.c - */ -void brw_init_pools( struct brw_context *brw ); -void brw_destroy_pools( struct brw_context *brw ); - -boolean brw_pool_alloc( struct brw_mem_pool *pool, - unsigned size, - unsigned alignment, - unsigned *offset_return); - -void brw_pool_fence( struct brw_context *brw, - struct brw_mem_pool *pool, - unsigned fence ); - - -void brw_pool_check_wrap( struct brw_context *brw, - struct brw_mem_pool *pool ); - -void brw_clear_all_caches( struct brw_context *brw ); -void brw_invalidate_pools( struct brw_context *brw ); -void brw_clear_batch_cache_flush( struct brw_context *brw ); - - -#endif diff --git a/src/gallium/drivers/i965simple/brw_state_batch.c b/src/gallium/drivers/i965simple/brw_state_batch.c deleted file mode 100644 index 43a1c89fc4..0000000000 --- a/src/gallium/drivers/i965simple/brw_state_batch.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - -#include "brw_state.h" -#include "brw_winsys.h" - -#include "util/u_memory.h" - -/* A facility similar to the data caching code above, which aims to - * prevent identical commands being issued repeatedly. - */ -boolean brw_cached_batch_struct( struct brw_context *brw, - const void *data, - unsigned sz ) -{ - struct brw_cached_batch_item *item = brw->cached_batch_items; - struct header *newheader = (struct header *)data; - - if (brw->emit_state_always) { - brw_batchbuffer_data(brw->winsys, data, sz); - return TRUE; - } - - while (item) { - if (item->header->opcode == newheader->opcode) { - if (item->sz == sz && memcmp(item->header, newheader, sz) == 0) - return FALSE; - if (item->sz != sz) { - FREE(item->header); - item->header = MALLOC(sz); - item->sz = sz; - } - goto emit; - } - item = item->next; - } - - assert(!item); - item = CALLOC_STRUCT(brw_cached_batch_item); - item->header = MALLOC(sz); - item->sz = sz; - item->next = brw->cached_batch_items; - brw->cached_batch_items = item; - -emit: - memcpy(item->header, newheader, sz); - brw_batchbuffer_data(brw->winsys, data, sz); - return TRUE; -} - -static void clear_batch_cache( struct brw_context *brw ) -{ - struct brw_cached_batch_item *item = brw->cached_batch_items; - - while (item) { - struct brw_cached_batch_item *next = item->next; - free((void *)item->header); - free(item); - item = next; - } - - brw->cached_batch_items = NULL; - - - brw_clear_all_caches(brw); - - brw_invalidate_pools(brw); -} - -void brw_clear_batch_cache_flush( struct brw_context *brw ) -{ - clear_batch_cache(brw); - -/* brw_do_flush(brw, BRW_FLUSH_STATE_CACHE|BRW_FLUSH_READ_CACHE); */ - - brw->state.dirty.brw |= ~0; - brw->state.dirty.cache |= ~0; -} - - - -void brw_destroy_batch_cache( struct brw_context *brw ) -{ - clear_batch_cache(brw); -} diff --git a/src/gallium/drivers/i965simple/brw_state_cache.c b/src/gallium/drivers/i965simple/brw_state_cache.c deleted file mode 100644 index 094248fa69..0000000000 --- a/src/gallium/drivers/i965simple/brw_state_cache.c +++ /dev/null @@ -1,443 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#include "brw_state.h" - -#include "brw_wm.h" -#include "brw_vs.h" -#include "brw_clip.h" -#include "brw_sf.h" -#include "brw_gs.h" - -#include "util/u_memory.h" - - - -/*********************************************************************** - * Check cache for uploaded version of struct, else upload new one. - * Fail when memory is exhausted. - * - * XXX: FIXME: Currently search is so slow it would be quicker to - * regenerate the data every time... - */ - -static unsigned hash_key( const void *key, unsigned key_size ) -{ - unsigned *ikey = (unsigned *)key; - unsigned hash = 0, i; - - assert(key_size % 4 == 0); - - /* I'm sure this can be improved on: - */ - for (i = 0; i < key_size/4; i++) - hash ^= ikey[i]; - - return hash; -} - -static struct brw_cache_item *search_cache( struct brw_cache *cache, - unsigned hash, - const void *key, - unsigned key_size) -{ - struct brw_cache_item *c; - - for (c = cache->items[hash % cache->size]; c; c = c->next) { - if (c->hash == hash && - c->key_size == key_size && - memcmp(c->key, key, key_size) == 0) - return c; - } - - return NULL; -} - - -static void rehash( struct brw_cache *cache ) -{ - struct brw_cache_item **items; - struct brw_cache_item *c, *next; - unsigned size, i; - - size = cache->size * 3; - items = (struct brw_cache_item**) MALLOC(size * sizeof(*items)); - memset(items, 0, size * sizeof(*items)); - - for (i = 0; i < cache->size; i++) - for (c = cache->items[i]; c; c = next) { - next = c->next; - c->next = items[c->hash % size]; - items[c->hash % size] = c; - } - - FREE(cache->items); - cache->items = items; - cache->size = size; -} - - -boolean brw_search_cache( struct brw_cache *cache, - const void *key, - unsigned key_size, - void *aux_return, - unsigned *offset_return) -{ - struct brw_cache_item *item; - unsigned addr = 0; - unsigned hash = hash_key(key, key_size); - - item = search_cache(cache, hash, key, key_size); - - if (item) { - if (aux_return) - *(void **)aux_return = (void *)((char *)item->key + item->key_size); - - *offset_return = addr = item->offset; - } - - if (item == NULL || addr != cache->last_addr) { - cache->brw->state.dirty.cache |= 1<id; - cache->last_addr = addr; - } - - return item != NULL; -} - -unsigned brw_upload_cache( struct brw_cache *cache, - const void *key, - unsigned key_size, - const void *data, - unsigned data_size, - const void *aux, - void *aux_return ) -{ - unsigned offset; - struct brw_cache_item *item = CALLOC_STRUCT(brw_cache_item); - unsigned hash = hash_key(key, key_size); - void *tmp = MALLOC(key_size + cache->aux_size); - - if (!brw_pool_alloc(cache->pool, data_size, 1 << 6, &offset)) { - /* Should not be possible: - */ - debug_printf("brw_pool_alloc failed\n"); - exit(1); - } - - memcpy(tmp, key, key_size); - - if (cache->aux_size) - memcpy(tmp+key_size, aux, cache->aux_size); - - item->key = tmp; - item->hash = hash; - item->key_size = key_size; - item->offset = offset; - item->data_size = data_size; - - if (++cache->n_items > cache->size * 1.5) - rehash(cache); - - hash %= cache->size; - item->next = cache->items[hash]; - cache->items[hash] = item; - - if (aux_return) { - assert(cache->aux_size); - *(void **)aux_return = (void *)((char *)item->key + item->key_size); - } - - if (BRW_DEBUG & DEBUG_STATE) - debug_printf("upload %s: %d bytes to pool buffer %p offset %x\n", - cache->name, - data_size, - (void*)cache->pool->buffer, - offset); - - /* Copy data to the buffer: - */ - cache->brw->winsys->buffer_subdata_typed(cache->brw->winsys, - cache->pool->buffer, - offset, - data_size, - data, - cache->id); - - cache->brw->state.dirty.cache |= 1<id; - cache->last_addr = offset; - - return offset; -} - -/* This doesn't really work with aux data. Use search/upload instead - */ -unsigned brw_cache_data_sz(struct brw_cache *cache, - const void *data, - unsigned data_size) -{ - unsigned addr; - - if (!brw_search_cache(cache, data, data_size, NULL, &addr)) { - addr = brw_upload_cache(cache, - data, data_size, - data, data_size, - NULL, NULL); - } - - return addr; -} - -unsigned brw_cache_data(struct brw_cache *cache, - const void *data) -{ - return brw_cache_data_sz(cache, data, cache->key_size); -} - -enum pool_type { - DW_SURFACE_STATE, - DW_GENERAL_STATE -}; - -static void brw_init_cache( struct brw_context *brw, - const char *name, - unsigned id, - unsigned key_size, - unsigned aux_size, - enum pool_type pool_type) -{ - struct brw_cache *cache = &brw->cache[id]; - cache->brw = brw; - cache->id = id; - cache->name = name; - cache->items = NULL; - - cache->size = 7; - cache->n_items = 0; - cache->items = (struct brw_cache_item **) - CALLOC(cache->size, sizeof(struct brw_cache_item)); - - - cache->key_size = key_size; - cache->aux_size = aux_size; - switch (pool_type) { - case DW_GENERAL_STATE: cache->pool = &brw->pool[BRW_GS_POOL]; break; - case DW_SURFACE_STATE: cache->pool = &brw->pool[BRW_SS_POOL]; break; - default: assert(0); break; - } -} - -void brw_init_caches( struct brw_context *brw ) -{ - - brw_init_cache(brw, - "CC_VP", - BRW_CC_VP, - sizeof(struct brw_cc_viewport), - 0, - DW_GENERAL_STATE); - - brw_init_cache(brw, - "CC_UNIT", - BRW_CC_UNIT, - sizeof(struct brw_cc_unit_state), - 0, - DW_GENERAL_STATE); - - brw_init_cache(brw, - "WM_PROG", - BRW_WM_PROG, - sizeof(struct brw_wm_prog_key), - sizeof(struct brw_wm_prog_data), - DW_GENERAL_STATE); - - brw_init_cache(brw, - "SAMPLER_DEFAULT_COLOR", - BRW_SAMPLER_DEFAULT_COLOR, - sizeof(struct brw_sampler_default_color), - 0, - DW_GENERAL_STATE); - - brw_init_cache(brw, - "SAMPLER", - BRW_SAMPLER, - 0, /* variable key/data size */ - 0, - DW_GENERAL_STATE); - - brw_init_cache(brw, - "WM_UNIT", - BRW_WM_UNIT, - sizeof(struct brw_wm_unit_state), - 0, - DW_GENERAL_STATE); - - brw_init_cache(brw, - "SF_PROG", - BRW_SF_PROG, - sizeof(struct brw_sf_prog_key), - sizeof(struct brw_sf_prog_data), - DW_GENERAL_STATE); - - brw_init_cache(brw, - "SF_VP", - BRW_SF_VP, - sizeof(struct brw_sf_viewport), - 0, - DW_GENERAL_STATE); - - brw_init_cache(brw, - "SF_UNIT", - BRW_SF_UNIT, - sizeof(struct brw_sf_unit_state), - 0, - DW_GENERAL_STATE); - - brw_init_cache(brw, - "VS_UNIT", - BRW_VS_UNIT, - sizeof(struct brw_vs_unit_state), - 0, - DW_GENERAL_STATE); - - brw_init_cache(brw, - "VS_PROG", - BRW_VS_PROG, - sizeof(struct brw_vs_prog_key), - sizeof(struct brw_vs_prog_data), - DW_GENERAL_STATE); - - brw_init_cache(brw, - "CLIP_UNIT", - BRW_CLIP_UNIT, - sizeof(struct brw_clip_unit_state), - 0, - DW_GENERAL_STATE); - - brw_init_cache(brw, - "CLIP_PROG", - BRW_CLIP_PROG, - sizeof(struct brw_clip_prog_key), - sizeof(struct brw_clip_prog_data), - DW_GENERAL_STATE); - - brw_init_cache(brw, - "GS_UNIT", - BRW_GS_UNIT, - sizeof(struct brw_gs_unit_state), - 0, - DW_GENERAL_STATE); - - brw_init_cache(brw, - "GS_PROG", - BRW_GS_PROG, - sizeof(struct brw_gs_prog_key), - sizeof(struct brw_gs_prog_data), - DW_GENERAL_STATE); - - brw_init_cache(brw, - "SS_SURFACE", - BRW_SS_SURFACE, - sizeof(struct brw_surface_state), - 0, - DW_SURFACE_STATE); - - brw_init_cache(brw, - "SS_SURF_BIND", - BRW_SS_SURF_BIND, - sizeof(struct brw_surface_binding_table), - 0, - DW_SURFACE_STATE); -} - - -/* When we lose hardware context, need to invalidate the surface cache - * as these structs must be explicitly re-uploaded. They are subject - * to fixup by the memory manager as they contain absolute agp - * offsets, so we need to ensure there is a fresh version of the - * struct available to receive the fixup. - * - * XXX: Need to ensure that there aren't two versions of a surface or - * bufferobj with different backing data active in the same buffer at - * once? Otherwise the cache could confuse them. Maybe better not to - * cache at all? - * - * --> Isn't this the same as saying need to ensure batch is flushed - * before new data is uploaded to an existing buffer? We - * already try to make sure of that. - */ -static void clear_cache( struct brw_cache *cache ) -{ - struct brw_cache_item *c, *next; - unsigned i; - - for (i = 0; i < cache->size; i++) { - for (c = cache->items[i]; c; c = next) { - next = c->next; - free((void *)c->key); - free(c); - } - cache->items[i] = NULL; - } - - cache->n_items = 0; -} - -void brw_clear_all_caches( struct brw_context *brw ) -{ - int i; - - if (BRW_DEBUG & DEBUG_STATE) - debug_printf("%s\n", __FUNCTION__); - - for (i = 0; i < BRW_MAX_CACHE; i++) - clear_cache(&brw->cache[i]); - - if (brw->curbe.last_buf) { - FREE(brw->curbe.last_buf); - brw->curbe.last_buf = NULL; - } - - brw->state.dirty.brw |= ~0; - brw->state.dirty.cache |= ~0; -} - - - - - -void brw_destroy_caches( struct brw_context *brw ) -{ - unsigned i; - - for (i = 0; i < BRW_MAX_CACHE; i++) - clear_cache(&brw->cache[i]); -} diff --git a/src/gallium/drivers/i965simple/brw_state_pool.c b/src/gallium/drivers/i965simple/brw_state_pool.c deleted file mode 100644 index e91263cb1f..0000000000 --- a/src/gallium/drivers/i965simple/brw_state_pool.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - -/** @file brw_state_pool.c - * Implements the state pool allocator. - * - * For the 965, we create two state pools for state cache entries. Objects - * will be allocated into the pools depending on which state base address - * their pointer is relative to in other 965 state. - * - * The state pools are relatively simple: As objects are allocated, increment - * the offset to allocate space. When the pool is "full" (rather, close to - * full), we reset the pool and reset the state cache entries that point into - * the pool. - */ - -#include "pipe/internal/p_winsys_screen.h" -#include "util/u_math.h" -#include "util/u_memory.h" -#include "pipe/p_inlines.h" -#include "brw_context.h" -#include "brw_state.h" - -boolean brw_pool_alloc( struct brw_mem_pool *pool, - unsigned size, - unsigned alignment, - unsigned *offset_return) -{ - unsigned fixup = align(pool->offset, alignment) - pool->offset; - - size = align(size, 4); - - if (pool->offset + fixup + size >= pool->size) { - debug_printf("%s failed\n", __FUNCTION__); - assert(0); - exit(0); - } - - pool->offset += fixup; - *offset_return = pool->offset; - pool->offset += size; - - return TRUE; -} - -static -void brw_invalidate_pool( struct brw_mem_pool *pool ) -{ - if (BRW_DEBUG & DEBUG_STATE) - debug_printf("\n\n\n %s \n\n\n", __FUNCTION__); - - pool->offset = 0; - - brw_clear_all_caches(pool->brw); -} - - -static void brw_init_pool( struct brw_context *brw, - unsigned pool_id, - unsigned size ) -{ - struct brw_mem_pool *pool = &brw->pool[pool_id]; - - pool->size = size; - pool->brw = brw; - - pool->buffer = pipe_buffer_create(brw->pipe.screen, - 4096, - 0 /* DRM_BO_FLAG_MEM_TT */, - size); -} - -static void brw_destroy_pool( struct brw_context *brw, - unsigned pool_id ) -{ - struct brw_mem_pool *pool = &brw->pool[pool_id]; - - pipe_buffer_reference( pool->brw->pipe.screen, - &pool->buffer, - NULL ); -} - - -void brw_pool_check_wrap( struct brw_context *brw, - struct brw_mem_pool *pool ) -{ - if (pool->offset > (pool->size * 3) / 4) { - brw->state.dirty.brw |= BRW_NEW_SCENE; - } - -} - -void brw_init_pools( struct brw_context *brw ) -{ - brw_init_pool(brw, BRW_GS_POOL, 0x80000); - brw_init_pool(brw, BRW_SS_POOL, 0x80000); -} - -void brw_destroy_pools( struct brw_context *brw ) -{ - brw_destroy_pool(brw, BRW_GS_POOL); - brw_destroy_pool(brw, BRW_SS_POOL); -} - - -void brw_invalidate_pools( struct brw_context *brw ) -{ - brw_invalidate_pool(&brw->pool[BRW_GS_POOL]); - brw_invalidate_pool(&brw->pool[BRW_SS_POOL]); -} diff --git a/src/gallium/drivers/i965simple/brw_state_upload.c b/src/gallium/drivers/i965simple/brw_state_upload.c deleted file mode 100644 index bac9161b5f..0000000000 --- a/src/gallium/drivers/i965simple/brw_state_upload.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#include "brw_context.h" -#include "brw_state.h" - -#include "util/u_memory.h" - -/* This is used to initialize brw->state.atoms[]. We could use this - * list directly except for a single atom, brw_constant_buffer, which - * has a .dirty value which changes according to the parameters of the - * current fragment and vertex programs, and so cannot be a static - * value. - */ -const struct brw_tracked_state *atoms[] = -{ - &brw_vs_prog, - &brw_gs_prog, - &brw_clip_prog, - &brw_sf_prog, - &brw_wm_prog, - - /* Once all the programs are done, we know how large urb entry - * sizes need to be and can decide if we need to change the urb - * layout. - */ - &brw_curbe_offsets, - &brw_recalculate_urb_fence, - - - &brw_cc_vp, - &brw_cc_unit, - - &brw_wm_surfaces, /* must do before samplers */ - &brw_wm_samplers, - - &brw_wm_unit, - &brw_sf_vp, - &brw_sf_unit, - &brw_vs_unit, /* always required, enabled or not */ - &brw_clip_unit, - &brw_gs_unit, - - /* Command packets: - */ - &brw_invarient_state, - &brw_state_base_address, - &brw_pipe_control, - - &brw_binding_table_pointers, - &brw_blend_constant_color, - - &brw_drawing_rect, - &brw_depthbuffer, - - &brw_polygon_stipple, - &brw_line_stipple, - - &brw_psp_urb_cbs, - - &brw_constant_buffer -}; - - -void brw_init_state( struct brw_context *brw ) -{ - brw_init_pools(brw); - brw_init_caches(brw); - - brw->state.dirty.brw = ~0; - brw->emit_state_always = 0; -} - - -void brw_destroy_state( struct brw_context *brw ) -{ - brw_destroy_caches(brw); - brw_destroy_batch_cache(brw); - brw_destroy_pools(brw); -} - -/*********************************************************************** - */ - -static boolean check_state( const struct brw_state_flags *a, - const struct brw_state_flags *b ) -{ - return ((a->brw & b->brw) || - (a->cache & b->cache)); -} - -static void accumulate_state( struct brw_state_flags *a, - const struct brw_state_flags *b ) -{ - a->brw |= b->brw; - a->cache |= b->cache; -} - - -static void xor_states( struct brw_state_flags *result, - const struct brw_state_flags *a, - const struct brw_state_flags *b ) -{ - result->brw = a->brw ^ b->brw; - result->cache = a->cache ^ b->cache; -} - - -/*********************************************************************** - * Emit all state: - */ -void brw_validate_state( struct brw_context *brw ) -{ - struct brw_state_flags *state = &brw->state.dirty; - unsigned i; - - if (brw->emit_state_always) - state->brw |= ~0; - - if (state->cache == 0 && - state->brw == 0) - return; - - if (brw->state.dirty.brw & BRW_NEW_SCENE) - brw_clear_batch_cache_flush(brw); - - if (BRW_DEBUG) { - /* Debug version which enforces various sanity checks on the - * state flags which are generated and checked to help ensure - * state atoms are ordered correctly in the list. - */ - struct brw_state_flags examined, prev; - memset(&examined, 0, sizeof(examined)); - prev = *state; - - for (i = 0; i < Elements(atoms); i++) { - const struct brw_tracked_state *atom = atoms[i]; - struct brw_state_flags generated; - - assert(atom->dirty.brw || - atom->dirty.cache); - assert(atom->update); - - if (check_state(state, &atom->dirty)) { - atom->update( brw ); - } - - accumulate_state(&examined, &atom->dirty); - - /* generated = (prev ^ state) - * if (examined & generated) - * fail; - */ - xor_states(&generated, &prev, state); - assert(!check_state(&examined, &generated)); - prev = *state; - } - } - else { - for (i = 0; i < Elements(atoms); i++) { - const struct brw_tracked_state *atom = atoms[i]; - - assert(atom->dirty.brw || - atom->dirty.cache); - assert(atom->update); - - if (check_state(state, &atom->dirty)) - atom->update( brw ); - } - } - - memset(state, 0, sizeof(*state)); -} diff --git a/src/gallium/drivers/i965simple/brw_structs.h b/src/gallium/drivers/i965simple/brw_structs.h deleted file mode 100644 index bbb087e95d..0000000000 --- a/src/gallium/drivers/i965simple/brw_structs.h +++ /dev/null @@ -1,1348 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#ifndef BRW_STRUCTS_H -#define BRW_STRUCTS_H - -#include "pipe/p_compiler.h" - -/* Command packets: - */ -struct header -{ - unsigned length:16; - unsigned opcode:16; -}; - - -union header_union -{ - struct header bits; - unsigned dword; -}; - -struct brw_3d_control -{ - struct - { - unsigned length:8; - unsigned notify_enable:1; - unsigned pad:3; - unsigned wc_flush_enable:1; - unsigned depth_stall_enable:1; - unsigned operation:2; - unsigned opcode:16; - } header; - - struct - { - unsigned pad:2; - unsigned dest_addr_type:1; - unsigned dest_addr:29; - } dest; - - unsigned dword2; - unsigned dword3; -}; - - -struct brw_3d_primitive -{ - struct - { - unsigned length:8; - unsigned pad:2; - unsigned topology:5; - unsigned indexed:1; - unsigned opcode:16; - } header; - - unsigned verts_per_instance; - unsigned start_vert_location; - unsigned instance_count; - unsigned start_instance_location; - unsigned base_vert_location; -}; - -/* These seem to be passed around as function args, so it works out - * better to keep them as #defines: - */ -#define BRW_FLUSH_READ_CACHE 0x1 -#define BRW_FLUSH_STATE_CACHE 0x2 -#define BRW_INHIBIT_FLUSH_RENDER_CACHE 0x4 -#define BRW_FLUSH_SNAPSHOT_COUNTERS 0x8 - -struct brw_mi_flush -{ - unsigned flags:4; - unsigned pad:12; - unsigned opcode:16; -}; - -struct brw_vf_statistics -{ - unsigned statistics_enable:1; - unsigned pad:15; - unsigned opcode:16; -}; - - - -struct brw_binding_table_pointers -{ - struct header header; - unsigned vs; - unsigned gs; - unsigned clp; - unsigned sf; - unsigned wm; -}; - - -struct brw_blend_constant_color -{ - struct header header; - float blend_constant_color[4]; -}; - - -struct brw_depthbuffer -{ - union header_union header; - - union { - struct { - unsigned pitch:18; - unsigned format:3; - unsigned pad:4; - unsigned depth_offset_disable:1; - unsigned tile_walk:1; - unsigned tiled_surface:1; - unsigned pad2:1; - unsigned surface_type:3; - } bits; - unsigned dword; - } dword1; - - unsigned dword2_base_addr; - - union { - struct { - unsigned pad:1; - unsigned mipmap_layout:1; - unsigned lod:4; - unsigned width:13; - unsigned height:13; - } bits; - unsigned dword; - } dword3; - - union { - struct { - unsigned pad:12; - unsigned min_array_element:9; - unsigned depth:11; - } bits; - unsigned dword; - } dword4; -}; - -struct brw_drawrect -{ - struct header header; - unsigned xmin:16; - unsigned ymin:16; - unsigned xmax:16; - unsigned ymax:16; - unsigned xorg:16; - unsigned yorg:16; -}; - - - - -struct brw_global_depth_offset_clamp -{ - struct header header; - float depth_offset_clamp; -}; - -struct brw_indexbuffer -{ - union { - struct - { - unsigned length:8; - unsigned index_format:2; - unsigned cut_index_enable:1; - unsigned pad:5; - unsigned opcode:16; - } bits; - unsigned dword; - - } header; - - unsigned buffer_start; - unsigned buffer_end; -}; - - -struct brw_line_stipple -{ - struct header header; - - struct - { - unsigned pattern:16; - unsigned pad:16; - } bits0; - - struct - { - unsigned repeat_count:9; - unsigned pad:7; - unsigned inverse_repeat_count:16; - } bits1; -}; - - -struct brw_pipelined_state_pointers -{ - struct header header; - - struct { - unsigned pad:5; - unsigned offset:27; - } vs; - - struct - { - unsigned enable:1; - unsigned pad:4; - unsigned offset:27; - } gs; - - struct - { - unsigned enable:1; - unsigned pad:4; - unsigned offset:27; - } clp; - - struct - { - unsigned pad:5; - unsigned offset:27; - } sf; - - struct - { - unsigned pad:5; - unsigned offset:27; - } wm; - - struct - { - unsigned pad:5; - unsigned offset:27; /* KW: check me! */ - } cc; -}; - - -struct brw_polygon_stipple_offset -{ - struct header header; - - struct { - unsigned y_offset:5; - unsigned pad:3; - unsigned x_offset:5; - unsigned pad0:19; - } bits0; -}; - - - -struct brw_polygon_stipple -{ - struct header header; - unsigned stipple[32]; -}; - - - -struct brw_pipeline_select -{ - struct - { - unsigned pipeline_select:1; - unsigned pad:15; - unsigned opcode:16; - } header; -}; - - -struct brw_pipe_control -{ - struct - { - unsigned length:8; - unsigned notify_enable:1; - unsigned pad:2; - unsigned instruction_state_cache_flush_enable:1; - unsigned write_cache_flush_enable:1; - unsigned depth_stall_enable:1; - unsigned post_sync_operation:2; - - unsigned opcode:16; - } header; - - struct - { - unsigned pad:2; - unsigned dest_addr_type:1; - unsigned dest_addr:29; - } bits1; - - unsigned data0; - unsigned data1; -}; - - -struct brw_urb_fence -{ - struct - { - unsigned length:8; - unsigned vs_realloc:1; - unsigned gs_realloc:1; - unsigned clp_realloc:1; - unsigned sf_realloc:1; - unsigned vfe_realloc:1; - unsigned cs_realloc:1; - unsigned pad:2; - unsigned opcode:16; - } header; - - struct - { - unsigned vs_fence:10; - unsigned gs_fence:10; - unsigned clp_fence:10; - unsigned pad:2; - } bits0; - - struct - { - unsigned sf_fence:10; - unsigned vf_fence:10; - unsigned cs_fence:10; - unsigned pad:2; - } bits1; -}; - -struct brw_constant_buffer_state /* previously brw_command_streamer */ -{ - struct header header; - - struct - { - unsigned nr_urb_entries:3; - unsigned pad:1; - unsigned urb_entry_size:5; - unsigned pad0:23; - } bits0; -}; - -struct brw_constant_buffer -{ - struct - { - unsigned length:8; - unsigned valid:1; - unsigned pad:7; - unsigned opcode:16; - } header; - - struct - { - unsigned buffer_length:6; - unsigned buffer_address:26; - } bits0; -}; - -struct brw_state_base_address -{ - struct header header; - - struct - { - unsigned modify_enable:1; - unsigned pad:4; - unsigned general_state_address:27; - } bits0; - - struct - { - unsigned modify_enable:1; - unsigned pad:4; - unsigned surface_state_address:27; - } bits1; - - struct - { - unsigned modify_enable:1; - unsigned pad:4; - unsigned indirect_object_state_address:27; - } bits2; - - struct - { - unsigned modify_enable:1; - unsigned pad:11; - unsigned general_state_upper_bound:20; - } bits3; - - struct - { - unsigned modify_enable:1; - unsigned pad:11; - unsigned indirect_object_state_upper_bound:20; - } bits4; -}; - -struct brw_state_prefetch -{ - struct header header; - - struct - { - unsigned prefetch_count:3; - unsigned pad:3; - unsigned prefetch_pointer:26; - } bits0; -}; - -struct brw_system_instruction_pointer -{ - struct header header; - - struct - { - unsigned pad:4; - unsigned system_instruction_pointer:28; - } bits0; -}; - - - - -/* State structs for the various fixed function units: - */ - - -struct thread0 -{ - unsigned pad0:1; - unsigned grf_reg_count:3; - unsigned pad1:2; - unsigned kernel_start_pointer:26; -}; - -struct thread1 -{ - unsigned ext_halt_exception_enable:1; - unsigned sw_exception_enable:1; - unsigned mask_stack_exception_enable:1; - unsigned timeout_exception_enable:1; - unsigned illegal_op_exception_enable:1; - unsigned pad0:3; - unsigned depth_coef_urb_read_offset:6; /* WM only */ - unsigned pad1:2; - unsigned floating_point_mode:1; - unsigned thread_priority:1; - unsigned binding_table_entry_count:8; - unsigned pad3:5; - unsigned single_program_flow:1; -}; - -struct thread2 -{ - unsigned per_thread_scratch_space:4; - unsigned pad0:6; - unsigned scratch_space_base_pointer:22; -}; - - -struct thread3 -{ - unsigned dispatch_grf_start_reg:4; - unsigned urb_entry_read_offset:6; - unsigned pad0:1; - unsigned urb_entry_read_length:6; - unsigned pad1:1; - unsigned const_urb_entry_read_offset:6; - unsigned pad2:1; - unsigned const_urb_entry_read_length:6; - unsigned pad3:1; -}; - - - -struct brw_clip_unit_state -{ - struct thread0 thread0; - struct - { - unsigned pad0:7; - unsigned sw_exception_enable:1; - unsigned pad1:3; - unsigned mask_stack_exception_enable:1; - unsigned pad2:1; - unsigned illegal_op_exception_enable:1; - unsigned pad3:2; - unsigned floating_point_mode:1; - unsigned thread_priority:1; - unsigned binding_table_entry_count:8; - unsigned pad4:5; - unsigned single_program_flow:1; - } thread1; - - struct thread2 thread2; - struct thread3 thread3; - - struct - { - unsigned pad0:9; - unsigned gs_output_stats:1; /* not always */ - unsigned stats_enable:1; - unsigned nr_urb_entries:7; - unsigned pad1:1; - unsigned urb_entry_allocation_size:5; - unsigned pad2:1; - unsigned max_threads:1; /* may be less */ - unsigned pad3:6; - } thread4; - - struct - { - unsigned pad0:13; - unsigned clip_mode:3; - unsigned userclip_enable_flags:8; - unsigned userclip_must_clip:1; - unsigned pad1:1; - unsigned guard_band_enable:1; - unsigned viewport_z_clip_enable:1; - unsigned viewport_xy_clip_enable:1; - unsigned vertex_position_space:1; - unsigned api_mode:1; - unsigned pad2:1; - } clip5; - - struct - { - unsigned pad0:5; - unsigned clipper_viewport_state_ptr:27; - } clip6; - - - float viewport_xmin; - float viewport_xmax; - float viewport_ymin; - float viewport_ymax; -}; - - - -struct brw_cc_unit_state -{ - struct - { - unsigned pad0:3; - unsigned bf_stencil_pass_depth_pass_op:3; - unsigned bf_stencil_pass_depth_fail_op:3; - unsigned bf_stencil_fail_op:3; - unsigned bf_stencil_func:3; - unsigned bf_stencil_enable:1; - unsigned pad1:2; - unsigned stencil_write_enable:1; - unsigned stencil_pass_depth_pass_op:3; - unsigned stencil_pass_depth_fail_op:3; - unsigned stencil_fail_op:3; - unsigned stencil_func:3; - unsigned stencil_enable:1; - } cc0; - - - struct - { - unsigned bf_stencil_ref:8; - unsigned stencil_write_mask:8; - unsigned stencil_test_mask:8; - unsigned stencil_ref:8; - } cc1; - - - struct - { - unsigned logicop_enable:1; - unsigned pad0:10; - unsigned depth_write_enable:1; - unsigned depth_test_function:3; - unsigned depth_test:1; - unsigned bf_stencil_write_mask:8; - unsigned bf_stencil_test_mask:8; - } cc2; - - - struct - { - unsigned pad0:8; - unsigned alpha_test_func:3; - unsigned alpha_test:1; - unsigned blend_enable:1; - unsigned ia_blend_enable:1; - unsigned pad1:1; - unsigned alpha_test_format:1; - unsigned pad2:16; - } cc3; - - struct - { - unsigned pad0:5; - unsigned cc_viewport_state_offset:27; - } cc4; - - struct - { - unsigned pad0:2; - unsigned ia_dest_blend_factor:5; - unsigned ia_src_blend_factor:5; - unsigned ia_blend_function:3; - unsigned statistics_enable:1; - unsigned logicop_func:4; - unsigned pad1:11; - unsigned dither_enable:1; - } cc5; - - struct - { - unsigned clamp_post_alpha_blend:1; - unsigned clamp_pre_alpha_blend:1; - unsigned clamp_range:2; - unsigned pad0:11; - unsigned y_dither_offset:2; - unsigned x_dither_offset:2; - unsigned dest_blend_factor:5; - unsigned src_blend_factor:5; - unsigned blend_function:3; - } cc6; - - struct { - union { - float f; - ubyte ub[4]; - } alpha_ref; - } cc7; -}; - - - -struct brw_sf_unit_state -{ - struct thread0 thread0; - struct thread1 thread1; - struct thread2 thread2; - struct thread3 thread3; - - struct - { - unsigned pad0:10; - unsigned stats_enable:1; - unsigned nr_urb_entries:7; - unsigned pad1:1; - unsigned urb_entry_allocation_size:5; - unsigned pad2:1; - unsigned max_threads:6; - unsigned pad3:1; - } thread4; - - struct - { - unsigned front_winding:1; - unsigned viewport_transform:1; - unsigned pad0:3; - unsigned sf_viewport_state_offset:27; - } sf5; - - struct - { - unsigned pad0:9; - unsigned dest_org_vbias:4; - unsigned dest_org_hbias:4; - unsigned scissor:1; - unsigned disable_2x2_trifilter:1; - unsigned disable_zero_pix_trifilter:1; - unsigned point_rast_rule:2; - unsigned line_endcap_aa_region_width:2; - unsigned line_width:4; - unsigned fast_scissor_disable:1; - unsigned cull_mode:2; - unsigned aa_enable:1; - } sf6; - - struct - { - unsigned point_size:11; - unsigned use_point_size_state:1; - unsigned subpixel_precision:1; - unsigned sprite_point:1; - unsigned pad0:11; - unsigned trifan_pv:2; - unsigned linestrip_pv:2; - unsigned tristrip_pv:2; - unsigned line_last_pixel_enable:1; - } sf7; - -}; - - -struct brw_gs_unit_state -{ - struct thread0 thread0; - struct thread1 thread1; - struct thread2 thread2; - struct thread3 thread3; - - struct - { - unsigned pad0:10; - unsigned stats_enable:1; - unsigned nr_urb_entries:7; - unsigned pad1:1; - unsigned urb_entry_allocation_size:5; - unsigned pad2:1; - unsigned max_threads:1; - unsigned pad3:6; - } thread4; - - struct - { - unsigned sampler_count:3; - unsigned pad0:2; - unsigned sampler_state_pointer:27; - } gs5; - - - struct - { - unsigned max_vp_index:4; - unsigned pad0:26; - unsigned reorder_enable:1; - unsigned pad1:1; - } gs6; -}; - - -struct brw_vs_unit_state -{ - struct thread0 thread0; - struct thread1 thread1; - struct thread2 thread2; - struct thread3 thread3; - - struct - { - unsigned pad0:10; - unsigned stats_enable:1; - unsigned nr_urb_entries:7; - unsigned pad1:1; - unsigned urb_entry_allocation_size:5; - unsigned pad2:1; - unsigned max_threads:4; - unsigned pad3:3; - } thread4; - - struct - { - unsigned sampler_count:3; - unsigned pad0:2; - unsigned sampler_state_pointer:27; - } vs5; - - struct - { - unsigned vs_enable:1; - unsigned vert_cache_disable:1; - unsigned pad0:30; - } vs6; -}; - - -struct brw_wm_unit_state -{ - struct thread0 thread0; - struct thread1 thread1; - struct thread2 thread2; - struct thread3 thread3; - - struct { - unsigned stats_enable:1; - unsigned pad0:1; - unsigned sampler_count:3; - unsigned sampler_state_pointer:27; - } wm4; - - struct - { - unsigned enable_8_pix:1; - unsigned enable_16_pix:1; - unsigned enable_32_pix:1; - unsigned pad0:7; - unsigned legacy_global_depth_bias:1; - unsigned line_stipple:1; - unsigned depth_offset:1; - unsigned polygon_stipple:1; - unsigned line_aa_region_width:2; - unsigned line_endcap_aa_region_width:2; - unsigned early_depth_test:1; - unsigned thread_dispatch_enable:1; - unsigned program_uses_depth:1; - unsigned program_computes_depth:1; - unsigned program_uses_killpixel:1; - unsigned legacy_line_rast: 1; - unsigned pad1:1; - unsigned max_threads:6; - unsigned pad2:1; - } wm5; - - float global_depth_offset_constant; - float global_depth_offset_scale; -}; - -struct brw_sampler_default_color { - float color[4]; -}; - -struct brw_sampler_state -{ - - struct - { - unsigned shadow_function:3; - unsigned lod_bias:11; - unsigned min_filter:3; - unsigned mag_filter:3; - unsigned mip_filter:2; - unsigned base_level:5; - unsigned pad:1; - unsigned lod_preclamp:1; - unsigned default_color_mode:1; - unsigned pad0:1; - unsigned disable:1; - } ss0; - - struct - { - unsigned r_wrap_mode:3; - unsigned t_wrap_mode:3; - unsigned s_wrap_mode:3; - unsigned pad:3; - unsigned max_lod:10; - unsigned min_lod:10; - } ss1; - - - struct - { - unsigned pad:5; - unsigned default_color_pointer:27; - } ss2; - - struct - { - unsigned pad:19; - unsigned max_aniso:3; - unsigned chroma_key_mode:1; - unsigned chroma_key_index:2; - unsigned chroma_key_enable:1; - unsigned monochrome_filter_width:3; - unsigned monochrome_filter_height:3; - } ss3; -}; - - -struct brw_clipper_viewport -{ - float xmin; - float xmax; - float ymin; - float ymax; -}; - -struct brw_cc_viewport -{ - float min_depth; - float max_depth; -}; - -struct brw_sf_viewport -{ - struct { - float m00; - float m11; - float m22; - float m30; - float m31; - float m32; - } viewport; - - struct { - short xmin; - short ymin; - short xmax; - short ymax; - } scissor; -}; - -/* Documented in the subsystem/shared-functions/sampler chapter... - */ -struct brw_surface_state -{ - struct { - unsigned cube_pos_z:1; - unsigned cube_neg_z:1; - unsigned cube_pos_y:1; - unsigned cube_neg_y:1; - unsigned cube_pos_x:1; - unsigned cube_neg_x:1; - unsigned pad:4; - unsigned mipmap_layout_mode:1; - unsigned vert_line_stride_ofs:1; - unsigned vert_line_stride:1; - unsigned color_blend:1; - unsigned writedisable_blue:1; - unsigned writedisable_green:1; - unsigned writedisable_red:1; - unsigned writedisable_alpha:1; - unsigned surface_format:9; - unsigned data_return_format:1; - unsigned pad0:1; - unsigned surface_type:3; - } ss0; - - struct { - unsigned base_addr; - } ss1; - - struct { - unsigned pad:2; - unsigned mip_count:4; - unsigned width:13; - unsigned height:13; - } ss2; - - struct { - unsigned tile_walk:1; - unsigned tiled_surface:1; - unsigned pad:1; - unsigned pitch:18; - unsigned depth:11; - } ss3; - - struct { - unsigned pad:19; - unsigned min_array_elt:9; - unsigned min_lod:4; - } ss4; -}; - - - -struct brw_vertex_buffer_state -{ - struct { - unsigned pitch:11; - unsigned pad:15; - unsigned access_type:1; - unsigned vb_index:5; - } vb0; - - unsigned start_addr; - unsigned max_index; -#if 1 - unsigned instance_data_step_rate; /* not included for sequential/random vertices? */ -#endif -}; - -#define BRW_VBP_MAX 17 - -struct brw_vb_array_state { - struct header header; - struct brw_vertex_buffer_state vb[BRW_VBP_MAX]; -}; - - -struct brw_vertex_element_state -{ - struct - { - unsigned src_offset:11; - unsigned pad:5; - unsigned src_format:9; - unsigned pad0:1; - unsigned valid:1; - unsigned vertex_buffer_index:5; - } ve0; - - struct - { - unsigned dst_offset:8; - unsigned pad:8; - unsigned vfcomponent3:4; - unsigned vfcomponent2:4; - unsigned vfcomponent1:4; - unsigned vfcomponent0:4; - } ve1; -}; - -#define BRW_VEP_MAX 18 - -struct brw_vertex_element_packet { - struct header header; - struct brw_vertex_element_state ve[BRW_VEP_MAX]; /* note: less than _TNL_ATTRIB_MAX */ -}; - - -struct brw_urb_immediate { - unsigned opcode:4; - unsigned offset:6; - unsigned swizzle_control:2; - unsigned pad:1; - unsigned allocate:1; - unsigned used:1; - unsigned complete:1; - unsigned response_length:4; - unsigned msg_length:4; - unsigned msg_target:4; - unsigned pad1:3; - unsigned end_of_thread:1; -}; - -/* Instruction format for the execution units: - */ - -struct brw_instruction -{ - struct - { - unsigned opcode:7; - unsigned pad:1; - unsigned access_mode:1; - unsigned mask_control:1; - unsigned dependency_control:2; - unsigned compression_control:2; - unsigned thread_control:2; - unsigned predicate_control:4; - unsigned predicate_inverse:1; - unsigned execution_size:3; - unsigned destreg__conditonalmod:4; /* destreg - send, conditionalmod - others */ - unsigned pad0:2; - unsigned debug_control:1; - unsigned saturate:1; - } header; - - union { - struct - { - unsigned dest_reg_file:2; - unsigned dest_reg_type:3; - unsigned src0_reg_file:2; - unsigned src0_reg_type:3; - unsigned src1_reg_file:2; - unsigned src1_reg_type:3; - unsigned pad:1; - unsigned dest_subreg_nr:5; - unsigned dest_reg_nr:8; - unsigned dest_horiz_stride:2; - unsigned dest_address_mode:1; - } da1; - - struct - { - unsigned dest_reg_file:2; - unsigned dest_reg_type:3; - unsigned src0_reg_file:2; - unsigned src0_reg_type:3; - unsigned pad:6; - int dest_indirect_offset:10; /* offset against the deref'd address reg */ - unsigned dest_subreg_nr:3; /* subnr for the address reg a0.x */ - unsigned dest_horiz_stride:2; - unsigned dest_address_mode:1; - } ia1; - - struct - { - unsigned dest_reg_file:2; - unsigned dest_reg_type:3; - unsigned src0_reg_file:2; - unsigned src0_reg_type:3; - unsigned src1_reg_file:2; - unsigned src1_reg_type:3; - unsigned pad0:1; - unsigned dest_writemask:4; - unsigned dest_subreg_nr:1; - unsigned dest_reg_nr:8; - unsigned pad1:2; - unsigned dest_address_mode:1; - } da16; - - struct - { - unsigned dest_reg_file:2; - unsigned dest_reg_type:3; - unsigned src0_reg_file:2; - unsigned src0_reg_type:3; - unsigned pad0:6; - unsigned dest_writemask:4; - int dest_indirect_offset:6; - unsigned dest_subreg_nr:3; - unsigned pad1:2; - unsigned dest_address_mode:1; - } ia16; - } bits1; - - - union { - struct - { - unsigned src0_subreg_nr:5; - unsigned src0_reg_nr:8; - unsigned src0_abs:1; - unsigned src0_negate:1; - unsigned src0_address_mode:1; - unsigned src0_horiz_stride:2; - unsigned src0_width:3; - unsigned src0_vert_stride:4; - unsigned flag_reg_nr:1; - unsigned pad:6; - } da1; - - struct - { - int src0_indirect_offset:10; - unsigned src0_subreg_nr:3; - unsigned src0_abs:1; - unsigned src0_negate:1; - unsigned src0_address_mode:1; - unsigned src0_horiz_stride:2; - unsigned src0_width:3; - unsigned src0_vert_stride:4; - unsigned flag_reg_nr:1; - unsigned pad:6; - } ia1; - - struct - { - unsigned src0_swz_x:2; - unsigned src0_swz_y:2; - unsigned src0_subreg_nr:1; - unsigned src0_reg_nr:8; - unsigned src0_abs:1; - unsigned src0_negate:1; - unsigned src0_address_mode:1; - unsigned src0_swz_z:2; - unsigned src0_swz_w:2; - unsigned pad0:1; - unsigned src0_vert_stride:4; - unsigned flag_reg_nr:1; - unsigned pad1:6; - } da16; - - struct - { - unsigned src0_swz_x:2; - unsigned src0_swz_y:2; - int src0_indirect_offset:6; - unsigned src0_subreg_nr:3; - unsigned src0_abs:1; - unsigned src0_negate:1; - unsigned src0_address_mode:1; - unsigned src0_swz_z:2; - unsigned src0_swz_w:2; - unsigned pad0:1; - unsigned src0_vert_stride:4; - unsigned flag_reg_nr:1; - unsigned pad1:6; - } ia16; - - } bits2; - - union - { - struct - { - unsigned src1_subreg_nr:5; - unsigned src1_reg_nr:8; - unsigned src1_abs:1; - unsigned src1_negate:1; - unsigned pad:1; - unsigned src1_horiz_stride:2; - unsigned src1_width:3; - unsigned src1_vert_stride:4; - unsigned pad0:7; - } da1; - - struct - { - unsigned src1_swz_x:2; - unsigned src1_swz_y:2; - unsigned src1_subreg_nr:1; - unsigned src1_reg_nr:8; - unsigned src1_abs:1; - unsigned src1_negate:1; - unsigned pad0:1; - unsigned src1_swz_z:2; - unsigned src1_swz_w:2; - unsigned pad1:1; - unsigned src1_vert_stride:4; - unsigned pad2:7; - } da16; - - struct - { - int src1_indirect_offset:10; - unsigned src1_subreg_nr:3; - unsigned src1_abs:1; - unsigned src1_negate:1; - unsigned pad0:1; - unsigned src1_horiz_stride:2; - unsigned src1_width:3; - unsigned src1_vert_stride:4; - unsigned flag_reg_nr:1; - unsigned pad1:6; - } ia1; - - struct - { - unsigned src1_swz_x:2; - unsigned src1_swz_y:2; - int src1_indirect_offset:6; - unsigned src1_subreg_nr:3; - unsigned src1_abs:1; - unsigned src1_negate:1; - unsigned pad0:1; - unsigned src1_swz_z:2; - unsigned src1_swz_w:2; - unsigned pad1:1; - unsigned src1_vert_stride:4; - unsigned flag_reg_nr:1; - unsigned pad2:6; - } ia16; - - - struct - { - int jump_count:16; /* note: signed */ - unsigned pop_count:4; - unsigned pad0:12; - } if_else; - - struct { - unsigned function:4; - unsigned int_type:1; - unsigned precision:1; - unsigned saturate:1; - unsigned data_type:1; - unsigned pad0:8; - unsigned response_length:4; - unsigned msg_length:4; - unsigned msg_target:4; - unsigned pad1:3; - unsigned end_of_thread:1; - } math; - - struct { - unsigned binding_table_index:8; - unsigned sampler:4; - unsigned return_format:2; - unsigned msg_type:2; - unsigned response_length:4; - unsigned msg_length:4; - unsigned msg_target:4; - unsigned pad1:3; - unsigned end_of_thread:1; - } sampler; - - struct brw_urb_immediate urb; - - struct { - unsigned binding_table_index:8; - unsigned msg_control:4; - unsigned msg_type:2; - unsigned target_cache:2; - unsigned response_length:4; - unsigned msg_length:4; - unsigned msg_target:4; - unsigned pad1:3; - unsigned end_of_thread:1; - } dp_read; - - struct { - unsigned binding_table_index:8; - unsigned msg_control:3; - unsigned pixel_scoreboard_clear:1; - unsigned msg_type:3; - unsigned send_commit_msg:1; - unsigned response_length:4; - unsigned msg_length:4; - unsigned msg_target:4; - unsigned pad1:3; - unsigned end_of_thread:1; - } dp_write; - - struct { - unsigned pad:16; - unsigned response_length:4; - unsigned msg_length:4; - unsigned msg_target:4; - unsigned pad1:3; - unsigned end_of_thread:1; - } generic; - - int d; - unsigned ud; - } bits3; -}; - - -#endif diff --git a/src/gallium/drivers/i965simple/brw_surface.c b/src/gallium/drivers/i965simple/brw_surface.c deleted file mode 100644 index 724a69b2ee..0000000000 --- a/src/gallium/drivers/i965simple/brw_surface.c +++ /dev/null @@ -1,126 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include "brw_blit.h" -#include "brw_context.h" -#include "brw_state.h" -#include "pipe/p_defines.h" -#include "pipe/p_inlines.h" -#include "pipe/internal/p_winsys_screen.h" -#include "util/u_tile.h" -#include "util/u_rect.h" - - - -/* Assumes all values are within bounds -- no checking at this level - - * do it higher up if required. - */ -static void -brw_surface_copy(struct pipe_context *pipe, - struct pipe_surface *dst, - unsigned dstx, unsigned dsty, - struct pipe_surface *src, - unsigned srcx, unsigned srcy, unsigned width, unsigned height) -{ - assert( dst != src ); - assert( dst->block.size == src->block.size ); - assert( dst->block.width == src->block.height ); - assert( dst->block.height == src->block.height ); - - if (0) { - void *dst_map = pipe->screen->surface_map( pipe->screen, - dst, - PIPE_BUFFER_USAGE_CPU_WRITE ); - - const void *src_map = pipe->screen->surface_map( pipe->screen, - src, - PIPE_BUFFER_USAGE_CPU_READ ); - - util_copy_rect(dst_map, - &dst->block, - dst->stride, - dstx, dsty, - width, height, - src_map, - src->stride, - srcx, srcy); - - pipe->screen->surface_unmap(pipe->screen, src); - pipe->screen->surface_unmap(pipe->screen, dst); - } - else { - struct brw_texture *dst_tex = (struct brw_texture *)dst->texture; - struct brw_texture *src_tex = (struct brw_texture *)src->texture; - assert(dst->block.width == 1); - assert(dst->block.height == 1); - brw_copy_blit(brw_context(pipe), - FALSE, - dst->block.size, - (short) src->stride/src->block.size, src_tex->buffer, src->offset, FALSE, - (short) dst->stride/dst->block.size, dst_tex->buffer, dst->offset, FALSE, - (short) srcx, (short) srcy, (short) dstx, (short) dsty, - (short) width, (short) height, PIPE_LOGICOP_COPY); - } -} - - -static void -brw_surface_fill(struct pipe_context *pipe, - struct pipe_surface *dst, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height, unsigned value) -{ - if (0) { - void *dst_map = pipe->screen->surface_map( pipe->screen, - dst, - PIPE_BUFFER_USAGE_CPU_WRITE ); - - util_fill_rect(dst_map, &dst->block, dst->stride, dstx, dsty, width, height, value); - - pipe->screen->surface_unmap(pipe->screen, dst); - } - else { - struct brw_texture *tex = (struct brw_texture *)dst->texture; - assert(dst->block.width == 1); - assert(dst->block.height == 1); - brw_fill_blit(brw_context(pipe), - dst->block.size, - (short) dst->stride/dst->block.size, - tex->buffer, dst->offset, FALSE, - (short) dstx, (short) dsty, - (short) width, (short) height, - value); - } -} - - -void -brw_init_surface_functions(struct brw_context *brw) -{ - brw->pipe.surface_copy = brw_surface_copy; - brw->pipe.surface_fill = brw_surface_fill; -} diff --git a/src/gallium/drivers/i965simple/brw_tex_layout.c b/src/gallium/drivers/i965simple/brw_tex_layout.c deleted file mode 100644 index 998ffaeac4..0000000000 --- a/src/gallium/drivers/i965simple/brw_tex_layout.c +++ /dev/null @@ -1,380 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -/* Code to layout images in a mipmap tree for i965. - */ - -#include "pipe/p_state.h" -#include "pipe/p_context.h" -#include "pipe/p_defines.h" -#include "pipe/p_inlines.h" -#include "pipe/internal/p_winsys_screen.h" -#include "util/u_math.h" -#include "util/u_memory.h" -#include "brw_context.h" -#include "brw_tex_layout.h" - - -#define FILE_DEBUG_FLAG DEBUG_TEXTURE - -#if 0 -unsigned intel_compressed_alignment(unsigned internalFormat) -{ - unsigned alignment = 4; - - switch (internalFormat) { - case GL_COMPRESSED_RGB_FXT1_3DFX: - case GL_COMPRESSED_RGBA_FXT1_3DFX: - alignment = 8; - break; - - default: - break; - } - - return alignment; -} -#endif - - -static void intel_miptree_set_image_offset(struct brw_texture *tex, - unsigned level, - unsigned img, - unsigned x, unsigned y) -{ - struct pipe_texture *pt = &tex->base; - if (img == 0 && level == 0) - assert(x == 0 && y == 0); - assert(img < tex->nr_images[level]); - - tex->image_offset[level][img] = y * tex->stride + x * pt->block.size; -} - -static void intel_miptree_set_level_info(struct brw_texture *tex, - unsigned level, - unsigned nr_images, - unsigned x, unsigned y, - unsigned w, unsigned h, unsigned d) -{ - struct pipe_texture *pt = &tex->base; - - assert(level < PIPE_MAX_TEXTURE_LEVELS); - - pt->width[level] = w; - pt->height[level] = h; - pt->depth[level] = d; - - pt->nblocksx[level] = pf_get_nblocksx(&pt->block, w); - pt->nblocksy[level] = pf_get_nblocksy(&pt->block, h); - - tex->level_offset[level] = y * tex->stride + x * tex->base.block.size; - tex->nr_images[level] = nr_images; - - /* - DBG("%s level %d size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__, - level, w, h, d, x, y, tex->level_offset[level]); - */ - - /* Not sure when this would happen, but anyway: - */ - if (tex->image_offset[level]) { - FREE(tex->image_offset[level]); - tex->image_offset[level] = NULL; - } - - assert(nr_images); - assert(!tex->image_offset[level]); - - tex->image_offset[level] = (unsigned *) MALLOC(nr_images * sizeof(unsigned)); - tex->image_offset[level][0] = 0; -} - -static void i945_miptree_layout_2d(struct brw_texture *tex) -{ - struct pipe_texture *pt = &tex->base; - const int align_x = 2, align_y = 4; - unsigned level; - unsigned x = 0; - unsigned y = 0; - unsigned width = pt->width[0]; - unsigned height = pt->height[0]; - unsigned nblocksx = pt->nblocksx[0]; - unsigned nblocksy = pt->nblocksy[0]; - - tex->stride = align(pt->nblocksx[0] * pt->block.size, 4); - - /* May need to adjust pitch to accomodate the placement of - * the 2nd mipmap level. This occurs when the alignment - * constraints of mipmap placement push the right edge of the - * 2nd mipmap level out past the width of its parent. - */ - if (pt->last_level > 0) { - unsigned mip1_nblocksx - = align(pf_get_nblocksx(&pt->block, minify(width)), align_x) - + pf_get_nblocksx(&pt->block, minify(minify(width))); - - if (mip1_nblocksx > nblocksx) - tex->stride = mip1_nblocksx * pt->block.size; - } - - /* Pitch must be a whole number of dwords - */ - tex->stride = align(tex->stride, 64); - tex->total_nblocksy = 0; - - for (level = 0; level <= pt->last_level; level++) { - intel_miptree_set_level_info(tex, level, 1, x, y, width, - height, 1); - - nblocksy = align(nblocksy, align_y); - - /* Because the images are packed better, the final offset - * might not be the maximal one: - */ - tex->total_nblocksy = MAX2(tex->total_nblocksy, y + nblocksy); - - /* Layout_below: step right after second mipmap level. - */ - if (level == 1) { - x += align(nblocksx, align_x); - } - else { - y += nblocksy; - } - - width = minify(width); - height = minify(height); - nblocksx = pf_get_nblocksx(&pt->block, width); - nblocksy = pf_get_nblocksy(&pt->block, height); - } -} - -static boolean brw_miptree_layout(struct brw_texture *tex) -{ - struct pipe_texture *pt = &tex->base; - /* XXX: these vary depending on image format: - */ -/* int align_w = 4; */ - - switch (pt->target) { - case PIPE_TEXTURE_CUBE: - case PIPE_TEXTURE_3D: { - unsigned width = pt->width[0]; - unsigned height = pt->height[0]; - unsigned depth = pt->depth[0]; - unsigned nblocksx = pt->nblocksx[0]; - unsigned nblocksy = pt->nblocksy[0]; - unsigned pack_x_pitch, pack_x_nr; - unsigned pack_y_pitch; - unsigned level; - unsigned align_h = 2; - unsigned align_w = 4; - - tex->total_nblocksy = 0; - - tex->stride = align(pt->nblocksx[0], 4); - pack_y_pitch = align(pt->nblocksy[0], align_h); - - pack_x_pitch = tex->stride / pt->block.size; - pack_x_nr = 1; - - for (level = 0; level <= pt->last_level; level++) { - unsigned nr_images = pt->target == PIPE_TEXTURE_3D ? depth : 6; - int x = 0; - int y = 0; - uint q, j; - - intel_miptree_set_level_info(tex, level, nr_images, - 0, tex->total_nblocksy, - width, height, depth); - - for (q = 0; q < nr_images;) { - for (j = 0; j < pack_x_nr && q < nr_images; j++, q++) { - intel_miptree_set_image_offset(tex, level, q, x, y); - x += pack_x_pitch; - } - - x = 0; - y += pack_y_pitch; - } - - - tex->total_nblocksy += y; - width = minify(width); - height = minify(height); - depth = minify(depth); - nblocksx = pf_get_nblocksx(&pt->block, width); - nblocksy = pf_get_nblocksy(&pt->block, height); - - if (pf_is_compressed(pt->format)) { - pack_y_pitch = (height + 3) / 4; - - if (pack_x_pitch > align(width, align_w)) { - pack_x_pitch = align(width, align_w); - pack_x_nr <<= 1; - } - } else { - if (pack_x_pitch > 4) { - pack_x_pitch >>= 1; - pack_x_nr <<= 1; - assert(pack_x_pitch * pack_x_nr * pt->block.size <= tex->stride); - } - - if (pack_y_pitch > 2) { - pack_y_pitch >>= 1; - pack_y_pitch = align(pack_y_pitch, align_h); - } - } - - } - break; - } - - default: - i945_miptree_layout_2d(tex); - break; - } -#if 0 - PRINT("%s: %dx%dx%d - sz 0x%x\n", __FUNCTION__, - pt->pitch, - pt->total_nblocksy, - pt->block.size, - pt->stride * pt->total_nblocksy ); -#endif - - return TRUE; -} - - -static struct pipe_texture * -brw_texture_create_screen(struct pipe_screen *screen, - const struct pipe_texture *templat) -{ - struct brw_texture *tex = CALLOC_STRUCT(brw_texture); - - if (tex) { - tex->base = *templat; - pipe_reference_init(&tex->base.reference, 1); - - tex->base.nblocksx[0] = pf_get_nblocksx(&tex->base.block, tex->base.width[0]); - tex->base.nblocksy[0] = pf_get_nblocksy(&tex->base.block, tex->base.height[0]); - - if (brw_miptree_layout(tex)) - tex->buffer = screen->buffer_create(screen, 64, - PIPE_BUFFER_USAGE_PIXEL, - tex->stride * - tex->total_nblocksy); - - if (!tex->buffer) { - FREE(tex); - return NULL; - } - } - - return &tex->base; -} - - -static void -brw_texture_destroy_screen(struct pipe_texture *pt) -{ - struct brw_texture *tex = (struct brw_texture *)pt; - uint i; - - /* - DBG("%s deleting %p\n", __FUNCTION__, (void *) tex); - */ - - pipe_buffer_reference(&tex->buffer, NULL); - - for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++) - if (tex->image_offset[i]) - free(tex->image_offset[i]); - - free(tex); -} - - -static struct pipe_surface * -brw_get_tex_surface_screen(struct pipe_screen *screen, - struct pipe_texture *pt, - unsigned face, unsigned level, unsigned zslice) -{ - struct brw_texture *tex = (struct brw_texture *)pt; - struct pipe_surface *ps; - unsigned offset; /* in bytes */ - - offset = tex->level_offset[level]; - - if (pt->target == PIPE_TEXTURE_CUBE) { - offset += tex->image_offset[level][face]; - } - else if (pt->target == PIPE_TEXTURE_3D) { - offset += tex->image_offset[level][zslice]; - } - else { - assert(face == 0); - assert(zslice == 0); - } - - ps = CALLOC_STRUCT(pipe_surface); - if (ps) { - pipe_reference_init(&ps->reference, 1); - pipe_texture_reference(&ps->texture, pt); - ps->format = pt->format; - ps->width = pt->width[level]; - ps->height = pt->height[level]; - ps->block = pt->block; - ps->nblocksx = pt->nblocksx[level]; - ps->nblocksy = pt->nblocksy[level]; - ps->stride = tex->stride; - ps->offset = offset; - } - return ps; -} - - -void -brw_init_texture_functions(struct brw_context *brw) -{ -// brw->pipe.texture_update = brw_texture_update; -} - - -void -brw_init_screen_texture_funcs(struct pipe_screen *screen) -{ - screen->texture_create = brw_texture_create_screen; - screen->texture_destroy = brw_texture_destroy_screen; - screen->get_tex_surface = brw_get_tex_surface_screen; -} - diff --git a/src/gallium/drivers/i965simple/brw_tex_layout.h b/src/gallium/drivers/i965simple/brw_tex_layout.h deleted file mode 100644 index a6b6ba8146..0000000000 --- a/src/gallium/drivers/i965simple/brw_tex_layout.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 BRW_TEX_LAYOUT_H -#define BRW_TEX_LAYOUT_H - - -struct brw_context; -struct pipe_screen; - - -extern void -brw_init_texture_functions(struct brw_context *brw); - -extern void -brw_init_screen_texture_funcs(struct pipe_screen *screen); - - -#endif diff --git a/src/gallium/drivers/i965simple/brw_urb.c b/src/gallium/drivers/i965simple/brw_urb.c deleted file mode 100644 index 101a4367b9..0000000000 --- a/src/gallium/drivers/i965simple/brw_urb.c +++ /dev/null @@ -1,186 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#include "brw_context.h" -//#include "brw_state.h" -#include "brw_batch.h" -#include "brw_defines.h" - -#define VS 0 -#define GS 1 -#define CLP 2 -#define SF 3 -#define CS 4 - -/* XXX: Are the min_entry_size numbers useful? - * XXX: Verify min_nr_entries, esp for VS. - * XXX: Verify SF min_entry_size. - */ -static const struct { - unsigned min_nr_entries; - unsigned preferred_nr_entries; - unsigned min_entry_size; - unsigned max_entry_size; -} limits[CS+1] = { - { 8, 32, 1, 5 }, /* vs */ - { 4, 8, 1, 5 }, /* gs */ - { 6, 8, 1, 5 }, /* clp */ - { 1, 8, 1, 12 }, /* sf */ - { 1, 4, 1, 32 } /* cs */ -}; - - -static boolean check_urb_layout( struct brw_context *brw ) -{ - brw->urb.vs_start = 0; - brw->urb.gs_start = brw->urb.nr_vs_entries * brw->urb.vsize; - brw->urb.clip_start = brw->urb.gs_start + brw->urb.nr_gs_entries * brw->urb.vsize; - brw->urb.sf_start = brw->urb.clip_start + brw->urb.nr_clip_entries * brw->urb.vsize; - brw->urb.cs_start = brw->urb.sf_start + brw->urb.nr_sf_entries * brw->urb.sfsize; - - return brw->urb.cs_start + brw->urb.nr_cs_entries * brw->urb.csize <= 256; -} - -/* Most minimal update, forces re-emit of URB fence packet after GS - * unit turned on/off. - */ -static void recalculate_urb_fence( struct brw_context *brw ) -{ - unsigned csize = brw->curbe.total_size; - unsigned vsize = brw->vs.prog_data->urb_entry_size; - unsigned sfsize = brw->sf.prog_data->urb_entry_size; - - if (csize < limits[CS].min_entry_size) - csize = limits[CS].min_entry_size; - - if (vsize < limits[VS].min_entry_size) - vsize = limits[VS].min_entry_size; - - if (sfsize < limits[SF].min_entry_size) - sfsize = limits[SF].min_entry_size; - - if (brw->urb.vsize < vsize || - brw->urb.sfsize < sfsize || - brw->urb.csize < csize || - (brw->urb.constrained && (brw->urb.vsize > brw->urb.vsize || - brw->urb.sfsize > brw->urb.sfsize || - brw->urb.csize > brw->urb.csize))) { - - - brw->urb.csize = csize; - brw->urb.sfsize = sfsize; - brw->urb.vsize = vsize; - - brw->urb.nr_vs_entries = limits[VS].preferred_nr_entries; - brw->urb.nr_gs_entries = limits[GS].preferred_nr_entries; - brw->urb.nr_clip_entries = limits[CLP].preferred_nr_entries; - brw->urb.nr_sf_entries = limits[SF].preferred_nr_entries; - brw->urb.nr_cs_entries = limits[CS].preferred_nr_entries; - - if (!check_urb_layout(brw)) { - brw->urb.nr_vs_entries = limits[VS].min_nr_entries; - brw->urb.nr_gs_entries = limits[GS].min_nr_entries; - brw->urb.nr_clip_entries = limits[CLP].min_nr_entries; - brw->urb.nr_sf_entries = limits[SF].min_nr_entries; - brw->urb.nr_cs_entries = limits[CS].min_nr_entries; - - brw->urb.constrained = 1; - - if (!check_urb_layout(brw)) { - /* This is impossible, given the maximal sizes of urb - * entries and the values for minimum nr of entries - * provided above. - */ - debug_printf("couldn't calculate URB layout!\n"); - exit(1); - } - - if (BRW_DEBUG & (DEBUG_URB|DEBUG_FALLBACKS)) - debug_printf("URB CONSTRAINED\n"); - } - else - brw->urb.constrained = 0; - - if (BRW_DEBUG & DEBUG_URB) - debug_printf("URB fence: %d ..VS.. %d ..GS.. %d ..CLP.. %d ..SF.. %d ..CS.. %d\n", - brw->urb.vs_start, - brw->urb.gs_start, - brw->urb.clip_start, - brw->urb.sf_start, - brw->urb.cs_start, - 256); - - brw->state.dirty.brw |= BRW_NEW_URB_FENCE; - } -} - - -const struct brw_tracked_state brw_recalculate_urb_fence = { - .dirty = { - .brw = BRW_NEW_CURBE_OFFSETS, - .cache = (CACHE_NEW_VS_PROG | - CACHE_NEW_SF_PROG) - }, - .update = recalculate_urb_fence -}; - - - - - -void brw_upload_urb_fence(struct brw_context *brw) -{ - struct brw_urb_fence uf; - memset(&uf, 0, sizeof(uf)); - - uf.header.opcode = CMD_URB_FENCE; - uf.header.length = sizeof(uf)/4-2; - uf.header.vs_realloc = 1; - uf.header.gs_realloc = 1; - uf.header.clp_realloc = 1; - uf.header.sf_realloc = 1; - uf.header.vfe_realloc = 1; - uf.header.cs_realloc = 1; - - /* The ordering below is correct, not the layout in the - * instruction. - * - * There are 256 urb reg pairs in total. - */ - uf.bits0.vs_fence = brw->urb.gs_start; - uf.bits0.gs_fence = brw->urb.clip_start; - uf.bits0.clp_fence = brw->urb.sf_start; - uf.bits1.sf_fence = brw->urb.cs_start; - uf.bits1.cs_fence = 256; - - BRW_BATCH_STRUCT(brw, &uf); -} diff --git a/src/gallium/drivers/i965simple/brw_util.c b/src/gallium/drivers/i965simple/brw_util.c deleted file mode 100644 index 42391d7c8c..0000000000 --- a/src/gallium/drivers/i965simple/brw_util.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#include "brw_util.h" -#include "brw_defines.h" - -#include "pipe/p_defines.h" - -unsigned brw_count_bits( unsigned val ) -{ - unsigned i; - for (i = 0; val ; val >>= 1) - if (val & 1) - i++; - return i; -} - - -unsigned brw_translate_blend_equation( int mode ) -{ - switch (mode) { - case PIPE_BLEND_ADD: - return BRW_BLENDFUNCTION_ADD; - case PIPE_BLEND_MIN: - return BRW_BLENDFUNCTION_MIN; - case PIPE_BLEND_MAX: - return BRW_BLENDFUNCTION_MAX; - case PIPE_BLEND_SUBTRACT: - return BRW_BLENDFUNCTION_SUBTRACT; - case PIPE_BLEND_REVERSE_SUBTRACT: - return BRW_BLENDFUNCTION_REVERSE_SUBTRACT; - default: - assert(0); - return BRW_BLENDFUNCTION_ADD; - } -} - -unsigned brw_translate_blend_factor( int factor ) -{ - switch(factor) { - case PIPE_BLENDFACTOR_ZERO: - return BRW_BLENDFACTOR_ZERO; - case PIPE_BLENDFACTOR_SRC_ALPHA: - return BRW_BLENDFACTOR_SRC_ALPHA; - case PIPE_BLENDFACTOR_ONE: - return BRW_BLENDFACTOR_ONE; - case PIPE_BLENDFACTOR_SRC_COLOR: - return BRW_BLENDFACTOR_SRC_COLOR; - case PIPE_BLENDFACTOR_INV_SRC_COLOR: - return BRW_BLENDFACTOR_INV_SRC_COLOR; - case PIPE_BLENDFACTOR_DST_COLOR: - return BRW_BLENDFACTOR_DST_COLOR; - case PIPE_BLENDFACTOR_INV_DST_COLOR: - return BRW_BLENDFACTOR_INV_DST_COLOR; - case PIPE_BLENDFACTOR_INV_SRC_ALPHA: - return BRW_BLENDFACTOR_INV_SRC_ALPHA; - case PIPE_BLENDFACTOR_DST_ALPHA: - return BRW_BLENDFACTOR_DST_ALPHA; - case PIPE_BLENDFACTOR_INV_DST_ALPHA: - return BRW_BLENDFACTOR_INV_DST_ALPHA; - case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: - return BRW_BLENDFACTOR_SRC_ALPHA_SATURATE; - case PIPE_BLENDFACTOR_CONST_COLOR: - return BRW_BLENDFACTOR_CONST_COLOR; - case PIPE_BLENDFACTOR_INV_CONST_COLOR: - return BRW_BLENDFACTOR_INV_CONST_COLOR; - case PIPE_BLENDFACTOR_CONST_ALPHA: - return BRW_BLENDFACTOR_CONST_ALPHA; - case PIPE_BLENDFACTOR_INV_CONST_ALPHA: - return BRW_BLENDFACTOR_INV_CONST_ALPHA; - default: - assert(0); - return BRW_BLENDFACTOR_ZERO; - } -} diff --git a/src/gallium/drivers/i965simple/brw_util.h b/src/gallium/drivers/i965simple/brw_util.h deleted file mode 100644 index d60e5934db..0000000000 --- a/src/gallium/drivers/i965simple/brw_util.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#ifndef BRW_UTIL_H -#define BRW_UTIL_H - -#include "pipe/p_state.h" - -extern unsigned brw_count_bits( unsigned val ); -extern unsigned brw_translate_blend_factor( int factor ); -extern unsigned brw_translate_blend_equation( int mode ); - - -#endif diff --git a/src/gallium/drivers/i965simple/brw_vs.c b/src/gallium/drivers/i965simple/brw_vs.c deleted file mode 100644 index 92327e896d..0000000000 --- a/src/gallium/drivers/i965simple/brw_vs.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#include "brw_context.h" -#include "brw_vs.h" -#include "brw_util.h" -#include "brw_state.h" - - -static void do_vs_prog( struct brw_context *brw, - const struct brw_vertex_program *vp, - struct brw_vs_prog_key *key ) -{ - unsigned program_size; - const unsigned *program; - struct brw_vs_compile c; - - memset(&c, 0, sizeof(c)); - memcpy(&c.key, key, sizeof(*key)); - - brw_init_compile(&c.func); - c.vp = vp; - - c.prog_data.outputs_written = vp->info.num_outputs; - c.prog_data.inputs_read = vp->info.num_inputs; - -#if 0 - if (c.key.copy_edgeflag) { - c.prog_data.outputs_written |= 1<vs.prog_gs_offset = brw_upload_cache( &brw->cache[BRW_VS_PROG], - &c.key, - sizeof(c.key), - program, - program_size, - &c.prog_data, - &brw->vs.prog_data); -} - - -static void brw_upload_vs_prog( struct brw_context *brw ) -{ - struct brw_vs_prog_key key; - const struct brw_vertex_program *vp = brw->attribs.VertexProgram; - - assert(vp); - - memset(&key, 0, sizeof(key)); - - /* Just upload the program verbatim for now. Always send it all - * the inputs it asks for, whether they are varying or not. - */ - key.program_string_id = vp->id; - key.nr_userclip = brw->attribs.Clip.nr; - key.copy_edgeflag = (brw->attribs.Raster->fill_cw != PIPE_POLYGON_MODE_FILL || - brw->attribs.Raster->fill_ccw != PIPE_POLYGON_MODE_FILL); - - /* Make an early check for the key. - */ - if (brw_search_cache(&brw->cache[BRW_VS_PROG], - &key, sizeof(key), - &brw->vs.prog_data, - &brw->vs.prog_gs_offset)) - return; - - do_vs_prog(brw, vp, &key); -} - - -/* See brw_vs.c: - */ -const struct brw_tracked_state brw_vs_prog = { - .dirty = { - .brw = BRW_NEW_VS, - .cache = 0 - }, - .update = brw_upload_vs_prog -}; diff --git a/src/gallium/drivers/i965simple/brw_vs.h b/src/gallium/drivers/i965simple/brw_vs.h deleted file mode 100644 index 070f9dfcae..0000000000 --- a/src/gallium/drivers/i965simple/brw_vs.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#ifndef BRW_VS_H -#define BRW_VS_H - - -#include "brw_context.h" -#include "brw_eu.h" - - -struct brw_vs_prog_key { - unsigned program_string_id; - unsigned nr_userclip:4; - unsigned copy_edgeflag:1; - unsigned know_w_is_one:1; - unsigned pad:26; -}; - - -struct brw_vs_compile { - struct brw_compile func; - struct brw_vs_prog_key key; - struct brw_vs_prog_data prog_data; - - const struct brw_vertex_program *vp; - - unsigned nr_inputs; - - unsigned first_output; - unsigned nr_outputs; - - unsigned first_tmp; - unsigned last_tmp; - - struct brw_reg r0; - struct brw_reg r1; - struct brw_reg regs[12][128]; - struct brw_reg tmp; - struct brw_reg stack; - - struct { - boolean used_in_src; - struct brw_reg reg; - } output_regs[128]; - - struct brw_reg userplane[6]; - -}; - -void brw_vs_emit( struct brw_vs_compile *c ); - -#endif diff --git a/src/gallium/drivers/i965simple/brw_vs_emit.c b/src/gallium/drivers/i965simple/brw_vs_emit.c deleted file mode 100644 index 3ee82d95b3..0000000000 --- a/src/gallium/drivers/i965simple/brw_vs_emit.c +++ /dev/null @@ -1,1330 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - -#include "brw_context.h" -#include "brw_vs.h" - -#include "pipe/p_shader_tokens.h" -#include "tgsi/tgsi_parse.h" - -struct brw_prog_info { - unsigned num_temps; - unsigned num_addrs; - unsigned num_consts; - - unsigned writes_psize; - - unsigned pos_idx; - unsigned result_edge_idx; - unsigned edge_flag_idx; - unsigned psize_idx; -}; - -/* Do things as simply as possible. Allocate and populate all regs - * ahead of time. - */ -static void brw_vs_alloc_regs( struct brw_vs_compile *c, - struct brw_prog_info *info ) -{ - unsigned i, reg = 0, mrf; - unsigned nr_params; - - /* r0 -- reserved as usual - */ - c->r0 = brw_vec8_grf(reg, 0); reg++; - - /* User clip planes from curbe: - */ - if (c->key.nr_userclip) { - for (i = 0; i < c->key.nr_userclip; i++) { - c->userplane[i] = stride( brw_vec4_grf(reg+3+i/2, (i%2) * 4), 0, 4, 1); - } - - /* Deal with curbe alignment: - */ - reg += ((6+c->key.nr_userclip+3)/4)*2; - } - - /* Vertex program parameters from curbe: - */ - nr_params = c->prog_data.max_const; - for (i = 0; i < nr_params; i++) { - c->regs[TGSI_FILE_CONSTANT][i] = stride(brw_vec4_grf(reg+i/2, (i%2) * 4), 0, 4, 1); - } - reg += (nr_params+1)/2; - c->prog_data.curb_read_length = reg - 1; - - - - /* Allocate input regs: - */ - c->nr_inputs = c->vp->info.num_inputs; - for (i = 0; i < c->nr_inputs; i++) { - c->regs[TGSI_FILE_INPUT][i] = brw_vec8_grf(reg, 0); - reg++; - } - - - /* Allocate outputs: TODO: could organize the non-position outputs - * to go straight into message regs. - */ - c->nr_outputs = 0; - c->first_output = reg; - mrf = 4; - for (i = 0; i < c->vp->info.num_outputs; i++) { - c->nr_outputs++; -#if 0 - if (i == VERT_RESULT_HPOS) { - c->regs[TGSI_FILE_OUTPUT][i] = brw_vec8_grf(reg, 0); - reg++; - } - else if (i == VERT_RESULT_PSIZ) { - c->regs[TGSI_FILE_OUTPUT][i] = brw_vec8_grf(reg, 0); - reg++; - mrf++; /* just a placeholder? XXX fix later stages & remove this */ - } - else { - c->regs[TGSI_FILE_OUTPUT][i] = brw_message_reg(mrf); - mrf++; - } -#else - /*treat pos differently for now */ - if (i == info->pos_idx) { - c->regs[TGSI_FILE_OUTPUT][i] = brw_vec8_grf(reg, 0); - reg++; - } else { - c->regs[TGSI_FILE_OUTPUT][i] = brw_message_reg(mrf); - mrf++; - } -#endif - } - - /* Allocate program temporaries: - */ - for (i = 0; i < info->num_temps; i++) { - c->regs[TGSI_FILE_TEMPORARY][i] = brw_vec8_grf(reg, 0); - reg++; - } - - /* Address reg(s). Don't try to use the internal address reg until - * deref time. - */ - for (i = 0; i < info->num_addrs; i++) { - c->regs[TGSI_FILE_ADDRESS][i] = brw_reg(BRW_GENERAL_REGISTER_FILE, - reg, - 0, - BRW_REGISTER_TYPE_D, - BRW_VERTICAL_STRIDE_8, - BRW_WIDTH_8, - BRW_HORIZONTAL_STRIDE_1, - BRW_SWIZZLE_XXXX, - TGSI_WRITEMASK_X); - reg++; - } - - 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++; - } - } - - c->stack = brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, reg, 0); - reg += 2; - - - /* Some opcodes need an internal temporary: - */ - c->first_tmp = reg; - c->last_tmp = reg; /* for allocation purposes */ - - /* Each input reg holds data from two vertices. The - * 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_entry_size = (c->nr_outputs+2+3)/4; - c->prog_data.total_grf = reg; -} - - -static struct brw_reg get_tmp( struct brw_vs_compile *c ) -{ - struct brw_reg tmp = brw_vec8_grf(c->last_tmp, 0); - - if (++c->last_tmp > c->prog_data.total_grf) - c->prog_data.total_grf = c->last_tmp; - - return tmp; -} - -static void release_tmp( struct brw_vs_compile *c, struct brw_reg tmp ) -{ - if (tmp.nr == c->last_tmp-1) - c->last_tmp--; -} - -static void release_tmps( struct brw_vs_compile *c ) -{ - c->last_tmp = c->first_tmp; -} - - -static void unalias1( struct brw_vs_compile *c, - struct brw_reg dst, - struct brw_reg arg0, - void (*func)( struct brw_vs_compile *, - struct brw_reg, - struct brw_reg )) -{ - if (dst.file == arg0.file && dst.nr == arg0.nr) { - struct brw_compile *p = &c->func; - struct brw_reg tmp = brw_writemask(get_tmp(c), dst.dw1.bits.writemask); - func(c, tmp, arg0); - brw_MOV(p, dst, tmp); - } - else { - func(c, dst, arg0); - } -} - -static void unalias2( struct brw_vs_compile *c, - struct brw_reg dst, - struct brw_reg arg0, - struct brw_reg arg1, - void (*func)( struct brw_vs_compile *, - struct brw_reg, - struct brw_reg, - struct brw_reg )) -{ - if ((dst.file == arg0.file && dst.nr == arg0.nr) || - (dst.file == arg1.file && dst.nr == arg1.nr)) { - struct brw_compile *p = &c->func; - struct brw_reg tmp = brw_writemask(get_tmp(c), dst.dw1.bits.writemask); - func(c, tmp, arg0, arg1); - brw_MOV(p, dst, tmp); - } - else { - func(c, dst, arg0, arg1); - } -} - -static void emit_sop( struct brw_compile *p, - struct brw_reg dst, - struct brw_reg arg0, - struct brw_reg arg1, - unsigned cond) -{ - brw_push_insn_state(p); - brw_CMP(p, brw_null_reg(), cond, arg0, arg1); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - brw_MOV(p, dst, brw_imm_f(1.0f)); - brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); - brw_MOV(p, dst, brw_imm_f(0.0f)); - brw_pop_insn_state(p); -} - -static void emit_seq( struct brw_compile *p, - struct brw_reg dst, - struct brw_reg arg0, - struct brw_reg arg1 ) -{ - emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_EQ); -} - -static void emit_sne( struct brw_compile *p, - struct brw_reg dst, - struct brw_reg arg0, - struct brw_reg arg1 ) -{ - emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_NEQ); -} -static void emit_slt( struct brw_compile *p, - struct brw_reg dst, - struct brw_reg arg0, - struct brw_reg arg1 ) -{ - emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_L); -} - -static void emit_sle( struct brw_compile *p, - struct brw_reg dst, - struct brw_reg arg0, - struct brw_reg arg1 ) -{ - emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_LE); -} - -static void emit_sgt( struct brw_compile *p, - struct brw_reg dst, - struct brw_reg arg0, - struct brw_reg arg1 ) -{ - emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_G); -} - -static void emit_sge( struct brw_compile *p, - struct brw_reg dst, - struct brw_reg arg0, - struct brw_reg arg1 ) -{ - emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_GE); -} - -static void emit_max( struct brw_compile *p, - struct brw_reg dst, - struct brw_reg arg0, - struct brw_reg arg1 ) -{ - brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, arg0, arg1); - brw_SEL(p, dst, arg1, arg0); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); -} - -static void emit_min( struct brw_compile *p, - struct brw_reg dst, - struct brw_reg arg0, - struct brw_reg arg1 ) -{ - brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, arg0, arg1); - brw_SEL(p, dst, arg0, arg1); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); -} - - -static void emit_math1( struct brw_vs_compile *c, - unsigned function, - struct brw_reg dst, - struct brw_reg arg0, - unsigned precision) -{ - /* There are various odd behaviours with SEND on the simulator. In - * addition there are documented issues with the fact that the GEN4 - * processor doesn't do dependency control properly on SEND - * results. So, on balance, this kludge to get around failures - * with writemasked math results looks like it might be necessary - * whether that turns out to be a simulator bug or not: - */ - struct brw_compile *p = &c->func; - struct brw_reg tmp = dst; - boolean need_tmp = (dst.dw1.bits.writemask != 0xf || - dst.file != BRW_GENERAL_REGISTER_FILE); - - if (need_tmp) - tmp = get_tmp(c); - - brw_math(p, - tmp, - function, - BRW_MATH_SATURATE_NONE, - 2, - arg0, - BRW_MATH_DATA_SCALAR, - precision); - - if (need_tmp) { - brw_MOV(p, dst, tmp); - release_tmp(c, tmp); - } -} - -static void emit_math2( struct brw_vs_compile *c, - unsigned function, - struct brw_reg dst, - struct brw_reg arg0, - struct brw_reg arg1, - unsigned precision) -{ - struct brw_compile *p = &c->func; - struct brw_reg tmp = dst; - boolean need_tmp = (dst.dw1.bits.writemask != 0xf || - dst.file != BRW_GENERAL_REGISTER_FILE); - - if (need_tmp) - tmp = get_tmp(c); - - brw_MOV(p, brw_message_reg(3), arg1); - - brw_math(p, - tmp, - function, - BRW_MATH_SATURATE_NONE, - 2, - arg0, - BRW_MATH_DATA_SCALAR, - precision); - - if (need_tmp) { - brw_MOV(p, dst, tmp); - release_tmp(c, tmp); - } -} - - - -static void emit_exp_noalias( struct brw_vs_compile *c, - struct brw_reg dst, - struct brw_reg arg0 ) -{ - struct brw_compile *p = &c->func; - - - if (dst.dw1.bits.writemask & TGSI_WRITEMASK_X) { - struct brw_reg tmp = get_tmp(c); - struct brw_reg tmp_d = retype(tmp, BRW_REGISTER_TYPE_D); - - /* tmp_d = floor(arg0.x) */ - brw_RNDD(p, tmp_d, brw_swizzle1(arg0, 0)); - - /* result[0] = 2.0 ^ tmp */ - - /* Adjust exponent for floating point: - * exp += 127 - */ - brw_ADD(p, brw_writemask(tmp_d, TGSI_WRITEMASK_X), tmp_d, brw_imm_d(127)); - - /* Install exponent and sign. - * Excess drops off the edge: - */ - brw_SHL(p, brw_writemask(retype(dst, BRW_REGISTER_TYPE_D), TGSI_WRITEMASK_X), - tmp_d, brw_imm_d(23)); - - release_tmp(c, tmp); - } - - if (dst.dw1.bits.writemask & TGSI_WRITEMASK_Y) { - /* result[1] = arg0.x - floor(arg0.x) */ - brw_FRC(p, brw_writemask(dst, TGSI_WRITEMASK_Y), brw_swizzle1(arg0, 0)); - } - - if (dst.dw1.bits.writemask & TGSI_WRITEMASK_Z) { - /* As with the LOG instruction, we might be better off just - * doing a taylor expansion here, seeing as we have to do all - * the prep work. - * - * If mathbox partial precision is too low, consider also: - * result[3] = result[0] * EXP(result[1]) - */ - emit_math1(c, - BRW_MATH_FUNCTION_EXP, - brw_writemask(dst, TGSI_WRITEMASK_Z), - brw_swizzle1(arg0, 0), - BRW_MATH_PRECISION_PARTIAL); - } - - if (dst.dw1.bits.writemask & TGSI_WRITEMASK_W) { - /* result[3] = 1.0; */ - brw_MOV(p, brw_writemask(dst, TGSI_WRITEMASK_W), brw_imm_f(1)); - } -} - - -static void emit_log_noalias( struct brw_vs_compile *c, - struct brw_reg dst, - struct brw_reg arg0 ) -{ - struct brw_compile *p = &c->func; - struct brw_reg tmp = dst; - struct brw_reg tmp_ud = retype(tmp, BRW_REGISTER_TYPE_UD); - struct brw_reg arg0_ud = retype(arg0, BRW_REGISTER_TYPE_UD); - boolean need_tmp = (dst.dw1.bits.writemask != 0xf || - dst.file != BRW_GENERAL_REGISTER_FILE); - - if (need_tmp) { - tmp = get_tmp(c); - tmp_ud = retype(tmp, BRW_REGISTER_TYPE_UD); - } - - /* Perform mant = frexpf(fabsf(x), &exp), adjust exp and mnt - * according to spec: - * - * These almost look likey they could be joined up, but not really - * practical: - * - * result[0].f = (x.i & ((1<<31)-1) >> 23) - 127 - * result[1].i = (x.i & ((1<<23)-1) + (127<<23) - */ - if (dst.dw1.bits.writemask & TGSI_WRITEMASK_XZ) { - brw_AND(p, - brw_writemask(tmp_ud, TGSI_WRITEMASK_X), - brw_swizzle1(arg0_ud, 0), - brw_imm_ud((1U<<31)-1)); - - brw_SHR(p, - brw_writemask(tmp_ud, TGSI_WRITEMASK_X), - tmp_ud, - brw_imm_ud(23)); - - brw_ADD(p, - brw_writemask(tmp, TGSI_WRITEMASK_X), - retype(tmp_ud, BRW_REGISTER_TYPE_D), /* does it matter? */ - brw_imm_d(-127)); - } - - if (dst.dw1.bits.writemask & TGSI_WRITEMASK_YZ) { - brw_AND(p, - brw_writemask(tmp_ud, TGSI_WRITEMASK_Y), - brw_swizzle1(arg0_ud, 0), - brw_imm_ud((1<<23)-1)); - - brw_OR(p, - brw_writemask(tmp_ud, TGSI_WRITEMASK_Y), - tmp_ud, - brw_imm_ud(127<<23)); - } - - if (dst.dw1.bits.writemask & TGSI_WRITEMASK_Z) { - /* result[2] = result[0] + LOG2(result[1]); */ - - /* Why bother? The above is just a hint how to do this with a - * taylor series. Maybe we *should* use a taylor series as by - * the time all the above has been done it's almost certainly - * quicker than calling the mathbox, even with low precision. - * - * Options are: - * - result[0] + mathbox.LOG2(result[1]) - * - mathbox.LOG2(arg0.x) - * - result[0] + inline_taylor_approx(result[1]) - */ - emit_math1(c, - BRW_MATH_FUNCTION_LOG, - brw_writemask(tmp, TGSI_WRITEMASK_Z), - brw_swizzle1(tmp, 1), - BRW_MATH_PRECISION_FULL); - - brw_ADD(p, - brw_writemask(tmp, TGSI_WRITEMASK_Z), - brw_swizzle1(tmp, 2), - brw_swizzle1(tmp, 0)); - } - - if (dst.dw1.bits.writemask & TGSI_WRITEMASK_W) { - /* result[3] = 1.0; */ - brw_MOV(p, brw_writemask(tmp, TGSI_WRITEMASK_W), brw_imm_f(1)); - } - - if (need_tmp) { - brw_MOV(p, dst, tmp); - release_tmp(c, tmp); - } -} - - - - -/* Need to unalias - consider swizzles: r0 = DST r0.xxxx r1 - */ -static void emit_dst_noalias( struct brw_vs_compile *c, - struct brw_reg dst, - struct brw_reg arg0, - struct brw_reg arg1) -{ - struct brw_compile *p = &c->func; - - /* There must be a better way to do this: - */ - if (dst.dw1.bits.writemask & TGSI_WRITEMASK_X) - brw_MOV(p, brw_writemask(dst, TGSI_WRITEMASK_X), brw_imm_f(1.0)); - if (dst.dw1.bits.writemask & TGSI_WRITEMASK_Y) - brw_MUL(p, brw_writemask(dst, TGSI_WRITEMASK_Y), arg0, arg1); - if (dst.dw1.bits.writemask & TGSI_WRITEMASK_Z) - brw_MOV(p, brw_writemask(dst, TGSI_WRITEMASK_Z), arg0); - if (dst.dw1.bits.writemask & TGSI_WRITEMASK_W) - brw_MOV(p, brw_writemask(dst, TGSI_WRITEMASK_W), arg1); -} - -static void emit_xpd( struct brw_compile *p, - struct brw_reg dst, - struct brw_reg t, - struct brw_reg u) -{ - brw_MUL(p, brw_null_reg(), brw_swizzle(t, 1,2,0,3), brw_swizzle(u,2,0,1,3)); - brw_MAC(p, dst, negate(brw_swizzle(t, 2,0,1,3)), brw_swizzle(u,1,2,0,3)); -} - - - -static void emit_lit_noalias( struct brw_vs_compile *c, - struct brw_reg dst, - struct brw_reg arg0 ) -{ - struct brw_compile *p = &c->func; - struct brw_instruction *if_insn; - struct brw_reg tmp = dst; - boolean need_tmp = (dst.file != BRW_GENERAL_REGISTER_FILE); - - if (need_tmp) - tmp = get_tmp(c); - - brw_MOV(p, brw_writemask(dst, TGSI_WRITEMASK_YZ), brw_imm_f(0)); - brw_MOV(p, brw_writemask(dst, TGSI_WRITEMASK_XW), brw_imm_f(1)); - - /* Need to use BRW_EXECUTE_8 and also do an 8-wide compare in order - * to get all channels active inside the IF. In the clipping code - * we run with NoMask, so it's not an option and we can use - * BRW_EXECUTE_1 for all comparisions. - */ - brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_G, brw_swizzle1(arg0,0), brw_imm_f(0)); - if_insn = brw_IF(p, BRW_EXECUTE_8); - { - brw_MOV(p, brw_writemask(dst, TGSI_WRITEMASK_Y), brw_swizzle1(arg0,0)); - - brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_G, brw_swizzle1(arg0,1), brw_imm_f(0)); - brw_MOV(p, brw_writemask(tmp, TGSI_WRITEMASK_Z), brw_swizzle1(arg0,1)); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - - emit_math2(c, - BRW_MATH_FUNCTION_POW, - brw_writemask(dst, TGSI_WRITEMASK_Z), - brw_swizzle1(tmp, 2), - brw_swizzle1(arg0, 3), - BRW_MATH_PRECISION_PARTIAL); - } - - brw_ENDIF(p, if_insn); -} - - - - - -/* TODO: relative addressing! - */ -static struct brw_reg get_reg( struct brw_vs_compile *c, - unsigned file, - unsigned index ) -{ - switch (file) { - case TGSI_FILE_TEMPORARY: - case TGSI_FILE_INPUT: - case TGSI_FILE_OUTPUT: - assert(c->regs[file][index].nr != 0); - return c->regs[file][index]; - case TGSI_FILE_CONSTANT: - assert(c->regs[TGSI_FILE_CONSTANT][index + c->prog_data.num_imm].nr != 0); - return c->regs[TGSI_FILE_CONSTANT][index + c->prog_data.num_imm]; - case TGSI_FILE_IMMEDIATE: - assert(c->regs[TGSI_FILE_CONSTANT][index].nr != 0); - return c->regs[TGSI_FILE_CONSTANT][index]; - case TGSI_FILE_ADDRESS: - assert(index == 0); - return c->regs[file][index]; - - case TGSI_FILE_NULL: /* undef values */ - return brw_null_reg(); - - default: - assert(0); - return brw_null_reg(); - } -} - - - -static struct brw_reg deref( struct brw_vs_compile *c, - struct brw_reg arg, - int offset) -{ - struct brw_compile *p = &c->func; - struct brw_reg tmp = vec4(get_tmp(c)); - struct brw_reg vp_address = retype(vec1(get_reg(c, TGSI_FILE_ADDRESS, 0)), BRW_REGISTER_TYPE_UW); - unsigned byte_offset = arg.nr * 32 + arg.subnr + offset * 16; - struct brw_reg indirect = brw_vec4_indirect(0,0); - - { - brw_push_insn_state(p); - brw_set_access_mode(p, BRW_ALIGN_1); - - /* This is pretty clunky - load the address register twice and - * fetch each 4-dword value in turn. There must be a way to do - * this in a single pass, but I couldn't get it to work. - */ - brw_ADD(p, brw_address_reg(0), vp_address, brw_imm_d(byte_offset)); - brw_MOV(p, tmp, indirect); - - brw_ADD(p, brw_address_reg(0), suboffset(vp_address, 8), brw_imm_d(byte_offset)); - brw_MOV(p, suboffset(tmp, 4), indirect); - - brw_pop_insn_state(p); - } - - return vec8(tmp); -} - - -static void emit_arl( struct brw_vs_compile *c, - struct brw_reg dst, - struct brw_reg arg0 ) -{ - struct brw_compile *p = &c->func; - struct brw_reg tmp = dst; - boolean need_tmp = (dst.file != BRW_GENERAL_REGISTER_FILE); - - if (need_tmp) - tmp = get_tmp(c); - - brw_RNDD(p, tmp, arg0); - brw_MUL(p, dst, tmp, brw_imm_d(16)); - - if (need_tmp) - release_tmp(c, tmp); -} - - -/* Will return mangled results for SWZ op. The emit_swz() function - * ignores this result and recalculates taking extended swizzles into - * account. - */ -static struct brw_reg get_arg( struct brw_vs_compile *c, - struct tgsi_src_register *src ) -{ - struct brw_reg reg; - - if (src->File == TGSI_FILE_NULL) - return brw_null_reg(); - -#if 0 - if (src->RelAddr) - reg = deref(c, c->regs[PROGRAM_STATE_VAR][0], src->Index); - else -#endif - reg = get_reg(c, src->File, src->Index); - - /* Convert 3-bit swizzle to 2-bit. - */ - reg.dw1.bits.swizzle = BRW_SWIZZLE4(src->SwizzleX, - src->SwizzleY, - src->SwizzleZ, - src->SwizzleW); - - /* Note this is ok for non-swizzle instructions: - */ - reg.negate = src->Negate ? 1 : 0; - - return reg; -} - - -static struct brw_reg get_dst( struct brw_vs_compile *c, - const struct tgsi_dst_register *dst ) -{ - struct brw_reg reg = get_reg(c, dst->File, dst->Index); - - reg.dw1.bits.writemask = dst->WriteMask; - - return reg; -} - - - - -static void emit_swz( struct brw_vs_compile *c, - struct brw_reg dst, - struct tgsi_src_register src ) -{ - struct brw_compile *p = &c->func; - unsigned zeros_mask = 0; - unsigned ones_mask = 0; - unsigned src_mask = 0; - ubyte src_swz[4]; - boolean need_tmp = (src.Negate && - dst.file != BRW_GENERAL_REGISTER_FILE); - struct brw_reg tmp = dst; - unsigned i; - - if (need_tmp) - tmp = get_tmp(c); - - for (i = 0; i < 4; i++) { - if (dst.dw1.bits.writemask & (1<regs[PROGRAM_STATE_VAR][0], src.Index); - else -#endif - arg0 = get_reg(c, src.File, src.Index); - - arg0 = brw_swizzle(arg0, - src_swz[0], src_swz[1], - src_swz[2], src_swz[3]); - - brw_MOV(p, brw_writemask(tmp, src_mask), arg0); - } - - if (zeros_mask) - brw_MOV(p, brw_writemask(tmp, zeros_mask), brw_imm_f(0)); - - if (ones_mask) - brw_MOV(p, brw_writemask(tmp, ones_mask), brw_imm_f(1)); - - if (src.Negate) - brw_MOV(p, brw_writemask(tmp, src.Negate), negate(tmp)); - - if (need_tmp) { - brw_MOV(p, dst, tmp); - release_tmp(c, tmp); - } -} - - - -/* Post-vertex-program processing. Send the results to the URB. - */ -static void emit_vertex_write( struct brw_vs_compile *c, struct brw_prog_info *info) -{ - struct brw_compile *p = &c->func; - struct brw_reg m0 = brw_message_reg(0); - struct brw_reg pos = c->regs[TGSI_FILE_OUTPUT][info->pos_idx]; - struct brw_reg ndc; - - if (c->key.copy_edgeflag) { - brw_MOV(p, - get_reg(c, TGSI_FILE_OUTPUT, info->result_edge_idx), - get_reg(c, TGSI_FILE_INPUT, info->edge_flag_idx)); - } - - - /* Build ndc coords? TODO: Shortcircuit when w is known to be one. - */ - if (!c->key.know_w_is_one) { - ndc = get_tmp(c); - emit_math1(c, BRW_MATH_FUNCTION_INV, ndc, brw_swizzle1(pos, 3), BRW_MATH_PRECISION_FULL); - brw_MUL(p, brw_writemask(ndc, TGSI_WRITEMASK_XYZ), pos, ndc); - } - else { - ndc = pos; - } - - /* This includes the workaround for -ve rhw, so is no longer an - * optional step: - */ - if (info->writes_psize || - c->key.nr_userclip || - !c->key.know_w_is_one) - { - struct brw_reg header1 = retype(get_tmp(c), BRW_REGISTER_TYPE_UD); - unsigned i; - - brw_MOV(p, header1, brw_imm_ud(0)); - - brw_set_access_mode(p, BRW_ALIGN_16); - - if (info->writes_psize) { - struct brw_reg psiz = c->regs[TGSI_FILE_OUTPUT][info->psize_idx]; - brw_MUL(p, brw_writemask(header1, TGSI_WRITEMASK_W), - brw_swizzle1(psiz, 0), brw_imm_f(1<<11)); - brw_AND(p, brw_writemask(header1, TGSI_WRITEMASK_W), header1, - brw_imm_ud(0x7ff<<8)); - } - - - for (i = 0; i < c->key.nr_userclip; i++) { - brw_set_conditionalmod(p, BRW_CONDITIONAL_L); - brw_DP4(p, brw_null_reg(), pos, c->userplane[i]); - brw_OR(p, brw_writemask(header1, TGSI_WRITEMASK_W), header1, brw_imm_ud(1<key.know_w_is_one) { - brw_CMP(p, - vec8(brw_null_reg()), - BRW_CONDITIONAL_L, - brw_swizzle1(ndc, 3), - brw_imm_f(0)); - - brw_OR(p, brw_writemask(header1, TGSI_WRITEMASK_W), header1, brw_imm_ud(1<<6)); - brw_MOV(p, ndc, brw_imm_f(0)); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - } - - brw_set_access_mode(p, BRW_ALIGN_1); /* why? */ - brw_MOV(p, retype(brw_message_reg(1), BRW_REGISTER_TYPE_UD), header1); - brw_set_access_mode(p, BRW_ALIGN_16); - - release_tmp(c, header1); - } - else { - brw_MOV(p, retype(brw_message_reg(1), BRW_REGISTER_TYPE_UD), brw_imm_ud(0)); - } - - - /* Emit the (interleaved) headers for the two vertices - an 8-reg - * of zeros followed by two sets of NDC coordinates: - */ - brw_set_access_mode(p, BRW_ALIGN_1); - brw_MOV(p, offset(m0, 2), ndc); - brw_MOV(p, offset(m0, 3), pos); - - - brw_urb_WRITE(p, - brw_null_reg(), /* dest */ - 0, /* starting mrf reg nr */ - c->r0, /* src */ - 0, /* allocate */ - 1, /* used */ - c->nr_outputs + 3, /* msg len */ - 0, /* response len */ - 1, /* eot */ - 1, /* writes complete */ - 0, /* urb destination offset */ - BRW_URB_SWIZZLE_INTERLEAVE); - -} - -static void -post_vs_emit( struct brw_vs_compile *c, struct brw_instruction *end_inst ) -{ - struct tgsi_parse_context parse; - const struct tgsi_token *tokens = c->vp->program.tokens; - tgsi_parse_init(&parse, tokens); - while (!tgsi_parse_end_of_tokens(&parse)) { - tgsi_parse_token(&parse); - if (parse.FullToken.Token.Type == TGSI_TOKEN_TYPE_INSTRUCTION) { -#if 0 - struct brw_instruction *brw_inst1, *brw_inst2; - const struct tgsi_full_instruction *inst1, *inst2; - int offset; - inst1 = &parse.FullToken.FullInstruction; - brw_inst1 = inst1->Data; - switch (inst1->Opcode) { - case TGSI_OPCODE_CAL: - case TGSI_OPCODE_BRA: - target_insn = inst1->BranchTarget; - inst2 = &c->vp->program.Base.Instructions[target_insn]; - brw_inst2 = inst2->Data; - offset = brw_inst2 - brw_inst1; - brw_set_src1(brw_inst1, brw_imm_d(offset*16)); - break; - case TGSI_OPCODE_END: - offset = end_inst - brw_inst1; - brw_set_src1(brw_inst1, brw_imm_d(offset*16)); - break; - default: - break; - } -#endif - } - } - tgsi_parse_free(&parse); -} - -static void process_declaration(const struct tgsi_full_declaration *decl, - struct brw_prog_info *info) -{ - int first = decl->DeclarationRange.First; - int last = decl->DeclarationRange.Last; - - switch(decl->Declaration.File) { - case TGSI_FILE_CONSTANT: - info->num_consts += last - first + 1; - break; - case TGSI_FILE_INPUT: { - } - break; - case TGSI_FILE_OUTPUT: { - assert(last == first); /* for now */ - if (decl->Declaration.Semantic) { - switch (decl->Semantic.SemanticName) { - case TGSI_SEMANTIC_POSITION: { - info->pos_idx = first; - } - break; - case TGSI_SEMANTIC_COLOR: - break; - case TGSI_SEMANTIC_BCOLOR: - break; - case TGSI_SEMANTIC_FOG: - break; - case TGSI_SEMANTIC_PSIZE: { - info->writes_psize = TRUE; - info->psize_idx = first; - } - break; - case TGSI_SEMANTIC_GENERIC: - break; - } - } - } - break; - case TGSI_FILE_TEMPORARY: { - info->num_temps += (last - first) + 1; - } - break; - case TGSI_FILE_SAMPLER: { - } - break; - case TGSI_FILE_ADDRESS: { - info->num_addrs += (last - first) + 1; - } - break; - case TGSI_FILE_IMMEDIATE: { - } - break; - case TGSI_FILE_NULL: { - } - break; - } -} - -static void process_instruction(struct brw_vs_compile *c, - struct tgsi_full_instruction *inst, - struct brw_prog_info *info) -{ - struct brw_reg args[3], dst; - struct brw_compile *p = &c->func; - /*struct brw_indirect stack_index = brw_indirect(0, 0);*/ - unsigned i; - unsigned index; - unsigned file; - /*FIXME: might not be the only one*/ - const struct tgsi_dst_register *dst_reg = &inst->FullDstRegisters[0].DstRegister; - /* - struct brw_instruction *if_inst[MAX_IFSN]; - unsigned insn, if_insn = 0; - */ - - for (i = 0; i < 3; i++) { - struct tgsi_full_src_register *src = &inst->FullSrcRegisters[i]; - index = src->SrcRegister.Index; - file = src->SrcRegister.File; - if (file == TGSI_FILE_OUTPUT && c->output_regs[index].used_in_src) - args[i] = c->output_regs[index].reg; - else - args[i] = get_arg(c, &src->SrcRegister); - } - - /* Get dest regs. Note that it is possible for a reg to be both - * dst and arg, given the static allocation of registers. So - * care needs to be taken emitting multi-operation instructions. - */ - index = dst_reg->Index; - file = dst_reg->File; - if (file == TGSI_FILE_OUTPUT && c->output_regs[index].used_in_src) - dst = c->output_regs[index].reg; - else - dst = get_dst(c, dst_reg); - - switch (inst->Instruction.Opcode) { - case TGSI_OPCODE_ABS: - brw_MOV(p, dst, brw_abs(args[0])); - break; - case TGSI_OPCODE_ADD: - brw_ADD(p, dst, args[0], args[1]); - break; - case TGSI_OPCODE_DP3: - brw_DP3(p, dst, args[0], args[1]); - break; - case TGSI_OPCODE_DP4: - brw_DP4(p, dst, args[0], args[1]); - break; - case TGSI_OPCODE_DPH: - brw_DPH(p, dst, args[0], args[1]); - break; - case TGSI_OPCODE_DST: - unalias2(c, dst, args[0], args[1], emit_dst_noalias); - break; - case TGSI_OPCODE_EXP: - unalias1(c, dst, args[0], emit_exp_noalias); - break; - case TGSI_OPCODE_EX2: - emit_math1(c, BRW_MATH_FUNCTION_EXP, dst, args[0], BRW_MATH_PRECISION_FULL); - break; - case TGSI_OPCODE_ARL: - emit_arl(c, dst, args[0]); - break; - case TGSI_OPCODE_FLR: - brw_RNDD(p, dst, args[0]); - break; - case TGSI_OPCODE_FRC: - brw_FRC(p, dst, args[0]); - break; - case TGSI_OPCODE_LOG: - unalias1(c, dst, args[0], emit_log_noalias); - break; - case TGSI_OPCODE_LG2: - emit_math1(c, BRW_MATH_FUNCTION_LOG, dst, args[0], BRW_MATH_PRECISION_FULL); - break; - case TGSI_OPCODE_LIT: - unalias1(c, dst, args[0], emit_lit_noalias); - break; - case TGSI_OPCODE_MAD: - brw_MOV(p, brw_acc_reg(), args[2]); - brw_MAC(p, dst, args[0], args[1]); - break; - case TGSI_OPCODE_MAX: - emit_max(p, dst, args[0], args[1]); - break; - case TGSI_OPCODE_MIN: - emit_min(p, dst, args[0], args[1]); - break; - case TGSI_OPCODE_MOV: - case TGSI_OPCODE_SWZ: -#if 0 - /* The args[0] value can't be used here as it won't have - * correctly encoded the full swizzle: - */ - emit_swz(c, dst, inst->SrcReg[0] ); -#endif - brw_MOV(p, dst, args[0]); - break; - case TGSI_OPCODE_MUL: - brw_MUL(p, dst, args[0], args[1]); - break; - case TGSI_OPCODE_POW: - emit_math2(c, BRW_MATH_FUNCTION_POW, dst, args[0], args[1], BRW_MATH_PRECISION_FULL); - break; - case TGSI_OPCODE_RCP: - emit_math1(c, BRW_MATH_FUNCTION_INV, dst, args[0], BRW_MATH_PRECISION_FULL); - break; - case TGSI_OPCODE_RSQ: - emit_math1(c, BRW_MATH_FUNCTION_RSQ, dst, args[0], BRW_MATH_PRECISION_FULL); - break; - - case TGSI_OPCODE_SEQ: - emit_seq(p, dst, args[0], args[1]); - break; - case TGSI_OPCODE_SNE: - emit_sne(p, dst, args[0], args[1]); - break; - case TGSI_OPCODE_SGE: - emit_sge(p, dst, args[0], args[1]); - break; - case TGSI_OPCODE_SGT: - emit_sgt(p, dst, args[0], args[1]); - break; - case TGSI_OPCODE_SLT: - emit_slt(p, dst, args[0], args[1]); - break; - case TGSI_OPCODE_SLE: - emit_sle(p, dst, args[0], args[1]); - break; - case TGSI_OPCODE_SUB: - brw_ADD(p, dst, args[0], negate(args[1])); - break; - case TGSI_OPCODE_XPD: - emit_xpd(p, dst, args[0], args[1]); - break; -#if 0 - case TGSI_OPCODE_IF: - assert(if_insn < MAX_IFSN); - if_inst[if_insn++] = brw_IF(p, BRW_EXECUTE_8); - break; - case TGSI_OPCODE_ELSE: - if_inst[if_insn-1] = brw_ELSE(p, if_inst[if_insn-1]); - break; - case TGSI_OPCODE_ENDIF: - assert(if_insn > 0); - brw_ENDIF(p, if_inst[--if_insn]); - break; - case TGSI_OPCODE_BRA: - brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); - brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16)); - brw_set_predicate_control_flag_value(p, 0xff); - break; - case TGSI_OPCODE_CAL: - brw_set_access_mode(p, BRW_ALIGN_1); - brw_ADD(p, deref_1uw(stack_index, 0), brw_ip_reg(), brw_imm_d(3*16)); - brw_set_access_mode(p, BRW_ALIGN_16); - brw_ADD(p, get_addr_reg(stack_index), - get_addr_reg(stack_index), brw_imm_d(4)); - inst->Data = &p->store[p->nr_insn]; - brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16)); - break; -#endif - case TGSI_OPCODE_RET: -#if 0 - brw_ADD(p, get_addr_reg(stack_index), - get_addr_reg(stack_index), brw_imm_d(-4)); - brw_set_access_mode(p, BRW_ALIGN_1); - brw_MOV(p, brw_ip_reg(), deref_1uw(stack_index, 0)); - brw_set_access_mode(p, BRW_ALIGN_16); -#else - /*brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16));*/ -#endif - break; - case TGSI_OPCODE_END: - brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16)); - break; - case TGSI_OPCODE_BGNSUB: - case TGSI_OPCODE_ENDSUB: - break; - default: - debug_printf("Unsupport opcode %d in vertex shader\n", inst->Instruction.Opcode); - break; - } - - if (dst_reg->File == TGSI_FILE_OUTPUT - && dst_reg->Index != info->pos_idx - && c->output_regs[dst_reg->Index].used_in_src) - brw_MOV(p, get_dst(c, dst_reg), dst); - - release_tmps(c); -} - -/* Emit the fragment program instructions here. - */ -void brw_vs_emit(struct brw_vs_compile *c) -{ -#define MAX_IFSN 32 - struct brw_compile *p = &c->func; - struct brw_instruction *end_inst; - struct tgsi_parse_context parse; - struct brw_indirect stack_index = brw_indirect(0, 0); - const struct tgsi_token *tokens = c->vp->program.tokens; - struct brw_prog_info prog_info; - unsigned allocated_registers = 0; - memset(&prog_info, 0, sizeof(struct brw_prog_info)); - - brw_set_compression_control(p, BRW_COMPRESSION_NONE); - brw_set_access_mode(p, BRW_ALIGN_16); - - tgsi_parse_init(&parse, tokens); - /* Message registers can't be read, so copy the output into GRF register - if they are used in source registers */ - while (!tgsi_parse_end_of_tokens(&parse)) { - tgsi_parse_token(&parse); - unsigned i; - switch (parse.FullToken.Token.Type) { - case TGSI_TOKEN_TYPE_INSTRUCTION: { - const struct tgsi_full_instruction *inst = &parse.FullToken.FullInstruction; - for (i = 0; i < 3; ++i) { - const struct tgsi_src_register *src = &inst->FullSrcRegisters[i].SrcRegister; - unsigned index = src->Index; - unsigned file = src->File; - if (file == TGSI_FILE_OUTPUT) - c->output_regs[index].used_in_src = TRUE; - } - } - break; - default: - /* nothing */ - break; - } - } - tgsi_parse_free(&parse); - - tgsi_parse_init(&parse, tokens); - - while (!tgsi_parse_end_of_tokens(&parse)) { - tgsi_parse_token(&parse); - - switch (parse.FullToken.Token.Type) { - case TGSI_TOKEN_TYPE_DECLARATION: { - struct tgsi_full_declaration *decl = &parse.FullToken.FullDeclaration; - process_declaration(decl, &prog_info); - } - break; - case TGSI_TOKEN_TYPE_IMMEDIATE: { - struct tgsi_full_immediate *imm = &parse.FullToken.FullImmediate; - assert(imm->Immediate.NrTokens == 4 + 1); - c->prog_data.imm_buf[c->prog_data.num_imm][0] = imm->u[0].Float; - c->prog_data.imm_buf[c->prog_data.num_imm][1] = imm->u[1].Float; - c->prog_data.imm_buf[c->prog_data.num_imm][2] = imm->u[2].Float; - c->prog_data.imm_buf[c->prog_data.num_imm][3] = imm->u[3].Float; - c->prog_data.num_imm++; - } - break; - case TGSI_TOKEN_TYPE_INSTRUCTION: { - struct tgsi_full_instruction *inst = &parse.FullToken.FullInstruction; - if (!allocated_registers) { - /* first instruction (declerations finished). - * now that we know what vars are being used allocate - * registers for them.*/ - c->prog_data.num_consts = prog_info.num_consts; - c->prog_data.max_const = prog_info.num_consts + c->prog_data.num_imm; - brw_vs_alloc_regs(c, &prog_info); - - brw_set_access_mode(p, BRW_ALIGN_1); - brw_MOV(p, get_addr_reg(stack_index), brw_address(c->stack)); - brw_set_access_mode(p, BRW_ALIGN_16); - allocated_registers = 1; - } - process_instruction(c, inst, &prog_info); - } - break; - } - } - - end_inst = &p->store[p->nr_insn]; - emit_vertex_write(c, &prog_info); - post_vs_emit(c, end_inst); - tgsi_parse_free(&parse); - -} diff --git a/src/gallium/drivers/i965simple/brw_vs_state.c b/src/gallium/drivers/i965simple/brw_vs_state.c deleted file mode 100644 index 1eaff87892..0000000000 --- a/src/gallium/drivers/i965simple/brw_vs_state.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#include "brw_context.h" -#include "brw_state.h" -#include "brw_defines.h" - -#include "util/u_math.h" -#include "util/u_memory.h" - -static void upload_vs_unit( struct brw_context *brw ) -{ - struct brw_vs_unit_state vs; - - memset(&vs, 0, sizeof(vs)); - - /* CACHE_NEW_VS_PROG */ - vs.thread0.kernel_start_pointer = brw->vs.prog_gs_offset >> 6; - vs.thread0.grf_reg_count = align(brw->vs.prog_data->total_grf, 16) / 16 - 1; - vs.thread3.urb_entry_read_length = brw->vs.prog_data->urb_read_length; - vs.thread3.const_urb_entry_read_length = brw->vs.prog_data->curb_read_length; - vs.thread3.dispatch_grf_start_reg = 1; - - - /* BRW_NEW_URB_FENCE */ - vs.thread4.nr_urb_entries = brw->urb.nr_vs_entries; - vs.thread4.urb_entry_allocation_size = brw->urb.vsize - 1; - vs.thread4.max_threads = MIN2( - MAX2(0, (brw->urb.nr_vs_entries - 6) / 2 - 1), - 15); - - - - if (BRW_DEBUG & DEBUG_SINGLE_THREAD) - vs.thread4.max_threads = 0; - - /* BRW_NEW_CURBE_OFFSETS, _NEW_TRANSFORM */ - if (0 /*brw->attribs.Clip->ClipPlanesEnabled*/) { - /* Note that we read in the userclip planes as well, hence - * clip_start: - */ - vs.thread3.const_urb_entry_read_offset = brw->curbe.clip_start * 2; - } - else { - vs.thread3.const_urb_entry_read_offset = brw->curbe.vs_start * 2; - } - - vs.thread1.floating_point_mode = BRW_FLOATING_POINT_NON_IEEE_754; - vs.thread3.urb_entry_read_offset = 0; - - /* No samplers for ARB_vp programs: - */ - vs.vs5.sampler_count = 0; - - if (BRW_DEBUG & DEBUG_STATS) - vs.thread4.stats_enable = 1; - - /* Vertex program always enabled: - */ - vs.vs6.vs_enable = 1; - - brw->vs.state_gs_offset = brw_cache_data( &brw->cache[BRW_VS_UNIT], &vs ); -} - - -const struct brw_tracked_state brw_vs_unit = { - .dirty = { - .brw = (BRW_NEW_CLIP | - BRW_NEW_CURBE_OFFSETS | - BRW_NEW_URB_FENCE), - .cache = CACHE_NEW_VS_PROG - }, - .update = upload_vs_unit -}; diff --git a/src/gallium/drivers/i965simple/brw_winsys.h b/src/gallium/drivers/i965simple/brw_winsys.h deleted file mode 100644 index ec1e400418..0000000000 --- a/src/gallium/drivers/i965simple/brw_winsys.h +++ /dev/null @@ -1,209 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * 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. - * - **************************************************************************/ - -/** - * \file - * This is the interface that i965simple requires any window system - * hosting it to implement. This is the only include file in i965simple - * which is public. - * - */ - -#ifndef BRW_WINSYS_H -#define BRW_WINSYS_H - - -#include "pipe/p_defines.h" - - -/* Pipe drivers are (meant to be!) independent of both GL and the - * window system. The window system provides a buffer manager and a - * set of additional hooks for things like command buffer submission, - * etc. - * - * There clearly has to be some agreement between the window system - * driver and the hardware driver about the format of command buffers, - * etc. - */ - -struct pipe_buffer; -struct pipe_fence_handle; -struct pipe_winsys; -struct pipe_screen; - - -/* The pipe driver currently understands the following chipsets: - */ -#define PCI_CHIP_I965_G 0x29A2 -#define PCI_CHIP_I965_Q 0x2992 -#define PCI_CHIP_I965_G_1 0x2982 -#define PCI_CHIP_I965_GM 0x2A02 -#define PCI_CHIP_I965_GME 0x2A12 - - -/* These are the names of all the state caches managed by the driver. - * - * When data is uploaded to a buffer with buffer_subdata, we use the - * special version of that function below so that information about - * what type of data this is can be passed to the winsys backend. - * That in turn allows the correct flags to be set in the aub file - * dump to allow human-readable file dumps later on. - */ - -enum brw_cache_id { - BRW_CC_VP, - BRW_CC_UNIT, - BRW_WM_PROG, - BRW_SAMPLER_DEFAULT_COLOR, - BRW_SAMPLER, - BRW_WM_UNIT, - BRW_SF_PROG, - BRW_SF_VP, - BRW_SF_UNIT, - BRW_VS_UNIT, - BRW_VS_PROG, - BRW_GS_UNIT, - BRW_GS_PROG, - BRW_CLIP_VP, - BRW_CLIP_UNIT, - BRW_CLIP_PROG, - BRW_SS_SURFACE, - BRW_SS_SURF_BIND, - - BRW_MAX_CACHE -}; - -#define BRW_CONSTANT_BUFFER BRW_MAX_CACHE - -/** - * Additional winsys interface for i965simple. - * - * It is an over-simple batchbuffer mechanism. Will want to improve the - * performance of this, perhaps based on the cmdstream stuff. It - * would be pretty impossible to implement swz on top of this - * interface. - * - * Will also need additions/changes to implement static/dynamic - * indirect state. - */ -struct brw_winsys { - - void (*destroy)(struct brw_winsys *); - - /** - * Reserve space on batch buffer. - * - * Returns a null pointer if there is insufficient space in the batch buffer - * to hold the requested number of dwords and relocations. - * - * The number of dwords should also include the number of relocations. - */ - unsigned *(*batch_start)(struct brw_winsys *sws, - unsigned dwords, - unsigned relocs); - - void (*batch_dword)(struct brw_winsys *sws, - unsigned dword); - - /** - * Emit a relocation to a buffer. - * - * Used not only when the buffer addresses are not pinned, but also to - * ensure refered buffers will not be destroyed until the current batch - * buffer execution is finished. - * - * The access flags is a combination of I915_BUFFER_ACCESS_WRITE and - * I915_BUFFER_ACCESS_READ macros. - */ - void (*batch_reloc)(struct brw_winsys *sws, - struct pipe_buffer *buf, - unsigned access_flags, - unsigned delta); - - - /* Not used yet, but really want this: - */ - void (*batch_end)( struct brw_winsys *sws ); - - /** - * Flush the batch buffer. - * - * Fence argument must point to NULL or to a previous fence, and the caller - * must call fence_reference when done with the fence. - */ - void (*batch_flush)(struct brw_winsys *sws, - struct pipe_fence_handle **fence); - - - /* A version of buffer_subdata that includes information for the - * simulator: - */ - void (*buffer_subdata_typed)(struct brw_winsys *sws, - struct pipe_buffer *buf, - unsigned long offset, - unsigned long size, - const void *data, - unsigned data_type); - - - /* A cheat so we don't have to think about relocations in a couple - * of places yet: - */ - unsigned (*get_buffer_offset)( struct brw_winsys *sws, - struct pipe_buffer *buf, - unsigned flags ); - -}; - -#define BRW_BUFFER_ACCESS_WRITE 0x1 -#define BRW_BUFFER_ACCESS_READ 0x2 - -#define BRW_BUFFER_USAGE_LIT_VERTEX (PIPE_BUFFER_USAGE_CUSTOM << 0) - - -struct pipe_context *brw_create(struct pipe_screen *, - struct brw_winsys *, - unsigned pci_id); - -static inline boolean brw_batchbuffer_data(struct brw_winsys *winsys, - const void *data, - unsigned bytes) -{ - static const unsigned incr = sizeof(unsigned); - uint i; - const unsigned *udata = (const unsigned*)(data); - unsigned size = bytes/incr; - - winsys->batch_start(winsys, size, 0); - for (i = 0; i < size; ++i) { - winsys->batch_dword(winsys, udata[i]); - } - winsys->batch_end(winsys); - - return (i == size); -} -#endif diff --git a/src/gallium/drivers/i965simple/brw_wm.c b/src/gallium/drivers/i965simple/brw_wm.c deleted file mode 100644 index 10161f2d2f..0000000000 --- a/src/gallium/drivers/i965simple/brw_wm.c +++ /dev/null @@ -1,209 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#include "brw_context.h" -#include "brw_util.h" -#include "brw_wm.h" -#include "brw_eu.h" -#include "brw_state.h" -#include "util/u_memory.h" - - - -static void do_wm_prog( struct brw_context *brw, - struct brw_fragment_program *fp, - struct brw_wm_prog_key *key) -{ - struct brw_wm_compile *c = CALLOC_STRUCT(brw_wm_compile); - const unsigned *program; - unsigned program_size; - - c->key = *key; - c->fp = fp; - - c->delta_xy[0] = brw_null_reg(); - c->delta_xy[1] = brw_null_reg(); - c->pixel_xy[0] = brw_null_reg(); - c->pixel_xy[1] = brw_null_reg(); - c->pixel_w = brw_null_reg(); - - - debug_printf("XXXXXXXX FP\n"); - - brw_wm_glsl_emit(c); - - /* get the program - */ - program = brw_get_program(&c->func, &program_size); - - /* - */ - brw->wm.prog_gs_offset = brw_upload_cache( &brw->cache[BRW_WM_PROG], - &c->key, - sizeof(c->key), - program, - program_size, - &c->prog_data, - &brw->wm.prog_data ); - - FREE(c); -} - - - -static void brw_wm_populate_key( struct brw_context *brw, - struct brw_wm_prog_key *key ) -{ - /* BRW_NEW_FRAGMENT_PROGRAM */ - struct brw_fragment_program *fp = - (struct brw_fragment_program *)brw->attribs.FragmentProgram; - unsigned lookup = 0; - unsigned line_aa; - - memset(key, 0, sizeof(*key)); - - /* Build the index for table lookup - */ - /* BRW_NEW_DEPTH_STENCIL */ - if (fp->info.uses_kill || - brw->attribs.DepthStencil->alpha.enabled) - lookup |= IZ_PS_KILL_ALPHATEST_BIT; - - if (fp->info.writes_z) - lookup |= IZ_PS_COMPUTES_DEPTH_BIT; - - if (brw->attribs.DepthStencil->depth.enabled) - lookup |= IZ_DEPTH_TEST_ENABLE_BIT; - - if (brw->attribs.DepthStencil->depth.enabled && - brw->attribs.DepthStencil->depth.writemask) /* ?? */ - lookup |= IZ_DEPTH_WRITE_ENABLE_BIT; - - if (brw->attribs.DepthStencil->stencil[0].enabled) { - lookup |= IZ_STENCIL_TEST_ENABLE_BIT; - - if (brw->attribs.DepthStencil->stencil[0].writemask || - brw->attribs.DepthStencil->stencil[1].writemask) - lookup |= IZ_STENCIL_WRITE_ENABLE_BIT; - } - - /* XXX: when should this be disabled? - */ - if (1) - lookup |= IZ_EARLY_DEPTH_TEST_BIT; - - - line_aa = AA_NEVER; - - /* _NEW_LINE, _NEW_POLYGON, BRW_NEW_REDUCED_PRIMITIVE */ - if (brw->attribs.Raster->line_smooth) { - if (brw->reduced_primitive == PIPE_PRIM_LINES) { - line_aa = AA_ALWAYS; - } - else if (brw->reduced_primitive == PIPE_PRIM_TRIANGLES) { - if (brw->attribs.Raster->fill_ccw == PIPE_POLYGON_MODE_LINE) { - line_aa = AA_SOMETIMES; - - if (brw->attribs.Raster->fill_cw == PIPE_POLYGON_MODE_LINE || - (brw->attribs.Raster->cull_mode == PIPE_WINDING_CW)) - line_aa = AA_ALWAYS; - } - else if (brw->attribs.Raster->fill_cw == PIPE_POLYGON_MODE_LINE) { - line_aa = AA_SOMETIMES; - - if (brw->attribs.Raster->cull_mode == PIPE_WINDING_CCW) - line_aa = AA_ALWAYS; - } - } - } - - brw_wm_lookup_iz(line_aa, - lookup, - key); - - -#if 0 - /* BRW_NEW_SAMPLER - * - * Not doing any of this at the moment: - */ - for (i = 0; i < BRW_MAX_TEX_UNIT; i++) { - const struct pipe_sampler_state *unit = brw->attribs.Samplers[i]; - - if (unit) { - - if (unit->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) { - key->shadowtex_mask |= 1<Image[0][t->BaseLevel]->InternalFormat == GL_YCBCR_MESA) - key->yuvtex_mask |= 1<program_string_id = fp->id; - -} - - -static void brw_upload_wm_prog( struct brw_context *brw ) -{ - struct brw_wm_prog_key key; - struct brw_fragment_program *fp = (struct brw_fragment_program *) - brw->attribs.FragmentProgram; - - brw_wm_populate_key(brw, &key); - - /* Make an early check for the key. - */ - if (brw_search_cache(&brw->cache[BRW_WM_PROG], - &key, sizeof(key), - &brw->wm.prog_data, - &brw->wm.prog_gs_offset)) - return; - - do_wm_prog(brw, fp, &key); -} - - -const struct brw_tracked_state brw_wm_prog = { - .dirty = { - .brw = (BRW_NEW_FS | - BRW_NEW_REDUCED_PRIMITIVE), - .cache = 0 - }, - .update = brw_upload_wm_prog -}; - diff --git a/src/gallium/drivers/i965simple/brw_wm.h b/src/gallium/drivers/i965simple/brw_wm.h deleted file mode 100644 index b29c4393f0..0000000000 --- a/src/gallium/drivers/i965simple/brw_wm.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#ifndef BRW_WM_H -#define BRW_WM_H - - -#include "brw_context.h" -#include "brw_eu.h" - -/* A big lookup table is used to figure out which and how many - * additional regs will inserted before the main payload in the WM - * program execution. These mainly relate to depth and stencil - * processing and the early-depth-test optimization. - */ -#define IZ_PS_KILL_ALPHATEST_BIT 0x1 -#define IZ_PS_COMPUTES_DEPTH_BIT 0x2 -#define IZ_DEPTH_WRITE_ENABLE_BIT 0x4 -#define IZ_DEPTH_TEST_ENABLE_BIT 0x8 -#define IZ_STENCIL_WRITE_ENABLE_BIT 0x10 -#define IZ_STENCIL_TEST_ENABLE_BIT 0x20 -#define IZ_EARLY_DEPTH_TEST_BIT 0x40 -#define IZ_BIT_MAX 0x80 - -#define AA_NEVER 0 -#define AA_SOMETIMES 1 -#define AA_ALWAYS 2 - -struct brw_wm_prog_key { - unsigned source_depth_reg:3; - unsigned aa_dest_stencil_reg:3; - unsigned dest_depth_reg:3; - unsigned nr_depth_regs:3; - unsigned shadowtex_mask:8; - unsigned computes_depth:1; /* could be derived from program string */ - unsigned source_depth_to_render_target:1; - unsigned runtime_check_aads_emit:1; - - unsigned yuvtex_mask:8; - - unsigned program_string_id; -}; - - - - - -#define PROGRAM_INTERNAL_PARAM -#define MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS 1024 /* 72 for GL_ARB_f_p */ -#define BRW_WM_MAX_INSN (MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS*3 + PIPE_MAX_ATTRIBS + 3) -#define BRW_WM_MAX_GRF 128 /* hardware limit */ -#define BRW_WM_MAX_VREG (BRW_WM_MAX_INSN * 4) -#define BRW_WM_MAX_REF (BRW_WM_MAX_INSN * 12) -#define BRW_WM_MAX_PARAM 256 -#define BRW_WM_MAX_CONST 256 -#define BRW_WM_MAX_KILLS MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS - -#define PAYLOAD_DEPTH (PIPE_MAX_ATTRIBS) - -#define MAX_IFSN 32 -#define MAX_LOOP_DEPTH 32 - -struct brw_wm_compile { - struct brw_compile func; - struct brw_wm_prog_key key; - struct brw_wm_prog_data prog_data; /* result */ - - struct brw_fragment_program *fp; - - unsigned grf_limit; - unsigned max_wm_grf; - - - struct brw_reg pixel_xy[2]; - struct brw_reg delta_xy[2]; - struct brw_reg pixel_w; - - - struct brw_reg wm_regs[8][32][4]; - - struct brw_reg payload_depth[4]; - struct brw_reg payload_coef[16]; - - struct brw_reg emit_mask_reg; - - struct brw_instruction *if_inst[MAX_IFSN]; - int if_insn; - - struct brw_instruction *loop_inst[MAX_LOOP_DEPTH]; - int loop_insn; - - struct brw_instruction *inst0; - struct brw_instruction *inst1; - - struct brw_reg stack; - struct brw_indirect stack_index; - - unsigned reg_index; - - unsigned tmp_start; - unsigned tmp_index; -}; - - - -void brw_wm_lookup_iz( unsigned line_aa, - unsigned lookup, - struct brw_wm_prog_key *key ); - -void brw_wm_glsl_emit(struct brw_wm_compile *c); -void brw_wm_emit_decls(struct brw_wm_compile *c); - -#endif diff --git a/src/gallium/drivers/i965simple/brw_wm_decl.c b/src/gallium/drivers/i965simple/brw_wm_decl.c deleted file mode 100644 index d50e66f613..0000000000 --- a/src/gallium/drivers/i965simple/brw_wm_decl.c +++ /dev/null @@ -1,392 +0,0 @@ - -#include "brw_context.h" -#include "brw_eu.h" -#include "brw_wm.h" -#include "util/u_math.h" -#include "util/u_memory.h" -#include "pipe/p_shader_tokens.h" -#include "tgsi/tgsi_parse.h" - -static struct brw_reg alloc_tmp(struct brw_wm_compile *c) -{ - c->tmp_index++; - c->reg_index = MAX2(c->reg_index, c->tmp_start + c->tmp_index); - return brw_vec8_grf(c->tmp_start + c->tmp_index, 0); -} - -static void release_tmps(struct brw_wm_compile *c) -{ - c->tmp_index = 0; -} - - - -static int is_null( struct brw_reg reg ) -{ - return (reg.file == BRW_ARCHITECTURE_REGISTER_FILE && - reg.nr == BRW_ARF_NULL); -} - -static void emit_pixel_xy( struct brw_wm_compile *c ) -{ - if (is_null(c->pixel_xy[0])) { - - struct brw_compile *p = &c->func; - struct brw_reg r1_uw = retype(brw_vec1_grf(1, 0), BRW_REGISTER_TYPE_UW); - - c->pixel_xy[0] = vec8(retype(alloc_tmp(c), BRW_REGISTER_TYPE_UW)); - c->pixel_xy[1] = vec8(retype(alloc_tmp(c), BRW_REGISTER_TYPE_UW)); - - /* Calculate pixel centers by adding 1 or 0 to each of the - * micro-tile coordinates passed in r1. - */ - brw_ADD(p, - c->pixel_xy[0], - stride(suboffset(r1_uw, 4), 2, 4, 0), - brw_imm_v(0x10101010)); - - brw_ADD(p, - c->pixel_xy[1], - stride(suboffset(r1_uw, 5), 2, 4, 0), - brw_imm_v(0x11001100)); - } -} - - - - - - -static void emit_delta_xy( struct brw_wm_compile *c ) -{ - if (is_null(c->delta_xy[0])) { - struct brw_compile *p = &c->func; - struct brw_reg r1 = brw_vec1_grf(1, 0); - - emit_pixel_xy(c); - - c->delta_xy[0] = alloc_tmp(c); - c->delta_xy[1] = alloc_tmp(c); - - /* Calc delta X,Y by subtracting origin in r1 from the pixel - * centers. - */ - brw_ADD(p, - c->delta_xy[0], - retype(c->pixel_xy[0], BRW_REGISTER_TYPE_UW), - negate(r1)); - - brw_ADD(p, - c->delta_xy[1], - retype(c->pixel_xy[1], BRW_REGISTER_TYPE_UW), - negate(suboffset(r1,1))); - } -} - - - -#if 0 -static void emit_pixel_w( struct brw_wm_compile *c ) -{ - if (is_null(c->pixel_w)) { - struct brw_compile *p = &c->func; - - struct brw_reg interp_wpos = c->coef_wpos; - - c->pixel_w = alloc_tmp(c); - - emit_delta_xy(c); - - /* Calc 1/w - just linterp wpos[3] optimized by putting the - * result straight into a message reg. - */ - struct brw_reg interp3 = brw_vec1_grf(interp_wpos.nr+1, 4); - brw_LINE(p, brw_null_reg(), interp3, c->delta_xy[0]); - brw_MAC(p, brw_message_reg(2), suboffset(interp3, 1), c->delta_xy[1]); - - /* Calc w */ - brw_math_16( p, - c->pixel_w, - BRW_MATH_FUNCTION_INV, - BRW_MATH_SATURATE_NONE, - 2, - brw_null_reg(), - BRW_MATH_PRECISION_FULL); - } -} -#endif - - -static void emit_cinterp(struct brw_wm_compile *c, - int idx, - int mask ) -{ - struct brw_compile *p = &c->func; - struct brw_reg interp[4]; - struct brw_reg coef = c->payload_coef[idx]; - int i; - - interp[0] = brw_vec1_grf(coef.nr, 0); - interp[1] = brw_vec1_grf(coef.nr, 4); - interp[2] = brw_vec1_grf(coef.nr+1, 0); - interp[3] = brw_vec1_grf(coef.nr+1, 4); - - for(i = 0; i < 4; i++ ) { - if (mask & (1<wm_regs[TGSI_FILE_INPUT][idx][i]; - brw_MOV(p, dst, suboffset(interp[i],3)); - } - } -} - -static void emit_linterp(struct brw_wm_compile *c, - int idx, - int mask ) -{ - struct brw_compile *p = &c->func; - struct brw_reg interp[4]; - struct brw_reg coef = c->payload_coef[idx]; - int i; - - emit_delta_xy(c); - - interp[0] = brw_vec1_grf(coef.nr, 0); - interp[1] = brw_vec1_grf(coef.nr, 4); - interp[2] = brw_vec1_grf(coef.nr+1, 0); - interp[3] = brw_vec1_grf(coef.nr+1, 4); - - for(i = 0; i < 4; i++ ) { - if (mask & (1<wm_regs[TGSI_FILE_INPUT][idx][i]; - brw_LINE(p, brw_null_reg(), interp[i], c->delta_xy[0]); - brw_MAC(p, dst, suboffset(interp[i],1), c->delta_xy[1]); - } - } -} - -#if 0 -static void emit_pinterp(struct brw_wm_compile *c, - int idx, - int mask ) -{ - struct brw_compile *p = &c->func; - struct brw_reg interp[4]; - struct brw_reg coef = c->payload_coef[idx]; - int i; - - get_delta_xy(c); - get_pixel_w(c); - - interp[0] = brw_vec1_grf(coef.nr, 0); - interp[1] = brw_vec1_grf(coef.nr, 4); - interp[2] = brw_vec1_grf(coef.nr+1, 0); - interp[3] = brw_vec1_grf(coef.nr+1, 4); - - for(i = 0; i < 4; i++ ) { - if (mask & (1<delta_xy[0]); - brw_MAC(p, dst, suboffset(interp[i],1), c->delta_xy[1]); - brw_MUL(p, dst, dst, c->pixel_w); - } - } -} -#endif - - - -#if 0 -static void emit_wpos( ) -{ - struct prog_dst_register dst = dst_reg(PROGRAM_INPUT, idx); - struct tgsi_full_src_register interp = src_reg(PROGRAM_PAYLOAD, idx); - struct tgsi_full_src_register deltas = get_delta_xy(c); - struct tgsi_full_src_register arg2; - unsigned opcode; - - opcode = WM_LINTERP; - arg2 = src_undef(); - - /* Have to treat wpos.xy specially: - */ - emit_op(c, - WM_WPOSXY, - dst_mask(dst, WRITEMASK_XY), - 0, 0, 0, - get_pixel_xy(c), - src_undef(), - src_undef()); - - dst = dst_mask(dst, WRITEMASK_ZW); - - /* PROGRAM_INPUT.attr.xyzw = INTERP payload.interp[attr].x, deltas.xyw - */ - emit_op(c, - WM_LINTERP, - dst, - 0, 0, 0, - interp, - deltas, - arg2); -} -#endif - - - - -/* Perform register allocation: - * - * -- r0??? - * -- passthrough depth regs (and stencil/aa??) - * -- curbe ?? - * -- inputs (coefficients) - * - * Use a totally static register allocation. This will perform poorly - * but is an easy way to get started (again). - */ -static void prealloc_reg(struct brw_wm_compile *c) -{ - int i, j; - int nr_curbe_regs = 0; - - /* R0, then some depth related regs: - */ - for (i = 0; i < c->key.nr_depth_regs; i++) { - c->payload_depth[i] = brw_vec8_grf(i*2, 0); - c->reg_index += 2; - } - - - /* Then a copy of our part of the CURBE entry: - */ - { - int nr_constants = c->fp->info.file_max[TGSI_FILE_CONSTANT] + 1; - int index = 0; - - /* XXX number of constants, or highest numbered constant? */ - assert(nr_constants == c->fp->info.file_count[TGSI_FILE_CONSTANT]); - - c->prog_data.max_const = 4*nr_constants; - for (i = 0; i < nr_constants; i++) { - for (j = 0; j < 4; j++, index++) - c->wm_regs[TGSI_FILE_CONSTANT][i][j] = brw_vec1_grf(c->reg_index + index/8, - index%8); - } - - nr_curbe_regs = 2*((4*nr_constants+15)/16); - c->reg_index += nr_curbe_regs; - } - - /* Adjust for parameter coefficients for position, which are - * currently always provided. - */ -// c->position_coef[i] = brw_vec8_grf(c->reg_index, 0); - c->reg_index += 2; - - /* Next we receive the plane coefficients for parameter - * interpolation: - */ - assert(c->fp->info.file_max[TGSI_FILE_INPUT] == c->fp->info.num_inputs); - for (i = 0; i < c->fp->info.file_max[TGSI_FILE_INPUT] + 1; i++) { - c->payload_coef[i] = brw_vec8_grf(c->reg_index, 0); - c->reg_index += 2; - } - - c->prog_data.first_curbe_grf = c->key.nr_depth_regs * 2; - c->prog_data.urb_read_length = (c->fp->info.num_inputs + 1) * 2; - c->prog_data.curb_read_length = nr_curbe_regs; - - /* That's the end of the payload, now we can start allocating registers. - */ - c->emit_mask_reg = brw_uw1_reg(BRW_GENERAL_REGISTER_FILE, c->reg_index, 0); - c->reg_index++; - - c->stack = brw_uw16_reg(BRW_GENERAL_REGISTER_FILE, c->reg_index, 0); - c->reg_index += 2; - - /* Now allocate room for the interpolated inputs and staging - * registers for the outputs: - */ - /* XXX do we want to loop over the _number_ of inputs/outputs or loop - * to the highest input/output index that's used? - * Probably the same, actually. - */ - assert(c->fp->info.file_max[TGSI_FILE_INPUT] + 1 == c->fp->info.num_inputs); - assert(c->fp->info.file_max[TGSI_FILE_OUTPUT] + 1 == c->fp->info.num_outputs); - for (i = 0; i < c->fp->info.file_max[TGSI_FILE_INPUT] + 1; i++) - for (j = 0; j < 4; j++) - c->wm_regs[TGSI_FILE_INPUT][i][j] = brw_vec8_grf( c->reg_index++, 0 ); - - for (i = 0; i < c->fp->info.file_max[TGSI_FILE_OUTPUT] + 1; i++) - for (j = 0; j < 4; j++) - c->wm_regs[TGSI_FILE_OUTPUT][i][j] = brw_vec8_grf( c->reg_index++, 0 ); - - /* Beyond this we should only need registers for internal temporaries: - */ - c->tmp_start = c->reg_index; -} - - - - - -/* Need to interpolate fragment program inputs in as a preamble to the - * shader. A more sophisticated compiler would do this on demand, but - * we'll do it up front: - */ -void brw_wm_emit_decls(struct brw_wm_compile *c) -{ - struct tgsi_parse_context parse; - int done = 0; - - prealloc_reg(c); - - tgsi_parse_init( &parse, c->fp->program.tokens ); - - while( !done && - !tgsi_parse_end_of_tokens( &parse ) ) - { - tgsi_parse_token( &parse ); - - switch( parse.FullToken.Token.Type ) { - case TGSI_TOKEN_TYPE_DECLARATION: - { - const struct tgsi_full_declaration *decl = &parse.FullToken.FullDeclaration; - unsigned first = decl->DeclarationRange.First; - unsigned last = decl->DeclarationRange.Last; - unsigned mask = decl->Declaration.UsageMask; /* ? */ - unsigned i; - - if (decl->Declaration.File != TGSI_FILE_INPUT) - break; - - for( i = first; i <= last; i++ ) { - switch (decl->Declaration.Interpolate) { - case TGSI_INTERPOLATE_CONSTANT: - emit_cinterp(c, i, mask); - break; - - case TGSI_INTERPOLATE_LINEAR: - emit_linterp(c, i, mask); - break; - - case TGSI_INTERPOLATE_PERSPECTIVE: - //emit_pinterp(c, i, mask); - emit_linterp(c, i, mask); - break; - } - } - break; - } - case TGSI_TOKEN_TYPE_IMMEDIATE: - case TGSI_TOKEN_TYPE_INSTRUCTION: - default: - done = 1; - break; - } - } - - tgsi_parse_free (&parse); - - release_tmps(c); -} diff --git a/src/gallium/drivers/i965simple/brw_wm_glsl.c b/src/gallium/drivers/i965simple/brw_wm_glsl.c deleted file mode 100644 index db75963932..0000000000 --- a/src/gallium/drivers/i965simple/brw_wm_glsl.c +++ /dev/null @@ -1,1076 +0,0 @@ - -#include "brw_context.h" -#include "brw_eu.h" -#include "brw_wm.h" -#include "util/u_math.h" -#include "util/u_memory.h" -#include "pipe/p_shader_tokens.h" -#include "tgsi/tgsi_parse.h" - - - -static int get_scalar_dst_index(struct tgsi_full_instruction *inst) -{ - struct tgsi_dst_register dst = inst->FullDstRegisters[0].DstRegister; - int i; - for (i = 0; i < 4; i++) - if (dst.WriteMask & (1<tmp_index++; - c->reg_index = MAX2(c->reg_index, c->tmp_index); - return brw_vec8_grf(c->tmp_start + c->tmp_index, 0); -} - -static void release_tmps(struct brw_wm_compile *c) -{ - c->tmp_index = 0; -} - - -static struct brw_reg -get_reg(struct brw_wm_compile *c, int file, int index, int component ) -{ - switch (file) { - case TGSI_FILE_NULL: - return brw_null_reg(); - - case TGSI_FILE_SAMPLER: - /* Should never get here: - */ - assert (0); - return brw_null_reg(); - - case TGSI_FILE_IMMEDIATE: - /* These need a different path: - */ - assert(0); - return brw_null_reg(); - - - case TGSI_FILE_CONSTANT: - case TGSI_FILE_INPUT: - case TGSI_FILE_OUTPUT: - case TGSI_FILE_TEMPORARY: - case TGSI_FILE_ADDRESS: - return c->wm_regs[file][index][component]; - - default: - assert(0); - return brw_null_reg(); - } -} - - -static struct brw_reg get_dst_reg(struct brw_wm_compile *c, - struct tgsi_full_instruction *inst, - int component) -{ - return get_reg(c, - inst->FullDstRegisters[0].DstRegister.File, - inst->FullDstRegisters[0].DstRegister.Index, - component); -} - -static int get_swz( struct tgsi_src_register src, int index ) -{ - switch (index & 3) { - case 0: return src.SwizzleX; - case 1: return src.SwizzleY; - case 2: return src.SwizzleZ; - case 3: return src.SwizzleW; - default: return 0; - } -} - -static int get_ext_swz( struct tgsi_src_register_ext_swz src, int index ) -{ - switch (index & 3) { - case 0: return src.ExtSwizzleX; - case 1: return src.ExtSwizzleY; - case 2: return src.ExtSwizzleZ; - case 3: return src.ExtSwizzleW; - default: return 0; - } -} - -static struct brw_reg get_src_reg(struct brw_wm_compile *c, - struct tgsi_full_src_register *src, - int index) -{ - struct brw_reg reg; - int component = index; - int neg = 0; - int abs = 0; - - if (src->SrcRegister.Negate) - neg = 1; - - component = get_swz(src->SrcRegister, component); - - /* Yes, there are multiple negates: - */ - switch (component & 3) { - case 0: neg ^= src->SrcRegisterExtSwz.NegateX; break; - case 1: neg ^= src->SrcRegisterExtSwz.NegateY; break; - case 2: neg ^= src->SrcRegisterExtSwz.NegateZ; break; - case 3: neg ^= src->SrcRegisterExtSwz.NegateW; break; - } - - /* And multiple swizzles, fun isn't it: - */ - component = get_ext_swz(src->SrcRegisterExtSwz, component); - - /* Not handling indirect lookups yet: - */ - assert(src->SrcRegister.Indirect == 0); - - /* Don't know what dimension means: - */ - assert(src->SrcRegister.Dimension == 0); - - /* Will never handle any of this stuff: - */ - assert(src->SrcRegisterExtMod.Complement == 0); - assert(src->SrcRegisterExtMod.Bias == 0); - assert(src->SrcRegisterExtMod.Scale2X == 0); - - if (src->SrcRegisterExtMod.Absolute) - abs = 1; - - /* Another negate! This is a post-absolute negate, which we - * can't do. Need to clean the crap out of tgsi somehow. - */ - assert(src->SrcRegisterExtMod.Negate == 0); - - switch( component ) { - case TGSI_EXTSWIZZLE_X: - case TGSI_EXTSWIZZLE_Y: - case TGSI_EXTSWIZZLE_Z: - case TGSI_EXTSWIZZLE_W: - reg = get_reg(c, - src->SrcRegister.File, - src->SrcRegister.Index, - component ); - - if (neg) - reg = negate(reg); - - if (abs) - reg = brw_abs(reg); - - break; - - /* XXX: this won't really work in the general case, but we know - * that the extended swizzle is only allowed in the SWZ - * instruction (right??), in which case using an immediate - * directly will work. - */ - case TGSI_EXTSWIZZLE_ZERO: - reg = brw_imm_f(0); - break; - - case TGSI_EXTSWIZZLE_ONE: - if (neg && !abs) - reg = brw_imm_f(-1.0); - else - reg = brw_imm_f(1.0); - break; - - default: - assert(0); - break; - } - - - return reg; -} - -static void emit_abs( struct brw_wm_compile *c, - struct tgsi_full_instruction *inst) -{ - unsigned mask = inst->FullDstRegisters[0].DstRegister.WriteMask; - - int i; - struct brw_compile *p = &c->func; - brw_set_saturate(p, inst->Instruction.Saturate != TGSI_SAT_NONE); - for (i = 0; i < 4; i++) { - if (mask & (1<FullSrcRegisters[0], i); - brw_MOV(p, dst, brw_abs(src)); /* NOTE */ - } - } - brw_set_saturate(p, 0); -} - - -static void emit_xpd(struct brw_wm_compile *c, - struct tgsi_full_instruction *inst) -{ - int i; - struct brw_compile *p = &c->func; - unsigned mask = inst->FullDstRegisters[0].DstRegister.WriteMask; - for (i = 0; i < 4; i++) { - unsigned i2 = (i+2)%3; - unsigned i1 = (i+1)%3; - if (mask & (1<FullSrcRegisters[0], i2)); - src1 = get_src_reg(c, &inst->FullSrcRegisters[1], i1); - brw_MUL(p, brw_null_reg(), src0, src1); - src0 = get_src_reg(c, &inst->FullSrcRegisters[0], i1); - src1 = get_src_reg(c, &inst->FullSrcRegisters[1], i2); - brw_set_saturate(p, inst->Instruction.Saturate != TGSI_SAT_NONE); - brw_MAC(p, dst, src0, src1); - brw_set_saturate(p, 0); - } - } - brw_set_saturate(p, 0); -} - -static void emit_dp3(struct brw_wm_compile *c, - struct tgsi_full_instruction *inst) -{ - struct brw_reg src0[3], src1[3], dst; - int i; - struct brw_compile *p = &c->func; - for (i = 0; i < 3; i++) { - src0[i] = get_src_reg(c, &inst->FullSrcRegisters[0], i); - src1[i] = get_src_reg(c, &inst->FullSrcRegisters[1], i); - } - - 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->Instruction.Saturate != TGSI_SAT_NONE) ? 1 : 0); - brw_MAC(p, dst, src0[2], src1[2]); - brw_set_saturate(p, 0); -} - -static void emit_dp4(struct brw_wm_compile *c, - struct tgsi_full_instruction *inst) -{ - struct brw_reg src0[4], src1[4], dst; - int i; - struct brw_compile *p = &c->func; - for (i = 0; i < 4; i++) { - src0[i] = get_src_reg(c, &inst->FullSrcRegisters[0], i); - src1[i] = get_src_reg(c, &inst->FullSrcRegisters[1], i); - } - 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]); - brw_set_saturate(p, (inst->Instruction.Saturate != TGSI_SAT_NONE) ? 1 : 0); - brw_MAC(p, dst, src0[3], src1[3]); - brw_set_saturate(p, 0); -} - -static void emit_dph(struct brw_wm_compile *c, - struct tgsi_full_instruction *inst) -{ - struct brw_reg src0[4], src1[4], dst; - int i; - struct brw_compile *p = &c->func; - for (i = 0; i < 4; i++) { - src0[i] = get_src_reg(c, &inst->FullSrcRegisters[0], i); - src1[i] = get_src_reg(c, &inst->FullSrcRegisters[1], i); - } - 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]); - brw_set_saturate(p, (inst->Instruction.Saturate != TGSI_SAT_NONE) ? 1 : 0); - brw_ADD(p, dst, src0[3], src1[3]); - brw_set_saturate(p, 0); -} - -static void emit_math1(struct brw_wm_compile *c, - struct tgsi_full_instruction *inst, unsigned func) -{ - struct brw_compile *p = &c->func; - struct brw_reg src0, dst; - - src0 = get_src_reg(c, &inst->FullSrcRegisters[0], 0); - dst = get_dst_reg(c, inst, get_scalar_dst_index(inst)); - brw_MOV(p, brw_message_reg(2), src0); - brw_math(p, - dst, - func, - ((inst->Instruction.Saturate != TGSI_SAT_NONE) - ? BRW_MATH_SATURATE_SATURATE - : BRW_MATH_SATURATE_NONE), - 2, - brw_null_reg(), - BRW_MATH_DATA_VECTOR, - BRW_MATH_PRECISION_FULL); -} - - -static void emit_alu2(struct brw_wm_compile *c, - struct tgsi_full_instruction *inst, - unsigned opcode) -{ - struct brw_compile *p = &c->func; - struct brw_reg src0, src1, dst; - unsigned mask = inst->FullDstRegisters[0].DstRegister.WriteMask; - int i; - brw_set_saturate(p, (inst->Instruction.Saturate != TGSI_SAT_NONE) ? 1 : 0); - for (i = 0 ; i < 4; i++) { - if (mask & (1<FullSrcRegisters[0], i); - src1 = get_src_reg(c, &inst->FullSrcRegisters[1], i); - brw_alu2(p, opcode, dst, src0, src1); - } - } - brw_set_saturate(p, 0); -} - - -static void emit_alu1(struct brw_wm_compile *c, - struct tgsi_full_instruction *inst, - unsigned opcode) -{ - struct brw_compile *p = &c->func; - struct brw_reg src0, dst; - unsigned mask = inst->FullDstRegisters[0].DstRegister.WriteMask; - int i; - brw_set_saturate(p, (inst->Instruction.Saturate != TGSI_SAT_NONE) ? 1 : 0); - for (i = 0 ; i < 4; i++) { - if (mask & (1<FullSrcRegisters[0], i); - brw_alu1(p, opcode, dst, src0); - } - } - if (inst->Instruction.Saturate != TGSI_SAT_NONE) - brw_set_saturate(p, 0); -} - - -static void emit_max(struct brw_wm_compile *c, - struct tgsi_full_instruction *inst) -{ - struct brw_compile *p = &c->func; - unsigned mask = inst->FullDstRegisters[0].DstRegister.WriteMask; - struct brw_reg src0, src1, dst; - int i; - brw_push_insn_state(p); - for (i = 0; i < 4; i++) { - if (mask & (1<FullSrcRegisters[0], i); - src1 = get_src_reg(c, &inst->FullSrcRegisters[1], i); - brw_set_saturate(p, (inst->Instruction.Saturate != TGSI_SAT_NONE) ? 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->Instruction.Saturate != TGSI_SAT_NONE) ? 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 tgsi_full_instruction *inst) -{ - struct brw_compile *p = &c->func; - unsigned mask = inst->FullDstRegisters[0].DstRegister.WriteMask; - struct brw_reg src0, src1, dst; - int i; - brw_push_insn_state(p); - for (i = 0; i < 4; i++) { - if (mask & (1<FullSrcRegisters[0], i); - src1 = get_src_reg(c, &inst->FullSrcRegisters[1], i); - brw_set_saturate(p, (inst->Instruction.Saturate != TGSI_SAT_NONE) ? 1 : 0); - brw_MOV(p, dst, src0); - brw_set_saturate(p, 0); - - brw_CMP(p, brw_null_reg(), BRW_CONDITIONAL_L, src1, src0); - brw_set_saturate(p, (inst->Instruction.Saturate != TGSI_SAT_NONE) ? 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_pow(struct brw_wm_compile *c, - struct tgsi_full_instruction *inst) -{ - 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->FullSrcRegisters[0], 0); - src1 = get_src_reg(c, &inst->FullSrcRegisters[1], 0); - - brw_MOV(p, brw_message_reg(2), src0); - brw_MOV(p, brw_message_reg(3), src1); - - brw_math(p, - dst, - BRW_MATH_FUNCTION_POW, - (inst->Instruction.Saturate != TGSI_SAT_NONE - ? BRW_MATH_SATURATE_SATURATE - : BRW_MATH_SATURATE_NONE), - 2, - brw_null_reg(), - BRW_MATH_DATA_VECTOR, - BRW_MATH_PRECISION_FULL); -} - -static void emit_lrp(struct brw_wm_compile *c, - struct tgsi_full_instruction *inst) -{ - struct brw_compile *p = &c->func; - unsigned mask = inst->FullDstRegisters[0].DstRegister.WriteMask; - struct brw_reg dst, tmp1, tmp2, src0, src1, src2; - int i; - for (i = 0; i < 4; i++) { - if (mask & (1<FullSrcRegisters[0], i); - - src1 = get_src_reg(c, &inst->FullSrcRegisters[1], i); - - if (src1.nr == dst.nr) { - tmp1 = alloc_tmp(c); - brw_MOV(p, tmp1, src1); - } else - tmp1 = src1; - - src2 = get_src_reg(c, &inst->FullSrcRegisters[2], i); - if (src2.nr == dst.nr) { - tmp2 = alloc_tmp(c); - brw_MOV(p, tmp2, src2); - } else - tmp2 = src2; - - brw_ADD(p, dst, negate(src0), brw_imm_f(1.0)); - brw_MUL(p, brw_null_reg(), dst, tmp2); - brw_set_saturate(p, (inst->Instruction.Saturate != TGSI_SAT_NONE) ? 1 : 0); - brw_MAC(p, dst, src0, tmp1); - brw_set_saturate(p, 0); - } - release_tmps(c); - } -} - -static void emit_kil(struct brw_wm_compile *c) -{ - struct brw_compile *p = &c->func; - struct brw_reg depth = retype(brw_vec1_grf(0, 0), BRW_REGISTER_TYPE_UW); - brw_push_insn_state(p); - brw_set_mask_control(p, BRW_MASK_DISABLE); - brw_NOT(p, c->emit_mask_reg, brw_mask_reg(1)); //IMASK - brw_AND(p, depth, c->emit_mask_reg, depth); - brw_pop_insn_state(p); -} - -static void emit_mad(struct brw_wm_compile *c, - struct tgsi_full_instruction *inst) -{ - struct brw_compile *p = &c->func; - unsigned mask = inst->FullDstRegisters[0].DstRegister.WriteMask; - struct brw_reg dst, src0, src1, src2; - int i; - - for (i = 0; i < 4; i++) { - if (mask & (1<FullSrcRegisters[0], i); - src1 = get_src_reg(c, &inst->FullSrcRegisters[1], i); - src2 = get_src_reg(c, &inst->FullSrcRegisters[2], i); - brw_MUL(p, dst, src0, src1); - - brw_set_saturate(p, (inst->Instruction.Saturate != TGSI_SAT_NONE) ? 1 : 0); - brw_ADD(p, dst, dst, src2); - brw_set_saturate(p, 0); - } - } -} - -static void emit_sop(struct brw_wm_compile *c, - struct tgsi_full_instruction *inst, unsigned cond) -{ - struct brw_compile *p = &c->func; - unsigned mask = inst->FullDstRegisters[0].DstRegister.WriteMask; - struct brw_reg dst, src0, src1; - int i; - - brw_push_insn_state(p); - for (i = 0; i < 4; i++) { - if (mask & (1<FullSrcRegisters[0], i); - src1 = get_src_reg(c, &inst->FullSrcRegisters[1], i); - brw_CMP(p, brw_null_reg(), cond, src0, src1); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - brw_MOV(p, dst, brw_imm_f(0.0)); - brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); - brw_MOV(p, dst, brw_imm_f(1.0)); - } - } - brw_pop_insn_state(p); -} - - -static void emit_ddx(struct brw_wm_compile *c, - struct tgsi_full_instruction *inst) -{ - struct brw_compile *p = &c->func; - unsigned mask = inst->FullDstRegisters[0].DstRegister.WriteMask; - struct brw_reg interp[4]; - struct brw_reg dst; - struct brw_reg src0, w; - unsigned nr, i; - src0 = get_src_reg(c, &inst->FullSrcRegisters[0], 0); - w = get_src_reg(c, &inst->FullSrcRegisters[1], 3); - nr = src0.nr; - interp[0] = brw_vec1_grf(nr, 0); - interp[1] = brw_vec1_grf(nr, 4); - interp[2] = brw_vec1_grf(nr+1, 0); - interp[3] = brw_vec1_grf(nr+1, 4); - brw_set_saturate(p, inst->Instruction.Saturate != TGSI_SAT_NONE); - for(i = 0; i < 4; i++ ) { - if (mask & (1<func; - unsigned mask = inst->FullDstRegisters[0].DstRegister.WriteMask; - struct brw_reg interp[4]; - struct brw_reg dst; - struct brw_reg src0, w; - unsigned nr, i; - - src0 = get_src_reg(c, &inst->FullSrcRegisters[0], 0); - nr = src0.nr; - w = get_src_reg(c, &inst->FullSrcRegisters[1], 3); - interp[0] = brw_vec1_grf(nr, 0); - interp[1] = brw_vec1_grf(nr, 4); - interp[2] = brw_vec1_grf(nr+1, 0); - interp[3] = brw_vec1_grf(nr+1, 4); - brw_set_saturate(p, inst->Instruction.Saturate != TGSI_SAT_NONE); - for(i = 0; i < 4; i++ ) { - if (mask & (1<func; - struct brw_reg payload_reg = c->payload_depth[0]; - struct brw_reg dst[4], src[4]; - unsigned i; - 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->FullSrcRegisters[0], i); - -#if 0 - 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)); - break; - case TEXTURE_2D_INDEX: - case TEXTURE_RECT_INDEX: - brw_MOV(p, brw_message_reg(2), src[0]); - brw_MOV(p, brw_message_reg(3), src[1]); - brw_MOV(p, brw_message_reg(4), brw_imm_f(0)); - break; - default: - brw_MOV(p, brw_message_reg(2), src[0]); - brw_MOV(p, brw_message_reg(3), src[1]); - brw_MOV(p, brw_message_reg(4), src[2]); - break; - } -#else - brw_MOV(p, brw_message_reg(2), src[0]); - brw_MOV(p, brw_message_reg(3), src[1]); - brw_MOV(p, brw_message_reg(4), brw_imm_f(0)); -#endif - - brw_MOV(p, brw_message_reg(5), src[3]); - brw_MOV(p, brw_message_reg(6), brw_imm_f(0)); - brw_SAMPLE(p, - retype(vec8(dst[0]), BRW_REGISTER_TYPE_UW), - 1, - retype(payload_reg, BRW_REGISTER_TYPE_UW), - inst->TexSrcUnit + 1, /* surface */ - inst->TexSrcUnit, /* sampler */ - inst->FullDstRegisters[0].DstRegister.WriteMask, - BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS, - 4, - 4, - 0); -#endif -} - -static void emit_tex(struct brw_wm_compile *c, - struct tgsi_full_instruction *inst) -{ -#if 0 - struct brw_compile *p = &c->func; - struct brw_reg payload_reg = c->payload_depth[0]; - struct brw_reg dst[4], src[4]; - unsigned msg_len; - unsigned i, nr; - unsigned emit; - boolean shadow = (c->key.shadowtex_mask & (1<TexSrcUnit)) ? 1 : 0; - - 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->FullSrcRegisters[0], i); - -#if 0 - switch (inst->TexSrcTarget) { - case TEXTURE_1D_INDEX: - emit = WRITEMASK_X; - nr = 1; - break; - case TEXTURE_2D_INDEX: - case TEXTURE_RECT_INDEX: - emit = WRITEMASK_XY; - nr = 2; - break; - default: - emit = WRITEMASK_XYZ; - nr = 3; - break; - } -#else - emit = WRITEMASK_XY; - nr = 2; -#endif - - msg_len = 1; - - for (i = 0; i < nr; i++) { - static const unsigned swz[4] = {0,1,2,2}; - if (emit & (1<TexSrcUnit + 1, /* surface */ - inst->TexSrcUnit, /* sampler */ - inst->FullDstRegisters[0].DstRegister.WriteMask, - BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE, - 4, - shadow ? 6 : 4, - 0); - - if (shadow) - brw_MOV(p, dst[3], brw_imm_f(1.0)); -#endif -} - - - - - - - - -static void emit_fb_write(struct brw_wm_compile *c, - struct tgsi_full_instruction *inst) -{ - struct brw_compile *p = &c->func; - int nr = 2; - int channel; - int base_reg = 0; - - // src0 = output color - // src1 = payload_depth[0] - // src2 = output depth - // dst = ??? - - - - /* Reserve a space for AA - may not be needed: - */ - if (c->key.aa_dest_stencil_reg) - nr += 1; - - { - brw_push_insn_state(p); - for (channel = 0; channel < 4; channel++) { - struct brw_reg src0 = c->wm_regs[TGSI_FILE_OUTPUT][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); - } - /* skip over the regs populated above: */ - nr += 8; - brw_pop_insn_state(p); - } - - - /* Pass through control information: - */ - /* mov (8) m1.0<1>:ud r1.0<8;8,1>:ud { Align1 NoMask } */ - { - brw_push_insn_state(p); - brw_set_mask_control(p, BRW_MASK_DISABLE); /* ? */ - brw_MOV(p, - brw_message_reg(base_reg + 1), - brw_vec8_grf(1, 0)); - brw_pop_insn_state(p); - } - - /* Send framebuffer write message: */ - brw_fb_WRITE(p, - retype(vec8(brw_null_reg()), BRW_REGISTER_TYPE_UW), - base_reg, - retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW), - 0, /* render surface always 0 */ - nr, - 0, - 1); - -} - - -static void brw_wm_emit_instruction( struct brw_wm_compile *c, - struct tgsi_full_instruction *inst ) -{ - struct brw_compile *p = &c->func; - -#if 0 - if (inst->CondUpdate) - brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); - else - brw_set_conditionalmod(p, BRW_CONDITIONAL_NONE); -#else - brw_set_conditionalmod(p, BRW_CONDITIONAL_NONE); -#endif - - switch (inst->Instruction.Opcode) { - case TGSI_OPCODE_ABS: - emit_abs(c, inst); - break; - case TGSI_OPCODE_ADD: - emit_alu2(c, inst, BRW_OPCODE_ADD); - break; - case TGSI_OPCODE_SUB: - assert(0); -// emit_alu2(c, inst, BRW_OPCODE_SUB); - break; - case TGSI_OPCODE_FRC: - emit_alu1(c, inst, BRW_OPCODE_FRC); - break; - case TGSI_OPCODE_FLR: - assert(0); -// emit_alu1(c, inst, BRW_OPCODE_FLR); - break; - case TGSI_OPCODE_LRP: - emit_lrp(c, inst); - break; - case TGSI_OPCODE_INT: - emit_alu1(c, inst, BRW_OPCODE_RNDD); - break; - case TGSI_OPCODE_MOV: - emit_alu1(c, inst, BRW_OPCODE_MOV); - break; - case TGSI_OPCODE_DP3: - emit_dp3(c, inst); - break; - case TGSI_OPCODE_DP4: - emit_dp4(c, inst); - break; - case TGSI_OPCODE_XPD: - emit_xpd(c, inst); - break; - case TGSI_OPCODE_DPH: - emit_dph(c, inst); - break; - case TGSI_OPCODE_RCP: - emit_math1(c, inst, BRW_MATH_FUNCTION_INV); - break; - case TGSI_OPCODE_RSQ: - emit_math1(c, inst, BRW_MATH_FUNCTION_RSQ); - break; - case TGSI_OPCODE_SIN: - emit_math1(c, inst, BRW_MATH_FUNCTION_SIN); - break; - case TGSI_OPCODE_COS: - emit_math1(c, inst, BRW_MATH_FUNCTION_COS); - break; - case TGSI_OPCODE_EX2: - emit_math1(c, inst, BRW_MATH_FUNCTION_EXP); - break; - case TGSI_OPCODE_LG2: - emit_math1(c, inst, BRW_MATH_FUNCTION_LOG); - break; - case TGSI_OPCODE_MAX: - emit_max(c, inst); - break; - case TGSI_OPCODE_MIN: - emit_min(c, inst); - break; - case TGSI_OPCODE_DDX: - emit_ddx(c, inst); - break; - case TGSI_OPCODE_DDY: - emit_ddy(c, inst); - break; - case TGSI_OPCODE_SLT: - emit_sop(c, inst, BRW_CONDITIONAL_L); - break; - case TGSI_OPCODE_SLE: - emit_sop(c, inst, BRW_CONDITIONAL_LE); - break; - case TGSI_OPCODE_SGT: - emit_sop(c, inst, BRW_CONDITIONAL_G); - break; - case TGSI_OPCODE_SGE: - emit_sop(c, inst, BRW_CONDITIONAL_GE); - break; - case TGSI_OPCODE_SEQ: - emit_sop(c, inst, BRW_CONDITIONAL_EQ); - break; - case TGSI_OPCODE_SNE: - emit_sop(c, inst, BRW_CONDITIONAL_NEQ); - break; - case TGSI_OPCODE_MUL: - emit_alu2(c, inst, BRW_OPCODE_MUL); - break; - case TGSI_OPCODE_POW: - emit_pow(c, inst); - break; - case TGSI_OPCODE_MAD: - emit_mad(c, inst); - break; - case TGSI_OPCODE_TEX: - emit_tex(c, inst); - break; - case TGSI_OPCODE_TXB: - emit_txb(c, inst); - break; - case TGSI_OPCODE_TEXKILL: - emit_kil(c); - break; - case TGSI_OPCODE_IF: - assert(c->if_insn < MAX_IFSN); - c->if_inst[c->if_insn++] = brw_IF(p, BRW_EXECUTE_8); - break; - case TGSI_OPCODE_ELSE: - c->if_inst[c->if_insn-1] = brw_ELSE(p, c->if_inst[c->if_insn-1]); - break; - case TGSI_OPCODE_ENDIF: - assert(c->if_insn > 0); - brw_ENDIF(p, c->if_inst[--c->if_insn]); - break; - case TGSI_OPCODE_BGNSUB: - case TGSI_OPCODE_ENDSUB: - break; - case TGSI_OPCODE_CAL: - brw_push_insn_state(p); - brw_set_mask_control(p, BRW_MASK_DISABLE); - brw_set_access_mode(p, BRW_ALIGN_1); - brw_ADD(p, deref_1ud(c->stack_index, 0), brw_ip_reg(), brw_imm_d(3*16)); - brw_set_access_mode(p, BRW_ALIGN_16); - brw_ADD(p, - get_addr_reg(c->stack_index), - get_addr_reg(c->stack_index), brw_imm_d(4)); -// orig_inst = inst->Data; -// orig_inst->Data = &p->store[p->nr_insn]; - assert(0); - brw_ADD(p, brw_ip_reg(), brw_ip_reg(), brw_imm_d(1*16)); - brw_pop_insn_state(p); - break; - - case TGSI_OPCODE_RET: -#if 0 - brw_push_insn_state(p); - brw_set_mask_control(p, BRW_MASK_DISABLE); - brw_ADD(p, - get_addr_reg(c->stack_index), - get_addr_reg(c->stack_index), brw_imm_d(-4)); - brw_set_access_mode(p, BRW_ALIGN_1); - brw_MOV(p, brw_ip_reg(), deref_1ud(c->stack_index, 0)); - brw_set_access_mode(p, BRW_ALIGN_16); - brw_pop_insn_state(p); -#else - emit_fb_write(c, inst); -#endif - - break; - case TGSI_OPCODE_BGNFOR: - c->loop_inst[c->loop_insn++] = brw_DO(p, BRW_EXECUTE_8); - break; - case TGSI_OPCODE_BRK: - brw_BREAK(p); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - break; - case TGSI_OPCODE_CONT: - brw_CONT(p); - brw_set_predicate_control(p, BRW_PREDICATE_NONE); - break; - case TGSI_OPCODE_ENDFOR: - c->loop_insn--; - c->inst0 = c->inst1 = brw_WHILE(p, c->loop_inst[c->loop_insn]); - /* patch all the BREAK instructions from - last BGNFOR */ - while (c->inst0 > c->loop_inst[c->loop_insn]) { - c->inst0--; - if (c->inst0->header.opcode == BRW_OPCODE_BREAK) { - c->inst0->bits3.if_else.jump_count = c->inst1 - c->inst0 + 1; - c->inst0->bits3.if_else.pop_count = 0; - } else if (c->inst0->header.opcode == BRW_OPCODE_CONTINUE) { - c->inst0->bits3.if_else.jump_count = c->inst1 - c->inst0; - c->inst0->bits3.if_else.pop_count = 0; - } - } - break; - case TGSI_OPCODE_END: - emit_fb_write(c, inst); - break; - - default: - debug_printf("unsupported IR in fragment shader %d\n", - inst->Instruction.Opcode); - } -#if 0 - if (inst->CondUpdate) - brw_set_predicate_control(p, BRW_PREDICATE_NORMAL); - else - brw_set_predicate_control(p, BRW_PREDICATE_NONE); -#endif -} - - - - - - -void brw_wm_glsl_emit(struct brw_wm_compile *c) -{ - struct tgsi_parse_context parse; - struct brw_compile *p = &c->func; - - brw_init_compile(&c->func); - brw_set_compression_control(p, BRW_COMPRESSION_NONE); - - c->reg_index = 0; - c->if_insn = 0; - c->loop_insn = 0; - c->stack_index = brw_indirect(0,0); - - /* Do static register allocation and parameter interpolation: - */ - brw_wm_emit_decls( c ); - - /* Emit the actual program. All done with very direct translation, - * hopefully we can improve on this shortly... - */ - brw_MOV(p, get_addr_reg(c->stack_index), brw_address(c->stack)); - - tgsi_parse_init( &parse, c->fp->program.tokens ); - - while( !tgsi_parse_end_of_tokens( &parse ) ) - { - tgsi_parse_token( &parse ); - - switch( parse.FullToken.Token.Type ) { - case TGSI_TOKEN_TYPE_DECLARATION: - /* already done */ - break; - - case TGSI_TOKEN_TYPE_IMMEDIATE: - /* not handled yet */ - assert(0); - break; - - case TGSI_TOKEN_TYPE_INSTRUCTION: - brw_wm_emit_instruction(c, &parse.FullToken.FullInstruction); - break; - - default: - assert( 0 ); - } - } - - tgsi_parse_free (&parse); - - /* Fix up call targets: - */ -#if 0 - { - unsigned nr_insns = c->fp->program.Base.NumInstructions; - unsigned insn, target_insn; - struct tgsi_full_instruction *inst1, *inst2; - struct brw_instruction *brw_inst1, *brw_inst2; - int offset; - for (insn = 0; insn < nr_insns; insn++) { - inst1 = &c->fp->program.Base.Instructions[insn]; - brw_inst1 = inst1->Data; - switch (inst1->Opcode) { - case TGSI_OPCODE_CAL: - target_insn = inst1->BranchTarget; - inst2 = &c->fp->program.Base.Instructions[target_insn]; - brw_inst2 = inst2->Data; - offset = brw_inst2 - brw_inst1; - brw_set_src1(brw_inst1, brw_imm_d(offset*16)); - break; - default: - break; - } - } - } -#endif - - c->prog_data.total_grf = c->reg_index; - c->prog_data.total_scratch = 0; -} diff --git a/src/gallium/drivers/i965simple/brw_wm_iz.c b/src/gallium/drivers/i965simple/brw_wm_iz.c deleted file mode 100644 index 6c5f25bf39..0000000000 --- a/src/gallium/drivers/i965simple/brw_wm_iz.c +++ /dev/null @@ -1,214 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - -#include "brw_wm.h" - - -#undef P /* prompted depth */ -#undef C /* computed */ -#undef N /* non-promoted? */ - -#define P 0 -#define C 1 -#define N 2 - -const struct { - unsigned mode:2; - unsigned sd_present:1; - unsigned sd_to_rt:1; - unsigned dd_present:1; - unsigned ds_present:1; -} wm_iz_table[IZ_BIT_MAX] = -{ - { P, 0, 0, 0, 0 }, - { P, 0, 0, 0, 0 }, - { C, 0, 1, 0, 0 }, - { C, 0, 1, 0, 0 }, - { C, 1, 1, 0, 0 }, - { C, 1, 1, 0, 0 }, - { C, 0, 1, 0, 0 }, - { C, 0, 1, 0, 0 }, - { C, 1, 1, 1, 0 }, - { C, 1, 1, 1, 0 }, - { C, 0, 1, 1, 0 }, - { C, 0, 1, 1, 0 }, - { C, 1, 1, 1, 0 }, - { C, 1, 1, 1, 0 }, - { C, 0, 1, 1, 0 }, - { C, 0, 1, 1, 0 }, - { P, 0, 0, 0, 0 }, - { P, 0, 0, 0, 0 }, - { C, 0, 1, 0, 0 }, - { C, 0, 1, 0, 0 }, - { C, 1, 1, 0, 0 }, - { C, 1, 1, 0, 0 }, - { C, 0, 1, 0, 0 }, - { C, 0, 1, 0, 0 }, - { C, 1, 1, 1, 0 }, - { C, 1, 1, 1, 0 }, - { C, 0, 1, 1, 0 }, - { C, 0, 1, 1, 0 }, - { C, 1, 1, 1, 0 }, - { C, 1, 1, 1, 0 }, - { C, 0, 1, 1, 0 }, - { C, 0, 1, 1, 0 }, - { C, 0, 0, 0, 1 }, - { C, 0, 0, 0, 1 }, - { C, 0, 1, 0, 1 }, - { C, 0, 1, 0, 1 }, - { C, 1, 1, 0, 1 }, - { C, 1, 1, 0, 1 }, - { C, 0, 1, 0, 1 }, - { C, 0, 1, 0, 1 }, - { C, 1, 1, 1, 1 }, - { C, 1, 1, 1, 1 }, - { C, 0, 1, 1, 1 }, - { C, 0, 1, 1, 1 }, - { C, 1, 1, 1, 1 }, - { C, 1, 1, 1, 1 }, - { C, 0, 1, 1, 1 }, - { C, 0, 1, 1, 1 }, - { C, 0, 0, 0, 1 }, - { C, 0, 0, 0, 1 }, - { C, 0, 1, 0, 1 }, - { C, 0, 1, 0, 1 }, - { C, 1, 1, 0, 1 }, - { C, 1, 1, 0, 1 }, - { C, 0, 1, 0, 1 }, - { C, 0, 1, 0, 1 }, - { C, 1, 1, 1, 1 }, - { C, 1, 1, 1, 1 }, - { C, 0, 1, 1, 1 }, - { C, 0, 1, 1, 1 }, - { C, 1, 1, 1, 1 }, - { C, 1, 1, 1, 1 }, - { C, 0, 1, 1, 1 }, - { C, 0, 1, 1, 1 }, - { P, 0, 0, 0, 0 }, - { P, 0, 0, 0, 0 }, - { P, 0, 0, 0, 0 }, - { P, 0, 0, 0, 0 }, - { P, 0, 0, 0, 0 }, - { N, 1, 1, 0, 0 }, - { N, 0, 1, 0, 0 }, - { N, 0, 1, 0, 0 }, - { P, 0, 0, 0, 0 }, - { P, 0, 0, 0, 0 }, - { C, 0, 1, 1, 0 }, - { C, 0, 1, 1, 0 }, - { P, 0, 0, 0, 0 }, - { N, 1, 1, 0, 0 }, - { C, 0, 1, 1, 0 }, - { C, 0, 1, 1, 0 }, - { P, 0, 0, 0, 0 }, - { P, 0, 0, 0, 0 }, - { P, 0, 0, 0, 0 }, - { P, 0, 0, 0, 0 }, - { P, 0, 0, 0, 0 }, - { N, 1, 1, 0, 0 }, - { N, 0, 1, 0, 0 }, - { N, 0, 1, 0, 0 }, - { P, 0, 0, 0, 0 }, - { P, 0, 0, 0, 0 }, - { C, 0, 1, 1, 0 }, - { C, 0, 1, 1, 0 }, - { P, 0, 0, 0, 0 }, - { N, 1, 1, 0, 0 }, - { C, 0, 1, 1, 0 }, - { C, 0, 1, 1, 0 }, - { P, 0, 0, 0, 0 }, - { P, 0, 0, 0, 0 }, - { P, 0, 0, 0, 0 }, - { P, 0, 0, 0, 0 }, - { P, 0, 0, 0, 0 }, - { N, 1, 1, 0, 1 }, - { N, 0, 1, 0, 1 }, - { N, 0, 1, 0, 1 }, - { P, 0, 0, 0, 0 }, - { P, 0, 0, 0, 0 }, - { C, 0, 1, 1, 1 }, - { C, 0, 1, 1, 1 }, - { P, 0, 0, 0, 0 }, - { N, 1, 1, 0, 1 }, - { C, 0, 1, 1, 1 }, - { C, 0, 1, 1, 1 }, - { P, 0, 0, 0, 0 }, - { C, 0, 0, 0, 1 }, - { P, 0, 0, 0, 0 }, - { C, 0, 1, 0, 1 }, - { P, 0, 0, 0, 0 }, - { C, 1, 1, 0, 1 }, - { C, 0, 1, 0, 1 }, - { C, 0, 1, 0, 1 }, - { P, 0, 0, 0, 0 }, - { C, 1, 1, 1, 1 }, - { C, 0, 1, 1, 1 }, - { C, 0, 1, 1, 1 }, - { P, 0, 0, 0, 0 }, - { C, 1, 1, 1, 1 }, - { C, 0, 1, 1, 1 }, - { C, 0, 1, 1, 1 } -}; - -void brw_wm_lookup_iz( unsigned line_aa, - unsigned lookup, - struct brw_wm_prog_key *key ) -{ - unsigned reg = 2; - - assert (lookup < IZ_BIT_MAX); - - if (lookup & IZ_PS_COMPUTES_DEPTH_BIT) - key->computes_depth = 1; - - if (wm_iz_table[lookup].sd_present) { - key->source_depth_reg = reg; - reg += 2; - } - - if (wm_iz_table[lookup].sd_to_rt) - key->source_depth_to_render_target = 1; - - if (wm_iz_table[lookup].ds_present || line_aa != AA_NEVER) { - key->aa_dest_stencil_reg = reg; - key->runtime_check_aads_emit = (!wm_iz_table[lookup].ds_present && - line_aa == AA_SOMETIMES); - reg++; - } - - if (wm_iz_table[lookup].dd_present) { - key->dest_depth_reg = reg; - reg+=2; - } - - key->nr_depth_regs = (reg+1)/2; -} - diff --git a/src/gallium/drivers/i965simple/brw_wm_sampler_state.c b/src/gallium/drivers/i965simple/brw_wm_sampler_state.c deleted file mode 100644 index 52b2909a65..0000000000 --- a/src/gallium/drivers/i965simple/brw_wm_sampler_state.c +++ /dev/null @@ -1,275 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#include "brw_context.h" -#include "brw_state.h" -#include "brw_defines.h" - -#include "util/u_math.h" -#include "util/u_memory.h" - - -#define COMPAREFUNC_ALWAYS 0 -#define COMPAREFUNC_NEVER 0x1 -#define COMPAREFUNC_LESS 0x2 -#define COMPAREFUNC_EQUAL 0x3 -#define COMPAREFUNC_LEQUAL 0x4 -#define COMPAREFUNC_GREATER 0x5 -#define COMPAREFUNC_NOTEQUAL 0x6 -#define COMPAREFUNC_GEQUAL 0x7 - -/* Samplers aren't strictly wm state from the hardware's perspective, - * but that is the only situation in which we use them in this driver. - */ - -static int intel_translate_shadow_compare_func(unsigned func) -{ - switch(func) { - case PIPE_FUNC_NEVER: - return COMPAREFUNC_ALWAYS; - case PIPE_FUNC_LESS: - return COMPAREFUNC_LEQUAL; - case PIPE_FUNC_LEQUAL: - return COMPAREFUNC_LESS; - case PIPE_FUNC_GREATER: - return COMPAREFUNC_GEQUAL; - case PIPE_FUNC_GEQUAL: - return COMPAREFUNC_GREATER; - case PIPE_FUNC_NOTEQUAL: - return COMPAREFUNC_EQUAL; - case PIPE_FUNC_EQUAL: - return COMPAREFUNC_NOTEQUAL; - case PIPE_FUNC_ALWAYS: - return COMPAREFUNC_NEVER; - } - - debug_printf("Unknown value in %s: %x\n", __FUNCTION__, func); - return COMPAREFUNC_NEVER; -} - -/* The brw (and related graphics cores) do not support GL_CLAMP. The - * Intel drivers for "other operating systems" implement GL_CLAMP as - * GL_CLAMP_TO_EDGE, so the same is done here. - */ -static unsigned translate_wrap_mode( int wrap ) -{ - switch( wrap ) { - case PIPE_TEX_WRAP_REPEAT: - return BRW_TEXCOORDMODE_WRAP; - case PIPE_TEX_WRAP_CLAMP: - return BRW_TEXCOORDMODE_CLAMP; - case PIPE_TEX_WRAP_CLAMP_TO_EDGE: - return BRW_TEXCOORDMODE_CLAMP; /* conform likes it this way */ - case PIPE_TEX_WRAP_CLAMP_TO_BORDER: - return BRW_TEXCOORDMODE_CLAMP_BORDER; - case PIPE_TEX_WRAP_MIRROR_REPEAT: - return BRW_TEXCOORDMODE_MIRROR; - default: - return BRW_TEXCOORDMODE_WRAP; - } -} - - -static unsigned U_FIXED(float value, unsigned frac_bits) -{ - value *= (1<cache[BRW_SAMPLER_DEFAULT_COLOR], &sdc ); -} - - -/* - */ -static void brw_update_sampler_state( const struct pipe_sampler_state *pipe_sampler, - unsigned sdc_gs_offset, - struct brw_sampler_state *sampler) -{ - memset(sampler, 0, sizeof(*sampler)); - - switch (pipe_sampler->min_mip_filter) { - case PIPE_TEX_FILTER_NEAREST: - sampler->ss0.min_filter = BRW_MAPFILTER_NEAREST; - break; - case PIPE_TEX_FILTER_LINEAR: - sampler->ss0.min_filter = BRW_MAPFILTER_LINEAR; - break; - case PIPE_TEX_FILTER_ANISO: - sampler->ss0.min_filter = BRW_MAPFILTER_ANISOTROPIC; - break; - default: - break; - } - - switch (pipe_sampler->min_mip_filter) { - case PIPE_TEX_MIPFILTER_NEAREST: - sampler->ss0.mip_filter = BRW_MIPFILTER_NEAREST; - break; - case PIPE_TEX_MIPFILTER_LINEAR: - sampler->ss0.mip_filter = BRW_MIPFILTER_LINEAR; - break; - case PIPE_TEX_MIPFILTER_NONE: - sampler->ss0.mip_filter = BRW_MIPFILTER_NONE; - break; - default: - break; - } - /* Set Anisotropy: - */ - switch (pipe_sampler->mag_img_filter) { - case PIPE_TEX_FILTER_NEAREST: - sampler->ss0.mag_filter = BRW_MAPFILTER_NEAREST; - break; - case PIPE_TEX_FILTER_LINEAR: - sampler->ss0.mag_filter = BRW_MAPFILTER_LINEAR; - break; - case PIPE_TEX_FILTER_ANISO: - sampler->ss0.mag_filter = BRW_MAPFILTER_LINEAR; - break; - default: - break; - } - - if (pipe_sampler->max_anisotropy > 2.0) { - sampler->ss3.max_aniso = MAX2((pipe_sampler->max_anisotropy - 2) / 2, - BRW_ANISORATIO_16); - } - - sampler->ss1.s_wrap_mode = translate_wrap_mode(pipe_sampler->wrap_s); - sampler->ss1.r_wrap_mode = translate_wrap_mode(pipe_sampler->wrap_r); - sampler->ss1.t_wrap_mode = translate_wrap_mode(pipe_sampler->wrap_t); - - /* Fulsim complains if I don't do this. Hardware doesn't mind: - */ -#if 0 - if (texObj->Target == GL_TEXTURE_CUBE_MAP_ARB) { - sampler->ss1.r_wrap_mode = BRW_TEXCOORDMODE_CUBE; - sampler->ss1.s_wrap_mode = BRW_TEXCOORDMODE_CUBE; - sampler->ss1.t_wrap_mode = BRW_TEXCOORDMODE_CUBE; - } -#endif - - /* Set shadow function: - */ - if (pipe_sampler->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) { - /* Shadowing is "enabled" by emitting a particular sampler - * message (sample_c). So need to recompile WM program when - * shadow comparison is enabled on each/any texture unit. - */ - sampler->ss0.shadow_function = intel_translate_shadow_compare_func(pipe_sampler->compare_func); - } - - /* Set LOD bias: - */ - sampler->ss0.lod_bias = S_FIXED(CLAMP(pipe_sampler->lod_bias, -16, 15), 6); - - sampler->ss0.lod_preclamp = 1; /* OpenGL mode */ - sampler->ss0.default_color_mode = 0; /* OpenGL/DX10 mode */ - - /* Set BaseMipLevel, MaxLOD, MinLOD: - * - * XXX: I don't think that using firstLevel, lastLevel works, - * because we always setup the surface state as if firstLevel == - * level zero. Probably have to subtract firstLevel from each of - * these: - */ - sampler->ss0.base_level = U_FIXED(0, 1); - - sampler->ss1.max_lod = U_FIXED(MIN2(MAX2(pipe_sampler->max_lod, 0), 13), 6); - sampler->ss1.min_lod = U_FIXED(MIN2(MAX2(pipe_sampler->min_lod, 0), 13), 6); - - sampler->ss2.default_color_pointer = sdc_gs_offset >> 5; -} - - - -/* All samplers must be uploaded in a single contiguous array, which - * complicates various things. However, this is still too confusing - - * FIXME: simplify all the different new texture state flags. - */ -static void upload_wm_samplers(struct brw_context *brw) -{ - unsigned unit; - unsigned sampler_count = 0; - - /* BRW_NEW_SAMPLER */ - for (unit = 0; unit < brw->num_textures && unit < brw->num_samplers; - unit++) { - /* determine unit enable/disable by looking for a bound texture */ - if (brw->attribs.Texture[unit]) { - const struct pipe_sampler_state *sampler = brw->attribs.Samplers[unit]; - unsigned sdc_gs_offset = upload_default_color(brw, sampler->border_color); - - brw_update_sampler_state(sampler, - sdc_gs_offset, - &brw->wm.sampler[unit]); - - sampler_count = unit + 1; - } - } - - if (brw->wm.sampler_count != sampler_count) { - brw->wm.sampler_count = sampler_count; - brw->state.dirty.cache |= CACHE_NEW_SAMPLER; - } - - brw->wm.sampler_gs_offset = 0; - - if (brw->wm.sampler_count) - brw->wm.sampler_gs_offset = - brw_cache_data_sz(&brw->cache[BRW_SAMPLER], - brw->wm.sampler, - sizeof(struct brw_sampler_state) * brw->wm.sampler_count); -} - -const struct brw_tracked_state brw_wm_samplers = { - .dirty = { - .brw = BRW_NEW_SAMPLER, - .cache = 0 - }, - .update = upload_wm_samplers -}; - diff --git a/src/gallium/drivers/i965simple/brw_wm_state.c b/src/gallium/drivers/i965simple/brw_wm_state.c deleted file mode 100644 index 37a9bf919c..0000000000 --- a/src/gallium/drivers/i965simple/brw_wm_state.c +++ /dev/null @@ -1,195 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - - -#include "brw_context.h" -#include "brw_state.h" -#include "brw_defines.h" -#include "brw_wm.h" -#include "util/u_math.h" -#include "util/u_memory.h" - -/*********************************************************************** - * WM unit - fragment programs and rasterization - */ -static void upload_wm_unit(struct brw_context *brw ) -{ - struct brw_wm_unit_state wm; - unsigned max_threads; - unsigned per_thread; - - if (BRW_DEBUG & DEBUG_SINGLE_THREAD) - max_threads = 0; - else - max_threads = 31; - - - memset(&wm, 0, sizeof(wm)); - - /* CACHE_NEW_WM_PROG */ - wm.thread0.grf_reg_count = align(brw->wm.prog_data->total_grf, 16) / 16 - 1; - wm.thread0.kernel_start_pointer = brw->wm.prog_gs_offset >> 6; - wm.thread3.dispatch_grf_start_reg = brw->wm.prog_data->first_curbe_grf; - wm.thread3.urb_entry_read_length = brw->wm.prog_data->urb_read_length; - wm.thread3.const_urb_entry_read_length = brw->wm.prog_data->curb_read_length; - - wm.wm5.max_threads = max_threads; - - per_thread = align(brw->wm.prog_data->total_scratch, 1024); - assert(per_thread <= 12 * 1024); - -#if 0 - if (brw->wm.prog_data->total_scratch) { - unsigned total = per_thread * (max_threads + 1); - - /* Scratch space -- just have to make sure there is sufficient - * allocated for the active program and current number of threads. - */ - brw->wm.scratch_buffer_size = total; - if (brw->wm.scratch_buffer && - brw->wm.scratch_buffer_size > brw->wm.scratch_buffer->size) { - dri_bo_unreference(brw->wm.scratch_buffer); - brw->wm.scratch_buffer = NULL; - } - if (!brw->wm.scratch_buffer) { - brw->wm.scratch_buffer = dri_bo_alloc(intel->intelScreen->bufmgr, - "wm scratch", - brw->wm.scratch_buffer_size, - 4096, DRM_BO_FLAG_MEM_TT); - } - } - /* XXX: Scratch buffers are not implemented correectly. - * - * The scratch offset to be programmed into wm is relative to the general - * state base address. However, using dri_bo_alloc/dri_bo_emit_reloc (or - * the previous bmGenBuffers scheme), we get an offset relative to the - * start of framebuffer. Even before then, it was broken in other ways, - * so just fail for now if we hit that path. - */ - assert(brw->wm.prog_data->total_scratch == 0); -#endif - - /* CACHE_NEW_SURFACE */ - wm.thread1.binding_table_entry_count = brw->wm.nr_surfaces; - - /* BRW_NEW_CURBE_OFFSETS */ - wm.thread3.const_urb_entry_read_offset = brw->curbe.wm_start * 2; - - wm.thread3.urb_entry_read_offset = 0; - wm.thread1.depth_coef_urb_read_offset = 1; - wm.thread1.floating_point_mode = BRW_FLOATING_POINT_NON_IEEE_754; - - /* CACHE_NEW_SAMPLER */ - wm.wm4.sampler_count = (brw->wm.sampler_count + 1) / 4; - wm.wm4.sampler_state_pointer = brw->wm.sampler_gs_offset >> 5; - - /* BRW_NEW_FRAGMENT_PROGRAM */ - { - const struct brw_fragment_program *fp = brw->attribs.FragmentProgram; - - if (fp->UsesDepth) - wm.wm5.program_uses_depth = 1; /* as far as we can tell */ - - if (fp->info.writes_z) - wm.wm5.program_computes_depth = 1; - - /* BRW_NEW_ALPHA_TEST */ - if (fp->info.uses_kill || - brw->attribs.DepthStencil->alpha.enabled) - wm.wm5.program_uses_killpixel = 1; - - wm.wm5.enable_8_pix = 1; - } - - wm.wm5.thread_dispatch_enable = 1; /* AKA: color_write */ - wm.wm5.legacy_line_rast = 0; - wm.wm5.legacy_global_depth_bias = 0; - wm.wm5.early_depth_test = 1; /* never need to disable */ - wm.wm5.line_aa_region_width = 0; - wm.wm5.line_endcap_aa_region_width = 1; - - /* BRW_NEW_RASTERIZER */ - if (brw->attribs.Raster->poly_stipple_enable) - wm.wm5.polygon_stipple = 1; - -#if 0 - if (brw->attribs.Polygon->OffsetFill) { - wm.wm5.depth_offset = 1; - /* Something wierd going on with legacy_global_depth_bias, - * offset_constant, scaling and MRD. This value passes glean - * but gives some odd results elsewere (eg. the - * quad-offset-units test). - */ - wm.global_depth_offset_constant = brw->attribs.Polygon->OffsetUnits * 2; - - /* This is the only value that passes glean: - */ - wm.global_depth_offset_scale = brw->attribs.Polygon->OffsetFactor; - } -#endif - - if (brw->attribs.Raster->line_stipple_enable) { - wm.wm5.line_stipple = 1; - } - - if (BRW_DEBUG & DEBUG_STATS) - wm.wm4.stats_enable = 1; - - brw->wm.state_gs_offset = brw_cache_data( &brw->cache[BRW_WM_UNIT], &wm ); - - if (brw->wm.prog_data->total_scratch) { - /* - dri_emit_reloc(brw->cache[BRW_WM_UNIT].pool->buffer, - DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, - (per_thread / 1024) - 1, - brw->wm.state_gs_offset + - ((char *)&wm.thread2 - (char *)&wm), - brw->wm.scratch_buffer); - */ - } else { - wm.thread2.scratch_space_base_pointer = 0; - } -} - -const struct brw_tracked_state brw_wm_unit = { - .dirty = { - .brw = (BRW_NEW_RASTERIZER | - BRW_NEW_ALPHA_TEST | - BRW_NEW_FS | - BRW_NEW_CURBE_OFFSETS), - - .cache = (CACHE_NEW_SURFACE | - CACHE_NEW_WM_PROG | - CACHE_NEW_SAMPLER) - }, - .update = upload_wm_unit -}; - diff --git a/src/gallium/drivers/i965simple/brw_wm_surface_state.c b/src/gallium/drivers/i965simple/brw_wm_surface_state.c deleted file mode 100644 index b5b9e0e702..0000000000 --- a/src/gallium/drivers/i965simple/brw_wm_surface_state.c +++ /dev/null @@ -1,305 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - -#include "brw_context.h" -#include "brw_state.h" -#include "brw_defines.h" - -static unsigned translate_tex_target( enum pipe_texture_target target ) -{ - switch (target) { - case PIPE_TEXTURE_1D: - return BRW_SURFACE_1D; - - case PIPE_TEXTURE_2D: - return BRW_SURFACE_2D; - - case PIPE_TEXTURE_3D: - return BRW_SURFACE_3D; - - case PIPE_TEXTURE_CUBE: - return BRW_SURFACE_CUBE; - - default: - assert(0); - return 0; - } -} - -static unsigned translate_tex_format( enum pipe_format pipe_format ) -{ - switch( pipe_format ) { - case PIPE_FORMAT_L8_UNORM: - return BRW_SURFACEFORMAT_L8_UNORM; - - case PIPE_FORMAT_I8_UNORM: - return BRW_SURFACEFORMAT_I8_UNORM; - - case PIPE_FORMAT_A8_UNORM: - return BRW_SURFACEFORMAT_A8_UNORM; - - case PIPE_FORMAT_A8L8_UNORM: - return BRW_SURFACEFORMAT_L8A8_UNORM; - - case PIPE_FORMAT_R8G8B8_UNORM: - assert(0); /* not supported for sampling */ - return BRW_SURFACEFORMAT_R8G8B8_UNORM; - - case PIPE_FORMAT_B8G8R8A8_UNORM: - return BRW_SURFACEFORMAT_B8G8R8A8_UNORM; - - case PIPE_FORMAT_R8G8B8A8_UNORM: - return BRW_SURFACEFORMAT_R8G8B8A8_UNORM; - - case PIPE_FORMAT_R5G6B5_UNORM: - return BRW_SURFACEFORMAT_B5G6R5_UNORM; - - case PIPE_FORMAT_A1R5G5B5_UNORM: - return BRW_SURFACEFORMAT_B5G5R5A1_UNORM; - - case PIPE_FORMAT_A4R4G4B4_UNORM: - return BRW_SURFACEFORMAT_B4G4R4A4_UNORM; - - case PIPE_FORMAT_YCBCR_REV: - return BRW_SURFACEFORMAT_YCRCB_NORMAL; - - case PIPE_FORMAT_YCBCR: - return BRW_SURFACEFORMAT_YCRCB_SWAPUVY; -#if 0 - case PIPE_FORMAT_RGB_FXT1: - case PIPE_FORMAT_RGBA_FXT1: - return BRW_SURFACEFORMAT_FXT1; -#endif - - case PIPE_FORMAT_Z16_UNORM: - return BRW_SURFACEFORMAT_I16_UNORM; -#if 0 - case PIPE_FORMAT_RGB_DXT1: - return BRW_SURFACEFORMAT_DXT1_RGB; - - case PIPE_FORMAT_RGBA_DXT1: - return BRW_SURFACEFORMAT_BC1_UNORM; - - case PIPE_FORMAT_RGBA_DXT3: - return BRW_SURFACEFORMAT_BC2_UNORM; - - case PIPE_FORMAT_RGBA_DXT5: - return BRW_SURFACEFORMAT_BC3_UNORM; - - case PIPE_FORMAT_SRGBA8: - return BRW_SURFACEFORMAT_R8G8B8A8_UNORM_SRGB; - case PIPE_FORMAT_SRGB_DXT1: - return BRW_SURFACEFORMAT_BC1_UNORM_SRGB; -#endif - - default: - assert(0); - return 0; - } -} - -static unsigned brw_buffer_offset(struct brw_context *brw, - struct pipe_buffer *buffer) -{ - return brw->winsys->get_buffer_offset(brw->winsys, - buffer, - 0); -} - -static -void brw_update_texture_surface( struct brw_context *brw, - unsigned unit ) -{ - const struct brw_texture *tObj = brw->attribs.Texture[unit]; - struct brw_surface_state surf; - - memset(&surf, 0, sizeof(surf)); - - surf.ss0.mipmap_layout_mode = BRW_SURFACE_MIPMAPLAYOUT_BELOW; - surf.ss0.surface_type = translate_tex_target(tObj->base.target); - surf.ss0.surface_format = translate_tex_format(tObj->base.format); - - /* This is ok for all textures with channel width 8bit or less: - */ -/* surf.ss0.data_return_format = BRW_SURFACERETURNFORMAT_S1; */ - - /* Updated in emit_reloc */ - surf.ss1.base_addr = brw_buffer_offset( brw, tObj->buffer ); - - surf.ss2.mip_count = tObj->base.last_level; - surf.ss2.width = tObj->base.width[0] - 1; - surf.ss2.height = tObj->base.height[0] - 1; - - surf.ss3.tile_walk = BRW_TILEWALK_XMAJOR; - surf.ss3.tiled_surface = 0; /* always zero */ - surf.ss3.pitch = tObj->stride - 1; - surf.ss3.depth = tObj->base.depth[0] - 1; - - surf.ss4.min_lod = 0; - - if (tObj->base.target == PIPE_TEXTURE_CUBE) { - surf.ss0.cube_pos_x = 1; - surf.ss0.cube_pos_y = 1; - surf.ss0.cube_pos_z = 1; - surf.ss0.cube_neg_x = 1; - surf.ss0.cube_neg_y = 1; - surf.ss0.cube_neg_z = 1; - } - - brw->wm.bind.surf_ss_offset[unit + 1] = - brw_cache_data( &brw->cache[BRW_SS_SURFACE], &surf ); -} - - - -#define OFFSET(TYPE, FIELD) ( (unsigned)&(((TYPE *)0)->FIELD) ) - - -static void upload_wm_surfaces(struct brw_context *brw ) -{ - unsigned i; - - { - struct brw_surface_state surf; - - /* BRW_NEW_FRAMEBUFFER - */ - struct pipe_surface *pipe_surface = brw->attribs.FrameBuffer.cbufs[0];/*fixme*/ - struct brw_texture *tex = (struct brw_texture *)pipe_surface->texture; - - memset(&surf, 0, sizeof(surf)); - - if (pipe_surface != NULL) { - if (pipe_surface->block.size == 4) - surf.ss0.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; - else - surf.ss0.surface_format = BRW_SURFACEFORMAT_B5G6R5_UNORM; - - surf.ss0.surface_type = BRW_SURFACE_2D; - - surf.ss1.base_addr = brw_buffer_offset( brw, tex->buffer ); - - surf.ss2.width = pipe_surface->width - 1; - surf.ss2.height = pipe_surface->height - 1; - surf.ss3.tile_walk = BRW_TILEWALK_XMAJOR; - surf.ss3.tiled_surface = 0; - surf.ss3.pitch = pipe_surface->stride - 1; - } else { - surf.ss0.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; - surf.ss0.surface_type = BRW_SURFACE_NULL; - } - - /* BRW_NEW_BLEND */ - surf.ss0.color_blend = (!brw->attribs.Blend->logicop_enable && - brw->attribs.Blend->blend_enable); - - - surf.ss0.writedisable_red = !(brw->attribs.Blend->colormask & PIPE_MASK_R); - surf.ss0.writedisable_green = !(brw->attribs.Blend->colormask & PIPE_MASK_G); - surf.ss0.writedisable_blue = !(brw->attribs.Blend->colormask & PIPE_MASK_B); - surf.ss0.writedisable_alpha = !(brw->attribs.Blend->colormask & PIPE_MASK_A); - - - - - brw->wm.bind.surf_ss_offset[0] = brw_cache_data( &brw->cache[BRW_SS_SURFACE], &surf ); - - brw->wm.nr_surfaces = 1; - } - - - /* BRW_NEW_TEXTURE - */ - for (i = 0; i < brw->num_textures && i < brw->num_samplers; i++) { - const struct brw_texture *texUnit = brw->attribs.Texture[i]; - - if (texUnit && - texUnit->base.reference.count/*(texUnit->reference.count > 0) == really used */) { - - brw_update_texture_surface(brw, i); - - brw->wm.nr_surfaces = i+2; - } - else { - brw->wm.bind.surf_ss_offset[i+1] = 0; - } - } - - brw->wm.bind_ss_offset = brw_cache_data( &brw->cache[BRW_SS_SURF_BIND], - &brw->wm.bind ); -} - - -/* KW: Will find a different way to acheive this, see for example the - * state caches with relocs in the i915 swz driver. - */ -#if 0 -static void emit_reloc_wm_surfaces(struct brw_context *brw) -{ - int unit; - - if (brw->state.draw_region != NULL) { - /* Emit framebuffer relocation */ - dri_emit_reloc(brw_cache_buffer(brw, BRW_SS_SURFACE), - DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ | DRM_BO_FLAG_WRITE, - 0, - brw->wm.bind.surf_ss_offset[0] + - offsetof(struct brw_surface_state, ss1), - brw->state.draw_region->buffer); - } - - /* Emit relocations for texture buffers */ - for (unit = 0; unit < BRW_MAX_TEX_UNIT; unit++) { - struct gl_texture_unit *texUnit = &brw->attribs.Texture->Unit[unit]; - struct gl_texture_object *tObj = texUnit->_Current; - struct intel_texture_object *intelObj = intel_texture_object(tObj); - - if (texUnit->_ReallyEnabled && intelObj->mt != NULL) { - dri_emit_reloc(brw_cache_buffer(brw, BRW_SS_SURFACE), - DRM_BO_FLAG_MEM_TT | DRM_BO_FLAG_READ, - 0, - brw->wm.bind.surf_ss_offset[unit + 1] + - offsetof(struct brw_surface_state, ss1), - intelObj->mt->region->buffer); - } - } -} -#endif - -const struct brw_tracked_state brw_wm_surfaces = { - .dirty = { - .brw = (BRW_NEW_FRAMEBUFFER | - BRW_NEW_BLEND | - BRW_NEW_TEXTURE), - .cache = 0 - }, - .update = upload_wm_surfaces, -}; diff --git a/src/gallium/winsys/xlib/SConscript b/src/gallium/winsys/xlib/SConscript index 467d595d33..14d4ca7c33 100644 --- a/src/gallium/winsys/xlib/SConscript +++ b/src/gallium/winsys/xlib/SConscript @@ -36,15 +36,6 @@ if env['platform'] == 'linux' \ env.Tool('udis86') sources += ['xlib_llvmpipe.c'] drivers += [llvmpipe] - - if 'i965simple' in env['drivers']: - env.Append(CPPDEFINES = 'GALLIUM_I965SIMPLE') - sources += [ - 'xlib_brw_aub.c', - 'xlib_brw_context.c', - 'xlib_brw_screen.c', - ] - drivers += [i965simple] if 'cell' in env['drivers']: env.Append(CPPDEFINES = 'GALLIUM_CELL') diff --git a/src/gallium/winsys/xlib/xlib.c b/src/gallium/winsys/xlib/xlib.c index 4b71cf7ec3..163cc8863c 100644 --- a/src/gallium/winsys/xlib/xlib.c +++ b/src/gallium/winsys/xlib/xlib.c @@ -43,7 +43,6 @@ enum mode { MODE_TRACE, - MODE_BRW, MODE_CELL, MODE_LLVMPIPE, MODE_SOFTPIPE @@ -55,9 +54,6 @@ static enum mode get_mode() if (getenv("XMESA_TRACE")) return MODE_TRACE; - if (getenv("XMESA_BRW")) - return MODE_BRW; - #ifdef GALLIUM_CELL if (!getenv("GALLIUM_NOCELL")) return MODE_CELL; @@ -80,11 +76,6 @@ static void _init( void ) case MODE_TRACE: #if defined(GALLIUM_TRACE) && defined(GALLIUM_SOFTPIPE) xmesa_set_driver( &xlib_trace_driver ); -#endif - break; - case MODE_BRW: -#if defined(GALLIUM_BRW) - xmesa_set_driver( &xlib_brw_driver ); #endif break; case MODE_CELL: diff --git a/src/gallium/winsys/xlib/xlib.h b/src/gallium/winsys/xlib/xlib.h index 347d45f4d6..f0855035f7 100644 --- a/src/gallium/winsys/xlib/xlib.h +++ b/src/gallium/winsys/xlib/xlib.h @@ -9,7 +9,6 @@ extern struct xm_driver xlib_trace_driver; extern struct xm_driver xlib_softpipe_driver; extern struct xm_driver xlib_llvmpipe_driver; extern struct xm_driver xlib_cell_driver; -extern struct xm_driver xlib_brw_driver; #endif diff --git a/src/gallium/winsys/xlib/xlib_brw.h b/src/gallium/winsys/xlib/xlib_brw.h deleted file mode 100644 index be2dd147db..0000000000 --- a/src/gallium/winsys/xlib/xlib_brw.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef XLIB_BRW_H -#define XLIB_BRW_H - -struct pipe_winsys; -struct pipe_buffer; -struct pipe_surface; -struct xmesa_buffer; - -unsigned xlib_brw_get_buffer_offset( struct pipe_winsys *pws, - struct pipe_buffer *buf, - unsigned access_flags ); - -void xlib_brw_buffer_subdata_typed( struct pipe_winsys *pws, - struct pipe_buffer *buf, - unsigned long offset, - unsigned long size, - const void *data, - unsigned data_type ); - - - -void xlib_brw_commands_aub(struct pipe_winsys *winsys, - unsigned *cmds, - unsigned nr_dwords); - -struct pipe_context * -xlib_create_brw_context( struct pipe_screen *screen, - void *unused ); - -#endif diff --git a/src/gallium/winsys/xlib/xlib_brw_aub.c b/src/gallium/winsys/xlib/xlib_brw_aub.c deleted file mode 100644 index b6bd849ef2..0000000000 --- a/src/gallium/winsys/xlib/xlib_brw_aub.c +++ /dev/null @@ -1,399 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - -#include -#include -#include "xlib_brw_aub.h" -#include "pipe/p_context.h" -#include "pipe/p_state.h" -#include "util/u_debug.h" -#include "util/u_memory.h" -#include "softpipe/sp_texture.h" - - -struct brw_aubfile { - FILE *file; - unsigned next_free_page; -}; - - -extern char *__progname; - - -struct aub_file_header { - unsigned int instruction_type; - unsigned int pad0:16; - unsigned int minor:8; - unsigned int major:8; - unsigned char application[8*4]; - unsigned int day:8; - unsigned int month:8; - unsigned int year:16; - unsigned int timezone:8; - unsigned int second:8; - unsigned int minute:8; - unsigned int hour:8; - unsigned int comment_length:16; - unsigned int pad1:16; -}; - -struct aub_block_header { - unsigned int instruction_type; - unsigned int operation:8; - unsigned int type:8; - unsigned int address_space:8; - unsigned int pad0:8; - unsigned int general_state_type:8; - unsigned int surface_state_type:8; - unsigned int pad1:16; - unsigned int address; - unsigned int length; -}; - -struct aub_dump_bmp { - unsigned int instruction_type; - unsigned int xmin:16; - unsigned int ymin:16; - unsigned int pitch:16; - unsigned int bpp:8; - unsigned int format:8; - unsigned int xsize:16; - unsigned int ysize:16; - unsigned int addr; - unsigned int unknown; -}; - -enum bh_operation { - BH_COMMENT, - BH_DATA_WRITE, - BH_COMMAND_WRITE, - BH_MMI0_WRITE32, - BH_END_SCENE, - BH_CONFIG_MEMORY_MAP, - BH_MAX_OPERATION -}; - -enum command_write_type { - CW_HWB_RING = 1, - CW_PRIMARY_RING_A, - CW_PRIMARY_RING_B, /* XXX - disagreement with listaub! */ - CW_PRIMARY_RING_C, - CW_MAX_TYPE -}; - -enum memory_map_type { - MM_DEFAULT, - MM_DYNAMIC, - MM_MAX_TYPE -}; - -enum address_space { - ADDR_GTT, - ADDR_LOCAL, - ADDR_MAIN, - ADDR_MAX -}; - - -#define AUB_FILE_HEADER 0xe085000b -#define AUB_BLOCK_HEADER 0xe0c10003 -#define AUB_DUMP_BMP 0xe09e0004 - -/* Registers to control page table - */ -#define PGETBL_CTL 0x2020 -#define PGETBL_ENABLED 0x1 - -#define NR_GTT_ENTRIES 65536 /* 256 mb */ - -#define FAIL \ -do { \ - fprintf(stderr, "failed to write aub data at %s/%d\n", __FUNCTION__, __LINE__); \ - exit(1); \ -} while (0) - - -/* Emit the headers at the top of each aubfile. Initialize the GTT. - */ -static void init_aubfile( FILE *aub_file ) -{ - struct aub_file_header fh; - struct aub_block_header bh; - unsigned int data; - - static int nr; - - nr++; - - /* Emit the aub header: - */ - memset(&fh, 0, sizeof(fh)); - - fh.instruction_type = AUB_FILE_HEADER; - fh.minor = 0x0; - fh.major = 0x7; - memcpy(fh.application, __progname, sizeof(fh.application)); - fh.day = (nr>>24) & 0xff; - fh.month = 0x0; - fh.year = 0x0; - fh.timezone = 0x0; - fh.second = nr & 0xff; - fh.minute = (nr>>8) & 0xff; - fh.hour = (nr>>16) & 0xff; - fh.comment_length = 0x0; - - if (fwrite(&fh, sizeof(fh), 1, aub_file) < 0) - FAIL; - - /* Setup the GTT starting at main memory address zero (!): - */ - memset(&bh, 0, sizeof(bh)); - - bh.instruction_type = AUB_BLOCK_HEADER; - bh.operation = BH_MMI0_WRITE32; - bh.type = 0x0; - bh.address_space = ADDR_GTT; /* ??? */ - bh.general_state_type = 0x0; - bh.surface_state_type = 0x0; - bh.address = PGETBL_CTL; - bh.length = 0x4; - - if (fwrite(&bh, sizeof(bh), 1, aub_file) < 0) - FAIL; - - data = 0x0 | PGETBL_ENABLED; - - if (fwrite(&data, sizeof(data), 1, aub_file) < 0) - FAIL; -} - - -static void init_aub_gtt( struct brw_aubfile *aubfile, - unsigned start_offset, - unsigned size ) -{ - FILE *aub_file = aubfile->file; - struct aub_block_header bh; - unsigned int i; - - assert(start_offset + size < NR_GTT_ENTRIES * 4096); - - - memset(&bh, 0, sizeof(bh)); - - bh.instruction_type = AUB_BLOCK_HEADER; - bh.operation = BH_DATA_WRITE; - bh.type = 0x0; - bh.address_space = ADDR_MAIN; - bh.general_state_type = 0x0; - bh.surface_state_type = 0x0; - bh.address = start_offset / 4096 * 4; - bh.length = size / 4096 * 4; - - if (fwrite(&bh, sizeof(bh), 1, aub_file) < 0) - FAIL; - - for (i = 0; i < size / 4096; i++) { - unsigned data = aubfile->next_free_page | 1; - - aubfile->next_free_page += 4096; - - if (fwrite(&data, sizeof(data), 1, aub_file) < 0) - FAIL; - } - -} - -static void write_block_header( FILE *aub_file, - struct aub_block_header *bh, - const unsigned *data, - unsigned sz ) -{ - sz = (sz + 3) & ~3; - - if (fwrite(bh, sizeof(*bh), 1, aub_file) < 0) - FAIL; - - if (fwrite(data, sz, 1, aub_file) < 0) - FAIL; - - fflush(aub_file); -} - - -static void write_dump_bmp( FILE *aub_file, - struct aub_dump_bmp *db ) -{ - if (fwrite(db, sizeof(*db), 1, aub_file) < 0) - FAIL; - - fflush(aub_file); -} - - - -void brw_aub_gtt_data( struct brw_aubfile *aubfile, - unsigned offset, - const void *data, - unsigned sz, - unsigned type, - unsigned state_type ) -{ - struct aub_block_header bh; - - bh.instruction_type = AUB_BLOCK_HEADER; - bh.operation = BH_DATA_WRITE; - bh.type = type; - bh.address_space = ADDR_GTT; - bh.pad0 = 0; - - if (type == DW_GENERAL_STATE) { - bh.general_state_type = state_type; - bh.surface_state_type = 0; - } - else { - bh.general_state_type = 0; - bh.surface_state_type = state_type; - } - - bh.pad1 = 0; - bh.address = offset; - bh.length = sz; - - write_block_header(aubfile->file, &bh, data, sz); -} - - - -void brw_aub_gtt_cmds( struct brw_aubfile *aubfile, - unsigned offset, - const void *data, - unsigned sz ) -{ - struct aub_block_header bh; - unsigned type = CW_PRIMARY_RING_A; - - - bh.instruction_type = AUB_BLOCK_HEADER; - bh.operation = BH_COMMAND_WRITE; - bh.type = type; - bh.address_space = ADDR_GTT; - bh.pad0 = 0; - bh.general_state_type = 0; - bh.surface_state_type = 0; - bh.pad1 = 0; - bh.address = offset; - bh.length = sz; - - write_block_header(aubfile->file, &bh, data, sz); -} - -void brw_aub_dump_bmp( struct brw_aubfile *aubfile, - struct pipe_surface *surface, - unsigned gtt_offset ) -{ - struct aub_dump_bmp db; - unsigned format; - - assert(surface->texture->block.width == 1); - assert(surface->texture->block.height == 1); - - if (surface->texture->block.size == 4) - format = 0x7; - else - format = 0x3; - - db.instruction_type = AUB_DUMP_BMP; - db.xmin = 0; - db.ymin = 0; - db.format = format; - db.bpp = surface->texture->block.size * 8; - db.pitch = softpipe_texture(surface->texture)->stride[surface->level] / - surface->texture->block.size; - db.xsize = surface->width; - db.ysize = surface->height; - db.addr = gtt_offset; - db.unknown = /* surface->tiled ? 0x4 : */ 0x0; - - write_dump_bmp(aubfile->file, &db); -} - - - -struct brw_aubfile *brw_aubfile_create( void ) -{ - struct brw_aubfile *aubfile = CALLOC_STRUCT(brw_aubfile); - char filename[80]; - int val; - static int i = 0; - - i++; - - if (getenv("INTEL_AUBFILE")) { - val = snprintf(filename, sizeof(filename), "%s%d.aub", getenv("INTEL_AUBFILE"), i%4); - debug_printf("--> Aub file: %s\n", filename); - aubfile->file = fopen(filename, "w"); - } - else { - val = snprintf(filename, sizeof(filename), "%s.aub", __progname); - if (val < 0 || val > sizeof(filename)) - strcpy(filename, "default.aub"); - - debug_printf("--> Aub file: %s\n", filename); - aubfile->file = fopen(filename, "w"); - } - - if (!aubfile->file) { - debug_printf("couldn't open aubfile\n"); - exit(1); - } - - init_aubfile(aubfile->file); - - /* The GTT is located starting address zero in main memory. Pages - * to populate the gtt start after this point. - */ - aubfile->next_free_page = (NR_GTT_ENTRIES * 4 + 4095) & ~4095; - - /* More or less correspond with all the agp regions mapped by the - * driver: - */ - init_aub_gtt(aubfile, 0, 4096*4); - init_aub_gtt(aubfile, AUB_BUF_START, AUB_BUF_SIZE); - - return aubfile; -} - -void brw_aub_destroy( struct brw_aubfile *aubfile ) -{ - fclose(aubfile->file); - FREE(aubfile); -} diff --git a/src/gallium/winsys/xlib/xlib_brw_aub.h b/src/gallium/winsys/xlib/xlib_brw_aub.h deleted file mode 100644 index f5c60c7be2..0000000000 --- a/src/gallium/winsys/xlib/xlib_brw_aub.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - Copyright (C) Intel Corp. 2006. All Rights Reserved. - Intel funded Tungsten Graphics (http://www.tungstengraphics.com) to - develop this 3D driver. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice (including the - next paragraph) shall be included in all copies or substantial - portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - */ - -#ifndef BRW_AUB_H -#define BRW_AUB_H - -/* We set up this region, buffers may be allocated here: - */ -#define AUB_BUF_START (4096*4) -#define AUB_BUF_SIZE (8*1024*1024) - -struct intel_context; -struct pipe_surface; - -struct brw_aubfile *brw_aubfile_create( void ); - -void brw_aub_destroy( struct brw_aubfile *aubfile ); - -void brw_aub_gtt_data( struct brw_aubfile *aubfile, - unsigned offset, - const void *data, - unsigned sz, - unsigned type, - unsigned state_type ); - -void brw_aub_gtt_cmds( struct brw_aubfile *aubfile, - unsigned offset, - const void *data, - unsigned sz ); - -void brw_aub_dump_bmp( struct brw_aubfile *aubfile, - struct pipe_surface *surface, - unsigned gtt_offset ); - - -enum data_write_type { - DW_NOTYPE, - DW_BATCH_BUFFER, - DW_BIN_BUFFER, - DW_BIN_POINTER_LIST, - DW_SLOW_STATE_BUFFER, - DW_VERTEX_BUFFER, - DW_2D_MAP, - DW_CUBE_MAP, - DW_INDIRECT_STATE_BUFFER, - DW_VOLUME_MAP, - DW_1D_MAP, - DW_CONSTANT_BUFFER, - DW_CONSTANT_URB_ENTRY, - DW_INDEX_BUFFER, - DW_GENERAL_STATE, - DW_SURFACE_STATE, - DW_MEDIA_OBJECT_INDIRECT_DATA, - DW_MAX_TYPE -}; - -enum data_write_general_state_type { - DWGS_NOTYPE, - DWGS_VERTEX_SHADER_STATE, - DWGS_GEOMETRY_SHADER_STATE , - DWGS_CLIPPER_STATE, - DWGS_STRIPS_FANS_STATE, - DWGS_WINDOWER_IZ_STATE, - DWGS_COLOR_CALC_STATE, - DWGS_CLIPPER_VIEWPORT_STATE, /* was 0x7 */ - DWGS_STRIPS_FANS_VIEWPORT_STATE, - DWGS_COLOR_CALC_VIEWPORT_STATE, /* was 0x9 */ - DWGS_SAMPLER_STATE, - DWGS_KERNEL_INSTRUCTIONS, - DWGS_SCRATCH_SPACE, - DWGS_SAMPLER_DEFAULT_COLOR, - DWGS_INTERFACE_DESCRIPTOR, - DWGS_VLD_STATE, - DWGS_VFE_STATE, - DWGS_MAX_TYPE -}; - -enum data_write_surface_state_type { - DWSS_NOTYPE, - DWSS_BINDING_TABLE_STATE, - DWSS_SURFACE_STATE, - DWSS_MAX_TYPE -}; - - -#endif diff --git a/src/gallium/winsys/xlib/xlib_brw_context.c b/src/gallium/winsys/xlib/xlib_brw_context.c deleted file mode 100644 index 09599507f4..0000000000 --- a/src/gallium/winsys/xlib/xlib_brw_context.c +++ /dev/null @@ -1,209 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Bismarck, ND., USA - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * - **************************************************************************/ - -/* - * Authors: - * Keith Whitwell - * Brian Paul - */ - - -//#include "glxheader.h" -//#include "xmesaP.h" - -#include "pipe/internal/p_winsys_screen.h" -#include "pipe/p_inlines.h" -#include "util/u_math.h" -#include "util/u_memory.h" -#include "i965simple/brw_winsys.h" -#include "xlib_brw_aub.h" -#include "xlib_brw.h" - - - - -#define XBCWS_BATCHBUFFER_SIZE 1024 - - -/* The backend to the brw driver (ie struct brw_winsys) is actually a - * per-context entity. - */ -struct xlib_brw_context_winsys { - struct brw_winsys brw_context_winsys; /**< batch buffer funcs */ - struct aub_context *aub; - - struct pipe_winsys *pipe_winsys; - - unsigned batch_data[XBCWS_BATCHBUFFER_SIZE]; - unsigned batch_nr; - unsigned batch_size; - unsigned batch_alloc; -}; - - -/* Turn a brw_winsys into an xlib_brw_context_winsys: - */ -static inline struct xlib_brw_context_winsys * -xlib_brw_context_winsys( struct brw_winsys *sws ) -{ - return (struct xlib_brw_context_winsys *)sws; -} - - -/* Simple batchbuffer interface: - */ - -static unsigned *xbcws_batch_start( struct brw_winsys *sws, - unsigned dwords, - unsigned relocs ) -{ - struct xlib_brw_context_winsys *xbcws = xlib_brw_context_winsys(sws); - - if (xbcws->batch_size < xbcws->batch_nr + dwords) - return NULL; - - xbcws->batch_alloc = xbcws->batch_nr + dwords; - return (void *)1; /* not a valid pointer! */ -} - -static void xbcws_batch_dword( struct brw_winsys *sws, - unsigned dword ) -{ - struct xlib_brw_context_winsys *xbcws = xlib_brw_context_winsys(sws); - - assert(xbcws->batch_nr < xbcws->batch_alloc); - xbcws->batch_data[xbcws->batch_nr++] = dword; -} - -static void xbcws_batch_reloc( struct brw_winsys *sws, - struct pipe_buffer *buf, - unsigned access_flags, - unsigned delta ) -{ - struct xlib_brw_context_winsys *xbcws = xlib_brw_context_winsys(sws); - - assert(xbcws->batch_nr < xbcws->batch_alloc); - xbcws->batch_data[xbcws->batch_nr++] = - ( xlib_brw_get_buffer_offset( NULL, buf, access_flags ) + - delta ); -} - -static void xbcws_batch_end( struct brw_winsys *sws ) -{ - struct xlib_brw_context_winsys *xbcws = xlib_brw_context_winsys(sws); - - assert(xbcws->batch_nr <= xbcws->batch_alloc); - xbcws->batch_alloc = 0; -} - -static void xbcws_batch_flush( struct brw_winsys *sws, - struct pipe_fence_handle **fence ) -{ - struct xlib_brw_context_winsys *xbcws = xlib_brw_context_winsys(sws); - assert(xbcws->batch_nr <= xbcws->batch_size); - - if (xbcws->batch_nr) { - xlib_brw_commands_aub( xbcws->pipe_winsys, - xbcws->batch_data, - xbcws->batch_nr ); - } - - xbcws->batch_nr = 0; -} - - - -/* Really a per-device function, just pass through: - */ -static unsigned xbcws_get_buffer_offset( struct brw_winsys *sws, - struct pipe_buffer *buf, - unsigned access_flags ) -{ - struct xlib_brw_context_winsys *xbcws = xlib_brw_context_winsys(sws); - - return xlib_brw_get_buffer_offset( xbcws->pipe_winsys, - buf, - access_flags ); -} - - -/* Really a per-device function, just pass through: - */ -static void xbcws_buffer_subdata_typed( struct brw_winsys *sws, - struct pipe_buffer *buf, - unsigned long offset, - unsigned long size, - const void *data, - unsigned data_type ) -{ - struct xlib_brw_context_winsys *xbcws = xlib_brw_context_winsys(sws); - - xlib_brw_buffer_subdata_typed( xbcws->pipe_winsys, - buf, - offset, - size, - data, - data_type ); -} - - -/** - * Create i965 hardware rendering context, but plugged into a - * dump-to-aubfile backend. - */ -struct pipe_context * -xlib_create_brw_context( struct pipe_screen *screen, - void *unused ) -{ - struct xlib_brw_context_winsys *xbcws = CALLOC_STRUCT( xlib_brw_context_winsys ); - - /* Fill in this struct with callbacks that i965simple will need to - * communicate with the window system, buffer manager, etc. - */ - xbcws->brw_context_winsys.batch_start = xbcws_batch_start; - xbcws->brw_context_winsys.batch_dword = xbcws_batch_dword; - xbcws->brw_context_winsys.batch_reloc = xbcws_batch_reloc; - xbcws->brw_context_winsys.batch_end = xbcws_batch_end; - xbcws->brw_context_winsys.batch_flush = xbcws_batch_flush; - xbcws->brw_context_winsys.buffer_subdata_typed = xbcws_buffer_subdata_typed; - xbcws->brw_context_winsys.get_buffer_offset = xbcws_get_buffer_offset; - - xbcws->pipe_winsys = screen->winsys; /* redundant */ - - xbcws->batch_size = XBCWS_BATCHBUFFER_SIZE; - - /* Create the i965simple context: - */ -#ifdef GALLIUM_CELL - return NULL; -#else - return brw_create( screen, - &xbcws->brw_context_winsys, - 0 ); -#endif -} diff --git a/src/gallium/winsys/xlib/xlib_brw_screen.c b/src/gallium/winsys/xlib/xlib_brw_screen.c deleted file mode 100644 index ef545796f3..0000000000 --- a/src/gallium/winsys/xlib/xlib_brw_screen.c +++ /dev/null @@ -1,469 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Bismarck, ND., USA - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * - **************************************************************************/ - -/* - * Authors: - * Keith Whitwell - * Brian Paul - */ - - -//#include "state_trackers/xlib/glxheader.h" -//#include "state_trackers/xlib/xmesaP.h" - -#include "pipe/internal/p_winsys_screen.h" -#include "util/u_math.h" -#include "util/u_memory.h" -#include "i965simple/brw_winsys.h" -#include "i965simple/brw_screen.h" -#include "i965simple/brw_context.h" - - -#include "xlib_brw_aub.h" -#include "xlib_brw.h" -#include "xlib.h" - -static struct pipe_buffer * -buffer_from_surface(struct pipe_surface *surface) -{ - struct brw_texture *texture = (struct brw_texture *)surface; - return texture->buffer; -} - -struct aub_buffer { - struct pipe_reference reference; - char *data; - unsigned offset; - unsigned size; - unsigned map_count; - boolean dump_on_unmap; -}; - - - -struct aub_pipe_winsys { - struct pipe_winsys winsys; - - struct brw_aubfile *aubfile; - - /* This is simple, isn't it: - */ - char *pool; - unsigned size; - unsigned used; -}; - - -/* Turn a pipe winsys into an aub/pipe winsys: - */ -static inline struct aub_pipe_winsys * -aub_pipe_winsys( struct pipe_winsys *winsys ) -{ - return (struct aub_pipe_winsys *)winsys; -} - - - -static INLINE struct aub_buffer * -aub_bo( struct pipe_buffer *bo ) -{ - return (struct aub_buffer *)bo; -} - -static INLINE struct pipe_buffer * -pipe_bo( struct aub_buffer *bo ) -{ - return (struct pipe_buffer *)bo; -} - - - - -static void *aub_buffer_map(struct pipe_winsys *winsys, - struct pipe_buffer *buf, - unsigned flags ) -{ - struct aub_buffer *sbo = aub_bo(buf); - - assert(sbo->data); - - if (flags & PIPE_BUFFER_USAGE_CPU_WRITE) - sbo->dump_on_unmap = 1; - - sbo->map_count++; - return sbo->data; -} - -static void aub_buffer_unmap(struct pipe_winsys *winsys, - struct pipe_buffer *buf) -{ - struct aub_pipe_winsys *iws = aub_pipe_winsys(winsys); - struct aub_buffer *sbo = aub_bo(buf); - - sbo->map_count--; - - if (sbo->map_count == 0 && - sbo->dump_on_unmap) { - - sbo->dump_on_unmap = 0; - - brw_aub_gtt_data( iws->aubfile, - sbo->offset, - sbo->data, - sbo->size, - 0, - 0); - } -} - - -static void -aub_buffer_destroy(struct pipe_buffer *buf) -{ - free(buf); -} - - - -void xlib_brw_commands_aub(struct pipe_winsys *winsys, - unsigned *cmds, - unsigned nr_dwords) -{ - struct aub_pipe_winsys *iws = aub_pipe_winsys(winsys); - unsigned size = nr_dwords * 4; - - assert(iws->used + size < iws->size); - - brw_aub_gtt_cmds( iws->aubfile, - AUB_BUF_START + iws->used, - cmds, - nr_dwords * sizeof(int) ); - - iws->used += align(size, 4096); -} - - -/* XXX: fix me: - */ -static struct aub_pipe_winsys *global_winsys = NULL; - - - - -/* Pipe has no concept of pools. We choose the tex/region pool - * for all buffers. - */ -static struct pipe_buffer * -aub_buffer_create(struct pipe_winsys *winsys, - unsigned alignment, - unsigned usage, - unsigned size) -{ - struct aub_pipe_winsys *iws = aub_pipe_winsys(winsys); - struct aub_buffer *sbo = CALLOC_STRUCT(aub_buffer); - - pipe_reference_init(&sbo->reference, 1); - - /* Could reuse buffers that are not referenced in current - * batchbuffer. Can't do that atm, so always reallocate: - */ - assert(iws->used + size < iws->size); - sbo->data = iws->pool + iws->used; - sbo->offset = AUB_BUF_START + iws->used; - iws->used += align(size, 4096); - - sbo->size = size; - - return pipe_bo(sbo); -} - - -static struct pipe_buffer * -aub_user_buffer_create(struct pipe_winsys *winsys, void *ptr, unsigned bytes) -{ - struct aub_buffer *sbo; - - /* Lets hope this is meant for upload, not as a result! - */ - sbo = aub_bo(aub_buffer_create( winsys, 0, 0, 0 )); - - sbo->data = ptr; - sbo->size = bytes; - - return pipe_bo(sbo); -} - - -/* The state tracker (should!) keep track of whether the fake - * frontbuffer has been touched by any rendering since the last time - * we copied its contents to the real frontbuffer. Our task is easy: - */ -static void -aub_flush_frontbuffer( struct pipe_winsys *winsys, - struct pipe_surface *surface, - void *context_private) -{ -// struct aub_pipe_winsys *iws = aub_pipe_winsys(winsys); - brw_aub_dump_bmp( global_winsys->aubfile, - surface, - aub_bo(buffer_from_surface(surface))->offset ); -} - - -/** - * Round n up to next multiple. - */ -static INLINE unsigned -round_up(unsigned n, unsigned multiple) -{ - return (n + multiple - 1) & ~(multiple - 1); -} - -static struct pipe_buffer * -aub_i915_surface_buffer_create(struct pipe_winsys *winsys, - unsigned width, unsigned height, - enum pipe_format format, - unsigned usage, - unsigned tex_usage, - unsigned *stride) -{ - const unsigned alignment = 64; - struct pipe_format_block block; - unsigned nblocksx, nblocksy; - - pf_get_block(format, &block); - nblocksx = pf_get_nblocksx(&block, width); - nblocksy = pf_get_nblocksy(&block, height); - *stride = round_up(nblocksx * block.size, alignment); - - return winsys->buffer_create(winsys, alignment, - usage, - *stride * nblocksy); -} - - -static const char * -aub_get_name( struct pipe_winsys *winsys ) -{ - return "Aub/xlib"; -} - -static void -xlib_brw_destroy_pipe_winsys_aub( struct pipe_winsys *winsys ) - -{ - struct aub_pipe_winsys *iws = aub_pipe_winsys(winsys); - brw_aub_destroy(iws->aubfile); - free(iws->pool); - free(iws); -} - - - -static struct pipe_winsys * -xlib_create_brw_winsys( void ) -{ - struct aub_pipe_winsys *iws = CALLOC_STRUCT( aub_pipe_winsys ); - - /* Fill in this struct with callbacks that pipe will need to - * communicate with the window system, buffer manager, etc. - * - * Pipe would be happy with a malloc based memory manager, but - * the SwapBuffers implementation in this winsys driver requires - * that rendering be done to an appropriate _DriBufferObject. - */ - iws->winsys.buffer_create = aub_buffer_create; - iws->winsys.user_buffer_create = aub_user_buffer_create; - iws->winsys.buffer_map = aub_buffer_map; - iws->winsys.buffer_unmap = aub_buffer_unmap; - iws->winsys.buffer_destroy = aub_buffer_destroy; - iws->winsys.flush_frontbuffer = aub_flush_frontbuffer; - iws->winsys.get_name = aub_get_name; - iws->winsys.destroy = xlib_brw_destroy_pipe_winsys_aub; - - iws->winsys.surface_buffer_create = aub_i915_surface_buffer_create; - - iws->aubfile = brw_aubfile_create(); - iws->size = AUB_BUF_SIZE; - iws->pool = malloc(AUB_BUF_SIZE); - - /* HACK: static copy of this pointer: - */ - assert(global_winsys == NULL); - global_winsys = iws; - - return &iws->winsys; -} - - -static struct pipe_screen * -xlib_create_brw_screen( void ) -{ -#ifndef GALLIUM_CELL - struct pipe_winsys *winsys; - struct pipe_screen *screen; - - winsys = xlib_create_brw_winsys(); - if (winsys == NULL) - return NULL; - - screen = brw_create_screen(winsys, 0/* XXX pci_id */); - if (screen == NULL) - goto fail; - - return screen; - -fail: - if (winsys) - winsys->destroy( winsys ); - -#endif - return NULL; -} - - -/* These per-screen functions are acually made available to the driver - * through the brw_winsys (per-context) entity. - */ -unsigned xlib_brw_get_buffer_offset( struct pipe_winsys *pws, - struct pipe_buffer *buf, - unsigned access_flags ) -{ - return aub_bo(buf)->offset; -} - -void xlib_brw_buffer_subdata_typed( struct pipe_winsys *pws, - struct pipe_buffer *buf, - unsigned long offset, - unsigned long size, - const void *data, - unsigned data_type ) -{ - unsigned aub_type = DW_GENERAL_STATE; - unsigned aub_sub_type = 0; - - switch (data_type) { - case BRW_CC_VP: - aub_sub_type = DWGS_COLOR_CALC_VIEWPORT_STATE; - break; - case BRW_CC_UNIT: - aub_sub_type = DWGS_COLOR_CALC_STATE; - break; - case BRW_WM_PROG: - aub_sub_type = DWGS_KERNEL_INSTRUCTIONS; - break; - case BRW_SAMPLER_DEFAULT_COLOR: - aub_sub_type = DWGS_SAMPLER_DEFAULT_COLOR; - break; - case BRW_SAMPLER: - aub_sub_type = DWGS_SAMPLER_STATE; - break; - case BRW_WM_UNIT: - aub_sub_type = DWGS_WINDOWER_IZ_STATE; - break; - case BRW_SF_PROG: - aub_sub_type = DWGS_KERNEL_INSTRUCTIONS; - break; - case BRW_SF_VP: - aub_sub_type = DWGS_STRIPS_FANS_VIEWPORT_STATE; - break; - case BRW_SF_UNIT: - aub_sub_type = DWGS_STRIPS_FANS_STATE; - break; - case BRW_VS_UNIT: - aub_sub_type = DWGS_VERTEX_SHADER_STATE; - break; - case BRW_VS_PROG: - aub_sub_type = DWGS_KERNEL_INSTRUCTIONS; - break; - case BRW_GS_UNIT: - aub_sub_type = DWGS_GEOMETRY_SHADER_STATE; - break; - case BRW_GS_PROG: - aub_sub_type = DWGS_KERNEL_INSTRUCTIONS; - break; - case BRW_CLIP_VP: - aub_sub_type = DWGS_CLIPPER_VIEWPORT_STATE; - break; - case BRW_CLIP_UNIT: - aub_sub_type = DWGS_CLIPPER_STATE; - break; - case BRW_CLIP_PROG: - aub_sub_type = DWGS_KERNEL_INSTRUCTIONS; - break; - case BRW_SS_SURFACE: - aub_type = DW_SURFACE_STATE; - aub_sub_type = DWSS_SURFACE_STATE; - break; - case BRW_SS_SURF_BIND: - aub_type = DW_SURFACE_STATE; - aub_sub_type = DWSS_BINDING_TABLE_STATE; - break; - case BRW_CONSTANT_BUFFER: - aub_type = DW_CONSTANT_URB_ENTRY; - aub_sub_type = 0; - break; - - default: - assert(0); - break; - } - - { - struct aub_pipe_winsys *iws = aub_pipe_winsys(pws); - struct aub_buffer *sbo = aub_bo(buf); - - assert(sbo->size > offset + size); - memcpy(sbo->data + offset, data, size); - - brw_aub_gtt_data( iws->aubfile, - sbo->offset + offset, - sbo->data + offset, - size, - aub_type, - aub_sub_type ); - } -} - - -static void -xlib_brw_display_surface(struct xmesa_buffer *b, - struct pipe_surface *surf) -{ - brw_aub_dump_bmp( global_winsys->aubfile, - surf, - aub_bo(buffer_from_surface(surf))->offset ); -} - - -struct xm_driver xlib_brw_driver = -{ - .create_pipe_screen = xlib_create_brw_screen, - .create_pipe_context = xlib_create_brw_context, - .display_surface = xlib_brw_display_surface, -}; -- cgit v1.2.3 From f00da2a3ff59c1a7104ac25a1c6eba5a6050ad68 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 29 Sep 2009 16:07:11 -0700 Subject: i915g: Drop the simple sufix None of the other driver have a silly sufix, so just drop it. Nothing new added in this commit or any other commit but this is better marketing. --- src/gallium/drivers/i915/Makefile | 28 + src/gallium/drivers/i915/SConscript | 30 + src/gallium/drivers/i915/i915_batch.h | 47 + src/gallium/drivers/i915/i915_blit.c | 151 +++ src/gallium/drivers/i915/i915_blit.h | 55 + src/gallium/drivers/i915/i915_buffer.c | 136 +++ src/gallium/drivers/i915/i915_buffer.h | 31 + src/gallium/drivers/i915/i915_clear.c | 48 + src/gallium/drivers/i915/i915_context.c | 244 ++++ src/gallium/drivers/i915/i915_context.h | 350 ++++++ src/gallium/drivers/i915/i915_debug.c | 898 +++++++++++++++ src/gallium/drivers/i915/i915_debug.h | 114 ++ src/gallium/drivers/i915/i915_debug_fp.c | 363 ++++++ src/gallium/drivers/i915/i915_flush.c | 86 ++ src/gallium/drivers/i915/i915_fpc.h | 207 ++++ src/gallium/drivers/i915/i915_fpc_emit.c | 375 ++++++ src/gallium/drivers/i915/i915_fpc_translate.c | 1202 ++++++++++++++++++++ src/gallium/drivers/i915/i915_prim_emit.c | 219 ++++ src/gallium/drivers/i915/i915_prim_vbuf.c | 645 +++++++++++ src/gallium/drivers/i915/i915_reg.h | 978 ++++++++++++++++ src/gallium/drivers/i915/i915_screen.c | 298 +++++ src/gallium/drivers/i915/i915_screen.h | 80 ++ src/gallium/drivers/i915/i915_state.c | 796 +++++++++++++ src/gallium/drivers/i915/i915_state.h | 50 + src/gallium/drivers/i915/i915_state_derived.c | 183 +++ src/gallium/drivers/i915/i915_state_dynamic.c | 310 +++++ src/gallium/drivers/i915/i915_state_emit.c | 402 +++++++ src/gallium/drivers/i915/i915_state_immediate.c | 225 ++++ src/gallium/drivers/i915/i915_state_inlines.h | 230 ++++ src/gallium/drivers/i915/i915_state_sampler.c | 299 +++++ src/gallium/drivers/i915/i915_surface.c | 94 ++ src/gallium/drivers/i915/i915_texture.c | 958 ++++++++++++++++ src/gallium/drivers/i915/i915_texture.h | 36 + src/gallium/drivers/i915/intel_batchbuffer.h | 87 ++ src/gallium/drivers/i915/intel_winsys.h | 230 ++++ src/gallium/drivers/i915simple/Makefile | 28 - src/gallium/drivers/i915simple/SConscript | 30 - src/gallium/drivers/i915simple/i915_batch.h | 47 - src/gallium/drivers/i915simple/i915_blit.c | 151 --- src/gallium/drivers/i915simple/i915_blit.h | 55 - src/gallium/drivers/i915simple/i915_buffer.c | 136 --- src/gallium/drivers/i915simple/i915_buffer.h | 31 - src/gallium/drivers/i915simple/i915_clear.c | 48 - src/gallium/drivers/i915simple/i915_context.c | 244 ---- src/gallium/drivers/i915simple/i915_context.h | 350 ------ src/gallium/drivers/i915simple/i915_debug.c | 898 --------------- src/gallium/drivers/i915simple/i915_debug.h | 114 -- src/gallium/drivers/i915simple/i915_debug_fp.c | 363 ------ src/gallium/drivers/i915simple/i915_flush.c | 86 -- src/gallium/drivers/i915simple/i915_fpc.h | 207 ---- src/gallium/drivers/i915simple/i915_fpc_emit.c | 375 ------ .../drivers/i915simple/i915_fpc_translate.c | 1202 -------------------- src/gallium/drivers/i915simple/i915_prim_emit.c | 219 ---- src/gallium/drivers/i915simple/i915_prim_vbuf.c | 645 ----------- src/gallium/drivers/i915simple/i915_reg.h | 978 ---------------- src/gallium/drivers/i915simple/i915_screen.c | 298 ----- src/gallium/drivers/i915simple/i915_screen.h | 80 -- src/gallium/drivers/i915simple/i915_state.c | 796 ------------- src/gallium/drivers/i915simple/i915_state.h | 50 - .../drivers/i915simple/i915_state_derived.c | 183 --- .../drivers/i915simple/i915_state_dynamic.c | 310 ----- src/gallium/drivers/i915simple/i915_state_emit.c | 402 ------- .../drivers/i915simple/i915_state_immediate.c | 225 ---- .../drivers/i915simple/i915_state_inlines.h | 230 ---- .../drivers/i915simple/i915_state_sampler.c | 299 ----- src/gallium/drivers/i915simple/i915_surface.c | 94 -- src/gallium/drivers/i915simple/i915_texture.c | 958 ---------------- src/gallium/drivers/i915simple/i915_texture.h | 36 - src/gallium/drivers/i915simple/intel_batchbuffer.h | 87 -- src/gallium/drivers/i915simple/intel_winsys.h | 230 ---- src/gallium/winsys/drm/intel/dri/Makefile | 2 +- src/gallium/winsys/drm/intel/dri/SConscript | 2 +- src/gallium/winsys/drm/intel/egl/Makefile | 2 +- src/gallium/winsys/drm/intel/gem/intel_drm_api.c | 4 +- .../winsys/drm/intel/gem/intel_drm_winsys.h | 2 +- src/gallium/winsys/drm/intel/xorg/Makefile | 2 +- 76 files changed, 10492 insertions(+), 10492 deletions(-) create mode 100644 src/gallium/drivers/i915/Makefile create mode 100644 src/gallium/drivers/i915/SConscript create mode 100644 src/gallium/drivers/i915/i915_batch.h create mode 100644 src/gallium/drivers/i915/i915_blit.c create mode 100644 src/gallium/drivers/i915/i915_blit.h create mode 100644 src/gallium/drivers/i915/i915_buffer.c create mode 100644 src/gallium/drivers/i915/i915_buffer.h create mode 100644 src/gallium/drivers/i915/i915_clear.c create mode 100644 src/gallium/drivers/i915/i915_context.c create mode 100644 src/gallium/drivers/i915/i915_context.h create mode 100644 src/gallium/drivers/i915/i915_debug.c create mode 100644 src/gallium/drivers/i915/i915_debug.h create mode 100644 src/gallium/drivers/i915/i915_debug_fp.c create mode 100644 src/gallium/drivers/i915/i915_flush.c create mode 100644 src/gallium/drivers/i915/i915_fpc.h create mode 100644 src/gallium/drivers/i915/i915_fpc_emit.c create mode 100644 src/gallium/drivers/i915/i915_fpc_translate.c create mode 100644 src/gallium/drivers/i915/i915_prim_emit.c create mode 100644 src/gallium/drivers/i915/i915_prim_vbuf.c create mode 100644 src/gallium/drivers/i915/i915_reg.h create mode 100644 src/gallium/drivers/i915/i915_screen.c create mode 100644 src/gallium/drivers/i915/i915_screen.h create mode 100644 src/gallium/drivers/i915/i915_state.c create mode 100644 src/gallium/drivers/i915/i915_state.h create mode 100644 src/gallium/drivers/i915/i915_state_derived.c create mode 100644 src/gallium/drivers/i915/i915_state_dynamic.c create mode 100644 src/gallium/drivers/i915/i915_state_emit.c create mode 100644 src/gallium/drivers/i915/i915_state_immediate.c create mode 100644 src/gallium/drivers/i915/i915_state_inlines.h create mode 100644 src/gallium/drivers/i915/i915_state_sampler.c create mode 100644 src/gallium/drivers/i915/i915_surface.c create mode 100644 src/gallium/drivers/i915/i915_texture.c create mode 100644 src/gallium/drivers/i915/i915_texture.h create mode 100644 src/gallium/drivers/i915/intel_batchbuffer.h create mode 100644 src/gallium/drivers/i915/intel_winsys.h delete mode 100644 src/gallium/drivers/i915simple/Makefile delete mode 100644 src/gallium/drivers/i915simple/SConscript delete mode 100644 src/gallium/drivers/i915simple/i915_batch.h delete mode 100644 src/gallium/drivers/i915simple/i915_blit.c delete mode 100644 src/gallium/drivers/i915simple/i915_blit.h delete mode 100644 src/gallium/drivers/i915simple/i915_buffer.c delete mode 100644 src/gallium/drivers/i915simple/i915_buffer.h delete mode 100644 src/gallium/drivers/i915simple/i915_clear.c delete mode 100644 src/gallium/drivers/i915simple/i915_context.c delete mode 100644 src/gallium/drivers/i915simple/i915_context.h delete mode 100644 src/gallium/drivers/i915simple/i915_debug.c delete mode 100644 src/gallium/drivers/i915simple/i915_debug.h delete mode 100644 src/gallium/drivers/i915simple/i915_debug_fp.c delete mode 100644 src/gallium/drivers/i915simple/i915_flush.c delete mode 100644 src/gallium/drivers/i915simple/i915_fpc.h delete mode 100644 src/gallium/drivers/i915simple/i915_fpc_emit.c delete mode 100644 src/gallium/drivers/i915simple/i915_fpc_translate.c delete mode 100644 src/gallium/drivers/i915simple/i915_prim_emit.c delete mode 100644 src/gallium/drivers/i915simple/i915_prim_vbuf.c delete mode 100644 src/gallium/drivers/i915simple/i915_reg.h delete mode 100644 src/gallium/drivers/i915simple/i915_screen.c delete mode 100644 src/gallium/drivers/i915simple/i915_screen.h delete mode 100644 src/gallium/drivers/i915simple/i915_state.c delete mode 100644 src/gallium/drivers/i915simple/i915_state.h delete mode 100644 src/gallium/drivers/i915simple/i915_state_derived.c delete mode 100644 src/gallium/drivers/i915simple/i915_state_dynamic.c delete mode 100644 src/gallium/drivers/i915simple/i915_state_emit.c delete mode 100644 src/gallium/drivers/i915simple/i915_state_immediate.c delete mode 100644 src/gallium/drivers/i915simple/i915_state_inlines.h delete mode 100644 src/gallium/drivers/i915simple/i915_state_sampler.c delete mode 100644 src/gallium/drivers/i915simple/i915_surface.c delete mode 100644 src/gallium/drivers/i915simple/i915_texture.c delete mode 100644 src/gallium/drivers/i915simple/i915_texture.h delete mode 100644 src/gallium/drivers/i915simple/intel_batchbuffer.h delete mode 100644 src/gallium/drivers/i915simple/intel_winsys.h (limited to 'src') diff --git a/src/gallium/drivers/i915/Makefile b/src/gallium/drivers/i915/Makefile new file mode 100644 index 0000000000..e33c74d02f --- /dev/null +++ b/src/gallium/drivers/i915/Makefile @@ -0,0 +1,28 @@ +TOP = ../../../.. +include $(TOP)/configs/current + +LIBNAME = i915 + +C_SOURCES = \ + i915_blit.c \ + i915_buffer.c \ + i915_clear.c \ + i915_flush.c \ + i915_context.c \ + i915_debug.c \ + i915_debug_fp.c \ + i915_state.c \ + i915_state_immediate.c \ + i915_state_dynamic.c \ + i915_state_derived.c \ + i915_state_emit.c \ + i915_state_sampler.c \ + i915_screen.c \ + i915_prim_emit.c \ + i915_prim_vbuf.c \ + i915_texture.c \ + i915_fpc_emit.c \ + i915_fpc_translate.c \ + i915_surface.c + +include ../../Makefile.template diff --git a/src/gallium/drivers/i915/SConscript b/src/gallium/drivers/i915/SConscript new file mode 100644 index 0000000000..5a1c47c88d --- /dev/null +++ b/src/gallium/drivers/i915/SConscript @@ -0,0 +1,30 @@ +Import('*') + +env = env.Clone() + +i915 = env.ConvenienceLibrary( + target = 'i915', + source = [ + 'i915_blit.c', + 'i915_buffer.c', + 'i915_clear.c', + 'i915_context.c', + 'i915_debug.c', + 'i915_debug_fp.c', + 'i915_flush.c', + 'i915_fpc_emit.c', + 'i915_fpc_translate.c', + 'i915_prim_emit.c', + 'i915_prim_vbuf.c', + 'i915_screen.c', + 'i915_state.c', + 'i915_state_derived.c', + 'i915_state_dynamic.c', + 'i915_state_emit.c', + 'i915_state_immediate.c', + 'i915_state_sampler.c', + 'i915_surface.c', + 'i915_texture.c', + ]) + +Export('i915') diff --git a/src/gallium/drivers/i915/i915_batch.h b/src/gallium/drivers/i915/i915_batch.h new file mode 100644 index 0000000000..b813784723 --- /dev/null +++ b/src/gallium/drivers/i915/i915_batch.h @@ -0,0 +1,47 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef I915_BATCH_H +#define I915_BATCH_H + +#include "intel_batchbuffer.h" + +#define BEGIN_BATCH(dwords, relocs) \ + (intel_batchbuffer_check(i915->batch, dwords, relocs)) + +#define OUT_BATCH(dword) \ + intel_batchbuffer_dword(i915->batch, dword) + +#define OUT_RELOC(buf, usage, offset) \ + intel_batchbuffer_reloc(i915->batch, buf, usage, offset) + +#define FLUSH_BATCH(fence) do { \ + intel_batchbuffer_flush(i915->batch, fence); \ + i915->hardware_dirty = ~0; \ +} while (0) + +#endif diff --git a/src/gallium/drivers/i915/i915_blit.c b/src/gallium/drivers/i915/i915_blit.c new file mode 100644 index 0000000000..83dfc33528 --- /dev/null +++ b/src/gallium/drivers/i915/i915_blit.c @@ -0,0 +1,151 @@ +/************************************************************************** + * + * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#include "i915_blit.h" +#include "i915_reg.h" +#include "i915_batch.h" +#include "i915_debug.h" + +#define FILE_DEBUG_FLAG DEBUG_BLIT + +void +i915_fill_blit(struct i915_context *i915, + unsigned cpp, + unsigned short dst_pitch, + struct intel_buffer *dst_buffer, + unsigned dst_offset, + short x, short y, + short w, short h, + unsigned color) +{ + unsigned BR13, CMD; + + + I915_DBG(i915, + "%s dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n", + __FUNCTION__, + dst_buffer, dst_pitch, dst_offset, x, y, w, h); + + switch (cpp) { + case 1: + case 2: + case 3: + BR13 = (((int) dst_pitch) & 0xffff) | + (0xF0 << 16) | (1 << 24); + CMD = XY_COLOR_BLT_CMD; + break; + case 4: + BR13 = (((int) dst_pitch) & 0xffff) | + (0xF0 << 16) | (1 << 24) | (1 << 25); + CMD = (XY_COLOR_BLT_CMD | XY_COLOR_BLT_WRITE_ALPHA | + XY_COLOR_BLT_WRITE_RGB); + break; + default: + return; + } + + if (!BEGIN_BATCH(6, 1)) { + FLUSH_BATCH(NULL); + assert(BEGIN_BATCH(6, 1)); + } + OUT_BATCH(CMD); + OUT_BATCH(BR13); + OUT_BATCH((y << 16) | x); + OUT_BATCH(((y + h) << 16) | (x + w)); + OUT_RELOC(dst_buffer, INTEL_USAGE_2D_TARGET, dst_offset); + OUT_BATCH(color); + FLUSH_BATCH(NULL); +} + +void +i915_copy_blit(struct i915_context *i915, + unsigned do_flip, + unsigned cpp, + unsigned short src_pitch, + struct intel_buffer *src_buffer, + unsigned src_offset, + unsigned short dst_pitch, + struct intel_buffer *dst_buffer, + unsigned dst_offset, + short src_x, short src_y, + short dst_x, short dst_y, + short w, short h) +{ + unsigned CMD, BR13; + int dst_y2 = dst_y + h; + int dst_x2 = dst_x + w; + + + I915_DBG(i915, + "%s src:buf(%p)/%d+%d %d,%d dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n", + __FUNCTION__, + src_buffer, src_pitch, src_offset, src_x, src_y, + dst_buffer, dst_pitch, dst_offset, dst_x, dst_y, w, h); + + switch (cpp) { + case 1: + case 2: + case 3: + BR13 = (((int) dst_pitch) & 0xffff) | + (0xCC << 16) | (1 << 24); + CMD = XY_SRC_COPY_BLT_CMD; + break; + case 4: + BR13 = (((int) dst_pitch) & 0xffff) | + (0xCC << 16) | (1 << 24) | (1 << 25); + CMD = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | + XY_SRC_COPY_BLT_WRITE_RGB); + break; + default: + return; + } + + if (dst_y2 < dst_y || dst_x2 < dst_x) { + return; + } + + /* Hardware can handle negative pitches but loses the ability to do + * proper overlapping blits in that case. We don't really have a + * need for either at this stage. + */ + assert (dst_pitch > 0 && src_pitch > 0); + + if (!BEGIN_BATCH(8, 2)) { + FLUSH_BATCH(NULL); + assert(BEGIN_BATCH(8, 2)); + } + OUT_BATCH(CMD); + OUT_BATCH(BR13); + OUT_BATCH((dst_y << 16) | dst_x); + OUT_BATCH((dst_y2 << 16) | dst_x2); + OUT_RELOC(dst_buffer, INTEL_USAGE_2D_TARGET, dst_offset); + OUT_BATCH((src_y << 16) | src_x); + OUT_BATCH(((int) src_pitch & 0xffff)); + OUT_RELOC(src_buffer, INTEL_USAGE_2D_SOURCE, src_offset); + FLUSH_BATCH(NULL); +} diff --git a/src/gallium/drivers/i915/i915_blit.h b/src/gallium/drivers/i915/i915_blit.h new file mode 100644 index 0000000000..8ce3220cfd --- /dev/null +++ b/src/gallium/drivers/i915/i915_blit.h @@ -0,0 +1,55 @@ +/************************************************************************** + * + * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef I915_BLIT_H +#define I915_BLIT_H + +#include "i915_context.h" + +extern void i915_copy_blit(struct i915_context *i915, + unsigned do_flip, + unsigned cpp, + unsigned short src_pitch, + struct intel_buffer *src_buffer, + unsigned src_offset, + unsigned short dst_pitch, + struct intel_buffer *dst_buffer, + unsigned dst_offset, + short srcx, short srcy, + short dstx, short dsty, + short w, short h); + +extern void i915_fill_blit(struct i915_context *i915, + unsigned cpp, + unsigned short dst_pitch, + struct intel_buffer *dst_buffer, + unsigned dst_offset, + short x, short y, + short w, short h, unsigned color); + + +#endif diff --git a/src/gallium/drivers/i915/i915_buffer.c b/src/gallium/drivers/i915/i915_buffer.c new file mode 100644 index 0000000000..effeba1297 --- /dev/null +++ b/src/gallium/drivers/i915/i915_buffer.c @@ -0,0 +1,136 @@ +/************************************************************************** + * + * Copyright © 2009 Jakob Bornecrantz + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include "util/u_memory.h" +#include "i915_screen.h" +#include "i915_buffer.h" + +struct intel_buffer; + +struct i915_buffer +{ + struct pipe_buffer base; + + struct intel_buffer *ibuf; /** hw buffer */ + + void *data; /**< user and malloc data */ + boolean own; /**< we own the data incase of malloc */ +}; + +static INLINE struct i915_buffer * +i915_buffer(struct pipe_buffer *buffer) +{ + return (struct i915_buffer *)buffer; +} + +static struct pipe_buffer * +i915_buffer_create(struct pipe_screen *screen, + unsigned alignment, + unsigned usage, + unsigned size) +{ + struct i915_buffer *buf = CALLOC_STRUCT(i915_buffer); + + if (!buf) + return NULL; + + pipe_reference_init(&buf->base.reference, 1); + buf->base.alignment = alignment; + buf->base.screen = screen; + buf->base.usage = usage; + buf->base.size = size; + buf->data = MALLOC(size); + buf->own = TRUE; + + if (!buf->data) + goto err; + + return &buf->base; + +err: + FREE(buf); + return NULL; +} + +static struct pipe_buffer * +i915_user_buffer_create(struct pipe_screen *screen, + void *ptr, + unsigned bytes) +{ + struct i915_buffer *buf = CALLOC_STRUCT(i915_buffer); + + if (!buf) + return NULL; + + pipe_reference_init(&buf->base.reference, 1); + buf->base.alignment = 0; + buf->base.screen = screen; + buf->base.usage = 0; + buf->base.size = bytes; + buf->data = ptr; + buf->own = FALSE; + + return &buf->base; +} + +static void * +i915_buffer_map(struct pipe_screen *screen, + struct pipe_buffer *buffer, + unsigned usage) +{ + struct i915_buffer *buf = i915_buffer(buffer); + assert(!buf->ibuf); + return buf->data; +} + +static void +i915_buffer_unmap(struct pipe_screen *screen, + struct pipe_buffer *buffer) +{ + struct i915_buffer *buf = i915_buffer(buffer); + assert(!buf->ibuf); +} + +static void +i915_buffer_destroy(struct pipe_buffer *buffer) +{ + struct i915_buffer *buf = i915_buffer(buffer); + assert(!buf->ibuf); + + if (buf->own) + FREE(buf->data); + FREE(buf); +} + +void i915_init_screen_buffer_functions(struct i915_screen *screen) +{ + screen->base.buffer_create = i915_buffer_create; + screen->base.user_buffer_create = i915_user_buffer_create; + screen->base.buffer_map = i915_buffer_map; + screen->base.buffer_map_range = NULL; + screen->base.buffer_flush_mapped_range = NULL; + screen->base.buffer_unmap = i915_buffer_unmap; + screen->base.buffer_destroy = i915_buffer_destroy; +} diff --git a/src/gallium/drivers/i915/i915_buffer.h b/src/gallium/drivers/i915/i915_buffer.h new file mode 100644 index 0000000000..80fda7c62f --- /dev/null +++ b/src/gallium/drivers/i915/i915_buffer.h @@ -0,0 +1,31 @@ +/************************************************************************** + * + * Copyright © 2009 Jakob Bornecrantz + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef I915_BUFFER_H +#define I915_BUFFER_H + +void i915_init_screen_buffer_functions(struct i915_screen *screen); + +#endif diff --git a/src/gallium/drivers/i915/i915_clear.c b/src/gallium/drivers/i915/i915_clear.c new file mode 100644 index 0000000000..90530f2826 --- /dev/null +++ b/src/gallium/drivers/i915/i915_clear.c @@ -0,0 +1,48 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * 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: + * Brian Paul + */ + + +#include "util/u_clear.h" +#include "i915_context.h" +#include "i915_state.h" + + +/** + * Clear the given buffers to the specified values. + * No masking, no scissor (clear entire buffer). + */ +void +i915_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, + double depth, unsigned stencil) +{ + util_clear(pipe, &i915_context(pipe)->framebuffer, buffers, rgba, depth, + stencil); +} diff --git a/src/gallium/drivers/i915/i915_context.c b/src/gallium/drivers/i915/i915_context.c new file mode 100644 index 0000000000..e745f3342d --- /dev/null +++ b/src/gallium/drivers/i915/i915_context.c @@ -0,0 +1,244 @@ +/************************************************************************** + * + * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include "i915_context.h" +#include "i915_state.h" +#include "i915_screen.h" +#include "i915_batch.h" +#include "i915_texture.h" +#include "i915_reg.h" + +#include "draw/draw_context.h" +#include "pipe/p_defines.h" +#include "pipe/internal/p_winsys_screen.h" +#include "pipe/p_inlines.h" +#include "util/u_memory.h" +#include "pipe/p_screen.h" + + +/* + * Draw functions + */ + + +static boolean +i915_draw_range_elements(struct pipe_context *pipe, + struct pipe_buffer *indexBuffer, + unsigned indexSize, + unsigned min_index, + unsigned max_index, + unsigned prim, unsigned start, unsigned count) +{ + struct i915_context *i915 = i915_context(pipe); + struct draw_context *draw = i915->draw; + unsigned i; + + if (i915->dirty) + i915_update_derived(i915); + + /* + * Map vertex buffers + */ + for (i = 0; i < i915->num_vertex_buffers; i++) { + void *buf = pipe_buffer_map(pipe->screen, i915->vertex_buffer[i].buffer, + PIPE_BUFFER_USAGE_CPU_READ); + draw_set_mapped_vertex_buffer(draw, i, buf); + } + + /* + * Map index buffer, if present + */ + if (indexBuffer) { + void *mapped_indexes = pipe_buffer_map(pipe->screen, indexBuffer, + PIPE_BUFFER_USAGE_CPU_READ); + draw_set_mapped_element_buffer_range(draw, indexSize, + min_index, + max_index, + mapped_indexes); + } else { + draw_set_mapped_element_buffer(draw, 0, NULL); + } + + + draw_set_mapped_constant_buffer(draw, + i915->current.constants[PIPE_SHADER_VERTEX], + (i915->current.num_user_constants[PIPE_SHADER_VERTEX] * + 4 * sizeof(float))); + + /* + * Do the drawing + */ + draw_arrays(i915->draw, prim, start, count); + + /* + * unmap vertex/index buffers + */ + for (i = 0; i < i915->num_vertex_buffers; i++) { + pipe_buffer_unmap(pipe->screen, i915->vertex_buffer[i].buffer); + draw_set_mapped_vertex_buffer(draw, i, NULL); + } + + if (indexBuffer) { + pipe_buffer_unmap(pipe->screen, indexBuffer); + draw_set_mapped_element_buffer_range(draw, 0, start, start + count - 1, NULL); + } + + return TRUE; +} + +static boolean +i915_draw_elements(struct pipe_context *pipe, + struct pipe_buffer *indexBuffer, + unsigned indexSize, + unsigned prim, unsigned start, unsigned count) +{ + return i915_draw_range_elements(pipe, indexBuffer, + indexSize, + 0, 0xffffffff, + prim, start, count); +} + +static boolean +i915_draw_arrays(struct pipe_context *pipe, + unsigned prim, unsigned start, unsigned count) +{ + return i915_draw_elements(pipe, NULL, 0, prim, start, count); +} + + +/* + * Is referenced functions + */ + + +static unsigned int +i915_is_texture_referenced(struct pipe_context *pipe, + struct pipe_texture *texture, + unsigned face, unsigned level) +{ + /** + * FIXME: Return the corrent result. We can't alays return referenced + * since it causes a double flush within the vbo module. + */ +#if 0 + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +#else + return 0; +#endif +} + +static unsigned int +i915_is_buffer_referenced(struct pipe_context *pipe, + struct pipe_buffer *buf) +{ + /** + * FIXME: Return the corrent result. We can't alays return referenced + * since it causes a double flush within the vbo module. + */ +#if 0 + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +#else + return 0; +#endif +} + + +/* + * Generic context functions + */ + + +static void i915_destroy(struct pipe_context *pipe) +{ + struct i915_context *i915 = i915_context(pipe); + int i; + + draw_destroy(i915->draw); + + if(i915->batch) + i915->iws->batchbuffer_destroy(i915->batch); + + /* unbind framebuffer */ + for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { + pipe_surface_reference(&i915->framebuffer.cbufs[i], NULL); + } + pipe_surface_reference(&i915->framebuffer.zsbuf, NULL); + + FREE(i915); +} + +struct pipe_context * +i915_create_context(struct pipe_screen *screen) +{ + struct i915_context *i915; + + i915 = CALLOC_STRUCT(i915_context); + if (i915 == NULL) + return NULL; + + i915->iws = i915_screen(screen)->iws; + i915->base.winsys = NULL; + i915->base.screen = screen; + + i915->base.destroy = i915_destroy; + + i915->base.clear = i915_clear; + + i915->base.draw_arrays = i915_draw_arrays; + i915->base.draw_elements = i915_draw_elements; + i915->base.draw_range_elements = i915_draw_range_elements; + + i915->base.is_texture_referenced = i915_is_texture_referenced; + i915->base.is_buffer_referenced = i915_is_buffer_referenced; + + /* + * Create drawing context and plug our rendering stage into it. + */ + i915->draw = draw_create(); + assert(i915->draw); + if (!debug_get_bool_option("I915_NO_VBUF", FALSE)) { + draw_set_rasterize_stage(i915->draw, i915_draw_vbuf_stage(i915)); + } else { + draw_set_rasterize_stage(i915->draw, i915_draw_render_stage(i915)); + } + + i915_init_surface_functions(i915); + i915_init_state_functions(i915); + i915_init_flush_functions(i915); + + draw_install_aaline_stage(i915->draw, &i915->base); + draw_install_aapoint_stage(i915->draw, &i915->base); + + i915->dirty = ~0; + i915->hardware_dirty = ~0; + + /* Batch stream debugging is a bit hacked up at the moment: + */ + i915->batch = i915->iws->batchbuffer_create(i915->iws); + + return &i915->base; +} diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h new file mode 100644 index 0000000000..234b441ce6 --- /dev/null +++ b/src/gallium/drivers/i915/i915_context.h @@ -0,0 +1,350 @@ + /************************************************************************** + * + * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef I915_CONTEXT_H +#define I915_CONTEXT_H + + +#include "pipe/p_context.h" +#include "pipe/p_defines.h" +#include "pipe/p_state.h" + +#include "draw/draw_vertex.h" + +#include "tgsi/tgsi_scan.h" + + +struct intel_winsys; +struct intel_buffer; +struct intel_batchbuffer; + + +#define I915_TEX_UNITS 8 + +#define I915_DYNAMIC_MODES4 0 +#define I915_DYNAMIC_DEPTHSCALE_0 1 /* just the header */ +#define I915_DYNAMIC_DEPTHSCALE_1 2 +#define I915_DYNAMIC_IAB 3 +#define I915_DYNAMIC_BC_0 4 /* just the header */ +#define I915_DYNAMIC_BC_1 5 +#define I915_DYNAMIC_BFO_0 6 +#define I915_DYNAMIC_BFO_1 7 +#define I915_DYNAMIC_STP_0 8 +#define I915_DYNAMIC_STP_1 9 +#define I915_DYNAMIC_SC_ENA_0 10 +#define I915_DYNAMIC_SC_RECT_0 11 +#define I915_DYNAMIC_SC_RECT_1 12 +#define I915_DYNAMIC_SC_RECT_2 13 +#define I915_MAX_DYNAMIC 14 + + +#define I915_IMMEDIATE_S0 0 +#define I915_IMMEDIATE_S1 1 +#define I915_IMMEDIATE_S2 2 +#define I915_IMMEDIATE_S3 3 +#define I915_IMMEDIATE_S4 4 +#define I915_IMMEDIATE_S5 5 +#define I915_IMMEDIATE_S6 6 +#define I915_IMMEDIATE_S7 7 +#define I915_MAX_IMMEDIATE 8 + +/* These must mach the order of LI0_STATE_* bits, as they will be used + * to generate hardware packets: + */ +#define I915_CACHE_STATIC 0 +#define I915_CACHE_DYNAMIC 1 /* handled specially */ +#define I915_CACHE_SAMPLER 2 +#define I915_CACHE_MAP 3 +#define I915_CACHE_PROGRAM 4 +#define I915_CACHE_CONSTANTS 5 +#define I915_MAX_CACHE 6 + +#define I915_MAX_CONSTANT 32 + + +/** See constant_flags[] below */ +#define I915_CONSTFLAG_USER 0x1f + + +/** + * Subclass of pipe_shader_state + */ +struct i915_fragment_shader +{ + struct pipe_shader_state state; + + struct tgsi_shader_info info; + + uint *program; + uint program_len; + + /** + * constants introduced during translation. + * These are placed at the end of the constant buffer and grow toward + * the beginning (eg: slot 31, 30 29, ...) + * User-provided constants start at 0. + * This allows both types of constants to co-exist (until there's too many) + * and doesn't require regenerating/changing the fragment program to + * shuffle constants around. + */ + uint num_constants; + float constants[I915_MAX_CONSTANT][4]; + + /** + * Status of each constant + * if I915_CONSTFLAG_PARAM, the value must be taken from the corresponding + * slot of the user's constant buffer. (set by pipe->set_constant_buffer()) + * Else, the bitmask indicates which components are occupied by immediates. + */ + ubyte constant_flags[I915_MAX_CONSTANT]; +}; + + +struct i915_cache_context; + +/* Use to calculate differences between state emitted to hardware and + * current driver-calculated state. + */ +struct i915_state +{ + unsigned immediate[I915_MAX_IMMEDIATE]; + unsigned dynamic[I915_MAX_DYNAMIC]; + + float constants[PIPE_SHADER_TYPES][I915_MAX_CONSTANT][4]; + /** number of constants passed in through a constant buffer */ + uint num_user_constants[PIPE_SHADER_TYPES]; + + /* texture sampler state */ + unsigned sampler[I915_TEX_UNITS][3]; + unsigned sampler_enable_flags; + unsigned sampler_enable_nr; + + /* texture image buffers */ + unsigned texbuffer[I915_TEX_UNITS][2]; + + /** Describes the current hardware vertex layout */ + struct vertex_info vertex_info; + + unsigned id; /* track lost context events */ +}; + +struct i915_blend_state { + unsigned iab; + unsigned modes4; + unsigned LIS5; + unsigned LIS6; +}; + +struct i915_depth_stencil_state { + unsigned stencil_modes4; + unsigned bfo[2]; + unsigned stencil_LIS5; + unsigned depth_LIS6; +}; + +struct i915_rasterizer_state { + int light_twoside : 1; + unsigned st; + enum interp_mode color_interp; + + unsigned LIS4; + unsigned LIS7; + unsigned sc[1]; + + const struct pipe_rasterizer_state *templ; + + union { float f; unsigned u; } ds[2]; +}; + +struct i915_sampler_state { + unsigned state[3]; + const struct pipe_sampler_state *templ; + unsigned minlod; + unsigned maxlod; +}; + +struct i915_texture { + struct pipe_texture base; + + /* Derived from the above: + */ + unsigned stride; + unsigned depth_stride; /* per-image on i945? */ + unsigned total_nblocksy; + + unsigned sw_tiled; /**< tiled with software flags */ + unsigned hw_tiled; /**< tiled with hardware fences */ + + unsigned nr_images[PIPE_MAX_TEXTURE_LEVELS]; + + /* Explicitly store the offset of each image for each cube face or + * depth value. Pretty much have to accept that hardware formats + * are going to be so diverse that there is no unified way to + * compute the offsets of depth/cube images within a mipmap level, + * so have to store them as a lookup table: + */ + unsigned *image_offset[PIPE_MAX_TEXTURE_LEVELS]; /**< array [depth] of offsets */ + + /* The data is held here: + */ + struct intel_buffer *buffer; +}; + +struct i915_context +{ + struct pipe_context base; + + struct intel_winsys *iws; + + struct draw_context *draw; + + /* The most recent drawing state as set by the driver: + */ + const struct i915_blend_state *blend; + const struct i915_sampler_state *sampler[PIPE_MAX_SAMPLERS]; + const struct i915_depth_stencil_state *depth_stencil; + const struct i915_rasterizer_state *rasterizer; + + struct i915_fragment_shader *fs; + + struct pipe_blend_color blend_color; + struct pipe_clip_state clip; + struct pipe_constant_buffer constants[PIPE_SHADER_TYPES]; + struct pipe_framebuffer_state framebuffer; + struct pipe_poly_stipple poly_stipple; + struct pipe_scissor_state scissor; + struct i915_texture *texture[PIPE_MAX_SAMPLERS]; + struct pipe_viewport_state viewport; + struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; + + unsigned dirty; + + unsigned num_samplers; + unsigned num_textures; + unsigned num_vertex_elements; + unsigned num_vertex_buffers; + + struct intel_batchbuffer *batch; + + /** Vertex buffer */ + struct intel_buffer *vbo; + size_t vbo_offset; + unsigned vbo_flushed; + + struct i915_state current; + unsigned hardware_dirty; + + unsigned debug; +}; + +/* A flag for each state_tracker state object: + */ +#define I915_NEW_VIEWPORT 0x1 +#define I915_NEW_RASTERIZER 0x2 +#define I915_NEW_FS 0x4 +#define I915_NEW_BLEND 0x8 +#define I915_NEW_CLIP 0x10 +#define I915_NEW_SCISSOR 0x20 +#define I915_NEW_STIPPLE 0x40 +#define I915_NEW_FRAMEBUFFER 0x80 +#define I915_NEW_ALPHA_TEST 0x100 +#define I915_NEW_DEPTH_STENCIL 0x200 +#define I915_NEW_SAMPLER 0x400 +#define I915_NEW_TEXTURE 0x800 +#define I915_NEW_CONSTANTS 0x1000 +#define I915_NEW_VBO 0x2000 +#define I915_NEW_VS 0x4000 + + +/* Driver's internally generated state flags: + */ +#define I915_NEW_VERTEX_FORMAT 0x10000 + + +/* Dirty flags for hardware emit + */ +#define I915_HW_STATIC (1<ptr + stream->offset); + + if (len == 0) { + PRINTF(stream, "Error - zero length packet (0x%08x)\n", stream->ptr[0]); + assert(0); + return FALSE; + } + + if (stream->print_addresses) + PRINTF(stream, "%08x: ", stream->offset); + + + PRINTF(stream, "%s (%d dwords):\n", name, len); + for (i = 0; i < len; i++) + PRINTF(stream, "\t0x%08x\n", ptr[i]); + PRINTF(stream, "\n"); + + stream->offset += len * sizeof(unsigned); + + return TRUE; +} + + +static const char *get_prim_name( unsigned val ) +{ + switch (val & PRIM3D_MASK) { + case PRIM3D_TRILIST: return "TRILIST"; break; + case PRIM3D_TRISTRIP: return "TRISTRIP"; break; + case PRIM3D_TRISTRIP_RVRSE: return "TRISTRIP_RVRSE"; break; + case PRIM3D_TRIFAN: return "TRIFAN"; break; + case PRIM3D_POLY: return "POLY"; break; + case PRIM3D_LINELIST: return "LINELIST"; break; + case PRIM3D_LINESTRIP: return "LINESTRIP"; break; + case PRIM3D_RECTLIST: return "RECTLIST"; break; + case PRIM3D_POINTLIST: return "POINTLIST"; break; + case PRIM3D_DIB: return "DIB"; break; + case PRIM3D_CLEAR_RECT: return "CLEAR_RECT"; break; + case PRIM3D_ZONE_INIT: return "ZONE_INIT"; break; + default: return "????"; break; + } +} + +static boolean debug_prim( struct debug_stream *stream, const char *name, + boolean dump_floats, + unsigned len ) +{ + unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); + const char *prim = get_prim_name( ptr[0] ); + unsigned i; + + + + PRINTF(stream, "%s %s (%d dwords):\n", name, prim, len); + PRINTF(stream, "\t0x%08x\n", ptr[0]); + for (i = 1; i < len; i++) { + if (dump_floats) + PRINTF(stream, "\t0x%08x // %f\n", ptr[i], *(float *)&ptr[i]); + else + PRINTF(stream, "\t0x%08x\n", ptr[i]); + } + + + PRINTF(stream, "\n"); + + stream->offset += len * sizeof(unsigned); + + return TRUE; +} + + + + +static boolean debug_program( struct debug_stream *stream, const char *name, unsigned len ) +{ + unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); + + if (len == 0) { + PRINTF(stream, "Error - zero length packet (0x%08x)\n", stream->ptr[0]); + assert(0); + return FALSE; + } + + if (stream->print_addresses) + PRINTF(stream, "%08x: ", stream->offset); + + PRINTF(stream, "%s (%d dwords):\n", name, len); + i915_disassemble_program( stream, ptr, len ); + + stream->offset += len * sizeof(unsigned); + return TRUE; +} + + +static boolean debug_chain( struct debug_stream *stream, const char *name, unsigned len ) +{ + unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); + unsigned old_offset = stream->offset + len * sizeof(unsigned); + unsigned i; + + PRINTF(stream, "%s (%d dwords):\n", name, len); + for (i = 0; i < len; i++) + PRINTF(stream, "\t0x%08x\n", ptr[i]); + + stream->offset = ptr[1] & ~0x3; + + if (stream->offset < old_offset) + PRINTF(stream, "\n... skipping backwards from 0x%x --> 0x%x ...\n\n", + old_offset, stream->offset ); + else + PRINTF(stream, "\n... skipping from 0x%x --> 0x%x ...\n\n", + old_offset, stream->offset ); + + + return TRUE; +} + + +static boolean debug_variable_length_prim( struct debug_stream *stream ) +{ + unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); + const char *prim = get_prim_name( ptr[0] ); + unsigned i, len; + + ushort *idx = (ushort *)(ptr+1); + for (i = 0; idx[i] != 0xffff; i++) + ; + + len = 1+(i+2)/2; + + PRINTF(stream, "3DPRIM, %s variable length %d indicies (%d dwords):\n", prim, i, len); + for (i = 0; i < len; i++) + PRINTF(stream, "\t0x%08x\n", ptr[i]); + PRINTF(stream, "\n"); + + stream->offset += len * sizeof(unsigned); + return TRUE; +} + + +static void +BITS( + struct debug_stream *stream, + unsigned dw, + unsigned hi, + unsigned lo, + const char *fmt, + ... ) +{ + va_list args; + unsigned himask = ~0UL >> (31 - (hi)); + + PRINTF(stream, "\t\t "); + + va_start( args, fmt ); + debug_vprintf( fmt, args ); + va_end( args ); + + PRINTF(stream, ": 0x%x\n", ((dw) & himask) >> (lo)); +} + +#ifdef DEBUG +#define MBZ( dw, hi, lo) do { \ + unsigned x = (dw) >> (lo); \ + unsigned lomask = (1 << (lo)) - 1; \ + unsigned himask; \ + himask = (1UL << (hi)) - 1; \ + assert ((x & himask & ~lomask) == 0); \ +} while (0) +#else +#define MBZ( dw, hi, lo) do { \ +} while (0) +#endif + +static void +FLAG( + struct debug_stream *stream, + unsigned dw, + unsigned bit, + const char *fmt, + ... ) +{ + if (((dw) >> (bit)) & 1) { + va_list args; + + PRINTF(stream, "\t\t "); + + va_start( args, fmt ); + debug_vprintf( fmt, args ); + va_end( args ); + + PRINTF(stream, "\n"); + } +} + +static boolean debug_load_immediate( struct debug_stream *stream, + const char *name, + unsigned len ) +{ + unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); + unsigned bits = (ptr[0] >> 4) & 0xff; + unsigned j = 0; + + PRINTF(stream, "%s (%d dwords, flags: %x):\n", name, len, bits); + PRINTF(stream, "\t0x%08x\n", ptr[j++]); + + if (bits & (1<<0)) { + PRINTF(stream, "\t LIS0: 0x%08x\n", ptr[j]); + PRINTF(stream, "\t vb address: 0x%08x\n", (ptr[j] & ~0x3)); + BITS(stream, ptr[j], 0, 0, "vb invalidate disable"); + j++; + } + if (bits & (1<<1)) { + PRINTF(stream, "\t LIS1: 0x%08x\n", ptr[j]); + BITS(stream, ptr[j], 29, 24, "vb dword width"); + BITS(stream, ptr[j], 21, 16, "vb dword pitch"); + BITS(stream, ptr[j], 15, 0, "vb max index"); + j++; + } + if (bits & (1<<2)) { + int i; + PRINTF(stream, "\t LIS2: 0x%08x\n", ptr[j]); + for (i = 0; i < 8; i++) { + unsigned tc = (ptr[j] >> (i * 4)) & 0xf; + if (tc != 0xf) + BITS(stream, tc, 3, 0, "tex coord %d", i); + } + j++; + } + if (bits & (1<<3)) { + PRINTF(stream, "\t LIS3: 0x%08x\n", ptr[j]); + j++; + } + if (bits & (1<<4)) { + PRINTF(stream, "\t LIS4: 0x%08x\n", ptr[j]); + BITS(stream, ptr[j], 31, 23, "point width"); + BITS(stream, ptr[j], 22, 19, "line width"); + FLAG(stream, ptr[j], 18, "alpha flatshade"); + FLAG(stream, ptr[j], 17, "fog flatshade"); + FLAG(stream, ptr[j], 16, "spec flatshade"); + FLAG(stream, ptr[j], 15, "rgb flatshade"); + BITS(stream, ptr[j], 14, 13, "cull mode"); + FLAG(stream, ptr[j], 12, "vfmt: point width"); + FLAG(stream, ptr[j], 11, "vfmt: specular/fog"); + FLAG(stream, ptr[j], 10, "vfmt: rgba"); + FLAG(stream, ptr[j], 9, "vfmt: depth offset"); + BITS(stream, ptr[j], 8, 6, "vfmt: position (2==xyzw)"); + FLAG(stream, ptr[j], 5, "force dflt diffuse"); + FLAG(stream, ptr[j], 4, "force dflt specular"); + FLAG(stream, ptr[j], 3, "local depth offset enable"); + FLAG(stream, ptr[j], 2, "vfmt: fp32 fog coord"); + FLAG(stream, ptr[j], 1, "sprite point"); + FLAG(stream, ptr[j], 0, "antialiasing"); + j++; + } + if (bits & (1<<5)) { + PRINTF(stream, "\t LIS5: 0x%08x\n", ptr[j]); + BITS(stream, ptr[j], 31, 28, "rgba write disables"); + FLAG(stream, ptr[j], 27, "force dflt point width"); + FLAG(stream, ptr[j], 26, "last pixel enable"); + FLAG(stream, ptr[j], 25, "global z offset enable"); + FLAG(stream, ptr[j], 24, "fog enable"); + BITS(stream, ptr[j], 23, 16, "stencil ref"); + BITS(stream, ptr[j], 15, 13, "stencil test"); + BITS(stream, ptr[j], 12, 10, "stencil fail op"); + BITS(stream, ptr[j], 9, 7, "stencil pass z fail op"); + BITS(stream, ptr[j], 6, 4, "stencil pass z pass op"); + FLAG(stream, ptr[j], 3, "stencil write enable"); + FLAG(stream, ptr[j], 2, "stencil test enable"); + FLAG(stream, ptr[j], 1, "color dither enable"); + FLAG(stream, ptr[j], 0, "logiop enable"); + j++; + } + if (bits & (1<<6)) { + PRINTF(stream, "\t LIS6: 0x%08x\n", ptr[j]); + FLAG(stream, ptr[j], 31, "alpha test enable"); + BITS(stream, ptr[j], 30, 28, "alpha func"); + BITS(stream, ptr[j], 27, 20, "alpha ref"); + FLAG(stream, ptr[j], 19, "depth test enable"); + BITS(stream, ptr[j], 18, 16, "depth func"); + FLAG(stream, ptr[j], 15, "blend enable"); + BITS(stream, ptr[j], 14, 12, "blend func"); + BITS(stream, ptr[j], 11, 8, "blend src factor"); + BITS(stream, ptr[j], 7, 4, "blend dst factor"); + FLAG(stream, ptr[j], 3, "depth write enable"); + FLAG(stream, ptr[j], 2, "color write enable"); + BITS(stream, ptr[j], 1, 0, "provoking vertex"); + j++; + } + + + PRINTF(stream, "\n"); + + assert(j == len); + + stream->offset += len * sizeof(unsigned); + + return TRUE; +} + + + +static boolean debug_load_indirect( struct debug_stream *stream, + const char *name, + unsigned len ) +{ + unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); + unsigned bits = (ptr[0] >> 8) & 0x3f; + unsigned i, j = 0; + + PRINTF(stream, "%s (%d dwords):\n", name, len); + PRINTF(stream, "\t0x%08x\n", ptr[j++]); + + for (i = 0; i < 6; i++) { + if (bits & (1<offset += len * sizeof(unsigned); + + return TRUE; +} + +static void BR13( struct debug_stream *stream, + unsigned val ) +{ + PRINTF(stream, "\t0x%08x\n", val); + FLAG(stream, val, 30, "clipping enable"); + BITS(stream, val, 25, 24, "color depth (3==32bpp)"); + BITS(stream, val, 23, 16, "raster op"); + BITS(stream, val, 15, 0, "dest pitch"); +} + + +static void BR22( struct debug_stream *stream, + unsigned val ) +{ + PRINTF(stream, "\t0x%08x\n", val); + BITS(stream, val, 31, 16, "dest y1"); + BITS(stream, val, 15, 0, "dest x1"); +} + +static void BR23( struct debug_stream *stream, + unsigned val ) +{ + PRINTF(stream, "\t0x%08x\n", val); + BITS(stream, val, 31, 16, "dest y2"); + BITS(stream, val, 15, 0, "dest x2"); +} + +static void BR09( struct debug_stream *stream, + unsigned val ) +{ + PRINTF(stream, "\t0x%08x -- dest address\n", val); +} + +static void BR26( struct debug_stream *stream, + unsigned val ) +{ + PRINTF(stream, "\t0x%08x\n", val); + BITS(stream, val, 31, 16, "src y1"); + BITS(stream, val, 15, 0, "src x1"); +} + +static void BR11( struct debug_stream *stream, + unsigned val ) +{ + PRINTF(stream, "\t0x%08x\n", val); + BITS(stream, val, 15, 0, "src pitch"); +} + +static void BR12( struct debug_stream *stream, + unsigned val ) +{ + PRINTF(stream, "\t0x%08x -- src address\n", val); +} + +static void BR16( struct debug_stream *stream, + unsigned val ) +{ + PRINTF(stream, "\t0x%08x -- color\n", val); +} + +static boolean debug_copy_blit( struct debug_stream *stream, + const char *name, + unsigned len ) +{ + unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); + int j = 0; + + PRINTF(stream, "%s (%d dwords):\n", name, len); + PRINTF(stream, "\t0x%08x\n", ptr[j++]); + + BR13(stream, ptr[j++]); + BR22(stream, ptr[j++]); + BR23(stream, ptr[j++]); + BR09(stream, ptr[j++]); + BR26(stream, ptr[j++]); + BR11(stream, ptr[j++]); + BR12(stream, ptr[j++]); + + stream->offset += len * sizeof(unsigned); + assert(j == len); + return TRUE; +} + +static boolean debug_color_blit( struct debug_stream *stream, + const char *name, + unsigned len ) +{ + unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); + int j = 0; + + PRINTF(stream, "%s (%d dwords):\n", name, len); + PRINTF(stream, "\t0x%08x\n", ptr[j++]); + + BR13(stream, ptr[j++]); + BR22(stream, ptr[j++]); + BR23(stream, ptr[j++]); + BR09(stream, ptr[j++]); + BR16(stream, ptr[j++]); + + stream->offset += len * sizeof(unsigned); + assert(j == len); + return TRUE; +} + +static boolean debug_modes4( struct debug_stream *stream, + const char *name, + unsigned len ) +{ + unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); + int j = 0; + + PRINTF(stream, "%s (%d dwords):\n", name, len); + PRINTF(stream, "\t0x%08x\n", ptr[j]); + BITS(stream, ptr[j], 21, 18, "logicop func"); + FLAG(stream, ptr[j], 17, "stencil test mask modify-enable"); + FLAG(stream, ptr[j], 16, "stencil write mask modify-enable"); + BITS(stream, ptr[j], 15, 8, "stencil test mask"); + BITS(stream, ptr[j], 7, 0, "stencil write mask"); + j++; + + stream->offset += len * sizeof(unsigned); + assert(j == len); + return TRUE; +} + +static boolean debug_map_state( struct debug_stream *stream, + const char *name, + unsigned len ) +{ + unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); + unsigned j = 0; + + PRINTF(stream, "%s (%d dwords):\n", name, len); + PRINTF(stream, "\t0x%08x\n", ptr[j++]); + + { + PRINTF(stream, "\t0x%08x\n", ptr[j]); + BITS(stream, ptr[j], 15, 0, "map mask"); + j++; + } + + while (j < len) { + { + PRINTF(stream, "\t TMn.0: 0x%08x\n", ptr[j]); + PRINTF(stream, "\t map address: 0x%08x\n", (ptr[j] & ~0x3)); + FLAG(stream, ptr[j], 1, "vertical line stride"); + FLAG(stream, ptr[j], 0, "vertical line stride offset"); + j++; + } + + { + PRINTF(stream, "\t TMn.1: 0x%08x\n", ptr[j]); + BITS(stream, ptr[j], 31, 21, "height"); + BITS(stream, ptr[j], 20, 10, "width"); + BITS(stream, ptr[j], 9, 7, "surface format"); + BITS(stream, ptr[j], 6, 3, "texel format"); + FLAG(stream, ptr[j], 2, "use fence regs"); + FLAG(stream, ptr[j], 1, "tiled surface"); + FLAG(stream, ptr[j], 0, "tile walk ymajor"); + j++; + } + { + PRINTF(stream, "\t TMn.2: 0x%08x\n", ptr[j]); + BITS(stream, ptr[j], 31, 21, "dword pitch"); + BITS(stream, ptr[j], 20, 15, "cube face enables"); + BITS(stream, ptr[j], 14, 9, "max lod"); + FLAG(stream, ptr[j], 8, "mip layout right"); + BITS(stream, ptr[j], 7, 0, "depth"); + j++; + } + } + + stream->offset += len * sizeof(unsigned); + assert(j == len); + return TRUE; +} + +static boolean debug_sampler_state( struct debug_stream *stream, + const char *name, + unsigned len ) +{ + unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); + unsigned j = 0; + + PRINTF(stream, "%s (%d dwords):\n", name, len); + PRINTF(stream, "\t0x%08x\n", ptr[j++]); + + { + PRINTF(stream, "\t0x%08x\n", ptr[j]); + BITS(stream, ptr[j], 15, 0, "sampler mask"); + j++; + } + + while (j < len) { + { + PRINTF(stream, "\t TSn.0: 0x%08x\n", ptr[j]); + FLAG(stream, ptr[j], 31, "reverse gamma"); + FLAG(stream, ptr[j], 30, "planar to packed"); + FLAG(stream, ptr[j], 29, "yuv->rgb"); + BITS(stream, ptr[j], 28, 27, "chromakey index"); + BITS(stream, ptr[j], 26, 22, "base mip level"); + BITS(stream, ptr[j], 21, 20, "mip mode filter"); + BITS(stream, ptr[j], 19, 17, "mag mode filter"); + BITS(stream, ptr[j], 16, 14, "min mode filter"); + BITS(stream, ptr[j], 13, 5, "lod bias (s4.4)"); + FLAG(stream, ptr[j], 4, "shadow enable"); + FLAG(stream, ptr[j], 3, "max-aniso-4"); + BITS(stream, ptr[j], 2, 0, "shadow func"); + j++; + } + + { + PRINTF(stream, "\t TSn.1: 0x%08x\n", ptr[j]); + BITS(stream, ptr[j], 31, 24, "min lod"); + MBZ( ptr[j], 23, 18 ); + FLAG(stream, ptr[j], 17, "kill pixel enable"); + FLAG(stream, ptr[j], 16, "keyed tex filter mode"); + FLAG(stream, ptr[j], 15, "chromakey enable"); + BITS(stream, ptr[j], 14, 12, "tcx wrap mode"); + BITS(stream, ptr[j], 11, 9, "tcy wrap mode"); + BITS(stream, ptr[j], 8, 6, "tcz wrap mode"); + FLAG(stream, ptr[j], 5, "normalized coords"); + BITS(stream, ptr[j], 4, 1, "map (surface) index"); + FLAG(stream, ptr[j], 0, "EAST deinterlacer enable"); + j++; + } + { + PRINTF(stream, "\t TSn.2: 0x%08x (default color)\n", ptr[j]); + j++; + } + } + + stream->offset += len * sizeof(unsigned); + assert(j == len); + return TRUE; +} + +static boolean debug_dest_vars( struct debug_stream *stream, + const char *name, + unsigned len ) +{ + unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); + int j = 0; + + PRINTF(stream, "%s (%d dwords):\n", name, len); + PRINTF(stream, "\t0x%08x\n", ptr[j++]); + + { + PRINTF(stream, "\t0x%08x\n", ptr[j]); + FLAG(stream, ptr[j], 31, "early classic ztest"); + FLAG(stream, ptr[j], 30, "opengl tex default color"); + FLAG(stream, ptr[j], 29, "bypass iz"); + FLAG(stream, ptr[j], 28, "lod preclamp"); + BITS(stream, ptr[j], 27, 26, "dither pattern"); + FLAG(stream, ptr[j], 25, "linear gamma blend"); + FLAG(stream, ptr[j], 24, "debug dither"); + BITS(stream, ptr[j], 23, 20, "dstorg x"); + BITS(stream, ptr[j], 19, 16, "dstorg y"); + MBZ (ptr[j], 15, 15 ); + BITS(stream, ptr[j], 14, 12, "422 write select"); + BITS(stream, ptr[j], 11, 8, "cbuf format"); + BITS(stream, ptr[j], 3, 2, "zbuf format"); + FLAG(stream, ptr[j], 1, "vert line stride"); + FLAG(stream, ptr[j], 1, "vert line stride offset"); + j++; + } + + stream->offset += len * sizeof(unsigned); + assert(j == len); + return TRUE; +} + +static boolean debug_buf_info( struct debug_stream *stream, + const char *name, + unsigned len ) +{ + unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); + int j = 0; + + PRINTF(stream, "%s (%d dwords):\n", name, len); + PRINTF(stream, "\t0x%08x\n", ptr[j++]); + + { + PRINTF(stream, "\t0x%08x\n", ptr[j]); + BITS(stream, ptr[j], 28, 28, "aux buffer id"); + BITS(stream, ptr[j], 27, 24, "buffer id (7=depth, 3=back)"); + FLAG(stream, ptr[j], 23, "use fence regs"); + FLAG(stream, ptr[j], 22, "tiled surface"); + FLAG(stream, ptr[j], 21, "tile walk ymajor"); + MBZ (ptr[j], 20, 14); + BITS(stream, ptr[j], 13, 2, "dword pitch"); + MBZ (ptr[j], 2, 0); + j++; + } + + PRINTF(stream, "\t0x%08x -- buffer base address\n", ptr[j++]); + + stream->offset += len * sizeof(unsigned); + assert(j == len); + return TRUE; +} + +static boolean i915_debug_packet( struct debug_stream *stream ) +{ + unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); + unsigned cmd = *ptr; + + switch (((cmd >> 29) & 0x7)) { + case 0x0: + switch ((cmd >> 23) & 0x3f) { + case 0x0: + return debug(stream, "MI_NOOP", 1); + case 0x3: + return debug(stream, "MI_WAIT_FOR_EVENT", 1); + case 0x4: + return debug(stream, "MI_FLUSH", 1); + case 0xA: + debug(stream, "MI_BATCH_BUFFER_END", 1); + return FALSE; + case 0x22: + return debug(stream, "MI_LOAD_REGISTER_IMM", 3); + case 0x31: + return debug_chain(stream, "MI_BATCH_BUFFER_START", 2); + default: + (void)debug(stream, "UNKNOWN 0x0 case!", 1); + assert(0); + break; + } + break; + case 0x1: + (void) debug(stream, "UNKNOWN 0x1 case!", 1); + assert(0); + break; + case 0x2: + switch ((cmd >> 22) & 0xff) { + case 0x50: + return debug_color_blit(stream, "XY_COLOR_BLT", (cmd & 0xff) + 2); + case 0x53: + return debug_copy_blit(stream, "XY_SRC_COPY_BLT", (cmd & 0xff) + 2); + default: + return debug(stream, "blit command", (cmd & 0xff) + 2); + } + break; + case 0x3: + switch ((cmd >> 24) & 0x1f) { + case 0x6: + return debug(stream, "3DSTATE_ANTI_ALIASING", 1); + case 0x7: + return debug(stream, "3DSTATE_RASTERIZATION_RULES", 1); + case 0x8: + return debug(stream, "3DSTATE_BACKFACE_STENCIL_OPS", 2); + case 0x9: + return debug(stream, "3DSTATE_BACKFACE_STENCIL_MASKS", 1); + case 0xb: + return debug(stream, "3DSTATE_INDEPENDENT_ALPHA_BLEND", 1); + case 0xc: + return debug(stream, "3DSTATE_MODES5", 1); + case 0xd: + return debug_modes4(stream, "3DSTATE_MODES4", 1); + case 0x15: + return debug(stream, "3DSTATE_FOG_COLOR", 1); + case 0x16: + return debug(stream, "3DSTATE_COORD_SET_BINDINGS", 1); + case 0x1c: + /* 3DState16NP */ + switch((cmd >> 19) & 0x1f) { + case 0x10: + return debug(stream, "3DSTATE_SCISSOR_ENABLE", 1); + case 0x11: + return debug(stream, "3DSTATE_DEPTH_SUBRECTANGLE_DISABLE", 1); + default: + (void) debug(stream, "UNKNOWN 0x1c case!", 1); + assert(0); + break; + } + break; + case 0x1d: + /* 3DStateMW */ + switch ((cmd >> 16) & 0xff) { + case 0x0: + return debug_map_state(stream, "3DSTATE_MAP_STATE", (cmd & 0x1f) + 2); + case 0x1: + return debug_sampler_state(stream, "3DSTATE_SAMPLER_STATE", (cmd & 0x1f) + 2); + case 0x4: + return debug_load_immediate(stream, "3DSTATE_LOAD_STATE_IMMEDIATE", (cmd & 0xf) + 2); + case 0x5: + return debug_program(stream, "3DSTATE_PIXEL_SHADER_PROGRAM", (cmd & 0x1ff) + 2); + case 0x6: + return debug(stream, "3DSTATE_PIXEL_SHADER_CONSTANTS", (cmd & 0xff) + 2); + case 0x7: + return debug_load_indirect(stream, "3DSTATE_LOAD_INDIRECT", (cmd & 0xff) + 2); + case 0x80: + return debug(stream, "3DSTATE_DRAWING_RECTANGLE", (cmd & 0xffff) + 2); + case 0x81: + return debug(stream, "3DSTATE_SCISSOR_RECTANGLE", (cmd & 0xffff) + 2); + case 0x83: + return debug(stream, "3DSTATE_SPAN_STIPPLE", (cmd & 0xffff) + 2); + case 0x85: + return debug_dest_vars(stream, "3DSTATE_DEST_BUFFER_VARS", (cmd & 0xffff) + 2); + case 0x88: + return debug(stream, "3DSTATE_CONSTANT_BLEND_COLOR", (cmd & 0xffff) + 2); + case 0x89: + return debug(stream, "3DSTATE_FOG_MODE", (cmd & 0xffff) + 2); + case 0x8e: + return debug_buf_info(stream, "3DSTATE_BUFFER_INFO", (cmd & 0xffff) + 2); + case 0x97: + return debug(stream, "3DSTATE_DEPTH_OFFSET_SCALE", (cmd & 0xffff) + 2); + case 0x98: + return debug(stream, "3DSTATE_DEFAULT_Z", (cmd & 0xffff) + 2); + case 0x99: + return debug(stream, "3DSTATE_DEFAULT_DIFFUSE", (cmd & 0xffff) + 2); + case 0x9a: + return debug(stream, "3DSTATE_DEFAULT_SPECULAR", (cmd & 0xffff) + 2); + case 0x9c: + return debug(stream, "3DSTATE_CLEAR_PARAMETERS", (cmd & 0xffff) + 2); + default: + assert(0); + return 0; + } + break; + case 0x1e: + if (cmd & (1 << 23)) + return debug(stream, "???", (cmd & 0xffff) + 1); + else + return debug(stream, "", 1); + break; + case 0x1f: + if ((cmd & (1 << 23)) == 0) + return debug_prim(stream, "3DPRIM (inline)", 1, (cmd & 0x1ffff) + 2); + else if (cmd & (1 << 17)) + { + if ((cmd & 0xffff) == 0) + return debug_variable_length_prim(stream); + else + return debug_prim(stream, "3DPRIM (indexed)", 0, (((cmd & 0xffff) + 1) / 2) + 1); + } + else + return debug_prim(stream, "3DPRIM (indirect sequential)", 0, 2); + break; + default: + return debug(stream, "", 0); + } + default: + assert(0); + return 0; + } + + assert(0); + return 0; +} + + + +void +i915_dump_batchbuffer( struct intel_batchbuffer *batch ) +{ + struct debug_stream stream; + unsigned *start = (unsigned*)batch->map; + unsigned *end = (unsigned*)batch->ptr; + unsigned long bytes = (unsigned long) (end - start) * 4; + boolean done = FALSE; + + stream.offset = 0; + stream.ptr = (char *)start; + stream.print_addresses = 0; + + if (!start || !end) { + debug_printf( "\n\nBATCH: ???\n"); + return; + } + + debug_printf( "\n\nBATCH: (%d)\n", bytes / 4); + + while (!done && + stream.offset < bytes) + { + if (!i915_debug_packet( &stream )) + break; + + assert(stream.offset <= bytes && + stream.offset >= 0); + } + + debug_printf( "END-BATCH\n\n\n"); +} + + diff --git a/src/gallium/drivers/i915/i915_debug.h b/src/gallium/drivers/i915/i915_debug.h new file mode 100644 index 0000000000..dd9b86e17b --- /dev/null +++ b/src/gallium/drivers/i915/i915_debug.h @@ -0,0 +1,114 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * 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: Keith Whitwell + */ + +#ifndef I915_DEBUG_H +#define I915_DEBUG_H + +#include + +struct i915_context; + +struct debug_stream +{ + unsigned offset; /* current gtt offset */ + char *ptr; /* pointer to gtt offset zero */ + char *end; /* pointer to gtt offset zero */ + unsigned print_addresses; +}; + + +/* Internal functions + */ +void i915_disassemble_program(struct debug_stream *stream, + const unsigned *program, unsigned sz); + +void i915_print_ureg(const char *msg, unsigned ureg); + + +#define DEBUG_BATCH 0x1 +#define DEBUG_BLIT 0x2 +#define DEBUG_BUFFER 0x4 +#define DEBUG_CONSTANTS 0x8 +#define DEBUG_CONTEXT 0x10 +#define DEBUG_DRAW 0x20 +#define DEBUG_DYNAMIC 0x40 +#define DEBUG_FLUSH 0x80 +#define DEBUG_MAP 0x100 +#define DEBUG_PROGRAM 0x200 +#define DEBUG_REGIONS 0x400 +#define DEBUG_SAMPLER 0x800 +#define DEBUG_STATIC 0x1000 +#define DEBUG_SURFACE 0x2000 +#define DEBUG_WINSYS 0x4000 + +#include "pipe/p_compiler.h" + +#if defined(DEBUG) && defined(FILE_DEBUG_FLAG) + +#include "pipe/internal/p_winsys_screen.h" + +static INLINE void +I915_DBG( + struct i915_context *i915, + const char *fmt, + ... ) +{ + if ((i915)->debug & FILE_DEBUG_FLAG) { + va_list args; + + va_start( args, fmt ); + debug_vprintf( fmt, args ); + va_end( args ); + } +} + +#else + +static INLINE void +I915_DBG( + struct i915_context *i915, + const char *fmt, + ... ) +{ + (void) i915; + (void) fmt; +} + +#endif + + +struct intel_batchbuffer; + +void i915_dump_batchbuffer( struct intel_batchbuffer *i915 ); + +void i915_debug_init( struct i915_context *i915 ); + + +#endif diff --git a/src/gallium/drivers/i915/i915_debug_fp.c b/src/gallium/drivers/i915/i915_debug_fp.c new file mode 100644 index 0000000000..9c5b117b6d --- /dev/null +++ b/src/gallium/drivers/i915/i915_debug_fp.c @@ -0,0 +1,363 @@ +/************************************************************************** + * + * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#include "i915_reg.h" +#include "i915_debug.h" +#include "pipe/internal/p_winsys_screen.h" +#include "util/u_memory.h" + + +static void +PRINTF( + struct debug_stream *stream, + const char *fmt, + ... ) +{ + va_list args; + + va_start( args, fmt ); + debug_vprintf( fmt, args ); + va_end( args ); +} + + +static const char *opcodes[0x20] = { + "NOP", + "ADD", + "MOV", + "MUL", + "MAD", + "DP2ADD", + "DP3", + "DP4", + "FRC", + "RCP", + "RSQ", + "EXP", + "LOG", + "CMP", + "MIN", + "MAX", + "FLR", + "MOD", + "TRC", + "SGE", + "SLT", + "TEXLD", + "TEXLDP", + "TEXLDB", + "TEXKILL", + "DCL", + "0x1a", + "0x1b", + "0x1c", + "0x1d", + "0x1e", + "0x1f", +}; + + +static const int args[0x20] = { + 0, /* 0 nop */ + 2, /* 1 add */ + 1, /* 2 mov */ + 2, /* 3 m ul */ + 3, /* 4 mad */ + 3, /* 5 dp2add */ + 2, /* 6 dp3 */ + 2, /* 7 dp4 */ + 1, /* 8 frc */ + 1, /* 9 rcp */ + 1, /* a rsq */ + 1, /* b exp */ + 1, /* c log */ + 3, /* d cmp */ + 2, /* e min */ + 2, /* f max */ + 1, /* 10 flr */ + 1, /* 11 mod */ + 1, /* 12 trc */ + 2, /* 13 sge */ + 2, /* 14 slt */ + 1, + 1, + 1, + 1, + 0, + 0, + 0, + 0, + 0, + 0, + 0, +}; + + +static const char *regname[0x8] = { + "R", + "T", + "CONST", + "S", + "OC", + "OD", + "U", + "UNKNOWN", +}; + +static void +print_reg_type_nr(struct debug_stream *stream, unsigned type, unsigned nr) +{ + switch (type) { + case REG_TYPE_T: + switch (nr) { + case T_DIFFUSE: + PRINTF(stream, "T_DIFFUSE"); + return; + case T_SPECULAR: + PRINTF(stream, "T_SPECULAR"); + return; + case T_FOG_W: + PRINTF(stream, "T_FOG_W"); + return; + default: + PRINTF(stream, "T_TEX%d", nr); + return; + } + case REG_TYPE_OC: + if (nr == 0) { + PRINTF(stream, "oC"); + return; + } + break; + case REG_TYPE_OD: + if (nr == 0) { + PRINTF(stream, "oD"); + return; + } + break; + default: + break; + } + + PRINTF(stream, "%s[%d]", regname[type], nr); +} + +#define REG_SWIZZLE_MASK 0x7777 +#define REG_NEGATE_MASK 0x8888 + +#define REG_SWIZZLE_XYZW ((SRC_X << A2_SRC2_CHANNEL_X_SHIFT) | \ + (SRC_Y << A2_SRC2_CHANNEL_Y_SHIFT) | \ + (SRC_Z << A2_SRC2_CHANNEL_Z_SHIFT) | \ + (SRC_W << A2_SRC2_CHANNEL_W_SHIFT)) + + +static void +print_reg_neg_swizzle(struct debug_stream *stream, unsigned reg) +{ + int i; + + if ((reg & REG_SWIZZLE_MASK) == REG_SWIZZLE_XYZW && + (reg & REG_NEGATE_MASK) == 0) + return; + + PRINTF(stream, "."); + + for (i = 3; i >= 0; i--) { + if (reg & (1 << ((i * 4) + 3))) + PRINTF(stream, "-"); + + switch ((reg >> (i * 4)) & 0x7) { + case 0: + PRINTF(stream, "x"); + break; + case 1: + PRINTF(stream, "y"); + break; + case 2: + PRINTF(stream, "z"); + break; + case 3: + PRINTF(stream, "w"); + break; + case 4: + PRINTF(stream, "0"); + break; + case 5: + PRINTF(stream, "1"); + break; + default: + PRINTF(stream, "?"); + break; + } + } +} + + +static void +print_src_reg(struct debug_stream *stream, unsigned dword) +{ + unsigned nr = (dword >> A2_SRC2_NR_SHIFT) & REG_NR_MASK; + unsigned type = (dword >> A2_SRC2_TYPE_SHIFT) & REG_TYPE_MASK; + print_reg_type_nr(stream, type, nr); + print_reg_neg_swizzle(stream, dword); +} + + +static void +print_dest_reg(struct debug_stream *stream, unsigned dword) +{ + unsigned nr = (dword >> A0_DEST_NR_SHIFT) & REG_NR_MASK; + unsigned type = (dword >> A0_DEST_TYPE_SHIFT) & REG_TYPE_MASK; + print_reg_type_nr(stream, type, nr); + if ((dword & A0_DEST_CHANNEL_ALL) == A0_DEST_CHANNEL_ALL) + return; + PRINTF(stream, "."); + if (dword & A0_DEST_CHANNEL_X) + PRINTF(stream, "x"); + if (dword & A0_DEST_CHANNEL_Y) + PRINTF(stream, "y"); + if (dword & A0_DEST_CHANNEL_Z) + PRINTF(stream, "z"); + if (dword & A0_DEST_CHANNEL_W) + PRINTF(stream, "w"); +} + + +#define GET_SRC0_REG(r0, r1) ((r0<<14)|(r1>>A1_SRC0_CHANNEL_W_SHIFT)) +#define GET_SRC1_REG(r0, r1) ((r0<<8)|(r1>>A2_SRC1_CHANNEL_W_SHIFT)) +#define GET_SRC2_REG(r) (r) + + +static void +print_arith_op(struct debug_stream *stream, + unsigned opcode, const unsigned * program) +{ + if (opcode != A0_NOP) { + print_dest_reg(stream, program[0]); + if (program[0] & A0_DEST_SATURATE) + PRINTF(stream, " = SATURATE "); + else + PRINTF(stream, " = "); + } + + PRINTF(stream, "%s ", opcodes[opcode]); + + print_src_reg(stream, GET_SRC0_REG(program[0], program[1])); + if (args[opcode] == 1) { + PRINTF(stream, "\n"); + return; + } + + PRINTF(stream, ", "); + print_src_reg(stream, GET_SRC1_REG(program[1], program[2])); + if (args[opcode] == 2) { + PRINTF(stream, "\n"); + return; + } + + PRINTF(stream, ", "); + print_src_reg(stream, GET_SRC2_REG(program[2])); + PRINTF(stream, "\n"); + return; +} + + +static void +print_tex_op(struct debug_stream *stream, + unsigned opcode, const unsigned * program) +{ + print_dest_reg(stream, program[0] | A0_DEST_CHANNEL_ALL); + PRINTF(stream, " = "); + + PRINTF(stream, "%s ", opcodes[opcode]); + + PRINTF(stream, "S[%d],", program[0] & T0_SAMPLER_NR_MASK); + + print_reg_type_nr(stream, + (program[1] >> T1_ADDRESS_REG_TYPE_SHIFT) & + REG_TYPE_MASK, + (program[1] >> T1_ADDRESS_REG_NR_SHIFT) & REG_NR_MASK); + PRINTF(stream, "\n"); +} + +static void +print_texkil_op(struct debug_stream *stream, + unsigned opcode, const unsigned * program) +{ + PRINTF(stream, "TEXKIL "); + + print_reg_type_nr(stream, + (program[1] >> T1_ADDRESS_REG_TYPE_SHIFT) & + REG_TYPE_MASK, + (program[1] >> T1_ADDRESS_REG_NR_SHIFT) & REG_NR_MASK); + PRINTF(stream, "\n"); +} + +static void +print_dcl_op(struct debug_stream *stream, + unsigned opcode, const unsigned * program) +{ + PRINTF(stream, "%s ", opcodes[opcode]); + print_dest_reg(stream, + program[0] | A0_DEST_CHANNEL_ALL); + PRINTF(stream, "\n"); +} + + +void +i915_disassemble_program(struct debug_stream *stream, + const unsigned * program, unsigned sz) +{ + unsigned i; + + PRINTF(stream, "\t\tBEGIN\n"); + + assert((program[0] & 0x1ff) + 2 == sz); + + program++; + for (i = 1; i < sz; i += 3, program += 3) { + unsigned opcode = program[0] & (0x1f << 24); + + PRINTF(stream, "\t\t"); + + if ((int) opcode >= A0_NOP && opcode <= A0_SLT) + print_arith_op(stream, opcode >> 24, program); + else if (opcode >= T0_TEXLD && opcode < T0_TEXKILL) + print_tex_op(stream, opcode >> 24, program); + else if (opcode == T0_TEXKILL) + print_texkil_op(stream, opcode >> 24, program); + else if (opcode == D0_DCL) + print_dcl_op(stream, opcode >> 24, program); + else + PRINTF(stream, "Unknown opcode 0x%x\n", opcode); + } + + PRINTF(stream, "\t\tEND\n\n"); +} + + diff --git a/src/gallium/drivers/i915/i915_flush.c b/src/gallium/drivers/i915/i915_flush.c new file mode 100644 index 0000000000..1582168eba --- /dev/null +++ b/src/gallium/drivers/i915/i915_flush.c @@ -0,0 +1,86 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * 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. + * + **************************************************************************/ + +/* Author: + * Keith Whitwell + */ + + +#include "pipe/p_defines.h" +#include "draw/draw_context.h" +#include "i915_context.h" +#include "i915_reg.h" +#include "i915_batch.h" + + +static void i915_flush( struct pipe_context *pipe, + unsigned flags, + struct pipe_fence_handle **fence ) +{ + struct i915_context *i915 = i915_context(pipe); + + draw_flush(i915->draw); + +#if 0 + /* Do we need to emit an MI_FLUSH command to flush the hardware + * caches? + */ + if (flags & (PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE)) { + unsigned flush = MI_FLUSH; + + if (!(flags & PIPE_FLUSH_RENDER_CACHE)) + flush |= INHIBIT_FLUSH_RENDER_CACHE; + + if (flags & PIPE_FLUSH_TEXTURE_CACHE) + flush |= FLUSH_MAP_CACHE; + + if (!BEGIN_BATCH(1, 0)) { + FLUSH_BATCH(NULL); + assert(BEGIN_BATCH(1, 0)); + } + OUT_BATCH( flush ); + } +#endif + +#if 0 + if (i915->batch->map == i915->batch->ptr) { + return; + } +#endif + + /* If there are no flags, just flush pending commands to hardware: + */ + FLUSH_BATCH(fence); + i915->vbo_flushed = 1; +} + + + +void i915_init_flush_functions( struct i915_context *i915 ) +{ + i915->base.flush = i915_flush; +} diff --git a/src/gallium/drivers/i915/i915_fpc.h b/src/gallium/drivers/i915/i915_fpc.h new file mode 100644 index 0000000000..2f0f99d046 --- /dev/null +++ b/src/gallium/drivers/i915/i915_fpc.h @@ -0,0 +1,207 @@ +/************************************************************************** + * + * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#ifndef I915_FPC_H +#define I915_FPC_H + + +#include "i915_context.h" +#include "i915_reg.h" + + + +#define I915_PROGRAM_SIZE 192 + + + +/** + * Program translation state + */ +struct i915_fp_compile { + struct i915_fragment_shader *shader; /* the shader we're compiling */ + + boolean used_constants[I915_MAX_CONSTANT]; + + /** maps TGSI immediate index to constant slot */ + uint num_immediates; + uint immediates_map[I915_MAX_CONSTANT]; + float immediates[I915_MAX_CONSTANT][4]; + + boolean first_instruction; + + uint declarations[I915_PROGRAM_SIZE]; + uint program[I915_PROGRAM_SIZE]; + + uint *csr; /**< Cursor, points into program. */ + + uint *decl; /**< Cursor, points into declarations. */ + + uint decl_s; /**< flags for which s regs need to be decl'd */ + uint decl_t; /**< flags for which t regs need to be decl'd */ + + uint temp_flag; /**< Tracks temporary regs which are in use */ + uint utemp_flag; /**< Tracks TYPE_U temporary regs which are in use */ + + uint nr_tex_indirect; + uint nr_tex_insn; + uint nr_alu_insn; + uint nr_decl_insn; + + boolean error; /**< Set if i915_program_error() is called */ + uint wpos_tex; + uint NumNativeInstructions; + uint NumNativeAluInstructions; + uint NumNativeTexInstructions; + uint NumNativeTexIndirections; +}; + + +/* Having zero and one in here makes the definition of swizzle a lot + * easier. + */ +#define UREG_TYPE_SHIFT 29 +#define UREG_NR_SHIFT 24 +#define UREG_CHANNEL_X_NEGATE_SHIFT 23 +#define UREG_CHANNEL_X_SHIFT 20 +#define UREG_CHANNEL_Y_NEGATE_SHIFT 19 +#define UREG_CHANNEL_Y_SHIFT 16 +#define UREG_CHANNEL_Z_NEGATE_SHIFT 15 +#define UREG_CHANNEL_Z_SHIFT 12 +#define UREG_CHANNEL_W_NEGATE_SHIFT 11 +#define UREG_CHANNEL_W_SHIFT 8 +#define UREG_CHANNEL_ZERO_NEGATE_MBZ 5 +#define UREG_CHANNEL_ZERO_SHIFT 4 +#define UREG_CHANNEL_ONE_NEGATE_MBZ 1 +#define UREG_CHANNEL_ONE_SHIFT 0 + +#define UREG_BAD 0xffffffff /* not a valid ureg */ + +#define X SRC_X +#define Y SRC_Y +#define Z SRC_Z +#define W SRC_W +#define ZERO SRC_ZERO +#define ONE SRC_ONE + +/* Construct a ureg: + */ +#define UREG( type, nr ) (((type)<< UREG_TYPE_SHIFT) | \ + ((nr) << UREG_NR_SHIFT) | \ + (X << UREG_CHANNEL_X_SHIFT) | \ + (Y << UREG_CHANNEL_Y_SHIFT) | \ + (Z << UREG_CHANNEL_Z_SHIFT) | \ + (W << UREG_CHANNEL_W_SHIFT) | \ + (ZERO << UREG_CHANNEL_ZERO_SHIFT) | \ + (ONE << UREG_CHANNEL_ONE_SHIFT)) + +#define GET_CHANNEL_SRC( reg, channel ) ((reg<<(channel*4)) & (0xf<<20)) +#define CHANNEL_SRC( src, channel ) (src>>(channel*4)) + +#define GET_UREG_TYPE(reg) (((reg)>>UREG_TYPE_SHIFT)®_TYPE_MASK) +#define GET_UREG_NR(reg) (((reg)>>UREG_NR_SHIFT)®_NR_MASK) + + + +#define UREG_XYZW_CHANNEL_MASK 0x00ffff00 + +/* One neat thing about the UREG representation: + */ +static INLINE int +swizzle(int reg, uint x, uint y, uint z, uint w) +{ + assert(x <= SRC_ONE); + assert(y <= SRC_ONE); + assert(z <= SRC_ONE); + assert(w <= SRC_ONE); + return ((reg & ~UREG_XYZW_CHANNEL_MASK) | + CHANNEL_SRC(GET_CHANNEL_SRC(reg, x), 0) | + CHANNEL_SRC(GET_CHANNEL_SRC(reg, y), 1) | + CHANNEL_SRC(GET_CHANNEL_SRC(reg, z), 2) | + CHANNEL_SRC(GET_CHANNEL_SRC(reg, w), 3)); +} + + + +/*********************************************************************** + * Public interface for the compiler + */ +extern void +i915_translate_fragment_program( struct i915_context *i915, + struct i915_fragment_shader *fs); + + + +extern uint i915_get_temp(struct i915_fp_compile *p); +extern uint i915_get_utemp(struct i915_fp_compile *p); +extern void i915_release_utemps(struct i915_fp_compile *p); + + +extern uint i915_emit_texld(struct i915_fp_compile *p, + uint dest, + uint destmask, + uint sampler, uint coord, uint op); + +extern uint i915_emit_arith(struct i915_fp_compile *p, + uint op, + uint dest, + uint mask, + uint saturate, + uint src0, uint src1, uint src2); + +extern uint i915_emit_decl(struct i915_fp_compile *p, + uint type, uint nr, uint d0_flags); + + +extern uint i915_emit_const1f(struct i915_fp_compile *p, float c0); + +extern uint i915_emit_const2f(struct i915_fp_compile *p, + float c0, float c1); + +extern uint i915_emit_const4fv(struct i915_fp_compile *p, + const float * c); + +extern uint i915_emit_const4f(struct i915_fp_compile *p, + float c0, float c1, + float c2, float c3); + + +/*====================================================================== + * i915_fpc_debug.c + */ +extern void i915_disassemble_program(const uint * program, uint sz); + + +/*====================================================================== + * i915_fpc_translate.c + */ + +extern void +i915_program_error(struct i915_fp_compile *p, const char *msg, ...); + + +#endif diff --git a/src/gallium/drivers/i915/i915_fpc_emit.c b/src/gallium/drivers/i915/i915_fpc_emit.c new file mode 100644 index 0000000000..b054ce41d3 --- /dev/null +++ b/src/gallium/drivers/i915/i915_fpc_emit.c @@ -0,0 +1,375 @@ +/************************************************************************** + * + * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include "i915_reg.h" +#include "i915_context.h" +#include "i915_fpc.h" +#include "util/u_math.h" + + +#define A0_DEST( reg ) (((reg)&UREG_TYPE_NR_MASK)>>UREG_A0_DEST_SHIFT_LEFT) +#define D0_DEST( reg ) (((reg)&UREG_TYPE_NR_MASK)>>UREG_A0_DEST_SHIFT_LEFT) +#define T0_DEST( reg ) (((reg)&UREG_TYPE_NR_MASK)>>UREG_A0_DEST_SHIFT_LEFT) +#define A0_SRC0( reg ) (((reg)&UREG_MASK)>>UREG_A0_SRC0_SHIFT_LEFT) +#define A1_SRC0( reg ) (((reg)&UREG_MASK)<>UREG_A1_SRC1_SHIFT_LEFT) +#define A2_SRC1( reg ) (((reg)&UREG_MASK)<>UREG_A2_SRC2_SHIFT_LEFT) + +/* These are special, and don't have swizzle/negate bits. + */ +#define T0_SAMPLER( reg ) (GET_UREG_NR(reg)<temp_flag); + if (!bit) { + i915_program_error(p, "i915_get_temp: out of temporaries\n"); + return 0; + } + + p->temp_flag |= 1 << (bit - 1); + return bit - 1; +} + + +static void +i915_release_temp(struct i915_fp_compile *p, int reg) +{ + p->temp_flag &= ~(1 << reg); +} + + +/** + * Get unpreserved temporary, a temp whose value is not preserved between + * PS program phases. + */ +uint +i915_get_utemp(struct i915_fp_compile * p) +{ + int bit = ffs(~p->utemp_flag); + if (!bit) { + i915_program_error(p, "i915_get_utemp: out of temporaries\n"); + return 0; + } + + p->utemp_flag |= 1 << (bit - 1); + return UREG(REG_TYPE_U, (bit - 1)); +} + +void +i915_release_utemps(struct i915_fp_compile *p) +{ + p->utemp_flag = ~0x7; +} + + +uint +i915_emit_decl(struct i915_fp_compile *p, + uint type, uint nr, uint d0_flags) +{ + uint reg = UREG(type, nr); + + if (type == REG_TYPE_T) { + if (p->decl_t & (1 << nr)) + return reg; + + p->decl_t |= (1 << nr); + } + else if (type == REG_TYPE_S) { + if (p->decl_s & (1 << nr)) + return reg; + + p->decl_s |= (1 << nr); + } + else + return reg; + + *(p->decl++) = (D0_DCL | D0_DEST(reg) | d0_flags); + *(p->decl++) = D1_MBZ; + *(p->decl++) = D2_MBZ; + + p->nr_decl_insn++; + return reg; +} + +uint +i915_emit_arith(struct i915_fp_compile * p, + uint op, + uint dest, + uint mask, + uint saturate, uint src0, uint src1, uint src2) +{ + uint c[3]; + uint nr_const = 0; + + assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST); + dest = UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest)); + assert(dest); + + if (GET_UREG_TYPE(src0) == REG_TYPE_CONST) + c[nr_const++] = 0; + if (GET_UREG_TYPE(src1) == REG_TYPE_CONST) + c[nr_const++] = 1; + if (GET_UREG_TYPE(src2) == REG_TYPE_CONST) + c[nr_const++] = 2; + + /* Recursively call this function to MOV additional const values + * into temporary registers. Use utemp registers for this - + * currently shouldn't be possible to run out, but keep an eye on + * this. + */ + if (nr_const > 1) { + uint s[3], first, i, old_utemp_flag; + + s[0] = src0; + s[1] = src1; + s[2] = src2; + old_utemp_flag = p->utemp_flag; + + first = GET_UREG_NR(s[c[0]]); + for (i = 1; i < nr_const; i++) { + if (GET_UREG_NR(s[c[i]]) != first) { + uint tmp = i915_get_utemp(p); + + i915_emit_arith(p, A0_MOV, tmp, A0_DEST_CHANNEL_ALL, 0, + s[c[i]], 0, 0); + s[c[i]] = tmp; + } + } + + src0 = s[0]; + src1 = s[1]; + src2 = s[2]; + p->utemp_flag = old_utemp_flag; /* restore */ + } + + *(p->csr++) = (op | A0_DEST(dest) | mask | saturate | A0_SRC0(src0)); + *(p->csr++) = (A1_SRC0(src0) | A1_SRC1(src1)); + *(p->csr++) = (A2_SRC1(src1) | A2_SRC2(src2)); + + p->nr_alu_insn++; + return dest; +} + + +/** + * Emit a texture load or texkill instruction. + * \param dest the dest i915 register + * \param destmask the dest register writemask + * \param sampler the i915 sampler register + * \param coord the i915 source texcoord operand + * \param opcode the instruction opcode + */ +uint i915_emit_texld( struct i915_fp_compile *p, + uint dest, + uint destmask, + uint sampler, + uint coord, + uint opcode ) +{ + const uint k = UREG(GET_UREG_TYPE(coord), GET_UREG_NR(coord)); + int temp = -1; + + if (coord != k) { + /* texcoord is swizzled or negated. Need to allocate a new temporary + * register (a utemp / unpreserved temp) won't do. + */ + uint tempReg; + + temp = i915_get_temp(p); /* get temp reg index */ + tempReg = UREG(REG_TYPE_R, temp); /* make i915 register */ + + i915_emit_arith( p, A0_MOV, + tempReg, A0_DEST_CHANNEL_ALL, /* dest reg, writemask */ + 0, /* saturate */ + coord, 0, 0 ); /* src0, src1, src2 */ + + /* new src texcoord is tempReg */ + coord = tempReg; + } + + /* Don't worry about saturate as we only support + */ + if (destmask != A0_DEST_CHANNEL_ALL) { + /* if not writing to XYZW... */ + uint tmp = i915_get_utemp(p); + i915_emit_texld( p, tmp, A0_DEST_CHANNEL_ALL, sampler, coord, opcode ); + i915_emit_arith( p, A0_MOV, dest, destmask, 0, tmp, 0, 0 ); + /* XXX release utemp here? */ + } + else { + assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST); + assert(dest = UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest))); + + /* is the sampler coord a texcoord input reg? */ + if (GET_UREG_TYPE(coord) != REG_TYPE_T) { + p->nr_tex_indirect++; + } + + *(p->csr++) = (opcode | + T0_DEST( dest ) | + T0_SAMPLER( sampler )); + + *(p->csr++) = T1_ADDRESS_REG( coord ); + *(p->csr++) = T2_MBZ; + + p->nr_tex_insn++; + } + + if (temp >= 0) + i915_release_temp(p, temp); + + return dest; +} + + +uint +i915_emit_const1f(struct i915_fp_compile * p, float c0) +{ + struct i915_fragment_shader *ifs = p->shader; + unsigned reg, idx; + + if (c0 == 0.0) + return swizzle(UREG(REG_TYPE_R, 0), ZERO, ZERO, ZERO, ZERO); + if (c0 == 1.0) + return swizzle(UREG(REG_TYPE_R, 0), ONE, ONE, ONE, ONE); + + for (reg = 0; reg < I915_MAX_CONSTANT; reg++) { + if (ifs->constant_flags[reg] == I915_CONSTFLAG_USER) + continue; + for (idx = 0; idx < 4; idx++) { + if (!(ifs->constant_flags[reg] & (1 << idx)) || + ifs->constants[reg][idx] == c0) { + ifs->constants[reg][idx] = c0; + ifs->constant_flags[reg] |= 1 << idx; + if (reg + 1 > ifs->num_constants) + ifs->num_constants = reg + 1; + return swizzle(UREG(REG_TYPE_CONST, reg), idx, ZERO, ZERO, ONE); + } + } + } + + i915_program_error(p, "i915_emit_const1f: out of constants\n"); + return 0; +} + +uint +i915_emit_const2f(struct i915_fp_compile * p, float c0, float c1) +{ + struct i915_fragment_shader *ifs = p->shader; + unsigned reg, idx; + + if (c0 == 0.0) + return swizzle(i915_emit_const1f(p, c1), ZERO, X, Z, W); + if (c0 == 1.0) + return swizzle(i915_emit_const1f(p, c1), ONE, X, Z, W); + + if (c1 == 0.0) + return swizzle(i915_emit_const1f(p, c0), X, ZERO, Z, W); + if (c1 == 1.0) + return swizzle(i915_emit_const1f(p, c0), X, ONE, Z, W); + + for (reg = 0; reg < I915_MAX_CONSTANT; reg++) { + if (ifs->constant_flags[reg] == 0xf || + ifs->constant_flags[reg] == I915_CONSTFLAG_USER) + continue; + for (idx = 0; idx < 3; idx++) { + if (!(ifs->constant_flags[reg] & (3 << idx))) { + ifs->constants[reg][idx + 0] = c0; + ifs->constants[reg][idx + 1] = c1; + ifs->constant_flags[reg] |= 3 << idx; + if (reg + 1 > ifs->num_constants) + ifs->num_constants = reg + 1; + return swizzle(UREG(REG_TYPE_CONST, reg), idx, idx + 1, ZERO, ONE); + } + } + } + + i915_program_error(p, "i915_emit_const2f: out of constants\n"); + return 0; +} + + + +uint +i915_emit_const4f(struct i915_fp_compile * p, + float c0, float c1, float c2, float c3) +{ + struct i915_fragment_shader *ifs = p->shader; + unsigned reg; + + for (reg = 0; reg < I915_MAX_CONSTANT; reg++) { + if (ifs->constant_flags[reg] == 0xf && + ifs->constants[reg][0] == c0 && + ifs->constants[reg][1] == c1 && + ifs->constants[reg][2] == c2 && + ifs->constants[reg][3] == c3) { + return UREG(REG_TYPE_CONST, reg); + } + else if (ifs->constant_flags[reg] == 0) { + + ifs->constants[reg][0] = c0; + ifs->constants[reg][1] = c1; + ifs->constants[reg][2] = c2; + ifs->constants[reg][3] = c3; + ifs->constant_flags[reg] = 0xf; + if (reg + 1 > ifs->num_constants) + ifs->num_constants = reg + 1; + return UREG(REG_TYPE_CONST, reg); + } + } + + i915_program_error(p, "i915_emit_const4f: out of constants\n"); + return 0; +} + + +uint +i915_emit_const4fv(struct i915_fp_compile * p, const float * c) +{ + return i915_emit_const4f(p, c[0], c[1], c[2], c[3]); +} diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c b/src/gallium/drivers/i915/i915_fpc_translate.c new file mode 100644 index 0000000000..89504ced27 --- /dev/null +++ b/src/gallium/drivers/i915/i915_fpc_translate.c @@ -0,0 +1,1202 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#include + +#include "i915_reg.h" +#include "i915_context.h" +#include "i915_fpc.h" + +#include "pipe/p_shader_tokens.h" +#include "util/u_math.h" +#include "util/u_memory.h" +#include "util/u_string.h" +#include "tgsi/tgsi_parse.h" +#include "tgsi/tgsi_dump.h" + +#include "draw/draw_vertex.h" + + +/** + * Simple pass-through fragment shader to use when we don't have + * a real shader (or it fails to compile for some reason). + */ +static unsigned passthrough[] = +{ + _3DSTATE_PIXEL_SHADER_PROGRAM | ((2*3)-1), + + /* declare input color: + */ + (D0_DCL | + (REG_TYPE_T << D0_TYPE_SHIFT) | + (T_DIFFUSE << D0_NR_SHIFT) | + D0_CHANNEL_ALL), + 0, + 0, + + /* move to output color: + */ + (A0_MOV | + (REG_TYPE_OC << A0_DEST_TYPE_SHIFT) | + A0_DEST_CHANNEL_ALL | + (REG_TYPE_T << A0_SRC0_TYPE_SHIFT) | + (T_DIFFUSE << A0_SRC0_NR_SHIFT)), + 0x01230000, /* .xyzw */ + 0 +}; + + +/* 1, -1/3!, 1/5!, -1/7! */ +static const float sin_constants[4] = { 1.0, + -1.0f / (3 * 2 * 1), + 1.0f / (5 * 4 * 3 * 2 * 1), + -1.0f / (7 * 6 * 5 * 4 * 3 * 2 * 1) +}; + +/* 1, -1/2!, 1/4!, -1/6! */ +static const float cos_constants[4] = { 1.0, + -1.0f / (2 * 1), + 1.0f / (4 * 3 * 2 * 1), + -1.0f / (6 * 5 * 4 * 3 * 2 * 1) +}; + + + +/** + * component-wise negation of ureg + */ +static INLINE int +negate(int reg, int x, int y, int z, int w) +{ + /* Another neat thing about the UREG representation */ + return reg ^ (((x & 1) << UREG_CHANNEL_X_NEGATE_SHIFT) | + ((y & 1) << UREG_CHANNEL_Y_NEGATE_SHIFT) | + ((z & 1) << UREG_CHANNEL_Z_NEGATE_SHIFT) | + ((w & 1) << UREG_CHANNEL_W_NEGATE_SHIFT)); +} + + +/** + * In the event of a translation failure, we'll generate a simple color + * pass-through program. + */ +static void +i915_use_passthrough_shader(struct i915_fragment_shader *fs) +{ + fs->program = (uint *) MALLOC(sizeof(passthrough)); + if (fs->program) { + memcpy(fs->program, passthrough, sizeof(passthrough)); + fs->program_len = Elements(passthrough); + } + fs->num_constants = 0; +} + + +void +i915_program_error(struct i915_fp_compile *p, const char *msg, ...) +{ + va_list args; + char buffer[1024]; + + debug_printf("i915_program_error: "); + va_start( args, msg ); + util_vsnprintf( buffer, sizeof(buffer), msg, args ); + va_end( args ); + debug_printf(buffer); + debug_printf("\n"); + + p->error = 1; +} + + + +/** + * Construct a ureg for the given source register. Will emit + * constants, apply swizzling and negation as needed. + */ +static uint +src_vector(struct i915_fp_compile *p, + const struct tgsi_full_src_register *source) +{ + uint index = source->SrcRegister.Index; + uint src = 0, sem_name, sem_ind; + + switch (source->SrcRegister.File) { + case TGSI_FILE_TEMPORARY: + if (source->SrcRegister.Index >= I915_MAX_TEMPORARY) { + i915_program_error(p, "Exceeded max temporary reg"); + return 0; + } + src = UREG(REG_TYPE_R, index); + break; + case TGSI_FILE_INPUT: + /* XXX: Packing COL1, FOGC into a single attribute works for + * texenv programs, but will fail for real fragment programs + * that use these attributes and expect them to be a full 4 + * components wide. Could use a texcoord to pass these + * attributes if necessary, but that won't work in the general + * case. + * + * We also use a texture coordinate to pass wpos when possible. + */ + + sem_name = p->shader->info.input_semantic_name[index]; + sem_ind = p->shader->info.input_semantic_index[index]; + + switch (sem_name) { + case TGSI_SEMANTIC_POSITION: + debug_printf("SKIP SEM POS\n"); + /* + assert(p->wpos_tex != -1); + src = i915_emit_decl(p, REG_TYPE_T, p->wpos_tex, D0_CHANNEL_ALL); + */ + break; + case TGSI_SEMANTIC_COLOR: + if (sem_ind == 0) { + src = i915_emit_decl(p, REG_TYPE_T, T_DIFFUSE, D0_CHANNEL_ALL); + } + else { + /* secondary color */ + assert(sem_ind == 1); + src = i915_emit_decl(p, REG_TYPE_T, T_SPECULAR, D0_CHANNEL_XYZ); + src = swizzle(src, X, Y, Z, ONE); + } + break; + case TGSI_SEMANTIC_FOG: + src = i915_emit_decl(p, REG_TYPE_T, T_FOG_W, D0_CHANNEL_W); + src = swizzle(src, W, W, W, W); + break; + case TGSI_SEMANTIC_GENERIC: + /* usually a texcoord */ + src = i915_emit_decl(p, REG_TYPE_T, T_TEX0 + sem_ind, D0_CHANNEL_ALL); + break; + default: + i915_program_error(p, "Bad source->Index"); + return 0; + } + break; + + case TGSI_FILE_IMMEDIATE: + assert(index < p->num_immediates); + index = p->immediates_map[index]; + /* fall-through */ + case TGSI_FILE_CONSTANT: + src = UREG(REG_TYPE_CONST, index); + break; + + default: + i915_program_error(p, "Bad source->File"); + return 0; + } + + if (source->SrcRegister.Extended) { + src = swizzle(src, + source->SrcRegisterExtSwz.ExtSwizzleX, + source->SrcRegisterExtSwz.ExtSwizzleY, + source->SrcRegisterExtSwz.ExtSwizzleZ, + source->SrcRegisterExtSwz.ExtSwizzleW); + } + else { + src = swizzle(src, + source->SrcRegister.SwizzleX, + source->SrcRegister.SwizzleY, + source->SrcRegister.SwizzleZ, + source->SrcRegister.SwizzleW); + } + + + /* There's both negate-all-components and per-component negation. + * Try to handle both here. + */ + { + int nx = source->SrcRegisterExtSwz.NegateX; + int ny = source->SrcRegisterExtSwz.NegateY; + int nz = source->SrcRegisterExtSwz.NegateZ; + int nw = source->SrcRegisterExtSwz.NegateW; + if (source->SrcRegister.Negate) { + nx = !nx; + ny = !ny; + nz = !nz; + nw = !nw; + } + src = negate(src, nx, ny, nz, nw); + } + + /* no abs() or post-abs negation */ +#if 0 + /* XXX assertions disabled to allow arbfplight.c to run */ + /* XXX enable these assertions, or fix things */ + assert(!source->SrcRegisterExtMod.Absolute); + assert(!source->SrcRegisterExtMod.Negate); +#endif + return src; +} + + +/** + * Construct a ureg for a destination register. + */ +static uint +get_result_vector(struct i915_fp_compile *p, + const struct tgsi_full_dst_register *dest) +{ + switch (dest->DstRegister.File) { + case TGSI_FILE_OUTPUT: + { + uint sem_name = p->shader->info.output_semantic_name[dest->DstRegister.Index]; + switch (sem_name) { + case TGSI_SEMANTIC_POSITION: + return UREG(REG_TYPE_OD, 0); + case TGSI_SEMANTIC_COLOR: + return UREG(REG_TYPE_OC, 0); + default: + i915_program_error(p, "Bad inst->DstReg.Index/semantics"); + return 0; + } + } + case TGSI_FILE_TEMPORARY: + return UREG(REG_TYPE_R, dest->DstRegister.Index); + default: + i915_program_error(p, "Bad inst->DstReg.File"); + return 0; + } +} + + +/** + * Compute flags for saturation and writemask. + */ +static uint +get_result_flags(const struct tgsi_full_instruction *inst) +{ + const uint writeMask + = inst->FullDstRegisters[0].DstRegister.WriteMask; + uint flags = 0x0; + + if (inst->Instruction.Saturate == TGSI_SAT_ZERO_ONE) + flags |= A0_DEST_SATURATE; + + if (writeMask & TGSI_WRITEMASK_X) + flags |= A0_DEST_CHANNEL_X; + if (writeMask & TGSI_WRITEMASK_Y) + flags |= A0_DEST_CHANNEL_Y; + if (writeMask & TGSI_WRITEMASK_Z) + flags |= A0_DEST_CHANNEL_Z; + if (writeMask & TGSI_WRITEMASK_W) + flags |= A0_DEST_CHANNEL_W; + + return flags; +} + + +/** + * Convert TGSI_TEXTURE_x token to DO_SAMPLE_TYPE_x token + */ +static uint +translate_tex_src_target(struct i915_fp_compile *p, uint tex) +{ + switch (tex) { + case TGSI_TEXTURE_SHADOW1D: + /* fall-through */ + case TGSI_TEXTURE_1D: + return D0_SAMPLE_TYPE_2D; + + case TGSI_TEXTURE_SHADOW2D: + /* fall-through */ + case TGSI_TEXTURE_2D: + return D0_SAMPLE_TYPE_2D; + + case TGSI_TEXTURE_SHADOWRECT: + /* fall-through */ + case TGSI_TEXTURE_RECT: + return D0_SAMPLE_TYPE_2D; + + case TGSI_TEXTURE_3D: + return D0_SAMPLE_TYPE_VOLUME; + + case TGSI_TEXTURE_CUBE: + return D0_SAMPLE_TYPE_CUBE; + + default: + i915_program_error(p, "TexSrc type"); + return 0; + } +} + + +/** + * Generate texel lookup instruction. + */ +static void +emit_tex(struct i915_fp_compile *p, + const struct tgsi_full_instruction *inst, + uint opcode) +{ + uint texture = inst->InstructionExtTexture.Texture; + uint unit = inst->FullSrcRegisters[1].SrcRegister.Index; + uint tex = translate_tex_src_target( p, texture ); + uint sampler = i915_emit_decl(p, REG_TYPE_S, unit, tex); + uint coord = src_vector( p, &inst->FullSrcRegisters[0]); + + i915_emit_texld( p, + get_result_vector( p, &inst->FullDstRegisters[0] ), + get_result_flags( inst ), + sampler, + coord, + opcode); +} + + +/** + * Generate a simple arithmetic instruction + * \param opcode the i915 opcode + * \param numArgs the number of input/src arguments + */ +static void +emit_simple_arith(struct i915_fp_compile *p, + const struct tgsi_full_instruction *inst, + uint opcode, uint numArgs) +{ + uint arg1, arg2, arg3; + + assert(numArgs <= 3); + + arg1 = (numArgs < 1) ? 0 : src_vector( p, &inst->FullSrcRegisters[0] ); + arg2 = (numArgs < 2) ? 0 : src_vector( p, &inst->FullSrcRegisters[1] ); + arg3 = (numArgs < 3) ? 0 : src_vector( p, &inst->FullSrcRegisters[2] ); + + i915_emit_arith( p, + opcode, + get_result_vector( p, &inst->FullDstRegisters[0]), + get_result_flags( inst ), 0, + arg1, + arg2, + arg3 ); +} + + +/** As above, but swap the first two src regs */ +static void +emit_simple_arith_swap2(struct i915_fp_compile *p, + const struct tgsi_full_instruction *inst, + uint opcode, uint numArgs) +{ + struct tgsi_full_instruction inst2; + + assert(numArgs == 2); + + /* transpose first two registers */ + inst2 = *inst; + inst2.FullSrcRegisters[0] = inst->FullSrcRegisters[1]; + inst2.FullSrcRegisters[1] = inst->FullSrcRegisters[0]; + + emit_simple_arith(p, &inst2, opcode, numArgs); +} + + +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + +/* + * Translate TGSI instruction to i915 instruction. + * + * Possible concerns: + * + * SIN, COS -- could use another taylor step? + * LIT -- results seem a little different to sw mesa + * LOG -- different to mesa on negative numbers, but this is conformant. + */ +static void +i915_translate_instruction(struct i915_fp_compile *p, + const struct tgsi_full_instruction *inst) +{ + uint writemask; + uint src0, src1, src2, flags; + uint tmp = 0; + + switch (inst->Instruction.Opcode) { + case TGSI_OPCODE_ABS: + src0 = src_vector(p, &inst->FullSrcRegisters[0]); + i915_emit_arith(p, + A0_MAX, + get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_flags(inst), 0, + src0, negate(src0, 1, 1, 1, 1), 0); + break; + + case TGSI_OPCODE_ADD: + emit_simple_arith(p, inst, A0_ADD, 2); + break; + + case TGSI_OPCODE_CMP: + src0 = src_vector(p, &inst->FullSrcRegisters[0]); + src1 = src_vector(p, &inst->FullSrcRegisters[1]); + src2 = src_vector(p, &inst->FullSrcRegisters[2]); + i915_emit_arith(p, A0_CMP, + get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_flags(inst), + 0, src0, src2, src1); /* NOTE: order of src2, src1 */ + break; + + case TGSI_OPCODE_COS: + src0 = src_vector(p, &inst->FullSrcRegisters[0]); + tmp = i915_get_utemp(p); + + i915_emit_arith(p, + A0_MUL, + tmp, A0_DEST_CHANNEL_X, 0, + src0, i915_emit_const1f(p, 1.0f / (float) (M_PI * 2.0)), 0); + + i915_emit_arith(p, A0_MOD, tmp, A0_DEST_CHANNEL_X, 0, tmp, 0, 0); + + /* By choosing different taylor constants, could get rid of this mul: + */ + i915_emit_arith(p, + A0_MUL, + tmp, A0_DEST_CHANNEL_X, 0, + tmp, i915_emit_const1f(p, (float) (M_PI * 2.0)), 0); + + /* + * t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1 + * t0 = MUL t0.xyxy t0.xx11 ; x^4, x^3, x^2, 1 + * t0 = MUL t0.xxz1 t0.z111 ; x^6 x^4 x^2 1 + * result = DP4 t0, cos_constants + */ + i915_emit_arith(p, + A0_MUL, + tmp, A0_DEST_CHANNEL_XY, 0, + swizzle(tmp, X, X, ONE, ONE), + swizzle(tmp, X, ONE, ONE, ONE), 0); + + i915_emit_arith(p, + A0_MUL, + tmp, A0_DEST_CHANNEL_XYZ, 0, + swizzle(tmp, X, Y, X, ONE), + swizzle(tmp, X, X, ONE, ONE), 0); + + i915_emit_arith(p, + A0_MUL, + tmp, A0_DEST_CHANNEL_XYZ, 0, + swizzle(tmp, X, X, Z, ONE), + swizzle(tmp, Z, ONE, ONE, ONE), 0); + + i915_emit_arith(p, + A0_DP4, + get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_flags(inst), 0, + swizzle(tmp, ONE, Z, Y, X), + i915_emit_const4fv(p, cos_constants), 0); + break; + + case TGSI_OPCODE_DP3: + emit_simple_arith(p, inst, A0_DP3, 2); + break; + + case TGSI_OPCODE_DP4: + emit_simple_arith(p, inst, A0_DP4, 2); + break; + + case TGSI_OPCODE_DPH: + src0 = src_vector(p, &inst->FullSrcRegisters[0]); + src1 = src_vector(p, &inst->FullSrcRegisters[1]); + + i915_emit_arith(p, + A0_DP4, + get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_flags(inst), 0, + swizzle(src0, X, Y, Z, ONE), src1, 0); + break; + + case TGSI_OPCODE_DST: + src0 = src_vector(p, &inst->FullSrcRegisters[0]); + src1 = src_vector(p, &inst->FullSrcRegisters[1]); + + /* result[0] = 1 * 1; + * result[1] = a[1] * b[1]; + * result[2] = a[2] * 1; + * result[3] = 1 * b[3]; + */ + i915_emit_arith(p, + A0_MUL, + get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_flags(inst), 0, + swizzle(src0, ONE, Y, Z, ONE), + swizzle(src1, ONE, Y, ONE, W), 0); + break; + + case TGSI_OPCODE_END: + /* no-op */ + break; + + case TGSI_OPCODE_EX2: + src0 = src_vector(p, &inst->FullSrcRegisters[0]); + + i915_emit_arith(p, + A0_EXP, + get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_flags(inst), 0, + swizzle(src0, X, X, X, X), 0, 0); + break; + + case TGSI_OPCODE_FLR: + emit_simple_arith(p, inst, A0_FLR, 1); + break; + + case TGSI_OPCODE_FRC: + emit_simple_arith(p, inst, A0_FRC, 1); + break; + + case TGSI_OPCODE_KIL: + /* kill if src[0].x < 0 || src[0].y < 0 ... */ + src0 = src_vector(p, &inst->FullSrcRegisters[0]); + tmp = i915_get_utemp(p); + + i915_emit_texld(p, + tmp, /* dest reg: a dummy reg */ + A0_DEST_CHANNEL_ALL, /* dest writemask */ + 0, /* sampler */ + src0, /* coord*/ + T0_TEXKILL); /* opcode */ + break; + + case TGSI_OPCODE_KILP: + assert(0); /* not tested yet */ + break; + + case TGSI_OPCODE_LG2: + src0 = src_vector(p, &inst->FullSrcRegisters[0]); + + i915_emit_arith(p, + A0_LOG, + get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_flags(inst), 0, + swizzle(src0, X, X, X, X), 0, 0); + break; + + case TGSI_OPCODE_LIT: + src0 = src_vector(p, &inst->FullSrcRegisters[0]); + tmp = i915_get_utemp(p); + + /* tmp = max( a.xyzw, a.00zw ) + * XXX: Clamp tmp.w to -128..128 + * tmp.y = log(tmp.y) + * tmp.y = tmp.w * tmp.y + * tmp.y = exp(tmp.y) + * result = cmp (a.11-x1, a.1x01, a.1xy1 ) + */ + i915_emit_arith(p, A0_MAX, tmp, A0_DEST_CHANNEL_ALL, 0, + src0, swizzle(src0, ZERO, ZERO, Z, W), 0); + + i915_emit_arith(p, A0_LOG, tmp, A0_DEST_CHANNEL_Y, 0, + swizzle(tmp, Y, Y, Y, Y), 0, 0); + + i915_emit_arith(p, A0_MUL, tmp, A0_DEST_CHANNEL_Y, 0, + swizzle(tmp, ZERO, Y, ZERO, ZERO), + swizzle(tmp, ZERO, W, ZERO, ZERO), 0); + + i915_emit_arith(p, A0_EXP, tmp, A0_DEST_CHANNEL_Y, 0, + swizzle(tmp, Y, Y, Y, Y), 0, 0); + + i915_emit_arith(p, A0_CMP, + get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_flags(inst), 0, + negate(swizzle(tmp, ONE, ONE, X, ONE), 0, 0, 1, 0), + swizzle(tmp, ONE, X, ZERO, ONE), + swizzle(tmp, ONE, X, Y, ONE)); + + break; + + case TGSI_OPCODE_LRP: + src0 = src_vector(p, &inst->FullSrcRegisters[0]); + src1 = src_vector(p, &inst->FullSrcRegisters[1]); + src2 = src_vector(p, &inst->FullSrcRegisters[2]); + flags = get_result_flags(inst); + tmp = i915_get_utemp(p); + + /* b*a + c*(1-a) + * + * b*a + c - ca + * + * tmp = b*a + c, + * result = (-c)*a + tmp + */ + i915_emit_arith(p, A0_MAD, tmp, + flags & A0_DEST_CHANNEL_ALL, 0, src1, src0, src2); + + i915_emit_arith(p, A0_MAD, + get_result_vector(p, &inst->FullDstRegisters[0]), + flags, 0, negate(src2, 1, 1, 1, 1), src0, tmp); + break; + + case TGSI_OPCODE_MAD: + emit_simple_arith(p, inst, A0_MAD, 3); + break; + + case TGSI_OPCODE_MAX: + emit_simple_arith(p, inst, A0_MAX, 2); + break; + + case TGSI_OPCODE_MIN: + src0 = src_vector(p, &inst->FullSrcRegisters[0]); + src1 = src_vector(p, &inst->FullSrcRegisters[1]); + tmp = i915_get_utemp(p); + flags = get_result_flags(inst); + + i915_emit_arith(p, + A0_MAX, + tmp, flags & A0_DEST_CHANNEL_ALL, 0, + negate(src0, 1, 1, 1, 1), + negate(src1, 1, 1, 1, 1), 0); + + i915_emit_arith(p, + A0_MOV, + get_result_vector(p, &inst->FullDstRegisters[0]), + flags, 0, negate(tmp, 1, 1, 1, 1), 0, 0); + break; + + case TGSI_OPCODE_MOV: + case TGSI_OPCODE_SWZ: + emit_simple_arith(p, inst, A0_MOV, 1); + break; + + case TGSI_OPCODE_MUL: + emit_simple_arith(p, inst, A0_MUL, 2); + break; + + case TGSI_OPCODE_POW: + src0 = src_vector(p, &inst->FullSrcRegisters[0]); + src1 = src_vector(p, &inst->FullSrcRegisters[1]); + tmp = i915_get_utemp(p); + flags = get_result_flags(inst); + + /* XXX: masking on intermediate values, here and elsewhere. + */ + i915_emit_arith(p, + A0_LOG, + tmp, A0_DEST_CHANNEL_X, 0, + swizzle(src0, X, X, X, X), 0, 0); + + i915_emit_arith(p, A0_MUL, tmp, A0_DEST_CHANNEL_X, 0, tmp, src1, 0); + + i915_emit_arith(p, + A0_EXP, + get_result_vector(p, &inst->FullDstRegisters[0]), + flags, 0, swizzle(tmp, X, X, X, X), 0, 0); + break; + + case TGSI_OPCODE_RET: + /* XXX: no-op? */ + break; + + case TGSI_OPCODE_RCP: + src0 = src_vector(p, &inst->FullSrcRegisters[0]); + + i915_emit_arith(p, + A0_RCP, + get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_flags(inst), 0, + swizzle(src0, X, X, X, X), 0, 0); + break; + + case TGSI_OPCODE_RSQ: + src0 = src_vector(p, &inst->FullSrcRegisters[0]); + + i915_emit_arith(p, + A0_RSQ, + get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_flags(inst), 0, + swizzle(src0, X, X, X, X), 0, 0); + break; + + case TGSI_OPCODE_SCS: + src0 = src_vector(p, &inst->FullSrcRegisters[0]); + tmp = i915_get_utemp(p); + + /* + * t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1 + * t0 = MUL t0.xyxy t0.xx11 ; x^4, x^3, x^2, x + * t1 = MUL t0.xyyw t0.yz11 ; x^7 x^5 x^3 x + * scs.x = DP4 t1, sin_constants + * t1 = MUL t0.xxz1 t0.z111 ; x^6 x^4 x^2 1 + * scs.y = DP4 t1, cos_constants + */ + i915_emit_arith(p, + A0_MUL, + tmp, A0_DEST_CHANNEL_XY, 0, + swizzle(src0, X, X, ONE, ONE), + swizzle(src0, X, ONE, ONE, ONE), 0); + + i915_emit_arith(p, + A0_MUL, + tmp, A0_DEST_CHANNEL_ALL, 0, + swizzle(tmp, X, Y, X, Y), + swizzle(tmp, X, X, ONE, ONE), 0); + + writemask = inst->FullDstRegisters[0].DstRegister.WriteMask; + + if (writemask & TGSI_WRITEMASK_Y) { + uint tmp1; + + if (writemask & TGSI_WRITEMASK_X) + tmp1 = i915_get_utemp(p); + else + tmp1 = tmp; + + i915_emit_arith(p, + A0_MUL, + tmp1, A0_DEST_CHANNEL_ALL, 0, + swizzle(tmp, X, Y, Y, W), + swizzle(tmp, X, Z, ONE, ONE), 0); + + i915_emit_arith(p, + A0_DP4, + get_result_vector(p, &inst->FullDstRegisters[0]), + A0_DEST_CHANNEL_Y, 0, + swizzle(tmp1, W, Z, Y, X), + i915_emit_const4fv(p, sin_constants), 0); + } + + if (writemask & TGSI_WRITEMASK_X) { + i915_emit_arith(p, + A0_MUL, + tmp, A0_DEST_CHANNEL_XYZ, 0, + swizzle(tmp, X, X, Z, ONE), + swizzle(tmp, Z, ONE, ONE, ONE), 0); + + i915_emit_arith(p, + A0_DP4, + get_result_vector(p, &inst->FullDstRegisters[0]), + A0_DEST_CHANNEL_X, 0, + swizzle(tmp, ONE, Z, Y, X), + i915_emit_const4fv(p, cos_constants), 0); + } + break; + + case TGSI_OPCODE_SGE: + emit_simple_arith(p, inst, A0_SGE, 2); + break; + + case TGSI_OPCODE_SLE: + /* like SGE, but swap reg0, reg1 */ + emit_simple_arith_swap2(p, inst, A0_SGE, 2); + break; + + case TGSI_OPCODE_SIN: + src0 = src_vector(p, &inst->FullSrcRegisters[0]); + tmp = i915_get_utemp(p); + + i915_emit_arith(p, + A0_MUL, + tmp, A0_DEST_CHANNEL_X, 0, + src0, i915_emit_const1f(p, 1.0f / (float) (M_PI * 2.0)), 0); + + i915_emit_arith(p, A0_MOD, tmp, A0_DEST_CHANNEL_X, 0, tmp, 0, 0); + + /* By choosing different taylor constants, could get rid of this mul: + */ + i915_emit_arith(p, + A0_MUL, + tmp, A0_DEST_CHANNEL_X, 0, + tmp, i915_emit_const1f(p, (float) (M_PI * 2.0)), 0); + + /* + * t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1 + * t0 = MUL t0.xyxy t0.xx11 ; x^4, x^3, x^2, x + * t1 = MUL t0.xyyw t0.yz11 ; x^7 x^5 x^3 x + * result = DP4 t1.wzyx, sin_constants + */ + i915_emit_arith(p, + A0_MUL, + tmp, A0_DEST_CHANNEL_XY, 0, + swizzle(tmp, X, X, ONE, ONE), + swizzle(tmp, X, ONE, ONE, ONE), 0); + + i915_emit_arith(p, + A0_MUL, + tmp, A0_DEST_CHANNEL_ALL, 0, + swizzle(tmp, X, Y, X, Y), + swizzle(tmp, X, X, ONE, ONE), 0); + + i915_emit_arith(p, + A0_MUL, + tmp, A0_DEST_CHANNEL_ALL, 0, + swizzle(tmp, X, Y, Y, W), + swizzle(tmp, X, Z, ONE, ONE), 0); + + i915_emit_arith(p, + A0_DP4, + get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_flags(inst), 0, + swizzle(tmp, W, Z, Y, X), + i915_emit_const4fv(p, sin_constants), 0); + break; + + case TGSI_OPCODE_SLT: + emit_simple_arith(p, inst, A0_SLT, 2); + break; + + case TGSI_OPCODE_SGT: + /* like SLT, but swap reg0, reg1 */ + emit_simple_arith_swap2(p, inst, A0_SLT, 2); + break; + + case TGSI_OPCODE_SUB: + src0 = src_vector(p, &inst->FullSrcRegisters[0]); + src1 = src_vector(p, &inst->FullSrcRegisters[1]); + + i915_emit_arith(p, + A0_ADD, + get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_flags(inst), 0, + src0, negate(src1, 1, 1, 1, 1), 0); + break; + + case TGSI_OPCODE_TEX: + emit_tex(p, inst, T0_TEXLD); + break; + + case TGSI_OPCODE_TXB: + emit_tex(p, inst, T0_TEXLDB); + break; + + case TGSI_OPCODE_TXP: + emit_tex(p, inst, T0_TEXLDP); + break; + + case TGSI_OPCODE_XPD: + /* Cross product: + * result.x = src0.y * src1.z - src0.z * src1.y; + * result.y = src0.z * src1.x - src0.x * src1.z; + * result.z = src0.x * src1.y - src0.y * src1.x; + * result.w = undef; + */ + src0 = src_vector(p, &inst->FullSrcRegisters[0]); + src1 = src_vector(p, &inst->FullSrcRegisters[1]); + tmp = i915_get_utemp(p); + + i915_emit_arith(p, + A0_MUL, + tmp, A0_DEST_CHANNEL_ALL, 0, + swizzle(src0, Z, X, Y, ONE), + swizzle(src1, Y, Z, X, ONE), 0); + + i915_emit_arith(p, + A0_MAD, + get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_flags(inst), 0, + swizzle(src0, Y, Z, X, ONE), + swizzle(src1, Z, X, Y, ONE), + negate(tmp, 1, 1, 1, 0)); + break; + + default: + i915_program_error(p, "bad opcode %d", inst->Instruction.Opcode); + p->error = 1; + return; + } + + i915_release_utemps(p); +} + + +/** + * Translate TGSI fragment shader into i915 hardware instructions. + * \param p the translation state + * \param tokens the TGSI token array + */ +static void +i915_translate_instructions(struct i915_fp_compile *p, + const struct tgsi_token *tokens) +{ + struct i915_fragment_shader *ifs = p->shader; + struct tgsi_parse_context parse; + + tgsi_parse_init( &parse, tokens ); + + while( !tgsi_parse_end_of_tokens( &parse ) ) { + + tgsi_parse_token( &parse ); + + switch( parse.FullToken.Token.Type ) { + case TGSI_TOKEN_TYPE_DECLARATION: + if (parse.FullToken.FullDeclaration.Declaration.File + == TGSI_FILE_CONSTANT) { + uint i; + for (i = parse.FullToken.FullDeclaration.DeclarationRange.First; + i <= parse.FullToken.FullDeclaration.DeclarationRange.Last; + i++) { + assert(ifs->constant_flags[i] == 0x0); + ifs->constant_flags[i] = I915_CONSTFLAG_USER; + ifs->num_constants = MAX2(ifs->num_constants, i + 1); + } + } + else if (parse.FullToken.FullDeclaration.Declaration.File + == TGSI_FILE_TEMPORARY) { + uint i; + for (i = parse.FullToken.FullDeclaration.DeclarationRange.First; + i <= parse.FullToken.FullDeclaration.DeclarationRange.Last; + i++) { + assert(i < I915_MAX_TEMPORARY); + /* XXX just use shader->info->file_mask[TGSI_FILE_TEMPORARY] */ + p->temp_flag |= (1 << i); /* mark temp as used */ + } + } + break; + + case TGSI_TOKEN_TYPE_IMMEDIATE: + { + const struct tgsi_full_immediate *imm + = &parse.FullToken.FullImmediate; + const uint pos = p->num_immediates++; + uint j; + assert( imm->Immediate.NrTokens <= 4 + 1 ); + for (j = 0; j < imm->Immediate.NrTokens - 1; j++) { + p->immediates[pos][j] = imm->u[j].Float; + } + } + break; + + case TGSI_TOKEN_TYPE_INSTRUCTION: + if (p->first_instruction) { + /* resolve location of immediates */ + uint i, j; + for (i = 0; i < p->num_immediates; i++) { + /* find constant slot for this immediate */ + for (j = 0; j < I915_MAX_CONSTANT; j++) { + if (ifs->constant_flags[j] == 0x0) { + memcpy(ifs->constants[j], + p->immediates[i], + 4 * sizeof(float)); + /*printf("immediate %d maps to const %d\n", i, j);*/ + ifs->constant_flags[j] = 0xf; /* all four comps used */ + p->immediates_map[i] = j; + ifs->num_constants = MAX2(ifs->num_constants, j + 1); + break; + } + } + } + + p->first_instruction = FALSE; + } + + i915_translate_instruction(p, &parse.FullToken.FullInstruction); + break; + + default: + assert( 0 ); + } + + } /* while */ + + tgsi_parse_free (&parse); +} + + +static struct i915_fp_compile * +i915_init_compile(struct i915_context *i915, + struct i915_fragment_shader *ifs) +{ + struct i915_fp_compile *p = CALLOC_STRUCT(i915_fp_compile); + + p->shader = ifs; + + /* Put new constants at end of const buffer, growing downward. + * The problem is we don't know how many user-defined constants might + * be specified with pipe->set_constant_buffer(). + * Should pre-scan the user's program to determine the highest-numbered + * constant referenced. + */ + ifs->num_constants = 0; + memset(ifs->constant_flags, 0, sizeof(ifs->constant_flags)); + + p->first_instruction = TRUE; + + p->nr_tex_indirect = 1; /* correct? */ + p->nr_tex_insn = 0; + p->nr_alu_insn = 0; + p->nr_decl_insn = 0; + + p->csr = p->program; + p->decl = p->declarations; + p->decl_s = 0; + p->decl_t = 0; + p->temp_flag = ~0x0 << I915_MAX_TEMPORARY; + p->utemp_flag = ~0x7; + + p->wpos_tex = -1; + + /* initialize the first program word */ + *(p->decl++) = _3DSTATE_PIXEL_SHADER_PROGRAM; + + return p; +} + + +/* Copy compile results to the fragment program struct and destroy the + * compilation context. + */ +static void +i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p) +{ + struct i915_fragment_shader *ifs = p->shader; + unsigned long program_size = (unsigned long) (p->csr - p->program); + unsigned long decl_size = (unsigned long) (p->decl - p->declarations); + + if (p->nr_tex_indirect > I915_MAX_TEX_INDIRECT) + i915_program_error(p, "Exceeded max nr indirect texture lookups"); + + if (p->nr_tex_insn > I915_MAX_TEX_INSN) + i915_program_error(p, "Exceeded max TEX instructions"); + + if (p->nr_alu_insn > I915_MAX_ALU_INSN) + i915_program_error(p, "Exceeded max ALU instructions"); + + if (p->nr_decl_insn > I915_MAX_DECL_INSN) + i915_program_error(p, "Exceeded max DECL instructions"); + + if (p->error) { + p->NumNativeInstructions = 0; + p->NumNativeAluInstructions = 0; + p->NumNativeTexInstructions = 0; + p->NumNativeTexIndirections = 0; + + i915_use_passthrough_shader(ifs); + } + else { + p->NumNativeInstructions + = p->nr_alu_insn + p->nr_tex_insn + p->nr_decl_insn; + p->NumNativeAluInstructions = p->nr_alu_insn; + p->NumNativeTexInstructions = p->nr_tex_insn; + p->NumNativeTexIndirections = p->nr_tex_indirect; + + /* patch in the program length */ + p->declarations[0] |= program_size + decl_size - 2; + + /* Copy compilation results to fragment program struct: + */ + assert(!ifs->program); + ifs->program + = (uint *) MALLOC((program_size + decl_size) * sizeof(uint)); + if (ifs->program) { + ifs->program_len = program_size + decl_size; + + memcpy(ifs->program, + p->declarations, + decl_size * sizeof(uint)); + + memcpy(ifs->program + decl_size, + p->program, + program_size * sizeof(uint)); + } + } + + /* Release the compilation struct: + */ + FREE(p); +} + + +/** + * Find an unused texture coordinate slot to use for fragment WPOS. + * Update p->fp->wpos_tex with the result (-1 if no used texcoord slot is found). + */ +static void +i915_find_wpos_space(struct i915_fp_compile *p) +{ +#if 0 + const uint inputs + = p->shader->inputs_read | (1 << TGSI_ATTRIB_POS); /*XXX hack*/ + uint i; + + p->wpos_tex = -1; + + if (inputs & (1 << TGSI_ATTRIB_POS)) { + for (i = 0; i < I915_TEX_UNITS; i++) { + if ((inputs & (1 << (TGSI_ATTRIB_TEX0 + i))) == 0) { + p->wpos_tex = i; + return; + } + } + + i915_program_error(p, "No free texcoord for wpos value"); + } +#else + if (p->shader->info.input_semantic_name[0] == TGSI_SEMANTIC_POSITION) { + /* frag shader using the fragment position input */ +#if 0 + assert(0); +#endif + } +#endif +} + + + + +/** + * Rather than trying to intercept and jiggle depth writes during + * emit, just move the value into its correct position at the end of + * the program: + */ +static void +i915_fixup_depth_write(struct i915_fp_compile *p) +{ + /* XXX assuming pos/depth is always in output[0] */ + if (p->shader->info.output_semantic_name[0] == TGSI_SEMANTIC_POSITION) { + const uint depth = UREG(REG_TYPE_OD, 0); + + i915_emit_arith(p, + A0_MOV, /* opcode */ + depth, /* dest reg */ + A0_DEST_CHANNEL_W, /* write mask */ + 0, /* saturate? */ + swizzle(depth, X, Y, Z, Z), /* src0 */ + 0, 0 /* src1, src2 */); + } +} + + +void +i915_translate_fragment_program( struct i915_context *i915, + struct i915_fragment_shader *fs) +{ + struct i915_fp_compile *p = i915_init_compile(i915, fs); + const struct tgsi_token *tokens = fs->state.tokens; + + i915_find_wpos_space(p); + +#if 0 + tgsi_dump(tokens, 0); +#endif + + i915_translate_instructions(p, tokens); + i915_fixup_depth_write(p); + + i915_fini_compile(i915, p); +} diff --git a/src/gallium/drivers/i915/i915_prim_emit.c b/src/gallium/drivers/i915/i915_prim_emit.c new file mode 100644 index 0000000000..d9a5c40ab9 --- /dev/null +++ b/src/gallium/drivers/i915/i915_prim_emit.c @@ -0,0 +1,219 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#include "draw/draw_pipe.h" +#include "util/u_math.h" +#include "util/u_memory.h" +#include "util/u_pack_color.h" + +#include "i915_context.h" +#include "i915_reg.h" +#include "i915_state.h" +#include "i915_batch.h" + + + +/** + * Primitive emit to hardware. No support for vertex buffers or any + * nice fast paths. + */ +struct setup_stage { + struct draw_stage stage; /**< This must be first (base class) */ + + struct i915_context *i915; +}; + + + +/** + * Basically a cast wrapper. + */ +static INLINE struct setup_stage *setup_stage( struct draw_stage *stage ) +{ + return (struct setup_stage *)stage; +} + + +/** + * Extract the needed fields from vertex_header and emit i915 dwords. + * Recall that the vertices are constructed by the 'draw' module and + * have a couple of slots at the beginning (1-dword header, 4-dword + * clip pos) that we ignore here. + */ +static INLINE void +emit_hw_vertex( struct i915_context *i915, + const struct vertex_header *vertex) +{ + const struct vertex_info *vinfo = &i915->current.vertex_info; + uint i; + uint count = 0; /* for debug/sanity */ + + assert(!i915->dirty); + + for (i = 0; i < vinfo->num_attribs; i++) { + const uint j = vinfo->attrib[i].src_index; + const float *attrib = vertex->data[j]; + switch (vinfo->attrib[i].emit) { + case EMIT_1F: + OUT_BATCH( fui(attrib[0]) ); + count++; + break; + case EMIT_2F: + OUT_BATCH( fui(attrib[0]) ); + OUT_BATCH( fui(attrib[1]) ); + count += 2; + break; + case EMIT_3F: + OUT_BATCH( fui(attrib[0]) ); + OUT_BATCH( fui(attrib[1]) ); + OUT_BATCH( fui(attrib[2]) ); + count += 3; + break; + case EMIT_4F: + OUT_BATCH( fui(attrib[0]) ); + OUT_BATCH( fui(attrib[1]) ); + OUT_BATCH( fui(attrib[2]) ); + OUT_BATCH( fui(attrib[3]) ); + count += 4; + break; + case EMIT_4UB: + OUT_BATCH( pack_ub4(float_to_ubyte( attrib[2] ), + float_to_ubyte( attrib[1] ), + float_to_ubyte( attrib[0] ), + float_to_ubyte( attrib[3] )) ); + count += 1; + break; + default: + assert(0); + } + } + assert(count == vinfo->size); +} + + + +static INLINE void +emit_prim( struct draw_stage *stage, + struct prim_header *prim, + unsigned hwprim, + unsigned nr ) +{ + struct i915_context *i915 = setup_stage(stage)->i915; + unsigned vertex_size; + unsigned i; + + if (i915->dirty) + i915_update_derived( i915 ); + + if (i915->hardware_dirty) + i915_emit_hardware_state( i915 ); + + /* need to do this after validation! */ + vertex_size = i915->current.vertex_info.size * 4; /* in bytes */ + assert(vertex_size >= 12); /* never smaller than 12 bytes */ + + if (!BEGIN_BATCH( 1 + nr * vertex_size / 4, 0 )) { + FLUSH_BATCH(NULL); + + /* Make sure state is re-emitted after a flush: + */ + i915_update_derived( i915 ); + i915_emit_hardware_state( i915 ); + + if (!BEGIN_BATCH( 1 + nr * vertex_size / 4, 0 )) { + assert(0); + return; + } + } + + /* Emit each triangle as a single primitive. I told you this was + * simple. + */ + OUT_BATCH(_3DPRIMITIVE | + hwprim | + ((4 + vertex_size * nr)/4 - 2)); + + for (i = 0; i < nr; i++) + emit_hw_vertex(i915, prim->v[i]); +} + + +static void +setup_tri( struct draw_stage *stage, struct prim_header *prim ) +{ + emit_prim( stage, prim, PRIM3D_TRILIST, 3 ); +} + + +static void +setup_line(struct draw_stage *stage, struct prim_header *prim) +{ + emit_prim( stage, prim, PRIM3D_LINELIST, 2 ); +} + + +static void +setup_point(struct draw_stage *stage, struct prim_header *prim) +{ + emit_prim( stage, prim, PRIM3D_POINTLIST, 1 ); +} + + +static void setup_flush( struct draw_stage *stage, unsigned flags ) +{ +} + +static void reset_stipple_counter( struct draw_stage *stage ) +{ +} + +static void render_destroy( struct draw_stage *stage ) +{ + FREE( stage ); +} + + +/** + * Create a new primitive setup/render stage. This gets plugged into + * the 'draw' module's pipeline. + */ +struct draw_stage *i915_draw_render_stage( struct i915_context *i915 ) +{ + struct setup_stage *setup = CALLOC_STRUCT(setup_stage); + + setup->i915 = i915; + setup->stage.draw = i915->draw; + setup->stage.point = setup_point; + setup->stage.line = setup_line; + setup->stage.tri = setup_tri; + setup->stage.flush = setup_flush; + setup->stage.reset_stipple_counter = reset_stipple_counter; + setup->stage.destroy = render_destroy; + + return &setup->stage; +} diff --git a/src/gallium/drivers/i915/i915_prim_vbuf.c b/src/gallium/drivers/i915/i915_prim_vbuf.c new file mode 100644 index 0000000000..8a3e466c84 --- /dev/null +++ b/src/gallium/drivers/i915/i915_prim_vbuf.c @@ -0,0 +1,645 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * 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. + * + **************************************************************************/ + +/** + * \file + * Build post-transformation, post-clipping vertex buffers and element + * lists by hooking into the end of the primitive pipeline and + * manipulating the vertex_id field in the vertex headers. + * + * XXX: work in progress + * + * \author José Fonseca + * \author Keith Whitwell + */ + + +#include "draw/draw_context.h" +#include "draw/draw_vbuf.h" +#include "util/u_debug.h" +#include "pipe/p_inlines.h" +#include "util/u_math.h" +#include "util/u_memory.h" +#include "util/u_fifo.h" + +#include "i915_context.h" +#include "i915_reg.h" +#include "i915_batch.h" +#include "i915_state.h" + + +/** + * Primitive renderer for i915. + */ +struct i915_vbuf_render { + struct vbuf_render base; + + struct i915_context *i915; + + /** Vertex size in bytes */ + size_t vertex_size; + + /** Software primitive */ + unsigned prim; + + /** Hardware primitive */ + unsigned hwprim; + + /** Genereate a vertex list */ + unsigned fallback; + + /* Stuff for the vbo */ + struct intel_buffer *vbo; + size_t vbo_size; + size_t vbo_offset; + void *vbo_ptr; + size_t vbo_max_used; + + /* stuff for the pool */ + struct util_fifo *pool_fifo; + unsigned pool_used; + unsigned pool_buffer_size; + boolean pool_not_used; +}; + + +/** + * Basically a cast wrapper. + */ +static INLINE struct i915_vbuf_render * +i915_vbuf_render(struct vbuf_render *render) +{ + assert(render); + return (struct i915_vbuf_render *)render; +} + +static const struct vertex_info * +i915_vbuf_render_get_vertex_info(struct vbuf_render *render) +{ + struct i915_vbuf_render *i915_render = i915_vbuf_render(render); + struct i915_context *i915 = i915_render->i915; + + if (i915->dirty) { + /* make sure we have up to date vertex layout */ + i915_update_derived(i915); + } + + return &i915->current.vertex_info; +} + +static boolean +i915_vbuf_render_reserve(struct i915_vbuf_render *i915_render, size_t size) +{ + struct i915_context *i915 = i915_render->i915; + + if (i915_render->vbo_size < size + i915_render->vbo_offset) + return FALSE; + + if (i915->vbo_flushed) + return FALSE; + + return TRUE; +} + +static void +i915_vbuf_render_new_buf(struct i915_vbuf_render *i915_render, size_t size) +{ + struct i915_context *i915 = i915_render->i915; + struct intel_winsys *iws = i915->iws; + + if (i915_render->vbo) { + if (i915_render->pool_not_used) + iws->buffer_destroy(iws, i915_render->vbo); + else + u_fifo_add(i915_render->pool_fifo, i915_render->vbo); + i915_render->vbo = NULL; + } + + i915->vbo_flushed = 0; + + i915_render->vbo_size = MAX2(size, i915_render->pool_buffer_size); + i915_render->vbo_offset = 0; + + if (i915_render->vbo_size != i915_render->pool_buffer_size) { + i915_render->pool_not_used = TRUE; + i915_render->vbo = iws->buffer_create(iws, i915_render->vbo_size, 64, + INTEL_NEW_VERTEX); + } else { + i915_render->pool_not_used = FALSE; + + if (i915_render->pool_used >= 2) { + FLUSH_BATCH(NULL); + i915->vbo_flushed = 0; + i915_render->pool_used = 0; + } + u_fifo_pop(i915_render->pool_fifo, (void**)&i915_render->vbo); + } +} + +static boolean +i915_vbuf_render_allocate_vertices(struct vbuf_render *render, + ushort vertex_size, + ushort nr_vertices) +{ + struct i915_vbuf_render *i915_render = i915_vbuf_render(render); + struct i915_context *i915 = i915_render->i915; + size_t size = (size_t)vertex_size * (size_t)nr_vertices; + + /* FIXME: handle failure */ + assert(!i915->vbo); + + if (!i915_vbuf_render_reserve(i915_render, size)) { + + if (i915->vbo_flushed) + i915_render->pool_used = 0; + + i915_vbuf_render_new_buf(i915_render, size); + } + + i915_render->vertex_size = vertex_size; + i915->vbo = i915_render->vbo; + i915->vbo_offset = i915_render->vbo_offset; + i915->dirty |= I915_NEW_VBO; + + if (!i915_render->vbo) + return FALSE; + return TRUE; +} + +static void * +i915_vbuf_render_map_vertices(struct vbuf_render *render) +{ + struct i915_vbuf_render *i915_render = i915_vbuf_render(render); + struct i915_context *i915 = i915_render->i915; + struct intel_winsys *iws = i915->iws; + + if (i915->vbo_flushed) + debug_printf("%s bad vbo flush occured stalling on hw\n", __FUNCTION__); + + i915_render->vbo_ptr = iws->buffer_map(iws, i915_render->vbo, TRUE); + + return (unsigned char *)i915_render->vbo_ptr + i915->vbo_offset; +} + +static void +i915_vbuf_render_unmap_vertices(struct vbuf_render *render, + ushort min_index, + ushort max_index) +{ + struct i915_vbuf_render *i915_render = i915_vbuf_render(render); + struct i915_context *i915 = i915_render->i915; + struct intel_winsys *iws = i915->iws; + + i915_render->vbo_max_used = MAX2(i915_render->vbo_max_used, i915_render->vertex_size * (max_index + 1)); + iws->buffer_unmap(iws, i915_render->vbo); +} + +static boolean +i915_vbuf_render_set_primitive(struct vbuf_render *render, + unsigned prim) +{ + struct i915_vbuf_render *i915_render = i915_vbuf_render(render); + i915_render->prim = prim; + + switch(prim) { + case PIPE_PRIM_POINTS: + i915_render->hwprim = PRIM3D_POINTLIST; + i915_render->fallback = 0; + return TRUE; + case PIPE_PRIM_LINES: + i915_render->hwprim = PRIM3D_LINELIST; + i915_render->fallback = 0; + return TRUE; + case PIPE_PRIM_LINE_LOOP: + i915_render->hwprim = PRIM3D_LINELIST; + i915_render->fallback = PIPE_PRIM_LINE_LOOP; + return TRUE; + case PIPE_PRIM_LINE_STRIP: + i915_render->hwprim = PRIM3D_LINESTRIP; + i915_render->fallback = 0; + return TRUE; + case PIPE_PRIM_TRIANGLES: + i915_render->hwprim = PRIM3D_TRILIST; + i915_render->fallback = 0; + return TRUE; + case PIPE_PRIM_TRIANGLE_STRIP: + i915_render->hwprim = PRIM3D_TRISTRIP; + i915_render->fallback = 0; + return TRUE; + case PIPE_PRIM_TRIANGLE_FAN: + i915_render->hwprim = PRIM3D_TRIFAN; + i915_render->fallback = 0; + return TRUE; + case PIPE_PRIM_QUADS: + i915_render->hwprim = PRIM3D_TRILIST; + i915_render->fallback = PIPE_PRIM_QUADS; + return TRUE; + case PIPE_PRIM_QUAD_STRIP: + i915_render->hwprim = PRIM3D_TRILIST; + i915_render->fallback = PIPE_PRIM_QUAD_STRIP; + return TRUE; + case PIPE_PRIM_POLYGON: + i915_render->hwprim = PRIM3D_POLY; + i915_render->fallback = 0; + return TRUE; + default: + /* FIXME: Actually, can handle a lot more just fine... */ + return FALSE; + } +} + +/** + * Used for fallbacks in draw_arrays + */ +static void +draw_arrays_generate_indices(struct vbuf_render *render, + unsigned start, uint nr, + unsigned type) +{ + struct i915_vbuf_render *i915_render = i915_vbuf_render(render); + struct i915_context *i915 = i915_render->i915; + unsigned i; + unsigned end = start + nr; + switch(type) { + case 0: + for (i = start; i+1 < end; i += 2) + OUT_BATCH((i+0) | (i+1) << 16); + if (i < end) + OUT_BATCH(i); + break; + case PIPE_PRIM_LINE_LOOP: + if (nr >= 2) { + for (i = start + 1; i < end; i++) + OUT_BATCH((i-0) | (i+0) << 16); + OUT_BATCH((i-0) | ( start) << 16); + } + break; + case PIPE_PRIM_QUADS: + for (i = start; i + 3 < end; i += 4) { + OUT_BATCH((i+0) | (i+1) << 16); + OUT_BATCH((i+3) | (i+1) << 16); + OUT_BATCH((i+2) | (i+3) << 16); + } + break; + case PIPE_PRIM_QUAD_STRIP: + for (i = start; i + 3 < end; i += 2) { + OUT_BATCH((i+0) | (i+1) << 16); + OUT_BATCH((i+3) | (i+2) << 16); + OUT_BATCH((i+0) | (i+3) << 16); + } + break; + default: + assert(0); + } +} + +static unsigned +draw_arrays_calc_nr_indices(uint nr, unsigned type) +{ + switch (type) { + case 0: + return nr; + case PIPE_PRIM_LINE_LOOP: + if (nr >= 2) + return nr * 2; + else + return 0; + case PIPE_PRIM_QUADS: + return (nr / 4) * 6; + case PIPE_PRIM_QUAD_STRIP: + return ((nr - 2) / 2) * 6; + default: + assert(0); + return 0; + } +} + +static void +draw_arrays_fallback(struct vbuf_render *render, + unsigned start, + uint nr) +{ + struct i915_vbuf_render *i915_render = i915_vbuf_render(render); + struct i915_context *i915 = i915_render->i915; + unsigned nr_indices; + + if (i915->dirty) + i915_update_derived(i915); + + if (i915->hardware_dirty) + i915_emit_hardware_state(i915); + + nr_indices = draw_arrays_calc_nr_indices(nr, i915_render->fallback); + if (!nr_indices) + return; + + if (!BEGIN_BATCH(1 + (nr_indices + 1)/2, 1)) { + FLUSH_BATCH(NULL); + + /* Make sure state is re-emitted after a flush: + */ + i915_update_derived(i915); + i915_emit_hardware_state(i915); + i915->vbo_flushed = 1; + + if (!BEGIN_BATCH(1 + (nr_indices + 1)/2, 1)) { + assert(0); + goto out; + } + } + OUT_BATCH(_3DPRIMITIVE | + PRIM_INDIRECT | + i915_render->hwprim | + PRIM_INDIRECT_ELTS | + nr_indices); + + draw_arrays_generate_indices(render, start, nr, i915_render->fallback); + +out: + return; +} + +static void +i915_vbuf_render_draw_arrays(struct vbuf_render *render, + unsigned start, + uint nr) +{ + struct i915_vbuf_render *i915_render = i915_vbuf_render(render); + struct i915_context *i915 = i915_render->i915; + + if (i915_render->fallback) { + draw_arrays_fallback(render, start, nr); + return; + } + + if (i915->dirty) + i915_update_derived(i915); + + if (i915->hardware_dirty) + i915_emit_hardware_state(i915); + + if (!BEGIN_BATCH(2, 0)) { + FLUSH_BATCH(NULL); + + /* Make sure state is re-emitted after a flush: + */ + i915_update_derived(i915); + i915_emit_hardware_state(i915); + i915->vbo_flushed = 1; + + if (!BEGIN_BATCH(2, 0)) { + assert(0); + goto out; + } + } + + OUT_BATCH(_3DPRIMITIVE | + PRIM_INDIRECT | + PRIM_INDIRECT_SEQUENTIAL | + i915_render->hwprim | + nr); + OUT_BATCH(start); /* Beginning vertex index */ + +out: + return; +} + +/** + * Used for normal and fallback emitting of indices + * If type is zero normal operation assumed. + */ +static void +draw_generate_indices(struct vbuf_render *render, + const ushort *indices, + uint nr_indices, + unsigned type) +{ + struct i915_vbuf_render *i915_render = i915_vbuf_render(render); + struct i915_context *i915 = i915_render->i915; + unsigned i; + + switch(type) { + case 0: + for (i = 0; i + 1 < nr_indices; i += 2) { + OUT_BATCH(indices[i] | indices[i+1] << 16); + } + if (i < nr_indices) { + OUT_BATCH(indices[i]); + } + break; + case PIPE_PRIM_LINE_LOOP: + if (nr_indices >= 2) { + for (i = 1; i < nr_indices; i++) + OUT_BATCH(indices[i-1] | indices[i] << 16); + OUT_BATCH(indices[i-1] | indices[0] << 16); + } + break; + case PIPE_PRIM_QUADS: + for (i = 0; i + 3 < nr_indices; i += 4) { + OUT_BATCH(indices[i+0] | indices[i+1] << 16); + OUT_BATCH(indices[i+3] | indices[i+1] << 16); + OUT_BATCH(indices[i+2] | indices[i+3] << 16); + } + break; + case PIPE_PRIM_QUAD_STRIP: + for (i = 0; i + 3 < nr_indices; i += 2) { + OUT_BATCH(indices[i+0] | indices[i+1] << 16); + OUT_BATCH(indices[i+3] | indices[i+2] << 16); + OUT_BATCH(indices[i+0] | indices[i+3] << 16); + } + break; + default: + assert(0); + break; + } +} + +static unsigned +draw_calc_nr_indices(uint nr_indices, unsigned type) +{ + switch (type) { + case 0: + return nr_indices; + case PIPE_PRIM_LINE_LOOP: + if (nr_indices >= 2) + return nr_indices * 2; + else + return 0; + case PIPE_PRIM_QUADS: + return (nr_indices / 4) * 6; + case PIPE_PRIM_QUAD_STRIP: + return ((nr_indices - 2) / 2) * 6; + default: + assert(0); + return 0; + } +} + +static void +i915_vbuf_render_draw(struct vbuf_render *render, + const ushort *indices, + uint nr_indices) +{ + struct i915_vbuf_render *i915_render = i915_vbuf_render(render); + struct i915_context *i915 = i915_render->i915; + unsigned save_nr_indices; + + save_nr_indices = nr_indices; + + nr_indices = draw_calc_nr_indices(nr_indices, i915_render->fallback); + if (!nr_indices) + return; + + if (i915->dirty) + i915_update_derived(i915); + + if (i915->hardware_dirty) + i915_emit_hardware_state(i915); + + if (!BEGIN_BATCH(1 + (nr_indices + 1)/2, 1)) { + FLUSH_BATCH(NULL); + + /* Make sure state is re-emitted after a flush: + */ + i915_update_derived(i915); + i915_emit_hardware_state(i915); + i915->vbo_flushed = 1; + + if (!BEGIN_BATCH(1 + (nr_indices + 1)/2, 1)) { + assert(0); + goto out; + } + } + + OUT_BATCH(_3DPRIMITIVE | + PRIM_INDIRECT | + i915_render->hwprim | + PRIM_INDIRECT_ELTS | + nr_indices); + draw_generate_indices(render, + indices, + save_nr_indices, + i915_render->fallback); + +out: + return; +} + +static void +i915_vbuf_render_release_vertices(struct vbuf_render *render) +{ + struct i915_vbuf_render *i915_render = i915_vbuf_render(render); + struct i915_context *i915 = i915_render->i915; + + assert(i915->vbo); + + i915_render->vbo_offset += i915_render->vbo_max_used; + i915_render->vbo_max_used = 0; + i915->vbo = NULL; + i915->dirty |= I915_NEW_VBO; +} + +static void +i915_vbuf_render_destroy(struct vbuf_render *render) +{ + struct i915_vbuf_render *i915_render = i915_vbuf_render(render); + FREE(i915_render); +} + +/** + * Create a new primitive render. + */ +static struct vbuf_render * +i915_vbuf_render_create(struct i915_context *i915) +{ + struct i915_vbuf_render *i915_render = CALLOC_STRUCT(i915_vbuf_render); + struct intel_winsys *iws = i915->iws; + int i; + + i915_render->i915 = i915; + + i915_render->base.max_vertex_buffer_bytes = 128*1024; + + /* NOTE: it must be such that state and vertices indices fit in a single + * batch buffer. + */ + i915_render->base.max_indices = 16*1024; + + i915_render->base.get_vertex_info = i915_vbuf_render_get_vertex_info; + i915_render->base.allocate_vertices = i915_vbuf_render_allocate_vertices; + i915_render->base.map_vertices = i915_vbuf_render_map_vertices; + i915_render->base.unmap_vertices = i915_vbuf_render_unmap_vertices; + i915_render->base.set_primitive = i915_vbuf_render_set_primitive; + i915_render->base.draw = i915_vbuf_render_draw; + i915_render->base.draw_arrays = i915_vbuf_render_draw_arrays; + i915_render->base.release_vertices = i915_vbuf_render_release_vertices; + i915_render->base.destroy = i915_vbuf_render_destroy; + + + i915_render->vbo = NULL; + i915_render->vbo_size = 0; + i915_render->vbo_offset = 0; + + i915_render->pool_used = FALSE; + i915_render->pool_buffer_size = 128 * 4096; + i915_render->pool_fifo = u_fifo_create(6); + for (i = 0; i < 6; i++) + u_fifo_add(i915_render->pool_fifo, + iws->buffer_create(iws, i915_render->pool_buffer_size, 64, + INTEL_NEW_VERTEX)); + +#if 0 + /* TODO JB: is this realy needed? */ + i915_render->vbo_ptr = iws->buffer_map(iws, i915_render->vbo, TRUE); + iws->buffer_unmap(iws, i915_render->vbo); +#endif + + return &i915_render->base; +} + +/** + * Create a new primitive vbuf/render stage. + */ +struct draw_stage *i915_draw_vbuf_stage(struct i915_context *i915) +{ + struct vbuf_render *render; + struct draw_stage *stage; + + render = i915_vbuf_render_create(i915); + if(!render) + return NULL; + + stage = draw_vbuf_stage(i915->draw, render); + if(!stage) { + render->destroy(render); + return NULL; + } + /** TODO JB: this shouldn't be here */ + draw_set_render(i915->draw, render); + + return stage; +} diff --git a/src/gallium/drivers/i915/i915_reg.h b/src/gallium/drivers/i915/i915_reg.h new file mode 100644 index 0000000000..04620fec68 --- /dev/null +++ b/src/gallium/drivers/i915/i915_reg.h @@ -0,0 +1,978 @@ +/************************************************************************** + * + * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#ifndef I915_REG_H +#define I915_REG_H + + +#define I915_SET_FIELD( var, mask, value ) (var &= ~(mask), var |= value) + +#define CMD_3D (0x3<<29) + +#define PRIM3D_INLINE (CMD_3D | (0x1f<<24)) +#define PRIM3D_TRILIST (0x0<<18) +#define PRIM3D_TRISTRIP (0x1<<18) +#define PRIM3D_TRISTRIP_RVRSE (0x2<<18) +#define PRIM3D_TRIFAN (0x3<<18) +#define PRIM3D_POLY (0x4<<18) +#define PRIM3D_LINELIST (0x5<<18) +#define PRIM3D_LINESTRIP (0x6<<18) +#define PRIM3D_RECTLIST (0x7<<18) +#define PRIM3D_POINTLIST (0x8<<18) +#define PRIM3D_DIB (0x9<<18) +#define PRIM3D_CLEAR_RECT (0xa<<18) +#define PRIM3D_ZONE_INIT (0xd<<18) +#define PRIM3D_MASK (0x1f<<18) + +/* p137 */ +#define _3DSTATE_AA_CMD (CMD_3D | (0x06<<24)) +#define AA_LINE_ECAAR_WIDTH_ENABLE (1<<16) +#define AA_LINE_ECAAR_WIDTH_0_5 0 +#define AA_LINE_ECAAR_WIDTH_1_0 (1<<14) +#define AA_LINE_ECAAR_WIDTH_2_0 (2<<14) +#define AA_LINE_ECAAR_WIDTH_4_0 (3<<14) +#define AA_LINE_REGION_WIDTH_ENABLE (1<<8) +#define AA_LINE_REGION_WIDTH_0_5 0 +#define AA_LINE_REGION_WIDTH_1_0 (1<<6) +#define AA_LINE_REGION_WIDTH_2_0 (2<<6) +#define AA_LINE_REGION_WIDTH_4_0 (3<<6) + +/* 3DSTATE_BACKFACE_STENCIL_OPS, p138*/ +#define _3DSTATE_BACKFACE_STENCIL_OPS (CMD_3D | (0x8<<24)) +#define BFO_ENABLE_STENCIL_REF (1<<23) +#define BFO_STENCIL_REF_SHIFT 15 +#define BFO_STENCIL_REF_MASK (0xff<<15) +#define BFO_ENABLE_STENCIL_FUNCS (1<<14) +#define BFO_STENCIL_TEST_SHIFT 11 +#define BFO_STENCIL_TEST_MASK (0x7<<11) +#define BFO_STENCIL_FAIL_SHIFT 8 +#define BFO_STENCIL_FAIL_MASK (0x7<<8) +#define BFO_STENCIL_PASS_Z_FAIL_SHIFT 5 +#define BFO_STENCIL_PASS_Z_FAIL_MASK (0x7<<5) +#define BFO_STENCIL_PASS_Z_PASS_SHIFT 2 +#define BFO_STENCIL_PASS_Z_PASS_MASK (0x7<<2) +#define BFO_ENABLE_STENCIL_TWO_SIDE (1<<1) +#define BFO_STENCIL_TWO_SIDE (1<<0) + + +/* 3DSTATE_BACKFACE_STENCIL_MASKS, p140 */ +#define _3DSTATE_BACKFACE_STENCIL_MASKS (CMD_3D | (0x9<<24)) +#define BFM_ENABLE_STENCIL_TEST_MASK (1<<17) +#define BFM_ENABLE_STENCIL_WRITE_MASK (1<<16) +#define BFM_STENCIL_TEST_MASK_SHIFT 8 +#define BFM_STENCIL_TEST_MASK_MASK (0xff<<8) +#define BFM_STENCIL_WRITE_MASK_SHIFT 0 +#define BFM_STENCIL_WRITE_MASK_MASK (0xff<<0) + + + +/* 3DSTATE_BIN_CONTROL p141 */ + +/* p143 */ +#define _3DSTATE_BUF_INFO_CMD (CMD_3D | (0x1d<<24) | (0x8e<<16) | 1) +/* Dword 1 */ +#define BUF_3D_ID_COLOR_BACK (0x3<<24) +#define BUF_3D_ID_DEPTH (0x7<<24) +#define BUF_3D_USE_FENCE (1<<23) +#define BUF_3D_TILED_SURFACE (1<<22) +#define BUF_3D_TILE_WALK_X 0 +#define BUF_3D_TILE_WALK_Y (1<<21) +#define BUF_3D_PITCH(x) (((x)/4)<<2) +/* Dword 2 */ +#define BUF_3D_ADDR(x) ((x) & ~0x3) + + +/* 3DSTATE_CHROMA_KEY */ + +/* 3DSTATE_CLEAR_PARAMETERS, p150 */ +#define _3DSTATE_CLEAR_PARAMETERS (CMD_3D | (0x1d<<24) | (0x9c<<16) | 5) +/* Dword 1 */ +#define CLEARPARAM_CLEAR_RECT (1 << 16) +#define CLEARPARAM_ZONE_INIT (0 << 16) +#define CLEARPARAM_WRITE_COLOR (1 << 2) +#define CLEARPARAM_WRITE_DEPTH (1 << 1) +#define CLEARPARAM_WRITE_STENCIL (1 << 0) + +/* 3DSTATE_CONSTANT_BLEND_COLOR, p153 */ +#define _3DSTATE_CONST_BLEND_COLOR_CMD (CMD_3D | (0x1d<<24) | (0x88<<16)) + + + +/* 3DSTATE_COORD_SET_BINDINGS, p154 */ +#define _3DSTATE_COORD_SET_BINDINGS (CMD_3D | (0x16<<24)) +#define CSB_TCB(iunit, eunit) ((eunit)<<(iunit*3)) + +/* p156 */ +#define _3DSTATE_DFLT_DIFFUSE_CMD (CMD_3D | (0x1d<<24) | (0x99<<16)) + +/* p157 */ +#define _3DSTATE_DFLT_SPEC_CMD (CMD_3D | (0x1d<<24) | (0x9a<<16)) + +/* p158 */ +#define _3DSTATE_DFLT_Z_CMD (CMD_3D | (0x1d<<24) | (0x98<<16)) + + +/* 3DSTATE_DEPTH_OFFSET_SCALE, p159 */ +#define _3DSTATE_DEPTH_OFFSET_SCALE (CMD_3D | (0x1d<<24) | (0x97<<16)) +/* scale in dword 1 */ + + +/* 3DSTATE_DEPTH_SUBRECT_DISABLE, p160 */ +#define _3DSTATE_DEPTH_SUBRECT_DISABLE (CMD_3D | (0x1c<<24) | (0x11<<19) | 0x2) + +/* p161 */ +#define _3DSTATE_DST_BUF_VARS_CMD (CMD_3D | (0x1d<<24) | (0x85<<16)) +/* Dword 1 */ +#define TEX_DEFAULT_COLOR_OGL (0<<30) +#define TEX_DEFAULT_COLOR_D3D (1<<30) +#define ZR_EARLY_DEPTH (1<<29) +#define LOD_PRECLAMP_OGL (1<<28) +#define LOD_PRECLAMP_D3D (0<<28) +#define DITHER_FULL_ALWAYS (0<<26) +#define DITHER_FULL_ON_FB_BLEND (1<<26) +#define DITHER_CLAMPED_ALWAYS (2<<26) +#define LINEAR_GAMMA_BLEND_32BPP (1<<25) +#define DEBUG_DISABLE_ENH_DITHER (1<<24) +#define DSTORG_HORT_BIAS(x) ((x)<<20) +#define DSTORG_VERT_BIAS(x) ((x)<<16) +#define COLOR_4_2_2_CHNL_WRT_ALL 0 +#define COLOR_4_2_2_CHNL_WRT_Y (1<<12) +#define COLOR_4_2_2_CHNL_WRT_CR (2<<12) +#define COLOR_4_2_2_CHNL_WRT_CB (3<<12) +#define COLOR_4_2_2_CHNL_WRT_CRCB (4<<12) +#define COLOR_BUF_8BIT 0 +#define COLOR_BUF_RGB555 (1<<8) +#define COLOR_BUF_RGB565 (2<<8) +#define COLOR_BUF_ARGB8888 (3<<8) +#define DEPTH_FRMT_16_FIXED 0 +#define DEPTH_FRMT_16_FLOAT (1<<2) +#define DEPTH_FRMT_24_FIXED_8_OTHER (2<<2) +#define VERT_LINE_STRIDE_1 (1<<1) +#define VERT_LINE_STRIDE_0 (0<<1) +#define VERT_LINE_STRIDE_OFS_1 1 +#define VERT_LINE_STRIDE_OFS_0 0 + +/* p166 */ +#define _3DSTATE_DRAW_RECT_CMD (CMD_3D|(0x1d<<24)|(0x80<<16)|3) +/* Dword 1 */ +#define DRAW_RECT_DIS_DEPTH_OFS (1<<30) +#define DRAW_DITHER_OFS_X(x) ((x)<<26) +#define DRAW_DITHER_OFS_Y(x) ((x)<<24) +/* Dword 2 */ +#define DRAW_YMIN(x) ((x)<<16) +#define DRAW_XMIN(x) (x) +/* Dword 3 */ +#define DRAW_YMAX(x) ((x)<<16) +#define DRAW_XMAX(x) (x) +/* Dword 4 */ +#define DRAW_YORG(x) ((x)<<16) +#define DRAW_XORG(x) (x) + + +/* 3DSTATE_FILTER_COEFFICIENTS_4X4, p170 */ + +/* 3DSTATE_FILTER_COEFFICIENTS_6X5, p172 */ + + +/* _3DSTATE_FOG_COLOR, p173 */ +#define _3DSTATE_FOG_COLOR_CMD (CMD_3D|(0x15<<24)) +#define FOG_COLOR_RED(x) ((x)<<16) +#define FOG_COLOR_GREEN(x) ((x)<<8) +#define FOG_COLOR_BLUE(x) (x) + +/* _3DSTATE_FOG_MODE, p174 */ +#define _3DSTATE_FOG_MODE_CMD (CMD_3D|(0x1d<<24)|(0x89<<16)|2) +/* Dword 1 */ +#define FMC1_FOGFUNC_MODIFY_ENABLE (1<<31) +#define FMC1_FOGFUNC_VERTEX (0<<28) +#define FMC1_FOGFUNC_PIXEL_EXP (1<<28) +#define FMC1_FOGFUNC_PIXEL_EXP2 (2<<28) +#define FMC1_FOGFUNC_PIXEL_LINEAR (3<<28) +#define FMC1_FOGFUNC_MASK (3<<28) +#define FMC1_FOGINDEX_MODIFY_ENABLE (1<<27) +#define FMC1_FOGINDEX_Z (0<<25) +#define FMC1_FOGINDEX_W (1<<25) +#define FMC1_C1_C2_MODIFY_ENABLE (1<<24) +#define FMC1_DENSITY_MODIFY_ENABLE (1<<23) +#define FMC1_C1_ONE (1<<13) +#define FMC1_C1_MASK (0xffff<<4) +/* Dword 2 */ +#define FMC2_C2_ONE (1<<16) +/* Dword 3 */ +#define FMC3_D_ONE (1<<16) + + + +/* _3DSTATE_INDEPENDENT_ALPHA_BLEND, p177 */ +#define _3DSTATE_INDEPENDENT_ALPHA_BLEND_CMD (CMD_3D|(0x0b<<24)) +#define IAB_MODIFY_ENABLE (1<<23) +#define IAB_ENABLE (1<<22) +#define IAB_MODIFY_FUNC (1<<21) +#define IAB_FUNC_SHIFT 16 +#define IAB_MODIFY_SRC_FACTOR (1<<11) +#define IAB_SRC_FACTOR_SHIFT 6 +#define IAB_SRC_FACTOR_MASK (BLENDFACT_MASK<<6) +#define IAB_MODIFY_DST_FACTOR (1<<5) +#define IAB_DST_FACTOR_SHIFT 0 +#define IAB_DST_FACTOR_MASK (BLENDFACT_MASK<<0) + + +#define BLENDFUNC_ADD 0x0 +#define BLENDFUNC_SUBTRACT 0x1 +#define BLENDFUNC_REVERSE_SUBTRACT 0x2 +#define BLENDFUNC_MIN 0x3 +#define BLENDFUNC_MAX 0x4 +#define BLENDFUNC_MASK 0x7 + +/* 3DSTATE_LOAD_INDIRECT, p180 */ + +#define _3DSTATE_LOAD_INDIRECT (CMD_3D|(0x1d<<24)|(0x7<<16)) +#define LI0_STATE_STATIC_INDIRECT (0x01<<8) +#define LI0_STATE_DYNAMIC_INDIRECT (0x02<<8) +#define LI0_STATE_SAMPLER (0x04<<8) +#define LI0_STATE_MAP (0x08<<8) +#define LI0_STATE_PROGRAM (0x10<<8) +#define LI0_STATE_CONSTANTS (0x20<<8) + +#define SIS0_BUFFER_ADDRESS(x) ((x)&~0x3) +#define SIS0_FORCE_LOAD (1<<1) +#define SIS0_BUFFER_VALID (1<<0) +#define SIS1_BUFFER_LENGTH(x) ((x)&0xff) + +#define DIS0_BUFFER_ADDRESS(x) ((x)&~0x3) +#define DIS0_BUFFER_RESET (1<<1) +#define DIS0_BUFFER_VALID (1<<0) + +#define SSB0_BUFFER_ADDRESS(x) ((x)&~0x3) +#define SSB0_FORCE_LOAD (1<<1) +#define SSB0_BUFFER_VALID (1<<0) +#define SSB1_BUFFER_LENGTH(x) ((x)&0xff) + +#define MSB0_BUFFER_ADDRESS(x) ((x)&~0x3) +#define MSB0_FORCE_LOAD (1<<1) +#define MSB0_BUFFER_VALID (1<<0) +#define MSB1_BUFFER_LENGTH(x) ((x)&0xff) + +#define PSP0_BUFFER_ADDRESS(x) ((x)&~0x3) +#define PSP0_FORCE_LOAD (1<<1) +#define PSP0_BUFFER_VALID (1<<0) +#define PSP1_BUFFER_LENGTH(x) ((x)&0xff) + +#define PSC0_BUFFER_ADDRESS(x) ((x)&~0x3) +#define PSC0_FORCE_LOAD (1<<1) +#define PSC0_BUFFER_VALID (1<<0) +#define PSC1_BUFFER_LENGTH(x) ((x)&0xff) + + + + + +/* _3DSTATE_RASTERIZATION_RULES */ +#define _3DSTATE_RASTER_RULES_CMD (CMD_3D|(0x07<<24)) +#define ENABLE_POINT_RASTER_RULE (1<<15) +#define OGL_POINT_RASTER_RULE (1<<13) +#define ENABLE_TEXKILL_3D_4D (1<<10) +#define TEXKILL_3D (0<<9) +#define TEXKILL_4D (1<<9) +#define ENABLE_LINE_STRIP_PROVOKE_VRTX (1<<8) +#define ENABLE_TRI_FAN_PROVOKE_VRTX (1<<5) +#define LINE_STRIP_PROVOKE_VRTX(x) ((x)<<6) +#define TRI_FAN_PROVOKE_VRTX(x) ((x)<<3) + +/* _3DSTATE_SCISSOR_ENABLE, p256 */ +#define _3DSTATE_SCISSOR_ENABLE_CMD (CMD_3D|(0x1c<<24)|(0x10<<19)) +#define ENABLE_SCISSOR_RECT ((1<<1) | 1) +#define DISABLE_SCISSOR_RECT (1<<1) + +/* _3DSTATE_SCISSOR_RECTANGLE_0, p257 */ +#define _3DSTATE_SCISSOR_RECT_0_CMD (CMD_3D|(0x1d<<24)|(0x81<<16)|1) +/* Dword 1 */ +#define SCISSOR_RECT_0_YMIN(x) ((x)<<16) +#define SCISSOR_RECT_0_XMIN(x) (x) +/* Dword 2 */ +#define SCISSOR_RECT_0_YMAX(x) ((x)<<16) +#define SCISSOR_RECT_0_XMAX(x) (x) + +/* p189 */ +#define _3DSTATE_LOAD_STATE_IMMEDIATE_1 ((0x3<<29)|(0x1d<<24)|(0x04<<16)) +#define I1_LOAD_S(n) (1<<(4+n)) + +#define S0_VB_OFFSET_MASK 0xffffffc +#define S0_AUTO_CACHE_INV_DISABLE (1<<0) + +#define S1_VERTEX_WIDTH_SHIFT 24 +#define S1_VERTEX_WIDTH_MASK (0x3f<<24) +#define S1_VERTEX_PITCH_SHIFT 16 +#define S1_VERTEX_PITCH_MASK (0x3f<<16) + +#define TEXCOORDFMT_2D 0x0 +#define TEXCOORDFMT_3D 0x1 +#define TEXCOORDFMT_4D 0x2 +#define TEXCOORDFMT_1D 0x3 +#define TEXCOORDFMT_2D_16 0x4 +#define TEXCOORDFMT_4D_16 0x5 +#define TEXCOORDFMT_NOT_PRESENT 0xf +#define S2_TEXCOORD_FMT0_MASK 0xf +#define S2_TEXCOORD_FMT1_SHIFT 4 +#define S2_TEXCOORD_FMT(unit, type) ((type)<<(unit*4)) +#define S2_TEXCOORD_NONE (~0) + +/* S3 not interesting */ + +#define S4_POINT_WIDTH_SHIFT 23 +#define S4_POINT_WIDTH_MASK (0x1ff<<23) +#define S4_LINE_WIDTH_SHIFT 19 +#define S4_LINE_WIDTH_ONE (0x2<<19) +#define S4_LINE_WIDTH_MASK (0xf<<19) +#define S4_FLATSHADE_ALPHA (1<<18) +#define S4_FLATSHADE_FOG (1<<17) +#define S4_FLATSHADE_SPECULAR (1<<16) +#define S4_FLATSHADE_COLOR (1<<15) +#define S4_CULLMODE_BOTH (0<<13) +#define S4_CULLMODE_NONE (1<<13) +#define S4_CULLMODE_CW (2<<13) +#define S4_CULLMODE_CCW (3<<13) +#define S4_CULLMODE_MASK (3<<13) +#define S4_VFMT_POINT_WIDTH (1<<12) +#define S4_VFMT_SPEC_FOG (1<<11) +#define S4_VFMT_COLOR (1<<10) +#define S4_VFMT_DEPTH_OFFSET (1<<9) +#define S4_VFMT_XYZ (1<<6) +#define S4_VFMT_XYZW (2<<6) +#define S4_VFMT_XY (3<<6) +#define S4_VFMT_XYW (4<<6) +#define S4_VFMT_XYZW_MASK (7<<6) +#define S4_FORCE_DEFAULT_DIFFUSE (1<<5) +#define S4_FORCE_DEFAULT_SPECULAR (1<<4) +#define S4_LOCAL_DEPTH_OFFSET_ENABLE (1<<3) +#define S4_VFMT_FOG_PARAM (1<<2) +#define S4_SPRITE_POINT_ENABLE (1<<1) +#define S4_LINE_ANTIALIAS_ENABLE (1<<0) + +#define S4_VFMT_MASK (S4_VFMT_POINT_WIDTH | \ + S4_VFMT_SPEC_FOG | \ + S4_VFMT_COLOR | \ + S4_VFMT_DEPTH_OFFSET | \ + S4_VFMT_XYZW_MASK | \ + S4_VFMT_FOG_PARAM) + + +#define S5_WRITEDISABLE_ALPHA (1<<31) +#define S5_WRITEDISABLE_RED (1<<30) +#define S5_WRITEDISABLE_GREEN (1<<29) +#define S5_WRITEDISABLE_BLUE (1<<28) +#define S5_WRITEDISABLE_MASK (0xf<<28) +#define S5_FORCE_DEFAULT_POINT_SIZE (1<<27) +#define S5_LAST_PIXEL_ENABLE (1<<26) +#define S5_GLOBAL_DEPTH_OFFSET_ENABLE (1<<25) +#define S5_FOG_ENABLE (1<<24) +#define S5_STENCIL_REF_SHIFT 16 +#define S5_STENCIL_REF_MASK (0xff<<16) +#define S5_STENCIL_TEST_FUNC_SHIFT 13 +#define S5_STENCIL_TEST_FUNC_MASK (0x7<<13) +#define S5_STENCIL_FAIL_SHIFT 10 +#define S5_STENCIL_FAIL_MASK (0x7<<10) +#define S5_STENCIL_PASS_Z_FAIL_SHIFT 7 +#define S5_STENCIL_PASS_Z_FAIL_MASK (0x7<<7) +#define S5_STENCIL_PASS_Z_PASS_SHIFT 4 +#define S5_STENCIL_PASS_Z_PASS_MASK (0x7<<4) +#define S5_STENCIL_WRITE_ENABLE (1<<3) +#define S5_STENCIL_TEST_ENABLE (1<<2) +#define S5_COLOR_DITHER_ENABLE (1<<1) +#define S5_LOGICOP_ENABLE (1<<0) + + +#define S6_ALPHA_TEST_ENABLE (1<<31) +#define S6_ALPHA_TEST_FUNC_SHIFT 28 +#define S6_ALPHA_TEST_FUNC_MASK (0x7<<28) +#define S6_ALPHA_REF_SHIFT 20 +#define S6_ALPHA_REF_MASK (0xff<<20) +#define S6_DEPTH_TEST_ENABLE (1<<19) +#define S6_DEPTH_TEST_FUNC_SHIFT 16 +#define S6_DEPTH_TEST_FUNC_MASK (0x7<<16) +#define S6_CBUF_BLEND_ENABLE (1<<15) +#define S6_CBUF_BLEND_FUNC_SHIFT 12 +#define S6_CBUF_BLEND_FUNC_MASK (0x7<<12) +#define S6_CBUF_SRC_BLEND_FACT_SHIFT 8 +#define S6_CBUF_SRC_BLEND_FACT_MASK (0xf<<8) +#define S6_CBUF_DST_BLEND_FACT_SHIFT 4 +#define S6_CBUF_DST_BLEND_FACT_MASK (0xf<<4) +#define S6_DEPTH_WRITE_ENABLE (1<<3) +#define S6_COLOR_WRITE_ENABLE (1<<2) +#define S6_TRISTRIP_PV_SHIFT 0 +#define S6_TRISTRIP_PV_MASK (0x3<<0) + +#define S7_DEPTH_OFFSET_CONST_MASK ~0 + + + +#define DST_BLND_FACT(f) ((f)<= 0.0) ? src1 : src2 */ +#define A0_MIN (0xe<<24) /* dst = (src0 < src1) ? src0 : src1 */ +#define A0_MAX (0xf<<24) /* dst = (src0 >= src1) ? src0 : src1 */ +#define A0_FLR (0x10<<24) /* dst = floor(src0) */ +#define A0_MOD (0x11<<24) /* dst = src0 fmod 1.0 */ +#define A0_TRC (0x12<<24) /* dst = int(src0) */ +#define A0_SGE (0x13<<24) /* dst = src0 >= src1 ? 1.0 : 0.0 */ +#define A0_SLT (0x14<<24) /* dst = src0 < src1 ? 1.0 : 0.0 */ +#define A0_DEST_SATURATE (1<<22) +#define A0_DEST_TYPE_SHIFT 19 +/* Allow: R, OC, OD, U */ +#define A0_DEST_NR_SHIFT 14 +/* Allow R: 0..15, OC,OD: 0..0, U: 0..2 */ +#define A0_DEST_CHANNEL_X (1<<10) +#define A0_DEST_CHANNEL_Y (2<<10) +#define A0_DEST_CHANNEL_Z (4<<10) +#define A0_DEST_CHANNEL_W (8<<10) +#define A0_DEST_CHANNEL_ALL (0xf<<10) +#define A0_DEST_CHANNEL_SHIFT 10 +#define A0_SRC0_TYPE_SHIFT 7 +#define A0_SRC0_NR_SHIFT 2 + +#define A0_DEST_CHANNEL_XY (A0_DEST_CHANNEL_X|A0_DEST_CHANNEL_Y) +#define A0_DEST_CHANNEL_XYZ (A0_DEST_CHANNEL_XY|A0_DEST_CHANNEL_Z) + + +#define SRC_X 0 +#define SRC_Y 1 +#define SRC_Z 2 +#define SRC_W 3 +#define SRC_ZERO 4 +#define SRC_ONE 5 + +#define A1_SRC0_CHANNEL_X_NEGATE (1<<31) +#define A1_SRC0_CHANNEL_X_SHIFT 28 +#define A1_SRC0_CHANNEL_Y_NEGATE (1<<27) +#define A1_SRC0_CHANNEL_Y_SHIFT 24 +#define A1_SRC0_CHANNEL_Z_NEGATE (1<<23) +#define A1_SRC0_CHANNEL_Z_SHIFT 20 +#define A1_SRC0_CHANNEL_W_NEGATE (1<<19) +#define A1_SRC0_CHANNEL_W_SHIFT 16 +#define A1_SRC1_TYPE_SHIFT 13 +#define A1_SRC1_NR_SHIFT 8 +#define A1_SRC1_CHANNEL_X_NEGATE (1<<7) +#define A1_SRC1_CHANNEL_X_SHIFT 4 +#define A1_SRC1_CHANNEL_Y_NEGATE (1<<3) +#define A1_SRC1_CHANNEL_Y_SHIFT 0 + +#define A2_SRC1_CHANNEL_Z_NEGATE (1<<31) +#define A2_SRC1_CHANNEL_Z_SHIFT 28 +#define A2_SRC1_CHANNEL_W_NEGATE (1<<27) +#define A2_SRC1_CHANNEL_W_SHIFT 24 +#define A2_SRC2_TYPE_SHIFT 21 +#define A2_SRC2_NR_SHIFT 16 +#define A2_SRC2_CHANNEL_X_NEGATE (1<<15) +#define A2_SRC2_CHANNEL_X_SHIFT 12 +#define A2_SRC2_CHANNEL_Y_NEGATE (1<<11) +#define A2_SRC2_CHANNEL_Y_SHIFT 8 +#define A2_SRC2_CHANNEL_Z_NEGATE (1<<7) +#define A2_SRC2_CHANNEL_Z_SHIFT 4 +#define A2_SRC2_CHANNEL_W_NEGATE (1<<3) +#define A2_SRC2_CHANNEL_W_SHIFT 0 + + + +/* Texture instructions */ +#define T0_TEXLD (0x15<<24) /* Sample texture using predeclared + * sampler and address, and output + * filtered texel data to destination + * register */ +#define T0_TEXLDP (0x16<<24) /* Same as texld but performs a + * perspective divide of the texture + * coordinate .xyz values by .w before + * sampling. */ +#define T0_TEXLDB (0x17<<24) /* Same as texld but biases the + * computed LOD by w. Only S4.6 two's + * comp is used. This implies that a + * float to fixed conversion is + * done. */ +#define T0_TEXKILL (0x18<<24) /* Does not perform a sampling + * operation. Simply kills the pixel + * if any channel of the address + * register is < 0.0. */ +#define T0_DEST_TYPE_SHIFT 19 +/* Allow: R, OC, OD, U */ +/* Note: U (unpreserved) regs do not retain their values between + * phases (cannot be used for feedback) + * + * Note: oC and OD registers can only be used as the destination of a + * texture instruction once per phase (this is an implementation + * restriction). + */ +#define T0_DEST_NR_SHIFT 14 +/* Allow R: 0..15, OC,OD: 0..0, U: 0..2 */ +#define T0_SAMPLER_NR_SHIFT 0 /* This field ignored for TEXKILL */ +#define T0_SAMPLER_NR_MASK (0xf<<0) + +#define T1_ADDRESS_REG_TYPE_SHIFT 24 /* Reg to use as texture coord */ +/* Allow R, T, OC, OD -- R, OC, OD are 'dependent' reads, new program phase */ +#define T1_ADDRESS_REG_NR_SHIFT 17 +#define T2_MBZ 0 + +/* Declaration instructions */ +#define D0_DCL (0x19<<24) /* Declare a t (interpolated attrib) + * register or an s (sampler) + * register. */ +#define D0_SAMPLE_TYPE_SHIFT 22 +#define D0_SAMPLE_TYPE_2D (0x0<<22) +#define D0_SAMPLE_TYPE_CUBE (0x1<<22) +#define D0_SAMPLE_TYPE_VOLUME (0x2<<22) +#define D0_SAMPLE_TYPE_MASK (0x3<<22) + +#define D0_TYPE_SHIFT 19 +/* Allow: T, S */ +#define D0_NR_SHIFT 14 +/* Allow T: 0..10, S: 0..15 */ +#define D0_CHANNEL_X (1<<10) +#define D0_CHANNEL_Y (2<<10) +#define D0_CHANNEL_Z (4<<10) +#define D0_CHANNEL_W (8<<10) +#define D0_CHANNEL_ALL (0xf<<10) +#define D0_CHANNEL_NONE (0<<10) + +#define D0_CHANNEL_XY (D0_CHANNEL_X|D0_CHANNEL_Y) +#define D0_CHANNEL_XYZ (D0_CHANNEL_XY|D0_CHANNEL_Z) + +/* I915 Errata: Do not allow (xz), (xw), (xzw) combinations for diffuse + * or specular declarations. + * + * For T dcls, only allow: (x), (xy), (xyz), (w), (xyzw) + * + * Must be zero for S (sampler) dcls + */ +#define D1_MBZ 0 +#define D2_MBZ 0 + + + +/* p207 */ +#define _3DSTATE_MAP_STATE (CMD_3D|(0x1d<<24)|(0x0<<16)) + +#define MS1_MAPMASK_SHIFT 0 +#define MS1_MAPMASK_MASK (0x8fff<<0) + +#define MS2_UNTRUSTED_SURFACE (1<<31) +#define MS2_ADDRESS_MASK 0xfffffffc +#define MS2_VERTICAL_LINE_STRIDE (1<<1) +#define MS2_VERTICAL_OFFSET (1<<1) + +#define MS3_HEIGHT_SHIFT 21 +#define MS3_WIDTH_SHIFT 10 +#define MS3_PALETTE_SELECT (1<<9) +#define MS3_MAPSURF_FORMAT_SHIFT 7 +#define MS3_MAPSURF_FORMAT_MASK (0x7<<7) +#define MAPSURF_8BIT (1<<7) +#define MAPSURF_16BIT (2<<7) +#define MAPSURF_32BIT (3<<7) +#define MAPSURF_422 (5<<7) +#define MAPSURF_COMPRESSED (6<<7) +#define MAPSURF_4BIT_INDEXED (7<<7) +#define MS3_MT_FORMAT_MASK (0x7 << 3) +#define MS3_MT_FORMAT_SHIFT 3 +#define MT_4BIT_IDX_ARGB8888 (7<<3) /* SURFACE_4BIT_INDEXED */ +#define MT_8BIT_I8 (0<<3) /* SURFACE_8BIT */ +#define MT_8BIT_L8 (1<<3) +#define MT_8BIT_A8 (4<<3) +#define MT_8BIT_MONO8 (5<<3) +#define MT_16BIT_RGB565 (0<<3) /* SURFACE_16BIT */ +#define MT_16BIT_ARGB1555 (1<<3) +#define MT_16BIT_ARGB4444 (2<<3) +#define MT_16BIT_AY88 (3<<3) +#define MT_16BIT_88DVDU (5<<3) +#define MT_16BIT_BUMP_655LDVDU (6<<3) +#define MT_16BIT_I16 (7<<3) +#define MT_16BIT_L16 (8<<3) +#define MT_16BIT_A16 (9<<3) +#define MT_32BIT_ARGB8888 (0<<3) /* SURFACE_32BIT */ +#define MT_32BIT_ABGR8888 (1<<3) +#define MT_32BIT_XRGB8888 (2<<3) +#define MT_32BIT_XBGR8888 (3<<3) +#define MT_32BIT_QWVU8888 (4<<3) +#define MT_32BIT_AXVU8888 (5<<3) +#define MT_32BIT_LXVU8888 (6<<3) +#define MT_32BIT_XLVU8888 (7<<3) +#define MT_32BIT_ARGB2101010 (8<<3) +#define MT_32BIT_ABGR2101010 (9<<3) +#define MT_32BIT_AWVU2101010 (0xA<<3) +#define MT_32BIT_GR1616 (0xB<<3) +#define MT_32BIT_VU1616 (0xC<<3) +#define MT_32BIT_xI824 (0xD<<3) +#define MT_32BIT_xA824 (0xE<<3) +#define MT_32BIT_xL824 (0xF<<3) +#define MT_422_YCRCB_SWAPY (0<<3) /* SURFACE_422 */ +#define MT_422_YCRCB_NORMAL (1<<3) +#define MT_422_YCRCB_SWAPUV (2<<3) +#define MT_422_YCRCB_SWAPUVY (3<<3) +#define MT_COMPRESS_DXT1 (0<<3) /* SURFACE_COMPRESSED */ +#define MT_COMPRESS_DXT2_3 (1<<3) +#define MT_COMPRESS_DXT4_5 (2<<3) +#define MT_COMPRESS_FXT1 (3<<3) +#define MT_COMPRESS_DXT1_RGB (4<<3) +#define MS3_USE_FENCE_REGS (1<<2) +#define MS3_TILED_SURFACE (1<<1) +#define MS3_TILE_WALK (1<<0) + +#define MS4_PITCH_SHIFT 21 +#define MS4_CUBE_FACE_ENA_NEGX (1<<20) +#define MS4_CUBE_FACE_ENA_POSX (1<<19) +#define MS4_CUBE_FACE_ENA_NEGY (1<<18) +#define MS4_CUBE_FACE_ENA_POSY (1<<17) +#define MS4_CUBE_FACE_ENA_NEGZ (1<<16) +#define MS4_CUBE_FACE_ENA_POSZ (1<<15) +#define MS4_CUBE_FACE_ENA_MASK (0x3f<<15) +#define MS4_MAX_LOD_SHIFT 9 +#define MS4_MAX_LOD_MASK (0x3f<<9) +#define MS4_MIP_LAYOUT_LEGACY (0<<8) +#define MS4_MIP_LAYOUT_BELOW_LPT (0<<8) +#define MS4_MIP_LAYOUT_RIGHT_LPT (1<<8) +#define MS4_VOLUME_DEPTH_SHIFT 0 +#define MS4_VOLUME_DEPTH_MASK (0xff<<0) + +/* p244 */ +#define _3DSTATE_SAMPLER_STATE (CMD_3D|(0x1d<<24)|(0x1<<16)) + +#define SS1_MAPMASK_SHIFT 0 +#define SS1_MAPMASK_MASK (0x8fff<<0) + +#define SS2_REVERSE_GAMMA_ENABLE (1<<31) +#define SS2_PACKED_TO_PLANAR_ENABLE (1<<30) +#define SS2_COLORSPACE_CONVERSION (1<<29) +#define SS2_CHROMAKEY_SHIFT 27 +#define SS2_BASE_MIP_LEVEL_SHIFT 22 +#define SS2_BASE_MIP_LEVEL_MASK (0x1f<<22) +#define SS2_MIP_FILTER_SHIFT 20 +#define SS2_MIP_FILTER_MASK (0x3<<20) +#define MIPFILTER_NONE 0 +#define MIPFILTER_NEAREST 1 +#define MIPFILTER_LINEAR 3 +#define SS2_MAG_FILTER_SHIFT 17 +#define SS2_MAG_FILTER_MASK (0x7<<17) +#define FILTER_NEAREST 0 +#define FILTER_LINEAR 1 +#define FILTER_ANISOTROPIC 2 +#define FILTER_4X4_1 3 +#define FILTER_4X4_2 4 +#define FILTER_4X4_FLAT 5 +#define FILTER_6X5_MONO 6 /* XXX - check */ +#define SS2_MIN_FILTER_SHIFT 14 +#define SS2_MIN_FILTER_MASK (0x7<<14) +#define SS2_LOD_BIAS_SHIFT 5 +#define SS2_LOD_BIAS_ONE (0x10<<5) +#define SS2_LOD_BIAS_MASK (0x1ff<<5) +/* Shadow requires: + * MT_X8{I,L,A}24 or MT_{I,L,A}16 texture format + * FILTER_4X4_x MIN and MAG filters + */ +#define SS2_SHADOW_ENABLE (1<<4) +#define SS2_MAX_ANISO_MASK (1<<3) +#define SS2_MAX_ANISO_2 (0<<3) +#define SS2_MAX_ANISO_4 (1<<3) +#define SS2_SHADOW_FUNC_SHIFT 0 +#define SS2_SHADOW_FUNC_MASK (0x7<<0) +/* SS2_SHADOW_FUNC values: see COMPAREFUNC_* */ + +#define SS3_MIN_LOD_SHIFT 24 +#define SS3_MIN_LOD_ONE (0x10<<24) +#define SS3_MIN_LOD_MASK (0xff<<24) +#define SS3_KILL_PIXEL_ENABLE (1<<17) +#define SS3_TCX_ADDR_MODE_SHIFT 12 +#define SS3_TCX_ADDR_MODE_MASK (0x7<<12) +#define TEXCOORDMODE_WRAP 0 +#define TEXCOORDMODE_MIRROR 1 +#define TEXCOORDMODE_CLAMP_EDGE 2 +#define TEXCOORDMODE_CUBE 3 +#define TEXCOORDMODE_CLAMP_BORDER 4 +#define TEXCOORDMODE_MIRROR_ONCE 5 +#define SS3_TCY_ADDR_MODE_SHIFT 9 +#define SS3_TCY_ADDR_MODE_MASK (0x7<<9) +#define SS3_TCZ_ADDR_MODE_SHIFT 6 +#define SS3_TCZ_ADDR_MODE_MASK (0x7<<6) +#define SS3_NORMALIZED_COORDS (1<<5) +#define SS3_TEXTUREMAP_INDEX_SHIFT 1 +#define SS3_TEXTUREMAP_INDEX_MASK (0xf<<1) +#define SS3_DEINTERLACER_ENABLE (1<<0) + +#define SS4_BORDER_COLOR_MASK (~0) + +/* 3DSTATE_SPAN_STIPPLE, p258 + */ +#define _3DSTATE_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16)) +#define ST1_ENABLE (1<<16) +#define ST1_MASK (0xffff) + +#define _3DSTATE_DEFAULT_Z ((0x3<<29)|(0x1d<<24)|(0x98<<16)) +#define _3DSTATE_DEFAULT_DIFFUSE ((0x3<<29)|(0x1d<<24)|(0x99<<16)) +#define _3DSTATE_DEFAULT_SPECULAR ((0x3<<29)|(0x1d<<24)|(0x9a<<16)) + + +#define MI_FLUSH ((0<<29)|(4<<23)) +#define FLUSH_MAP_CACHE (1<<0) +#define INHIBIT_FLUSH_RENDER_CACHE (1<<2) + + +#define CMD_3D (0x3<<29) + + +#define _3DPRIMITIVE ((0x3<<29)|(0x1f<<24)) +#define PRIM_INDIRECT (1<<23) +#define PRIM_INLINE (0<<23) +#define PRIM_INDIRECT_SEQUENTIAL (0<<17) +#define PRIM_INDIRECT_ELTS (1<<17) + +#define PRIM3D_TRILIST (0x0<<18) +#define PRIM3D_TRISTRIP (0x1<<18) +#define PRIM3D_TRISTRIP_RVRSE (0x2<<18) +#define PRIM3D_TRIFAN (0x3<<18) +#define PRIM3D_POLY (0x4<<18) +#define PRIM3D_LINELIST (0x5<<18) +#define PRIM3D_LINESTRIP (0x6<<18) +#define PRIM3D_RECTLIST (0x7<<18) +#define PRIM3D_POINTLIST (0x8<<18) +#define PRIM3D_DIB (0x9<<18) +#define PRIM3D_MASK (0x1f<<18) + +#define I915PACKCOLOR4444(r,g,b,a) \ + ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4)) + +#define I915PACKCOLOR1555(r,g,b,a) \ + ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \ + ((a) ? 0x8000 : 0)) + +#define I915PACKCOLOR565(r,g,b) \ + ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3)) + +#define I915PACKCOLOR8888(r,g,b,a) \ + ((a<<24) | (r<<16) | (g<<8) | b) + + + + +#define BR00_BITBLT_CLIENT 0x40000000 +#define BR00_OP_COLOR_BLT 0x10000000 +#define BR00_OP_SRC_COPY_BLT 0x10C00000 +#define BR13_SOLID_PATTERN 0x80000000 + +#define XY_COLOR_BLT_CMD ((2<<29)|(0x50<<22)|0x4) +#define XY_COLOR_BLT_WRITE_ALPHA (1<<21) +#define XY_COLOR_BLT_WRITE_RGB (1<<20) + +#define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6) +#define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21) +#define XY_SRC_COPY_BLT_WRITE_RGB (1<<20) + +#define MI_WAIT_FOR_EVENT ((0x3<<23)) +#define MI_WAIT_FOR_PLANE_B_FLIP (1<<6) +#define MI_WAIT_FOR_PLANE_A_FLIP (1<<2) + +#define MI_BATCH_BUFFER (0x30<<23) +#define MI_BATCH_BUFFER_START (0x31<<23) +#define MI_BATCH_BUFFER_END (0xa<<23) + + + +#define COMPAREFUNC_ALWAYS 0 +#define COMPAREFUNC_NEVER 0x1 +#define COMPAREFUNC_LESS 0x2 +#define COMPAREFUNC_EQUAL 0x3 +#define COMPAREFUNC_LEQUAL 0x4 +#define COMPAREFUNC_GREATER 0x5 +#define COMPAREFUNC_NOTEQUAL 0x6 +#define COMPAREFUNC_GEQUAL 0x7 + +#define STENCILOP_KEEP 0 +#define STENCILOP_ZERO 0x1 +#define STENCILOP_REPLACE 0x2 +#define STENCILOP_INCRSAT 0x3 +#define STENCILOP_DECRSAT 0x4 +#define STENCILOP_INCR 0x5 +#define STENCILOP_DECR 0x6 +#define STENCILOP_INVERT 0x7 + +#define LOGICOP_CLEAR 0 +#define LOGICOP_NOR 0x1 +#define LOGICOP_AND_INV 0x2 +#define LOGICOP_COPY_INV 0x3 +#define LOGICOP_AND_RVRSE 0x4 +#define LOGICOP_INV 0x5 +#define LOGICOP_XOR 0x6 +#define LOGICOP_NAND 0x7 +#define LOGICOP_AND 0x8 +#define LOGICOP_EQUIV 0x9 +#define LOGICOP_NOOP 0xa +#define LOGICOP_OR_INV 0xb +#define LOGICOP_COPY 0xc +#define LOGICOP_OR_RVRSE 0xd +#define LOGICOP_OR 0xe +#define LOGICOP_SET 0xf + +#define BLENDFACT_ZERO 0x01 +#define BLENDFACT_ONE 0x02 +#define BLENDFACT_SRC_COLR 0x03 +#define BLENDFACT_INV_SRC_COLR 0x04 +#define BLENDFACT_SRC_ALPHA 0x05 +#define BLENDFACT_INV_SRC_ALPHA 0x06 +#define BLENDFACT_DST_ALPHA 0x07 +#define BLENDFACT_INV_DST_ALPHA 0x08 +#define BLENDFACT_DST_COLR 0x09 +#define BLENDFACT_INV_DST_COLR 0x0a +#define BLENDFACT_SRC_ALPHA_SATURATE 0x0b +#define BLENDFACT_CONST_COLOR 0x0c +#define BLENDFACT_INV_CONST_COLOR 0x0d +#define BLENDFACT_CONST_ALPHA 0x0e +#define BLENDFACT_INV_CONST_ALPHA 0x0f +#define BLENDFACT_MASK 0x0f + +#define PCI_CHIP_I915_G 0x2582 +#define PCI_CHIP_I915_GM 0x2592 +#define PCI_CHIP_I945_G 0x2772 +#define PCI_CHIP_I945_GM 0x27A2 +#define PCI_CHIP_I945_GME 0x27AE +#define PCI_CHIP_G33_G 0x29C2 +#define PCI_CHIP_Q35_G 0x29B2 +#define PCI_CHIP_Q33_G 0x29D2 + + +#endif diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c new file mode 100644 index 0000000000..c66558c320 --- /dev/null +++ b/src/gallium/drivers/i915/i915_screen.c @@ -0,0 +1,298 @@ +/************************************************************************** + * + * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#include "pipe/p_inlines.h" +#include "util/u_memory.h" +#include "util/u_string.h" + +#include "i915_reg.h" +#include "i915_context.h" +#include "i915_screen.h" +#include "i915_buffer.h" +#include "i915_texture.h" +#include "intel_winsys.h" + + +/* + * Probe functions + */ + + +static const char * +i915_get_vendor(struct pipe_screen *screen) +{ + return "VMware, Inc."; +} + +static const char * +i915_get_name(struct pipe_screen *screen) +{ + static char buffer[128]; + const char *chipset; + + switch (i915_screen(screen)->pci_id) { + case PCI_CHIP_I915_G: + chipset = "915G"; + break; + case PCI_CHIP_I915_GM: + chipset = "915GM"; + break; + case PCI_CHIP_I945_G: + chipset = "945G"; + break; + case PCI_CHIP_I945_GM: + chipset = "945GM"; + break; + case PCI_CHIP_I945_GME: + chipset = "945GME"; + break; + case PCI_CHIP_G33_G: + chipset = "G33"; + break; + case PCI_CHIP_Q35_G: + chipset = "Q35"; + break; + case PCI_CHIP_Q33_G: + chipset = "Q33"; + break; + default: + chipset = "unknown"; + break; + } + + util_snprintf(buffer, sizeof(buffer), "i915 (chipset: %s)", chipset); + return buffer; +} + +static int +i915_get_param(struct pipe_screen *screen, int param) +{ + switch (param) { + case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: + return 8; + case PIPE_CAP_NPOT_TEXTURES: + return 1; + case PIPE_CAP_TWO_SIDED_STENCIL: + return 1; + case PIPE_CAP_GLSL: + return 0; + case PIPE_CAP_ANISOTROPIC_FILTER: + return 0; + case PIPE_CAP_POINT_SPRITE: + return 0; + case PIPE_CAP_MAX_RENDER_TARGETS: + return 1; + case PIPE_CAP_OCCLUSION_QUERY: + return 0; + case PIPE_CAP_TEXTURE_SHADOW_MAP: + return 1; + case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: + return 11; /* max 1024x1024 */ + case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: + return 8; /* max 128x128x128 */ + case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: + return 11; /* max 1024x1024 */ + default: + return 0; + } +} + +static float +i915_get_paramf(struct pipe_screen *screen, int param) +{ + switch (param) { + case PIPE_CAP_MAX_LINE_WIDTH: + /* fall-through */ + case PIPE_CAP_MAX_LINE_WIDTH_AA: + return 7.5; + + case PIPE_CAP_MAX_POINT_WIDTH: + /* fall-through */ + case PIPE_CAP_MAX_POINT_WIDTH_AA: + return 255.0; + + case PIPE_CAP_MAX_TEXTURE_ANISOTROPY: + return 4.0; + + case PIPE_CAP_MAX_TEXTURE_LOD_BIAS: + return 16.0; + + default: + return 0; + } +} + +static boolean +i915_is_format_supported(struct pipe_screen *screen, + enum pipe_format format, + enum pipe_texture_target target, + unsigned tex_usage, + unsigned geom_flags) +{ + static const enum pipe_format tex_supported[] = { + PIPE_FORMAT_R8G8B8A8_UNORM, + PIPE_FORMAT_A8R8G8B8_UNORM, + PIPE_FORMAT_R5G6B5_UNORM, + PIPE_FORMAT_L8_UNORM, + PIPE_FORMAT_A8_UNORM, + PIPE_FORMAT_I8_UNORM, + PIPE_FORMAT_A8L8_UNORM, + PIPE_FORMAT_YCBCR, + PIPE_FORMAT_YCBCR_REV, + PIPE_FORMAT_S8Z24_UNORM, + PIPE_FORMAT_NONE /* list terminator */ + }; + static const enum pipe_format surface_supported[] = { + PIPE_FORMAT_A8R8G8B8_UNORM, + PIPE_FORMAT_R5G6B5_UNORM, + PIPE_FORMAT_S8Z24_UNORM, + PIPE_FORMAT_NONE /* list terminator */ + }; + const enum pipe_format *list; + uint i; + + if(tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) + list = surface_supported; + else + list = tex_supported; + + for (i = 0; list[i] != PIPE_FORMAT_NONE; i++) { + if (list[i] == format) + return TRUE; + } + + return FALSE; +} + + +/* + * Fence functions + */ + + +static void +i915_fence_reference(struct pipe_screen *screen, + struct pipe_fence_handle **ptr, + struct pipe_fence_handle *fence) +{ + struct i915_screen *is = i915_screen(screen); + + is->iws->fence_reference(is->iws, ptr, fence); +} + +static int +i915_fence_signalled(struct pipe_screen *screen, + struct pipe_fence_handle *fence, + unsigned flags) +{ + struct i915_screen *is = i915_screen(screen); + + return is->iws->fence_signalled(is->iws, fence); +} + +static int +i915_fence_finish(struct pipe_screen *screen, + struct pipe_fence_handle *fence, + unsigned flags) +{ + struct i915_screen *is = i915_screen(screen); + + return is->iws->fence_finish(is->iws, fence); +} + + +/* + * Generic functions + */ + + +static void +i915_destroy_screen(struct pipe_screen *screen) +{ + struct i915_screen *is = i915_screen(screen); + + if (is->iws) + is->iws->destroy(is->iws); + + FREE(is); +} + +/** + * Create a new i915_screen object + */ +struct pipe_screen * +i915_create_screen(struct intel_winsys *iws, uint pci_id) +{ + struct i915_screen *is = CALLOC_STRUCT(i915_screen); + + if (!is) + return NULL; + + switch (pci_id) { + case PCI_CHIP_I915_G: + case PCI_CHIP_I915_GM: + is->is_i945 = FALSE; + break; + + case PCI_CHIP_I945_G: + case PCI_CHIP_I945_GM: + case PCI_CHIP_I945_GME: + case PCI_CHIP_G33_G: + case PCI_CHIP_Q33_G: + case PCI_CHIP_Q35_G: + is->is_i945 = TRUE; + break; + + default: + debug_printf("%s: unknown pci id 0x%x, cannot create screen\n", + __FUNCTION__, pci_id); + return NULL; + } + + is->pci_id = pci_id; + is->iws = iws; + + is->base.winsys = NULL; + + is->base.destroy = i915_destroy_screen; + + is->base.get_name = i915_get_name; + is->base.get_vendor = i915_get_vendor; + is->base.get_param = i915_get_param; + is->base.get_paramf = i915_get_paramf; + is->base.is_format_supported = i915_is_format_supported; + + is->base.fence_reference = i915_fence_reference; + is->base.fence_signalled = i915_fence_signalled; + is->base.fence_finish = i915_fence_finish; + + i915_init_screen_texture_functions(is); + i915_init_screen_buffer_functions(is); + + return &is->base; +} diff --git a/src/gallium/drivers/i915/i915_screen.h b/src/gallium/drivers/i915/i915_screen.h new file mode 100644 index 0000000000..5126485caa --- /dev/null +++ b/src/gallium/drivers/i915/i915_screen.h @@ -0,0 +1,80 @@ +/************************************************************************** + * + * 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. + * + **************************************************************************/ + +#ifndef I915_SCREEN_H +#define I915_SCREEN_H + +#include "pipe/p_state.h" +#include "pipe/p_screen.h" + + +struct intel_winsys; + + +/** + * Subclass of pipe_screen + */ +struct i915_screen +{ + struct pipe_screen base; + + struct intel_winsys *iws; + + boolean is_i945; + uint pci_id; +}; + +/** + * Subclass of pipe_transfer + */ +struct i915_transfer +{ + struct pipe_transfer base; + + unsigned offset; +}; + + +/* + * Cast wrappers + */ + + +static INLINE struct i915_screen * +i915_screen(struct pipe_screen *pscreen) +{ + return (struct i915_screen *) pscreen; +} + +static INLINE struct i915_transfer * +i915_transfer(struct pipe_transfer *transfer) +{ + return (struct i915_transfer *)transfer; +} + + +#endif /* I915_SCREEN_H */ diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c new file mode 100644 index 0000000000..7d48e6e84d --- /dev/null +++ b/src/gallium/drivers/i915/i915_state.c @@ -0,0 +1,796 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * 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: Keith Whitwell + */ + + +#include "draw/draw_context.h" +#include "pipe/internal/p_winsys_screen.h" +#include "pipe/p_inlines.h" +#include "util/u_math.h" +#include "util/u_memory.h" +#include "tgsi/tgsi_parse.h" + +#include "i915_context.h" +#include "i915_reg.h" +#include "i915_state.h" +#include "i915_state_inlines.h" +#include "i915_fpc.h" + +/* The i915 (and related graphics cores) do not support GL_CLAMP. The + * Intel drivers for "other operating systems" implement GL_CLAMP as + * GL_CLAMP_TO_EDGE, so the same is done here. + */ +static unsigned +translate_wrap_mode(unsigned wrap) +{ + switch (wrap) { + case PIPE_TEX_WRAP_REPEAT: + return TEXCOORDMODE_WRAP; + case PIPE_TEX_WRAP_CLAMP: + return TEXCOORDMODE_CLAMP_EDGE; /* not quite correct */ + case PIPE_TEX_WRAP_CLAMP_TO_EDGE: + return TEXCOORDMODE_CLAMP_EDGE; + case PIPE_TEX_WRAP_CLAMP_TO_BORDER: + return TEXCOORDMODE_CLAMP_BORDER; +// case PIPE_TEX_WRAP_MIRRORED_REPEAT: +// return TEXCOORDMODE_MIRROR; + default: + return TEXCOORDMODE_WRAP; + } +} + +static unsigned translate_img_filter( unsigned filter ) +{ + switch (filter) { + case PIPE_TEX_FILTER_NEAREST: + return FILTER_NEAREST; + case PIPE_TEX_FILTER_LINEAR: + return FILTER_LINEAR; + case PIPE_TEX_FILTER_ANISO: + return FILTER_ANISOTROPIC; + default: + assert(0); + return FILTER_NEAREST; + } +} + +static unsigned translate_mip_filter( unsigned filter ) +{ + switch (filter) { + case PIPE_TEX_MIPFILTER_NONE: + return MIPFILTER_NONE; + case PIPE_TEX_MIPFILTER_NEAREST: + return MIPFILTER_NEAREST; + case PIPE_TEX_MIPFILTER_LINEAR: + return MIPFILTER_LINEAR; + default: + assert(0); + return MIPFILTER_NONE; + } +} + + +/* None of this state is actually used for anything yet. + */ +static void * +i915_create_blend_state(struct pipe_context *pipe, + const struct pipe_blend_state *blend) +{ + struct i915_blend_state *cso_data = CALLOC_STRUCT( i915_blend_state ); + + { + unsigned eqRGB = blend->rgb_func; + unsigned srcRGB = blend->rgb_src_factor; + unsigned dstRGB = blend->rgb_dst_factor; + + unsigned eqA = blend->alpha_func; + unsigned srcA = blend->alpha_src_factor; + unsigned dstA = blend->alpha_dst_factor; + + /* Special handling for MIN/MAX filter modes handled at + * state_tracker level. + */ + + if (srcA != srcRGB || + dstA != dstRGB || + eqA != eqRGB) { + + cso_data->iab = (_3DSTATE_INDEPENDENT_ALPHA_BLEND_CMD | + IAB_MODIFY_ENABLE | + IAB_ENABLE | + IAB_MODIFY_FUNC | + IAB_MODIFY_SRC_FACTOR | + IAB_MODIFY_DST_FACTOR | + SRC_ABLND_FACT(i915_translate_blend_factor(srcA)) | + DST_ABLND_FACT(i915_translate_blend_factor(dstA)) | + (i915_translate_blend_func(eqA) << IAB_FUNC_SHIFT)); + } + else { + cso_data->iab = (_3DSTATE_INDEPENDENT_ALPHA_BLEND_CMD | + IAB_MODIFY_ENABLE | + 0); + } + } + + cso_data->modes4 |= (_3DSTATE_MODES_4_CMD | + ENABLE_LOGIC_OP_FUNC | + LOGIC_OP_FUNC(i915_translate_logic_op(blend->logicop_func))); + + if (blend->logicop_enable) + cso_data->LIS5 |= S5_LOGICOP_ENABLE; + + if (blend->dither) + cso_data->LIS5 |= S5_COLOR_DITHER_ENABLE; + + if ((blend->colormask & PIPE_MASK_R) == 0) + cso_data->LIS5 |= S5_WRITEDISABLE_RED; + + if ((blend->colormask & PIPE_MASK_G) == 0) + cso_data->LIS5 |= S5_WRITEDISABLE_GREEN; + + if ((blend->colormask & PIPE_MASK_B) == 0) + cso_data->LIS5 |= S5_WRITEDISABLE_BLUE; + + if ((blend->colormask & PIPE_MASK_A) == 0) + cso_data->LIS5 |= S5_WRITEDISABLE_ALPHA; + + if (blend->blend_enable) { + unsigned funcRGB = blend->rgb_func; + unsigned srcRGB = blend->rgb_src_factor; + unsigned dstRGB = blend->rgb_dst_factor; + + cso_data->LIS6 |= (S6_CBUF_BLEND_ENABLE | + SRC_BLND_FACT(i915_translate_blend_factor(srcRGB)) | + DST_BLND_FACT(i915_translate_blend_factor(dstRGB)) | + (i915_translate_blend_func(funcRGB) << S6_CBUF_BLEND_FUNC_SHIFT)); + } + + return cso_data; +} + +static void i915_bind_blend_state(struct pipe_context *pipe, + void *blend) +{ + struct i915_context *i915 = i915_context(pipe); + draw_flush(i915->draw); + + i915->blend = (struct i915_blend_state*)blend; + + i915->dirty |= I915_NEW_BLEND; +} + + +static void i915_delete_blend_state(struct pipe_context *pipe, void *blend) +{ + FREE(blend); +} + +static void i915_set_blend_color( struct pipe_context *pipe, + const struct pipe_blend_color *blend_color ) +{ + struct i915_context *i915 = i915_context(pipe); + draw_flush(i915->draw); + + i915->blend_color = *blend_color; + + i915->dirty |= I915_NEW_BLEND; +} + +static void * +i915_create_sampler_state(struct pipe_context *pipe, + const struct pipe_sampler_state *sampler) +{ + struct i915_sampler_state *cso = CALLOC_STRUCT( i915_sampler_state ); + const unsigned ws = sampler->wrap_s; + const unsigned wt = sampler->wrap_t; + const unsigned wr = sampler->wrap_r; + unsigned minFilt, magFilt; + unsigned mipFilt; + + cso->templ = sampler; + + mipFilt = translate_mip_filter(sampler->min_mip_filter); + minFilt = translate_img_filter( sampler->min_img_filter ); + magFilt = translate_img_filter( sampler->mag_img_filter ); + + if (sampler->max_anisotropy > 2.0) { + cso->state[0] |= SS2_MAX_ANISO_4; + } + + { + int b = (int) (sampler->lod_bias * 16.0); + b = CLAMP(b, -256, 255); + cso->state[0] |= ((b << SS2_LOD_BIAS_SHIFT) & SS2_LOD_BIAS_MASK); + } + + /* Shadow: + */ + if (sampler->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) + { + cso->state[0] |= (SS2_SHADOW_ENABLE | + i915_translate_compare_func(sampler->compare_func)); + + minFilt = FILTER_4X4_FLAT; + magFilt = FILTER_4X4_FLAT; + } + + cso->state[0] |= ((minFilt << SS2_MIN_FILTER_SHIFT) | + (mipFilt << SS2_MIP_FILTER_SHIFT) | + (magFilt << SS2_MAG_FILTER_SHIFT)); + + cso->state[1] |= + ((translate_wrap_mode(ws) << SS3_TCX_ADDR_MODE_SHIFT) | + (translate_wrap_mode(wt) << SS3_TCY_ADDR_MODE_SHIFT) | + (translate_wrap_mode(wr) << SS3_TCZ_ADDR_MODE_SHIFT)); + + if (sampler->normalized_coords) + cso->state[1] |= SS3_NORMALIZED_COORDS; + + { + int minlod = (int) (16.0 * sampler->min_lod); + int maxlod = (int) (16.0 * sampler->max_lod); + minlod = CLAMP(minlod, 0, 16 * 11); + maxlod = CLAMP(maxlod, 0, 16 * 11); + + if (minlod > maxlod) + maxlod = minlod; + + cso->minlod = minlod; + cso->maxlod = maxlod; + } + + { + ubyte r = float_to_ubyte(sampler->border_color[0]); + ubyte g = float_to_ubyte(sampler->border_color[1]); + ubyte b = float_to_ubyte(sampler->border_color[2]); + ubyte a = float_to_ubyte(sampler->border_color[3]); + cso->state[2] = I915PACKCOLOR8888(r, g, b, a); + } + return cso; +} + +static void i915_bind_sampler_states(struct pipe_context *pipe, + unsigned num, void **sampler) +{ + struct i915_context *i915 = i915_context(pipe); + unsigned i; + + assert(num <= PIPE_MAX_SAMPLERS); + + /* Check for no-op */ + if (num == i915->num_samplers && + !memcmp(i915->sampler, sampler, num * sizeof(void *))) + return; + + draw_flush(i915->draw); + + for (i = 0; i < num; ++i) + i915->sampler[i] = sampler[i]; + for (i = num; i < PIPE_MAX_SAMPLERS; ++i) + i915->sampler[i] = NULL; + + i915->num_samplers = num; + + i915->dirty |= I915_NEW_SAMPLER; +} + +static void i915_delete_sampler_state(struct pipe_context *pipe, + void *sampler) +{ + FREE(sampler); +} + + +/** XXX move someday? Or consolidate all these simple state setters + * into one file. + */ + +static void * +i915_create_depth_stencil_state(struct pipe_context *pipe, + const struct pipe_depth_stencil_alpha_state *depth_stencil) +{ + struct i915_depth_stencil_state *cso = CALLOC_STRUCT( i915_depth_stencil_state ); + + { + int testmask = depth_stencil->stencil[0].valuemask & 0xff; + int writemask = depth_stencil->stencil[0].writemask & 0xff; + + cso->stencil_modes4 |= (_3DSTATE_MODES_4_CMD | + ENABLE_STENCIL_TEST_MASK | + STENCIL_TEST_MASK(testmask) | + ENABLE_STENCIL_WRITE_MASK | + STENCIL_WRITE_MASK(writemask)); + } + + if (depth_stencil->stencil[0].enabled) { + int test = i915_translate_compare_func(depth_stencil->stencil[0].func); + int fop = i915_translate_stencil_op(depth_stencil->stencil[0].fail_op); + int dfop = i915_translate_stencil_op(depth_stencil->stencil[0].zfail_op); + int dpop = i915_translate_stencil_op(depth_stencil->stencil[0].zpass_op); + int ref = depth_stencil->stencil[0].ref_value & 0xff; + + cso->stencil_LIS5 |= (S5_STENCIL_TEST_ENABLE | + S5_STENCIL_WRITE_ENABLE | + (ref << S5_STENCIL_REF_SHIFT) | + (test << S5_STENCIL_TEST_FUNC_SHIFT) | + (fop << S5_STENCIL_FAIL_SHIFT) | + (dfop << S5_STENCIL_PASS_Z_FAIL_SHIFT) | + (dpop << S5_STENCIL_PASS_Z_PASS_SHIFT)); + } + + if (depth_stencil->stencil[1].enabled) { + int test = i915_translate_compare_func(depth_stencil->stencil[1].func); + int fop = i915_translate_stencil_op(depth_stencil->stencil[1].fail_op); + int dfop = i915_translate_stencil_op(depth_stencil->stencil[1].zfail_op); + int dpop = i915_translate_stencil_op(depth_stencil->stencil[1].zpass_op); + int ref = depth_stencil->stencil[1].ref_value & 0xff; + int tmask = depth_stencil->stencil[1].valuemask & 0xff; + int wmask = depth_stencil->stencil[1].writemask & 0xff; + + cso->bfo[0] = (_3DSTATE_BACKFACE_STENCIL_OPS | + BFO_ENABLE_STENCIL_FUNCS | + BFO_ENABLE_STENCIL_TWO_SIDE | + BFO_ENABLE_STENCIL_REF | + BFO_STENCIL_TWO_SIDE | + (ref << BFO_STENCIL_REF_SHIFT) | + (test << BFO_STENCIL_TEST_SHIFT) | + (fop << BFO_STENCIL_FAIL_SHIFT) | + (dfop << BFO_STENCIL_PASS_Z_FAIL_SHIFT) | + (dpop << BFO_STENCIL_PASS_Z_PASS_SHIFT)); + + cso->bfo[1] = (_3DSTATE_BACKFACE_STENCIL_MASKS | + BFM_ENABLE_STENCIL_TEST_MASK | + BFM_ENABLE_STENCIL_WRITE_MASK | + (tmask << BFM_STENCIL_TEST_MASK_SHIFT) | + (wmask << BFM_STENCIL_WRITE_MASK_SHIFT)); + } + else { + /* This actually disables two-side stencil: The bit set is a + * modify-enable bit to indicate we are changing the two-side + * setting. Then there is a symbolic zero to show that we are + * setting the flag to zero/off. + */ + cso->bfo[0] = (_3DSTATE_BACKFACE_STENCIL_OPS | + BFO_ENABLE_STENCIL_TWO_SIDE | + 0); + cso->bfo[1] = 0; + } + + if (depth_stencil->depth.enabled) { + int func = i915_translate_compare_func(depth_stencil->depth.func); + + cso->depth_LIS6 |= (S6_DEPTH_TEST_ENABLE | + (func << S6_DEPTH_TEST_FUNC_SHIFT)); + + if (depth_stencil->depth.writemask) + cso->depth_LIS6 |= S6_DEPTH_WRITE_ENABLE; + } + + if (depth_stencil->alpha.enabled) { + int test = i915_translate_compare_func(depth_stencil->alpha.func); + ubyte refByte = float_to_ubyte(depth_stencil->alpha.ref_value); + + cso->depth_LIS6 |= (S6_ALPHA_TEST_ENABLE | + (test << S6_ALPHA_TEST_FUNC_SHIFT) | + (((unsigned) refByte) << S6_ALPHA_REF_SHIFT)); + } + + return cso; +} + +static void i915_bind_depth_stencil_state(struct pipe_context *pipe, + void *depth_stencil) +{ + struct i915_context *i915 = i915_context(pipe); + draw_flush(i915->draw); + + i915->depth_stencil = (const struct i915_depth_stencil_state *)depth_stencil; + + i915->dirty |= I915_NEW_DEPTH_STENCIL; +} + +static void i915_delete_depth_stencil_state(struct pipe_context *pipe, + void *depth_stencil) +{ + FREE(depth_stencil); +} + + +static void i915_set_scissor_state( struct pipe_context *pipe, + const struct pipe_scissor_state *scissor ) +{ + struct i915_context *i915 = i915_context(pipe); + draw_flush(i915->draw); + + memcpy( &i915->scissor, scissor, sizeof(*scissor) ); + i915->dirty |= I915_NEW_SCISSOR; +} + + +static void i915_set_polygon_stipple( struct pipe_context *pipe, + const struct pipe_poly_stipple *stipple ) +{ +} + + + +static void * +i915_create_fs_state(struct pipe_context *pipe, + const struct pipe_shader_state *templ) +{ + struct i915_context *i915 = i915_context(pipe); + struct i915_fragment_shader *ifs = CALLOC_STRUCT(i915_fragment_shader); + if (!ifs) + return NULL; + + ifs->state.tokens = tgsi_dup_tokens(templ->tokens); + + tgsi_scan_shader(templ->tokens, &ifs->info); + + /* The shader's compiled to i915 instructions here */ + i915_translate_fragment_program(i915, ifs); + + return ifs; +} + +static void +i915_bind_fs_state(struct pipe_context *pipe, void *shader) +{ + struct i915_context *i915 = i915_context(pipe); + draw_flush(i915->draw); + + i915->fs = (struct i915_fragment_shader*) shader; + + i915->dirty |= I915_NEW_FS; +} + +static +void i915_delete_fs_state(struct pipe_context *pipe, void *shader) +{ + struct i915_fragment_shader *ifs = (struct i915_fragment_shader *) shader; + + if (ifs->program) + FREE(ifs->program); + ifs->program_len = 0; + + FREE((struct tgsi_token *)ifs->state.tokens); + + FREE(ifs); +} + + +static void * +i915_create_vs_state(struct pipe_context *pipe, + const struct pipe_shader_state *templ) +{ + struct i915_context *i915 = i915_context(pipe); + + /* just pass-through to draw module */ + return draw_create_vertex_shader(i915->draw, templ); +} + +static void i915_bind_vs_state(struct pipe_context *pipe, void *shader) +{ + struct i915_context *i915 = i915_context(pipe); + + /* just pass-through to draw module */ + draw_bind_vertex_shader(i915->draw, (struct draw_vertex_shader *) shader); + + i915->dirty |= I915_NEW_VS; +} + +static void i915_delete_vs_state(struct pipe_context *pipe, void *shader) +{ + struct i915_context *i915 = i915_context(pipe); + + /* just pass-through to draw module */ + draw_delete_vertex_shader(i915->draw, (struct draw_vertex_shader *) shader); +} + +static void i915_set_constant_buffer(struct pipe_context *pipe, + uint shader, uint index, + const struct pipe_constant_buffer *buf) +{ + struct i915_context *i915 = i915_context(pipe); + struct pipe_screen *screen = pipe->screen; + draw_flush(i915->draw); + + assert(shader < PIPE_SHADER_TYPES); + assert(index == 0); + + /* Make a copy of shader constants. + * During fragment program translation we may add additional + * constants to the array. + * + * We want to consider the situation where some user constants + * (ex: a material color) may change frequently but the shader program + * stays the same. In that case we should only be updating the first + * N constants, leaving any extras from shader translation alone. + */ + if (buf) { + void *mapped; + if (buf->buffer && buf->buffer->size && + (mapped = pipe_buffer_map(screen, buf->buffer, + PIPE_BUFFER_USAGE_CPU_READ))) { + memcpy(i915->current.constants[shader], mapped, buf->buffer->size); + pipe_buffer_unmap(screen, buf->buffer); + i915->current.num_user_constants[shader] + = buf->buffer->size / (4 * sizeof(float)); + } + else { + i915->current.num_user_constants[shader] = 0; + } + } + + i915->dirty |= I915_NEW_CONSTANTS; +} + + +static void i915_set_sampler_textures(struct pipe_context *pipe, + unsigned num, + struct pipe_texture **texture) +{ + struct i915_context *i915 = i915_context(pipe); + uint i; + + assert(num <= PIPE_MAX_SAMPLERS); + + /* Check for no-op */ + if (num == i915->num_textures && + !memcmp(i915->texture, texture, num * sizeof(struct pipe_texture *))) + return; + + /* Fixes wrong texture in texobj with VBUF */ + draw_flush(i915->draw); + + for (i = 0; i < num; i++) + pipe_texture_reference((struct pipe_texture **) &i915->texture[i], + texture[i]); + + for (i = num; i < i915->num_textures; i++) + pipe_texture_reference((struct pipe_texture **) &i915->texture[i], + NULL); + + i915->num_textures = num; + + i915->dirty |= I915_NEW_TEXTURE; +} + + + +static void i915_set_framebuffer_state(struct pipe_context *pipe, + const struct pipe_framebuffer_state *fb) +{ + struct i915_context *i915 = i915_context(pipe); + int i; + + draw_flush(i915->draw); + + i915->framebuffer.width = fb->width; + i915->framebuffer.height = fb->height; + i915->framebuffer.nr_cbufs = fb->nr_cbufs; + for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { + pipe_surface_reference(&i915->framebuffer.cbufs[i], fb->cbufs[i]); + } + pipe_surface_reference(&i915->framebuffer.zsbuf, fb->zsbuf); + + i915->dirty |= I915_NEW_FRAMEBUFFER; +} + + + +static void i915_set_clip_state( struct pipe_context *pipe, + const struct pipe_clip_state *clip ) +{ + struct i915_context *i915 = i915_context(pipe); + draw_flush(i915->draw); + + draw_set_clip_state(i915->draw, clip); + + i915->dirty |= I915_NEW_CLIP; +} + + + +/* Called when driver state tracker notices changes to the viewport + * matrix: + */ +static void i915_set_viewport_state( struct pipe_context *pipe, + const struct pipe_viewport_state *viewport ) +{ + struct i915_context *i915 = i915_context(pipe); + + i915->viewport = *viewport; /* struct copy */ + + /* pass the viewport info to the draw module */ + draw_set_viewport_state(i915->draw, &i915->viewport); + + i915->dirty |= I915_NEW_VIEWPORT; +} + + +static void * +i915_create_rasterizer_state(struct pipe_context *pipe, + const struct pipe_rasterizer_state *rasterizer) +{ + struct i915_rasterizer_state *cso = CALLOC_STRUCT( i915_rasterizer_state ); + + cso->templ = rasterizer; + cso->color_interp = rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR; + cso->light_twoside = rasterizer->light_twoside; + cso->ds[0].u = _3DSTATE_DEPTH_OFFSET_SCALE; + cso->ds[1].f = rasterizer->offset_scale; + if (rasterizer->poly_stipple_enable) { + cso->st |= ST1_ENABLE; + } + + if (rasterizer->scissor) + cso->sc[0] = _3DSTATE_SCISSOR_ENABLE_CMD | ENABLE_SCISSOR_RECT; + else + cso->sc[0] = _3DSTATE_SCISSOR_ENABLE_CMD | DISABLE_SCISSOR_RECT; + + switch (rasterizer->cull_mode) { + case PIPE_WINDING_NONE: + cso->LIS4 |= S4_CULLMODE_NONE; + break; + case PIPE_WINDING_CW: + cso->LIS4 |= S4_CULLMODE_CW; + break; + case PIPE_WINDING_CCW: + cso->LIS4 |= S4_CULLMODE_CCW; + break; + case PIPE_WINDING_BOTH: + cso->LIS4 |= S4_CULLMODE_BOTH; + break; + } + + { + int line_width = CLAMP((int)(rasterizer->line_width * 2), 1, 0xf); + + cso->LIS4 |= line_width << S4_LINE_WIDTH_SHIFT; + + if (rasterizer->line_smooth) + cso->LIS4 |= S4_LINE_ANTIALIAS_ENABLE; + } + + { + int point_size = CLAMP((int) rasterizer->point_size, 1, 0xff); + + cso->LIS4 |= point_size << S4_POINT_WIDTH_SHIFT; + } + + if (rasterizer->flatshade) { + cso->LIS4 |= (S4_FLATSHADE_ALPHA | + S4_FLATSHADE_COLOR | + S4_FLATSHADE_SPECULAR); + } + + cso->LIS7 = fui( rasterizer->offset_units ); + + + return cso; +} + +static void i915_bind_rasterizer_state( struct pipe_context *pipe, + void *raster ) +{ + struct i915_context *i915 = i915_context(pipe); + + i915->rasterizer = (struct i915_rasterizer_state *)raster; + + /* pass-through to draw module */ + draw_set_rasterizer_state(i915->draw, + (i915->rasterizer ? i915->rasterizer->templ : NULL)); + + i915->dirty |= I915_NEW_RASTERIZER; +} + +static void i915_delete_rasterizer_state(struct pipe_context *pipe, + void *raster) +{ + FREE(raster); +} + +static void i915_set_vertex_buffers(struct pipe_context *pipe, + unsigned count, + const struct pipe_vertex_buffer *buffers) +{ + struct i915_context *i915 = i915_context(pipe); + /* Because we change state before the draw_set_vertex_buffers call + * we need a flush here, just to be sure. + */ + draw_flush(i915->draw); + + memcpy(i915->vertex_buffer, buffers, count * sizeof(buffers[0])); + i915->num_vertex_buffers = count; + + /* pass-through to draw module */ + draw_set_vertex_buffers(i915->draw, count, buffers); +} + +static void i915_set_vertex_elements(struct pipe_context *pipe, + unsigned count, + const struct pipe_vertex_element *elements) +{ + struct i915_context *i915 = i915_context(pipe); + /* Because we change state before the draw_set_vertex_buffers call + * we need a flush here, just to be sure. + */ + draw_flush(i915->draw); + + i915->num_vertex_elements = count; + /* pass-through to draw module */ + draw_set_vertex_elements(i915->draw, count, elements); +} + + +static void i915_set_edgeflags(struct pipe_context *pipe, + const unsigned *bitfield) +{ + /* TODO do something here */ +} + +void +i915_init_state_functions( struct i915_context *i915 ) +{ + i915->base.set_edgeflags = i915_set_edgeflags; + i915->base.create_blend_state = i915_create_blend_state; + i915->base.bind_blend_state = i915_bind_blend_state; + i915->base.delete_blend_state = i915_delete_blend_state; + + i915->base.create_sampler_state = i915_create_sampler_state; + i915->base.bind_sampler_states = i915_bind_sampler_states; + i915->base.delete_sampler_state = i915_delete_sampler_state; + + i915->base.create_depth_stencil_alpha_state = i915_create_depth_stencil_state; + i915->base.bind_depth_stencil_alpha_state = i915_bind_depth_stencil_state; + i915->base.delete_depth_stencil_alpha_state = i915_delete_depth_stencil_state; + + i915->base.create_rasterizer_state = i915_create_rasterizer_state; + i915->base.bind_rasterizer_state = i915_bind_rasterizer_state; + i915->base.delete_rasterizer_state = i915_delete_rasterizer_state; + i915->base.create_fs_state = i915_create_fs_state; + i915->base.bind_fs_state = i915_bind_fs_state; + i915->base.delete_fs_state = i915_delete_fs_state; + i915->base.create_vs_state = i915_create_vs_state; + i915->base.bind_vs_state = i915_bind_vs_state; + i915->base.delete_vs_state = i915_delete_vs_state; + + i915->base.set_blend_color = i915_set_blend_color; + i915->base.set_clip_state = i915_set_clip_state; + i915->base.set_constant_buffer = i915_set_constant_buffer; + i915->base.set_framebuffer_state = i915_set_framebuffer_state; + + i915->base.set_polygon_stipple = i915_set_polygon_stipple; + i915->base.set_scissor_state = i915_set_scissor_state; + i915->base.set_sampler_textures = i915_set_sampler_textures; + i915->base.set_viewport_state = i915_set_viewport_state; + i915->base.set_vertex_buffers = i915_set_vertex_buffers; + i915->base.set_vertex_elements = i915_set_vertex_elements; +} diff --git a/src/gallium/drivers/i915/i915_state.h b/src/gallium/drivers/i915/i915_state.h new file mode 100644 index 0000000000..86c6b0027d --- /dev/null +++ b/src/gallium/drivers/i915/i915_state.h @@ -0,0 +1,50 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * 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: Keith Whitwell + */ + +#ifndef I915_STATE_H +#define I915_STATE_H + +struct i915_context; + + +struct i915_tracked_state { + unsigned dirty; + void (*update)( struct i915_context * ); +}; + +void i915_update_immediate( struct i915_context *i915 ); +void i915_update_dynamic( struct i915_context *i915 ); +void i915_update_derived( struct i915_context *i915 ); +void i915_update_samplers( struct i915_context *i915 ); +void i915_update_textures(struct i915_context *i915); + +void i915_emit_hardware_state( struct i915_context *i915 ); + +#endif diff --git a/src/gallium/drivers/i915/i915_state_derived.c b/src/gallium/drivers/i915/i915_state_derived.c new file mode 100644 index 0000000000..178d4e8781 --- /dev/null +++ b/src/gallium/drivers/i915/i915_state_derived.c @@ -0,0 +1,183 @@ +/************************************************************************** + * + * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#include "util/u_memory.h" +#include "pipe/p_shader_tokens.h" +#include "draw/draw_context.h" +#include "draw/draw_vertex.h" +#include "i915_context.h" +#include "i915_state.h" +#include "i915_reg.h" +#include "i915_fpc.h" + + + +/** + * Determine the hardware vertex layout. + * Depends on vertex/fragment shader state. + */ +static void calculate_vertex_layout( struct i915_context *i915 ) +{ + const struct i915_fragment_shader *fs = i915->fs; + const enum interp_mode colorInterp = i915->rasterizer->color_interp; + struct vertex_info vinfo; + boolean texCoords[8], colors[2], fog, needW; + uint i; + int src; + + memset(texCoords, 0, sizeof(texCoords)); + colors[0] = colors[1] = fog = needW = FALSE; + memset(&vinfo, 0, sizeof(vinfo)); + + /* Determine which fragment program inputs are needed. Setup HW vertex + * layout below, in the HW-specific attribute order. + */ + for (i = 0; i < fs->info.num_inputs; i++) { + switch (fs->info.input_semantic_name[i]) { + case TGSI_SEMANTIC_POSITION: + break; + case TGSI_SEMANTIC_COLOR: + assert(fs->info.input_semantic_index[i] < 2); + colors[fs->info.input_semantic_index[i]] = TRUE; + break; + case TGSI_SEMANTIC_GENERIC: + /* usually a texcoord */ + { + const uint unit = fs->info.input_semantic_index[i]; + assert(unit < 8); + texCoords[unit] = TRUE; + needW = TRUE; + } + break; + case TGSI_SEMANTIC_FOG: + fog = TRUE; + break; + default: + assert(0); + } + } + + + /* pos */ + src = draw_find_vs_output(i915->draw, TGSI_SEMANTIC_POSITION, 0); + if (needW) { + draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_LINEAR, src); + vinfo.hwfmt[0] |= S4_VFMT_XYZW; + vinfo.attrib[0].emit = EMIT_4F; + } + else { + draw_emit_vertex_attr(&vinfo, EMIT_3F, INTERP_LINEAR, src); + vinfo.hwfmt[0] |= S4_VFMT_XYZ; + vinfo.attrib[0].emit = EMIT_3F; + } + + /* hardware point size */ + /* XXX todo */ + + /* primary color */ + if (colors[0]) { + src = draw_find_vs_output(i915->draw, TGSI_SEMANTIC_COLOR, 0); + draw_emit_vertex_attr(&vinfo, EMIT_4UB, colorInterp, src); + vinfo.hwfmt[0] |= S4_VFMT_COLOR; + } + + /* secondary color */ + if (colors[1]) { + src = draw_find_vs_output(i915->draw, TGSI_SEMANTIC_COLOR, 1); + draw_emit_vertex_attr(&vinfo, EMIT_4UB, colorInterp, src); + vinfo.hwfmt[0] |= S4_VFMT_SPEC_FOG; + } + + /* fog coord, not fog blend factor */ + if (fog) { + src = draw_find_vs_output(i915->draw, TGSI_SEMANTIC_FOG, 0); + draw_emit_vertex_attr(&vinfo, EMIT_1F, INTERP_PERSPECTIVE, src); + vinfo.hwfmt[0] |= S4_VFMT_FOG_PARAM; + } + + /* texcoords */ + for (i = 0; i < 8; i++) { + uint hwtc; + if (texCoords[i]) { + hwtc = TEXCOORDFMT_4D; + src = draw_find_vs_output(i915->draw, TGSI_SEMANTIC_GENERIC, i); + draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE, src); + } + else { + hwtc = TEXCOORDFMT_NOT_PRESENT; + } + vinfo.hwfmt[1] |= hwtc << (i * 4); + } + + draw_compute_vertex_size(&vinfo); + + if (memcmp(&i915->current.vertex_info, &vinfo, sizeof(vinfo))) { + /* Need to set this flag so that the LIS2/4 registers get set. + * It also means the i915_update_immediate() function must be called + * after this one, in i915_update_derived(). + */ + i915->dirty |= I915_NEW_VERTEX_FORMAT; + + memcpy(&i915->current.vertex_info, &vinfo, sizeof(vinfo)); + } +} + + + + +/* Hopefully this will remain quite simple, otherwise need to pull in + * something like the state tracker mechanism. + */ +void i915_update_derived( struct i915_context *i915 ) +{ + if (i915->dirty & (I915_NEW_RASTERIZER | I915_NEW_FS | I915_NEW_VS)) + calculate_vertex_layout( i915 ); + + if (i915->dirty & (I915_NEW_SAMPLER | I915_NEW_TEXTURE)) + i915_update_samplers(i915); + + if (i915->dirty & I915_NEW_TEXTURE) + i915_update_textures(i915); + + if (i915->dirty) + i915_update_immediate( i915 ); + + if (i915->dirty) + i915_update_dynamic( i915 ); + + if (i915->dirty & I915_NEW_FS) { + i915->hardware_dirty |= I915_HW_PROGRAM; /* XXX right? */ + } + + /* HW emit currently references framebuffer state directly: + */ + if (i915->dirty & I915_NEW_FRAMEBUFFER) + i915->hardware_dirty |= I915_HW_STATIC; + + i915->dirty = 0; +} diff --git a/src/gallium/drivers/i915/i915_state_dynamic.c b/src/gallium/drivers/i915/i915_state_dynamic.c new file mode 100644 index 0000000000..86126a5a15 --- /dev/null +++ b/src/gallium/drivers/i915/i915_state_dynamic.c @@ -0,0 +1,310 @@ +/************************************************************************** + * + * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include "i915_batch.h" +#include "i915_state_inlines.h" +#include "i915_context.h" +#include "i915_reg.h" +#include "i915_state.h" +#include "util/u_math.h" +#include "util/u_memory.h" +#include "util/u_pack_color.h" + +#define FILE_DEBUG_FLAG DEBUG_STATE + +/* State that we have chosen to store in the DYNAMIC segment of the + * i915 indirect state mechanism. + * + * Can't cache these in the way we do the static state, as there is no + * start/size in the command packet, instead an 'end' value that gets + * incremented. + * + * Additionally, there seems to be a requirement to re-issue the full + * (active) state every time a 4kb boundary is crossed. + */ + +static INLINE void set_dynamic_indirect( struct i915_context *i915, + unsigned offset, + const unsigned *src, + unsigned dwords ) +{ + unsigned i; + + for (i = 0; i < dwords; i++) + i915->current.dynamic[offset + i] = src[i]; + + i915->hardware_dirty |= I915_HW_DYNAMIC; +} + + +/*********************************************************************** + * Modes4: stencil masks and logicop + */ +static void upload_MODES4( struct i915_context *i915 ) +{ + unsigned modes4 = 0; + + /* I915_NEW_STENCIL */ + modes4 |= i915->depth_stencil->stencil_modes4; + /* I915_NEW_BLEND */ + modes4 |= i915->blend->modes4; + + /* Always, so that we know when state is in-active: + */ + set_dynamic_indirect( i915, + I915_DYNAMIC_MODES4, + &modes4, + 1 ); +} + +const struct i915_tracked_state i915_upload_MODES4 = { + I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL, + upload_MODES4 +}; + + + + +/*********************************************************************** + */ + +static void upload_BFO( struct i915_context *i915 ) +{ + set_dynamic_indirect( i915, + I915_DYNAMIC_BFO_0, + &(i915->depth_stencil->bfo[0]), + 2 ); +} + +const struct i915_tracked_state i915_upload_BFO = { + I915_NEW_DEPTH_STENCIL, + upload_BFO +}; + + +/*********************************************************************** + */ + + +static void upload_BLENDCOLOR( struct i915_context *i915 ) +{ + unsigned bc[2]; + + memset( bc, 0, sizeof(bc) ); + + /* I915_NEW_BLEND {_COLOR} + */ + { + const float *color = i915->blend_color.color; + + bc[0] = _3DSTATE_CONST_BLEND_COLOR_CMD; + bc[1] = pack_ui32_float4( color[0], + color[1], + color[2], + color[3] ); + } + + set_dynamic_indirect( i915, + I915_DYNAMIC_BC_0, + bc, + 2 ); +} + +const struct i915_tracked_state i915_upload_BLENDCOLOR = { + I915_NEW_BLEND, + upload_BLENDCOLOR +}; + +/*********************************************************************** + */ + + +static void upload_IAB( struct i915_context *i915 ) +{ + unsigned iab = i915->blend->iab; + + + set_dynamic_indirect( i915, + I915_DYNAMIC_IAB, + &iab, + 1 ); +} + +const struct i915_tracked_state i915_upload_IAB = { + I915_NEW_BLEND, + upload_IAB +}; + + +/*********************************************************************** + */ + + + +static void upload_DEPTHSCALE( struct i915_context *i915 ) +{ + set_dynamic_indirect( i915, + I915_DYNAMIC_DEPTHSCALE_0, + &(i915->rasterizer->ds[0].u), + 2 ); +} + +const struct i915_tracked_state i915_upload_DEPTHSCALE = { + I915_NEW_RASTERIZER, + upload_DEPTHSCALE +}; + + + +/*********************************************************************** + * Polygon stipple + * + * The i915 supports a 4x4 stipple natively, GL wants 32x32. + * Fortunately stipple is usually a repeating pattern. + * + * XXX: does stipple pattern need to be adjusted according to + * the window position? + * + * XXX: possibly need workaround for conform paths test. + */ + +static void upload_STIPPLE( struct i915_context *i915 ) +{ + unsigned st[2]; + + st[0] = _3DSTATE_STIPPLE; + st[1] = 0; + + /* I915_NEW_RASTERIZER + */ + st[1] |= i915->rasterizer->st; + + + /* I915_NEW_STIPPLE + */ + { + const ubyte *mask = (const ubyte *)i915->poly_stipple.stipple; + ubyte p[4]; + + p[0] = mask[12] & 0xf; + p[1] = mask[8] & 0xf; + p[2] = mask[4] & 0xf; + p[3] = mask[0] & 0xf; + + /* Not sure what to do about fallbacks, so for now just dont: + */ + st[1] |= ((p[0] << 0) | + (p[1] << 4) | + (p[2] << 8) | + (p[3] << 12)); + } + + + set_dynamic_indirect( i915, + I915_DYNAMIC_STP_0, + &st[0], + 2 ); +} + + +const struct i915_tracked_state i915_upload_STIPPLE = { + I915_NEW_RASTERIZER | I915_NEW_STIPPLE, + upload_STIPPLE +}; + + + +/*********************************************************************** + * Scissor. + */ +static void upload_SCISSOR_ENABLE( struct i915_context *i915 ) +{ + set_dynamic_indirect( i915, + I915_DYNAMIC_SC_ENA_0, + &(i915->rasterizer->sc[0]), + 1 ); +} + +const struct i915_tracked_state i915_upload_SCISSOR_ENABLE = { + I915_NEW_RASTERIZER, + upload_SCISSOR_ENABLE +}; + + + +static void upload_SCISSOR_RECT( struct i915_context *i915 ) +{ + unsigned x1 = i915->scissor.minx; + unsigned y1 = i915->scissor.miny; + unsigned x2 = i915->scissor.maxx; + unsigned y2 = i915->scissor.maxy; + unsigned sc[3]; + + sc[0] = _3DSTATE_SCISSOR_RECT_0_CMD; + sc[1] = (y1 << 16) | (x1 & 0xffff); + sc[2] = (y2 << 16) | (x2 & 0xffff); + + set_dynamic_indirect( i915, + I915_DYNAMIC_SC_RECT_0, + &sc[0], + 3 ); +} + + +const struct i915_tracked_state i915_upload_SCISSOR_RECT = { + I915_NEW_SCISSOR, + upload_SCISSOR_RECT +}; + + + + + + +static const struct i915_tracked_state *atoms[] = { + &i915_upload_MODES4, + &i915_upload_BFO, + &i915_upload_BLENDCOLOR, + &i915_upload_IAB, + &i915_upload_DEPTHSCALE, + &i915_upload_STIPPLE, + &i915_upload_SCISSOR_ENABLE, + &i915_upload_SCISSOR_RECT +}; + +/* These will be dynamic indirect state commands, but for now just end + * up on the batch buffer with everything else. + */ +void i915_update_dynamic( struct i915_context *i915 ) +{ + int i; + + for (i = 0; i < Elements(atoms); i++) + if (i915->dirty & atoms[i]->dirty) + atoms[i]->update( i915 ); +} + diff --git a/src/gallium/drivers/i915/i915_state_emit.c b/src/gallium/drivers/i915/i915_state_emit.c new file mode 100644 index 0000000000..a3d4e3b04e --- /dev/null +++ b/src/gallium/drivers/i915/i915_state_emit.c @@ -0,0 +1,402 @@ +/************************************************************************** + * + * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + + +#include "i915_reg.h" +#include "i915_context.h" +#include "i915_batch.h" +#include "i915_reg.h" + +#include "pipe/p_context.h" +#include "pipe/p_defines.h" + +static unsigned translate_format( enum pipe_format format ) +{ + switch (format) { + case PIPE_FORMAT_A8R8G8B8_UNORM: + return COLOR_BUF_ARGB8888; + case PIPE_FORMAT_R5G6B5_UNORM: + return COLOR_BUF_RGB565; + default: + assert(0); + return 0; + } +} + +static unsigned translate_depth_format( enum pipe_format zformat ) +{ + switch (zformat) { + case PIPE_FORMAT_S8Z24_UNORM: + return DEPTH_FRMT_24_FIXED_8_OTHER; + case PIPE_FORMAT_Z16_UNORM: + return DEPTH_FRMT_16_FIXED; + default: + assert(0); + return 0; + } +} + + +/** + * Examine framebuffer state to determine width, height. + */ +static boolean +framebuffer_size(const struct pipe_framebuffer_state *fb, + uint *width, uint *height) +{ + if (fb->cbufs[0]) { + *width = fb->cbufs[0]->width; + *height = fb->cbufs[0]->height; + return TRUE; + } + else if (fb->zsbuf) { + *width = fb->zsbuf->width; + *height = fb->zsbuf->height; + return TRUE; + } + else { + *width = *height = 0; + return FALSE; + } +} + + +/* Push the state into the sarea and/or texture memory. + */ +void +i915_emit_hardware_state(struct i915_context *i915 ) +{ + /* XXX: there must be an easier way */ + const unsigned dwords = ( 14 + + 7 + + I915_MAX_DYNAMIC + + 8 + + 2 + I915_TEX_UNITS*3 + + 2 + I915_TEX_UNITS*3 + + 2 + I915_MAX_CONSTANT*4 + +#if 0 + i915->current.program_len + +#else + i915->fs->program_len + +#endif + 6 + ) * 3/2; /* plus 50% margin */ + const unsigned relocs = ( I915_TEX_UNITS + + 3 + ) * 3/2; /* plus 50% margin */ + +#if 0 + debug_printf("i915_emit_hardware_state: %d dwords, %d relocs\n", dwords, relocs); +#endif + + if(!BEGIN_BATCH(dwords, relocs)) { + FLUSH_BATCH(NULL); + assert(BEGIN_BATCH(dwords, relocs)); + } + + /* 14 dwords, 0 relocs */ + if (i915->hardware_dirty & I915_HW_INVARIENT) + { + OUT_BATCH(_3DSTATE_AA_CMD | + AA_LINE_ECAAR_WIDTH_ENABLE | + AA_LINE_ECAAR_WIDTH_1_0 | + AA_LINE_REGION_WIDTH_ENABLE | AA_LINE_REGION_WIDTH_1_0); + + OUT_BATCH(_3DSTATE_DFLT_DIFFUSE_CMD); + OUT_BATCH(0); + + OUT_BATCH(_3DSTATE_DFLT_SPEC_CMD); + OUT_BATCH(0); + + OUT_BATCH(_3DSTATE_DFLT_Z_CMD); + OUT_BATCH(0); + + OUT_BATCH(_3DSTATE_COORD_SET_BINDINGS | + CSB_TCB(0, 0) | + CSB_TCB(1, 1) | + CSB_TCB(2, 2) | + CSB_TCB(3, 3) | + CSB_TCB(4, 4) | + CSB_TCB(5, 5) | + CSB_TCB(6, 6) | + CSB_TCB(7, 7)); + + OUT_BATCH(_3DSTATE_RASTER_RULES_CMD | + ENABLE_POINT_RASTER_RULE | + OGL_POINT_RASTER_RULE | + ENABLE_LINE_STRIP_PROVOKE_VRTX | + ENABLE_TRI_FAN_PROVOKE_VRTX | + LINE_STRIP_PROVOKE_VRTX(1) | + TRI_FAN_PROVOKE_VRTX(2) | + ENABLE_TEXKILL_3D_4D | + TEXKILL_4D); + + /* Need to initialize this to zero. + */ + OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(3) | (0)); + OUT_BATCH(0); + + OUT_BATCH(_3DSTATE_DEPTH_SUBRECT_DISABLE); + + /* disable indirect state for now + */ + OUT_BATCH(_3DSTATE_LOAD_INDIRECT | 0); + OUT_BATCH(0); + } + + /* 7 dwords, 1 relocs */ + if (i915->hardware_dirty & I915_HW_IMMEDIATE) + { + OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | + I1_LOAD_S(0) | + I1_LOAD_S(1) | + I1_LOAD_S(2) | + I1_LOAD_S(4) | + I1_LOAD_S(5) | + I1_LOAD_S(6) | + (5)); + + if(i915->vbo) + OUT_RELOC(i915->vbo, + INTEL_USAGE_VERTEX, + i915->current.immediate[I915_IMMEDIATE_S0]); + else + /* FIXME: we should not do this */ + OUT_BATCH(0); + OUT_BATCH(i915->current.immediate[I915_IMMEDIATE_S1]); + OUT_BATCH(i915->current.immediate[I915_IMMEDIATE_S2]); + OUT_BATCH(i915->current.immediate[I915_IMMEDIATE_S4]); + OUT_BATCH(i915->current.immediate[I915_IMMEDIATE_S5]); + OUT_BATCH(i915->current.immediate[I915_IMMEDIATE_S6]); + } + + /* I915_MAX_DYNAMIC dwords, 0 relocs */ + if (i915->hardware_dirty & I915_HW_DYNAMIC) + { + int i; + for (i = 0; i < I915_MAX_DYNAMIC; i++) { + OUT_BATCH(i915->current.dynamic[i]); + } + } + + /* 8 dwords, 2 relocs */ + if (i915->hardware_dirty & I915_HW_STATIC) + { + struct pipe_surface *cbuf_surface = i915->framebuffer.cbufs[0]; + struct pipe_surface *depth_surface = i915->framebuffer.zsbuf; + + if (cbuf_surface) { + unsigned ctile = BUF_3D_USE_FENCE; + struct i915_texture *tex = (struct i915_texture *) + cbuf_surface->texture; + assert(tex); + + if (tex && tex->sw_tiled) { + ctile = BUF_3D_TILED_SURFACE; + } + + OUT_BATCH(_3DSTATE_BUF_INFO_CMD); + + OUT_BATCH(BUF_3D_ID_COLOR_BACK | + BUF_3D_PITCH(tex->stride) | /* pitch in bytes */ + ctile); + + OUT_RELOC(tex->buffer, + INTEL_USAGE_RENDER, + cbuf_surface->offset); + } + + /* What happens if no zbuf?? + */ + if (depth_surface) { + unsigned ztile = BUF_3D_USE_FENCE; + struct i915_texture *tex = (struct i915_texture *) + depth_surface->texture; + assert(tex); + + if (tex && tex->sw_tiled) { + ztile = BUF_3D_TILED_SURFACE; + } + + OUT_BATCH(_3DSTATE_BUF_INFO_CMD); + + OUT_BATCH(BUF_3D_ID_DEPTH | + BUF_3D_PITCH(tex->stride) | /* pitch in bytes */ + ztile); + + OUT_RELOC(tex->buffer, + INTEL_USAGE_RENDER, + depth_surface->offset); + } + + { + unsigned cformat, zformat = 0; + + if (cbuf_surface) + cformat = cbuf_surface->format; + else + cformat = PIPE_FORMAT_A8R8G8B8_UNORM; /* arbitrary */ + cformat = translate_format(cformat); + + if (depth_surface) + zformat = translate_depth_format( i915->framebuffer.zsbuf->format ); + + OUT_BATCH(_3DSTATE_DST_BUF_VARS_CMD); + OUT_BATCH(DSTORG_HORT_BIAS(0x8) | /* .5 */ + DSTORG_VERT_BIAS(0x8) | /* .5 */ + LOD_PRECLAMP_OGL | + TEX_DEFAULT_COLOR_OGL | + cformat | + zformat ); + } + } + +#if 01 + /* texture images */ + /* 2 + I915_TEX_UNITS*3 dwords, I915_TEX_UNITS relocs */ + if (i915->hardware_dirty & (I915_HW_MAP | I915_HW_SAMPLER)) + { + const uint nr = i915->current.sampler_enable_nr; + if (nr) { + const uint enabled = i915->current.sampler_enable_flags; + uint unit; + uint count = 0; + OUT_BATCH(_3DSTATE_MAP_STATE | (3 * nr)); + OUT_BATCH(enabled); + for (unit = 0; unit < I915_TEX_UNITS; unit++) { + if (enabled & (1 << unit)) { + struct intel_buffer *buf = i915->texture[unit]->buffer; + uint offset = 0; + assert(buf); + + count++; + + OUT_RELOC(buf, INTEL_USAGE_SAMPLER, offset); + OUT_BATCH(i915->current.texbuffer[unit][0]); /* MS3 */ + OUT_BATCH(i915->current.texbuffer[unit][1]); /* MS4 */ + } + } + assert(count == nr); + } + } +#endif + +#if 01 + /* samplers */ + /* 2 + I915_TEX_UNITS*3 dwords, 0 relocs */ + if (i915->hardware_dirty & I915_HW_SAMPLER) + { + if (i915->current.sampler_enable_nr) { + int i; + + OUT_BATCH( _3DSTATE_SAMPLER_STATE | + (3 * i915->current.sampler_enable_nr) ); + + OUT_BATCH( i915->current.sampler_enable_flags ); + + for (i = 0; i < I915_TEX_UNITS; i++) { + if (i915->current.sampler_enable_flags & (1<current.sampler[i][0] ); + OUT_BATCH( i915->current.sampler[i][1] ); + OUT_BATCH( i915->current.sampler[i][2] ); + } + } + } + } +#endif + + /* constants */ + /* 2 + I915_MAX_CONSTANT*4 dwords, 0 relocs */ + if (i915->hardware_dirty & I915_HW_PROGRAM) + { + /* Collate the user-defined constants with the fragment shader's + * immediates according to the constant_flags[] array. + */ + const uint nr = i915->fs->num_constants; + if (nr) { + uint i; + + OUT_BATCH( _3DSTATE_PIXEL_SHADER_CONSTANTS | (nr * 4) ); + OUT_BATCH( (1 << (nr - 1)) | ((1 << (nr - 1)) - 1) ); + + for (i = 0; i < nr; i++) { + const uint *c; + if (i915->fs->constant_flags[i] == I915_CONSTFLAG_USER) { + /* grab user-defined constant */ + c = (uint *) i915->current.constants[PIPE_SHADER_FRAGMENT][i]; + } + else { + /* emit program constant */ + c = (uint *) i915->fs->constants[i]; + } +#if 0 /* debug */ + { + float *f = (float *) c; + printf("Const %2d: %f %f %f %f %s\n", i, f[0], f[1], f[2], f[3], + (i915->fs->constant_flags[i] == I915_CONSTFLAG_USER + ? "user" : "immediate")); + } +#endif + OUT_BATCH(*c++); + OUT_BATCH(*c++); + OUT_BATCH(*c++); + OUT_BATCH(*c++); + } + } + } + + /* Fragment program */ + /* i915->current.program_len dwords, 0 relocs */ + if (i915->hardware_dirty & I915_HW_PROGRAM) + { + uint i; + /* we should always have, at least, a pass-through program */ + assert(i915->fs->program_len > 0); + for (i = 0; i < i915->fs->program_len; i++) { + OUT_BATCH(i915->fs->program[i]); + } + } + + /* drawing surface size */ + /* 6 dwords, 0 relocs */ + { + uint w, h; + boolean k = framebuffer_size(&i915->framebuffer, &w, &h); + (void)k; + assert(k); + + OUT_BATCH(_3DSTATE_DRAW_RECT_CMD); + OUT_BATCH(0); + OUT_BATCH(0); + OUT_BATCH(((w - 1) & 0xffff) | ((h - 1) << 16)); + OUT_BATCH(0); + OUT_BATCH(0); + } + + + i915->hardware_dirty = 0; +} diff --git a/src/gallium/drivers/i915/i915_state_immediate.c b/src/gallium/drivers/i915/i915_state_immediate.c new file mode 100644 index 0000000000..8c16bb4e27 --- /dev/null +++ b/src/gallium/drivers/i915/i915_state_immediate.c @@ -0,0 +1,225 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * 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: + * Keith Whitwell + */ + +#include "i915_state_inlines.h" +#include "i915_context.h" +#include "i915_state.h" +#include "i915_reg.h" +#include "util/u_memory.h" + + +/* All state expressable with the LOAD_STATE_IMMEDIATE_1 packet. + * Would like to opportunistically recombine all these fragments into + * a single packet containing only what has changed, but for now emit + * as multiple packets. + */ + + + + +/*********************************************************************** + * S0,S1: Vertex buffer state. + */ +static void upload_S0S1(struct i915_context *i915) +{ + unsigned LIS0, LIS1; + + /* INTEL_NEW_VBO */ + /* TODO: re-use vertex buffers here? */ + LIS0 = i915->vbo_offset; + + /* INTEL_NEW_VERTEX_SIZE -- do this where the vertex size is calculated! + */ + { + unsigned vertex_size = i915->current.vertex_info.size; + + LIS1 = ((vertex_size << 24) | + (vertex_size << 16)); + } + + /* INTEL_NEW_VBO */ + /* TODO: use a vertex generation number to track vbo changes */ + if (1 || + i915->current.immediate[I915_IMMEDIATE_S0] != LIS0 || + i915->current.immediate[I915_IMMEDIATE_S1] != LIS1) + { + i915->current.immediate[I915_IMMEDIATE_S0] = LIS0; + i915->current.immediate[I915_IMMEDIATE_S1] = LIS1; + i915->hardware_dirty |= I915_HW_IMMEDIATE; + } +} + +const struct i915_tracked_state i915_upload_S0S1 = { + I915_NEW_VBO | I915_NEW_VERTEX_FORMAT, + upload_S0S1 +}; + + + + +/*********************************************************************** + * S4: Vertex format, rasterization state + */ +static void upload_S2S4(struct i915_context *i915) +{ + unsigned LIS2, LIS4; + + /* I915_NEW_VERTEX_FORMAT */ + { + LIS2 = i915->current.vertex_info.hwfmt[1]; + LIS4 = i915->current.vertex_info.hwfmt[0]; + /* + debug_printf("LIS2: 0x%x LIS4: 0x%x\n", LIS2, LIS4); + */ + assert(LIS4); /* should never be zero? */ + } + + LIS4 |= i915->rasterizer->LIS4; + + if (LIS2 != i915->current.immediate[I915_IMMEDIATE_S2] || + LIS4 != i915->current.immediate[I915_IMMEDIATE_S4]) { + + i915->current.immediate[I915_IMMEDIATE_S2] = LIS2; + i915->current.immediate[I915_IMMEDIATE_S4] = LIS4; + i915->hardware_dirty |= I915_HW_IMMEDIATE; + } +} + + +const struct i915_tracked_state i915_upload_S2S4 = { + I915_NEW_RASTERIZER | I915_NEW_VERTEX_FORMAT, + upload_S2S4 +}; + + + +/*********************************************************************** + * + */ +static void upload_S5( struct i915_context *i915 ) +{ + unsigned LIS5 = 0; + + LIS5 |= i915->depth_stencil->stencil_LIS5; + + LIS5 |= i915->blend->LIS5; + +#if 0 + /* I915_NEW_RASTERIZER */ + if (i915->state.Polygon->OffsetFill) { + LIS5 |= S5_GLOBAL_DEPTH_OFFSET_ENABLE; + } +#endif + + + if (LIS5 != i915->current.immediate[I915_IMMEDIATE_S5]) { + i915->current.immediate[I915_IMMEDIATE_S5] = LIS5; + i915->hardware_dirty |= I915_HW_IMMEDIATE; + } +} + +const struct i915_tracked_state i915_upload_S5 = { + (I915_NEW_DEPTH_STENCIL | I915_NEW_BLEND | I915_NEW_RASTERIZER), + upload_S5 +}; + + +/*********************************************************************** + */ +static void upload_S6( struct i915_context *i915 ) +{ + unsigned LIS6 = (2 << S6_TRISTRIP_PV_SHIFT); + + /* I915_NEW_FRAMEBUFFER + */ + if (i915->framebuffer.cbufs[0]) + LIS6 |= S6_COLOR_WRITE_ENABLE; + + /* I915_NEW_BLEND + */ + LIS6 |= i915->blend->LIS6; + + /* I915_NEW_DEPTH + */ + LIS6 |= i915->depth_stencil->depth_LIS6; + + if (LIS6 != i915->current.immediate[I915_IMMEDIATE_S6]) { + i915->current.immediate[I915_IMMEDIATE_S6] = LIS6; + i915->hardware_dirty |= I915_HW_IMMEDIATE; + } +} + +const struct i915_tracked_state i915_upload_S6 = { + I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL | I915_NEW_FRAMEBUFFER, + upload_S6 +}; + + +/*********************************************************************** + */ +static void upload_S7( struct i915_context *i915 ) +{ + unsigned LIS7; + + /* I915_NEW_RASTERIZER + */ + LIS7 = i915->rasterizer->LIS7; + + if (LIS7 != i915->current.immediate[I915_IMMEDIATE_S7]) { + i915->current.immediate[I915_IMMEDIATE_S7] = LIS7; + i915->hardware_dirty |= I915_HW_IMMEDIATE; + } +} + +const struct i915_tracked_state i915_upload_S7 = { + I915_NEW_RASTERIZER, + upload_S7 +}; + + +static const struct i915_tracked_state *atoms[] = { + &i915_upload_S0S1, + &i915_upload_S2S4, + &i915_upload_S5, + &i915_upload_S6, + &i915_upload_S7 +}; + +/* + */ +void i915_update_immediate( struct i915_context *i915 ) +{ + int i; + + for (i = 0; i < Elements(atoms); i++) + if (i915->dirty & atoms[i]->dirty) + atoms[i]->update( i915 ); +} diff --git a/src/gallium/drivers/i915/i915_state_inlines.h b/src/gallium/drivers/i915/i915_state_inlines.h new file mode 100644 index 0000000000..378de8f9c4 --- /dev/null +++ b/src/gallium/drivers/i915/i915_state_inlines.h @@ -0,0 +1,230 @@ +/************************************************************************** + * + * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef I915_STATE_INLINES_H +#define I915_STATE_INLINES_H + +#include "pipe/p_compiler.h" +#include "pipe/p_defines.h" +#include "i915_reg.h" + + +static INLINE unsigned +i915_translate_compare_func(unsigned func) +{ + switch (func) { + case PIPE_FUNC_NEVER: + return COMPAREFUNC_NEVER; + case PIPE_FUNC_LESS: + return COMPAREFUNC_LESS; + case PIPE_FUNC_LEQUAL: + return COMPAREFUNC_LEQUAL; + case PIPE_FUNC_GREATER: + return COMPAREFUNC_GREATER; + case PIPE_FUNC_GEQUAL: + return COMPAREFUNC_GEQUAL; + case PIPE_FUNC_NOTEQUAL: + return COMPAREFUNC_NOTEQUAL; + case PIPE_FUNC_EQUAL: + return COMPAREFUNC_EQUAL; + case PIPE_FUNC_ALWAYS: + return COMPAREFUNC_ALWAYS; + default: + return COMPAREFUNC_ALWAYS; + } +} + +static INLINE unsigned +i915_translate_stencil_op(unsigned op) +{ + switch (op) { + case PIPE_STENCIL_OP_KEEP: + return STENCILOP_KEEP; + case PIPE_STENCIL_OP_ZERO: + return STENCILOP_ZERO; + case PIPE_STENCIL_OP_REPLACE: + return STENCILOP_REPLACE; + case PIPE_STENCIL_OP_INCR: + return STENCILOP_INCRSAT; + case PIPE_STENCIL_OP_DECR: + return STENCILOP_DECRSAT; + case PIPE_STENCIL_OP_INCR_WRAP: + return STENCILOP_INCR; + case PIPE_STENCIL_OP_DECR_WRAP: + return STENCILOP_DECR; + case PIPE_STENCIL_OP_INVERT: + return STENCILOP_INVERT; + default: + return STENCILOP_ZERO; + } +} + +static INLINE unsigned +i915_translate_blend_factor(unsigned factor) +{ + switch (factor) { + case PIPE_BLENDFACTOR_ZERO: + return BLENDFACT_ZERO; + case PIPE_BLENDFACTOR_SRC_ALPHA: + return BLENDFACT_SRC_ALPHA; + case PIPE_BLENDFACTOR_ONE: + return BLENDFACT_ONE; + case PIPE_BLENDFACTOR_SRC_COLOR: + return BLENDFACT_SRC_COLR; + case PIPE_BLENDFACTOR_INV_SRC_COLOR: + return BLENDFACT_INV_SRC_COLR; + case PIPE_BLENDFACTOR_DST_COLOR: + return BLENDFACT_DST_COLR; + case PIPE_BLENDFACTOR_INV_DST_COLOR: + return BLENDFACT_INV_DST_COLR; + case PIPE_BLENDFACTOR_INV_SRC_ALPHA: + return BLENDFACT_INV_SRC_ALPHA; + case PIPE_BLENDFACTOR_DST_ALPHA: + return BLENDFACT_DST_ALPHA; + case PIPE_BLENDFACTOR_INV_DST_ALPHA: + return BLENDFACT_INV_DST_ALPHA; + case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: + return BLENDFACT_SRC_ALPHA_SATURATE; + case PIPE_BLENDFACTOR_CONST_COLOR: + return BLENDFACT_CONST_COLOR; + case PIPE_BLENDFACTOR_INV_CONST_COLOR: + return BLENDFACT_INV_CONST_COLOR; + case PIPE_BLENDFACTOR_CONST_ALPHA: + return BLENDFACT_CONST_ALPHA; + case PIPE_BLENDFACTOR_INV_CONST_ALPHA: + return BLENDFACT_INV_CONST_ALPHA; + default: + return BLENDFACT_ZERO; + } +} + +static INLINE unsigned +i915_translate_blend_func(unsigned mode) +{ + switch (mode) { + case PIPE_BLEND_ADD: + return BLENDFUNC_ADD; + case PIPE_BLEND_MIN: + return BLENDFUNC_MIN; + case PIPE_BLEND_MAX: + return BLENDFUNC_MAX; + case PIPE_BLEND_SUBTRACT: + return BLENDFUNC_SUBTRACT; + case PIPE_BLEND_REVERSE_SUBTRACT: + return BLENDFUNC_REVERSE_SUBTRACT; + default: + return 0; + } +} + + +static INLINE unsigned +i915_translate_logic_op(unsigned opcode) +{ + switch (opcode) { + case PIPE_LOGICOP_CLEAR: + return LOGICOP_CLEAR; + case PIPE_LOGICOP_AND: + return LOGICOP_AND; + case PIPE_LOGICOP_AND_REVERSE: + return LOGICOP_AND_RVRSE; + case PIPE_LOGICOP_COPY: + return LOGICOP_COPY; + case PIPE_LOGICOP_COPY_INVERTED: + return LOGICOP_COPY_INV; + case PIPE_LOGICOP_AND_INVERTED: + return LOGICOP_AND_INV; + case PIPE_LOGICOP_NOOP: + return LOGICOP_NOOP; + case PIPE_LOGICOP_XOR: + return LOGICOP_XOR; + case PIPE_LOGICOP_OR: + return LOGICOP_OR; + case PIPE_LOGICOP_OR_INVERTED: + return LOGICOP_OR_INV; + case PIPE_LOGICOP_NOR: + return LOGICOP_NOR; + case PIPE_LOGICOP_EQUIV: + return LOGICOP_EQUIV; + case PIPE_LOGICOP_INVERT: + return LOGICOP_INV; + case PIPE_LOGICOP_OR_REVERSE: + return LOGICOP_OR_RVRSE; + case PIPE_LOGICOP_NAND: + return LOGICOP_NAND; + case PIPE_LOGICOP_SET: + return LOGICOP_SET; + default: + return LOGICOP_SET; + } +} + + + +static INLINE boolean i915_validate_vertices( unsigned hw_prim, unsigned nr ) +{ + boolean ok; + + switch (hw_prim) { + case PRIM3D_POINTLIST: + ok = (nr >= 1); + assert(ok); + break; + case PRIM3D_LINELIST: + ok = (nr >= 2) && (nr % 2) == 0; + assert(ok); + break; + case PRIM3D_LINESTRIP: + ok = (nr >= 2); + assert(ok); + break; + case PRIM3D_TRILIST: + ok = (nr >= 3) && (nr % 3) == 0; + assert(ok); + break; + case PRIM3D_TRISTRIP: + ok = (nr >= 3); + assert(ok); + break; + case PRIM3D_TRIFAN: + ok = (nr >= 3); + assert(ok); + break; + case PRIM3D_POLY: + ok = (nr >= 3); + assert(ok); + break; + default: + assert(0); + ok = 0; + break; + } + + return ok; +} + +#endif diff --git a/src/gallium/drivers/i915/i915_state_sampler.c b/src/gallium/drivers/i915/i915_state_sampler.c new file mode 100644 index 0000000000..c5e9084d12 --- /dev/null +++ b/src/gallium/drivers/i915/i915_state_sampler.c @@ -0,0 +1,299 @@ +/************************************************************************** + * + * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include "pipe/p_context.h" +#include "pipe/p_state.h" +#include "util/u_memory.h" + +#include "i915_state_inlines.h" +#include "i915_context.h" +#include "i915_reg.h" +#include "i915_state.h" + + +/* + * A note about min_lod & max_lod. + * + * There is a circular dependancy between the sampler state + * and the map state to be submitted to hw. + * + * Two condition must be meet: + * min_lod =< max_lod == true + * max_lod =< last_level == true + * + * + * This is all fine and dandy if it where for the fact that max_lod + * is set on the map state instead of the sampler state. That is + * the max_lod we submit on map is: + * max_lod = MIN2(last_level, max_lod); + * + * So we need to update the map state when we change samplers and + * we need to be change the sampler state when map state is changed. + * The first part is done by calling i915_update_texture in + * i915_update_samplers and the second part is done else where in + * code tracking the state changes. + */ + +static void +i915_update_texture(struct i915_context *i915, + uint unit, + const struct i915_texture *tex, + const struct i915_sampler_state *sampler, + uint state[6]); +/** + * Compute i915 texture sampling state. + * + * Recalculate all state from scratch. Perhaps not the most + * efficient, but this has gotten complex enough that we need + * something which is understandable and reliable. + * \param state returns the 3 words of compute state + */ +static void update_sampler(struct i915_context *i915, + uint unit, + const struct i915_sampler_state *sampler, + const struct i915_texture *tex, + unsigned state[3] ) +{ + const struct pipe_texture *pt = &tex->base; + unsigned minlod, lastlod; + + /* Need to do this after updating the maps, which call the + * intel_finalize_mipmap_tree and hence can update firstLevel: + */ + state[0] = sampler->state[0]; + state[1] = sampler->state[1]; + state[2] = sampler->state[2]; + + if (pt->format == PIPE_FORMAT_YCBCR || + pt->format == PIPE_FORMAT_YCBCR_REV) + state[0] |= SS2_COLORSPACE_CONVERSION; + + /* 3D textures don't seem to respect the border color. + * Fallback if there's ever a danger that they might refer to + * it. + * + * Effectively this means fallback on 3D clamp or + * clamp_to_border. + * + * XXX: Check if this is true on i945. + * XXX: Check if this bug got fixed in release silicon. + */ +#if 0 + { + const unsigned ws = sampler->templ->wrap_s; + const unsigned wt = sampler->templ->wrap_t; + const unsigned wr = sampler->templ->wrap_r; + if (pt->target == PIPE_TEXTURE_3D && + (sampler->templ->min_img_filter != PIPE_TEX_FILTER_NEAREST || + sampler->templ->mag_img_filter != PIPE_TEX_FILTER_NEAREST) && + (ws == PIPE_TEX_WRAP_CLAMP || + wt == PIPE_TEX_WRAP_CLAMP || + wr == PIPE_TEX_WRAP_CLAMP || + ws == PIPE_TEX_WRAP_CLAMP_TO_BORDER || + wt == PIPE_TEX_WRAP_CLAMP_TO_BORDER || + wr == PIPE_TEX_WRAP_CLAMP_TO_BORDER)) { + if (i915->conformance_mode > 0) { + assert(0); + /* sampler->fallback = true; */ + /* TODO */ + } + } + } +#endif + + /* See note at the top of file */ + minlod = sampler->minlod; + lastlod = pt->last_level << 4; + + if (lastlod < minlod) { + minlod = lastlod; + } + + state[1] |= (sampler->minlod << SS3_MIN_LOD_SHIFT); + state[1] |= (unit << SS3_TEXTUREMAP_INDEX_SHIFT); +} + + +void i915_update_samplers( struct i915_context *i915 ) +{ + uint unit; + + i915->current.sampler_enable_nr = 0; + i915->current.sampler_enable_flags = 0x0; + + for (unit = 0; unit < i915->num_textures && unit < i915->num_samplers; + unit++) { + /* determine unit enable/disable by looking for a bound texture */ + /* could also examine the fragment program? */ + if (i915->texture[unit]) { + update_sampler( i915, + unit, + i915->sampler[unit], /* sampler state */ + i915->texture[unit], /* texture */ + i915->current.sampler[unit] /* the result */ + ); + i915_update_texture( i915, + unit, + i915->texture[unit], /* texture */ + i915->sampler[unit], /* sampler state */ + i915->current.texbuffer[unit] ); + + i915->current.sampler_enable_nr++; + i915->current.sampler_enable_flags |= (1 << unit); + } + } + + i915->hardware_dirty |= I915_HW_SAMPLER | I915_HW_MAP; +} + + +static uint +translate_texture_format(enum pipe_format pipeFormat) +{ + switch (pipeFormat) { + case PIPE_FORMAT_L8_UNORM: + return MAPSURF_8BIT | MT_8BIT_L8; + case PIPE_FORMAT_I8_UNORM: + return MAPSURF_8BIT | MT_8BIT_I8; + case PIPE_FORMAT_A8_UNORM: + return MAPSURF_8BIT | MT_8BIT_A8; + case PIPE_FORMAT_A8L8_UNORM: + return MAPSURF_16BIT | MT_16BIT_AY88; + case PIPE_FORMAT_R5G6B5_UNORM: + return MAPSURF_16BIT | MT_16BIT_RGB565; + case PIPE_FORMAT_A1R5G5B5_UNORM: + return MAPSURF_16BIT | MT_16BIT_ARGB1555; + case PIPE_FORMAT_A4R4G4B4_UNORM: + return MAPSURF_16BIT | MT_16BIT_ARGB4444; + case PIPE_FORMAT_A8R8G8B8_UNORM: + return MAPSURF_32BIT | MT_32BIT_ARGB8888; + case PIPE_FORMAT_YCBCR_REV: + return (MAPSURF_422 | MT_422_YCRCB_NORMAL); + case PIPE_FORMAT_YCBCR: + return (MAPSURF_422 | MT_422_YCRCB_SWAPY); +#if 0 + case PIPE_FORMAT_RGB_FXT1: + case PIPE_FORMAT_RGBA_FXT1: + return (MAPSURF_COMPRESSED | MT_COMPRESS_FXT1); +#endif + case PIPE_FORMAT_Z16_UNORM: + return (MAPSURF_16BIT | MT_16BIT_L16); +#if 0 + case PIPE_FORMAT_RGBA_DXT1: + case PIPE_FORMAT_RGB_DXT1: + return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1); + case PIPE_FORMAT_RGBA_DXT3: + return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3); + case PIPE_FORMAT_RGBA_DXT5: + return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5); +#endif + case PIPE_FORMAT_S8Z24_UNORM: + return (MAPSURF_32BIT | MT_32BIT_xI824); + default: + debug_printf("i915: translate_texture_format() bad image format %x\n", + pipeFormat); + assert(0); + return 0; + } +} + + +static void +i915_update_texture(struct i915_context *i915, + uint unit, + const struct i915_texture *tex, + const struct i915_sampler_state *sampler, + uint state[6]) +{ + const struct pipe_texture *pt = &tex->base; + uint format, pitch; + const uint width = pt->width[0], height = pt->height[0], depth = pt->depth[0]; + const uint num_levels = pt->last_level; + unsigned max_lod = num_levels * 4; + unsigned tiled = MS3_USE_FENCE_REGS; + + assert(tex); + assert(width); + assert(height); + assert(depth); + + format = translate_texture_format(pt->format); + pitch = tex->stride; + + assert(format); + assert(pitch); + + if (tex->sw_tiled) { + assert(!((pitch - 1) & pitch)); + tiled = MS3_TILED_SURFACE; + } + + /* MS3 state */ + state[0] = + (((height - 1) << MS3_HEIGHT_SHIFT) + | ((width - 1) << MS3_WIDTH_SHIFT) + | format + | tiled); + + /* + * XXX When min_filter != mag_filter and there's just one mipmap level, + * set max_lod = 1 to make sure i915 chooses between min/mag filtering. + */ + + /* See note at the top of file */ + if (max_lod > (sampler->maxlod >> 2)) + max_lod = sampler->maxlod >> 2; + + /* MS4 state */ + state[1] = + ((((pitch / 4) - 1) << MS4_PITCH_SHIFT) + | MS4_CUBE_FACE_ENA_MASK + | ((max_lod) << MS4_MAX_LOD_SHIFT) + | ((depth - 1) << MS4_VOLUME_DEPTH_SHIFT)); +} + + +void +i915_update_textures(struct i915_context *i915) +{ + uint unit; + + for (unit = 0; unit < i915->num_textures && unit < i915->num_samplers; + unit++) { + /* determine unit enable/disable by looking for a bound texture */ + /* could also examine the fragment program? */ + if (i915->texture[unit]) { + i915_update_texture( i915, + unit, + i915->texture[unit], /* texture */ + i915->sampler[unit], /* sampler state */ + i915->current.texbuffer[unit] ); + } + } + + i915->hardware_dirty |= I915_HW_MAP; +} diff --git a/src/gallium/drivers/i915/i915_surface.c b/src/gallium/drivers/i915/i915_surface.c new file mode 100644 index 0000000000..ab8331f3e6 --- /dev/null +++ b/src/gallium/drivers/i915/i915_surface.c @@ -0,0 +1,94 @@ +/************************************************************************** + * + * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#include "i915_context.h" +#include "i915_blit.h" +#include "i915_state.h" +#include "pipe/p_defines.h" +#include "pipe/p_inlines.h" +#include "pipe/p_inlines.h" +#include "pipe/internal/p_winsys_screen.h" +#include "util/u_tile.h" +#include "util/u_rect.h" + + +/* Assumes all values are within bounds -- no checking at this level - + * do it higher up if required. + */ +static void +i915_surface_copy(struct pipe_context *pipe, + struct pipe_surface *dst, + unsigned dstx, unsigned dsty, + struct pipe_surface *src, + unsigned srcx, unsigned srcy, unsigned width, unsigned height) +{ + struct i915_texture *dst_tex = (struct i915_texture *)dst->texture; + struct i915_texture *src_tex = (struct i915_texture *)src->texture; + + assert( dst != src ); + assert( dst_tex->base.block.size == src_tex->base.block.size ); + assert( dst_tex->base.block.width == src_tex->base.block.height ); + assert( dst_tex->base.block.height == src_tex->base.block.height ); + assert( dst_tex->base.block.width == 1 ); + assert( dst_tex->base.block.height == 1 ); + + i915_copy_blit( i915_context(pipe), + FALSE, + dst_tex->base.block.size, + (unsigned short) src_tex->stride, src_tex->buffer, src->offset, + (unsigned short) dst_tex->stride, dst_tex->buffer, dst->offset, + (short) srcx, (short) srcy, (short) dstx, (short) dsty, (short) width, (short) height ); +} + + +static void +i915_surface_fill(struct pipe_context *pipe, + struct pipe_surface *dst, + unsigned dstx, unsigned dsty, + unsigned width, unsigned height, unsigned value) +{ + struct i915_texture *tex = (struct i915_texture *)dst->texture; + + assert(tex->base.block.width == 1); + assert(tex->base.block.height == 1); + + i915_fill_blit( i915_context(pipe), + tex->base.block.size, + (unsigned short) tex->stride, + tex->buffer, dst->offset, + (short) dstx, (short) dsty, + (short) width, (short) height, + value ); +} + + +void +i915_init_surface_functions(struct i915_context *i915) +{ + i915->base.surface_copy = i915_surface_copy; + i915->base.surface_fill = i915_surface_fill; +} diff --git a/src/gallium/drivers/i915/i915_texture.c b/src/gallium/drivers/i915/i915_texture.c new file mode 100644 index 0000000000..286c9ace8e --- /dev/null +++ b/src/gallium/drivers/i915/i915_texture.c @@ -0,0 +1,958 @@ +/************************************************************************** + * + * Copyright 2006 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. + * + **************************************************************************/ + /* + * Authors: + * Keith Whitwell + * Michel Dänzer + */ + +#include "pipe/p_state.h" +#include "pipe/p_context.h" +#include "pipe/p_defines.h" +#include "pipe/p_inlines.h" +#include "pipe/internal/p_winsys_screen.h" +#include "util/u_math.h" +#include "util/u_memory.h" + +#include "i915_context.h" +#include "i915_texture.h" +#include "i915_debug.h" +#include "i915_screen.h" +#include "intel_winsys.h" + + +/* + * Helper function and arrays + */ + + +/** + * Initial offset for Cube map. + */ +static const int initial_offsets[6][2] = { + {0, 0}, + {0, 2}, + {1, 0}, + {1, 2}, + {1, 1}, + {1, 3} +}; + +/** + * Step offsets for Cube map. + */ +static const int step_offsets[6][2] = { + {0, 2}, + {0, 2}, + {-1, 2}, + {-1, 2}, + {-1, 1}, + {-1, 1} +}; + +static unsigned +power_of_two(unsigned x) +{ + unsigned value = 1; + while (value < x) + value = value << 1; + return value; +} + +static unsigned +round_up(unsigned n, unsigned multiple) +{ + return (n + multiple - 1) & ~(multiple - 1); +} + + +/* + * More advanced helper funcs + */ + + +static void +i915_miptree_set_level_info(struct i915_texture *tex, + unsigned level, + unsigned nr_images, + unsigned w, unsigned h, unsigned d) +{ + struct pipe_texture *pt = &tex->base; + + assert(level < PIPE_MAX_TEXTURE_LEVELS); + + pt->width[level] = w; + pt->height[level] = h; + pt->depth[level] = d; + + pt->nblocksx[level] = pf_get_nblocksx(&pt->block, w); + pt->nblocksy[level] = pf_get_nblocksy(&pt->block, h); + + tex->nr_images[level] = nr_images; + + /* + DBG("%s level %d size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__, + level, w, h, d, x, y, tex->level_offset[level]); + */ + + /* Not sure when this would happen, but anyway: + */ + if (tex->image_offset[level]) { + FREE(tex->image_offset[level]); + tex->image_offset[level] = NULL; + } + + assert(nr_images); + assert(!tex->image_offset[level]); + + tex->image_offset[level] = (unsigned *) MALLOC(nr_images * sizeof(unsigned)); + tex->image_offset[level][0] = 0; +} + +static void +i915_miptree_set_image_offset(struct i915_texture *tex, + unsigned level, unsigned img, unsigned x, unsigned y) +{ + if (img == 0 && level == 0) + assert(x == 0 && y == 0); + + assert(img < tex->nr_images[level]); + + tex->image_offset[level][img] = y * tex->stride + x * tex->base.block.size; + + /* + printf("%s level %d img %d pos %d,%d image_offset %x\n", + __FUNCTION__, level, img, x, y, tex->image_offset[level][img]); + */ +} + + +/* + * i915 layout functions, some used by i945 + */ + + +/** + * Special case to deal with scanout textures. + */ +static boolean +i915_scanout_layout(struct i915_texture *tex) +{ + struct pipe_texture *pt = &tex->base; + + if (pt->last_level > 0 || pt->block.size != 4) + return FALSE; + + i915_miptree_set_level_info(tex, 0, 1, + tex->base.width[0], + tex->base.height[0], + 1); + i915_miptree_set_image_offset(tex, 0, 0, 0, 0); + + if (tex->base.width[0] >= 240) { + tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size); + tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8); + tex->hw_tiled = INTEL_TILE_X; + } else if (tex->base.width[0] == 64 && tex->base.height[0] == 64) { + tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size); + tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8); + } else { + return FALSE; + } + + debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__, + tex->base.width[0], tex->base.height[0], pt->block.size, + tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy); + + return TRUE; +} + +/** + * Special case to deal with shared textures. + */ +static boolean +i915_display_target_layout(struct i915_texture *tex) +{ + struct pipe_texture *pt = &tex->base; + + if (pt->last_level > 0 || pt->block.size != 4) + return FALSE; + + /* fallback to normal textures for small textures */ + if (tex->base.width[0] < 240) + return FALSE; + + i915_miptree_set_level_info(tex, 0, 1, + tex->base.width[0], + tex->base.height[0], + 1); + i915_miptree_set_image_offset(tex, 0, 0, 0, 0); + + tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size); + tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8); + tex->hw_tiled = INTEL_TILE_X; + + debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__, + tex->base.width[0], tex->base.height[0], pt->block.size, + tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy); + + return TRUE; +} + +static void +i915_miptree_layout_2d(struct i915_texture *tex) +{ + struct pipe_texture *pt = &tex->base; + unsigned level; + unsigned width = pt->width[0]; + unsigned height = pt->height[0]; + unsigned nblocksx = pt->nblocksx[0]; + unsigned nblocksy = pt->nblocksy[0]; + + /* used for scanouts that need special layouts */ + if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_PRIMARY) + if (i915_scanout_layout(tex)) + return; + + /* for shared buffers we use some very like scanout */ + if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET) + if (i915_display_target_layout(tex)) + return; + + tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4); + tex->total_nblocksy = 0; + + for (level = 0; level <= pt->last_level; level++) { + i915_miptree_set_level_info(tex, level, 1, width, height, 1); + i915_miptree_set_image_offset(tex, level, 0, 0, tex->total_nblocksy); + + nblocksy = round_up(MAX2(2, nblocksy), 2); + + tex->total_nblocksy += nblocksy; + + width = minify(width); + height = minify(height); + nblocksx = pf_get_nblocksx(&pt->block, width); + nblocksy = pf_get_nblocksy(&pt->block, height); + } +} + +static void +i915_miptree_layout_3d(struct i915_texture *tex) +{ + struct pipe_texture *pt = &tex->base; + unsigned level; + + unsigned width = pt->width[0]; + unsigned height = pt->height[0]; + unsigned depth = pt->depth[0]; + unsigned nblocksx = pt->nblocksx[0]; + unsigned nblocksy = pt->nblocksy[0]; + unsigned stack_nblocksy = 0; + + /* Calculate the size of a single slice. + */ + tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4); + + /* XXX: hardware expects/requires 9 levels at minimum. + */ + for (level = 0; level <= MAX2(8, pt->last_level); level++) { + i915_miptree_set_level_info(tex, level, depth, width, height, depth); + + stack_nblocksy += MAX2(2, nblocksy); + + width = minify(width); + height = minify(height); + depth = minify(depth); + nblocksx = pf_get_nblocksx(&pt->block, width); + nblocksy = pf_get_nblocksy(&pt->block, height); + } + + /* Fixup depth image_offsets: + */ + depth = pt->depth[0]; + for (level = 0; level <= pt->last_level; level++) { + unsigned i; + for (i = 0; i < depth; i++) + i915_miptree_set_image_offset(tex, level, i, 0, i * stack_nblocksy); + + depth = minify(depth); + } + + /* Multiply slice size by texture depth for total size. It's + * remarkable how wasteful of memory the i915 texture layouts + * are. They are largely fixed in the i945. + */ + tex->total_nblocksy = stack_nblocksy * pt->depth[0]; +} + +static void +i915_miptree_layout_cube(struct i915_texture *tex) +{ + struct pipe_texture *pt = &tex->base; + unsigned width = pt->width[0], height = pt->height[0]; + const unsigned nblocks = pt->nblocksx[0]; + unsigned level; + unsigned face; + + assert(width == height); /* cubemap images are square */ + + /* double pitch for cube layouts */ + tex->stride = round_up(nblocks * pt->block.size * 2, 4); + tex->total_nblocksy = nblocks * 4; + + for (level = 0; level <= pt->last_level; level++) { + i915_miptree_set_level_info(tex, level, 6, width, height, 1); + width /= 2; + height /= 2; + } + + for (face = 0; face < 6; face++) { + unsigned x = initial_offsets[face][0] * nblocks; + unsigned y = initial_offsets[face][1] * nblocks; + unsigned d = nblocks; + + for (level = 0; level <= pt->last_level; level++) { + i915_miptree_set_image_offset(tex, level, face, x, y); + d >>= 1; + x += step_offsets[face][0] * d; + y += step_offsets[face][1] * d; + } + } +} + +static boolean +i915_miptree_layout(struct i915_texture * tex) +{ + struct pipe_texture *pt = &tex->base; + + switch (pt->target) { + case PIPE_TEXTURE_1D: + case PIPE_TEXTURE_2D: + i915_miptree_layout_2d(tex); + break; + case PIPE_TEXTURE_3D: + i915_miptree_layout_3d(tex); + break; + case PIPE_TEXTURE_CUBE: + i915_miptree_layout_cube(tex); + break; + default: + assert(0); + return FALSE; + } + + return TRUE; +} + + +/* + * i945 layout functions + */ + + +static void +i945_miptree_layout_2d(struct i915_texture *tex) +{ + struct pipe_texture *pt = &tex->base; + const int align_x = 2, align_y = 4; + unsigned level; + unsigned x = 0; + unsigned y = 0; + unsigned width = pt->width[0]; + unsigned height = pt->height[0]; + unsigned nblocksx = pt->nblocksx[0]; + unsigned nblocksy = pt->nblocksy[0]; + + /* used for scanouts that need special layouts */ + if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_PRIMARY) + if (i915_scanout_layout(tex)) + return; + + /* for shared buffers we use some very like scanout */ + if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET) + if (i915_display_target_layout(tex)) + return; + + tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4); + + /* May need to adjust pitch to accomodate the placement of + * the 2nd mipmap level. This occurs when the alignment + * constraints of mipmap placement push the right edge of the + * 2nd mipmap level out past the width of its parent. + */ + if (pt->last_level > 0) { + unsigned mip1_nblocksx + = align(pf_get_nblocksx(&pt->block, minify(width)), align_x) + + pf_get_nblocksx(&pt->block, minify(minify(width))); + + if (mip1_nblocksx > nblocksx) + tex->stride = mip1_nblocksx * pt->block.size; + } + + /* Pitch must be a whole number of dwords + */ + tex->stride = align(tex->stride, 64); + tex->total_nblocksy = 0; + + for (level = 0; level <= pt->last_level; level++) { + i915_miptree_set_level_info(tex, level, 1, width, height, 1); + i915_miptree_set_image_offset(tex, level, 0, x, y); + + nblocksy = align(nblocksy, align_y); + + /* Because the images are packed better, the final offset + * might not be the maximal one: + */ + tex->total_nblocksy = MAX2(tex->total_nblocksy, y + nblocksy); + + /* Layout_below: step right after second mipmap level. + */ + if (level == 1) { + x += align(nblocksx, align_x); + } + else { + y += nblocksy; + } + + width = minify(width); + height = minify(height); + nblocksx = pf_get_nblocksx(&pt->block, width); + nblocksy = pf_get_nblocksy(&pt->block, height); + } +} + +static void +i945_miptree_layout_3d(struct i915_texture *tex) +{ + struct pipe_texture *pt = &tex->base; + unsigned width = pt->width[0]; + unsigned height = pt->height[0]; + unsigned depth = pt->depth[0]; + unsigned nblocksx = pt->nblocksx[0]; + unsigned nblocksy = pt->nblocksy[0]; + unsigned pack_x_pitch, pack_x_nr; + unsigned pack_y_pitch; + unsigned level; + + tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4); + tex->total_nblocksy = 0; + + pack_y_pitch = MAX2(pt->nblocksy[0], 2); + pack_x_pitch = tex->stride / pt->block.size; + pack_x_nr = 1; + + for (level = 0; level <= pt->last_level; level++) { + int x = 0; + int y = 0; + unsigned q, j; + + i915_miptree_set_level_info(tex, level, depth, width, height, depth); + + for (q = 0; q < depth;) { + for (j = 0; j < pack_x_nr && q < depth; j++, q++) { + i915_miptree_set_image_offset(tex, level, q, x, y + tex->total_nblocksy); + x += pack_x_pitch; + } + + x = 0; + y += pack_y_pitch; + } + + tex->total_nblocksy += y; + + if (pack_x_pitch > 4) { + pack_x_pitch >>= 1; + pack_x_nr <<= 1; + assert(pack_x_pitch * pack_x_nr * pt->block.size <= tex->stride); + } + + if (pack_y_pitch > 2) { + pack_y_pitch >>= 1; + } + + width = minify(width); + height = minify(height); + depth = minify(depth); + nblocksx = pf_get_nblocksx(&pt->block, width); + nblocksy = pf_get_nblocksy(&pt->block, height); + } +} + +static void +i945_miptree_layout_cube(struct i915_texture *tex) +{ + struct pipe_texture *pt = &tex->base; + unsigned level; + + const unsigned nblocks = pt->nblocksx[0]; + unsigned face; + unsigned width = pt->width[0]; + unsigned height = pt->height[0]; + + /* + printf("%s %i, %i\n", __FUNCTION__, pt->width[0], pt->height[0]); + */ + + assert(width == height); /* cubemap images are square */ + + /* + * XXX Should only be used for compressed formats. But lets + * keep this code active just in case. + * + * Depending on the size of the largest images, pitch can be + * determined either by the old-style packing of cubemap faces, + * or the final row of 4x4, 2x2 and 1x1 faces below this. + */ + if (nblocks > 32) + tex->stride = round_up(nblocks * pt->block.size * 2, 4); + else + tex->stride = 14 * 8 * pt->block.size; + + tex->total_nblocksy = nblocks * 4; + + /* Set all the levels to effectively occupy the whole rectangular region. + */ + for (level = 0; level <= pt->last_level; level++) { + i915_miptree_set_level_info(tex, level, 6, width, height, 1); + width /= 2; + height /= 2; + } + + for (face = 0; face < 6; face++) { + unsigned x = initial_offsets[face][0] * nblocks; + unsigned y = initial_offsets[face][1] * nblocks; + unsigned d = nblocks; + +#if 0 /* Fix and enable this code for compressed formats */ + if (nblocks == 4 && face >= 4) { + y = tex->total_height - 4; + x = (face - 4) * 8; + } + else if (nblocks < 4 && (face > 0)) { + y = tex->total_height - 4; + x = face * 8; + } +#endif + + for (level = 0; level <= pt->last_level; level++) { + i915_miptree_set_image_offset(tex, level, face, x, y); + + d >>= 1; + +#if 0 /* Fix and enable this code for compressed formats */ + switch (d) { + case 4: + switch (face) { + case PIPE_TEX_FACE_POS_X: + case PIPE_TEX_FACE_NEG_X: + x += step_offsets[face][0] * d; + y += step_offsets[face][1] * d; + break; + case PIPE_TEX_FACE_POS_Y: + case PIPE_TEX_FACE_NEG_Y: + y += 12; + x -= 8; + break; + case PIPE_TEX_FACE_POS_Z: + case PIPE_TEX_FACE_NEG_Z: + y = tex->total_height - 4; + x = (face - 4) * 8; + break; + } + case 2: + y = tex->total_height - 4; + x = 16 + face * 8; + break; + + case 1: + x += 48; + break; + default: +#endif + x += step_offsets[face][0] * d; + y += step_offsets[face][1] * d; +#if 0 + break; + } +#endif + } + } +} + +static boolean +i945_miptree_layout(struct i915_texture * tex) +{ + struct pipe_texture *pt = &tex->base; + + switch (pt->target) { + case PIPE_TEXTURE_1D: + case PIPE_TEXTURE_2D: + i945_miptree_layout_2d(tex); + break; + case PIPE_TEXTURE_3D: + i945_miptree_layout_3d(tex); + break; + case PIPE_TEXTURE_CUBE: + i945_miptree_layout_cube(tex); + break; + default: + assert(0); + return FALSE; + } + + return TRUE; +} + + +/* + * Screen texture functions + */ + + +static struct pipe_texture * +i915_texture_create(struct pipe_screen *screen, + const struct pipe_texture *templat) +{ + struct i915_screen *is = i915_screen(screen); + struct intel_winsys *iws = is->iws; + struct i915_texture *tex = CALLOC_STRUCT(i915_texture); + size_t tex_size; + unsigned buf_usage = 0; + + if (!tex) + return NULL; + + tex->base = *templat; + pipe_reference_init(&tex->base.reference, 1); + tex->base.screen = screen; + + tex->base.nblocksx[0] = pf_get_nblocksx(&tex->base.block, tex->base.width[0]); + tex->base.nblocksy[0] = pf_get_nblocksy(&tex->base.block, tex->base.height[0]); + + if (is->is_i945) { + if (!i945_miptree_layout(tex)) + goto fail; + } else { + if (!i915_miptree_layout(tex)) + goto fail; + } + + tex_size = tex->stride * tex->total_nblocksy; + + + + /* for scanouts and cursors, cursors arn't scanouts */ + if (templat->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY && templat->width[0] != 64) + buf_usage = INTEL_NEW_SCANOUT; + else + buf_usage = INTEL_NEW_TEXTURE; + + tex->buffer = iws->buffer_create(iws, tex_size, 64, buf_usage); + if (!tex->buffer) + goto fail; + + /* setup any hw fences */ + if (tex->hw_tiled) { + assert(tex->sw_tiled == INTEL_TILE_NONE); + iws->buffer_set_fence_reg(iws, tex->buffer, tex->stride, tex->hw_tiled); + } + + +#if 0 + void *ptr = ws->buffer_map(ws, tex->buffer, + PIPE_BUFFER_USAGE_CPU_WRITE); + memset(ptr, 0x80, tex_size); + ws->buffer_unmap(ws, tex->buffer); +#endif + + return &tex->base; + +fail: + FREE(tex); + return NULL; +} + +static struct pipe_texture * +i915_texture_blanket(struct pipe_screen * screen, + const struct pipe_texture *base, + const unsigned *stride, + struct pipe_buffer *buffer) +{ +#if 0 + struct i915_texture *tex; + assert(screen); + + /* Only supports one type */ + if (base->target != PIPE_TEXTURE_2D || + base->last_level != 0 || + base->depth[0] != 1) { + return NULL; + } + + tex = CALLOC_STRUCT(i915_texture); + if (!tex) + return NULL; + + tex->base = *base; + pipe_reference_init(&tex->base.reference, 1); + tex->base.screen = screen; + + tex->stride = stride[0]; + + i915_miptree_set_level_info(tex, 0, 1, base->width[0], base->height[0], 1); + i915_miptree_set_image_offset(tex, 0, 0, 0, 0); + + pipe_buffer_reference(&tex->buffer, buffer); + + return &tex->base; +#else + return NULL; +#endif +} + +static void +i915_texture_destroy(struct pipe_texture *pt) +{ + struct i915_texture *tex = (struct i915_texture *)pt; + struct intel_winsys *iws = i915_screen(pt->screen)->iws; + uint i; + + /* + DBG("%s deleting %p\n", __FUNCTION__, (void *) tex); + */ + + iws->buffer_destroy(iws, tex->buffer); + + for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++) + if (tex->image_offset[i]) + FREE(tex->image_offset[i]); + + FREE(tex); +} + + +/* + * Screen surface functions + */ + + +static struct pipe_surface * +i915_get_tex_surface(struct pipe_screen *screen, + struct pipe_texture *pt, + unsigned face, unsigned level, unsigned zslice, + unsigned flags) +{ + struct i915_texture *tex = (struct i915_texture *)pt; + struct pipe_surface *ps; + unsigned offset; /* in bytes */ + + if (pt->target == PIPE_TEXTURE_CUBE) { + offset = tex->image_offset[level][face]; + } + else if (pt->target == PIPE_TEXTURE_3D) { + offset = tex->image_offset[level][zslice]; + } + else { + offset = tex->image_offset[level][0]; + assert(face == 0); + assert(zslice == 0); + } + + ps = CALLOC_STRUCT(pipe_surface); + if (ps) { + pipe_reference_init(&ps->reference, 1); + pipe_texture_reference(&ps->texture, pt); + ps->format = pt->format; + ps->width = pt->width[level]; + ps->height = pt->height[level]; + ps->offset = offset; + ps->usage = flags; + } + return ps; +} + +static void +i915_tex_surface_destroy(struct pipe_surface *surf) +{ + pipe_texture_reference(&surf->texture, NULL); + FREE(surf); +} + + +/* + * Screen transfer functions + */ + + +static struct pipe_transfer* +i915_get_tex_transfer(struct pipe_screen *screen, + struct pipe_texture *texture, + unsigned face, unsigned level, unsigned zslice, + enum pipe_transfer_usage usage, unsigned x, unsigned y, + unsigned w, unsigned h) +{ + struct i915_texture *tex = (struct i915_texture *)texture; + struct i915_transfer *trans; + unsigned offset; /* in bytes */ + + if (texture->target == PIPE_TEXTURE_CUBE) { + offset = tex->image_offset[level][face]; + } + else if (texture->target == PIPE_TEXTURE_3D) { + offset = tex->image_offset[level][zslice]; + } + else { + offset = tex->image_offset[level][0]; + assert(face == 0); + assert(zslice == 0); + } + + trans = CALLOC_STRUCT(i915_transfer); + if (trans) { + pipe_texture_reference(&trans->base.texture, texture); + trans->base.format = trans->base.format; + trans->base.x = x; + trans->base.y = y; + trans->base.width = w; + trans->base.height = h; + trans->base.block = texture->block; + trans->base.nblocksx = texture->nblocksx[level]; + trans->base.nblocksy = texture->nblocksy[level]; + trans->base.stride = tex->stride; + trans->offset = offset; + trans->base.usage = usage; + } + return &trans->base; +} + +static void * +i915_transfer_map(struct pipe_screen *screen, + struct pipe_transfer *transfer) +{ + struct i915_texture *tex = (struct i915_texture *)transfer->texture; + struct intel_winsys *iws = i915_screen(tex->base.screen)->iws; + char *map; + boolean write = FALSE; + + if (transfer->usage & PIPE_TRANSFER_WRITE) + write = TRUE; + + map = iws->buffer_map(iws, tex->buffer, write); + if (map == NULL) + return NULL; + + return map + i915_transfer(transfer)->offset + + transfer->y / transfer->block.height * transfer->stride + + transfer->x / transfer->block.width * transfer->block.size; +} + +static void +i915_transfer_unmap(struct pipe_screen *screen, + struct pipe_transfer *transfer) +{ + struct i915_texture *tex = (struct i915_texture *)transfer->texture; + struct intel_winsys *iws = i915_screen(tex->base.screen)->iws; + iws->buffer_unmap(iws, tex->buffer); +} + +static void +i915_tex_transfer_destroy(struct pipe_transfer *trans) +{ + pipe_texture_reference(&trans->texture, NULL); + FREE(trans); +} + + +/* + * Other texture functions + */ + + +void +i915_init_screen_texture_functions(struct i915_screen *is) +{ + is->base.texture_create = i915_texture_create; + is->base.texture_blanket = i915_texture_blanket; + is->base.texture_destroy = i915_texture_destroy; + is->base.get_tex_surface = i915_get_tex_surface; + is->base.tex_surface_destroy = i915_tex_surface_destroy; + is->base.get_tex_transfer = i915_get_tex_transfer; + is->base.transfer_map = i915_transfer_map; + is->base.transfer_unmap = i915_transfer_unmap; + is->base.tex_transfer_destroy = i915_tex_transfer_destroy; +} + +struct pipe_texture * +i915_texture_blanket_intel(struct pipe_screen *screen, + struct pipe_texture *base, + unsigned stride, + struct intel_buffer *buffer) +{ + struct i915_texture *tex; + assert(screen); + + /* Only supports one type */ + if (base->target != PIPE_TEXTURE_2D || + base->last_level != 0 || + base->depth[0] != 1) { + return NULL; + } + + tex = CALLOC_STRUCT(i915_texture); + if (!tex) + return NULL; + + tex->base = *base; + pipe_reference_init(&tex->base.reference, 1); + tex->base.screen = screen; + + tex->stride = stride; + + i915_miptree_set_level_info(tex, 0, 1, base->width[0], base->height[0], 1); + i915_miptree_set_image_offset(tex, 0, 0, 0, 0); + + tex->buffer = buffer; + + return &tex->base; +} + +boolean +i915_get_texture_buffer_intel(struct pipe_texture *texture, + struct intel_buffer **buffer, + unsigned *stride) +{ + struct i915_texture *tex = (struct i915_texture *)texture; + + if (!texture) + return FALSE; + + *stride = tex->stride; + *buffer = tex->buffer; + + return TRUE; +} diff --git a/src/gallium/drivers/i915/i915_texture.h b/src/gallium/drivers/i915/i915_texture.h new file mode 100644 index 0000000000..51a1dd984c --- /dev/null +++ b/src/gallium/drivers/i915/i915_texture.h @@ -0,0 +1,36 @@ +/************************************************************************** + * + * 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. + * + **************************************************************************/ + +#ifndef I915_TEXTURE_H +#define I915_TEXTURE_H + +struct i915_screen; + +extern void +i915_init_screen_texture_functions(struct i915_screen *is); + +#endif /* I915_TEXTURE_H */ diff --git a/src/gallium/drivers/i915/intel_batchbuffer.h b/src/gallium/drivers/i915/intel_batchbuffer.h new file mode 100644 index 0000000000..db12dfd2ac --- /dev/null +++ b/src/gallium/drivers/i915/intel_batchbuffer.h @@ -0,0 +1,87 @@ +/************************************************************************** + * + * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef INTEL_BATCH_H +#define INTEL_BATCH_H + +#include "intel_winsys.h" + +static INLINE boolean +intel_batchbuffer_check(struct intel_batchbuffer *batch, + size_t dwords, + size_t relocs) +{ + return dwords * 4 <= batch->size - (batch->ptr - batch->map) && + relocs <= (batch->max_relocs - batch->relocs); +} + +static INLINE size_t +intel_batchbuffer_space(struct intel_batchbuffer *batch) +{ + return batch->size - (batch->ptr - batch->map); +} + +static INLINE void +intel_batchbuffer_dword(struct intel_batchbuffer *batch, + unsigned dword) +{ + if (intel_batchbuffer_space(batch) < 4) + return; + + *(unsigned *)batch->ptr = dword; + batch->ptr += 4; +} + +static INLINE void +intel_batchbuffer_write(struct intel_batchbuffer *batch, + void *data, + size_t size) +{ + if (intel_batchbuffer_space(batch) < size) + return; + + memcpy(data, batch->ptr, size); + batch->ptr += size; +} + +static INLINE int +intel_batchbuffer_reloc(struct intel_batchbuffer *batch, + struct intel_buffer *buffer, + enum intel_buffer_usage usage, + size_t offset) +{ + return batch->iws->batchbuffer_reloc(batch, buffer, usage, offset); +} + +static INLINE void +intel_batchbuffer_flush(struct intel_batchbuffer *batch, + struct pipe_fence_handle **fence) +{ + batch->iws->batchbuffer_flush(batch, fence); +} + +#endif diff --git a/src/gallium/drivers/i915/intel_winsys.h b/src/gallium/drivers/i915/intel_winsys.h new file mode 100644 index 0000000000..42c5e7470e --- /dev/null +++ b/src/gallium/drivers/i915/intel_winsys.h @@ -0,0 +1,230 @@ +/************************************************************************** + * + * Copyright © 2009 Jakob Bornecrantz + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef INTEL_WINSYS_H +#define INTEL_WINSYS_H + +#include "pipe/p_compiler.h" + +struct intel_winsys; +struct intel_buffer; +struct intel_batchbuffer; +struct pipe_texture; +struct pipe_fence_handle; + +enum intel_buffer_usage +{ + /* use on textures */ + INTEL_USAGE_RENDER = 0x01, + INTEL_USAGE_SAMPLER = 0x02, + INTEL_USAGE_2D_TARGET = 0x04, + INTEL_USAGE_2D_SOURCE = 0x08, + /* use on vertex */ + INTEL_USAGE_VERTEX = 0x10, +}; + +enum intel_buffer_type +{ + INTEL_NEW_TEXTURE, + INTEL_NEW_SCANOUT, /**< a texture used for scanning out from */ + INTEL_NEW_VERTEX, +}; + +enum intel_buffer_tile +{ + INTEL_TILE_NONE, + INTEL_TILE_X, + INTEL_TILE_Y, +}; + +struct intel_batchbuffer { + + struct intel_winsys *iws; + + /** + * Values exported to speed up the writing the batchbuffer, + * instead of having to go trough a accesor function for + * each dword written. + */ + /*{@*/ + uint8_t *map; + uint8_t *ptr; + size_t size; + + size_t relocs; + size_t max_relocs; + /*@}*/ +}; + +struct intel_winsys { + + /** + * Batchbuffer functions. + */ + /*@{*/ + /** + * Create a new batchbuffer. + */ + struct intel_batchbuffer *(*batchbuffer_create)(struct intel_winsys *iws); + + /** + * Emit a relocation to a buffer. + * Target position in batchbuffer is the same as ptr. + * + * @batch + * @reloc buffer address to be inserted into target. + * @usage how is the hardware going to use the buffer. + * @offset add this to the reloc buffers address + * @target buffer where to write the address, null for batchbuffer. + */ + int (*batchbuffer_reloc)(struct intel_batchbuffer *batch, + struct intel_buffer *reloc, + enum intel_buffer_usage usage, + unsigned offset); + + /** + * Flush a bufferbatch. + */ + void (*batchbuffer_flush)(struct intel_batchbuffer *batch, + struct pipe_fence_handle **fence); + + /** + * Destroy a batchbuffer. + */ + void (*batchbuffer_destroy)(struct intel_batchbuffer *batch); + /*@}*/ + + + /** + * Buffer functions. + */ + /*@{*/ + /** + * Create a buffer. + */ + struct intel_buffer *(*buffer_create)(struct intel_winsys *iws, + unsigned size, unsigned alignment, + enum intel_buffer_type type); + + /** + * Fence a buffer with a fence reg. + * Not to be confused with pipe_fence_handle. + */ + int (*buffer_set_fence_reg)(struct intel_winsys *iws, + struct intel_buffer *buffer, + unsigned stride, + enum intel_buffer_tile tile); + + /** + * Map a buffer. + */ + void *(*buffer_map)(struct intel_winsys *iws, + struct intel_buffer *buffer, + boolean write); + + /** + * Unmap a buffer. + */ + void (*buffer_unmap)(struct intel_winsys *iws, + struct intel_buffer *buffer); + + /** + * Write to a buffer. + * + * Arguments follows pwrite(2) + */ + int (*buffer_write)(struct intel_winsys *iws, + struct intel_buffer *dst, + const void *src, + size_t size, + size_t offset); + + void (*buffer_destroy)(struct intel_winsys *iws, + struct intel_buffer *buffer); + /*@}*/ + + + /** + * Fence functions. + */ + /*@{*/ + /** + * Reference fence and set ptr to fence. + */ + void (*fence_reference)(struct intel_winsys *iws, + struct pipe_fence_handle **ptr, + struct pipe_fence_handle *fence); + + /** + * Check if a fence has finished. + */ + int (*fence_signalled)(struct intel_winsys *iws, + struct pipe_fence_handle *fence); + + /** + * Wait on a fence to finish. + */ + int (*fence_finish)(struct intel_winsys *iws, + struct pipe_fence_handle *fence); + /*@}*/ + + + /** + * Destroy the winsys. + */ + void (*destroy)(struct intel_winsys *iws); +}; + + +/** + * Create i915 pipe_screen. + */ +struct pipe_screen *i915_create_screen(struct intel_winsys *iws, unsigned pci_id); + +/** + * Create a i915 pipe_context. + */ +struct pipe_context *i915_create_context(struct pipe_screen *screen); + +/** + * Get the intel_winsys buffer backing the texture. + * + * TODO UGLY + */ +boolean i915_get_texture_buffer_intel(struct pipe_texture *texture, + struct intel_buffer **buffer, + unsigned *stride); + +/** + * Wrap a intel_winsys buffer with a texture blanket. + * + * TODO UGLY + */ +struct pipe_texture * i915_texture_blanket_intel(struct pipe_screen *screen, + struct pipe_texture *tmplt, + unsigned pitch, + struct intel_buffer *buffer); + +#endif diff --git a/src/gallium/drivers/i915simple/Makefile b/src/gallium/drivers/i915simple/Makefile deleted file mode 100644 index fb533c1796..0000000000 --- a/src/gallium/drivers/i915simple/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -TOP = ../../../.. -include $(TOP)/configs/current - -LIBNAME = i915simple - -C_SOURCES = \ - i915_blit.c \ - i915_buffer.c \ - i915_clear.c \ - i915_flush.c \ - i915_context.c \ - i915_debug.c \ - i915_debug_fp.c \ - i915_state.c \ - i915_state_immediate.c \ - i915_state_dynamic.c \ - i915_state_derived.c \ - i915_state_emit.c \ - i915_state_sampler.c \ - i915_screen.c \ - i915_prim_emit.c \ - i915_prim_vbuf.c \ - i915_texture.c \ - i915_fpc_emit.c \ - i915_fpc_translate.c \ - i915_surface.c - -include ../../Makefile.template diff --git a/src/gallium/drivers/i915simple/SConscript b/src/gallium/drivers/i915simple/SConscript deleted file mode 100644 index 778c4ed0fd..0000000000 --- a/src/gallium/drivers/i915simple/SConscript +++ /dev/null @@ -1,30 +0,0 @@ -Import('*') - -env = env.Clone() - -i915simple = env.ConvenienceLibrary( - target = 'i915simple', - source = [ - 'i915_blit.c', - 'i915_buffer.c', - 'i915_clear.c', - 'i915_context.c', - 'i915_debug.c', - 'i915_debug_fp.c', - 'i915_flush.c', - 'i915_fpc_emit.c', - 'i915_fpc_translate.c', - 'i915_prim_emit.c', - 'i915_prim_vbuf.c', - 'i915_screen.c', - 'i915_state.c', - 'i915_state_derived.c', - 'i915_state_dynamic.c', - 'i915_state_emit.c', - 'i915_state_immediate.c', - 'i915_state_sampler.c', - 'i915_surface.c', - 'i915_texture.c', - ]) - -Export('i915simple') diff --git a/src/gallium/drivers/i915simple/i915_batch.h b/src/gallium/drivers/i915simple/i915_batch.h deleted file mode 100644 index b813784723..0000000000 --- a/src/gallium/drivers/i915simple/i915_batch.h +++ /dev/null @@ -1,47 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef I915_BATCH_H -#define I915_BATCH_H - -#include "intel_batchbuffer.h" - -#define BEGIN_BATCH(dwords, relocs) \ - (intel_batchbuffer_check(i915->batch, dwords, relocs)) - -#define OUT_BATCH(dword) \ - intel_batchbuffer_dword(i915->batch, dword) - -#define OUT_RELOC(buf, usage, offset) \ - intel_batchbuffer_reloc(i915->batch, buf, usage, offset) - -#define FLUSH_BATCH(fence) do { \ - intel_batchbuffer_flush(i915->batch, fence); \ - i915->hardware_dirty = ~0; \ -} while (0) - -#endif diff --git a/src/gallium/drivers/i915simple/i915_blit.c b/src/gallium/drivers/i915simple/i915_blit.c deleted file mode 100644 index 83dfc33528..0000000000 --- a/src/gallium/drivers/i915simple/i915_blit.c +++ /dev/null @@ -1,151 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#include "i915_blit.h" -#include "i915_reg.h" -#include "i915_batch.h" -#include "i915_debug.h" - -#define FILE_DEBUG_FLAG DEBUG_BLIT - -void -i915_fill_blit(struct i915_context *i915, - unsigned cpp, - unsigned short dst_pitch, - struct intel_buffer *dst_buffer, - unsigned dst_offset, - short x, short y, - short w, short h, - unsigned color) -{ - unsigned BR13, CMD; - - - I915_DBG(i915, - "%s dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n", - __FUNCTION__, - dst_buffer, dst_pitch, dst_offset, x, y, w, h); - - switch (cpp) { - case 1: - case 2: - case 3: - BR13 = (((int) dst_pitch) & 0xffff) | - (0xF0 << 16) | (1 << 24); - CMD = XY_COLOR_BLT_CMD; - break; - case 4: - BR13 = (((int) dst_pitch) & 0xffff) | - (0xF0 << 16) | (1 << 24) | (1 << 25); - CMD = (XY_COLOR_BLT_CMD | XY_COLOR_BLT_WRITE_ALPHA | - XY_COLOR_BLT_WRITE_RGB); - break; - default: - return; - } - - if (!BEGIN_BATCH(6, 1)) { - FLUSH_BATCH(NULL); - assert(BEGIN_BATCH(6, 1)); - } - OUT_BATCH(CMD); - OUT_BATCH(BR13); - OUT_BATCH((y << 16) | x); - OUT_BATCH(((y + h) << 16) | (x + w)); - OUT_RELOC(dst_buffer, INTEL_USAGE_2D_TARGET, dst_offset); - OUT_BATCH(color); - FLUSH_BATCH(NULL); -} - -void -i915_copy_blit(struct i915_context *i915, - unsigned do_flip, - unsigned cpp, - unsigned short src_pitch, - struct intel_buffer *src_buffer, - unsigned src_offset, - unsigned short dst_pitch, - struct intel_buffer *dst_buffer, - unsigned dst_offset, - short src_x, short src_y, - short dst_x, short dst_y, - short w, short h) -{ - unsigned CMD, BR13; - int dst_y2 = dst_y + h; - int dst_x2 = dst_x + w; - - - I915_DBG(i915, - "%s src:buf(%p)/%d+%d %d,%d dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n", - __FUNCTION__, - src_buffer, src_pitch, src_offset, src_x, src_y, - dst_buffer, dst_pitch, dst_offset, dst_x, dst_y, w, h); - - switch (cpp) { - case 1: - case 2: - case 3: - BR13 = (((int) dst_pitch) & 0xffff) | - (0xCC << 16) | (1 << 24); - CMD = XY_SRC_COPY_BLT_CMD; - break; - case 4: - BR13 = (((int) dst_pitch) & 0xffff) | - (0xCC << 16) | (1 << 24) | (1 << 25); - CMD = (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA | - XY_SRC_COPY_BLT_WRITE_RGB); - break; - default: - return; - } - - if (dst_y2 < dst_y || dst_x2 < dst_x) { - return; - } - - /* Hardware can handle negative pitches but loses the ability to do - * proper overlapping blits in that case. We don't really have a - * need for either at this stage. - */ - assert (dst_pitch > 0 && src_pitch > 0); - - if (!BEGIN_BATCH(8, 2)) { - FLUSH_BATCH(NULL); - assert(BEGIN_BATCH(8, 2)); - } - OUT_BATCH(CMD); - OUT_BATCH(BR13); - OUT_BATCH((dst_y << 16) | dst_x); - OUT_BATCH((dst_y2 << 16) | dst_x2); - OUT_RELOC(dst_buffer, INTEL_USAGE_2D_TARGET, dst_offset); - OUT_BATCH((src_y << 16) | src_x); - OUT_BATCH(((int) src_pitch & 0xffff)); - OUT_RELOC(src_buffer, INTEL_USAGE_2D_SOURCE, src_offset); - FLUSH_BATCH(NULL); -} diff --git a/src/gallium/drivers/i915simple/i915_blit.h b/src/gallium/drivers/i915simple/i915_blit.h deleted file mode 100644 index 8ce3220cfd..0000000000 --- a/src/gallium/drivers/i915simple/i915_blit.h +++ /dev/null @@ -1,55 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef I915_BLIT_H -#define I915_BLIT_H - -#include "i915_context.h" - -extern void i915_copy_blit(struct i915_context *i915, - unsigned do_flip, - unsigned cpp, - unsigned short src_pitch, - struct intel_buffer *src_buffer, - unsigned src_offset, - unsigned short dst_pitch, - struct intel_buffer *dst_buffer, - unsigned dst_offset, - short srcx, short srcy, - short dstx, short dsty, - short w, short h); - -extern void i915_fill_blit(struct i915_context *i915, - unsigned cpp, - unsigned short dst_pitch, - struct intel_buffer *dst_buffer, - unsigned dst_offset, - short x, short y, - short w, short h, unsigned color); - - -#endif diff --git a/src/gallium/drivers/i915simple/i915_buffer.c b/src/gallium/drivers/i915simple/i915_buffer.c deleted file mode 100644 index effeba1297..0000000000 --- a/src/gallium/drivers/i915simple/i915_buffer.c +++ /dev/null @@ -1,136 +0,0 @@ -/************************************************************************** - * - * Copyright © 2009 Jakob Bornecrantz - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include "util/u_memory.h" -#include "i915_screen.h" -#include "i915_buffer.h" - -struct intel_buffer; - -struct i915_buffer -{ - struct pipe_buffer base; - - struct intel_buffer *ibuf; /** hw buffer */ - - void *data; /**< user and malloc data */ - boolean own; /**< we own the data incase of malloc */ -}; - -static INLINE struct i915_buffer * -i915_buffer(struct pipe_buffer *buffer) -{ - return (struct i915_buffer *)buffer; -} - -static struct pipe_buffer * -i915_buffer_create(struct pipe_screen *screen, - unsigned alignment, - unsigned usage, - unsigned size) -{ - struct i915_buffer *buf = CALLOC_STRUCT(i915_buffer); - - if (!buf) - return NULL; - - pipe_reference_init(&buf->base.reference, 1); - buf->base.alignment = alignment; - buf->base.screen = screen; - buf->base.usage = usage; - buf->base.size = size; - buf->data = MALLOC(size); - buf->own = TRUE; - - if (!buf->data) - goto err; - - return &buf->base; - -err: - FREE(buf); - return NULL; -} - -static struct pipe_buffer * -i915_user_buffer_create(struct pipe_screen *screen, - void *ptr, - unsigned bytes) -{ - struct i915_buffer *buf = CALLOC_STRUCT(i915_buffer); - - if (!buf) - return NULL; - - pipe_reference_init(&buf->base.reference, 1); - buf->base.alignment = 0; - buf->base.screen = screen; - buf->base.usage = 0; - buf->base.size = bytes; - buf->data = ptr; - buf->own = FALSE; - - return &buf->base; -} - -static void * -i915_buffer_map(struct pipe_screen *screen, - struct pipe_buffer *buffer, - unsigned usage) -{ - struct i915_buffer *buf = i915_buffer(buffer); - assert(!buf->ibuf); - return buf->data; -} - -static void -i915_buffer_unmap(struct pipe_screen *screen, - struct pipe_buffer *buffer) -{ - struct i915_buffer *buf = i915_buffer(buffer); - assert(!buf->ibuf); -} - -static void -i915_buffer_destroy(struct pipe_buffer *buffer) -{ - struct i915_buffer *buf = i915_buffer(buffer); - assert(!buf->ibuf); - - if (buf->own) - FREE(buf->data); - FREE(buf); -} - -void i915_init_screen_buffer_functions(struct i915_screen *screen) -{ - screen->base.buffer_create = i915_buffer_create; - screen->base.user_buffer_create = i915_user_buffer_create; - screen->base.buffer_map = i915_buffer_map; - screen->base.buffer_map_range = NULL; - screen->base.buffer_flush_mapped_range = NULL; - screen->base.buffer_unmap = i915_buffer_unmap; - screen->base.buffer_destroy = i915_buffer_destroy; -} diff --git a/src/gallium/drivers/i915simple/i915_buffer.h b/src/gallium/drivers/i915simple/i915_buffer.h deleted file mode 100644 index 80fda7c62f..0000000000 --- a/src/gallium/drivers/i915simple/i915_buffer.h +++ /dev/null @@ -1,31 +0,0 @@ -/************************************************************************** - * - * Copyright © 2009 Jakob Bornecrantz - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef I915_BUFFER_H -#define I915_BUFFER_H - -void i915_init_screen_buffer_functions(struct i915_screen *screen); - -#endif diff --git a/src/gallium/drivers/i915simple/i915_clear.c b/src/gallium/drivers/i915simple/i915_clear.c deleted file mode 100644 index 90530f2826..0000000000 --- a/src/gallium/drivers/i915simple/i915_clear.c +++ /dev/null @@ -1,48 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * 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: - * Brian Paul - */ - - -#include "util/u_clear.h" -#include "i915_context.h" -#include "i915_state.h" - - -/** - * Clear the given buffers to the specified values. - * No masking, no scissor (clear entire buffer). - */ -void -i915_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, - double depth, unsigned stencil) -{ - util_clear(pipe, &i915_context(pipe)->framebuffer, buffers, rgba, depth, - stencil); -} diff --git a/src/gallium/drivers/i915simple/i915_context.c b/src/gallium/drivers/i915simple/i915_context.c deleted file mode 100644 index e745f3342d..0000000000 --- a/src/gallium/drivers/i915simple/i915_context.c +++ /dev/null @@ -1,244 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include "i915_context.h" -#include "i915_state.h" -#include "i915_screen.h" -#include "i915_batch.h" -#include "i915_texture.h" -#include "i915_reg.h" - -#include "draw/draw_context.h" -#include "pipe/p_defines.h" -#include "pipe/internal/p_winsys_screen.h" -#include "pipe/p_inlines.h" -#include "util/u_memory.h" -#include "pipe/p_screen.h" - - -/* - * Draw functions - */ - - -static boolean -i915_draw_range_elements(struct pipe_context *pipe, - struct pipe_buffer *indexBuffer, - unsigned indexSize, - unsigned min_index, - unsigned max_index, - unsigned prim, unsigned start, unsigned count) -{ - struct i915_context *i915 = i915_context(pipe); - struct draw_context *draw = i915->draw; - unsigned i; - - if (i915->dirty) - i915_update_derived(i915); - - /* - * Map vertex buffers - */ - for (i = 0; i < i915->num_vertex_buffers; i++) { - void *buf = pipe_buffer_map(pipe->screen, i915->vertex_buffer[i].buffer, - PIPE_BUFFER_USAGE_CPU_READ); - draw_set_mapped_vertex_buffer(draw, i, buf); - } - - /* - * Map index buffer, if present - */ - if (indexBuffer) { - void *mapped_indexes = pipe_buffer_map(pipe->screen, indexBuffer, - PIPE_BUFFER_USAGE_CPU_READ); - draw_set_mapped_element_buffer_range(draw, indexSize, - min_index, - max_index, - mapped_indexes); - } else { - draw_set_mapped_element_buffer(draw, 0, NULL); - } - - - draw_set_mapped_constant_buffer(draw, - i915->current.constants[PIPE_SHADER_VERTEX], - (i915->current.num_user_constants[PIPE_SHADER_VERTEX] * - 4 * sizeof(float))); - - /* - * Do the drawing - */ - draw_arrays(i915->draw, prim, start, count); - - /* - * unmap vertex/index buffers - */ - for (i = 0; i < i915->num_vertex_buffers; i++) { - pipe_buffer_unmap(pipe->screen, i915->vertex_buffer[i].buffer); - draw_set_mapped_vertex_buffer(draw, i, NULL); - } - - if (indexBuffer) { - pipe_buffer_unmap(pipe->screen, indexBuffer); - draw_set_mapped_element_buffer_range(draw, 0, start, start + count - 1, NULL); - } - - return TRUE; -} - -static boolean -i915_draw_elements(struct pipe_context *pipe, - struct pipe_buffer *indexBuffer, - unsigned indexSize, - unsigned prim, unsigned start, unsigned count) -{ - return i915_draw_range_elements(pipe, indexBuffer, - indexSize, - 0, 0xffffffff, - prim, start, count); -} - -static boolean -i915_draw_arrays(struct pipe_context *pipe, - unsigned prim, unsigned start, unsigned count) -{ - return i915_draw_elements(pipe, NULL, 0, prim, start, count); -} - - -/* - * Is referenced functions - */ - - -static unsigned int -i915_is_texture_referenced(struct pipe_context *pipe, - struct pipe_texture *texture, - unsigned face, unsigned level) -{ - /** - * FIXME: Return the corrent result. We can't alays return referenced - * since it causes a double flush within the vbo module. - */ -#if 0 - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -#else - return 0; -#endif -} - -static unsigned int -i915_is_buffer_referenced(struct pipe_context *pipe, - struct pipe_buffer *buf) -{ - /** - * FIXME: Return the corrent result. We can't alays return referenced - * since it causes a double flush within the vbo module. - */ -#if 0 - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -#else - return 0; -#endif -} - - -/* - * Generic context functions - */ - - -static void i915_destroy(struct pipe_context *pipe) -{ - struct i915_context *i915 = i915_context(pipe); - int i; - - draw_destroy(i915->draw); - - if(i915->batch) - i915->iws->batchbuffer_destroy(i915->batch); - - /* unbind framebuffer */ - for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { - pipe_surface_reference(&i915->framebuffer.cbufs[i], NULL); - } - pipe_surface_reference(&i915->framebuffer.zsbuf, NULL); - - FREE(i915); -} - -struct pipe_context * -i915_create_context(struct pipe_screen *screen) -{ - struct i915_context *i915; - - i915 = CALLOC_STRUCT(i915_context); - if (i915 == NULL) - return NULL; - - i915->iws = i915_screen(screen)->iws; - i915->base.winsys = NULL; - i915->base.screen = screen; - - i915->base.destroy = i915_destroy; - - i915->base.clear = i915_clear; - - i915->base.draw_arrays = i915_draw_arrays; - i915->base.draw_elements = i915_draw_elements; - i915->base.draw_range_elements = i915_draw_range_elements; - - i915->base.is_texture_referenced = i915_is_texture_referenced; - i915->base.is_buffer_referenced = i915_is_buffer_referenced; - - /* - * Create drawing context and plug our rendering stage into it. - */ - i915->draw = draw_create(); - assert(i915->draw); - if (!debug_get_bool_option("I915_NO_VBUF", FALSE)) { - draw_set_rasterize_stage(i915->draw, i915_draw_vbuf_stage(i915)); - } else { - draw_set_rasterize_stage(i915->draw, i915_draw_render_stage(i915)); - } - - i915_init_surface_functions(i915); - i915_init_state_functions(i915); - i915_init_flush_functions(i915); - - draw_install_aaline_stage(i915->draw, &i915->base); - draw_install_aapoint_stage(i915->draw, &i915->base); - - i915->dirty = ~0; - i915->hardware_dirty = ~0; - - /* Batch stream debugging is a bit hacked up at the moment: - */ - i915->batch = i915->iws->batchbuffer_create(i915->iws); - - return &i915->base; -} diff --git a/src/gallium/drivers/i915simple/i915_context.h b/src/gallium/drivers/i915simple/i915_context.h deleted file mode 100644 index 234b441ce6..0000000000 --- a/src/gallium/drivers/i915simple/i915_context.h +++ /dev/null @@ -1,350 +0,0 @@ - /************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef I915_CONTEXT_H -#define I915_CONTEXT_H - - -#include "pipe/p_context.h" -#include "pipe/p_defines.h" -#include "pipe/p_state.h" - -#include "draw/draw_vertex.h" - -#include "tgsi/tgsi_scan.h" - - -struct intel_winsys; -struct intel_buffer; -struct intel_batchbuffer; - - -#define I915_TEX_UNITS 8 - -#define I915_DYNAMIC_MODES4 0 -#define I915_DYNAMIC_DEPTHSCALE_0 1 /* just the header */ -#define I915_DYNAMIC_DEPTHSCALE_1 2 -#define I915_DYNAMIC_IAB 3 -#define I915_DYNAMIC_BC_0 4 /* just the header */ -#define I915_DYNAMIC_BC_1 5 -#define I915_DYNAMIC_BFO_0 6 -#define I915_DYNAMIC_BFO_1 7 -#define I915_DYNAMIC_STP_0 8 -#define I915_DYNAMIC_STP_1 9 -#define I915_DYNAMIC_SC_ENA_0 10 -#define I915_DYNAMIC_SC_RECT_0 11 -#define I915_DYNAMIC_SC_RECT_1 12 -#define I915_DYNAMIC_SC_RECT_2 13 -#define I915_MAX_DYNAMIC 14 - - -#define I915_IMMEDIATE_S0 0 -#define I915_IMMEDIATE_S1 1 -#define I915_IMMEDIATE_S2 2 -#define I915_IMMEDIATE_S3 3 -#define I915_IMMEDIATE_S4 4 -#define I915_IMMEDIATE_S5 5 -#define I915_IMMEDIATE_S6 6 -#define I915_IMMEDIATE_S7 7 -#define I915_MAX_IMMEDIATE 8 - -/* These must mach the order of LI0_STATE_* bits, as they will be used - * to generate hardware packets: - */ -#define I915_CACHE_STATIC 0 -#define I915_CACHE_DYNAMIC 1 /* handled specially */ -#define I915_CACHE_SAMPLER 2 -#define I915_CACHE_MAP 3 -#define I915_CACHE_PROGRAM 4 -#define I915_CACHE_CONSTANTS 5 -#define I915_MAX_CACHE 6 - -#define I915_MAX_CONSTANT 32 - - -/** See constant_flags[] below */ -#define I915_CONSTFLAG_USER 0x1f - - -/** - * Subclass of pipe_shader_state - */ -struct i915_fragment_shader -{ - struct pipe_shader_state state; - - struct tgsi_shader_info info; - - uint *program; - uint program_len; - - /** - * constants introduced during translation. - * These are placed at the end of the constant buffer and grow toward - * the beginning (eg: slot 31, 30 29, ...) - * User-provided constants start at 0. - * This allows both types of constants to co-exist (until there's too many) - * and doesn't require regenerating/changing the fragment program to - * shuffle constants around. - */ - uint num_constants; - float constants[I915_MAX_CONSTANT][4]; - - /** - * Status of each constant - * if I915_CONSTFLAG_PARAM, the value must be taken from the corresponding - * slot of the user's constant buffer. (set by pipe->set_constant_buffer()) - * Else, the bitmask indicates which components are occupied by immediates. - */ - ubyte constant_flags[I915_MAX_CONSTANT]; -}; - - -struct i915_cache_context; - -/* Use to calculate differences between state emitted to hardware and - * current driver-calculated state. - */ -struct i915_state -{ - unsigned immediate[I915_MAX_IMMEDIATE]; - unsigned dynamic[I915_MAX_DYNAMIC]; - - float constants[PIPE_SHADER_TYPES][I915_MAX_CONSTANT][4]; - /** number of constants passed in through a constant buffer */ - uint num_user_constants[PIPE_SHADER_TYPES]; - - /* texture sampler state */ - unsigned sampler[I915_TEX_UNITS][3]; - unsigned sampler_enable_flags; - unsigned sampler_enable_nr; - - /* texture image buffers */ - unsigned texbuffer[I915_TEX_UNITS][2]; - - /** Describes the current hardware vertex layout */ - struct vertex_info vertex_info; - - unsigned id; /* track lost context events */ -}; - -struct i915_blend_state { - unsigned iab; - unsigned modes4; - unsigned LIS5; - unsigned LIS6; -}; - -struct i915_depth_stencil_state { - unsigned stencil_modes4; - unsigned bfo[2]; - unsigned stencil_LIS5; - unsigned depth_LIS6; -}; - -struct i915_rasterizer_state { - int light_twoside : 1; - unsigned st; - enum interp_mode color_interp; - - unsigned LIS4; - unsigned LIS7; - unsigned sc[1]; - - const struct pipe_rasterizer_state *templ; - - union { float f; unsigned u; } ds[2]; -}; - -struct i915_sampler_state { - unsigned state[3]; - const struct pipe_sampler_state *templ; - unsigned minlod; - unsigned maxlod; -}; - -struct i915_texture { - struct pipe_texture base; - - /* Derived from the above: - */ - unsigned stride; - unsigned depth_stride; /* per-image on i945? */ - unsigned total_nblocksy; - - unsigned sw_tiled; /**< tiled with software flags */ - unsigned hw_tiled; /**< tiled with hardware fences */ - - unsigned nr_images[PIPE_MAX_TEXTURE_LEVELS]; - - /* Explicitly store the offset of each image for each cube face or - * depth value. Pretty much have to accept that hardware formats - * are going to be so diverse that there is no unified way to - * compute the offsets of depth/cube images within a mipmap level, - * so have to store them as a lookup table: - */ - unsigned *image_offset[PIPE_MAX_TEXTURE_LEVELS]; /**< array [depth] of offsets */ - - /* The data is held here: - */ - struct intel_buffer *buffer; -}; - -struct i915_context -{ - struct pipe_context base; - - struct intel_winsys *iws; - - struct draw_context *draw; - - /* The most recent drawing state as set by the driver: - */ - const struct i915_blend_state *blend; - const struct i915_sampler_state *sampler[PIPE_MAX_SAMPLERS]; - const struct i915_depth_stencil_state *depth_stencil; - const struct i915_rasterizer_state *rasterizer; - - struct i915_fragment_shader *fs; - - struct pipe_blend_color blend_color; - struct pipe_clip_state clip; - struct pipe_constant_buffer constants[PIPE_SHADER_TYPES]; - struct pipe_framebuffer_state framebuffer; - struct pipe_poly_stipple poly_stipple; - struct pipe_scissor_state scissor; - struct i915_texture *texture[PIPE_MAX_SAMPLERS]; - struct pipe_viewport_state viewport; - struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; - - unsigned dirty; - - unsigned num_samplers; - unsigned num_textures; - unsigned num_vertex_elements; - unsigned num_vertex_buffers; - - struct intel_batchbuffer *batch; - - /** Vertex buffer */ - struct intel_buffer *vbo; - size_t vbo_offset; - unsigned vbo_flushed; - - struct i915_state current; - unsigned hardware_dirty; - - unsigned debug; -}; - -/* A flag for each state_tracker state object: - */ -#define I915_NEW_VIEWPORT 0x1 -#define I915_NEW_RASTERIZER 0x2 -#define I915_NEW_FS 0x4 -#define I915_NEW_BLEND 0x8 -#define I915_NEW_CLIP 0x10 -#define I915_NEW_SCISSOR 0x20 -#define I915_NEW_STIPPLE 0x40 -#define I915_NEW_FRAMEBUFFER 0x80 -#define I915_NEW_ALPHA_TEST 0x100 -#define I915_NEW_DEPTH_STENCIL 0x200 -#define I915_NEW_SAMPLER 0x400 -#define I915_NEW_TEXTURE 0x800 -#define I915_NEW_CONSTANTS 0x1000 -#define I915_NEW_VBO 0x2000 -#define I915_NEW_VS 0x4000 - - -/* Driver's internally generated state flags: - */ -#define I915_NEW_VERTEX_FORMAT 0x10000 - - -/* Dirty flags for hardware emit - */ -#define I915_HW_STATIC (1<ptr + stream->offset); - - if (len == 0) { - PRINTF(stream, "Error - zero length packet (0x%08x)\n", stream->ptr[0]); - assert(0); - return FALSE; - } - - if (stream->print_addresses) - PRINTF(stream, "%08x: ", stream->offset); - - - PRINTF(stream, "%s (%d dwords):\n", name, len); - for (i = 0; i < len; i++) - PRINTF(stream, "\t0x%08x\n", ptr[i]); - PRINTF(stream, "\n"); - - stream->offset += len * sizeof(unsigned); - - return TRUE; -} - - -static const char *get_prim_name( unsigned val ) -{ - switch (val & PRIM3D_MASK) { - case PRIM3D_TRILIST: return "TRILIST"; break; - case PRIM3D_TRISTRIP: return "TRISTRIP"; break; - case PRIM3D_TRISTRIP_RVRSE: return "TRISTRIP_RVRSE"; break; - case PRIM3D_TRIFAN: return "TRIFAN"; break; - case PRIM3D_POLY: return "POLY"; break; - case PRIM3D_LINELIST: return "LINELIST"; break; - case PRIM3D_LINESTRIP: return "LINESTRIP"; break; - case PRIM3D_RECTLIST: return "RECTLIST"; break; - case PRIM3D_POINTLIST: return "POINTLIST"; break; - case PRIM3D_DIB: return "DIB"; break; - case PRIM3D_CLEAR_RECT: return "CLEAR_RECT"; break; - case PRIM3D_ZONE_INIT: return "ZONE_INIT"; break; - default: return "????"; break; - } -} - -static boolean debug_prim( struct debug_stream *stream, const char *name, - boolean dump_floats, - unsigned len ) -{ - unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); - const char *prim = get_prim_name( ptr[0] ); - unsigned i; - - - - PRINTF(stream, "%s %s (%d dwords):\n", name, prim, len); - PRINTF(stream, "\t0x%08x\n", ptr[0]); - for (i = 1; i < len; i++) { - if (dump_floats) - PRINTF(stream, "\t0x%08x // %f\n", ptr[i], *(float *)&ptr[i]); - else - PRINTF(stream, "\t0x%08x\n", ptr[i]); - } - - - PRINTF(stream, "\n"); - - stream->offset += len * sizeof(unsigned); - - return TRUE; -} - - - - -static boolean debug_program( struct debug_stream *stream, const char *name, unsigned len ) -{ - unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); - - if (len == 0) { - PRINTF(stream, "Error - zero length packet (0x%08x)\n", stream->ptr[0]); - assert(0); - return FALSE; - } - - if (stream->print_addresses) - PRINTF(stream, "%08x: ", stream->offset); - - PRINTF(stream, "%s (%d dwords):\n", name, len); - i915_disassemble_program( stream, ptr, len ); - - stream->offset += len * sizeof(unsigned); - return TRUE; -} - - -static boolean debug_chain( struct debug_stream *stream, const char *name, unsigned len ) -{ - unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); - unsigned old_offset = stream->offset + len * sizeof(unsigned); - unsigned i; - - PRINTF(stream, "%s (%d dwords):\n", name, len); - for (i = 0; i < len; i++) - PRINTF(stream, "\t0x%08x\n", ptr[i]); - - stream->offset = ptr[1] & ~0x3; - - if (stream->offset < old_offset) - PRINTF(stream, "\n... skipping backwards from 0x%x --> 0x%x ...\n\n", - old_offset, stream->offset ); - else - PRINTF(stream, "\n... skipping from 0x%x --> 0x%x ...\n\n", - old_offset, stream->offset ); - - - return TRUE; -} - - -static boolean debug_variable_length_prim( struct debug_stream *stream ) -{ - unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); - const char *prim = get_prim_name( ptr[0] ); - unsigned i, len; - - ushort *idx = (ushort *)(ptr+1); - for (i = 0; idx[i] != 0xffff; i++) - ; - - len = 1+(i+2)/2; - - PRINTF(stream, "3DPRIM, %s variable length %d indicies (%d dwords):\n", prim, i, len); - for (i = 0; i < len; i++) - PRINTF(stream, "\t0x%08x\n", ptr[i]); - PRINTF(stream, "\n"); - - stream->offset += len * sizeof(unsigned); - return TRUE; -} - - -static void -BITS( - struct debug_stream *stream, - unsigned dw, - unsigned hi, - unsigned lo, - const char *fmt, - ... ) -{ - va_list args; - unsigned himask = ~0UL >> (31 - (hi)); - - PRINTF(stream, "\t\t "); - - va_start( args, fmt ); - debug_vprintf( fmt, args ); - va_end( args ); - - PRINTF(stream, ": 0x%x\n", ((dw) & himask) >> (lo)); -} - -#ifdef DEBUG -#define MBZ( dw, hi, lo) do { \ - unsigned x = (dw) >> (lo); \ - unsigned lomask = (1 << (lo)) - 1; \ - unsigned himask; \ - himask = (1UL << (hi)) - 1; \ - assert ((x & himask & ~lomask) == 0); \ -} while (0) -#else -#define MBZ( dw, hi, lo) do { \ -} while (0) -#endif - -static void -FLAG( - struct debug_stream *stream, - unsigned dw, - unsigned bit, - const char *fmt, - ... ) -{ - if (((dw) >> (bit)) & 1) { - va_list args; - - PRINTF(stream, "\t\t "); - - va_start( args, fmt ); - debug_vprintf( fmt, args ); - va_end( args ); - - PRINTF(stream, "\n"); - } -} - -static boolean debug_load_immediate( struct debug_stream *stream, - const char *name, - unsigned len ) -{ - unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); - unsigned bits = (ptr[0] >> 4) & 0xff; - unsigned j = 0; - - PRINTF(stream, "%s (%d dwords, flags: %x):\n", name, len, bits); - PRINTF(stream, "\t0x%08x\n", ptr[j++]); - - if (bits & (1<<0)) { - PRINTF(stream, "\t LIS0: 0x%08x\n", ptr[j]); - PRINTF(stream, "\t vb address: 0x%08x\n", (ptr[j] & ~0x3)); - BITS(stream, ptr[j], 0, 0, "vb invalidate disable"); - j++; - } - if (bits & (1<<1)) { - PRINTF(stream, "\t LIS1: 0x%08x\n", ptr[j]); - BITS(stream, ptr[j], 29, 24, "vb dword width"); - BITS(stream, ptr[j], 21, 16, "vb dword pitch"); - BITS(stream, ptr[j], 15, 0, "vb max index"); - j++; - } - if (bits & (1<<2)) { - int i; - PRINTF(stream, "\t LIS2: 0x%08x\n", ptr[j]); - for (i = 0; i < 8; i++) { - unsigned tc = (ptr[j] >> (i * 4)) & 0xf; - if (tc != 0xf) - BITS(stream, tc, 3, 0, "tex coord %d", i); - } - j++; - } - if (bits & (1<<3)) { - PRINTF(stream, "\t LIS3: 0x%08x\n", ptr[j]); - j++; - } - if (bits & (1<<4)) { - PRINTF(stream, "\t LIS4: 0x%08x\n", ptr[j]); - BITS(stream, ptr[j], 31, 23, "point width"); - BITS(stream, ptr[j], 22, 19, "line width"); - FLAG(stream, ptr[j], 18, "alpha flatshade"); - FLAG(stream, ptr[j], 17, "fog flatshade"); - FLAG(stream, ptr[j], 16, "spec flatshade"); - FLAG(stream, ptr[j], 15, "rgb flatshade"); - BITS(stream, ptr[j], 14, 13, "cull mode"); - FLAG(stream, ptr[j], 12, "vfmt: point width"); - FLAG(stream, ptr[j], 11, "vfmt: specular/fog"); - FLAG(stream, ptr[j], 10, "vfmt: rgba"); - FLAG(stream, ptr[j], 9, "vfmt: depth offset"); - BITS(stream, ptr[j], 8, 6, "vfmt: position (2==xyzw)"); - FLAG(stream, ptr[j], 5, "force dflt diffuse"); - FLAG(stream, ptr[j], 4, "force dflt specular"); - FLAG(stream, ptr[j], 3, "local depth offset enable"); - FLAG(stream, ptr[j], 2, "vfmt: fp32 fog coord"); - FLAG(stream, ptr[j], 1, "sprite point"); - FLAG(stream, ptr[j], 0, "antialiasing"); - j++; - } - if (bits & (1<<5)) { - PRINTF(stream, "\t LIS5: 0x%08x\n", ptr[j]); - BITS(stream, ptr[j], 31, 28, "rgba write disables"); - FLAG(stream, ptr[j], 27, "force dflt point width"); - FLAG(stream, ptr[j], 26, "last pixel enable"); - FLAG(stream, ptr[j], 25, "global z offset enable"); - FLAG(stream, ptr[j], 24, "fog enable"); - BITS(stream, ptr[j], 23, 16, "stencil ref"); - BITS(stream, ptr[j], 15, 13, "stencil test"); - BITS(stream, ptr[j], 12, 10, "stencil fail op"); - BITS(stream, ptr[j], 9, 7, "stencil pass z fail op"); - BITS(stream, ptr[j], 6, 4, "stencil pass z pass op"); - FLAG(stream, ptr[j], 3, "stencil write enable"); - FLAG(stream, ptr[j], 2, "stencil test enable"); - FLAG(stream, ptr[j], 1, "color dither enable"); - FLAG(stream, ptr[j], 0, "logiop enable"); - j++; - } - if (bits & (1<<6)) { - PRINTF(stream, "\t LIS6: 0x%08x\n", ptr[j]); - FLAG(stream, ptr[j], 31, "alpha test enable"); - BITS(stream, ptr[j], 30, 28, "alpha func"); - BITS(stream, ptr[j], 27, 20, "alpha ref"); - FLAG(stream, ptr[j], 19, "depth test enable"); - BITS(stream, ptr[j], 18, 16, "depth func"); - FLAG(stream, ptr[j], 15, "blend enable"); - BITS(stream, ptr[j], 14, 12, "blend func"); - BITS(stream, ptr[j], 11, 8, "blend src factor"); - BITS(stream, ptr[j], 7, 4, "blend dst factor"); - FLAG(stream, ptr[j], 3, "depth write enable"); - FLAG(stream, ptr[j], 2, "color write enable"); - BITS(stream, ptr[j], 1, 0, "provoking vertex"); - j++; - } - - - PRINTF(stream, "\n"); - - assert(j == len); - - stream->offset += len * sizeof(unsigned); - - return TRUE; -} - - - -static boolean debug_load_indirect( struct debug_stream *stream, - const char *name, - unsigned len ) -{ - unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); - unsigned bits = (ptr[0] >> 8) & 0x3f; - unsigned i, j = 0; - - PRINTF(stream, "%s (%d dwords):\n", name, len); - PRINTF(stream, "\t0x%08x\n", ptr[j++]); - - for (i = 0; i < 6; i++) { - if (bits & (1<offset += len * sizeof(unsigned); - - return TRUE; -} - -static void BR13( struct debug_stream *stream, - unsigned val ) -{ - PRINTF(stream, "\t0x%08x\n", val); - FLAG(stream, val, 30, "clipping enable"); - BITS(stream, val, 25, 24, "color depth (3==32bpp)"); - BITS(stream, val, 23, 16, "raster op"); - BITS(stream, val, 15, 0, "dest pitch"); -} - - -static void BR22( struct debug_stream *stream, - unsigned val ) -{ - PRINTF(stream, "\t0x%08x\n", val); - BITS(stream, val, 31, 16, "dest y1"); - BITS(stream, val, 15, 0, "dest x1"); -} - -static void BR23( struct debug_stream *stream, - unsigned val ) -{ - PRINTF(stream, "\t0x%08x\n", val); - BITS(stream, val, 31, 16, "dest y2"); - BITS(stream, val, 15, 0, "dest x2"); -} - -static void BR09( struct debug_stream *stream, - unsigned val ) -{ - PRINTF(stream, "\t0x%08x -- dest address\n", val); -} - -static void BR26( struct debug_stream *stream, - unsigned val ) -{ - PRINTF(stream, "\t0x%08x\n", val); - BITS(stream, val, 31, 16, "src y1"); - BITS(stream, val, 15, 0, "src x1"); -} - -static void BR11( struct debug_stream *stream, - unsigned val ) -{ - PRINTF(stream, "\t0x%08x\n", val); - BITS(stream, val, 15, 0, "src pitch"); -} - -static void BR12( struct debug_stream *stream, - unsigned val ) -{ - PRINTF(stream, "\t0x%08x -- src address\n", val); -} - -static void BR16( struct debug_stream *stream, - unsigned val ) -{ - PRINTF(stream, "\t0x%08x -- color\n", val); -} - -static boolean debug_copy_blit( struct debug_stream *stream, - const char *name, - unsigned len ) -{ - unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); - int j = 0; - - PRINTF(stream, "%s (%d dwords):\n", name, len); - PRINTF(stream, "\t0x%08x\n", ptr[j++]); - - BR13(stream, ptr[j++]); - BR22(stream, ptr[j++]); - BR23(stream, ptr[j++]); - BR09(stream, ptr[j++]); - BR26(stream, ptr[j++]); - BR11(stream, ptr[j++]); - BR12(stream, ptr[j++]); - - stream->offset += len * sizeof(unsigned); - assert(j == len); - return TRUE; -} - -static boolean debug_color_blit( struct debug_stream *stream, - const char *name, - unsigned len ) -{ - unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); - int j = 0; - - PRINTF(stream, "%s (%d dwords):\n", name, len); - PRINTF(stream, "\t0x%08x\n", ptr[j++]); - - BR13(stream, ptr[j++]); - BR22(stream, ptr[j++]); - BR23(stream, ptr[j++]); - BR09(stream, ptr[j++]); - BR16(stream, ptr[j++]); - - stream->offset += len * sizeof(unsigned); - assert(j == len); - return TRUE; -} - -static boolean debug_modes4( struct debug_stream *stream, - const char *name, - unsigned len ) -{ - unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); - int j = 0; - - PRINTF(stream, "%s (%d dwords):\n", name, len); - PRINTF(stream, "\t0x%08x\n", ptr[j]); - BITS(stream, ptr[j], 21, 18, "logicop func"); - FLAG(stream, ptr[j], 17, "stencil test mask modify-enable"); - FLAG(stream, ptr[j], 16, "stencil write mask modify-enable"); - BITS(stream, ptr[j], 15, 8, "stencil test mask"); - BITS(stream, ptr[j], 7, 0, "stencil write mask"); - j++; - - stream->offset += len * sizeof(unsigned); - assert(j == len); - return TRUE; -} - -static boolean debug_map_state( struct debug_stream *stream, - const char *name, - unsigned len ) -{ - unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); - unsigned j = 0; - - PRINTF(stream, "%s (%d dwords):\n", name, len); - PRINTF(stream, "\t0x%08x\n", ptr[j++]); - - { - PRINTF(stream, "\t0x%08x\n", ptr[j]); - BITS(stream, ptr[j], 15, 0, "map mask"); - j++; - } - - while (j < len) { - { - PRINTF(stream, "\t TMn.0: 0x%08x\n", ptr[j]); - PRINTF(stream, "\t map address: 0x%08x\n", (ptr[j] & ~0x3)); - FLAG(stream, ptr[j], 1, "vertical line stride"); - FLAG(stream, ptr[j], 0, "vertical line stride offset"); - j++; - } - - { - PRINTF(stream, "\t TMn.1: 0x%08x\n", ptr[j]); - BITS(stream, ptr[j], 31, 21, "height"); - BITS(stream, ptr[j], 20, 10, "width"); - BITS(stream, ptr[j], 9, 7, "surface format"); - BITS(stream, ptr[j], 6, 3, "texel format"); - FLAG(stream, ptr[j], 2, "use fence regs"); - FLAG(stream, ptr[j], 1, "tiled surface"); - FLAG(stream, ptr[j], 0, "tile walk ymajor"); - j++; - } - { - PRINTF(stream, "\t TMn.2: 0x%08x\n", ptr[j]); - BITS(stream, ptr[j], 31, 21, "dword pitch"); - BITS(stream, ptr[j], 20, 15, "cube face enables"); - BITS(stream, ptr[j], 14, 9, "max lod"); - FLAG(stream, ptr[j], 8, "mip layout right"); - BITS(stream, ptr[j], 7, 0, "depth"); - j++; - } - } - - stream->offset += len * sizeof(unsigned); - assert(j == len); - return TRUE; -} - -static boolean debug_sampler_state( struct debug_stream *stream, - const char *name, - unsigned len ) -{ - unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); - unsigned j = 0; - - PRINTF(stream, "%s (%d dwords):\n", name, len); - PRINTF(stream, "\t0x%08x\n", ptr[j++]); - - { - PRINTF(stream, "\t0x%08x\n", ptr[j]); - BITS(stream, ptr[j], 15, 0, "sampler mask"); - j++; - } - - while (j < len) { - { - PRINTF(stream, "\t TSn.0: 0x%08x\n", ptr[j]); - FLAG(stream, ptr[j], 31, "reverse gamma"); - FLAG(stream, ptr[j], 30, "planar to packed"); - FLAG(stream, ptr[j], 29, "yuv->rgb"); - BITS(stream, ptr[j], 28, 27, "chromakey index"); - BITS(stream, ptr[j], 26, 22, "base mip level"); - BITS(stream, ptr[j], 21, 20, "mip mode filter"); - BITS(stream, ptr[j], 19, 17, "mag mode filter"); - BITS(stream, ptr[j], 16, 14, "min mode filter"); - BITS(stream, ptr[j], 13, 5, "lod bias (s4.4)"); - FLAG(stream, ptr[j], 4, "shadow enable"); - FLAG(stream, ptr[j], 3, "max-aniso-4"); - BITS(stream, ptr[j], 2, 0, "shadow func"); - j++; - } - - { - PRINTF(stream, "\t TSn.1: 0x%08x\n", ptr[j]); - BITS(stream, ptr[j], 31, 24, "min lod"); - MBZ( ptr[j], 23, 18 ); - FLAG(stream, ptr[j], 17, "kill pixel enable"); - FLAG(stream, ptr[j], 16, "keyed tex filter mode"); - FLAG(stream, ptr[j], 15, "chromakey enable"); - BITS(stream, ptr[j], 14, 12, "tcx wrap mode"); - BITS(stream, ptr[j], 11, 9, "tcy wrap mode"); - BITS(stream, ptr[j], 8, 6, "tcz wrap mode"); - FLAG(stream, ptr[j], 5, "normalized coords"); - BITS(stream, ptr[j], 4, 1, "map (surface) index"); - FLAG(stream, ptr[j], 0, "EAST deinterlacer enable"); - j++; - } - { - PRINTF(stream, "\t TSn.2: 0x%08x (default color)\n", ptr[j]); - j++; - } - } - - stream->offset += len * sizeof(unsigned); - assert(j == len); - return TRUE; -} - -static boolean debug_dest_vars( struct debug_stream *stream, - const char *name, - unsigned len ) -{ - unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); - int j = 0; - - PRINTF(stream, "%s (%d dwords):\n", name, len); - PRINTF(stream, "\t0x%08x\n", ptr[j++]); - - { - PRINTF(stream, "\t0x%08x\n", ptr[j]); - FLAG(stream, ptr[j], 31, "early classic ztest"); - FLAG(stream, ptr[j], 30, "opengl tex default color"); - FLAG(stream, ptr[j], 29, "bypass iz"); - FLAG(stream, ptr[j], 28, "lod preclamp"); - BITS(stream, ptr[j], 27, 26, "dither pattern"); - FLAG(stream, ptr[j], 25, "linear gamma blend"); - FLAG(stream, ptr[j], 24, "debug dither"); - BITS(stream, ptr[j], 23, 20, "dstorg x"); - BITS(stream, ptr[j], 19, 16, "dstorg y"); - MBZ (ptr[j], 15, 15 ); - BITS(stream, ptr[j], 14, 12, "422 write select"); - BITS(stream, ptr[j], 11, 8, "cbuf format"); - BITS(stream, ptr[j], 3, 2, "zbuf format"); - FLAG(stream, ptr[j], 1, "vert line stride"); - FLAG(stream, ptr[j], 1, "vert line stride offset"); - j++; - } - - stream->offset += len * sizeof(unsigned); - assert(j == len); - return TRUE; -} - -static boolean debug_buf_info( struct debug_stream *stream, - const char *name, - unsigned len ) -{ - unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); - int j = 0; - - PRINTF(stream, "%s (%d dwords):\n", name, len); - PRINTF(stream, "\t0x%08x\n", ptr[j++]); - - { - PRINTF(stream, "\t0x%08x\n", ptr[j]); - BITS(stream, ptr[j], 28, 28, "aux buffer id"); - BITS(stream, ptr[j], 27, 24, "buffer id (7=depth, 3=back)"); - FLAG(stream, ptr[j], 23, "use fence regs"); - FLAG(stream, ptr[j], 22, "tiled surface"); - FLAG(stream, ptr[j], 21, "tile walk ymajor"); - MBZ (ptr[j], 20, 14); - BITS(stream, ptr[j], 13, 2, "dword pitch"); - MBZ (ptr[j], 2, 0); - j++; - } - - PRINTF(stream, "\t0x%08x -- buffer base address\n", ptr[j++]); - - stream->offset += len * sizeof(unsigned); - assert(j == len); - return TRUE; -} - -static boolean i915_debug_packet( struct debug_stream *stream ) -{ - unsigned *ptr = (unsigned *)(stream->ptr + stream->offset); - unsigned cmd = *ptr; - - switch (((cmd >> 29) & 0x7)) { - case 0x0: - switch ((cmd >> 23) & 0x3f) { - case 0x0: - return debug(stream, "MI_NOOP", 1); - case 0x3: - return debug(stream, "MI_WAIT_FOR_EVENT", 1); - case 0x4: - return debug(stream, "MI_FLUSH", 1); - case 0xA: - debug(stream, "MI_BATCH_BUFFER_END", 1); - return FALSE; - case 0x22: - return debug(stream, "MI_LOAD_REGISTER_IMM", 3); - case 0x31: - return debug_chain(stream, "MI_BATCH_BUFFER_START", 2); - default: - (void)debug(stream, "UNKNOWN 0x0 case!", 1); - assert(0); - break; - } - break; - case 0x1: - (void) debug(stream, "UNKNOWN 0x1 case!", 1); - assert(0); - break; - case 0x2: - switch ((cmd >> 22) & 0xff) { - case 0x50: - return debug_color_blit(stream, "XY_COLOR_BLT", (cmd & 0xff) + 2); - case 0x53: - return debug_copy_blit(stream, "XY_SRC_COPY_BLT", (cmd & 0xff) + 2); - default: - return debug(stream, "blit command", (cmd & 0xff) + 2); - } - break; - case 0x3: - switch ((cmd >> 24) & 0x1f) { - case 0x6: - return debug(stream, "3DSTATE_ANTI_ALIASING", 1); - case 0x7: - return debug(stream, "3DSTATE_RASTERIZATION_RULES", 1); - case 0x8: - return debug(stream, "3DSTATE_BACKFACE_STENCIL_OPS", 2); - case 0x9: - return debug(stream, "3DSTATE_BACKFACE_STENCIL_MASKS", 1); - case 0xb: - return debug(stream, "3DSTATE_INDEPENDENT_ALPHA_BLEND", 1); - case 0xc: - return debug(stream, "3DSTATE_MODES5", 1); - case 0xd: - return debug_modes4(stream, "3DSTATE_MODES4", 1); - case 0x15: - return debug(stream, "3DSTATE_FOG_COLOR", 1); - case 0x16: - return debug(stream, "3DSTATE_COORD_SET_BINDINGS", 1); - case 0x1c: - /* 3DState16NP */ - switch((cmd >> 19) & 0x1f) { - case 0x10: - return debug(stream, "3DSTATE_SCISSOR_ENABLE", 1); - case 0x11: - return debug(stream, "3DSTATE_DEPTH_SUBRECTANGLE_DISABLE", 1); - default: - (void) debug(stream, "UNKNOWN 0x1c case!", 1); - assert(0); - break; - } - break; - case 0x1d: - /* 3DStateMW */ - switch ((cmd >> 16) & 0xff) { - case 0x0: - return debug_map_state(stream, "3DSTATE_MAP_STATE", (cmd & 0x1f) + 2); - case 0x1: - return debug_sampler_state(stream, "3DSTATE_SAMPLER_STATE", (cmd & 0x1f) + 2); - case 0x4: - return debug_load_immediate(stream, "3DSTATE_LOAD_STATE_IMMEDIATE", (cmd & 0xf) + 2); - case 0x5: - return debug_program(stream, "3DSTATE_PIXEL_SHADER_PROGRAM", (cmd & 0x1ff) + 2); - case 0x6: - return debug(stream, "3DSTATE_PIXEL_SHADER_CONSTANTS", (cmd & 0xff) + 2); - case 0x7: - return debug_load_indirect(stream, "3DSTATE_LOAD_INDIRECT", (cmd & 0xff) + 2); - case 0x80: - return debug(stream, "3DSTATE_DRAWING_RECTANGLE", (cmd & 0xffff) + 2); - case 0x81: - return debug(stream, "3DSTATE_SCISSOR_RECTANGLE", (cmd & 0xffff) + 2); - case 0x83: - return debug(stream, "3DSTATE_SPAN_STIPPLE", (cmd & 0xffff) + 2); - case 0x85: - return debug_dest_vars(stream, "3DSTATE_DEST_BUFFER_VARS", (cmd & 0xffff) + 2); - case 0x88: - return debug(stream, "3DSTATE_CONSTANT_BLEND_COLOR", (cmd & 0xffff) + 2); - case 0x89: - return debug(stream, "3DSTATE_FOG_MODE", (cmd & 0xffff) + 2); - case 0x8e: - return debug_buf_info(stream, "3DSTATE_BUFFER_INFO", (cmd & 0xffff) + 2); - case 0x97: - return debug(stream, "3DSTATE_DEPTH_OFFSET_SCALE", (cmd & 0xffff) + 2); - case 0x98: - return debug(stream, "3DSTATE_DEFAULT_Z", (cmd & 0xffff) + 2); - case 0x99: - return debug(stream, "3DSTATE_DEFAULT_DIFFUSE", (cmd & 0xffff) + 2); - case 0x9a: - return debug(stream, "3DSTATE_DEFAULT_SPECULAR", (cmd & 0xffff) + 2); - case 0x9c: - return debug(stream, "3DSTATE_CLEAR_PARAMETERS", (cmd & 0xffff) + 2); - default: - assert(0); - return 0; - } - break; - case 0x1e: - if (cmd & (1 << 23)) - return debug(stream, "???", (cmd & 0xffff) + 1); - else - return debug(stream, "", 1); - break; - case 0x1f: - if ((cmd & (1 << 23)) == 0) - return debug_prim(stream, "3DPRIM (inline)", 1, (cmd & 0x1ffff) + 2); - else if (cmd & (1 << 17)) - { - if ((cmd & 0xffff) == 0) - return debug_variable_length_prim(stream); - else - return debug_prim(stream, "3DPRIM (indexed)", 0, (((cmd & 0xffff) + 1) / 2) + 1); - } - else - return debug_prim(stream, "3DPRIM (indirect sequential)", 0, 2); - break; - default: - return debug(stream, "", 0); - } - default: - assert(0); - return 0; - } - - assert(0); - return 0; -} - - - -void -i915_dump_batchbuffer( struct intel_batchbuffer *batch ) -{ - struct debug_stream stream; - unsigned *start = (unsigned*)batch->map; - unsigned *end = (unsigned*)batch->ptr; - unsigned long bytes = (unsigned long) (end - start) * 4; - boolean done = FALSE; - - stream.offset = 0; - stream.ptr = (char *)start; - stream.print_addresses = 0; - - if (!start || !end) { - debug_printf( "\n\nBATCH: ???\n"); - return; - } - - debug_printf( "\n\nBATCH: (%d)\n", bytes / 4); - - while (!done && - stream.offset < bytes) - { - if (!i915_debug_packet( &stream )) - break; - - assert(stream.offset <= bytes && - stream.offset >= 0); - } - - debug_printf( "END-BATCH\n\n\n"); -} - - diff --git a/src/gallium/drivers/i915simple/i915_debug.h b/src/gallium/drivers/i915simple/i915_debug.h deleted file mode 100644 index dd9b86e17b..0000000000 --- a/src/gallium/drivers/i915simple/i915_debug.h +++ /dev/null @@ -1,114 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * 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: Keith Whitwell - */ - -#ifndef I915_DEBUG_H -#define I915_DEBUG_H - -#include - -struct i915_context; - -struct debug_stream -{ - unsigned offset; /* current gtt offset */ - char *ptr; /* pointer to gtt offset zero */ - char *end; /* pointer to gtt offset zero */ - unsigned print_addresses; -}; - - -/* Internal functions - */ -void i915_disassemble_program(struct debug_stream *stream, - const unsigned *program, unsigned sz); - -void i915_print_ureg(const char *msg, unsigned ureg); - - -#define DEBUG_BATCH 0x1 -#define DEBUG_BLIT 0x2 -#define DEBUG_BUFFER 0x4 -#define DEBUG_CONSTANTS 0x8 -#define DEBUG_CONTEXT 0x10 -#define DEBUG_DRAW 0x20 -#define DEBUG_DYNAMIC 0x40 -#define DEBUG_FLUSH 0x80 -#define DEBUG_MAP 0x100 -#define DEBUG_PROGRAM 0x200 -#define DEBUG_REGIONS 0x400 -#define DEBUG_SAMPLER 0x800 -#define DEBUG_STATIC 0x1000 -#define DEBUG_SURFACE 0x2000 -#define DEBUG_WINSYS 0x4000 - -#include "pipe/p_compiler.h" - -#if defined(DEBUG) && defined(FILE_DEBUG_FLAG) - -#include "pipe/internal/p_winsys_screen.h" - -static INLINE void -I915_DBG( - struct i915_context *i915, - const char *fmt, - ... ) -{ - if ((i915)->debug & FILE_DEBUG_FLAG) { - va_list args; - - va_start( args, fmt ); - debug_vprintf( fmt, args ); - va_end( args ); - } -} - -#else - -static INLINE void -I915_DBG( - struct i915_context *i915, - const char *fmt, - ... ) -{ - (void) i915; - (void) fmt; -} - -#endif - - -struct intel_batchbuffer; - -void i915_dump_batchbuffer( struct intel_batchbuffer *i915 ); - -void i915_debug_init( struct i915_context *i915 ); - - -#endif diff --git a/src/gallium/drivers/i915simple/i915_debug_fp.c b/src/gallium/drivers/i915simple/i915_debug_fp.c deleted file mode 100644 index 9c5b117b6d..0000000000 --- a/src/gallium/drivers/i915simple/i915_debug_fp.c +++ /dev/null @@ -1,363 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#include "i915_reg.h" -#include "i915_debug.h" -#include "pipe/internal/p_winsys_screen.h" -#include "util/u_memory.h" - - -static void -PRINTF( - struct debug_stream *stream, - const char *fmt, - ... ) -{ - va_list args; - - va_start( args, fmt ); - debug_vprintf( fmt, args ); - va_end( args ); -} - - -static const char *opcodes[0x20] = { - "NOP", - "ADD", - "MOV", - "MUL", - "MAD", - "DP2ADD", - "DP3", - "DP4", - "FRC", - "RCP", - "RSQ", - "EXP", - "LOG", - "CMP", - "MIN", - "MAX", - "FLR", - "MOD", - "TRC", - "SGE", - "SLT", - "TEXLD", - "TEXLDP", - "TEXLDB", - "TEXKILL", - "DCL", - "0x1a", - "0x1b", - "0x1c", - "0x1d", - "0x1e", - "0x1f", -}; - - -static const int args[0x20] = { - 0, /* 0 nop */ - 2, /* 1 add */ - 1, /* 2 mov */ - 2, /* 3 m ul */ - 3, /* 4 mad */ - 3, /* 5 dp2add */ - 2, /* 6 dp3 */ - 2, /* 7 dp4 */ - 1, /* 8 frc */ - 1, /* 9 rcp */ - 1, /* a rsq */ - 1, /* b exp */ - 1, /* c log */ - 3, /* d cmp */ - 2, /* e min */ - 2, /* f max */ - 1, /* 10 flr */ - 1, /* 11 mod */ - 1, /* 12 trc */ - 2, /* 13 sge */ - 2, /* 14 slt */ - 1, - 1, - 1, - 1, - 0, - 0, - 0, - 0, - 0, - 0, - 0, -}; - - -static const char *regname[0x8] = { - "R", - "T", - "CONST", - "S", - "OC", - "OD", - "U", - "UNKNOWN", -}; - -static void -print_reg_type_nr(struct debug_stream *stream, unsigned type, unsigned nr) -{ - switch (type) { - case REG_TYPE_T: - switch (nr) { - case T_DIFFUSE: - PRINTF(stream, "T_DIFFUSE"); - return; - case T_SPECULAR: - PRINTF(stream, "T_SPECULAR"); - return; - case T_FOG_W: - PRINTF(stream, "T_FOG_W"); - return; - default: - PRINTF(stream, "T_TEX%d", nr); - return; - } - case REG_TYPE_OC: - if (nr == 0) { - PRINTF(stream, "oC"); - return; - } - break; - case REG_TYPE_OD: - if (nr == 0) { - PRINTF(stream, "oD"); - return; - } - break; - default: - break; - } - - PRINTF(stream, "%s[%d]", regname[type], nr); -} - -#define REG_SWIZZLE_MASK 0x7777 -#define REG_NEGATE_MASK 0x8888 - -#define REG_SWIZZLE_XYZW ((SRC_X << A2_SRC2_CHANNEL_X_SHIFT) | \ - (SRC_Y << A2_SRC2_CHANNEL_Y_SHIFT) | \ - (SRC_Z << A2_SRC2_CHANNEL_Z_SHIFT) | \ - (SRC_W << A2_SRC2_CHANNEL_W_SHIFT)) - - -static void -print_reg_neg_swizzle(struct debug_stream *stream, unsigned reg) -{ - int i; - - if ((reg & REG_SWIZZLE_MASK) == REG_SWIZZLE_XYZW && - (reg & REG_NEGATE_MASK) == 0) - return; - - PRINTF(stream, "."); - - for (i = 3; i >= 0; i--) { - if (reg & (1 << ((i * 4) + 3))) - PRINTF(stream, "-"); - - switch ((reg >> (i * 4)) & 0x7) { - case 0: - PRINTF(stream, "x"); - break; - case 1: - PRINTF(stream, "y"); - break; - case 2: - PRINTF(stream, "z"); - break; - case 3: - PRINTF(stream, "w"); - break; - case 4: - PRINTF(stream, "0"); - break; - case 5: - PRINTF(stream, "1"); - break; - default: - PRINTF(stream, "?"); - break; - } - } -} - - -static void -print_src_reg(struct debug_stream *stream, unsigned dword) -{ - unsigned nr = (dword >> A2_SRC2_NR_SHIFT) & REG_NR_MASK; - unsigned type = (dword >> A2_SRC2_TYPE_SHIFT) & REG_TYPE_MASK; - print_reg_type_nr(stream, type, nr); - print_reg_neg_swizzle(stream, dword); -} - - -static void -print_dest_reg(struct debug_stream *stream, unsigned dword) -{ - unsigned nr = (dword >> A0_DEST_NR_SHIFT) & REG_NR_MASK; - unsigned type = (dword >> A0_DEST_TYPE_SHIFT) & REG_TYPE_MASK; - print_reg_type_nr(stream, type, nr); - if ((dword & A0_DEST_CHANNEL_ALL) == A0_DEST_CHANNEL_ALL) - return; - PRINTF(stream, "."); - if (dword & A0_DEST_CHANNEL_X) - PRINTF(stream, "x"); - if (dword & A0_DEST_CHANNEL_Y) - PRINTF(stream, "y"); - if (dword & A0_DEST_CHANNEL_Z) - PRINTF(stream, "z"); - if (dword & A0_DEST_CHANNEL_W) - PRINTF(stream, "w"); -} - - -#define GET_SRC0_REG(r0, r1) ((r0<<14)|(r1>>A1_SRC0_CHANNEL_W_SHIFT)) -#define GET_SRC1_REG(r0, r1) ((r0<<8)|(r1>>A2_SRC1_CHANNEL_W_SHIFT)) -#define GET_SRC2_REG(r) (r) - - -static void -print_arith_op(struct debug_stream *stream, - unsigned opcode, const unsigned * program) -{ - if (opcode != A0_NOP) { - print_dest_reg(stream, program[0]); - if (program[0] & A0_DEST_SATURATE) - PRINTF(stream, " = SATURATE "); - else - PRINTF(stream, " = "); - } - - PRINTF(stream, "%s ", opcodes[opcode]); - - print_src_reg(stream, GET_SRC0_REG(program[0], program[1])); - if (args[opcode] == 1) { - PRINTF(stream, "\n"); - return; - } - - PRINTF(stream, ", "); - print_src_reg(stream, GET_SRC1_REG(program[1], program[2])); - if (args[opcode] == 2) { - PRINTF(stream, "\n"); - return; - } - - PRINTF(stream, ", "); - print_src_reg(stream, GET_SRC2_REG(program[2])); - PRINTF(stream, "\n"); - return; -} - - -static void -print_tex_op(struct debug_stream *stream, - unsigned opcode, const unsigned * program) -{ - print_dest_reg(stream, program[0] | A0_DEST_CHANNEL_ALL); - PRINTF(stream, " = "); - - PRINTF(stream, "%s ", opcodes[opcode]); - - PRINTF(stream, "S[%d],", program[0] & T0_SAMPLER_NR_MASK); - - print_reg_type_nr(stream, - (program[1] >> T1_ADDRESS_REG_TYPE_SHIFT) & - REG_TYPE_MASK, - (program[1] >> T1_ADDRESS_REG_NR_SHIFT) & REG_NR_MASK); - PRINTF(stream, "\n"); -} - -static void -print_texkil_op(struct debug_stream *stream, - unsigned opcode, const unsigned * program) -{ - PRINTF(stream, "TEXKIL "); - - print_reg_type_nr(stream, - (program[1] >> T1_ADDRESS_REG_TYPE_SHIFT) & - REG_TYPE_MASK, - (program[1] >> T1_ADDRESS_REG_NR_SHIFT) & REG_NR_MASK); - PRINTF(stream, "\n"); -} - -static void -print_dcl_op(struct debug_stream *stream, - unsigned opcode, const unsigned * program) -{ - PRINTF(stream, "%s ", opcodes[opcode]); - print_dest_reg(stream, - program[0] | A0_DEST_CHANNEL_ALL); - PRINTF(stream, "\n"); -} - - -void -i915_disassemble_program(struct debug_stream *stream, - const unsigned * program, unsigned sz) -{ - unsigned i; - - PRINTF(stream, "\t\tBEGIN\n"); - - assert((program[0] & 0x1ff) + 2 == sz); - - program++; - for (i = 1; i < sz; i += 3, program += 3) { - unsigned opcode = program[0] & (0x1f << 24); - - PRINTF(stream, "\t\t"); - - if ((int) opcode >= A0_NOP && opcode <= A0_SLT) - print_arith_op(stream, opcode >> 24, program); - else if (opcode >= T0_TEXLD && opcode < T0_TEXKILL) - print_tex_op(stream, opcode >> 24, program); - else if (opcode == T0_TEXKILL) - print_texkil_op(stream, opcode >> 24, program); - else if (opcode == D0_DCL) - print_dcl_op(stream, opcode >> 24, program); - else - PRINTF(stream, "Unknown opcode 0x%x\n", opcode); - } - - PRINTF(stream, "\t\tEND\n\n"); -} - - diff --git a/src/gallium/drivers/i915simple/i915_flush.c b/src/gallium/drivers/i915simple/i915_flush.c deleted file mode 100644 index 1582168eba..0000000000 --- a/src/gallium/drivers/i915simple/i915_flush.c +++ /dev/null @@ -1,86 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * 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. - * - **************************************************************************/ - -/* Author: - * Keith Whitwell - */ - - -#include "pipe/p_defines.h" -#include "draw/draw_context.h" -#include "i915_context.h" -#include "i915_reg.h" -#include "i915_batch.h" - - -static void i915_flush( struct pipe_context *pipe, - unsigned flags, - struct pipe_fence_handle **fence ) -{ - struct i915_context *i915 = i915_context(pipe); - - draw_flush(i915->draw); - -#if 0 - /* Do we need to emit an MI_FLUSH command to flush the hardware - * caches? - */ - if (flags & (PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE)) { - unsigned flush = MI_FLUSH; - - if (!(flags & PIPE_FLUSH_RENDER_CACHE)) - flush |= INHIBIT_FLUSH_RENDER_CACHE; - - if (flags & PIPE_FLUSH_TEXTURE_CACHE) - flush |= FLUSH_MAP_CACHE; - - if (!BEGIN_BATCH(1, 0)) { - FLUSH_BATCH(NULL); - assert(BEGIN_BATCH(1, 0)); - } - OUT_BATCH( flush ); - } -#endif - -#if 0 - if (i915->batch->map == i915->batch->ptr) { - return; - } -#endif - - /* If there are no flags, just flush pending commands to hardware: - */ - FLUSH_BATCH(fence); - i915->vbo_flushed = 1; -} - - - -void i915_init_flush_functions( struct i915_context *i915 ) -{ - i915->base.flush = i915_flush; -} diff --git a/src/gallium/drivers/i915simple/i915_fpc.h b/src/gallium/drivers/i915simple/i915_fpc.h deleted file mode 100644 index 2f0f99d046..0000000000 --- a/src/gallium/drivers/i915simple/i915_fpc.h +++ /dev/null @@ -1,207 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#ifndef I915_FPC_H -#define I915_FPC_H - - -#include "i915_context.h" -#include "i915_reg.h" - - - -#define I915_PROGRAM_SIZE 192 - - - -/** - * Program translation state - */ -struct i915_fp_compile { - struct i915_fragment_shader *shader; /* the shader we're compiling */ - - boolean used_constants[I915_MAX_CONSTANT]; - - /** maps TGSI immediate index to constant slot */ - uint num_immediates; - uint immediates_map[I915_MAX_CONSTANT]; - float immediates[I915_MAX_CONSTANT][4]; - - boolean first_instruction; - - uint declarations[I915_PROGRAM_SIZE]; - uint program[I915_PROGRAM_SIZE]; - - uint *csr; /**< Cursor, points into program. */ - - uint *decl; /**< Cursor, points into declarations. */ - - uint decl_s; /**< flags for which s regs need to be decl'd */ - uint decl_t; /**< flags for which t regs need to be decl'd */ - - uint temp_flag; /**< Tracks temporary regs which are in use */ - uint utemp_flag; /**< Tracks TYPE_U temporary regs which are in use */ - - uint nr_tex_indirect; - uint nr_tex_insn; - uint nr_alu_insn; - uint nr_decl_insn; - - boolean error; /**< Set if i915_program_error() is called */ - uint wpos_tex; - uint NumNativeInstructions; - uint NumNativeAluInstructions; - uint NumNativeTexInstructions; - uint NumNativeTexIndirections; -}; - - -/* Having zero and one in here makes the definition of swizzle a lot - * easier. - */ -#define UREG_TYPE_SHIFT 29 -#define UREG_NR_SHIFT 24 -#define UREG_CHANNEL_X_NEGATE_SHIFT 23 -#define UREG_CHANNEL_X_SHIFT 20 -#define UREG_CHANNEL_Y_NEGATE_SHIFT 19 -#define UREG_CHANNEL_Y_SHIFT 16 -#define UREG_CHANNEL_Z_NEGATE_SHIFT 15 -#define UREG_CHANNEL_Z_SHIFT 12 -#define UREG_CHANNEL_W_NEGATE_SHIFT 11 -#define UREG_CHANNEL_W_SHIFT 8 -#define UREG_CHANNEL_ZERO_NEGATE_MBZ 5 -#define UREG_CHANNEL_ZERO_SHIFT 4 -#define UREG_CHANNEL_ONE_NEGATE_MBZ 1 -#define UREG_CHANNEL_ONE_SHIFT 0 - -#define UREG_BAD 0xffffffff /* not a valid ureg */ - -#define X SRC_X -#define Y SRC_Y -#define Z SRC_Z -#define W SRC_W -#define ZERO SRC_ZERO -#define ONE SRC_ONE - -/* Construct a ureg: - */ -#define UREG( type, nr ) (((type)<< UREG_TYPE_SHIFT) | \ - ((nr) << UREG_NR_SHIFT) | \ - (X << UREG_CHANNEL_X_SHIFT) | \ - (Y << UREG_CHANNEL_Y_SHIFT) | \ - (Z << UREG_CHANNEL_Z_SHIFT) | \ - (W << UREG_CHANNEL_W_SHIFT) | \ - (ZERO << UREG_CHANNEL_ZERO_SHIFT) | \ - (ONE << UREG_CHANNEL_ONE_SHIFT)) - -#define GET_CHANNEL_SRC( reg, channel ) ((reg<<(channel*4)) & (0xf<<20)) -#define CHANNEL_SRC( src, channel ) (src>>(channel*4)) - -#define GET_UREG_TYPE(reg) (((reg)>>UREG_TYPE_SHIFT)®_TYPE_MASK) -#define GET_UREG_NR(reg) (((reg)>>UREG_NR_SHIFT)®_NR_MASK) - - - -#define UREG_XYZW_CHANNEL_MASK 0x00ffff00 - -/* One neat thing about the UREG representation: - */ -static INLINE int -swizzle(int reg, uint x, uint y, uint z, uint w) -{ - assert(x <= SRC_ONE); - assert(y <= SRC_ONE); - assert(z <= SRC_ONE); - assert(w <= SRC_ONE); - return ((reg & ~UREG_XYZW_CHANNEL_MASK) | - CHANNEL_SRC(GET_CHANNEL_SRC(reg, x), 0) | - CHANNEL_SRC(GET_CHANNEL_SRC(reg, y), 1) | - CHANNEL_SRC(GET_CHANNEL_SRC(reg, z), 2) | - CHANNEL_SRC(GET_CHANNEL_SRC(reg, w), 3)); -} - - - -/*********************************************************************** - * Public interface for the compiler - */ -extern void -i915_translate_fragment_program( struct i915_context *i915, - struct i915_fragment_shader *fs); - - - -extern uint i915_get_temp(struct i915_fp_compile *p); -extern uint i915_get_utemp(struct i915_fp_compile *p); -extern void i915_release_utemps(struct i915_fp_compile *p); - - -extern uint i915_emit_texld(struct i915_fp_compile *p, - uint dest, - uint destmask, - uint sampler, uint coord, uint op); - -extern uint i915_emit_arith(struct i915_fp_compile *p, - uint op, - uint dest, - uint mask, - uint saturate, - uint src0, uint src1, uint src2); - -extern uint i915_emit_decl(struct i915_fp_compile *p, - uint type, uint nr, uint d0_flags); - - -extern uint i915_emit_const1f(struct i915_fp_compile *p, float c0); - -extern uint i915_emit_const2f(struct i915_fp_compile *p, - float c0, float c1); - -extern uint i915_emit_const4fv(struct i915_fp_compile *p, - const float * c); - -extern uint i915_emit_const4f(struct i915_fp_compile *p, - float c0, float c1, - float c2, float c3); - - -/*====================================================================== - * i915_fpc_debug.c - */ -extern void i915_disassemble_program(const uint * program, uint sz); - - -/*====================================================================== - * i915_fpc_translate.c - */ - -extern void -i915_program_error(struct i915_fp_compile *p, const char *msg, ...); - - -#endif diff --git a/src/gallium/drivers/i915simple/i915_fpc_emit.c b/src/gallium/drivers/i915simple/i915_fpc_emit.c deleted file mode 100644 index b054ce41d3..0000000000 --- a/src/gallium/drivers/i915simple/i915_fpc_emit.c +++ /dev/null @@ -1,375 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include "i915_reg.h" -#include "i915_context.h" -#include "i915_fpc.h" -#include "util/u_math.h" - - -#define A0_DEST( reg ) (((reg)&UREG_TYPE_NR_MASK)>>UREG_A0_DEST_SHIFT_LEFT) -#define D0_DEST( reg ) (((reg)&UREG_TYPE_NR_MASK)>>UREG_A0_DEST_SHIFT_LEFT) -#define T0_DEST( reg ) (((reg)&UREG_TYPE_NR_MASK)>>UREG_A0_DEST_SHIFT_LEFT) -#define A0_SRC0( reg ) (((reg)&UREG_MASK)>>UREG_A0_SRC0_SHIFT_LEFT) -#define A1_SRC0( reg ) (((reg)&UREG_MASK)<>UREG_A1_SRC1_SHIFT_LEFT) -#define A2_SRC1( reg ) (((reg)&UREG_MASK)<>UREG_A2_SRC2_SHIFT_LEFT) - -/* These are special, and don't have swizzle/negate bits. - */ -#define T0_SAMPLER( reg ) (GET_UREG_NR(reg)<temp_flag); - if (!bit) { - i915_program_error(p, "i915_get_temp: out of temporaries\n"); - return 0; - } - - p->temp_flag |= 1 << (bit - 1); - return bit - 1; -} - - -static void -i915_release_temp(struct i915_fp_compile *p, int reg) -{ - p->temp_flag &= ~(1 << reg); -} - - -/** - * Get unpreserved temporary, a temp whose value is not preserved between - * PS program phases. - */ -uint -i915_get_utemp(struct i915_fp_compile * p) -{ - int bit = ffs(~p->utemp_flag); - if (!bit) { - i915_program_error(p, "i915_get_utemp: out of temporaries\n"); - return 0; - } - - p->utemp_flag |= 1 << (bit - 1); - return UREG(REG_TYPE_U, (bit - 1)); -} - -void -i915_release_utemps(struct i915_fp_compile *p) -{ - p->utemp_flag = ~0x7; -} - - -uint -i915_emit_decl(struct i915_fp_compile *p, - uint type, uint nr, uint d0_flags) -{ - uint reg = UREG(type, nr); - - if (type == REG_TYPE_T) { - if (p->decl_t & (1 << nr)) - return reg; - - p->decl_t |= (1 << nr); - } - else if (type == REG_TYPE_S) { - if (p->decl_s & (1 << nr)) - return reg; - - p->decl_s |= (1 << nr); - } - else - return reg; - - *(p->decl++) = (D0_DCL | D0_DEST(reg) | d0_flags); - *(p->decl++) = D1_MBZ; - *(p->decl++) = D2_MBZ; - - p->nr_decl_insn++; - return reg; -} - -uint -i915_emit_arith(struct i915_fp_compile * p, - uint op, - uint dest, - uint mask, - uint saturate, uint src0, uint src1, uint src2) -{ - uint c[3]; - uint nr_const = 0; - - assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST); - dest = UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest)); - assert(dest); - - if (GET_UREG_TYPE(src0) == REG_TYPE_CONST) - c[nr_const++] = 0; - if (GET_UREG_TYPE(src1) == REG_TYPE_CONST) - c[nr_const++] = 1; - if (GET_UREG_TYPE(src2) == REG_TYPE_CONST) - c[nr_const++] = 2; - - /* Recursively call this function to MOV additional const values - * into temporary registers. Use utemp registers for this - - * currently shouldn't be possible to run out, but keep an eye on - * this. - */ - if (nr_const > 1) { - uint s[3], first, i, old_utemp_flag; - - s[0] = src0; - s[1] = src1; - s[2] = src2; - old_utemp_flag = p->utemp_flag; - - first = GET_UREG_NR(s[c[0]]); - for (i = 1; i < nr_const; i++) { - if (GET_UREG_NR(s[c[i]]) != first) { - uint tmp = i915_get_utemp(p); - - i915_emit_arith(p, A0_MOV, tmp, A0_DEST_CHANNEL_ALL, 0, - s[c[i]], 0, 0); - s[c[i]] = tmp; - } - } - - src0 = s[0]; - src1 = s[1]; - src2 = s[2]; - p->utemp_flag = old_utemp_flag; /* restore */ - } - - *(p->csr++) = (op | A0_DEST(dest) | mask | saturate | A0_SRC0(src0)); - *(p->csr++) = (A1_SRC0(src0) | A1_SRC1(src1)); - *(p->csr++) = (A2_SRC1(src1) | A2_SRC2(src2)); - - p->nr_alu_insn++; - return dest; -} - - -/** - * Emit a texture load or texkill instruction. - * \param dest the dest i915 register - * \param destmask the dest register writemask - * \param sampler the i915 sampler register - * \param coord the i915 source texcoord operand - * \param opcode the instruction opcode - */ -uint i915_emit_texld( struct i915_fp_compile *p, - uint dest, - uint destmask, - uint sampler, - uint coord, - uint opcode ) -{ - const uint k = UREG(GET_UREG_TYPE(coord), GET_UREG_NR(coord)); - int temp = -1; - - if (coord != k) { - /* texcoord is swizzled or negated. Need to allocate a new temporary - * register (a utemp / unpreserved temp) won't do. - */ - uint tempReg; - - temp = i915_get_temp(p); /* get temp reg index */ - tempReg = UREG(REG_TYPE_R, temp); /* make i915 register */ - - i915_emit_arith( p, A0_MOV, - tempReg, A0_DEST_CHANNEL_ALL, /* dest reg, writemask */ - 0, /* saturate */ - coord, 0, 0 ); /* src0, src1, src2 */ - - /* new src texcoord is tempReg */ - coord = tempReg; - } - - /* Don't worry about saturate as we only support - */ - if (destmask != A0_DEST_CHANNEL_ALL) { - /* if not writing to XYZW... */ - uint tmp = i915_get_utemp(p); - i915_emit_texld( p, tmp, A0_DEST_CHANNEL_ALL, sampler, coord, opcode ); - i915_emit_arith( p, A0_MOV, dest, destmask, 0, tmp, 0, 0 ); - /* XXX release utemp here? */ - } - else { - assert(GET_UREG_TYPE(dest) != REG_TYPE_CONST); - assert(dest = UREG(GET_UREG_TYPE(dest), GET_UREG_NR(dest))); - - /* is the sampler coord a texcoord input reg? */ - if (GET_UREG_TYPE(coord) != REG_TYPE_T) { - p->nr_tex_indirect++; - } - - *(p->csr++) = (opcode | - T0_DEST( dest ) | - T0_SAMPLER( sampler )); - - *(p->csr++) = T1_ADDRESS_REG( coord ); - *(p->csr++) = T2_MBZ; - - p->nr_tex_insn++; - } - - if (temp >= 0) - i915_release_temp(p, temp); - - return dest; -} - - -uint -i915_emit_const1f(struct i915_fp_compile * p, float c0) -{ - struct i915_fragment_shader *ifs = p->shader; - unsigned reg, idx; - - if (c0 == 0.0) - return swizzle(UREG(REG_TYPE_R, 0), ZERO, ZERO, ZERO, ZERO); - if (c0 == 1.0) - return swizzle(UREG(REG_TYPE_R, 0), ONE, ONE, ONE, ONE); - - for (reg = 0; reg < I915_MAX_CONSTANT; reg++) { - if (ifs->constant_flags[reg] == I915_CONSTFLAG_USER) - continue; - for (idx = 0; idx < 4; idx++) { - if (!(ifs->constant_flags[reg] & (1 << idx)) || - ifs->constants[reg][idx] == c0) { - ifs->constants[reg][idx] = c0; - ifs->constant_flags[reg] |= 1 << idx; - if (reg + 1 > ifs->num_constants) - ifs->num_constants = reg + 1; - return swizzle(UREG(REG_TYPE_CONST, reg), idx, ZERO, ZERO, ONE); - } - } - } - - i915_program_error(p, "i915_emit_const1f: out of constants\n"); - return 0; -} - -uint -i915_emit_const2f(struct i915_fp_compile * p, float c0, float c1) -{ - struct i915_fragment_shader *ifs = p->shader; - unsigned reg, idx; - - if (c0 == 0.0) - return swizzle(i915_emit_const1f(p, c1), ZERO, X, Z, W); - if (c0 == 1.0) - return swizzle(i915_emit_const1f(p, c1), ONE, X, Z, W); - - if (c1 == 0.0) - return swizzle(i915_emit_const1f(p, c0), X, ZERO, Z, W); - if (c1 == 1.0) - return swizzle(i915_emit_const1f(p, c0), X, ONE, Z, W); - - for (reg = 0; reg < I915_MAX_CONSTANT; reg++) { - if (ifs->constant_flags[reg] == 0xf || - ifs->constant_flags[reg] == I915_CONSTFLAG_USER) - continue; - for (idx = 0; idx < 3; idx++) { - if (!(ifs->constant_flags[reg] & (3 << idx))) { - ifs->constants[reg][idx + 0] = c0; - ifs->constants[reg][idx + 1] = c1; - ifs->constant_flags[reg] |= 3 << idx; - if (reg + 1 > ifs->num_constants) - ifs->num_constants = reg + 1; - return swizzle(UREG(REG_TYPE_CONST, reg), idx, idx + 1, ZERO, ONE); - } - } - } - - i915_program_error(p, "i915_emit_const2f: out of constants\n"); - return 0; -} - - - -uint -i915_emit_const4f(struct i915_fp_compile * p, - float c0, float c1, float c2, float c3) -{ - struct i915_fragment_shader *ifs = p->shader; - unsigned reg; - - for (reg = 0; reg < I915_MAX_CONSTANT; reg++) { - if (ifs->constant_flags[reg] == 0xf && - ifs->constants[reg][0] == c0 && - ifs->constants[reg][1] == c1 && - ifs->constants[reg][2] == c2 && - ifs->constants[reg][3] == c3) { - return UREG(REG_TYPE_CONST, reg); - } - else if (ifs->constant_flags[reg] == 0) { - - ifs->constants[reg][0] = c0; - ifs->constants[reg][1] = c1; - ifs->constants[reg][2] = c2; - ifs->constants[reg][3] = c3; - ifs->constant_flags[reg] = 0xf; - if (reg + 1 > ifs->num_constants) - ifs->num_constants = reg + 1; - return UREG(REG_TYPE_CONST, reg); - } - } - - i915_program_error(p, "i915_emit_const4f: out of constants\n"); - return 0; -} - - -uint -i915_emit_const4fv(struct i915_fp_compile * p, const float * c) -{ - return i915_emit_const4f(p, c[0], c[1], c[2], c[3]); -} diff --git a/src/gallium/drivers/i915simple/i915_fpc_translate.c b/src/gallium/drivers/i915simple/i915_fpc_translate.c deleted file mode 100644 index 89504ced27..0000000000 --- a/src/gallium/drivers/i915simple/i915_fpc_translate.c +++ /dev/null @@ -1,1202 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#include - -#include "i915_reg.h" -#include "i915_context.h" -#include "i915_fpc.h" - -#include "pipe/p_shader_tokens.h" -#include "util/u_math.h" -#include "util/u_memory.h" -#include "util/u_string.h" -#include "tgsi/tgsi_parse.h" -#include "tgsi/tgsi_dump.h" - -#include "draw/draw_vertex.h" - - -/** - * Simple pass-through fragment shader to use when we don't have - * a real shader (or it fails to compile for some reason). - */ -static unsigned passthrough[] = -{ - _3DSTATE_PIXEL_SHADER_PROGRAM | ((2*3)-1), - - /* declare input color: - */ - (D0_DCL | - (REG_TYPE_T << D0_TYPE_SHIFT) | - (T_DIFFUSE << D0_NR_SHIFT) | - D0_CHANNEL_ALL), - 0, - 0, - - /* move to output color: - */ - (A0_MOV | - (REG_TYPE_OC << A0_DEST_TYPE_SHIFT) | - A0_DEST_CHANNEL_ALL | - (REG_TYPE_T << A0_SRC0_TYPE_SHIFT) | - (T_DIFFUSE << A0_SRC0_NR_SHIFT)), - 0x01230000, /* .xyzw */ - 0 -}; - - -/* 1, -1/3!, 1/5!, -1/7! */ -static const float sin_constants[4] = { 1.0, - -1.0f / (3 * 2 * 1), - 1.0f / (5 * 4 * 3 * 2 * 1), - -1.0f / (7 * 6 * 5 * 4 * 3 * 2 * 1) -}; - -/* 1, -1/2!, 1/4!, -1/6! */ -static const float cos_constants[4] = { 1.0, - -1.0f / (2 * 1), - 1.0f / (4 * 3 * 2 * 1), - -1.0f / (6 * 5 * 4 * 3 * 2 * 1) -}; - - - -/** - * component-wise negation of ureg - */ -static INLINE int -negate(int reg, int x, int y, int z, int w) -{ - /* Another neat thing about the UREG representation */ - return reg ^ (((x & 1) << UREG_CHANNEL_X_NEGATE_SHIFT) | - ((y & 1) << UREG_CHANNEL_Y_NEGATE_SHIFT) | - ((z & 1) << UREG_CHANNEL_Z_NEGATE_SHIFT) | - ((w & 1) << UREG_CHANNEL_W_NEGATE_SHIFT)); -} - - -/** - * In the event of a translation failure, we'll generate a simple color - * pass-through program. - */ -static void -i915_use_passthrough_shader(struct i915_fragment_shader *fs) -{ - fs->program = (uint *) MALLOC(sizeof(passthrough)); - if (fs->program) { - memcpy(fs->program, passthrough, sizeof(passthrough)); - fs->program_len = Elements(passthrough); - } - fs->num_constants = 0; -} - - -void -i915_program_error(struct i915_fp_compile *p, const char *msg, ...) -{ - va_list args; - char buffer[1024]; - - debug_printf("i915_program_error: "); - va_start( args, msg ); - util_vsnprintf( buffer, sizeof(buffer), msg, args ); - va_end( args ); - debug_printf(buffer); - debug_printf("\n"); - - p->error = 1; -} - - - -/** - * Construct a ureg for the given source register. Will emit - * constants, apply swizzling and negation as needed. - */ -static uint -src_vector(struct i915_fp_compile *p, - const struct tgsi_full_src_register *source) -{ - uint index = source->SrcRegister.Index; - uint src = 0, sem_name, sem_ind; - - switch (source->SrcRegister.File) { - case TGSI_FILE_TEMPORARY: - if (source->SrcRegister.Index >= I915_MAX_TEMPORARY) { - i915_program_error(p, "Exceeded max temporary reg"); - return 0; - } - src = UREG(REG_TYPE_R, index); - break; - case TGSI_FILE_INPUT: - /* XXX: Packing COL1, FOGC into a single attribute works for - * texenv programs, but will fail for real fragment programs - * that use these attributes and expect them to be a full 4 - * components wide. Could use a texcoord to pass these - * attributes if necessary, but that won't work in the general - * case. - * - * We also use a texture coordinate to pass wpos when possible. - */ - - sem_name = p->shader->info.input_semantic_name[index]; - sem_ind = p->shader->info.input_semantic_index[index]; - - switch (sem_name) { - case TGSI_SEMANTIC_POSITION: - debug_printf("SKIP SEM POS\n"); - /* - assert(p->wpos_tex != -1); - src = i915_emit_decl(p, REG_TYPE_T, p->wpos_tex, D0_CHANNEL_ALL); - */ - break; - case TGSI_SEMANTIC_COLOR: - if (sem_ind == 0) { - src = i915_emit_decl(p, REG_TYPE_T, T_DIFFUSE, D0_CHANNEL_ALL); - } - else { - /* secondary color */ - assert(sem_ind == 1); - src = i915_emit_decl(p, REG_TYPE_T, T_SPECULAR, D0_CHANNEL_XYZ); - src = swizzle(src, X, Y, Z, ONE); - } - break; - case TGSI_SEMANTIC_FOG: - src = i915_emit_decl(p, REG_TYPE_T, T_FOG_W, D0_CHANNEL_W); - src = swizzle(src, W, W, W, W); - break; - case TGSI_SEMANTIC_GENERIC: - /* usually a texcoord */ - src = i915_emit_decl(p, REG_TYPE_T, T_TEX0 + sem_ind, D0_CHANNEL_ALL); - break; - default: - i915_program_error(p, "Bad source->Index"); - return 0; - } - break; - - case TGSI_FILE_IMMEDIATE: - assert(index < p->num_immediates); - index = p->immediates_map[index]; - /* fall-through */ - case TGSI_FILE_CONSTANT: - src = UREG(REG_TYPE_CONST, index); - break; - - default: - i915_program_error(p, "Bad source->File"); - return 0; - } - - if (source->SrcRegister.Extended) { - src = swizzle(src, - source->SrcRegisterExtSwz.ExtSwizzleX, - source->SrcRegisterExtSwz.ExtSwizzleY, - source->SrcRegisterExtSwz.ExtSwizzleZ, - source->SrcRegisterExtSwz.ExtSwizzleW); - } - else { - src = swizzle(src, - source->SrcRegister.SwizzleX, - source->SrcRegister.SwizzleY, - source->SrcRegister.SwizzleZ, - source->SrcRegister.SwizzleW); - } - - - /* There's both negate-all-components and per-component negation. - * Try to handle both here. - */ - { - int nx = source->SrcRegisterExtSwz.NegateX; - int ny = source->SrcRegisterExtSwz.NegateY; - int nz = source->SrcRegisterExtSwz.NegateZ; - int nw = source->SrcRegisterExtSwz.NegateW; - if (source->SrcRegister.Negate) { - nx = !nx; - ny = !ny; - nz = !nz; - nw = !nw; - } - src = negate(src, nx, ny, nz, nw); - } - - /* no abs() or post-abs negation */ -#if 0 - /* XXX assertions disabled to allow arbfplight.c to run */ - /* XXX enable these assertions, or fix things */ - assert(!source->SrcRegisterExtMod.Absolute); - assert(!source->SrcRegisterExtMod.Negate); -#endif - return src; -} - - -/** - * Construct a ureg for a destination register. - */ -static uint -get_result_vector(struct i915_fp_compile *p, - const struct tgsi_full_dst_register *dest) -{ - switch (dest->DstRegister.File) { - case TGSI_FILE_OUTPUT: - { - uint sem_name = p->shader->info.output_semantic_name[dest->DstRegister.Index]; - switch (sem_name) { - case TGSI_SEMANTIC_POSITION: - return UREG(REG_TYPE_OD, 0); - case TGSI_SEMANTIC_COLOR: - return UREG(REG_TYPE_OC, 0); - default: - i915_program_error(p, "Bad inst->DstReg.Index/semantics"); - return 0; - } - } - case TGSI_FILE_TEMPORARY: - return UREG(REG_TYPE_R, dest->DstRegister.Index); - default: - i915_program_error(p, "Bad inst->DstReg.File"); - return 0; - } -} - - -/** - * Compute flags for saturation and writemask. - */ -static uint -get_result_flags(const struct tgsi_full_instruction *inst) -{ - const uint writeMask - = inst->FullDstRegisters[0].DstRegister.WriteMask; - uint flags = 0x0; - - if (inst->Instruction.Saturate == TGSI_SAT_ZERO_ONE) - flags |= A0_DEST_SATURATE; - - if (writeMask & TGSI_WRITEMASK_X) - flags |= A0_DEST_CHANNEL_X; - if (writeMask & TGSI_WRITEMASK_Y) - flags |= A0_DEST_CHANNEL_Y; - if (writeMask & TGSI_WRITEMASK_Z) - flags |= A0_DEST_CHANNEL_Z; - if (writeMask & TGSI_WRITEMASK_W) - flags |= A0_DEST_CHANNEL_W; - - return flags; -} - - -/** - * Convert TGSI_TEXTURE_x token to DO_SAMPLE_TYPE_x token - */ -static uint -translate_tex_src_target(struct i915_fp_compile *p, uint tex) -{ - switch (tex) { - case TGSI_TEXTURE_SHADOW1D: - /* fall-through */ - case TGSI_TEXTURE_1D: - return D0_SAMPLE_TYPE_2D; - - case TGSI_TEXTURE_SHADOW2D: - /* fall-through */ - case TGSI_TEXTURE_2D: - return D0_SAMPLE_TYPE_2D; - - case TGSI_TEXTURE_SHADOWRECT: - /* fall-through */ - case TGSI_TEXTURE_RECT: - return D0_SAMPLE_TYPE_2D; - - case TGSI_TEXTURE_3D: - return D0_SAMPLE_TYPE_VOLUME; - - case TGSI_TEXTURE_CUBE: - return D0_SAMPLE_TYPE_CUBE; - - default: - i915_program_error(p, "TexSrc type"); - return 0; - } -} - - -/** - * Generate texel lookup instruction. - */ -static void -emit_tex(struct i915_fp_compile *p, - const struct tgsi_full_instruction *inst, - uint opcode) -{ - uint texture = inst->InstructionExtTexture.Texture; - uint unit = inst->FullSrcRegisters[1].SrcRegister.Index; - uint tex = translate_tex_src_target( p, texture ); - uint sampler = i915_emit_decl(p, REG_TYPE_S, unit, tex); - uint coord = src_vector( p, &inst->FullSrcRegisters[0]); - - i915_emit_texld( p, - get_result_vector( p, &inst->FullDstRegisters[0] ), - get_result_flags( inst ), - sampler, - coord, - opcode); -} - - -/** - * Generate a simple arithmetic instruction - * \param opcode the i915 opcode - * \param numArgs the number of input/src arguments - */ -static void -emit_simple_arith(struct i915_fp_compile *p, - const struct tgsi_full_instruction *inst, - uint opcode, uint numArgs) -{ - uint arg1, arg2, arg3; - - assert(numArgs <= 3); - - arg1 = (numArgs < 1) ? 0 : src_vector( p, &inst->FullSrcRegisters[0] ); - arg2 = (numArgs < 2) ? 0 : src_vector( p, &inst->FullSrcRegisters[1] ); - arg3 = (numArgs < 3) ? 0 : src_vector( p, &inst->FullSrcRegisters[2] ); - - i915_emit_arith( p, - opcode, - get_result_vector( p, &inst->FullDstRegisters[0]), - get_result_flags( inst ), 0, - arg1, - arg2, - arg3 ); -} - - -/** As above, but swap the first two src regs */ -static void -emit_simple_arith_swap2(struct i915_fp_compile *p, - const struct tgsi_full_instruction *inst, - uint opcode, uint numArgs) -{ - struct tgsi_full_instruction inst2; - - assert(numArgs == 2); - - /* transpose first two registers */ - inst2 = *inst; - inst2.FullSrcRegisters[0] = inst->FullSrcRegisters[1]; - inst2.FullSrcRegisters[1] = inst->FullSrcRegisters[0]; - - emit_simple_arith(p, &inst2, opcode, numArgs); -} - - -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif - -/* - * Translate TGSI instruction to i915 instruction. - * - * Possible concerns: - * - * SIN, COS -- could use another taylor step? - * LIT -- results seem a little different to sw mesa - * LOG -- different to mesa on negative numbers, but this is conformant. - */ -static void -i915_translate_instruction(struct i915_fp_compile *p, - const struct tgsi_full_instruction *inst) -{ - uint writemask; - uint src0, src1, src2, flags; - uint tmp = 0; - - switch (inst->Instruction.Opcode) { - case TGSI_OPCODE_ABS: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - i915_emit_arith(p, - A0_MAX, - get_result_vector(p, &inst->FullDstRegisters[0]), - get_result_flags(inst), 0, - src0, negate(src0, 1, 1, 1, 1), 0); - break; - - case TGSI_OPCODE_ADD: - emit_simple_arith(p, inst, A0_ADD, 2); - break; - - case TGSI_OPCODE_CMP: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - src1 = src_vector(p, &inst->FullSrcRegisters[1]); - src2 = src_vector(p, &inst->FullSrcRegisters[2]); - i915_emit_arith(p, A0_CMP, - get_result_vector(p, &inst->FullDstRegisters[0]), - get_result_flags(inst), - 0, src0, src2, src1); /* NOTE: order of src2, src1 */ - break; - - case TGSI_OPCODE_COS: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - tmp = i915_get_utemp(p); - - i915_emit_arith(p, - A0_MUL, - tmp, A0_DEST_CHANNEL_X, 0, - src0, i915_emit_const1f(p, 1.0f / (float) (M_PI * 2.0)), 0); - - i915_emit_arith(p, A0_MOD, tmp, A0_DEST_CHANNEL_X, 0, tmp, 0, 0); - - /* By choosing different taylor constants, could get rid of this mul: - */ - i915_emit_arith(p, - A0_MUL, - tmp, A0_DEST_CHANNEL_X, 0, - tmp, i915_emit_const1f(p, (float) (M_PI * 2.0)), 0); - - /* - * t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1 - * t0 = MUL t0.xyxy t0.xx11 ; x^4, x^3, x^2, 1 - * t0 = MUL t0.xxz1 t0.z111 ; x^6 x^4 x^2 1 - * result = DP4 t0, cos_constants - */ - i915_emit_arith(p, - A0_MUL, - tmp, A0_DEST_CHANNEL_XY, 0, - swizzle(tmp, X, X, ONE, ONE), - swizzle(tmp, X, ONE, ONE, ONE), 0); - - i915_emit_arith(p, - A0_MUL, - tmp, A0_DEST_CHANNEL_XYZ, 0, - swizzle(tmp, X, Y, X, ONE), - swizzle(tmp, X, X, ONE, ONE), 0); - - i915_emit_arith(p, - A0_MUL, - tmp, A0_DEST_CHANNEL_XYZ, 0, - swizzle(tmp, X, X, Z, ONE), - swizzle(tmp, Z, ONE, ONE, ONE), 0); - - i915_emit_arith(p, - A0_DP4, - get_result_vector(p, &inst->FullDstRegisters[0]), - get_result_flags(inst), 0, - swizzle(tmp, ONE, Z, Y, X), - i915_emit_const4fv(p, cos_constants), 0); - break; - - case TGSI_OPCODE_DP3: - emit_simple_arith(p, inst, A0_DP3, 2); - break; - - case TGSI_OPCODE_DP4: - emit_simple_arith(p, inst, A0_DP4, 2); - break; - - case TGSI_OPCODE_DPH: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - src1 = src_vector(p, &inst->FullSrcRegisters[1]); - - i915_emit_arith(p, - A0_DP4, - get_result_vector(p, &inst->FullDstRegisters[0]), - get_result_flags(inst), 0, - swizzle(src0, X, Y, Z, ONE), src1, 0); - break; - - case TGSI_OPCODE_DST: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - src1 = src_vector(p, &inst->FullSrcRegisters[1]); - - /* result[0] = 1 * 1; - * result[1] = a[1] * b[1]; - * result[2] = a[2] * 1; - * result[3] = 1 * b[3]; - */ - i915_emit_arith(p, - A0_MUL, - get_result_vector(p, &inst->FullDstRegisters[0]), - get_result_flags(inst), 0, - swizzle(src0, ONE, Y, Z, ONE), - swizzle(src1, ONE, Y, ONE, W), 0); - break; - - case TGSI_OPCODE_END: - /* no-op */ - break; - - case TGSI_OPCODE_EX2: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - - i915_emit_arith(p, - A0_EXP, - get_result_vector(p, &inst->FullDstRegisters[0]), - get_result_flags(inst), 0, - swizzle(src0, X, X, X, X), 0, 0); - break; - - case TGSI_OPCODE_FLR: - emit_simple_arith(p, inst, A0_FLR, 1); - break; - - case TGSI_OPCODE_FRC: - emit_simple_arith(p, inst, A0_FRC, 1); - break; - - case TGSI_OPCODE_KIL: - /* kill if src[0].x < 0 || src[0].y < 0 ... */ - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - tmp = i915_get_utemp(p); - - i915_emit_texld(p, - tmp, /* dest reg: a dummy reg */ - A0_DEST_CHANNEL_ALL, /* dest writemask */ - 0, /* sampler */ - src0, /* coord*/ - T0_TEXKILL); /* opcode */ - break; - - case TGSI_OPCODE_KILP: - assert(0); /* not tested yet */ - break; - - case TGSI_OPCODE_LG2: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - - i915_emit_arith(p, - A0_LOG, - get_result_vector(p, &inst->FullDstRegisters[0]), - get_result_flags(inst), 0, - swizzle(src0, X, X, X, X), 0, 0); - break; - - case TGSI_OPCODE_LIT: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - tmp = i915_get_utemp(p); - - /* tmp = max( a.xyzw, a.00zw ) - * XXX: Clamp tmp.w to -128..128 - * tmp.y = log(tmp.y) - * tmp.y = tmp.w * tmp.y - * tmp.y = exp(tmp.y) - * result = cmp (a.11-x1, a.1x01, a.1xy1 ) - */ - i915_emit_arith(p, A0_MAX, tmp, A0_DEST_CHANNEL_ALL, 0, - src0, swizzle(src0, ZERO, ZERO, Z, W), 0); - - i915_emit_arith(p, A0_LOG, tmp, A0_DEST_CHANNEL_Y, 0, - swizzle(tmp, Y, Y, Y, Y), 0, 0); - - i915_emit_arith(p, A0_MUL, tmp, A0_DEST_CHANNEL_Y, 0, - swizzle(tmp, ZERO, Y, ZERO, ZERO), - swizzle(tmp, ZERO, W, ZERO, ZERO), 0); - - i915_emit_arith(p, A0_EXP, tmp, A0_DEST_CHANNEL_Y, 0, - swizzle(tmp, Y, Y, Y, Y), 0, 0); - - i915_emit_arith(p, A0_CMP, - get_result_vector(p, &inst->FullDstRegisters[0]), - get_result_flags(inst), 0, - negate(swizzle(tmp, ONE, ONE, X, ONE), 0, 0, 1, 0), - swizzle(tmp, ONE, X, ZERO, ONE), - swizzle(tmp, ONE, X, Y, ONE)); - - break; - - case TGSI_OPCODE_LRP: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - src1 = src_vector(p, &inst->FullSrcRegisters[1]); - src2 = src_vector(p, &inst->FullSrcRegisters[2]); - flags = get_result_flags(inst); - tmp = i915_get_utemp(p); - - /* b*a + c*(1-a) - * - * b*a + c - ca - * - * tmp = b*a + c, - * result = (-c)*a + tmp - */ - i915_emit_arith(p, A0_MAD, tmp, - flags & A0_DEST_CHANNEL_ALL, 0, src1, src0, src2); - - i915_emit_arith(p, A0_MAD, - get_result_vector(p, &inst->FullDstRegisters[0]), - flags, 0, negate(src2, 1, 1, 1, 1), src0, tmp); - break; - - case TGSI_OPCODE_MAD: - emit_simple_arith(p, inst, A0_MAD, 3); - break; - - case TGSI_OPCODE_MAX: - emit_simple_arith(p, inst, A0_MAX, 2); - break; - - case TGSI_OPCODE_MIN: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - src1 = src_vector(p, &inst->FullSrcRegisters[1]); - tmp = i915_get_utemp(p); - flags = get_result_flags(inst); - - i915_emit_arith(p, - A0_MAX, - tmp, flags & A0_DEST_CHANNEL_ALL, 0, - negate(src0, 1, 1, 1, 1), - negate(src1, 1, 1, 1, 1), 0); - - i915_emit_arith(p, - A0_MOV, - get_result_vector(p, &inst->FullDstRegisters[0]), - flags, 0, negate(tmp, 1, 1, 1, 1), 0, 0); - break; - - case TGSI_OPCODE_MOV: - case TGSI_OPCODE_SWZ: - emit_simple_arith(p, inst, A0_MOV, 1); - break; - - case TGSI_OPCODE_MUL: - emit_simple_arith(p, inst, A0_MUL, 2); - break; - - case TGSI_OPCODE_POW: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - src1 = src_vector(p, &inst->FullSrcRegisters[1]); - tmp = i915_get_utemp(p); - flags = get_result_flags(inst); - - /* XXX: masking on intermediate values, here and elsewhere. - */ - i915_emit_arith(p, - A0_LOG, - tmp, A0_DEST_CHANNEL_X, 0, - swizzle(src0, X, X, X, X), 0, 0); - - i915_emit_arith(p, A0_MUL, tmp, A0_DEST_CHANNEL_X, 0, tmp, src1, 0); - - i915_emit_arith(p, - A0_EXP, - get_result_vector(p, &inst->FullDstRegisters[0]), - flags, 0, swizzle(tmp, X, X, X, X), 0, 0); - break; - - case TGSI_OPCODE_RET: - /* XXX: no-op? */ - break; - - case TGSI_OPCODE_RCP: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - - i915_emit_arith(p, - A0_RCP, - get_result_vector(p, &inst->FullDstRegisters[0]), - get_result_flags(inst), 0, - swizzle(src0, X, X, X, X), 0, 0); - break; - - case TGSI_OPCODE_RSQ: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - - i915_emit_arith(p, - A0_RSQ, - get_result_vector(p, &inst->FullDstRegisters[0]), - get_result_flags(inst), 0, - swizzle(src0, X, X, X, X), 0, 0); - break; - - case TGSI_OPCODE_SCS: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - tmp = i915_get_utemp(p); - - /* - * t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1 - * t0 = MUL t0.xyxy t0.xx11 ; x^4, x^3, x^2, x - * t1 = MUL t0.xyyw t0.yz11 ; x^7 x^5 x^3 x - * scs.x = DP4 t1, sin_constants - * t1 = MUL t0.xxz1 t0.z111 ; x^6 x^4 x^2 1 - * scs.y = DP4 t1, cos_constants - */ - i915_emit_arith(p, - A0_MUL, - tmp, A0_DEST_CHANNEL_XY, 0, - swizzle(src0, X, X, ONE, ONE), - swizzle(src0, X, ONE, ONE, ONE), 0); - - i915_emit_arith(p, - A0_MUL, - tmp, A0_DEST_CHANNEL_ALL, 0, - swizzle(tmp, X, Y, X, Y), - swizzle(tmp, X, X, ONE, ONE), 0); - - writemask = inst->FullDstRegisters[0].DstRegister.WriteMask; - - if (writemask & TGSI_WRITEMASK_Y) { - uint tmp1; - - if (writemask & TGSI_WRITEMASK_X) - tmp1 = i915_get_utemp(p); - else - tmp1 = tmp; - - i915_emit_arith(p, - A0_MUL, - tmp1, A0_DEST_CHANNEL_ALL, 0, - swizzle(tmp, X, Y, Y, W), - swizzle(tmp, X, Z, ONE, ONE), 0); - - i915_emit_arith(p, - A0_DP4, - get_result_vector(p, &inst->FullDstRegisters[0]), - A0_DEST_CHANNEL_Y, 0, - swizzle(tmp1, W, Z, Y, X), - i915_emit_const4fv(p, sin_constants), 0); - } - - if (writemask & TGSI_WRITEMASK_X) { - i915_emit_arith(p, - A0_MUL, - tmp, A0_DEST_CHANNEL_XYZ, 0, - swizzle(tmp, X, X, Z, ONE), - swizzle(tmp, Z, ONE, ONE, ONE), 0); - - i915_emit_arith(p, - A0_DP4, - get_result_vector(p, &inst->FullDstRegisters[0]), - A0_DEST_CHANNEL_X, 0, - swizzle(tmp, ONE, Z, Y, X), - i915_emit_const4fv(p, cos_constants), 0); - } - break; - - case TGSI_OPCODE_SGE: - emit_simple_arith(p, inst, A0_SGE, 2); - break; - - case TGSI_OPCODE_SLE: - /* like SGE, but swap reg0, reg1 */ - emit_simple_arith_swap2(p, inst, A0_SGE, 2); - break; - - case TGSI_OPCODE_SIN: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - tmp = i915_get_utemp(p); - - i915_emit_arith(p, - A0_MUL, - tmp, A0_DEST_CHANNEL_X, 0, - src0, i915_emit_const1f(p, 1.0f / (float) (M_PI * 2.0)), 0); - - i915_emit_arith(p, A0_MOD, tmp, A0_DEST_CHANNEL_X, 0, tmp, 0, 0); - - /* By choosing different taylor constants, could get rid of this mul: - */ - i915_emit_arith(p, - A0_MUL, - tmp, A0_DEST_CHANNEL_X, 0, - tmp, i915_emit_const1f(p, (float) (M_PI * 2.0)), 0); - - /* - * t0.xy = MUL x.xx11, x.x1111 ; x^2, x, 1, 1 - * t0 = MUL t0.xyxy t0.xx11 ; x^4, x^3, x^2, x - * t1 = MUL t0.xyyw t0.yz11 ; x^7 x^5 x^3 x - * result = DP4 t1.wzyx, sin_constants - */ - i915_emit_arith(p, - A0_MUL, - tmp, A0_DEST_CHANNEL_XY, 0, - swizzle(tmp, X, X, ONE, ONE), - swizzle(tmp, X, ONE, ONE, ONE), 0); - - i915_emit_arith(p, - A0_MUL, - tmp, A0_DEST_CHANNEL_ALL, 0, - swizzle(tmp, X, Y, X, Y), - swizzle(tmp, X, X, ONE, ONE), 0); - - i915_emit_arith(p, - A0_MUL, - tmp, A0_DEST_CHANNEL_ALL, 0, - swizzle(tmp, X, Y, Y, W), - swizzle(tmp, X, Z, ONE, ONE), 0); - - i915_emit_arith(p, - A0_DP4, - get_result_vector(p, &inst->FullDstRegisters[0]), - get_result_flags(inst), 0, - swizzle(tmp, W, Z, Y, X), - i915_emit_const4fv(p, sin_constants), 0); - break; - - case TGSI_OPCODE_SLT: - emit_simple_arith(p, inst, A0_SLT, 2); - break; - - case TGSI_OPCODE_SGT: - /* like SLT, but swap reg0, reg1 */ - emit_simple_arith_swap2(p, inst, A0_SLT, 2); - break; - - case TGSI_OPCODE_SUB: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - src1 = src_vector(p, &inst->FullSrcRegisters[1]); - - i915_emit_arith(p, - A0_ADD, - get_result_vector(p, &inst->FullDstRegisters[0]), - get_result_flags(inst), 0, - src0, negate(src1, 1, 1, 1, 1), 0); - break; - - case TGSI_OPCODE_TEX: - emit_tex(p, inst, T0_TEXLD); - break; - - case TGSI_OPCODE_TXB: - emit_tex(p, inst, T0_TEXLDB); - break; - - case TGSI_OPCODE_TXP: - emit_tex(p, inst, T0_TEXLDP); - break; - - case TGSI_OPCODE_XPD: - /* Cross product: - * result.x = src0.y * src1.z - src0.z * src1.y; - * result.y = src0.z * src1.x - src0.x * src1.z; - * result.z = src0.x * src1.y - src0.y * src1.x; - * result.w = undef; - */ - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - src1 = src_vector(p, &inst->FullSrcRegisters[1]); - tmp = i915_get_utemp(p); - - i915_emit_arith(p, - A0_MUL, - tmp, A0_DEST_CHANNEL_ALL, 0, - swizzle(src0, Z, X, Y, ONE), - swizzle(src1, Y, Z, X, ONE), 0); - - i915_emit_arith(p, - A0_MAD, - get_result_vector(p, &inst->FullDstRegisters[0]), - get_result_flags(inst), 0, - swizzle(src0, Y, Z, X, ONE), - swizzle(src1, Z, X, Y, ONE), - negate(tmp, 1, 1, 1, 0)); - break; - - default: - i915_program_error(p, "bad opcode %d", inst->Instruction.Opcode); - p->error = 1; - return; - } - - i915_release_utemps(p); -} - - -/** - * Translate TGSI fragment shader into i915 hardware instructions. - * \param p the translation state - * \param tokens the TGSI token array - */ -static void -i915_translate_instructions(struct i915_fp_compile *p, - const struct tgsi_token *tokens) -{ - struct i915_fragment_shader *ifs = p->shader; - struct tgsi_parse_context parse; - - tgsi_parse_init( &parse, tokens ); - - while( !tgsi_parse_end_of_tokens( &parse ) ) { - - tgsi_parse_token( &parse ); - - switch( parse.FullToken.Token.Type ) { - case TGSI_TOKEN_TYPE_DECLARATION: - if (parse.FullToken.FullDeclaration.Declaration.File - == TGSI_FILE_CONSTANT) { - uint i; - for (i = parse.FullToken.FullDeclaration.DeclarationRange.First; - i <= parse.FullToken.FullDeclaration.DeclarationRange.Last; - i++) { - assert(ifs->constant_flags[i] == 0x0); - ifs->constant_flags[i] = I915_CONSTFLAG_USER; - ifs->num_constants = MAX2(ifs->num_constants, i + 1); - } - } - else if (parse.FullToken.FullDeclaration.Declaration.File - == TGSI_FILE_TEMPORARY) { - uint i; - for (i = parse.FullToken.FullDeclaration.DeclarationRange.First; - i <= parse.FullToken.FullDeclaration.DeclarationRange.Last; - i++) { - assert(i < I915_MAX_TEMPORARY); - /* XXX just use shader->info->file_mask[TGSI_FILE_TEMPORARY] */ - p->temp_flag |= (1 << i); /* mark temp as used */ - } - } - break; - - case TGSI_TOKEN_TYPE_IMMEDIATE: - { - const struct tgsi_full_immediate *imm - = &parse.FullToken.FullImmediate; - const uint pos = p->num_immediates++; - uint j; - assert( imm->Immediate.NrTokens <= 4 + 1 ); - for (j = 0; j < imm->Immediate.NrTokens - 1; j++) { - p->immediates[pos][j] = imm->u[j].Float; - } - } - break; - - case TGSI_TOKEN_TYPE_INSTRUCTION: - if (p->first_instruction) { - /* resolve location of immediates */ - uint i, j; - for (i = 0; i < p->num_immediates; i++) { - /* find constant slot for this immediate */ - for (j = 0; j < I915_MAX_CONSTANT; j++) { - if (ifs->constant_flags[j] == 0x0) { - memcpy(ifs->constants[j], - p->immediates[i], - 4 * sizeof(float)); - /*printf("immediate %d maps to const %d\n", i, j);*/ - ifs->constant_flags[j] = 0xf; /* all four comps used */ - p->immediates_map[i] = j; - ifs->num_constants = MAX2(ifs->num_constants, j + 1); - break; - } - } - } - - p->first_instruction = FALSE; - } - - i915_translate_instruction(p, &parse.FullToken.FullInstruction); - break; - - default: - assert( 0 ); - } - - } /* while */ - - tgsi_parse_free (&parse); -} - - -static struct i915_fp_compile * -i915_init_compile(struct i915_context *i915, - struct i915_fragment_shader *ifs) -{ - struct i915_fp_compile *p = CALLOC_STRUCT(i915_fp_compile); - - p->shader = ifs; - - /* Put new constants at end of const buffer, growing downward. - * The problem is we don't know how many user-defined constants might - * be specified with pipe->set_constant_buffer(). - * Should pre-scan the user's program to determine the highest-numbered - * constant referenced. - */ - ifs->num_constants = 0; - memset(ifs->constant_flags, 0, sizeof(ifs->constant_flags)); - - p->first_instruction = TRUE; - - p->nr_tex_indirect = 1; /* correct? */ - p->nr_tex_insn = 0; - p->nr_alu_insn = 0; - p->nr_decl_insn = 0; - - p->csr = p->program; - p->decl = p->declarations; - p->decl_s = 0; - p->decl_t = 0; - p->temp_flag = ~0x0 << I915_MAX_TEMPORARY; - p->utemp_flag = ~0x7; - - p->wpos_tex = -1; - - /* initialize the first program word */ - *(p->decl++) = _3DSTATE_PIXEL_SHADER_PROGRAM; - - return p; -} - - -/* Copy compile results to the fragment program struct and destroy the - * compilation context. - */ -static void -i915_fini_compile(struct i915_context *i915, struct i915_fp_compile *p) -{ - struct i915_fragment_shader *ifs = p->shader; - unsigned long program_size = (unsigned long) (p->csr - p->program); - unsigned long decl_size = (unsigned long) (p->decl - p->declarations); - - if (p->nr_tex_indirect > I915_MAX_TEX_INDIRECT) - i915_program_error(p, "Exceeded max nr indirect texture lookups"); - - if (p->nr_tex_insn > I915_MAX_TEX_INSN) - i915_program_error(p, "Exceeded max TEX instructions"); - - if (p->nr_alu_insn > I915_MAX_ALU_INSN) - i915_program_error(p, "Exceeded max ALU instructions"); - - if (p->nr_decl_insn > I915_MAX_DECL_INSN) - i915_program_error(p, "Exceeded max DECL instructions"); - - if (p->error) { - p->NumNativeInstructions = 0; - p->NumNativeAluInstructions = 0; - p->NumNativeTexInstructions = 0; - p->NumNativeTexIndirections = 0; - - i915_use_passthrough_shader(ifs); - } - else { - p->NumNativeInstructions - = p->nr_alu_insn + p->nr_tex_insn + p->nr_decl_insn; - p->NumNativeAluInstructions = p->nr_alu_insn; - p->NumNativeTexInstructions = p->nr_tex_insn; - p->NumNativeTexIndirections = p->nr_tex_indirect; - - /* patch in the program length */ - p->declarations[0] |= program_size + decl_size - 2; - - /* Copy compilation results to fragment program struct: - */ - assert(!ifs->program); - ifs->program - = (uint *) MALLOC((program_size + decl_size) * sizeof(uint)); - if (ifs->program) { - ifs->program_len = program_size + decl_size; - - memcpy(ifs->program, - p->declarations, - decl_size * sizeof(uint)); - - memcpy(ifs->program + decl_size, - p->program, - program_size * sizeof(uint)); - } - } - - /* Release the compilation struct: - */ - FREE(p); -} - - -/** - * Find an unused texture coordinate slot to use for fragment WPOS. - * Update p->fp->wpos_tex with the result (-1 if no used texcoord slot is found). - */ -static void -i915_find_wpos_space(struct i915_fp_compile *p) -{ -#if 0 - const uint inputs - = p->shader->inputs_read | (1 << TGSI_ATTRIB_POS); /*XXX hack*/ - uint i; - - p->wpos_tex = -1; - - if (inputs & (1 << TGSI_ATTRIB_POS)) { - for (i = 0; i < I915_TEX_UNITS; i++) { - if ((inputs & (1 << (TGSI_ATTRIB_TEX0 + i))) == 0) { - p->wpos_tex = i; - return; - } - } - - i915_program_error(p, "No free texcoord for wpos value"); - } -#else - if (p->shader->info.input_semantic_name[0] == TGSI_SEMANTIC_POSITION) { - /* frag shader using the fragment position input */ -#if 0 - assert(0); -#endif - } -#endif -} - - - - -/** - * Rather than trying to intercept and jiggle depth writes during - * emit, just move the value into its correct position at the end of - * the program: - */ -static void -i915_fixup_depth_write(struct i915_fp_compile *p) -{ - /* XXX assuming pos/depth is always in output[0] */ - if (p->shader->info.output_semantic_name[0] == TGSI_SEMANTIC_POSITION) { - const uint depth = UREG(REG_TYPE_OD, 0); - - i915_emit_arith(p, - A0_MOV, /* opcode */ - depth, /* dest reg */ - A0_DEST_CHANNEL_W, /* write mask */ - 0, /* saturate? */ - swizzle(depth, X, Y, Z, Z), /* src0 */ - 0, 0 /* src1, src2 */); - } -} - - -void -i915_translate_fragment_program( struct i915_context *i915, - struct i915_fragment_shader *fs) -{ - struct i915_fp_compile *p = i915_init_compile(i915, fs); - const struct tgsi_token *tokens = fs->state.tokens; - - i915_find_wpos_space(p); - -#if 0 - tgsi_dump(tokens, 0); -#endif - - i915_translate_instructions(p, tokens); - i915_fixup_depth_write(p); - - i915_fini_compile(i915, p); -} diff --git a/src/gallium/drivers/i915simple/i915_prim_emit.c b/src/gallium/drivers/i915simple/i915_prim_emit.c deleted file mode 100644 index d9a5c40ab9..0000000000 --- a/src/gallium/drivers/i915simple/i915_prim_emit.c +++ /dev/null @@ -1,219 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#include "draw/draw_pipe.h" -#include "util/u_math.h" -#include "util/u_memory.h" -#include "util/u_pack_color.h" - -#include "i915_context.h" -#include "i915_reg.h" -#include "i915_state.h" -#include "i915_batch.h" - - - -/** - * Primitive emit to hardware. No support for vertex buffers or any - * nice fast paths. - */ -struct setup_stage { - struct draw_stage stage; /**< This must be first (base class) */ - - struct i915_context *i915; -}; - - - -/** - * Basically a cast wrapper. - */ -static INLINE struct setup_stage *setup_stage( struct draw_stage *stage ) -{ - return (struct setup_stage *)stage; -} - - -/** - * Extract the needed fields from vertex_header and emit i915 dwords. - * Recall that the vertices are constructed by the 'draw' module and - * have a couple of slots at the beginning (1-dword header, 4-dword - * clip pos) that we ignore here. - */ -static INLINE void -emit_hw_vertex( struct i915_context *i915, - const struct vertex_header *vertex) -{ - const struct vertex_info *vinfo = &i915->current.vertex_info; - uint i; - uint count = 0; /* for debug/sanity */ - - assert(!i915->dirty); - - for (i = 0; i < vinfo->num_attribs; i++) { - const uint j = vinfo->attrib[i].src_index; - const float *attrib = vertex->data[j]; - switch (vinfo->attrib[i].emit) { - case EMIT_1F: - OUT_BATCH( fui(attrib[0]) ); - count++; - break; - case EMIT_2F: - OUT_BATCH( fui(attrib[0]) ); - OUT_BATCH( fui(attrib[1]) ); - count += 2; - break; - case EMIT_3F: - OUT_BATCH( fui(attrib[0]) ); - OUT_BATCH( fui(attrib[1]) ); - OUT_BATCH( fui(attrib[2]) ); - count += 3; - break; - case EMIT_4F: - OUT_BATCH( fui(attrib[0]) ); - OUT_BATCH( fui(attrib[1]) ); - OUT_BATCH( fui(attrib[2]) ); - OUT_BATCH( fui(attrib[3]) ); - count += 4; - break; - case EMIT_4UB: - OUT_BATCH( pack_ub4(float_to_ubyte( attrib[2] ), - float_to_ubyte( attrib[1] ), - float_to_ubyte( attrib[0] ), - float_to_ubyte( attrib[3] )) ); - count += 1; - break; - default: - assert(0); - } - } - assert(count == vinfo->size); -} - - - -static INLINE void -emit_prim( struct draw_stage *stage, - struct prim_header *prim, - unsigned hwprim, - unsigned nr ) -{ - struct i915_context *i915 = setup_stage(stage)->i915; - unsigned vertex_size; - unsigned i; - - if (i915->dirty) - i915_update_derived( i915 ); - - if (i915->hardware_dirty) - i915_emit_hardware_state( i915 ); - - /* need to do this after validation! */ - vertex_size = i915->current.vertex_info.size * 4; /* in bytes */ - assert(vertex_size >= 12); /* never smaller than 12 bytes */ - - if (!BEGIN_BATCH( 1 + nr * vertex_size / 4, 0 )) { - FLUSH_BATCH(NULL); - - /* Make sure state is re-emitted after a flush: - */ - i915_update_derived( i915 ); - i915_emit_hardware_state( i915 ); - - if (!BEGIN_BATCH( 1 + nr * vertex_size / 4, 0 )) { - assert(0); - return; - } - } - - /* Emit each triangle as a single primitive. I told you this was - * simple. - */ - OUT_BATCH(_3DPRIMITIVE | - hwprim | - ((4 + vertex_size * nr)/4 - 2)); - - for (i = 0; i < nr; i++) - emit_hw_vertex(i915, prim->v[i]); -} - - -static void -setup_tri( struct draw_stage *stage, struct prim_header *prim ) -{ - emit_prim( stage, prim, PRIM3D_TRILIST, 3 ); -} - - -static void -setup_line(struct draw_stage *stage, struct prim_header *prim) -{ - emit_prim( stage, prim, PRIM3D_LINELIST, 2 ); -} - - -static void -setup_point(struct draw_stage *stage, struct prim_header *prim) -{ - emit_prim( stage, prim, PRIM3D_POINTLIST, 1 ); -} - - -static void setup_flush( struct draw_stage *stage, unsigned flags ) -{ -} - -static void reset_stipple_counter( struct draw_stage *stage ) -{ -} - -static void render_destroy( struct draw_stage *stage ) -{ - FREE( stage ); -} - - -/** - * Create a new primitive setup/render stage. This gets plugged into - * the 'draw' module's pipeline. - */ -struct draw_stage *i915_draw_render_stage( struct i915_context *i915 ) -{ - struct setup_stage *setup = CALLOC_STRUCT(setup_stage); - - setup->i915 = i915; - setup->stage.draw = i915->draw; - setup->stage.point = setup_point; - setup->stage.line = setup_line; - setup->stage.tri = setup_tri; - setup->stage.flush = setup_flush; - setup->stage.reset_stipple_counter = reset_stipple_counter; - setup->stage.destroy = render_destroy; - - return &setup->stage; -} diff --git a/src/gallium/drivers/i915simple/i915_prim_vbuf.c b/src/gallium/drivers/i915simple/i915_prim_vbuf.c deleted file mode 100644 index 8a3e466c84..0000000000 --- a/src/gallium/drivers/i915simple/i915_prim_vbuf.c +++ /dev/null @@ -1,645 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * 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. - * - **************************************************************************/ - -/** - * \file - * Build post-transformation, post-clipping vertex buffers and element - * lists by hooking into the end of the primitive pipeline and - * manipulating the vertex_id field in the vertex headers. - * - * XXX: work in progress - * - * \author José Fonseca - * \author Keith Whitwell - */ - - -#include "draw/draw_context.h" -#include "draw/draw_vbuf.h" -#include "util/u_debug.h" -#include "pipe/p_inlines.h" -#include "util/u_math.h" -#include "util/u_memory.h" -#include "util/u_fifo.h" - -#include "i915_context.h" -#include "i915_reg.h" -#include "i915_batch.h" -#include "i915_state.h" - - -/** - * Primitive renderer for i915. - */ -struct i915_vbuf_render { - struct vbuf_render base; - - struct i915_context *i915; - - /** Vertex size in bytes */ - size_t vertex_size; - - /** Software primitive */ - unsigned prim; - - /** Hardware primitive */ - unsigned hwprim; - - /** Genereate a vertex list */ - unsigned fallback; - - /* Stuff for the vbo */ - struct intel_buffer *vbo; - size_t vbo_size; - size_t vbo_offset; - void *vbo_ptr; - size_t vbo_max_used; - - /* stuff for the pool */ - struct util_fifo *pool_fifo; - unsigned pool_used; - unsigned pool_buffer_size; - boolean pool_not_used; -}; - - -/** - * Basically a cast wrapper. - */ -static INLINE struct i915_vbuf_render * -i915_vbuf_render(struct vbuf_render *render) -{ - assert(render); - return (struct i915_vbuf_render *)render; -} - -static const struct vertex_info * -i915_vbuf_render_get_vertex_info(struct vbuf_render *render) -{ - struct i915_vbuf_render *i915_render = i915_vbuf_render(render); - struct i915_context *i915 = i915_render->i915; - - if (i915->dirty) { - /* make sure we have up to date vertex layout */ - i915_update_derived(i915); - } - - return &i915->current.vertex_info; -} - -static boolean -i915_vbuf_render_reserve(struct i915_vbuf_render *i915_render, size_t size) -{ - struct i915_context *i915 = i915_render->i915; - - if (i915_render->vbo_size < size + i915_render->vbo_offset) - return FALSE; - - if (i915->vbo_flushed) - return FALSE; - - return TRUE; -} - -static void -i915_vbuf_render_new_buf(struct i915_vbuf_render *i915_render, size_t size) -{ - struct i915_context *i915 = i915_render->i915; - struct intel_winsys *iws = i915->iws; - - if (i915_render->vbo) { - if (i915_render->pool_not_used) - iws->buffer_destroy(iws, i915_render->vbo); - else - u_fifo_add(i915_render->pool_fifo, i915_render->vbo); - i915_render->vbo = NULL; - } - - i915->vbo_flushed = 0; - - i915_render->vbo_size = MAX2(size, i915_render->pool_buffer_size); - i915_render->vbo_offset = 0; - - if (i915_render->vbo_size != i915_render->pool_buffer_size) { - i915_render->pool_not_used = TRUE; - i915_render->vbo = iws->buffer_create(iws, i915_render->vbo_size, 64, - INTEL_NEW_VERTEX); - } else { - i915_render->pool_not_used = FALSE; - - if (i915_render->pool_used >= 2) { - FLUSH_BATCH(NULL); - i915->vbo_flushed = 0; - i915_render->pool_used = 0; - } - u_fifo_pop(i915_render->pool_fifo, (void**)&i915_render->vbo); - } -} - -static boolean -i915_vbuf_render_allocate_vertices(struct vbuf_render *render, - ushort vertex_size, - ushort nr_vertices) -{ - struct i915_vbuf_render *i915_render = i915_vbuf_render(render); - struct i915_context *i915 = i915_render->i915; - size_t size = (size_t)vertex_size * (size_t)nr_vertices; - - /* FIXME: handle failure */ - assert(!i915->vbo); - - if (!i915_vbuf_render_reserve(i915_render, size)) { - - if (i915->vbo_flushed) - i915_render->pool_used = 0; - - i915_vbuf_render_new_buf(i915_render, size); - } - - i915_render->vertex_size = vertex_size; - i915->vbo = i915_render->vbo; - i915->vbo_offset = i915_render->vbo_offset; - i915->dirty |= I915_NEW_VBO; - - if (!i915_render->vbo) - return FALSE; - return TRUE; -} - -static void * -i915_vbuf_render_map_vertices(struct vbuf_render *render) -{ - struct i915_vbuf_render *i915_render = i915_vbuf_render(render); - struct i915_context *i915 = i915_render->i915; - struct intel_winsys *iws = i915->iws; - - if (i915->vbo_flushed) - debug_printf("%s bad vbo flush occured stalling on hw\n", __FUNCTION__); - - i915_render->vbo_ptr = iws->buffer_map(iws, i915_render->vbo, TRUE); - - return (unsigned char *)i915_render->vbo_ptr + i915->vbo_offset; -} - -static void -i915_vbuf_render_unmap_vertices(struct vbuf_render *render, - ushort min_index, - ushort max_index) -{ - struct i915_vbuf_render *i915_render = i915_vbuf_render(render); - struct i915_context *i915 = i915_render->i915; - struct intel_winsys *iws = i915->iws; - - i915_render->vbo_max_used = MAX2(i915_render->vbo_max_used, i915_render->vertex_size * (max_index + 1)); - iws->buffer_unmap(iws, i915_render->vbo); -} - -static boolean -i915_vbuf_render_set_primitive(struct vbuf_render *render, - unsigned prim) -{ - struct i915_vbuf_render *i915_render = i915_vbuf_render(render); - i915_render->prim = prim; - - switch(prim) { - case PIPE_PRIM_POINTS: - i915_render->hwprim = PRIM3D_POINTLIST; - i915_render->fallback = 0; - return TRUE; - case PIPE_PRIM_LINES: - i915_render->hwprim = PRIM3D_LINELIST; - i915_render->fallback = 0; - return TRUE; - case PIPE_PRIM_LINE_LOOP: - i915_render->hwprim = PRIM3D_LINELIST; - i915_render->fallback = PIPE_PRIM_LINE_LOOP; - return TRUE; - case PIPE_PRIM_LINE_STRIP: - i915_render->hwprim = PRIM3D_LINESTRIP; - i915_render->fallback = 0; - return TRUE; - case PIPE_PRIM_TRIANGLES: - i915_render->hwprim = PRIM3D_TRILIST; - i915_render->fallback = 0; - return TRUE; - case PIPE_PRIM_TRIANGLE_STRIP: - i915_render->hwprim = PRIM3D_TRISTRIP; - i915_render->fallback = 0; - return TRUE; - case PIPE_PRIM_TRIANGLE_FAN: - i915_render->hwprim = PRIM3D_TRIFAN; - i915_render->fallback = 0; - return TRUE; - case PIPE_PRIM_QUADS: - i915_render->hwprim = PRIM3D_TRILIST; - i915_render->fallback = PIPE_PRIM_QUADS; - return TRUE; - case PIPE_PRIM_QUAD_STRIP: - i915_render->hwprim = PRIM3D_TRILIST; - i915_render->fallback = PIPE_PRIM_QUAD_STRIP; - return TRUE; - case PIPE_PRIM_POLYGON: - i915_render->hwprim = PRIM3D_POLY; - i915_render->fallback = 0; - return TRUE; - default: - /* FIXME: Actually, can handle a lot more just fine... */ - return FALSE; - } -} - -/** - * Used for fallbacks in draw_arrays - */ -static void -draw_arrays_generate_indices(struct vbuf_render *render, - unsigned start, uint nr, - unsigned type) -{ - struct i915_vbuf_render *i915_render = i915_vbuf_render(render); - struct i915_context *i915 = i915_render->i915; - unsigned i; - unsigned end = start + nr; - switch(type) { - case 0: - for (i = start; i+1 < end; i += 2) - OUT_BATCH((i+0) | (i+1) << 16); - if (i < end) - OUT_BATCH(i); - break; - case PIPE_PRIM_LINE_LOOP: - if (nr >= 2) { - for (i = start + 1; i < end; i++) - OUT_BATCH((i-0) | (i+0) << 16); - OUT_BATCH((i-0) | ( start) << 16); - } - break; - case PIPE_PRIM_QUADS: - for (i = start; i + 3 < end; i += 4) { - OUT_BATCH((i+0) | (i+1) << 16); - OUT_BATCH((i+3) | (i+1) << 16); - OUT_BATCH((i+2) | (i+3) << 16); - } - break; - case PIPE_PRIM_QUAD_STRIP: - for (i = start; i + 3 < end; i += 2) { - OUT_BATCH((i+0) | (i+1) << 16); - OUT_BATCH((i+3) | (i+2) << 16); - OUT_BATCH((i+0) | (i+3) << 16); - } - break; - default: - assert(0); - } -} - -static unsigned -draw_arrays_calc_nr_indices(uint nr, unsigned type) -{ - switch (type) { - case 0: - return nr; - case PIPE_PRIM_LINE_LOOP: - if (nr >= 2) - return nr * 2; - else - return 0; - case PIPE_PRIM_QUADS: - return (nr / 4) * 6; - case PIPE_PRIM_QUAD_STRIP: - return ((nr - 2) / 2) * 6; - default: - assert(0); - return 0; - } -} - -static void -draw_arrays_fallback(struct vbuf_render *render, - unsigned start, - uint nr) -{ - struct i915_vbuf_render *i915_render = i915_vbuf_render(render); - struct i915_context *i915 = i915_render->i915; - unsigned nr_indices; - - if (i915->dirty) - i915_update_derived(i915); - - if (i915->hardware_dirty) - i915_emit_hardware_state(i915); - - nr_indices = draw_arrays_calc_nr_indices(nr, i915_render->fallback); - if (!nr_indices) - return; - - if (!BEGIN_BATCH(1 + (nr_indices + 1)/2, 1)) { - FLUSH_BATCH(NULL); - - /* Make sure state is re-emitted after a flush: - */ - i915_update_derived(i915); - i915_emit_hardware_state(i915); - i915->vbo_flushed = 1; - - if (!BEGIN_BATCH(1 + (nr_indices + 1)/2, 1)) { - assert(0); - goto out; - } - } - OUT_BATCH(_3DPRIMITIVE | - PRIM_INDIRECT | - i915_render->hwprim | - PRIM_INDIRECT_ELTS | - nr_indices); - - draw_arrays_generate_indices(render, start, nr, i915_render->fallback); - -out: - return; -} - -static void -i915_vbuf_render_draw_arrays(struct vbuf_render *render, - unsigned start, - uint nr) -{ - struct i915_vbuf_render *i915_render = i915_vbuf_render(render); - struct i915_context *i915 = i915_render->i915; - - if (i915_render->fallback) { - draw_arrays_fallback(render, start, nr); - return; - } - - if (i915->dirty) - i915_update_derived(i915); - - if (i915->hardware_dirty) - i915_emit_hardware_state(i915); - - if (!BEGIN_BATCH(2, 0)) { - FLUSH_BATCH(NULL); - - /* Make sure state is re-emitted after a flush: - */ - i915_update_derived(i915); - i915_emit_hardware_state(i915); - i915->vbo_flushed = 1; - - if (!BEGIN_BATCH(2, 0)) { - assert(0); - goto out; - } - } - - OUT_BATCH(_3DPRIMITIVE | - PRIM_INDIRECT | - PRIM_INDIRECT_SEQUENTIAL | - i915_render->hwprim | - nr); - OUT_BATCH(start); /* Beginning vertex index */ - -out: - return; -} - -/** - * Used for normal and fallback emitting of indices - * If type is zero normal operation assumed. - */ -static void -draw_generate_indices(struct vbuf_render *render, - const ushort *indices, - uint nr_indices, - unsigned type) -{ - struct i915_vbuf_render *i915_render = i915_vbuf_render(render); - struct i915_context *i915 = i915_render->i915; - unsigned i; - - switch(type) { - case 0: - for (i = 0; i + 1 < nr_indices; i += 2) { - OUT_BATCH(indices[i] | indices[i+1] << 16); - } - if (i < nr_indices) { - OUT_BATCH(indices[i]); - } - break; - case PIPE_PRIM_LINE_LOOP: - if (nr_indices >= 2) { - for (i = 1; i < nr_indices; i++) - OUT_BATCH(indices[i-1] | indices[i] << 16); - OUT_BATCH(indices[i-1] | indices[0] << 16); - } - break; - case PIPE_PRIM_QUADS: - for (i = 0; i + 3 < nr_indices; i += 4) { - OUT_BATCH(indices[i+0] | indices[i+1] << 16); - OUT_BATCH(indices[i+3] | indices[i+1] << 16); - OUT_BATCH(indices[i+2] | indices[i+3] << 16); - } - break; - case PIPE_PRIM_QUAD_STRIP: - for (i = 0; i + 3 < nr_indices; i += 2) { - OUT_BATCH(indices[i+0] | indices[i+1] << 16); - OUT_BATCH(indices[i+3] | indices[i+2] << 16); - OUT_BATCH(indices[i+0] | indices[i+3] << 16); - } - break; - default: - assert(0); - break; - } -} - -static unsigned -draw_calc_nr_indices(uint nr_indices, unsigned type) -{ - switch (type) { - case 0: - return nr_indices; - case PIPE_PRIM_LINE_LOOP: - if (nr_indices >= 2) - return nr_indices * 2; - else - return 0; - case PIPE_PRIM_QUADS: - return (nr_indices / 4) * 6; - case PIPE_PRIM_QUAD_STRIP: - return ((nr_indices - 2) / 2) * 6; - default: - assert(0); - return 0; - } -} - -static void -i915_vbuf_render_draw(struct vbuf_render *render, - const ushort *indices, - uint nr_indices) -{ - struct i915_vbuf_render *i915_render = i915_vbuf_render(render); - struct i915_context *i915 = i915_render->i915; - unsigned save_nr_indices; - - save_nr_indices = nr_indices; - - nr_indices = draw_calc_nr_indices(nr_indices, i915_render->fallback); - if (!nr_indices) - return; - - if (i915->dirty) - i915_update_derived(i915); - - if (i915->hardware_dirty) - i915_emit_hardware_state(i915); - - if (!BEGIN_BATCH(1 + (nr_indices + 1)/2, 1)) { - FLUSH_BATCH(NULL); - - /* Make sure state is re-emitted after a flush: - */ - i915_update_derived(i915); - i915_emit_hardware_state(i915); - i915->vbo_flushed = 1; - - if (!BEGIN_BATCH(1 + (nr_indices + 1)/2, 1)) { - assert(0); - goto out; - } - } - - OUT_BATCH(_3DPRIMITIVE | - PRIM_INDIRECT | - i915_render->hwprim | - PRIM_INDIRECT_ELTS | - nr_indices); - draw_generate_indices(render, - indices, - save_nr_indices, - i915_render->fallback); - -out: - return; -} - -static void -i915_vbuf_render_release_vertices(struct vbuf_render *render) -{ - struct i915_vbuf_render *i915_render = i915_vbuf_render(render); - struct i915_context *i915 = i915_render->i915; - - assert(i915->vbo); - - i915_render->vbo_offset += i915_render->vbo_max_used; - i915_render->vbo_max_used = 0; - i915->vbo = NULL; - i915->dirty |= I915_NEW_VBO; -} - -static void -i915_vbuf_render_destroy(struct vbuf_render *render) -{ - struct i915_vbuf_render *i915_render = i915_vbuf_render(render); - FREE(i915_render); -} - -/** - * Create a new primitive render. - */ -static struct vbuf_render * -i915_vbuf_render_create(struct i915_context *i915) -{ - struct i915_vbuf_render *i915_render = CALLOC_STRUCT(i915_vbuf_render); - struct intel_winsys *iws = i915->iws; - int i; - - i915_render->i915 = i915; - - i915_render->base.max_vertex_buffer_bytes = 128*1024; - - /* NOTE: it must be such that state and vertices indices fit in a single - * batch buffer. - */ - i915_render->base.max_indices = 16*1024; - - i915_render->base.get_vertex_info = i915_vbuf_render_get_vertex_info; - i915_render->base.allocate_vertices = i915_vbuf_render_allocate_vertices; - i915_render->base.map_vertices = i915_vbuf_render_map_vertices; - i915_render->base.unmap_vertices = i915_vbuf_render_unmap_vertices; - i915_render->base.set_primitive = i915_vbuf_render_set_primitive; - i915_render->base.draw = i915_vbuf_render_draw; - i915_render->base.draw_arrays = i915_vbuf_render_draw_arrays; - i915_render->base.release_vertices = i915_vbuf_render_release_vertices; - i915_render->base.destroy = i915_vbuf_render_destroy; - - - i915_render->vbo = NULL; - i915_render->vbo_size = 0; - i915_render->vbo_offset = 0; - - i915_render->pool_used = FALSE; - i915_render->pool_buffer_size = 128 * 4096; - i915_render->pool_fifo = u_fifo_create(6); - for (i = 0; i < 6; i++) - u_fifo_add(i915_render->pool_fifo, - iws->buffer_create(iws, i915_render->pool_buffer_size, 64, - INTEL_NEW_VERTEX)); - -#if 0 - /* TODO JB: is this realy needed? */ - i915_render->vbo_ptr = iws->buffer_map(iws, i915_render->vbo, TRUE); - iws->buffer_unmap(iws, i915_render->vbo); -#endif - - return &i915_render->base; -} - -/** - * Create a new primitive vbuf/render stage. - */ -struct draw_stage *i915_draw_vbuf_stage(struct i915_context *i915) -{ - struct vbuf_render *render; - struct draw_stage *stage; - - render = i915_vbuf_render_create(i915); - if(!render) - return NULL; - - stage = draw_vbuf_stage(i915->draw, render); - if(!stage) { - render->destroy(render); - return NULL; - } - /** TODO JB: this shouldn't be here */ - draw_set_render(i915->draw, render); - - return stage; -} diff --git a/src/gallium/drivers/i915simple/i915_reg.h b/src/gallium/drivers/i915simple/i915_reg.h deleted file mode 100644 index 04620fec68..0000000000 --- a/src/gallium/drivers/i915simple/i915_reg.h +++ /dev/null @@ -1,978 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#ifndef I915_REG_H -#define I915_REG_H - - -#define I915_SET_FIELD( var, mask, value ) (var &= ~(mask), var |= value) - -#define CMD_3D (0x3<<29) - -#define PRIM3D_INLINE (CMD_3D | (0x1f<<24)) -#define PRIM3D_TRILIST (0x0<<18) -#define PRIM3D_TRISTRIP (0x1<<18) -#define PRIM3D_TRISTRIP_RVRSE (0x2<<18) -#define PRIM3D_TRIFAN (0x3<<18) -#define PRIM3D_POLY (0x4<<18) -#define PRIM3D_LINELIST (0x5<<18) -#define PRIM3D_LINESTRIP (0x6<<18) -#define PRIM3D_RECTLIST (0x7<<18) -#define PRIM3D_POINTLIST (0x8<<18) -#define PRIM3D_DIB (0x9<<18) -#define PRIM3D_CLEAR_RECT (0xa<<18) -#define PRIM3D_ZONE_INIT (0xd<<18) -#define PRIM3D_MASK (0x1f<<18) - -/* p137 */ -#define _3DSTATE_AA_CMD (CMD_3D | (0x06<<24)) -#define AA_LINE_ECAAR_WIDTH_ENABLE (1<<16) -#define AA_LINE_ECAAR_WIDTH_0_5 0 -#define AA_LINE_ECAAR_WIDTH_1_0 (1<<14) -#define AA_LINE_ECAAR_WIDTH_2_0 (2<<14) -#define AA_LINE_ECAAR_WIDTH_4_0 (3<<14) -#define AA_LINE_REGION_WIDTH_ENABLE (1<<8) -#define AA_LINE_REGION_WIDTH_0_5 0 -#define AA_LINE_REGION_WIDTH_1_0 (1<<6) -#define AA_LINE_REGION_WIDTH_2_0 (2<<6) -#define AA_LINE_REGION_WIDTH_4_0 (3<<6) - -/* 3DSTATE_BACKFACE_STENCIL_OPS, p138*/ -#define _3DSTATE_BACKFACE_STENCIL_OPS (CMD_3D | (0x8<<24)) -#define BFO_ENABLE_STENCIL_REF (1<<23) -#define BFO_STENCIL_REF_SHIFT 15 -#define BFO_STENCIL_REF_MASK (0xff<<15) -#define BFO_ENABLE_STENCIL_FUNCS (1<<14) -#define BFO_STENCIL_TEST_SHIFT 11 -#define BFO_STENCIL_TEST_MASK (0x7<<11) -#define BFO_STENCIL_FAIL_SHIFT 8 -#define BFO_STENCIL_FAIL_MASK (0x7<<8) -#define BFO_STENCIL_PASS_Z_FAIL_SHIFT 5 -#define BFO_STENCIL_PASS_Z_FAIL_MASK (0x7<<5) -#define BFO_STENCIL_PASS_Z_PASS_SHIFT 2 -#define BFO_STENCIL_PASS_Z_PASS_MASK (0x7<<2) -#define BFO_ENABLE_STENCIL_TWO_SIDE (1<<1) -#define BFO_STENCIL_TWO_SIDE (1<<0) - - -/* 3DSTATE_BACKFACE_STENCIL_MASKS, p140 */ -#define _3DSTATE_BACKFACE_STENCIL_MASKS (CMD_3D | (0x9<<24)) -#define BFM_ENABLE_STENCIL_TEST_MASK (1<<17) -#define BFM_ENABLE_STENCIL_WRITE_MASK (1<<16) -#define BFM_STENCIL_TEST_MASK_SHIFT 8 -#define BFM_STENCIL_TEST_MASK_MASK (0xff<<8) -#define BFM_STENCIL_WRITE_MASK_SHIFT 0 -#define BFM_STENCIL_WRITE_MASK_MASK (0xff<<0) - - - -/* 3DSTATE_BIN_CONTROL p141 */ - -/* p143 */ -#define _3DSTATE_BUF_INFO_CMD (CMD_3D | (0x1d<<24) | (0x8e<<16) | 1) -/* Dword 1 */ -#define BUF_3D_ID_COLOR_BACK (0x3<<24) -#define BUF_3D_ID_DEPTH (0x7<<24) -#define BUF_3D_USE_FENCE (1<<23) -#define BUF_3D_TILED_SURFACE (1<<22) -#define BUF_3D_TILE_WALK_X 0 -#define BUF_3D_TILE_WALK_Y (1<<21) -#define BUF_3D_PITCH(x) (((x)/4)<<2) -/* Dword 2 */ -#define BUF_3D_ADDR(x) ((x) & ~0x3) - - -/* 3DSTATE_CHROMA_KEY */ - -/* 3DSTATE_CLEAR_PARAMETERS, p150 */ -#define _3DSTATE_CLEAR_PARAMETERS (CMD_3D | (0x1d<<24) | (0x9c<<16) | 5) -/* Dword 1 */ -#define CLEARPARAM_CLEAR_RECT (1 << 16) -#define CLEARPARAM_ZONE_INIT (0 << 16) -#define CLEARPARAM_WRITE_COLOR (1 << 2) -#define CLEARPARAM_WRITE_DEPTH (1 << 1) -#define CLEARPARAM_WRITE_STENCIL (1 << 0) - -/* 3DSTATE_CONSTANT_BLEND_COLOR, p153 */ -#define _3DSTATE_CONST_BLEND_COLOR_CMD (CMD_3D | (0x1d<<24) | (0x88<<16)) - - - -/* 3DSTATE_COORD_SET_BINDINGS, p154 */ -#define _3DSTATE_COORD_SET_BINDINGS (CMD_3D | (0x16<<24)) -#define CSB_TCB(iunit, eunit) ((eunit)<<(iunit*3)) - -/* p156 */ -#define _3DSTATE_DFLT_DIFFUSE_CMD (CMD_3D | (0x1d<<24) | (0x99<<16)) - -/* p157 */ -#define _3DSTATE_DFLT_SPEC_CMD (CMD_3D | (0x1d<<24) | (0x9a<<16)) - -/* p158 */ -#define _3DSTATE_DFLT_Z_CMD (CMD_3D | (0x1d<<24) | (0x98<<16)) - - -/* 3DSTATE_DEPTH_OFFSET_SCALE, p159 */ -#define _3DSTATE_DEPTH_OFFSET_SCALE (CMD_3D | (0x1d<<24) | (0x97<<16)) -/* scale in dword 1 */ - - -/* 3DSTATE_DEPTH_SUBRECT_DISABLE, p160 */ -#define _3DSTATE_DEPTH_SUBRECT_DISABLE (CMD_3D | (0x1c<<24) | (0x11<<19) | 0x2) - -/* p161 */ -#define _3DSTATE_DST_BUF_VARS_CMD (CMD_3D | (0x1d<<24) | (0x85<<16)) -/* Dword 1 */ -#define TEX_DEFAULT_COLOR_OGL (0<<30) -#define TEX_DEFAULT_COLOR_D3D (1<<30) -#define ZR_EARLY_DEPTH (1<<29) -#define LOD_PRECLAMP_OGL (1<<28) -#define LOD_PRECLAMP_D3D (0<<28) -#define DITHER_FULL_ALWAYS (0<<26) -#define DITHER_FULL_ON_FB_BLEND (1<<26) -#define DITHER_CLAMPED_ALWAYS (2<<26) -#define LINEAR_GAMMA_BLEND_32BPP (1<<25) -#define DEBUG_DISABLE_ENH_DITHER (1<<24) -#define DSTORG_HORT_BIAS(x) ((x)<<20) -#define DSTORG_VERT_BIAS(x) ((x)<<16) -#define COLOR_4_2_2_CHNL_WRT_ALL 0 -#define COLOR_4_2_2_CHNL_WRT_Y (1<<12) -#define COLOR_4_2_2_CHNL_WRT_CR (2<<12) -#define COLOR_4_2_2_CHNL_WRT_CB (3<<12) -#define COLOR_4_2_2_CHNL_WRT_CRCB (4<<12) -#define COLOR_BUF_8BIT 0 -#define COLOR_BUF_RGB555 (1<<8) -#define COLOR_BUF_RGB565 (2<<8) -#define COLOR_BUF_ARGB8888 (3<<8) -#define DEPTH_FRMT_16_FIXED 0 -#define DEPTH_FRMT_16_FLOAT (1<<2) -#define DEPTH_FRMT_24_FIXED_8_OTHER (2<<2) -#define VERT_LINE_STRIDE_1 (1<<1) -#define VERT_LINE_STRIDE_0 (0<<1) -#define VERT_LINE_STRIDE_OFS_1 1 -#define VERT_LINE_STRIDE_OFS_0 0 - -/* p166 */ -#define _3DSTATE_DRAW_RECT_CMD (CMD_3D|(0x1d<<24)|(0x80<<16)|3) -/* Dword 1 */ -#define DRAW_RECT_DIS_DEPTH_OFS (1<<30) -#define DRAW_DITHER_OFS_X(x) ((x)<<26) -#define DRAW_DITHER_OFS_Y(x) ((x)<<24) -/* Dword 2 */ -#define DRAW_YMIN(x) ((x)<<16) -#define DRAW_XMIN(x) (x) -/* Dword 3 */ -#define DRAW_YMAX(x) ((x)<<16) -#define DRAW_XMAX(x) (x) -/* Dword 4 */ -#define DRAW_YORG(x) ((x)<<16) -#define DRAW_XORG(x) (x) - - -/* 3DSTATE_FILTER_COEFFICIENTS_4X4, p170 */ - -/* 3DSTATE_FILTER_COEFFICIENTS_6X5, p172 */ - - -/* _3DSTATE_FOG_COLOR, p173 */ -#define _3DSTATE_FOG_COLOR_CMD (CMD_3D|(0x15<<24)) -#define FOG_COLOR_RED(x) ((x)<<16) -#define FOG_COLOR_GREEN(x) ((x)<<8) -#define FOG_COLOR_BLUE(x) (x) - -/* _3DSTATE_FOG_MODE, p174 */ -#define _3DSTATE_FOG_MODE_CMD (CMD_3D|(0x1d<<24)|(0x89<<16)|2) -/* Dword 1 */ -#define FMC1_FOGFUNC_MODIFY_ENABLE (1<<31) -#define FMC1_FOGFUNC_VERTEX (0<<28) -#define FMC1_FOGFUNC_PIXEL_EXP (1<<28) -#define FMC1_FOGFUNC_PIXEL_EXP2 (2<<28) -#define FMC1_FOGFUNC_PIXEL_LINEAR (3<<28) -#define FMC1_FOGFUNC_MASK (3<<28) -#define FMC1_FOGINDEX_MODIFY_ENABLE (1<<27) -#define FMC1_FOGINDEX_Z (0<<25) -#define FMC1_FOGINDEX_W (1<<25) -#define FMC1_C1_C2_MODIFY_ENABLE (1<<24) -#define FMC1_DENSITY_MODIFY_ENABLE (1<<23) -#define FMC1_C1_ONE (1<<13) -#define FMC1_C1_MASK (0xffff<<4) -/* Dword 2 */ -#define FMC2_C2_ONE (1<<16) -/* Dword 3 */ -#define FMC3_D_ONE (1<<16) - - - -/* _3DSTATE_INDEPENDENT_ALPHA_BLEND, p177 */ -#define _3DSTATE_INDEPENDENT_ALPHA_BLEND_CMD (CMD_3D|(0x0b<<24)) -#define IAB_MODIFY_ENABLE (1<<23) -#define IAB_ENABLE (1<<22) -#define IAB_MODIFY_FUNC (1<<21) -#define IAB_FUNC_SHIFT 16 -#define IAB_MODIFY_SRC_FACTOR (1<<11) -#define IAB_SRC_FACTOR_SHIFT 6 -#define IAB_SRC_FACTOR_MASK (BLENDFACT_MASK<<6) -#define IAB_MODIFY_DST_FACTOR (1<<5) -#define IAB_DST_FACTOR_SHIFT 0 -#define IAB_DST_FACTOR_MASK (BLENDFACT_MASK<<0) - - -#define BLENDFUNC_ADD 0x0 -#define BLENDFUNC_SUBTRACT 0x1 -#define BLENDFUNC_REVERSE_SUBTRACT 0x2 -#define BLENDFUNC_MIN 0x3 -#define BLENDFUNC_MAX 0x4 -#define BLENDFUNC_MASK 0x7 - -/* 3DSTATE_LOAD_INDIRECT, p180 */ - -#define _3DSTATE_LOAD_INDIRECT (CMD_3D|(0x1d<<24)|(0x7<<16)) -#define LI0_STATE_STATIC_INDIRECT (0x01<<8) -#define LI0_STATE_DYNAMIC_INDIRECT (0x02<<8) -#define LI0_STATE_SAMPLER (0x04<<8) -#define LI0_STATE_MAP (0x08<<8) -#define LI0_STATE_PROGRAM (0x10<<8) -#define LI0_STATE_CONSTANTS (0x20<<8) - -#define SIS0_BUFFER_ADDRESS(x) ((x)&~0x3) -#define SIS0_FORCE_LOAD (1<<1) -#define SIS0_BUFFER_VALID (1<<0) -#define SIS1_BUFFER_LENGTH(x) ((x)&0xff) - -#define DIS0_BUFFER_ADDRESS(x) ((x)&~0x3) -#define DIS0_BUFFER_RESET (1<<1) -#define DIS0_BUFFER_VALID (1<<0) - -#define SSB0_BUFFER_ADDRESS(x) ((x)&~0x3) -#define SSB0_FORCE_LOAD (1<<1) -#define SSB0_BUFFER_VALID (1<<0) -#define SSB1_BUFFER_LENGTH(x) ((x)&0xff) - -#define MSB0_BUFFER_ADDRESS(x) ((x)&~0x3) -#define MSB0_FORCE_LOAD (1<<1) -#define MSB0_BUFFER_VALID (1<<0) -#define MSB1_BUFFER_LENGTH(x) ((x)&0xff) - -#define PSP0_BUFFER_ADDRESS(x) ((x)&~0x3) -#define PSP0_FORCE_LOAD (1<<1) -#define PSP0_BUFFER_VALID (1<<0) -#define PSP1_BUFFER_LENGTH(x) ((x)&0xff) - -#define PSC0_BUFFER_ADDRESS(x) ((x)&~0x3) -#define PSC0_FORCE_LOAD (1<<1) -#define PSC0_BUFFER_VALID (1<<0) -#define PSC1_BUFFER_LENGTH(x) ((x)&0xff) - - - - - -/* _3DSTATE_RASTERIZATION_RULES */ -#define _3DSTATE_RASTER_RULES_CMD (CMD_3D|(0x07<<24)) -#define ENABLE_POINT_RASTER_RULE (1<<15) -#define OGL_POINT_RASTER_RULE (1<<13) -#define ENABLE_TEXKILL_3D_4D (1<<10) -#define TEXKILL_3D (0<<9) -#define TEXKILL_4D (1<<9) -#define ENABLE_LINE_STRIP_PROVOKE_VRTX (1<<8) -#define ENABLE_TRI_FAN_PROVOKE_VRTX (1<<5) -#define LINE_STRIP_PROVOKE_VRTX(x) ((x)<<6) -#define TRI_FAN_PROVOKE_VRTX(x) ((x)<<3) - -/* _3DSTATE_SCISSOR_ENABLE, p256 */ -#define _3DSTATE_SCISSOR_ENABLE_CMD (CMD_3D|(0x1c<<24)|(0x10<<19)) -#define ENABLE_SCISSOR_RECT ((1<<1) | 1) -#define DISABLE_SCISSOR_RECT (1<<1) - -/* _3DSTATE_SCISSOR_RECTANGLE_0, p257 */ -#define _3DSTATE_SCISSOR_RECT_0_CMD (CMD_3D|(0x1d<<24)|(0x81<<16)|1) -/* Dword 1 */ -#define SCISSOR_RECT_0_YMIN(x) ((x)<<16) -#define SCISSOR_RECT_0_XMIN(x) (x) -/* Dword 2 */ -#define SCISSOR_RECT_0_YMAX(x) ((x)<<16) -#define SCISSOR_RECT_0_XMAX(x) (x) - -/* p189 */ -#define _3DSTATE_LOAD_STATE_IMMEDIATE_1 ((0x3<<29)|(0x1d<<24)|(0x04<<16)) -#define I1_LOAD_S(n) (1<<(4+n)) - -#define S0_VB_OFFSET_MASK 0xffffffc -#define S0_AUTO_CACHE_INV_DISABLE (1<<0) - -#define S1_VERTEX_WIDTH_SHIFT 24 -#define S1_VERTEX_WIDTH_MASK (0x3f<<24) -#define S1_VERTEX_PITCH_SHIFT 16 -#define S1_VERTEX_PITCH_MASK (0x3f<<16) - -#define TEXCOORDFMT_2D 0x0 -#define TEXCOORDFMT_3D 0x1 -#define TEXCOORDFMT_4D 0x2 -#define TEXCOORDFMT_1D 0x3 -#define TEXCOORDFMT_2D_16 0x4 -#define TEXCOORDFMT_4D_16 0x5 -#define TEXCOORDFMT_NOT_PRESENT 0xf -#define S2_TEXCOORD_FMT0_MASK 0xf -#define S2_TEXCOORD_FMT1_SHIFT 4 -#define S2_TEXCOORD_FMT(unit, type) ((type)<<(unit*4)) -#define S2_TEXCOORD_NONE (~0) - -/* S3 not interesting */ - -#define S4_POINT_WIDTH_SHIFT 23 -#define S4_POINT_WIDTH_MASK (0x1ff<<23) -#define S4_LINE_WIDTH_SHIFT 19 -#define S4_LINE_WIDTH_ONE (0x2<<19) -#define S4_LINE_WIDTH_MASK (0xf<<19) -#define S4_FLATSHADE_ALPHA (1<<18) -#define S4_FLATSHADE_FOG (1<<17) -#define S4_FLATSHADE_SPECULAR (1<<16) -#define S4_FLATSHADE_COLOR (1<<15) -#define S4_CULLMODE_BOTH (0<<13) -#define S4_CULLMODE_NONE (1<<13) -#define S4_CULLMODE_CW (2<<13) -#define S4_CULLMODE_CCW (3<<13) -#define S4_CULLMODE_MASK (3<<13) -#define S4_VFMT_POINT_WIDTH (1<<12) -#define S4_VFMT_SPEC_FOG (1<<11) -#define S4_VFMT_COLOR (1<<10) -#define S4_VFMT_DEPTH_OFFSET (1<<9) -#define S4_VFMT_XYZ (1<<6) -#define S4_VFMT_XYZW (2<<6) -#define S4_VFMT_XY (3<<6) -#define S4_VFMT_XYW (4<<6) -#define S4_VFMT_XYZW_MASK (7<<6) -#define S4_FORCE_DEFAULT_DIFFUSE (1<<5) -#define S4_FORCE_DEFAULT_SPECULAR (1<<4) -#define S4_LOCAL_DEPTH_OFFSET_ENABLE (1<<3) -#define S4_VFMT_FOG_PARAM (1<<2) -#define S4_SPRITE_POINT_ENABLE (1<<1) -#define S4_LINE_ANTIALIAS_ENABLE (1<<0) - -#define S4_VFMT_MASK (S4_VFMT_POINT_WIDTH | \ - S4_VFMT_SPEC_FOG | \ - S4_VFMT_COLOR | \ - S4_VFMT_DEPTH_OFFSET | \ - S4_VFMT_XYZW_MASK | \ - S4_VFMT_FOG_PARAM) - - -#define S5_WRITEDISABLE_ALPHA (1<<31) -#define S5_WRITEDISABLE_RED (1<<30) -#define S5_WRITEDISABLE_GREEN (1<<29) -#define S5_WRITEDISABLE_BLUE (1<<28) -#define S5_WRITEDISABLE_MASK (0xf<<28) -#define S5_FORCE_DEFAULT_POINT_SIZE (1<<27) -#define S5_LAST_PIXEL_ENABLE (1<<26) -#define S5_GLOBAL_DEPTH_OFFSET_ENABLE (1<<25) -#define S5_FOG_ENABLE (1<<24) -#define S5_STENCIL_REF_SHIFT 16 -#define S5_STENCIL_REF_MASK (0xff<<16) -#define S5_STENCIL_TEST_FUNC_SHIFT 13 -#define S5_STENCIL_TEST_FUNC_MASK (0x7<<13) -#define S5_STENCIL_FAIL_SHIFT 10 -#define S5_STENCIL_FAIL_MASK (0x7<<10) -#define S5_STENCIL_PASS_Z_FAIL_SHIFT 7 -#define S5_STENCIL_PASS_Z_FAIL_MASK (0x7<<7) -#define S5_STENCIL_PASS_Z_PASS_SHIFT 4 -#define S5_STENCIL_PASS_Z_PASS_MASK (0x7<<4) -#define S5_STENCIL_WRITE_ENABLE (1<<3) -#define S5_STENCIL_TEST_ENABLE (1<<2) -#define S5_COLOR_DITHER_ENABLE (1<<1) -#define S5_LOGICOP_ENABLE (1<<0) - - -#define S6_ALPHA_TEST_ENABLE (1<<31) -#define S6_ALPHA_TEST_FUNC_SHIFT 28 -#define S6_ALPHA_TEST_FUNC_MASK (0x7<<28) -#define S6_ALPHA_REF_SHIFT 20 -#define S6_ALPHA_REF_MASK (0xff<<20) -#define S6_DEPTH_TEST_ENABLE (1<<19) -#define S6_DEPTH_TEST_FUNC_SHIFT 16 -#define S6_DEPTH_TEST_FUNC_MASK (0x7<<16) -#define S6_CBUF_BLEND_ENABLE (1<<15) -#define S6_CBUF_BLEND_FUNC_SHIFT 12 -#define S6_CBUF_BLEND_FUNC_MASK (0x7<<12) -#define S6_CBUF_SRC_BLEND_FACT_SHIFT 8 -#define S6_CBUF_SRC_BLEND_FACT_MASK (0xf<<8) -#define S6_CBUF_DST_BLEND_FACT_SHIFT 4 -#define S6_CBUF_DST_BLEND_FACT_MASK (0xf<<4) -#define S6_DEPTH_WRITE_ENABLE (1<<3) -#define S6_COLOR_WRITE_ENABLE (1<<2) -#define S6_TRISTRIP_PV_SHIFT 0 -#define S6_TRISTRIP_PV_MASK (0x3<<0) - -#define S7_DEPTH_OFFSET_CONST_MASK ~0 - - - -#define DST_BLND_FACT(f) ((f)<= 0.0) ? src1 : src2 */ -#define A0_MIN (0xe<<24) /* dst = (src0 < src1) ? src0 : src1 */ -#define A0_MAX (0xf<<24) /* dst = (src0 >= src1) ? src0 : src1 */ -#define A0_FLR (0x10<<24) /* dst = floor(src0) */ -#define A0_MOD (0x11<<24) /* dst = src0 fmod 1.0 */ -#define A0_TRC (0x12<<24) /* dst = int(src0) */ -#define A0_SGE (0x13<<24) /* dst = src0 >= src1 ? 1.0 : 0.0 */ -#define A0_SLT (0x14<<24) /* dst = src0 < src1 ? 1.0 : 0.0 */ -#define A0_DEST_SATURATE (1<<22) -#define A0_DEST_TYPE_SHIFT 19 -/* Allow: R, OC, OD, U */ -#define A0_DEST_NR_SHIFT 14 -/* Allow R: 0..15, OC,OD: 0..0, U: 0..2 */ -#define A0_DEST_CHANNEL_X (1<<10) -#define A0_DEST_CHANNEL_Y (2<<10) -#define A0_DEST_CHANNEL_Z (4<<10) -#define A0_DEST_CHANNEL_W (8<<10) -#define A0_DEST_CHANNEL_ALL (0xf<<10) -#define A0_DEST_CHANNEL_SHIFT 10 -#define A0_SRC0_TYPE_SHIFT 7 -#define A0_SRC0_NR_SHIFT 2 - -#define A0_DEST_CHANNEL_XY (A0_DEST_CHANNEL_X|A0_DEST_CHANNEL_Y) -#define A0_DEST_CHANNEL_XYZ (A0_DEST_CHANNEL_XY|A0_DEST_CHANNEL_Z) - - -#define SRC_X 0 -#define SRC_Y 1 -#define SRC_Z 2 -#define SRC_W 3 -#define SRC_ZERO 4 -#define SRC_ONE 5 - -#define A1_SRC0_CHANNEL_X_NEGATE (1<<31) -#define A1_SRC0_CHANNEL_X_SHIFT 28 -#define A1_SRC0_CHANNEL_Y_NEGATE (1<<27) -#define A1_SRC0_CHANNEL_Y_SHIFT 24 -#define A1_SRC0_CHANNEL_Z_NEGATE (1<<23) -#define A1_SRC0_CHANNEL_Z_SHIFT 20 -#define A1_SRC0_CHANNEL_W_NEGATE (1<<19) -#define A1_SRC0_CHANNEL_W_SHIFT 16 -#define A1_SRC1_TYPE_SHIFT 13 -#define A1_SRC1_NR_SHIFT 8 -#define A1_SRC1_CHANNEL_X_NEGATE (1<<7) -#define A1_SRC1_CHANNEL_X_SHIFT 4 -#define A1_SRC1_CHANNEL_Y_NEGATE (1<<3) -#define A1_SRC1_CHANNEL_Y_SHIFT 0 - -#define A2_SRC1_CHANNEL_Z_NEGATE (1<<31) -#define A2_SRC1_CHANNEL_Z_SHIFT 28 -#define A2_SRC1_CHANNEL_W_NEGATE (1<<27) -#define A2_SRC1_CHANNEL_W_SHIFT 24 -#define A2_SRC2_TYPE_SHIFT 21 -#define A2_SRC2_NR_SHIFT 16 -#define A2_SRC2_CHANNEL_X_NEGATE (1<<15) -#define A2_SRC2_CHANNEL_X_SHIFT 12 -#define A2_SRC2_CHANNEL_Y_NEGATE (1<<11) -#define A2_SRC2_CHANNEL_Y_SHIFT 8 -#define A2_SRC2_CHANNEL_Z_NEGATE (1<<7) -#define A2_SRC2_CHANNEL_Z_SHIFT 4 -#define A2_SRC2_CHANNEL_W_NEGATE (1<<3) -#define A2_SRC2_CHANNEL_W_SHIFT 0 - - - -/* Texture instructions */ -#define T0_TEXLD (0x15<<24) /* Sample texture using predeclared - * sampler and address, and output - * filtered texel data to destination - * register */ -#define T0_TEXLDP (0x16<<24) /* Same as texld but performs a - * perspective divide of the texture - * coordinate .xyz values by .w before - * sampling. */ -#define T0_TEXLDB (0x17<<24) /* Same as texld but biases the - * computed LOD by w. Only S4.6 two's - * comp is used. This implies that a - * float to fixed conversion is - * done. */ -#define T0_TEXKILL (0x18<<24) /* Does not perform a sampling - * operation. Simply kills the pixel - * if any channel of the address - * register is < 0.0. */ -#define T0_DEST_TYPE_SHIFT 19 -/* Allow: R, OC, OD, U */ -/* Note: U (unpreserved) regs do not retain their values between - * phases (cannot be used for feedback) - * - * Note: oC and OD registers can only be used as the destination of a - * texture instruction once per phase (this is an implementation - * restriction). - */ -#define T0_DEST_NR_SHIFT 14 -/* Allow R: 0..15, OC,OD: 0..0, U: 0..2 */ -#define T0_SAMPLER_NR_SHIFT 0 /* This field ignored for TEXKILL */ -#define T0_SAMPLER_NR_MASK (0xf<<0) - -#define T1_ADDRESS_REG_TYPE_SHIFT 24 /* Reg to use as texture coord */ -/* Allow R, T, OC, OD -- R, OC, OD are 'dependent' reads, new program phase */ -#define T1_ADDRESS_REG_NR_SHIFT 17 -#define T2_MBZ 0 - -/* Declaration instructions */ -#define D0_DCL (0x19<<24) /* Declare a t (interpolated attrib) - * register or an s (sampler) - * register. */ -#define D0_SAMPLE_TYPE_SHIFT 22 -#define D0_SAMPLE_TYPE_2D (0x0<<22) -#define D0_SAMPLE_TYPE_CUBE (0x1<<22) -#define D0_SAMPLE_TYPE_VOLUME (0x2<<22) -#define D0_SAMPLE_TYPE_MASK (0x3<<22) - -#define D0_TYPE_SHIFT 19 -/* Allow: T, S */ -#define D0_NR_SHIFT 14 -/* Allow T: 0..10, S: 0..15 */ -#define D0_CHANNEL_X (1<<10) -#define D0_CHANNEL_Y (2<<10) -#define D0_CHANNEL_Z (4<<10) -#define D0_CHANNEL_W (8<<10) -#define D0_CHANNEL_ALL (0xf<<10) -#define D0_CHANNEL_NONE (0<<10) - -#define D0_CHANNEL_XY (D0_CHANNEL_X|D0_CHANNEL_Y) -#define D0_CHANNEL_XYZ (D0_CHANNEL_XY|D0_CHANNEL_Z) - -/* I915 Errata: Do not allow (xz), (xw), (xzw) combinations for diffuse - * or specular declarations. - * - * For T dcls, only allow: (x), (xy), (xyz), (w), (xyzw) - * - * Must be zero for S (sampler) dcls - */ -#define D1_MBZ 0 -#define D2_MBZ 0 - - - -/* p207 */ -#define _3DSTATE_MAP_STATE (CMD_3D|(0x1d<<24)|(0x0<<16)) - -#define MS1_MAPMASK_SHIFT 0 -#define MS1_MAPMASK_MASK (0x8fff<<0) - -#define MS2_UNTRUSTED_SURFACE (1<<31) -#define MS2_ADDRESS_MASK 0xfffffffc -#define MS2_VERTICAL_LINE_STRIDE (1<<1) -#define MS2_VERTICAL_OFFSET (1<<1) - -#define MS3_HEIGHT_SHIFT 21 -#define MS3_WIDTH_SHIFT 10 -#define MS3_PALETTE_SELECT (1<<9) -#define MS3_MAPSURF_FORMAT_SHIFT 7 -#define MS3_MAPSURF_FORMAT_MASK (0x7<<7) -#define MAPSURF_8BIT (1<<7) -#define MAPSURF_16BIT (2<<7) -#define MAPSURF_32BIT (3<<7) -#define MAPSURF_422 (5<<7) -#define MAPSURF_COMPRESSED (6<<7) -#define MAPSURF_4BIT_INDEXED (7<<7) -#define MS3_MT_FORMAT_MASK (0x7 << 3) -#define MS3_MT_FORMAT_SHIFT 3 -#define MT_4BIT_IDX_ARGB8888 (7<<3) /* SURFACE_4BIT_INDEXED */ -#define MT_8BIT_I8 (0<<3) /* SURFACE_8BIT */ -#define MT_8BIT_L8 (1<<3) -#define MT_8BIT_A8 (4<<3) -#define MT_8BIT_MONO8 (5<<3) -#define MT_16BIT_RGB565 (0<<3) /* SURFACE_16BIT */ -#define MT_16BIT_ARGB1555 (1<<3) -#define MT_16BIT_ARGB4444 (2<<3) -#define MT_16BIT_AY88 (3<<3) -#define MT_16BIT_88DVDU (5<<3) -#define MT_16BIT_BUMP_655LDVDU (6<<3) -#define MT_16BIT_I16 (7<<3) -#define MT_16BIT_L16 (8<<3) -#define MT_16BIT_A16 (9<<3) -#define MT_32BIT_ARGB8888 (0<<3) /* SURFACE_32BIT */ -#define MT_32BIT_ABGR8888 (1<<3) -#define MT_32BIT_XRGB8888 (2<<3) -#define MT_32BIT_XBGR8888 (3<<3) -#define MT_32BIT_QWVU8888 (4<<3) -#define MT_32BIT_AXVU8888 (5<<3) -#define MT_32BIT_LXVU8888 (6<<3) -#define MT_32BIT_XLVU8888 (7<<3) -#define MT_32BIT_ARGB2101010 (8<<3) -#define MT_32BIT_ABGR2101010 (9<<3) -#define MT_32BIT_AWVU2101010 (0xA<<3) -#define MT_32BIT_GR1616 (0xB<<3) -#define MT_32BIT_VU1616 (0xC<<3) -#define MT_32BIT_xI824 (0xD<<3) -#define MT_32BIT_xA824 (0xE<<3) -#define MT_32BIT_xL824 (0xF<<3) -#define MT_422_YCRCB_SWAPY (0<<3) /* SURFACE_422 */ -#define MT_422_YCRCB_NORMAL (1<<3) -#define MT_422_YCRCB_SWAPUV (2<<3) -#define MT_422_YCRCB_SWAPUVY (3<<3) -#define MT_COMPRESS_DXT1 (0<<3) /* SURFACE_COMPRESSED */ -#define MT_COMPRESS_DXT2_3 (1<<3) -#define MT_COMPRESS_DXT4_5 (2<<3) -#define MT_COMPRESS_FXT1 (3<<3) -#define MT_COMPRESS_DXT1_RGB (4<<3) -#define MS3_USE_FENCE_REGS (1<<2) -#define MS3_TILED_SURFACE (1<<1) -#define MS3_TILE_WALK (1<<0) - -#define MS4_PITCH_SHIFT 21 -#define MS4_CUBE_FACE_ENA_NEGX (1<<20) -#define MS4_CUBE_FACE_ENA_POSX (1<<19) -#define MS4_CUBE_FACE_ENA_NEGY (1<<18) -#define MS4_CUBE_FACE_ENA_POSY (1<<17) -#define MS4_CUBE_FACE_ENA_NEGZ (1<<16) -#define MS4_CUBE_FACE_ENA_POSZ (1<<15) -#define MS4_CUBE_FACE_ENA_MASK (0x3f<<15) -#define MS4_MAX_LOD_SHIFT 9 -#define MS4_MAX_LOD_MASK (0x3f<<9) -#define MS4_MIP_LAYOUT_LEGACY (0<<8) -#define MS4_MIP_LAYOUT_BELOW_LPT (0<<8) -#define MS4_MIP_LAYOUT_RIGHT_LPT (1<<8) -#define MS4_VOLUME_DEPTH_SHIFT 0 -#define MS4_VOLUME_DEPTH_MASK (0xff<<0) - -/* p244 */ -#define _3DSTATE_SAMPLER_STATE (CMD_3D|(0x1d<<24)|(0x1<<16)) - -#define SS1_MAPMASK_SHIFT 0 -#define SS1_MAPMASK_MASK (0x8fff<<0) - -#define SS2_REVERSE_GAMMA_ENABLE (1<<31) -#define SS2_PACKED_TO_PLANAR_ENABLE (1<<30) -#define SS2_COLORSPACE_CONVERSION (1<<29) -#define SS2_CHROMAKEY_SHIFT 27 -#define SS2_BASE_MIP_LEVEL_SHIFT 22 -#define SS2_BASE_MIP_LEVEL_MASK (0x1f<<22) -#define SS2_MIP_FILTER_SHIFT 20 -#define SS2_MIP_FILTER_MASK (0x3<<20) -#define MIPFILTER_NONE 0 -#define MIPFILTER_NEAREST 1 -#define MIPFILTER_LINEAR 3 -#define SS2_MAG_FILTER_SHIFT 17 -#define SS2_MAG_FILTER_MASK (0x7<<17) -#define FILTER_NEAREST 0 -#define FILTER_LINEAR 1 -#define FILTER_ANISOTROPIC 2 -#define FILTER_4X4_1 3 -#define FILTER_4X4_2 4 -#define FILTER_4X4_FLAT 5 -#define FILTER_6X5_MONO 6 /* XXX - check */ -#define SS2_MIN_FILTER_SHIFT 14 -#define SS2_MIN_FILTER_MASK (0x7<<14) -#define SS2_LOD_BIAS_SHIFT 5 -#define SS2_LOD_BIAS_ONE (0x10<<5) -#define SS2_LOD_BIAS_MASK (0x1ff<<5) -/* Shadow requires: - * MT_X8{I,L,A}24 or MT_{I,L,A}16 texture format - * FILTER_4X4_x MIN and MAG filters - */ -#define SS2_SHADOW_ENABLE (1<<4) -#define SS2_MAX_ANISO_MASK (1<<3) -#define SS2_MAX_ANISO_2 (0<<3) -#define SS2_MAX_ANISO_4 (1<<3) -#define SS2_SHADOW_FUNC_SHIFT 0 -#define SS2_SHADOW_FUNC_MASK (0x7<<0) -/* SS2_SHADOW_FUNC values: see COMPAREFUNC_* */ - -#define SS3_MIN_LOD_SHIFT 24 -#define SS3_MIN_LOD_ONE (0x10<<24) -#define SS3_MIN_LOD_MASK (0xff<<24) -#define SS3_KILL_PIXEL_ENABLE (1<<17) -#define SS3_TCX_ADDR_MODE_SHIFT 12 -#define SS3_TCX_ADDR_MODE_MASK (0x7<<12) -#define TEXCOORDMODE_WRAP 0 -#define TEXCOORDMODE_MIRROR 1 -#define TEXCOORDMODE_CLAMP_EDGE 2 -#define TEXCOORDMODE_CUBE 3 -#define TEXCOORDMODE_CLAMP_BORDER 4 -#define TEXCOORDMODE_MIRROR_ONCE 5 -#define SS3_TCY_ADDR_MODE_SHIFT 9 -#define SS3_TCY_ADDR_MODE_MASK (0x7<<9) -#define SS3_TCZ_ADDR_MODE_SHIFT 6 -#define SS3_TCZ_ADDR_MODE_MASK (0x7<<6) -#define SS3_NORMALIZED_COORDS (1<<5) -#define SS3_TEXTUREMAP_INDEX_SHIFT 1 -#define SS3_TEXTUREMAP_INDEX_MASK (0xf<<1) -#define SS3_DEINTERLACER_ENABLE (1<<0) - -#define SS4_BORDER_COLOR_MASK (~0) - -/* 3DSTATE_SPAN_STIPPLE, p258 - */ -#define _3DSTATE_STIPPLE ((0x3<<29)|(0x1d<<24)|(0x83<<16)) -#define ST1_ENABLE (1<<16) -#define ST1_MASK (0xffff) - -#define _3DSTATE_DEFAULT_Z ((0x3<<29)|(0x1d<<24)|(0x98<<16)) -#define _3DSTATE_DEFAULT_DIFFUSE ((0x3<<29)|(0x1d<<24)|(0x99<<16)) -#define _3DSTATE_DEFAULT_SPECULAR ((0x3<<29)|(0x1d<<24)|(0x9a<<16)) - - -#define MI_FLUSH ((0<<29)|(4<<23)) -#define FLUSH_MAP_CACHE (1<<0) -#define INHIBIT_FLUSH_RENDER_CACHE (1<<2) - - -#define CMD_3D (0x3<<29) - - -#define _3DPRIMITIVE ((0x3<<29)|(0x1f<<24)) -#define PRIM_INDIRECT (1<<23) -#define PRIM_INLINE (0<<23) -#define PRIM_INDIRECT_SEQUENTIAL (0<<17) -#define PRIM_INDIRECT_ELTS (1<<17) - -#define PRIM3D_TRILIST (0x0<<18) -#define PRIM3D_TRISTRIP (0x1<<18) -#define PRIM3D_TRISTRIP_RVRSE (0x2<<18) -#define PRIM3D_TRIFAN (0x3<<18) -#define PRIM3D_POLY (0x4<<18) -#define PRIM3D_LINELIST (0x5<<18) -#define PRIM3D_LINESTRIP (0x6<<18) -#define PRIM3D_RECTLIST (0x7<<18) -#define PRIM3D_POINTLIST (0x8<<18) -#define PRIM3D_DIB (0x9<<18) -#define PRIM3D_MASK (0x1f<<18) - -#define I915PACKCOLOR4444(r,g,b,a) \ - ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4)) - -#define I915PACKCOLOR1555(r,g,b,a) \ - ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \ - ((a) ? 0x8000 : 0)) - -#define I915PACKCOLOR565(r,g,b) \ - ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3)) - -#define I915PACKCOLOR8888(r,g,b,a) \ - ((a<<24) | (r<<16) | (g<<8) | b) - - - - -#define BR00_BITBLT_CLIENT 0x40000000 -#define BR00_OP_COLOR_BLT 0x10000000 -#define BR00_OP_SRC_COPY_BLT 0x10C00000 -#define BR13_SOLID_PATTERN 0x80000000 - -#define XY_COLOR_BLT_CMD ((2<<29)|(0x50<<22)|0x4) -#define XY_COLOR_BLT_WRITE_ALPHA (1<<21) -#define XY_COLOR_BLT_WRITE_RGB (1<<20) - -#define XY_SRC_COPY_BLT_CMD ((2<<29)|(0x53<<22)|6) -#define XY_SRC_COPY_BLT_WRITE_ALPHA (1<<21) -#define XY_SRC_COPY_BLT_WRITE_RGB (1<<20) - -#define MI_WAIT_FOR_EVENT ((0x3<<23)) -#define MI_WAIT_FOR_PLANE_B_FLIP (1<<6) -#define MI_WAIT_FOR_PLANE_A_FLIP (1<<2) - -#define MI_BATCH_BUFFER (0x30<<23) -#define MI_BATCH_BUFFER_START (0x31<<23) -#define MI_BATCH_BUFFER_END (0xa<<23) - - - -#define COMPAREFUNC_ALWAYS 0 -#define COMPAREFUNC_NEVER 0x1 -#define COMPAREFUNC_LESS 0x2 -#define COMPAREFUNC_EQUAL 0x3 -#define COMPAREFUNC_LEQUAL 0x4 -#define COMPAREFUNC_GREATER 0x5 -#define COMPAREFUNC_NOTEQUAL 0x6 -#define COMPAREFUNC_GEQUAL 0x7 - -#define STENCILOP_KEEP 0 -#define STENCILOP_ZERO 0x1 -#define STENCILOP_REPLACE 0x2 -#define STENCILOP_INCRSAT 0x3 -#define STENCILOP_DECRSAT 0x4 -#define STENCILOP_INCR 0x5 -#define STENCILOP_DECR 0x6 -#define STENCILOP_INVERT 0x7 - -#define LOGICOP_CLEAR 0 -#define LOGICOP_NOR 0x1 -#define LOGICOP_AND_INV 0x2 -#define LOGICOP_COPY_INV 0x3 -#define LOGICOP_AND_RVRSE 0x4 -#define LOGICOP_INV 0x5 -#define LOGICOP_XOR 0x6 -#define LOGICOP_NAND 0x7 -#define LOGICOP_AND 0x8 -#define LOGICOP_EQUIV 0x9 -#define LOGICOP_NOOP 0xa -#define LOGICOP_OR_INV 0xb -#define LOGICOP_COPY 0xc -#define LOGICOP_OR_RVRSE 0xd -#define LOGICOP_OR 0xe -#define LOGICOP_SET 0xf - -#define BLENDFACT_ZERO 0x01 -#define BLENDFACT_ONE 0x02 -#define BLENDFACT_SRC_COLR 0x03 -#define BLENDFACT_INV_SRC_COLR 0x04 -#define BLENDFACT_SRC_ALPHA 0x05 -#define BLENDFACT_INV_SRC_ALPHA 0x06 -#define BLENDFACT_DST_ALPHA 0x07 -#define BLENDFACT_INV_DST_ALPHA 0x08 -#define BLENDFACT_DST_COLR 0x09 -#define BLENDFACT_INV_DST_COLR 0x0a -#define BLENDFACT_SRC_ALPHA_SATURATE 0x0b -#define BLENDFACT_CONST_COLOR 0x0c -#define BLENDFACT_INV_CONST_COLOR 0x0d -#define BLENDFACT_CONST_ALPHA 0x0e -#define BLENDFACT_INV_CONST_ALPHA 0x0f -#define BLENDFACT_MASK 0x0f - -#define PCI_CHIP_I915_G 0x2582 -#define PCI_CHIP_I915_GM 0x2592 -#define PCI_CHIP_I945_G 0x2772 -#define PCI_CHIP_I945_GM 0x27A2 -#define PCI_CHIP_I945_GME 0x27AE -#define PCI_CHIP_G33_G 0x29C2 -#define PCI_CHIP_Q35_G 0x29B2 -#define PCI_CHIP_Q33_G 0x29D2 - - -#endif diff --git a/src/gallium/drivers/i915simple/i915_screen.c b/src/gallium/drivers/i915simple/i915_screen.c deleted file mode 100644 index c66558c320..0000000000 --- a/src/gallium/drivers/i915simple/i915_screen.c +++ /dev/null @@ -1,298 +0,0 @@ -/************************************************************************** - * - * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#include "pipe/p_inlines.h" -#include "util/u_memory.h" -#include "util/u_string.h" - -#include "i915_reg.h" -#include "i915_context.h" -#include "i915_screen.h" -#include "i915_buffer.h" -#include "i915_texture.h" -#include "intel_winsys.h" - - -/* - * Probe functions - */ - - -static const char * -i915_get_vendor(struct pipe_screen *screen) -{ - return "VMware, Inc."; -} - -static const char * -i915_get_name(struct pipe_screen *screen) -{ - static char buffer[128]; - const char *chipset; - - switch (i915_screen(screen)->pci_id) { - case PCI_CHIP_I915_G: - chipset = "915G"; - break; - case PCI_CHIP_I915_GM: - chipset = "915GM"; - break; - case PCI_CHIP_I945_G: - chipset = "945G"; - break; - case PCI_CHIP_I945_GM: - chipset = "945GM"; - break; - case PCI_CHIP_I945_GME: - chipset = "945GME"; - break; - case PCI_CHIP_G33_G: - chipset = "G33"; - break; - case PCI_CHIP_Q35_G: - chipset = "Q35"; - break; - case PCI_CHIP_Q33_G: - chipset = "Q33"; - break; - default: - chipset = "unknown"; - break; - } - - util_snprintf(buffer, sizeof(buffer), "i915 (chipset: %s)", chipset); - return buffer; -} - -static int -i915_get_param(struct pipe_screen *screen, int param) -{ - switch (param) { - case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: - return 8; - case PIPE_CAP_NPOT_TEXTURES: - return 1; - case PIPE_CAP_TWO_SIDED_STENCIL: - return 1; - case PIPE_CAP_GLSL: - return 0; - case PIPE_CAP_ANISOTROPIC_FILTER: - return 0; - case PIPE_CAP_POINT_SPRITE: - return 0; - case PIPE_CAP_MAX_RENDER_TARGETS: - return 1; - case PIPE_CAP_OCCLUSION_QUERY: - return 0; - case PIPE_CAP_TEXTURE_SHADOW_MAP: - return 1; - case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: - return 11; /* max 1024x1024 */ - case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: - return 8; /* max 128x128x128 */ - case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: - return 11; /* max 1024x1024 */ - default: - return 0; - } -} - -static float -i915_get_paramf(struct pipe_screen *screen, int param) -{ - switch (param) { - case PIPE_CAP_MAX_LINE_WIDTH: - /* fall-through */ - case PIPE_CAP_MAX_LINE_WIDTH_AA: - return 7.5; - - case PIPE_CAP_MAX_POINT_WIDTH: - /* fall-through */ - case PIPE_CAP_MAX_POINT_WIDTH_AA: - return 255.0; - - case PIPE_CAP_MAX_TEXTURE_ANISOTROPY: - return 4.0; - - case PIPE_CAP_MAX_TEXTURE_LOD_BIAS: - return 16.0; - - default: - return 0; - } -} - -static boolean -i915_is_format_supported(struct pipe_screen *screen, - enum pipe_format format, - enum pipe_texture_target target, - unsigned tex_usage, - unsigned geom_flags) -{ - static const enum pipe_format tex_supported[] = { - PIPE_FORMAT_R8G8B8A8_UNORM, - PIPE_FORMAT_A8R8G8B8_UNORM, - PIPE_FORMAT_R5G6B5_UNORM, - PIPE_FORMAT_L8_UNORM, - PIPE_FORMAT_A8_UNORM, - PIPE_FORMAT_I8_UNORM, - PIPE_FORMAT_A8L8_UNORM, - PIPE_FORMAT_YCBCR, - PIPE_FORMAT_YCBCR_REV, - PIPE_FORMAT_S8Z24_UNORM, - PIPE_FORMAT_NONE /* list terminator */ - }; - static const enum pipe_format surface_supported[] = { - PIPE_FORMAT_A8R8G8B8_UNORM, - PIPE_FORMAT_R5G6B5_UNORM, - PIPE_FORMAT_S8Z24_UNORM, - PIPE_FORMAT_NONE /* list terminator */ - }; - const enum pipe_format *list; - uint i; - - if(tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) - list = surface_supported; - else - list = tex_supported; - - for (i = 0; list[i] != PIPE_FORMAT_NONE; i++) { - if (list[i] == format) - return TRUE; - } - - return FALSE; -} - - -/* - * Fence functions - */ - - -static void -i915_fence_reference(struct pipe_screen *screen, - struct pipe_fence_handle **ptr, - struct pipe_fence_handle *fence) -{ - struct i915_screen *is = i915_screen(screen); - - is->iws->fence_reference(is->iws, ptr, fence); -} - -static int -i915_fence_signalled(struct pipe_screen *screen, - struct pipe_fence_handle *fence, - unsigned flags) -{ - struct i915_screen *is = i915_screen(screen); - - return is->iws->fence_signalled(is->iws, fence); -} - -static int -i915_fence_finish(struct pipe_screen *screen, - struct pipe_fence_handle *fence, - unsigned flags) -{ - struct i915_screen *is = i915_screen(screen); - - return is->iws->fence_finish(is->iws, fence); -} - - -/* - * Generic functions - */ - - -static void -i915_destroy_screen(struct pipe_screen *screen) -{ - struct i915_screen *is = i915_screen(screen); - - if (is->iws) - is->iws->destroy(is->iws); - - FREE(is); -} - -/** - * Create a new i915_screen object - */ -struct pipe_screen * -i915_create_screen(struct intel_winsys *iws, uint pci_id) -{ - struct i915_screen *is = CALLOC_STRUCT(i915_screen); - - if (!is) - return NULL; - - switch (pci_id) { - case PCI_CHIP_I915_G: - case PCI_CHIP_I915_GM: - is->is_i945 = FALSE; - break; - - case PCI_CHIP_I945_G: - case PCI_CHIP_I945_GM: - case PCI_CHIP_I945_GME: - case PCI_CHIP_G33_G: - case PCI_CHIP_Q33_G: - case PCI_CHIP_Q35_G: - is->is_i945 = TRUE; - break; - - default: - debug_printf("%s: unknown pci id 0x%x, cannot create screen\n", - __FUNCTION__, pci_id); - return NULL; - } - - is->pci_id = pci_id; - is->iws = iws; - - is->base.winsys = NULL; - - is->base.destroy = i915_destroy_screen; - - is->base.get_name = i915_get_name; - is->base.get_vendor = i915_get_vendor; - is->base.get_param = i915_get_param; - is->base.get_paramf = i915_get_paramf; - is->base.is_format_supported = i915_is_format_supported; - - is->base.fence_reference = i915_fence_reference; - is->base.fence_signalled = i915_fence_signalled; - is->base.fence_finish = i915_fence_finish; - - i915_init_screen_texture_functions(is); - i915_init_screen_buffer_functions(is); - - return &is->base; -} diff --git a/src/gallium/drivers/i915simple/i915_screen.h b/src/gallium/drivers/i915simple/i915_screen.h deleted file mode 100644 index 5126485caa..0000000000 --- a/src/gallium/drivers/i915simple/i915_screen.h +++ /dev/null @@ -1,80 +0,0 @@ -/************************************************************************** - * - * 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. - * - **************************************************************************/ - -#ifndef I915_SCREEN_H -#define I915_SCREEN_H - -#include "pipe/p_state.h" -#include "pipe/p_screen.h" - - -struct intel_winsys; - - -/** - * Subclass of pipe_screen - */ -struct i915_screen -{ - struct pipe_screen base; - - struct intel_winsys *iws; - - boolean is_i945; - uint pci_id; -}; - -/** - * Subclass of pipe_transfer - */ -struct i915_transfer -{ - struct pipe_transfer base; - - unsigned offset; -}; - - -/* - * Cast wrappers - */ - - -static INLINE struct i915_screen * -i915_screen(struct pipe_screen *pscreen) -{ - return (struct i915_screen *) pscreen; -} - -static INLINE struct i915_transfer * -i915_transfer(struct pipe_transfer *transfer) -{ - return (struct i915_transfer *)transfer; -} - - -#endif /* I915_SCREEN_H */ diff --git a/src/gallium/drivers/i915simple/i915_state.c b/src/gallium/drivers/i915simple/i915_state.c deleted file mode 100644 index 7d48e6e84d..0000000000 --- a/src/gallium/drivers/i915simple/i915_state.c +++ /dev/null @@ -1,796 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * 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: Keith Whitwell - */ - - -#include "draw/draw_context.h" -#include "pipe/internal/p_winsys_screen.h" -#include "pipe/p_inlines.h" -#include "util/u_math.h" -#include "util/u_memory.h" -#include "tgsi/tgsi_parse.h" - -#include "i915_context.h" -#include "i915_reg.h" -#include "i915_state.h" -#include "i915_state_inlines.h" -#include "i915_fpc.h" - -/* The i915 (and related graphics cores) do not support GL_CLAMP. The - * Intel drivers for "other operating systems" implement GL_CLAMP as - * GL_CLAMP_TO_EDGE, so the same is done here. - */ -static unsigned -translate_wrap_mode(unsigned wrap) -{ - switch (wrap) { - case PIPE_TEX_WRAP_REPEAT: - return TEXCOORDMODE_WRAP; - case PIPE_TEX_WRAP_CLAMP: - return TEXCOORDMODE_CLAMP_EDGE; /* not quite correct */ - case PIPE_TEX_WRAP_CLAMP_TO_EDGE: - return TEXCOORDMODE_CLAMP_EDGE; - case PIPE_TEX_WRAP_CLAMP_TO_BORDER: - return TEXCOORDMODE_CLAMP_BORDER; -// case PIPE_TEX_WRAP_MIRRORED_REPEAT: -// return TEXCOORDMODE_MIRROR; - default: - return TEXCOORDMODE_WRAP; - } -} - -static unsigned translate_img_filter( unsigned filter ) -{ - switch (filter) { - case PIPE_TEX_FILTER_NEAREST: - return FILTER_NEAREST; - case PIPE_TEX_FILTER_LINEAR: - return FILTER_LINEAR; - case PIPE_TEX_FILTER_ANISO: - return FILTER_ANISOTROPIC; - default: - assert(0); - return FILTER_NEAREST; - } -} - -static unsigned translate_mip_filter( unsigned filter ) -{ - switch (filter) { - case PIPE_TEX_MIPFILTER_NONE: - return MIPFILTER_NONE; - case PIPE_TEX_MIPFILTER_NEAREST: - return MIPFILTER_NEAREST; - case PIPE_TEX_MIPFILTER_LINEAR: - return MIPFILTER_LINEAR; - default: - assert(0); - return MIPFILTER_NONE; - } -} - - -/* None of this state is actually used for anything yet. - */ -static void * -i915_create_blend_state(struct pipe_context *pipe, - const struct pipe_blend_state *blend) -{ - struct i915_blend_state *cso_data = CALLOC_STRUCT( i915_blend_state ); - - { - unsigned eqRGB = blend->rgb_func; - unsigned srcRGB = blend->rgb_src_factor; - unsigned dstRGB = blend->rgb_dst_factor; - - unsigned eqA = blend->alpha_func; - unsigned srcA = blend->alpha_src_factor; - unsigned dstA = blend->alpha_dst_factor; - - /* Special handling for MIN/MAX filter modes handled at - * state_tracker level. - */ - - if (srcA != srcRGB || - dstA != dstRGB || - eqA != eqRGB) { - - cso_data->iab = (_3DSTATE_INDEPENDENT_ALPHA_BLEND_CMD | - IAB_MODIFY_ENABLE | - IAB_ENABLE | - IAB_MODIFY_FUNC | - IAB_MODIFY_SRC_FACTOR | - IAB_MODIFY_DST_FACTOR | - SRC_ABLND_FACT(i915_translate_blend_factor(srcA)) | - DST_ABLND_FACT(i915_translate_blend_factor(dstA)) | - (i915_translate_blend_func(eqA) << IAB_FUNC_SHIFT)); - } - else { - cso_data->iab = (_3DSTATE_INDEPENDENT_ALPHA_BLEND_CMD | - IAB_MODIFY_ENABLE | - 0); - } - } - - cso_data->modes4 |= (_3DSTATE_MODES_4_CMD | - ENABLE_LOGIC_OP_FUNC | - LOGIC_OP_FUNC(i915_translate_logic_op(blend->logicop_func))); - - if (blend->logicop_enable) - cso_data->LIS5 |= S5_LOGICOP_ENABLE; - - if (blend->dither) - cso_data->LIS5 |= S5_COLOR_DITHER_ENABLE; - - if ((blend->colormask & PIPE_MASK_R) == 0) - cso_data->LIS5 |= S5_WRITEDISABLE_RED; - - if ((blend->colormask & PIPE_MASK_G) == 0) - cso_data->LIS5 |= S5_WRITEDISABLE_GREEN; - - if ((blend->colormask & PIPE_MASK_B) == 0) - cso_data->LIS5 |= S5_WRITEDISABLE_BLUE; - - if ((blend->colormask & PIPE_MASK_A) == 0) - cso_data->LIS5 |= S5_WRITEDISABLE_ALPHA; - - if (blend->blend_enable) { - unsigned funcRGB = blend->rgb_func; - unsigned srcRGB = blend->rgb_src_factor; - unsigned dstRGB = blend->rgb_dst_factor; - - cso_data->LIS6 |= (S6_CBUF_BLEND_ENABLE | - SRC_BLND_FACT(i915_translate_blend_factor(srcRGB)) | - DST_BLND_FACT(i915_translate_blend_factor(dstRGB)) | - (i915_translate_blend_func(funcRGB) << S6_CBUF_BLEND_FUNC_SHIFT)); - } - - return cso_data; -} - -static void i915_bind_blend_state(struct pipe_context *pipe, - void *blend) -{ - struct i915_context *i915 = i915_context(pipe); - draw_flush(i915->draw); - - i915->blend = (struct i915_blend_state*)blend; - - i915->dirty |= I915_NEW_BLEND; -} - - -static void i915_delete_blend_state(struct pipe_context *pipe, void *blend) -{ - FREE(blend); -} - -static void i915_set_blend_color( struct pipe_context *pipe, - const struct pipe_blend_color *blend_color ) -{ - struct i915_context *i915 = i915_context(pipe); - draw_flush(i915->draw); - - i915->blend_color = *blend_color; - - i915->dirty |= I915_NEW_BLEND; -} - -static void * -i915_create_sampler_state(struct pipe_context *pipe, - const struct pipe_sampler_state *sampler) -{ - struct i915_sampler_state *cso = CALLOC_STRUCT( i915_sampler_state ); - const unsigned ws = sampler->wrap_s; - const unsigned wt = sampler->wrap_t; - const unsigned wr = sampler->wrap_r; - unsigned minFilt, magFilt; - unsigned mipFilt; - - cso->templ = sampler; - - mipFilt = translate_mip_filter(sampler->min_mip_filter); - minFilt = translate_img_filter( sampler->min_img_filter ); - magFilt = translate_img_filter( sampler->mag_img_filter ); - - if (sampler->max_anisotropy > 2.0) { - cso->state[0] |= SS2_MAX_ANISO_4; - } - - { - int b = (int) (sampler->lod_bias * 16.0); - b = CLAMP(b, -256, 255); - cso->state[0] |= ((b << SS2_LOD_BIAS_SHIFT) & SS2_LOD_BIAS_MASK); - } - - /* Shadow: - */ - if (sampler->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) - { - cso->state[0] |= (SS2_SHADOW_ENABLE | - i915_translate_compare_func(sampler->compare_func)); - - minFilt = FILTER_4X4_FLAT; - magFilt = FILTER_4X4_FLAT; - } - - cso->state[0] |= ((minFilt << SS2_MIN_FILTER_SHIFT) | - (mipFilt << SS2_MIP_FILTER_SHIFT) | - (magFilt << SS2_MAG_FILTER_SHIFT)); - - cso->state[1] |= - ((translate_wrap_mode(ws) << SS3_TCX_ADDR_MODE_SHIFT) | - (translate_wrap_mode(wt) << SS3_TCY_ADDR_MODE_SHIFT) | - (translate_wrap_mode(wr) << SS3_TCZ_ADDR_MODE_SHIFT)); - - if (sampler->normalized_coords) - cso->state[1] |= SS3_NORMALIZED_COORDS; - - { - int minlod = (int) (16.0 * sampler->min_lod); - int maxlod = (int) (16.0 * sampler->max_lod); - minlod = CLAMP(minlod, 0, 16 * 11); - maxlod = CLAMP(maxlod, 0, 16 * 11); - - if (minlod > maxlod) - maxlod = minlod; - - cso->minlod = minlod; - cso->maxlod = maxlod; - } - - { - ubyte r = float_to_ubyte(sampler->border_color[0]); - ubyte g = float_to_ubyte(sampler->border_color[1]); - ubyte b = float_to_ubyte(sampler->border_color[2]); - ubyte a = float_to_ubyte(sampler->border_color[3]); - cso->state[2] = I915PACKCOLOR8888(r, g, b, a); - } - return cso; -} - -static void i915_bind_sampler_states(struct pipe_context *pipe, - unsigned num, void **sampler) -{ - struct i915_context *i915 = i915_context(pipe); - unsigned i; - - assert(num <= PIPE_MAX_SAMPLERS); - - /* Check for no-op */ - if (num == i915->num_samplers && - !memcmp(i915->sampler, sampler, num * sizeof(void *))) - return; - - draw_flush(i915->draw); - - for (i = 0; i < num; ++i) - i915->sampler[i] = sampler[i]; - for (i = num; i < PIPE_MAX_SAMPLERS; ++i) - i915->sampler[i] = NULL; - - i915->num_samplers = num; - - i915->dirty |= I915_NEW_SAMPLER; -} - -static void i915_delete_sampler_state(struct pipe_context *pipe, - void *sampler) -{ - FREE(sampler); -} - - -/** XXX move someday? Or consolidate all these simple state setters - * into one file. - */ - -static void * -i915_create_depth_stencil_state(struct pipe_context *pipe, - const struct pipe_depth_stencil_alpha_state *depth_stencil) -{ - struct i915_depth_stencil_state *cso = CALLOC_STRUCT( i915_depth_stencil_state ); - - { - int testmask = depth_stencil->stencil[0].valuemask & 0xff; - int writemask = depth_stencil->stencil[0].writemask & 0xff; - - cso->stencil_modes4 |= (_3DSTATE_MODES_4_CMD | - ENABLE_STENCIL_TEST_MASK | - STENCIL_TEST_MASK(testmask) | - ENABLE_STENCIL_WRITE_MASK | - STENCIL_WRITE_MASK(writemask)); - } - - if (depth_stencil->stencil[0].enabled) { - int test = i915_translate_compare_func(depth_stencil->stencil[0].func); - int fop = i915_translate_stencil_op(depth_stencil->stencil[0].fail_op); - int dfop = i915_translate_stencil_op(depth_stencil->stencil[0].zfail_op); - int dpop = i915_translate_stencil_op(depth_stencil->stencil[0].zpass_op); - int ref = depth_stencil->stencil[0].ref_value & 0xff; - - cso->stencil_LIS5 |= (S5_STENCIL_TEST_ENABLE | - S5_STENCIL_WRITE_ENABLE | - (ref << S5_STENCIL_REF_SHIFT) | - (test << S5_STENCIL_TEST_FUNC_SHIFT) | - (fop << S5_STENCIL_FAIL_SHIFT) | - (dfop << S5_STENCIL_PASS_Z_FAIL_SHIFT) | - (dpop << S5_STENCIL_PASS_Z_PASS_SHIFT)); - } - - if (depth_stencil->stencil[1].enabled) { - int test = i915_translate_compare_func(depth_stencil->stencil[1].func); - int fop = i915_translate_stencil_op(depth_stencil->stencil[1].fail_op); - int dfop = i915_translate_stencil_op(depth_stencil->stencil[1].zfail_op); - int dpop = i915_translate_stencil_op(depth_stencil->stencil[1].zpass_op); - int ref = depth_stencil->stencil[1].ref_value & 0xff; - int tmask = depth_stencil->stencil[1].valuemask & 0xff; - int wmask = depth_stencil->stencil[1].writemask & 0xff; - - cso->bfo[0] = (_3DSTATE_BACKFACE_STENCIL_OPS | - BFO_ENABLE_STENCIL_FUNCS | - BFO_ENABLE_STENCIL_TWO_SIDE | - BFO_ENABLE_STENCIL_REF | - BFO_STENCIL_TWO_SIDE | - (ref << BFO_STENCIL_REF_SHIFT) | - (test << BFO_STENCIL_TEST_SHIFT) | - (fop << BFO_STENCIL_FAIL_SHIFT) | - (dfop << BFO_STENCIL_PASS_Z_FAIL_SHIFT) | - (dpop << BFO_STENCIL_PASS_Z_PASS_SHIFT)); - - cso->bfo[1] = (_3DSTATE_BACKFACE_STENCIL_MASKS | - BFM_ENABLE_STENCIL_TEST_MASK | - BFM_ENABLE_STENCIL_WRITE_MASK | - (tmask << BFM_STENCIL_TEST_MASK_SHIFT) | - (wmask << BFM_STENCIL_WRITE_MASK_SHIFT)); - } - else { - /* This actually disables two-side stencil: The bit set is a - * modify-enable bit to indicate we are changing the two-side - * setting. Then there is a symbolic zero to show that we are - * setting the flag to zero/off. - */ - cso->bfo[0] = (_3DSTATE_BACKFACE_STENCIL_OPS | - BFO_ENABLE_STENCIL_TWO_SIDE | - 0); - cso->bfo[1] = 0; - } - - if (depth_stencil->depth.enabled) { - int func = i915_translate_compare_func(depth_stencil->depth.func); - - cso->depth_LIS6 |= (S6_DEPTH_TEST_ENABLE | - (func << S6_DEPTH_TEST_FUNC_SHIFT)); - - if (depth_stencil->depth.writemask) - cso->depth_LIS6 |= S6_DEPTH_WRITE_ENABLE; - } - - if (depth_stencil->alpha.enabled) { - int test = i915_translate_compare_func(depth_stencil->alpha.func); - ubyte refByte = float_to_ubyte(depth_stencil->alpha.ref_value); - - cso->depth_LIS6 |= (S6_ALPHA_TEST_ENABLE | - (test << S6_ALPHA_TEST_FUNC_SHIFT) | - (((unsigned) refByte) << S6_ALPHA_REF_SHIFT)); - } - - return cso; -} - -static void i915_bind_depth_stencil_state(struct pipe_context *pipe, - void *depth_stencil) -{ - struct i915_context *i915 = i915_context(pipe); - draw_flush(i915->draw); - - i915->depth_stencil = (const struct i915_depth_stencil_state *)depth_stencil; - - i915->dirty |= I915_NEW_DEPTH_STENCIL; -} - -static void i915_delete_depth_stencil_state(struct pipe_context *pipe, - void *depth_stencil) -{ - FREE(depth_stencil); -} - - -static void i915_set_scissor_state( struct pipe_context *pipe, - const struct pipe_scissor_state *scissor ) -{ - struct i915_context *i915 = i915_context(pipe); - draw_flush(i915->draw); - - memcpy( &i915->scissor, scissor, sizeof(*scissor) ); - i915->dirty |= I915_NEW_SCISSOR; -} - - -static void i915_set_polygon_stipple( struct pipe_context *pipe, - const struct pipe_poly_stipple *stipple ) -{ -} - - - -static void * -i915_create_fs_state(struct pipe_context *pipe, - const struct pipe_shader_state *templ) -{ - struct i915_context *i915 = i915_context(pipe); - struct i915_fragment_shader *ifs = CALLOC_STRUCT(i915_fragment_shader); - if (!ifs) - return NULL; - - ifs->state.tokens = tgsi_dup_tokens(templ->tokens); - - tgsi_scan_shader(templ->tokens, &ifs->info); - - /* The shader's compiled to i915 instructions here */ - i915_translate_fragment_program(i915, ifs); - - return ifs; -} - -static void -i915_bind_fs_state(struct pipe_context *pipe, void *shader) -{ - struct i915_context *i915 = i915_context(pipe); - draw_flush(i915->draw); - - i915->fs = (struct i915_fragment_shader*) shader; - - i915->dirty |= I915_NEW_FS; -} - -static -void i915_delete_fs_state(struct pipe_context *pipe, void *shader) -{ - struct i915_fragment_shader *ifs = (struct i915_fragment_shader *) shader; - - if (ifs->program) - FREE(ifs->program); - ifs->program_len = 0; - - FREE((struct tgsi_token *)ifs->state.tokens); - - FREE(ifs); -} - - -static void * -i915_create_vs_state(struct pipe_context *pipe, - const struct pipe_shader_state *templ) -{ - struct i915_context *i915 = i915_context(pipe); - - /* just pass-through to draw module */ - return draw_create_vertex_shader(i915->draw, templ); -} - -static void i915_bind_vs_state(struct pipe_context *pipe, void *shader) -{ - struct i915_context *i915 = i915_context(pipe); - - /* just pass-through to draw module */ - draw_bind_vertex_shader(i915->draw, (struct draw_vertex_shader *) shader); - - i915->dirty |= I915_NEW_VS; -} - -static void i915_delete_vs_state(struct pipe_context *pipe, void *shader) -{ - struct i915_context *i915 = i915_context(pipe); - - /* just pass-through to draw module */ - draw_delete_vertex_shader(i915->draw, (struct draw_vertex_shader *) shader); -} - -static void i915_set_constant_buffer(struct pipe_context *pipe, - uint shader, uint index, - const struct pipe_constant_buffer *buf) -{ - struct i915_context *i915 = i915_context(pipe); - struct pipe_screen *screen = pipe->screen; - draw_flush(i915->draw); - - assert(shader < PIPE_SHADER_TYPES); - assert(index == 0); - - /* Make a copy of shader constants. - * During fragment program translation we may add additional - * constants to the array. - * - * We want to consider the situation where some user constants - * (ex: a material color) may change frequently but the shader program - * stays the same. In that case we should only be updating the first - * N constants, leaving any extras from shader translation alone. - */ - if (buf) { - void *mapped; - if (buf->buffer && buf->buffer->size && - (mapped = pipe_buffer_map(screen, buf->buffer, - PIPE_BUFFER_USAGE_CPU_READ))) { - memcpy(i915->current.constants[shader], mapped, buf->buffer->size); - pipe_buffer_unmap(screen, buf->buffer); - i915->current.num_user_constants[shader] - = buf->buffer->size / (4 * sizeof(float)); - } - else { - i915->current.num_user_constants[shader] = 0; - } - } - - i915->dirty |= I915_NEW_CONSTANTS; -} - - -static void i915_set_sampler_textures(struct pipe_context *pipe, - unsigned num, - struct pipe_texture **texture) -{ - struct i915_context *i915 = i915_context(pipe); - uint i; - - assert(num <= PIPE_MAX_SAMPLERS); - - /* Check for no-op */ - if (num == i915->num_textures && - !memcmp(i915->texture, texture, num * sizeof(struct pipe_texture *))) - return; - - /* Fixes wrong texture in texobj with VBUF */ - draw_flush(i915->draw); - - for (i = 0; i < num; i++) - pipe_texture_reference((struct pipe_texture **) &i915->texture[i], - texture[i]); - - for (i = num; i < i915->num_textures; i++) - pipe_texture_reference((struct pipe_texture **) &i915->texture[i], - NULL); - - i915->num_textures = num; - - i915->dirty |= I915_NEW_TEXTURE; -} - - - -static void i915_set_framebuffer_state(struct pipe_context *pipe, - const struct pipe_framebuffer_state *fb) -{ - struct i915_context *i915 = i915_context(pipe); - int i; - - draw_flush(i915->draw); - - i915->framebuffer.width = fb->width; - i915->framebuffer.height = fb->height; - i915->framebuffer.nr_cbufs = fb->nr_cbufs; - for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { - pipe_surface_reference(&i915->framebuffer.cbufs[i], fb->cbufs[i]); - } - pipe_surface_reference(&i915->framebuffer.zsbuf, fb->zsbuf); - - i915->dirty |= I915_NEW_FRAMEBUFFER; -} - - - -static void i915_set_clip_state( struct pipe_context *pipe, - const struct pipe_clip_state *clip ) -{ - struct i915_context *i915 = i915_context(pipe); - draw_flush(i915->draw); - - draw_set_clip_state(i915->draw, clip); - - i915->dirty |= I915_NEW_CLIP; -} - - - -/* Called when driver state tracker notices changes to the viewport - * matrix: - */ -static void i915_set_viewport_state( struct pipe_context *pipe, - const struct pipe_viewport_state *viewport ) -{ - struct i915_context *i915 = i915_context(pipe); - - i915->viewport = *viewport; /* struct copy */ - - /* pass the viewport info to the draw module */ - draw_set_viewport_state(i915->draw, &i915->viewport); - - i915->dirty |= I915_NEW_VIEWPORT; -} - - -static void * -i915_create_rasterizer_state(struct pipe_context *pipe, - const struct pipe_rasterizer_state *rasterizer) -{ - struct i915_rasterizer_state *cso = CALLOC_STRUCT( i915_rasterizer_state ); - - cso->templ = rasterizer; - cso->color_interp = rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR; - cso->light_twoside = rasterizer->light_twoside; - cso->ds[0].u = _3DSTATE_DEPTH_OFFSET_SCALE; - cso->ds[1].f = rasterizer->offset_scale; - if (rasterizer->poly_stipple_enable) { - cso->st |= ST1_ENABLE; - } - - if (rasterizer->scissor) - cso->sc[0] = _3DSTATE_SCISSOR_ENABLE_CMD | ENABLE_SCISSOR_RECT; - else - cso->sc[0] = _3DSTATE_SCISSOR_ENABLE_CMD | DISABLE_SCISSOR_RECT; - - switch (rasterizer->cull_mode) { - case PIPE_WINDING_NONE: - cso->LIS4 |= S4_CULLMODE_NONE; - break; - case PIPE_WINDING_CW: - cso->LIS4 |= S4_CULLMODE_CW; - break; - case PIPE_WINDING_CCW: - cso->LIS4 |= S4_CULLMODE_CCW; - break; - case PIPE_WINDING_BOTH: - cso->LIS4 |= S4_CULLMODE_BOTH; - break; - } - - { - int line_width = CLAMP((int)(rasterizer->line_width * 2), 1, 0xf); - - cso->LIS4 |= line_width << S4_LINE_WIDTH_SHIFT; - - if (rasterizer->line_smooth) - cso->LIS4 |= S4_LINE_ANTIALIAS_ENABLE; - } - - { - int point_size = CLAMP((int) rasterizer->point_size, 1, 0xff); - - cso->LIS4 |= point_size << S4_POINT_WIDTH_SHIFT; - } - - if (rasterizer->flatshade) { - cso->LIS4 |= (S4_FLATSHADE_ALPHA | - S4_FLATSHADE_COLOR | - S4_FLATSHADE_SPECULAR); - } - - cso->LIS7 = fui( rasterizer->offset_units ); - - - return cso; -} - -static void i915_bind_rasterizer_state( struct pipe_context *pipe, - void *raster ) -{ - struct i915_context *i915 = i915_context(pipe); - - i915->rasterizer = (struct i915_rasterizer_state *)raster; - - /* pass-through to draw module */ - draw_set_rasterizer_state(i915->draw, - (i915->rasterizer ? i915->rasterizer->templ : NULL)); - - i915->dirty |= I915_NEW_RASTERIZER; -} - -static void i915_delete_rasterizer_state(struct pipe_context *pipe, - void *raster) -{ - FREE(raster); -} - -static void i915_set_vertex_buffers(struct pipe_context *pipe, - unsigned count, - const struct pipe_vertex_buffer *buffers) -{ - struct i915_context *i915 = i915_context(pipe); - /* Because we change state before the draw_set_vertex_buffers call - * we need a flush here, just to be sure. - */ - draw_flush(i915->draw); - - memcpy(i915->vertex_buffer, buffers, count * sizeof(buffers[0])); - i915->num_vertex_buffers = count; - - /* pass-through to draw module */ - draw_set_vertex_buffers(i915->draw, count, buffers); -} - -static void i915_set_vertex_elements(struct pipe_context *pipe, - unsigned count, - const struct pipe_vertex_element *elements) -{ - struct i915_context *i915 = i915_context(pipe); - /* Because we change state before the draw_set_vertex_buffers call - * we need a flush here, just to be sure. - */ - draw_flush(i915->draw); - - i915->num_vertex_elements = count; - /* pass-through to draw module */ - draw_set_vertex_elements(i915->draw, count, elements); -} - - -static void i915_set_edgeflags(struct pipe_context *pipe, - const unsigned *bitfield) -{ - /* TODO do something here */ -} - -void -i915_init_state_functions( struct i915_context *i915 ) -{ - i915->base.set_edgeflags = i915_set_edgeflags; - i915->base.create_blend_state = i915_create_blend_state; - i915->base.bind_blend_state = i915_bind_blend_state; - i915->base.delete_blend_state = i915_delete_blend_state; - - i915->base.create_sampler_state = i915_create_sampler_state; - i915->base.bind_sampler_states = i915_bind_sampler_states; - i915->base.delete_sampler_state = i915_delete_sampler_state; - - i915->base.create_depth_stencil_alpha_state = i915_create_depth_stencil_state; - i915->base.bind_depth_stencil_alpha_state = i915_bind_depth_stencil_state; - i915->base.delete_depth_stencil_alpha_state = i915_delete_depth_stencil_state; - - i915->base.create_rasterizer_state = i915_create_rasterizer_state; - i915->base.bind_rasterizer_state = i915_bind_rasterizer_state; - i915->base.delete_rasterizer_state = i915_delete_rasterizer_state; - i915->base.create_fs_state = i915_create_fs_state; - i915->base.bind_fs_state = i915_bind_fs_state; - i915->base.delete_fs_state = i915_delete_fs_state; - i915->base.create_vs_state = i915_create_vs_state; - i915->base.bind_vs_state = i915_bind_vs_state; - i915->base.delete_vs_state = i915_delete_vs_state; - - i915->base.set_blend_color = i915_set_blend_color; - i915->base.set_clip_state = i915_set_clip_state; - i915->base.set_constant_buffer = i915_set_constant_buffer; - i915->base.set_framebuffer_state = i915_set_framebuffer_state; - - i915->base.set_polygon_stipple = i915_set_polygon_stipple; - i915->base.set_scissor_state = i915_set_scissor_state; - i915->base.set_sampler_textures = i915_set_sampler_textures; - i915->base.set_viewport_state = i915_set_viewport_state; - i915->base.set_vertex_buffers = i915_set_vertex_buffers; - i915->base.set_vertex_elements = i915_set_vertex_elements; -} diff --git a/src/gallium/drivers/i915simple/i915_state.h b/src/gallium/drivers/i915simple/i915_state.h deleted file mode 100644 index 86c6b0027d..0000000000 --- a/src/gallium/drivers/i915simple/i915_state.h +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * 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: Keith Whitwell - */ - -#ifndef I915_STATE_H -#define I915_STATE_H - -struct i915_context; - - -struct i915_tracked_state { - unsigned dirty; - void (*update)( struct i915_context * ); -}; - -void i915_update_immediate( struct i915_context *i915 ); -void i915_update_dynamic( struct i915_context *i915 ); -void i915_update_derived( struct i915_context *i915 ); -void i915_update_samplers( struct i915_context *i915 ); -void i915_update_textures(struct i915_context *i915); - -void i915_emit_hardware_state( struct i915_context *i915 ); - -#endif diff --git a/src/gallium/drivers/i915simple/i915_state_derived.c b/src/gallium/drivers/i915simple/i915_state_derived.c deleted file mode 100644 index 178d4e8781..0000000000 --- a/src/gallium/drivers/i915simple/i915_state_derived.c +++ /dev/null @@ -1,183 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#include "util/u_memory.h" -#include "pipe/p_shader_tokens.h" -#include "draw/draw_context.h" -#include "draw/draw_vertex.h" -#include "i915_context.h" -#include "i915_state.h" -#include "i915_reg.h" -#include "i915_fpc.h" - - - -/** - * Determine the hardware vertex layout. - * Depends on vertex/fragment shader state. - */ -static void calculate_vertex_layout( struct i915_context *i915 ) -{ - const struct i915_fragment_shader *fs = i915->fs; - const enum interp_mode colorInterp = i915->rasterizer->color_interp; - struct vertex_info vinfo; - boolean texCoords[8], colors[2], fog, needW; - uint i; - int src; - - memset(texCoords, 0, sizeof(texCoords)); - colors[0] = colors[1] = fog = needW = FALSE; - memset(&vinfo, 0, sizeof(vinfo)); - - /* Determine which fragment program inputs are needed. Setup HW vertex - * layout below, in the HW-specific attribute order. - */ - for (i = 0; i < fs->info.num_inputs; i++) { - switch (fs->info.input_semantic_name[i]) { - case TGSI_SEMANTIC_POSITION: - break; - case TGSI_SEMANTIC_COLOR: - assert(fs->info.input_semantic_index[i] < 2); - colors[fs->info.input_semantic_index[i]] = TRUE; - break; - case TGSI_SEMANTIC_GENERIC: - /* usually a texcoord */ - { - const uint unit = fs->info.input_semantic_index[i]; - assert(unit < 8); - texCoords[unit] = TRUE; - needW = TRUE; - } - break; - case TGSI_SEMANTIC_FOG: - fog = TRUE; - break; - default: - assert(0); - } - } - - - /* pos */ - src = draw_find_vs_output(i915->draw, TGSI_SEMANTIC_POSITION, 0); - if (needW) { - draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_LINEAR, src); - vinfo.hwfmt[0] |= S4_VFMT_XYZW; - vinfo.attrib[0].emit = EMIT_4F; - } - else { - draw_emit_vertex_attr(&vinfo, EMIT_3F, INTERP_LINEAR, src); - vinfo.hwfmt[0] |= S4_VFMT_XYZ; - vinfo.attrib[0].emit = EMIT_3F; - } - - /* hardware point size */ - /* XXX todo */ - - /* primary color */ - if (colors[0]) { - src = draw_find_vs_output(i915->draw, TGSI_SEMANTIC_COLOR, 0); - draw_emit_vertex_attr(&vinfo, EMIT_4UB, colorInterp, src); - vinfo.hwfmt[0] |= S4_VFMT_COLOR; - } - - /* secondary color */ - if (colors[1]) { - src = draw_find_vs_output(i915->draw, TGSI_SEMANTIC_COLOR, 1); - draw_emit_vertex_attr(&vinfo, EMIT_4UB, colorInterp, src); - vinfo.hwfmt[0] |= S4_VFMT_SPEC_FOG; - } - - /* fog coord, not fog blend factor */ - if (fog) { - src = draw_find_vs_output(i915->draw, TGSI_SEMANTIC_FOG, 0); - draw_emit_vertex_attr(&vinfo, EMIT_1F, INTERP_PERSPECTIVE, src); - vinfo.hwfmt[0] |= S4_VFMT_FOG_PARAM; - } - - /* texcoords */ - for (i = 0; i < 8; i++) { - uint hwtc; - if (texCoords[i]) { - hwtc = TEXCOORDFMT_4D; - src = draw_find_vs_output(i915->draw, TGSI_SEMANTIC_GENERIC, i); - draw_emit_vertex_attr(&vinfo, EMIT_4F, INTERP_PERSPECTIVE, src); - } - else { - hwtc = TEXCOORDFMT_NOT_PRESENT; - } - vinfo.hwfmt[1] |= hwtc << (i * 4); - } - - draw_compute_vertex_size(&vinfo); - - if (memcmp(&i915->current.vertex_info, &vinfo, sizeof(vinfo))) { - /* Need to set this flag so that the LIS2/4 registers get set. - * It also means the i915_update_immediate() function must be called - * after this one, in i915_update_derived(). - */ - i915->dirty |= I915_NEW_VERTEX_FORMAT; - - memcpy(&i915->current.vertex_info, &vinfo, sizeof(vinfo)); - } -} - - - - -/* Hopefully this will remain quite simple, otherwise need to pull in - * something like the state tracker mechanism. - */ -void i915_update_derived( struct i915_context *i915 ) -{ - if (i915->dirty & (I915_NEW_RASTERIZER | I915_NEW_FS | I915_NEW_VS)) - calculate_vertex_layout( i915 ); - - if (i915->dirty & (I915_NEW_SAMPLER | I915_NEW_TEXTURE)) - i915_update_samplers(i915); - - if (i915->dirty & I915_NEW_TEXTURE) - i915_update_textures(i915); - - if (i915->dirty) - i915_update_immediate( i915 ); - - if (i915->dirty) - i915_update_dynamic( i915 ); - - if (i915->dirty & I915_NEW_FS) { - i915->hardware_dirty |= I915_HW_PROGRAM; /* XXX right? */ - } - - /* HW emit currently references framebuffer state directly: - */ - if (i915->dirty & I915_NEW_FRAMEBUFFER) - i915->hardware_dirty |= I915_HW_STATIC; - - i915->dirty = 0; -} diff --git a/src/gallium/drivers/i915simple/i915_state_dynamic.c b/src/gallium/drivers/i915simple/i915_state_dynamic.c deleted file mode 100644 index 86126a5a15..0000000000 --- a/src/gallium/drivers/i915simple/i915_state_dynamic.c +++ /dev/null @@ -1,310 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include "i915_batch.h" -#include "i915_state_inlines.h" -#include "i915_context.h" -#include "i915_reg.h" -#include "i915_state.h" -#include "util/u_math.h" -#include "util/u_memory.h" -#include "util/u_pack_color.h" - -#define FILE_DEBUG_FLAG DEBUG_STATE - -/* State that we have chosen to store in the DYNAMIC segment of the - * i915 indirect state mechanism. - * - * Can't cache these in the way we do the static state, as there is no - * start/size in the command packet, instead an 'end' value that gets - * incremented. - * - * Additionally, there seems to be a requirement to re-issue the full - * (active) state every time a 4kb boundary is crossed. - */ - -static INLINE void set_dynamic_indirect( struct i915_context *i915, - unsigned offset, - const unsigned *src, - unsigned dwords ) -{ - unsigned i; - - for (i = 0; i < dwords; i++) - i915->current.dynamic[offset + i] = src[i]; - - i915->hardware_dirty |= I915_HW_DYNAMIC; -} - - -/*********************************************************************** - * Modes4: stencil masks and logicop - */ -static void upload_MODES4( struct i915_context *i915 ) -{ - unsigned modes4 = 0; - - /* I915_NEW_STENCIL */ - modes4 |= i915->depth_stencil->stencil_modes4; - /* I915_NEW_BLEND */ - modes4 |= i915->blend->modes4; - - /* Always, so that we know when state is in-active: - */ - set_dynamic_indirect( i915, - I915_DYNAMIC_MODES4, - &modes4, - 1 ); -} - -const struct i915_tracked_state i915_upload_MODES4 = { - I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL, - upload_MODES4 -}; - - - - -/*********************************************************************** - */ - -static void upload_BFO( struct i915_context *i915 ) -{ - set_dynamic_indirect( i915, - I915_DYNAMIC_BFO_0, - &(i915->depth_stencil->bfo[0]), - 2 ); -} - -const struct i915_tracked_state i915_upload_BFO = { - I915_NEW_DEPTH_STENCIL, - upload_BFO -}; - - -/*********************************************************************** - */ - - -static void upload_BLENDCOLOR( struct i915_context *i915 ) -{ - unsigned bc[2]; - - memset( bc, 0, sizeof(bc) ); - - /* I915_NEW_BLEND {_COLOR} - */ - { - const float *color = i915->blend_color.color; - - bc[0] = _3DSTATE_CONST_BLEND_COLOR_CMD; - bc[1] = pack_ui32_float4( color[0], - color[1], - color[2], - color[3] ); - } - - set_dynamic_indirect( i915, - I915_DYNAMIC_BC_0, - bc, - 2 ); -} - -const struct i915_tracked_state i915_upload_BLENDCOLOR = { - I915_NEW_BLEND, - upload_BLENDCOLOR -}; - -/*********************************************************************** - */ - - -static void upload_IAB( struct i915_context *i915 ) -{ - unsigned iab = i915->blend->iab; - - - set_dynamic_indirect( i915, - I915_DYNAMIC_IAB, - &iab, - 1 ); -} - -const struct i915_tracked_state i915_upload_IAB = { - I915_NEW_BLEND, - upload_IAB -}; - - -/*********************************************************************** - */ - - - -static void upload_DEPTHSCALE( struct i915_context *i915 ) -{ - set_dynamic_indirect( i915, - I915_DYNAMIC_DEPTHSCALE_0, - &(i915->rasterizer->ds[0].u), - 2 ); -} - -const struct i915_tracked_state i915_upload_DEPTHSCALE = { - I915_NEW_RASTERIZER, - upload_DEPTHSCALE -}; - - - -/*********************************************************************** - * Polygon stipple - * - * The i915 supports a 4x4 stipple natively, GL wants 32x32. - * Fortunately stipple is usually a repeating pattern. - * - * XXX: does stipple pattern need to be adjusted according to - * the window position? - * - * XXX: possibly need workaround for conform paths test. - */ - -static void upload_STIPPLE( struct i915_context *i915 ) -{ - unsigned st[2]; - - st[0] = _3DSTATE_STIPPLE; - st[1] = 0; - - /* I915_NEW_RASTERIZER - */ - st[1] |= i915->rasterizer->st; - - - /* I915_NEW_STIPPLE - */ - { - const ubyte *mask = (const ubyte *)i915->poly_stipple.stipple; - ubyte p[4]; - - p[0] = mask[12] & 0xf; - p[1] = mask[8] & 0xf; - p[2] = mask[4] & 0xf; - p[3] = mask[0] & 0xf; - - /* Not sure what to do about fallbacks, so for now just dont: - */ - st[1] |= ((p[0] << 0) | - (p[1] << 4) | - (p[2] << 8) | - (p[3] << 12)); - } - - - set_dynamic_indirect( i915, - I915_DYNAMIC_STP_0, - &st[0], - 2 ); -} - - -const struct i915_tracked_state i915_upload_STIPPLE = { - I915_NEW_RASTERIZER | I915_NEW_STIPPLE, - upload_STIPPLE -}; - - - -/*********************************************************************** - * Scissor. - */ -static void upload_SCISSOR_ENABLE( struct i915_context *i915 ) -{ - set_dynamic_indirect( i915, - I915_DYNAMIC_SC_ENA_0, - &(i915->rasterizer->sc[0]), - 1 ); -} - -const struct i915_tracked_state i915_upload_SCISSOR_ENABLE = { - I915_NEW_RASTERIZER, - upload_SCISSOR_ENABLE -}; - - - -static void upload_SCISSOR_RECT( struct i915_context *i915 ) -{ - unsigned x1 = i915->scissor.minx; - unsigned y1 = i915->scissor.miny; - unsigned x2 = i915->scissor.maxx; - unsigned y2 = i915->scissor.maxy; - unsigned sc[3]; - - sc[0] = _3DSTATE_SCISSOR_RECT_0_CMD; - sc[1] = (y1 << 16) | (x1 & 0xffff); - sc[2] = (y2 << 16) | (x2 & 0xffff); - - set_dynamic_indirect( i915, - I915_DYNAMIC_SC_RECT_0, - &sc[0], - 3 ); -} - - -const struct i915_tracked_state i915_upload_SCISSOR_RECT = { - I915_NEW_SCISSOR, - upload_SCISSOR_RECT -}; - - - - - - -static const struct i915_tracked_state *atoms[] = { - &i915_upload_MODES4, - &i915_upload_BFO, - &i915_upload_BLENDCOLOR, - &i915_upload_IAB, - &i915_upload_DEPTHSCALE, - &i915_upload_STIPPLE, - &i915_upload_SCISSOR_ENABLE, - &i915_upload_SCISSOR_RECT -}; - -/* These will be dynamic indirect state commands, but for now just end - * up on the batch buffer with everything else. - */ -void i915_update_dynamic( struct i915_context *i915 ) -{ - int i; - - for (i = 0; i < Elements(atoms); i++) - if (i915->dirty & atoms[i]->dirty) - atoms[i]->update( i915 ); -} - diff --git a/src/gallium/drivers/i915simple/i915_state_emit.c b/src/gallium/drivers/i915simple/i915_state_emit.c deleted file mode 100644 index a3d4e3b04e..0000000000 --- a/src/gallium/drivers/i915simple/i915_state_emit.c +++ /dev/null @@ -1,402 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#include "i915_reg.h" -#include "i915_context.h" -#include "i915_batch.h" -#include "i915_reg.h" - -#include "pipe/p_context.h" -#include "pipe/p_defines.h" - -static unsigned translate_format( enum pipe_format format ) -{ - switch (format) { - case PIPE_FORMAT_A8R8G8B8_UNORM: - return COLOR_BUF_ARGB8888; - case PIPE_FORMAT_R5G6B5_UNORM: - return COLOR_BUF_RGB565; - default: - assert(0); - return 0; - } -} - -static unsigned translate_depth_format( enum pipe_format zformat ) -{ - switch (zformat) { - case PIPE_FORMAT_S8Z24_UNORM: - return DEPTH_FRMT_24_FIXED_8_OTHER; - case PIPE_FORMAT_Z16_UNORM: - return DEPTH_FRMT_16_FIXED; - default: - assert(0); - return 0; - } -} - - -/** - * Examine framebuffer state to determine width, height. - */ -static boolean -framebuffer_size(const struct pipe_framebuffer_state *fb, - uint *width, uint *height) -{ - if (fb->cbufs[0]) { - *width = fb->cbufs[0]->width; - *height = fb->cbufs[0]->height; - return TRUE; - } - else if (fb->zsbuf) { - *width = fb->zsbuf->width; - *height = fb->zsbuf->height; - return TRUE; - } - else { - *width = *height = 0; - return FALSE; - } -} - - -/* Push the state into the sarea and/or texture memory. - */ -void -i915_emit_hardware_state(struct i915_context *i915 ) -{ - /* XXX: there must be an easier way */ - const unsigned dwords = ( 14 + - 7 + - I915_MAX_DYNAMIC + - 8 + - 2 + I915_TEX_UNITS*3 + - 2 + I915_TEX_UNITS*3 + - 2 + I915_MAX_CONSTANT*4 + -#if 0 - i915->current.program_len + -#else - i915->fs->program_len + -#endif - 6 - ) * 3/2; /* plus 50% margin */ - const unsigned relocs = ( I915_TEX_UNITS + - 3 - ) * 3/2; /* plus 50% margin */ - -#if 0 - debug_printf("i915_emit_hardware_state: %d dwords, %d relocs\n", dwords, relocs); -#endif - - if(!BEGIN_BATCH(dwords, relocs)) { - FLUSH_BATCH(NULL); - assert(BEGIN_BATCH(dwords, relocs)); - } - - /* 14 dwords, 0 relocs */ - if (i915->hardware_dirty & I915_HW_INVARIENT) - { - OUT_BATCH(_3DSTATE_AA_CMD | - AA_LINE_ECAAR_WIDTH_ENABLE | - AA_LINE_ECAAR_WIDTH_1_0 | - AA_LINE_REGION_WIDTH_ENABLE | AA_LINE_REGION_WIDTH_1_0); - - OUT_BATCH(_3DSTATE_DFLT_DIFFUSE_CMD); - OUT_BATCH(0); - - OUT_BATCH(_3DSTATE_DFLT_SPEC_CMD); - OUT_BATCH(0); - - OUT_BATCH(_3DSTATE_DFLT_Z_CMD); - OUT_BATCH(0); - - OUT_BATCH(_3DSTATE_COORD_SET_BINDINGS | - CSB_TCB(0, 0) | - CSB_TCB(1, 1) | - CSB_TCB(2, 2) | - CSB_TCB(3, 3) | - CSB_TCB(4, 4) | - CSB_TCB(5, 5) | - CSB_TCB(6, 6) | - CSB_TCB(7, 7)); - - OUT_BATCH(_3DSTATE_RASTER_RULES_CMD | - ENABLE_POINT_RASTER_RULE | - OGL_POINT_RASTER_RULE | - ENABLE_LINE_STRIP_PROVOKE_VRTX | - ENABLE_TRI_FAN_PROVOKE_VRTX | - LINE_STRIP_PROVOKE_VRTX(1) | - TRI_FAN_PROVOKE_VRTX(2) | - ENABLE_TEXKILL_3D_4D | - TEXKILL_4D); - - /* Need to initialize this to zero. - */ - OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | I1_LOAD_S(3) | (0)); - OUT_BATCH(0); - - OUT_BATCH(_3DSTATE_DEPTH_SUBRECT_DISABLE); - - /* disable indirect state for now - */ - OUT_BATCH(_3DSTATE_LOAD_INDIRECT | 0); - OUT_BATCH(0); - } - - /* 7 dwords, 1 relocs */ - if (i915->hardware_dirty & I915_HW_IMMEDIATE) - { - OUT_BATCH(_3DSTATE_LOAD_STATE_IMMEDIATE_1 | - I1_LOAD_S(0) | - I1_LOAD_S(1) | - I1_LOAD_S(2) | - I1_LOAD_S(4) | - I1_LOAD_S(5) | - I1_LOAD_S(6) | - (5)); - - if(i915->vbo) - OUT_RELOC(i915->vbo, - INTEL_USAGE_VERTEX, - i915->current.immediate[I915_IMMEDIATE_S0]); - else - /* FIXME: we should not do this */ - OUT_BATCH(0); - OUT_BATCH(i915->current.immediate[I915_IMMEDIATE_S1]); - OUT_BATCH(i915->current.immediate[I915_IMMEDIATE_S2]); - OUT_BATCH(i915->current.immediate[I915_IMMEDIATE_S4]); - OUT_BATCH(i915->current.immediate[I915_IMMEDIATE_S5]); - OUT_BATCH(i915->current.immediate[I915_IMMEDIATE_S6]); - } - - /* I915_MAX_DYNAMIC dwords, 0 relocs */ - if (i915->hardware_dirty & I915_HW_DYNAMIC) - { - int i; - for (i = 0; i < I915_MAX_DYNAMIC; i++) { - OUT_BATCH(i915->current.dynamic[i]); - } - } - - /* 8 dwords, 2 relocs */ - if (i915->hardware_dirty & I915_HW_STATIC) - { - struct pipe_surface *cbuf_surface = i915->framebuffer.cbufs[0]; - struct pipe_surface *depth_surface = i915->framebuffer.zsbuf; - - if (cbuf_surface) { - unsigned ctile = BUF_3D_USE_FENCE; - struct i915_texture *tex = (struct i915_texture *) - cbuf_surface->texture; - assert(tex); - - if (tex && tex->sw_tiled) { - ctile = BUF_3D_TILED_SURFACE; - } - - OUT_BATCH(_3DSTATE_BUF_INFO_CMD); - - OUT_BATCH(BUF_3D_ID_COLOR_BACK | - BUF_3D_PITCH(tex->stride) | /* pitch in bytes */ - ctile); - - OUT_RELOC(tex->buffer, - INTEL_USAGE_RENDER, - cbuf_surface->offset); - } - - /* What happens if no zbuf?? - */ - if (depth_surface) { - unsigned ztile = BUF_3D_USE_FENCE; - struct i915_texture *tex = (struct i915_texture *) - depth_surface->texture; - assert(tex); - - if (tex && tex->sw_tiled) { - ztile = BUF_3D_TILED_SURFACE; - } - - OUT_BATCH(_3DSTATE_BUF_INFO_CMD); - - OUT_BATCH(BUF_3D_ID_DEPTH | - BUF_3D_PITCH(tex->stride) | /* pitch in bytes */ - ztile); - - OUT_RELOC(tex->buffer, - INTEL_USAGE_RENDER, - depth_surface->offset); - } - - { - unsigned cformat, zformat = 0; - - if (cbuf_surface) - cformat = cbuf_surface->format; - else - cformat = PIPE_FORMAT_A8R8G8B8_UNORM; /* arbitrary */ - cformat = translate_format(cformat); - - if (depth_surface) - zformat = translate_depth_format( i915->framebuffer.zsbuf->format ); - - OUT_BATCH(_3DSTATE_DST_BUF_VARS_CMD); - OUT_BATCH(DSTORG_HORT_BIAS(0x8) | /* .5 */ - DSTORG_VERT_BIAS(0x8) | /* .5 */ - LOD_PRECLAMP_OGL | - TEX_DEFAULT_COLOR_OGL | - cformat | - zformat ); - } - } - -#if 01 - /* texture images */ - /* 2 + I915_TEX_UNITS*3 dwords, I915_TEX_UNITS relocs */ - if (i915->hardware_dirty & (I915_HW_MAP | I915_HW_SAMPLER)) - { - const uint nr = i915->current.sampler_enable_nr; - if (nr) { - const uint enabled = i915->current.sampler_enable_flags; - uint unit; - uint count = 0; - OUT_BATCH(_3DSTATE_MAP_STATE | (3 * nr)); - OUT_BATCH(enabled); - for (unit = 0; unit < I915_TEX_UNITS; unit++) { - if (enabled & (1 << unit)) { - struct intel_buffer *buf = i915->texture[unit]->buffer; - uint offset = 0; - assert(buf); - - count++; - - OUT_RELOC(buf, INTEL_USAGE_SAMPLER, offset); - OUT_BATCH(i915->current.texbuffer[unit][0]); /* MS3 */ - OUT_BATCH(i915->current.texbuffer[unit][1]); /* MS4 */ - } - } - assert(count == nr); - } - } -#endif - -#if 01 - /* samplers */ - /* 2 + I915_TEX_UNITS*3 dwords, 0 relocs */ - if (i915->hardware_dirty & I915_HW_SAMPLER) - { - if (i915->current.sampler_enable_nr) { - int i; - - OUT_BATCH( _3DSTATE_SAMPLER_STATE | - (3 * i915->current.sampler_enable_nr) ); - - OUT_BATCH( i915->current.sampler_enable_flags ); - - for (i = 0; i < I915_TEX_UNITS; i++) { - if (i915->current.sampler_enable_flags & (1<current.sampler[i][0] ); - OUT_BATCH( i915->current.sampler[i][1] ); - OUT_BATCH( i915->current.sampler[i][2] ); - } - } - } - } -#endif - - /* constants */ - /* 2 + I915_MAX_CONSTANT*4 dwords, 0 relocs */ - if (i915->hardware_dirty & I915_HW_PROGRAM) - { - /* Collate the user-defined constants with the fragment shader's - * immediates according to the constant_flags[] array. - */ - const uint nr = i915->fs->num_constants; - if (nr) { - uint i; - - OUT_BATCH( _3DSTATE_PIXEL_SHADER_CONSTANTS | (nr * 4) ); - OUT_BATCH( (1 << (nr - 1)) | ((1 << (nr - 1)) - 1) ); - - for (i = 0; i < nr; i++) { - const uint *c; - if (i915->fs->constant_flags[i] == I915_CONSTFLAG_USER) { - /* grab user-defined constant */ - c = (uint *) i915->current.constants[PIPE_SHADER_FRAGMENT][i]; - } - else { - /* emit program constant */ - c = (uint *) i915->fs->constants[i]; - } -#if 0 /* debug */ - { - float *f = (float *) c; - printf("Const %2d: %f %f %f %f %s\n", i, f[0], f[1], f[2], f[3], - (i915->fs->constant_flags[i] == I915_CONSTFLAG_USER - ? "user" : "immediate")); - } -#endif - OUT_BATCH(*c++); - OUT_BATCH(*c++); - OUT_BATCH(*c++); - OUT_BATCH(*c++); - } - } - } - - /* Fragment program */ - /* i915->current.program_len dwords, 0 relocs */ - if (i915->hardware_dirty & I915_HW_PROGRAM) - { - uint i; - /* we should always have, at least, a pass-through program */ - assert(i915->fs->program_len > 0); - for (i = 0; i < i915->fs->program_len; i++) { - OUT_BATCH(i915->fs->program[i]); - } - } - - /* drawing surface size */ - /* 6 dwords, 0 relocs */ - { - uint w, h; - boolean k = framebuffer_size(&i915->framebuffer, &w, &h); - (void)k; - assert(k); - - OUT_BATCH(_3DSTATE_DRAW_RECT_CMD); - OUT_BATCH(0); - OUT_BATCH(0); - OUT_BATCH(((w - 1) & 0xffff) | ((h - 1) << 16)); - OUT_BATCH(0); - OUT_BATCH(0); - } - - - i915->hardware_dirty = 0; -} diff --git a/src/gallium/drivers/i915simple/i915_state_immediate.c b/src/gallium/drivers/i915simple/i915_state_immediate.c deleted file mode 100644 index 8c16bb4e27..0000000000 --- a/src/gallium/drivers/i915simple/i915_state_immediate.c +++ /dev/null @@ -1,225 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * 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: - * Keith Whitwell - */ - -#include "i915_state_inlines.h" -#include "i915_context.h" -#include "i915_state.h" -#include "i915_reg.h" -#include "util/u_memory.h" - - -/* All state expressable with the LOAD_STATE_IMMEDIATE_1 packet. - * Would like to opportunistically recombine all these fragments into - * a single packet containing only what has changed, but for now emit - * as multiple packets. - */ - - - - -/*********************************************************************** - * S0,S1: Vertex buffer state. - */ -static void upload_S0S1(struct i915_context *i915) -{ - unsigned LIS0, LIS1; - - /* INTEL_NEW_VBO */ - /* TODO: re-use vertex buffers here? */ - LIS0 = i915->vbo_offset; - - /* INTEL_NEW_VERTEX_SIZE -- do this where the vertex size is calculated! - */ - { - unsigned vertex_size = i915->current.vertex_info.size; - - LIS1 = ((vertex_size << 24) | - (vertex_size << 16)); - } - - /* INTEL_NEW_VBO */ - /* TODO: use a vertex generation number to track vbo changes */ - if (1 || - i915->current.immediate[I915_IMMEDIATE_S0] != LIS0 || - i915->current.immediate[I915_IMMEDIATE_S1] != LIS1) - { - i915->current.immediate[I915_IMMEDIATE_S0] = LIS0; - i915->current.immediate[I915_IMMEDIATE_S1] = LIS1; - i915->hardware_dirty |= I915_HW_IMMEDIATE; - } -} - -const struct i915_tracked_state i915_upload_S0S1 = { - I915_NEW_VBO | I915_NEW_VERTEX_FORMAT, - upload_S0S1 -}; - - - - -/*********************************************************************** - * S4: Vertex format, rasterization state - */ -static void upload_S2S4(struct i915_context *i915) -{ - unsigned LIS2, LIS4; - - /* I915_NEW_VERTEX_FORMAT */ - { - LIS2 = i915->current.vertex_info.hwfmt[1]; - LIS4 = i915->current.vertex_info.hwfmt[0]; - /* - debug_printf("LIS2: 0x%x LIS4: 0x%x\n", LIS2, LIS4); - */ - assert(LIS4); /* should never be zero? */ - } - - LIS4 |= i915->rasterizer->LIS4; - - if (LIS2 != i915->current.immediate[I915_IMMEDIATE_S2] || - LIS4 != i915->current.immediate[I915_IMMEDIATE_S4]) { - - i915->current.immediate[I915_IMMEDIATE_S2] = LIS2; - i915->current.immediate[I915_IMMEDIATE_S4] = LIS4; - i915->hardware_dirty |= I915_HW_IMMEDIATE; - } -} - - -const struct i915_tracked_state i915_upload_S2S4 = { - I915_NEW_RASTERIZER | I915_NEW_VERTEX_FORMAT, - upload_S2S4 -}; - - - -/*********************************************************************** - * - */ -static void upload_S5( struct i915_context *i915 ) -{ - unsigned LIS5 = 0; - - LIS5 |= i915->depth_stencil->stencil_LIS5; - - LIS5 |= i915->blend->LIS5; - -#if 0 - /* I915_NEW_RASTERIZER */ - if (i915->state.Polygon->OffsetFill) { - LIS5 |= S5_GLOBAL_DEPTH_OFFSET_ENABLE; - } -#endif - - - if (LIS5 != i915->current.immediate[I915_IMMEDIATE_S5]) { - i915->current.immediate[I915_IMMEDIATE_S5] = LIS5; - i915->hardware_dirty |= I915_HW_IMMEDIATE; - } -} - -const struct i915_tracked_state i915_upload_S5 = { - (I915_NEW_DEPTH_STENCIL | I915_NEW_BLEND | I915_NEW_RASTERIZER), - upload_S5 -}; - - -/*********************************************************************** - */ -static void upload_S6( struct i915_context *i915 ) -{ - unsigned LIS6 = (2 << S6_TRISTRIP_PV_SHIFT); - - /* I915_NEW_FRAMEBUFFER - */ - if (i915->framebuffer.cbufs[0]) - LIS6 |= S6_COLOR_WRITE_ENABLE; - - /* I915_NEW_BLEND - */ - LIS6 |= i915->blend->LIS6; - - /* I915_NEW_DEPTH - */ - LIS6 |= i915->depth_stencil->depth_LIS6; - - if (LIS6 != i915->current.immediate[I915_IMMEDIATE_S6]) { - i915->current.immediate[I915_IMMEDIATE_S6] = LIS6; - i915->hardware_dirty |= I915_HW_IMMEDIATE; - } -} - -const struct i915_tracked_state i915_upload_S6 = { - I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL | I915_NEW_FRAMEBUFFER, - upload_S6 -}; - - -/*********************************************************************** - */ -static void upload_S7( struct i915_context *i915 ) -{ - unsigned LIS7; - - /* I915_NEW_RASTERIZER - */ - LIS7 = i915->rasterizer->LIS7; - - if (LIS7 != i915->current.immediate[I915_IMMEDIATE_S7]) { - i915->current.immediate[I915_IMMEDIATE_S7] = LIS7; - i915->hardware_dirty |= I915_HW_IMMEDIATE; - } -} - -const struct i915_tracked_state i915_upload_S7 = { - I915_NEW_RASTERIZER, - upload_S7 -}; - - -static const struct i915_tracked_state *atoms[] = { - &i915_upload_S0S1, - &i915_upload_S2S4, - &i915_upload_S5, - &i915_upload_S6, - &i915_upload_S7 -}; - -/* - */ -void i915_update_immediate( struct i915_context *i915 ) -{ - int i; - - for (i = 0; i < Elements(atoms); i++) - if (i915->dirty & atoms[i]->dirty) - atoms[i]->update( i915 ); -} diff --git a/src/gallium/drivers/i915simple/i915_state_inlines.h b/src/gallium/drivers/i915simple/i915_state_inlines.h deleted file mode 100644 index 378de8f9c4..0000000000 --- a/src/gallium/drivers/i915simple/i915_state_inlines.h +++ /dev/null @@ -1,230 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef I915_STATE_INLINES_H -#define I915_STATE_INLINES_H - -#include "pipe/p_compiler.h" -#include "pipe/p_defines.h" -#include "i915_reg.h" - - -static INLINE unsigned -i915_translate_compare_func(unsigned func) -{ - switch (func) { - case PIPE_FUNC_NEVER: - return COMPAREFUNC_NEVER; - case PIPE_FUNC_LESS: - return COMPAREFUNC_LESS; - case PIPE_FUNC_LEQUAL: - return COMPAREFUNC_LEQUAL; - case PIPE_FUNC_GREATER: - return COMPAREFUNC_GREATER; - case PIPE_FUNC_GEQUAL: - return COMPAREFUNC_GEQUAL; - case PIPE_FUNC_NOTEQUAL: - return COMPAREFUNC_NOTEQUAL; - case PIPE_FUNC_EQUAL: - return COMPAREFUNC_EQUAL; - case PIPE_FUNC_ALWAYS: - return COMPAREFUNC_ALWAYS; - default: - return COMPAREFUNC_ALWAYS; - } -} - -static INLINE unsigned -i915_translate_stencil_op(unsigned op) -{ - switch (op) { - case PIPE_STENCIL_OP_KEEP: - return STENCILOP_KEEP; - case PIPE_STENCIL_OP_ZERO: - return STENCILOP_ZERO; - case PIPE_STENCIL_OP_REPLACE: - return STENCILOP_REPLACE; - case PIPE_STENCIL_OP_INCR: - return STENCILOP_INCRSAT; - case PIPE_STENCIL_OP_DECR: - return STENCILOP_DECRSAT; - case PIPE_STENCIL_OP_INCR_WRAP: - return STENCILOP_INCR; - case PIPE_STENCIL_OP_DECR_WRAP: - return STENCILOP_DECR; - case PIPE_STENCIL_OP_INVERT: - return STENCILOP_INVERT; - default: - return STENCILOP_ZERO; - } -} - -static INLINE unsigned -i915_translate_blend_factor(unsigned factor) -{ - switch (factor) { - case PIPE_BLENDFACTOR_ZERO: - return BLENDFACT_ZERO; - case PIPE_BLENDFACTOR_SRC_ALPHA: - return BLENDFACT_SRC_ALPHA; - case PIPE_BLENDFACTOR_ONE: - return BLENDFACT_ONE; - case PIPE_BLENDFACTOR_SRC_COLOR: - return BLENDFACT_SRC_COLR; - case PIPE_BLENDFACTOR_INV_SRC_COLOR: - return BLENDFACT_INV_SRC_COLR; - case PIPE_BLENDFACTOR_DST_COLOR: - return BLENDFACT_DST_COLR; - case PIPE_BLENDFACTOR_INV_DST_COLOR: - return BLENDFACT_INV_DST_COLR; - case PIPE_BLENDFACTOR_INV_SRC_ALPHA: - return BLENDFACT_INV_SRC_ALPHA; - case PIPE_BLENDFACTOR_DST_ALPHA: - return BLENDFACT_DST_ALPHA; - case PIPE_BLENDFACTOR_INV_DST_ALPHA: - return BLENDFACT_INV_DST_ALPHA; - case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: - return BLENDFACT_SRC_ALPHA_SATURATE; - case PIPE_BLENDFACTOR_CONST_COLOR: - return BLENDFACT_CONST_COLOR; - case PIPE_BLENDFACTOR_INV_CONST_COLOR: - return BLENDFACT_INV_CONST_COLOR; - case PIPE_BLENDFACTOR_CONST_ALPHA: - return BLENDFACT_CONST_ALPHA; - case PIPE_BLENDFACTOR_INV_CONST_ALPHA: - return BLENDFACT_INV_CONST_ALPHA; - default: - return BLENDFACT_ZERO; - } -} - -static INLINE unsigned -i915_translate_blend_func(unsigned mode) -{ - switch (mode) { - case PIPE_BLEND_ADD: - return BLENDFUNC_ADD; - case PIPE_BLEND_MIN: - return BLENDFUNC_MIN; - case PIPE_BLEND_MAX: - return BLENDFUNC_MAX; - case PIPE_BLEND_SUBTRACT: - return BLENDFUNC_SUBTRACT; - case PIPE_BLEND_REVERSE_SUBTRACT: - return BLENDFUNC_REVERSE_SUBTRACT; - default: - return 0; - } -} - - -static INLINE unsigned -i915_translate_logic_op(unsigned opcode) -{ - switch (opcode) { - case PIPE_LOGICOP_CLEAR: - return LOGICOP_CLEAR; - case PIPE_LOGICOP_AND: - return LOGICOP_AND; - case PIPE_LOGICOP_AND_REVERSE: - return LOGICOP_AND_RVRSE; - case PIPE_LOGICOP_COPY: - return LOGICOP_COPY; - case PIPE_LOGICOP_COPY_INVERTED: - return LOGICOP_COPY_INV; - case PIPE_LOGICOP_AND_INVERTED: - return LOGICOP_AND_INV; - case PIPE_LOGICOP_NOOP: - return LOGICOP_NOOP; - case PIPE_LOGICOP_XOR: - return LOGICOP_XOR; - case PIPE_LOGICOP_OR: - return LOGICOP_OR; - case PIPE_LOGICOP_OR_INVERTED: - return LOGICOP_OR_INV; - case PIPE_LOGICOP_NOR: - return LOGICOP_NOR; - case PIPE_LOGICOP_EQUIV: - return LOGICOP_EQUIV; - case PIPE_LOGICOP_INVERT: - return LOGICOP_INV; - case PIPE_LOGICOP_OR_REVERSE: - return LOGICOP_OR_RVRSE; - case PIPE_LOGICOP_NAND: - return LOGICOP_NAND; - case PIPE_LOGICOP_SET: - return LOGICOP_SET; - default: - return LOGICOP_SET; - } -} - - - -static INLINE boolean i915_validate_vertices( unsigned hw_prim, unsigned nr ) -{ - boolean ok; - - switch (hw_prim) { - case PRIM3D_POINTLIST: - ok = (nr >= 1); - assert(ok); - break; - case PRIM3D_LINELIST: - ok = (nr >= 2) && (nr % 2) == 0; - assert(ok); - break; - case PRIM3D_LINESTRIP: - ok = (nr >= 2); - assert(ok); - break; - case PRIM3D_TRILIST: - ok = (nr >= 3) && (nr % 3) == 0; - assert(ok); - break; - case PRIM3D_TRISTRIP: - ok = (nr >= 3); - assert(ok); - break; - case PRIM3D_TRIFAN: - ok = (nr >= 3); - assert(ok); - break; - case PRIM3D_POLY: - ok = (nr >= 3); - assert(ok); - break; - default: - assert(0); - ok = 0; - break; - } - - return ok; -} - -#endif diff --git a/src/gallium/drivers/i915simple/i915_state_sampler.c b/src/gallium/drivers/i915simple/i915_state_sampler.c deleted file mode 100644 index c5e9084d12..0000000000 --- a/src/gallium/drivers/i915simple/i915_state_sampler.c +++ /dev/null @@ -1,299 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include "pipe/p_context.h" -#include "pipe/p_state.h" -#include "util/u_memory.h" - -#include "i915_state_inlines.h" -#include "i915_context.h" -#include "i915_reg.h" -#include "i915_state.h" - - -/* - * A note about min_lod & max_lod. - * - * There is a circular dependancy between the sampler state - * and the map state to be submitted to hw. - * - * Two condition must be meet: - * min_lod =< max_lod == true - * max_lod =< last_level == true - * - * - * This is all fine and dandy if it where for the fact that max_lod - * is set on the map state instead of the sampler state. That is - * the max_lod we submit on map is: - * max_lod = MIN2(last_level, max_lod); - * - * So we need to update the map state when we change samplers and - * we need to be change the sampler state when map state is changed. - * The first part is done by calling i915_update_texture in - * i915_update_samplers and the second part is done else where in - * code tracking the state changes. - */ - -static void -i915_update_texture(struct i915_context *i915, - uint unit, - const struct i915_texture *tex, - const struct i915_sampler_state *sampler, - uint state[6]); -/** - * Compute i915 texture sampling state. - * - * Recalculate all state from scratch. Perhaps not the most - * efficient, but this has gotten complex enough that we need - * something which is understandable and reliable. - * \param state returns the 3 words of compute state - */ -static void update_sampler(struct i915_context *i915, - uint unit, - const struct i915_sampler_state *sampler, - const struct i915_texture *tex, - unsigned state[3] ) -{ - const struct pipe_texture *pt = &tex->base; - unsigned minlod, lastlod; - - /* Need to do this after updating the maps, which call the - * intel_finalize_mipmap_tree and hence can update firstLevel: - */ - state[0] = sampler->state[0]; - state[1] = sampler->state[1]; - state[2] = sampler->state[2]; - - if (pt->format == PIPE_FORMAT_YCBCR || - pt->format == PIPE_FORMAT_YCBCR_REV) - state[0] |= SS2_COLORSPACE_CONVERSION; - - /* 3D textures don't seem to respect the border color. - * Fallback if there's ever a danger that they might refer to - * it. - * - * Effectively this means fallback on 3D clamp or - * clamp_to_border. - * - * XXX: Check if this is true on i945. - * XXX: Check if this bug got fixed in release silicon. - */ -#if 0 - { - const unsigned ws = sampler->templ->wrap_s; - const unsigned wt = sampler->templ->wrap_t; - const unsigned wr = sampler->templ->wrap_r; - if (pt->target == PIPE_TEXTURE_3D && - (sampler->templ->min_img_filter != PIPE_TEX_FILTER_NEAREST || - sampler->templ->mag_img_filter != PIPE_TEX_FILTER_NEAREST) && - (ws == PIPE_TEX_WRAP_CLAMP || - wt == PIPE_TEX_WRAP_CLAMP || - wr == PIPE_TEX_WRAP_CLAMP || - ws == PIPE_TEX_WRAP_CLAMP_TO_BORDER || - wt == PIPE_TEX_WRAP_CLAMP_TO_BORDER || - wr == PIPE_TEX_WRAP_CLAMP_TO_BORDER)) { - if (i915->conformance_mode > 0) { - assert(0); - /* sampler->fallback = true; */ - /* TODO */ - } - } - } -#endif - - /* See note at the top of file */ - minlod = sampler->minlod; - lastlod = pt->last_level << 4; - - if (lastlod < minlod) { - minlod = lastlod; - } - - state[1] |= (sampler->minlod << SS3_MIN_LOD_SHIFT); - state[1] |= (unit << SS3_TEXTUREMAP_INDEX_SHIFT); -} - - -void i915_update_samplers( struct i915_context *i915 ) -{ - uint unit; - - i915->current.sampler_enable_nr = 0; - i915->current.sampler_enable_flags = 0x0; - - for (unit = 0; unit < i915->num_textures && unit < i915->num_samplers; - unit++) { - /* determine unit enable/disable by looking for a bound texture */ - /* could also examine the fragment program? */ - if (i915->texture[unit]) { - update_sampler( i915, - unit, - i915->sampler[unit], /* sampler state */ - i915->texture[unit], /* texture */ - i915->current.sampler[unit] /* the result */ - ); - i915_update_texture( i915, - unit, - i915->texture[unit], /* texture */ - i915->sampler[unit], /* sampler state */ - i915->current.texbuffer[unit] ); - - i915->current.sampler_enable_nr++; - i915->current.sampler_enable_flags |= (1 << unit); - } - } - - i915->hardware_dirty |= I915_HW_SAMPLER | I915_HW_MAP; -} - - -static uint -translate_texture_format(enum pipe_format pipeFormat) -{ - switch (pipeFormat) { - case PIPE_FORMAT_L8_UNORM: - return MAPSURF_8BIT | MT_8BIT_L8; - case PIPE_FORMAT_I8_UNORM: - return MAPSURF_8BIT | MT_8BIT_I8; - case PIPE_FORMAT_A8_UNORM: - return MAPSURF_8BIT | MT_8BIT_A8; - case PIPE_FORMAT_A8L8_UNORM: - return MAPSURF_16BIT | MT_16BIT_AY88; - case PIPE_FORMAT_R5G6B5_UNORM: - return MAPSURF_16BIT | MT_16BIT_RGB565; - case PIPE_FORMAT_A1R5G5B5_UNORM: - return MAPSURF_16BIT | MT_16BIT_ARGB1555; - case PIPE_FORMAT_A4R4G4B4_UNORM: - return MAPSURF_16BIT | MT_16BIT_ARGB4444; - case PIPE_FORMAT_A8R8G8B8_UNORM: - return MAPSURF_32BIT | MT_32BIT_ARGB8888; - case PIPE_FORMAT_YCBCR_REV: - return (MAPSURF_422 | MT_422_YCRCB_NORMAL); - case PIPE_FORMAT_YCBCR: - return (MAPSURF_422 | MT_422_YCRCB_SWAPY); -#if 0 - case PIPE_FORMAT_RGB_FXT1: - case PIPE_FORMAT_RGBA_FXT1: - return (MAPSURF_COMPRESSED | MT_COMPRESS_FXT1); -#endif - case PIPE_FORMAT_Z16_UNORM: - return (MAPSURF_16BIT | MT_16BIT_L16); -#if 0 - case PIPE_FORMAT_RGBA_DXT1: - case PIPE_FORMAT_RGB_DXT1: - return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT1); - case PIPE_FORMAT_RGBA_DXT3: - return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3); - case PIPE_FORMAT_RGBA_DXT5: - return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5); -#endif - case PIPE_FORMAT_S8Z24_UNORM: - return (MAPSURF_32BIT | MT_32BIT_xI824); - default: - debug_printf("i915: translate_texture_format() bad image format %x\n", - pipeFormat); - assert(0); - return 0; - } -} - - -static void -i915_update_texture(struct i915_context *i915, - uint unit, - const struct i915_texture *tex, - const struct i915_sampler_state *sampler, - uint state[6]) -{ - const struct pipe_texture *pt = &tex->base; - uint format, pitch; - const uint width = pt->width[0], height = pt->height[0], depth = pt->depth[0]; - const uint num_levels = pt->last_level; - unsigned max_lod = num_levels * 4; - unsigned tiled = MS3_USE_FENCE_REGS; - - assert(tex); - assert(width); - assert(height); - assert(depth); - - format = translate_texture_format(pt->format); - pitch = tex->stride; - - assert(format); - assert(pitch); - - if (tex->sw_tiled) { - assert(!((pitch - 1) & pitch)); - tiled = MS3_TILED_SURFACE; - } - - /* MS3 state */ - state[0] = - (((height - 1) << MS3_HEIGHT_SHIFT) - | ((width - 1) << MS3_WIDTH_SHIFT) - | format - | tiled); - - /* - * XXX When min_filter != mag_filter and there's just one mipmap level, - * set max_lod = 1 to make sure i915 chooses between min/mag filtering. - */ - - /* See note at the top of file */ - if (max_lod > (sampler->maxlod >> 2)) - max_lod = sampler->maxlod >> 2; - - /* MS4 state */ - state[1] = - ((((pitch / 4) - 1) << MS4_PITCH_SHIFT) - | MS4_CUBE_FACE_ENA_MASK - | ((max_lod) << MS4_MAX_LOD_SHIFT) - | ((depth - 1) << MS4_VOLUME_DEPTH_SHIFT)); -} - - -void -i915_update_textures(struct i915_context *i915) -{ - uint unit; - - for (unit = 0; unit < i915->num_textures && unit < i915->num_samplers; - unit++) { - /* determine unit enable/disable by looking for a bound texture */ - /* could also examine the fragment program? */ - if (i915->texture[unit]) { - i915_update_texture( i915, - unit, - i915->texture[unit], /* texture */ - i915->sampler[unit], /* sampler state */ - i915->current.texbuffer[unit] ); - } - } - - i915->hardware_dirty |= I915_HW_MAP; -} diff --git a/src/gallium/drivers/i915simple/i915_surface.c b/src/gallium/drivers/i915simple/i915_surface.c deleted file mode 100644 index ab8331f3e6..0000000000 --- a/src/gallium/drivers/i915simple/i915_surface.c +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************************** - * - * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#include "i915_context.h" -#include "i915_blit.h" -#include "i915_state.h" -#include "pipe/p_defines.h" -#include "pipe/p_inlines.h" -#include "pipe/p_inlines.h" -#include "pipe/internal/p_winsys_screen.h" -#include "util/u_tile.h" -#include "util/u_rect.h" - - -/* Assumes all values are within bounds -- no checking at this level - - * do it higher up if required. - */ -static void -i915_surface_copy(struct pipe_context *pipe, - struct pipe_surface *dst, - unsigned dstx, unsigned dsty, - struct pipe_surface *src, - unsigned srcx, unsigned srcy, unsigned width, unsigned height) -{ - struct i915_texture *dst_tex = (struct i915_texture *)dst->texture; - struct i915_texture *src_tex = (struct i915_texture *)src->texture; - - assert( dst != src ); - assert( dst_tex->base.block.size == src_tex->base.block.size ); - assert( dst_tex->base.block.width == src_tex->base.block.height ); - assert( dst_tex->base.block.height == src_tex->base.block.height ); - assert( dst_tex->base.block.width == 1 ); - assert( dst_tex->base.block.height == 1 ); - - i915_copy_blit( i915_context(pipe), - FALSE, - dst_tex->base.block.size, - (unsigned short) src_tex->stride, src_tex->buffer, src->offset, - (unsigned short) dst_tex->stride, dst_tex->buffer, dst->offset, - (short) srcx, (short) srcy, (short) dstx, (short) dsty, (short) width, (short) height ); -} - - -static void -i915_surface_fill(struct pipe_context *pipe, - struct pipe_surface *dst, - unsigned dstx, unsigned dsty, - unsigned width, unsigned height, unsigned value) -{ - struct i915_texture *tex = (struct i915_texture *)dst->texture; - - assert(tex->base.block.width == 1); - assert(tex->base.block.height == 1); - - i915_fill_blit( i915_context(pipe), - tex->base.block.size, - (unsigned short) tex->stride, - tex->buffer, dst->offset, - (short) dstx, (short) dsty, - (short) width, (short) height, - value ); -} - - -void -i915_init_surface_functions(struct i915_context *i915) -{ - i915->base.surface_copy = i915_surface_copy; - i915->base.surface_fill = i915_surface_fill; -} diff --git a/src/gallium/drivers/i915simple/i915_texture.c b/src/gallium/drivers/i915simple/i915_texture.c deleted file mode 100644 index 286c9ace8e..0000000000 --- a/src/gallium/drivers/i915simple/i915_texture.c +++ /dev/null @@ -1,958 +0,0 @@ -/************************************************************************** - * - * Copyright 2006 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. - * - **************************************************************************/ - /* - * Authors: - * Keith Whitwell - * Michel Dänzer - */ - -#include "pipe/p_state.h" -#include "pipe/p_context.h" -#include "pipe/p_defines.h" -#include "pipe/p_inlines.h" -#include "pipe/internal/p_winsys_screen.h" -#include "util/u_math.h" -#include "util/u_memory.h" - -#include "i915_context.h" -#include "i915_texture.h" -#include "i915_debug.h" -#include "i915_screen.h" -#include "intel_winsys.h" - - -/* - * Helper function and arrays - */ - - -/** - * Initial offset for Cube map. - */ -static const int initial_offsets[6][2] = { - {0, 0}, - {0, 2}, - {1, 0}, - {1, 2}, - {1, 1}, - {1, 3} -}; - -/** - * Step offsets for Cube map. - */ -static const int step_offsets[6][2] = { - {0, 2}, - {0, 2}, - {-1, 2}, - {-1, 2}, - {-1, 1}, - {-1, 1} -}; - -static unsigned -power_of_two(unsigned x) -{ - unsigned value = 1; - while (value < x) - value = value << 1; - return value; -} - -static unsigned -round_up(unsigned n, unsigned multiple) -{ - return (n + multiple - 1) & ~(multiple - 1); -} - - -/* - * More advanced helper funcs - */ - - -static void -i915_miptree_set_level_info(struct i915_texture *tex, - unsigned level, - unsigned nr_images, - unsigned w, unsigned h, unsigned d) -{ - struct pipe_texture *pt = &tex->base; - - assert(level < PIPE_MAX_TEXTURE_LEVELS); - - pt->width[level] = w; - pt->height[level] = h; - pt->depth[level] = d; - - pt->nblocksx[level] = pf_get_nblocksx(&pt->block, w); - pt->nblocksy[level] = pf_get_nblocksy(&pt->block, h); - - tex->nr_images[level] = nr_images; - - /* - DBG("%s level %d size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__, - level, w, h, d, x, y, tex->level_offset[level]); - */ - - /* Not sure when this would happen, but anyway: - */ - if (tex->image_offset[level]) { - FREE(tex->image_offset[level]); - tex->image_offset[level] = NULL; - } - - assert(nr_images); - assert(!tex->image_offset[level]); - - tex->image_offset[level] = (unsigned *) MALLOC(nr_images * sizeof(unsigned)); - tex->image_offset[level][0] = 0; -} - -static void -i915_miptree_set_image_offset(struct i915_texture *tex, - unsigned level, unsigned img, unsigned x, unsigned y) -{ - if (img == 0 && level == 0) - assert(x == 0 && y == 0); - - assert(img < tex->nr_images[level]); - - tex->image_offset[level][img] = y * tex->stride + x * tex->base.block.size; - - /* - printf("%s level %d img %d pos %d,%d image_offset %x\n", - __FUNCTION__, level, img, x, y, tex->image_offset[level][img]); - */ -} - - -/* - * i915 layout functions, some used by i945 - */ - - -/** - * Special case to deal with scanout textures. - */ -static boolean -i915_scanout_layout(struct i915_texture *tex) -{ - struct pipe_texture *pt = &tex->base; - - if (pt->last_level > 0 || pt->block.size != 4) - return FALSE; - - i915_miptree_set_level_info(tex, 0, 1, - tex->base.width[0], - tex->base.height[0], - 1); - i915_miptree_set_image_offset(tex, 0, 0, 0, 0); - - if (tex->base.width[0] >= 240) { - tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size); - tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8); - tex->hw_tiled = INTEL_TILE_X; - } else if (tex->base.width[0] == 64 && tex->base.height[0] == 64) { - tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size); - tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8); - } else { - return FALSE; - } - - debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__, - tex->base.width[0], tex->base.height[0], pt->block.size, - tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy); - - return TRUE; -} - -/** - * Special case to deal with shared textures. - */ -static boolean -i915_display_target_layout(struct i915_texture *tex) -{ - struct pipe_texture *pt = &tex->base; - - if (pt->last_level > 0 || pt->block.size != 4) - return FALSE; - - /* fallback to normal textures for small textures */ - if (tex->base.width[0] < 240) - return FALSE; - - i915_miptree_set_level_info(tex, 0, 1, - tex->base.width[0], - tex->base.height[0], - 1); - i915_miptree_set_image_offset(tex, 0, 0, 0, 0); - - tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size); - tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8); - tex->hw_tiled = INTEL_TILE_X; - - debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__, - tex->base.width[0], tex->base.height[0], pt->block.size, - tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy); - - return TRUE; -} - -static void -i915_miptree_layout_2d(struct i915_texture *tex) -{ - struct pipe_texture *pt = &tex->base; - unsigned level; - unsigned width = pt->width[0]; - unsigned height = pt->height[0]; - unsigned nblocksx = pt->nblocksx[0]; - unsigned nblocksy = pt->nblocksy[0]; - - /* used for scanouts that need special layouts */ - if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_PRIMARY) - if (i915_scanout_layout(tex)) - return; - - /* for shared buffers we use some very like scanout */ - if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET) - if (i915_display_target_layout(tex)) - return; - - tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4); - tex->total_nblocksy = 0; - - for (level = 0; level <= pt->last_level; level++) { - i915_miptree_set_level_info(tex, level, 1, width, height, 1); - i915_miptree_set_image_offset(tex, level, 0, 0, tex->total_nblocksy); - - nblocksy = round_up(MAX2(2, nblocksy), 2); - - tex->total_nblocksy += nblocksy; - - width = minify(width); - height = minify(height); - nblocksx = pf_get_nblocksx(&pt->block, width); - nblocksy = pf_get_nblocksy(&pt->block, height); - } -} - -static void -i915_miptree_layout_3d(struct i915_texture *tex) -{ - struct pipe_texture *pt = &tex->base; - unsigned level; - - unsigned width = pt->width[0]; - unsigned height = pt->height[0]; - unsigned depth = pt->depth[0]; - unsigned nblocksx = pt->nblocksx[0]; - unsigned nblocksy = pt->nblocksy[0]; - unsigned stack_nblocksy = 0; - - /* Calculate the size of a single slice. - */ - tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4); - - /* XXX: hardware expects/requires 9 levels at minimum. - */ - for (level = 0; level <= MAX2(8, pt->last_level); level++) { - i915_miptree_set_level_info(tex, level, depth, width, height, depth); - - stack_nblocksy += MAX2(2, nblocksy); - - width = minify(width); - height = minify(height); - depth = minify(depth); - nblocksx = pf_get_nblocksx(&pt->block, width); - nblocksy = pf_get_nblocksy(&pt->block, height); - } - - /* Fixup depth image_offsets: - */ - depth = pt->depth[0]; - for (level = 0; level <= pt->last_level; level++) { - unsigned i; - for (i = 0; i < depth; i++) - i915_miptree_set_image_offset(tex, level, i, 0, i * stack_nblocksy); - - depth = minify(depth); - } - - /* Multiply slice size by texture depth for total size. It's - * remarkable how wasteful of memory the i915 texture layouts - * are. They are largely fixed in the i945. - */ - tex->total_nblocksy = stack_nblocksy * pt->depth[0]; -} - -static void -i915_miptree_layout_cube(struct i915_texture *tex) -{ - struct pipe_texture *pt = &tex->base; - unsigned width = pt->width[0], height = pt->height[0]; - const unsigned nblocks = pt->nblocksx[0]; - unsigned level; - unsigned face; - - assert(width == height); /* cubemap images are square */ - - /* double pitch for cube layouts */ - tex->stride = round_up(nblocks * pt->block.size * 2, 4); - tex->total_nblocksy = nblocks * 4; - - for (level = 0; level <= pt->last_level; level++) { - i915_miptree_set_level_info(tex, level, 6, width, height, 1); - width /= 2; - height /= 2; - } - - for (face = 0; face < 6; face++) { - unsigned x = initial_offsets[face][0] * nblocks; - unsigned y = initial_offsets[face][1] * nblocks; - unsigned d = nblocks; - - for (level = 0; level <= pt->last_level; level++) { - i915_miptree_set_image_offset(tex, level, face, x, y); - d >>= 1; - x += step_offsets[face][0] * d; - y += step_offsets[face][1] * d; - } - } -} - -static boolean -i915_miptree_layout(struct i915_texture * tex) -{ - struct pipe_texture *pt = &tex->base; - - switch (pt->target) { - case PIPE_TEXTURE_1D: - case PIPE_TEXTURE_2D: - i915_miptree_layout_2d(tex); - break; - case PIPE_TEXTURE_3D: - i915_miptree_layout_3d(tex); - break; - case PIPE_TEXTURE_CUBE: - i915_miptree_layout_cube(tex); - break; - default: - assert(0); - return FALSE; - } - - return TRUE; -} - - -/* - * i945 layout functions - */ - - -static void -i945_miptree_layout_2d(struct i915_texture *tex) -{ - struct pipe_texture *pt = &tex->base; - const int align_x = 2, align_y = 4; - unsigned level; - unsigned x = 0; - unsigned y = 0; - unsigned width = pt->width[0]; - unsigned height = pt->height[0]; - unsigned nblocksx = pt->nblocksx[0]; - unsigned nblocksy = pt->nblocksy[0]; - - /* used for scanouts that need special layouts */ - if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_PRIMARY) - if (i915_scanout_layout(tex)) - return; - - /* for shared buffers we use some very like scanout */ - if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET) - if (i915_display_target_layout(tex)) - return; - - tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4); - - /* May need to adjust pitch to accomodate the placement of - * the 2nd mipmap level. This occurs when the alignment - * constraints of mipmap placement push the right edge of the - * 2nd mipmap level out past the width of its parent. - */ - if (pt->last_level > 0) { - unsigned mip1_nblocksx - = align(pf_get_nblocksx(&pt->block, minify(width)), align_x) - + pf_get_nblocksx(&pt->block, minify(minify(width))); - - if (mip1_nblocksx > nblocksx) - tex->stride = mip1_nblocksx * pt->block.size; - } - - /* Pitch must be a whole number of dwords - */ - tex->stride = align(tex->stride, 64); - tex->total_nblocksy = 0; - - for (level = 0; level <= pt->last_level; level++) { - i915_miptree_set_level_info(tex, level, 1, width, height, 1); - i915_miptree_set_image_offset(tex, level, 0, x, y); - - nblocksy = align(nblocksy, align_y); - - /* Because the images are packed better, the final offset - * might not be the maximal one: - */ - tex->total_nblocksy = MAX2(tex->total_nblocksy, y + nblocksy); - - /* Layout_below: step right after second mipmap level. - */ - if (level == 1) { - x += align(nblocksx, align_x); - } - else { - y += nblocksy; - } - - width = minify(width); - height = minify(height); - nblocksx = pf_get_nblocksx(&pt->block, width); - nblocksy = pf_get_nblocksy(&pt->block, height); - } -} - -static void -i945_miptree_layout_3d(struct i915_texture *tex) -{ - struct pipe_texture *pt = &tex->base; - unsigned width = pt->width[0]; - unsigned height = pt->height[0]; - unsigned depth = pt->depth[0]; - unsigned nblocksx = pt->nblocksx[0]; - unsigned nblocksy = pt->nblocksy[0]; - unsigned pack_x_pitch, pack_x_nr; - unsigned pack_y_pitch; - unsigned level; - - tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4); - tex->total_nblocksy = 0; - - pack_y_pitch = MAX2(pt->nblocksy[0], 2); - pack_x_pitch = tex->stride / pt->block.size; - pack_x_nr = 1; - - for (level = 0; level <= pt->last_level; level++) { - int x = 0; - int y = 0; - unsigned q, j; - - i915_miptree_set_level_info(tex, level, depth, width, height, depth); - - for (q = 0; q < depth;) { - for (j = 0; j < pack_x_nr && q < depth; j++, q++) { - i915_miptree_set_image_offset(tex, level, q, x, y + tex->total_nblocksy); - x += pack_x_pitch; - } - - x = 0; - y += pack_y_pitch; - } - - tex->total_nblocksy += y; - - if (pack_x_pitch > 4) { - pack_x_pitch >>= 1; - pack_x_nr <<= 1; - assert(pack_x_pitch * pack_x_nr * pt->block.size <= tex->stride); - } - - if (pack_y_pitch > 2) { - pack_y_pitch >>= 1; - } - - width = minify(width); - height = minify(height); - depth = minify(depth); - nblocksx = pf_get_nblocksx(&pt->block, width); - nblocksy = pf_get_nblocksy(&pt->block, height); - } -} - -static void -i945_miptree_layout_cube(struct i915_texture *tex) -{ - struct pipe_texture *pt = &tex->base; - unsigned level; - - const unsigned nblocks = pt->nblocksx[0]; - unsigned face; - unsigned width = pt->width[0]; - unsigned height = pt->height[0]; - - /* - printf("%s %i, %i\n", __FUNCTION__, pt->width[0], pt->height[0]); - */ - - assert(width == height); /* cubemap images are square */ - - /* - * XXX Should only be used for compressed formats. But lets - * keep this code active just in case. - * - * Depending on the size of the largest images, pitch can be - * determined either by the old-style packing of cubemap faces, - * or the final row of 4x4, 2x2 and 1x1 faces below this. - */ - if (nblocks > 32) - tex->stride = round_up(nblocks * pt->block.size * 2, 4); - else - tex->stride = 14 * 8 * pt->block.size; - - tex->total_nblocksy = nblocks * 4; - - /* Set all the levels to effectively occupy the whole rectangular region. - */ - for (level = 0; level <= pt->last_level; level++) { - i915_miptree_set_level_info(tex, level, 6, width, height, 1); - width /= 2; - height /= 2; - } - - for (face = 0; face < 6; face++) { - unsigned x = initial_offsets[face][0] * nblocks; - unsigned y = initial_offsets[face][1] * nblocks; - unsigned d = nblocks; - -#if 0 /* Fix and enable this code for compressed formats */ - if (nblocks == 4 && face >= 4) { - y = tex->total_height - 4; - x = (face - 4) * 8; - } - else if (nblocks < 4 && (face > 0)) { - y = tex->total_height - 4; - x = face * 8; - } -#endif - - for (level = 0; level <= pt->last_level; level++) { - i915_miptree_set_image_offset(tex, level, face, x, y); - - d >>= 1; - -#if 0 /* Fix and enable this code for compressed formats */ - switch (d) { - case 4: - switch (face) { - case PIPE_TEX_FACE_POS_X: - case PIPE_TEX_FACE_NEG_X: - x += step_offsets[face][0] * d; - y += step_offsets[face][1] * d; - break; - case PIPE_TEX_FACE_POS_Y: - case PIPE_TEX_FACE_NEG_Y: - y += 12; - x -= 8; - break; - case PIPE_TEX_FACE_POS_Z: - case PIPE_TEX_FACE_NEG_Z: - y = tex->total_height - 4; - x = (face - 4) * 8; - break; - } - case 2: - y = tex->total_height - 4; - x = 16 + face * 8; - break; - - case 1: - x += 48; - break; - default: -#endif - x += step_offsets[face][0] * d; - y += step_offsets[face][1] * d; -#if 0 - break; - } -#endif - } - } -} - -static boolean -i945_miptree_layout(struct i915_texture * tex) -{ - struct pipe_texture *pt = &tex->base; - - switch (pt->target) { - case PIPE_TEXTURE_1D: - case PIPE_TEXTURE_2D: - i945_miptree_layout_2d(tex); - break; - case PIPE_TEXTURE_3D: - i945_miptree_layout_3d(tex); - break; - case PIPE_TEXTURE_CUBE: - i945_miptree_layout_cube(tex); - break; - default: - assert(0); - return FALSE; - } - - return TRUE; -} - - -/* - * Screen texture functions - */ - - -static struct pipe_texture * -i915_texture_create(struct pipe_screen *screen, - const struct pipe_texture *templat) -{ - struct i915_screen *is = i915_screen(screen); - struct intel_winsys *iws = is->iws; - struct i915_texture *tex = CALLOC_STRUCT(i915_texture); - size_t tex_size; - unsigned buf_usage = 0; - - if (!tex) - return NULL; - - tex->base = *templat; - pipe_reference_init(&tex->base.reference, 1); - tex->base.screen = screen; - - tex->base.nblocksx[0] = pf_get_nblocksx(&tex->base.block, tex->base.width[0]); - tex->base.nblocksy[0] = pf_get_nblocksy(&tex->base.block, tex->base.height[0]); - - if (is->is_i945) { - if (!i945_miptree_layout(tex)) - goto fail; - } else { - if (!i915_miptree_layout(tex)) - goto fail; - } - - tex_size = tex->stride * tex->total_nblocksy; - - - - /* for scanouts and cursors, cursors arn't scanouts */ - if (templat->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY && templat->width[0] != 64) - buf_usage = INTEL_NEW_SCANOUT; - else - buf_usage = INTEL_NEW_TEXTURE; - - tex->buffer = iws->buffer_create(iws, tex_size, 64, buf_usage); - if (!tex->buffer) - goto fail; - - /* setup any hw fences */ - if (tex->hw_tiled) { - assert(tex->sw_tiled == INTEL_TILE_NONE); - iws->buffer_set_fence_reg(iws, tex->buffer, tex->stride, tex->hw_tiled); - } - - -#if 0 - void *ptr = ws->buffer_map(ws, tex->buffer, - PIPE_BUFFER_USAGE_CPU_WRITE); - memset(ptr, 0x80, tex_size); - ws->buffer_unmap(ws, tex->buffer); -#endif - - return &tex->base; - -fail: - FREE(tex); - return NULL; -} - -static struct pipe_texture * -i915_texture_blanket(struct pipe_screen * screen, - const struct pipe_texture *base, - const unsigned *stride, - struct pipe_buffer *buffer) -{ -#if 0 - struct i915_texture *tex; - assert(screen); - - /* Only supports one type */ - if (base->target != PIPE_TEXTURE_2D || - base->last_level != 0 || - base->depth[0] != 1) { - return NULL; - } - - tex = CALLOC_STRUCT(i915_texture); - if (!tex) - return NULL; - - tex->base = *base; - pipe_reference_init(&tex->base.reference, 1); - tex->base.screen = screen; - - tex->stride = stride[0]; - - i915_miptree_set_level_info(tex, 0, 1, base->width[0], base->height[0], 1); - i915_miptree_set_image_offset(tex, 0, 0, 0, 0); - - pipe_buffer_reference(&tex->buffer, buffer); - - return &tex->base; -#else - return NULL; -#endif -} - -static void -i915_texture_destroy(struct pipe_texture *pt) -{ - struct i915_texture *tex = (struct i915_texture *)pt; - struct intel_winsys *iws = i915_screen(pt->screen)->iws; - uint i; - - /* - DBG("%s deleting %p\n", __FUNCTION__, (void *) tex); - */ - - iws->buffer_destroy(iws, tex->buffer); - - for (i = 0; i < PIPE_MAX_TEXTURE_LEVELS; i++) - if (tex->image_offset[i]) - FREE(tex->image_offset[i]); - - FREE(tex); -} - - -/* - * Screen surface functions - */ - - -static struct pipe_surface * -i915_get_tex_surface(struct pipe_screen *screen, - struct pipe_texture *pt, - unsigned face, unsigned level, unsigned zslice, - unsigned flags) -{ - struct i915_texture *tex = (struct i915_texture *)pt; - struct pipe_surface *ps; - unsigned offset; /* in bytes */ - - if (pt->target == PIPE_TEXTURE_CUBE) { - offset = tex->image_offset[level][face]; - } - else if (pt->target == PIPE_TEXTURE_3D) { - offset = tex->image_offset[level][zslice]; - } - else { - offset = tex->image_offset[level][0]; - assert(face == 0); - assert(zslice == 0); - } - - ps = CALLOC_STRUCT(pipe_surface); - if (ps) { - pipe_reference_init(&ps->reference, 1); - pipe_texture_reference(&ps->texture, pt); - ps->format = pt->format; - ps->width = pt->width[level]; - ps->height = pt->height[level]; - ps->offset = offset; - ps->usage = flags; - } - return ps; -} - -static void -i915_tex_surface_destroy(struct pipe_surface *surf) -{ - pipe_texture_reference(&surf->texture, NULL); - FREE(surf); -} - - -/* - * Screen transfer functions - */ - - -static struct pipe_transfer* -i915_get_tex_transfer(struct pipe_screen *screen, - struct pipe_texture *texture, - unsigned face, unsigned level, unsigned zslice, - enum pipe_transfer_usage usage, unsigned x, unsigned y, - unsigned w, unsigned h) -{ - struct i915_texture *tex = (struct i915_texture *)texture; - struct i915_transfer *trans; - unsigned offset; /* in bytes */ - - if (texture->target == PIPE_TEXTURE_CUBE) { - offset = tex->image_offset[level][face]; - } - else if (texture->target == PIPE_TEXTURE_3D) { - offset = tex->image_offset[level][zslice]; - } - else { - offset = tex->image_offset[level][0]; - assert(face == 0); - assert(zslice == 0); - } - - trans = CALLOC_STRUCT(i915_transfer); - if (trans) { - pipe_texture_reference(&trans->base.texture, texture); - trans->base.format = trans->base.format; - trans->base.x = x; - trans->base.y = y; - trans->base.width = w; - trans->base.height = h; - trans->base.block = texture->block; - trans->base.nblocksx = texture->nblocksx[level]; - trans->base.nblocksy = texture->nblocksy[level]; - trans->base.stride = tex->stride; - trans->offset = offset; - trans->base.usage = usage; - } - return &trans->base; -} - -static void * -i915_transfer_map(struct pipe_screen *screen, - struct pipe_transfer *transfer) -{ - struct i915_texture *tex = (struct i915_texture *)transfer->texture; - struct intel_winsys *iws = i915_screen(tex->base.screen)->iws; - char *map; - boolean write = FALSE; - - if (transfer->usage & PIPE_TRANSFER_WRITE) - write = TRUE; - - map = iws->buffer_map(iws, tex->buffer, write); - if (map == NULL) - return NULL; - - return map + i915_transfer(transfer)->offset + - transfer->y / transfer->block.height * transfer->stride + - transfer->x / transfer->block.width * transfer->block.size; -} - -static void -i915_transfer_unmap(struct pipe_screen *screen, - struct pipe_transfer *transfer) -{ - struct i915_texture *tex = (struct i915_texture *)transfer->texture; - struct intel_winsys *iws = i915_screen(tex->base.screen)->iws; - iws->buffer_unmap(iws, tex->buffer); -} - -static void -i915_tex_transfer_destroy(struct pipe_transfer *trans) -{ - pipe_texture_reference(&trans->texture, NULL); - FREE(trans); -} - - -/* - * Other texture functions - */ - - -void -i915_init_screen_texture_functions(struct i915_screen *is) -{ - is->base.texture_create = i915_texture_create; - is->base.texture_blanket = i915_texture_blanket; - is->base.texture_destroy = i915_texture_destroy; - is->base.get_tex_surface = i915_get_tex_surface; - is->base.tex_surface_destroy = i915_tex_surface_destroy; - is->base.get_tex_transfer = i915_get_tex_transfer; - is->base.transfer_map = i915_transfer_map; - is->base.transfer_unmap = i915_transfer_unmap; - is->base.tex_transfer_destroy = i915_tex_transfer_destroy; -} - -struct pipe_texture * -i915_texture_blanket_intel(struct pipe_screen *screen, - struct pipe_texture *base, - unsigned stride, - struct intel_buffer *buffer) -{ - struct i915_texture *tex; - assert(screen); - - /* Only supports one type */ - if (base->target != PIPE_TEXTURE_2D || - base->last_level != 0 || - base->depth[0] != 1) { - return NULL; - } - - tex = CALLOC_STRUCT(i915_texture); - if (!tex) - return NULL; - - tex->base = *base; - pipe_reference_init(&tex->base.reference, 1); - tex->base.screen = screen; - - tex->stride = stride; - - i915_miptree_set_level_info(tex, 0, 1, base->width[0], base->height[0], 1); - i915_miptree_set_image_offset(tex, 0, 0, 0, 0); - - tex->buffer = buffer; - - return &tex->base; -} - -boolean -i915_get_texture_buffer_intel(struct pipe_texture *texture, - struct intel_buffer **buffer, - unsigned *stride) -{ - struct i915_texture *tex = (struct i915_texture *)texture; - - if (!texture) - return FALSE; - - *stride = tex->stride; - *buffer = tex->buffer; - - return TRUE; -} diff --git a/src/gallium/drivers/i915simple/i915_texture.h b/src/gallium/drivers/i915simple/i915_texture.h deleted file mode 100644 index 51a1dd984c..0000000000 --- a/src/gallium/drivers/i915simple/i915_texture.h +++ /dev/null @@ -1,36 +0,0 @@ -/************************************************************************** - * - * 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. - * - **************************************************************************/ - -#ifndef I915_TEXTURE_H -#define I915_TEXTURE_H - -struct i915_screen; - -extern void -i915_init_screen_texture_functions(struct i915_screen *is); - -#endif /* I915_TEXTURE_H */ diff --git a/src/gallium/drivers/i915simple/intel_batchbuffer.h b/src/gallium/drivers/i915simple/intel_batchbuffer.h deleted file mode 100644 index db12dfd2ac..0000000000 --- a/src/gallium/drivers/i915simple/intel_batchbuffer.h +++ /dev/null @@ -1,87 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef INTEL_BATCH_H -#define INTEL_BATCH_H - -#include "intel_winsys.h" - -static INLINE boolean -intel_batchbuffer_check(struct intel_batchbuffer *batch, - size_t dwords, - size_t relocs) -{ - return dwords * 4 <= batch->size - (batch->ptr - batch->map) && - relocs <= (batch->max_relocs - batch->relocs); -} - -static INLINE size_t -intel_batchbuffer_space(struct intel_batchbuffer *batch) -{ - return batch->size - (batch->ptr - batch->map); -} - -static INLINE void -intel_batchbuffer_dword(struct intel_batchbuffer *batch, - unsigned dword) -{ - if (intel_batchbuffer_space(batch) < 4) - return; - - *(unsigned *)batch->ptr = dword; - batch->ptr += 4; -} - -static INLINE void -intel_batchbuffer_write(struct intel_batchbuffer *batch, - void *data, - size_t size) -{ - if (intel_batchbuffer_space(batch) < size) - return; - - memcpy(data, batch->ptr, size); - batch->ptr += size; -} - -static INLINE int -intel_batchbuffer_reloc(struct intel_batchbuffer *batch, - struct intel_buffer *buffer, - enum intel_buffer_usage usage, - size_t offset) -{ - return batch->iws->batchbuffer_reloc(batch, buffer, usage, offset); -} - -static INLINE void -intel_batchbuffer_flush(struct intel_batchbuffer *batch, - struct pipe_fence_handle **fence) -{ - batch->iws->batchbuffer_flush(batch, fence); -} - -#endif diff --git a/src/gallium/drivers/i915simple/intel_winsys.h b/src/gallium/drivers/i915simple/intel_winsys.h deleted file mode 100644 index 42c5e7470e..0000000000 --- a/src/gallium/drivers/i915simple/intel_winsys.h +++ /dev/null @@ -1,230 +0,0 @@ -/************************************************************************** - * - * Copyright © 2009 Jakob Bornecrantz - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - -#ifndef INTEL_WINSYS_H -#define INTEL_WINSYS_H - -#include "pipe/p_compiler.h" - -struct intel_winsys; -struct intel_buffer; -struct intel_batchbuffer; -struct pipe_texture; -struct pipe_fence_handle; - -enum intel_buffer_usage -{ - /* use on textures */ - INTEL_USAGE_RENDER = 0x01, - INTEL_USAGE_SAMPLER = 0x02, - INTEL_USAGE_2D_TARGET = 0x04, - INTEL_USAGE_2D_SOURCE = 0x08, - /* use on vertex */ - INTEL_USAGE_VERTEX = 0x10, -}; - -enum intel_buffer_type -{ - INTEL_NEW_TEXTURE, - INTEL_NEW_SCANOUT, /**< a texture used for scanning out from */ - INTEL_NEW_VERTEX, -}; - -enum intel_buffer_tile -{ - INTEL_TILE_NONE, - INTEL_TILE_X, - INTEL_TILE_Y, -}; - -struct intel_batchbuffer { - - struct intel_winsys *iws; - - /** - * Values exported to speed up the writing the batchbuffer, - * instead of having to go trough a accesor function for - * each dword written. - */ - /*{@*/ - uint8_t *map; - uint8_t *ptr; - size_t size; - - size_t relocs; - size_t max_relocs; - /*@}*/ -}; - -struct intel_winsys { - - /** - * Batchbuffer functions. - */ - /*@{*/ - /** - * Create a new batchbuffer. - */ - struct intel_batchbuffer *(*batchbuffer_create)(struct intel_winsys *iws); - - /** - * Emit a relocation to a buffer. - * Target position in batchbuffer is the same as ptr. - * - * @batch - * @reloc buffer address to be inserted into target. - * @usage how is the hardware going to use the buffer. - * @offset add this to the reloc buffers address - * @target buffer where to write the address, null for batchbuffer. - */ - int (*batchbuffer_reloc)(struct intel_batchbuffer *batch, - struct intel_buffer *reloc, - enum intel_buffer_usage usage, - unsigned offset); - - /** - * Flush a bufferbatch. - */ - void (*batchbuffer_flush)(struct intel_batchbuffer *batch, - struct pipe_fence_handle **fence); - - /** - * Destroy a batchbuffer. - */ - void (*batchbuffer_destroy)(struct intel_batchbuffer *batch); - /*@}*/ - - - /** - * Buffer functions. - */ - /*@{*/ - /** - * Create a buffer. - */ - struct intel_buffer *(*buffer_create)(struct intel_winsys *iws, - unsigned size, unsigned alignment, - enum intel_buffer_type type); - - /** - * Fence a buffer with a fence reg. - * Not to be confused with pipe_fence_handle. - */ - int (*buffer_set_fence_reg)(struct intel_winsys *iws, - struct intel_buffer *buffer, - unsigned stride, - enum intel_buffer_tile tile); - - /** - * Map a buffer. - */ - void *(*buffer_map)(struct intel_winsys *iws, - struct intel_buffer *buffer, - boolean write); - - /** - * Unmap a buffer. - */ - void (*buffer_unmap)(struct intel_winsys *iws, - struct intel_buffer *buffer); - - /** - * Write to a buffer. - * - * Arguments follows pwrite(2) - */ - int (*buffer_write)(struct intel_winsys *iws, - struct intel_buffer *dst, - const void *src, - size_t size, - size_t offset); - - void (*buffer_destroy)(struct intel_winsys *iws, - struct intel_buffer *buffer); - /*@}*/ - - - /** - * Fence functions. - */ - /*@{*/ - /** - * Reference fence and set ptr to fence. - */ - void (*fence_reference)(struct intel_winsys *iws, - struct pipe_fence_handle **ptr, - struct pipe_fence_handle *fence); - - /** - * Check if a fence has finished. - */ - int (*fence_signalled)(struct intel_winsys *iws, - struct pipe_fence_handle *fence); - - /** - * Wait on a fence to finish. - */ - int (*fence_finish)(struct intel_winsys *iws, - struct pipe_fence_handle *fence); - /*@}*/ - - - /** - * Destroy the winsys. - */ - void (*destroy)(struct intel_winsys *iws); -}; - - -/** - * Create i915 pipe_screen. - */ -struct pipe_screen *i915_create_screen(struct intel_winsys *iws, unsigned pci_id); - -/** - * Create a i915 pipe_context. - */ -struct pipe_context *i915_create_context(struct pipe_screen *screen); - -/** - * Get the intel_winsys buffer backing the texture. - * - * TODO UGLY - */ -boolean i915_get_texture_buffer_intel(struct pipe_texture *texture, - struct intel_buffer **buffer, - unsigned *stride); - -/** - * Wrap a intel_winsys buffer with a texture blanket. - * - * TODO UGLY - */ -struct pipe_texture * i915_texture_blanket_intel(struct pipe_screen *screen, - struct pipe_texture *tmplt, - unsigned pitch, - struct intel_buffer *buffer); - -#endif diff --git a/src/gallium/winsys/drm/intel/dri/Makefile b/src/gallium/winsys/drm/intel/dri/Makefile index 5e212b62a4..c0ecd9680e 100644 --- a/src/gallium/winsys/drm/intel/dri/Makefile +++ b/src/gallium/winsys/drm/intel/dri/Makefile @@ -9,7 +9,7 @@ PIPE_DRIVERS = \ $(TOP)/src/gallium/drivers/trace/libtrace.a \ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ $(TOP)/src/gallium/drivers/identity/libidentity.a \ - $(TOP)/src/gallium/drivers/i915simple/libi915simple.a + $(TOP)/src/gallium/drivers/i915/libi915.a DRIVER_SOURCES = diff --git a/src/gallium/winsys/drm/intel/dri/SConscript b/src/gallium/winsys/drm/intel/dri/SConscript index f973811072..b1b654d9f8 100644 --- a/src/gallium/winsys/drm/intel/dri/SConscript +++ b/src/gallium/winsys/drm/intel/dri/SConscript @@ -8,7 +8,7 @@ drivers = [ st_dri, inteldrm, softpipe, - i915simple, + i915, trace, ] diff --git a/src/gallium/winsys/drm/intel/egl/Makefile b/src/gallium/winsys/drm/intel/egl/Makefile index 490baded66..1397e9f729 100644 --- a/src/gallium/winsys/drm/intel/egl/Makefile +++ b/src/gallium/winsys/drm/intel/egl/Makefile @@ -9,7 +9,7 @@ PIPE_DRIVERS = \ $(GALLIUMDIR)/winsys/drm/intel/gem/libinteldrm.a \ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ $(TOP)/src/gallium/drivers/trace/libtrace.a \ - $(TOP)/src/gallium/drivers/i915simple/libi915simple.a + $(TOP)/src/gallium/drivers/i915/libi915.a DRIVER_SOURCES = diff --git a/src/gallium/winsys/drm/intel/gem/intel_drm_api.c b/src/gallium/winsys/drm/intel/gem/intel_drm_api.c index 8b647a769b..9ed570ff6e 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_drm_api.c +++ b/src/gallium/winsys/drm/intel/gem/intel_drm_api.c @@ -4,8 +4,8 @@ #include "intel_drm_winsys.h" #include "util/u_memory.h" -#include "i915simple/i915_context.h" -#include "i915simple/i915_screen.h" +#include "i915/i915_context.h" +#include "i915/i915_screen.h" #include "trace/tr_drm.h" diff --git a/src/gallium/winsys/drm/intel/gem/intel_drm_winsys.h b/src/gallium/winsys/drm/intel/gem/intel_drm_winsys.h index 415c45feea..b4a60563ef 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_drm_winsys.h +++ b/src/gallium/winsys/drm/intel/gem/intel_drm_winsys.h @@ -2,7 +2,7 @@ #ifndef INTEL_DRM_WINSYS_H #define INTEL_DRM_WINSYS_H -#include "i915simple/intel_batchbuffer.h" +#include "i915/intel_batchbuffer.h" #include "drm.h" #include "intel_bufmgr.h" diff --git a/src/gallium/winsys/drm/intel/xorg/Makefile b/src/gallium/winsys/drm/intel/xorg/Makefile index 9e56853b02..14c2462524 100644 --- a/src/gallium/winsys/drm/intel/xorg/Makefile +++ b/src/gallium/winsys/drm/intel/xorg/Makefile @@ -18,7 +18,7 @@ INCLUDES = \ LIBS = \ $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a \ $(TOP)/src/gallium/winsys/drm/intel/gem/libinteldrm.a \ - $(TOP)/src/gallium/drivers/i915simple/libi915simple.a \ + $(TOP)/src/gallium/drivers/i915/libi915.a \ $(TOP)/src/gallium/drivers/trace/libtrace.a \ $(TOP)/src/gallium/drivers/softpipe/libsoftpipe.a \ $(GALLIUM_AUXILIARIES) -- cgit v1.2.3 From 3b29dcbb5e1f0641cdfab22b5e578d933e9dbf35 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 5 Oct 2009 14:07:29 -0600 Subject: intel: remove a buffer equality test in _mesa_make_current() Before, if we called glXMakeCurrent() to change a context's window binding while an FBO was bound, we weren't updating the intel->driDrawable and intel->driReadDrawable fields. This could cause us to dereference a null pointer elsewhere. --- src/mesa/drivers/dri/intel/intel_context.c | 60 ++++++++++++++---------------- 1 file changed, 27 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index fce42e9c2d..c49f06e44a 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -993,41 +993,35 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv, _mesa_make_current(&intel->ctx, &intel_fb->Base, readFb); - /* The drawbuffer won't always be updated by _mesa_make_current: - */ - if (intel->ctx.DrawBuffer == &intel_fb->Base) { - - if (intel->driReadDrawable != driReadPriv) - intel->driReadDrawable = driReadPriv; - - if (intel->driDrawable != driDrawPriv) { - if (driDrawPriv->swap_interval == (unsigned)-1) { - int i; - - driDrawPriv->vblFlags = (intel->intelScreen->irq_active != 0) - ? driGetDefaultVBlankFlags(&intel->optionCache) - : VBLANK_FLAG_NO_IRQ; - - /* Prevent error printf if one crtc is disabled, this will - * be properly calculated in intelWindowMoved() next. - */ - driDrawPriv->vblFlags = intelFixupVblank(intel, driDrawPriv); - - (*psp->systemTime->getUST) (&intel_fb->swap_ust); - driDrawableInitVBlank(driDrawPriv); - intel_fb->vbl_waited = driDrawPriv->vblSeq; - - for (i = 0; i < 2; i++) { - if (intel_fb->color_rb[i]) - intel_fb->color_rb[i]->vbl_pending = driDrawPriv->vblSeq; - } - } - intel->driDrawable = driDrawPriv; - intelWindowMoved(intel); - } + intel->driReadDrawable = driReadPriv; + + if (intel->driDrawable != driDrawPriv) { + if (driDrawPriv->swap_interval == (unsigned)-1) { + int i; + + driDrawPriv->vblFlags = (intel->intelScreen->irq_active != 0) + ? driGetDefaultVBlankFlags(&intel->optionCache) + : VBLANK_FLAG_NO_IRQ; - intel_draw_buffer(&intel->ctx, &intel_fb->Base); + /* Prevent error printf if one crtc is disabled, this will + * be properly calculated in intelWindowMoved() next. + */ + driDrawPriv->vblFlags = intelFixupVblank(intel, driDrawPriv); + + (*psp->systemTime->getUST) (&intel_fb->swap_ust); + driDrawableInitVBlank(driDrawPriv); + intel_fb->vbl_waited = driDrawPriv->vblSeq; + + for (i = 0; i < 2; i++) { + if (intel_fb->color_rb[i]) + intel_fb->color_rb[i]->vbl_pending = driDrawPriv->vblSeq; + } + } + intel->driDrawable = driDrawPriv; + intelWindowMoved(intel); } + + intel_draw_buffer(&intel->ctx, &intel_fb->Base); } else { _mesa_make_current(NULL, NULL, NULL); -- cgit v1.2.3 From 3b7ec94c0db4140f72682f70262baf77be683816 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 5 Oct 2009 14:25:36 -0600 Subject: intel: use driReadDrawable, not driDrawable in do_blit_readpixels() --- src/mesa/drivers/dri/intel/intel_pixel_read.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_pixel_read.c b/src/mesa/drivers/dri/intel/intel_pixel_read.c index 8713463ace..e036736323 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_read.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_read.c @@ -236,14 +236,14 @@ do_blit_readpixels(GLcontext * ctx, intelFlush(&intel->ctx); LOCK_HARDWARE(intel); - if (intel->driDrawable->numClipRects) { + if (intel->driReadDrawable->numClipRects) { GLboolean all = (width * height * src->cpp == dst->Base.Size && x == 0 && dst_offset == 0); dri_bo *dst_buffer = intel_bufferobj_buffer(intel, dst, all ? INTEL_WRITE_FULL : INTEL_WRITE_PART); - __DRIdrawablePrivate *dPriv = intel->driDrawable; + __DRIdrawablePrivate *dPriv = intel->driReadDrawable; int nbox = dPriv->numClipRects; drm_clip_rect_t *box = dPriv->pClipRects; drm_clip_rect_t rect; -- cgit v1.2.3 From 79892e7976fbb91ae426f5868d5f453e977c1f17 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 5 Oct 2009 14:26:16 -0600 Subject: intel: use driReadDrawable in do_copy_texsubimage() --- src/mesa/drivers/dri/intel/intel_tex_copy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 74f7f58bbe..b241c11625 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -135,7 +135,7 @@ do_copy_texsubimage(struct intel_context *intel, if (ctx->ReadBuffer->Name == 0) { /* reading from a window, adjust x, y */ - __DRIdrawablePrivate *dPriv = intel->driDrawable; + const __DRIdrawablePrivate *dPriv = intel->driReadDrawable; y = dPriv->y + (dPriv->h - (y + height)); x += dPriv->x; -- cgit v1.2.3 From 722ae91722342ae8d32244a0e0c3a8ad1fdae4e2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 5 Oct 2009 14:43:38 -0600 Subject: i965g: remove 965/brw files from XLIB_WINSYS_SOURCES --- src/gallium/winsys/xlib/Makefile | 3 --- 1 file changed, 3 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/xlib/Makefile b/src/gallium/winsys/xlib/Makefile index 3a1945d92c..3dc38a78e4 100644 --- a/src/gallium/winsys/xlib/Makefile +++ b/src/gallium/winsys/xlib/Makefile @@ -31,9 +31,6 @@ DEFINES += \ XLIB_WINSYS_SOURCES = \ xlib.c \ xlib_cell.c \ - xlib_brw_aub.c \ - xlib_brw_context.c \ - xlib_brw_screen.c \ xlib_llvmpipe.c \ xlib_softpipe.c \ xlib_trace.c -- cgit v1.2.3 From bbbf55fa8419549debbba9ac6dc011b2c18ef24c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 5 Oct 2009 16:52:26 -0600 Subject: mesa: make _mesa_get_texel_fetch_func() static --- src/mesa/main/texfetch.c | 2 +- src/mesa/main/texfetch.h | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c index 3428f705be..6b7db584f8 100644 --- a/src/mesa/main/texfetch.c +++ b/src/mesa/main/texfetch.c @@ -522,7 +522,7 @@ texfetch_funcs[MESA_FORMAT_COUNT] = }; -FetchTexelFuncF +static FetchTexelFuncF _mesa_get_texel_fetch_func(gl_format format, GLuint dims) { FetchTexelFuncF f; diff --git a/src/mesa/main/texfetch.h b/src/mesa/main/texfetch.h index a9be530a06..ef13bf27fe 100644 --- a/src/mesa/main/texfetch.h +++ b/src/mesa/main/texfetch.h @@ -31,9 +31,6 @@ #include "formats.h" -extern FetchTexelFuncF -_mesa_get_texel_fetch_func(gl_format format, GLuint dims); - extern StoreTexelFunc _mesa_get_texel_store_func(gl_format format); -- cgit v1.2.3 From 1a2bb37264b4448d33f2948fe1702c9dc936395d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 5 Oct 2009 17:12:36 -0600 Subject: mesa: lift _mesa_set_fetch_functions() calls out of drivers Call it from in the main Mesa glTexImage functions. --- src/mesa/drivers/dri/intel/intel_tex_image.c | 4 ---- src/mesa/drivers/dri/radeon/radeon_texture.c | 3 --- src/mesa/drivers/dri/unichrome/via_tex.c | 3 --- src/mesa/main/texfetch.c | 12 ++++++------ src/mesa/main/teximage.c | 20 ++++++++++++++++++++ src/mesa/main/texstore.c | 9 --------- 6 files changed, 26 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index dd436becab..f32ff0dd05 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -7,7 +7,6 @@ #include "main/convolve.h" #include "main/context.h" #include "main/texcompress.h" -#include "main/texfetch.h" #include "main/texformat.h" #include "main/texstore.h" #include "main/texgetimage.h" @@ -336,8 +335,6 @@ intelTexImage(GLcontext * ctx, texImage->TexFormat = intelChooseTextureFormat(ctx, internalFormat, format, type); - _mesa_set_fetch_functions(texImage, dims); - if (_mesa_is_format_compressed(texImage->TexFormat)) { texelBytes = 0; } @@ -794,7 +791,6 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, intelImage->level = level; texImage->TexFormat = intelChooseTextureFormat(&intel->ctx, internalFormat, type, format); - _mesa_set_fetch_functions(texImage, 2); texImage->RowStride = rb->region->pitch; intel_miptree_reference(&intelImage->mt, intelObj->mt); diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 2c28011057..17e42e72ee 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -34,7 +34,6 @@ #include "main/convolve.h" #include "main/mipmap.h" #include "main/texcompress.h" -#include "main/texfetch.h" #include "main/texformat.h" #include "main/texstore.h" #include "main/teximage.h" @@ -140,7 +139,6 @@ static void map_override(GLcontext *ctx, radeonTexObj *t) radeon_bo_map(t->bo, GL_FALSE); img->base.Data = t->bo->ptr; - _mesa_set_fetch_functions(&img->base, 2); } static void unmap_override(GLcontext *ctx, radeonTexObj *t) @@ -543,7 +541,6 @@ static void radeon_teximage( /* Choose and fill in the texture format for this image */ texImage->TexFormat = radeonChooseTextureFormat(ctx, internalFormat, format, type, 0); - _mesa_set_fetch_functions(texImage, dims); if (_mesa_is_format_compressed(texImage->TexFormat)) { texelBytes = 0; diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index a99aa9debc..fa7542c5cb 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -37,7 +37,6 @@ #include "main/mipmap.h" #include "main/simple_list.h" #include "main/texcompress.h" -#include "main/texfetch.h" #include "main/texformat.h" #include "main/texobj.h" #include "main/texstore.h" @@ -692,8 +691,6 @@ static void viaTexImage(GLcontext *ctx, assert(texImage->TexFormat); - _mesa_set_fetch_functions(texImage, dims); - texelBytes = _mesa_get_format_bytes(texImage->TexFormat); if (texelBytes == 0) { diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c index 6b7db584f8..851659e9c5 100644 --- a/src/mesa/main/texfetch.c +++ b/src/mesa/main/texfetch.c @@ -595,6 +595,7 @@ fetch_texel_float_to_chan(const struct gl_texture_image *texImage, } +#if 0 /** * Adaptor for fetching a float texel from a GLchan-valued texture. */ @@ -620,6 +621,7 @@ fetch_texel_chan_to_float(const struct gl_texture_image *texImage, texelOut[3] = CHAN_TO_FLOAT(temp[3]); } } +#endif /** @@ -631,17 +633,15 @@ _mesa_set_fetch_functions(struct gl_texture_image *texImage, GLuint dims) ASSERT(dims == 1 || dims == 2 || dims == 3); ASSERT(texImage->TexFormat); - texImage->FetchTexelf = - _mesa_get_texel_fetch_func(texImage->TexFormat, dims); + if (!texImage->FetchTexelf) { + texImage->FetchTexelf = + _mesa_get_texel_fetch_func(texImage->TexFormat, dims); + } /* now check if we need to use a float/chan adaptor */ if (!texImage->FetchTexelc) { texImage->FetchTexelc = fetch_texel_float_to_chan; } - else if (!texImage->FetchTexelf) { - texImage->FetchTexelf = fetch_texel_chan_to_float; - } - ASSERT(texImage->FetchTexelc); ASSERT(texImage->FetchTexelf); diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 438a316b9c..457380b8fa 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -43,6 +43,7 @@ #include "macros.h" #include "state.h" #include "texcompress.h" +#include "texfetch.h" #include "texformat.h" #include "teximage.h" #include "texstate.h" @@ -997,6 +998,9 @@ _mesa_init_teximage_fields(GLcontext *ctx, GLenum target, img->HeightScale = (GLfloat) img->Height; img->DepthScale = (GLfloat) img->Depth; } + + img->FetchTexelc = NULL; + img->FetchTexelf = NULL; } @@ -2200,6 +2204,8 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, ASSERT(texImage->TexFormat); + _mesa_set_fetch_functions(texImage, 1); + check_gen_mipmap(ctx, target, texObj, level); update_fbo_texture(ctx, texObj, face, level); @@ -2314,6 +2320,8 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, ASSERT(texImage->TexFormat); + _mesa_set_fetch_functions(texImage, 2); + check_gen_mipmap(ctx, target, texObj, level); update_fbo_texture(ctx, texObj, face, level); @@ -2424,6 +2432,8 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, ASSERT(texImage->TexFormat); + _mesa_set_fetch_functions(texImage, 3); + check_gen_mipmap(ctx, target, texObj, level); update_fbo_texture(ctx, texObj, face, level); @@ -2732,6 +2742,8 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, ASSERT(texImage->TexFormat); + _mesa_set_fetch_functions(texImage, 1); + check_gen_mipmap(ctx, target, texObj, level); update_fbo_texture(ctx, texObj, face, level); @@ -2807,6 +2819,8 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, ASSERT(texImage->TexFormat); + _mesa_set_fetch_functions(texImage, 2); + check_gen_mipmap(ctx, target, texObj, level); update_fbo_texture(ctx, texObj, face, level); @@ -3259,6 +3273,8 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, imageSize, data, texObj, texImage); + _mesa_set_fetch_functions(texImage, 1); + check_gen_mipmap(ctx, target, texObj, level); /* state update */ @@ -3363,6 +3379,8 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, border, imageSize, data, texObj, texImage); + _mesa_set_fetch_functions(texImage, 2); + check_gen_mipmap(ctx, target, texObj, level); /* state update */ @@ -3467,6 +3485,8 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, border, imageSize, data, texObj, texImage); + _mesa_set_fetch_functions(texImage, 3); + check_gen_mipmap(ctx, target, texObj, level); /* state update */ diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 133b0370c8..52502b7033 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -64,7 +64,6 @@ #include "texcompress.h" #include "texcompress_fxt1.h" #include "texcompress_s3tc.h" -#include "texfetch.h" #include "texformat.h" #include "teximage.h" #include "texstore.h" @@ -3213,8 +3212,6 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, = ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type); ASSERT(texImage->TexFormat); - _mesa_set_fetch_functions(texImage, 1); - /* allocate memory */ sizeInBytes = texture_size(texImage); texImage->Data = _mesa_alloc_texmemory(sizeInBytes); @@ -3276,8 +3273,6 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, = ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type); ASSERT(texImage->TexFormat); - _mesa_set_fetch_functions(texImage, 2); - /* allocate memory */ sizeInBytes = texture_size(texImage); texImage->Data = _mesa_alloc_texmemory(sizeInBytes); @@ -3335,8 +3330,6 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, = ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type); ASSERT(texImage->TexFormat); - _mesa_set_fetch_functions(texImage, 3); - /* allocate memory */ sizeInBytes = texture_size(texImage); texImage->Data = _mesa_alloc_texmemory(sizeInBytes); @@ -3539,8 +3532,6 @@ _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level, = ctx->Driver.ChooseTextureFormat(ctx, internalFormat, 0, 0); ASSERT(texImage->TexFormat); - _mesa_set_fetch_functions(texImage, 2); - /* allocate storage */ texImage->Data = _mesa_alloc_texmemory(imageSize); if (!texImage->Data) { -- cgit v1.2.3 From 41bee4cff54c6a4c3ee193c80164a4b81863774b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 5 Oct 2009 17:27:50 -0600 Subject: mesa: add parenthesis --- src/mesa/main/colormac.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/main/colormac.h b/src/mesa/main/colormac.h index 815624ee50..7ae781ae23 100644 --- a/src/mesa/main/colormac.h +++ b/src/mesa/main/colormac.h @@ -140,9 +140,9 @@ */ #define UNCLAMPED_FLOAT_TO_RGB_CHAN(dst, f) \ do { \ - UNCLAMPED_FLOAT_TO_CHAN(dst[0], f[0]); \ - UNCLAMPED_FLOAT_TO_CHAN(dst[1], f[1]); \ - UNCLAMPED_FLOAT_TO_CHAN(dst[2], f[2]); \ + UNCLAMPED_FLOAT_TO_CHAN((dst)[0], (f)[0]); \ + UNCLAMPED_FLOAT_TO_CHAN((dst)[1], (f)[1]); \ + UNCLAMPED_FLOAT_TO_CHAN((dst)[2], (f)[2]); \ } while (0) @@ -156,10 +156,10 @@ do { \ */ #define UNCLAMPED_FLOAT_TO_RGBA_CHAN(dst, f) \ do { \ - UNCLAMPED_FLOAT_TO_CHAN(dst[0], f[0]); \ - UNCLAMPED_FLOAT_TO_CHAN(dst[1], f[1]); \ - UNCLAMPED_FLOAT_TO_CHAN(dst[2], f[2]); \ - UNCLAMPED_FLOAT_TO_CHAN(dst[3], f[3]); \ + UNCLAMPED_FLOAT_TO_CHAN((dst)[0], (f)[0]); \ + UNCLAMPED_FLOAT_TO_CHAN((dst)[1], (f)[1]); \ + UNCLAMPED_FLOAT_TO_CHAN((dst)[2], (f)[2]); \ + UNCLAMPED_FLOAT_TO_CHAN((dst)[3], (f)[3]); \ } while (0) -- cgit v1.2.3 From 6ec3db6cab95c1025d4afa0e7951246b5aa51b48 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 5 Oct 2009 17:28:39 -0600 Subject: mesa: use FetchTexelf() instead of FetchTexelc() --- src/mesa/main/texrender.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c index f47478421a..c8b532acbb 100644 --- a/src/mesa/main/texrender.c +++ b/src/mesa/main/texrender.c @@ -1,5 +1,6 @@ #include "context.h" +#include "colormac.h" #include "fbobject.h" #include "texfetch.h" #include "texrender.h" @@ -46,7 +47,9 @@ texture_get_row(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, if (rb->DataType == CHAN_TYPE) { GLchan *rgbaOut = (GLchan *) values; for (i = 0; i < count; i++) { - trb->TexImage->FetchTexelc(trb->TexImage, x + i, y, z, rgbaOut + 4 * i); + GLfloat rgba[4]; + trb->TexImage->FetchTexelf(trb->TexImage, x + i, y, z, rgba); + UNCLAMPED_FLOAT_TO_RGBA_CHAN(rgbaOut + 4 * i, rgba); } } else if (rb->DataType == GL_UNSIGNED_SHORT) { @@ -100,8 +103,10 @@ texture_get_values(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, if (rb->DataType == CHAN_TYPE) { GLchan *rgbaOut = (GLchan *) values; for (i = 0; i < count; i++) { - trb->TexImage->FetchTexelc(trb->TexImage, x[i], y[i] + trb->Yoffset, - z, rgbaOut + 4 * i); + GLfloat rgba[4]; + trb->TexImage->FetchTexelf(trb->TexImage, x[i], y[i] + trb->Yoffset, + z, rgba); + UNCLAMPED_FLOAT_TO_RGBA_CHAN(rgbaOut + 4 * i, rgba); } } else if (rb->DataType == GL_UNSIGNED_SHORT) { -- cgit v1.2.3 From 7e7f38a67d82191076b95f6faa0d419df68610da Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 5 Oct 2009 17:48:22 -0600 Subject: mesa: remove feature tests --- src/mesa/main/formats.c | 12 ------------ src/mesa/main/formats.h | 8 -------- src/mesa/main/texfetch.c | 4 ---- src/mesa/main/texfetch_tmp.h | 4 ---- 4 files changed, 28 deletions(-) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index ebe59f8960..c98e90d1c3 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -261,8 +261,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 8, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 1 /* BlockWidth/Height,Bytes */ }, - -#if FEATURE_EXT_texture_sRGB { MESA_FORMAT_SRGB8, GL_RGB, @@ -303,7 +301,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 8, 0, 0, 0, 0, 1, 1, 2 }, -#if FEATURE_texture_s3tc { MESA_FORMAT_SRGB_DXT1, /* Name */ GL_RGB, /* BaseFormat */ @@ -336,10 +333,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 16 /* 16 bytes per 4x4 block */ }, -#endif -#endif -#if FEATURE_texture_fxt1 { MESA_FORMAT_RGB_FXT1, GL_RGB, @@ -356,9 +350,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 8, 4, 16 /* 16 bytes per 8x4 block */ }, -#endif -#if FEATURE_texture_s3tc { MESA_FORMAT_RGB_DXT1, /* Name */ GL_RGB, /* BaseFormat */ @@ -391,8 +383,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 4, 4, 16 /* 16 bytes per 4x4 block */ }, -#endif - { MESA_FORMAT_RGBA_FLOAT32, GL_RGBA, @@ -489,7 +479,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 16, 0, 0, 0, 1, 1, 2 }, - { MESA_FORMAT_DUDV8, GL_DUDV_ATI, @@ -498,7 +487,6 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 1, 1, 2 }, - { MESA_FORMAT_SIGNED_RGBA8888, GL_RGBA, diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 316ff1a8ec..7a2a948991 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -79,7 +79,6 @@ typedef enum MESA_FORMAT_S8, /* SSSS SSSS */ /*@}*/ -#if FEATURE_EXT_texture_sRGB /** * \name 8-bit/channel sRGB formats */ @@ -89,29 +88,22 @@ typedef enum MESA_FORMAT_SARGB8, MESA_FORMAT_SL8, MESA_FORMAT_SLA8, -#if FEATURE_texture_s3tc MESA_FORMAT_SRGB_DXT1, MESA_FORMAT_SRGBA_DXT1, MESA_FORMAT_SRGBA_DXT3, MESA_FORMAT_SRGBA_DXT5, -#endif /*@}*/ -#endif /** * \name Compressed texture formats. */ /*@{*/ -#if FEATURE_texture_fxt1 MESA_FORMAT_RGB_FXT1, MESA_FORMAT_RGBA_FXT1, -#endif -#if FEATURE_texture_s3tc MESA_FORMAT_RGB_DXT1, MESA_FORMAT_RGBA_DXT1, MESA_FORMAT_RGBA_DXT3, MESA_FORMAT_RGBA_DXT5, -#endif /*@}*/ /** diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c index 851659e9c5..fbb3170ff5 100644 --- a/src/mesa/main/texfetch.c +++ b/src/mesa/main/texfetch.c @@ -41,8 +41,6 @@ #include "texfetch.h" -#if FEATURE_EXT_texture_sRGB - /** * Convert an 8-bit sRGB value from non-linear space to a * linear RGB value in [0, 1]. @@ -71,8 +69,6 @@ nonlinear_to_linear(GLubyte cs8) } -#endif /* FEATURE_EXT_texture_sRGB */ - /* Texel fetch routines for all supported formats */ diff --git a/src/mesa/main/texfetch_tmp.h b/src/mesa/main/texfetch_tmp.h index 3ac932b979..43030c2985 100644 --- a/src/mesa/main/texfetch_tmp.h +++ b/src/mesa/main/texfetch_tmp.h @@ -989,8 +989,6 @@ static void store_texel_ci8(struct gl_texture_image *texImage, #endif -#if FEATURE_EXT_texture_sRGB - /* Fetch texel from 1D, 2D or 3D srgb8 texture, return 4 GLfloats */ /* Note: component order is same as for MESA_FORMAT_RGB888 */ static void FETCH(srgb8)(const struct gl_texture_image *texImage, @@ -1100,8 +1098,6 @@ static void store_texel_sla8(struct gl_texture_image *texImage, } #endif -#endif /* FEATURE_EXT_texture_sRGB */ - /* MESA_FORMAT_DUDV8 ********************************************************/ -- cgit v1.2.3 From be0765cd6ec47cf068775197f312a1123e044566 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 5 Oct 2009 17:50:33 -0600 Subject: mesa: move gl_format_info struct to formats.c This is a private datatype. --- src/mesa/main/formats.c | 37 +++++++++++++++++++++++++++++++++++++ src/mesa/main/formats.h | 38 -------------------------------------- 2 files changed, 37 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index c98e90d1c3..e38c51772d 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -30,6 +30,43 @@ #include "texstore.h" +/** + * Information about texture formats. + */ +struct gl_format_info +{ + gl_format Name; + + /** + * Base format is one of GL_RGB, GL_RGBA, GL_ALPHA, GL_LUMINANCE, + * GL_LUMINANCE_ALPHA, GL_INTENSITY, GL_COLOR_INDEX, GL_DEPTH_COMPONENT. + */ + GLenum BaseFormat; + + /** + * Logical data type: one of GL_UNSIGNED_NORMALIZED, GL_SIGNED_NORMALED, + * GL_UNSIGNED_INT, GL_SIGNED_INT, GL_FLOAT. + */ + GLenum DataType; + + GLubyte RedBits; + GLubyte GreenBits; + GLubyte BlueBits; + GLubyte AlphaBits; + GLubyte LuminanceBits; + GLubyte IntensityBits; + GLubyte IndexBits; + GLubyte DepthBits; + GLubyte StencilBits; + + /** + * To describe compressed formats. If not compressed, Width=Height=1. + */ + GLubyte BlockWidth, BlockHeight; + GLubyte BytesPerBlock; +}; + + /** * Info about each format. * These must be in the same order as the MESA_FORMAT_* enums so that diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 7a2a948991..723e237a57 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -137,44 +137,6 @@ typedef enum } gl_format; -/** - * Information about texture formats. - */ -struct gl_format_info -{ - gl_format Name; - - /** - * Base format is one of GL_RGB, GL_RGBA, GL_ALPHA, GL_LUMINANCE, - * GL_LUMINANCE_ALPHA, GL_INTENSITY, GL_COLOR_INDEX, GL_DEPTH_COMPONENT. - */ - GLenum BaseFormat; - - /** - * Logical data type: one of GL_UNSIGNED_NORMALIZED, GL_SIGNED_NORMALED, - * GL_UNSIGNED_INT, GL_SIGNED_INT, GL_FLOAT. - */ - GLenum DataType; - - GLubyte RedBits; - GLubyte GreenBits; - GLubyte BlueBits; - GLubyte AlphaBits; - GLubyte LuminanceBits; - GLubyte IntensityBits; - GLubyte IndexBits; - GLubyte DepthBits; - GLubyte StencilBits; - - /** - * To describe compressed formats. If not compressed, Width=Height=1. - */ - GLubyte BlockWidth, BlockHeight; - GLubyte BytesPerBlock; -}; - - - extern GLuint _mesa_get_format_bytes(gl_format format); -- cgit v1.2.3 From 019bc97bd900a84f5f999afdb42928e92d33814b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 5 Oct 2009 17:54:20 -0600 Subject: mesa: move _mesa_format_to_type_and_comps() to formats.c --- src/mesa/main/formats.c | 257 +++++++++++++++++++++++++++++----------------- src/mesa/main/formats.h | 7 +- src/mesa/main/mipmap.c | 1 - src/mesa/main/texformat.c | 179 -------------------------------- src/mesa/main/texformat.h | 4 - 5 files changed, 168 insertions(+), 280 deletions(-) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index e38c51772d..d3c8b1213b 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -734,109 +734,182 @@ _mesa_test_formats(void) } + /** - * XXX possible replacement for _mesa_format_to_type_and_comps() - * Used for mipmap generation. + * Return datatype and number of components per texel for the given gl_format. + * Only used for mipmap generation code. */ void -_mesa_format_to_type_and_comps2(gl_format format, - GLenum *datatype, GLuint *comps) +_mesa_format_to_type_and_comps(gl_format format, + GLenum *datatype, GLuint *comps) { - const struct gl_format_info *info = _mesa_get_format_info(format); - - /* We use a bunch of heuristics here. If this gets too ugly we could - * just encode the info the in the gl_format_info structures. - */ - if (info->BaseFormat == GL_RGB || - info->BaseFormat == GL_RGBA || - info->BaseFormat == GL_ALPHA) { - *comps = ((info->RedBits > 0) + - (info->GreenBits > 0) + - (info->BlueBits > 0) + - (info->AlphaBits > 0)); - - if (info->DataType== GL_FLOAT) { - if (info->RedBits == 32) - *datatype = GL_FLOAT; - else - *datatype = GL_HALF_FLOAT; - } - else if (info->GreenBits == 3) { - *datatype = GL_UNSIGNED_BYTE_3_3_2; - } - else if (info->GreenBits == 4) { - *datatype = GL_UNSIGNED_SHORT_4_4_4_4; - } - else if (info->GreenBits == 6) { - *datatype = GL_UNSIGNED_SHORT_5_6_5; - } - else if (info->GreenBits == 5) { - *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV; - } - else if (info->RedBits == 8) { - *datatype = GL_UNSIGNED_BYTE; - } - else { - ASSERT(info->RedBits == 16); - *datatype = GL_UNSIGNED_SHORT; - } - } - else if (info->BaseFormat == GL_LUMINANCE || - info->BaseFormat == GL_LUMINANCE_ALPHA) { - *comps = ((info->LuminanceBits > 0) + - (info->AlphaBits > 0)); - if (info->LuminanceBits == 8) { - *datatype = GL_UNSIGNED_BYTE; - } - else if (info->LuminanceBits == 16) { - *datatype = GL_UNSIGNED_SHORT; - } - else { - *datatype = GL_FLOAT; - } - } - else if (info->BaseFormat == GL_INTENSITY) { - *comps = 1; - if (info->IntensityBits == 8) { - *datatype = GL_UNSIGNED_BYTE; - } - else if (info->IntensityBits == 16) { - *datatype = GL_UNSIGNED_SHORT; - } - else { - *datatype = GL_FLOAT; - } - } - else if (info->BaseFormat == GL_COLOR_INDEX) { - *comps = 1; + switch (format) { + case MESA_FORMAT_RGBA8888: + case MESA_FORMAT_RGBA8888_REV: + case MESA_FORMAT_ARGB8888: + case MESA_FORMAT_ARGB8888_REV: + *datatype = GL_UNSIGNED_BYTE; + *comps = 4; + return; + case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR888: + *datatype = GL_UNSIGNED_BYTE; + *comps = 3; + return; + case MESA_FORMAT_RGB565: + case MESA_FORMAT_RGB565_REV: + *datatype = GL_UNSIGNED_SHORT_5_6_5; + *comps = 3; + return; + + case MESA_FORMAT_ARGB4444: + case MESA_FORMAT_ARGB4444_REV: + *datatype = GL_UNSIGNED_SHORT_4_4_4_4; + *comps = 4; + return; + + case MESA_FORMAT_ARGB1555: + case MESA_FORMAT_ARGB1555_REV: + *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV; + *comps = 4; + return; + + case MESA_FORMAT_AL88: + case MESA_FORMAT_AL88_REV: + *datatype = GL_UNSIGNED_BYTE; + *comps = 2; + return; + case MESA_FORMAT_RGB332: + *datatype = GL_UNSIGNED_BYTE_3_3_2; + *comps = 3; + return; + + case MESA_FORMAT_A8: + case MESA_FORMAT_L8: + case MESA_FORMAT_I8: + case MESA_FORMAT_CI8: *datatype = GL_UNSIGNED_BYTE; - } - else if (info->BaseFormat == GL_DEPTH_COMPONENT) { - *comps = 1; - if (info->DepthBits == 16) { - *datatype = GL_UNSIGNED_SHORT; - } - else { - ASSERT(info->DepthBits == 32); - *datatype = GL_UNSIGNED_INT; - } - } - else if (info->BaseFormat == GL_DEPTH_STENCIL) { *comps = 1; - *datatype = GL_UNSIGNED_INT; - } - else if (info->BaseFormat == GL_YCBCR_MESA) { + return; + + case MESA_FORMAT_YCBCR: + case MESA_FORMAT_YCBCR_REV: + *datatype = GL_UNSIGNED_SHORT; *comps = 2; + return; + + case MESA_FORMAT_Z24_S8: + *datatype = GL_UNSIGNED_INT; + *comps = 1; /* XXX OK? */ + return; + + case MESA_FORMAT_S8_Z24: + *datatype = GL_UNSIGNED_INT; + *comps = 1; /* XXX OK? */ + return; + + case MESA_FORMAT_Z16: *datatype = GL_UNSIGNED_SHORT; - } - else if (info->BaseFormat == GL_DUDV_ATI) { + *comps = 1; + return; + + case MESA_FORMAT_Z32: + *datatype = GL_UNSIGNED_INT; + *comps = 1; + return; + + case MESA_FORMAT_DUDV8: + *datatype = GL_BYTE; *comps = 2; + return; + + case MESA_FORMAT_SIGNED_RGBA8888: + case MESA_FORMAT_SIGNED_RGBA8888_REV: *datatype = GL_BYTE; - } - else { - /* any other formats? */ - ASSERT(0); + *comps = 4; + return; + +#if FEATURE_EXT_texture_sRGB + case MESA_FORMAT_SRGB8: + *datatype = GL_UNSIGNED_BYTE; + *comps = 3; + return; + case MESA_FORMAT_SRGBA8: + case MESA_FORMAT_SARGB8: + *datatype = GL_UNSIGNED_BYTE; + *comps = 4; + return; + case MESA_FORMAT_SL8: + *datatype = GL_UNSIGNED_BYTE; *comps = 1; + return; + case MESA_FORMAT_SLA8: + *datatype = GL_UNSIGNED_BYTE; + *comps = 2; + return; +#endif + +#if FEATURE_texture_fxt1 + case MESA_FORMAT_RGB_FXT1: + case MESA_FORMAT_RGBA_FXT1: +#endif +#if FEATURE_texture_s3tc + case MESA_FORMAT_RGB_DXT1: + case MESA_FORMAT_RGBA_DXT1: + case MESA_FORMAT_RGBA_DXT3: + case MESA_FORMAT_RGBA_DXT5: +#if FEATURE_EXT_texture_sRGB + case MESA_FORMAT_SRGB_DXT1: + case MESA_FORMAT_SRGBA_DXT1: + case MESA_FORMAT_SRGBA_DXT3: + case MESA_FORMAT_SRGBA_DXT5: +#endif + /* XXX generate error instead? */ *datatype = GL_UNSIGNED_BYTE; + *comps = 0; + return; +#endif + + case MESA_FORMAT_RGBA_FLOAT32: + *datatype = GL_FLOAT; + *comps = 4; + return; + case MESA_FORMAT_RGBA_FLOAT16: + *datatype = GL_HALF_FLOAT_ARB; + *comps = 4; + return; + case MESA_FORMAT_RGB_FLOAT32: + *datatype = GL_FLOAT; + *comps = 3; + return; + case MESA_FORMAT_RGB_FLOAT16: + *datatype = GL_HALF_FLOAT_ARB; + *comps = 3; + return; + case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: + *datatype = GL_FLOAT; + *comps = 2; + return; + case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: + *datatype = GL_HALF_FLOAT_ARB; + *comps = 2; + return; + case MESA_FORMAT_ALPHA_FLOAT32: + case MESA_FORMAT_LUMINANCE_FLOAT32: + case MESA_FORMAT_INTENSITY_FLOAT32: + *datatype = GL_FLOAT; + *comps = 1; + return; + case MESA_FORMAT_ALPHA_FLOAT16: + case MESA_FORMAT_LUMINANCE_FLOAT16: + case MESA_FORMAT_INTENSITY_FLOAT16: + *datatype = GL_HALF_FLOAT_ARB; + *comps = 1; + return; + + default: + _mesa_problem(NULL, "bad format in _mesa_format_to_type_and_comps"); + *datatype = 0; + *comps = 1; } } diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 723e237a57..6aebb85f2b 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -152,10 +152,6 @@ _mesa_get_format_base_format(gl_format format); extern GLboolean _mesa_is_format_compressed(gl_format format); -extern void -_mesa_format_to_type_and_comps2(gl_format format, - GLenum *datatype, GLuint *comps); - extern GLuint _mesa_format_image_size(gl_format format, GLsizei width, GLsizei height, GLsizei depth); @@ -163,6 +159,9 @@ _mesa_format_image_size(gl_format format, GLsizei width, extern GLint _mesa_format_row_stride(gl_format format, GLsizei width); +extern void +_mesa_format_to_type_and_comps(gl_format format, + GLenum *datatype, GLuint *comps); extern void _mesa_test_formats(void); diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index e24e7285c3..694d593330 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -31,7 +31,6 @@ #include "formats.h" #include "mipmap.h" #include "texcompress.h" -#include "texformat.h" #include "teximage.h" #include "texstore.h" #include "image.h" diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index b1ae324050..038dc0bb50 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -362,182 +362,3 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, return MESA_FORMAT_NONE; } - - -/** - * Return datatype and number of components per texel for the given gl_format. - */ -void -_mesa_format_to_type_and_comps(gl_format format, - GLenum *datatype, GLuint *comps) -{ - switch (format) { - case MESA_FORMAT_RGBA8888: - case MESA_FORMAT_RGBA8888_REV: - case MESA_FORMAT_ARGB8888: - case MESA_FORMAT_ARGB8888_REV: - *datatype = CHAN_TYPE; - *comps = 4; - return; - case MESA_FORMAT_RGB888: - case MESA_FORMAT_BGR888: - *datatype = GL_UNSIGNED_BYTE; - *comps = 3; - return; - case MESA_FORMAT_RGB565: - case MESA_FORMAT_RGB565_REV: - *datatype = GL_UNSIGNED_SHORT_5_6_5; - *comps = 3; - return; - - case MESA_FORMAT_ARGB4444: - case MESA_FORMAT_ARGB4444_REV: - *datatype = GL_UNSIGNED_SHORT_4_4_4_4; - *comps = 4; - return; - - case MESA_FORMAT_ARGB1555: - case MESA_FORMAT_ARGB1555_REV: - *datatype = GL_UNSIGNED_SHORT_1_5_5_5_REV; - *comps = 4; - return; - - case MESA_FORMAT_AL88: - case MESA_FORMAT_AL88_REV: - *datatype = GL_UNSIGNED_BYTE; - *comps = 2; - return; - case MESA_FORMAT_RGB332: - *datatype = GL_UNSIGNED_BYTE_3_3_2; - *comps = 3; - return; - - case MESA_FORMAT_A8: - case MESA_FORMAT_L8: - case MESA_FORMAT_I8: - case MESA_FORMAT_CI8: - *datatype = GL_UNSIGNED_BYTE; - *comps = 1; - return; - - case MESA_FORMAT_YCBCR: - case MESA_FORMAT_YCBCR_REV: - *datatype = GL_UNSIGNED_SHORT; - *comps = 2; - return; - - case MESA_FORMAT_Z24_S8: - *datatype = GL_UNSIGNED_INT; - *comps = 1; /* XXX OK? */ - return; - - case MESA_FORMAT_S8_Z24: - *datatype = GL_UNSIGNED_INT; - *comps = 1; /* XXX OK? */ - return; - - case MESA_FORMAT_Z16: - *datatype = GL_UNSIGNED_SHORT; - *comps = 1; - return; - - case MESA_FORMAT_Z32: - *datatype = GL_UNSIGNED_INT; - *comps = 1; - return; - - case MESA_FORMAT_DUDV8: - *datatype = GL_BYTE; - *comps = 2; - return; - - case MESA_FORMAT_SIGNED_RGBA8888: - case MESA_FORMAT_SIGNED_RGBA8888_REV: - *datatype = GL_BYTE; - *comps = 4; - return; - -#if FEATURE_EXT_texture_sRGB - case MESA_FORMAT_SRGB8: - *datatype = GL_UNSIGNED_BYTE; - *comps = 3; - return; - case MESA_FORMAT_SRGBA8: - case MESA_FORMAT_SARGB8: - *datatype = GL_UNSIGNED_BYTE; - *comps = 4; - return; - case MESA_FORMAT_SL8: - *datatype = GL_UNSIGNED_BYTE; - *comps = 1; - return; - case MESA_FORMAT_SLA8: - *datatype = GL_UNSIGNED_BYTE; - *comps = 2; - return; -#endif - -#if FEATURE_texture_fxt1 - case MESA_FORMAT_RGB_FXT1: - case MESA_FORMAT_RGBA_FXT1: -#endif -#if FEATURE_texture_s3tc - case MESA_FORMAT_RGB_DXT1: - case MESA_FORMAT_RGBA_DXT1: - case MESA_FORMAT_RGBA_DXT3: - case MESA_FORMAT_RGBA_DXT5: -#if FEATURE_EXT_texture_sRGB - case MESA_FORMAT_SRGB_DXT1: - case MESA_FORMAT_SRGBA_DXT1: - case MESA_FORMAT_SRGBA_DXT3: - case MESA_FORMAT_SRGBA_DXT5: -#endif - /* XXX generate error instead? */ - *datatype = GL_UNSIGNED_BYTE; - *comps = 0; - return; -#endif - - case MESA_FORMAT_RGBA_FLOAT32: - *datatype = GL_FLOAT; - *comps = 4; - return; - case MESA_FORMAT_RGBA_FLOAT16: - *datatype = GL_HALF_FLOAT_ARB; - *comps = 4; - return; - case MESA_FORMAT_RGB_FLOAT32: - *datatype = GL_FLOAT; - *comps = 3; - return; - case MESA_FORMAT_RGB_FLOAT16: - *datatype = GL_HALF_FLOAT_ARB; - *comps = 3; - return; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: - *datatype = GL_FLOAT; - *comps = 2; - return; - case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: - *datatype = GL_HALF_FLOAT_ARB; - *comps = 2; - return; - case MESA_FORMAT_ALPHA_FLOAT32: - case MESA_FORMAT_LUMINANCE_FLOAT32: - case MESA_FORMAT_INTENSITY_FLOAT32: - *datatype = GL_FLOAT; - *comps = 1; - return; - case MESA_FORMAT_ALPHA_FLOAT16: - case MESA_FORMAT_LUMINANCE_FLOAT16: - case MESA_FORMAT_INTENSITY_FLOAT16: - *datatype = GL_HALF_FLOAT_ARB; - *comps = 1; - return; - - default: - _mesa_problem(NULL, "bad format in _mesa_format_to_type_and_comps"); - *datatype = 0; - *comps = 1; - } -} diff --git a/src/mesa/main/texformat.h b/src/mesa/main/texformat.h index 0711b67da1..bda5fd6d8c 100644 --- a/src/mesa/main/texformat.h +++ b/src/mesa/main/texformat.h @@ -36,8 +36,4 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, GLenum format, GLenum type ); -extern void -_mesa_format_to_type_and_comps(gl_format format, - GLenum *datatype, GLuint *comps); - #endif -- cgit v1.2.3 From 90cd968300b8490f6efd75ef751fd3b6554f16d3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 5 Oct 2009 17:56:31 -0600 Subject: mesa: don't include texformat.h --- src/mesa/main/debug.c | 1 - src/mesa/main/texcompress.c | 1 - src/mesa/main/texcompress_fxt1.c | 1 - src/mesa/main/texcompress_s3tc.c | 1 - src/mesa/main/texgetimage.c | 2 +- src/mesa/main/teximage.c | 1 - src/mesa/main/texstore.c | 1 - 7 files changed, 1 insertion(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 391180a7c6..e55c2f02c9 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -35,7 +35,6 @@ #include "readpix.h" #include "texgetimage.h" #include "texobj.h" -#include "texformat.h" /** diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index a2b1218d0c..5713b2c00d 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -38,7 +38,6 @@ #include "image.h" #include "mipmap.h" #include "texcompress.h" -#include "texformat.h" #include "texstore.h" diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index 7a30806b60..ef42fb92b7 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -38,7 +38,6 @@ #include "mipmap.h" #include "texcompress.h" #include "texcompress_fxt1.h" -#include "texformat.h" #include "texstore.h" diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index 2f7168c622..9fc73fec51 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -42,7 +42,6 @@ #include "image.h" #include "texcompress.h" #include "texcompress_s3tc.h" -#include "texformat.h" #include "texstore.h" #ifdef __MINGW32__ diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 341ce6103f..d5cd4b2b9d 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -32,9 +32,9 @@ #include "glheader.h" #include "bufferobj.h" #include "context.h" +#include "formats.h" #include "image.h" #include "texcompress.h" -#include "texformat.h" #include "texgetimage.h" #include "teximage.h" #include "texstate.h" diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 457380b8fa..52d2886d0a 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -44,7 +44,6 @@ #include "state.h" #include "texcompress.h" #include "texfetch.h" -#include "texformat.h" #include "teximage.h" #include "texstate.h" #include "texstore.h" diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 52502b7033..83e349d010 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -64,7 +64,6 @@ #include "texcompress.h" #include "texcompress_fxt1.h" #include "texcompress_s3tc.h" -#include "texformat.h" #include "teximage.h" #include "texstore.h" #include "enums.h" -- cgit v1.2.3 From 3e34a2a2b97e7c93955deedb7c12b73bccd6662d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 5 Oct 2009 18:11:35 -0600 Subject: drivers: don't include texformat.h And remove other unneeded #includes while we're at it. --- src/mesa/drivers/dri/gamma/gamma_tex.c | 13 +++++-------- src/mesa/drivers/dri/i810/i810tex.c | 1 - src/mesa/drivers/dri/i810/i810texmem.c | 1 - src/mesa/drivers/dri/i810/i810texstate.c | 1 - src/mesa/drivers/dri/i915/i830_texblend.c | 1 - src/mesa/drivers/dri/i915/i830_texstate.c | 1 - src/mesa/drivers/dri/i915/i830_vtbl.c | 1 - src/mesa/drivers/dri/i915/i915_texstate.c | 1 - src/mesa/drivers/dri/i915/i915_vtbl.c | 1 - src/mesa/drivers/dri/i965/brw_vs_surface_state.c | 1 - src/mesa/drivers/dri/i965/brw_wm.c | 1 - src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 1 - src/mesa/drivers/dri/intel/intel_blit.c | 1 - src/mesa/drivers/dri/intel/intel_fbo.c | 1 - src/mesa/drivers/dri/intel/intel_span.c | 1 - src/mesa/drivers/dri/intel/intel_tex_format.c | 1 - src/mesa/drivers/dri/intel/intel_tex_image.c | 1 - src/mesa/drivers/dri/mach64/mach64_tex.c | 1 - src/mesa/drivers/dri/mach64/mach64_texmem.c | 11 +++++------ src/mesa/drivers/dri/mach64/mach64_texstate.c | 1 - src/mesa/drivers/dri/mga/mga_texstate.c | 15 ++++++--------- src/mesa/drivers/dri/mga/mgatex.c | 13 ++++++------- src/mesa/drivers/dri/r128/r128_tex.c | 1 - src/mesa/drivers/dri/r128/r128_texmem.c | 1 - src/mesa/drivers/dri/r128/r128_texstate.c | 1 - src/mesa/drivers/dri/r200/r200_tex.c | 1 - src/mesa/drivers/dri/r200/r200_texstate.c | 1 - src/mesa/drivers/dri/r300/r300_state.c | 1 - src/mesa/drivers/dri/r300/r300_tex.c | 1 - src/mesa/drivers/dri/r300/r300_texstate.c | 1 - src/mesa/drivers/dri/r600/r600_tex.c | 1 - src/mesa/drivers/dri/r600/r600_texstate.c | 1 - src/mesa/drivers/dri/r600/r700_state.c | 1 - src/mesa/drivers/dri/radeon/radeon_fbo.c | 1 - src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 1 - src/mesa/drivers/dri/radeon/radeon_tex.c | 1 - src/mesa/drivers/dri/radeon/radeon_texstate.c | 1 - src/mesa/drivers/dri/radeon/radeon_texture.c | 1 - src/mesa/drivers/dri/s3v/s3v_tex.c | 4 ---- src/mesa/drivers/dri/savage/savage_xmesa.c | 2 +- src/mesa/drivers/dri/savage/savagetex.c | 23 +++++++++-------------- src/mesa/drivers/dri/sis/sis_tex.c | 8 +++----- src/mesa/drivers/dri/sis/sis_texstate.c | 1 - src/mesa/drivers/dri/tdfx/tdfx_state.c | 1 - src/mesa/drivers/dri/tdfx/tdfx_tex.c | 1 - src/mesa/drivers/dri/unichrome/via_tex.c | 3 +-- 46 files changed, 36 insertions(+), 93 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/gamma/gamma_tex.c b/src/mesa/drivers/dri/gamma/gamma_tex.c index 97797d4788..0dad250e4d 100644 --- a/src/mesa/drivers/dri/gamma/gamma_tex.c +++ b/src/mesa/drivers/dri/gamma/gamma_tex.c @@ -1,21 +1,18 @@ -#include -#include - #include "main/glheader.h" #include "main/mtypes.h" +#include "main/colormac.h" #include "main/imports.h" #include "main/simple_list.h" #include "main/enums.h" +#include "main/mm.h" #include "main/texstore.h" -#include "teximage.h" -#include "main/texformat.h" -#include "texobj.h" +#include "main/teximage.h" +#include "main/texobj.h" + #include "swrast/swrast.h" -#include "main/mm.h" #include "gammacontext.h" -#include "colormac.h" /* diff --git a/src/mesa/drivers/dri/i810/i810tex.c b/src/mesa/drivers/dri/i810/i810tex.c index 8166393eb1..2f6978f5aa 100644 --- a/src/mesa/drivers/dri/i810/i810tex.c +++ b/src/mesa/drivers/dri/i810/i810tex.c @@ -28,7 +28,6 @@ #include "main/simple_list.h" #include "main/enums.h" #include "main/texstore.h" -#include "main/texformat.h" #include "main/teximage.h" #include "main/texobj.h" #include "main/colormac.h" diff --git a/src/mesa/drivers/dri/i810/i810texmem.c b/src/mesa/drivers/dri/i810/i810texmem.c index c2a5d95fc7..d93afbf9ef 100644 --- a/src/mesa/drivers/dri/i810/i810texmem.c +++ b/src/mesa/drivers/dri/i810/i810texmem.c @@ -30,7 +30,6 @@ #include "main/enums.h" #include "main/colormac.h" #include "main/mm.h" -#include "main/texformat.h" #include "i810screen.h" #include "i810_dri.h" diff --git a/src/mesa/drivers/dri/i810/i810texstate.c b/src/mesa/drivers/dri/i810/i810texstate.c index b873ddbecb..bff28c11c8 100644 --- a/src/mesa/drivers/dri/i810/i810texstate.c +++ b/src/mesa/drivers/dri/i810/i810texstate.c @@ -25,7 +25,6 @@ #include "main/glheader.h" #include "main/macros.h" #include "main/mtypes.h" -#include "main/texformat.h" #include "main/simple_list.h" #include "main/enums.h" #include "main/mm.h" diff --git a/src/mesa/drivers/dri/i915/i830_texblend.c b/src/mesa/drivers/dri/i915/i830_texblend.c index 09f7f37e76..3f64be8c96 100644 --- a/src/mesa/drivers/dri/i915/i830_texblend.c +++ b/src/mesa/drivers/dri/i915/i830_texblend.c @@ -30,7 +30,6 @@ #include "main/mtypes.h" #include "main/simple_list.h" #include "main/enums.h" -#include "main/texformat.h" #include "main/texstore.h" #include "main/mm.h" diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index 837ae57074..98fb853c68 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -27,7 +27,6 @@ #include "main/mtypes.h" #include "main/enums.h" -#include "main/texformat.h" #include "intel_mipmap_tree.h" #include "intel_tex.h" diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index d53900b329..22f8bc7f19 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -26,7 +26,6 @@ **************************************************************************/ #include "glapi/glapi.h" -#include "main/texformat.h" #include "i830_context.h" #include "i830_reg.h" diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index d6f6cfdb49..03ed8a6311 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -27,7 +27,6 @@ #include "main/mtypes.h" #include "main/enums.h" -#include "main/texformat.h" #include "intel_mipmap_tree.h" #include "intel_tex.h" diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index 1c3da63da9..a4b00b06e7 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -32,7 +32,6 @@ #include "main/imports.h" #include "main/macros.h" #include "main/colormac.h" -#include "main/texformat.h" #include "tnl/t_context.h" #include "tnl/t_vertex.h" diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c index 89f47522a1..4fa3269bed 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c @@ -30,7 +30,6 @@ */ #include "main/mtypes.h" -#include "main/texformat.h" #include "main/texstore.h" #include "shader/prog_parameter.h" diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 46df778bee..5a2ac1a651 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -29,7 +29,6 @@ * Keith Whitwell */ -#include "main/texformat.h" #include "brw_context.h" #include "brw_util.h" #include "brw_wm.h" 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 855fe7593d..ea559d2ac7 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -31,7 +31,6 @@ #include "main/mtypes.h" -#include "main/texformat.h" #include "main/texstore.h" #include "shader/prog_parameter.h" diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index 799b22cc90..0158bd309f 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -29,7 +29,6 @@ #include "main/mtypes.h" #include "main/context.h" #include "main/enums.h" -#include "main/texformat.h" #include "main/colormac.h" #include "intel_blit.h" diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 1be381b9ea..3b4b90f2dc 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -33,7 +33,6 @@ #include "main/framebuffer.h" #include "main/renderbuffer.h" #include "main/context.h" -#include "main/texformat.h" #include "main/texrender.h" #include "drivers/common/meta.h" diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index f754ce0cd1..5bbcce6fe4 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -29,7 +29,6 @@ #include "main/macros.h" #include "main/mtypes.h" #include "main/colormac.h" -#include "main/texformat.h" #include "intel_buffers.h" #include "intel_fbo.h" diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c index 22c010bbd7..eca0f6d572 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_format.c +++ b/src/mesa/drivers/dri/intel/intel_tex_format.c @@ -1,7 +1,6 @@ #include "intel_context.h" #include "intel_tex.h" #include "intel_chipset.h" -#include "main/texformat.h" #include "main/enums.h" diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index f32ff0dd05..b159010b8e 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -7,7 +7,6 @@ #include "main/convolve.h" #include "main/context.h" #include "main/texcompress.h" -#include "main/texformat.h" #include "main/texstore.h" #include "main/texgetimage.h" #include "main/texobj.h" diff --git a/src/mesa/drivers/dri/mach64/mach64_tex.c b/src/mesa/drivers/dri/mach64/mach64_tex.c index 02433e5dd8..cce0e4d3ff 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tex.c +++ b/src/mesa/drivers/dri/mach64/mach64_tex.c @@ -41,7 +41,6 @@ #include "main/simple_list.h" #include "main/enums.h" #include "main/texstore.h" -#include "main/texformat.h" #include "main/teximage.h" #include "main/texobj.h" #include "main/imports.h" diff --git a/src/mesa/drivers/dri/mach64/mach64_texmem.c b/src/mesa/drivers/dri/mach64/mach64_texmem.c index e83aeae3e1..b97e9eec25 100644 --- a/src/mesa/drivers/dri/mach64/mach64_texmem.c +++ b/src/mesa/drivers/dri/mach64/mach64_texmem.c @@ -31,6 +31,11 @@ * Jose Fonseca */ +#include "main/context.h" +#include "main/macros.h" +#include "main/simple_list.h" +#include "main/imports.h" + #include "mach64_context.h" #include "mach64_state.h" #include "mach64_ioctl.h" @@ -38,12 +43,6 @@ #include "mach64_tris.h" #include "mach64_tex.h" -#include "main/context.h" -#include "main/macros.h" -#include "main/simple_list.h" -#include "main/texformat.h" -#include "main/imports.h" - /* Destroy hardware state associated with texture `t'. */ diff --git a/src/mesa/drivers/dri/mach64/mach64_texstate.c b/src/mesa/drivers/dri/mach64/mach64_texstate.c index c333355324..df0a09a5c1 100644 --- a/src/mesa/drivers/dri/mach64/mach64_texstate.c +++ b/src/mesa/drivers/dri/mach64/mach64_texstate.c @@ -33,7 +33,6 @@ #include "main/imports.h" #include "main/context.h" #include "main/macros.h" -#include "main/texformat.h" #include "mach64_context.h" #include "mach64_ioctl.h" diff --git a/src/mesa/drivers/dri/mga/mga_texstate.c b/src/mesa/drivers/dri/mga/mga_texstate.c index d52f0fac75..54eda62a96 100644 --- a/src/mesa/drivers/dri/mga/mga_texstate.c +++ b/src/mesa/drivers/dri/mga/mga_texstate.c @@ -27,22 +27,19 @@ * Keith Whitwell */ -#include +#include "main/context.h" +#include "main/enums.h" +#include "main/macros.h" #include "main/mm.h" +#include "main/imports.h" +#include "main/simple_list.h" + #include "mgacontext.h" #include "mgatex.h" #include "mgaregs.h" #include "mgatris.h" #include "mgaioctl.h" -#include "main/context.h" -#include "main/enums.h" -#include "main/macros.h" -#include "main/imports.h" - -#include "main/simple_list.h" -#include "main/texformat.h" - #define MGA_USE_TABLE_FOR_FORMAT #ifdef MGA_USE_TABLE_FOR_FORMAT #define TMC_nr_tformat (MESA_FORMAT_YCBCR_REV + 1) diff --git a/src/mesa/drivers/dri/mga/mgatex.c b/src/mesa/drivers/dri/mga/mgatex.c index 71a8400e3b..9163371b33 100644 --- a/src/mesa/drivers/dri/mga/mgatex.c +++ b/src/mesa/drivers/dri/mga/mgatex.c @@ -27,23 +27,22 @@ #include "main/glheader.h" #include "main/mm.h" -#include "mgacontext.h" -#include "mgatex.h" -#include "mgaregs.h" -#include "mgatris.h" -#include "mgaioctl.h" - #include "main/colormac.h" #include "main/context.h" #include "main/enums.h" #include "main/simple_list.h" #include "main/imports.h" #include "main/macros.h" -#include "main/texformat.h" #include "main/texstore.h" #include "main/teximage.h" #include "main/texobj.h" +#include "mgacontext.h" +#include "mgatex.h" +#include "mgaregs.h" +#include "mgatris.h" +#include "mgaioctl.h" + #include "swrast/swrast.h" #include "xmlpool.h" diff --git a/src/mesa/drivers/dri/r128/r128_tex.c b/src/mesa/drivers/dri/r128/r128_tex.c index 6acda445f7..0a1207fb89 100644 --- a/src/mesa/drivers/dri/r128/r128_tex.c +++ b/src/mesa/drivers/dri/r128/r128_tex.c @@ -44,7 +44,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/simple_list.h" #include "main/enums.h" #include "main/texstore.h" -#include "main/texformat.h" #include "main/teximage.h" #include "main/texobj.h" #include "main/imports.h" diff --git a/src/mesa/drivers/dri/r128/r128_texmem.c b/src/mesa/drivers/dri/r128/r128_texmem.c index 84f8563b89..4ddcb86bcd 100644 --- a/src/mesa/drivers/dri/r128/r128_texmem.c +++ b/src/mesa/drivers/dri/r128/r128_texmem.c @@ -41,7 +41,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/context.h" #include "main/macros.h" #include "main/simple_list.h" -#include "main/texformat.h" #include "main/imports.h" #define TEX_0 1 diff --git a/src/mesa/drivers/dri/r128/r128_texstate.c b/src/mesa/drivers/dri/r128/r128_texstate.c index 2e71c25861..cb2b5f9536 100644 --- a/src/mesa/drivers/dri/r128/r128_texstate.c +++ b/src/mesa/drivers/dri/r128/r128_texstate.c @@ -36,7 +36,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/imports.h" #include "main/context.h" #include "main/macros.h" -#include "main/texformat.h" #include "r128_context.h" #include "r128_state.h" diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c index 36d9e37d87..5a21a8b9c5 100644 --- a/src/mesa/drivers/dri/r200/r200_tex.c +++ b/src/mesa/drivers/dri/r200/r200_tex.c @@ -38,7 +38,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/enums.h" #include "main/image.h" #include "main/simple_list.h" -#include "main/texformat.h" #include "main/texstore.h" #include "main/teximage.h" #include "main/texobj.h" diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index 1a6fa9f548..20ec6fffaf 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -36,7 +36,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/imports.h" #include "main/context.h" #include "main/macros.h" -#include "main/texformat.h" #include "main/teximage.h" #include "main/texobj.h" #include "main/enums.h" diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 3060f49aaf..ac20c08e20 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -45,7 +45,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/framebuffer.h" #include "main/simple_list.h" #include "main/api_arrayelt.h" -#include "main/texformat.h" #include "swrast/swrast.h" #include "swrast_setup/swrast_setup.h" diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c index 10daeca9e6..27b78a912f 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.c +++ b/src/mesa/drivers/dri/r300/r300_tex.c @@ -40,7 +40,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/image.h" #include "main/mipmap.h" #include "main/simple_list.h" -#include "main/texformat.h" #include "main/texstore.h" #include "main/teximage.h" #include "main/texobj.h" diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index cb826248f3..1e9bd3e849 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -39,7 +39,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/imports.h" #include "main/context.h" #include "main/macros.h" -#include "main/texformat.h" #include "main/teximage.h" #include "main/texobj.h" #include "main/enums.h" diff --git a/src/mesa/drivers/dri/r600/r600_tex.c b/src/mesa/drivers/dri/r600/r600_tex.c index 47081c968e..20965bb3c8 100644 --- a/src/mesa/drivers/dri/r600/r600_tex.c +++ b/src/mesa/drivers/dri/r600/r600_tex.c @@ -40,7 +40,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/image.h" #include "main/mipmap.h" #include "main/simple_list.h" -#include "main/texformat.h" #include "main/texstore.h" #include "main/teximage.h" #include "main/texobj.h" diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c index 55b455edc0..35186ef970 100644 --- a/src/mesa/drivers/dri/r600/r600_texstate.c +++ b/src/mesa/drivers/dri/r600/r600_texstate.c @@ -39,7 +39,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/imports.h" #include "main/context.h" #include "main/macros.h" -#include "main/texformat.h" #include "main/teximage.h" #include "main/texobj.h" #include "main/enums.h" diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index fbff109455..65f83b8315 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -46,7 +46,6 @@ #include "shader/prog_parameter.h" #include "shader/prog_statevars.h" #include "vbo/vbo.h" -#include "main/texformat.h" #include "r600_context.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 90ea2ec335..3f4f382d6c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -33,7 +33,6 @@ #include "main/framebuffer.h" #include "main/renderbuffer.h" #include "main/context.h" -#include "main/texformat.h" #include "main/texrender.h" #include "drivers/common/meta.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index 5429525587..86f596deb9 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -32,7 +32,6 @@ #include "main/simple_list.h" #include "main/texcompress.h" -#include "main/texformat.h" static GLuint radeon_compressed_texture_size(GLcontext *ctx, GLsizei width, GLsizei height, GLsizei depth, diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.c b/src/mesa/drivers/dri/radeon/radeon_tex.c index 99865fff27..60981aada2 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex.c +++ b/src/mesa/drivers/dri/radeon/radeon_tex.c @@ -38,7 +38,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/enums.h" #include "main/image.h" #include "main/simple_list.h" -#include "main/texformat.h" #include "main/texstore.h" #include "main/teximage.h" #include "main/texobj.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index cb17f48bf3..c7786381ae 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -38,7 +38,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/colormac.h" #include "main/context.h" #include "main/macros.h" -#include "main/texformat.h" #include "main/teximage.h" #include "main/texobj.h" #include "main/enums.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 17e42e72ee..8e9276c5ae 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -34,7 +34,6 @@ #include "main/convolve.h" #include "main/mipmap.h" #include "main/texcompress.h" -#include "main/texformat.h" #include "main/texstore.h" #include "main/teximage.h" #include "main/texobj.h" diff --git a/src/mesa/drivers/dri/s3v/s3v_tex.c b/src/mesa/drivers/dri/s3v/s3v_tex.c index ec1182f34f..517f5e5ca7 100644 --- a/src/mesa/drivers/dri/s3v/s3v_tex.c +++ b/src/mesa/drivers/dri/s3v/s3v_tex.c @@ -2,16 +2,12 @@ * Author: Max Lingua */ -#include -#include - #include "main/glheader.h" #include "main/mtypes.h" #include "main/simple_list.h" #include "main/enums.h" #include "main/mm.h" #include "main/texstore.h" -#include "main/texformat.h" #include "main/teximage.h" #include "swrast/swrast.h" diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index 06179edae3..048fbe452c 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -574,7 +574,7 @@ savageDestroyContext(__DRIcontextPrivate *driContextPriv) _mesa_destroy_context(imesa->glCtx); /* no longer use vertex_dma_buf*/ - Xfree(imesa); + _mesa_free(imesa); } } diff --git a/src/mesa/drivers/dri/savage/savagetex.c b/src/mesa/drivers/dri/savage/savagetex.c index 796da4fc0d..6c97bb6c70 100644 --- a/src/mesa/drivers/dri/savage/savagetex.c +++ b/src/mesa/drivers/dri/savage/savagetex.c @@ -23,29 +23,24 @@ */ -#include -#include - -#include - +#include "main/context.h" #include "main/mm.h" -#include "savagecontext.h" -#include "savagetex.h" -#include "savagetris.h" -#include "savageioctl.h" -#include "main/simple_list.h" -#include "main/enums.h" -#include "savage_bci.h" - #include "main/macros.h" -#include "main/texformat.h" #include "main/texstore.h" #include "main/texobj.h" #include "main/convolve.h" #include "main/colormac.h" +#include "main/simple_list.h" +#include "main/enums.h" #include "swrast/swrast.h" +#include "savagecontext.h" +#include "savagetex.h" +#include "savagetris.h" +#include "savageioctl.h" +#include "savage_bci.h" + #include "xmlpool.h" #define TILE_INDEX_DXT1 0 diff --git a/src/mesa/drivers/dri/sis/sis_tex.c b/src/mesa/drivers/dri/sis/sis_tex.c index 5dc05146b1..951c470dad 100644 --- a/src/mesa/drivers/dri/sis/sis_tex.c +++ b/src/mesa/drivers/dri/sis/sis_tex.c @@ -28,17 +28,15 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * Eric Anholt */ -#include "sis_context.h" -#include "sis_alloc.h" -#include "sis_tex.h" - #include "swrast/swrast.h" #include "main/imports.h" -#include "main/texformat.h" #include "main/texstore.h" #include "main/teximage.h" #include "main/texobj.h" +#include "sis_context.h" +#include "sis_alloc.h" +#include "sis_tex.h" #include "xmlpool.h" #define ALIGN(value, align) (GLubyte *)((long)(value + align - 1) & ~(align - 1)) diff --git a/src/mesa/drivers/dri/sis/sis_texstate.c b/src/mesa/drivers/dri/sis/sis_texstate.c index 46417ce414..a507173b21 100644 --- a/src/mesa/drivers/dri/sis/sis_texstate.c +++ b/src/mesa/drivers/dri/sis/sis_texstate.c @@ -36,7 +36,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/colormac.h" #include "main/context.h" #include "main/macros.h" -#include "main/texformat.h" #include "sis_context.h" #include "sis_state.h" diff --git a/src/mesa/drivers/dri/tdfx/tdfx_state.c b/src/mesa/drivers/dri/tdfx/tdfx_state.c index 591df8a905..cf2712720f 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_state.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_state.c @@ -40,7 +40,6 @@ #include "main/mtypes.h" #include "main/colormac.h" -#include "main/texformat.h" #include "main/texstore.h" #include "main/teximage.h" diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index 5e9421aa2a..0cd9051613 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -42,7 +42,6 @@ #include "main/image.h" #include "main/mipmap.h" #include "main/texcompress.h" -#include "main/texformat.h" #include "main/teximage.h" #include "main/texstore.h" #include "main/texobj.h" diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index fa7542c5cb..a72dcd6be2 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -35,13 +35,12 @@ #include "main/convolve.h" #include "main/context.h" #include "main/mipmap.h" +#include "main/mm.h" #include "main/simple_list.h" #include "main/texcompress.h" -#include "main/texformat.h" #include "main/texobj.h" #include "main/texstore.h" -#include "main/mm.h" #include "via_context.h" #include "via_fb.h" #include "via_tex.h" -- cgit v1.2.3 From ce3c2b51a23c1f674b7a6e862d238c3935d72ca3 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 5 Oct 2009 18:11:25 -0700 Subject: i915g: Tweek vertexbuffer size --- src/gallium/drivers/i915/i915_prim_vbuf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/i915/i915_prim_vbuf.c b/src/gallium/drivers/i915/i915_prim_vbuf.c index 8a3e466c84..a7e1d4b45e 100644 --- a/src/gallium/drivers/i915/i915_prim_vbuf.c +++ b/src/gallium/drivers/i915/i915_prim_vbuf.c @@ -581,9 +581,9 @@ i915_vbuf_render_create(struct i915_context *i915) int i; i915_render->i915 = i915; - - i915_render->base.max_vertex_buffer_bytes = 128*1024; - + + i915_render->base.max_vertex_buffer_bytes = 16*4096; + /* NOTE: it must be such that state and vertices indices fit in a single * batch buffer. */ @@ -605,7 +605,7 @@ i915_vbuf_render_create(struct i915_context *i915) i915_render->vbo_offset = 0; i915_render->pool_used = FALSE; - i915_render->pool_buffer_size = 128 * 4096; + i915_render->pool_buffer_size = i915_render->base.max_vertex_buffer_bytes * 4; i915_render->pool_fifo = u_fifo_create(6); for (i = 0; i < 6; i++) u_fifo_add(i915_render->pool_fifo, -- cgit v1.2.3 From db8b363eb9fd03a377f8d1f1bab5b29c64a3caa7 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 5 Oct 2009 18:30:43 -0700 Subject: i915g: Add more defines to tweek batchbuffer --- .../winsys/drm/intel/gem/intel_drm_batchbuffer.c | 41 +++++++++++++++------- 1 file changed, 28 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/intel/gem/intel_drm_batchbuffer.c b/src/gallium/winsys/drm/intel/gem/intel_drm_batchbuffer.c index ebd1b607b7..5b4dafc8e4 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_drm_batchbuffer.c +++ b/src/gallium/winsys/drm/intel/gem/intel_drm_batchbuffer.c @@ -14,6 +14,8 @@ #undef INTEL_RUN_SYNC #undef INTEL_MAP_BATCHBUFFER +#undef INTEL_MAP_GTT +#define INTEL_ALWAYS_FLUSH struct intel_drm_batchbuffer { @@ -34,6 +36,7 @@ static void intel_drm_batchbuffer_reset(struct intel_drm_batchbuffer *batch) { struct intel_drm_winsys *idws = intel_drm_winsys(batch->base.iws); + int ret; if (batch->bo) drm_intel_bo_unreference(batch->bo); @@ -43,8 +46,15 @@ intel_drm_batchbuffer_reset(struct intel_drm_batchbuffer *batch) 4096); #ifdef INTEL_MAP_BATCHBUFFER - drm_intel_bo_map(batch->bo, TRUE); +#ifdef INTEL_MAP_GTT + ret = drm_intel_gem_bo_map_gtt(batch->bo); +#else + ret = drm_intel_bo_map(batch->bo, TRUE); +#endif + assert(ret == 0); batch->base.map = batch->bo->virtual; +#else + (void)ret; #endif memset(batch->base.map, 0, batch->actual_size); @@ -148,24 +158,29 @@ intel_drm_batchbuffer_flush(struct intel_batchbuffer *ibatch, used = batch->base.ptr - batch->base.map; assert((used & 3) == 0); - if (used & 4) { - // MI_FLUSH | FLUSH_MAP_CACHE; - intel_batchbuffer_dword(ibatch, (0x0<<29)|(0x4<<23)|(1<<0)); - // MI_NOOP - intel_batchbuffer_dword(ibatch, (0x0<<29)|(0x0<<23)); - // MI_BATCH_BUFFER_END; - intel_batchbuffer_dword(ibatch, (0x0<<29)|(0xA<<23)); - } else { - //MI_FLUSH | FLUSH_MAP_CACHE; - intel_batchbuffer_dword(ibatch, (0x0<<29)|(0x4<<23)|(1<<0)); - // MI_BATCH_BUFFER_END; - intel_batchbuffer_dword(ibatch, (0x0<<29)|(0xA<<23)); + +#ifdef INTEL_ALWAYS_FLUSH + /* MI_FLUSH | FLUSH_MAP_CACHE */ + intel_batchbuffer_dword(ibatch, (0x4<<23)|(1<<0)); + used += 4; +#endif + + if ((used & 4) == 0) { + /* MI_NOOP */ + intel_batchbuffer_dword(ibatch, 0); } + /* MI_BATCH_BUFFER_END */ + intel_batchbuffer_dword(ibatch, (0xA<<23)); used = batch->base.ptr - batch->base.map; + assert((used & 4) == 0); #ifdef INTEL_MAP_BATCHBUFFER +#ifdef INTEL_MAP_GTT + drm_intel_gem_bo_unmap_gtt(batch->bo); +#else drm_intel_bo_unmap(batch->bo); +#endif #else drm_intel_bo_subdata(batch->bo, 0, used, batch->base.map); #endif -- cgit v1.2.3 From 4911443d364e38bf93915cf9587f5cf8791cb30d Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Tue, 6 Oct 2009 13:18:09 +1000 Subject: nouveau: fix buffer object leak Very apparent with resizing windows on DRI2. --- src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c index 8b531830f4..f512c0e5f3 100644 --- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c +++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c @@ -197,6 +197,7 @@ nouveau_drm_pt_from_name(struct drm_api *api, struct pipe_screen *pscreen, unsigned stride, unsigned handle) { struct nouveau_device *dev = nouveau_screen(pscreen)->device; + struct pipe_texture *pt; struct pipe_buffer *pb; int ret; @@ -218,7 +219,9 @@ nouveau_drm_pt_from_name(struct drm_api *api, struct pipe_screen *pscreen, pb->usage = PIPE_BUFFER_USAGE_GPU_READ_WRITE | PIPE_BUFFER_USAGE_CPU_READ_WRITE; pb->size = nouveau_bo(pb)->size; - return pscreen->texture_blanket(pscreen, templ, &stride, pb); + pt = pscreen->texture_blanket(pscreen, templ, &stride, pb); + pipe_buffer_reference(&pb, NULL); + return pt; } static boolean -- cgit v1.2.3 From 340436d8d2f5f6360c2920de3a7547af95deb8f6 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Tue, 6 Oct 2009 13:55:48 +1000 Subject: nv50: fix segfault when there's gaps in enabled texture units Tested with progs/demos/multiarb. --- src/gallium/drivers/nv50/nv50_state_validate.c | 11 +++++++---- src/gallium/drivers/nv50/nv50_tex.c | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index 867b1ea872..fd27620371 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -356,13 +356,16 @@ viewport_uptodate: if (nv50->dirty & NV50_NEW_SAMPLER) { int i; - so = so_new(nv50->sampler_nr * 8 + 3, 0); + so = so_new(nv50->sampler_nr * 9 + 2, 0); so_method(so, tesla, NV50TCL_CB_ADDR, 1); so_data (so, NV50_CB_TSC); - so_method(so, tesla, NV50TCL_CB_DATA(0) | 0x40000000, - nv50->sampler_nr * 8); - for (i = 0; i < nv50->sampler_nr; i++) + for (i = 0; i < nv50->sampler_nr; i++) { + if (!nv50->sampler[i]) + continue; + + so_method(so, tesla, NV50TCL_CB_DATA(0) | (2<<29), 8); so_datap (so, nv50->sampler[i]->tsc, 8); + } so_ref(so, &nv50->state.tsc_upload); so_ref(NULL, &so); } diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index 21825a0411..72d33150af 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -157,6 +157,9 @@ nv50_tex_validate(struct nv50_context *nv50) for (unit = 0; unit < nv50->miptree_nr; unit++) { struct nv50_miptree *mt = nv50->miptree[unit]; + if (!mt) + continue; + so_method(so, tesla, NV50TCL_CB_DATA(0) | 0x40000000, 8); if (nv50_tex_construct(nv50, so, mt, unit)) { NOUVEAU_ERR("failed tex validate\n"); -- cgit v1.2.3 From ec58dac86d3068b47c5a4e0187ef56985dcbf75c Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Mon, 5 Oct 2009 09:38:52 +0300 Subject: r600: r700PredictRenderSize can flush, so move index buffer setup after it --- src/mesa/drivers/dri/r600/r700_render.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index 0aef0b7ea1..4f39d9f1bd 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -960,7 +960,6 @@ static GLboolean r700TryDrawPrims(GLcontext *ctx, _tnl_UpdateFixedFunctionProgram(ctx); r700SetVertexFormat(ctx, arrays, max_index + 1); - r700SetupIndexBuffer(ctx, ib); /* shaders need to be updated before buffers are validated */ r700UpdateShaders2(ctx); if (!r600ValidateBuffers(ctx)) @@ -981,6 +980,7 @@ static GLboolean r700TryDrawPrims(GLcontext *ctx, GLuint emit_end = r700PredictRenderSize(ctx, nr_prims) + context->radeon.cmdbuf.cs->cdw; + r700SetupIndexBuffer(ctx, ib); r700SetupStreams2(ctx, arrays, max_index + 1); radeonEmitState(radeon); -- cgit v1.2.3 From 9e42f0ebc7e538e0bff7c8c8539532ff2fc3c475 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Tue, 6 Oct 2009 20:07:38 +0200 Subject: r300/compiler: Fix regression in pair scheduling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle --- .../dri/r300/compiler/radeon_pair_schedule.c | 28 +++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c index ea01bb7881..df67aafe02 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_schedule.c @@ -179,8 +179,19 @@ static void commit_instruction(struct schedule_state * s, struct schedule_instru for(unsigned int i = 0; i < sinst->NumWriteValues; ++i) { struct reg_value * v = sinst->WriteValues[i]; - for(struct reg_value_reader * r = v->Readers; r; r = r->Next) { - decrease_dependencies(s, r->Reader); + if (v->NumReaders) { + for(struct reg_value_reader * r = v->Readers; r; r = r->Next) { + decrease_dependencies(s, r->Reader); + } + } else { + /* This happens in instruction sequences of the type + * OP r.x, ...; + * OP r.x, r.x, ...; + * See also the subtlety in how instructions that both + * read and write the same register are scanned. + */ + if (v->Next) + decrease_dependencies(s, v->Next->Writer); } } } @@ -360,6 +371,13 @@ static void scan_read(void * data, struct rc_instruction * inst, if (!v) return; + if (v->Writer == s->Current) { + /* The instruction reads and writes to a register component. + * In this case, we only want to increment dependencies by one. + */ + return; + } + DBG("%i: read %i[%i] chan %i\n", s->Current->Instruction->IP, file, index, chan); struct reg_value_reader * reader = memory_pool_malloc(&s->C->Pool, sizeof(*reader)); @@ -426,8 +444,12 @@ static void schedule_block(struct r300_fragment_program_compiler * c, DBG("%i: Scanning\n", inst->IP); - rc_for_all_reads(inst, &scan_read, &s); + /* The order of things here is subtle and maybe slightly + * counter-intuitive, to account for the case where an + * instruction writes to the same register as it reads + * from. */ rc_for_all_writes(inst, &scan_write, &s); + rc_for_all_reads(inst, &scan_read, &s); DBG("%i: Has %i dependencies\n", inst->IP, s.Current->NumDependencies); -- cgit v1.2.3 From a09bd685daa9f2eebf7c7b428dc0da4595dd6459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Tue, 6 Oct 2009 20:24:46 +0200 Subject: r300/compiler: Fix a really stupid logic inversion in the generic dataflow code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle --- src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c index 58dcb20d29..cce9166e64 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c @@ -44,7 +44,7 @@ static void reads_normal(struct rc_instruction * fullinst, rc_read_write_fn cb, for(unsigned int chan = 0; chan < 4; ++chan) refmask |= 1 << GET_SWZ(inst->SrcReg[src].Swizzle, chan); - refmask &= ~RC_MASK_XYZW; + refmask &= RC_MASK_XYZW; for(unsigned int chan = 0; chan < 4; ++chan) { if (GET_BIT(refmask, chan)) { -- cgit v1.2.3 From bcfba138cc7ffbf8163b29dc4a89520369a00f96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Tue, 6 Oct 2009 21:13:27 +0200 Subject: r300/compiler: Fix yet another regression in register allocation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle --- src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c b/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c index e39ac2f510..828d0c8e28 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_pair_regalloc.c @@ -177,6 +177,7 @@ static void scan_callback(void * data, struct rc_instruction * inst, reg->Live.Start = -1; else reg->Live.Start = inst->IP; + reg->Live.End = inst->IP; } else { if (inst->IP > reg->Live.End) reg->Live.End = inst->IP; -- cgit v1.2.3 From 57abb76e1095d14f54ea8b8d0d2220e209b8656f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Tue, 6 Oct 2009 21:24:44 +0200 Subject: r300/compiler: Fix R300 vertex program dumps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The source register field has 8 bits. Signed-off-by: Nicolai Hähnle --- src/mesa/drivers/dri/r300/compiler/r3xx_vertprog_dump.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog_dump.c b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog_dump.c index 980ef3eaea..66f9b0529f 100644 --- a/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog_dump.c +++ b/src/mesa/drivers/dri/r300/compiler/r3xx_vertprog_dump.c @@ -146,7 +146,7 @@ static void r300_vs_op_dump(uint32_t op) static void r300_vs_src_dump(uint32_t src) { fprintf(stderr, " reg: %d%s swiz: %s%s/%s%s/%s%s/%s%s\n", - (src >> 5) & 0x7f, r300_vs_src_debug[src & 0x3], + (src >> 5) & 0xff, r300_vs_src_debug[src & 0x3], src & (1 << 25) ? "-" : " ", r300_vs_swiz_debug[(src >> 13) & 0x7], src & (1 << 26) ? "-" : " ", -- cgit v1.2.3 From edfd2f7c4f942ed0c1aa1238ab0684ee7dd889a2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 6 Oct 2009 18:54:13 -0600 Subject: mesa: accept more pnames in _mesa_get_format_bits() --- src/mesa/main/formats.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index d3c8b1213b..9bc0509368 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -569,23 +569,42 @@ _mesa_get_format_bits(gl_format format, GLenum pname) const struct gl_format_info *info = _mesa_get_format_info(format); switch (pname) { + case GL_RED_BITS: case GL_TEXTURE_RED_SIZE: + case GL_RENDERBUFFER_RED_SIZE_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: return info->RedBits; + case GL_GREEN_BITS: case GL_TEXTURE_GREEN_SIZE: + case GL_RENDERBUFFER_GREEN_SIZE_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: return info->GreenBits; + case GL_BLUE_BITS: case GL_TEXTURE_BLUE_SIZE: + case GL_RENDERBUFFER_BLUE_SIZE_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: return info->BlueBits; + case GL_ALPHA_BITS: case GL_TEXTURE_ALPHA_SIZE: + case GL_RENDERBUFFER_ALPHA_SIZE_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: return info->AlphaBits; case GL_TEXTURE_INTENSITY_SIZE: return info->IntensityBits; case GL_TEXTURE_LUMINANCE_SIZE: return info->LuminanceBits; + case GL_INDEX_BITS: case GL_TEXTURE_INDEX_SIZE_EXT: return info->IndexBits; + case GL_DEPTH_BITS: case GL_TEXTURE_DEPTH_SIZE_ARB: + case GL_RENDERBUFFER_DEPTH_SIZE_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: return info->DepthBits; + case GL_STENCIL_BITS: case GL_TEXTURE_STENCIL_SIZE_EXT: + case GL_RENDERBUFFER_STENCIL_SIZE_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: return info->StencilBits; default: _mesa_problem(NULL, "bad pname in _mesa_get_format_bits()"); -- cgit v1.2.3 From f7b5e616e07b5caa27e91bb5733a8a849d5963f6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 6 Oct 2009 18:56:29 -0600 Subject: mesa: added _mesa_get_format_color_encoding() --- src/mesa/main/formats.c | 25 +++++++++++++++++++++++++ src/mesa/main/formats.h | 3 +++ 2 files changed, 28 insertions(+) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 9bc0509368..d1d8491391 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -637,6 +637,31 @@ _mesa_is_format_compressed(gl_format format) } +/** + * Return color encoding for given format. + * \return GL_LINEAR or GL_SRGB + */ +GLenum +_mesa_get_format_color_encoding(gl_format format) +{ + /* XXX this info should be encoded in gl_format_info */ + switch (format) { + 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_SRGB; + default: + return GL_LINEAR; + } +} + + /** * Return number of bytes needed to store an image of the given size * in the given format. diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 6aebb85f2b..fcedbe9be2 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -152,6 +152,9 @@ _mesa_get_format_base_format(gl_format format); extern GLboolean _mesa_is_format_compressed(gl_format format); +extern GLenum +_mesa_get_format_color_encoding(gl_format format); + extern GLuint _mesa_format_image_size(gl_format format, GLsizei width, GLsizei height, GLsizei depth); -- cgit v1.2.3 From c13b9a141d77845517bf7cab20cff6115c31e67d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 6 Oct 2009 19:00:09 -0600 Subject: mesa: added MESA_FORMAT_SIGNED_RGBA_16 for accum buffers --- src/mesa/main/formats.c | 9 ++++++++- src/mesa/main/formats.h | 1 + src/mesa/main/texfetch.c | 7 +++++++ src/mesa/main/texstore.c | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index d1d8491391..a1a8ea8835 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -540,7 +540,14 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, 1, 1, 4 }, - + { + MESA_FORMAT_SIGNED_RGBA_16, + GL_RGBA, + GL_SIGNED_NORMALIZED, + 16, 16, 16, 16, + 0, 0, 0, 0, 0, + 1, 1, 8 + } }; diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index fcedbe9be2..9da6d5d979 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -131,6 +131,7 @@ typedef enum MESA_FORMAT_DUDV8, MESA_FORMAT_SIGNED_RGBA8888, MESA_FORMAT_SIGNED_RGBA8888_REV, + MESA_FORMAT_SIGNED_RGBA_16, /*@}*/ MESA_FORMAT_COUNT, diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c index fbb3170ff5..63b2eacf55 100644 --- a/src/mesa/main/texfetch.c +++ b/src/mesa/main/texfetch.c @@ -333,6 +333,13 @@ texfetch_funcs[MESA_FORMAT_COUNT] = fetch_texel_3d_signed_rgba8888_rev, store_texel_signed_rgba8888_rev }, + { + MESA_FORMAT_SIGNED_RGBA_16, + NULL, /* XXX to do */ + NULL, + NULL, + NULL + }, { MESA_FORMAT_RGBA8888, fetch_texel_1d_f_rgba8888, diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 83e349d010..7754644da9 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3026,6 +3026,7 @@ texstore_funcs[MESA_FORMAT_COUNT] = { MESA_FORMAT_DUDV8, _mesa_texstore_dudv8 }, { MESA_FORMAT_SIGNED_RGBA8888, _mesa_texstore_signed_rgba8888 }, { MESA_FORMAT_SIGNED_RGBA8888_REV, _mesa_texstore_signed_rgba8888 }, + { MESA_FORMAT_SIGNED_RGBA_16, NULL }, }; -- cgit v1.2.3 From c5b725489243e6a94ca5e31306cdfa93619bd200 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 6 Oct 2009 19:01:43 -0600 Subject: mesa: added case for MESA_FORMAT_SIGNED_RGBA_16 --- src/mesa/main/formats.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index a1a8ea8835..483f993a75 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -879,6 +879,10 @@ _mesa_format_to_type_and_comps(gl_format format, *datatype = GL_BYTE; *comps = 4; return; + case MESA_FORMAT_SIGNED_RGBA_16: + *datatype = GL_SHORT; + *comps = 4; + return; #if FEATURE_EXT_texture_sRGB case MESA_FORMAT_SRGB8: -- cgit v1.2.3 From aec2c010f6dc2febcd5f3a10a0dc92738db68e1a Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Tue, 6 Oct 2009 22:07:47 -0400 Subject: nv04-nv40: Fix swizzle transfers for NPOT sizes. Workarounds not necessary, SIFM can handle NPOT, we just weren't setting dst dimensions properly. SIFM can't handle odd w,h though, that still needs fixing. --- src/gallium/drivers/nv04/nv04_surface_2d.c | 147 +++++++---------------------- 1 file changed, 34 insertions(+), 113 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv04/nv04_surface_2d.c b/src/gallium/drivers/nv04/nv04_surface_2d.c index f88e138c79..b2ab50ee21 100644 --- a/src/gallium/drivers/nv04/nv04_surface_2d.c +++ b/src/gallium/drivers/nv04/nv04_surface_2d.c @@ -1,5 +1,6 @@ #include "pipe/p_context.h" #include "pipe/p_format.h" +#include "util/u_math.h" #include "util/u_memory.h" #include "nouveau/nouveau_winsys.h" @@ -107,17 +108,20 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx, struct nouveau_bo *src_bo = nouveau_bo(ctx->buf(src)); struct nouveau_bo *dst_bo = nouveau_bo(ctx->buf(dst)); const unsigned src_pitch = ((struct nv04_surface *)src)->pitch; + /* Max width & height may not be the same on all HW, but must be POT */ const unsigned max_w = 1024; const unsigned max_h = 1024; - const unsigned sub_w = w > max_w ? max_w : w; - const unsigned sub_h = h > max_h ? max_h : h; - unsigned cx; - unsigned cy; + unsigned sub_w = w > max_w ? max_w : w; + unsigned sub_h = h > max_h ? max_h : h; + unsigned x; + unsigned y; -#if 0 - /* That's the way she likes it */ - assert(src_pitch == ((struct nv04_surface *)dst)->pitch); -#endif + /* Swizzled surfaces must be POT */ + assert(util_is_pot(dst->width) && util_is_pot(dst->height)); + + /* If area is too large to copy in one shot we must copy it in POT chunks to meet alignment requirements */ + assert(sub_w == w || util_is_pot(sub_w)); + assert(sub_h == h || util_is_pot(sub_h)); BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_DMA_IMAGE, 1); OUT_RELOCo(chan, dst_bo, @@ -125,8 +129,8 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx, BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_FORMAT, 1); OUT_RING (chan, nv04_surface_format(dst->format) | - log2i(w) << NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_U_SHIFT | - log2i(h) << NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_V_SHIFT); + log2i(dst->width) << NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_U_SHIFT | + log2i(dst->height) << NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_V_SHIFT); BEGIN_RING(chan, sifm, NV04_SCALED_IMAGE_FROM_MEMORY_DMA_IMAGE, 1); OUT_RELOCo(chan, src_bo, @@ -134,32 +138,37 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx, BEGIN_RING(chan, sifm, NV04_SCALED_IMAGE_FROM_MEMORY_SURFACE, 1); OUT_RING (chan, swzsurf->handle); - for (cy = 0; cy < h; cy += sub_h) { - for (cx = 0; cx < w; cx += sub_w) { + for (y = 0; y < h; y += sub_h) { + sub_h = MIN2(sub_h, h - y); + + for (x = 0; x < w; x += sub_w) { + sub_w = MIN2(sub_w, w - x); + + /* Must be 64-byte aligned */ + assert(!((dst->offset + nv04_swizzle_bits(dx+x, dy+y) * dst->texture->block.size) & 63)); + BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_OFFSET, 1); - OUT_RELOCl(chan, dst_bo, dst->offset + nv04_swizzle_bits(cx+dx, cy+dy) * - dst->texture->block.size, NOUVEAU_BO_GART | - NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); + OUT_RELOCl(chan, dst_bo, dst->offset + nv04_swizzle_bits(dx+x, dy+y) * dst->texture->block.size, + NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); BEGIN_RING(chan, sifm, NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION, 9); OUT_RING (chan, NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION_TRUNCATE); OUT_RING (chan, nv04_scaled_image_format(src->format)); OUT_RING (chan, NV04_SCALED_IMAGE_FROM_MEMORY_OPERATION_SRCCOPY); OUT_RING (chan, 0); - OUT_RING (chan, sub_h << 16 | sub_w); + OUT_RING (chan, sub_h << NV04_SCALED_IMAGE_FROM_MEMORY_CLIP_SIZE_H_SHIFT | sub_w); OUT_RING (chan, 0); - OUT_RING (chan, sub_h << 16 | sub_w); + OUT_RING (chan, sub_h << NV04_SCALED_IMAGE_FROM_MEMORY_OUT_SIZE_H_SHIFT | sub_w); OUT_RING (chan, 1 << 20); OUT_RING (chan, 1 << 20); BEGIN_RING(chan, sifm, NV04_SCALED_IMAGE_FROM_MEMORY_SIZE, 4); - OUT_RING (chan, sub_h << 16 | sub_w); + OUT_RING (chan, sub_h << NV04_SCALED_IMAGE_FROM_MEMORY_SIZE_H_SHIFT | sub_w); OUT_RING (chan, src_pitch | NV04_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CENTER | NV04_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_POINT_SAMPLE); - OUT_RELOCl(chan, src_bo, src->offset + (cy+sy) * src_pitch + - (cx+sx) * src->texture->block.size, NOUVEAU_BO_GART | - NOUVEAU_BO_VRAM | NOUVEAU_BO_RD); + OUT_RELOCl(chan, src_bo, src->offset + (sy+y) * src_pitch + (sx+x) * src->texture->block.size, + NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_RD); OUT_RING (chan, 0); } } @@ -213,43 +222,6 @@ nv04_surface_copy_m2mf(struct nv04_surface_2d *ctx, return 0; } -static int -nv04_surface_copy_m2mf_swizzle(struct nv04_surface_2d *ctx, - struct pipe_surface *dst, int dx, int dy, - struct pipe_surface *src, int sx, int sy) -{ - struct nouveau_channel *chan = ctx->m2mf->channel; - struct nouveau_grobj *m2mf = ctx->m2mf; - struct nouveau_bo *src_bo = nouveau_bo(ctx->buf(src)); - struct nouveau_bo *dst_bo = nouveau_bo(ctx->buf(dst)); - unsigned src_pitch = ((struct nv04_surface *)src)->pitch; - unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch; - unsigned dst_offset = dst->offset + nv04_swizzle_bits(dx, dy) * - dst->texture->block.size; - unsigned src_offset = src->offset + sy * src_pitch + - sx * src->texture->block.size; - - BEGIN_RING(chan, m2mf, NV04_MEMORY_TO_MEMORY_FORMAT_DMA_BUFFER_IN, 2); - OUT_RELOCo(chan, src_bo, - NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_RD); - OUT_RELOCo(chan, dst_bo, - NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); - - BEGIN_RING(chan, m2mf, NV04_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN, 8); - OUT_RELOCl(chan, src_bo, src_offset, - NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD); - OUT_RELOCl(chan, dst_bo, dst_offset, - NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_WR); - OUT_RING (chan, src_pitch); - OUT_RING (chan, dst_pitch); - OUT_RING (chan, 1 * src->texture->block.size); - OUT_RING (chan, 1); - OUT_RING (chan, 0x0101); - OUT_RING (chan, 0); - - return 0; -} - static int nv04_surface_copy_blit(struct nv04_surface_2d *ctx, struct pipe_surface *dst, int dx, int dy, struct pipe_surface *src, int sx, int sy, @@ -299,61 +271,10 @@ nv04_surface_copy(struct nv04_surface_2d *ctx, struct pipe_surface *dst, assert(src->format == dst->format); /* Setup transfer to swizzle the texture to vram if needed */ - if (src_linear && !dst_linear) { - int x,y; - - if ((w>1) && (h>1)) { - int potWidth = 1<potHeight ? potHeight : potWidth); - - /* top left is always POT, but we can only swizzle squares */ - for (y=0; y0) { - nv04_surface_copy(ctx, dst, dx+potWidth, dy, - src, sx+potWidth, sy, - remainWidth, potHeight); - } - - /* bottom left */ - if (remainHeight>0) { - nv04_surface_copy(ctx, dst, dx, dy+potHeight, - src, sx, sy+potHeight, - potWidth, remainHeight); - } - - /* bottom right */ - if ((remainWidth>0) && (remainHeight>0)) { - nv04_surface_copy(ctx, dst, dx+potWidth, dy+potHeight, - src, sx+potWidth, sy+potHeight, - remainWidth, remainHeight); - } - } else if (w==1) { - /* We have a column to copy to a swizzled texture */ - for (y=0; y 1 && h > 1) { + nv04_surface_copy_swizzle(ctx, dst, dx, dy, src, sx, sy, w, h); + return; + } /* NV_CONTEXT_SURFACES_2D has buffer alignment restrictions, fallback * to NV_MEMORY_TO_MEMORY_FORMAT in this case. -- cgit v1.2.3 From 74d61d03b54d72217d463c248468cdcd09320efc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 6 Oct 2009 22:30:01 -0600 Subject: mesa: added MESA_FORMAT_XRGB8888 --- src/mesa/main/formats.c | 9 +++++++++ src/mesa/main/formats.h | 1 + src/mesa/main/texfetch.c | 7 +++++++ src/mesa/main/texfetch_tmp.h | 24 ++++++++++++++++++++++++ src/mesa/main/texstore.c | 23 +++++++++++++++++++---- 5 files changed, 60 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 483f993a75..2924ab69cc 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -114,6 +114,14 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 4 /* BlockWidth/Height,Bytes */ }, + { + MESA_FORMAT_XRGB8888, /* Name */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, { MESA_FORMAT_RGB888, /* Name */ GL_RGB, /* BaseFormat */ @@ -799,6 +807,7 @@ _mesa_format_to_type_and_comps(gl_format format, case MESA_FORMAT_RGBA8888_REV: case MESA_FORMAT_ARGB8888: case MESA_FORMAT_ARGB8888_REV: + case MESA_FORMAT_XRGB8888: *datatype = GL_UNSIGNED_BYTE; *comps = 4; return; diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 9da6d5d979..30915bfe4b 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -54,6 +54,7 @@ typedef enum MESA_FORMAT_RGBA8888_REV, /* AAAA AAAA BBBB BBBB GGGG GGGG RRRR RRRR */ MESA_FORMAT_ARGB8888, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ MESA_FORMAT_ARGB8888_REV, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */ + MESA_FORMAT_XRGB8888, /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */ MESA_FORMAT_RGB888, /* RRRR RRRR GGGG GGGG BBBB BBBB */ MESA_FORMAT_BGR888, /* BBBB BBBB GGGG GGGG RRRR RRRR */ MESA_FORMAT_RGB565, /* RRRR RGGG GGGB BBBB */ diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c index 63b2eacf55..c50219521b 100644 --- a/src/mesa/main/texfetch.c +++ b/src/mesa/main/texfetch.c @@ -368,6 +368,13 @@ texfetch_funcs[MESA_FORMAT_COUNT] = fetch_texel_3d_f_argb8888_rev, store_texel_argb8888_rev }, + { + MESA_FORMAT_XRGB8888, + fetch_texel_1d_f_xrgb8888, + fetch_texel_2d_f_xrgb8888, + fetch_texel_3d_f_xrgb8888, + store_texel_xrgb8888 + }, { MESA_FORMAT_RGB888, fetch_texel_1d_f_rgb888, diff --git a/src/mesa/main/texfetch_tmp.h b/src/mesa/main/texfetch_tmp.h index 43030c2985..27434946ec 100644 --- a/src/mesa/main/texfetch_tmp.h +++ b/src/mesa/main/texfetch_tmp.h @@ -535,6 +535,30 @@ static void store_texel_argb8888_rev(struct gl_texture_image *texImage, #endif +/* MESA_FORMAT_XRGB8888 ******************************************************/ + +/* Fetch texel from 1D, 2D or 3D xrgb8888 texture, return 4 GLchans */ +static void FETCH(f_xrgb8888)( 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_FLOAT( (s >> 16) & 0xff ); + texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 8) & 0xff ); + texel[BCOMP] = UBYTE_TO_FLOAT( (s ) & 0xff ); + texel[ACOMP] = 1.0f; +} + +#if DIM == 3 +static void store_texel_xrgb8888(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(0xff, rgba[RCOMP], rgba[GCOMP], rgba[BCOMP]); +} +#endif + + /* MESA_FORMAT_RGB888 ********************************************************/ /* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */ diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 7754644da9..604f6c462a 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1344,12 +1344,14 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_ARGB8888 || - dstFormat == MESA_FORMAT_ARGB8888_REV); + dstFormat == MESA_FORMAT_ARGB8888_REV || + dstFormat == MESA_FORMAT_XRGB8888); ASSERT(texelBytes == 4); if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == MESA_FORMAT_ARGB8888 && + (dstFormat == MESA_FORMAT_ARGB8888 || + dstFormat == MESA_FORMAT_XRGB8888) && baseInternalFormat == GL_RGBA && srcFormat == GL_BGRA && ((srcType == GL_UNSIGNED_BYTE && littleEndian) || @@ -1379,7 +1381,8 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == MESA_FORMAT_ARGB8888 && + (dstFormat == MESA_FORMAT_ARGB8888 || + dstFormat == MESA_FORMAT_XRGB8888) && srcFormat == GL_RGB && (baseInternalFormat == GL_RGBA || baseInternalFormat == GL_RGB) && @@ -1455,6 +1458,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) /* dstmap - how to swizzle from RGBA to dst format: */ if ((littleEndian && dstFormat == MESA_FORMAT_ARGB8888) || + (littleEndian && dstFormat == MESA_FORMAT_XRGB8888) || (!littleEndian && dstFormat == MESA_FORMAT_ARGB8888_REV)) { dstmap[3] = 3; /* alpha */ dstmap[2] = 0; /* red */ @@ -1463,7 +1467,8 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) } else { assert((littleEndian && dstFormat == MESA_FORMAT_ARGB8888_REV) || - (!littleEndian && dstFormat == MESA_FORMAT_ARGB8888)); + (!littleEndian && dstFormat == MESA_FORMAT_ARGB8888) || + (!littleEndian && dstFormat == MESA_FORMAT_XRGB8888)); dstmap[3] = 2; dstmap[2] = 1; dstmap[1] = 0; @@ -1511,6 +1516,15 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) src += 4; } } + else if (dstFormat == MESA_FORMAT_XRGB8888) { + for (col = 0; col < srcWidth; col++) { + dstUI[col] = PACK_COLOR_8888( 0xff, + CHAN_TO_UBYTE(src[RCOMP]), + CHAN_TO_UBYTE(src[GCOMP]), + CHAN_TO_UBYTE(src[BCOMP]) ); + src += 4; + } + } else { for (col = 0; col < srcWidth; col++) { dstUI[col] = PACK_COLOR_8888_REV( CHAN_TO_UBYTE(src[ACOMP]), @@ -2973,6 +2987,7 @@ texstore_funcs[MESA_FORMAT_COUNT] = { MESA_FORMAT_RGBA8888_REV, _mesa_texstore_rgba8888 }, { MESA_FORMAT_ARGB8888, _mesa_texstore_argb8888 }, { MESA_FORMAT_ARGB8888_REV, _mesa_texstore_argb8888 }, + { MESA_FORMAT_XRGB8888, _mesa_texstore_argb8888 }, { MESA_FORMAT_RGB888, _mesa_texstore_rgb888 }, { MESA_FORMAT_BGR888, _mesa_texstore_bgr888 }, { MESA_FORMAT_RGB565, _mesa_texstore_rgb565 }, -- cgit v1.2.3 From 030723fc5d3faa919cac245fc7b13430ca201826 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 7 Oct 2009 01:40:37 +0100 Subject: i915g: Disable vbuf fifo and minor commenting of vbuf code The vbuf fifo doesn't appear to help once the libdrm reuse flag has been set. --- src/gallium/drivers/i915/i915_prim_vbuf.c | 37 ++++++++++++++++++++++--------- 1 file changed, 26 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/i915/i915_prim_vbuf.c b/src/gallium/drivers/i915/i915_prim_vbuf.c index a7e1d4b45e..cf065fd51b 100644 --- a/src/gallium/drivers/i915/i915_prim_vbuf.c +++ b/src/gallium/drivers/i915/i915_prim_vbuf.c @@ -52,6 +52,8 @@ #include "i915_state.h" +#undef VBUF_USE_FIFO + /** * Primitive renderer for i915. */ @@ -74,16 +76,19 @@ struct i915_vbuf_render { /* Stuff for the vbo */ struct intel_buffer *vbo; - size_t vbo_size; + size_t vbo_size; /**< current size of allocated buffer */ + size_t vbo_alloc_size; /**< minimum buffer size to allocate */ size_t vbo_offset; void *vbo_ptr; size_t vbo_max_used; - /* stuff for the pool */ +#ifdef VBUF_USE_FIFO + /* Stuff for the pool */ struct util_fifo *pool_fifo; unsigned pool_used; unsigned pool_buffer_size; boolean pool_not_used; +#endif }; @@ -132,18 +137,23 @@ i915_vbuf_render_new_buf(struct i915_vbuf_render *i915_render, size_t size) struct intel_winsys *iws = i915->iws; if (i915_render->vbo) { +#ifdef VBUF_USE_FIFO if (i915_render->pool_not_used) iws->buffer_destroy(iws, i915_render->vbo); else u_fifo_add(i915_render->pool_fifo, i915_render->vbo); i915_render->vbo = NULL; +#else + iws->buffer_destroy(iws, i915_render->vbo); +#endif } i915->vbo_flushed = 0; - i915_render->vbo_size = MAX2(size, i915_render->pool_buffer_size); + i915_render->vbo_size = MAX2(size, i915_render->vbo_alloc_size); i915_render->vbo_offset = 0; +#ifdef VBUF_USE_FIFO if (i915_render->vbo_size != i915_render->pool_buffer_size) { i915_render->pool_not_used = TRUE; i915_render->vbo = iws->buffer_create(iws, i915_render->vbo_size, 64, @@ -158,6 +168,10 @@ i915_vbuf_render_new_buf(struct i915_vbuf_render *i915_render, size_t size) } u_fifo_pop(i915_render->pool_fifo, (void**)&i915_render->vbo); } +#else + i915_render->vbo = iws->buffer_create(iws, i915_render->vbo_size, + 64, INTEL_NEW_VERTEX); +#endif } static boolean @@ -173,10 +187,11 @@ i915_vbuf_render_allocate_vertices(struct vbuf_render *render, assert(!i915->vbo); if (!i915_vbuf_render_reserve(i915_render, size)) { - +#ifdef VBUF_USE_FIFO + /* incase we flushed reset the number of pool buffers used */ if (i915->vbo_flushed) i915_render->pool_used = 0; - +#endif i915_vbuf_render_new_buf(i915_render, size); } @@ -603,19 +618,19 @@ i915_vbuf_render_create(struct i915_context *i915) i915_render->vbo = NULL; i915_render->vbo_size = 0; i915_render->vbo_offset = 0; + i915_render->vbo_alloc_size = i915_render->base.max_vertex_buffer_bytes * 4; +#ifdef VBUF_USE_POOL i915_render->pool_used = FALSE; - i915_render->pool_buffer_size = i915_render->base.max_vertex_buffer_bytes * 4; + i915_render->pool_buffer_size = i915_render->vbo_alloc_size; i915_render->pool_fifo = u_fifo_create(6); for (i = 0; i < 6; i++) u_fifo_add(i915_render->pool_fifo, iws->buffer_create(iws, i915_render->pool_buffer_size, 64, INTEL_NEW_VERTEX)); - -#if 0 - /* TODO JB: is this realy needed? */ - i915_render->vbo_ptr = iws->buffer_map(iws, i915_render->vbo, TRUE); - iws->buffer_unmap(iws, i915_render->vbo); +#else + (void)i; + (void)iws; #endif return &i915_render->base; -- cgit v1.2.3 From f8ba93aefdf23b88a945d6037cd2e672c99b314c Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 7 Oct 2009 03:26:03 +0100 Subject: i915g: Change order of buffer_write arguments They now follow the pipe_buffer_write style, its the gallium driver that sets the interface not the winsys. --- src/gallium/drivers/i915/intel_winsys.h | 6 +++--- src/gallium/winsys/drm/intel/gem/intel_drm_buffer.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/i915/intel_winsys.h b/src/gallium/drivers/i915/intel_winsys.h index 42c5e7470e..2c8dc63f3f 100644 --- a/src/gallium/drivers/i915/intel_winsys.h +++ b/src/gallium/drivers/i915/intel_winsys.h @@ -153,13 +153,13 @@ struct intel_winsys { /** * Write to a buffer. * - * Arguments follows pwrite(2) + * Arguments follows pipe_buffer_write. */ int (*buffer_write)(struct intel_winsys *iws, struct intel_buffer *dst, - const void *src, + size_t offset, size_t size, - size_t offset); + const void *data); void (*buffer_destroy)(struct intel_winsys *iws, struct intel_buffer *buffer); diff --git a/src/gallium/winsys/drm/intel/gem/intel_drm_buffer.c b/src/gallium/winsys/drm/intel/gem/intel_drm_buffer.c index 327e19fcd6..ac4dd6e00e 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_drm_buffer.c +++ b/src/gallium/winsys/drm/intel/gem/intel_drm_buffer.c @@ -119,9 +119,9 @@ intel_drm_buffer_unmap(struct intel_winsys *iws, static int intel_drm_buffer_write(struct intel_winsys *iws, struct intel_buffer *buffer, - const void *data, + size_t offset, size_t size, - size_t offset) + const void *data) { struct intel_drm_buffer *buf = intel_drm_buffer(buffer); -- cgit v1.2.3 From 0f0127f6f9ee6c976c707cd406bf392aea978976 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 7 Oct 2009 03:28:04 +0100 Subject: i915g: Use buffer write instead of map for lit vertices --- src/gallium/drivers/i915/i915_prim_vbuf.c | 39 +++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/i915/i915_prim_vbuf.c b/src/gallium/drivers/i915/i915_prim_vbuf.c index cf065fd51b..07546c03b2 100644 --- a/src/gallium/drivers/i915/i915_prim_vbuf.c +++ b/src/gallium/drivers/i915/i915_prim_vbuf.c @@ -53,6 +53,7 @@ #undef VBUF_USE_FIFO +#undef VBUF_MAP_BUFFER /** * Primitive renderer for i915. @@ -82,6 +83,12 @@ struct i915_vbuf_render { void *vbo_ptr; size_t vbo_max_used; +#ifndef VBUF_MAP_BUFFER + size_t map_used_start; + size_t map_used_end; + size_t map_size; +#endif + #ifdef VBUF_USE_FIFO /* Stuff for the pool */ struct util_fifo *pool_fifo; @@ -153,6 +160,14 @@ i915_vbuf_render_new_buf(struct i915_vbuf_render *i915_render, size_t size) i915_render->vbo_size = MAX2(size, i915_render->vbo_alloc_size); i915_render->vbo_offset = 0; +#ifndef VBUF_MAP_BUFFER + if (i915_render->vbo_size > i915_render->map_size) { + i915_render->map_size = i915_render->vbo_size; + FREE(i915_render->vbo_ptr); + i915_render->vbo_ptr = MALLOC(i915_render->map_size); + } +#endif + #ifdef VBUF_USE_FIFO if (i915_render->vbo_size != i915_render->pool_buffer_size) { i915_render->pool_not_used = TRUE; @@ -215,9 +230,13 @@ i915_vbuf_render_map_vertices(struct vbuf_render *render) if (i915->vbo_flushed) debug_printf("%s bad vbo flush occured stalling on hw\n", __FUNCTION__); +#ifdef VBUF_MAP_BUFFER i915_render->vbo_ptr = iws->buffer_map(iws, i915_render->vbo, TRUE); - - return (unsigned char *)i915_render->vbo_ptr + i915->vbo_offset; + return (unsigned char *)i915_render->vbo_ptr + i915_render->vbo_offset; +#else + (void)iws; + return (unsigned char *)i915_render->vbo_ptr; +#endif } static void @@ -230,7 +249,17 @@ i915_vbuf_render_unmap_vertices(struct vbuf_render *render, struct intel_winsys *iws = i915->iws; i915_render->vbo_max_used = MAX2(i915_render->vbo_max_used, i915_render->vertex_size * (max_index + 1)); +#ifdef VBUF_MAP_BUFFER iws->buffer_unmap(iws, i915_render->vbo); +#else + i915_render->map_used_start = i915_render->vertex_size * min_index; + i915_render->map_used_end = i915_render->vertex_size * (max_index + 1); + iws->buffer_write(iws, i915_render->vbo, + i915_render->map_used_start + i915_render->vbo_offset, + i915_render->map_used_end - i915_render->map_used_start, + i915_render->vbo_ptr + i915_render->map_used_start); + +#endif } static boolean @@ -614,8 +643,14 @@ i915_vbuf_render_create(struct i915_context *i915) i915_render->base.release_vertices = i915_vbuf_render_release_vertices; i915_render->base.destroy = i915_vbuf_render_destroy; +#ifndef VBUF_MAP_BUFFER + i915_render->map_size = 0; + i915_render->map_used_start = 0; + i915_render->map_used_end = 0; +#endif i915_render->vbo = NULL; + i915_render->vbo_ptr = NULL; i915_render->vbo_size = 0; i915_render->vbo_offset = 0; i915_render->vbo_alloc_size = i915_render->base.max_vertex_buffer_bytes * 4; -- cgit v1.2.3 From f9904edf53e1f8be22991c80b4f9a5cb510674df Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 7 Oct 2009 07:43:12 -0600 Subject: gallium/xlib: return 0 for errorBase, eventBase in glXQueryExtension() A little better than leaving the values undefined, I think. See bug 24321. --- src/gallium/state_trackers/glx/xlib/glx_api.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c index 6cd7ede31c..3277ff58a6 100644 --- a/src/gallium/state_trackers/glx/xlib/glx_api.c +++ b/src/gallium/state_trackers/glx/xlib/glx_api.c @@ -1309,12 +1309,14 @@ glXCopyContext( Display *dpy, GLXContext src, GLXContext dst, Bool -glXQueryExtension( Display *dpy, int *errorb, int *event ) +glXQueryExtension( Display *dpy, int *errorBase, int *eventBase ) { /* Mesa's GLX isn't really an X extension but we try to act like one. */ (void) dpy; - (void) errorb; - (void) event; + if (errorBase) + *errorBase = 0; + if (eventBase) + *eventBase = 0; return True; } -- cgit v1.2.3 From e3fff3daf031a997a1d4316e1a0e5c831573221d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 7 Oct 2009 07:45:15 -0600 Subject: mesa/xlib: return 0 for errorBase, eventBase in glXQueryExtension() A little better than leaving the values undefined, I think. See bug 24321. --- src/mesa/drivers/x11/fakeglx.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index 6449dc88b0..2bda9db87c 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -1637,12 +1637,14 @@ Fake_glXCopyContext( Display *dpy, GLXContext src, GLXContext dst, static Bool -Fake_glXQueryExtension( Display *dpy, int *errorb, int *event ) +Fake_glXQueryExtension( Display *dpy, int *errorBase, int *eventBase ) { /* Mesa's GLX isn't really an X extension but we try to act like one. */ (void) dpy; - (void) errorb; - (void) event; + if (errorBase) + *errorBase = 0; + if (eventBase) + *eventBase = 0; return True; } -- cgit v1.2.3 From 14f21c785087f86d291243400e59ebfc8721c4f6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 6 Oct 2009 19:05:23 -0600 Subject: swrast: add missing returns --- src/mesa/swrast/s_depth.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c index 26e23f02d5..a9d678d180 100644 --- a/src/mesa/swrast/s_depth.c +++ b/src/mesa/swrast/s_depth.c @@ -1211,6 +1211,7 @@ _swrast_read_depth_span_float( GLcontext *ctx, struct gl_renderbuffer *rb, if (!rb) { /* really only doing this to prevent FP exceptions later */ _mesa_bzero(depth, n * sizeof(GLfloat)); + return; } ASSERT(rb->_BaseFormat == GL_DEPTH_COMPONENT); @@ -1274,6 +1275,7 @@ _swrast_read_depth_span_uint( GLcontext *ctx, struct gl_renderbuffer *rb, if (!rb) { /* really only doing this to prevent FP exceptions later */ _mesa_bzero(depth, n * sizeof(GLfloat)); + return; } ASSERT(rb->_BaseFormat == GL_DEPTH_COMPONENT); -- cgit v1.2.3 From edbaa717b49f679572805d535ed7c77518257781 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 7 Oct 2009 08:07:53 -0600 Subject: swrast: s/GLfloat/GLuint/ in bzero() --- src/mesa/swrast/s_depth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c index a9d678d180..7086cae0c8 100644 --- a/src/mesa/swrast/s_depth.c +++ b/src/mesa/swrast/s_depth.c @@ -1274,7 +1274,7 @@ _swrast_read_depth_span_uint( GLcontext *ctx, struct gl_renderbuffer *rb, { if (!rb) { /* really only doing this to prevent FP exceptions later */ - _mesa_bzero(depth, n * sizeof(GLfloat)); + _mesa_bzero(depth, n * sizeof(GLuint)); return; } -- cgit v1.2.3 From de81b2cf0a465e2c6c43c7f9f864129728b3a080 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Wed, 7 Oct 2009 16:36:39 +0200 Subject: st/dri: Add missing front buffer case in dri_get_buffers(). This seems to help for compiz at least with some drivers. Also add an assert(0) to catch unhandled cases in the future. --- src/gallium/state_trackers/dri/dri_drawable.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index 3f8dc8df75..c67cc8dacb 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -213,6 +213,7 @@ dri_get_buffers(__DRIdrawablePrivate * dPriv) dri_drawable->h, buffers[i].pitch); switch (buffers[i].attachment) { + case __DRI_BUFFER_FRONT_LEFT: case __DRI_BUFFER_FAKE_FRONT_LEFT: case __DRI_BUFFER_BACK_LEFT: drawable->color_format = surface->format; @@ -222,6 +223,9 @@ dri_get_buffers(__DRIdrawablePrivate * dPriv) case __DRI_BUFFER_STENCIL: drawable->depth_stencil_format = surface->format; break; + case __DRI_BUFFER_ACCUM: + default: + assert(0); } st_set_framebuffer_surface(drawable->stfb, index, surface); -- cgit v1.2.3 From 0526100a5cbd928fa28d38abdafd6beb024b0828 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 7 Oct 2009 09:40:04 -0600 Subject: gallium/xlib: fix glXQueryDrawable() bugs, see bug 24320 --- src/gallium/state_trackers/glx/xlib/glx_api.c | 38 ++++++++++++++++++--------- src/gallium/state_trackers/glx/xlib/xm_api.c | 2 +- src/gallium/state_trackers/glx/xlib/xm_api.h | 7 +++++ 3 files changed, 34 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c index 3277ff58a6..556eefb1b1 100644 --- a/src/gallium/state_trackers/glx/xlib/glx_api.c +++ b/src/gallium/state_trackers/glx/xlib/glx_api.c @@ -1992,32 +1992,42 @@ glXCreatePbuffer( Display *dpy, GLXFBConfig config, break; case GLX_PRESERVED_CONTENTS: attrib++; - preserveContents = *attrib; /* ignored */ + preserveContents = *attrib; break; case GLX_LARGEST_PBUFFER: attrib++; - useLargest = *attrib; /* ignored */ + useLargest = *attrib; break; default: return 0; } } - /* not used at this time */ - (void) useLargest; - (void) preserveContents; - if (width == 0 || height == 0) return 0; + if (width > MAX_WIDTH || height > MAX_HEIGHT) { + /* If allocation would have failed and GLX_LARGEST_PBUFFER is set, + * allocate the largest possible buffer. + */ + if (useLargest) { + width = MAX_WIDTH; + height = MAX_HEIGHT; + } + } + xmbuf = XMesaCreatePBuffer( xmvis, 0, width, height); /* A GLXPbuffer handle must be an X Drawable because that's what * glXMakeCurrent takes. */ - if (xmbuf) + if (xmbuf) { + xmbuf->largestPbuffer = useLargest; + xmbuf->preservedContents = preserveContents; return (GLXPbuffer) xmbuf->drawable; - else + } + else { return 0; + } } @@ -2035,22 +2045,26 @@ void glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute, unsigned int *value ) { + GLuint width, height; XMesaBuffer xmbuf = XMesaFindBuffer(dpy, draw); if (!xmbuf) return; + /* make sure buffer's dimensions are up to date */ + xmesa_get_window_size(dpy, xmbuf, &width, &height); + switch (attribute) { case GLX_WIDTH: - *value = xmesa_buffer_width(xmbuf); + *value = width; break; case GLX_HEIGHT: - *value = xmesa_buffer_width(xmbuf); + *value = height; break; case GLX_PRESERVED_CONTENTS: - *value = True; + *value = xmbuf->preservedContents; break; case GLX_LARGEST_PBUFFER: - *value = xmesa_buffer_width(xmbuf) * xmesa_buffer_height(xmbuf); + *value = xmbuf->largestPbuffer; break; case GLX_FBCONFIG_ID: *value = xmbuf->xm_visual->visinfo->visualid; diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index 957002ddd5..c76dfb31d2 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -228,7 +228,7 @@ get_drawable_size( Display *dpy, Drawable d, uint *width, uint *height ) * \param width returns width in pixels * \param height returns height in pixels */ -static void +void xmesa_get_window_size(Display *dpy, XMesaBuffer b, GLuint *width, GLuint *height) { diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.h b/src/gallium/state_trackers/glx/xlib/xm_api.h index ce97a3ec76..d24971ca1c 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.h +++ b/src/gallium/state_trackers/glx/xlib/xm_api.h @@ -323,6 +323,9 @@ struct xmesa_buffer { Colormap cmap; /* the X colormap */ BufferType type; /* window, pixmap, pbuffer or glxwindow */ + GLboolean largestPbuffer; /**< for pbuffers */ + GLboolean preservedContents; /**< for pbuffers */ + XImage *tempImage; unsigned long selectedEvents;/* for pbuffers only */ @@ -369,6 +372,10 @@ xmesa_delete_framebuffer(struct gl_framebuffer *fb); extern XMesaBuffer xmesa_find_buffer(Display *dpy, Colormap cmap, XMesaBuffer notThis); +extern void +xmesa_get_window_size(Display *dpy, XMesaBuffer b, + GLuint *width, GLuint *height); + extern void xmesa_check_and_update_buffer_size(XMesaContext xmctx, XMesaBuffer drawBuffer); -- cgit v1.2.3 From c3eef6021a06d728aa4c8b882264f554f2d4b801 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 7 Oct 2009 09:40:22 -0600 Subject: mesa/xlib: fix glXQueryDrawable() bugs, see bug 24320 --- src/mesa/drivers/x11/fakeglx.c | 37 +++++++++++++++++++++++++------------ src/mesa/drivers/x11/xmesaP.h | 3 +++ 2 files changed, 28 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index 2bda9db87c..525db3b7cb 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -2351,32 +2351,42 @@ Fake_glXCreatePbuffer( Display *dpy, GLXFBConfig config, break; case GLX_PRESERVED_CONTENTS: attrib++; - preserveContents = *attrib; /* ignored */ + preserveContents = *attrib; break; case GLX_LARGEST_PBUFFER: attrib++; - useLargest = *attrib; /* ignored */ + useLargest = *attrib; break; default: return 0; } } - /* not used at this time */ - (void) useLargest; - (void) preserveContents; - if (width == 0 || height == 0) return 0; + if (width > MAX_WIDTH || height > MAX_HEIGHT) { + /* If allocation would have failed and GLX_LARGEST_PBUFFER is set, + * allocate the largest possible buffer. + */ + if (useLargest) { + width = MAX_WIDTH; + height = MAX_HEIGHT; + } + } + xmbuf = XMesaCreatePBuffer( xmvis, 0, width, height); /* A GLXPbuffer handle must be an X Drawable because that's what * glXMakeCurrent takes. */ - if (xmbuf) + if (xmbuf) { + xmbuf->largestPbuffer = useLargest; + xmbuf->preservedContents = preserveContents; return (GLXPbuffer) xmbuf->frontxrb->pixmap; - else + } + else { return 0; + } } @@ -2398,6 +2408,9 @@ Fake_glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute, if (!xmbuf) return; + /* make sure buffer's dimensions are up to date */ + xmesa_check_and_update_buffer_size(NULL, xmbuf); + switch (attribute) { case GLX_WIDTH: *value = xmbuf->mesa_buffer.Width; @@ -2406,10 +2419,10 @@ Fake_glXQueryDrawable( Display *dpy, GLXDrawable draw, int attribute, *value = xmbuf->mesa_buffer.Height; break; case GLX_PRESERVED_CONTENTS: - *value = True; + *value = xmbuf->preservedContents; break; case GLX_LARGEST_PBUFFER: - *value = xmbuf->mesa_buffer.Width * xmbuf->mesa_buffer.Height; + *value = xmbuf->largestPbuffer; break; case GLX_FBCONFIG_ID: *value = xmbuf->xm_visual->visinfo->visualid; @@ -2766,10 +2779,10 @@ Fake_glXQueryGLXPbufferSGIX(Display *dpy, GLXPbufferSGIX pbuf, int attribute, un switch (attribute) { case GLX_PRESERVED_CONTENTS_SGIX: - *value = True; + *value = xmbuf->preservedContents; break; case GLX_LARGEST_PBUFFER_SGIX: - *value = xmbuf->mesa_buffer.Width * xmbuf->mesa_buffer.Height; + *value = xmbuf->largestPbuffer; break; case GLX_WIDTH_SGIX: *value = xmbuf->mesa_buffer.Width; diff --git a/src/mesa/drivers/x11/xmesaP.h b/src/mesa/drivers/x11/xmesaP.h index 25db55862e..3ffd7661e3 100644 --- a/src/mesa/drivers/x11/xmesaP.h +++ b/src/mesa/drivers/x11/xmesaP.h @@ -212,6 +212,9 @@ struct xmesa_buffer { XMesaDisplay *display; BufferType type; /* window, pixmap, pbuffer or glxwindow */ + GLboolean largestPbuffer; /**< for pbuffers */ + GLboolean preservedContents; /**< for pbuffers */ + struct xmesa_renderbuffer *frontxrb; /* front color renderbuffer */ struct xmesa_renderbuffer *backxrb; /* back color renderbuffer */ -- cgit v1.2.3 From 2ef1aae1633db98fc52f440ca33b8f2a6f153d45 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 7 Oct 2009 09:58:03 -0600 Subject: st/mesa: pass pipe_screen, not pipe_context to st_choose_format() functions These don't depend on context state, but use a screen pointer. --- src/mesa/state_tracker/st_atom_pixeltransfer.c | 3 ++- src/mesa/state_tracker/st_cb_drawpixels.c | 5 +++-- src/mesa/state_tracker/st_cb_fbo.c | 2 +- src/mesa/state_tracker/st_format.c | 12 ++++++------ src/mesa/state_tracker/st_format.h | 5 +++-- 5 files changed, 15 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c index eff3666ca8..babfcc87b4 100644 --- a/src/mesa/state_tracker/st_atom_pixeltransfer.c +++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c @@ -122,7 +122,8 @@ create_color_map_texture(GLcontext *ctx) const uint texSize = 256; /* simple, and usually perfect */ /* find an RGBA texture format */ - format = st_choose_format(pipe, GL_RGBA, PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER); + format = st_choose_format(pipe->screen, GL_RGBA, + PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER); /* create texture for color map/table */ pt = st_texture_create(ctx->st, PIPE_TEXTURE_2D, format, 0, diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 4a64472fa1..5c3413f905 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -1015,13 +1015,14 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, else { /* srcFormat can't be used as a texture format */ if (type == GL_DEPTH) { - texFormat = st_choose_format(pipe, GL_DEPTH_COMPONENT, PIPE_TEXTURE_2D, + texFormat = st_choose_format(screen, GL_DEPTH_COMPONENT, + PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_DEPTH_STENCIL); assert(texFormat != PIPE_FORMAT_NONE); /* XXX no depth texture formats??? */ } else { /* default color format */ - texFormat = st_choose_format(pipe, GL_RGBA, PIPE_TEXTURE_2D, + texFormat = st_choose_format(screen, GL_RGBA, PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER); assert(texFormat != PIPE_FORMAT_NONE); } diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 57a2a3db5b..864f5d3ca3 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -93,7 +93,7 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, if (strb->format != PIPE_FORMAT_NONE) format = strb->format; else - format = st_choose_renderbuffer_format(pipe, internalFormat); + format = st_choose_renderbuffer_format(pipe->screen, internalFormat); /* init renderbuffer fields */ strb->Base.Width = width; diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index dcb90a3107..3e0db37414 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -392,10 +392,9 @@ default_depth_format(struct pipe_screen *screen, * or PIPE_TEXTURE_USAGE_SAMPLER */ enum pipe_format -st_choose_format(struct pipe_context *pipe, GLenum internalFormat, +st_choose_format(struct pipe_screen *screen, GLenum internalFormat, enum pipe_texture_target target, unsigned tex_usage) { - struct pipe_screen *screen = pipe->screen; unsigned geom_flags = 0; switch (internalFormat) { @@ -618,14 +617,15 @@ is_depth_or_stencil_format(GLenum internalFormat) * Called by FBO code to choose a PIPE_FORMAT_ for drawing surfaces. */ enum pipe_format -st_choose_renderbuffer_format(struct pipe_context *pipe, GLenum internalFormat) +st_choose_renderbuffer_format(struct pipe_screen *screen, + GLenum internalFormat) { uint usage; if (is_depth_or_stencil_format(internalFormat)) usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL; else usage = PIPE_TEXTURE_USAGE_RENDER_TARGET; - return st_choose_format(pipe, internalFormat, PIPE_TEXTURE_2D, usage); + return st_choose_format(screen, internalFormat, PIPE_TEXTURE_2D, usage); } @@ -713,8 +713,8 @@ st_ChooseTextureFormat(GLcontext *ctx, GLint internalFormat, (void) format; (void) type; - pFormat = st_choose_format(ctx->st->pipe, internalFormat, PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_SAMPLER); + pFormat = st_choose_format(ctx->st->pipe->screen, internalFormat, + PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER); if (pFormat == PIPE_FORMAT_NONE) return NULL; diff --git a/src/mesa/state_tracker/st_format.h b/src/mesa/state_tracker/st_format.h index 9d9e02fe9b..e4a788c89b 100644 --- a/src/mesa/state_tracker/st_format.h +++ b/src/mesa/state_tracker/st_format.h @@ -64,11 +64,12 @@ st_mesa_format_to_pipe_format(GLuint mesaFormat); extern enum pipe_format -st_choose_format(struct pipe_context *pipe, GLenum internalFormat, +st_choose_format(struct pipe_screen *screen, GLenum internalFormat, enum pipe_texture_target target, unsigned tex_usage); extern enum pipe_format -st_choose_renderbuffer_format(struct pipe_context *pipe, GLenum internalFormat); +st_choose_renderbuffer_format(struct pipe_screen *screen, + GLenum internalFormat); extern const struct gl_texture_format * -- cgit v1.2.3 From c0de2ed5055b951ff523c3b25eecfc82d1f307ef Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 7 Oct 2009 17:48:45 +0100 Subject: mesa/st: add missing mesa constant file name There are many different names for constants in mesa, we were missing one since the ureg rewrite. --- src/mesa/state_tracker/st_mesa_to_tgsi.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index b0a1b529f1..70d7c4fee2 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -151,7 +151,7 @@ dst_register( struct st_translate *t, return t->address[index]; default: - assert( 0 ); + debug_assert( 0 ); return ureg_dst_undef(); } } @@ -173,8 +173,9 @@ src_register( struct st_translate *t, case PROGRAM_STATE_VAR: case PROGRAM_NAMED_PARAM: + case PROGRAM_ENV_PARAM: case PROGRAM_UNIFORM: - case PROGRAM_CONSTANT: + case PROGRAM_CONSTANT: /* ie, immediate */ return t->constants[index]; case PROGRAM_INPUT: @@ -187,7 +188,7 @@ src_register( struct st_translate *t, return ureg_src(t->address[index]); default: - assert( 0 ); + debug_assert( 0 ); return ureg_src_undef(); } } @@ -216,7 +217,7 @@ translate_texture_target( GLuint textarget, case TEXTURE_CUBE_INDEX: return TGSI_TEXTURE_CUBE; case TEXTURE_RECT_INDEX: return TGSI_TEXTURE_RECT; default: - assert( 0 ); + debug_assert( 0 ); return TGSI_TEXTURE_1D; } } @@ -386,7 +387,7 @@ static void emit_swz( struct st_translate *t, swizzle_4v( imm, add_swizzle ) ); } else { - assert(0); + debug_assert(0); } #undef IMM_ZERO @@ -539,7 +540,7 @@ translate_opcode( unsigned op ) case OPCODE_END: return TGSI_OPCODE_END; default: - assert( 0 ); + debug_assert( 0 ); return TGSI_OPCODE_NOP; } } @@ -578,7 +579,7 @@ compile_instruction( case OPCODE_ELSE: case OPCODE_ENDLOOP: case OPCODE_IF: - assert(num_dst == 0); + debug_assert(num_dst == 0); ureg_label_insn( ureg, translate_opcode( inst->Opcode ), src, num_src, @@ -761,7 +762,7 @@ st_translate_mesa_program( outputSemanticIndex[i] ); break; default: - assert(0); + debug_assert(0); return 0; } } @@ -781,7 +782,7 @@ st_translate_mesa_program( /* Declare address register. */ if (program->NumAddressRegs > 0) { - assert( program->NumAddressRegs == 1 ); + debug_assert( program->NumAddressRegs == 1 ); t->address[0] = ureg_DECL_address( ureg ); } @@ -864,7 +865,7 @@ out: if (!tokens) { debug_printf("%s: failed to translate Mesa program:\n", __FUNCTION__); _mesa_print_program(program); - assert(0); + debug_assert(0); } return tokens; -- cgit v1.2.3 From 3f5a316f36e2d376104640033c8bcefef3810ef4 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 7 Oct 2009 17:50:03 +0100 Subject: util: do some more util_blit_pixels cases without temporaries When the source surface is pointing at a 2d texture with only one mipmap level, use that directly rather than creating a temporary. Probably want to cover more cases, but this is a start. --- src/gallium/auxiliary/util/u_blit.c | 163 ++++++++++++++++-------------------- 1 file changed, 73 insertions(+), 90 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index c516317d70..fb00c3abe8 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -182,47 +182,7 @@ get_next_slot( struct blit_state *ctx ) } -/** - * Setup vertex data for the textured quad we'll draw. - * Note: y=0=top - */ -static unsigned -setup_vertex_data(struct blit_state *ctx, - float x0, float y0, float x1, float y1, float z) -{ - unsigned offset; - - ctx->vertices[0][0][0] = x0; - ctx->vertices[0][0][1] = y0; - ctx->vertices[0][0][2] = z; - ctx->vertices[0][1][0] = 0.0f; /*s*/ - ctx->vertices[0][1][1] = 0.0f; /*t*/ - - ctx->vertices[1][0][0] = x1; - ctx->vertices[1][0][1] = y0; - ctx->vertices[1][0][2] = z; - ctx->vertices[1][1][0] = 1.0f; /*s*/ - ctx->vertices[1][1][1] = 0.0f; /*t*/ - - ctx->vertices[2][0][0] = x1; - ctx->vertices[2][0][1] = y1; - ctx->vertices[2][0][2] = z; - ctx->vertices[2][1][0] = 1.0f; - ctx->vertices[2][1][1] = 1.0f; - - ctx->vertices[3][0][0] = x0; - ctx->vertices[3][0][1] = y1; - ctx->vertices[3][0][2] = z; - ctx->vertices[3][1][0] = 0.0f; - ctx->vertices[3][1][1] = 1.0f; - - offset = get_next_slot( ctx ); - - pipe_buffer_write(ctx->pipe->screen, ctx->vbuf, - offset, sizeof(ctx->vertices), ctx->vertices); - return offset; -} /** @@ -315,15 +275,13 @@ util_blit_pixels_writemask(struct blit_state *ctx, { struct pipe_context *pipe = ctx->pipe; struct pipe_screen *screen = pipe->screen; - struct pipe_texture texTemp, *tex; - struct pipe_surface *texSurf; + struct pipe_texture *tex = NULL; struct pipe_framebuffer_state fb; const int srcW = abs(srcX1 - srcX0); const int srcH = abs(srcY1 - srcY0); - const int srcLeft = MIN2(srcX0, srcX1); - const int srcTop = MIN2(srcY0, srcY1); unsigned offset; boolean overlap; + float s0, t0, s1, t1; assert(filter == PIPE_TEX_MIPFILTER_NEAREST || filter == PIPE_TEX_MIPFILTER_LINEAR); @@ -358,54 +316,76 @@ util_blit_pixels_writemask(struct blit_state *ctx, return; } - if (srcLeft != srcX0) { - /* left-right flip */ - int tmp = dstX0; - dstX0 = dstX1; - dstX1 = tmp; - } - - if (srcTop != srcY0) { - /* up-down flip */ - int tmp = dstY0; - dstY0 = dstY1; - dstY1 = tmp; - } - assert(screen->is_format_supported(screen, dst->format, PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)); - /* - * XXX for now we're always creating a temporary texture. - * Strictly speaking that's not always needed. + /* Create a temporary texture when src and dest alias or when src + * is anything other than a single-level 2d texture. + * + * This can still be improved upon. */ + if (util_same_surface(src, dst) || + src->texture->target != PIPE_TEXTURE_2D || + src->texture->last_level != 0) + { + struct pipe_texture texTemp; + struct pipe_surface *texSurf; + const int srcLeft = MIN2(srcX0, srcX1); + const int srcTop = MIN2(srcY0, srcY1); + + if (srcLeft != srcX0) { + /* left-right flip */ + int tmp = dstX0; + dstX0 = dstX1; + dstX1 = tmp; + } + + if (srcTop != srcY0) { + /* up-down flip */ + int tmp = dstY0; + dstY0 = dstY1; + dstY1 = tmp; + } + + /* create temp texture */ + memset(&texTemp, 0, sizeof(texTemp)); + texTemp.target = PIPE_TEXTURE_2D; + texTemp.format = src->format; + texTemp.last_level = 0; + texTemp.width[0] = srcW; + texTemp.height[0] = srcH; + texTemp.depth[0] = 1; + pf_get_block(src->format, &texTemp.block); + + tex = screen->texture_create(screen, &texTemp); + if (!tex) + return; + + texSurf = screen->get_tex_surface(screen, tex, 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_WRITE); + + /* load temp texture */ + pipe->surface_copy(pipe, + texSurf, 0, 0, /* dest */ + src, srcLeft, srcTop, /* src */ + srcW, srcH); /* size */ + + /* free the surface, update the texture if necessary. + */ + pipe_surface_reference(&texSurf, NULL); + s0 = 0.0f; + s1 = 1.0f; + t0 = 0.0f; + t1 = 1.0f; + } + else { + pipe_texture_reference(&tex, src->texture); + s0 = srcX0 / (float)tex->width[0]; + s1 = srcX1 / (float)tex->width[0]; + t0 = srcY0 / (float)tex->height[0]; + t1 = srcY1 / (float)tex->height[0]; + } - /* create temp texture */ - memset(&texTemp, 0, sizeof(texTemp)); - texTemp.target = PIPE_TEXTURE_2D; - texTemp.format = src->format; - texTemp.last_level = 0; - texTemp.width[0] = srcW; - texTemp.height[0] = srcH; - texTemp.depth[0] = 1; - pf_get_block(src->format, &texTemp.block); - - tex = screen->texture_create(screen, &texTemp); - if (!tex) - return; - - texSurf = screen->get_tex_surface(screen, tex, 0, 0, 0, - PIPE_BUFFER_USAGE_GPU_WRITE); - - /* load temp texture */ - pipe->surface_copy(pipe, - texSurf, 0, 0, /* dest */ - src, srcLeft, srcTop, /* src */ - srcW, srcH); /* size */ - - /* free the surface, update the texture if necessary. - */ - pipe_surface_reference(&texSurf, NULL); /* save state (restored below) */ cso_save_blend(ctx->cso); @@ -447,9 +427,12 @@ util_blit_pixels_writemask(struct blit_state *ctx, cso_set_framebuffer(ctx->cso, &fb); /* draw quad */ - offset = setup_vertex_data(ctx, - (float) dstX0, (float) dstY0, - (float) dstX1, (float) dstY1, z); + offset = setup_vertex_data_tex(ctx, + (float) dstX0, (float) dstY0, + (float) dstX1, (float) dstY1, + s0, t0, + s1, t1, + z); util_draw_vertex_buffer(ctx->pipe, ctx->vbuf, offset, PIPE_PRIM_TRIANGLE_FAN, -- cgit v1.2.3 From ae351599f144b9e0cb1691870dd4c305fbaab97c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sat, 3 Oct 2009 16:18:57 +0200 Subject: prog_parameter: Document the fact that Size may be > 4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle --- src/mesa/shader/prog_parameter.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/prog_parameter.h b/src/mesa/shader/prog_parameter.h index d1fcf47e61..699cb0c735 100644 --- a/src/mesa/shader/prog_parameter.h +++ b/src/mesa/shader/prog_parameter.h @@ -56,7 +56,13 @@ struct gl_program_parameter const char *Name; /**< Null-terminated string */ gl_register_file Type; /**< PROGRAM_NAMED_PARAM, CONSTANT or STATE_VAR */ GLenum DataType; /**< GL_FLOAT, GL_FLOAT_VEC2, etc */ - GLuint Size; /**< Number of components (1..4) */ + /** + * Number of components (1..4), or more. + * If the number of components is greater than 4, + * this parameter is part of a larger uniform like a GLSL matrix or array. + * The next program parameter's Size will be Size-4 of this parameter. + */ + GLuint Size; GLboolean Used; /**< Helper flag for GLSL uniform tracking */ GLboolean Initialized; /**< Has the ParameterValue[] been set? */ GLbitfield Flags; /**< Bitmask of PROG_PARAM_*_BIT */ -- cgit v1.2.3 From 9fde81bb20bbfd2f8da80749cb84d890843a7bc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sat, 3 Oct 2009 16:30:16 +0200 Subject: shader_api: Fix bounds checking of glUniform and glUniformMatrix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle Reviewed-by: Ian Romanick --- src/mesa/shader/shader_api.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 178b7d0dba..b282d7af60 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -1702,8 +1702,8 @@ set_program_uniform(GLcontext *ctx, struct gl_program *program, /* we'll ignore extra data below */ } else { - /* non-array: count must be one */ - if (count != 1) { + /* non-array: count must be at most one; count == 0 is handled by the loop below */ + if (count > 1) { _mesa_error(ctx, GL_INVALID_OPERATION, "glUniform(uniform is not an array)"); return; @@ -1880,20 +1880,27 @@ set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program, GLboolean transpose, const GLfloat *values) { GLuint mat, row, col; - GLuint dst = index + offset, src = 0; + GLuint src = 0; + const struct gl_program_parameter * param = &program->Parameters->Parameters[index]; + const GLint slots = (param->Size + 3) / 4; + const GLint typeSize = sizeof_glsl_type(param->DataType); GLint nr, nc; /* check that the number of rows, columns is correct */ - get_matrix_dims(program->Parameters->Parameters[index].DataType, &nr, &nc); + get_matrix_dims(param->DataType, &nr, &nc); if (rows != nr || cols != nc) { _mesa_error(ctx, GL_INVALID_OPERATION, "glUniformMatrix(matrix size mismatch)"); return; } - if (index + offset > program->Parameters->Size) { - /* out of bounds! */ - return; + if (param->Size <= typeSize) { + /* non-array: count must be at most one; count == 0 is handled by the loop below */ + if (count > 1) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glUniformMatrix(uniform is not an array)"); + return; + } } /* @@ -1907,7 +1914,12 @@ set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program, /* each matrix: */ for (col = 0; col < cols; col++) { - GLfloat *v = program->Parameters->ParameterValues[dst]; + GLfloat *v; + if (offset >= slots) { + /* Ignore writes beyond the end of (the used part of) an array */ + return; + } + v = program->Parameters->ParameterValues[index + offset]; for (row = 0; row < rows; row++) { if (transpose) { v[row] = values[src + row * cols + col]; @@ -1916,7 +1928,8 @@ set_program_uniform_matrix(GLcontext *ctx, struct gl_program *program, v[row] = values[src + col * rows + row]; } } - dst++; + + offset++; } src += rows * cols; /* next matrix */ -- cgit v1.2.3 From cf6209b274c83f3018c9f0855de769285325b98f Mon Sep 17 00:00:00 2001 From: Joakim Sindholt Date: Wed, 7 Oct 2009 21:02:18 +0200 Subject: r300compiler: fix scons build again --- src/mesa/drivers/dri/r300/compiler/SConscript | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/SConscript b/src/mesa/drivers/dri/r300/compiler/SConscript index 48fd65fb71..46075a8aee 100755 --- a/src/mesa/drivers/dri/r300/compiler/SConscript +++ b/src/mesa/drivers/dri/r300/compiler/SConscript @@ -12,10 +12,17 @@ r300compiler = env.ConvenienceLibrary( source = [ 'radeon_code.c', 'radeon_compiler.c', - 'radeon_nqssadce.c', 'radeon_program.c', + 'radeon_program_print.c', + 'radeon_opcodes.c', 'radeon_program_alu.c', 'radeon_program_pair.c', + 'radeon_pair_translate.c', + 'radeon_pair_schedule.c', + 'radeon_pair_regalloc.c', + 'radeon_dataflow.c', + 'radeon_dataflow_deadcode.c', + 'radeon_dataflow_swizzles.c', 'r3xx_fragprog.c', 'r300_fragprog.c', 'r300_fragprog_swizzle.c', -- cgit v1.2.3 From 9a0ff33ad60cb63d430c4f93f6531f7aa2ec2ba8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 7 Oct 2009 13:17:20 -0600 Subject: softpipe: prefix non-static functions with sp_ --- src/gallium/drivers/softpipe/sp_prim_vbuf.c | 86 ++++++++++++++--------------- src/gallium/drivers/softpipe/sp_setup.c | 12 ++-- src/gallium/drivers/softpipe/sp_setup.h | 12 ++-- 3 files changed, 55 insertions(+), 55 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_prim_vbuf.c b/src/gallium/drivers/softpipe/sp_prim_vbuf.c index e603c20fc4..5fbac06a53 100644 --- a/src/gallium/drivers/softpipe/sp_prim_vbuf.c +++ b/src/gallium/drivers/softpipe/sp_prim_vbuf.c @@ -138,7 +138,7 @@ sp_vbuf_set_primitive(struct vbuf_render *vbr, unsigned prim) struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr); struct setup_context *setup_ctx = cvbr->setup; - setup_prepare( setup_ctx ); + sp_setup_prepare( setup_ctx ); cvbr->softpipe->reduced_prim = u_reduced_prim(prim); cvbr->prim = prim; @@ -171,14 +171,14 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) switch (cvbr->prim) { case PIPE_PRIM_POINTS: for (i = 0; i < nr; i++) { - setup_point( setup_ctx, + sp_setup_point( setup_ctx, get_vert(vertex_buffer, indices[i-0], stride) ); } break; case PIPE_PRIM_LINES: for (i = 1; i < nr; i += 2) { - setup_line( setup_ctx, + sp_setup_line( setup_ctx, get_vert(vertex_buffer, indices[i-1], stride), get_vert(vertex_buffer, indices[i-0], stride) ); } @@ -186,7 +186,7 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) case PIPE_PRIM_LINE_STRIP: for (i = 1; i < nr; i ++) { - setup_line( setup_ctx, + sp_setup_line( setup_ctx, get_vert(vertex_buffer, indices[i-1], stride), get_vert(vertex_buffer, indices[i-0], stride) ); } @@ -194,12 +194,12 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) case PIPE_PRIM_LINE_LOOP: for (i = 1; i < nr; i ++) { - setup_line( setup_ctx, + sp_setup_line( setup_ctx, get_vert(vertex_buffer, indices[i-1], stride), get_vert(vertex_buffer, indices[i-0], stride) ); } if (nr) { - setup_line( setup_ctx, + sp_setup_line( setup_ctx, get_vert(vertex_buffer, indices[nr-1], stride), get_vert(vertex_buffer, indices[0], stride) ); } @@ -208,7 +208,7 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) case PIPE_PRIM_TRIANGLES: if (softpipe->rasterizer->flatshade_first) { for (i = 2; i < nr; i += 3) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i-1], stride), get_vert(vertex_buffer, indices[i-0], stride), get_vert(vertex_buffer, indices[i-2], stride) ); @@ -216,7 +216,7 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) } else { for (i = 2; i < nr; i += 3) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i-2], stride), get_vert(vertex_buffer, indices[i-1], stride), get_vert(vertex_buffer, indices[i-0], stride) ); @@ -227,7 +227,7 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) case PIPE_PRIM_TRIANGLE_STRIP: if (softpipe->rasterizer->flatshade_first) { for (i = 2; i < nr; i += 1) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i+(i&1)-1], stride), get_vert(vertex_buffer, indices[i-(i&1)], stride), get_vert(vertex_buffer, indices[i-2], stride) ); @@ -235,7 +235,7 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) } else { for (i = 2; i < nr; i += 1) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i+(i&1)-2], stride), get_vert(vertex_buffer, indices[i-(i&1)-1], stride), get_vert(vertex_buffer, indices[i-0], stride) ); @@ -246,7 +246,7 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) case PIPE_PRIM_TRIANGLE_FAN: if (softpipe->rasterizer->flatshade_first) { for (i = 2; i < nr; i += 1) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i-0], stride), get_vert(vertex_buffer, indices[0], stride), get_vert(vertex_buffer, indices[i-1], stride) ); @@ -254,7 +254,7 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) } else { for (i = 2; i < nr; i += 1) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, indices[0], stride), get_vert(vertex_buffer, indices[i-1], stride), get_vert(vertex_buffer, indices[i-0], stride) ); @@ -265,11 +265,11 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) case PIPE_PRIM_QUADS: if (softpipe->rasterizer->flatshade_first) { for (i = 3; i < nr; i += 4) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i-2], stride), get_vert(vertex_buffer, indices[i-1], stride), get_vert(vertex_buffer, indices[i-3], stride) ); - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i-1], stride), get_vert(vertex_buffer, indices[i-0], stride), get_vert(vertex_buffer, indices[i-3], stride) ); @@ -277,12 +277,12 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) } else { for (i = 3; i < nr; i += 4) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i-3], stride), get_vert(vertex_buffer, indices[i-2], stride), get_vert(vertex_buffer, indices[i-0], stride) ); - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i-2], stride), get_vert(vertex_buffer, indices[i-1], stride), get_vert(vertex_buffer, indices[i-0], stride) ); @@ -293,11 +293,11 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) case PIPE_PRIM_QUAD_STRIP: if (softpipe->rasterizer->flatshade_first) { for (i = 3; i < nr; i += 2) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i-0], stride), get_vert(vertex_buffer, indices[i-1], stride), get_vert(vertex_buffer, indices[i-3], stride)); - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i-2], stride), get_vert(vertex_buffer, indices[i-0], stride), get_vert(vertex_buffer, indices[i-3], stride) ); @@ -305,11 +305,11 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) } else { for (i = 3; i < nr; i += 2) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i-3], stride), get_vert(vertex_buffer, indices[i-2], stride), get_vert(vertex_buffer, indices[i-0], stride) ); - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i-1], stride), get_vert(vertex_buffer, indices[i-3], stride), get_vert(vertex_buffer, indices[i-0], stride) ); @@ -324,7 +324,7 @@ sp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) * flatshade_first state makes no difference. */ for (i = 2; i < nr; i += 1) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, indices[i-0], stride), get_vert(vertex_buffer, indices[i-1], stride), get_vert(vertex_buffer, indices[0], stride) ); @@ -355,14 +355,14 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) switch (cvbr->prim) { case PIPE_PRIM_POINTS: for (i = 0; i < nr; i++) { - setup_point( setup_ctx, + sp_setup_point( setup_ctx, get_vert(vertex_buffer, i-0, stride) ); } break; case PIPE_PRIM_LINES: for (i = 1; i < nr; i += 2) { - setup_line( setup_ctx, + sp_setup_line( setup_ctx, get_vert(vertex_buffer, i-1, stride), get_vert(vertex_buffer, i-0, stride) ); } @@ -370,7 +370,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) case PIPE_PRIM_LINE_STRIP: for (i = 1; i < nr; i ++) { - setup_line( setup_ctx, + sp_setup_line( setup_ctx, get_vert(vertex_buffer, i-1, stride), get_vert(vertex_buffer, i-0, stride) ); } @@ -378,12 +378,12 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) case PIPE_PRIM_LINE_LOOP: for (i = 1; i < nr; i ++) { - setup_line( setup_ctx, + sp_setup_line( setup_ctx, get_vert(vertex_buffer, i-1, stride), get_vert(vertex_buffer, i-0, stride) ); } if (nr) { - setup_line( setup_ctx, + sp_setup_line( setup_ctx, get_vert(vertex_buffer, nr-1, stride), get_vert(vertex_buffer, 0, stride) ); } @@ -392,7 +392,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) case PIPE_PRIM_TRIANGLES: if (softpipe->rasterizer->flatshade_first) { for (i = 2; i < nr; i += 3) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, i-1, stride), get_vert(vertex_buffer, i-0, stride), get_vert(vertex_buffer, i-2, stride) ); @@ -400,7 +400,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } else { for (i = 2; i < nr; i += 3) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, i-2, stride), get_vert(vertex_buffer, i-1, stride), get_vert(vertex_buffer, i-0, stride) ); @@ -411,7 +411,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) case PIPE_PRIM_TRIANGLE_STRIP: if (softpipe->rasterizer->flatshade_first) { for (i = 2; i < nr; i++) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, i+(i&1)-1, stride), get_vert(vertex_buffer, i-(i&1), stride), get_vert(vertex_buffer, i-2, stride) ); @@ -419,7 +419,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } else { for (i = 2; i < nr; i++) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, i+(i&1)-2, stride), get_vert(vertex_buffer, i-(i&1)-1, stride), get_vert(vertex_buffer, i-0, stride) ); @@ -430,7 +430,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) case PIPE_PRIM_TRIANGLE_FAN: if (softpipe->rasterizer->flatshade_first) { for (i = 2; i < nr; i += 1) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, i-0, stride), get_vert(vertex_buffer, 0, stride), get_vert(vertex_buffer, i-1, stride) ); @@ -438,7 +438,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } else { for (i = 2; i < nr; i += 1) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, 0, stride), get_vert(vertex_buffer, i-1, stride), get_vert(vertex_buffer, i-0, stride) ); @@ -449,11 +449,11 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) case PIPE_PRIM_QUADS: if (softpipe->rasterizer->flatshade_first) { for (i = 3; i < nr; i += 4) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, i-2, stride), get_vert(vertex_buffer, i-1, stride), get_vert(vertex_buffer, i-3, stride) ); - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, i-1, stride), get_vert(vertex_buffer, i-0, stride), get_vert(vertex_buffer, i-3, stride) ); @@ -461,11 +461,11 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } else { for (i = 3; i < nr; i += 4) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, i-3, stride), get_vert(vertex_buffer, i-2, stride), get_vert(vertex_buffer, i-0, stride) ); - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, i-2, stride), get_vert(vertex_buffer, i-1, stride), get_vert(vertex_buffer, i-0, stride) ); @@ -476,11 +476,11 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) case PIPE_PRIM_QUAD_STRIP: if (softpipe->rasterizer->flatshade_first) { for (i = 3; i < nr; i += 2) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, i-0, stride), get_vert(vertex_buffer, i-1, stride), get_vert(vertex_buffer, i-3, stride) ); - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, i-2, stride), get_vert(vertex_buffer, i-0, stride), get_vert(vertex_buffer, i-3, stride) ); @@ -488,11 +488,11 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) } else { for (i = 3; i < nr; i += 2) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, i-3, stride), get_vert(vertex_buffer, i-2, stride), get_vert(vertex_buffer, i-0, stride) ); - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, i-1, stride), get_vert(vertex_buffer, i-3, stride), get_vert(vertex_buffer, i-0, stride) ); @@ -507,7 +507,7 @@ sp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) * flatshade_first state makes no difference. */ for (i = 2; i < nr; i += 1) { - setup_tri( setup_ctx, + sp_setup_tri( setup_ctx, get_vert(vertex_buffer, i-1, stride), get_vert(vertex_buffer, i-0, stride), get_vert(vertex_buffer, 0, stride) ); @@ -525,7 +525,7 @@ static void sp_vbuf_destroy(struct vbuf_render *vbr) { struct softpipe_vbuf_render *cvbr = softpipe_vbuf_render(vbr); - setup_destroy_context(cvbr->setup); + sp_setup_destroy_context(cvbr->setup); FREE(cvbr); } @@ -556,7 +556,7 @@ sp_create_vbuf_backend(struct softpipe_context *sp) cvbr->softpipe = sp; - cvbr->setup = setup_create_context(cvbr->softpipe); + cvbr->setup = sp_setup_create_context(cvbr->softpipe); return &cvbr->base; } diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c index ade125662a..e55e209fd1 100644 --- a/src/gallium/drivers/softpipe/sp_setup.c +++ b/src/gallium/drivers/softpipe/sp_setup.c @@ -696,7 +696,7 @@ calc_det( const float (*v0)[4], /** * Do setup for triangle rasterization, then render the triangle. */ -void setup_tri( struct setup_context *setup, +void sp_setup_tri( struct setup_context *setup, const float (*v0)[4], const float (*v1)[4], const float (*v2)[4] ) @@ -915,7 +915,7 @@ plot(struct setup_context *setup, int x, int y) * to handle stippling and wide lines. */ void -setup_line(struct setup_context *setup, +sp_setup_line(struct setup_context *setup, const float (*v0)[4], const float (*v1)[4]) { @@ -1045,7 +1045,7 @@ point_persp_coeff(const struct setup_context *setup, * XXX could optimize a lot for 1-pixel points. */ void -setup_point( struct setup_context *setup, +sp_setup_point( struct setup_context *setup, const float (*v0)[4] ) { struct softpipe_context *softpipe = setup->softpipe; @@ -1246,7 +1246,7 @@ setup_point( struct setup_context *setup, } } -void setup_prepare( struct setup_context *setup ) +void sp_setup_prepare( struct setup_context *setup ) { struct softpipe_context *sp = setup->softpipe; @@ -1270,7 +1270,7 @@ void setup_prepare( struct setup_context *setup ) -void setup_destroy_context( struct setup_context *setup ) +void sp_setup_destroy_context( struct setup_context *setup ) { FREE( setup ); } @@ -1279,7 +1279,7 @@ void setup_destroy_context( struct setup_context *setup ) /** * Create a new primitive setup/render stage. */ -struct setup_context *setup_create_context( struct softpipe_context *softpipe ) +struct setup_context *sp_setup_create_context( struct softpipe_context *softpipe ) { struct setup_context *setup = CALLOC_STRUCT(setup_context); unsigned i; diff --git a/src/gallium/drivers/softpipe/sp_setup.h b/src/gallium/drivers/softpipe/sp_setup.h index d54f334428..9c8844d2e8 100644 --- a/src/gallium/drivers/softpipe/sp_setup.h +++ b/src/gallium/drivers/softpipe/sp_setup.h @@ -31,23 +31,23 @@ struct setup_context; struct softpipe_context; void -setup_tri( struct setup_context *setup, +sp_setup_tri( struct setup_context *setup, const float (*v0)[4], const float (*v1)[4], const float (*v2)[4] ); void -setup_line(struct setup_context *setup, +sp_setup_line(struct setup_context *setup, const float (*v0)[4], const float (*v1)[4]); void -setup_point( struct setup_context *setup, +sp_setup_point( struct setup_context *setup, const float (*v0)[4] ); -struct setup_context *setup_create_context( struct softpipe_context *softpipe ); -void setup_prepare( struct setup_context *setup ); -void setup_destroy_context( struct setup_context *setup ); +struct setup_context *sp_setup_create_context( struct softpipe_context *softpipe ); +void sp_setup_prepare( struct setup_context *setup ); +void sp_setup_destroy_context( struct setup_context *setup ); #endif -- cgit v1.2.3 From 0fb71be2179ebf140b086682f050399809ef57b8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 7 Oct 2009 13:21:57 -0600 Subject: softpipe: whitespace and comment fixes --- src/gallium/drivers/softpipe/sp_context.h | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index 43a195c8ef..a735573d6f 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -85,7 +85,7 @@ struct softpipe_context { /** Mapped vertex buffers */ ubyte *mapped_vbuffer[PIPE_MAX_ATTRIBS]; - + /** Mapped constant buffers */ void *mapped_constants[PIPE_SHADER_TYPES]; @@ -96,14 +96,13 @@ struct softpipe_context { /** Which vertex shader output slot contains point size */ int psize_slot; - /* The reduced version of the primitive supplied by the state - * tracker. - */ + /** The reduced version of the primitive supplied by the state tracker */ unsigned reduced_api_prim; - /* The reduced primitive after unfilled triangles, wide-line - * decomposition, etc, are taken into account. This is the - * primitive actually rasterized. + /** + * The reduced primitive after unfilled triangles, wide-line decomposition, + * etc, are taken into account. This is the primitive type that's actually + * rasterized. */ unsigned reduced_prim; @@ -117,7 +116,6 @@ struct softpipe_context { struct quad_stage *shade; struct quad_stage *depth_test; struct quad_stage *blend; - struct quad_stage *first; /**< points to one of the above stages */ } quad; @@ -135,10 +133,10 @@ struct softpipe_context { struct draw_stage *vbuf; boolean dirty_render_cache; - + struct softpipe_tile_cache *cbuf_cache[PIPE_MAX_COLOR_BUFS]; struct softpipe_tile_cache *zsbuf_cache; - + unsigned tex_timestamp; struct softpipe_tex_tile_cache *tex_cache[PIPE_MAX_SAMPLERS]; @@ -159,4 +157,3 @@ softpipe_reset_sampler_varients(struct softpipe_context *softpipe); #endif /* SP_CONTEXT_H */ - -- cgit v1.2.3 From 2b9418b2785b3f25fc44daf90436f24b4de35980 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 7 Oct 2009 13:30:48 -0600 Subject: softpipe: new comments --- src/gallium/drivers/softpipe/sp_texture.c | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 2e6c43c7ef..7caf2928b4 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -111,6 +111,9 @@ softpipe_displaytarget_layout(struct pipe_screen *screen, } +/** + * Create new pipe_texture given the template information. + */ static struct pipe_texture * softpipe_texture_create(struct pipe_screen *screen, const struct pipe_texture *template) @@ -145,6 +148,9 @@ softpipe_texture_create(struct pipe_screen *screen, } +/** + * Create a new pipe_texture which wraps an existing buffer. + */ static struct pipe_texture * softpipe_texture_blanket(struct pipe_screen * screen, const struct pipe_texture *base, @@ -188,6 +194,9 @@ softpipe_texture_destroy(struct pipe_texture *pt) } +/** + * Get a pipe_surface "view" into a texture. + */ static struct pipe_surface * softpipe_get_tex_surface(struct pipe_screen *screen, struct pipe_texture *pt, @@ -248,6 +257,9 @@ softpipe_get_tex_surface(struct pipe_screen *screen, } +/** + * Free a pipe_surface which was created with softpipe_get_tex_surface(). + */ static void softpipe_tex_surface_destroy(struct pipe_surface *surf) { @@ -261,6 +273,18 @@ softpipe_tex_surface_destroy(struct pipe_surface *surf) } +/** + * Geta pipe_transfer object which is used for moving data in/out of + * a texture object. + * \param face one of PIPE_TEX_FACE_x or 0 + * \param level texture mipmap level + * \param zslice 2D slice of a 3D texture + * \param usage one of PIPE_TRANSFER_READ/WRITE/READ_WRITE + * \param x X position of region to read/write + * \param y Y position of region to read/write + * \param width width of region to read/write + * \param height height of region to read/write + */ static struct pipe_transfer * softpipe_get_tex_transfer(struct pipe_screen *screen, struct pipe_texture *texture, @@ -310,6 +334,10 @@ softpipe_get_tex_transfer(struct pipe_screen *screen, } +/** + * Free a pipe_transfer object which was created with + * softpipe_get_tex_transfer(). + */ static void softpipe_tex_transfer_destroy(struct pipe_transfer *transfer) { @@ -323,6 +351,9 @@ softpipe_tex_transfer_destroy(struct pipe_transfer *transfer) } +/** + * Create memory mapping for given pipe_transfer object. + */ static void * softpipe_transfer_map( struct pipe_screen *screen, struct pipe_transfer *transfer ) @@ -355,6 +386,9 @@ softpipe_transfer_map( struct pipe_screen *screen, } +/** + * Unmap memory mapping for given pipe_transfer object. + */ static void softpipe_transfer_unmap(struct pipe_screen *screen, struct pipe_transfer *transfer) @@ -372,6 +406,7 @@ softpipe_transfer_unmap(struct pipe_screen *screen, } } + static struct pipe_video_surface* softpipe_video_surface_create(struct pipe_screen *screen, enum pipe_video_chroma_format chroma_format, @@ -445,6 +480,10 @@ softpipe_init_screen_texture_funcs(struct pipe_screen *screen) } +/** + * Return pipe_buffer handle and stride for given texture object. + * XXX used for??? + */ boolean softpipe_get_texture_buffer( struct pipe_texture *texture, struct pipe_buffer **buf, -- cgit v1.2.3 From 7dd2c0afd68a90bb6b1f5f030c8d60bf6a562071 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 7 Oct 2009 14:07:49 -0600 Subject: mesa: don't need to free textures, VBOs, etc. in _mesa_meta_free() They're freed by the normal context deallocation code. Fixes Blender crash, bug 24185. --- src/mesa/drivers/common/meta.c | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 2741a41bf3..b6c6ef70fd 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -238,34 +238,10 @@ _mesa_meta_init(GLcontext *ctx) void _mesa_meta_free(GLcontext *ctx) { - struct gl_meta_state *meta = ctx->Meta; - - if (_mesa_get_current_context()) { - /* if there's no current context, these textures, buffers, etc should - * still get freed by _mesa_free_context_data(). - */ - - _mesa_DeleteTextures(1, &meta->TempTex.TexObj); - - /* glBlitFramebuffer */ - _mesa_DeleteBuffersARB(1, & meta->Blit.VBO); - _mesa_DeleteVertexArraysAPPLE(1, &meta->Blit.ArrayObj); - _mesa_DeletePrograms(1, &meta->Blit.DepthFP); - - /* glClear */ - _mesa_DeleteBuffersARB(1, & meta->Clear.VBO); - _mesa_DeleteVertexArraysAPPLE(1, &meta->Clear.ArrayObj); - - /* glCopyPixels */ - _mesa_DeleteBuffersARB(1, & meta->CopyPix.VBO); - _mesa_DeleteVertexArraysAPPLE(1, &meta->CopyPix.ArrayObj); - - /* glDrawPixels */ - _mesa_DeleteVertexArraysAPPLE(1, &meta->DrawPix.ArrayObj); - _mesa_DeletePrograms(1, &meta->DrawPix.DepthFP); - _mesa_DeletePrograms(1, &meta->DrawPix.StencilFP); - } - + /* Note: Any textures, VBOs, etc, that we allocate should get + * freed by the normal context destruction code. But this would be + * the place to free other meta data someday. + */ _mesa_free(ctx->Meta); ctx->Meta = NULL; } -- cgit v1.2.3 From 0083d2e40a8b0aa9ea36f98d4b6b7981d5dca0e3 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 7 Oct 2009 14:29:23 -0600 Subject: i915g: Fix MSVC build. --- src/gallium/drivers/i915/i915_prim_vbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/i915/i915_prim_vbuf.c b/src/gallium/drivers/i915/i915_prim_vbuf.c index 07546c03b2..6b832140a8 100644 --- a/src/gallium/drivers/i915/i915_prim_vbuf.c +++ b/src/gallium/drivers/i915/i915_prim_vbuf.c @@ -257,7 +257,7 @@ i915_vbuf_render_unmap_vertices(struct vbuf_render *render, iws->buffer_write(iws, i915_render->vbo, i915_render->map_used_start + i915_render->vbo_offset, i915_render->map_used_end - i915_render->map_used_start, - i915_render->vbo_ptr + i915_render->map_used_start); + (unsigned char *)i915_render->vbo_ptr + i915_render->map_used_start); #endif } -- cgit v1.2.3 From 9f002e4aaa2d7ea085cd0a3c66ff0fa533905382 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 7 Oct 2009 14:42:14 -0600 Subject: mesa/xlib: call XQueryExtension() in glXQueryExtension() See bug 24321. --- src/mesa/drivers/x11/fakeglx.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index 525db3b7cb..5c0084f37a 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -1639,13 +1639,15 @@ Fake_glXCopyContext( Display *dpy, GLXContext src, GLXContext dst, static Bool Fake_glXQueryExtension( Display *dpy, int *errorBase, int *eventBase ) { + int op, ev, err; /* Mesa's GLX isn't really an X extension but we try to act like one. */ - (void) dpy; + if (!XQueryExtension(dpy, GLX_EXTENSION_NAME, &op, &ev, &err)) + ev = err = 0; if (errorBase) - *errorBase = 0; + *errorBase = err; if (eventBase) - *eventBase = 0; - return True; + *eventBase = ev; + return True; /* we're faking GLX so always return success */ } -- cgit v1.2.3 From ee3fbe70672f32ae598a0005e027a6883a130e7b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 7 Oct 2009 14:43:27 -0600 Subject: gallium/xlib: call XQueryExtension() in glXQueryExtension() See bug 24321. --- src/gallium/state_trackers/glx/xlib/glx_api.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c index 556eefb1b1..f2881b9a31 100644 --- a/src/gallium/state_trackers/glx/xlib/glx_api.c +++ b/src/gallium/state_trackers/glx/xlib/glx_api.c @@ -1311,13 +1311,15 @@ glXCopyContext( Display *dpy, GLXContext src, GLXContext dst, Bool glXQueryExtension( Display *dpy, int *errorBase, int *eventBase ) { + int op, ev, err; /* Mesa's GLX isn't really an X extension but we try to act like one. */ - (void) dpy; + if (!XQueryExtension(dpy, GLX_EXTENSION_NAME, &op, &ev, &err)) + ev = err = 0; if (errorBase) - *errorBase = 0; + *errorBase = err; if (eventBase) - *eventBase = 0; - return True; + *eventBase = ev; + return True; /* we're faking GLX so always return success */ } -- cgit v1.2.3 From 6e1697bee72a95f7d605e42ce60e2cb4a545106f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 7 Oct 2009 16:03:04 -0600 Subject: mesa: rename display list functions _mesa_alloc_instruction() sounded like it was related to vertex/fragment program instructions, but it wasn't. --- src/mesa/main/dlist.c | 14 +++++++------- src/mesa/main/dlist.h | 10 +++++----- src/mesa/vbo/vbo_save_api.c | 12 ++++++------ 3 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 95c1b9015b..b886bd039f 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -796,7 +796,7 @@ unpack_image(GLcontext *ctx, GLuint dimensions, * opcode). */ void * -_mesa_alloc_instruction(GLcontext *ctx, GLuint opcode, GLuint bytes) +_mesa_dlist_alloc(GLcontext *ctx, GLuint opcode, GLuint bytes) { const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node); Node *n; @@ -847,11 +847,11 @@ _mesa_alloc_instruction(GLcontext *ctx, GLuint opcode, GLuint bytes) * \return the new opcode number or -1 if error */ GLint -_mesa_alloc_opcode(GLcontext *ctx, - GLuint size, - void (*execute) (GLcontext *, void *), - void (*destroy) (GLcontext *, void *), - void (*print) (GLcontext *, void *)) +_mesa_dlist_alloc_opcode(GLcontext *ctx, + GLuint size, + void (*execute) (GLcontext *, void *), + void (*destroy) (GLcontext *, void *), + void (*print) (GLcontext *, void *)) { if (ctx->ListExt.NumOpcodes < MAX_DLIST_EXT_OPCODES) { const GLuint i = ctx->ListExt.NumOpcodes++; @@ -875,7 +875,7 @@ _mesa_alloc_opcode(GLcontext *ctx, * usable data area. */ #define ALLOC_INSTRUCTION(CTX, OPCODE, NPARAMS) \ - ((Node *)_mesa_alloc_instruction(CTX, OPCODE, (NPARAMS)*sizeof(Node)) - 1) + ((Node *)_mesa_dlist_alloc(CTX, OPCODE, (NPARAMS)*sizeof(Node)) - 1) diff --git a/src/mesa/main/dlist.h b/src/mesa/main/dlist.h index af36991d5e..589cbc5992 100644 --- a/src/mesa/main/dlist.h +++ b/src/mesa/main/dlist.h @@ -61,12 +61,12 @@ extern void GLAPIENTRY _mesa_CallLists( GLsizei n, GLenum type, const GLvoid *li extern void _mesa_compile_error( GLcontext *ctx, GLenum error, const char *s ); -extern void *_mesa_alloc_instruction(GLcontext *ctx, GLuint opcode, GLuint sz); +extern void *_mesa_dlist_alloc(GLcontext *ctx, GLuint opcode, GLuint sz); -extern GLint _mesa_alloc_opcode( GLcontext *ctx, GLuint sz, - void (*execute)( GLcontext *, void * ), - void (*destroy)( GLcontext *, void * ), - void (*print)( GLcontext *, void * ) ); +extern GLint _mesa_dlist_alloc_opcode( GLcontext *ctx, GLuint sz, + void (*execute)( GLcontext *, void * ), + void (*destroy)( GLcontext *, void * ), + void (*print)( GLcontext *, void * ) ); extern void _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist); diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c index 4da248e2b8..3f86c68b24 100644 --- a/src/mesa/vbo/vbo_save_api.c +++ b/src/mesa/vbo/vbo_save_api.c @@ -270,7 +270,7 @@ static void _save_compile_vertex_list( GLcontext *ctx ) * being compiled. */ node = (struct vbo_save_vertex_list *) - _mesa_alloc_instruction(ctx, save->opcode_vertex_list, sizeof(*node)); + _mesa_dlist_alloc(ctx, save->opcode_vertex_list, sizeof(*node)); if (!node) return; @@ -1233,11 +1233,11 @@ void vbo_save_api_init( struct vbo_save_context *save ) GLuint i; save->opcode_vertex_list = - _mesa_alloc_opcode( ctx, - sizeof(struct vbo_save_vertex_list), - vbo_save_playback_vertex_list, - vbo_destroy_vertex_list, - vbo_print_vertex_list ); + _mesa_dlist_alloc_opcode( ctx, + sizeof(struct vbo_save_vertex_list), + vbo_save_playback_vertex_list, + vbo_destroy_vertex_list, + vbo_print_vertex_list ); ctx->Driver.NotifySaveBegin = vbo_save_NotifyBegin; -- cgit v1.2.3 From 77be195cf691bc7ba249f350e13c7ac06a78e9de Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 7 Oct 2009 16:12:26 -0600 Subject: main: replace ALLOC_INSTRUCTION macro with regular function --- src/mesa/main/dlist.c | 401 +++++++++++++++++++++++++------------------------- 1 file changed, 202 insertions(+), 199 deletions(-) (limited to 'src') diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index b886bd039f..f76323dff5 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -869,13 +869,16 @@ _mesa_dlist_alloc_opcode(GLcontext *ctx, /** * Allocate display list instruction. Returns Node ptr to where the opcode - * is stored. - * - nParams is the number of function parameters - * - return value a pointer to sizeof(Node) before the actual - * usable data area. + * is stored. The first function parameter would go in node[1]. + * \param opcode one of OPCODE_x + * \param nparams number of function parameters */ -#define ALLOC_INSTRUCTION(CTX, OPCODE, NPARAMS) \ - ((Node *)_mesa_dlist_alloc(CTX, OPCODE, (NPARAMS)*sizeof(Node)) - 1) +static INLINE Node * +alloc_instruction(GLcontext *ctx, OpCode opcode, GLuint nparams) +{ + return (Node *) + _mesa_dlist_alloc(ctx, opcode, nparams * sizeof(Node)) - 1; +} @@ -888,7 +891,7 @@ save_Accum(GLenum op, GLfloat value) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_ACCUM, 2); + n = alloc_instruction(ctx, OPCODE_ACCUM, 2); if (n) { n[1].e = op; n[2].f = value; @@ -905,7 +908,7 @@ save_AlphaFunc(GLenum func, GLclampf ref) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_ALPHA_FUNC, 2); + n = alloc_instruction(ctx, OPCODE_ALPHA_FUNC, 2); if (n) { n[1].e = func; n[2].f = (GLfloat) ref; @@ -922,7 +925,7 @@ save_BindTexture(GLenum target, GLuint texture) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_BIND_TEXTURE, 2); + n = alloc_instruction(ctx, OPCODE_BIND_TEXTURE, 2); if (n) { n[1].e = target; n[2].ui = texture; @@ -941,7 +944,7 @@ save_Bitmap(GLsizei width, GLsizei height, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_BITMAP, 7); + n = alloc_instruction(ctx, OPCODE_BITMAP, 7); if (n) { n[1].i = (GLint) width; n[2].i = (GLint) height; @@ -964,7 +967,7 @@ save_BlendEquation(GLenum mode) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_BLEND_EQUATION, 1); + n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION, 1); if (n) { n[1].e = mode; } @@ -980,7 +983,7 @@ save_BlendEquationSeparateEXT(GLenum modeRGB, GLenum modeA) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_BLEND_EQUATION_SEPARATE, 2); + n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE, 2); if (n) { n[1].e = modeRGB; n[2].e = modeA; @@ -998,7 +1001,7 @@ save_BlendFuncSeparateEXT(GLenum sfactorRGB, GLenum dfactorRGB, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_BLEND_FUNC_SEPARATE, 4); + n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE, 4); if (n) { n[1].e = sfactorRGB; n[2].e = dfactorRGB; @@ -1025,7 +1028,7 @@ save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_BLEND_COLOR, 4); + n = alloc_instruction(ctx, OPCODE_BLEND_COLOR, 4); if (n) { n[1].f = red; n[2].f = green; @@ -1059,7 +1062,7 @@ save_CallList(GLuint list) Node *n; SAVE_FLUSH_VERTICES(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_CALL_LIST, 1); + n = alloc_instruction(ctx, OPCODE_CALL_LIST, 1); if (n) { n[1].ui = list; } @@ -1103,7 +1106,7 @@ save_CallLists(GLsizei num, GLenum type, const GLvoid * lists) for (i = 0; i < num; i++) { GLint list = translate_id(i, type, lists); - Node *n = ALLOC_INSTRUCTION(ctx, OPCODE_CALL_LIST_OFFSET, 2); + Node *n = alloc_instruction(ctx, OPCODE_CALL_LIST_OFFSET, 2); if (n) { n[1].i = list; n[2].b = typeErrorFlag; @@ -1127,7 +1130,7 @@ save_Clear(GLbitfield mask) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR, 1); + n = alloc_instruction(ctx, OPCODE_CLEAR, 1); if (n) { n[1].bf = mask; } @@ -1143,7 +1146,7 @@ save_ClearAccum(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR_ACCUM, 4); + n = alloc_instruction(ctx, OPCODE_CLEAR_ACCUM, 4); if (n) { n[1].f = red; n[2].f = green; @@ -1162,7 +1165,7 @@ save_ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR_COLOR, 4); + n = alloc_instruction(ctx, OPCODE_CLEAR_COLOR, 4); if (n) { n[1].f = red; n[2].f = green; @@ -1181,7 +1184,7 @@ save_ClearDepth(GLclampd depth) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR_DEPTH, 1); + n = alloc_instruction(ctx, OPCODE_CLEAR_DEPTH, 1); if (n) { n[1].f = (GLfloat) depth; } @@ -1197,7 +1200,7 @@ save_ClearIndex(GLfloat c) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR_INDEX, 1); + n = alloc_instruction(ctx, OPCODE_CLEAR_INDEX, 1); if (n) { n[1].f = c; } @@ -1213,7 +1216,7 @@ save_ClearStencil(GLint s) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_CLEAR_STENCIL, 1); + n = alloc_instruction(ctx, OPCODE_CLEAR_STENCIL, 1); if (n) { n[1].i = s; } @@ -1229,7 +1232,7 @@ save_ClipPlane(GLenum plane, const GLdouble * equ) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_CLIP_PLANE, 5); + n = alloc_instruction(ctx, OPCODE_CLIP_PLANE, 5); if (n) { n[1].e = plane; n[2].f = (GLfloat) equ[0]; @@ -1251,7 +1254,7 @@ save_ColorMask(GLboolean red, GLboolean green, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_MASK, 4); + n = alloc_instruction(ctx, OPCODE_COLOR_MASK, 4); if (n) { n[1].b = red; n[2].b = green; @@ -1271,7 +1274,7 @@ save_ColorMaterial(GLenum face, GLenum mode) Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_MATERIAL, 2); + n = alloc_instruction(ctx, OPCODE_COLOR_MATERIAL, 2); if (n) { n[1].e = face; n[2].e = mode; @@ -1296,7 +1299,7 @@ save_ColorTable(GLenum target, GLenum internalFormat, else { Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_TABLE, 6); + n = alloc_instruction(ctx, OPCODE_COLOR_TABLE, 6); if (n) { n[1].e = target; n[2].e = internalFormat; @@ -1324,7 +1327,7 @@ save_ColorTableParameterfv(GLenum target, GLenum pname, ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_TABLE_PARAMETER_FV, 6); + n = alloc_instruction(ctx, OPCODE_COLOR_TABLE_PARAMETER_FV, 6); if (n) { n[1].e = target; n[2].e = pname; @@ -1353,7 +1356,7 @@ save_ColorTableParameteriv(GLenum target, GLenum pname, const GLint *params) ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_TABLE_PARAMETER_IV, 6); + n = alloc_instruction(ctx, OPCODE_COLOR_TABLE_PARAMETER_IV, 6); if (n) { n[1].e = target; n[2].e = pname; @@ -1382,7 +1385,7 @@ save_ColorSubTable(GLenum target, GLsizei start, GLsizei count, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_COLOR_SUB_TABLE, 6); + n = alloc_instruction(ctx, OPCODE_COLOR_SUB_TABLE, 6); if (n) { n[1].e = target; n[2].i = start; @@ -1407,7 +1410,7 @@ save_CopyColorSubTable(GLenum target, GLsizei start, Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_COLOR_SUB_TABLE, 5); + n = alloc_instruction(ctx, OPCODE_COPY_COLOR_SUB_TABLE, 5); if (n) { n[1].e = target; n[2].i = start; @@ -1429,7 +1432,7 @@ save_CopyColorTable(GLenum target, GLenum internalformat, Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_COLOR_TABLE, 5); + n = alloc_instruction(ctx, OPCODE_COPY_COLOR_TABLE, 5); if (n) { n[1].e = target; n[2].e = internalformat; @@ -1452,7 +1455,7 @@ save_ConvolutionFilter1D(GLenum target, GLenum internalFormat, GLsizei width, ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_FILTER_1D, 6); + n = alloc_instruction(ctx, OPCODE_CONVOLUTION_FILTER_1D, 6); if (n) { n[1].e = target; n[2].e = internalFormat; @@ -1479,7 +1482,7 @@ save_ConvolutionFilter2D(GLenum target, GLenum internalFormat, ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_FILTER_2D, 7); + n = alloc_instruction(ctx, OPCODE_CONVOLUTION_FILTER_2D, 7); if (n) { n[1].e = target; n[2].e = internalFormat; @@ -1504,7 +1507,7 @@ save_ConvolutionParameteri(GLenum target, GLenum pname, GLint param) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_PARAMETER_I, 3); + n = alloc_instruction(ctx, OPCODE_CONVOLUTION_PARAMETER_I, 3); if (n) { n[1].e = target; n[2].e = pname; @@ -1522,7 +1525,7 @@ save_ConvolutionParameteriv(GLenum target, GLenum pname, const GLint *params) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_PARAMETER_IV, 6); + n = alloc_instruction(ctx, OPCODE_CONVOLUTION_PARAMETER_IV, 6); if (n) { n[1].e = target; n[2].e = pname; @@ -1550,7 +1553,7 @@ save_ConvolutionParameterf(GLenum target, GLenum pname, GLfloat param) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_PARAMETER_F, 3); + n = alloc_instruction(ctx, OPCODE_CONVOLUTION_PARAMETER_F, 3); if (n) { n[1].e = target; n[2].e = pname; @@ -1569,7 +1572,7 @@ save_ConvolutionParameterfv(GLenum target, GLenum pname, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_CONVOLUTION_PARAMETER_FV, 6); + n = alloc_instruction(ctx, OPCODE_CONVOLUTION_PARAMETER_FV, 6); if (n) { n[1].e = target; n[2].e = pname; @@ -1597,7 +1600,7 @@ save_CopyPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum type) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_PIXELS, 5); + n = alloc_instruction(ctx, OPCODE_COPY_PIXELS, 5); if (n) { n[1].i = x; n[2].i = y; @@ -1619,7 +1622,7 @@ save_CopyTexImage1D(GLenum target, GLint level, GLenum internalformat, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_TEX_IMAGE1D, 7); + n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE1D, 7); if (n) { n[1].e = target; n[2].i = level; @@ -1645,7 +1648,7 @@ save_CopyTexImage2D(GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_TEX_IMAGE2D, 8); + n = alloc_instruction(ctx, OPCODE_COPY_TEX_IMAGE2D, 8); if (n) { n[1].e = target; n[2].i = level; @@ -1671,7 +1674,7 @@ save_CopyTexSubImage1D(GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6); + n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE1D, 6); if (n) { n[1].e = target; n[2].i = level; @@ -1695,7 +1698,7 @@ save_CopyTexSubImage2D(GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8); + n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE2D, 8); if (n) { n[1].e = target; n[2].i = level; @@ -1721,7 +1724,7 @@ save_CopyTexSubImage3D(GLenum target, GLint level, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9); + n = alloc_instruction(ctx, OPCODE_COPY_TEX_SUB_IMAGE3D, 9); if (n) { n[1].e = target; n[2].i = level; @@ -1747,7 +1750,7 @@ save_CullFace(GLenum mode) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_CULL_FACE, 1); + n = alloc_instruction(ctx, OPCODE_CULL_FACE, 1); if (n) { n[1].e = mode; } @@ -1763,7 +1766,7 @@ save_DepthFunc(GLenum func) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_DEPTH_FUNC, 1); + n = alloc_instruction(ctx, OPCODE_DEPTH_FUNC, 1); if (n) { n[1].e = func; } @@ -1779,7 +1782,7 @@ save_DepthMask(GLboolean mask) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_DEPTH_MASK, 1); + n = alloc_instruction(ctx, OPCODE_DEPTH_MASK, 1); if (n) { n[1].b = mask; } @@ -1795,7 +1798,7 @@ save_DepthRange(GLclampd nearval, GLclampd farval) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_DEPTH_RANGE, 2); + n = alloc_instruction(ctx, OPCODE_DEPTH_RANGE, 2); if (n) { n[1].f = (GLfloat) nearval; n[2].f = (GLfloat) farval; @@ -1812,7 +1815,7 @@ save_Disable(GLenum cap) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_DISABLE, 1); + n = alloc_instruction(ctx, OPCODE_DISABLE, 1); if (n) { n[1].e = cap; } @@ -1828,7 +1831,7 @@ save_DrawBuffer(GLenum mode) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_DRAW_BUFFER, 1); + n = alloc_instruction(ctx, OPCODE_DRAW_BUFFER, 1); if (n) { n[1].e = mode; } @@ -1847,7 +1850,7 @@ save_DrawPixels(GLsizei width, GLsizei height, ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_DRAW_PIXELS, 5); + n = alloc_instruction(ctx, OPCODE_DRAW_PIXELS, 5); if (n) { n[1].i = width; n[2].i = height; @@ -1869,7 +1872,7 @@ save_Enable(GLenum cap) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_ENABLE, 1); + n = alloc_instruction(ctx, OPCODE_ENABLE, 1); if (n) { n[1].e = cap; } @@ -1886,7 +1889,7 @@ save_EvalMesh1(GLenum mode, GLint i1, GLint i2) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_EVALMESH1, 3); + n = alloc_instruction(ctx, OPCODE_EVALMESH1, 3); if (n) { n[1].e = mode; n[2].i = i1; @@ -1904,7 +1907,7 @@ save_EvalMesh2(GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_EVALMESH2, 5); + n = alloc_instruction(ctx, OPCODE_EVALMESH2, 5); if (n) { n[1].e = mode; n[2].i = i1; @@ -1926,7 +1929,7 @@ save_Fogfv(GLenum pname, const GLfloat *params) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_FOG, 5); + n = alloc_instruction(ctx, OPCODE_FOG, 5); if (n) { n[1].e = pname; n[2].f = params[0]; @@ -1995,7 +1998,7 @@ save_FrontFace(GLenum mode) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_FRONT_FACE, 1); + n = alloc_instruction(ctx, OPCODE_FRONT_FACE, 1); if (n) { n[1].e = mode; } @@ -2012,7 +2015,7 @@ save_Frustum(GLdouble left, GLdouble right, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_FRUSTUM, 6); + n = alloc_instruction(ctx, OPCODE_FRUSTUM, 6); if (n) { n[1].f = (GLfloat) left; n[2].f = (GLfloat) right; @@ -2033,7 +2036,7 @@ save_Hint(GLenum target, GLenum mode) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_HINT, 2); + n = alloc_instruction(ctx, OPCODE_HINT, 2); if (n) { n[1].e = target; n[2].e = mode; @@ -2052,7 +2055,7 @@ save_Histogram(GLenum target, GLsizei width, GLenum internalFormat, Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_HISTOGRAM, 4); + n = alloc_instruction(ctx, OPCODE_HISTOGRAM, 4); if (n) { n[1].e = target; n[2].i = width; @@ -2071,7 +2074,7 @@ save_IndexMask(GLuint mask) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_INDEX_MASK, 1); + n = alloc_instruction(ctx, OPCODE_INDEX_MASK, 1); if (n) { n[1].ui = mask; } @@ -2086,7 +2089,7 @@ save_InitNames(void) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - (void) ALLOC_INSTRUCTION(ctx, OPCODE_INIT_NAMES, 0); + (void) alloc_instruction(ctx, OPCODE_INIT_NAMES, 0); if (ctx->ExecuteFlag) { CALL_InitNames(ctx->Exec, ()); } @@ -2099,7 +2102,7 @@ save_Lightfv(GLenum light, GLenum pname, const GLfloat *params) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_LIGHT, 6); + n = alloc_instruction(ctx, OPCODE_LIGHT, 6); if (n) { GLint i, nParams; n[1].e = light; @@ -2213,7 +2216,7 @@ save_LightModelfv(GLenum pname, const GLfloat *params) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_LIGHT_MODEL, 5); + n = alloc_instruction(ctx, OPCODE_LIGHT_MODEL, 5); if (n) { n[1].e = pname; n[2].f = params[0]; @@ -2280,7 +2283,7 @@ save_LineStipple(GLint factor, GLushort pattern) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_LINE_STIPPLE, 2); + n = alloc_instruction(ctx, OPCODE_LINE_STIPPLE, 2); if (n) { n[1].i = factor; n[2].us = pattern; @@ -2297,7 +2300,7 @@ save_LineWidth(GLfloat width) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_LINE_WIDTH, 1); + n = alloc_instruction(ctx, OPCODE_LINE_WIDTH, 1); if (n) { n[1].f = width; } @@ -2313,7 +2316,7 @@ save_ListBase(GLuint base) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_LIST_BASE, 1); + n = alloc_instruction(ctx, OPCODE_LIST_BASE, 1); if (n) { n[1].ui = base; } @@ -2328,7 +2331,7 @@ save_LoadIdentity(void) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - (void) ALLOC_INSTRUCTION(ctx, OPCODE_LOAD_IDENTITY, 0); + (void) alloc_instruction(ctx, OPCODE_LOAD_IDENTITY, 0); if (ctx->ExecuteFlag) { CALL_LoadIdentity(ctx->Exec, ()); } @@ -2341,7 +2344,7 @@ save_LoadMatrixf(const GLfloat * m) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_LOAD_MATRIX, 16); + n = alloc_instruction(ctx, OPCODE_LOAD_MATRIX, 16); if (n) { GLuint i; for (i = 0; i < 16; i++) { @@ -2372,7 +2375,7 @@ save_LoadName(GLuint name) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_LOAD_NAME, 1); + n = alloc_instruction(ctx, OPCODE_LOAD_NAME, 1); if (n) { n[1].ui = name; } @@ -2388,7 +2391,7 @@ save_LogicOp(GLenum opcode) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_LOGIC_OP, 1); + n = alloc_instruction(ctx, OPCODE_LOGIC_OP, 1); if (n) { n[1].e = opcode; } @@ -2405,7 +2408,7 @@ save_Map1d(GLenum target, GLdouble u1, GLdouble u2, GLint stride, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_MAP1, 6); + n = alloc_instruction(ctx, OPCODE_MAP1, 6); if (n) { GLfloat *pnts = _mesa_copy_map_points1d(target, stride, order, points); n[1].e = target; @@ -2427,7 +2430,7 @@ save_Map1f(GLenum target, GLfloat u1, GLfloat u2, GLint stride, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_MAP1, 6); + n = alloc_instruction(ctx, OPCODE_MAP1, 6); if (n) { GLfloat *pnts = _mesa_copy_map_points1f(target, stride, order, points); n[1].e = target; @@ -2452,7 +2455,7 @@ save_Map2d(GLenum target, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_MAP2, 10); + n = alloc_instruction(ctx, OPCODE_MAP2, 10); if (n) { GLfloat *pnts = _mesa_copy_map_points2d(target, ustride, uorder, vstride, vorder, points); @@ -2485,7 +2488,7 @@ save_Map2f(GLenum target, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_MAP2, 10); + n = alloc_instruction(ctx, OPCODE_MAP2, 10); if (n) { GLfloat *pnts = _mesa_copy_map_points2f(target, ustride, uorder, vstride, vorder, points); @@ -2514,7 +2517,7 @@ save_MapGrid1f(GLint un, GLfloat u1, GLfloat u2) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_MAPGRID1, 3); + n = alloc_instruction(ctx, OPCODE_MAPGRID1, 3); if (n) { n[1].i = un; n[2].f = u1; @@ -2540,7 +2543,7 @@ save_MapGrid2f(GLint un, GLfloat u1, GLfloat u2, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_MAPGRID2, 6); + n = alloc_instruction(ctx, OPCODE_MAPGRID2, 6); if (n) { n[1].i = un; n[2].f = u1; @@ -2571,7 +2574,7 @@ save_MatrixMode(GLenum mode) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_MATRIX_MODE, 1); + n = alloc_instruction(ctx, OPCODE_MATRIX_MODE, 1); if (n) { n[1].e = mode; } @@ -2588,7 +2591,7 @@ save_Minmax(GLenum target, GLenum internalFormat, GLboolean sink) Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_MIN_MAX, 3); + n = alloc_instruction(ctx, OPCODE_MIN_MAX, 3); if (n) { n[1].e = target; n[2].e = internalFormat; @@ -2606,7 +2609,7 @@ save_MultMatrixf(const GLfloat * m) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_MULT_MATRIX, 16); + n = alloc_instruction(ctx, OPCODE_MULT_MATRIX, 16); if (n) { GLuint i; for (i = 0; i < 16; i++) { @@ -2650,7 +2653,7 @@ save_Ortho(GLdouble left, GLdouble right, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_ORTHO, 6); + n = alloc_instruction(ctx, OPCODE_ORTHO, 6); if (n) { n[1].f = (GLfloat) left; n[2].f = (GLfloat) right; @@ -2671,7 +2674,7 @@ save_PixelMapfv(GLenum map, GLint mapsize, const GLfloat *values) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_PIXEL_MAP, 3); + n = alloc_instruction(ctx, OPCODE_PIXEL_MAP, 3); if (n) { n[1].e = map; n[2].i = mapsize; @@ -2728,7 +2731,7 @@ save_PixelTransferf(GLenum pname, GLfloat param) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_PIXEL_TRANSFER, 2); + n = alloc_instruction(ctx, OPCODE_PIXEL_TRANSFER, 2); if (n) { n[1].e = pname; n[2].f = param; @@ -2752,7 +2755,7 @@ save_PixelZoom(GLfloat xfactor, GLfloat yfactor) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_PIXEL_ZOOM, 2); + n = alloc_instruction(ctx, OPCODE_PIXEL_ZOOM, 2); if (n) { n[1].f = xfactor; n[2].f = yfactor; @@ -2769,7 +2772,7 @@ save_PointParameterfvEXT(GLenum pname, const GLfloat *params) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_POINT_PARAMETERS, 4); + n = alloc_instruction(ctx, OPCODE_POINT_PARAMETERS, 4); if (n) { n[1].e = pname; n[2].f = params[0]; @@ -2816,7 +2819,7 @@ save_PointSize(GLfloat size) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_POINT_SIZE, 1); + n = alloc_instruction(ctx, OPCODE_POINT_SIZE, 1); if (n) { n[1].f = size; } @@ -2832,7 +2835,7 @@ save_PolygonMode(GLenum face, GLenum mode) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_POLYGON_MODE, 2); + n = alloc_instruction(ctx, OPCODE_POLYGON_MODE, 2); if (n) { n[1].e = face; n[2].e = mode; @@ -2851,7 +2854,7 @@ save_PolygonStipple(const GLubyte * pattern) ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_POLYGON_STIPPLE, 1); + n = alloc_instruction(ctx, OPCODE_POLYGON_STIPPLE, 1); if (n) { n[1].data = unpack_image(ctx, 2, 32, 32, 1, GL_COLOR_INDEX, GL_BITMAP, pattern, &ctx->Unpack); @@ -2868,7 +2871,7 @@ save_PolygonOffset(GLfloat factor, GLfloat units) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_POLYGON_OFFSET, 2); + n = alloc_instruction(ctx, OPCODE_POLYGON_OFFSET, 2); if (n) { n[1].f = factor; n[2].f = units; @@ -2893,7 +2896,7 @@ save_PopAttrib(void) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - (void) ALLOC_INSTRUCTION(ctx, OPCODE_POP_ATTRIB, 0); + (void) alloc_instruction(ctx, OPCODE_POP_ATTRIB, 0); if (ctx->ExecuteFlag) { CALL_PopAttrib(ctx->Exec, ()); } @@ -2905,7 +2908,7 @@ save_PopMatrix(void) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - (void) ALLOC_INSTRUCTION(ctx, OPCODE_POP_MATRIX, 0); + (void) alloc_instruction(ctx, OPCODE_POP_MATRIX, 0); if (ctx->ExecuteFlag) { CALL_PopMatrix(ctx->Exec, ()); } @@ -2917,7 +2920,7 @@ save_PopName(void) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - (void) ALLOC_INSTRUCTION(ctx, OPCODE_POP_NAME, 0); + (void) alloc_instruction(ctx, OPCODE_POP_NAME, 0); if (ctx->ExecuteFlag) { CALL_PopName(ctx->Exec, ()); } @@ -2934,7 +2937,7 @@ save_PrioritizeTextures(GLsizei num, const GLuint * textures, for (i = 0; i < num; i++) { Node *n; - n = ALLOC_INSTRUCTION(ctx, OPCODE_PRIORITIZE_TEXTURE, 2); + n = alloc_instruction(ctx, OPCODE_PRIORITIZE_TEXTURE, 2); if (n) { n[1].ui = textures[i]; n[2].f = priorities[i]; @@ -2952,7 +2955,7 @@ save_PushAttrib(GLbitfield mask) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_PUSH_ATTRIB, 1); + n = alloc_instruction(ctx, OPCODE_PUSH_ATTRIB, 1); if (n) { n[1].bf = mask; } @@ -2967,7 +2970,7 @@ save_PushMatrix(void) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - (void) ALLOC_INSTRUCTION(ctx, OPCODE_PUSH_MATRIX, 0); + (void) alloc_instruction(ctx, OPCODE_PUSH_MATRIX, 0); if (ctx->ExecuteFlag) { CALL_PushMatrix(ctx->Exec, ()); } @@ -2980,7 +2983,7 @@ save_PushName(GLuint name) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_PUSH_NAME, 1); + n = alloc_instruction(ctx, OPCODE_PUSH_NAME, 1); if (n) { n[1].ui = name; } @@ -2996,7 +2999,7 @@ save_RasterPos4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_RASTER_POS, 4); + n = alloc_instruction(ctx, OPCODE_RASTER_POS, 4); if (n) { n[1].f = x; n[2].f = y; @@ -3155,7 +3158,7 @@ save_PassThrough(GLfloat token) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_PASSTHROUGH, 1); + n = alloc_instruction(ctx, OPCODE_PASSTHROUGH, 1); if (n) { n[1].f = token; } @@ -3171,7 +3174,7 @@ save_ReadBuffer(GLenum mode) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_READ_BUFFER, 1); + n = alloc_instruction(ctx, OPCODE_READ_BUFFER, 1); if (n) { n[1].e = mode; } @@ -3187,7 +3190,7 @@ save_ResetHistogram(GLenum target) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_RESET_HISTOGRAM, 1); + n = alloc_instruction(ctx, OPCODE_RESET_HISTOGRAM, 1); if (n) { n[1].e = target; } @@ -3203,7 +3206,7 @@ save_ResetMinmax(GLenum target) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_RESET_MIN_MAX, 1); + n = alloc_instruction(ctx, OPCODE_RESET_MIN_MAX, 1); if (n) { n[1].e = target; } @@ -3219,7 +3222,7 @@ save_Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_ROTATE, 4); + n = alloc_instruction(ctx, OPCODE_ROTATE, 4); if (n) { n[1].f = angle; n[2].f = x; @@ -3245,7 +3248,7 @@ save_Scalef(GLfloat x, GLfloat y, GLfloat z) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_SCALE, 3); + n = alloc_instruction(ctx, OPCODE_SCALE, 3); if (n) { n[1].f = x; n[2].f = y; @@ -3270,7 +3273,7 @@ save_Scissor(GLint x, GLint y, GLsizei width, GLsizei height) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_SCISSOR, 4); + n = alloc_instruction(ctx, OPCODE_SCISSOR, 4); if (n) { n[1].i = x; n[2].i = y; @@ -3304,7 +3307,7 @@ save_ShadeModel(GLenum mode) if (ctx->Driver.CurrentSavePrimitive == PRIM_OUTSIDE_BEGIN_END) ctx->ListState.Current.ShadeModel = mode; - n = ALLOC_INSTRUCTION(ctx, OPCODE_SHADE_MODEL, 1); + n = alloc_instruction(ctx, OPCODE_SHADE_MODEL, 1); if (n) { n[1].e = mode; } @@ -3317,7 +3320,7 @@ save_StencilFunc(GLenum func, GLint ref, GLuint mask) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC, 3); + n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC, 3); if (n) { n[1].e = func; n[2].i = ref; @@ -3335,7 +3338,7 @@ save_StencilMask(GLuint mask) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_MASK, 1); + n = alloc_instruction(ctx, OPCODE_STENCIL_MASK, 1); if (n) { n[1].ui = mask; } @@ -3351,7 +3354,7 @@ save_StencilOp(GLenum fail, GLenum zfail, GLenum zpass) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_OP, 3); + n = alloc_instruction(ctx, OPCODE_STENCIL_OP, 3); if (n) { n[1].e = fail; n[2].e = zfail; @@ -3369,7 +3372,7 @@ save_StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4); + n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4); if (n) { n[1].e = face; n[2].e = func; @@ -3390,7 +3393,7 @@ save_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref, Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); /* GL_FRONT */ - n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4); + n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4); if (n) { n[1].e = GL_FRONT; n[2].e = frontfunc; @@ -3398,7 +3401,7 @@ save_StencilFuncSeparateATI(GLenum frontfunc, GLenum backfunc, GLint ref, n[4].ui = mask; } /* GL_BACK */ - n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4); + n = alloc_instruction(ctx, OPCODE_STENCIL_FUNC_SEPARATE, 4); if (n) { n[1].e = GL_BACK; n[2].e = backfunc; @@ -3418,7 +3421,7 @@ save_StencilMaskSeparate(GLenum face, GLuint mask) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2); + n = alloc_instruction(ctx, OPCODE_STENCIL_MASK_SEPARATE, 2); if (n) { n[1].e = face; n[2].ui = mask; @@ -3435,7 +3438,7 @@ save_StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_STENCIL_OP_SEPARATE, 4); + n = alloc_instruction(ctx, OPCODE_STENCIL_OP_SEPARATE, 4); if (n) { n[1].e = face; n[2].e = fail; @@ -3454,7 +3457,7 @@ save_TexEnvfv(GLenum target, GLenum pname, const GLfloat *params) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_TEXENV, 6); + n = alloc_instruction(ctx, OPCODE_TEXENV, 6); if (n) { n[1].e = target; n[2].e = pname; @@ -3519,7 +3522,7 @@ save_TexGenfv(GLenum coord, GLenum pname, const GLfloat *params) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_TEXGEN, 6); + n = alloc_instruction(ctx, OPCODE_TEXGEN, 6); if (n) { n[1].e = coord; n[2].e = pname; @@ -3594,7 +3597,7 @@ save_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_TEXPARAMETER, 6); + n = alloc_instruction(ctx, OPCODE_TEXPARAMETER, 6); if (n) { n[1].e = target; n[2].e = pname; @@ -3654,7 +3657,7 @@ save_TexImage1D(GLenum target, else { Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_IMAGE1D, 8); + n = alloc_instruction(ctx, OPCODE_TEX_IMAGE1D, 8); if (n) { n[1].e = target; n[2].i = level; @@ -3689,7 +3692,7 @@ save_TexImage2D(GLenum target, else { Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_IMAGE2D, 9); + n = alloc_instruction(ctx, OPCODE_TEX_IMAGE2D, 9); if (n) { n[1].e = target; n[2].i = level; @@ -3727,7 +3730,7 @@ save_TexImage3D(GLenum target, else { Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_IMAGE3D, 10); + n = alloc_instruction(ctx, OPCODE_TEX_IMAGE3D, 10); if (n) { n[1].e = target; n[2].i = level; @@ -3760,7 +3763,7 @@ save_TexSubImage1D(GLenum target, GLint level, GLint xoffset, ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_SUB_IMAGE1D, 7); + n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE1D, 7); if (n) { n[1].e = target; n[2].i = level; @@ -3789,7 +3792,7 @@ save_TexSubImage2D(GLenum target, GLint level, ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_SUB_IMAGE2D, 9); + n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE2D, 9); if (n) { n[1].e = target; n[2].i = level; @@ -3820,7 +3823,7 @@ save_TexSubImage3D(GLenum target, GLint level, ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_SUB_IMAGE3D, 11); + n = alloc_instruction(ctx, OPCODE_TEX_SUB_IMAGE3D, 11); if (n) { n[1].e = target; n[2].i = level; @@ -3850,7 +3853,7 @@ save_Translatef(GLfloat x, GLfloat y, GLfloat z) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_TRANSLATE, 3); + n = alloc_instruction(ctx, OPCODE_TRANSLATE, 3); if (n) { n[1].f = x; n[2].f = y; @@ -3876,7 +3879,7 @@ save_Viewport(GLint x, GLint y, GLsizei width, GLsizei height) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_VIEWPORT, 4); + n = alloc_instruction(ctx, OPCODE_VIEWPORT, 4); if (n) { n[1].i = x; n[2].i = y; @@ -3895,7 +3898,7 @@ save_WindowPos4fMESA(GLfloat x, GLfloat y, GLfloat z, GLfloat w) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_WINDOW_POS, 4); + n = alloc_instruction(ctx, OPCODE_WINDOW_POS, 4); if (n) { n[1].f = x; n[2].f = y; @@ -4056,7 +4059,7 @@ save_ActiveTextureARB(GLenum target) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_ACTIVE_TEXTURE, 1); + n = alloc_instruction(ctx, OPCODE_ACTIVE_TEXTURE, 1); if (n) { n[1].e = target; } @@ -4129,7 +4132,7 @@ save_CompressedTexImage1DARB(GLenum target, GLint level, return; } MEMCPY(image, data, imageSize); - n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D, 7); + n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_1D, 7); if (n) { n[1].e = target; n[2].i = level; @@ -4175,7 +4178,7 @@ save_CompressedTexImage2DARB(GLenum target, GLint level, return; } MEMCPY(image, data, imageSize); - n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D, 8); + n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_2D, 8); if (n) { n[1].e = target; n[2].i = level; @@ -4222,7 +4225,7 @@ save_CompressedTexImage3DARB(GLenum target, GLint level, return; } MEMCPY(image, data, imageSize); - n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D, 9); + n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_IMAGE_3D, 9); if (n) { n[1].e = target; n[2].i = level; @@ -4265,7 +4268,7 @@ save_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, return; } MEMCPY(image, data, imageSize); - n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, 7); + n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_1D, 7); if (n) { n[1].e = target; n[2].i = level; @@ -4305,7 +4308,7 @@ save_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, return; } MEMCPY(image, data, imageSize); - n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, 9); + n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_2D, 9); if (n) { n[1].e = target; n[2].i = level; @@ -4347,7 +4350,7 @@ save_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, return; } MEMCPY(image, data, imageSize); - n = ALLOC_INSTRUCTION(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, 11); + n = alloc_instruction(ctx, OPCODE_COMPRESSED_TEX_SUB_IMAGE_3D, 11); if (n) { n[1].e = target; n[2].i = level; @@ -4380,7 +4383,7 @@ save_SampleCoverageARB(GLclampf value, GLboolean invert) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_SAMPLE_COVERAGE, 2); + n = alloc_instruction(ctx, OPCODE_SAMPLE_COVERAGE, 2); if (n) { n[1].f = value; n[2].b = invert; @@ -4401,7 +4404,7 @@ save_BindProgramNV(GLenum target, GLuint id) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_BIND_PROGRAM_NV, 2); + n = alloc_instruction(ctx, OPCODE_BIND_PROGRAM_NV, 2); if (n) { n[1].e = target; n[2].ui = id; @@ -4418,7 +4421,7 @@ save_ProgramEnvParameter4fARB(GLenum target, GLuint index, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6); + n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6); if (n) { n[1].e = target; n[2].ui = index; @@ -4455,7 +4458,7 @@ save_ProgramEnvParameters4fvEXT(GLenum target, GLuint index, GLsizei count, const GLfloat * p = params; for (i = 0 ; i < count ; i++) { - n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6); + n = alloc_instruction(ctx, OPCODE_PROGRAM_ENV_PARAMETER_ARB, 6); if (n) { n[1].e = target; n[2].ui = index; @@ -4503,7 +4506,7 @@ save_ExecuteProgramNV(GLenum target, GLuint id, const GLfloat *params) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_EXECUTE_PROGRAM_NV, 6); + n = alloc_instruction(ctx, OPCODE_EXECUTE_PROGRAM_NV, 6); if (n) { n[1].e = target; n[2].ui = id; @@ -4549,7 +4552,7 @@ save_LoadProgramNV(GLenum target, GLuint id, GLsizei len, ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_LOAD_PROGRAM_NV, 4); + n = alloc_instruction(ctx, OPCODE_LOAD_PROGRAM_NV, 4); if (n) { GLubyte *programCopy = (GLubyte *) _mesa_malloc(len); if (!programCopy) { @@ -4576,7 +4579,7 @@ save_RequestResidentProgramsNV(GLsizei num, const GLuint * ids) ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_TRACK_MATRIX_NV, 2); + n = alloc_instruction(ctx, OPCODE_TRACK_MATRIX_NV, 2); if (n) { GLuint *idCopy = (GLuint *) _mesa_malloc(num * sizeof(GLuint)); if (!idCopy) { @@ -4600,7 +4603,7 @@ save_TrackMatrixNV(GLenum target, GLuint address, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_TRACK_MATRIX_NV, 4); + n = alloc_instruction(ctx, OPCODE_TRACK_MATRIX_NV, 4); if (n) { n[1].e = target; n[2].ui = address; @@ -4625,7 +4628,7 @@ save_ProgramLocalParameter4fARB(GLenum target, GLuint index, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6); + n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6); if (n) { n[1].e = target; n[2].ui = index; @@ -4647,7 +4650,7 @@ save_ProgramLocalParameter4fvARB(GLenum target, GLuint index, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6); + n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6); if (n) { n[1].e = target; n[2].ui = index; @@ -4675,7 +4678,7 @@ save_ProgramLocalParameters4fvEXT(GLenum target, GLuint index, GLsizei count, const GLfloat * p = params; for (i = 0 ; i < count ; i++) { - n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6); + n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6); if (n) { n[1].e = target; n[2].ui = index; @@ -4702,7 +4705,7 @@ save_ProgramLocalParameter4dARB(GLenum target, GLuint index, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6); + n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6); if (n) { n[1].e = target; n[2].ui = index; @@ -4724,7 +4727,7 @@ save_ProgramLocalParameter4dvARB(GLenum target, GLuint index, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6); + n = alloc_instruction(ctx, OPCODE_PROGRAM_LOCAL_PARAMETER_ARB, 6); if (n) { n[1].e = target; n[2].ui = index; @@ -4747,7 +4750,7 @@ save_ProgramNamedParameter4fNV(GLuint id, GLsizei len, const GLubyte * name, ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_NAMED_PARAMETER_NV, 6); + n = alloc_instruction(ctx, OPCODE_PROGRAM_NAMED_PARAMETER_NV, 6); if (n) { GLubyte *nameCopy = (GLubyte *) _mesa_malloc(len); if (!nameCopy) { @@ -4806,7 +4809,7 @@ save_ActiveStencilFaceEXT(GLenum face) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1); + n = alloc_instruction(ctx, OPCODE_ACTIVE_STENCIL_FACE_EXT, 1); if (n) { n[1].e = face; } @@ -4823,7 +4826,7 @@ save_DepthBoundsEXT(GLclampd zmin, GLclampd zmax) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_DEPTH_BOUNDS_EXT, 2); + n = alloc_instruction(ctx, OPCODE_DEPTH_BOUNDS_EXT, 2); if (n) { n[1].f = (GLfloat) zmin; n[2].f = (GLfloat) zmax; @@ -4846,7 +4849,7 @@ save_ProgramStringARB(GLenum target, GLenum format, GLsizei len, ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_PROGRAM_STRING_ARB, 4); + n = alloc_instruction(ctx, OPCODE_PROGRAM_STRING_ARB, 4); if (n) { GLubyte *programCopy = (GLubyte *) _mesa_malloc(len); if (!programCopy) { @@ -4875,7 +4878,7 @@ save_BeginQueryARB(GLenum target, GLuint id) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_BEGIN_QUERY_ARB, 2); + n = alloc_instruction(ctx, OPCODE_BEGIN_QUERY_ARB, 2); if (n) { n[1].e = target; n[2].ui = id; @@ -4892,7 +4895,7 @@ save_EndQueryARB(GLenum target) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_END_QUERY_ARB, 1); + n = alloc_instruction(ctx, OPCODE_END_QUERY_ARB, 1); if (n) { n[1].e = target; } @@ -4910,7 +4913,7 @@ save_DrawBuffersARB(GLsizei count, const GLenum * buffers) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS); + n = alloc_instruction(ctx, OPCODE_DRAW_BUFFERS_ARB, 1 + MAX_DRAW_BUFFERS); if (n) { GLint i; n[1].i = count; @@ -4931,7 +4934,7 @@ save_TexBumpParameterfvATI(GLenum pname, const GLfloat *param) GET_CURRENT_CONTEXT(ctx); Node *n; - n = ALLOC_INSTRUCTION(ctx, OPCODE_TEX_BUMP_PARAMETER_ATI, 5); + n = alloc_instruction(ctx, OPCODE_TEX_BUMP_PARAMETER_ATI, 5); if (n) { n[1].ui = pname; n[2].f = param[0]; @@ -4962,7 +4965,7 @@ save_BindFragmentShaderATI(GLuint id) GET_CURRENT_CONTEXT(ctx); Node *n; - n = ALLOC_INSTRUCTION(ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1); + n = alloc_instruction(ctx, OPCODE_BIND_FRAGMENT_SHADER_ATI, 1); if (n) { n[1].ui = id; } @@ -4977,7 +4980,7 @@ save_SetFragmentShaderConstantATI(GLuint dst, const GLfloat *value) GET_CURRENT_CONTEXT(ctx); Node *n; - n = ALLOC_INSTRUCTION(ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5); + n = alloc_instruction(ctx, OPCODE_SET_FRAGMENT_SHADER_CONSTANTS_ATI, 5); if (n) { n[1].ui = dst; n[2].f = value[0]; @@ -4997,7 +5000,7 @@ save_Attr1fNV(GLenum attr, GLfloat x) GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_1F_NV, 2); + n = alloc_instruction(ctx, OPCODE_ATTR_1F_NV, 2); if (n) { n[1].e = attr; n[2].f = x; @@ -5018,7 +5021,7 @@ save_Attr2fNV(GLenum attr, GLfloat x, GLfloat y) GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_2F_NV, 3); + n = alloc_instruction(ctx, OPCODE_ATTR_2F_NV, 3); if (n) { n[1].e = attr; n[2].f = x; @@ -5040,7 +5043,7 @@ save_Attr3fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z) GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_3F_NV, 4); + n = alloc_instruction(ctx, OPCODE_ATTR_3F_NV, 4); if (n) { n[1].e = attr; n[2].f = x; @@ -5063,7 +5066,7 @@ save_Attr4fNV(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w) GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_4F_NV, 5); + n = alloc_instruction(ctx, OPCODE_ATTR_4F_NV, 5); if (n) { n[1].e = attr; n[2].f = x; @@ -5088,7 +5091,7 @@ save_Attr1fARB(GLenum attr, GLfloat x) GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_1F_ARB, 2); + n = alloc_instruction(ctx, OPCODE_ATTR_1F_ARB, 2); if (n) { n[1].e = attr; n[2].f = x; @@ -5109,7 +5112,7 @@ save_Attr2fARB(GLenum attr, GLfloat x, GLfloat y) GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_2F_ARB, 3); + n = alloc_instruction(ctx, OPCODE_ATTR_2F_ARB, 3); if (n) { n[1].e = attr; n[2].f = x; @@ -5131,7 +5134,7 @@ save_Attr3fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z) GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_3F_ARB, 4); + n = alloc_instruction(ctx, OPCODE_ATTR_3F_ARB, 4); if (n) { n[1].e = attr; n[2].f = x; @@ -5154,7 +5157,7 @@ save_Attr4fARB(GLenum attr, GLfloat x, GLfloat y, GLfloat z, GLfloat w) GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_ATTR_4F_ARB, 5); + n = alloc_instruction(ctx, OPCODE_ATTR_4F_ARB, 5); if (n) { n[1].e = attr; n[2].f = x; @@ -5179,7 +5182,7 @@ save_EvalCoord1f(GLfloat x) GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_EVAL_C1, 1); + n = alloc_instruction(ctx, OPCODE_EVAL_C1, 1); if (n) { n[1].f = x; } @@ -5200,7 +5203,7 @@ save_EvalCoord2f(GLfloat x, GLfloat y) GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_EVAL_C2, 2); + n = alloc_instruction(ctx, OPCODE_EVAL_C2, 2); if (n) { n[1].f = x; n[2].f = y; @@ -5223,7 +5226,7 @@ save_EvalPoint1(GLint x) GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_EVAL_P1, 1); + n = alloc_instruction(ctx, OPCODE_EVAL_P1, 1); if (n) { n[1].i = x; } @@ -5238,7 +5241,7 @@ save_EvalPoint2(GLint x, GLint y) GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_EVAL_P2, 2); + n = alloc_instruction(ctx, OPCODE_EVAL_P2, 2); if (n) { n[1].i = x; n[2].i = y; @@ -5341,7 +5344,7 @@ save_Materialfv(GLenum face, GLenum pname, const GLfloat * param) SAVE_FLUSH_VERTICES(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_MATERIAL, 6); + n = alloc_instruction(ctx, OPCODE_MATERIAL, 6); if (n) { n[1].e = face; n[2].e = pname; @@ -5384,7 +5387,7 @@ save_Begin(GLenum mode) return; SAVE_FLUSH_VERTICES(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_BEGIN, 1); + n = alloc_instruction(ctx, OPCODE_BEGIN, 1); if (n) { n[1].e = mode; } @@ -5400,7 +5403,7 @@ save_End(void) { GET_CURRENT_CONTEXT(ctx); SAVE_FLUSH_VERTICES(ctx); - (void) ALLOC_INSTRUCTION(ctx, OPCODE_END, 0); + (void) alloc_instruction(ctx, OPCODE_END, 0); ctx->Driver.CurrentSavePrimitive = PRIM_OUTSIDE_BEGIN_END; if (ctx->ExecuteFlag) { CALL_End(ctx->Exec, ()); @@ -5413,7 +5416,7 @@ save_Rectf(GLfloat a, GLfloat b, GLfloat c, GLfloat d) GET_CURRENT_CONTEXT(ctx); Node *n; SAVE_FLUSH_VERTICES(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_RECTF, 4); + n = alloc_instruction(ctx, OPCODE_RECTF, 4); if (n) { n[1].f = a; n[2].f = b; @@ -5827,7 +5830,7 @@ save_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_BLIT_FRAMEBUFFER, 10); + n = alloc_instruction(ctx, OPCODE_BLIT_FRAMEBUFFER, 10); if (n) { n[1].i = srcX0; n[2].i = srcY0; @@ -5856,7 +5859,7 @@ save_ProvokingVertexEXT(GLenum mode) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_PROVOKING_VERTEX, 1); + n = alloc_instruction(ctx, OPCODE_PROVOKING_VERTEX, 1); if (n) { n[1].e = mode; } @@ -5874,7 +5877,7 @@ save_UseProgramObjectARB(GLhandleARB program) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_USE_PROGRAM, 1); + n = alloc_instruction(ctx, OPCODE_USE_PROGRAM, 1); if (n) { n[1].ui = program; } @@ -5890,7 +5893,7 @@ save_Uniform1fARB(GLint location, GLfloat x) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_1F, 2); + n = alloc_instruction(ctx, OPCODE_UNIFORM_1F, 2); if (n) { n[1].i = location; n[2].f = x; @@ -5907,7 +5910,7 @@ save_Uniform2fARB(GLint location, GLfloat x, GLfloat y) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_2F, 3); + n = alloc_instruction(ctx, OPCODE_UNIFORM_2F, 3); if (n) { n[1].i = location; n[2].f = x; @@ -5925,7 +5928,7 @@ save_Uniform3fARB(GLint location, GLfloat x, GLfloat y, GLfloat z) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_3F, 4); + n = alloc_instruction(ctx, OPCODE_UNIFORM_3F, 4); if (n) { n[1].i = location; n[2].f = x; @@ -5944,7 +5947,7 @@ save_Uniform4fARB(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_4F, 5); + n = alloc_instruction(ctx, OPCODE_UNIFORM_4F, 5); if (n) { n[1].i = location; n[2].f = x; @@ -5975,7 +5978,7 @@ save_Uniform1fvARB(GLint location, GLsizei count, const GLfloat *v) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_1FV, 3); + n = alloc_instruction(ctx, OPCODE_UNIFORM_1FV, 3); if (n) { n[1].i = location; n[2].i = count; @@ -5992,7 +5995,7 @@ save_Uniform2fvARB(GLint location, GLsizei count, const GLfloat *v) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_2FV, 3); + n = alloc_instruction(ctx, OPCODE_UNIFORM_2FV, 3); if (n) { n[1].i = location; n[2].i = count; @@ -6009,7 +6012,7 @@ save_Uniform3fvARB(GLint location, GLsizei count, const GLfloat *v) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_3FV, 3); + n = alloc_instruction(ctx, OPCODE_UNIFORM_3FV, 3); if (n) { n[1].i = location; n[2].i = count; @@ -6026,7 +6029,7 @@ save_Uniform4fvARB(GLint location, GLsizei count, const GLfloat *v) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_4FV, 3); + n = alloc_instruction(ctx, OPCODE_UNIFORM_4FV, 3); if (n) { n[1].i = location; n[2].i = count; @@ -6044,7 +6047,7 @@ save_Uniform1iARB(GLint location, GLint x) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_1I, 2); + n = alloc_instruction(ctx, OPCODE_UNIFORM_1I, 2); if (n) { n[1].i = location; n[2].i = x; @@ -6060,7 +6063,7 @@ save_Uniform2iARB(GLint location, GLint x, GLint y) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_2I, 3); + n = alloc_instruction(ctx, OPCODE_UNIFORM_2I, 3); if (n) { n[1].i = location; n[2].i = x; @@ -6077,7 +6080,7 @@ save_Uniform3iARB(GLint location, GLint x, GLint y, GLint z) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_3I, 4); + n = alloc_instruction(ctx, OPCODE_UNIFORM_3I, 4); if (n) { n[1].i = location; n[2].i = x; @@ -6095,7 +6098,7 @@ save_Uniform4iARB(GLint location, GLint x, GLint y, GLint z, GLint w) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_4I, 5); + n = alloc_instruction(ctx, OPCODE_UNIFORM_4I, 5); if (n) { n[1].i = location; n[2].i = x; @@ -6116,7 +6119,7 @@ save_Uniform1ivARB(GLint location, GLsizei count, const GLint *v) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_1IV, 3); + n = alloc_instruction(ctx, OPCODE_UNIFORM_1IV, 3); if (n) { n[1].i = location; n[2].i = count; @@ -6133,7 +6136,7 @@ save_Uniform2ivARB(GLint location, GLsizei count, const GLint *v) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_2IV, 3); + n = alloc_instruction(ctx, OPCODE_UNIFORM_2IV, 3); if (n) { n[1].i = location; n[2].i = count; @@ -6150,7 +6153,7 @@ save_Uniform3ivARB(GLint location, GLsizei count, const GLint *v) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_3IV, 3); + n = alloc_instruction(ctx, OPCODE_UNIFORM_3IV, 3); if (n) { n[1].i = location; n[2].i = count; @@ -6167,7 +6170,7 @@ save_Uniform4ivARB(GLint location, GLsizei count, const GLint *v) GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_4IV, 3); + n = alloc_instruction(ctx, OPCODE_UNIFORM_4IV, 3); if (n) { n[1].i = location; n[2].i = count; @@ -6186,7 +6189,7 @@ save_UniformMatrix2fvARB(GLint location, GLsizei count, GLboolean transpose, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX22, 4); + n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX22, 4); if (n) { n[1].i = location; n[2].i = count; @@ -6205,7 +6208,7 @@ save_UniformMatrix3fvARB(GLint location, GLsizei count, GLboolean transpose, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX33, 4); + n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX33, 4); if (n) { n[1].i = location; n[2].i = count; @@ -6224,7 +6227,7 @@ save_UniformMatrix4fvARB(GLint location, GLsizei count, GLboolean transpose, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX44, 4); + n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX44, 4); if (n) { n[1].i = location; n[2].i = count; @@ -6244,7 +6247,7 @@ save_UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX23, 4); + n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX23, 4); if (n) { n[1].i = location; n[2].i = count; @@ -6263,7 +6266,7 @@ save_UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX32, 4); + n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX32, 4); if (n) { n[1].i = location; n[2].i = count; @@ -6283,7 +6286,7 @@ save_UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX24, 4); + n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX24, 4); if (n) { n[1].i = location; n[2].i = count; @@ -6302,7 +6305,7 @@ save_UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX42, 4); + n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX42, 4); if (n) { n[1].i = location; n[2].i = count; @@ -6322,7 +6325,7 @@ save_UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX34, 4); + n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX34, 4); if (n) { n[1].i = location; n[2].i = count; @@ -6341,7 +6344,7 @@ save_UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, GET_CURRENT_CONTEXT(ctx); Node *n; ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); - n = ALLOC_INSTRUCTION(ctx, OPCODE_UNIFORM_MATRIX43, 4); + n = alloc_instruction(ctx, OPCODE_UNIFORM_MATRIX43, 4); if (n) { n[1].i = location; n[2].i = count; @@ -6365,7 +6368,7 @@ static void save_error(GLcontext *ctx, GLenum error, const char *s) { Node *n; - n = ALLOC_INSTRUCTION(ctx, OPCODE_ERROR, 2); + n = alloc_instruction(ctx, OPCODE_ERROR, 2); if (n) { n[1].e = error; n[2].data = (void *) s; @@ -7583,7 +7586,7 @@ _mesa_EndList(void) */ ctx->Driver.EndList(ctx); - (void) ALLOC_INSTRUCTION(ctx, OPCODE_END_OF_LIST, 0); + (void) alloc_instruction(ctx, OPCODE_END_OF_LIST, 0); /* Destroy old list, if any */ destroy_list(ctx, ctx->ListState.CurrentList->Name); -- cgit v1.2.3 From fc995c72982b5f971741986fea7aa63bb5fcbd81 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 7 Oct 2009 16:21:34 -0600 Subject: mesa: clean-up display list mem allocation, fix NULL handling The -1 term in alloc_instruction() foiled later NULL pointer checks. --- src/mesa/main/dlist.c | 47 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 34 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index f76323dff5..c1890bcbc9 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -789,14 +789,13 @@ unpack_image(GLcontext *ctx, GLuint dimensions, /** - * Allocate space for a display list instruction. + * Allocate space for a display list instruction (opcode + payload space). * \param opcode the instruction opcode (OPCODE_* value) - * \param bytes instruction size in bytes, not counting opcode. - * \return pointer to the usable data area (not including the internal - * opcode). + * \param bytes instruction payload size (not counting opcode) + * \return pointer to allocated memory (the opcode space) */ -void * -_mesa_dlist_alloc(GLcontext *ctx, GLuint opcode, GLuint bytes) +static Node * +dlist_alloc(GLcontext *ctx, OpCode opcode, GLuint bytes) { const GLuint numNodes = 1 + (bytes + sizeof(Node) - 1) / sizeof(Node); Node *n; @@ -830,9 +829,30 @@ _mesa_dlist_alloc(GLcontext *ctx, GLuint opcode, GLuint bytes) n = ctx->ListState.CurrentBlock + ctx->ListState.CurrentPos; ctx->ListState.CurrentPos += numNodes; - n[0].opcode = (OpCode) opcode; + n[0].opcode = opcode; - return (void *) (n + 1); /* return ptr to node following opcode */ + return n; +} + + + +/** + * Allocate space for a display list instruction. Used by callers outside + * this file for things like VBO vertex data. + * + * \param opcode the instruction opcode (OPCODE_* value) + * \param bytes instruction size in bytes, not counting opcode. + * \return pointer to the usable data area (not including the internal + * opcode). + */ +void * +_mesa_dlist_alloc(GLcontext *ctx, GLuint opcode, GLuint bytes) +{ + Node *n = dlist_alloc(ctx, (OpCode) opcode, bytes); + if (n) + return n + 1; /* return pointer to payload area, after opcode */ + else + return NULL; } @@ -866,18 +886,19 @@ _mesa_dlist_alloc_opcode(GLcontext *ctx, } - /** - * Allocate display list instruction. Returns Node ptr to where the opcode - * is stored. The first function parameter would go in node[1]. + * Allocate space for a display list instruction. The space is basically + * an array of Nodes where node[0] holds the opcode, node[1] is the first + * function parameter, node[2] is the second parameter, etc. + * * \param opcode one of OPCODE_x * \param nparams number of function parameters + * \return pointer to start of instruction space */ static INLINE Node * alloc_instruction(GLcontext *ctx, OpCode opcode, GLuint nparams) { - return (Node *) - _mesa_dlist_alloc(ctx, opcode, nparams * sizeof(Node)) - 1; + return dlist_alloc(ctx, opcode, nparams * sizeof(Node)); } -- cgit v1.2.3 From 15f05e97aac46ffcf8a7765b0072535718833622 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 7 Oct 2009 16:32:25 -0600 Subject: mesa: added _mesa_free_display_list_data() --- src/mesa/main/context.c | 1 + src/mesa/main/dlist.c | 7 +++++++ src/mesa/main/dlist.h | 2 ++ 3 files changed, 10 insertions(+) (limited to 'src') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index ae91bf5f38..4d222cb0eb 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -971,6 +971,7 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL); _mesa_free_attrib_data(ctx); + _mesa_free_display_list_data(ctx); _mesa_free_lighting_data( ctx ); _mesa_free_eval_data( ctx ); _mesa_free_texture_data( ctx ); diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index c1890bcbc9..cec7d873d4 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -9463,3 +9463,10 @@ _mesa_init_display_list(GLcontext *ctx) _mesa_save_vtxfmt_init(&ctx->ListState.ListVtxfmt); #endif } + + +void +_mesa_free_display_list_data(GLcontext *ctx) +{ + +} diff --git a/src/mesa/main/dlist.h b/src/mesa/main/dlist.h index 589cbc5992..f37a93a7f4 100644 --- a/src/mesa/main/dlist.h +++ b/src/mesa/main/dlist.h @@ -106,5 +106,7 @@ _mesa_init_dlist_dispatch(struct _glapi_table *disp) extern void _mesa_init_display_list( GLcontext * ctx ); +extern void _mesa_free_display_list_data(GLcontext *ctx); + #endif /* DLIST_H */ -- cgit v1.2.3 From 33e9ac20e3b399c6ec6ec2f586a9402b68590992 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 7 Oct 2009 16:41:18 -0600 Subject: mesa: move gl_list_instruction and gl_list_extensions to dlist.c --- src/mesa/main/dlist.c | 68 +++++++++++++++++++++++++++++++++++++------------- src/mesa/main/mtypes.h | 26 ++----------------- 2 files changed, 52 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index cec7d873d4..69667942f0 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -1,8 +1,9 @@ /* * Mesa 3-D graphics library - * Version: 7.1 + * Version: 7.7 * - * Copyright (C) 1999-2007 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. + * Copyright (C) 2009 VMware, Inc. All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -91,6 +92,33 @@ #include "glapi/dispatch.h" + +/** + * Other parts of Mesa (such as the VBO module) can plug into the display + * list system. This structure describes new display list instructions. + */ +struct gl_list_instruction +{ + GLuint Size; + void (*Execute)( GLcontext *ctx, void *data ); + void (*Destroy)( GLcontext *ctx, void *data ); + void (*Print)( GLcontext *ctx, void *data ); +}; + + +#define MAX_DLIST_EXT_OPCODES 16 + +/** + * Used by device drivers to hook new commands into display lists. + */ +struct gl_list_extensions +{ + struct gl_list_instruction Opcode[MAX_DLIST_EXT_OPCODES]; + GLuint NumOpcodes; +}; + + + /** * Flush vertices. * @@ -496,9 +524,9 @@ _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist) /* check for extension opcodes first */ GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0; - if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) { - ctx->ListExt.Opcode[i].Destroy(ctx, &n[1]); - n += ctx->ListExt.Opcode[i].Size; + if (i >= 0 && i < (GLint) ctx->ListExt->NumOpcodes) { + ctx->ListExt->Opcode[i].Destroy(ctx, &n[1]); + n += ctx->ListExt->Opcode[i].Size; } else { switch (n[0].opcode) { @@ -873,13 +901,13 @@ _mesa_dlist_alloc_opcode(GLcontext *ctx, void (*destroy) (GLcontext *, void *), void (*print) (GLcontext *, void *)) { - if (ctx->ListExt.NumOpcodes < MAX_DLIST_EXT_OPCODES) { - const GLuint i = ctx->ListExt.NumOpcodes++; - ctx->ListExt.Opcode[i].Size = + if (ctx->ListExt->NumOpcodes < MAX_DLIST_EXT_OPCODES) { + const GLuint i = ctx->ListExt->NumOpcodes++; + ctx->ListExt->Opcode[i].Size = 1 + (size + sizeof(Node) - 1) / sizeof(Node); - ctx->ListExt.Opcode[i].Execute = execute; - ctx->ListExt.Opcode[i].Destroy = destroy; - ctx->ListExt.Opcode[i].Print = print; + ctx->ListExt->Opcode[i].Execute = execute; + ctx->ListExt->Opcode[i].Destroy = destroy; + ctx->ListExt->Opcode[i].Print = print; return i + OPCODE_EXT_0; } return -1; @@ -6468,10 +6496,10 @@ execute_list(GLcontext *ctx, GLuint list) OpCode opcode = n[0].opcode; int i = (int) n[0].opcode - (int) OPCODE_EXT_0; - if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) { + if (i >= 0 && i < (GLint) ctx->ListExt->NumOpcodes) { /* this is a driver-extended opcode */ - ctx->ListExt.Opcode[i].Execute(ctx, &n[1]); - n += ctx->ListExt.Opcode[i].Size; + ctx->ListExt->Opcode[i].Execute(ctx, &n[1]); + n += ctx->ListExt->Opcode[i].Size; } else { switch (opcode) { @@ -9068,10 +9096,10 @@ print_list(GLcontext *ctx, GLuint list) OpCode opcode = n[0].opcode; GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0; - if (i >= 0 && i < (GLint) ctx->ListExt.NumOpcodes) { + if (i >= 0 && i < (GLint) ctx->ListExt->NumOpcodes) { /* this is a driver-extended opcode */ - ctx->ListExt.Opcode[i].Print(ctx, &n[1]); - n += ctx->ListExt.Opcode[i].Size; + ctx->ListExt->Opcode[i].Print(ctx, &n[1]); + n += ctx->ListExt->Opcode[i].Size; } else { switch (opcode) { @@ -9449,6 +9477,9 @@ _mesa_init_display_list(GLcontext *ctx) tableInitialized = GL_TRUE; } + /* extension info */ + ctx->ListExt = CALLOC_STRUCT(gl_list_extensions); + /* Display list */ ctx->ListState.CallDepth = 0; ctx->ExecuteFlag = GL_TRUE; @@ -9468,5 +9499,6 @@ _mesa_init_display_list(GLcontext *ctx) void _mesa_free_display_list_data(GLcontext *ctx) { - + free(ctx->ListExt); + ctx->ListExt = NULL; } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index d005064645..a1184df281 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -84,6 +84,7 @@ /*@{*/ struct _mesa_HashTable; struct gl_attrib_node; +struct gl_list_extensions; struct gl_meta_state; struct gl_pixelstore_attrib; struct gl_program_cache; @@ -819,29 +820,6 @@ struct gl_list_attrib }; -/** - * Used by device drivers to hook new commands into display lists. - */ -struct gl_list_instruction -{ - GLuint Size; - void (*Execute)( GLcontext *ctx, void *data ); - void (*Destroy)( GLcontext *ctx, void *data ); - void (*Print)( GLcontext *ctx, void *data ); -}; - -#define MAX_DLIST_EXT_OPCODES 16 - -/** - * Used by device drivers to hook new commands into display lists. - */ -struct gl_list_extensions -{ - struct gl_list_instruction Opcode[MAX_DLIST_EXT_OPCODES]; - GLuint NumOpcodes; -}; - - /** * Multisample attribute group (GL_MULTISAMPLE_BIT). */ @@ -3061,7 +3039,7 @@ struct __GLcontextRec struct gl_shine_tab *_ShineTabList; /**< MRU list of inactive shine tables */ /**@}*/ - struct gl_list_extensions ListExt; /**< driver dlist extensions */ + struct gl_list_extensions *ListExt; /**< driver dlist extensions */ /** \name For debugging/development only */ /*@{*/ -- cgit v1.2.3 From f001cc09811214f0fa9083b799ad4232f8aee836 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 7 Oct 2009 16:51:26 -0600 Subject: mesa: clean up extended opcode code --- src/mesa/main/dlist.c | 71 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 53 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 69667942f0..b692c335a7 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -505,6 +505,49 @@ lookup_list(GLcontext *ctx, GLuint list) } +/** Is the given opcode an extension code? */ +static INLINE GLboolean +is_ext_opcode(OpCode opcode) +{ + return (opcode >= OPCODE_EXT_0); +} + + +/** Destroy an extended opcode instruction */ +static GLint +ext_opcode_destroy(GLcontext *ctx, Node *node) +{ + const GLint i = node[0].opcode - OPCODE_EXT_0; + GLint step; + ctx->ListExt->Opcode[i].Destroy(ctx, &node[1]); + step = ctx->ListExt->Opcode[i].Size; + return step; +} + + +/** Execute an extended opcode instruction */ +static GLint +ext_opcode_execute(GLcontext *ctx, Node *node) +{ + const GLint i = node[0].opcode - OPCODE_EXT_0; + GLint step; + ctx->ListExt->Opcode[i].Execute(ctx, &node[1]); + step = ctx->ListExt->Opcode[i].Size; + return step; +} + + +/** Print an extended opcode instruction */ +static GLint +ext_opcode_print(GLcontext *ctx, Node *node) +{ + const GLint i = node[0].opcode - OPCODE_EXT_0; + GLint step; + ctx->ListExt->Opcode[i].Print(ctx, &node[1]); + step = ctx->ListExt->Opcode[i].Size; + return step; +} + /** * Delete the named display list, but don't remove from hash table. @@ -520,16 +563,14 @@ _mesa_delete_list(GLcontext *ctx, struct gl_display_list *dlist) done = block ? GL_FALSE : GL_TRUE; while (!done) { + const OpCode opcode = n[0].opcode; /* check for extension opcodes first */ - - GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0; - if (i >= 0 && i < (GLint) ctx->ListExt->NumOpcodes) { - ctx->ListExt->Opcode[i].Destroy(ctx, &n[1]); - n += ctx->ListExt->Opcode[i].Size; + if (is_ext_opcode(opcode)) { + n += ext_opcode_destroy(ctx, n); } else { - switch (n[0].opcode) { + switch (opcode) { /* for some commands, we need to free malloc'd memory */ case OPCODE_MAP1: _mesa_free(n[6].data); @@ -6493,13 +6534,10 @@ execute_list(GLcontext *ctx, GLuint list) done = GL_FALSE; while (!done) { - OpCode opcode = n[0].opcode; - int i = (int) n[0].opcode - (int) OPCODE_EXT_0; + const OpCode opcode = n[0].opcode; - if (i >= 0 && i < (GLint) ctx->ListExt->NumOpcodes) { - /* this is a driver-extended opcode */ - ctx->ListExt->Opcode[i].Execute(ctx, &n[1]); - n += ctx->ListExt->Opcode[i].Size; + if (is_ext_opcode(opcode)) { + n += ext_opcode_execute(ctx, n); } else { switch (opcode) { @@ -9093,13 +9131,10 @@ print_list(GLcontext *ctx, GLuint list) done = n ? GL_FALSE : GL_TRUE; while (!done) { - OpCode opcode = n[0].opcode; - GLint i = (GLint) n[0].opcode - (GLint) OPCODE_EXT_0; + const OpCode opcode = n[0].opcode; - if (i >= 0 && i < (GLint) ctx->ListExt->NumOpcodes) { - /* this is a driver-extended opcode */ - ctx->ListExt->Opcode[i].Print(ctx, &n[1]); - n += ctx->ListExt->Opcode[i].Size; + if (is_ext_opcode(opcode)) { + n += ext_opcode_print(ctx, n); } else { switch (opcode) { -- cgit v1.2.3 From f49d53594c8ba501c39f9a43148ce02a0ec8bfc2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 8 Oct 2009 12:50:42 -0600 Subject: mesa: free display list state after freeing shared state Fixes bug 24402. --- src/mesa/main/context.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 4d222cb0eb..95ff3495ab 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -971,7 +971,6 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_reference_fragprog(ctx, &ctx->FragmentProgram._TexEnvProgram, NULL); _mesa_free_attrib_data(ctx); - _mesa_free_display_list_data(ctx); _mesa_free_lighting_data( ctx ); _mesa_free_eval_data( ctx ); _mesa_free_texture_data( ctx ); @@ -1012,6 +1011,9 @@ _mesa_free_context_data( GLcontext *ctx ) _mesa_free_shared_state( ctx, ctx->Shared ); } + /* needs to be after freeing shared state */ + _mesa_free_display_list_data(ctx); + if (ctx->Extensions.String) _mesa_free((void *) ctx->Extensions.String); -- cgit v1.2.3 From 193dddb04e26d4e6ccefef03ce7a620606d6de5f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 1 Oct 2009 17:53:12 -0700 Subject: intel: Use new drm_intel_bo_references() to avoid flushing. --- src/mesa/drivers/dri/intel/intel_buffer_objects.c | 13 +++++++------ src/mesa/drivers/dri/intel/intel_tex_image.c | 17 +++++++++++++---- 2 files changed, 20 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index a0225936c8..ea9d5a6276 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -209,7 +209,8 @@ intel_bufferobj_subdata(GLcontext * ctx, memcpy((char *)intel_obj->sys_buffer + offset, data, size); else { /* Flush any existing batchbuffer that might reference this data. */ - intelFlush(ctx); + if (drm_intel_bo_references(intel->batch->buf, intel_obj->buffer)) + intelFlush(ctx); dri_bo_subdata(intel_obj->buffer, offset, size, data); } @@ -257,10 +258,9 @@ intel_bufferobj_map(GLcontext * ctx, return obj->Pointer; } - /* Flush any existing batchbuffer that might have written to this - * buffer. - */ - intelFlush(ctx); + /* Flush any existing batchbuffer that might reference this data. */ + if (drm_intel_bo_references(intel->batch->buf, intel_obj->buffer)) + intelFlush(ctx); if (intel_obj->region) intel_bufferobj_cow(intel, intel_obj); @@ -330,7 +330,8 @@ intel_bufferobj_map_range(GLcontext * ctx, * the batchbuffer so that GEM knows about the buffer access for later * syncing. */ - if (!(access & GL_MAP_UNSYNCHRONIZED_BIT)) + if (!(access & GL_MAP_UNSYNCHRONIZED_BIT) && + drm_intel_bo_references(intel->batch->buf, intel_obj->buffer)) intelFlush(ctx); if (intel_obj->buffer == NULL) { diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 66201b1f46..5c915178e7 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -201,6 +201,9 @@ try_pbo_upload(struct intel_context *intel, struct intel_buffer_object *pbo = intel_buffer_object(unpack->BufferObj); GLuint src_offset, src_stride; GLuint dst_offset, dst_stride; + dri_bo *dst_buffer = intel_region_buffer(intel, + intelImage->mt->region, + INTEL_WRITE_FULL); if (!_mesa_is_bufferobj(unpack->BufferObj) || intel->ctx._ImageTransferState || @@ -223,7 +226,8 @@ try_pbo_upload(struct intel_context *intel, dst_stride = intelImage->mt->pitch; - intelFlush(&intel->ctx); + if (drm_intel_bo_references(intel->batch->buf, dst_buffer)) + intelFlush(&intel->ctx); LOCK_HARDWARE(intel); { dri_bo *src_buffer = intel_bufferobj_buffer(intel, pbo, INTEL_READ); @@ -316,8 +320,6 @@ intelTexImage(GLcontext * ctx, DBG("%s target %s level %d %dx%dx%d border %d\n", __FUNCTION__, _mesa_lookup_enum_by_nr(target), level, width, height, depth, border); - intelFlush(ctx); - intelImage->face = target_to_face(target); intelImage->level = level; @@ -478,13 +480,20 @@ intelTexImage(GLcontext * ctx, LOCK_HARDWARE(intel); if (intelImage->mt) { - if (pixels != NULL) + if (pixels != NULL) { + /* Flush any queued rendering with the texture before mapping. */ + if (drm_intel_bo_references(intel->batch->buf, + intelImage->mt->region->buffer)) { + intelFlush(ctx); + } texImage->Data = intel_miptree_image_map(intel, intelImage->mt, intelImage->face, intelImage->level, &dstRowStride, intelImage->base.ImageOffsets); + } + texImage->RowStride = dstRowStride / intelImage->mt->cpp; } else { -- cgit v1.2.3 From 9b8d2e76c395d6e1fcd09a61cd319cdc2d70c466 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 1 Oct 2009 18:16:52 -0700 Subject: i965: Use bo_references for the state cache delete function. This appears to shave about 3% off the CPU usage in cairo-gl for firefox. --- src/mesa/drivers/dri/i965/brw_state_cache.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c index f8e46aacf7..c262e1db8b 100644 --- a/src/mesa/drivers/dri/i965/brw_state_cache.c +++ b/src/mesa/drivers/dri/i965/brw_state_cache.c @@ -534,14 +534,9 @@ brw_state_cache_bo_delete(struct brw_cache *cache, dri_bo *bo) for (i = 0; i < cache->size; i++) { for (prev = &cache->items[i]; *prev;) { struct brw_cache_item *c = *prev; - int j; - - for (j = 0; j < c->nr_reloc_bufs; j++) { - if (c->reloc_bufs[j] == bo) - break; - } - if (j != c->nr_reloc_bufs) { + if (drm_intel_bo_references(c->bo, bo)) { + int j; *prev = c->next; @@ -551,17 +546,8 @@ brw_state_cache_bo_delete(struct brw_cache *cache, dri_bo *bo) free((void *)c->key); free(c); cache->n_items--; - - /* Delete up the tree. Notably we're trying to get from - * a request to delete the surface, to deleting the surface state - * object, to deleting the binding table. We're slack and restart - * the deletion process when we do this because the other delete - * may kill our *prev. - */ - brw_state_cache_bo_delete(cache, c->bo); - prev = &cache->items[i]; } else { - prev = &(*prev)->next; + prev = &c->next; } } } -- cgit v1.2.3 From 44c6c20b69839ea130a255496f5f692186b68793 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Fri, 9 Oct 2009 10:46:12 +0300 Subject: r600: fixup KIL instruction a bit - KILLGT takes 2 arguments - arb KIL has no dst register - add TODO about clause ending but currently piglit fp-kil passes and does not hang the card --- src/mesa/drivers/dri/r600/r700_assembler.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 903b6968be..fefae22ba7 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -336,7 +336,8 @@ unsigned int r700GetNumOperands(r700_AssemblerBase* pAsm) switch (pAsm->D.dst.opcode) { - case SQ_OP2_INST_ADD: + case SQ_OP2_INST_ADD: + case SQ_OP2_INST_KILLGT: case SQ_OP2_INST_MUL: case SQ_OP2_INST_MAX: case SQ_OP2_INST_MIN: @@ -356,7 +357,6 @@ unsigned int r700GetNumOperands(r700_AssemblerBase* pAsm) case SQ_OP2_INST_MOV: case SQ_OP2_INST_FRACT: case SQ_OP2_INST_FLOOR: - case SQ_OP2_INST_KILLGT: case SQ_OP2_INST_EXP_IEEE: case SQ_OP2_INST_LOG_CLAMPED: case SQ_OP2_INST_LOG_IEEE: @@ -2744,15 +2744,15 @@ GLboolean assemble_FRC(r700_AssemblerBase *pAsm) GLboolean assemble_KIL(r700_AssemblerBase *pAsm) { + /* TODO: doc says KILL has to be last(end) ALU clause */ + checkop1(pAsm); pAsm->D.dst.opcode = SQ_OP2_INST_KILLGT; - - if ( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = 0; pAsm->D.dst.writex = 0; pAsm->D.dst.writey = 0; pAsm->D.dst.writez = 0; @@ -2765,20 +2765,11 @@ GLboolean assemble_KIL(r700_AssemblerBase *pAsm) setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_0); noneg_PVSSRC(&(pAsm->S[0].src)); - pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; - - if(PROGRAM_TEMPORARY == pAsm->pILInst[pAsm->uiCurInst].DstReg.File) + if ( GL_FALSE == assemble_src(pAsm, 0, 1) ) { - pAsm->S[1].src.reg = pAsm->pILInst[pAsm->uiCurInst].DstReg.Index + pAsm->starting_temp_register_number; - } - else - { //PROGRAM_OUTPUT - pAsm->S[1].src.reg = pAsm->uiFP_OutputMap[pAsm->pILInst[pAsm->uiCurInst].DstReg.Index]; + return GL_FALSE; } - setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); - noswizzle_PVSSRC(&(pAsm->S[1].src)); - if ( GL_FALSE == next_ins(pAsm) ) { return GL_FALSE; -- cgit v1.2.3 From b858257ca698e2f7dd3004299ae91d3687ae1f1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Mon, 5 Oct 2009 18:32:36 +0100 Subject: gdi: Fix the build when llvmpipe is requested (the default) but llvm is not present. --- src/gallium/winsys/gdi/SConscript | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/gdi/SConscript b/src/gallium/winsys/gdi/SConscript index f5e6d36d89..8f556daf04 100644 --- a/src/gallium/winsys/gdi/SConscript +++ b/src/gallium/winsys/gdi/SConscript @@ -18,14 +18,20 @@ if env['platform'] == 'windows': 'ws2_32', ]) - if 'llvmpipe' in env['drivers']: - sources = ['gdi_llvmpipe_winsys.c'] - drivers = [llvmpipe] - env.Tool('llvm') - elif 'softpipe' in env['drivers']: + sources = [] + drivers = [] + + if 'softpipe' in env['drivers']: sources = ['gdi_softpipe_winsys.c'] drivers = [softpipe] - else: + + if 'llvmpipe' in env['drivers']: + env.Tool('llvm') + if 'LLVM_VERSION' in env: + sources = ['gdi_llvmpipe_winsys.c'] + drivers = [llvmpipe] + + if not sources or not drivers: print 'warning: softpipe or llvmpipe not selected, gdi winsys disabled' Return() -- cgit v1.2.3 From 69588d7ed59a019a5272a9cc391e30c47d006aee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 9 Oct 2009 11:29:33 +0100 Subject: llvmpipe: Eliminate constant mapping/unmapping. --- src/gallium/drivers/llvmpipe/lp_context.h | 3 -- src/gallium/drivers/llvmpipe/lp_draw_arrays.c | 50 --------------------------- src/gallium/drivers/llvmpipe/lp_state_fs.c | 20 +++++++++-- 3 files changed, 17 insertions(+), 56 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_context.h b/src/gallium/drivers/llvmpipe/lp_context.h index 8d5a0d4f1f..7df340554e 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.h +++ b/src/gallium/drivers/llvmpipe/lp_context.h @@ -88,9 +88,6 @@ struct llvmpipe_context { /** Mapped vertex buffers */ ubyte *mapped_vbuffer[PIPE_MAX_ATTRIBS]; - /** Mapped constant buffers */ - void *mapped_constants[PIPE_SHADER_TYPES]; - /** Vertex format */ struct vertex_info vertex_info; struct vertex_info vertex_info_vbuf; diff --git a/src/gallium/drivers/llvmpipe/lp_draw_arrays.c b/src/gallium/drivers/llvmpipe/lp_draw_arrays.c index 89772e62d3..0aa13a1fc6 100644 --- a/src/gallium/drivers/llvmpipe/lp_draw_arrays.c +++ b/src/gallium/drivers/llvmpipe/lp_draw_arrays.c @@ -45,54 +45,6 @@ -static void -llvmpipe_map_constant_buffers(struct llvmpipe_context *lp) -{ - struct pipe_screen *screen = lp->pipe.screen; - uint i, size; - - for (i = 0; i < PIPE_SHADER_TYPES; i++) { - if (lp->constants[i].buffer && lp->constants[i].buffer->size) - lp->mapped_constants[i] = screen->buffer_map(screen, lp->constants[i].buffer, - PIPE_BUFFER_USAGE_CPU_READ); - } - - if (lp->constants[PIPE_SHADER_VERTEX].buffer) - size = lp->constants[PIPE_SHADER_VERTEX].buffer->size; - else - size = 0; - - lp->jit_context.constants = lp->mapped_constants[PIPE_SHADER_FRAGMENT]; - - draw_set_mapped_constant_buffer(lp->draw, - lp->mapped_constants[PIPE_SHADER_VERTEX], - size); -} - - -static void -llvmpipe_unmap_constant_buffers(struct llvmpipe_context *lp) -{ - struct pipe_screen *screen = lp->pipe.screen; - uint i; - - /* really need to flush all prims since the vert/frag shaders const buffers - * are going away now. - */ - draw_flush(lp->draw); - - draw_set_mapped_constant_buffer(lp->draw, NULL, 0); - - lp->jit_context.constants = NULL; - - for (i = 0; i < 2; i++) { - if (lp->constants[i].buffer && lp->constants[i].buffer->size) - screen->buffer_unmap(screen, lp->constants[i].buffer); - lp->mapped_constants[i] = NULL; - } -} - - boolean llvmpipe_draw_arrays(struct pipe_context *pipe, unsigned mode, unsigned start, unsigned count) @@ -124,7 +76,6 @@ llvmpipe_draw_range_elements(struct pipe_context *pipe, llvmpipe_update_derived( lp ); llvmpipe_map_transfers(lp); - llvmpipe_map_constant_buffers(lp); /* * Map vertex buffers @@ -163,7 +114,6 @@ llvmpipe_draw_range_elements(struct pipe_context *pipe, /* Note: leave drawing surfaces mapped */ - llvmpipe_unmap_constant_buffers(lp); lp->dirty_render_cache = TRUE; diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index b00be0cc32..7728ba6076 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -83,6 +83,7 @@ #include "lp_bld_debug.h" #include "lp_screen.h" #include "lp_context.h" +#include "lp_buffer.h" #include "lp_state.h" #include "lp_quad.h" #include "lp_tex_sample.h" @@ -671,16 +672,29 @@ llvmpipe_delete_fs_state(struct pipe_context *pipe, void *fs) void llvmpipe_set_constant_buffer(struct pipe_context *pipe, uint shader, uint index, - const struct pipe_constant_buffer *buf) + const struct pipe_constant_buffer *constants) { struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); + struct pipe_buffer *buffer = constants ? constants->buffer : NULL; + unsigned size = buffer ? buffer->size : 0; + const void *data = buffer ? llvmpipe_buffer(buffer)->data : NULL; assert(shader < PIPE_SHADER_TYPES); assert(index == 0); + if(shader == PIPE_SHADER_VERTEX) + draw_flush(llvmpipe->draw); + /* note: reference counting */ - pipe_buffer_reference(&llvmpipe->constants[shader].buffer, - buf ? buf->buffer : NULL); + pipe_buffer_reference(&llvmpipe->constants[shader].buffer, buffer); + + if(shader == PIPE_SHADER_FRAGMENT) { + llvmpipe->jit_context.constants = data; + } + + if(shader == PIPE_SHADER_VERTEX) { + draw_set_mapped_constant_buffer(llvmpipe->draw, data, size); + } llvmpipe->dirty |= LP_NEW_CONSTANTS; } -- cgit v1.2.3 From c595dea23c6e77dc5d44a7f4b86916b72e09f970 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 9 Oct 2009 13:22:42 +0100 Subject: util: Force ESI register for cpuid's ebx result. Fixes a segfault and better code. Unfortunately using an arbitrary register ("=r") causes the gcc to abort when the code is optimized saying it can't satisfy the constraint. Setting seems to do the trick. --- src/gallium/auxiliary/util/u_cpu_detect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c index 70ce25cfcf..ded361ce70 100644 --- a/src/gallium/auxiliary/util/u_cpu_detect.c +++ b/src/gallium/auxiliary/util/u_cpu_detect.c @@ -346,7 +346,7 @@ cpuid(uint32_t ax, uint32_t *p) "cpuid\n\t" "xchgl %%ebx, %1" : "=a" (p[0]), - "=m" (p[1]), + "=S" (p[1]), "=c" (p[2]), "=d" (p[3]) : "0" (ax) -- cgit v1.2.3 From f36123323c9d696fec6e54882242cab15247ab0d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 8 Oct 2009 13:00:37 -0600 Subject: softpipe: restore/fix print_vertex() debug helper --- src/gallium/drivers/softpipe/sp_setup.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c index e55e209fd1..00fb52a64f 100644 --- a/src/gallium/drivers/softpipe/sp_setup.c +++ b/src/gallium/drivers/softpipe/sp_setup.c @@ -106,6 +106,7 @@ struct setup_context { #endif unsigned winding; /* which winding to cull */ + unsigned nr_vertex_attrs; }; @@ -268,8 +269,8 @@ static void print_vertex(const struct setup_context *setup, const float (*v)[4]) { int i; - debug_printf(" Vertex: (%p)\n", v); - for (i = 0; i < setup->quad[0].nr_attrs; i++) { + debug_printf(" Vertex: (%p)\n", (void *) v); + for (i = 0; i < setup->nr_vertex_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])) { @@ -1254,6 +1255,9 @@ void sp_setup_prepare( struct setup_context *setup ) softpipe_update_derived(sp); } + /* Note: nr_attrs is only used for debugging (vertex printing) */ + setup->nr_vertex_attrs = draw_num_vs_outputs(sp->draw); + sp->quad.first->begin( sp->quad.first ); if (sp->reduced_api_prim == PIPE_PRIM_TRIANGLES && -- cgit v1.2.3 From a31d16cbfa5a74299f6b6acd4814d6393f46d66b Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 8 Oct 2009 13:05:55 +0200 Subject: st/xorg: Fix depth stencil buffers on old X servers Sanity checking is for the weak. --- src/gallium/state_trackers/xorg/xorg_dri2.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index 8a362596c7..c41a7cd639 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -81,11 +81,14 @@ driDoCreateBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int format) case DRI2BufferStencil: #if defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION > 2 case DRI2BufferDepthStencil: +#else + /* Works on old X servers because sanity checking is for the weak */ + case 9: +#endif if (exa_priv->depth_stencil_tex && !pf_is_depth_stencil(exa_priv->depth_stencil_tex->format)) exa_priv->depth_stencil_tex = NULL; /* Fall through */ -#endif case DRI2BufferDepth: if (exa_priv->depth_stencil_tex) pipe_texture_reference(&tex, exa_priv->depth_stencil_tex); -- cgit v1.2.3 From 552efdae06eae578da6d0c6d6bad4b662bce9735 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 8 Oct 2009 13:13:36 +0200 Subject: st/xorg: Use A8 textures for depth 8 pixmaps There is no hardware out there that can render to I8 textures. --- src/gallium/state_trackers/xorg/xorg_exa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index f7949bafaa..8920b24307 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -76,7 +76,7 @@ exa_get_pipe_format(int depth, enum pipe_format *format, int *bbp) assert(*bbp == 16); break; case 8: - *format = PIPE_FORMAT_I8_UNORM; + *format = PIPE_FORMAT_A8_UNORM; assert(*bbp == 8); break; case 4: -- cgit v1.2.3 From 5080e8bea6ae5cdb116023a5e2d8dbbb762bd69d Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 8 Oct 2009 13:38:34 +0200 Subject: st/xorg: Debug fallbacks for composite as well --- src/gallium/state_trackers/xorg/xorg_exa.c | 44 +++++++++++++++++++----------- 1 file changed, 28 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 8920b24307..279b551db2 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -215,8 +215,12 @@ ExaPrepareAccess(PixmapPtr pPix, int index) #endif PIPE_TRANSFER_READ_WRITE, 0, 0, priv->tex->width[0], priv->tex->height[0]); - if (!priv->map_transfer) + if (!priv->map_transfer) +#ifdef EXA_MIXED_PIXMAPS return FALSE; +#else + FatalError("failed to create transfer\n"); +#endif pPix->devPrivate.ptr = exa->scrn->transfer_map(exa->scrn, priv->map_transfer); @@ -318,7 +322,10 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) #if DISABLE_ACCEL return FALSE; #else - return xorg_solid_bind_state(exa, priv, fg); + if (xorg_solid_bind_state(exa, priv, fg)) + return TRUE; + else + XORG_FALLBACK("xorg_solid_bind_state failed\n"); #endif } @@ -496,11 +503,14 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, (void) exa; return FALSE; #else - return xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture, - pDstPicture, - pSrc ? exaGetPixmapDriverPrivate(pSrc) : NULL, - pMask ? exaGetPixmapDriverPrivate(pMask) : NULL, - exaGetPixmapDriverPrivate(pDst)); + if (xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture, + pDstPicture, + pSrc ? exaGetPixmapDriverPrivate(pSrc) : NULL, + pMask ? exaGetPixmapDriverPrivate(pMask) : NULL, + exaGetPixmapDriverPrivate(pDst))) + return TRUE; + else + XORG_FALLBACK("xorg_composite_bind_state failed"); #endif } @@ -526,15 +536,17 @@ ExaCheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture) { - boolean accelerated = xorg_composite_accelerated(op, - pSrcPicture, - pMaskPicture, - pDstPicture); -#if DEBUG_PRINT - debug_printf("ExaCheckComposite(%d, %p, %p, %p) = %d\n", - op, pSrcPicture, pMaskPicture, pDstPicture, accelerated); -#endif - return accelerated; + ScreenPtr pScreen = pDstPicture->pDrawable->pScreen; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + modesettingPtr ms = modesettingPTR(pScrn); + + if (xorg_composite_accelerated(op, + pSrcPicture, + pMaskPicture, + pDstPicture)) + return TRUE; + else + XORG_FALLBACK("xorg_composite_accelerated failed"); } static void * -- cgit v1.2.3 From 992b143b2551b0fe1871bc90aed984f63d04d7b5 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 8 Oct 2009 14:41:06 +0200 Subject: Revert "st/xorg: Debug fallbacks for composite as well" This commit included a change that should have been in its own commit, and turns out that you can do what was suposed to go in it in much better way as well. This reverts commit 5080e8bea6ae5cdb116023a5e2d8dbbb762bd69d. --- src/gallium/state_trackers/xorg/xorg_exa.c | 44 +++++++++++------------------- 1 file changed, 16 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 279b551db2..8920b24307 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -215,12 +215,8 @@ ExaPrepareAccess(PixmapPtr pPix, int index) #endif PIPE_TRANSFER_READ_WRITE, 0, 0, priv->tex->width[0], priv->tex->height[0]); - if (!priv->map_transfer) -#ifdef EXA_MIXED_PIXMAPS + if (!priv->map_transfer) return FALSE; -#else - FatalError("failed to create transfer\n"); -#endif pPix->devPrivate.ptr = exa->scrn->transfer_map(exa->scrn, priv->map_transfer); @@ -322,10 +318,7 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) #if DISABLE_ACCEL return FALSE; #else - if (xorg_solid_bind_state(exa, priv, fg)) - return TRUE; - else - XORG_FALLBACK("xorg_solid_bind_state failed\n"); + return xorg_solid_bind_state(exa, priv, fg); #endif } @@ -503,14 +496,11 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, (void) exa; return FALSE; #else - if (xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture, - pDstPicture, - pSrc ? exaGetPixmapDriverPrivate(pSrc) : NULL, - pMask ? exaGetPixmapDriverPrivate(pMask) : NULL, - exaGetPixmapDriverPrivate(pDst))) - return TRUE; - else - XORG_FALLBACK("xorg_composite_bind_state failed"); + return xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture, + pDstPicture, + pSrc ? exaGetPixmapDriverPrivate(pSrc) : NULL, + pMask ? exaGetPixmapDriverPrivate(pMask) : NULL, + exaGetPixmapDriverPrivate(pDst)); #endif } @@ -536,17 +526,15 @@ ExaCheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture) { - ScreenPtr pScreen = pDstPicture->pDrawable->pScreen; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - modesettingPtr ms = modesettingPTR(pScrn); - - if (xorg_composite_accelerated(op, - pSrcPicture, - pMaskPicture, - pDstPicture)) - return TRUE; - else - XORG_FALLBACK("xorg_composite_accelerated failed"); + boolean accelerated = xorg_composite_accelerated(op, + pSrcPicture, + pMaskPicture, + pDstPicture); +#if DEBUG_PRINT + debug_printf("ExaCheckComposite(%d, %p, %p, %p) = %d\n", + op, pSrcPicture, pMaskPicture, pDstPicture, accelerated); +#endif + return accelerated; } static void * -- cgit v1.2.3 From 6d629d4aa211d098fe9541d0b644cf67ee1d7019 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 8 Oct 2009 14:40:19 +0200 Subject: st/xorg: More fallback debugging Change the fallback debugging around a bit and do the old commit correctly --- src/gallium/state_trackers/xorg/xorg_composite.c | 11 ++++--- src/gallium/state_trackers/xorg/xorg_exa.c | 42 ++++++++++++------------ src/gallium/state_trackers/xorg/xorg_exa.h | 14 ++++---- 3 files changed, 35 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 7037d17e43..98e9933f72 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -283,6 +283,9 @@ boolean xorg_composite_accelerated(int op, PicturePtr pMaskPicture, PicturePtr pDstPicture) { + ScreenPtr pScreen = pDstPicture->pDrawable->pScreen; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + modesettingPtr ms = modesettingPTR(pScrn); unsigned i; unsigned accel_ops_count = sizeof(accelerated_ops)/sizeof(struct acceleration_info); @@ -290,11 +293,11 @@ boolean xorg_composite_accelerated(int op, if (pSrcPicture->pSourcePict) { /* Gradients not yet supported */ if (pSrcPicture->pSourcePict->type != SourcePictTypeSolidFill) - return FALSE; + XORG_FALLBACK("gradients not yet supported"); /* Solid source with mask not yet handled properly */ if (pMaskPicture) - return FALSE; + XORG_FALLBACK("solid source with mask not yet handled properly"); } for (i = 0; i < accel_ops_count; ++i) { @@ -306,11 +309,11 @@ boolean xorg_composite_accelerated(int op, (!accelerated_ops[i].with_mask || (pMaskPicture->componentAlpha && !accelerated_ops[i].component_alpha)))) - return FALSE; + XORG_FALLBACK("component alpha unsupported"); return TRUE; } } - return FALSE; + XORG_FALLBACK("unsupported operation"); } static void diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 8920b24307..3f0ed3d980 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -294,21 +294,21 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) debug_printf("ExaPrepareSolid(0x%x)\n", fg); #endif if (!exa->pipe) - XORG_FALLBACK("solid accle not enabled"); + XORG_FALLBACK("accle not enabled"); if (!priv || !priv->tex) - XORG_FALLBACK("solid !priv || !priv->tex"); + XORG_FALLBACK("%s", !priv ? "!priv" : "!priv->tex"); if (!EXA_PM_IS_SOLID(&pPixmap->drawable, planeMask)) - XORG_FALLBACK("solid planeMask is not solid"); + XORG_FALLBACK("planeMask is not solid"); if (alu != GXcopy) - XORG_FALLBACK("solid not GXcopy"); + XORG_FALLBACK("not GXcopy"); if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, priv->tex->target, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) { - XORG_FALLBACK("solid bad format %s", pf_name(priv->tex->format)); + XORG_FALLBACK("format %s", pf_name(priv->tex->format)); } #if DEBUG_SOLID @@ -390,29 +390,29 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, debug_printf("ExaPrepareCopy\n"); #endif if (!exa->pipe) - XORG_FALLBACK("copy accle not enabled"); + XORG_FALLBACK("accle not enabled"); - if (!priv || !src_priv) - XORG_FALLBACK("copy !priv || !src_priv"); + if (!priv || !priv->tex) + XORG_FALLBACK("pDst %s", !priv ? "!priv" : "!priv->tex"); - if (!priv->tex || !src_priv->tex) - XORG_FALLBACK("copy !priv->tex || !src_priv->tex"); + if (!src_priv || !src_priv->tex) + XORG_FALLBACK("pSrc %s", !src_priv ? "!priv" : "!priv->tex"); if (!EXA_PM_IS_SOLID(&pSrcPixmap->drawable, planeMask)) - XORG_FALLBACK("copy planeMask is not solid"); + XORG_FALLBACK("planeMask is not solid"); if (alu != GXcopy) - XORG_FALLBACK("copy alu not GXcopy"); + XORG_FALLBACK("alu not GXcopy"); if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, priv->tex->target, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) - XORG_FALLBACK("copy pDst format %s", pf_name(priv->tex->format)); + XORG_FALLBACK("pDst format %s", pf_name(priv->tex->format)); if (!exa->scrn->is_format_supported(exa->scrn, src_priv->tex->format, src_priv->tex->target, PIPE_TEXTURE_USAGE_SAMPLER, 0)) - XORG_FALLBACK("copy pSrc format %s", pf_name(src_priv->tex->format)); + XORG_FALLBACK("pSrc format %s", pf_name(src_priv->tex->format)); exa->copy.src = src_priv; exa->copy.dst = priv; @@ -459,37 +459,37 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, debug_printf("ExaPrepareComposite\n"); #endif if (!exa->pipe) - XORG_FALLBACK("comp accle not enabled"); + XORG_FALLBACK("accle not enabled"); priv = exaGetPixmapDriverPrivate(pDst); if (!priv || !priv->tex) - XORG_FALLBACK("comp pDst %s", !priv ? "!priv" : "!priv->tex"); + XORG_FALLBACK("pDst %s", !priv ? "!priv" : "!priv->tex"); if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, priv->tex->target, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) - XORG_FALLBACK("copy pDst format: %s", pf_name(priv->tex->format)); + XORG_FALLBACK("pDst format: %s", pf_name(priv->tex->format)); if (pSrc) { priv = exaGetPixmapDriverPrivate(pSrc); if (!priv || !priv->tex) - XORG_FALLBACK("comp pSrc %s", !priv ? "!priv" : "!priv->tex"); + XORG_FALLBACK("pSrc %s", !priv ? "!priv" : "!priv->tex"); if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, priv->tex->target, PIPE_TEXTURE_USAGE_SAMPLER, 0)) - XORG_FALLBACK("copy pSrc format: %s", pf_name(priv->tex->format)); + XORG_FALLBACK("pSrc format: %s", pf_name(priv->tex->format)); } if (pMask) { priv = exaGetPixmapDriverPrivate(pMask); if (!priv || !priv->tex) - XORG_FALLBACK("comp pMask %s", !priv ? "!priv" : "!priv->tex"); + XORG_FALLBACK("pMask %s", !priv ? "!priv" : "!priv->tex"); if (!exa->scrn->is_format_supported(exa->scrn, priv->tex->format, priv->tex->target, PIPE_TEXTURE_USAGE_SAMPLER, 0)) - XORG_FALLBACK("copy pMask format: %s", pf_name(priv->tex->format)); + XORG_FALLBACK("pMask format: %s", pf_name(priv->tex->format)); } #if DISABLE_ACCEL diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h index d3f25ca844..28834e3ef5 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.h +++ b/src/gallium/state_trackers/xorg/xorg_exa.h @@ -50,13 +50,13 @@ struct exa_pixmap_priv unsigned map_count; }; -#define XORG_FALLBACK(s, arg...) \ -do { \ - if (ms->debug_fallback) { \ - xf86DrvMsg(pScrn->scrnIndex, X_INFO, \ - "fallback: " s "\n", ##arg); \ - } \ - return FALSE; \ +#define XORG_FALLBACK(s, arg...) \ +do { \ + if (ms->debug_fallback) { \ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, \ + "%s fallback " s "\n", __FUNCTION__, ##arg); \ + } \ + return FALSE; \ } while(0) struct pipe_surface * -- cgit v1.2.3 From db828ed7589d0a5687386c4b4268b4e7ff78c866 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 8 Oct 2009 14:43:22 +0200 Subject: st/xorg: Old X servers don't deal well with failing accesses --- src/gallium/state_trackers/xorg/xorg_exa.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 3f0ed3d980..2633e8caaf 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -215,8 +215,12 @@ ExaPrepareAccess(PixmapPtr pPix, int index) #endif PIPE_TRANSFER_READ_WRITE, 0, 0, priv->tex->width[0], priv->tex->height[0]); - if (!priv->map_transfer) + if (!priv->map_transfer) +#ifdef EXA_MIXED_PIXMAPS return FALSE; +#else + FatalError("failed to create transfer\n"); +#endif pPix->devPrivate.ptr = exa->scrn->transfer_map(exa->scrn, priv->map_transfer); -- cgit v1.2.3 From 45e76d2665b38ba3787548310efc59e969124c01 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 8 Oct 2009 20:27:27 -0600 Subject: mesa: remove a bunch of gl_renderbuffer fields _ActualFormat is replaced by Format (MESA_FORMAT_x). ColorEncoding, ComponentType, RedBits, GreenBits, BlueBits, etc. are all replaced by MESA_FORMAT_x queries. --- src/mesa/drivers/dri/common/drirenderbuffer.c | 23 +- src/mesa/drivers/dri/i915/i915_texstate.c | 2 +- src/mesa/drivers/dri/intel/intel_buffers.c | 2 +- src/mesa/drivers/dri/intel/intel_context.c | 14 +- src/mesa/drivers/dri/intel/intel_fbo.c | 105 ++----- src/mesa/drivers/dri/intel/intel_span.c | 21 +- src/mesa/drivers/dri/intel/intel_tex_format.c | 2 +- src/mesa/drivers/dri/r200/r200_state_init.c | 10 +- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 10 +- .../drivers/dri/radeon/radeon_common_context.c | 14 +- src/mesa/drivers/dri/radeon/radeon_fbo.c | 102 ++---- src/mesa/drivers/dri/radeon/radeon_span.c | 20 +- src/mesa/drivers/dri/radeon/radeon_state_init.c | 10 +- src/mesa/drivers/dri/sis/sis_dd.c | 9 +- src/mesa/drivers/dri/swrast/swrast.c | 23 +- src/mesa/drivers/dri/unichrome/via_context.c | 5 + src/mesa/drivers/osmesa/osmesa.c | 19 +- src/mesa/drivers/x11/xm_buffer.c | 8 +- src/mesa/drivers/x11/xm_dd.c | 4 +- src/mesa/main/depthstencil.c | 344 +++++++++++++++------ src/mesa/main/fbobject.c | 190 ++++++------ src/mesa/main/framebuffer.c | 70 +++-- src/mesa/main/mtypes.h | 12 +- src/mesa/main/rbadaptors.c | 18 +- src/mesa/main/renderbuffer.c | 243 ++++----------- src/mesa/main/texrender.c | 17 +- src/mesa/state_tracker/st_cb_clear.c | 13 +- src/mesa/state_tracker/st_cb_fbo.c | 14 +- src/mesa/state_tracker/st_cb_texture.c | 9 +- src/mesa/state_tracker/st_format.c | 103 ++++-- src/mesa/state_tracker/st_format.h | 7 +- src/mesa/swrast/s_clear.c | 8 +- src/mesa/swrast/s_depth.c | 13 +- src/mesa/swrast/s_triangle.c | 2 +- 34 files changed, 709 insertions(+), 757 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.c b/src/mesa/drivers/dri/common/drirenderbuffer.c index 15af99136c..6fa1c6caa0 100644 --- a/src/mesa/drivers/dri/common/drirenderbuffer.c +++ b/src/mesa/drivers/dri/common/drirenderbuffer.c @@ -1,5 +1,6 @@ #include "main/mtypes.h" +#include "main/formats.h" #include "main/framebuffer.h" #include "main/renderbuffer.h" #include "main/imports.h" @@ -83,47 +84,37 @@ driNewRenderbuffer(GLenum format, GLvoid *addr, if (format == GL_RGBA || format == GL_RGB5 || format == GL_RGBA8) { /* Color */ - drb->Base._BaseFormat = GL_RGBA; drb->Base.DataType = GL_UNSIGNED_BYTE; if (format == GL_RGB5) { - drb->Base.RedBits = 5; - drb->Base.GreenBits = 6; - drb->Base.BlueBits = 5; + drb->Base.Format = MESA_FORMAT_RGB565; } else { - drb->Base.RedBits = - drb->Base.GreenBits = - drb->Base.BlueBits = - drb->Base.AlphaBits = 8; + drb->Base.Format = MESA_FORMAT_ARGB8888; } } else if (format == GL_DEPTH_COMPONENT16) { /* Depth */ - drb->Base._BaseFormat = GL_DEPTH_COMPONENT; /* we always Get/Put 32-bit Z values */ drb->Base.DataType = GL_UNSIGNED_INT; - drb->Base.DepthBits = 16; + drb->Base.Format = MESA_FORMAT_Z16; } else if (format == GL_DEPTH_COMPONENT24) { /* Depth */ - drb->Base._BaseFormat = GL_DEPTH_COMPONENT; /* we always Get/Put 32-bit Z values */ drb->Base.DataType = GL_UNSIGNED_INT; - drb->Base.DepthBits = 24; + drb->Base.Format = MESA_FORMAT_Z32; } else if (format == GL_DEPTH_COMPONENT32) { /* Depth */ - drb->Base._BaseFormat = GL_DEPTH_COMPONENT; /* we always Get/Put 32-bit Z values */ drb->Base.DataType = GL_UNSIGNED_INT; - drb->Base.DepthBits = 32; + drb->Base.Format = MESA_FORMAT_Z32; } else { /* Stencil */ ASSERT(format == GL_STENCIL_INDEX8_EXT); - drb->Base._BaseFormat = GL_STENCIL_INDEX; drb->Base.DataType = GL_UNSIGNED_BYTE; - drb->Base.StencilBits = 8; + drb->Base.Format = MESA_FORMAT_S8; } /* XXX if we were allocating a user-created renderbuffer, we'd have diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index 03ed8a6311..e441e287eb 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -80,7 +80,7 @@ translate_texture_format(GLuint mesa_format, GLuint internal_format, return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3); case MESA_FORMAT_RGBA_DXT5: return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5); - case MESA_FORMAT_S8_Z24: + case MESA_FORMAT_Z24_S8: return (MAPSURF_32BIT | MT_32BIT_xI824); default: fprintf(stderr, "%s: bad image format %x\n", __FUNCTION__, mesa_format); diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index e7357e78c5..fce227e9d9 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -257,7 +257,7 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) if (fb->_StencilBuffer && fb->_StencilBuffer->Wrapped) { irbStencil = intel_renderbuffer(fb->_StencilBuffer->Wrapped); if (irbStencil && irbStencil->region) { - ASSERT(irbStencil->Base._ActualFormat == GL_DEPTH24_STENCIL8_EXT); + ASSERT(irbStencil->Base.Format == MESA_FORMAT_Z24_S8); FALLBACK(intel, INTEL_FALLBACK_STENCIL_BUFFER, GL_FALSE); } else { diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index d49d95768d..6820393e00 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -189,19 +189,7 @@ intelGetString(GLcontext * ctx, GLenum name) static unsigned intel_bits_per_pixel(const struct intel_renderbuffer *rb) { - switch (rb->Base._ActualFormat) { - case GL_RGB5: - case GL_DEPTH_COMPONENT16: - return 16; - case GL_RGB8: - case GL_RGBA8: - case GL_DEPTH_COMPONENT24: - case GL_DEPTH24_STENCIL8_EXT: - case GL_STENCIL_INDEX8_EXT: - return 32; - default: - return 0; - } + return _mesa_get_format_bytes(rb->Base.Format) * 8; } void diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 3b4b90f2dc..292cccf7f2 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -114,11 +114,8 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: - rb->_ActualFormat = GL_RGB5; + rb->Format = MESA_FORMAT_RGB565; rb->DataType = GL_UNSIGNED_BYTE; - rb->RedBits = 5; - rb->GreenBits = 6; - rb->BlueBits = 5; irb->texformat = MESA_FORMAT_RGB565; cpp = 2; break; @@ -127,12 +124,8 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_RGB10: case GL_RGB12: case GL_RGB16: - rb->_ActualFormat = GL_RGB8; + rb->Format = MESA_FORMAT_ARGB8888; rb->DataType = GL_UNSIGNED_BYTE; - rb->RedBits = 8; - rb->GreenBits = 8; - rb->BlueBits = 8; - rb->AlphaBits = 0; irb->texformat = MESA_FORMAT_ARGB8888; /* XXX: Need xrgb8888 */ cpp = 4; break; @@ -144,12 +137,8 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: - rb->_ActualFormat = GL_RGBA8; + rb->Format = MESA_FORMAT_ARGB8888; rb->DataType = GL_UNSIGNED_BYTE; - rb->RedBits = 8; - rb->GreenBits = 8; - rb->BlueBits = 8; - rb->AlphaBits = 8; irb->texformat = MESA_FORMAT_ARGB8888; cpp = 4; break; @@ -159,36 +148,31 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_STENCIL_INDEX8_EXT: case GL_STENCIL_INDEX16_EXT: /* alloc a depth+stencil buffer */ - rb->_ActualFormat = GL_DEPTH24_STENCIL8_EXT; + rb->Format = MESA_FORMAT_Z24_S8; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; - rb->StencilBits = 8; cpp = 4; - irb->texformat = MESA_FORMAT_S8_Z24; + irb->texformat = MESA_FORMAT_Z24_S8; break; case GL_DEPTH_COMPONENT16: - rb->_ActualFormat = GL_DEPTH_COMPONENT16; + rb->Format = MESA_FORMAT_Z16; rb->DataType = GL_UNSIGNED_SHORT; - rb->DepthBits = 16; cpp = 2; irb->texformat = MESA_FORMAT_Z16; break; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT32: - rb->_ActualFormat = GL_DEPTH24_STENCIL8_EXT; + rb->Format = MESA_FORMAT_Z24_S8; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; - rb->DepthBits = 24; cpp = 4; - irb->texformat = MESA_FORMAT_S8_Z24; + irb->texformat = MESA_FORMAT_Z24_S8; break; case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: - rb->_ActualFormat = GL_DEPTH24_STENCIL8_EXT; + rb->Format = MESA_FORMAT_Z24_S8; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; - rb->DepthBits = 24; - rb->StencilBits = 8; cpp = 4; - irb->texformat = MESA_FORMAT_S8_Z24; + irb->texformat = MESA_FORMAT_Z24_S8; break; default: _mesa_problem(ctx, @@ -196,6 +180,8 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, return GL_FALSE; } + rb->_BaseFormat = _mesa_base_fbo_format(ctx, internalFormat); + intelFlush(ctx); /* free old region */ @@ -245,7 +231,7 @@ intel_alloc_window_storage(GLcontext * ctx, struct gl_renderbuffer *rb, ASSERT(rb->Name == 0); rb->Width = width; rb->Height = height; - rb->_ActualFormat = internalFormat; + rb->InternalFormat = internalFormat; return GL_TRUE; } @@ -324,62 +310,46 @@ intel_create_renderbuffer(GLenum intFormat) switch (intFormat) { case GL_RGB5: - irb->Base._ActualFormat = GL_RGB5; - irb->Base._BaseFormat = GL_RGBA; - irb->Base.RedBits = 5; - irb->Base.GreenBits = 6; - irb->Base.BlueBits = 5; + irb->Base.Format = MESA_FORMAT_RGB565; + irb->Base._BaseFormat = GL_RGB; irb->Base.DataType = GL_UNSIGNED_BYTE; irb->texformat = MESA_FORMAT_RGB565; break; case GL_RGB8: - irb->Base._ActualFormat = GL_RGB8; + irb->Base.Format = MESA_FORMAT_ARGB8888; /* XXX: NEED XRGB8888 */ irb->Base._BaseFormat = GL_RGB; - irb->Base.RedBits = 8; - irb->Base.GreenBits = 8; - irb->Base.BlueBits = 8; - irb->Base.AlphaBits = 0; irb->Base.DataType = GL_UNSIGNED_BYTE; irb->texformat = MESA_FORMAT_ARGB8888; /* XXX: NEED XRGB8888 */ break; case GL_RGBA8: - irb->Base._ActualFormat = GL_RGBA8; + irb->Base.Format = MESA_FORMAT_ARGB8888; irb->Base._BaseFormat = GL_RGBA; - irb->Base.RedBits = 8; - irb->Base.GreenBits = 8; - irb->Base.BlueBits = 8; - irb->Base.AlphaBits = 8; irb->Base.DataType = GL_UNSIGNED_BYTE; irb->texformat = MESA_FORMAT_ARGB8888; break; case GL_STENCIL_INDEX8_EXT: - irb->Base._ActualFormat = GL_STENCIL_INDEX8_EXT; + irb->Base.Format = MESA_FORMAT_Z24_S8; irb->Base._BaseFormat = GL_STENCIL_INDEX; - irb->Base.StencilBits = 8; irb->Base.DataType = GL_UNSIGNED_BYTE; - irb->texformat = MESA_FORMAT_S8_Z24; + irb->texformat = MESA_FORMAT_Z24_S8; break; case GL_DEPTH_COMPONENT16: - irb->Base._ActualFormat = GL_DEPTH_COMPONENT16; + irb->Base.Format = MESA_FORMAT_Z16; irb->Base._BaseFormat = GL_DEPTH_COMPONENT; - irb->Base.DepthBits = 16; irb->Base.DataType = GL_UNSIGNED_SHORT; irb->texformat = MESA_FORMAT_Z16; break; case GL_DEPTH_COMPONENT24: - irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; + irb->Base.Format = MESA_FORMAT_Z24_S8; irb->Base._BaseFormat = GL_DEPTH_COMPONENT; - irb->Base.DepthBits = 24; irb->Base.DataType = GL_UNSIGNED_INT; - irb->texformat = MESA_FORMAT_S8_Z24; + irb->texformat = MESA_FORMAT_Z24_S8; break; case GL_DEPTH24_STENCIL8_EXT: - irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; - irb->Base._BaseFormat = GL_DEPTH_STENCIL_EXT; - irb->Base.DepthBits = 24; - irb->Base.StencilBits = 8; + irb->Base.Format = MESA_FORMAT_Z24_S8; + irb->Base._BaseFormat = GL_DEPTH_STENCIL; irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT; - irb->texformat = MESA_FORMAT_S8_Z24; + irb->texformat = MESA_FORMAT_Z24_S8; break; default: _mesa_problem(NULL, @@ -468,38 +438,26 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb, gl_format texFormat; if (texImage->TexFormat == MESA_FORMAT_ARGB8888) { - irb->Base._ActualFormat = GL_RGBA8; - irb->Base._BaseFormat = GL_RGBA; irb->Base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGBA8 texture OK\n"); } else if (texImage->TexFormat == MESA_FORMAT_RGB565) { - irb->Base._ActualFormat = GL_RGB5; - irb->Base._BaseFormat = GL_RGB; irb->Base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGB5 texture OK\n"); } else if (texImage->TexFormat == MESA_FORMAT_ARGB1555) { - irb->Base._ActualFormat = GL_RGB5_A1; - irb->Base._BaseFormat = GL_RGBA; irb->Base.DataType = GL_UNSIGNED_BYTE; DBG("Render to ARGB1555 texture OK\n"); } else if (texImage->TexFormat == MESA_FORMAT_ARGB4444) { - irb->Base._ActualFormat = GL_RGBA4; - irb->Base._BaseFormat = GL_RGBA; irb->Base.DataType = GL_UNSIGNED_BYTE; DBG("Render to ARGB4444 texture OK\n"); } else if (texImage->TexFormat == MESA_FORMAT_Z16) { - irb->Base._ActualFormat = GL_DEPTH_COMPONENT16; - irb->Base._BaseFormat = GL_DEPTH_COMPONENT; irb->Base.DataType = GL_UNSIGNED_SHORT; DBG("Render to DEPTH16 texture OK\n"); } - else if (texImage->TexFormat == MESA_FORMAT_S8_Z24) { - irb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; - irb->Base._BaseFormat = GL_DEPTH_STENCIL_EXT; + else if (texImage->TexFormat == MESA_FORMAT_Z24_S8) { irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT; DBG("Render to DEPTH_STENCIL texture OK\n"); } @@ -508,17 +466,14 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb, return GL_FALSE; } + irb->Base.Format = texImage->TexFormat; + texFormat = texImage->TexFormat; - irb->Base.InternalFormat = irb->Base._ActualFormat; + irb->Base.InternalFormat = texImage->InternalFormat; + irb->Base._BaseFormat = _mesa_base_fbo_format(ctx, irb->Base.InternalFormat); irb->Base.Width = texImage->Width; irb->Base.Height = texImage->Height; - irb->Base.RedBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE); - irb->Base.GreenBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE); - irb->Base.BlueBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE); - irb->Base.AlphaBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE); - irb->Base.DepthBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE_ARB); - irb->Base.StencilBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_STENCIL_SIZE_EXT); irb->Base.Delete = intel_delete_renderbuffer; irb->Base.AllocStorage = intel_nop_alloc_storage; diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 5bbcce6fe4..540ebca15c 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -621,7 +621,7 @@ intel_set_span_functions(struct intel_context *intel, } break; case MESA_FORMAT_ARGB8888: - if (rb->AlphaBits == 0) { /* XXX: Need xRGB8888 Mesa format */ + if (0 /*rb->AlphaBits == 0*/) { /* XXX: Need xRGB8888 Mesa format */ /* 8888 RGBx */ switch (tiling) { case I915_TILING_NONE: @@ -665,26 +665,13 @@ intel_set_span_functions(struct intel_context *intel, break; } break; - case MESA_FORMAT_S8_Z24: + case MESA_FORMAT_Z24_S8: /* There are a few different ways SW asks us to access the S8Z24 data: * Z24 depth-only depth reads * S8Z24 depth reads * S8Z24 stencil reads. */ - if (rb->_ActualFormat == GL_DEPTH_COMPONENT24) { - switch (tiling) { - case I915_TILING_NONE: - default: - intelInitDepthPointers_z24(rb); - break; - case I915_TILING_X: - intel_XTile_InitDepthPointers_z24(rb); - break; - case I915_TILING_Y: - intel_YTile_InitDepthPointers_z24(rb); - break; - } - } else if (rb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT) { + if (rb->Format == MESA_FORMAT_Z24_S8) { switch (tiling) { case I915_TILING_NONE: default: @@ -697,7 +684,7 @@ intel_set_span_functions(struct intel_context *intel, intel_YTile_InitDepthPointers_z24_s8(rb); break; } - } else if (rb->_ActualFormat == GL_STENCIL_INDEX8_EXT) { + } else if (rb->Format == MESA_FORMAT_S8) { switch (tiling) { case I915_TILING_NONE: default: diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c index eca0f6d572..a71590d3ef 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_format.c +++ b/src/mesa/drivers/dri/intel/intel_tex_format.c @@ -153,7 +153,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, #endif case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: - return MESA_FORMAT_S8_Z24; + return MESA_FORMAT_Z24_S8; #ifndef I915 case GL_SRGB_EXT: diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c index 7697306d88..68bfeea701 100644 --- a/src/mesa/drivers/dri/r200/r200_state_init.c +++ b/src/mesa/drivers/dri/r200/r200_state_init.c @@ -529,16 +529,18 @@ static void ctx_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) atom->cmd[CTX_RB3D_CNTL] &= ~(0xf << 10); if (rrb->cpp == 4) atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_ARGB8888; - else switch (rrb->base._ActualFormat) { - case GL_RGB5: + else switch (rrb->base.Format) { + case MESA_FORMAT_RGB565: atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_RGB565; break; - case GL_RGBA4: + case MESA_FORMAT_ARGB4444: atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_ARGB4444; break; - case GL_RGB5_A1: + case MESA_FORMAT_ARGB1555: atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_ARGB1555; break; + default: + _mesa_problem(ctx, "Unexpected format in ctx_emit_cs"); } cbpitch = (rrb->pitch / rrb->cpp); diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index da5b7ba642..1e2a54f634 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -279,16 +279,18 @@ static void emit_cb_offset(GLcontext *ctx, struct radeon_state_atom * atom) cbpitch = (rrb->pitch / rrb->cpp); if (rrb->cpp == 4) cbpitch |= R300_COLOR_FORMAT_ARGB8888; - else switch (rrb->base._ActualFormat) { - case GL_RGB5: + else switch (rrb->base.Format) { + case MESA_FORMAT_RGB565: cbpitch |= R300_COLOR_FORMAT_RGB565; break; - case GL_RGBA4: + case MESA_FORMAT_ARGB4444: cbpitch |= R300_COLOR_FORMAT_ARGB4444; break; - case GL_RGB5_A1: + case MESA_FORMAT_ARGB1555: cbpitch |= R300_COLOR_FORMAT_ARGB1555; break; + default: + _mesa_problem(ctx, "unexpected format in emit_cb_offset()"); } if (rrb->bo->flags & RADEON_BO_FLAGS_MACRO_TILE) diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index 6b9b1e3c5e..fe99644907 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -496,19 +496,7 @@ radeon_make_renderbuffer_current(radeonContextPtr radeon, static unsigned radeon_bits_per_pixel(const struct radeon_renderbuffer *rb) { - switch (rb->base._ActualFormat) { - case GL_RGB5: - case GL_DEPTH_COMPONENT16: - return 16; - case GL_RGB8: - case GL_RGBA8: - case GL_DEPTH_COMPONENT24: - case GL_DEPTH24_STENCIL8_EXT: - case GL_STENCIL_INDEX8_EXT: - return 32; - default: - return 0; - } + return _mesa_get_format_bytes(rb->base.Format) * 8; } void diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 3f4f382d6c..796dd1b423 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -90,11 +90,8 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: - rb->_ActualFormat = GL_RGB5; + rb->Format = MESA_FORMAT_RGB565; rb->DataType = GL_UNSIGNED_BYTE; - rb->RedBits = 5; - rb->GreenBits = 6; - rb->BlueBits = 5; cpp = 2; break; case GL_RGB: @@ -102,12 +99,8 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_RGB10: case GL_RGB12: case GL_RGB16: - rb->_ActualFormat = GL_RGB8; + rb->Format = MESA_FORMAT_ARGB8888; rb->DataType = GL_UNSIGNED_BYTE; - rb->RedBits = 8; - rb->GreenBits = 8; - rb->BlueBits = 8; - rb->AlphaBits = 0; cpp = 4; break; case GL_RGBA: @@ -118,12 +111,8 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: - rb->_ActualFormat = GL_RGBA8; + rb->Format = MESA_FORMAT_ARGB8888; rb->DataType = GL_UNSIGNED_BYTE; - rb->RedBits = 8; - rb->GreenBits = 8; - rb->BlueBits = 8; - rb->AlphaBits = 8; cpp = 4; break; case GL_STENCIL_INDEX: @@ -132,31 +121,26 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_STENCIL_INDEX8_EXT: case GL_STENCIL_INDEX16_EXT: /* alloc a depth+stencil buffer */ - rb->_ActualFormat = GL_DEPTH24_STENCIL8_EXT; + rb->Format = MESA_FORMAT_Z24_S8; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; - rb->StencilBits = 8; cpp = 4; break; case GL_DEPTH_COMPONENT16: - rb->_ActualFormat = GL_DEPTH_COMPONENT16; + rb->Format = MESA_FORMAT_Z16; rb->DataType = GL_UNSIGNED_SHORT; - rb->DepthBits = 16; cpp = 2; break; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT32: - rb->_ActualFormat = GL_DEPTH_COMPONENT24; + rb->Format = MESA_FORMAT_Z32; rb->DataType = GL_UNSIGNED_INT; - rb->DepthBits = 24; cpp = 4; break; case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: - rb->_ActualFormat = GL_DEPTH24_STENCIL8_EXT; + rb->Format = MESA_FORMAT_Z24_S8; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; - rb->DepthBits = 24; - rb->StencilBits = 8; cpp = 4; break; default: @@ -165,6 +149,8 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, return GL_FALSE; } + rb->_BaseFormat = _mesa_base_fbo_format(ctx, internalFormat); + if (ctx->Driver.Flush) ctx->Driver.Flush(ctx); /* +r6/r7 */ @@ -212,7 +198,7 @@ radeon_alloc_window_storage(GLcontext * ctx, struct gl_renderbuffer *rb, ASSERT(rb->Name == 0); rb->Width = width; rb->Height = height; - rb->_ActualFormat = internalFormat; + rb->InternalFormat = internalFormat; return GL_TRUE; } @@ -269,55 +255,32 @@ radeon_create_renderbuffer(GLenum format, __DRIdrawablePrivate *driDrawPriv) /* XXX format junk */ switch (format) { case GL_RGB5: - rrb->base._ActualFormat = GL_RGB5; - rrb->base._BaseFormat = GL_RGBA; - rrb->base.RedBits = 5; - rrb->base.GreenBits = 6; - rrb->base.BlueBits = 5; rrb->base.DataType = GL_UNSIGNED_BYTE; + rrb->base._BaseFormat = GL_RGB; break; case GL_RGB8: - rrb->base._ActualFormat = GL_RGB8; - rrb->base._BaseFormat = GL_RGB; - rrb->base.RedBits = 8; - rrb->base.GreenBits = 8; - rrb->base.BlueBits = 8; - rrb->base.AlphaBits = 0; rrb->base.DataType = GL_UNSIGNED_BYTE; + rrb->base._BaseFormat = GL_RGB; break; case GL_RGBA8: - rrb->base._ActualFormat = GL_RGBA8; - rrb->base._BaseFormat = GL_RGBA; - rrb->base.RedBits = 8; - rrb->base.GreenBits = 8; - rrb->base.BlueBits = 8; - rrb->base.AlphaBits = 8; rrb->base.DataType = GL_UNSIGNED_BYTE; + rrb->base._BaseFormat = GL_RGBA; break; case GL_STENCIL_INDEX8_EXT: - rrb->base._ActualFormat = GL_STENCIL_INDEX8_EXT; - rrb->base._BaseFormat = GL_STENCIL_INDEX; - rrb->base.StencilBits = 8; rrb->base.DataType = GL_UNSIGNED_BYTE; + rrb->base._BaseFormat = GL_STENCIL_INDEX; break; case GL_DEPTH_COMPONENT16: - rrb->base._ActualFormat = GL_DEPTH_COMPONENT16; - rrb->base._BaseFormat = GL_DEPTH_COMPONENT; - rrb->base.DepthBits = 16; rrb->base.DataType = GL_UNSIGNED_SHORT; + rrb->base._BaseFormat = GL_DEPTH_COMPONENT; break; case GL_DEPTH_COMPONENT24: - rrb->base._ActualFormat = GL_DEPTH_COMPONENT24; - rrb->base._BaseFormat = GL_DEPTH_COMPONENT; - rrb->base.DepthBits = 24; rrb->base.DataType = GL_UNSIGNED_INT; + rrb->base._BaseFormat = GL_DEPTH_COMPONENT; break; case GL_DEPTH24_STENCIL8_EXT: - rrb->base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; - rrb->base._BaseFormat = GL_DEPTH_STENCIL_EXT; - rrb->base.DepthBits = 24; - rrb->base.StencilBits = 8; rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT; + rrb->base._BaseFormat = GL_STENCIL_INDEX; break; default: fprintf(stderr, "%s: Unknown format 0x%04x\n", __FUNCTION__, format); @@ -390,44 +353,26 @@ radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb, restart: if (texImage->TexFormat == MESA_FORMAT_ARGB8888) { - rrb->cpp = 4; - rrb->base._ActualFormat = GL_RGBA8; - rrb->base._BaseFormat = GL_RGBA; rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGBA8 texture OK\n"); } else if (texImage->TexFormat == MESA_FORMAT_RGB565) { - rrb->cpp = 2; - rrb->base._ActualFormat = GL_RGB5; - rrb->base._BaseFormat = GL_RGB; rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGB5 texture OK\n"); } else if (texImage->TexFormat == MESA_FORMAT_ARGB1555) { - rrb->cpp = 2; - rrb->base._ActualFormat = GL_RGB5_A1; - rrb->base._BaseFormat = GL_RGBA; rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to ARGB1555 texture OK\n"); } else if (texImage->TexFormat == MESA_FORMAT_ARGB4444) { - rrb->cpp = 2; - rrb->base._ActualFormat = GL_RGBA4; - rrb->base._BaseFormat = GL_RGBA; rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to ARGB1555 texture OK\n"); } else if (texImage->TexFormat == MESA_FORMAT_Z16) { - rrb->cpp = 2; - rrb->base._ActualFormat = GL_DEPTH_COMPONENT16; - rrb->base._BaseFormat = GL_DEPTH_COMPONENT; rrb->base.DataType = GL_UNSIGNED_SHORT; DBG("Render to DEPTH16 texture OK\n"); } else if (texImage->TexFormat == MESA_FORMAT_S8_Z24) { - rrb->cpp = 4; - rrb->base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; - rrb->base._BaseFormat = GL_DEPTH_STENCIL_EXT; rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT; DBG("Render to DEPTH_STENCIL texture OK\n"); } @@ -448,16 +393,15 @@ restart: texFormat = texImage->TexFormat; + rrb->base.Format = texFormat; + + rrb->cpp = _mesa_get_format_bytes(texFormat); rrb->pitch = texImage->Width * rrb->cpp; - rrb->base.InternalFormat = rrb->base._ActualFormat; + rrb->base.InternalFormat = texImage->InternalFormat; + rrb->base._BaseFormat = _mesa_base_fbo_format(ctx, rrb->base.InternalFormat); + rrb->base.Width = texImage->Width; rrb->base.Height = texImage->Height; - rrb->base.RedBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE); - rrb->base.GreenBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE); - rrb->base.BlueBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE); - rrb->base.AlphaBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE); - rrb->base.DepthBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE_ARB); - rrb->base.StencilBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_STENCIL_SIZE_EXT); rrb->base.Delete = radeon_delete_renderbuffer; rrb->base.AllocStorage = radeon_nop_alloc_storage; diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c index 0c49c3713a..055f77a24b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.c +++ b/src/mesa/drivers/dri/radeon/radeon_span.c @@ -864,25 +864,25 @@ void radeonInitSpanFuncs(GLcontext * ctx) */ static void radeonSetSpanFunctions(struct radeon_renderbuffer *rrb) { - if (rrb->base._ActualFormat == GL_RGB5) { + if (rrb->base.Format == MESA_FORMAT_RGB565) { radeonInitPointers_RGB565(&rrb->base); - } else if (rrb->base._ActualFormat == GL_RGB8) { + } else if (rrb->base.Format == MESA_FORMAT_RGBA8888) { /* XXX */ radeonInitPointers_xRGB8888(&rrb->base); - } else if (rrb->base._ActualFormat == GL_RGBA8) { + } else if (rrb->base.Format == MESA_FORMAT_RGBA8888) { radeonInitPointers_ARGB8888(&rrb->base); - } else if (rrb->base._ActualFormat == GL_RGBA4) { + } else if (rrb->base.Format == MESA_FORMAT_ARGB4444) { radeonInitPointers_ARGB4444(&rrb->base); - } else if (rrb->base._ActualFormat == GL_RGB5_A1) { + } else if (rrb->base.Format == MESA_FORMAT_ARGB1555) { radeonInitPointers_ARGB1555(&rrb->base); - } else if (rrb->base._ActualFormat == GL_DEPTH_COMPONENT16) { + } else if (rrb->base.Format == MESA_FORMAT_Z16) { radeonInitDepthPointers_z16(&rrb->base); - } else if (rrb->base._ActualFormat == GL_DEPTH_COMPONENT24) { + } else if (rrb->base.Format == GL_DEPTH_COMPONENT32) { /* XXX */ radeonInitDepthPointers_z24(&rrb->base); - } else if (rrb->base._ActualFormat == GL_DEPTH24_STENCIL8_EXT) { + } else if (rrb->base.Format == MESA_FORMAT_Z24_S8) { radeonInitDepthPointers_z24_s8(&rrb->base); - } else if (rrb->base._ActualFormat == GL_STENCIL_INDEX8_EXT) { + } else if (rrb->base.Format == MESA_FORMAT_S8) { radeonInitStencilPointers_z24_s8(&rrb->base); } else { - fprintf(stderr, "radeonSetSpanFunctions: bad actual format: 0x%04X\n", rrb->base._ActualFormat); + fprintf(stderr, "radeonSetSpanFunctions: bad actual format: 0x%04X\n", rrb->base.Format); } } diff --git a/src/mesa/drivers/dri/radeon/radeon_state_init.c b/src/mesa/drivers/dri/radeon/radeon_state_init.c index f3ad0dd17a..2d19220d8a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state_init.c +++ b/src/mesa/drivers/dri/radeon/radeon_state_init.c @@ -440,16 +440,18 @@ static void ctx_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) atom->cmd[CTX_RB3D_CNTL] &= ~(0xf << 10); if (rrb->cpp == 4) atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_ARGB8888; - else switch (rrb->base._ActualFormat) { - case GL_RGB5: + else switch (rrb->base.Format) { + case MESA_FORMAT_RGB565: atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_RGB565; break; - case GL_RGBA4: + case MESA_FORMAT_ARGB4444: atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_ARGB4444; break; - case GL_RGB5_A1: + case MESA_FORMAT_ARGB1555: atom->cmd[CTX_RB3D_CNTL] |= RADEON_COLOR_FORMAT_ARGB1555; break; + default: + _mesa_problem(ctx, "unexpected format in ctx_emit_cs()"); } cbpitch = (rrb->pitch / rrb->cpp); diff --git a/src/mesa/drivers/dri/sis/sis_dd.c b/src/mesa/drivers/dri/sis/sis_dd.c index bddc4a9285..217d77557f 100644 --- a/src/mesa/drivers/dri/sis/sis_dd.c +++ b/src/mesa/drivers/dri/sis/sis_dd.c @@ -41,6 +41,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "sis_tris.h" #include "swrast/swrast.h" +#include "main/formats.h" #include "main/framebuffer.h" #include "main/renderbuffer.h" @@ -142,25 +143,25 @@ sisInitRenderbuffer(struct gl_renderbuffer *rb, GLenum format) if (format == GL_RGBA) { /* Color */ - rb->_BaseFormat = GL_RGBA; + rb->Format = MESA_FORMAT_ARGB8888; rb->DataType = GL_UNSIGNED_BYTE; } else if (format == GL_DEPTH_COMPONENT16) { /* Depth */ - rb->_BaseFormat = GL_DEPTH_COMPONENT; /* we always Get/Put 32-bit Z values */ + rb->Format = MESA_FORMAT_Z16; rb->DataType = GL_UNSIGNED_INT; } else if (format == GL_DEPTH_COMPONENT24) { /* Depth */ - rb->_BaseFormat = GL_DEPTH_COMPONENT; /* we always Get/Put 32-bit Z values */ + rb->Format = MESA_FORMAT_Z32; rb->DataType = GL_UNSIGNED_INT; } else { /* Stencil */ ASSERT(format == GL_STENCIL_INDEX8_EXT); - rb->_BaseFormat = GL_STENCIL_INDEX; + rb->Format = MESA_FORMAT_S8; rb->DataType = GL_UNSIGNED_BYTE; } diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index f4947daa06..a8d1a95bbe 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -33,6 +33,7 @@ #include "main/context.h" #include "main/extensions.h" +#include "main/formats.h" #include "main/framebuffer.h" #include "main/imports.h" #include "main/renderbuffer.h" @@ -378,50 +379,38 @@ swrast_new_renderbuffer(const GLvisual *visual, GLboolean front) switch (pixel_format) { case PF_A8R8G8B8: + xrb->Base.Format = MESA_FORMAT_ARGB8888; xrb->Base.InternalFormat = GL_RGBA; xrb->Base._BaseFormat = GL_RGBA; xrb->Base.DataType = GL_UNSIGNED_BYTE; - xrb->Base.RedBits = 8 * sizeof(GLubyte); - xrb->Base.GreenBits = 8 * sizeof(GLubyte); - xrb->Base.BlueBits = 8 * sizeof(GLubyte); - xrb->Base.AlphaBits = 8 * sizeof(GLubyte); xrb->bpp = 32; break; case PF_X8R8G8B8: + xrb->Base.Format = MESA_FORMAT_ARGB8888; /* XXX */ xrb->Base.InternalFormat = GL_RGB; xrb->Base._BaseFormat = GL_RGB; xrb->Base.DataType = GL_UNSIGNED_BYTE; - xrb->Base.RedBits = 8 * sizeof(GLubyte); - xrb->Base.GreenBits = 8 * sizeof(GLubyte); - xrb->Base.BlueBits = 8 * sizeof(GLubyte); - xrb->Base.AlphaBits = 0; xrb->bpp = 32; break; case PF_R5G6B5: + xrb->Base.Format = MESA_FORMAT_RGB565; xrb->Base.InternalFormat = GL_RGB; xrb->Base._BaseFormat = GL_RGB; xrb->Base.DataType = GL_UNSIGNED_BYTE; - xrb->Base.RedBits = 5 * sizeof(GLubyte); - xrb->Base.GreenBits = 6 * sizeof(GLubyte); - xrb->Base.BlueBits = 5 * sizeof(GLubyte); - xrb->Base.AlphaBits = 0; xrb->bpp = 16; break; case PF_R3G3B2: + xrb->Base.Format = MESA_FORMAT_RGB332; xrb->Base.InternalFormat = GL_RGB; xrb->Base._BaseFormat = GL_RGB; xrb->Base.DataType = GL_UNSIGNED_BYTE; - xrb->Base.RedBits = 3 * sizeof(GLubyte); - xrb->Base.GreenBits = 3 * sizeof(GLubyte); - xrb->Base.BlueBits = 2 * sizeof(GLubyte); - xrb->Base.AlphaBits = 0; xrb->bpp = 8; break; case PF_CI8: + xrb->Base.Format = MESA_FORMAT_CI8; xrb->Base.InternalFormat = GL_COLOR_INDEX8_EXT; xrb->Base._BaseFormat = GL_COLOR_INDEX; xrb->Base.DataType = GL_UNSIGNED_BYTE; - xrb->Base.IndexBits = 8 * sizeof(GLubyte); xrb->bpp = 8; break; default: diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index 6eb19ac079..e7b6b030d1 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -32,6 +32,7 @@ #include "main/glheader.h" #include "main/context.h" +#include "main/formats.h" #include "main/matrix.h" #include "main/state.h" #include "main/simple_list.h" @@ -163,24 +164,28 @@ viaInitRenderbuffer(struct via_renderbuffer *vrb, GLenum format, if (format == GL_RGBA) { /* Color */ rb->_BaseFormat = GL_RGBA; + rb->Format = MESA_FORMAT_ARGB8888; rb->DataType = GL_UNSIGNED_BYTE; } else if (format == GL_DEPTH_COMPONENT16) { /* Depth */ rb->_BaseFormat = GL_DEPTH_COMPONENT; /* we always Get/Put 32-bit Z values */ + rb->Format = MESA_FORMAT_Z16; rb->DataType = GL_UNSIGNED_INT; } else if (format == GL_DEPTH_COMPONENT24) { /* Depth */ rb->_BaseFormat = GL_DEPTH_COMPONENT; /* we always Get/Put 32-bit Z values */ + rb->Format = MESA_FORMAT_Z32; rb->DataType = GL_UNSIGNED_INT; } else { /* Stencil */ ASSERT(format == GL_STENCIL_INDEX8_EXT); rb->_BaseFormat = GL_STENCIL_INDEX; + rb->Format = MESA_FORMAT_S8; rb->DataType = GL_UNSIGNED_BYTE; } diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index 692657a5df..bac8a9ef14 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -37,6 +37,7 @@ #include "GL/osmesa.h" #include "main/context.h" #include "main/extensions.h" +#include "main/formats.h" #include "main/framebuffer.h" #include "main/imports.h" #include "main/mtypes.h" @@ -840,11 +841,6 @@ osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, else bpc = 32; - rb->RedBits = - rb->GreenBits = - rb->BlueBits = - rb->AlphaBits = bpc; - /* Note: we can ignoring internalFormat for "window-system" renderbuffers */ (void) internalFormat; @@ -876,7 +872,6 @@ osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutValues = put_values_RGBA32; rb->PutMonoValues = put_mono_values_RGBA32; } - rb->RedBits = rb->GreenBits = rb->BlueBits = rb->AlphaBits = bpc; } else if (osmesa->format == OSMESA_BGRA) { if (rb->DataType == GL_UNSIGNED_BYTE) { @@ -906,7 +901,6 @@ osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutValues = put_values_BGRA32; rb->PutMonoValues = put_mono_values_BGRA32; } - rb->RedBits = rb->GreenBits = rb->BlueBits = rb->AlphaBits = bpc; } else if (osmesa->format == OSMESA_ARGB) { if (rb->DataType == GL_UNSIGNED_BYTE) { @@ -936,7 +930,6 @@ osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutValues = put_values_ARGB32; rb->PutMonoValues = put_mono_values_ARGB32; } - rb->RedBits = rb->GreenBits = rb->BlueBits = rb->AlphaBits = bpc; } else if (osmesa->format == OSMESA_RGB) { if (rb->DataType == GL_UNSIGNED_BYTE) { @@ -966,7 +959,6 @@ osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutValues = put_values_RGB32; rb->PutMonoValues = put_mono_values_RGB32; } - rb->RedBits = rb->GreenBits = rb->BlueBits = bpc; } else if (osmesa->format == OSMESA_BGR) { if (rb->DataType == GL_UNSIGNED_BYTE) { @@ -996,7 +988,6 @@ osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutValues = put_values_BGR32; rb->PutMonoValues = put_mono_values_BGR32; } - rb->RedBits = rb->GreenBits = rb->BlueBits = bpc; } else if (osmesa->format == OSMESA_RGB_565) { ASSERT(rb->DataType == GL_UNSIGNED_BYTE); @@ -1007,9 +998,6 @@ osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_RGB_565; rb->PutValues = put_values_RGB_565; rb->PutMonoValues = put_mono_values_RGB_565; - rb->RedBits = 5; - rb->GreenBits = 6; - rb->BlueBits = 5; } else if (osmesa->format == OSMESA_COLOR_INDEX) { rb->GetRow = get_row_CI; @@ -1018,7 +1006,6 @@ osmesa_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_CI; rb->PutValues = put_values_CI; rb->PutMonoValues = put_mono_values_CI; - rb->IndexBits = 8; } else { _mesa_problem(ctx, "bad pixel format in osmesa renderbuffer_storage"); @@ -1048,13 +1035,13 @@ new_osmesa_renderbuffer(GLcontext *ctx, GLenum format, GLenum type) if (format == OSMESA_COLOR_INDEX) { rb->InternalFormat = GL_COLOR_INDEX; - rb->_ActualFormat = GL_COLOR_INDEX8_EXT; + rb->Format = MESA_FORMAT_CI8; rb->_BaseFormat = GL_COLOR_INDEX; rb->DataType = GL_UNSIGNED_BYTE; } else { rb->InternalFormat = GL_RGBA; - rb->_ActualFormat = GL_RGBA; + rb->Format = MESA_FORMAT_RGBA8888; rb->_BaseFormat = GL_RGBA; rb->DataType = type; } diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c index 821e2a8e08..bf38629289 100644 --- a/src/mesa/drivers/x11/xm_buffer.c +++ b/src/mesa/drivers/x11/xm_buffer.c @@ -32,6 +32,7 @@ #include "glxheader.h" #include "xmesaP.h" #include "main/imports.h" +#include "main/formats.h" #include "main/framebuffer.h" #include "main/renderbuffer.h" @@ -338,18 +339,15 @@ xmesa_new_renderbuffer(GLcontext *ctx, GLuint name, const GLvisual *visual, if (visual->rgbMode) { xrb->Base.InternalFormat = GL_RGBA; + xrb->Base.Format = MESA_FORMAT_RGBA8888; xrb->Base._BaseFormat = GL_RGBA; xrb->Base.DataType = GL_UNSIGNED_BYTE; - xrb->Base.RedBits = visual->redBits; - xrb->Base.GreenBits = visual->greenBits; - xrb->Base.BlueBits = visual->blueBits; - xrb->Base.AlphaBits = visual->alphaBits; } else { xrb->Base.InternalFormat = GL_COLOR_INDEX; + xrb->Base.Format = MESA_FORMAT_CI8; xrb->Base._BaseFormat = GL_COLOR_INDEX; xrb->Base.DataType = GL_UNSIGNED_INT; - xrb->Base.IndexBits = visual->indexBits; } /* only need to set Red/Green/EtcBits fields for user-created RBs */ } diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index d757e50b5a..a27d7045ab 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -448,7 +448,7 @@ can_do_DrawPixels_8R8G8B(GLcontext *ctx, GLenum format, GLenum type) struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb->Wrapped); if (xrb && xrb->pixmap && /* drawing to pixmap or window */ - xrb->Base.AlphaBits == 0) { + _mesa_get_format_bits(xrb->Base.Format, GL_ALPHA_BITS) == 0) { return GL_TRUE; } } @@ -582,7 +582,7 @@ can_do_DrawPixels_5R6G5B(GLcontext *ctx, GLenum format, GLenum type) struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(rb->Wrapped); if (xrb && xrb->pixmap && /* drawing to pixmap or window */ - xrb->Base.AlphaBits == 0) { + _mesa_get_format_bits(xrb->Base.Format, GL_ALPHA_BITS) == 0) { return GL_TRUE; } } diff --git a/src/mesa/main/depthstencil.c b/src/mesa/main/depthstencil.c index 7be2aacaf2..803dc6c75e 100644 --- a/src/mesa/main/depthstencil.c +++ b/src/mesa/main/depthstencil.c @@ -26,6 +26,7 @@ #include "imports.h" #include "context.h" #include "fbobject.h" +#include "formats.h" #include "mtypes.h" #include "depthstencil.h" #include "renderbuffer.h" @@ -40,8 +41,8 @@ * a combined Z+stencil buffer! That implies we need three different sets * of Get/Put functions. * - * We solve this by wrapping the Z24_S8 renderbuffer with depth and stencil - * adaptors, each with the right kind of depth/stencil Get/Put functions. + * We solve this by wrapping the Z24_S8 or S8_Z24 renderbuffer with depth and + * stencil adaptors, each with the right kind of depth/stencil Get/Put functions. */ @@ -62,8 +63,8 @@ nop_get_pointer(GLcontext *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) static void delete_wrapper(struct gl_renderbuffer *rb) { - ASSERT(rb->_ActualFormat == GL_DEPTH_COMPONENT24 || - rb->_ActualFormat == GL_STENCIL_INDEX8_EXT); + ASSERT(rb->Format == MESA_FORMAT_Z24_S8 || + rb->Format == MESA_FORMAT_S8_Z24); _mesa_reference_renderbuffer(&rb->Wrapped, NULL); _mesa_free(rb); } @@ -82,7 +83,8 @@ alloc_wrapper_storage(GLcontext *ctx, struct gl_renderbuffer *rb, (void) internalFormat; - ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT); + ASSERT(dsrb->Format == MESA_FORMAT_Z24_S8 || + dsrb->Format == MESA_FORMAT_S8_Z24); retVal = dsrb->AllocStorage(ctx, dsrb, dsrb->InternalFormat, width, height); if (retVal) { @@ -108,14 +110,21 @@ get_row_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count, GLuint *dst = (GLuint *) values; const GLuint *src = (const GLuint *) dsrb->GetPointer(ctx, dsrb, x, y); ASSERT(z24rb->DataType == GL_UNSIGNED_INT); - ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT); ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT); if (!src) { dsrb->GetRow(ctx, dsrb, count, x, y, temp); src = temp; } - for (i = 0; i < count; i++) { - dst[i] = src[i] >> 8; + if (dsrb->Format == MESA_FORMAT_Z24_S8) { + for (i = 0; i < count; i++) { + dst[i] = src[i] >> 8; + } + } + else { + assert(dsrb->Format == MESA_FORMAT_S8_Z24); + for (i = 0; i < count; i++) { + dst[i] = src[i] & 0xffffff; + } } } @@ -127,13 +136,20 @@ get_values_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count, GLuint temp[MAX_WIDTH], i; GLuint *dst = (GLuint *) values; ASSERT(z24rb->DataType == GL_UNSIGNED_INT); - ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT); ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT); ASSERT(count <= MAX_WIDTH); /* don't bother trying direct access */ dsrb->GetValues(ctx, dsrb, count, x, y, temp); - for (i = 0; i < count; i++) { - dst[i] = temp[i] >> 8; + if (dsrb->Format == MESA_FORMAT_Z24_S8) { + for (i = 0; i < count; i++) { + dst[i] = temp[i] >> 8; + } + } + else { + assert(dsrb->Format == MESA_FORMAT_S8_Z24); + for (i = 0; i < count; i++) { + dst[i] = temp[i] & 0xffffff; + } } } @@ -145,14 +161,23 @@ put_row_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count, const GLuint *src = (const GLuint *) values; GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x, y); ASSERT(z24rb->DataType == GL_UNSIGNED_INT); - ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT); ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT); if (dst) { /* direct access */ GLuint i; - for (i = 0; i < count; i++) { - if (!mask || mask[i]) { - dst[i] = (src[i] << 8) | (dst[i] & 0xff); + if (dsrb->Format == MESA_FORMAT_Z24_S8) { + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + dst[i] = (src[i] << 8) | (dst[i] & 0xff); + } + } + } + else { + assert(dsrb->Format == MESA_FORMAT_S8_Z24); + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + dst[i] = (src[i] & 0xffffff) | (dst[i] & 0xff000000); + } } } } @@ -160,9 +185,19 @@ put_row_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count, /* get, modify, put */ GLuint temp[MAX_WIDTH], i; dsrb->GetRow(ctx, dsrb, count, x, y, temp); - for (i = 0; i < count; i++) { - if (!mask || mask[i]) { - temp[i] = (src[i] << 8) | (temp[i] & 0xff); + if (dsrb->Format == MESA_FORMAT_Z24_S8) { + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + temp[i] = (src[i] << 8) | (temp[i] & 0xff); + } + } + } + else { + assert(dsrb->Format == MESA_FORMAT_S8_Z24); + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + temp[i] = (src[i] & 0xffffff) | (temp[i] & 0xff000000); + } } } dsrb->PutRow(ctx, dsrb, count, x, y, temp, mask); @@ -174,17 +209,27 @@ put_mono_row_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count, GLint x, GLint y, const void *value, const GLubyte *mask) { struct gl_renderbuffer *dsrb = z24rb->Wrapped; - const GLuint shiftedVal = *((GLuint *) value) << 8; GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x, y); ASSERT(z24rb->DataType == GL_UNSIGNED_INT); - ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT); ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT); if (dst) { /* direct access */ GLuint i; - for (i = 0; i < count; i++) { - if (!mask || mask[i]) { - dst[i] = shiftedVal | (dst[i] & 0xff); + if (dsrb->Format == MESA_FORMAT_Z24_S8) { + const GLuint shiftedVal = *((GLuint *) value) << 8; + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + dst[i] = shiftedVal | (dst[i] & 0xff); + } + } + } + else { + const GLuint shiftedVal = *((GLuint *) value); + assert(dsrb->Format == MESA_FORMAT_S8_Z24); + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + dst[i] = shiftedVal | (dst[i] & 0xff000000); + } } } } @@ -192,9 +237,21 @@ put_mono_row_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count, /* get, modify, put */ GLuint temp[MAX_WIDTH], i; dsrb->GetRow(ctx, dsrb, count, x, y, temp); - for (i = 0; i < count; i++) { - if (!mask || mask[i]) { - temp[i] = shiftedVal | (temp[i] & 0xff); + if (dsrb->Format == MESA_FORMAT_Z24_S8) { + const GLuint shiftedVal = *((GLuint *) value) << 8; + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + temp[i] = shiftedVal | (temp[i] & 0xff); + } + } + } + else { + const GLuint shiftedVal = *((GLuint *) value); + assert(dsrb->Format == MESA_FORMAT_S8_Z24); + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + temp[i] = shiftedVal | (temp[i] & 0xff000000); + } } } dsrb->PutRow(ctx, dsrb, count, x, y, temp, mask); @@ -209,15 +266,25 @@ put_values_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count, struct gl_renderbuffer *dsrb = z24rb->Wrapped; const GLuint *src = (const GLuint *) values; ASSERT(z24rb->DataType == GL_UNSIGNED_INT); - ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT); ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT); if (dsrb->GetPointer(ctx, dsrb, 0, 0)) { /* direct access */ GLuint i; - for (i = 0; i < count; i++) { - if (!mask || mask[i]) { - GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]); - *dst = (src[i] << 8) | (*dst & 0xff); + if (dsrb->Format == MESA_FORMAT_Z24_S8) { + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]); + *dst = (src[i] << 8) | (*dst & 0xff); + } + } + } + else { + assert(dsrb->Format == MESA_FORMAT_S8_Z24); + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]); + *dst = (src[i] & 0xffffff) | (*dst & 0xff000000); + } } } } @@ -225,9 +292,19 @@ put_values_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, GLuint count, /* get, modify, put */ GLuint temp[MAX_WIDTH], i; dsrb->GetValues(ctx, dsrb, count, x, y, temp); - for (i = 0; i < count; i++) { - if (!mask || mask[i]) { - temp[i] = (src[i] << 8) | (temp[i] & 0xff); + if (dsrb->Format == MESA_FORMAT_Z24_S8) { + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + temp[i] = (src[i] << 8) | (temp[i] & 0xff); + } + } + } + else { + assert(dsrb->Format == MESA_FORMAT_S8_Z24); + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + temp[i] = (src[i] & 0xffffff) | (temp[i] & 0xff000000); + } } } dsrb->PutValues(ctx, dsrb, count, x, y, temp, mask); @@ -241,12 +318,23 @@ put_mono_values_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, { struct gl_renderbuffer *dsrb = z24rb->Wrapped; GLuint temp[MAX_WIDTH], i; - const GLuint shiftedVal = *((GLuint *) value) << 8; /* get, modify, put */ dsrb->GetValues(ctx, dsrb, count, x, y, temp); - for (i = 0; i < count; i++) { - if (!mask || mask[i]) { - temp[i] = shiftedVal | (temp[i] & 0xff); + if (dsrb->Format == MESA_FORMAT_Z24_S8) { + const GLuint shiftedVal = *((GLuint *) value) << 8; + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + temp[i] = shiftedVal | (temp[i] & 0xff); + } + } + } + else { + assert(dsrb->Format == MESA_FORMAT_S8_Z24); + const GLuint shiftedVal = *((GLuint *) value); + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + temp[i] = shiftedVal | (temp[i] & 0xff000000); + } } } dsrb->PutValues(ctx, dsrb, count, x, y, temp, mask); @@ -264,7 +352,8 @@ _mesa_new_z24_renderbuffer_wrapper(GLcontext *ctx, { struct gl_renderbuffer *z24rb; - ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT); + ASSERT(dsrb->Format == MESA_FORMAT_Z24_S8 || + dsrb->Format == MESA_FORMAT_S8_Z24); ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT); z24rb = _mesa_new_renderbuffer(ctx, 0); @@ -277,10 +366,9 @@ _mesa_new_z24_renderbuffer_wrapper(GLcontext *ctx, z24rb->Width = dsrb->Width; z24rb->Height = dsrb->Height; z24rb->InternalFormat = GL_DEPTH_COMPONENT24; - z24rb->_ActualFormat = GL_DEPTH_COMPONENT24; + z24rb->Format = MESA_FORMAT_Z24_S8; z24rb->_BaseFormat = GL_DEPTH_COMPONENT; z24rb->DataType = GL_UNSIGNED_INT; - z24rb->DepthBits = 24; z24rb->Data = NULL; z24rb->Delete = delete_wrapper; z24rb->AllocStorage = alloc_wrapper_storage; @@ -310,14 +398,21 @@ get_row_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count, GLubyte *dst = (GLubyte *) values; const GLuint *src = (const GLuint *) dsrb->GetPointer(ctx, dsrb, x, y); ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE); - ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT); ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT); if (!src) { dsrb->GetRow(ctx, dsrb, count, x, y, temp); src = temp; } - for (i = 0; i < count; i++) { - dst[i] = src[i] & 0xff; + if (dsrb->Format == MESA_FORMAT_Z24_S8) { + for (i = 0; i < count; i++) { + dst[i] = src[i] & 0xff; + } + } + else { + assert(dsrb->Format == MESA_FORMAT_S8_Z24); + for (i = 0; i < count; i++) { + dst[i] = src[i] >> 24; + } } } @@ -329,13 +424,20 @@ get_values_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count, GLuint temp[MAX_WIDTH], i; GLubyte *dst = (GLubyte *) values; ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE); - ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT); ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT); ASSERT(count <= MAX_WIDTH); /* don't bother trying direct access */ dsrb->GetValues(ctx, dsrb, count, x, y, temp); - for (i = 0; i < count; i++) { - dst[i] = temp[i] & 0xff; + if (dsrb->Format == MESA_FORMAT_Z24_S8) { + for (i = 0; i < count; i++) { + dst[i] = temp[i] & 0xff; + } + } + else { + assert(dsrb->Format == MESA_FORMAT_S8_Z24); + for (i = 0; i < count; i++) { + dst[i] = temp[i] >> 24; + } } } @@ -347,14 +449,23 @@ put_row_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count, const GLubyte *src = (const GLubyte *) values; GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x, y); ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE); - ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT); ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT); if (dst) { /* direct access */ GLuint i; - for (i = 0; i < count; i++) { - if (!mask || mask[i]) { - dst[i] = (dst[i] & 0xffffff00) | src[i]; + if (dsrb->Format == MESA_FORMAT_Z24_S8) { + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + dst[i] = (dst[i] & 0xffffff00) | src[i]; + } + } + } + else { + assert(dsrb->Format == MESA_FORMAT_S8_Z24); + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + dst[i] = (dst[i] & 0xffffff) | (src[i] << 24); + } } } } @@ -362,9 +473,19 @@ put_row_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count, /* get, modify, put */ GLuint temp[MAX_WIDTH], i; dsrb->GetRow(ctx, dsrb, count, x, y, temp); - for (i = 0; i < count; i++) { - if (!mask || mask[i]) { - temp[i] = (temp[i] & 0xffffff00) | src[i]; + if (dsrb->Format == MESA_FORMAT_Z24_S8) { + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + temp[i] = (temp[i] & 0xffffff00) | src[i]; + } + } + } + else { + assert(dsrb->Format == MESA_FORMAT_S8_Z24); + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + temp[i] = (temp[i] & 0xffffff) | (src[i] << 24); + } } } dsrb->PutRow(ctx, dsrb, count, x, y, temp, mask); @@ -379,14 +500,23 @@ put_mono_row_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count, const GLubyte val = *((GLubyte *) value); GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x, y); ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE); - ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT); ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT); if (dst) { /* direct access */ GLuint i; - for (i = 0; i < count; i++) { - if (!mask || mask[i]) { - dst[i] = (dst[i] & 0xffffff00) | val; + if (dsrb->Format == MESA_FORMAT_Z24_S8) { + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + dst[i] = (dst[i] & 0xffffff00) | val; + } + } + } + else { + assert(dsrb->Format == MESA_FORMAT_S8_Z24); + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + dst[i] = (dst[i] & 0xffffff) | (val << 24); + } } } } @@ -394,9 +524,19 @@ put_mono_row_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count, /* get, modify, put */ GLuint temp[MAX_WIDTH], i; dsrb->GetRow(ctx, dsrb, count, x, y, temp); - for (i = 0; i < count; i++) { - if (!mask || mask[i]) { - temp[i] = (temp[i] & 0xffffff00) | val; + if (dsrb->Format == MESA_FORMAT_Z24_S8) { + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + temp[i] = (temp[i] & 0xffffff00) | val; + } + } + } + else { + assert(dsrb->Format == MESA_FORMAT_S8_Z24); + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + temp[i] = (temp[i] & 0xffffff) | (val << 24); + } } } dsrb->PutRow(ctx, dsrb, count, x, y, temp, mask); @@ -411,15 +551,25 @@ put_values_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count, struct gl_renderbuffer *dsrb = s8rb->Wrapped; const GLubyte *src = (const GLubyte *) values; ASSERT(s8rb->DataType == GL_UNSIGNED_BYTE); - ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT); ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT); if (dsrb->GetPointer(ctx, dsrb, 0, 0)) { /* direct access */ GLuint i; - for (i = 0; i < count; i++) { - if (!mask || mask[i]) { - GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]); - *dst = (*dst & 0xffffff00) | src[i]; + if (dsrb->Format == MESA_FORMAT_Z24_S8) { + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]); + *dst = (*dst & 0xffffff00) | src[i]; + } + } + } + else { + assert(dsrb->Format == MESA_FORMAT_S8_Z24); + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + GLuint *dst = (GLuint *) dsrb->GetPointer(ctx, dsrb, x[i], y[i]); + *dst = (*dst & 0xffffff) | (src[i] << 24); + } } } } @@ -427,9 +577,19 @@ put_values_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count, /* get, modify, put */ GLuint temp[MAX_WIDTH], i; dsrb->GetValues(ctx, dsrb, count, x, y, temp); - for (i = 0; i < count; i++) { - if (!mask || mask[i]) { - temp[i] = (temp[i] & 0xffffff00) | src[i]; + if (dsrb->Format == MESA_FORMAT_Z24_S8) { + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + temp[i] = (temp[i] & 0xffffff00) | src[i]; + } + } + } + else { + assert(dsrb->Format == MESA_FORMAT_S8_Z24); + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + temp[i] = (temp[i] & 0xffffff) | (src[i] << 24); + } } } dsrb->PutValues(ctx, dsrb, count, x, y, temp, mask); @@ -446,9 +606,19 @@ put_mono_values_s8(GLcontext *ctx, struct gl_renderbuffer *s8rb, GLuint count, const GLubyte val = *((GLubyte *) value); /* get, modify, put */ dsrb->GetValues(ctx, dsrb, count, x, y, temp); - for (i = 0; i < count; i++) { - if (!mask || mask[i]) { - temp[i] = (temp[i] & 0xffffff) | val; + if (dsrb->Format == MESA_FORMAT_Z24_S8) { + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + temp[i] = (temp[i] & 0xffffff00) | val; + } + } + } + else { + assert(dsrb->Format == MESA_FORMAT_S8_Z24); + for (i = 0; i < count; i++) { + if (!mask || mask[i]) { + temp[i] = (temp[i] & 0xffffff) | (val << 24); + } } } dsrb->PutValues(ctx, dsrb, count, x, y, temp, mask); @@ -465,7 +635,8 @@ _mesa_new_s8_renderbuffer_wrapper(GLcontext *ctx, struct gl_renderbuffer *dsrb) { struct gl_renderbuffer *s8rb; - ASSERT(dsrb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT); + ASSERT(dsrb->Format == MESA_FORMAT_Z24_S8 || + dsrb->Format == MESA_FORMAT_S8_Z24); ASSERT(dsrb->DataType == GL_UNSIGNED_INT_24_8_EXT); s8rb = _mesa_new_renderbuffer(ctx, 0); @@ -478,10 +649,9 @@ _mesa_new_s8_renderbuffer_wrapper(GLcontext *ctx, struct gl_renderbuffer *dsrb) s8rb->Width = dsrb->Width; s8rb->Height = dsrb->Height; s8rb->InternalFormat = GL_STENCIL_INDEX8_EXT; - s8rb->_ActualFormat = GL_STENCIL_INDEX8_EXT; + s8rb->Format = MESA_FORMAT_S8; s8rb->_BaseFormat = GL_STENCIL_INDEX; s8rb->DataType = GL_UNSIGNED_BYTE; - s8rb->StencilBits = 8; s8rb->Data = NULL; s8rb->Delete = delete_wrapper; s8rb->AllocStorage = alloc_wrapper_storage; @@ -528,10 +698,10 @@ _mesa_extract_stencil(GLcontext *ctx, ASSERT(dsRb); ASSERT(stencilRb); - ASSERT(dsRb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT); + ASSERT(dsRb->Format == MESA_FORMAT_Z24_S8); ASSERT(dsRb->DataType == GL_UNSIGNED_INT_24_8_EXT); - ASSERT(stencilRb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT || - stencilRb->_ActualFormat == GL_STENCIL_INDEX8_EXT); + ASSERT(stencilRb->Format == MESA_FORMAT_Z24_S8 || + stencilRb->Format == MESA_FORMAT_S8); ASSERT(dsRb->Width == stencilRb->Width); ASSERT(dsRb->Height == stencilRb->Height); @@ -541,7 +711,7 @@ _mesa_extract_stencil(GLcontext *ctx, for (row = 0; row < height; row++) { GLuint depthStencil[MAX_WIDTH]; dsRb->GetRow(ctx, dsRb, width, 0, row, depthStencil); - if (stencilRb->_ActualFormat == GL_STENCIL_INDEX8_EXT) { + if (stencilRb->Format == MESA_FORMAT_S8) { /* 8bpp stencil */ GLubyte stencil[MAX_WIDTH]; GLuint i; @@ -553,7 +723,7 @@ _mesa_extract_stencil(GLcontext *ctx, else { /* 32bpp stencil */ /* the 24 depth bits will be ignored */ - ASSERT(stencilRb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT); + ASSERT(stencilRb->Format == MESA_FORMAT_Z24_S8); ASSERT(stencilRb->DataType == GL_UNSIGNED_INT_24_8_EXT); stencilRb->PutRow(ctx, stencilRb, width, 0, row, depthStencil, NULL); } @@ -577,10 +747,10 @@ _mesa_insert_stencil(GLcontext *ctx, ASSERT(dsRb); ASSERT(stencilRb); - ASSERT(dsRb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT); + ASSERT(dsRb->Format == MESA_FORMAT_Z24_S8); ASSERT(dsRb->DataType == GL_UNSIGNED_INT_24_8_EXT); - ASSERT(stencilRb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT || - stencilRb->_ActualFormat == GL_STENCIL_INDEX8_EXT); + ASSERT(stencilRb->Format == MESA_FORMAT_Z24_S8 || + stencilRb->Format == MESA_FORMAT_S8); ASSERT(dsRb->Width == stencilRb->Width); ASSERT(dsRb->Height == stencilRb->Height); @@ -593,7 +763,7 @@ _mesa_insert_stencil(GLcontext *ctx, dsRb->GetRow(ctx, dsRb, width, 0, row, depthStencil); - if (stencilRb->_ActualFormat == GL_STENCIL_INDEX8_EXT) { + if (stencilRb->Format == MESA_FORMAT_S8) { /* 8bpp stencil */ GLubyte stencil[MAX_WIDTH]; GLuint i; @@ -605,7 +775,7 @@ _mesa_insert_stencil(GLcontext *ctx, else { /* 32bpp stencil buffer */ GLuint stencil[MAX_WIDTH], i; - ASSERT(stencilRb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT); + ASSERT(stencilRb->Format == MESA_FORMAT_Z24_S8); ASSERT(stencilRb->DataType == GL_UNSIGNED_INT_24_8_EXT); stencilRb->GetRow(ctx, stencilRb, width, 0, row, stencil); for (i = 0; i < width; i++) { @@ -631,7 +801,7 @@ _mesa_promote_stencil(GLcontext *ctx, struct gl_renderbuffer *stencilRb) GLubyte *data; GLint i, j, k; - ASSERT(stencilRb->_ActualFormat == GL_STENCIL_INDEX8_EXT); + ASSERT(stencilRb->Format == MESA_FORMAT_S8); ASSERT(stencilRb->Data); data = (GLubyte *) stencilRb->Data; @@ -650,6 +820,4 @@ _mesa_promote_stencil(GLcontext *ctx, struct gl_renderbuffer *stencilRb) stencilRb->PutRow(ctx, stencilRb, width, 0, i, depthStencil, NULL); } _mesa_free(data); - - stencilRb->_BaseFormat = GL_DEPTH_STENCIL_EXT; } diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 6610725de8..c2b7458f57 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -48,7 +48,7 @@ /** Set this to 1 to help debug FBO incompleteness problems */ -#define DEBUG_FBO 0 +#define DEBUG_FBO 1 /** @@ -416,10 +416,9 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, } else { ASSERT(format == GL_STENCIL); - ASSERT(att->Renderbuffer->StencilBits); if (ctx->Extensions.EXT_packed_depth_stencil && ctx->Extensions.ARB_depth_texture && - att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) { + baseFormat == GL_DEPTH_STENCIL_EXT) { /* OK */ } else { @@ -431,6 +430,9 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, } } else if (att->Type == GL_RENDERBUFFER_EXT) { + const GLenum baseFormat = + _mesa_get_format_base_format(att->Renderbuffer->Format); + ASSERT(att->Renderbuffer); if (!att->Renderbuffer->InternalFormat || att->Renderbuffer->Width < 1 || @@ -440,24 +442,19 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, return; } if (format == GL_COLOR) { - if (att->Renderbuffer->_BaseFormat != GL_RGB && - att->Renderbuffer->_BaseFormat != GL_RGBA) { + if (baseFormat != GL_RGB && + baseFormat != GL_RGBA) { att_incomplete("bad renderbuffer color format"); att->Complete = GL_FALSE; return; } - ASSERT(att->Renderbuffer->RedBits); - ASSERT(att->Renderbuffer->GreenBits); - ASSERT(att->Renderbuffer->BlueBits); } else if (format == GL_DEPTH) { - if (att->Renderbuffer->_BaseFormat == GL_DEPTH_COMPONENT) { - ASSERT(att->Renderbuffer->DepthBits); + if (baseFormat == GL_DEPTH_COMPONENT) { /* OK */ } else if (ctx->Extensions.EXT_packed_depth_stencil && - att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) { - ASSERT(att->Renderbuffer->DepthBits); + baseFormat == GL_DEPTH_STENCIL_EXT) { /* OK */ } else { @@ -468,13 +465,11 @@ test_attachment_completeness(const GLcontext *ctx, GLenum format, } else { assert(format == GL_STENCIL); - if (att->Renderbuffer->_BaseFormat == GL_STENCIL_INDEX) { - ASSERT(att->Renderbuffer->StencilBits); + if (baseFormat == GL_STENCIL_INDEX) { /* OK */ } else if (ctx->Extensions.EXT_packed_depth_stencil && - att->Renderbuffer->_BaseFormat == GL_DEPTH_STENCIL_EXT) { - ASSERT(att->Renderbuffer->StencilBits); + baseFormat == GL_DEPTH_STENCIL_EXT) { /* OK */ } else { @@ -980,42 +975,27 @@ renderbuffer_storage(GLenum target, GLenum internalFormat, } /* These MUST get set by the AllocStorage func */ - rb->_ActualFormat = 0; - rb->RedBits = - rb->GreenBits = - rb->BlueBits = - rb->AlphaBits = - rb->IndexBits = - rb->DepthBits = - rb->StencilBits = 0; + rb->Format = MESA_FORMAT_NONE; rb->NumSamples = samples; /* Now allocate the storage */ ASSERT(rb->AllocStorage); if (rb->AllocStorage(ctx, rb, internalFormat, width, height)) { /* No error - check/set fields now */ - assert(rb->_ActualFormat); + assert(rb->Format != MESA_FORMAT_NONE); assert(rb->Width == (GLuint) width); assert(rb->Height == (GLuint) height); - assert(rb->RedBits || rb->GreenBits || rb->BlueBits || rb->AlphaBits || - rb->DepthBits || rb->StencilBits || rb->IndexBits); rb->InternalFormat = internalFormat; - rb->_BaseFormat = baseFormat; + rb->_BaseFormat = _mesa_base_fbo_format(ctx, internalFormat); + assert(rb->_BaseFormat != 0); } else { /* Probably ran out of memory - clear the fields */ rb->Width = 0; rb->Height = 0; + rb->Format = MESA_FORMAT_NONE; rb->InternalFormat = GL_NONE; - rb->_ActualFormat = GL_NONE; rb->_BaseFormat = GL_NONE; - rb->RedBits = - rb->GreenBits = - rb->BlueBits = - rb->AlphaBits = - rb->IndexBits = - rb->DepthBits = - rb->StencilBits = rb->NumSamples = 0; } @@ -1028,6 +1008,53 @@ renderbuffer_storage(GLenum target, GLenum internalFormat, } +/** + * Helper function for _mesa_GetRenderbufferParameterivEXT() and + * _mesa_GetFramebufferAttachmentParameterivEXT() + * We have to be careful to respect the base format. For example, if a + * renderbuffer/texture was created with internalFormat=GL_RGB but the + * driver actually chose a GL_RGBA format, when the user queries ALPHA_SIZE + * we need to return zero. + */ +static GLint +get_component_bits(GLenum pname, GLenum baseFormat, gl_format format) +{ + switch (pname) { + case GL_RENDERBUFFER_RED_SIZE_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: + case GL_RENDERBUFFER_GREEN_SIZE_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: + case GL_RENDERBUFFER_BLUE_SIZE_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: + if (baseFormat == GL_RGB || baseFormat == GL_RGBA) + return _mesa_get_format_bits(format, pname); + else + return 0; + case GL_RENDERBUFFER_ALPHA_SIZE_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: + if (baseFormat == GL_RGBA || baseFormat == GL_ALPHA) + return _mesa_get_format_bits(format, pname); + else + return 0; + case GL_RENDERBUFFER_DEPTH_SIZE_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: + if (baseFormat == GL_DEPTH_COMPONENT || baseFormat == GL_DEPTH_STENCIL) + return _mesa_get_format_bits(format, pname); + else + return 0; + case GL_RENDERBUFFER_STENCIL_SIZE_EXT: + case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: + if (baseFormat == GL_STENCIL_INDEX || baseFormat == GL_DEPTH_STENCIL) + return _mesa_get_format_bits(format, pname); + else + return 0; + default: + return 0; + } +} + + + void GLAPIENTRY _mesa_RenderbufferStorageEXT(GLenum target, GLenum internalFormat, GLsizei width, GLsizei height) @@ -1084,22 +1111,12 @@ _mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params) *params = rb->InternalFormat; return; case GL_RENDERBUFFER_RED_SIZE_EXT: - *params = rb->RedBits; - break; case GL_RENDERBUFFER_GREEN_SIZE_EXT: - *params = rb->GreenBits; - break; case GL_RENDERBUFFER_BLUE_SIZE_EXT: - *params = rb->BlueBits; - break; case GL_RENDERBUFFER_ALPHA_SIZE_EXT: - *params = rb->AlphaBits; - break; case GL_RENDERBUFFER_DEPTH_SIZE_EXT: - *params = rb->DepthBits; - break; case GL_RENDERBUFFER_STENCIL_SIZE_EXT: - *params = rb->StencilBits; + *params = get_component_bits(pname, rb->_BaseFormat, rb->Format); break; case GL_RENDERBUFFER_SAMPLES: if (ctx->Extensions.ARB_framebuffer_object) { @@ -1706,7 +1723,9 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment, if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) { /* make sure the renderbuffer is a depth/stencil format */ - if (rb->_BaseFormat != GL_DEPTH_STENCIL) { + const GLenum baseFormat = + _mesa_get_format_base_format(att->Renderbuffer->Format); + if (baseFormat != GL_DEPTH_STENCIL) { _mesa_error(ctx, GL_INVALID_OPERATION, "glFramebufferRenderbufferEXT(renderbuffer" " is not DEPTH_STENCIL format)"); @@ -1862,7 +1881,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, "glGetFramebufferAttachmentParameterivEXT(pname)"); } else { - *params = att->Renderbuffer->ColorEncoding; + *params = _mesa_get_format_color_encoding(att->Renderbuffer->Format); } return; case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: @@ -1872,61 +1891,44 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, return; } else { - *params = att->Renderbuffer->ComponentType; + gl_format format = att->Renderbuffer->Format; + if (format == MESA_FORMAT_CI8 || format == MESA_FORMAT_S8) { + /* special cases */ + *params = GL_INDEX; + } + else { + *params = _mesa_get_format_datatype(format); + } } return; case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: - if (!ctx->Extensions.ARB_framebuffer_object) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetFramebufferAttachmentParameterivEXT(pname)"); - } - else { - *params = att->Renderbuffer->RedBits; - } - return; case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: - if (!ctx->Extensions.ARB_framebuffer_object) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetFramebufferAttachmentParameterivEXT(pname)"); - } - else { - *params = att->Renderbuffer->GreenBits; - } - return; case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: - if (!ctx->Extensions.ARB_framebuffer_object) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetFramebufferAttachmentParameterivEXT(pname)"); - } - else { - *params = att->Renderbuffer->BlueBits; - } - return; case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: - if (!ctx->Extensions.ARB_framebuffer_object) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetFramebufferAttachmentParameterivEXT(pname)"); - } - else { - *params = att->Renderbuffer->AlphaBits; - } - return; case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: + case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: if (!ctx->Extensions.ARB_framebuffer_object) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetFramebufferAttachmentParameterivEXT(pname)"); } - else { - *params = att->Renderbuffer->DepthBits; + else if (att->Texture) { + const struct gl_texture_image *texImage = + _mesa_select_tex_image(ctx, att->Texture, att->Texture->Target, + att->TextureLevel); + if (texImage) { + *params = get_component_bits(pname, texImage->_BaseFormat, + texImage->TexFormat); + } + else { + *params = 0; + } } - return; - case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: - if (!ctx->Extensions.ARB_framebuffer_object) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glGetFramebufferAttachmentParameterivEXT(pname)"); + else if (att->Renderbuffer) { + *params = get_component_bits(pname, att->Renderbuffer->_BaseFormat, + att->Renderbuffer->Format); } else { - *params = att->Renderbuffer->StencilBits; + *params = 0; } return; default: @@ -2053,7 +2055,8 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, struct gl_renderbuffer *drawRb = drawFb->_StencilBuffer; if (!readRb || !drawRb || - readRb->StencilBits != drawRb->StencilBits) { + _mesa_get_format_bits(readRb->Format, GL_STENCIL_BITS) != + _mesa_get_format_bits(drawRb->Format, GL_STENCIL_BITS)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBlitFramebufferEXT(stencil buffer size mismatch"); return; @@ -2065,7 +2068,8 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, struct gl_renderbuffer *drawRb = drawFb->_DepthBuffer; if (!readRb || !drawRb || - readRb->DepthBits != drawRb->DepthBits) { + _mesa_get_format_bits(readRb->Format, GL_DEPTH_BITS) != + _mesa_get_format_bits(drawRb->Format, GL_DEPTH_BITS)) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBlitFramebufferEXT(depth buffer size mismatch"); return; @@ -2093,7 +2097,7 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, /* color formats must match */ if (colorReadRb && colorDrawRb && - colorReadRb->_ActualFormat != colorDrawRb->_ActualFormat) { + colorReadRb->Format != colorDrawRb->Format) { _mesa_error(ctx, GL_INVALID_OPERATION, "glBlitFramebufferEXT(bad src/dst multisample pixel formats"); return; diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index dc79b8ca61..154dedacd5 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -35,6 +35,7 @@ #include "buffers.h" #include "context.h" #include "depthstencil.h" +#include "formats.h" #include "macros.h" #include "mtypes.h" #include "fbobject.h" @@ -281,7 +282,6 @@ _mesa_resize_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb, struct gl_renderbuffer *rb = att->Renderbuffer; /* only resize if size is changing */ if (rb->Width != width || rb->Height != height) { - /* could just as well pass rb->_ActualFormat here */ if (rb->AllocStorage(ctx, rb, rb->InternalFormat, width, height)) { ASSERT(rb->Width == width); ASSERT(rb->Height == height); @@ -523,19 +523,22 @@ _mesa_update_framebuffer_visual(struct gl_framebuffer *fb) for (i = 0; i < BUFFER_COUNT; i++) { if (fb->Attachment[i].Renderbuffer) { const struct gl_renderbuffer *rb = fb->Attachment[i].Renderbuffer; - if (rb->_BaseFormat == GL_RGBA || rb->_BaseFormat == GL_RGB) { - fb->Visual.redBits = rb->RedBits; - fb->Visual.greenBits = rb->GreenBits; - fb->Visual.blueBits = rb->BlueBits; - fb->Visual.alphaBits = rb->AlphaBits; + const GLenum baseFormat = _mesa_get_format_base_format(rb->Format); + const gl_format fmt = rb->Format; + + if (baseFormat == GL_RGBA || baseFormat == GL_RGB) { + fb->Visual.redBits = _mesa_get_format_bits(fmt, GL_RED_BITS); + fb->Visual.greenBits = _mesa_get_format_bits(fmt, GL_GREEN_BITS); + fb->Visual.blueBits = _mesa_get_format_bits(fmt, GL_BLUE_BITS); + fb->Visual.alphaBits = _mesa_get_format_bits(fmt, GL_ALPHA_BITS); fb->Visual.rgbBits = fb->Visual.redBits + fb->Visual.greenBits + fb->Visual.blueBits; fb->Visual.floatMode = GL_FALSE; fb->Visual.samples = rb->NumSamples; break; } - else if (rb->_BaseFormat == GL_COLOR_INDEX) { - fb->Visual.indexBits = rb->IndexBits; + else if (baseFormat == GL_COLOR_INDEX) { + fb->Visual.indexBits = _mesa_get_format_bits(fmt, GL_INDEX_BITS); fb->Visual.rgbMode = GL_FALSE; break; } @@ -543,27 +546,30 @@ _mesa_update_framebuffer_visual(struct gl_framebuffer *fb) } if (fb->Attachment[BUFFER_DEPTH].Renderbuffer) { + const struct gl_renderbuffer *rb = + fb->Attachment[BUFFER_DEPTH].Renderbuffer; + const gl_format fmt = rb->Format; fb->Visual.haveDepthBuffer = GL_TRUE; - fb->Visual.depthBits - = fb->Attachment[BUFFER_DEPTH].Renderbuffer->DepthBits; + fb->Visual.depthBits = _mesa_get_format_bits(fmt, GL_DEPTH_BITS); } if (fb->Attachment[BUFFER_STENCIL].Renderbuffer) { + const struct gl_renderbuffer *rb = + fb->Attachment[BUFFER_STENCIL].Renderbuffer; + const gl_format fmt = rb->Format; fb->Visual.haveStencilBuffer = GL_TRUE; - fb->Visual.stencilBits - = fb->Attachment[BUFFER_STENCIL].Renderbuffer->StencilBits; + fb->Visual.stencilBits = _mesa_get_format_bits(fmt, GL_STENCIL_BITS); } if (fb->Attachment[BUFFER_ACCUM].Renderbuffer) { + const struct gl_renderbuffer *rb = + fb->Attachment[BUFFER_ACCUM].Renderbuffer; + const gl_format fmt = rb->Format; fb->Visual.haveAccumBuffer = GL_TRUE; - fb->Visual.accumRedBits - = fb->Attachment[BUFFER_ACCUM].Renderbuffer->RedBits; - fb->Visual.accumGreenBits - = fb->Attachment[BUFFER_ACCUM].Renderbuffer->GreenBits; - fb->Visual.accumBlueBits - = fb->Attachment[BUFFER_ACCUM].Renderbuffer->BlueBits; - fb->Visual.accumAlphaBits - = fb->Attachment[BUFFER_ACCUM].Renderbuffer->AlphaBits; + fb->Visual.accumRedBits = _mesa_get_format_bits(fmt, GL_RED_BITS); + fb->Visual.accumGreenBits = _mesa_get_format_bits(fmt, GL_GREEN_BITS); + fb->Visual.accumBlueBits = _mesa_get_format_bits(fmt, GL_BLUE_BITS); + fb->Visual.accumAlphaBits = _mesa_get_format_bits(fmt, GL_ALPHA_BITS); } compute_depth_max(fb); @@ -592,11 +598,11 @@ _mesa_update_depth_buffer(GLcontext *ctx, depthRb = fb->Attachment[attIndex].Renderbuffer; - if (depthRb && depthRb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT) { + if (depthRb && depthRb->_BaseFormat == GL_DEPTH_STENCIL) { /* The attached depth buffer is a GL_DEPTH_STENCIL renderbuffer */ if (!fb->_DepthBuffer || fb->_DepthBuffer->Wrapped != depthRb - || fb->_DepthBuffer->_BaseFormat != GL_DEPTH_COMPONENT) { + || _mesa_get_format_base_format(fb->_DepthBuffer->Format) != GL_DEPTH_COMPONENT) { /* need to update wrapper */ struct gl_renderbuffer *wrapper = _mesa_new_z24_renderbuffer_wrapper(ctx, depthRb); @@ -633,11 +639,11 @@ _mesa_update_stencil_buffer(GLcontext *ctx, stencilRb = fb->Attachment[attIndex].Renderbuffer; - if (stencilRb && stencilRb->_ActualFormat == GL_DEPTH24_STENCIL8_EXT) { + if (stencilRb && stencilRb->_BaseFormat == GL_DEPTH_STENCIL) { /* The attached stencil buffer is a GL_DEPTH_STENCIL renderbuffer */ if (!fb->_StencilBuffer || fb->_StencilBuffer->Wrapped != stencilRb - || fb->_StencilBuffer->_BaseFormat != GL_STENCIL_INDEX) { + || _mesa_get_format_base_format(fb->_StencilBuffer->Format) != GL_STENCIL_INDEX) { /* need to update wrapper */ struct gl_renderbuffer *wrapper = _mesa_new_s8_renderbuffer_wrapper(ctx, stencilRb); @@ -854,30 +860,32 @@ _mesa_source_buffer_exists(GLcontext *ctx, GLenum format) if (ctx->ReadBuffer->_ColorReadBuffer == NULL) { return GL_FALSE; } - ASSERT(ctx->ReadBuffer->_ColorReadBuffer->RedBits > 0 || - ctx->ReadBuffer->_ColorReadBuffer->IndexBits > 0); + ASSERT(_mesa_get_format_bits(ctx->ReadBuffer->_ColorReadBuffer->Format, GL_RED_BITS) > 0 || + _mesa_get_format_bits(ctx->ReadBuffer->_ColorReadBuffer->Format, GL_INDEX_BITS) > 0); break; case GL_DEPTH: case GL_DEPTH_COMPONENT: if (!att[BUFFER_DEPTH].Renderbuffer) { return GL_FALSE; } - ASSERT(att[BUFFER_DEPTH].Renderbuffer->DepthBits > 0); + /*ASSERT(att[BUFFER_DEPTH].Renderbuffer->DepthBits > 0);*/ break; case GL_STENCIL: case GL_STENCIL_INDEX: if (!att[BUFFER_STENCIL].Renderbuffer) { return GL_FALSE; } - ASSERT(att[BUFFER_STENCIL].Renderbuffer->StencilBits > 0); + /*ASSERT(att[BUFFER_STENCIL].Renderbuffer->StencilBits > 0);*/ break; case GL_DEPTH_STENCIL_EXT: if (!att[BUFFER_DEPTH].Renderbuffer || !att[BUFFER_STENCIL].Renderbuffer) { return GL_FALSE; } + /* ASSERT(att[BUFFER_DEPTH].Renderbuffer->DepthBits > 0); ASSERT(att[BUFFER_STENCIL].Renderbuffer->StencilBits > 0); + */ break; default: _mesa_problem(ctx, @@ -932,22 +940,24 @@ _mesa_dest_buffer_exists(GLcontext *ctx, GLenum format) if (!att[BUFFER_DEPTH].Renderbuffer) { return GL_FALSE; } - ASSERT(att[BUFFER_DEPTH].Renderbuffer->DepthBits > 0); + /*ASSERT(att[BUFFER_DEPTH].Renderbuffer->DepthBits > 0);*/ break; case GL_STENCIL: case GL_STENCIL_INDEX: if (!att[BUFFER_STENCIL].Renderbuffer) { return GL_FALSE; } - ASSERT(att[BUFFER_STENCIL].Renderbuffer->StencilBits > 0); + /*ASSERT(att[BUFFER_STENCIL].Renderbuffer->StencilBits > 0);*/ break; case GL_DEPTH_STENCIL_EXT: if (!att[BUFFER_DEPTH].Renderbuffer || !att[BUFFER_STENCIL].Renderbuffer) { return GL_FALSE; } + /* ASSERT(att[BUFFER_DEPTH].Renderbuffer->DepthBits > 0); ASSERT(att[BUFFER_STENCIL].Renderbuffer->StencilBits > 0); + */ break; default: _mesa_problem(ctx, diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 8e6e0d09be..5bbb12ea70 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2089,19 +2089,9 @@ struct gl_renderbuffer GLint RefCount; GLuint Width, Height; GLenum InternalFormat; /**< The user-specified format */ - GLenum _ActualFormat; /**< The driver-chosen format */ GLenum _BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_DEPTH_COMPONENT or GL_STENCIL_INDEX. */ - GLenum ColorEncoding; /**< GL_LINEAR or GL_SRGB */ - GLenum ComponentType; /**< GL_FLOAT, GL_INT, GL_UNSIGNED_INT, - GL_UNSIGNED_NORMALIZED or GL_INDEX */ - GLubyte RedBits; /**< Bits of red per pixel */ - GLubyte GreenBits; - GLubyte BlueBits; - GLubyte AlphaBits; - GLubyte IndexBits; - GLubyte DepthBits; - GLubyte StencilBits; + GLuint Format; /**< The actual format: MESA_FORMAT_x */ GLubyte NumSamples; GLenum DataType; /**< Type of values passed to the Get/Put functions */ diff --git a/src/mesa/main/rbadaptors.c b/src/mesa/main/rbadaptors.c index c1ac0606c8..1060c5796e 100644 --- a/src/mesa/main/rbadaptors.c +++ b/src/mesa/main/rbadaptors.c @@ -218,14 +218,10 @@ _mesa_new_renderbuffer_16wrap8(GLcontext *ctx, struct gl_renderbuffer *rb8) _glthread_UNLOCK_MUTEX(rb8->Mutex); rb16->InternalFormat = rb8->InternalFormat; - rb16->_ActualFormat = rb8->_ActualFormat; + rb16->Format = rb8->Format; /* XXX is this right? */ rb16->_BaseFormat = rb8->_BaseFormat; rb16->DataType = GL_UNSIGNED_SHORT; /* Note: passing through underlying bits/channel */ - rb16->RedBits = rb8->RedBits; - rb16->GreenBits = rb8->GreenBits; - rb16->BlueBits = rb8->BlueBits; - rb16->AlphaBits = rb8->AlphaBits; rb16->Wrapped = rb8; rb16->AllocStorage = AllocStorage_wrapper; @@ -385,14 +381,10 @@ _mesa_new_renderbuffer_32wrap8(GLcontext *ctx, struct gl_renderbuffer *rb8) _glthread_UNLOCK_MUTEX(rb8->Mutex); rb32->InternalFormat = rb8->InternalFormat; - rb32->_ActualFormat = rb8->_ActualFormat; + rb32->Format = rb8->Format; /* XXX is this right? */ rb32->_BaseFormat = rb8->_BaseFormat; rb32->DataType = GL_FLOAT; /* Note: passing through underlying bits/channel */ - rb32->RedBits = rb8->RedBits; - rb32->GreenBits = rb8->GreenBits; - rb32->BlueBits = rb8->BlueBits; - rb32->AlphaBits = rb8->AlphaBits; rb32->Wrapped = rb8; rb32->AllocStorage = AllocStorage_wrapper; @@ -552,14 +544,10 @@ _mesa_new_renderbuffer_32wrap16(GLcontext *ctx, struct gl_renderbuffer *rb16) _glthread_UNLOCK_MUTEX(rb16->Mutex); rb32->InternalFormat = rb16->InternalFormat; - rb32->_ActualFormat = rb16->_ActualFormat; + rb32->Format = rb16->Format; /* XXX is this right? */ rb32->_BaseFormat = rb16->_BaseFormat; rb32->DataType = GL_FLOAT; /* Note: passing through underlying bits/channel */ - rb32->RedBits = rb16->RedBits; - rb32->GreenBits = rb16->GreenBits; - rb32->BlueBits = rb16->BlueBits; - rb32->AlphaBits = rb16->AlphaBits; rb32->Wrapped = rb16; rb32->AllocStorage = AllocStorage_wrapper; diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index 38be8266e0..409fd8634a 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -43,6 +43,8 @@ #include "glheader.h" #include "imports.h" #include "context.h" +#include "fbobject.h" +#include "formats.h" #include "mtypes.h" #include "fbobject.h" #include "renderbuffer.h" @@ -72,7 +74,7 @@ get_pointer_ubyte(GLcontext *ctx, struct gl_renderbuffer *rb, if (!rb->Data) return NULL; ASSERT(rb->DataType == GL_UNSIGNED_BYTE); - /* Can't assert _ActualFormat since these funcs may be used for serveral + /* Can't assert rb->Format since these funcs may be used for serveral * different formats (GL_ALPHA8, GL_STENCIL_INDEX8, etc). */ return (GLubyte *) rb->Data + y * rb->Width + x; @@ -448,7 +450,7 @@ static void * get_pointer_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLint x, GLint y) { - ASSERT(rb->_ActualFormat == GL_RGB8); + ASSERT(rb->Format == MESA_FORMAT_RGB888); /* No direct access since this buffer is RGB but caller will be * treating it as if it were RGBA. */ @@ -463,7 +465,7 @@ get_row_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLubyte *src = (const GLubyte *) rb->Data + 3 * (y * rb->Width + x); GLubyte *dst = (GLubyte *) values; GLuint i; - ASSERT(rb->_ActualFormat == GL_RGB8); + ASSERT(rb->Format == MESA_FORMAT_RGB888); ASSERT(rb->DataType == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) { dst[i * 4 + 0] = src[i * 3 + 0]; @@ -480,7 +482,7 @@ get_values_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, { GLubyte *dst = (GLubyte *) values; GLuint i; - ASSERT(rb->_ActualFormat == GL_RGB8); + ASSERT(rb->Format == MESA_FORMAT_RGB888); ASSERT(rb->DataType == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) { const GLubyte *src @@ -501,7 +503,7 @@ put_row_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLubyte *src = (const GLubyte *) values; GLubyte *dst = (GLubyte *) rb->Data + 3 * (y * rb->Width + x); GLuint i; - ASSERT(rb->_ActualFormat == GL_RGB8); + ASSERT(rb->Format == MESA_FORMAT_RGB888); ASSERT(rb->DataType == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) { if (!mask || mask[i]) { @@ -521,7 +523,7 @@ put_row_rgb_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLubyte *src = (const GLubyte *) values; GLubyte *dst = (GLubyte *) rb->Data + 3 * (y * rb->Width + x); GLuint i; - ASSERT(rb->_ActualFormat == GL_RGB8); + ASSERT(rb->Format == MESA_FORMAT_RGB888); ASSERT(rb->DataType == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) { if (!mask || mask[i]) { @@ -542,7 +544,7 @@ put_mono_row_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLubyte val1 = ((const GLubyte *) value)[1]; const GLubyte val2 = ((const GLubyte *) value)[2]; GLubyte *dst = (GLubyte *) rb->Data + 3 * (y * rb->Width + x); - ASSERT(rb->_ActualFormat == GL_RGB8); + ASSERT(rb->Format == MESA_FORMAT_RGB888); ASSERT(rb->DataType == GL_UNSIGNED_BYTE); if (!mask && val0 == val1 && val1 == val2) { /* optimized case */ @@ -569,7 +571,7 @@ put_values_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, /* note: incoming values are RGB+A! */ const GLubyte *src = (const GLubyte *) values; GLuint i; - ASSERT(rb->_ActualFormat == GL_RGB8); + ASSERT(rb->Format == MESA_FORMAT_RGB888); ASSERT(rb->DataType == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) { if (!mask || mask[i]) { @@ -592,7 +594,7 @@ put_mono_values_ubyte3(GLcontext *ctx, struct gl_renderbuffer *rb, const GLubyte val1 = ((const GLubyte *) value)[1]; const GLubyte val2 = ((const GLubyte *) value)[2]; GLuint i; - ASSERT(rb->_ActualFormat == GL_RGB8); + ASSERT(rb->Format == MESA_FORMAT_RGB888); ASSERT(rb->DataType == GL_UNSIGNED_BYTE); for (i = 0; i < count; i++) { if (!mask || mask[i]) { @@ -617,7 +619,7 @@ get_pointer_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, if (!rb->Data) return NULL; ASSERT(rb->DataType == GL_UNSIGNED_BYTE); - ASSERT(rb->_ActualFormat == GL_RGBA8); + ASSERT(rb->Format == MESA_FORMAT_RGBA8888); return (GLubyte *) rb->Data + 4 * (y * rb->Width + x); } @@ -628,7 +630,7 @@ get_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, { const GLubyte *src = (const GLubyte *) rb->Data + 4 * (y * rb->Width + x); ASSERT(rb->DataType == GL_UNSIGNED_BYTE); - ASSERT(rb->_ActualFormat == GL_RGBA8); + ASSERT(rb->Format == MESA_FORMAT_RGBA8888); _mesa_memcpy(values, src, 4 * count * sizeof(GLubyte)); } @@ -641,7 +643,7 @@ get_values_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLuint *dst = (GLuint *) values; GLuint i; ASSERT(rb->DataType == GL_UNSIGNED_BYTE); - ASSERT(rb->_ActualFormat == GL_RGBA8); + ASSERT(rb->Format == MESA_FORMAT_RGBA8888); for (i = 0; i < count; i++) { const GLuint *src = (GLuint *) rb->Data + (y[i] * rb->Width + x[i]); dst[i] = *src; @@ -657,7 +659,7 @@ put_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLuint *src = (const GLuint *) values; GLuint *dst = (GLuint *) rb->Data + (y * rb->Width + x); ASSERT(rb->DataType == GL_UNSIGNED_BYTE); - ASSERT(rb->_ActualFormat == GL_RGBA8); + ASSERT(rb->Format == MESA_FORMAT_RGBA8888); if (mask) { GLuint i; for (i = 0; i < count; i++) { @@ -681,7 +683,7 @@ put_row_rgb_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, GLubyte *dst = (GLubyte *) rb->Data + 4 * (y * rb->Width + x); GLuint i; ASSERT(rb->DataType == GL_UNSIGNED_BYTE); - ASSERT(rb->_ActualFormat == GL_RGBA8); + ASSERT(rb->Format == MESA_FORMAT_RGBA8888); for (i = 0; i < count; i++) { if (!mask || mask[i]) { dst[i * 4 + 0] = src[i * 3 + 0]; @@ -701,7 +703,7 @@ put_mono_row_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLuint val = *((const GLuint *) value); GLuint *dst = (GLuint *) rb->Data + (y * rb->Width + x); ASSERT(rb->DataType == GL_UNSIGNED_BYTE); - ASSERT(rb->_ActualFormat == GL_RGBA8); + ASSERT(rb->Format == MESA_FORMAT_RGBA8888); if (!mask && val == 0) { /* common case */ _mesa_bzero(dst, count * 4 * sizeof(GLubyte)); @@ -735,7 +737,7 @@ put_values_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, GLuint count, const GLuint *src = (const GLuint *) values; GLuint i; ASSERT(rb->DataType == GL_UNSIGNED_BYTE); - ASSERT(rb->_ActualFormat == GL_RGBA8); + ASSERT(rb->Format == MESA_FORMAT_RGBA8888); for (i = 0; i < count; i++) { if (!mask || mask[i]) { GLuint *dst = (GLuint *) rb->Data + (y[i] * rb->Width + x[i]); @@ -754,7 +756,7 @@ put_mono_values_ubyte4(GLcontext *ctx, struct gl_renderbuffer *rb, const GLuint val = *((const GLuint *) value); GLuint i; ASSERT(rb->DataType == GL_UNSIGNED_BYTE); - ASSERT(rb->_ActualFormat == GL_RGBA8); + ASSERT(rb->Format == MESA_FORMAT_RGBA8888); for (i = 0; i < count; i++) { if (!mask || mask[i]) { GLuint *dst = (GLuint *) rb->Data + (y[i] * rb->Width + x[i]); @@ -947,15 +949,6 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, { GLuint pixelSize; - /* first clear these fields */ - rb->RedBits = - rb->GreenBits = - rb->BlueBits = - rb->AlphaBits = - rb->IndexBits = - rb->DepthBits = - rb->StencilBits = 0; - switch (internalFormat) { case GL_RGB: case GL_R3_G3_B2: @@ -965,8 +958,7 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, case GL_RGB10: case GL_RGB12: case GL_RGB16: - rb->_ActualFormat = GL_RGB8; - rb->_BaseFormat = GL_RGB; + rb->Format = MESA_FORMAT_RGB888; rb->DataType = GL_UNSIGNED_BYTE; rb->GetPointer = get_pointer_ubyte3; rb->GetRow = get_row_ubyte3; @@ -976,10 +968,6 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_ubyte3; rb->PutValues = put_values_ubyte3; rb->PutMonoValues = put_mono_values_ubyte3; - rb->RedBits = 8 * sizeof(GLubyte); - rb->GreenBits = 8 * sizeof(GLubyte); - rb->BlueBits = 8 * sizeof(GLubyte); - rb->AlphaBits = 0; pixelSize = 3 * sizeof(GLubyte); break; case GL_RGBA: @@ -987,8 +975,11 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, case GL_RGBA4: case GL_RGB5_A1: case GL_RGBA8: - rb->_ActualFormat = GL_RGBA8; - rb->_BaseFormat = GL_RGBA; +#if 1 + case GL_RGB10_A2: + case GL_RGBA12: +#endif + rb->Format = MESA_FORMAT_RGBA8888; rb->DataType = GL_UNSIGNED_BYTE; rb->GetPointer = get_pointer_ubyte4; rb->GetRow = get_row_ubyte4; @@ -998,18 +989,12 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_ubyte4; rb->PutValues = put_values_ubyte4; rb->PutMonoValues = put_mono_values_ubyte4; - rb->RedBits = 8 * sizeof(GLubyte); - rb->GreenBits = 8 * sizeof(GLubyte); - rb->BlueBits = 8 * sizeof(GLubyte); - rb->AlphaBits = 8 * sizeof(GLubyte); pixelSize = 4 * sizeof(GLubyte); break; - case GL_RGB10_A2: - case GL_RGBA12: case GL_RGBA16: - rb->_ActualFormat = GL_RGBA16; - rb->_BaseFormat = GL_RGBA; - rb->DataType = GL_UNSIGNED_SHORT; + /* for accum buffer */ + rb->Format = MESA_FORMAT_SIGNED_RGBA_16; + rb->DataType = GL_SHORT; rb->GetPointer = get_pointer_ushort4; rb->GetRow = get_row_ushort4; rb->GetValues = get_values_ushort4; @@ -1018,16 +1003,11 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_ushort4; rb->PutValues = put_values_ushort4; rb->PutMonoValues = put_mono_values_ushort4; - rb->RedBits = 8 * sizeof(GLushort); - rb->GreenBits = 8 * sizeof(GLushort); - rb->BlueBits = 8 * sizeof(GLushort); - rb->AlphaBits = 8 * sizeof(GLushort); pixelSize = 4 * sizeof(GLushort); break; -#if 00 +#if 0 case GL_ALPHA8: - rb->_ActualFormat = GL_ALPHA8; - rb->_BaseFormat = GL_RGBA; /* Yes, not GL_ALPHA! */ + rb->Format = MESA_FORMAT_A8; rb->DataType = GL_UNSIGNED_BYTE; rb->GetPointer = get_pointer_alpha8; rb->GetRow = get_row_alpha8; @@ -1037,10 +1017,6 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_alpha8; rb->PutValues = put_values_alpha8; rb->PutMonoValues = put_mono_values_alpha8; - rb->RedBits = 0; /*red*/ - rb->GreenBits = 0; /*green*/ - rb->BlueBits = 0; /*blue*/ - rb->AlphaBits = 8 * sizeof(GLubyte); pixelSize = sizeof(GLubyte); break; #endif @@ -1048,8 +1024,8 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, case GL_STENCIL_INDEX1_EXT: case GL_STENCIL_INDEX4_EXT: case GL_STENCIL_INDEX8_EXT: - rb->_ActualFormat = GL_STENCIL_INDEX8_EXT; - rb->_BaseFormat = GL_STENCIL_INDEX; + case GL_STENCIL_INDEX16_EXT: + rb->Format = MESA_FORMAT_S8; rb->DataType = GL_UNSIGNED_BYTE; rb->GetPointer = get_pointer_ubyte; rb->GetRow = get_row_ubyte; @@ -1059,28 +1035,11 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_ubyte; rb->PutValues = put_values_ubyte; rb->PutMonoValues = put_mono_values_ubyte; - rb->StencilBits = 8 * sizeof(GLubyte); pixelSize = sizeof(GLubyte); break; - case GL_STENCIL_INDEX16_EXT: - rb->_ActualFormat = GL_STENCIL_INDEX16_EXT; - rb->_BaseFormat = GL_STENCIL_INDEX; - rb->DataType = GL_UNSIGNED_SHORT; - rb->GetPointer = get_pointer_ushort; - rb->GetRow = get_row_ushort; - rb->GetValues = get_values_ushort; - rb->PutRow = put_row_ushort; - rb->PutRowRGB = NULL; - rb->PutMonoRow = put_mono_row_ushort; - rb->PutValues = put_values_ushort; - rb->PutMonoValues = put_mono_values_ushort; - rb->StencilBits = 8 * sizeof(GLushort); - pixelSize = sizeof(GLushort); - break; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT16: - rb->_ActualFormat = GL_DEPTH_COMPONENT16; - rb->_BaseFormat = GL_DEPTH_COMPONENT; + rb->Format = MESA_FORMAT_Z16; rb->DataType = GL_UNSIGNED_SHORT; rb->GetPointer = get_pointer_ushort; rb->GetRow = get_row_ushort; @@ -1090,12 +1049,10 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_ushort; rb->PutValues = put_values_ushort; rb->PutMonoValues = put_mono_values_ushort; - rb->DepthBits = 8 * sizeof(GLushort); pixelSize = sizeof(GLushort); break; case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT32: - rb->_BaseFormat = GL_DEPTH_COMPONENT; rb->DataType = GL_UNSIGNED_INT; rb->GetPointer = get_pointer_uint; rb->GetRow = get_row_uint; @@ -1105,20 +1062,12 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_uint; rb->PutValues = put_values_uint; rb->PutMonoValues = put_mono_values_uint; - if (internalFormat == GL_DEPTH_COMPONENT24) { - rb->_ActualFormat = GL_DEPTH_COMPONENT24; - rb->DepthBits = 24; - } - else { - rb->_ActualFormat = GL_DEPTH_COMPONENT32; - rb->DepthBits = 32; - } + rb->Format = MESA_FORMAT_Z32; pixelSize = sizeof(GLuint); break; case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: - rb->_ActualFormat = GL_DEPTH24_STENCIL8_EXT; - rb->_BaseFormat = GL_DEPTH_STENCIL_EXT; + rb->Format = MESA_FORMAT_Z24_S8; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; rb->GetPointer = get_pointer_uint; rb->GetRow = get_row_uint; @@ -1128,13 +1077,12 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_uint; rb->PutValues = put_values_uint; rb->PutMonoValues = put_mono_values_uint; - rb->DepthBits = 24; - rb->StencilBits = 8; pixelSize = sizeof(GLuint); break; case GL_COLOR_INDEX8_EXT: - rb->_ActualFormat = GL_COLOR_INDEX8_EXT; - rb->_BaseFormat = GL_COLOR_INDEX; + case GL_COLOR_INDEX16_EXT: + case COLOR_INDEX32: + rb->Format = MESA_FORMAT_CI8; rb->DataType = GL_UNSIGNED_BYTE; rb->GetPointer = get_pointer_ubyte; rb->GetRow = get_row_ubyte; @@ -1144,39 +1092,8 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->PutMonoRow = put_mono_row_ubyte; rb->PutValues = put_values_ubyte; rb->PutMonoValues = put_mono_values_ubyte; - rb->IndexBits = 8 * sizeof(GLubyte); pixelSize = sizeof(GLubyte); break; - case GL_COLOR_INDEX16_EXT: - rb->_ActualFormat = GL_COLOR_INDEX16_EXT; - rb->_BaseFormat = GL_COLOR_INDEX; - rb->DataType = GL_UNSIGNED_SHORT; - rb->GetPointer = get_pointer_ushort; - rb->GetRow = get_row_ushort; - rb->GetValues = get_values_ushort; - rb->PutRow = put_row_ushort; - rb->PutRowRGB = NULL; - rb->PutMonoRow = put_mono_row_ushort; - rb->PutValues = put_values_ushort; - rb->PutMonoValues = put_mono_values_ushort; - rb->IndexBits = 8 * sizeof(GLushort); - pixelSize = sizeof(GLushort); - break; - case COLOR_INDEX32: - rb->_ActualFormat = COLOR_INDEX32; - rb->_BaseFormat = GL_COLOR_INDEX; - rb->DataType = GL_UNSIGNED_INT; - rb->GetPointer = get_pointer_uint; - rb->GetRow = get_row_uint; - rb->GetValues = get_values_uint; - rb->PutRow = put_row_uint; - rb->PutRowRGB = NULL; - rb->PutMonoRow = put_mono_row_uint; - rb->PutValues = put_values_uint; - rb->PutMonoValues = put_mono_values_uint; - rb->IndexBits = 8 * sizeof(GLuint); - pixelSize = sizeof(GLuint); - break; default: _mesa_problem(ctx, "Bad internalFormat in _mesa_soft_renderbuffer_storage"); return GL_FALSE; @@ -1213,6 +1130,7 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, rb->Width = width; rb->Height = height; + rb->_BaseFormat = _mesa_base_fbo_format(ctx, rb->InternalFormat); return GL_TRUE; } @@ -1239,7 +1157,7 @@ alloc_storage_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, GLenum internalFormat, GLuint width, GLuint height) { ASSERT(arb != arb->Wrapped); - ASSERT(arb->_ActualFormat == GL_ALPHA8); + ASSERT(arb->Format == MESA_FORMAT_A8); /* first, pass the call to the wrapped RGB buffer */ if (!arb->Wrapped->AllocStorage(ctx, arb->Wrapped, internalFormat, @@ -1439,8 +1357,8 @@ put_mono_values_alpha8(GLcontext *ctx, struct gl_renderbuffer *arb, static void copy_buffer_alpha8(struct gl_renderbuffer* dst, struct gl_renderbuffer* src) { - ASSERT(dst->_ActualFormat == GL_ALPHA8); - ASSERT(src->_ActualFormat == GL_ALPHA8); + ASSERT(dst->Format == MESA_FORMAT_A8); + ASSERT(src->Format == MESA_FORMAT_A8); ASSERT(dst->Width == src->Width); ASSERT(dst->Height == src->Height); @@ -1486,16 +1404,7 @@ _mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name) rb->Width = 0; rb->Height = 0; rb->InternalFormat = GL_NONE; - rb->_ActualFormat = GL_NONE; - rb->_BaseFormat = GL_NONE; - - rb->ComponentType = GL_UNSIGNED_NORMALIZED; /* ARB_fbo */ - rb->ColorEncoding = GL_LINEAR; /* ARB_fbo */ - - rb->RedBits = rb->GreenBits = rb->BlueBits = rb->AlphaBits = 0; - rb->IndexBits = 0; - rb->DepthBits = 0; - rb->StencilBits = 0; + rb->Format = MESA_FORMAT_NONE; rb->DataType = GL_NONE; rb->Data = NULL; @@ -1612,18 +1521,15 @@ _mesa_add_color_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, if (rgbBits <= 8) { if (alphaBits) - rb->_ActualFormat = GL_RGBA8; + rb->Format = MESA_FORMAT_RGBA8888; else - rb->_ActualFormat = GL_RGB8; + rb->Format = MESA_FORMAT_RGB888; } else { assert(rgbBits <= 16); - if (alphaBits) - rb->_ActualFormat = GL_RGBA16; - else - rb->_ActualFormat = GL_RGBA16; /* don't really have RGB16 yet */ + rb->Format = MESA_FORMAT_NONE; /*XXX RGBA16;*/ } - rb->InternalFormat = rb->_ActualFormat; + rb->InternalFormat = GL_RGBA; rb->AllocStorage = _mesa_soft_renderbuffer_storage; _mesa_add_renderbuffer(fb, b, rb); @@ -1677,15 +1583,9 @@ _mesa_add_color_index_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, return GL_FALSE; } - if (indexBits <= 8) { - /* only support GLuint for now */ - /*rb->InternalFormat = GL_COLOR_INDEX8_EXT;*/ - rb->_ActualFormat = COLOR_INDEX32; - } - else { - rb->_ActualFormat = COLOR_INDEX32; - } - rb->InternalFormat = rb->_ActualFormat; + assert(indexBits <= 8); + rb->Format = MESA_FORMAT_CI8; + rb->InternalFormat = GL_COLOR_INDEX; rb->AllocStorage = _mesa_soft_renderbuffer_storage; _mesa_add_renderbuffer(fb, b, rb); @@ -1758,8 +1658,7 @@ _mesa_add_alpha_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, * values. */ arb->InternalFormat = arb->Wrapped->InternalFormat; - arb->_ActualFormat = GL_ALPHA8; - arb->_BaseFormat = arb->Wrapped->_BaseFormat; + arb->Format = MESA_FORMAT_A8; arb->DataType = arb->Wrapped->DataType; arb->AllocStorage = alloc_storage_alpha8; arb->Delete = delete_renderbuffer_alpha8; @@ -1833,15 +1732,13 @@ _mesa_add_depth_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, } if (depthBits <= 16) { - rb->_ActualFormat = GL_DEPTH_COMPONENT16; - } - else if (depthBits <= 24) { - rb->_ActualFormat = GL_DEPTH_COMPONENT24; + rb->Format = MESA_FORMAT_Z16; + rb->InternalFormat = GL_DEPTH_COMPONENT16; } else { - rb->_ActualFormat = GL_DEPTH_COMPONENT32; + rb->Format = MESA_FORMAT_Z32; + rb->InternalFormat = GL_DEPTH_COMPONENT32; } - rb->InternalFormat = rb->_ActualFormat; rb->AllocStorage = _mesa_soft_renderbuffer_storage; _mesa_add_renderbuffer(fb, BUFFER_DEPTH, rb); @@ -1878,14 +1775,9 @@ _mesa_add_stencil_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, return GL_FALSE; } - if (stencilBits <= 8) { - rb->_ActualFormat = GL_STENCIL_INDEX8_EXT; - } - else { - /* not really supported (see s_stencil.c code) */ - rb->_ActualFormat = GL_STENCIL_INDEX16_EXT; - } - rb->InternalFormat = rb->_ActualFormat; + assert(stencilBits <= 8); + rb->Format = MESA_FORMAT_S8; + rb->InternalFormat = GL_STENCIL_INDEX8; rb->AllocStorage = _mesa_soft_renderbuffer_storage; _mesa_add_renderbuffer(fb, BUFFER_STENCIL, rb); @@ -1923,7 +1815,7 @@ _mesa_add_accum_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, return GL_FALSE; } - rb->_ActualFormat = GL_RGBA16; + rb->Format = MESA_FORMAT_SIGNED_RGBA_16; rb->InternalFormat = GL_RGBA16; rb->AllocStorage = _mesa_soft_renderbuffer_storage; _mesa_add_renderbuffer(fb, BUFFER_ACCUM, rb); @@ -1967,13 +1859,9 @@ _mesa_add_aux_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, return GL_FALSE; } - if (colorBits <= 8) { - rb->_ActualFormat = GL_RGBA8; - } - else { - rb->_ActualFormat = GL_RGBA16; - } - rb->InternalFormat = rb->_ActualFormat; + assert (colorBits <= 8); + rb->Format = MESA_FORMAT_RGBA8888; + rb->InternalFormat = GL_RGBA; rb->AllocStorage = _mesa_soft_renderbuffer_storage; _mesa_add_renderbuffer(fb, BUFFER_AUX0 + i, rb); @@ -2071,6 +1959,8 @@ void _mesa_add_renderbuffer(struct gl_framebuffer *fb, GLuint bufferName, struct gl_renderbuffer *rb) { + GLenum baseFormat; + assert(fb); assert(rb); assert(bufferName < BUFFER_COUNT); @@ -2095,7 +1985,8 @@ _mesa_add_renderbuffer(struct gl_framebuffer *fb, * and the device driver is expecting 8-bit values (GLubyte), we can * use a "renderbuffer adaptor/wrapper" to do the necessary conversions. */ - if (rb->_BaseFormat == GL_RGBA) { + baseFormat = _mesa_get_format_base_format(rb->Format); + if (baseFormat == GL_RGBA) { if (CHAN_BITS == 16 && rb->DataType == GL_UNSIGNED_BYTE) { GET_CURRENT_CONTEXT(ctx); rb = _mesa_new_renderbuffer_16wrap8(ctx, rb); @@ -2202,7 +2093,7 @@ _mesa_new_depthstencil_renderbuffer(GLcontext *ctx, GLuint name) /* init fields not covered by _mesa_new_renderbuffer() */ dsrb->InternalFormat = GL_DEPTH24_STENCIL8_EXT; - dsrb->_ActualFormat = GL_DEPTH24_STENCIL8_EXT; + dsrb->Format = MESA_FORMAT_Z24_S8; dsrb->AllocStorage = _mesa_soft_renderbuffer_storage; return dsrb; diff --git a/src/mesa/main/texrender.c b/src/mesa/main/texrender.c index c8b532acbb..e2432be6ca 100644 --- a/src/mesa/main/texrender.c +++ b/src/mesa/main/texrender.c @@ -497,30 +497,23 @@ update_wrapper(GLcontext *ctx, const struct gl_renderbuffer_attachment *att) trb->Base.InternalFormat = trb->TexImage->InternalFormat; /* XXX may need more special cases here */ if (trb->TexImage->TexFormat == MESA_FORMAT_Z24_S8) { - trb->Base._ActualFormat = GL_DEPTH24_STENCIL8_EXT; + trb->Base.Format = MESA_FORMAT_Z24_S8; trb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT; } else if (trb->TexImage->TexFormat == MESA_FORMAT_Z16) { - trb->Base._ActualFormat = GL_DEPTH_COMPONENT; + trb->Base.Format = MESA_FORMAT_Z16; trb->Base.DataType = GL_UNSIGNED_SHORT; } else if (trb->TexImage->TexFormat == MESA_FORMAT_Z32) { - trb->Base._ActualFormat = GL_DEPTH_COMPONENT; + trb->Base.Format = MESA_FORMAT_Z32; trb->Base.DataType = GL_UNSIGNED_INT; } else { - trb->Base._ActualFormat = trb->TexImage->InternalFormat; + trb->Base.Format = trb->TexImage->TexFormat; trb->Base.DataType = CHAN_TYPE; } - trb->Base._BaseFormat = trb->TexImage->_BaseFormat; trb->Base.Data = trb->TexImage->Data; - - trb->Base.RedBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_RED_SIZE); - trb->Base.GreenBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_GREEN_SIZE); - trb->Base.BlueBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_BLUE_SIZE); - trb->Base.AlphaBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_ALPHA_SIZE); - trb->Base.DepthBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_DEPTH_SIZE_ARB); - trb->Base.StencilBits = _mesa_get_format_bits(texFormat, GL_TEXTURE_STENCIL_SIZE_EXT); + trb->Base._BaseFormat = _mesa_base_fbo_format(ctx, trb->Base.InternalFormat); } diff --git a/src/mesa/state_tracker/st_cb_clear.c b/src/mesa/state_tracker/st_cb_clear.c index 8a8c99f7e1..f015b12368 100644 --- a/src/mesa/state_tracker/st_cb_clear.c +++ b/src/mesa/state_tracker/st_cb_clear.c @@ -34,6 +34,7 @@ */ #include "main/glheader.h" +#include "main/formats.h" #include "main/macros.h" #include "shader/prog_instruction.h" #include "st_context.h" @@ -300,10 +301,14 @@ 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 GLuint stencilMax = (1 << rb->StencilBits) - 1; + const GLuint stencilMax = 0xff; GLboolean maskStencil = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax; + assert(rb->Format == MESA_FORMAT_S8 || + rb->Format == MESA_FORMAT_Z24_S8 || + rb->Format == MESA_FORMAT_S8_Z24); + if (ctx->Scissor.Enabled && (ctx->Scissor.X != 0 || ctx->Scissor.Y != 0 || @@ -350,10 +355,14 @@ check_clear_stencil_with_quad(GLcontext *ctx, struct gl_renderbuffer *rb) { const struct st_renderbuffer *strb = st_renderbuffer(rb); const GLboolean isDS = pf_is_depth_and_stencil(strb->surface->format); - const GLuint stencilMax = (1 << rb->StencilBits) - 1; + const GLuint stencilMax = 0xff; const GLboolean maskStencil = (ctx->Stencil.WriteMask[0] & stencilMax) != stencilMax; + assert(rb->Format == MESA_FORMAT_S8 || + rb->Format == MESA_FORMAT_Z24_S8 || + rb->Format == MESA_FORMAT_S8_Z24); + if (maskStencil) return TRUE; diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index fe0a121493..7899d745aa 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -64,13 +64,7 @@ init_renderbuffer_bits(struct st_renderbuffer *strb, assert( 0 ); } - strb->Base._ActualFormat = info.base_format; - strb->Base.RedBits = info.red_bits; - strb->Base.GreenBits = info.green_bits; - strb->Base.BlueBits = info.blue_bits; - strb->Base.AlphaBits = info.alpha_bits; - strb->Base.DepthBits = info.depth_bits; - strb->Base.StencilBits = info.stencil_bits; + strb->Base.Format = info.mesa_format; strb->Base.DataType = st_format_datatype(pipeFormat); return info.size; @@ -270,30 +264,24 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw) case PIPE_FORMAT_A4R4G4B4_UNORM: case PIPE_FORMAT_R5G6B5_UNORM: strb->Base.InternalFormat = GL_RGBA; - strb->Base._BaseFormat = GL_RGBA; break; case PIPE_FORMAT_Z16_UNORM: strb->Base.InternalFormat = GL_DEPTH_COMPONENT16; - strb->Base._BaseFormat = GL_DEPTH_COMPONENT; break; case PIPE_FORMAT_Z32_UNORM: strb->Base.InternalFormat = GL_DEPTH_COMPONENT32; - strb->Base._BaseFormat = GL_DEPTH_COMPONENT; break; case PIPE_FORMAT_S8Z24_UNORM: case PIPE_FORMAT_Z24S8_UNORM: case PIPE_FORMAT_X8Z24_UNORM: case PIPE_FORMAT_Z24X8_UNORM: strb->Base.InternalFormat = GL_DEPTH24_STENCIL8_EXT; - strb->Base._BaseFormat = GL_DEPTH_STENCIL_EXT; break; case PIPE_FORMAT_S8_UNORM: strb->Base.InternalFormat = GL_STENCIL_INDEX8_EXT; - strb->Base._BaseFormat = GL_STENCIL_INDEX; break; case PIPE_FORMAT_R16G16B16A16_SNORM: strb->Base.InternalFormat = GL_RGBA16; - strb->Base._BaseFormat = GL_RGBA; break; default: _mesa_problem(NULL, diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index dc3ab61425..01b8e5fd77 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -31,6 +31,7 @@ #include "main/convolve.h" #endif #include "main/enums.h" +#include "main/formats.h" #include "main/image.h" #include "main/imports.h" #include "main/macros.h" @@ -1397,8 +1398,8 @@ static unsigned compatible_src_dst_formats(const struct gl_renderbuffer *src, const struct gl_texture_image *dst) { - const GLenum srcFormat = src->_BaseFormat; - const GLenum dstLogicalFormat = dst->_BaseFormat; + const GLenum srcFormat = _mesa_get_format_base_format(src->Format); + const GLenum dstLogicalFormat = _mesa_get_format_base_format(dst->TexFormat); if (srcFormat == dstLogicalFormat) { /* This is the same as matching_base_formats, which should @@ -1524,7 +1525,9 @@ st_copy_texsubimage(GLcontext *ctx, * framebuffer's alpha values). We can't do that with the blit or * textured-quad paths. */ - matching_base_formats = (strb->Base._BaseFormat == texImage->_BaseFormat); + matching_base_formats = + (_mesa_get_format_base_format(strb->Base.Format) == + _mesa_get_format_base_format(texImage->TexFormat)); format_writemask = compatible_src_dst_formats(&strb->Base, texImage); if (ctx->_ImageTransferState == 0x0) { diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 6f76e2d8c0..aa71b91ec8 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -99,10 +99,11 @@ st_get_format_info(enum pipe_format format, struct pipe_format_info *pinfo) if (format == PIPE_FORMAT_A1R5G5B5_UNORM || format == PIPE_FORMAT_R5G6B5_UNORM) { pinfo->datatype = GL_UNSIGNED_SHORT; } + else if (format == PIPE_FORMAT_S8Z24_UNORM) { + pinfo->datatype = GL_UNSIGNED_INT_24_8; + } else { - GLuint size; - - size = format_max_bits( info ); + const GLuint size = format_max_bits( info ); if (size == 8) { if (pf_type(info) == PIPE_FORMAT_TYPE_UNORM) pinfo->datatype = GL_UNSIGNED_BYTE; @@ -150,24 +151,10 @@ st_get_format_info(enum pipe_format format, struct pipe_format_info *pinfo) pinfo->red_bits = 0; } - /* Base format */ - if (pinfo->depth_bits) { - if (pinfo->stencil_bits) { - pinfo->base_format = GL_DEPTH_STENCIL_EXT; - } - else { - pinfo->base_format = GL_DEPTH_COMPONENT; - } - } - else if (pinfo->stencil_bits) { - pinfo->base_format = GL_STENCIL_INDEX; - } - else { - pinfo->base_format = GL_RGBA; - } + pinfo->mesa_format = st_pipe_format_to_mesa_format(format); } else if (pf_layout(format) == PIPE_FORMAT_LAYOUT_YCBCR) { - pinfo->base_format = GL_YCBCR_MESA; + pinfo->mesa_format = MESA_FORMAT_YCBCR; pinfo->datatype = GL_UNSIGNED_SHORT; pinfo->size = 2; /* two bytes per "texel" */ } @@ -224,7 +211,7 @@ st_format_datatype(enum pipe_format format) enum pipe_format -st_mesa_format_to_pipe_format(GLuint mesaFormat) +st_mesa_format_to_pipe_format(gl_format mesaFormat) { switch (mesaFormat) { /* fix this */ @@ -293,6 +280,82 @@ st_mesa_format_to_pipe_format(GLuint mesaFormat) } } + +gl_format +st_pipe_format_to_mesa_format(enum pipe_format pipeFormat) +{ + switch (pipeFormat) { + case PIPE_FORMAT_A8R8G8B8_UNORM: + return MESA_FORMAT_ARGB8888; + case PIPE_FORMAT_A1R5G5B5_UNORM: + return MESA_FORMAT_ARGB1555; + case PIPE_FORMAT_A4R4G4B4_UNORM: + return MESA_FORMAT_ARGB4444; + case PIPE_FORMAT_R5G6B5_UNORM: + return MESA_FORMAT_RGB565; + case PIPE_FORMAT_A8L8_UNORM: + return MESA_FORMAT_AL88; + case PIPE_FORMAT_A8_UNORM: + return MESA_FORMAT_A8; + case PIPE_FORMAT_L8_UNORM: + return MESA_FORMAT_L8; + case PIPE_FORMAT_I8_UNORM: + return MESA_FORMAT_I8; + case PIPE_FORMAT_Z16_UNORM: + return MESA_FORMAT_Z16; + case PIPE_FORMAT_Z32_UNORM: + return MESA_FORMAT_Z32; + case PIPE_FORMAT_Z24S8_UNORM: + return MESA_FORMAT_Z24_S8; + case PIPE_FORMAT_S8Z24_UNORM: + return MESA_FORMAT_S8_Z24; + case PIPE_FORMAT_S8_UNORM: + return MESA_FORMAT_S8; + + case PIPE_FORMAT_YCBCR: + return MESA_FORMAT_YCBCR; + case PIPE_FORMAT_R16G16B16A16_SNORM: + return MESA_FORMAT_SIGNED_RGBA_16; + +#if FEATURE_texture_s3tc + case PIPE_FORMAT_DXT1_RGB: + return MESA_FORMAT_RGB_DXT1; + case PIPE_FORMAT_DXT1_RGBA: + return MESA_FORMAT_RGBA_DXT1; + case PIPE_FORMAT_DXT3_RGBA: + return MESA_FORMAT_RGBA_DXT3; + case PIPE_FORMAT_DXT5_RGBA: + return MESA_FORMAT_RGBA_DXT5; +#if FEATURE_EXT_texture_sRGB + case PIPE_FORMAT_DXT1_SRGB: + return MESA_FORMAT_SRGB_DXT1; + case PIPE_FORMAT_DXT1_SRGBA: + return MESA_FORMAT_SRGBA_DXT1; + case PIPE_FORMAT_DXT3_SRGBA: + return MESA_FORMAT_SRGBA_DXT3; + case PIPE_FORMAT_DXT5_SRGBA: + return MESA_FORMAT_SRGBA_DXT5; +#endif +#endif +#if FEATURE_EXT_texture_sRGB + case PIPE_FORMAT_A8L8_SRGB: + return MESA_FORMAT_SLA8; + case PIPE_FORMAT_L8_SRGB: + return MESA_FORMAT_SL8; + case PIPE_FORMAT_R8G8B8_SRGB: + return MESA_FORMAT_SRGB8; + case PIPE_FORMAT_R8G8B8A8_SRGB: + return MESA_FORMAT_SRGBA8; + case PIPE_FORMAT_A8R8G8B8_SRGB: + return MESA_FORMAT_SARGB8; +#endif + default: + assert(0); + return 0; + } +} + + /** * Find an RGBA format supported by the context/winsys. */ diff --git a/src/mesa/state_tracker/st_format.h b/src/mesa/state_tracker/st_format.h index 1a8c6ea98f..97422bb199 100644 --- a/src/mesa/state_tracker/st_format.h +++ b/src/mesa/state_tracker/st_format.h @@ -34,7 +34,7 @@ struct pipe_format_info { enum pipe_format format; - GLenum base_format; + gl_format mesa_format; GLenum datatype; GLubyte red_bits; GLubyte green_bits; @@ -61,7 +61,10 @@ st_format_datatype(enum pipe_format format); extern enum pipe_format -st_mesa_format_to_pipe_format(GLuint mesaFormat); +st_mesa_format_to_pipe_format(gl_format mesaFormat); + +extern gl_format +st_pipe_format_to_mesa_format(enum pipe_format pipeFormat); extern enum pipe_format diff --git a/src/mesa/swrast/s_clear.c b/src/mesa/swrast/s_clear.c index 35080fd394..002718ded8 100644 --- a/src/mesa/swrast/s_clear.c +++ b/src/mesa/swrast/s_clear.c @@ -24,6 +24,7 @@ #include "main/glheader.h" #include "main/colormac.h" +#include "main/formats.h" #include "main/macros.h" #include "main/imports.h" #include "main/mtypes.h" @@ -211,9 +212,6 @@ clear_ci_buffer(GLcontext *ctx, struct gl_renderbuffer *rb) ASSERT(!ctx->Visual.rgbMode); - ASSERT((ctx->Color.IndexMask & ((1 << rb->IndexBits) - 1)) - == (GLuint) ((1 << rb->IndexBits) - 1)); - ASSERT(rb->PutMonoRow); /* setup clear value */ @@ -264,8 +262,8 @@ clear_color_buffers(GLcontext *ctx) } else { struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; - const GLuint indexBits = (1 << rb->IndexBits) - 1; - if ((ctx->Color.IndexMask & indexBits) == indexBits) { + const GLuint indexMask = (1 << _mesa_get_format_bits(rb->Format, GL_INDEX_BITS)) - 1; + if ((ctx->Color.IndexMask & indexMask) == indexMask) { masking = GL_FALSE; } else { diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c index 1a428fb1a2..8073a61197 100644 --- a/src/mesa/swrast/s_depth.c +++ b/src/mesa/swrast/s_depth.c @@ -25,6 +25,7 @@ #include "main/glheader.h" #include "main/context.h" +#include "main/formats.h" #include "main/macros.h" #include "main/imports.h" #include "main/fbobject.h" @@ -1298,11 +1299,15 @@ void _swrast_read_depth_span_uint( GLcontext *ctx, struct gl_renderbuffer *rb, GLint n, GLint x, GLint y, GLuint depth[] ) { + GLuint depthBits; + if (!rb) { /* really only doing this to prevent FP exceptions later */ _mesa_bzero(depth, n * sizeof(GLfloat)); } + depthBits = _mesa_get_format_bits(rb->Format, GL_DEPTH_BITS); + ASSERT(rb->_BaseFormat == GL_DEPTH_COMPONENT); if (y < 0 || y >= (GLint) rb->Height || @@ -1334,8 +1339,8 @@ _swrast_read_depth_span_uint( GLcontext *ctx, struct gl_renderbuffer *rb, if (rb->DataType == GL_UNSIGNED_INT) { rb->GetRow(ctx, rb, n, x, y, depth); - if (rb->DepthBits < 32) { - GLuint shift = 32 - rb->DepthBits; + if (depthBits < 32) { + GLuint shift = 32 - depthBits; GLint i; for (i = 0; i < n; i++) { GLuint z = depth[i]; @@ -1347,14 +1352,14 @@ _swrast_read_depth_span_uint( GLcontext *ctx, struct gl_renderbuffer *rb, GLushort temp[MAX_WIDTH]; GLint i; rb->GetRow(ctx, rb, n, x, y, temp); - if (rb->DepthBits == 16) { + if (depthBits == 16) { for (i = 0; i < n; i++) { GLuint z = temp[i]; depth[i] = (z << 16) | z; } } else { - GLuint shift = 16 - rb->DepthBits; + GLuint shift = 16 - depthBits; for (i = 0; i < n; i++) { GLuint z = temp[i]; depth[i] = (z << (shift + 16)) | (z << shift); /* XXX lsb bits? */ diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index f28f2c9307..005d7a4c82 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -891,7 +891,7 @@ fast_persp_span(GLcontext *ctx, SWspan *span, return; \ } #define RENDER_SPAN( span ) \ - if (rb->DepthBits <= 16) { \ + if (rb->Format == MESA_FORMAT_Z16) { \ GLuint i; \ const GLushort *zRow = (const GLushort *) \ rb->GetPointer(ctx, rb, span.x, span.y); \ -- cgit v1.2.3 From ce64e063a8b32d842a3b5dfe62178e9e4cd89f9c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 9 Oct 2009 13:22:00 -0600 Subject: mesa: fix incorrect assertion in _mesa_add_aux_renderbuffers() Fixes bug 24426. --- src/mesa/main/renderbuffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index 38be8266e0..5bef7c84fb 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -1955,7 +1955,7 @@ _mesa_add_aux_renderbuffers(GLcontext *ctx, struct gl_framebuffer *fb, return GL_FALSE; } - assert(numBuffers < MAX_AUX_BUFFERS); + assert(numBuffers <= MAX_AUX_BUFFERS); for (i = 0; i < numBuffers; i++) { struct gl_renderbuffer *rb = _mesa_new_renderbuffer(ctx, 0); -- cgit v1.2.3 From 6164f1fe790def9f3ca4f1f555ef59bbaa82db90 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 9 Oct 2009 13:20:28 -0600 Subject: st/mesa: create aux buffers according to visual Fixes bug 24426 for gallium. --- src/mesa/state_tracker/st_framebuffer.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/mesa/state_tracker/st_framebuffer.c b/src/mesa/state_tracker/st_framebuffer.c index 5c0d335d62..a5d1ae3b03 100644 --- a/src/mesa/state_tracker/st_framebuffer.c +++ b/src/mesa/state_tracker/st_framebuffer.c @@ -52,6 +52,7 @@ st_create_framebuffer( const __GLcontextModes *visual, struct st_framebuffer *stfb = ST_CALLOC_STRUCT(st_framebuffer); if (stfb) { int samples = st_get_msaa(); + int i; if (visual->sampleBuffers) samples = visual->samples; @@ -119,6 +120,12 @@ st_create_framebuffer( const __GLcontextModes *visual, _mesa_add_renderbuffer(&stfb->Base, BUFFER_ACCUM, accumRb); } + for (i = 0; i < visual->numAuxBuffers; i++) { + struct gl_renderbuffer *aux + = st_new_renderbuffer_fb(colorFormat, 0, FALSE); + _mesa_add_renderbuffer(&stfb->Base, BUFFER_AUX0 + i, aux); + } + stfb->Base.Initialized = GL_TRUE; stfb->InitWidth = width; stfb->InitHeight = height; -- cgit v1.2.3 From 194ede4bf97547ce8a61587ede0b0a5054955783 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Fri, 9 Oct 2009 15:44:32 -0400 Subject: radeon: fix scissor regression fixes fdo bug 24248 --- src/mesa/drivers/dri/r600/r700_state.c | 10 +++++++--- src/mesa/drivers/dri/radeon/radeon_common.c | 9 ++++----- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index 124469b5a6..98f116d0a6 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -1269,11 +1269,15 @@ void r700SetScissor(context_t *context) //--------------- return; } if (context->radeon.state.scissor.enabled) { - /* r600 has exclusive scissors */ x1 = context->radeon.state.scissor.rect.x1; y1 = context->radeon.state.scissor.rect.y1; - x2 = context->radeon.state.scissor.rect.x2 + 1; - y2 = context->radeon.state.scissor.rect.y2 + 1; + x2 = context->radeon.state.scissor.rect.x2; + y2 = context->radeon.state.scissor.rect.y2; + /* r600 has exclusive BR scissors */ + if (context->radeon.radeonScreen->kernel_mm) { + x2++; + y2++; + } } else { if (context->radeon.radeonScreen->driScreen->dri2.enabled) { x1 = 0; diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index 9817ff856b..8032cbcd69 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -229,16 +229,15 @@ void radeonUpdateScissor( GLcontext *ctx ) } if (!rmesa->radeonScreen->kernel_mm) { /* Fix scissors for dri 1 */ - __DRIdrawablePrivate *dPriv = radeon_get_drawable(rmesa); x1 += dPriv->x; - x2 += dPriv->x; + x2 += dPriv->x + 1; min_x += dPriv->x; - max_x += dPriv->x; + max_x += dPriv->x + 1; y1 += dPriv->y; - y2 += dPriv->y; + y2 += dPriv->y + 1; min_y += dPriv->y; - max_y += dPriv->y; + max_y += dPriv->y + 1; } rmesa->state.scissor.rect.x1 = CLAMP(x1, min_x, max_x); -- cgit v1.2.3 From a74e53ddba246b1f6604c6120b63a923fd9c60d5 Mon Sep 17 00:00:00 2001 From: Cooper Yuan Date: Sat, 10 Oct 2009 14:41:44 +0800 Subject: r300g: add video surface create and destroy functions --- src/gallium/drivers/r300/r300_texture.c | 52 +++++++++++++++++++++++++++++++++ src/gallium/drivers/r300/r300_texture.h | 14 ++++++++- 2 files changed, 65 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index ce60ded7ca..7ea4c33fa9 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -215,6 +215,55 @@ static struct pipe_texture* return (struct pipe_texture*)tex; } +static struct pipe_video_surface * +r300_video_surface_create(struct pipe_screen *screen, + enum pipe_video_chroma_format chroma_format, + unsigned width, unsigned height) +{ + struct r300_video_surface *r300_vsfc; + struct pipe_texture template; + + assert(screen); + assert(width && height); + + r300_vsfc = CALLOC_STRUCT(r300_video_surface); + if (!r300_vsfc) + return NULL; + + pipe_reference_init(&r300_vsfc->base.reference, 1); + r300_vsfc->base.screen = screen; + r300_vsfc->base.chroma_format = chroma_format; + r300_vsfc->base.width = width; + r300_vsfc->base.height = height; + + memset(&template, 0, sizeof(struct pipe_texture)); + template.target = PIPE_TEXTURE_2D; + template.format = PIPE_FORMAT_X8R8G8B8_UNORM; + template.last_level = 0; + template.width[0] = util_next_power_of_two(width); + template.height[0] = util_next_power_of_two(height); + template.depth[0] = 1; + pf_get_block(template.format, &template.block); + template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | + PIPE_TEXTURE_USAGE_RENDER_TARGET; + + r300_vsfc->tex = screen->texture_create(screen, &template); + if (!r300_vsfc->tex) + { + FREE(r300_vsfc); + return NULL; + } + + return &r300_vsfc->base; +} + +static void r300_video_surface_destroy(struct pipe_video_surface *vsfc) +{ + struct r300_video_surface *r300_vsfc = r300_video_surface(vsfc); + pipe_texture_reference(&r300_vsfc->tex, NULL); + FREE(r300_vsfc); +} + void r300_init_screen_texture_functions(struct pipe_screen* screen) { screen->texture_create = r300_texture_create; @@ -222,6 +271,9 @@ void r300_init_screen_texture_functions(struct pipe_screen* screen) screen->get_tex_surface = r300_get_tex_surface; screen->tex_surface_destroy = r300_tex_surface_destroy; screen->texture_blanket = r300_texture_blanket; + + screen->video_surface_create = r300_video_surface_create; + screen->video_surface_destroy= r300_video_surface_destroy; } boolean r300_get_texture_buffer(struct pipe_texture* texture, diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h index bd87790bc3..e5182d31b4 100644 --- a/src/gallium/drivers/r300/r300_texture.h +++ b/src/gallium/drivers/r300/r300_texture.h @@ -24,7 +24,7 @@ #define R300_TEXTURE_H #include "pipe/p_screen.h" - +#include "pipe/p_video_state.h" #include "util/u_math.h" #include "r300_context.h" @@ -91,6 +91,18 @@ static INLINE uint32_t r300_translate_texformat(enum pipe_format format) return 0; } +struct r300_video_surface +{ + struct pipe_video_surface base; + struct pipe_texture *tex; +}; + +static INLINE struct r300_video_surface * +r300_video_surface(struct pipe_video_surface *pvs) +{ + return (struct r300_video_surface *)pvs; +} + #ifndef R300_WINSYS_H boolean r300_get_texture_buffer(struct pipe_texture* texture, -- cgit v1.2.3 From 768481ed40cb7530fdbadbf4d6dc00b74209adf1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 10 Oct 2009 09:18:14 -0600 Subject: softpipe: revert 564df9dc5f6335eb8dc68f3c69cf054d2142663c This change silenced valgrind warnings but broke progs/tests/drawbuffers. The problem is we don't know the surface's state when we start caching it (it may or may not be initialized/cleared/etc). So "clearing" it here was presumptuous. Leaving the code in place (but disabled) for reference and when using valgrind. Fixes bug 24401 --- src/gallium/drivers/softpipe/sp_tile_cache.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index 5f7864e671..b2195ec6b5 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -131,7 +131,12 @@ sp_create_tile_cache( struct pipe_screen *screen ) tc->entries[pos].y = -1; } -#if TILE_CLEAR_OPTIMIZATION + /* XXX this code prevents valgrind warnings about use of uninitialized + * memory in programs that don't clear the surface before rendering. + * However, it breaks clearing in other situations (such as in + * progs/tests/drawbuffers, see bug 24402). + */ +#if 0 && TILE_CLEAR_OPTIMIZATION /* set flags to indicate all the tiles are cleared */ memset(tc->clear_flags, 255, sizeof(tc->clear_flags)); #endif -- cgit v1.2.3 From 39daa763b59cc80d862709e99ee3619bd0f7a14d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 10 Oct 2009 09:12:00 -0600 Subject: softpipe: fix multi-drawbuffers regression This is part of the fix for bug 24401. --- src/gallium/drivers/softpipe/sp_quad_blend.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c index e243c63fa2..0ad0b98654 100644 --- a/src/gallium/drivers/softpipe/sp_quad_blend.c +++ b/src/gallium/drivers/softpipe/sp_quad_blend.c @@ -946,15 +946,15 @@ choose_blend_quad(struct quad_stage *qs, qs->run = blend_noop; } else if (!softpipe->blend->logicop_enable && - softpipe->blend->colormask == 0xf) + softpipe->blend->colormask == 0xf && + softpipe->framebuffer.nr_cbufs == 1) { if (!blend->blend_enable) { qs->run = single_output_color; } else if (blend->rgb_src_factor == blend->alpha_src_factor && blend->rgb_dst_factor == blend->alpha_dst_factor && - blend->rgb_func == blend->alpha_func && - softpipe->framebuffer.nr_cbufs == 1) + blend->rgb_func == blend->alpha_func) { if (blend->alpha_func == PIPE_BLEND_ADD) { if (blend->rgb_src_factor == PIPE_BLENDFACTOR_ONE && -- cgit v1.2.3 From 3611d01a44d5d3cd2c132e685836b1ea9c8b9922 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sun, 11 Oct 2009 19:12:24 +1000 Subject: r300g: fix blending default state + alpha separate. this makes the default state same as r300 --- src/gallium/drivers/r300/r300_state.c | 41 +++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 88cb9af6fb..3cef285dee 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -46,23 +46,46 @@ static void* r300_create_blend_state(struct pipe_context* pipe, { struct r300_blend_state* blend = CALLOC_STRUCT(r300_blend_state); + { + unsigned eqRGB = state->rgb_func; + unsigned srcRGB = state->rgb_src_factor; + unsigned dstRGB = state->rgb_dst_factor; + + unsigned eqA = state->alpha_func; + unsigned srcA = state->alpha_src_factor; + unsigned dstA = state->alpha_dst_factor; + + if (srcA != srcRGB || + dstA != dstRGB || + eqA != eqRGB) { + blend->alpha_blend_control = + r300_translate_blend_function(eqA) | + (r300_translate_blend_factor(srcA) << + R300_SRC_BLEND_SHIFT) | + (r300_translate_blend_factor(dstA) << + R300_DST_BLEND_SHIFT); + blend->blend_control |= R300_ALPHA_BLEND_ENABLE | + R300_SEPARATE_ALPHA_ENABLE; + } else { + blend->alpha_blend_control = R300_COMB_FCN_ADD_CLAMP | + (R300_BLEND_GL_ONE << R300_SRC_BLEND_SHIFT) | + (R300_BLEND_GL_ZERO << R300_DST_BLEND_SHIFT); + } + } if (state->blend_enable) { /* XXX for now, always do separate alpha... * is it faster to do it with one reg? */ - blend->blend_control = R300_ALPHA_BLEND_ENABLE | - R300_SEPARATE_ALPHA_ENABLE | - R300_READ_ENABLE | + blend->blend_control |= R300_READ_ENABLE | r300_translate_blend_function(state->rgb_func) | (r300_translate_blend_factor(state->rgb_src_factor) << R300_SRC_BLEND_SHIFT) | (r300_translate_blend_factor(state->rgb_dst_factor) << R300_DST_BLEND_SHIFT); - blend->alpha_blend_control = - r300_translate_blend_function(state->alpha_func) | - (r300_translate_blend_factor(state->alpha_src_factor) << - R300_SRC_BLEND_SHIFT) | - (r300_translate_blend_factor(state->alpha_dst_factor) << - R300_DST_BLEND_SHIFT); + } else { + blend->blend_control = + R300_COMB_FCN_ADD_CLAMP | + (R300_BLEND_GL_ONE << R300_SRC_BLEND_SHIFT) | + (R300_BLEND_GL_ZERO << R300_DST_BLEND_SHIFT); } /* PIPE_LOGICOP_* don't need to be translated, fortunately. */ -- cgit v1.2.3 From f096cc7dc1cdae1698eb7a340cd8c7f5ea0b1166 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= Date: Sun, 11 Oct 2009 12:40:07 +0200 Subject: r300g: Fix fragment program constants upload on R300 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Nicolai Hähnle --- src/gallium/drivers/r300/r300_emit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 77ce431cdc..570b4c5ef7 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -212,7 +212,7 @@ void r300_emit_fragment_program_code(struct r300_context* r300, } if (constants->Count) { - OUT_CS_ONE_REG(R300_PFS_PARAM_0_X, constants->Count * 4); + OUT_CS_REG_SEQ(R300_PFS_PARAM_0_X, constants->Count * 4); for(i = 0; i < constants->Count; ++i) { const float * data = get_shader_constant(r300, &constants->Constants[i], externals); OUT_CS(pack_float24(data[0])); -- cgit v1.2.3 From a82da7fa263c7fb6b902285994136890e6dc3278 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 11 Oct 2009 11:04:09 -0700 Subject: i965: Fix the bounds emitted in the vertex buffer packets. It's the address of the last valid byte, not the address of the first invalid byte. This should also fix problems with rendering with the new sanity checks in the kernel. --- src/mesa/drivers/dri/i965/brw_draw_upload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 4aa17fa02d..5c33246749 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -539,12 +539,12 @@ static void brw_emit_vertices(struct brw_context *brw) if (input->stride) { OUT_RELOC(input->bo, I915_GEM_DOMAIN_VERTEX, 0, - input->offset + input->stride * input->count); + input->offset + input->stride * input->count - 1); } else { assert(input->count == 1); OUT_RELOC(input->bo, I915_GEM_DOMAIN_VERTEX, 0, - input->offset + input->element_size); + input->offset + input->element_size - 1); } } else OUT_BATCH(input->stride ? input->count : 0); -- cgit v1.2.3 From f3be27c0cf8a4c47230f31d9d66bde7340ffb204 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sun, 11 Oct 2009 11:16:03 -0700 Subject: i965: Fix the last valid address setting for the index buffer. Again, last valid address, not first invalid address. Fixes regression in 255e5be265133280293bbfd8b2f9b74b2dec50bb that the kernel now catches and caused piglit draw_elements_base_vertex to fail. --- src/mesa/drivers/dri/i965/brw_draw_upload.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 5c33246749..9d089e113e 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -726,7 +726,7 @@ static void brw_emit_index_buffer(struct brw_context *brw) brw->ib.offset); OUT_RELOC(brw->ib.bo, I915_GEM_DOMAIN_VERTEX, 0, - brw->ib.offset + brw->ib.size); + brw->ib.offset + brw->ib.size - 1); OUT_BATCH( 0 ); ADVANCE_BATCH(); } -- cgit v1.2.3 From 4969d014e5d55985119874c8db7cb98154185802 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 30 Sep 2009 21:22:48 -0400 Subject: st/xorg: implement basics of xv --- src/gallium/state_trackers/xorg/Makefile | 1 + src/gallium/state_trackers/xorg/xorg_crtc.c | 4 +- src/gallium/state_trackers/xorg/xorg_driver.c | 2 + src/gallium/state_trackers/xorg/xorg_xv.c | 65 +++++++++++++++++++++++++-- 4 files changed, 66 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/Makefile b/src/gallium/state_trackers/xorg/Makefile index 27a1990724..030bac5fff 100644 --- a/src/gallium/state_trackers/xorg/Makefile +++ b/src/gallium/state_trackers/xorg/Makefile @@ -5,6 +5,7 @@ LIBNAME = xorgtracker LIBRARY_INCLUDES = \ -DHAVE_CONFIG_H \ + -DHAVE_XEXTPROTO_71=1 \ $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \ -I$(TOP)/src/gallium/include \ -I$(TOP)/src/gallium/auxiliary \ diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index 67fe29a69d..95973586da 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -43,10 +43,10 @@ #include "xf86Modes.h" #ifdef HAVE_XEXTPROTO_71 -#include +#include "X11/extensions/dpmsconst.h" #else #define DPMS_SERVER -#include +#include "X11/extensions/dpmsconst.h" #endif #include "pipe/p_inlines.h" diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 4bc87aa613..ab6c3d7558 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -560,6 +560,8 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) ms->exa = xorg_exa_init(pScrn); ms->debug_fallback = debug_get_bool_option("XORG_DEBUG_FALLBACK", TRUE); + xorg_init_video(pScreen); + miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); xf86SetSilkenMouse(pScreen); diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index 88955d47fd..27d52700ec 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -40,26 +40,54 @@ static XF86ImageRec Images[NUM_IMAGES] = { struct xorg_xv_port_priv { RegionRec clip; + + int brightness; + int contrast; }; static void stop_video(ScrnInfoPtr pScrn, pointer data, Bool shutdown) { + struct xorg_xv_port_priv *priv = (struct xorg_xv_port_priv *)data; + + REGION_EMPTY(pScrn->pScreen, &priv->clip); } static int set_port_attribute(ScrnInfoPtr pScrn, Atom attribute, INT32 value, pointer data) { - return 0; + struct xorg_xv_port_priv *priv = (struct xorg_xv_port_priv *)data; + + if (attribute == xvBrightness) { + if ((value < -128) || (value > 127)) + return BadValue; + priv->brightness = value; + } else if (attribute == xvContrast) { + if ((value < 0) || (value > 255)) + return BadValue; + priv->contrast = value; + } else + return BadMatch; + + return Success; } static int get_port_attribute(ScrnInfoPtr pScrn, Atom attribute, INT32 * value, pointer data) { - return 0; + struct xorg_xv_port_priv *priv = (struct xorg_xv_port_priv *)data; + + if (attribute == xvBrightness) + *value = priv->brightness; + else if (attribute == xvContrast) + *value = priv->contrast; + else + return BadMatch; + + return Success; } static void @@ -69,6 +97,13 @@ query_best_size(ScrnInfoPtr pScrn, short drw_w, short drw_h, unsigned int *p_w, unsigned int *p_h, pointer data) { + if (vid_w > (drw_w << 1)) + drw_w = vid_w >> 1; + if (vid_h > (drw_h << 1)) + drw_h = vid_h >> 1; + + *p_w = drw_w; + *p_h = drw_h; } static int @@ -91,7 +126,29 @@ query_image_attributes(ScrnInfoPtr pScrn, unsigned short *w, unsigned short *h, int *pitches, int *offsets) { - return 0; + int size; + + if (*w > IMAGE_MAX_WIDTH) + *w = IMAGE_MAX_WIDTH; + if (*h > IMAGE_MAX_HEIGHT) + *h = IMAGE_MAX_HEIGHT; + + *w = (*w + 1) & ~1; + if (offsets) + offsets[0] = 0; + + switch (id) { + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + size = *w << 1; + if (pitches) + pitches[0] = size; + size *= *h; + break; + } + + return size; } static struct xorg_xv_port_priv * @@ -106,7 +163,7 @@ port_priv_create(ScreenPtr pScreen) if (!priv) return NULL; - REGION_NULL(pScreen, &priv->clip); + REGION_NULL(pScreen, &priv->clip); return priv; } -- cgit v1.2.3 From 59ae3d51556229631f558f56268df89c885de664 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Tue, 6 Oct 2009 12:38:47 -0400 Subject: configs: fix some remains of the i915simple driver --- src/gallium/winsys/xlib/SConscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/xlib/SConscript b/src/gallium/winsys/xlib/SConscript index 14d4ca7c33..dfe550f733 100644 --- a/src/gallium/winsys/xlib/SConscript +++ b/src/gallium/winsys/xlib/SConscript @@ -5,7 +5,7 @@ Import('*') if env['platform'] == 'linux' \ and 'mesa' in env['statetrackers'] \ - and set(('softpipe', 'llvmpipe', 'i915simple', 'trace')).intersection(env['drivers']) \ + and set(('softpipe', 'llvmpipe', 'i915', 'trace')).intersection(env['drivers']) \ and not env['dri']: env = env.Clone() -- cgit v1.2.3 From 319a588238b4c0c58f8f8807e1143ad79cd8f698 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Fri, 9 Oct 2009 09:52:17 -0400 Subject: st/xorg: lots of rendering and xv changes extract all the rendering code to xorg_rendedrer, make both exa and xv share that code. in the process cleanup the rendering code and implement a lot more of the xv infrastructure. --- src/gallium/state_trackers/xorg/SConscript | 1 + src/gallium/state_trackers/xorg/xorg_composite.c | 746 +--------------------- src/gallium/state_trackers/xorg/xorg_composite.h | 5 - src/gallium/state_trackers/xorg/xorg_exa.c | 50 +- src/gallium/state_trackers/xorg/xorg_exa.h | 12 +- src/gallium/state_trackers/xorg/xorg_exa_tgsi.c | 14 +- src/gallium/state_trackers/xorg/xorg_exa_tgsi.h | 4 +- src/gallium/state_trackers/xorg/xorg_renderer.c | 748 +++++++++++++++++++++++ src/gallium/state_trackers/xorg/xorg_renderer.h | 53 ++ src/gallium/state_trackers/xorg/xorg_tracker.h | 4 +- src/gallium/state_trackers/xorg/xorg_xv.c | 319 +++++++++- 11 files changed, 1170 insertions(+), 786 deletions(-) create mode 100644 src/gallium/state_trackers/xorg/xorg_renderer.c create mode 100644 src/gallium/state_trackers/xorg/xorg_renderer.h (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/SConscript b/src/gallium/state_trackers/xorg/SConscript index 65f55ea378..6165bae7a4 100644 --- a/src/gallium/state_trackers/xorg/SConscript +++ b/src/gallium/state_trackers/xorg/SConscript @@ -22,6 +22,7 @@ if 'xorg' in env['statetrackers']: 'xorg_exa.c', 'xorg_exa_tgsi.c', 'xorg_output.c', + 'xorg_xv.c', ] ) Export('st_xorg') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 98e9933f72..54b9ecaba1 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -1,5 +1,6 @@ #include "xorg_composite.h" +#include "xorg_renderer.h" #include "xorg_exa_tgsi.h" #include "cso_cache/cso_context.h" @@ -111,173 +112,6 @@ render_repeat_to_gallium(int mode) return PIPE_TEX_WRAP_REPEAT; } - -static INLINE void -setup_vertex0(float vertex[2][4], float x, float y, - float color[4]) -{ - vertex[0][0] = x; - vertex[0][1] = y; - vertex[0][2] = 0.f; /*z*/ - vertex[0][3] = 1.f; /*w*/ - - vertex[1][0] = color[0]; /*r*/ - vertex[1][1] = color[1]; /*g*/ - vertex[1][2] = color[2]; /*b*/ - vertex[1][3] = color[3]; /*a*/ -} - -static struct pipe_buffer * -setup_vertex_data0(struct exa_context *ctx, - int srcX, int srcY, int maskX, int maskY, - int dstX, int dstY, int width, int height) -{ - /* 1st vertex */ - setup_vertex0(ctx->vertices2[0], dstX, dstY, - ctx->solid_color); - /* 2nd vertex */ - setup_vertex0(ctx->vertices2[1], dstX + width, dstY, - ctx->solid_color); - /* 3rd vertex */ - setup_vertex0(ctx->vertices2[2], dstX + width, dstY + height, - ctx->solid_color); - /* 4th vertex */ - setup_vertex0(ctx->vertices2[3], dstX, dstY + height, - ctx->solid_color); - - return pipe_user_buffer_create(ctx->pipe->screen, - ctx->vertices2, - sizeof(ctx->vertices2)); -} - -static INLINE void -setup_vertex1(float vertex[2][4], float x, float y, float s, float t) -{ - vertex[0][0] = x; - vertex[0][1] = y; - vertex[0][2] = 0.f; /*z*/ - vertex[0][3] = 1.f; /*w*/ - - vertex[1][0] = s; /*s*/ - vertex[1][1] = t; /*t*/ - vertex[1][2] = 0.f; /*r*/ - vertex[1][3] = 1.f; /*q*/ -} - -static struct pipe_buffer * -setup_vertex_data1(struct exa_context *ctx, - int srcX, int srcY, int maskX, int maskY, - int dstX, int dstY, int width, int height) -{ - float s0, t0, s1, t1; - struct pipe_texture *src = ctx->bound_textures[0]; - - s0 = srcX / src->width[0]; - s1 = srcX + width / src->width[0]; - t0 = srcY / src->height[0]; - t1 = srcY + height / src->height[0]; - - /* 1st vertex */ - setup_vertex1(ctx->vertices2[0], dstX, dstY, - s0, t0); - /* 2nd vertex */ - setup_vertex1(ctx->vertices2[1], dstX + width, dstY, - s1, t0); - /* 3rd vertex */ - setup_vertex1(ctx->vertices2[2], dstX + width, dstY + height, - s1, t1); - /* 4th vertex */ - setup_vertex1(ctx->vertices2[3], dstX, dstY + height, - s0, t1); - - return pipe_user_buffer_create(ctx->pipe->screen, - ctx->vertices2, - sizeof(ctx->vertices2)); -} - -static struct pipe_buffer * -setup_vertex_data_tex(struct exa_context *ctx, - float x0, float y0, float x1, float y1, - float s0, float t0, float s1, float t1, - float z) -{ - /* 1st vertex */ - setup_vertex1(ctx->vertices2[0], x0, y0, - s0, t0); - /* 2nd vertex */ - setup_vertex1(ctx->vertices2[1], x1, y0, - s1, t0); - /* 3rd vertex */ - setup_vertex1(ctx->vertices2[2], x1, y1, - s1, t1); - /* 4th vertex */ - setup_vertex1(ctx->vertices2[3], x0, y1, - s0, t1); - - return pipe_user_buffer_create(ctx->pipe->screen, - ctx->vertices2, - sizeof(ctx->vertices2)); -} - - - -static INLINE void -setup_vertex2(float vertex[3][4], float x, float y, - float s0, float t0, float s1, float t1) -{ - vertex[0][0] = x; - vertex[0][1] = y; - vertex[0][2] = 0.f; /*z*/ - vertex[0][3] = 1.f; /*w*/ - - vertex[1][0] = s0; /*s*/ - vertex[1][1] = t0; /*t*/ - vertex[1][2] = 0.f; /*r*/ - vertex[1][3] = 1.f; /*q*/ - - vertex[2][0] = s1; /*s*/ - vertex[2][1] = t1; /*t*/ - vertex[2][2] = 0.f; /*r*/ - vertex[2][3] = 1.f; /*q*/ -} - -static struct pipe_buffer * -setup_vertex_data2(struct exa_context *ctx, - int srcX, int srcY, int maskX, int maskY, - int dstX, int dstY, int width, int height) -{ - float st0[4], st1[4]; - struct pipe_texture *src = ctx->bound_textures[0]; - struct pipe_texture *mask = ctx->bound_textures[0]; - - st0[0] = srcX / src->width[0]; - st0[1] = srcY / src->height[0]; - st0[2] = srcX + width / src->width[0]; - st0[3] = srcY + height / src->height[0]; - - st1[0] = maskX / mask->width[0]; - st1[1] = maskY / mask->height[0]; - st1[2] = maskX + width / mask->width[0]; - st1[3] = maskY + height / mask->height[0]; - - /* 1st vertex */ - setup_vertex2(ctx->vertices3[0], dstX, dstY, - st0[0], st0[1], st1[0], st1[1]); - /* 2nd vertex */ - setup_vertex2(ctx->vertices3[1], dstX + width, dstY, - st0[2], st0[1], st1[2], st1[1]); - /* 3rd vertex */ - setup_vertex2(ctx->vertices3[2], dstX + width, dstY + height, - st0[2], st0[3], st1[2], st1[3]); - /* 4th vertex */ - setup_vertex2(ctx->vertices3[3], dstX, dstY + height, - st0[0], st0[3], st1[0], st1[3]); - - return pipe_user_buffer_create(ctx->pipe->screen, - ctx->vertices3, - sizeof(ctx->vertices3)); -} - boolean xorg_composite_accelerated(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, @@ -316,71 +150,6 @@ boolean xorg_composite_accelerated(int op, XORG_FALLBACK("unsupported operation"); } -static void -bind_clip_state(struct exa_context *exa) -{ -} - -static void -bind_framebuffer_state(struct exa_context *exa, struct exa_pixmap_priv *pDst) -{ - unsigned i; - struct pipe_framebuffer_state state; - struct pipe_surface *surface = exa_gpu_surface(exa, pDst); - memset(&state, 0, sizeof(struct pipe_framebuffer_state)); - - state.width = pDst->tex->width[0]; - state.height = pDst->tex->height[0]; - - state.nr_cbufs = 1; - state.cbufs[0] = surface; - for (i = 1; i < PIPE_MAX_COLOR_BUFS; ++i) - state.cbufs[i] = 0; - - /* currently we don't use depth/stencil */ - state.zsbuf = 0; - - cso_set_framebuffer(exa->cso, &state); - - /* we do fire and forget for the framebuffer, this is the forget part */ - pipe_surface_reference(&surface, NULL); -} - -enum AxisOrientation { - Y0_BOTTOM, - Y0_TOP -}; - -static void -set_viewport(struct exa_context *exa, int width, int height, - enum AxisOrientation orientation) -{ - struct pipe_viewport_state viewport; - float y_scale = (orientation == Y0_BOTTOM) ? -2.f : 2.f; - - viewport.scale[0] = width / 2.f; - viewport.scale[1] = height / y_scale; - viewport.scale[2] = 1.0; - viewport.scale[3] = 1.0; - viewport.translate[0] = width / 2.f; - viewport.translate[1] = height / 2.f; - viewport.translate[2] = 0.0; - viewport.translate[3] = 0.0; - - cso_set_viewport(exa->cso, &viewport); -} - -static void -bind_viewport_state(struct exa_context *exa, struct exa_pixmap_priv *pDst) -{ - int width = pDst->tex->width[0]; - int height = pDst->tex->height[0]; - - /*debug_printf("Bind viewport (%d, %d)\n", width, height);*/ - - set_viewport(exa, width, height, Y0_TOP); -} - static void bind_blend_state(struct exa_context *exa, int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture) @@ -402,17 +171,9 @@ bind_blend_state(struct exa_context *exa, int op, blend.rgb_dst_factor = blend_opt.rgb_dst_factor; blend.alpha_dst_factor = blend_opt.alpha_dst_factor; - cso_set_blend(exa->cso, &blend); + cso_set_blend(exa->renderer->cso, &blend); } -static void -bind_rasterizer_state(struct exa_context *exa) -{ - struct pipe_rasterizer_state raster; - memset(&raster, 0, sizeof(struct pipe_rasterizer_state)); - raster.gl_rasterization_rules = 1; - cso_set_rasterizer(exa->cso, &raster); -} static void bind_shaders(struct exa_context *exa, int op, @@ -446,9 +207,9 @@ bind_shaders(struct exa_context *exa, int op, fs_traits |= FS_MASK; } - shader = xorg_shaders_get(exa->shaders, vs_traits, fs_traits); - cso_set_vertex_shader_handle(exa->cso, shader.vs); - cso_set_fragment_shader_handle(exa->cso, shader.fs); + shader = xorg_shaders_get(exa->renderer->shaders, vs_traits, fs_traits); + cso_set_vertex_shader_handle(exa->renderer->cso, shader.vs); + cso_set_fragment_shader_handle(exa->renderer->cso, shader.fs); } @@ -500,9 +261,9 @@ bind_samplers(struct exa_context *exa, int op, ++exa->num_bound_samplers; } - cso_set_samplers(exa->cso, exa->num_bound_samplers, + cso_set_samplers(exa->renderer->cso, exa->num_bound_samplers, (const struct pipe_sampler_state **)samplers); - cso_set_sampler_textures(exa->cso, exa->num_bound_samplers, + cso_set_sampler_textures(exa->renderer->cso, exa->num_bound_samplers, exa->bound_textures); } @@ -515,18 +276,8 @@ setup_vs_constant_buffer(struct exa_context *exa, 2.f/width, 2.f/height, 1, 1, -1, -1, 0, 0 }; - struct pipe_constant_buffer *cbuf = &exa->vs_const_buffer; - - pipe_buffer_reference(&cbuf->buffer, NULL); - cbuf->buffer = pipe_buffer_create(exa->pipe->screen, 16, - PIPE_BUFFER_USAGE_CONSTANT, - param_bytes); - - if (cbuf->buffer) { - pipe_buffer_write(exa->pipe->screen, cbuf->buffer, - 0, param_bytes, vs_consts); - } - exa->pipe->set_constant_buffer(exa->pipe, PIPE_SHADER_VERTEX, 0, cbuf); + renderer_set_constants(exa->renderer, PIPE_SHADER_VERTEX, + vs_consts, param_bytes); } @@ -534,21 +285,11 @@ static void setup_fs_constant_buffer(struct exa_context *exa) { const int param_bytes = 4 * sizeof(float); - float fs_consts[8] = { + const float fs_consts[8] = { 0, 0, 0, 1, }; - struct pipe_constant_buffer *cbuf = &exa->fs_const_buffer; - - pipe_buffer_reference(&cbuf->buffer, NULL); - cbuf->buffer = pipe_buffer_create(exa->pipe->screen, 16, - PIPE_BUFFER_USAGE_CONSTANT, - param_bytes); - - if (cbuf->buffer) { - pipe_buffer_write(exa->pipe->screen, cbuf->buffer, - 0, param_bytes, fs_consts); - } - exa->pipe->set_constant_buffer(exa->pipe, PIPE_SHADER_FRAGMENT, 0, cbuf); + renderer_set_constants(exa->renderer, PIPE_SHADER_FRAGMENT, + fs_consts, param_bytes); } static void @@ -570,14 +311,13 @@ boolean xorg_composite_bind_state(struct exa_context *exa, struct exa_pixmap_priv *pMask, struct exa_pixmap_priv *pDst) { - bind_framebuffer_state(exa, pDst); - bind_viewport_state(exa, pDst); + renderer_bind_framebuffer(exa->renderer, pDst); + renderer_bind_viewport(exa->renderer, pDst); bind_blend_state(exa, op, pSrcPicture, pMaskPicture); - bind_rasterizer_state(exa); + renderer_bind_rasterizer(exa->renderer); bind_shaders(exa, op, pSrcPicture, pMaskPicture); bind_samplers(exa, op, pSrcPicture, pMaskPicture, pDstPicture, pSrc, pMask, pDst); - bind_clip_state(exa); setup_constant_buffers(exa, pDst); return FALSE; @@ -588,42 +328,16 @@ void xorg_composite(struct exa_context *exa, int srcX, int srcY, int maskX, int maskY, int dstX, int dstY, int width, int height) { - struct pipe_context *pipe = exa->pipe; - struct pipe_buffer *buf = 0; - if (exa->num_bound_samplers == 0 ) { /* solid fill */ - buf = setup_vertex_data0(exa, - srcX, srcY, maskX, maskY, - dstX, dstY, width, height); - } else if (exa->num_bound_samplers == 1 ) /* src */ - buf = setup_vertex_data1(exa, - srcX, srcY, maskX, maskY, - dstX, dstY, width, height); - else if (exa->num_bound_samplers == 2) /* src + mask */ - buf = setup_vertex_data2(exa, - srcX, srcY, maskX, maskY, - dstX, dstY, width, height); - else if (exa->num_bound_samplers == 3) { /* src + mask + dst */ - debug_assert(!"src/mask/dst not handled right now"); -#if 0 - buf = setup_vertex_data2(exa, - srcX, srcY, maskX, maskY, - dstX, dstY, width, height); -#endif - } - - if (buf) { - int num_attribs = 1; /*pos*/ - num_attribs += exa->num_bound_samplers; - if (exa->has_solid_color) - ++num_attribs; - - util_draw_vertex_buffer(pipe, buf, 0, - PIPE_PRIM_TRIANGLE_FAN, - 4, /* verts */ - num_attribs); /* attribs/vert */ - - pipe_buffer_reference(&buf, NULL); + renderer_draw_solid_rect(exa->renderer, + dstX, dstY, dstX + width, dstY + height, + exa->solid_color); + } else { + int pos[6] = {srcX, srcY, maskX, maskY, dstX, dstY}; + renderer_draw_textures(exa->renderer, + pos, width, height, + exa->bound_textures, + exa->num_bound_samplers); } } @@ -650,16 +364,15 @@ boolean xorg_solid_bind_state(struct exa_context *exa, vs_traits = VS_SOLID_FILL; fs_traits = FS_SOLID_FILL; - bind_framebuffer_state(exa, pixmap); - bind_viewport_state(exa, pixmap); - bind_rasterizer_state(exa); + renderer_bind_framebuffer(exa->renderer, pixmap); + renderer_bind_viewport(exa->renderer, pixmap); + renderer_bind_rasterizer(exa->renderer); bind_blend_state(exa, PictOpSrc, NULL, NULL); setup_constant_buffers(exa, pixmap); - bind_clip_state(exa); - shader = xorg_shaders_get(exa->shaders, vs_traits, fs_traits); - cso_set_vertex_shader_handle(exa->cso, shader.vs); - cso_set_fragment_shader_handle(exa->cso, shader.fs); + shader = xorg_shaders_get(exa->renderer->shaders, vs_traits, fs_traits); + cso_set_vertex_shader_handle(exa->renderer->cso, shader.vs); + cso_set_fragment_shader_handle(exa->renderer->cso, shader.fs); return TRUE; } @@ -668,402 +381,7 @@ void xorg_solid(struct exa_context *exa, struct exa_pixmap_priv *pixmap, int x0, int y0, int x1, int y1) { - struct pipe_context *pipe = exa->pipe; - struct pipe_buffer *buf = 0; - - /* 1st vertex */ - setup_vertex0(exa->vertices2[0], x0, y0, - exa->solid_color); - /* 2nd vertex */ - setup_vertex0(exa->vertices2[1], x1, y0, - exa->solid_color); - /* 3rd vertex */ - setup_vertex0(exa->vertices2[2], x1, y1, - exa->solid_color); - /* 4th vertex */ - setup_vertex0(exa->vertices2[3], x0, y1, - exa->solid_color); - - buf = pipe_user_buffer_create(exa->pipe->screen, - exa->vertices2, - sizeof(exa->vertices2)); - - - if (buf) { - util_draw_vertex_buffer(pipe, buf, 0, - PIPE_PRIM_TRIANGLE_FAN, - 4, /* verts */ - 2); /* attribs/vert */ - - pipe_buffer_reference(&buf, NULL); - } -} - - -static INLINE void shift_rectx(float coords[4], - const float *bounds, - const float shift) -{ - coords[0] += shift; - coords[2] -= shift; - if (bounds) { - coords[2] = MIN2(coords[2], bounds[2]); - /* bound x/y + width/height */ - if ((coords[0] + coords[2]) > (bounds[0] + bounds[2])) { - coords[2] = (bounds[0] + bounds[2]) - coords[0]; - } - } -} - -static INLINE void shift_recty(float coords[4], - const float *bounds, - const float shift) -{ - coords[1] += shift; - coords[3] -= shift; - if (bounds) { - coords[3] = MIN2(coords[3], bounds[3]); - if ((coords[1] + coords[3]) > (bounds[1] + bounds[3])) { - coords[3] = (bounds[1] + bounds[3]) - coords[1]; - } - } -} - -static INLINE void bound_rect(float coords[4], - const float bounds[4], - float shift[4]) -{ - /* if outside the bounds */ - if (coords[0] > (bounds[0] + bounds[2]) || - coords[1] > (bounds[1] + bounds[3]) || - (coords[0] + coords[2]) < bounds[0] || - (coords[1] + coords[3]) < bounds[1]) { - coords[0] = 0.f; - coords[1] = 0.f; - coords[2] = 0.f; - coords[3] = 0.f; - shift[0] = 0.f; - shift[1] = 0.f; - return; - } - - /* bound x */ - if (coords[0] < bounds[0]) { - shift[0] = bounds[0] - coords[0]; - coords[2] -= shift[0]; - coords[0] = bounds[0]; - } else - shift[0] = 0.f; - - /* bound y */ - if (coords[1] < bounds[1]) { - shift[1] = bounds[1] - coords[1]; - coords[3] -= shift[1]; - coords[1] = bounds[1]; - } else - shift[1] = 0.f; - - shift[2] = bounds[2] - coords[2]; - shift[3] = bounds[3] - coords[3]; - /* bound width/height */ - coords[2] = MIN2(coords[2], bounds[2]); - coords[3] = MIN2(coords[3], bounds[3]); - - /* bound x/y + width/height */ - if ((coords[0] + coords[2]) > (bounds[0] + bounds[2])) { - coords[2] = (bounds[0] + bounds[2]) - coords[0]; - } - if ((coords[1] + coords[3]) > (bounds[1] + bounds[3])) { - coords[3] = (bounds[1] + bounds[3]) - coords[1]; - } - - /* if outside the bounds */ - if ((coords[0] + coords[2]) < bounds[0] || - (coords[1] + coords[3]) < bounds[1]) { - coords[0] = 0.f; - coords[1] = 0.f; - coords[2] = 0.f; - coords[3] = 0.f; - return; - } -} - -static INLINE void sync_size(float *src_loc, float *dst_loc) -{ - src_loc[2] = MIN2(src_loc[2], dst_loc[2]); - src_loc[3] = MIN2(src_loc[3], dst_loc[3]); - dst_loc[2] = src_loc[2]; - dst_loc[3] = src_loc[3]; -} - - -static void renderer_copy_texture(struct exa_context *exa, - struct pipe_texture *src, - float sx1, float sy1, - float sx2, float sy2, - struct pipe_texture *dst, - float dx1, float dy1, - float dx2, float dy2) -{ - struct pipe_context *pipe = exa->pipe; - struct pipe_screen *screen = pipe->screen; - struct pipe_buffer *buf; - struct pipe_surface *dst_surf = screen->get_tex_surface( - screen, dst, 0, 0, 0, - PIPE_BUFFER_USAGE_GPU_WRITE); - struct pipe_framebuffer_state fb; - float s0, t0, s1, t1; - struct xorg_shader shader; - - assert(src->width[0] != 0); - assert(src->height[0] != 0); - assert(dst->width[0] != 0); - assert(dst->height[0] != 0); - -#if 1 - s0 = sx1 / src->width[0]; - s1 = sx2 / src->width[0]; - t0 = sy1 / src->height[0]; - t1 = sy2 / src->height[0]; -#else - s0 = 0; - s1 = 1; - t0 = 0; - t1 = 1; -#endif - -#if 0 - debug_printf("copy texture src=[%f, %f, %f, %f], dst=[%f, %f, %f, %f], tex=[%f, %f, %f, %f]\n", - sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, - s0, t0, s1, t1); -#endif - - assert(screen->is_format_supported(screen, dst_surf->format, - PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_RENDER_TARGET, - 0)); - - /* save state (restored below) */ - cso_save_blend(exa->cso); - cso_save_samplers(exa->cso); - cso_save_sampler_textures(exa->cso); - cso_save_framebuffer(exa->cso); - cso_save_fragment_shader(exa->cso); - cso_save_vertex_shader(exa->cso); - - cso_save_viewport(exa->cso); - - - /* set misc state we care about */ - { - struct pipe_blend_state blend; - memset(&blend, 0, sizeof(blend)); - blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE; - blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE; - blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO; - blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO; - blend.colormask = PIPE_MASK_RGBA; - cso_set_blend(exa->cso, &blend); - } - - /* sampler */ - { - struct pipe_sampler_state sampler; - memset(&sampler, 0, sizeof(sampler)); - sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE; - sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE; - sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE; - sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE; - sampler.min_img_filter = PIPE_TEX_FILTER_NEAREST; - sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST; - sampler.normalized_coords = 1; - cso_single_sampler(exa->cso, 0, &sampler); - cso_single_sampler_done(exa->cso); - } - - set_viewport(exa, dst_surf->width, dst_surf->height, Y0_TOP); - - /* texture */ - cso_set_sampler_textures(exa->cso, 1, &src); - - bind_rasterizer_state(exa); - - /* shaders */ - shader = xorg_shaders_get(exa->shaders, - VS_COMPOSITE, - FS_COMPOSITE); - cso_set_vertex_shader_handle(exa->cso, shader.vs); - cso_set_fragment_shader_handle(exa->cso, shader.fs); - - /* drawing dest */ - memset(&fb, 0, sizeof(fb)); - fb.width = dst_surf->width; - fb.height = dst_surf->height; - fb.nr_cbufs = 1; - fb.cbufs[0] = dst_surf; - { - int i; - for (i = 1; i < PIPE_MAX_COLOR_BUFS; ++i) - fb.cbufs[i] = 0; - } - cso_set_framebuffer(exa->cso, &fb); - setup_vs_constant_buffer(exa, fb.width, fb.height); - setup_fs_constant_buffer(exa); - - /* draw quad */ - buf = setup_vertex_data_tex(exa, - dx1, dy1, - dx2, dy2, - s0, t0, s1, t1, - 0.0f); - - if (buf) { - util_draw_vertex_buffer(exa->pipe, buf, 0, - PIPE_PRIM_TRIANGLE_FAN, - 4, /* verts */ - 2); /* attribs/vert */ - - pipe_buffer_reference(&buf, NULL); - } - - /* restore state we changed */ - cso_restore_blend(exa->cso); - cso_restore_samplers(exa->cso); - cso_restore_sampler_textures(exa->cso); - cso_restore_framebuffer(exa->cso); - cso_restore_vertex_shader(exa->cso); - cso_restore_fragment_shader(exa->cso); - cso_restore_viewport(exa->cso); - - pipe_surface_reference(&dst_surf, NULL); -} - - -static struct pipe_texture * -create_sampler_texture(struct exa_context *ctx, - struct pipe_texture *src) -{ - enum pipe_format format; - struct pipe_context *pipe = ctx->pipe; - struct pipe_screen *screen = pipe->screen; - struct pipe_texture *pt; - struct pipe_texture templ; - - pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); - - /* the coming in texture should already have that invariance */ - debug_assert(screen->is_format_supported(screen, src->format, - PIPE_TEXTURE_2D, - PIPE_TEXTURE_USAGE_SAMPLER, 0)); - - format = src->format; - - memset(&templ, 0, sizeof(templ)); - templ.target = PIPE_TEXTURE_2D; - templ.format = format; - templ.last_level = 0; - templ.width[0] = src->width[0]; - templ.height[0] = src->height[0]; - templ.depth[0] = 1; - pf_get_block(format, &templ.block); - templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; - - pt = screen->texture_create(screen, &templ); - - debug_assert(!pt || pipe_is_referenced(&pt->reference)); - - if (!pt) - return NULL; - - { - /* copy source framebuffer surface into texture */ - struct pipe_surface *ps_read = screen->get_tex_surface( - screen, src, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_READ); - struct pipe_surface *ps_tex = screen->get_tex_surface( - screen, pt, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE ); - pipe->surface_copy(pipe, - ps_tex, /* dest */ - 0, 0, /* destx/y */ - ps_read, - 0, 0, src->width[0], src->height[0]); - pipe_surface_reference(&ps_read, NULL); - pipe_surface_reference(&ps_tex, NULL); - } - - return pt; -} - -void xorg_copy_pixmap(struct exa_context *ctx, - struct exa_pixmap_priv *dst_priv, int dx, int dy, - struct exa_pixmap_priv *src_priv, int sx, int sy, - int width, int height) -{ - float dst_loc[4], src_loc[4]; - float dst_bounds[4], src_bounds[4]; - float src_shift[4], dst_shift[4], shift[4]; - struct pipe_texture *dst = dst_priv->tex; - struct pipe_texture *src = src_priv->tex; - - if (ctx->pipe->is_texture_referenced(ctx->pipe, src, 0, 0) & - PIPE_REFERENCED_FOR_WRITE) - ctx->pipe->flush(ctx->pipe, PIPE_FLUSH_RENDER_CACHE, NULL); - - dst_loc[0] = dx; - dst_loc[1] = dy; - dst_loc[2] = width; - dst_loc[3] = height; - dst_bounds[0] = 0.f; - dst_bounds[1] = 0.f; - dst_bounds[2] = dst->width[0]; - dst_bounds[3] = dst->height[0]; - - src_loc[0] = sx; - src_loc[1] = sy; - src_loc[2] = width; - src_loc[3] = height; - src_bounds[0] = 0.f; - src_bounds[1] = 0.f; - src_bounds[2] = src->width[0]; - src_bounds[3] = src->height[0]; - - bound_rect(src_loc, src_bounds, src_shift); - bound_rect(dst_loc, dst_bounds, dst_shift); - shift[0] = src_shift[0] - dst_shift[0]; - shift[1] = src_shift[1] - dst_shift[1]; - - if (shift[0] < 0) - shift_rectx(src_loc, src_bounds, -shift[0]); - else - shift_rectx(dst_loc, dst_bounds, shift[0]); - - if (shift[1] < 0) - shift_recty(src_loc, src_bounds, -shift[1]); - else - shift_recty(dst_loc, dst_bounds, shift[1]); - - sync_size(src_loc, dst_loc); - - if (src_loc[2] >= 0 && src_loc[3] >= 0 && - dst_loc[2] >= 0 && dst_loc[3] >= 0) { - struct pipe_texture *temp_src = src; - - if (src == dst) - temp_src = create_sampler_texture(ctx, src); - - renderer_copy_texture(ctx, - temp_src, - src_loc[0], - src_loc[1], - src_loc[0] + src_loc[2], - src_loc[1] + src_loc[3], - dst, - dst_loc[0], - dst_loc[1], - dst_loc[0] + dst_loc[2], - dst_loc[1] + dst_loc[3]); - - if (src == dst) - pipe_texture_reference(&temp_src, NULL); - } + renderer_draw_solid_rect(exa->renderer, + x0, y0, x1, y1, exa->solid_color); } diff --git a/src/gallium/state_trackers/xorg/xorg_composite.h b/src/gallium/state_trackers/xorg/xorg_composite.h index e73f1c704a..236addf1ce 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.h +++ b/src/gallium/state_trackers/xorg/xorg_composite.h @@ -29,9 +29,4 @@ void xorg_solid(struct exa_context *exa, struct exa_pixmap_priv *pixmap, int x0, int y0, int x1, int y1); -void xorg_copy_pixmap(struct exa_context *ctx, - struct exa_pixmap_priv *dst, int dx, int dy, - struct exa_pixmap_priv *src, int sx, int sy, - int width, int height); - #endif diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 2633e8caaf..29785c0040 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -43,8 +43,6 @@ #include "pipe/p_state.h" #include "pipe/p_inlines.h" -#include "cso_cache/cso_context.h" - #include "util/u_rect.h" #define DEBUG_PRINT 0 @@ -89,16 +87,6 @@ exa_get_pipe_format(int depth, enum pipe_format *format, int *bbp) } } -static void -xorg_exa_init_state(struct exa_context *exa) -{ - struct pipe_depth_stencil_alpha_state dsa; - - /* set common initial clip state */ - memset(&dsa, 0, sizeof(struct pipe_depth_stencil_alpha_state)); - cso_set_depth_stencil_alpha(exa->cso, &dsa); -} - static void xorg_exa_common_done(struct exa_context *exa) { @@ -444,9 +432,9 @@ ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY, debug_assert(priv == exa->copy.dst); - xorg_copy_pixmap(exa, exa->copy.dst, dstX, dstY, - exa->copy.src, srcX, srcY, - width, height); + renderer_copy_pixmap(exa->renderer, exa->copy.dst, dstX, dstY, + exa->copy.src, srcX, srcY, + width, height); } static Bool @@ -701,7 +689,7 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, dst_surf = exa->scrn->get_tex_surface( exa->scrn, texture, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE); - src_surf = exa_gpu_surface(exa, priv); + src_surf = xorg_gpu_surface(exa->pipe->screen, priv); exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf, 0, 0, min(width, texture->width[0]), min(height, texture->height[0])); @@ -731,23 +719,8 @@ xorg_exa_close(ScrnInfoPtr pScrn) { modesettingPtr ms = modesettingPTR(pScrn); struct exa_context *exa = ms->exa; - struct pipe_constant_buffer *vsbuf = &exa->vs_const_buffer; - struct pipe_constant_buffer *fsbuf = &exa->fs_const_buffer; - if (exa->shaders) { - xorg_shaders_destroy(exa->shaders); - } - - if (vsbuf && vsbuf->buffer) - pipe_buffer_reference(&vsbuf->buffer, NULL); - - if (fsbuf && fsbuf->buffer) - pipe_buffer_reference(&fsbuf->buffer, NULL); - - if (exa->cso) { - cso_release_all(exa->cso); - cso_destroy_context(exa->cso); - } + renderer_destroy(exa->renderer); if (exa->pipe) exa->pipe->destroy(exa->pipe); @@ -822,10 +795,7 @@ xorg_exa_init(ScrnInfoPtr pScrn) /* Share context with DRI */ ms->ctx = exa->pipe; - exa->cso = cso_create_context(exa->pipe); - exa->shaders = xorg_shaders_create(exa); - - xorg_exa_init_state(exa); + exa->renderer = renderer_create(exa->pipe); return (void *)exa; @@ -836,11 +806,11 @@ out_err: } struct pipe_surface * -exa_gpu_surface(struct exa_context *exa, struct exa_pixmap_priv *priv) +xorg_gpu_surface(struct pipe_screen *scrn, struct exa_pixmap_priv *priv) { - return exa->scrn->get_tex_surface(exa->scrn, priv->tex, 0, 0, 0, - PIPE_BUFFER_USAGE_GPU_READ | - PIPE_BUFFER_USAGE_GPU_WRITE); + return scrn->get_tex_surface(scrn, priv->tex, 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_READ | + PIPE_BUFFER_USAGE_GPU_WRITE); } diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h index 28834e3ef5..292f964cec 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.h +++ b/src/gallium/state_trackers/xorg/xorg_exa.h @@ -16,11 +16,7 @@ struct exa_context ExaDriverPtr pExa; struct pipe_context *pipe; struct pipe_screen *scrn; - struct cso_context *cso; - struct xorg_shaders *shaders; - - struct pipe_constant_buffer vs_const_buffer; - struct pipe_constant_buffer fs_const_buffer; + struct xorg_renderer *renderer; struct pipe_texture *bound_textures[MAX_EXA_SAMPLERS]; int num_bound_samplers; @@ -32,10 +28,6 @@ struct exa_context struct exa_pixmap_priv *src; struct exa_pixmap_priv *dst; } copy; - - /* we should combine these two */ - float vertices2[4][2][4]; - float vertices3[4][3][4]; }; struct exa_pixmap_priv @@ -60,7 +52,7 @@ do { \ } while(0) struct pipe_surface * -exa_gpu_surface(struct exa_context *exa, struct exa_pixmap_priv *priv); +xorg_gpu_surface(struct pipe_screen *scrn, struct exa_pixmap_priv *priv); void xorg_exa_flush(struct exa_context *exa, uint pipeFlushFlags, struct pipe_fence_handle **fence); diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c index bb5a42af37..8ce06e374a 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c @@ -44,7 +44,7 @@ */ struct xorg_shaders { - struct exa_context *exa; + struct xorg_renderer *r; struct cso_hash *vs_hash; struct cso_hash *fs_hash; @@ -400,11 +400,11 @@ create_fs(struct pipe_context *pipe, return ureg_create_shader_and_destroy(ureg, pipe); } -struct xorg_shaders * xorg_shaders_create(struct exa_context *exa) +struct xorg_shaders * xorg_shaders_create(struct xorg_renderer *r) { struct xorg_shaders *sc = CALLOC_STRUCT(xorg_shaders); - sc->exa = exa; + sc->r = r; sc->vs_hash = cso_hash_create(); sc->fs_hash = cso_hash_create(); @@ -431,9 +431,9 @@ cache_destroy(struct cso_context *cso, void xorg_shaders_destroy(struct xorg_shaders *sc) { - cache_destroy(sc->exa->cso, sc->vs_hash, + cache_destroy(sc->r->cso, sc->vs_hash, PIPE_SHADER_VERTEX); - cache_destroy(sc->exa->cso, sc->fs_hash, + cache_destroy(sc->r->cso, sc->fs_hash, PIPE_SHADER_FRAGMENT); free(sc); @@ -468,9 +468,9 @@ struct xorg_shader xorg_shaders_get(struct xorg_shaders *sc, struct xorg_shader shader = { NULL, NULL }; void *vs, *fs; - vs = shader_from_cache(sc->exa->pipe, PIPE_SHADER_VERTEX, + vs = shader_from_cache(sc->r->pipe, PIPE_SHADER_VERTEX, sc->vs_hash, vs_traits); - fs = shader_from_cache(sc->exa->pipe, PIPE_SHADER_FRAGMENT, + fs = shader_from_cache(sc->r->pipe, PIPE_SHADER_FRAGMENT, sc->fs_hash, fs_traits); debug_assert(vs && fs); diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h index 1535a0c8c3..33c272070b 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h @@ -1,7 +1,7 @@ #ifndef XORG_EXA_TGSI_H #define XORG_EXA_TGSI_H -#include "xorg_exa.h" +#include "xorg_renderer.h" enum xorg_vs_traits { VS_COMPOSITE = 1 << 0, @@ -33,7 +33,7 @@ struct xorg_shader { struct xorg_shaders; -struct xorg_shaders *xorg_shaders_create(struct exa_context *exa); +struct xorg_shaders *xorg_shaders_create(struct xorg_renderer *renderer); void xorg_shaders_destroy(struct xorg_shaders *shaders); struct xorg_shader xorg_shaders_get(struct xorg_shaders *shaders, diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c new file mode 100644 index 0000000000..362fb6f4f1 --- /dev/null +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -0,0 +1,748 @@ +#include "xorg_exa.h" +#include "xorg_renderer.h" + +#include "xorg_exa_tgsi.h" + +#include "cso_cache/cso_context.h" +#include "util/u_draw_quad.h" +#include "util/u_math.h" +#include "util/u_memory.h" + +#include "pipe/p_inlines.h" + +enum AxisOrientation { + Y0_BOTTOM, + Y0_TOP +}; + +static void +renderer_init_state(struct xorg_renderer *r) +{ + struct pipe_depth_stencil_alpha_state dsa; + + /* set common initial clip state */ + memset(&dsa, 0, sizeof(struct pipe_depth_stencil_alpha_state)); + cso_set_depth_stencil_alpha(r->cso, &dsa); +} + + +static INLINE void +setup_vertex0(float vertex[2][4], float x, float y, + float color[4]) +{ + vertex[0][0] = x; + vertex[0][1] = y; + vertex[0][2] = 0.f; /*z*/ + vertex[0][3] = 1.f; /*w*/ + + vertex[1][0] = color[0]; /*r*/ + vertex[1][1] = color[1]; /*g*/ + vertex[1][2] = color[2]; /*b*/ + vertex[1][3] = color[3]; /*a*/ +} + +static INLINE void +setup_vertex1(float vertex[2][4], float x, float y, float s, float t) +{ + vertex[0][0] = x; + vertex[0][1] = y; + vertex[0][2] = 0.f; /*z*/ + vertex[0][3] = 1.f; /*w*/ + + vertex[1][0] = s; /*s*/ + vertex[1][1] = t; /*t*/ + vertex[1][2] = 0.f; /*r*/ + vertex[1][3] = 1.f; /*q*/ +} + +static struct pipe_buffer * +setup_vertex_data1(struct xorg_renderer *r, + int srcX, int srcY, int dstX, int dstY, + int width, int height, + struct pipe_texture *src) +{ + float s0, t0, s1, t1; + + s0 = srcX / src->width[0]; + s1 = srcX + width / src->width[0]; + t0 = srcY / src->height[0]; + t1 = srcY + height / src->height[0]; + + /* 1st vertex */ + setup_vertex1(r->vertices2[0], dstX, dstY, s0, t0); + /* 2nd vertex */ + setup_vertex1(r->vertices2[1], dstX + width, dstY, s1, t0); + /* 3rd vertex */ + setup_vertex1(r->vertices2[2], dstX + width, dstY + height, s1, t1); + /* 4th vertex */ + setup_vertex1(r->vertices2[3], dstX, dstY + height, s0, t1); + + return pipe_user_buffer_create(r->pipe->screen, + r->vertices2, + sizeof(r->vertices2)); +} + +static struct pipe_buffer * +setup_vertex_data_tex(struct xorg_renderer *r, + float x0, float y0, float x1, float y1, + float s0, float t0, float s1, float t1, + float z) +{ + /* 1st vertex */ + setup_vertex1(r->vertices2[0], x0, y0, s0, t0); + /* 2nd vertex */ + setup_vertex1(r->vertices2[1], x1, y0, s1, t0); + /* 3rd vertex */ + setup_vertex1(r->vertices2[2], x1, y1, s1, t1); + /* 4th vertex */ + setup_vertex1(r->vertices2[3], x0, y1, s0, t1); + + return pipe_user_buffer_create(r->pipe->screen, + r->vertices2, + sizeof(r->vertices2)); +} + +static INLINE void +setup_vertex2(float vertex[3][4], float x, float y, + float s0, float t0, float s1, float t1) +{ + vertex[0][0] = x; + vertex[0][1] = y; + vertex[0][2] = 0.f; /*z*/ + vertex[0][3] = 1.f; /*w*/ + + vertex[1][0] = s0; /*s*/ + vertex[1][1] = t0; /*t*/ + vertex[1][2] = 0.f; /*r*/ + vertex[1][3] = 1.f; /*q*/ + + vertex[2][0] = s1; /*s*/ + vertex[2][1] = t1; /*t*/ + vertex[2][2] = 0.f; /*r*/ + vertex[2][3] = 1.f; /*q*/ +} + +static struct pipe_buffer * +setup_vertex_data2(struct xorg_renderer *r, + int srcX, int srcY, int maskX, int maskY, + int dstX, int dstY, int width, int height, + struct pipe_texture *src, + struct pipe_texture *mask) +{ + float st0[4], st1[4]; + + st0[0] = srcX / src->width[0]; + st0[1] = srcY / src->height[0]; + st0[2] = srcX + width / src->width[0]; + st0[3] = srcY + height / src->height[0]; + + st1[0] = maskX / mask->width[0]; + st1[1] = maskY / mask->height[0]; + st1[2] = maskX + width / mask->width[0]; + st1[3] = maskY + height / mask->height[0]; + + /* 1st vertex */ + setup_vertex2(r->vertices3[0], dstX, dstY, + st0[0], st0[1], st1[0], st1[1]); + /* 2nd vertex */ + setup_vertex2(r->vertices3[1], dstX + width, dstY, + st0[2], st0[1], st1[2], st1[1]); + /* 3rd vertex */ + setup_vertex2(r->vertices3[2], dstX + width, dstY + height, + st0[2], st0[3], st1[2], st1[3]); + /* 4th vertex */ + setup_vertex2(r->vertices3[3], dstX, dstY + height, + st0[0], st0[3], st1[0], st1[3]); + + return pipe_user_buffer_create(r->pipe->screen, + r->vertices3, + sizeof(r->vertices3)); +} + + + +static void +set_viewport(struct xorg_renderer *r, int width, int height, + enum AxisOrientation orientation) +{ + struct pipe_viewport_state viewport; + float y_scale = (orientation == Y0_BOTTOM) ? -2.f : 2.f; + + viewport.scale[0] = width / 2.f; + viewport.scale[1] = height / y_scale; + viewport.scale[2] = 1.0; + viewport.scale[3] = 1.0; + viewport.translate[0] = width / 2.f; + viewport.translate[1] = height / 2.f; + viewport.translate[2] = 0.0; + viewport.translate[3] = 0.0; + + cso_set_viewport(r->cso, &viewport); +} + + + +struct xorg_renderer * renderer_create(struct pipe_context *pipe) +{ + struct xorg_renderer *renderer = CALLOC_STRUCT(xorg_renderer); + + renderer->cso = cso_create_context(pipe); + renderer->shaders = xorg_shaders_create(renderer); + + renderer_init_state(renderer); + + return renderer; +} + +void renderer_destroy(struct xorg_renderer *r) +{ + struct pipe_constant_buffer *vsbuf = &r->vs_const_buffer; + struct pipe_constant_buffer *fsbuf = &r->fs_const_buffer; + + if (vsbuf && vsbuf->buffer) + pipe_buffer_reference(&vsbuf->buffer, NULL); + + if (fsbuf && fsbuf->buffer) + pipe_buffer_reference(&fsbuf->buffer, NULL); + + if (r->cso) { + cso_release_all(r->cso); + cso_destroy_context(r->cso); + } + + if (r->shaders) { + xorg_shaders_destroy(r->shaders); + } +} + +void renderer_bind_framebuffer(struct xorg_renderer *r, + struct exa_pixmap_priv *priv) +{ + unsigned i; + struct pipe_framebuffer_state state; + struct pipe_surface *surface = xorg_gpu_surface(r->pipe->screen, priv); + memset(&state, 0, sizeof(struct pipe_framebuffer_state)); + + state.width = priv->tex->width[0]; + state.height = priv->tex->height[0]; + + state.nr_cbufs = 1; + state.cbufs[0] = surface; + for (i = 1; i < PIPE_MAX_COLOR_BUFS; ++i) + state.cbufs[i] = 0; + + /* currently we don't use depth/stencil */ + state.zsbuf = 0; + + cso_set_framebuffer(r->cso, &state); + + /* we do fire and forget for the framebuffer, this is the forget part */ + pipe_surface_reference(&surface, NULL); +} + +void renderer_bind_viewport(struct xorg_renderer *r, + struct exa_pixmap_priv *dst) +{ + int width = dst->tex->width[0]; + int height = dst->tex->height[0]; + + /*debug_printf("Bind viewport (%d, %d)\n", width, height);*/ + + set_viewport(r, width, height, Y0_TOP); +} + +void renderer_bind_rasterizer(struct xorg_renderer *r) +{ + struct pipe_rasterizer_state raster; + + /* XXX: move to renderer_init_state? */ + memset(&raster, 0, sizeof(struct pipe_rasterizer_state)); + raster.gl_rasterization_rules = 1; + cso_set_rasterizer(r->cso, &raster); +} + +void renderer_set_constants(struct xorg_renderer *r, + int shader_type, + const float *params, + int param_bytes) +{ + struct pipe_constant_buffer *cbuf = + (shader_type == PIPE_SHADER_VERTEX) ? &r->vs_const_buffer : + &r->fs_const_buffer; + + pipe_buffer_reference(&cbuf->buffer, NULL); + cbuf->buffer = pipe_buffer_create(r->pipe->screen, 16, + PIPE_BUFFER_USAGE_CONSTANT, + param_bytes); + + if (cbuf->buffer) { + pipe_buffer_write(r->pipe->screen, cbuf->buffer, + 0, param_bytes, params); + } + r->pipe->set_constant_buffer(r->pipe, shader_type, 0, cbuf); +} + +static void +setup_vs_constant_buffer(struct xorg_renderer *r, + int width, int height) +{ + const int param_bytes = 8 * sizeof(float); + float vs_consts[8] = { + 2.f/width, 2.f/height, 1, 1, + -1, -1, 0, 0 + }; + renderer_set_constants(r, PIPE_SHADER_VERTEX, + vs_consts, param_bytes); +} + +static void +setup_fs_constant_buffer(struct xorg_renderer *r) +{ + const int param_bytes = 4 * sizeof(float); + const float fs_consts[8] = { + 0, 0, 0, 1, + }; + renderer_set_constants(r, PIPE_SHADER_FRAGMENT, + fs_consts, param_bytes); +} + +static INLINE void shift_rectx(float coords[4], + const float *bounds, + const float shift) +{ + coords[0] += shift; + coords[2] -= shift; + if (bounds) { + coords[2] = MIN2(coords[2], bounds[2]); + /* bound x/y + width/height */ + if ((coords[0] + coords[2]) > (bounds[0] + bounds[2])) { + coords[2] = (bounds[0] + bounds[2]) - coords[0]; + } + } +} + +static INLINE void shift_recty(float coords[4], + const float *bounds, + const float shift) +{ + coords[1] += shift; + coords[3] -= shift; + if (bounds) { + coords[3] = MIN2(coords[3], bounds[3]); + if ((coords[1] + coords[3]) > (bounds[1] + bounds[3])) { + coords[3] = (bounds[1] + bounds[3]) - coords[1]; + } + } +} + +static INLINE void bound_rect(float coords[4], + const float bounds[4], + float shift[4]) +{ + /* if outside the bounds */ + if (coords[0] > (bounds[0] + bounds[2]) || + coords[1] > (bounds[1] + bounds[3]) || + (coords[0] + coords[2]) < bounds[0] || + (coords[1] + coords[3]) < bounds[1]) { + coords[0] = 0.f; + coords[1] = 0.f; + coords[2] = 0.f; + coords[3] = 0.f; + shift[0] = 0.f; + shift[1] = 0.f; + return; + } + + /* bound x */ + if (coords[0] < bounds[0]) { + shift[0] = bounds[0] - coords[0]; + coords[2] -= shift[0]; + coords[0] = bounds[0]; + } else + shift[0] = 0.f; + + /* bound y */ + if (coords[1] < bounds[1]) { + shift[1] = bounds[1] - coords[1]; + coords[3] -= shift[1]; + coords[1] = bounds[1]; + } else + shift[1] = 0.f; + + shift[2] = bounds[2] - coords[2]; + shift[3] = bounds[3] - coords[3]; + /* bound width/height */ + coords[2] = MIN2(coords[2], bounds[2]); + coords[3] = MIN2(coords[3], bounds[3]); + + /* bound x/y + width/height */ + if ((coords[0] + coords[2]) > (bounds[0] + bounds[2])) { + coords[2] = (bounds[0] + bounds[2]) - coords[0]; + } + if ((coords[1] + coords[3]) > (bounds[1] + bounds[3])) { + coords[3] = (bounds[1] + bounds[3]) - coords[1]; + } + + /* if outside the bounds */ + if ((coords[0] + coords[2]) < bounds[0] || + (coords[1] + coords[3]) < bounds[1]) { + coords[0] = 0.f; + coords[1] = 0.f; + coords[2] = 0.f; + coords[3] = 0.f; + return; + } +} + +static INLINE void sync_size(float *src_loc, float *dst_loc) +{ + src_loc[2] = MIN2(src_loc[2], dst_loc[2]); + src_loc[3] = MIN2(src_loc[3], dst_loc[3]); + dst_loc[2] = src_loc[2]; + dst_loc[3] = src_loc[3]; +} + +static void renderer_copy_texture(struct xorg_renderer *r, + struct pipe_texture *src, + float sx1, float sy1, + float sx2, float sy2, + struct pipe_texture *dst, + float dx1, float dy1, + float dx2, float dy2) +{ + struct pipe_context *pipe = r->pipe; + struct pipe_screen *screen = pipe->screen; + struct pipe_buffer *buf; + struct pipe_surface *dst_surf = screen->get_tex_surface( + screen, dst, 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_WRITE); + struct pipe_framebuffer_state fb; + float s0, t0, s1, t1; + struct xorg_shader shader; + + assert(src->width[0] != 0); + assert(src->height[0] != 0); + assert(dst->width[0] != 0); + assert(dst->height[0] != 0); + +#if 1 + s0 = sx1 / src->width[0]; + s1 = sx2 / src->width[0]; + t0 = sy1 / src->height[0]; + t1 = sy2 / src->height[0]; +#else + s0 = 0; + s1 = 1; + t0 = 0; + t1 = 1; +#endif + +#if 0 + debug_printf("copy texture src=[%f, %f, %f, %f], dst=[%f, %f, %f, %f], tex=[%f, %f, %f, %f]\n", + sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, + s0, t0, s1, t1); +#endif + + assert(screen->is_format_supported(screen, dst_surf->format, + PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_RENDER_TARGET, + 0)); + + /* save state (restored below) */ + cso_save_blend(r->cso); + cso_save_samplers(r->cso); + cso_save_sampler_textures(r->cso); + cso_save_framebuffer(r->cso); + cso_save_fragment_shader(r->cso); + cso_save_vertex_shader(r->cso); + + cso_save_viewport(r->cso); + + + /* set misc state we care about */ + { + struct pipe_blend_state blend; + memset(&blend, 0, sizeof(blend)); + blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE; + blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE; + blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO; + blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO; + blend.colormask = PIPE_MASK_RGBA; + cso_set_blend(r->cso, &blend); + } + + /* sampler */ + { + struct pipe_sampler_state sampler; + memset(&sampler, 0, sizeof(sampler)); + sampler.wrap_s = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + sampler.wrap_t = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + sampler.wrap_r = PIPE_TEX_WRAP_CLAMP_TO_EDGE; + sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NONE; + sampler.min_img_filter = PIPE_TEX_FILTER_NEAREST; + sampler.mag_img_filter = PIPE_TEX_FILTER_NEAREST; + sampler.normalized_coords = 1; + cso_single_sampler(r->cso, 0, &sampler); + cso_single_sampler_done(r->cso); + } + + set_viewport(r, dst_surf->width, dst_surf->height, Y0_TOP); + + /* texture */ + cso_set_sampler_textures(r->cso, 1, &src); + + renderer_bind_rasterizer(r); + + /* shaders */ + shader = xorg_shaders_get(r->shaders, + VS_COMPOSITE, + FS_COMPOSITE); + cso_set_vertex_shader_handle(r->cso, shader.vs); + cso_set_fragment_shader_handle(r->cso, shader.fs); + + /* drawing dest */ + memset(&fb, 0, sizeof(fb)); + fb.width = dst_surf->width; + fb.height = dst_surf->height; + fb.nr_cbufs = 1; + fb.cbufs[0] = dst_surf; + { + int i; + for (i = 1; i < PIPE_MAX_COLOR_BUFS; ++i) + fb.cbufs[i] = 0; + } + cso_set_framebuffer(r->cso, &fb); + setup_vs_constant_buffer(r, fb.width, fb.height); + setup_fs_constant_buffer(r); + + /* draw quad */ + buf = setup_vertex_data_tex(r, + dx1, dy1, + dx2, dy2, + s0, t0, s1, t1, + 0.0f); + + if (buf) { + util_draw_vertex_buffer(r->pipe, buf, 0, + PIPE_PRIM_TRIANGLE_FAN, + 4, /* verts */ + 2); /* attribs/vert */ + + pipe_buffer_reference(&buf, NULL); + } + + /* restore state we changed */ + cso_restore_blend(r->cso); + cso_restore_samplers(r->cso); + cso_restore_sampler_textures(r->cso); + cso_restore_framebuffer(r->cso); + cso_restore_vertex_shader(r->cso); + cso_restore_fragment_shader(r->cso); + cso_restore_viewport(r->cso); + + pipe_surface_reference(&dst_surf, NULL); +} + +static struct pipe_texture * +create_sampler_texture(struct xorg_renderer *r, + struct pipe_texture *src) +{ + enum pipe_format format; + struct pipe_context *pipe = r->pipe; + struct pipe_screen *screen = pipe->screen; + struct pipe_texture *pt; + struct pipe_texture templ; + + pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); + + /* the coming in texture should already have that invariance */ + debug_assert(screen->is_format_supported(screen, src->format, + PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_SAMPLER, 0)); + + format = src->format; + + memset(&templ, 0, sizeof(templ)); + templ.target = PIPE_TEXTURE_2D; + templ.format = format; + templ.last_level = 0; + templ.width[0] = src->width[0]; + templ.height[0] = src->height[0]; + templ.depth[0] = 1; + pf_get_block(format, &templ.block); + templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; + + pt = screen->texture_create(screen, &templ); + + debug_assert(!pt || pipe_is_referenced(&pt->reference)); + + if (!pt) + return NULL; + + { + /* copy source framebuffer surface into texture */ + struct pipe_surface *ps_read = screen->get_tex_surface( + screen, src, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_READ); + struct pipe_surface *ps_tex = screen->get_tex_surface( + screen, pt, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE ); + pipe->surface_copy(pipe, + ps_tex, /* dest */ + 0, 0, /* destx/y */ + ps_read, + 0, 0, src->width[0], src->height[0]); + pipe_surface_reference(&ps_read, NULL); + pipe_surface_reference(&ps_tex, NULL); + } + + return pt; +} + + +void renderer_copy_pixmap(struct xorg_renderer *r, + struct exa_pixmap_priv *dst_priv, int dx, int dy, + struct exa_pixmap_priv *src_priv, int sx, int sy, + int width, int height) +{ + float dst_loc[4], src_loc[4]; + float dst_bounds[4], src_bounds[4]; + float src_shift[4], dst_shift[4], shift[4]; + struct pipe_texture *dst = dst_priv->tex; + struct pipe_texture *src = src_priv->tex; + + if (r->pipe->is_texture_referenced(r->pipe, src, 0, 0) & + PIPE_REFERENCED_FOR_WRITE) + r->pipe->flush(r->pipe, PIPE_FLUSH_RENDER_CACHE, NULL); + + dst_loc[0] = dx; + dst_loc[1] = dy; + dst_loc[2] = width; + dst_loc[3] = height; + dst_bounds[0] = 0.f; + dst_bounds[1] = 0.f; + dst_bounds[2] = dst->width[0]; + dst_bounds[3] = dst->height[0]; + + src_loc[0] = sx; + src_loc[1] = sy; + src_loc[2] = width; + src_loc[3] = height; + src_bounds[0] = 0.f; + src_bounds[1] = 0.f; + src_bounds[2] = src->width[0]; + src_bounds[3] = src->height[0]; + + bound_rect(src_loc, src_bounds, src_shift); + bound_rect(dst_loc, dst_bounds, dst_shift); + shift[0] = src_shift[0] - dst_shift[0]; + shift[1] = src_shift[1] - dst_shift[1]; + + if (shift[0] < 0) + shift_rectx(src_loc, src_bounds, -shift[0]); + else + shift_rectx(dst_loc, dst_bounds, shift[0]); + + if (shift[1] < 0) + shift_recty(src_loc, src_bounds, -shift[1]); + else + shift_recty(dst_loc, dst_bounds, shift[1]); + + sync_size(src_loc, dst_loc); + + if (src_loc[2] >= 0 && src_loc[3] >= 0 && + dst_loc[2] >= 0 && dst_loc[3] >= 0) { + struct pipe_texture *temp_src = src; + + if (src == dst) + temp_src = create_sampler_texture(r, src); + + renderer_copy_texture(r, + temp_src, + src_loc[0], + src_loc[1], + src_loc[0] + src_loc[2], + src_loc[1] + src_loc[3], + dst, + dst_loc[0], + dst_loc[1], + dst_loc[0] + dst_loc[2], + dst_loc[1] + dst_loc[3]); + + if (src == dst) + pipe_texture_reference(&temp_src, NULL); + } +} + +void renderer_draw_solid_rect(struct xorg_renderer *r, + int x0, int y0, + int x1, int y1, + float *color) +{ + struct pipe_context *pipe = r->pipe; + struct pipe_buffer *buf = 0; + + /* 1st vertex */ + setup_vertex0(r->vertices2[0], x0, y0, color); + /* 2nd vertex */ + setup_vertex0(r->vertices2[1], x1, y0, color); + /* 3rd vertex */ + setup_vertex0(r->vertices2[2], x1, y1, color); + /* 4th vertex */ + setup_vertex0(r->vertices2[3], x0, y1, color); + + buf = pipe_user_buffer_create(pipe->screen, + r->vertices2, + sizeof(r->vertices2)); + + + if (buf) { + util_draw_vertex_buffer(pipe, buf, 0, + PIPE_PRIM_TRIANGLE_FAN, + 4, /* verts */ + 2); /* attribs/vert */ + + pipe_buffer_reference(&buf, NULL); + } +} + +void renderer_draw_textures(struct xorg_renderer *r, + int *pos, + int width, int height, + struct pipe_texture **textures, + int num_textures) +{ + struct pipe_context *pipe = r->pipe; + struct pipe_buffer *buf = 0; + + switch(num_textures) { + case 1: + buf = setup_vertex_data1(r, + pos[0], pos[1], /* src */ + pos[4], pos[5], /* dst */ + width, height, + textures[0]); + break; + case 2: + buf = setup_vertex_data2(r, + pos[0], pos[1], /* src */ + pos[2], pos[3], /* mask */ + pos[4], pos[5], /* dst */ + width, height, + textures[0], textures[1]); + break; + default: + debug_assert(!"Unsupported number of textures"); + break; + } + + if (buf) { + int num_attribs = 1; /*pos*/ + num_attribs += num_textures; + + util_draw_vertex_buffer(pipe, buf, 0, + PIPE_PRIM_TRIANGLE_FAN, + 4, /* verts */ + num_attribs); /* attribs/vert */ + + pipe_buffer_reference(&buf, NULL); + } +} diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h new file mode 100644 index 0000000000..b6296d5fd6 --- /dev/null +++ b/src/gallium/state_trackers/xorg/xorg_renderer.h @@ -0,0 +1,53 @@ +#ifndef XORG_RENDERER_H +#define XORG_RENDERER_H + +#include "pipe/p_context.h" +#include "pipe/p_state.h" + +struct xorg_shaders; +struct exa_pixmap_priv; + +struct xorg_renderer { + struct pipe_context *pipe; + + struct cso_context *cso; + struct xorg_shaders *shaders; + + struct pipe_constant_buffer vs_const_buffer; + struct pipe_constant_buffer fs_const_buffer; + + /* we should combine these two */ + float vertices2[4][2][4]; + float vertices3[4][3][4]; +}; + +struct xorg_renderer *renderer_create(struct pipe_context *pipe); +void renderer_destroy(struct xorg_renderer *renderer); + +void renderer_bind_framebuffer(struct xorg_renderer *r, + struct exa_pixmap_priv *priv); +void renderer_bind_viewport(struct xorg_renderer *r, + struct exa_pixmap_priv *dst); +void renderer_bind_rasterizer(struct xorg_renderer *r); +void renderer_set_constants(struct xorg_renderer *r, + int shader_type, + const float *buffer, + int size); +void renderer_copy_pixmap(struct xorg_renderer *r, + struct exa_pixmap_priv *dst_priv, int dx, int dy, + struct exa_pixmap_priv *src_priv, int sx, int sy, + int width, int height); + +void renderer_draw_solid_rect(struct xorg_renderer *r, + int x0, int y0, + int x1, int y1, + float *color); + +void renderer_draw_textures(struct xorg_renderer *r, + int *pos, + int width, int height, + struct pipe_texture **textures, + int num_textures); + + +#endif diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h index db2f16f63e..24e1a4928e 100644 --- a/src/gallium/state_trackers/xorg/xorg_tracker.h +++ b/src/gallium/state_trackers/xorg/xorg_tracker.h @@ -51,6 +51,8 @@ #define DRV_ERROR(msg) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, msg); +struct exa_context; + typedef struct { int lastInstance; @@ -92,7 +94,7 @@ typedef struct _modesettingRec boolean ds_depth_bits_last; /* exa */ - void *exa; + struct exa_context *exa; Bool noEvict; Bool debug_fallback; diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index 27d52700ec..efac9275b2 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -4,10 +4,34 @@ #include #include +#include "xorg_exa.h" +#include "xorg_renderer.h" + +#include "pipe/p_screen.h" +#include "pipe/p_inlines.h" + /*XXX get these from pipe's texture limits */ #define IMAGE_MAX_WIDTH 2048 #define IMAGE_MAX_HEIGHT 2048 +#define RES_720P_X 1280 +#define RES_720P_Y 720 + + +/* The ITU-R BT.601 conversion matrix for SDTV. */ +static const float bt_601[] = { + 1.0, 0.0, 1.4075, + 1.0, -0.3455, -0.7169, + 1.0, 1.7790, 0. +}; + +/* The ITU-R BT.709 conversion matrix for HDTV. */ +static const float bt_709[] = { + 1.0, 0.0, 1.581, + 1.0, -0.1881, -0.47, + 1.0, 1.8629, 0. +}; + #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) static Atom xvBrightness, xvContrast; @@ -39,10 +63,17 @@ static XF86ImageRec Images[NUM_IMAGES] = { }; struct xorg_xv_port_priv { + struct xorg_renderer *r; + RegionRec clip; int brightness; int contrast; + + int current_set; + /* juggle two sets of seperate Y, U and V + * textures */ + struct pipe_texture *yuv[2][3]; }; @@ -106,6 +137,225 @@ query_best_size(ScrnInfoPtr pScrn, *p_h = drw_h; } +static INLINE struct pipe_texture * +create_component_texture(struct pipe_context *pipe, + int width, int height) +{ + struct pipe_screen *screen = pipe->screen; + struct pipe_texture *tex = 0; + struct pipe_texture templ; + + memset(&templ, 0, sizeof(templ)); + templ.target = PIPE_TEXTURE_2D; + templ.format = PIPE_FORMAT_L8_UNORM; + templ.last_level = 0; + templ.width[0] = width; + templ.height[0] = height; + templ.depth[0] = 1; + pf_get_block(PIPE_FORMAT_L8_UNORM, &templ.block); + templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; + + tex = screen->texture_create(screen, &templ); + + return tex; +} + +static int +check_yuv_textures(struct xorg_xv_port_priv *priv, int width, int height) +{ + struct pipe_texture **dst = priv->yuv[priv->current_set]; + if (!dst[0] || + dst[0]->width[0] != width || + dst[0]->height[0] != height) { + pipe_texture_reference(&dst[0], NULL); + } + if (!dst[1] || + dst[1]->width[0] != width || + dst[1]->height[0] != height) { + pipe_texture_reference(&dst[1], NULL); + } + if (!dst[2] || + dst[2]->width[0] != width || + dst[2]->height[0] != height) { + pipe_texture_reference(&dst[2], NULL); + } + + if (!dst[0]) + dst[0] = create_component_texture(priv->r->pipe, width, height); + + if (!dst[1]) + dst[1] = create_component_texture(priv->r->pipe, width, height); + + if (!dst[2]) + dst[2] = create_component_texture(priv->r->pipe, width, height); + + if (!dst[0] || !dst[1] || !dst[2]) + return BadAlloc; + + return Success; +} + +static void +copy_packed_data(ScrnInfoPtr pScrn, + struct xorg_xv_port_priv *port, + int id, + unsigned char *buf, + int srcPitch, + int left, + int top, + int w, int h) +{ + unsigned char *src; + int i, j; + struct pipe_texture **dst = port->yuv[port->current_set]; + struct pipe_transfer *ytrans, *utrans, *vtrans; + struct pipe_screen *screen = port->r->pipe->screen; + char *ymap, *vmap, *umap; + unsigned char y1, y2, u, v; + int yidx, uidx, vidx; + + src = buf + (top * srcPitch) + (left << 1); + + ytrans = screen->get_tex_transfer(screen, dst[0], + 0, 0, 0, + PIPE_TRANSFER_WRITE, + left, top, w, h); + utrans = screen->get_tex_transfer(screen, dst[1], + 0, 0, 0, + PIPE_TRANSFER_WRITE, + left, top, w, h); + vtrans = screen->get_tex_transfer(screen, dst[2], + 0, 0, 0, + PIPE_TRANSFER_WRITE, + left, top, w, h); + + ymap = screen->transfer_map(screen, ytrans); + umap = screen->transfer_map(screen, utrans); + vmap = screen->transfer_map(screen, vtrans); + + switch (id) { + case FOURCC_YV12: { + int y_array_size = w * h; + for (i = 0; i < w; ++i) { + for (j = 0; i < h; ++j) { + /*XXX use src? */ + y1 = buf[j*w + i]; + u = buf[(j/2) * (w/2) + i/2 + y_array_size]; + v = buf[(j/2) * (w/2) + i/2 + y_array_size + y_array_size/4]; + ymap[yidx++] = y1; + umap[uidx++] = u; + vmap[vidx++] = v; + } + } + } + break; + case FOURCC_YUY2: + for (j = 0; j < h; ++j) { + for (i = 0; i < w; ++i) { + /* extracting two pixels */ + y1 = buf[0]; + u = buf[1]; + y2 = buf[2]; + v = buf[3]; + + ymap[yidx++] = y1; + ymap[yidx++] = y2; + umap[uidx++] = u; + umap[uidx++] = u; + vmap[vidx++] = v; + vmap[vidx++] = v; + } + } + break; + default: + debug_assert(!"Unsupported yuv format!"); + break; + } + + screen->transfer_unmap(screen, ytrans); + screen->transfer_unmap(screen, utrans); + screen->transfer_unmap(screen, vtrans); + screen->tex_transfer_destroy(ytrans); + screen->tex_transfer_destroy(utrans); + screen->tex_transfer_destroy(vtrans); +} + +static void +setup_video_constants(struct xorg_renderer *r, boolean hdtv) +{ + struct pipe_context *pipe = r->pipe; + const int param_bytes = 9 * sizeof(float); + struct pipe_constant_buffer *cbuf = &r->vs_const_buffer; + + pipe_buffer_reference(&cbuf->buffer, NULL); + cbuf->buffer = pipe_buffer_create(pipe->screen, 16, + PIPE_BUFFER_USAGE_CONSTANT, + param_bytes); + + if (cbuf->buffer) { + const float *video_constants = (hdtv) ? bt_709 : bt_601; + + pipe_buffer_write(pipe->screen, cbuf->buffer, + 0, param_bytes, video_constants); + } + pipe->set_constant_buffer(pipe, PIPE_SHADER_FRAGMENT, 0, cbuf); +} + +static int +display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id, + RegionPtr dstRegion, + short width, short height, + int x1, int y1, int x2, int y2, + short src_w, short src_h, short drw_w, short drw_h, + PixmapPtr pPixmap) +{ + BoxPtr pbox; + int nbox; + int dxo, dyo; + Bool hdtv; + float tc0[2], tc1[2], tc2[2]; + + hdtv = ((src_w >= RES_720P_X) && (src_h >= RES_720P_Y)); + setup_video_constants(pPriv->r, hdtv); + + REGION_TRANSLATE(pScrn->pScreen, dstRegion, -pPixmap->screen_x, + -pPixmap->screen_y); + + dxo = dstRegion->extents.x1; + dyo = dstRegion->extents.y1; + + pbox = REGION_RECTS(dstRegion); + nbox = REGION_NUM_RECTS(dstRegion); + + while (nbox--) { + int box_x1 = pbox->x1; + int box_y1 = pbox->y1; + int box_x2 = pbox->x2; + int box_y2 = pbox->y2; + + tc0[0] = (double) (box_x1 - dxo) / (double) drw_w; /* u0 */ + tc0[1] = (double) (box_y1 - dyo) / (double) drw_h; /* v0 */ + tc1[0] = (double) (box_x2 - dxo) / (double) drw_w; /* u1 */ + tc1[1] = tc0[1]; + tc2[0] = tc0[0]; + tc2[1] = (double) (box_y2 - dyo) / (double) drw_h; /* v1 */ + +#if 0 + x = box_x1; + y = box_y1; + w = box_x2 - box_x1; + h = box_y2 - box_y1; + + pbox++; + draw_yuv(pScrn, x, y, w, h, &src, 1, FALSE, + 0, tc0, tc1, tc2, 1, + pPriv->conversionData); +#endif + } + DamageDamageRegion(&pPixmap->drawable, dstRegion); + return TRUE; +} + static int put_image(ScrnInfoPtr pScrn, short src_x, short src_y, @@ -117,7 +367,57 @@ put_image(ScrnInfoPtr pScrn, Bool sync, RegionPtr clipBoxes, pointer data, DrawablePtr pDraw) { - return 0; + struct xorg_xv_port_priv *pPriv = (struct xorg_xv_port_priv *) data; + ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; + PixmapPtr pPixmap; + INT32 x1, x2, y1, y2; + int srcPitch; + BoxRec dstBox; + int ret; + + /* Clip */ + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + if (!xf86XVClipVideoHelper(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, + width, height)) + return Success; + + switch (id) { + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + srcPitch = width << 1; + break; + } + + ret = check_yuv_textures(pPriv, width, height); + + if (ret) + return ret; + + copy_packed_data(pScrn, pPriv, id, buf, srcPitch, + src_x, src_y, width, height); + + if (pDraw->type == DRAWABLE_WINDOW) { + pPixmap = (*pScreen->GetWindowPixmap)((WindowPtr)pDraw); + } else { + pPixmap = (PixmapPtr)pDraw; + } + + display_video(pScrn, pPriv, id, clipBoxes, width, height, + x1, y1, x2, y2, + src_w, src_h, drw_w, drw_h, pPixmap); + + pPriv->current_set = (pPriv->current_set + 1) & 1; + return Success; } static int @@ -152,10 +452,8 @@ query_image_attributes(ScrnInfoPtr pScrn, } static struct xorg_xv_port_priv * -port_priv_create(ScreenPtr pScreen) +port_priv_create(struct xorg_renderer *r) { - /*ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];*/ - /*modesettingPtr ms = modesettingPTR(pScrn);*/ struct xorg_xv_port_priv *priv = NULL; priv = calloc(1, sizeof(struct xorg_xv_port_priv)); @@ -163,16 +461,20 @@ port_priv_create(ScreenPtr pScreen) if (!priv) return NULL; + priv->r = r; + REGION_NULL(pScreen, &priv->clip); + debug_assert(priv && priv->r); + return priv; } static XF86VideoAdaptorPtr xorg_setup_textured_adapter(ScreenPtr pScreen) { - /*ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];*/ - /*modesettingPtr ms = modesettingPTR(pScrn);*/ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + modesettingPtr ms = modesettingPTR(pScrn); XF86VideoAdaptorPtr adapt; XF86AttributePtr attrs; DevUnion *dev_unions; @@ -181,6 +483,9 @@ xorg_setup_textured_adapter(ScreenPtr pScreen) nattributes = NUM_TEXTURED_ATTRIBUTES; + debug_assert(ms->exa); + debug_assert(ms->exa->renderer); + adapt = calloc(1, sizeof(XF86VideoAdaptorRec)); dev_unions = calloc(nports, sizeof(DevUnion)); attrs = calloc(nattributes, sizeof(XF86AttributeRec)); @@ -218,7 +523,7 @@ xorg_setup_textured_adapter(ScreenPtr pScreen) for (i = 0; i < nports; i++) { struct xorg_xv_port_priv *priv = - port_priv_create(pScreen); + port_priv_create(ms->exa->renderer); adapt->pPortPrivates[i].ptr = (pointer) (priv); adapt->nPorts++; -- cgit v1.2.3 From 150d4968e31e4600f9479c53f83d810b92b59cf7 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Sun, 11 Oct 2009 21:52:10 -0400 Subject: st/xorg: initialize pipe in the renderer --- src/gallium/state_trackers/xorg/xorg_renderer.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 362fb6f4f1..1eecf7d2b9 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -186,6 +186,7 @@ struct xorg_renderer * renderer_create(struct pipe_context *pipe) { struct xorg_renderer *renderer = CALLOC_STRUCT(xorg_renderer); + renderer->pipe = pipe; renderer->cso = cso_create_context(pipe); renderer->shaders = xorg_shaders_create(renderer); -- cgit v1.2.3 From 97dd35bd6f2e2654b96923fd06bf9761e7b2269d Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Mon, 12 Oct 2009 12:20:26 +0300 Subject: r600: DPH adds w comp of second operand, so set first one to 1 instead --- src/mesa/drivers/dri/r600/r700_assembler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index fefae22ba7..a1331fdfd2 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -2635,7 +2635,7 @@ GLboolean assemble_DOT(r700_AssemblerBase *pAsm) } else if(pAsm->pILInst[pAsm->uiCurInst].Opcode == OPCODE_DPH) { - onecomp_PVSSRC(&(pAsm->S[1].src), 3); + onecomp_PVSSRC(&(pAsm->S[0].src), 3); } if ( GL_FALSE == next_ins(pAsm) ) -- cgit v1.2.3 From da66d9e12d339c5c6df08ea0bd11a550c9c57b36 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Mon, 12 Oct 2009 12:58:40 +0300 Subject: r600: LIT dst.y gets value from src.x seems I overlooked this when removing hardcoded swizzles for this one previously --- src/mesa/drivers/dri/r600/r700_assembler.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index a1331fdfd2..ed597c027b 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -3026,6 +3026,7 @@ GLboolean assemble_LIT(r700_AssemblerBase *pAsm) pAsm->S[0].src.rtype = srcType; pAsm->S[0].src.reg = srcReg; setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X, SQ_SEL_X, SQ_SEL_X, SQ_SEL_X); pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; pAsm->S[1].src.reg = tmp; setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); -- cgit v1.2.3 From 7a32c0a19e77e2e735f8d5cbc5b3bb9fda9606e5 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Mon, 12 Oct 2009 14:57:45 +0300 Subject: r600: implement ProgramStringNotify need this to properly test with piglit/glean vert/fragprog tests copied mostly from r300, many thanks to osiris, nha, airlied, others... --- src/mesa/drivers/dri/r600/r700_oglprog.c | 55 ++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_oglprog.c b/src/mesa/drivers/dri/r600/r700_oglprog.c index 5290ef31be..0d476fcd86 100644 --- a/src/mesa/drivers/dri/r600/r700_oglprog.c +++ b/src/mesa/drivers/dri/r600/r700_oglprog.c @@ -40,6 +40,24 @@ #include "r700_vertprog.h" +static void freeVertProgCache(GLcontext *ctx, struct r700_vertex_program_cont *cache) +{ + struct r700_vertex_program *tmp, *vp = cache->progs; + + while (vp) { + tmp = vp->next; + /* Release DMA region */ + r600DeleteShader(ctx, vp->shaderbo); + /* Clean up */ + Clean_Up_Assembler(&(vp->r700AsmCode)); + Clean_Up_Shader(&(vp->r700Shader)); + + _mesa_reference_vertprog(ctx, &vp->mesa_program, NULL); + _mesa_free(vp); + vp = tmp; + } +} + static struct gl_program *r700NewProgram(GLcontext * ctx, GLenum target, GLuint id) @@ -84,8 +102,7 @@ static struct gl_program *r700NewProgram(GLcontext * ctx, static void r700DeleteProgram(GLcontext * ctx, struct gl_program *prog) { - struct r700_vertex_program_cont * vpc; - struct r700_vertex_program *vp, *tmp; + struct r700_vertex_program_cont *vpc = (struct r700_vertex_program_cont *)prog; struct r700_fragment_program * fp; radeon_print(RADEON_SHADER, RADEON_VERBOSE, @@ -95,20 +112,7 @@ static void r700DeleteProgram(GLcontext * ctx, struct gl_program *prog) { case GL_VERTEX_STATE_PROGRAM_NV: case GL_VERTEX_PROGRAM_ARB: - vpc = (struct r700_vertex_program_cont*)prog; - vp = vpc->progs; - while (vp) { - tmp = vp->next; - /* Release DMA region */ - - r600DeleteShader(ctx, vp->shaderbo); - - /* Clean up */ - Clean_Up_Assembler(&(vp->r700AsmCode)); - Clean_Up_Shader(&(vp->r700Shader)); - _mesa_free(vp); - vp = tmp; - } + freeVertProgCache(ctx, vpc); break; case GL_FRAGMENT_PROGRAM_NV: case GL_FRAGMENT_PROGRAM_ARB: @@ -131,7 +135,24 @@ static void r700DeleteProgram(GLcontext * ctx, struct gl_program *prog) static void r700ProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog) { - + struct r700_vertex_program_cont *vpc = (struct r700_vertex_program_cont *)prog; + struct r700_fragment_program * fp = (struct r700_fragment_program*)prog; + + switch (target) { + case GL_VERTEX_PROGRAM_ARB: + freeVertProgCache(ctx, vpc); + vpc->progs = NULL; + break; + case GL_FRAGMENT_PROGRAM_ARB: + r600DeleteShader(ctx, fp->shaderbo); + Clean_Up_Assembler(&(fp->r700AsmCode)); + Clean_Up_Shader(&(fp->r700Shader)); + fp->translated = GL_FALSE; + fp->loaded = GL_FALSE; + fp->shaderbo = NULL; + break; + } + } static GLboolean r700IsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog) -- cgit v1.2.3 From a5348d435da7d06478adc003a07e388915a8b346 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Mon, 12 Oct 2009 21:03:26 +0200 Subject: Add support for more 8 and 16 bits formats --- src/gallium/drivers/nv04/nv04_surface_2d.c | 11 ++++++++++- src/gallium/drivers/nv30/nv30_miptree.c | 5 +++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nv04/nv04_surface_2d.c b/src/gallium/drivers/nv04/nv04_surface_2d.c index b2ab50ee21..8c7eb367e2 100644 --- a/src/gallium/drivers/nv04/nv04_surface_2d.c +++ b/src/gallium/drivers/nv04/nv04_surface_2d.c @@ -13,10 +13,13 @@ nv04_surface_format(enum pipe_format format) { switch (format) { case PIPE_FORMAT_A8_UNORM: + case PIPE_FORMAT_L8_UNORM: + case PIPE_FORMAT_I8_UNORM: return NV04_CONTEXT_SURFACES_2D_FORMAT_Y8; case PIPE_FORMAT_R16_SNORM: case PIPE_FORMAT_R5G6B5_UNORM: case PIPE_FORMAT_Z16_UNORM: + case PIPE_FORMAT_A8L8_UNORM: return NV04_CONTEXT_SURFACES_2D_FORMAT_R5G6B5; case PIPE_FORMAT_X8R8G8B8_UNORM: case PIPE_FORMAT_A8R8G8B8_UNORM: @@ -36,6 +39,7 @@ nv04_rect_format(enum pipe_format format) case PIPE_FORMAT_A8_UNORM: return NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A8R8G8B8; case PIPE_FORMAT_R5G6B5_UNORM: + case PIPE_FORMAT_A8L8_UNORM: case PIPE_FORMAT_Z16_UNORM: return NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A16R5G6B5; case PIPE_FORMAT_A8R8G8B8_UNORM: @@ -51,6 +55,10 @@ static INLINE int nv04_scaled_image_format(enum pipe_format format) { switch (format) { + case PIPE_FORMAT_A8_UNORM: + case PIPE_FORMAT_L8_UNORM: + case PIPE_FORMAT_I8_UNORM: + return NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_Y8; case PIPE_FORMAT_A1R5G5B5_UNORM: return NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_A1R5G5B5; case PIPE_FORMAT_A8R8G8B8_UNORM: @@ -59,6 +67,7 @@ nv04_scaled_image_format(enum pipe_format format) return NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_X8R8G8B8; case PIPE_FORMAT_R5G6B5_UNORM: case PIPE_FORMAT_R16_SNORM: + case PIPE_FORMAT_A8L8_UNORM: return NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_FORMAT_R5G6B5; default: return -1; @@ -131,7 +140,7 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx, OUT_RING (chan, nv04_surface_format(dst->format) | log2i(dst->width) << NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_U_SHIFT | log2i(dst->height) << NV04_SWIZZLED_SURFACE_FORMAT_BASE_SIZE_V_SHIFT); - + BEGIN_RING(chan, sifm, NV04_SCALED_IMAGE_FROM_MEMORY_DMA_IMAGE, 1); OUT_RELOCo(chan, src_bo, NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_RD); diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c index 7f8054de73..17acca61ab 100644 --- a/src/gallium/drivers/nv30/nv30_miptree.c +++ b/src/gallium/drivers/nv30/nv30_miptree.c @@ -96,6 +96,11 @@ nv30_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt) case PIPE_FORMAT_A8R8G8B8_UNORM: case PIPE_FORMAT_X8R8G8B8_UNORM: case PIPE_FORMAT_R16_SNORM: + case PIPE_FORMAT_R5G6B5_UNORM: + case PIPE_FORMAT_A8L8_UNORM: + case PIPE_FORMAT_A8_UNORM: + case PIPE_FORMAT_L8_UNORM: + case PIPE_FORMAT_I8_UNORM: { if (debug_get_bool_option("NOUVEAU_NO_SWIZZLE", FALSE)) mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR; -- cgit v1.2.3 From 6c1cd4c55856dc7d36406de21a0fb5f567fcd36f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 9 Oct 2009 08:29:28 -0600 Subject: mesa: print program Id when printing --- src/mesa/shader/prog_print.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index b71735aa80..a2bed07900 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -788,7 +788,7 @@ _mesa_fprint_program_opt(FILE *f, else if (mode == PROG_PRINT_NV) _mesa_fprintf(f, "!!VP1.0\n"); else - _mesa_fprintf(f, "# Vertex Program/Shader\n"); + _mesa_fprintf(f, "# Vertex Program/Shader %u\n", prog->Id); break; case GL_FRAGMENT_PROGRAM_ARB: case GL_FRAGMENT_PROGRAM_NV: @@ -797,7 +797,7 @@ _mesa_fprint_program_opt(FILE *f, else if (mode == PROG_PRINT_NV) _mesa_fprintf(f, "!!FP1.0\n"); else - _mesa_fprintf(f, "# Fragment Program/Shader\n"); + _mesa_fprintf(f, "# Fragment Program/Shader %u\n", prog->Id); break; } -- cgit v1.2.3 From 15d2ef602461ca75e7160af46a2b5040742a91c9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 12 Oct 2009 17:32:16 -0600 Subject: i965: remove unused var --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') 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 9c28a22a29..f7cc5153a8 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -693,7 +693,6 @@ brw_wm_get_binding_table(struct brw_context *brw) static void prepare_wm_surfaces(struct brw_context *brw ) { GLcontext *ctx = &brw->intel.ctx; - struct intel_context *intel = &brw->intel; GLuint i; int old_nr_surfaces; -- cgit v1.2.3 From e6594a22f298833eeb6881795b24d03d2fd8e898 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 12 Oct 2009 17:37:06 -0600 Subject: intel: pass zslice to intel_miptree_image_offset() This lets us get rid of intel_miptree_depth_offsets() and simplify all of the calling code. --- src/mesa/drivers/dri/i915/i830_texstate.c | 5 +-- src/mesa/drivers/dri/i915/i915_texstate.c | 5 +-- src/mesa/drivers/dri/intel/intel_fbo.c | 11 +---- src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 61 +++++++++++--------------- src/mesa/drivers/dri/intel/intel_mipmap_tree.h | 14 ++---- src/mesa/drivers/dri/intel/intel_tex_copy.c | 2 +- src/mesa/drivers/dri/intel/intel_tex_image.c | 7 +-- 7 files changed, 40 insertions(+), 65 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index 6f998fa6f7..f270a13781 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -162,9 +162,8 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) } else { dri_bo_reference(intelObj->mt->region->buffer); i830->state.tex_buffer[unit] = intelObj->mt->region->buffer; - i830->state.tex_offset[unit] = intel_miptree_image_offset(intelObj->mt, - 0, intelObj-> - firstLevel); + i830->state.tex_offset[unit] = + intel_miptree_image_offset(intelObj->mt, 0, intelObj->firstLevel, 0); format = translate_texture_format(firstImage->TexFormat->MesaFormat, firstImage->InternalFormat); diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index 32d4b30cf9..b2f82f5655 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -173,9 +173,8 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) } else { dri_bo_reference(intelObj->mt->region->buffer); i915->state.tex_buffer[unit] = intelObj->mt->region->buffer; - i915->state.tex_offset[unit] = intel_miptree_image_offset(intelObj->mt, - 0, intelObj-> - firstLevel); + i915->state.tex_offset[unit] = + intel_miptree_image_offset(intelObj->mt, 0, intelObj->firstLevel, 0); format = translate_texture_format(firstImage->TexFormat->MesaFormat, firstImage->InternalFormat, diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 8dfb24290d..2e61371805 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -618,15 +618,8 @@ intel_render_texture(GLcontext * ctx, } /* compute offset of the particular 2D image within the texture region */ - imageOffset = intel_miptree_image_offset(intel_image->mt, - att->CubeMapFace, - att->TextureLevel); - - if (att->Texture->Target == GL_TEXTURE_3D) { - const GLuint *offsets = intel_miptree_depth_offsets(intel_image->mt, - att->TextureLevel); - imageOffset += offsets[att->Zoffset]; - } + imageOffset = intel_miptree_image_offset(intel_image->mt, att->CubeMapFace, + att->TextureLevel, att->Zoffset); /* store that offset in the region */ intel_image->mt->region->draw_offset = imageOffset; diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 4f5101a312..d9d2edfe19 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -395,33 +395,26 @@ intel_miptree_set_image_offset(struct intel_mipmap_tree *mt, } -/* Although we use the image_offset[] array to store relative offsets - * to cube faces, Mesa doesn't know anything about this and expects - * each cube face to be treated as a separate image. - * - * These functions present that view to mesa: +/** + * Return offset to the start of a 2D slice of a texture (a mipmap level, + * cube face, 3D Z slice). + * \param mt the texture object/miptree + * \param face cube map face in [0,5] or zero for non-cube textures + * \param level mipmap level + * \param zslice Z slice of a 3D texture, or zero for non-3D textures */ -const GLuint * -intel_miptree_depth_offsets(struct intel_mipmap_tree *mt, GLuint level) -{ - static const GLuint zero = 0; - - if (mt->target != GL_TEXTURE_3D || mt->level[level].nr_images == 1) - return &zero; - else - return mt->level[level].image_offset; -} - - GLuint -intel_miptree_image_offset(struct intel_mipmap_tree *mt, - GLuint face, GLuint level) +intel_miptree_image_offset(const struct intel_mipmap_tree *mt, + GLuint face, GLuint level, GLuint zslice) { + GLuint offset = mt->level[level].level_offset; + if (mt->target == GL_TEXTURE_CUBE_MAP_ARB) - return (mt->level[level].level_offset + - mt->level[level].image_offset[face]); - else - return mt->level[level].level_offset; + offset += mt->level[level].image_offset[face]; + else if (mt->target == GL_TEXTURE_3D) + offset += mt->level[level].image_offset[zslice]; + + return offset; } @@ -459,7 +452,7 @@ intel_miptree_image_map(struct intel_context * intel, } return (intel_region_map(intel, mt->region) + - intel_miptree_image_offset(mt, face, level)); + intel_miptree_image_offset(mt, face, level, 0)); } void @@ -484,19 +477,18 @@ intel_miptree_image_data(struct intel_context *intel, GLuint src_image_pitch) { GLuint depth = dst->level[level].depth; - GLuint dst_offset = intel_miptree_image_offset(dst, face, level); - const GLuint *dst_depth_offset = intel_miptree_depth_offsets(dst, level); GLuint i; GLuint height = 0; DBG("%s: %d/%d\n", __FUNCTION__, face, level); for (i = 0; i < depth; i++) { + GLuint dst_offset = intel_miptree_image_offset(dst, face, level, i); height = dst->level[level].height; if(dst->compressed) height = (height + 3) / 4; intel_region_data(intel, dst->region, - dst_offset + dst_depth_offset[i], /* dst_offset */ + dst_offset, 0, 0, /* dstx, dsty */ src, src_row_pitch, @@ -519,10 +511,6 @@ intel_miptree_image_copy(struct intel_context *intel, GLuint width = src->level[level].width; GLuint height = src->level[level].height; GLuint depth = src->level[level].depth; - GLuint dst_offset = intel_miptree_image_offset(dst, face, level); - GLuint src_offset = intel_miptree_image_offset(src, face, level); - const GLuint *dst_depth_offset = intel_miptree_depth_offsets(dst, level); - const GLuint *src_depth_offset = intel_miptree_depth_offsets(src, level); GLuint i; GLboolean success; @@ -535,10 +523,13 @@ intel_miptree_image_copy(struct intel_context *intel, } for (i = 0; i < depth; i++) { + GLuint dst_offset = intel_miptree_image_offset(dst, face, level, i); + GLuint src_offset = intel_miptree_image_offset(src, face, level, i); + success = intel_region_copy(intel, - dst->region, dst_offset + dst_depth_offset[i], + dst->region, dst_offset, 0, 0, - src->region, src_offset + src_depth_offset[i], + src->region, src_offset, 0, 0, width, height, GL_COPY); if (!success) { GLubyte *src_ptr, *dst_ptr; @@ -546,11 +537,11 @@ intel_miptree_image_copy(struct intel_context *intel, src_ptr = intel_region_map(intel, src->region); dst_ptr = intel_region_map(intel, dst->region); - _mesa_copy_rect(dst_ptr + dst_offset + dst_depth_offset[i], + _mesa_copy_rect(dst_ptr + dst_offset, dst->cpp, dst->pitch, 0, 0, width, height, - src_ptr + src_offset + src_depth_offset[i], + src_ptr + src_offset, src->pitch, 0, 0); intel_region_unmap(intel, src->region); diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h index c890b2a0d0..c08f9cd8b6 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h @@ -177,17 +177,9 @@ void intel_miptree_image_unmap(struct intel_context *intel, struct intel_mipmap_tree *mt); -/* Return the linear offset of an image relative to the start of the - * tree: - */ -GLuint intel_miptree_image_offset(struct intel_mipmap_tree *mt, - GLuint face, GLuint level); - -/* Return pointers to each 2d slice within an image. Indexed by depth - * value. - */ -const GLuint *intel_miptree_depth_offsets(struct intel_mipmap_tree *mt, - GLuint level); +GLuint +intel_miptree_image_offset(const struct intel_mipmap_tree *mt, + GLuint face, GLuint level, GLuint zslice); void intel_miptree_set_level_info(struct intel_mipmap_tree *mt, diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index f3e312420d..99cd818417 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -117,7 +117,7 @@ do_copy_texsubimage(struct intel_context *intel, INTEL_WRITE_PART); GLuint image_offset = intel_miptree_image_offset(intelImage->mt, intelImage->face, - intelImage->level); + intelImage->level, 0); const GLint orig_x = x; const GLint orig_y = y; GLshort src_pitch; diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 5c915178e7..dcc613449f 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -222,7 +222,8 @@ try_pbo_upload(struct intel_context *intel, dst_offset = intel_miptree_image_offset(intelImage->mt, intelImage->face, - intelImage->level); + intelImage->level, + 0 /* zslice */); dst_stride = intelImage->mt->pitch; @@ -281,8 +282,8 @@ try_pbo_zcopy(struct intel_context *intel, dst_offset = intel_miptree_image_offset(intelImage->mt, intelImage->face, - intelImage->level); - + intelImage->level, + 0 /* zslice */); dst_stride = intelImage->mt->pitch; if (src_stride != dst_stride || dst_offset != 0 || src_offset != 0) { -- cgit v1.2.3 From c932e21fa848562325f666dce5db3b09bc61bffa Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 12 Oct 2009 17:40:33 -0600 Subject: intel: code clean-ups --- src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index d9d2edfe19..cc23a8905a 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -476,16 +476,17 @@ intel_miptree_image_data(struct intel_context *intel, GLuint src_row_pitch, GLuint src_image_pitch) { - GLuint depth = dst->level[level].depth; + const GLuint depth = dst->level[level].depth; GLuint i; - GLuint height = 0; DBG("%s: %d/%d\n", __FUNCTION__, face, level); for (i = 0; i < depth; i++) { GLuint dst_offset = intel_miptree_image_offset(dst, face, level, i); - height = dst->level[level].height; - if(dst->compressed) + GLuint height = dst->level[level].height; + + if (dst->compressed) height = (height + 3) / 4; + intel_region_data(intel, dst->region, dst_offset, -- cgit v1.2.3 From b9c28979576a566055e44cb31f3e5c0cd82754e0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 12 Oct 2009 17:41:14 -0600 Subject: intel: added INLINE keyword to minify() This is mainly just to silence some warnings. --- src/mesa/drivers/dri/intel/intel_tex_layout.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_layout.h b/src/mesa/drivers/dri/intel/intel_tex_layout.h index c9de9b5678..a9ac9e7eb4 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_layout.h +++ b/src/mesa/drivers/dri/intel/intel_tex_layout.h @@ -33,7 +33,7 @@ #include "main/macros.h" -static GLuint minify( GLuint d ) +static INLINE GLuint minify( GLuint d ) { return MAX2(1, d>>1); } -- cgit v1.2.3 From 3732d0a77d2cbae50874f5a4ebdb3d8f06021a57 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 12 Oct 2009 17:41:47 -0600 Subject: intel: replace extern decl with #include --- src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index cc23a8905a..26ebcf3907 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -28,6 +28,7 @@ #include "intel_context.h" #include "intel_mipmap_tree.h" #include "intel_regions.h" +#include "intel_tex_layout.h" #include "intel_chipset.h" #ifndef I915 #include "brw_state.h" @@ -500,7 +501,7 @@ intel_miptree_image_data(struct intel_context *intel, } } -extern void intel_get_texture_alignment_unit(GLenum, GLuint *, GLuint *); + /* Copy mipmap image between trees */ void -- cgit v1.2.3 From 47a7535f413d6467082de224f64eecc046227406 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 12 Oct 2009 18:08:42 -0600 Subject: intel: whitespace/formatting clean-up --- src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 28 +++++++++++++++++--------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 26ebcf3907..01e9d4add3 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -37,6 +37,7 @@ #define FILE_DEBUG_FLAG DEBUG_MIPTREE + static GLenum target_to_target(GLenum target) { @@ -53,6 +54,7 @@ target_to_target(GLenum target) } } + static struct intel_mipmap_tree * intel_miptree_create_internal(struct intel_context *intel, GLenum target, @@ -102,6 +104,7 @@ intel_miptree_create_internal(struct intel_context *intel, return mt; } + struct intel_mipmap_tree * intel_miptree_create(struct intel_context *intel, GLenum target, @@ -154,6 +157,7 @@ intel_miptree_create(struct intel_context *intel, return mt; } + struct intel_mipmap_tree * intel_miptree_create_for_region(struct intel_context *intel, GLenum target, @@ -191,7 +195,8 @@ intel_miptree_create_for_region(struct intel_context *intel, intel_region_reference(&mt->region, region); return mt; - } +} + /** * intel_miptree_pitch_align: @@ -205,7 +210,6 @@ intel_miptree_create_for_region(struct intel_context *intel, * Given @pitch, compute a larger value which accounts for * any necessary alignment required by the device */ - int intel_miptree_pitch_align (struct intel_context *intel, struct intel_mipmap_tree *mt, uint32_t tiling, @@ -251,6 +255,7 @@ int intel_miptree_pitch_align (struct intel_context *intel, return pitch; } + void intel_miptree_reference(struct intel_mipmap_tree **dst, struct intel_mipmap_tree *src) @@ -260,6 +265,7 @@ intel_miptree_reference(struct intel_mipmap_tree **dst, DBG("%s %p refcount now %d\n", __FUNCTION__, src, src->refcount); } + void intel_miptree_release(struct intel_context *intel, struct intel_mipmap_tree **mt) @@ -298,9 +304,8 @@ intel_miptree_release(struct intel_context *intel, } - - -/* Can the image be pulled into a unified mipmap tree. This mirrors +/** + * Can the image be pulled into a unified mipmap tree? This mirrors * the completeness test in a lot of ways. * * Not sure whether I want to pass gl_texture_image here. @@ -387,6 +392,7 @@ intel_miptree_set_image_offset_ex(struct intel_mipmap_tree *mt, __FUNCTION__, level, img, x, y, mt->level[level].image_offset[img]); } + void intel_miptree_set_image_offset(struct intel_mipmap_tree *mt, GLuint level, GLuint img, @@ -419,7 +425,6 @@ intel_miptree_image_offset(const struct intel_mipmap_tree *mt, } - /** * Map a teximage in a mipmap tree. * \param row_stride returns row stride in bytes @@ -456,6 +461,7 @@ intel_miptree_image_map(struct intel_context * intel, intel_miptree_image_offset(mt, face, level, 0)); } + void intel_miptree_image_unmap(struct intel_context *intel, struct intel_mipmap_tree *mt) @@ -465,8 +471,8 @@ intel_miptree_image_unmap(struct intel_context *intel, } - -/* Upload data for a particular image. +/** + * Upload data for a particular image. */ void intel_miptree_image_data(struct intel_context *intel, @@ -502,7 +508,8 @@ intel_miptree_image_data(struct intel_context *intel, } -/* Copy mipmap image between trees +/** + * Copy mipmap image between trees */ void intel_miptree_image_copy(struct intel_context *intel, @@ -519,7 +526,8 @@ intel_miptree_image_copy(struct intel_context *intel, if (dst->compressed) { GLuint align_w, align_h; - intel_get_texture_alignment_unit(dst->internal_format, &align_w, &align_h); + intel_get_texture_alignment_unit(dst->internal_format, + &align_w, &align_h); height = (height + 3) / 4; width = ALIGN(width, align_w); } -- cgit v1.2.3 From b5d6a8e88fb970bce596adc10a8b22f6758591f0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 12 Oct 2009 18:09:32 -0600 Subject: mesa: minor clean up in check_begin_texture_render() --- src/mesa/main/fbobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 6e767bb24d..87061aeb0d 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1129,7 +1129,7 @@ check_begin_texture_render(GLcontext *ctx, struct gl_framebuffer *fb) struct gl_renderbuffer_attachment *att = fb->Attachment + i; struct gl_texture_object *texObj = att->Texture; if (texObj - && att->Texture->Image[att->CubeMapFace][att->TextureLevel]) { + && texObj->Image[att->CubeMapFace][att->TextureLevel]) { ctx->Driver.RenderTexture(ctx, fb, att); } } -- cgit v1.2.3 From 3f928b355275c0e76ead6febe471a552ece8b0a8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 12 Oct 2009 18:11:31 -0600 Subject: mesa: save/set/restore texture base/wrap state in blitframebuffer_texture() --- src/mesa/drivers/common/meta.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 02e771c8d8..9cba3a7600 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -1048,8 +1048,13 @@ blitframebuffer_texture(GLcontext *ctx, if (readAtt && readAtt->Texture) { const struct gl_texture_object *texObj = readAtt->Texture; + const GLuint srcLevel = readAtt->TextureLevel; const GLenum minFilterSave = texObj->MinFilter; const GLenum magFilterSave = texObj->MagFilter; + const GLint baseLevelSave = texObj->BaseLevel; + const GLint maxLevelSave = texObj->MaxLevel; + const GLenum wrapSSave = texObj->WrapS; + const GLenum wrapTSave = texObj->WrapT; const GLenum target = texObj->Target; if (drawAtt->Texture == readAtt->Texture) { @@ -1075,8 +1080,11 @@ blitframebuffer_texture(GLcontext *ctx, _mesa_BindTexture(target, texObj->Name); _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, filter); _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, filter); + _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, srcLevel); + _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, srcLevel); + _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + _mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); _mesa_TexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - /*_mesa_set_enable(ctx, GL_TEXTURE_RECTANGLE, GL_FALSE);*/ _mesa_set_enable(ctx, target, GL_TRUE); /* Prepare vertex data (the VBO was previously created and bound) */ @@ -1089,8 +1097,7 @@ blitframebuffer_texture(GLcontext *ctx, if (target == GL_TEXTURE_2D) { const struct gl_texture_image *texImage - = _mesa_select_tex_image(ctx, texObj, target, - readAtt->TextureLevel); + = _mesa_select_tex_image(ctx, texObj, target, srcLevel); s0 = srcX0 / (float) texImage->Width; s1 = srcX1 / (float) texImage->Width; t0 = srcY0 / (float) texImage->Height; @@ -1127,11 +1134,15 @@ blitframebuffer_texture(GLcontext *ctx, _mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4); - /* Restore texture's filter state, the texture binding will + /* Restore texture object state, the texture binding will * be restored by _mesa_meta_end(). */ _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, minFilterSave); _mesa_TexParameteri(target, GL_TEXTURE_MAG_FILTER, magFilterSave); + _mesa_TexParameteri(target, GL_TEXTURE_BASE_LEVEL, baseLevelSave); + _mesa_TexParameteri(target, GL_TEXTURE_MAX_LEVEL, maxLevelSave); + _mesa_TexParameteri(target, GL_TEXTURE_WRAP_S, wrapSSave); + _mesa_TexParameteri(target, GL_TEXTURE_WRAP_T, wrapTSave); /* Done with color buffer */ mask &= ~GL_COLOR_BUFFER_BIT; -- cgit v1.2.3 From 05fc9cdfdfceaf7ca1db64bf1feccf649fe4c907 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Tue, 6 Oct 2009 15:30:39 -0700 Subject: r300g: Clean up texture formats. --- src/gallium/drivers/r300/r300_screen.c | 4 +--- src/gallium/drivers/r300/r300_state_inlines.h | 1 - src/gallium/drivers/r300/r300_texture.h | 13 ++++++++----- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 81d01b1320..e8d991586f 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -215,10 +215,8 @@ static boolean check_tex_2d_format(enum pipe_format format, uint32_t usage, PIPE_TEXTURE_USAGE_PRIMARY | PIPE_TEXTURE_USAGE_SAMPLER); - /* Z buffer */ + /* Z buffer or texture */ case PIPE_FORMAT_Z16_UNORM: - return usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL; - /* Z buffer with stencil or texture */ case PIPE_FORMAT_Z24S8_UNORM: return usage & diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index 88eb66b79e..d7b57e1b22 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -295,7 +295,6 @@ static INLINE uint32_t r300_translate_colorformat(enum pipe_format format) case PIPE_FORMAT_X8R8G8B8_UNORM: case PIPE_FORMAT_R8G8B8A8_UNORM: case PIPE_FORMAT_R8G8B8X8_UNORM: - case PIPE_FORMAT_Z24S8_UNORM: return R300_COLOR_FORMAT_ARGB8888; /* XXX Not in pipe_format case PIPE_FORMAT_A32R32G32B32: diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h index e5182d31b4..992dad77ab 100644 --- a/src/gallium/drivers/r300/r300_texture.h +++ b/src/gallium/drivers/r300/r300_texture.h @@ -43,6 +43,14 @@ static INLINE uint32_t r300_translate_texformat(enum pipe_format format) /* X8 */ case PIPE_FORMAT_I8_UNORM: return R300_EASY_TX_FORMAT(X, X, X, X, X8); + /* X16 */ + case PIPE_FORMAT_R16_UNORM: + return R300_EASY_TX_FORMAT(X, X, X, X, X16); + case PIPE_FORMAT_R16_SNORM: + return R300_EASY_TX_FORMAT(X, X, X, X, X16) | + R300_TX_FORMAT_SIGNED; + case PIPE_FORMAT_Z16_UNORM: + return R300_EASY_TX_FORMAT(X, X, X, X, X16); /* W8Z8Y8X8 */ case PIPE_FORMAT_A8R8G8B8_UNORM: return R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8); @@ -76,11 +84,6 @@ static INLINE uint32_t r300_translate_texformat(enum pipe_format format) /* W24_FP */ case PIPE_FORMAT_Z24S8_UNORM: return R300_EASY_TX_FORMAT(X, X, X, X, W24_FP); - /* Z5_Y6_X5 */ - case PIPE_FORMAT_R16_SNORM: - return R300_EASY_TX_FORMAT(X, X, X, X, Z5Y6X5); - case PIPE_FORMAT_Z16_UNORM: - return R300_EASY_TX_FORMAT(X, X, X, X, X16); default: debug_printf("r300: Implementation error: " "Got unsupported texture format %s in %s\n", -- cgit v1.2.3 From 36ccdf09b8483305c7fa1366de9df2dea2fd6985 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Tue, 6 Oct 2009 16:00:27 -0700 Subject: r300g: Prevent multiple-use textures from getting incorrectly approved. --- src/gallium/drivers/r300/r300_screen.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index e8d991586f..7d154576e0 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -182,16 +182,19 @@ static float r300_get_paramf(struct pipe_screen* pscreen, int param) static boolean check_tex_2d_format(enum pipe_format format, uint32_t usage, boolean is_r500) { + uint32_t retval = 0; + switch (format) { /* Supported formats. */ /* Colorbuffer */ case PIPE_FORMAT_A4R4G4B4_UNORM: case PIPE_FORMAT_R5G6B5_UNORM: case PIPE_FORMAT_A1R5G5B5_UNORM: - return usage & + retval = usage & (PIPE_TEXTURE_USAGE_RENDER_TARGET | PIPE_TEXTURE_USAGE_DISPLAY_TARGET | PIPE_TEXTURE_USAGE_PRIMARY); + break; /* Texture */ case PIPE_FORMAT_A8R8G8B8_SRGB: @@ -201,7 +204,8 @@ static boolean check_tex_2d_format(enum pipe_format format, uint32_t usage, case PIPE_FORMAT_DXT3_RGBA: case PIPE_FORMAT_DXT5_RGBA: case PIPE_FORMAT_YCBCR: - return usage & PIPE_TEXTURE_USAGE_SAMPLER; + retval = usage & PIPE_TEXTURE_USAGE_SAMPLER; + break; /* Colorbuffer or texture */ case PIPE_FORMAT_A8R8G8B8_UNORM: @@ -209,19 +213,21 @@ static boolean check_tex_2d_format(enum pipe_format format, uint32_t usage, case PIPE_FORMAT_R8G8B8A8_UNORM: case PIPE_FORMAT_R8G8B8X8_UNORM: case PIPE_FORMAT_I8_UNORM: - return usage & + retval = usage & (PIPE_TEXTURE_USAGE_RENDER_TARGET | PIPE_TEXTURE_USAGE_DISPLAY_TARGET | PIPE_TEXTURE_USAGE_PRIMARY | PIPE_TEXTURE_USAGE_SAMPLER); + break; /* Z buffer or texture */ case PIPE_FORMAT_Z16_UNORM: /* Z buffer with stencil or texture */ case PIPE_FORMAT_Z24S8_UNORM: - return usage & + retval = usage & (PIPE_TEXTURE_USAGE_DEPTH_STENCIL | PIPE_TEXTURE_USAGE_SAMPLER); + break; /* Definitely unsupported formats. */ /* Non-usable Z buffer/stencil formats. */ @@ -259,7 +265,13 @@ static boolean check_tex_2d_format(enum pipe_format format, uint32_t usage, break; } - return FALSE; + /* If usage was a mask that contained multiple bits, and not all of them + * are supported, this will catch that and return FALSE. + * e.g. usage = 2 | 4; retval = 4; (retval >= usage) == FALSE + * + * This also returns FALSE for any unknown formats. + */ + return (retval >= usage); } /* XXX moar targets */ -- cgit v1.2.3 From 95a05621eb750c07e5c7a5eb64b8458d202192b3 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 12 Oct 2009 20:47:00 -0700 Subject: r300g: Fallback on surfaces we can't render to or from. Still not sure why st keeps handing down things we can't render to. --- src/gallium/drivers/r300/r300_surface.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index cc6288cb51..4d0ccd6b0f 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -113,9 +113,10 @@ static void r300_surface_fill(struct pipe_context* pipe, dest, x, y, w, h, pixpitch, color); /* Fallback? */ - if (FALSE) { + if (!pipe->screen->is_format_supported(pipe->screen, dest->format, + PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) { fallback: - debug_printf("r300: Falling back on surface clear..."); + debug_printf("r300: Falling back on surface clear...\n"); util_surface_fill(pipe, dest, x, y, w, h, color); return; } @@ -245,10 +246,18 @@ static void r300_surface_copy(struct pipe_context* pipe, if ((srctex->buffer == desttex->buffer) && ((destx < srcx + w) || (srcx < destx + w)) && ((desty < srcy + h) || (srcy < desty + h))) { + goto fallback; + } + + if (!pipe->screen->is_format_supported(pipe->screen, src->format, + PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER, 0) || + !pipe->screen->is_format_supported(pipe->screen, dest->format, + PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) { fallback: debug_printf("r300: Falling back on surface_copy\n"); util_surface_copy(pipe, FALSE, dest, destx, desty, src, srcx, srcy, w, h); + return; } /* Add our target BOs to the list. */ -- cgit v1.2.3 From a4a4f7abc2137754646a811007696321c7714f1b Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 12 Oct 2009 20:55:57 -0700 Subject: r300g: Surface debug. It gets really annoying watching r300g tell me how it's filling surfaces. Or falling back during filling surfaces. --- src/gallium/drivers/r300/r300_context.h | 1 + src/gallium/drivers/r300/r300_debug.c | 1 + src/gallium/drivers/r300/r300_surface.c | 12 ++++++------ 3 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 52b1c9a6b2..a817459ee3 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -312,6 +312,7 @@ void r300_init_surface_functions(struct r300_context* r300); #define DBG_VP 0x0000004 #define DBG_CS 0x0000008 #define DBG_DRAW 0x0000010 +#define DBG_SURF 0x0000020 /*@}*/ static INLINE boolean DBG_ON(struct r300_context * ctx, unsigned flags) diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c index 85d69c0747..4a55a0c5b1 100644 --- a/src/gallium/drivers/r300/r300_debug.c +++ b/src/gallium/drivers/r300/r300_debug.c @@ -37,6 +37,7 @@ static struct debug_option debug_options[] = { { "vp", DBG_VP, "Vertex program handling" }, { "cs", DBG_CS, "Command submissions" }, { "draw", DBG_DRAW, "Draw and emit" }, + { "surf", DBG_SURF, "Surface drawing" }, { "all", ~0, "Convenience option that enables all debug flags" }, diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index 4d0ccd6b0f..a263b26512 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -108,7 +108,7 @@ static void r300_surface_fill(struct pipe_context* pipe, r = (float)((color >> 16) & 0xff) / 255.0f; g = (float)((color >> 8) & 0xff) / 255.0f; b = (float)((color >> 0) & 0xff) / 255.0f; - debug_printf("r300: Filling surface %p at (%d,%d)," + DBG(r300, DBG_SURF, "r300: Filling surface %p at (%d,%d)," " dimensions %dx%d (pixel pitch %d), color 0x%x\n", dest, x, y, w, h, pixpitch, color); @@ -116,7 +116,7 @@ static void r300_surface_fill(struct pipe_context* pipe, if (!pipe->screen->is_format_supported(pipe->screen, dest->format, PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) { fallback: - debug_printf("r300: Falling back on surface clear...\n"); + DBG(r300, DBG_SURF, "r300: Falling back on surface clear...\n"); util_surface_fill(pipe, dest, x, y, w, h, color); return; } @@ -131,7 +131,7 @@ validate: if (!r300->winsys->validate(r300->winsys)) { r300->context.flush(&r300->context, 0, NULL); if (invalid) { - debug_printf("r300: Stuck in validation loop, gonna fallback."); + DBG(r300, DBG_SURF, "r300: Stuck in validation loop, gonna fallback."); goto fallback; } invalid = TRUE; @@ -239,7 +239,7 @@ static void r300_surface_copy(struct pipe_context* pipe, float fsrcx = srcx, fsrcy = srcy, fdestx = destx, fdesty = desty; CS_LOCALS(r300); - debug_printf("r300: Copying surface %p at (%d,%d) to %p at (%d, %d)," + DBG(r300, DBG_SURF, "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); @@ -254,7 +254,7 @@ static void r300_surface_copy(struct pipe_context* pipe, !pipe->screen->is_format_supported(pipe->screen, dest->format, PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) { fallback: - debug_printf("r300: Falling back on surface_copy\n"); + DBG(r300, DBG_SURF, "r300: Falling back on surface_copy\n"); util_surface_copy(pipe, FALSE, dest, destx, desty, src, srcx, srcy, w, h); return; @@ -275,7 +275,7 @@ validate: if (!r300->winsys->validate(r300->winsys)) { r300->context.flush(&r300->context, 0, NULL); if (invalid) { - debug_printf("r300: Stuck in validation loop, gonna fallback."); + DBG(r300, DBG_SURF, "r300: Stuck in validation loop, gonna fallback."); goto fallback; } invalid = TRUE; -- cgit v1.2.3 From ca8cafda0b996167647d724ea3da3ec568a9e42f Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 12 Oct 2009 21:26:46 -0700 Subject: r300g: More debug flags. --- src/gallium/drivers/r300/r300_context.h | 2 ++ src/gallium/drivers/r300/r300_debug.c | 2 ++ src/gallium/drivers/r300/r300_surface.c | 9 +++++---- 3 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index a817459ee3..086633f732 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -313,6 +313,8 @@ void r300_init_surface_functions(struct r300_context* r300); #define DBG_CS 0x0000008 #define DBG_DRAW 0x0000010 #define DBG_SURF 0x0000020 +#define DBG_TEX 0x0000040 +#define DBG_FALL 0x0000080 /*@}*/ static INLINE boolean DBG_ON(struct r300_context * ctx, unsigned flags) diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c index 4a55a0c5b1..bfd4ab018a 100644 --- a/src/gallium/drivers/r300/r300_debug.c +++ b/src/gallium/drivers/r300/r300_debug.c @@ -38,6 +38,8 @@ static struct debug_option debug_options[] = { { "cs", DBG_CS, "Command submissions" }, { "draw", DBG_DRAW, "Draw and emit" }, { "surf", DBG_SURF, "Surface drawing" }, + { "tex", DBG_TEX, "Textures" }, + { "fall", DBG_FALL, "Fallbacks" }, { "all", ~0, "Convenience option that enables all debug flags" }, diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index a263b26512..d72e734ff0 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -116,7 +116,8 @@ static void r300_surface_fill(struct pipe_context* pipe, if (!pipe->screen->is_format_supported(pipe->screen, dest->format, PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) { fallback: - DBG(r300, DBG_SURF, "r300: Falling back on surface clear...\n"); + DBG(r300, DBG_SURF | DBG_FALL, + "r300: Falling back on surface clear...\n"); util_surface_fill(pipe, dest, x, y, w, h, color); return; } @@ -131,7 +132,7 @@ validate: if (!r300->winsys->validate(r300->winsys)) { r300->context.flush(&r300->context, 0, NULL); if (invalid) { - DBG(r300, DBG_SURF, "r300: Stuck in validation loop, gonna fallback."); + DBG(r300, DBG_SURF | DBG_FALL, "r300: Stuck in validation loop."); goto fallback; } invalid = TRUE; @@ -254,7 +255,7 @@ static void r300_surface_copy(struct pipe_context* pipe, !pipe->screen->is_format_supported(pipe->screen, dest->format, PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) { fallback: - DBG(r300, DBG_SURF, "r300: Falling back on surface_copy\n"); + DBG(r300, DBG_SURF | DBG_FALL, "r300: Falling back on surface_copy\n"); util_surface_copy(pipe, FALSE, dest, destx, desty, src, srcx, srcy, w, h); return; @@ -275,7 +276,7 @@ validate: if (!r300->winsys->validate(r300->winsys)) { r300->context.flush(&r300->context, 0, NULL); if (invalid) { - DBG(r300, DBG_SURF, "r300: Stuck in validation loop, gonna fallback."); + DBG(r300, DBG_SURF | DBG_FALL, "r300: Stuck in validation loop."); goto fallback; } invalid = TRUE; -- cgit v1.2.3 From c8413351c33d5758da057b56a140c9ee622a5e4a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 13 Oct 2009 09:04:14 -0600 Subject: mesa: do RTT check in _mesa_meta_check_generate_mipmap_fallback() We need to check that we can actually render to the texture's format before doing mipmap generation. This may fix bug 24219. --- src/mesa/drivers/common/meta.c | 55 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 9cba3a7600..bae2c01ac2 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2064,21 +2064,64 @@ _mesa_meta_Bitmap(GLcontext *ctx, * Check if the call to _mesa_meta_GenerateMipmap() will require a * software fallback. The fallback path will require that the texture * images are mapped. + * \return GL_TRUE if a fallback is needed, GL_FALSE otherwise */ GLboolean _mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target, struct gl_texture_object *texObj) { - struct gl_texture_image *baseImage = - _mesa_select_tex_image(ctx, texObj, target, texObj->BaseLevel); + const GLuint fboSave = ctx->DrawBuffer->Name; + struct gen_mipmap_state *mipmap = &ctx->Meta->Mipmap; + struct gl_texture_image *baseImage; + GLuint srcLevel; + GLenum status; /* check for fallbacks */ if (!ctx->Extensions.EXT_framebuffer_object || - target == GL_TEXTURE_3D || - !baseImage || - baseImage->IsCompressed) { + target == GL_TEXTURE_3D) { return GL_TRUE; } + + srcLevel = texObj->BaseLevel; + baseImage = _mesa_select_tex_image(ctx, texObj, target, srcLevel); + if (!baseImage || baseImage->IsCompressed) { + return GL_TRUE; + } + + /* + * Test that we can actually render in the texture's format. + */ + if (!mipmap->FBO) + _mesa_GenFramebuffersEXT(1, &mipmap->FBO); + _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, mipmap->FBO); + + if (target == GL_TEXTURE_1D) { + _mesa_FramebufferTexture1DEXT(GL_FRAMEBUFFER_EXT, + GL_COLOR_ATTACHMENT0_EXT, + target, texObj->Name, srcLevel); + } + else if (target == GL_TEXTURE_3D) { + GLint zoffset = 0; + _mesa_FramebufferTexture3DEXT(GL_FRAMEBUFFER_EXT, + GL_COLOR_ATTACHMENT0_EXT, + target, texObj->Name, srcLevel, zoffset); + } + else { + /* 2D / cube */ + _mesa_FramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, + GL_COLOR_ATTACHMENT0_EXT, + target, texObj->Name, srcLevel); + } + + status = _mesa_CheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT); + + _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboSave); + + if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { + printf("Can't render\n"); + return GL_TRUE; + } + return GL_FALSE; } @@ -2152,10 +2195,8 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, } if (!mipmap->FBO) { - /* Bind the new renderbuffer to the color attachment point. */ _mesa_GenFramebuffersEXT(1, &mipmap->FBO); } - _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, mipmap->FBO); _mesa_TexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR); -- cgit v1.2.3 From eefecf5d2a5bf9fc0f0f7919faf1747b0add8d6f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 13 Oct 2009 09:04:54 -0600 Subject: mesa: whitespace fixes --- src/mesa/drivers/common/meta.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index bae2c01ac2..21458a7c73 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2113,7 +2113,7 @@ _mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target, target, texObj->Name, srcLevel); } - status = _mesa_CheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT); + status = _mesa_CheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboSave); @@ -2399,7 +2399,7 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0_EXT); /* sanity check */ - status = _mesa_CheckFramebufferStatusEXT (GL_FRAMEBUFFER_EXT); + status = _mesa_CheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT); if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { abort(); break; -- cgit v1.2.3 From 89bb33fb20e69d9fa5325da10abf31d61d51d371 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Sat, 10 Oct 2009 04:45:41 -0400 Subject: st/xorg: fix and enable by default xrender acceleration src in mask was broken --- src/gallium/state_trackers/xorg/xorg_composite.c | 2 +- src/gallium/state_trackers/xorg/xorg_exa.c | 5 ++++- src/gallium/state_trackers/xorg/xorg_exa_tgsi.c | 14 ++++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 54b9ecaba1..90283fe6af 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -320,7 +320,7 @@ boolean xorg_composite_bind_state(struct exa_context *exa, pDstPicture, pSrc, pMask, pDst); setup_constant_buffers(exa, pDst); - return FALSE; + return TRUE; } void xorg_composite(struct exa_context *exa, diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 29785c0040..af76d6690f 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -506,7 +506,7 @@ ExaComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pDst); #if DEBUG_PRINT - debug_printf("\tExaComposite\n"); + debug_printf("\tExaComposite(src[%d,%d], mask=[%d, %d], dst=[%d, %d], dim=[%d, %d])\n", srcX, srcY, maskX, maskY, dstX, dstY, width, height); #endif xorg_composite(exa, priv, srcX, srcY, maskX, maskY, @@ -525,6 +525,9 @@ ExaCheckComposite(int op, #if DEBUG_PRINT debug_printf("ExaCheckComposite(%d, %p, %p, %p) = %d\n", op, pSrcPicture, pMaskPicture, pDstPicture, accelerated); +#endif +#if DISABLE_ACCEL + accelerated = FALSE; #endif return accelerated; } diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c index 8ce06e374a..8c9b674b4b 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c @@ -67,9 +67,19 @@ src_in_mask(struct ureg_program *ureg, struct ureg_src src, struct ureg_src mask) { - /* MUL dst, src, mask.wwww */ +#if 0 + /* MUL dst, src, mask.a */ ureg_MUL(ureg, dst, src, ureg_scalar(mask, TGSI_SWIZZLE_W)); +#else + /* MOV dst, src */ + /* MUL dst.a, src.a, mask.a */ + ureg_MOV(ureg, dst, src); + ureg_MUL(ureg, + ureg_writemask(dst, TGSI_WRITEMASK_W), + ureg_scalar(src, TGSI_SWIZZLE_W), + ureg_scalar(mask, TGSI_SWIZZLE_W)); +#endif } static struct ureg_src @@ -271,7 +281,7 @@ create_vs(struct pipe_context *pipe, if (has_mask) { src = ureg_DECL_vs_input(ureg, input_slot++); - dst = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 2); + dst = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 1); ureg_MOV(ureg, dst, src); } -- cgit v1.2.3 From 83f4e72009e2ee03ec1175bd3e6e309e605c2bd1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 13 Oct 2009 10:37:39 -0600 Subject: intel: fix broken sw generate mipmap path Need to restore code that fixed up the intel_texture_image state. --- src/mesa/drivers/dri/intel/intel_tex.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex.c b/src/mesa/drivers/dri/intel/intel_tex.c index 3cbc379dbd..215a534a5c 100644 --- a/src/mesa/drivers/dri/intel/intel_tex.c +++ b/src/mesa/drivers/dri/intel/intel_tex.c @@ -177,6 +177,28 @@ intelGenerateMipmap(GLcontext *ctx, GLenum target, intel_tex_map_level_images(intel, intelObj, texObj->BaseLevel); _mesa_generate_mipmap(ctx, target, texObj); intel_tex_unmap_level_images(intel, intelObj, texObj->BaseLevel); + + { + GLuint nr_faces = (texObj->Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1; + GLuint face, i; + /* Update the level information in our private data in the new images, + * since it didn't get set as part of a normal TexImage path. + */ + for (face = 0; face < nr_faces; face++) { + for (i = texObj->BaseLevel + 1; i < texObj->MaxLevel; i++) { + struct intel_texture_image *intelImage = + intel_texture_image(texObj->Image[face][i]); + if (!intelImage) + break; + intelImage->level = i; + intelImage->face = face; + /* Unreference the miptree to signal that the new Data is a + * bare pointer from mesa. + */ + intel_miptree_release(intel, &intelImage->mt); + } + } + } } else { _mesa_meta_GenerateMipmap(ctx, target, texObj); -- cgit v1.2.3 From 1cc1c3a0336d74e518417e2e93e141171a50542b Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Sat, 10 Oct 2009 05:24:32 -0400 Subject: st/xorg: solid fills with masks are supported gradients are supported, but not enabled by default due to little testing they got --- src/gallium/state_trackers/xorg/xorg_composite.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 90283fe6af..6871625605 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -125,13 +125,8 @@ boolean xorg_composite_accelerated(int op, sizeof(accelerated_ops)/sizeof(struct acceleration_info); if (pSrcPicture->pSourcePict) { - /* Gradients not yet supported */ if (pSrcPicture->pSourcePict->type != SourcePictTypeSolidFill) - XORG_FALLBACK("gradients not yet supported"); - - /* Solid source with mask not yet handled properly */ - if (pMaskPicture) - XORG_FALLBACK("solid source with mask not yet handled properly"); + XORG_FALLBACK("gradients not enabled (haven't been well tested)"); } for (i = 0; i < accel_ops_count; ++i) { -- cgit v1.2.3 From 5541988578054345ca70b7ed7972710396e61b44 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 28 Sep 2009 17:25:48 +0800 Subject: egl: Add support for driver built-in. This allows an EGL driver to be compiled together with libEGL.so. It eliminates the need to specify a driver, or support module loading on new platforms. Signed-off-by: Chia-I Wu --- src/egl/main/egldriver.c | 157 ++++++++++++++++++++++++++++------------------- src/egl/main/egllog.c | 4 -- 2 files changed, 93 insertions(+), 68 deletions(-) (limited to 'src') diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c index 87786e36bb..0c76c79973 100644 --- a/src/egl/main/egldriver.c +++ b/src/egl/main/egldriver.c @@ -22,59 +22,70 @@ #if defined(_EGL_PLATFORM_X) #include -#elif defined(_EGL_PLATFORM_WINDOWS) -/* Use static linking on Windows for now */ -#define WINDOWS_STATIC_LINK #endif + /** * Wrappers for dlopen/dlclose() */ #if defined(_EGL_PLATFORM_WINDOWS) -#ifdef WINDOWS_STATIC_LINK - static const char *DefaultDriverName = "Windows EGL Static Library"; -#else - /* XXX Need to decide how to do dynamic name lookup on Windows */ - static const char *DefaultDriverName = "TBD"; -#endif - typedef HMODULE lib_handle; - - static HMODULE - open_library(const char *filename) - { -#ifdef WINDOWS_STATIC_LINK - return 0; -#else - return LoadLibrary(filename); -#endif - } - static void - close_library(HMODULE lib) - { -#ifdef WINDOWS_STATIC_LINK -#else - FreeLibrary(lib); -#endif - } + +/* XXX Need to decide how to do dynamic name lookup on Windows */ +static const char DefaultDriverName[] = "TBD"; + +typedef HMODULE lib_handle; + +static HMODULE +open_library(const char *filename) +{ + return LoadLibrary(filename); +} + +static void +close_library(HMODULE lib) +{ + FreeLibrary(lib); +} + #elif defined(_EGL_PLATFORM_X) - static const char *DefaultDriverName = "egl_softpipe"; - typedef void * lib_handle; - static void * - open_library(const char *filename) - { - return dlopen(filename, RTLD_LAZY); - } +static const char DefaultDriverName[] = "egl_softpipe"; + +typedef void * lib_handle; + +static void * +open_library(const char *filename) +{ + return dlopen(filename, RTLD_LAZY); +} + +static void +close_library(void *lib) +{ + dlclose(lib); +} + +#else /* _EGL_PLATFORM_NO_OS */ + +static const char DefaultDriverName[] = "builtin"; + +typedef void *lib_handle; + +static INLINE void * +open_library(const char *filename) +{ + return (void *) filename; +} + +static INLINE void +close_library(void *lib) +{ +} + - static void - close_library(void *lib) - { - dlclose(lib); - } - #endif @@ -95,14 +106,22 @@ _eglChooseDriver(_EGLDisplay *dpy, char **argsRet) path = _eglstrdup(path); #if defined(_EGL_PLATFORM_X) - if (!path && dpy->NativeDisplay) { + if (!path && dpy && dpy->NativeDisplay) { /* assume (wrongly!) that the native display is a display string */ path = _eglSplitDisplayString((const char *) dpy->NativeDisplay, &args); } suffix = "so"; #elif defined(_EGL_PLATFORM_WINDOWS) suffix = "dll"; -#endif /* _EGL_PLATFORM_X */ +#else /* _EGL_PLATFORM_NO_OS */ + if (path) { + /* force the use of the default driver */ + _eglLog(_EGL_DEBUG, "ignore EGL_DRIVER"); + free(path); + path = NULL; + } + suffix = NULL; +#endif if (!path) path = _eglstrdup(DefaultDriverName); @@ -136,43 +155,48 @@ _eglChooseDriver(_EGLDisplay *dpy, char **argsRet) static _EGLMain_t _eglOpenLibrary(const char *driverPath, lib_handle *handle) { - _EGLMain_t mainFunc; lib_handle lib; + _EGLMain_t mainFunc = NULL; + const char *error = "unknown error"; assert(driverPath); -#if defined(_EGL_PLATFORM_WINDOWS) -/* Use static linking on Windows for now */ -#ifdef WINDOWS_STATIC_LINK - lib = 0; - mainFunc = (_EGLMain_t)_eglMain; -#else - /* XXX untested */ _eglLog(_EGL_DEBUG, "dlopen(%s)", driverPath); lib = open_library(driverPath); - if (!lib) { - _eglLog(_EGL_WARNING, "Could not open %s", - driverPath); - return NULL; + +#if defined(_EGL_PLATFORM_WINDOWS) + /* XXX untested */ + if (lib) + mainFunc = (_EGLMain_t) GetProcAddress(lib, "_eglMain"); +#elif defined(_EGL_PLATFORM_X) + if (lib) { + mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain"); + if (!mainFunc) + error = dlerror(); + } + else { + error = dlerror(); } - mainFunc = (_EGLMain_t) GetProcAddress(lib, "_eglMain"); +#else /* _EGL_PLATFORM_NO_OS */ + /* must be the default driver name */ + if (strcmp(driverPath, DefaultDriverName) == 0) + mainFunc = (_EGLMain_t) _eglMain; + else + error = "not builtin driver"; #endif -#elif defined(_EGL_PLATFORM_X) - _eglLog(_EGL_DEBUG, "dlopen(%s)", driverPath); - lib = open_library(driverPath); + if (!lib) { - _eglLog(_EGL_WARNING, "Could not open %s (%s)", - driverPath, dlerror()); + _eglLog(_EGL_WARNING, "Could not open driver %s (%s)", + driverPath, error); if (!getenv("EGL_DRIVER")) _eglLog(_EGL_WARNING, "The driver can be overridden by setting EGL_DRIVER"); return NULL; } - mainFunc = (_EGLMain_t) dlsym(lib, "_eglMain"); -#endif if (!mainFunc) { - _eglLog(_EGL_WARNING, "_eglMain not found in %s", driverPath); + _eglLog(_EGL_WARNING, "_eglMain not found in %s (%s)", + driverPath, error); if (lib) close_library(lib); return NULL; @@ -428,6 +452,11 @@ _eglFindAPIs(void) const char *es2_libname = "libGLESv2.so"; const char *gl_libname = "libGL.so"; const char *vg_libname = "libOpenVG.so"; +#else /* _EGL_PLATFORM_NO_OS */ + const char *es1_libname = NULL; + const char *es2_libname = NULL; + const char *gl_libname = NULL; + const char *vg_libname = NULL; #endif if ((lib = open_library(es1_libname))) { diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c index 1d7a0a388c..23eb523eeb 100644 --- a/src/egl/main/egllog.c +++ b/src/egl/main/egllog.c @@ -21,11 +21,7 @@ static EGLint ReportingLevel = -1; static void log_level_initialize(void) { -#if defined(_EGL_PLATFORM_X) char *log_env = getenv("EGL_LOG_LEVEL"); -#else - char *log_env = NULL; -#endif if (log_env == NULL) { ReportingLevel = FALLBACK_LOG_LEVEL; -- cgit v1.2.3 From 9061d733d3f31293c145cf3b7a0f71c1bfd31989 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 15 Aug 2009 22:44:46 +0800 Subject: egl: Remove core functions from eglGetProcAddress. eglGetProcAddress may not be used to query core (non-extension) functions. Signed-off-by: Chia-I Wu --- src/egl/main/eglapi.c | 61 ++++++++++++++------------------------------------- 1 file changed, 16 insertions(+), 45 deletions(-) (limited to 'src') diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 29617b7aff..82ee9d9bcd 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -586,43 +586,11 @@ eglGetError(void) void (* EGLAPIENTRY eglGetProcAddress(const char *procname))() { - typedef void (*genericFunc)(); - struct name_function { + static const struct { const char *name; _EGLProc function; - }; - static struct name_function egl_functions[] = { - /* alphabetical order */ - { "eglBindTexImage", (_EGLProc) eglBindTexImage }, - { "eglChooseConfig", (_EGLProc) eglChooseConfig }, - { "eglCopyBuffers", (_EGLProc) eglCopyBuffers }, - { "eglCreateContext", (_EGLProc) eglCreateContext }, - { "eglCreatePbufferSurface", (_EGLProc) eglCreatePbufferSurface }, - { "eglCreatePixmapSurface", (_EGLProc) eglCreatePixmapSurface }, - { "eglCreateWindowSurface", (_EGLProc) eglCreateWindowSurface }, - { "eglDestroyContext", (_EGLProc) eglDestroyContext }, - { "eglDestroySurface", (_EGLProc) eglDestroySurface }, - { "eglGetConfigAttrib", (_EGLProc) eglGetConfigAttrib }, - { "eglGetConfigs", (_EGLProc) eglGetConfigs }, - { "eglGetCurrentContext", (_EGLProc) eglGetCurrentContext }, - { "eglGetCurrentDisplay", (_EGLProc) eglGetCurrentDisplay }, - { "eglGetCurrentSurface", (_EGLProc) eglGetCurrentSurface }, - { "eglGetDisplay", (_EGLProc) eglGetDisplay }, - { "eglGetError", (_EGLProc) eglGetError }, - { "eglGetProcAddress", (_EGLProc) eglGetProcAddress }, - { "eglInitialize", (_EGLProc) eglInitialize }, - { "eglMakeCurrent", (_EGLProc) eglMakeCurrent }, - { "eglQueryContext", (_EGLProc) eglQueryContext }, - { "eglQueryString", (_EGLProc) eglQueryString }, - { "eglQuerySurface", (_EGLProc) eglQuerySurface }, - { "eglReleaseTexImage", (_EGLProc) eglReleaseTexImage }, - { "eglSurfaceAttrib", (_EGLProc) eglSurfaceAttrib }, - { "eglSwapBuffers", (_EGLProc) eglSwapBuffers }, - { "eglSwapInterval", (_EGLProc) eglSwapInterval }, - { "eglTerminate", (_EGLProc) eglTerminate }, - { "eglWaitGL", (_EGLProc) eglWaitGL }, - { "eglWaitNative", (_EGLProc) eglWaitNative }, - /* Extensions */ + } egl_functions[] = { + /* extensions only */ #ifdef EGL_MESA_screen_surface { "eglChooseModeMESA", (_EGLProc) eglChooseModeMESA }, { "eglGetModesMESA", (_EGLProc) eglGetModesMESA }, @@ -637,19 +605,16 @@ void (* EGLAPIENTRY eglGetProcAddress(const char *procname))() { "eglQueryScreenModeMESA", (_EGLProc) eglQueryScreenModeMESA }, { "eglQueryModeStringMESA", (_EGLProc) eglQueryModeStringMESA }, #endif /* EGL_MESA_screen_surface */ -#ifdef EGL_VERSION_1_2 - { "eglBindAPI", (_EGLProc) eglBindAPI }, - { "eglCreatePbufferFromClientBuffer", (_EGLProc) eglCreatePbufferFromClientBuffer }, - { "eglQueryAPI", (_EGLProc) eglQueryAPI }, - { "eglReleaseThread", (_EGLProc) eglReleaseThread }, - { "eglWaitClient", (_EGLProc) eglWaitClient }, -#endif /* EGL_VERSION_1_2 */ { NULL, NULL } }; EGLint i; - for (i = 0; egl_functions[i].name; i++) { - if (strcmp(egl_functions[i].name, procname) == 0) { - return (genericFunc) egl_functions[i].function; + + if (!procname) + return NULL; + if (strncmp(procname, "egl", 3) == 0) { + for (i = 0; egl_functions[i].name; i++) { + if (strcmp(egl_functions[i].name, procname) == 0) + return egl_functions[i].function; } } @@ -664,6 +629,9 @@ void (* EGLAPIENTRY eglGetProcAddress(const char *procname))() } +#ifdef EGL_MESA_screen_surface + + /* * EGL_MESA_screen extension */ @@ -838,6 +806,9 @@ eglQueryModeStringMESA(EGLDisplay dpy, EGLModeMESA mode) } +#endif /* EGL_MESA_screen_surface */ + + /** ** EGL 1.2 **/ -- cgit v1.2.3 From e787ffcd02cac9085ac69f631cce235d1cad59c9 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 28 Sep 2009 17:39:07 +0800 Subject: egl: Preload a driver if eglGetProcAddress is called early. Signed-off-by: Chia-I Wu --- src/egl/main/eglapi.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 82ee9d9bcd..23d841d2d1 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -618,6 +618,10 @@ void (* EGLAPIENTRY eglGetProcAddress(const char *procname))() } } + /* preload a driver if there isn't one */ + if (!_eglGlobal.NumDrivers) + _eglPreloadDriver(NULL); + /* now loop over drivers to query their procs */ for (i = 0; i < _eglGlobal.NumDrivers; i++) { _EGLProc p = _eglGlobal.Drivers[i]->API.GetProcAddress(procname); -- cgit v1.2.3 From 310c76812e5a2013dad36fc9d1686f57e7b1e626 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 17 Aug 2009 15:53:54 +0800 Subject: egl: Allow binding to any client API. As a result, EGL_NONE is no longer a valid client API. And it is possible that no config supports the current bound API. Signed-off-by: Chia-I Wu --- src/egl/main/eglapi.c | 32 +++----------------------------- src/egl/main/eglcurrent.c | 2 +- src/egl/main/eglcurrent.h | 23 +++++++++++++++-------- src/egl/main/eglglobals.c | 1 - src/egl/main/eglglobals.h | 3 --- 5 files changed, 19 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 23d841d2d1..d86ef9ce56 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -92,8 +92,8 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) snprintf(disp->Version, sizeof(disp->Version), "%d.%d (%s)", major_int, minor_int, drv->Name); - /* update the global notion of supported APIs */ - _eglGlobal.ClientAPIsMask |= disp->ClientAPIsMask; + /* limit to APIs supported by core */ + disp->ClientAPIsMask &= _EGL_API_ALL_BITS; disp->Driver = drv; } else { @@ -842,33 +842,7 @@ eglBindAPI(EGLenum api) if (!_eglIsApiValid(api)) return _eglError(EGL_BAD_PARAMETER, "eglBindAPI"); - switch (api) { -#ifdef EGL_VERSION_1_4 - case EGL_OPENGL_API: - if (_eglGlobal.ClientAPIsMask & EGL_OPENGL_BIT) { - t->CurrentAPIIndex = _eglConvertApiToIndex(api); - return EGL_TRUE; - } - _eglError(EGL_BAD_PARAMETER, "eglBindAPI"); - return EGL_FALSE; -#endif - case EGL_OPENGL_ES_API: - if (_eglGlobal.ClientAPIsMask & (EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT)) { - t->CurrentAPIIndex = _eglConvertApiToIndex(api); - return EGL_TRUE; - } - _eglError(EGL_BAD_PARAMETER, "eglBindAPI"); - return EGL_FALSE; - case EGL_OPENVG_API: - if (_eglGlobal.ClientAPIsMask & EGL_OPENVG_BIT) { - t->CurrentAPIIndex = _eglConvertApiToIndex(api); - return EGL_TRUE; - } - _eglError(EGL_BAD_PARAMETER, "eglBindAPI"); - return EGL_FALSE; - default: - return EGL_FALSE; - } + t->CurrentAPIIndex = _eglConvertApiToIndex(api); return EGL_TRUE; } diff --git a/src/egl/main/eglcurrent.c b/src/egl/main/eglcurrent.c index 4431f964f6..ca7a077168 100644 --- a/src/egl/main/eglcurrent.c +++ b/src/egl/main/eglcurrent.c @@ -9,7 +9,7 @@ /* This should be kept in sync with _eglInitThreadInfo() */ #define _EGL_THREAD_INFO_INITIALIZER \ - { EGL_SUCCESS, { NULL }, 1 } + { EGL_SUCCESS, { NULL }, 0 } /* a fallback thread info to guarantee that every thread always has one */ static _EGLThreadInfo dummy_thread = _EGL_THREAD_INFO_INITIALIZER; diff --git a/src/egl/main/eglcurrent.h b/src/egl/main/eglcurrent.h index 8eb241029e..9503e0aba0 100644 --- a/src/egl/main/eglcurrent.h +++ b/src/egl/main/eglcurrent.h @@ -4,8 +4,16 @@ #include "egltypedefs.h" -#define _EGL_API_NUM_INDICES \ - (EGL_OPENGL_API - EGL_OPENGL_ES_API + 2) /* idx 0 is for EGL_NONE */ +#define _EGL_API_ALL_BITS \ + (EGL_OPENGL_ES_BIT | \ + EGL_OPENVG_BIT | \ + EGL_OPENGL_ES2_BIT | \ + EGL_OPENGL_BIT) + + +#define _EGL_API_FIRST_API EGL_OPENGL_ES_API +#define _EGL_API_LAST_API EGL_OPENGL_API +#define _EGL_API_NUM_APIS (_EGL_API_LAST_API - _EGL_API_FIRST_API + 1) /** @@ -14,20 +22,19 @@ struct _egl_thread_info { EGLint LastError; - _EGLContext *CurrentContexts[_EGL_API_NUM_INDICES]; + _EGLContext *CurrentContexts[_EGL_API_NUM_APIS]; /* use index for fast access to current context */ EGLint CurrentAPIIndex; }; /** - * Return true if a client API enum can be converted to an index. + * Return true if a client API enum is recognized. */ static INLINE EGLBoolean _eglIsApiValid(EGLenum api) { - return ((api >= EGL_OPENGL_ES_API && api <= EGL_OPENGL_API) || - api == EGL_NONE); + return (api >= _EGL_API_FIRST_API && api <= _EGL_API_LAST_API); } @@ -38,7 +45,7 @@ _eglIsApiValid(EGLenum api) static INLINE EGLint _eglConvertApiToIndex(EGLenum api) { - return (api != EGL_NONE) ? api - EGL_OPENGL_ES_API + 1 : 0; + return api - _EGL_API_FIRST_API; } @@ -49,7 +56,7 @@ _eglConvertApiToIndex(EGLenum api) static INLINE EGLenum _eglConvertApiFromIndex(EGLint idx) { - return (idx) ? EGL_OPENGL_ES_API + idx - 1 : EGL_NONE; + return _EGL_API_FIRST_API + idx; } diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c index 3ae4c1ad3a..30d9fe97b4 100644 --- a/src/egl/main/eglglobals.c +++ b/src/egl/main/eglglobals.c @@ -15,7 +15,6 @@ struct _egl_global _eglGlobal = &_eglGlobalMutex, /* Mutex */ NULL, /* DisplayList */ 1, /* FreeScreenHandle */ - 0x0, /* ClientAPIsMask */ 0, /* NumDrivers */ { NULL }, /* Drivers */ 2, /* NumAtExitCalls */ diff --git a/src/egl/main/eglglobals.h b/src/egl/main/eglglobals.h index 58511076d4..5ebb914ca7 100644 --- a/src/egl/main/eglglobals.h +++ b/src/egl/main/eglglobals.h @@ -19,9 +19,6 @@ struct _egl_global EGLScreenMESA FreeScreenHandle; - /* bitmaks of supported APIs (supported by _some_ driver) */ - EGLint ClientAPIsMask; - EGLint NumDrivers; _EGLDriver *Drivers[10]; -- cgit v1.2.3 From f1c5cab5525dfcb8edffa275e7c8c3e753c7536f Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Tue, 29 Sep 2009 16:11:06 +0800 Subject: egl: Improve logging facility. Add _eglSetLogger and _eglSetLogLevel to allow drivers to change the message logger or report level. Signed-off-by: Chia-I Wu --- src/egl/main/eglglobals.c | 7 +- src/egl/main/egllog.c | 181 +++++++++++++++++++++++++++++++++------------- src/egl/main/egllog.h | 11 +++ 3 files changed, 145 insertions(+), 54 deletions(-) (limited to 'src') diff --git a/src/egl/main/eglglobals.c b/src/egl/main/eglglobals.c index 30d9fe97b4..443d0f072c 100644 --- a/src/egl/main/eglglobals.c +++ b/src/egl/main/eglglobals.c @@ -18,9 +18,10 @@ struct _egl_global _eglGlobal = 0, /* NumDrivers */ { NULL }, /* Drivers */ 2, /* NumAtExitCalls */ - { /* AtExitCalls */ - _eglFiniDisplay, - _eglUnloadDrivers + { + /* default AtExitCalls, called in reverse order */ + _eglUnloadDrivers, /* always called last */ + _eglFiniDisplay }, }; diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c index 23eb523eeb..11a9bf7275 100644 --- a/src/egl/main/egllog.c +++ b/src/egl/main/egllog.c @@ -9,47 +9,140 @@ #include #include #include + #include "egllog.h" +#include "eglmutex.h" #define MAXSTRING 1000 -#define FALLBACK_LOG_LEVEL _EGL_WARNING -#define FALLBACK_LOG_LEVEL_STR "warning" +#define FALLBACK_LOG_LEVEL _EGL_WARNING -static EGLint ReportingLevel = -1; +static struct { + _EGLMutex mutex; -static void -log_level_initialize(void) + EGLBoolean initialized; + EGLint level; + _EGLLogProc logger; + EGLint num_messages; +} logging = { + _EGL_MUTEX_INITIALIZER, + EGL_FALSE, + FALLBACK_LOG_LEVEL, + NULL, + 0 +}; + +static const char *level_strings[] = { + /* the order is important */ + "fatal", + "warning", + "info", + "debug", + NULL +}; + + +/** + * Set the function to be called when there is a message to log. + * Note that the function will be called with an internal lock held. + * Recursive logging is not allowed. + */ +void +_eglSetLogProc(_EGLLogProc logger) { - char *log_env = getenv("EGL_LOG_LEVEL"); + EGLint num_messages = 0; - if (log_env == NULL) { - ReportingLevel = FALLBACK_LOG_LEVEL; - } - else if (strcasecmp(log_env, "fatal") == 0) { - ReportingLevel = _EGL_FATAL; - } - else if (strcasecmp(log_env, "warning") == 0) { - ReportingLevel = _EGL_WARNING; + _eglLockMutex(&logging.mutex); + + if (logging.logger != logger) { + logging.logger = logger; + + num_messages = logging.num_messages; + logging.num_messages = 0; } - else if (strcasecmp(log_env, "info") == 0) { - ReportingLevel = _EGL_INFO; + + _eglUnlockMutex(&logging.mutex); + + if (num_messages) + _eglLog(_EGL_DEBUG, + "New logger installed. " + "Messages before the new logger might not be available."); +} + + +/** + * Set the log reporting level. + */ +void +_eglSetLogLevel(EGLint level) +{ + switch (level) { + case _EGL_FATAL: + case _EGL_WARNING: + case _EGL_INFO: + case _EGL_DEBUG: + _eglLockMutex(&logging.mutex); + logging.level = level; + _eglUnlockMutex(&logging.mutex); + break; + default: + break; } - else if (strcasecmp(log_env, "debug") == 0) { - ReportingLevel = _EGL_DEBUG; +} + + +/** + * The default logger. It prints the message to stderr. + */ +static void +_eglDefaultLogger(EGLint level, const char *msg) +{ + fprintf(stderr, "libEGL %s: %s\n", level_strings[level], msg); +} + + +/** + * Initialize the logging facility. + */ +static void +_eglInitLogger(void) +{ + const char *log_env; + EGLint i, level = -1; + + if (logging.initialized) + return; + + log_env = getenv("EGL_LOG_LEVEL"); + if (log_env) { + for (i = 0; level_strings[i]; i++) { + if (strcasecmp(log_env, level_strings[i]) == 0) { + level = i; + break; + } + } } else { - fprintf(stderr, "Unrecognized EGL_LOG_LEVEL environment variable value. " + level = FALLBACK_LOG_LEVEL; + } + + logging.logger = _eglDefaultLogger; + logging.level = (level >= 0) ? level : FALLBACK_LOG_LEVEL; + logging.initialized = EGL_TRUE; + + /* it is fine to call _eglLog now */ + if (log_env && level < 0) { + _eglLog(_EGL_WARNING, + "Unrecognized EGL_LOG_LEVEL environment variable value. " "Expected one of \"fatal\", \"warning\", \"info\", \"debug\". " - "Got \"%s\". Falling back to \"%s\".\n", - log_env, FALLBACK_LOG_LEVEL_STR); - ReportingLevel = FALLBACK_LOG_LEVEL; + "Got \"%s\". Falling back to \"%s\".", + log_env, level_strings[FALLBACK_LOG_LEVEL]); } } /** - * Log a message to stderr. + * Log a message with message logger. * \param level one of _EGL_FATAL, _EGL_WARNING, _EGL_INFO, _EGL_DEBUG. */ void @@ -57,40 +150,26 @@ _eglLog(EGLint level, const char *fmtStr, ...) { va_list args; char msg[MAXSTRING]; - const char *levelStr; - static int log_level_initialized = 0; - if (!log_level_initialized) { - log_level_initialize(); - log_level_initialized = 1; - } + /* one-time initialization; a little race here is fine */ + if (!logging.initialized) + _eglInitLogger(); + if (level > logging.level || level < 0) + return; - if (level <= ReportingLevel) { - switch (level) { - case _EGL_FATAL: - levelStr = "Fatal"; - break; - case _EGL_WARNING: - levelStr = "Warning"; - break; - case _EGL_INFO: - levelStr = "Info"; - break; - case _EGL_DEBUG: - levelStr = "Debug"; - break; - default: - levelStr = ""; - } + _eglLockMutex(&logging.mutex); + if (logging.logger) { va_start(args, fmtStr); vsnprintf(msg, MAXSTRING, fmtStr, args); va_end(args); - fprintf(stderr, "libEGL %s: %s\n", levelStr, msg); - - if (level == _EGL_FATAL) { - exit(1); /* or abort()? */ - } + logging.logger(level, msg); + logging.num_messages++; } + + _eglUnlockMutex(&logging.mutex); + + if (level == _EGL_FATAL) + exit(1); /* or abort()? */ } diff --git a/src/egl/main/egllog.h b/src/egl/main/egllog.h index 2fa352f155..83c8bb72a6 100644 --- a/src/egl/main/egllog.h +++ b/src/egl/main/egllog.h @@ -9,6 +9,17 @@ #define _EGL_DEBUG 3 /* useful info for debugging */ +typedef void (*_EGLLogProc)(EGLint level, const char *msg); + + +extern void +_eglSetLogProc(_EGLLogProc logger); + + +extern void +_eglSetLogLevel(EGLint level); + + extern void _eglLog(EGLint level, const char *fmtStr, ...); -- cgit v1.2.3 From cf33aaf8fe2b1d22e394f431735b76f3ab04b854 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Tue, 13 Oct 2009 22:53:32 +0200 Subject: nouveau: nv30: use texture width,height for render target dimensions --- src/gallium/drivers/nv30/nv30_state_fb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv30/nv30_state_fb.c b/src/gallium/drivers/nv30/nv30_state_fb.c index 44b6a74715..2729dcec7c 100644 --- a/src/gallium/drivers/nv30/nv30_state_fb.c +++ b/src/gallium/drivers/nv30/nv30_state_fb.c @@ -40,10 +40,9 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) for (i = 1; i < fb->nr_cbufs; i++) assert(!(rt[i]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)); - /* FIXME: NV34TCL_RT_FORMAT_LOG2_[WIDTH/HEIGHT] */ rt_format = NV34TCL_RT_FORMAT_TYPE_SWIZZLED | - log2i(fb->width) << 16 /*NV34TCL_RT_FORMAT_LOG2_WIDTH_SHIFT*/ | - log2i(fb->height) << 24 /*NV34TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT*/; + (log2i(rt[0]->base.width) << NV34TCL_RT_FORMAT_LOG2_WIDTH_SHIFT) | + (log2i(rt[0]->base.height) << NV34TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT); } else rt_format = NV34TCL_RT_FORMAT_TYPE_LINEAR; -- cgit v1.2.3 From f058b25881e08c9d89a33345e5c84e1357396932 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 8 Oct 2009 17:28:02 -0700 Subject: Store clipping distance for user clip planes as part of vertex processing Once the clipping distance is calculated and stored per vertex, the distances can be re-used when clipping is actually performed. This doesn't have any immediate benefit, but it paves the way for implementing gl_ClipDistance in vertex shaders and result.clip[] in vertex programs. This has not produces any oglconform regressions on my G31 system which uses software TNL. Signed-off-by: Ian Romanick Reviewed-by: Brian Paul --- src/mesa/tnl/t_context.h | 1 + src/mesa/tnl/t_vb_cliptmp.h | 103 +++++++++++++++++++++++++++++++++++++------- src/mesa/tnl/t_vb_program.c | 15 +++++++ src/mesa/tnl/t_vb_vertex.c | 31 +++++++++++-- 4 files changed, 132 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index 6137c2d2fe..ca4edcfcb9 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -207,6 +207,7 @@ struct vertex_buffer GLvector4f *EyePtr; /* _TNL_BIT_POS */ GLvector4f *ClipPtr; /* _TNL_BIT_POS */ GLvector4f *NdcPtr; /* _TNL_BIT_POS */ + GLfloat *ClipDistancePtr[MAX_CLIP_PLANES]; /* _TNL_BIT_POS */ GLubyte ClipOrMask; /* _TNL_BIT_POS */ GLubyte ClipAndMask; /* _TNL_BIT_POS */ GLubyte *ClipMask; /* _TNL_BIT_POS */ diff --git a/src/mesa/tnl/t_vb_cliptmp.h b/src/mesa/tnl/t_vb_cliptmp.h index 618b8b3130..0d2183a9e6 100644 --- a/src/mesa/tnl/t_vb_cliptmp.h +++ b/src/mesa/tnl/t_vb_cliptmp.h @@ -80,6 +80,58 @@ do { \ } while (0) +#define POLY_USERCLIP(PLANE) \ +do { \ + if (mask & CLIP_USER_BIT) { \ + GLuint idxPrev = inlist[0]; \ + GLfloat dpPrev = VB->ClipDistancePtr[PLANE][idxPrev]; \ + GLuint outcount = 0; \ + GLuint i; \ + \ + inlist[n] = inlist[0]; /* prevent rotation of vertices */ \ + for (i = 1; i <= n; i++) { \ + GLuint idx = inlist[i]; \ + GLfloat dp = VB->ClipDistancePtr[PLANE][idx]; \ + \ + if (!IS_NEGATIVE(dpPrev)) { \ + outlist[outcount++] = idxPrev; \ + } \ + \ + if (DIFFERENT_SIGNS(dp, dpPrev)) { \ + if (IS_NEGATIVE(dp)) { \ + /* Going out of bounds. Avoid division by zero as we \ + * know dp != dpPrev from DIFFERENT_SIGNS, above. \ + */ \ + GLfloat t = dp / (dp - dpPrev); \ + INTERP_4F( t, coord[newvert], coord[idx], coord[idxPrev]); \ + interp( ctx, t, newvert, idx, idxPrev, GL_TRUE ); \ + } else { \ + /* Coming back in. \ + */ \ + GLfloat t = dpPrev / (dpPrev - dp); \ + INTERP_4F( t, coord[newvert], coord[idxPrev], coord[idx]); \ + interp( ctx, t, newvert, idxPrev, idx, GL_FALSE ); \ + } \ + outlist[outcount++] = newvert++; \ + } \ + \ + idxPrev = idx; \ + dpPrev = dp; \ + } \ + \ + if (outcount < 3) \ + return; \ + \ + { \ + GLuint *tmp = inlist; \ + inlist = outlist; \ + outlist = tmp; \ + n = outcount; \ + } \ + } \ +} while (0) + + #define LINE_CLIP(PLANE_BIT, A, B, C, D ) \ do { \ if (mask & PLANE_BIT) { \ @@ -111,6 +163,37 @@ do { \ } while (0) +#define LINE_USERCLIP(PLANE) \ +do { \ + if (mask & CLIP_USER_BIT) { \ + const GLfloat dp0 = VB->ClipDistancePtr[PLANE][v0]; \ + const GLfloat dp1 = VB->ClipDistancePtr[PLANE][v1]; \ + const GLboolean neg_dp0 = IS_NEGATIVE(dp0); \ + const GLboolean neg_dp1 = IS_NEGATIVE(dp1); \ + \ + /* For regular clipping, we know from the clipmask that one \ + * (or both) of these must be negative (otherwise we wouldn't \ + * be here). \ + * For userclip, there is only a single bit for all active \ + * planes, so we can end up here when there is nothing to do, \ + * hence the second IS_NEGATIVE() test: \ + */ \ + if (neg_dp0 && neg_dp1) \ + return; /* both vertices outside clip plane: discard */ \ + \ + if (neg_dp1) { \ + GLfloat t = dp1 / (dp1 - dp0); \ + if (t > t1) t1 = t; \ + } else if (neg_dp0) { \ + GLfloat t = dp0 / (dp0 - dp1); \ + if (t > t0) t0 = t; \ + } \ + if (t0 + t1 >= 1.0) \ + return; /* discard */ \ + } \ +} while (0) + + /* Clip a line against the viewport and user clip planes. */ @@ -139,11 +222,7 @@ TAG(clip_line)( GLcontext *ctx, GLuint v0, GLuint v1, GLubyte mask ) if (mask & CLIP_USER_BIT) { for (p = 0; p < ctx->Const.MaxClipPlanes; p++) { if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { - const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; - const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; - const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; - const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; - LINE_CLIP( CLIP_USER_BIT, a, b, c, d ); + LINE_USERCLIP(p); } } } @@ -228,11 +307,7 @@ TAG(clip_tri)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte mask ) if (mask & CLIP_USER_BIT) { for (p = 0; p < ctx->Const.MaxClipPlanes; p++) { if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { - const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; - const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; - const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; - const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; - POLY_CLIP( CLIP_USER_BIT, a, b, c, d ); + POLY_USERCLIP(p); } } } @@ -291,11 +366,7 @@ TAG(clip_quad)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, if (mask & CLIP_USER_BIT) { for (p = 0; p < ctx->Const.MaxClipPlanes; p++) { if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { - const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; - const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; - const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; - const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; - POLY_CLIP( CLIP_USER_BIT, a, b, c, d ); + POLY_USERCLIP(p); } } } @@ -317,4 +388,6 @@ TAG(clip_quad)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, #undef SIZE #undef TAG #undef POLY_CLIP +#undef POLY_USERCLIP #undef LINE_CLIP +#undef LINE_USERCLIP diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c index c10a27614f..5fb83c2b01 100644 --- a/src/mesa/tnl/t_vb_program.c +++ b/src/mesa/tnl/t_vb_program.c @@ -66,6 +66,7 @@ struct vp_stage_data { GLvector4f results[VERT_RESULT_MAX]; GLvector4f ndcCoords; /**< normalized device coords */ + GLfloat *clipdistance[MAX_CLIP_PLANES]; GLubyte *clipmask; /**< clip flags */ GLubyte ormask, andmask; /**< for clipping */ }; @@ -77,6 +78,7 @@ struct vp_stage_data { static void userclip( GLcontext *ctx, GLvector4f *clip, + GLfloat *clipdistance[MAX_CLIP_PLANES], GLubyte *clipmask, GLubyte *clipormask, GLubyte *clipandmask ) @@ -105,6 +107,8 @@ userclip( GLcontext *ctx, clipmask[i] |= CLIP_USER_BIT; } + clipdistance[p][i] = dp; + STRIDE_F(coord, stride); } @@ -164,6 +168,7 @@ do_ndc_cliptest(GLcontext *ctx, struct vp_stage_data *store) ctx->VertexProgram.Current->IsPositionInvariant)) { userclip( ctx, VB->ClipPtr, + store->clipdistance, store->clipmask, &store->ormask, &store->andmask ); @@ -171,6 +176,9 @@ do_ndc_cliptest(GLcontext *ctx, struct vp_stage_data *store) if (store->andmask) { return GL_FALSE; } + + memcpy(VB->ClipDistancePtr, store->clipdistance, + sizeof(store->clipdistance)); } VB->ClipAndMask = store->andmask; @@ -514,6 +522,10 @@ init_vp(GLcontext *ctx, struct tnl_pipeline_stage *stage) _mesa_vector4f_alloc( &store->ndcCoords, 0, size, 32 ); store->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 ); + for (i = 0; i < MAX_CLIP_PLANES; i++) + store->clipdistance[i] = + (GLfloat *) ALIGN_MALLOC(sizeof(GLfloat) * size, 32); + return GL_TRUE; } @@ -537,6 +549,9 @@ dtr(struct tnl_pipeline_stage *stage) _mesa_vector4f_free( &store->ndcCoords ); ALIGN_FREE( store->clipmask ); + for (i = 0; i < MAX_CLIP_PLANES; i++) + ALIGN_FREE(store->clipdistance[i]); + FREE( store ); stage->privatePtr = NULL; } diff --git a/src/mesa/tnl/t_vb_vertex.c b/src/mesa/tnl/t_vb_vertex.c index 4734754ea4..2a61ff1177 100644 --- a/src/mesa/tnl/t_vb_vertex.c +++ b/src/mesa/tnl/t_vb_vertex.c @@ -44,6 +44,7 @@ struct vertex_stage_data { GLvector4f eye; GLvector4f clip; GLvector4f proj; + GLfloat *clipdistance[MAX_CLIP_PLANES]; GLubyte *clipmask; GLubyte ormask; GLubyte andmask; @@ -56,11 +57,12 @@ struct vertex_stage_data { /* This function implements cliptesting for user-defined clip planes. * The clipping of primitives to these planes is implemented in - * t_render_clip.h. + * t_vp_cliptmp.h. */ #define USER_CLIPTEST(NAME, SZ) \ static void NAME( GLcontext *ctx, \ GLvector4f *clip, \ + GLfloat *clipdistances[MAX_CLIP_PLANES], \ GLubyte *clipmask, \ GLubyte *clipormask, \ GLubyte *clipandmask ) \ @@ -88,6 +90,8 @@ static void NAME( GLcontext *ctx, \ clipmask[i] |= CLIP_USER_BIT; \ } \ \ + clipdistances[p][i] = dp; \ + \ STRIDE_F(coord, stride); \ } \ \ @@ -107,8 +111,9 @@ USER_CLIPTEST(userclip3, 3) USER_CLIPTEST(userclip4, 4) static void (*(usercliptab[5]))( GLcontext *, - GLvector4f *, GLubyte *, - GLubyte *, GLubyte * ) = + GLvector4f *, + GLfloat *[MAX_CLIP_PLANES], + GLubyte *, GLubyte *, GLubyte * ) = { NULL, NULL, @@ -214,12 +219,16 @@ static GLboolean run_vertex_stage( GLcontext *ctx, if (ctx->Transform.ClipPlanesEnabled) { usercliptab[VB->ClipPtr->size]( ctx, VB->ClipPtr, + store->clipdistance, store->clipmask, &store->ormask, &store->andmask ); if (store->andmask) return GL_FALSE; + + memcpy(VB->ClipDistancePtr, store->clipdistance, + sizeof(store->clipdistance)); } VB->ClipAndMask = store->andmask; @@ -236,6 +245,7 @@ static GLboolean init_vertex_stage( GLcontext *ctx, struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct vertex_stage_data *store; GLuint size = VB->Size; + unsigned i; stage->privatePtr = CALLOC(sizeof(*store)); store = VERTEX_STAGE_DATA(stage); @@ -247,8 +257,17 @@ static GLboolean init_vertex_stage( GLcontext *ctx, _mesa_vector4f_alloc( &store->proj, 0, size, 32 ); store->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 ); + for (i = 0; i < MAX_CLIP_PLANES; i++) + store->clipdistance[i] = + (GLfloat *) ALIGN_MALLOC(sizeof(GLfloat) * size, 32); if (!store->clipmask || + !store->clipdistance[0] || + !store->clipdistance[1] || + !store->clipdistance[2] || + !store->clipdistance[3] || + !store->clipdistance[4] || + !store->clipdistance[5] || !store->eye.data || !store->clip.data || !store->proj.data) @@ -262,10 +281,16 @@ static void dtr( struct tnl_pipeline_stage *stage ) struct vertex_stage_data *store = VERTEX_STAGE_DATA(stage); if (store) { + unsigned i; + _mesa_vector4f_free( &store->eye ); _mesa_vector4f_free( &store->clip ); _mesa_vector4f_free( &store->proj ); ALIGN_FREE( store->clipmask ); + + for (i = 0; i < MAX_CLIP_PLANES; i++) + ALIGN_FREE(store->clipdistance[i]); + FREE(store); stage->privatePtr = NULL; stage->run = init_vertex_stage; -- cgit v1.2.3 From dfefde38c7dfe70a3531cb85215e55eeb6407180 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 13 Oct 2009 16:18:06 -0600 Subject: mesa: don't print pointer in _mesa_fprint_parameter_list() --- src/mesa/shader/prog_print.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index a2bed07900..ba4d39452f 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -906,7 +906,8 @@ _mesa_fprint_parameter_list(FILE *f, if (!list) return; - _mesa_fprintf(f, "param list %p\n", (void *) list); + if (0) + _mesa_fprintf(f, "param list %p\n", (void *) list); _mesa_fprintf(f, "dirty state flags: 0x%x\n", list->StateFlags); for (i = 0; i < list->NumParameters; i++){ struct gl_program_parameter *param = list->Parameters + i; -- cgit v1.2.3 From 435623b3f0b2d2db5b107ef177693ccafc591a29 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 13 Oct 2009 16:32:15 -0600 Subject: mesa: rework _mesa_read_shader() debug hook Look for shaders named "newshader_" to replace the incoming shader text. For debug purposes. --- src/mesa/main/shaders.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/main/shaders.c b/src/mesa/main/shaders.c index bc76b91291..96fd8695a5 100644 --- a/src/mesa/main/shaders.c +++ b/src/mesa/main/shaders.c @@ -388,7 +388,6 @@ _mesa_read_shader(const char *fname) int len; if (!f) { - _mesa_fprintf(stderr, "Unable to open shader file %s\n", fname); return NULL; } @@ -401,11 +400,6 @@ _mesa_read_shader(const char *fname) shader = _mesa_strdup(buffer); free(buffer); - if (0) { - _mesa_fprintf(stderr, "Read shader %s:\n", fname); - _mesa_fprintf(stderr, "%s\n", shader); - } - return shader; } @@ -475,19 +469,25 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, source[totalLength - 1] = '\0'; source[totalLength - 2] = '\0'; -#if 0 if (0) { + /* Compute the shader's source code checksum then try to open a file + * named newshader_. If it exists, use it in place of the + * original shader source code. For debugging. + */ + const GLuint checksum = _mesa_str_checksum(source); + char filename[100]; GLcharARB *newSource; - newSource = _mesa_read_shader("newshader.frag"); + sprintf(filename, "newshader_%d", checksum); + + newSource = _mesa_read_shader(filename); if (newSource) { + _mesa_fprintf(stderr, "Mesa: Replacing shader %u chksum=%d with %s\n", + shaderObj, checksum, filename); _mesa_free(source); source = newSource; } - } -#else - (void) _mesa_read_shader; -#endif + } ctx->Driver.ShaderSource(ctx, shaderObj, source); -- cgit v1.2.3 From 220f72a8d04728efbbc097d27be43590b0fe1ceb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 13 Oct 2009 16:33:17 -0600 Subject: mesa: minor tweak to printf string --- src/mesa/shader/shader_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index ce19649323..6de97984e6 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -1526,7 +1526,7 @@ _mesa_use_program(GLcontext *ctx, GLuint program) /* debug code */ if (0) { GLuint i; - _mesa_printf("Use Shader %u\n", shProg->Name); + _mesa_printf("Use Shader Program %u\n", shProg->Name); for (i = 0; i < shProg->NumShaders; i++) { _mesa_printf(" shader %u, type 0x%x, checksum %u\n", shProg->Shaders[i]->Name, -- cgit v1.2.3 From 23c0c820e2767324546d450d2a7aa7bf1f70c36f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 14 Oct 2009 11:42:05 +1000 Subject: r300g: fix case where texture unit 0 is disabled but unit 1 is enabled. to reproduce, start texrect, disable 0 texture in menu. Signed-off-by: Dave Airlie --- src/gallium/drivers/r300/r300_emit.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 570b4c5ef7..99deb50400 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -683,7 +683,8 @@ validate: /* ...textures... */ for (i = 0; i < r300->texture_count; i++) { tex = r300->textures[i]; - assert(tex && tex->buffer && "texture is marked, but NULL!"); + if (!tex) + continue; if (!r300->winsys->add_buffer(r300->winsys, tex->buffer, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0)) { r300->context.flush(&r300->context, 0, NULL); @@ -770,12 +771,13 @@ validate: if (r300->dirty_state & (R300_ANY_NEW_SAMPLERS | R300_ANY_NEW_TEXTURES)) { for (i = 0; i < MIN2(r300->sampler_count, r300->texture_count); i++) { - if (r300->dirty_state & - ((R300_NEW_SAMPLER << i) | (R300_NEW_TEXTURE << i))) { - r300_emit_texture(r300, - r300->sampler_states[i], - r300->textures[i], - i); + if (r300->dirty_state & + ((R300_NEW_SAMPLER << i) | (R300_NEW_TEXTURE << i))) { + if (r300->textures[i]) + r300_emit_texture(r300, + r300->sampler_states[i], + r300->textures[i], + i); r300->dirty_state &= ~((R300_NEW_SAMPLER << i) | (R300_NEW_TEXTURE << i)); dirty_tex++; -- cgit v1.2.3 From 210481ae16e966865dcf9f1fd5f5dfabf4dc28bc Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 14 Oct 2009 15:13:25 +1000 Subject: r300g: attempt to make bo space check sane. This attempts to make r300g do proper bo space checking as opposed to whatever it was doing now. Signed-off-by: Dave Airlie --- src/gallium/drivers/r300/r300_context.c | 9 +++++++++ src/gallium/drivers/r300/r300_emit.c | 3 +++ src/gallium/drivers/r300/r300_winsys.h | 6 ++++++ src/gallium/winsys/drm/radeon/core/radeon_r300.c | 23 ++++++++++++++++++++--- 4 files changed, 38 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 9cc455135d..e6bc80e48f 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -136,6 +136,13 @@ r300_is_buffer_referenced( struct pipe_context *pipe, return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; } +static void r300_flush_cb(void *data) +{ + struct r300_context* const cs_context_copy = data; + + cs_context_copy->context.flush(&cs_context_copy->context, 0, NULL); +} + struct pipe_context* r300_create_context(struct pipe_screen* screen, struct r300_winsys* r300_winsys) { @@ -190,6 +197,8 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300_init_state_functions(r300); r300_emit_invariant_state(r300); + + r300->winsys->set_flush_cb(r300->winsys, r300_flush_cb, r300); r300->dirty_state = R300_NEW_KITCHEN_SINK; r300->dirty_hw++; diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 99deb50400..64748ad8f8 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -658,6 +658,9 @@ void r300_emit_dirty_state(struct r300_context* r300) r300_update_derived_state(r300); + /* Clean out BOs. */ + r300->winsys->reset_bos(r300->winsys); + /* XXX check size */ validate: /* Color buffers... */ diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h index f18ad75a47..540f8eca92 100644 --- a/src/gallium/drivers/r300/r300_winsys.h +++ b/src/gallium/drivers/r300/r300_winsys.h @@ -92,6 +92,12 @@ struct r300_winsys { /* Flush the CS. */ void (*flush_cs)(struct r300_winsys* winsys); + + /* winsys flush - callback from winsys when flush required */ + void (*set_flush_cb)(struct r300_winsys *winsys, + void (*flush_cb)(void *), void *data); + + void (*reset_bos)(struct r300_winsys *winsys); }; struct pipe_context* r300_create_context(struct pipe_screen* screen, diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index d2d84f1a8f..3587892e00 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -22,6 +22,17 @@ #include "radeon_r300.h" +static void radeon_r300_set_flush_cb(struct r300_winsys *winsys, + void (*flush_cb)(void *), + void *data) +{ + struct radeon_winsys_priv* priv = + (struct radeon_winsys_priv*)winsys->radeon_winsys; + + radeon_cs_space_set_flush(priv->cs, flush_cb, + data); +} + static boolean radeon_r300_add_buffer(struct r300_winsys* winsys, struct pipe_buffer* pbuffer, uint32_t rd, @@ -95,6 +106,13 @@ static void radeon_r300_write_cs_reloc(struct r300_winsys* winsys, } } +static void radeon_r300_reset_bos(struct r300_winsys *winsys) +{ + struct radeon_winsys_priv* priv = + (struct radeon_winsys_priv*)winsys->radeon_winsys; + radeon_cs_space_reset_bos(priv->cs); +} + static void radeon_r300_end_cs(struct r300_winsys* winsys, const char* file, const char* function, @@ -119,9 +137,6 @@ static void radeon_r300_flush_cs(struct r300_winsys* winsys) radeon_cs_print(priv->cs, stderr); } - /* Clean out BOs. */ - radeon_cs_space_reset_bos(priv->cs); - /* Reset CS. * Someday, when we care about performance, we should really find a way * to rotate between two or three CS objects so that the GPU can be @@ -203,6 +218,8 @@ radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys) winsys->write_cs_reloc = radeon_r300_write_cs_reloc; winsys->end_cs = radeon_r300_end_cs; winsys->flush_cs = radeon_r300_flush_cs; + winsys->reset_bos = radeon_r300_reset_bos; + winsys->set_flush_cb = radeon_r300_set_flush_cb; memcpy(winsys, old_winsys, sizeof(struct radeon_winsys)); -- cgit v1.2.3 From c1bee7bdea470b6b5dcebef9aacc8fe4feca687c Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 14 Oct 2009 16:53:12 +1000 Subject: r300g: fixup arb occulsion query support. 1: add rv530 support - num z pipes cap - add proper start/finish query options for rv530 2: convert to use linked list properly. 3: add flushing required check. 4: initial Z top disabling support. TODO: make it actually work on my rv530. --- src/gallium/drivers/r300/r300_chipset.h | 2 + src/gallium/drivers/r300/r300_context.c | 10 ++-- src/gallium/drivers/r300/r300_context.h | 4 +- src/gallium/drivers/r300/r300_emit.c | 69 ++++++++++++++++++++---- src/gallium/drivers/r300/r300_flush.c | 10 +++- src/gallium/drivers/r300/r300_query.c | 42 ++++++++------- src/gallium/drivers/r300/r300_reg.h | 15 ++++-- src/gallium/drivers/r300/r300_screen.c | 1 + src/gallium/drivers/r300/r300_state.c | 11 ++-- src/gallium/drivers/r300/r300_winsys.h | 3 ++ src/gallium/winsys/drm/radeon/core/radeon_r300.c | 10 ++++ 11 files changed, 134 insertions(+), 43 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_chipset.h b/src/gallium/drivers/r300/r300_chipset.h index 322d4a57e4..f015a4243d 100644 --- a/src/gallium/drivers/r300/r300_chipset.h +++ b/src/gallium/drivers/r300/r300_chipset.h @@ -36,6 +36,8 @@ struct r300_capabilities { int num_vert_fpus; /* The number of fragment pipes */ int num_frag_pipes; + /* The number of z pipes */ + int num_z_pipes; /* Whether or not TCL is physically present */ boolean has_tcl; /* Whether or not this is an RV515 or newer; R500s have many differences diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index e6bc80e48f..7a9c098e30 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -99,11 +99,9 @@ static void r300_destroy_context(struct pipe_context* context) { context->screen->buffer_destroy(r300->oqbo); /* If there are any queries pending or not destroyed, remove them now. */ - if (r300->query_list) { - foreach_s(query, temp, r300->query_list) { - remove_from_list(query); - FREE(query); - } + foreach_s(query, temp, &r300->query_list) { + remove_from_list(query); + FREE(query); } FREE(r300->blend_color_state); @@ -201,6 +199,6 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->winsys->set_flush_cb(r300->winsys, r300_flush_cb, r300); r300->dirty_state = R300_NEW_KITCHEN_SINK; r300->dirty_hw++; - + make_empty_list(&r300->query_list); return &r300->context; } diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 086633f732..9b0094b63c 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -172,6 +172,8 @@ struct r300_query { unsigned int count; /* The offset of this query into the query buffer, in bytes. */ unsigned offset; + /* if we've flushed the query */ + boolean flushed; /* Linked list members. */ struct r300_query* prev; struct r300_query* next; @@ -237,7 +239,7 @@ struct r300_context { /* Occlusion query buffer. */ struct pipe_buffer* oqbo; /* Query list. */ - struct r300_query* query_list; + struct r300_query query_list; /* Various CSO state objects. */ /* Blend state. */ diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 64748ad8f8..3d28249c16 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -323,28 +323,30 @@ void r300_emit_fb_state(struct r300_context* r300, void r300_emit_query_begin(struct r300_context* r300, struct r300_query* query) { + struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps; CS_LOCALS(r300); /* XXX This will almost certainly not return good results * for overlapping queries. */ - BEGIN_CS(2); + BEGIN_CS(4); + if (caps->family == CHIP_FAMILY_RV530) { + OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL); + } else { + OUT_CS_REG(R300_SU_REG_DEST, R300_RASTER_PIPE_SELECT_ALL); + } OUT_CS_REG(R300_ZB_ZPASS_DATA, 0); END_CS; } -void r300_emit_query_end(struct r300_context* r300, - struct r300_query* query) + +static void r300_emit_query_finish(struct r300_context *r300, + struct r300_query *query) { struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps; CS_LOCALS(r300); - if (!r300->winsys->add_buffer(r300->winsys, r300->oqbo, - 0, RADEON_GEM_DOMAIN_GTT)) { - debug_printf("r300: There wasn't room for the OQ buffer!?" - " Oh noes!\n"); - } - assert(caps->num_frag_pipes); + BEGIN_CS(6 * caps->num_frag_pipes + 2); /* I'm not so sure I like this switch, but it's hard to be elegant * when there's so many special cases... @@ -394,6 +396,55 @@ void r300_emit_query_end(struct r300_context* r300, } +static void rv530_emit_query_single(struct r300_context *r300, + struct r300_query *query) +{ + CS_LOCALS(r300); + + BEGIN_CS(8); + OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_0); + OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1); + OUT_CS_RELOC(r300->oqbo, query->offset, 0, RADEON_GEM_DOMAIN_GTT, 0); + OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL); + END_CS; +} + +static void rv530_emit_query_double(struct r300_context *r300, + struct r300_query *query) +{ + CS_LOCALS(r300); + + BEGIN_CS(14); + OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_0); + OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1); + OUT_CS_RELOC(r300->oqbo, query->offset, 0, RADEON_GEM_DOMAIN_GTT, 0); + OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_1); + OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1); + OUT_CS_RELOC(r300->oqbo, query->offset + sizeof(uint32_t), 0, RADEON_GEM_DOMAIN_GTT, 0); + OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL); + END_CS; +} + +void r300_emit_query_end(struct r300_context* r300, + struct r300_query* query) +{ + struct r300_capabilities *caps = r300_screen(r300->context.screen)->caps; + + if (!r300->winsys->add_buffer(r300->winsys, r300->oqbo, + 0, RADEON_GEM_DOMAIN_GTT)) { + debug_printf("r300: There wasn't room for the OQ buffer!?" + " Oh noes!\n"); + } + + if (caps->family == CHIP_FAMILY_RV530) { + if (caps->num_z_pipes == 2) + rv530_emit_query_double(r300, query); + else + rv530_emit_query_single(r300, query); + } else + r300_emit_query_finish(r300, query); +} + void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs) { CS_LOCALS(r300); diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c index 0dff1c6f4f..a8ab0d7212 100644 --- a/src/gallium/drivers/r300/r300_flush.c +++ b/src/gallium/drivers/r300/r300_flush.c @@ -26,9 +26,10 @@ static void r300_flush(struct pipe_context* pipe, unsigned flags, struct pipe_fence_handle** fence) { - struct r300_context* r300 = r300_context(pipe); - CS_LOCALS(r300); + struct r300_context *r300 = r300_context(pipe); + struct r300_query *query; + CS_LOCALS(r300); /* We probably need to flush Draw, but we may have been called from * within Draw. This feels kludgy, but it might be the best thing. */ if (!r300->draw->flushing) { @@ -41,8 +42,13 @@ static void r300_flush(struct pipe_context* pipe, r300->dirty_state = R300_NEW_KITCHEN_SINK; r300->dirty_hw = 0; } + /* reset flushed query */ + foreach(query, &r300->query_list) { + query->flushed = TRUE; + } } + void r300_init_flush_functions(struct r300_context* r300) { r300->context.flush = r300_flush; diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c index 2880d34877..b01313648b 100644 --- a/src/gallium/drivers/r300/r300_query.c +++ b/src/gallium/drivers/r300/r300_query.c @@ -24,13 +24,13 @@ #include "r300_emit.h" -static struct pipe_query* r300_create_query(struct pipe_context* pipe, +static struct pipe_query *r300_create_query(struct pipe_context *pipe, unsigned query_type) { - struct r300_context* r300 = r300_context(pipe); - struct r300_screen* r300screen = r300_screen(r300->context.screen); - unsigned query_size = r300screen->caps->num_frag_pipes * 4; - struct r300_query* q, * qptr; + struct r300_context *r300 = r300_context(pipe); + struct r300_screen *r300screen = r300_screen(r300->context.screen); + unsigned query_size; + struct r300_query *q, *qptr; q = CALLOC_STRUCT(r300_query); @@ -39,13 +39,16 @@ static struct pipe_query* r300_create_query(struct pipe_context* pipe, q->active = FALSE; - if (!r300->query_list) { - r300->query_list = q; - } else if (!is_empty_list(r300->query_list)) { - qptr = last_elem(r300->query_list); + if (r300screen->caps->family == CHIP_FAMILY_RV530) + query_size = r300screen->caps->num_z_pipes * sizeof(uint32_t); + else + query_size = r300screen->caps->num_frag_pipes * sizeof(uint32_t); + + if (!is_empty_list(&r300->query_list)) { + qptr = last_elem(&r300->query_list); q->offset = qptr->offset + query_size; - insert_at_tail(r300->query_list, q); } + insert_at_tail(&r300->query_list, q); /* XXX */ if (q->offset >= 4096) { @@ -74,9 +77,10 @@ static void r300_begin_query(struct pipe_context* pipe, map = pipe->screen->buffer_map(pipe->screen, r300->oqbo, PIPE_BUFFER_USAGE_CPU_WRITE); map += q->offset / 4; - *map = ~0; + *map = ~0U; pipe->screen->buffer_unmap(pipe->screen, r300->oqbo); + q->flushed = FALSE; r300_emit_dirty_state(r300); r300_emit_query_begin(r300, q); } @@ -98,28 +102,30 @@ static boolean r300_get_query_result(struct pipe_context* pipe, { struct r300_context* r300 = r300_context(pipe); struct r300_screen* r300screen = r300_screen(r300->context.screen); - struct r300_query* q = (struct r300_query*)query; + struct r300_query *q = (struct r300_query*)query; unsigned flags = PIPE_BUFFER_USAGE_CPU_READ; uint32_t* map; - uint32_t temp; + uint32_t temp = 0; unsigned i; - if (wait) { + if (q->flushed == FALSE) pipe->flush(pipe, 0, NULL); - } else { + if (!wait) { flags |= PIPE_BUFFER_USAGE_DONTBLOCK; } map = pipe->screen->buffer_map(pipe->screen, r300->oqbo, flags); + if (!map) + return FALSE; map += q->offset / 4; for (i = 0; i < r300screen->caps->num_frag_pipes; i++) { - if (*map == ~0) { + if (*map == ~0U) { /* Looks like our results aren't ready yet. */ if (wait) { debug_printf("r300: Despite waiting, OQ results haven't" " come in yet.\n"); } - temp = ~0; + temp = ~0U; break; } temp += *map; @@ -127,7 +133,7 @@ static boolean r300_get_query_result(struct pipe_context* pipe, } pipe->screen->buffer_unmap(pipe->screen, r300->oqbo); - if (temp == ~0) { + if (temp == ~0U) { /* Our results haven't been written yet... */ return FALSE; } diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h index 3abff5db62..ae94bb9b9f 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -1172,6 +1172,13 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* SU Depth Offset value */ #define R300_SU_DEPTH_OFFSET 0x42c4 +#define R300_SU_REG_DEST 0x42c8 +# define R300_RASTER_PIPE_SELECT_0 (1 << 0) +# define R300_RASTER_PIPE_SELECT_1 (1 << 1) +# define R300_RASTER_PIPE_SELECT_2 (1 << 2) +# define R300_RASTER_PIPE_SELECT_3 (1 << 3) +# define R300_RASTER_PIPE_SELECT_ALL 0xf + /* BEGIN: Rasterization / Interpolators - many guesses */ @@ -2095,6 +2102,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define R500_FG_ALPHA_VALUE 0x4be0 # define R500_FG_ALPHA_VALUE_MASK 0x0000ffff +#define RV530_FG_ZBREG_DEST 0x4be8 +# define RV530_FG_ZBREG_DEST_PIPE_SELECT_0 (1 << 0) +# define RV530_FG_ZBREG_DEST_PIPE_SELECT_1 (1 << 1) +# define RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL (3 << 0) /* gap */ /* Fragment program parameters in 7.16 floating point */ @@ -3313,10 +3324,6 @@ enum { #define R200_3D_DRAW_IMMD_2 0xC0003500 -/* XXX Oh look, stuff not brought over from docs yet */ - -#define R300_SU_REG_DEST 0x42C8 - #endif /* _R300_REG_H */ /* *INDENT-ON* */ diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 7d154576e0..5381651c77 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -395,6 +395,7 @@ struct pipe_screen* r300_create_screen(struct r300_winsys* r300_winsys) caps->pci_id = r300_winsys->pci_id; caps->num_frag_pipes = r300_winsys->gb_pipes; + caps->num_z_pipes = r300_winsys->z_pipes; r300_parse_chipset(caps); diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 3cef285dee..d8533ac168 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -190,6 +190,7 @@ static void* r300_create_dsa_state(struct pipe_context* pipe, const struct pipe_depth_stencil_alpha_state* state) { + struct r300_context* r300 = r300_context(pipe); struct r300_dsa_state* dsa = CALLOC_STRUCT(r300_dsa_state); /* Depth test setup. */ @@ -247,11 +248,15 @@ static void* R300_FG_ALPHA_FUNC_ENABLE; dsa->alpha_reference = CLAMP(state->alpha.ref_value * 1023.0f, 0, 1023); - } else { - /* XXX need to fix this to be dynamically set - dsa->z_buffer_top = R300_ZTOP_ENABLE; */ } + dsa->z_buffer_top = R300_ZTOP_ENABLE; + /* XXX TODO: add frag prog rules for ztop disable */ + if (state->alpha.enabled && state->alpha.func != PIPE_FUNC_ALWAYS) + dsa->z_buffer_top = R300_ZTOP_DISABLE; + if (!is_empty_list(&r300->query_list)) + dsa->z_buffer_top = R300_ZTOP_DISABLE; + return (void*)dsa; } diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h index 540f8eca92..864a6146b2 100644 --- a/src/gallium/drivers/r300/r300_winsys.h +++ b/src/gallium/drivers/r300/r300_winsys.h @@ -48,6 +48,9 @@ struct r300_winsys { /* GB pipe count */ uint32_t gb_pipes; + /* Z pipe count (rv530 only) */ + uint32_t z_pipes; + /* GART size. */ uint32_t gart_size; diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index 3587892e00..7ea5d1fb4e 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -164,6 +164,16 @@ static void do_ioctls(struct r300_winsys* winsys, int fd) } winsys->gb_pipes = target; + /* get Z pipes */ + info.request = RADEON_INFO_NUM_Z_PIPES; + retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)); + if (retval) { + fprintf(stderr, "%s: Failed to get GB pipe count, " + "error number %d\n", __FUNCTION__, retval); + exit(1); + } + winsys->z_pipes = target; + /* Then, get PCI ID */ info.request = RADEON_INFO_DEVICE_ID; retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)); -- cgit v1.2.3 From 47791697ab6eb6965f0ba8ba3f20373b3753ca2a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 14 Oct 2009 17:14:43 +1000 Subject: r300g: convert query to a state for emitting. This means we don't emit in the begin query but when we have to flush. Similiar to classic. TODO: make query object actually work. --- src/gallium/drivers/r300/r300_context.h | 2 ++ src/gallium/drivers/r300/r300_emit.c | 15 ++++++++++++--- src/gallium/drivers/r300/r300_query.c | 8 ++++++-- 3 files changed, 20 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 9b0094b63c..3a01869ba1 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -141,6 +141,7 @@ struct r300_viewport_state { #define R300_NEW_VERTEX_FORMAT 0x04000000 #define R300_NEW_VERTEX_SHADER 0x08000000 #define R300_NEW_VIEWPORT 0x10000000 +#define R300_NEW_QUERY 0x20000000 #define R300_NEW_KITCHEN_SINK 0x1fffffff /* The next several objects are not pure Radeon state; they inherit from @@ -239,6 +240,7 @@ struct r300_context { /* Occlusion query buffer. */ struct pipe_buffer* oqbo; /* Query list. */ + struct r300_query *query_current; struct r300_query query_list; /* Various CSO state objects. */ diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 3d28249c16..babbe0dd74 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -320,12 +320,16 @@ void r300_emit_fb_state(struct r300_context* r300, END_CS; } -void r300_emit_query_begin(struct r300_context* r300, - struct r300_query* query) +void r300_emit_query_start(struct r300_context *r300) + { - struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps; + struct r300_capabilities *caps = r300_screen(r300->context.screen)->caps; + struct r300_query *query = r300->query_current; CS_LOCALS(r300); + if (!query) + return; + /* XXX This will almost certainly not return good results * for overlapping queries. */ BEGIN_CS(4); @@ -772,6 +776,11 @@ validate: goto validate; } + if (r300->dirty_state & R300_NEW_QUERY) { + r300_emit_query_start(r300); + r300->dirty_state &= ~R300_NEW_QUERY; + } + if (r300->dirty_state & R300_NEW_BLEND) { r300_emit_blend_state(r300, r300->blend_state); r300->dirty_state &= ~R300_NEW_BLEND; diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c index b01313648b..fb4340ff3d 100644 --- a/src/gallium/drivers/r300/r300_query.c +++ b/src/gallium/drivers/r300/r300_query.c @@ -74,6 +74,8 @@ static void r300_begin_query(struct pipe_context* pipe, struct r300_context* r300 = r300_context(pipe); struct r300_query* q = (struct r300_query*)query; + assert(r300->query_current == NULL); + map = pipe->screen->buffer_map(pipe->screen, r300->oqbo, PIPE_BUFFER_USAGE_CPU_WRITE); map += q->offset / 4; @@ -81,8 +83,8 @@ static void r300_begin_query(struct pipe_context* pipe, pipe->screen->buffer_unmap(pipe->screen, r300->oqbo); q->flushed = FALSE; - r300_emit_dirty_state(r300); - r300_emit_query_begin(r300, q); + r300->query_current = q; + r300->dirty_state |= R300_NEW_QUERY; } static void r300_end_query(struct pipe_context* pipe, @@ -93,6 +95,8 @@ static void r300_end_query(struct pipe_context* pipe, r300_emit_dirty_state(r300); r300_emit_query_end(r300, q); + + r300->query_current = NULL; } static boolean r300_get_query_result(struct pipe_context* pipe, -- cgit v1.2.3 From 51d1cf55da6f8b8a215814589a189b6e5e537fe5 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 14 Oct 2009 17:44:19 +1000 Subject: r300g: port over last parts of oq support. Add support for begin/end in each CS so we don't get any other processes rendering in between. TODO: blame other parts of driver for this not working like Z. --- src/gallium/drivers/r300/r300_context.h | 2 ++ src/gallium/drivers/r300/r300_emit.c | 11 +++++++++-- src/gallium/drivers/r300/r300_emit.h | 3 +-- src/gallium/drivers/r300/r300_flush.c | 2 ++ src/gallium/drivers/r300/r300_query.c | 7 ++----- 5 files changed, 16 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 3a01869ba1..7826ed1452 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -175,6 +175,8 @@ struct r300_query { unsigned offset; /* if we've flushed the query */ boolean flushed; + /* if begin has been emitted */ + boolean begin_emitted; /* Linked list members. */ struct r300_query* prev; struct r300_query* next; diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index babbe0dd74..6e616cd5b2 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -340,6 +340,7 @@ void r300_emit_query_start(struct r300_context *r300) } OUT_CS_REG(R300_ZB_ZPASS_DATA, 0); END_CS; + query->begin_emitted = TRUE; } @@ -429,10 +430,16 @@ static void rv530_emit_query_double(struct r300_context *r300, END_CS; } -void r300_emit_query_end(struct r300_context* r300, - struct r300_query* query) +void r300_emit_query_end(struct r300_context* r300) { struct r300_capabilities *caps = r300_screen(r300->context.screen)->caps; + struct r300_query *query = r300->query_current; + + if (!query) + return; + + if (query->begin_emitted == FALSE) + return; if (!r300->winsys->add_buffer(r300->winsys, r300->oqbo, 0, RADEON_GEM_DOMAIN_GTT)) { diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h index c4002b8e5d..b62aa9fec5 100644 --- a/src/gallium/drivers/r300/r300_emit.h +++ b/src/gallium/drivers/r300/r300_emit.h @@ -58,8 +58,7 @@ void r300_emit_fb_state(struct r300_context* r300, void r300_emit_query_begin(struct r300_context* r300, struct r300_query* query); -void r300_emit_query_end(struct r300_context* r300, - struct r300_query* query); +void r300_emit_query_end(struct r300_context* r300); void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs); diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c index a8ab0d7212..241ea71d6b 100644 --- a/src/gallium/drivers/r300/r300_flush.c +++ b/src/gallium/drivers/r300/r300_flush.c @@ -36,6 +36,8 @@ static void r300_flush(struct pipe_context* pipe, draw_flush(r300->draw); } + r300_emit_query_end(r300); + if (r300->dirty_hw) { FLUSH_CS; r300_emit_invariant_state(r300); diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c index fb4340ff3d..2b0fbfb7d2 100644 --- a/src/gallium/drivers/r300/r300_query.c +++ b/src/gallium/drivers/r300/r300_query.c @@ -88,14 +88,11 @@ static void r300_begin_query(struct pipe_context* pipe, } static void r300_end_query(struct pipe_context* pipe, - struct pipe_query* query) + struct pipe_query* query) { struct r300_context* r300 = r300_context(pipe); - struct r300_query* q = (struct r300_query*)query; - - r300_emit_dirty_state(r300); - r300_emit_query_end(r300, q); + r300_emit_query_end(r300); r300->query_current = NULL; } -- cgit v1.2.3 From ce5cba040c34a1a70186c29a5055e9be3c85a54a Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 14 Oct 2009 18:05:14 +1000 Subject: r300g: add one more ZTOP disable bit. Still missing the frag uses kill support, hopefully nha can point that out. --- src/gallium/drivers/r300/r300_fs.h | 6 ++++++ src/gallium/drivers/r300/r300_state.c | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_fs.h b/src/gallium/drivers/r300/r300_fs.h index 967e9f697e..04453274aa 100644 --- a/src/gallium/drivers/r300/r300_fs.h +++ b/src/gallium/drivers/r300/r300_fs.h @@ -48,4 +48,10 @@ struct r300_fragment_shader { void r300_translate_fragment_shader(struct r300_context* r300, struct r300_fragment_shader* fs); +static inline boolean r300_fragment_shader_writes_depth(struct r300_fragment_shader *fs) +{ + if (!fs) + return FALSE; + return (fs->code.writes_depth) ? TRUE : FALSE; +} #endif /* R300_FS_H */ diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index d8533ac168..95e2943baa 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -252,9 +252,11 @@ static void* dsa->z_buffer_top = R300_ZTOP_ENABLE; /* XXX TODO: add frag prog rules for ztop disable */ + if (r300_fragment_shader_writes_depth(r300->fs)) + dsa->z_buffer_top = R300_ZTOP_DISABLE; if (state->alpha.enabled && state->alpha.func != PIPE_FUNC_ALWAYS) dsa->z_buffer_top = R300_ZTOP_DISABLE; - if (!is_empty_list(&r300->query_list)) + if (r300->query_current) dsa->z_buffer_top = R300_ZTOP_DISABLE; return (void*)dsa; -- cgit v1.2.3 From fa581580b18d530b849299c38604ab0804290e49 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 14 Oct 2009 18:24:05 +1000 Subject: r300g: add QUERY to KITCHEN_SINK I missed this, thanks to Corbin for pointing it out. --- src/gallium/drivers/r300/r300_context.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 7826ed1452..d2e8875503 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -142,7 +142,7 @@ struct r300_viewport_state { #define R300_NEW_VERTEX_SHADER 0x08000000 #define R300_NEW_VIEWPORT 0x10000000 #define R300_NEW_QUERY 0x20000000 -#define R300_NEW_KITCHEN_SINK 0x1fffffff +#define R300_NEW_KITCHEN_SINK 0x3fffffff /* The next several objects are not pure Radeon state; they inherit from * various Gallium classes. */ -- cgit v1.2.3 From 88b697fb0aaaab8479716763510f56b1053ddb37 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 14 Oct 2009 18:24:34 +1000 Subject: r300g: remove buffer add that should be unnecessary. This should be handled in the emit fine --- src/gallium/drivers/r300/r300_emit.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 6e616cd5b2..feffadd0ee 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -441,12 +441,6 @@ void r300_emit_query_end(struct r300_context* r300) if (query->begin_emitted == FALSE) return; - if (!r300->winsys->add_buffer(r300->winsys, r300->oqbo, - 0, RADEON_GEM_DOMAIN_GTT)) { - debug_printf("r300: There wasn't room for the OQ buffer!?" - " Oh noes!\n"); - } - if (caps->family == CHIP_FAMILY_RV530) { if (caps->num_z_pipes == 2) rv530_emit_query_double(r300, query); -- cgit v1.2.3 From f13e507798cdbbe2fad5df33dcd581d49d6fa7ab Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 14 Oct 2009 01:58:18 -0700 Subject: r300g: Compiler warning cleanup. --- src/gallium/drivers/r300/r300_context.c | 2 +- src/gallium/drivers/r300/r300_render.c | 7 ------- src/gallium/drivers/r300/r300_state_derived.c | 2 +- src/gallium/drivers/r300/r300_surface.c | 3 +-- 4 files changed, 3 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 7a9c098e30..b243f88bb5 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -152,7 +152,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->winsys = r300_winsys; r300->context.winsys = (struct pipe_winsys*)r300_winsys; - r300->context.screen = r300_screen(screen); + r300->context.screen = screen; r300_init_debug(r300); diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index ca44e0f661..b56f7a3d1e 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -127,7 +127,6 @@ static void r300_render_unmap_vertices(struct vbuf_render* render, static void r300_render_release_vertices(struct vbuf_render* render) { struct r300_render* r300render = r300_render(render); - struct r300_context* r300 = r300render->r300; r300render->vbo_offset += r300render->vbo_max_used; r300render->vbo_max_used = 0; @@ -182,8 +181,6 @@ static void r300_prepare_render(struct r300_render* render, unsigned count) { struct r300_context* r300 = render->r300; - CS_LOCALS(r300); - r300_emit_dirty_state(r300); } @@ -213,11 +210,7 @@ static void r300_render_draw(struct vbuf_render* render, { 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; int i; - uint32_t index; CS_LOCALS(r300); diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 02b7ab9107..335b54820a 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -193,7 +193,7 @@ static void r300_vertex_psc(struct r300_context* r300, struct vertex_info* vinfo = &vformat->vinfo; int* tab = vformat->vs_tab; uint32_t temp; - int i, attrib_count; + unsigned i, attrib_count; /* Vertex shaders have no semantics on their inputs, * so PSC should just route stuff based on their info, diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c index d72e734ff0..5cf49d20aa 100644 --- a/src/gallium/drivers/r300/r300_surface.c +++ b/src/gallium/drivers/r300/r300_surface.c @@ -95,8 +95,7 @@ static void r300_surface_fill(struct pipe_context* pipe, unsigned w, unsigned h, unsigned color) { - int i; - float r, g, b, a, depth; + float r, g, b, a; struct r300_context* r300 = r300_context(pipe); struct r300_capabilities* caps = r300_screen(pipe->screen)->caps; struct r300_texture* tex = (struct r300_texture*)dest->texture; -- cgit v1.2.3 From fd63f89e95342d7d5921d6369346e356b505b584 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 14 Oct 2009 03:09:41 -0700 Subject: r300g: Move ztop to derived state. Need to get it into its own atom instead of piggybacking on DSA. --- src/gallium/drivers/r300/r300_state.c | 10 -------- src/gallium/drivers/r300/r300_state_derived.c | 36 +++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 95e2943baa..8359850966 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -190,7 +190,6 @@ static void* r300_create_dsa_state(struct pipe_context* pipe, const struct pipe_depth_stencil_alpha_state* state) { - struct r300_context* r300 = r300_context(pipe); struct r300_dsa_state* dsa = CALLOC_STRUCT(r300_dsa_state); /* Depth test setup. */ @@ -250,15 +249,6 @@ static void* 0, 1023); } - dsa->z_buffer_top = R300_ZTOP_ENABLE; - /* XXX TODO: add frag prog rules for ztop disable */ - if (r300_fragment_shader_writes_depth(r300->fs)) - dsa->z_buffer_top = R300_ZTOP_DISABLE; - if (state->alpha.enabled && state->alpha.func != PIPE_FUNC_ALWAYS) - dsa->z_buffer_top = R300_ZTOP_DISABLE; - if (r300->query_current) - dsa->z_buffer_top = R300_ZTOP_DISABLE; - return (void*)dsa; } diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 335b54820a..5d323a26b1 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -444,6 +444,37 @@ static void r300_update_rs_block(struct r300_context* r300) rs->inst_count = MAX2(MAX2(col_count - 1, tex_count - 1), 0); } +static void r300_update_ztop(struct r300_context* r300) +{ + r300->dsa_state->z_buffer_top = R300_ZTOP_ENABLE; + + /* This is important enough that I felt it warranted a comment. + * + * According to the docs, these are the conditions where ZTOP must be + * disabled: + * 1) Alpha testing enabled + * 2) Texture kill instructions in fragment shader + * 3) Chroma key culling enabled + * 4) W-buffering enabled + * + * The docs claim that for the first three cases, if no ZS writes happen, + * then ZTOP can be used. + * + * Additionally, the following conditions require disabled ZTOP: + * ~) Depth writes in fragment shader + * ~) Outstanding occlusion queries + * + * ~C. + */ + if (r300->dsa_state->alpha_function) { + r300->dsa_state->z_buffer_top = R300_ZTOP_DISABLE; + } else if (r300_fragment_shader_writes_depth(r300->fs)) { + r300->dsa_state->z_buffer_top = R300_ZTOP_DISABLE; + } else if (r300->query_current) { + r300->dsa_state->z_buffer_top = R300_ZTOP_DISABLE; + } +} + void r300_update_derived_state(struct r300_context* r300) { if (r300->dirty_state & @@ -455,4 +486,9 @@ void r300_update_derived_state(struct r300_context* r300) r300_update_fs_tab(r300); r300_update_rs_block(r300); } + + if (r300->dirty_state & + (R300_NEW_DSA | R300_NEW_FRAGMENT_SHADER | R300_NEW_QUERY)) { + r300_update_ztop(r300); + } } -- cgit v1.2.3 From 98eb7a14a44f8e5c3c2d2f1418d7d4e4ed0fe5e8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 14 Oct 2009 07:52:26 -0600 Subject: mesa: remove left-over debug printf --- src/mesa/drivers/common/meta.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 21458a7c73..ceb929f694 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2118,7 +2118,6 @@ _mesa_meta_check_generate_mipmap_fallback(GLcontext *ctx, GLenum target, _mesa_BindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboSave); if (status != GL_FRAMEBUFFER_COMPLETE_EXT) { - printf("Can't render\n"); return GL_TRUE; } -- cgit v1.2.3 From 68edb4eac55457796ed5c5e4f1c702af749fd543 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Wed, 14 Oct 2009 17:11:08 +0100 Subject: gallium: New ALIGN_STACK macro to tell gcc to align stack pointer. --- src/gallium/include/pipe/p_compiler.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h index c13cffceb0..c36286f9be 100644 --- a/src/gallium/include/pipe/p_compiler.h +++ b/src/gallium/include/pipe/p_compiler.h @@ -167,11 +167,17 @@ typedef unsigned char boolean; #define ALIGN16_ASSIGN(NAME) NAME##___aligned #define ALIGN16_ATTRIB __attribute__(( aligned( 16 ) )) #define ALIGN8_ATTRIB __attribute__(( aligned( 8 ) )) +#if __GNUC__ > 4 || (__GNUC__ == 4 &&__GNUC_MINOR__>1) +#define ALIGN_STACK __attribute__((force_align_arg_pointer)) +#else +#define ALIGN_STACK +#endif #else #define ALIGN16_DECL(TYPE, NAME, SIZE) TYPE NAME##___unaligned[SIZE + 1] #define ALIGN16_ASSIGN(NAME) align16(NAME##___unaligned) #define ALIGN16_ATTRIB #define ALIGN8_ATTRIB +#define ALIGN_STACK #endif -- cgit v1.2.3 From 4046c3bab4dde95d4096f26637adaa6ce6d310a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Wed, 14 Oct 2009 17:11:30 +0100 Subject: llvmpipe: Use ALIGN_STACK. --- src/gallium/drivers/llvmpipe/lp_setup.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 60107214df..b14c265b7f 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -115,6 +115,7 @@ struct setup_context { /** * Execute fragment shader for the four fragments in the quad. */ +ALIGN_STACK static void shade_quads(struct llvmpipe_context *llvmpipe, struct quad_header *quads[], -- cgit v1.2.3 From 3ce3c03257bccc5f9e8a6caf0f39565a87856eaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Wed, 14 Oct 2009 17:27:06 +0100 Subject: util: Fix cpu detection on Windows. Cleanup. --- src/gallium/auxiliary/util/u_cpu_detect.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c index ded361ce70..b94390aef9 100644 --- a/src/gallium/auxiliary/util/u_cpu_detect.c +++ b/src/gallium/auxiliary/util/u_cpu_detect.c @@ -397,12 +397,17 @@ util_cpu_detect(void) #endif /* Count the number of CPUs in system */ -#if !defined(PIPE_OS_WINDOWS) && !defined(PIPE_OS_UNKNOWN) && defined(_SC_NPROCESSORS_ONLN) +#if defined(PIPE_OS_WINDOWS) + { + SYSTEM_INFO system_info; + GetSystemInfo(&system_info); + util_cpu_caps.nr_cpus = system_info.dwNumberOfProcessors; + } +#elif defined(PIPE_OS_UNIX) && defined(_SC_NPROCESSORS_ONLN) util_cpu_caps.nr_cpus = sysconf(_SC_NPROCESSORS_ONLN); if (util_cpu_caps.nr_cpus == -1) util_cpu_caps.nr_cpus = 1; - -#elif defined(PIPE_OS_NETBSD) || defined(PIPE_OS_FREEBSD) || defined(PIPE_OS_OPENBSD) +#elif defined(PIPE_OS_BSD) { int mib[2], ncpu; int len; @@ -469,7 +474,6 @@ util_cpu_detect(void) util_cpu_caps.cacheline = regs2[2] & 0xFF; } -#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_FREEBSD) || defined(PIPE_OS_NETBSD) || defined(PIPE_OS_CYGWIN) || defined(PIPE_OS_OPENBSD) if (util_cpu_caps.has_sse) check_os_katmai_support(); @@ -477,13 +481,8 @@ util_cpu_detect(void) util_cpu_caps.has_sse2 = 0; util_cpu_caps.has_sse3 = 0; util_cpu_caps.has_ssse3 = 0; + util_cpu_caps.has_sse4_1 = 0; } -#else - util_cpu_caps.has_sse = 0; - util_cpu_caps.has_sse2 = 0; - util_cpu_caps.has_sse3 = 0; - util_cpu_caps.has_ssse3 = 0; -#endif } #endif /* PIPE_ARCH_X86 || PIPE_ARCH_X86_64 */ -- cgit v1.2.3 From f22c427bd685f55e6f7e29dcd72cdb1aa42f04d9 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 14 Oct 2009 14:18:36 -0400 Subject: r600: enable EXT_vertex_array_bgra extensions --- src/mesa/drivers/dri/r600/r600_context.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index 969144ba12..ba0d450cbb 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -131,6 +131,7 @@ const struct dri_extension card_extensions[] = { {"GL_EXT_texture_lod_bias", NULL}, {"GL_EXT_texture_mirror_clamp", NULL}, {"GL_EXT_texture_rectangle", NULL}, + {"GL_EXT_vertex_array_bgra", NULL}, {"GL_EXT_texture_sRGB", NULL}, {"GL_ATI_separate_stencil", GL_ATI_separate_stencil_functions}, {"GL_ATI_texture_env_combine3", NULL}, -- cgit v1.2.3 From 96c9b39a6a9553573fcbdb5fd6db0e9d59768442 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 13 Oct 2009 15:32:04 +0100 Subject: i915g: Fix warnings --- src/gallium/drivers/i915/i915_debug.c | 2 +- src/gallium/drivers/i915/i915_fpc_translate.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/i915/i915_debug.c b/src/gallium/drivers/i915/i915_debug.c index ce92d1af9a..e6640e587b 100644 --- a/src/gallium/drivers/i915/i915_debug.c +++ b/src/gallium/drivers/i915/i915_debug.c @@ -880,7 +880,7 @@ i915_dump_batchbuffer( struct intel_batchbuffer *batch ) return; } - debug_printf( "\n\nBATCH: (%d)\n", bytes / 4); + debug_printf( "\n\nBATCH: (%d)\n", (int)bytes / 4); while (!done && stream.offset < bytes) diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c b/src/gallium/drivers/i915/i915_fpc_translate.c index 89504ced27..1fe5cda956 100644 --- a/src/gallium/drivers/i915/i915_fpc_translate.c +++ b/src/gallium/drivers/i915/i915_fpc_translate.c @@ -127,7 +127,7 @@ i915_program_error(struct i915_fp_compile *p, const char *msg, ...) va_start( args, msg ); util_vsnprintf( buffer, sizeof(buffer), msg, args ); va_end( args ); - debug_printf(buffer); + debug_printf("%s", buffer); debug_printf("\n"); p->error = 1; -- cgit v1.2.3 From 59cf40059a7c451b1d1bc0c90f674e8e4baa5ab8 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Sun, 11 Oct 2009 01:07:26 -0400 Subject: st/xorg: get transparency on fills working (fixes Qt/KDE apps) --- src/gallium/state_trackers/xorg/xorg_composite.c | 19 ++++++++++++------- src/gallium/state_trackers/xorg/xorg_renderer.c | 3 +++ 2 files changed, 15 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 6871625605..b39b39511e 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -40,6 +40,14 @@ static const struct xorg_composite_blend xorg_blends[] = { { PictOpOverReverse, PIPE_BLENDFACTOR_SRC_ALPHA, PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_INV_SRC_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA }, + + { PictOpOutReverse, + PIPE_BLENDFACTOR_SRC_ALPHA, PIPE_BLENDFACTOR_ONE, + PIPE_BLENDFACTOR_INV_SRC_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA }, + + { PictOpAdd, + PIPE_BLENDFACTOR_SRC_ALPHA, PIPE_BLENDFACTOR_ONE, + PIPE_BLENDFACTOR_INV_SRC_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA }, }; @@ -138,7 +146,9 @@ boolean xorg_composite_accelerated(int op, (!accelerated_ops[i].with_mask || (pMaskPicture->componentAlpha && !accelerated_ops[i].component_alpha)))) - XORG_FALLBACK("component alpha unsupported"); + XORG_FALLBACK("component alpha unsupported (PictOpOver=%s(%d)", + (accelerated_ops[i].op == PictOpOver) ? "yes" : "no", + accelerated_ops[i].op); return TRUE; } } @@ -156,10 +166,7 @@ bind_blend_state(struct exa_context *exa, int op, memset(&blend, 0, sizeof(struct pipe_blend_state)); blend.blend_enable = 1; - blend.colormask |= PIPE_MASK_R; - blend.colormask |= PIPE_MASK_G; - blend.colormask |= PIPE_MASK_B; - blend.colormask |= PIPE_MASK_A; + blend.colormask |= PIPE_MASK_RGBA; blend.rgb_src_factor = blend_opt.rgb_src_factor; blend.alpha_src_factor = blend_opt.alpha_src_factor; @@ -346,8 +353,6 @@ boolean xorg_solid_bind_state(struct exa_context *exa, pixel_to_float4(fg, exa->solid_color); exa->has_solid_color = TRUE; - exa->solid_color[3] = 1.f; - #if 0 debug_printf("Color Pixel=(%d, %d, %d, %d), RGBA=(%f, %f, %f, %f)\n", (fg >> 24) & 0xff, (fg >> 16) & 0xff, diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 1eecf7d2b9..81b209cb59 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -681,6 +681,9 @@ void renderer_draw_solid_rect(struct xorg_renderer *r, struct pipe_context *pipe = r->pipe; struct pipe_buffer *buf = 0; + /* + debug_printf("solid rect[(%d, %d), (%d, %d)], rgba[%f, %f, %f, %f]\n", + x0, y0, x1, y1, color[0], color[1], color[2], color[3]);*/ /* 1st vertex */ setup_vertex0(r->vertices2[0], x0, y0, color); /* 2nd vertex */ -- cgit v1.2.3 From ef067b5f01eb7ea7a08a64d897e0e70e139c618d Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 13 Oct 2009 11:56:35 +0200 Subject: st/xorg: Fix dpms include problems --- src/gallium/state_trackers/xorg/Makefile | 1 - src/gallium/state_trackers/xorg/xorg_crtc.c | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/Makefile b/src/gallium/state_trackers/xorg/Makefile index 030bac5fff..27a1990724 100644 --- a/src/gallium/state_trackers/xorg/Makefile +++ b/src/gallium/state_trackers/xorg/Makefile @@ -5,7 +5,6 @@ LIBNAME = xorgtracker LIBRARY_INCLUDES = \ -DHAVE_CONFIG_H \ - -DHAVE_XEXTPROTO_71=1 \ $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \ -I$(TOP)/src/gallium/include \ -I$(TOP)/src/gallium/auxiliary \ diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index 95973586da..67fe29a69d 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -43,10 +43,10 @@ #include "xf86Modes.h" #ifdef HAVE_XEXTPROTO_71 -#include "X11/extensions/dpmsconst.h" +#include #else #define DPMS_SERVER -#include "X11/extensions/dpmsconst.h" +#include #endif #include "pipe/p_inlines.h" -- cgit v1.2.3 From 0187e042b681663938a1a12e9ae03c6f0ab48af5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 14 Oct 2009 15:00:50 -0600 Subject: mesa: remove unused ctx->Driver.TextureMatrix() hook --- src/mesa/drivers/common/driverfuncs.c | 1 - src/mesa/main/dd.h | 1 - src/mesa/main/texstate.c | 7 ------- 3 files changed, 9 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 0f8447cb70..5934907cf0 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -183,7 +183,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->TexGen = NULL; driver->TexEnv = NULL; driver->TexParameter = NULL; - driver->TextureMatrix = NULL; driver->Viewport = NULL; /* vertex arrays */ diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index ce5e158626..a9632ec954 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -717,7 +717,6 @@ struct dd_function_table { void (*TexParameter)(GLcontext *ctx, GLenum target, struct gl_texture_object *texObj, GLenum pname, const GLfloat *params); - void (*TextureMatrix)(GLcontext *ctx, GLuint unit, const GLmatrix *mat); /** Set the viewport */ void (*Viewport)(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h); /*@}*/ diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 43f26873e0..16492bd7bc 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -307,10 +307,6 @@ _mesa_ActiveTextureARB(GLenum texture) /* update current stack pointer */ ctx->CurrentStack = &ctx->TextureMatrixStack[texUnit]; } - - if (ctx->Driver.ActiveTexture) { - (*ctx->Driver.ActiveTexture)( ctx, (GLuint) texUnit ); - } } @@ -360,9 +356,6 @@ update_texture_matrices( GLcontext *ctx ) if (ctx->Texture.Unit[u]._ReallyEnabled && ctx->TextureMatrixStack[u].Top->type != MATRIX_IDENTITY) ctx->Texture._TexMatEnabled |= ENABLE_TEXMAT(u); - - if (ctx->Driver.TextureMatrix) - ctx->Driver.TextureMatrix( ctx, u, ctx->TextureMatrixStack[u].Top); } } } -- cgit v1.2.3 From 73fc0ca4c36f258c4d0d7707dd3313a685c211bf Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 14 Oct 2009 15:11:12 -0600 Subject: mesa: remove unused ctx->Driver.PrioritizeTextures() hook --- src/mesa/drivers/common/driverfuncs.c | 1 - src/mesa/drivers/dri/mach64/mach64_tex.c | 1 - src/mesa/main/dd.h | 6 ------ src/mesa/main/texobj.c | 2 -- 4 files changed, 10 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 5934907cf0..4d21b033f7 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -125,7 +125,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->UnmapTexture = NULL; driver->TextureMemCpy = _mesa_memcpy; driver->IsTextureResident = NULL; - driver->PrioritizeTexture = NULL; driver->ActiveTexture = NULL; driver->UpdateTexturePalette = NULL; diff --git a/src/mesa/drivers/dri/mach64/mach64_tex.c b/src/mesa/drivers/dri/mach64/mach64_tex.c index 225d23179e..5a22c93bd2 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tex.c +++ b/src/mesa/drivers/dri/mach64/mach64_tex.c @@ -567,7 +567,6 @@ void mach64InitTextureFuncs( struct dd_function_table *functions ) functions->UpdateTexturePalette = NULL; functions->ActiveTexture = NULL; - functions->PrioritizeTexture = NULL; driInitTextureFormats(); } diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index a9632ec954..25aaddea81 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -544,12 +544,6 @@ struct dd_function_table { GLboolean (*IsTextureResident)( GLcontext *ctx, struct gl_texture_object *t ); - /** - * Called by glPrioritizeTextures(). - */ - void (*PrioritizeTexture)( GLcontext *ctx, struct gl_texture_object *t, - GLclampf priority ); - /** * Called by glActiveTextureARB() to set current texture unit. */ diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 8fd5eaa266..31832184c0 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -1098,8 +1098,6 @@ _mesa_PrioritizeTextures( GLsizei n, const GLuint *texName, struct gl_texture_object *t = _mesa_lookup_texture(ctx, texName[i]); if (t) { t->Priority = CLAMP( priorities[i], 0.0F, 1.0F ); - if (ctx->Driver.PrioritizeTexture) - ctx->Driver.PrioritizeTexture( ctx, t, t->Priority ); } } } -- cgit v1.2.3 From d9099f8602eb6d15e9fc2e0b0987e7a58fb98b68 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 14 Oct 2009 15:46:25 -0600 Subject: mesa: rename VERBOSE_IMMEDIATE->VERBOSE_MATERIAL to reflect what it does --- src/mesa/main/debug.c | 2 +- src/mesa/main/light.c | 2 +- src/mesa/main/mtypes.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 8492c8561d..530170b526 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -167,7 +167,7 @@ static void add_debug_flags( const char *debug ) static const struct debug_option debug_opt[] = { { "varray", VERBOSE_VARRAY }, { "tex", VERBOSE_TEXTURE }, - { "imm", VERBOSE_IMMEDIATE }, + { "mat", VERBOSE_MATERIAL }, { "pipe", VERBOSE_PIPELINE }, { "driver", VERBOSE_DRIVER }, { "state", VERBOSE_STATE }, diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index 10c89f4368..1c8a081e9a 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -636,7 +636,7 @@ _mesa_update_material( GLcontext *ctx, GLuint bitmask ) struct gl_light *light, *list = &ctx->Light.EnabledList; GLfloat (*mat)[4] = ctx->Light.Material.Attrib; - if (MESA_VERBOSE&VERBOSE_IMMEDIATE) + if (MESA_VERBOSE & VERBOSE_MATERIAL) _mesa_debug(ctx, "_mesa_update_material, mask 0x%x\n", bitmask); if (!bitmask) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index a1184df281..f0f21f633f 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3099,7 +3099,7 @@ enum _verbose { VERBOSE_VARRAY = 0x0001, VERBOSE_TEXTURE = 0x0002, - VERBOSE_IMMEDIATE = 0x0004, + VERBOSE_MATERIAL = 0x0004, VERBOSE_PIPELINE = 0x0008, VERBOSE_DRIVER = 0x0010, VERBOSE_STATE = 0x0020, -- cgit v1.2.3 From ade1cc992410c8696fdfe0f84fb613fd0dc8099f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 14 Oct 2009 16:23:22 -0600 Subject: mesa: added MESA_VERBOSE option 'draw' to debug glDrawArrays/Elements, etc. --- src/mesa/main/debug.c | 3 ++- src/mesa/main/mtypes.h | 3 +++ src/mesa/vbo/vbo_exec_array.c | 29 +++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 530170b526..07ed51f5ab 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -174,7 +174,8 @@ static void add_debug_flags( const char *debug ) { "api", VERBOSE_API }, { "list", VERBOSE_DISPLAY_LIST }, { "lighting", VERBOSE_LIGHTING }, - { "disassem", VERBOSE_DISASSEM } + { "disassem", VERBOSE_DISASSEM }, + { "draw", VERBOSE_DRAW } }; GLuint i; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index f0f21f633f..5699db5d4a 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3095,6 +3095,7 @@ extern int MESA_DEBUG_FLAGS; #endif +/** The MESA_VERBOSE var is a bitmask of these flags */ enum _verbose { VERBOSE_VARRAY = 0x0001, @@ -3109,9 +3110,11 @@ enum _verbose VERBOSE_PRIMS = 0x0400, VERBOSE_VERTS = 0x0800, VERBOSE_DISASSEM = 0x1000, + VERBOSE_DRAW = 0x2000 }; +/** The MESA_DEBUG_FLAGS var is a bitmask of these flags */ enum _debug { DEBUG_ALWAYS_FLUSH = 0x1 diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 774cffc451..0e1737c210 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -33,6 +33,7 @@ #include "main/api_noop.h" #include "main/varray.h" #include "main/bufferobj.h" +#include "main/enums.h" #include "main/macros.h" #include "glapi/dispatch.h" @@ -482,6 +483,10 @@ vbo_exec_DrawArrays(GLenum mode, GLint start, GLsizei count) struct vbo_exec_context *exec = &vbo->exec; struct _mesa_prim prim[1]; + if (MESA_VERBOSE & VERBOSE_DRAW) + _mesa_debug(ctx, "glDrawArrays(%s, %d, %d)\n", + _mesa_lookup_enum_by_nr(mode), start, count); + if (!_mesa_validate_DrawArrays( ctx, mode, start, count )) return; @@ -675,6 +680,12 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, static GLuint warnCount = 0; GET_CURRENT_CONTEXT(ctx); + if (MESA_VERBOSE & VERBOSE_DRAW) + _mesa_debug(ctx, + "glDrawRangeElementsBaseVertex(%s, %u, %u, %d, %s, %p, %d)\n", + _mesa_lookup_enum_by_nr(mode), start, end, count, + _mesa_lookup_enum_by_nr(type), indices, basevertex); + if (!_mesa_validate_DrawRangeElements( ctx, mode, start, end, count, type, indices, basevertex )) return; @@ -761,6 +772,14 @@ vbo_exec_DrawRangeElements(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) { + GET_CURRENT_CONTEXT(ctx); + + if (MESA_VERBOSE & VERBOSE_DRAW) + _mesa_debug(ctx, + "glDrawRangeElements(%s, %u, %u, %d, %s, %p)\n", + _mesa_lookup_enum_by_nr(mode), start, end, count, + _mesa_lookup_enum_by_nr(type), indices); + vbo_exec_DrawRangeElementsBaseVertex(mode, start, end, count, type, indices, 0); } @@ -772,6 +791,11 @@ vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type, { GET_CURRENT_CONTEXT(ctx); + if (MESA_VERBOSE & VERBOSE_DRAW) + _mesa_debug(ctx, "glDrawElements(%s, %u, %s, %p)\n", + _mesa_lookup_enum_by_nr(mode), count, + _mesa_lookup_enum_by_nr(type), indices); + if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices, 0 )) return; @@ -785,6 +809,11 @@ vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, { GET_CURRENT_CONTEXT(ctx); + if (MESA_VERBOSE & VERBOSE_DRAW) + _mesa_debug(ctx, "glDrawElementsBaseVertex(%s, %d, %s, %p, %d)\n", + _mesa_lookup_enum_by_nr(mode), count, + _mesa_lookup_enum_by_nr(type), indices, basevertex); + if (!_mesa_validate_DrawElements( ctx, mode, count, type, indices, basevertex )) return; -- cgit v1.2.3 From f9784072fee016e14e0319c705420becb2490bf9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 14 Oct 2009 16:23:52 -0600 Subject: vbo: clean-ups, reformatting --- src/mesa/vbo/vbo_exec_array.c | 49 +++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index 0e1737c210..fd70b57b72 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -54,10 +54,9 @@ vbo_get_minmax_index(GLcontext *ctx, const void *indices; if (_mesa_is_bufferobj(ib->obj)) { - const GLvoid *map = ctx->Driver.MapBuffer(ctx, - GL_ELEMENT_ARRAY_BUFFER_ARB, - GL_READ_ONLY, - ib->obj); + const GLvoid *map = + ctx->Driver.MapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, + GL_READ_ONLY, ib->obj); indices = ADD_POINTERS(map, ib->ptr); } else { indices = ib->ptr; @@ -106,9 +105,7 @@ vbo_get_minmax_index(GLcontext *ctx, } if (_mesa_is_bufferobj(ib->obj)) { - ctx->Driver.UnmapBuffer(ctx, - GL_ELEMENT_ARRAY_BUFFER_ARB, - ib->obj); + ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, ib->obj); } } @@ -126,10 +123,9 @@ check_array_data(GLcontext *ctx, struct gl_client_array *array, if (_mesa_is_bufferobj(array->BufferObj)) { if (!array->BufferObj->Pointer) { /* need to map now */ - array->BufferObj->Pointer = ctx->Driver.MapBuffer(ctx, - GL_ARRAY_BUFFER_ARB, - GL_READ_ONLY, - array->BufferObj); + array->BufferObj->Pointer = + ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER_ARB, + GL_READ_ONLY, array->BufferObj); } data = ADD_POINTERS(data, array->BufferObj->Pointer); } @@ -170,9 +166,7 @@ unmap_array_buffer(GLcontext *ctx, struct gl_client_array *array) if (array->Enabled && _mesa_is_bufferobj(array->BufferObj) && _mesa_bufferobj_mapped(array->BufferObj)) { - ctx->Driver.UnmapBuffer(ctx, - GL_ARRAY_BUFFER_ARB, - array->BufferObj); + ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER_ARB, array->BufferObj); } } @@ -223,13 +217,13 @@ check_draw_elements_data(GLcontext *ctx, GLsizei count, GLenum elemType, check_array_data(ctx, &arrayObj->TexCoord[k], VERT_ATTRIB_TEX0 + k, j); } for (k = 0; k < Elements(arrayObj->VertexAttrib); k++) { - check_array_data(ctx, &arrayObj->VertexAttrib[k], VERT_ATTRIB_GENERIC0 + k, j); + check_array_data(ctx, &arrayObj->VertexAttrib[k], + VERT_ATTRIB_GENERIC0 + k, j); } } if (_mesa_is_bufferobj(ctx->Array.ElementArrayBufferObj)) { - ctx->Driver.UnmapBuffer(ctx, - GL_ELEMENT_ARRAY_BUFFER_ARB, + ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, ctx->Array.ElementArrayBufferObj); } @@ -460,7 +454,6 @@ bind_arrays(GLcontext *ctx) } else if (exec->array.program_mode != get_program_mode(ctx) || exec->array.enabled_flags != ctx->Array.ArrayObj->_Enabled) { - recalculate_input_bindings(ctx); } #else @@ -587,11 +580,11 @@ dump_element_buffer(GLcontext *ctx, GLenum type) ; } - ctx->Driver.UnmapBuffer(ctx, - GL_ELEMENT_ARRAY_BUFFER_ARB, + ctx->Driver.UnmapBuffer(ctx, GL_ELEMENT_ARRAY_BUFFER_ARB, ctx->Array.ElementArrayBufferObj); } + /* Inner support for both _mesa_DrawElements and _mesa_DrawRangeElements */ static void vbo_validated_drawrangeelements(GLcontext *ctx, GLenum mode, @@ -766,11 +759,10 @@ vbo_exec_DrawRangeElementsBaseVertex(GLenum mode, count, type, indices, basevertex); } + static void GLAPIENTRY -vbo_exec_DrawRangeElements(GLenum mode, - GLuint start, GLuint end, - GLsizei count, GLenum type, - const GLvoid *indices) +vbo_exec_DrawRangeElements(GLenum mode, GLuint start, GLuint end, + GLsizei count, GLenum type, const GLvoid *indices) { GET_CURRENT_CONTEXT(ctx); @@ -803,6 +795,7 @@ vbo_exec_DrawElements(GLenum mode, GLsizei count, GLenum type, count, type, indices, 0); } + static void GLAPIENTRY vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLint basevertex) @@ -822,7 +815,8 @@ vbo_exec_DrawElementsBaseVertex(GLenum mode, GLsizei count, GLenum type, count, type, indices, basevertex); } -/* Inner support for both _mesa_DrawElements and _mesa_DrawRangeElements */ + +/** Inner support for both _mesa_DrawElements and _mesa_DrawRangeElements */ static void vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode, const GLsizei *count, GLenum type, @@ -957,6 +951,7 @@ vbo_validated_multidrawelements(GLcontext *ctx, GLenum mode, _mesa_free(prim); } + static void GLAPIENTRY vbo_exec_MultiDrawElements(GLenum mode, const GLsizei *count, GLenum type, @@ -978,6 +973,7 @@ vbo_exec_MultiDrawElements(GLenum mode, NULL); } + static void GLAPIENTRY vbo_exec_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, @@ -1067,6 +1063,7 @@ _mesa_DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, vbo_exec_DrawRangeElements(mode, start, end, count, type, indices); } + void GLAPIENTRY _mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, @@ -1076,6 +1073,7 @@ _mesa_DrawRangeElementsBaseVertex(GLenum mode, GLuint start, GLuint end, indices, basevertex); } + /* GL_EXT_multi_draw_arrays */ void GLAPIENTRY _mesa_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, @@ -1084,6 +1082,7 @@ _mesa_MultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, vbo_exec_MultiDrawElements(mode, count, type, indices, primcount); } + void GLAPIENTRY _mesa_MultiDrawElementsBaseVertex(GLenum mode, const GLsizei *count, GLenum type, -- cgit v1.2.3 From 2fd5cb713338e91999a036399a4bea4406687ca0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 14 Oct 2009 16:24:35 -0600 Subject: mesa: added VERBOSE_SWAPBUFFERS --- src/mesa/main/context.c | 2 ++ src/mesa/main/debug.c | 3 ++- src/mesa/main/mtypes.h | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 95ff3495ab..ea1ee22812 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -173,6 +173,8 @@ GLfloat _mesa_ubyte_to_float_color_tab[256]; void _mesa_notifySwapBuffers(__GLcontext *ctx) { + if (MESA_VERBOSE & VERBOSE_SWAPBUFFERS) + _mesa_debug(ctx, "SwapBuffers\n"); FLUSH_CURRENT( ctx, 0 ); if (ctx->Driver.Flush) { ctx->Driver.Flush(ctx); diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 07ed51f5ab..490cc9c26b 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -175,7 +175,8 @@ static void add_debug_flags( const char *debug ) { "list", VERBOSE_DISPLAY_LIST }, { "lighting", VERBOSE_LIGHTING }, { "disassem", VERBOSE_DISASSEM }, - { "draw", VERBOSE_DRAW } + { "draw", VERBOSE_DRAW }, + { "swap", VERBOSE_SWAPBUFFERS } }; GLuint i; diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 5699db5d4a..988bfe1e22 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -3110,7 +3110,8 @@ enum _verbose VERBOSE_PRIMS = 0x0400, VERBOSE_VERTS = 0x0800, VERBOSE_DISASSEM = 0x1000, - VERBOSE_DRAW = 0x2000 + VERBOSE_DRAW = 0x2000, + VERBOSE_SWAPBUFFERS = 0x4000 }; -- cgit v1.2.3 From a82fc97c643c4309a10cfefb108c4c0f11a2e55a Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 14 Oct 2009 20:06:38 -0700 Subject: r300g: Move ZTOP to its own state atom. It may seem pointless, but this avoids a fair amount of predicted CSO pain. --- src/gallium/drivers/r300/r300_context.h | 8 +++++++- src/gallium/drivers/r300/r300_emit.c | 2 +- src/gallium/drivers/r300/r300_state_derived.c | 8 ++++---- src/gallium/drivers/r300/r300_surface.h | 1 - 4 files changed, 12 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index d2e8875503..2acce0fd4a 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -62,7 +62,6 @@ struct r300_dsa_state { uint32_t z_buffer_control; /* R300_ZB_CNTL: 0x4f00 */ uint32_t z_stencil_control; /* R300_ZB_ZSTENCILCNTL: 0x4f04 */ uint32_t stencil_ref_mask; /* R300_ZB_STENCILREFMASK: 0x4f08 */ - uint32_t z_buffer_top; /* R300_ZB_ZTOP: 0x4f14 */ uint32_t stencil_ref_bf; /* R500_ZB_STENCILREFMASK_BF: 0x4fd4 */ }; @@ -124,6 +123,10 @@ struct r300_viewport_state { uint32_t vte_control; /* R300_VAP_VTE_CNTL: 0x20b0 */ }; +struct r300_ztop_state { + uint32_t z_buffer_top; /* R300_ZB_ZTOP: 0x4f14 */ +}; + #define R300_NEW_BLEND 0x00000001 #define R300_NEW_BLEND_COLOR 0x00000002 #define R300_NEW_CLIP 0x00000004 @@ -281,6 +284,9 @@ struct r300_context { struct r300_vertex_shader* vs; /* Viewport state. */ struct r300_viewport_state* viewport_state; + /* ZTOP state. */ + struct r300_ztop_state ztop_state; + /* Bitmask of dirty state objects. */ uint32_t dirty_state; /* Flag indicating whether or not the HW is dirty. */ diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index feffadd0ee..2c3bba952d 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -106,7 +106,7 @@ void r300_emit_dsa_state(struct r300_context* r300, OUT_CS(dsa->z_buffer_control); OUT_CS(dsa->z_stencil_control); OUT_CS(dsa->stencil_ref_mask); - OUT_CS_REG(R300_ZB_ZTOP, dsa->z_buffer_top); + OUT_CS_REG(R300_ZB_ZTOP, r300->ztop_state.z_buffer_top); if (r300screen->caps->is_r500) { /* OUT_CS_REG(R500_ZB_STENCILREFMASK_BF, dsa->stencil_ref_bf); */ } diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 5d323a26b1..f0861a9cf1 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -446,7 +446,7 @@ static void r300_update_rs_block(struct r300_context* r300) static void r300_update_ztop(struct r300_context* r300) { - r300->dsa_state->z_buffer_top = R300_ZTOP_ENABLE; + r300->ztop_state.z_buffer_top = R300_ZTOP_ENABLE; /* This is important enough that I felt it warranted a comment. * @@ -467,11 +467,11 @@ static void r300_update_ztop(struct r300_context* r300) * ~C. */ if (r300->dsa_state->alpha_function) { - r300->dsa_state->z_buffer_top = R300_ZTOP_DISABLE; + r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE; } else if (r300_fragment_shader_writes_depth(r300->fs)) { - r300->dsa_state->z_buffer_top = R300_ZTOP_DISABLE; + r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE; } else if (r300->query_current) { - r300->dsa_state->z_buffer_top = R300_ZTOP_DISABLE; + r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE; } } diff --git a/src/gallium/drivers/r300/r300_surface.h b/src/gallium/drivers/r300/r300_surface.h index f9e98b2ec9..d5998e6e6d 100644 --- a/src/gallium/drivers/r300/r300_surface.h +++ b/src/gallium/drivers/r300/r300_surface.h @@ -54,7 +54,6 @@ static struct r300_dsa_state dsa_clear_state = { .z_buffer_control = 0x0, .z_stencil_control = 0x0, .stencil_ref_mask = R300_STENCILWRITEMASK_MASK, - .z_buffer_top = R300_ZTOP_ENABLE, .stencil_ref_bf = 0x0, }; -- cgit v1.2.3 From 074e069910c7082620be4211fe5496365f828886 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Sun, 11 Oct 2009 06:08:42 -0400 Subject: st/xorg: fix most of the composition modes --- src/gallium/state_trackers/xorg/xorg_composite.c | 40 +++++++++++++++++++----- 1 file changed, 32 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index b39b39511e..b07192175e 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -22,7 +22,7 @@ struct xorg_composite_blend { #define BLEND_OP_OVER 3 static const struct xorg_composite_blend xorg_blends[] = { { PictOpClear, - PIPE_BLENDFACTOR_CONST_COLOR, PIPE_BLENDFACTOR_CONST_ALPHA, + PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ZERO }, { PictOpSrc, @@ -34,20 +34,44 @@ static const struct xorg_composite_blend xorg_blends[] = { PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_ONE }, { PictOpOver, - PIPE_BLENDFACTOR_SRC_ALPHA, PIPE_BLENDFACTOR_ONE, + PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_INV_SRC_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA }, { PictOpOverReverse, - PIPE_BLENDFACTOR_SRC_ALPHA, PIPE_BLENDFACTOR_ONE, - PIPE_BLENDFACTOR_INV_SRC_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA }, + PIPE_BLENDFACTOR_INV_DST_ALPHA, PIPE_BLENDFACTOR_ONE, + PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_INV_SRC_ALPHA }, + + { PictOpIn, + PIPE_BLENDFACTOR_DST_ALPHA, PIPE_BLENDFACTOR_ONE, + PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_INV_SRC_ALPHA }, + + { PictOpInReverse, + PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ONE, + PIPE_BLENDFACTOR_SRC_ALPHA, PIPE_BLENDFACTOR_ONE }, + + { PictOpOut, + PIPE_BLENDFACTOR_INV_DST_ALPHA, PIPE_BLENDFACTOR_ONE, + PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_INV_SRC_ALPHA }, { PictOpOutReverse, - PIPE_BLENDFACTOR_SRC_ALPHA, PIPE_BLENDFACTOR_ONE, + PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_INV_SRC_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA }, - { PictOpAdd, - PIPE_BLENDFACTOR_SRC_ALPHA, PIPE_BLENDFACTOR_ONE, + { PictOpAtop, + PIPE_BLENDFACTOR_DST_ALPHA, PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_INV_SRC_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA }, + + { PictOpAtopReverse, + PIPE_BLENDFACTOR_INV_DST_ALPHA, PIPE_BLENDFACTOR_ONE, + PIPE_BLENDFACTOR_SRC_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA }, + + { PictOpXor, + PIPE_BLENDFACTOR_INV_DST_ALPHA, PIPE_BLENDFACTOR_ONE, + PIPE_BLENDFACTOR_INV_SRC_ALPHA, PIPE_BLENDFACTOR_ONE }, + + { PictOpAdd, + PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_ONE, + PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_ONE }, }; @@ -164,7 +188,7 @@ bind_blend_state(struct exa_context *exa, int op, blend_opt = blend_for_op(op); - memset(&blend, 0, sizeof(struct pipe_blend_state)); + memset(&blend, 0, sizeof(struct pipe_blend_state)); blend.blend_enable = 1; blend.colormask |= PIPE_MASK_RGBA; -- cgit v1.2.3 From 72fd1cf292937565a182b400595816c6ad88836a Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 14 Oct 2009 11:44:09 +0200 Subject: trace: Handle transfer returning null --- src/gallium/drivers/trace/tr_screen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index ab605c7fc8..7da9bd3866 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -366,7 +366,8 @@ trace_screen_get_tex_transfer(struct pipe_screen *_screen, trace_dump_call_end(); - result = trace_transfer_create(tr_tex, result); + if (result) + result = trace_transfer_create(tr_tex, result); return result; } -- cgit v1.2.3 From c47b03ebebd4db30bf5ed17b44c0f8757306b197 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 14 Oct 2009 13:14:22 -0600 Subject: radeon: initialize renderbuffer Format field in radeon_create_renderbuffer() Plus, use MESA_FORMAT_S8_Z24 everywhere. --- src/mesa/drivers/dri/radeon/radeon_fbo.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 796dd1b423..21007d85c3 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -121,7 +121,7 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_STENCIL_INDEX8_EXT: case GL_STENCIL_INDEX16_EXT: /* alloc a depth+stencil buffer */ - rb->Format = MESA_FORMAT_Z24_S8; + rb->Format = MESA_FORMAT_S8_Z24; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; cpp = 4; break; @@ -139,7 +139,7 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, break; case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: - rb->Format = MESA_FORMAT_Z24_S8; + rb->Format = MESA_FORMAT_S8_Z24; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; cpp = 4; break; @@ -255,30 +255,37 @@ radeon_create_renderbuffer(GLenum format, __DRIdrawablePrivate *driDrawPriv) /* XXX format junk */ switch (format) { case GL_RGB5: + rrb->base.Format = MESA_FORMAT_RGB565; rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGB; break; case GL_RGB8: + rrb->base.Format = MESA_FORMAT_ARGB8888; rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGB; break; case GL_RGBA8: + rrb->base.Format = MESA_FORMAT_ARGB8888; rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGBA; break; case GL_STENCIL_INDEX8_EXT: + rrb->base.Format = MESA_FORMAT_S8; rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_STENCIL_INDEX; break; case GL_DEPTH_COMPONENT16: + rrb->base.Format = MESA_FORMAT_Z16; rrb->base.DataType = GL_UNSIGNED_SHORT; rrb->base._BaseFormat = GL_DEPTH_COMPONENT; break; case GL_DEPTH_COMPONENT24: + rrb->base.Format = MESA_FORMAT_Z32; rrb->base.DataType = GL_UNSIGNED_INT; rrb->base._BaseFormat = GL_DEPTH_COMPONENT; break; case GL_DEPTH24_STENCIL8_EXT: + rrb->base.Format = MESA_FORMAT_S8_Z24; rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT; rrb->base._BaseFormat = GL_STENCIL_INDEX; break; -- cgit v1.2.3 From 269f16cd96fdbee5d178130171b4ef40258f61cf Mon Sep 17 00:00:00 2001 From: Neil Roberts Date: Wed, 14 Oct 2009 23:25:04 +0100 Subject: mesa: Use _mesa_strtod in the lexer for assembly shaders See bug 24531. --- src/mesa/shader/program_lexer.l | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/program_lexer.l b/src/mesa/shader/program_lexer.l index d240217481..c2803ff707 100644 --- a/src/mesa/shader/program_lexer.l +++ b/src/mesa/shader/program_lexer.l @@ -22,6 +22,7 @@ * DEALINGS IN THE SOFTWARE. */ #include "main/glheader.h" +#include "main/imports.h" #include "prog_instruction.h" #include "prog_statevars.h" @@ -318,19 +319,19 @@ ARRAYSHADOW2D { return_token_or_IDENTIFIER(require_ARB_fp && require return INTEGER; } {num}?{frac}{exp}? { - yylval->real = strtod(yytext, NULL); + yylval->real = _mesa_strtod(yytext, NULL); return REAL; } {num}"."/[^.] { - yylval->real = strtod(yytext, NULL); + yylval->real = _mesa_strtod(yytext, NULL); return REAL; } {num}{exp} { - yylval->real = strtod(yytext, NULL); + yylval->real = _mesa_strtod(yytext, NULL); return REAL; } {num}"."{exp} { - yylval->real = strtod(yytext, NULL); + yylval->real = _mesa_strtod(yytext, NULL); return REAL; } -- cgit v1.2.3 From 6f8b4d9e3625c7de83247596fd6822227da04336 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 15 Oct 2009 08:59:13 -0600 Subject: mesa: regenerated lex.yy.c w/ _mesa_strtod() --- src/mesa/shader/lex.yy.c | 385 ++++++++++++++++++++++++----------------------- 1 file changed, 193 insertions(+), 192 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/lex.yy.c b/src/mesa/shader/lex.yy.c index 709426f3a6..fefef573ee 100644 --- a/src/mesa/shader/lex.yy.c +++ b/src/mesa/shader/lex.yy.c @@ -900,6 +900,7 @@ static yyconst flex_int16_t yy_chk[1023] = * DEALINGS IN THE SOFTWARE. */ #include "main/glheader.h" +#include "main/imports.h" #include "prog_instruction.h" #include "prog_statevars.h" @@ -1003,7 +1004,7 @@ swiz_from_char(char c) } while(0); #define YY_EXTRA_TYPE struct asm_parser_state * -#line 1007 "lex.yy.c" +#line 1008 "lex.yy.c" #define INITIAL 0 @@ -1244,10 +1245,10 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 136 "program_lexer.l" +#line 137 "program_lexer.l" -#line 1251 "lex.yy.c" +#line 1252 "lex.yy.c" yylval = yylval_param; @@ -1336,17 +1337,17 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 138 "program_lexer.l" +#line 139 "program_lexer.l" { return ARBvp_10; } YY_BREAK case 2: YY_RULE_SETUP -#line 139 "program_lexer.l" +#line 140 "program_lexer.l" { return ARBfp_10; } YY_BREAK case 3: YY_RULE_SETUP -#line 140 "program_lexer.l" +#line 141 "program_lexer.l" { yylval->integer = at_address; return_token_or_IDENTIFIER(require_ARB_vp, ADDRESS); @@ -1354,747 +1355,747 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 144 "program_lexer.l" +#line 145 "program_lexer.l" { return ALIAS; } YY_BREAK case 5: YY_RULE_SETUP -#line 145 "program_lexer.l" +#line 146 "program_lexer.l" { return ATTRIB; } YY_BREAK case 6: YY_RULE_SETUP -#line 146 "program_lexer.l" +#line 147 "program_lexer.l" { return END; } YY_BREAK case 7: YY_RULE_SETUP -#line 147 "program_lexer.l" +#line 148 "program_lexer.l" { return OPTION; } YY_BREAK case 8: YY_RULE_SETUP -#line 148 "program_lexer.l" +#line 149 "program_lexer.l" { return OUTPUT; } YY_BREAK case 9: YY_RULE_SETUP -#line 149 "program_lexer.l" +#line 150 "program_lexer.l" { return PARAM; } YY_BREAK case 10: YY_RULE_SETUP -#line 150 "program_lexer.l" +#line 151 "program_lexer.l" { yylval->integer = at_temp; return TEMP; } YY_BREAK case 11: YY_RULE_SETUP -#line 152 "program_lexer.l" +#line 153 "program_lexer.l" { return_opcode( 1, VECTOR_OP, ABS, OFF); } YY_BREAK case 12: YY_RULE_SETUP -#line 153 "program_lexer.l" +#line 154 "program_lexer.l" { return_opcode(require_ARB_fp, VECTOR_OP, ABS, ZERO_ONE); } YY_BREAK case 13: YY_RULE_SETUP -#line 154 "program_lexer.l" +#line 155 "program_lexer.l" { return_opcode( 1, BIN_OP, ADD, OFF); } YY_BREAK case 14: YY_RULE_SETUP -#line 155 "program_lexer.l" +#line 156 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, ADD, ZERO_ONE); } YY_BREAK case 15: YY_RULE_SETUP -#line 156 "program_lexer.l" +#line 157 "program_lexer.l" { return_opcode(require_ARB_vp, ARL, ARL, OFF); } YY_BREAK case 16: YY_RULE_SETUP -#line 158 "program_lexer.l" +#line 159 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, CMP, OFF); } YY_BREAK case 17: YY_RULE_SETUP -#line 159 "program_lexer.l" +#line 160 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, CMP, ZERO_ONE); } YY_BREAK case 18: YY_RULE_SETUP -#line 160 "program_lexer.l" +#line 161 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, COS, OFF); } YY_BREAK case 19: YY_RULE_SETUP -#line 161 "program_lexer.l" +#line 162 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, COS, ZERO_ONE); } YY_BREAK case 20: YY_RULE_SETUP -#line 163 "program_lexer.l" +#line 164 "program_lexer.l" { return_opcode( 1, BIN_OP, DP3, OFF); } YY_BREAK case 21: YY_RULE_SETUP -#line 164 "program_lexer.l" +#line 165 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, DP3, ZERO_ONE); } YY_BREAK case 22: YY_RULE_SETUP -#line 165 "program_lexer.l" +#line 166 "program_lexer.l" { return_opcode( 1, BIN_OP, DP4, OFF); } YY_BREAK case 23: YY_RULE_SETUP -#line 166 "program_lexer.l" +#line 167 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, DP4, ZERO_ONE); } YY_BREAK case 24: YY_RULE_SETUP -#line 167 "program_lexer.l" +#line 168 "program_lexer.l" { return_opcode( 1, BIN_OP, DPH, OFF); } YY_BREAK case 25: YY_RULE_SETUP -#line 168 "program_lexer.l" +#line 169 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, DPH, ZERO_ONE); } YY_BREAK case 26: YY_RULE_SETUP -#line 169 "program_lexer.l" +#line 170 "program_lexer.l" { return_opcode( 1, BIN_OP, DST, OFF); } YY_BREAK case 27: YY_RULE_SETUP -#line 170 "program_lexer.l" +#line 171 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, DST, ZERO_ONE); } YY_BREAK case 28: YY_RULE_SETUP -#line 172 "program_lexer.l" +#line 173 "program_lexer.l" { return_opcode( 1, SCALAR_OP, EX2, OFF); } YY_BREAK case 29: YY_RULE_SETUP -#line 173 "program_lexer.l" +#line 174 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, EX2, ZERO_ONE); } YY_BREAK case 30: YY_RULE_SETUP -#line 174 "program_lexer.l" +#line 175 "program_lexer.l" { return_opcode(require_ARB_vp, SCALAR_OP, EXP, OFF); } YY_BREAK case 31: YY_RULE_SETUP -#line 176 "program_lexer.l" +#line 177 "program_lexer.l" { return_opcode( 1, VECTOR_OP, FLR, OFF); } YY_BREAK case 32: YY_RULE_SETUP -#line 177 "program_lexer.l" +#line 178 "program_lexer.l" { return_opcode(require_ARB_fp, VECTOR_OP, FLR, ZERO_ONE); } YY_BREAK case 33: YY_RULE_SETUP -#line 178 "program_lexer.l" +#line 179 "program_lexer.l" { return_opcode( 1, VECTOR_OP, FRC, OFF); } YY_BREAK case 34: YY_RULE_SETUP -#line 179 "program_lexer.l" +#line 180 "program_lexer.l" { return_opcode(require_ARB_fp, VECTOR_OP, FRC, ZERO_ONE); } YY_BREAK case 35: YY_RULE_SETUP -#line 181 "program_lexer.l" +#line 182 "program_lexer.l" { return_opcode(require_ARB_fp, KIL, KIL, OFF); } YY_BREAK case 36: YY_RULE_SETUP -#line 183 "program_lexer.l" +#line 184 "program_lexer.l" { return_opcode( 1, VECTOR_OP, LIT, OFF); } YY_BREAK case 37: YY_RULE_SETUP -#line 184 "program_lexer.l" +#line 185 "program_lexer.l" { return_opcode(require_ARB_fp, VECTOR_OP, LIT, ZERO_ONE); } YY_BREAK case 38: YY_RULE_SETUP -#line 185 "program_lexer.l" +#line 186 "program_lexer.l" { return_opcode( 1, SCALAR_OP, LG2, OFF); } YY_BREAK case 39: YY_RULE_SETUP -#line 186 "program_lexer.l" +#line 187 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, LG2, ZERO_ONE); } YY_BREAK case 40: YY_RULE_SETUP -#line 187 "program_lexer.l" +#line 188 "program_lexer.l" { return_opcode(require_ARB_vp, SCALAR_OP, LOG, OFF); } YY_BREAK case 41: YY_RULE_SETUP -#line 188 "program_lexer.l" +#line 189 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, LRP, OFF); } YY_BREAK case 42: YY_RULE_SETUP -#line 189 "program_lexer.l" +#line 190 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, LRP, ZERO_ONE); } YY_BREAK case 43: YY_RULE_SETUP -#line 191 "program_lexer.l" +#line 192 "program_lexer.l" { return_opcode( 1, TRI_OP, MAD, OFF); } YY_BREAK case 44: YY_RULE_SETUP -#line 192 "program_lexer.l" +#line 193 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, MAD, ZERO_ONE); } YY_BREAK case 45: YY_RULE_SETUP -#line 193 "program_lexer.l" +#line 194 "program_lexer.l" { return_opcode( 1, BIN_OP, MAX, OFF); } YY_BREAK case 46: YY_RULE_SETUP -#line 194 "program_lexer.l" +#line 195 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, MAX, ZERO_ONE); } YY_BREAK case 47: YY_RULE_SETUP -#line 195 "program_lexer.l" +#line 196 "program_lexer.l" { return_opcode( 1, BIN_OP, MIN, OFF); } YY_BREAK case 48: YY_RULE_SETUP -#line 196 "program_lexer.l" +#line 197 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, MIN, ZERO_ONE); } YY_BREAK case 49: YY_RULE_SETUP -#line 197 "program_lexer.l" +#line 198 "program_lexer.l" { return_opcode( 1, VECTOR_OP, MOV, OFF); } YY_BREAK case 50: YY_RULE_SETUP -#line 198 "program_lexer.l" +#line 199 "program_lexer.l" { return_opcode(require_ARB_fp, VECTOR_OP, MOV, ZERO_ONE); } YY_BREAK case 51: YY_RULE_SETUP -#line 199 "program_lexer.l" +#line 200 "program_lexer.l" { return_opcode( 1, BIN_OP, MUL, OFF); } YY_BREAK case 52: YY_RULE_SETUP -#line 200 "program_lexer.l" +#line 201 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, MUL, ZERO_ONE); } YY_BREAK case 53: YY_RULE_SETUP -#line 202 "program_lexer.l" +#line 203 "program_lexer.l" { return_opcode( 1, BINSC_OP, POW, OFF); } YY_BREAK case 54: YY_RULE_SETUP -#line 203 "program_lexer.l" +#line 204 "program_lexer.l" { return_opcode(require_ARB_fp, BINSC_OP, POW, ZERO_ONE); } YY_BREAK case 55: YY_RULE_SETUP -#line 205 "program_lexer.l" +#line 206 "program_lexer.l" { return_opcode( 1, SCALAR_OP, RCP, OFF); } YY_BREAK case 56: YY_RULE_SETUP -#line 206 "program_lexer.l" +#line 207 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, RCP, ZERO_ONE); } YY_BREAK case 57: YY_RULE_SETUP -#line 207 "program_lexer.l" +#line 208 "program_lexer.l" { return_opcode( 1, SCALAR_OP, RSQ, OFF); } YY_BREAK case 58: YY_RULE_SETUP -#line 208 "program_lexer.l" +#line 209 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, RSQ, ZERO_ONE); } YY_BREAK case 59: YY_RULE_SETUP -#line 210 "program_lexer.l" +#line 211 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SCS, OFF); } YY_BREAK case 60: YY_RULE_SETUP -#line 211 "program_lexer.l" +#line 212 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SCS, ZERO_ONE); } YY_BREAK case 61: YY_RULE_SETUP -#line 212 "program_lexer.l" +#line 213 "program_lexer.l" { return_opcode( 1, BIN_OP, SGE, OFF); } YY_BREAK case 62: YY_RULE_SETUP -#line 213 "program_lexer.l" +#line 214 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, SGE, ZERO_ONE); } YY_BREAK case 63: YY_RULE_SETUP -#line 214 "program_lexer.l" +#line 215 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SIN, OFF); } YY_BREAK case 64: YY_RULE_SETUP -#line 215 "program_lexer.l" +#line 216 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SIN, ZERO_ONE); } YY_BREAK case 65: YY_RULE_SETUP -#line 216 "program_lexer.l" +#line 217 "program_lexer.l" { return_opcode( 1, BIN_OP, SLT, OFF); } YY_BREAK case 66: YY_RULE_SETUP -#line 217 "program_lexer.l" +#line 218 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, SLT, ZERO_ONE); } YY_BREAK case 67: YY_RULE_SETUP -#line 218 "program_lexer.l" +#line 219 "program_lexer.l" { return_opcode( 1, BIN_OP, SUB, OFF); } YY_BREAK case 68: YY_RULE_SETUP -#line 219 "program_lexer.l" +#line 220 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, SUB, ZERO_ONE); } YY_BREAK case 69: YY_RULE_SETUP -#line 220 "program_lexer.l" +#line 221 "program_lexer.l" { return_opcode( 1, SWZ, SWZ, OFF); } YY_BREAK case 70: YY_RULE_SETUP -#line 221 "program_lexer.l" +#line 222 "program_lexer.l" { return_opcode(require_ARB_fp, SWZ, SWZ, ZERO_ONE); } YY_BREAK case 71: YY_RULE_SETUP -#line 223 "program_lexer.l" +#line 224 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TEX, OFF); } YY_BREAK case 72: YY_RULE_SETUP -#line 224 "program_lexer.l" +#line 225 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TEX, ZERO_ONE); } YY_BREAK case 73: YY_RULE_SETUP -#line 225 "program_lexer.l" +#line 226 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, OFF); } YY_BREAK case 74: YY_RULE_SETUP -#line 226 "program_lexer.l" +#line 227 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, ZERO_ONE); } YY_BREAK case 75: YY_RULE_SETUP -#line 227 "program_lexer.l" +#line 228 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, OFF); } YY_BREAK case 76: YY_RULE_SETUP -#line 228 "program_lexer.l" +#line 229 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, ZERO_ONE); } YY_BREAK case 77: YY_RULE_SETUP -#line 230 "program_lexer.l" +#line 231 "program_lexer.l" { return_opcode( 1, BIN_OP, XPD, OFF); } YY_BREAK case 78: YY_RULE_SETUP -#line 231 "program_lexer.l" +#line 232 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, XPD, ZERO_ONE); } YY_BREAK case 79: YY_RULE_SETUP -#line 233 "program_lexer.l" +#line 234 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); } YY_BREAK case 80: YY_RULE_SETUP -#line 234 "program_lexer.l" +#line 235 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); } YY_BREAK case 81: YY_RULE_SETUP -#line 235 "program_lexer.l" +#line 236 "program_lexer.l" { return PROGRAM; } YY_BREAK case 82: YY_RULE_SETUP -#line 236 "program_lexer.l" +#line 237 "program_lexer.l" { return STATE; } YY_BREAK case 83: YY_RULE_SETUP -#line 237 "program_lexer.l" +#line 238 "program_lexer.l" { return RESULT; } YY_BREAK case 84: YY_RULE_SETUP -#line 239 "program_lexer.l" +#line 240 "program_lexer.l" { return AMBIENT; } YY_BREAK case 85: YY_RULE_SETUP -#line 240 "program_lexer.l" +#line 241 "program_lexer.l" { return ATTENUATION; } YY_BREAK case 86: YY_RULE_SETUP -#line 241 "program_lexer.l" +#line 242 "program_lexer.l" { return BACK; } YY_BREAK case 87: YY_RULE_SETUP -#line 242 "program_lexer.l" +#line 243 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, CLIP); } YY_BREAK case 88: YY_RULE_SETUP -#line 243 "program_lexer.l" +#line 244 "program_lexer.l" { return COLOR; } YY_BREAK case 89: YY_RULE_SETUP -#line 244 "program_lexer.l" +#line 245 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, DEPTH); } YY_BREAK case 90: YY_RULE_SETUP -#line 245 "program_lexer.l" +#line 246 "program_lexer.l" { return DIFFUSE; } YY_BREAK case 91: YY_RULE_SETUP -#line 246 "program_lexer.l" +#line 247 "program_lexer.l" { return DIRECTION; } YY_BREAK case 92: YY_RULE_SETUP -#line 247 "program_lexer.l" +#line 248 "program_lexer.l" { return EMISSION; } YY_BREAK case 93: YY_RULE_SETUP -#line 248 "program_lexer.l" +#line 249 "program_lexer.l" { return ENV; } YY_BREAK case 94: YY_RULE_SETUP -#line 249 "program_lexer.l" +#line 250 "program_lexer.l" { return EYE; } YY_BREAK case 95: YY_RULE_SETUP -#line 250 "program_lexer.l" +#line 251 "program_lexer.l" { return FOGCOORD; } YY_BREAK case 96: YY_RULE_SETUP -#line 251 "program_lexer.l" +#line 252 "program_lexer.l" { return FOG; } YY_BREAK case 97: YY_RULE_SETUP -#line 252 "program_lexer.l" +#line 253 "program_lexer.l" { return FRONT; } YY_BREAK case 98: YY_RULE_SETUP -#line 253 "program_lexer.l" +#line 254 "program_lexer.l" { return HALF; } YY_BREAK case 99: YY_RULE_SETUP -#line 254 "program_lexer.l" +#line 255 "program_lexer.l" { return INVERSE; } YY_BREAK case 100: YY_RULE_SETUP -#line 255 "program_lexer.l" +#line 256 "program_lexer.l" { return INVTRANS; } YY_BREAK case 101: YY_RULE_SETUP -#line 256 "program_lexer.l" +#line 257 "program_lexer.l" { return LIGHT; } YY_BREAK case 102: YY_RULE_SETUP -#line 257 "program_lexer.l" +#line 258 "program_lexer.l" { return LIGHTMODEL; } YY_BREAK case 103: YY_RULE_SETUP -#line 258 "program_lexer.l" +#line 259 "program_lexer.l" { return LIGHTPROD; } YY_BREAK case 104: YY_RULE_SETUP -#line 259 "program_lexer.l" +#line 260 "program_lexer.l" { return LOCAL; } YY_BREAK case 105: YY_RULE_SETUP -#line 260 "program_lexer.l" +#line 261 "program_lexer.l" { return MATERIAL; } YY_BREAK case 106: YY_RULE_SETUP -#line 261 "program_lexer.l" +#line 262 "program_lexer.l" { return MAT_PROGRAM; } YY_BREAK case 107: YY_RULE_SETUP -#line 262 "program_lexer.l" +#line 263 "program_lexer.l" { return MATRIX; } YY_BREAK case 108: YY_RULE_SETUP -#line 263 "program_lexer.l" +#line 264 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, MATRIXINDEX); } YY_BREAK case 109: YY_RULE_SETUP -#line 264 "program_lexer.l" +#line 265 "program_lexer.l" { return MODELVIEW; } YY_BREAK case 110: YY_RULE_SETUP -#line 265 "program_lexer.l" +#line 266 "program_lexer.l" { return MVP; } YY_BREAK case 111: YY_RULE_SETUP -#line 266 "program_lexer.l" +#line 267 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, NORMAL); } YY_BREAK case 112: YY_RULE_SETUP -#line 267 "program_lexer.l" +#line 268 "program_lexer.l" { return OBJECT; } YY_BREAK case 113: YY_RULE_SETUP -#line 268 "program_lexer.l" +#line 269 "program_lexer.l" { return PALETTE; } YY_BREAK case 114: YY_RULE_SETUP -#line 269 "program_lexer.l" +#line 270 "program_lexer.l" { return PARAMS; } YY_BREAK case 115: YY_RULE_SETUP -#line 270 "program_lexer.l" +#line 271 "program_lexer.l" { return PLANE; } YY_BREAK case 116: YY_RULE_SETUP -#line 271 "program_lexer.l" +#line 272 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, POINT_TOK); } YY_BREAK case 117: YY_RULE_SETUP -#line 272 "program_lexer.l" +#line 273 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, POINTSIZE); } YY_BREAK case 118: YY_RULE_SETUP -#line 273 "program_lexer.l" +#line 274 "program_lexer.l" { return POSITION; } YY_BREAK case 119: YY_RULE_SETUP -#line 274 "program_lexer.l" +#line 275 "program_lexer.l" { return PRIMARY; } YY_BREAK case 120: YY_RULE_SETUP -#line 275 "program_lexer.l" +#line 276 "program_lexer.l" { return PROJECTION; } YY_BREAK case 121: YY_RULE_SETUP -#line 276 "program_lexer.l" +#line 277 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, RANGE); } YY_BREAK case 122: YY_RULE_SETUP -#line 277 "program_lexer.l" +#line 278 "program_lexer.l" { return ROW; } YY_BREAK case 123: YY_RULE_SETUP -#line 278 "program_lexer.l" +#line 279 "program_lexer.l" { return SCENECOLOR; } YY_BREAK case 124: YY_RULE_SETUP -#line 279 "program_lexer.l" +#line 280 "program_lexer.l" { return SECONDARY; } YY_BREAK case 125: YY_RULE_SETUP -#line 280 "program_lexer.l" +#line 281 "program_lexer.l" { return SHININESS; } YY_BREAK case 126: YY_RULE_SETUP -#line 281 "program_lexer.l" +#line 282 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, SIZE_TOK); } YY_BREAK case 127: YY_RULE_SETUP -#line 282 "program_lexer.l" +#line 283 "program_lexer.l" { return SPECULAR; } YY_BREAK case 128: YY_RULE_SETUP -#line 283 "program_lexer.l" +#line 284 "program_lexer.l" { return SPOT; } YY_BREAK case 129: YY_RULE_SETUP -#line 284 "program_lexer.l" +#line 285 "program_lexer.l" { return TEXCOORD; } YY_BREAK case 130: YY_RULE_SETUP -#line 285 "program_lexer.l" +#line 286 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, TEXENV); } YY_BREAK case 131: YY_RULE_SETUP -#line 286 "program_lexer.l" +#line 287 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN); } YY_BREAK case 132: YY_RULE_SETUP -#line 287 "program_lexer.l" +#line 288 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_Q); } YY_BREAK case 133: YY_RULE_SETUP -#line 288 "program_lexer.l" +#line 289 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_S); } YY_BREAK case 134: YY_RULE_SETUP -#line 289 "program_lexer.l" +#line 290 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_T); } YY_BREAK case 135: YY_RULE_SETUP -#line 290 "program_lexer.l" +#line 291 "program_lexer.l" { return TEXTURE; } YY_BREAK case 136: YY_RULE_SETUP -#line 291 "program_lexer.l" +#line 292 "program_lexer.l" { return TRANSPOSE; } YY_BREAK case 137: YY_RULE_SETUP -#line 292 "program_lexer.l" +#line 293 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, VTXATTRIB); } YY_BREAK case 138: YY_RULE_SETUP -#line 293 "program_lexer.l" +#line 294 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, WEIGHT); } YY_BREAK case 139: YY_RULE_SETUP -#line 295 "program_lexer.l" +#line 296 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEXTURE_UNIT); } YY_BREAK case 140: YY_RULE_SETUP -#line 296 "program_lexer.l" +#line 297 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_1D); } YY_BREAK case 141: YY_RULE_SETUP -#line 297 "program_lexer.l" +#line 298 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_2D); } YY_BREAK case 142: YY_RULE_SETUP -#line 298 "program_lexer.l" +#line 299 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_3D); } YY_BREAK case 143: YY_RULE_SETUP -#line 299 "program_lexer.l" +#line 300 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_CUBE); } YY_BREAK case 144: YY_RULE_SETUP -#line 300 "program_lexer.l" +#line 301 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_rect, TEX_RECT); } YY_BREAK case 145: YY_RULE_SETUP -#line 301 "program_lexer.l" +#line 302 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW1D); } YY_BREAK case 146: YY_RULE_SETUP -#line 302 "program_lexer.l" +#line 303 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW2D); } YY_BREAK case 147: YY_RULE_SETUP -#line 303 "program_lexer.l" +#line 304 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_rect, TEX_SHADOWRECT); } YY_BREAK case 148: YY_RULE_SETUP -#line 304 "program_lexer.l" +#line 305 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY1D); } YY_BREAK case 149: YY_RULE_SETUP -#line 305 "program_lexer.l" +#line 306 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY2D); } YY_BREAK case 150: YY_RULE_SETUP -#line 306 "program_lexer.l" +#line 307 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW1D); } YY_BREAK case 151: YY_RULE_SETUP -#line 307 "program_lexer.l" +#line 308 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); } YY_BREAK case 152: YY_RULE_SETUP -#line 309 "program_lexer.l" +#line 310 "program_lexer.l" { yylval->string = strdup(yytext); return IDENTIFIER; @@ -2102,12 +2103,12 @@ YY_RULE_SETUP YY_BREAK case 153: YY_RULE_SETUP -#line 314 "program_lexer.l" +#line 315 "program_lexer.l" { return DOT_DOT; } YY_BREAK case 154: YY_RULE_SETUP -#line 316 "program_lexer.l" +#line 317 "program_lexer.l" { yylval->integer = strtol(yytext, NULL, 10); return INTEGER; @@ -2115,9 +2116,9 @@ YY_RULE_SETUP YY_BREAK case 155: YY_RULE_SETUP -#line 320 "program_lexer.l" +#line 321 "program_lexer.l" { - yylval->real = strtod(yytext, NULL); + yylval->real = _mesa_strtod(yytext, NULL); return REAL; } YY_BREAK @@ -2127,31 +2128,31 @@ case 156: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 324 "program_lexer.l" +#line 325 "program_lexer.l" { - yylval->real = strtod(yytext, NULL); + yylval->real = _mesa_strtod(yytext, NULL); return REAL; } YY_BREAK case 157: YY_RULE_SETUP -#line 328 "program_lexer.l" +#line 329 "program_lexer.l" { - yylval->real = strtod(yytext, NULL); + yylval->real = _mesa_strtod(yytext, NULL); return REAL; } YY_BREAK case 158: YY_RULE_SETUP -#line 332 "program_lexer.l" +#line 333 "program_lexer.l" { - yylval->real = strtod(yytext, NULL); + yylval->real = _mesa_strtod(yytext, NULL); return REAL; } YY_BREAK case 159: YY_RULE_SETUP -#line 337 "program_lexer.l" +#line 338 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; @@ -2160,7 +2161,7 @@ YY_RULE_SETUP YY_BREAK case 160: YY_RULE_SETUP -#line 343 "program_lexer.l" +#line 344 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2170,7 +2171,7 @@ YY_RULE_SETUP YY_BREAK case 161: YY_RULE_SETUP -#line 349 "program_lexer.l" +#line 350 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; @@ -2179,7 +2180,7 @@ YY_RULE_SETUP YY_BREAK case 162: YY_RULE_SETUP -#line 354 "program_lexer.l" +#line 355 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; @@ -2188,7 +2189,7 @@ YY_RULE_SETUP YY_BREAK case 163: YY_RULE_SETUP -#line 360 "program_lexer.l" +#line 361 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2198,7 +2199,7 @@ YY_RULE_SETUP YY_BREAK case 164: YY_RULE_SETUP -#line 366 "program_lexer.l" +#line 367 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2208,7 +2209,7 @@ YY_RULE_SETUP YY_BREAK case 165: YY_RULE_SETUP -#line 372 "program_lexer.l" +#line 373 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; @@ -2217,7 +2218,7 @@ YY_RULE_SETUP YY_BREAK case 166: YY_RULE_SETUP -#line 378 "program_lexer.l" +#line 379 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2227,7 +2228,7 @@ YY_RULE_SETUP YY_BREAK case 167: YY_RULE_SETUP -#line 385 "program_lexer.l" +#line 386 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2239,7 +2240,7 @@ YY_RULE_SETUP YY_BREAK case 168: YY_RULE_SETUP -#line 394 "program_lexer.l" +#line 395 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; @@ -2248,7 +2249,7 @@ YY_RULE_SETUP YY_BREAK case 169: YY_RULE_SETUP -#line 400 "program_lexer.l" +#line 401 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2258,7 +2259,7 @@ YY_RULE_SETUP YY_BREAK case 170: YY_RULE_SETUP -#line 406 "program_lexer.l" +#line 407 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; @@ -2267,7 +2268,7 @@ YY_RULE_SETUP YY_BREAK case 171: YY_RULE_SETUP -#line 411 "program_lexer.l" +#line 412 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; @@ -2276,7 +2277,7 @@ YY_RULE_SETUP YY_BREAK case 172: YY_RULE_SETUP -#line 417 "program_lexer.l" +#line 418 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2286,7 +2287,7 @@ YY_RULE_SETUP YY_BREAK case 173: YY_RULE_SETUP -#line 423 "program_lexer.l" +#line 424 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2296,7 +2297,7 @@ YY_RULE_SETUP YY_BREAK case 174: YY_RULE_SETUP -#line 429 "program_lexer.l" +#line 430 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; @@ -2305,7 +2306,7 @@ YY_RULE_SETUP YY_BREAK case 175: YY_RULE_SETUP -#line 435 "program_lexer.l" +#line 436 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2315,7 +2316,7 @@ YY_RULE_SETUP YY_BREAK case 176: YY_RULE_SETUP -#line 443 "program_lexer.l" +#line 444 "program_lexer.l" { if (require_ARB_vp) { return TEXGEN_R; @@ -2329,7 +2330,7 @@ YY_RULE_SETUP YY_BREAK case 177: YY_RULE_SETUP -#line 454 "program_lexer.l" +#line 455 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2341,13 +2342,13 @@ YY_RULE_SETUP YY_BREAK case 178: YY_RULE_SETUP -#line 463 "program_lexer.l" +#line 464 "program_lexer.l" { return DOT; } YY_BREAK case 179: /* rule 179 can match eol */ YY_RULE_SETUP -#line 465 "program_lexer.l" +#line 466 "program_lexer.l" { yylloc->first_line++; yylloc->first_column = 1; @@ -2358,7 +2359,7 @@ YY_RULE_SETUP YY_BREAK case 180: YY_RULE_SETUP -#line 472 "program_lexer.l" +#line 473 "program_lexer.l" /* eat whitespace */ ; YY_BREAK case 181: @@ -2366,20 +2367,20 @@ case 181: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 473 "program_lexer.l" +#line 474 "program_lexer.l" /* eat comments */ ; YY_BREAK case 182: YY_RULE_SETUP -#line 474 "program_lexer.l" +#line 475 "program_lexer.l" { return yytext[0]; } YY_BREAK case 183: YY_RULE_SETUP -#line 475 "program_lexer.l" +#line 476 "program_lexer.l" ECHO; YY_BREAK -#line 2383 "lex.yy.c" +#line 2384 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -3554,7 +3555,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 475 "program_lexer.l" +#line 476 "program_lexer.l" -- cgit v1.2.3 From f7285bdffcd8cca1c7d3066d38907a5987e844ea Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Tue, 29 Sep 2009 09:46:29 +0300 Subject: r600: clear position enable bit when when wpos is not used by FP Makes doom3 alot nicer.. --- src/mesa/drivers/dri/r600/r700_fragprog.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c index 78ce3ae436..62a1ea1a22 100644 --- a/src/mesa/drivers/dri/r600/r700_fragprog.c +++ b/src/mesa/drivers/dri/r600/r700_fragprog.c @@ -341,6 +341,11 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx) SETbit(r700->SPI_PS_IN_CONTROL_0.u32All, POSITION_ENA_bit); SETbit(r700->SPI_INPUT_Z.u32All, PROVIDE_Z_TO_SPI_bit); } + else + { + CLEARbit(r700->SPI_PS_IN_CONTROL_0.u32All, POSITION_ENA_bit); + CLEARbit(r700->SPI_INPUT_Z.u32All, PROVIDE_Z_TO_SPI_bit); + } ui = (unNumOfReg < ui) ? ui : unNumOfReg; -- cgit v1.2.3 From 5101215a64a69a212241eadba7f097cef33a0b5c Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Mon, 28 Sep 2009 10:42:35 +0300 Subject: r600: user correct alpha blend factor Signed-off-by: Dave Airlie --- src/mesa/drivers/dri/r600/r700_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index 98f116d0a6..0d1f906d84 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -467,10 +467,10 @@ static void r700SetBlendState(GLcontext * ctx) eqn, COLOR_COMB_FCN_shift, COLOR_COMB_FCN_mask); SETfield(blend_reg, - blend_factor(ctx->Color.BlendSrcRGB, GL_TRUE), + blend_factor(ctx->Color.BlendSrcA, GL_TRUE), ALPHA_SRCBLEND_shift, ALPHA_SRCBLEND_mask); SETfield(blend_reg, - blend_factor(ctx->Color.BlendDstRGB, GL_FALSE), + blend_factor(ctx->Color.BlendDstA, GL_FALSE), ALPHA_DESTBLEND_shift, ALPHA_DESTBLEND_mask); switch (ctx->Color.BlendEquationA) { -- cgit v1.2.3 From bf68e54a4d69bdd9a01656919d3cd752c96157b3 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Mon, 28 Sep 2009 11:23:49 +0300 Subject: r600: use CB_TARGET_MASK instead of CB_SHADER_MASK for setting color mask makes blend functions work better Signed-off-by: Dave Airlie --- src/mesa/drivers/dri/r600/r700_state.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index 0d1f906d84..244a016e07 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -745,9 +745,9 @@ static void r700ColorMask(GLcontext * ctx, (b ? 4 : 0) | (a ? 8 : 0)); - if (mask != r700->CB_SHADER_MASK.u32All) { + if (mask != r700->CB_TARGET_MASK.u32All) { R600_STATECHANGE(context, cb); - SETfield(r700->CB_SHADER_MASK.u32All, mask, OUTPUT0_ENABLE_shift, OUTPUT0_ENABLE_mask); + SETfield(r700->CB_TARGET_MASK.u32All, mask, TARGET0_ENABLE_shift, TARGET0_ENABLE_mask); } } @@ -1758,7 +1758,7 @@ void r700InitState(GLcontext * ctx) //------------------- r700->CB_CLRCMP_MSK.u32All = 0xFFFFFFFF; /* screen/window/view */ - SETfield(r700->CB_TARGET_MASK.u32All, 0xF, (4 * id), TARGET0_ENABLE_mask); + SETfield(r700->CB_SHADER_MASK.u32All, 0xF, (4 * id), OUTPUT0_ENABLE_mask); context->radeon.hw.all_dirty = GL_TRUE; -- cgit v1.2.3 From 95851d8cb232cbd1312d2b8de471ba2aeb276911 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Fri, 9 Oct 2009 10:46:12 +0300 Subject: r600: fixup KIL instruction a bit - KILLGT takes 2 arguments - arb KIL has no dst register - add TODO about clause ending but currently piglit fp-kil passes and does not hang the card --- src/mesa/drivers/dri/r600/r700_assembler.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 00eda544d4..e79c256c6b 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -336,7 +336,8 @@ unsigned int r700GetNumOperands(r700_AssemblerBase* pAsm) switch (pAsm->D.dst.opcode) { - case SQ_OP2_INST_ADD: + case SQ_OP2_INST_ADD: + case SQ_OP2_INST_KILLGT: case SQ_OP2_INST_MUL: case SQ_OP2_INST_MAX: case SQ_OP2_INST_MIN: @@ -356,7 +357,6 @@ unsigned int r700GetNumOperands(r700_AssemblerBase* pAsm) case SQ_OP2_INST_MOV: case SQ_OP2_INST_FRACT: case SQ_OP2_INST_FLOOR: - case SQ_OP2_INST_KILLGT: case SQ_OP2_INST_EXP_IEEE: case SQ_OP2_INST_LOG_CLAMPED: case SQ_OP2_INST_LOG_IEEE: @@ -2617,15 +2617,15 @@ GLboolean assemble_FRC(r700_AssemblerBase *pAsm) GLboolean assemble_KIL(r700_AssemblerBase *pAsm) { + /* TODO: doc says KILL has to be last(end) ALU clause */ + checkop1(pAsm); pAsm->D.dst.opcode = SQ_OP2_INST_KILLGT; - - if ( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = 0; pAsm->D.dst.writex = 0; pAsm->D.dst.writey = 0; pAsm->D.dst.writez = 0; @@ -2638,20 +2638,11 @@ GLboolean assemble_KIL(r700_AssemblerBase *pAsm) setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_0); noneg_PVSSRC(&(pAsm->S[0].src)); - pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; - - if(PROGRAM_TEMPORARY == pAsm->pILInst[pAsm->uiCurInst].DstReg.File) + if ( GL_FALSE == assemble_src(pAsm, 0, 1) ) { - pAsm->S[1].src.reg = pAsm->pILInst[pAsm->uiCurInst].DstReg.Index + pAsm->starting_temp_register_number; - } - else - { //PROGRAM_OUTPUT - pAsm->S[1].src.reg = pAsm->uiFP_OutputMap[pAsm->pILInst[pAsm->uiCurInst].DstReg.Index]; + return GL_FALSE; } - setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); - noswizzle_PVSSRC(&(pAsm->S[1].src)); - if ( GL_FALSE == next_ins(pAsm) ) { return GL_FALSE; -- cgit v1.2.3 From 74c31e5d05f7ed342fb143cb6f637b54e8961973 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Mon, 12 Oct 2009 12:20:26 +0300 Subject: r600: DPH adds w comp of second operand, so set first one to 1 instead --- src/mesa/drivers/dri/r600/r700_assembler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index e79c256c6b..1837712883 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -2508,7 +2508,7 @@ GLboolean assemble_DOT(r700_AssemblerBase *pAsm) } else if(pAsm->pILInst[pAsm->uiCurInst].Opcode == OPCODE_DPH) { - onecomp_PVSSRC(&(pAsm->S[1].src), 3); + onecomp_PVSSRC(&(pAsm->S[0].src), 3); } if ( GL_FALSE == next_ins(pAsm) ) -- cgit v1.2.3 From 606becc7f3513354548f587d84db731046616401 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Mon, 12 Oct 2009 12:58:40 +0300 Subject: r600: LIT dst.y gets value from src.x seems I overlooked this when removing hardcoded swizzles for this one previously --- src/mesa/drivers/dri/r600/r700_assembler.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 1837712883..25b27cd829 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -2899,6 +2899,7 @@ GLboolean assemble_LIT(r700_AssemblerBase *pAsm) pAsm->S[0].src.rtype = srcType; pAsm->S[0].src.reg = srcReg; setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X, SQ_SEL_X, SQ_SEL_X, SQ_SEL_X); pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; pAsm->S[1].src.reg = tmp; setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); -- cgit v1.2.3 From a3fec141017a39916d07000a3aa00eef3c9ac8a7 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Mon, 12 Oct 2009 14:57:45 +0300 Subject: r600: implement ProgramStringNotify need this to properly test with piglit/glean vert/fragprog tests copied mostly from r300, many thanks to osiris, nha, airlied, others... --- src/mesa/drivers/dri/r600/r700_oglprog.c | 55 ++++++++++++++++++++++---------- 1 file changed, 38 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_oglprog.c b/src/mesa/drivers/dri/r600/r700_oglprog.c index 5290ef31be..0d476fcd86 100644 --- a/src/mesa/drivers/dri/r600/r700_oglprog.c +++ b/src/mesa/drivers/dri/r600/r700_oglprog.c @@ -40,6 +40,24 @@ #include "r700_vertprog.h" +static void freeVertProgCache(GLcontext *ctx, struct r700_vertex_program_cont *cache) +{ + struct r700_vertex_program *tmp, *vp = cache->progs; + + while (vp) { + tmp = vp->next; + /* Release DMA region */ + r600DeleteShader(ctx, vp->shaderbo); + /* Clean up */ + Clean_Up_Assembler(&(vp->r700AsmCode)); + Clean_Up_Shader(&(vp->r700Shader)); + + _mesa_reference_vertprog(ctx, &vp->mesa_program, NULL); + _mesa_free(vp); + vp = tmp; + } +} + static struct gl_program *r700NewProgram(GLcontext * ctx, GLenum target, GLuint id) @@ -84,8 +102,7 @@ static struct gl_program *r700NewProgram(GLcontext * ctx, static void r700DeleteProgram(GLcontext * ctx, struct gl_program *prog) { - struct r700_vertex_program_cont * vpc; - struct r700_vertex_program *vp, *tmp; + struct r700_vertex_program_cont *vpc = (struct r700_vertex_program_cont *)prog; struct r700_fragment_program * fp; radeon_print(RADEON_SHADER, RADEON_VERBOSE, @@ -95,20 +112,7 @@ static void r700DeleteProgram(GLcontext * ctx, struct gl_program *prog) { case GL_VERTEX_STATE_PROGRAM_NV: case GL_VERTEX_PROGRAM_ARB: - vpc = (struct r700_vertex_program_cont*)prog; - vp = vpc->progs; - while (vp) { - tmp = vp->next; - /* Release DMA region */ - - r600DeleteShader(ctx, vp->shaderbo); - - /* Clean up */ - Clean_Up_Assembler(&(vp->r700AsmCode)); - Clean_Up_Shader(&(vp->r700Shader)); - _mesa_free(vp); - vp = tmp; - } + freeVertProgCache(ctx, vpc); break; case GL_FRAGMENT_PROGRAM_NV: case GL_FRAGMENT_PROGRAM_ARB: @@ -131,7 +135,24 @@ static void r700DeleteProgram(GLcontext * ctx, struct gl_program *prog) static void r700ProgramStringNotify(GLcontext * ctx, GLenum target, struct gl_program *prog) { - + struct r700_vertex_program_cont *vpc = (struct r700_vertex_program_cont *)prog; + struct r700_fragment_program * fp = (struct r700_fragment_program*)prog; + + switch (target) { + case GL_VERTEX_PROGRAM_ARB: + freeVertProgCache(ctx, vpc); + vpc->progs = NULL; + break; + case GL_FRAGMENT_PROGRAM_ARB: + r600DeleteShader(ctx, fp->shaderbo); + Clean_Up_Assembler(&(fp->r700AsmCode)); + Clean_Up_Shader(&(fp->r700Shader)); + fp->translated = GL_FALSE; + fp->loaded = GL_FALSE; + fp->shaderbo = NULL; + break; + } + } static GLboolean r700IsProgramNative(GLcontext * ctx, GLenum target, struct gl_program *prog) -- cgit v1.2.3 From 22a0029a68cf6a17e5d799c7d8eb8a699ccdeabb Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Thu, 15 Oct 2009 11:24:49 -0400 Subject: r600: fix tfp1 bo size Setting the wrong bo size resulting in an incomplete read cache flush when reading the texture. This fixes the compiz text corruption. [agd5f: take hw pitch alignment into account] --- src/mesa/drivers/dri/r600/r600_texstate.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c index bcb8d7c73d..61ff7e8158 100644 --- a/src/mesa/drivers/dri/r600/r600_texstate.c +++ b/src/mesa/drivers/dri/r600/r600_texstate.c @@ -721,7 +721,9 @@ void r600SetTexOffset(__DRIcontext * pDRICtx, GLint texname, struct gl_texture_object *tObj = _mesa_lookup_texture(rmesa->radeon.glCtx, texname); radeonTexObjPtr t = radeon_tex_obj(tObj); - uint32_t pitch_val, size; + int firstlevel = t->mt ? t->mt->firstLevel : 0; + const struct gl_texture_image *firstImage; + uint32_t pitch_val, size, row_align; if (!tObj) return; @@ -731,7 +733,9 @@ void r600SetTexOffset(__DRIcontext * pDRICtx, GLint texname, if (!offset) return; - size = pitch;//h * w * (depth / 8); + firstImage = t->base.Image[0][firstlevel]; + row_align = rmesa->radeon.texture_row_align - 1; + size = ((firstImage->Width * (depth / 8) + row_align) & ~row_align) * firstImage->Height; if (t->bo) { radeon_bo_unref(t->bo); t->bo = NULL; -- cgit v1.2.3 From e5d6450c2c85cc7d645cb0736194f41e5393802d Mon Sep 17 00:00:00 2001 From: Robert Noland Date: Wed, 14 Oct 2009 13:58:56 -0500 Subject: radeon: return EINVAL for 0 length buffers. Signed-off-by: Robert Noland --- src/mesa/drivers/dri/radeon/radeon_bo_legacy.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c index 3e7547d2f9..ce60a2f7ea 100644 --- a/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c +++ b/src/mesa/drivers/dri/radeon/radeon_bo_legacy.c @@ -710,6 +710,10 @@ int radeon_bo_legacy_validate(struct radeon_bo *bo, bo, bo->size, bo_legacy->map_count); return -EINVAL; } + if(bo->size == 0) { + fprintf(stderr, "bo(%p) has size 0.\n", bo); + return -EINVAL; + } if (bo_legacy->static_bo || bo_legacy->validated) { *soffset = bo_legacy->offset; *eoffset = bo_legacy->offset + bo->size; -- cgit v1.2.3 From a176b1c5d8b14601ec7e6ca9599c55fcc4797a7d Mon Sep 17 00:00:00 2001 From: Robert Noland Date: Wed, 14 Oct 2009 14:02:12 -0500 Subject: r600: cleanup in r600_cs_process_relocs(). Signed-off-by: Robert Noland --- src/mesa/drivers/dri/r600/r600_cmdbuf.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_cmdbuf.c b/src/mesa/drivers/dri/r600/r600_cmdbuf.c index 3cfe03a45f..d27a3245a3 100644 --- a/src/mesa/drivers/dri/r600/r600_cmdbuf.c +++ b/src/mesa/drivers/dri/r600/r600_cmdbuf.c @@ -254,7 +254,7 @@ static int r600_cs_process_relocs(struct radeon_cs *cs, relocs = (struct r600_cs_reloc_legacy *)cs->relocs; restart: for (i = 0; i < cs->crelocs; i++) { - uint32_t soffset, eoffset, asicoffset; + uint32_t soffset, eoffset; r = radeon_bo_legacy_validate(relocs[i].base.bo, &soffset, &eoffset); @@ -262,24 +262,12 @@ restart: goto restart; } if (r) { - fprintf(stderr, "validated %p [0x%08X, 0x%08X]\n", + fprintf(stderr, "invalid bo(%p) [0x%08X, 0x%08X]\n", relocs[i].base.bo, soffset, eoffset); return r; } - asicoffset = soffset; for (j = 0; j < relocs[i].cindices; j++) { - if (asicoffset >= eoffset) { - /* radeon_bo_debug(relocs[i].base.bo, 12); */ - fprintf(stderr, "validated %p [0x%08X, 0x%08X]\n", - relocs[i].base.bo, soffset, eoffset); - fprintf(stderr, "above end: %p 0x%08X 0x%08X\n", - relocs[i].base.bo, - cs->packets[relocs[i].indices[j]], - eoffset); - exit(0); - return -EINVAL; - } /* pkt3 nop header in ib chunk */ cs->packets[relocs[i].reloc_indices[j]] = 0xC0001000; /* reloc index in ib chunk */ @@ -287,7 +275,7 @@ restart: } /* asic offset in reloc chunk */ /* see alex drm r600_nomm_relocate */ - reloc_chunk[offset_dw] = asicoffset; + reloc_chunk[offset_dw] = soffset; reloc_chunk[offset_dw + 3] = 0; offset_dw += 4; -- cgit v1.2.3 From 16c6a3b71e6be04b6bb3d08fcb658194c5251fc7 Mon Sep 17 00:00:00 2001 From: Robert Noland Date: Wed, 14 Oct 2009 14:04:24 -0500 Subject: r600: FRAG_ATTRIB_WPOS and FRAG_ATTRIB_FOGC appear to be supported. Report unsupported attributes while I'm here. Signed-off-by: Robert Noland --- src/mesa/drivers/dri/r600/r700_assembler.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 25b27cd829..a683008746 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -1180,8 +1180,10 @@ GLboolean tex_src(r700_AssemblerBase *pAsm) case PROGRAM_INPUT: switch (pILInst->SrcReg[0].Index) { + case FRAG_ATTRIB_WPOS: case FRAG_ATTRIB_COL0: case FRAG_ATTRIB_COL1: + case FRAG_ATTRIB_FOGC: case FRAG_ATTRIB_TEX0: case FRAG_ATTRIB_TEX1: case FRAG_ATTRIB_TEX2: @@ -1194,7 +1196,16 @@ GLboolean tex_src(r700_AssemblerBase *pAsm) pAsm->S[0].src.reg = pAsm->uiFP_AttributeMap[pILInst->SrcReg[0].Index]; pAsm->S[0].src.rtype = SRC_REG_INPUT; - break; + break; + case FRAG_ATTRIB_FACE: + fprintf(stderr, "FRAG_ATTRIB_FACE unsupported\n"); + break; + case FRAG_ATTRIB_PNTC: + fprintf(stderr, "FRAG_ATTRIB_PNTC unsupported\n"); + break; + case FRAG_ATTRIB_VAR0: + fprintf(stderr, "FRAG_ATTRIB_VAR0 unsupported\n"); + break; } break; } -- cgit v1.2.3 From 3f30b0709b5a71915df336194f9f805e4c306cef Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Wed, 14 Oct 2009 16:20:07 -0400 Subject: Use the right pitch when rendering to a texture We need to get the pitch from the texture level we are rendering to, rather than just using the base texel width. --- src/mesa/drivers/dri/radeon/radeon_fbo.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index d83b166742..2012cbcf83 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -445,7 +445,6 @@ restart: goto restart; } - rrb->pitch = texImage->Width * rrb->cpp; rrb->base.InternalFormat = rrb->base._ActualFormat; rrb->base.Width = texImage->Width; rrb->base.Height = texImage->Height; @@ -555,8 +554,10 @@ radeon_render_texture(GLcontext * ctx, imageOffset += offsets[att->Zoffset]; } - /* store that offset in the region */ + /* store that offset in the region, along with the correct pitch for + * the image we are rendering to */ rrb->draw_offset = imageOffset; + rrb->pitch = radeon_image->mt->levels[att->TextureLevel].rowstride; /* update drawing region, etc */ radeon_draw_buffer(ctx, fb); -- cgit v1.2.3 From 2fc1614e7a56ab16df1b6ebbc159c58e8212d96d Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 1 Oct 2009 16:40:09 +0800 Subject: egl: Fix eglCheckConfigHandle. A stupid bug by me made the check void. Signed-off-by: Chia-I Wu --- src/egl/main/eglconfig.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c index 2c8d1c4055..31d69a7708 100644 --- a/src/egl/main/eglconfig.c +++ b/src/egl/main/eglconfig.c @@ -82,18 +82,17 @@ _eglAddConfig(_EGLDisplay *dpy, _EGLConfig *conf) EGLBoolean _eglCheckConfigHandle(EGLConfig config, _EGLDisplay *dpy) { - _EGLConfig *conf = NULL; + EGLint num_configs = (dpy) ? dpy->NumConfigs : 0; EGLint i; - for (i = 0; dpy && i < dpy->NumConfigs; i++) { - conf = dpy->Configs[i]; + for (i = 0; i < num_configs; i++) { + _EGLConfig *conf = dpy->Configs[i]; if (conf == (_EGLConfig *) config) { assert(conf->Display == dpy); break; } } - - return (conf != NULL); + return (i < num_configs); } -- cgit v1.2.3 From 29d115092e7b9e1436df3ce1fb7ffe183f8a9302 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 10 Oct 2009 14:39:43 +0800 Subject: egl: Fix GLX_USE_TLS build. Remove an extraneous semicolon. Signed-off-by: Chia-I Wu --- src/egl/main/eglcurrent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/egl/main/eglcurrent.c b/src/egl/main/eglcurrent.c index ca7a077168..df506151b5 100644 --- a/src/egl/main/eglcurrent.c +++ b/src/egl/main/eglcurrent.c @@ -16,7 +16,7 @@ static _EGLThreadInfo dummy_thread = _EGL_THREAD_INFO_INITIALIZER; #ifdef GLX_USE_TLS -static __thread const _EGLThreadInfo *_egl_TSD; +static __thread const _EGLThreadInfo *_egl_TSD __attribute__ ((tls_model("initial-exec"))); static INLINE void _eglSetTSD(const _EGLThreadInfo *t) -- cgit v1.2.3 From 8bb2485ed0e4764b8ad1f1a7f0bfe1c3f66d71bc Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 1 Oct 2009 18:32:19 +0800 Subject: egl: Include GL header in eglconfigutil.h. This is just a cosmetic change. Signed-off-by: Chia-I Wu --- src/egl/main/eglconfigutil.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/egl/main/eglconfigutil.h b/src/egl/main/eglconfigutil.h index ad85079890..8c923ee206 100644 --- a/src/egl/main/eglconfigutil.h +++ b/src/egl/main/eglconfigutil.h @@ -2,7 +2,7 @@ #define EGLCONFIGUTIL_INCLUDED -#include "GLES/gl.h" +#include "GL/gl.h" #include "GL/internal/glcore.h" #include "eglconfig.h" -- cgit v1.2.3 From 61906631202af855d0742586956ff9f34522a525 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 30 Sep 2009 15:34:45 +0800 Subject: egl: Rework error checking in eglGetCurrentSurface. Signed-off-by: Chia-I Wu --- src/egl/main/eglapi.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index d86ef9ce56..1512c0a14e 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -568,8 +568,26 @@ eglGetCurrentContext(void) EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw) { - _EGLSurface *s = _eglGetCurrentSurface(readdraw); - return _eglGetSurfaceHandle(s); + _EGLContext *ctx = _eglGetCurrentContext(); + _EGLSurface *surf; + + if (!ctx) + return EGL_NO_SURFACE; + + switch (readdraw) { + case EGL_DRAW: + surf = ctx->DrawSurface; + break; + case EGL_READ: + surf = ctx->ReadSurface; + break; + default: + _eglError(EGL_BAD_PARAMETER, __FUNCTION__); + surf = NULL; + break; + } + + return _eglGetSurfaceHandle(surf); } -- cgit v1.2.3 From aaa1253b09a6a38e7fcd695aa36e89b9d4bd8dfe Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 30 Sep 2009 15:08:34 +0800 Subject: egl: Update comments about eglapi.c. Mention that opaque handles are looked up and checked. Signed-off-by: Chia-I Wu --- src/egl/main/eglapi.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 1512c0a14e..1d370db471 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -9,12 +9,27 @@ * heterogeneous hardware devices in the future. * * The EGLDisplay, EGLConfig, EGLContext and EGLSurface types are - * opaque handles implemented with 32-bit unsigned integers. - * It's up to the driver function or fallback function to look up the - * handle and get an object. - * By using opaque handles, we leave open the possibility of having - * indirect rendering in the future, like GLX. + * opaque handles. Internal objects are linked to a display to + * create the handles. * + * For each public API entry point, the opaque handles are looked up + * before being dispatched to the drivers. When it fails to look up + * a handle, one of + * + * EGL_BAD_DISPLAY + * EGL_BAD_CONFIG + * EGL_BAD_CONTEXT + * EGL_BAD_SURFACE + * EGL_BAD_SCREEN_MESA + * EGL_BAD_MODE_MESA + * + * is generated and the driver function is not called. An + * uninitialized EGLDisplay has no driver associated with it. When + * such display is detected, + * + * EGL_NOT_INITIALIZED + * + * is generated. * * Notes on naming conventions: * -- cgit v1.2.3 From bbfd0e26151bef567c152c8018ecc15f04c70914 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 15 Oct 2009 11:08:33 +0800 Subject: egl: Rework error checking in eglSwapBuffers. Signed-off-by: Chia-I Wu --- src/egl/main/eglapi.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 1d370db471..366901889f 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -31,6 +31,15 @@ * * is generated. * + * Some of the entry points use current display, context, or surface + * implicitly. For such entry points, the implicit objects are also + * checked before calling the driver function. Other than the + * errors listed above, + * + * EGL_BAD_CURRENT_SURFACE + * + * may also be generated. + * * Notes on naming conventions: * * eglFooBar - public EGL function @@ -519,7 +528,13 @@ eglSwapInterval(EGLDisplay dpy, EGLint interval) EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) { + _EGLContext *ctx = _eglGetCurrentContext(); _EGL_DECLARE_DD_AND_SURFACE(dpy, surface); + + /* surface must be bound to current context in EGL 1.4 */ + if (!ctx || !_eglIsContextLinked(ctx) || surf != ctx->DrawSurface) + return _eglError(EGL_BAD_SURFACE, __FUNCTION__); + return drv->API.SwapBuffers(drv, disp, surf); } -- cgit v1.2.3 From 57da499d7ba074128e8c97b8076805e403a2b9c4 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 15 Oct 2009 11:08:48 +0800 Subject: egl: Rework eglSwapInterval. This adds error checking to eglSwapInterval and clamps the swap interval. Signed-off-by: Chia-I Wu --- src/egl/main/eglapi.c | 12 +++++++++++- src/egl/main/eglapi.h | 2 +- src/egl/main/eglsurface.c | 27 ++++++++++++++++++++++----- src/egl/main/eglsurface.h | 2 +- 4 files changed, 35 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 366901889f..5ce0469351 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -520,8 +520,18 @@ eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval) { + _EGLContext *ctx = _eglGetCurrentContext(); + _EGLSurface *surf; _EGL_DECLARE_DD(dpy); - return drv->API.SwapInterval(drv, disp, interval); + + if (!ctx || !_eglIsContextLinked(ctx) || ctx->Display != disp) + return _eglError(EGL_BAD_CONTEXT, __FUNCTION__); + + surf = ctx->DrawSurface; + if (!_eglIsSurfaceLinked(surf)) + return _eglError(EGL_BAD_SURFACE, __FUNCTION__); + + return drv->API.SwapInterval(drv, disp, surf, interval); } diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h index 6081e58892..feb35c863c 100644 --- a/src/egl/main/eglapi.h +++ b/src/egl/main/eglapi.h @@ -35,7 +35,7 @@ typedef EGLBoolean (*QuerySurface_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurf typedef EGLBoolean (*SurfaceAttrib_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint attribute, EGLint value); typedef EGLBoolean (*BindTexImage_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint buffer); typedef EGLBoolean (*ReleaseTexImage_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLint buffer); -typedef EGLBoolean (*SwapInterval_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLint interval); +typedef EGLBoolean (*SwapInterval_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint interval); typedef EGLBoolean (*SwapBuffers_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw); typedef EGLBoolean (*CopyBuffers_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, NativePixmapType target); diff --git a/src/egl/main/eglsurface.c b/src/egl/main/eglsurface.c index e7a1a8329e..940a1b760c 100644 --- a/src/egl/main/eglsurface.c +++ b/src/egl/main/eglsurface.c @@ -15,6 +15,22 @@ #include "eglsurface.h" +static void +_eglClampSwapInterval(_EGLSurface *surf, EGLint interval) +{ + EGLint bound = GET_CONFIG_ATTRIB(surf->Config, EGL_MAX_SWAP_INTERVAL); + if (interval >= bound) { + interval = bound; + } + else { + bound = GET_CONFIG_ATTRIB(surf->Config, EGL_MIN_SWAP_INTERVAL); + if (interval < bound) + interval = bound; + } + surf->SwapInterval = interval; +} + + /** * Do error check on parameters and initialize the given _EGLSurface object. * \return EGL_TRUE if no errors, EGL_FALSE otherwise. @@ -194,7 +210,9 @@ _eglInitSurface(_EGLDriver *drv, _EGLSurface *surf, EGLint type, surf->TextureTarget = texTarget; surf->MipmapTexture = mipmapTex; surf->MipmapLevel = 0; - surf->SwapInterval = 0; + /* the default swap interval is 1 */ + _eglClampSwapInterval(surf, 1); + #ifdef EGL_VERSION_1_2 surf->SwapBehavior = EGL_BUFFER_DESTROYED; /* XXX ok? */ surf->HorizontalResolution = EGL_UNKNOWN; /* set by caller */ @@ -466,11 +484,10 @@ _eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface, EGLBoolean -_eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, EGLint interval) +_eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, + EGLint interval) { - _EGLSurface *surf = _eglGetCurrentSurface(EGL_DRAW); - if (surf) - surf->SwapInterval = interval; + _eglClampSwapInterval(surf, interval); return EGL_TRUE; } diff --git a/src/egl/main/eglsurface.h b/src/egl/main/eglsurface.h index f6d44b5922..b75fa9c368 100644 --- a/src/egl/main/eglsurface.h +++ b/src/egl/main/eglsurface.h @@ -86,7 +86,7 @@ _eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint extern EGLBoolean -_eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, EGLint interval); +_eglSwapInterval(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surf, EGLint interval); #ifdef EGL_VERSION_1_2 -- cgit v1.2.3 From 6c21c8862bc6edc9cddf3b6eb6f276961099a7a8 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Mon, 28 Sep 2009 14:12:39 +0800 Subject: egl: Rework the synchronization primitives. This adds error checking to the synchronization primitives. And eglWaitGL is now implemented by eglWaitClient. Signed-off-by: Chia-I Wu --- src/egl/main/eglapi.c | 66 ++++++++++++++++++++++++++++++------------------ src/egl/main/eglapi.h | 6 ++--- src/egl/main/egldriver.c | 2 +- src/egl/main/eglmisc.c | 3 ++- src/egl/main/eglmisc.h | 2 +- 5 files changed, 48 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index 5ce0469351..14cc5fa613 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -558,32 +558,66 @@ eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, NativePixmapType target) EGLBoolean EGLAPIENTRY -eglWaitGL(void) +eglWaitClient(void) { - _EGLDisplay *disp = _eglGetCurrentDisplay(); + _EGLContext *ctx = _eglGetCurrentContext(); + _EGLDisplay *disp; _EGLDriver *drv; - if (!disp) + if (!ctx) return EGL_TRUE; + /* let bad current context imply bad current surface */ + if (!_eglIsContextLinked(ctx) || !_eglIsSurfaceLinked(ctx->DrawSurface)) + return _eglError(EGL_BAD_CURRENT_SURFACE, __FUNCTION__); - /* a current display is always initialized */ + /* a valid current context implies an initialized current display */ + disp = ctx->Display; drv = disp->Driver; + assert(drv); + + return drv->API.WaitClient(drv, disp, ctx); +} + - return drv->API.WaitGL(drv, disp); +EGLBoolean EGLAPIENTRY +eglWaitGL(void) +{ +#ifdef EGL_VERSION_1_2 + _EGLThreadInfo *t = _eglGetCurrentThread(); + EGLint api_index = t->CurrentAPIIndex; + EGLint es_index = _eglConvertApiToIndex(EGL_OPENGL_ES_API); + EGLBoolean ret; + + if (api_index != es_index && _eglIsCurrentThreadDummy()) + return _eglError(EGL_BAD_ALLOC, "eglWaitGL"); + + t->CurrentAPIIndex = es_index; + ret = eglWaitClient(); + t->CurrentAPIIndex = api_index; + return ret; +#else + return eglWaitClient(); +#endif } EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine) { - _EGLDisplay *disp = _eglGetCurrentDisplay(); + _EGLContext *ctx = _eglGetCurrentContext(); + _EGLDisplay *disp; _EGLDriver *drv; - if (!disp) + if (!ctx) return EGL_TRUE; + /* let bad current context imply bad current surface */ + if (!_eglIsContextLinked(ctx) || !_eglIsSurfaceLinked(ctx->DrawSurface)) + return _eglError(EGL_BAD_CURRENT_SURFACE, __FUNCTION__); - /* a current display is always initialized */ + /* a valid current context implies an initialized current display */ + disp = ctx->Display; drv = disp->Driver; + assert(drv); return drv->API.WaitNative(drv, disp, engine); } @@ -958,20 +992,4 @@ eglReleaseThread(void) } -EGLBoolean -eglWaitClient(void) -{ - _EGLDisplay *disp = _eglGetCurrentDisplay(); - _EGLDriver *drv; - - if (!disp) - return EGL_TRUE; - - /* a current display is always initialized */ - drv = disp->Driver; - - return drv->API.WaitClient(drv, disp); -} - - #endif /* EGL_VERSION_1_2 */ diff --git a/src/egl/main/eglapi.h b/src/egl/main/eglapi.h index feb35c863c..aa0abe3eb6 100644 --- a/src/egl/main/eglapi.h +++ b/src/egl/main/eglapi.h @@ -41,7 +41,7 @@ typedef EGLBoolean (*CopyBuffers_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurfa /* misc funcs */ typedef const char *(*QueryString_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLint name); -typedef EGLBoolean (*WaitGL_t)(_EGLDriver *drv, _EGLDisplay *dpy); +typedef EGLBoolean (*WaitClient_t)(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx); typedef EGLBoolean (*WaitNative_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLint engine); typedef _EGLProc (*GetProcAddress_t)(const char *procname); @@ -65,7 +65,6 @@ typedef const char * (*QueryModeStringMESA_t)(_EGLDriver *drv, _EGLDisplay *dpy, #ifdef EGL_VERSION_1_2 -typedef EGLBoolean (*WaitClient_t)(_EGLDriver *drv, _EGLDisplay *dpy); typedef _EGLSurface *(*CreatePbufferFromClientBuffer_t)(_EGLDriver *drv, _EGLDisplay *dpy, EGLenum buftype, EGLClientBuffer buffer, _EGLConfig *config, const EGLint *attrib_list); #endif /* EGL_VERSION_1_2 */ @@ -101,7 +100,7 @@ struct _egl_api CopyBuffers_t CopyBuffers; QueryString_t QueryString; - WaitGL_t WaitGL; + WaitClient_t WaitClient; WaitNative_t WaitNative; GetProcAddress_t GetProcAddress; @@ -120,7 +119,6 @@ struct _egl_api QueryModeStringMESA_t QueryModeStringMESA; #ifdef EGL_VERSION_1_2 - WaitClient_t WaitClient; CreatePbufferFromClientBuffer_t CreatePbufferFromClientBuffer; #endif }; diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c index 0c76c79973..018b06d3be 100644 --- a/src/egl/main/egldriver.c +++ b/src/egl/main/egldriver.c @@ -408,7 +408,7 @@ _eglInitDriverFallbacks(_EGLDriver *drv) drv->API.CopyBuffers = _eglCopyBuffers; drv->API.QueryString = _eglQueryString; - drv->API.WaitGL = _eglWaitGL; + drv->API.WaitClient = _eglWaitClient; drv->API.WaitNative = _eglWaitNative; #ifdef EGL_MESA_screen_surface diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c index b37213faf1..e66913320b 100644 --- a/src/egl/main/eglmisc.c +++ b/src/egl/main/eglmisc.c @@ -108,11 +108,12 @@ _eglQueryString(_EGLDriver *drv, _EGLDisplay *dpy, EGLint name) EGLBoolean -_eglWaitGL(_EGLDriver *drv, _EGLDisplay *dpy) +_eglWaitClient(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx) { /* just a placeholder */ (void) drv; (void) dpy; + (void) ctx; return EGL_TRUE; } diff --git a/src/egl/main/eglmisc.h b/src/egl/main/eglmisc.h index a15c839be2..829d4cde79 100644 --- a/src/egl/main/eglmisc.h +++ b/src/egl/main/eglmisc.h @@ -37,7 +37,7 @@ _eglQueryString(_EGLDriver *drv, _EGLDisplay *dpy, EGLint name); extern EGLBoolean -_eglWaitGL(_EGLDriver *drv, _EGLDisplay *dpy); +_eglWaitClient(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx); extern EGLBoolean -- cgit v1.2.3 From 108273c5ed43b2c54a58900b7bb4528f912e2b1f Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Sun, 11 Oct 2009 12:54:11 -0400 Subject: st/xorg: refix source over --- src/gallium/state_trackers/xorg/xorg_composite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index b07192175e..d6483fb72c 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -34,7 +34,7 @@ static const struct xorg_composite_blend xorg_blends[] = { PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_ONE }, { PictOpOver, - PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_ONE, + PIPE_BLENDFACTOR_SRC_ALPHA, PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_INV_SRC_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA }, { PictOpOverReverse, -- cgit v1.2.3 From 13580aa3d142b17f936e517daf949ae228f9f14e Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Thu, 15 Oct 2009 21:58:44 +0200 Subject: nouveau: nv30: refuse binding a colour buffer with a zeta buffer with different bits, till the backend can tell Mesa not to do that. --- src/gallium/drivers/nv30/nv30_state_fb.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nv30/nv30_state_fb.c b/src/gallium/drivers/nv30/nv30_state_fb.c index 2729dcec7c..9b0266fba5 100644 --- a/src/gallium/drivers/nv30/nv30_state_fb.c +++ b/src/gallium/drivers/nv30/nv30_state_fb.c @@ -15,6 +15,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) unsigned w = fb->width; unsigned h = fb->height; struct nv30_miptree *nv30mt; + int colour_bits = 32, zeta_bits = 32; rt_enable = 0; for (i = 0; i < fb->nr_cbufs; i++) { @@ -54,6 +55,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) break; case PIPE_FORMAT_R5G6B5_UNORM: rt_format |= NV34TCL_RT_FORMAT_COLOR_R5G6B5; + colour_bits = 16; break; default: assert(0); @@ -62,6 +64,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) switch (zeta_format) { case PIPE_FORMAT_Z16_UNORM: rt_format |= NV34TCL_RT_FORMAT_ZETA_Z16; + zeta_bits = 16; break; case PIPE_FORMAT_Z24S8_UNORM: case PIPE_FORMAT_Z24X8_UNORM: @@ -72,6 +75,10 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) assert(0); } + if (colour_bits != zeta_bits) { + return FALSE; + } + if (rt_enable & NV34TCL_RT_ENABLE_COLOR0) { uint32_t pitch = rt[0]->pitch; if (zeta) { -- cgit v1.2.3 From a5a05fd782bf7bc3843e475df7b12fe6784c1b9e Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Thu, 15 Oct 2009 22:41:09 +0200 Subject: nouveau: nv30: Hack to enforce same number of bits as front buffer, for render targets --- src/gallium/drivers/nv30/nv30_screen.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c index 41af38450b..5b1e5cab2d 100644 --- a/src/gallium/drivers/nv30/nv30_screen.c +++ b/src/gallium/drivers/nv30/nv30_screen.c @@ -10,6 +10,22 @@ #define NV34TCL_CHIPSET_3X_MASK 0x00000010 #define NV35TCL_CHIPSET_3X_MASK 0x000001e0 +/* FIXME: It seems I should not include directly ../../winsys/drm/nouveau/drm/nouveau_drm_api.h + * to get the pointer to the context front buffer, so I copied nouveau_winsys here. + * nv30_screen_surface_format_supported() can then use it to enforce creating fbo + * with same number of bits everywhere. + */ +struct nouveau_winsys { + struct pipe_winsys base; + + struct pipe_screen *pscreen; + + unsigned nr_pctx; + struct pipe_context **pctx; + + struct pipe_surface *front; +}; + static int nv30_screen_get_param(struct pipe_screen *pscreen, int param) { @@ -83,21 +99,19 @@ nv30_screen_surface_format_supported(struct pipe_screen *pscreen, enum pipe_texture_target target, unsigned tex_usage, unsigned geom_flags) { + struct pipe_surface *front = ((struct nouveau_winsys *) pscreen->winsys)->front; + if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) { - switch (format) { - case PIPE_FORMAT_A8R8G8B8_UNORM: - case PIPE_FORMAT_R5G6B5_UNORM: - return TRUE; - default: - break; - } + return (format == front->format); } else if (tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) { switch (format) { case PIPE_FORMAT_Z24S8_UNORM: case PIPE_FORMAT_Z24X8_UNORM: + return (front->format == PIPE_FORMAT_A8R8G8B8_UNORM) + || (front->format == PIPE_FORMAT_A8R8G8B8_UNORM); case PIPE_FORMAT_Z16_UNORM: - return TRUE; + return (front->format == PIPE_FORMAT_R5G6B5_UNORM); default: break; } -- cgit v1.2.3 From 9bf2aa33298db5af9128ad8f625321be47ab65c3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 15 Oct 2009 14:49:53 -0600 Subject: dri/common: fix broken _dri_texformat_* initializations --- src/mesa/drivers/dri/common/texmem.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/common/texmem.c b/src/mesa/drivers/dri/common/texmem.c index c9c3324ed9..e8880d9ae8 100644 --- a/src/mesa/drivers/dri/common/texmem.c +++ b/src/mesa/drivers/dri/common/texmem.c @@ -1312,10 +1312,10 @@ gl_format _dri_texformat_rgb565 = MESA_FORMAT_NONE; gl_format _dri_texformat_argb4444 = MESA_FORMAT_NONE; gl_format _dri_texformat_argb1555 = MESA_FORMAT_NONE; gl_format _dri_texformat_al88 = MESA_FORMAT_NONE; -gl_format _dri_texformat_a8 = MESA_FORMAT_NONE; -gl_format _dri_texformat_ci8 = MESA_FORMAT_NONE; -gl_format _dri_texformat_i8 = MESA_FORMAT_NONE; -gl_format _dri_texformat_l8 = MESA_FORMAT_NONE; +gl_format _dri_texformat_a8 = MESA_FORMAT_A8; +gl_format _dri_texformat_ci8 = MESA_FORMAT_CI8; +gl_format _dri_texformat_i8 = MESA_FORMAT_I8; +gl_format _dri_texformat_l8 = MESA_FORMAT_L8; /*@}*/ -- cgit v1.2.3 From a37c9ac8eee8c0d5b49f198f490828a794dc93c4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 15 Oct 2009 14:54:32 -0600 Subject: dri/common: use _mesa_little_endian() and update comments --- src/mesa/drivers/dri/common/texmem.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/common/texmem.c b/src/mesa/drivers/dri/common/texmem.c index e8880d9ae8..798c09f09f 100644 --- a/src/mesa/drivers/dri/common/texmem.c +++ b/src/mesa/drivers/dri/common/texmem.c @@ -1302,8 +1302,8 @@ driCalculateTextureFirstLastLevel( driTextureObject * t ) /** - * \name DRI texture formats. Pointers initialized to either the big- or - * little-endian Mesa formats. + * \name DRI texture formats. These vars are initialized to either the + * big- or little-endian Mesa formats. */ /*@{*/ gl_format _dri_texformat_rgba8888 = MESA_FORMAT_NONE; @@ -1320,15 +1320,13 @@ gl_format _dri_texformat_l8 = MESA_FORMAT_L8; /** - * Initialize little endian target, host byte order independent texture formats + * Initialize _dri_texformat_* vars according to whether we're on + * a big or little endian system. */ void driInitTextureFormats(void) { - const GLuint ui = 1; - const GLubyte littleEndian = *((const GLubyte *) &ui); - - if (littleEndian) { + if (_mesa_little_endian()) { _dri_texformat_rgba8888 = MESA_FORMAT_RGBA8888; _dri_texformat_argb8888 = MESA_FORMAT_ARGB8888; _dri_texformat_rgb565 = MESA_FORMAT_RGB565; -- cgit v1.2.3 From fa3046431a0da5990043fd4856602b0ba57ff9af Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 15 Oct 2009 14:57:45 -0600 Subject: dri/common: updated #includes --- src/mesa/drivers/dri/common/texmem.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/common/texmem.c b/src/mesa/drivers/dri/common/texmem.c index 798c09f09f..895139b55b 100644 --- a/src/mesa/drivers/dri/common/texmem.c +++ b/src/mesa/drivers/dri/common/texmem.c @@ -42,14 +42,10 @@ * application. */ -#include "texmem.h" -#include "main/simple_list.h" #include "main/imports.h" #include "main/macros.h" -#include "main/texformat.h" - -#include - +#include "main/simple_list.h" +#include "texmem.h" static unsigned dummy_swap_counter; -- cgit v1.2.3 From e4f21be13ac14edd89e865138a9e36b266425b39 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Thu, 15 Oct 2009 16:58:26 -0700 Subject: r300g: Set logical ID for each emitted texture/sampler. multitexarray works on my r300, but texrect doesn't. --- src/gallium/drivers/r300/r300_emit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 2c3bba952d..f3adc0968e 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -531,7 +531,8 @@ void r300_emit_texture(struct r300_context* r300, CS_LOCALS(r300); BEGIN_CS(16); - OUT_CS_REG(R300_TX_FILTER0_0 + (offset * 4), sampler->filter0); + OUT_CS_REG(R300_TX_FILTER0_0 + (offset * 4), sampler->filter0 | + (offset << 28)); OUT_CS_REG(R300_TX_FILTER1_0 + (offset * 4), sampler->filter1); OUT_CS_REG(R300_TX_BORDER_COLOR_0 + (offset * 4), sampler->border_color); -- cgit v1.2.3 From 89b31c9619449d5c9b8ebe4e245c2a926e3583e6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 14 Oct 2009 14:19:03 -0600 Subject: mesa: use C locale for _mesa_strtod() _mesa_strtod() is used for shader/program parsing where the decimal point character is always '.' Use strtod_l() with a "C" locale to ensure correct string->double conversion when the actual locale uses another character such as ',' for the decimal point. Fixes bug 24531. --- src/mesa/main/imports.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 6ffaddcde9..87cb5ce0fb 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -48,6 +48,10 @@ #include "context.h" #include "version.h" +#ifdef _GNU_SOURCE +#include +#endif + #define MAXSTRING 4000 /* for vsnprintf() */ @@ -908,7 +912,15 @@ _mesa_atoi(const char *s) double _mesa_strtod( const char *s, char **end ) { +#ifdef _GNU_SOURCE + static locale_t loc = NULL; + if (!loc) { + loc = newlocale(LC_CTYPE_MASK, "C", NULL); + } + return strtod_l(s, end, loc); +#else return strtod(s, end); +#endif } /** Compute simple checksum/hash for a string */ -- cgit v1.2.3 From 3924d8611513eea74446d655b554596ab66381ff Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 16 Oct 2009 08:27:56 -0700 Subject: util: Change function names to begin with u_. Avoids link-time clashes with Mesa's internal hash table. --- src/gallium/auxiliary/util/u_hash_table.c | 41 ++++++++++++++++--------------- src/gallium/auxiliary/util/u_hash_table.h | 33 +++++++++++++------------ 2 files changed, 38 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_hash_table.c b/src/gallium/auxiliary/util/u_hash_table.c index 8c2a8f454c..de711f9c1d 100644 --- a/src/gallium/auxiliary/util/u_hash_table.c +++ b/src/gallium/auxiliary/util/u_hash_table.c @@ -47,7 +47,7 @@ #include "util/u_hash_table.h" -struct hash_table +struct u_hash_table { struct cso_hash *cso; @@ -75,13 +75,13 @@ hash_table_item(struct cso_hash_iter iter) } -struct hash_table * -hash_table_create(unsigned (*hash)(void *key), - int (*compare)(void *key1, void *key2)) +struct u_hash_table * +u_hash_table_create(unsigned (*hash)(void *key), + int (*compare)(void *key1, void *key2)) { - struct hash_table *ht; + struct u_hash_table *ht; - ht = MALLOC_STRUCT(hash_table); + ht = MALLOC_STRUCT(u_hash_table); if(!ht) return NULL; @@ -99,7 +99,7 @@ hash_table_create(unsigned (*hash)(void *key), static INLINE struct cso_hash_iter -hash_table_find_iter(struct hash_table *ht, +hash_table_find_iter(struct u_hash_table *ht, void *key, unsigned key_hash) { @@ -119,7 +119,7 @@ hash_table_find_iter(struct hash_table *ht, static INLINE struct hash_table_item * -hash_table_find_item(struct hash_table *ht, +hash_table_find_item(struct u_hash_table *ht, void *key, unsigned key_hash) { @@ -139,9 +139,9 @@ hash_table_find_item(struct hash_table *ht, enum pipe_error -hash_table_set(struct hash_table *ht, - void *key, - void *value) +u_hash_table_set(struct u_hash_table *ht, + void *key, + void *value) { unsigned key_hash; struct hash_table_item *item; @@ -178,8 +178,8 @@ hash_table_set(struct hash_table *ht, void * -hash_table_get(struct hash_table *ht, - void *key) +u_hash_table_get(struct u_hash_table *ht, + void *key) { unsigned key_hash; struct hash_table_item *item; @@ -199,8 +199,8 @@ hash_table_get(struct hash_table *ht, void -hash_table_remove(struct hash_table *ht, - void *key) +u_hash_table_remove(struct u_hash_table *ht, + void *key) { unsigned key_hash; struct cso_hash_iter iter; @@ -225,7 +225,7 @@ hash_table_remove(struct hash_table *ht, void -hash_table_clear(struct hash_table *ht) +u_hash_table_clear(struct u_hash_table *ht) { struct cso_hash_iter iter; struct hash_table_item *item; @@ -244,9 +244,10 @@ hash_table_clear(struct hash_table *ht) enum pipe_error -hash_table_foreach(struct hash_table *ht, - enum pipe_error (*callback)(void *key, void *value, void *data), - void *data) +u_hash_table_foreach(struct u_hash_table *ht, + enum pipe_error (*callback) + (void *key, void *value, void *data), + void *data) { struct cso_hash_iter iter; struct hash_table_item *item; @@ -270,7 +271,7 @@ hash_table_foreach(struct hash_table *ht, void -hash_table_destroy(struct hash_table *ht) +u_hash_table_destroy(struct u_hash_table *ht) { struct cso_hash_iter iter; struct hash_table_item *item; diff --git a/src/gallium/auxiliary/util/u_hash_table.h b/src/gallium/auxiliary/util/u_hash_table.h index feee881582..feb47365f0 100644 --- a/src/gallium/auxiliary/util/u_hash_table.h +++ b/src/gallium/auxiliary/util/u_hash_table.h @@ -46,7 +46,7 @@ extern "C" { /** * Generic purpose hash table. */ -struct hash_table; +struct u_hash_table; /** @@ -55,37 +55,38 @@ struct hash_table; * @param hash hash function * @param compare should return 0 for two equal keys. */ -struct hash_table * -hash_table_create(unsigned (*hash)(void *key), - int (*compare)(void *key1, void *key2)); +struct u_hash_table * +u_hash_table_create(unsigned (*hash)(void *key), + int (*compare)(void *key1, void *key2)); enum pipe_error -hash_table_set(struct hash_table *ht, - void *key, - void *value); +u_hash_table_set(struct u_hash_table *ht, + void *key, + void *value); void * -hash_table_get(struct hash_table *ht, - void *key); +u_hash_table_get(struct u_hash_table *ht, + void *key); void -hash_table_remove(struct hash_table *ht, - void *key); +u_hash_table_remove(struct u_hash_table *ht, + void *key); void -hash_table_clear(struct hash_table *ht); +u_hash_table_clear(struct u_hash_table *ht); enum pipe_error -hash_table_foreach(struct hash_table *ht, - enum pipe_error (*callback)(void *key, void *value, void *data), - void *data); +u_hash_table_foreach(struct u_hash_table *ht, + enum pipe_error (*callback) + (void *key, void *value, void *data), + void *data); void -hash_table_destroy(struct hash_table *ht); +u_hash_table_destroy(struct u_hash_table *ht); #ifdef __cplusplus -- cgit v1.2.3 From fc8a156cfc539b9c04dc3527e4fc61cb4b0b688e Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 16 Oct 2009 08:39:59 -0700 Subject: r300g: Use a hash table to look up vertex info. Need to move rs_block to this, too. Also, I'm getting massive amounts of flicker for some reason; I bet we've gotta re-re-examine PSC and friends. :C --- src/gallium/drivers/r300/r300_context.c | 18 ++++++- src/gallium/drivers/r300/r300_context.h | 10 +++- src/gallium/drivers/r300/r300_emit.c | 26 +++++----- src/gallium/drivers/r300/r300_render.c | 2 +- src/gallium/drivers/r300/r300_state_derived.c | 72 ++++++++++++++++++++------- src/gallium/drivers/r300/r300_state_derived.h | 4 ++ 6 files changed, 97 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index b243f88bb5..a1156d2de6 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -89,10 +89,23 @@ static boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode, return r300_draw_elements(pipe, NULL, 0, mode, start, count); } -static void r300_destroy_context(struct pipe_context* context) { +static enum pipe_error r300_clear_hash_table(void* key, void* value, + void* data) +{ + FREE(key); + FREE(value); + return PIPE_OK; +} + +static void r300_destroy_context(struct pipe_context* context) +{ struct r300_context* r300 = r300_context(context); struct r300_query* query, * temp; + u_hash_table_foreach(r300->shader_hash_table, r300_clear_hash_table, + NULL); + u_hash_table_destroy(r300->shader_hash_table); + draw_destroy(r300->draw); /* Free the OQ BO. */ @@ -167,6 +180,9 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->context.is_texture_referenced = r300_is_texture_referenced; r300->context.is_buffer_referenced = r300_is_buffer_referenced; + r300->shader_hash_table = u_hash_table_create(r300_shader_key_hash, + r300_shader_key_compare); + r300->blend_color_state = CALLOC_STRUCT(r300_blend_color_state); r300->rs_block = CALLOC_STRUCT(r300_rs_block); r300->scissor_state = CALLOC_STRUCT(r300_scissor_state); diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 2acce0fd4a..2a62c67fc7 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -30,12 +30,14 @@ #include "tgsi/tgsi_scan.h" +#include "util/u_hash_table.h" #include "util/u_memory.h" #include "util/u_simple_list.h" #include "r300_clear.h" #include "r300_query.h" #include "r300_screen.h" +#include "r300_state_derived.h" #include "r300_winsys.h" struct r300_fragment_shader; @@ -248,6 +250,12 @@ struct r300_context { struct r300_query *query_current; struct r300_query query_list; + /* Shader hash table. Used to store vertex formatting information, which + * depends on the combination of both currently loaded shaders. */ + struct u_hash_table* shader_hash_table; + /* Vertex formatting information. */ + struct r300_vertex_format* vertex_info; + /* Various CSO state objects. */ /* Blend state. */ struct r300_blend_state* blend_state; @@ -278,8 +286,6 @@ struct r300_context { /* Vertex buffers for Gallium. */ struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS]; int vertex_buffer_count; - /* Vertex information. */ - struct r300_vertex_format vertex_info; /* Vertex shader. */ struct r300_vertex_shader* vs; /* Viewport state. */ diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index f3adc0968e..e6092cda9b 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -551,7 +551,7 @@ void r300_emit_vertex_buffer(struct r300_context* r300) DBG(r300, DBG_DRAW, "r300: Preparing vertex buffer %p for render, " "vertex size %d\n", r300->vbo, - r300->vertex_info.vinfo.size); + r300->vertex_info->vinfo.size); /* Set the pointer to our vertex buffer. The emitted values are this: * PACKET3 [3D_LOAD_VBPNTR] * COUNT [1] @@ -562,8 +562,8 @@ void r300_emit_vertex_buffer(struct r300_context* r300) 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(r300->vertex_info->vinfo.size | + (r300->vertex_info->vinfo.size << 8)); OUT_CS(r300->vbo_offset); OUT_CS_RELOC(r300->vbo, 0, RADEON_GEM_DOMAIN_GTT, 0, 0); END_CS; @@ -575,30 +575,30 @@ void r300_emit_vertex_format_state(struct r300_context* r300) CS_LOCALS(r300); BEGIN_CS(26); - OUT_CS_REG(R300_VAP_VTX_SIZE, r300->vertex_info.vinfo.size); + OUT_CS_REG(R300_VAP_VTX_SIZE, r300->vertex_info->vinfo.size); OUT_CS_REG_SEQ(R300_VAP_VTX_STATE_CNTL, 2); - OUT_CS(r300->vertex_info.vinfo.hwfmt[0]); - OUT_CS(r300->vertex_info.vinfo.hwfmt[1]); + OUT_CS(r300->vertex_info->vinfo.hwfmt[0]); + OUT_CS(r300->vertex_info->vinfo.hwfmt[1]); OUT_CS_REG_SEQ(R300_VAP_OUTPUT_VTX_FMT_0, 2); - OUT_CS(r300->vertex_info.vinfo.hwfmt[2]); - OUT_CS(r300->vertex_info.vinfo.hwfmt[3]); + OUT_CS(r300->vertex_info->vinfo.hwfmt[2]); + OUT_CS(r300->vertex_info->vinfo.hwfmt[3]); /* for (i = 0; i < 4; i++) { * debug_printf("hwfmt%d: 0x%08x\n", i, - * r300->vertex_info.vinfo.hwfmt[i]); + * r300->vertex_info->vinfo.hwfmt[i]); * } */ OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_0, 8); for (i = 0; i < 8; i++) { - OUT_CS(r300->vertex_info.vap_prog_stream_cntl[i]); + OUT_CS(r300->vertex_info->vap_prog_stream_cntl[i]); /* debug_printf("prog_stream_cntl%d: 0x%08x\n", i, - * r300->vertex_info.vap_prog_stream_cntl[i]); */ + * r300->vertex_info->vap_prog_stream_cntl[i]); */ } OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_EXT_0, 8); for (i = 0; i < 8; i++) { - OUT_CS(r300->vertex_info.vap_prog_stream_cntl_ext[i]); + OUT_CS(r300->vertex_info->vap_prog_stream_cntl_ext[i]); /* debug_printf("prog_stream_cntl_ext%d: 0x%08x\n", i, - * r300->vertex_info.vap_prog_stream_cntl_ext[i]); */ + * r300->vertex_info->vap_prog_stream_cntl_ext[i]); */ } END_CS; } diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index b56f7a3d1e..4e778e1e57 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -67,7 +67,7 @@ r300_render_get_vertex_info(struct vbuf_render* render) r300_update_derived_state(r300); - return &r300->vertex_info.vinfo; + return &r300->vertex_info->vinfo; } static boolean r300_render_allocate_vertices(struct vbuf_render* render, diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index f0861a9cf1..53027777d6 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -29,6 +29,27 @@ /* r300_state_derived: Various bits of state which are dependent upon * currently bound CSO data. */ +struct r300_shader_key { + struct r300_vertex_shader* vs; + struct r300_fragment_shader* fs; +}; + +unsigned r300_shader_key_hash(void* key) { + struct r300_shader_key* shader_key = (struct r300_shader_key*)key; + unsigned vs = (unsigned)shader_key->vs; + unsigned fs = (unsigned)shader_key->fs; + + return (vs << 16) | (fs & 0xffff); +} + +int r300_shader_key_compare(void* key1, void* key2) { + struct r300_shader_key* shader_key1 = (struct r300_shader_key*)key1; + struct r300_shader_key* shader_key2 = (struct r300_shader_key*)key2; + + return (shader_key1->vs == shader_key2->vs) && + (shader_key1->fs == shader_key2->fs); +} + /* Set up the vs_tab and routes. */ static void r300_vs_tab_routes(struct r300_context* r300, struct r300_vertex_format* vformat) @@ -247,23 +268,41 @@ static void r300_vertex_psc(struct r300_context* r300, /* Update the vertex format. */ static void r300_update_vertex_format(struct r300_context* r300) { - struct r300_vertex_format vformat; + struct r300_shader_key* key; + struct r300_vertex_format* vformat; + void* value; int i; - memset(&vformat, 0, sizeof(struct r300_vertex_format)); - for (i = 0; i < 16; i++) { - vformat.vs_tab[i] = -1; - vformat.fs_tab[i] = -1; - } + key = CALLOC_STRUCT(r300_shader_key); + key->vs = r300->vs; + key->fs = r300->fs; - r300_vs_tab_routes(r300, &vformat); + value = u_hash_table_get(r300->shader_hash_table, (void*)key); + if (value) { + debug_printf("r300: Hash table hit! vs: %p fs: %p\n", key->vs, + key->fs); + vformat = (struct r300_vertex_format*)value; + } else { + debug_printf("r300: Hash table miss... vs: %p fs: %p\n", key->vs, + key->fs); + vformat = CALLOC_STRUCT(r300_vertex_format); + + for (i = 0; i < 16; i++) { + vformat->vs_tab[i] = -1; + vformat->fs_tab[i] = -1; + } + + r300_vs_tab_routes(r300, vformat); + r300_vertex_psc(r300, vformat); - r300_vertex_psc(r300, &vformat); + if (u_hash_table_set(r300->shader_hash_table, (void*)key, + (void*)vformat) != PIPE_OK) { + debug_printf("r300: Hash table insertion error!\n"); + } + } - if (memcmp(&r300->vertex_info, &vformat, - sizeof(struct r300_vertex_format))) { - memcpy(&r300->vertex_info, &vformat, - sizeof(struct r300_vertex_format)); + if (r300->vertex_info != vformat) { + r300->vertex_info = vformat; r300->dirty_state |= R300_NEW_VERTEX_FORMAT; } } @@ -271,7 +310,7 @@ static void r300_update_vertex_format(struct r300_context* r300) /* Set up the mappings from GB to US, for RS block. */ static void r300_update_fs_tab(struct r300_context* r300) { - struct r300_vertex_format* vformat = &r300->vertex_info; + struct r300_vertex_format* vformat = r300->vertex_info; struct tgsi_shader_info* info = &r300->fs->info; int i, cols = 0, texs = 0, cols_emitted = 0; int* tab = vformat->fs_tab; @@ -337,7 +376,7 @@ static void r300_update_rs_block(struct r300_context* r300) { struct r300_rs_block* rs = r300->rs_block; struct tgsi_shader_info* info = &r300->fs->info; - int* tab = r300->vertex_info.fs_tab; + int* tab = r300->vertex_info->fs_tab; int col_count = 0, fp_offset = 0, i, tex_count = 0; int rs_tex_comp = 0; memset(rs, 0, sizeof(struct r300_rs_block)); @@ -477,10 +516,7 @@ static void r300_update_ztop(struct r300_context* r300) void r300_update_derived_state(struct r300_context* r300) { - if (r300->dirty_state & - (R300_NEW_FRAGMENT_SHADER | R300_NEW_VERTEX_SHADER)) { - r300_update_vertex_format(r300); - } + r300_update_vertex_format(r300); if (r300->dirty_state & R300_NEW_VERTEX_FORMAT) { r300_update_fs_tab(r300); diff --git a/src/gallium/drivers/r300/r300_state_derived.h b/src/gallium/drivers/r300/r300_state_derived.h index 71a4a47b00..05ad535e2d 100644 --- a/src/gallium/drivers/r300/r300_state_derived.h +++ b/src/gallium/drivers/r300/r300_state_derived.h @@ -25,6 +25,10 @@ struct r300_context; +unsigned r300_shader_key_hash(void* key); + +int r300_shader_key_compare(void* key1, void* key2); + void r300_update_derived_state(struct r300_context* r300); #endif /* R300_STATE_DERIVED_H */ -- cgit v1.2.3 From 3e56bef5a5f56feb65ae94a51e5db9cf943ce0ce Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 16 Oct 2009 09:45:07 -0700 Subject: radeon-gallium: Use debug_get_bool_option instead of getenv. --- src/gallium/winsys/drm/radeon/core/radeon_drm.c | 4 ++-- src/gallium/winsys/drm/radeon/core/radeon_drm.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c index caab33de1c..69f14e54f2 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c @@ -38,7 +38,7 @@ struct pipe_screen* radeon_create_screen(struct drm_api* api, { struct radeon_winsys* winsys = radeon_pipe_winsys(drmFB); - if (getenv("RADEON_SOFTPIPE")) { + if (debug_get_bool_option("RADEON_SOFTPIPE", FALSE)) { return softpipe_create_screen((struct pipe_winsys*)winsys); } else { struct r300_winsys* r300 = radeon_create_r300_winsys(drmFB, winsys); @@ -51,7 +51,7 @@ struct pipe_screen* radeon_create_screen(struct drm_api* api, struct pipe_context* radeon_create_context(struct drm_api* api, struct pipe_screen* screen) { - if (getenv("RADEON_SOFTPIPE")) { + if (debug_get_bool_option("RADEON_SOFTPIPE", FALSE)) { return radeon_create_softpipe(screen->winsys); } else { return r300_create_context(screen, diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.h b/src/gallium/winsys/drm/radeon/core/radeon_drm.h index 88a5c82b28..9a789ec1a4 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_drm.h +++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.h @@ -37,6 +37,7 @@ #include "pipe/p_screen.h" #include "trace/tr_drm.h" +#include "util/u_debug.h" #include "util/u_memory.h" #include "state_tracker/drm_api.h" -- cgit v1.2.3 From 3594b53c0173ac810106f667604bf94b5cfc4a1e Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Fri, 16 Oct 2009 20:21:17 +0200 Subject: r300: fix vertex program parameters limits --- src/mesa/drivers/dri/r300/r300_vertprog.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_vertprog.c b/src/mesa/drivers/dri/r300/r300_vertprog.c index 2f7b67c143..ed8b788108 100644 --- a/src/mesa/drivers/dri/r300/r300_vertprog.c +++ b/src/mesa/drivers/dri/r300/r300_vertprog.c @@ -62,12 +62,6 @@ static int r300VertexProgUpdateParams(GLcontext * ctx, struct r300_vertex_progra } } - if (vp->code.constants.Count * 4 > VSF_MAX_FRAGMENT_LENGTH) { - /* Should have checked this earlier... */ - fprintf(stderr, "%s:Params exhausted\n", __FUNCTION__); - _mesa_exit(-1); - } - for(i = 0; i < vp->code.constants.Count; ++i) { const float * src = 0; const struct rc_constant * constant = &vp->code.constants.Constants[i]; @@ -281,6 +275,11 @@ static struct r300_vertex_program *build_program(GLcontext *ctx, } r3xx_compile_vertex_program(&compiler); + + if (vp->code.constants.Count > ctx->Const.VertexProgram.MaxParameters) { + rc_error(&compiler.Base, "Program exceeds constant buffer size limit\n"); + } + vp->error = compiler.Base.Error; vp->Base->Base.InputsRead = vp->code.InputsRead; @@ -334,7 +333,6 @@ struct r300_vertex_program * r300SelectAndTranslateVertexShader(GLcontext *ctx) #define bump_vpu_count(ptr, new_count) do { \ drm_r300_cmd_header_t* _p=((drm_r300_cmd_header_t*)(ptr)); \ int _nc=(new_count)/4; \ - assert(_nc < 256); \ if(_nc>_p->vpu.count)_p->vpu.count=_nc; \ } while(0) -- cgit v1.2.3 From 2ee7fd8d584abf051c552f455aeb588e2936b0ea Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 15 Oct 2009 15:25:52 -0600 Subject: mesa: added MESA_GLSL=useprog debug flag This logs glUseProgram() calls to stderr. --- src/mesa/main/mtypes.h | 1 + src/mesa/shader/shader_api.c | 27 +++++++++++++++++++++------ 2 files changed, 22 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 988bfe1e22..b77dcdb730 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2046,6 +2046,7 @@ struct gl_shader_program #define GLSL_UNIFORMS 0x10 /**< Print glUniform calls */ #define GLSL_NOP_VERT 0x20 /**< Force no-op vertex shaders */ #define GLSL_NOP_FRAG 0x40 /**< Force no-op fragment shaders */ +#define GLSL_USE_PROG 0x80 /**< Log glUseProgram calls */ /** diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 6de97984e6..f473bd1173 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -390,6 +390,8 @@ get_shader_flags(void) flags |= GLSL_OPT; if (_mesa_strstr(env, "uniform")) flags |= GLSL_UNIFORMS; + if (_mesa_strstr(env, "useprog")) + flags |= GLSL_USE_PROG; } return flags; @@ -1524,19 +1526,32 @@ _mesa_use_program(GLcontext *ctx, GLuint program) } /* debug code */ - if (0) { + if (ctx->Shader.Flags & GLSL_USE_PROG) { GLuint i; - _mesa_printf("Use Shader Program %u\n", shProg->Name); + _mesa_printf("Mesa: glUseProgram(%u)\n", shProg->Name); for (i = 0; i < shProg->NumShaders; i++) { - _mesa_printf(" shader %u, type 0x%x, checksum %u\n", + const char *s; + switch (shProg->Shaders[i]->Type) { + case GL_VERTEX_SHADER: + s = "vertex"; + break; + case GL_FRAGMENT_SHADER: + s = "fragment"; + break; + case GL_GEOMETRY_SHADER: + s = "geometry"; + break; + default: + s = ""; + } + _mesa_printf(" %s shader %u, checksum %u\n", s, shProg->Shaders[i]->Name, - shProg->Shaders[i]->Type, shProg->Shaders[i]->SourceChecksum); } if (shProg->VertexProgram) - printf(" vert prog %u\n", shProg->VertexProgram->Base.Id); + _mesa_printf(" vert prog %u\n", shProg->VertexProgram->Base.Id); if (shProg->FragmentProgram) - printf(" frag prog %u\n", shProg->FragmentProgram->Base.Id); + _mesa_printf(" frag prog %u\n", shProg->FragmentProgram->Base.Id); } } else { -- cgit v1.2.3 From f0503726bf8113919e4b00fbca504d7cbdcd0151 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 16 Oct 2009 08:12:47 -0600 Subject: mesa: move a comma --- src/mesa/main/mtypes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index b77dcdb730..ea3b552b9d 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -208,7 +208,7 @@ typedef enum VERT_RESULT_BFC0 = 13, VERT_RESULT_BFC1 = 14, VERT_RESULT_EDGE = 15, - VERT_RESULT_VAR0 = 16 /**< shader varying */, + VERT_RESULT_VAR0 = 16, /**< shader varying */ VERT_RESULT_MAX = (VERT_RESULT_VAR0 + MAX_VARYING) } gl_vert_result; -- cgit v1.2.3 From d9fd207133ba2ff8cd0bbcab6963c70d71628b1b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 16 Oct 2009 09:21:45 -0600 Subject: mesa: added SUBDIRS support in dri/Makefile.template --- src/mesa/drivers/dri/Makefile.template | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/Makefile.template b/src/mesa/drivers/dri/Makefile.template index 18dbeba24a..defead6c6b 100644 --- a/src/mesa/drivers/dri/Makefile.template +++ b/src/mesa/drivers/dri/Makefile.template @@ -60,7 +60,7 @@ SHARED_INCLUDES = \ ##### TARGETS ##### -default: symlinks depend $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME) +default: symlinks subdirs depend $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME) $(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template @@ -72,6 +72,18 @@ $(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME) $(INSTALL) $(LIBNAME) $(TOP)/$(LIB_DIR) +# If the Makefile defined SUBDIRS, run make in each +.PHONY: subdirs +subdirs: + @if test -n "$(SUBDIRS)" ; then \ + for dir in $(SUBDIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE)) || exit 1; \ + fi \ + done \ + fi + + depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS) @ echo "running $(MKDEP)" @ rm -f depend -- cgit v1.2.3 From db2046580f3b5be0e9fe30337f3bf412c4556ed9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 16 Oct 2009 09:25:05 -0600 Subject: mesa: use EXTRA_MODULES and SUBDIRS to build r300 compiler This is a bit cleaner and avoids rebuilding the r300_dri.so library all the time. --- src/mesa/drivers/dri/Makefile.template | 6 ++++-- src/mesa/drivers/dri/r300/Makefile | 10 ++++------ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/Makefile.template b/src/mesa/drivers/dri/Makefile.template index defead6c6b..d2731aebae 100644 --- a/src/mesa/drivers/dri/Makefile.template +++ b/src/mesa/drivers/dri/Makefile.template @@ -63,9 +63,11 @@ SHARED_INCLUDES = \ default: symlinks subdirs depend $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME) -$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(PIPE_DRIVERS) $(WINOBJ) Makefile $(TOP)/src/mesa/drivers/dri/Makefile.template +$(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) $(WINOBJ) Makefile \ + $(TOP)/src/mesa/drivers/dri/Makefile.template $(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \ - $(OBJECTS) $(PIPE_DRIVERS) $(MESA_MODULES) $(WINOBJ) $(DRI_LIB_DEPS) + $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) $(WINOBJ) \ + $(DRI_LIB_DEPS) $(TOP)/$(LIB_DIR)/$(LIBNAME): $(LIBNAME) diff --git a/src/mesa/drivers/dri/r300/Makefile b/src/mesa/drivers/dri/r300/Makefile index c64f940623..0e5b29b685 100644 --- a/src/mesa/drivers/dri/r300/Makefile +++ b/src/mesa/drivers/dri/r300/Makefile @@ -69,7 +69,10 @@ DRIVER_DEFINES = -DRADEON_R300 DRI_LIB_DEPS += $(RADEON_LDFLAGS) -PIPE_DRIVERS = compiler/libr300compiler.a +SUBDIRS = compiler + +EXTRA_MODULES = compiler/libr300compiler.a + ##### TARGETS ##### @@ -77,8 +80,3 @@ include ../Makefile.template symlinks: -# Mark the archive phony so that we always check for recompilation -.PHONY : compiler/libr300compiler.a - -compiler/libr300compiler.a: - cd compiler && $(MAKE) -- cgit v1.2.3 From f094b86bb5ab93aedc03df5cf5bdf51ab9d37045 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 16 Oct 2009 09:33:11 -0600 Subject: mesa: lift default symlinks target into Makefile.template Driver Makefiles can still add symlink dependencies/rules if needed. --- src/mesa/drivers/dri/Makefile.template | 4 ++++ src/mesa/drivers/dri/fb/Makefile | 2 -- src/mesa/drivers/dri/ffb/Makefile | 1 - src/mesa/drivers/dri/gamma/Makefile | 1 - src/mesa/drivers/dri/i810/Makefile | 1 - src/mesa/drivers/dri/i915/Makefile | 1 - src/mesa/drivers/dri/i965/Makefile | 1 - src/mesa/drivers/dri/mach64/Makefile | 1 - src/mesa/drivers/dri/mga/Makefile | 1 - src/mesa/drivers/dri/r128/Makefile | 1 - src/mesa/drivers/dri/r200/Makefile | 1 - src/mesa/drivers/dri/r300/Makefile | 2 -- src/mesa/drivers/dri/r600/Makefile | 1 - src/mesa/drivers/dri/radeon/Makefile | 1 - src/mesa/drivers/dri/s3v/Makefile | 1 - src/mesa/drivers/dri/savage/Makefile | 1 - src/mesa/drivers/dri/sis/Makefile | 1 - src/mesa/drivers/dri/swrast/Makefile | 1 - src/mesa/drivers/dri/tdfx/Makefile | 2 -- src/mesa/drivers/dri/trident/Makefile | 1 - src/mesa/drivers/dri/unichrome/Makefile | 1 - 21 files changed, 4 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/Makefile.template b/src/mesa/drivers/dri/Makefile.template index d2731aebae..1ce9315530 100644 --- a/src/mesa/drivers/dri/Makefile.template +++ b/src/mesa/drivers/dri/Makefile.template @@ -86,6 +86,10 @@ subdirs: fi +.PHONY: symlinks +symlinks: + + depend: $(C_SOURCES) $(ASM_SOURCES) $(SYMLINKS) @ echo "running $(MKDEP)" @ rm -f depend diff --git a/src/mesa/drivers/dri/fb/Makefile b/src/mesa/drivers/dri/fb/Makefile index 309f50b95f..cf9b3a8556 100644 --- a/src/mesa/drivers/dri/fb/Makefile +++ b/src/mesa/drivers/dri/fb/Makefile @@ -25,5 +25,3 @@ ASM_SOURCES = include ../Makefile.template -symlinks: - diff --git a/src/mesa/drivers/dri/ffb/Makefile b/src/mesa/drivers/dri/ffb/Makefile index cb73238c03..e9da8f9066 100644 --- a/src/mesa/drivers/dri/ffb/Makefile +++ b/src/mesa/drivers/dri/ffb/Makefile @@ -33,4 +33,3 @@ ASM_SOURCES = include ../Makefile.template -symlinks: diff --git a/src/mesa/drivers/dri/gamma/Makefile b/src/mesa/drivers/dri/gamma/Makefile index 250d3ac089..09df1578fc 100644 --- a/src/mesa/drivers/dri/gamma/Makefile +++ b/src/mesa/drivers/dri/gamma/Makefile @@ -32,4 +32,3 @@ ASM_SOURCES = include ../Makefile.template -symlinks: diff --git a/src/mesa/drivers/dri/i810/Makefile b/src/mesa/drivers/dri/i810/Makefile index a7825b49b4..3874faee51 100644 --- a/src/mesa/drivers/dri/i810/Makefile +++ b/src/mesa/drivers/dri/i810/Makefile @@ -29,4 +29,3 @@ ASM_SOURCES = include ../Makefile.template -symlinks: diff --git a/src/mesa/drivers/dri/i915/Makefile b/src/mesa/drivers/dri/i915/Makefile index 393312e732..37f15aa767 100644 --- a/src/mesa/drivers/dri/i915/Makefile +++ b/src/mesa/drivers/dri/i915/Makefile @@ -72,4 +72,3 @@ intel_decode.o: ../intel/intel_decode.c intel_tex_layout.o: ../intel/intel_tex_layout.c -symlinks: diff --git a/src/mesa/drivers/dri/i965/Makefile b/src/mesa/drivers/dri/i965/Makefile index 57dcc91586..7a55333e89 100644 --- a/src/mesa/drivers/dri/i965/Makefile +++ b/src/mesa/drivers/dri/i965/Makefile @@ -100,6 +100,5 @@ DRI_LIB_DEPS += -ldrm_intel include ../Makefile.template -symlinks: intel_decode.o: ../intel/intel_decode.c intel_tex_layout.o: ../intel/intel_tex_layout.c diff --git a/src/mesa/drivers/dri/mach64/Makefile b/src/mesa/drivers/dri/mach64/Makefile index 7246d51f5d..a8f463e9fd 100644 --- a/src/mesa/drivers/dri/mach64/Makefile +++ b/src/mesa/drivers/dri/mach64/Makefile @@ -30,4 +30,3 @@ ASM_SOURCES = include ../Makefile.template -symlinks: diff --git a/src/mesa/drivers/dri/mga/Makefile b/src/mesa/drivers/dri/mga/Makefile index a871064c62..0cc329fb22 100644 --- a/src/mesa/drivers/dri/mga/Makefile +++ b/src/mesa/drivers/dri/mga/Makefile @@ -31,4 +31,3 @@ ASM_SOURCES = include ../Makefile.template -symlinks: diff --git a/src/mesa/drivers/dri/r128/Makefile b/src/mesa/drivers/dri/r128/Makefile index 796dfbc516..52c5a38a70 100644 --- a/src/mesa/drivers/dri/r128/Makefile +++ b/src/mesa/drivers/dri/r128/Makefile @@ -29,4 +29,3 @@ ASM_SOURCES = include ../Makefile.template -symlinks: diff --git a/src/mesa/drivers/dri/r200/Makefile b/src/mesa/drivers/dri/r200/Makefile index fbce70c37b..776f1e3f3f 100644 --- a/src/mesa/drivers/dri/r200/Makefile +++ b/src/mesa/drivers/dri/r200/Makefile @@ -66,4 +66,3 @@ include ../Makefile.template #INCLUDES += -I../radeon/server -symlinks: diff --git a/src/mesa/drivers/dri/r300/Makefile b/src/mesa/drivers/dri/r300/Makefile index 0e5b29b685..cb0f715fa0 100644 --- a/src/mesa/drivers/dri/r300/Makefile +++ b/src/mesa/drivers/dri/r300/Makefile @@ -78,5 +78,3 @@ EXTRA_MODULES = compiler/libr300compiler.a include ../Makefile.template -symlinks: - diff --git a/src/mesa/drivers/dri/r600/Makefile b/src/mesa/drivers/dri/r600/Makefile index 7d5a7b1ab6..9b7c42042e 100644 --- a/src/mesa/drivers/dri/r600/Makefile +++ b/src/mesa/drivers/dri/r600/Makefile @@ -76,4 +76,3 @@ DRI_LIB_DEPS += $(RADEON_LDFLAGS) include ../Makefile.template -symlinks: diff --git a/src/mesa/drivers/dri/radeon/Makefile b/src/mesa/drivers/dri/radeon/Makefile index b1efc72872..ae2e695bfc 100644 --- a/src/mesa/drivers/dri/radeon/Makefile +++ b/src/mesa/drivers/dri/radeon/Makefile @@ -55,4 +55,3 @@ X86_SOURCES = include ../Makefile.template -symlinks: diff --git a/src/mesa/drivers/dri/s3v/Makefile b/src/mesa/drivers/dri/s3v/Makefile index 9bd7973154..da7e6cdc20 100644 --- a/src/mesa/drivers/dri/s3v/Makefile +++ b/src/mesa/drivers/dri/s3v/Makefile @@ -33,4 +33,3 @@ ASM_SOURCES = include ../Makefile.template -symlinks: diff --git a/src/mesa/drivers/dri/savage/Makefile b/src/mesa/drivers/dri/savage/Makefile index 018482f66b..2e5c40802c 100644 --- a/src/mesa/drivers/dri/savage/Makefile +++ b/src/mesa/drivers/dri/savage/Makefile @@ -27,4 +27,3 @@ ASM_SOURCES = include ../Makefile.template -symlinks: diff --git a/src/mesa/drivers/dri/sis/Makefile b/src/mesa/drivers/dri/sis/Makefile index d2354e6776..ad009fc239 100644 --- a/src/mesa/drivers/dri/sis/Makefile +++ b/src/mesa/drivers/dri/sis/Makefile @@ -34,4 +34,3 @@ ASM_SOURCES = include ../Makefile.template -symlinks: diff --git a/src/mesa/drivers/dri/swrast/Makefile b/src/mesa/drivers/dri/swrast/Makefile index 5f3a4f2191..771169c1ff 100644 --- a/src/mesa/drivers/dri/swrast/Makefile +++ b/src/mesa/drivers/dri/swrast/Makefile @@ -21,4 +21,3 @@ SWRAST_COMMON_SOURCES = \ include ../Makefile.template -symlinks: diff --git a/src/mesa/drivers/dri/tdfx/Makefile b/src/mesa/drivers/dri/tdfx/Makefile index 092c580fea..b9f25db4fe 100644 --- a/src/mesa/drivers/dri/tdfx/Makefile +++ b/src/mesa/drivers/dri/tdfx/Makefile @@ -32,6 +32,4 @@ ASM_SOURCES = include ../Makefile.template -symlinks: - diff --git a/src/mesa/drivers/dri/trident/Makefile b/src/mesa/drivers/dri/trident/Makefile index 9ee24c504c..bd9b7f35a2 100644 --- a/src/mesa/drivers/dri/trident/Makefile +++ b/src/mesa/drivers/dri/trident/Makefile @@ -23,4 +23,3 @@ ASM_SOURCES = include ../Makefile.template -symlinks: diff --git a/src/mesa/drivers/dri/unichrome/Makefile b/src/mesa/drivers/dri/unichrome/Makefile index 5fe00c1bd1..344d34fce3 100644 --- a/src/mesa/drivers/dri/unichrome/Makefile +++ b/src/mesa/drivers/dri/unichrome/Makefile @@ -29,4 +29,3 @@ ASM_SOURCES = include ../Makefile.template -symlinks: -- cgit v1.2.3 From a335d334d45701a42c283257fa44f2f7148e186d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 16 Oct 2009 09:42:30 -0600 Subject: mesa: fix/update some comments --- src/mesa/main/mtypes.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index ea3b552b9d..052fbaaaea 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.5 + * Version: 7.7 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * Copyright (C) 2009 VMware, Inc. All Rights Reserved. @@ -1917,10 +1917,10 @@ struct ati_fragment_shader struct atifs_instruction *Instructions[2]; struct atifs_setupinst *SetupInst[2]; GLfloat Constants[8][4]; - GLbitfield LocalConstDef; /** Indicates which constants have been set */ + GLbitfield LocalConstDef; /**< Indicates which constants have been set */ GLubyte numArithInstr[2]; GLubyte regsAssigned[2]; - GLubyte NumPasses; /** 1 or 2 */ + GLubyte NumPasses; /**< 1 or 2 */ GLubyte cur_pass; GLubyte last_optype; GLboolean interpinp1; @@ -1934,7 +1934,7 @@ struct ati_fragment_shader struct gl_ati_fragment_shader_state { GLboolean Enabled; - GLboolean _Enabled; /** enabled and valid shader? */ + GLboolean _Enabled; /**< enabled and valid shader? */ GLboolean Compiling; GLfloat GlobalConstants[8][4]; struct ati_fragment_shader *Current; -- cgit v1.2.3 From 60a39b6799c72430851d92f93758e2f25487a0f4 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sat, 17 Oct 2009 08:25:48 +0100 Subject: intel: Disallow relocations to the byte beyond the end of the buffer --- src/mesa/drivers/dri/intel/intel_batchbuffer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h b/src/mesa/drivers/dri/intel/intel_batchbuffer.h index 9a619fbd5c..d4899aab7f 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.h +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.h @@ -157,7 +157,7 @@ intel_batchbuffer_require_space(struct intel_batchbuffer *batch, #define OUT_BATCH(d) intel_batchbuffer_emit_dword(intel->batch, d) #define OUT_RELOC(buf, read_domains, write_domain, delta) do { \ - assert((unsigned) (delta) <= buf->size); \ + assert((unsigned) (delta) < buf->size); \ intel_batchbuffer_emit_reloc(intel->batch, buf, \ read_domains, write_domain, delta); \ } while (0) -- cgit v1.2.3 From 5d42e3988de8b3e1b37d8c21d18db240bc8b4096 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sat, 17 Oct 2009 11:45:04 +0100 Subject: util: Rename from u_* to util_* while we're at it. To be consistent with the rest. --- src/gallium/auxiliary/util/u_hash_table.c | 90 +++++++++++++++---------------- src/gallium/auxiliary/util/u_hash_table.h | 32 +++++------ src/gallium/auxiliary/util/u_keymap.c | 2 +- 3 files changed, 62 insertions(+), 62 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_hash_table.c b/src/gallium/auxiliary/util/u_hash_table.c index de711f9c1d..5604e3ac37 100644 --- a/src/gallium/auxiliary/util/u_hash_table.c +++ b/src/gallium/auxiliary/util/u_hash_table.c @@ -47,7 +47,7 @@ #include "util/u_hash_table.h" -struct u_hash_table +struct util_hash_table { struct cso_hash *cso; @@ -61,27 +61,27 @@ struct u_hash_table }; -struct hash_table_item +struct util_hash_table_item { void *key; void *value; }; -static INLINE struct hash_table_item * -hash_table_item(struct cso_hash_iter iter) +static INLINE struct util_hash_table_item * +util_hash_table_item(struct cso_hash_iter iter) { - return (struct hash_table_item *)cso_hash_iter_data(iter); + return (struct util_hash_table_item *)cso_hash_iter_data(iter); } -struct u_hash_table * -u_hash_table_create(unsigned (*hash)(void *key), - int (*compare)(void *key1, void *key2)) +struct util_hash_table * +util_hash_table_create(unsigned (*hash)(void *key), + int (*compare)(void *key1, void *key2)) { - struct u_hash_table *ht; + struct util_hash_table *ht; - ht = MALLOC_STRUCT(u_hash_table); + ht = MALLOC_STRUCT(util_hash_table); if(!ht) return NULL; @@ -99,16 +99,16 @@ u_hash_table_create(unsigned (*hash)(void *key), static INLINE struct cso_hash_iter -hash_table_find_iter(struct u_hash_table *ht, - void *key, - unsigned key_hash) +util_hash_table_find_iter(struct util_hash_table *ht, + void *key, + unsigned key_hash) { struct cso_hash_iter iter; - struct hash_table_item *item; + struct util_hash_table_item *item; iter = cso_hash_find(ht->cso, key_hash); while (!cso_hash_iter_is_null(iter)) { - item = (struct hash_table_item *)cso_hash_iter_data(iter); + item = (struct util_hash_table_item *)cso_hash_iter_data(iter); if (!ht->compare(item->key, key)) break; iter = cso_hash_iter_next(iter); @@ -118,17 +118,17 @@ hash_table_find_iter(struct u_hash_table *ht, } -static INLINE struct hash_table_item * -hash_table_find_item(struct u_hash_table *ht, - void *key, - unsigned key_hash) +static INLINE struct util_hash_table_item * +util_hash_table_find_item(struct util_hash_table *ht, + void *key, + unsigned key_hash) { struct cso_hash_iter iter; - struct hash_table_item *item; + struct util_hash_table_item *item; iter = cso_hash_find(ht->cso, key_hash); while (!cso_hash_iter_is_null(iter)) { - item = (struct hash_table_item *)cso_hash_iter_data(iter); + item = (struct util_hash_table_item *)cso_hash_iter_data(iter); if (!ht->compare(item->key, key)) return item; iter = cso_hash_iter_next(iter); @@ -139,12 +139,12 @@ hash_table_find_item(struct u_hash_table *ht, enum pipe_error -u_hash_table_set(struct u_hash_table *ht, - void *key, - void *value) +util_hash_table_set(struct util_hash_table *ht, + void *key, + void *value) { unsigned key_hash; - struct hash_table_item *item; + struct util_hash_table_item *item; struct cso_hash_iter iter; assert(ht); @@ -153,14 +153,14 @@ u_hash_table_set(struct u_hash_table *ht, key_hash = ht->hash(key); - item = hash_table_find_item(ht, key, key_hash); + item = util_hash_table_find_item(ht, key, key_hash); if(item) { /* TODO: key/value destruction? */ item->value = value; return PIPE_OK; } - item = MALLOC_STRUCT(hash_table_item); + item = MALLOC_STRUCT(util_hash_table_item); if(!item) return PIPE_ERROR_OUT_OF_MEMORY; @@ -178,11 +178,11 @@ u_hash_table_set(struct u_hash_table *ht, void * -u_hash_table_get(struct u_hash_table *ht, - void *key) +util_hash_table_get(struct util_hash_table *ht, + void *key) { unsigned key_hash; - struct hash_table_item *item; + struct util_hash_table_item *item; assert(ht); if (!ht) @@ -190,7 +190,7 @@ u_hash_table_get(struct u_hash_table *ht, key_hash = ht->hash(key); - item = hash_table_find_item(ht, key, key_hash); + item = util_hash_table_find_item(ht, key, key_hash); if(!item) return NULL; @@ -199,12 +199,12 @@ u_hash_table_get(struct u_hash_table *ht, void -u_hash_table_remove(struct u_hash_table *ht, - void *key) +util_hash_table_remove(struct util_hash_table *ht, + void *key) { unsigned key_hash; struct cso_hash_iter iter; - struct hash_table_item *item; + struct util_hash_table_item *item; assert(ht); if (!ht) @@ -212,11 +212,11 @@ u_hash_table_remove(struct u_hash_table *ht, key_hash = ht->hash(key); - iter = hash_table_find_iter(ht, key, key_hash); + iter = util_hash_table_find_iter(ht, key, key_hash); if(cso_hash_iter_is_null(iter)) return; - item = hash_table_item(iter); + item = util_hash_table_item(iter); assert(item); FREE(item); @@ -225,10 +225,10 @@ u_hash_table_remove(struct u_hash_table *ht, void -u_hash_table_clear(struct u_hash_table *ht) +util_hash_table_clear(struct util_hash_table *ht) { struct cso_hash_iter iter; - struct hash_table_item *item; + struct util_hash_table_item *item; assert(ht); if (!ht) @@ -236,7 +236,7 @@ u_hash_table_clear(struct u_hash_table *ht) iter = cso_hash_first_node(ht->cso); while (!cso_hash_iter_is_null(iter)) { - item = (struct hash_table_item *)cso_hash_take(ht->cso, cso_hash_iter_key(iter)); + item = (struct util_hash_table_item *)cso_hash_take(ht->cso, cso_hash_iter_key(iter)); FREE(item); iter = cso_hash_first_node(ht->cso); } @@ -244,13 +244,13 @@ u_hash_table_clear(struct u_hash_table *ht) enum pipe_error -u_hash_table_foreach(struct u_hash_table *ht, +util_hash_table_foreach(struct util_hash_table *ht, enum pipe_error (*callback) (void *key, void *value, void *data), void *data) { struct cso_hash_iter iter; - struct hash_table_item *item; + struct util_hash_table_item *item; enum pipe_error result; assert(ht); @@ -259,7 +259,7 @@ u_hash_table_foreach(struct u_hash_table *ht, iter = cso_hash_first_node(ht->cso); while (!cso_hash_iter_is_null(iter)) { - item = (struct hash_table_item *)cso_hash_iter_data(iter); + item = (struct util_hash_table_item *)cso_hash_iter_data(iter); result = callback(item->key, item->value, data); if(result != PIPE_OK) return result; @@ -271,10 +271,10 @@ u_hash_table_foreach(struct u_hash_table *ht, void -u_hash_table_destroy(struct u_hash_table *ht) +util_hash_table_destroy(struct util_hash_table *ht) { struct cso_hash_iter iter; - struct hash_table_item *item; + struct util_hash_table_item *item; assert(ht); if (!ht) @@ -282,7 +282,7 @@ u_hash_table_destroy(struct u_hash_table *ht) iter = cso_hash_first_node(ht->cso); while (!cso_hash_iter_is_null(iter)) { - item = (struct hash_table_item *)cso_hash_iter_data(iter); + item = (struct util_hash_table_item *)cso_hash_iter_data(iter); FREE(item); iter = cso_hash_iter_next(iter); } diff --git a/src/gallium/auxiliary/util/u_hash_table.h b/src/gallium/auxiliary/util/u_hash_table.h index feb47365f0..258a31aec8 100644 --- a/src/gallium/auxiliary/util/u_hash_table.h +++ b/src/gallium/auxiliary/util/u_hash_table.h @@ -46,7 +46,7 @@ extern "C" { /** * Generic purpose hash table. */ -struct u_hash_table; +struct util_hash_table; /** @@ -55,38 +55,38 @@ struct u_hash_table; * @param hash hash function * @param compare should return 0 for two equal keys. */ -struct u_hash_table * -u_hash_table_create(unsigned (*hash)(void *key), - int (*compare)(void *key1, void *key2)); +struct util_hash_table * +util_hash_table_create(unsigned (*hash)(void *key), + int (*compare)(void *key1, void *key2)); enum pipe_error -u_hash_table_set(struct u_hash_table *ht, - void *key, - void *value); +util_hash_table_set(struct util_hash_table *ht, + void *key, + void *value); void * -u_hash_table_get(struct u_hash_table *ht, - void *key); +util_hash_table_get(struct util_hash_table *ht, + void *key); void -u_hash_table_remove(struct u_hash_table *ht, - void *key); +util_hash_table_remove(struct util_hash_table *ht, + void *key); void -u_hash_table_clear(struct u_hash_table *ht); +util_hash_table_clear(struct util_hash_table *ht); enum pipe_error -u_hash_table_foreach(struct u_hash_table *ht, - enum pipe_error (*callback) +util_hash_table_foreach(struct util_hash_table *ht, + enum pipe_error (*callback) (void *key, void *value, void *data), - void *data); + void *data); void -u_hash_table_destroy(struct u_hash_table *ht); +util_hash_table_destroy(struct util_hash_table *ht); #ifdef __cplusplus diff --git a/src/gallium/auxiliary/util/u_keymap.c b/src/gallium/auxiliary/util/u_keymap.c index 508a2ee063..f856395ca9 100644 --- a/src/gallium/auxiliary/util/u_keymap.c +++ b/src/gallium/auxiliary/util/u_keymap.c @@ -28,7 +28,7 @@ /** * Key lookup/associative container. * - * Like Jose's u_hash_table, based on CSO cache code for now. + * Like Jose's util_hash_table, based on CSO cache code for now. * * Author: Brian Paul */ -- cgit v1.2.3 From 67356ae04743da3137e950503ffd4a1f8fa36400 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Sat, 17 Oct 2009 20:27:24 +0200 Subject: nouveau: nv30: Use same workaround as i915 for segfault related to vbo --- src/gallium/drivers/nv30/nv30_context.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv30/nv30_context.c b/src/gallium/drivers/nv30/nv30_context.c index f827bdc78b..a3e65b96f7 100644 --- a/src/gallium/drivers/nv30/nv30_context.c +++ b/src/gallium/drivers/nv30/nv30_context.c @@ -10,7 +10,7 @@ nv30_flush(struct pipe_context *pipe, unsigned flags, struct pipe_fence_handle **fence) { struct nv30_context *nv30 = nv30_context(pipe); - + if (flags & PIPE_FLUSH_TEXTURE_CACHE) { BEGIN_RING(rankine, 0x1fd8, 1); OUT_RING (2); @@ -37,10 +37,14 @@ nv30_is_texture_referenced( struct pipe_context *pipe, unsigned face, unsigned level) { /** - * FIXME: Optimize. + * FIXME: Return the corrent result. We can't alays return referenced + * since it causes a double flush within the vbo module. */ - +#if 0 return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +#else + return 0; +#endif } static unsigned int @@ -48,10 +52,14 @@ nv30_is_buffer_referenced( struct pipe_context *pipe, struct pipe_buffer *buf) { /** - * FIXME: Optimize. + * FIXME: Return the corrent result. We can't alays return referenced + * since it causes a double flush within the vbo module. */ - +#if 0 return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +#else + return 0; +#endif } struct pipe_context * @@ -95,4 +103,3 @@ nv30_create(struct pipe_screen *pscreen, unsigned pctx_id) return &nv30->pipe; } - -- cgit v1.2.3 From 66aab9a1f6de241687a14f7aed45226061c1b84b Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Sat, 17 Oct 2009 20:46:19 +0200 Subject: nouveau: nv30: Remove duplicate case. Was a typo for X8R8G8B8, but that will never be use for front buffer. --- src/gallium/drivers/nv30/nv30_screen.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c index 5b1e5cab2d..bb40e1803d 100644 --- a/src/gallium/drivers/nv30/nv30_screen.c +++ b/src/gallium/drivers/nv30/nv30_screen.c @@ -108,8 +108,7 @@ nv30_screen_surface_format_supported(struct pipe_screen *pscreen, switch (format) { case PIPE_FORMAT_Z24S8_UNORM: case PIPE_FORMAT_Z24X8_UNORM: - return (front->format == PIPE_FORMAT_A8R8G8B8_UNORM) - || (front->format == PIPE_FORMAT_A8R8G8B8_UNORM); + return (front->format == PIPE_FORMAT_A8R8G8B8_UNORM); case PIPE_FORMAT_Z16_UNORM: return (front->format == PIPE_FORMAT_R5G6B5_UNORM); default: -- cgit v1.2.3 From 114417a2f52ab463f37fcabb5e9b0636574623dc Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Sat, 17 Oct 2009 20:49:18 +0200 Subject: nouveau: nv40: Use same workaround as i915 for segfault related to vbo --- src/gallium/drivers/nv40/nv40_context.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv40/nv40_context.c b/src/gallium/drivers/nv40/nv40_context.c index 8eba6a43ef..4e23671202 100644 --- a/src/gallium/drivers/nv40/nv40_context.c +++ b/src/gallium/drivers/nv40/nv40_context.c @@ -10,7 +10,7 @@ nv40_flush(struct pipe_context *pipe, unsigned flags, struct pipe_fence_handle **fence) { struct nv40_context *nv40 = nv40_context(pipe); - + if (flags & PIPE_FLUSH_TEXTURE_CACHE) { BEGIN_RING(curie, 0x1fd8, 1); OUT_RING (2); @@ -37,10 +37,14 @@ nv40_is_texture_referenced( struct pipe_context *pipe, unsigned face, unsigned level) { /** - * FIXME: Optimize. + * FIXME: Return the correct result. We can't always return referenced + * since it causes a double flush within the vbo module. */ - +#if 0 return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +#else + return 0; +#endif } static unsigned int @@ -48,10 +52,14 @@ nv40_is_buffer_referenced( struct pipe_context *pipe, struct pipe_buffer *buf) { /** - * FIXME: Optimize. + * FIXME: Return the correct result. We can't always return referenced + * since it causes a double flush within the vbo module. */ - +#if 0 return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +#else + return 0; +#endif } struct pipe_context * @@ -95,4 +103,3 @@ nv40_create(struct pipe_screen *pscreen, unsigned pctx_id) return &nv40->pipe; } - -- cgit v1.2.3 From ce9ae4a483e7c85a9046a87005232aa09de782aa Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 17 Oct 2009 20:05:23 -0700 Subject: r300g: Fix u_hash_table rename. --- src/gallium/drivers/r300/r300_context.c | 6 +++--- src/gallium/drivers/r300/r300_context.h | 2 +- src/gallium/drivers/r300/r300_state_derived.c | 8 +++----- 3 files changed, 7 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index a1156d2de6..0518685200 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -102,9 +102,9 @@ static void r300_destroy_context(struct pipe_context* context) struct r300_context* r300 = r300_context(context); struct r300_query* query, * temp; - u_hash_table_foreach(r300->shader_hash_table, r300_clear_hash_table, + util_hash_table_foreach(r300->shader_hash_table, r300_clear_hash_table, NULL); - u_hash_table_destroy(r300->shader_hash_table); + util_hash_table_destroy(r300->shader_hash_table); draw_destroy(r300->draw); @@ -180,7 +180,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->context.is_texture_referenced = r300_is_texture_referenced; r300->context.is_buffer_referenced = r300_is_buffer_referenced; - r300->shader_hash_table = u_hash_table_create(r300_shader_key_hash, + r300->shader_hash_table = util_hash_table_create(r300_shader_key_hash, r300_shader_key_compare); r300->blend_color_state = CALLOC_STRUCT(r300_blend_color_state); diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 2a62c67fc7..2d608d6afc 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -252,7 +252,7 @@ struct r300_context { /* Shader hash table. Used to store vertex formatting information, which * depends on the combination of both currently loaded shaders. */ - struct u_hash_table* shader_hash_table; + struct util_hash_table* shader_hash_table; /* Vertex formatting information. */ struct r300_vertex_format* vertex_info; diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 53027777d6..0210d97914 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -277,7 +277,7 @@ static void r300_update_vertex_format(struct r300_context* r300) key->vs = r300->vs; key->fs = r300->fs; - value = u_hash_table_get(r300->shader_hash_table, (void*)key); + value = util_hash_table_get(r300->shader_hash_table, (void*)key); if (value) { debug_printf("r300: Hash table hit! vs: %p fs: %p\n", key->vs, key->fs); @@ -295,10 +295,8 @@ static void r300_update_vertex_format(struct r300_context* r300) r300_vs_tab_routes(r300, vformat); r300_vertex_psc(r300, vformat); - if (u_hash_table_set(r300->shader_hash_table, (void*)key, - (void*)vformat) != PIPE_OK) { - debug_printf("r300: Hash table insertion error!\n"); - } + util_hash_table_set(r300->shader_hash_table, + (void*)key, (void*)vformat); } if (r300->vertex_info != vformat) { -- cgit v1.2.3 From 51173e4e53a64465d1498ffd6454687b7629eb59 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 17 Oct 2009 20:29:27 -0700 Subject: r300g: Also have rs_block keyed to the current shader combo. Eliminates part of the glxgears corruption here. Need to clean up PSC more, to get rid of the rest of it. --- src/gallium/drivers/r300/r300_state_derived.c | 109 ++++++++++++++------------ 1 file changed, 58 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 0210d97914..da8c366f30 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -34,6 +34,11 @@ struct r300_shader_key { struct r300_fragment_shader* fs; }; +struct r300_shader_derived_value { + struct r300_vertex_format* vformat; + struct r300_rs_block* rs_block; +}; + unsigned r300_shader_key_hash(void* key) { struct r300_shader_key* shader_key = (struct r300_shader_key*)key; unsigned vs = (unsigned)shader_key->vs; @@ -265,50 +270,10 @@ static void r300_vertex_psc(struct r300_context* r300, (R300_LAST_VEC << (i & 1 ? 16 : 0)); } -/* Update the vertex format. */ -static void r300_update_vertex_format(struct r300_context* r300) -{ - struct r300_shader_key* key; - struct r300_vertex_format* vformat; - void* value; - int i; - - key = CALLOC_STRUCT(r300_shader_key); - key->vs = r300->vs; - key->fs = r300->fs; - - value = util_hash_table_get(r300->shader_hash_table, (void*)key); - if (value) { - debug_printf("r300: Hash table hit! vs: %p fs: %p\n", key->vs, - key->fs); - vformat = (struct r300_vertex_format*)value; - } else { - debug_printf("r300: Hash table miss... vs: %p fs: %p\n", key->vs, - key->fs); - vformat = CALLOC_STRUCT(r300_vertex_format); - - for (i = 0; i < 16; i++) { - vformat->vs_tab[i] = -1; - vformat->fs_tab[i] = -1; - } - - r300_vs_tab_routes(r300, vformat); - r300_vertex_psc(r300, vformat); - - util_hash_table_set(r300->shader_hash_table, - (void*)key, (void*)vformat); - } - - if (r300->vertex_info != vformat) { - r300->vertex_info = vformat; - r300->dirty_state |= R300_NEW_VERTEX_FORMAT; - } -} - /* Set up the mappings from GB to US, for RS block. */ -static void r300_update_fs_tab(struct r300_context* r300) +static void r300_update_fs_tab(struct r300_context* r300, + struct r300_vertex_format* vformat) { - struct r300_vertex_format* vformat = r300->vertex_info; struct tgsi_shader_info* info = &r300->fs->info; int i, cols = 0, texs = 0, cols_emitted = 0; int* tab = vformat->fs_tab; @@ -370,14 +335,14 @@ static void r300_update_fs_tab(struct r300_context* r300) /* Set up the RS block. This is the part of the chipset that actually does * the rasterization of vertices into fragments. This is also the part of the * chipset that locks up if any part of it is even slightly wrong. */ -static void r300_update_rs_block(struct r300_context* r300) +static void r300_update_rs_block(struct r300_context* r300, + struct r300_vertex_format* vformat, + struct r300_rs_block* rs) { - struct r300_rs_block* rs = r300->rs_block; struct tgsi_shader_info* info = &r300->fs->info; - int* tab = r300->vertex_info->fs_tab; + int* tab = vformat->fs_tab; int col_count = 0, fp_offset = 0, i, tex_count = 0; int rs_tex_comp = 0; - memset(rs, 0, sizeof(struct r300_rs_block)); if (r300_screen(r300->context.screen)->caps->is_r500) { for (i = 0; i < info->num_inputs; i++) { @@ -481,6 +446,53 @@ static void r300_update_rs_block(struct r300_context* r300) rs->inst_count = MAX2(MAX2(col_count - 1, tex_count - 1), 0); } +/* Update the vertex format. */ +static void r300_update_vertex_format(struct r300_context* r300) +{ + struct r300_shader_key* key; + struct r300_vertex_format* vformat; + struct r300_rs_block* rs_block; + struct r300_shader_derived_value* value; + int i; + + key = CALLOC_STRUCT(r300_shader_key); + key->vs = r300->vs; + key->fs = r300->fs; + + value = (struct r300_shader_derived_value*) + util_hash_table_get(r300->shader_hash_table, (void*)key); + if (value) { + vformat = value->vformat; + rs_block = value->rs_block; + + FREE(key); + } else { + vformat = CALLOC_STRUCT(r300_vertex_format); + rs_block = CALLOC_STRUCT(r300_rs_block); + value = CALLOC_STRUCT(r300_shader_derived_value); + + for (i = 0; i < 16; i++) { + vformat->vs_tab[i] = -1; + vformat->fs_tab[i] = -1; + } + + r300_vs_tab_routes(r300, vformat); + r300_vertex_psc(r300, vformat); + r300_update_fs_tab(r300, vformat); + + r300_update_rs_block(r300, vformat, rs_block); + + value->vformat = vformat; + value->rs_block = rs_block; + util_hash_table_set(r300->shader_hash_table, + (void*)key, (void*)value); + } + + r300->vertex_info = vformat; + r300->rs_block = rs_block; + r300->dirty_state |= (R300_NEW_VERTEX_FORMAT | R300_NEW_RS_BLOCK); +} + static void r300_update_ztop(struct r300_context* r300) { r300->ztop_state.z_buffer_top = R300_ZTOP_ENABLE; @@ -516,11 +528,6 @@ void r300_update_derived_state(struct r300_context* r300) { r300_update_vertex_format(r300); - if (r300->dirty_state & R300_NEW_VERTEX_FORMAT) { - r300_update_fs_tab(r300); - r300_update_rs_block(r300); - } - if (r300->dirty_state & (R300_NEW_DSA | R300_NEW_FRAGMENT_SHADER | R300_NEW_QUERY)) { r300_update_ztop(r300); -- cgit v1.2.3 From 11056ca86fce64209b7d21c87070c419a1968d28 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 17 Oct 2009 20:47:45 -0700 Subject: r300g: Use a dirty test to bring framerate back up. This is just split out from the next commit, that's all. --- src/gallium/drivers/r300/r300_state_derived.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index da8c366f30..c59d446e93 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -447,7 +447,7 @@ static void r300_update_rs_block(struct r300_context* r300, } /* Update the vertex format. */ -static void r300_update_vertex_format(struct r300_context* r300) +static void r300_update_derived_shader_state(struct r300_context* r300) { struct r300_shader_key* key; struct r300_vertex_format* vformat; @@ -526,7 +526,10 @@ static void r300_update_ztop(struct r300_context* r300) void r300_update_derived_state(struct r300_context* r300) { - r300_update_vertex_format(r300); + if (r300->dirty_state & + (R300_NEW_FRAGMENT_SHADER | R300_NEW_VERTEX_SHADER)) { + r300_update_derived_shader_state(r300); + } if (r300->dirty_state & (R300_NEW_DSA | R300_NEW_FRAGMENT_SHADER | R300_NEW_QUERY)) { -- cgit v1.2.3 From bfd877e4705002d97ee8dba6fe0c1f8676582ab3 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 17 Oct 2009 20:53:19 -0700 Subject: r300g: Squash format warning. Won't ever be supported. --- src/gallium/drivers/r300/r300_screen.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 5381651c77..44770d1aca 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -231,6 +231,7 @@ static boolean check_tex_2d_format(enum pipe_format format, uint32_t usage, /* Definitely unsupported formats. */ /* Non-usable Z buffer/stencil formats. */ + case PIPE_FORMAT_Z32_UNORM: case PIPE_FORMAT_Z24X8_UNORM: case PIPE_FORMAT_S8Z24_UNORM: case PIPE_FORMAT_X8Z24_UNORM: -- cgit v1.2.3 From bb567357bc1366df7115e0daa68c2470e3bf6ba6 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 17 Oct 2009 21:32:56 -0700 Subject: gallium: Permit surface_copy and surface_fill to be NULL. Uf. Lots of files touched. Would people with working vega, xorg, dri1, etc. please make sure you are not broken, and fix yourself up if you are. There were only two or three places where the code did not have painful fallbacks, so I would advise st maintainers to find less painful workarounds, or consider overhauling util_surface_copy and util_surface_fill. Per ymanton, darktama, and Dr_Jakob's suggestions, clear has been left as-is. I will not add PIPE_CAP_BLITTER unless it is deemed necessary. --- src/gallium/auxiliary/util/u_blit.c | 19 ++++++++++++++----- src/gallium/auxiliary/util/u_clear.h | 16 +++++++++++++--- src/gallium/drivers/r300/r300_context.c | 2 +- src/gallium/include/pipe/p_context.h | 3 +++ src/gallium/state_trackers/dri/dri_drawable.c | 22 ++++++++++++++++------ src/gallium/state_trackers/egl/egl_surface.c | 23 +++++++++++++++++------ src/gallium/state_trackers/vega/renderer.c | 16 ++++++++++++---- src/gallium/state_trackers/vega/vg_tracker.c | 24 +++++++++++++++++------- src/gallium/state_trackers/xorg/xorg_exa.c | 12 +++++++++--- src/gallium/state_trackers/xorg/xorg_renderer.c | 19 ++++++++++++++----- src/mesa/state_tracker/st_atom_framebuffer.c | 16 ++++++++++++---- src/mesa/state_tracker/st_cb_drawpixels.c | 19 ++++++++++++++----- src/mesa/state_tracker/st_cb_fbo.c | 16 ++++++++++++---- src/mesa/state_tracker/st_cb_texture.c | 3 ++- 14 files changed, 156 insertions(+), 54 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index fb00c3abe8..5038642599 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -46,6 +46,7 @@ #include "util/u_memory.h" #include "util/u_simple_shaders.h" #include "util/u_surface.h" +#include "util/u_rect.h" #include "cso_cache/cso_context.h" @@ -301,7 +302,8 @@ util_blit_pixels_writemask(struct blit_state *ctx, * no overlapping. * Filter mode should not matter since there's no stretching. */ - if (dst->format == src->format && + if (pipe->surface_copy && + dst->format == src->format && srcX0 < srcX1 && dstX0 < dstX1 && srcY0 < srcY1 && @@ -365,10 +367,17 @@ util_blit_pixels_writemask(struct blit_state *ctx, PIPE_BUFFER_USAGE_GPU_WRITE); /* load temp texture */ - pipe->surface_copy(pipe, - texSurf, 0, 0, /* dest */ - src, srcLeft, srcTop, /* src */ - srcW, srcH); /* size */ + if (pipe->surface_copy) { + pipe->surface_copy(pipe, + texSurf, 0, 0, /* dest */ + src, srcLeft, srcTop, /* src */ + srcW, srcH); /* size */ + } else { + util_surface_copy(pipe, FALSE, + texSurf, 0, 0, /* dest */ + src, srcLeft, srcTop, /* src */ + srcW, srcH); /* size */ + } /* free the surface, update the texture if necessary. */ diff --git a/src/gallium/auxiliary/util/u_clear.h b/src/gallium/auxiliary/util/u_clear.h index 7c16b32cf9..1e65a035ae 100644 --- a/src/gallium/auxiliary/util/u_clear.h +++ b/src/gallium/auxiliary/util/u_clear.h @@ -32,6 +32,7 @@ #include "pipe/p_context.h" #include "pipe/p_state.h" #include "util/u_pack_color.h" +#include "util/u_rect.h" /** @@ -48,13 +49,22 @@ util_clear(struct pipe_context *pipe, unsigned color; util_pack_color(rgba, ps->format, &color); - pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, color); + if (pipe->surface_fill) { + pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, color); + } else { + util_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)); + if (pipe->surface_fill) { + pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, + util_pack_z_stencil(ps->format, depth, stencil)); + } else { + util_surface_fill(pipe, ps, 0, 0, ps->width, ps->height, + util_pack_z_stencil(ps->format, depth, stencil)); + } } } diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 0518685200..7b370b3e95 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -206,7 +206,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300_init_query_functions(r300); - r300_init_surface_functions(r300); + /* r300_init_surface_functions(r300); */ r300_init_state_functions(r300); diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 39620a7198..5569001e60 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -189,6 +189,9 @@ struct pipe_context { /** * Surface functions + * + * The pipe driver is allowed to set these functions to NULL, and in that + * case, they will not be available. */ /*@{*/ diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index c67cc8dacb..5625ff53cf 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -45,6 +45,7 @@ #include "state_tracker/st_cb_fbo.h" #include "util/u_memory.h" +#include "util/u_rect.h" static struct pipe_surface * dri_surface_from_handle(struct drm_api *api, @@ -541,12 +542,21 @@ dri1_swap_copy(struct dri_context *ctx, cur = dPriv->pClipRects; for (i = 0; i < dPriv->numClipRects; ++i) { - if (dri1_intersect_src_bbox(&clip, dPriv->x, dPriv->y, cur++, bbox)) - pipe->surface_copy(pipe, dst, clip.x1, clip.y1, - src, - (int)clip.x1 - dPriv->x, - (int)clip.y1 - dPriv->y, - clip.x2 - clip.x1, clip.y2 - clip.y1); + if (dri1_intersect_src_bbox(&clip, dPriv->x, dPriv->y, cur++, bbox)) { + if (pipe->surface_copy) { + pipe->surface_copy(pipe, dst, clip.x1, clip.y1, + src, + (int)clip.x1 - dPriv->x, + (int)clip.y1 - dPriv->y, + clip.x2 - clip.x1, clip.y2 - clip.y1); + } else { + util_surface_copy(pipe, FALSE, dst, clip.x1, clip.y1, + src, + (int)clip.x1 - dPriv->x, + (int)clip.y1 - dPriv->y, + clip.x2 - clip.x1, clip.y2 - clip.y1); + } + } } } diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c index 7911a8834e..71c013756d 100644 --- a/src/gallium/state_trackers/egl/egl_surface.c +++ b/src/gallium/state_trackers/egl/egl_surface.c @@ -12,6 +12,8 @@ #include "state_tracker/drm_api.h" +#include "util/u_rect.h" + /* * Util functions */ @@ -360,12 +362,21 @@ drm_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw) st_notify_swapbuffers(surf->stfb); if (ctx && surf->screen) { - ctx->pipe->surface_copy(ctx->pipe, - surf->screen->surface, - 0, 0, - back_surf, - 0, 0, - surf->w, surf->h); + if (ctx->pipe->surface_copy) { + ctx->pipe->surface_copy(ctx->pipe, + surf->screen->surface, + 0, 0, + back_surf, + 0, 0, + surf->w, surf->h); + } else { + util_surface_copy(ctx->pipe, FALSE, + surf->screen->surface, + 0, 0, + back_surf, + 0, 0, + surf->w, surf->h); + } ctx->pipe->flush(ctx->pipe, PIPE_FLUSH_RENDER_CACHE | PIPE_FLUSH_TEXTURE_CACHE, NULL); #ifdef DRM_MODE_FEATURE_DIRTYFB diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c index f7c5f2f0cd..396c88aa3d 100644 --- a/src/gallium/state_trackers/vega/renderer.c +++ b/src/gallium/state_trackers/vega/renderer.c @@ -37,6 +37,7 @@ #include "util/u_draw_quad.h" #include "util/u_simple_shaders.h" #include "util/u_memory.h" +#include "util/u_rect.h" #include "cso_cache/cso_context.h" @@ -457,10 +458,17 @@ void renderer_copy_surface(struct renderer *ctx, PIPE_BUFFER_USAGE_GPU_WRITE); /* load temp texture */ - pipe->surface_copy(pipe, - texSurf, 0, 0, /* dest */ - src, srcLeft, srcTop, /* src */ - srcW, srcH); /* size */ + if (pipe->surface_copy) { + pipe->surface_copy(pipe, + texSurf, 0, 0, /* dest */ + src, srcLeft, srcTop, /* src */ + srcW, srcH); /* size */ + } else { + util_surface_copy(pipe, FALSE, + texSurf, 0, 0, /* dest */ + src, srcLeft, srcTop, /* src */ + srcW, srcH); /* size */ + } /* free the surface, update the texture if necessary.*/ screen->tex_surface_destroy(texSurf); diff --git a/src/gallium/state_trackers/vega/vg_tracker.c b/src/gallium/state_trackers/vega/vg_tracker.c index 56cc60aebe..c4da01e52c 100644 --- a/src/gallium/state_trackers/vega/vg_tracker.c +++ b/src/gallium/state_trackers/vega/vg_tracker.c @@ -235,13 +235,23 @@ static void setup_new_alpha_mask(struct vg_context *ctx, old_texture, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_READ); - pipe->surface_copy(pipe, - surface, - 0, 0, - old_surface, - 0, 0, - MIN2(old_surface->width, width), - MIN2(old_surface->height, height)); + if (pipe->surface_copy) { + pipe->surface_copy(pipe, + surface, + 0, 0, + old_surface, + 0, 0, + MIN2(old_surface->width, width), + MIN2(old_surface->height, height)); + } else { + util_surface_copy(pipe, FALSE, + surface, + 0, 0, + old_surface, + 0, 0, + MIN2(old_surface->width, width), + MIN2(old_surface->height, height)); + } if (surface) pipe_surface_reference(&surface, NULL); if (old_surface) diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index af76d6690f..4988af4864 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -693,9 +693,15 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, dst_surf = exa->scrn->get_tex_surface( exa->scrn, texture, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE); src_surf = xorg_gpu_surface(exa->pipe->screen, priv); - exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf, - 0, 0, min(width, texture->width[0]), - min(height, texture->height[0])); + if (exa->pipe->surface_copy) { + exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf, + 0, 0, min(width, texture->width[0]), + min(height, texture->height[0])); + } else { + util_surface_copy(exa->pipe, FALSE, dst_surf, 0, 0, src_surf, + 0, 0, min(width, texture->width[0]), + min(height, texture->height[0])); + } exa->scrn->tex_surface_destroy(dst_surf); exa->scrn->tex_surface_destroy(src_surf); } diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 81b209cb59..ca69e1e0e9 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -7,6 +7,7 @@ #include "util/u_draw_quad.h" #include "util/u_math.h" #include "util/u_memory.h" +#include "util/u_rect.h" #include "pipe/p_inlines.h" @@ -586,11 +587,19 @@ create_sampler_texture(struct xorg_renderer *r, screen, src, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_READ); struct pipe_surface *ps_tex = screen->get_tex_surface( screen, pt, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE ); - pipe->surface_copy(pipe, - ps_tex, /* dest */ - 0, 0, /* destx/y */ - ps_read, - 0, 0, src->width[0], src->height[0]); + if (pipe->surface_copy) { + pipe->surface_copy(pipe, + ps_tex, /* dest */ + 0, 0, /* destx/y */ + ps_read, + 0, 0, src->width[0], src->height[0]); + } else { + util_surface_copy(pipe, FALSE, + ps_tex, /* dest */ + 0, 0, /* destx/y */ + ps_read, + 0, 0, src->width[0], src->height[0]); + } pipe_surface_reference(&ps_read, NULL); pipe_surface_reference(&ps_tex, NULL); } diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c index 5209a6a0c9..e18c0f6e0a 100644 --- a/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/src/mesa/state_tracker/st_atom_framebuffer.c @@ -39,6 +39,7 @@ #include "pipe/p_context.h" #include "pipe/p_inlines.h" #include "cso_cache/cso_context.h" +#include "util/u_rect.h" @@ -162,10 +163,17 @@ update_framebuffer_state( struct st_context *st ) (void) st_get_framebuffer_surface(stfb, ST_SURFACE_FRONT_LEFT, &surf_front); (void) st_get_framebuffer_surface(stfb, ST_SURFACE_BACK_LEFT, &surf_back); - st->pipe->surface_copy(st->pipe, - surf_front, 0, 0, /* dest */ - surf_back, 0, 0, /* src */ - fb->Width, fb->Height); + if (st->pipe->surface_copy) { + st->pipe->surface_copy(st->pipe, + surf_front, 0, 0, /* dest */ + surf_back, 0, 0, /* src */ + fb->Width, fb->Height); + } else { + util_surface_copy(st->pipe, FALSE, + surf_front, 0, 0, + surf_back, 0, 0, + fb->Width, fb->Height); + } } /* we're assuming we'll really draw to the front buffer */ st->frontbuffer_status = FRONT_STATUS_DIRTY; diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 5c3413f905..be44577117 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -62,6 +62,7 @@ #include "util/u_tile.h" #include "util/u_draw_quad.h" #include "util/u_math.h" +#include "util/u_rect.h" #include "shader/prog_instruction.h" #include "cso_cache/cso_context.h" @@ -1075,11 +1076,19 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, PIPE_BUFFER_USAGE_GPU_READ); struct pipe_surface *psTex = screen->get_tex_surface(screen, pt, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE ); - pipe->surface_copy(pipe, - psTex, /* dest */ - 0, 0, /* destx/y */ - psRead, - srcx, srcy, width, height); + if (pipe->surface_copy) { + pipe->surface_copy(pipe, + psTex, /* dest */ + 0, 0, /* destx/y */ + psRead, + srcx, srcy, width, height); + } else { + util_surface_copy(pipe, FALSE, + psTex, + 0, 0, + psRead, + srcx, srcy, width, height); + } pipe_surface_reference(&psRead, NULL); pipe_surface_reference(&psTex, NULL); } diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 864f5d3ca3..73aa65955b 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -49,6 +49,7 @@ #include "st_public.h" #include "st_texture.h" +#include "util/u_rect.h" /** @@ -538,10 +539,17 @@ copy_back_to_front(struct st_context *st, (void) st_get_framebuffer_surface(stfb, backIndex, &surf_back); if (surf_front && surf_back) { - st->pipe->surface_copy(st->pipe, - surf_front, 0, 0, /* dest */ - surf_back, 0, 0, /* src */ - fb->Width, fb->Height); + if (st->pipe->surface_copy) { + st->pipe->surface_copy(st->pipe, + surf_front, 0, 0, /* dest */ + surf_back, 0, 0, /* src */ + fb->Width, fb->Height); + } else { + util_surface_copy(st->pipe, FALSE, + surf_front, 0, 0, + surf_back, 0, 0, + fb->Width, fb->Height); + } } } diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index b943787106..a1953342b4 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1546,7 +1546,8 @@ st_copy_texsubimage(GLcontext *ctx, if (ctx->_ImageTransferState == 0x0) { - if (matching_base_formats && + if (pipe->surface_copy && + matching_base_formats && src_format == dest_format && !do_flip) { -- cgit v1.2.3 From 838da1d4ae11aa8b5eab4f35713709714e337cbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 18 Oct 2009 14:31:58 +0100 Subject: llvmpipe: Allocate texture storage for whole quads. --- src/gallium/drivers/llvmpipe/lp_texture.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index 08f0950d47..a00f2495df 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -66,16 +66,24 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen, pf_get_block(lpt->base.format, &lpt->base.block); for (level = 0; level <= pt->last_level; level++) { + unsigned nblocksx, nblocksy; + pt->width[level] = width; pt->height[level] = height; pt->depth[level] = depth; pt->nblocksx[level] = pf_get_nblocksx(&pt->block, width); - pt->nblocksy[level] = pf_get_nblocksy(&pt->block, height); - lpt->stride[level] = align(pt->nblocksx[level]*pt->block.size, 16); + pt->nblocksy[level] = pf_get_nblocksy(&pt->block, height); + + /* Allocate storage for whole quads. This is particularly important + * for depth surfaces, which are currently stored in a swizzled format. */ + nblocksx = pf_get_nblocksx(&pt->block, align(width, 2)); + nblocksy = pf_get_nblocksy(&pt->block, align(height, 2)); + + lpt->stride[level] = align(nblocksx*pt->block.size, 16); lpt->level_offset[level] = buffer_size; - buffer_size += (pt->nblocksy[level] * + buffer_size += (nblocksy * ((pt->target == PIPE_TEXTURE_CUBE) ? 6 : depth) * lpt->stride[level]); -- cgit v1.2.3 From d2e29b502e5f777551ff057f08e54d82542863cf Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 18 Oct 2009 10:30:18 -0700 Subject: r300g: Add another ZTOP condition. I don't even know if texkill works right now. --- src/gallium/drivers/r300/r300_state_derived.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index c59d446e93..2c624766bb 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -517,6 +517,8 @@ static void r300_update_ztop(struct r300_context* r300) */ if (r300->dsa_state->alpha_function) { r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE; + } else if (r300->fs->info.uses_kill) { + r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE; } else if (r300_fragment_shader_writes_depth(r300->fs)) { r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE; } else if (r300->query_current) { -- cgit v1.2.3 From 16a06fea73b1e6e8857f7568762bfc56dcfe2940 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 18 Oct 2009 15:54:39 -0700 Subject: r300g: Fix up a bunch of warnings. --- src/gallium/drivers/r300/r300_emit.c | 24 +++++++++++------------- src/gallium/drivers/r300/r300_emit.h | 1 + src/gallium/drivers/r300/r300_flush.c | 2 ++ src/gallium/drivers/r300/r300_screen.c | 2 +- src/gallium/drivers/r300/r300_state.c | 4 ++-- src/gallium/drivers/r300/r300_state_derived.c | 10 ++++------ 6 files changed, 21 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index e6092cda9b..df2046bd0c 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -320,8 +320,7 @@ void r300_emit_fb_state(struct r300_context* r300, END_CS; } -void r300_emit_query_start(struct r300_context *r300) - +static void r300_emit_query_start(struct r300_context *r300) { struct r300_capabilities *caps = r300_screen(r300->context.screen)->caps; struct r300_query *query = r300->query_current; @@ -334,9 +333,9 @@ void r300_emit_query_start(struct r300_context *r300) * for overlapping queries. */ BEGIN_CS(4); if (caps->family == CHIP_FAMILY_RV530) { - OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL); + OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL); } else { - OUT_CS_REG(R300_SU_REG_DEST, R300_RASTER_PIPE_SELECT_ALL); + OUT_CS_REG(R300_SU_REG_DEST, R300_RASTER_PIPE_SELECT_ALL); } OUT_CS_REG(R300_ZB_ZPASS_DATA, 0); END_CS; @@ -345,7 +344,7 @@ void r300_emit_query_start(struct r300_context *r300) static void r300_emit_query_finish(struct r300_context *r300, - struct r300_query *query) + struct r300_query *query) { struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps; CS_LOCALS(r300); @@ -388,7 +387,7 @@ static void r300_emit_query_finish(struct r300_context *r300, OUT_CS_REG_SEQ(R300_ZB_ZPASS_ADDR, 1); OUT_CS_RELOC(r300->oqbo, query->offset + (sizeof(uint32_t) * 0), 0, RADEON_GEM_DOMAIN_GTT, 0); - break; + break; default: debug_printf("r300: Implementation error: Chipset reports %d" " pixel pipes!\n", caps->num_frag_pipes); @@ -398,11 +397,10 @@ static void r300_emit_query_finish(struct r300_context *r300, /* And, finally, reset it to normal... */ OUT_CS_REG(R300_SU_REG_DEST, 0xF); END_CS; - } static void rv530_emit_query_single(struct r300_context *r300, - struct r300_query *query) + struct r300_query *query) { CS_LOCALS(r300); @@ -415,7 +413,7 @@ static void rv530_emit_query_single(struct r300_context *r300, } static void rv530_emit_query_double(struct r300_context *r300, - struct r300_query *query) + struct r300_query *query) { CS_LOCALS(r300); @@ -442,10 +440,10 @@ void r300_emit_query_end(struct r300_context* r300) return; if (caps->family == CHIP_FAMILY_RV530) { - if (caps->num_z_pipes == 2) - rv530_emit_query_double(r300, query); - else - rv530_emit_query_single(r300, query); + if (caps->num_z_pipes == 2) + rv530_emit_query_double(r300, query); + else + rv530_emit_query_single(r300, query); } else r300_emit_query_finish(r300, query); } diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h index b62aa9fec5..7e469ea0c7 100644 --- a/src/gallium/drivers/r300/r300_emit.h +++ b/src/gallium/drivers/r300/r300_emit.h @@ -58,6 +58,7 @@ void r300_emit_fb_state(struct r300_context* r300, void r300_emit_query_begin(struct r300_context* r300, struct r300_query* query); + void r300_emit_query_end(struct r300_context* r300); void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs); diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c index 241ea71d6b..d60652a021 100644 --- a/src/gallium/drivers/r300/r300_flush.c +++ b/src/gallium/drivers/r300/r300_flush.c @@ -20,7 +20,9 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include "r300_emit.h" #include "r300_flush.h" +#include "r300_state_invariant.h" static void r300_flush(struct pipe_context* pipe, unsigned flags, diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 44770d1aca..cc499d400a 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -311,7 +311,7 @@ r300_get_tex_transfer(struct pipe_screen *screen, { struct r300_texture *tex = (struct r300_texture *)texture; struct r300_transfer *trans; - unsigned offset; /* in bytes */ + unsigned offset = 0; /* in bytes */ /* XXX Add support for these things */ if (texture->target == PIPE_TEXTURE_CUBE) { diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 8359850966..0a982a9d5d 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -329,7 +329,7 @@ static void r300_delete_fs_state(struct pipe_context* pipe, void* shader) { struct r300_fragment_shader* fs = (struct r300_fragment_shader*)shader; rc_constants_destroy(&fs->code.constants); - FREE(fs->state.tokens); + FREE((void*)fs->state.tokens); FREE(shader); } @@ -697,7 +697,7 @@ static void r300_delete_vs_state(struct pipe_context* pipe, void* shader) rc_constants_destroy(&vs->code.constants); draw_delete_vertex_shader(r300->draw, vs->draw); - FREE(vs->state.tokens); + FREE((void*)vs->state.tokens); FREE(shader); } else { draw_delete_vertex_shader(r300->draw, diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 2c624766bb..1468b9d36e 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -265,7 +265,9 @@ static void r300_vertex_psc(struct r300_context* r300, } /* Set the last vector in the PSC. */ - i--; + if (i) { + i -= 1; + } vformat->vap_prog_stream_cntl[i >> 1] |= (R300_LAST_VEC << (i & 1 ? 16 : 0)); } @@ -336,17 +338,14 @@ static void r300_update_fs_tab(struct r300_context* r300, * the rasterization of vertices into fragments. This is also the part of the * chipset that locks up if any part of it is even slightly wrong. */ static void r300_update_rs_block(struct r300_context* r300, - struct r300_vertex_format* vformat, struct r300_rs_block* rs) { struct tgsi_shader_info* info = &r300->fs->info; - int* tab = vformat->fs_tab; int col_count = 0, fp_offset = 0, i, tex_count = 0; int rs_tex_comp = 0; if (r300_screen(r300->context.screen)->caps->is_r500) { for (i = 0; i < info->num_inputs; i++) { - assert(tab[i] != -1); switch (info->input_semantic_name[i]) { case TGSI_SEMANTIC_COLOR: rs->ip[col_count] |= @@ -387,7 +386,6 @@ static void r300_update_rs_block(struct r300_context* r300, } } else { for (i = 0; i < info->num_inputs; i++) { - assert(tab[i] != -1); switch (info->input_semantic_name[i]) { case TGSI_SEMANTIC_COLOR: rs->ip[col_count] |= @@ -480,7 +478,7 @@ static void r300_update_derived_shader_state(struct r300_context* r300) r300_vertex_psc(r300, vformat); r300_update_fs_tab(r300, vformat); - r300_update_rs_block(r300, vformat, rs_block); + r300_update_rs_block(r300, rs_block); value->vformat = vformat; value->rs_block = rs_block; -- cgit v1.2.3 From 869d3eea37ee060d62cd5b7f6031ef5a93e328a1 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Wed, 7 Oct 2009 16:07:34 +1000 Subject: drm/nv50: write tic/tsc setup to correct slots when skipping units --- src/gallium/drivers/nv50/nv50_state_validate.c | 7 ++++--- src/gallium/drivers/nv50/nv50_tex.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index fd27620371..9079de918d 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -356,13 +356,14 @@ viewport_uptodate: if (nv50->dirty & NV50_NEW_SAMPLER) { int i; - so = so_new(nv50->sampler_nr * 9 + 2, 0); - so_method(so, tesla, NV50TCL_CB_ADDR, 1); - so_data (so, NV50_CB_TSC); + so = so_new(nv50->sampler_nr * 11, 0); for (i = 0; i < nv50->sampler_nr; i++) { if (!nv50->sampler[i]) continue; + so_method(so, tesla, NV50TCL_CB_ADDR, 1); + so_data (so, ((i * 8) << NV50TCL_CB_ADDR_ID_SHIFT) | + NV50_CB_TSC); so_method(so, tesla, NV50TCL_CB_DATA(0) | (2<<29), 8); so_datap (so, nv50->sampler[i]->tsc, 8); } diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index 72d33150af..ca2b883e9b 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -148,18 +148,19 @@ nv50_tex_validate(struct nv50_context *nv50) struct nouveau_stateobj *so; int unit, push; - push = nv50->miptree_nr * 9 + 2; + push = nv50->miptree_nr * 11; push += MAX2(nv50->miptree_nr, nv50->state.miptree_nr) * 2; so = so_new(push, nv50->miptree_nr * 2); - so_method(so, tesla, NV50TCL_CB_ADDR, 1); - so_data (so, NV50_CB_TIC); for (unit = 0; unit < nv50->miptree_nr; unit++) { struct nv50_miptree *mt = nv50->miptree[unit]; if (!mt) continue; + so_method(so, tesla, NV50TCL_CB_ADDR, 1); + so_data (so, ((unit * 8) << NV50TCL_CB_ADDR_ID_SHIFT) | + NV50_CB_TIC); so_method(so, tesla, NV50TCL_CB_DATA(0) | 0x40000000, 8); if (nv50_tex_construct(nv50, so, mt, unit)) { NOUVEAU_ERR("failed tex validate\n"); -- cgit v1.2.3 From 35b98e2884bd7c76c43fa08d5bb0a8f1396d3298 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Mon, 19 Oct 2009 09:28:59 +1000 Subject: nouveau: implement is_{texture,buffer}_referenced properly --- src/gallium/drivers/nouveau/Makefile | 3 +- src/gallium/drivers/nouveau/nouveau_context.c | 41 +++++++++++++++++++++++++++ src/gallium/drivers/nouveau/nouveau_context.h | 11 +++++++ src/gallium/drivers/nv04/nv04_context.c | 28 ++---------------- src/gallium/drivers/nv04/nv04_context.h | 1 + src/gallium/drivers/nv10/nv10_context.c | 27 ++---------------- src/gallium/drivers/nv10/nv10_context.h | 1 + src/gallium/drivers/nv20/nv20_context.c | 28 ++---------------- src/gallium/drivers/nv20/nv20_context.h | 1 + src/gallium/drivers/nv30/nv30_context.c | 35 ++--------------------- src/gallium/drivers/nv30/nv30_context.h | 1 + src/gallium/drivers/nv40/nv40_context.c | 35 ++--------------------- src/gallium/drivers/nv40/nv40_context.h | 1 + src/gallium/drivers/nv50/nv50_context.c | 27 ++---------------- src/gallium/drivers/nv50/nv50_context.h | 1 + 15 files changed, 72 insertions(+), 169 deletions(-) create mode 100644 src/gallium/drivers/nouveau/nouveau_context.c create mode 100644 src/gallium/drivers/nouveau/nouveau_context.h (limited to 'src') diff --git a/src/gallium/drivers/nouveau/Makefile b/src/gallium/drivers/nouveau/Makefile index dbe8a6e7bf..0cb66041d5 100644 --- a/src/gallium/drivers/nouveau/Makefile +++ b/src/gallium/drivers/nouveau/Makefile @@ -3,6 +3,7 @@ include $(TOP)/configs/current LIBNAME = nouveau -C_SOURCES = nouveau_screen.c +C_SOURCES = nouveau_screen.c \ + nouveau_context.c include ../../Makefile.template diff --git a/src/gallium/drivers/nouveau/nouveau_context.c b/src/gallium/drivers/nouveau/nouveau_context.c new file mode 100644 index 0000000000..23443869e6 --- /dev/null +++ b/src/gallium/drivers/nouveau/nouveau_context.c @@ -0,0 +1,41 @@ +#include +#include + +#include "nouveau/nouveau_screen.h" +#include "nouveau/nouveau_context.h" + +#include "nouveau/nouveau_bo.h" + +static unsigned int +nouveau_reference_flags(struct nouveau_bo *bo) +{ + uint32_t bo_flags; + int flags = 0; + + bo_flags = nouveau_bo_pending(bo); + if (bo_flags & NOUVEAU_BO_RD) + flags |= PIPE_REFERENCED_FOR_READ; + if (bo_flags & NOUVEAU_BO_WR) + flags |= PIPE_REFERENCED_FOR_WRITE; + + return flags; +} + +unsigned int +nouveau_is_texture_referenced(struct pipe_context *pipe, + struct pipe_texture *pt, + unsigned face, unsigned level) +{ + struct nouveau_miptree *mt = nouveau_miptree(pt); + + return nouveau_reference_flags(mt->bo); +} + +unsigned int +nouveau_is_buffer_referenced(struct pipe_context *pipe, struct pipe_buffer *pb) +{ + struct nouveau_bo *bo = nouveau_bo(pb); + + return nouveau_reference_flags(bo); +} + diff --git a/src/gallium/drivers/nouveau/nouveau_context.h b/src/gallium/drivers/nouveau/nouveau_context.h new file mode 100644 index 0000000000..6a28d40da7 --- /dev/null +++ b/src/gallium/drivers/nouveau/nouveau_context.h @@ -0,0 +1,11 @@ +#ifndef __NOUVEAU_CONTEXT_H__ +#define __NOUVEAU_CONTEXT_H__ + +unsigned int +nouveau_is_texture_referenced(struct pipe_context *, struct pipe_texture *, + unsigned face, unsigned level); + +unsigned int +nouveau_is_buffer_referenced(struct pipe_context *, struct pipe_buffer *); + +#endif diff --git a/src/gallium/drivers/nv04/nv04_context.c b/src/gallium/drivers/nv04/nv04_context.c index 17166c9f51..10d984ace9 100644 --- a/src/gallium/drivers/nv04/nv04_context.c +++ b/src/gallium/drivers/nv04/nv04_context.c @@ -64,30 +64,6 @@ nv04_init_hwctx(struct nv04_context *nv04) return TRUE; } -static unsigned int -nv04_is_texture_referenced( struct pipe_context *pipe, - struct pipe_texture *texture, - unsigned face, unsigned level) -{ - /** - * FIXME: Optimize. - */ - - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -} - -static unsigned int -nv04_is_buffer_referenced( struct pipe_context *pipe, - struct pipe_buffer *buf) -{ - /** - * FIXME: Optimize. - */ - - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -} - - struct pipe_context * nv04_create(struct pipe_screen *pscreen, unsigned pctx_id) { @@ -113,8 +89,8 @@ nv04_create(struct pipe_screen *pscreen, unsigned pctx_id) nv04->pipe.clear = nv04_clear; nv04->pipe.flush = nv04_flush; - nv04->pipe.is_texture_referenced = nv04_is_texture_referenced; - nv04->pipe.is_buffer_referenced = nv04_is_buffer_referenced; + nv04->pipe.is_texture_referenced = nouveau_is_texture_referenced; + nv04->pipe.is_buffer_referenced = nouveau_is_buffer_referenced; nv04_init_surface_functions(nv04); nv04_init_state_functions(nv04); diff --git a/src/gallium/drivers/nv04/nv04_context.h b/src/gallium/drivers/nv04/nv04_context.h index 2842b2c90d..55326c787a 100644 --- a/src/gallium/drivers/nv04/nv04_context.h +++ b/src/gallium/drivers/nv04/nv04_context.h @@ -13,6 +13,7 @@ #include "nouveau/nouveau_winsys.h" #include "nouveau/nouveau_gldefs.h" +#include "nouveau/nouveau_context.h" #define NOUVEAU_PUSH_CONTEXT(ctx) \ struct nv04_screen *ctx = nv04->screen diff --git a/src/gallium/drivers/nv10/nv10_context.c b/src/gallium/drivers/nv10/nv10_context.c index a127b134ec..933176fc32 100644 --- a/src/gallium/drivers/nv10/nv10_context.c +++ b/src/gallium/drivers/nv10/nv10_context.c @@ -257,29 +257,6 @@ nv10_set_edgeflags(struct pipe_context *pipe, const unsigned *bitfield) { } -static unsigned int -nv10_is_texture_referenced( struct pipe_context *pipe, - struct pipe_texture *texture, - unsigned face, unsigned level) -{ - /** - * FIXME: Optimize. - */ - - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -} - -static unsigned int -nv10_is_buffer_referenced( struct pipe_context *pipe, - struct pipe_buffer *buf) -{ - /** - * FIXME: Optimize. - */ - - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -} - struct pipe_context * nv10_create(struct pipe_screen *pscreen, unsigned pctx_id) { @@ -305,8 +282,8 @@ nv10_create(struct pipe_screen *pscreen, unsigned pctx_id) nv10->pipe.clear = nv10_clear; nv10->pipe.flush = nv10_flush; - nv10->pipe.is_texture_referenced = nv10_is_texture_referenced; - nv10->pipe.is_buffer_referenced = nv10_is_buffer_referenced; + nv10->pipe.is_texture_referenced = nouveau_is_texture_referenced; + nv10->pipe.is_buffer_referenced = nouveau_is_buffer_referenced; nv10_init_surface_functions(nv10); nv10_init_state_functions(nv10); diff --git a/src/gallium/drivers/nv10/nv10_context.h b/src/gallium/drivers/nv10/nv10_context.h index f1e003c953..36a6aa7a74 100644 --- a/src/gallium/drivers/nv10/nv10_context.h +++ b/src/gallium/drivers/nv10/nv10_context.h @@ -13,6 +13,7 @@ #include "nouveau/nouveau_winsys.h" #include "nouveau/nouveau_gldefs.h" +#include "nouveau/nouveau_context.h" #define NOUVEAU_PUSH_CONTEXT(ctx) \ struct nv10_screen *ctx = nv10->screen diff --git a/src/gallium/drivers/nv20/nv20_context.c b/src/gallium/drivers/nv20/nv20_context.c index b32d0d83ba..9a48739661 100644 --- a/src/gallium/drivers/nv20/nv20_context.c +++ b/src/gallium/drivers/nv20/nv20_context.c @@ -380,30 +380,6 @@ nv20_set_edgeflags(struct pipe_context *pipe, const unsigned *bitfield) { } - -static unsigned int -nv20_is_texture_referenced( struct pipe_context *pipe, - struct pipe_texture *texture, - unsigned face, unsigned level) -{ - /** - * FIXME: Optimize. - */ - - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -} - -static unsigned int -nv20_is_buffer_referenced( struct pipe_context *pipe, - struct pipe_buffer *buf) -{ - /** - * FIXME: Optimize. - */ - - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -} - struct pipe_context * nv20_create(struct pipe_screen *pscreen, unsigned pctx_id) { @@ -429,8 +405,8 @@ nv20_create(struct pipe_screen *pscreen, unsigned pctx_id) nv20->pipe.clear = nv20_clear; nv20->pipe.flush = nv20_flush; - nv20->pipe.is_texture_referenced = nv20_is_texture_referenced; - nv20->pipe.is_buffer_referenced = nv20_is_buffer_referenced; + nv20->pipe.is_texture_referenced = nouveau_is_texture_referenced; + nv20->pipe.is_buffer_referenced = nouveau_is_buffer_referenced; nv20_init_surface_functions(nv20); nv20_init_state_functions(nv20); diff --git a/src/gallium/drivers/nv20/nv20_context.h b/src/gallium/drivers/nv20/nv20_context.h index fc932f1f90..a4eaa95660 100644 --- a/src/gallium/drivers/nv20/nv20_context.h +++ b/src/gallium/drivers/nv20/nv20_context.h @@ -13,6 +13,7 @@ #include "nouveau/nouveau_winsys.h" #include "nouveau/nouveau_gldefs.h" +#include "nouveau/nouveau_context.h" #define NOUVEAU_PUSH_CONTEXT(ctx) \ struct nv20_screen *ctx = nv20->screen diff --git a/src/gallium/drivers/nv30/nv30_context.c b/src/gallium/drivers/nv30/nv30_context.c index a3e65b96f7..d8300fd69f 100644 --- a/src/gallium/drivers/nv30/nv30_context.c +++ b/src/gallium/drivers/nv30/nv30_context.c @@ -31,37 +31,6 @@ nv30_destroy(struct pipe_context *pipe) FREE(nv30); } -static unsigned int -nv30_is_texture_referenced( struct pipe_context *pipe, - struct pipe_texture *texture, - unsigned face, unsigned level) -{ - /** - * FIXME: Return the corrent result. We can't alays return referenced - * since it causes a double flush within the vbo module. - */ -#if 0 - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -#else - return 0; -#endif -} - -static unsigned int -nv30_is_buffer_referenced( struct pipe_context *pipe, - struct pipe_buffer *buf) -{ - /** - * FIXME: Return the corrent result. We can't alays return referenced - * since it causes a double flush within the vbo module. - */ -#if 0 - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -#else - return 0; -#endif -} - struct pipe_context * nv30_create(struct pipe_screen *pscreen, unsigned pctx_id) { @@ -86,8 +55,8 @@ nv30_create(struct pipe_screen *pscreen, unsigned pctx_id) nv30->pipe.clear = nv30_clear; nv30->pipe.flush = nv30_flush; - nv30->pipe.is_texture_referenced = nv30_is_texture_referenced; - nv30->pipe.is_buffer_referenced = nv30_is_buffer_referenced; + nv30->pipe.is_texture_referenced = nouveau_is_texture_referenced; + nv30->pipe.is_buffer_referenced = nouveau_is_buffer_referenced; nv30_init_query_functions(nv30); nv30_init_surface_functions(nv30); diff --git a/src/gallium/drivers/nv30/nv30_context.h b/src/gallium/drivers/nv30/nv30_context.h index 4229c0a0e1..8d49366dfc 100644 --- a/src/gallium/drivers/nv30/nv30_context.h +++ b/src/gallium/drivers/nv30/nv30_context.h @@ -13,6 +13,7 @@ #include "nouveau/nouveau_winsys.h" #include "nouveau/nouveau_gldefs.h" +#include "nouveau/nouveau_context.h" #define NOUVEAU_PUSH_CONTEXT(ctx) \ struct nv30_screen *ctx = nv30->screen diff --git a/src/gallium/drivers/nv40/nv40_context.c b/src/gallium/drivers/nv40/nv40_context.c index 4e23671202..7f008274a4 100644 --- a/src/gallium/drivers/nv40/nv40_context.c +++ b/src/gallium/drivers/nv40/nv40_context.c @@ -31,37 +31,6 @@ nv40_destroy(struct pipe_context *pipe) FREE(nv40); } -static unsigned int -nv40_is_texture_referenced( struct pipe_context *pipe, - struct pipe_texture *texture, - unsigned face, unsigned level) -{ - /** - * FIXME: Return the correct result. We can't always return referenced - * since it causes a double flush within the vbo module. - */ -#if 0 - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -#else - return 0; -#endif -} - -static unsigned int -nv40_is_buffer_referenced( struct pipe_context *pipe, - struct pipe_buffer *buf) -{ - /** - * FIXME: Return the correct result. We can't always return referenced - * since it causes a double flush within the vbo module. - */ -#if 0 - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -#else - return 0; -#endif -} - struct pipe_context * nv40_create(struct pipe_screen *pscreen, unsigned pctx_id) { @@ -86,8 +55,8 @@ nv40_create(struct pipe_screen *pscreen, unsigned pctx_id) nv40->pipe.clear = nv40_clear; nv40->pipe.flush = nv40_flush; - nv40->pipe.is_texture_referenced = nv40_is_texture_referenced; - nv40->pipe.is_buffer_referenced = nv40_is_buffer_referenced; + nv40->pipe.is_texture_referenced = nouveau_is_texture_referenced; + nv40->pipe.is_buffer_referenced = nouveau_is_buffer_referenced; nv40_init_query_functions(nv40); nv40_init_surface_functions(nv40); diff --git a/src/gallium/drivers/nv40/nv40_context.h b/src/gallium/drivers/nv40/nv40_context.h index 97bc83292d..a3d594167a 100644 --- a/src/gallium/drivers/nv40/nv40_context.h +++ b/src/gallium/drivers/nv40/nv40_context.h @@ -13,6 +13,7 @@ #include "nouveau/nouveau_winsys.h" #include "nouveau/nouveau_gldefs.h" +#include "nouveau/nouveau_context.h" #define NOUVEAU_PUSH_CONTEXT(ctx) \ struct nv40_screen *ctx = nv40->screen diff --git a/src/gallium/drivers/nv50/nv50_context.c b/src/gallium/drivers/nv50/nv50_context.c index fca078b174..7ef27bb671 100644 --- a/src/gallium/drivers/nv50/nv50_context.c +++ b/src/gallium/drivers/nv50/nv50_context.c @@ -60,29 +60,6 @@ nv50_set_edgeflags(struct pipe_context *pipe, const unsigned *bitfield) { } -static unsigned int -nv50_is_texture_referenced( struct pipe_context *pipe, - struct pipe_texture *texture, - unsigned face, unsigned level) -{ - /** - * FIXME: Optimize. - */ - - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -} - -static unsigned int -nv50_is_buffer_referenced( struct pipe_context *pipe, - struct pipe_buffer *buf) -{ - /** - * FIXME: Optimize. - */ - - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -} - struct pipe_context * nv50_create(struct pipe_screen *pscreen, unsigned pctx_id) { @@ -108,8 +85,8 @@ nv50_create(struct pipe_screen *pscreen, unsigned pctx_id) nv50->pipe.flush = nv50_flush; - nv50->pipe.is_texture_referenced = nv50_is_texture_referenced; - nv50->pipe.is_buffer_referenced = nv50_is_buffer_referenced; + nv50->pipe.is_texture_referenced = nouveau_is_texture_referenced; + nv50->pipe.is_buffer_referenced = nouveau_is_buffer_referenced; screen->base.channel->user_private = nv50; screen->base.channel->flush_notify = nv50_state_flush_notify; diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index 4608854d71..fd2dab856d 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -14,6 +14,7 @@ #include "nouveau/nouveau_winsys.h" #include "nouveau/nouveau_gldefs.h" #include "nouveau/nouveau_stateobj.h" +#include "nouveau/nouveau_context.h" #include "nv50_screen.h" #include "nv50_program.h" -- cgit v1.2.3 From 6ab2fcca9d40ed65ab8d88c0253969c5311b7320 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 10 Oct 2009 13:18:07 +0200 Subject: nv50: nicer texture format switch Similar to nv40. --- src/gallium/drivers/nv50/nv50_tex.c | 144 ++++++++++++------------------------ 1 file changed, 49 insertions(+), 95 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index ca2b883e9b..81e04327e8 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -25,106 +25,60 @@ #include "nouveau/nouveau_stateobj.h" +#define _(pf, tt, r, g, b, a, tf) \ +{ \ + PIPE_FORMAT_##pf, \ + NV50TIC_0_0_MAPR_##r | NV50TIC_0_0_TYPER_##tt | \ + NV50TIC_0_0_MAPG_##g | NV50TIC_0_0_TYPEG_##tt | \ + NV50TIC_0_0_MAPB_##b | NV50TIC_0_0_TYPEB_##tt | \ + NV50TIC_0_0_MAPA_##a | NV50TIC_0_0_TYPEA_##tt | \ + NV50TIC_0_0_FMT_##tf \ +} + +struct nv50_texture_format { + enum pipe_format pf; + uint32_t hw; +}; + +#define NV50_TEX_FORMAT_LIST_SIZE \ + (sizeof(nv50_tex_format_list) / sizeof(struct nv50_texture_format)) + +static const struct nv50_texture_format nv50_tex_format_list[] = +{ + _(A8R8G8B8_UNORM, UNORM, C2, C1, C0, C3, 8_8_8_8), + _(X8R8G8B8_UNORM, UNORM, C2, C1, C0, ONE, 8_8_8_8), + _(A1R5G5B5_UNORM, UNORM, C2, C1, C0, C3, 1_5_5_5), + _(A4R4G4B4_UNORM, UNORM, C2, C1, C0, C3, 4_4_4_4), + + _(R5G6B5_UNORM, UNORM, C2, C1, C0, ONE, 5_6_5), + + _(L8_UNORM, UNORM, C0, C0, C0, ONE, 8), + _(A8_UNORM, UNORM, ZERO, ZERO, ZERO, C0, 8), + _(I8_UNORM, UNORM, C0, C0, C0, C0, 8), + + _(A8L8_UNORM, UNORM, C0, C0, C0, C1, 8_8), + + _(DXT1_RGB, UNORM, C0, C1, C2, ONE, DXT1), + _(DXT1_RGBA, UNORM, C0, C1, C2, C3, DXT1), + _(DXT3_RGBA, UNORM, C0, C1, C2, C3, DXT3), + _(DXT5_RGBA, UNORM, C0, C1, C2, C3, DXT5) +}; + +#undef _ + static int nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so, struct nv50_miptree *mt, int unit) { - switch (mt->base.base.format) { - case PIPE_FORMAT_A8R8G8B8_UNORM: - so_data(so, NV50TIC_0_0_MAPA_C3 | NV50TIC_0_0_TYPEA_UNORM | - NV50TIC_0_0_MAPR_C2 | NV50TIC_0_0_TYPER_UNORM | - NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM | - NV50TIC_0_0_MAPB_C0 | NV50TIC_0_0_TYPEB_UNORM | - NV50TIC_0_0_FMT_8_8_8_8); - break; - case PIPE_FORMAT_X8R8G8B8_UNORM: - so_data(so, NV50TIC_0_0_MAPA_ONE | NV50TIC_0_0_TYPEA_UNORM | - NV50TIC_0_0_MAPR_C2 | NV50TIC_0_0_TYPER_UNORM | - NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM | - NV50TIC_0_0_MAPB_C0 | NV50TIC_0_0_TYPEB_UNORM | - NV50TIC_0_0_FMT_8_8_8_8); - break; - case PIPE_FORMAT_A1R5G5B5_UNORM: - so_data(so, NV50TIC_0_0_MAPA_C3 | NV50TIC_0_0_TYPEA_UNORM | - NV50TIC_0_0_MAPR_C2 | NV50TIC_0_0_TYPER_UNORM | - NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM | - NV50TIC_0_0_MAPB_C0 | NV50TIC_0_0_TYPEB_UNORM | - NV50TIC_0_0_FMT_1_5_5_5); - break; - case PIPE_FORMAT_A4R4G4B4_UNORM: - so_data(so, NV50TIC_0_0_MAPA_C3 | NV50TIC_0_0_TYPEA_UNORM | - NV50TIC_0_0_MAPR_C2 | NV50TIC_0_0_TYPER_UNORM | - NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM | - NV50TIC_0_0_MAPB_C0 | NV50TIC_0_0_TYPEB_UNORM | - NV50TIC_0_0_FMT_4_4_4_4); - break; - case PIPE_FORMAT_R5G6B5_UNORM: - so_data(so, NV50TIC_0_0_MAPA_ONE | NV50TIC_0_0_TYPEA_UNORM | - NV50TIC_0_0_MAPR_C2 | NV50TIC_0_0_TYPER_UNORM | - NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM | - NV50TIC_0_0_MAPB_C0 | NV50TIC_0_0_TYPEB_UNORM | - NV50TIC_0_0_FMT_5_6_5); - break; - case PIPE_FORMAT_L8_UNORM: - so_data(so, NV50TIC_0_0_MAPA_ONE | NV50TIC_0_0_TYPEA_UNORM | - NV50TIC_0_0_MAPR_C0 | NV50TIC_0_0_TYPER_UNORM | - NV50TIC_0_0_MAPG_C0 | NV50TIC_0_0_TYPEG_UNORM | - NV50TIC_0_0_MAPB_C0 | NV50TIC_0_0_TYPEB_UNORM | - NV50TIC_0_0_FMT_8); - break; - case PIPE_FORMAT_A8_UNORM: - so_data(so, NV50TIC_0_0_MAPA_C0 | NV50TIC_0_0_TYPEA_UNORM | - NV50TIC_0_0_MAPR_ZERO | NV50TIC_0_0_TYPER_UNORM | - NV50TIC_0_0_MAPG_ZERO | NV50TIC_0_0_TYPEG_UNORM | - NV50TIC_0_0_MAPB_ZERO | NV50TIC_0_0_TYPEB_UNORM | - NV50TIC_0_0_FMT_8); - break; - case PIPE_FORMAT_I8_UNORM: - so_data(so, NV50TIC_0_0_MAPA_C0 | NV50TIC_0_0_TYPEA_UNORM | - NV50TIC_0_0_MAPR_C0 | NV50TIC_0_0_TYPER_UNORM | - NV50TIC_0_0_MAPG_C0 | NV50TIC_0_0_TYPEG_UNORM | - NV50TIC_0_0_MAPB_C0 | NV50TIC_0_0_TYPEB_UNORM | - NV50TIC_0_0_FMT_8); - break; - case PIPE_FORMAT_A8L8_UNORM: - so_data(so, NV50TIC_0_0_MAPA_C1 | NV50TIC_0_0_TYPEA_UNORM | - NV50TIC_0_0_MAPR_C0 | NV50TIC_0_0_TYPER_UNORM | - NV50TIC_0_0_MAPG_C0 | NV50TIC_0_0_TYPEG_UNORM | - NV50TIC_0_0_MAPB_C0 | NV50TIC_0_0_TYPEB_UNORM | - NV50TIC_0_0_FMT_8_8); - break; - case PIPE_FORMAT_DXT1_RGB: - so_data(so, NV50TIC_0_0_MAPA_ONE | NV50TIC_0_0_TYPEA_UNORM | - NV50TIC_0_0_MAPR_C0 | NV50TIC_0_0_TYPER_UNORM | - NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM | - NV50TIC_0_0_MAPB_C2 | NV50TIC_0_0_TYPEB_UNORM | - NV50TIC_0_0_FMT_DXT1); - break; - case PIPE_FORMAT_DXT1_RGBA: - so_data(so, NV50TIC_0_0_MAPA_C3 | NV50TIC_0_0_TYPEA_UNORM | - NV50TIC_0_0_MAPR_C0 | NV50TIC_0_0_TYPER_UNORM | - NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM | - NV50TIC_0_0_MAPB_C2 | NV50TIC_0_0_TYPEB_UNORM | - NV50TIC_0_0_FMT_DXT1); - break; - case PIPE_FORMAT_DXT3_RGBA: - so_data(so, NV50TIC_0_0_MAPA_C3 | NV50TIC_0_0_TYPEA_UNORM | - NV50TIC_0_0_MAPR_C0 | NV50TIC_0_0_TYPER_UNORM | - NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM | - NV50TIC_0_0_MAPB_C2 | NV50TIC_0_0_TYPEB_UNORM | - NV50TIC_0_0_FMT_DXT3); - break; - case PIPE_FORMAT_DXT5_RGBA: - so_data(so, NV50TIC_0_0_MAPA_C3 | NV50TIC_0_0_TYPEA_UNORM | - NV50TIC_0_0_MAPR_C0 | NV50TIC_0_0_TYPER_UNORM | - NV50TIC_0_0_MAPG_C1 | NV50TIC_0_0_TYPEG_UNORM | - NV50TIC_0_0_MAPB_C2 | NV50TIC_0_0_TYPEB_UNORM | - NV50TIC_0_0_FMT_DXT5); - break; - default: - return 1; - } + unsigned i; + + for (i = 0; i < NV50_TEX_FORMAT_LIST_SIZE; i++) + if (nv50_tex_format_list[i].pf == mt->base.base.format) + break; + if (i == NV50_TEX_FORMAT_LIST_SIZE) + return 1; + so_data (so, nv50_tex_format_list[i].hw); so_reloc(so, mt->base.bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW | NOUVEAU_BO_RD, 0, 0); if (nv50->sampler[unit]->normalized) -- cgit v1.2.3 From fba2eabe13b8a3f8c1396c5949db3daab0192156 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 10 Oct 2009 13:13:16 +0200 Subject: nv50: use SIFC for TIC, TSC upload Add proper flushes for TIC and TSC and remove the costly 2D.0110 flush in nv50_flush. Correct TIC and TSC bo sizes. --- src/gallium/drivers/nv50/nv50_context.c | 7 ---- src/gallium/drivers/nv50/nv50_context.h | 5 +++ src/gallium/drivers/nv50/nv50_screen.c | 25 ++---------- src/gallium/drivers/nv50/nv50_state_validate.c | 54 ++++++++++++++++++++++---- src/gallium/drivers/nv50/nv50_tex.c | 34 +++++++++------- src/gallium/drivers/nv50/nv50_vbo.c | 4 -- 6 files changed, 77 insertions(+), 52 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_context.c b/src/gallium/drivers/nv50/nv50_context.c index 7ef27bb671..219e7a7862 100644 --- a/src/gallium/drivers/nv50/nv50_context.c +++ b/src/gallium/drivers/nv50/nv50_context.c @@ -33,13 +33,6 @@ nv50_flush(struct pipe_context *pipe, unsigned flags, { struct nv50_context *nv50 = nv50_context(pipe); struct nouveau_channel *chan = nv50->screen->base.channel; - struct nouveau_grobj *eng2d = nv50->screen->eng2d; - - /* We need this in the ddx for reliable composite, not sure what we're - * actually flushing. We generate all our own flushes with flags = 0. */ - WAIT_RING(chan, 2); - BEGIN_RING(chan, eng2d, 0x0110, 1); - OUT_RING (chan, 0); if (flags & PIPE_FLUSH_FRAME) FIRE_RING(chan); diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index fd2dab856d..75cb65d9a2 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -199,6 +199,11 @@ extern void nv50_program_destroy(struct nv50_context *nv50, struct nv50_program extern boolean nv50_state_validate(struct nv50_context *nv50); extern void nv50_state_flush_notify(struct nouveau_channel *chan); +extern void nv50_so_init_sifc(struct nv50_context *nv50, + struct nouveau_stateobj *so, + struct nouveau_bo *bo, unsigned reloc, + unsigned size); + /* nv50_tex.c */ extern void nv50_tex_validate(struct nv50_context *); diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index dd7baecba7..66361dc3ba 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -364,48 +364,31 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1); so_data (so, 0x00000131 | (NV50_CB_PFP << 12)); - /* Texture sampler/image unit setup - we abuse the constant buffer - * upload mechanism for the moment to upload data to the tex config - * blocks. At some point we *may* want to go the NVIDIA way of doing - * things? - */ - ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 32*8*4, &screen->tic); + ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 64*8*4, &screen->tic); if (ret) { nv50_screen_destroy(pscreen); return NULL; } - so_method(so, screen->tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3); - so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM | - NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0); - so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM | - NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0); - so_data (so, (NV50_CB_TIC << 16) | 0x0800); so_method(so, screen->tesla, NV50TCL_TIC_ADDRESS_HIGH, 3); so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0); so_reloc (so, screen->tic, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0); - so_data (so, 0x00000800); + so_data (so, 0x000007ff); - ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 32*8*4, &screen->tsc); + ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 64*8*4, &screen->tsc); if (ret) { nv50_screen_destroy(pscreen); return NULL; } - so_method(so, screen->tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3); - so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM | - NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0); - so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM | - NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0); - so_data (so, (NV50_CB_TSC << 16) | 0x0800); so_method(so, screen->tesla, NV50TCL_TSC_ADDRESS_HIGH, 3); so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0); so_reloc (so, screen->tsc, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0); - so_data (so, 0x00000800); + so_data (so, 0x00000000); /* Vertex array limits - max them out */ diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index 9079de918d..012911f41b 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -222,6 +222,9 @@ nv50_state_flush_notify(struct nouveau_channel *chan) { struct nv50_context *nv50 = chan->user_private; + if (nv50->state.tic_upload && !(nv50->dirty & NV50_NEW_TEXTURE)) + so_emit(chan, nv50->state.tic_upload); + so_emit_reloc_markers(chan, nv50->state.fb); so_emit_reloc_markers(chan, nv50->state.vertprog); so_emit_reloc_markers(chan, nv50->state.fragprog); @@ -233,6 +236,7 @@ boolean nv50_state_validate(struct nv50_context *nv50) { struct nouveau_grobj *tesla = nv50->screen->tesla; + struct nouveau_grobj *eng2d = nv50->screen->eng2d; struct nouveau_stateobj *so; unsigned i; @@ -354,19 +358,25 @@ scissor_uptodate: viewport_uptodate: if (nv50->dirty & NV50_NEW_SAMPLER) { - int i; + unsigned i; + + so = so_new(nv50->sampler_nr * 9 + 23 + 4, 2); + + nv50_so_init_sifc(nv50, so, nv50->screen->tsc, NOUVEAU_BO_VRAM, + nv50->sampler_nr * 8 * 4); - so = so_new(nv50->sampler_nr * 11, 0); for (i = 0; i < nv50->sampler_nr; i++) { if (!nv50->sampler[i]) continue; - - so_method(so, tesla, NV50TCL_CB_ADDR, 1); - so_data (so, ((i * 8) << NV50TCL_CB_ADDR_ID_SHIFT) | - NV50_CB_TSC); - so_method(so, tesla, NV50TCL_CB_DATA(0) | (2<<29), 8); + so_method(so, eng2d, NV50_2D_SIFC_DATA | (2 << 29), 8); so_datap (so, nv50->sampler[i]->tsc, 8); } + + so_method(so, tesla, 0x1440, 1); /* sync SIFC */ + so_data (so, 0); + so_method(so, tesla, 0x1334, 1); /* flush TSC */ + so_data (so, 0); + so_ref(so, &nv50->state.tsc_upload); so_ref(NULL, &so); } @@ -384,3 +394,33 @@ viewport_uptodate: return TRUE; } +void nv50_so_init_sifc(struct nv50_context *nv50, + struct nouveau_stateobj *so, + struct nouveau_bo *bo, unsigned reloc, unsigned size) +{ + struct nouveau_grobj *eng2d = nv50->screen->eng2d; + + so_method(so, eng2d, NV50_2D_DST_FORMAT, 2); + so_data (so, NV50_2D_DST_FORMAT_R8_UNORM); + so_data (so, 1); + so_method(so, eng2d, NV50_2D_DST_PITCH, 5); + so_data (so, 262144); + so_data (so, 65536); + so_data (so, 1); + so_reloc (so, bo, 0, reloc | NOUVEAU_BO_WR | NOUVEAU_BO_HIGH, 0, 0); + so_reloc (so, bo, 0, reloc | NOUVEAU_BO_WR | NOUVEAU_BO_LOW, 0, 0); + so_method(so, eng2d, NV50_2D_SIFC_UNK0800, 2); + so_data (so, 0); + so_data (so, NV50_2D_SIFC_FORMAT_R8_UNORM); + so_method(so, eng2d, NV50_2D_SIFC_WIDTH, 10); + so_data (so, size); + so_data (so, 1); + so_data (so, 0); + so_data (so, 1); + so_data (so, 0); + so_data (so, 1); + so_data (so, 0); + so_data (so, 0); + so_data (so, 0); + so_data (so, 0); +} diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index 81e04327e8..e12a6ad648 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -98,24 +98,24 @@ nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so, void nv50_tex_validate(struct nv50_context *nv50) { + struct nouveau_grobj *eng2d = nv50->screen->eng2d; struct nouveau_grobj *tesla = nv50->screen->tesla; struct nouveau_stateobj *so; - int unit, push; + unsigned i, unit, push; - push = nv50->miptree_nr * 11; - push += MAX2(nv50->miptree_nr, nv50->state.miptree_nr) * 2; + push = MAX2(nv50->miptree_nr, nv50->state.miptree_nr) * 2 + 23 + 6; + so = so_new(nv50->miptree_nr * 9 + push, nv50->miptree_nr + 2); - so = so_new(push, nv50->miptree_nr * 2); - for (unit = 0; unit < nv50->miptree_nr; unit++) { + nv50_so_init_sifc(nv50, so, nv50->screen->tic, NOUVEAU_BO_VRAM, + nv50->miptree_nr * 8 * 4); + + for (i = 0, unit = 0; unit < nv50->miptree_nr; ++unit) { struct nv50_miptree *mt = nv50->miptree[unit]; if (!mt) continue; - so_method(so, tesla, NV50TCL_CB_ADDR, 1); - so_data (so, ((unit * 8) << NV50TCL_CB_ADDR_ID_SHIFT) | - NV50_CB_TIC); - so_method(so, tesla, NV50TCL_CB_DATA(0) | 0x40000000, 8); + so_method(so, eng2d, NV50_2D_SIFC_DATA | (2 << 29), 8); if (nv50_tex_construct(nv50, so, mt, unit)) { NOUVEAU_ERR("failed tex validate\n"); so_ref(NULL, &so); @@ -123,17 +123,25 @@ nv50_tex_validate(struct nv50_context *nv50) } so_method(so, tesla, NV50TCL_SET_SAMPLER_TEX, 1); - so_data (so, (unit << NV50TCL_SET_SAMPLER_TEX_TIC_SHIFT) | - (unit << NV50TCL_SET_SAMPLER_TEX_SAMPLER_SHIFT) | - NV50TCL_SET_SAMPLER_TEX_VALID); + so_data (so, (i++ << NV50TCL_SET_SAMPLER_TEX_TIC_SHIFT) | + (unit << NV50TCL_SET_SAMPLER_TEX_SAMPLER_SHIFT) | + NV50TCL_SET_SAMPLER_TEX_VALID); } for (; unit < nv50->state.miptree_nr; unit++) { so_method(so, tesla, NV50TCL_SET_SAMPLER_TEX, 1); so_data (so, - (unit << NV50TCL_SET_SAMPLER_TEX_SAMPLER_SHIFT) | 0); + (unit << NV50TCL_SET_SAMPLER_TEX_SAMPLER_SHIFT) | 0); } + /* not sure if the following really do what I think: */ + so_method(so, tesla, 0x1440, 1); /* sync SIFC */ + so_data (so, 0); + so_method(so, tesla, 0x1330, 1); /* flush TIC */ + so_data (so, 0); + so_method(so, tesla, 0x1338, 1); /* flush texture caches */ + so_data (so, 0x20); + so_ref(so, &nv50->state.tic_upload); so_ref(NULL, &so); nv50->state.miptree_nr = nv50->miptree_nr; diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c index eeed148c7b..8b0fbf0e76 100644 --- a/src/gallium/drivers/nv50/nv50_vbo.c +++ b/src/gallium/drivers/nv50/nv50_vbo.c @@ -139,10 +139,6 @@ nv50_draw_arrays(struct pipe_context *pipe, unsigned mode, unsigned start, OUT_RING (chan, 0); BEGIN_RING(chan, tesla, 0x142c, 1); OUT_RING (chan, 0); - BEGIN_RING(chan, tesla, 0x1440, 1); - OUT_RING (chan, 0); - BEGIN_RING(chan, tesla, 0x1334, 1); - OUT_RING (chan, 0); BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BEGIN, 1); OUT_RING (chan, nv50_prim(mode)); -- cgit v1.2.3 From c0e80cf0e97cec526bb2ff0f94d9142e33374c20 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Wed, 14 Oct 2009 21:23:29 +0200 Subject: nv50: submit user vbo data through the fifo Requesting a new real buffer from the kernel and copying all the data is wasteful e.g. if only a few (but widely spread) vertices are accessed. --- src/gallium/drivers/nv50/nv50_context.h | 3 + src/gallium/drivers/nv50/nv50_vbo.c | 409 ++++++++++++++++++++++++++++++-- 2 files changed, 394 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index 75cb65d9a2..33667e8765 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -121,6 +121,7 @@ struct nv50_state { struct nouveau_stateobj *vtxfmt; struct nouveau_stateobj *vtxbuf; struct nouveau_stateobj *vtxattr; + unsigned vtxelt_nr; }; struct nv50_context { @@ -153,6 +154,8 @@ struct nv50_context { unsigned sampler_nr; struct nv50_miptree *miptree[PIPE_MAX_SAMPLERS]; unsigned miptree_nr; + + uint16_t vbo_fifo; }; static INLINE struct nv50_context * diff --git a/src/gallium/drivers/nv50/nv50_vbo.c b/src/gallium/drivers/nv50/nv50_vbo.c index 8b0fbf0e76..db54380241 100644 --- a/src/gallium/drivers/nv50/nv50_vbo.c +++ b/src/gallium/drivers/nv50/nv50_vbo.c @@ -26,6 +26,18 @@ #include "nv50_context.h" +static boolean +nv50_push_elements_u08(struct nv50_context *, uint8_t *, unsigned); + +static boolean +nv50_push_elements_u16(struct nv50_context *, uint16_t *, unsigned); + +static boolean +nv50_push_elements_u32(struct nv50_context *, uint32_t *, unsigned); + +static boolean +nv50_push_arrays(struct nv50_context *, unsigned, unsigned); + static INLINE unsigned nv50_prim(unsigned mode) { @@ -132,6 +144,7 @@ nv50_draw_arrays(struct pipe_context *pipe, unsigned mode, unsigned start, struct nv50_context *nv50 = nv50_context(pipe); struct nouveau_channel *chan = nv50->screen->tesla->channel; struct nouveau_grobj *tesla = nv50->screen->tesla; + boolean ret; nv50_state_validate(nv50); @@ -142,17 +155,22 @@ nv50_draw_arrays(struct pipe_context *pipe, unsigned mode, unsigned start, BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BEGIN, 1); OUT_RING (chan, nv50_prim(mode)); - BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BUFFER_FIRST, 2); - OUT_RING (chan, start); - OUT_RING (chan, count); + + if (nv50->vbo_fifo) + ret = nv50_push_arrays(nv50, start, count); + else { + BEGIN_RING(chan, tesla, NV50TCL_VERTEX_BUFFER_FIRST, 2); + OUT_RING (chan, start); + OUT_RING (chan, count); + ret = TRUE; + } BEGIN_RING(chan, tesla, NV50TCL_VERTEX_END, 1); OUT_RING (chan, 0); - pipe->flush(pipe, 0, NULL); - return TRUE; + return ret; } -static INLINE void +static INLINE boolean nv50_draw_elements_inline_u08(struct nv50_context *nv50, uint8_t *map, unsigned start, unsigned count) { @@ -161,6 +179,9 @@ nv50_draw_elements_inline_u08(struct nv50_context *nv50, uint8_t *map, map += start; + if (nv50->vbo_fifo) + return nv50_push_elements_u08(nv50, map, count); + if (count & 1) { BEGIN_RING(chan, tesla, 0x15e8, 1); OUT_RING (chan, map[0]); @@ -179,9 +200,10 @@ nv50_draw_elements_inline_u08(struct nv50_context *nv50, uint8_t *map, count -= nr; map += nr; } + return TRUE; } -static INLINE void +static INLINE boolean nv50_draw_elements_inline_u16(struct nv50_context *nv50, uint16_t *map, unsigned start, unsigned count) { @@ -190,6 +212,9 @@ nv50_draw_elements_inline_u16(struct nv50_context *nv50, uint16_t *map, map += start; + if (nv50->vbo_fifo) + return nv50_push_elements_u16(nv50, map, count); + if (count & 1) { BEGIN_RING(chan, tesla, 0x15e8, 1); OUT_RING (chan, map[0]); @@ -208,9 +233,10 @@ nv50_draw_elements_inline_u16(struct nv50_context *nv50, uint16_t *map, count -= nr; map += nr; } + return TRUE; } -static INLINE void +static INLINE boolean nv50_draw_elements_inline_u32(struct nv50_context *nv50, uint32_t *map, unsigned start, unsigned count) { @@ -219,6 +245,9 @@ nv50_draw_elements_inline_u32(struct nv50_context *nv50, uint32_t *map, map += start; + if (nv50->vbo_fifo) + return nv50_push_elements_u32(nv50, map, count); + while (count) { unsigned nr = count > 2047 ? 2047 : count; @@ -228,6 +257,7 @@ nv50_draw_elements_inline_u32(struct nv50_context *nv50, uint32_t *map, count -= nr; map += nr; } + return TRUE; } boolean @@ -240,6 +270,7 @@ nv50_draw_elements(struct pipe_context *pipe, struct nouveau_grobj *tesla = nv50->screen->tesla; struct pipe_screen *pscreen = pipe->screen; void *map; + boolean ret; map = pipe_buffer_map(pscreen, indexBuffer, PIPE_BUFFER_USAGE_CPU_READ); @@ -254,23 +285,25 @@ nv50_draw_elements(struct pipe_context *pipe, OUT_RING (chan, nv50_prim(mode)); switch (indexSize) { case 1: - nv50_draw_elements_inline_u08(nv50, map, start, count); + ret = nv50_draw_elements_inline_u08(nv50, map, start, count); break; case 2: - nv50_draw_elements_inline_u16(nv50, map, start, count); + ret = nv50_draw_elements_inline_u16(nv50, map, start, count); break; case 4: - nv50_draw_elements_inline_u32(nv50, map, start, count); + ret = nv50_draw_elements_inline_u32(nv50, map, start, count); break; default: assert(0); + ret = FALSE; + break; } BEGIN_RING(chan, tesla, NV50TCL_VERTEX_END, 1); OUT_RING (chan, 0); pipe_buffer_unmap(pscreen, indexBuffer); - pipe->flush(pipe, 0, NULL); - return TRUE; + + return ret; } static INLINE boolean @@ -337,17 +370,24 @@ nv50_vbo_validate(struct nv50_context *nv50) { struct nouveau_grobj *tesla = nv50->screen->tesla; struct nouveau_stateobj *vtxbuf, *vtxfmt, *vtxattr; - unsigned i; + unsigned i, n_ve; /* don't validate if Gallium took away our buffers */ if (nv50->vtxbuf_nr == 0) return; + nv50->vbo_fifo = 0; + + for (i = 0; i < nv50->vtxbuf_nr; ++i) + if (nv50->vtxbuf[i].stride && + !(nv50->vtxbuf[i].buffer->usage & PIPE_BUFFER_USAGE_VERTEX)) + nv50->vbo_fifo = 0xffff; + + n_ve = MAX2(nv50->vtxelt_nr, nv50->state.vtxelt_nr); vtxattr = NULL; - vtxbuf = so_new(nv50->vtxelt_nr * 7, nv50->vtxelt_nr * 4); - vtxfmt = so_new(nv50->vtxelt_nr + 1, 0); - so_method(vtxfmt, tesla, NV50TCL_VERTEX_ARRAY_ATTRIB(0), - nv50->vtxelt_nr); + vtxbuf = so_new(n_ve * 7, nv50->vtxelt_nr * 4); + vtxfmt = so_new(n_ve + 1, 0); + so_method(vtxfmt, tesla, NV50TCL_VERTEX_ARRAY_ATTRIB(0), n_ve); for (i = 0; i < nv50->vtxelt_nr; i++) { struct pipe_vertex_element *ve = &nv50->vtxelt[i]; @@ -363,10 +403,19 @@ nv50_vbo_validate(struct nv50_context *nv50) so_method(vtxbuf, tesla, NV50TCL_VERTEX_ARRAY_FORMAT(i), 1); so_data (vtxbuf, 0); + + nv50->vbo_fifo &= ~(1 << i); continue; } so_data(vtxfmt, hw | i); + if (nv50->vbo_fifo) { + so_method(vtxbuf, tesla, + NV50TCL_VERTEX_ARRAY_FORMAT(i), 1); + so_data (vtxbuf, 0); + continue; + } + so_method(vtxbuf, tesla, NV50TCL_VERTEX_ARRAY_FORMAT(i), 3); so_data (vtxbuf, 0x20000000 | vb->stride); so_reloc (vtxbuf, bo, vb->buffer_offset + @@ -385,6 +434,13 @@ nv50_vbo_validate(struct nv50_context *nv50) NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0); } + for (; i < n_ve; ++i) { + so_data (vtxfmt, 0x7e080010); + + so_method(vtxbuf, tesla, NV50TCL_VERTEX_ARRAY_FORMAT(i), 1); + so_data (vtxbuf, 0); + } + nv50->state.vtxelt_nr = nv50->vtxelt_nr; so_ref (vtxfmt, &nv50->state.vtxfmt); so_ref (vtxbuf, &nv50->state.vtxbuf); @@ -394,3 +450,320 @@ nv50_vbo_validate(struct nv50_context *nv50) so_ref (NULL, &vtxattr); } +typedef void (*pfn_push)(struct nouveau_channel *, void *); + +struct nv50_vbo_emitctx +{ + pfn_push push[16]; + void *map[16]; + unsigned stride[16]; + unsigned nr_ve; + unsigned vtx_dwords; + unsigned vtx_max; +}; + +static INLINE void +emit_vtx_next(struct nouveau_channel *chan, struct nv50_vbo_emitctx *emit) +{ + unsigned i; + + for (i = 0; i < emit->nr_ve; ++i) { + emit->push[i](chan, emit->map[i]); + emit->map[i] += emit->stride[i]; + } +} + +static INLINE void +emit_vtx(struct nouveau_channel *chan, struct nv50_vbo_emitctx *emit, + uint32_t vi) +{ + unsigned i; + + for (i = 0; i < emit->nr_ve; ++i) + emit->push[i](chan, emit->map[i] + emit->stride[i] * vi); +} + +static INLINE boolean +nv50_map_vbufs(struct nv50_context *nv50) +{ + int i; + + for (i = 0; i < nv50->vtxbuf_nr; ++i) { + struct pipe_vertex_buffer *vb = &nv50->vtxbuf[i]; + unsigned size, delta; + + if (nouveau_bo(vb->buffer)->map) + continue; + + size = vb->stride * (vb->max_index + 1); + delta = vb->buffer_offset; + + if (!size) + size = vb->buffer->size - vb->buffer_offset; + + if (nouveau_bo_map_range(nouveau_bo(vb->buffer), + delta, size, NOUVEAU_BO_RD)) + break; + } + + if (i == nv50->vtxbuf_nr) + return TRUE; + for (; i >= 0; --i) + nouveau_bo_unmap(nouveau_bo(nv50->vtxbuf[i].buffer)); + return FALSE; +} + +static INLINE void +nv50_unmap_vbufs(struct nv50_context *nv50) +{ + unsigned i; + + for (i = 0; i < nv50->vtxbuf_nr; ++i) + if (nouveau_bo(nv50->vtxbuf[i].buffer)->map) + nouveau_bo_unmap(nouveau_bo(nv50->vtxbuf[i].buffer)); +} + +static void +emit_b32_1(struct nouveau_channel *chan, void *data) +{ + uint32_t *v = data; + + OUT_RING(chan, v[0]); +} + +static void +emit_b32_2(struct nouveau_channel *chan, void *data) +{ + uint32_t *v = data; + + OUT_RING(chan, v[0]); + OUT_RING(chan, v[1]); +} + +static void +emit_b32_3(struct nouveau_channel *chan, void *data) +{ + uint32_t *v = data; + + OUT_RING(chan, v[0]); + OUT_RING(chan, v[1]); + OUT_RING(chan, v[2]); +} + +static void +emit_b32_4(struct nouveau_channel *chan, void *data) +{ + uint32_t *v = data; + + OUT_RING(chan, v[0]); + OUT_RING(chan, v[1]); + OUT_RING(chan, v[2]); + OUT_RING(chan, v[3]); +} + +static void +emit_b16_1(struct nouveau_channel *chan, void *data) +{ + uint16_t *v = data; + + OUT_RING(chan, v[0]); +} + +static void +emit_b16_3(struct nouveau_channel *chan, void *data) +{ + uint16_t *v = data; + + OUT_RING(chan, (v[1] << 16) | v[0]); + OUT_RING(chan, v[2]); +} + +static void +emit_b08_1(struct nouveau_channel *chan, void *data) +{ + uint8_t *v = data; + + OUT_RING(chan, v[0]); +} + +static void +emit_b08_3(struct nouveau_channel *chan, void *data) +{ + uint8_t *v = data; + + OUT_RING(chan, (v[2] << 16) | (v[1] << 8) | v[0]); +} + +static boolean +emit_prepare(struct nv50_context *nv50, struct nv50_vbo_emitctx *emit, + unsigned start) +{ + unsigned i; + + if (nv50_map_vbufs(nv50) == FALSE) + return FALSE; + + emit->nr_ve = 0; + emit->vtx_dwords = 0; + + for (i = 0; i < nv50->vtxelt_nr; ++i) { + struct pipe_vertex_element *ve; + struct pipe_vertex_buffer *vb; + unsigned n, type, size; + + ve = &nv50->vtxelt[i]; + vb = &nv50->vtxbuf[ve->vertex_buffer_index]; + if (!(nv50->vbo_fifo & (1 << i))) + continue; + n = emit->nr_ve++; + + emit->stride[n] = vb->stride; + emit->map[n] = nouveau_bo(vb->buffer)->map + + (start * vb->stride + ve->src_offset); + + type = pf_type(ve->src_format); + size = pf_size_x(ve->src_format) << pf_exp2(ve->src_format); + + assert(ve->nr_components > 0 && ve->nr_components <= 4); + + /* It shouldn't be necessary to push the implicit 1s + * for case 3 and size 8 cases 1, 2, 3. + */ + switch (size) { + default: + NOUVEAU_ERR("unsupported vtxelt size: %u\n", size); + return FALSE; + case 32: + switch (ve->nr_components) { + case 1: emit->push[n] = emit_b32_1; break; + case 2: emit->push[n] = emit_b32_2; break; + case 3: emit->push[n] = emit_b32_3; break; + case 4: emit->push[n] = emit_b32_4; break; + } + emit->vtx_dwords += ve->nr_components; + break; + case 16: + switch (ve->nr_components) { + case 1: emit->push[n] = emit_b16_1; break; + case 2: emit->push[n] = emit_b32_1; break; + case 3: emit->push[n] = emit_b16_3; break; + case 4: emit->push[n] = emit_b32_2; break; + } + emit->vtx_dwords += (ve->nr_components + 1) >> 1; + break; + case 8: + switch (ve->nr_components) { + case 1: emit->push[n] = emit_b08_1; break; + case 2: emit->push[n] = emit_b16_1; break; + case 3: emit->push[n] = emit_b08_3; break; + case 4: emit->push[n] = emit_b32_1; break; + } + emit->vtx_dwords += 1; + break; + } + } + + emit->vtx_max = 512 / emit->vtx_dwords; + + return TRUE; +} + +static boolean +nv50_push_arrays(struct nv50_context *nv50, unsigned start, unsigned count) +{ + struct nouveau_channel *chan = nv50->screen->base.channel; + struct nouveau_grobj *tesla = nv50->screen->tesla; + struct nv50_vbo_emitctx emit; + + if (emit_prepare(nv50, &emit, start) == FALSE) + return FALSE; + + while (count) { + unsigned i, dw, nr = MIN2(count, emit.vtx_max); + dw = nr * emit.vtx_dwords; + + BEGIN_RING(chan, tesla, NV50TCL_VERTEX_DATA | 0x40000000, dw); + for (i = 0; i < nr; ++i) + emit_vtx_next(chan, &emit); + + count -= nr; + } + nv50_unmap_vbufs(nv50); + + return TRUE; +} + +static boolean +nv50_push_elements_u32(struct nv50_context *nv50, uint32_t *map, unsigned count) +{ + struct nouveau_channel *chan = nv50->screen->base.channel; + struct nouveau_grobj *tesla = nv50->screen->tesla; + struct nv50_vbo_emitctx emit; + + if (emit_prepare(nv50, &emit, 0) == FALSE) + return FALSE; + + while (count) { + unsigned i, dw, nr = MIN2(count, emit.vtx_max); + dw = nr * emit.vtx_dwords; + + BEGIN_RING(chan, tesla, NV50TCL_VERTEX_DATA | 0x40000000, dw); + for (i = 0; i < nr; ++i) + emit_vtx(chan, &emit, *map++); + + count -= nr; + } + nv50_unmap_vbufs(nv50); + + return TRUE; +} + +static boolean +nv50_push_elements_u16(struct nv50_context *nv50, uint16_t *map, unsigned count) +{ + struct nouveau_channel *chan = nv50->screen->base.channel; + struct nouveau_grobj *tesla = nv50->screen->tesla; + struct nv50_vbo_emitctx emit; + + if (emit_prepare(nv50, &emit, 0) == FALSE) + return FALSE; + + while (count) { + unsigned i, dw, nr = MIN2(count, emit.vtx_max); + dw = nr * emit.vtx_dwords; + + BEGIN_RING(chan, tesla, NV50TCL_VERTEX_DATA | 0x40000000, dw); + for (i = 0; i < nr; ++i) + emit_vtx(chan, &emit, *map++); + + count -= nr; + } + nv50_unmap_vbufs(nv50); + + return TRUE; +} + +static boolean +nv50_push_elements_u08(struct nv50_context *nv50, uint8_t *map, unsigned count) +{ + struct nouveau_channel *chan = nv50->screen->base.channel; + struct nouveau_grobj *tesla = nv50->screen->tesla; + struct nv50_vbo_emitctx emit; + + if (emit_prepare(nv50, &emit, 0) == FALSE) + return FALSE; + + while (count) { + unsigned i, dw, nr = MIN2(count, emit.vtx_max); + dw = nr * emit.vtx_dwords; + + BEGIN_RING(chan, tesla, NV50TCL_VERTEX_DATA | 0x40000000, dw); + for (i = 0; i < nr; ++i) + emit_vtx(chan, &emit, *map++); + + count -= nr; + } + nv50_unmap_vbufs(nv50); + + return TRUE; +} -- cgit v1.2.3 From 1635e8d6f4b96e691746e8c8c5a273089bae6843 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Wed, 14 Oct 2009 21:27:35 +0200 Subject: nv50: add support for DDX and DDY opcodes --- src/gallium/drivers/nv50/nv50_program.c | 70 ++++++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 576d075318..89e0ac8db9 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -837,7 +837,7 @@ emit_precossin(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src) #define CVTOP_SAT 0x08 #define CVTOP_ABS 0x10 -/* 0x04 == 32 bit */ +/* 0x04 == 32 bit dst */ /* 0x40 == dst is float */ /* 0x80 == src is float */ #define CVT_F32_F32 0xc4 @@ -858,7 +858,7 @@ emit_cvt(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src, set_long(pc, e); e->inst[0] |= 0xa0000000; - e->inst[1] |= 0x00004000; + e->inst[1] |= 0x00004000; /* 32 bit src */ e->inst[1] |= (cvn << 16); e->inst[1] |= (fmt << 24); set_src_0(pc, src, e); @@ -1037,20 +1037,10 @@ emit_lit(struct nv50_pc *pc, struct nv50_reg **dst, unsigned mask, FREE(one); } -static void +static INLINE void emit_neg(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src) { - struct nv50_program_exec *e = exec(pc); - - set_long(pc, e); - e->inst[0] |= 0xa0000000; /* delta */ - e->inst[1] |= (7 << 29); /* delta */ - e->inst[1] |= 0x04000000; /* negate arg0? probably not */ - e->inst[1] |= (1 << 14); /* src .f32 */ - set_dst(pc, dst, e); - set_src_0(pc, src, e); - - emit(pc, e); + emit_cvt(pc, dst, src, -1, CVTOP_RN, CVT_F32_F32 | CVT_NEG); } static void @@ -1218,6 +1208,43 @@ emit_nop(struct nv50_pc *pc) emit(pc, e); } +static void +emit_ddx(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src) +{ + struct nv50_program_exec *e = exec(pc); + + assert(src->type == P_TEMP); + + e->inst[0] = 0xc0140000; + e->inst[1] = 0x89800000; + set_long(pc, e); + set_dst(pc, dst, e); + set_src_0(pc, src, e); + set_src_2(pc, src, e); + + emit(pc, e); +} + +static void +emit_ddy(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src) +{ + struct nv50_program_exec *e = exec(pc); + + assert(src->type == P_TEMP); + + if (!src->neg) /* ! double negation */ + emit_neg(pc, src, src); + + e->inst[0] = 0xc0150000; + e->inst[1] = 0x8a400000; + set_long(pc, e); + set_dst(pc, dst, e); + set_src_0(pc, src, e); + set_src_2(pc, src, e); + + emit(pc, e); +} + static void convert_to_long(struct nv50_pc *pc, struct nv50_program_exec *e) { @@ -1270,6 +1297,7 @@ static boolean negate_supported(const struct tgsi_full_instruction *insn, int i) { switch (insn->Instruction.Opcode) { + case TGSI_OPCODE_DDY: case TGSI_OPCODE_DP3: case TGSI_OPCODE_DP4: case TGSI_OPCODE_MUL: @@ -1660,6 +1688,20 @@ nv50_program_tx_insn(struct nv50_pc *pc, emit_precossin(pc, temp, src[0][0]); emit_flop(pc, 5, brdc, temp); break; + case TGSI_OPCODE_DDX: + for (c = 0; c < 4; c++) { + if (!(mask & (1 << c))) + continue; + emit_ddx(pc, dst[c], src[0][c]); + } + break; + case TGSI_OPCODE_DDY: + for (c = 0; c < 4; c++) { + if (!(mask & (1 << c))) + continue; + emit_ddy(pc, dst[c], src[0][c]); + } + break; case TGSI_OPCODE_DP3: emit_mul(pc, temp, src[0][0], src[1][0]); emit_mad(pc, temp, src[0][1], src[1][1], temp); -- cgit v1.2.3 From f204eb184237b387432413212a3a20d83c87594b Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Tue, 13 Oct 2009 15:09:13 +0200 Subject: nv50: quick fix for insn src negation We only have a per nv50_reg negation flag, if an nv50_reg is used more than once in a TGSI op with different sign modes, we'd generate wrong code. We probably can't do much better without more invasive changes. --- src/gallium/drivers/nv50/nv50_program.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 89e0ac8db9..1bd6f717d1 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -1293,9 +1293,12 @@ convert_to_long(struct nv50_pc *pc, struct nv50_program_exec *e) e->inst[1] |= q; } +/* Some operations support an optional negation flag. */ static boolean negate_supported(const struct tgsi_full_instruction *insn, int i) { + int s; + switch (insn->Instruction.Opcode) { case TGSI_OPCODE_DDY: case TGSI_OPCODE_DP3: @@ -1305,12 +1308,29 @@ negate_supported(const struct tgsi_full_instruction *insn, int i) case TGSI_OPCODE_ADD: case TGSI_OPCODE_SUB: case TGSI_OPCODE_MAD: - return TRUE; + break; case TGSI_OPCODE_POW: - return (i == 1) ? TRUE : FALSE; + if (i == 1) + break; + return FALSE; default: return FALSE; } + + /* Watch out for possible multiple uses of an nv50_reg, we + * can't use nv50_reg::neg in these cases. + */ + for (s = 0; s < insn->Instruction.NumSrcRegs; ++s) { + if (s == i) + continue; + if ((insn->FullSrcRegisters[s].SrcRegister.Index == + insn->FullSrcRegisters[i].SrcRegister.Index) && + (insn->FullSrcRegisters[s].SrcRegister.File == + insn->FullSrcRegisters[i].SrcRegister.File)) + return FALSE; + } + + return TRUE; } /* Return a read mask for source registers deduced from opcode & write mask. */ @@ -1956,6 +1976,7 @@ nv50_program_tx_insn(struct nv50_pc *pc, for (c = 0; c < 4; c++) { if (!src[i][c]) continue; + src[i][c]->neg = 0; if (src[i][c]->index == -1 && src[i][c]->type == P_IMMD) FREE(src[i][c]); } -- cgit v1.2.3 From 2eef2017acbbb617c559555648c7745141f3aedb Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Mon, 19 Oct 2009 17:47:29 +0200 Subject: nv50: implement TGSI_OPCODE_CMP --- src/gallium/drivers/nv50/nv50_program.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 1bd6f717d1..3b7033b518 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -506,11 +506,13 @@ emit_mov(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src) { struct nv50_program_exec *e = exec(pc); - e->inst[0] |= 0x10000000; + e->inst[0] = 0x10000000; + if (!pc->allow32) + set_long(pc, e); set_dst(pc, dst, e); - if (pc->allow32 && dst->type != P_RESULT && src->type == P_IMMD) { + if (!is_long(e) && src->type == P_IMMD) { set_immd(pc, src, e); /*XXX: 32-bit, but steals part of "half" reg space - need to * catch and handle this case if/when we do half-regs @@ -1696,6 +1698,18 @@ nv50_program_tx_insn(struct nv50_pc *pc, CVTOP_CEIL, CVT_F32_F32 | CVT_RI); } break; + case TGSI_OPCODE_CMP: + pc->allow32 = FALSE; + for (c = 0; c < 4; c++) { + if (!(mask & (1 << c))) + continue; + emit_cvt(pc, NULL, src[0][c], 1, CVTOP_RN, CVT_F32_F32); + emit_mov(pc, dst[c], src[1][c]); + set_pred(pc, 0x1, 1, pc->p->exec_tail); /* @SF */ + emit_mov(pc, dst[c], src[2][c]); + set_pred(pc, 0x6, 1, pc->p->exec_tail); /* @NSF */ + } + break; case TGSI_OPCODE_COS: if (mask & 8) { emit_precossin(pc, temp, src[0][3]); -- cgit v1.2.3 From eb7ea97e7fff1ee39921ad81294c4963b5b3ded8 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Mon, 19 Oct 2009 17:53:31 +0200 Subject: nv50: cleanup emit_kil --- src/gallium/drivers/nv50/nv50_program.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 3b7033b518..bfd979ce0f 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -1050,22 +1050,18 @@ emit_kil(struct nv50_pc *pc, struct nv50_reg *src) { struct nv50_program_exec *e; const int r_pred = 1; + unsigned cvn = CVT_F32_F32; - /* Sets predicate reg ? */ - e = exec(pc); - e->inst[0] = 0xa00001fd; - e->inst[1] = 0xc4014788; - set_src_0(pc, src, e); - set_pred_wr(pc, 1, r_pred, e); if (src->neg) - e->inst[1] |= 0x20000000; - emit(pc, e); + cvn |= CVT_NEG; + /* write predicate reg */ + emit_cvt(pc, NULL, src, r_pred, CVTOP_RN, cvn); - /* This is probably KILP */ + /* conditional discard */ e = exec(pc); - e->inst[0] = 0x000001fe; + e->inst[0] = 0x00000002; set_long(pc, e); - set_pred(pc, 1 /* LT? */, r_pred, e); + set_pred(pc, 0x1 /* LT */, r_pred, e); emit(pc, e); } -- cgit v1.2.3 From ec5c23551cdb4c369d8f8f392208f4d4bf29911b Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Mon, 19 Oct 2009 18:17:45 +0200 Subject: nv50: add support for address regs Allow indirect uniform access and increase the limit on parameters from 128 to 512. --- src/gallium/drivers/nv50/nv50_program.c | 178 ++++++++++++++++++++++++++++++-- src/gallium/drivers/nv50/nv50_screen.c | 10 +- 2 files changed, 175 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index bfd979ce0f..c7145bb9be 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -32,6 +32,7 @@ #include "nv50_context.h" #define NV50_SU_MAX_TEMP 64 +#define NV50_SU_MAX_ADDR 7 //#define NV50_PROGRAM_DUMP /* ARL - gallium craps itself on progs/vp/arl.txt @@ -79,7 +80,8 @@ struct nv50_reg { P_ATTR, P_RESULT, P_CONST, - P_IMMD + P_IMMD, + P_ADDR } type; int index; @@ -99,6 +101,7 @@ struct nv50_pc { /* hw resources */ struct nv50_reg *r_temp[NV50_SU_MAX_TEMP]; + struct nv50_reg r_addr[NV50_SU_MAX_ADDR]; /* tgsi resources */ struct nv50_reg *temp; @@ -112,6 +115,8 @@ struct nv50_pc { struct nv50_reg *immd; float *immd_buf; int immd_nr; + struct nv50_reg **addr; + int addr_nr; struct nv50_reg *temp_temp[16]; unsigned temp_temp_nr; @@ -158,6 +163,17 @@ popcnt4(uint32_t val) return cnt[val & 0xf]; } +static void +terminate_mbb(struct nv50_pc *pc) +{ + int i; + + /* remove records of temporary address register values */ + for (i = 0; i < NV50_SU_MAX_ADDR; ++i) + if (pc->r_addr[i].index < 0) + pc->r_addr[i].rhw = -1; +} + static void alloc_reg(struct nv50_pc *pc, struct nv50_reg *reg) { @@ -454,9 +470,68 @@ set_immd(struct nv50_pc *pc, struct nv50_reg *imm, struct nv50_program_exec *e) e->inst[1] |= (val >> 6) << 2; } +static void +emit_set_addr(struct nv50_pc *pc, struct nv50_reg *dst, unsigned val) +{ + struct nv50_program_exec *e = exec(pc); + + assert(val <= 0xffff); + e->inst[0] = 0xd0000000 | ((val & 0xffff) << 9); + e->inst[1] = 0x20000000; + e->inst[0] |= dst->hw << 2; + set_long(pc, e); + + emit(pc, e); +} + +static struct nv50_reg * +alloc_addr(struct nv50_pc *pc, struct nv50_reg *ref) +{ + int i; + struct nv50_reg *a = NULL; + + if (!ref) { + for (i = 0; i < NV50_SU_MAX_ADDR; ++i) { + if (pc->r_addr[i].index >= 0) + continue; + if (pc->r_addr[i].rhw >= 0 && + pc->r_addr[i].acc == pc->insn_cur) + continue; + + pc->r_addr[i].rhw = -1; + pc->r_addr[i].index = i; + return &pc->r_addr[i]; + } + assert(0); + return NULL; + } + + for (i = NV50_SU_MAX_ADDR - 1; i >= 0; --i) { + if (pc->r_addr[i].index >= 0) /* occupied for TGSI */ + continue; + if (pc->r_addr[i].rhw < 0) { /* unused */ + a = &pc->r_addr[i]; + continue; + } + if (!a && pc->r_addr[i].acc != pc->insn_cur) + a = &pc->r_addr[i]; + + if (ref->hw - pc->r_addr[i].rhw < 128) { + /* alloc'd & suitable */ + pc->r_addr[i].acc = pc->insn_cur; + return &pc->r_addr[i]; + } + } + assert(a); + emit_set_addr(pc, a, ref->hw * 4); + + a->rhw = ref->hw % 128; + a->acc = pc->insn_cur; + return a; +} #define INTERP_LINEAR 0 -#define INTERP_FLAT 1 +#define INTERP_FLAT 1 #define INTERP_PERSPECTIVE 2 #define INTERP_CENTROID 4 @@ -488,6 +563,16 @@ emit_interp(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *iv, emit(pc, e); } +static INLINE void +set_addr(struct nv50_program_exec *e, struct nv50_reg *a) +{ + assert(!(e->inst[0] & 0x0c000000)); + assert(!(e->inst[1] & 0x00000004)); + + e->inst[0] |= (a->hw & 3) << 26; + e->inst[1] |= (a->hw >> 2) << 2; +} + static void set_data(struct nv50_pc *pc, struct nv50_reg *src, unsigned m, unsigned s, struct nv50_program_exec *e) @@ -498,6 +583,14 @@ set_data(struct nv50_pc *pc, struct nv50_reg *src, unsigned m, unsigned s, e->param.shift = s; e->param.mask = m << (s % 32); + if (src->hw > 127) + set_addr(e, alloc_addr(pc, src)); + else + if (src->acc < 0) { + assert(src->type == P_CONST); + set_addr(e, pc->addr[src->index]); + } + e->inst[1] |= (((src->type == P_IMMD) ? 0 : 1) << 22); } @@ -632,7 +725,7 @@ set_src_1(struct nv50_pc *pc, struct nv50_reg *src, struct nv50_program_exec *e) } alloc_reg(pc, src); - e->inst[0] |= (src->hw << 16); + e->inst[0] |= ((src->hw & 127) << 16); } static void @@ -660,7 +753,7 @@ set_src_2(struct nv50_pc *pc, struct nv50_reg *src, struct nv50_program_exec *e) } alloc_reg(pc, src); - e->inst[1] |= (src->hw << 14); + e->inst[1] |= ((src->hw & 127) << 14); } static void @@ -722,6 +815,22 @@ emit_add(struct nv50_pc *pc, struct nv50_reg *dst, emit(pc, e); } +static void +emit_arl(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src, + uint8_t s) +{ + struct nv50_program_exec *e = exec(pc); + + set_long(pc, e); + e->inst[1] |= 0xc0000000; + + e->inst[0] |= dst->hw << 2; + e->inst[0] |= s << 16; /* shift left */ + set_src_0_restricted(pc, src, e); + + emit(pc, e); +} + static void emit_minmax(struct nv50_pc *pc, unsigned sub, struct nv50_reg *dst, struct nv50_reg *src0, struct nv50_reg *src1) @@ -1403,6 +1512,16 @@ tgsi_dst(struct nv50_pc *pc, int c, const struct tgsi_full_dst_register *dst) return &pc->temp[dst->DstRegister.Index * 4 + c]; case TGSI_FILE_OUTPUT: return &pc->result[dst->DstRegister.Index * 4 + c]; + case TGSI_FILE_ADDRESS: + { + struct nv50_reg *r = pc->addr[dst->DstRegister.Index * 4 + c]; + if (!r) { + r = alloc_addr(pc, NULL); + pc->addr[dst->DstRegister.Index * 4 + c] = r; + } + assert(r); + return r; + } case TGSI_FILE_NULL: return NULL; default: @@ -1418,7 +1537,10 @@ tgsi_src(struct nv50_pc *pc, int chan, const struct tgsi_full_src_register *src, { struct nv50_reg *r = NULL; struct nv50_reg *temp; - unsigned sgn, c; + unsigned sgn, c, swz; + + if (src->SrcRegister.File != TGSI_FILE_CONSTANT) + assert(!src->SrcRegister.Indirect); sgn = tgsi_util_get_full_src_register_sign_mode(src, chan); @@ -1436,13 +1558,29 @@ tgsi_src(struct nv50_pc *pc, int chan, const struct tgsi_full_src_register *src, r = &pc->temp[src->SrcRegister.Index * 4 + c]; break; case TGSI_FILE_CONSTANT: - r = &pc->param[src->SrcRegister.Index * 4 + c]; + if (!src->SrcRegister.Indirect) { + r = &pc->param[src->SrcRegister.Index * 4 + c]; + break; + } + /* Indicate indirection by setting r->acc < 0 and + * use the index field to select the address reg. + */ + r = MALLOC_STRUCT(nv50_reg); + swz = tgsi_util_get_src_register_swizzle( + &src->SrcRegisterInd, 0); + ctor_reg(r, P_CONST, + src->SrcRegisterInd.Index * 4 + swz, c); + r->acc = -1; break; case TGSI_FILE_IMMEDIATE: r = &pc->immd[src->SrcRegister.Index * 4 + c]; break; case TGSI_FILE_SAMPLER: break; + case TGSI_FILE_ADDRESS: + r = pc->addr[src->SrcRegister.Index * 4 + c]; + assert(r); + break; default: assert(0); break; @@ -1678,8 +1816,15 @@ nv50_program_tx_insn(struct nv50_pc *pc, emit_add(pc, dst[c], src[0][c], src[1][c]); } break; + case TGSI_OPCODE_ARL: + assert(src[0][0]); + temp = temp_temp(pc); + emit_cvt(pc, temp, src[0][0], -1, CVTOP_FLOOR, CVT_S32_F32); + emit_arl(pc, dst[0], temp, 4); + break; case TGSI_OPCODE_BGNLOOP: pc->loop_pos[pc->loop_lvl++] = pc->p->exec_size; + terminate_mbb(pc); break; case TGSI_OPCODE_BRK: emit_branch(pc, -1, 0, NULL); @@ -1763,6 +1908,7 @@ nv50_program_tx_insn(struct nv50_pc *pc, emit_branch(pc, -1, 0, NULL); pc->if_insn[--pc->if_lvl]->param.index = pc->p->exec_size; pc->if_insn[pc->if_lvl++] = pc->p->exec_tail; + terminate_mbb(pc); break; case TGSI_OPCODE_ENDIF: pc->if_insn[--pc->if_lvl]->param.index = pc->p->exec_size; @@ -1775,6 +1921,7 @@ nv50_program_tx_insn(struct nv50_pc *pc, pc->br_join[pc->if_lvl]->param.index = pc->p->exec_size; pc->br_join[pc->if_lvl] = NULL; } + terminate_mbb(pc); /* emit a NOP as join point, we could set it on the next * one, but would have to make sure it is long and !immd */ @@ -1785,6 +1932,7 @@ nv50_program_tx_insn(struct nv50_pc *pc, emit_branch(pc, -1, 0, NULL); pc->p->exec_tail->param.index = pc->loop_pos[--pc->loop_lvl]; pc->br_loop[pc->loop_lvl]->param.index = pc->p->exec_size; + terminate_mbb(pc); break; case TGSI_OPCODE_EX2: emit_preex2(pc, temp, src[0][0]); @@ -1812,6 +1960,7 @@ nv50_program_tx_insn(struct nv50_pc *pc, set_pred_wr(pc, 1, 0, pc->if_cond); emit_branch(pc, 0, 2, &pc->br_join[pc->if_lvl]); pc->if_insn[pc->if_lvl++] = pc->p->exec_tail; + terminate_mbb(pc); break; case TGSI_OPCODE_KIL: emit_kil(pc, src[0][0]); @@ -1989,6 +2138,9 @@ nv50_program_tx_insn(struct nv50_pc *pc, src[i][c]->neg = 0; if (src[i][c]->index == -1 && src[i][c]->type == P_IMMD) FREE(src[i][c]); + else + if (src[i][c]->acc < 0 && src[i][c]->type == P_CONST) + FREE(src[i][c]); /* indirect constant */ } } @@ -2332,8 +2484,8 @@ nv50_program_tx_prep(struct nv50_pc *pc) pc->interp_mode[i] = mode; } break; + case TGSI_FILE_ADDRESS: case TGSI_FILE_CONSTANT: - break; case TGSI_FILE_SAMPLER: break; default: @@ -2527,6 +2679,8 @@ ctor_nv50_pc(struct nv50_pc *pc, struct nv50_program *p) pc->attr_nr = p->info.file_max[TGSI_FILE_INPUT] + 1; pc->result_nr = p->info.file_max[TGSI_FILE_OUTPUT] + 1; pc->param_nr = p->info.file_max[TGSI_FILE_CONSTANT] + 1; + pc->addr_nr = p->info.file_max[TGSI_FILE_ADDRESS] + 1; + assert(pc->addr_nr <= 2); p->cfg.high_temp = 4; @@ -2595,6 +2749,14 @@ ctor_nv50_pc(struct nv50_pc *pc, struct nv50_program *p) ctor_reg(&pc->param[rid], P_CONST, i, rid); } + if (pc->addr_nr) { + pc->addr = CALLOC(pc->addr_nr * 4, sizeof(struct nv50_reg *)); + if (!pc->addr) + return FALSE; + } + for (i = 0; i < NV50_SU_MAX_ADDR; ++i) + ctor_reg(&pc->r_addr[i], P_ADDR, -1, i + 1); + return TRUE; } @@ -2774,7 +2936,7 @@ nv50_program_validate_data(struct nv50_context *nv50, struct nv50_program *p) p->immd_nr, NV50_CB_PMISC); } - assert(p->param_nr <= 128); + assert(p->param_nr <= 512); if (p->param_nr) { unsigned cb; diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index 66361dc3ba..0bd5487695 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -301,7 +301,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) so_data (so, 8); /* constant buffers for immediates and VP/FP parameters */ - ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 128*4*4, + ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, (32 * 4) * 4, &screen->constbuf_misc[0]); if (ret) { nv50_screen_destroy(pscreen); @@ -309,7 +309,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) } for (i = 0; i < 2; i++) { - ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, 128*4*4, + ret = nouveau_bo_new(dev, NOUVEAU_BO_VRAM, 0, (128 * 4) * 4, &screen->constbuf_parm[i]); if (ret) { nv50_screen_destroy(pscreen); @@ -318,8 +318,8 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) } if (nouveau_resource_init(&screen->immd_heap[0], 0, 128) || - nouveau_resource_init(&screen->parm_heap[0], 0, 128) || - nouveau_resource_init(&screen->parm_heap[1], 0, 128)) + nouveau_resource_init(&screen->parm_heap[0], 0, 512) || + nouveau_resource_init(&screen->parm_heap[1], 0, 512)) { NOUVEAU_ERR("Error initialising constant buffers.\n"); nv50_screen_destroy(pscreen); @@ -340,7 +340,7 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) NOUVEAU_BO_RD | NOUVEAU_BO_HIGH, 0, 0); so_reloc (so, screen->constbuf_misc[0], 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_RD | NOUVEAU_BO_LOW, 0, 0); - so_data (so, (NV50_CB_PMISC << 16) | 0x00000800); + so_data (so, (NV50_CB_PMISC << 16) | 0x00000200); so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1); so_data (so, 0x00000001 | (NV50_CB_PMISC << 12)); so_method(so, screen->tesla, NV50TCL_SET_PROGRAM_CB, 1); -- cgit v1.2.3 From 68b5dc9634a39b5aa84fe963676b4fd0249363cf Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 18 Oct 2009 07:50:14 +0200 Subject: st/xorg: Change how disable accel is handled --- src/gallium/state_trackers/xorg/xorg_exa.c | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 4988af4864..a1c07218cb 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -47,7 +47,7 @@ #define DEBUG_PRINT 0 #define DEBUG_SOLID 0 -#define DISABLE_ACCEL 0 +#define ACCEL_ENABLED TRUE /* * Helper functions @@ -307,11 +307,7 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) fg = 0xffff0000; #endif -#if DISABLE_ACCEL - return FALSE; -#else - return xorg_solid_bind_state(exa, priv, fg); -#endif + return ACCEL_ENABLED && xorg_solid_bind_state(exa, priv, fg); } static void @@ -409,11 +405,7 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, exa->copy.src = src_priv; exa->copy.dst = priv; -#if DISABLE_ACCEL - return FALSE; -#else - return TRUE; -#endif + return ACCEL_ENABLED; } static void @@ -484,16 +476,12 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, XORG_FALLBACK("pMask format: %s", pf_name(priv->tex->format)); } -#if DISABLE_ACCEL - (void) exa; - return FALSE; -#else - return xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture, + return ACCEL_ENABLED && + xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture, pDstPicture, pSrc ? exaGetPixmapDriverPrivate(pSrc) : NULL, pMask ? exaGetPixmapDriverPrivate(pMask) : NULL, exaGetPixmapDriverPrivate(pDst)); -#endif } static void @@ -526,10 +514,7 @@ ExaCheckComposite(int op, debug_printf("ExaCheckComposite(%d, %p, %p, %p) = %d\n", op, pSrcPicture, pMaskPicture, pDstPicture, accelerated); #endif -#if DISABLE_ACCEL - accelerated = FALSE; -#endif - return accelerated; + return ACCEL_ENABLED && accelerated; } static void * -- cgit v1.2.3 From b8843c60565094be311e3b31c0826a3035627a3e Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 18 Oct 2009 15:25:30 +0200 Subject: st/xorg: Support more then one output of a given type --- src/gallium/state_trackers/xorg/xorg_output.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_output.c b/src/gallium/state_trackers/xorg/xorg_output.c index 26f45f8d64..964d9595a9 100644 --- a/src/gallium/state_trackers/xorg/xorg_output.c +++ b/src/gallium/state_trackers/xorg/xorg_output.c @@ -56,17 +56,17 @@ static char *connector_enum_list[] = { "Unknown", "VGA", - "DVI-I", - "DVI-D", - "DVI-A", + "DVI", + "DVI", + "DVI", "Composite", "SVIDEO", "LVDS", - "Component", - "9-pin DIN", - "DisplayPort", - "HDMI Type A", - "HDMI Type B", + "CTV", + "DIN", + "DP", + "HDMI", + "HDMI", }; static void @@ -240,7 +240,7 @@ output_init(ScrnInfoPtr pScrn) drmModeResPtr res; drmModeConnectorPtr drm_connector = NULL; drmModeEncoderPtr drm_encoder = NULL; - char *name; + char name[32]; int c, v, p; res = drmModeGetResources(ms->fd); @@ -273,7 +273,10 @@ output_init(ScrnInfoPtr pScrn) (void)v; #endif - name = connector_enum_list[drm_connector->connector_type]; + snprintf(name, 32, "%s%d", + connector_enum_list[drm_connector->connector_type], + drm_connector->connector_type_id); + output = xf86OutputCreate(pScrn, &output_funcs, name); if (!output) -- cgit v1.2.3 From e9e6152cb38ca5f1ea6d65cf9bf32150bf9d2b7b Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 18 Oct 2009 11:46:19 +0200 Subject: st/xorg: Clean up cursor functions a bit --- src/gallium/state_trackers/xorg/xorg_crtc.c | 81 +++++++++++++++++------------ 1 file changed, 47 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index 67fe29a69d..6c6b6b5d1c 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -173,18 +173,23 @@ crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data) //ScrnInfoPtr pScrn = crtc->scrn; } +/* + * Cursor functions + */ + static void -crtc_destroy(xf86CrtcPtr crtc) +crtc_set_cursor_colors(xf86CrtcPtr crtc, int bg, int fg) { - struct crtc_private *crtcp = crtc->driver_private; +} - if (crtcp->cursor_tex) - pipe_texture_reference(&crtcp->cursor_tex, NULL); +static void +crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y) +{ + modesettingPtr ms = modesettingPTR(crtc->scrn); + struct crtc_private *crtcp = crtc->driver_private; - drmModeFreeCrtc(crtcp->drm_crtc); - xfree(crtcp); + drmModeMoveCursor(ms->fd, crtcp->drm_crtc->crtc_id, x, y); } - static void crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image) { @@ -229,15 +234,6 @@ crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image) ms->screen->tex_transfer_destroy(transfer); } -static void -crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y) -{ - modesettingPtr ms = modesettingPTR(crtc->scrn); - struct crtc_private *crtcp = crtc->driver_private; - - drmModeMoveCursor(ms->fd, crtcp->drm_crtc->crtc_id, x, y); -} - static void crtc_show_cursor(xf86CrtcPtr crtc) { @@ -258,38 +254,55 @@ crtc_hide_cursor(xf86CrtcPtr crtc) drmModeSetCursor(ms->fd, crtcp->drm_crtc->crtc_id, 0, 0, 0); } +void +crtc_cursor_destroy(xf86CrtcPtr crtc) +{ + struct crtc_private *crtcp = crtc->driver_private; + + if (crtcp->cursor_tex) { + pipe_texture_reference(&crtcp->cursor_tex, NULL); + } +} + +/* + * Misc functions + */ + +static void +crtc_destroy(xf86CrtcPtr crtc) +{ + struct crtc_private *crtcp = crtc->driver_private; + + if (crtcp->cursor_tex) + pipe_texture_reference(&crtcp->cursor_tex, NULL); + + drmModeFreeCrtc(crtcp->drm_crtc); + xfree(crtcp); +} + static const xf86CrtcFuncsRec crtc_funcs = { .dpms = crtc_dpms, - .save = NULL, - .restore = NULL, + .lock = crtc_lock, .unlock = crtc_unlock, .mode_fixup = crtc_mode_fixup, .prepare = crtc_prepare, .mode_set = crtc_mode_set, .commit = crtc_commit, - .gamma_set = crtc_gamma_set, - .shadow_create = crtc_shadow_create, - .shadow_allocate = crtc_shadow_allocate, - .shadow_destroy = crtc_shadow_destroy, + + .set_cursor_colors = crtc_set_cursor_colors, .set_cursor_position = crtc_set_cursor_position, .show_cursor = crtc_show_cursor, .hide_cursor = crtc_hide_cursor, - .load_cursor_image = NULL, /* lets convert to argb only */ - .set_cursor_colors = NULL, /* using argb only */ .load_cursor_argb = crtc_load_cursor_argb, - .destroy = crtc_destroy, -}; -void -crtc_cursor_destroy(xf86CrtcPtr crtc) -{ - struct crtc_private *crtcp = crtc->driver_private; + .shadow_create = crtc_shadow_create, + .shadow_allocate = crtc_shadow_allocate, + .shadow_destroy = crtc_shadow_destroy, - if (crtcp->cursor_tex) { - pipe_texture_reference(&crtcp->cursor_tex, NULL); - } -} + .gamma_set = crtc_gamma_set, + .destroy = crtc_destroy, +}; void crtc_init(ScrnInfoPtr pScrn) -- cgit v1.2.3 From 846da0bfdae971cba84cd2ad9217c74c62e6bce9 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 18 Oct 2009 15:42:25 +0200 Subject: st/xorg: Massivly redo root pixmap creation --- src/gallium/state_trackers/xorg/xorg_driver.c | 122 +++++++++++++++++-------- src/gallium/state_trackers/xorg/xorg_exa.c | 44 +++++++++ src/gallium/state_trackers/xorg/xorg_tracker.h | 9 ++ 3 files changed, 137 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index ab6c3d7558..24d3c23fa6 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -144,20 +144,22 @@ static Bool CreateFrontBuffer(ScrnInfoPtr pScrn) { modesettingPtr ms = modesettingPTR(pScrn); - ScreenPtr pScreen = pScrn->pScreen; - PixmapPtr rootPixmap = pScreen->GetScreenPixmap(pScreen); unsigned handle, stride; + struct pipe_texture *tex; ms->noEvict = TRUE; - xorg_exa_set_displayed_usage(rootPixmap); - pScreen->ModifyPixmapHeader(rootPixmap, - pScrn->virtualX, pScrn->virtualY, - pScrn->depth, pScrn->bitsPerPixel, - pScrn->displayWidth * pScrn->bitsPerPixel / 8, - NULL); - ms->noEvict = FALSE; - handle = xorg_exa_get_pixmap_handle(rootPixmap, &stride); + tex = xorg_exa_create_root_texture(pScrn, pScrn->virtualX, pScrn->virtualY, + pScrn->depth, pScrn->bitsPerPixel); + + if (!tex) + return FALSE; + + if (!ms->api->local_handle_from_texture(ms->api, ms->screen, + tex, + &stride, + &handle)) + return FALSE; drmModeAddFB(ms->fd, pScrn->virtualX, @@ -166,12 +168,39 @@ CreateFrontBuffer(ScrnInfoPtr pScrn) pScrn->bitsPerPixel, stride, handle, - &ms->fb_id); + &ms->fb_id); pScrn->frameX0 = 0; pScrn->frameY0 = 0; AdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + pipe_texture_reference(&ms->root_texture, tex); + pipe_texture_reference(&tex, NULL); + return TRUE; +} + +static Bool +BindTextureToRoot(ScrnInfoPtr pScrn) +{ + modesettingPtr ms = modesettingPTR(pScrn); + ScreenPtr pScreen = pScrn->pScreen; + struct pipe_texture *check; + PixmapPtr rootPixmap; + + rootPixmap = pScreen->GetScreenPixmap(pScreen); + + xorg_exa_set_displayed_usage(rootPixmap); + xorg_exa_set_shared_usage(rootPixmap); + xorg_exa_set_texture(rootPixmap, ms->root_texture); + if (!pScreen->ModifyPixmapHeader(rootPixmap, -1, -1, -1, -1, -1, NULL)) + FatalError("Couldn't adjust screen pixmap\n"); + + check = xorg_exa_get_texture(rootPixmap); + if (ms->root_texture != check) + FatalError("Created new root texture\n"); + + pipe_texture_reference(&check, NULL); + return TRUE; } @@ -179,10 +208,9 @@ static Bool crtc_resize(ScrnInfoPtr pScrn, int width, int height) { modesettingPtr ms = modesettingPTR(pScrn); - //ScreenPtr pScreen = pScrn->pScreen; - //PixmapPtr rootPixmap = pScreen->GetScreenPixmap(pScreen); - //Bool fbAccessDisabled; - //CARD8 *fbstart; + unsigned handle, stride; + PixmapPtr rootPixmap; + ScreenPtr pScreen = pScrn->pScreen; if (width == pScrn->virtualX && height == pScrn->virtualY) return TRUE; @@ -192,13 +220,40 @@ crtc_resize(ScrnInfoPtr pScrn, int width, int height) pScrn->virtualX = width; pScrn->virtualY = height; + /* + * Remove the old framebuffer & texture. + */ + drmModeRmFB(ms->fd, ms->fb_id); + pipe_texture_reference(&ms->root_texture, NULL); + + + rootPixmap = pScreen->GetScreenPixmap(pScreen); + if (!pScreen->ModifyPixmapHeader(rootPixmap, width, height, -1, -1, -1, NULL)) + return FALSE; + + /* takes one ref */ + ms->root_texture = xorg_exa_get_texture(rootPixmap); + + if (!ms->api->local_handle_from_texture(ms->api, ms->screen, + ms->root_texture, + &stride, + &handle)) + FatalError("Could not get handle and stride from texture\n"); + + drmModeAddFB(ms->fd, + pScrn->virtualX, + pScrn->virtualY, + pScrn->depth, + pScrn->bitsPerPixel, + stride, + handle, + &ms->fb_id); + /* HW dependent - FIXME */ pScrn->displayWidth = pScrn->virtualX; - drmModeRmFB(ms->fd, ms->fb_id); - /* now create new frontbuffer */ - return CreateFrontBuffer(pScrn); + return CreateFrontBuffer(pScrn) && BindTextureToRoot(pScrn); } static const xf86CrtcConfigFuncsRec crtc_config_funcs = { @@ -429,7 +484,6 @@ CreateScreenResources(ScreenPtr pScreen) modesettingPtr ms = modesettingPTR(pScrn); PixmapPtr rootPixmap; Bool ret; - unsigned handle, stride; ms->noEvict = TRUE; @@ -437,29 +491,14 @@ CreateScreenResources(ScreenPtr pScreen) ret = pScreen->CreateScreenResources(pScreen); pScreen->CreateScreenResources = CreateScreenResources; - rootPixmap = pScreen->GetScreenPixmap(pScreen); - - xorg_exa_set_displayed_usage(rootPixmap); - xorg_exa_set_shared_usage(rootPixmap); - if (!pScreen->ModifyPixmapHeader(rootPixmap, -1, -1, -1, -1, -1, NULL)) - FatalError("Couldn't adjust screen pixmap\n"); + BindTextureToRoot(pScrn); ms->noEvict = FALSE; - handle = xorg_exa_get_pixmap_handle(rootPixmap, &stride); - - drmModeAddFB(ms->fd, - pScrn->virtualX, - pScrn->virtualY, - pScrn->depth, - pScrn->bitsPerPixel, - stride, - handle, - &ms->fb_id); - AdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); #ifdef DRM_MODE_FEATURE_DIRTYFB + rootPixmap = pScreen->GetScreenPixmap(pScreen); ms->damage = DamageCreate(NULL, NULL, DamageReportNone, TRUE, pScreen, rootPixmap); @@ -472,6 +511,8 @@ CreateScreenResources(ScreenPtr pScreen) "Failed to create screen damage record\n"); return FALSE; } +#else + (void)rootPixmap; #endif return ret; @@ -684,8 +725,11 @@ EnterVT(int scrnIndex, int flags) SaveHWState(pScrn); } - if (!flags) /* signals startup as we'll do this in CreateScreenResources */ - CreateFrontBuffer(pScrn); + if (!CreateFrontBuffer(pScrn)) + return FALSE; + + if (!flags && !BindTextureToRoot(pScrn)) + return FALSE; if (!xf86SetDesiredModes(pScrn)) return FALSE; @@ -725,6 +769,8 @@ CloseScreen(int scrnIndex, ScreenPtr pScreen) } #endif + pipe_texture_reference(&ms->root_texture, NULL); + if (ms->exa) xorg_exa_close(pScrn); diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index a1c07218cb..ca25d90557 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -708,6 +708,50 @@ xorg_exa_get_texture(PixmapPtr pPixmap) return tex; } +Bool +xorg_exa_set_texture(PixmapPtr pPixmap, struct pipe_texture *tex) +{ + struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap); + + int mask = PIPE_TEXTURE_USAGE_PRIMARY | PIPE_TEXTURE_USAGE_DISPLAY_TARGET; + + if (!priv) + return FALSE; + + if (pPixmap->drawable.width != tex->width[0] || + pPixmap->drawable.height != tex->height[0]) + return FALSE; + + pipe_texture_reference(&priv->tex, tex); + priv->tex_flags = tex->tex_usage & mask; + + return TRUE; +} + +struct pipe_texture * +xorg_exa_create_root_texture(ScrnInfoPtr pScrn, + int width, int height, + int depth, int bitsPerPixel) +{ + modesettingPtr ms = modesettingPTR(pScrn); + struct exa_context *exa = ms->exa; + struct pipe_texture template; + + memset(&template, 0, sizeof(template)); + template.target = PIPE_TEXTURE_2D; + exa_get_pipe_format(depth, &template.format, &bitsPerPixel); + pf_get_block(template.format, &template.block); + template.width[0] = width; + template.height[0] = height; + template.depth[0] = 1; + template.last_level = 0; + template.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET; + template.tex_usage |= PIPE_TEXTURE_USAGE_PRIMARY; + template.tex_usage |= PIPE_TEXTURE_USAGE_DISPLAY_TARGET; + + return exa->scrn->texture_create(exa->scrn, &template); +} + void xorg_exa_close(ScrnInfoPtr pScrn) { diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h index 24e1a4928e..6130cf6621 100644 --- a/src/gallium/state_trackers/xorg/xorg_tracker.h +++ b/src/gallium/state_trackers/xorg/xorg_tracker.h @@ -92,6 +92,7 @@ typedef struct _modesettingRec struct pipe_context *ctx; boolean d_depth_bits_last; boolean ds_depth_bits_last; + struct pipe_texture *root_texture; /* exa */ struct exa_context *exa; @@ -121,6 +122,14 @@ xorg_exa_set_displayed_usage(PixmapPtr pPixmap); int xorg_exa_set_shared_usage(PixmapPtr pPixmap); +Bool +xorg_exa_set_texture(PixmapPtr pPixmap, struct pipe_texture *tex); + +struct pipe_texture * +xorg_exa_create_root_texture(ScrnInfoPtr pScrn, + int width, int height, + int depth, int bpp); + void * xorg_exa_init(ScrnInfoPtr pScrn); -- cgit v1.2.3 From e1b39c673d885e3dc990a29445360830b0a603aa Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sun, 18 Oct 2009 11:49:44 +0200 Subject: st/xorg: Switch to set_mode_major --- src/gallium/state_trackers/xorg/xorg_crtc.c | 86 ++++++++++----------------- src/gallium/state_trackers/xorg/xorg_driver.c | 4 +- 2 files changed, 32 insertions(+), 58 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index 6c6b6b5d1c..85b9162d4c 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -64,8 +64,6 @@ struct crtc_private static void crtc_dpms(xf86CrtcPtr crtc, int mode) { - //ScrnInfoPtr pScrn = crtc->scrn; - switch (mode) { case DPMSModeOn: case DPMSModeStandby: @@ -77,44 +75,29 @@ crtc_dpms(xf86CrtcPtr crtc, int mode) } static Bool -crtc_lock(xf86CrtcPtr crtc) -{ - return FALSE; -} - -static void -crtc_unlock(xf86CrtcPtr crtc) -{ -} - -static void -crtc_prepare(xf86CrtcPtr crtc) -{ -} - -static void -crtc_commit(xf86CrtcPtr crtc) -{ -} - -static Bool -crtc_mode_fixup(xf86CrtcPtr crtc, DisplayModePtr mode, - DisplayModePtr adjusted_mode) -{ - return TRUE; -} - -static void -crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, - DisplayModePtr adjusted_mode, int x, int y) +crtc_set_mode_major(xf86CrtcPtr crtc, DisplayModePtr mode, + Rotation rotation, int x, int y) { xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(crtc->scrn); modesettingPtr ms = modesettingPTR(crtc->scrn); - xf86OutputPtr output = config->output[config->compat_output]; - drmModeConnectorPtr drm_connector = output->driver_private; + xf86OutputPtr output = NULL; + drmModeConnectorPtr drm_connector; struct crtc_private *crtcp = crtc->driver_private; drmModeCrtcPtr drm_crtc = crtcp->drm_crtc; drmModeModeInfo drm_mode; + int i, ret; + + for (i = 0; i < config->num_output; output = NULL, i++) { + output = config->output[i]; + + if (output->crtc == crtc) + break; + } + + if (!output) + return FALSE; + + drm_connector = output->driver_private; drm_mode.clock = mode->Clock; drm_mode.hdisplay = mode->HDisplay; @@ -133,17 +116,19 @@ crtc_mode_set(xf86CrtcPtr crtc, DisplayModePtr mode, xf86SetModeDefaultName(mode); strncpy(drm_mode.name, mode->name, DRM_DISPLAY_MODE_LEN); - drmModeSetCrtc(ms->fd, drm_crtc->crtc_id, ms->fb_id, x, y, - &drm_connector->connector_id, 1, &drm_mode); -} + ret = drmModeSetCrtc(ms->fd, drm_crtc->crtc_id, ms->fb_id, x, y, + &drm_connector->connector_id, 1, &drm_mode); -#if 0 -static void -crtc_load_lut(xf86CrtcPtr crtc) -{ - //ScrnInfoPtr pScrn = crtc->scrn; + if (ret) + return FALSE; + + crtc->x = x; + crtc->y = y; + crtc->mode = *mode; + crtc->rotation = rotation; + + return TRUE; } -#endif static void crtc_gamma_set(xf86CrtcPtr crtc, CARD16 * red, CARD16 * green, CARD16 * blue, @@ -154,23 +139,18 @@ crtc_gamma_set(xf86CrtcPtr crtc, CARD16 * red, CARD16 * green, CARD16 * blue, static void * crtc_shadow_allocate(xf86CrtcPtr crtc, int width, int height) { - //ScrnInfoPtr pScrn = crtc->scrn; - return NULL; } static PixmapPtr crtc_shadow_create(xf86CrtcPtr crtc, void *data, int width, int height) { - //ScrnInfoPtr pScrn = crtc->scrn; - return NULL; } static void crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data) { - //ScrnInfoPtr pScrn = crtc->scrn; } /* @@ -282,13 +262,7 @@ crtc_destroy(xf86CrtcPtr crtc) static const xf86CrtcFuncsRec crtc_funcs = { .dpms = crtc_dpms, - - .lock = crtc_lock, - .unlock = crtc_unlock, - .mode_fixup = crtc_mode_fixup, - .prepare = crtc_prepare, - .mode_set = crtc_mode_set, - .commit = crtc_commit, + .set_mode_major = crtc_set_mode_major, .set_cursor_colors = crtc_set_cursor_colors, .set_cursor_position = crtc_set_cursor_position, @@ -322,6 +296,7 @@ crtc_init(ScrnInfoPtr pScrn) for (c = 0; c < res->count_crtcs; c++) { drm_crtc = drmModeGetCrtc(ms->fd, res->crtcs[c]); + if (!drm_crtc) continue; @@ -338,7 +313,6 @@ crtc_init(ScrnInfoPtr pScrn) crtcp->drm_crtc = drm_crtc; crtc->driver_private = crtcp; - } out: diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 24d3c23fa6..2df954f18e 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -651,8 +651,8 @@ AdjustFrame(int scrnIndex, int x, int y, int flags) xf86CrtcPtr crtc = output->crtc; if (crtc && crtc->enabled) { - crtc->funcs->mode_set(crtc, pScrn->currentMode, pScrn->currentMode, x, - y); + crtc->funcs->set_mode_major(crtc, pScrn->currentMode, + RR_Rotate_0, x, y); crtc->x = output->initial_x + x; crtc->y = output->initial_y + y; } -- cgit v1.2.3 From 973aab1a528f0a42e8b5e979b4730649ea366363 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 19 Oct 2009 13:06:45 -0700 Subject: dri-st: Add EXT_provoking_vertex. Hm, I could have sworn I did this before? --- src/gallium/state_trackers/dri/dri_extensions.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/dri/dri_extensions.c b/src/gallium/state_trackers/dri/dri_extensions.c index f39a305531..800d462e32 100644 --- a/src/gallium/state_trackers/dri/dri_extensions.c +++ b/src/gallium/state_trackers/dri/dri_extensions.c @@ -37,6 +37,7 @@ #define need_GL_ARB_multisample #define need_GL_ARB_occlusion_query #define need_GL_ARB_point_parameters +#define need_GL_ARB_provoking_vertex #define need_GL_ARB_shader_objects #define need_GL_ARB_texture_compression #define need_GL_ARB_vertex_array_object @@ -52,6 +53,7 @@ #define need_GL_EXT_fog_coord #define need_GL_EXT_framebuffer_object #define need_GL_EXT_multi_draw_arrays +#define need_GL_EXT_provoking_vertex #define need_GL_EXT_secondary_color #define need_GL_APPLE_vertex_array_object #define need_GL_NV_vertex_program @@ -69,6 +71,7 @@ const struct dri_extension card_extensions[] = { {"GL_ARB_multitexture", NULL}, {"GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions}, {"GL_ARB_pixel_buffer_object", NULL}, + {"GL_ARB_provoking_vertex", GL_ARB_provoking_vertex_functions}, {"GL_ARB_point_parameters", GL_ARB_point_parameters_functions}, {"GL_ARB_shading_language_100", GL_VERSION_2_0_functions }, {"GL_ARB_shading_language_120", GL_VERSION_2_1_functions }, @@ -97,6 +100,7 @@ const struct dri_extension card_extensions[] = { {"GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions}, {"GL_EXT_packed_depth_stencil", NULL}, {"GL_EXT_pixel_buffer_object", NULL}, + {"GL_EXT_provoking_vertex", GL_EXT_provoking_vertex_functions}, {"GL_EXT_secondary_color", GL_EXT_secondary_color_functions}, {"GL_EXT_stencil_wrap", NULL}, {"GL_EXT_texture_edge_clamp", NULL}, -- cgit v1.2.3 From e5f1f6a0bece3d035bf5ac1685b5335af4862cea Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Mon, 19 Oct 2009 13:51:28 -0700 Subject: r300g: Demonstratory kludge to unbreak glxgears. We *must* recalculate something in vformat every rebind; let's see if we can't narrow it down a bit. --- src/gallium/drivers/r300/r300_state_derived.c | 28 +++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 1468b9d36e..5df1a0cd63 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -460,32 +460,36 @@ static void r300_update_derived_shader_state(struct r300_context* r300) value = (struct r300_shader_derived_value*) util_hash_table_get(r300->shader_hash_table, (void*)key); if (value) { - vformat = value->vformat; + //vformat = value->vformat; rs_block = value->rs_block; FREE(key); } else { - vformat = CALLOC_STRUCT(r300_vertex_format); rs_block = CALLOC_STRUCT(r300_rs_block); value = CALLOC_STRUCT(r300_shader_derived_value); - for (i = 0; i < 16; i++) { - vformat->vs_tab[i] = -1; - vformat->fs_tab[i] = -1; - } - - r300_vs_tab_routes(r300, vformat); - r300_vertex_psc(r300, vformat); - r300_update_fs_tab(r300, vformat); - r300_update_rs_block(r300, rs_block); - value->vformat = vformat; + //value->vformat = vformat; value->rs_block = rs_block; util_hash_table_set(r300->shader_hash_table, (void*)key, (void*)value); } + /* XXX This will be refactored ASAP. */ + vformat = CALLOC_STRUCT(r300_vertex_format); + + for (i = 0; i < 16; i++) { + vformat->vs_tab[i] = -1; + vformat->fs_tab[i] = -1; + } + + r300_vs_tab_routes(r300, vformat); + r300_vertex_psc(r300, vformat); + r300_update_fs_tab(r300, vformat); + + FREE(r300->vertex_info); + r300->vertex_info = vformat; r300->rs_block = rs_block; r300->dirty_state |= (R300_NEW_VERTEX_FORMAT | R300_NEW_RS_BLOCK); -- cgit v1.2.3 From a39a3cc14e816cc91a81028a27c4dbd4816cdc9d Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Tue, 13 Oct 2009 13:06:39 -0400 Subject: st/xorg: implement basic src/mask transformations plus fix filters --- src/gallium/state_trackers/xorg/Makefile | 1 + src/gallium/state_trackers/xorg/xorg_composite.c | 126 +++++++++++++++++++--- src/gallium/state_trackers/xorg/xorg_exa.c | 2 + src/gallium/state_trackers/xorg/xorg_exa.h | 8 ++ src/gallium/state_trackers/xorg/xorg_renderer.c | 130 ++++++++++++++++++----- src/gallium/state_trackers/xorg/xorg_renderer.h | 4 +- 6 files changed, 231 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/Makefile b/src/gallium/state_trackers/xorg/Makefile index 27a1990724..030bac5fff 100644 --- a/src/gallium/state_trackers/xorg/Makefile +++ b/src/gallium/state_trackers/xorg/Makefile @@ -5,6 +5,7 @@ LIBNAME = xorgtracker LIBRARY_INCLUDES = \ -DHAVE_CONFIG_H \ + -DHAVE_XEXTPROTO_71=1 \ $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \ -I$(TOP)/src/gallium/include \ -I$(TOP)/src/gallium/auxiliary \ diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index d6483fb72c..7379e3b746 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -9,6 +9,9 @@ #include "pipe/p_inlines.h" +/*XXX also in Xrender.h but the including it here breaks compilition */ +#define XFixedToDouble(f) (((double) (f)) / 65536.) + struct xorg_composite_blend { int op:8; @@ -144,6 +147,43 @@ render_repeat_to_gallium(int mode) return PIPE_TEX_WRAP_REPEAT; } +static INLINE boolean +render_filter_to_gallium(int xrender_filter, int *out_filter) +{ + + switch (xrender_filter) { + case PictFilterNearest: + *out_filter = PIPE_TEX_FILTER_NEAREST; + break; + case PictFilterBilinear: + *out_filter = PIPE_TEX_FILTER_LINEAR; + break; + case PictFilterFast: + *out_filter = PIPE_TEX_FILTER_NEAREST; + break; + case PictFilterGood: + *out_filter = PIPE_TEX_FILTER_LINEAR; + break; + case PictFilterBest: + *out_filter = PIPE_TEX_FILTER_LINEAR; + break; + default: + debug_printf("Unkown xrender filter"); + *out_filter = PIPE_TEX_FILTER_NEAREST; + return FALSE; + } + + return TRUE; +} + +static boolean is_filter_accelerated(PicturePtr pic) +{ + int filter; + if (pic && !render_filter_to_gallium(pic->filter, &filter)) + return FALSE; + return TRUE; +} + boolean xorg_composite_accelerated(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, @@ -156,6 +196,11 @@ boolean xorg_composite_accelerated(int op, unsigned accel_ops_count = sizeof(accelerated_ops)/sizeof(struct acceleration_info); + if (!is_filter_accelerated(pSrcPicture) || + !is_filter_accelerated(pMaskPicture)) { + XORG_FALLBACK("Unsupported Xrender filter"); + } + if (pSrcPicture->pSourcePict) { if (pSrcPicture->pSourcePict->type != SourcePictTypeSolidFill) XORG_FALLBACK("gradients not enabled (haven't been well tested)"); @@ -163,13 +208,10 @@ boolean xorg_composite_accelerated(int op, for (i = 0; i < accel_ops_count; ++i) { if (op == accelerated_ops[i].op) { - /* Check for unsupported component alpha */ - if ((pSrcPicture->componentAlpha && - !accelerated_ops[i].component_alpha) || - (pMaskPicture && - (!accelerated_ops[i].with_mask || - (pMaskPicture->componentAlpha && - !accelerated_ops[i].component_alpha)))) + /* Check for component alpha */ + if (pMaskPicture && + (pMaskPicture->componentAlpha || + (!accelerated_ops[i].with_mask))) XORG_FALLBACK("component alpha unsupported (PictOpOver=%s(%d)", (accelerated_ops[i].op == PictOpOver) ? "yes" : "no", accelerated_ops[i].op); @@ -238,7 +280,6 @@ bind_shaders(struct exa_context *exa, int op, cso_set_fragment_shader_handle(exa->renderer->cso, shader.fs); } - static void bind_samplers(struct exa_context *exa, int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, @@ -264,10 +305,15 @@ bind_samplers(struct exa_context *exa, int op, if (pSrcPicture && pSrc) { unsigned src_wrap = render_repeat_to_gallium( pSrcPicture->repeatType); + int filter; + + render_filter_to_gallium(pSrcPicture->filter, &filter); + src_sampler.wrap_s = src_wrap; src_sampler.wrap_t = src_wrap; - src_sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST; - src_sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST; + src_sampler.min_img_filter = filter; + src_sampler.mag_img_filter = filter; + src_sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST; src_sampler.normalized_coords = 1; samplers[0] = &src_sampler; exa->bound_textures[0] = pSrc->tex; @@ -277,10 +323,15 @@ bind_samplers(struct exa_context *exa, int op, if (pMaskPicture && pMask) { unsigned mask_wrap = render_repeat_to_gallium( pMaskPicture->repeatType); + int filter; + + render_filter_to_gallium(pMaskPicture->filter, &filter); + mask_sampler.wrap_s = mask_wrap; mask_sampler.wrap_t = mask_wrap; - mask_sampler.min_img_filter = PIPE_TEX_MIPFILTER_NEAREST; - mask_sampler.mag_img_filter = PIPE_TEX_MIPFILTER_NEAREST; + mask_sampler.min_img_filter = filter; + mask_sampler.mag_img_filter = filter; + src_sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST; mask_sampler.normalized_coords = 1; samplers[1] = &mask_sampler; exa->bound_textures[1] = pMask->tex; @@ -328,6 +379,44 @@ setup_constant_buffers(struct exa_context *exa, struct exa_pixmap_priv *pDst) setup_fs_constant_buffer(exa); } +static INLINE boolean matrix_from_pict_transform(PictTransform *trans, float *matrix) +{ + if (!trans) + return FALSE; + + matrix[0] = XFixedToDouble(trans->matrix[0][0]); + matrix[1] = XFixedToDouble(trans->matrix[0][1]); + matrix[2] = XFixedToDouble(trans->matrix[0][2]); + + matrix[3] = XFixedToDouble(trans->matrix[1][0]); + matrix[4] = XFixedToDouble(trans->matrix[1][1]); + matrix[5] = XFixedToDouble(trans->matrix[1][2]); + + matrix[6] = XFixedToDouble(trans->matrix[2][0]); + matrix[7] = XFixedToDouble(trans->matrix[2][1]); + matrix[8] = XFixedToDouble(trans->matrix[2][2]); + + return TRUE; +} + +static void +setup_transforms(struct exa_context *exa, + PicturePtr pSrcPicture, PicturePtr pMaskPicture) +{ + PictTransform *src_t = NULL; + PictTransform *mask_t = NULL; + + if (pSrcPicture) + src_t = pSrcPicture->transform; + if (pMaskPicture) + mask_t = pMaskPicture->transform; + + exa->transform.has_src = + matrix_from_pict_transform(src_t, exa->transform.src); + exa->transform.has_mask = + matrix_from_pict_transform(mask_t, exa->transform.mask); +} + boolean xorg_composite_bind_state(struct exa_context *exa, int op, PicturePtr pSrcPicture, @@ -346,6 +435,8 @@ boolean xorg_composite_bind_state(struct exa_context *exa, pDstPicture, pSrc, pMask, pDst); setup_constant_buffers(exa, pDst); + setup_transforms(exa, pSrcPicture, pMaskPicture); + return TRUE; } @@ -360,10 +451,19 @@ void xorg_composite(struct exa_context *exa, exa->solid_color); } else { int pos[6] = {srcX, srcY, maskX, maskY, dstX, dstY}; + float *src_matrix = NULL; + float *mask_matrix = NULL; + + if (exa->transform.has_src) + src_matrix = exa->transform.src; + if (exa->transform.has_mask) + mask_matrix = exa->transform.mask; + renderer_draw_textures(exa->renderer, pos, width, height, exa->bound_textures, - exa->num_bound_samplers); + exa->num_bound_samplers, + src_matrix, mask_matrix); } } diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index ca25d90557..39c4d26ebe 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -92,6 +92,8 @@ xorg_exa_common_done(struct exa_context *exa) { exa->copy.src = NULL; exa->copy.dst = NULL; + exa->transform.has_src = FALSE; + exa->transform.has_mask = FALSE; exa->has_solid_color = FALSE; exa->num_bound_samplers = 0; } diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h index 292f964cec..45f88d9404 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.h +++ b/src/gallium/state_trackers/xorg/xorg_exa.h @@ -24,6 +24,14 @@ struct exa_context float solid_color[4]; boolean has_solid_color; + /* float[9] projective matrix bound to pictures */ + struct { + float src[9]; + float mask[9]; + boolean has_src; + boolean has_mask; + } transform; + struct { struct exa_pixmap_priv *src; struct exa_pixmap_priv *dst; diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index ca69e1e0e9..3dd5e6e811 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -11,11 +11,39 @@ #include "pipe/p_inlines.h" +#include + enum AxisOrientation { Y0_BOTTOM, Y0_TOP }; +#define floatsEqual(x, y) (fabs(x - y) <= 0.00001f * MIN2(fabs(x), fabs(y))) +#define floatIsZero(x) (floatsEqual((x) + 1, 1)) + +static INLINE boolean is_affine(float *matrix) +{ + return floatIsZero(matrix[2]) && floatIsZero(matrix[5]) + && floatsEqual(matrix[8], 1); +} +static INLINE void map_point(float *mat, float x, float y, + float *out_x, float *out_y) +{ + if (!mat) { + *out_x = x; + *out_y = y; + return; + } + + *out_x = mat[0]*x + mat[3]*y + mat[6]; + *out_y = mat[1]*x + mat[4]*y + mat[7]; + if (!is_affine(mat)) { + float w = 1/(mat[2]*x + mat[5]*y + mat[8]); + *out_x *= w; + *out_y *= w; + } +} + static void renderer_init_state(struct xorg_renderer *r) { @@ -60,23 +88,38 @@ static struct pipe_buffer * setup_vertex_data1(struct xorg_renderer *r, int srcX, int srcY, int dstX, int dstY, int width, int height, - struct pipe_texture *src) + struct pipe_texture *src, float *src_matrix) { - float s0, t0, s1, t1; + float s0, t0, s1, t1, stmp, ttmp; s0 = srcX / src->width[0]; s1 = srcX + width / src->width[0]; t0 = srcY / src->height[0]; t1 = srcY + height / src->height[0]; - /* 1st vertex */ - setup_vertex1(r->vertices2[0], dstX, dstY, s0, t0); - /* 2nd vertex */ - setup_vertex1(r->vertices2[1], dstX + width, dstY, s1, t0); - /* 3rd vertex */ - setup_vertex1(r->vertices2[2], dstX + width, dstY + height, s1, t1); - /* 4th vertex */ - setup_vertex1(r->vertices2[3], dstX, dstY + height, s0, t1); + if (src_matrix) { + /* 1st vertex */ + map_point(src_matrix, s0, t0, &stmp, &ttmp); + setup_vertex1(r->vertices2[0], dstX, dstY, stmp, ttmp); + /* 2nd vertex */ + map_point(src_matrix, s1, t0, &stmp, &ttmp); + setup_vertex1(r->vertices2[1], dstX + width, dstY, stmp, ttmp); + /* 3rd vertex */ + map_point(src_matrix, s1, t1, &stmp, &ttmp); + setup_vertex1(r->vertices2[2], dstX + width, dstY + height, stmp, ttmp); + /* 4th vertex */ + map_point(src_matrix, s0, t1, &stmp, &ttmp); + setup_vertex1(r->vertices2[3], dstX, dstY + height, stmp, ttmp); + } else { + /* 1st vertex */ + setup_vertex1(r->vertices2[0], dstX, dstY, s0, t0); + /* 2nd vertex */ + setup_vertex1(r->vertices2[1], dstX + width, dstY, s1, t0); + /* 3rd vertex */ + setup_vertex1(r->vertices2[2], dstX + width, dstY + height, s1, t1); + /* 4th vertex */ + setup_vertex1(r->vertices2[3], dstX, dstY + height, s0, t1); + } return pipe_user_buffer_create(r->pipe->screen, r->vertices2, @@ -128,9 +171,11 @@ setup_vertex_data2(struct xorg_renderer *r, int srcX, int srcY, int maskX, int maskY, int dstX, int dstY, int width, int height, struct pipe_texture *src, - struct pipe_texture *mask) + struct pipe_texture *mask, + float *src_matrix, float *mask_matrix) { float st0[4], st1[4]; + float pt0[2], pt1[2]; st0[0] = srcX / src->width[0]; st0[1] = srcY / src->height[0]; @@ -142,18 +187,49 @@ setup_vertex_data2(struct xorg_renderer *r, st1[2] = maskX + width / mask->width[0]; st1[3] = maskY + height / mask->height[0]; - /* 1st vertex */ - setup_vertex2(r->vertices3[0], dstX, dstY, - st0[0], st0[1], st1[0], st1[1]); - /* 2nd vertex */ - setup_vertex2(r->vertices3[1], dstX + width, dstY, - st0[2], st0[1], st1[2], st1[1]); - /* 3rd vertex */ - setup_vertex2(r->vertices3[2], dstX + width, dstY + height, - st0[2], st0[3], st1[2], st1[3]); - /* 4th vertex */ - setup_vertex2(r->vertices3[3], dstX, dstY + height, - st0[0], st0[3], st1[0], st1[3]); + if (src_matrix || mask_matrix) { + /* 1st vertex */ + map_point(src_matrix, st0[0], st0[1], + pt0 + 0, pt0 + 1); + map_point(mask_matrix, st1[0], st1[1], + pt1 + 0, pt1 + 1); + setup_vertex2(r->vertices3[0], dstX, dstY, + pt0[0], pt0[1], pt1[0], pt1[1]); + /* 2nd vertex */ + map_point(src_matrix, st0[2], st0[1], + pt0 + 0, pt0 + 1); + map_point(mask_matrix, st1[2], st1[1], + pt1 + 0, pt1 + 1); + setup_vertex2(r->vertices3[1], dstX + width, dstY, + pt0[0], pt0[1], pt1[0], pt1[1]); + /* 3rd vertex */ + map_point(src_matrix, st0[2], st0[3], + pt0 + 0, pt0 + 1); + map_point(mask_matrix, st1[2], st1[3], + pt1 + 0, pt1 + 1); + setup_vertex2(r->vertices3[2], dstX + width, dstY + height, + pt0[0], pt0[1], pt1[0], pt1[1]); + /* 4th vertex */ + map_point(src_matrix, st0[0], st0[3], + pt0 + 0, pt0 + 1); + map_point(mask_matrix, st1[0], st1[3], + pt1 + 0, pt1 + 1); + setup_vertex2(r->vertices3[3], dstX, dstY + height, + pt0[0], pt0[1], pt1[0], pt1[1]); + } else { + /* 1st vertex */ + setup_vertex2(r->vertices3[0], dstX, dstY, + st0[0], st0[1], st1[0], st1[1]); + /* 2nd vertex */ + setup_vertex2(r->vertices3[1], dstX + width, dstY, + st0[2], st0[1], st1[2], st1[1]); + /* 3rd vertex */ + setup_vertex2(r->vertices3[2], dstX + width, dstY + height, + st0[2], st0[3], st1[2], st1[3]); + /* 4th vertex */ + setup_vertex2(r->vertices3[3], dstX, dstY + height, + st0[0], st0[3], st1[0], st1[3]); + } return pipe_user_buffer_create(r->pipe->screen, r->vertices3, @@ -721,7 +797,8 @@ void renderer_draw_textures(struct xorg_renderer *r, int *pos, int width, int height, struct pipe_texture **textures, - int num_textures) + int num_textures, + float *src_matrix, float *mask_matrix) { struct pipe_context *pipe = r->pipe; struct pipe_buffer *buf = 0; @@ -732,7 +809,7 @@ void renderer_draw_textures(struct xorg_renderer *r, pos[0], pos[1], /* src */ pos[4], pos[5], /* dst */ width, height, - textures[0]); + textures[0], src_matrix); break; case 2: buf = setup_vertex_data2(r, @@ -740,7 +817,8 @@ void renderer_draw_textures(struct xorg_renderer *r, pos[2], pos[3], /* mask */ pos[4], pos[5], /* dst */ width, height, - textures[0], textures[1]); + textures[0], textures[1], + src_matrix, mask_matrix); break; default: debug_assert(!"Unsupported number of textures"); diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h index b6296d5fd6..3e37c9aa93 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.h +++ b/src/gallium/state_trackers/xorg/xorg_renderer.h @@ -47,7 +47,9 @@ void renderer_draw_textures(struct xorg_renderer *r, int *pos, int width, int height, struct pipe_texture **textures, - int num_textures); + int num_textures, + float *src_matrix, + float *mask_matrix); #endif -- cgit v1.2.3 From b7fbcfdb3bf220ceae5c994d49bcd806a51e177a Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Mon, 19 Oct 2009 23:48:38 -0400 Subject: st/xorg: makefile garbage --- src/gallium/state_trackers/xorg/Makefile | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/Makefile b/src/gallium/state_trackers/xorg/Makefile index 030bac5fff..27a1990724 100644 --- a/src/gallium/state_trackers/xorg/Makefile +++ b/src/gallium/state_trackers/xorg/Makefile @@ -5,7 +5,6 @@ LIBNAME = xorgtracker LIBRARY_INCLUDES = \ -DHAVE_CONFIG_H \ - -DHAVE_XEXTPROTO_71=1 \ $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \ -I$(TOP)/src/gallium/include \ -I$(TOP)/src/gallium/auxiliary \ -- cgit v1.2.3 From 5f8f14e5ca994461c54ba547f6371c2f71474425 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 19 Oct 2009 07:49:40 +0200 Subject: st/xorg: Remove output functions not used --- src/gallium/state_trackers/xorg/xorg_output.c | 84 +++++---------------------- 1 file changed, 15 insertions(+), 69 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_output.c b/src/gallium/state_trackers/xorg/xorg_output.c index 964d9595a9..bfeddc5e11 100644 --- a/src/gallium/state_trackers/xorg/xorg_output.c +++ b/src/gallium/state_trackers/xorg/xorg_output.c @@ -70,52 +70,15 @@ static char *connector_enum_list[] = { }; static void -dpms(xf86OutputPtr output, int mode) -{ -} - -static void -save(xf86OutputPtr output) -{ -} - -static void -restore(xf86OutputPtr output) -{ -} - -static int -mode_valid(xf86OutputPtr output, DisplayModePtr pMode) -{ - return MODE_OK; -} - -static Bool -mode_fixup(xf86OutputPtr output, DisplayModePtr mode, - DisplayModePtr adjusted_mode) -{ - return TRUE; -} - -static void -prepare(xf86OutputPtr output) -{ - dpms(output, DPMSModeOff); -} - -static void -mode_set(xf86OutputPtr output, DisplayModePtr mode, - DisplayModePtr adjusted_mode) +create_resources(xf86OutputPtr output) { +#ifdef RANDR_12_INTERFACE +#endif /* RANDR_12_INTERFACE */ } static void -commit(xf86OutputPtr output) +dpms(xf86OutputPtr output, int mode) { - dpms(output, DPMSModeOn); - - if (output->scrn->pScreen != NULL) - xf86_reload_cursors(output->scrn->pScreen); } static xf86OutputStatus @@ -171,17 +134,10 @@ get_modes(xf86OutputPtr output) return modes; } -static void -destroy(xf86OutputPtr output) -{ - drmModeFreeConnector(output->driver_private); -} - -static void -create_resources(xf86OutputPtr output) +static int +mode_valid(xf86OutputPtr output, DisplayModePtr pMode) { -#ifdef RANDR_12_INTERFACE -#endif /* RANDR_12_INTERFACE */ + return MODE_OK; } #ifdef RANDR_12_INTERFACE @@ -200,36 +156,26 @@ get_property(xf86OutputPtr output, Atom property) } #endif /* RANDR_13_INTERFACE */ -#ifdef RANDR_GET_CRTC_INTERFACE -static xf86CrtcPtr -get_crtc(xf86OutputPtr output) +static void +destroy(xf86OutputPtr output) { - return NULL; + drmModeFreeConnector(output->driver_private); } -#endif static const xf86OutputFuncsRec output_funcs = { .create_resources = create_resources, - .dpms = dpms, - .save = save, - .restore = restore, - .mode_valid = mode_valid, - .mode_fixup = mode_fixup, - .prepare = prepare, - .mode_set = mode_set, - .commit = commit, - .detect = detect, - .get_modes = get_modes, #ifdef RANDR_12_INTERFACE .set_property = set_property, #endif #ifdef RANDR_13_INTERFACE .get_property = get_property, #endif + .dpms = dpms, + .detect = detect, + + .get_modes = get_modes, + .mode_valid = mode_valid, .destroy = destroy, -#ifdef RANDR_GET_CRTC_INTERFACE - .get_crtc = get_crtc, -#endif }; void -- cgit v1.2.3 From 8123180ea649540fb7319bc79ad77dca0d5d68cd Mon Sep 17 00:00:00 2001 From: Robert Noland Date: Mon, 19 Oct 2009 09:47:39 -0500 Subject: r600: Fix size calculation for 24 bit depth size was being calculated based on 3 bytes per pixel with 24 bit depth instead of 4 bytes. This caused corruption in the bottom 25% of objects. This finishes fixing the menu/text corruption in compiz/kde4. Signed-off-by: Robert Noland --- src/mesa/drivers/dri/r600/r600_texstate.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c index 61ff7e8158..a30703e41b 100644 --- a/src/mesa/drivers/dri/r600/r600_texstate.c +++ b/src/mesa/drivers/dri/r600/r600_texstate.c @@ -723,7 +723,7 @@ void r600SetTexOffset(__DRIcontext * pDRICtx, GLint texname, radeonTexObjPtr t = radeon_tex_obj(tObj); int firstlevel = t->mt ? t->mt->firstLevel : 0; const struct gl_texture_image *firstImage; - uint32_t pitch_val, size, row_align; + uint32_t pitch_val, size, row_align, bpp; if (!tObj) return; @@ -733,9 +733,13 @@ void r600SetTexOffset(__DRIcontext * pDRICtx, GLint texname, if (!offset) return; + bpp = depth / 8; + if (bpp == 3) + bpp = 4; + firstImage = t->base.Image[0][firstlevel]; row_align = rmesa->radeon.texture_row_align - 1; - size = ((firstImage->Width * (depth / 8) + row_align) & ~row_align) * firstImage->Height; + size = ((firstImage->Width * bpp + row_align) & ~row_align) * firstImage->Height; if (t->bo) { radeon_bo_unref(t->bo); t->bo = NULL; -- cgit v1.2.3 From 16e21191e26084848c7e6e3ffd9e15ef670855c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mathias=20Fr=C3=B6hlich?= Date: Mon, 19 Oct 2009 11:47:21 -0400 Subject: r300: fix texture size handling with size > 2048 The in kernel texture check fails because of both bit11 flags being set on 16x16 textures. It tuns out that these bits are still set and not cleared in the pp_txpitch field of the texture. The attached patch at least helps for this case on my machine. It clears the bit 11 from the pitch field if the texture is smaller and masks out that hight bits on the conventional width and height field. Fixes bug 24584 --- src/mesa/drivers/dri/r300/r300_texstate.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index f030451b28..65cabccdc1 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -225,10 +225,10 @@ static void setup_hardware_state(r300ContextPtr rmesa, radeonTexObj *t) if (t->image_override && t->bo) return; - t->pp_txsize = (((firstImage->Width - 1) << R300_TX_WIDTHMASK_SHIFT) - | ((firstImage->Height - 1) << R300_TX_HEIGHTMASK_SHIFT) - | ((firstImage->DepthLog2) << R300_TX_DEPTHMASK_SHIFT) - | ((t->mt->lastLevel - t->mt->firstLevel) << R300_TX_MAX_MIP_LEVEL_SHIFT)); + t->pp_txsize = (((R300_TX_WIDTHMASK_MASK & ((firstImage->Width - 1) << R300_TX_WIDTHMASK_SHIFT))) + | ((R300_TX_HEIGHTMASK_MASK & ((firstImage->Height - 1) << R300_TX_HEIGHTMASK_SHIFT))) + | ((R300_TX_DEPTHMASK_MASK & ((firstImage->DepthLog2) << R300_TX_DEPTHMASK_SHIFT))) + | ((R300_TX_MAX_MIP_LEVEL_MASK & ((t->mt->lastLevel - t->mt->firstLevel) << R300_TX_MAX_MIP_LEVEL_SHIFT)))); t->tile_bits = 0; @@ -248,8 +248,12 @@ static void setup_hardware_state(r300ContextPtr rmesa, radeonTexObj *t) if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { if (firstImage->Width > 2048) t->pp_txpitch |= R500_TXWIDTH_BIT11; + else + t->pp_txpitch &= ~R500_TXWIDTH_BIT11; if (firstImage->Height > 2048) t->pp_txpitch |= R500_TXHEIGHT_BIT11; + else + t->pp_txpitch &= ~R500_TXHEIGHT_BIT11; } } @@ -479,16 +483,20 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo break; } pitch_val--; - t->pp_txsize = ((rb->base.Width - 1) << R300_TX_WIDTHMASK_SHIFT) | - ((rb->base.Height - 1) << R300_TX_HEIGHTMASK_SHIFT); + t->pp_txsize = (((R300_TX_WIDTHMASK_MASK & ((rb->base.Width - 1) << R300_TX_WIDTHMASK_SHIFT))) + | ((R300_TX_HEIGHTMASK_MASK & ((rb->base.Height - 1) << R300_TX_HEIGHTMASK_SHIFT)))); t->pp_txsize |= R300_TX_SIZE_TXPITCH_EN; t->pp_txpitch |= pitch_val; if (rmesa->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { if (rb->base.Width > 2048) t->pp_txpitch |= R500_TXWIDTH_BIT11; + else + t->pp_txpitch &= ~R500_TXWIDTH_BIT11; if (rb->base.Height > 2048) t->pp_txpitch |= R500_TXHEIGHT_BIT11; + else + t->pp_txpitch &= ~R500_TXHEIGHT_BIT11; } t->validated = GL_TRUE; _mesa_unlock_texture(radeon->glCtx, texObj); -- cgit v1.2.3 From a9f71b3bba86771be56ff1def716beb370decd22 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 20 Oct 2009 17:18:25 +0200 Subject: st/xorg: Cleanly shutdown --- src/gallium/state_trackers/xorg/xorg_driver.c | 5 ++++- src/gallium/state_trackers/xorg/xorg_renderer.c | 10 ++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 2df954f18e..7da10427ec 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -541,6 +541,9 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) return FALSE; } + if (!ms->api) + ms->api = drm_api_create(); + if (!ms->screen) { ms->screen = ms->api->create_screen(ms->api, ms->fd, NULL); @@ -774,7 +777,7 @@ CloseScreen(int scrnIndex, ScreenPtr pScreen) if (ms->exa) xorg_exa_close(pScrn); - if (ms->api->destroy) + if (ms->api && ms->api->destroy) ms->api->destroy(ms->api); ms->api = NULL; diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 3dd5e6e811..393f3fac3e 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -283,13 +283,15 @@ void renderer_destroy(struct xorg_renderer *r) if (fsbuf && fsbuf->buffer) pipe_buffer_reference(&fsbuf->buffer, NULL); + if (r->shaders) { + xorg_shaders_destroy(r->shaders); + r->shaders = NULL; + } + if (r->cso) { cso_release_all(r->cso); cso_destroy_context(r->cso); - } - - if (r->shaders) { - xorg_shaders_destroy(r->shaders); + r->cso = NULL; } } -- cgit v1.2.3 From fc07ca004aaa338217c49e95f51b072b32c4f8c6 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 20 Oct 2009 17:17:41 +0200 Subject: trace: Check for destroy before calling it --- src/gallium/drivers/trace/tr_drm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/trace/tr_drm.c b/src/gallium/drivers/trace/tr_drm.c index 781ca5d3bc..48d1c4051c 100644 --- a/src/gallium/drivers/trace/tr_drm.c +++ b/src/gallium/drivers/trace/tr_drm.c @@ -150,7 +150,9 @@ trace_drm_destroy(struct drm_api *_api) { struct trace_drm_api *tr_api = trace_drm_api(_api); struct drm_api *api = tr_api->api; - api->destroy(api); + + if (api->destroy) + api->destroy(api); free(tr_api); } -- cgit v1.2.3 From 478332b0c1f0198bc7063300d203c21e42796045 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 20 Oct 2009 17:52:33 +0200 Subject: st/xorg: Move drm init to own function --- src/gallium/state_trackers/xorg/xorg_driver.c | 65 +++++++++++++++------------ 1 file changed, 36 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 7da10427ec..847647c1e4 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -260,6 +260,37 @@ static const xf86CrtcConfigFuncsRec crtc_config_funcs = { crtc_resize }; +static Bool +InitDRM(ScrnInfoPtr pScrn) +{ + modesettingPtr ms = modesettingPTR(pScrn); + + /* deal with server regeneration */ + if (ms->fd < 0) { + char *BusID; + + BusID = xalloc(64); + sprintf(BusID, "PCI:%d:%d:%d", + ((ms->PciInfo->domain << 8) | ms->PciInfo->bus), + ms->PciInfo->dev, ms->PciInfo->func + ); + + ms->fd = drmOpen(NULL, BusID); + + if (ms->fd < 0) + return FALSE; + } + + if (!ms->api) { + ms->api = drm_api_create(); + + if (!ms->api) + return FALSE; + } + + return TRUE; +} + static Bool PreInit(ScrnInfoPtr pScrn, int flags) { @@ -268,7 +299,6 @@ PreInit(ScrnInfoPtr pScrn, int flags) rgb defaultWeight = { 0, 0, 0 }; EntityInfoPtr pEnt; EntPtr msEnt = NULL; - char *BusID; int max_width, max_height; if (pScrn->numEntities != 1) @@ -317,16 +347,9 @@ PreInit(ScrnInfoPtr pScrn, int flags) } } - BusID = xalloc(64); - sprintf(BusID, "PCI:%d:%d:%d", - ((ms->PciInfo->domain << 8) | ms->PciInfo->bus), - ms->PciInfo->dev, ms->PciInfo->func - ); - - ms->api = drm_api_create(); - ms->fd = drmOpen(NULL, BusID); - - if (ms->fd < 0) + ms->fd = -1; + ms->api = NULL; + if (!InitDRM(pScrn)) return FALSE; pScrn->monitor = pScrn->confScreen->monitor; @@ -525,24 +548,8 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) modesettingPtr ms = modesettingPTR(pScrn); VisualPtr visual; - /* deal with server regeneration */ - if (ms->fd < 0) { - char *BusID; - - BusID = xalloc(64); - sprintf(BusID, "PCI:%d:%d:%d", - ((ms->PciInfo->domain << 8) | ms->PciInfo->bus), - ms->PciInfo->dev, ms->PciInfo->func - ); - - ms->fd = drmOpen(NULL, BusID); - - if (ms->fd < 0) - return FALSE; - } - - if (!ms->api) - ms->api = drm_api_create(); + if (!InitDRM(pScrn)) + return FALSE; if (!ms->screen) { ms->screen = ms->api->create_screen(ms->api, ms->fd, NULL); -- cgit v1.2.3 From ca940a73a72c68c461344d27f9d1fac31cd73819 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 20 Oct 2009 10:43:46 -0600 Subject: mesa: Fix Mac OS build. strtod_l needs the xlocale.h header on Mac OS. It's possible other non-Linux OSes would need this header too. --- src/mesa/main/imports.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 87cb5ce0fb..30fa55997e 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -50,6 +50,9 @@ #ifdef _GNU_SOURCE #include +#ifdef __APPLE__ +#include +#endif #endif -- cgit v1.2.3 From 4b2cf92ad9caa384869371534c1f2154625a755a Mon Sep 17 00:00:00 2001 From: Marc Dietrich Date: Sun, 18 Oct 2009 08:28:34 -0700 Subject: cell: fix compilation on cell s/LERP/LRP/ --- src/gallium/drivers/cell/ppu/cell_gen_fp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/cell/ppu/cell_gen_fp.c b/src/gallium/drivers/cell/ppu/cell_gen_fp.c index 312621fd53..b6b2f885af 100644 --- a/src/gallium/drivers/cell/ppu/cell_gen_fp.c +++ b/src/gallium/drivers/cell/ppu/cell_gen_fp.c @@ -674,7 +674,7 @@ emit_MAD(struct codegen *gen, const struct tgsi_full_instruction *inst) * Emit linear interpolate. See emit_ADD for comments. */ static boolean -emit_LERP(struct codegen *gen, const struct tgsi_full_instruction *inst) +emit_LRP(struct codegen *gen, const struct tgsi_full_instruction *inst) { int ch, s1_reg[4], s2_reg[4], s3_reg[4], d_reg[4], tmp_reg[4]; @@ -1766,7 +1766,7 @@ emit_instruction(struct codegen *gen, return emit_binop(gen, inst); case TGSI_OPCODE_MAD: return emit_MAD(gen, inst); - case TGSI_OPCODE_LERP: + case TGSI_OPCODE_LRP: return emit_LRP(gen, inst); case TGSI_OPCODE_DP3: return emit_DP3(gen, inst); -- cgit v1.2.3 From cbd20e18a0f82a653513d165694ed7bbb336e765 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 19 Oct 2009 17:54:42 -0700 Subject: meta: Fix the BufferSubData in meta clear to be BufferData. Fixes a 3.4% +/- 1.3% performance regression in my GL demo (n=3). The other meta code could probably also use the same treatment. --- src/mesa/drivers/common/meta.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index ceb929f694..b38f22e130 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -1346,8 +1346,6 @@ _mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers) /* create vertex array buffer */ _mesa_GenBuffersARB(1, &clear->VBO); _mesa_BindBufferARB(GL_ARRAY_BUFFER_ARB, clear->VBO); - _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), - NULL, GL_DYNAMIC_DRAW_ARB); /* setup vertex arrays */ _mesa_VertexPointer(3, GL_FLOAT, sizeof(struct vertex), OFFSET(x)); @@ -1423,7 +1421,8 @@ _mesa_meta_Clear(GLcontext *ctx, GLbitfield buffers) } /* upload new vertex data */ - _mesa_BufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts); + _mesa_BufferDataARB(GL_ARRAY_BUFFER_ARB, sizeof(verts), verts, + GL_DYNAMIC_DRAW_ARB); } /* draw quad */ -- cgit v1.2.3 From d56125a298106d81e10674f1c4b3b43b51a5139d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 20 Oct 2009 14:51:53 -0700 Subject: intel: Fix flipped condition in ARB_sync GetSYnciv(GL_SYNC_STATUS). Bug #24435 --- src/mesa/drivers/dri/intel/intel_syncobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_syncobj.c b/src/mesa/drivers/dri/intel/intel_syncobj.c index 1286fe929b..0d7889d3c2 100644 --- a/src/mesa/drivers/dri/intel/intel_syncobj.c +++ b/src/mesa/drivers/dri/intel/intel_syncobj.c @@ -114,7 +114,7 @@ static void intel_check_sync(GLcontext *ctx, struct gl_sync_object *s) { struct intel_sync_object *sync = (struct intel_sync_object *)s; - if (sync->bo && drm_intel_bo_busy(sync->bo)) { + if (sync->bo && !drm_intel_bo_busy(sync->bo)) { drm_intel_bo_unreference(sync->bo); sync->bo = NULL; s->StatusFlag = 1; -- cgit v1.2.3 From 58abfebaad80b72c4a4bedad2d96a3959651eea3 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 21 Oct 2009 06:44:16 -0700 Subject: r300g: Kill r300_surface with fire. If you really want to see it again, check the history. --- src/gallium/drivers/r300/Makefile | 1 - src/gallium/drivers/r300/r300_surface.c | 381 -------------------------------- src/gallium/drivers/r300/r300_surface.h | 123 ----------- 3 files changed, 505 deletions(-) delete mode 100644 src/gallium/drivers/r300/r300_surface.c delete mode 100644 src/gallium/drivers/r300/r300_surface.h (limited to 'src') diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile index 69e4724790..c4f2c021c4 100644 --- a/src/gallium/drivers/r300/Makefile +++ b/src/gallium/drivers/r300/Makefile @@ -20,7 +20,6 @@ C_SOURCES = \ r300_state_derived.c \ r300_state_invariant.c \ r300_vs.c \ - r300_surface.c \ r300_texture.c \ r300_tgsi_to_rc.c diff --git a/src/gallium/drivers/r300/r300_surface.c b/src/gallium/drivers/r300/r300_surface.c deleted file mode 100644 index 5cf49d20aa..0000000000 --- a/src/gallium/drivers/r300/r300_surface.c +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Copyright 2008 Corbin Simpson - * Joakim Sindholt - * - * 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_surface.h" - -static void r300_surface_setup(struct r300_context* r300, - struct r300_texture* dest, - unsigned x, unsigned y, - unsigned w, unsigned h) -{ - struct r300_capabilities* caps = r300_screen(r300->context.screen)->caps; - unsigned pixpitch = r300_texture_get_stride(dest, 0) / dest->tex.block.size; - CS_LOCALS(r300); - - r300_emit_blend_state(r300, &blend_clear_state); - r300_emit_blend_color_state(r300, &blend_color_clear_state); - r300_emit_dsa_state(r300, &dsa_clear_state); - r300_emit_rs_state(r300, &rs_clear_state); - - BEGIN_CS(26); - - /* Viewport setup */ - OUT_CS_REG_SEQ(R300_SE_VPORT_XSCALE, 6); - OUT_CS_32F((float)w); - OUT_CS_32F((float)x); - OUT_CS_32F((float)h); - OUT_CS_32F((float)y); - OUT_CS_32F(1.0); - OUT_CS_32F(0.0); - - OUT_CS_REG(R300_VAP_VTE_CNTL, R300_VPORT_X_SCALE_ENA | - R300_VPORT_X_OFFSET_ENA | - R300_VPORT_Y_SCALE_ENA | - R300_VPORT_Y_OFFSET_ENA | - R300_VTX_XY_FMT | R300_VTX_Z_FMT); - - /* Pixel scissors. */ - OUT_CS_REG_SEQ(R300_SC_SCISSORS_TL, 2); - if (caps->is_r500) { - OUT_CS((x << R300_SCISSORS_X_SHIFT) | (y << R300_SCISSORS_Y_SHIFT)); - OUT_CS(((w - 1) << R300_SCISSORS_X_SHIFT) | ((h - 1) << R300_SCISSORS_Y_SHIFT)); - } else { - /* Non-R500 chipsets have an offset of 1440 in their scissors. */ - OUT_CS(((x + 1440) << R300_SCISSORS_X_SHIFT) | - ((y + 1440) << R300_SCISSORS_Y_SHIFT)); - OUT_CS((((w - 1) + 1440) << R300_SCISSORS_X_SHIFT) | - (((h - 1) + 1440) << R300_SCISSORS_Y_SHIFT)); - } - - /* Flush colorbuffer and blend caches. */ - OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, - R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D | - R300_RB3D_DSTCACHE_CTLSTAT_DC_FINISH_SIGNAL); - OUT_CS_REG(R300_ZB_ZCACHE_CTLSTAT, - R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE | - R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE); - - /* Setup colorbuffer. */ - OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0, 1); - OUT_CS_RELOC(dest->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0); - OUT_CS_REG_SEQ(R300_RB3D_COLORPITCH0, 1); - OUT_CS_RELOC(dest->buffer, pixpitch | - r300_translate_colorformat(dest->tex.format), 0, - RADEON_GEM_DOMAIN_VRAM, 0); - OUT_CS_REG(RB3D_COLOR_CHANNEL_MASK, 0xf); - - END_CS; -} - -/* Provides pipe_context's "surface_fill". Commonly used for clearing - * buffers. */ -static void r300_surface_fill(struct pipe_context* pipe, - struct pipe_surface* dest, - unsigned x, unsigned y, - unsigned w, unsigned h, - unsigned color) -{ - float r, g, b, a; - struct r300_context* r300 = r300_context(pipe); - struct r300_capabilities* caps = r300_screen(pipe->screen)->caps; - struct r300_texture* tex = (struct r300_texture*)dest->texture; - unsigned pixpitch = r300_texture_get_stride(tex, 0) / tex->tex.block.size; - boolean invalid = FALSE; - CS_LOCALS(r300); - - 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; - DBG(r300, DBG_SURF, "r300: Filling surface %p at (%d,%d)," - " dimensions %dx%d (pixel pitch %d), color 0x%x\n", - dest, x, y, w, h, pixpitch, color); - - /* Fallback? */ - if (!pipe->screen->is_format_supported(pipe->screen, dest->format, - PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) { -fallback: - DBG(r300, DBG_SURF | DBG_FALL, - "r300: Falling back on surface clear...\n"); - util_surface_fill(pipe, dest, x, y, w, h, color); - return; - } - - /* Make sure our target BO is okay. */ -validate: - if (!r300->winsys->add_buffer(r300->winsys, tex->buffer, - 0, RADEON_GEM_DOMAIN_VRAM)) { - r300->context.flush(&r300->context, 0, NULL); - goto validate; - } - if (!r300->winsys->validate(r300->winsys)) { - r300->context.flush(&r300->context, 0, NULL); - if (invalid) { - DBG(r300, DBG_SURF | DBG_FALL, "r300: Stuck in validation loop."); - goto fallback; - } - invalid = TRUE; - goto validate; - } - - r300_surface_setup(r300, tex, x, y, w, h); - - /* Vertex shader setup */ - if (caps->has_tcl) { - r300_emit_vertex_program_code(r300, &r300_passthrough_vertex_shader, 0); - } else { - BEGIN_CS(4); - OUT_CS_REG(R300_VAP_CNTL_STATUS, -#ifdef PIPE_ARCH_BIG_ENDIAN - R300_VC_32BIT_SWAP | -#endif - 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) | - R300_PVS_VF_MAX_VTX_NUM(12)); - END_CS; - } - - /* Fragment shader setup */ - if (caps->is_r500) { - r500_emit_fragment_program_code(r300, &r5xx_passthrough_fragment_shader, 0); - r300_emit_rs_block_state(r300, &r5xx_rs_block_clear_state); - } else { - r300_emit_fragment_program_code(r300, &r3xx_passthrough_fragment_shader, 0); - r300_emit_rs_block_state(r300, &r3xx_rs_block_clear_state); - } - - BEGIN_CS(26); - - /* 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); - - /* The size of the point we're about to draw, in sixths of pixels */ - OUT_CS_REG(R300_GA_POINT_SIZE, - ((h * 6) & R300_POINTSIZE_Y_MASK) | - ((w * 6) << R300_POINTSIZE_X_SHIFT)); - - /* Vertex size. */ - OUT_CS_REG(R300_VAP_VTX_SIZE, 0x8); - - /* 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)); - /* Position */ - OUT_CS_32F(0.5); - OUT_CS_32F(0.5); - OUT_CS_32F(1.0); - OUT_CS_32F(1.0); - /* Color */ - OUT_CS_32F(r); - OUT_CS_32F(g); - OUT_CS_32F(b); - OUT_CS_32F(a); - - OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, 0xA); - - END_CS; - - r300->dirty_hw++; -} - -static void r300_surface_copy(struct pipe_context* pipe, - struct pipe_surface* dest, - unsigned destx, unsigned desty, - struct pipe_surface* src, - unsigned srcx, unsigned srcy, - unsigned w, unsigned h) -{ - struct r300_context* r300 = r300_context(pipe); - 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 = r300_texture_get_stride(srctex, 0) / srctex->tex.block.size; - boolean invalid = FALSE; - float fsrcx = srcx, fsrcy = srcy, fdestx = destx, fdesty = desty; - CS_LOCALS(r300); - - DBG(r300, DBG_SURF, "r300: Copying surface %p at (%d,%d) to %p at (%d, %d)," - " dimensions %dx%d (pixel pitch %d)\n", - src, srcx, srcy, dest, destx, desty, w, h, pixpitch); - - if ((srctex->buffer == desttex->buffer) && - ((destx < srcx + w) || (srcx < destx + w)) && - ((desty < srcy + h) || (srcy < desty + h))) { - goto fallback; - } - - if (!pipe->screen->is_format_supported(pipe->screen, src->format, - PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER, 0) || - !pipe->screen->is_format_supported(pipe->screen, dest->format, - PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) { -fallback: - DBG(r300, DBG_SURF | DBG_FALL, "r300: Falling back on surface_copy\n"); - util_surface_copy(pipe, FALSE, dest, destx, desty, src, - srcx, srcy, w, h); - return; - } - - /* Add our target BOs to the list. */ -validate: - if (!r300->winsys->add_buffer(r300->winsys, srctex->buffer, - RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0)) { - r300->context.flush(&r300->context, 0, NULL); - goto validate; - } - if (!r300->winsys->add_buffer(r300->winsys, desttex->buffer, - 0, RADEON_GEM_DOMAIN_VRAM)) { - r300->context.flush(&r300->context, 0, NULL); - goto validate; - } - if (!r300->winsys->validate(r300->winsys)) { - r300->context.flush(&r300->context, 0, NULL); - if (invalid) { - DBG(r300, DBG_SURF | DBG_FALL, "r300: Stuck in validation loop."); - goto fallback; - } - invalid = TRUE; - goto validate; - } - - r300_surface_setup(r300, desttex, destx, desty, w, h); - - /* Setup the texture. */ - r300_emit_texture(r300, &r300_sampler_copy_state, srctex, 0); - - /* Flush and enable. */ - r300_flush_textures(r300); - - /* Vertex shader setup */ - if (caps->has_tcl) { - r300_emit_vertex_program_code(r300, &r300_passthrough_vertex_shader, 0); - } else { - BEGIN_CS(4); - OUT_CS_REG(R300_VAP_CNTL_STATUS, -#ifdef PIPE_ARCH_BIG_ENDIAN - R300_VC_32BIT_SWAP | -#endif - 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) | - R300_PVS_VF_MAX_VTX_NUM(12)); - END_CS; - } - - /* Fragment shader setup */ - if (caps->is_r500) { - r500_emit_fragment_program_code(r300, &r5xx_texture_fragment_shader, 0); - r300_emit_rs_block_state(r300, &r5xx_rs_block_copy_state); - } else { - r300_emit_fragment_program_code(r300, &r3xx_texture_fragment_shader, 0); - r300_emit_rs_block_state(r300, &r3xx_rs_block_copy_state); - } - - BEGIN_CS(30); - /* 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); - - /* Vertex size. */ - OUT_CS_REG(R300_VAP_VTX_SIZE, 0x4); - - /* Packet3 with our texcoords */ - OUT_CS_PKT3(R200_3D_DRAW_IMMD_2, 16); - OUT_CS(R300_PRIM_TYPE_QUADS | R300_PRIM_WALK_RING | - (4 << R300_PRIM_NUM_VERTICES_SHIFT)); - /* (x , y ) */ - OUT_CS_32F(fdestx / dest->width); - OUT_CS_32F(fdesty / dest->height); - OUT_CS_32F(fsrcx / src->width); - OUT_CS_32F(fsrcy / src->height); - /* (x , y + h) */ - OUT_CS_32F(fdestx / dest->width); - OUT_CS_32F((fdesty + h) / dest->height); - OUT_CS_32F(fsrcx / src->width); - OUT_CS_32F((fsrcy + h) / src->height); - /* (x + w, y + h) */ - OUT_CS_32F((fdestx + w) / dest->width); - OUT_CS_32F((fdesty + h) / dest->height); - OUT_CS_32F((fsrcx + w) / src->width); - OUT_CS_32F((fsrcy + h) / src->height); - /* (x + w, y ) */ - OUT_CS_32F((fdestx + w) / dest->width); - OUT_CS_32F(fdesty / dest->height); - OUT_CS_32F((fsrcx + w) / src->width); - OUT_CS_32F(fsrcy / src->height); - - OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, 0xA); - - END_CS; - - r300->dirty_hw++; -} - -void r300_init_surface_functions(struct r300_context* r300) -{ - r300->context.surface_fill = r300_surface_fill; - r300->context.surface_copy = r300_surface_copy; -} diff --git a/src/gallium/drivers/r300/r300_surface.h b/src/gallium/drivers/r300/r300_surface.h deleted file mode 100644 index d5998e6e6d..0000000000 --- a/src/gallium/drivers/r300/r300_surface.h +++ /dev/null @@ -1,123 +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. */ - -#ifndef R300_SURFACE_H -#define R300_SURFACE_H - -#include "pipe/p_context.h" -#include "pipe/p_screen.h" - -#include "util/u_rect.h" - -#include "r300_context.h" -#include "r300_cs.h" -#include "r300_emit.h" -#include "r300_fs.h" -#include "r300_vs.h" -#include "r300_state_inlines.h" - -static struct r300_blend_state blend_clear_state = { - .blend_control = 0x0, - .alpha_blend_control = 0x0, - .rop = 0x0, - .dither = 0x0, -}; - -static struct r300_blend_color_state blend_color_clear_state = { - .blend_color = 0x0, - .blend_color_red_alpha = 0x0, - .blend_color_green_blue = 0x0, -}; - -static struct r300_dsa_state dsa_clear_state = { - .alpha_function = 0x0, - .alpha_reference = 0x0, - .z_buffer_control = 0x0, - .z_stencil_control = 0x0, - .stencil_ref_mask = R300_STENCILWRITEMASK_MASK, - .stencil_ref_bf = 0x0, -}; - -static struct r300_rs_state rs_clear_state = { - .point_minmax = 0x36000006, - .line_control = 0x00030006, - .depth_scale_front = 0x0, - .depth_offset_front = 0x0, - .depth_scale_back = 0x0, - .depth_offset_back = 0x0, - .polygon_offset_enable = 0x0, - .cull_mode = 0x0, - .line_stipple_config = 0x3BAAAAAB, - .line_stipple_value = 0x0, - .color_control = R300_SHADE_MODEL_FLAT, -}; - -static struct r300_rs_block r3xx_rs_block_clear_state = { - .ip[0] = R500_RS_SEL_S(R300_RS_SEL_C0) | - R500_RS_SEL_T(R300_RS_SEL_C0) | - R500_RS_SEL_R(R300_RS_SEL_C0) | - R500_RS_SEL_Q(R300_RS_SEL_K1), - .inst[0] = R300_RS_INST_COL_CN_WRITE, - .count = R300_IT_COUNT(0) | R300_IC_COUNT(1) | R300_HIRES_EN, - .inst_count = 0, -}; - -static struct r300_rs_block r5xx_rs_block_clear_state = { - .ip[0] = R500_RS_SEL_S(R500_RS_IP_PTR_K0) | - R500_RS_SEL_T(R500_RS_IP_PTR_K0) | - R500_RS_SEL_R(R500_RS_IP_PTR_K0) | - R500_RS_SEL_Q(R500_RS_IP_PTR_K1), - .inst[0] = R500_RS_INST_COL_CN_WRITE, - .count = R300_IT_COUNT(0) | R300_IC_COUNT(1) | R300_HIRES_EN, - .inst_count = 0, -}; - -/* The following state is used for surface_copy only. */ - -static struct r300_rs_block r3xx_rs_block_copy_state = { - .ip[0] = R500_RS_SEL_S(R300_RS_SEL_K0) | - R500_RS_SEL_T(R300_RS_SEL_K0) | - R500_RS_SEL_R(R300_RS_SEL_K0) | - 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(0), -}; - -static struct r300_rs_block r5xx_rs_block_copy_state = { - .ip[0] = R500_RS_SEL_S(0) | - R500_RS_SEL_T(1) | - R500_RS_SEL_R(R500_RS_IP_PTR_K0) | - R500_RS_SEL_Q(R500_RS_IP_PTR_K1), - .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(0), -}; - -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 | - R300_TX_MIN_FILTER_NEAREST, -}; - -#endif /* R300_SURFACE_H */ -- cgit v1.2.3 From b21df2620ef970daa306e06c6ca69a9b66280cd6 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 21 Oct 2009 06:47:05 -0700 Subject: r300g: Also kill r300_shader_inlines with fire. --- src/gallium/drivers/r300/r300_shader_inlines.h | 47 -------------------------- 1 file changed, 47 deletions(-) delete mode 100644 src/gallium/drivers/r300/r300_shader_inlines.h (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_shader_inlines.h b/src/gallium/drivers/r300/r300_shader_inlines.h deleted file mode 100644 index a04f45b03e..0000000000 --- a/src/gallium/drivers/r300/r300_shader_inlines.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2009 Corbin Simpson - * Joakim Sindholt - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifndef R300_SHADER_INLINES_H -#define R300_SHADER_INLINES_H - -/* TGSI constants. TGSI is like XML: If it can't solve your problems, you're - * not using enough of it. */ -static const struct tgsi_full_src_register r300_constant_zero = { - .SrcRegister.Extended = TRUE, - .SrcRegister.File = TGSI_FILE_NULL, - .SrcRegisterExtSwz.ExtSwizzleX = TGSI_EXTSWIZZLE_ZERO, - .SrcRegisterExtSwz.ExtSwizzleY = TGSI_EXTSWIZZLE_ZERO, - .SrcRegisterExtSwz.ExtSwizzleZ = TGSI_EXTSWIZZLE_ZERO, - .SrcRegisterExtSwz.ExtSwizzleW = TGSI_EXTSWIZZLE_ZERO, -}; - -static const struct tgsi_full_src_register r300_constant_one = { - .SrcRegister.Extended = TRUE, - .SrcRegister.File = TGSI_FILE_NULL, - .SrcRegisterExtSwz.ExtSwizzleX = TGSI_EXTSWIZZLE_ONE, - .SrcRegisterExtSwz.ExtSwizzleY = TGSI_EXTSWIZZLE_ONE, - .SrcRegisterExtSwz.ExtSwizzleZ = TGSI_EXTSWIZZLE_ONE, - .SrcRegisterExtSwz.ExtSwizzleW = TGSI_EXTSWIZZLE_ONE, -}; - -#endif /* R300_SHADER_INLINES_H */ -- cgit v1.2.3 From b589e39809fa9d0b24a708d792b70ae5b120ffb8 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 21 Oct 2009 05:45:05 -0700 Subject: r300g: Examine vertex attribute type on HW TCL too. --- src/gallium/drivers/r300/r300_state_derived.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 5df1a0cd63..7297f9c653 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -244,10 +244,8 @@ static void r300_vertex_psc(struct r300_context* r300, assert(tab[i] != -1); /* Add the attribute to the PSC table. */ - temp = r300screen->caps->has_tcl ? - R300_DATA_TYPE_FLOAT_4 : - translate_vertex_data_type(vinfo->attrib[i].emit); - temp |= tab[i] << R300_DST_VEC_LOC_SHIFT; + temp = translate_vertex_data_type(vinfo->attrib[i].emit) | + tab[i] << R300_DST_VEC_LOC_SHIFT; if (i & 1) { vformat->vap_prog_stream_cntl[i >> 1] &= 0x0000ffff; -- cgit v1.2.3 From 5a0598f23569314a4ad72eda59e250ab9c43b46d Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 21 Oct 2009 05:48:45 -0700 Subject: r300g: Don't use the hashtable internally. As osiris pointed out, glxgears slowly gets slower for some reason when it's enabled, and it's not helping at the moment, so just turn it off. --- src/gallium/drivers/r300/r300_state_derived.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 7297f9c653..6e7679c39f 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -451,6 +451,7 @@ static void r300_update_derived_shader_state(struct r300_context* r300) struct r300_shader_derived_value* value; int i; + /* key = CALLOC_STRUCT(r300_shader_key); key->vs = r300->vs; key->fs = r300->fs; @@ -472,10 +473,11 @@ static void r300_update_derived_shader_state(struct r300_context* r300) value->rs_block = rs_block; util_hash_table_set(r300->shader_hash_table, (void*)key, (void*)value); - } + } */ /* XXX This will be refactored ASAP. */ vformat = CALLOC_STRUCT(r300_vertex_format); + rs_block = CALLOC_STRUCT(r300_rs_block); for (i = 0; i < 16; i++) { vformat->vs_tab[i] = -1; @@ -486,7 +488,10 @@ static void r300_update_derived_shader_state(struct r300_context* r300) r300_vertex_psc(r300, vformat); r300_update_fs_tab(r300, vformat); + r300_update_rs_block(r300, rs_block); + FREE(r300->vertex_info); + FREE(r300->rs_block); r300->vertex_info = vformat; r300->rs_block = rs_block; -- cgit v1.2.3 From babadb8bb9d68f3687a9c9cb80f98c732b1120c7 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 21 Oct 2009 05:54:49 -0700 Subject: r300g: Don't use getenv; use debug_get_*_option instead. --- src/gallium/drivers/r300/r300_chipset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_chipset.c b/src/gallium/drivers/r300/r300_chipset.c index d138866d33..9b763e2cb5 100644 --- a/src/gallium/drivers/r300/r300_chipset.c +++ b/src/gallium/drivers/r300/r300_chipset.c @@ -31,7 +31,7 @@ void r300_parse_chipset(struct r300_capabilities* caps) { /* Reasonable defaults */ caps->num_vert_fpus = 4; - caps->has_tcl = getenv("RADEON_NO_TCL") ? FALSE : TRUE; + caps->has_tcl = debug_get_bool_option("RADEON_NO_TCL", FALSE) ? FALSE : TRUE; caps->is_r500 = FALSE; caps->high_second_pipe = FALSE; -- cgit v1.2.3 From 6a448a525baf81173f92ee8c3074b98baa54397b Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 21 Oct 2009 06:31:36 -0700 Subject: r300g: Cleanup header includes. --- src/gallium/drivers/r300/r300_chipset.c | 1 + src/gallium/drivers/r300/r300_chipset.h | 6 +++--- src/gallium/drivers/r300/r300_clear.c | 3 +++ src/gallium/drivers/r300/r300_clear.h | 4 +--- src/gallium/drivers/r300/r300_context.c | 16 +++++++++++++++- src/gallium/drivers/r300/r300_context.h | 13 ------------- src/gallium/drivers/r300/r300_emit.c | 7 ++++++- src/gallium/drivers/r300/r300_emit.h | 7 ------- src/gallium/drivers/r300/r300_flush.c | 7 +++++++ src/gallium/drivers/r300/r300_flush.h | 7 ------- src/gallium/drivers/r300/r300_fs.c | 6 +++++- src/gallium/drivers/r300/r300_fs.h | 7 +++---- src/gallium/drivers/r300/r300_query.c | 8 +++++++- src/gallium/drivers/r300/r300_query.h | 4 ---- src/gallium/drivers/r300/r300_render.c | 5 ++++- src/gallium/drivers/r300/r300_screen.c | 7 +++++++ src/gallium/drivers/r300/r300_screen.h | 5 ----- src/gallium/drivers/r300/r300_state.c | 4 ++++ src/gallium/drivers/r300/r300_state_derived.c | 8 +++++++- src/gallium/drivers/r300/r300_state_inlines.h | 2 ++ src/gallium/drivers/r300/r300_state_invariant.c | 5 ++++- src/gallium/drivers/r300/r300_state_invariant.h | 6 +----- src/gallium/drivers/r300/r300_texture.c | 6 ++++++ src/gallium/drivers/r300/r300_texture.h | 3 --- 24 files changed, 86 insertions(+), 61 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_chipset.c b/src/gallium/drivers/r300/r300_chipset.c index 9b763e2cb5..51fdb82ff3 100644 --- a/src/gallium/drivers/r300/r300_chipset.c +++ b/src/gallium/drivers/r300/r300_chipset.c @@ -21,6 +21,7 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "r300_chipset.h" + #include "util/u_debug.h" /* r300_chipset: A file all to itself for deducing the various properties of diff --git a/src/gallium/drivers/r300/r300_chipset.h b/src/gallium/drivers/r300/r300_chipset.h index f015a4243d..0633a8b8a7 100644 --- a/src/gallium/drivers/r300/r300_chipset.h +++ b/src/gallium/drivers/r300/r300_chipset.h @@ -33,11 +33,11 @@ struct r300_capabilities { /* Chipset family */ int family; /* The number of vertex floating-point units */ - int num_vert_fpus; + unsigned num_vert_fpus; /* The number of fragment pipes */ - int num_frag_pipes; + unsigned num_frag_pipes; /* The number of z pipes */ - int num_z_pipes; + unsigned num_z_pipes; /* Whether or not TCL is physically present */ boolean has_tcl; /* Whether or not this is an RV515 or newer; R500s have many differences diff --git a/src/gallium/drivers/r300/r300_clear.c b/src/gallium/drivers/r300/r300_clear.c index 8b9cb819ae..02d6d504fc 100644 --- a/src/gallium/drivers/r300/r300_clear.c +++ b/src/gallium/drivers/r300/r300_clear.c @@ -21,6 +21,9 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "r300_clear.h" +#include "r300_context.h" + +#include "util/u_clear.h" /* Clears currently bound buffers. */ void r300_clear(struct pipe_context* pipe, diff --git a/src/gallium/drivers/r300/r300_clear.h b/src/gallium/drivers/r300/r300_clear.h index cd5900565e..b8fcdf273c 100644 --- a/src/gallium/drivers/r300/r300_clear.h +++ b/src/gallium/drivers/r300/r300_clear.h @@ -23,9 +23,7 @@ #ifndef R300_CLEAR_H #define R300_CLEAR_H -#include "util/u_clear.h" - -#include "r300_context.h" +struct pipe_context; void r300_clear(struct pipe_context* pipe, unsigned buffers, diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 7b370b3e95..4ba11a026e 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -20,10 +20,24 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "r300_context.h" +#include "draw/draw_context.h" + +#include "pipe/p_inlines.h" + +#include "tgsi/tgsi_scan.h" +#include "util/u_hash_table.h" +#include "util/u_memory.h" +#include "util/u_simple_list.h" + +#include "r300_clear.h" +#include "r300_context.h" #include "r300_flush.h" +#include "r300_query.h" +#include "r300_screen.h" +#include "r300_state_derived.h" #include "r300_state_invariant.h" +#include "r300_winsys.h" static boolean r300_draw_range_elements(struct pipe_context* pipe, struct pipe_buffer* indexBuffer, diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 2d608d6afc..61a57df35e 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -23,23 +23,10 @@ #ifndef R300_CONTEXT_H #define R300_CONTEXT_H -#include "draw/draw_context.h" #include "draw/draw_vertex.h" #include "pipe/p_context.h" -#include "tgsi/tgsi_scan.h" - -#include "util/u_hash_table.h" -#include "util/u_memory.h" -#include "util/u_simple_list.h" - -#include "r300_clear.h" -#include "r300_query.h" -#include "r300_screen.h" -#include "r300_state_derived.h" -#include "r300_winsys.h" - struct r300_fragment_shader; struct r300_vertex_shader; diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index df2046bd0c..258c38fefd 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -22,10 +22,15 @@ /* r300_emit: Functions for emitting state. */ -#include "r300_emit.h" +#include "util/u_math.h" +#include "r300_context.h" +#include "r300_cs.h" +#include "r300_emit.h" #include "r300_fs.h" +#include "r300_screen.h" #include "r300_state_derived.h" +#include "r300_state_inlines.h" #include "r300_vs.h" void r300_emit_blend_state(struct r300_context* r300, diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h index 7e469ea0c7..02ac5bebbd 100644 --- a/src/gallium/drivers/r300/r300_emit.h +++ b/src/gallium/drivers/r300/r300_emit.h @@ -23,13 +23,6 @@ #ifndef R300_EMIT_H #define R300_EMIT_H -#include "util/u_math.h" - -#include "r300_context.h" -#include "r300_cs.h" -#include "r300_screen.h" -#include "r300_state_inlines.h" - struct rX00_fragment_program_code; struct r300_vertex_program_code; diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c index d60652a021..c222ea09b1 100644 --- a/src/gallium/drivers/r300/r300_flush.c +++ b/src/gallium/drivers/r300/r300_flush.c @@ -20,6 +20,13 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include "draw/draw_context.h" +#include "draw/draw_private.h" + +#include "util/u_simple_list.h" + +#include "r300_context.h" +#include "r300_cs.h" #include "r300_emit.h" #include "r300_flush.h" #include "r300_state_invariant.h" diff --git a/src/gallium/drivers/r300/r300_flush.h b/src/gallium/drivers/r300/r300_flush.h index 9a83d89daa..0e9e6106bb 100644 --- a/src/gallium/drivers/r300/r300_flush.h +++ b/src/gallium/drivers/r300/r300_flush.h @@ -23,13 +23,6 @@ #ifndef R300_FLUSH_H #define R300_FLUSH_H -#include "draw/draw_private.h" - -#include "pipe/p_context.h" - -#include "r300_context.h" -#include "r300_cs.h" - void r300_init_flush_functions(struct r300_context* r300); #endif /* R300_FLUSH_H */ diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c index 546ad545a5..2db185fd80 100644 --- a/src/gallium/drivers/r300/r300_fs.c +++ b/src/gallium/drivers/r300/r300_fs.c @@ -21,10 +21,14 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "r300_fs.h" +#include "tgsi/tgsi_dump.h" +#include "r300_context.h" +#include "r300_screen.h" +#include "r300_fs.h" #include "r300_tgsi_to_rc.h" +#include "radeon_code.h" #include "radeon_compiler.h" static void find_output_registers(struct r300_fragment_program_compiler * compiler, diff --git a/src/gallium/drivers/r300/r300_fs.h b/src/gallium/drivers/r300/r300_fs.h index 04453274aa..8dfb139738 100644 --- a/src/gallium/drivers/r300/r300_fs.h +++ b/src/gallium/drivers/r300/r300_fs.h @@ -24,14 +24,13 @@ #ifndef R300_FS_H #define R300_FS_H -#include "tgsi/tgsi_dump.h" +#include "pipe/p_state.h" + +#include "tgsi/tgsi_scan.h" -#include "r300_context.h" #include "r3xx_fs.h" #include "r5xx_fs.h" -#include "radeon_code.h" - struct r300_fragment_shader { /* Parent class */ struct pipe_shader_state state; diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c index 2b0fbfb7d2..007f11efae 100644 --- a/src/gallium/drivers/r300/r300_query.c +++ b/src/gallium/drivers/r300/r300_query.c @@ -20,9 +20,15 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "r300_query.h" +#include "util/u_memory.h" +#include "util/u_simple_list.h" +#include "r300_context.h" +#include "r300_screen.h" +#include "r300_cs.h" #include "r300_emit.h" +#include "r300_query.h" +#include "r300_reg.h" static struct pipe_query *r300_create_query(struct pipe_context *pipe, unsigned query_type) diff --git a/src/gallium/drivers/r300/r300_query.h b/src/gallium/drivers/r300/r300_query.h index 4f50e8f844..48876da312 100644 --- a/src/gallium/drivers/r300/r300_query.h +++ b/src/gallium/drivers/r300/r300_query.h @@ -23,10 +23,6 @@ #ifndef R300_QUERY_H #define R300_QUERY_H -#include "r300_context.h" -#include "r300_cs.h" -#include "r300_reg.h" - struct r300_context; static INLINE struct r300_query* r300_query(struct pipe_query* q) diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 4e778e1e57..79a33b53cb 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -20,8 +20,11 @@ * 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_context.h" #include "draw/draw_vbuf.h" + +#include "pipe/p_inlines.h" + #include "util/u_memory.h" #include "r300_cs.h" diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index cc499d400a..a9058a25e5 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -20,7 +20,14 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include "pipe/p_inlines.h" +#include "util/u_memory.h" +#include "util/u_simple_screen.h" + +#include "r300_context.h" #include "r300_screen.h" +#include "r300_texture.h" +#include "r300_winsys.h" /* Return the identifier behind whom the brave coders responsible for this * amalgamation of code, sweat, and duct tape, routinely obscure their names. diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h index 2a0e41fbc3..41df31f670 100644 --- a/src/gallium/drivers/r300/r300_screen.h +++ b/src/gallium/drivers/r300/r300_screen.h @@ -23,14 +23,9 @@ #ifndef R300_SCREEN_H #define R300_SCREEN_H -#include "pipe/p_inlines.h" #include "pipe/p_screen.h" -#include "util/u_memory.h" -#include "util/u_simple_screen.h" #include "r300_chipset.h" -#include "r300_texture.h" -#include "r300_winsys.h" struct r300_screen { /* Parent class */ diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 0a982a9d5d..c4c9e5d7c2 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -20,8 +20,11 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include "draw/draw_context.h" + #include "util/u_debug.h" #include "util/u_math.h" +#include "util/u_memory.h" #include "util/u_pack_color.h" #include "tgsi/tgsi_parse.h" @@ -31,6 +34,7 @@ #include "r300_context.h" #include "r300_reg.h" +#include "r300_screen.h" #include "r300_state_inlines.h" #include "r300_fs.h" #include "r300_vs.h" diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 6e7679c39f..e749bd9cb9 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -20,9 +20,15 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "r300_state_derived.h" +#include "draw/draw_context.h" + +#include "util/u_math.h" +#include "util/u_memory.h" +#include "r300_context.h" #include "r300_fs.h" +#include "r300_screen.h" +#include "r300_state_derived.h" #include "r300_state_inlines.h" #include "r300_vs.h" diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index d7b57e1b22..9135c55ec4 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -24,6 +24,8 @@ #ifndef R300_STATE_INLINES_H #define R300_STATE_INLINES_H +#include "draw/draw_vertex.h" + #include "pipe/p_format.h" #include "r300_reg.h" diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c index 3865730d63..4865f16058 100644 --- a/src/gallium/drivers/r300/r300_state_invariant.c +++ b/src/gallium/drivers/r300/r300_state_invariant.c @@ -21,9 +21,12 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include "r300_context.h" +#include "r300_cs.h" +#include "r300_reg.h" +#include "r300_screen.h" #include "r300_state_invariant.h" - struct pipe_viewport_state r300_viewport_identity = { .scale = {1.0, 1.0, 1.0, 1.0}, .translate = {0.0, 0.0, 0.0, 0.0}, diff --git a/src/gallium/drivers/r300/r300_state_invariant.h b/src/gallium/drivers/r300/r300_state_invariant.h index 5bea6779fe..05cff0d6df 100644 --- a/src/gallium/drivers/r300/r300_state_invariant.h +++ b/src/gallium/drivers/r300/r300_state_invariant.h @@ -23,11 +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" -#include "r300_state_inlines.h" +struct r300_context; void r300_emit_invariant_state(struct r300_context* r300); diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 7ea4c33fa9..339fbb6242 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -20,6 +20,12 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#include "pipe/p_screen.h" + +#include "util/u_math.h" +#include "util/u_memory.h" + +#include "r300_context.h" #include "r300_texture.h" static void r300_setup_texture_state(struct r300_texture* tex) diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h index 992dad77ab..2e58bda716 100644 --- a/src/gallium/drivers/r300/r300_texture.h +++ b/src/gallium/drivers/r300/r300_texture.h @@ -23,11 +23,8 @@ #ifndef R300_TEXTURE_H #define R300_TEXTURE_H -#include "pipe/p_screen.h" #include "pipe/p_video_state.h" -#include "util/u_math.h" -#include "r300_context.h" #include "r300_reg.h" struct r300_texture; -- cgit v1.2.3 From 3b8dad47f816667aa4166d6e27361d274fc2cf4d Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 21 Oct 2009 06:49:16 -0700 Subject: r300g: No debug in r300_state. --- src/gallium/drivers/r300/r300_state.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index c4c9e5d7c2..a3e1bc621a 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -22,7 +22,6 @@ #include "draw/draw_context.h" -#include "util/u_debug.h" #include "util/u_math.h" #include "util/u_memory.h" #include "util/u_pack_color.h" -- cgit v1.2.3 From ce98860012b10cc6cc124fd1ed6fa3a5e28712bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 20 Oct 2009 10:54:21 +0100 Subject: llvmpipe: Remove extraneous name in lp_type pre-declaration. --- src/gallium/drivers/llvmpipe/lp_bld_arit.h | 2 +- src/gallium/drivers/llvmpipe/lp_bld_const.h | 2 +- src/gallium/drivers/llvmpipe/lp_bld_conv.h | 2 +- src/gallium/drivers/llvmpipe/lp_bld_logic.h | 2 +- src/gallium/drivers/llvmpipe/lp_bld_swizzle.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.h b/src/gallium/drivers/llvmpipe/lp_bld_arit.h index 095a8e1cab..4e568c055e 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_arit.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.h @@ -40,7 +40,7 @@ #include -struct lp_type type; +struct lp_type; struct lp_build_context; diff --git a/src/gallium/drivers/llvmpipe/lp_bld_const.h b/src/gallium/drivers/llvmpipe/lp_bld_const.h index ffb302f736..cb8e1c7b00 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_const.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_const.h @@ -42,7 +42,7 @@ #include -struct lp_type type; +struct lp_type; unsigned diff --git a/src/gallium/drivers/llvmpipe/lp_bld_conv.h b/src/gallium/drivers/llvmpipe/lp_bld_conv.h index ca378804d2..948e68fae4 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_conv.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_conv.h @@ -40,7 +40,7 @@ #include -struct lp_type type; +struct lp_type; LLVMValueRef diff --git a/src/gallium/drivers/llvmpipe/lp_bld_logic.h b/src/gallium/drivers/llvmpipe/lp_bld_logic.h index a4ee7723b5..d67500ef70 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_logic.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_logic.h @@ -42,7 +42,7 @@ #include "pipe/p_defines.h" /* For PIPE_FUNC_xxx */ -struct lp_type type; +struct lp_type; struct lp_build_context; diff --git a/src/gallium/drivers/llvmpipe/lp_bld_swizzle.h b/src/gallium/drivers/llvmpipe/lp_bld_swizzle.h index 1f6da80448..b9472127a6 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_swizzle.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_swizzle.h @@ -40,7 +40,7 @@ #include -struct lp_type type; +struct lp_type; struct lp_build_context; -- cgit v1.2.3 From cb351bdd6e09b40fe719c548c48ea40c6c4c3d11 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Wed, 21 Oct 2009 21:56:09 +0200 Subject: nouveau: nv30: check number of colour buffers to bind --- src/gallium/drivers/nv30/nv30_state_fb.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nv30/nv30_state_fb.c b/src/gallium/drivers/nv30/nv30_state_fb.c index 9b0266fba5..197de82886 100644 --- a/src/gallium/drivers/nv30/nv30_state_fb.c +++ b/src/gallium/drivers/nv30/nv30_state_fb.c @@ -17,6 +17,10 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) struct nv30_miptree *nv30mt; int colour_bits = 32, zeta_bits = 32; + if (fb->nr_cbufs == 0) { + return FALSE; + } + rt_enable = 0; for (i = 0; i < fb->nr_cbufs; i++) { if (colour_format) { -- cgit v1.2.3 From d364f662c685ba0f28aa865fbd7e1f0acc3c469e Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Wed, 21 Oct 2009 22:01:03 +0200 Subject: nouveau: nv30: Do not use assert to return NULL --- src/gallium/drivers/nv30/nv30_fragtex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nv30/nv30_fragtex.c b/src/gallium/drivers/nv30/nv30_fragtex.c index 822e1d8def..a2ce947a72 100644 --- a/src/gallium/drivers/nv30/nv30_fragtex.c +++ b/src/gallium/drivers/nv30/nv30_fragtex.c @@ -69,7 +69,7 @@ nv30_fragtex_build(struct nv30_context *nv30, int unit) tf = nv30_fragtex_format(pt->format); if (!tf) - assert(0); + return NULL; txf = tf->format; txf |= ((pt->last_level>0) ? NV34TCL_TX_FORMAT_MIPMAP : 0); -- cgit v1.2.3 From 2cc5a0e6bb8fe2aa0733d70fec65df934b1093f6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 20 Oct 2009 16:13:08 -0600 Subject: mesa: added _mesa_dump_renderbuffers() debug code --- src/mesa/main/debug.c | 76 +++++++++++++++++++++++++++++++++++++++++++++++++-- src/mesa/main/debug.h | 3 ++ 2 files changed, 77 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 490cc9c26b..8b1707bab3 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -27,6 +27,7 @@ #include "attrib.h" #include "colormac.h" #include "context.h" +#include "enums.h" #include "hash.h" #include "imports.h" #include "debug.h" @@ -264,10 +265,13 @@ write_ppm(const char *filename, const GLubyte *buffer, int width, int height, /** - * Write level[0] image to a ppm file. + * Write a texture image to a ppm file. + * \param face cube face in [0,5] + * \param level mipmap level */ static void -write_texture_image(struct gl_texture_object *texObj, GLuint face, GLuint level) +write_texture_image(struct gl_texture_object *texObj, + GLuint face, GLuint level) { struct gl_texture_image *img = texObj->Image[face][level]; if (img) { @@ -299,6 +303,45 @@ write_texture_image(struct gl_texture_object *texObj, GLuint face, GLuint level) } +/** + * Write renderbuffer image to a ppm file. + */ +static void +write_renderbuffer_image(const struct gl_renderbuffer *rb) +{ + GET_CURRENT_CONTEXT(ctx); + GLubyte *buffer; + char s[100]; + GLenum format, type; + + if (rb->_BaseFormat == GL_RGB || + rb->_BaseFormat == GL_RGBA) { + format = GL_RGBA; + type = GL_UNSIGNED_BYTE; + } + else if (rb->_BaseFormat == GL_DEPTH_STENCIL) { + format = GL_DEPTH_STENCIL; + type = GL_UNSIGNED_INT_24_8; + } + else { + return; + } + + buffer = (GLubyte *) _mesa_malloc(rb->Width * rb->Height * 4); + + ctx->Driver.ReadPixels(ctx, 0, 0, rb->Width, rb->Height, + format, type, &ctx->DefaultPacking, buffer); + + /* make filename */ + _mesa_sprintf(s, "/tmp/renderbuffer%u.ppm", rb->Name); + + _mesa_printf(" Writing renderbuffer image to %s\n", s); + write_ppm(s, buffer, rb->Width, rb->Height, 4, 0, 1, 2, GL_TRUE); + + _mesa_free(buffer); +} + + static GLboolean DumpImages; @@ -341,6 +384,35 @@ _mesa_dump_textures(GLboolean dumpImages) } +static void +dump_renderbuffer_cb(GLuint id, void *data, void *userData) +{ + const struct gl_renderbuffer *rb = (const struct gl_renderbuffer *) data; + (void) userData; + + _mesa_printf("Renderbuffer %u: %u x %u IntFormat = %s\n", + rb->Name, rb->Width, rb->Height, + _mesa_lookup_enum_by_nr(rb->InternalFormat)); + if (DumpImages) { + write_renderbuffer_image(rb); + } +} + + +/** + * Print basic info about all renderbuffers to stdout. + * If dumpImages is true, write PPM of level[0] image to a file. + */ +void +_mesa_dump_renderbuffers(GLboolean dumpImages) +{ + GET_CURRENT_CONTEXT(ctx); + DumpImages = dumpImages; + _mesa_HashWalk(ctx->Shared->RenderBuffers, dump_renderbuffer_cb, ctx); +} + + + void _mesa_dump_color_buffer(const char *filename) { diff --git a/src/mesa/main/debug.h b/src/mesa/main/debug.h index bb384c4324..2a7de9c6b6 100644 --- a/src/mesa/main/debug.h +++ b/src/mesa/main/debug.h @@ -60,6 +60,9 @@ extern void _mesa_init_debug( GLcontext *ctx ); extern void _mesa_dump_textures(GLboolean dumpImages); +extern void +_mesa_dump_renderbuffers(GLboolean dumpImages); + extern void _mesa_dump_color_buffer(const char *filename); -- cgit v1.2.3 From b2b239691dfe593676aaee0cd990fa76354ac96f Mon Sep 17 00:00:00 2001 From: Marc Dietrich Date: Sun, 18 Oct 2009 08:28:33 -0700 Subject: gallium/util: fix cpu detection on ppc As we are compiling with -D_BSD_SOURCE, sigjmp_buf and siglongjmp should be replaced by the non-sig functions (see man 3 setjmp). Tested on linux/cell. --- src/gallium/auxiliary/util/u_cpu_detect.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c index b94390aef9..7330d5dbd0 100644 --- a/src/gallium/auxiliary/util/u_cpu_detect.c +++ b/src/gallium/auxiliary/util/u_cpu_detect.c @@ -131,7 +131,7 @@ win32_sig_handler_sse(EXCEPTION_POINTERS* ep) #if defined(PIPE_ARCH_PPC) && !defined(PIPE_OS_DARWIN) -static sigjmp_buf __lv_powerpc_jmpbuf; +static jmp_buf __lv_powerpc_jmpbuf; static volatile sig_atomic_t __lv_powerpc_canjump = 0; static void @@ -143,9 +143,11 @@ sigill_handler(int sig) } __lv_powerpc_canjump = 0; - siglongjmp(__lv_powerpc_jmpbuf, 1); + longjmp(__lv_powerpc_jmpbuf, 1); } +#endif +#if defined(PIPE_ARCH_PPC) static void check_os_altivec_support(void) { @@ -166,7 +168,7 @@ check_os_altivec_support(void) /* no Darwin, do it the brute-force way */ /* this is borrowed from the libmpeg2 library */ signal(SIGILL, sigill_handler); - if (sigsetjmp(__lv_powerpc_jmpbuf, 1)) { + if (setjmp(__lv_powerpc_jmpbuf)) { signal(SIGILL, SIG_DFL); } else { __lv_powerpc_canjump = 1; @@ -180,9 +182,9 @@ check_os_altivec_support(void) signal(SIGILL, SIG_DFL); util_cpu_caps.has_altivec = 1; } -#endif +#endif /* PIPE_OS_DARWIN */ } -#endif +#endif /* PIPE_ARCH_PPC */ /* If we're running on a processor that can do SSE, let's see if we * are allowed to or not. This will catch 2.4.0 or later kernels that @@ -190,6 +192,7 @@ check_os_altivec_support(void) * and RedHat patched 2.2 kernels that have broken exception handling * support for user space apps that do SSE. */ +#if defined(PIPE_ARCH_X86) || defined (PIPE_ARCH_X86_64) static void check_os_katmai_support(void) { @@ -370,6 +373,7 @@ cpuid(uint32_t ax, uint32_t *p) return ret; } +#endif /* X86 or X86_64 */ void util_cpu_detect(void) -- cgit v1.2.3 From e4c700dbbf2a802f32bf62256c801105998c3729 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 21 Oct 2009 19:55:44 -0600 Subject: mesa: added MESA_FORMAT_X8_Z24 format 24-bit Z in 32-bit pixel. We could probably use the MESA_FORMAT_S8_Z24 format but this there's a few places where we explicitly don't want stencil. This format may go away at some point in the future. --- src/mesa/main/formats.c | 13 +++++++++++++ src/mesa/main/formats.h | 1 + src/mesa/main/texfetch.c | 7 +++++++ src/mesa/main/texstore.c | 36 ++++++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 2924ab69cc..45ac39a818 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -290,6 +290,14 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 16, 0, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 2 /* BlockWidth/Height,Bytes */ }, + { + MESA_FORMAT_X8_Z24, /* Name */ + GL_DEPTH_COMPONENT, /* BaseFormat */ + GL_UNSIGNED_INT, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 24, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, { MESA_FORMAT_Z32, /* Name */ GL_DEPTH_COMPONENT, /* BaseFormat */ @@ -873,6 +881,11 @@ _mesa_format_to_type_and_comps(gl_format format, *comps = 1; return; + case MESA_FORMAT_X8_Z24: + *datatype = GL_UNSIGNED_INT; + *comps = 1; + return; + case MESA_FORMAT_Z32: *datatype = GL_UNSIGNED_INT; *comps = 1; diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 30915bfe4b..f8b4a6cdf4 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -76,6 +76,7 @@ typedef enum MESA_FORMAT_Z24_S8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ SSSS SSSS */ MESA_FORMAT_S8_Z24, /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ MESA_FORMAT_Z16, /* ZZZZ ZZZZ ZZZZ ZZZZ */ + MESA_FORMAT_X8_Z24, /* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ MESA_FORMAT_Z32, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ MESA_FORMAT_S8, /* SSSS SSSS */ /*@}*/ diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c index c50219521b..e6e28aef19 100644 --- a/src/mesa/main/texfetch.c +++ b/src/mesa/main/texfetch.c @@ -522,6 +522,13 @@ texfetch_funcs[MESA_FORMAT_COUNT] = fetch_texel_3d_f_z16, store_texel_z16 }, + { + MESA_FORMAT_X8_Z24, + fetch_texel_1d_f_s8_z24, + fetch_texel_2d_f_s8_z24, + fetch_texel_3d_f_s8_z24, + store_texel_s8_z24 + }, { MESA_FORMAT_Z32, fetch_texel_1d_f_z32, diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 604f6c462a..d0d4250352 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1048,6 +1048,41 @@ _mesa_texstore_z32(TEXSTORE_PARAMS) return GL_TRUE; } + +/** + * Store a 24-bit integer depth component texture image. + */ +static GLboolean +_mesa_texstore_x8_z24(TEXSTORE_PARAMS) +{ + const GLuint depthScale = 0xffffff; + const GLuint texelBytes = 4; + + (void) dims; + ASSERT(dstFormat == MESA_FORMAT_X8_Z24); + + { + /* general path */ + GLint img, row; + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = (GLubyte *) dstAddr + + dstImageOffsets[dstZoffset + img] * texelBytes + + dstYoffset * dstRowStride + + dstXoffset * texelBytes; + for (row = 0; row < srcHeight; row++) { + const GLvoid *src = _mesa_image_address(dims, srcPacking, + srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0); + _mesa_unpack_depth_span(ctx, srcWidth, + GL_UNSIGNED_INT, (GLuint *) dstRow, + depthScale, srcType, src, srcPacking); + dstRow += dstRowStride; + } + } + } + return GL_TRUE; +} + + #define STRIDE_3D 0 /** @@ -3009,6 +3044,7 @@ texstore_funcs[MESA_FORMAT_COUNT] = { MESA_FORMAT_Z24_S8, _mesa_texstore_z24_s8 }, { MESA_FORMAT_S8_Z24, _mesa_texstore_s8_z24 }, { MESA_FORMAT_Z16, _mesa_texstore_z16 }, + { MESA_FORMAT_X8_Z24, _mesa_texstore_x8_z24 }, { MESA_FORMAT_Z32, _mesa_texstore_z32 }, { MESA_FORMAT_S8, NULL/*_mesa_texstore_s8*/ }, { MESA_FORMAT_SRGB8, _mesa_texstore_srgb8 }, -- cgit v1.2.3 From 832f29770d91c7d98c9b8438922247fff8f0f8bd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 21 Oct 2009 19:56:18 -0600 Subject: mesa: use MESA_FORMAT_X8_Z24 format --- src/mesa/main/depthstencil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/depthstencil.c b/src/mesa/main/depthstencil.c index 803dc6c75e..6fefdac1e3 100644 --- a/src/mesa/main/depthstencil.c +++ b/src/mesa/main/depthstencil.c @@ -366,7 +366,7 @@ _mesa_new_z24_renderbuffer_wrapper(GLcontext *ctx, z24rb->Width = dsrb->Width; z24rb->Height = dsrb->Height; z24rb->InternalFormat = GL_DEPTH_COMPONENT24; - z24rb->Format = MESA_FORMAT_Z24_S8; + z24rb->Format = MESA_FORMAT_X8_Z24; z24rb->_BaseFormat = GL_DEPTH_COMPONENT; z24rb->DataType = GL_UNSIGNED_INT; z24rb->Data = NULL; -- cgit v1.2.3 From c55b355fd460453a459e073ac4119c69e06e7531 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 21 Oct 2009 19:58:00 -0600 Subject: mesa: use MESA_FORMAT_X8_Z24 --- src/mesa/main/renderbuffer.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index 409fd8634a..0e21656385 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -1052,6 +1052,18 @@ _mesa_soft_renderbuffer_storage(GLcontext *ctx, struct gl_renderbuffer *rb, pixelSize = sizeof(GLushort); break; case GL_DEPTH_COMPONENT24: + rb->DataType = GL_UNSIGNED_INT; + rb->GetPointer = get_pointer_uint; + rb->GetRow = get_row_uint; + rb->GetValues = get_values_uint; + rb->PutRow = put_row_uint; + rb->PutRowRGB = NULL; + rb->PutMonoRow = put_mono_row_uint; + rb->PutValues = put_values_uint; + rb->PutMonoValues = put_mono_values_uint; + rb->Format = MESA_FORMAT_X8_Z24; + pixelSize = sizeof(GLuint); + break; case GL_DEPTH_COMPONENT32: rb->DataType = GL_UNSIGNED_INT; rb->GetPointer = get_pointer_uint; @@ -1735,6 +1747,10 @@ _mesa_add_depth_renderbuffer(GLcontext *ctx, struct gl_framebuffer *fb, rb->Format = MESA_FORMAT_Z16; rb->InternalFormat = GL_DEPTH_COMPONENT16; } + else if (depthBits <= 24) { + rb->Format = MESA_FORMAT_X8_Z24; + rb->InternalFormat = GL_DEPTH_COMPONENT24; + } else { rb->Format = MESA_FORMAT_Z32; rb->InternalFormat = GL_DEPTH_COMPONENT32; -- cgit v1.2.3 From 4bd70b5cff13039a4b0e0c554156fec06e3c3906 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 21 Oct 2009 20:00:43 -0600 Subject: i965: change parameter type to gl_format --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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 ea559d2ac7..5d8bb7a14b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -69,7 +69,8 @@ static GLuint translate_tex_target( GLenum target ) } -static GLuint translate_tex_format( GLuint mesa_format, GLenum internal_format, +static GLuint translate_tex_format( gl_format mesa_format, + GLenum internal_format, GLenum depth_mode ) { switch( mesa_format ) { -- cgit v1.2.3 From 68d94a608a6d46156a567b8f0e011ac58054975e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 21 Oct 2009 20:02:33 -0600 Subject: intel: use MESA_FORMAT_S8_Z24 format and avoid z24s8/s8z24 conversions --- src/mesa/drivers/dri/intel/intel_buffers.c | 2 +- src/mesa/drivers/dri/intel/intel_fbo.c | 26 +++++++++++++------------- src/mesa/drivers/dri/intel/intel_span.c | 20 ++++---------------- src/mesa/drivers/dri/intel/intel_tex_format.c | 2 +- 4 files changed, 19 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index fce227e9d9..6661cc77d2 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -257,7 +257,7 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) if (fb->_StencilBuffer && fb->_StencilBuffer->Wrapped) { irbStencil = intel_renderbuffer(fb->_StencilBuffer->Wrapped); if (irbStencil && irbStencil->region) { - ASSERT(irbStencil->Base.Format == MESA_FORMAT_Z24_S8); + ASSERT(irbStencil->Base.Format == MESA_FORMAT_S8_Z24); FALLBACK(intel, INTEL_FALLBACK_STENCIL_BUFFER, GL_FALSE); } else { diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 292cccf7f2..2d73f6e2a3 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -148,10 +148,10 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_STENCIL_INDEX8_EXT: case GL_STENCIL_INDEX16_EXT: /* alloc a depth+stencil buffer */ - rb->Format = MESA_FORMAT_Z24_S8; + rb->Format = MESA_FORMAT_S8_Z24; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; cpp = 4; - irb->texformat = MESA_FORMAT_Z24_S8; + irb->texformat = MESA_FORMAT_S8_Z24; break; case GL_DEPTH_COMPONENT16: rb->Format = MESA_FORMAT_Z16; @@ -162,17 +162,17 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT32: - rb->Format = MESA_FORMAT_Z24_S8; + rb->Format = MESA_FORMAT_S8_Z24; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; cpp = 4; - irb->texformat = MESA_FORMAT_Z24_S8; + irb->texformat = MESA_FORMAT_S8_Z24; break; case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: - rb->Format = MESA_FORMAT_Z24_S8; + rb->Format = MESA_FORMAT_S8_Z24; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; cpp = 4; - irb->texformat = MESA_FORMAT_Z24_S8; + irb->texformat = MESA_FORMAT_S8_Z24; break; default: _mesa_problem(ctx, @@ -328,10 +328,10 @@ intel_create_renderbuffer(GLenum intFormat) irb->texformat = MESA_FORMAT_ARGB8888; break; case GL_STENCIL_INDEX8_EXT: - irb->Base.Format = MESA_FORMAT_Z24_S8; + irb->Base.Format = MESA_FORMAT_S8_Z24; irb->Base._BaseFormat = GL_STENCIL_INDEX; irb->Base.DataType = GL_UNSIGNED_BYTE; - irb->texformat = MESA_FORMAT_Z24_S8; + irb->texformat = MESA_FORMAT_S8_Z24; break; case GL_DEPTH_COMPONENT16: irb->Base.Format = MESA_FORMAT_Z16; @@ -340,16 +340,16 @@ intel_create_renderbuffer(GLenum intFormat) irb->texformat = MESA_FORMAT_Z16; break; case GL_DEPTH_COMPONENT24: - irb->Base.Format = MESA_FORMAT_Z24_S8; + irb->Base.Format = MESA_FORMAT_S8_Z24; irb->Base._BaseFormat = GL_DEPTH_COMPONENT; irb->Base.DataType = GL_UNSIGNED_INT; - irb->texformat = MESA_FORMAT_Z24_S8; + irb->texformat = MESA_FORMAT_S8_Z24; break; case GL_DEPTH24_STENCIL8_EXT: - irb->Base.Format = MESA_FORMAT_Z24_S8; + irb->Base.Format = MESA_FORMAT_S8_Z24; irb->Base._BaseFormat = GL_DEPTH_STENCIL; irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT; - irb->texformat = MESA_FORMAT_Z24_S8; + irb->texformat = MESA_FORMAT_S8_Z24; break; default: _mesa_problem(NULL, @@ -457,7 +457,7 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb, irb->Base.DataType = GL_UNSIGNED_SHORT; DBG("Render to DEPTH16 texture OK\n"); } - else if (texImage->TexFormat == MESA_FORMAT_Z24_S8) { + else if (texImage->TexFormat == MESA_FORMAT_S8_Z24) { irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT; DBG("Render to DEPTH_STENCIL texture OK\n"); } diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 540ebca15c..81692e93a9 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -131,18 +131,6 @@ pwrite_8(struct intel_renderbuffer *irb, uint32_t offset, uint8_t val) dri_bo_subdata(irb->region->buffer, offset, 1, &val); } -static uint32_t -z24s8_to_s8z24(uint32_t val) -{ - return (val << 24) | (val >> 8); -} - -static uint32_t -s8z24_to_z24s8(uint32_t val) -{ - return (val >> 24) | (val << 8); -} - static uint32_t no_tile_swizzle(struct intel_renderbuffer *irb, int x, int y) { @@ -374,8 +362,8 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb, /* z24s8 depthbuffer functions. */ #define INTEL_VALUE_TYPE GLuint -#define INTEL_WRITE_DEPTH(offset, d) pwrite_32(irb, offset, z24s8_to_s8z24(d)) -#define INTEL_READ_DEPTH(offset) s8z24_to_z24s8(pread_32(irb, offset)) +#define INTEL_WRITE_DEPTH(offset, d) pwrite_32(irb, offset, d) +#define INTEL_READ_DEPTH(offset) pread_32(irb, offset) #define INTEL_TAG(name) name##_z24_s8 #include "intel_depthtmp.h" @@ -665,13 +653,13 @@ intel_set_span_functions(struct intel_context *intel, break; } break; - case MESA_FORMAT_Z24_S8: + case MESA_FORMAT_S8_Z24: /* There are a few different ways SW asks us to access the S8Z24 data: * Z24 depth-only depth reads * S8Z24 depth reads * S8Z24 stencil reads. */ - if (rb->Format == MESA_FORMAT_Z24_S8) { + if (rb->Format == MESA_FORMAT_S8_Z24) { switch (tiling) { case I915_TILING_NONE: default: diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c index a71590d3ef..eca0f6d572 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_format.c +++ b/src/mesa/drivers/dri/intel/intel_tex_format.c @@ -153,7 +153,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, #endif case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: - return MESA_FORMAT_Z24_S8; + return MESA_FORMAT_S8_Z24; #ifndef I915 case GL_SRGB_EXT: -- cgit v1.2.3 From c18b022d0d1dc07c37c0bd981d4fc6fac27e5a45 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 21 Oct 2009 21:12:23 -0600 Subject: radeon: replace MESA_FORMAT_Z24_S8 with MESA_FORMAT_S8_Z24 Core Mesa deals with MESA_FORMAT_S8_Z24 everywhere it should so we shouldn't have to use MESA_FORMAT_Z24_S8 anymore. --- src/mesa/drivers/dri/r300/r300_texstate.c | 2 +- src/mesa/drivers/dri/r600/r600_texstate.c | 6 +++--- src/mesa/drivers/dri/radeon/radeon_span.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 1e9bd3e849..63f0154cd3 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -159,7 +159,7 @@ void r300SetDepthTexMode(struct gl_texture_object *tObj) case MESA_FORMAT_Z16: format = formats[0]; break; - case MESA_FORMAT_Z24_S8: + case MESA_FORMAT_S8_Z24: format = formats[1]; break; case MESA_FORMAT_Z32: diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c index 35186ef970..63d88f83d6 100644 --- a/src/mesa/drivers/dri/r600/r600_texstate.c +++ b/src/mesa/drivers/dri/r600/r600_texstate.c @@ -77,7 +77,7 @@ void r600UpdateTextureState(GLcontext * ctx) } } -static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, GLuint mesa_format) +static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa_format) { radeonTexObj *t = radeon_tex_obj(tObj); @@ -479,14 +479,14 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, GLuint mesa_fo SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); break; case MESA_FORMAT_Z16: - case MESA_FORMAT_Z24_S8: + case MESA_FORMAT_S8_Z24: case MESA_FORMAT_Z32: switch (mesa_format) { case MESA_FORMAT_Z16: SETfield(t->SQ_TEX_RESOURCE1, FMT_16, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); break; - case MESA_FORMAT_Z24_S8: + case MESA_FORMAT_S8_Z24: SETfield(t->SQ_TEX_RESOURCE1, FMT_24_8, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); break; diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c index 055f77a24b..4b47e756c7 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.c +++ b/src/mesa/drivers/dri/radeon/radeon_span.c @@ -878,11 +878,11 @@ static void radeonSetSpanFunctions(struct radeon_renderbuffer *rrb) radeonInitDepthPointers_z16(&rrb->base); } else if (rrb->base.Format == GL_DEPTH_COMPONENT32) { /* XXX */ radeonInitDepthPointers_z24(&rrb->base); - } else if (rrb->base.Format == MESA_FORMAT_Z24_S8) { + } else if (rrb->base.Format == MESA_FORMAT_S8_Z24) { radeonInitDepthPointers_z24_s8(&rrb->base); } else if (rrb->base.Format == MESA_FORMAT_S8) { radeonInitStencilPointers_z24_s8(&rrb->base); } else { - fprintf(stderr, "radeonSetSpanFunctions: bad actual format: 0x%04X\n", rrb->base.Format); + fprintf(stderr, "radeonSetSpanFunctions: bad format: 0x%04X\n", rrb->base.Format); } } -- cgit v1.2.3 From 6e1ddd34c6b6f9773ef87198503f5f61f9a6c23a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 21 Oct 2009 21:20:05 -0600 Subject: radeon: get rid of z24s8 <-> s8z24 conversions in span code Can just use s8z24 everywhere. Note: the WRITE_DEPTH macro for R600 may need to be fixed. --- src/mesa/drivers/dri/radeon/radeon_span.c | 34 ++++++++----------------------- 1 file changed, 8 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c index 4b47e756c7..9cdcde1eb0 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.c +++ b/src/mesa/drivers/dri/radeon/radeon_span.c @@ -334,22 +334,6 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #endif -#ifndef RADEON_R300 -#ifndef RADEON_R600 -static uint32_t -z24s8_to_s8z24(uint32_t val) -{ - return (val << 24) | (val >> 8); -} - -static uint32_t -s8z24_to_z24s8(uint32_t val) -{ - return (val >> 24) | (val << 8); -} -#endif -#endif - /* * Note that all information needed to access pixels in a renderbuffer * should be obtained through the gl_renderbuffer parameter, not per-context @@ -631,15 +615,13 @@ do { \ #define WRITE_DEPTH( _x, _y, d ) \ do { \ GLuint *_ptr = (GLuint*)r200_depth_4byte( rrb, _x + x_off, _y + y_off ); \ - GLuint tmp = z24s8_to_s8z24(d); \ - *_ptr = tmp; \ + *_ptr = d; \ } while (0) #else #define WRITE_DEPTH( _x, _y, d ) \ do { \ GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ - GLuint tmp = z24s8_to_s8z24(d); \ - *_ptr = tmp; \ + *_ptr = d; \ } while (0) #endif @@ -657,15 +639,15 @@ do { \ #elif defined(RADEON_R200) #define READ_DEPTH( d, _x, _y ) \ do { \ - d = s8z24_to_z24s8(*(GLuint*)(r200_depth_4byte(rrb, _x + x_off, _y + y_off))); \ + d = *(GLuint*)(r200_depth_4byte(rrb, _x + x_off, _y + y_off)); \ }while(0) #else #define READ_DEPTH( d, _x, _y ) do { \ - d = s8z24_to_z24s8(*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off ))); \ + d = *(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off )); \ } while (0) #endif -#define TAG(x) radeon##x##_z24_s8 +#define TAG(x) radeon##x##_s8_z24 #include "depthtmp.h" /* ================================================================ @@ -742,7 +724,7 @@ do { \ } while (0) #endif -#define TAG(x) radeon##x##_z24_s8 +#define TAG(x) radeon##x##_s8_z24 #include "stenciltmp.h" @@ -879,9 +861,9 @@ static void radeonSetSpanFunctions(struct radeon_renderbuffer *rrb) } else if (rrb->base.Format == GL_DEPTH_COMPONENT32) { /* XXX */ radeonInitDepthPointers_z24(&rrb->base); } else if (rrb->base.Format == MESA_FORMAT_S8_Z24) { - radeonInitDepthPointers_z24_s8(&rrb->base); + radeonInitDepthPointers_s8_z24(&rrb->base); } else if (rrb->base.Format == MESA_FORMAT_S8) { - radeonInitStencilPointers_z24_s8(&rrb->base); + radeonInitStencilPointers_s8_z24(&rrb->base); } else { fprintf(stderr, "radeonSetSpanFunctions: bad format: 0x%04X\n", rrb->base.Format); } -- cgit v1.2.3 From 3c685608664900562919136fbc33ac16060a27c3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 21 Oct 2009 21:47:58 -0600 Subject: i915: replace MESA_FORMAT_Z24_S8 with MESA_FORMAT_S8_Z24 And change parameter type. --- src/mesa/drivers/dri/i915/i915_texstate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index e441e287eb..d6bfe5fc7f 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -36,7 +36,7 @@ static GLuint -translate_texture_format(GLuint mesa_format, GLuint internal_format, +translate_texture_format(gl_format mesa_format, GLuint internal_format, GLenum DepthMode) { switch (mesa_format) { @@ -80,7 +80,7 @@ translate_texture_format(GLuint mesa_format, GLuint internal_format, return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT2_3); case MESA_FORMAT_RGBA_DXT5: return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5); - case MESA_FORMAT_Z24_S8: + case MESA_FORMAT_S8_Z24: return (MAPSURF_32BIT | MT_32BIT_xI824); default: fprintf(stderr, "%s: bad image format %x\n", __FUNCTION__, mesa_format); -- cgit v1.2.3 From 40247d87d215d0f1b6370b2888548544eedf0d89 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 21 Oct 2009 22:53:37 -0700 Subject: r300g: Cleanup old static shader state. --- src/gallium/drivers/r300/Makefile | 2 - src/gallium/drivers/r300/r300_fs.c | 11 +--- src/gallium/drivers/r300/r300_fs.h | 3 +- src/gallium/drivers/r300/r300_vs.c | 86 ------------------------- src/gallium/drivers/r300/r3xx_fs.c | 74 ---------------------- src/gallium/drivers/r300/r3xx_fs.h | 32 ---------- src/gallium/drivers/r300/r5xx_fs.c | 125 ------------------------------------- src/gallium/drivers/r300/r5xx_fs.h | 32 ---------- 8 files changed, 4 insertions(+), 361 deletions(-) delete mode 100644 src/gallium/drivers/r300/r3xx_fs.c delete mode 100644 src/gallium/drivers/r300/r3xx_fs.h delete mode 100644 src/gallium/drivers/r300/r5xx_fs.c delete mode 100644 src/gallium/drivers/r300/r5xx_fs.h (limited to 'src') diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile index c4f2c021c4..f73d80de88 100644 --- a/src/gallium/drivers/r300/Makefile +++ b/src/gallium/drivers/r300/Makefile @@ -4,8 +4,6 @@ include $(TOP)/configs/current LIBNAME = r300 C_SOURCES = \ - r3xx_fs.c \ - r5xx_fs.c \ r300_chipset.c \ r300_clear.c \ r300_context.c \ diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c index 2db185fd80..29ddc84c41 100644 --- a/src/gallium/drivers/r300/r300_fs.c +++ b/src/gallium/drivers/r300/r300_fs.c @@ -130,14 +130,9 @@ void r300_translate_fragment_shader(struct r300_context* r300, /* Invoke the compiler */ r3xx_compile_fragment_program(&compiler); if (compiler.Base.Error) { - /* Todo: Fallback to software rendering gracefully? */ - fprintf(stderr, "r300 FP: Compiler error: %s\n", compiler.Base.ErrorMsg); - - if (compiler.is_r500) { - memcpy(compiler.code, &r5xx_passthrough_fragment_shader, sizeof(r5xx_passthrough_fragment_shader)); - } else { - memcpy(compiler.code, &r3xx_passthrough_fragment_shader, sizeof(r3xx_passthrough_fragment_shader)); - } + /* XXX failover maybe? */ + DBG(r300, DBG_FP, "r300: Error compiling fragment program: %s\n", + compiler.Base.ErrorMsg); } /* And, finally... */ diff --git a/src/gallium/drivers/r300/r300_fs.h b/src/gallium/drivers/r300/r300_fs.h index 8dfb139738..e831c30301 100644 --- a/src/gallium/drivers/r300/r300_fs.h +++ b/src/gallium/drivers/r300/r300_fs.h @@ -28,8 +28,7 @@ #include "tgsi/tgsi_scan.h" -#include "r3xx_fs.h" -#include "r5xx_fs.h" +#include "radeon_code.h" struct r300_fragment_shader { /* Parent class */ diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c index 8460cfaf51..eca85879a7 100644 --- a/src/gallium/drivers/r300/r300_vs.c +++ b/src/gallium/drivers/r300/r300_vs.c @@ -146,89 +146,3 @@ void r300_translate_vertex_shader(struct r300_context* r300, rc_destroy(&compiler.Base); vs->translated = TRUE; } - - -/* XXX get these to r300_reg */ -#define R300_PVS_DST_OPCODE(x) ((x) << 0) -# define R300_VE_DOT_PRODUCT 1 -# define R300_VE_MULTIPLY 2 -# define R300_VE_ADD 3 -# define R300_VE_MAXIMUM 7 -# define R300_VE_SET_LESS_THAN 10 -#define R300_PVS_DST_MATH_INST (1 << 6) -# define R300_ME_RECIP_DX 6 -#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 -# 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(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) -#define R300_PVS_MODIFIER_X (1 << 25) -#define R300_PVS_MODIFIER_Y (1 << 26) -#define R300_PVS_MODIFIER_Z (1 << 27) -#define R300_PVS_MODIFIER_W (1 << 28) -#define R300_PVS_NEGATE_XYZW \ - (R300_PVS_MODIFIER_X | R300_PVS_MODIFIER_Y | \ - R300_PVS_MODIFIER_Z | R300_PVS_MODIFIER_W) - -struct r300_vertex_program_code r300_passthrough_vertex_shader = { - .length = 8, /* two instructions */ - - /* MOV out[0], in[0] */ - .body.d[0] = 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, - .body.d[1] = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) | - R300_PVS_SRC_OFFSET(0) | R300_PVS_SRC_SWIZZLE_XYZW, - .body.d[2] = R300_PVS_SRC_SWIZZLE_ZERO, - .body.d[3] = 0x0, - - /* MOV out[1], in[1] */ - .body.d[4] = R300_PVS_DST_OPCODE(R300_VE_ADD) | - R300_PVS_DST_REG_TYPE(R300_PVS_DST_REG_OUT) | - R300_PVS_DST_OFFSET(1) | R300_PVS_DST_WE_XYZW, - .body.d[5] = R300_PVS_SRC_REG_TYPE(R300_PVS_SRC_REG_INPUT) | - R300_PVS_SRC_OFFSET(1) | R300_PVS_SRC_SWIZZLE_XYZW, - .body.d[6] = R300_PVS_SRC_SWIZZLE_ZERO, - .body.d[7] = 0x0, - - .inputs[0] = 0, - .inputs[1] = 1, - .outputs[0] = 0, - .outputs[1] = 1, - - .InputsRead = 3, - .OutputsWritten = 3 -}; - diff --git a/src/gallium/drivers/r300/r3xx_fs.c b/src/gallium/drivers/r300/r3xx_fs.c deleted file mode 100644 index c1c1194d58..0000000000 --- a/src/gallium/drivers/r300/r3xx_fs.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2008 Corbin Simpson - * Joakim Sindholt - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#include "r3xx_fs.h" - -#include "r300_reg.h" - -struct rX00_fragment_program_code r3xx_passthrough_fragment_shader = { - .code.r300.alu.length = 1, - .code.r300.tex.length = 0, - - .code.r300.config = 0, - .code.r300.pixsize = 0, - .code.r300.code_offset = 0, - .code.r300.code_addr[3] = R300_RGBA_OUT, - - .code.r300.alu.inst[0].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, - .code.r300.alu.inst[0].rgb_addr = R300_RGB_ADDR0(0) | R300_RGB_ADDR1(0) | - R300_RGB_ADDR2(0) | R300_ALU_DSTC_OUTPUT_XYZ, - .code.r300.alu.inst[0].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, - .code.r300.alu.inst[0].alpha_addr = R300_ALPHA_ADDR0(0) | - R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT, -}; - -struct rX00_fragment_program_code r3xx_texture_fragment_shader = { - .code.r300.alu.length = 1, - .code.r300.tex.length = 1, - - .code.r300.config = R300_PFS_CNTL_FIRST_NODE_HAS_TEX, - .code.r300.pixsize = 0, - .code.r300.code_offset = 0, - .code.r300.code_addr[3] = R300_RGBA_OUT, - - .code.r300.tex.inst[0] = R300_TEX_OP_LD << R300_TEX_INST_SHIFT, - - .code.r300.alu.inst[0].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, - .code.r300.alu.inst[0].rgb_addr = R300_RGB_ADDR0(0) | R300_RGB_ADDR1(0) | - R300_RGB_ADDR2(0) | R300_ALU_DSTC_OUTPUT_XYZ, - .code.r300.alu.inst[0].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, - .code.r300.alu.inst[0].alpha_addr = R300_ALPHA_ADDR0(0) | - R300_ALPHA_ADDR1(0) | R300_ALPHA_ADDR2(0) | R300_ALU_DSTA_OUTPUT, -}; diff --git a/src/gallium/drivers/r300/r3xx_fs.h b/src/gallium/drivers/r300/r3xx_fs.h deleted file mode 100644 index 51cd245724..0000000000 --- a/src/gallium/drivers/r300/r3xx_fs.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2008 Corbin Simpson - * Joakim Sindholt - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * the Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifndef R3XX_FS_H -#define R3XX_FS_H - -#include "radeon_code.h" - -struct rX00_fragment_program_code r3xx_passthrough_fragment_shader; -struct rX00_fragment_program_code r3xx_texture_fragment_shader; - -#endif /* R3XX_FS_H */ diff --git a/src/gallium/drivers/r300/r5xx_fs.c b/src/gallium/drivers/r300/r5xx_fs.c deleted file mode 100644 index f072deab0d..0000000000 --- a/src/gallium/drivers/r300/r5xx_fs.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2008 Corbin Simpson - * Joakim Sindholt - * - * 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 "r5xx_fs.h" - -#include "r300_reg.h" - -/* XXX this all should find its way back to r300_reg */ -/* Swizzle tools */ -#define R500_SWIZZLE_ZERO 4 -#define R500_SWIZZLE_HALF 5 -#define R500_SWIZZLE_ONE 6 -#define R500_SWIZ_RGB_ZERO ((4 << 0) | (4 << 3) | (4 << 6)) -#define R500_SWIZ_RGB_ONE ((6 << 0) | (6 << 3) | (6 << 6)) -#define R500_SWIZ_RGB_RGB ((0 << 0) | (1 << 3) | (2 << 6)) -#define R500_SWIZ_MOD_NEG 1 -#define R500_SWIZ_MOD_ABS 2 -#define R500_SWIZ_MOD_NEG_ABS 3 -/* Swizzles for inst2 */ -#define R500_SWIZ_TEX_STRQ(x) ((x) << 8) -#define R500_SWIZ_TEX_RGBA(x) ((x) << 24) -/* Swizzles for inst3 */ -#define R500_SWIZ_RGB_A(x) ((x) << 2) -#define R500_SWIZ_RGB_B(x) ((x) << 15) -/* Swizzles for inst4 */ -#define R500_SWIZ_ALPHA_A(x) ((x) << 14) -#define R500_SWIZ_ALPHA_B(x) ((x) << 21) -/* Swizzle for inst5 */ -#define R500_SWIZ_RGBA_C(x) ((x) << 14) -#define R500_SWIZ_ALPHA_C(x) ((x) << 27) -/* Writemasks */ -#define R500_TEX_WMASK(x) ((x) << 11) -#define R500_ALU_WMASK(x) ((x) << 11) -#define R500_ALU_OMASK(x) ((x) << 15) -#define R500_W_OMASK (1 << 31) - -struct rX00_fragment_program_code r5xx_passthrough_fragment_shader = { - .code.r500.max_temp_idx = 0, - .code.r500.inst_end = 0, - - .code.r500.inst[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, - .code.r500.inst[0].inst1 = - R500_RGB_ADDR0(0) | R500_RGB_ADDR1(0) | R500_RGB_ADDR1_CONST | - R500_RGB_ADDR2(0) | R500_RGB_ADDR2_CONST, - .code.r500.inst[0].inst2 = - R500_ALPHA_ADDR0(0) | R500_ALPHA_ADDR1(0) | R500_ALPHA_ADDR1_CONST | - R500_ALPHA_ADDR2(0) | R500_ALPHA_ADDR2_CONST, - .code.r500.inst[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, - .code.r500.inst[0].inst4 = - R500_ALPHA_OP_CMP | R500_ALPHA_SWIZ_A_A | R500_ALPHA_SWIZ_B_A, - .code.r500.inst[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, -}; - -struct rX00_fragment_program_code r5xx_texture_fragment_shader = { - .code.r500.max_temp_idx = 0, - .code.r500.inst_end = 1, - - .code.r500.inst[0].inst0 = R500_INST_TYPE_TEX | - R500_INST_TEX_SEM_WAIT | - R500_INST_RGB_WMASK_RGB | R500_INST_ALPHA_WMASK | - R500_INST_RGB_CLAMP | R500_INST_ALPHA_CLAMP, - .code.r500.inst[0].inst1 = R500_TEX_ID(0) | R500_TEX_INST_LD | - R500_TEX_SEM_ACQUIRE | R500_TEX_IGNORE_UNCOVERED, - .code.r500.inst[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, - .code.r500.inst[0].inst3 = 0x0, - .code.r500.inst[0].inst4 = 0x0, - .code.r500.inst[0].inst5 = 0x0, - - .code.r500.inst[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, - .code.r500.inst[1].inst1 = - R500_RGB_ADDR0(0) | R500_RGB_ADDR1(0) | R500_RGB_ADDR1_CONST | - R500_RGB_ADDR2(0) | R500_RGB_ADDR2_CONST, - .code.r500.inst[1].inst2 = - R500_ALPHA_ADDR0(0) | R500_ALPHA_ADDR1(0) | R500_ALPHA_ADDR1_CONST | - R500_ALPHA_ADDR2(0) | R500_ALPHA_ADDR2_CONST, - .code.r500.inst[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, - .code.r500.inst[1].inst4 = - R500_ALPHA_OP_CMP | R500_ALPHA_SWIZ_A_A | R500_ALPHA_SWIZ_B_A, - .code.r500.inst[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, -}; diff --git a/src/gallium/drivers/r300/r5xx_fs.h b/src/gallium/drivers/r300/r5xx_fs.h deleted file mode 100644 index a4addde32b..0000000000 --- a/src/gallium/drivers/r300/r5xx_fs.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2008 Corbin Simpson - * Joakim Sindholt - * - * 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 R5XX_FS_H -#define R5XX_FS_H - -#include "radeon_code.h" - -struct rX00_fragment_program_code r5xx_passthrough_fragment_shader; -struct rX00_fragment_program_code r5xx_texture_fragment_shader; - -#endif /* R5XX_FS_H */ -- cgit v1.2.3 From 5a653ada4143c24b00b0ca12b4898064afd59c29 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 21 Oct 2009 22:54:52 -0700 Subject: r300g: Remove unused debug flag. --- src/gallium/drivers/r300/r300_context.h | 5 ++--- src/gallium/drivers/r300/r300_debug.c | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 61a57df35e..4e2c0ec34e 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -317,9 +317,8 @@ void r300_init_surface_functions(struct r300_context* r300); #define DBG_VP 0x0000004 #define DBG_CS 0x0000008 #define DBG_DRAW 0x0000010 -#define DBG_SURF 0x0000020 -#define DBG_TEX 0x0000040 -#define DBG_FALL 0x0000080 +#define DBG_TEX 0x0000020 +#define DBG_FALL 0x0000040 /*@}*/ static INLINE boolean DBG_ON(struct r300_context * ctx, unsigned flags) diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c index bfd4ab018a..421253ca72 100644 --- a/src/gallium/drivers/r300/r300_debug.c +++ b/src/gallium/drivers/r300/r300_debug.c @@ -37,7 +37,6 @@ static struct debug_option debug_options[] = { { "vp", DBG_VP, "Vertex program handling" }, { "cs", DBG_CS, "Command submissions" }, { "draw", DBG_DRAW, "Draw and emit" }, - { "surf", DBG_SURF, "Surface drawing" }, { "tex", DBG_TEX, "Textures" }, { "fall", DBG_FALL, "Fallbacks" }, -- cgit v1.2.3 From 034db65f08b943ee9940947db69e4e190f751061 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 21 Oct 2009 23:23:37 -0700 Subject: r300g: Update comments, asserts, indents in r300_texture. I wish I knew enough about textures to really really REALLY fix that file. --- src/gallium/drivers/r300/r300_texture.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 339fbb6242..3c8ff24e17 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -42,16 +42,16 @@ static void r300_setup_texture_state(struct r300_texture* tex) /* XXX */ state->format1 = r300_translate_texformat(pt->format); if (pt->target == PIPE_TEXTURE_CUBE) { - state->format1 |= R300_TX_FORMAT_CUBIC_MAP; + state->format1 |= R300_TX_FORMAT_CUBIC_MAP; } if (pt->target == PIPE_TEXTURE_3D) { - state->format1 |= R300_TX_FORMAT_3D; + state->format1 |= R300_TX_FORMAT_3D; } state->format2 = (r300_texture_get_stride(tex, 0) / pt->block.size) - 1; - /* Assume (somewhat foolishly) that oversized textures will - * not be permitted by the state tracker. */ + /* Don't worry about accidentally setting this bit on non-r500; + * the kernel should catch it. */ if (pt->width[0] > 2048) { state->format2 |= R500_TXWIDTH_BIT11; } @@ -73,7 +73,8 @@ unsigned r300_texture_get_stride(struct r300_texture* tex, unsigned level) return tex->stride_override; if (level > tex->tex.last_level) { - debug_printf("%s: level (%u) > last_level (%u)\n", __FUNCTION__, level, tex->tex.last_level); + debug_printf("%s: level (%u) > last_level (%u)\n", __FUNCTION__, + level, tex->tex.last_level); return 0; } @@ -96,11 +97,6 @@ static void r300_setup_miptree(struct r300_texture* tex) base->nblocksx[i] = pf_get_nblocksx(&base->block, base->width[i]); base->nblocksy[i] = pf_get_nblocksy(&base->block, base->height[i]); - /* Radeons enjoy things in multiples of 64. - * - * XXX - * POT, uncompressed, unmippmapped textures can be aligned to 32, - * instead of 64. */ stride = r300_texture_get_stride(tex, i); size = stride * base->nblocksy[i] * base->depth[i]; @@ -195,9 +191,7 @@ static struct pipe_texture* { struct r300_texture* tex; - /* XXX we should start doing mips now... */ if (base->target != PIPE_TEXTURE_2D || - base->last_level != 0 || base->depth[0] != 1) { return NULL; } @@ -213,7 +207,6 @@ static struct pipe_texture* tex->stride_override = *stride; - /* XXX */ r300_setup_texture_state(tex); pipe_buffer_reference(&tex->buffer, buffer); -- cgit v1.2.3 From 0a8cd4862c4f04308ab818077bab94417ffbf50b Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 21 Oct 2009 23:26:02 -0700 Subject: r300g: Update comments, function names in r300_state_inlines. --- src/gallium/drivers/r300/r300_state_derived.c | 2 +- src/gallium/drivers/r300/r300_state_inlines.h | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index e749bd9cb9..42aee7231e 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -250,7 +250,7 @@ static void r300_vertex_psc(struct r300_context* r300, assert(tab[i] != -1); /* Add the attribute to the PSC table. */ - temp = translate_vertex_data_type(vinfo->attrib[i].emit) | + temp = translate_draw_vertex_data_type(vinfo->attrib[i].emit) | tab[i] << R300_DST_VEC_LOC_SHIFT; if (i & 1) { diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index 9135c55ec4..c82d8e5f08 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -53,6 +53,7 @@ static INLINE uint32_t r300_translate_blend_function(int blend_func) return R300_COMB_FCN_MAX; default: debug_printf("r300: Unknown blend function %d\n", blend_func); + assert(0); break; } return 0; @@ -100,6 +101,7 @@ static INLINE uint32_t r300_translate_blend_factor(int blend_fact) case PIPE_BLENDFACTOR_INV_SRC1_ALPHA: */ default: debug_printf("r300: Unknown blend factor %d\n", blend_fact); + assert(0); break; } return 0; @@ -129,6 +131,7 @@ static INLINE uint32_t r300_translate_depth_stencil_function(int zs_func) default: debug_printf("r300: Unknown depth/stencil function %d\n", zs_func); + assert(0); break; } return 0; @@ -155,6 +158,7 @@ static INLINE uint32_t r300_translate_stencil_op(int s_op) return R300_ZS_INVERT; default: debug_printf("r300: Unknown stencil op %d", s_op); + assert(0); break; } return 0; @@ -181,6 +185,7 @@ static INLINE uint32_t r300_translate_alpha_function(int alpha_func) return R300_FG_ALPHA_FUNC_ALWAYS; default: debug_printf("r300: Unknown alpha function %d", alpha_func); + assert(0); break; } return 0; @@ -209,6 +214,7 @@ static INLINE uint32_t r300_translate_wrap(int wrap) return R300_TX_CLAMP_TO_EDGE | R300_TX_MIRRORED; default: debug_printf("r300: Unknown texture wrap %d", wrap); + assert(0); return 0; } } @@ -228,6 +234,7 @@ static INLINE uint32_t r300_translate_tex_filters(int min, int mag, int mip) break; default: debug_printf("r300: Unknown texture filter %d\n", min); + assert(0); break; } switch (mag) { @@ -242,6 +249,7 @@ static INLINE uint32_t r300_translate_tex_filters(int min, int mag, int mip) break; default: debug_printf("r300: Unknown texture filter %d\n", mag); + assert(0); break; } switch (mip) { @@ -256,6 +264,7 @@ static INLINE uint32_t r300_translate_tex_filters(int min, int mag, int mip) break; default: debug_printf("r300: Unknown texture filter %d\n", mip); + assert(0); break; } @@ -279,6 +288,8 @@ static INLINE uint32_t r300_anisotropy(float max_aniso) /* Buffer formats. */ +/* Colorbuffer formats. This is the unswizzled format of the RB3D block's + * output. For the swizzling of the targets, check the shader's format. */ static INLINE uint32_t r300_translate_colorformat(enum pipe_format format) { switch (format) { @@ -313,11 +324,13 @@ static INLINE uint32_t r300_translate_colorformat(enum pipe_format format) debug_printf("r300: Implementation error: " "Got unsupported color format %s in %s\n", pf_name(format), __FUNCTION__); + assert(0); break; } return 0; } +/* Depthbuffer and stencilbuffer. Thankfully, we only support two kinds. */ static INLINE uint32_t r300_translate_zsformat(enum pipe_format format) { switch (format) { @@ -331,18 +344,22 @@ static INLINE uint32_t r300_translate_zsformat(enum pipe_format format) debug_printf("r300: Implementation error: " "Got unsupported ZS format %s in %s\n", pf_name(format), __FUNCTION__); + assert(0); break; } return 0; } -/* Translate pipe_format into US_OUT_FMT. +/* Shader output formats. This is essentially the swizzle from the shader + * to the RB3D block. + * * Note that formats are stored from C3 to C0. */ static INLINE uint32_t r300_translate_out_fmt(enum pipe_format format) { switch (format) { case PIPE_FORMAT_A8R8G8B8_UNORM: case PIPE_FORMAT_X8R8G8B8_UNORM: + /* XXX */ case PIPE_FORMAT_Z24S8_UNORM: return R300_US_OUT_FMT_C4_8 | R300_C0_SEL_B | R300_C1_SEL_G | @@ -356,6 +373,7 @@ static INLINE uint32_t r300_translate_out_fmt(enum pipe_format format) debug_printf("r300: Implementation error: " "Got unsupported output format %s in %s\n", pf_name(format), __FUNCTION__); + assert(0); return R300_US_OUT_FMT_UNUSED; } return 0; @@ -382,7 +400,8 @@ static INLINE uint32_t r300_translate_gb_pipes(int pipe_count) return 0; } -static INLINE uint32_t translate_vertex_data_type(int type) { +/* Translate Draw vertex types into PSC vertex types. */ +static INLINE uint32_t translate_draw_vertex_data_type(int type) { switch (type) { case EMIT_1F: case EMIT_1F_PSIZE: @@ -406,7 +425,6 @@ static INLINE uint32_t translate_vertex_data_type(int type) { assert(0); break; } - return 0; } -- cgit v1.2.3 From b86302283b48654682e0580c53ece01bf095fa95 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Tue, 20 Oct 2009 11:45:39 +0300 Subject: r600: add beginnings of ARL instruction --- src/mesa/drivers/dri/r600/r700_assembler.c | 35 +++++++++++++++++++++++++++--- src/mesa/drivers/dri/r600/r700_assembler.h | 1 + 2 files changed, 33 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index a683008746..d0eb9949a6 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -355,6 +355,7 @@ unsigned int r700GetNumOperands(r700_AssemblerBase* pAsm) return 2; case SQ_OP2_INST_MOV: + case SQ_OP2_INST_MOVA_FLOOR: case SQ_OP2_INST_FRACT: case SQ_OP2_INST_FLOOR: case SQ_OP2_INST_EXP_IEEE: @@ -2064,7 +2065,7 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) } //other bits - alu_instruction_ptr->m_Word0.f.index_mode = SQ_INDEX_LOOP; + alu_instruction_ptr->m_Word0.f.index_mode = SQ_INDEX_AR_X; if( (is_single_scalar_operation == GL_TRUE) || (GL_TRUE == bSplitInst) ) @@ -2398,6 +2399,35 @@ GLboolean assemble_ADD(r700_AssemblerBase *pAsm) return GL_TRUE; } +GLboolean assemble_ARL(r700_AssemblerBase *pAsm) +{ /* TODO: ar values dont' persist between clauses */ + if( GL_FALSE == checkop1(pAsm) ) + { + return GL_FALSE; + } + + pAsm->D.dst.opcode = SQ_OP2_INST_MOVA_FLOOR; + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = 0; + pAsm->D.dst.writex = 0; + pAsm->D.dst.writey = 0; + pAsm->D.dst.writez = 0; + pAsm->D.dst.writew = 0; + + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + return GL_TRUE; +} + GLboolean assemble_BAD(char *opcode_str) { radeon_error("Not yet implemented instruction (%s)\n", opcode_str); @@ -3812,8 +3842,7 @@ GLboolean AssembleInstr(GLuint uiNumberInsts, break; case OPCODE_ARL: - radeon_error("Not yet implemented instruction OPCODE_ARL \n"); - //if ( GL_FALSE == assemble_BAD("ARL") ) + if ( GL_FALSE == assemble_ARL(pR700AsmCode) ) return GL_FALSE; break; case OPCODE_ARR: diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index 73bb8bac55..d639592702 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -461,6 +461,7 @@ GLboolean next_ins(r700_AssemblerBase *pAsm); GLboolean assemble_math_function(r700_AssemblerBase* pAsm, BITS opcode); GLboolean assemble_ABS(r700_AssemblerBase *pAsm); GLboolean assemble_ADD(r700_AssemblerBase *pAsm); +GLboolean assemble_ARL(r700_AssemblerBase *pAsm); GLboolean assemble_BAD(char *opcode_str); GLboolean assemble_CMP(r700_AssemblerBase *pAsm); GLboolean assemble_COS(r700_AssemblerBase *pAsm); -- cgit v1.2.3 From a88c9296cb079ff42ef901113d0fe772228e6feb Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Wed, 21 Oct 2009 12:23:27 +0300 Subject: r600: need to export something from PS Also avoids empty shader for "END" - seems to be somewhat valid fp Maybe this can be done differently in the future (fake FRAG_RESULT_COLOR already in Map_Fragment_Program() or is there a way to program the chip to not hang in case of no exports. --- src/mesa/drivers/dri/r600/r700_assembler.c | 11 ++++++++++- src/mesa/drivers/dri/r600/r700_fragprog.c | 10 +++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index d0eb9949a6..6ff08e1cfb 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -4187,6 +4187,7 @@ GLboolean Process_Fragment_Exports(r700_AssemblerBase *pR700AsmCode, GLbitfield OutputsWritten) { unsigned int unBit; + GLuint export_count = 0; if(pR700AsmCode->depth_export_register_number >= 0) { @@ -4208,6 +4209,7 @@ GLboolean Process_Fragment_Exports(r700_AssemblerBase *pR700AsmCode, { return GL_FALSE; } + export_count++; } unBit = 1 << FRAG_RESULT_DEPTH; if(OutputsWritten & unBit) @@ -4221,8 +4223,15 @@ GLboolean Process_Fragment_Exports(r700_AssemblerBase *pR700AsmCode, { return GL_FALSE; } + export_count++; } - + /* Need to export something, otherwise we'll hang + * results are undefined anyway */ + if(export_count == 0) + { + Process_Export(pR700AsmCode, SQ_EXPORT_PIXEL, 0, 1, 0, GL_FALSE); + } + if(pR700AsmCode->cf_last_export_ptr != NULL) { pR700AsmCode->cf_last_export_ptr->m_Word1.f.cf_inst = SQ_CF_INST_EXPORT_DONE; diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c index 62a1ea1a22..3736bce11c 100644 --- a/src/mesa/drivers/dri/r600/r700_fragprog.c +++ b/src/mesa/drivers/dri/r600/r700_fragprog.c @@ -251,7 +251,15 @@ GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp, number_of_colors_exported--; } - fp->r700Shader.exportMode = number_of_colors_exported << 1 | z_enabled; + /* illegal to set this to 0 */ + if(number_of_colors_exported || z_enabled) + { + fp->r700Shader.exportMode = number_of_colors_exported << 1 | z_enabled; + } + else + { + fp->r700Shader.exportMode = (1 << 1); + } fp->translated = GL_TRUE; -- cgit v1.2.3 From 869e20bcb7db9c6540eb6b538104303df738d302 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Wed, 21 Oct 2009 19:04:21 +0300 Subject: r600: set barrier for tex inst if dst is used earlier, might overwrite it otherwise --- src/mesa/drivers/dri/r600/r700_fragprog.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c index 3736bce11c..0f549ead9c 100644 --- a/src/mesa/drivers/dri/r600/r700_fragprog.c +++ b/src/mesa/drivers/dri/r600/r700_fragprog.c @@ -135,15 +135,19 @@ GLboolean Find_Instruction_Dependencies_fp(struct r700_fragment_program *fp, { GLuint i, j; GLint * puiTEMPwrites; + GLint * puiTEMPreads; struct prog_instruction * pILInst; InstDeps *pInstDeps; struct prog_instruction * texcoord_DepInst; GLint nDepInstID; puiTEMPwrites = (GLint*) MALLOC(sizeof(GLuint)*mesa_fp->Base.NumTemporaries); + puiTEMPreads = (GLint*) MALLOC(sizeof(GLuint)*mesa_fp->Base.NumTemporaries); + for(i=0; iBase.NumTemporaries; i++) { puiTEMPwrites[i] = -1; + puiTEMPreads[i] = -1; } pInstDeps = (InstDeps*)MALLOC(sizeof(InstDeps)*mesa_fp->Base.NumInstructions); @@ -167,6 +171,11 @@ GLboolean Find_Instruction_Dependencies_fp(struct r700_fragment_program *fp, { //Set dep. pInstDeps[i].nSrcDeps[j] = puiTEMPwrites[pILInst->SrcReg[j].Index]; + //Set first read + if(puiTEMPreads[pILInst->SrcReg[j].Index] < 0 ) + { + puiTEMPreads[pILInst->SrcReg[j].Index] = i; + } } else { @@ -177,8 +186,6 @@ GLboolean Find_Instruction_Dependencies_fp(struct r700_fragment_program *fp, fp->r700AsmCode.pInstDeps = pInstDeps; - FREE(puiTEMPwrites); - //Find dep for tex inst for(i=0; iBase.NumInstructions; i++) { @@ -203,9 +210,25 @@ GLboolean Find_Instruction_Dependencies_fp(struct r700_fragment_program *fp, { //... other deps? } } + // make sure that we dont overwrite src used earlier + nDepInstID = puiTEMPreads[pILInst->DstReg.Index]; + if(nDepInstID < i) + { + pInstDeps[i].nDstDep = puiTEMPreads[pILInst->DstReg.Index]; + texcoord_DepInst = &(mesa_fp->Base.Instructions[nDepInstID]); + if(GL_TRUE == IsAlu(texcoord_DepInst->Opcode) ) + { + pInstDeps[nDepInstID].nDstDep = i; + } + + } + } } + FREE(puiTEMPwrites); + FREE(puiTEMPreads); + return GL_TRUE; } -- cgit v1.2.3 From 511bd5f32b67f903b590f00f7ccf8132127ef2e4 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Thu, 22 Oct 2009 00:21:08 -0700 Subject: r300g: Check for NULL Draw during flush. Split from the fastpath WIP. --- src/gallium/drivers/r300/r300_flush.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_flush.c b/src/gallium/drivers/r300/r300_flush.c index c222ea09b1..14a08241fc 100644 --- a/src/gallium/drivers/r300/r300_flush.c +++ b/src/gallium/drivers/r300/r300_flush.c @@ -40,8 +40,10 @@ static void r300_flush(struct pipe_context* pipe, CS_LOCALS(r300); /* We probably need to flush Draw, but we may have been called from - * within Draw. This feels kludgy, but it might be the best thing. */ - if (!r300->draw->flushing) { + * within Draw. This feels kludgy, but it might be the best thing. + * + * Of course, the best thing is to kill Draw with fire. :3 */ + if (r300->draw && !r300->draw->flushing) { draw_flush(r300->draw); } -- cgit v1.2.3 From eebf4b5299a880f4cdf8a916b4e1ca0bd79a6f07 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Thu, 22 Oct 2009 21:55:22 +1000 Subject: nv50: support 3D class 0x8597, remove redundant unknown chipset detection --- src/gallium/drivers/nv50/nv50_screen.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index 0bd5487695..63dce0f4c2 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -218,7 +218,16 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) tesla_class = NV54TCL; break; case 0xa0: - tesla_class = NVA0TCL; + switch (chipset) { + case 0xa0: + case 0xaa: + case 0xac: + tesla_class = NVA0TCL; + break; + default: + tesla_class = 0x8597; + break; + } break; default: NOUVEAU_ERR("Not a known NV50 chipset: NV%02x\n", chipset); @@ -226,12 +235,6 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) return NULL; } - if (tesla_class == 0) { - NOUVEAU_ERR("Unknown G8x chipset: NV%02x\n", chipset); - nv50_screen_destroy(pscreen); - return NULL; - } - ret = nouveau_grobj_alloc(chan, 0xbeef5097, tesla_class, &screen->tesla); if (ret) { -- cgit v1.2.3 From 326baecd757747a52b028e1f590437597776d7e6 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 16 Oct 2009 12:18:25 +0800 Subject: egl: Correct conversion of native visual type. Signed-off-by: Chia-I Wu --- src/egl/main/eglconfigutil.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/egl/main/eglconfigutil.c b/src/egl/main/eglconfigutil.c index a5fcdcd287..36e94f0d2d 100644 --- a/src/egl/main/eglconfigutil.c +++ b/src/egl/main/eglconfigutil.c @@ -102,7 +102,12 @@ _eglConfigFromContextModesRec(_EGLConfig *conf, const __GLcontextModes *m, SET_CONFIG_ATTRIB(conf, EGL_NATIVE_RENDERABLE, m->xRenderable); SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_ID, m->visualID); - SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE, m->visualType); + + if (m->visualType != GLX_NONE) + SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE, m->visualType); + else + SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE, EGL_NONE); + SET_CONFIG_ATTRIB(conf, EGL_RENDERABLE_TYPE, renderable_type); SET_CONFIG_ATTRIB(conf, EGL_SAMPLE_BUFFERS, m->sampleBuffers); SET_CONFIG_ATTRIB(conf, EGL_SAMPLES, m->samples); -- cgit v1.2.3 From 78c3a351bc91eed49a07108682013a323d87540e Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 1 Oct 2009 18:16:10 +0800 Subject: egl_glx: Clean up the initialization code. Proper detection of GLX extensions. Convert fbconfigs or visuals in a more unified way and validate the resulting configs. Signed-off-by: Chia-I Wu --- src/egl/drivers/glx/egl_glx.c | 658 ++++++++++++++++++++++++------------------ 1 file changed, 371 insertions(+), 287 deletions(-) (limited to 'src') diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c index 4685f600e2..404c998dcb 100644 --- a/src/egl/drivers/glx/egl_glx.c +++ b/src/egl/drivers/glx/egl_glx.c @@ -40,16 +40,14 @@ */ -#include -#include -#include -#include -#include -#include "dlfcn.h" +#include +#include #include -#include +#include + #include "glxclient.h" +#include "eglconfigutil.h" #include "eglconfig.h" #include "eglcontext.h" #include "egldisplay.h" @@ -58,46 +56,19 @@ #include "egllog.h" #include "eglsurface.h" -#include - #define CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T)) +#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) -static const EGLint all_apis = (EGL_OPENGL_ES_BIT - | EGL_OPENGL_ES2_BIT - | EGL_OPENVG_BIT - /* | EGL_OPENGL_BIT */); /* can't do */ +#ifndef GLX_VERSION_1_4 +#error "GL/glx.h must be equal to or greater than GLX 1.4" +#endif + +/* + * report OpenGL ES bits because apps usually forget to specify + * EGL_RENDERABLE_TYPE when choosing configs + */ +#define GLX_EGL_APIS (EGL_OPENGL_BIT | EGL_OPENGL_ES_BIT | EGL_OPENGL_ES2_BIT) -struct visual_attribs -{ - /* X visual attribs */ - int id; - int klass; - int depth; - int redMask, greenMask, blueMask; - int colormapSize; - int bitsPerRGB; - - /* GL visual attribs */ - int supportsGL; - int transparentType; - int transparentRedValue; - int transparentGreenValue; - int transparentBlueValue; - int transparentAlphaValue; - int transparentIndexValue; - int bufferSize; - int level; - int render_type; - int doubleBuffer; - int stereo; - int auxBuffers; - int redSize, greenSize, blueSize, alphaSize; - int depthSize; - int stencilSize; - int accumRedSize, accumGreenSize, accumBlueSize, accumAlphaSize; - int numSamples, numMultisample; - int visualCaveat; -}; /** subclass of _EGLDriver */ struct GLX_egl_driver @@ -114,6 +85,21 @@ struct GLX_egl_display GLXFBConfig *fbconfigs; int glx_maj, glx_min; + + const char *extensions; + EGLBoolean have_1_3; + EGLBoolean have_make_current_read; + EGLBoolean have_fbconfig; + EGLBoolean have_pbuffer; + + /* GLX_SGIX_pbuffer */ + PFNGLXCREATEGLXPBUFFERSGIXPROC glXCreateGLXPbufferSGIX; + PFNGLXDESTROYGLXPBUFFERSGIXPROC glXDestroyGLXPbufferSGIX; + + /* workaround quirks of different GLX implementations */ + EGLBoolean single_buffered_quirk; + EGLBoolean glx_window_quirk; + }; @@ -139,6 +125,7 @@ struct GLX_egl_surface struct GLX_egl_config { _EGLConfig Base; /**< base class */ + EGLBoolean double_buffered; int index; }; @@ -173,288 +160,369 @@ GLX_egl_config_index(_EGLConfig *conf) return ((struct GLX_egl_config *) conf)->index; } -static GLboolean -get_visual_attribs(Display *dpy, XVisualInfo *vInfo, - struct visual_attribs *attribs) -{ - const char *ext = glXQueryExtensionsString(dpy, vInfo->screen); - int rgba; - memset(attribs, 0, sizeof(struct visual_attribs)); +#define MAP_ATTRIB(attr, memb) \ + { attr, offsetof(__GLcontextModes, memb) } + + +static const struct { + int attr; + int offset; +} fbconfig_attributes[] = { + /* table 3.1 of GLX 1.4 */ + MAP_ATTRIB(GLX_FBCONFIG_ID, fbconfigID), + MAP_ATTRIB(GLX_BUFFER_SIZE, rgbBits), + MAP_ATTRIB(GLX_LEVEL, level), + MAP_ATTRIB(GLX_DOUBLEBUFFER, doubleBufferMode), + MAP_ATTRIB(GLX_STEREO, stereoMode), + MAP_ATTRIB(GLX_AUX_BUFFERS, numAuxBuffers), + MAP_ATTRIB(GLX_RED_SIZE, redBits), + MAP_ATTRIB(GLX_GREEN_SIZE, greenBits), + MAP_ATTRIB(GLX_BLUE_SIZE, blueBits), + MAP_ATTRIB(GLX_ALPHA_SIZE, alphaBits), + MAP_ATTRIB(GLX_DEPTH_SIZE, depthBits), + MAP_ATTRIB(GLX_STENCIL_SIZE, stencilBits), + MAP_ATTRIB(GLX_ACCUM_RED_SIZE, accumRedBits), + MAP_ATTRIB(GLX_ACCUM_GREEN_SIZE, accumGreenBits), + MAP_ATTRIB(GLX_ACCUM_BLUE_SIZE, accumBlueBits), + MAP_ATTRIB(GLX_ACCUM_ALPHA_SIZE, accumAlphaBits), + MAP_ATTRIB(GLX_SAMPLE_BUFFERS, sampleBuffers), + MAP_ATTRIB(GLX_SAMPLES, samples), + MAP_ATTRIB(GLX_RENDER_TYPE, renderType), + MAP_ATTRIB(GLX_DRAWABLE_TYPE, drawableType), + MAP_ATTRIB(GLX_X_RENDERABLE, xRenderable), + MAP_ATTRIB(GLX_X_VISUAL_TYPE, visualType), + MAP_ATTRIB(GLX_CONFIG_CAVEAT, visualRating), + MAP_ATTRIB(GLX_TRANSPARENT_TYPE, transparentPixel), + MAP_ATTRIB(GLX_TRANSPARENT_INDEX_VALUE, transparentIndex), + MAP_ATTRIB(GLX_TRANSPARENT_RED_VALUE, transparentRed), + MAP_ATTRIB(GLX_TRANSPARENT_GREEN_VALUE, transparentGreen), + MAP_ATTRIB(GLX_TRANSPARENT_BLUE_VALUE, transparentBlue), + MAP_ATTRIB(GLX_TRANSPARENT_ALPHA_VALUE, transparentAlpha), + MAP_ATTRIB(GLX_MAX_PBUFFER_WIDTH, maxPbufferWidth), + MAP_ATTRIB(GLX_MAX_PBUFFER_HEIGHT, maxPbufferHeight), + MAP_ATTRIB(GLX_MAX_PBUFFER_PIXELS, maxPbufferPixels), + MAP_ATTRIB(GLX_VISUAL_ID, visualID), +}; - attribs->id = vInfo->visualid; -#if defined(__cplusplus) || defined(c_plusplus) - attribs->klass = vInfo->c_class; -#else - attribs->klass = vInfo->class; -#endif - attribs->depth = vInfo->depth; - attribs->redMask = vInfo->red_mask; - attribs->greenMask = vInfo->green_mask; - attribs->blueMask = vInfo->blue_mask; - attribs->colormapSize = vInfo->colormap_size; - attribs->bitsPerRGB = vInfo->bits_per_rgb; - - if (glXGetConfig(dpy, vInfo, GLX_USE_GL, &attribs->supportsGL) != 0 || - !attribs->supportsGL) - return GL_FALSE; - glXGetConfig(dpy, vInfo, GLX_BUFFER_SIZE, &attribs->bufferSize); - glXGetConfig(dpy, vInfo, GLX_LEVEL, &attribs->level); - glXGetConfig(dpy, vInfo, GLX_RGBA, &rgba); - if (!rgba) - return GL_FALSE; - attribs->render_type = GLX_RGBA_BIT; - - glXGetConfig(dpy, vInfo, GLX_DOUBLEBUFFER, &attribs->doubleBuffer); - if (!attribs->doubleBuffer) - return GL_FALSE; - - glXGetConfig(dpy, vInfo, GLX_STEREO, &attribs->stereo); - glXGetConfig(dpy, vInfo, GLX_AUX_BUFFERS, &attribs->auxBuffers); - glXGetConfig(dpy, vInfo, GLX_RED_SIZE, &attribs->redSize); - glXGetConfig(dpy, vInfo, GLX_GREEN_SIZE, &attribs->greenSize); - glXGetConfig(dpy, vInfo, GLX_BLUE_SIZE, &attribs->blueSize); - glXGetConfig(dpy, vInfo, GLX_ALPHA_SIZE, &attribs->alphaSize); - glXGetConfig(dpy, vInfo, GLX_DEPTH_SIZE, &attribs->depthSize); - glXGetConfig(dpy, vInfo, GLX_STENCIL_SIZE, &attribs->stencilSize); - glXGetConfig(dpy, vInfo, GLX_ACCUM_RED_SIZE, &attribs->accumRedSize); - glXGetConfig(dpy, vInfo, GLX_ACCUM_GREEN_SIZE, &attribs->accumGreenSize); - glXGetConfig(dpy, vInfo, GLX_ACCUM_BLUE_SIZE, &attribs->accumBlueSize); - glXGetConfig(dpy, vInfo, GLX_ACCUM_ALPHA_SIZE, &attribs->accumAlphaSize); - - /* get transparent pixel stuff */ - glXGetConfig(dpy, vInfo,GLX_TRANSPARENT_TYPE, &attribs->transparentType); - if (attribs->transparentType == GLX_TRANSPARENT_RGB) { - glXGetConfig(dpy, vInfo, GLX_TRANSPARENT_RED_VALUE, &attribs->transparentRedValue); - glXGetConfig(dpy, vInfo, GLX_TRANSPARENT_GREEN_VALUE, &attribs->transparentGreenValue); - glXGetConfig(dpy, vInfo, GLX_TRANSPARENT_BLUE_VALUE, &attribs->transparentBlueValue); - glXGetConfig(dpy, vInfo, GLX_TRANSPARENT_ALPHA_VALUE, &attribs->transparentAlphaValue); - } - else if (attribs->transparentType == GLX_TRANSPARENT_INDEX) { - glXGetConfig(dpy, vInfo, GLX_TRANSPARENT_INDEX_VALUE, &attribs->transparentIndexValue); - } - /* multisample attribs */ -#ifdef GLX_ARB_multisample - if (ext && strstr(ext, "GLX_ARB_multisample")) { - glXGetConfig(dpy, vInfo, GLX_SAMPLE_BUFFERS_ARB, &attribs->numMultisample); - glXGetConfig(dpy, vInfo, GLX_SAMPLES_ARB, &attribs->numSamples); - } -#endif - else { - attribs->numSamples = 0; - attribs->numMultisample = 0; +static EGLBoolean +convert_fbconfig(Display *dpy, GLXFBConfig fbconfig, + struct GLX_egl_config *GLX_conf) +{ + __GLcontextModes mode; + int err = 0, attr, val, i; + + memset(&mode, 0, sizeof(mode)); + + for (i = 0; i < ARRAY_SIZE(fbconfig_attributes); i++) { + int offset = fbconfig_attributes[i].offset; + attr = fbconfig_attributes[i].attr; + err = glXGetFBConfigAttrib(dpy, fbconfig, attr, &val); + if (err) { + if (err == GLX_BAD_ATTRIBUTE) { + err = 0; + continue; + } + break; + } + *((int *) ((char *) &mode + offset)) = val; } + if (err) + return EGL_FALSE; -#if defined(GLX_EXT_visual_rating) - if (ext && strstr(ext, "GLX_EXT_visual_rating")) { - glXGetConfig(dpy, vInfo, GLX_VISUAL_CAVEAT_EXT, &attribs->visualCaveat); - } - else { - attribs->visualCaveat = GLX_NONE_EXT; + /* must have rgba bit */ + if (!(mode.renderType & GLX_RGBA_BIT)) + return EGL_FALSE; + + /* pixmap and pbuffer surfaces must be single-buffered in EGL */ + if (mode.doubleBufferMode) { + mode.drawableType &= ~(GLX_PIXMAP_BIT | GLX_PBUFFER_BIT); + if (!mode.drawableType) + return EGL_FALSE; } -#else - attribs->visualCaveat = 0; -#endif - return GL_TRUE; + mode.rgbMode = GL_TRUE; + mode.haveAccumBuffer = (mode.accumRedBits + + mode.accumGreenBits + + mode.accumBlueBits + + mode.accumAlphaBits > 0); + mode.haveDepthBuffer = (mode.depthBits > 0); + mode.haveStencilBuffer = (mode.stencilBits > 0); + + GLX_conf->double_buffered = (mode.doubleBufferMode != 0); + return _eglConfigFromContextModesRec(&GLX_conf->Base, &mode, + GLX_EGL_APIS, GLX_EGL_APIS); } -#ifdef GLX_VERSION_1_3 + +static const struct { + int attr; + int offset; +} visual_attributes[] = { + /* table 3.7 of GLX 1.4 */ + /* no GLX_USE_GL */ + MAP_ATTRIB(GLX_BUFFER_SIZE, rgbBits), + MAP_ATTRIB(GLX_LEVEL, level), + MAP_ATTRIB(GLX_RGBA, rgbMode), + MAP_ATTRIB(GLX_DOUBLEBUFFER, doubleBufferMode), + MAP_ATTRIB(GLX_STEREO, stereoMode), + MAP_ATTRIB(GLX_AUX_BUFFERS, numAuxBuffers), + MAP_ATTRIB(GLX_RED_SIZE, redBits), + MAP_ATTRIB(GLX_GREEN_SIZE, greenBits), + MAP_ATTRIB(GLX_BLUE_SIZE, blueBits), + MAP_ATTRIB(GLX_ALPHA_SIZE, alphaBits), + MAP_ATTRIB(GLX_DEPTH_SIZE, depthBits), + MAP_ATTRIB(GLX_STENCIL_SIZE, stencilBits), + MAP_ATTRIB(GLX_ACCUM_RED_SIZE, accumRedBits), + MAP_ATTRIB(GLX_ACCUM_GREEN_SIZE, accumGreenBits), + MAP_ATTRIB(GLX_ACCUM_BLUE_SIZE, accumBlueBits), + MAP_ATTRIB(GLX_ACCUM_ALPHA_SIZE, accumAlphaBits), + MAP_ATTRIB(GLX_SAMPLE_BUFFERS, sampleBuffers), + MAP_ATTRIB(GLX_SAMPLES, samples), + MAP_ATTRIB(GLX_FBCONFIG_ID, fbconfigID), + /* GLX_EXT_visual_rating */ + MAP_ATTRIB(GLX_VISUAL_CAVEAT_EXT, visualRating), +}; + static int -glx_token_to_visual_class(int visual_type) -{ - switch (visual_type) { - case GLX_TRUE_COLOR: - return TrueColor; - case GLX_DIRECT_COLOR: - return DirectColor; - case GLX_PSEUDO_COLOR: - return PseudoColor; - case GLX_STATIC_COLOR: - return StaticColor; - case GLX_GRAY_SCALE: - return GrayScale; - case GLX_STATIC_GRAY: - return StaticGray; - case GLX_NONE: +get_visual_type(const XVisualInfo *vis) +{ + int klass; + +#if defined(__cplusplus) || defined(c_plusplus) + klass = vis->c_class; +#else + klass = vis->class; +#endif + + switch (klass) { + case TrueColor: + return GLX_TRUE_COLOR; + case DirectColor: + return GLX_DIRECT_COLOR; + case PseudoColor: + return GLX_PSEUDO_COLOR; + case StaticColor: + return GLX_STATIC_COLOR; + case GrayScale: + return GLX_GRAY_SCALE; + case StaticGray: + return GLX_STATIC_GRAY; default: - return None; + return GLX_NONE; } } -static int -get_fbconfig_attribs(Display *dpy, GLXFBConfig fbconfig, - struct visual_attribs *attribs) -{ - int visual_type; - int fbconfig_id; - memset(attribs, 0, sizeof(struct visual_attribs)); +static EGLBoolean +convert_visual(Display *dpy, XVisualInfo *vinfo, + struct GLX_egl_config *GLX_conf) +{ + __GLcontextModes mode; + int err, attr, val, i; - glXGetFBConfigAttrib(dpy, fbconfig, GLX_FBCONFIG_ID, &fbconfig_id); + /* the visual must support OpenGL */ + err = glXGetConfig(dpy, vinfo, GLX_USE_GL, &val); + if (err || !val) + return EGL_FALSE; - glXGetFBConfigAttrib(dpy, fbconfig, GLX_VISUAL_ID, &attribs->id); + memset(&mode, 0, sizeof(mode)); + + for (i = 0; i < ARRAY_SIZE(visual_attributes); i++) { + int offset = visual_attributes[i].offset; + attr = visual_attributes[i].attr; + err = glXGetConfig(dpy, vinfo, attr, &val); + if (err) { + if (err == GLX_BAD_ATTRIBUTE) { + err = 0; + continue; + } + break; + } + *((int *) ((char *) &mode + offset)) = val; + } + if (err) + return EGL_FALSE; -#if 0 - attribs->depth = vInfo->depth; - attribs->redMask = vInfo->red_mask; - attribs->greenMask = vInfo->green_mask; - attribs->blueMask = vInfo->blue_mask; - attribs->colormapSize = vInfo->colormap_size; - attribs->bitsPerRGB = vInfo->bits_per_rgb; -#endif + /* must be RGB mode */ + if (!mode.rgbMode) + return EGL_FALSE; - glXGetFBConfigAttrib(dpy, fbconfig, GLX_X_VISUAL_TYPE, &visual_type); - attribs->klass = glx_token_to_visual_class(visual_type); - - glXGetFBConfigAttrib(dpy, fbconfig, GLX_BUFFER_SIZE, &attribs->bufferSize); - glXGetFBConfigAttrib(dpy, fbconfig, GLX_LEVEL, &attribs->level); - glXGetFBConfigAttrib(dpy, fbconfig, GLX_RENDER_TYPE, &attribs->render_type); - if (!(attribs->render_type & GLX_RGBA_BIT)) - return 0; - - glXGetFBConfigAttrib(dpy, fbconfig, GLX_DOUBLEBUFFER, &attribs->doubleBuffer); - if (!attribs->doubleBuffer) - return 0; - - glXGetFBConfigAttrib(dpy, fbconfig, GLX_STEREO, &attribs->stereo); - glXGetFBConfigAttrib(dpy, fbconfig, GLX_AUX_BUFFERS, &attribs->auxBuffers); - - glXGetFBConfigAttrib(dpy, fbconfig, GLX_RED_SIZE, &attribs->redSize); - glXGetFBConfigAttrib(dpy, fbconfig, GLX_GREEN_SIZE, &attribs->greenSize); - glXGetFBConfigAttrib(dpy, fbconfig, GLX_BLUE_SIZE, &attribs->blueSize); - glXGetFBConfigAttrib(dpy, fbconfig, GLX_ALPHA_SIZE, &attribs->alphaSize); - glXGetFBConfigAttrib(dpy, fbconfig, GLX_DEPTH_SIZE, &attribs->depthSize); - glXGetFBConfigAttrib(dpy, fbconfig, GLX_STENCIL_SIZE, &attribs->stencilSize); - - glXGetFBConfigAttrib(dpy, fbconfig, GLX_ACCUM_RED_SIZE, &attribs->accumRedSize); - glXGetFBConfigAttrib(dpy, fbconfig, GLX_ACCUM_GREEN_SIZE, &attribs->accumGreenSize); - glXGetFBConfigAttrib(dpy, fbconfig, GLX_ACCUM_BLUE_SIZE, &attribs->accumBlueSize); - glXGetFBConfigAttrib(dpy, fbconfig, GLX_ACCUM_ALPHA_SIZE, &attribs->accumAlphaSize); - - /* get transparent pixel stuff */ - glXGetFBConfigAttrib(dpy, fbconfig,GLX_TRANSPARENT_TYPE, &attribs->transparentType); - if (attribs->transparentType == GLX_TRANSPARENT_RGB) { - glXGetFBConfigAttrib(dpy, fbconfig, GLX_TRANSPARENT_RED_VALUE, &attribs->transparentRedValue); - glXGetFBConfigAttrib(dpy, fbconfig, GLX_TRANSPARENT_GREEN_VALUE, &attribs->transparentGreenValue); - glXGetFBConfigAttrib(dpy, fbconfig, GLX_TRANSPARENT_BLUE_VALUE, &attribs->transparentBlueValue); - glXGetFBConfigAttrib(dpy, fbconfig, GLX_TRANSPARENT_ALPHA_VALUE, &attribs->transparentAlphaValue); - } - else if (attribs->transparentType == GLX_TRANSPARENT_INDEX) { - glXGetFBConfigAttrib(dpy, fbconfig, GLX_TRANSPARENT_INDEX_VALUE, &attribs->transparentIndexValue); - } + mode.visualID = vinfo->visualid; + mode.visualType = get_visual_type(vinfo); + mode.redMask = vinfo->red_mask; + mode.greenMask = vinfo->green_mask; + mode.blueMask = vinfo->blue_mask; + + mode.drawableType = GLX_WINDOW_BIT; + /* pixmap surfaces must be single-buffered in EGL */ + if (!mode.doubleBufferMode) + mode.drawableType |= GLX_PIXMAP_BIT; + + mode.renderType = GLX_RGBA_BIT; + mode.xRenderable = GL_TRUE; + mode.haveAccumBuffer = (mode.accumRedBits + + mode.accumGreenBits + + mode.accumBlueBits + + mode.accumAlphaBits > 0); + mode.haveDepthBuffer = (mode.depthBits > 0); + mode.haveStencilBuffer = (mode.stencilBits > 0); + + GLX_conf->double_buffered = (mode.doubleBufferMode != 0); + return _eglConfigFromContextModesRec(&GLX_conf->Base, &mode, + GLX_EGL_APIS, GLX_EGL_APIS); +} - glXGetFBConfigAttrib(dpy, fbconfig, GLX_SAMPLE_BUFFERS, &attribs->numMultisample); - glXGetFBConfigAttrib(dpy, fbconfig, GLX_SAMPLES, &attribs->numSamples); - glXGetFBConfigAttrib(dpy, fbconfig, GLX_CONFIG_CAVEAT, &attribs->visualCaveat); +static void +fix_config(struct GLX_egl_display *GLX_dpy, struct GLX_egl_config *GLX_conf) +{ + _EGLConfig *conf = &GLX_conf->Base; + EGLint surface_type, r, g, b, a; + + surface_type = GET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE); + if (!GLX_conf->double_buffered && GLX_dpy->single_buffered_quirk) { + /* some GLX impls do not like single-buffered window surface */ + surface_type &= ~EGL_WINDOW_BIT; + /* pbuffer bit is usually not set */ + if (GLX_dpy->have_pbuffer) + surface_type |= EGL_PBUFFER_BIT; + SET_CONFIG_ATTRIB(conf, EGL_SURFACE_TYPE, surface_type); + } - if (attribs->id == 0) { - attribs->id = fbconfig_id; - return EGL_PBUFFER_BIT | EGL_PIXMAP_BIT; + /* no visual attribs unless window bit is set */ + if (!(surface_type & EGL_WINDOW_BIT)) { + SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_ID, 0); + SET_CONFIG_ATTRIB(conf, EGL_NATIVE_VISUAL_TYPE, EGL_NONE); } - return EGL_WINDOW_BIT; + /* make sure buffer size is set correctly */ + r = GET_CONFIG_ATTRIB(conf, EGL_RED_SIZE); + g = GET_CONFIG_ATTRIB(conf, EGL_GREEN_SIZE); + b = GET_CONFIG_ATTRIB(conf, EGL_BLUE_SIZE); + a = GET_CONFIG_ATTRIB(conf, EGL_ALPHA_SIZE); + SET_CONFIG_ATTRIB(conf, EGL_BUFFER_SIZE, r + g + b + a); } -#endif static EGLBoolean -create_configs(_EGLDisplay *disp, struct GLX_egl_display *GLX_dpy) +create_configs(_EGLDisplay *dpy, struct GLX_egl_display *GLX_dpy, + EGLint screen) { - XVisualInfo theTemplate; - int numVisuals; - long mask; - int i; - struct visual_attribs attribs; + EGLint num_configs = 0, i; + EGLint id = 1; - GLX_dpy->fbconfigs = NULL; - -#ifdef GLX_VERSION_1_3 - /* get list of all fbconfigs on this screen */ - GLX_dpy->fbconfigs = glXGetFBConfigs(GLX_dpy->dpy, DefaultScreen(GLX_dpy->dpy), &numVisuals); + if (GLX_dpy->have_fbconfig) { + GLX_dpy->fbconfigs = glXGetFBConfigs(GLX_dpy->dpy, screen, &num_configs); + } + else { + XVisualInfo vinfo_template; + long mask; - if (numVisuals == 0) { - GLX_dpy->fbconfigs = NULL; - goto xvisual; + vinfo_template.screen = screen; + mask = VisualScreenMask; + GLX_dpy->visuals = XGetVisualInfo(GLX_dpy->dpy, mask, &vinfo_template, + &num_configs); } - for (i = 0; i < numVisuals; i++) { - struct GLX_egl_config *config; - int bit; + if (!num_configs) + return EGL_FALSE; - bit = get_fbconfig_attribs(GLX_dpy->dpy, GLX_dpy->fbconfigs[i], &attribs); - if (!bit) + for (i = 0; i < num_configs; i++) { + struct GLX_egl_config *GLX_conf, template; + EGLBoolean ok; + + memset(&template, 0, sizeof(template)); + _eglInitConfig(&template.Base, id); + if (GLX_dpy->have_fbconfig) + ok = convert_fbconfig(GLX_dpy->dpy, GLX_dpy->fbconfigs[i], &template); + else + ok = convert_visual(GLX_dpy->dpy, &GLX_dpy->visuals[i], &template); + if (!ok) + continue; + + fix_config(GLX_dpy, &template); + if (!_eglValidateConfig(&template.Base, EGL_FALSE)) { + _eglLog(_EGL_DEBUG, "GLX: failed to validate config %d", i); continue; + } + + GLX_conf = CALLOC_STRUCT(GLX_egl_config); + if (GLX_conf) { + memcpy(GLX_conf, &template, sizeof(template)); + GLX_conf->index = i; - config = CALLOC_STRUCT(GLX_egl_config); - - config->index = i; - _eglInitConfig(&config->Base, (i+1)); - SET_CONFIG_ATTRIB(&config->Base, EGL_NATIVE_VISUAL_ID, attribs.id); - SET_CONFIG_ATTRIB(&config->Base, EGL_BUFFER_SIZE, attribs.bufferSize); - SET_CONFIG_ATTRIB(&config->Base, EGL_RED_SIZE, attribs.redSize); - SET_CONFIG_ATTRIB(&config->Base, EGL_GREEN_SIZE, attribs.greenSize); - SET_CONFIG_ATTRIB(&config->Base, EGL_BLUE_SIZE, attribs.blueSize); - SET_CONFIG_ATTRIB(&config->Base, EGL_ALPHA_SIZE, attribs.alphaSize); - SET_CONFIG_ATTRIB(&config->Base, EGL_DEPTH_SIZE, attribs.depthSize); - SET_CONFIG_ATTRIB(&config->Base, EGL_STENCIL_SIZE, attribs.stencilSize); - SET_CONFIG_ATTRIB(&config->Base, EGL_SAMPLES, attribs.numSamples); - SET_CONFIG_ATTRIB(&config->Base, EGL_SAMPLE_BUFFERS, attribs.numMultisample); - SET_CONFIG_ATTRIB(&config->Base, EGL_CONFORMANT, all_apis); - SET_CONFIG_ATTRIB(&config->Base, EGL_RENDERABLE_TYPE, all_apis); - SET_CONFIG_ATTRIB(&config->Base, EGL_SURFACE_TYPE, bit); - - /* XXX possibly other things to init... */ - - _eglAddConfig(disp, &config->Base); + _eglAddConfig(dpy, &GLX_conf->Base); + id++; + } } - goto end; -#endif + return EGL_TRUE; +} + + +static void +check_extensions(struct GLX_egl_display *GLX_dpy, EGLint screen) +{ + GLX_dpy->extensions = + glXQueryExtensionsString(GLX_dpy->dpy, screen); + if (GLX_dpy->extensions) { + /* glXGetProcAddress is assumed */ + + if (strstr(GLX_dpy->extensions, "GLX_SGI_make_current_read")) { + /* GLX 1.3 entry points are used */ + GLX_dpy->have_make_current_read = EGL_TRUE; + } -xvisual: - /* get list of all visuals on this screen */ - theTemplate.screen = DefaultScreen(GLX_dpy->dpy); - mask = VisualScreenMask; - GLX_dpy->visuals = XGetVisualInfo(GLX_dpy->dpy, mask, &theTemplate, &numVisuals); - - for (i = 0; i < numVisuals; i++) { - struct GLX_egl_config *config; - - if (!get_visual_attribs(GLX_dpy->dpy, &GLX_dpy->visuals[i], &attribs)) - continue; - - config = CALLOC_STRUCT(GLX_egl_config); - - config->index = i; - _eglInitConfig(&config->Base, (i+1)); - SET_CONFIG_ATTRIB(&config->Base, EGL_NATIVE_VISUAL_ID, attribs.id); - SET_CONFIG_ATTRIB(&config->Base, EGL_BUFFER_SIZE, attribs.bufferSize); - SET_CONFIG_ATTRIB(&config->Base, EGL_RED_SIZE, attribs.redSize); - SET_CONFIG_ATTRIB(&config->Base, EGL_GREEN_SIZE, attribs.greenSize); - SET_CONFIG_ATTRIB(&config->Base, EGL_BLUE_SIZE, attribs.blueSize); - SET_CONFIG_ATTRIB(&config->Base, EGL_ALPHA_SIZE, attribs.alphaSize); - SET_CONFIG_ATTRIB(&config->Base, EGL_DEPTH_SIZE, attribs.depthSize); - SET_CONFIG_ATTRIB(&config->Base, EGL_STENCIL_SIZE, attribs.stencilSize); - SET_CONFIG_ATTRIB(&config->Base, EGL_SAMPLES, attribs.numSamples); - SET_CONFIG_ATTRIB(&config->Base, EGL_SAMPLE_BUFFERS, attribs.numMultisample); - SET_CONFIG_ATTRIB(&config->Base, EGL_CONFORMANT, all_apis); - SET_CONFIG_ATTRIB(&config->Base, EGL_RENDERABLE_TYPE, all_apis); - SET_CONFIG_ATTRIB(&config->Base, EGL_SURFACE_TYPE, - (EGL_WINDOW_BIT /*| EGL_PBUFFER_BIT | EGL_PIXMAP_BIT*/)); - - /* XXX possibly other things to init... */ - - _eglAddConfig(disp, &config->Base); + if (strstr(GLX_dpy->extensions, "GLX_SGIX_fbconfig")) { + /* GLX 1.3 entry points are used */ + GLX_dpy->have_fbconfig = EGL_TRUE; + } + + if (strstr(GLX_dpy->extensions, "GLX_SGIX_pbuffer")) { + GLX_dpy->glXCreateGLXPbufferSGIX = (PFNGLXCREATEGLXPBUFFERSGIXPROC) + glXGetProcAddress((const GLubyte *) "glXCreateGLXPbufferSGIX"); + GLX_dpy->glXDestroyGLXPbufferSGIX = (PFNGLXDESTROYGLXPBUFFERSGIXPROC) + glXGetProcAddress((const GLubyte *) "glXDestroyGLXPbufferSGIX"); + + if (GLX_dpy->glXCreateGLXPbufferSGIX && + GLX_dpy->glXDestroyGLXPbufferSGIX && + GLX_dpy->have_fbconfig) + GLX_dpy->have_pbuffer = EGL_TRUE; + } } -end: - return EGL_TRUE; + if (GLX_dpy->glx_maj == 1 && GLX_dpy->glx_min >= 3) { + GLX_dpy->have_1_3 = EGL_TRUE; + GLX_dpy->have_make_current_read = EGL_TRUE; + GLX_dpy->have_fbconfig = EGL_TRUE; + GLX_dpy->have_pbuffer = EGL_TRUE; + } +} + + +static void +check_quirks(struct GLX_egl_display *GLX_dpy, EGLint screen) +{ + const char *vendor; + + GLX_dpy->single_buffered_quirk = EGL_TRUE; + GLX_dpy->glx_window_quirk = EGL_TRUE; + + vendor = glXGetClientString(GLX_dpy->dpy, GLX_VENDOR); + if (vendor && strstr(vendor, "NVIDIA")) { + vendor = glXQueryServerString(GLX_dpy->dpy, screen, GLX_VENDOR); + if (vendor && strstr(vendor, "NVIDIA")) { + _eglLog(_EGL_DEBUG, "disable quirks"); + GLX_dpy->single_buffered_quirk = EGL_FALSE; + GLX_dpy->glx_window_quirk = EGL_FALSE; + } + } } + /** * Called via eglInitialize(), GLX_drv->API.Initialize(). */ @@ -478,17 +546,33 @@ GLX_eglInitialize(_EGLDriver *drv, _EGLDisplay *disp, } } - disp->DriverData = (void *) GLX_dpy; - disp->ClientAPIsMask = all_apis; + if (!glXQueryVersion(GLX_dpy->dpy, &GLX_dpy->glx_maj, &GLX_dpy->glx_min)) { + _eglLog(_EGL_WARNING, "GLX: glXQueryVersion failed"); + if (!disp->NativeDisplay) + XCloseDisplay(GLX_dpy->dpy); + free(GLX_dpy); + return EGL_FALSE; + } - glXQueryVersion(GLX_dpy->dpy, &GLX_dpy->glx_maj, &GLX_dpy->glx_min); + check_extensions(GLX_dpy, DefaultScreen(GLX_dpy->dpy)); + check_quirks(GLX_dpy, DefaultScreen(GLX_dpy->dpy)); + + create_configs(disp, GLX_dpy, DefaultScreen(GLX_dpy->dpy)); + if (!disp->NumConfigs) { + _eglLog(_EGL_WARNING, "GLX: failed to create any config"); + if (!disp->NativeDisplay) + XCloseDisplay(GLX_dpy->dpy); + free(GLX_dpy); + return EGL_FALSE; + } + + disp->DriverData = (void *) GLX_dpy; + disp->ClientAPIsMask = GLX_EGL_APIS; /* we're supporting EGL 1.4 */ *major = 1; *minor = 4; - create_configs(disp, GLX_dpy); - return EGL_TRUE; } -- cgit v1.2.3 From c407c7024495b19eec5ce978b611c7359c247f81 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 1 Oct 2009 18:22:33 +0800 Subject: egl_glx: Clean up surface functions. Separete Drawable and GLXDrawable. Add support for pbuffer and pixmap surfaces on GLX <= 1.3. Remove surface binding code that will never work. Signed-off-by: Chia-I Wu --- src/egl/drivers/glx/egl_glx.c | 205 ++++++++++++++++++++++-------------------- 1 file changed, 106 insertions(+), 99 deletions(-) (limited to 'src') diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c index 404c998dcb..e09cbe744e 100644 --- a/src/egl/drivers/glx/egl_glx.c +++ b/src/egl/drivers/glx/egl_glx.c @@ -33,20 +33,12 @@ * Authors: Alan Hourihane */ -/* - * TODO: - * - * test eglBind/ReleaseTexImage - */ - - #include #include #include +#include #include -#include "glxclient.h" - #include "eglconfigutil.h" #include "eglconfig.h" #include "eglcontext.h" @@ -117,7 +109,8 @@ struct GLX_egl_surface { _EGLSurface Base; /**< base class */ - GLXDrawable drawable; + Drawable drawable; + GLXDrawable glx_drawable; }; @@ -673,8 +666,8 @@ GLX_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf, if (!_eglMakeCurrent(drv, disp, dsurf, rsurf, ctx)) return EGL_FALSE; - ddraw = (GLX_dsurf) ? GLX_dsurf->drawable : None; - rdraw = (GLX_rsurf) ? GLX_rsurf->drawable : None; + ddraw = (GLX_dsurf) ? GLX_dsurf->glx_drawable : None; + rdraw = (GLX_rsurf) ? GLX_rsurf->glx_drawable : None; cctx = (GLX_ctx) ? GLX_ctx->context : NULL; #ifdef GLX_VERSION_1_3 @@ -726,6 +719,20 @@ GLX_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf, } GLX_surf->drawable = window; + + if (GLX_dpy->have_1_3 && !GLX_dpy->glx_window_quirk) + GLX_surf->glx_drawable = + glXCreateWindow(GLX_dpy->dpy, + GLX_dpy->fbconfigs[GLX_egl_config_index(conf)], + GLX_surf->drawable, NULL); + else + GLX_surf->glx_drawable = GLX_surf->drawable; + + if (!GLX_surf->glx_drawable) { + free(GLX_surf); + return NULL; + } + get_drawable_size(GLX_dpy->dpy, window, &width, &height); GLX_surf->Base.Width = width; GLX_surf->Base.Height = height; @@ -733,18 +740,13 @@ GLX_eglCreateWindowSurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf, return &GLX_surf->Base; } -#ifdef GLX_VERSION_1_3 static _EGLSurface * GLX_eglCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf, NativePixmapType pixmap, const EGLint *attrib_list) { struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp); struct GLX_egl_surface *GLX_surf; - int i; - - /* GLX must >= 1.3 */ - if (!(GLX_dpy->glx_maj == 1 && GLX_dpy->glx_min >= 3)) - return NULL; + uint width, height; GLX_surf = CALLOC_STRUCT(GLX_egl_surface); if (!GLX_surf) { @@ -758,25 +760,39 @@ GLX_eglCreatePixmapSurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf, return NULL; } - for (i = 0; attrib_list && attrib_list[i] != EGL_NONE; i++) { - switch (attrib_list[i]) { - /* no attribs at this time */ - default: - _eglError(EGL_BAD_ATTRIBUTE, "eglCreatePixmapSurface"); - free(GLX_surf); - return NULL; + GLX_surf->drawable = pixmap; + + if (GLX_dpy->have_1_3) { + GLX_surf->glx_drawable = + glXCreatePixmap(GLX_dpy->dpy, + GLX_dpy->fbconfigs[GLX_egl_config_index(conf)], + GLX_surf->drawable, NULL); + } + else if (GLX_dpy->have_fbconfig) { + GLXFBConfig fbconfig = GLX_dpy->fbconfigs[GLX_egl_config_index(conf)]; + XVisualInfo *vinfo = glXGetVisualFromFBConfig(GLX_dpy->dpy, fbconfig); + if (vinfo) { + GLX_surf->glx_drawable = + glXCreateGLXPixmap(GLX_dpy->dpy, vinfo, GLX_surf->drawable); + XFree(vinfo); } } + else { + GLX_surf->glx_drawable = + glXCreateGLXPixmap(GLX_dpy->dpy, + &GLX_dpy->visuals[GLX_egl_config_index(conf)], + GLX_surf->drawable); + } - GLX_surf->drawable = - glXCreatePixmap(GLX_dpy->dpy, - GLX_dpy->fbconfigs[GLX_egl_config_index(conf)], - pixmap, NULL); - if (!GLX_surf->drawable) { + if (!GLX_surf->glx_drawable) { free(GLX_surf); return NULL; } + get_drawable_size(GLX_dpy->dpy, pixmap, &width, &height); + GLX_surf->Base.Width = width; + GLX_surf->Base.Height = height; + return &GLX_surf->Base; } @@ -787,11 +803,7 @@ GLX_eglCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *disp, struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp); struct GLX_egl_surface *GLX_surf; int attribs[5]; - int i = 0, j = 0; - - /* GLX must >= 1.3 */ - if (!(GLX_dpy->glx_maj == 1 && GLX_dpy->glx_min >= 3)) - return NULL; + int i; GLX_surf = CALLOC_STRUCT(GLX_egl_surface); if (!GLX_surf) { @@ -805,33 +817,44 @@ GLX_eglCreatePbufferSurface(_EGLDriver *drv, _EGLDisplay *disp, return NULL; } - while(attrib_list[i] != EGL_NONE) { - switch (attrib_list[i]) { - case EGL_WIDTH: - attribs[j++] = GLX_PBUFFER_WIDTH; - attribs[j++] = attrib_list[i+1]; - break; - case EGL_HEIGHT: - attribs[j++] = GLX_PBUFFER_HEIGHT; - attribs[j++] = attrib_list[i+1]; - break; + i = 0; + attribs[i] = None; + + GLX_surf->drawable = None; + + if (GLX_dpy->have_1_3) { + /* put geometry in attribs */ + if (GLX_surf->Base.Width) { + attribs[i++] = GLX_PBUFFER_WIDTH; + attribs[i++] = GLX_surf->Base.Width; + } + if (GLX_surf->Base.Height) { + attribs[i++] = GLX_PBUFFER_HEIGHT; + attribs[i++] = GLX_surf->Base.Height; } - i++; + attribs[i] = None; + + GLX_surf->glx_drawable = + glXCreatePbuffer(GLX_dpy->dpy, + GLX_dpy->fbconfigs[GLX_egl_config_index(conf)], + attribs); + } + else if (GLX_dpy->have_pbuffer) { + GLX_surf->glx_drawable = GLX_dpy->glXCreateGLXPbufferSGIX( + GLX_dpy->dpy, + GLX_dpy->fbconfigs[GLX_egl_config_index(conf)], + GLX_surf->Base.Width, + GLX_surf->Base.Height, + attribs); } - attribs[j++] = 0; - GLX_surf->drawable = - glXCreatePbuffer(GLX_dpy->dpy, - GLX_dpy->fbconfigs[GLX_egl_config_index(conf)], - attribs); - if (!GLX_surf->drawable) { + if (!GLX_surf->glx_drawable) { free(GLX_surf); return NULL; } return &GLX_surf->Base; } -#endif static EGLBoolean GLX_eglDestroySurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) @@ -839,15 +862,35 @@ GLX_eglDestroySurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp); if (!_eglIsSurfaceBound(surf)) { struct GLX_egl_surface *GLX_surf = GLX_egl_surface(surf); - switch (surf->Type) { - case EGL_PBUFFER_BIT: - glXDestroyPbuffer(GLX_dpy->dpy, GLX_surf->drawable); - break; - case EGL_PIXMAP_BIT: - glXDestroyPixmap(GLX_dpy->dpy, GLX_surf->drawable); - break; - default: - break; + + if (GLX_dpy->have_1_3) { + switch (surf->Type) { + case EGL_WINDOW_BIT: + if (!GLX_dpy->glx_window_quirk) + glXDestroyWindow(GLX_dpy->dpy, GLX_surf->glx_drawable); + break; + case EGL_PBUFFER_BIT: + glXDestroyPbuffer(GLX_dpy->dpy, GLX_surf->glx_drawable); + break; + case EGL_PIXMAP_BIT: + glXDestroyPixmap(GLX_dpy->dpy, GLX_surf->glx_drawable); + break; + default: + break; + } + } + else { + switch (surf->Type) { + case EGL_PBUFFER_BIT: + GLX_dpy->glXDestroyGLXPbufferSGIX(GLX_dpy->dpy, + GLX_surf->glx_drawable); + break; + case EGL_PIXMAP_BIT: + glXDestroyGLXPixmap(GLX_dpy->dpy, GLX_surf->glx_drawable); + break; + default: + break; + } } free(surf); } @@ -856,45 +899,13 @@ GLX_eglDestroySurface(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf) } -static EGLBoolean -GLX_eglBindTexImage(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf, - EGLint buffer) -{ - struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp); - struct GLX_egl_surface *GLX_surf = GLX_egl_surface(surf); - - /* buffer ?? */ - glXBindTexImageEXT(GLX_dpy->dpy, GLX_surf->drawable, - GLX_FRONT_LEFT_EXT, NULL); - - return EGL_TRUE; -} - - -static EGLBoolean -GLX_eglReleaseTexImage(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *surf, - EGLint buffer) -{ - struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp); - struct GLX_egl_surface *GLX_surf = GLX_egl_surface(surf); - - /* buffer ?? */ - glXReleaseTexImageEXT(GLX_dpy->dpy, GLX_surf->drawable, - GLX_FRONT_LEFT_EXT); - - return EGL_TRUE; -} - - static EGLBoolean GLX_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) { struct GLX_egl_display *GLX_dpy = GLX_egl_display(disp); struct GLX_egl_surface *GLX_surf = GLX_egl_surface(draw); - _eglLog(_EGL_DEBUG, "GLX: EGL SwapBuffers 0x%x",draw); - - glXSwapBuffers(GLX_dpy->dpy, GLX_surf->drawable); + glXSwapBuffers(GLX_dpy->dpy, GLX_surf->glx_drawable); return EGL_TRUE; } @@ -949,13 +960,9 @@ _eglMain(const char *args) GLX_drv->Base.API.CreateContext = GLX_eglCreateContext; GLX_drv->Base.API.MakeCurrent = GLX_eglMakeCurrent; GLX_drv->Base.API.CreateWindowSurface = GLX_eglCreateWindowSurface; -#ifdef GLX_VERSION_1_3 GLX_drv->Base.API.CreatePixmapSurface = GLX_eglCreatePixmapSurface; GLX_drv->Base.API.CreatePbufferSurface = GLX_eglCreatePbufferSurface; -#endif GLX_drv->Base.API.DestroySurface = GLX_eglDestroySurface; - GLX_drv->Base.API.BindTexImage = GLX_eglBindTexImage; - GLX_drv->Base.API.ReleaseTexImage = GLX_eglReleaseTexImage; GLX_drv->Base.API.SwapBuffers = GLX_eglSwapBuffers; GLX_drv->Base.API.GetProcAddress = GLX_eglGetProcAddress; -- cgit v1.2.3 From a20643657723094197620976402aeec2f40a84a0 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 1 Oct 2009 18:23:41 +0800 Subject: egl_glx: Clean up context functions. This lifts the requirement that a context must be direct. Signed-off-by: Chia-I Wu --- src/egl/drivers/glx/egl_glx.c | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c index e09cbe744e..aa0c8c88b1 100644 --- a/src/egl/drivers/glx/egl_glx.c +++ b/src/egl/drivers/glx/egl_glx.c @@ -616,8 +616,7 @@ GLX_eglCreateContext(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf, return NULL; } -#ifdef GLX_VERSION_1_3 - if (GLX_dpy->fbconfigs) + if (GLX_dpy->have_fbconfig) GLX_ctx->context = glXCreateNewContext(GLX_dpy->dpy, GLX_dpy->fbconfigs[GLX_egl_config_index(conf)], @@ -625,7 +624,6 @@ GLX_eglCreateContext(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf, GLX_ctx_shared ? GLX_ctx_shared->context : NULL, GL_TRUE); else -#endif GLX_ctx->context = glXCreateContext(GLX_dpy->dpy, &GLX_dpy->visuals[GLX_egl_config_index(conf)], @@ -636,15 +634,6 @@ GLX_eglCreateContext(_EGLDriver *drv, _EGLDisplay *disp, _EGLConfig *conf, return NULL; } -#if 1 - /* (maybe?) need to have a direct rendering context */ - if (!glXIsDirect(GLX_dpy->dpy, GLX_ctx->context)) { - glXDestroyContext(GLX_dpy->dpy, GLX_ctx->context); - free(GLX_ctx); - return NULL; - } -#endif - return &GLX_ctx->Base; } @@ -670,13 +659,10 @@ GLX_eglMakeCurrent(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *dsurf, rdraw = (GLX_rsurf) ? GLX_rsurf->glx_drawable : None; cctx = (GLX_ctx) ? GLX_ctx->context : NULL; -#ifdef GLX_VERSION_1_3 - if (glXMakeContextCurrent(GLX_dpy->dpy, ddraw, rdraw, cctx)) - return EGL_TRUE; -#endif - - if (ddraw == rdraw && glXMakeCurrent(GLX_dpy->dpy, ddraw, cctx)) - return EGL_TRUE; + if (GLX_dpy->have_make_current_read) + return glXMakeContextCurrent(GLX_dpy->dpy, ddraw, rdraw, cctx); + else if (ddraw == rdraw) + return glXMakeCurrent(GLX_dpy->dpy, ddraw, cctx); return EGL_FALSE; } -- cgit v1.2.3 From 7ffe64a7ae912974f9c2da43dd362cd832e2ba99 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 1 Oct 2009 18:23:58 +0800 Subject: egl_glx: Clean up eglGetProcAddress. Signed-off-by: Chia-I Wu --- src/egl/drivers/glx/egl_glx.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'src') diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c index aa0c8c88b1..71b26181c1 100644 --- a/src/egl/drivers/glx/egl_glx.c +++ b/src/egl/drivers/glx/egl_glx.c @@ -37,7 +37,6 @@ #include #include #include -#include #include "eglconfigutil.h" #include "eglconfig.h" @@ -902,21 +901,7 @@ GLX_eglSwapBuffers(_EGLDriver *drv, _EGLDisplay *disp, _EGLSurface *draw) static _EGLProc GLX_eglGetProcAddress(const char *procname) { - /* This is a bit of a hack to get at the gallium/Mesa state tracker - * function st_get_proc_address(). This will probably change at - * some point. - */ - _EGLProc (*get_proc_addr)(const char *procname); - _EGLProc proc_addr; - get_proc_addr = dlsym(NULL, "st_get_proc_address"); - if (get_proc_addr) - return get_proc_addr(procname); - - proc_addr = glXGetProcAddress((const GLubyte *)procname); - if (proc_addr) - return proc_addr; - - return (_EGLProc)dlsym(NULL, procname); + return (_EGLProc) glXGetProcAddress((const GLubyte *) procname); } -- cgit v1.2.3 From 60cf250d4705d5005399a53ab334fbc10b4bf9c4 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 2 Oct 2009 10:38:14 +0800 Subject: egl_glx: Add support for eglWaitClient and eglWaitNative. Signed-off-by: Chia-I Wu --- src/egl/drivers/glx/egl_glx.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') diff --git a/src/egl/drivers/glx/egl_glx.c b/src/egl/drivers/glx/egl_glx.c index 71b26181c1..96292b0e9e 100644 --- a/src/egl/drivers/glx/egl_glx.c +++ b/src/egl/drivers/glx/egl_glx.c @@ -904,6 +904,21 @@ GLX_eglGetProcAddress(const char *procname) return (_EGLProc) glXGetProcAddress((const GLubyte *) procname); } +static EGLBoolean +GLX_eglWaitClient(_EGLDriver *drv, _EGLDisplay *dpy, _EGLContext *ctx) +{ + glXWaitGL(); + return EGL_TRUE; +} + +static EGLBoolean +GLX_eglWaitNative(_EGLDriver *drv, _EGLDisplay *dpy, EGLint engine) +{ + if (engine != EGL_CORE_NATIVE_ENGINE) + return _eglError(EGL_BAD_PARAMETER, "eglWaitNative"); + glXWaitX(); + return EGL_TRUE; +} static void GLX_Unload(_EGLDriver *drv) @@ -936,6 +951,8 @@ _eglMain(const char *args) GLX_drv->Base.API.DestroySurface = GLX_eglDestroySurface; GLX_drv->Base.API.SwapBuffers = GLX_eglSwapBuffers; GLX_drv->Base.API.GetProcAddress = GLX_eglGetProcAddress; + GLX_drv->Base.API.WaitClient = GLX_eglWaitClient; + GLX_drv->Base.API.WaitNative = GLX_eglWaitNative; GLX_drv->Base.Name = "GLX"; GLX_drv->Base.Unload = GLX_Unload; -- cgit v1.2.3 From c4af8ce69e1a7105b0178da8a085b73ab984e432 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Thu, 22 Oct 2009 11:49:19 -0400 Subject: st/xorg: lots of render fixes fixes all the blend modes, fixes flushing/finishing semantics, adds acceleration for the component alpha modes that we can support, fixes src in mask shader and general cleanups --- src/gallium/state_trackers/xorg/xorg_composite.c | 168 ++++++++++++----------- src/gallium/state_trackers/xorg/xorg_exa.c | 19 ++- src/gallium/state_trackers/xorg/xorg_exa_tgsi.c | 37 ++--- src/gallium/state_trackers/xorg/xorg_exa_tgsi.h | 3 +- 4 files changed, 114 insertions(+), 113 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 7379e3b746..297b6c5f5d 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -13,68 +13,43 @@ #define XFixedToDouble(f) (((double) (f)) / 65536.) struct xorg_composite_blend { - int op:8; + int op : 8; - unsigned rgb_src_factor:5; /**< PIPE_BLENDFACTOR_x */ - unsigned alpha_src_factor:5; /**< PIPE_BLENDFACTOR_x */ + unsigned alpha_dst : 4; + unsigned alpha_src : 4; - unsigned rgb_dst_factor:5; /**< PIPE_BLENDFACTOR_x */ - unsigned alpha_dst_factor:5; /**< PIPE_BLENDFACTOR_x */ + unsigned rgb_src : 8; /**< PIPE_BLENDFACTOR_x */ + unsigned rgb_dst : 8; /**< PIPE_BLENDFACTOR_x */ }; #define BLEND_OP_OVER 3 static const struct xorg_composite_blend xorg_blends[] = { { PictOpClear, - PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ZERO, - PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ZERO }, - + 0, 0, PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ZERO}, { PictOpSrc, - PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_ONE, - PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ZERO }, - + 0, 0, PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_ZERO}, { PictOpDst, - PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ZERO, - PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_ONE }, - + 0, 0, PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ONE}, { PictOpOver, - PIPE_BLENDFACTOR_SRC_ALPHA, PIPE_BLENDFACTOR_ONE, - PIPE_BLENDFACTOR_INV_SRC_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA }, - + 0, 1, PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_INV_SRC_ALPHA}, { PictOpOverReverse, - PIPE_BLENDFACTOR_INV_DST_ALPHA, PIPE_BLENDFACTOR_ONE, - PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_INV_SRC_ALPHA }, - + 1, 0, PIPE_BLENDFACTOR_INV_DST_ALPHA, PIPE_BLENDFACTOR_ONE}, { PictOpIn, - PIPE_BLENDFACTOR_DST_ALPHA, PIPE_BLENDFACTOR_ONE, - PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_INV_SRC_ALPHA }, - + 1, 0, PIPE_BLENDFACTOR_DST_ALPHA, PIPE_BLENDFACTOR_ZERO}, { PictOpInReverse, - PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ONE, - PIPE_BLENDFACTOR_SRC_ALPHA, PIPE_BLENDFACTOR_ONE }, - + 0, 1, PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_SRC_ALPHA}, { PictOpOut, - PIPE_BLENDFACTOR_INV_DST_ALPHA, PIPE_BLENDFACTOR_ONE, - PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_INV_SRC_ALPHA }, - + 1, 0, PIPE_BLENDFACTOR_INV_DST_ALPHA, PIPE_BLENDFACTOR_ZERO}, { PictOpOutReverse, - PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_ONE, - PIPE_BLENDFACTOR_INV_SRC_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA }, - + 0, 1, PIPE_BLENDFACTOR_ZERO, PIPE_BLENDFACTOR_INV_SRC_ALPHA}, { PictOpAtop, - PIPE_BLENDFACTOR_DST_ALPHA, PIPE_BLENDFACTOR_ONE, - PIPE_BLENDFACTOR_INV_SRC_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA }, - + 1, 1, PIPE_BLENDFACTOR_DST_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA}, { PictOpAtopReverse, - PIPE_BLENDFACTOR_INV_DST_ALPHA, PIPE_BLENDFACTOR_ONE, - PIPE_BLENDFACTOR_SRC_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA }, - + 1, 1, PIPE_BLENDFACTOR_INV_DST_ALPHA, PIPE_BLENDFACTOR_SRC_ALPHA}, { PictOpXor, - PIPE_BLENDFACTOR_INV_DST_ALPHA, PIPE_BLENDFACTOR_ONE, - PIPE_BLENDFACTOR_INV_SRC_ALPHA, PIPE_BLENDFACTOR_ONE }, - + 1, 1, PIPE_BLENDFACTOR_INV_DST_ALPHA, PIPE_BLENDFACTOR_INV_SRC_ALPHA}, { PictOpAdd, - PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_ONE, - PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_ONE }, + 0, 0, PIPE_BLENDFACTOR_ONE, PIPE_BLENDFACTOR_ONE}, }; @@ -95,38 +70,62 @@ pixel_to_float4(Pixel pixel, float *color) struct acceleration_info { int op : 16; - int with_mask : 1; - int component_alpha : 1; }; static const struct acceleration_info accelerated_ops[] = { - {PictOpClear, 1, 0}, - {PictOpSrc, 1, 0}, - {PictOpDst, 1, 0}, - {PictOpOver, 1, 0}, - {PictOpOverReverse, 1, 0}, - {PictOpIn, 1, 0}, - {PictOpInReverse, 1, 0}, - {PictOpOut, 1, 0}, - {PictOpOutReverse, 1, 0}, - {PictOpAtop, 1, 0}, - {PictOpAtopReverse, 1, 0}, - {PictOpXor, 1, 0}, - {PictOpAdd, 1, 0}, - {PictOpSaturate, 1, 0}, + {PictOpClear, }, + {PictOpSrc, }, + {PictOpDst, }, + {PictOpOver, }, + {PictOpOverReverse, }, + {PictOpIn, }, + {PictOpInReverse, }, + {PictOpOut, }, + {PictOpOutReverse, }, + {PictOpAtop, }, + {PictOpAtopReverse, }, + {PictOpXor, }, + {PictOpAdd, }, + {PictOpSaturate, }, }; static struct xorg_composite_blend -blend_for_op(int op) +blend_for_op(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, + PicturePtr pDstPicture) { const int num_blends = sizeof(xorg_blends)/sizeof(struct xorg_composite_blend); int i; + struct xorg_composite_blend blend = xorg_blends[BLEND_OP_OVER]; for (i = 0; i < num_blends; ++i) { if (xorg_blends[i].op == op) - return xorg_blends[i]; + blend = xorg_blends[i]; } - return xorg_blends[BLEND_OP_OVER]; + + /* If there's no dst alpha channel, adjust the blend op so that we'll treat + * it as always 1. + */ + if (pDstPicture && + PICT_FORMAT_A(pDstPicture->format) == 0 && blend.alpha_dst) { + if (blend.rgb_src == PIPE_BLENDFACTOR_DST_ALPHA) + blend.rgb_src = PIPE_BLENDFACTOR_ONE; + else if (blend.rgb_src == PIPE_BLENDFACTOR_INV_DST_ALPHA) + blend.rgb_src = PIPE_BLENDFACTOR_ZERO; + } + + /* If the source alpha is being used, then we should only be in a case where + * the source blend factor is 0, and the source blend value is the mask + * channels multiplied by the source picture's alpha. + */ + if (pMaskPicture && pMaskPicture->componentAlpha && + PICT_FORMAT_RGB(pMaskPicture->format) && blend.alpha_src) { + if (blend.rgb_dst == PIPE_BLENDFACTOR_SRC_ALPHA) { + blend.rgb_dst = PIPE_BLENDFACTOR_SRC_COLOR; + } else if (blend.rgb_dst == PIPE_BLENDFACTOR_INV_SRC_ALPHA) { + blend.rgb_dst = PIPE_BLENDFACTOR_INV_SRC_COLOR; + } + } + return blend; } static INLINE int @@ -203,41 +202,50 @@ boolean xorg_composite_accelerated(int op, if (pSrcPicture->pSourcePict) { if (pSrcPicture->pSourcePict->type != SourcePictTypeSolidFill) - XORG_FALLBACK("gradients not enabled (haven't been well tested)"); + XORG_FALLBACK("Gradients not enabled (haven't been well tested)"); } for (i = 0; i < accel_ops_count; ++i) { if (op == accelerated_ops[i].op) { + struct xorg_composite_blend blend = blend_for_op(op, + pSrcPicture, + pMaskPicture, + pDstPicture); /* Check for component alpha */ - if (pMaskPicture && - (pMaskPicture->componentAlpha || - (!accelerated_ops[i].with_mask))) - XORG_FALLBACK("component alpha unsupported (PictOpOver=%s(%d)", - (accelerated_ops[i].op == PictOpOver) ? "yes" : "no", - accelerated_ops[i].op); + if (pMaskPicture && pMaskPicture->componentAlpha && + PICT_FORMAT_RGB(pMaskPicture->format)) { + if (blend.alpha_src && + blend.rgb_src != PIPE_BLENDFACTOR_ZERO) { + XORG_FALLBACK("Component alpha not supported with source " + "alpha and source value blending. (op=%d)", + op); + } + } return TRUE; } } - XORG_FALLBACK("unsupported operation"); + XORG_FALLBACK("Unsupported composition operation = %d", op); } static void bind_blend_state(struct exa_context *exa, int op, - PicturePtr pSrcPicture, PicturePtr pMaskPicture) + PicturePtr pSrcPicture, + PicturePtr pMaskPicture, + PicturePtr pDstPicture) { struct xorg_composite_blend blend_opt; struct pipe_blend_state blend; - blend_opt = blend_for_op(op); + blend_opt = blend_for_op(op, pSrcPicture, pMaskPicture, pDstPicture); - memset(&blend, 0, sizeof(struct pipe_blend_state)); + memset(&blend, 0, sizeof(struct pipe_blend_state)); blend.blend_enable = 1; blend.colormask |= PIPE_MASK_RGBA; - blend.rgb_src_factor = blend_opt.rgb_src_factor; - blend.alpha_src_factor = blend_opt.alpha_src_factor; - blend.rgb_dst_factor = blend_opt.rgb_dst_factor; - blend.alpha_dst_factor = blend_opt.alpha_dst_factor; + blend.rgb_src_factor = blend_opt.rgb_src; + blend.alpha_src_factor = blend_opt.rgb_src; + blend.rgb_dst_factor = blend_opt.rgb_dst; + blend.alpha_dst_factor = blend_opt.rgb_dst; cso_set_blend(exa->renderer->cso, &blend); } @@ -273,6 +281,8 @@ bind_shaders(struct exa_context *exa, int op, if (pMaskPicture) { vs_traits |= VS_MASK; fs_traits |= FS_MASK; + if (pMaskPicture->componentAlpha) + fs_traits |= FS_COMPONENT_ALPHA; } shader = xorg_shaders_get(exa->renderer->shaders, vs_traits, fs_traits); @@ -428,7 +438,7 @@ boolean xorg_composite_bind_state(struct exa_context *exa, { renderer_bind_framebuffer(exa->renderer, pDst); renderer_bind_viewport(exa->renderer, pDst); - bind_blend_state(exa, op, pSrcPicture, pMaskPicture); + bind_blend_state(exa, op, pSrcPicture, pMaskPicture, pDstPicture); renderer_bind_rasterizer(exa->renderer); bind_shaders(exa, op, pSrcPicture, pMaskPicture); bind_samplers(exa, op, pSrcPicture, pMaskPicture, @@ -491,7 +501,7 @@ boolean xorg_solid_bind_state(struct exa_context *exa, renderer_bind_framebuffer(exa->renderer, pixmap); renderer_bind_viewport(exa->renderer, pixmap); renderer_bind_rasterizer(exa->renderer); - bind_blend_state(exa, PictOpSrc, NULL, NULL); + bind_blend_state(exa, PictOpSrc, NULL, NULL, NULL); setup_constant_buffers(exa, pixmap); shader = xorg_shaders_get(exa->renderer->shaders, vs_traits, fs_traits); diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 39c4d26ebe..b83d97bdb6 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -105,12 +105,21 @@ xorg_exa_common_done(struct exa_context *exa) static void ExaWaitMarker(ScreenPtr pScreen, int marker) { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + modesettingPtr ms = modesettingPTR(pScrn); + struct exa_context *exa = ms->exa; + +#if 0 + xorg_exa_flush(exa, PIPE_FLUSH_RENDER_CACHE, NULL); +#else + xorg_exa_finish(exa); +#endif } static int ExaMarkSync(ScreenPtr pScreen) { - return 1; + return 1; } static Bool @@ -258,11 +267,6 @@ ExaDone(PixmapPtr pPixmap) if (!priv) return; -#if 1 - xorg_exa_flush(exa, PIPE_FLUSH_RENDER_CACHE, NULL); -#else - xorg_exa_finish(exa); -#endif xorg_exa_common_done(exa); } @@ -442,7 +446,8 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, struct exa_pixmap_priv *priv; #if DEBUG_PRINT - debug_printf("ExaPrepareComposite\n"); + debug_printf("ExaPrepareComposite(%d, src=0x%p, mask=0x%p, dst=0x%p)\n", + op, pSrcPicture, pMaskPicture, pDstPicture); #endif if (!exa->pipe) XORG_FALLBACK("accle not enabled"); diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c index 8c9b674b4b..041f4f96dc 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c @@ -50,36 +50,20 @@ struct xorg_shaders { struct cso_hash *fs_hash; }; -static const char over_op[] = - "SUB TEMP[3], CONST[0].wwww, TEMP[1].wwww\n" - "MAD TEMP[3], TEMP[0], TEMP[3], TEMP[0]\n"; - - -static INLINE void -create_preamble(struct ureg_program *ureg) -{ -} - - static INLINE void src_in_mask(struct ureg_program *ureg, struct ureg_dst dst, struct ureg_src src, - struct ureg_src mask) + struct ureg_src mask, + boolean component_alpha) { -#if 0 - /* MUL dst, src, mask.a */ - ureg_MUL(ureg, dst, src, - ureg_scalar(mask, TGSI_SWIZZLE_W)); -#else - /* MOV dst, src */ - /* MUL dst.a, src.a, mask.a */ - ureg_MOV(ureg, dst, src); - ureg_MUL(ureg, - ureg_writemask(dst, TGSI_WRITEMASK_W), - ureg_scalar(src, TGSI_SWIZZLE_W), - ureg_scalar(mask, TGSI_SWIZZLE_W)); -#endif + if (component_alpha) { + ureg_MUL(ureg, dst, src, mask); + } + else { + ureg_MUL(ureg, dst, src, + ureg_scalar(mask, TGSI_SWIZZLE_W)); + } } static struct ureg_src @@ -305,6 +289,7 @@ create_fs(struct pipe_context *pipe, boolean is_solid = fs_traits & FS_SOLID_FILL; boolean is_lingrad = fs_traits & FS_LINGRAD_FILL; boolean is_radgrad = fs_traits & FS_RADGRAD_FILL; + boolean is_comp_alpha = fs_traits & FS_COMPONENT_ALPHA; ureg = ureg_create(TGSI_PROCESSOR_FRAGMENT); if (ureg == NULL) @@ -401,7 +386,7 @@ create_fs(struct pipe_context *pipe, ureg_TEX(ureg, mask, TGSI_TEXTURE_2D, mask_pos, mask_sampler); /* src IN mask */ - src_in_mask(ureg, out, ureg_src(src), ureg_src(mask)); + src_in_mask(ureg, out, ureg_src(src), ureg_src(mask), is_comp_alpha); ureg_release_temporary(ureg, mask); } diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h index 33c272070b..c290d44e8f 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h @@ -23,7 +23,8 @@ enum xorg_fs_traits { FS_RADGRAD_FILL = 1 << 4, FS_FILL = (FS_SOLID_FILL | FS_LINGRAD_FILL | - FS_RADGRAD_FILL) + FS_RADGRAD_FILL), + FS_COMPONENT_ALPHA = 1 << 5 }; struct xorg_shader { -- cgit v1.2.3 From 1f5b568fbeda9e48f0ea6473cf8193e9502bb21a Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Thu, 22 Oct 2009 12:13:02 -0400 Subject: st/xorg: cleanup the checks for whether the op is accelerated --- src/gallium/state_trackers/xorg/xorg_composite.c | 96 +++++++++--------------- 1 file changed, 36 insertions(+), 60 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 297b6c5f5d..e039bb12b6 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -68,64 +68,48 @@ pixel_to_float4(Pixel pixel, float *color) color[3] = ((float)a) / 255.; } -struct acceleration_info { - int op : 16; -}; -static const struct acceleration_info accelerated_ops[] = { - {PictOpClear, }, - {PictOpSrc, }, - {PictOpDst, }, - {PictOpOver, }, - {PictOpOverReverse, }, - {PictOpIn, }, - {PictOpInReverse, }, - {PictOpOut, }, - {PictOpOutReverse, }, - {PictOpAtop, }, - {PictOpAtopReverse, }, - {PictOpXor, }, - {PictOpAdd, }, - {PictOpSaturate, }, -}; - -static struct xorg_composite_blend -blend_for_op(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, +static boolean +blend_for_op(struct xorg_composite_blend *blend, + int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture) { const int num_blends = sizeof(xorg_blends)/sizeof(struct xorg_composite_blend); int i; - struct xorg_composite_blend blend = xorg_blends[BLEND_OP_OVER]; + boolean supported = FALSE; + + /* our default in case something goes wrong */ + *blend = xorg_blends[BLEND_OP_OVER]; for (i = 0; i < num_blends; ++i) { - if (xorg_blends[i].op == op) - blend = xorg_blends[i]; + if (xorg_blends[i].op == op) { + *blend = xorg_blends[i]; + supported = TRUE; + } } /* If there's no dst alpha channel, adjust the blend op so that we'll treat - * it as always 1. - */ + * it as always 1. */ if (pDstPicture && - PICT_FORMAT_A(pDstPicture->format) == 0 && blend.alpha_dst) { - if (blend.rgb_src == PIPE_BLENDFACTOR_DST_ALPHA) - blend.rgb_src = PIPE_BLENDFACTOR_ONE; - else if (blend.rgb_src == PIPE_BLENDFACTOR_INV_DST_ALPHA) - blend.rgb_src = PIPE_BLENDFACTOR_ZERO; + PICT_FORMAT_A(pDstPicture->format) == 0 && blend->alpha_dst) { + if (blend->rgb_src == PIPE_BLENDFACTOR_DST_ALPHA) + blend->rgb_src = PIPE_BLENDFACTOR_ONE; + else if (blend->rgb_src == PIPE_BLENDFACTOR_INV_DST_ALPHA) + blend->rgb_src = PIPE_BLENDFACTOR_ZERO; } /* If the source alpha is being used, then we should only be in a case where * the source blend factor is 0, and the source blend value is the mask - * channels multiplied by the source picture's alpha. - */ + * channels multiplied by the source picture's alpha. */ if (pMaskPicture && pMaskPicture->componentAlpha && - PICT_FORMAT_RGB(pMaskPicture->format) && blend.alpha_src) { - if (blend.rgb_dst == PIPE_BLENDFACTOR_SRC_ALPHA) { - blend.rgb_dst = PIPE_BLENDFACTOR_SRC_COLOR; - } else if (blend.rgb_dst == PIPE_BLENDFACTOR_INV_SRC_ALPHA) { - blend.rgb_dst = PIPE_BLENDFACTOR_INV_SRC_COLOR; + PICT_FORMAT_RGB(pMaskPicture->format) && blend->alpha_src) { + if (blend->rgb_dst == PIPE_BLENDFACTOR_SRC_ALPHA) { + blend->rgb_dst = PIPE_BLENDFACTOR_SRC_COLOR; + } else if (blend->rgb_dst == PIPE_BLENDFACTOR_INV_SRC_ALPHA) { + blend->rgb_dst = PIPE_BLENDFACTOR_INV_SRC_COLOR; } } - return blend; + return supported; } static INLINE int @@ -191,9 +175,7 @@ boolean xorg_composite_accelerated(int op, ScreenPtr pScreen = pDstPicture->pDrawable->pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; modesettingPtr ms = modesettingPTR(pScrn); - unsigned i; - unsigned accel_ops_count = - sizeof(accelerated_ops)/sizeof(struct acceleration_info); + struct xorg_composite_blend blend; if (!is_filter_accelerated(pSrcPicture) || !is_filter_accelerated(pMaskPicture)) { @@ -205,24 +187,18 @@ boolean xorg_composite_accelerated(int op, XORG_FALLBACK("Gradients not enabled (haven't been well tested)"); } - for (i = 0; i < accel_ops_count; ++i) { - if (op == accelerated_ops[i].op) { - struct xorg_composite_blend blend = blend_for_op(op, - pSrcPicture, - pMaskPicture, - pDstPicture); - /* Check for component alpha */ - if (pMaskPicture && pMaskPicture->componentAlpha && - PICT_FORMAT_RGB(pMaskPicture->format)) { - if (blend.alpha_src && - blend.rgb_src != PIPE_BLENDFACTOR_ZERO) { - XORG_FALLBACK("Component alpha not supported with source " - "alpha and source value blending. (op=%d)", - op); - } + if (blend_for_op(&blend, op, + pSrcPicture, pMaskPicture, pDstPicture)) { + /* Check for component alpha */ + if (pMaskPicture && pMaskPicture->componentAlpha && + PICT_FORMAT_RGB(pMaskPicture->format)) { + if (blend.alpha_src && blend.rgb_src != PIPE_BLENDFACTOR_ZERO) { + XORG_FALLBACK("Component alpha not supported with source " + "alpha and source value blending. (op=%d)", + op); } - return TRUE; } + return TRUE; } XORG_FALLBACK("Unsupported composition operation = %d", op); } @@ -236,7 +212,7 @@ bind_blend_state(struct exa_context *exa, int op, struct xorg_composite_blend blend_opt; struct pipe_blend_state blend; - blend_opt = blend_for_op(op, pSrcPicture, pMaskPicture, pDstPicture); + blend_for_op(&blend_opt, op, pSrcPicture, pMaskPicture, pDstPicture); memset(&blend, 0, sizeof(struct pipe_blend_state)); blend.blend_enable = 1; -- cgit v1.2.3 From 4797ce0d194720369b46d51733536d02b4a14473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 22 Oct 2009 18:09:37 +0100 Subject: util: Set cpu endianness too. --- src/gallium/auxiliary/util/u_cpu_detect.c | 2 ++ src/gallium/auxiliary/util/u_cpu_detect.h | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c index 7330d5dbd0..c93e0db23c 100644 --- a/src/gallium/auxiliary/util/u_cpu_detect.c +++ b/src/gallium/auxiliary/util/u_cpu_detect.c @@ -394,8 +394,10 @@ util_cpu_detect(void) util_cpu_caps.arch = UTIL_CPU_ARCH_SPARC; #elif defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) util_cpu_caps.arch = UTIL_CPU_ARCH_X86; + util_cpu_caps.little_endian = 1; #elif defined(PIPE_ARCH_PPC) util_cpu_caps.arch = UTIL_CPU_ARCH_POWERPC; + util_cpu_caps.little_endian = 0; #else util_cpu_caps.arch = UTIL_CPU_ARCH_UNKNOWN; #endif diff --git a/src/gallium/auxiliary/util/u_cpu_detect.h b/src/gallium/auxiliary/util/u_cpu_detect.h index 7ea0121c07..4b3dc39c34 100644 --- a/src/gallium/auxiliary/util/u_cpu_detect.h +++ b/src/gallium/auxiliary/util/u_cpu_detect.h @@ -54,6 +54,8 @@ struct util_cpu_caps { int x86_cpu_type; unsigned cacheline; + unsigned little_endian:1; + unsigned has_tsc:1; unsigned has_mmx:1; unsigned has_mmx2:1; -- cgit v1.2.3 From a07437f8a6a863654487c5586cbd02bfc20f0a3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 22 Oct 2009 18:10:19 +0100 Subject: llvmpipe: Call util_cpu_detect() from the unit tests. --- src/gallium/drivers/llvmpipe/lp_test_format.c | 3 +++ src/gallium/drivers/llvmpipe/lp_test_main.c | 4 ++++ 2 files changed, 7 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c index ab80c0143f..5dc8297fe9 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_format.c +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c @@ -35,6 +35,7 @@ #include #include +#include "util/u_cpu_detect.h" #include "util/u_format.h" #include "lp_bld_format.h" @@ -263,6 +264,8 @@ int main(int argc, char **argv) LLVMInitializeNativeTarget(); #endif + util_cpu_detect(); + for (i = 0; i < sizeof(test_cases)/sizeof(test_cases[0]); ++i) if(!test_format(&test_cases[i])) ret = 1; diff --git a/src/gallium/drivers/llvmpipe/lp_test_main.c b/src/gallium/drivers/llvmpipe/lp_test_main.c index f07fa256f1..d4767ff52b 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_main.c +++ b/src/gallium/drivers/llvmpipe/lp_test_main.c @@ -34,6 +34,8 @@ */ +#include "util/u_cpu_detect.h" + #include "lp_bld_const.h" #include "lp_test.h" @@ -370,6 +372,8 @@ int main(int argc, char **argv) LLVMInitializeNativeTarget(); #endif + util_cpu_detect(); + if(fp) { /* Warm up the caches */ test_some(0, NULL, 100); -- cgit v1.2.3 From 421507de06bd42a322c5864d887e67e385eb458c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 22 Oct 2009 18:28:17 +0100 Subject: llvmpipe: Factor vector packing/unpacking to a separate source file. These functions will be needed to implement many of the 8bit operations, and they are quite complex on its own. --- src/gallium/drivers/llvmpipe/Makefile | 1 + src/gallium/drivers/llvmpipe/SConscript | 1 + src/gallium/drivers/llvmpipe/lp_bld_conv.c | 240 +---------------- src/gallium/drivers/llvmpipe/lp_bld_pack.c | 419 +++++++++++++++++++++++++++++ src/gallium/drivers/llvmpipe/lp_bld_pack.h | 95 +++++++ 5 files changed, 519 insertions(+), 237 deletions(-) create mode 100644 src/gallium/drivers/llvmpipe/lp_bld_pack.c create mode 100644 src/gallium/drivers/llvmpipe/lp_bld_pack.h (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/Makefile b/src/gallium/drivers/llvmpipe/Makefile index 21aff1967a..b96ee23a99 100644 --- a/src/gallium/drivers/llvmpipe/Makefile +++ b/src/gallium/drivers/llvmpipe/Makefile @@ -21,6 +21,7 @@ C_SOURCES = \ lp_bld_interp.c \ lp_bld_intr.c \ lp_bld_logic.c \ + lp_bld_pack.c \ lp_bld_sample_soa.c \ lp_bld_swizzle.c \ lp_bld_struct.c \ diff --git a/src/gallium/drivers/llvmpipe/SConscript b/src/gallium/drivers/llvmpipe/SConscript index 13cd465838..403e4daa43 100644 --- a/src/gallium/drivers/llvmpipe/SConscript +++ b/src/gallium/drivers/llvmpipe/SConscript @@ -33,6 +33,7 @@ llvmpipe = env.ConvenienceLibrary( 'lp_bld_format_soa.c', 'lp_bld_interp.c', 'lp_bld_intr.c', + 'lp_bld_pack.c', 'lp_bld_sample_soa.c', 'lp_bld_struct.c', 'lp_bld_logic.c', diff --git a/src/gallium/drivers/llvmpipe/lp_bld_conv.c b/src/gallium/drivers/llvmpipe/lp_bld_conv.c index 20c8710214..9935209437 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_conv.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_conv.c @@ -69,6 +69,7 @@ #include "lp_bld_const.h" #include "lp_bld_intr.h" #include "lp_bld_arit.h" +#include "lp_bld_pack.h" #include "lp_bld_conv.h" @@ -198,241 +199,6 @@ lp_build_unsigned_norm_to_float(LLVMBuilderRef builder, } -/** - * Build shuffle vectors that match PUNPCKLxx and PUNPCKHxx instructions. - */ -static LLVMValueRef -lp_build_const_unpack_shuffle(unsigned n, unsigned lo_hi) -{ - LLVMValueRef elems[LP_MAX_VECTOR_LENGTH]; - unsigned i, j; - - assert(n <= LP_MAX_VECTOR_LENGTH); - assert(lo_hi < 2); - - /* TODO: cache results in a static table */ - - for(i = 0, j = lo_hi*n/2; i < n; i += 2, ++j) { - elems[i + 0] = LLVMConstInt(LLVMInt32Type(), 0 + j, 0); - elems[i + 1] = LLVMConstInt(LLVMInt32Type(), n + j, 0); - } - - return LLVMConstVector(elems, n); -} - - -/** - * Build shuffle vectors that match PACKxx instructions. - */ -static LLVMValueRef -lp_build_const_pack_shuffle(unsigned n) -{ - LLVMValueRef elems[LP_MAX_VECTOR_LENGTH]; - unsigned i; - - assert(n <= LP_MAX_VECTOR_LENGTH); - - /* TODO: cache results in a static table */ - - for(i = 0; i < n; ++i) - elems[i] = LLVMConstInt(LLVMInt32Type(), 2*i, 0); - - return LLVMConstVector(elems, n); -} - - -/** - * Expand the bit width. - * - * This will only change the number of bits the values are represented, not the - * values themselves. - */ -static void -lp_build_expand(LLVMBuilderRef builder, - struct lp_type src_type, - struct lp_type dst_type, - LLVMValueRef src, - LLVMValueRef *dst, unsigned num_dsts) -{ - unsigned num_tmps; - unsigned i; - - /* Register width must remain constant */ - assert(src_type.width * src_type.length == dst_type.width * dst_type.length); - - /* We must not loose or gain channels. Only precision */ - assert(src_type.length == dst_type.length * num_dsts); - - num_tmps = 1; - dst[0] = src; - - while(src_type.width < dst_type.width) { - struct lp_type new_type = src_type; - LLVMTypeRef new_vec_type; - - new_type.width *= 2; - new_type.length /= 2; - new_vec_type = lp_build_vec_type(new_type); - - for(i = num_tmps; i--; ) { - LLVMValueRef zero; - LLVMValueRef shuffle_lo; - LLVMValueRef shuffle_hi; - LLVMValueRef lo; - LLVMValueRef hi; - - zero = lp_build_zero(src_type); - shuffle_lo = lp_build_const_unpack_shuffle(src_type.length, 0); - shuffle_hi = lp_build_const_unpack_shuffle(src_type.length, 1); - - /* PUNPCKLBW, PUNPCKHBW */ - lo = LLVMBuildShuffleVector(builder, dst[i], zero, shuffle_lo, ""); - hi = LLVMBuildShuffleVector(builder, dst[i], zero, shuffle_hi, ""); - - dst[2*i + 0] = LLVMBuildBitCast(builder, lo, new_vec_type, ""); - dst[2*i + 1] = LLVMBuildBitCast(builder, hi, new_vec_type, ""); - } - - src_type = new_type; - - num_tmps *= 2; - } - - assert(num_tmps == num_dsts); -} - - -/** - * Non-interleaved pack. - * - * This will move values as - * - * lo = __ l0 __ l1 __ l2 __.. __ ln - * hi = __ h0 __ h1 __ h2 __.. __ hn - * res = l0 l1 l2 .. ln h0 h1 h2 .. hn - * - * TODO: handle saturation consistently. - */ -static LLVMValueRef -lp_build_pack2(LLVMBuilderRef builder, - struct lp_type src_type, - struct lp_type dst_type, - boolean clamped, - LLVMValueRef lo, - LLVMValueRef hi) -{ - LLVMTypeRef src_vec_type = lp_build_vec_type(src_type); - LLVMTypeRef dst_vec_type = lp_build_vec_type(dst_type); - LLVMValueRef shuffle; - LLVMValueRef res; - - /* Register width must remain constant */ - assert(src_type.width * src_type.length == dst_type.width * dst_type.length); - - /* We must not loose or gain channels. Only precision */ - assert(src_type.length * 2 == dst_type.length); - - assert(!src_type.floating); - assert(!dst_type.floating); - - if(util_cpu_caps.has_sse2 && src_type.width * src_type.length == 128) { - /* All X86 non-interleaved pack instructions all take signed inputs and - * saturate them, so saturate beforehand. */ - if(!src_type.sign && !clamped) { - struct lp_build_context bld; - unsigned dst_bits = dst_type.sign ? dst_type.width - 1 : dst_type.width; - LLVMValueRef dst_max = lp_build_int_const_scalar(src_type, ((unsigned long long)1 << dst_bits) - 1); - lp_build_context_init(&bld, builder, src_type); - lo = lp_build_min(&bld, lo, dst_max); - hi = lp_build_min(&bld, hi, dst_max); - } - - switch(src_type.width) { - case 32: - if(dst_type.sign || !util_cpu_caps.has_sse4_1) - res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packssdw.128", src_vec_type, lo, hi); - else - /* PACKUSDW is the only instrinsic with a consistent signature */ - return lp_build_intrinsic_binary(builder, "llvm.x86.sse41.packusdw", dst_vec_type, lo, hi); - break; - - case 16: - if(dst_type.sign) - res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packsswb.128", src_vec_type, lo, hi); - else - res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packuswb.128", src_vec_type, lo, hi); - break; - - default: - assert(0); - return LLVMGetUndef(dst_vec_type); - break; - } - - res = LLVMBuildBitCast(builder, res, dst_vec_type, ""); - return res; - } - - lo = LLVMBuildBitCast(builder, lo, dst_vec_type, ""); - hi = LLVMBuildBitCast(builder, hi, dst_vec_type, ""); - - shuffle = lp_build_const_pack_shuffle(dst_type.length); - - res = LLVMBuildShuffleVector(builder, lo, hi, shuffle, ""); - - return res; -} - - -/** - * Truncate the bit width. - * - * TODO: Handle saturation consistently. - */ -static LLVMValueRef -lp_build_pack(LLVMBuilderRef builder, - struct lp_type src_type, - struct lp_type dst_type, - boolean clamped, - const LLVMValueRef *src, unsigned num_srcs) -{ - LLVMValueRef tmp[LP_MAX_VECTOR_LENGTH]; - unsigned i; - - /* Register width must remain constant */ - assert(src_type.width * src_type.length == dst_type.width * dst_type.length); - - /* We must not loose or gain channels. Only precision */ - assert(src_type.length * num_srcs == dst_type.length); - - for(i = 0; i < num_srcs; ++i) - tmp[i] = src[i]; - - while(src_type.width > dst_type.width) { - struct lp_type new_type = src_type; - - new_type.width /= 2; - new_type.length *= 2; - - /* Take in consideration the sign changes only in the last step */ - if(new_type.width == dst_type.width) - new_type.sign = dst_type.sign; - - num_srcs /= 2; - - for(i = 0; i < num_srcs; ++i) - tmp[i] = lp_build_pack2(builder, src_type, new_type, clamped, - tmp[2*i + 0], tmp[2*i + 1]); - - src_type = new_type; - } - - assert(num_srcs == 1); - - return tmp[0]; -} - - /** * Generic type conversion. * @@ -572,7 +338,7 @@ lp_build_conv(LLVMBuilderRef builder, if(tmp_type.width < dst_type.width) { assert(num_tmps == 1); - lp_build_expand(builder, tmp_type, dst_type, tmp[0], tmp, num_dsts); + lp_build_unpack(builder, tmp_type, dst_type, tmp[0], tmp, num_dsts); tmp_type.width = dst_type.width; tmp_type.length = dst_type.length; num_tmps = num_dsts; @@ -692,7 +458,7 @@ lp_build_conv_mask(LLVMBuilderRef builder, } else if(src_type.width < dst_type.width) { assert(num_srcs == 1); - lp_build_expand(builder, src_type, dst_type, src[0], dst, num_dsts); + lp_build_unpack(builder, src_type, dst_type, src[0], dst, num_dsts); } else { assert(num_srcs == num_dsts); diff --git a/src/gallium/drivers/llvmpipe/lp_bld_pack.c b/src/gallium/drivers/llvmpipe/lp_bld_pack.c new file mode 100644 index 0000000000..fe82fda039 --- /dev/null +++ b/src/gallium/drivers/llvmpipe/lp_bld_pack.c @@ -0,0 +1,419 @@ +/************************************************************************** + * + * 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 + * Helper functions for packing/unpacking. + * + * Pack/unpacking is necessary for conversion between types of different + * bit width. + * + * They are also commonly used when an computation needs higher + * precision for the intermediate values. For example, if one needs the + * function: + * + * c = compute(a, b); + * + * to use more precision for intermediate results then one should implement it + * as: + * + * LLVMValueRef + * compute(LLVMBuilderRef builder struct lp_type type, LLVMValueRef a, LLVMValueRef b) + * { + * struct lp_type wide_type = lp_wider_type(type); + * LLVMValueRef al, ah, bl, bh, cl, ch, c; + * + * lp_build_unpack2(builder, type, wide_type, a, &al, &ah); + * lp_build_unpack2(builder, type, wide_type, b, &bl, &bh); + * + * cl = compute_half(al, bl); + * ch = compute_half(ah, bh); + * + * c = lp_build_pack2(bld->builder, wide_type, type, cl, ch); + * + * return c; + * } + * + * where compute_half() would do the computation for half the elements with + * twice the precision. + * + * @author Jose Fonseca + */ + + +#include "util/u_debug.h" +#include "util/u_math.h" +#include "util/u_cpu_detect.h" + +#include "lp_bld_type.h" +#include "lp_bld_const.h" +#include "lp_bld_intr.h" +#include "lp_bld_arit.h" +#include "lp_bld_pack.h" + + +/** + * Build shuffle vectors that match PUNPCKLxx and PUNPCKHxx instructions. + */ +static LLVMValueRef +lp_build_const_unpack_shuffle(unsigned n, unsigned lo_hi) +{ + LLVMValueRef elems[LP_MAX_VECTOR_LENGTH]; + unsigned i, j; + + assert(n <= LP_MAX_VECTOR_LENGTH); + assert(lo_hi < 2); + + /* TODO: cache results in a static table */ + + for(i = 0, j = lo_hi*n/2; i < n; i += 2, ++j) { + elems[i + 0] = LLVMConstInt(LLVMInt32Type(), 0 + j, 0); + elems[i + 1] = LLVMConstInt(LLVMInt32Type(), n + j, 0); + } + + return LLVMConstVector(elems, n); +} + + +/** + * Build shuffle vectors that match PACKxx instructions. + */ +static LLVMValueRef +lp_build_const_pack_shuffle(unsigned n) +{ + LLVMValueRef elems[LP_MAX_VECTOR_LENGTH]; + unsigned i; + + assert(n <= LP_MAX_VECTOR_LENGTH); + + /* TODO: cache results in a static table */ + + for(i = 0; i < n; ++i) + elems[i] = LLVMConstInt(LLVMInt32Type(), 2*i, 0); + + return LLVMConstVector(elems, n); +} + + +/** + * Interleave vector elements. + * + * Matches the PUNPCKLxx and PUNPCKHxx SSE instructions. + */ +LLVMValueRef +lp_build_interleave2(LLVMBuilderRef builder, + struct lp_type type, + LLVMValueRef a, + LLVMValueRef b, + unsigned lo_hi) +{ + LLVMValueRef shuffle; + + shuffle = lp_build_const_unpack_shuffle(type.length, lo_hi); + + return LLVMBuildShuffleVector(builder, a, b, shuffle, ""); +} + + +/** + * Double the bit width. + * + * This will only change the number of bits the values are represented, not the + * values themselves. + */ +void +lp_build_unpack2(LLVMBuilderRef builder, + struct lp_type src_type, + struct lp_type dst_type, + LLVMValueRef src, + LLVMValueRef *dst_lo, + LLVMValueRef *dst_hi) +{ + LLVMValueRef msb; + LLVMTypeRef dst_vec_type; + + assert(!src_type.floating); + assert(!dst_type.floating); + assert(dst_type.sign == src_type.sign); + assert(dst_type.width == src_type.width * 2); + assert(dst_type.length * 2 == src_type.length); + + if(src_type.sign) { + /* Replicate the sign bit in the most significant bits */ + msb = LLVMBuildAShr(builder, src, lp_build_int_const_scalar(src_type, src_type.width - 1), ""); + } + else + /* Most significant bits always zero */ + msb = lp_build_zero(src_type); + + /* Interleave bits */ + if(util_cpu_caps.little_endian) { + *dst_lo = lp_build_interleave2(builder, src_type, src, msb, 0); + *dst_hi = lp_build_interleave2(builder, src_type, src, msb, 1); + } + else { + *dst_lo = lp_build_interleave2(builder, src_type, msb, src, 0); + *dst_hi = lp_build_interleave2(builder, src_type, msb, src, 1); + } + + /* Cast the result into the new type (twice as wide) */ + + dst_vec_type = lp_build_vec_type(dst_type); + + *dst_lo = LLVMBuildBitCast(builder, *dst_lo, dst_vec_type, ""); + *dst_hi = LLVMBuildBitCast(builder, *dst_hi, dst_vec_type, ""); +} + + +/** + * Expand the bit width. + * + * This will only change the number of bits the values are represented, not the + * values themselves. + */ +void +lp_build_unpack(LLVMBuilderRef builder, + struct lp_type src_type, + struct lp_type dst_type, + LLVMValueRef src, + LLVMValueRef *dst, unsigned num_dsts) +{ + unsigned num_tmps; + unsigned i; + + /* Register width must remain constant */ + assert(src_type.width * src_type.length == dst_type.width * dst_type.length); + + /* We must not loose or gain channels. Only precision */ + assert(src_type.length == dst_type.length * num_dsts); + + num_tmps = 1; + dst[0] = src; + + while(src_type.width < dst_type.width) { + struct lp_type tmp_type = src_type; + + tmp_type.width *= 2; + tmp_type.length /= 2; + + for(i = num_tmps; i--; ) { + lp_build_unpack2(builder, src_type, tmp_type, dst[i], &dst[2*i + 0], &dst[2*i + 1]); + } + + src_type = tmp_type; + + num_tmps *= 2; + } + + assert(num_tmps == num_dsts); +} + + +/** + * Non-interleaved pack. + * + * This will move values as + * + * lo = __ l0 __ l1 __ l2 __.. __ ln + * hi = __ h0 __ h1 __ h2 __.. __ hn + * res = l0 l1 l2 .. ln h0 h1 h2 .. hn + * + * This will only change the number of bits the values are represented, not the + * values themselves. + * + * It is assumed the values are already clamped into the destination type range. + * Values outside that range will produce undefined results. Use + * lp_build_packs2 instead. + */ +LLVMValueRef +lp_build_pack2(LLVMBuilderRef builder, + struct lp_type src_type, + struct lp_type dst_type, + LLVMValueRef lo, + LLVMValueRef hi) +{ + LLVMTypeRef src_vec_type = lp_build_vec_type(src_type); + LLVMTypeRef dst_vec_type = lp_build_vec_type(dst_type); + LLVMValueRef shuffle; + LLVMValueRef res; + + dst_vec_type = lp_build_vec_type(dst_type); + + assert(!src_type.floating); + assert(!dst_type.floating); + assert(src_type.width == dst_type.width * 2); + assert(src_type.length * 2 == dst_type.length); + + if(util_cpu_caps.has_sse2 && src_type.width * src_type.length == 128) { + switch(src_type.width) { + case 32: + if(dst_type.sign) { + res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packssdw.128", src_vec_type, lo, hi); + } + else { + if (util_cpu_caps.has_sse4_1) { + /* PACKUSDW is the only instrinsic with a consistent signature */ + return lp_build_intrinsic_binary(builder, "llvm.x86.sse41.packusdw", dst_vec_type, lo, hi); + } + else { + assert(0); + return LLVMGetUndef(dst_vec_type); + } + } + break; + + case 16: + if(dst_type.sign) + res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packsswb.128", src_vec_type, lo, hi); + else + res = lp_build_intrinsic_binary(builder, "llvm.x86.sse2.packuswb.128", src_vec_type, lo, hi); + break; + + default: + assert(0); + return LLVMGetUndef(dst_vec_type); + break; + } + + res = LLVMBuildBitCast(builder, res, dst_vec_type, ""); + return res; + } + + lo = LLVMBuildBitCast(builder, lo, dst_vec_type, ""); + hi = LLVMBuildBitCast(builder, hi, dst_vec_type, ""); + + shuffle = lp_build_const_pack_shuffle(dst_type.length); + + res = LLVMBuildShuffleVector(builder, lo, hi, shuffle, ""); + + return res; +} + + + +/** + * Non-interleaved pack and saturate. + * + * Same as lp_build_pack2 but will saturate values so that they fit into the + * destination type. + */ +LLVMValueRef +lp_build_packs2(LLVMBuilderRef builder, + struct lp_type src_type, + struct lp_type dst_type, + LLVMValueRef lo, + LLVMValueRef hi) +{ + boolean clamp; + + assert(!src_type.floating); + assert(!dst_type.floating); + assert(src_type.sign == dst_type.sign); + assert(src_type.width == dst_type.width * 2); + assert(src_type.length * 2 == dst_type.length); + + clamp = TRUE; + + /* All X86 SSE non-interleaved pack instructions take signed inputs and + * saturate them, so no need to clamp for those cases. */ + if(util_cpu_caps.has_sse2 && + src_type.width * src_type.length == 128 && + src_type.sign) + clamp = FALSE; + + if(clamp) { + struct lp_build_context bld; + unsigned dst_bits = dst_type.sign ? dst_type.width - 1 : dst_type.width; + LLVMValueRef dst_max = lp_build_int_const_scalar(src_type, ((unsigned long long)1 << dst_bits) - 1); + lp_build_context_init(&bld, builder, src_type); + lo = lp_build_min(&bld, lo, dst_max); + hi = lp_build_min(&bld, hi, dst_max); + /* FIXME: What about lower bound? */ + } + + return lp_build_pack2(builder, src_type, dst_type, lo, hi); +} + + +/** + * Truncate the bit width. + * + * TODO: Handle saturation consistently. + */ +LLVMValueRef +lp_build_pack(LLVMBuilderRef builder, + struct lp_type src_type, + struct lp_type dst_type, + boolean clamped, + const LLVMValueRef *src, unsigned num_srcs) +{ + LLVMValueRef (*pack2)(LLVMBuilderRef builder, + struct lp_type src_type, + struct lp_type dst_type, + LLVMValueRef lo, + LLVMValueRef hi); + LLVMValueRef tmp[LP_MAX_VECTOR_LENGTH]; + unsigned i; + + + /* Register width must remain constant */ + assert(src_type.width * src_type.length == dst_type.width * dst_type.length); + + /* We must not loose or gain channels. Only precision */ + assert(src_type.length * num_srcs == dst_type.length); + + if(clamped) + pack2 = &lp_build_pack2; + else + pack2 = &lp_build_packs2; + + for(i = 0; i < num_srcs; ++i) + tmp[i] = src[i]; + + while(src_type.width > dst_type.width) { + struct lp_type tmp_type = src_type; + + tmp_type.width /= 2; + tmp_type.length *= 2; + + /* Take in consideration the sign changes only in the last step */ + if(tmp_type.width == dst_type.width) + tmp_type.sign = dst_type.sign; + + num_srcs /= 2; + + for(i = 0; i < num_srcs; ++i) + tmp[i] = pack2(builder, src_type, tmp_type, tmp[2*i + 0], tmp[2*i + 1]); + + src_type = tmp_type; + } + + assert(num_srcs == 1); + + return tmp[0]; +} diff --git a/src/gallium/drivers/llvmpipe/lp_bld_pack.h b/src/gallium/drivers/llvmpipe/lp_bld_pack.h new file mode 100644 index 0000000000..fb2a34984a --- /dev/null +++ b/src/gallium/drivers/llvmpipe/lp_bld_pack.h @@ -0,0 +1,95 @@ +/************************************************************************** + * + * 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 + * Helper functions for packing/unpacking conversions. + * + * @author Jose Fonseca + */ + + +#ifndef LP_BLD_PACK_H +#define LP_BLD_PACK_H + + +#include + + +struct lp_type; + + +LLVMValueRef +lp_build_interleave2(LLVMBuilderRef builder, + struct lp_type type, + LLVMValueRef a, + LLVMValueRef b, + unsigned lo_hi); + + +void +lp_build_unpack2(LLVMBuilderRef builder, + struct lp_type src_type, + struct lp_type dst_type, + LLVMValueRef src, + LLVMValueRef *dst_lo, + LLVMValueRef *dst_hi); + + +void +lp_build_unpack(LLVMBuilderRef builder, + struct lp_type src_type, + struct lp_type dst_type, + LLVMValueRef src, + LLVMValueRef *dst, unsigned num_dsts); + + +LLVMValueRef +lp_build_packs2(LLVMBuilderRef builder, + struct lp_type src_type, + struct lp_type dst_type, + LLVMValueRef lo, + LLVMValueRef hi); + + +LLVMValueRef +lp_build_pack2(LLVMBuilderRef builder, + struct lp_type src_type, + struct lp_type dst_type, + LLVMValueRef lo, + LLVMValueRef hi); + + +LLVMValueRef +lp_build_pack(LLVMBuilderRef builder, + struct lp_type src_type, + struct lp_type dst_type, + boolean clamped, + const LLVMValueRef *src, unsigned num_srcs); + + +#endif /* !LP_BLD_PACK_H */ -- cgit v1.2.3 From 4458695bdafb13eba639d986e2f20953f0f7445c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 22 Oct 2009 18:28:37 +0100 Subject: llvmpipe: Utility function to double the bit width of a type. --- src/gallium/drivers/llvmpipe/lp_bld_type.c | 29 ++++++++++++++++++++++++----- src/gallium/drivers/llvmpipe/lp_bld_type.h | 4 ++++ 2 files changed, 28 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_type.c b/src/gallium/drivers/llvmpipe/lp_bld_type.c index 606243d6c5..1320a26721 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_type.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_type.c @@ -160,12 +160,31 @@ lp_build_int_vec_type(struct lp_type type) struct lp_type lp_int_type(struct lp_type type) { - struct lp_type int_type; + struct lp_type res_type; - memset(&int_type, 0, sizeof int_type); - int_type.width = type.width; - int_type.length = type.length; - return int_type; + memset(&res_type, 0, sizeof res_type); + res_type.width = type.width; + res_type.length = type.length; + + return res_type; +} + + +/** + * Return the type with twice the bit width (hence half the number of elements). + */ +struct lp_type +lp_wider_type(struct lp_type type) +{ + struct lp_type res_type; + + memcpy(&res_type, &type, sizeof res_type); + res_type.width *= 2; + res_type.length /= 2; + + assert(res_type.length); + + return res_type; } diff --git a/src/gallium/drivers/llvmpipe/lp_bld_type.h b/src/gallium/drivers/llvmpipe/lp_bld_type.h index ee5ca3483c..46c298fa20 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_type.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_type.h @@ -166,6 +166,10 @@ struct lp_type lp_int_type(struct lp_type type); +struct lp_type +lp_wider_type(struct lp_type type); + + void lp_build_context_init(struct lp_build_context *bld, LLVMBuilderRef builder, -- cgit v1.2.3 From 01b85e292352d710586344348fff5a81459e5486 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 22 Oct 2009 18:28:57 +0100 Subject: llvmpipe: Use the pack/unpack functions for 8bit unsigned norm multiplication. --- src/gallium/drivers/llvmpipe/lp_bld_arit.c | 96 ++++++------------------------ 1 file changed, 17 insertions(+), 79 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.c b/src/gallium/drivers/llvmpipe/lp_bld_arit.c index d27ef0de04..83ca06acf8 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_arit.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.c @@ -54,6 +54,7 @@ #include "lp_bld_const.h" #include "lp_bld_intr.h" #include "lp_bld_logic.h" +#include "lp_bld_pack.h" #include "lp_bld_debug.h" #include "lp_bld_arit.h" @@ -279,45 +280,6 @@ lp_build_sub(struct lp_build_context *bld, } -/** - * Build shuffle vectors that match PUNPCKLxx and PUNPCKHxx instructions. - */ -static LLVMValueRef -lp_build_unpack_shuffle(unsigned n, unsigned lo_hi) -{ - LLVMValueRef elems[LP_MAX_VECTOR_LENGTH]; - unsigned i, j; - - assert(n <= LP_MAX_VECTOR_LENGTH); - assert(lo_hi < 2); - - for(i = 0, j = lo_hi*n/2; i < n; i += 2, ++j) { - elems[i + 0] = LLVMConstInt(LLVMInt32Type(), 0 + j, 0); - elems[i + 1] = LLVMConstInt(LLVMInt32Type(), n + j, 0); - } - - return LLVMConstVector(elems, n); -} - - -/** - * Build constant int vector of width 'n' and value 'c'. - */ -static LLVMValueRef -lp_build_const_vec(LLVMTypeRef type, unsigned n, long long c) -{ - LLVMValueRef elems[LP_MAX_VECTOR_LENGTH]; - unsigned i; - - assert(n <= LP_MAX_VECTOR_LENGTH); - - for(i = 0; i < n; ++i) - elems[i] = LLVMConstInt(type, c, 0); - - return LLVMConstVector(elems, n); -} - - /** * Normalized 8bit multiplication. * @@ -361,33 +323,30 @@ lp_build_const_vec(LLVMTypeRef type, unsigned n, long long c) */ static LLVMValueRef lp_build_mul_u8n(LLVMBuilderRef builder, + struct lp_type i16_type, LLVMValueRef a, LLVMValueRef b) { - static LLVMValueRef c01 = NULL; - static LLVMValueRef c08 = NULL; - static LLVMValueRef c80 = NULL; + LLVMValueRef c8; LLVMValueRef ab; - if(!c01) c01 = lp_build_const_vec(LLVMInt16Type(), 8, 0x01); - if(!c08) c08 = lp_build_const_vec(LLVMInt16Type(), 8, 0x08); - if(!c80) c80 = lp_build_const_vec(LLVMInt16Type(), 8, 0x80); + c8 = lp_build_int_const_scalar(i16_type, 8); #if 0 /* a*b/255 ~= (a*(b + 1)) >> 256 */ - b = LLVMBuildAdd(builder, b, c01, ""); + b = LLVMBuildAdd(builder, b, lp_build_int_const_scalar(i16_type, 1), ""); ab = LLVMBuildMul(builder, a, b, ""); #else - /* t/255 ~= (t + (t >> 8) + 0x80) >> 8 */ + /* ab/255 ~= (ab + (ab >> 8) + 0x80) >> 8 */ ab = LLVMBuildMul(builder, a, b, ""); - ab = LLVMBuildAdd(builder, ab, LLVMBuildLShr(builder, ab, c08, ""), ""); - ab = LLVMBuildAdd(builder, ab, c80, ""); + ab = LLVMBuildAdd(builder, ab, LLVMBuildLShr(builder, ab, c8, ""), ""); + ab = LLVMBuildAdd(builder, ab, lp_build_int_const_scalar(i16_type, 0x80), ""); #endif - ab = LLVMBuildLShr(builder, ab, c08, ""); + ab = LLVMBuildLShr(builder, ab, c8, ""); return ab; } @@ -415,39 +374,18 @@ lp_build_mul(struct lp_build_context *bld, return bld->undef; if(!type.floating && !type.fixed && type.norm) { - if(util_cpu_caps.has_sse2 && type.width == 8 && type.length == 16) { - LLVMTypeRef i16x8 = LLVMVectorType(LLVMInt16Type(), 8); - LLVMTypeRef i8x16 = LLVMVectorType(LLVMInt8Type(), 16); - static LLVMValueRef ml = NULL; - static LLVMValueRef mh = NULL; - LLVMValueRef al, ah, bl, bh; - LLVMValueRef abl, abh; - LLVMValueRef ab; - - if(!ml) ml = lp_build_unpack_shuffle(16, 0); - if(!mh) mh = lp_build_unpack_shuffle(16, 1); + if(type.width == 8) { + struct lp_type i16_type = lp_wider_type(type); + LLVMValueRef al, ah, bl, bh, abl, abh, ab; - /* PUNPCKLBW, PUNPCKHBW */ - al = LLVMBuildShuffleVector(bld->builder, a, bld->zero, ml, ""); - bl = LLVMBuildShuffleVector(bld->builder, b, bld->zero, ml, ""); - ah = LLVMBuildShuffleVector(bld->builder, a, bld->zero, mh, ""); - bh = LLVMBuildShuffleVector(bld->builder, b, bld->zero, mh, ""); - - /* NOP */ - al = LLVMBuildBitCast(bld->builder, al, i16x8, ""); - bl = LLVMBuildBitCast(bld->builder, bl, i16x8, ""); - ah = LLVMBuildBitCast(bld->builder, ah, i16x8, ""); - bh = LLVMBuildBitCast(bld->builder, bh, i16x8, ""); + lp_build_unpack2(bld->builder, type, i16_type, a, &al, &ah); + lp_build_unpack2(bld->builder, type, i16_type, b, &bl, &bh); /* PMULLW, PSRLW, PADDW */ - abl = lp_build_mul_u8n(bld->builder, al, bl); - abh = lp_build_mul_u8n(bld->builder, ah, bh); - - /* PACKUSWB */ - ab = lp_build_intrinsic_binary(bld->builder, "llvm.x86.sse2.packuswb.128" , i16x8, abl, abh); + abl = lp_build_mul_u8n(bld->builder, i16_type, al, bl); + abh = lp_build_mul_u8n(bld->builder, i16_type, ah, bh); - /* NOP */ - ab = LLVMBuildBitCast(bld->builder, ab, i8x16, ""); + ab = lp_build_pack2(bld->builder, i16_type, type, abl, abh); return ab; } -- cgit v1.2.3 From 9aafa1fbd247cd6d1bb0ab47bc5b318bd0d67bc5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 22 Oct 2009 19:02:04 +0100 Subject: llvmpipe: Avoid variable size arrays. Not really variable size, but MSVC still doesn't like them. --- src/gallium/drivers/llvmpipe/lp_test.h | 3 +++ src/gallium/drivers/llvmpipe/lp_test_blend.c | 4 ++-- src/gallium/drivers/llvmpipe/lp_test_conv.c | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_test.h b/src/gallium/drivers/llvmpipe/lp_test.h index a88e110c66..21016fefe3 100644 --- a/src/gallium/drivers/llvmpipe/lp_test.h +++ b/src/gallium/drivers/llvmpipe/lp_test.h @@ -56,6 +56,9 @@ #include "lp_bld_type.h" +#define LP_TEST_NUM_SAMPLES 32 + + void write_tsv_header(FILE *fp); diff --git a/src/gallium/drivers/llvmpipe/lp_test_blend.c b/src/gallium/drivers/llvmpipe/lp_test_blend.c index 94b661dcba..e3af81cffb 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_blend.c +++ b/src/gallium/drivers/llvmpipe/lp_test_blend.c @@ -477,8 +477,8 @@ test_one(unsigned verbose, char *error = NULL; blend_test_ptr_t blend_test_ptr; boolean success; - const unsigned n = 32; - int64_t cycles[n]; + const unsigned n = LP_TEST_NUM_SAMPLES; + int64_t cycles[LP_TEST_NUM_SAMPLES]; double cycles_avg = 0.0; unsigned i, j; diff --git a/src/gallium/drivers/llvmpipe/lp_test_conv.c b/src/gallium/drivers/llvmpipe/lp_test_conv.c index 9dcf58e5dc..ac2a6d05e3 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_conv.c +++ b/src/gallium/drivers/llvmpipe/lp_test_conv.c @@ -156,8 +156,8 @@ test_one(unsigned verbose, char *error = NULL; conv_test_ptr_t conv_test_ptr; boolean success; - const unsigned n = 32; - int64_t cycles[n]; + const unsigned n = LP_TEST_NUM_SAMPLES; + int64_t cycles[LP_TEST_NUM_SAMPLES]; double cycles_avg = 0.0; unsigned num_srcs; unsigned num_dsts; -- cgit v1.2.3 From ba8c11923a13bdec53128988ffc26ceb5c4f7310 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 22 Oct 2009 19:02:42 +0100 Subject: llvmpipe: Define rdtsc for MSVC. --- src/gallium/drivers/llvmpipe/lp_test.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_test.h b/src/gallium/drivers/llvmpipe/lp_test.h index 21016fefe3..39d80726e6 100644 --- a/src/gallium/drivers/llvmpipe/lp_test.h +++ b/src/gallium/drivers/llvmpipe/lp_test.h @@ -71,17 +71,28 @@ boolean test_all(unsigned verbose, FILE *fp); +#if defined(PIPE_CC_MSVC) + +unsigned __int64 __rdtsc(); +#pragma intrinsic(__rdtsc) +#define rdtsc() __rdtsc() + +#elif defined(PIPE_CC_GCC) && (defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)) + static INLINE uint64_t rdtsc(void) { -#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) uint32_t hi, lo; __asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi)); return ((uint64_t)lo) | (((uint64_t)hi) << 32); +} + #else - return 0; + +#define rdtsc() 0 + #endif -} + float -- cgit v1.2.3 From 719984afca3864cfe86ca734f3e2bd6eb5834bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 22 Oct 2009 19:03:04 +0100 Subject: llvmpipe: Avoid yet another variable size array. --- src/gallium/drivers/llvmpipe/lp_setup.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index b14c265b7f..c43b3da450 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -278,11 +278,13 @@ clip_emit_quad( struct setup_context *setup, struct quad_header *quad ) * until we codegenerate single-quad variants of the fragment pipeline * we need this hack. */ const unsigned nr_quads = TILE_VECTOR_HEIGHT*TILE_VECTOR_WIDTH/QUAD_SIZE; - struct quad_header quads[nr_quads]; - struct quad_header *quad_ptrs[nr_quads]; + struct quad_header quads[4]; + struct quad_header *quad_ptrs[4]; int x0 = block_x(quad->input.x0); unsigned i; + assert(nr_quads == 4); + for(i = 0; i < nr_quads; ++i) { int x = x0 + 2*i; if(x == quad->input.x0) -- cgit v1.2.3 From eb1b8ed1484f0cc792c5237114b54d5fa53164cc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Oct 2009 12:26:17 -0600 Subject: radeon: fix some renderbuffer format bugs --- src/mesa/drivers/dri/radeon/radeon_fbo.c | 8 ++++---- src/mesa/drivers/dri/radeon/radeon_span.c | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 21007d85c3..096ded23fb 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -280,14 +280,14 @@ radeon_create_renderbuffer(GLenum format, __DRIdrawablePrivate *driDrawPriv) rrb->base._BaseFormat = GL_DEPTH_COMPONENT; break; case GL_DEPTH_COMPONENT24: - rrb->base.Format = MESA_FORMAT_Z32; - rrb->base.DataType = GL_UNSIGNED_INT; - rrb->base._BaseFormat = GL_DEPTH_COMPONENT; + rrb->base.Format = MESA_FORMAT_S8_Z24; + rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT; + rrb->base._BaseFormat = GL_DEPTH_STENCIL; break; case GL_DEPTH24_STENCIL8_EXT: rrb->base.Format = MESA_FORMAT_S8_Z24; rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT; - rrb->base._BaseFormat = GL_STENCIL_INDEX; + rrb->base._BaseFormat = GL_DEPTH_STENCIL; break; default: fprintf(stderr, "%s: Unknown format 0x%04x\n", __FUNCTION__, format); diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c index 9cdcde1eb0..2add8c3eb7 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.c +++ b/src/mesa/drivers/dri/radeon/radeon_span.c @@ -848,9 +848,9 @@ static void radeonSetSpanFunctions(struct radeon_renderbuffer *rrb) { if (rrb->base.Format == MESA_FORMAT_RGB565) { radeonInitPointers_RGB565(&rrb->base); - } else if (rrb->base.Format == MESA_FORMAT_RGBA8888) { /* XXX */ + } else if (rrb->base.Format == MESA_FORMAT_XRGB8888) { radeonInitPointers_xRGB8888(&rrb->base); - } else if (rrb->base.Format == MESA_FORMAT_RGBA8888) { + } else if (rrb->base.Format == MESA_FORMAT_ARGB8888) { radeonInitPointers_ARGB8888(&rrb->base); } else if (rrb->base.Format == MESA_FORMAT_ARGB4444) { radeonInitPointers_ARGB4444(&rrb->base); @@ -858,7 +858,7 @@ static void radeonSetSpanFunctions(struct radeon_renderbuffer *rrb) radeonInitPointers_ARGB1555(&rrb->base); } else if (rrb->base.Format == MESA_FORMAT_Z16) { radeonInitDepthPointers_z16(&rrb->base); - } else if (rrb->base.Format == GL_DEPTH_COMPONENT32) { /* XXX */ + } else if (rrb->base.Format == MESA_FORMAT_X8_Z24) { radeonInitDepthPointers_z24(&rrb->base); } else if (rrb->base.Format == MESA_FORMAT_S8_Z24) { radeonInitDepthPointers_s8_z24(&rrb->base); -- cgit v1.2.3 From dd36006a4eb1cb08dc49af3075c215e6eea46e75 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Thu, 22 Oct 2009 14:48:45 -0400 Subject: r600: fix depth span macros for format changes --- src/mesa/drivers/dri/radeon/radeon_span.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c index 2add8c3eb7..2bc7d31254 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.c +++ b/src/mesa/drivers/dri/radeon/radeon_span.c @@ -603,12 +603,12 @@ do { \ GLuint *_ptr = (GLuint*)r600_ptr_depth( rrb, _x + x_off, _y + y_off ); \ GLuint tmp = *_ptr; \ tmp &= 0xff000000; \ - tmp |= (((d) >> 8) & 0x00ffffff); \ + tmp |= ((d) & 0x00ffffff); \ *_ptr = tmp; \ _ptr = (GLuint*)r600_ptr_stencil(rrb, _x + x_off, _y + y_off); \ tmp = *_ptr; \ tmp &= 0xffffff00; \ - tmp |= (d) & 0xff; \ + tmp |= ((d) >> 24) & 0xff; \ *_ptr = tmp; \ } while (0) #elif defined(RADEON_R200) @@ -633,8 +633,8 @@ do { \ #elif defined(RADEON_R600) #define READ_DEPTH( d, _x, _y ) \ do { \ - d = ((*(GLuint*)(r600_ptr_depth(rrb, _x + x_off, _y + y_off))) << 8) & 0xffffff00; \ - d |= (*(GLuint*)(r600_ptr_stencil(rrb, _x + x_off, _y + y_off))) & 0x000000ff; \ + d = (*(GLuint*)(r600_ptr_depth(rrb, _x + x_off, _y + y_off))) & 0x00ffffff; \ + d |= ((*(GLuint*)(r600_ptr_stencil(rrb, _x + x_off, _y + y_off))) << 24) & 0xff000000; \ }while(0) #elif defined(RADEON_R200) #define READ_DEPTH( d, _x, _y ) \ -- cgit v1.2.3 From 1f7f9bab8139681e1dcbc6c10fb42965059d1395 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Thu, 22 Oct 2009 11:39:59 -0700 Subject: r300g: Move render functions to r300_render. Part of the fastpath cleanup. --- src/gallium/drivers/r300/r300_context.c | 67 +---------- src/gallium/drivers/r300/r300_context.h | 3 + src/gallium/drivers/r300/r300_render.c | 192 ++++++++++++++++++++++++++++++++ src/gallium/drivers/r300/r300_render.h | 52 +++++++++ 4 files changed, 249 insertions(+), 65 deletions(-) create mode 100644 src/gallium/drivers/r300/r300_render.h (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 4ba11a026e..c34fbb1123 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -34,75 +34,12 @@ #include "r300_context.h" #include "r300_flush.h" #include "r300_query.h" +#include "r300_render.h" #include "r300_screen.h" #include "r300_state_derived.h" #include "r300_state_invariant.h" #include "r300_winsys.h" -static boolean r300_draw_range_elements(struct pipe_context* pipe, - struct pipe_buffer* indexBuffer, - unsigned indexSize, - unsigned minIndex, - unsigned maxIndex, - unsigned mode, - unsigned start, - unsigned count) -{ - struct r300_context* r300 = r300_context(pipe); - int i; - - for (i = 0; i < r300->vertex_buffer_count; i++) { - void* buf = pipe_buffer_map(pipe->screen, - r300->vertex_buffers[i].buffer, - PIPE_BUFFER_USAGE_CPU_READ); - draw_set_mapped_vertex_buffer(r300->draw, i, buf); - } - - if (indexBuffer) { - void* indices = pipe_buffer_map(pipe->screen, indexBuffer, - PIPE_BUFFER_USAGE_CPU_READ); - draw_set_mapped_element_buffer_range(r300->draw, indexSize, - minIndex, maxIndex, indices); - } else { - draw_set_mapped_element_buffer(r300->draw, 0, NULL); - } - - draw_set_mapped_constant_buffer(r300->draw, - r300->shader_constants[PIPE_SHADER_VERTEX].constants, - r300->shader_constants[PIPE_SHADER_VERTEX].count * - (sizeof(float) * 4)); - - draw_arrays(r300->draw, mode, start, count); - - for (i = 0; i < r300->vertex_buffer_count; i++) { - pipe_buffer_unmap(pipe->screen, r300->vertex_buffers[i].buffer); - draw_set_mapped_vertex_buffer(r300->draw, i, NULL); - } - - if (indexBuffer) { - pipe_buffer_unmap(pipe->screen, indexBuffer); - draw_set_mapped_element_buffer_range(r300->draw, 0, start, - start + count - 1, NULL); - } - - return TRUE; -} - -static boolean r300_draw_elements(struct pipe_context* pipe, - struct pipe_buffer* indexBuffer, - unsigned indexSize, unsigned mode, - unsigned start, unsigned count) -{ - return r300_draw_range_elements(pipe, indexBuffer, indexSize, 0, ~0, - mode, start, count); -} - -static boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode, - unsigned start, unsigned count) -{ - return r300_draw_elements(pipe, NULL, 0, mode, start, count); -} - static enum pipe_error r300_clear_hash_table(void* key, void* value, void* data) { @@ -189,7 +126,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->context.draw_arrays = r300_draw_arrays; r300->context.draw_elements = r300_draw_elements; - r300->context.draw_range_elements = r300_draw_range_elements; + r300->context.draw_range_elements = r300_swtcl_draw_range_elements; r300->context.is_texture_referenced = r300_is_texture_referenced; r300->context.is_buffer_referenced = r300_is_buffer_referenced; diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 4e2c0ec34e..30b80fa9db 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -273,6 +273,9 @@ struct r300_context { /* Vertex buffers for Gallium. */ struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS]; int vertex_buffer_count; + /* Vertex elements for Gallium. */ + struct pipe_vertex_element vertex_elements[PIPE_MAX_ATTRIBS]; + int vertex_element_count; /* Vertex shader. */ struct r300_vertex_shader* vs; /* Viewport state. */ diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 79a33b53cb..4916152bd6 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -31,11 +31,203 @@ #include "r300_context.h" #include "r300_emit.h" #include "r300_reg.h" +#include "r300_render.h" #include "r300_state_derived.h" /* r300_render: Vertex and index buffer primitive emission. */ #define R300_MAX_VBO_SIZE (1024 * 1024) +static uint32_t r300_translate_primitive(unsigned prim) +{ + switch (prim) { + case PIPE_PRIM_POINTS: + return R300_VAP_VF_CNTL__PRIM_POINTS; + case PIPE_PRIM_LINES: + return R300_VAP_VF_CNTL__PRIM_LINES; + case PIPE_PRIM_LINE_LOOP: + return R300_VAP_VF_CNTL__PRIM_LINE_LOOP; + case PIPE_PRIM_LINE_STRIP: + return R300_VAP_VF_CNTL__PRIM_LINE_STRIP; + case PIPE_PRIM_TRIANGLES: + return R300_VAP_VF_CNTL__PRIM_TRIANGLES; + case PIPE_PRIM_TRIANGLE_STRIP: + return R300_VAP_VF_CNTL__PRIM_TRIANGLE_STRIP; + case PIPE_PRIM_TRIANGLE_FAN: + return R300_VAP_VF_CNTL__PRIM_TRIANGLE_FAN; + case PIPE_PRIM_QUADS: + return R300_VAP_VF_CNTL__PRIM_QUADS; + case PIPE_PRIM_QUAD_STRIP: + return R300_VAP_VF_CNTL__PRIM_QUAD_STRIP; + case PIPE_PRIM_POLYGON: + return R300_VAP_VF_CNTL__PRIM_POLYGON; + default: + return 0; + } +} + +/* This is the fast-path drawing & emission for HW TCL. */ +boolean r300_draw_range_elements(struct pipe_context* pipe, + struct pipe_buffer* indexBuffer, + unsigned indexSize, + unsigned minIndex, + unsigned maxIndex, + unsigned mode, + unsigned start, + unsigned count) +{ + struct r300_context* r300 = r300_context(pipe); + CS_LOCALS(r300); + uint32_t prim = r300_translate_primitive(mode); + struct pipe_vertex_buffer* aos = r300->vertex_buffers; + unsigned aos_count = r300->vertex_buffer_count; + short* indices; + unsigned packet_size; + unsigned i; + bool invalid = FALSE; + +validate: + for (i = 0; i < aos_count; i++) { + if (!r300->winsys->add_buffer(r300->winsys, aos[i].buffer, + RADEON_GEM_DOMAIN_GTT, 0)) { + pipe->flush(pipe, 0, NULL); + goto validate; + } + } + if (!r300->winsys->validate(r300->winsys)) { + pipe->flush(pipe, 0, NULL); + if (invalid) { + /* Well, hell. */ + debug_printf("r300: Stuck in validation loop, gonna quit now."); + exit(1); + } + invalid = TRUE; + goto validate; + } + + r300_emit_dirty_state(r300); + + packet_size = (aos_count >> 1) * 3 + (aos_count & 1) * 2; + + BEGIN_CS(3 + packet_size + (aos_count * 2)); + OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, packet_size); + OUT_CS(aos_count); + for (i = 0; i < aos_count - 1; i += 2) { + OUT_CS(aos[i].stride | + (aos[i].stride << 8) | + (aos[i + 1].stride << 16) | + (aos[i + 1].stride << 24)); + OUT_CS(aos[i].buffer_offset + start * 4 * aos[i].stride); + OUT_CS(aos[i + 1].buffer_offset + start * 4 * aos[i + 1].stride); + } + if (aos_count & 1) { + OUT_CS(aos[i].stride | (aos[i].stride << 8)); + OUT_CS(aos[i].buffer_offset + start * 4 * aos[i].stride); + } + for (i = 0; i < aos_count; i++) { + OUT_CS_RELOC(aos[i].buffer, 0, RADEON_GEM_DOMAIN_GTT, 0, 0); + } + END_CS; + + if (indexBuffer) { + indices = (short*)pipe_buffer_map(pipe->screen, indexBuffer, + PIPE_BUFFER_USAGE_CPU_READ); + + /* Set the starting point. */ + indices += start; + + BEGIN_CS(2 + (count+1)/2); + OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, (count + 1)/2); + OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (count << 16) | prim); + for (i = 0; i < count - 1; i += 2) { + OUT_CS(indices[i + 1] << 16 | indices[i]); + } + if (count % 2) { + OUT_CS(indices[count - 1]); + } + END_CS; + } else { + 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) | + prim); + END_CS; + } + + return TRUE; +} + +/* Simple helpers for context setup. Should probably be moved to util. */ +boolean r300_draw_elements(struct pipe_context* pipe, + struct pipe_buffer* indexBuffer, + unsigned indexSize, unsigned mode, + unsigned start, unsigned count) +{ + return pipe->draw_range_elements(pipe, indexBuffer, indexSize, 0, ~0, + mode, start, count); +} + +boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode, + unsigned start, unsigned count) +{ + return pipe->draw_elements(pipe, NULL, 0, mode, start, count); +} + +/**************************************************************************** + * The rest of this file is for SW TCL rendering only. Please be polite and * + * keep these functions separated so that they are easier to locate. ~C. * + ***************************************************************************/ + +/* Draw-based drawing for SW TCL chipsets. */ +boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe, + struct pipe_buffer* indexBuffer, + unsigned indexSize, + unsigned minIndex, + unsigned maxIndex, + unsigned mode, + unsigned start, + unsigned count) +{ + struct r300_context* r300 = r300_context(pipe); + int i; + + for (i = 0; i < r300->vertex_buffer_count; i++) { + void* buf = pipe_buffer_map(pipe->screen, + r300->vertex_buffers[i].buffer, + PIPE_BUFFER_USAGE_CPU_READ); + draw_set_mapped_vertex_buffer(r300->draw, i, buf); + } + + if (indexBuffer) { + void* indices = pipe_buffer_map(pipe->screen, indexBuffer, + PIPE_BUFFER_USAGE_CPU_READ); + draw_set_mapped_element_buffer_range(r300->draw, indexSize, + minIndex, maxIndex, indices); + } else { + draw_set_mapped_element_buffer(r300->draw, 0, NULL); + } + + draw_set_mapped_constant_buffer(r300->draw, + r300->shader_constants[PIPE_SHADER_VERTEX].constants, + r300->shader_constants[PIPE_SHADER_VERTEX].count * + (sizeof(float) * 4)); + + draw_arrays(r300->draw, mode, start, count); + + for (i = 0; i < r300->vertex_buffer_count; i++) { + pipe_buffer_unmap(pipe->screen, r300->vertex_buffers[i].buffer); + draw_set_mapped_vertex_buffer(r300->draw, i, NULL); + } + + if (indexBuffer) { + pipe_buffer_unmap(pipe->screen, indexBuffer); + draw_set_mapped_element_buffer_range(r300->draw, 0, start, + start + count - 1, NULL); + } + + return TRUE; +} + +/* Object for rendering using Draw. */ struct r300_render { /* Parent class */ struct vbuf_render base; diff --git a/src/gallium/drivers/r300/r300_render.h b/src/gallium/drivers/r300/r300_render.h new file mode 100644 index 0000000000..3d8f47ba75 --- /dev/null +++ b/src/gallium/drivers/r300/r300_render.h @@ -0,0 +1,52 @@ +/* + * 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_RENDER_H +#define R300_RENDER_H + +boolean r300_draw_range_elements(struct pipe_context* pipe, + struct pipe_buffer* indexBuffer, + unsigned indexSize, + unsigned minIndex, + unsigned maxIndex, + unsigned mode, + unsigned start, + unsigned count); + +boolean r300_draw_elements(struct pipe_context* pipe, + struct pipe_buffer* indexBuffer, + unsigned indexSize, unsigned mode, + unsigned start, unsigned count); + +boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode, + unsigned start, unsigned count); + +boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe, + struct pipe_buffer* indexBuffer, + unsigned indexSize, + unsigned minIndex, + unsigned maxIndex, + unsigned mode, + unsigned start, + unsigned count); + +#endif /* R300_RENDER_H */ -- cgit v1.2.3 From 06e464c2d57552d5ccde2b98885aeef953d8b2a1 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Thu, 22 Oct 2009 11:45:36 -0700 Subject: r300g: Clean up duplicate code in r300_render. --- src/gallium/drivers/r300/r300_render.c | 49 +++------------------------------- 1 file changed, 4 insertions(+), 45 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 4916152bd6..6e2bcc62da 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -331,54 +331,13 @@ 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; - } + r300render->prim = prim; + r300render->hwprim = r300_translate_primitive(prim); return TRUE; } -static void r300_prepare_render(struct r300_render* render, unsigned count) -{ - struct r300_context* r300 = render->r300; - - r300_emit_dirty_state(r300); -} - static void r300_render_draw_arrays(struct vbuf_render* render, unsigned start, unsigned count) @@ -388,7 +347,7 @@ static void r300_render_draw_arrays(struct vbuf_render* render, CS_LOCALS(r300); - r300_prepare_render(r300render, count); + r300_emit_dirty_state(r300); DBG(r300, DBG_DRAW, "r300: Doing vbuf render, count %d\n", count); @@ -409,7 +368,7 @@ static void r300_render_draw(struct vbuf_render* render, CS_LOCALS(r300); - r300_prepare_render(r300render, count); + r300_emit_dirty_state(r300); BEGIN_CS(2 + (count+1)/2); OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, (count+1)/2); -- cgit v1.2.3 From 8e4657a9d4cbb899d388068cff0f8c267071fa50 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Thu, 22 Oct 2009 12:29:30 -0700 Subject: Nuke s3v. As per FDO #17889. --- src/mesa/drivers/dri/common/drirenderbuffer.h | 2 +- src/mesa/drivers/dri/s3v/Makefile | 35 - src/mesa/drivers/dri/s3v/s3v_common.h | 83 --- src/mesa/drivers/dri/s3v/s3v_context.c | 260 ------- src/mesa/drivers/dri/s3v/s3v_context.h | 443 ------------ src/mesa/drivers/dri/s3v/s3v_dd.c | 90 --- src/mesa/drivers/dri/s3v/s3v_dri.h | 143 ---- src/mesa/drivers/dri/s3v/s3v_inithw.c | 79 --- src/mesa/drivers/dri/s3v/s3v_lock.c | 62 -- src/mesa/drivers/dri/s3v/s3v_lock.h | 99 --- src/mesa/drivers/dri/s3v/s3v_macros.h | 230 ------- src/mesa/drivers/dri/s3v/s3v_regs.h | 367 ---------- src/mesa/drivers/dri/s3v/s3v_render.c | 203 ------ src/mesa/drivers/dri/s3v/s3v_screen.c | 99 --- src/mesa/drivers/dri/s3v/s3v_screen.h | 39 -- src/mesa/drivers/dri/s3v/s3v_span.c | 219 ------ src/mesa/drivers/dri/s3v/s3v_state.c | 888 ------------------------ src/mesa/drivers/dri/s3v/s3v_tex.c | 548 --------------- src/mesa/drivers/dri/s3v/s3v_tex.h | 28 - src/mesa/drivers/dri/s3v/s3v_texmem.c | 582 ---------------- src/mesa/drivers/dri/s3v/s3v_texstate.c | 300 -------- src/mesa/drivers/dri/s3v/s3v_tris.c | 850 ----------------------- src/mesa/drivers/dri/s3v/s3v_tris.h | 11 - src/mesa/drivers/dri/s3v/s3v_tritmp.h | 958 -------------------------- src/mesa/drivers/dri/s3v/s3v_vb.c | 339 --------- src/mesa/drivers/dri/s3v/s3v_vb.h | 39 -- src/mesa/drivers/dri/s3v/s3v_xmesa.c | 341 --------- src/mesa/drivers/dri/s3v/s3virgetri.h | 383 ---------- 28 files changed, 1 insertion(+), 7719 deletions(-) delete mode 100644 src/mesa/drivers/dri/s3v/Makefile delete mode 100644 src/mesa/drivers/dri/s3v/s3v_common.h delete mode 100644 src/mesa/drivers/dri/s3v/s3v_context.c delete mode 100644 src/mesa/drivers/dri/s3v/s3v_context.h delete mode 100644 src/mesa/drivers/dri/s3v/s3v_dd.c delete mode 100644 src/mesa/drivers/dri/s3v/s3v_dri.h delete mode 100644 src/mesa/drivers/dri/s3v/s3v_inithw.c delete mode 100644 src/mesa/drivers/dri/s3v/s3v_lock.c delete mode 100644 src/mesa/drivers/dri/s3v/s3v_lock.h delete mode 100644 src/mesa/drivers/dri/s3v/s3v_macros.h delete mode 100644 src/mesa/drivers/dri/s3v/s3v_regs.h delete mode 100644 src/mesa/drivers/dri/s3v/s3v_render.c delete mode 100644 src/mesa/drivers/dri/s3v/s3v_screen.c delete mode 100644 src/mesa/drivers/dri/s3v/s3v_screen.h delete mode 100644 src/mesa/drivers/dri/s3v/s3v_span.c delete mode 100644 src/mesa/drivers/dri/s3v/s3v_state.c delete mode 100644 src/mesa/drivers/dri/s3v/s3v_tex.c delete mode 100644 src/mesa/drivers/dri/s3v/s3v_tex.h delete mode 100644 src/mesa/drivers/dri/s3v/s3v_texmem.c delete mode 100644 src/mesa/drivers/dri/s3v/s3v_texstate.c delete mode 100644 src/mesa/drivers/dri/s3v/s3v_tris.c delete mode 100644 src/mesa/drivers/dri/s3v/s3v_tris.h delete mode 100644 src/mesa/drivers/dri/s3v/s3v_tritmp.h delete mode 100644 src/mesa/drivers/dri/s3v/s3v_vb.c delete mode 100644 src/mesa/drivers/dri/s3v/s3v_vb.h delete mode 100644 src/mesa/drivers/dri/s3v/s3v_xmesa.c delete mode 100644 src/mesa/drivers/dri/s3v/s3virgetri.h (limited to 'src') diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.h b/src/mesa/drivers/dri/common/drirenderbuffer.h index cf55286b30..5ae28cb53a 100644 --- a/src/mesa/drivers/dri/common/drirenderbuffer.h +++ b/src/mesa/drivers/dri/common/drirenderbuffer.h @@ -56,7 +56,7 @@ typedef struct { * A handy flag to know if this is the back color buffer. * * \note - * This is currently only used by s3v and tdfx. + * This is currently only used by tdfx. */ GLboolean backBuffer; } driRenderbuffer; diff --git a/src/mesa/drivers/dri/s3v/Makefile b/src/mesa/drivers/dri/s3v/Makefile deleted file mode 100644 index da7e6cdc20..0000000000 --- a/src/mesa/drivers/dri/s3v/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# src/mesa/drivers/dri/s3v/Makefile - -TOP = ../../../../.. -include $(TOP)/configs/current - -LIBNAME = s3v_dri.so - -# Doesn't exist yet. -#MINIGLX_SOURCES = server/savage_dri.c - -DRIVER_SOURCES = \ - s3v_context.c \ - s3v_dd.c \ - s3v_inithw.c \ - s3v_lock.c \ - s3v_render.c \ - s3v_screen.c \ - s3v_span.c \ - s3v_state.c \ - s3v_tex.c \ - s3v_texmem.c \ - s3v_texstate.c \ - s3v_tris.c \ - s3v_vb.c \ - s3v_xmesa.c - -C_SOURCES = \ - $(COMMON_SOURCES) \ - $(DRIVER_SOURCES) - -ASM_SOURCES = - - -include ../Makefile.template - diff --git a/src/mesa/drivers/dri/s3v/s3v_common.h b/src/mesa/drivers/dri/s3v/s3v_common.h deleted file mode 100644 index b66cdf1df0..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_common.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Author: Max Lingua - */ - -/* WARNING: If you change any of these defines, make sure to change - * the kernel include file as well (s3v_drm.h) - */ - -#ifndef _XF86DRI_S3V_H_ -#define _XF86DRI_S3V_H_ - -#ifndef _S3V_DEFINES_ -#define _S3V_DEFINES_ -#define S3V_USE_BATCH 1 - -/* #define S3V_BUF_4K 1 */ - -#ifdef S3V_BUF_4K -#define S3V_DMA_BUF_ORDER 12 -#define S3V_DMA_BUF_NR 256 -#else -#define S3V_DMA_BUF_ORDER 16 /* -much- better */ -#define S3V_DMA_BUF_NR 16 -#endif -/* on s3virge you can only choose between * - * 4k (2^12) and 64k (2^16) dma bufs */ -#define S3V_DMA_BUF_SZ (1< - */ - -#include "s3v_context.h" - -#include "swrast/swrast.h" -#include "swrast_setup/swrast_setup.h" -#include "vbo/vbo.h" - -#include "tnl/tnl.h" -#include "tnl/t_pipeline.h" - -#include "main/context.h" -#include "main/simple_list.h" -#include "main/matrix.h" -#include "main/extensions.h" -#if defined(USE_X86_ASM) -#include "x86/common_x86_asm.h" -#endif -#include "main/simple_list.h" -#include "main/mm.h" - -#include "drivers/common/driverfuncs.h" -#include "s3v_vb.h" -#include "s3v_tris.h" - -#if 0 -extern const struct tnl_pipeline_stage _s3v_render_stage; - -static const struct tnl_pipeline_stage *s3v_pipeline[] = { - &_tnl_vertex_transform_stage, - &_tnl_normal_transform_stage, - &_tnl_lighting_stage, - &_tnl_fog_coordinate_stage, - &_tnl_texgen_stage, - &_tnl_texture_transform_stage, - /* REMOVE: point attenuation stage */ -#if 1 - &_s3v_render_stage, /* ADD: unclipped rastersetup-to-dma */ -#endif - &_tnl_render_stage, - 0, -}; -#endif - -GLboolean s3vCreateContext(const __GLcontextModes *glVisual, - __DRIcontextPrivate *driContextPriv, - void *sharedContextPrivate) -{ - GLcontext *ctx, *shareCtx; - __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; - s3vContextPtr vmesa; - s3vScreenPtr s3vScrn; - S3VSAREAPtr saPriv=(S3VSAREAPtr)(((char*)sPriv->pSAREA) + - sizeof(drm_sarea_t)); - struct dd_function_table functions; - - DEBUG_WHERE(("*** s3vCreateContext ***\n")); - - vmesa = (s3vContextPtr) CALLOC( sizeof(*vmesa) ); - if ( !vmesa ) return GL_FALSE; - - /* Allocate the Mesa context */ - if (sharedContextPrivate) - shareCtx = ((s3vContextPtr) sharedContextPrivate)->glCtx; - else - shareCtx = NULL; - - _mesa_init_driver_functions(&functions); - - vmesa->glCtx = _mesa_create_context(glVisual, shareCtx, &functions, - (void *)vmesa); - if (!vmesa->glCtx) { - FREE(vmesa); - return GL_FALSE; - } - - vmesa->driContext = driContextPriv; - vmesa->driScreen = sPriv; - vmesa->driDrawable = NULL; /* Set by XMesaMakeCurrent */ - - vmesa->hHWContext = driContextPriv->hHWContext; - vmesa->driHwLock = (drmLock *)&sPriv->pSAREA->lock; - vmesa->driFd = sPriv->fd; - vmesa->sarea = saPriv; - - s3vScrn = vmesa->s3vScreen = (s3vScreenPtr)(sPriv->private); - - ctx = vmesa->glCtx; - - ctx->Const.MaxTextureLevels = 11; /* it is (11-1) -> 1024 * 1024 FIXME */ - - ctx->Const.MaxTextureUnits = 1; /* FIXME: or 2 ? */ - - /* No wide points. - */ - ctx->Const.MinPointSize = 1.0; - ctx->Const.MinPointSizeAA = 1.0; - ctx->Const.MaxPointSize = 1.0; - ctx->Const.MaxPointSizeAA = 1.0; - - /* No wide lines. - */ - ctx->Const.MinLineWidth = 1.0; - ctx->Const.MinLineWidthAA = 1.0; - ctx->Const.MaxLineWidth = 1.0; - ctx->Const.MaxLineWidthAA = 1.0; - ctx->Const.LineWidthGranularity = 1.0; - - ctx->Const.MaxDrawBuffers = 1; - - vmesa->texHeap = mmInit( 0, vmesa->s3vScreen->textureSize ); - DEBUG(("vmesa->s3vScreen->textureSize = 0x%x\n", - vmesa->s3vScreen->textureSize)); - - /* NOTE */ - /* mmInit(offset, size); */ - - /* allocates a structure like this: - - struct mem_block_t { - struct mem_block_t *next; - struct mem_block_t *heap; - int ofs,size; - int align; - int free:1; - int reserved:1; - }; - - */ - - make_empty_list(&vmesa->TexObjList); - make_empty_list(&vmesa->SwappedOut); - - vmesa->CurrentTexObj[0] = 0; - vmesa->CurrentTexObj[1] = 0; /* FIXME */ - - vmesa->RenderIndex = ~0; - - /* Initialize the software rasterizer and helper modules. - */ - _swrast_CreateContext( ctx ); - _vbo_CreateContext( ctx ); - _tnl_CreateContext( ctx ); - _swsetup_CreateContext( ctx ); - - /* Install the customized pipeline: - */ -#if 0 - _tnl_destroy_pipeline( ctx ); - _tnl_install_pipeline( ctx, s3v_pipeline ); -#endif - /* Configure swrast to match hardware characteristics: - */ -#if 0 - _swrast_allow_pixel_fog( ctx, GL_FALSE ); - _swrast_allow_vertex_fog( ctx, GL_TRUE ); -#endif - vmesa->_3d_mode = 0; - - /* 3D lines / gouraud tris */ - vmesa->CMD = ( AUTO_EXEC_ON | HW_CLIP_ON | DEST_COL_1555 - | FOG_OFF | ALPHA_OFF | Z_OFF | Z_UPDATE_OFF - | Z_LESS | TEX_WRAP_ON | TEX_MODULATE | LINEAR - | TEX_COL_ARGB1555 | CMD_3D ); - - vmesa->_alpha[0] = vmesa->_alpha[1] = ALPHA_OFF; - vmesa->alpha_cmd = vmesa->_alpha[0]; - vmesa->_tri[0] = DO_GOURAUD_TRI; - vmesa->_tri[1] = DO_TEX_LIT_TRI; - vmesa->prim_cmd = vmesa->_tri[0]; - - /* printf("first vmesa->CMD = 0x%x\n", vmesa->CMD); */ - - vmesa->TexOffset = vmesa->s3vScreen->texOffset; - - s3vInitVB( ctx ); - s3vInitExtensions( ctx ); - s3vInitDriverFuncs( ctx ); - s3vInitStateFuncs( ctx ); - s3vInitSpanFuncs( ctx ); - s3vInitTextureFuncs( ctx ); - s3vInitTriFuncs( ctx ); - s3vInitState( vmesa ); - - driContextPriv->driverPrivate = (void *)vmesa; - - /* HACK */ - vmesa->bufSize = S3V_DMA_BUF_SZ; - - DEBUG(("vmesa->bufSize = %i\n", vmesa->bufSize)); - DEBUG(("vmesa->bufCount = %i\n", vmesa->bufCount)); - - - /* dma init */ - DEBUG_BUFS(("GET_FIRST_DMA\n")); - - vmesa->_bufNum = 0; - - GET_FIRST_DMA(vmesa->driFd, vmesa->hHWContext, - 1, &(vmesa->bufIndex[0]), &(vmesa->bufSize), - &vmesa->_buf[0], &vmesa->bufCount, s3vScrn); - - GET_FIRST_DMA(vmesa->driFd, vmesa->hHWContext, - 1, &(vmesa->bufIndex[1]), &(vmesa->bufSize), - &vmesa->_buf[1], &vmesa->bufCount, s3vScrn); - - vmesa->buf = vmesa->_buf[vmesa->_bufNum]; - -/* - vmesa->CMD = (AUTO_EXEC_ON | HW_CLIP_ON | DEST_COL_1555 - | FOG_OFF | ALPHA_OFF | Z_OFF | Z_UPDATE_OFF - | DO_GOURAUD_TRI | CMD_3D); - - vmesa->TexOffset = vmesa->s3vScreen->texOffset; -*/ - -/* ... but we should support only 15 bit in virge (out of 8/15/24)... */ - - DEBUG(("glVisual->depthBits = %i\n", glVisual->depthBits)); - - switch (glVisual->depthBits) { - case 8: - break; - - case 15: - case 16: - vmesa->depth_scale = 1.0f / 0xffff; - break; - case 24: - vmesa->depth_scale = 1.0f / 0xffffff; - break; - default: - break; - } - - vmesa->cull_zero = 0.0f; - - vmesa->DepthSize = glVisual->depthBits; - vmesa->Flags = S3V_FRONT_BUFFER; - vmesa->Flags |= (glVisual->doubleBufferMode ? S3V_BACK_BUFFER : 0); - vmesa->Flags |= (vmesa->DepthSize > 0 ? S3V_DEPTH_BUFFER : 0); - - vmesa->EnabledFlags = S3V_FRONT_BUFFER; - vmesa->EnabledFlags |= (glVisual->doubleBufferMode ? S3V_BACK_BUFFER : 0); - - - if (vmesa->Flags & S3V_BACK_BUFFER) { - vmesa->readOffset = vmesa->drawOffset = vmesa->s3vScreen->backOffset; - } else { - vmesa->readOffset = vmesa->drawOffset = 0; - } - - s3vInitHW( vmesa ); - - driContextPriv->driverPrivate = (void *)vmesa; - - return GL_TRUE; -} diff --git a/src/mesa/drivers/dri/s3v/s3v_context.h b/src/mesa/drivers/dri/s3v/s3v_context.h deleted file mode 100644 index 671ba90d78..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_context.h +++ /dev/null @@ -1,443 +0,0 @@ -/* - * Author: Max Lingua - */ - -#ifndef _S3V_CONTEXT_H_ -#define _S3V_CONTEXT_H_ - -#include "dri_util.h" - -#include "s3v_dri.h" -#include "s3v_regs.h" -#include "s3v_macros.h" -#include "s3v_screen.h" -#include "main/colormac.h" -#include "main/macros.h" -#include "main/mtypes.h" -#include "drm.h" -#include "main/mm.h" -#include "drirenderbuffer.h" - -/* Flags for context */ -#define S3V_FRONT_BUFFER 0x00000001 -#define S3V_BACK_BUFFER 0x00000002 -#define S3V_DEPTH_BUFFER 0x00000004 - - /* FIXME: check */ -#define S3V_MAX_TEXTURE_SIZE 2048 - -/* These are the minimum requirements and should probably be increased */ -#define MAX_MODELVIEW_STACK 16 -#define MAX_PROJECTION_STACK 2 -#define MAX_TEXTURE_STACK 2 - -extern void s3vDDUpdateHWState(GLcontext *ctx); -extern s3vScreenPtr s3vCreateScreen(__DRIscreenPrivate *sPriv); -extern void s3vDestroyScreen(__DRIscreenPrivate *sPriv); -extern GLboolean s3vCreateContext(const __GLcontextModes *glVisual, - __DRIcontextPrivate *driContextPriv, - void *sharedContextPrivate); - -#define S3V_UPLOAD_ALL 0xffffffff -/* #define S3V_UPLOAD_CLIPRECTS 0x00000002 */ -#define S3V_UPLOAD_ALPHA 0x00000004 -#define S3V_UPLOAD_BLEND 0x00000008 -#define S3V_UPLOAD_DEPTH 0x00000010 -#define S3V_UPLOAD_VIEWPORT 0x00000020 -#define S3V_UPLOAD_SHADE 0x00000040 -#define S3V_UPLOAD_CLIP 0x00000080 -#define S3V_UPLOAD_MASKS 0x00000100 -#define S3V_UPLOAD_WINDOW 0x00000200 /* defunct */ -#define S3V_UPLOAD_GEOMETRY 0x00000400 -#define S3V_UPLOAD_POLYGON 0x00000800 -#define S3V_UPLOAD_DITHER 0x00001000 -#define S3V_UPLOAD_LOGICOP 0x00002000 -#define S3V_UPLOAD_FOG 0x00004000 -#define S3V_UPLOAD_LIGHT 0x00008000 -#define S3V_UPLOAD_CONTEXT 0x00010000 -#define S3V_UPLOAD_TEX0 0x00020000 -#define S3V_UPLOAD_STIPPLE 0x00040000 -#define S3V_UPLOAD_TRANSFORM 0x00080000 -#define S3V_UPLOAD_LINEMODE 0x00100000 -#define S3V_UPLOAD_POINTMODE 0x00200000 -#define S3V_UPLOAD_TRIMODE 0x00400000 - -#define S3V_NEW_CLIP 0x00000001 -#define S3V_NEW_WINDOW 0x00000002 -#define S3V_NEW_CONTEXT 0x00000004 -#define S3V_NEW_TEXTURE 0x00000008 /* defunct */ -#define S3V_NEW_ALPHA 0x00000010 -#define S3V_NEW_DEPTH 0x00000020 -#define S3V_NEW_MASKS 0x00000040 -#define S3V_NEW_POLYGON 0x00000080 -#define S3V_NEW_CULL 0x00000100 -#define S3V_NEW_LOGICOP 0x00000200 -#define S3V_NEW_FOG 0x00000400 -#define S3V_NEW_LIGHT 0x00000800 -#define S3V_NEW_STIPPLE 0x00001000 -#define S3V_NEW_ALL 0xffffffff - -#define S3V_FALLBACK_TRI 0x00000001 -#define S3V_FALLBACK_TEXTURE 0x00000002 - -struct s3v_context; -typedef struct s3v_context s3vContextRec; -typedef struct s3v_context *s3vContextPtr; -typedef struct s3v_texture_object_t *s3vTextureObjectPtr; - -#define VALID_S3V_TEXTURE_OBJECT(tobj) (tobj) - -#define S3V_TEX_MAXLEVELS 12 - -/* For shared texture space managment, these texture objects may also - * be used as proxies for regions of texture memory containing other - * client's textures. Such proxy textures (not to be confused with GL - * proxy textures) are subject to the same LRU aging we use for our - * own private textures, and thus we have a mechanism where we can - * fairly decide between kicking out our own textures and those of - * other clients. - * - * Non-local texture objects have a valid MemBlock to describe the - * region managed by the other client, and can be identified by - * 't->globj == 0' - */ -struct s3v_texture_object_t { - struct s3v_texture_object_t *next, *prev; - - GLuint age; - struct gl_texture_object *globj; - - int Pitch; - int Height; - int WidthLog2; - int texelBytes; - int totalSize; - int bound; - - struct mem_block *MemBlock; - GLuint BufAddr; - - GLuint min_level; - GLuint max_level; - GLuint dirty_images; - - GLint firstLevel, lastLevel; /* upload tObj->Image[first .. lastLevel] */ - - struct { - const struct gl_texture_image *image; - int offset; /* into BufAddr */ - int height; - int internalFormat; - } image[S3V_TEX_MAXLEVELS]; - - GLuint TextureCMD; - - GLuint TextureColorMode; - GLuint TextureFilterMode; - GLuint TextureBorderColor; - GLuint TextureWrap; - GLuint TextureMipSize; - - GLuint TextureBaseAddr[S3V_TEX_MAXLEVELS]; - GLuint TextureFormat; - GLuint TextureReadMode; -}; - -#define S3V_NO_PALETTE 0x0 -#define S3V_USE_PALETTE 0x1 -#define S3V_UPDATE_PALETTE 0x2 -#define S3V_FALLBACK_PALETTE 0x4 - -void s3vUpdateTextureState( GLcontext *ctx ); - -void s3vDestroyTexObj( s3vContextPtr vmesa, s3vTextureObjectPtr t); -void s3vUploadTexImages( s3vContextPtr vmesa, s3vTextureObjectPtr t ); - -void s3vResetGlobalLRU( s3vContextPtr vmesa ); -void s3vTexturesGone( s3vContextPtr vmesa, - GLuint start, GLuint end, - GLuint in_use ); - -void s3vEmitHwState( s3vContextPtr vmesa ); -void s3vGetLock( s3vContextPtr vmesa, GLuint flags ); -void s3vInitExtensions( GLcontext *ctx ); -void s3vInitDriverFuncs( GLcontext *ctx ); -void s3vSetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis); -void s3vInitState( s3vContextPtr vmesa ); -void s3vInitHW( s3vContextPtr vmesa ); -void s3vInitStateFuncs( GLcontext *ctx ); -void s3vInitTextureFuncs( GLcontext *ctx ); -void s3vInitTriFuncs( GLcontext *ctx ); - -void s3vUpdateWindow( GLcontext *ctx ); -void s3vUpdateViewportOffset( GLcontext *ctx ); - -void s3vPrintLocalLRU( s3vContextPtr vmesa ); -void s3vPrintGlobalLRU( s3vContextPtr vmesa ); - -extern void s3vFallback( s3vContextPtr vmesa, GLuint bit, GLboolean mode ); -#define FALLBACK( imesa, bit, mode ) s3vFallback( imesa, bit, mode ) - -/* Use the templated vertex formats. Only one of these is used in s3v. - */ -#define TAG(x) s3v##x -#include "tnl_dd/t_dd_vertex.h" -#undef TAG - -typedef void (*s3v_quad_func)( s3vContextPtr, - const s3vVertex *, - const s3vVertex *, - const s3vVertex *, - const s3vVertex * ); -typedef void (*s3v_tri_func)( s3vContextPtr, - const s3vVertex *, - const s3vVertex *, - const s3vVertex * ); -typedef void (*s3v_line_func)( s3vContextPtr, - const s3vVertex *, - const s3vVertex * ); -typedef void (*s3v_point_func)( s3vContextPtr, - const s3vVertex * ); - - -/* static void s3v_lines_emit(GLcontext *ctx, GLuint start, GLuint end); */ -typedef void (*emit_func)( GLcontext *, GLuint, GLuint); - -struct s3v_context { - GLcontext *glCtx; /* Mesa context */ - - __DRIcontextPrivate *driContext; - __DRIscreenPrivate *driScreen; - __DRIdrawablePrivate *driDrawable; - - GLuint new_gl_state; - GLuint new_state; - GLuint dirty; - - S3VSAREAPtr sarea; - - /* Temporaries for translating away float colors - */ - struct gl_client_array UbyteColor; - struct gl_client_array UbyteSecondaryColor; - - /* Mirrors of some DRI state - */ - - drm_context_t hHWContext; - drmLock *driHwLock; - int driFd; - - GLuint numClipRects; /* Cliprects for the draw buffer */ - drm_clip_rect_t *pClipRects; - - GLuint* buf; /* FIXME */ - GLuint* _buf[2]; - int _bufNum; - int bufIndex[2]; - int bufSize; - int bufCount; - - s3vScreenPtr s3vScreen; /* Screen private DRI data */ - - int drawOffset; - int readOffset; - - s3v_point_func draw_point; - s3v_line_func draw_line; - s3v_tri_func draw_tri; - s3v_quad_func draw_quad; - - GLuint Fallback; - GLuint RenderIndex; - GLuint SetupNewInputs; - GLuint SetupIndex; - - GLuint vertex_format; - GLuint vertex_size; - GLuint vertex_stride_shift; - char *verts; - - GLfloat hw_viewport[16]; - GLuint hw_primitive; - GLenum render_primitive; - - GLfloat depth_scale; - - s3vTextureObjectPtr CurrentTexObj[2]; - struct s3v_texture_object_t TexObjList; - struct s3v_texture_object_t SwappedOut; - GLenum TexEnvImageFmt[2]; - - struct mem_block *texHeap; - - int lastSwap; - int texAge; - int ctxAge; - int dirtyAge; - int lastStamp; - - /* max was here: don't touch */ - - unsigned int S3V_REG[S3V_REGS_NUM]; - - GLuint texMode; - GLuint alphaMode; - GLuint lightMode; - - GLuint SrcBase; - GLuint DestBase; - GLuint DestBlit; - GLuint ScissorLR; - GLuint ScissorTB; - GLuint ScissorWH; /* SubScissorWH */ /* RectWH */ - GLuint FrontStride; - GLuint BackStride; - GLuint SrcStride; - GLuint DestStride; - GLuint SrcXY; - GLuint DestXY; - - GLuint ClearColor; - GLuint Color; - GLuint DitherMode; - GLuint ClearDepth; - - GLuint TextureBorderColor; - GLuint TexOffset; - GLuint TexStride; - - GLuint CMD; - GLuint prim_cmd; - GLuint _tri[2]; /* 0 = gouraud; 1 = tex (lit or unlit) */ - GLuint alpha_cmd; /* actual alpha cmd */ - GLuint _alpha[2]; - GLuint _alpha_tex; /* tex alpha type */ - /* (3d_mode) 0 = 3d line/gourad tri; 1 = 3d tex tri */ - GLuint _3d_mode; - - GLfloat backface_sign; - GLfloat cull_zero; - - int restore_primitive; - -/* *** 2check *** */ - - GLuint FogMode; - GLuint AreaStippleMode; - GLuint LBReadFormat; - GLuint LBWriteFormat; - GLuint LineMode; - GLuint PointMode; - GLuint TriangleMode; - GLuint AntialiasMode; - GLfloat ViewportScaleX; - GLfloat ViewportScaleY; - GLfloat ViewportScaleZ; - GLfloat ViewportOffsetX; - GLfloat ViewportOffsetY; - GLfloat ViewportOffsetZ; - int MatrixMode; - int DepthMode; - int TransformMode; - int LBReadMode; - int FBReadMode; - int FBWindowBase; - int LBWindowBase; - int ColorDDAMode; - int GeometryMode; - int AlphaTestMode; - int AlphaBlendMode; - int AB_FBReadMode; - int AB_FBReadMode_Save; - int DeltaMode; - int ColorMaterialMode; - int FBHardwareWriteMask; - int MaterialMode; - int NormalizeMode; - int LightingMode; - int Light0Mode; - int Light1Mode; - int Light2Mode; - int Light3Mode; - int Light4Mode; - int Light5Mode; - int Light6Mode; - int Light7Mode; - int Light8Mode; - int Light9Mode; - int Light10Mode; - int Light11Mode; - int Light12Mode; - int Light13Mode; - int Light14Mode; - int Light15Mode; - int LogicalOpMode; - int ScissorMode; - int ScissorMaxXY; - int ScissorMinXY; - int Window; /* GID part probably should be in draw priv */ - int WindowOrigin; - int x, y, w, h; /* Probably should be in drawable priv */ - int FrameCount; /* Probably should be in drawable priv */ - int NotClipped; /* Probably should be in drawable priv */ - int WindowChanged; /* Probably should be in drawabl... */ - int Flags; - int EnabledFlags; - int DepthSize; - int Begin; - GLenum ErrorValue; - int Texture1DEnabled; - int Texture2DEnabled; - - float ModelView[16]; - float Proj[16]; - float ModelViewProj[16]; - float Texture[16]; - - float ModelViewStack[(MAX_MODELVIEW_STACK-1)*16]; - int ModelViewCount; - float ProjStack[(MAX_PROJECTION_STACK-1)*16]; - int ProjCount; - float TextureStack[(MAX_TEXTURE_STACK-1)*16]; - int TextureCount; -}; - -#define S3VIRGEPACKCOLOR555( r, g, b, a ) \ - ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \ - ((a) ? 0x8000 : 0)) - -#define S3VIRGEPACKCOLOR565( r, g, b ) \ - ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3)) - -#define S3VIRGEPACKCOLOR888( r, g, b ) \ - (((r) << 16) | ((g) << 8) | (b)) - -#define S3VIRGEPACKCOLOR8888( r, g, b, a ) \ - (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)) - -#define S3VIRGEPACKCOLOR4444( r, g, b, a ) \ - ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4)) - -static INLINE GLuint s3vPackColor( GLuint cpp, - GLubyte r, GLubyte g, - GLubyte b, GLubyte a ) -{ - unsigned int ret; - DEBUG(("cpp = %i, r=0x%x, g=0x%x, b=0x%x, a=0x%x\n", cpp, r, g, b, a)); - - switch ( cpp ) { - case 2: - ret = S3VIRGEPACKCOLOR555( r, g, b, a ); - DEBUG(("ret = 0x%x\n", ret)); - return ret; - case 4: - return PACK_COLOR_8888( a, r, g, b ); - default: - return 0; - } -} - -#define S3V_CONTEXT(ctx) ((s3vContextPtr)(ctx->DriverCtx)) - -#endif /* _S3V_CONTEXT_H_ */ diff --git a/src/mesa/drivers/dri/s3v/s3v_dd.c b/src/mesa/drivers/dri/s3v/s3v_dd.c deleted file mode 100644 index e340116f5e..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_dd.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Author: Max Lingua - */ - -#include "s3v_context.h" -#include "s3v_vb.h" -#include "s3v_lock.h" -#if defined(USE_X86_ASM) -#include "x86/common_x86_asm.h" -#endif - -#include "main/context.h" -#include "main/framebuffer.h" -#include "swrast/swrast.h" - -#define S3V_DATE "20020207" - - -/* Return the width and height of the current color buffer. - */ -static void s3vDDGetBufferSize( GLframebuffer *buffer, - GLuint *width, GLuint *height ) -{ - GET_CURRENT_CONTEXT(ctx); - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - -/* S3VHW_LOCK( vmesa ); */ - *width = vmesa->driDrawable->w; - *height = vmesa->driDrawable->h; -/* S3VHW_UNLOCK( vmesa ); */ -} - - -/* Return various strings for glGetString(). - */ -static const GLubyte *s3vDDGetString( GLcontext *ctx, GLenum name ) -{ - static char buffer[128]; - - switch ( name ) { - case GL_VENDOR: - return (GLubyte *)"Max Lingua (ladybug)"; - - case GL_RENDERER: - sprintf( buffer, "Mesa DRI S3 Virge " S3V_DATE ); - - /* Append any CPU-specific information. - */ -#ifdef USE_X86_ASM - if ( _mesa_x86_cpu_features ) { - strncat( buffer, " x86", 4 ); - -} -#ifdef USE_MMX_ASM - if ( cpu_has_mmx ) { - strncat( buffer, "/MMX", 4 ); - } -#endif -#ifdef USE_3DNOW_ASM - if ( cpu_has_3dnow ) { - strncat( buffer, "/3DNow!", 7 ); - } -#endif -#ifdef USE_SSE_ASM - if ( cpu_has_xmm ) { - strncat( buffer, "/SSE", 4 ); - } -#endif -#endif - return (GLubyte *)buffer; - - default: - return NULL; - } -} - -/* Enable the extensions supported by this driver. - */ -void s3vInitExtensions( GLcontext *ctx ) -{ - /* None... */ -} - -/* Initialize the driver's misc functions. - */ -void s3vInitDriverFuncs( GLcontext *ctx ) -{ - ctx->Driver.GetBufferSize = s3vDDGetBufferSize; - ctx->Driver.GetString = s3vDDGetString; -} diff --git a/src/mesa/drivers/dri/s3v/s3v_dri.h b/src/mesa/drivers/dri/s3v/s3v_dri.h deleted file mode 100644 index 339c579f7f..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_dri.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Author: Max Lingua - */ - -#ifndef _S3V_DRI -#define _S3V_DRI - -#include "s3v_common.h" - -#define S3V_MAX_DRAWABLES (S3V_DMA_BUF_NR/2) /* 32 */ /* 256 */ /* FIXME */ - -typedef struct -{ - int deviceID; - int width; - int height; - int mem; - int cpp; - int bitsPerPixel; - - int fbOffset; - int fbStride; - - int logTextureGranularity; - int textureOffset; - - drm_handle_t regs; - drmSize regsSize; - - unsigned int sarea_priv_offset; -/* - drmAddress regsMap; - - drmSize textureSize; - drm_handle_t textures; -*/ - -#if 0 - drm_handle_t agp_buffers; - drmSize agp_buf_size; -#endif - -/* - drmBufMapPtr drmBufs; - int irq; - unsigned int sarea_priv_offset; -*/ - -/* FIXME: cleanup ! */ - - drmSize registerSize; /* == S3V_MMIO_REGSIZE */ - drm_handle_t registerHandle; - - drmSize pciSize; - drm_handle_t pciMemHandle; - - drmSize frontSize; /* == videoRambytes */ -/* drm_handle_t frontHandle; */ - unsigned long frontOffset; /* == fbOffset */ - int frontPitch; -/* unsigned char *front; */ - - unsigned int bufferSize; /* size of depth/back buffer */ - - drmSize backSize; -/* drm_handle_t backHandle; */ - unsigned long backOffset; - int backPitch; -/* unsigned char *back; */ - - drmSize depthSize; -/* drm_handle_t depthHandle; */ - unsigned long depthOffset; - int depthPitch; -/* unsigned char *depth; */ - - drmSize texSize; -/* drm_handle_t texHandle; */ - unsigned long texOffset; - int texPitch; -/* unsigned char *tex; */ - - drmSize dmaBufSize; /* Size of buffers (in bytes) */ - drm_handle_t dmaBufHandle; /* Handle from drmAddMap */ - unsigned long dmaBufOffset; /* Offset/Start */ - int dmaBufPitch; /* Pitch */ - unsigned char *dmaBuf; /* Map */ - int bufNumBufs; /* Number of buffers */ - drmBufMapPtr buffers; /* Buffer map */ - -} S3VDRIRec, *S3VDRIPtr; - -/* WARNING: Do not change the SAREA structure without changing the kernel - * as well */ - -typedef struct { - unsigned char next, prev; /* indices to form a circular LRU */ - unsigned char in_use; /* owned by a client, or free? */ - int age; /* tracked by clients to update local LRU's */ -} S3VTexRegionRec, *S3VTexRegionPtr; - -typedef struct { - unsigned int nbox; - drm_clip_rect_t boxes[S3V_NR_SAREA_CLIPRECTS]; - - /* Maintain an LRU of contiguous regions of texture space. If - * you think you own a region of texture memory, and it has an - * age different to the one you set, then you are mistaken and - * it has been stolen by another client. If global texAge - * hasn't changed, there is no need to walk the list. - * - * These regions can be used as a proxy for the fine-grained - * texture information of other clients - by maintaining them - * in the same lru which is used to age their own textures, - * clients have an approximate lru for the whole of global - * texture space, and can make informed decisions as to which - * areas to kick out. There is no need to choose whether to - * kick out your own texture or someone else's - simply eject - * them all in LRU order. - */ - S3VTexRegionRec texList[S3V_NR_TEX_REGIONS+1]; /* Last elt is sentinal */ - - int texAge; /* last time texture was uploaded */ - - int last_enqueue; /* last time a buffer was enqueued */ - int last_dispatch; /* age of the most recently dispatched buffer */ - int last_quiescent; /* */ - - int ctxOwner; /* last context to upload state */ -} S3VSAREARec, *S3VSAREAPtr; - -typedef struct { - /* Nothing here yet */ - int dummy; -} S3VConfigPrivRec, *S3VConfigPrivPtr; - -typedef struct { - /* Nothing here yet */ - int dummy; -} S3VDRIContextRec, *S3VDRIContextPtr; - - -#endif diff --git a/src/mesa/drivers/dri/s3v/s3v_inithw.c b/src/mesa/drivers/dri/s3v/s3v_inithw.c deleted file mode 100644 index bdc9effb79..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_inithw.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Author: Max Lingua - */ - -#include - -#include "s3v_context.h" - -void s3vInitHW( s3vContextPtr vmesa ) -{ - int i; - static short _reset = 1; - - DEBUG(("vmesa->driDrawable = %p\n", vmesa->driDrawable)); - DEBUG(("stride = %i\n", - vmesa->driScreen->fbWidth*vmesa->s3vScreen->cpp)); - DEBUG(("frontOffset = 0x%x\n", vmesa->s3vScreen->frontOffset)); - DEBUG(("backOffset = 0x%x\n", vmesa->s3vScreen->backOffset)); - DEBUG(("depthOffset = 0x%x\n", vmesa->s3vScreen->depthOffset)); - DEBUG(("textureOffset = 0x%x\n", vmesa->s3vScreen->texOffset)); - -/* if (_reset) { */ -/* ioctl(vmesa->driFd, 0x4a); */ - ioctl(vmesa->driFd, 0x41); /* reset */ - _reset = 0; -/* ioctl(vmesa->driFd, 0x4c); */ -/* } */ - - /* FIXME */ - switch (vmesa->s3vScreen->cpp) { - case 2: - break; - case 4: - break; - } - - /* FIXME for stencil, gid, etc */ - switch (vmesa->DepthSize) { - case 15: - case 16: - break; - case 24: - break; - case 32: - break; - } - - vmesa->FogMode = 1; - vmesa->ClearDepth = 0xffff; - vmesa->x = 0; - vmesa->y = 0; - vmesa->w = 0; - vmesa->h = 0; - vmesa->FrameCount = 0; - vmesa->MatrixMode = GL_MODELVIEW; - vmesa->ModelViewCount = 0; - vmesa->ProjCount = 0; - vmesa->TextureCount = 0; - - - /* FIXME: do we need the following? */ - - for (i = 0; i < 16; i++) - if (i % 5 == 0) - vmesa->ModelView[i] = - vmesa->Proj[i] = - vmesa->ModelViewProj[i] = - vmesa->Texture[i] = 1.0; - else - vmesa->ModelView[i] = - vmesa->Proj[i] = - vmesa->ModelViewProj[i] = - vmesa->Texture[i] = 0.0; - - vmesa->LBWindowBase = vmesa->driScreen->fbWidth * - (vmesa->driScreen->fbHeight - 1); - vmesa->FBWindowBase = vmesa->driScreen->fbWidth * - (vmesa->driScreen->fbHeight - 1); -} diff --git a/src/mesa/drivers/dri/s3v/s3v_lock.c b/src/mesa/drivers/dri/s3v/s3v_lock.c deleted file mode 100644 index 52bb87ecec..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_lock.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Author: Max Lingua - */ - -#include "s3v_context.h" - -#if DEBUG_LOCKING -char *prevLockFile = NULL; -int prevLockLine = 0; -#endif - - -/* Update the hardware state. This is called if another context has - * grabbed the hardware lock, which includes the X server. This - * function also updates the driver's window state after the X server - * moves, resizes or restacks a window -- the change will be reflected - * in the drawable position and clip rects. Since the X server grabs - * the hardware lock when it changes the window state, this routine will - * automatically be called after such a change. - */ -void s3vGetLock( s3vContextPtr vmesa, GLuint flags ) -{ - __DRIdrawablePrivate *dPriv = vmesa->driDrawable; -/* __DRIscreenPrivate *sPriv = vmesa->driScreen; */ - - printf("s3vGetLock <- ***\n"); - - drmGetLock( vmesa->driFd, vmesa->hHWContext, flags ); - - /* The window might have moved, so we might need to get new clip - * rects. - * - * NOTE: This releases and regrabs the hw lock to allow the X server - * to respond to the DRI protocol request for new drawable info. - * Since the hardware state depends on having the latest drawable - * clip rects, all state checking must be done _after_ this call. - */ - /* DRI_VALIDATE_DRAWABLE_INFO( vmesa->display, sPriv, dPriv ); */ - - if ( vmesa->lastStamp != dPriv->lastStamp ) { - vmesa->lastStamp = dPriv->lastStamp; - vmesa->new_state |= S3V_NEW_WINDOW | S3V_NEW_CLIP; - } - - vmesa->numClipRects = dPriv->numClipRects; - vmesa->pClipRects = dPriv->pClipRects; - -#if 0 - vmesa->dirty = ~0; - - if ( sarea->ctxOwner != vmesa->hHWContext ) { - sarea->ctxOwner = vmesa->hHWContext; - vmesa->dirty = S3V_UPLOAD_ALL; - } - - for ( i = 0 ; i < vmesa->lastTexHeap ; i++ ) { - if ( sarea->texAge[i] != vmesa->lastTexAge[i] ) { - s3vAgeTextures( vmesa, i ); - } - } -#endif -} diff --git a/src/mesa/drivers/dri/s3v/s3v_lock.h b/src/mesa/drivers/dri/s3v/s3v_lock.h deleted file mode 100644 index c39d24a38a..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_lock.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Author: Max Lingua - */ - -#ifndef __S3V_LOCK_H__ -#define __S3V_LOCK_H__ - -#include - -extern void s3vGetLock( s3vContextPtr vmesa, GLuint flags ); - -/* Turn DEBUG_LOCKING on to find locking conflicts. - */ -#define DEBUG_LOCKING 0 - -#if DEBUG_LOCKING -extern char *prevLockFile; -extern int prevLockLine; - -#define DEBUG_LOCK() \ - do { \ - prevLockFile = (__FILE__); \ - prevLockLine = (__LINE__); \ - } while (0) - -#define DEBUG_RESET() \ - do { \ - prevLockFile = 0; \ - prevLockLine = 0; \ - } while (0) - -#define DEBUG_CHECK_LOCK() \ - do { \ - if ( prevLockFile ) { \ - fprintf( stderr, \ - "LOCK SET!\n\tPrevious %s:%d\n\tCurrent: %s:%d\n", \ - prevLockFile, prevLockLine, __FILE__, __LINE__ ); \ - exit(1); \ - } \ - } while (0) - -#else - -#define DEBUG_LOCK() -#define DEBUG_RESET() -#define DEBUG_CHECK_LOCK() - -#endif - -/* - * !!! We may want to separate locks from locks with validation. This - * could be used to improve performance for those things commands that - * do not do any drawing !!! - */ - -/* Lock the hardware and validate our state. - */ -#define LOCK_HARDWARE( vmesa ) \ - do { \ - char __ret = 0; \ - DEBUG_CHECK_LOCK(); \ - DRM_CAS( vmesa->driHwLock, vmesa->hHWContext, \ - (DRM_LOCK_HELD | vmesa->hHWContext), __ret ); \ - if ( __ret ) \ - s3vGetLock( vmesa, 0 ); \ - DEBUG_LOCK(); \ - } while (0) - -/* Unlock the hardware. - */ -#define UNLOCK_HARDWARE( vmesa ) \ - do { \ - DRM_UNLOCK( vmesa->driFd, \ - vmesa->driHwLock, \ - vmesa->hHWContext ); \ - DEBUG_RESET(); \ - } while (0) - -#define S3VHW_LOCK( vmesa ) \ - DRM_UNLOCK(vmesa->driFd, vmesa->driHwLock, vmesa->hHWContext); \ - DRM_SPINLOCK(&vmesa->driScreen->pSAREA->drawable_lock, \ - vmesa->driScreen->drawLockID); \ - /* VALIDATE_DRAWABLE_INFO_NO_LOCK(vmesa); */ - -#define S3VHW_UNLOCK( vmesa ) \ - DRM_SPINUNLOCK(&vmesa->driScreen->pSAREA->drawable_lock, \ - vmesa->driScreen->drawLockID); \ - /* VALIDATE_DRAWABLE_INFO_NO_LOCK_POST(vmesa); */ - -#define S3V_SIMPLE_LOCK( vmesa ) \ - ioctl(vmesa->driFd, 0x4a) - -#define S3V_SIMPLE_FLUSH_LOCK( vmesa ) \ - ioctl(vmesa->driFd, 0x4b) - -#define S3V_SIMPLE_UNLOCK( vmesa ) \ - ioctl(vmesa->driFd, 0x4c) - -#endif /* __S3V_LOCK_H__ */ diff --git a/src/mesa/drivers/dri/s3v/s3v_macros.h b/src/mesa/drivers/dri/s3v/s3v_macros.h deleted file mode 100644 index 7e9b4529df..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_macros.h +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Author: Max Lingua - */ - -#ifndef _S3V_MACROS_H_ -#define _S3V_MACROS_H_ - -/**************/ -/* DRI macros */ -/**************/ - -#define GENERIC_DEBUG 0 -#define FLOW_DEBUG 0 -#define DMABUFS_DEBUG 0 - -/* Note: The argument to DEBUG*() _must_ be enclosed in parenthesis */ - -#if (GENERIC_DEBUG || FLOW_DEBUG || DMABUFS_DEBUG) -#include -#endif - -#undef DEBUG -#if GENERIC_DEBUG -#define DEBUG(str) printf str -#else -#define DEBUG(str) -#endif - -#if FLOW_DEBUG -#define DEBUG_WHERE(str) printf str -#else -#define DEBUG_WHERE(str) -#endif - -#if DMABUFS_DEBUG -#define DEBUG_BUFS(str) printf str -#else -#define DEBUG_BUFS(str) -#endif - - -#if 0 -#define S3V_DMA_SEND_FLAGS DRM_DMA_PRIORITY -#define S3V_DMA_SEND_FLAGS DRM_DMA_BLOCK -#else -#define S3V_DMA_SEND_FLAGS 0 -#endif - -#if 0 -#define S3V_DMA_GET_FLAGS \ - (DRM_DMA_SMALLER_OK | DRM_DMA_LARGER_OK | DRM_DMA_WAIT) -#else -#define S3V_DMA_GET_FLAGS DRM_DMA_WAIT -#endif - - -#define DMAOUT_CHECK(reg,len) \ -do { \ - DEBUG(("DMAOUT_CHECK: reg = 0x%x\n", S3V_##reg##_REG)); \ - DEBUG_BUFS(("DMAOUT_CHECK (was): ")); \ - DEBUG_BUFS(("vmesa->bufCount=%i of vmesa->bufSize=%i\n", \ - vmesa->bufCount, vmesa->bufSize)); \ - /* FIXME: > or >= */ \ - if (vmesa->bufCount+(len+1) >= vmesa->bufSize) \ - DMAFLUSH(); \ -\ - vmesa->bufCount += (len+1); \ - DEBUG_BUFS(("DMAOUT_CHECK (is): vmesa->bufCount=%i len=%i, reg=%x\n", \ - vmesa->bufCount, len, S3V_##reg##_REG)); \ - DMAOUT( ((len & 0xffff) | ((S3V_##reg##_REG & 0xfffc) << 14)) ); \ -} while (0) - -#define DMAOUT(val) \ -do { \ - *(vmesa->buf++)=val; \ - DEBUG_BUFS(("DMAOUT: val=0x%x\n", (unsigned int)val)); \ -} while(0) - -#define DMAFINISH() \ -do { \ - /* NOTE: it does nothing - it just prints some summary infos */ \ - DEBUG(("DMAFINISH: vmesa->bufCount=%i\n", vmesa->bufCount)); \ - DEBUG(("buf: index=%i; addr=%p\n", vmesa->bufIndex[vmesa->_bufNum], \ - vmesa->s3vScreen->bufs->list[vmesa->bufIndex[vmesa->_bufNum]].address)); \ -} while(0) - -#define DMAFLUSH() \ -do { \ - if (vmesa->bufCount) { \ - SEND_DMA(vmesa->driFd, vmesa->hHWContext, 1, \ - &vmesa->bufIndex[vmesa->_bufNum], &vmesa->bufCount); \ -/* - GET_DMA(vmesa->driFd, vmesa->hHWContext, 1, \ - &vmesa->bufIndex, &vmesa->bufSize); \ -*/ \ - vmesa->_bufNum = !(vmesa->_bufNum); \ - vmesa->buf = vmesa->_buf[vmesa->_bufNum]; \ -/* - vmesa->buf = \ - vmesa->s3vScreen->bufs->list[vmesa->bufIndex].address; \ -*/ \ - vmesa->bufCount = 0; \ - } \ -} while (0) - -#define CMDCHANGE() \ -do { \ - DMAOUT_CHECK(3DTRI_CMDSET, 1); /* FIXME: TRI/LINE */ \ - DMAOUT(vmesa->CMD); \ - DMAFINISH(); \ -} while (0) - -#ifdef DONT_SEND_DMA -#define GET_DMA(fd, hHWCtx, n, idx, size) -#define SEND_DMA(fd, hHWCtx,n, idx, cnt) -#else -#define GET_DMA(fd, hHWCtx, n, idx, size) \ -do { \ - drmDMAReq dma; \ - int retcode, i; \ -\ - DEBUG(("GET_DMA: ")); \ - DEBUG(("req_count=%i; req_list[#0]=%i; req_size[#0]=%i\n", \ - n, (idx)[n-1], (size)[n-1])); \ -\ - dma.context = (hHWCtx); \ - dma.send_count = 0; \ - dma.send_list = NULL; \ - dma.send_sizes = NULL; \ - dma.flags = S3V_DMA_GET_FLAGS; \ - dma.request_count = (n); \ - dma.request_size = S3V_DMA_BUF_SZ; \ - dma.request_list = (idx); \ - dma.request_sizes = (size); \ -\ - do { \ - if ((retcode = drmDMA((fd), &dma))) { \ - DEBUG_BUFS(("drmDMA (get) returned %d\n", retcode)); \ - } \ -} while (!(dma).granted_count); \ -\ - for (i = 0; i < (n); i++) { \ - DEBUG(("Got buffer %i (index #%i)\n", (idx)[i], i)); \ - DEBUG(("of %i bytes (%i words) size\n", \ - (size)[i], (size)[i] >>2)); \ - /* Convert from bytes to words */ \ - (size)[i] >>= 2; \ - } \ -} while (0) - -#define SEND_DMA(fd, hHWCtx, n, idx, cnt) \ -do { \ - drmDMAReq dma; \ - int retcode, i; \ -\ - DEBUG(("SEND_DMA: ")); \ - DEBUG(("send_count=%i; send_list[#0]=%i; send_sizes[#0]=%i\n", \ - n, (idx)[n-1], (cnt)[n-1])); \ -\ - for (i = 0; i < (n); i++) { \ - /* Convert from words to bytes */ \ - (cnt)[i] <<= 2; \ - } \ -\ - dma.context = (hHWCtx); \ - dma.send_count = (n); \ - dma.send_list = (idx); \ - dma.send_sizes = (cnt); \ - dma.flags = S3V_DMA_SEND_FLAGS; \ - dma.request_count = 0; \ - dma.request_size = 0; \ - dma.request_list = NULL; \ - dma.request_sizes = NULL; \ -\ - if ((retcode = drmDMA((fd), &dma))) { \ - DEBUG_BUFS(("drmDMA (send) returned %d\n", retcode)); \ - } \ -\ - for (i = 0; i < (n); i++) { \ - DEBUG(("Sent buffer %i (index #%i)\n", (idx)[i], i)); \ - DEBUG(("of %i bytes (%i words) size\n", \ - (cnt)[i], (cnt)[i] >>2)); \ - (cnt)[i] = 0; \ - } \ -} while (0) -#endif /* DONT_SEND_DMA */ - -#define GET_FIRST_DMA(fd, hHWCtx, n, idx, size, buf, cnt, vPriv) \ -do { \ - int i; \ - DEBUG_BUFS(("GET_FIRST_DMA\n")); \ - DEBUG_BUFS(("n=%i idx=%i size=%i\n", n, *idx, *size)); \ - DEBUG_BUFS(("going to GET_DMA\n")); \ - GET_DMA(fd, hHWCtx, n, idx, size); \ - DEBUG_BUFS(("coming from GET_DMA\n")); \ - DEBUG_BUFS(("n=%i idx=%i size=%i\n", n, (idx)[0], (size)[0])); \ - for (i = 0; i < (n); i++) { \ - DEBUG_BUFS(("buf #%i @%p\n", \ - i, (vPriv)->bufs->list[(idx)[i]].address)); \ - (buf)[i] = (vPriv)->bufs->list[(idx)[i]].address; \ - (cnt)[i] = 0; \ - } \ - DEBUG(("GOING HOME\n")); \ -} while (0) - -/**************************/ -/* generic, global macros */ -/**************************/ - -#define CALC_LOG2(l2,s) \ -do { \ - int __s = s; \ - l2 = 0; \ - while (__s > 1) { ++l2; __s >>= 1; } \ -} while (0) - -#define PrimType_Null 0x00000000 -#define PrimType_Points 0x10000000 -#define PrimType_Lines 0x20000000 -#define PrimType_LineLoop 0x30000000 -#define PrimType_LineStrip 0x40000000 -#define PrimType_Triangles 0x50000000 -#define PrimType_TriangleStrip 0x60000000 -#define PrimType_TriangleFan 0x70000000 -#define PrimType_Quads 0x80000000 -#define PrimType_QuadStrip 0x90000000 -#define PrimType_Polygon 0xa0000000 -#define PrimType_Mask 0xf0000000 - -#endif /* _S3V_MACROS_H_ */ diff --git a/src/mesa/drivers/dri/s3v/s3v_regs.h b/src/mesa/drivers/dri/s3v/s3v_regs.h deleted file mode 100644 index 26a7c54af5..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_regs.h +++ /dev/null @@ -1,367 +0,0 @@ -/* - * Author: Max Lingua - */ - -#ifndef _S3V_REG_H -#define _S3V_REG_H - -#define S3V_REGS_NUM 256 - -/************ - * DMA REGS * - ************/ - -#define S3V_DMA_ID 0 -#define S3V_DMA_REG 0x8590 -#define S3V_DMA_WRITEP_ID 1 -#define S3V_DMA_WRITEP_REG 0x8594 -#define S3V_DMA_READP_ID 2 -#define S3V_DMA_READP_REG 0x8598 -#define S3V_DMA_ENABLE_ID 3 -#define S3V_DMA_ENABLE_REG 0x859C -#define S3V_DMA_UPDATE_ID 4 -#define S3V_DMA_UPDATE_REG 0x10000 - -/*************** - * STATUS REGS * - ***************/ - -#define S3V_STAT_ID 10 -#define S3V_STAT_REG 0x8504 -#define S3V_STAT_VSYNC_ID 11 -#define S3V_STAT_VSYNC_REG 0x8505 -#define S3V_STAT_3D_DONE_ID 12 -#define S3V_STAT_3D_DONE_REG 0x8506 -#define S3V_STAT_FIFO_OVER_ID 13 -#define S3V_STAT_FIFO_OVER_REG 0x8508 -#define S3V_STAT_FIFO_EMPTY_ID 14 -#define S3V_STAT_FIFO_EMPTY_REG 0x850C -#define S3V_STAT_HDMA_DONE_ID 15 -#define S3V_STAT_HDMA_DONE_REG 0x8514 -#define S3V_STAT_CDMA_DONE_ID 16 -#define S3V_STAT_CDMA_DONE_REG 0x8524 -#define S3V_STAT_3D_FIFO_EMPTY_ID 17 -#define S3V_STAT_3D_FIFO_EMPTY_REG 0x8544 -#define S3V_STAT_LPB_ID 18 -#define S3V_STAT_LPB_REG 0x8584 -#define S3V_STAT_3D_BUSY_ID 19 -#define S3V_STAT_3D_BUSY_REG 0x8704 - -/*********** - * 2D REGS * - ***********/ - -#define S3V_BITBLT_ID 30 -#define S3V_BITBLT_REG 0xA400 -#define S3V_BITBLT_SRC_BASE_ID 31 -#define S3V_BITBLT_SRC_BASE_REG 0xA4D4 -#define S3V_BITBLT_DEST_BASE_ID 32 -#define S3V_BITBLT_DEST_BASE_REG 0xA4D8 -#define S3V_BITBLT_CLIP_L_R_ID 33 -#define S3V_BITBLT_CLIP_L_R_REG 0xA4DC -#define S3V_BITBLT_CLIP_T_B_ID 34 -#define S3V_BITBLT_CLIP_T_B_REG 0xA4E0 -#define S3V_BITBLT_DEST_SRC_STRIDE_ID 35 -#define S3V_BITBLT_DEST_SRC_STRIDE_REG 0xA4E4 -#define S3V_BITBLT_MONO_PAT0_ID 36 -#define S3V_BITBLT_MONO_PAT0_REG 0xA4E8 -#define S3V_BITBLT_MONO_PAT1_ID 37 -#define S3V_BITBLT_MONO_PAT1_REG 0xA4EC -#define S3V_BITBLT_PAT_BG_COLOR_ID 38 -#define S3V_BITBLT_PAT_BG_COLOR_REG 0xA4F0 -#define S3V_BITBLT_PAT_FG_COLOR_ID 39 -#define S3V_BITBLT_PAT_FG_COLOR_REG 0xA4F4 -#define S3V_BITBLT_CMDSET_ID 40 -#define S3V_BITBLT_CMDSET_REG 0xA500 -#define S3V_BITBLT_WIDTH_HEIGHT_ID 41 -#define S3V_BITBLT_WIDTH_HEIGHT_REG 0xA504 -#define S3V_BITBLT_SRC_X_Y_ID 42 -#define S3V_BITBLT_SRC_X_Y_REG 0xA508 -#define S3V_BITBLT_DEST_X_Y_ID 43 -#define S3V_BITBLT_DEST_X_Y_REG 0xA50C -#define S3V_2DLINE_ID 44 -#define S3V_2DLINE_REG 0xA800 -#define S3V_2DPOLY_ID 45 -#define S3V_2DPOLY_REG 0xAC00 - -/*************** - * 3DLINE REGS * - ***************/ -/* base regs */ -#define S3V_3DLINE_ID 50 -#define S3V_3DLINE_REG 0xB000 -#define S3V_3DLINE_Z_BASE_ID 51 -#define S3V_3DLINE_Z_BASE_REG 0xB0D4 -#define S3V_3DLINE_SRC_BASE_ID 52 /* it is the same reg */ -#define S3V_3DLINE_SRC_BASE_REG 0xB0D4 -#define S3V_3DLINE_DEST_BASE_ID 53 -#define S3V_3DLINE_DEST_BASE_REG 0xB0D8 -#define S3V_3DLINE_CLIP_L_R_ID 54 -#define S3V_3DLINE_CLIP_L_R_REG 0xB0DC -#define S3V_3DLINE_CLIP_T_B_ID 55 -#define S3V_3DLINE_CLIP_T_B_REG 0xB0E0 -#define S3V_3DLINE_DEST_SRC_STRIDE_ID 56 -#define S3V_3DLINE_DEST_SRC_STRIDE_REG 0xB0E4 -#define S3V_3DLINE_Z_STRIDE_ID 57 -#define S3V_3DLINE_Z_STRIDE_REG 0xB0E8 -#define S3V_3DLINE_TEX_BASE_ID 58 -#define S3V_3DLINE_TEX_BASE_REG 0xB0EC -#define S3V_3DLINE_TEX_B_COLOR_ID 59 -#define S3V_3DLINE_TEX_B_COLOR_REG 0xB0F0 -#define S3V_3DLINE_FOG_COLOR_ID 60 -#define S3V_3DLINE_FOG_COLOR_REG 0xB0F4 -#define S3V_3DLINE_COLOR0_ID 61 -#define S3V_3DLINE_COLOR0_REG 0xB0F8 -#define S3V_3DLINE_COLOR1_ID 62 -#define S3V_3DLINE_COLOR1_REG 0xB0FC -#define S3V_3DLINE_CMDSET_ID 63 -#define S3V_3DLINE_CMDSET_REG 0xB100 /* special */ -/* tex regs */ -/* FIXME: shouldn't it be a 1D tex for lines? */ -#define S3V_3DLINE_BASEV_ID 64 -#define S3V_3DLINE_BASEV_REG 0xB104 -#define S3V_3DLINE_BASEU_ID 65 -#define S3V_3DLINE_BASEU_REG 0xB108 -#define S3V_3DLINE_WXD_ID 66 -#define S3V_3DLINE_WXD_REG 0xB10C -#define S3V_3DLINE_WYD_ID 67 -#define S3V_3DLINE_WYD_REG 0xB110 -#define S3V_3DLINE_WSTART_ID 68 -#define S3V_3DLINE_WSTART_REG 0xB114 -#define S3V_3DLINE_DXD_ID 69 -#define S3V_3DLINE_DXD_REG 0xB118 -#define S3V_3DLINE_VXD_ID 70 -#define S3V_3DLINE_VXD_REG 0xB11C -#define S3V_3DLINE_UXD_ID 71 -#define S3V_3DLINE_UXD_REG 0xB120 -#define S3V_3DLINE_DYD_ID 72 -#define S3V_3DLINE_DYD_REG 0xB124 -#define S3V_3DLINE_VYD_ID 73 -#define S3V_3DLINE_VYD_REG 0xB128 -#define S3V_3DLINE_UYD_ID 74 -#define S3V_3DLINE_UYD_REG 0xB12C -#define S3V_3DLINE_DSTART_ID 75 -#define S3V_3DLINE_DSTART_REG 0xB130 -#define S3V_3DLINE_VSTART_ID 76 -#define S3V_3DLINE_VSTART_REG 0xB134 -#define S3V_3DLINE_USTART_ID 77 -#define S3V_3DLINE_USTART_REG 0xB138 -/* gourad regs */ -#define S3V_3DLINE_GBD_ID 78 -#define S3V_3DLINE_GBD_REG 0xB144 -#define S3V_3DLINE_ARD_ID 79 -#define S3V_3DLINE_ARD_REG 0xB148 -#define S3V_3DLINE_GS_BS_ID 80 -#define S3V_3DLINE_GS_BS_REG 0xB14C -#define S3V_3DLINE_AS_RS_ID 81 -#define S3V_3DLINE_AS_RS_REG 0xB150 -/* vertex regs */ -#define S3V_3DLINE_DZ_ID 82 -#define S3V_3DLINE_DZ_REG 0xB158 -#define S3V_3DLINE_ZSTART_ID 83 -#define S3V_3DLINE_ZSTART_REG 0xB15C -#define S3V_3DLINE_XEND0_END1_ID 84 -#define S3V_3DLINE_XEND0_END1_REG 0xB16C -#define S3V_3DLINE_DX_ID 85 -#define S3V_3DLINE_DX_REG 0xB170 -#define S3V_3DLINE_XSTART_ID 86 -#define S3V_3DLINE_XSTART_REG 0xB174 -#define S3V_3DLINE_YSTART_ID 87 -#define S3V_3DLINE_YSTART_REG 0xB178 -#define S3V_3DLINE_YCNT_ID 88 -#define S3V_3DLINE_YCNT_REG 0xB17C - -/************** - * 3DTRI REGS * - **************/ -/* base regs */ -#define S3V_3DTRI_ID 100 -#define S3V_3DTRI_REG 0xB400 -#define S3V_3DTRI_Z_BASE_ID 101 -#define S3V_3DTRI_Z_BASE_REG 0xB4D4 -#define S3V_3DTRI_SRC_BASE_ID 102 /* it is the same reg */ -#define S3V_3DTRI_SRC_BASE_REG 0xB4D4 -#define S3V_3DTRI_DEST_BASE_ID 103 -#define S3V_3DTRI_DEST_BASE_REG 0xB4D8 -#define S3V_3DTRI_CLIP_L_R_ID 104 -#define S3V_3DTRI_CLIP_L_R_REG 0xB4DC -#define S3V_3DTRI_CLIP_T_B_ID 105 -#define S3V_3DTRI_CLIP_T_B_REG 0xB4E0 -#define S3V_3DTRI_DEST_SRC_STRIDE_ID 106 -#define S3V_3DTRI_DEST_SRC_STRIDE_REG 0xB4E4 -#define S3V_3DTRI_Z_STRIDE_ID 107 -#define S3V_3DTRI_Z_STRIDE_REG 0xB4E8 -#define S3V_3DTRI_TEX_BASE_ID 108 -#define S3V_3DTRI_TEX_BASE_REG 0xB4EC -#define S3V_3DTRI_TEX_B_COLOR_ID 109 -#define S3V_3DTRI_TEX_B_COLOR_REG 0xB4F0 -#define S3V_3DTRI_FOG_COLOR_ID 110 -#define S3V_3DTRI_FOG_COLOR_REG 0xB4F4 -#define S3V_3DTRI_COLOR0_ID 111 -#define S3V_3DTRI_COLOR0_REG 0xB4F8 -#define S3V_3DTRI_COLOR1_ID 112 -#define S3V_3DTRI_COLOR1_REG 0xB4FC -#define S3V_3DTRI_CMDSET_ID 113 /* special */ -#define S3V_3DTRI_CMDSET_REG 0xB500 -/* tex regs */ -#define S3V_3DTRI_BASEV_ID 114 -#define S3V_3DTRI_BASEV_REG 0xB504 -#define S3V_3DTRI_BASEU_ID 115 -#define S3V_3DTRI_BASEU_REG 0xB508 -#define S3V_3DTRI_WXD_ID 116 -#define S3V_3DTRI_WXD_REG 0xB50C -#define S3V_3DTRI_WYD_ID 117 -#define S3V_3DTRI_WYD_REG 0xB510 -#define S3V_3DTRI_WSTART_ID 118 -#define S3V_3DTRI_WSTART_REG 0xB514 -#define S3V_3DTRI_DXD_ID 119 -#define S3V_3DTRI_DXD_REG 0xB518 -#define S3V_3DTRI_VXD_ID 120 -#define S3V_3DTRI_VXD_REG 0xB51C -#define S3V_3DTRI_UXD_ID 121 -#define S3V_3DTRI_UXD_REG 0xB520 -#define S3V_3DTRI_DYD_ID 122 -#define S3V_3DTRI_DYD_REG 0xB524 -#define S3V_3DTRI_VYD_ID 123 -#define S3V_3DTRI_VYD_REG 0xB528 -#define S3V_3DTRI_UYD_ID 124 -#define S3V_3DTRI_UYD_REG 0xB52C -#define S3V_3DTRI_DSTART_ID 125 -#define S3V_3DTRI_DSTART_REG 0xB530 -#define S3V_3DTRI_VSTART_ID 126 -#define S3V_3DTRI_VSTART_REG 0xB534 -#define S3V_3DTRI_USTART_ID 127 -#define S3V_3DTRI_USTART_REG 0xB538 -/* gourad regs */ -#define S3V_3DTRI_GBX_ID 128 -#define S3V_3DTRI_GBX_REG 0xB53C -#define S3V_3DTRI_ARX_ID 129 -#define S3V_3DTRI_ARX_REG 0xB540 -#define S3V_3DTRI_GBY_ID 130 -#define S3V_3DTRI_GBY_REG 0xB544 -#define S3V_3DTRI_ARY_ID 131 -#define S3V_3DTRI_ARY_REG 0xB548 -#define S3V_3DTRI_GS_BS_ID 132 -#define S3V_3DTRI_GS_BS_REG 0xB54C -#define S3V_3DTRI_AS_RS_ID 133 -#define S3V_3DTRI_AS_RS_REG 0xB550 -/* vertex regs */ -#define S3V_3DTRI_ZXD_ID 134 -#define S3V_3DTRI_ZXD_REG 0xB554 -#define S3V_3DTRI_ZYD_ID 135 -#define S3V_3DTRI_ZYD_REG 0xB558 -#define S3V_3DTRI_ZSTART_ID 136 -#define S3V_3DTRI_ZSTART_REG 0xB55C -#define S3V_3DTRI_TXDELTA12_ID 137 -#define S3V_3DTRI_TXDELTA12_REG 0xB560 -#define S3V_3DTRI_TXEND12_ID 138 -#define S3V_3DTRI_TXEND12_REG 0xB564 -#define S3V_3DTRI_TXDELTA01_ID 139 -#define S3V_3DTRI_TXDELTA01_REG 0xB568 -#define S3V_3DTRI_TXEND01_ID 140 -#define S3V_3DTRI_TXEND01_REG 0xB56C -#define S3V_3DTRI_TXDELTA02_ID 141 -#define S3V_3DTRI_TXDELTA02_REG 0xB570 -#define S3V_3DTRI_TXSTART02_ID 142 -#define S3V_3DTRI_TXSTART02_REG 0xB574 -#define S3V_3DTRI_TYS_ID 143 -#define S3V_3DTRI_TYS_REG 0xB578 -#define S3V_3DTRI_TY01_Y12_ID 144 -#define S3V_3DTRI_TY01_Y12_REG 0xB57C - -/* COMMANDS (to 0xB100 [lines] or 0xB500 [tris]) */ - -/* Auto execute */ -#define AUTO_EXEC_MASK 0x00000001 -#define AUTO_EXEC_OFF (0x0) -#define AUTO_EXEC_ON (0x1) -/* HW clipping */ -#define HW_CLIP_MASK 0x00000002 -#define HW_CLIP_OFF (0x0 << 1) -#define HW_CLIP_ON (0x1 << 1) -/* Destination color */ -#define DEST_COL_MASK 0x0000001c -#define DEST_COL_PAL (0x0 << 2) /* 8 bpp - palettized */ -#define DEST_COL_1555 (0x1 << 2) /* 16 bpp - ZRGB */ -#define DEST_COL_888 (0x2 << 2) /* 24 bpp - RGB */ -/* Texture color */ -#define TEX_COL_MASK 0x000000e0 -#define TEX_COL_ARGB8888 (0x0 << 5) /* 32 bpp - ARGB */ -#define TEX_COL_ARGB4444 (0x1 << 5) /* 16 bpp - ARGB */ -#define TEX_COL_ARGB1555 (0x2 << 5) /* 16 bpp - ARGB */ -#define TEX_COL_ALPHA4 (0x3 << 5) /* 8 bpp - ALPHA4 */ -#define TEX_COL_BLEND4_LOW (0x4 << 5) /* 4 bpp - BLEND4 low nibble */ -#define TEX_COL_BLEND4_HIGH (0x5 << 5) /* 4 bpp - BLEND4 high nibble */ -#define TEX_COL_PAL (0x6 << 5) /* 8 bpp - palettized */ -#define TEX_COL_YUV (0x7 << 5) /* 16 bpp - YUV */ -/* Mipmap level */ -#define MIP_MASK 0x00000f00 -#define MIPMAP_LEVEL(s) (s << 8) /* 8 -> 11 bits */ -/* Texture filtering */ -#define TEX_FILTER_MASK 0x00007000 -#define MIP_NEAREST (0x0 << 12) -#define LINEAR_MIP_NEAREST (0x1 << 12) -#define MIP_LINEAR (0x2 << 12) -#define LINEAR_MIP_LINEAR (0x3 << 12) -#define NEAREST (0x4 << 12) -#define FAST_BILINEAR (0x5 << 12) -#define LINEAR (0x6 << 12) -/* Texture blending */ -#define TEX_BLEND_MAKS 0x00018000 -#define TEX_REFLECT (0x0 << 15) -#define TEX_MODULATE (0x1 << 15) -#define TEX_DECAL (0x2 << 15) -/* Fog */ -#define FOG_MASK 0x00020000 -#define FOG_OFF (0x0 << 17) -#define FOG_ON (0x1 << 17) -/* Alpha blending */ -#define ALPHA_BLEND_MASK 0x000c0000 -#define ALPHA_OFF (0x0 << 18) | (0x0 << 19) -#define ALPHA_TEX (0x2 << 18) -#define ALPHA_SRC (0x3 << 18) -/* Depth compare mode */ -#define Z_MODE_MASK 0x00700000 -#define Z_NEVER (0x0 << 20) -#define Z_GREATER (0x1 << 20) -#define Z_EQUAL (0x2 << 20) -#define Z_GEQUAL (0x3 << 20) -#define Z_LESS (0x4 << 20) -#define Z_NOTEQUAL (0x5 << 20) -#define Z_LEQUAL (0x6 << 20) -#define Z_ALWAYS (0x7 << 20) -/* Depth update */ -#define Z_UPDATE_MASK 0x00800000 -#define Z_UPDATE_OFF (0x0 << 23) /* disable z update */ -#define Z_UPDATE_ON (0x1 << 23) -/* Depth buffering mode */ -#define Z_BUFFER_MASK 0x03000000 -#define Z_BUFFER (0x0 << 24) | (0x0 << 25) -#define Z_MUX_BUF (0x1 << 24) | (0x0 << 25) -#define Z_MUX_DRAW (0x2 << 24) -#define Z_OFF (0x3 << 24) /* no z buffering */ -/* Texture wrapping */ -#define TEX_WRAP_MASK 0x04000000 -#define TEX_WRAP_OFF (0x0 << 26) -#define TEX_WRAP_ON (0x1 << 26) -/* 3d command */ -#define DO_MASK 0x78000000 -#define DO_GOURAUD_TRI (0x0 << 27) -#define DO_TEX_LIT_TRI_OLD (0x1 << 27) -#define DO_TEX_UNLIT_TRI_OLD (0x2 << 27) -#define DO_TEX_LIT_TRI (0x5 << 27) -#define DO_TEX_UNLIT_TRI (0x6 << 27) -#define DO_3D_LINE (0x8 << 27) -#define DO_NOP (0xf << 27) /* turn on autoexec */ -/* status */ -#define CMD_MASK 0x80000000 -#define CMD_2D (0x0 << 31) /* execute a 2d cmd */ -#define CMD_3D (0x1 << 31) /* execute a 3d cmd */ - -/* global masks */ -#define TEX_MASK ( TEX_COL_MASK | TEX_WRAP_MASK | MIP_MASK \ - | TEX_FILTER_MASK | TEX_BLEND_MAKS \ - | TEX_WRAP_MASK ) -#define Z_MASK ( Z_MODE_MASK | Z_UPDATE_MASK | Z_BUFFER_MASK ) - -#endif /* _S3V_REG_H */ diff --git a/src/mesa/drivers/dri/s3v/s3v_render.c b/src/mesa/drivers/dri/s3v/s3v_render.c deleted file mode 100644 index 5023f3c464..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_render.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Author: Max Lingua - */ - -#include "main/glheader.h" -#include "main/context.h" -#include "main/macros.h" -#include "main/mtypes.h" - -#include "tnl/t_context.h" - -#include "s3v_context.h" -#include "s3v_tris.h" -#include "s3v_vb.h" - - -#define HAVE_POINTS 0 -#define HAVE_LINES 0 -#define HAVE_LINE_STRIPS 0 -#define HAVE_TRIANGLES 0 -#define HAVE_TRI_STRIPS 0 -#define HAVE_TRI_STRIP_1 0 -#define HAVE_TRI_FANS 0 -#define HAVE_QUADS 0 -#define HAVE_QUAD_STRIPS 0 -#define HAVE_POLYGONS 0 - -#define HAVE_ELTS 0 - -#if 0 -static void VERT_FALLBACK( GLcontext *ctx, - GLuint start, - GLuint count, - GLuint flags ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); -/* s3vContextPtr vmesa = S3V_CONTEXT(ctx); */ - int _flags; - - DEBUG(("VERT_FALLBACK: flags & PRIM_MODE_MASK = %i\n", - flags & PRIM_MODE_MASK)); - DEBUG(("VERT_FALLBACK: flags=%i PRIM_MODE_MASK=%i\n", - flags, PRIM_MODE_MASK)); -#if 0 - tnl->Driver.Render.PrimitiveNotify( ctx, flags & PRIM_MODE_MASK ); -#endif - tnl->Driver.Render.BuildVertices( ctx, start, count, ~0 ); - - _flags = flags & PRIM_MODE_MASK; - - tnl->Driver.Render.PrimTabVerts[_flags]( ctx, start, count, flags ); - S3V_CONTEXT(ctx)->SetupNewInputs = VERT_BIT_POS; -} -#endif - -static const GLuint hw_prim[GL_POLYGON+1] = { - PrimType_Points, - PrimType_Lines, - PrimType_LineLoop, - PrimType_LineStrip, - PrimType_Triangles, - PrimType_TriangleStrip, - PrimType_TriangleFan, - PrimType_Quads, - PrimType_QuadStrip, - PrimType_Polygon -}; - -static INLINE void s3vStartPrimitive( s3vContextPtr vmesa, GLenum prim ) -{ - __DRIdrawablePrivate *dPriv = vmesa->driDrawable; - - int _hw_prim = hw_prim[prim]; - - DEBUG(("s3vStartPrimitive (new #%i) ", prim)); - - if (_hw_prim != vmesa->restore_primitive) { - - if (prim == 4) { /* TRI */ - DEBUG(("switching to tri\n")); - vmesa->prim_cmd = vmesa->_tri[vmesa->_3d_mode]; - vmesa->alpha_cmd = vmesa->_alpha[vmesa->_3d_mode]; - DMAOUT_CHECK(3DTRI_Z_BASE, 12); - } else if (prim == 1) { /* LINE */ - DEBUG(("switching to line\n")); - vmesa->prim_cmd = DO_3D_LINE; - vmesa->alpha_cmd = vmesa->_alpha[0]; - DMAOUT_CHECK(3DLINE_Z_BASE, 12); - } else { - DEBUG(("Never mind the bollocks!\n")); - } - - DMAOUT(vmesa->s3vScreen->depthOffset & 0x003FFFF8); - DMAOUT(vmesa->DestBase); - /* DMAOUT(vmesa->ScissorLR); */ - /* DMAOUT(vmesa->ScissorTB); */ - DMAOUT( (0 << 16) | (dPriv->w-1) ); - DMAOUT( (0 << 16) | (dPriv->h-1) ); - DMAOUT( (vmesa->SrcStride << 16) | vmesa->TexStride ); - DMAOUT(vmesa->SrcStride); - DMAOUT(vmesa->TexOffset); - DMAOUT(vmesa->TextureBorderColor); - DMAOUT(0); /* FOG */ - DMAOUT(0); - DMAOUT(0); - DMAOUT(vmesa->CMD | vmesa->prim_cmd | vmesa->alpha_cmd); - DMAFINISH(); - } - - vmesa->restore_primitive = _hw_prim; -} - -static INLINE void s3vEndPrimitive( s3vContextPtr vmesa ) -{ -/* GLcontext *ctx = vmesa->glCtx; */ - DEBUG(("s3vEndPrimitive\n")); -} - -#define LOCAL_VARS s3vContextPtr vmesa = S3V_CONTEXT(ctx) -#define INIT( prim ) s3vStartPrimitive( vmesa, prim ) -#define FINISH s3vEndPrimitive( vmesa ) -#define NEW_PRIMITIVE() (void) vmesa -#define NEW_BUFFER() (void) vmesa -#define FIRE_VERTICES() (void) vmesa -#define GET_CURRENT_VB_MAX_VERTS() \ - (vmesa->bufSize - vmesa->bufCount) / 2 -#define GET_SUBSEQUENT_VB_MAX_VERTS() \ - S3V_DMA_BUF_SZ / 2 -/* XXX */ -#define ALLOC_VERTS(nr) NULL -#define EMIT_VERTS(ctx, start, count, buf) NULL -#define FLUSH() s3vEndPrimitive( vmesa ) - -#define TAG(x) s3v_##x - -#include "tnl_dd/t_dd_dmatmp.h" - -/**********************************************************************/ -/* Render pipeline stage */ -/**********************************************************************/ - - -static GLboolean s3v_run_render( GLcontext *ctx, - struct tnl_pipeline_stage *stage ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *VB = &tnl->vb; - GLuint i; - tnl_render_func *tab; - - DEBUG(("s3v_run_render\n")); - - /* FIXME: hw clip */ - if (VB->ClipOrMask || vmesa->RenderIndex != 0) { - DEBUG(("*** CLIPPED in render ***\n")); -#if 1 - return GL_TRUE; /* don't handle clipping here */ -#endif - } - - - /* We don't do elts */ - if (VB->Elts) - return GL_TRUE; - - tab = TAG(render_tab_verts); - - tnl->Driver.Render.Start( ctx ); - - for (i = 0 ; i < VB->PrimitiveCount ; i++ ) - { - GLuint prim = _tnl_translate_prim(&VB->Primitive[i]); - GLuint start = VB->Primitive[i].start; - GLuint length = VB->Primitive[i].count; - - DEBUG(("s3v_run_render (loop=%i) (lenght=%i)\n", i, length)); - - if (length) { - tnl->Driver.Render.BuildVertices( ctx, start, - start+length, ~0 /*stage->inputs*/); /* XXX */ - tnl->Driver.Render.PrimTabVerts[prim & PRIM_MODE_MASK] - ( ctx, start, start + length, prim ); - vmesa->SetupNewInputs = VERT_BIT_POS; - } - } - - tnl->Driver.Render.Finish( ctx ); - - return GL_FALSE; /* finished the pipe */ -} - - - -const struct tnl_pipeline_stage _s3v_render_stage = -{ - "s3v render", - NULL, - NULL, - NULL, - NULL, - s3v_run_render /* run */ -}; diff --git a/src/mesa/drivers/dri/s3v/s3v_screen.c b/src/mesa/drivers/dri/s3v/s3v_screen.c deleted file mode 100644 index f1810597e6..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_screen.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Author: Max Lingua - */ - -#include "s3v_context.h" -#include "s3v_vb.h" -#include "s3v_dri.h" - -s3vScreenPtr s3vCreateScreen( __DRIscreenPrivate *sPriv ) -{ - s3vScreenPtr s3vScreen; - S3VDRIPtr vDRIPriv = (S3VDRIPtr)sPriv->pDevPriv; - -/* int i; */ - - DEBUG(("s3vCreateScreen\n")); - DEBUG(("sPriv->pDevPriv at %p\n", sPriv->pDevPriv)); - DEBUG(("size = %i\n", sizeof(*vDRIPriv))); - - if (sPriv->devPrivSize != sizeof(S3VDRIRec)) { - fprintf(stderr,"\nERROR! sizeof(S3VDRIRec) does not match passed size from device driver\n"); - return GL_FALSE; - } - - /* Allocate the private area */ - s3vScreen = (s3vScreenPtr) CALLOC( sizeof(*s3vScreen) ); - if ( !s3vScreen ) return NULL; - - s3vScreen->regionCount = 4; /* Magic number. Can we fix this? */ - - s3vScreen->regions = _mesa_malloc(s3vScreen->regionCount * - sizeof(s3vRegion)); - DEBUG(("sPriv->fd = %i\nvDRIPriv->dmaBufHandle = %x\n", - sPriv->fd, vDRIPriv->dmaBufHandle)); - - DEBUG(("vDRIPriv->dmaBufSize=%i\nvDRIPriv->dmaBuf=%p\n", - vDRIPriv->dmaBufSize, vDRIPriv->dmaBuf)); - - - /* Get the list of dma buffers */ - s3vScreen->bufs = drmMapBufs(sPriv->fd); - - if (!s3vScreen->bufs) { - DEBUG(("Helter/skelter with drmMapBufs\n")); - return GL_FALSE; - } - - s3vScreen->textureSize = vDRIPriv->texSize; - s3vScreen->logTextureGranularity = vDRIPriv->logTextureGranularity; - s3vScreen->cpp = vDRIPriv->cpp; - s3vScreen->frontOffset = vDRIPriv->frontOffset; - s3vScreen->frontPitch = vDRIPriv->frontPitch; - s3vScreen->backOffset = vDRIPriv->backOffset; - s3vScreen->backPitch = vDRIPriv->frontPitch; /* FIXME: check */ - s3vScreen->depthOffset = vDRIPriv->depthOffset; - s3vScreen->depthPitch = vDRIPriv->frontPitch; - s3vScreen->texOffset = vDRIPriv->texOffset; - - s3vScreen->driScreen = sPriv; - - DEBUG(("vDRIPriv->width =%i; vDRIPriv->deviceID =%x\n", vDRIPriv->width, - vDRIPriv->deviceID)); - DEBUG(("vDRIPriv->mem =%i\n", vDRIPriv->mem)); - DEBUG(("vDRIPriv->fbOffset =%i\n", vDRIPriv->fbOffset)); - DEBUG((" ps3vDRI->fbStride =%i\n", vDRIPriv->fbStride)); - DEBUG(("s3vScreen->cpp = %i\n", s3vScreen->cpp)); - DEBUG(("s3vScreen->backOffset = %x\n", s3vScreen->backOffset)); - DEBUG(("s3vScreen->depthOffset = %x\n", s3vScreen->depthOffset)); - DEBUG(("s3vScreen->texOffset = %x\n", s3vScreen->texOffset)); - DEBUG(("I will return from s3vCreateScreen now\n")); - - DEBUG(("s3vScreen->bufs = 0x%x\n", s3vScreen->bufs)); - return s3vScreen; -} - -/* Destroy the device specific screen private data struct. - */ -void s3vDestroyScreen( __DRIscreenPrivate *sPriv ) -{ - s3vScreenPtr s3vScreen = (s3vScreenPtr)sPriv->private; - - DEBUG(("s3vDestroyScreen\n")); - - /* First, unmap the dma buffers */ -/* - drmUnmapBufs( s3vScreen->bufs ); -*/ - /* Next, unmap all the regions */ -/* while (s3vScreen->regionCount > 0) { - - (void)drmUnmap(s3vScreen->regions[s3vScreen->regionCount].map, - s3vScreen->regions[s3vScreen->regionCount].size); - s3vScreen->regionCount--; - - } - FREE(s3vScreen->regions); */ - if (s3vScreen) - FREE(s3vScreen); -} diff --git a/src/mesa/drivers/dri/s3v/s3v_screen.h b/src/mesa/drivers/dri/s3v/s3v_screen.h deleted file mode 100644 index c49bc8587d..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_screen.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Author: Max Lingua - */ - -#include "main/mtypes.h" - -typedef struct _s3vRegion { - drm_handle_t handle; - drmSize size; - drmAddress map; -} s3vRegion, *s3vRegionPtr; - -typedef struct { - - int regionCount; /* Count of register regions */ - s3vRegion *regions; /* Vector of mapped region info */ - - drmBufMapPtr bufs; /* Map of DMA buffers */ - - __DRIscreenPrivate *driScreen; /* Back pointer to DRI screen */ - - int cpp; - int frontPitch; - int frontOffset; - - int backPitch; - int backOffset; - int backX; - int backY; - - int depthOffset; - int depthPitch; - - int texOffset; - int textureOffset; - int textureSize; - int logTextureGranularity; -} s3vScreenRec, *s3vScreenPtr; - diff --git a/src/mesa/drivers/dri/s3v/s3v_span.c b/src/mesa/drivers/dri/s3v/s3v_span.c deleted file mode 100644 index f9f7c0d1ee..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_span.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Author: Max Lingua - */ - -#include "s3v_context.h" -#include "s3v_lock.h" - -#include "swrast/swrast.h" - -#define _SPANLOCK 1 -#define DBG 0 - -#define LOCAL_VARS \ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); \ - __DRIscreenPrivate *sPriv = vmesa->driScreen; \ - __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \ - driRenderbuffer *drb = (driRenderbuffer *) rb; \ - GLuint cpp = drb->cpp; \ - GLuint pitch = ( (drb->backBuffer) ? \ - ((dPriv->w+31)&~31) * cpp \ - : sPriv->fbWidth * cpp); \ - GLuint height = dPriv->h; \ - char *buf = (char *)(sPriv->pFB + drb->offset \ - + (drb->backBuffer ? 0 : dPriv->x * cpp + dPriv->y * pitch));\ - GLuint p; \ - (void) p - -/* FIXME! Depth/Stencil read/writes don't work ! */ -#define LOCAL_DEPTH_VARS \ - __DRIdrawablePrivate *dPriv = vmesa->driDrawable; \ - __DRIscreenPrivate *sPriv = vmesa->driScreen; \ - driRenderbuffer *drb = (driRenderbuffer *) rb; \ - GLuint pitch = drb->pitch; \ - GLuint height = dPriv->h; \ - char *buf = (char *)(sPriv->pFB + drb->offset); \ - (void) pitch - -#define LOCAL_STENCIL_VARS LOCAL_DEPTH_VARS - -#define Y_FLIP( _y ) (height - _y - 1) - -#if _SPANLOCK /* OK, we lock */ - -#define HW_LOCK() \ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); \ - (void) vmesa; \ - DMAFLUSH(); \ - S3V_SIMPLE_FLUSH_LOCK(vmesa); -#define HW_UNLOCK() S3V_SIMPLE_UNLOCK(vmesa); - -#else /* plz, don't lock */ - -#define HW_LOCK() \ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); \ - (void) vmesa; \ - DMAFLUSH(); -#define HW_UNLOCK() - -#endif - - -/* ================================================================ - * Color buffer - */ - -/* 16 bit, RGB565 color spanline and pixel functions - */ -#define INIT_MONO_PIXEL(p, color) \ - p = S3VIRGEPACKCOLOR555( color[0], color[1], color[2], color[3] ) - -#define WRITE_RGBA( _x, _y, r, g, b, a ) \ -do { \ - *(GLushort *)(buf + _x*2 + _y*pitch) = ((((int)r & 0xf8) << 7) | \ - (((int)g & 0xf8) << 2) | \ - (((int)b & 0xf8) >> 3)); \ - DEBUG(("buf=0x%x drawOffset=0x%x dPriv->x=%i drb->cpp=%i dPriv->y=%i pitch=%i\n", \ - sPriv->pFB, vmesa->drawOffset, dPriv->x, drb->cpp, dPriv->y, pitch)); \ - DEBUG(("dPriv->w = %i\n", dPriv->w)); \ -} while(0) - -#define WRITE_PIXEL( _x, _y, p ) \ - *(GLushort *)(buf + _x*2 + _y*pitch) = p - -#define READ_RGBA( rgba, _x, _y ) \ - do { \ - GLushort p = *(GLushort *)(buf + _x*2 + _y*pitch); \ - rgba[0] = (p >> 7) & 0xf8; \ - rgba[1] = (p >> 2) & 0xf8; \ - rgba[2] = (p << 3) & 0xf8; \ - rgba[3] = 0xff; /* - if ( rgba[0] & 0x08 ) rgba[0] |= 0x07; \ - if ( rgba[1] & 0x04 ) rgba[1] |= 0x03; \ - if ( rgba[2] & 0x08 ) rgba[2] |= 0x07; */ \ - } while (0) - -#define TAG(x) s3v##x##_RGB555 -#include "spantmp.h" - - -/* 32 bit, ARGB8888 color spanline and pixel functions - */ - -#undef INIT_MONO_PIXEL -#define INIT_MONO_PIXEL(p, color) \ - p = PACK_COLOR_8888( color[3], color[0], color[1], color[2] ) - -#define WRITE_RGBA( _x, _y, r, g, b, a ) \ - *(GLuint *)(buf + _x*4 + _y*pitch) = ((b << 0) | \ - (g << 8) | \ - (r << 16) | \ - (a << 24) ) - -#define WRITE_PIXEL( _x, _y, p ) \ - *(GLuint *)(buf + _x*4 + _y*pitch) = p - -#define READ_RGBA( rgba, _x, _y ) \ -do { \ - GLuint p = *(GLuint *)(buf + _x*4 + _y*pitch); \ - rgba[0] = (p >> 16) & 0xff; \ - rgba[1] = (p >> 8) & 0xff; \ - rgba[2] = (p >> 0) & 0xff; \ - rgba[3] = (p >> 24) & 0xff; \ -} while (0) - -#define TAG(x) s3v##x##_ARGB8888 -#include "spantmp.h" - - -/* 16 bit depthbuffer functions. - */ -#define VALUE_TYPE GLushort - -#define WRITE_DEPTH( _x, _y, d ) \ - *(GLushort *)(buf + _x*2 + _y*dPriv->w*2) = d - -#define READ_DEPTH( d, _x, _y ) \ - d = *(GLushort *)(buf + _x*2 + _y*dPriv->w*2); - -#define TAG(x) s3v##x##_z16 -#include "depthtmp.h" - - - - -/* 32 bit depthbuffer functions. - */ -#if 0 -#define VALUE_TYPE GLuint - -#define WRITE_DEPTH( _x, _y, d ) \ - *(GLuint *)(buf + _x*4 + _y*pitch) = d; - -#define READ_DEPTH( d, _x, _y ) \ - d = *(GLuint *)(buf + _x*4 + _y*pitch); - -#define TAG(x) s3v##x##_32 -#include "depthtmp.h" -#endif - - -/* 24/8 bit interleaved depth/stencil functions - */ -#if 0 -#define VALUE_TYPE GLuint - -#define WRITE_DEPTH( _x, _y, d ) { \ - GLuint tmp = *(GLuint *)(buf + _x*4 + _y*pitch); \ - tmp &= 0xff; \ - tmp |= (d) & 0xffffff00; \ - *(GLuint *)(buf + _x*4 + _y*pitch) = tmp; \ -} - -#define READ_DEPTH( d, _x, _y ) \ - d = *(GLuint *)(buf + _x*4 + _y*pitch) & ~0xff - - -#define TAG(x) s3v##x##_24_8 -#include "depthtmp.h" - -#define WRITE_STENCIL( _x, _y, d ) { \ - GLuint tmp = *(GLuint *)(buf + _x*4 + _y*pitch); \ - tmp &= 0xffffff00; \ - tmp |= d & 0xff; \ - *(GLuint *)(buf + _x*4 + _y*pitch) = tmp; \ -} - -#define READ_STENCIL( d, _x, _y ) \ - d = *(GLuint *)(buf + _x*4 + _y*pitch) & 0xff - -#define TAG(x) s3v##x##_24_8 -#include "stenciltmp.h" - -#endif - - -/** - * Plug in the Get/Put routines for the given driRenderbuffer. - */ -void -s3vSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis) -{ - if (drb->Base.InternalFormat == GL_RGBA) { - if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) { - s3vInitPointers_RGB555(&drb->Base); - } - else { - s3vInitPointers_ARGB8888(&drb->Base); - } - } - else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) { - s3vInitDepthPointers_z16(&drb->Base); - } - else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) { - /* not done yet */ - } - else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) { - /* not done yet */ - } -} diff --git a/src/mesa/drivers/dri/s3v/s3v_state.c b/src/mesa/drivers/dri/s3v/s3v_state.c deleted file mode 100644 index 561f42c705..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_state.c +++ /dev/null @@ -1,888 +0,0 @@ -/* - * Author: Max Lingua - */ - -#include "s3v_context.h" -#include "s3v_macros.h" -#include "s3v_dri.h" -#include "main/macros.h" -#include "main/colormac.h" -#include "swrast/swrast.h" -#include "swrast_setup/swrast_setup.h" -#include "vbo/vbo.h" -#include "tnl/tnl.h" - -/* #define DEBUG(str) printf str */ -#define ENABLELIGHTING 0 - - -/* ============================================================= - * Alpha blending - */ - -static void s3vUpdateAlphaMode( GLcontext *ctx ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - uint32_t cmd = vmesa->CMD; - cmd &= ~ALPHA_BLEND_MASK; - - if ( ctx->Color.BlendEnabled ) { - DEBUG(("ctx->Color.AlphaEnabled = 1")); - vmesa->_alpha[0] = ALPHA_SRC; - vmesa->_alpha[1] = vmesa->_alpha_tex; /* FIXME: not all tex modes - support alpha */ - } else { - DEBUG(("ctx->Color.AlphaEnabled = 0")); - vmesa->_alpha[0] = vmesa->_alpha[1] = ALPHA_OFF; - } -#if 1 - if ((cmd & DO_MASK) & DO_3D_LINE) { /* we are drawing 3d lines */ - /* which don't support tex */ - cmd |= vmesa->_alpha[0]; - } else { - cmd |= vmesa->_alpha[vmesa->_3d_mode]; - } - - vmesa->CMD = cmd; /* FIXME: enough? */ -#else - vmesa->restore_primitive = -1; -#endif - -} - -static void s3vDDAlphaFunc( GLcontext *ctx, GLenum func, GLfloat ref ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - - DEBUG(("s3vDDAlphaFunc\n")); - - vmesa->new_state |= S3V_NEW_ALPHA; -} - -static void s3vDDBlendFunc( GLcontext *ctx, GLenum sfactor, GLenum dfactor ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - - DEBUG(("s3vDDBlendFunc\n")); - - vmesa->new_state |= S3V_NEW_ALPHA; -} - -/* ================================================================ - * Buffer clear - */ - -static void s3vDDClear( GLcontext *ctx, GLbitfield mask ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - unsigned int _stride; - GLint cx = ctx->DrawBuffer->_Xmin; - GLint cy = ctx->DrawBuffer->_Ymin; - GLint cw = ctx->DrawBuffer->_Xmax - cx; - GLint ch = ctx->DrawBuffer->_Ymax - cy; - - /* XXX FIX ME: the cx,cy,cw,ch vars are currently ignored! */ - - vmesa->restore_primitive = -1; - - /* Update and emit any new state. We need to do this here to catch - * changes to the masks. - * FIXME: Just update the masks? - */ - - if ( vmesa->new_state ) - s3vDDUpdateHWState( ctx ); - -/* s3vUpdateMasks( ctx ); */ -/* s3vUpdateClipping( ctx ); */ -/* s3vEmitHwState( vmesa ); */ - - -#if 1 /* soft (0)/hw (1)*/ - - DEBUG(("*** s3vDDClear ***\n")); - - DMAOUT_CHECK(BITBLT_SRC_BASE, 15); - DMAOUT(vmesa->SrcBase); - DMAOUT(vmesa->DestBlit); - DMAOUT( vmesa->ScissorLR ); - DMAOUT( vmesa->ScissorTB ); - DMAOUT( (vmesa->SrcStride << 16) | vmesa->SrcStride ); /* FIXME: unify */ - DMAOUT( (~(0)) ); /* masks */ - DMAOUT( (~(0)) ); - DMAOUT(0); - DMAOUT(vmesa->ClearColor); - DMAOUT(0); - DMAOUT(0); - /* FIXME */ - DMAOUT(0x16000122 | 0x5 | (0xF0 << 17)); /* black magic to me */ - DMAOUT(vmesa->ScissorWH); - DMAOUT(vmesa->SrcXY); - DMAOUT(vmesa->DestXY); - DMAFINISH(); - - if (mask & BUFFER_BIT_DEPTH) { /* depth */ - DEBUG(("BUFFER_BIT_DEPTH\n")); - - _stride = ((cw+31)&~31) * 2; /* XXX cw or Buffer->Width??? */ - - DMAOUT_CHECK(BITBLT_SRC_BASE, 15); - DMAOUT(0); - DMAOUT(vmesa->s3vScreen->depthOffset); - DMAOUT( (0 << 16) | cw ); - DMAOUT( (0 << 16) | ch ); - DMAOUT( (vmesa->SrcStride << 16) | vmesa->DestStride ); - DMAOUT( (~(0)) ); /* masks */ - DMAOUT( (~(0)) ); - DMAOUT(0); - DMAOUT(vmesa->ClearDepth); /* 0x7FFF */ - /* FIXME */ - DMAOUT(0); - DMAOUT(0); - DMAOUT(0x16000122 | 0x5 | (0xF0 << 17)); - DMAOUT( ((cw-1) << 16) | (ch-1) ); - DMAOUT(0); - DMAOUT( (0 << 16) | 0 ); - DMAFINISH(); - - DEBUG(("vmesa->ClearDepth = 0x%x\n", vmesa->ClearDepth)); - mask &= ~BUFFER_BIT_DEPTH; - } - - if (!vmesa->NotClipped) { - DEBUG(("vmesa->NotClipped\n")); /* yes */ - } - - if (!(vmesa->EnabledFlags & S3V_BACK_BUFFER)) { - DEBUG(("!S3V_BACK_BUFFER -> flush\n")); - DMAFLUSH(); - } -/* - if ( mask ) - DEBUG(("still masked ;3(\n")); */ /* yes */ -#else - _swrast_Clear( ctx, mask ); -#endif -} - -/* ============================================================= - * Depth testing - */ - -static void s3vUpdateZMode( GLcontext *ctx ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - uint32_t cmd = vmesa->CMD; - - DEBUG(("Depth.Test = %i\n", ctx->Depth.Test)); - DEBUG(("CMD was = 0x%x ", cmd)); - -/* printf("depth --- CMD was = 0x%x \n", cmd); */ - - cmd &= ~Z_MASK; /* 0xfc0fffff; */ - /* Z_BUFFER */ /* 000 mode */ /* Z_UPDATE_OFF */ - - if (!ctx->Depth.Test) - cmd |= Z_OFF; - - if ( ctx->Depth.Mask ) - cmd |= Z_UPDATE_ON; - - switch ( ctx->Depth.Func ) { - case GL_NEVER: - cmd |= Z_NEVER; - break; - case GL_ALWAYS: - cmd |= Z_ALWAYS; - break; - case GL_LESS: - cmd |= Z_LESS; - break; - case GL_LEQUAL: - cmd |= Z_LEQUAL; - break; - case GL_EQUAL: - cmd |= Z_EQUAL; - break; - case GL_GEQUAL: - cmd |= Z_GEQUAL; - break; - case GL_GREATER: - cmd |= Z_GREATER; - break; - case GL_NOTEQUAL: - cmd |= Z_NOTEQUAL; - break; - } - - DEBUG(("CMD is 0x%x\n", cmd)); - - vmesa->dirty |= S3V_UPLOAD_DEPTH; - vmesa->CMD = cmd; -} - -static void s3vDDDepthFunc( GLcontext *ctx, GLenum func ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - -/* FLUSH_BATCH( vmesa ); */ - DEBUG(("s3vDDDepthFunc\n")); - vmesa->new_state |= S3V_NEW_DEPTH; -} - -static void s3vDDDepthMask( GLcontext *ctx, GLboolean flag ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - - /* FLUSH_BATCH( vmesa ); */ - DEBUG(("s3vDDDepthMask\n")); - vmesa->new_state |= S3V_NEW_DEPTH; -} - -static void s3vDDClearDepth( GLcontext *ctx, GLclampd d ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - - switch ( vmesa->DepthSize ) { - case 15: - case 16: - vmesa->ClearDepth = d * 0x0000ffff; /* 65536 */ - DEBUG(("GLclampd d = %f\n", d)); - DEBUG(("ctx->Depth.Clear = %f\n", ctx->Depth.Clear)); - DEBUG(("(They should be the same)\n")); - break; - case 24: - vmesa->ClearDepth = d * 0x00ffffff; - break; - case 32: - vmesa->ClearDepth = d * 0xffffffff; - break; - } -} - -static void s3vDDFinish( GLcontext *ctx ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - DMAFLUSH(); -} - -static void s3vDDFlush( GLcontext *ctx ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - DMAFLUSH(); -} - -/* ============================================================= - * Fog - */ - -static void s3vUpdateFogAttrib( GLcontext *ctx ) -{ -/* s3vContextPtr vmesa = S3V_CONTEXT(ctx); */ - - if (ctx->Fog.Enabled) { - } else { - } - - switch (ctx->Fog.Mode) { - case GL_LINEAR: - break; - case GL_EXP: - break; - case GL_EXP2: - break; - } -} - -static void s3vDDFogfv( GLcontext *ctx, GLenum pname, const GLfloat *param ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - vmesa->new_state |= S3V_NEW_FOG; -} - -/* ============================================================= - * Lines - */ -static void s3vDDLineWidth( GLcontext *ctx, GLfloat width ) -{ - /* FIXME: on virge you only have one size of 3d lines * - * if we wanted more, we should start using tris instead * - * but virge has problem with some tris when all of the * - * vertices stay on a line */ -} - -/* ============================================================= - * Points - */ -static void s3vDDPointSize( GLcontext *ctx, GLfloat size ) -{ - /* FIXME: we use 3d line to fake points. So same limitations - * as above apply */ -} - -/* ============================================================= - * Polygon - */ - -static void s3vUpdatePolygon( GLcontext *ctx ) -{ - /* FIXME: I don't think we could do much here */ - - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - vmesa->dirty |= S3V_UPLOAD_POLYGON; -} - -/* ============================================================= - * Clipping - */ - -static void s3vUpdateClipping( GLcontext *ctx ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = vmesa->driDrawable; - - int x0,y0,x1,y1; - - DEBUG((">>> s3vUpdateClipping <<<\n")); -/* - if ( vmesa->driDrawable ) { - DEBUG(("s3vUpdateClipping\n")); -*/ - if (vmesa->EnabledFlags & S3V_BACK_BUFFER) { - DEBUG(("S3V_BACK_BUFFER\n")); - - x0 = 0; - y0 = 0; - x1 = dPriv->w - 1; - y1 = dPriv->h - 1; - - vmesa->SrcBase = 0; - vmesa->DestBase = vmesa->s3vScreen->backOffset; - vmesa->DestBlit = vmesa->DestBase; - vmesa->ScissorLR = ( (0 << 16) | (dPriv->w-1) ); - vmesa->ScissorTB = ( (0 << 16) | (dPriv->h-1) ); -/* - vmesa->ScissorLR = ( (x0 << 16) | x1 ); - vmesa->ScissorTB = ( (y0 << 16) | y1 ); -*/ - vmesa->SrcStride = ( ((dPriv->w+31)&~31) * vmesa->s3vScreen->cpp ); - vmesa->DestStride = vmesa->driScreen->fbWidth*vmesa->s3vScreen->cpp; - vmesa->ScissorWH = ( (dPriv->w << 16) | dPriv->h ); - vmesa->SrcXY = 0; -/* vmesa->DestXY = ( (dPriv->x << 16) | dPriv->y ); */ - vmesa->DestXY = ( (0 << 16) | 0 ); - } else { - DEBUG(("S3V_FRONT_BUFFER\n")); - - x0 = dPriv->x; - y0 = dPriv->y; - x1 = x0 + dPriv->w - 1; - y1 = y0 + dPriv->h - 1; - - vmesa->SrcBase = 0; - vmesa->DestBase = 0; - vmesa->ScissorLR = ( (x0 << 16) | x1 ); - vmesa->ScissorTB = ( (y0 << 16) | y1 ); - vmesa->DestStride = vmesa->driScreen->fbWidth*vmesa->s3vScreen->cpp; - vmesa->SrcStride = vmesa->DestStride; - vmesa->DestBase = (y0 * vmesa->DestStride) - + x0*vmesa->s3vScreen->cpp; - vmesa->DestBlit = 0; - vmesa->ScissorWH = ( (x1 << 16) | y1 ); - vmesa->SrcXY = 0; - vmesa->DestXY = ( (0 << 16) | 0 ); -/* vmesa->DestXY = ( (dPriv->x << 16) | dPriv->y ); */ - } - - DEBUG(("x0=%i y0=%i x1=%i y1=%i\n", x0, y0, x1, y1)); - DEBUG(("stride=%i rectWH=0x%x\n\n", vmesa->DestStride, vmesa->ScissorWH)); - - /* FIXME: how could we use the following info? */ - /* if (ctx->Scissor.Enabled) {} */ - - vmesa->dirty |= S3V_UPLOAD_CLIP; -/* } */ -} - -static void s3vDDScissor( GLcontext *ctx, - GLint x, GLint y, GLsizei w, GLsizei h ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - - DEBUG((">>> s3vDDScissor <<<")); - /* FLUSH_BATCH( vmesa ); */ - vmesa->new_state |= S3V_NEW_CLIP; -} - -/* ============================================================= - * Culling - */ - -static void s3vUpdateCull( GLcontext *ctx ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - GLfloat backface_sign = 1; - - DEBUG(("s3vUpdateCull\n")); - /* FIXME: GL_FRONT_AND_BACK */ - - switch ( ctx->Polygon.CullFaceMode ) { - case GL_BACK: - if (ctx->Polygon.FrontFace == GL_CCW) - backface_sign = -1; - break; - - case GL_FRONT: - if (ctx->Polygon.FrontFace != GL_CCW) - backface_sign = -1; - break; - - default: - break; - } - - vmesa->backface_sign = backface_sign; - vmesa->dirty |= S3V_UPLOAD_GEOMETRY; -} - - -static void s3vDDCullFace( GLcontext *ctx, GLenum mode ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - /* FLUSH_BATCH( vmesa ); */ - vmesa->new_state |= S3V_NEW_CULL; -} - -static void s3vDDFrontFace( GLcontext *ctx, GLenum mode ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - /* FLUSH_BATCH( vmesa ); */ - vmesa->new_state |= S3V_NEW_CULL; -} - -/* ============================================================= - * Masks - */ - -static void s3vUpdateMasks( GLcontext *ctx ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - - GLuint mask = s3vPackColor( vmesa->s3vScreen->cpp, - ctx->Color.ColorMask[RCOMP], - ctx->Color.ColorMask[GCOMP], - ctx->Color.ColorMask[BCOMP], - ctx->Color.ColorMask[ACOMP] ); - - if (vmesa->s3vScreen->cpp == 2) mask |= mask << 16; - - /* FIXME: can we do something in virge? */ -} -/* -static void s3vDDColorMask( GLcontext *ctx, GLboolean r, GLboolean g, - GLboolean b, GLboolean a) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - - FLUSH_BATCH( vmesa ); - vmesa->new_state |= S3V_NEW_MASKS; -} -*/ -/* ============================================================= - * Rendering attributes - */ - -/* ============================================================= - * Miscellaneous - */ - -static void s3vDDClearColor( GLcontext *ctx, const GLfloat color[4]) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - - DEBUG(("*** s3vDDClearColor\n")); - - vmesa->ClearColor = s3vPackColor( 2, /* vmesa->s3vScreen->cpp, */ - color[0], color[1], color[2], color[3] ); - -#if 0 - if (vmesa->s3vScreen->cpp == 2) vmesa->ClearColor |= vmesa->ClearColor<<16; -#endif -} - -static void s3vDDSetDrawBuffer( GLcontext *ctx, GLenum mode ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - int found = GL_TRUE; - - DEBUG(("*** s3vDDSetDrawBuffer ***\n")); - - /* FLUSH_BATCH( vmesa ); */ - - switch ( mode ) { - case GL_FRONT_LEFT: - vmesa->drawOffset = vmesa->s3vScreen->frontOffset; - break; - case GL_BACK_LEFT: - vmesa->drawOffset = vmesa->s3vScreen->backOffset; - /* vmesa->driScreen->fbHeight * - * vmesa->driScreen->fbWidth * - * vmesa->s3vScreen->cpp; */ - break; - default: - found = GL_FALSE; - break; - } - - DEBUG(("vmesa->drawOffset = 0x%x\n", vmesa->drawOffset)); -/* return GL_TRUE; */ -} - -/* ============================================================= - * Window position and viewport transformation - */ - -void s3vUpdateWindow( GLcontext *ctx ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = vmesa->driDrawable; - GLfloat xoffset = (GLfloat)dPriv->x; - GLfloat yoffset = - vmesa->driScreen->fbHeight - (GLfloat)dPriv->y - dPriv->h; - const GLfloat *v = ctx->Viewport._WindowMap.m; - - GLfloat sx = v[MAT_SX]; - GLfloat tx = v[MAT_TX] + xoffset; - GLfloat sy = v[MAT_SY]; - GLfloat ty = v[MAT_TY] + yoffset; - GLfloat sz = v[MAT_SZ] * vmesa->depth_scale; - GLfloat tz = v[MAT_TZ] * vmesa->depth_scale; - - vmesa->dirty |= S3V_UPLOAD_VIEWPORT; - - vmesa->ViewportScaleX = sx; - vmesa->ViewportScaleY = sy; - vmesa->ViewportScaleZ = sz; - vmesa->ViewportOffsetX = tx; - vmesa->ViewportOffsetY = ty; - vmesa->ViewportOffsetZ = tz; -} - - -/* -static void s3vDDViewport( GLcontext *ctx, GLint x, GLint y, - GLsizei width, GLsizei height ) -{ - s3vUpdateWindow( ctx ); -} - -static void s3vDDDepthRange( GLcontext *ctx, GLclampd nearval, - GLclampd farval ) -{ - s3vUpdateWindow( ctx ); -} -*/ -void s3vUpdateViewportOffset( GLcontext *ctx ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = vmesa->driDrawable; - GLfloat xoffset = (GLfloat)dPriv->x; - GLfloat yoffset = - vmesa->driScreen->fbHeight - (GLfloat)dPriv->y - dPriv->h; - const GLfloat *v = ctx->Viewport._WindowMap.m; - - GLfloat tx = v[MAT_TX] + xoffset; - GLfloat ty = v[MAT_TY] + yoffset; - - DEBUG(("*** s3vUpdateViewportOffset ***\n")); - - if ( vmesa->ViewportOffsetX != tx || - vmesa->ViewportOffsetY != ty ) - { - vmesa->ViewportOffsetX = tx; - vmesa->ViewportOffsetY = ty; - - vmesa->new_state |= S3V_NEW_WINDOW; - } - -/* vmesa->new_state |= S3V_NEW_CLIP; */ -} - -/* ============================================================= - * State enable/disable - */ - -static void s3vDDEnable( GLcontext *ctx, GLenum cap, GLboolean state ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - - switch ( cap ) { - case GL_ALPHA_TEST: - case GL_BLEND: - vmesa->new_state |= S3V_NEW_ALPHA; - DEBUG(("s3vDDEnable: GL_BLEND\n")); - break; - - case GL_CULL_FACE: - vmesa->new_state |= S3V_NEW_CULL; - DEBUG(("s3vDDEnable: GL_CULL_FACE\n")); - break; - - case GL_DEPTH_TEST: - vmesa->new_state |= S3V_NEW_DEPTH; - DEBUG(("s3vDDEnable: GL_DEPTH\n")); - break; -#if 0 - case GL_FOG: - vmesa->new_state |= S3V_NEW_FOG; - break; -#endif - - case GL_SCISSOR_TEST: - vmesa->new_state |= S3V_NEW_CLIP; - break; - - case GL_TEXTURE_2D: - DEBUG(("*** GL_TEXTURE_2D: %i\n", state)); - vmesa->_3d_mode = state; - vmesa->restore_primitive = -1; - break; - - default: - return; - } -} - -/* ============================================================= - * State initialization, management - */ - - -/* - * Load the current context's state into the hardware. - * - * NOTE: Be VERY careful about ensuring the context state is marked for - * upload, the only place it shouldn't be uploaded is when the setup - * state has changed in ReducedPrimitiveChange as this comes right after - * a state update. - * - * Blits of any type should always upload the context and masks after - * they are done. - */ -void s3vEmitHwState( s3vContextPtr vmesa ) -{ - if (!vmesa->driDrawable) return; - if (!vmesa->dirty) return; - - DEBUG(("**********************\n")); - DEBUG(("*** s3vEmitHwState ***\n")); - DEBUG(("**********************\n")); - - if (vmesa->dirty & S3V_UPLOAD_VIEWPORT) { - vmesa->dirty &= ~S3V_UPLOAD_VIEWPORT; - DEBUG(("S3V_UPLOAD_VIEWPORT\n")); - } - - if ( (vmesa->dirty & S3V_UPLOAD_POINTMODE) || - (vmesa->dirty & S3V_UPLOAD_LINEMODE) || - (vmesa->dirty & S3V_UPLOAD_TRIMODE) ) { - - } - - if (vmesa->dirty & S3V_UPLOAD_POINTMODE) { - vmesa->dirty &= ~S3V_UPLOAD_POINTMODE; - } - - if (vmesa->dirty & S3V_UPLOAD_LINEMODE) { - vmesa->dirty &= ~S3V_UPLOAD_LINEMODE; - } - - if (vmesa->dirty & S3V_UPLOAD_TRIMODE) { - vmesa->dirty &= ~S3V_UPLOAD_TRIMODE; - } - - if (vmesa->dirty & S3V_UPLOAD_FOG) { - GLchan c[3], col; - UNCLAMPED_FLOAT_TO_RGB_CHAN( c, vmesa->glCtx->Fog.Color ); - DEBUG(("uploading ** FOG **\n")); - col = s3vPackColor(2, c[0], c[1], c[2], 0); - vmesa->dirty &= ~S3V_UPLOAD_FOG; - } - - if (vmesa->dirty & S3V_UPLOAD_DITHER) { - vmesa->dirty &= ~S3V_UPLOAD_DITHER; - } - - if (vmesa->dirty & S3V_UPLOAD_LOGICOP) { - vmesa->dirty &= ~S3V_UPLOAD_LOGICOP; - } - - if (vmesa->dirty & S3V_UPLOAD_CLIP) { - vmesa->dirty &= ~S3V_UPLOAD_CLIP; - DEBUG(("S3V_UPLOAD_CLIP\n")); - DEBUG(("vmesa->ScissorLR: %i\n", vmesa->ScissorLR)); - DEBUG(("vmesa->ScissorTB: %i\n", vmesa->ScissorTB)); - } - - if (vmesa->dirty & S3V_UPLOAD_MASKS) { - vmesa->dirty &= ~S3V_UPLOAD_MASKS; - DEBUG(("S3V_UPLOAD_BLEND\n")); - } - - if (vmesa->dirty & S3V_UPLOAD_ALPHA) { - vmesa->dirty &= ~S3V_UPLOAD_ALPHA; - DEBUG(("S3V_UPLOAD_ALPHA\n")); - } - - if (vmesa->dirty & S3V_UPLOAD_SHADE) { - vmesa->dirty &= ~S3V_UPLOAD_SHADE; - } - - if (vmesa->dirty & S3V_UPLOAD_POLYGON) { - vmesa->dirty &= ~S3V_UPLOAD_POLYGON; - } - - if (vmesa->dirty & S3V_UPLOAD_DEPTH) { - vmesa->dirty &= ~S3V_UPLOAD_DEPTH; - DEBUG(("S3V_UPLOAD_DEPTH: DepthMode = 0x%x08\n", vmesa->DepthMode)); - } - - if (vmesa->dirty & S3V_UPLOAD_GEOMETRY) { - vmesa->dirty &= ~S3V_UPLOAD_GEOMETRY; - } - - if (vmesa->dirty & S3V_UPLOAD_TRANSFORM) { - vmesa->dirty &= ~S3V_UPLOAD_TRANSFORM; - } - - if (vmesa->dirty & S3V_UPLOAD_TEX0) { - s3vTextureObjectPtr curTex = vmesa->CurrentTexObj[0]; - vmesa->dirty &= ~S3V_UPLOAD_TEX0; - DEBUG(("S3V_UPLOAD_TEX0\n")); - if (curTex) { - DEBUG(("S3V_UPLOAD_TEX0: curTex\n")); - } else { - DEBUG(("S3V_UPLOAD_TEX0: !curTex\n")); - } - } -} - -void s3vDDUpdateHWState( GLcontext *ctx ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - - int new_state = vmesa->new_state; - - /* s3vUpdateClipping( ctx ); */ - - if ( new_state ) - { - - vmesa->new_state = 0; - - /* Update the various parts of the context's state. - */ - if ( new_state & S3V_NEW_ALPHA ) - s3vUpdateAlphaMode( ctx ); - - if ( new_state & S3V_NEW_DEPTH ) - s3vUpdateZMode( ctx ); - - if ( new_state & S3V_NEW_FOG ) - s3vUpdateFogAttrib( ctx ); - - if ( new_state & S3V_NEW_CLIP ) - { - DEBUG(("---> going to s3vUpdateClipping\n")); - s3vUpdateClipping( ctx ); - } - - if ( new_state & S3V_NEW_POLYGON ) - s3vUpdatePolygon( ctx ); - - if ( new_state & S3V_NEW_CULL ) - s3vUpdateCull( ctx ); - - if ( new_state & S3V_NEW_MASKS ) - s3vUpdateMasks( ctx ); - - if ( new_state & S3V_NEW_WINDOW ) - s3vUpdateWindow( ctx ); -/* - if ( new_state & S3_NEW_TEXTURE ) - s3vUpdateTextureState( ctx ); -*/ - CMDCHANGE(); - } - - /* HACK ! */ - s3vEmitHwState( vmesa ); -} - - -static void s3vDDUpdateState( GLcontext *ctx, GLuint new_state ) -{ - _swrast_InvalidateState( ctx, new_state ); - _swsetup_InvalidateState( ctx, new_state ); - _vbo_InvalidateState( ctx, new_state ); - _tnl_InvalidateState( ctx, new_state ); - S3V_CONTEXT(ctx)->new_gl_state |= new_state; -} - - -/* Initialize the context's hardware state. - */ -void s3vInitState( s3vContextPtr vmesa ) -{ - vmesa->new_state = 0; -} - -/* Initialize the driver's state functions. - */ -void s3vInitStateFuncs( GLcontext *ctx ) -{ - ctx->Driver.UpdateState = s3vDDUpdateState; - - ctx->Driver.Clear = s3vDDClear; - ctx->Driver.ClearIndex = NULL; - ctx->Driver.ClearColor = s3vDDClearColor; - ctx->Driver.DrawBuffer = s3vDDSetDrawBuffer; - ctx->Driver.ReadBuffer = NULL; /* XXX */ - - ctx->Driver.IndexMask = NULL; - ctx->Driver.ColorMask = NULL; /* s3vDDColorMask; */ /* FIXME */ - - ctx->Driver.AlphaFunc = s3vDDAlphaFunc; /* FIXME */ -#if 0 - ctx->Driver.BlendEquation = NULL; /* s3vDDBlendEquation; */ - ctx->Driver.BlendFunc = s3vDDBlendFunc; /* FIXME */ -#endif - ctx->Driver.BlendFuncSeparate = NULL; /* s3vDDBlendFuncSeparate; */ - ctx->Driver.ClearDepth = s3vDDClearDepth; - ctx->Driver.CullFace = s3vDDCullFace; - ctx->Driver.FrontFace = s3vDDFrontFace; - ctx->Driver.DepthFunc = s3vDDDepthFunc; /* FIXME */ - ctx->Driver.DepthMask = s3vDDDepthMask; /* FIXME */ - ctx->Driver.DepthRange = NULL; /* s3vDDDepthRange; */ - ctx->Driver.Enable = s3vDDEnable; /* FIXME */ - ctx->Driver.Finish = s3vDDFinish; - ctx->Driver.Flush = s3vDDFlush; -#if 1 - ctx->Driver.Fogfv = NULL; /* s3vDDFogfv; */ -#endif - ctx->Driver.Hint = NULL; - ctx->Driver.LineWidth = NULL; /* s3vDDLineWidth; */ - ctx->Driver.LineStipple = NULL; /* s3vDDLineStipple; */ -#if ENABLELIGHTING - ctx->Driver.Lightfv = NULL; /* s3vDDLightfv; */ - - ctx->Driver.LightModelfv = NULL; /* s3vDDLightModelfv; */ -#endif - ctx->Driver.LogicOpcode = NULL; /* s3vDDLogicalOpcode; */ - ctx->Driver.PointSize = NULL; /* s3vDDPointSize; */ - ctx->Driver.PolygonMode = NULL; /* s3vDDPolygonMode; */ - ctx->Driver.PolygonStipple = NULL; /* s3vDDPolygonStipple; */ - ctx->Driver.Scissor = s3vDDScissor; /* ScissorLR / ScissorTB */ - ctx->Driver.ShadeModel = NULL; /* s3vDDShadeModel; */ - ctx->Driver.Viewport = NULL; /* s3vDDViewport; */ -} diff --git a/src/mesa/drivers/dri/s3v/s3v_tex.c b/src/mesa/drivers/dri/s3v/s3v_tex.c deleted file mode 100644 index ec1182f34f..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_tex.c +++ /dev/null @@ -1,548 +0,0 @@ -/* - * Author: Max Lingua - */ - -#include -#include - -#include "main/glheader.h" -#include "main/mtypes.h" -#include "main/simple_list.h" -#include "main/enums.h" -#include "main/mm.h" -#include "main/texstore.h" -#include "main/texformat.h" -#include "main/teximage.h" -#include "swrast/swrast.h" - -#include "s3v_context.h" -#include "s3v_tex.h" - - -extern void s3vSwapOutTexObj(s3vContextPtr vmesa, s3vTextureObjectPtr t); -extern void s3vDestroyTexObj(s3vContextPtr vmesa, s3vTextureObjectPtr t); - -/* -static GLuint s3vComputeLodBias(GLfloat bias) -{ -#if TEX_DEBUG_ON - DEBUG_TEX(("*** s3vComputeLodBias ***\n")); -#endif - return bias; -} -*/ - -static void s3vSetTexWrapping(s3vContextPtr vmesa, - s3vTextureObjectPtr t, - GLenum wraps, GLenum wrapt) -{ - GLuint t0 = t->TextureCMD; - GLuint cmd = vmesa->CMD; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vSetTexWrapping: #%i ***\n", ++times)); -#endif - - - t0 &= ~TEX_WRAP_MASK; - cmd &= ~TEX_WRAP_MASK; - - if ((wraps != GL_CLAMP) || (wrapt != GL_CLAMP)) { - DEBUG(("TEX_WRAP_ON\n")); - t0 |= TEX_WRAP_ON; - cmd |= TEX_WRAP_ON; - } - - cmd |= TEX_WRAP_ON; /* FIXME: broken if off */ - t->TextureCMD = t0; - vmesa->CMD = cmd; -} - - -static void s3vSetTexFilter(s3vContextPtr vmesa, - s3vTextureObjectPtr t, - GLenum minf, GLenum magf) -{ - GLuint t0 = t->TextureCMD; - GLuint cmd = vmesa->CMD; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vSetTexFilter: #%i ***\n", ++times)); -#endif - - t0 &= ~TEX_FILTER_MASK; - cmd &= ~TEX_FILTER_MASK; - - switch (minf) { - case GL_NEAREST: - DEBUG(("GL_NEAREST\n")); - t0 |= NEAREST; - cmd |= NEAREST; - break; - case GL_LINEAR: - DEBUG(("GL_LINEAR\n")); - t0 |= LINEAR; - cmd |= LINEAR; - break; - case GL_NEAREST_MIPMAP_NEAREST: - DEBUG(("GL_MIPMAP_NEAREST\n")); - t0 |= MIP_NEAREST; - cmd |= MIP_NEAREST; - break; - case GL_LINEAR_MIPMAP_NEAREST: - DEBUG(("GL_LINEAR_MIPMAP_NEAREST\n")); - t0 |= LINEAR_MIP_NEAREST; - cmd |= LINEAR_MIP_NEAREST; - break; - case GL_NEAREST_MIPMAP_LINEAR: - DEBUG(("GL_NEAREST_MIPMAP_LINEAR\n")); - t0 |= MIP_LINEAR; - cmd |= MIP_LINEAR; - break; - case GL_LINEAR_MIPMAP_LINEAR: - DEBUG(("GL_LINEAR_MIPMAP_LINEAR\n")); - t0 |= LINEAR_MIP_LINEAR; - cmd |= LINEAR_MIP_LINEAR; - break; - default: - break; - } - /* FIXME: bilinear? */ - -#if 0 - switch (magf) { - case GL_NEAREST: - break; - case GL_LINEAR: - break; - default: - break; - } -#endif - - t->TextureCMD = t0; - - DEBUG(("CMD was = 0x%x\n", vmesa->CMD)); - DEBUG(("CMD is = 0x%x\n", cmd)); - - vmesa->CMD = cmd; - /* CMDCHANGE(); */ -} - - -static void s3vSetTexBorderColor(s3vContextPtr vmesa, - s3vTextureObjectPtr 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]); - -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vSetTexBorderColor: #%i ***\n", ++times)); -#endif - - /*FIXME: it should depend on tex col format */ - /* switch(t0 ... t->TextureColorMode) */ - - /* case TEX_COL_ARGB1555: */ - t->TextureBorderColor = S3VIRGEPACKCOLOR555(c[0], c[1], c[2], c[3]); - - DEBUG(("TextureBorderColor = 0x%x\n", t->TextureBorderColor)); - - vmesa->TextureBorderColor = t->TextureBorderColor; -} - -static void s3vTexParameter( GLcontext *ctx, GLenum target, - struct gl_texture_object *tObj, - GLenum pname, const GLfloat *params ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - s3vTextureObjectPtr t = (s3vTextureObjectPtr) tObj->DriverData; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vTexParameter: #%i ***\n", ++times)); -#endif - - if (!t) return; - - /* Can't do the update now as we don't know whether to flush - * vertices or not. Setting vmesa->new_state means that - * s3vUpdateTextureState() will be called before any triangles are - * rendered. If a statechange has occurred, it will be detected at - * that point, and buffered vertices flushed. - */ - switch (pname) { - case GL_TEXTURE_MIN_FILTER: - case GL_TEXTURE_MAG_FILTER: - s3vSetTexFilter( vmesa, t, tObj->MinFilter, tObj->MagFilter ); - break; - - case GL_TEXTURE_WRAP_S: - case GL_TEXTURE_WRAP_T: - s3vSetTexWrapping( vmesa, t, tObj->WrapS, tObj->WrapT ); - break; - - case GL_TEXTURE_BORDER_COLOR: - s3vSetTexBorderColor( vmesa, t, tObj->BorderColor ); - break; - - case GL_TEXTURE_BASE_LEVEL: - case GL_TEXTURE_MAX_LEVEL: - case GL_TEXTURE_MIN_LOD: - case GL_TEXTURE_MAX_LOD: - /* This isn't the most efficient solution but there doesn't appear to - * be a nice alternative for Virge. Since there's no LOD clamping, - * we just have to rely on loading the right subset of mipmap levels - * to simulate a clamped LOD. - */ - s3vSwapOutTexObj( vmesa, t ); - break; - - default: - return; - } - - if (t == vmesa->CurrentTexObj[0]) - vmesa->dirty |= S3V_UPLOAD_TEX0; - -#if 0 - if (t == vmesa->CurrentTexObj[1]) { - vmesa->dirty |= S3V_UPLOAD_TEX1; - } -#endif -} - - -static void s3vTexEnv( GLcontext *ctx, GLenum target, - GLenum pname, const GLfloat *param ) -{ - s3vContextPtr vmesa = S3V_CONTEXT( ctx ); - GLuint unit = ctx->Texture.CurrentUnit; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vTexEnv: #%i ***\n", ++times)); -#endif - - /* Only one env color. Need a fallback if env colors are different - * and texture setup references env color in both units. - */ - switch (pname) { - case GL_TEXTURE_ENV_COLOR: { - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - GLfloat *fc = texUnit->EnvColor; - GLuint r, g, b, a, col; - CLAMPED_FLOAT_TO_UBYTE(r, fc[0]); - CLAMPED_FLOAT_TO_UBYTE(g, fc[1]); - CLAMPED_FLOAT_TO_UBYTE(b, fc[2]); - CLAMPED_FLOAT_TO_UBYTE(a, fc[3]); - - col = ((a << 24) | - (r << 16) | - (g << 8) | - (b << 0)); - - break; - } - case GL_TEXTURE_ENV_MODE: - vmesa->TexEnvImageFmt[unit] = 0; /* force recalc of env state */ - break; - case GL_TEXTURE_LOD_BIAS_EXT: { -/* - struct gl_texture_object *tObj = - ctx->Texture.Unit[unit]._Current; - - s3vTextureObjectPtr t = (s3vTextureObjectPtr) tObj->DriverData; -*/ - break; - } - default: - break; - } -} - -static void s3vTexImage1D( GLcontext *ctx, GLenum target, GLint level, - GLint internalFormat, - GLint width, GLint border, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *pack, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ) -{ - s3vContextPtr vmesa = S3V_CONTEXT( ctx ); - s3vTextureObjectPtr t = (s3vTextureObjectPtr) texObj->DriverData; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vTexImage1D: #%i ***\n", ++times)); -#endif - -#if 1 - if (t) { -#if _TEXFLUSH - DMAFLUSH(); -#endif - s3vSwapOutTexObj( vmesa, t ); -/* - s3vDestroyTexObj( vmesa, t ); - texObj->DriverData = 0; -*/ - } -#endif - _mesa_store_teximage1d( ctx, target, level, internalFormat, - width, border, format, type, - pixels, pack, texObj, texImage ); -} - -static void s3vTexSubImage1D( GLcontext *ctx, - GLenum target, - GLint level, - GLint xoffset, - GLsizei width, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *pack, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ) -{ - s3vContextPtr vmesa = S3V_CONTEXT( ctx ); - s3vTextureObjectPtr t = (s3vTextureObjectPtr) texObj->DriverData; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vTexSubImage1D: #%i ***\n", ++times)); -#endif - -#if 1 - if (t) { -#if _TEXFLUSH - DMAFLUSH(); -#endif - s3vSwapOutTexObj( vmesa, t ); -/* - s3vDestroyTexObj( vmesa, t ); - texObj->DriverData = 0; -*/ - } -#endif - _mesa_store_texsubimage1d(ctx, target, level, xoffset, width, - format, type, pixels, pack, texObj, - texImage); -} - -static void s3vTexImage2D( GLcontext *ctx, GLenum target, GLint level, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ) -{ - s3vContextPtr vmesa = S3V_CONTEXT( ctx ); - s3vTextureObjectPtr t = (s3vTextureObjectPtr) texObj->DriverData; - -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vTexImage2D: #%i ***\n", ++times)); -#endif - -#if 1 - if (t) { -#if _TEXFLUSH - DMAFLUSH(); -#endif - s3vSwapOutTexObj( vmesa, t ); -/* - s3vDestroyTexObj( vmesa, t ); - texObj->DriverData = 0; -*/ - } -#endif - _mesa_store_teximage2d( ctx, target, level, internalFormat, - width, height, border, format, type, - pixels, packing, texObj, texImage ); -} - -static void s3vTexSubImage2D( GLcontext *ctx, - GLenum target, - GLint level, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ) -{ - s3vContextPtr vmesa = S3V_CONTEXT( ctx ); - s3vTextureObjectPtr t = (s3vTextureObjectPtr) texObj->DriverData; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vTexSubImage2D: #%i ***\n", ++times)); -#endif - -#if 1 - if (t) { -#if _TEXFLUSH - DMAFLUSH(); -#endif - s3vSwapOutTexObj( vmesa, t ); -/* - s3vDestroyTexObj( vmesa, t ); - texObj->DriverData = 0; -*/ - } -#endif - _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width, - height, format, type, pixels, packing, texObj, - texImage); -} - - -static void s3vBindTexture( GLcontext *ctx, GLenum target, - struct gl_texture_object *tObj ) -{ - s3vContextPtr vmesa = S3V_CONTEXT( ctx ); - s3vTextureObjectPtr t = (s3vTextureObjectPtr) tObj->DriverData; - GLuint cmd = vmesa->CMD; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vBindTexture: #%i ***\n", ++times)); -#endif - - if (!t) { -/* - GLfloat bias = ctx->Texture.Unit[ctx->Texture.CurrentUnit].LodBias; -*/ - t = CALLOC_STRUCT(s3v_texture_object_t); - - /* Initialize non-image-dependent parts of the state: - */ - t->globj = tObj; -#if 0 - if (target == GL_TEXTURE_2D) { - } else - if (target == GL_TEXTURE_1D) { - } - -#if X_BYTE_ORDER == X_LITTLE_ENDIAN - t->TextureFormat = (TF_LittleEndian | -#else - t->TextureFormat = (TF_BigEndian | -#endif -#endif - t->dirty_images = ~0; - - tObj->DriverData = t; - make_empty_list( t ); -#if 0 - s3vSetTexWrapping( vmesa, t, tObj->WrapS, tObj->WrapT ); - s3vSetTexFilter( vmesa, t, tObj->MinFilter, tObj->MagFilter ); - s3vSetTexBorderColor( vmesa, t, tObj->BorderColor ); -#endif - } - - cmd = vmesa->CMD & ~MIP_MASK; - vmesa->dirty |= S3V_UPLOAD_TEX0; - vmesa->TexOffset = t->TextureBaseAddr[tObj->BaseLevel]; - vmesa->TexStride = t->Pitch; - cmd |= MIPMAP_LEVEL(t->WidthLog2); - vmesa->CMD = cmd; - vmesa->restore_primitive = -1; -#if 0 - printf("t->TextureBaseAddr[0] = 0x%x\n", t->TextureBaseAddr[0]); - printf("t->TextureBaseAddr[1] = 0x%x\n", t->TextureBaseAddr[1]); - printf("t->TextureBaseAddr[2] = 0x%x\n", t->TextureBaseAddr[2]); -#endif -} - - -static void s3vDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj ) -{ - s3vTextureObjectPtr t = (s3vTextureObjectPtr)tObj->DriverData; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vDeleteTexture: #%i ***\n", ++times)); -#endif - - if (t) { - s3vContextPtr vmesa = S3V_CONTEXT( ctx ); - -#if _TEXFLUSH - if (vmesa) { - DMAFLUSH(); - } -#endif - - s3vDestroyTexObj( vmesa, t ); - tObj->DriverData = 0; - - } -} - -static GLboolean s3vIsTextureResident( GLcontext *ctx, - struct gl_texture_object *tObj ) -{ - s3vTextureObjectPtr t = (s3vTextureObjectPtr)tObj->DriverData; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vIsTextureResident: #%i ***\n", ++times)); -#endif - - return (t && t->MemBlock); -} - -static void s3vInitTextureObjects( GLcontext *ctx ) -{ - /* s3vContextPtr vmesa = S3V_CONTEXT(ctx); */ - struct gl_texture_object *texObj; - GLuint tmp = ctx->Texture.CurrentUnit; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vInitTextureObjects: #%i ***\n", ++times)); -#endif - -#if 1 - ctx->Texture.CurrentUnit = 0; - - texObj = ctx->Texture.Unit[0].CurrentTex[TEXTURE_1D_INDEX]; - s3vBindTexture( ctx, GL_TEXTURE_1D, texObj ); - - texObj = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; - s3vBindTexture( ctx, GL_TEXTURE_2D, texObj ); -#endif - -#if 0 - ctx->Texture.CurrentUnit = 1; - - texObj = ctx->Texture.Unit[1].CurrentTex[TEXTURE_1D_INDEX]; - s3vBindTexture( ctx, GL_TEXTURE_1D, texObj ); - - texObj = ctx->Texture.Unit[1].CurrentTex[TEXTURE_2D_INDEX]; - s3vBindTexture( ctx, GL_TEXTURE_2D, texObj ); -#endif - - ctx->Texture.CurrentUnit = tmp; -} - - -void s3vInitTextureFuncs( GLcontext *ctx ) -{ -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vInitTextureFuncs: #%i ***\n", ++times)); -#endif - - ctx->Driver.TexEnv = s3vTexEnv; - ctx->Driver.TexImage2D = s3vTexImage2D; - ctx->Driver.TexSubImage2D = s3vTexSubImage2D; - ctx->Driver.BindTexture = s3vBindTexture; - ctx->Driver.DeleteTexture = s3vDeleteTexture; - ctx->Driver.TexParameter = s3vTexParameter; - ctx->Driver.UpdateTexturePalette = 0; - ctx->Driver.IsTextureResident = s3vIsTextureResident; - - s3vInitTextureObjects( ctx ); -} diff --git a/src/mesa/drivers/dri/s3v/s3v_tex.h b/src/mesa/drivers/dri/s3v/s3v_tex.h deleted file mode 100644 index a823fe2453..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_tex.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Author: Max Lingua - */ - -#ifndef _S3V_TEX_H -#define _S3V_TEX_H - -#define TEX_DEBUG_ON 0 - -extern void s3vUpdateTexLRU( s3vContextPtr vmesa, s3vTextureObjectPtr t ); - -#if TEX_DEBUG_ON -#define DEBUG_TEX(str) printf str -#else -#define DEBUG_TEX(str) /* str */ -#endif - -#define _TEXFLUSH 1 /* flush before uploading */ -#define _TEXLOCK 1 /* lock before writing new texures to card mem */ - /* if you turn it on you will gain stability and image - quality, but you will loose performance (~10%) */ -#define _TEXFALLBACK 0 /* fallback to software for -big- textures (slow) */ - /* turning this off, you will lose some tex (e.g. mountains - on tuxracer) but you will increase average playability */ - -#define _TEXALIGN 0x00000007 - -#endif diff --git a/src/mesa/drivers/dri/s3v/s3v_texmem.c b/src/mesa/drivers/dri/s3v/s3v_texmem.c deleted file mode 100644 index 705d105f55..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_texmem.c +++ /dev/null @@ -1,582 +0,0 @@ -/* - * Author: Max Lingua - */ - -#include -#include - -#include "main/glheader.h" -#include "main/macros.h" -#include "main/mtypes.h" -#include "main/simple_list.h" -#include "main/enums.h" - -#include "main/mm.h" -#include "s3v_context.h" -#include "s3v_lock.h" -#include "s3v_tex.h" - -void s3vSwapOutTexObj(s3vContextPtr vmesa, s3vTextureObjectPtr t); -void s3vUpdateTexLRU( s3vContextPtr vmesa, s3vTextureObjectPtr t ); - - -void s3vDestroyTexObj(s3vContextPtr vmesa, s3vTextureObjectPtr t) -{ -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vDestroyTexObj: #%i ***\n", ++times)); -#endif - - if (!t) return; - -/* FIXME: useful? */ -#if _TEXFLUSH - if (vmesa) - DMAFLUSH(); -#endif - - /* This is sad - need to sync *in case* we upload a texture - * to this newly free memory... - */ - if (t->MemBlock) { - mmFreeMem(t->MemBlock); - t->MemBlock = 0; - - if (vmesa && t->age > vmesa->dirtyAge) - vmesa->dirtyAge = t->age; - } - - if (t->globj) - t->globj->DriverData = NULL; - - if (vmesa) { - if (vmesa->CurrentTexObj[0] == t) { - vmesa->CurrentTexObj[0] = 0; - vmesa->dirty &= ~S3V_UPLOAD_TEX0; - } - -#if 0 - if (vmesa->CurrentTexObj[1] == t) { - vmesa->CurrentTexObj[1] = 0; - vmesa->dirty &= ~S3V_UPLOAD_TEX1; - } -#endif - } - - remove_from_list(t); - FREE(t); -} - - -void s3vSwapOutTexObj(s3vContextPtr vmesa, s3vTextureObjectPtr t) -{ -/* int i; */ -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vSwapOutTexObj: #%i ***\n", ++times)); -#endif - - if (t->MemBlock) { - - mmFreeMem(t->MemBlock); - t->MemBlock = 0; - - if (t->age > vmesa->dirtyAge) - vmesa->dirtyAge = t->age; - - t->dirty_images = ~0; - move_to_tail(&(vmesa->SwappedOut), t); - } -} - - -/* Upload an image from mesa's internal copy. - */ - -static void s3vUploadTexLevel( s3vContextPtr vmesa, s3vTextureObjectPtr t, - int level ) -{ - __DRIscreenPrivate *sPriv = vmesa->driScreen; - const struct gl_texture_image *image = t->image[level].image; - int i,j; - int l2d; - /* int offset = 0; */ - int words; - GLuint* dest; -#if TEX_DEBUG_ON - static unsigned int times=0; -#endif - if ( !image ) return; - if (image->Data == 0) return; - - DEBUG_TEX(("*** s3vUploadTexLevel: #%i ***\n", ++times)); - DEBUG_TEX(("level = %i\n", level)); - - l2d = 5; /* 32bits per texel == 1<<5 */ -/* - if (level == 0) - ; -*/ - DEBUG_TEX(("t->image[%i].offset = 0x%x\n", - level, t->image[level].offset)); - - t->TextureBaseAddr[level] = (GLuint)(t->BufAddr + t->image[level].offset - + _TEXALIGN) & (GLuint)(~_TEXALIGN); - dest = (GLuint*)(sPriv->pFB + t->TextureBaseAddr[level]); - - DEBUG_TEX(("sPriv->pFB = 0x%x\n", sPriv->pFB)); - DEBUG_TEX(("dest = 0x%x\n", dest)); - DEBUG_TEX(("dest - sPriv->pFB = 0x%x\n", ((int)dest - (int)sPriv->pFB))); - - /* NOTE: we implicitly suppose t->texelBytes == 2 */ - - words = (image->Width * image->Height) >> 1; - - DEBUG_TEX(("\n\n")); - - switch (t->image[level].internalFormat) { - case GL_RGB: - case 3: - { - GLubyte *src = (GLubyte *)image->Data; - - DEBUG_TEX(("GL_RGB:\n")); -/* - if (level == 0) - ; -*/ - /* The UGLY way, and SLOW : use DMA FIXME ! */ - - for (i = 0; i < words; i++) { - unsigned int data; - /* data = PACK_COLOR_565(src[0],src[1],src[2]); */ - data = S3VIRGEPACKCOLOR555(src[0],src[1],src[2],255) - |(S3VIRGEPACKCOLOR555(src[3],src[4],src[5],255)<<16); - - *dest++ = data; - /* src += 3; */ - src +=6; - } - } - break; - - case GL_RGBA: - case 4: - { - GLubyte *src = (GLubyte *)image->Data; - - DEBUG_TEX(("GL_RGBA:\n")); -/* - if (level == 0) - ; -*/ - for (i = 0; i < words; i++) { - unsigned int data; - - /* data = PACK_COLOR_8888(src[0],src[1],src[2],src[3]); */ - data = S3VIRGEPACKCOLOR4444(src[0], src[1],src[2], src[3]) - | (S3VIRGEPACKCOLOR4444(src[4], src[5], src[6], src[7]) << 16); - - *dest++ = data; - /* src += 4; */ - src += 8; - } - } - break; - - case GL_LUMINANCE: - { - GLubyte *src = (GLubyte *)image->Data; - - DEBUG_TEX(("GL_LUMINANCE:\n")); -/* - if (level == 0) - ; -*/ - for (i = 0; i < words; i++) { - unsigned int data; - - /* data = PACK_COLOR_888(src[0],src[0],src[0]); */ - data = S3VIRGEPACKCOLOR4444(src[0],src[0],src[0],src[0]) - | (S3VIRGEPACKCOLOR4444(src[1],src[1],src[1],src[1]) << 16); - - *dest++ = data; - /* src ++; */ - src +=2; - } - } - break; - - case GL_INTENSITY: - { - GLubyte *src = (GLubyte *)image->Data; - - DEBUG_TEX(("GL_INTENSITY:\n")); -/* - if (level == 0) - ; -*/ - for (i = 0; i < words; i++) { - unsigned int data; - - /* data = PACK_COLOR_8888(src[0],src[0],src[0],src[0]); */ - data = S3VIRGEPACKCOLOR4444(src[0],src[0],src[0],src[0]) - | (S3VIRGEPACKCOLOR4444(src[1],src[1],src[1],src[1]) << 16); - - *dest++ = data; - /* src ++; */ - src += 2; - } - } - break; - - case GL_LUMINANCE_ALPHA: - { - GLubyte *src = (GLubyte *)image->Data; - - DEBUG_TEX(("GL_LUMINANCE_ALPHA:\n")); -/* - if (level == 0) - ; -*/ - for (i = 0; i < words; i++) { - unsigned int data; - - /* data = PACK_COLOR_8888(src[0],src[0],src[0],src[1]); */ - data = S3VIRGEPACKCOLOR4444(src[0],src[0],src[0],src[1]) - | (S3VIRGEPACKCOLOR4444(src[2],src[2],src[2],src[3]) << 16); - - *dest++ = data; - /* src += 2; */ - src += 4; - } - } - break; - - case GL_ALPHA: - { - GLubyte *src = (GLubyte *)image->Data; - - DEBUG_TEX(("GL_ALPHA:\n")); -/* - if (level == 0) - ; -*/ - for (i = 0; i < words; i++) { - unsigned int data; - - /* data = PACK_COLOR_8888(255,255,255,src[0]); */ - data = S3VIRGEPACKCOLOR4444(255,255,255,src[0]) - | (S3VIRGEPACKCOLOR4444(255,255,255,src[1]) << 16); - - *dest++ = data; - /* src += 1; */ - src += 2; - } - } - break; - - /* TODO: Translate color indices *now*: - */ - case GL_COLOR_INDEX: - { - - GLubyte *dst = (GLubyte *)(t->BufAddr + t->image[level].offset); - GLubyte *src = (GLubyte *)image->Data; - - DEBUG_TEX(("GL_COLOR_INDEX:\n")); - - for (j = 0 ; j < image->Height ; j++, dst += t->Pitch) { - for (i = 0 ; i < image->Width ; i++) { - dst[i] = src[0]; - src += 1; - } - } - } - break; - - default: - fprintf(stderr, "Not supported texture format %s\n", - _mesa_lookup_enum_by_nr(image->_BaseFormat)); - } - - DEBUG_TEX(("words = %i\n\n", words)); -} - -void s3vPrintLocalLRU( s3vContextPtr vmesa ) -{ - s3vTextureObjectPtr t; - int sz = 1 << (vmesa->s3vScreen->logTextureGranularity); - -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vPrintLocalLRU: #%i ***\n", ++times)); -#endif - - foreach( t, &vmesa->TexObjList ) { - if (!t->globj) - fprintf(stderr, "Placeholder %d at %x sz %x\n", - t->MemBlock->ofs / sz, - t->MemBlock->ofs, - t->MemBlock->size); - else - fprintf(stderr, "Texture at %x sz %x\n", - t->MemBlock->ofs, - t->MemBlock->size); - - } -} - -void s3vPrintGlobalLRU( s3vContextPtr vmesa ) -{ - int i, j; - S3VTexRegionPtr list = vmesa->sarea->texList; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vPrintGlobalLRU: #%i ***\n", ++times)); -#endif - - for (i = 0, j = S3V_NR_TEX_REGIONS ; i < S3V_NR_TEX_REGIONS ; i++) { - fprintf(stderr, "list[%d] age %d next %d prev %d\n", - j, list[j].age, list[j].next, list[j].prev); - j = list[j].next; - if (j == S3V_NR_TEX_REGIONS) break; - } - - if (j != S3V_NR_TEX_REGIONS) - fprintf(stderr, "Loop detected in global LRU\n"); -} - - -void s3vResetGlobalLRU( s3vContextPtr vmesa ) -{ - S3VTexRegionPtr list = vmesa->sarea->texList; - int sz = 1 << vmesa->s3vScreen->logTextureGranularity; - int i; - -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vResetGlobalLRU: #%i ***\n", ++times)); -#endif - - /* (Re)initialize the global circular LRU list. The last element - * in the array (S3V_NR_TEX_REGIONS) is the sentinal. Keeping it - * at the end of the array allows it to be addressed rationally - * when looking up objects at a particular location in texture - * memory. - */ - for (i = 0 ; (i+1) * sz <= vmesa->s3vScreen->textureSize ; i++) { - list[i].prev = i-1; - list[i].next = i+1; - list[i].age = 0; - } - - i--; - list[0].prev = S3V_NR_TEX_REGIONS; - list[i].prev = i-1; - list[i].next = S3V_NR_TEX_REGIONS; - list[S3V_NR_TEX_REGIONS].prev = i; - list[S3V_NR_TEX_REGIONS].next = 0; - vmesa->sarea->texAge = 0; -} - - -void s3vUpdateTexLRU( s3vContextPtr vmesa, s3vTextureObjectPtr t ) -{ -/* - int i; - int logsz = vmesa->s3vScreen->logTextureGranularity; - int start = t->MemBlock->ofs >> logsz; - int end = (t->MemBlock->ofs + t->MemBlock->size - 1) >> logsz; - S3VTexRegionPtr list = vmesa->sarea->texList; -*/ - -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vUpdateTexLRU: #%i ***\n", ++times)); -#endif - - vmesa->texAge = ++vmesa->sarea->texAge; - - /* Update our local LRU - */ - move_to_head( &(vmesa->TexObjList), t ); - - /* Update the global LRU - */ -#if 0 - for (i = start ; i <= end ; i++) { - - list[i].in_use = 1; - list[i].age = vmesa->texAge; - - /* remove_from_list(i) - */ - list[(unsigned)list[i].next].prev = list[i].prev; - list[(unsigned)list[i].prev].next = list[i].next; - - /* insert_at_head(list, i) - */ - list[i].prev = S3V_NR_TEX_REGIONS; - list[i].next = list[S3V_NR_TEX_REGIONS].next; - list[(unsigned)list[S3V_NR_TEX_REGIONS].next].prev = i; - list[S3V_NR_TEX_REGIONS].next = i; - } -#endif -} - - -/* Called for every shared texture region which has increased in age - * since we last held the lock. - * - * Figures out which of our textures have been ejected by other clients, - * and pushes a placeholder texture onto the LRU list to represent - * the other client's textures. - */ -void s3vTexturesGone( s3vContextPtr vmesa, - GLuint offset, - GLuint size, - GLuint in_use ) -{ - s3vTextureObjectPtr t, tmp; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vTexturesGone: #%i ***\n", ++times)); -#endif - - foreach_s ( t, tmp, &vmesa->TexObjList ) { - - if (t->MemBlock->ofs >= offset + size || - t->MemBlock->ofs + t->MemBlock->size <= offset) - continue; - - /* It overlaps - kick it off. Need to hold onto the currently bound - * objects, however. - */ - s3vSwapOutTexObj( vmesa, t ); - } - - if (in_use) { - t = (s3vTextureObjectPtr) calloc(1,sizeof(*t)); - if (!t) return; - - t->MemBlock = mmAllocMem( vmesa->texHeap, size, 0, offset); - insert_at_head( &vmesa->TexObjList, t ); - } - - /* Reload any lost textures referenced by current vertex buffer. - */ -#if 0 - if (vmesa->vertex_buffer) { - int i, j; - - fprintf(stderr, "\n\nreload tex\n"); - - for (i = 0 ; i < vmesa->statenr ; i++) { - for (j = 0 ; j < 2 ; j++) { - s3vTextureObjectPtr t = vmesa->state_tex[j][i]; - if (t) { - if (t->MemBlock == 0) - s3vUploadTexImages( vmesa, t ); - } - } - } - - /* Hard to do this with the lock held: - */ - /* S3V_FIREVERTICES( vmesa ); */ - } -#endif -} - - -/* This is called with the lock held. May have to eject our own and/or - * other client's texture objects to make room for the upload. - */ -void s3vUploadTexImages( s3vContextPtr vmesa, s3vTextureObjectPtr t ) -{ - int i; - int ofs; - int numLevels; -#if TEX_DEBUG_ON - static unsigned int times=0; - static unsigned int try=0; - - DEBUG_TEX(("*** s3vUploadTexImages: #%i ***\n", ++times)); - DEBUG_TEX(("vmesa->texHeap = 0x%x; t->totalSize = %i\n", - (unsigned int)vmesa->texHeap, t->totalSize)); -#endif - - /* Do we need to eject LRU texture objects? - */ - if (!t->MemBlock) { - - while (1) - { - /* int try = 0; */ - DEBUG_TEX(("trying to alloc mem for tex (try %i)\n", ++try)); - - t->MemBlock = mmAllocMem( vmesa->texHeap, t->totalSize, 12, 0 ); - - if (t->MemBlock) - break; - - if (vmesa->TexObjList.prev == vmesa->CurrentTexObj[0]) { -/* || vmesa->TexObjList.prev == vmesa->CurrentTexObj[1]) { - fprintf(stderr, "Hit bound texture in upload\n"); - s3vPrintLocalLRU( vmesa ); */ - return; - } - - if (vmesa->TexObjList.prev == &(vmesa->TexObjList)) { -/* fprintf(stderr, "Failed to upload texture, sz %d\n", - t->totalSize); - mmDumpMemInfo( vmesa->texHeap ); */ - return; - } - - DEBUG_TEX(("swapping out: %p\n", vmesa->TexObjList.prev)); - s3vSwapOutTexObj( vmesa, vmesa->TexObjList.prev ); - } - - ofs = t->MemBlock->ofs; - - t->BufAddr = vmesa->s3vScreen->texOffset + ofs; - - DEBUG_TEX(("ofs = 0x%x\n", ofs)); - DEBUG_TEX(("t->BufAddr = 0x%x\n", t->BufAddr)); - -/* FIXME: check if we need it */ -#if 0 - if (t == vmesa->CurrentTexObj[0]) { - vmesa->dirty |= S3V_UPLOAD_TEX0; - vmesa->restore_primitive = -1; - } -#endif - -#if 0 - if (t == vmesa->CurrentTexObj[1]) - vmesa->dirty |= S3V_UPLOAD_TEX1; -#endif - - s3vUpdateTexLRU( vmesa, t ); - } - -#if 0 - if (vmesa->dirtyAge >= GET_DISPATCH_AGE(vmesa)) - s3vWaitAgeLocked( vmesa, vmesa->dirtyAge ); -#endif - -#if _TEXLOCK - S3V_SIMPLE_FLUSH_LOCK(vmesa); -#endif - numLevels = t->lastLevel - t->firstLevel + 1; - for (i = 0 ; i < numLevels ; i++) - if (t->dirty_images & (1<dirty_images = 0; -#if _TEXLOCK - S3V_SIMPLE_UNLOCK(vmesa); -#endif -} diff --git a/src/mesa/drivers/dri/s3v/s3v_texstate.c b/src/mesa/drivers/dri/s3v/s3v_texstate.c deleted file mode 100644 index 455bae6301..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_texstate.c +++ /dev/null @@ -1,300 +0,0 @@ -/* - * Author: Max Lingua - */ - -#include -#include - -#include "main/glheader.h" -#include "main/macros.h" -#include "main/mtypes.h" -#include "main/simple_list.h" -#include "main/enums.h" - -#include "main/mm.h" -#include "s3v_context.h" -#include "s3v_tex.h" - - -static void s3vSetTexImages( s3vContextPtr vmesa, - struct gl_texture_object *tObj ) -{ - GLuint height, width, pitch, i, /*textureFormat,*/ log_pitch; - s3vTextureObjectPtr t = (s3vTextureObjectPtr) tObj->DriverData; - const struct gl_texture_image *baseImage = tObj->Image[0][tObj->BaseLevel]; - GLint firstLevel, lastLevel, numLevels; - GLint log2Width, log2Height; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vSetTexImages: #%i ***\n", ++times)); -#endif - - t->texelBytes = 2; /* FIXME: always 2 ? */ - - /* Compute which mipmap levels we really want to send to the hardware. - * This depends on the base image size, GL_TEXTURE_MIN_LOD, - * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL. - * Yes, this looks overly complicated, but it's all needed. - */ - if (tObj->MinFilter == GL_LINEAR || tObj->MinFilter == GL_NEAREST) { - firstLevel = lastLevel = tObj->BaseLevel; - } - else { - firstLevel = tObj->BaseLevel + (GLint) (tObj->MinLod + 0.5); - firstLevel = MAX2(firstLevel, tObj->BaseLevel); - lastLevel = tObj->BaseLevel + (GLint) (tObj->MaxLod + 0.5); - lastLevel = MAX2(lastLevel, tObj->BaseLevel); - lastLevel = MIN2(lastLevel, tObj->BaseLevel + baseImage->MaxLog2); - lastLevel = MIN2(lastLevel, tObj->MaxLevel); - lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */ - } - - /* save these values */ - t->firstLevel = firstLevel; - t->lastLevel = lastLevel; - - numLevels = lastLevel - firstLevel + 1; - - log2Width = tObj->Image[0][firstLevel]->WidthLog2; - log2Height = tObj->Image[0][firstLevel]->HeightLog2; - - - /* Figure out the amount of memory required to hold all the mipmap - * levels. Choose the smallest pitch to accomodate the largest - * mipmap: - */ - width = tObj->Image[0][firstLevel]->Width * t->texelBytes; - for (pitch = 32, log_pitch=2 ; pitch < width ; pitch *= 2 ) - log_pitch++; - - /* All images must be loaded at this pitch. Count the number of - * lines required: - */ - for ( height = i = 0 ; i < numLevels ; i++ ) { - t->image[i].image = tObj->Image[0][firstLevel + i]; - t->image[i].offset = height * pitch; - t->image[i].internalFormat = baseImage->_BaseFormat; - height += t->image[i].image->Height; - t->TextureBaseAddr[i] = (t->BufAddr + t->image[i].offset + - _TEXALIGN) & (GLuint)(~_TEXALIGN); - } - - t->Pitch = pitch; - t->WidthLog2 = log2Width; - t->totalSize = height*pitch; - t->max_level = i-1; - vmesa->dirty |= S3V_UPLOAD_TEX0 /* | S3V_UPLOAD_TEX1*/; - vmesa->restore_primitive = -1; - DEBUG(("<><>pitch = TexStride = %i\n", pitch)); - DEBUG(("log2Width = %i\n", log2Width)); - - s3vUploadTexImages( vmesa, t ); -} - -static void s3vUpdateTexEnv( GLcontext *ctx, GLuint unit ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - const struct gl_texture_object *tObj = texUnit->_Current; - const GLuint format = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; -/* - s3vTextureObjectPtr t = (s3vTextureObjectPtr)tObj->DriverData; - GLuint tc; -*/ - GLuint alpha = 0; - GLuint cmd = vmesa->CMD; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vUpdateTexEnv: %i ***\n", ++times)); -#endif - - cmd &= ~TEX_COL_MASK; - cmd &= ~TEX_BLEND_MAKS; -/* cmd &= ~ALPHA_BLEND_MASK; */ - - DEBUG(("format = ")); - - switch (format) { - case GL_RGB: - DEBUG_TEX(("GL_RGB\n")); - cmd |= TEX_COL_ARGB1555; - break; - case GL_LUMINANCE: - DEBUG_TEX(("GL_LUMINANCE\n")); - cmd |= TEX_COL_ARGB4444; - alpha = 1; /* FIXME: check */ - break; - case GL_ALPHA: - DEBUG_TEX(("GL_ALPHA\n")); - cmd |= TEX_COL_ARGB4444; - alpha = 1; - break; - case GL_LUMINANCE_ALPHA: - DEBUG_TEX(("GL_LUMINANCE_ALPHA\n")); - cmd |= TEX_COL_ARGB4444; - alpha = 1; - break; - case GL_INTENSITY: - DEBUG_TEX(("GL_INTENSITY\n")); - cmd |= TEX_COL_ARGB4444; - alpha = 1; - break; - case GL_RGBA: - DEBUG_TEX(("GL_RGBA\n")); - cmd |= TEX_COL_ARGB4444; - alpha = 1; - break; - case GL_COLOR_INDEX: - DEBUG_TEX(("GL_COLOR_INDEX\n")); - cmd |= TEX_COL_PAL; - break; - } - - DEBUG_TEX(("EnvMode = ")); - - switch (texUnit->EnvMode) { - case GL_REPLACE: - DEBUG_TEX(("GL_REPLACE\n")); - cmd |= TEX_REFLECT; /* FIXME */ - vmesa->_tri[1] = DO_TEX_UNLIT_TRI; /* FIXME: white tri hack */ - vmesa->_alpha_tex = ALPHA_TEX /* * alpha */; - break; - case GL_MODULATE: - DEBUG_TEX(("GL_MODULATE\n")); - cmd |= TEX_MODULATE; - vmesa->_tri[1] = DO_TEX_LIT_TRI; -#if 0 - if (alpha) - vmesa->_alpha_tex = ALPHA_TEX /* * alpha */; - else - vmesa->_alpha_tex = ALPHA_SRC /* * alpha */; -#else - vmesa->_alpha_tex = ALPHA_TEX ; -#endif - break; - case GL_ADD: - DEBUG_TEX(("DEBUG_TEX\n")); - /* do nothing ???*/ - break; - case GL_DECAL: - DEBUG_TEX(("GL_DECAL\n")); - cmd |= TEX_DECAL; - vmesa->_tri[1] = DO_TEX_LIT_TRI; - vmesa->_alpha_tex = ALPHA_OFF; - break; - case GL_BLEND: - DEBUG_TEX(("GL_BLEND\n")); - cmd |= TEX_DECAL; - vmesa->_tri[1] = DO_TEX_LIT_TRI; - vmesa->_alpha_tex = ALPHA_OFF; /* FIXME: sure? */ - break; - default: - fprintf(stderr, "unknown tex env mode"); - return; - } - - DEBUG_TEX(("\n\n vmesa->CMD was 0x%x\n", vmesa->CMD)); - DEBUG_TEX(( " vmesa->CMD is 0x%x\n\n", cmd )); - - vmesa->_alpha[1] = vmesa->_alpha_tex; - vmesa->CMD = cmd; /* | MIPMAP_LEVEL(8); */ - vmesa->restore_primitive = -1; -} - -static void s3vUpdateTexUnit( GLcontext *ctx, GLuint unit ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - GLuint cmd = vmesa->CMD; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vUpdateTexUnit: %i ***\n", ++times)); - DEBUG_TEX(("and vmesa->CMD was 0x%x\n", vmesa->CMD)); -#endif - - if (texUnit->_ReallyEnabled == TEXTURE_2D_BIT) - { - struct gl_texture_object *tObj = texUnit->_Current; - s3vTextureObjectPtr t = (s3vTextureObjectPtr)tObj->DriverData; - - /* Upload teximages (not pipelined) - */ - if (t->dirty_images) { -#if _TEXFLUSH - DMAFLUSH(); -#endif - s3vSetTexImages( vmesa, tObj ); - if (!t->MemBlock) { -#if _TEXFALLBACK - FALLBACK( vmesa, S3V_FALLBACK_TEXTURE, GL_TRUE ); -#endif - return; - } - } - - /* Update state if this is a different texture object to last - * time. - */ -#if 1 - if (vmesa->CurrentTexObj[unit] != t) { - vmesa->dirty |= S3V_UPLOAD_TEX0 /* << unit */; - vmesa->CurrentTexObj[unit] = t; - s3vUpdateTexLRU( vmesa, t ); /* done too often */ - } -#endif - - /* Update texture environment if texture object image format or - * texture environment state has changed. - */ - if (tObj->Image[0][tObj->BaseLevel]->_BaseFormat != - vmesa->TexEnvImageFmt[unit]) { - vmesa->TexEnvImageFmt[unit] = tObj->Image[0][tObj->BaseLevel]->_BaseFormat; - s3vUpdateTexEnv( ctx, unit ); - } -#if 1 - cmd = vmesa->CMD & ~MIP_MASK; - vmesa->dirty |= S3V_UPLOAD_TEX0 /* << unit */; - vmesa->CurrentTexObj[unit] = t; - vmesa->TexOffset = t->TextureBaseAddr[tObj->BaseLevel]; - vmesa->TexStride = t->Pitch; - cmd |= MIPMAP_LEVEL(t->WidthLog2); - - DEBUG_TEX(("\n\n>> vmesa->CMD was 0x%x\n", vmesa->CMD)); - DEBUG_TEX(( ">> vmesa->CMD is 0x%x\n\n", cmd )); - DEBUG_TEX(("t->WidthLog2 = %i\n", t->WidthLog2)); - DEBUG_TEX(("MIPMAP_LEVEL(t->WidthLog2) = 0x%x\n", MIPMAP_LEVEL(t->WidthLog2))); - - vmesa->CMD = cmd; - vmesa->restore_primitive = -1; -#endif - } - else if (texUnit->_ReallyEnabled) { /* _ReallyEnabled but != TEXTURE0_2D */ -#if _TEXFALLBACK - FALLBACK( vmesa, S3V_FALLBACK_TEXTURE, GL_TRUE ); -#endif - } - else /*if (vmesa->CurrentTexObj[unit])*/ { /* !_ReallyEnabled */ - vmesa->CurrentTexObj[unit] = 0; - vmesa->TexEnvImageFmt[unit] = 0; - vmesa->dirty &= ~(S3V_UPLOAD_TEX0< - */ - -#include -#include - -#include - -#include "s3v_context.h" -#include "s3v_vb.h" -#include "s3v_tris.h" - -#include "main/glheader.h" -#include "main/mtypes.h" -#include "main/macros.h" -#include "main/colormac.h" - -#include "swrast/swrast.h" -#include "swrast_setup/swrast_setup.h" -#include "tnl/tnl.h" -#include "tnl/t_context.h" -#include "tnl/t_pipeline.h" - - -/*********************************************************************** - * Build hardware rasterization functions * - ***********************************************************************/ - -#define DO_TRI 1 -#define HAVE_RGBA 1 -#define HAVE_SPEC 0 -#define HAVE_BACK_COLORS 0 -#define HAVE_HW_FLATSHADE 1 -#define VERTEX s3vVertex -#define TAB rast_tab - -#define VERT_SET_RGBA( v, c ) \ -do { \ - UNCLAMPED_FLOAT_TO_RGBA_CHAN( v->ub4[4], c); \ -/* *(v->ub4[4]) = c; \ */ \ -} while (0) -#define VERT_COPY_RGBA( v0, v1 ) v0->ui[4] = v1->ui[4] -/* -#define VERT_COPY_RGBA1( v0, v1 ) v0->ui[4] = v1->ui[4] -*/ -#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[4] -#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[4] = color[idx] - -#define S3V_OFFSET_BIT 0x01 -#define S3V_TWOSIDE_BIT 0x02 -#define S3V_UNFILLED_BIT 0x04 -#define S3V_FALLBACK_BIT 0x08 -#define S3V_MAX_TRIFUNC 0x10 - - -static struct { - tnl_points_func points; - tnl_line_func line; - tnl_triangle_func triangle; - tnl_quad_func quad; -} rast_tab[S3V_MAX_TRIFUNC]; - -#define S3V_RAST_CULL_BIT 0x01 -#define S3V_RAST_FLAT_BIT 0x02 -#define S3V_RAST_TEX_BIT 0x04 - -static s3v_point_func s3v_point_tab[0x8]; -static s3v_line_func s3v_line_tab[0x8]; -static s3v_tri_func s3v_tri_tab[0x8]; -static s3v_quad_func s3v_quad_tab[0x8]; - -#define IND (0) -#define TAG(x) x -#include "s3v_tritmp.h" - -#define IND (S3V_RAST_CULL_BIT) -#define TAG(x) x##_cull -#include "s3v_tritmp.h" - -#define IND (S3V_RAST_FLAT_BIT) -#define TAG(x) x##_flat -#include "s3v_tritmp.h" - -#define IND (S3V_RAST_CULL_BIT|S3V_RAST_FLAT_BIT) -#define TAG(x) x##_cull_flat -#include "s3v_tritmp.h" - -#define IND (S3V_RAST_TEX_BIT) -#define TAG(x) x##_tex -#include "s3v_tritmp.h" - -#define IND (S3V_RAST_CULL_BIT|S3V_RAST_TEX_BIT) -#define TAG(x) x##_cull_tex -#include "s3v_tritmp.h" - -#define IND (S3V_RAST_FLAT_BIT|S3V_RAST_TEX_BIT) -#define TAG(x) x##_flat_tex -#include "s3v_tritmp.h" - -#define IND (S3V_RAST_CULL_BIT|S3V_RAST_FLAT_BIT|S3V_RAST_TEX_BIT) -#define TAG(x) x##_cull_flat_tex -#include "s3v_tritmp.h" - -static void init_rast_tab( void ) -{ - DEBUG(("*** init_rast_tab ***\n")); - - s3v_init(); - s3v_init_cull(); - s3v_init_flat(); - s3v_init_cull_flat(); - s3v_init_tex(); - s3v_init_cull_tex(); - s3v_init_flat_tex(); - s3v_init_cull_flat_tex(); -} - -/*********************************************************************** - * Rasterization fallback helpers * - ***********************************************************************/ - - -/* This code is hit only when a mix of accelerated and unaccelerated - * primitives are being drawn, and only for the unaccelerated - * primitives. - */ - -#if 0 -static void -s3v_fallback_quad( s3vContextPtr vmesa, - const s3vVertex *v0, - const s3vVertex *v1, - const s3vVertex *v2, - const s3vVertex *v3 ) -{ - GLcontext *ctx = vmesa->glCtx; - SWvertex v[4]; - s3v_translate_vertex( ctx, v0, &v[0] ); - s3v_translate_vertex( ctx, v1, &v[1] ); - s3v_translate_vertex( ctx, v2, &v[2] ); - s3v_translate_vertex( ctx, v3, &v[3] ); - DEBUG(("s3v_fallback_quad\n")); -/* _swrast_Quad( ctx, &v[0], &v[1], &v[2], &v[3] ); */ -} - -static void -s3v_fallback_tri( s3vContextPtr vmesa, - const s3vVertex *v0, - const s3vVertex *v1, - const s3vVertex *v2 ) -{ - GLcontext *ctx = vmesa->glCtx; - SWvertex v[3]; - s3v_translate_vertex( ctx, v0, &v[0] ); - s3v_translate_vertex( ctx, v1, &v[1] ); - s3v_translate_vertex( ctx, v2, &v[2] ); - DEBUG(("s3v_fallback_tri\n")); -/* _swrast_Triangle( ctx, &v[0], &v[1], &v[2] ); */ -} - -static void -s3v_fallback_line( s3vContextPtr vmesa, - const s3vVertex *v0, - const s3vVertex *v1 ) -{ - GLcontext *ctx = vmesa->glCtx; - SWvertex v[2]; - s3v_translate_vertex( ctx, v0, &v[0] ); - s3v_translate_vertex( ctx, v1, &v[1] ); - DEBUG(("s3v_fallback_line\n")); - _swrast_Line( ctx, &v[0], &v[1] ); -} - -/* -static void -s3v_fallback_point( s3vContextPtr vmesa, - const s3vVertex *v0 ) -{ - GLcontext *ctx = vmesa->glCtx; - SWvertex v[1]; - s3v_translate_vertex( ctx, v0, &v[0] ); - _swrast_Point( ctx, &v[0] ); -} -*/ -#endif - -/*********************************************************************** - * Choose rasterization functions * - ***********************************************************************/ - -#define _S3V_NEW_RASTER_STATE (_NEW_FOG | \ - _NEW_TEXTURE | \ - _DD_NEW_TRI_SMOOTH | \ - _DD_NEW_LINE_SMOOTH | \ - _DD_NEW_POINT_SMOOTH | \ - _DD_NEW_TRI_STIPPLE | \ - _DD_NEW_LINE_STIPPLE) - -#define LINE_FALLBACK (0) -#define TRI_FALLBACK (0) - -static void s3v_nodraw_triangle(GLcontext *ctx, s3vVertex *v0, - s3vVertex *v1, s3vVertex *v2) -{ - (void) (ctx && v0 && v1 && v2); -} - -static void s3v_nodraw_quad(GLcontext *ctx, - s3vVertex *v0, s3vVertex *v1, - s3vVertex *v2, s3vVertex *v3) -{ - (void) (ctx && v0 && v1 && v2 && v3); -} - -void s3vChooseRasterState(GLcontext *ctx); - -void s3vChooseRasterState(GLcontext *ctx) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - GLuint flags = ctx->_TriangleCaps; - GLuint ind = 0; - - DEBUG(("*** s3vChooseRasterState ***\n")); - - if (ctx->Polygon.CullFlag) { - if (ctx->Polygon.CullFaceMode == GL_FRONT_AND_BACK) { - vmesa->draw_tri = (s3v_tri_func)s3v_nodraw_triangle; - vmesa->draw_quad = (s3v_quad_func)s3v_nodraw_quad; - return; - } - ind |= S3V_RAST_CULL_BIT; - /* s3v_update_cullsign(ctx); */ - } /* else vmesa->backface_sign = 0; */ - - if ( flags & DD_FLATSHADE ) - ind |= S3V_RAST_FLAT_BIT; - - if ( ctx->Texture.Unit[0]._ReallyEnabled ) { - ind |= S3V_RAST_TEX_BIT; - } - - DEBUG(("ind = %i\n", ind)); - - vmesa->draw_line = s3v_line_tab[ind]; - vmesa->draw_tri = s3v_tri_tab[ind]; - vmesa->draw_quad = s3v_quad_tab[ind]; - vmesa->draw_point = s3v_point_tab[ind]; - -#if 0 - /* Hook in fallbacks for specific primitives. CURRENTLY DISABLED - */ - - if (flags & LINE_FALLBACK) - vmesa->draw_line = s3v_fallback_line; - - if (flags & TRI_FALLBACK) { - DEBUG(("TRI_FALLBACK\n")); - vmesa->draw_tri = s3v_fallback_tri; - vmesa->draw_quad = s3v_fallback_quad; - } -#endif -} - - - - -/*********************************************************************** - * Macros for t_dd_tritmp.h to draw basic primitives * - ***********************************************************************/ - -#define TRI( v0, v1, v2 ) \ -do { \ - /* - if (DO_FALLBACK) \ - vmesa->draw_tri( vmesa, v0, v1, v2 ); \ - else */ \ - DEBUG(("TRI: max was here\n")); /* \ - s3v_draw_tex_triangle( vmesa, v0, v1, v2 ); */ \ - vmesa->draw_tri( vmesa, v0, v1, v2 ); \ -} while (0) - -#define QUAD( v0, v1, v2, v3 ) \ -do { \ - DEBUG(("QUAD: max was here\n")); \ - vmesa->draw_quad( vmesa, v0, v1, v2, v3 ); \ -} while (0) - -#define LINE( v0, v1 ) \ -do { \ - DEBUG(("LINE: max was here\n")); \ - vmesa->draw_line( vmesa, v0, v1 ); \ -} while (0) - -#define POINT( v0 ) \ -do { \ - vmesa->draw_point( vmesa, v0 ); \ -} while (0) - - -/*********************************************************************** - * Build render functions from dd templates * - ***********************************************************************/ - -/* -#define S3V_OFFSET_BIT 0x01 -#define S3V_TWOSIDE_BIT 0x02 -#define S3V_UNFILLED_BIT 0x04 -#define S3V_FALLBACK_BIT 0x08 -#define S3V_MAX_TRIFUNC 0x10 - - -static struct { - points_func points; - line_func line; - triangle_func triangle; - quad_func quad; -} rast_tab[S3V_MAX_TRIFUNC]; -*/ - -#define DO_FALLBACK (IND & S3V_FALLBACK_BIT) -#define DO_OFFSET (IND & S3V_OFFSET_BIT) -#define DO_UNFILLED (IND & S3V_UNFILLED_BIT) -#define DO_TWOSIDE (IND & S3V_TWOSIDE_BIT) -#define DO_FLAT 0 -#define DO_TRI 1 -#define DO_QUAD 1 -#define DO_LINE 1 -#define DO_POINTS 1 -#define DO_FULL_QUAD 1 - -#define HAVE_RGBA 1 -#define HAVE_SPEC 0 -#define HAVE_BACK_COLORS 0 -#define HAVE_HW_FLATSHADE 1 -#define VERTEX s3vVertex -#define TAB rast_tab - -#define DEPTH_SCALE 1.0 -#define UNFILLED_TRI unfilled_tri -#define UNFILLED_QUAD unfilled_quad -#define VERT_X(_v) _v->v.x -#define VERT_Y(_v) _v->v.y -#define VERT_Z(_v) _v->v.z -#define AREA_IS_CCW( a ) (a > 0) -#define GET_VERTEX(e) (vmesa->verts + (e<vertex_stride_shift)) - -#if 0 -#define VERT_SET_RGBA( v, c ) \ -do { \ -/* UNCLAMPED_FLOAT_TO_RGBA_CHAN( v->ub4[4], c) */ \ -} while (0) - -#define VERT_COPY_RGBA( v0, v1 ) v0->ui[4] = v1->ui[4] -/* -#define VERT_COPY_RGBA1( v0, v1 ) v0->ui[4] = v1->ui[4] -*/ -#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[4] -#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[4] = color[idx] -#endif - -#define LOCAL_VARS(n) \ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); \ - GLuint color[n]; \ - (void) color; - - -/*********************************************************************** - * Helpers for rendering unfilled primitives * - ***********************************************************************/ - -static const GLuint hw_prim[GL_POLYGON+1] = { - PrimType_Points, - PrimType_Lines, - PrimType_Lines, - PrimType_Lines, - PrimType_Triangles, - PrimType_Triangles, - PrimType_Triangles, - PrimType_Triangles, - PrimType_Triangles, - PrimType_Triangles -}; - -static void s3vResetLineStipple( GLcontext *ctx ); -static void s3vRasterPrimitive( GLcontext *ctx, GLuint hwprim ); -static void s3vRenderPrimitive( GLcontext *ctx, GLenum prim ); -/* -extern static void s3v_lines_emit(GLcontext *ctx, GLuint start, GLuint end); -extern static void s3v_tris_emit(GLcontext *ctx, GLuint start, GLuint end); -*/ -#define RASTERIZE(x) if (vmesa->hw_primitive != hw_prim[x]) \ - s3vRasterPrimitive( ctx, hw_prim[x] ) -#define RENDER_PRIMITIVE vmesa->render_primitive -#define TAG(x) x -#define IND S3V_FALLBACK_BIT -#include "tnl_dd/t_dd_unfilled.h" -#undef IND - -/*********************************************************************** - * Generate GL render functions * - ***********************************************************************/ - -#define IND (0) -#define TAG(x) x -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (S3V_OFFSET_BIT) -#define TAG(x) x##_offset -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (S3V_TWOSIDE_BIT) -#define TAG(x) x##_twoside -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (S3V_TWOSIDE_BIT|S3V_OFFSET_BIT) -#define TAG(x) x##_twoside_offset -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (S3V_UNFILLED_BIT) -#define TAG(x) x##_unfilled -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (S3V_OFFSET_BIT|S3V_UNFILLED_BIT) -#define TAG(x) x##_offset_unfilled -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (S3V_TWOSIDE_BIT|S3V_UNFILLED_BIT) -#define TAG(x) x##_twoside_unfilled -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (S3V_TWOSIDE_BIT|S3V_OFFSET_BIT|S3V_UNFILLED_BIT) -#define TAG(x) x##_twoside_offset_unfilled -#include "tnl_dd/t_dd_tritmp.h" - - -static void init_render_tab( void ) -{ - DEBUG(("*** init_render_tab ***\n")); - - init(); - init_offset(); - init_twoside(); - init_twoside_offset(); - init_unfilled(); - init_offset_unfilled(); - init_twoside_unfilled(); - init_twoside_offset_unfilled(); -} - - -/**********************************************************************/ -/* Render unclipped begin/end objects */ -/**********************************************************************/ - -#define VERT(x) (s3vVertex *)(s3vverts + (x << shift)) - -#define RENDER_POINTS( start, count ) \ - DEBUG(("RENDER_POINTS...(ok)\n")); \ - for ( ; start < count ; start++) \ - vmesa->draw_line( vmesa, VERT(start), VERT(start) ) - /* vmesa->draw_point( vmesa, VERT(start) ) */ - -#define RENDER_LINE( v0, v1 ) \ - /* DEBUG(("RENDER_LINE...(ok)\n")); \ */ \ - vmesa->draw_line( vmesa, VERT(v0), VERT(v1) ); \ - DEBUG(("RENDER_LINE...(ok)\n")) - -#define RENDER_TRI( v0, v1, v2 ) \ - DEBUG(("RENDER_TRI...(ok)\n")); \ - vmesa->draw_tri( vmesa, VERT(v0), VERT(v1), VERT(v2) ) - -#define RENDER_QUAD( v0, v1, v2, v3 ) \ - DEBUG(("RENDER_QUAD...(ok)\n")); \ - /* s3v_draw_quad( vmesa, VERT(v0), VERT(v1), VERT(v2),VERT(v3) ) */\ - /* s3v_draw_triangle( vmesa, VERT(v0), VERT(v1), VERT(v2) ); \ - s3v_draw_triangle( vmesa, VERT(v0), VERT(v2), VERT(v3) ) */ \ - vmesa->draw_quad( vmesa, VERT(v0), VERT(v1), VERT(v2), VERT(v3) ) - -#define INIT(x) s3vRenderPrimitive( ctx, x ); -#undef LOCAL_VARS -#define LOCAL_VARS \ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); \ - const GLuint shift = vmesa->vertex_stride_shift; \ - const char *s3vverts = (char *)vmesa->verts; \ - const GLboolean stipple = ctx->Line.StippleFlag; \ - (void) stipple; -#define RESET_STIPPLE if ( stipple ) s3vResetLineStipple( ctx ); -#define RESET_OCCLUSION -#define PRESERVE_VB_DEFS -#define ELT(x) (x) -#define TAG(x) s3v_##x##_verts -#include "tnl_dd/t_dd_rendertmp.h" - - -/**********************************************************************/ -/* Render clipped primitives */ -/**********************************************************************/ - -static void s3vRenderClippedPoly( GLcontext *ctx, const GLuint *elts, - GLuint n ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLuint prim = vmesa->render_primitive; - - DEBUG(("I AM in: s3vRenderClippedPoly\n")); - - /* Render the new vertices as an unclipped polygon. - */ - if (1) - { - GLuint *tmp = VB->Elts; - VB->Elts = (GLuint *)elts; - tnl->Driver.Render.PrimTabElts[GL_POLYGON] - ( ctx, 0, n, PRIM_BEGIN|PRIM_END ); - - VB->Elts = tmp; - } - - /* Restore the render primitive - */ -#if 1 - if (prim != GL_POLYGON) { - DEBUG(("and prim != GL_POLYGON\n")); - tnl->Driver.Render.PrimitiveNotify( ctx, prim ); - } - -#endif -} - -static void s3vRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - /*tnl->Driver.LineFunc = s3v_line_tab[2];*/ /* _swsetup_Line; */ - - DEBUG(("I AM in: s3vRenderClippedLine\n")); - tnl->Driver.Render.Line( ctx, ii, jj ); -} - - -/**********************************************************************/ -/* Choose render functions */ -/**********************************************************************/ - - - -#define _S3V_NEW_RENDERSTATE (_DD_NEW_TRI_UNFILLED | \ - _DD_NEW_TRI_LIGHT_TWOSIDE | \ - _DD_NEW_TRI_OFFSET) - -#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED) - -static void s3vChooseRenderState(GLcontext *ctx) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLuint flags = ctx->_TriangleCaps; - GLuint index = 0; - - DEBUG(("s3vChooseRenderState\n")); - - if (flags & ANY_RASTER_FLAGS) { - if (flags & DD_TRI_LIGHT_TWOSIDE) index |= S3V_TWOSIDE_BIT; - if (flags & DD_TRI_OFFSET) index |= S3V_OFFSET_BIT; - if (flags & DD_TRI_UNFILLED) index |= S3V_UNFILLED_BIT; - } - - DEBUG(("vmesa->RenderIndex = %i\n", vmesa->RenderIndex)); - DEBUG(("index = %i\n", index)); - - if (vmesa->RenderIndex != index) { - vmesa->RenderIndex = index; - - tnl->Driver.Render.Points = rast_tab[index].points; - tnl->Driver.Render.Line = rast_tab[index].line; - tnl->Driver.Render.Triangle = rast_tab[index].triangle; - tnl->Driver.Render.Quad = rast_tab[index].quad; - - if (vmesa->RenderIndex == 0) - tnl->Driver.Render.PrimTabVerts = s3v_render_tab_verts; - else - tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts; - tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts; - tnl->Driver.Render.ClippedLine = s3vRenderClippedLine; - tnl->Driver.Render.ClippedPolygon = s3vRenderClippedPoly; - } -} - - -/**********************************************************************/ -/* High level hooks for t_vb_render.c */ -/**********************************************************************/ - - - -/* Determine the rasterized primitive when not drawing unfilled - * polygons. - * - * Used only for the default render stage which always decomposes - * primitives to trianges/lines/points. For the accelerated stage, - * which renders strips as strips, the equivalent calculations are - * performed in s3v_render.c. - */ - -static void s3vRasterPrimitive( GLcontext *ctx, GLuint hwprim ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); -/* __DRIdrawablePrivate *dPriv = vmesa->driDrawable; */ - GLuint cmd = vmesa->CMD; - - unsigned int _hw_prim = hwprim; - - DEBUG(("s3vRasterPrimitive: hwprim = 0x%x ", _hw_prim)); - -/* printf("* vmesa->CMD = 0x%x\n", vmesa->CMD); */ - - if (vmesa->hw_primitive != _hw_prim) - { - DEBUG(("(new one) ***\n")); - cmd &= ~DO_MASK; - cmd &= ~ALPHA_BLEND_MASK; - vmesa->hw_primitive = _hw_prim; - - if (_hw_prim == PrimType_Triangles) { - /* TRI */ - DEBUG(("->switching to tri\n")); - cmd |= (vmesa->_tri[vmesa->_3d_mode] | vmesa->_alpha[vmesa->_3d_mode]); - } else if (_hw_prim == PrimType_Lines - || _hw_prim == PrimType_Points) { - /* LINE */ - DEBUG(("->switching to line\n")); - cmd |= (DO_3D_LINE | vmesa->_alpha[0]); - } else { - /* ugh? */ - DEBUG(("->switching to your sis'ass\n")); - } - - DEBUG(("\n")); - - vmesa->restore_primitive = _hw_prim; - /* 0xacc16827: good value -> lightened newave!!! */ - vmesa->CMD = cmd; - CMDCHANGE(); - } -} - -static void s3vRenderPrimitive( GLcontext *ctx, GLenum prim ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = vmesa->driDrawable; - GLuint cmd = vmesa->CMD; - - unsigned int _hw_prim = hw_prim[prim]; - - vmesa->render_primitive = prim; - vmesa->hw_primitive = _hw_prim; - - DEBUG(("s3vRenderPrimitive #%i ", prim)); - DEBUG(("_hw_prim = 0x%x\n", _hw_prim)); - -/* printf(" vmesa->CMD = 0x%x\n", vmesa->CMD); */ - - if (_hw_prim != vmesa->restore_primitive) { - DEBUG(("_hw_prim != vmesa->restore_primitive (was 0x%x)\n", - vmesa->restore_primitive)); -#if 1 - cmd &= ~DO_MASK; - cmd &= ~ALPHA_BLEND_MASK; -/* - printf(" cmd = 0x%x\n", cmd); - printf(" vmesa->_3d_mode=%i; vmesa->_tri[vmesa->_3d_mode]=0x%x\n", - vmesa->_3d_mode, vmesa->_tri[vmesa->_3d_mode]); - printf("vmesa->alpha[0] = 0x%x; vmesa->alpha[1] = 0x%x\n", - vmesa->_alpha[0], vmesa->_alpha[1]); -*/ - if (_hw_prim == PrimType_Triangles) { /* TRI */ - DEBUG(("->switching to tri\n")); - cmd |= (vmesa->_tri[vmesa->_3d_mode] | vmesa->_alpha[vmesa->_3d_mode]); - DEBUG(("vmesa->TexStride = %i\n", vmesa->TexStride)); - DEBUG(("vmesa->TexOffset = %i\n", vmesa->TexOffset)); - DMAOUT_CHECK(3DTRI_Z_BASE, 12); - } else { /* LINE */ - DEBUG(("->switching to line\n")); - cmd |= (DO_3D_LINE | vmesa->_alpha[0]); - DMAOUT_CHECK(3DLINE_Z_BASE, 12); - } - - DMAOUT(vmesa->s3vScreen->depthOffset & 0x003FFFF8); - DMAOUT(vmesa->DestBase); - /* DMAOUT(vmesa->ScissorLR); */ - /* DMAOUT(vmesa->ScissorTB); */ - - /* NOTE: we need to restore all these values since we - * are coming back from a vmesa->restore_primitive */ - DMAOUT( (0 << 16) | (dPriv->w-1) ); - DMAOUT( (0 << 16) | (dPriv->h-1) ); - DMAOUT( (vmesa->SrcStride << 16) | vmesa->TexStride ); - DMAOUT(vmesa->SrcStride); - DMAOUT(vmesa->TexOffset); - DMAOUT(vmesa->TextureBorderColor); - DMAOUT(0); /* FOG */ - DMAOUT(0); - DMAOUT(0); - DMAOUT(cmd); - /* 0xacc16827: good value -> lightened newave!!! */ - DMAFINISH(); - - vmesa->CMD = cmd; -#endif - } - - DEBUG(("\n")); - - vmesa->restore_primitive = _hw_prim; -} - -static void s3vRunPipeline( GLcontext *ctx ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - - DEBUG(("*** s3vRunPipeline ***\n")); - - if ( vmesa->new_state ) - s3vDDUpdateHWState( ctx ); - - if (vmesa->new_gl_state) { - - if (vmesa->new_gl_state & _NEW_TEXTURE) { - s3vUpdateTextureState( ctx ); - } - - if (!vmesa->Fallback) { - if (vmesa->new_gl_state & _S3V_NEW_VERTEX) - s3vChooseVertexState( ctx ); - - if (vmesa->new_gl_state & _S3V_NEW_RASTER_STATE) - s3vChooseRasterState( ctx ); - - if (vmesa->new_gl_state & _S3V_NEW_RENDERSTATE) - s3vChooseRenderState( ctx ); - } - - vmesa->new_gl_state = 0; - - } - - _tnl_run_pipeline( ctx ); -} - -static void s3vRenderStart( GLcontext *ctx ) -{ - /* Check for projective texturing. Make sure all texcoord - * pointers point to something. (fix in mesa?) - */ - - DEBUG(("s3vRenderStart\n")); - /* s3vCheckTexSizes( ctx ); */ -} - -static void s3vRenderFinish( GLcontext *ctx ) -{ - if (0) - _swrast_flush( ctx ); /* never needed */ -} - -static void s3vResetLineStipple( GLcontext *ctx ) -{ -/* s3vContextPtr vmesa = S3V_CONTEXT(ctx); */ - - /* Reset the hardware stipple counter. - */ -/* - CHECK_DMA_BUFFER(vmesa, 1); - WRITE(vmesa->buf, UpdateLineStippleCounters, 0); -*/ -} - - -/**********************************************************************/ -/* Transition to/from hardware rasterization. */ -/**********************************************************************/ - - -void s3vFallback( s3vContextPtr vmesa, GLuint bit, GLboolean mode ) -{ - GLcontext *ctx = vmesa->glCtx; - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLuint oldfallback = vmesa->Fallback; - - DEBUG(("*** s3vFallback: ")); - - if (mode) { - vmesa->Fallback |= bit; - if (oldfallback == 0) { - DEBUG(("oldfallback == 0 ***\n")); - _swsetup_Wakeup( ctx ); - _tnl_need_projected_coords( ctx, GL_TRUE ); - vmesa->RenderIndex = ~0; - } - } - else { - DEBUG(("***\n")); - vmesa->Fallback &= ~bit; - if (oldfallback == bit) { - _swrast_flush( ctx ); - tnl->Driver.Render.Start = s3vRenderStart; - tnl->Driver.Render.PrimitiveNotify = s3vRenderPrimitive; - tnl->Driver.Render.Finish = s3vRenderFinish; - tnl->Driver.Render.BuildVertices = s3vBuildVertices; - tnl->Driver.Render.ResetLineStipple = s3vResetLineStipple; - vmesa->new_gl_state |= (_S3V_NEW_RENDERSTATE| - _S3V_NEW_RASTER_STATE| - _S3V_NEW_VERTEX); - } - } -} - - -/**********************************************************************/ -/* Initialization. */ -/**********************************************************************/ - - -void s3vInitTriFuncs( GLcontext *ctx ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - TNLcontext *tnl = TNL_CONTEXT(ctx); - static int firsttime = 1; - - if (firsttime) { - init_rast_tab(); - init_render_tab(); - firsttime = 0; - } - - vmesa->RenderIndex = ~0; - - tnl->Driver.RunPipeline = s3vRunPipeline; - tnl->Driver.Render.Start = s3vRenderStart; - tnl->Driver.Render.Finish = s3vRenderFinish; - tnl->Driver.Render.PrimitiveNotify = s3vRenderPrimitive; - tnl->Driver.Render.ResetLineStipple = s3vResetLineStipple; -/* - tnl->Driver.RenderInterp = _swsetup_RenderInterp; - tnl->Driver.RenderCopyPV = _swsetup_RenderCopyPV; -*/ - tnl->Driver.Render.BuildVertices = s3vBuildVertices; -} diff --git a/src/mesa/drivers/dri/s3v/s3v_tris.h b/src/mesa/drivers/dri/s3v/s3v_tris.h deleted file mode 100644 index 0010a7fe0a..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_tris.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Author: Max Lingua - */ - -#ifndef _S3V_TRIS_H -#define _S3V_TRIS_H - -extern void s3vDDTrifuncInit(void); -extern void s3vDDChooseTriRenderState(GLcontext *); - -#endif /* !(_S3V_TRIS_H) */ diff --git a/src/mesa/drivers/dri/s3v/s3v_tritmp.h b/src/mesa/drivers/dri/s3v/s3v_tritmp.h deleted file mode 100644 index 2321bd414f..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_tritmp.h +++ /dev/null @@ -1,958 +0,0 @@ -/* - * Author: Max Lingua - */ - -/**** MACROS start ****/ - -/* point/line macros */ - -#define LINE_VERT_VARS \ - SWvertex v[3]; \ - s3vVertex* vvv[2]; \ - int x[3], y[3], z[3]; \ - int idx[3]; \ - int dx01, dy01; \ - int delt02; \ - int deltzy, zstart; \ - int start02, end01; \ - int ystart, y01y12; \ - int i, tmp, tmp2, tmp3; \ - GLfloat ydiff, fy[3] -#define LINE_VERT_VARS_VOIDS \ - (void) v; (void) vvv; (void) x; (void) y; (void) z; (void) idx; \ - (void) dx01; (void) dy01; (void) delt02; (void) deltzy; \ - (void) zstart; (void) start02; (void) ystart; (void) y01y12; \ - (void) i; (void) tmp; (void) tmp2; (void) tmp3; (void) ydiff; (void) fy - -#define LINE_FLAT_VARS \ - int arstart, gbstart; \ - int deltarx, deltgbx, deltary, deltgby; \ - GLubyte *(col)[3] -#define LINE_FLAT_VARS_VOIDS \ - (void) arstart; (void) gbstart; (void) deltarx; (void) deltgbx; \ - (void) deltary; (void) deltgby; (void) col - -#define LINE_GOURAUD_VARS \ - int arstart, gbstart; \ - int deltary, deltgby; \ - int ctmp, ctmp2, ctmp3, ctmp4; \ - GLubyte *(col)[3] -#define LINE_GOURAUD_VARS_VOIDS \ - (void) arstart; (void) gbstart; (void) deltary; (void) deltgby; \ - (void) ctmp; (void) ctmp2; (void) ctmp3; (void) ctmp4; (void) col - -#define SORT_LINE_VERT() \ -do { \ - if(v[0].attrib[FRAG_ATTRIB_WPOS][1] <= v[1].attrib[FRAG_ATTRIB_WPOS][1]) { \ -\ - idx[0] = 0; \ - idx[1] = 1; \ -\ - } else if (v[0].attrib[FRAG_ATTRIB_WPOS][1] > v[1].attrib[FRAG_ATTRIB_WPOS][1]) { \ -\ - idx[0] = 1; \ - idx[1] = 0; \ -\ - } \ -} while(0) - -#define SET_LINE_VERT() \ -do { \ - x[0] = (v[idx[0]].attrib[FRAG_ATTRIB_WPOS][0] * 1024.0f * 1024.0f); /* 0x100000 */ \ - y[0] = fy[0] = dPriv->h - v[idx[0]].attrib[FRAG_ATTRIB_WPOS][1]; \ - z[0] = (v[idx[0]].attrib[FRAG_ATTRIB_WPOS][2]) * 1024.0f * 32.0f; /* 0x8000; */ \ -\ - x[1] = (v[idx[1]].attrib[FRAG_ATTRIB_WPOS][0] * 1024.0f * 1024.0f); /* 0x100000 */ \ - y[1] = dPriv->h - v[idx[1]].attrib[FRAG_ATTRIB_WPOS][1]; \ - z[1] = (v[idx[1]].attrib[FRAG_ATTRIB_WPOS][2]) * 1024.0f * 32.0f; /* 0x8000 */ \ -} while(0) - -#define SET_LINE_XY() \ -do { \ - tmp = v[idx[0]].attrib[FRAG_ATTRIB_WPOS][0]; \ - tmp2 = v[idx[1]].attrib[FRAG_ATTRIB_WPOS][0]; \ -\ - dx01 = x[0] - x[1]; \ - dy01 = y[0] - y[1]; \ -\ - ydiff = fy[0] - (float)y[0]; \ - ystart = y[0]; \ - y01y12 = dy01 + 1; \ -} while (0) - -#define SET_LINE_DIR() \ -do { \ - if (tmp2 > tmp) { \ - y01y12 |= 0x80000000; \ - tmp3 = tmp2-tmp; \ - } else { \ - tmp3 = tmp-tmp2; \ - } \ -\ - end01 = ((tmp << 16) | tmp2); \ -\ - if (dy01) \ - delt02 = -(dx01/dy01); \ - else \ - delt02 = 0; \ -\ - if (dy01 > tmp3) { /* Y MAJ */ \ - /* NOTE: tmp3 always >=0 */ \ - start02 = x[0]; \ - } else if (delt02 >= 0){ /* X MAJ - positive delta */ \ - start02 = x[0] + delt02/2; \ - dy01 = tmp3; /* could be 0 */ \ - } else { /* X MAJ - negative delta */ \ - start02 = x[0] + delt02/2 + ((1 << 20) - 1); \ - dy01 = tmp3; /* could be 0 */ \ - } \ -} while(0) - -#define SET_LINE_Z() \ -do { \ - zstart = z[0]; \ -\ - if (dy01) { \ - deltzy = (z[1] - z[0])/dy01; \ - } else { \ - deltzy = 0; /* dy01 = tmp3 = 0 (it's a point)*/ \ - } \ -} while (0) - -#define SET_LINE_FLAT_COL() \ -do { \ - col[0] = &(v[idx[0]].color[0]); \ - deltarx = deltary = deltgbx = deltgby = 0; \ - gbstart = (((col[0][1]) << 23) | ((col[0][2]) << 7)); \ - arstart = (((col[0][3]) << 23) | ((col[0][0]) << 7)); \ -} while(0) - -#define SET_LINE_GOURAUD_COL() \ -do { \ - col[0] = &(v[idx[0]].color[0]); \ - col[1] = &(v[idx[1]].color[0]); \ -\ - vvv[0] = _v0; \ - vvv[1] = _v1; \ -\ - for (i=0; i<2; i++) { \ - /* FIXME: swapped ! */ \ - col[i][0] = vvv[!idx[i]]->v.color.red; \ - col[i][1] = vvv[!idx[i]]->v.color.green; \ - col[i][2] = vvv[!idx[i]]->v.color.blue; \ - col[i][3] = vvv[!idx[i]]->v.color.alpha; \ - } \ -\ - if (dy01) { \ -\ - ctmp = ((col[0][1] - col[1][1]) << 7) / dy01; \ - ctmp2 = ((col[0][2] - col[1][2]) << 7) / dy01; \ - deltgby = ((ctmp << 16) & 0xFFFF0000) | (ctmp2 & 0xFFFF); \ -\ - ctmp3 = ((col[0][3] - col[1][3]) << 7) / dy01; \ - ctmp4 = ((col[0][0] - col[1][0]) << 7) / dy01; \ - deltary = ((ctmp3 << 16) & 0xFFFF0000) | (ctmp4 & 0xFFFF); \ - } else { \ - ctmp = ((col[1][1] - col[0][1]) << 7); \ - ctmp2 = ((col[1][2] - col[0][2]) << 7); \ - deltgby = ((ctmp << 16) & 0xFFFF0000) | (ctmp2 & 0xFFFF); \ -\ - ctmp3 = ((col[1][3] - col[0][3]) << 7); \ - ctmp4 = ((col[1][0] - col[0][0]) << 7); \ - deltary = ((ctmp3 << 16) & 0xFFFF0000) | (ctmp4 & 0xFFFF); \ - deltgby = deltary = 0; \ - } \ -\ - idx[0] = 1; /* FIXME: swapped */ \ -\ - gbstart = \ - (((int)((ydiff * ctmp) + (col[idx[0]][1] << 7)) << 16) & 0x7FFF0000) \ - | ((int)((ydiff * ctmp2) + (col[idx[0]][2] << 7)) & 0x7FFF); \ - arstart = \ - (((int)((ydiff * ctmp3) + (col[idx[0]][3] << 7)) << 16) & 0x7FFF0000) \ - | ((int)((ydiff * ctmp4) + (col[idx[0]][0] << 7)) & 0x7FFF); \ -} while(0) - -#define SEND_LINE_COL() \ -do { \ - DMAOUT(deltgby); \ - DMAOUT(deltary); \ - DMAOUT(gbstart); \ - DMAOUT(arstart); \ -} while (0) - -#define SEND_LINE_VERT() \ -do { \ - DMAOUT(deltzy); \ - DMAOUT(zstart); \ - DMAOUT(0); \ - DMAOUT(0); \ - DMAOUT(0); \ - DMAOUT(end01); \ - DMAOUT(delt02); \ - DMAOUT(start02); \ - DMAOUT(ystart); \ - DMAOUT(y01y12); \ -} while (0) - - -/* tri macros (mostly stolen from utah-glx...) */ - -#define VERT_VARS \ - SWvertex v[3]; \ - int x[3], y[3], z[3]; \ - int idx[3]; \ - int dx01, dy01; \ - int dx02, dy02; \ - int dx12, dy12; \ - int delt01, delt02, delt12; \ - int deltzx, deltzy, zstart; \ - int start02, end01, end12; \ - int ystart, y01y12; \ - int i, tmp, lr; \ - GLfloat ydiff, fy[3] -#define VERT_VARS_VOIDS \ - (void) v; (void) x; (void) y; (void) z; (void) idx; (void) dx01; \ - (void) dy01; (void) dx02; (void) dy02; (void) dx12; (void) dy12; \ - (void) delt01; (void) delt02; (void) delt12; (void) deltzx; \ - (void) deltzy; (void) zstart; (void) start02; (void) end01; \ - (void) end12; (void) ystart; (void) y01y12; (void) i; (void) tmp; \ - (void) lr; (void) ydiff; (void) fy - -#define GOURAUD_VARS \ - int arstart, gbstart; \ - int deltarx, deltgbx, deltary, deltgby; \ - int ctmp, ctmp2, ctmp3, ctmp4; \ - GLubyte *(col)[3] -#define GOURAUD_VARS_VOIDS \ - (void) arstart; (void) gbstart; (void) deltarx; (void) deltgbx; \ - (void) deltary; (void) deltgby; (void) ctmp; (void) ctmp2; \ - (void) ctmp3; (void) ctmp4; (void) col - -#define FLAT_VARS \ - int arstart, gbstart; \ - int deltarx, deltgbx, deltary, deltgby; \ - GLubyte *(col)[3] -#define FLAT_VARS_VOIDS \ - (void) arstart; (void) gbstart; (void) deltarx; (void) deltgbx; \ - (void) deltary; (void) deltgby; (void) col - -#define TEX_VARS \ - int u0, u1, u2; \ - GLfloat ru0, ru1, ru2; \ - int v0, v1, v2; \ - GLfloat rv0, rv1, rv2; \ - GLfloat w0, w1, w2; \ - GLfloat rw0, rw1, rw2; \ - int baseu, basev; \ - int d0, d1, d2; \ - int deltdx, deltvx, deltux, deltdy, deltvy, deltuy; \ - int deltwx, deltwy; \ - int rbaseu, rbasev; \ - int dstart, ustart, wstart, vstart; \ - static int stmp = 0; \ - s3vTextureObjectPtr t -#define TEX_VARS_VOIDS \ - (void) u0; (void) u1; (void) u2; (void) ru0; (void) ru1; (void) ru2; \ - (void) v0; (void) v1; (void) v2; (void) rv0; (void) rv1; (void) rv2; \ - (void) w0; (void) w1; (void) w2; (void) rw0; (void) rw1; (void) rw2; \ - (void) baseu; (void) basev; (void) d0; (void) d1; (void) d2; \ - (void) deltdx; (void) deltvx; (void) deltux; (void) deltdy; \ - (void) deltuy; (void) deltwx; (void) deltwy; (void) rbaseu; \ - (void) rbasev; (void) dstart; (void) ustart; (void) wstart; \ - (void) vstart; (void) stmp; (void) t - -#define SORT_VERT() \ -do { \ - for (i=0; i<3; i++) \ - fy[i] = v[i].attrib[FRAG_ATTRIB_WPOS][1]; \ -\ - if (fy[1] > fy[0]) { /* (fy[1] > fy[0]) */ \ -\ - if (fy[2] > fy[0]) { \ - idx[0] = 0; \ - if (fy[1] > fy[2]) { \ - idx[1] = 2; \ - idx[2] = 1; \ - } else { \ - idx[1] = 1; \ - idx[2] = 2; \ - } \ - } else { \ - idx[0] = 2; \ - idx[1] = 0; \ - idx[2] = 1; \ - } \ - } else { /* (fy[1] < y[0]) */ \ - if (fy[2] > fy[0]) { \ - idx[0] = 1; \ - idx[1] = 0; \ - idx[2] = 2; \ - } else { \ - idx[2] = 0; \ - if (fy[2] > fy[1]) { \ - idx[0] = 1; \ - idx[1] = 2; \ - } else { \ - idx[0] = 2; \ - idx[1] = 1; \ - } \ - } \ - } \ -} while(0) - -#define SET_VERT() \ -do { \ - for (i=0; i<3; i++) \ - { \ - x[i] = ((v[idx[i]].attrib[FRAG_ATTRIB_WPOS][0]) * /* 0x100000*/ 1024.0 * 1024.0); \ - y[i] = fy[i] = (dPriv->h - v[idx[i]].attrib[FRAG_ATTRIB_WPOS][1]); \ - z[i] = ((v[idx[i]].attrib[FRAG_ATTRIB_WPOS][2]) * /* 0x8000 */ 1024.0 * 32.0); \ - } \ -\ - ydiff = fy[0] - (float)y[0]; \ -\ - ystart = y[0]; \ -\ - dx12 = x[2] - x[1]; \ - dy12 = y[1] - y[2]; \ - dx01 = x[1] - x[0]; \ - dy01 = y[0] - y[1]; \ - dx02 = x[2] - x[0]; \ - dy02 = y[0] - y[2]; \ -\ - delt01 = delt02 = delt12 = 0; \ -} while (0) - - -#define SET_XY() \ -do { \ - if (dy01) delt01 = dx01 / dy01; \ - if (dy12) delt12 = dx12 / dy12; \ - delt02 = dx02 / dy02; \ -\ - start02 = x[0] + (ydiff * delt02); \ - end01 = x[0] + (ydiff * delt01); \ - end12 = x[1] + ((fy[1] - (GLfloat)y[1]) * delt12); \ -} while (0) - -#define SET_DIR() \ -do { \ - tmp = x[1] - (dy01 * delt02 + x[0]); \ - if (tmp > 0) { \ - lr = 0x80000000; \ - } else { \ - tmp *= -1; \ - lr = 0; \ - } \ - tmp >>= 20; \ -\ - y01y12 = ((((y[0] - y[1]) & 0x7FF) << 16) \ - | ((y[1] - y[2]) & 0x7FF) | lr); \ -} while (0) - -#define SET_Z() \ -do { \ - deltzy = (z[2] - z[0]) / dy02; \ - if (tmp) { \ - deltzx = (z[1] - (dy01 * deltzy + z[0])) / tmp; \ - } else { \ - deltzx = 0; \ - } \ - zstart = (deltzy * ydiff) + z[0]; \ -} while (0) - -#define SET_FLAT_COL() \ -do { \ - col[0] = &(v[0].color[0]); \ - deltarx = deltary = deltgbx = deltgby = 0; \ - gbstart = (((col[0][1]) << 23) | ((col[0][2]) << 7)); \ - arstart = (((col[0][3]) << 23) | ((col[0][0]) << 7)); \ -} while(0) - -#define SET_GOURAUD_COL() \ -do { \ - col[0] = &(v[idx[0]].color[0]); \ - col[1] = &(v[idx[1]].color[0]); \ - col[2] = &(v[idx[2]].color[0]); \ -\ - ctmp = ((col[2][3] - col[0][3]) << 7) / dy02; \ - ctmp2 = ((col[2][0] - col[0][0]) << 7) / dy02; \ - deltary = ((ctmp << 16) & 0xFFFF0000) | (ctmp2 & 0xFFFF); \ - ctmp3 = ((col[2][1] - col[0][1]) << 7) / dy02; \ - ctmp4 = ((col[2][2] - col[0][2]) << 7) / dy02; \ - deltgby = ((ctmp3 << 16) & 0xFFFF0000) | (ctmp4 & 0xFFFF); \ - gbstart = \ - (((int)((ydiff * ctmp3) + (col[0][1] << 7)) << 16) & 0x7FFF0000) \ - | ((int)((ydiff * ctmp4) + (col[0][2] << 7)) & 0x7FFF); \ - arstart = \ - (((int)((ydiff * ctmp) + (col[0][3] << 7)) << 16) & 0x7FFF0000) \ - | ((int)((ydiff * ctmp2) + (col[0][0] << 7)) & 0x7FFF); \ - if (tmp) { \ - int ax, rx, gx, bx; \ - ax = ((col[1][3] << 7) - (dy01 * ctmp + (col[0][3] << 7))) / tmp; \ - rx = ((col[1][0] << 7) - (dy01 * ctmp2 + (col[0][0] << 7))) / tmp; \ - gx = ((col[1][1] << 7) - (dy01 * ctmp3 + (col[0][1] << 7))) / tmp; \ - bx = ((col[1][2] << 7) - (dy01 * ctmp4 + (col[0][2] << 7))) / tmp; \ - deltarx = ((ax << 16) & 0xFFFF0000) | (rx & 0xFFFF); \ - deltgbx = ((gx << 16) & 0xFFFF0000) | (bx & 0xFFFF); \ - } else { \ - deltgbx = deltarx = 0; \ - } \ -} while (0) - -#define SET_TEX_VERT() \ -do { \ - t = ((s3vTextureObjectPtr) \ - ctx->Texture.Unit[0]._Current->DriverData); \ - deltwx = deltwy = wstart = deltdx = deltdy = dstart = 0; \ -\ - u0 = (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][0] \ - * (GLfloat)(t->image[0].image->Width) * 256.0); \ - u1 = (v[idx[1]].attrib[FRAG_ATTRIB_TEX0][0] \ - * (GLfloat)(t->globj->Image[0][0]->Width) * 256.0); \ - u2 = (v[idx[2]].attrib[FRAG_ATTRIB_TEX0][0] \ - * (GLfloat)(t->globj->Image[0][0]->Width) * 256.0); \ - v0 = (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][1] \ - * (GLfloat)(t->globj->Image[0][0]->Height) * 256.0); \ - v1 = (v[idx[1]].attrib[FRAG_ATTRIB_TEX0][1] \ - * (GLfloat)(t->globj->Image[0][0]->Height) * 256.0); \ - v2 = (v[idx[2]].attrib[FRAG_ATTRIB_TEX0][1] \ - * (GLfloat)(t->globj->Image[0][0]->Height) * 256.0); \ -\ - w0 = (v[idx[0]].attrib[FRAG_ATTRIB_WPOS][3]); \ - w1 = (v[idx[1]].attrib[FRAG_ATTRIB_WPOS][3]); \ - w2 = (v[idx[2]].attrib[FRAG_ATTRIB_WPOS][3]); \ -} while (0) - -#define SET_BASEUV() \ -do { \ - if (u0 < u1) { \ - if (u0 < u2) { \ - baseu = u0; \ - } else { \ - baseu = u2; \ - } \ - } else { \ - if (u1 < u2) { \ - baseu = u1; \ - } else { \ - baseu = u2; \ - } \ - } \ -\ - if (v0 < v1) { \ - if (v0 < v2) { \ - basev = v0; \ - } else { \ - basev = v2; \ - } \ - } else { \ - if (v1 < v2) { \ - basev = v1; \ - } else { \ - basev = v2; \ - } \ - } \ -} while (0) - - -#define SET_RW() \ -do { \ - /* GLfloat minW; \ -\ - if (w0 < w1) { \ - if (w0 < w2) { \ - minW = w0; \ - } else { \ - minW = w2; \ - } \ - } else { \ - if (w1 < w2) { \ - minW = w1; \ - } else { \ - minW = w2; \ - } \ - } */ \ -\ - rw0 = (512.0 * w0); \ - rw1 = (512.0 * w1); \ - rw2 = (512.0 * w2); \ -} while (0) - -#define SET_D() \ -do { \ - GLfloat sxy, suv; \ - int lev; \ -\ - suv = (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][0] - \ - v[idx[2]].attrib[FRAG_ATTRIB_TEX0][0]) * \ - (v[idx[1]].attrib[FRAG_ATTRIB_TEX0][1] - \ - v[idx[2]].attrib[FRAG_ATTRIB_TEX0][1]) - \ - (v[idx[1]].attrib[FRAG_ATTRIB_TEX0][0] - \ - v[idx[2]].attrib[FRAG_ATTRIB_TEX0][0]) * \ - (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][1] - \ - v[idx[2]].attrib[FRAG_ATTRIB_TEX0][2]); \ -\ - sxy = (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][0] - \ - v[idx[2]].attrib[FRAG_ATTRIB_TEX0][0]) * \ - (v[idx[1]].attrib[FRAG_ATTRIB_TEX0][1] - \ - v[idx[2]].attrib[FRAG_ATTRIB_TEX0][1]) - \ - (v[idx[1]].attrib[FRAG_ATTRIB_TEX0][0] - \ - v[idx[2]].attrib[FRAG_ATTRIB_TEX0][0]) * \ - (v[idx[0]].attrib[FRAG_ATTRIB_TEX0][1] - \ - v[idx[2]].attrib[FRAG_ATTRIB_TEX0][2]); \ -\ - if (sxy < 0) sxy *= -1.0; \ - if (suv < 0) suv *= -1.0; \ -\ - lev = *(int*)&suv - *(int *)&sxy; \ - if (lev < 0) \ - lev = 0; \ - else \ - lev >>=23; \ - dstart = (lev << 27); \ -} while (0) - -#define SET_UVWD() \ -do { \ - SET_BASEUV(); \ - SET_RW(); \ - SET_D(); \ - ru0 = (((u0 - baseu) * rw0)); \ - ru1 = (((u1 - baseu) * rw1)); \ - ru2 = (((u2 - baseu) * rw2)); \ - rv0 = (((v0 - basev) * rw0)); \ - rv1 = (((v1 - basev) * rw1)); \ - rv2 = (((v2 - basev) * rw2)); \ -\ - while (baseu < 0) { baseu += (t->globj->Image[0][0]->Width << 8); } \ - while (basev < 0) { basev += (t->globj->Image[0][0]->Height << 8); } \ -\ - if (!(baseu & 0xFF)) \ - { baseu = (baseu >> 8); } \ - else \ - { baseu = (baseu >> 8) + 1; } \ -\ - if ((basev & 0x80) || !(basev & 0xFF)) \ - { basev = (basev >> 8); } \ - else \ - { basev = (basev >> 8) - 1; } \ -\ - rbaseu = (baseu) << (16 - t->globj->Image[0][0]->WidthLog2); \ - rbasev = (basev) << (16 - t->globj->Image[0][0]->WidthLog2); \ - deltuy = (((ru2 - ru0) / dy02)); \ - deltvy = (((rv2 - rv0) / dy02)); \ - rw0 *= (1024.0 * 512.0); \ - rw1 *= (1024.0 * 512.0); \ - rw2 *= (1024.0 * 512.0); \ - deltwy = ((rw2 - rw0) / dy02); \ - if (tmp) { \ - deltux = ((ru1 - (dy01 * deltuy + ru0)) / tmp); \ - deltvx = ((rv1 - (dy01 * deltvy + rv0)) / tmp); \ - deltwx = ((rw1 - (dy01 * deltwy + rw0)) / tmp); \ - } else { deltux = deltvx = deltwx = 0; } \ - ustart = (deltuy * ydiff) + (ru0); \ - vstart = (deltvy * ydiff) + (rv0); \ - wstart = (deltwy * ydiff) + (rw0); \ -} while (0) - -#define SEND_UVWD() \ -do { \ - DMAOUT((rbasev & 0xFFFF)); \ - DMAOUT((0xa0000000 | (rbaseu & 0xFFFF))); \ - DMAOUT(deltwx); \ - DMAOUT(deltwy); \ - DMAOUT(wstart); \ - DMAOUT(deltdx); \ - DMAOUT(deltvx); \ - DMAOUT(deltux); \ - DMAOUT(deltdy); \ - DMAOUT(deltvy); \ - DMAOUT(deltuy); \ - DMAOUT(dstart); \ - DMAOUT(vstart); \ - DMAOUT(ustart); \ -} while (0) - -#define SEND_VERT() \ -do { \ - DMAOUT(deltzx); \ - DMAOUT(deltzy); \ - DMAOUT(zstart); \ - DMAOUT(delt12); \ - DMAOUT(end12); \ - DMAOUT(delt01); \ - DMAOUT(end01); \ - DMAOUT(delt02); \ - DMAOUT(start02); \ - DMAOUT(ystart); \ - DMAOUT(y01y12); \ -} while (0) - -#define SEND_COL() \ -do { \ - DMAOUT(deltgbx); \ - DMAOUT(deltarx); \ - DMAOUT(deltgby); \ - DMAOUT(deltary); \ - DMAOUT(gbstart); \ - DMAOUT(arstart); \ -} while (0) - -/**** MACROS end ****/ - - - - -static void TAG(s3v_point)( s3vContextPtr vmesa, - const s3vVertex *_v0 ) -{ -} - -static void TAG(s3v_line)( s3vContextPtr vmesa, - const s3vVertex *_v0, - const s3vVertex *_v1 ) -{ - GLcontext *ctx = vmesa->glCtx; - __DRIdrawablePrivate *dPriv = vmesa->driDrawable; - - LINE_VERT_VARS; -#if (IND & S3V_RAST_FLAT_BIT) - LINE_FLAT_VARS; -#else - LINE_GOURAUD_VARS; -#endif -#if (IND & S3V_RAST_CULL_BIT) - GLfloat cull; - (void) cull; -#endif - LINE_VERT_VARS_VOIDS; -#if (IND & S3V_RAST_FLAT_BIT) - LINE_FLAT_VARS_VOIDS; -#else - LINE_GOURAUD_VARS_VOIDS; -#endif - - DEBUG(("*** s3v_line: ")); -#if (IND & S3V_RAST_CULL_BIT) - DEBUG(("cull ")); -#endif -#if (IND & S3V_RAST_FLAT_BIT) - DEBUG(("flat ")); -#endif - - DEBUG(("***\n")); - -#if 0 - s3v_print_vertex(ctx, _v0); - s3v_print_vertex(ctx, _v1); -#endif - - s3v_translate_vertex( ctx, _v0, &v[0] ); - s3v_translate_vertex( ctx, _v1, &v[1] ); - -#if (IND & S3V_RAST_CULL_BIT) - /* FIXME: should we cull lines too? */ -#endif - (void)v; /* v[0]; v[1]; */ - - SORT_LINE_VERT(); - SET_LINE_VERT(); - - SET_LINE_XY(); - SET_LINE_DIR(); - SET_LINE_Z(); - -#if (IND & S3V_RAST_FLAT_BIT) - SET_LINE_FLAT_COL(); -#else - SET_LINE_GOURAUD_COL(); -#endif - - DMAOUT_CHECK(3DLINE_GBD, 15); - SEND_LINE_COL(); - DMAOUT(0); - SEND_LINE_VERT(); - DMAFINISH(); -} - -static void TAG(s3v_triangle)( s3vContextPtr vmesa, - const s3vVertex *_v0, - const s3vVertex *_v1, - const s3vVertex *_v2 ) -{ - GLcontext *ctx = vmesa->glCtx; - __DRIdrawablePrivate *dPriv = vmesa->driDrawable; - - VERT_VARS; -#if (IND & S3v_RAST_FLAT_BIT) - FLAT_VARS; -#else - GOURAUD_VARS; -#endif -#if (IND & S3V_RAST_TEX_BIT) - TEX_VARS; -#endif -#if (IND & S3V_RAST_CULL_BIT) - GLfloat cull; -#endif - VERT_VARS_VOIDS; -#if (IND & S3v_RAST_FLAT_BIT) - FLAT_VARS_VOIDS; -#else - GOURAUD_VARS_VOIDS; -#endif -#if (IND & S3V_RAST_TEX_BIT) - TEX_VARS_VOIDS; -#endif - - DEBUG(("*** s3v_triangle: ")); -#if (IND & S3V_RAST_CULL_BIT) - DEBUG(("cull ")); -#endif -#if (IND & S3V_RAST_FLAT_BIT) - DEBUG(("flat ")); -#endif -#if (IND & S3V_RAST_TEX_BIT) - DEBUG(("tex ")); -#endif - -DEBUG(("***\n")); - -#if 0 - s3v_print_vertex(ctx, _v0); - s3v_print_vertex(ctx, _v1); - s3v_print_vertex(ctx, _v2); -#endif - - s3v_translate_vertex( ctx, _v0, &v[0] ); - s3v_translate_vertex( ctx, _v1, &v[1] ); - s3v_translate_vertex( ctx, _v2, &v[2] ); - -#if (IND & S3V_RAST_CULL_BIT) - cull = vmesa->backface_sign * - ((v[1].attrib[FRAG_ATTRIB_WPOS][0] - v[0].attrib[FRAG_ATTRIB_WPOS][0]) * (v[0].attrib[FRAG_ATTRIB_WPOS][1] - v[2].attrib[FRAG_ATTRIB_WPOS][1]) + - (v[1].attrib[FRAG_ATTRIB_WPOS][1] - v[0].attrib[FRAG_ATTRIB_WPOS][1]) * (v[2].attrib[FRAG_ATTRIB_WPOS][0] - v[0].attrib[FRAG_ATTRIB_WPOS][0])); - - if (cull < vmesa->cull_zero /* -0.02f */) return; -#endif - - (void)v; /* v[0]; v[1]; v[2]; */ - - SORT_VERT(); - SET_VERT(); - - if (dy02 == 0) return; - - SET_XY(); - SET_DIR(); - SET_Z(); - -#if (IND & S3V_RAST_TEX_BIT) - SET_TEX_VERT(); - SET_UVWD(); -#endif - -#if (IND & S3V_RAST_FLAT_BIT) - SET_FLAT_COL(); -#else - SET_GOURAUD_COL(); -#endif - -#if (IND & S3V_RAST_TEX_BIT) - DMAOUT_CHECK(3DTRI_BASEV, 31); - SEND_UVWD(); - SEND_COL(); - SEND_VERT(); - DMAFINISH(); -#else - DMAOUT_CHECK(3DTRI_GBX, 17); - SEND_COL(); - SEND_VERT(); - DMAFINISH(); -#endif -} - -static void TAG(s3v_quad)( s3vContextPtr vmesa, - const s3vVertex *_v0, - const s3vVertex *_v1, - const s3vVertex *_v2, - const s3vVertex *_v3 ) -{ - GLcontext *ctx = vmesa->glCtx; - __DRIdrawablePrivate *dPriv = vmesa->driDrawable; - - SWvertex temp_v[4]; - VERT_VARS; -#if (IND & S3v_RAST_FLAT_BIT) - FLAT_VARS; -#else - GOURAUD_VARS; -#endif -#if (IND & S3V_RAST_TEX_BIT) - TEX_VARS; -#endif -#if (IND & S3V_RAST_CULL_BIT) - GLfloat cull; -#endif - VERT_VARS_VOIDS; -#if (IND & S3v_RAST_FLAT_BIT) - FLAT_VARS_VOIDS; -#else - GOURAUD_VARS_VOIDS; -#endif -#if (IND & S3V_RAST_TEX_BIT) - TEX_VARS_VOIDS; -#endif - - DEBUG(("*** s3v_quad: ")); -#if (IND & S3V_RAST_CULL_BIT) - DEBUG(("cull ")); - /* printf(""); */ /* speed trick */ -#endif -#if (IND & S3V_RAST_FLAT_BIT) - DEBUG(("flat ")); -#endif -#if (IND & S3V_RAST_TEX_BIT) - DEBUG(("tex ")); -#endif - - DEBUG(("***\n")); - -#if 0 - s3v_print_vertex(ctx, _v0); - s3v_print_vertex(ctx, _v1); - s3v_print_vertex(ctx, _v2); - s3v_print_vertex(ctx, _v3); -#endif - s3v_translate_vertex( ctx, _v0, &temp_v[0] ); - s3v_translate_vertex( ctx, _v1, &temp_v[1] ); - s3v_translate_vertex( ctx, _v2, &temp_v[2] ); - s3v_translate_vertex( ctx, _v3, &temp_v[3] ); - - /* FIRST TRI (0,1,2) */ - - /* ROMEO */ - /* printf(""); */ /* speed trick (a) [turn on if (a) is return]*/ - - v[0] = temp_v[0]; - v[1] = temp_v[1]; - v[2] = temp_v[2]; - -#if (IND & S3V_RAST_CULL_BIT) - cull = vmesa->backface_sign * - ((v[1].attrib[FRAG_ATTRIB_WPOS][0] - v[0].attrib[FRAG_ATTRIB_WPOS][0]) * (v[0].attrib[FRAG_ATTRIB_WPOS][1] - v[2].attrib[FRAG_ATTRIB_WPOS][1]) + - (v[1].attrib[FRAG_ATTRIB_WPOS][1] - v[0].attrib[FRAG_ATTRIB_WPOS][1]) * (v[2].attrib[FRAG_ATTRIB_WPOS][0] - v[0].attrib[FRAG_ATTRIB_WPOS][0])); - - if (cull < vmesa->cull_zero /* -0.02f */) goto second; /* return; */ /* (a) */ -#endif - -#if 0 - v[0] = temp_v[0]; - v[1] = temp_v[1]; - v[2] = temp_v[2]; -#else - (void) v; -#endif - SORT_VERT(); - SET_VERT(); - - if (dy02 == 0) goto second; - - SET_XY(); - SET_DIR(); - SET_Z(); - -#if (IND & S3V_RAST_TEX_BIT) - SET_TEX_VERT(); - SET_UVWD(); -#endif - -#if (IND & S3V_RAST_FLAT_BIT) - SET_FLAT_COL(); -#else - SET_GOURAUD_COL(); -#endif - -#if (IND & S3V_RAST_TEX_BIT) - DMAOUT_CHECK(3DTRI_BASEV, 31); - SEND_UVWD(); - SEND_COL(); - SEND_VERT(); - DMAFINISH(); -#else - DMAOUT_CHECK(3DTRI_GBX, 17); - SEND_COL(); - SEND_VERT(); - DMAFINISH(); -#endif - - /* SECOND TRI (0,2,3) */ - -second: - v[0] = temp_v[0]; - v[1] = temp_v[2]; - v[2] = temp_v[3]; - -#if (IND & S3V_RAST_CULL_BIT) - cull = vmesa->backface_sign * - ((v[1].attrib[FRAG_ATTRIB_WPOS][0] - v[0].attrib[FRAG_ATTRIB_WPOS][0]) * (v[0].attrib[FRAG_ATTRIB_WPOS][1] - v[2].attrib[FRAG_ATTRIB_WPOS][1]) + - (v[1].attrib[FRAG_ATTRIB_WPOS][1] - v[0].attrib[FRAG_ATTRIB_WPOS][1]) * (v[2].attrib[FRAG_ATTRIB_WPOS][0] - v[0].attrib[FRAG_ATTRIB_WPOS][0])); - - if (cull < /* -0.02f */ vmesa->cull_zero) return; -#endif - -/* second: */ - - /* ROMEO */ - /* printf(""); */ /* speed trick */ - - v[0] = temp_v[0]; - v[1] = temp_v[2]; - v[2] = temp_v[3]; - - SORT_VERT(); - SET_VERT(); - - if (dy02 == 0) return; - - SET_XY(); - SET_DIR(); - SET_Z(); - -#if (IND & S3V_RAST_TEX_BIT) - SET_TEX_VERT(); - SET_UVWD(); -#endif - -#if (IND & S3V_RAST_FLAT_BIT) - SET_FLAT_COL(); -#else - SET_GOURAUD_COL(); -#endif - -#if (IND & S3V_RAST_TEX_BIT) - DMAOUT_CHECK(3DTRI_BASEV, 31); - SEND_UVWD(); - SEND_COL(); - SEND_VERT(); - DMAFINISH(); -#else - DMAOUT_CHECK(3DTRI_GBX, 17); - SEND_COL(); - SEND_VERT(); - DMAFINISH(); -#endif -} - -static void TAG(s3v_init)(void) -{ - s3v_point_tab[IND] = TAG(s3v_point); - s3v_line_tab[IND] = TAG(s3v_line); - s3v_tri_tab[IND] = TAG(s3v_triangle); - s3v_quad_tab[IND] = TAG(s3v_quad); -} - -#undef IND -#undef TAG diff --git a/src/mesa/drivers/dri/s3v/s3v_vb.c b/src/mesa/drivers/dri/s3v/s3v_vb.c deleted file mode 100644 index 00e375c6c4..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_vb.c +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Author: Max Lingua - */ - -#include "main/glheader.h" -#include "main/mtypes.h" -#include "main/macros.h" -#include "main/colormac.h" - -#include "swrast_setup/swrast_setup.h" -#include "tnl/t_context.h" -#include "tnl/tnl.h" - -#include "s3v_context.h" -#include "s3v_vb.h" -#include "s3v_tris.h" - -#define S3V_XYZW_BIT 0x1 -#define S3V_RGBA_BIT 0x2 -#define S3V_TEX0_BIT 0x4 -#define S3V_PTEX_BIT 0x8 -#define S3V_FOG_BIT 0x10 -#define S3V_MAX_SETUP 0x20 - -static struct { - void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint ); - tnl_interp_func interp; - tnl_copy_pv_func copy_pv; - GLboolean (*check_tex_sizes)( GLcontext *ctx ); - GLuint vertex_size; - GLuint vertex_stride_shift; - GLuint vertex_format; -} setup_tab[S3V_MAX_SETUP]; - - -/* Only one vertex format, atm, so no need to give them names: - */ -#define TINY_VERTEX_FORMAT 1 -#define NOTEX_VERTEX_FORMAT 0 -#define TEX0_VERTEX_FORMAT 0 -#define TEX1_VERTEX_FORMAT 0 -#define PROJ_TEX1_VERTEX_FORMAT 0 -#define TEX2_VERTEX_FORMAT 0 -#define TEX3_VERTEX_FORMAT 0 -#define PROJ_TEX3_VERTEX_FORMAT 0 - -#define DO_XYZW (IND & S3V_XYZW_BIT) -#define DO_RGBA (IND & S3V_RGBA_BIT) -#define DO_SPEC 0 -#define DO_FOG (IND & S3V_FOG_BIT) -#define DO_TEX0 (IND & S3V_TEX0_BIT) -#define DO_TEX1 0 -#define DO_TEX2 0 -#define DO_TEX3 0 -#define DO_PTEX (IND & S3V_PTEX_BIT) - -#define VERTEX s3vVertex -#define LOCALVARS /* s3vContextPtr vmesa = S3V_CONTEXT(ctx); */ -#define GET_VIEWPORT_MAT() 0 /* vmesa->hw_viewport */ -#define GET_TEXSOURCE(n) n -#define GET_VERTEX_FORMAT() 0 -#define GET_VERTEX_SIZE() S3V_CONTEXT(ctx)->vertex_size * sizeof(GLuint) -#define GET_VERTEX_STORE() S3V_CONTEXT(ctx)->verts -#define GET_VERTEX_STRIDE_SHIFT() S3V_CONTEXT(ctx)->vertex_stride_shift -#define INVALIDATE_STORED_VERTICES() -#define GET_UBYTE_COLOR_STORE() &S3V_CONTEXT(ctx)->UbyteColor -#define GET_UBYTE_SPEC_COLOR_STORE() &S3V_CONTEXT(ctx)->UbyteSecondaryColor - -#define HAVE_HW_VIEWPORT 1 /* FIXME */ -#define HAVE_HW_DIVIDE 1 -#define HAVE_RGBA_COLOR 0 /* we're BGRA */ -#define HAVE_TINY_VERTICES 1 -#define HAVE_NOTEX_VERTICES 0 -#define HAVE_TEX0_VERTICES 0 -#define HAVE_TEX1_VERTICES 0 -#define HAVE_TEX2_VERTICES 0 -#define HAVE_TEX3_VERTICES 0 -#define HAVE_PTEX_VERTICES 1 - -/* -#define SUBPIXEL_X -.5 -#define SUBPIXEL_Y -.5 -#define UNVIEWPORT_VARS GLfloat h = S3V_CONTEXT(ctx)->driDrawable->h -#define UNVIEWPORT_X(x) x - SUBPIXEL_X -#define UNVIEWPORT_Y(y) - y + h + SUBPIXEL_Y -#define UNVIEWPORT_Z(z) z / vmesa->depth_scale -*/ - -#define PTEX_FALLBACK() /* never needed */ - -#define IMPORT_QUALIFIER -#define IMPORT_FLOAT_COLORS s3v_import_float_colors -#define IMPORT_FLOAT_SPEC_COLORS s3v_import_float_spec_colors - -#define INTERP_VERTEX setup_tab[S3V_CONTEXT(ctx)->SetupIndex].interp -#define COPY_PV_VERTEX setup_tab[S3V_CONTEXT(ctx)->SetupIndex].copy_pv - - - -/*********************************************************************** - * Generate pv-copying and translation functions * - ***********************************************************************/ - -#define TAG(x) s3v_##x -#include "tnl_dd/t_dd_vb.c" - -/*********************************************************************** - * Generate vertex emit and interp functions * - ***********************************************************************/ - - -#define IND (S3V_XYZW_BIT|S3V_RGBA_BIT) -#define TAG(x) x##_wg -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (S3V_XYZW_BIT|S3V_RGBA_BIT|S3V_TEX0_BIT) -#define TAG(x) x##_wgt0 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (S3V_XYZW_BIT|S3V_RGBA_BIT|S3V_TEX0_BIT|S3V_PTEX_BIT) -#define TAG(x) x##_wgpt0 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (S3V_TEX0_BIT) -#define TAG(x) x##_t0 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (S3V_RGBA_BIT) -#define TAG(x) x##_g -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (S3V_RGBA_BIT|S3V_TEX0_BIT) -#define TAG(x) x##_gt0 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (S3V_XYZW_BIT|S3V_RGBA_BIT|S3V_FOG_BIT) -#define TAG(x) x##_wgf -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (S3V_XYZW_BIT|S3V_RGBA_BIT|S3V_FOG_BIT|S3V_TEX0_BIT) -#define TAG(x) x##_wgft0 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (S3V_XYZW_BIT|S3V_RGBA_BIT|S3V_FOG_BIT|S3V_TEX0_BIT|S3V_PTEX_BIT) -#define TAG(x) x##_wgfpt0 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (S3V_FOG_BIT) -#define TAG(x) x##_f -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (S3V_RGBA_BIT | S3V_FOG_BIT) -#define TAG(x) x##_gf -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (S3V_RGBA_BIT | S3V_FOG_BIT | S3V_TEX0_BIT) -#define TAG(x) x##_gft0 -#include "tnl_dd/t_dd_vbtmp.h" - -static void init_setup_tab( void ) -{ - init_wg(); /* pos + col */ - init_wgt0(); /* pos + col + tex0 */ - init_wgpt0(); /* pos + col + p-tex0 (?) */ - init_t0(); /* tex0 */ - init_g(); /* col */ - init_gt0(); /* col + tex */ - init_wgf(); - init_wgft0(); - init_wgfpt0(); - init_f(); - init_gf(); - init_gft0(); -} - - -#if 0 -void s3vPrintSetupFlags(char *msg, GLuint flags ) -{ - fprintf(stderr, "%s(%x): %s%s%s%s%s%s\n", - msg, - (int)flags, - (flags & S3V_XYZW_BIT) ? " xyzw," : "", - (flags & S3V_RGBA_BIT) ? " rgba," : "", - (flags & S3V_SPEC_BIT) ? " spec," : "", - (flags & S3V_FOG_BIT) ? " fog," : "", - (flags & S3V_TEX0_BIT) ? " tex-0," : "", - (flags & S3V_TEX1_BIT) ? " tex-1," : ""); -} -#endif - - -void s3vCheckTexSizes( GLcontext *ctx ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - s3vContextPtr vmesa = S3V_CONTEXT( ctx ); - - if (!setup_tab[vmesa->SetupIndex].check_tex_sizes(ctx)) { - - vmesa->SetupIndex |= (S3V_PTEX_BIT|S3V_RGBA_BIT); - - if (1 || !(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) { - tnl->Driver.Render.Interp = setup_tab[vmesa->SetupIndex].interp; - tnl->Driver.Render.CopyPV = setup_tab[vmesa->SetupIndex].copy_pv; - } - } -} - -void s3vBuildVertices( GLcontext *ctx, - GLuint start, - GLuint count, - GLuint newinputs ) -{ - s3vContextPtr vmesa = S3V_CONTEXT( ctx ); - GLubyte *v = ((GLubyte *)vmesa->verts + - (start<vertex_stride_shift)); - GLuint stride = 1<vertex_stride_shift; - - DEBUG(("*** s3vBuildVertices ***\n")); - DEBUG(("vmesa->SetupNewInputs = 0x%x\n", vmesa->SetupNewInputs)); - DEBUG(("vmesa->SetupIndex = 0x%x\n", vmesa->SetupIndex)); - -#if 1 - setup_tab[vmesa->SetupIndex].emit( ctx, start, count, v, stride ); -#else - newinputs |= vmesa->SetupNewInputs; - vmesa->SetupNewInputs = 0; - - DEBUG(("newinputs is 0x%x\n", newinputs)); - - if (!newinputs) { - DEBUG(("!newinputs\n")); - return; - } - - if (newinputs & VERT_CLIP) { - setup_tab[vmesa->SetupIndex].emit( ctx, start, count, v, stride ); - DEBUG(("newinputs & VERT_CLIP\n")); - return; - } /* else { */ -/* GLuint ind = 0; */ - - if (newinputs & VERT_RGBA) { - DEBUG(("newinputs & VERT_RGBA\n")); - ind |= S3V_RGBA_BIT; - } - - if (newinputs & VERT_TEX0) { - DEBUG(("newinputs & VERT_TEX0\n")); - ind |= S3V_TEX0_BIT; - } - - if (newinputs & VERT_FOG_COORD) - ind |= S3V_FOG_BIT; - - if (vmesa->SetupIndex & S3V_PTEX_BIT) - ind = ~0; - - ind &= vmesa->SetupIndex; - - DEBUG(("vmesa->SetupIndex = 0x%x\n", vmesa->SetupIndex)); - DEBUG(("ind = 0x%x\n", ind)); - DEBUG(("ind & vmesa->SetupIndex = 0x%x\n", (ind & vmesa->SetupIndex))); - - if (ind) { - setup_tab[ind].emit( ctx, start, count, v, stride ); - } -#endif -} - -void s3vChooseVertexState( GLcontext *ctx ) -{ - s3vContextPtr vmesa = S3V_CONTEXT( ctx ); - TNLcontext *tnl = TNL_CONTEXT(ctx); - - GLuint ind = S3V_XYZW_BIT | S3V_RGBA_BIT; - - /* FIXME: will segv in tnl_dd/t_dd_vbtmp.h (line 196) on some demos */ -/* - if (ctx->Fog.Enabled) - ind |= S3V_FOG_BIT; -*/ - - - if (ctx->Texture.Unit[0]._ReallyEnabled) { - _tnl_need_projected_coords( ctx, GL_FALSE ); - ind |= S3V_TEX0_BIT; - } else { - _tnl_need_projected_coords( ctx, GL_TRUE ); - } - - vmesa->SetupIndex = ind; - - if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) { - tnl->Driver.Render.Interp = s3v_interp_extras; - tnl->Driver.Render.CopyPV = s3v_copy_pv_extras; - } else { - tnl->Driver.Render.Interp = setup_tab[ind].interp; - tnl->Driver.Render.CopyPV = setup_tab[ind].copy_pv; - } -} - - -void s3vInitVB( GLcontext *ctx ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - GLuint size = TNL_CONTEXT(ctx)->vb.Size; - - vmesa->verts = (char *)ALIGN_MALLOC(size * 4 * 16, 32); - - { - static int firsttime = 1; - if (firsttime) { - init_setup_tab(); - firsttime = 0; - vmesa->vertex_stride_shift = 6 /* 4 */; /* FIXME - only one vertex setup */ - } - } -} - - -void s3vFreeVB( GLcontext *ctx ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - if (vmesa->verts) { - ALIGN_FREE(vmesa->verts); - vmesa->verts = 0; - } - - if (vmesa->UbyteSecondaryColor.Ptr) { - ALIGN_FREE((void *)vmesa->UbyteSecondaryColor.Ptr); - vmesa->UbyteSecondaryColor.Ptr = 0; - } - - if (vmesa->UbyteColor.Ptr) { - ALIGN_FREE((void *)vmesa->UbyteColor.Ptr); - vmesa->UbyteColor.Ptr = 0; - } -} diff --git a/src/mesa/drivers/dri/s3v/s3v_vb.h b/src/mesa/drivers/dri/s3v/s3v_vb.h deleted file mode 100644 index 0fd5437380..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_vb.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Author: Max Lingua - */ - -#ifndef S3VVB_INC -#define S3VVB_INC - -#include "main/mtypes.h" -#include "swrast/swrast.h" - -#define _S3V_NEW_VERTEX (_NEW_TEXTURE | \ - _DD_NEW_TRI_UNFILLED | \ - _DD_NEW_TRI_LIGHT_TWOSIDE) - - -extern void s3vChooseVertexState( GLcontext *ctx ); -extern void s3vCheckTexSizes( GLcontext *ctx ); -extern void s3vBuildVertices( GLcontext *ctx, - GLuint start, - GLuint count, - GLuint newinputs ); - - -extern void s3v_import_float_colors( GLcontext *ctx ); -extern void s3v_import_float_spec_colors( GLcontext *ctx ); - -extern void s3v_translate_vertex( GLcontext *ctx, - const s3vVertex *src, - SWvertex *dst ); - -extern void s3vInitVB( GLcontext *ctx ); -extern void s3vFreeVB( GLcontext *ctx ); - -extern void s3v_print_vertex( GLcontext *ctx, const s3vVertex *v ); -#if 0 -extern void s3vPrintSetupFlags(char *msg, GLuint flags ); -#endif - -#endif diff --git a/src/mesa/drivers/dri/s3v/s3v_xmesa.c b/src/mesa/drivers/dri/s3v/s3v_xmesa.c deleted file mode 100644 index 85f1481769..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_xmesa.c +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Author: Max Lingua - */ - -#include "s3v_context.h" -#include "s3v_vb.h" -#include "s3v_dri.h" -#include "main/context.h" -#include "main/matrix.h" -#include "main/framebuffer.h" -#include "main/renderbuffer.h" -#include "main/viewport.h" - -#include "swrast/swrast.h" -#include "swrast_setup/swrast_setup.h" -#include "tnl/tnl.h" -#include "vbo/vbo.h" - -/* #define DEBUG(str) printf str */ - -static const __DRIconfig ** -s3vInitScreen(__DRIscreen *sPriv) -{ - sPriv->private = (void *) s3vCreateScreen( sPriv ); - - if (!sPriv->private) { - s3vDestroyScreen( sPriv ); - return GL_FALSE; - } - - return NULL; -} - -static void -s3vDestroyContext(__DRIcontextPrivate *driContextPriv) -{ - s3vContextPtr vmesa = (s3vContextPtr)driContextPriv->driverPrivate; - - if (vmesa) { - _swsetup_DestroyContext( vmesa->glCtx ); - _tnl_DestroyContext( vmesa->glCtx ); - _vbo_DestroyContext( vmesa->glCtx ); - _swrast_DestroyContext( vmesa->glCtx ); - - s3vFreeVB( vmesa->glCtx ); - - /* free the Mesa context */ - vmesa->glCtx->DriverCtx = NULL; - _mesa_destroy_context(vmesa->glCtx); - - _mesa_free(vmesa); - driContextPriv->driverPrivate = NULL; - } -} - - -static GLboolean -s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv, - __DRIdrawablePrivate *driDrawPriv, - const __GLcontextModes *mesaVis, - GLboolean isPixmap ) -{ - s3vScreenPtr screen = (s3vScreenPtr) driScrnPriv->private; - - if (isPixmap) { - return GL_FALSE; /* not implemented */ - } - else { - struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis); - - { - driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp, - screen->frontOffset, screen->frontPitch, - driDrawPriv); - s3vSetSpanFunctions(frontRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); - } - - if (mesaVis->doubleBufferMode) { - driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp, - screen->backOffset, screen->backPitch, - driDrawPriv); - s3vSetSpanFunctions(backRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); - backRb->backBuffer = GL_TRUE; - } - - if (mesaVis->depthBits == 16) { - driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL, screen->cpp, - screen->depthOffset, screen->depthPitch, - driDrawPriv); - s3vSetSpanFunctions(depthRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); - } - else if (mesaVis->depthBits == 24) { - driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, NULL, screen->cpp, - screen->depthOffset, screen->depthPitch, - driDrawPriv); - s3vSetSpanFunctions(depthRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); - } - - /* no h/w stencil yet? - if (mesaVis->stencilBits > 0) { - driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, NULL, - screen->cpp, screen->depthOffset, - screen->depthPitch, driDrawPriv); - s3vSetSpanFunctions(stencilRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); - } - */ - - _mesa_add_soft_renderbuffers(fb, - GL_FALSE, /* color */ - GL_FALSE, /* depth */ - mesaVis->stencilBits > 0, - mesaVis->accumRedBits > 0, - GL_FALSE, /* alpha */ - GL_FALSE /* aux */); - driDrawPriv->driverPrivate = (void *) fb; - - return (driDrawPriv->driverPrivate != NULL); - } -} - - -static void -s3vDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) -{ - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); -} - -static void -s3vSwapBuffers(__DRIdrawablePrivate *drawablePrivate) -{ - __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate; - __DRIscreenPrivate *sPriv; - GLcontext *ctx; - s3vContextPtr vmesa; - s3vScreenPtr s3vscrn; - - vmesa = (s3vContextPtr) dPriv->driContextPriv->driverPrivate; - sPriv = vmesa->driScreen; - s3vscrn = vmesa->s3vScreen; - ctx = vmesa->glCtx; - - DEBUG(("*** s3vSwapBuffers ***\n")); - -/* DMAFLUSH(); */ - - _mesa_notifySwapBuffers( ctx ); - - vmesa = (s3vContextPtr) dPriv->driContextPriv->driverPrivate; -/* driScrnPriv = vmesa->driScreen; */ - -/* if (vmesa->EnabledFlags & S3V_BACK_BUFFER) */ - -/* _mesa_notifySwapBuffers( ctx ); */ -#if 1 -{ - int x0, y0, x1, y1; -/* - int nRect = dPriv->numClipRects; - XF86DRIClipRectPtr pRect = dPriv->pClipRects; - - __DRIscreenPrivate *driScrnPriv = vmesa->driScreen; -*/ - -/* - DEBUG(("s3vSwapBuffers: S3V_BACK_BUFFER = 1 - nClip = %i\n", nRect)); -*/ -/* vmesa->drawOffset=vmesa->s3vScreen->backOffset; */ - - x0 = dPriv->x; - y0 = dPriv->y; - - x1 = x0 + dPriv->w - 1; - y1 = y0 + dPriv->h - 1; - - DMAOUT_CHECK(BITBLT_SRC_BASE, 15); - DMAOUT(vmesa->s3vScreen->backOffset); - DMAOUT(0); /* 0xc0000000 */ - DMAOUT( ((x0 << 16) | x1) ); - DMAOUT( ((y0 << 16) | y1) ); - DMAOUT( (vmesa->DestStride << 16) | vmesa->SrcStride ); - DMAOUT( (~(0)) ); - DMAOUT( (~(0)) ); - DMAOUT(0); - DMAOUT(0); - /* FIXME */ - DMAOUT(0); - DMAOUT(0); - DMAOUT( (0x01 | /* Autoexecute */ - 0x02 | /* clip */ - 0x04 | /* 16 bit */ - 0x20 | /* draw */ - 0x400 | /* word alignment (bit 10=1) */ - (0x2 << 11) | /* offset = 1 byte */ - (0xCC << 17) | /* rop #204 */ - (0x3 << 25)) ); /* l-r, t-b */ - DMAOUT(vmesa->ScissorWH); - DMAOUT( /* 0 */ vmesa->SrcXY ); - DMAOUT( (dPriv->x << 16) | dPriv->y ); - DMAFINISH(); - - DMAFLUSH(); - - vmesa->restore_primitive = -1; - -} -#endif -} - -static GLboolean -s3vMakeCurrent(__DRIcontextPrivate *driContextPriv, - __DRIdrawablePrivate *driDrawPriv, - __DRIdrawablePrivate *driReadPriv) -{ - int x1,x2,y1,y2; - int cx, cy, cw, ch; - unsigned int src_stride, dest_stride; - int cl; - - s3vContextPtr vmesa; - __DRIdrawablePrivate *dPriv = driDrawPriv; - vmesa = (s3vContextPtr) dPriv->driContextPriv->driverPrivate; - - DEBUG(("s3vMakeCurrent\n")); - - DEBUG(("dPriv->x=%i y=%i w=%i h=%i\n", dPriv->x, dPriv->y, - dPriv->w, dPriv->h)); - - if (driContextPriv) { - GET_CURRENT_CONTEXT(ctx); - s3vContextPtr oldVirgeCtx = ctx ? S3V_CONTEXT(ctx) : NULL; - s3vContextPtr newVirgeCtx = (s3vContextPtr) driContextPriv->driverPrivate; - - if ( newVirgeCtx != oldVirgeCtx ) { - - newVirgeCtx->dirty = ~0; - cl = 1; - DEBUG(("newVirgeCtx != oldVirgeCtx\n")); -/* s3vUpdateClipping(newVirgeCtx->glCtx ); */ - } - - if (newVirgeCtx->driDrawable != driDrawPriv) { - newVirgeCtx->driDrawable = driDrawPriv; - DEBUG(("driDrawable != driDrawPriv\n")); - s3vUpdateWindow ( newVirgeCtx->glCtx ); - s3vUpdateViewportOffset( newVirgeCtx->glCtx ); -/* s3vUpdateClipping(newVirgeCtx->glCtx ); */ - } -/* - s3vUpdateWindow ( newVirgeCtx->glCtx ); - s3vUpdateViewportOffset( newVirgeCtx->glCtx ); -*/ - -/* - _mesa_make_current( newVirgeCtx->glCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate ); - - _mesa_set_viewport(newVirgeCtx->glCtx, 0, 0, - newVirgeCtx->driDrawable->w, - newVirgeCtx->driDrawable->h); -*/ - -#if 0 - newVirgeCtx->Window &= ~W_GIDMask; - newVirgeCtx->Window |= (driDrawPriv->index << 5); - CHECK_DMA_BUFFER(newVirgeCtx,1); - WRITE(newVirgeCtx->buf, S3VWindow, newVirgeCtx->Window); -#endif - - newVirgeCtx->new_state |= S3V_NEW_WINDOW; /* FIXME */ - - _mesa_make_current( newVirgeCtx->glCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate ); - - if (!newVirgeCtx->glCtx->Viewport.Width) { - _mesa_set_viewport(newVirgeCtx->glCtx, 0, 0, - driDrawPriv->w, driDrawPriv->h); - -/* s3vUpdateClipping(newVirgeCtx->glCtx ); */ - } - -/* - if (cl) { - s3vUpdateClipping(newVirgeCtx->glCtx ); - cl =0; - } -*/ - - newVirgeCtx->new_state |= S3V_NEW_CLIP; - - if (1) { - cx = dPriv->x; - cw = dPriv->w; - cy = dPriv->y; - ch = dPriv->h; - } - - x1 = y1 = 0; - x2 = cw-1; - y2 = ch-1; - - /* src_stride = vmesa->s3vScreen->w * vmesa->s3vScreen->cpp; - dest_stride = ((x2+31)&~31) * vmesa->s3vScreen->cpp; */ - src_stride = vmesa->driScreen->fbWidth * 2; - dest_stride = ((x2+31)&~31) * 2; - } else { - _mesa_make_current( NULL, NULL, NULL ); - } - - return GL_TRUE; -} - - -static GLboolean -s3vUnbindContext( __DRIcontextPrivate *driContextPriv ) -{ - return GL_TRUE; -} - -const struct __DriverAPIRec driDriverAPI = { - .InitScreen = s3vInitScreen, - .DestroyScreen = s3vDestroyScreen, - .CreateContext = s3vCreateContext, - .DestroyContext = s3vDestroyContext, - .CreateBuffer = s3vCreateBuffer, - .DestroyBuffer = s3vDestroyBuffer, - .SwapBuffers = s3vSwapBuffers, - .MakeCurrent = s3vMakeCurrent, - .UnbindContext = s3vUnbindContext, -}; diff --git a/src/mesa/drivers/dri/s3v/s3virgetri.h b/src/mesa/drivers/dri/s3v/s3virgetri.h deleted file mode 100644 index 5519cfd741..0000000000 --- a/src/mesa/drivers/dri/s3v/s3virgetri.h +++ /dev/null @@ -1,383 +0,0 @@ -/* - * Author: Max Lingua - */ - -#define LOCAL_VARS \ - int vert0, vert1, vert2; \ - GLfloat y0, y1, y2, ydiff; \ - int iy0, iy1, iy2; \ - int x0, x1, x2, z0, z1, z2; \ - int dy01, dy02, dy12, dx01, dx02, dx12; \ - int delt02, delt01, delt12, end01, end12, start02; \ - int zstart, arstart, gbstart; \ - int deltzy, deltzx, deltarx, deltgbx, deltary, deltgby; \ - GLubyte (*colours)[4]; \ - GLubyte (*scolours)[4]; \ - static int tp = 0; \ - int tmp, lr - -#define LOCAL_TEX_VARS \ - int u0, u1, u2; \ - GLfloat ru0, ru1, ru2; \ - int v0, v1, v2; \ - GLfloat rv0, rv1, rv2; \ - GLfloat w0, w1, w2; \ - GLfloat rw0, rw1, rw2; \ - int baseu, basev; \ - int d0, d1, d2; \ - int deltdx, deltvx, deltux, deltdy, deltvy, deltuy; \ - int deltwx, deltwy; \ - int rbaseu, rbasev; \ - int dstart, ustart, wstart, vstart; \ - static int stmp = 0; \ - s3virgeTextureObject_t *t - -#define CULL_BACKFACE() \ - do { \ - GLfloat *w0 = VB->Win.data[e0]; \ - GLfloat *w1 = VB->Win.data[e1]; \ - GLfloat *w2 = VB->Win.data[e2]; \ - float cull; \ - cull = ctx->backface_sign * ((w1[0] - w0[0]) * (w0[1] - w2[1]) + \ - (w1[1] - w0[1]) * (w2[0] - w0[0])); \ - if (cull < 0) \ - return; \ - } while (0) - -#define SORT_VERTICES() \ - do { \ - y0 = VB->Win.data[e0][1]; \ - y1 = VB->Win.data[e1][1]; \ - y2 = VB->Win.data[e2][1]; \ - if (y1 > y0) { \ - if (y2 > y0) { \ - vert0 = e0; \ - if (y1 > y2) { vert2 = e1; vert1 = e2; } else { vert2 = e2; vert1 = e1; } \ - } else { vert0 = e2; vert1 = e0; vert2 = e1; } \ - } else { \ - if (y2 > y0) { vert0 = e1; vert1 = e0; vert2 = e2; } else { \ - vert2 = e0; \ - if (y2 > y1) { vert0 = e1; vert1 = e2; } else { vert0 = e2; vert1 = e1; } \ - } \ - } \ - } while (0) - -#define SET_VARIABLES() \ - do { \ - iy0 = y0 = ((s3virgeDB->height - (VB->Win.data[vert0][1]))); \ - iy1 = y1 = ((s3virgeDB->height - (VB->Win.data[vert1][1]))); \ - iy2 = y2 = ((s3virgeDB->height - (VB->Win.data[vert2][1]))); \ - if (iy0 == iy2) { return; } \ - ydiff = y0 - (float)iy0; \ - x0 = ((VB->Win.data[vert0][0]) * 1024.0 * 1024.0); \ - x1 = ((VB->Win.data[vert1][0]) * 1024.0 * 1024.0); \ - x2 = ((VB->Win.data[vert2][0]) * 1024.0 * 1024.0); \ - z0 = (VB->Win.data[vert0][2] * 1024.0 * 32.0); \ - z1 = (VB->Win.data[vert1][2] * 1024.0 * 32.0); \ - z2 = (VB->Win.data[vert2][2] * 1024.0 * 32.0); \ - dx12 = x2 - x1; \ - dy12 = iy1 - iy2; \ - dx01 = x1 - x0; \ - dy01 = iy0 - iy1; \ - dx02 = x2 - x0; \ - dy02 = iy0 - iy2; \ - delt12 = delt02 = delt01 = 0; \ - } while (0) - -#define SET_TEX_VARIABLES() \ - do { \ - t = ((s3virgeTextureObject_t *)ctx->Texture.Unit[0].Current->DriverData); \ - deltwx = deltwy = wstart = deltdx = deltdy = dstart = 0; \ - u0 = (VB->TexCoordPtr[0]->data[vert0][0] * (GLfloat)(t->tObj->Image[0]->Width) * 256.0); \ - u1 = (VB->TexCoordPtr[0]->data[vert1][0] * (GLfloat)(t->tObj->Image[0]->Width) * 256.0); \ - u2 = (VB->TexCoordPtr[0]->data[vert2][0] * (GLfloat)(t->tObj->Image[0]->Width) * 256.0); \ - v0 = (VB->TexCoordPtr[0]->data[vert0][1] * (GLfloat)(t->tObj->Image[0]->Height) * 256.0); \ - v1 = (VB->TexCoordPtr[0]->data[vert1][1] * (GLfloat)(t->tObj->Image[0]->Height) * 256.0); \ - v2 = (VB->TexCoordPtr[0]->data[vert2][1] * (GLfloat)(t->tObj->Image[0]->Height) * 256.0); \ - w0 = (VB->Win.data[vert0][3]); \ - w1 = (VB->Win.data[vert1][3]); \ - w2 = (VB->Win.data[vert2][3]); \ - } while (0) - -#define FLATSHADE_COLORS() \ - do { \ - GLubyte *col = &(colours[pv][0]); \ - deltarx = deltary = deltgbx = deltgby = 0; \ - gbstart = (((col[1]) << 23) | ((col[2]) << 7)); \ - arstart = (((col[3]) << 23) | ((col[0]) << 7)); \ - } while (0) - -#define GOURAUD_COLORS() \ - do { \ - int ctmp, ctmp2, ctmp3, ctmp4; \ - GLubyte *col0, *col1, *col2; \ - col0 = &(colours[vert0][0]); \ - col1 = &(colours[vert1][0]); \ - col2 = &(colours[vert2][0]); \ - ctmp = ((col2[3] - col0[3]) << 7) / dy02; \ - ctmp2 = ((col2[0] - col0[0]) << 7) / dy02; \ - deltary = ((ctmp << 16) & 0xFFFF0000) | (ctmp2 & 0xFFFF); \ - ctmp3 = ((col2[1] - col0[1]) << 7) / dy02; \ - ctmp4 = ((col2[2] - col0[2]) << 7) / dy02; \ - deltgby = ((ctmp3 << 16) & 0xFFFF0000) | (ctmp4 & 0xFFFF); \ - gbstart = (((int)((ydiff * ctmp3) + (col0[1] << 7)) << 16) & 0x7FFF0000) | \ - ((int)((ydiff * ctmp4) + (col0[2] << 7)) & 0x7FFF); \ - arstart = (((int)((ydiff * ctmp) + (col0[3] << 7)) << 16) & 0x7FFF0000) | \ - ((int)((ydiff * ctmp2) + (col0[0] << 7)) & 0x7FFF); \ - if (tmp) { \ - int ax, rx, gx, bx; \ - ax = ((col1[3] << 7) - (dy01 * ctmp + (col0[3] << 7))) / tmp; \ - rx = ((col1[0] << 7) - (dy01 * ctmp2 + (col0[0] << 7))) / tmp; \ - gx = ((col1[1] << 7) - (dy01 * ctmp3 + (col0[1] << 7))) / tmp; \ - bx = ((col1[2] << 7) - (dy01 * ctmp4 + (col0[2] << 7))) / tmp; \ - deltarx = ((ax << 16) & 0xFFFF0000) | (rx & 0xFFFF); \ - deltgbx = ((gx << 16) & 0xFFFF0000) | (bx & 0xFFFF); \ - } else { \ - deltgbx = deltarx = 0; \ - } \ - } while (0) - -#define SET_XY() \ - do { \ - delt02 = dx02 / dy02; \ - if (dy12) delt12 = dx12 / dy12; \ - if (dy01) delt01 = dx01 / dy01; \ - start02 = (ydiff * delt02) + x0; \ - end01 = (ydiff * delt01) + x0; \ - end12 = ((y1 - (GLfloat)iy1) * delt12) + x1; \ - } while (0) - -#define SET_DIR() \ - do { \ - tmp = x1 - (dy01 * delt02 + x0); \ - if (tmp > 0) { \ - lr = 0x80000000; \ - } else { \ - tmp *= -1; \ - lr = 0; \ - } \ - tmp >>= 20; \ - } while (0) - -#define SET_Z() \ - do { \ - deltzy = (z2 - z0) / dy02; \ - if (tmp) { \ - deltzx = (z1 - (dy01 * deltzy + z0)) / tmp; \ - } else { deltzx = 0; } \ - zstart = (deltzy * ydiff) + z0; \ - } while (0) - -#define SET_BASEUV() \ - do { \ - if (u0 < u1) { \ - if (u0 < u2) { \ - baseu = u0; \ - } else { \ - baseu = u2; \ - } \ - } else { \ - if (u1 < u2) { \ - baseu = u1; \ - } else { \ - baseu = u2; \ - } \ - } \ - if (v0 < v1) { \ - if (v0 < v2) { \ - basev = v0; \ - } else { \ - basev = v2; \ - } \ - } else { \ - if (v1 < v2) { \ - basev = v1; \ - } else { \ - basev = v2; \ - } \ - } \ - } while (0) - -#define SET_RW() \ - do { \ - /* GLfloat minW; \ - if (w0 < w1) { \ - if (w0 < w2) { \ - minW = w0; \ - } else { \ - minW = w2; \ - } \ - } else { \ - if (w1 < w2) { \ - minW = w1; \ - } else { \ - minW = w2; \ - } \ - } */ \ - rw0 = (512.0 * w0); \ - rw1 = (512.0 * w1); \ - rw2 = (512.0 * w2); \ - } while (0) - - -#define SET_D() \ - do { \ - GLfloat sxy, suv; \ - int lev; \ - suv = (VB->TexCoordPtr[0]->data[vert0][0] - \ - VB->TexCoordPtr[0]->data[vert2][0]) * \ - (VB->TexCoordPtr[0]->data[vert1][1] - \ - VB->TexCoordPtr[0]->data[vert2][1]) - \ - (VB->TexCoordPtr[0]->data[vert1][0] - \ - VB->TexCoordPtr[0]->data[vert2][0]) * \ - (VB->TexCoordPtr[0]->data[vert0][1] - \ - VB->TexCoordPtr[0]->data[vert2][2]); \ - sxy = (VB->Win.data[vert0][0] - \ - VB->Win.data[vert2][0]) * \ - (VB->Win.data[vert1][1] - \ - VB->Win.data[vert2][1]) - \ - (VB->Win.data[vert1][0] - \ - VB->Win.data[vert2][0]) * \ - (VB->Win.data[vert0][1] - \ - VB->Win.data[vert2][2]); \ - if (sxy < 0) sxy *= -1.0; \ - if (suv < 0) suv *= -1.0; \ - lev = *(int*)&suv - *(int *)&sxy; \ - if (lev < 0) \ - lev = 0; \ - else \ - lev >>=23; \ - dstart = (lev << 27); \ - } while (0) - - - -#define SET_UVWD() \ - do { \ - SET_BASEUV(); \ - SET_RW(); \ - SET_D(); \ - ru0 = (((u0 - baseu) * rw0)); \ - ru1 = (((u1 - baseu) * rw1)); \ - ru2 = (((u2 - baseu) * rw2)); \ - rv0 = (((v0 - basev) * rw0)); \ - rv1 = (((v1 - basev) * rw1)); \ - rv2 = (((v2 - basev) * rw2)); \ - while (baseu < 0) { baseu += (t->tObj->Image[0]->Width << 8); } \ - while (basev < 0) { basev += (t->tObj->Image[0]->Height << 8); } \ - if (!(baseu & 0xFF)) { baseu = (baseu >> 8); } else { baseu = (baseu >> 8) + 1; } \ - if ((basev & 0x80) || !(basev & 0xFF)) { basev = (basev >> 8); } else { basev = (basev >> 8) - 1; } \ - rbaseu = (baseu) << (16 - t->widthLog2); \ - rbasev = (basev) << (16 - t->widthLog2); \ - deltuy = (((ru2 - ru0) / dy02)); \ - deltvy = (((rv2 - rv0) / dy02)); \ - rw0 *= (1024.0 * 512.0); \ - rw1 *= (1024.0 * 512.0); \ - rw2 *= (1024.0 * 512.0); \ - deltwy = ((rw2 - rw0) / dy02); \ - if (tmp) { \ - deltux = ((ru1 - (dy01 * deltuy + ru0)) / tmp); \ - deltvx = ((rv1 - (dy01 * deltvy + rv0)) / tmp); \ - deltwx = ((rw1 - (dy01 * deltwy + rw0)) / tmp); \ - } else { deltux = deltvx = deltwx = 0; } \ - ustart = (deltuy * ydiff) + (ru0); \ - vstart = (deltvy * ydiff) + (rv0); \ - wstart = (deltwy * ydiff) + (rw0); \ - } while (0) - - -#define SEND_COLORS() \ - do { \ - WAITFIFOEMPTY(6); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_GBX), deltgbx); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_ARX), deltarx); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_GBY), deltgby); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_ARY), deltary); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_GS_BS), gbstart); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_AS_RS), arstart); \ - } while (0) - -#define SEND_VERTICES() \ - do { \ - WAITFIFOEMPTY(6); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_ZSTART), zstart); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_ZXD), deltzx); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_ZYD), deltzy); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TXDELTA12), delt12); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TXEND12), end12); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TXDELTA01), delt01); \ - WAITFIFOEMPTY(5); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TXEND01), end01); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TXDELTA02), delt02); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TXSTART02), start02); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TYS), iy0); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_TY01_Y12), \ - ((((iy0 - iy1) & 0x7FF) << 16) | \ - ((iy1 - iy2) & 0x7FF) | lr)); \ - } while (0) - -#define SEND_UVWD() \ - do { \ - WAITFIFOEMPTY(7); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_BASEV), (rbasev & 0xFFFF)); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_BASEU), (0xa0000000 | (rbaseu & 0xFFFF))); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_WXD), deltwx); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_WYD), deltwy); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_WSTART), wstart); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_DXD), deltdx); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_VXD), deltvx); \ - WAITFIFOEMPTY(7); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_UXD), deltux); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_DYD), deltdy); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_VYD), deltvy); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_UYD), deltuy); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_DSTART), dstart); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_VSTART), vstart); \ - OUTREG( (S3VIRGE_3DTRI_REG | S3VIRGE_3DTRI_USTART), ustart); \ - } while (0) - -#define DMA_SEND_UVWD() \ - do { \ - DMAOUT((rbasev & 0xFFFF)); \ - DMAOUT((0xa0000000 | (rbaseu & 0xFFFF))); \ - DMAOUT(deltwx); \ - DMAOUT(deltwy); \ - DMAOUT(wstart); \ - DMAOUT(deltdx); \ - DMAOUT(deltvx); \ - DMAOUT(deltux); \ - DMAOUT(deltdy); \ - DMAOUT(deltvy); \ - DMAOUT(deltuy); \ - DMAOUT(dstart); \ - DMAOUT(vstart); \ - DMAOUT(ustart); \ - } while (0) - - -#define DMA_SEND_COLORS() \ - do { \ - DMAOUT(deltgbx); \ - DMAOUT(deltarx); \ - DMAOUT(deltgby); \ - DMAOUT(deltary); \ - DMAOUT(gbstart); \ - DMAOUT(arstart); \ - } while (0) - -#define DMA_SEND_VERTICES() \ - do { \ - DMAOUT(deltzx); \ - DMAOUT(deltzy); \ - DMAOUT(zstart); \ - DMAOUT(delt12); \ - DMAOUT(end12); \ - DMAOUT(delt01); \ - DMAOUT(end01); \ - DMAOUT(delt02); \ - DMAOUT(start02); \ - DMAOUT(iy0); \ - DMAOUT(((((iy0 - iy1) & 0x7FF) << 16) | \ - ((iy1 - iy2) & 0x7FF) | lr)); \ - } while (0) - -- cgit v1.2.3 From fd7ee2bcb74edf8c4412a244c33fd4749509b912 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Thu, 22 Oct 2009 12:57:13 -0700 Subject: Kill off trident. Hm. I could have said "chew trident and spit it out," or perhaps "spear trident," instead. Dohoho. --- src/mesa/drivers/dri/trident/Makefile | 25 - src/mesa/drivers/dri/trident/trident_context.c | 465 ---------- src/mesa/drivers/dri/trident/trident_context.h | 242 ----- src/mesa/drivers/dri/trident/trident_dd.c | 110 --- src/mesa/drivers/dri/trident/trident_dri.h | 28 - src/mesa/drivers/dri/trident/trident_lock.h | 11 - src/mesa/drivers/dri/trident/trident_state.c | 548 ------------ src/mesa/drivers/dri/trident/trident_tris.c | 1125 ------------------------ src/mesa/drivers/dri/trident/trident_vb.c | 434 --------- 9 files changed, 2988 deletions(-) delete mode 100644 src/mesa/drivers/dri/trident/Makefile delete mode 100644 src/mesa/drivers/dri/trident/trident_context.c delete mode 100644 src/mesa/drivers/dri/trident/trident_context.h delete mode 100644 src/mesa/drivers/dri/trident/trident_dd.c delete mode 100644 src/mesa/drivers/dri/trident/trident_dri.h delete mode 100644 src/mesa/drivers/dri/trident/trident_lock.h delete mode 100644 src/mesa/drivers/dri/trident/trident_state.c delete mode 100644 src/mesa/drivers/dri/trident/trident_tris.c delete mode 100644 src/mesa/drivers/dri/trident/trident_vb.c (limited to 'src') diff --git a/src/mesa/drivers/dri/trident/Makefile b/src/mesa/drivers/dri/trident/Makefile deleted file mode 100644 index bd9b7f35a2..0000000000 --- a/src/mesa/drivers/dri/trident/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# src/mesa/drivers/dri/trident/Makefile - -TOP = ../../../../.. -include $(TOP)/configs/current - -LIBNAME = trident_dri.so - -# Not yet -# MINIGLX_SOURCES = server/trident_dri.c - -DRIVER_SOURCES = \ - trident_context.c \ - trident_state.c \ - trident_vb.c \ - trident_dd.c \ - trident_tris.c - -C_SOURCES = \ - $(COMMON_SOURCES) \ - $(DRIVER_SOURCES) - -ASM_SOURCES = - -include ../Makefile.template - diff --git a/src/mesa/drivers/dri/trident/trident_context.c b/src/mesa/drivers/dri/trident/trident_context.c deleted file mode 100644 index b5126b07ea..0000000000 --- a/src/mesa/drivers/dri/trident/trident_context.c +++ /dev/null @@ -1,465 +0,0 @@ -/* - * Copyright 2002 by Alan Hourihane, Sychdyn, North Wales, UK. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Authors: Alan Hourihane, - * - * Trident CyberBladeXP driver. - * - */ -#include "trident_dri.h" -#include "trident_context.h" -#include "trident_lock.h" - -#include "swrast/swrast.h" -#include "swrast_setup/swrast_setup.h" -#include "vbo/vbo.h" - -#include "tnl/tnl.h" -#include "tnl/t_pipeline.h" - -#include "main/context.h" -#include "main/simple_list.h" -#include "main/matrix.h" -#include "main/extensions.h" -#include "main/framebuffer.h" -#include "main/renderbuffer.h" -#include "main/viewport.h" -#if defined(USE_X86_ASM) -#include "x86/common_x86_asm.h" -#endif -#include "main/simple_list.h" -#include "main/mm.h" -#include "drirenderbuffer.h" - -#include "drivers/common/driverfuncs.h" -#include "dri_util.h" -#include "utils.h" - -static const struct tnl_pipeline_stage *trident_pipeline[] = { - &_tnl_vertex_transform_stage, - &_tnl_normal_transform_stage, - &_tnl_lighting_stage, - &_tnl_texgen_stage, - &_tnl_texture_transform_stage, - &_tnl_render_stage, - 0, -}; - - -static GLboolean -tridentCreateContext( const __GLcontextModes *glVisual, - __DRIcontextPrivate *driContextPriv, - void *sharedContextPrivate) -{ - GLcontext *ctx, *shareCtx; - __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; - tridentContextPtr tmesa; - tridentScreenPtr tridentscrn; - struct dd_function_table functions; -#if 0 - drm_trident_sarea_t *saPriv=(drm_trident_sarea_t *)(((char*)sPriv->pSAREA)+ - sizeof(XF86DRISAREARec)); -#endif - - tmesa = (tridentContextPtr) CALLOC( sizeof(*tmesa) ); - if ( !tmesa ) return GL_FALSE; - - /* Allocate the Mesa context */ - if (sharedContextPrivate) - shareCtx = ((tridentContextPtr) sharedContextPrivate)->glCtx; - else - shareCtx = NULL; - - _mesa_init_driver_functions(&functions); - - tmesa->glCtx = - _mesa_create_context(glVisual, shareCtx, &functions, (void *)tmesa); - - if (!tmesa->glCtx) { - FREE(tmesa); - return GL_FALSE; - } - - tmesa->driContext = driContextPriv; - tmesa->driScreen = sPriv; - tmesa->driDrawable = NULL; /* Set by XMesaMakeCurrent */ - - tmesa->hHWContext = driContextPriv->hHWContext; - tmesa->driHwLock = (drmLock *)&sPriv->pSAREA->lock; - tmesa->driFd = sPriv->fd; -#if 0 - tmesa->sarea = saPriv; -#endif - - tridentscrn = tmesa->tridentScreen = (tridentScreenPtr)(sPriv->private); - - ctx = tmesa->glCtx; - - ctx->Const.MaxTextureLevels = 13; /* 4K by 4K? Is that right? */ - ctx->Const.MaxTextureUnits = 1; /* Permedia 3 */ - - ctx->Const.MinLineWidth = 0.0; - ctx->Const.MaxLineWidth = 255.0; - - ctx->Const.MinLineWidthAA = 0.0; - ctx->Const.MaxLineWidthAA = 65536.0; - - ctx->Const.MinPointSize = 0.0; - ctx->Const.MaxPointSize = 255.0; - - ctx->Const.MinPointSizeAA = 0.5; /* 4x4 quality mode */ - ctx->Const.MaxPointSizeAA = 16.0; - ctx->Const.PointSizeGranularity = 0.25; - - ctx->Const.MaxDrawBuffers = 1; - -#if 0 - tmesa->texHeap = mmInit( 0, tmesa->tridentScreen->textureSize ); - - make_empty_list(&tmesa->TexObjList); - make_empty_list(&tmesa->SwappedOut); - - tmesa->CurrentTexObj[0] = 0; - tmesa->CurrentTexObj[1] = 0; /* Permedia 3, second texture */ - - tmesa->RenderIndex = ~0; -#endif - - /* Initialize the software rasterizer and helper modules. - */ - _swrast_CreateContext( ctx ); - _vbo_CreateContext( ctx ); - _tnl_CreateContext( ctx ); - _swsetup_CreateContext( ctx ); - - /* Install the customized pipeline: - */ - _tnl_destroy_pipeline( ctx ); - _tnl_install_pipeline( ctx, trident_pipeline ); - - /* Configure swrast to match hardware characteristics: - */ - _swrast_allow_pixel_fog( ctx, GL_FALSE ); - _swrast_allow_vertex_fog( ctx, GL_TRUE ); - - tridentInitVB( ctx ); - tridentDDInitExtensions( ctx ); - tridentDDInitDriverFuncs( ctx ); - tridentDDInitStateFuncs( ctx ); -#if 0 - tridentDDInitSpanFuncs( ctx ); - tridentDDInitTextureFuncs( ctx ); -#endif - tridentDDInitTriFuncs( ctx ); - tridentDDInitState( tmesa ); - - driContextPriv->driverPrivate = (void *)tmesa; - - UNLOCK_HARDWARE(tmesa); - - return GL_TRUE; -} - -static void -tridentDestroyContext(__DRIcontextPrivate *driContextPriv) -{ - tridentContextPtr tmesa = (tridentContextPtr)driContextPriv->driverPrivate; - - if (tmesa) { - _swsetup_DestroyContext( tmesa->glCtx ); - _tnl_DestroyContext( tmesa->glCtx ); - _vbo_DestroyContext( tmesa->glCtx ); - _swrast_DestroyContext( tmesa->glCtx ); - - /* free the Mesa context */ - tmesa->glCtx->DriverCtx = NULL; - _mesa_destroy_context(tmesa->glCtx); - - _mesa_free(tmesa); - driContextPriv->driverPrivate = NULL; - } -} - - -static GLboolean -tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv, - __DRIdrawablePrivate *driDrawPriv, - const __GLcontextModes *mesaVis, - GLboolean isPixmap ) -{ - tridentScreenPtr screen = (tridentScreenPtr) driScrnPriv->private; - - if (isPixmap) { - return GL_FALSE; /* not implemented */ - } - else { - struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis); - - { - driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp, - screen->frontOffset, screen->frontPitch, - driDrawPriv); - /* - tridentSetSpanFunctions(frontRb, mesaVis); - */ - _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); - } - - if (mesaVis->doubleBufferMode) { - driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp, - screen->backOffset, screen->backPitch, - driDrawPriv); - /* - tridentSetSpanFunctions(backRb, mesaVis); - */ - _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); - } - - if (mesaVis->depthBits == 16) { - driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL, screen->cpp, - screen->depthOffset, screen->depthPitch, - driDrawPriv); - /* - tridentSetSpanFunctions(depthRb, mesaVis); - */ - _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); - } - else if (mesaVis->depthBits == 24) { - driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, NULL, screen->cpp, - screen->depthOffset, screen->depthPitch, - driDrawPriv); - /* - tridentSetSpanFunctions(depthRb, mesaVis); - */ - _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); - } - - /* no h/w stencil? - if (mesaVis->stencilBits > 0 && !swStencil) { - driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT); - tridentSetSpanFunctions(stencilRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); - } - */ - - _mesa_add_soft_renderbuffers(fb, - GL_FALSE, /* color */ - GL_FALSE, /* depth */ - mesaVis->stencilBits > 0, - mesaVis->accumRedBits > 0, - GL_FALSE, /* alpha */ - GL_FALSE /* aux */); - driDrawPriv->driverPrivate = (void *) fb; - - return (driDrawPriv->driverPrivate != NULL); - } -} - - -static void -tridentDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) -{ - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); -} - -static void -tridentSwapBuffers(__DRIdrawablePrivate *drawablePrivate) -{ - __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate; - - if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { - tridentContextPtr tmesa; - GLcontext *ctx; - tmesa = (tridentContextPtr) dPriv->driContextPriv->driverPrivate; - ctx = tmesa->glCtx; - if (ctx->Visual.doubleBufferMode) { - _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */ - tridentCopyBuffer( dPriv ); - } - } - else { - /* XXX this shouldn't be an error but we can't handle it for now */ - _mesa_problem(NULL, "tridentSwapBuffers: drawable has no context!\n"); - } -} - -static GLboolean -tridentMakeCurrent(__DRIcontextPrivate *driContextPriv, - __DRIdrawablePrivate *driDrawPriv, - __DRIdrawablePrivate *driReadPriv) -{ - if (driContextPriv) { - GET_CURRENT_CONTEXT(ctx); - tridentContextPtr oldCtx = ctx ? TRIDENT_CONTEXT(ctx) : NULL; - tridentContextPtr newCtx = (tridentContextPtr) driContextPriv->driverPrivate; - - if ( newCtx != oldCtx ) { - newCtx->dirty = ~0; - } - - if (newCtx->driDrawable != driDrawPriv) { - newCtx->driDrawable = driDrawPriv; -#if 0 - tridentUpdateWindow ( newCtx->glCtx ); - tridentUpdateViewportOffset( newCtx->glCtx ); -#endif - } - - newCtx->drawOffset = newCtx->tridentScreen->backOffset; - newCtx->drawPitch = newCtx->tridentScreen->backPitch; - - _mesa_make_current( newCtx->glCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate ); - - if (!newCtx->glCtx->Viewport.Width) { - _mesa_set_viewport(newCtx->glCtx, 0, 0, - driDrawPriv->w, driDrawPriv->h); - } - } else { - _mesa_make_current( NULL, NULL, NULL ); - } - return GL_TRUE; -} - - -static GLboolean -tridentUnbindContext( __DRIcontextPrivate *driContextPriv ) -{ - return GL_TRUE; -} - - -static tridentScreenPtr -tridentCreateScreen( __DRIscreenPrivate *sPriv ) -{ - TRIDENTDRIPtr tDRIPriv = (TRIDENTDRIPtr)sPriv->pDevPriv; - tridentScreenPtr tridentScreen; - - if (sPriv->devPrivSize != sizeof(TRIDENTDRIRec)) { - fprintf(stderr,"\nERROR! sizeof(TRIDENTDRIRec) does not match passed size from device driver\n"); - return GL_FALSE; - } - - /* Allocate the private area */ - tridentScreen = (tridentScreenPtr) CALLOC( sizeof(*tridentScreen) ); - if ( !tridentScreen ) return NULL; - - tridentScreen->driScreen = sPriv; - - tridentScreen->frontOffset = tDRIPriv->frontOffset; - tridentScreen->backOffset = tDRIPriv->backOffset; - tridentScreen->depthOffset = tDRIPriv->depthOffset; - tridentScreen->frontPitch = tDRIPriv->frontPitch; - tridentScreen->backPitch = tDRIPriv->backPitch; - tridentScreen->depthPitch = tDRIPriv->depthPitch; - tridentScreen->width = tDRIPriv->width; - tridentScreen->height = tDRIPriv->height; - -printf("%d %d\n",tridentScreen->width,tridentScreen->height); -printf("%d %d\n",tridentScreen->frontPitch,tridentScreen->backPitch); -printf("offset 0x%x 0x%x\n",tridentScreen->backOffset,tridentScreen->depthOffset); - - tridentScreen->mmio.handle = tDRIPriv->regs; - tridentScreen->mmio.size = 0x20000; - - if (drmMap(sPriv->fd, - tridentScreen->mmio.handle, tridentScreen->mmio.size, - (drmAddressPtr)&tridentScreen->mmio.map)) { - FREE(tridentScreen); - return GL_FALSE; - } -printf("MAPPED at %p\n", tridentScreen->mmio.map); - - return tridentScreen; -} - -/* Destroy the device specific screen private data struct. - */ -static void -tridentDestroyScreen( __DRIscreenPrivate *sPriv ) -{ - tridentScreenPtr tridentScreen = (tridentScreenPtr)sPriv->private; - - FREE(tridentScreen); -} - -static GLboolean -tridentInitDriver(__DRIscreenPrivate *sPriv) -{ - sPriv->private = (void *) tridentCreateScreen( sPriv ); - - if (!sPriv->private) { - tridentDestroyScreen( sPriv ); - return GL_FALSE; - } - - return GL_TRUE; -} - -/** - * This is the driver specific part of the createNewScreen entry point. - * - * \todo maybe fold this into intelInitDriver - * - * \return the __GLcontextModes supported by this driver - */ -const __DRIconfig **tridentInitScreen(__DRIscreenPrivate *psp) -{ - static const __DRIversion ddx_expected = { 4, 0, 0 }; - static const __DRIversion dri_expected = { 3, 1, 0 }; - static const __DRIversion drm_expected = { 1, 0, 0 }; - - if ( ! driCheckDriDdxDrmVersions2( "Trident", - &psp->dri_version, & dri_expected, - &psp->ddx_version, & ddx_expected, - &psp->drm_version, & drm_expected ) ) - return NULL; - - if (!tridentInitDriver(psp)) - return NULL; - - /* Wait... what? This driver doesn't report any modes... */ -#if 0 - TRIDENTDRIPtr dri_priv = (TRIDENTDRIPtr) psp->pDevPriv; - *driver_modes = tridentFillInModes( dri_priv->bytesPerPixel * 8, - GL_TRUE ); -#endif - - return NULL; -} - -const struct __DriverAPIRec driDriverAPI = { - tridentInitScreen, - tridentDestroyScreen, - tridentCreateContext, - tridentDestroyContext, - tridentCreateBuffer, - tridentDestroyBuffer, - tridentSwapBuffers, - tridentMakeCurrent, - tridentUnbindContext, -}; diff --git a/src/mesa/drivers/dri/trident/trident_context.h b/src/mesa/drivers/dri/trident/trident_context.h deleted file mode 100644 index fbbb4a96e7..0000000000 --- a/src/mesa/drivers/dri/trident/trident_context.h +++ /dev/null @@ -1,242 +0,0 @@ -/* - * Copyright 2002 by Alan Hourihane, Sychdyn, North Wales, UK. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Authors: Alan Hourihane, - * - * Trident CyberBladeXP driver. - * - */ -#ifndef _TRIDENT_CONTEXT_H_ -#define _TRIDENT_CONTEXT_H_ - -#include "dri_util.h" -#include "main/macros.h" -#include "main/mtypes.h" -#include "drm.h" -#include "main/mm.h" - -#define SUBPIXEL_X (0.0F) -#define SUBPIXEL_Y (0.125F) - -#define _TRIDENT_NEW_VERTEX (_NEW_TEXTURE | \ - _DD_NEW_TRI_UNFILLED | \ - _DD_NEW_TRI_LIGHT_TWOSIDE) - -#define TRIDENT_FALLBACK_TEXTURE 0x01 -#define TRIDENT_FALLBACK_DRAW_BUFFER 0x02 - -#define TRIDENT_NEW_CLIP 0x01 - -#define TRIDENT_UPLOAD_COMMAND_D 0x00000001 -#define TRIDENT_UPLOAD_CONTEXT 0x04000000 -#define TRIDENT_UPLOAD_CLIPRECTS 0x80000000 - -#define TAG(x) trident##x -#include "tnl_dd/t_dd_vertex.h" -#undef TAG - -/* these require that base be dword-aligned */ -static INLINE void MMIO_OUT32(unsigned char *base, unsigned int offset, - unsigned int val) -{ - unsigned int *addr = (unsigned int *)(base + offset); - *addr = val; -} - -static INLINE unsigned int MMIO_IN32(unsigned char *base, unsigned int offset) -{ - unsigned int *addr = (unsigned int *)(base + offset); - return *addr; -} - -#define MMIO_OUT8(base, offset, val) *((base) + (offset)) = (val) -#define MMIO_IN8(base, offset) *((base) + (offset)) - -struct trident_context; -typedef struct trident_context tridentContextRec; -typedef struct trident_context *tridentContextPtr; - -typedef void (*trident_quad_func)( tridentContextPtr, - const tridentVertex *, - const tridentVertex *, - const tridentVertex *, - const tridentVertex * ); -typedef void (*trident_tri_func)( tridentContextPtr, - const tridentVertex *, - const tridentVertex *, - const tridentVertex * ); -typedef void (*trident_line_func)( tridentContextPtr, - const tridentVertex *, - const tridentVertex * ); -typedef void (*trident_point_func)( tridentContextPtr, - const tridentVertex * ); - -typedef struct { - drm_handle_t handle; /* Handle to the DRM region */ - drmSize size; /* Size of the DRM region */ - unsigned char *map; /* Mapping of the DRM region */ -} tridentRegionRec, *tridentRegionPtr; - -typedef struct { - __DRIscreenPrivate *driScreen; /* Back pointer to DRI screen */ - - drmBufMapPtr buffers; - - unsigned int frontOffset; - unsigned int frontPitch; - unsigned int backOffset; - unsigned int backPitch; - unsigned int depthOffset; - unsigned int depthPitch; - unsigned int width; - unsigned int height; - unsigned int cpp; - -#if 0 - unsigned int sarea_priv_offset; -#endif - - tridentRegionRec mmio; -} tridentScreenRec, *tridentScreenPtr; - -/** - * tridentRenderbuffer, derived from Mesa's gl_renderbuffer - */ -typedef struct { - struct gl_renderbuffer Base; - /* XXX per-window info should go here */ - int foo, bar; -} tridentRenderbuffer; - - -struct trident_context { - GLcontext *glCtx; /* Mesa context */ - - __DRIcontextPrivate *driContext; - __DRIscreenPrivate *driScreen; - __DRIdrawablePrivate *driDrawable; - - GLuint new_gl_state; - GLuint new_state; - GLuint dirty; - -#if 0 - drm_trident_sarea_t *sarea; -#endif - - /* Temporaries for translating away float colors: - */ - struct gl_client_array UbyteColor; - struct gl_client_array UbyteSecondaryColor; - - /* Mirrors of some DRI state - */ - int lastStamp; /* mirror driDrawable->lastStamp */ - - drm_context_t hHWContext; - drmLock *driHwLock; - int driFd; - - tridentScreenPtr tridentScreen; /* Screen private DRI data */ - - /* Visual, drawable, cliprect and scissor information - */ - GLenum DrawBuffer; - GLint drawOffset, drawPitch; - GLint drawX, drawY; /* origin of drawable in draw buffer */ - GLint readOffset, readPitch; - - GLuint numClipRects; /* Cliprects for the draw buffer */ - drm_clip_rect_t *pClipRects; - - GLint scissor; - drm_clip_rect_t ScissorRect; /* Current software scissor */ - - GLuint Fallback; - GLuint RenderIndex; - GLuint SetupNewInputs; - GLuint SetupIndex; - GLfloat hw_viewport[16]; - GLfloat depth_scale; - GLuint vertex_format; - GLuint vertex_size; - GLuint vertex_stride_shift; - GLubyte *verts; - - GLint tmu_source[2]; - - GLuint hw_primitive; - GLenum render_primitive; - - trident_point_func draw_point; - trident_line_func draw_line; - trident_tri_func draw_tri; - trident_quad_func draw_quad; - -#if 0 - gammaTextureObjectPtr CurrentTexObj[2]; - struct gamma_texture_object_t TexObjList; - struct gamma_texture_object_t SwappedOut; - GLenum TexEnvImageFmt[2]; - - struct mem_block *texHeap; - - int lastSwap; - int texAge; - int ctxAge; - int dirtyAge; - int lastStamp; -#endif - - /* Chip state */ - - int commandD; - - /* Context State */ - - int ClearColor; -}; - -void tridentDDInitExtensions( GLcontext *ctx ); -void tridentDDInitDriverFuncs( GLcontext *ctx ); -void tridentDDInitSpanFuncs( GLcontext *ctx ); -void tridentDDInitState( tridentContextPtr tmesa ); -void tridentInitHW( tridentContextPtr tmesa ); -void tridentDDInitStateFuncs( GLcontext *ctx ); -void tridentDDInitTextureFuncs( GLcontext *ctx ); -void tridentDDInitTriFuncs( GLcontext *ctx ); - -extern void tridentBuildVertices( GLcontext *ctx, - GLuint start, - GLuint count, - GLuint newinputs ); -extern void tridentInitVB( GLcontext *ctx ); -extern void tridentCopyBuffer( const __DRIdrawablePrivate *dPriv ); -extern void tridentFallback( tridentContextPtr tmesa, GLuint bit, - GLboolean mode ); -extern void tridentCheckTexSizes( GLcontext *ctx ); -extern void tridentChooseVertexState( GLcontext *ctx ); -extern void tridentDDUpdateHWState( GLcontext *ctx ); -extern void tridentUploadHwStateLocked( tridentContextPtr tmesa ); - -#define TRIDENT_CONTEXT(ctx) ((tridentContextPtr)(ctx->DriverCtx)) - -#endif /* _TRIDENT_CONTEXT_H_ */ diff --git a/src/mesa/drivers/dri/trident/trident_dd.c b/src/mesa/drivers/dri/trident/trident_dd.c deleted file mode 100644 index faa40c36a2..0000000000 --- a/src/mesa/drivers/dri/trident/trident_dd.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 2002 by Alan Hourihane, Sychdyn, North Wales, UK. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Authors: Alan Hourihane, - * - * Trident CyberBladeXP driver. - * - */ -#include "trident_context.h" -#include "trident_lock.h" -#if defined(USE_X86_ASM) -#include "x86/common_x86_asm.h" -#endif - -#include "swrast/swrast.h" -#include "main/context.h" -#include "main/framebuffer.h" - -#define TRIDENT_DATE "20041223" - -/* Return the width and height of the current color buffer. - */ -static void tridentDDGetBufferSize( GLframebuffer *framebuffer, - GLuint *width, GLuint *height ) -{ - GET_CURRENT_CONTEXT(ctx); - tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); - - LOCK_HARDWARE(tmesa); - *width = tmesa->driDrawable->w; - *height = tmesa->driDrawable->h; - UNLOCK_HARDWARE(tmesa); -} - - -/* Return various strings for glGetString(). - */ -static const GLubyte *tridentDDGetString( GLcontext *ctx, GLenum name ) -{ - static char buffer[128]; - - switch ( name ) { - case GL_VENDOR: - return (GLubyte *)"Alan Hourihane"; - - case GL_RENDERER: - sprintf( buffer, "Mesa DRI Trident " TRIDENT_DATE ); - - /* Append any CPU-specific information. - */ -#ifdef USE_X86_ASM - if ( _mesa_x86_cpu_features ) { - strncat( buffer, " x86", 4 ); - } -#ifdef USE_MMX_ASM - if ( cpu_has_mmx ) { - strncat( buffer, "/MMX", 4 ); - } -#endif -#ifdef USE_3DNOW_ASM - if ( cpu_has_3dnow ) { - strncat( buffer, "/3DNow!", 7 ); - } -#endif -#ifdef USE_SSE_ASM - if ( cpu_has_xmm ) { - strncat( buffer, "/SSE", 4 ); - } -#endif -#endif - return (GLubyte *)buffer; - - default: - return NULL; - } -} - -/* Enable the extensions supported by this driver. - */ -void tridentDDInitExtensions( GLcontext *ctx ) -{ - /* None... */ -} - -/* Initialize the driver's misc functions. - */ -void tridentDDInitDriverFuncs( GLcontext *ctx ) -{ - ctx->Driver.GetBufferSize = tridentDDGetBufferSize; - ctx->Driver.GetString = tridentDDGetString; - ctx->Driver.Error = NULL; -} diff --git a/src/mesa/drivers/dri/trident/trident_dri.h b/src/mesa/drivers/dri/trident/trident_dri.h deleted file mode 100644 index c1ce3c4682..0000000000 --- a/src/mesa/drivers/dri/trident/trident_dri.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _TRIDENT_DRI_ -#define _TRIDENT_DRI_ - -#include "xf86drm.h" - -typedef struct { - drm_handle_t regs; - drmSize regsSize; - drmAddress regsMap; - int deviceID; - int width; - int height; - int mem; - int frontOffset; - int frontPitch; - int backOffset; - int backPitch; - int depthOffset; - int depthPitch; - int cpp; -#if 0 - int textureOffset; - int textureSize; -#endif - unsigned int sarea_priv_offset; -} TRIDENTDRIRec, *TRIDENTDRIPtr; - -#endif diff --git a/src/mesa/drivers/dri/trident/trident_lock.h b/src/mesa/drivers/dri/trident/trident_lock.h deleted file mode 100644 index ee0819f5ca..0000000000 --- a/src/mesa/drivers/dri/trident/trident_lock.h +++ /dev/null @@ -1,11 +0,0 @@ -/* XXX tridentGetLock doesn't exist... */ - -#define LOCK_HARDWARE(tmesa) \ - do { \ - char __ret = 0; \ - DRM_CAS(tmesa->driHwLock, tmesa->hHWContext, \ - DRM_LOCK_HELD | tmesa->hHWContext, __ret); \ - } while (0) - -#define UNLOCK_HARDWARE(tmesa) \ - DRM_UNLOCK(tmesa->driFd, tmesa->driHwLock, tmesa->hHWContext) diff --git a/src/mesa/drivers/dri/trident/trident_state.c b/src/mesa/drivers/dri/trident/trident_state.c deleted file mode 100644 index e68d3a73c6..0000000000 --- a/src/mesa/drivers/dri/trident/trident_state.c +++ /dev/null @@ -1,548 +0,0 @@ -/* - * Copyright 2002 by Alan Hourihane, Sychdyn, North Wales, UK. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Authors: Alan Hourihane, - * - * Trident CyberBladeXP driver. - * - */ -#include "trident_context.h" -#include "trident_lock.h" -#include "vbo/vbo.h" -#include "swrast/swrast.h" -#include "swrast_setup/swrast_setup.h" -#include "tnl/tnl.h" -#include "main/framebuffer.h" - -#define TRIDENTPACKCOLOR332(r, g, b) \ - (((r) & 0xe0) | (((g) & 0xe0) >> 3) | (((b) & 0xc0) >> 6)) - -#define TRIDENTPACKCOLOR1555(r, g, b, a) \ - ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \ - ((a) ? 0x8000 : 0)) - -#define TRIDENTPACKCOLOR565(r, g, b) \ - ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3)) - -#define TRIDENTPACKCOLOR888(r, g, b) \ - (((r) << 16) | ((g) << 8) | (b)) - -#define TRIDENTPACKCOLOR8888(r, g, b, a) \ - (((a) << 24) | ((r) << 16) | ((g) << 8) | (b)) - -#define TRIDENTPACKCOLOR4444(r, g, b, a) \ - ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4)) - -static INLINE GLuint tridentPackColor( GLuint cpp, - GLubyte r, GLubyte g, - GLubyte b, GLubyte a ) -{ - switch ( cpp ) { - case 2: - return TRIDENTPACKCOLOR565( r, g, b ); - case 4: - return TRIDENTPACKCOLOR8888( r, g, b, a ); - default: - return 0; - } -} - -void tridentUploadHwStateLocked( tridentContextPtr tmesa ) -{ - unsigned char *MMIO = tmesa->tridentScreen->mmio.map; -#if 0 - ATISAREAPrivPtr sarea = tmesa->sarea; - trident_context_regs_t *regs = &(sarea->ContextState); -#endif - - if ( tmesa->dirty & TRIDENT_UPLOAD_COMMAND_D ) { - MMIO_OUT32(MMIO, 0x00281C, tmesa->commandD ); - tmesa->dirty &= ~TRIDENT_UPLOAD_COMMAND_D; - } - - if ( tmesa->dirty & TRIDENT_UPLOAD_CLIPRECTS ) { - /* XXX FIX ME ! */ - MMIO_OUT32(MMIO, 0x002C80 , 0x20008000 | tmesa->tridentScreen->height ); - MMIO_OUT32(MMIO, 0x002C84 , 0x20000000 | tmesa->tridentScreen->width ); - tmesa->dirty &= ~TRIDENT_UPLOAD_CLIPRECTS; - } - - tmesa->dirty = 0; -} - -/* Copy the back color buffer to the front color buffer. - */ -void tridentCopyBuffer( const __DRIdrawablePrivate *dPriv ) -{ - unsigned char *MMIO; - tridentContextPtr tmesa; - GLint nbox, i; - int busy; - drm_clip_rect_t *pbox; - - assert(dPriv); - assert(dPriv->driContextPriv); - assert(dPriv->driContextPriv->driverPrivate); - - tmesa = (tridentContextPtr) dPriv->driContextPriv->driverPrivate; - MMIO = tmesa->tridentScreen->mmio.map; - - LOCK_HARDWARE( tmesa ); - - /* use front buffer cliprects */ - nbox = dPriv->numClipRects; - pbox = dPriv->pClipRects; - - for ( i = 0 ; i < nbox ; i++ ) { -#if 0 - GLint nr = MIN2( i + MACH64_NR_SAREA_CLIPRECTS , nbox ); - drm_clip_rect_t *b = tmesa->sarea->boxes; - GLint n = 0; - - for ( ; i < nr ; i++ ) { - *b++ = pbox[i]; - n++; - } - tmesa->sarea->nbox = n; -#endif - - MMIO_OUT32(MMIO, 0x2150, tmesa->tridentScreen->frontPitch << 20 | tmesa->tridentScreen->frontOffset>>4); - MMIO_OUT32(MMIO, 0x2154, tmesa->tridentScreen->backPitch << 20 | tmesa->tridentScreen->backOffset>>4); - MMIO_OUT8(MMIO, 0x2127, 0xCC); /* Copy Rop */ - MMIO_OUT32(MMIO, 0x2128, 0x4); /* scr2scr */ - MMIO_OUT32(MMIO, 0x2138, (pbox->x1 << 16) | pbox->y1); - MMIO_OUT32(MMIO, 0x213C, (pbox->x1 << 16) | pbox->y1); - MMIO_OUT32(MMIO, 0x2140, (pbox->x2 - pbox->x1) << 16 | (pbox->y2 - pbox->y1) ); - MMIO_OUT8(MMIO, 0x2124, 0x01); /* BLT */ -#define GE_BUSY 0x80 - for (;;) { - busy = MMIO_IN8(MMIO, 0x2120); - if ( !(busy & GE_BUSY) ) - break; - } - } - - UNLOCK_HARDWARE( tmesa ); - -#if 0 - tmesa->dirty |= (MACH64_UPLOAD_CONTEXT | - MACH64_UPLOAD_MISC | - MACH64_UPLOAD_CLIPRECTS); -#endif -} - - -static void tridentDDClear( GLcontext *ctx, GLbitfield mask ) -{ - tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); - unsigned char *MMIO = tmesa->tridentScreen->mmio.map; - int busy; - GLuint flags = 0; - GLint i; - GLint cx, cy, cw, ch; - -#define DRM_TRIDENT_FRONT 0x01 -#define DRM_TRIDENT_BACK 0x02 -#define DRM_TRIDENT_DEPTH 0x04 - - if ( tmesa->new_state ) - tridentDDUpdateHWState( ctx ); - - if ( mask & BUFFER_BIT_FRONT_LEFT ) { - flags |= DRM_TRIDENT_FRONT; - mask &= ~BUFFER_BIT_FRONT_LEFT; - } - - if ( mask & BUFFER_BIT_BACK_LEFT ) { - flags |= DRM_TRIDENT_BACK; - mask &= ~BUFFER_BIT_BACK_LEFT; - } - - if ( ( mask & BUFFER_BIT_DEPTH ) && ctx->Depth.Mask ) { - flags |= DRM_TRIDENT_DEPTH; - mask &= ~BUFFER_BIT_DEPTH; - } - - LOCK_HARDWARE(tmesa); - - /* get region after locking: */ - cx = ctx->DrawBuffer->_Xmin; - cy = ctx->DrawBuffer->_Ymin; - cw = ctx->DrawBuffer->_Xmax - cx; - ch = ctx->DrawBuffer->_Ymax - cy; - - if ( flags ) { - - cx += tmesa->drawX; - cy += tmesa->drawY; - - /* HACK!!! - */ - if ( tmesa->dirty & ~TRIDENT_UPLOAD_CLIPRECTS ) { - tridentUploadHwStateLocked( tmesa ); - } - - for ( i = 0 ; i < tmesa->numClipRects ; i++ ) { -#if 0 - int nr = MIN2( i + TRIDENT_NR_SAREA_CLIPRECTS, tmesa->numClipRects ); - drm_clip_rect_t *box = tmesa->pClipRects; - drm_clip_rect_t *b = tmesa->sarea->boxes; - GLint n = 0; - - if ( !all ) { - for ( ; i < nr ; i++ ) { - GLint x = box[i].x1; - GLint y = box[i].y1; - GLint w = box[i].x2 - x; - GLint h = box[i].y2 - y; - - if ( x < cx ) w -= cx - x, x = cx; - if ( y < cy ) h -= cy - y, y = cy; - if ( x + w > cx + cw ) w = cx + cw - x; - if ( y + h > cy + ch ) h = cy + ch - y; - if ( w <= 0 ) continue; - if ( h <= 0 ) continue; - - b->x1 = x; - b->y1 = y; - b->x2 = x + w; - b->y2 = y + h; - b++; - n++; - } - } else { - for ( ; i < nr ; i++ ) { - *b++ = box[i]; - n++; - } - } - - tmesa->sarea->nbox = n; -#endif - -if (flags & DRM_TRIDENT_BACK) { - MMIO_OUT32(MMIO, 0x2150, tmesa->tridentScreen->backPitch << 20 | tmesa->tridentScreen->backOffset>>4); - MMIO_OUT8(MMIO, 0x2127, 0xF0); /* Pat Rop */ - MMIO_OUT32(MMIO, 0x2158, tmesa->ClearColor); - MMIO_OUT32(MMIO, 0x2128, 0x4000); /* solidfill */ - MMIO_OUT32(MMIO, 0x2138, cx << 16 | cy); - MMIO_OUT32(MMIO, 0x2140, cw << 16 | ch); - MMIO_OUT8(MMIO, 0x2124, 0x01); /* BLT */ -#define GE_BUSY 0x80 - for (;;) { - busy = MMIO_IN8(MMIO, 0x2120); - if ( !(busy & GE_BUSY) ) - break; - } -} -if (flags & DRM_TRIDENT_DEPTH) { - MMIO_OUT32(MMIO, 0x2150, tmesa->tridentScreen->depthPitch << 20 | tmesa->tridentScreen->depthOffset>>4); - MMIO_OUT8(MMIO, 0x2127, 0xF0); /* Pat Rop */ - MMIO_OUT32(MMIO, 0x2158, tmesa->ClearColor); - MMIO_OUT32(MMIO, 0x2128, 0x4000); /* solidfill */ - MMIO_OUT32(MMIO, 0x2138, cx << 16 | cy); - MMIO_OUT32(MMIO, 0x2140, cw << 16 | ch); - MMIO_OUT8(MMIO, 0x2124, 0x01); /* BLT */ -#define GE_BUSY 0x80 - for (;;) { - busy = MMIO_IN8(MMIO, 0x2120); - if ( !(busy & GE_BUSY) ) - break; - } -} - MMIO_OUT32(MMIO, 0x2150, tmesa->tridentScreen->frontPitch << 20 | tmesa->tridentScreen->frontOffset>>4); -if (flags & DRM_TRIDENT_FRONT) { - MMIO_OUT8(MMIO, 0x2127, 0xF0); /* Pat Rop */ - MMIO_OUT32(MMIO, 0x2158, tmesa->ClearColor); - MMIO_OUT32(MMIO, 0x2128, 0x4000); /* solidfill */ - MMIO_OUT32(MMIO, 0x2138, cx << 16 | cy); - MMIO_OUT32(MMIO, 0x2140, cw << 16 | ch); - MMIO_OUT8(MMIO, 0x2124, 0x01); /* BLT */ -#define GE_BUSY 0x80 - for (;;) { - busy = MMIO_IN8(MMIO, 0x2120); - if ( !(busy & GE_BUSY) ) - break; - } -} - - } - -#if 0 - tmesa->dirty |= (TRIDENT_UPLOAD_CONTEXT | - TRIDENT_UPLOAD_MISC | - TRIDENT_UPLOAD_CLIPRECTS); -#endif - } - - UNLOCK_HARDWARE(tmesa); - - if ( mask ) - _swrast_Clear( ctx, mask ); -} - -static void tridentDDShadeModel( GLcontext *ctx, GLenum mode ) -{ - tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); - GLuint s = tmesa->commandD; - -#define TRIDENT_FLAT_SHADE 0x000000E0 -#define TRIDENT_FLAT_SHADE_VERTEX_C 0x00000060 -#define TRIDENT_FLAT_SHADE_GOURAUD 0x00000080 - - s &= ~TRIDENT_FLAT_SHADE; - - switch ( mode ) { - case GL_FLAT: - s |= TRIDENT_FLAT_SHADE_VERTEX_C; - break; - case GL_SMOOTH: - s |= TRIDENT_FLAT_SHADE_GOURAUD; - break; - default: - return; - } - - if ( tmesa->commandD != s ) { - tmesa->commandD = s; - - tmesa->dirty |= TRIDENT_UPLOAD_COMMAND_D; - } -} - -static void -tridentCalcViewport( GLcontext *ctx ) -{ - tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); - const GLfloat *v = ctx->Viewport._WindowMap.m; - GLfloat *m = tmesa->hw_viewport; - - /* See also trident_translate_vertex. - */ - m[MAT_SX] = v[MAT_SX]; - m[MAT_TX] = v[MAT_TX] + tmesa->drawX + SUBPIXEL_X; - m[MAT_SY] = - v[MAT_SY]; - m[MAT_TY] = - v[MAT_TY] + tmesa->driDrawable->h + tmesa->drawY + SUBPIXEL_Y; -#if 0 - m[MAT_SZ] = v[MAT_SZ] * tmesa->depth_scale; - m[MAT_TZ] = v[MAT_TZ] * tmesa->depth_scale; -#else - m[MAT_SZ] = v[MAT_SZ]; - m[MAT_TZ] = v[MAT_TZ]; -#endif - - tmesa->SetupNewInputs = ~0; -} - -static void tridentDDViewport( GLcontext *ctx, - GLint x, GLint y, - GLsizei width, GLsizei height ) -{ - tridentCalcViewport( ctx ); -} - -static void tridentDDDepthRange( GLcontext *ctx, - GLclampd nearval, GLclampd farval ) -{ - tridentCalcViewport( ctx ); -} - -static void -tridentSetCliprects( tridentContextPtr tmesa, GLenum mode ) -{ - __DRIdrawablePrivate *dPriv = tmesa->driDrawable; - - switch ( mode ) { - case GL_FRONT_LEFT: - if (dPriv->numClipRects == 0) { - static drm_clip_rect_t zeroareacliprect = {0,0,0,0}; - tmesa->numClipRects = 1; - tmesa->pClipRects = &zeroareacliprect; - } else { - tmesa->numClipRects = dPriv->numClipRects; - tmesa->pClipRects = (drm_clip_rect_t *)dPriv->pClipRects; - } - tmesa->drawX = dPriv->x; - tmesa->drawY = dPriv->y; - break; - case GL_BACK_LEFT: - if ( dPriv->numBackClipRects == 0 ) { - if (dPriv->numClipRects == 0) { - static drm_clip_rect_t zeroareacliprect = {0,0,0,0}; - tmesa->numClipRects = 1; - tmesa->pClipRects = &zeroareacliprect; - } else { - tmesa->numClipRects = dPriv->numClipRects; - tmesa->pClipRects = (drm_clip_rect_t *)dPriv->pClipRects; - tmesa->drawX = dPriv->x; - tmesa->drawY = dPriv->y; - } - } - else { - tmesa->numClipRects = dPriv->numBackClipRects; - tmesa->pClipRects = (drm_clip_rect_t *)dPriv->pBackClipRects; - tmesa->drawX = dPriv->backX; - tmesa->drawY = dPriv->backY; - } - break; - default: - return; - } - -#if 0 - tmesa->dirty |= TRIDENT_UPLOAD_CLIPRECTS; -#endif -} - -#if 0 -static GLboolean tridentDDSetDrawBuffer( GLcontext *ctx, GLenum mode ) -{ - tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); - int found = GL_TRUE; - - if ( tmesa->DrawBuffer != mode ) { - tmesa->DrawBuffer = mode; - - switch ( mode ) { - case GL_FRONT_LEFT: - tridentFallback( tmesa, TRIDENT_FALLBACK_DRAW_BUFFER, GL_FALSE ); - tmesa->drawOffset = tmesa->tridentScreen->frontOffset; - tmesa->drawPitch = tmesa->tridentScreen->frontPitch; - tridentSetCliprects( tmesa, GL_FRONT_LEFT ); - break; - case GL_BACK_LEFT: - tridentFallback( tmesa, TRIDENT_FALLBACK_DRAW_BUFFER, GL_FALSE ); - tmesa->drawOffset = tmesa->tridentScreen->backOffset; - tmesa->drawPitch = tmesa->tridentScreen->backPitch; - tridentSetCliprects( tmesa, GL_BACK_LEFT ); - break; - default: - tridentFallback( tmesa, TRIDENT_FALLBACK_DRAW_BUFFER, GL_TRUE ); - found = GL_FALSE; - break; - } - -#if 0 - tmesa->setup.dst_off_pitch = (((tmesa->drawPitch/8) << 22) | - (tmesa->drawOffset >> 3)); - - tmesa->dirty |= MACH64_UPLOAD_DST_OFF_PITCH | MACH64_UPLOAD_CONTEXT; -#endif - - } - - return found; -} - -static void tridentDDClearColor( GLcontext *ctx, - const GLchan color[4] ) -{ - tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); - - tmesa->ClearColor = tridentPackColor( tmesa->tridentScreen->cpp, - color[0], color[1], - color[2], color[3] ); -} -#endif - -static void -tridentDDUpdateState( GLcontext *ctx, GLuint new_state ) -{ - _swrast_InvalidateState( ctx, new_state ); - _swsetup_InvalidateState( ctx, new_state ); - _vbo_InvalidateState( ctx, new_state ); - _tnl_InvalidateState( ctx, new_state ); - TRIDENT_CONTEXT(ctx)->new_gl_state |= new_state; -} - - -/* Initialize the context's hardware state. - */ -void tridentDDInitState( tridentContextPtr tmesa ) -{ - tmesa->new_state = 0; - - switch ( tmesa->glCtx->Visual.depthBits ) { - case 16: - tmesa->depth_scale = 1.0 / (GLfloat)0xffff; - break; - case 24: - tmesa->depth_scale = 1.0 / (GLfloat)0xffffff; - break; - } -} - -void tridentDDUpdateHWState( GLcontext *ctx ) -{ - tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); - int new_state = tmesa->new_state; - - if ( new_state ) - { - tmesa->new_state = 0; - -#if 0 - /* Update the various parts of the context's state. - */ - if ( new_state & GAMMA_NEW_ALPHA ) - tridentUpdateAlphaMode( ctx ); - - if ( new_state & GAMMA_NEW_DEPTH ) - tridentUpdateZMode( ctx ); - - if ( new_state & GAMMA_NEW_FOG ) - gammaUpdateFogAttrib( ctx ); - - if ( new_state & GAMMA_NEW_CLIP ) - gammaUpdateClipping( ctx ); - - if ( new_state & GAMMA_NEW_POLYGON ) - gammaUpdatePolygon( ctx ); - - if ( new_state & GAMMA_NEW_CULL ) - gammaUpdateCull( ctx ); - - if ( new_state & GAMMA_NEW_MASKS ) - gammaUpdateMasks( ctx ); - - if ( new_state & GAMMA_NEW_STIPPLE ) - gammaUpdateStipple( ctx ); -#endif - } - - /* HACK ! */ - -#if 0 - gammaEmitHwState( tmesa ); -#endif -} - -/* Initialize the driver's state functions. - */ -void tridentDDInitStateFuncs( GLcontext *ctx ) -{ - ctx->Driver.UpdateState = tridentDDUpdateState; - - ctx->Driver.Clear = tridentDDClear; - ctx->Driver.DepthRange = tridentDDDepthRange; - ctx->Driver.ShadeModel = tridentDDShadeModel; - ctx->Driver.Viewport = tridentDDViewport; -} diff --git a/src/mesa/drivers/dri/trident/trident_tris.c b/src/mesa/drivers/dri/trident/trident_tris.c deleted file mode 100644 index ee85ab482c..0000000000 --- a/src/mesa/drivers/dri/trident/trident_tris.c +++ /dev/null @@ -1,1125 +0,0 @@ -/* - * Copyright 2002 by Alan Hourihane, Sychdyn, North Wales, UK. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Authors: Alan Hourihane, - * - * Trident CyberBladeXP driver. - * - */ - -#include "trident_context.h" -#include "trident_lock.h" -#include "tnl/tnl.h" -#include "tnl/t_context.h" -#include "tnl/t_pipeline.h" -#include "swrast/swrast.h" -#include "swrast_setup/swrast_setup.h" - -static int first = 1; - -typedef struct reg { - int addr; - int data; -} RegData; - -RegData initRegData[]={ - {0x2804, 0x19980824}, - {0x2F70, 0x46455858}, - {0x2F74, 0x41584998}, - {0x2F00, 0x00000000}, - {0x2F04, 0x80000800}, - {0x2F08, 0x00550200}, - {0x2F40, 0x00000001}, - {0x2F40, 0x00000001}, - {0x2F44, 0x00830097}, - {0x2F48, 0x0087009F}, - {0x2F4C, 0x00BF0003}, - {0x2F50, 0xF00B6C1B}, - {0x2C04, 0x00000000}, - {0x2D00, 0x00000080}, - {0x2D00, 0x00000000}, - {0x2DD4, 0x00100000}, - {0x2DD4, 0x00100010}, - {0x2DD8, 0x00100000}, - {0x2DD8, 0x00100010}, - {0x2C88, 0xFFFFFFFF}, - {0x2C94 , 0xFFFFFFFF}, - {0x281C, 0x00008000}, - {0x2C80, 0x00000000}, - {0x2C80, 0x00000000}, - {0x2C80 , 0x00008000}, - {0x2C00 , 0x00000000}, - {0x2C04 , 0x00000000}, - {0x2C08 , 0x00000000}, - {0x2C0C , 0x00000000}, - {0x2C10 , 0x00000000}, - {0x2C14 , 0x00000000}, - {0x2C18 , 0x00000000}, - {0x2C1C , 0x00000000}, - {0x2C20 , 0x00000000}, - {0x2C24 , 0x00000000}, - {0x2C2C , 0x00000000}, - {0x2C30 , 0x00000000}, - {0x2C34 , 0x00000000}, - {0x2C38 , 0x00000000}, - {0x2C3C , 0x00000000}, - {0x2C40 , 0x00000000}, - {0x2C44 , 0x00000000}, - {0x2C48 , 0x00000000}, - {0x2C4C , 0x00000000}, - {0x2C50 , 0x00000000}, - {0x2C54 , 0x00000000}, - {0x2C58 , 0x00000000}, - {0x2C5C , 0x00000000}, - {0x2C60 , 0x00000000}, - {0x2C64 , 0x00000000}, - {0x2C68 , 0x00000000}, - {0x2C6C , 0x00000000}, - {0x2C70 , 0x00000000}, - {0x2C74 , 0x00000000}, - {0x2C78 , 0x00000000}, - {0x2C7C , 0x00000000}, - {0x2C80 , 0x00008000}, - {0x2C84 , 0x00000000}, - {0x2C88 , 0xFFFFFFFF}, - {0x2C8C , 0x00000000}, - {0x2C90 , 0x00000000}, - {0x2C94 , 0xFFFFFFFF}, - {0x2C98 , 0x00000000}, - {0x2C9C , 0x00000000}, - {0x2CA0 , 0x00000000}, - {0x2CA4 , 0x00000000}, - {0x2CA8 , 0x00000000}, - {0x2CAC , 0x00000000}, - {0x2CB0 , 0x00000000}, - {0x2CB4 , 0x00000000}, - {0x2CB8 , 0x00000000}, - {0x2CBC , 0x00000000}, - {0x2CC0 , 0x00000000}, - {0x2CC4 , 0x00000000}, - {0x2CC8 , 0x00000000}, - {0x2CCC , 0x00000000}, - {0x2CD0 , 0x00000000}, - {0x2CD4 , 0x00000000}, - {0x2CD8 , 0x00000000}, - {0x2CDC , 0x00000000}, - {0x2CE0 , 0x00000000}, - {0x2CE4 , 0x00000000}, - {0x2CE8 , 0x00000000}, - {0x2CEC , 0x00000000}, - {0x2CF0 , 0x00000000}, - {0x2CF4 , 0x00000000}, - {0x2CF8 , 0x00000000}, - {0x2CFC , 0x00000000}, - {0x2D00 , 0x00000000}, - {0x2D04 , 0x00000000}, - {0x2D08 , 0x00000000}, - {0x2D0C , 0x00000000}, - {0x2D10 , 0x00000000}, - {0x2D14 , 0x00000000}, - {0x2D18 , 0x00000000}, - {0x2D1C , 0x00000000}, - {0x2D20 , 0x00000000}, - {0x2D24 , 0x00000000}, - {0x2D28 , 0x00000000}, - {0x2D2C , 0x00000000}, - {0x2D30 , 0x00000000}, - {0x2D34 , 0x00000000}, - {0x2D38 , 0x00000000}, - {0x2D3C , 0x00000000}, - {0x2D40 , 0x00000000}, - {0x2D44 , 0x00000000}, - {0x2D48 , 0x00000000}, - {0x2D4C , 0x00000000}, - {0x2D50 , 0x00000000}, - {0x2D54 , 0x00000000}, - {0x2D58 , 0x00000000}, - {0x2D5C , 0x00000000}, - {0x2D60 , 0x00000000}, - {0x2D64 , 0x00000000}, - {0x2D68 , 0x00000000}, - {0x2D6C , 0x00000000}, - {0x2D70 , 0x00000000}, - {0x2D74 , 0x00000000}, - {0x2D78 , 0x00000000}, - {0x2D7C , 0x00000000}, - {0x2D80 , 0x00000000}, - {0x2D84 , 0x00000000}, - {0x2D88 , 0x00000000}, - {0x2D8C , 0x00000000}, - {0x2D90 , 0x00000000}, - {0x2D94 , 0x00000000}, - {0x2D98 , 0x00000000}, - {0x2D9C , 0x00000000}, - {0x2DA0 , 0x00000000}, - {0x2DA4 , 0x00000000}, - {0x2DA8 , 0x00000000}, - {0x2DAC , 0x00000000}, - {0x2DB0 , 0x00000000}, - {0x2DB4 , 0x00000000}, - {0x2DB8 , 0x00000000}, - {0x2DBC , 0x00000000}, - {0x2DC0 , 0x00000000}, - {0x2DC4 , 0x00000000}, - {0x2DC8 , 0x00000000}, - {0x2DCC , 0x00000000}, - {0x2DD0 , 0x00000000}, - {0x2DD4 , 0x00100010}, - {0x2DD8 , 0x00100010}, - {0x2DDC , 0x00000000}, - {0x2DE0 , 0x00000000}, - {0x2DE4 , 0x00000000}, - {0x2DE8 , 0x00000000}, - {0x2DEC , 0x00000000}, - {0x2DF0 , 0x00000000}, - {0x2DF4 , 0x00000000}, - {0x2DF8 , 0x00000000}, - {0x2DFC , 0x00000000}, - {0x2E00 , 0x00000000}, - {0x2E04 , 0x00000000}, - {0x2E08 , 0x00000000}, - {0x2E0C , 0x00000000}, - {0x2E10 , 0x00000000}, - {0x2E14 , 0x00000000}, - {0x2E18 , 0x00000000}, - {0x2E1C , 0x00000000}, - {0x2E20 , 0x00000000}, - {0x2E24 , 0x00000000}, - {0x2E28 , 0x00000000}, - {0x2E2C , 0x00000000}, - {0x2E30 , 0x00000000}, - {0x2E34 , 0x00000000}, - {0x2E38 , 0x00000000}, - {0x2E3C , 0x00000000}, - {0x2E40 , 0x00000000}, - {0x2E44 , 0x00000000}, - {0x2E48 , 0x00000000}, - {0x2E4C , 0x00000000}, - {0x2E50 , 0x00000000}, - {0x2E54 , 0x00000000}, - {0x2E58 , 0x00000000}, - {0x2E5C , 0x00000000}, - {0x2E60 , 0x00000000}, - {0x2E64 , 0x00000000}, - {0x2E68 , 0x00000000}, - {0x2E6C , 0x00000000}, - {0x2E70 , 0x00000000}, - {0x2E74 , 0x00000000}, - {0x2E78 , 0x00000000}, - {0x2E7C , 0x00000000}, - {0x2E80 , 0x00000000}, - {0x2E84 , 0x00000000}, - {0x2E88 , 0x00000000}, - {0x2E8C , 0x00000000}, - {0x2E90 , 0x00000000}, - {0x2E94 , 0x00000000}, - {0x2E98 , 0x00000000}, - {0x2E9C , 0x00000000}, - {0x2EA0 , 0x00000000}, - {0x2EA4 , 0x00000000}, - {0x2EA8 , 0x00000000}, - {0x2EAC , 0x00000000}, - {0x2EB0 , 0x00000000}, - {0x2EB4 , 0x00000000}, - {0x2EB8 , 0x00000000}, - {0x2EBC , 0x00000000}, - {0x2EC0 , 0x00000000}, - {0x2EC4 , 0x00000000}, - {0x2EC8 , 0x00000000}, - {0x2ECC , 0x00000000}, - {0x2ED0 , 0x00000000}, - {0x2ED4 , 0x00000000}, - {0x2ED8 , 0x00000000}, - {0x2EDC , 0x00000000}, - {0x2EE0 , 0x00000000}, - {0x2EE4 ,0x00000000}, - {0x2EE8 ,0x00000000}, - {0x2EEC , 0x00000000}, - {0x2EF0 , 0x00000000}, - {0x2EF4 , 0x00000000}, - {0x2EF8 , 0x00000000}, - {0x2EFC , 0x00000000}, - /*{0x2F60 , 0x00000000},*/ -}; - -int initRegDataNum=sizeof(initRegData)/sizeof(RegData); - -typedef union { - unsigned int i; - float f; -} dmaBufRec, *dmaBuf; - -void Init3D( tridentContextPtr tmesa ) -{ - unsigned char *MMIO = tmesa->tridentScreen->mmio.map; - int i; - - for(i=0;itridentScreen->mmio.map; - dmaBufRec clr; - -printf("DRAW TRI\n"); - Init3D(tmesa); - -printf("ENGINE STATUS 0x%x\n",MMIO_IN32(MMIO, 0x2800)); - MMIO_OUT32(MMIO, 0x002800, 0x00000000 ); -#if 0 - MMIO_OUT32(MMIO, 0x002368 , MMIO_IN32(MMIO,0x002368)|1 ); -#endif - - MMIO_OUT32(MMIO, 0x002C00 , 0x00000014 ); -#if 0 - MMIO_OUT32(MMIO, 0x002C04 , 0x0A8004C0 ); -#else - MMIO_OUT32(MMIO, 0x002C04 , 0x0A8000C0 ); -#endif - -#if 0 - MMIO_OUT32(MMIO, 0x002C08 , 0x00000000 ); - MMIO_OUT32(MMIO, 0x002C0C , 0xFFCCCCCC ); - MMIO_OUT32(MMIO, 0x002C10 , 0x3F800000 ); - MMIO_OUT32(MMIO, 0x002C14 , 0x3D0D3DCB ); - MMIO_OUT32(MMIO, 0x002C2C , 0x70000000 ); - MMIO_OUT32(MMIO, 0x002C24 , 0x00202C00 ); - MMIO_OUT32(MMIO, 0x002C28 , 0xE0002500 ); - MMIO_OUT32(MMIO, 0x002C30 , 0x00000000 ); - MMIO_OUT32(MMIO, 0x002C34 , 0xE0000000 ); - MMIO_OUT32(MMIO, 0x002C38 , 0x00000000 ); -#endif - - MMIO_OUT32(MMIO, 0x002C50 , 0x00000000 ); - MMIO_OUT32(MMIO, 0x002C54 , 0x0C320C80 ); - MMIO_OUT32(MMIO, 0x002C50 , 0x00000000 ); - MMIO_OUT32(MMIO, 0x002C54 , 0x0C320C80 ); - MMIO_OUT32(MMIO, 0x002C80 , 0x20008258 ); - MMIO_OUT32(MMIO, 0x002C84 , 0x20000320 ); - MMIO_OUT32(MMIO, 0x002C94 , 0xFFFFFFFF ); - -#if 0 - MMIO_OUT32(MMIO, 0x002D00 , 0x00009009 ); - MMIO_OUT32(MMIO, 0x002D38 , 0x00000000 ); - MMIO_OUT32(MMIO, 0x002D94 , 0x20002000 ); - MMIO_OUT32(MMIO, 0x002D50 , 0xf0000000 ); - MMIO_OUT32(MMIO, 0x002D80 , 0x24002000 ); - MMIO_OUT32(MMIO, 0x002D98 , 0x81000000 ); - MMIO_OUT32(MMIO, 0x002DB0 , 0x81000000 ); - MMIO_OUT32(MMIO, 0x002DC8 , 0x808000FF ); - MMIO_OUT32(MMIO, 0x002DD4 , 0x02000200 ); - MMIO_OUT32(MMIO, 0x002DD8 , 0x02000200 ); - MMIO_OUT32(MMIO, 0x002D30 , 0x02092400 ); - MMIO_OUT32(MMIO, 0x002D04 , 0x00102120 ); - MMIO_OUT32(MMIO, 0x002D08 , 0xFFFFFFFF ); - MMIO_OUT32(MMIO, 0x002D0C , 0xF00010D0 ); - MMIO_OUT32(MMIO, 0x002D10 , 0xC0000400 ); -#endif - - MMIO_OUT32(MMIO, 0x002814, 0x00000000 ); -#if 0 - MMIO_OUT32(MMIO, 0x002818 , 0x00036C20 ); -#else - MMIO_OUT32(MMIO, 0x002818 , 0x00036020 ); -#endif - MMIO_OUT32(MMIO, 0x00281C , 0x00098081 ); - -printf("first TRI\n"); - clr.f = 5.0; - MMIO_OUT32(MMIO, 0x002820 , clr.i ); - clr.f = 595.0; - MMIO_OUT32(MMIO, 0x002824 , clr.i ); - clr.f = 1.0; - MMIO_OUT32(MMIO, 0x002828 , clr.i ); - MMIO_OUT32(MMIO, 0x00282C , 0x00FF00 ); -#if 0 - clr.f = 0.0; - MMIO_OUT32(MMIO, 0x002830 , clr.i ); - clr.f = 1.0; - MMIO_OUT32(MMIO, 0x002834 , clr.i ); -#endif - - clr.f = 5.0; - MMIO_OUT32(MMIO, 0x002820 , clr.i ); - clr.f = 5.0; - MMIO_OUT32(MMIO, 0x002824 , clr.i ); - clr.f = 1.0; - MMIO_OUT32(MMIO, 0x002828 , clr.i ); - MMIO_OUT32(MMIO, 0x00282C , 0xFF0000 ); -#if 0 - clr.f = 0.0; - MMIO_OUT32(MMIO, 0x002830 , clr.i ); - clr.f = 0.0; - MMIO_OUT32(MMIO, 0x002834 , clr.i ); -#endif - - clr.f = 395.0; -printf("0x%x\n",clr.i); - MMIO_OUT32(MMIO, 0x002820 , clr.i ); - clr.f = 5.0; - MMIO_OUT32(MMIO, 0x002824 , clr.i ); - clr.f = 1.0; - MMIO_OUT32(MMIO, 0x002828 , clr.i ); - MMIO_OUT32(MMIO, 0x00282C , 0xFF ); -#if 0 - clr.f = 1.0; - MMIO_OUT32(MMIO, 0x002830 , clr.i ); - clr.f = 0.0; - MMIO_OUT32(MMIO, 0x002834 , clr.i ); -#endif - -printf("sec TRI\n"); - MMIO_OUT32(MMIO, 0x00281C , 0x00093980 ); - clr.f = 395.0; - MMIO_OUT32(MMIO, 0x002820 , clr.i ); - clr.f = 595.0; - MMIO_OUT32(MMIO, 0x002824 , clr.i ); - clr.f = 1.0; - MMIO_OUT32(MMIO, 0x002828 , clr.i ); - MMIO_OUT32(MMIO, 0x00282C , 0x00FF00 ); -#if 0 - clr.f = 1.0; - MMIO_OUT32(MMIO, 0x002830 , clr.i ); - clr.f = 1.0; - MMIO_OUT32(MMIO, 0x002834 , clr.i ); -#endif - -#if 0 - MMIO_OUT32(MMIO, 0x002368 , MMIO_IN32(MMIO,0x002368)&0xfffffffe ); -#endif - -printf("fin TRI\n"); - - return 0; -} - -static INLINE void trident_draw_point(tridentContextPtr tmesa, - const tridentVertex *v0 ) -{ - unsigned char *MMIO = tmesa->tridentScreen->mmio.map; - (void) MMIO; -} - -static INLINE void trident_draw_line( tridentContextPtr tmesa, - const tridentVertex *v0, - const tridentVertex *v1 ) -{ - unsigned char *MMIO = tmesa->tridentScreen->mmio.map; - (void) MMIO; -} - -static INLINE void trident_draw_triangle( tridentContextPtr tmesa, - const tridentVertex *v0, - const tridentVertex *v1, - const tridentVertex *v2 ) -{ -} - -static INLINE void trident_draw_quad( tridentContextPtr tmesa, - const tridentVertex *v0, - const tridentVertex *v1, - const tridentVertex *v2, - const tridentVertex *v3 ) -{ - GLuint vertsize = tmesa->vertex_size; - GLint coloridx = (vertsize > 4) ? 4 : 3; - unsigned char *MMIO = tmesa->tridentScreen->mmio.map; - int clr; - float *ftmp = (float *)(&clr); - - if (tmesa->dirty) - tridentUploadHwStateLocked( tmesa ); -#if 0 - DrawTriangle(tmesa); - exit(0); -#else -#if 1 - if (first) { - Init3D(tmesa); -#if 0 - DrawTriangle(tmesa); -#endif - first = 0; - } -#endif - - LOCK_HARDWARE( tmesa ); - - MMIO_OUT32(MMIO, 0x002C00 , 0x00000010 ); - MMIO_OUT32(MMIO, 0x002C04 , 0x029C00C0 ); - - /* Z buffer */ - MMIO_OUT32(MMIO, 0x002C24 , 0x00100000 /*| (tmesa->tridentScreen->depthOffset)*/ ); - MMIO_OUT32(MMIO, 0x002C28 , 0xE0000000 | (tmesa->tridentScreen->depthPitch * 4) ); - - /* front buffer */ - MMIO_OUT32(MMIO, 0x002C50 , 0x00000000 | (tmesa->drawOffset) ); - MMIO_OUT32(MMIO, 0x002C54 , 0x0C320000 | (tmesa->drawPitch * 4) ); - - /* clipper */ - MMIO_OUT32(MMIO, 0x002C80 , 0x20008000 | tmesa->tridentScreen->height ); - MMIO_OUT32(MMIO, 0x002C84 , 0x20000000 | tmesa->tridentScreen->width ); - - /* writemask */ - MMIO_OUT32(MMIO, 0x002C94 , 0xFFFFFFFF ); - -if (vertsize == 4) { - MMIO_OUT32(MMIO, 0x002818 , 0x0003A020 ); - MMIO_OUT32(MMIO, 0x00281C , 0x00098021 ); - - *ftmp = v0->v.x; - MMIO_OUT32(MMIO, 0x002820 , clr ); - *ftmp = v0->v.y; - MMIO_OUT32(MMIO, 0x002824 , clr ); - *ftmp = v0->v.z; - MMIO_OUT32(MMIO, 0x002828 , clr ); -#if 0 - *ftmp = v0->v.w; - MMIO_OUT32(MMIO, 0x00282C , clr ); -#endif - MMIO_OUT32(MMIO, 0x00282C , v0->ui[coloridx] ); - - *ftmp = v1->v.x; - MMIO_OUT32(MMIO, 0x002820 , clr ); - *ftmp = v1->v.y; - MMIO_OUT32(MMIO, 0x002824 , clr ); - *ftmp = v1->v.z; - MMIO_OUT32(MMIO, 0x002828 , clr ); -#if 0 - *ftmp = v1->v.w; - MMIO_OUT32(MMIO, 0x00282C , clr ); -#endif - MMIO_OUT32(MMIO, 0x00282C , v1->ui[coloridx] ); - - *ftmp = v2->v.x; - MMIO_OUT32(MMIO, 0x002820 , clr ); - *ftmp = v2->v.y; - MMIO_OUT32(MMIO, 0x002824 , clr ); - *ftmp = v2->v.z; - MMIO_OUT32(MMIO, 0x002828 , clr ); -#if 0 - *ftmp = v2->v.w; - MMIO_OUT32(MMIO, 0x00282C , clr ); -#endif - MMIO_OUT32(MMIO, 0x00282C , v2->ui[coloridx] ); - - MMIO_OUT32(MMIO, 0x00281C , 0x00093020 ); - *ftmp = v3->v.x; - MMIO_OUT32(MMIO, 0x002820 , clr ); - *ftmp = v3->v.y; - MMIO_OUT32(MMIO, 0x002824 , clr ); - *ftmp = v3->v.z; - MMIO_OUT32(MMIO, 0x002828 , clr ); -#if 0 - *ftmp = v3->v.w; - MMIO_OUT32(MMIO, 0x00282C , clr ); -#endif - MMIO_OUT32(MMIO, 0x00282C , v3->ui[coloridx] ); - -} -#endif - - UNLOCK_HARDWARE( tmesa ); -} -/*********************************************************************** - * Rasterization fallback helpers * - ***********************************************************************/ - - -/* This code is hit only when a mix of accelerated and unaccelerated - * primitives are being drawn, and only for the unaccelerated - * primitives. - */ -#if 0 -static void -trident_fallback_quad( tridentContextPtr tmesa, - const tridentVertex *v0, - const tridentVertex *v1, - const tridentVertex *v2, - const tridentVertex *v3 ) -{ - GLcontext *ctx = tmesa->glCtx; - SWvertex v[4]; - trident_translate_vertex( ctx, v0, &v[0] ); - trident_translate_vertex( ctx, v1, &v[1] ); - trident_translate_vertex( ctx, v2, &v[2] ); - trident_translate_vertex( ctx, v3, &v[3] ); - _swrast_Quad( ctx, &v[0], &v[1], &v[2], &v[3] ); -} -#endif - -/* XXX hack to get the prototype defined in time... */ -void trident_translate_vertex(GLcontext *ctx, const tridentVertex *src, - SWvertex *dst); - -static void -trident_fallback_tri( tridentContextPtr tmesa, - const tridentVertex *v0, - const tridentVertex *v1, - const tridentVertex *v2 ) -{ - GLcontext *ctx = tmesa->glCtx; - SWvertex v[3]; - trident_translate_vertex( ctx, v0, &v[0] ); - trident_translate_vertex( ctx, v1, &v[1] ); - trident_translate_vertex( ctx, v2, &v[2] ); - _swrast_Triangle( ctx, &v[0], &v[1], &v[2] ); -} - -static void -trident_fallback_line( tridentContextPtr tmesa, - const tridentVertex *v0, - const tridentVertex *v1 ) -{ - GLcontext *ctx = tmesa->glCtx; - SWvertex v[2]; - trident_translate_vertex( ctx, v0, &v[0] ); - trident_translate_vertex( ctx, v1, &v[1] ); - _swrast_Line( ctx, &v[0], &v[1] ); -} - - -static void -trident_fallback_point( tridentContextPtr tmesa, - const tridentVertex *v0 ) -{ - GLcontext *ctx = tmesa->glCtx; - SWvertex v[1]; - trident_translate_vertex( ctx, v0, &v[0] ); - _swrast_Point( ctx, &v[0] ); -} - -/*********************************************************************** - * Macros for t_dd_tritmp.h to draw basic primitives * - ***********************************************************************/ - -#define TRI( a, b, c ) \ -do { \ - if (DO_FALLBACK) \ - tmesa->draw_tri( tmesa, a, b, c ); \ - else \ - trident_draw_triangle( tmesa, a, b, c ); \ -} while (0) - -#define QUAD( a, b, c, d ) \ -do { \ - if (DO_FALLBACK) { \ - tmesa->draw_tri( tmesa, a, b, d ); \ - tmesa->draw_tri( tmesa, b, c, d ); \ - } else \ - trident_draw_quad( tmesa, a, b, c, d ); \ -} while (0) - -#define LINE( v0, v1 ) \ -do { \ - if (DO_FALLBACK) \ - tmesa->draw_line( tmesa, v0, v1 ); \ - else \ - trident_draw_line( tmesa, v0, v1 ); \ -} while (0) - -#define POINT( v0 ) \ -do { \ - if (DO_FALLBACK) \ - tmesa->draw_point( tmesa, v0 ); \ - else \ - trident_draw_point( tmesa, v0 ); \ -} while (0) - -/*********************************************************************** - * Build render functions from dd templates * - ***********************************************************************/ - -#define TRIDENT_OFFSET_BIT 0x01 -#define TRIDENT_TWOSIDE_BIT 0x02 -#define TRIDENT_UNFILLED_BIT 0x04 -#define TRIDENT_FALLBACK_BIT 0x08 -#define TRIDENT_MAX_TRIFUNC 0x10 - - -static struct { - tnl_points_func points; - tnl_line_func line; - tnl_triangle_func triangle; - tnl_quad_func quad; -} rast_tab[TRIDENT_MAX_TRIFUNC]; - - -#define DO_FALLBACK (IND & TRIDENT_FALLBACK_BIT) -#define DO_OFFSET (IND & TRIDENT_OFFSET_BIT) -#define DO_UNFILLED (IND & TRIDENT_UNFILLED_BIT) -#define DO_TWOSIDE (IND & TRIDENT_TWOSIDE_BIT) -#define DO_FLAT 0 -#define DO_TRI 1 -#define DO_QUAD 1 -#define DO_LINE 1 -#define DO_POINTS 1 -#define DO_FULL_QUAD 1 - -#define HAVE_RGBA 1 -#define HAVE_SPEC 1 -#define HAVE_BACK_COLORS 0 -#define HAVE_HW_FLATSHADE 1 -#define VERTEX tridentVertex -#define TAB rast_tab - -#define DEPTH_SCALE 1.0 -#define UNFILLED_TRI unfilled_tri -#define UNFILLED_QUAD unfilled_quad -#define VERT_X(_v) _v->v.x -#define VERT_Y(_v) _v->v.y -#define VERT_Z(_v) _v->v.z -#define AREA_IS_CCW( a ) (a > 0) -#define GET_VERTEX(e) (tmesa->verts + (e<vertex_stride_shift)) - -#define TRIDENT_COLOR( dst, src ) \ -do { \ - dst[0] = src[2]; \ - dst[1] = src[1]; \ - dst[2] = src[0]; \ - dst[3] = src[3]; \ -} while (0) - -#define TRIDENT_SPEC( dst, src ) \ -do { \ - dst[0] = src[2]; \ - dst[1] = src[1]; \ - dst[2] = src[0]; \ -} while (0) - -#define VERT_SET_RGBA( v, c ) TRIDENT_COLOR( v->ub4[coloroffset], c ) -#define VERT_COPY_RGBA( v0, v1 ) v0->ui[coloroffset] = v1->ui[coloroffset] -#define VERT_SAVE_RGBA( idx ) color[idx] = v[idx]->ui[coloroffset] -#define VERT_RESTORE_RGBA( idx ) v[idx]->ui[coloroffset] = color[idx] - -#define VERT_SET_SPEC( v, c ) if (havespec) TRIDENT_SPEC( v->ub4[5], c ) -#define VERT_COPY_SPEC( v0, v1 ) if (havespec) COPY_3V(v0->ub4[5], v1->ub4[5]) -#define VERT_SAVE_SPEC( idx ) if (havespec) spec[idx] = v[idx]->ui[5] -#define VERT_RESTORE_SPEC( idx ) if (havespec) v[idx]->ui[5] = spec[idx] - -#define LOCAL_VARS(n) \ - tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); \ - GLuint color[n], spec[n]; \ - GLuint coloroffset = (tmesa->vertex_size == 4 ? 3 : 4); \ - GLboolean havespec = (tmesa->vertex_size == 4 ? 0 : 1); \ - (void) color; (void) spec; (void) coloroffset; (void) havespec; -/*********************************************************************** - * Helpers for rendering unfilled primitives * - ***********************************************************************/ -#if 0 -static const GLuint hw_prim[GL_POLYGON+1] = { - B_PrimType_Points, - B_PrimType_Lines, - B_PrimType_Lines, - B_PrimType_Lines, - B_PrimType_Triangles, - B_PrimType_Triangles, - B_PrimType_Triangles, - B_PrimType_Triangles, - B_PrimType_Triangles, - B_PrimType_Triangles -}; -#endif - -static void tridentResetLineStipple( GLcontext *ctx ); -#if 0 -static void tridentRasterPrimitive( GLcontext *ctx, GLuint hwprim ); -#endif -static void tridentRenderPrimitive( GLcontext *ctx, GLenum prim ); - -#define RASTERIZE(x) /*if (tmesa->hw_primitive != hw_prim[x]) \ - tridentRasterPrimitive( ctx, hw_prim[x] ) */ -#define RENDER_PRIMITIVE tmesa->render_primitive -#define TAG(x) x -#define IND TRIDENT_FALLBACK_BIT -#include "tnl_dd/t_dd_unfilled.h" -#undef IND - -/*********************************************************************** - * Generate GL render functions * - ***********************************************************************/ - -#define IND (0) -#define TAG(x) x -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (TRIDENT_OFFSET_BIT) -#define TAG(x) x##_offset -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (TRIDENT_TWOSIDE_BIT) -#define TAG(x) x##_twoside -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (TRIDENT_TWOSIDE_BIT|TRIDENT_OFFSET_BIT) -#define TAG(x) x##_twoside_offset -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (TRIDENT_UNFILLED_BIT) -#define TAG(x) x##_unfilled -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (TRIDENT_OFFSET_BIT|TRIDENT_UNFILLED_BIT) -#define TAG(x) x##_offset_unfilled -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (TRIDENT_TWOSIDE_BIT|TRIDENT_UNFILLED_BIT) -#define TAG(x) x##_twoside_unfilled -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (TRIDENT_TWOSIDE_BIT|TRIDENT_OFFSET_BIT|TRIDENT_UNFILLED_BIT) -#define TAG(x) x##_twoside_offset_unfilled -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (TRIDENT_FALLBACK_BIT) -#define TAG(x) x##_fallback -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (TRIDENT_OFFSET_BIT|TRIDENT_FALLBACK_BIT) -#define TAG(x) x##_offset_fallback -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (TRIDENT_TWOSIDE_BIT|TRIDENT_FALLBACK_BIT) -#define TAG(x) x##_twoside_fallback -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (TRIDENT_TWOSIDE_BIT|TRIDENT_OFFSET_BIT|TRIDENT_FALLBACK_BIT) -#define TAG(x) x##_twoside_offset_fallback -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (TRIDENT_UNFILLED_BIT|TRIDENT_FALLBACK_BIT) -#define TAG(x) x##_unfilled_fallback -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (TRIDENT_OFFSET_BIT|TRIDENT_UNFILLED_BIT|TRIDENT_FALLBACK_BIT) -#define TAG(x) x##_offset_unfilled_fallback -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (TRIDENT_TWOSIDE_BIT|TRIDENT_UNFILLED_BIT|TRIDENT_FALLBACK_BIT) -#define TAG(x) x##_twoside_unfilled_fallback -#include "tnl_dd/t_dd_tritmp.h" - -#define IND (TRIDENT_TWOSIDE_BIT|TRIDENT_OFFSET_BIT|TRIDENT_UNFILLED_BIT|TRIDENT_FALLBACK_BIT) -#define TAG(x) x##_twoside_offset_unfilled_fallback -#include "tnl_dd/t_dd_tritmp.h" - -static void init_rast_tab( void ) -{ - init(); - init_offset(); - init_twoside(); - init_twoside_offset(); - init_unfilled(); - init_offset_unfilled(); - init_twoside_unfilled(); - init_twoside_offset_unfilled(); - init_fallback(); - init_offset_fallback(); - init_twoside_fallback(); - init_twoside_offset_fallback(); - init_unfilled_fallback(); - init_offset_unfilled_fallback(); - init_twoside_unfilled_fallback(); - init_twoside_offset_unfilled_fallback(); -} - - -/**********************************************************************/ -/* Render unclipped begin/end objects */ -/**********************************************************************/ - -#define VERT(x) (tridentVertex *)(tridentverts + (x << shift)) -#define RENDER_POINTS( start, count ) \ - for ( ; start < count ; start++) \ - trident_draw_point( tmesa, VERT(start) ) -#define RENDER_LINE( v0, v1 ) \ - trident_draw_line( tmesa, VERT(v0), VERT(v1) ) -#define RENDER_TRI( v0, v1, v2 ) \ - trident_draw_triangle( tmesa, VERT(v0), VERT(v1), VERT(v2) ) -#define RENDER_QUAD( v0, v1, v2, v3 ) \ - trident_draw_quad( tmesa, VERT(v0), VERT(v1), VERT(v2), VERT(v3) ) -#define INIT(x) tridentRenderPrimitive( ctx, x ); -#undef LOCAL_VARS -#define LOCAL_VARS \ - tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); \ - const GLuint shift = tmesa->vertex_stride_shift; \ - const char *tridentverts = (char *)tmesa->verts; \ - const GLboolean stipple = ctx->Line.StippleFlag; \ - const GLuint * const elt = TNL_CONTEXT(ctx)->vb.Elts; \ - (void) elt; -#define RESET_STIPPLE if ( stipple ) tridentResetLineStipple( ctx ); -#define RESET_OCCLUSION -#define PRESERVE_VB_DEFS -#define ELT(x) (x) -#define TAG(x) trident_##x##_verts -#include "tnl/t_vb_rendertmp.h" -#undef ELT -#undef TAG -#define TAG(x) trident_##x##_elts -#define ELT(x) elt[x] -#include "tnl/t_vb_rendertmp.h" - -/**********************************************************************/ -/* Render clipped primitives */ -/**********************************************************************/ - -static void tridentRenderClippedPoly( GLcontext *ctx, const GLuint *elts, - GLuint n ) -{ - tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); - struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLuint prim = tmesa->render_primitive; - - /* Render the new vertices as an unclipped polygon. - */ - { - GLuint *tmp = VB->Elts; - VB->Elts = (GLuint *)elts; - tnl->Driver.Render.PrimTabElts[GL_POLYGON]( ctx, 0, n, PRIM_BEGIN|PRIM_END ); - VB->Elts = tmp; - } - - /* Restore the render primitive - */ - if (prim != GL_POLYGON) - tnl->Driver.Render.PrimitiveNotify( ctx, prim ); -} - -static void tridentRenderClippedLine( GLcontext *ctx, GLuint ii, GLuint jj ) -{ - TNLcontext *tnl = TNL_CONTEXT(ctx); - tnl->Driver.Render.Line( ctx, ii, jj ); -} - - -/**********************************************************************/ -/* Choose render functions */ -/**********************************************************************/ - -#define _TRIDENT_NEW_RENDER_STATE (_DD_NEW_LINE_STIPPLE | \ - _DD_NEW_LINE_SMOOTH | \ - _DD_NEW_POINT_SMOOTH | \ - _DD_NEW_TRI_SMOOTH | \ - _DD_NEW_TRI_UNFILLED | \ - _DD_NEW_TRI_LIGHT_TWOSIDE | \ - _DD_NEW_TRI_OFFSET) \ - - -#define POINT_FALLBACK (DD_POINT_SMOOTH) -#define LINE_FALLBACK (DD_LINE_STIPPLE|DD_LINE_SMOOTH) -#define TRI_FALLBACK (DD_TRI_SMOOTH) -#define ANY_FALLBACK_FLAGS (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK) -#define ANY_RASTER_FLAGS (DD_TRI_LIGHT_TWOSIDE|DD_TRI_OFFSET|DD_TRI_UNFILLED) - - -static void tridentChooseRenderState(GLcontext *ctx) -{ - tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLuint flags = ctx->_TriangleCaps; - GLuint index = 0; - - if (flags & (ANY_RASTER_FLAGS|ANY_FALLBACK_FLAGS)) { - tmesa->draw_point = trident_draw_point; - tmesa->draw_line = trident_draw_line; - tmesa->draw_tri = trident_draw_triangle; - - if (flags & ANY_RASTER_FLAGS) { - if (flags & DD_TRI_LIGHT_TWOSIDE) index |= TRIDENT_TWOSIDE_BIT; - if (flags & DD_TRI_OFFSET) index |= TRIDENT_OFFSET_BIT; - if (flags & DD_TRI_UNFILLED) index |= TRIDENT_UNFILLED_BIT; - } - - /* Hook in fallbacks for specific primitives. - */ - if (flags & (POINT_FALLBACK|LINE_FALLBACK|TRI_FALLBACK)) { - if (flags & POINT_FALLBACK) tmesa->draw_point = trident_fallback_point; - if (flags & LINE_FALLBACK) tmesa->draw_line = trident_fallback_line; - if (flags & TRI_FALLBACK) tmesa->draw_tri = trident_fallback_tri; - index |= TRIDENT_FALLBACK_BIT; - } - } - - if (tmesa->RenderIndex != index) { - tmesa->RenderIndex = index; - - tnl->Driver.Render.Points = rast_tab[index].points; - tnl->Driver.Render.Line = rast_tab[index].line; - tnl->Driver.Render.Triangle = rast_tab[index].triangle; - tnl->Driver.Render.Quad = rast_tab[index].quad; - - if (tmesa->RenderIndex == 0) { - tnl->Driver.Render.PrimTabVerts = trident_render_tab_verts; - tnl->Driver.Render.PrimTabElts = trident_render_tab_elts; - } else { - tnl->Driver.Render.PrimTabVerts = _tnl_render_tab_verts; - tnl->Driver.Render.PrimTabElts = _tnl_render_tab_elts; - } - tnl->Driver.Render.ClippedLine = tridentRenderClippedLine; - tnl->Driver.Render.ClippedPolygon = tridentRenderClippedPoly; - } -} - - -/**********************************************************************/ -/* High level hooks for t_vb_render.c */ -/**********************************************************************/ - - - -/* Determine the rasterized primitive when not drawing unfilled - * polygons. - * - * Used only for the default render stage which always decomposes - * primitives to trianges/lines/points. For the accelerated stage, - * which renders strips as strips, the equivalent calculations are - * performed in tridentrender.c. - */ -#if 0 -static void tridentRasterPrimitive( GLcontext *ctx, GLuint hwprim ) -{ - tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); - if (tmesa->hw_primitive != hwprim) - tmesa->hw_primitive = hwprim; -} -#endif - -static void tridentRenderPrimitive( GLcontext *ctx, GLenum prim ) -{ - tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); - tmesa->render_primitive = prim; -} - -static void tridentRunPipeline( GLcontext *ctx ) -{ - tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); - - if ( tmesa->new_state ) - tridentDDUpdateHWState( ctx ); - - if (tmesa->new_gl_state) { -#if 0 - if (tmesa->new_gl_state & _NEW_TEXTURE) - tridentUpdateTextureState( ctx ); -#endif - - if (!tmesa->Fallback) { - if (tmesa->new_gl_state & _TRIDENT_NEW_VERTEX) - tridentChooseVertexState( ctx ); - - if (tmesa->new_gl_state & _TRIDENT_NEW_RENDER_STATE) - tridentChooseRenderState( ctx ); - } - - tmesa->new_gl_state = 0; - } - - _tnl_run_pipeline( ctx ); -} - -static void tridentRenderStart( GLcontext *ctx ) -{ - /* Check for projective texturing. Make sure all texcoord - * pointers point to something. (fix in mesa?) - */ - tridentCheckTexSizes( ctx ); -} - -static void tridentRenderFinish( GLcontext *ctx ) -{ - if (0) - _swrast_flush( ctx ); /* never needed */ -} - -static void tridentResetLineStipple( GLcontext *ctx ) -{ - tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); - (void) tmesa; - - /* Reset the hardware stipple counter. - */ -} - - -/**********************************************************************/ -/* Transition to/from hardware rasterization. */ -/**********************************************************************/ - - -void tridentFallback( tridentContextPtr tmesa, GLuint bit, GLboolean mode ) -{ - GLcontext *ctx = tmesa->glCtx; - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLuint oldfallback = tmesa->Fallback; - - _tnl_need_projected_coords( ctx, GL_FALSE ); - - if (mode) { - tmesa->Fallback |= bit; - if (oldfallback == 0) { - _swsetup_Wakeup( ctx ); - tmesa->RenderIndex = ~0; - } - } - else { - tmesa->Fallback &= ~bit; - if (oldfallback == bit) { - _swrast_flush( ctx ); - tnl->Driver.Render.Start = tridentRenderStart; - tnl->Driver.Render.PrimitiveNotify = tridentRenderPrimitive; - tnl->Driver.Render.Finish = tridentRenderFinish; - tnl->Driver.Render.BuildVertices = tridentBuildVertices; - tnl->Driver.Render.ResetLineStipple = tridentResetLineStipple; - tmesa->new_gl_state |= (_TRIDENT_NEW_RENDER_STATE| - _TRIDENT_NEW_VERTEX); - } - } -} - - -/**********************************************************************/ -/* Initialization. */ -/**********************************************************************/ - - -void tridentDDInitTriFuncs( GLcontext *ctx ) -{ - tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); - TNLcontext *tnl = TNL_CONTEXT(ctx); - static int firsttime = 1; - - if (firsttime) { - init_rast_tab(); - firsttime = 0; - } - - tmesa->RenderIndex = ~0; - - tnl->Driver.RunPipeline = tridentRunPipeline; - tnl->Driver.Render.Start = tridentRenderStart; - tnl->Driver.Render.Finish = tridentRenderFinish; - tnl->Driver.Render.PrimitiveNotify = tridentRenderPrimitive; - tnl->Driver.Render.ResetLineStipple = tridentResetLineStipple; - tnl->Driver.Render.BuildVertices = tridentBuildVertices; -} diff --git a/src/mesa/drivers/dri/trident/trident_vb.c b/src/mesa/drivers/dri/trident/trident_vb.c deleted file mode 100644 index 055a914595..0000000000 --- a/src/mesa/drivers/dri/trident/trident_vb.c +++ /dev/null @@ -1,434 +0,0 @@ -/* - * Copyright 2002 by Alan Hourihane, Sychdyn, North Wales, UK. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Authors: Alan Hourihane, - * - * Trident CyberBladeXP driver. - * - */ -#include "main/glheader.h" -#include "main/mtypes.h" -#include "main/macros.h" -#include "main/colormac.h" - -#include "swrast_setup/swrast_setup.h" -#include "swrast/swrast.h" -#include "tnl/t_context.h" -#include "tnl/tnl.h" - -#include "trident_context.h" - -#define TRIDENT_TEX1_BIT 0x1 -#define TRIDENT_TEX0_BIT 0x2 -#define TRIDENT_RGBA_BIT 0x4 -#define TRIDENT_SPEC_BIT 0x8 -#define TRIDENT_FOG_BIT 0x10 -#define TRIDENT_XYZW_BIT 0x20 -#define TRIDENT_PTEX_BIT 0x40 -#define TRIDENT_MAX_SETUP 0x80 - -static struct { - void (*emit)( GLcontext *, GLuint, GLuint, void *, GLuint ); - tnl_interp_func interp; - tnl_copy_pv_func copy_pv; - GLboolean (*check_tex_sizes)( GLcontext *ctx ); - GLuint vertex_size; - GLuint vertex_stride_shift; - GLuint vertex_format; -} setup_tab[TRIDENT_MAX_SETUP]; - -#define TINY_VERTEX_FORMAT 1 -#define NOTEX_VERTEX_FORMAT 2 -#define TEX0_VERTEX_FORMAT 3 -#define TEX1_VERTEX_FORMAT 4 -#define PROJ_TEX1_VERTEX_FORMAT 5 -#define TEX2_VERTEX_FORMAT 6 -#define TEX3_VERTEX_FORMAT 7 -#define PROJ_TEX3_VERTEX_FORMAT 8 - -#define DO_XYZW (IND & TRIDENT_XYZW_BIT) -#define DO_RGBA (IND & TRIDENT_RGBA_BIT) -#define DO_SPEC (IND & TRIDENT_SPEC_BIT) -#define DO_FOG (IND & TRIDENT_FOG_BIT) -#define DO_TEX0 (IND & TRIDENT_TEX0_BIT) -#define DO_TEX1 (IND & TRIDENT_TEX1_BIT) -#define DO_TEX2 0 -#define DO_TEX3 0 -#define DO_PTEX (IND & TRIDENT_PTEX_BIT) - -#define VERTEX tridentVertex -#define VERTEX_COLOR trident_color_t -#define LOCALVARS tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); -#define GET_VIEWPORT_MAT() tmesa->hw_viewport -#define GET_TEXSOURCE(n) tmesa->tmu_source[n] -#define GET_VERTEX_FORMAT() tmesa->vertex_format -#define GET_VERTEX_SIZE() tmesa->vertex_size -#define GET_VERTEX_STORE() tmesa->verts -#define GET_VERTEX_STRIDE_SHIFT() tmesa->vertex_stride_shift -#define GET_UBYTE_COLOR_STORE() &tmesa->UbyteColor -#define GET_UBYTE_SPEC_COLOR_STORE() &tmesa->UbyteSecondaryColor - -#define HAVE_HW_VIEWPORT 0 -#define HAVE_HW_DIVIDE 0 -#define HAVE_RGBA_COLOR 0 -#define HAVE_TINY_VERTICES 1 -#define HAVE_NOTEX_VERTICES 1 -#define HAVE_TEX0_VERTICES 1 -#define HAVE_TEX1_VERTICES 1 -#define HAVE_TEX2_VERTICES 0 -#define HAVE_TEX3_VERTICES 0 -#define HAVE_PTEX_VERTICES 0 - -#define UNVIEWPORT_VARS \ - const GLfloat dx = - tmesa->drawX - SUBPIXEL_X; \ - const GLfloat dy = (tmesa->driDrawable->h + \ - tmesa->drawY + SUBPIXEL_Y); \ - const GLfloat sz = 1.0 / tmesa->depth_scale - -#define UNVIEWPORT_X(x) x + dx; -#define UNVIEWPORT_Y(y) - y + dy; -#define UNVIEWPORT_Z(z) z * sz; - -#define PTEX_FALLBACK() tridentFallback(TRIDENT_CONTEXT(ctx), TRIDENT_FALLBACK_TEXTURE, 1) - -#define IMPORT_FLOAT_COLORS trident_import_float_colors -#define IMPORT_FLOAT_SPEC_COLORS trident_import_float_spec_colors - -#define INTERP_VERTEX setup_tab[tmesa->SetupIndex].interp -#define COPY_PV_VERTEX setup_tab[tmesa->SetupIndex].copy_pv - -/*********************************************************************** - * Generate pv-copying and translation functions * - ***********************************************************************/ - -#define TAG(x) trident_##x -#include "tnl_dd/t_dd_vb.c" - -/*********************************************************************** - * Generate vertex emit and interp functions * - ***********************************************************************/ - -#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT) -#define TAG(x) x##_wg -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_SPEC_BIT) -#define TAG(x) x##_wgs -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_TEX0_BIT) -#define TAG(x) x##_wgt0 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT) -#define TAG(x) x##_wgt0t1 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_TEX0_BIT|TRIDENT_PTEX_BIT) -#define TAG(x) x##_wgpt0 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT) -#define TAG(x) x##_wgst0 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT) -#define TAG(x) x##_wgst0t1 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT|TRIDENT_PTEX_BIT) -#define TAG(x) x##_wgspt0 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT) -#define TAG(x) x##_wgf -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_SPEC_BIT) -#define TAG(x) x##_wgfs -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_TEX0_BIT) -#define TAG(x) x##_wgft0 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT) -#define TAG(x) x##_wgft0t1 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_TEX0_BIT|TRIDENT_PTEX_BIT) -#define TAG(x) x##_wgfpt0 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT) -#define TAG(x) x##_wgfst0 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT) -#define TAG(x) x##_wgfst0t1 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT|TRIDENT_PTEX_BIT) -#define TAG(x) x##_wgfspt0 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_TEX0_BIT) -#define TAG(x) x##_t0 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT) -#define TAG(x) x##_t0t1 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_FOG_BIT) -#define TAG(x) x##_f -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_FOG_BIT|TRIDENT_TEX0_BIT) -#define TAG(x) x##_ft0 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_FOG_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT) -#define TAG(x) x##_ft0t1 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_RGBA_BIT) -#define TAG(x) x##_g -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_RGBA_BIT|TRIDENT_SPEC_BIT) -#define TAG(x) x##_gs -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_RGBA_BIT|TRIDENT_TEX0_BIT) -#define TAG(x) x##_gt0 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_RGBA_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT) -#define TAG(x) x##_gt0t1 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_RGBA_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT) -#define TAG(x) x##_gst0 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_RGBA_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT) -#define TAG(x) x##_gst0t1 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT) -#define TAG(x) x##_gf -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_SPEC_BIT) -#define TAG(x) x##_gfs -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_TEX0_BIT) -#define TAG(x) x##_gft0 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT) -#define TAG(x) x##_gft0t1 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT) -#define TAG(x) x##_gfst0 -#include "tnl_dd/t_dd_vbtmp.h" - -#define IND (TRIDENT_RGBA_BIT|TRIDENT_FOG_BIT|TRIDENT_SPEC_BIT|TRIDENT_TEX0_BIT|TRIDENT_TEX1_BIT) -#define TAG(x) x##_gfst0t1 -#include "tnl_dd/t_dd_vbtmp.h" - -static void init_setup_tab( void ) -{ - init_wg(); - init_wgs(); - init_wgt0(); - init_wgt0t1(); - init_wgpt0(); - init_wgst0(); - init_wgst0t1(); - init_wgspt0(); - init_wgf(); - init_wgfs(); - init_wgft0(); - init_wgft0t1(); - init_wgfpt0(); - init_wgfst0(); - init_wgfst0t1(); - init_wgfspt0(); - init_t0(); - init_t0t1(); - init_f(); - init_ft0(); - init_ft0t1(); - init_g(); - init_gs(); - init_gt0(); - init_gt0t1(); - init_gst0(); - init_gst0t1(); - init_gf(); - init_gfs(); - init_gft0(); - init_gft0t1(); - init_gfst0(); - init_gfst0t1(); -} - -void tridentBuildVertices( GLcontext *ctx, - GLuint start, - GLuint count, - GLuint newinputs ) -{ - tridentContextPtr tmesa = TRIDENT_CONTEXT( ctx ); - GLubyte *v = ((GLubyte *)tmesa->verts + (start<vertex_stride_shift)); - GLuint stride = 1<vertex_stride_shift; - - newinputs |= tmesa->SetupNewInputs; - tmesa->SetupNewInputs = 0; - - if (!newinputs) - return; - - if (newinputs & VERT_BIT_POS) { - setup_tab[tmesa->SetupIndex].emit( ctx, start, count, v, stride ); - } else { - GLuint ind = 0; - - if (newinputs & VERT_BIT_COLOR0) - ind |= TRIDENT_RGBA_BIT; - - if (newinputs & VERT_BIT_COLOR1) - ind |= TRIDENT_SPEC_BIT; - - if (newinputs & VERT_BIT_TEX0) - ind |= TRIDENT_TEX0_BIT; - - if (newinputs & VERT_BIT_TEX1) - ind |= TRIDENT_TEX1_BIT; - - if (newinputs & VERT_BIT_FOG) - ind |= TRIDENT_FOG_BIT; - - if (tmesa->SetupIndex & TRIDENT_PTEX_BIT) - ind = ~0; - - ind &= tmesa->SetupIndex; - - if (ind) { - setup_tab[ind].emit( ctx, start, count, v, stride ); - } - } -} - -void tridentCheckTexSizes( GLcontext *ctx ) -{ - tridentContextPtr tmesa = TRIDENT_CONTEXT( ctx ); - - if (!setup_tab[tmesa->SetupIndex].check_tex_sizes(ctx)) { - TNLcontext *tnl = TNL_CONTEXT(ctx); - - /* Invalidate stored verts - */ - tmesa->SetupNewInputs = ~0; - tmesa->SetupIndex |= TRIDENT_PTEX_BIT; - - if (!tmesa->Fallback && - !(ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED))) { - tnl->Driver.Render.Interp = setup_tab[tmesa->SetupIndex].interp; - tnl->Driver.Render.CopyPV = setup_tab[tmesa->SetupIndex].copy_pv; - } - } -} - -void tridentChooseVertexState( GLcontext *ctx ) -{ - tridentContextPtr tmesa = TRIDENT_CONTEXT( ctx ); - TNLcontext *tnl = TNL_CONTEXT(ctx); - GLuint ind = TRIDENT_XYZW_BIT|TRIDENT_RGBA_BIT; - - if (ctx->_TriangleCaps & DD_SEPARATE_SPECULAR) - ind |= TRIDENT_SPEC_BIT; - - if (ctx->Fog.Enabled) - ind |= TRIDENT_FOG_BIT; - - if (ctx->Texture.Unit[0]._ReallyEnabled) { - ind |= TRIDENT_TEX0_BIT; - if (ctx->Texture.Unit[1]._ReallyEnabled) { - ind |= TRIDENT_TEX1_BIT; - } - } - - tmesa->SetupIndex = ind; - - if (ctx->_TriangleCaps & (DD_TRI_LIGHT_TWOSIDE|DD_TRI_UNFILLED)) { - tnl->Driver.Render.Interp = trident_interp_extras; - tnl->Driver.Render.CopyPV = trident_copy_pv_extras; - } else { - tnl->Driver.Render.Interp = setup_tab[ind].interp; - tnl->Driver.Render.CopyPV = setup_tab[ind].copy_pv; - } - - if (setup_tab[ind].vertex_format != tmesa->vertex_format) { - tmesa->vertex_format = setup_tab[ind].vertex_format; - tmesa->vertex_size = setup_tab[ind].vertex_size; - tmesa->vertex_stride_shift = setup_tab[ind].vertex_stride_shift; - } -} - -void tridentInitVB( GLcontext *ctx ) -{ - tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); - GLuint size = TNL_CONTEXT(ctx)->vb.Size; - - tmesa->verts = (GLubyte *)ALIGN_MALLOC( size * 16 * 4, 32 ); - - { - static int firsttime = 1; - if (firsttime) { - init_setup_tab(); - firsttime = 0; - } - } -} - -void tridentFreeVB( GLcontext *ctx ) -{ - tridentContextPtr tmesa = TRIDENT_CONTEXT(ctx); - - if (tmesa->verts) { - ALIGN_FREE(tmesa->verts); - tmesa->verts = 0; - } - - if (tmesa->UbyteSecondaryColor.Ptr) { - ALIGN_FREE((void *)tmesa->UbyteSecondaryColor.Ptr); - tmesa->UbyteSecondaryColor.Ptr = 0; - } - - if (tmesa->UbyteColor.Ptr) { - ALIGN_FREE((void *)tmesa->UbyteColor.Ptr); - tmesa->UbyteColor.Ptr = 0; - } -} -- cgit v1.2.3 From f9a69c0f040171cffa63c9c68264c1cf847aa1cd Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Thu, 22 Oct 2009 21:55:09 +0200 Subject: nouveau: nv30: use a8r8g8b8 as depth texture format for z24s8 --- src/gallium/drivers/nv30/nv30_fragtex.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv30/nv30_fragtex.c b/src/gallium/drivers/nv30/nv30_fragtex.c index a2ce947a72..f5f17d4071 100644 --- a/src/gallium/drivers/nv30/nv30_fragtex.c +++ b/src/gallium/drivers/nv30/nv30_fragtex.c @@ -30,7 +30,7 @@ nv30_texture_formats[] = { _(I8_UNORM , L8 , S1, S1, S1, S1, X, X, X, X), _(A8L8_UNORM , A8L8 , S1, S1, S1, S1, X, X, X, Y), // _(Z16_UNORM , Z16 , S1, S1, S1, ONE, X, X, X, X), -// _(Z24S8_UNORM , Z24 , S1, S1, S1, ONE, X, X, X, X), + _(Z24S8_UNORM , A8R8G8B8, S1, S1, S1, ONE, X, X, X, X), _(DXT1_RGB , DXT1 , S1, S1, S1, ONE, X, Y, Z, W), _(DXT1_RGBA , DXT1 , S1, S1, S1, S1, X, Y, Z, W), _(DXT3_RGBA , DXT3 , S1, S1, S1, S1, X, Y, Z, W), @@ -73,9 +73,9 @@ nv30_fragtex_build(struct nv30_context *nv30, int unit) txf = tf->format; txf |= ((pt->last_level>0) ? NV34TCL_TX_FORMAT_MIPMAP : 0); - txf |= log2i(pt->width[0]) << 20; - txf |= log2i(pt->height[0]) << 24; - txf |= log2i(pt->depth[0]) << 28; + txf |= log2i(pt->width[0]) << NV34TCL_TX_FORMAT_BASE_SIZE_U_SHIFT; + txf |= log2i(pt->height[0]) << NV34TCL_TX_FORMAT_BASE_SIZE_V_SHIFT; + txf |= log2i(pt->depth[0]) << NV34TCL_TX_FORMAT_BASE_SIZE_W_SHIFT; txf |= NV34TCL_TX_FORMAT_NO_BORDER | 0x10000; switch (pt->target) { -- cgit v1.2.3 From 4b8de9bd7c6f77fcf3f1f2b939bab980e074e8bf Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Thu, 22 Oct 2009 22:01:53 +0200 Subject: nouveau: nv30: rewrite so we can render only in depth buffer --- src/gallium/drivers/nv30/nv30_state_fb.c | 55 ++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv30/nv30_state_fb.c b/src/gallium/drivers/nv30/nv30_state_fb.c index 197de82886..f90681b0f9 100644 --- a/src/gallium/drivers/nv30/nv30_state_fb.c +++ b/src/gallium/drivers/nv30/nv30_state_fb.c @@ -8,8 +8,8 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) struct nouveau_channel *chan = nv30->screen->base.channel; struct nouveau_grobj *rankine = nv30->screen->rankine; struct nv04_surface *rt[2], *zeta = NULL; - uint32_t rt_enable, rt_format; - int i, colour_format = 0, zeta_format = 0; + uint32_t rt_enable = 0, rt_format = 0; + int i, colour_format = 0, zeta_format = 0, depth_only = 0; struct nouveau_stateobj *so = so_new(64, 10); unsigned rt_flags = NOUVEAU_BO_RDWR | NOUVEAU_BO_VRAM; unsigned w = fb->width; @@ -17,11 +17,6 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) struct nv30_miptree *nv30mt; int colour_bits = 32, zeta_bits = 32; - if (fb->nr_cbufs == 0) { - return FALSE; - } - - rt_enable = 0; for (i = 0; i < fb->nr_cbufs; i++) { if (colour_format) { assert(colour_format == fb->cbufs[i]->format); @@ -40,17 +35,35 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) zeta = (struct nv04_surface *)fb->zsbuf; } - if (!(rt[0]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) { - assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1))); - for (i = 1; i < fb->nr_cbufs; i++) - assert(!(rt[i]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)); + if (rt_enable & (NV34TCL_RT_ENABLE_COLOR0|NV34TCL_RT_ENABLE_COLOR1)) { + /* Render to at least a colour buffer */ + if (!(rt[0]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) { + assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1))); + for (i = 1; i < fb->nr_cbufs; i++) + assert(!(rt[i]->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)); - rt_format = NV34TCL_RT_FORMAT_TYPE_SWIZZLED | - (log2i(rt[0]->base.width) << NV34TCL_RT_FORMAT_LOG2_WIDTH_SHIFT) | - (log2i(rt[0]->base.height) << NV34TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT); + rt_format = NV34TCL_RT_FORMAT_TYPE_SWIZZLED | + (log2i(rt[0]->base.width) << NV34TCL_RT_FORMAT_LOG2_WIDTH_SHIFT) | + (log2i(rt[0]->base.height) << NV34TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT); + } + else + rt_format = NV34TCL_RT_FORMAT_TYPE_LINEAR; + } else if (fb->zsbuf) { + depth_only = 1; + + /* Render to depth buffer only */ + if (!(zeta->base.texture->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) { + assert(!(fb->width & (fb->width - 1)) && !(fb->height & (fb->height - 1))); + + rt_format = NV34TCL_RT_FORMAT_TYPE_SWIZZLED | + (log2i(zeta->base.width) << NV34TCL_RT_FORMAT_LOG2_WIDTH_SHIFT) | + (log2i(zeta->base.height) << NV34TCL_RT_FORMAT_LOG2_HEIGHT_SHIFT); + } + else + rt_format = NV34TCL_RT_FORMAT_TYPE_LINEAR; + } else { + return FALSE; } - else - rt_format = NV34TCL_RT_FORMAT_TYPE_LINEAR; switch (colour_format) { case PIPE_FORMAT_A8R8G8B8_UNORM: @@ -83,21 +96,23 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) return FALSE; } - if (rt_enable & NV34TCL_RT_ENABLE_COLOR0) { - uint32_t pitch = rt[0]->pitch; + if (depth_only || (rt_enable & NV34TCL_RT_ENABLE_COLOR0)) { + struct nv04_surface *rt0 = (depth_only ? zeta : rt[0]); + uint32_t pitch = rt0->pitch; + if (zeta) { pitch |= (zeta->pitch << 16); } else { pitch |= (pitch << 16); } - nv30mt = (struct nv30_miptree *)rt[0]->base.texture; + nv30mt = (struct nv30_miptree *) rt0->base.texture; so_method(so, rankine, NV34TCL_DMA_COLOR0, 1); so_reloc (so, nouveau_bo(nv30mt->buffer), 0, rt_flags | NOUVEAU_BO_OR, chan->vram->handle, chan->gart->handle); so_method(so, rankine, NV34TCL_COLOR0_PITCH, 2); so_data (so, pitch); - so_reloc (so, nouveau_bo(nv30mt->buffer), rt[0]->base.offset, + so_reloc (so, nouveau_bo(nv30mt->buffer), rt0->base.offset, rt_flags | NOUVEAU_BO_LOW, 0, 0); } -- cgit v1.2.3 From 198925caa18526e5aa908ab50482aff814207dc2 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Thu, 22 Oct 2009 22:57:30 +0200 Subject: nv50: handle PIPE_TEX_FILTER_ANISO case Set the same bits as for linear filtering (in addition to max anisotropy), and 2 unknown bits I've seen set. --- src/gallium/drivers/nv50/nv50_state.c | 26 +++++++++++--------------- src/gallium/drivers/nv50/nv50_texture.h | 2 ++ 2 files changed, 13 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c index 81fa3e34c5..ffaa5e29d1 100644 --- a/src/gallium/drivers/nv50/nv50_state.c +++ b/src/gallium/drivers/nv50/nv50_state.c @@ -146,6 +146,7 @@ nv50_sampler_state_create(struct pipe_context *pipe, (wrap_mode(cso->wrap_r) << 6)); switch (cso->mag_img_filter) { + case PIPE_TEX_FILTER_ANISO: case PIPE_TEX_FILTER_LINEAR: tsc[1] |= NV50TSC_1_1_MAGF_LINEAR; break; @@ -156,6 +157,7 @@ nv50_sampler_state_create(struct pipe_context *pipe, } switch (cso->min_img_filter) { + case PIPE_TEX_FILTER_ANISO: case PIPE_TEX_FILTER_LINEAR: tsc[1] |= NV50TSC_1_1_MINF_LINEAR; break; @@ -183,21 +185,15 @@ nv50_sampler_state_create(struct pipe_context *pipe, else if (cso->max_anisotropy >= 12.0) tsc[0] |= (6 << 20); - else - if (cso->max_anisotropy >= 10.0) - tsc[0] |= (5 << 20); - else - if (cso->max_anisotropy >= 8.0) - tsc[0] |= (4 << 20); - else - if (cso->max_anisotropy >= 6.0) - tsc[0] |= (3 << 20); - else - if (cso->max_anisotropy >= 4.0) - tsc[0] |= (2 << 20); - else - if (cso->max_anisotropy >= 2.0) - tsc[0] |= (1 << 20); + else { + tsc[0] |= (int)(cso->max_anisotropy * 0.5f) << 20; + + if (cso->max_anisotropy >= 4.0) + tsc[1] |= NV50TSC_1_1_UNKN_ANISO_35; + else + if (cso->max_anisotropy >= 2.0) + tsc[1] |= NV50TSC_1_1_UNKN_ANISO_15; + } if (cso->compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) { tsc[0] |= (1 << 8); diff --git a/src/gallium/drivers/nv50/nv50_texture.h b/src/gallium/drivers/nv50/nv50_texture.h index 207fb039f7..13f74c11c6 100644 --- a/src/gallium/drivers/nv50/nv50_texture.h +++ b/src/gallium/drivers/nv50/nv50_texture.h @@ -133,6 +133,8 @@ #define NV50TSC_1_1_MIPF_NEAREST 0x00000080 #define NV50TSC_1_1_MIPF_LINEAR 0x000000c0 #define NV50TSC_1_1_LOD_BIAS_MASK 0x01fff000 +#define NV50TSC_1_1_UNKN_ANISO_15 0x10000000 +#define NV50TSC_1_1_UNKN_ANISO_35 0x18000000 #define NV50TSC_1_2_MIN_LOD_MASK 0x00000f00 #define NV50TSC_1_2_MAX_LOD_MASK 0x00f00000 -- cgit v1.2.3 From ff9e1c01989fc80f07cdc69e3e373bdfe1a384ef Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Thu, 22 Oct 2009 13:42:03 -0700 Subject: r300g: Cleanup PSC setup math a bit and stop using Draw formats. --- src/gallium/drivers/r300/r300_reg.h | 21 ++++++++++++ src/gallium/drivers/r300/r300_state_derived.c | 28 +++++++++------- src/gallium/drivers/r300/r300_state_inlines.h | 48 +++++++++++++++++++++------ 3 files changed, 74 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h index ae94bb9b9f..e920b2a5e7 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -348,6 +348,27 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_WRITE_ENA_W 8 # define R300_SWIZZLE1_SHIFT 16 +# define R300_VAP_SWIZZLE_X001 \ + ((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_SHIFT) | \ + (R300_SWIZZLE_SELECT_FP_ZERO << R300_SWIZZLE_SELECT_Y_SHIFT) | \ + (R300_SWIZZLE_SELECT_FP_ZERO << R300_SWIZZLE_SELECT_Z_SHIFT) | \ + (R300_SWIZZLE_SELECT_FP_ONE << R300_SWIZZLE_SELECT_W_SHIFT) | \ + (0xf << R300_WRITE_ENA_SHIFT)) + +# define R300_VAP_SWIZZLE_XY01 \ + ((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_SHIFT) | \ + (R300_SWIZZLE_SELECT_Y << R300_SWIZZLE_SELECT_Y_SHIFT) | \ + (R300_SWIZZLE_SELECT_FP_ZERO << R300_SWIZZLE_SELECT_Z_SHIFT) | \ + (R300_SWIZZLE_SELECT_FP_ONE << R300_SWIZZLE_SELECT_W_SHIFT) | \ + (0xf << R300_WRITE_ENA_SHIFT)) + +# define R300_VAP_SWIZZLE_XYZ1 \ + ((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_SHIFT) | \ + (R300_SWIZZLE_SELECT_Y << R300_SWIZZLE_SELECT_Y_SHIFT) | \ + (R300_SWIZZLE_SELECT_Z << R300_SWIZZLE_SELECT_Z_SHIFT) | \ + (R300_SWIZZLE_SELECT_FP_ONE << R300_SWIZZLE_SELECT_W_SHIFT) | \ + (0xf << R300_WRITE_ENA_SHIFT)) + # define R300_VAP_SWIZZLE_XYZW \ ((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_SHIFT) | \ (R300_SWIZZLE_SELECT_Y << R300_SWIZZLE_SELECT_Y_SHIFT) | \ diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 42aee7231e..7d000e9e2d 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -224,7 +224,8 @@ static void r300_vertex_psc(struct r300_context* r300, struct r300_screen* r300screen = r300_screen(r300->context.screen); struct vertex_info* vinfo = &vformat->vinfo; int* tab = vformat->vs_tab; - uint32_t temp; + uint16_t type, swizzle; + enum pipe_format format; unsigned i, attrib_count; /* Vertex shaders have no semantics on their inputs, @@ -246,25 +247,28 @@ static void r300_vertex_psc(struct r300_context* r300, } for (i = 0; i < attrib_count; i++) { - /* Make sure we have a proper destination for our attribute */ + /* Make sure we have a proper destination for our attribute. */ assert(tab[i] != -1); - /* Add the attribute to the PSC table. */ - temp = translate_draw_vertex_data_type(vinfo->attrib[i].emit) | + format = draw_translate_vinfo_format(vinfo->attrib[i].emit); + + /* Obtain the type of data in this attribute. */ + type = r300_translate_vertex_data_type(format) | tab[i] << R300_DST_VEC_LOC_SHIFT; + /* Obtain the swizzle for this attribute. Note that the default + * swizzle in the hardware is not XYZW! */ + swizzle = r300_translate_vertex_data_swizzle(format); + + /* Add the attribute to the PSC table. */ if (i & 1) { - vformat->vap_prog_stream_cntl[i >> 1] &= 0x0000ffff; - vformat->vap_prog_stream_cntl[i >> 1] |= temp << 16; + vformat->vap_prog_stream_cntl[i >> 1] |= type << 16; - vformat->vap_prog_stream_cntl_ext[i >> 1] |= - (R300_VAP_SWIZZLE_XYZW << 16); + vformat->vap_prog_stream_cntl_ext[i >> 1] |= swizzle << 16; } else { - vformat->vap_prog_stream_cntl[i >> 1] &= 0xffff0000; - vformat->vap_prog_stream_cntl[i >> 1] |= temp << 0; + vformat->vap_prog_stream_cntl[i >> 1] |= type << 0; - vformat->vap_prog_stream_cntl_ext[i >> 1] |= - (R300_VAP_SWIZZLE_XYZW << 0); + vformat->vap_prog_stream_cntl_ext[i >> 1] |= swizzle << 0; } } diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index c82d8e5f08..2431b75a51 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -400,28 +400,54 @@ static INLINE uint32_t r300_translate_gb_pipes(int pipe_count) return 0; } -/* Translate Draw vertex types into PSC vertex types. */ -static INLINE uint32_t translate_draw_vertex_data_type(int type) { - switch (type) { - case EMIT_1F: - case EMIT_1F_PSIZE: +/* Translate pipe_formats into PSC vertex types. */ +static INLINE uint16_t +r300_translate_vertex_data_type(enum pipe_format format) { + switch (format) { + case PIPE_FORMAT_R32_FLOAT: return R300_DATA_TYPE_FLOAT_1; break; - case EMIT_2F: + case PIPE_FORMAT_R32G32_FLOAT: return R300_DATA_TYPE_FLOAT_2; break; - case EMIT_3F: + case PIPE_FORMAT_R32G32B32_FLOAT: return R300_DATA_TYPE_FLOAT_3; break; - case EMIT_4F: + case PIPE_FORMAT_R32G32B32A32_FLOAT: return R300_DATA_TYPE_FLOAT_4; break; - case EMIT_4UB: - return R300_DATA_TYPE_BYTE; + case PIPE_FORMAT_R8G8B8A8_UNORM: + return R300_DATA_TYPE_BYTE | + R300_NORMALIZE; + break; + default: + debug_printf("r300: Implementation error: " + "Bad vertex data format %s!\n", pf_name(format)); + assert(0); + break; + } + return 0; +} + +static INLINE uint16_t +r300_translate_vertex_data_swizzle(enum pipe_format format) { + switch (format) { + case PIPE_FORMAT_R32_FLOAT: + return R300_VAP_SWIZZLE_X001; + break; + case PIPE_FORMAT_R32G32_FLOAT: + return R300_VAP_SWIZZLE_XY01; + break; + case PIPE_FORMAT_R32G32B32_FLOAT: + return R300_VAP_SWIZZLE_XYZ1; + break; + case PIPE_FORMAT_R32G32B32A32_FLOAT: + case PIPE_FORMAT_R8G8B8A8_UNORM: + return R300_VAP_SWIZZLE_XYZW; break; default: debug_printf("r300: Implementation error: " - "Bad vertex data type!\n"); + "Bad vertex data format %s!\n", pf_name(format)); assert(0); break; } -- cgit v1.2.3 From 04ec113e09f6287f2c6b39bf0247e06839eaf7a8 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Thu, 22 Oct 2009 14:28:47 -0700 Subject: r300g: Enable more stuff in r300_screen, cleanup comments. Also enable 24-bit depth buffers without stencil. --- src/gallium/drivers/r300/r300_screen.c | 34 +++++++++++++++------------ src/gallium/drivers/r300/r300_state_inlines.h | 4 +++- src/gallium/drivers/r300/r300_texture.h | 1 + 3 files changed, 23 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index a9058a25e5..1d9f91d0f7 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -80,13 +80,10 @@ static int r300_get_param(struct pipe_screen* pscreen, int param) struct r300_screen* r300screen = r300_screen(pscreen); switch (param) { - /* XXX cases marked "IN THEORY" are possible on the hardware, - * but haven't been implemented yet. */ case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: /* XXX I'm told this goes up to 16 */ return 8; case PIPE_CAP_NPOT_TEXTURES: - /* IN THEORY */ return 0; case PIPE_CAP_TWO_SIDED_STENCIL: if (r300screen->caps->is_r500) { @@ -95,16 +92,26 @@ static int r300_get_param(struct pipe_screen* pscreen, int param) return 0; } case PIPE_CAP_GLSL: - if (r300screen->caps->is_r500) { - return 1; - } else { - return 0; - } + /* I'll be frank. This is a lie. + * + * We don't truly support GLSL on any of this driver's chipsets. + * To be fair, no chipset supports the full GLSL specification + * to the best of our knowledge, but some of the less esoteric + * features are still missing here. + * + * Rather than cripple ourselves intentionally, I'm going to set + * this flag, and as Gallium's interface continues to change, I + * hope that this single monolithic GLSL enable can slowly get + * split down into many different pieces and the state tracker + * will handle fallbacks transparently, like it should. + * + * ~ C. + */ + return 1; case PIPE_CAP_ANISOTROPIC_FILTER: return 1; case PIPE_CAP_POINT_SPRITE: - /* IN THEORY */ - return 0; + return 1; case PIPE_CAP_MAX_RENDER_TARGETS: return 4; case PIPE_CAP_OCCLUSION_QUERY: @@ -145,10 +152,8 @@ static int r300_get_param(struct pipe_screen* pscreen, int param) case PIPE_CAP_TEXTURE_MIRROR_REPEAT: return 1; case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS: - /* XXX guessing (what a terrible guess) */ - return 2; + return 0; case PIPE_CAP_TGSI_CONT_SUPPORTED: - /* XXX */ return 0; case PIPE_CAP_BLEND_EQUATION_SEPARATE: return 1; @@ -229,6 +234,7 @@ static boolean check_tex_2d_format(enum pipe_format format, uint32_t usage, /* Z buffer or texture */ case PIPE_FORMAT_Z16_UNORM: + case PIPE_FORMAT_Z24X8_UNORM: /* Z buffer with stencil or texture */ case PIPE_FORMAT_Z24S8_UNORM: retval = usage & @@ -239,7 +245,6 @@ static boolean check_tex_2d_format(enum pipe_format format, uint32_t usage, /* Definitely unsupported formats. */ /* Non-usable Z buffer/stencil formats. */ case PIPE_FORMAT_Z32_UNORM: - case PIPE_FORMAT_Z24X8_UNORM: case PIPE_FORMAT_S8Z24_UNORM: case PIPE_FORMAT_X8Z24_UNORM: debug_printf("r300: Note: Got unsupported format: %s in %s\n", @@ -249,7 +254,6 @@ static boolean check_tex_2d_format(enum pipe_format format, uint32_t usage, /* XXX These don't even exist case PIPE_FORMAT_A32R32G32B32: case PIPE_FORMAT_A16R16G16B16: */ - /* XXX Insert YUV422 packed VYUY and YVYU here */ /* XXX What the deuce is UV88? (r3xx accel page 14) debug_printf("r300: Warning: Got unimplemented format: %s in %s\n", pf_name(format), __FUNCTION__); diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index 2431b75a51..ec11a41253 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -330,13 +330,15 @@ static INLINE uint32_t r300_translate_colorformat(enum pipe_format format) return 0; } -/* Depthbuffer and stencilbuffer. Thankfully, we only support two kinds. */ +/* Depthbuffer and stencilbuffer. Thankfully, we only support two flavors. */ static INLINE uint32_t r300_translate_zsformat(enum pipe_format format) { switch (format) { /* 16-bit depth, no stencil */ case PIPE_FORMAT_Z16_UNORM: return R300_DEPTHFORMAT_16BIT_INT_Z; + /* 24-bit depth, ignored stencil */ + case PIPE_FORMAT_Z24X8_UNORM: /* 24-bit depth, 8-bit stencil */ case PIPE_FORMAT_Z24S8_UNORM: return R300_DEPTHFORMAT_24BIT_INT_Z_8BIT_STENCIL; diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h index 2e58bda716..55d1a0ac5c 100644 --- a/src/gallium/drivers/r300/r300_texture.h +++ b/src/gallium/drivers/r300/r300_texture.h @@ -80,6 +80,7 @@ static INLINE uint32_t r300_translate_texformat(enum pipe_format format) R300_TX_FORMAT_YUV_TO_RGB; /* W24_FP */ case PIPE_FORMAT_Z24S8_UNORM: + case PIPE_FORMAT_Z24X8_UNORM: return R300_EASY_TX_FORMAT(X, X, X, X, W24_FP); default: debug_printf("r300: Implementation error: " -- cgit v1.2.3 From 2f7abf5c042a1bcf97d77d6dad4a17bda37e0567 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Oct 2009 16:26:54 -0600 Subject: i965: remove unused BRW_FALLBACK_TEXTURE bit The value was probably wrong too. It was the same as INTEL_FALLBACK_DRAW_BUFFER. --- src/mesa/drivers/dri/i965/brw_context.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index a5209ac41b..b7d6c7ce7e 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -115,7 +115,7 @@ * Handles blending and (presumably) depth and stencil testing. */ -#define BRW_FALLBACK_TEXTURE 0x1 + #define BRW_MAX_CURBE (32*16) struct brw_context; -- cgit v1.2.3 From f9bbbe5803a72eceb8ed6ddc73bb48c8bcdc0179 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Oct 2009 16:32:08 -0600 Subject: i965: remove unused brw_context::tmp_fallback field --- src/mesa/drivers/dri/i965/brw_context.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index b7d6c7ce7e..da0e091bfd 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -454,7 +454,6 @@ struct brw_context GLuint primitive; GLboolean emit_state_always; - GLboolean tmp_fallback; GLboolean no_batch_wrap; struct { -- cgit v1.2.3 From ea659f891740fab1943eca219ffbdd5ed3d1906c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Oct 2009 16:33:36 -0600 Subject: intel: Fallback field is a bitmask, use GLbitfield --- src/mesa/drivers/dri/i915/intel_tris.c | 8 ++++++-- src/mesa/drivers/dri/intel/intel_context.c | 2 +- src/mesa/drivers/dri/intel/intel_context.h | 9 +++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c index a905455342..bc6b29281a 100644 --- a/src/mesa/drivers/dri/i915/intel_tris.c +++ b/src/mesa/drivers/dri/i915/intel_tris.c @@ -1194,12 +1194,16 @@ getFallbackString(GLuint bit) +/** + * Enable/disable a fallback flag. + * \param bit one of INTEL_FALLBACK_x flags. + */ void -intelFallback(struct intel_context *intel, GLuint bit, GLboolean mode) +intelFallback(struct intel_context *intel, GLbitfield bit, GLboolean mode) { GLcontext *ctx = &intel->ctx; TNLcontext *tnl = TNL_CONTEXT(ctx); - GLuint oldfallback = intel->Fallback; + const GLbitfield oldfallback = intel->Fallback; if (mode) { intel->Fallback |= bit; diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index c49f06e44a..d24af46f59 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -839,7 +839,7 @@ intelDestroyContext(__DRIcontextPrivate * driContextPriv) _vbo_DestroyContext(&intel->ctx); _swrast_DestroyContext(&intel->ctx); - intel->Fallback = 0; /* don't call _swrast_Flush later */ + intel->Fallback = 0x0; /* don't call _swrast_Flush later */ intel_batchbuffer_free(intel->batch); intel->batch = NULL; diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 03e7cf39d6..a9db8f6a2b 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -61,6 +61,10 @@ typedef void (*intel_line_func) (struct intel_context *, intelVertex *, intelVertex *); typedef void (*intel_point_func) (struct intel_context *, intelVertex *); +/** + * Bits for intel->Fallback field + */ +/*@{*/ #define INTEL_FALLBACK_DRAW_BUFFER 0x1 #define INTEL_FALLBACK_READ_BUFFER 0x2 #define INTEL_FALLBACK_DEPTH_BUFFER 0x4 @@ -68,8 +72,9 @@ typedef void (*intel_point_func) (struct intel_context *, intelVertex *); #define INTEL_FALLBACK_USER 0x10 #define INTEL_FALLBACK_RENDERMODE 0x20 #define INTEL_FALLBACK_TEXTURE 0x40 +/*@}*/ -extern void intelFallback(struct intel_context *intel, GLuint bit, +extern void intelFallback(struct intel_context *intel, GLbitfield bit, GLboolean mode); #define FALLBACK( intel, bit, mode ) intelFallback( intel, bit, mode ) @@ -171,7 +176,7 @@ struct intel_context struct dri_metaops meta; GLint refcount; - GLuint Fallback; + GLbitfield Fallback; /**< mask of INTEL_FALLBACK_x bits */ GLuint NewGLState; dri_bufmgr *bufmgr; -- cgit v1.2.3 From c24466c34e7aeb8aeda2455f6a688b99c44b10e2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Oct 2009 16:45:03 -0600 Subject: intel: define INTEL_FALLBACK_DRIVER for drivers --- src/mesa/drivers/dri/intel/intel_context.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index a9db8f6a2b..d3acf6e4b3 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -72,6 +72,7 @@ typedef void (*intel_point_func) (struct intel_context *, intelVertex *); #define INTEL_FALLBACK_USER 0x10 #define INTEL_FALLBACK_RENDERMODE 0x20 #define INTEL_FALLBACK_TEXTURE 0x40 +#define INTEL_FALLBACK_DRIVER 0x1000 /**< first for drivers */ /*@}*/ extern void intelFallback(struct intel_context *intel, GLbitfield bit, -- cgit v1.2.3 From 8810b8f67135185d1044746bb861fe2ff997626c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Oct 2009 16:45:50 -0600 Subject: i965: fix hacked Fallback usage in brw_prepare_vertices() Setting intel->Fallback = 1 clobbered any fallback state that was already set. Not sure where this hack originated (the git history is a little convoluted). Define and use a new BRW_FALLBACK_DRAW bit instead. This shouldn't break anything and could potentially fix some bugs (but no specific ones are known). --- src/mesa/drivers/dri/i965/brw_context.h | 2 ++ src/mesa/drivers/dri/i965/brw_draw_upload.c | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index da0e091bfd..b1e7ec8465 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -116,6 +116,8 @@ */ +#define BRW_FALLBACK_DRAW (INTEL_FALLBACK_DRIVER << 0) + #define BRW_MAX_CURBE (32*16) struct brw_context; diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 9d089e113e..4f8ceb37bd 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -375,9 +375,10 @@ static void brw_prepare_vertices(struct brw_context *brw) * isn't an issue at this point. */ if (brw->vb.nr_enabled >= BRW_VEP_MAX) { - intel->Fallback = 1; + FALLBACK(intel, BRW_FALLBACK_DRAW, GL_TRUE); return; } + FALLBACK(intel, BRW_FALLBACK_DRAW, GL_FALSE); for (i = 0; i < brw->vb.nr_enabled; i++) { struct brw_vertex_element *input = brw->vb.enabled[i]; @@ -427,9 +428,10 @@ static void brw_prepare_vertices(struct brw_context *brw) /* Position array not properly enabled: */ if (input->glarray->StrideB == 0) { - intel->Fallback = 1; + FALLBACK(intel, BRW_FALLBACK_DRAW, GL_TRUE); return; } + FALLBACK(intel, BRW_FALLBACK_DRAW, GL_FALSE); interleave = input->glarray->StrideB; ptr = input->glarray->Ptr; -- cgit v1.2.3 From fb22e801699ef69e40d8e9dfda758be824d86b96 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Thu, 22 Oct 2009 19:31:44 -0400 Subject: st/xorg: fix the makefile when used with new xextproto --- src/gallium/state_trackers/xorg/Makefile | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/Makefile b/src/gallium/state_trackers/xorg/Makefile index 27a1990724..22c107370e 100644 --- a/src/gallium/state_trackers/xorg/Makefile +++ b/src/gallium/state_trackers/xorg/Makefile @@ -5,6 +5,8 @@ LIBNAME = xorgtracker LIBRARY_INCLUDES = \ -DHAVE_CONFIG_H \ + $(shell pkg-config xextproto --atleast-version=7.0.99.1 \ + && echo "-DHAVE_XEXTPROTO_71") \ $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \ -I$(TOP)/src/gallium/include \ -I$(TOP)/src/gallium/auxiliary \ -- cgit v1.2.3 From 4837e01bcd3d011a38d75cc9f1eff629c3de6fd6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Oct 2009 18:16:10 -0600 Subject: mesa: code refactoring- new _mesa_finish(), _mesa_flush() --- src/mesa/main/context.c | 37 +++++++++++++++++++++++++++++-------- src/mesa/main/context.h | 8 ++++++++ 2 files changed, 37 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index ac6540f4a0..e844a7432d 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -1543,6 +1543,33 @@ _mesa_record_error(GLcontext *ctx, GLenum error) } +/** + * Flush commands and wait for completion. + */ +void +_mesa_finish(GLcontext *ctx) +{ + FLUSH_CURRENT( ctx, 0 ); + if (ctx->Driver.Finish) { + ctx->Driver.Finish(ctx); + } +} + + +/** + * Flush commands. + */ +void +_mesa_flush(GLcontext *ctx) +{ + FLUSH_CURRENT( ctx, 0 ); + if (ctx->Driver.Flush) { + ctx->Driver.Flush(ctx); + } +} + + + /** * Execute glFinish(). * @@ -1554,10 +1581,7 @@ _mesa_Finish(void) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - FLUSH_CURRENT( ctx, 0 ); - if (ctx->Driver.Finish) { - ctx->Driver.Finish(ctx); - } + _mesa_finish(ctx); } @@ -1572,10 +1596,7 @@ _mesa_Flush(void) { GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - FLUSH_CURRENT( ctx, 0 ); - if (ctx->Driver.Flush) { - ctx->Driver.Flush(ctx); - } + _mesa_flush(ctx); } diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 5587695fa0..c3be1063f8 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -170,6 +170,14 @@ _mesa_valid_to_render(GLcontext *ctx, const char *where); extern void _mesa_record_error( GLcontext *ctx, GLenum error ); + +extern void +_mesa_finish(GLcontext *ctx); + +extern void +_mesa_flush(GLcontext *ctx); + + extern void GLAPIENTRY _mesa_Finish( void ); -- cgit v1.2.3 From 5e6a6a2719c695996490bde491dac267e52f78af Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Oct 2009 18:19:01 -0600 Subject: glx: don't destroy context immediately if it's currently bound According to the GLXDestroyContext() man page, the context should not immediately be destroyed if it's bound to some thread. Wait until it's unbound to really delete it. The code for doing the later part is already present in MakeContextCurrent() so no change was needed there. --- src/glx/x11/glxcmds.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index cd4aede74e..c63116bab7 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -540,6 +540,16 @@ DestroyContext(Display * dpy, GLXContext gc) imported = gc->imported; gc->xid = None; + if (gc->currentDpy) { + /* This context is bound to some thread. According to the man page, + * we should not actually delete the context until it's unbound. + * Note that we set gc->xid = None above. In MakeContextCurrent() + * we check for that and delete the context there. + */ + __glXUnlock(); + return; + } + #ifdef GLX_DIRECT_RENDERING /* Destroy the direct rendering context */ if (gc->driContext) { -- cgit v1.2.3 From 55058652b886b95bfc24109a9edb04d274c01c1a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Oct 2009 18:32:48 -0600 Subject: intel: flush old context before binding new context Per the GLX spec, when changing rendering contexts, the old context should first be flushed. --- src/mesa/drivers/dri/intel/intel_context.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index d24af46f59..ddb0550f77 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -944,10 +944,23 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv, __DRIdrawablePrivate * driReadPriv) { __DRIscreenPrivate *psp = driDrawPriv->driScreenPriv; + struct intel_context *intel; + GET_CURRENT_CONTEXT(curCtx); + + if (driContextPriv) + intel = (struct intel_context *) driContextPriv->driverPrivate; + else + intel = NULL; + + /* According to the glXMakeCurrent() man page: "Pending commands to + * the previous context, if any, are flushed before it is released." + * But only flush if we're actually changing contexts. + */ + if (intel_context(curCtx) && intel_context(curCtx) != intel) { + _mesa_flush(curCtx); + } if (driContextPriv) { - struct intel_context *intel = - (struct intel_context *) driContextPriv->driverPrivate; struct intel_framebuffer *intel_fb = (struct intel_framebuffer *) driDrawPriv->driverPrivate; GLframebuffer *readFb = (GLframebuffer *) driReadPriv->driverPrivate; -- cgit v1.2.3 From 488e67bab267dd687dbe83e52974ad4519906fcc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Oct 2009 09:37:22 -0600 Subject: mesa: added _mesa_dump_texture() --- src/mesa/main/debug.c | 28 +++++++++++++++++++++++++--- src/mesa/main/debug.h | 3 +++ 2 files changed, 28 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 8b1707bab3..0e35617575 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -346,12 +346,10 @@ static GLboolean DumpImages; static void -dump_texture_cb(GLuint id, void *data, void *userData) +dump_texture(struct gl_texture_object *texObj) { - struct gl_texture_object *texObj = (struct gl_texture_object *) data; int i; GLboolean written = GL_FALSE; - (void) userData; _mesa_printf("Texture %u\n", texObj->Name); _mesa_printf(" Target 0x%x\n", texObj->Target); @@ -371,6 +369,30 @@ dump_texture_cb(GLuint id, void *data, void *userData) } +/** + * Dump a single texture. + */ +void +_mesa_dump_texture(GLuint texture, GLboolean dumpImages) +{ + GET_CURRENT_CONTEXT(ctx); + struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, texture); + if (texObj) { + DumpImages = dumpImages; + dump_texture(texObj); + } +} + + +static void +dump_texture_cb(GLuint id, void *data, void *userData) +{ + struct gl_texture_object *texObj = (struct gl_texture_object *) data; + (void) userData; + dump_texture(texObj); +} + + /** * Print basic info about all texture objext to stdout. * If dumpImages is true, write PPM of level[0] image to a file. diff --git a/src/mesa/main/debug.h b/src/mesa/main/debug.h index 2a7de9c6b6..f66f774a45 100644 --- a/src/mesa/main/debug.h +++ b/src/mesa/main/debug.h @@ -57,6 +57,9 @@ extern void _mesa_init_debug( GLcontext *ctx ); #endif +extern void +_mesa_dump_texture(GLuint texture, GLboolean dumpImages); + extern void _mesa_dump_textures(GLboolean dumpImages); -- cgit v1.2.3 From fdce832437537f8e89f7ea57d15e73a481bd240e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Oct 2009 09:37:56 -0600 Subject: mesa: fix up vbo comments --- src/mesa/vbo/vbo_exec_api.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index bfa6d76886..f88df5aac7 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -57,7 +57,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. static void reset_attrfv( struct vbo_exec_context *exec ); -/* Close off the last primitive, execute the buffer, restart the +/** + * Close off the last primitive, execute the buffer, restart the * primitive. */ static void vbo_exec_wrap_buffers( struct vbo_exec_context *exec ) @@ -106,7 +107,8 @@ static void vbo_exec_wrap_buffers( struct vbo_exec_context *exec ) } -/* Deal with buffer wrapping where provoked by the vertex buffer +/** + * Deal with buffer wrapping where provoked by the vertex buffer * filling up, as opposed to upgrade_vertex(). */ void vbo_exec_vtx_wrap( struct vbo_exec_context *exec ) @@ -135,7 +137,7 @@ void vbo_exec_vtx_wrap( struct vbo_exec_context *exec ) } -/* +/** * Copy the active vertex's values to the ctx->Current fields. */ static void vbo_exec_copy_to_current( struct vbo_exec_context *exec ) @@ -208,7 +210,8 @@ static void vbo_exec_copy_from_current( struct vbo_exec_context *exec ) } -/* Flush existing data, set new attrib size, replay copied vertices. +/** + * Flush existing data, set new attrib size, replay copied vertices. */ static void vbo_exec_wrap_upgrade_vertex( struct vbo_exec_context *exec, GLuint attr, @@ -392,8 +395,7 @@ do { \ #if FEATURE_evaluators -/* Eval - */ + static void GLAPIENTRY vbo_exec_EvalCoord1f( GLfloat u ) { GET_CURRENT_CONTEXT( ctx ); @@ -492,8 +494,8 @@ static void GLAPIENTRY vbo_exec_EvalPoint2( GLint i, GLint j ) #endif /* FEATURE_evaluators */ -/* Build a list of primitives on the fly. Keep - * ctx->Driver.CurrentExecPrimitive uptodate as well. +/** + * Called via glBegin. */ static void GLAPIENTRY vbo_exec_Begin( GLenum mode ) { @@ -537,6 +539,10 @@ static void GLAPIENTRY vbo_exec_Begin( GLenum mode ) } + +/** + * Called via glEnd. + */ static void GLAPIENTRY vbo_exec_End( void ) { GET_CURRENT_CONTEXT( ctx ); -- cgit v1.2.3 From cf0e25d4c89b62f37ff8d1f11c50efcab6557c7f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Oct 2009 19:20:38 -0600 Subject: radeon: simplify radeon_create_renderbuffer() --- src/mesa/drivers/dri/radeon/radeon_common.h | 2 +- src/mesa/drivers/dri/radeon/radeon_fbo.c | 35 +++++++++++++---------------- src/mesa/drivers/dri/radeon/radeon_screen.c | 19 +++++++++------- 3 files changed, 27 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_common.h b/src/mesa/drivers/dri/radeon/radeon_common.h index f3201911ac..def0cc17a9 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.h +++ b/src/mesa/drivers/dri/radeon/radeon_common.h @@ -43,7 +43,7 @@ void radeon_renderbuffer_set_bo(struct radeon_renderbuffer *rb, struct radeon_bo *bo); struct radeon_renderbuffer * -radeon_create_renderbuffer(GLenum format, __DRIdrawablePrivate *driDrawPriv); +radeon_create_renderbuffer(gl_format format, __DRIdrawablePrivate *driDrawPriv); static inline struct radeon_renderbuffer *radeon_renderbuffer(struct gl_renderbuffer *rb) { struct radeon_renderbuffer *rrb = (struct radeon_renderbuffer *)rb; diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 096ded23fb..40846828c5 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -240,8 +240,13 @@ radeon_nop_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, return GL_FALSE; } + +/** + * Create a renderbuffer for a window's color, depth and/or stencil buffer. + * Not used for user-created renderbuffers. + */ struct radeon_renderbuffer * -radeon_create_renderbuffer(GLenum format, __DRIdrawablePrivate *driDrawPriv) +radeon_create_renderbuffer(gl_format format, __DRIdrawablePrivate *driDrawPriv) { struct radeon_renderbuffer *rrb; @@ -252,40 +257,30 @@ radeon_create_renderbuffer(GLenum format, __DRIdrawablePrivate *driDrawPriv) _mesa_init_renderbuffer(&rrb->base, 0); rrb->base.ClassID = RADEON_RB_CLASS; - /* XXX format junk */ + rrb->base.Format = format; + switch (format) { - case GL_RGB5: - rrb->base.Format = MESA_FORMAT_RGB565; + case MESA_FORMAT_RGB565: rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGB; break; - case GL_RGB8: - rrb->base.Format = MESA_FORMAT_ARGB8888; + case MESA_FORMAT_XRGB8888: rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGB; break; - case GL_RGBA8: - rrb->base.Format = MESA_FORMAT_ARGB8888; + case MESA_FORMAT_ARGB8888: rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGBA; break; - case GL_STENCIL_INDEX8_EXT: - rrb->base.Format = MESA_FORMAT_S8; + case MESA_FORMAT_S8: rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_STENCIL_INDEX; break; - case GL_DEPTH_COMPONENT16: - rrb->base.Format = MESA_FORMAT_Z16; + case MESA_FORMAT_Z16: rrb->base.DataType = GL_UNSIGNED_SHORT; rrb->base._BaseFormat = GL_DEPTH_COMPONENT; break; - case GL_DEPTH_COMPONENT24: - rrb->base.Format = MESA_FORMAT_S8_Z24; - rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT; - rrb->base._BaseFormat = GL_DEPTH_STENCIL; - break; - case GL_DEPTH24_STENCIL8_EXT: - rrb->base.Format = MESA_FORMAT_S8_Z24; + case MESA_FORMAT_S8_Z24: rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT; rrb->base._BaseFormat = GL_DEPTH_STENCIL; break; @@ -296,7 +291,7 @@ radeon_create_renderbuffer(GLenum format, __DRIdrawablePrivate *driDrawPriv) } rrb->dPriv = driDrawPriv; - rrb->base.InternalFormat = format; + rrb->base.InternalFormat = _mesa_get_format_base_format(format); rrb->base.Delete = radeon_delete_renderbuffer; rrb->base.AllocStorage = radeon_alloc_window_storage; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 573eb6c9c1..4a2313f99e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -1480,7 +1480,7 @@ radeonCreateBuffer( __DRIscreenPrivate *driScrnPriv, const GLboolean swAccum = mesaVis->accumRedBits > 0; const GLboolean swStencil = mesaVis->stencilBits > 0 && mesaVis->depthBits != 24; - GLenum rgbFormat; + gl_format rgbFormat; struct radeon_framebuffer *rfb; if (isPixmap) @@ -1493,11 +1493,11 @@ radeonCreateBuffer( __DRIscreenPrivate *driScrnPriv, _mesa_initialize_framebuffer(&rfb->base, mesaVis); if (mesaVis->redBits == 5) - rgbFormat = GL_RGB5; + rgbFormat = MESA_FORMAT_RGB565; else if (mesaVis->alphaBits == 0) - rgbFormat = GL_RGB8; + rgbFormat = MESA_FORMAT_XRGB8888; else - rgbFormat = GL_RGBA8; + rgbFormat = MESA_FORMAT_ARGB8888; /* front color renderbuffer */ rfb->color_rb[0] = radeon_create_renderbuffer(rgbFormat, driDrawPriv); @@ -1513,19 +1513,22 @@ radeonCreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->depthBits == 24) { if (mesaVis->stencilBits == 8) { - struct radeon_renderbuffer *depthStencilRb = radeon_create_renderbuffer(GL_DEPTH24_STENCIL8_EXT, driDrawPriv); + struct radeon_renderbuffer *depthStencilRb = + radeon_create_renderbuffer(MESA_FORMAT_S8_Z24, driDrawPriv); _mesa_add_renderbuffer(&rfb->base, BUFFER_DEPTH, &depthStencilRb->base); _mesa_add_renderbuffer(&rfb->base, BUFFER_STENCIL, &depthStencilRb->base); depthStencilRb->has_surface = screen->depthHasSurface; } else { /* depth renderbuffer */ - struct radeon_renderbuffer *depth = radeon_create_renderbuffer(GL_DEPTH_COMPONENT24, driDrawPriv); + struct radeon_renderbuffer *depth = + radeon_create_renderbuffer(MESA_FORMAT_X8_Z24, driDrawPriv); _mesa_add_renderbuffer(&rfb->base, BUFFER_DEPTH, &depth->base); depth->has_surface = screen->depthHasSurface; } } else if (mesaVis->depthBits == 16) { - /* just 16-bit depth buffer, no hw stencil */ - struct radeon_renderbuffer *depth = radeon_create_renderbuffer(GL_DEPTH_COMPONENT16, driDrawPriv); + /* just 16-bit depth buffer, no hw stencil */ + struct radeon_renderbuffer *depth = + radeon_create_renderbuffer(MESA_FORMAT_Z16, driDrawPriv); _mesa_add_renderbuffer(&rfb->base, BUFFER_DEPTH, &depth->base); depth->has_surface = screen->depthHasSurface; } -- cgit v1.2.3 From 1160acbfea986a821761d18f5f14d5d2cb0dea8c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 22 Oct 2009 19:49:21 -0600 Subject: dri/drivers: update driNewRenderbuffer() to take a gl_format Now pass a specific MESA_FORMAT_x token to indicate the renderbuffer's format. This is better than passing a GLenum and having to guess the specific format. I'm unable to test all the drivers, but any issues should be easy to fix. --- src/mesa/drivers/dri/common/drirenderbuffer.c | 61 +++++++++++++------------- src/mesa/drivers/dri/common/drirenderbuffer.h | 3 +- src/mesa/drivers/dri/fb/fb_dri.c | 4 +- src/mesa/drivers/dri/fb/fb_egl.c | 4 +- src/mesa/drivers/dri/ffb/ffb_xmesa.c | 8 ++-- src/mesa/drivers/dri/i810/i810screen.c | 6 +-- src/mesa/drivers/dri/mach64/mach64_screen.c | 8 ++-- src/mesa/drivers/dri/mach64/mach64_span.c | 14 +++--- src/mesa/drivers/dri/mga/mga_xmesa.c | 14 +++--- src/mesa/drivers/dri/mga/mgaspan.c | 20 ++++----- src/mesa/drivers/dri/r128/r128_screen.c | 10 ++--- src/mesa/drivers/dri/r128/r128_span.c | 18 ++++---- src/mesa/drivers/dri/s3v/s3v_xmesa.c | 10 ++--- src/mesa/drivers/dri/savage/savage_xmesa.c | 10 ++--- src/mesa/drivers/dri/savage/savagespan.c | 18 ++++---- src/mesa/drivers/dri/sis/sis_span.c | 20 ++++----- src/mesa/drivers/dri/tdfx/tdfx_screen.c | 10 ++--- src/mesa/drivers/dri/trident/trident_context.c | 10 ++--- src/mesa/drivers/dri/unichrome/via_screen.c | 12 ++--- src/mesa/drivers/dri/unichrome/via_span.c | 21 +++++---- 20 files changed, 136 insertions(+), 145 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.c b/src/mesa/drivers/dri/common/drirenderbuffer.c index 6fa1c6caa0..4e7e92c82b 100644 --- a/src/mesa/drivers/dri/common/drirenderbuffer.c +++ b/src/mesa/drivers/dri/common/drirenderbuffer.c @@ -54,7 +54,7 @@ driDeleteRenderbuffer(struct gl_renderbuffer *rb) * \param pitch pixels per row */ driRenderbuffer * -driNewRenderbuffer(GLenum format, GLvoid *addr, +driNewRenderbuffer(gl_format format, GLvoid *addr, GLint cpp, GLint offset, GLint pitch, __DRIdrawablePrivate *dPriv) { @@ -80,46 +80,47 @@ driNewRenderbuffer(GLenum format, GLvoid *addr, /* Make sure we're using a null-valued GetPointer routine */ assert(drb->Base.GetPointer(NULL, &drb->Base, 0, 0) == NULL); - drb->Base.InternalFormat = format; - - if (format == GL_RGBA || format == GL_RGB5 || format == GL_RGBA8) { - /* Color */ - drb->Base.DataType = GL_UNSIGNED_BYTE; - if (format == GL_RGB5) { - drb->Base.Format = MESA_FORMAT_RGB565; + switch (format) { + case MESA_FORMAT_ARGB8888: + if (cpp == 2) { + /* override format */ + format = MESA_FORMAT_RGB565; } - else { - drb->Base.Format = MESA_FORMAT_ARGB8888; - } - } - else if (format == GL_DEPTH_COMPONENT16) { - /* Depth */ - /* we always Get/Put 32-bit Z values */ - drb->Base.DataType = GL_UNSIGNED_INT; - drb->Base.Format = MESA_FORMAT_Z16; - } - else if (format == GL_DEPTH_COMPONENT24) { + drb->Base.DataType = GL_UNSIGNED_BYTE; + break; + case MESA_FORMAT_Z16: /* Depth */ /* we always Get/Put 32-bit Z values */ drb->Base.DataType = GL_UNSIGNED_INT; - drb->Base.Format = MESA_FORMAT_Z32; - } - else if (format == GL_DEPTH_COMPONENT32) { + assert(cpp == 2); + break; + case MESA_FORMAT_Z32: /* Depth */ /* we always Get/Put 32-bit Z values */ drb->Base.DataType = GL_UNSIGNED_INT; - drb->Base.Format = MESA_FORMAT_Z32; - } - else { + assert(cpp == 4); + break; + case MESA_FORMAT_Z24_S8: + drb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT; + assert(cpp == 4); + break; + case MESA_FORMAT_S8_Z24: + drb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT; + assert(cpp == 4); + break; + case MESA_FORMAT_S8: /* Stencil */ - ASSERT(format == GL_STENCIL_INDEX8_EXT); drb->Base.DataType = GL_UNSIGNED_BYTE; - drb->Base.Format = MESA_FORMAT_S8; + break; + default: + _mesa_problem(NULL, "Bad format 0x%x in driNewRenderbuffer", format); + return NULL; } - /* XXX if we were allocating a user-created renderbuffer, we'd have - * to fill in the Red/Green/Blue/.../Bits values too. - */ + drb->Base.Format = format; + + drb->Base.InternalFormat = + drb->Base._BaseFormat = _mesa_get_format_base_format(format); drb->Base.AllocStorage = driRenderbufferStorage; drb->Base.Delete = driDeleteRenderbuffer; diff --git a/src/mesa/drivers/dri/common/drirenderbuffer.h b/src/mesa/drivers/dri/common/drirenderbuffer.h index cf55286b30..9712c0017b 100644 --- a/src/mesa/drivers/dri/common/drirenderbuffer.h +++ b/src/mesa/drivers/dri/common/drirenderbuffer.h @@ -11,6 +11,7 @@ #define DRIRENDERBUFFER_H #include "main/mtypes.h" +#include "main/formats.h" #include "dri_util.h" @@ -63,7 +64,7 @@ typedef struct { extern driRenderbuffer * -driNewRenderbuffer(GLenum format, GLvoid *addr, +driNewRenderbuffer(gl_format format, GLvoid *addr, GLint cpp, GLint offset, GLint pitch, __DRIdrawablePrivate *dPriv); diff --git a/src/mesa/drivers/dri/fb/fb_dri.c b/src/mesa/drivers/dri/fb/fb_dri.c index 571b8922d5..fd869b2fe7 100644 --- a/src/mesa/drivers/dri/fb/fb_dri.c +++ b/src/mesa/drivers/dri/fb/fb_dri.c @@ -437,7 +437,7 @@ fbCreateBuffer( __DRIscreenPrivate *driScrnPriv, /* XXX double-check these parameters (bpp vs cpp, etc) */ { - driRenderbuffer *drb = driNewRenderbuffer(GL_RGBA, + driRenderbuffer *drb = driNewRenderbuffer(MESA_FORMAT_ARGB8888, driScrnPriv->pFB, driScrnPriv->fbBPP / 8, driScrnPriv->fbOrigin, @@ -451,7 +451,7 @@ fbCreateBuffer( __DRIscreenPrivate *driScrnPriv, /* XXX what are the correct origin/stride values? */ GLvoid *backBuf = _mesa_malloc(driScrnPriv->fbStride * driScrnPriv->fbHeight); - driRenderbuffer *drb = driNewRenderbuffer(GL_RGBA, + driRenderbuffer *drb = driNewRenderbuffer(MESA_FORMAT_ARGB8888, backBuf, driScrnPriv->fbBPP /8, driScrnPriv->fbOrigin, diff --git a/src/mesa/drivers/dri/fb/fb_egl.c b/src/mesa/drivers/dri/fb/fb_egl.c index 4e41860d8c..eb7adf8224 100644 --- a/src/mesa/drivers/dri/fb/fb_egl.c +++ b/src/mesa/drivers/dri/fb/fb_egl.c @@ -692,7 +692,7 @@ fbCreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig cfg, /* front color renderbuffer */ { - driRenderbuffer *drb = driNewRenderbuffer(GL_RGBA, display->pFB, + driRenderbuffer *drb = driNewRenderbuffer(MESA_FORMAT_ARGB8888, display->pFB, bytesPerPixel, origin, stride, NULL); fbSetSpanFunctions(drb, &vis); @@ -703,7 +703,7 @@ fbCreateScreenSurfaceMESA(_EGLDriver *drv, EGLDisplay dpy, EGLConfig cfg, /* back color renderbuffer */ if (vis.doubleBufferMode) { GLubyte *backBuf = _mesa_malloc(stride * height); - driRenderbuffer *drb = driNewRenderbuffer(GL_RGBA, backBuf, + driRenderbuffer *drb = driNewRenderbuffer(MESA_FORMAT_ARGB8888, backBuf, bytesPerPixel, origin, stride, NULL); fbSetSpanFunctions(drb, &vis); diff --git a/src/mesa/drivers/dri/ffb/ffb_xmesa.c b/src/mesa/drivers/dri/ffb/ffb_xmesa.c index 3b9f5c6759..09cc26d09e 100644 --- a/src/mesa/drivers/dri/ffb/ffb_xmesa.c +++ b/src/mesa/drivers/dri/ffb/ffb_xmesa.c @@ -347,7 +347,7 @@ ffbCreateBuffer(__DRIscreenPrivate *driScrnPriv, { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, NULL, bpp, offset, bogusPitch, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, bpp, offset, bogusPitch, driDrawPriv); ffbSetSpanFunctions(frontRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); @@ -355,7 +355,7 @@ ffbCreateBuffer(__DRIscreenPrivate *driScrnPriv, if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, NULL, bpp, offset, bogusPitch, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, bpp, offset, bogusPitch, driDrawPriv); ffbSetSpanFunctions(backRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); @@ -363,7 +363,7 @@ ffbCreateBuffer(__DRIscreenPrivate *driScrnPriv, if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL, bpp, offset, + = driNewRenderbuffer(MESA_FORMAT_Z16, NULL, bpp, offset, bogusPitch, driDrawPriv); ffbSetDepthFunctions(depthRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); @@ -371,7 +371,7 @@ ffbCreateBuffer(__DRIscreenPrivate *driScrnPriv, if (mesaVis->stencilBits > 0 && !swStencil) { driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, NULL, bpp, offset, + = driNewRenderbuffer(MESA_FORMAT_S8, NULL, bpp, offset, bogusPitch, driDrawPriv); ffbSetStencilFunctions(stencilRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index 6e49f3466c..b0256abbfb 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -293,7 +293,7 @@ i810CreateBuffer( __DRIscreenPrivate *driScrnPriv, { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, driScrnPriv->pFB, screen->cpp, /*screen->frontOffset*/0, screen->backPitch, @@ -304,7 +304,7 @@ i810CreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, screen->back.map, screen->cpp, screen->backOffset, screen->backPitch, @@ -315,7 +315,7 @@ i810CreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, + = driNewRenderbuffer(MESA_FORMAT_Z16, screen->depth.map, screen->cpp, screen->depthOffset, screen->backPitch, diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 6440027ca4..a7222ec960 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -316,7 +316,7 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv, { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp, screen->frontOffset, screen->frontPitch, @@ -327,7 +327,7 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp, screen->backOffset, screen->backPitch, @@ -338,7 +338,7 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, + = driNewRenderbuffer(MESA_FORMAT_Z16, NULL, screen->cpp, screen->depthOffset, screen->depthPitch, driDrawPriv); @@ -348,7 +348,7 @@ mach64CreateBuffer( __DRIscreenPrivate *driScrnPriv, else if (mesaVis->depthBits == 24) { /* XXX I don't think 24-bit Z is supported - so this isn't used */ driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, + = driNewRenderbuffer(MESA_FORMAT_Z24_S8, NULL, screen->cpp, screen->depthOffset, screen->depthPitch, diff --git a/src/mesa/drivers/dri/mach64/mach64_span.c b/src/mesa/drivers/dri/mach64/mach64_span.c index 91d46ce32e..500319e0e3 100644 --- a/src/mesa/drivers/dri/mach64/mach64_span.c +++ b/src/mesa/drivers/dri/mach64/mach64_span.c @@ -157,15 +157,13 @@ void mach64DDInitSpanFuncs( GLcontext *ctx ) void mach64SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis) { - if (drb->Base.InternalFormat == GL_RGBA) { - if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) { - mach64InitPointers_RGB565(&drb->Base); - } - else { - mach64InitPointers_ARGB8888(&drb->Base); - } + if (drb->Base.Format == MESA_FORMAT_RGB565) { + mach64InitPointers_RGB565(&drb->Base); } - else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) { + else if (drb->Base.Format == MESA_FORMAT_ARGB8888) { + mach64InitPointers_ARGB8888(&drb->Base); + } + else if (drb->Base.Format == MESA_FORMAT_Z16) { mach64InitDepthPointers_z16(&drb->Base); } } diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 0dc76fea50..4ca71ca505 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -723,7 +723,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv, { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp, screen->frontOffset, screen->frontPitch, @@ -734,7 +734,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp, screen->backOffset, screen->backPitch, @@ -745,7 +745,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, + = driNewRenderbuffer(MESA_FORMAT_Z16, NULL, screen->cpp, screen->depthOffset, screen->depthPitch, @@ -757,7 +757,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv, /* XXX is this right? */ if (mesaVis->stencilBits) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, + = driNewRenderbuffer(MESA_FORMAT_Z24_S8, NULL, screen->cpp, screen->depthOffset, screen->depthPitch, @@ -767,7 +767,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv, } else { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT32, + = driNewRenderbuffer(MESA_FORMAT_Z32, NULL, screen->cpp, screen->depthOffset, screen->depthPitch, @@ -778,7 +778,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv, } else if (mesaVis->depthBits == 32) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT32, + = driNewRenderbuffer(MESA_FORMAT_Z32, NULL, screen->cpp, screen->depthOffset, screen->depthPitch, @@ -789,7 +789,7 @@ mgaCreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->stencilBits > 0 && !swStencil) { driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, + = driNewRenderbuffer(MESA_FORMAT_S8, NULL, screen->cpp, screen->depthOffset, screen->depthPitch, diff --git a/src/mesa/drivers/dri/mga/mgaspan.c b/src/mesa/drivers/dri/mga/mgaspan.c index 5b6d323ca9..2ff1cac8e2 100644 --- a/src/mesa/drivers/dri/mga/mgaspan.c +++ b/src/mesa/drivers/dri/mga/mgaspan.c @@ -206,24 +206,22 @@ void mgaDDInitSpanFuncs( GLcontext *ctx ) void mgaSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis) { - if (drb->Base.InternalFormat == GL_RGBA) { - if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) { - mgaInitPointers_565(&drb->Base); - } - else { - mgaInitPointers_8888(&drb->Base); - } + if (drb->Base.Format == MESA_FORMAT_RGB565) { + mgaInitPointers_565(&drb->Base); } - else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) { + else if (drb->Base.Format == MESA_FORMAT_ARGB8888) { + mgaInitPointers_8888(&drb->Base); + } + else if (drb->Base.Format == MESA_FORMAT_Z16) { mgaInitDepthPointers_z16(&drb->Base); } - else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) { + else if (drb->Base.Format == MESA_FORMAT_Z24_S8) { mgaInitDepthPointers_z24_s8(&drb->Base); } - else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT32) { + else if (drb->Base.Format == MESA_FORMAT_Z32) { mgaInitDepthPointers_z32(&drb->Base); } - else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) { + else if (drb->Base.Format == MESA_FORMAT_S8) { mgaInitStencilPointers_z24_s8(&drb->Base); } } diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index f5bcc2f290..652dad51f2 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -284,7 +284,7 @@ r128CreateBuffer( __DRIscreenPrivate *driScrnPriv, { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp, screen->frontOffset, screen->frontPitch, @@ -295,7 +295,7 @@ r128CreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp, screen->backOffset, screen->backPitch, @@ -306,7 +306,7 @@ r128CreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, + = driNewRenderbuffer(MESA_FORMAT_Z16, NULL, screen->cpp, screen->depthOffset, screen->depthPitch, @@ -316,7 +316,7 @@ r128CreateBuffer( __DRIscreenPrivate *driScrnPriv, } else if (mesaVis->depthBits == 24) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, + = driNewRenderbuffer(MESA_FORMAT_S8_Z24, NULL, screen->cpp, screen->depthOffset, screen->depthPitch, @@ -327,7 +327,7 @@ r128CreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->stencilBits > 0 && !swStencil) { driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, + = driNewRenderbuffer(MESA_FORMAT_S8, NULL, screen->cpp, screen->depthOffset, screen->depthPitch, diff --git a/src/mesa/drivers/dri/r128/r128_span.c b/src/mesa/drivers/dri/r128/r128_span.c index dd177e0def..d238cc3c94 100644 --- a/src/mesa/drivers/dri/r128/r128_span.c +++ b/src/mesa/drivers/dri/r128/r128_span.c @@ -433,21 +433,19 @@ void r128DDInitSpanFuncs( GLcontext *ctx ) void r128SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis) { - if (drb->Base.InternalFormat == GL_RGBA) { - if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) { - r128InitPointers_RGB565(&drb->Base); - } - else { - r128InitPointers_ARGB8888(&drb->Base); - } + if (drb->Base.Format == MESA_FORMAT_RGB565) { + r128InitPointers_RGB565(&drb->Base); } - else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) { + else if (drb->Base.Format == MESA_FORMAT_ARGB8888) { + r128InitPointers_ARGB8888(&drb->Base); + } + else if (drb->Base.Format == MESA_FORMAT_Z16) { r128InitDepthPointers_z16(&drb->Base); } - else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) { + else if (drb->Base.Format == MESA_FORMAT_S8_Z24) { r128InitDepthPointers_z24_s8(&drb->Base); } - else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) { + else if (drb->Base.Format == MESA_FORMAT_S8) { radeonInitStencilPointers_z24_s8(&drb->Base); } } diff --git a/src/mesa/drivers/dri/s3v/s3v_xmesa.c b/src/mesa/drivers/dri/s3v/s3v_xmesa.c index 85f1481769..f1e123d676 100644 --- a/src/mesa/drivers/dri/s3v/s3v_xmesa.c +++ b/src/mesa/drivers/dri/s3v/s3v_xmesa.c @@ -70,7 +70,7 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv, { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp, screen->frontOffset, screen->frontPitch, driDrawPriv); s3vSetSpanFunctions(frontRb, mesaVis); @@ -79,7 +79,7 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp, screen->backOffset, screen->backPitch, driDrawPriv); s3vSetSpanFunctions(backRb, mesaVis); @@ -89,7 +89,7 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL, screen->cpp, + = driNewRenderbuffer(MESA_FORMAT_Z16, NULL, screen->cpp, screen->depthOffset, screen->depthPitch, driDrawPriv); s3vSetSpanFunctions(depthRb, mesaVis); @@ -97,7 +97,7 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv, } else if (mesaVis->depthBits == 24) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, NULL, screen->cpp, + = driNewRenderbuffer(MESA_FORMAT_Z24_S8, NULL, screen->cpp, screen->depthOffset, screen->depthPitch, driDrawPriv); s3vSetSpanFunctions(depthRb, mesaVis); @@ -107,7 +107,7 @@ s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv, /* no h/w stencil yet? if (mesaVis->stencilBits > 0) { driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, NULL, + = driNewRenderbuffer(MESA_FORMAT_S8, NULL, screen->cpp, screen->depthOffset, screen->depthPitch, driDrawPriv); s3vSetSpanFunctions(stencilRb, mesaVis); diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index 048fbe452c..9eea728319 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -602,7 +602,7 @@ savageCreateBuffer( __DRIscreenPrivate *driScrnPriv, { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, (GLubyte *) screen->aperture.map + 0x01000000 * TARGET_FRONT, screen->cpp, @@ -615,7 +615,7 @@ savageCreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, (GLubyte *) screen->aperture.map + 0x01000000 * TARGET_BACK, screen->cpp, @@ -628,7 +628,7 @@ savageCreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, + = driNewRenderbuffer(MESA_FORMAT_Z16, (GLubyte *) screen->aperture.map + 0x01000000 * TARGET_DEPTH, screen->zpp, @@ -639,7 +639,7 @@ savageCreateBuffer( __DRIscreenPrivate *driScrnPriv, } else if (mesaVis->depthBits == 24) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, + = driNewRenderbuffer(MESA_FORMAT_S8_Z24, (GLubyte *) screen->aperture.map + 0x01000000 * TARGET_DEPTH, screen->zpp, @@ -651,7 +651,7 @@ savageCreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->stencilBits > 0 && !swStencil) { driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, + = driNewRenderbuffer(MESA_FORMAT_S8, (GLubyte *) screen->aperture.map + 0x01000000 * TARGET_DEPTH, screen->zpp, diff --git a/src/mesa/drivers/dri/savage/savagespan.c b/src/mesa/drivers/dri/savage/savagespan.c index 9615e34013..3bb6fbcc63 100644 --- a/src/mesa/drivers/dri/savage/savagespan.c +++ b/src/mesa/drivers/dri/savage/savagespan.c @@ -255,15 +255,13 @@ void savageSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis, GLboolean float_depth) { - if (drb->Base.InternalFormat == GL_RGBA) { - if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) { - savageInitPointers_565(&drb->Base); - } - else { - savageInitPointers_8888(&drb->Base); - } + if (drb->Base.Format == MESA_FORMAT_RGB565) { + savageInitPointers_565(&drb->Base); + } + else if (drb->Base.Format == MESA_FORMAT_ARGB8888) { + savageInitPointers_8888(&drb->Base); } - else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) { + else if (drb->Base.Format == MESA_FORMAT_Z16) { if (float_depth) { savageInitDepthPointers_z16f(&drb->Base); } @@ -271,7 +269,7 @@ savageSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis, savageInitDepthPointers_z16(&drb->Base); } } - else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) { + else if (drb->Base.Format == MESA_FORMAT_S8_Z24) { if (float_depth) { savageInitDepthPointers_s8_z24f(&drb->Base); } @@ -279,7 +277,7 @@ savageSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis, savageInitDepthPointers_s8_z24(&drb->Base); } } - else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) { + else if (drb->Base.Format == MESA_FORMAT_S8) { savageInitStencilPointers_s8_z24(&drb->Base); } } diff --git a/src/mesa/drivers/dri/sis/sis_span.c b/src/mesa/drivers/dri/sis/sis_span.c index 9e9a509755..cfbb51007d 100644 --- a/src/mesa/drivers/dri/sis/sis_span.c +++ b/src/mesa/drivers/dri/sis/sis_span.c @@ -176,24 +176,22 @@ sisDDInitSpanFuncs( GLcontext *ctx ) void sisSetSpanFunctions(struct sis_renderbuffer *srb, const GLvisual *vis) { - if (srb->Base.InternalFormat == GL_RGBA) { - if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) { - sisInitPointers_RGB565( &srb->Base ); - } - else { - sisInitPointers_ARGB8888( &srb->Base ); - } + if (srb->Base.Format == MESA_FORMAT_RGB565) { + sisInitPointers_RGB565( &srb->Base ); } - else if (srb->Base.InternalFormat == GL_DEPTH_COMPONENT16) { + else if (srb->Base.Format == MESA_FORMAT_ARGB8888) { + sisInitPointers_ARGB8888( &srb->Base ); + } + else if (srb->Base.Format == MESA_FORMAT_Z16) { sisInitDepthPointers_z16(&srb->Base); } - else if (srb->Base.InternalFormat == GL_DEPTH_COMPONENT24) { + else if (srb->Base.Format == MESA_FORMAT_S8_Z24) { sisInitDepthPointers_z24_s8(&srb->Base); } - else if (srb->Base.InternalFormat == GL_DEPTH_COMPONENT32) { + else if (srb->Base.Format == MESA_FORMAT_Z32) { sisInitDepthPointers_z32(&srb->Base); } - else if (srb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) { + else if (srb->Base.Format == MESA_FORMAT_S8) { sisInitStencilPointers_z24_s8(&srb->Base); } } diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 58bd48b294..c29694679d 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -173,7 +173,7 @@ tdfxCreateBuffer( __DRIscreenPrivate *driScrnPriv, { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp, screen->fbOffset, screen->width, driDrawPriv); tdfxSetSpanFunctions(frontRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); @@ -181,7 +181,7 @@ tdfxCreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp, screen->backOffset, screen->width, driDrawPriv); tdfxSetSpanFunctions(backRb, mesaVis); @@ -191,7 +191,7 @@ tdfxCreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL, screen->cpp, + = driNewRenderbuffer(MESA_FORMAT_Z16, NULL, screen->cpp, screen->depthOffset, screen->width, driDrawPriv); tdfxSetSpanFunctions(depthRb, mesaVis); @@ -199,7 +199,7 @@ tdfxCreateBuffer( __DRIscreenPrivate *driScrnPriv, } else if (mesaVis->depthBits == 24) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, NULL, screen->cpp, + = driNewRenderbuffer(MESA_FORMAT_Z24_S8, NULL, screen->cpp, screen->depthOffset, screen->width, driDrawPriv); tdfxSetSpanFunctions(depthRb, mesaVis); @@ -208,7 +208,7 @@ tdfxCreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->stencilBits > 0) { driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, NULL, screen->cpp, + = driNewRenderbuffer(MESA_FORMAT_S8, NULL, screen->cpp, screen->depthOffset, screen->width, driDrawPriv); tdfxSetSpanFunctions(stencilRb, mesaVis); diff --git a/src/mesa/drivers/dri/trident/trident_context.c b/src/mesa/drivers/dri/trident/trident_context.c index b5126b07ea..b693a95ece 100644 --- a/src/mesa/drivers/dri/trident/trident_context.c +++ b/src/mesa/drivers/dri/trident/trident_context.c @@ -215,7 +215,7 @@ tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv, { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp, screen->frontOffset, screen->frontPitch, driDrawPriv); /* @@ -226,7 +226,7 @@ tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, NULL, screen->cpp, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp, screen->backOffset, screen->backPitch, driDrawPriv); /* @@ -237,7 +237,7 @@ tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv, if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL, screen->cpp, + = driNewRenderbuffer(MESA_FORMAT_Z16, NULL, screen->cpp, screen->depthOffset, screen->depthPitch, driDrawPriv); /* @@ -247,7 +247,7 @@ tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv, } else if (mesaVis->depthBits == 24) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, NULL, screen->cpp, + = driNewRenderbuffer(MESA_FORMAT_Z24_S8, NULL, screen->cpp, screen->depthOffset, screen->depthPitch, driDrawPriv); /* @@ -259,7 +259,7 @@ tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv, /* no h/w stencil? if (mesaVis->stencilBits > 0 && !swStencil) { driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT); + = driNewRenderbuffer(MESA_FORMAT_S8); tridentSetSpanFunctions(stencilRb, mesaVis); _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); } diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 3dbb570571..5b5477d8e0 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -248,7 +248,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, /* XXX check/fix the offset/pitch parameters! */ { driRenderbuffer *frontRb - = driNewRenderbuffer(GL_RGBA, NULL, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->bytesPerPixel, 0, screen->width, driDrawPriv); viaSetSpanFunctions(frontRb, mesaVis); @@ -257,7 +257,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, if (mesaVis->doubleBufferMode) { driRenderbuffer *backRb - = driNewRenderbuffer(GL_RGBA, NULL, + = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->bytesPerPixel, 0, screen->width, driDrawPriv); viaSetSpanFunctions(backRb, mesaVis); @@ -266,7 +266,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, if (mesaVis->depthBits == 16) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT16, NULL, + = driNewRenderbuffer(MESA_FORMAT_Z16, NULL, screen->bytesPerPixel, 0, screen->width, driDrawPriv); viaSetSpanFunctions(depthRb, mesaVis); @@ -274,7 +274,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, } else if (mesaVis->depthBits == 24) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT24, NULL, + = driNewRenderbuffer(MESA_FORMAT_Z24_S8, NULL, screen->bytesPerPixel, 0, screen->width, driDrawPriv); viaSetSpanFunctions(depthRb, mesaVis); @@ -282,7 +282,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, } else if (mesaVis->depthBits == 32) { driRenderbuffer *depthRb - = driNewRenderbuffer(GL_DEPTH_COMPONENT32, NULL, + = driNewRenderbuffer(MESA_FORMAT_Z32, NULL, screen->bytesPerPixel, 0, screen->width, driDrawPriv); viaSetSpanFunctions(depthRb, mesaVis); @@ -291,7 +291,7 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, if (mesaVis->stencilBits > 0 && !swStencil) { driRenderbuffer *stencilRb - = driNewRenderbuffer(GL_STENCIL_INDEX8_EXT, NULL, + = driNewRenderbuffer(MESA_FORMAT_S8, NULL, screen->bytesPerPixel, 0, screen->width, driDrawPriv); viaSetSpanFunctions(stencilRb, mesaVis); diff --git a/src/mesa/drivers/dri/unichrome/via_span.c b/src/mesa/drivers/dri/unichrome/via_span.c index b908f0fb23..e847164cd0 100644 --- a/src/mesa/drivers/dri/unichrome/via_span.c +++ b/src/mesa/drivers/dri/unichrome/via_span.c @@ -23,6 +23,7 @@ */ #include "main/glheader.h" +#include "main/formats.h" #include "main/macros.h" #include "main/mtypes.h" #include "main/colormac.h" @@ -177,24 +178,22 @@ void viaInitSpanFuncs(GLcontext *ctx) void viaSetSpanFunctions(struct via_renderbuffer *vrb, const GLvisual *vis) { - if (vrb->Base.InternalFormat == GL_RGBA) { - if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) { - viaInitPointers_565(&vrb->Base); - } - else { - viaInitPointers_8888(&vrb->Base); - } + if (vrb->Base.Format == MESA_FORMAT_RGB565) { + viaInitPointers_565(&vrb->Base); } - else if (vrb->Base.InternalFormat == GL_DEPTH_COMPONENT16) { + else if (vrb->Base.Format == MESA_FORMAT_ARGB8888) { + viaInitPointers_8888(&vrb->Base); + } + else if (vrb->Base.Format == MESA_FORMAT_Z16) { viaInitDepthPointers_z16(&vrb->Base); } - else if (vrb->Base.InternalFormat == GL_DEPTH_COMPONENT24) { + else if (vrb->Base.Format == MESA_FORMAT_Z24_S8) { viaInitDepthPointers_z24_s8(&vrb->Base); } - else if (vrb->Base.InternalFormat == GL_DEPTH_COMPONENT32) { + else if (vrb->Base.Format == MESA_FORMAT_Z32) { viaInitDepthPointers_z32(&vrb->Base); } - else if (vrb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) { + else if (vrb->Base.Format == MESA_FORMAT_S8) { viaInitStencilPointers_z24_s8(&vrb->Base); } } -- cgit v1.2.3 From dd245016657c599ecf24c4abe999319f9c870c47 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 20 Oct 2009 10:58:14 -0700 Subject: ARB prog parser: Fix parameter array size comparison Array indexes are invalid when >= the maximum, but array sizes are only in valid when > the maximum. This prevented programs from declaring a single maximum size array. See the piglit vp-max-array test. --- src/mesa/shader/program_parse.tab.c | 2 +- src/mesa/shader/program_parse.y | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c index 9f2d4de90f..c255e912ed 100644 --- a/src/mesa/shader/program_parse.tab.c +++ b/src/mesa/shader/program_parse.tab.c @@ -3109,7 +3109,7 @@ yyreduce: /* Line 1455 of yacc.c */ #line 1041 "program_parse.y" { - if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxParameters)) { + if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - (1)].integer) > state->limits->MaxParameters)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid parameter array size"); YYERROR; } else { diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index 06c1915fbe..ae9e15ae5a 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -1039,7 +1039,7 @@ optArraySize: } | INTEGER { - if (($1 < 1) || ((unsigned) $1 >= state->limits->MaxParameters)) { + if (($1 < 1) || ((unsigned) $1 > state->limits->MaxParameters)) { yyerror(& @1, state, "invalid parameter array size"); YYERROR; } else { -- cgit v1.2.3 From 286611d99060c38c4cc12f18fde5448213e2a44b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 22 Oct 2009 19:21:21 -0700 Subject: Revert "Store clipping distance for user clip planes as part of vertex processing" This reverts commit f058b25881e08c9d89a33345e5c84e1357396932. This change is completely wrong in so many ways. When clip distances are generated as part of vertex processing, they must be interpolated to perform clipping. Geometric clipping goes right out the window. --- src/mesa/tnl/t_context.h | 1 - src/mesa/tnl/t_vb_cliptmp.h | 103 +++++++------------------------------------- src/mesa/tnl/t_vb_program.c | 15 ------- src/mesa/tnl/t_vb_vertex.c | 31 ++----------- 4 files changed, 18 insertions(+), 132 deletions(-) (limited to 'src') diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index ca4edcfcb9..6137c2d2fe 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -207,7 +207,6 @@ struct vertex_buffer GLvector4f *EyePtr; /* _TNL_BIT_POS */ GLvector4f *ClipPtr; /* _TNL_BIT_POS */ GLvector4f *NdcPtr; /* _TNL_BIT_POS */ - GLfloat *ClipDistancePtr[MAX_CLIP_PLANES]; /* _TNL_BIT_POS */ GLubyte ClipOrMask; /* _TNL_BIT_POS */ GLubyte ClipAndMask; /* _TNL_BIT_POS */ GLubyte *ClipMask; /* _TNL_BIT_POS */ diff --git a/src/mesa/tnl/t_vb_cliptmp.h b/src/mesa/tnl/t_vb_cliptmp.h index 0d2183a9e6..618b8b3130 100644 --- a/src/mesa/tnl/t_vb_cliptmp.h +++ b/src/mesa/tnl/t_vb_cliptmp.h @@ -80,58 +80,6 @@ do { \ } while (0) -#define POLY_USERCLIP(PLANE) \ -do { \ - if (mask & CLIP_USER_BIT) { \ - GLuint idxPrev = inlist[0]; \ - GLfloat dpPrev = VB->ClipDistancePtr[PLANE][idxPrev]; \ - GLuint outcount = 0; \ - GLuint i; \ - \ - inlist[n] = inlist[0]; /* prevent rotation of vertices */ \ - for (i = 1; i <= n; i++) { \ - GLuint idx = inlist[i]; \ - GLfloat dp = VB->ClipDistancePtr[PLANE][idx]; \ - \ - if (!IS_NEGATIVE(dpPrev)) { \ - outlist[outcount++] = idxPrev; \ - } \ - \ - if (DIFFERENT_SIGNS(dp, dpPrev)) { \ - if (IS_NEGATIVE(dp)) { \ - /* Going out of bounds. Avoid division by zero as we \ - * know dp != dpPrev from DIFFERENT_SIGNS, above. \ - */ \ - GLfloat t = dp / (dp - dpPrev); \ - INTERP_4F( t, coord[newvert], coord[idx], coord[idxPrev]); \ - interp( ctx, t, newvert, idx, idxPrev, GL_TRUE ); \ - } else { \ - /* Coming back in. \ - */ \ - GLfloat t = dpPrev / (dpPrev - dp); \ - INTERP_4F( t, coord[newvert], coord[idxPrev], coord[idx]); \ - interp( ctx, t, newvert, idxPrev, idx, GL_FALSE ); \ - } \ - outlist[outcount++] = newvert++; \ - } \ - \ - idxPrev = idx; \ - dpPrev = dp; \ - } \ - \ - if (outcount < 3) \ - return; \ - \ - { \ - GLuint *tmp = inlist; \ - inlist = outlist; \ - outlist = tmp; \ - n = outcount; \ - } \ - } \ -} while (0) - - #define LINE_CLIP(PLANE_BIT, A, B, C, D ) \ do { \ if (mask & PLANE_BIT) { \ @@ -163,37 +111,6 @@ do { \ } while (0) -#define LINE_USERCLIP(PLANE) \ -do { \ - if (mask & CLIP_USER_BIT) { \ - const GLfloat dp0 = VB->ClipDistancePtr[PLANE][v0]; \ - const GLfloat dp1 = VB->ClipDistancePtr[PLANE][v1]; \ - const GLboolean neg_dp0 = IS_NEGATIVE(dp0); \ - const GLboolean neg_dp1 = IS_NEGATIVE(dp1); \ - \ - /* For regular clipping, we know from the clipmask that one \ - * (or both) of these must be negative (otherwise we wouldn't \ - * be here). \ - * For userclip, there is only a single bit for all active \ - * planes, so we can end up here when there is nothing to do, \ - * hence the second IS_NEGATIVE() test: \ - */ \ - if (neg_dp0 && neg_dp1) \ - return; /* both vertices outside clip plane: discard */ \ - \ - if (neg_dp1) { \ - GLfloat t = dp1 / (dp1 - dp0); \ - if (t > t1) t1 = t; \ - } else if (neg_dp0) { \ - GLfloat t = dp0 / (dp0 - dp1); \ - if (t > t0) t0 = t; \ - } \ - if (t0 + t1 >= 1.0) \ - return; /* discard */ \ - } \ -} while (0) - - /* Clip a line against the viewport and user clip planes. */ @@ -222,7 +139,11 @@ TAG(clip_line)( GLcontext *ctx, GLuint v0, GLuint v1, GLubyte mask ) if (mask & CLIP_USER_BIT) { for (p = 0; p < ctx->Const.MaxClipPlanes; p++) { if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { - LINE_USERCLIP(p); + const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; + const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; + const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; + const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; + LINE_CLIP( CLIP_USER_BIT, a, b, c, d ); } } } @@ -307,7 +228,11 @@ TAG(clip_tri)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLubyte mask ) if (mask & CLIP_USER_BIT) { for (p = 0; p < ctx->Const.MaxClipPlanes; p++) { if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { - POLY_USERCLIP(p); + const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; + const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; + const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; + const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; + POLY_CLIP( CLIP_USER_BIT, a, b, c, d ); } } } @@ -366,7 +291,11 @@ TAG(clip_quad)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, if (mask & CLIP_USER_BIT) { for (p = 0; p < ctx->Const.MaxClipPlanes; p++) { if (ctx->Transform.ClipPlanesEnabled & (1 << p)) { - POLY_USERCLIP(p); + const GLfloat a = ctx->Transform._ClipUserPlane[p][0]; + const GLfloat b = ctx->Transform._ClipUserPlane[p][1]; + const GLfloat c = ctx->Transform._ClipUserPlane[p][2]; + const GLfloat d = ctx->Transform._ClipUserPlane[p][3]; + POLY_CLIP( CLIP_USER_BIT, a, b, c, d ); } } } @@ -388,6 +317,4 @@ TAG(clip_quad)( GLcontext *ctx, GLuint v0, GLuint v1, GLuint v2, GLuint v3, #undef SIZE #undef TAG #undef POLY_CLIP -#undef POLY_USERCLIP #undef LINE_CLIP -#undef LINE_USERCLIP diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c index 5fb83c2b01..c10a27614f 100644 --- a/src/mesa/tnl/t_vb_program.c +++ b/src/mesa/tnl/t_vb_program.c @@ -66,7 +66,6 @@ struct vp_stage_data { GLvector4f results[VERT_RESULT_MAX]; GLvector4f ndcCoords; /**< normalized device coords */ - GLfloat *clipdistance[MAX_CLIP_PLANES]; GLubyte *clipmask; /**< clip flags */ GLubyte ormask, andmask; /**< for clipping */ }; @@ -78,7 +77,6 @@ struct vp_stage_data { static void userclip( GLcontext *ctx, GLvector4f *clip, - GLfloat *clipdistance[MAX_CLIP_PLANES], GLubyte *clipmask, GLubyte *clipormask, GLubyte *clipandmask ) @@ -107,8 +105,6 @@ userclip( GLcontext *ctx, clipmask[i] |= CLIP_USER_BIT; } - clipdistance[p][i] = dp; - STRIDE_F(coord, stride); } @@ -168,7 +164,6 @@ do_ndc_cliptest(GLcontext *ctx, struct vp_stage_data *store) ctx->VertexProgram.Current->IsPositionInvariant)) { userclip( ctx, VB->ClipPtr, - store->clipdistance, store->clipmask, &store->ormask, &store->andmask ); @@ -176,9 +171,6 @@ do_ndc_cliptest(GLcontext *ctx, struct vp_stage_data *store) if (store->andmask) { return GL_FALSE; } - - memcpy(VB->ClipDistancePtr, store->clipdistance, - sizeof(store->clipdistance)); } VB->ClipAndMask = store->andmask; @@ -522,10 +514,6 @@ init_vp(GLcontext *ctx, struct tnl_pipeline_stage *stage) _mesa_vector4f_alloc( &store->ndcCoords, 0, size, 32 ); store->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 ); - for (i = 0; i < MAX_CLIP_PLANES; i++) - store->clipdistance[i] = - (GLfloat *) ALIGN_MALLOC(sizeof(GLfloat) * size, 32); - return GL_TRUE; } @@ -549,9 +537,6 @@ dtr(struct tnl_pipeline_stage *stage) _mesa_vector4f_free( &store->ndcCoords ); ALIGN_FREE( store->clipmask ); - for (i = 0; i < MAX_CLIP_PLANES; i++) - ALIGN_FREE(store->clipdistance[i]); - FREE( store ); stage->privatePtr = NULL; } diff --git a/src/mesa/tnl/t_vb_vertex.c b/src/mesa/tnl/t_vb_vertex.c index 2a61ff1177..4734754ea4 100644 --- a/src/mesa/tnl/t_vb_vertex.c +++ b/src/mesa/tnl/t_vb_vertex.c @@ -44,7 +44,6 @@ struct vertex_stage_data { GLvector4f eye; GLvector4f clip; GLvector4f proj; - GLfloat *clipdistance[MAX_CLIP_PLANES]; GLubyte *clipmask; GLubyte ormask; GLubyte andmask; @@ -57,12 +56,11 @@ struct vertex_stage_data { /* This function implements cliptesting for user-defined clip planes. * The clipping of primitives to these planes is implemented in - * t_vp_cliptmp.h. + * t_render_clip.h. */ #define USER_CLIPTEST(NAME, SZ) \ static void NAME( GLcontext *ctx, \ GLvector4f *clip, \ - GLfloat *clipdistances[MAX_CLIP_PLANES], \ GLubyte *clipmask, \ GLubyte *clipormask, \ GLubyte *clipandmask ) \ @@ -90,8 +88,6 @@ static void NAME( GLcontext *ctx, \ clipmask[i] |= CLIP_USER_BIT; \ } \ \ - clipdistances[p][i] = dp; \ - \ STRIDE_F(coord, stride); \ } \ \ @@ -111,9 +107,8 @@ USER_CLIPTEST(userclip3, 3) USER_CLIPTEST(userclip4, 4) static void (*(usercliptab[5]))( GLcontext *, - GLvector4f *, - GLfloat *[MAX_CLIP_PLANES], - GLubyte *, GLubyte *, GLubyte * ) = + GLvector4f *, GLubyte *, + GLubyte *, GLubyte * ) = { NULL, NULL, @@ -219,16 +214,12 @@ static GLboolean run_vertex_stage( GLcontext *ctx, if (ctx->Transform.ClipPlanesEnabled) { usercliptab[VB->ClipPtr->size]( ctx, VB->ClipPtr, - store->clipdistance, store->clipmask, &store->ormask, &store->andmask ); if (store->andmask) return GL_FALSE; - - memcpy(VB->ClipDistancePtr, store->clipdistance, - sizeof(store->clipdistance)); } VB->ClipAndMask = store->andmask; @@ -245,7 +236,6 @@ static GLboolean init_vertex_stage( GLcontext *ctx, struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; struct vertex_stage_data *store; GLuint size = VB->Size; - unsigned i; stage->privatePtr = CALLOC(sizeof(*store)); store = VERTEX_STAGE_DATA(stage); @@ -257,17 +247,8 @@ static GLboolean init_vertex_stage( GLcontext *ctx, _mesa_vector4f_alloc( &store->proj, 0, size, 32 ); store->clipmask = (GLubyte *) ALIGN_MALLOC(sizeof(GLubyte)*size, 32 ); - for (i = 0; i < MAX_CLIP_PLANES; i++) - store->clipdistance[i] = - (GLfloat *) ALIGN_MALLOC(sizeof(GLfloat) * size, 32); if (!store->clipmask || - !store->clipdistance[0] || - !store->clipdistance[1] || - !store->clipdistance[2] || - !store->clipdistance[3] || - !store->clipdistance[4] || - !store->clipdistance[5] || !store->eye.data || !store->clip.data || !store->proj.data) @@ -281,16 +262,10 @@ static void dtr( struct tnl_pipeline_stage *stage ) struct vertex_stage_data *store = VERTEX_STAGE_DATA(stage); if (store) { - unsigned i; - _mesa_vector4f_free( &store->eye ); _mesa_vector4f_free( &store->clip ); _mesa_vector4f_free( &store->proj ); ALIGN_FREE( store->clipmask ); - - for (i = 0; i < MAX_CLIP_PLANES; i++) - ALIGN_FREE(store->clipdistance[i]); - FREE(store); stage->privatePtr = NULL; stage->run = init_vertex_stage; -- cgit v1.2.3 From 95328c7cf91322813de846a72f157aefff9417a6 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Thu, 22 Oct 2009 17:18:01 -0400 Subject: r600: clean up context creation Make it more consistent with other radeon drivers. --- src/mesa/drivers/dri/r600/r600_context.c | 202 +++++++++++++++---------------- 1 file changed, 100 insertions(+), 102 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index ba0d450cbb..9776a868ff 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -213,6 +213,96 @@ static void r600_init_vtbl(radeonContextPtr radeon) radeon->vtbl.fallback = r600_fallback; } +static void r600InitConstValues(GLcontext *ctx, radeonScreenPtr screen) +{ + context_t *r600 = R700_CONTEXT(ctx); + + ctx->Const.MaxTextureImageUnits = + driQueryOptioni(&r600->radeon.optionCache, "texture_image_units"); + ctx->Const.MaxTextureCoordUnits = + driQueryOptioni(&r600->radeon.optionCache, "texture_coord_units"); + ctx->Const.MaxTextureUnits = + MIN2(ctx->Const.MaxTextureImageUnits, + ctx->Const.MaxTextureCoordUnits); + ctx->Const.MaxTextureMaxAnisotropy = 16.0; + ctx->Const.MaxTextureLodBias = 16.0; + + ctx->Const.MaxTextureLevels = 13; /* hw support 14 */ + ctx->Const.MaxTextureRectSize = 4096; /* hw support 8192 */ + + ctx->Const.MinPointSize = 0x0001 / 8.0; + ctx->Const.MinPointSizeAA = 0x0001 / 8.0; + ctx->Const.MaxPointSize = 0xffff / 8.0; + ctx->Const.MaxPointSizeAA = 0xffff / 8.0; + + ctx->Const.MinLineWidth = 0x0001 / 8.0; + ctx->Const.MinLineWidthAA = 0x0001 / 8.0; + ctx->Const.MaxLineWidth = 0xffff / 8.0; + ctx->Const.MaxLineWidthAA = 0xffff / 8.0; + + ctx->Const.MaxDrawBuffers = 1; /* hw supports 8 */ + + /* 256 for reg-based consts, inline consts also supported */ + ctx->Const.VertexProgram.MaxInstructions = 8192; /* in theory no limit */ + ctx->Const.VertexProgram.MaxNativeInstructions = 8192; + ctx->Const.VertexProgram.MaxNativeAttribs = 160; + ctx->Const.VertexProgram.MaxTemps = 128; + ctx->Const.VertexProgram.MaxNativeTemps = 128; + ctx->Const.VertexProgram.MaxNativeParameters = 256; + ctx->Const.VertexProgram.MaxNativeAddressRegs = 1; /* ??? */ + + ctx->Const.FragmentProgram.MaxNativeTemps = 128; + ctx->Const.FragmentProgram.MaxNativeAttribs = 32; + ctx->Const.FragmentProgram.MaxNativeParameters = 256; + ctx->Const.FragmentProgram.MaxNativeAluInstructions = 8192; + /* 8 per clause on r6xx, 16 on rv670/r7xx */ + if ((screen->chip_family == CHIP_FAMILY_RV670) || + (screen->chip_family >= CHIP_FAMILY_RV770)) + ctx->Const.FragmentProgram.MaxNativeTexInstructions = 16; + else + ctx->Const.FragmentProgram.MaxNativeTexInstructions = 8; + ctx->Const.FragmentProgram.MaxNativeInstructions = 8192; + ctx->Const.FragmentProgram.MaxNativeTexIndirections = 8; /* ??? */ + ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* and these are?? */ +} + +static void r600ParseOptions(context_t *r600, radeonScreenPtr screen) +{ + /* Parse configuration files. + * Do this here so that initialMaxAnisotropy is set before we create + * the default textures. + */ + driParseConfigFiles(&r600->radeon.optionCache, &screen->optionCache, + screen->driScreen->myNum, "r600"); + + r600->radeon.initialMaxAnisotropy = driQueryOptionf(&r600->radeon.optionCache, + "def_max_anisotropy"); + +} + +static void r600InitGLExtensions(GLcontext *ctx) +{ + context_t *r600 = R700_CONTEXT(ctx); + + driInitExtensions(ctx, card_extensions, GL_TRUE); + if (r600->radeon.radeonScreen->kernel_mm) + driInitExtensions(ctx, mm_extensions, GL_FALSE); + + if (driQueryOptionb + (&r600->radeon.optionCache, "disable_stencil_two_side")) + _mesa_disable_extension(ctx, "GL_EXT_stencil_two_side"); + + if (r600->radeon.glCtx->Mesa_DXTn + && !driQueryOptionb(&r600->radeon.optionCache, "disable_s3tc")) { + _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); + _mesa_enable_extension(ctx, "GL_S3_s3tc"); + } else + if (driQueryOptionb(&r600->radeon.optionCache, "force_s3tc_enable")) + { + _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); + } +} + /* Create the device specific rendering context. */ GLboolean r600CreateContext(const __GLcontextModes * glVisual, @@ -236,19 +326,10 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual, return GL_FALSE; } - if (!(screen->chip_flags & RADEON_CHIPSET_TCL)) - hw_tcl_on = future_hw_tcl_on = 0; + r600ParseOptions(r600, screen); + r600->radeon.radeonScreen = screen; r600_init_vtbl(&r600->radeon); - /* Parse configuration files. - * Do this here so that initialMaxAnisotropy is set before we create - * the default textures. - */ - driParseConfigFiles(&r600->radeon.optionCache, &screen->optionCache, - screen->driScreen->myNum, "r600"); - - r600->radeon.initialMaxAnisotropy = driQueryOptionf(&r600->radeon.optionCache, - "def_max_anisotropy"); /* Init default driver functions then plug in our R600-specific functions * (the texture functions are especially important) @@ -259,7 +340,7 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual, r600InitTextureFuncs(&functions); r700InitShaderFuncs(&functions); r700InitIoctlFuncs(&functions); - radeonInitBufferObjectFuncs(&functions); + radeonInitBufferObjectFuncs(&functions); if (!radeonInitContext(&r600->radeon, &functions, glVisual, driContextPriv, @@ -269,44 +350,14 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual, return GL_FALSE; } - /* Init r600 context data */ - /* Set the maximum texture size small enough that we can guarentee that - * all texture units can bind a maximal texture and have them both in - * texturable memory at once. - */ - ctx = r600->radeon.glCtx; - ctx->Const.MaxTextureImageUnits = - driQueryOptioni(&r600->radeon.optionCache, "texture_image_units"); - ctx->Const.MaxTextureCoordUnits = - driQueryOptioni(&r600->radeon.optionCache, "texture_coord_units"); - ctx->Const.MaxTextureUnits = - MIN2(ctx->Const.MaxTextureImageUnits, - ctx->Const.MaxTextureCoordUnits); - ctx->Const.MaxTextureMaxAnisotropy = 16.0; - ctx->Const.MaxTextureLodBias = 16.0; - - ctx->Const.MaxTextureLevels = 13; /* hw support 14 */ - ctx->Const.MaxTextureRectSize = 4096; /* hw support 8192 */ - - ctx->Const.MinPointSize = 0x0001 / 8.0; - ctx->Const.MinPointSizeAA = 0x0001 / 8.0; - ctx->Const.MaxPointSize = 0xffff / 8.0; - ctx->Const.MaxPointSizeAA = 0xffff / 8.0; - - ctx->Const.MinLineWidth = 0x0001 / 8.0; - ctx->Const.MinLineWidthAA = 0x0001 / 8.0; - ctx->Const.MaxLineWidth = 0xffff / 8.0; - ctx->Const.MaxLineWidthAA = 0xffff / 8.0; + ctx->VertexProgram._MaintainTnlProgram = GL_TRUE; + ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; - /* Needs further modifications */ -#if 0 - ctx->Const.MaxArrayLockSize = - ( /*512 */ RADEON_BUFFER_SIZE * 16 * 1024) / (4 * 4); -#endif + r600InitConstValues(ctx, screen); - ctx->Const.MaxDrawBuffers = 1; + _mesa_set_mvp_with_dp4( ctx, GL_TRUE ); /* Initialize the software rasterizer and helper modules. */ @@ -315,16 +366,12 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual, _tnl_CreateContext(ctx); _swsetup_CreateContext(ctx); _swsetup_Wakeup(ctx); - _ae_create_context(ctx); /* Install the customized pipeline: */ _tnl_destroy_pipeline(ctx); _tnl_install_pipeline(ctx, r700_pipeline); - - /* Try and keep materials and vertices separate: - */ -/* _tnl_isolate_materials(ctx, GL_TRUE); */ + TNL_CONTEXT(ctx)->Driver.RunPipeline = r600RunPipeline; /* Configure swrast and TNL to match hardware characteristics: */ @@ -333,65 +380,16 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual, _tnl_allow_pixel_fog(ctx, GL_FALSE); _tnl_allow_vertex_fog(ctx, GL_TRUE); - /* 256 for reg-based consts, inline consts also supported */ - ctx->Const.VertexProgram.MaxInstructions = 8192; /* in theory no limit */ - ctx->Const.VertexProgram.MaxNativeInstructions = 8192; - ctx->Const.VertexProgram.MaxNativeAttribs = 160; - ctx->Const.VertexProgram.MaxTemps = 128; - ctx->Const.VertexProgram.MaxNativeTemps = 128; - ctx->Const.VertexProgram.MaxNativeParameters = 256; - ctx->Const.VertexProgram.MaxNativeAddressRegs = 1; /* ??? */ - - ctx->Const.FragmentProgram.MaxNativeTemps = 128; - ctx->Const.FragmentProgram.MaxNativeAttribs = 32; - ctx->Const.FragmentProgram.MaxNativeParameters = 256; - ctx->Const.FragmentProgram.MaxNativeAluInstructions = 8192; - /* 8 per clause on r6xx, 16 on rv670/r7xx */ - if ((screen->chip_family == CHIP_FAMILY_RV670) || - (screen->chip_family >= CHIP_FAMILY_RV770)) - ctx->Const.FragmentProgram.MaxNativeTexInstructions = 16; - else - ctx->Const.FragmentProgram.MaxNativeTexInstructions = 8; - ctx->Const.FragmentProgram.MaxNativeInstructions = 8192; - ctx->Const.FragmentProgram.MaxNativeTexIndirections = 8; /* ??? */ - ctx->Const.FragmentProgram.MaxNativeAddressRegs = 0; /* and these are?? */ - ctx->VertexProgram._MaintainTnlProgram = GL_TRUE; - ctx->FragmentProgram._MaintainTexEnvProgram = GL_TRUE; - radeon_init_debug(); - driInitExtensions(ctx, card_extensions, GL_TRUE); - if (r600->radeon.radeonScreen->kernel_mm) - driInitExtensions(ctx, mm_extensions, GL_FALSE); - - if (driQueryOptionb - (&r600->radeon.optionCache, "disable_stencil_two_side")) - _mesa_disable_extension(ctx, "GL_EXT_stencil_two_side"); - - if (r600->radeon.glCtx->Mesa_DXTn - && !driQueryOptionb(&r600->radeon.optionCache, "disable_s3tc")) { - _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); - _mesa_enable_extension(ctx, "GL_S3_s3tc"); - } else - if (driQueryOptionb(&r600->radeon.optionCache, "force_s3tc_enable")) - { - _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); - } - - r700InitDraw(ctx); + r700InitDraw(ctx); radeon_fbo_init(&r600->radeon); radeonInitSpanFuncs( ctx ); - r600InitCmdBuf(r600); - r700InitState(r600->radeon.glCtx); - TNL_CONTEXT(ctx)->Driver.RunPipeline = r600RunPipeline; - - if (driQueryOptionb(&r600->radeon.optionCache, "no_rast")) { - radeon_warning("disabling 3D acceleration\n"); - } + r600InitGLExtensions(ctx); return GL_TRUE; } -- cgit v1.2.3 From 614e8f220332d5876c787ea07300c6c8508219d5 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Thu, 22 Oct 2009 17:41:31 -0400 Subject: r600: remove old tnl pipeline --- src/mesa/drivers/dri/r600/r600_context.c | 33 +++--- src/mesa/drivers/dri/r600/r700_render.c | 193 +++---------------------------- 2 files changed, 34 insertions(+), 192 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index 9776a868ff..e6791b46f0 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -94,8 +94,6 @@ int hw_tcl_on = 1; #include "extension_helper.h" -extern const struct tnl_pipeline_stage *r700_pipeline[]; - const struct dri_extension card_extensions[] = { /* *INDENT-OFF* */ {"GL_ARB_depth_texture", NULL}, @@ -160,17 +158,20 @@ const struct dri_extension gl_20_extension[] = { {"GL_VERSION_2_0", GL_VERSION_2_0_functions }, }; - -static void r600RunPipeline(GLcontext * ctx) -{ - _mesa_lock_context_textures(ctx); - - if (ctx->NewState) - _mesa_update_state_locked(ctx); - - _tnl_run_pipeline(ctx); - _mesa_unlock_context_textures(ctx); -} +static const struct tnl_pipeline_stage *r600_pipeline[] = { + /* Catch any t&l fallbacks + */ + &_tnl_vertex_transform_stage, + &_tnl_normal_transform_stage, + &_tnl_lighting_stage, + &_tnl_fog_coordinate_stage, + &_tnl_texgen_stage, + &_tnl_texture_transform_stage, + &_tnl_point_attenuation_stage, + &_tnl_vertex_program_stage, + &_tnl_render_stage, + 0, +}; static void r600_get_lock(radeonContextPtr rmesa) { @@ -181,7 +182,7 @@ static void r600_get_lock(radeonContextPtr rmesa) if (!rmesa->radeonScreen->kernel_mm) radeon_bo_legacy_texture_age(rmesa->radeonScreen->bom); } -} +} static void r600_vtbl_emit_cs_header(struct radeon_cs *cs, radeonContextPtr rmesa) { @@ -370,8 +371,8 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual, /* Install the customized pipeline: */ _tnl_destroy_pipeline(ctx); - _tnl_install_pipeline(ctx, r700_pipeline); - TNL_CONTEXT(ctx)->Driver.RunPipeline = r600RunPipeline; + _tnl_install_pipeline(ctx, r600_pipeline); + TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline; /* Configure swrast and TNL to match hardware characteristics: */ diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index 4f39d9f1bd..71f95a19c0 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -409,139 +409,6 @@ static GLuint r700PredictRenderSize(GLcontext* ctx, GLuint nr_prims) return dwords; } -static GLboolean r700RunRender(GLcontext * ctx, - struct tnl_pipeline_stage *stage) -{ - context_t *context = R700_CONTEXT(ctx); - radeonContextPtr radeon = &context->radeon; - unsigned int i, id = 0; - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *vb = &tnl->vb; - struct radeon_renderbuffer *rrb; - - radeon_print(RADEON_RENDER, RADEON_NORMAL, "%s: cs begin at %d\n", - __func__, context->radeon.cmdbuf.cs->cdw); - - /* always emit CB base to prevent - * lock ups on some chips. - */ - R600_STATECHANGE(context, cb_target); - /* mark vtx as dirty since it changes per-draw */ - R600_STATECHANGE(context, vtx); - - r700SetScissor(context); - r700SetupVertexProgram(ctx); - r700SetupFragmentProgram(ctx); - r600UpdateTextureState(ctx); - - GLuint emit_end = r700PredictRenderSize(ctx, 0) - + context->radeon.cmdbuf.cs->cdw; - r700SetupStreams(ctx); - - radeonEmitState(radeon); - - radeon_debug_add_indent(); - /* richard test code */ - for (i = 0; i < vb->PrimitiveCount; i++) { - GLuint prim = _tnl_translate_prim(&vb->Primitive[i]); - GLuint start = vb->Primitive[i].start; - GLuint end = vb->Primitive[i].start + vb->Primitive[i].count; - r700RunRenderPrimitive(ctx, start, end, prim); - } - radeon_debug_remove_indent(); - - /* Flush render op cached for last several quads. */ - r700WaitForIdleClean(context); - - rrb = radeon_get_colorbuffer(&context->radeon); - if (rrb && rrb->bo) - r700SyncSurf(context, rrb->bo, 0, RADEON_GEM_DOMAIN_VRAM, - CB_ACTION_ENA_bit | (1 << (id + 6))); - - rrb = radeon_get_depthbuffer(&context->radeon); - if (rrb && rrb->bo) - r700SyncSurf(context, rrb->bo, 0, RADEON_GEM_DOMAIN_VRAM, - DB_ACTION_ENA_bit | DB_DEST_BASE_ENA_bit); - - radeonReleaseArrays(ctx, ~0); - - radeon_print(RADEON_RENDER, RADEON_TRACE, "%s: cs end at %d\n", - __func__, context->radeon.cmdbuf.cs->cdw); - - if ( emit_end < context->radeon.cmdbuf.cs->cdw ) - WARN_ONCE("Rendering was %d commands larger than predicted size." - " We might overflow command buffer.\n", context->radeon.cmdbuf.cs->cdw - emit_end); - - return GL_FALSE; -} - -static GLboolean r700RunNonTCLRender(GLcontext * ctx, - struct tnl_pipeline_stage *stage) /* -------------------- */ -{ - GLboolean bRet = GL_TRUE; - - return bRet; -} - -static GLboolean r700RunTCLRender(GLcontext * ctx, /*----------------------*/ - struct tnl_pipeline_stage *stage) -{ - GLboolean bRet = GL_FALSE; - - /* TODO : sw fallback */ - - /* Need shader bo's setup before bo check */ - r700UpdateShaders(ctx); - /** - - * Ensure all enabled and complete textures are uploaded along with any buffers being used. - */ - if(!r600ValidateBuffers(ctx)) - { - return GL_TRUE; - } - - bRet = r700RunRender(ctx, stage); - - return bRet; - //GL_FALSE will stop to do other pipe stage in _tnl_run_pipeline - //The render here DOES finish the whole pipe, so GL_FALSE should be returned for success. -} - -const struct tnl_pipeline_stage _r700_render_stage = { - "r700 Hardware Rasterization", - NULL, - NULL, - NULL, - NULL, - r700RunNonTCLRender -}; - -const struct tnl_pipeline_stage _r700_tcl_stage = { - "r700 Hardware Transform, Clipping and Lighting", - NULL, - NULL, - NULL, - NULL, - r700RunTCLRender -}; - -const struct tnl_pipeline_stage *r700_pipeline[] = -{ - &_r700_tcl_stage, - &_tnl_vertex_transform_stage, - &_tnl_normal_transform_stage, - &_tnl_lighting_stage, - &_tnl_fog_coordinate_stage, - &_tnl_texgen_stage, - &_tnl_texture_transform_stage, - &_tnl_vertex_program_stage, - - &_r700_render_stage, - &_tnl_render_stage, - 0, -}; - #define CONVERT( TYPE, MACRO ) do { \ GLuint i, j, sz; \ sz = input->Size; \ @@ -941,12 +808,12 @@ static void r700SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer } static GLboolean r700TryDrawPrims(GLcontext *ctx, - const struct gl_client_array *arrays[], - const struct _mesa_prim *prim, - GLuint nr_prims, - const struct _mesa_index_buffer *ib, - GLuint min_index, - GLuint max_index ) + const struct gl_client_array *arrays[], + const struct _mesa_prim *prim, + GLuint nr_prims, + const struct _mesa_index_buffer *ib, + GLuint min_index, + GLuint max_index ) { context_t *context = R700_CONTEXT(ctx); radeonContextPtr radeon = &context->radeon; @@ -954,9 +821,7 @@ static GLboolean r700TryDrawPrims(GLcontext *ctx, struct radeon_renderbuffer *rrb; if (ctx->NewState) - { _mesa_update_state( ctx ); - } _tnl_UpdateFixedFunctionProgram(ctx); r700SetVertexFormat(ctx, arrays, max_index + 1); @@ -1019,18 +884,18 @@ static GLboolean r700TryDrawPrims(GLcontext *ctx, return GL_TRUE; } -static void r700DrawPrimsRe(GLcontext *ctx, - const struct gl_client_array *arrays[], - const struct _mesa_prim *prim, - GLuint nr_prims, - const struct _mesa_index_buffer *ib, - GLboolean index_bounds_valid, - GLuint min_index, - GLuint max_index) +static void r700DrawPrims(GLcontext *ctx, + const struct gl_client_array *arrays[], + const struct _mesa_prim *prim, + GLuint nr_prims, + const struct _mesa_index_buffer *ib, + GLboolean index_bounds_valid, + GLuint min_index, + GLuint max_index) { - GLboolean retval = GL_FALSE; + GLboolean retval = GL_FALSE; - /* This check should get folded into just the places that + /* This check should get folded into just the places that * min/max index are really needed. */ if (!index_bounds_valid) { @@ -1038,7 +903,7 @@ static void r700DrawPrimsRe(GLcontext *ctx, } if (min_index) { - vbo_rebase_prims( ctx, arrays, prim, nr_prims, ib, min_index, max_index, r700DrawPrimsRe ); + vbo_rebase_prims( ctx, arrays, prim, nr_prims, ib, min_index, max_index, r700DrawPrims ); return; } @@ -1050,30 +915,6 @@ static void r700DrawPrimsRe(GLcontext *ctx, _tnl_draw_prims(ctx, arrays, prim, nr_prims, ib, min_index, max_index); } -static void r700DrawPrims(GLcontext *ctx, - const struct gl_client_array *arrays[], - const struct _mesa_prim *prim, - GLuint nr_prims, - const struct _mesa_index_buffer *ib, - GLboolean index_bounds_valid, - GLuint min_index, - GLuint max_index) -{ - context_t *context = R700_CONTEXT(ctx); - - /* For non indexed drawing, using tnl pipe. */ - if(!ib) - { - context->ind_buf.bo = NULL; - - _tnl_vbo_draw_prims(ctx, arrays, prim, nr_prims, ib, - index_bounds_valid, min_index, max_index); - return; - } - - r700DrawPrimsRe(ctx, arrays, prim, nr_prims, ib, index_bounds_valid, min_index, max_index); -} - void r700InitDraw(GLcontext *ctx) { struct vbo_context *vbo = vbo_context(ctx); -- cgit v1.2.3 From fc38a3cfe84e4e79af43f29d236748120789a286 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Fri, 23 Oct 2009 00:40:41 -0400 Subject: r600: fix render size prediction --- src/mesa/drivers/dri/r600/r700_chip.c | 4 ++-- src/mesa/drivers/dri/r600/r700_render.c | 35 +++++++++++++++---------------- src/mesa/drivers/dri/r600/r700_vertprog.c | 1 + 3 files changed, 20 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index 3b7f6fffe0..3ebc53d94f 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -210,8 +210,8 @@ static void r700SetupVTXConstants(GLcontext * ctx, extern int getTypeSize(GLenum type); static void r700SetupVTXConstants2(GLcontext * ctx, - void * pAos, - StreamDesc * pStreamDesc) + void * pAos, + StreamDesc * pStreamDesc) { context_t *context = R700_CONTEXT(ctx); struct radeon_aos * paos = (struct radeon_aos *)pAos; diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index 71f95a19c0..c2e7680eae 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -375,38 +375,38 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim /* start 3d, idle, cb/db flush */ #define PRE_EMIT_STATE_BUFSZ 10 + 5 + 14 -static GLuint r700PredictRenderSize(GLcontext* ctx, GLuint nr_prims) +static GLuint r700PredictRenderSize(GLcontext* ctx, + const struct _mesa_prim *prim, + const struct _mesa_index_buffer *ib, + GLuint nr_prims) { context_t *context = R700_CONTEXT(ctx); - struct r700_vertex_program *vp = context->selected_vp; GLboolean flushed; GLuint dwords, i; GLuint state_size; - /* pre calculate aos count so state prediction works */ - context->radeon.tcl.aos_count = _mesa_bitcount(vp->mesa_program->Base.InputsRead); dwords = PRE_EMIT_STATE_BUFSZ; - if (nr_prims) + if (ib) dwords += nr_prims * 14; else { - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *vb = &tnl->vb; - - for (i = 0; i < vb->PrimitiveCount; i++) - dwords += vb->Primitive[i].count + 10; + for (i = 0; i < nr_prims; ++i) + { + dwords += prim[i].count + 10; + } } + state_size = radeonCountStateEmitSize(&context->radeon); flushed = rcommonEnsureCmdBufSpace(&context->radeon, - dwords + state_size, __FUNCTION__); - + dwords + state_size, + __FUNCTION__); if (flushed) - dwords += radeonCountStateEmitSize(&context->radeon); + dwords += radeonCountStateEmitSize(&context->radeon); else - dwords += state_size; + dwords += state_size; - radeon_print(RADEON_RENDER, RADEON_VERBOSE, - "%s: total prediction size is %d.\n", __FUNCTION__, dwords); + radeon_print(RADEON_RENDER, RADEON_VERBOSE, "%s: total prediction size is %d.\n", __FUNCTION__, dwords); return dwords; + } #define CONVERT( TYPE, MACRO ) do { \ @@ -653,7 +653,6 @@ static void r700SetupStreams2(GLcontext *ctx, const struct gl_client_array *inpu } } - context->radeon.tcl.aos_count = context->nNumActiveAos; ret = radeon_cs_space_check_with_bo(context->radeon.cmdbuf.cs, first_elem(&context->radeon.dma.reserved)->bo, RADEON_GEM_DOMAIN_GTT, 0); @@ -842,7 +841,7 @@ static GLboolean r700TryDrawPrims(GLcontext *ctx, r700SetupFragmentProgram(ctx); r600UpdateTextureState(ctx); - GLuint emit_end = r700PredictRenderSize(ctx, nr_prims) + GLuint emit_end = r700PredictRenderSize(ctx, prim, ib, nr_prims) + context->radeon.cmdbuf.cs->cdw; r700SetupIndexBuffer(ctx, ib); diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c index d12c39c9f7..65c2c3f811 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.c +++ b/src/mesa/drivers/dri/r600/r700_vertprog.c @@ -580,6 +580,7 @@ void r700SetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], unBit >>= 1; ++unLoc; } + context->radeon.tcl.aos_count = context->nNumActiveAos; } void * r700GetActiveVpShaderBo(GLcontext * ctx) -- cgit v1.2.3 From 45eb9d2f6dced7654291cabb4b8dd02a695db694 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Fri, 23 Oct 2009 01:00:23 -0400 Subject: r600: remove remains of old tnl pipeline --- src/mesa/drivers/dri/r600/r600_context.h | 30 -------- src/mesa/drivers/dri/r600/r700_chip.c | 121 ++---------------------------- src/mesa/drivers/dri/r600/r700_render.c | 6 +- src/mesa/drivers/dri/r600/r700_shader.h | 1 + src/mesa/drivers/dri/r600/r700_state.c | 40 +--------- src/mesa/drivers/dri/r600/r700_vertprog.c | 103 ++++++------------------- src/mesa/drivers/dri/r600/r700_vertprog.h | 8 +- 7 files changed, 41 insertions(+), 268 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_context.h b/src/mesa/drivers/dri/r600/r600_context.h index 7f68820fda..394fd757d4 100644 --- a/src/mesa/drivers/dri/r600/r600_context.h +++ b/src/mesa/drivers/dri/r600/r600_context.h @@ -58,29 +58,6 @@ typedef struct r600_context context_t; #include "main/mm.h" -/************ DMA BUFFERS **************/ - -/* The blit width for texture uploads - */ -#define R600_BLIT_WIDTH_BYTES 1024 -#define R600_MAX_TEXTURE_UNITS 8 - -struct r600_texture_state { - int tc_count; /* number of incoming texture coordinates from VAP */ -}; - -/* Perhaps more if we store programs in vmem? */ -/* drm_r600_cmd_header_t->vpu->count is unsigned char */ -#define VSF_MAX_FRAGMENT_LENGTH (255*4) - -/* Can be tested with colormat currently. */ -#define VSF_MAX_FRAGMENT_TEMPS (14) - -#define STATE_R600_WINDOW_DIMENSION (STATE_INTERNAL_DRIVER+0) -#define STATE_R600_TEXRECT_FACTOR (STATE_INTERNAL_DRIVER+1) - -extern int hw_tcl_on; - #define COLOR_IS_RGBA #define TAG(x) r600##x #include "tnl_dd/t_dd_vertex.h" @@ -167,9 +144,6 @@ struct r600_context { /* Vertex buffers */ - GLvector4f dummy_attrib[_TNL_ATTRIB_MAX]; - GLvector4f *temp_attrib[_TNL_ATTRIB_MAX]; - GLint nNumActiveAos; StreamDesc stream_desc[VERT_ATTRIB_MAX]; struct r700_index_buffer ind_buf; @@ -203,7 +177,6 @@ extern GLboolean r700SyncSurf(context_t *context, uint32_t write_domain, uint32_t sync_type); -extern void r700SetupStreams(GLcontext * ctx); extern void r700Start3D(context_t *context); extern void r600InitAtoms(context_t *context); extern void r700InitDraw(GLcontext *ctx); @@ -213,7 +186,4 @@ extern void r700InitDraw(GLcontext *ctx); #define RADEON_D_PLAYBACK_RAW 2 #define RADEON_D_T 3 -#define r600PackFloat32 radeonPackFloat32 -#define r600PackFloat24 radeonPackFloat24 - #endif /* __R600_CONTEXT_H__ */ diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index 3ebc53d94f..75b97c56cd 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -141,77 +141,10 @@ static void r700SendTexBorderColorState(GLcontext *ctx, struct radeon_state_atom } } +extern int getTypeSize(GLenum type); static void r700SetupVTXConstants(GLcontext * ctx, - unsigned int nStreamID, void * pAos, - unsigned int size, /* number of elements in vector */ - unsigned int stride, - unsigned int count) /* number of vectors in stream */ -{ - context_t *context = R700_CONTEXT(ctx); - struct radeon_aos * paos = (struct radeon_aos *)pAos; - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - unsigned int uSQ_VTX_CONSTANT_WORD0_0; - unsigned int uSQ_VTX_CONSTANT_WORD1_0; - unsigned int uSQ_VTX_CONSTANT_WORD2_0 = 0; - unsigned int uSQ_VTX_CONSTANT_WORD3_0 = 0; - unsigned int uSQ_VTX_CONSTANT_WORD6_0 = 0; - - if (!paos->bo) - return; - - if ((context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV610) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV620) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RS780) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RS880) || - (context->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV710)) - r700SyncSurf(context, paos->bo, RADEON_GEM_DOMAIN_GTT, 0, TC_ACTION_ENA_bit); - else - r700SyncSurf(context, paos->bo, RADEON_GEM_DOMAIN_GTT, 0, VC_ACTION_ENA_bit); - - uSQ_VTX_CONSTANT_WORD0_0 = paos->offset; - uSQ_VTX_CONSTANT_WORD1_0 = count * (size * 4) - 1; - - SETfield(uSQ_VTX_CONSTANT_WORD2_0, 0, BASE_ADDRESS_HI_shift, BASE_ADDRESS_HI_mask); /* TODO */ - SETfield(uSQ_VTX_CONSTANT_WORD2_0, stride, SQ_VTX_CONSTANT_WORD2_0__STRIDE_shift, - SQ_VTX_CONSTANT_WORD2_0__STRIDE_mask); - SETfield(uSQ_VTX_CONSTANT_WORD2_0, GetSurfaceFormat(GL_FLOAT, size, NULL), - SQ_VTX_CONSTANT_WORD2_0__DATA_FORMAT_shift, - SQ_VTX_CONSTANT_WORD2_0__DATA_FORMAT_mask); /* TODO : trace back api for initial data type, not only GL_FLOAT */ - SETfield(uSQ_VTX_CONSTANT_WORD2_0, SQ_NUM_FORMAT_SCALED, - SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_shift, SQ_VTX_CONSTANT_WORD2_0__NUM_FORMAT_ALL_mask); - SETbit(uSQ_VTX_CONSTANT_WORD2_0, SQ_VTX_CONSTANT_WORD2_0__FORMAT_COMP_ALL_bit); - - SETfield(uSQ_VTX_CONSTANT_WORD3_0, 1, MEM_REQUEST_SIZE_shift, MEM_REQUEST_SIZE_mask); - SETfield(uSQ_VTX_CONSTANT_WORD6_0, SQ_TEX_VTX_VALID_BUFFER, - SQ_TEX_RESOURCE_WORD6_0__TYPE_shift, SQ_TEX_RESOURCE_WORD6_0__TYPE_mask); - - BEGIN_BATCH_NO_AUTOSTATE(9 + 2); - - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_RESOURCE, 7)); - R600_OUT_BATCH((nStreamID + SQ_FETCH_RESOURCE_VS_OFFSET) * FETCH_RESOURCE_STRIDE); - R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD0_0); - R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD1_0); - R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD2_0); - R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD3_0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(0); - R600_OUT_BATCH(uSQ_VTX_CONSTANT_WORD6_0); - R600_OUT_BATCH_RELOC(uSQ_VTX_CONSTANT_WORD0_0, - paos->bo, - uSQ_VTX_CONSTANT_WORD0_0, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); - COMMIT_BATCH(); - -} - -extern int getTypeSize(GLenum type); -static void r700SetupVTXConstants2(GLcontext * ctx, - void * pAos, - StreamDesc * pStreamDesc) + StreamDesc * pStreamDesc) { context_t *context = R700_CONTEXT(ctx); struct radeon_aos * paos = (struct radeon_aos *)pAos; @@ -295,31 +228,6 @@ static void r700SetupVTXConstants2(GLcontext * ctx, } -void r700SetupStreams(GLcontext *ctx) -{ - context_t *context = R700_CONTEXT(ctx); - struct r700_vertex_program *vp = context->selected_vp; - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *vb = &tnl->vb; - unsigned int i, j = 0; - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - - R600_STATECHANGE(context, vtx); - - for(i=0; imesa_program->Base.InputsRead & (1 << i)) { - rcommon_emit_vector(ctx, - &context->radeon.tcl.aos[j], - vb->AttribPtr[i]->data, - vb->AttribPtr[i]->size, - vb->AttribPtr[i]->stride, - vb->Count); - j++; - } - } - context->radeon.tcl.aos_count = j; -} - static void r700SendVTXState(GLcontext *ctx, struct radeon_state_atom *atom) { context_t *context = R700_CONTEXT(ctx); @@ -343,25 +251,12 @@ static void r700SendVTXState(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); for(i=0; imesa_program->Base.InputsRead & (1 << i)) - { - if(1 == context->selected_vp->uiVersion) - { - /* currently aos are packed */ - r700SetupVTXConstants(ctx, - i, - (void*)(&context->radeon.tcl.aos[j]), - (unsigned int)context->radeon.tcl.aos[j].components, - (unsigned int)context->radeon.tcl.aos[j].stride * 4, - (unsigned int)context->radeon.tcl.aos[j].count); - } - else - { /* context->selected_vp->uiVersion == 2 : aos not always packed */ - r700SetupVTXConstants2(ctx, - (void*)(&context->radeon.tcl.aos[j]), - &(context->stream_desc[j])); - } - j++; + if(vp->mesa_program->Base.InputsRead & (1 << i)) + { + r700SetupVTXConstants(ctx, + (void*)(&context->radeon.tcl.aos[j]), + &(context->stream_desc[j])); + j++; } } } diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index c2e7680eae..3e1ce9fb72 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -550,7 +550,7 @@ static void r700AlignDataToDword(GLcontext *ctx, attr->stride = dst_stride; } -static void r700SetupStreams2(GLcontext *ctx, const struct gl_client_array *input[], int count) +static void r700SetupStreams(GLcontext *ctx, const struct gl_client_array *input[], int count) { context_t *context = R700_CONTEXT(ctx); GLuint stride; @@ -825,7 +825,7 @@ static GLboolean r700TryDrawPrims(GLcontext *ctx, _tnl_UpdateFixedFunctionProgram(ctx); r700SetVertexFormat(ctx, arrays, max_index + 1); /* shaders need to be updated before buffers are validated */ - r700UpdateShaders2(ctx); + r700UpdateShaders(ctx); if (!r600ValidateBuffers(ctx)) return GL_FALSE; @@ -845,7 +845,7 @@ static GLboolean r700TryDrawPrims(GLcontext *ctx, + context->radeon.cmdbuf.cs->cdw; r700SetupIndexBuffer(ctx, ib); - r700SetupStreams2(ctx, arrays, max_index + 1); + r700SetupStreams(ctx, arrays, max_index + 1); radeonEmitState(radeon); diff --git a/src/mesa/drivers/dri/r600/r700_shader.h b/src/mesa/drivers/dri/r600/r700_shader.h index 997cb05aaf..c6a058617e 100644 --- a/src/mesa/drivers/dri/r600/r700_shader.h +++ b/src/mesa/drivers/dri/r600/r700_shader.h @@ -128,6 +128,7 @@ typedef struct R700_Shader //Internal void AddInstToList(TypedShaderList * plstCFInstructions, R700ShaderInstruction * pInst); +void TakeInstOutFromList(TypedShaderList * plstCFInstructions, R700ShaderInstruction * pInst); void ResolveLinks(R700_Shader *pShader); void Assemble(R700_Shader *pShader); diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index 3d3c8b958f..9a6a68a68c 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -61,12 +61,9 @@ static void r700UpdatePolygonMode(GLcontext * ctx); static void r700SetPolygonOffsetState(GLcontext * ctx, GLboolean state); static void r700SetStencilState(GLcontext * ctx, GLboolean state); -void r700UpdateShaders (GLcontext * ctx) //---------------------------------- +void r700UpdateShaders(GLcontext * ctx) { context_t *context = R700_CONTEXT(ctx); - GLvector4f dummy_attrib[_TNL_ATTRIB_MAX]; - GLvector4f *temp_attrib[_TNL_ATTRIB_MAX]; - int i; /* should only happenen once, just after context is created */ /* TODO: shouldn't we fallback to sw here? */ @@ -77,40 +74,7 @@ void r700UpdateShaders (GLcontext * ctx) //---------------------------------- r700SelectFragmentShader(ctx); - if (context->radeon.NewGLState) { - for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) { - /* mat states from state var not array for sw */ - dummy_attrib[i].stride = 0; - temp_attrib[i] = TNL_CONTEXT(ctx)->vb.AttribPtr[i]; - TNL_CONTEXT(ctx)->vb.AttribPtr[i] = &(dummy_attrib[i]); - } - - _tnl_UpdateFixedFunctionProgram(ctx); - - for (i = _TNL_FIRST_MAT; i <= _TNL_LAST_MAT; i++) { - TNL_CONTEXT(ctx)->vb.AttribPtr[i] = temp_attrib[i]; - } - } - - r700SelectVertexShader(ctx, 1); - r700UpdateStateParameters(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); - context->radeon.NewGLState = 0; -} - -void r700UpdateShaders2(GLcontext * ctx) -{ - context_t *context = R700_CONTEXT(ctx); - - /* should only happenen once, just after context is created */ - /* TODO: shouldn't we fallback to sw here? */ - if (!ctx->FragmentProgram._Current) { - _mesa_fprintf(stderr, "No ctx->FragmentProgram._Current!!\n"); - return; - } - - r700SelectFragmentShader(ctx); - - r700SelectVertexShader(ctx, 2); + r700SelectVertexShader(ctx); r700UpdateStateParameters(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); context->radeon.NewGLState = 0; } diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c index 65c2c3f811..c84b0ac059 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.c +++ b/src/mesa/drivers/dri/r600/r700_vertprog.c @@ -203,22 +203,11 @@ void Map_Vertex_Program(GLcontext *ctx, pAsm->number_used_registers += num_inputs; // Create VFETCH instructions for inputs - if(1 == vp->uiVersion) - { - if (GL_TRUE != Process_Vertex_Program_Vfetch_Instructions(vp, mesa_vp) ) - { - radeon_error("Calling Process_Vertex_Program_Vfetch_Instructions return error. \n"); - return; - } - } - else - { - if (GL_TRUE != Process_Vertex_Program_Vfetch_Instructions2(ctx, vp, mesa_vp) ) - { - radeon_error("Calling Process_Vertex_Program_Vfetch_Instructions2 return error. \n"); - return; - } - } + if (GL_TRUE != Process_Vertex_Program_Vfetch_Instructions2(ctx, vp, mesa_vp) ) + { + radeon_error("Calling Process_Vertex_Program_Vfetch_Instructions2 return error. \n"); + return; + } // Map Outputs pAsm->number_of_exports = Map_Vertex_Output(pAsm, mesa_vp, pAsm->number_used_registers); @@ -228,7 +217,7 @@ void Map_Vertex_Program(GLcontext *ctx, pAsm->number_used_registers += pAsm->number_of_exports; pAsm->pucOutMask = (unsigned char*) MALLOC(pAsm->number_of_exports); - + for(ui=0; uinumber_of_exports; ui++) { pAsm->pucOutMask[ui] = 0x0; @@ -245,7 +234,7 @@ void Map_Vertex_Program(GLcontext *ctx, { /* fix func t_vp uses NumTemporaries */ pAsm->number_used_registers += mesa_vp->Base.NumTemporaries; } - + pAsm->uFirstHelpReg = pAsm->number_used_registers; } @@ -300,18 +289,13 @@ GLboolean Find_Instruction_Dependencies_vp(struct r700_vertex_program *vp, } struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, - struct gl_vertex_program *mesa_vp, - GLint nVer) + struct gl_vertex_program *mesa_vp) { context_t *context = R700_CONTEXT(ctx); struct r700_vertex_program *vp; - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *vb = &tnl->vb; - unsigned int unBit; unsigned int i; vp = _mesa_calloc(sizeof(*vp)); - vp->uiVersion = nVer; vp->mesa_program = (struct gl_vertex_program *)_mesa_clone_program(ctx, &mesa_vp->Base); if (mesa_vp->IsPositionInvariant) @@ -319,29 +303,13 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, _mesa_insert_mvp_code(ctx, vp->mesa_program); } - if( 1 == nVer ) + for(i=0; inNumActiveAos; i++) { - for(i=0; imesa_program->Base.InputsRead & unBit) /* ctx->Array.ArrayObj->xxxxxxx */ - { - vp->aos_desc[i].size = vb->AttribPtr[i]->size; - vp->aos_desc[i].stride = vb->AttribPtr[i]->size * sizeof(GL_FLOAT);/* when emit array, data is packed. vb->AttribPtr[i]->stride;*/ - vp->aos_desc[i].type = GL_FLOAT; - } - } + vp->aos_desc[i].size = context->stream_desc[i].size; + vp->aos_desc[i].stride = context->stream_desc[i].stride; + vp->aos_desc[i].type = context->stream_desc[i].type; } - else - { - for(i=0; inNumActiveAos; i++) - { - vp->aos_desc[i].size = context->stream_desc[i].size; - vp->aos_desc[i].stride = context->stream_desc[i].stride; - vp->aos_desc[i].type = context->stream_desc[i].type; - } - } - + if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) { vp->r700AsmCode.bR6xx = 1; @@ -354,14 +322,14 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, if(GL_FALSE == Find_Instruction_Dependencies_vp(vp, vp->mesa_program)) { return NULL; - } + } if(GL_FALSE == AssembleInstr(vp->mesa_program->Base.NumInstructions, - &(vp->mesa_program->Base.Instructions[0]), + &(vp->mesa_program->Base.Instructions[0]), &(vp->r700AsmCode)) ) { return NULL; - } + } if(GL_FALSE == Process_Vertex_Exports(&(vp->r700AsmCode), vp->mesa_program->Base.OutputsWritten) ) { @@ -378,14 +346,11 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, return vp; } -void r700SelectVertexShader(GLcontext *ctx, GLint nVersion) +void r700SelectVertexShader(GLcontext *ctx) { context_t *context = R700_CONTEXT(ctx); struct r700_vertex_program_cont *vpc; struct r700_vertex_program *vp; - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *vb = &tnl->vb; - unsigned int unBit; unsigned int i; GLboolean match; GLbitfield InputsRead; @@ -396,47 +361,27 @@ void r700SelectVertexShader(GLcontext *ctx, GLint nVersion) if (vpc->mesa_program.IsPositionInvariant) { InputsRead |= VERT_BIT_POS; - } - + } + for (vp = vpc->progs; vp; vp = vp->next) { - if (vp->uiVersion != nVersion ) - continue; - match = GL_TRUE; - if ( 1 == nVersion ) + match = GL_TRUE; + for(i=0; inNumActiveAos; i++) { - for(i=0; iaos_desc[i].size != context->stream_desc[i].size) { - if (vp->aos_desc[i].size != vb->AttribPtr[i]->size) - { match = GL_FALSE; break; - } } - } } - else - { - for(i=0; inNumActiveAos; i++) - { - if (vp->aos_desc[i].size != context->stream_desc[i].size) - { - match = GL_FALSE; - break; - } - } - } - if (match) + if (match) { context->selected_vp = vp; return; } } - vp = r700TranslateVertexShader(ctx, &(vpc->mesa_program), nVersion); + vp = r700TranslateVertexShader(ctx, &(vpc->mesa_program)); if(!vp) { radeon_error("Failed to translate vertex shader. \n"); diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.h b/src/mesa/drivers/dri/r600/r700_vertprog.h index f9a3e395ee..00824c29d3 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.h +++ b/src/mesa/drivers/dri/r600/r700_vertprog.h @@ -52,8 +52,7 @@ struct r700_vertex_program GLboolean translated; GLboolean loaded; - GLint uiVersion; - + void * shaderbo; ArrayDesc aos_desc[VERT_ATTRIB_MAX]; @@ -87,11 +86,10 @@ GLboolean Find_Instruction_Dependencies_vp(struct r700_vertex_program *vp, struct gl_vertex_program *mesa_vp); struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, - struct gl_vertex_program *mesa_vp, - GLint nVer); + struct gl_vertex_program *mesa_vp); /* Interface */ -extern void r700SelectVertexShader(GLcontext *ctx, GLint nVersion); +extern void r700SelectVertexShader(GLcontext *ctx); extern void r700SetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], int count); extern GLboolean r700SetupVertexProgram(GLcontext * ctx); -- cgit v1.2.3 From 0072a26662994653e07b0bb14cb1f12817540566 Mon Sep 17 00:00:00 2001 From: Cooper Yuan Date: Fri, 23 Oct 2009 14:44:27 +0800 Subject: g3dvl: pass display and screen to g3dvl when creating video private context --- src/gallium/state_trackers/xorg/xvmc/context.c | 2 +- src/gallium/winsys/g3dvl/vl_winsys.h | 3 ++- src/gallium/winsys/g3dvl/xlib/xsp_winsys.c | 7 ++++--- 3 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xvmc/context.c b/src/gallium/state_trackers/xorg/xvmc/context.c index 942692d1bb..c8a389385a 100644 --- a/src/gallium/state_trackers/xorg/xvmc/context.c +++ b/src/gallium/state_trackers/xorg/xvmc/context.c @@ -195,7 +195,7 @@ Status XvMCCreateContext(Display *dpy, XvPortID port, int surface_type_id, return BadAlloc; } - vpipe = vl_video_create(screen, ProfileToPipe(mc_type), + vpipe = vl_video_create(dpy, scrn, screen, ProfileToPipe(mc_type), FormatToPipe(chroma_format), width, height); if (!vpipe) { diff --git a/src/gallium/winsys/g3dvl/vl_winsys.h b/src/gallium/winsys/g3dvl/vl_winsys.h index 22119f9559..b4fa0d67a1 100644 --- a/src/gallium/winsys/g3dvl/vl_winsys.h +++ b/src/gallium/winsys/g3dvl/vl_winsys.h @@ -39,7 +39,8 @@ struct pipe_screen* vl_screen_create(Display *display, int screen); struct pipe_video_context* -vl_video_create(struct pipe_screen *screen, +vl_video_create(Display *display, int screen, + struct pipe_screen *p_screen, enum pipe_video_profile profile, enum pipe_video_chroma_format chroma_format, unsigned width, unsigned height); diff --git a/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c b/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c index 0e5f5a587b..08067aad64 100644 --- a/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c +++ b/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c @@ -300,7 +300,8 @@ vl_screen_create(Display *display, int screen) } struct pipe_video_context* -vl_video_create(struct pipe_screen *screen, +vl_video_create(Display *display, int screen, + struct pipe_screen *p_screen, enum pipe_video_profile profile, enum pipe_video_chroma_format chroma_format, unsigned width, unsigned height) @@ -308,10 +309,10 @@ vl_video_create(struct pipe_screen *screen, struct pipe_video_context *vpipe; struct xsp_context *xsp_context; - assert(screen); + assert(p_screen); assert(width && height); - vpipe = sp_video_create(screen, profile, chroma_format, width, height); + vpipe = sp_video_create(p_screen, profile, chroma_format, width, height); if (!vpipe) return NULL; -- cgit v1.2.3 From 6df12aad2fcdc30b200142a86c762b5e60e4b05e Mon Sep 17 00:00:00 2001 From: Cooper Yuan Date: Fri, 23 Oct 2009 14:46:29 +0800 Subject: r300g: add flush_frontbuffer function to display video surface --- src/gallium/winsys/drm/radeon/core/radeon_buffer.c | 52 +++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c index 7bf23cba23..beb1d6d430 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c @@ -33,6 +33,14 @@ #include "radeon_buffer.h" #include "radeon_bo_gem.h" +#include "softpipe/sp_texture.h" +#include +struct radeon_vl_context +{ + Display *display; + int screen; + Drawable drawable; +}; static const char *radeon_get_name(struct pipe_winsys *ws) { @@ -183,11 +191,53 @@ static int radeon_fence_finish(struct pipe_winsys *ws, return 0; } +static void radeon_display_surface(struct pipe_winsys *pws, + struct pipe_surface *psurf, + struct radeon_vl_context *rvl_ctx) +{ + struct r300_texture *r300tex = (struct r300_texture *)(psurf->texture); + XImage *ximage; + void *data; + + ximage = XCreateImage(rvl_ctx->display, + XDefaultVisual(rvl_ctx->display, rvl_ctx->screen), + XDefaultDepth(rvl_ctx->display, rvl_ctx->screen), + ZPixmap, 0, /* format, offset */ + NULL, /* data */ + 0, 0, /* size */ + 32, /* bitmap_pad */ + 0); /* bytes_per_line */ + + assert(ximage->format); + assert(ximage->bitmap_unit); + + data = pws->buffer_map(pws, r300tex->buffer, 0); + + /* update XImage's fields */ + ximage->data = data; + ximage->width = psurf->width; + ximage->height = psurf->height; + ximage->bytes_per_line = r300tex->stride_override; + + XPutImage(rvl_ctx->display, rvl_ctx->drawable, + XDefaultGC(rvl_ctx->display, rvl_ctx->screen), + ximage, 0, 0, 0, 0, psurf->width, psurf->height); + + XSync(rvl_ctx->display, 0); + + ximage->data = NULL; + XDestroyImage(ximage); + + pws->buffer_unmap(pws, r300tex->buffer); +} + static void radeon_flush_frontbuffer(struct pipe_winsys *pipe_winsys, struct pipe_surface *pipe_surface, void *context_private) { - /* XXX TODO: call dri2CopyRegion */ + struct radeon_vl_context *rvl_ctx; + rvl_ctx = (struct radeon_vl_context *) context_private; + radeon_display_surface(pipe_winsys, pipe_surface, rvl_ctx); } struct radeon_winsys* radeon_pipe_winsys(int fd) -- cgit v1.2.3 From 9b6c86b8be092b40f8a84506bc929ee939937a16 Mon Sep 17 00:00:00 2001 From: Cooper Yuan Date: Fri, 23 Oct 2009 16:40:31 +0800 Subject: r300g: last changes's typo, miss a include file --- src/gallium/winsys/drm/radeon/core/radeon_buffer.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c index beb1d6d430..0a7b5ecb09 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c @@ -34,6 +34,7 @@ #include "radeon_bo_gem.h" #include "softpipe/sp_texture.h" +#include "r300_context.h" #include struct radeon_vl_context { -- cgit v1.2.3 From 4e1d51786e0657c7430d731ac464f2a73e32eddf Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 23 Oct 2009 13:49:04 +0100 Subject: gallium: remove noise opcodes Provide a dummy implementation in the GL state tracker (move 0.5 to the destination regs). At some point, a motivated person could add a better implementation of noise. Currently not even the nvidia binary drivers do anything more than this. In any case, the place to do this is in the GL state tracker, not the poor driver. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 16 ---------------- src/gallium/auxiliary/tgsi/tgsi_info.c | 8 ++++---- src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h | 4 ---- src/gallium/drivers/cell/spu/spu_exec.c | 16 ---------------- src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c | 9 --------- src/gallium/drivers/nv30/nv30_fragprog.c | 6 ------ src/gallium/drivers/nv40/nv40_fragprog.c | 6 ------ src/gallium/drivers/r300/r300_tgsi_to_rc.c | 4 ---- src/gallium/include/pipe/p_shader_tokens.h | 5 +---- src/mesa/state_tracker/st_mesa_to_tgsi.c | 23 +++++++++++++++-------- 10 files changed, 20 insertions(+), 77 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index c79c56debd..d9661c75a0 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -3223,22 +3223,6 @@ exec_instruction( /* no-op */ break; - case TGSI_OPCODE_NOISE1: - assert( 0 ); - break; - - case TGSI_OPCODE_NOISE2: - assert( 0 ); - break; - - case TGSI_OPCODE_NOISE3: - assert( 0 ); - break; - - case TGSI_OPCODE_NOISE4: - assert( 0 ); - break; - case TGSI_OPCODE_NOP: break; diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c index 17af4cb7ad..fe8b0bdce3 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.c +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c @@ -134,10 +134,10 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 0, 0, 0, 0, 0, 1, "BGNSUB", TGSI_OPCODE_BGNSUB }, { 0, 0, 0, 1, 1, 0, "ENDLOOP", TGSI_OPCODE_ENDLOOP }, { 0, 0, 0, 0, 1, 0, "ENDSUB", TGSI_OPCODE_ENDSUB }, - { 1, 1, 0, 0, 0, 0, "NOISE1", TGSI_OPCODE_NOISE1 }, - { 1, 1, 0, 0, 0, 0, "NOISE2", TGSI_OPCODE_NOISE2 }, - { 1, 1, 0, 0, 0, 0, "NOISE3", TGSI_OPCODE_NOISE3 }, - { 1, 1, 0, 0, 0, 0, "NOISE4", TGSI_OPCODE_NOISE4 }, + { 0, 0, 0, 0, 0, 0, "", 103 }, /* removed */ + { 0, 0, 0, 0, 0, 0, "", 104 }, /* removed */ + { 0, 0, 0, 0, 0, 0, "", 105 }, /* removed */ + { 0, 0, 0, 0, 0, 0, "", 106 }, /* removed */ { 0, 0, 0, 0, 0, 0, "NOP", TGSI_OPCODE_NOP }, { 0, 0, 0, 0, 0, 0, "", 108 }, /* removed */ { 0, 0, 0, 0, 0, 0, "", 109 }, /* removed */ diff --git a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h index e7bcf4bf75..d321f013d0 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h +++ b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h @@ -139,10 +139,6 @@ OP00_LBL(BGNLOOP) OP00(BGNSUB) OP00_LBL(ENDLOOP) OP00(ENDSUB) -OP11(NOISE1) -OP11(NOISE2) -OP11(NOISE3) -OP11(NOISE4) OP00(NOP) OP11(NRM4) OP01(CALLNZ) diff --git a/src/gallium/drivers/cell/spu/spu_exec.c b/src/gallium/drivers/cell/spu/spu_exec.c index 0eaae2e451..725a72b326 100644 --- a/src/gallium/drivers/cell/spu/spu_exec.c +++ b/src/gallium/drivers/cell/spu/spu_exec.c @@ -1807,22 +1807,6 @@ exec_instruction( /* no-op */ break; - case TGSI_OPCODE_NOISE1: - ASSERT( 0 ); - break; - - case TGSI_OPCODE_NOISE2: - ASSERT( 0 ); - break; - - case TGSI_OPCODE_NOISE3: - ASSERT( 0 ); - break; - - case TGSI_OPCODE_NOISE4: - ASSERT( 0 ); - break; - case TGSI_OPCODE_NOP: break; diff --git a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c index adc81569ed..926cc1cc9f 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c @@ -1386,15 +1386,6 @@ emit_instruction( return 0; break; - case TGSI_OPCODE_NOISE1: - case TGSI_OPCODE_NOISE2: - case TGSI_OPCODE_NOISE3: - case TGSI_OPCODE_NOISE4: - FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { - dst0[chan_index] = bld->base.zero; - } - break; - case TGSI_OPCODE_NOP: break; diff --git a/src/gallium/drivers/nv30/nv30_fragprog.c b/src/gallium/drivers/nv30/nv30_fragprog.c index a48ba9782b..62c6c76cee 100644 --- a/src/gallium/drivers/nv30/nv30_fragprog.c +++ b/src/gallium/drivers/nv30/nv30_fragprog.c @@ -527,12 +527,6 @@ nv30_fragprog_parse_instruction(struct nv30_fpc *fpc, case TGSI_OPCODE_MUL: arith(fpc, sat, MUL, dst, mask, src[0], src[1], none); break; - case TGSI_OPCODE_NOISE1: - case TGSI_OPCODE_NOISE2: - case TGSI_OPCODE_NOISE3: - case TGSI_OPCODE_NOISE4: - arith(fpc, sat, SFL, dst, mask, none, none, none); - break; case TGSI_OPCODE_POW: arith(fpc, sat, POW, dst, mask, src[0], src[1], none); break; diff --git a/src/gallium/drivers/nv40/nv40_fragprog.c b/src/gallium/drivers/nv40/nv40_fragprog.c index 32d9ed1a7f..e3550baa63 100644 --- a/src/gallium/drivers/nv40/nv40_fragprog.c +++ b/src/gallium/drivers/nv40/nv40_fragprog.c @@ -568,12 +568,6 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc, case TGSI_OPCODE_MUL: arith(fpc, sat, MUL, dst, mask, src[0], src[1], none); break; - case TGSI_OPCODE_NOISE1: - case TGSI_OPCODE_NOISE2: - case TGSI_OPCODE_NOISE3: - case TGSI_OPCODE_NOISE4: - arith(fpc, sat, SFL, dst, mask, none, none, none); - break; case TGSI_OPCODE_POW: tmp = temp(fpc); arith(fpc, 0, LG2, tmp, MASK_X, diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/src/gallium/drivers/r300/r300_tgsi_to_rc.c index 74d4fb5087..3d2f6cafee 100644 --- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c +++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c @@ -135,10 +135,6 @@ static unsigned translate_opcode(unsigned opcode) /* case TGSI_OPCODE_BGNSUB: return RC_OPCODE_BGNSUB; */ /* case TGSI_OPCODE_ENDLOOP2: return RC_OPCODE_ENDLOOP2; */ /* case TGSI_OPCODE_ENDSUB: return RC_OPCODE_ENDSUB; */ - /* case TGSI_OPCODE_NOISE1: return RC_OPCODE_NOISE1; */ - /* case TGSI_OPCODE_NOISE2: return RC_OPCODE_NOISE2; */ - /* case TGSI_OPCODE_NOISE3: return RC_OPCODE_NOISE3; */ - /* case TGSI_OPCODE_NOISE4: return RC_OPCODE_NOISE4; */ case TGSI_OPCODE_NOP: return RC_OPCODE_NOP; /* gap */ /* case TGSI_OPCODE_NRM4: return RC_OPCODE_NRM4; */ diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index 5fa6c9af30..48e6583ada 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -266,10 +266,7 @@ union tgsi_immediate_data #define TGSI_OPCODE_BGNSUB 100 #define TGSI_OPCODE_ENDLOOP 101 #define TGSI_OPCODE_ENDSUB 102 -#define TGSI_OPCODE_NOISE1 103 -#define TGSI_OPCODE_NOISE2 104 -#define TGSI_OPCODE_NOISE3 105 -#define TGSI_OPCODE_NOISE4 106 + /* gap */ #define TGSI_OPCODE_NOP 107 /* gap */ #define TGSI_OPCODE_NRM4 112 diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 70d7c4fee2..1b9d35d353 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -481,14 +481,6 @@ translate_opcode( unsigned op ) return TGSI_OPCODE_MOV; case OPCODE_MUL: return TGSI_OPCODE_MUL; - case OPCODE_NOISE1: - return TGSI_OPCODE_NOISE1; - case OPCODE_NOISE2: - return TGSI_OPCODE_NOISE2; - case OPCODE_NOISE3: - return TGSI_OPCODE_NOISE3; - case OPCODE_NOISE4: - return TGSI_OPCODE_NOISE4; case OPCODE_NOP: return TGSI_OPCODE_NOP; case OPCODE_NRM3: @@ -616,6 +608,21 @@ compile_instruction( src, num_src ); break; + case OPCODE_NOISE1: + case OPCODE_NOISE2: + case OPCODE_NOISE3: + case OPCODE_NOISE4: + /* At some point, a motivated person could add a better + * implementation of noise. Currently not even the nvidia + * binary drivers do anything more than this. In any case, the + * place to do this is in the GL state tracker, not the poor + * driver. + */ + ureg_MOV( ureg, dst[0], ureg_imm1f(ureg, 0.5) ); + break; + + + default: ureg_insn( ureg, translate_opcode( inst->Opcode ), -- cgit v1.2.3 From b9cb74c7f826dfd320f5e5b54aa933898f7ddd3d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 23 Oct 2009 14:31:24 +0100 Subject: gallium: remove the swizzling parts of ExtSwizzle These haven't been used by the mesa state tracker since the conversion to tgsi_ureg, and it seems that none of the other state trackers are using it either. This helps simplify one of the biggest suprises when starting off with TGSI shaders. --- src/gallium/auxiliary/draw/draw_vs_aos.c | 30 ++--------- src/gallium/auxiliary/tgsi/tgsi_build.c | 27 +--------- src/gallium/auxiliary/tgsi/tgsi_build.h | 4 -- src/gallium/auxiliary/tgsi/tgsi_dump.c | 27 ---------- src/gallium/auxiliary/tgsi/tgsi_dump_c.c | 26 --------- src/gallium/auxiliary/tgsi/tgsi_exec.c | 34 ++++-------- src/gallium/auxiliary/tgsi/tgsi_info.c | 2 +- src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h | 1 - src/gallium/auxiliary/tgsi/tgsi_ppc.c | 26 +++------ src/gallium/auxiliary/tgsi/tgsi_scan.c | 5 -- src/gallium/auxiliary/tgsi/tgsi_sse2.c | 34 +++--------- src/gallium/auxiliary/tgsi/tgsi_text.c | 28 ++-------- src/gallium/auxiliary/tgsi/tgsi_util.c | 74 ++------------------------ src/gallium/auxiliary/tgsi/tgsi_util.h | 12 +---- src/gallium/drivers/cell/ppu/cell_gen_fp.c | 18 ++----- src/gallium/drivers/cell/spu/spu_exec.c | 27 +++------- src/gallium/drivers/cell/spu/spu_util.c | 48 +---------------- src/gallium/drivers/i915/i915_fpc_translate.c | 20 ++----- src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c | 26 +++------ src/gallium/drivers/nv30/nv30_fragprog.c | 24 ++------- src/gallium/drivers/nv40/nv40_fragprog.c | 18 ++----- src/gallium/drivers/nv40/nv40_vertprog.c | 18 ++----- src/gallium/drivers/nv50/nv50_program.c | 28 +++------- src/gallium/drivers/r300/r300_tgsi_to_rc.c | 9 ++-- src/gallium/include/pipe/p_shader_tokens.h | 17 +----- src/mesa/state_tracker/st_mesa_to_tgsi.c | 2 - 26 files changed, 96 insertions(+), 489 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_vs_aos.c b/src/gallium/auxiliary/draw/draw_vs_aos.c index 645d7cccba..88bc790b62 100644 --- a/src/gallium/auxiliary/draw/draw_vs_aos.c +++ b/src/gallium/auxiliary/draw/draw_vs_aos.c @@ -537,19 +537,10 @@ static struct x86_reg fetch_src( struct aos_compilation *cp, unsigned abs = 0; for (i = 0; i < 4; i++) { - unsigned swizzle = tgsi_util_get_full_src_register_extswizzle( src, i ); + unsigned swizzle = tgsi_util_get_full_src_register_swizzle( src, i ); unsigned neg = tgsi_util_get_full_src_register_sign_mode( src, i ); - switch (swizzle) { - case TGSI_EXTSWIZZLE_ZERO: - case TGSI_EXTSWIZZLE_ONE: - AOS_ERROR(cp, "not supporting full swizzles yet in tgsi_aos_sse2"); - break; - - default: - swz |= (swizzle & 0x3) << (i * 2); - break; - } + swz |= (swizzle & 0x3) << (i * 2); switch (neg) { case TGSI_UTIL_SIGN_TOGGLE: @@ -632,23 +623,10 @@ static void x87_fld_src( struct aos_compilation *cp, src->SrcRegister.File, src->SrcRegister.Index); - unsigned swizzle = tgsi_util_get_full_src_register_extswizzle( src, channel ); + unsigned swizzle = tgsi_util_get_full_src_register_swizzle( src, channel ); unsigned neg = tgsi_util_get_full_src_register_sign_mode( src, channel ); - switch (swizzle) { - case TGSI_EXTSWIZZLE_ZERO: - x87_fldz( cp->func ); - break; - - case TGSI_EXTSWIZZLE_ONE: - x87_fld1( cp->func ); - break; - - default: - x87_fld( cp->func, x86_make_disp(arg0, (swizzle & 3) * sizeof(float)) ); - break; - } - + x87_fld( cp->func, x86_make_disp(arg0, (swizzle & 3) * sizeof(float)) ); switch (neg) { case TGSI_UTIL_SIGN_TOGGLE: diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index e0cfc54420..98d36f43e4 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -692,12 +692,8 @@ tgsi_build_full_instruction( tgsi_default_src_register_ext_swz() ) ) { struct tgsi_src_register_ext_swz *src_register_ext_swz; - /* Use of the extended swizzle requires the simple swizzle to be identity. + /* Use of the extended negate requires the simple negate to be identity. */ - assert( reg->SrcRegister.SwizzleX == TGSI_SWIZZLE_X ); - assert( reg->SrcRegister.SwizzleY == TGSI_SWIZZLE_Y ); - assert( reg->SrcRegister.SwizzleZ == TGSI_SWIZZLE_Z ); - assert( reg->SrcRegister.SwizzleW == TGSI_SWIZZLE_W ); assert( reg->SrcRegister.Negate == FALSE ); if( maxsize <= size ) @@ -707,10 +703,6 @@ tgsi_build_full_instruction( size++; *src_register_ext_swz = tgsi_build_src_register_ext_swz( - reg->SrcRegisterExtSwz.ExtSwizzleX, - reg->SrcRegisterExtSwz.ExtSwizzleY, - reg->SrcRegisterExtSwz.ExtSwizzleZ, - reg->SrcRegisterExtSwz.ExtSwizzleW, reg->SrcRegisterExtSwz.NegateX, reg->SrcRegisterExtSwz.NegateY, reg->SrcRegisterExtSwz.NegateZ, @@ -1048,10 +1040,7 @@ tgsi_default_src_register_ext_swz( void ) struct tgsi_src_register_ext_swz src_register_ext_swz; src_register_ext_swz.Type = TGSI_SRC_REGISTER_EXT_TYPE_SWZ; - src_register_ext_swz.ExtSwizzleX = TGSI_EXTSWIZZLE_X; - src_register_ext_swz.ExtSwizzleY = TGSI_EXTSWIZZLE_Y; - src_register_ext_swz.ExtSwizzleZ = TGSI_EXTSWIZZLE_Z; - src_register_ext_swz.ExtSwizzleW = TGSI_EXTSWIZZLE_W; + src_register_ext_swz.Padding0 = 0; src_register_ext_swz.NegateX = 0; src_register_ext_swz.NegateY = 0; src_register_ext_swz.NegateZ = 0; @@ -1074,10 +1063,6 @@ tgsi_compare_src_register_ext_swz( struct tgsi_src_register_ext_swz tgsi_build_src_register_ext_swz( - unsigned ext_swizzle_x, - unsigned ext_swizzle_y, - unsigned ext_swizzle_z, - unsigned ext_swizzle_w, unsigned negate_x, unsigned negate_y, unsigned negate_z, @@ -1088,20 +1073,12 @@ tgsi_build_src_register_ext_swz( { struct tgsi_src_register_ext_swz src_register_ext_swz; - assert( ext_swizzle_x <= TGSI_EXTSWIZZLE_ONE ); - assert( ext_swizzle_y <= TGSI_EXTSWIZZLE_ONE ); - assert( ext_swizzle_z <= TGSI_EXTSWIZZLE_ONE ); - assert( ext_swizzle_w <= TGSI_EXTSWIZZLE_ONE ); assert( negate_x <= 1 ); assert( negate_y <= 1 ); assert( negate_z <= 1 ); assert( negate_w <= 1 ); src_register_ext_swz = tgsi_default_src_register_ext_swz(); - src_register_ext_swz.ExtSwizzleX = ext_swizzle_x; - src_register_ext_swz.ExtSwizzleY = ext_swizzle_y; - src_register_ext_swz.ExtSwizzleZ = ext_swizzle_z; - src_register_ext_swz.ExtSwizzleW = ext_swizzle_w; src_register_ext_swz.NegateX = negate_x; src_register_ext_swz.NegateY = negate_y; src_register_ext_swz.NegateZ = negate_z; diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.h b/src/gallium/auxiliary/tgsi/tgsi_build.h index 17d977b059..5e0062a96f 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.h +++ b/src/gallium/auxiliary/tgsi/tgsi_build.h @@ -241,10 +241,6 @@ tgsi_compare_src_register_ext_swz( struct tgsi_src_register_ext_swz tgsi_build_src_register_ext_swz( - unsigned ext_swizzle_x, - unsigned ext_swizzle_y, - unsigned ext_swizzle_z, - unsigned ext_swizzle_w, unsigned negate_x, unsigned negate_y, unsigned negate_z, diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index 111d95b666..3a584a10a1 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -148,15 +148,6 @@ static const char *texture_names[] = "SHADOWRECT" }; -static const char *extswizzle_names[] = -{ - "x", - "y", - "z", - "w", - "0", - "1" -}; static const char *modulate_names[TGSI_MODULATE_COUNT] = { @@ -446,24 +437,6 @@ iter_instruction( ENM( src->SrcRegister.SwizzleZ, swizzle_names ); ENM( src->SrcRegister.SwizzleW, swizzle_names ); } - if (src->SrcRegisterExtSwz.ExtSwizzleX != TGSI_EXTSWIZZLE_X || - src->SrcRegisterExtSwz.ExtSwizzleY != TGSI_EXTSWIZZLE_Y || - src->SrcRegisterExtSwz.ExtSwizzleZ != TGSI_EXTSWIZZLE_Z || - src->SrcRegisterExtSwz.ExtSwizzleW != TGSI_EXTSWIZZLE_W) { - CHR( '.' ); - if (src->SrcRegisterExtSwz.NegateX) - TXT("-"); - ENM( src->SrcRegisterExtSwz.ExtSwizzleX, extswizzle_names ); - if (src->SrcRegisterExtSwz.NegateY) - TXT("-"); - ENM( src->SrcRegisterExtSwz.ExtSwizzleY, extswizzle_names ); - if (src->SrcRegisterExtSwz.NegateZ) - TXT("-"); - ENM( src->SrcRegisterExtSwz.ExtSwizzleZ, extswizzle_names ); - if (src->SrcRegisterExtSwz.NegateW) - TXT("-"); - ENM( src->SrcRegisterExtSwz.ExtSwizzleW, extswizzle_names ); - } if (src->SrcRegisterExtMod.Complement) CHR( ')' ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c index 4a9c02b141..4f59ed22b5 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c @@ -167,16 +167,6 @@ static const char *TGSI_SRC_REGISTER_EXTS[] = "SRC_REGISTER_EXT_TYPE_MOD" }; -static const char *TGSI_EXTSWIZZLES[] = -{ - "EXTSWIZZLE_X", - "EXTSWIZZLE_Y", - "EXTSWIZZLE_Z", - "EXTSWIZZLE_W", - "EXTSWIZZLE_ZERO", - "EXTSWIZZLE_ONE" -}; - static const char *TGSI_WRITEMASKS[] = { "0", @@ -560,22 +550,6 @@ dump_instruction_verbose( EOL(); TXT( "\nType : " ); ENM( src->SrcRegisterExtSwz.Type, TGSI_SRC_REGISTER_EXTS ); - if( deflt || fs->SrcRegisterExtSwz.ExtSwizzleX != src->SrcRegisterExtSwz.ExtSwizzleX ) { - TXT( "\nExtSwizzleX: " ); - ENM( src->SrcRegisterExtSwz.ExtSwizzleX, TGSI_EXTSWIZZLES ); - } - if( deflt || fs->SrcRegisterExtSwz.ExtSwizzleY != src->SrcRegisterExtSwz.ExtSwizzleY ) { - TXT( "\nExtSwizzleY: " ); - ENM( src->SrcRegisterExtSwz.ExtSwizzleY, TGSI_EXTSWIZZLES ); - } - if( deflt || fs->SrcRegisterExtSwz.ExtSwizzleZ != src->SrcRegisterExtSwz.ExtSwizzleZ ) { - TXT( "\nExtSwizzleZ: " ); - ENM( src->SrcRegisterExtSwz.ExtSwizzleZ, TGSI_EXTSWIZZLES ); - } - if( deflt || fs->SrcRegisterExtSwz.ExtSwizzleW != src->SrcRegisterExtSwz.ExtSwizzleW ) { - TXT( "\nExtSwizzleW: " ); - ENM( src->SrcRegisterExtSwz.ExtSwizzleW, TGSI_EXTSWIZZLES ); - } if( deflt || fs->SrcRegisterExtSwz.NegateX != src->SrcRegisterExtSwz.NegateX ) { TXT( "\nNegateX : " ); UID( src->SrcRegisterExtSwz.NegateX ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index d9661c75a0..14f0fc4e38 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -210,9 +210,8 @@ tgsi_check_soa_dependencies(const struct tgsi_full_instruction *inst) uint channelsWritten = 0x0; FOR_EACH_ENABLED_CHANNEL(*inst, chan) { /* check if we're reading a channel that's been written */ - uint swizzle = tgsi_util_get_full_src_register_extswizzle(&inst->FullSrcRegisters[i], chan); - if (swizzle <= TGSI_SWIZZLE_W && - (channelsWritten & (1 << swizzle))) { + uint swizzle = tgsi_util_get_full_src_register_swizzle(&inst->FullSrcRegisters[i], chan); + if (channelsWritten & (1 << swizzle)) { return TRUE; } @@ -338,7 +337,7 @@ tgsi_exec_machine_bind_shader( /* XXX we only handle SOA dependencies properly for MOV/SWZ * at this time! */ - if (opcode != TGSI_OPCODE_MOV && opcode != TGSI_OPCODE_SWZ) { + if (opcode != TGSI_OPCODE_MOV) { debug_printf("Warning: SOA dependency in instruction" " is not handled:\n"); tgsi_dump_instruction(&parse.FullToken.FullInstruction, @@ -1130,10 +1129,10 @@ fetch_src_file_channel( union tgsi_exec_channel *chan ) { switch( swizzle ) { - case TGSI_EXTSWIZZLE_X: - case TGSI_EXTSWIZZLE_Y: - case TGSI_EXTSWIZZLE_Z: - case TGSI_EXTSWIZZLE_W: + case TGSI_SWIZZLE_X: + case TGSI_SWIZZLE_Y: + case TGSI_SWIZZLE_Z: + case TGSI_SWIZZLE_W: switch( file ) { case TGSI_FILE_CONSTANT: assert(mach->Consts); @@ -1201,14 +1200,6 @@ fetch_src_file_channel( } break; - case TGSI_EXTSWIZZLE_ZERO: - *chan = mach->Temps[TEMP_0_I].xyzw[TEMP_0_C]; - break; - - case TGSI_EXTSWIZZLE_ONE: - *chan = mach->Temps[TEMP_1_I].xyzw[TEMP_1_C]; - break; - default: assert( 0 ); } @@ -1367,7 +1358,7 @@ fetch_source( */ } - swizzle = tgsi_util_get_full_src_register_extswizzle( reg, chan_index ); + swizzle = tgsi_util_get_full_src_register_swizzle( reg, chan_index ); fetch_src_file_channel( mach, reg->SrcRegister.File, @@ -1689,10 +1680,8 @@ exec_kil(struct tgsi_exec_machine *mach, uint kilmask = 0; /* bit 0 = pixel 0, bit 1 = pixel 1, etc */ union tgsi_exec_channel r[1]; - /* This mask stores component bits that were already tested. Note that - * we test if the value is less than zero, so 1.0 and 0.0 need not to be - * tested. */ - uniquemask = (1 << TGSI_EXTSWIZZLE_ZERO) | (1 << TGSI_EXTSWIZZLE_ONE); + /* This mask stores component bits that were already tested. */ + uniquemask = 0; for (chan_index = 0; chan_index < 4; chan_index++) { @@ -1700,7 +1689,7 @@ exec_kil(struct tgsi_exec_machine *mach, uint i; /* unswizzle channel */ - swizzle = tgsi_util_get_full_src_register_extswizzle ( + swizzle = tgsi_util_get_full_src_register_swizzle ( &inst->FullSrcRegisters[0], chan_index); @@ -2031,7 +2020,6 @@ exec_instruction( break; case TGSI_OPCODE_MOV: - case TGSI_OPCODE_SWZ: if (inst->Flags & SOA_DEPENDENCY_FLAG) { /* Do all fetches into temp regs, then do all stores to avoid * intermediate/accidental clobbering. This could be done all the diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c index fe8b0bdce3..be375cabb8 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_info.c +++ b/src/gallium/auxiliary/tgsi/tgsi_info.c @@ -149,7 +149,7 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] = { 0, 1, 0, 0, 0, 0, "BREAKC", TGSI_OPCODE_BREAKC }, { 0, 1, 0, 0, 0, 0, "KIL", TGSI_OPCODE_KIL }, { 0, 0, 0, 0, 0, 0, "END", TGSI_OPCODE_END }, - { 1, 1, 0, 0, 0, 0, "SWZ", TGSI_OPCODE_SWZ } + { 0, 0, 0, 0, 0, 0, "", 118 } /* removed */ }; const struct tgsi_opcode_info * diff --git a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h index d321f013d0..b34263da48 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h +++ b/src/gallium/auxiliary/tgsi/tgsi_opcode_tmp.h @@ -146,7 +146,6 @@ OP01(IFC) OP01(BREAKC) OP01(KIL) OP00(END) -OP11(SWZ) #undef OP00 diff --git a/src/gallium/auxiliary/tgsi/tgsi_ppc.c b/src/gallium/auxiliary/tgsi/tgsi_ppc.c index 4b1c7d4e01..617fd7f6be 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ppc.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ppc.c @@ -283,14 +283,14 @@ emit_fetch(struct gen_context *gen, const struct tgsi_full_src_register *reg, const unsigned chan_index) { - uint swizzle = tgsi_util_get_full_src_register_extswizzle(reg, chan_index); + uint swizzle = tgsi_util_get_full_src_register_swizzle(reg, chan_index); int dst_vec = -1; switch (swizzle) { - case TGSI_EXTSWIZZLE_X: - case TGSI_EXTSWIZZLE_Y: - case TGSI_EXTSWIZZLE_Z: - case TGSI_EXTSWIZZLE_W: + case TGSI_SWIZZLE_X: + case TGSI_SWIZZLE_Y: + case TGSI_SWIZZLE_Z: + case TGSI_SWIZZLE_W: switch (reg->SrcRegister.File) { case TGSI_FILE_INPUT: { @@ -349,16 +349,6 @@ emit_fetch(struct gen_context *gen, assert( 0 ); } break; - case TGSI_EXTSWIZZLE_ZERO: - ppc_vzero(gen->f, dst_vec); - break; - case TGSI_EXTSWIZZLE_ONE: - { - int one_vec = gen_one_vec(gen); - dst_vec = ppc_allocate_vec_register(gen->f); - ppc_vmove(gen->f, dst_vec, one_vec); - } - break; default: assert( 0 ); } @@ -418,8 +408,8 @@ equal_src_locs(const struct tgsi_full_src_register *a, uint chan_a, return FALSE; if (a->SrcRegister.Index != b->SrcRegister.Index) return FALSE; - swz_a = tgsi_util_get_full_src_register_extswizzle(a, chan_a); - swz_b = tgsi_util_get_full_src_register_extswizzle(b, chan_b); + swz_a = tgsi_util_get_full_src_register_swizzle(a, chan_a); + swz_b = tgsi_util_get_full_src_register_swizzle(b, chan_b); if (swz_a != swz_b) return FALSE; sign_a = tgsi_util_get_full_src_register_sign_mode(a, chan_a); @@ -635,7 +625,6 @@ emit_unaryop(struct gen_context *gen, struct tgsi_full_instruction *inst) ppc_vlogefp(gen->f, v1, v0); /* v1 = log2(v0) */ break; case TGSI_OPCODE_MOV: - case TGSI_OPCODE_SWZ: if (v0 != v1) ppc_vmove(gen->f, v1, v0); break; @@ -1119,7 +1108,6 @@ emit_instruction(struct gen_context *gen, switch (inst->Instruction.Opcode) { case TGSI_OPCODE_MOV: - case TGSI_OPCODE_SWZ: case TGSI_OPCODE_ABS: case TGSI_OPCODE_FLR: case TGSI_OPCODE_FRC: diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c index 0db4481a3d..f9c16f1b6c 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c @@ -228,11 +228,6 @@ tgsi_is_passthrough_shader(const struct tgsi_token *tokens) src->SrcRegister.SwizzleZ != TGSI_SWIZZLE_Z || src->SrcRegister.SwizzleW != TGSI_SWIZZLE_W || - src->SrcRegisterExtSwz.ExtSwizzleX != TGSI_EXTSWIZZLE_X || - src->SrcRegisterExtSwz.ExtSwizzleY != TGSI_EXTSWIZZLE_Y || - src->SrcRegisterExtSwz.ExtSwizzleZ != TGSI_EXTSWIZZLE_Z || - src->SrcRegisterExtSwz.ExtSwizzleW != TGSI_EXTSWIZZLE_W || - dst->DstRegister.WriteMask != TGSI_WRITEMASK_XYZW) { tgsi_parse_free(&parse); diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index 5f6b83b236..a96fc94c7a 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -1260,13 +1260,13 @@ emit_fetch( const struct tgsi_full_src_register *reg, const unsigned chan_index ) { - unsigned swizzle = tgsi_util_get_full_src_register_extswizzle( reg, chan_index ); + unsigned swizzle = tgsi_util_get_full_src_register_swizzle( reg, chan_index ); switch (swizzle) { - case TGSI_EXTSWIZZLE_X: - case TGSI_EXTSWIZZLE_Y: - case TGSI_EXTSWIZZLE_Z: - case TGSI_EXTSWIZZLE_W: + case TGSI_SWIZZLE_X: + case TGSI_SWIZZLE_Y: + case TGSI_SWIZZLE_Z: + case TGSI_SWIZZLE_W: switch (reg->SrcRegister.File) { case TGSI_FILE_CONSTANT: emit_const( @@ -1308,22 +1308,6 @@ emit_fetch( } break; - case TGSI_EXTSWIZZLE_ZERO: - emit_tempf( - func, - xmm, - TGSI_EXEC_TEMP_00000000_I, - TGSI_EXEC_TEMP_00000000_C ); - break; - - case TGSI_EXTSWIZZLE_ONE: - emit_tempf( - func, - xmm, - TEMP_ONE_I, - TEMP_ONE_C ); - break; - default: assert( 0 ); } @@ -1582,13 +1566,13 @@ emit_kil( /* This mask stores component bits that were already tested. Note that * we test if the value is less than zero, so 1.0 and 0.0 need not to be * tested. */ - uniquemask = (1 << TGSI_EXTSWIZZLE_ZERO) | (1 << TGSI_EXTSWIZZLE_ONE); + uniquemask = 0; FOR_EACH_CHANNEL( chan_index ) { unsigned swizzle; /* unswizzle channel */ - swizzle = tgsi_util_get_full_src_register_extswizzle( + swizzle = tgsi_util_get_full_src_register_swizzle( reg, chan_index ); @@ -1772,7 +1756,6 @@ emit_instruction( break; case TGSI_OPCODE_MOV: - case TGSI_OPCODE_SWZ: FOR_EACH_DST0_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( func, *inst, 4 + chan_index, 0, chan_index ); } @@ -2938,8 +2921,7 @@ tgsi_emit_sse2( * the result in the cases where the code is too opaque to * fix. */ - if (opcode != TGSI_OPCODE_MOV && - opcode != TGSI_OPCODE_SWZ) { + if (opcode != TGSI_OPCODE_MOV) { debug_printf("Warning: src/dst aliasing in instruction" " is not handled:\n"); tgsi_dump_instruction(&parse.FullToken.FullInstruction, 1); diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index d438450b1e..87d9cd7b3f 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -538,13 +538,11 @@ static boolean parse_optional_swizzle( struct translate_ctx *ctx, uint swizzle[4], - boolean *parsed_swizzle, - boolean *parsed_extswizzle ) + boolean *parsed_swizzle ) { const char *cur = ctx->cur; *parsed_swizzle = FALSE; - *parsed_extswizzle = FALSE; eat_opt_white( &cur ); if (*cur == '.') { @@ -562,15 +560,8 @@ parse_optional_swizzle( else if (uprcase( *cur ) == 'W') swizzle[i] = TGSI_SWIZZLE_W; else { - if (*cur == '0') - swizzle[i] = TGSI_EXTSWIZZLE_ZERO; - else if (*cur == '1') - swizzle[i] = TGSI_EXTSWIZZLE_ONE; - else { - report_error( ctx, "Expected register swizzle component `x', `y', `z', `w', `0' or `1'" ); - return FALSE; - } - *parsed_extswizzle = TRUE; + report_error( ctx, "Expected register swizzle component `x', `y', `z', `w', `0' or `1'" ); + return FALSE; } cur++; } @@ -595,7 +586,6 @@ parse_src_operand( uint swizzle[4]; boolean parsed_ext_negate_paren = FALSE; boolean parsed_swizzle; - boolean parsed_extswizzle; if (*ctx->cur == '-') { cur = ctx->cur; @@ -690,16 +680,8 @@ parse_src_operand( /* Parse optional swizzle. */ - if (parse_optional_swizzle( ctx, swizzle, &parsed_swizzle, &parsed_extswizzle )) { - if (parsed_extswizzle) { - assert( parsed_swizzle ); - - src->SrcRegisterExtSwz.ExtSwizzleX = swizzle[0]; - src->SrcRegisterExtSwz.ExtSwizzleY = swizzle[1]; - src->SrcRegisterExtSwz.ExtSwizzleZ = swizzle[2]; - src->SrcRegisterExtSwz.ExtSwizzleW = swizzle[3]; - } - else if (parsed_swizzle) { + if (parse_optional_swizzle( ctx, swizzle, &parsed_swizzle )) { + if (parsed_swizzle) { src->SrcRegister.SwizzleX = swizzle[0]; src->SrcRegister.SwizzleY = swizzle[1]; src->SrcRegister.SwizzleZ = swizzle[2]; diff --git a/src/gallium/auxiliary/tgsi/tgsi_util.c b/src/gallium/auxiliary/tgsi/tgsi_util.c index 71f8a6ca40..6120a2da94 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_util.c +++ b/src/gallium/auxiliary/tgsi/tgsi_util.c @@ -69,59 +69,15 @@ tgsi_util_get_src_register_swizzle( return 0; } -unsigned -tgsi_util_get_src_register_extswizzle( - const struct tgsi_src_register_ext_swz *reg, - unsigned component ) -{ - switch( component ) { - case 0: - return reg->ExtSwizzleX; - case 1: - return reg->ExtSwizzleY; - case 2: - return reg->ExtSwizzleZ; - case 3: - return reg->ExtSwizzleW; - default: - assert( 0 ); - } - return 0; -} unsigned -tgsi_util_get_full_src_register_extswizzle( +tgsi_util_get_full_src_register_swizzle( const struct tgsi_full_src_register *reg, unsigned component ) { - unsigned swizzle; - - /* - * First, calculate the extended swizzle for a given channel. This will give - * us either a channel index into the simple swizzle or a constant 1 or 0. - */ - swizzle = tgsi_util_get_src_register_extswizzle( - ®->SrcRegisterExtSwz, + return tgsi_util_get_src_register_swizzle( + ®->SrcRegister, component ); - - assert (TGSI_SWIZZLE_X == TGSI_EXTSWIZZLE_X); - assert (TGSI_SWIZZLE_Y == TGSI_EXTSWIZZLE_Y); - assert (TGSI_SWIZZLE_Z == TGSI_EXTSWIZZLE_Z); - assert (TGSI_SWIZZLE_W == TGSI_EXTSWIZZLE_W); - assert (TGSI_EXTSWIZZLE_ZERO > TGSI_SWIZZLE_W); - assert (TGSI_EXTSWIZZLE_ONE > TGSI_SWIZZLE_W); - - /* - * Second, calculate the simple swizzle for the unswizzled channel index. - * Leave the constants intact, they are not affected by the simple swizzle. - */ - if( swizzle <= TGSI_SWIZZLE_W ) { - swizzle = tgsi_util_get_src_register_swizzle( - ®->SrcRegister, - swizzle ); - } - - return swizzle; } void @@ -148,30 +104,6 @@ tgsi_util_set_src_register_swizzle( } } -void -tgsi_util_set_src_register_extswizzle( - struct tgsi_src_register_ext_swz *reg, - unsigned swizzle, - unsigned component ) -{ - switch( component ) { - case 0: - reg->ExtSwizzleX = swizzle; - break; - case 1: - reg->ExtSwizzleY = swizzle; - break; - case 2: - reg->ExtSwizzleZ = swizzle; - break; - case 3: - reg->ExtSwizzleW = swizzle; - break; - default: - assert( 0 ); - } -} - unsigned tgsi_util_get_src_register_extnegate( const struct tgsi_src_register_ext_swz *reg, diff --git a/src/gallium/auxiliary/tgsi/tgsi_util.h b/src/gallium/auxiliary/tgsi/tgsi_util.h index 21eb656327..bf3f20ca6c 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_util.h +++ b/src/gallium/auxiliary/tgsi/tgsi_util.h @@ -45,13 +45,9 @@ tgsi_util_get_src_register_swizzle( const struct tgsi_src_register *reg, unsigned component ); -unsigned -tgsi_util_get_src_register_extswizzle( - const struct tgsi_src_register_ext_swz *reg, - unsigned component); unsigned -tgsi_util_get_full_src_register_extswizzle( +tgsi_util_get_full_src_register_swizzle( const struct tgsi_full_src_register *reg, unsigned component ); @@ -61,12 +57,6 @@ tgsi_util_set_src_register_swizzle( unsigned swizzle, unsigned component ); -void -tgsi_util_set_src_register_extswizzle( - struct tgsi_src_register_ext_swz *reg, - unsigned swizzle, - unsigned component ); - unsigned tgsi_util_get_src_register_extnegate( const struct tgsi_src_register_ext_swz *reg, diff --git a/src/gallium/drivers/cell/ppu/cell_gen_fp.c b/src/gallium/drivers/cell/ppu/cell_gen_fp.c index b6b2f885af..19e3ab0844 100644 --- a/src/gallium/drivers/cell/ppu/cell_gen_fp.c +++ b/src/gallium/drivers/cell/ppu/cell_gen_fp.c @@ -231,7 +231,7 @@ static boolean is_register_src(struct codegen *gen, int channel, const struct tgsi_full_src_register *src) { - int swizzle = tgsi_util_get_full_src_register_extswizzle(src, channel); + int swizzle = tgsi_util_get_full_src_register_swizzle(src, channel); int sign_op = tgsi_util_get_full_src_register_sign_mode(src, channel); if (swizzle > TGSI_SWIZZLE_W || sign_op != TGSI_UTIL_SIGN_KEEP) { @@ -271,23 +271,14 @@ get_src_reg(struct codegen *gen, const struct tgsi_full_src_register *src) { int reg = -1; - int swizzle = tgsi_util_get_full_src_register_extswizzle(src, channel); + int swizzle = tgsi_util_get_full_src_register_swizzle(src, channel); boolean reg_is_itemp = FALSE; uint sign_op; assert(swizzle >= TGSI_SWIZZLE_X); - assert(swizzle <= TGSI_EXTSWIZZLE_ONE); + assert(swizzle <= TGSI_SWIZZLE_W); - if (swizzle == TGSI_EXTSWIZZLE_ONE) { - /* Load const one float and early out */ - reg = get_const_one_reg(gen); - } - else if (swizzle == TGSI_EXTSWIZZLE_ZERO) { - /* Load const zero float and early out */ - reg = get_itemp(gen); - spe_xor(gen->f, reg, reg, reg); - } - else { + { int index = src->SrcRegister.Index; assert(swizzle < 4); @@ -1758,7 +1749,6 @@ emit_instruction(struct codegen *gen, case TGSI_OPCODE_ARL: return emit_ARL(gen, inst); case TGSI_OPCODE_MOV: - case TGSI_OPCODE_SWZ: return emit_MOV(gen, inst); case TGSI_OPCODE_ADD: case TGSI_OPCODE_SUB: diff --git a/src/gallium/drivers/cell/spu/spu_exec.c b/src/gallium/drivers/cell/spu/spu_exec.c index 725a72b326..4c32b2d06d 100644 --- a/src/gallium/drivers/cell/spu/spu_exec.c +++ b/src/gallium/drivers/cell/spu/spu_exec.c @@ -346,10 +346,10 @@ fetch_src_file_channel( union spu_exec_channel *chan ) { switch( swizzle ) { - case TGSI_EXTSWIZZLE_X: - case TGSI_EXTSWIZZLE_Y: - case TGSI_EXTSWIZZLE_Z: - case TGSI_EXTSWIZZLE_W: + case TGSI_SWIZZLE_X: + case TGSI_SWIZZLE_Y: + case TGSI_SWIZZLE_Z: + case TGSI_SWIZZLE_W: switch( file ) { case TGSI_FILE_CONSTANT: { unsigned i; @@ -413,14 +413,6 @@ fetch_src_file_channel( } break; - case TGSI_EXTSWIZZLE_ZERO: - *chan = mach->Temps[TEMP_0_I].xyzw[TEMP_0_C]; - break; - - case TGSI_EXTSWIZZLE_ONE: - *chan = mach->Temps[TEMP_1_I].xyzw[TEMP_1_C]; - break; - default: ASSERT( 0 ); } @@ -500,7 +492,7 @@ fetch_source( } } - swizzle = tgsi_util_get_full_src_register_extswizzle( reg, chan_index ); + swizzle = tgsi_util_get_full_src_register_swizzle( reg, chan_index ); fetch_src_file_channel( mach, reg->SrcRegister.File, @@ -610,10 +602,8 @@ exec_kil(struct spu_exec_machine *mach, uint kilmask = 0; /* bit 0 = pixel 0, bit 1 = pixel 1, etc */ union spu_exec_channel r[1]; - /* This mask stores component bits that were already tested. Note that - * we test if the value is less than zero, so 1.0 and 0.0 need not to be - * tested. */ - uniquemask = (1 << TGSI_EXTSWIZZLE_ZERO) | (1 << TGSI_EXTSWIZZLE_ONE); + /* This mask stores component bits that were already tested. */ + uniquemask = 0; for (chan_index = 0; chan_index < 4; chan_index++) { @@ -621,7 +611,7 @@ exec_kil(struct spu_exec_machine *mach, uint i; /* unswizzle channel */ - swizzle = tgsi_util_get_full_src_register_extswizzle ( + swizzle = tgsi_util_get_full_src_register_swizzle ( &inst->FullSrcRegisters[0], chan_index); @@ -909,7 +899,6 @@ exec_instruction( break; case TGSI_OPCODE_MOV: - case TGSI_OPCODE_SWZ: FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); STORE( &r[0], 0, chan_index ); diff --git a/src/gallium/drivers/cell/spu/spu_util.c b/src/gallium/drivers/cell/spu/spu_util.c index af25dd3718..25a7a71133 100644 --- a/src/gallium/drivers/cell/spu/spu_util.c +++ b/src/gallium/drivers/cell/spu/spu_util.c @@ -26,59 +26,15 @@ tgsi_util_get_src_register_swizzle( return 0; } -unsigned -tgsi_util_get_src_register_extswizzle( - const struct tgsi_src_register_ext_swz *reg, - unsigned component ) -{ - switch( component ) { - case 0: - return reg->ExtSwizzleX; - case 1: - return reg->ExtSwizzleY; - case 2: - return reg->ExtSwizzleZ; - case 3: - return reg->ExtSwizzleW; - default: - ASSERT( 0 ); - } - return 0; -} unsigned tgsi_util_get_full_src_register_extswizzle( const struct tgsi_full_src_register *reg, unsigned component ) { - unsigned swizzle; - - /* - * First, calculate the extended swizzle for a given channel. This will give - * us either a channel index into the simple swizzle or a constant 1 or 0. - */ - swizzle = tgsi_util_get_src_register_extswizzle( - ®->SrcRegisterExtSwz, + return tgsi_util_get_src_register_swizzle( + reg->SrcRegister, component ); - - ASSERT (TGSI_SWIZZLE_X == TGSI_EXTSWIZZLE_X); - ASSERT (TGSI_SWIZZLE_Y == TGSI_EXTSWIZZLE_Y); - ASSERT (TGSI_SWIZZLE_Z == TGSI_EXTSWIZZLE_Z); - ASSERT (TGSI_SWIZZLE_W == TGSI_EXTSWIZZLE_W); - ASSERT (TGSI_EXTSWIZZLE_ZERO > TGSI_SWIZZLE_W); - ASSERT (TGSI_EXTSWIZZLE_ONE > TGSI_SWIZZLE_W); - - /* - * Second, calculate the simple swizzle for the unswizzled channel index. - * Leave the constants intact, they are not affected by the simple swizzle. - */ - if( swizzle <= TGSI_SWIZZLE_W ) { - swizzle = tgsi_util_get_src_register_swizzle( - ®->SrcRegister, - component ); - } - - return swizzle; } unsigned diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c b/src/gallium/drivers/i915/i915_fpc_translate.c index 1fe5cda956..3074044441 100644 --- a/src/gallium/drivers/i915/i915_fpc_translate.c +++ b/src/gallium/drivers/i915/i915_fpc_translate.c @@ -214,20 +214,11 @@ src_vector(struct i915_fp_compile *p, return 0; } - if (source->SrcRegister.Extended) { - src = swizzle(src, - source->SrcRegisterExtSwz.ExtSwizzleX, - source->SrcRegisterExtSwz.ExtSwizzleY, - source->SrcRegisterExtSwz.ExtSwizzleZ, - source->SrcRegisterExtSwz.ExtSwizzleW); - } - else { - src = swizzle(src, - source->SrcRegister.SwizzleX, - source->SrcRegister.SwizzleY, - source->SrcRegister.SwizzleZ, - source->SrcRegister.SwizzleW); - } + src = swizzle(src, + source->SrcRegister.SwizzleX, + source->SrcRegister.SwizzleY, + source->SrcRegister.SwizzleZ, + source->SrcRegister.SwizzleW); /* There's both negate-all-components and per-component negation. @@ -681,7 +672,6 @@ i915_translate_instruction(struct i915_fp_compile *p, break; case TGSI_OPCODE_MOV: - case TGSI_OPCODE_SWZ: emit_simple_arith(p, inst, A0_MOV, 1); break; diff --git a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c index 926cc1cc9f..64027de6aa 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c @@ -158,14 +158,14 @@ emit_fetch( const unsigned chan_index ) { const struct tgsi_full_src_register *reg = &inst->FullSrcRegisters[index]; - unsigned swizzle = tgsi_util_get_full_src_register_extswizzle( reg, chan_index ); + unsigned swizzle = tgsi_util_get_full_src_register_swizzle( reg, chan_index ); LLVMValueRef res; switch (swizzle) { - case TGSI_EXTSWIZZLE_X: - case TGSI_EXTSWIZZLE_Y: - case TGSI_EXTSWIZZLE_Z: - case TGSI_EXTSWIZZLE_W: + case TGSI_SWIZZLE_X: + case TGSI_SWIZZLE_Y: + case TGSI_SWIZZLE_Z: + case TGSI_SWIZZLE_W: switch (reg->SrcRegister.File) { case TGSI_FILE_CONSTANT: { @@ -198,14 +198,6 @@ emit_fetch( } break; - case TGSI_EXTSWIZZLE_ZERO: - res = bld->base.zero; - break; - - case TGSI_EXTSWIZZLE_ONE: - res = bld->base.one; - break; - default: assert( 0 ); return bld->base.undef; @@ -394,12 +386,7 @@ emit_kil( unsigned swizzle; /* Unswizzle channel */ - swizzle = tgsi_util_get_full_src_register_extswizzle( reg, chan_index ); - - /* Note that we test if the value is less than zero, so 1.0 and 0.0 need - * not to be tested. */ - if(swizzle == TGSI_EXTSWIZZLE_ZERO || swizzle == TGSI_EXTSWIZZLE_ONE) - continue; + swizzle = tgsi_util_get_full_src_register_swizzle( reg, chan_index ); /* Check if the component has not been already tested. */ assert(swizzle < NUM_CHANNELS); @@ -488,7 +475,6 @@ emit_instruction( #endif case TGSI_OPCODE_MOV: - case TGSI_OPCODE_SWZ: FOR_EACH_DST0_ENABLED_CHANNEL( inst, chan_index ) { dst0[chan_index] = emit_fetch( bld, inst, 0, chan_index ); } diff --git a/src/gallium/drivers/nv30/nv30_fragprog.c b/src/gallium/drivers/nv30/nv30_fragprog.c index 62c6c76cee..93cf869f58 100644 --- a/src/gallium/drivers/nv30/nv30_fragprog.c +++ b/src/gallium/drivers/nv30/nv30_fragprog.c @@ -326,21 +326,13 @@ src_native_swz(struct nv30_fpc *fpc, const struct tgsi_full_src_register *fsrc, uint c; for (c = 0; c < 4; c++) { - switch (tgsi_util_get_full_src_register_extswizzle(fsrc, c)) { - case TGSI_EXTSWIZZLE_X: - case TGSI_EXTSWIZZLE_Y: - case TGSI_EXTSWIZZLE_Z: - case TGSI_EXTSWIZZLE_W: + switch (tgsi_util_get_full_src_register_swizzle(fsrc, c)) { + case TGSI_SWIZZLE_X: + case TGSI_SWIZZLE_Y: + case TGSI_SWIZZLE_Z: + case TGSI_SWIZZLE_W: mask |= (1 << c); break; - case TGSI_EXTSWIZZLE_ZERO: - zero_mask |= (1 << c); - tgsi.swz[c] = SWZ_X; - break; - case TGSI_EXTSWIZZLE_ONE: - one_mask |= (1 << c); - tgsi.swz[c] = SWZ_X; - break; default: assert(0); } @@ -357,12 +349,6 @@ src_native_swz(struct nv30_fpc *fpc, const struct tgsi_full_src_register *fsrc, if (mask) arith(fpc, 0, MOV, *src, mask, tgsi, none, none); - if (zero_mask) - arith(fpc, 0, SFL, *src, zero_mask, *src, none, none); - - if (one_mask) - arith(fpc, 0, STR, *src, one_mask, *src, none, none); - if (neg_mask) { struct nv30_sreg one = temp(fpc); arith(fpc, 0, STR, one, neg_mask, one, none, none); diff --git a/src/gallium/drivers/nv40/nv40_fragprog.c b/src/gallium/drivers/nv40/nv40_fragprog.c index e3550baa63..4a6b355936 100644 --- a/src/gallium/drivers/nv40/nv40_fragprog.c +++ b/src/gallium/drivers/nv40/nv40_fragprog.c @@ -329,21 +329,13 @@ src_native_swz(struct nv40_fpc *fpc, const struct tgsi_full_src_register *fsrc, uint c; for (c = 0; c < 4; c++) { - switch (tgsi_util_get_full_src_register_extswizzle(fsrc, c)) { - case TGSI_EXTSWIZZLE_X: - case TGSI_EXTSWIZZLE_Y: - case TGSI_EXTSWIZZLE_Z: - case TGSI_EXTSWIZZLE_W: + switch (tgsi_util_get_full_src_register_swizzle(fsrc, c)) { + case TGSI_SWIZZLE_X: + case TGSI_SWIZZLE_Y: + case TGSI_SWIZZLE_Z: + case TGSI_SWIZZLE_W: mask |= (1 << c); break; - case TGSI_EXTSWIZZLE_ZERO: - zero_mask |= (1 << c); - tgsi.swz[c] = SWZ_X; - break; - case TGSI_EXTSWIZZLE_ONE: - one_mask |= (1 << c); - tgsi.swz[c] = SWZ_X; - break; default: assert(0); } diff --git a/src/gallium/drivers/nv40/nv40_vertprog.c b/src/gallium/drivers/nv40/nv40_vertprog.c index 0382dbba8f..4898aaa809 100644 --- a/src/gallium/drivers/nv40/nv40_vertprog.c +++ b/src/gallium/drivers/nv40/nv40_vertprog.c @@ -370,21 +370,13 @@ src_native_swz(struct nv40_vpc *vpc, const struct tgsi_full_src_register *fsrc, uint c; for (c = 0; c < 4; c++) { - switch (tgsi_util_get_full_src_register_extswizzle(fsrc, c)) { - case TGSI_EXTSWIZZLE_X: - case TGSI_EXTSWIZZLE_Y: - case TGSI_EXTSWIZZLE_Z: - case TGSI_EXTSWIZZLE_W: + switch (tgsi_util_get_full_src_register_swizzle(fsrc, c)) { + case TGSI_SWIZZLE_X: + case TGSI_SWIZZLE_Y: + case TGSI_SWIZZLE_Z: + case TGSI_SWIZZLE_W: mask |= tgsi_mask(1 << c); break; - case TGSI_EXTSWIZZLE_ZERO: - zero_mask |= tgsi_mask(1 << c); - tgsi.swz[c] = SWZ_X; - break; - case TGSI_EXTSWIZZLE_ONE: - one_mask |= tgsi_mask(1 << c); - tgsi.swz[c] = SWZ_X; - break; default: assert(0); } diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index c7145bb9be..5c691877e0 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -1544,12 +1544,12 @@ tgsi_src(struct nv50_pc *pc, int chan, const struct tgsi_full_src_register *src, sgn = tgsi_util_get_full_src_register_sign_mode(src, chan); - c = tgsi_util_get_full_src_register_extswizzle(src, chan); + c = tgsi_util_get_full_src_register_swizzle(src, chan); switch (c) { - case TGSI_EXTSWIZZLE_X: - case TGSI_EXTSWIZZLE_Y: - case TGSI_EXTSWIZZLE_Z: - case TGSI_EXTSWIZZLE_W: + case TGSI_SWIZZLE_X: + case TGSI_SWIZZLE_Y: + case TGSI_SWIZZLE_Z: + case TGSI_SWIZZLE_W: switch (src->SrcRegister.File) { case TGSI_FILE_INPUT: r = &pc->attr[src->SrcRegister.Index * 4 + c]; @@ -1586,13 +1586,6 @@ tgsi_src(struct nv50_pc *pc, int chan, const struct tgsi_full_src_register *src, break; } break; - case TGSI_EXTSWIZZLE_ZERO: - r = alloc_immd(pc, 0.0); - return r; - case TGSI_EXTSWIZZLE_ONE: - if (sgn == TGSI_UTIL_SIGN_TOGGLE || sgn == TGSI_UTIL_SIGN_SET) - return alloc_immd(pc, -1.0); - return alloc_immd(pc, 1.0); default: assert(0); break; @@ -2005,7 +1998,6 @@ nv50_program_tx_insn(struct nv50_pc *pc, } break; case TGSI_OPCODE_MOV: - case TGSI_OPCODE_SWZ: for (c = 0; c < 4; c++) { if (!(mask & (1 << c))) continue; @@ -2189,10 +2181,7 @@ prep_inspect_insn(struct nv50_pc *pc, const struct tgsi_full_instruction *insn) for (c = 0; c < 4; c++) { if (!(mask & (1 << c))) continue; - k = tgsi_util_get_full_src_register_extswizzle(src, c); - - if (k > TGSI_EXTSWIZZLE_W) - continue; + k = tgsi_util_get_full_src_register_swizzle(src, c); reg[src->SrcRegister.Index * 4 + k].acc = pc->insn_nr; } @@ -2295,11 +2284,10 @@ nv50_tgsi_scan_swizzle(const struct tgsi_full_instruction *insn, if (!(mask & (1 << chn))) /* src is not read */ continue; - c = tgsi_util_get_full_src_register_extswizzle(fs, chn); + c = tgsi_util_get_full_src_register_swizzle(fs, chn); s = tgsi_util_get_full_src_register_sign_mode(fs, chn); - if (c > TGSI_EXTSWIZZLE_W || - !(fd->DstRegister.WriteMask & (1 << c))) + if (!(fd->DstRegister.WriteMask & (1 << c))) continue; /* no danger if src is copied to TEMP first */ diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/src/gallium/drivers/r300/r300_tgsi_to_rc.c index 3d2f6cafee..de599b068f 100644 --- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c +++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c @@ -142,7 +142,6 @@ static unsigned translate_opcode(unsigned opcode) /* case TGSI_OPCODE_IFC: return RC_OPCODE_IFC; */ /* case TGSI_OPCODE_BREAKC: return RC_OPCODE_BREAKC; */ case TGSI_OPCODE_KIL: return RC_OPCODE_KIL; - case TGSI_OPCODE_SWZ: return RC_OPCODE_SWZ; } fprintf(stderr, "Unknown opcode: %i\n", opcode); @@ -205,10 +204,10 @@ static void transform_srcreg( dst->File = translate_register_file(src->SrcRegister.File); dst->Index = translate_register_index(ttr, src->SrcRegister.File, src->SrcRegister.Index); dst->RelAddr = src->SrcRegister.Indirect; - dst->Swizzle = tgsi_util_get_full_src_register_extswizzle(src, 0); - dst->Swizzle |= tgsi_util_get_full_src_register_extswizzle(src, 1) << 3; - dst->Swizzle |= tgsi_util_get_full_src_register_extswizzle(src, 2) << 6; - dst->Swizzle |= tgsi_util_get_full_src_register_extswizzle(src, 3) << 9; + dst->Swizzle = tgsi_util_get_full_src_register_swizzle(src, 0); + dst->Swizzle |= tgsi_util_get_full_src_register_swizzle(src, 1) << 3; + dst->Swizzle |= tgsi_util_get_full_src_register_swizzle(src, 2) << 6; + dst->Swizzle |= tgsi_util_get_full_src_register_swizzle(src, 3) << 9; dst->Abs = src->SrcRegisterExtMod.Absolute; dst->Negate = src->SrcRegisterExtSwz.NegateX | diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index 48e6583ada..b01df41b0e 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -275,7 +275,7 @@ union tgsi_immediate_data #define TGSI_OPCODE_BREAKC 115 #define TGSI_OPCODE_KIL 116 /* conditional kill */ #define TGSI_OPCODE_END 117 /* aka HALT */ -#define TGSI_OPCODE_SWZ 118 + /* gap */ #define TGSI_OPCODE_LAST 119 #define TGSI_SAT_NONE 0 /* do not saturate */ @@ -496,17 +496,7 @@ struct tgsi_src_register_ext * follows. */ -#define TGSI_EXTSWIZZLE_X TGSI_SWIZZLE_X -#define TGSI_EXTSWIZZLE_Y TGSI_SWIZZLE_Y -#define TGSI_EXTSWIZZLE_Z TGSI_SWIZZLE_Z -#define TGSI_EXTSWIZZLE_W TGSI_SWIZZLE_W -#define TGSI_EXTSWIZZLE_ZERO 4 -#define TGSI_EXTSWIZZLE_ONE 5 - /** - * ExtSwizzleX, ExtSwizzleY, ExtSwizzleZ and ExtSwizzleW swizzle the source - * register in an extended manner. - * * NegateX, NegateY, NegateZ and NegateW negate individual components of the * source register. * @@ -518,10 +508,7 @@ struct tgsi_src_register_ext struct tgsi_src_register_ext_swz { unsigned Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_SWZ */ - unsigned ExtSwizzleX : 4; /* TGSI_EXTSWIZZLE_ */ - unsigned ExtSwizzleY : 4; /* TGSI_EXTSWIZZLE_ */ - unsigned ExtSwizzleZ : 4; /* TGSI_EXTSWIZZLE_ */ - unsigned ExtSwizzleW : 4; /* TGSI_EXTSWIZZLE_ */ + unsigned Padding0 : 16; /* unused */ unsigned NegateX : 1; /* BOOL */ unsigned NegateY : 1; /* BOOL */ unsigned NegateZ : 1; /* BOOL */ diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 1b9d35d353..3d6c215819 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -515,8 +515,6 @@ translate_opcode( unsigned op ) return TGSI_OPCODE_SSG; case OPCODE_SUB: return TGSI_OPCODE_SUB; - case OPCODE_SWZ: - return TGSI_OPCODE_SWZ; case OPCODE_TEX: return TGSI_OPCODE_TEX; case OPCODE_TXB: -- cgit v1.2.3 From 8a571b809accce1c36907ea616a893b920b752e5 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 23 Oct 2009 14:38:30 +0100 Subject: cell: typo from ExtSwizzle commit --- src/gallium/drivers/cell/spu/spu_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/cell/spu/spu_util.c b/src/gallium/drivers/cell/spu/spu_util.c index 25a7a71133..a62c04e6af 100644 --- a/src/gallium/drivers/cell/spu/spu_util.c +++ b/src/gallium/drivers/cell/spu/spu_util.c @@ -28,7 +28,7 @@ tgsi_util_get_src_register_swizzle( unsigned -tgsi_util_get_full_src_register_extswizzle( +tgsi_util_get_full_src_register_swizzle( const struct tgsi_full_src_register *reg, unsigned component ) { -- cgit v1.2.3 From da253319f9e5d37d9c55b975ef9328545a3ac9b4 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 23 Oct 2009 14:50:02 +0100 Subject: gallium: remove extended negate also, and also the ExtSwz token Likewise, the extended negate functionality hasn't been used since mesa switched to using tgsi_ureg to build programs, and has been translating the SWZ opcode internally to a single MAD. --- src/gallium/auxiliary/tgsi/tgsi_build.c | 82 --------------------------- src/gallium/auxiliary/tgsi/tgsi_build.h | 18 ------ src/gallium/auxiliary/tgsi/tgsi_dump_c.c | 32 +---------- src/gallium/auxiliary/tgsi/tgsi_parse.c | 5 -- src/gallium/auxiliary/tgsi/tgsi_parse.h | 1 - src/gallium/auxiliary/tgsi/tgsi_ureg.c | 1 - src/gallium/auxiliary/tgsi/tgsi_util.c | 53 +---------------- src/gallium/auxiliary/tgsi/tgsi_util.h | 12 ---- src/gallium/drivers/cell/spu/spu_util.c | 46 --------------- src/gallium/drivers/i915/i915_fpc_translate.c | 13 +---- src/gallium/drivers/nv30/nv30_fragprog.c | 17 +----- src/gallium/drivers/nv40/nv40_fragprog.c | 23 +------- src/gallium/drivers/nv40/nv40_vertprog.c | 23 +------- src/gallium/drivers/r300/r300_tgsi_to_rc.c | 7 +-- src/gallium/include/pipe/p_shader_tokens.h | 24 -------- 15 files changed, 11 insertions(+), 346 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index 98d36f43e4..d45561362d 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -687,32 +687,6 @@ tgsi_build_full_instruction( header ); prev_token = (struct tgsi_token *) src_register; - if( tgsi_compare_src_register_ext_swz( - reg->SrcRegisterExtSwz, - tgsi_default_src_register_ext_swz() ) ) { - struct tgsi_src_register_ext_swz *src_register_ext_swz; - - /* Use of the extended negate requires the simple negate to be identity. - */ - assert( reg->SrcRegister.Negate == FALSE ); - - if( maxsize <= size ) - return 0; - src_register_ext_swz = - (struct tgsi_src_register_ext_swz *) &tokens[size]; - size++; - - *src_register_ext_swz = tgsi_build_src_register_ext_swz( - reg->SrcRegisterExtSwz.NegateX, - reg->SrcRegisterExtSwz.NegateY, - reg->SrcRegisterExtSwz.NegateZ, - reg->SrcRegisterExtSwz.NegateW, - prev_token, - instruction, - header ); - prev_token = (struct tgsi_token *) src_register_ext_swz; - } - if( tgsi_compare_src_register_ext_mod( reg->SrcRegisterExtMod, tgsi_default_src_register_ext_mod() ) ) { @@ -1025,7 +999,6 @@ tgsi_default_full_src_register( void ) struct tgsi_full_src_register full_src_register; full_src_register.SrcRegister = tgsi_default_src_register(); - full_src_register.SrcRegisterExtSwz = tgsi_default_src_register_ext_swz(); full_src_register.SrcRegisterExtMod = tgsi_default_src_register_ext_mod(); full_src_register.SrcRegisterInd = tgsi_default_src_register(); full_src_register.SrcRegisterDim = tgsi_default_dimension(); @@ -1034,61 +1007,6 @@ tgsi_default_full_src_register( void ) return full_src_register; } -struct tgsi_src_register_ext_swz -tgsi_default_src_register_ext_swz( void ) -{ - struct tgsi_src_register_ext_swz src_register_ext_swz; - - src_register_ext_swz.Type = TGSI_SRC_REGISTER_EXT_TYPE_SWZ; - src_register_ext_swz.Padding0 = 0; - src_register_ext_swz.NegateX = 0; - src_register_ext_swz.NegateY = 0; - src_register_ext_swz.NegateZ = 0; - src_register_ext_swz.NegateW = 0; - src_register_ext_swz.Padding = 0; - src_register_ext_swz.Extended = 0; - - return src_register_ext_swz; -} - -unsigned -tgsi_compare_src_register_ext_swz( - struct tgsi_src_register_ext_swz a, - struct tgsi_src_register_ext_swz b ) -{ - a.Padding = b.Padding = 0; - a.Extended = b.Extended = 0; - return compare32(&a, &b); -} - -struct tgsi_src_register_ext_swz -tgsi_build_src_register_ext_swz( - unsigned negate_x, - unsigned negate_y, - unsigned negate_z, - unsigned negate_w, - struct tgsi_token *prev_token, - struct tgsi_instruction *instruction, - struct tgsi_header *header ) -{ - struct tgsi_src_register_ext_swz src_register_ext_swz; - - assert( negate_x <= 1 ); - assert( negate_y <= 1 ); - assert( negate_z <= 1 ); - assert( negate_w <= 1 ); - - src_register_ext_swz = tgsi_default_src_register_ext_swz(); - src_register_ext_swz.NegateX = negate_x; - src_register_ext_swz.NegateY = negate_y; - src_register_ext_swz.NegateZ = negate_z; - src_register_ext_swz.NegateW = negate_w; - - prev_token->Extended = 1; - instruction_grow( instruction, header ); - - return src_register_ext_swz; -} struct tgsi_src_register_ext_mod tgsi_default_src_register_ext_mod( void ) diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.h b/src/gallium/auxiliary/tgsi/tgsi_build.h index 5e0062a96f..9ae1705f6c 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.h +++ b/src/gallium/auxiliary/tgsi/tgsi_build.h @@ -231,24 +231,6 @@ tgsi_build_src_register( struct tgsi_full_src_register tgsi_default_full_src_register( void ); -struct tgsi_src_register_ext_swz -tgsi_default_src_register_ext_swz( void ); - -unsigned -tgsi_compare_src_register_ext_swz( - struct tgsi_src_register_ext_swz a, - struct tgsi_src_register_ext_swz b ); - -struct tgsi_src_register_ext_swz -tgsi_build_src_register_ext_swz( - unsigned negate_x, - unsigned negate_y, - unsigned negate_z, - unsigned negate_w, - struct tgsi_token *prev_token, - struct tgsi_instruction *instruction, - struct tgsi_header *header ); - struct tgsi_src_register_ext_mod tgsi_default_src_register_ext_mod( void ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c index 4f59ed22b5..c7dbdb3bd2 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c @@ -163,7 +163,7 @@ static const char *TGSI_TEXTURES[] = static const char *TGSI_SRC_REGISTER_EXTS[] = { - "SRC_REGISTER_EXT_TYPE_SWZ", + "", "SRC_REGISTER_EXT_TYPE_MOD" }; @@ -546,36 +546,6 @@ dump_instruction_verbose( } } - if( deflt || tgsi_compare_src_register_ext_swz( src->SrcRegisterExtSwz, fs->SrcRegisterExtSwz ) ) { - EOL(); - TXT( "\nType : " ); - ENM( src->SrcRegisterExtSwz.Type, TGSI_SRC_REGISTER_EXTS ); - if( deflt || fs->SrcRegisterExtSwz.NegateX != src->SrcRegisterExtSwz.NegateX ) { - TXT( "\nNegateX : " ); - UID( src->SrcRegisterExtSwz.NegateX ); - } - if( deflt || fs->SrcRegisterExtSwz.NegateY != src->SrcRegisterExtSwz.NegateY ) { - TXT( "\nNegateY : " ); - UID( src->SrcRegisterExtSwz.NegateY ); - } - if( deflt || fs->SrcRegisterExtSwz.NegateZ != src->SrcRegisterExtSwz.NegateZ ) { - TXT( "\nNegateZ : " ); - UID( src->SrcRegisterExtSwz.NegateZ ); - } - if( deflt || fs->SrcRegisterExtSwz.NegateW != src->SrcRegisterExtSwz.NegateW ) { - TXT( "\nNegateW : " ); - UID( src->SrcRegisterExtSwz.NegateW ); - } - if( ignored ) { - TXT( "\nPadding : " ); - UIX( src->SrcRegisterExtSwz.Padding ); - if( deflt || fs->SrcRegisterExtSwz.Extended != src->SrcRegisterExtSwz.Extended ) { - TXT( "\nExtended : " ); - UID( src->SrcRegisterExtSwz.Extended ); - } - } - } - if( deflt || tgsi_compare_src_register_ext_mod( src->SrcRegisterExtMod, fs->SrcRegisterExtMod ) ) { EOL(); TXT( "\nType : " ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c index 4870f82b6b..f742c71936 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.c +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c @@ -264,11 +264,6 @@ tgsi_parse_token( next_token( ctx, &token ); switch( token.Type ) { - case TGSI_SRC_REGISTER_EXT_TYPE_SWZ: - copy_token(&inst->FullSrcRegisters[i].SrcRegisterExtSwz, - &token); - break; - case TGSI_SRC_REGISTER_EXT_TYPE_MOD: copy_token(&inst->FullSrcRegisters[i].SrcRegisterExtMod, &token); diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h b/src/gallium/auxiliary/tgsi/tgsi_parse.h index a26ee5ba86..602131398d 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.h +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h @@ -56,7 +56,6 @@ struct tgsi_full_dst_register struct tgsi_full_src_register { struct tgsi_src_register SrcRegister; - struct tgsi_src_register_ext_swz SrcRegisterExtSwz; struct tgsi_src_register_ext_mod SrcRegisterExtMod; struct tgsi_src_register SrcRegisterInd; struct tgsi_dimension SrcRegisterDim; diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 654426a903..8cb574ea43 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -51,7 +51,6 @@ union tgsi_any_token { struct tgsi_instruction_ext_texture insn_ext_texture; struct tgsi_instruction_ext_predicate insn_ext_predicate; struct tgsi_src_register src; - struct tgsi_src_register_ext_swz src_ext_swz; struct tgsi_src_register_ext_mod src_ext_mod; struct tgsi_dimension dim; struct tgsi_dst_register dst; diff --git a/src/gallium/auxiliary/tgsi/tgsi_util.c b/src/gallium/auxiliary/tgsi/tgsi_util.c index 6120a2da94..4dee1be9e8 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_util.c +++ b/src/gallium/auxiliary/tgsi/tgsi_util.c @@ -104,50 +104,6 @@ tgsi_util_set_src_register_swizzle( } } -unsigned -tgsi_util_get_src_register_extnegate( - const struct tgsi_src_register_ext_swz *reg, - unsigned component ) -{ - switch( component ) { - case 0: - return reg->NegateX; - case 1: - return reg->NegateY; - case 2: - return reg->NegateZ; - case 3: - return reg->NegateW; - default: - assert( 0 ); - } - return 0; -} - -void -tgsi_util_set_src_register_extnegate( - struct tgsi_src_register_ext_swz *reg, - unsigned negate, - unsigned component ) -{ - switch( component ) { - case 0: - reg->NegateX = negate; - break; - case 1: - reg->NegateY = negate; - break; - case 2: - reg->NegateZ = negate; - break; - case 3: - reg->NegateW = negate; - break; - default: - assert( 0 ); - } -} - unsigned tgsi_util_get_full_src_register_sign_mode( const struct tgsi_full_src_register *reg, @@ -171,9 +127,7 @@ tgsi_util_get_full_src_register_sign_mode( unsigned negate; negate = reg->SrcRegister.Negate; - if( tgsi_util_get_src_register_extnegate( ®->SrcRegisterExtSwz, component ) ) { - negate = !negate; - } + if( reg->SrcRegisterExtMod.Negate ) { negate = !negate; } @@ -194,11 +148,6 @@ tgsi_util_set_full_src_register_sign_mode( struct tgsi_full_src_register *reg, unsigned sign_mode ) { - reg->SrcRegisterExtSwz.NegateX = 0; - reg->SrcRegisterExtSwz.NegateY = 0; - reg->SrcRegisterExtSwz.NegateZ = 0; - reg->SrcRegisterExtSwz.NegateW = 0; - switch (sign_mode) { case TGSI_UTIL_SIGN_CLEAR: diff --git a/src/gallium/auxiliary/tgsi/tgsi_util.h b/src/gallium/auxiliary/tgsi/tgsi_util.h index bf3f20ca6c..19ee2e7cf2 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_util.h +++ b/src/gallium/auxiliary/tgsi/tgsi_util.h @@ -33,7 +33,6 @@ extern "C" { #endif struct tgsi_src_register; -struct tgsi_src_register_ext_swz; struct tgsi_full_src_register; void * @@ -57,17 +56,6 @@ tgsi_util_set_src_register_swizzle( unsigned swizzle, unsigned component ); -unsigned -tgsi_util_get_src_register_extnegate( - const struct tgsi_src_register_ext_swz *reg, - unsigned component ); - -void -tgsi_util_set_src_register_extnegate( - struct tgsi_src_register_ext_swz *reg, - unsigned negate, - unsigned component ); - #define TGSI_UTIL_SIGN_CLEAR 0 /* Force positive */ #define TGSI_UTIL_SIGN_SET 1 /* Force negative */ #define TGSI_UTIL_SIGN_TOGGLE 2 /* Negate */ diff --git a/src/gallium/drivers/cell/spu/spu_util.c b/src/gallium/drivers/cell/spu/spu_util.c index a62c04e6af..c2c32b22d5 100644 --- a/src/gallium/drivers/cell/spu/spu_util.c +++ b/src/gallium/drivers/cell/spu/spu_util.c @@ -37,49 +37,6 @@ tgsi_util_get_full_src_register_swizzle( component ); } -unsigned -tgsi_util_get_src_register_extnegate( - const struct tgsi_src_register_ext_swz *reg, - unsigned component ) -{ - switch( component ) { - case 0: - return reg->NegateX; - case 1: - return reg->NegateY; - case 2: - return reg->NegateZ; - case 3: - return reg->NegateW; - default: - ASSERT( 0 ); - } - return 0; -} - -void -tgsi_util_set_src_register_extnegate( - struct tgsi_src_register_ext_swz *reg, - unsigned negate, - unsigned component ) -{ - switch( component ) { - case 0: - reg->NegateX = negate; - break; - case 1: - reg->NegateY = negate; - break; - case 2: - reg->NegateZ = negate; - break; - case 3: - reg->NegateW = negate; - break; - default: - ASSERT( 0 ); - } -} unsigned tgsi_util_get_full_src_register_sign_mode( @@ -104,9 +61,6 @@ tgsi_util_get_full_src_register_sign_mode( unsigned negate; negate = reg->SrcRegister.Negate; - if( tgsi_util_get_src_register_extnegate( ®->SrcRegisterExtSwz, component ) ) { - negate = !negate; - } if( reg->SrcRegisterExtMod.Negate ) { negate = !negate; } diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c b/src/gallium/drivers/i915/i915_fpc_translate.c index 3074044441..379d47e79a 100644 --- a/src/gallium/drivers/i915/i915_fpc_translate.c +++ b/src/gallium/drivers/i915/i915_fpc_translate.c @@ -225,17 +225,8 @@ src_vector(struct i915_fp_compile *p, * Try to handle both here. */ { - int nx = source->SrcRegisterExtSwz.NegateX; - int ny = source->SrcRegisterExtSwz.NegateY; - int nz = source->SrcRegisterExtSwz.NegateZ; - int nw = source->SrcRegisterExtSwz.NegateW; - if (source->SrcRegister.Negate) { - nx = !nx; - ny = !ny; - nz = !nz; - nw = !nw; - } - src = negate(src, nx, ny, nz, nw); + int n = source->SrcRegister.Negate; + src = negate(src, n, n, n, n); } /* no abs() or post-abs negation */ diff --git a/src/gallium/drivers/nv30/nv30_fragprog.c b/src/gallium/drivers/nv30/nv30_fragprog.c index 93cf869f58..cc0385426c 100644 --- a/src/gallium/drivers/nv30/nv30_fragprog.c +++ b/src/gallium/drivers/nv30/nv30_fragprog.c @@ -318,11 +318,7 @@ src_native_swz(struct nv30_fpc *fpc, const struct tgsi_full_src_register *fsrc, { const struct nv30_sreg none = nv30_sr(NV30SR_NONE, 0); struct nv30_sreg tgsi = tgsi_src(fpc, fsrc); - uint mask = 0, zero_mask = 0, one_mask = 0, neg_mask = 0; - uint neg[4] = { fsrc->SrcRegisterExtSwz.NegateX, - fsrc->SrcRegisterExtSwz.NegateY, - fsrc->SrcRegisterExtSwz.NegateZ, - fsrc->SrcRegisterExtSwz.NegateW }; + uint mask = 0; uint c; for (c = 0; c < 4; c++) { @@ -336,12 +332,9 @@ src_native_swz(struct nv30_fpc *fpc, const struct tgsi_full_src_register *fsrc, default: assert(0); } - - if (!tgsi.negate && neg[c]) - neg_mask |= (1 << c); } - if (mask == MASK_ALL && !neg_mask) + if (mask == MASK_ALL) return TRUE; *src = temp(fpc); @@ -349,12 +342,6 @@ src_native_swz(struct nv30_fpc *fpc, const struct tgsi_full_src_register *fsrc, if (mask) arith(fpc, 0, MOV, *src, mask, tgsi, none, none); - if (neg_mask) { - struct nv30_sreg one = temp(fpc); - arith(fpc, 0, STR, one, neg_mask, one, none, none); - arith(fpc, 0, MUL, *src, neg_mask, *src, neg(one), none); - } - return FALSE; } diff --git a/src/gallium/drivers/nv40/nv40_fragprog.c b/src/gallium/drivers/nv40/nv40_fragprog.c index 4a6b355936..99277506fc 100644 --- a/src/gallium/drivers/nv40/nv40_fragprog.c +++ b/src/gallium/drivers/nv40/nv40_fragprog.c @@ -321,11 +321,7 @@ src_native_swz(struct nv40_fpc *fpc, const struct tgsi_full_src_register *fsrc, { const struct nv40_sreg none = nv40_sr(NV40SR_NONE, 0); struct nv40_sreg tgsi = tgsi_src(fpc, fsrc); - uint mask = 0, zero_mask = 0, one_mask = 0, neg_mask = 0; - uint neg[4] = { fsrc->SrcRegisterExtSwz.NegateX, - fsrc->SrcRegisterExtSwz.NegateY, - fsrc->SrcRegisterExtSwz.NegateZ, - fsrc->SrcRegisterExtSwz.NegateW }; + uint mask = 0; uint c; for (c = 0; c < 4; c++) { @@ -339,12 +335,9 @@ src_native_swz(struct nv40_fpc *fpc, const struct tgsi_full_src_register *fsrc, default: assert(0); } - - if (!tgsi.negate && neg[c]) - neg_mask |= (1 << c); } - if (mask == MASK_ALL && !neg_mask) + if (mask == MASK_ALL) return TRUE; *src = temp(fpc); @@ -352,18 +345,6 @@ src_native_swz(struct nv40_fpc *fpc, const struct tgsi_full_src_register *fsrc, if (mask) arith(fpc, 0, MOV, *src, mask, tgsi, none, none); - if (zero_mask) - arith(fpc, 0, SFL, *src, zero_mask, *src, none, none); - - if (one_mask) - arith(fpc, 0, STR, *src, one_mask, *src, none, none); - - if (neg_mask) { - struct nv40_sreg one = temp(fpc); - arith(fpc, 0, STR, one, neg_mask, one, none, none); - arith(fpc, 0, MUL, *src, neg_mask, *src, neg(one), none); - } - return FALSE; } diff --git a/src/gallium/drivers/nv40/nv40_vertprog.c b/src/gallium/drivers/nv40/nv40_vertprog.c index 4898aaa809..31dae2457f 100644 --- a/src/gallium/drivers/nv40/nv40_vertprog.c +++ b/src/gallium/drivers/nv40/nv40_vertprog.c @@ -362,11 +362,7 @@ src_native_swz(struct nv40_vpc *vpc, const struct tgsi_full_src_register *fsrc, { const struct nv40_sreg none = nv40_sr(NV40SR_NONE, 0); struct nv40_sreg tgsi = tgsi_src(vpc, fsrc); - uint mask = 0, zero_mask = 0, one_mask = 0, neg_mask = 0; - uint neg[4] = { fsrc->SrcRegisterExtSwz.NegateX, - fsrc->SrcRegisterExtSwz.NegateY, - fsrc->SrcRegisterExtSwz.NegateZ, - fsrc->SrcRegisterExtSwz.NegateW }; + uint mask = 0; uint c; for (c = 0; c < 4; c++) { @@ -380,12 +376,9 @@ src_native_swz(struct nv40_vpc *vpc, const struct tgsi_full_src_register *fsrc, default: assert(0); } - - if (!tgsi.negate && neg[c]) - neg_mask |= tgsi_mask(1 << c); } - if (mask == MASK_ALL && !neg_mask) + if (mask == MASK_ALL) return TRUE; *src = temp(vpc); @@ -393,18 +386,6 @@ src_native_swz(struct nv40_vpc *vpc, const struct tgsi_full_src_register *fsrc, if (mask) arith(vpc, 0, OP_MOV, *src, mask, tgsi, none, none); - if (zero_mask) - arith(vpc, 0, OP_SFL, *src, zero_mask, *src, none, none); - - if (one_mask) - arith(vpc, 0, OP_STR, *src, one_mask, *src, none, none); - - if (neg_mask) { - struct nv40_sreg one = temp(vpc); - arith(vpc, 0, OP_STR, one, neg_mask, one, none, none); - arith(vpc, 0, OP_MUL, *src, neg_mask, *src, neg(one), none); - } - return FALSE; } diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/src/gallium/drivers/r300/r300_tgsi_to_rc.c index de599b068f..589f1984ee 100644 --- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c +++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c @@ -209,12 +209,7 @@ static void transform_srcreg( dst->Swizzle |= tgsi_util_get_full_src_register_swizzle(src, 2) << 6; dst->Swizzle |= tgsi_util_get_full_src_register_swizzle(src, 3) << 9; dst->Abs = src->SrcRegisterExtMod.Absolute; - dst->Negate = - src->SrcRegisterExtSwz.NegateX | - (src->SrcRegisterExtSwz.NegateY << 1) | - (src->SrcRegisterExtSwz.NegateZ << 2) | - (src->SrcRegisterExtSwz.NegateW << 3); - dst->Negate ^= src->SrcRegister.Negate ? RC_MASK_XYZW : 0; + dst->Negate = src->SrcRegister.Negate ? RC_MASK_XYZW : 0; } static void transform_texture(struct rc_instruction * dst, struct tgsi_instruction_ext_texture src) diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index b01df41b0e..de338c4877 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -475,7 +475,6 @@ struct tgsi_src_register * Then, if tgsi_src_register::Dimension is TRUE, tgsi_dimension follows. */ -#define TGSI_SRC_REGISTER_EXT_TYPE_SWZ 0 #define TGSI_SRC_REGISTER_EXT_TYPE_MOD 1 struct tgsi_src_register_ext @@ -486,9 +485,6 @@ struct tgsi_src_register_ext }; /** - * If tgsi_src_register_ext::Type is TGSI_SRC_REGISTER_EXT_TYPE_SWZ, - * it should be cast to tgsi_src_register_ext_swz. - * * If tgsi_src_register_ext::Type is TGSI_SRC_REGISTER_EXT_TYPE_MOD, * it should be cast to tgsi_src_register_ext_mod. * @@ -496,26 +492,6 @@ struct tgsi_src_register_ext * follows. */ -/** - * NegateX, NegateY, NegateZ and NegateW negate individual components of the - * source register. - * - * NOTE: To simplify matter, if this token is present, the corresponding Swizzle - * and Negate fields in tgsi_src_register should be set to X,Y,Z,W - * and FALSE, respectively. - */ - -struct tgsi_src_register_ext_swz -{ - unsigned Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_SWZ */ - unsigned Padding0 : 16; /* unused */ - unsigned NegateX : 1; /* BOOL */ - unsigned NegateY : 1; /* BOOL */ - unsigned NegateZ : 1; /* BOOL */ - unsigned NegateW : 1; /* BOOL */ - unsigned Padding : 7; - unsigned Extended : 1; /* BOOL */ -}; /** * Extra src register modifiers -- cgit v1.2.3 From 738b394769bb95036635f7a00a1ef08890c5be63 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Fri, 23 Oct 2009 14:25:09 +0300 Subject: r600: for position invariant programs reading vert_pos is not always known at this point --- src/mesa/drivers/dri/r600/r700_vertprog.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c index c84b0ac059..ffc6068bd8 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.c +++ b/src/mesa/drivers/dri/r600/r700_vertprog.c @@ -515,6 +515,11 @@ void r700SetVertexFormat(GLcontext *ctx, const struct gl_client_array *arrays[], unsigned int unBit = mesa_vp->Base.InputsRead; context->nNumActiveAos = 0; + if (mesa_vp->IsPositionInvariant) + { + unBit |= VERT_BIT_POS; + } + while(unBit) { if(unBit & 1) -- cgit v1.2.3 From d4d4733e6c312f2a8e9977b06fc554904407c456 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Fri, 23 Oct 2009 16:44:31 +0300 Subject: r600: remove duplicate stride setting Stride is set already in r700SetVertexFormat and there it works correctly for 0 also --- src/mesa/drivers/dri/r600/r700_render.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index 3e1ce9fb72..9cf984f966 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -618,19 +618,15 @@ static void r700SetupStreams(GLcontext *ctx, const struct gl_client_array *input { case 1: radeonEmitVec4(dst, input[i]->Ptr, input[i]->StrideB, local_count); - context->stream_desc[index].stride = 4; break; case 2: radeonEmitVec8(dst, input[i]->Ptr, input[i]->StrideB, local_count); - context->stream_desc[index].stride = 8; break; case 3: radeonEmitVec12(dst, input[i]->Ptr, input[i]->StrideB, local_count); - context->stream_desc[index].stride = 12; break; case 4: radeonEmitVec16(dst, input[i]->Ptr, input[i]->StrideB, local_count); - context->stream_desc[index].stride = 16; break; default: assert(0); -- cgit v1.2.3 From bec5230a1ff3998d0f184fc2b7437b51082c329f Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Fri, 23 Oct 2009 01:05:23 -0400 Subject: st/xorg: lots of fixes related to compositing fixes transformations, rendering with multiple bound textures, xrender matrix conversions plus some cleanups --- src/gallium/state_trackers/xorg/xorg_composite.c | 12 +- src/gallium/state_trackers/xorg/xorg_exa.c | 17 ++- src/gallium/state_trackers/xorg/xorg_exa_tgsi.c | 2 +- src/gallium/state_trackers/xorg/xorg_renderer.c | 171 ++++++++++++----------- 4 files changed, 109 insertions(+), 93 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index e039bb12b6..7366fa7b85 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -371,15 +371,15 @@ static INLINE boolean matrix_from_pict_transform(PictTransform *trans, float *ma return FALSE; matrix[0] = XFixedToDouble(trans->matrix[0][0]); - matrix[1] = XFixedToDouble(trans->matrix[0][1]); - matrix[2] = XFixedToDouble(trans->matrix[0][2]); + matrix[3] = XFixedToDouble(trans->matrix[0][1]); + matrix[6] = XFixedToDouble(trans->matrix[0][2]); - matrix[3] = XFixedToDouble(trans->matrix[1][0]); + matrix[1] = XFixedToDouble(trans->matrix[1][0]); matrix[4] = XFixedToDouble(trans->matrix[1][1]); - matrix[5] = XFixedToDouble(trans->matrix[1][2]); + matrix[7] = XFixedToDouble(trans->matrix[1][2]); - matrix[6] = XFixedToDouble(trans->matrix[2][0]); - matrix[7] = XFixedToDouble(trans->matrix[2][1]); + matrix[2] = XFixedToDouble(trans->matrix[2][0]); + matrix[5] = XFixedToDouble(trans->matrix[2][1]); matrix[8] = XFixedToDouble(trans->matrix[2][2]); return TRUE; diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index b83d97bdb6..bd97baae2b 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -74,7 +74,7 @@ exa_get_pipe_format(int depth, enum pipe_format *format, int *bbp) assert(*bbp == 16); break; case 8: - *format = PIPE_FORMAT_A8_UNORM; + *format = PIPE_FORMAT_L8_UNORM; assert(*bbp == 8); break; case 4: @@ -145,6 +145,11 @@ ExaDownloadFromScreen(PixmapPtr pPix, int x, int y, int w, int h, char *dst, if (!transfer) return FALSE; +#if DEBUG_PRINT + debug_printf("------ ExaDownloadFromScreen(%d, %d, %d, %d, %d)\n", + x, y, w, h, dst_pitch); +#endif + util_copy_rect((unsigned char*)dst, &priv->tex->block, dst_pitch, 0, 0, w, h, exa->scrn->transfer_map(exa->scrn, transfer), transfer->stride, 0, 0); @@ -174,6 +179,11 @@ ExaUploadToScreen(PixmapPtr pPix, int x, int y, int w, int h, char *src, if (!transfer) return FALSE; +#if DEBUG_PRINT + debug_printf("++++++ ExaUploadToScreen(%d, %d, %d, %d, %d)\n", + x, y, w, h, src_pitch); +#endif + util_copy_rect(exa->scrn->transfer_map(exa->scrn, transfer), &priv->tex->block, transfer->stride, 0, 0, w, h, (unsigned char*)src, src_pitch, 0, 0); @@ -501,7 +511,10 @@ ExaComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pDst); #if DEBUG_PRINT - debug_printf("\tExaComposite(src[%d,%d], mask=[%d, %d], dst=[%d, %d], dim=[%d, %d])\n", srcX, srcY, maskX, maskY, dstX, dstY, width, height); + debug_printf("\tExaComposite(src[%d,%d], mask=[%d, %d], dst=[%d, %d], dim=[%d, %d])\n", + srcX, srcY, maskX, maskY, dstX, dstY, width, height); + debug_printf("\t Num bound samplers = %d\n", + exa->num_bound_samplers); #endif xorg_composite(exa, priv, srcX, srcY, maskX, maskY, diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c index 041f4f96dc..abb00824eb 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c @@ -62,7 +62,7 @@ src_in_mask(struct ureg_program *ureg, } else { ureg_MUL(ureg, dst, src, - ureg_scalar(mask, TGSI_SWIZZLE_W)); + ureg_scalar(mask, TGSI_SWIZZLE_X)); } } diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 393f3fac3e..51941f091c 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -86,41 +86,37 @@ setup_vertex1(float vertex[2][4], float x, float y, float s, float t) static struct pipe_buffer * setup_vertex_data1(struct xorg_renderer *r, - int srcX, int srcY, int dstX, int dstY, - int width, int height, + float srcX, float srcY, float dstX, float dstY, + float width, float height, struct pipe_texture *src, float *src_matrix) { - float s0, t0, s1, t1, stmp, ttmp; + float s0, t0, s1, t1; + float pt0[2], pt1[2]; - s0 = srcX / src->width[0]; - s1 = srcX + width / src->width[0]; - t0 = srcY / src->height[0]; - t1 = srcY + height / src->height[0]; + pt0[0] = srcX; + pt0[1] = srcY; + pt1[0] = (srcX + width); + pt1[1] = (srcY + height); if (src_matrix) { - /* 1st vertex */ - map_point(src_matrix, s0, t0, &stmp, &ttmp); - setup_vertex1(r->vertices2[0], dstX, dstY, stmp, ttmp); - /* 2nd vertex */ - map_point(src_matrix, s1, t0, &stmp, &ttmp); - setup_vertex1(r->vertices2[1], dstX + width, dstY, stmp, ttmp); - /* 3rd vertex */ - map_point(src_matrix, s1, t1, &stmp, &ttmp); - setup_vertex1(r->vertices2[2], dstX + width, dstY + height, stmp, ttmp); - /* 4th vertex */ - map_point(src_matrix, s0, t1, &stmp, &ttmp); - setup_vertex1(r->vertices2[3], dstX, dstY + height, stmp, ttmp); - } else { - /* 1st vertex */ - setup_vertex1(r->vertices2[0], dstX, dstY, s0, t0); - /* 2nd vertex */ - setup_vertex1(r->vertices2[1], dstX + width, dstY, s1, t0); - /* 3rd vertex */ - setup_vertex1(r->vertices2[2], dstX + width, dstY + height, s1, t1); - /* 4th vertex */ - setup_vertex1(r->vertices2[3], dstX, dstY + height, s0, t1); + map_point(src_matrix, pt0[0], pt0[1], &pt0[0], &pt0[1]); + map_point(src_matrix, pt1[0], pt1[1], &pt1[0], &pt1[1]); } + s0 = pt0[0] / src->width[0]; + s1 = pt1[0] / src->width[0]; + t0 = pt0[1] / src->height[0]; + t1 = pt1[1] / src->height[0]; + + /* 1st vertex */ + setup_vertex1(r->vertices2[0], dstX, dstY, s0, t0); + /* 2nd vertex */ + setup_vertex1(r->vertices2[1], dstX + width, dstY, s1, t0); + /* 3rd vertex */ + setup_vertex1(r->vertices2[2], dstX + width, dstY + height, s1, t1); + /* 4th vertex */ + setup_vertex1(r->vertices2[3], dstX, dstY + height, s0, t1); + return pipe_user_buffer_create(r->pipe->screen, r->vertices2, sizeof(r->vertices2)); @@ -168,69 +164,61 @@ setup_vertex2(float vertex[3][4], float x, float y, static struct pipe_buffer * setup_vertex_data2(struct xorg_renderer *r, - int srcX, int srcY, int maskX, int maskY, - int dstX, int dstY, int width, int height, + float srcX, float srcY, float maskX, float maskY, + float dstX, float dstY, float width, float height, struct pipe_texture *src, struct pipe_texture *mask, float *src_matrix, float *mask_matrix) { - float st0[4], st1[4]; - float pt0[2], pt1[2]; + float src_s0, src_t0, src_s1, src_t1; + float mask_s0, mask_t0, mask_s1, mask_t1; + float spt0[2], spt1[2]; + float mpt0[2], mpt1[2]; + + spt0[0] = srcX; + spt0[1] = srcY; + spt1[0] = srcX + width; + spt1[1] = srcY + height; + + mpt0[0] = maskX; + mpt0[1] = maskY; + mpt1[0] = maskX + width; + mpt1[1] = maskY + height; + + if (src_matrix) { + map_point(src_matrix, spt0[0], spt0[1], &spt0[0], &spt0[1]); + map_point(src_matrix, spt1[0], spt1[1], &spt1[0], &spt1[1]); + } - st0[0] = srcX / src->width[0]; - st0[1] = srcY / src->height[0]; - st0[2] = srcX + width / src->width[0]; - st0[3] = srcY + height / src->height[0]; - - st1[0] = maskX / mask->width[0]; - st1[1] = maskY / mask->height[0]; - st1[2] = maskX + width / mask->width[0]; - st1[3] = maskY + height / mask->height[0]; - - if (src_matrix || mask_matrix) { - /* 1st vertex */ - map_point(src_matrix, st0[0], st0[1], - pt0 + 0, pt0 + 1); - map_point(mask_matrix, st1[0], st1[1], - pt1 + 0, pt1 + 1); - setup_vertex2(r->vertices3[0], dstX, dstY, - pt0[0], pt0[1], pt1[0], pt1[1]); - /* 2nd vertex */ - map_point(src_matrix, st0[2], st0[1], - pt0 + 0, pt0 + 1); - map_point(mask_matrix, st1[2], st1[1], - pt1 + 0, pt1 + 1); - setup_vertex2(r->vertices3[1], dstX + width, dstY, - pt0[0], pt0[1], pt1[0], pt1[1]); - /* 3rd vertex */ - map_point(src_matrix, st0[2], st0[3], - pt0 + 0, pt0 + 1); - map_point(mask_matrix, st1[2], st1[3], - pt1 + 0, pt1 + 1); - setup_vertex2(r->vertices3[2], dstX + width, dstY + height, - pt0[0], pt0[1], pt1[0], pt1[1]); - /* 4th vertex */ - map_point(src_matrix, st0[0], st0[3], - pt0 + 0, pt0 + 1); - map_point(mask_matrix, st1[0], st1[3], - pt1 + 0, pt1 + 1); - setup_vertex2(r->vertices3[3], dstX, dstY + height, - pt0[0], pt0[1], pt1[0], pt1[1]); - } else { - /* 1st vertex */ - setup_vertex2(r->vertices3[0], dstX, dstY, - st0[0], st0[1], st1[0], st1[1]); - /* 2nd vertex */ - setup_vertex2(r->vertices3[1], dstX + width, dstY, - st0[2], st0[1], st1[2], st1[1]); - /* 3rd vertex */ - setup_vertex2(r->vertices3[2], dstX + width, dstY + height, - st0[2], st0[3], st1[2], st1[3]); - /* 4th vertex */ - setup_vertex2(r->vertices3[3], dstX, dstY + height, - st0[0], st0[3], st1[0], st1[3]); + if (mask_matrix) { + map_point(mask_matrix, mpt0[0], mpt0[1], &mpt0[0], &mpt0[1]); + map_point(mask_matrix, mpt1[0], mpt1[1], &mpt1[0], &mpt1[1]); } + src_s0 = spt0[0] / src->width[0]; + src_t0 = spt0[1] / src->height[0]; + src_s1 = spt1[0] / src->width[0]; + src_t1 = spt1[1] / src->height[0]; + + mask_s0 = mpt0[0] / mask->width[0]; + mask_t0 = mpt0[1] / mask->height[0]; + mask_s1 = mpt1[0] / mask->width[0]; + mask_t1 = mpt1[1] / mask->height[0]; + + /* 1st vertex */ + setup_vertex2(r->vertices3[0], dstX, dstY, + src_s0, src_t0, mask_s0, mask_t0); + /* 2nd vertex */ + setup_vertex2(r->vertices3[1], dstX + width, dstY, + src_s1, src_t0, mask_s1, mask_t0); + /* 3rd vertex */ + setup_vertex2(r->vertices3[2], dstX + width, dstY + height, + src_s1, src_t1, mask_s1, mask_t1); + /* 4th vertex */ + setup_vertex2(r->vertices3[3], dstX, dstY + height, + src_s0, src_t1, mask_s0, mask_t1); + + return pipe_user_buffer_create(r->pipe->screen, r->vertices3, sizeof(r->vertices3)); @@ -805,6 +793,21 @@ void renderer_draw_textures(struct xorg_renderer *r, struct pipe_context *pipe = r->pipe; struct pipe_buffer *buf = 0; +#if 0 + if (src_matrix) { + debug_printf("src_matrix = \n"); + debug_printf("%f, %f, %f\n", src_matrix[0], src_matrix[1], src_matrix[2]); + debug_printf("%f, %f, %f\n", src_matrix[3], src_matrix[4], src_matrix[5]); + debug_printf("%f, %f, %f\n", src_matrix[6], src_matrix[7], src_matrix[8]); + } + if (mask_matrix) { + debug_printf("mask_matrix = \n"); + debug_printf("%f, %f, %f\n", mask_matrix[0], mask_matrix[1], mask_matrix[2]); + debug_printf("%f, %f, %f\n", mask_matrix[3], mask_matrix[4], mask_matrix[5]); + debug_printf("%f, %f, %f\n", mask_matrix[6], mask_matrix[7], mask_matrix[8]); + } +#endif + switch(num_textures) { case 1: buf = setup_vertex_data1(r, -- cgit v1.2.3 From d7d3fb925b6993740d0126d0d7e678c27f5f1850 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 8 Oct 2009 10:33:32 +0800 Subject: mesa/main: Add support for remap table. This commit only adds the source files. It is supposed to replace the remap table in DRI drivers. Signed-off-by: Chia-I Wu --- src/mesa/glapi/Makefile | 4 + src/mesa/glapi/remap_helper.py | 219 ++ src/mesa/main/mfeatures.h | 6 + src/mesa/main/remap.c | 216 ++ src/mesa/main/remap.h | 87 + src/mesa/main/remap_helper.h | 5884 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 6416 insertions(+) create mode 100644 src/mesa/glapi/remap_helper.py create mode 100644 src/mesa/main/remap.c create mode 100644 src/mesa/main/remap.h create mode 100644 src/mesa/main/remap_helper.h (limited to 'src') diff --git a/src/mesa/glapi/Makefile b/src/mesa/glapi/Makefile index 22f65b74c2..08c376a4b0 100644 --- a/src/mesa/glapi/Makefile +++ b/src/mesa/glapi/Makefile @@ -9,6 +9,7 @@ include $(TOP)/configs/current OUTPUTS = glprocs.h glapitemp.h glapioffsets.h glapitable.h dispatch.h \ ../main/enums.c \ + ../main/remap_helper.h \ ../x86/glapi_x86.S \ ../x86-64/glapi_x86-64.S \ ../sparc/glapi_sparc.S \ @@ -92,6 +93,9 @@ dispatch.h $(GLX_DIR)/dispatch.h: gl_table.py $(COMMON) ../main/enums.c: gl_enums.py $(COMMON) $(PYTHON2) $(PYTHON_FLAGS) $< > $@ +../main/remap_helper.h: remap_helper.py $(COMMON) + $(PYTHON2) $(PYTHON_FLAGS) $< > $@ + ../x86/glapi_x86.S: gl_x86_asm.py $(COMMON) $(PYTHON2) $(PYTHON_FLAGS) $< > $@ diff --git a/src/mesa/glapi/remap_helper.py b/src/mesa/glapi/remap_helper.py new file mode 100644 index 0000000000..7e68a908e3 --- /dev/null +++ b/src/mesa/glapi/remap_helper.py @@ -0,0 +1,219 @@ +#!/usr/bin/env python + +# Copyright (C) 2009 Chia-I Wu +# All Rights Reserved. +# +# This is based on extension_helper.py by Ian Romanick. +# +# 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 +# IBM 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 gl_XML +import license +import sys, getopt, string + +def get_function_spec(func): + sig = "" + # derive parameter signature + for p in func.parameterIterator(): + if p.is_padding: + continue + # FIXME: This is a *really* ugly hack. :( + tn = p.type_expr.get_base_type_node() + if p.is_pointer(): + sig += 'p' + elif tn.integer: + sig += 'i' + elif tn.size == 4: + sig += 'f' + else: + sig += 'd' + + spec = [sig] + for ent in func.entry_points: + spec.append("gl" + ent) + + # spec is terminated by an empty string + spec.append('') + + return spec + +class PrintGlRemap(gl_XML.gl_print_base): + def __init__(self): + gl_XML.gl_print_base.__init__(self) + + self.name = "remap_helper.py (from Mesa)" + self.license = license.bsd_license_template % ("Copyright (C) 2009 Chia-I Wu ", "Chia-I Wu") + return + + + def printRealHeader(self): + print '#include "glapi/dispatch.h"' + print '#include "glapi/glapioffsets.h"' + print '' + return + + + def printBody(self, api): + print 'struct gl_function_remap {' + print ' GLint func_index;' + print ' GLint dispatch_offset; /* for sanity check */' + print '};' + print '' + + pool_indices = {} + + print '/* this is internal to remap.c */' + print '#ifdef need_MESA_remap_table' + print '' + print 'static const char _mesa_function_pool[] =' + + # output string pool + index = 0; + for f in api.functionIterateAll(): + pool_indices[f] = index + + spec = get_function_spec(f) + + # a function has either assigned offset, fixed offset, + # or no offset + if f.assign_offset: + comments = "will be remapped" + elif f.offset > 0: + comments = "offset %d" % f.offset + else: + comments = "dynamic" + + print ' /* _mesa_function_pool[%d]: %s (%s) */' \ + % (index, f.name, comments) + for line in spec: + print ' "%s\\0"' % line + index += len(line) + 1 + print ' ;' + print '' + + print '/* these functions need to be remapped */' + print 'static const struct {' + print ' GLint pool_index;' + print ' GLint remap_index;' + print '} MESA_remap_table_functions[] = {' + # output all functions that need to be remapped + # iterate by offsets so that they are sorted by remap indices + for f in api.functionIterateByOffset(): + if not f.assign_offset: + continue + print ' { %5d, %s_remap_index },' \ + % (pool_indices[f], f.name) + print ' { -1, -1 }' + print '};' + print '' + + abi = [ "1.0", "1.1", "1.2", "GL_ARB_multitexture" ] + extension_functions = {} + + # collect non-ABI functions + for f in api.functionIterateAll(): + for n in f.entry_points: + category, num = api.get_category_for_name(n) + if category not in abi: + c = gl_XML.real_category_name(category) + if not extension_functions.has_key(c): + extension_functions[c] = [] + extension_functions[c].append(f) + extensions = extension_functions.keys() + extensions.sort() + + # output ABI functions that have alternative names (with ext suffix) + print '/* these functions are in the ABI, but have alternative names */' + print 'static const struct gl_function_remap MESA_alt_functions[] = {' + for ext in extensions: + funcs = [] + for f in extension_functions[ext]: + # test if the function is in the ABI + if not f.assign_offset and f.offset >= 0: + funcs.append(f) + if not funcs: + continue + print ' /* from %s */' % ext + for f in funcs: + print ' { %5d, _gloffset_%s },' \ + % (pool_indices[f], f.name) + print ' { -1, -1 }' + print '};' + print '' + + print '#endif /* need_MESA_remap_table */' + print '' + + # output remap helpers for DRI drivers + + for ext in extensions: + funcs = [] + remapped = [] + for f in extension_functions[ext]: + if f.assign_offset: + # these are handled above + remapped.append(f) + else: + # these functions are either in the + # abi, or have offset -1 + funcs.append(f) + + print '#if defined(need_%s)' % (ext) + if remapped: + print '/* functions defined in MESA_remap_table_functions are excluded */' + + # output extension functions that need to be mapped + print 'static const struct gl_function_remap %s_functions[] = {' % (ext) + for f in funcs: + if f.offset >= 0: + print ' { %5d, _gloffset_%s },' \ + % (pool_indices[f], f.name) + else: + print ' { %5d, -1 }, /* %s */' % \ + (pool_indices[f], f.name) + print ' { -1, -1 }' + print '};' + + print '#endif' + print '' + + return + + +def show_usage(): + print "Usage: %s [-f input_file_name]" % sys.argv[0] + sys.exit(1) + +if __name__ == '__main__': + file_name = "gl_API.xml" + + try: + (args, trail) = getopt.getopt(sys.argv[1:], "f:") + except Exception,e: + show_usage() + + for (arg,val) in args: + if arg == "-f": + file_name = val + + api = gl_XML.parse_GL_API( file_name ) + + printer = PrintGlRemap() + printer.Print( api ) diff --git a/src/mesa/main/mfeatures.h b/src/mesa/main/mfeatures.h index c2fb8404b1..4e68bc15d8 100644 --- a/src/mesa/main/mfeatures.h +++ b/src/mesa/main/mfeatures.h @@ -68,6 +68,12 @@ * enabled or not. */ +#ifdef IN_DRI_DRIVER +#define FEATURE_remap_table 1 +#else +#define FEATURE_remap_table 0 +#endif + #define FEATURE_accum _HAVE_FULL_GL #define FEATURE_arrayelt _HAVE_FULL_GL #define FEATURE_attrib_stack _HAVE_FULL_GL diff --git a/src/mesa/main/remap.c b/src/mesa/main/remap.c new file mode 100644 index 0000000000..0385ae8d7d --- /dev/null +++ b/src/mesa/main/remap.c @@ -0,0 +1,216 @@ +/* + * Mesa 3-D graphics library + * Version: 7.7 + * + * Copyright (C) 2009 Chia-I Wu + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/** + * \file remap.c + * Remap table management. + * + * Entries in the dispatch table are either static or dynamic. The + * dispatch table is shared by mesa core and glapi. When they are + * built separately, it is possible that a static entry in mesa core + * is dynamic, or assigned a different static offset, in glapi. The + * remap table is in charge of mapping a static entry in mesa core to + * a dynamic entry, or the corresponding static entry, in glapi. + */ + +#include "remap.h" +#include "imports.h" + +#include "glapi/dispatch.h" + + +#if FEATURE_remap_table + + +#define need_MESA_remap_table +#include "remap_helper.h" + +#define ARRAY_SIZE(a) (sizeof (a) / sizeof ((a)[0])) +#define MAX_ENTRY_POINTS 16 + + +/* this is global for quick access */ +int driDispatchRemapTable[driDispatchRemapTable_size]; + + +/** + * Return the spec string associated with the given function index. + * The index is available from including remap_helper.h. + * + * \param func_index an opaque function index. + * + * \return the spec string associated with the function index, or NULL. + */ +const char * +_mesa_get_function_spec(GLint func_index) +{ + if (func_index < ARRAY_SIZE(_mesa_function_pool)) + return _mesa_function_pool + func_index; + else + return NULL; +} + + +/** + * Map a function by its spec. The function will be added to glapi, + * and the dispatch offset will be returned. + * + * \param spec a '\0'-separated string array specifying a function. + * It begins with the parameter signature of the function, + * followed by the names of the entry points. An empty entry + * point name terminates the array. + * + * \return the offset of the (re-)mapped function in the dispatch + * table, or -1. + */ +GLint +_mesa_map_function_spec(const char *spec) +{ + const char *signature; + const char *names[MAX_ENTRY_POINTS + 1]; + GLint num_names = 0; + + if (!spec) + return -1; + + signature = spec; + spec += strlen(spec) + 1; + + /* spec is terminated by an empty string */ + while (*spec) { + names[num_names] = spec; + num_names++; + if (num_names >= MAX_ENTRY_POINTS) + break; + spec += strlen(spec) + 1; + } + if (!num_names) + return -1; + + names[num_names] = NULL; + + /* add the entry points to the dispatch table */ + return _glapi_add_dispatch(names, signature); +} + + +/** + * Map an array of functions. This is a convenient function for + * use with arrays available from including remap_helper.h. + * + * Note that the dispatch offsets of the functions are not returned. + * If they are needed, _mesa_map_function_spec() should be used. + * + * \param func_array an array of function remaps. + */ +void +_mesa_map_function_array(const struct gl_function_remap *func_array) +{ + GLint i; + + if (!func_array) + return; + + for (i = 0; func_array[i].func_index != -1; i++) { + const char *spec; + GLint offset; + + spec = _mesa_get_function_spec(func_array[i].func_index); + if (!spec) { + _mesa_problem(NULL, "invalid function index %d", + func_array[i].func_index); + continue; + } + + offset = _mesa_map_function_spec(spec); + /* error checks */ + if (offset < 0) { + const char *name = spec + strlen(spec) + 1; + _mesa_warning(NULL, "failed to remap %s", name); + } + else if (func_array[i].dispatch_offset >= 0 && + offset != func_array[i].dispatch_offset) { + const char *name = spec + strlen(spec) + 1; + _mesa_problem(NULL, "%s should be mapped to %d, not %d", + name, func_array[i].dispatch_offset, offset); + } + } +} + + +/** + * Map the functions which are already static. + * + * When a extension function are incorporated into the ABI, the + * extension suffix is usually stripped. Mapping such functions + * makes sure the alternative names are available. + * + * Note that functions mapped by _mesa_init_remap_table() are + * excluded. + */ +void +_mesa_map_static_functions(void) +{ + /* Remap static functions which have alternative names and are in the ABI. + * This is to be on the safe side. glapi should have defined those names. + */ + _mesa_map_function_array(MESA_alt_functions); +} + + +/** + * Initialize the remap table. This is called in one_time_init(). + * The remap table needs to be initialized before calling the + * CALL/GET/SET macros defined in glapi/dispatch.h. + */ +void +_mesa_init_remap_table(void) +{ + static GLboolean initialized = GL_FALSE; + GLint i; + + if (initialized) + return; + initialized = GL_TRUE; + + /* initialize the remap table */ + for (i = 0; i < ARRAY_SIZE(driDispatchRemapTable); i++) { + GLint offset; + const char *spec; + + /* sanity check */ + ASSERT(i == MESA_remap_table_functions[i].remap_index); + spec = _mesa_function_pool + MESA_remap_table_functions[i].pool_index; + + offset = _mesa_map_function_spec(spec); + /* store the dispatch offset in the remap table */ + driDispatchRemapTable[i] = offset; + if (offset < 0) + _mesa_warning(NULL, "failed to remap index %d", i); + } +} + + +#endif /* FEATURE_remap_table */ diff --git a/src/mesa/main/remap.h b/src/mesa/main/remap.h new file mode 100644 index 0000000000..7fb56e3600 --- /dev/null +++ b/src/mesa/main/remap.h @@ -0,0 +1,87 @@ +/* + * Mesa 3-D graphics library + * Version: 7.7 + * + * Copyright (C) 2009 Chia-I Wu + * + * 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 REMAP_H +#define REMAP_H + + +#include "main/mtypes.h" + +struct gl_function_remap; + + +#if FEATURE_remap_table + +extern int +driDispatchRemapTable[]; + +extern const char * +_mesa_get_function_spec(GLint func_index); + +extern GLint +_mesa_map_function_spec(const char *spec); + +extern void +_mesa_map_function_array(const struct gl_function_remap *func_array); + +extern void +_mesa_map_static_functions(void); + +extern void +_mesa_init_remap_table(void); + +#else /* FEATURE_remap_table */ + +static INLINE const char * +_mesa_get_function_spec(GLint func_index) +{ + return NULL; +} + +static INLINE GLint +_mesa_map_function_spec(const char *spec) +{ + return -1; +} + +static INLINE void +_mesa_map_function_array(const struct gl_function_remap *func_array) +{ +} + +static INLINE void +_mesa_map_static_functions(void) +{ +} + +static INLINE void +_mesa_init_remap_table(void) +{ +} + +#endif /* FEATURE_remap_table */ + + +#endif /* REMAP_H */ diff --git a/src/mesa/main/remap_helper.h b/src/mesa/main/remap_helper.h new file mode 100644 index 0000000000..89192d37e5 --- /dev/null +++ b/src/mesa/main/remap_helper.h @@ -0,0 +1,5884 @@ +/* DO NOT EDIT - This file generated automatically by remap_helper.py (from Mesa) script */ + +/* + * Copyright (C) 2009 Chia-I Wu + * 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 + * Chia-I Wu, + * 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 "glapi/dispatch.h" +#include "glapi/glapioffsets.h" + +struct gl_function_remap { + GLint func_index; + GLint dispatch_offset; /* for sanity check */ +}; + +/* this is internal to remap.c */ +#ifdef need_MESA_remap_table + +static const char _mesa_function_pool[] = + /* _mesa_function_pool[0]: MapGrid1d (offset 224) */ + "idd\0" + "glMapGrid1d\0" + "\0" + /* _mesa_function_pool[17]: UniformMatrix3fvARB (will be remapped) */ + "iiip\0" + "glUniformMatrix3fv\0" + "glUniformMatrix3fvARB\0" + "\0" + /* _mesa_function_pool[64]: MapGrid1f (offset 225) */ + "iff\0" + "glMapGrid1f\0" + "\0" + /* _mesa_function_pool[81]: RasterPos4i (offset 82) */ + "iiii\0" + "glRasterPos4i\0" + "\0" + /* _mesa_function_pool[101]: RasterPos4d (offset 78) */ + "dddd\0" + "glRasterPos4d\0" + "\0" + /* _mesa_function_pool[121]: NewList (dynamic) */ + "ii\0" + "glNewList\0" + "\0" + /* _mesa_function_pool[135]: RasterPos4f (offset 80) */ + "ffff\0" + "glRasterPos4f\0" + "\0" + /* _mesa_function_pool[155]: LoadIdentity (offset 290) */ + "\0" + "glLoadIdentity\0" + "\0" + /* _mesa_function_pool[172]: SampleCoverageARB (will be remapped) */ + "fi\0" + "glSampleCoverage\0" + "glSampleCoverageARB\0" + "\0" + /* _mesa_function_pool[213]: ConvolutionFilter1D (offset 348) */ + "iiiiip\0" + "glConvolutionFilter1D\0" + "glConvolutionFilter1DEXT\0" + "\0" + /* _mesa_function_pool[268]: BeginQueryARB (will be remapped) */ + "ii\0" + "glBeginQuery\0" + "glBeginQueryARB\0" + "\0" + /* _mesa_function_pool[301]: RasterPos3dv (offset 71) */ + "p\0" + "glRasterPos3dv\0" + "\0" + /* _mesa_function_pool[319]: PointParameteriNV (will be remapped) */ + "ii\0" + "glPointParameteri\0" + "glPointParameteriNV\0" + "\0" + /* _mesa_function_pool[361]: GetProgramiv (will be remapped) */ + "iip\0" + "glGetProgramiv\0" + "\0" + /* _mesa_function_pool[381]: MultiTexCoord3sARB (offset 398) */ + "iiii\0" + "glMultiTexCoord3s\0" + "glMultiTexCoord3sARB\0" + "\0" + /* _mesa_function_pool[426]: SecondaryColor3iEXT (will be remapped) */ + "iii\0" + "glSecondaryColor3i\0" + "glSecondaryColor3iEXT\0" + "\0" + /* _mesa_function_pool[472]: WindowPos3fMESA (will be remapped) */ + "fff\0" + "glWindowPos3f\0" + "glWindowPos3fARB\0" + "glWindowPos3fMESA\0" + "\0" + /* _mesa_function_pool[526]: TexCoord1iv (offset 99) */ + "p\0" + "glTexCoord1iv\0" + "\0" + /* _mesa_function_pool[543]: TexCoord4sv (offset 125) */ + "p\0" + "glTexCoord4sv\0" + "\0" + /* _mesa_function_pool[560]: RasterPos4s (offset 84) */ + "iiii\0" + "glRasterPos4s\0" + "\0" + /* _mesa_function_pool[580]: PixelTexGenParameterfvSGIS (will be remapped) */ + "ip\0" + "glPixelTexGenParameterfvSGIS\0" + "\0" + /* _mesa_function_pool[613]: ActiveTextureARB (offset 374) */ + "i\0" + "glActiveTexture\0" + "glActiveTextureARB\0" + "\0" + /* _mesa_function_pool[651]: BlitFramebufferEXT (will be remapped) */ + "iiiiiiiiii\0" + "glBlitFramebuffer\0" + "glBlitFramebufferEXT\0" + "\0" + /* _mesa_function_pool[702]: TexCoord1f (offset 96) */ + "f\0" + "glTexCoord1f\0" + "\0" + /* _mesa_function_pool[718]: TexCoord1d (offset 94) */ + "d\0" + "glTexCoord1d\0" + "\0" + /* _mesa_function_pool[734]: VertexAttrib4ubvNV (will be remapped) */ + "ip\0" + "glVertexAttrib4ubvNV\0" + "\0" + /* _mesa_function_pool[759]: TexCoord1i (offset 98) */ + "i\0" + "glTexCoord1i\0" + "\0" + /* _mesa_function_pool[775]: GetProgramNamedParameterdvNV (will be remapped) */ + "iipp\0" + "glGetProgramNamedParameterdvNV\0" + "\0" + /* _mesa_function_pool[812]: Histogram (offset 367) */ + "iiii\0" + "glHistogram\0" + "glHistogramEXT\0" + "\0" + /* _mesa_function_pool[845]: TexCoord1s (offset 100) */ + "i\0" + "glTexCoord1s\0" + "\0" + /* _mesa_function_pool[861]: GetMapfv (offset 267) */ + "iip\0" + "glGetMapfv\0" + "\0" + /* _mesa_function_pool[877]: EvalCoord1f (offset 230) */ + "f\0" + "glEvalCoord1f\0" + "\0" + /* _mesa_function_pool[894]: TexImage4DSGIS (dynamic) */ + "iiiiiiiiiip\0" + "glTexImage4DSGIS\0" + "\0" + /* _mesa_function_pool[924]: PolygonStipple (offset 175) */ + "p\0" + "glPolygonStipple\0" + "\0" + /* _mesa_function_pool[944]: WindowPos2dvMESA (will be remapped) */ + "p\0" + "glWindowPos2dv\0" + "glWindowPos2dvARB\0" + "glWindowPos2dvMESA\0" + "\0" + /* _mesa_function_pool[999]: ReplacementCodeuiColor3fVertex3fvSUN (dynamic) */ + "ppp\0" + "glReplacementCodeuiColor3fVertex3fvSUN\0" + "\0" + /* _mesa_function_pool[1043]: BlendEquationSeparateEXT (will be remapped) */ + "ii\0" + "glBlendEquationSeparate\0" + "glBlendEquationSeparateEXT\0" + "glBlendEquationSeparateATI\0" + "\0" + /* _mesa_function_pool[1125]: ListParameterfSGIX (dynamic) */ + "iif\0" + "glListParameterfSGIX\0" + "\0" + /* _mesa_function_pool[1151]: SecondaryColor3bEXT (will be remapped) */ + "iii\0" + "glSecondaryColor3b\0" + "glSecondaryColor3bEXT\0" + "\0" + /* _mesa_function_pool[1197]: TexCoord4fColor4fNormal3fVertex4fvSUN (dynamic) */ + "pppp\0" + "glTexCoord4fColor4fNormal3fVertex4fvSUN\0" + "\0" + /* _mesa_function_pool[1243]: GetPixelMapfv (offset 271) */ + "ip\0" + "glGetPixelMapfv\0" + "\0" + /* _mesa_function_pool[1263]: Color3uiv (offset 22) */ + "p\0" + "glColor3uiv\0" + "\0" + /* _mesa_function_pool[1278]: IsEnabled (offset 286) */ + "i\0" + "glIsEnabled\0" + "\0" + /* _mesa_function_pool[1293]: VertexAttrib4svNV (will be remapped) */ + "ip\0" + "glVertexAttrib4svNV\0" + "\0" + /* _mesa_function_pool[1317]: EvalCoord2fv (offset 235) */ + "p\0" + "glEvalCoord2fv\0" + "\0" + /* _mesa_function_pool[1335]: GetBufferSubDataARB (will be remapped) */ + "iiip\0" + "glGetBufferSubData\0" + "glGetBufferSubDataARB\0" + "\0" + /* _mesa_function_pool[1382]: BufferSubDataARB (will be remapped) */ + "iiip\0" + "glBufferSubData\0" + "glBufferSubDataARB\0" + "\0" + /* _mesa_function_pool[1423]: TexCoord2fColor4ubVertex3fvSUN (dynamic) */ + "ppp\0" + "glTexCoord2fColor4ubVertex3fvSUN\0" + "\0" + /* _mesa_function_pool[1461]: AttachShader (will be remapped) */ + "ii\0" + "glAttachShader\0" + "\0" + /* _mesa_function_pool[1480]: VertexAttrib2fARB (will be remapped) */ + "iff\0" + "glVertexAttrib2f\0" + "glVertexAttrib2fARB\0" + "\0" + /* _mesa_function_pool[1522]: GetDebugLogLengthMESA (dynamic) */ + "iii\0" + "glGetDebugLogLengthMESA\0" + "\0" + /* _mesa_function_pool[1551]: GetMapiv (offset 268) */ + "iip\0" + "glGetMapiv\0" + "\0" + /* _mesa_function_pool[1567]: VertexAttrib3fARB (will be remapped) */ + "ifff\0" + "glVertexAttrib3f\0" + "glVertexAttrib3fARB\0" + "\0" + /* _mesa_function_pool[1610]: Indexubv (offset 316) */ + "p\0" + "glIndexubv\0" + "\0" + /* _mesa_function_pool[1624]: GetQueryivARB (will be remapped) */ + "iip\0" + "glGetQueryiv\0" + "glGetQueryivARB\0" + "\0" + /* _mesa_function_pool[1658]: TexImage3D (offset 371) */ + "iiiiiiiiip\0" + "glTexImage3D\0" + "glTexImage3DEXT\0" + "\0" + /* _mesa_function_pool[1699]: ReplacementCodeuiVertex3fvSUN (dynamic) */ + "pp\0" + "glReplacementCodeuiVertex3fvSUN\0" + "\0" + /* _mesa_function_pool[1735]: EdgeFlagPointer (offset 312) */ + "ip\0" + "glEdgeFlagPointer\0" + "\0" + /* _mesa_function_pool[1757]: Color3ubv (offset 20) */ + "p\0" + "glColor3ubv\0" + "\0" + /* _mesa_function_pool[1772]: GetQueryObjectivARB (will be remapped) */ + "iip\0" + "glGetQueryObjectiv\0" + "glGetQueryObjectivARB\0" + "\0" + /* _mesa_function_pool[1818]: Vertex3dv (offset 135) */ + "p\0" + "glVertex3dv\0" + "\0" + /* _mesa_function_pool[1833]: ReplacementCodeuiTexCoord2fVertex3fvSUN (dynamic) */ + "ppp\0" + "glReplacementCodeuiTexCoord2fVertex3fvSUN\0" + "\0" + /* _mesa_function_pool[1880]: CompressedTexSubImage2DARB (will be remapped) */ + "iiiiiiiip\0" + "glCompressedTexSubImage2D\0" + "glCompressedTexSubImage2DARB\0" + "\0" + /* _mesa_function_pool[1946]: CombinerOutputNV (will be remapped) */ + "iiiiiiiiii\0" + "glCombinerOutputNV\0" + "\0" + /* _mesa_function_pool[1977]: VertexAttribs3fvNV (will be remapped) */ + "iip\0" + "glVertexAttribs3fvNV\0" + "\0" + /* _mesa_function_pool[2003]: Uniform2fARB (will be remapped) */ + "iff\0" + "glUniform2f\0" + "glUniform2fARB\0" + "\0" + /* _mesa_function_pool[2035]: LightModeliv (offset 166) */ + "ip\0" + "glLightModeliv\0" + "\0" + /* _mesa_function_pool[2054]: VertexAttrib1svARB (will be remapped) */ + "ip\0" + "glVertexAttrib1sv\0" + "glVertexAttrib1svARB\0" + "\0" + /* _mesa_function_pool[2097]: VertexAttribs1dvNV (will be remapped) */ + "iip\0" + "glVertexAttribs1dvNV\0" + "\0" + /* _mesa_function_pool[2123]: Uniform2ivARB (will be remapped) */ + "iip\0" + "glUniform2iv\0" + "glUniform2ivARB\0" + "\0" + /* _mesa_function_pool[2157]: GetImageTransformParameterfvHP (dynamic) */ + "iip\0" + "glGetImageTransformParameterfvHP\0" + "\0" + /* _mesa_function_pool[2195]: Normal3bv (offset 53) */ + "p\0" + "glNormal3bv\0" + "\0" + /* _mesa_function_pool[2210]: TexGeniv (offset 193) */ + "iip\0" + "glTexGeniv\0" + "\0" + /* _mesa_function_pool[2226]: WeightubvARB (dynamic) */ + "ip\0" + "glWeightubvARB\0" + "\0" + /* _mesa_function_pool[2245]: VertexAttrib1fvNV (will be remapped) */ + "ip\0" + "glVertexAttrib1fvNV\0" + "\0" + /* _mesa_function_pool[2269]: Vertex3iv (offset 139) */ + "p\0" + "glVertex3iv\0" + "\0" + /* _mesa_function_pool[2284]: CopyConvolutionFilter1D (offset 354) */ + "iiiii\0" + "glCopyConvolutionFilter1D\0" + "glCopyConvolutionFilter1DEXT\0" + "\0" + /* _mesa_function_pool[2346]: ReplacementCodeuiNormal3fVertex3fSUN (dynamic) */ + "iffffff\0" + "glReplacementCodeuiNormal3fVertex3fSUN\0" + "\0" + /* _mesa_function_pool[2394]: DeleteSync (will be remapped) */ + "i\0" + "glDeleteSync\0" + "\0" + /* _mesa_function_pool[2410]: FragmentMaterialfvSGIX (dynamic) */ + "iip\0" + "glFragmentMaterialfvSGIX\0" + "\0" + /* _mesa_function_pool[2440]: BlendColor (offset 336) */ + "ffff\0" + "glBlendColor\0" + "glBlendColorEXT\0" + "\0" + /* _mesa_function_pool[2475]: UniformMatrix4fvARB (will be remapped) */ + "iiip\0" + "glUniformMatrix4fv\0" + "glUniformMatrix4fvARB\0" + "\0" + /* _mesa_function_pool[2522]: DeleteVertexArraysAPPLE (will be remapped) */ + "ip\0" + "glDeleteVertexArrays\0" + "glDeleteVertexArraysAPPLE\0" + "\0" + /* _mesa_function_pool[2573]: ReadInstrumentsSGIX (dynamic) */ + "i\0" + "glReadInstrumentsSGIX\0" + "\0" + /* _mesa_function_pool[2598]: CallLists (offset 3) */ + "iip\0" + "glCallLists\0" + "\0" + /* _mesa_function_pool[2615]: UniformMatrix2x4fv (will be remapped) */ + "iiip\0" + "glUniformMatrix2x4fv\0" + "\0" + /* _mesa_function_pool[2642]: Color4ubVertex3fvSUN (dynamic) */ + "pp\0" + "glColor4ubVertex3fvSUN\0" + "\0" + /* _mesa_function_pool[2669]: Normal3iv (offset 59) */ + "p\0" + "glNormal3iv\0" + "\0" + /* _mesa_function_pool[2684]: PassThrough (offset 199) */ + "f\0" + "glPassThrough\0" + "\0" + /* _mesa_function_pool[2701]: FramebufferTextureLayerEXT (will be remapped) */ + "iiiii\0" + "glFramebufferTextureLayer\0" + "glFramebufferTextureLayerEXT\0" + "\0" + /* _mesa_function_pool[2763]: GetListParameterfvSGIX (dynamic) */ + "iip\0" + "glGetListParameterfvSGIX\0" + "\0" + /* _mesa_function_pool[2793]: Viewport (offset 305) */ + "iiii\0" + "glViewport\0" + "\0" + /* _mesa_function_pool[2810]: VertexAttrib4NusvARB (will be remapped) */ + "ip\0" + "glVertexAttrib4Nusv\0" + "glVertexAttrib4NusvARB\0" + "\0" + /* _mesa_function_pool[2857]: WindowPos4svMESA (will be remapped) */ + "p\0" + "glWindowPos4svMESA\0" + "\0" + /* _mesa_function_pool[2879]: CreateProgramObjectARB (will be remapped) */ + "\0" + "glCreateProgramObjectARB\0" + "\0" + /* _mesa_function_pool[2906]: FragmentLightModelivSGIX (dynamic) */ + "ip\0" + "glFragmentLightModelivSGIX\0" + "\0" + /* _mesa_function_pool[2937]: UniformMatrix4x3fv (will be remapped) */ + "iiip\0" + "glUniformMatrix4x3fv\0" + "\0" + /* _mesa_function_pool[2964]: PrioritizeTextures (offset 331) */ + "ipp\0" + "glPrioritizeTextures\0" + "glPrioritizeTexturesEXT\0" + "\0" + /* _mesa_function_pool[3014]: AsyncMarkerSGIX (dynamic) */ + "i\0" + "glAsyncMarkerSGIX\0" + "\0" + /* _mesa_function_pool[3035]: GlobalAlphaFactorubSUN (dynamic) */ + "i\0" + "glGlobalAlphaFactorubSUN\0" + "\0" + /* _mesa_function_pool[3063]: ClearDebugLogMESA (dynamic) */ + "iii\0" + "glClearDebugLogMESA\0" + "\0" + /* _mesa_function_pool[3088]: ResetHistogram (offset 369) */ + "i\0" + "glResetHistogram\0" + "glResetHistogramEXT\0" + "\0" + /* _mesa_function_pool[3128]: GetProgramNamedParameterfvNV (will be remapped) */ + "iipp\0" + "glGetProgramNamedParameterfvNV\0" + "\0" + /* _mesa_function_pool[3165]: PointParameterfEXT (will be remapped) */ + "if\0" + "glPointParameterf\0" + "glPointParameterfARB\0" + "glPointParameterfEXT\0" + "glPointParameterfSGIS\0" + "\0" + /* _mesa_function_pool[3251]: LoadIdentityDeformationMapSGIX (dynamic) */ + "i\0" + "glLoadIdentityDeformationMapSGIX\0" + "\0" + /* _mesa_function_pool[3287]: GenFencesNV (will be remapped) */ + "ip\0" + "glGenFencesNV\0" + "\0" + /* _mesa_function_pool[3305]: ImageTransformParameterfHP (dynamic) */ + "iif\0" + "glImageTransformParameterfHP\0" + "\0" + /* _mesa_function_pool[3339]: MatrixIndexusvARB (dynamic) */ + "ip\0" + "glMatrixIndexusvARB\0" + "\0" + /* _mesa_function_pool[3363]: DrawElementsBaseVertex (will be remapped) */ + "iiipi\0" + "glDrawElementsBaseVertex\0" + "\0" + /* _mesa_function_pool[3395]: DisableVertexAttribArrayARB (will be remapped) */ + "i\0" + "glDisableVertexAttribArray\0" + "glDisableVertexAttribArrayARB\0" + "\0" + /* _mesa_function_pool[3455]: TexCoord2sv (offset 109) */ + "p\0" + "glTexCoord2sv\0" + "\0" + /* _mesa_function_pool[3472]: Vertex4dv (offset 143) */ + "p\0" + "glVertex4dv\0" + "\0" + /* _mesa_function_pool[3487]: StencilMaskSeparate (will be remapped) */ + "ii\0" + "glStencilMaskSeparate\0" + "\0" + /* _mesa_function_pool[3513]: ProgramLocalParameter4dARB (will be remapped) */ + "iidddd\0" + "glProgramLocalParameter4dARB\0" + "\0" + /* _mesa_function_pool[3550]: CompressedTexImage3DARB (will be remapped) */ + "iiiiiiiip\0" + "glCompressedTexImage3D\0" + "glCompressedTexImage3DARB\0" + "\0" + /* _mesa_function_pool[3610]: Color3sv (offset 18) */ + "p\0" + "glColor3sv\0" + "\0" + /* _mesa_function_pool[3624]: GetConvolutionParameteriv (offset 358) */ + "iip\0" + "glGetConvolutionParameteriv\0" + "glGetConvolutionParameterivEXT\0" + "\0" + /* _mesa_function_pool[3688]: VertexAttrib1fARB (will be remapped) */ + "if\0" + "glVertexAttrib1f\0" + "glVertexAttrib1fARB\0" + "\0" + /* _mesa_function_pool[3729]: Vertex2dv (offset 127) */ + "p\0" + "glVertex2dv\0" + "\0" + /* _mesa_function_pool[3744]: TestFenceNV (will be remapped) */ + "i\0" + "glTestFenceNV\0" + "\0" + /* _mesa_function_pool[3761]: MultiTexCoord1fvARB (offset 379) */ + "ip\0" + "glMultiTexCoord1fv\0" + "glMultiTexCoord1fvARB\0" + "\0" + /* _mesa_function_pool[3806]: TexCoord3iv (offset 115) */ + "p\0" + "glTexCoord3iv\0" + "\0" + /* _mesa_function_pool[3823]: ColorFragmentOp2ATI (will be remapped) */ + "iiiiiiiiii\0" + "glColorFragmentOp2ATI\0" + "\0" + /* _mesa_function_pool[3857]: SecondaryColorPointerListIBM (dynamic) */ + "iiipi\0" + "glSecondaryColorPointerListIBM\0" + "\0" + /* _mesa_function_pool[3895]: GetPixelTexGenParameterivSGIS (will be remapped) */ + "ip\0" + "glGetPixelTexGenParameterivSGIS\0" + "\0" + /* _mesa_function_pool[3931]: Color3fv (offset 14) */ + "p\0" + "glColor3fv\0" + "\0" + /* _mesa_function_pool[3945]: VertexAttrib4fNV (will be remapped) */ + "iffff\0" + "glVertexAttrib4fNV\0" + "\0" + /* _mesa_function_pool[3971]: ReplacementCodeubSUN (dynamic) */ + "i\0" + "glReplacementCodeubSUN\0" + "\0" + /* _mesa_function_pool[3997]: FinishAsyncSGIX (dynamic) */ + "p\0" + "glFinishAsyncSGIX\0" + "\0" + /* _mesa_function_pool[4018]: GetDebugLogMESA (dynamic) */ + "iiiipp\0" + "glGetDebugLogMESA\0" + "\0" + /* _mesa_function_pool[4044]: FogCoorddEXT (will be remapped) */ + "d\0" + "glFogCoordd\0" + "glFogCoorddEXT\0" + "\0" + /* _mesa_function_pool[4074]: Color4ubVertex3fSUN (dynamic) */ + "iiiifff\0" + "glColor4ubVertex3fSUN\0" + "\0" + /* _mesa_function_pool[4105]: FogCoordfEXT (will be remapped) */ + "f\0" + "glFogCoordf\0" + "glFogCoordfEXT\0" + "\0" + /* _mesa_function_pool[4135]: PointSize (offset 173) */ + "f\0" + "glPointSize\0" + "\0" + /* _mesa_function_pool[4150]: TexCoord2fVertex3fSUN (dynamic) */ + "fffff\0" + "glTexCoord2fVertex3fSUN\0" + "\0" + /* _mesa_function_pool[4181]: PopName (offset 200) */ + "\0" + "glPopName\0" + "\0" + /* _mesa_function_pool[4193]: GlobalAlphaFactoriSUN (dynamic) */ + "i\0" + "glGlobalAlphaFactoriSUN\0" + "\0" + /* _mesa_function_pool[4220]: VertexAttrib2dNV (will be remapped) */ + "idd\0" + "glVertexAttrib2dNV\0" + "\0" + /* _mesa_function_pool[4244]: GetProgramInfoLog (will be remapped) */ + "iipp\0" + "glGetProgramInfoLog\0" + "\0" + /* _mesa_function_pool[4270]: VertexAttrib4NbvARB (will be remapped) */ + "ip\0" + "glVertexAttrib4Nbv\0" + "glVertexAttrib4NbvARB\0" + "\0" + /* _mesa_function_pool[4315]: GetActiveAttribARB (will be remapped) */ + "iiipppp\0" + "glGetActiveAttrib\0" + "glGetActiveAttribARB\0" + "\0" + /* _mesa_function_pool[4363]: Vertex4sv (offset 149) */ + "p\0" + "glVertex4sv\0" + "\0" + /* _mesa_function_pool[4378]: VertexAttrib4ubNV (will be remapped) */ + "iiiii\0" + "glVertexAttrib4ubNV\0" + "\0" + /* _mesa_function_pool[4405]: TextureRangeAPPLE (will be remapped) */ + "iip\0" + "glTextureRangeAPPLE\0" + "\0" + /* _mesa_function_pool[4430]: GetTexEnvfv (offset 276) */ + "iip\0" + "glGetTexEnvfv\0" + "\0" + /* _mesa_function_pool[4449]: TexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */ + "ffffffffffff\0" + "glTexCoord2fColor4fNormal3fVertex3fSUN\0" + "\0" + /* _mesa_function_pool[4502]: Indexub (offset 315) */ + "i\0" + "glIndexub\0" + "\0" + /* _mesa_function_pool[4515]: TexEnvi (offset 186) */ + "iii\0" + "glTexEnvi\0" + "\0" + /* _mesa_function_pool[4530]: GetClipPlane (offset 259) */ + "ip\0" + "glGetClipPlane\0" + "\0" + /* _mesa_function_pool[4549]: CombinerParameterfvNV (will be remapped) */ + "ip\0" + "glCombinerParameterfvNV\0" + "\0" + /* _mesa_function_pool[4577]: VertexAttribs3dvNV (will be remapped) */ + "iip\0" + "glVertexAttribs3dvNV\0" + "\0" + /* _mesa_function_pool[4603]: VertexAttribs4fvNV (will be remapped) */ + "iip\0" + "glVertexAttribs4fvNV\0" + "\0" + /* _mesa_function_pool[4629]: VertexArrayRangeNV (will be remapped) */ + "ip\0" + "glVertexArrayRangeNV\0" + "\0" + /* _mesa_function_pool[4654]: FragmentLightiSGIX (dynamic) */ + "iii\0" + "glFragmentLightiSGIX\0" + "\0" + /* _mesa_function_pool[4680]: PolygonOffsetEXT (will be remapped) */ + "ff\0" + "glPolygonOffsetEXT\0" + "\0" + /* _mesa_function_pool[4703]: PollAsyncSGIX (dynamic) */ + "p\0" + "glPollAsyncSGIX\0" + "\0" + /* _mesa_function_pool[4722]: DeleteFragmentShaderATI (will be remapped) */ + "i\0" + "glDeleteFragmentShaderATI\0" + "\0" + /* _mesa_function_pool[4751]: Scaled (offset 301) */ + "ddd\0" + "glScaled\0" + "\0" + /* _mesa_function_pool[4765]: Scalef (offset 302) */ + "fff\0" + "glScalef\0" + "\0" + /* _mesa_function_pool[4779]: TexCoord2fNormal3fVertex3fvSUN (dynamic) */ + "ppp\0" + "glTexCoord2fNormal3fVertex3fvSUN\0" + "\0" + /* _mesa_function_pool[4817]: MultTransposeMatrixdARB (will be remapped) */ + "p\0" + "glMultTransposeMatrixd\0" + "glMultTransposeMatrixdARB\0" + "\0" + /* _mesa_function_pool[4869]: AlphaFunc (offset 240) */ + "if\0" + "glAlphaFunc\0" + "\0" + /* _mesa_function_pool[4885]: WindowPos2svMESA (will be remapped) */ + "p\0" + "glWindowPos2sv\0" + "glWindowPos2svARB\0" + "glWindowPos2svMESA\0" + "\0" + /* _mesa_function_pool[4940]: EdgeFlag (offset 41) */ + "i\0" + "glEdgeFlag\0" + "\0" + /* _mesa_function_pool[4954]: TexCoord2iv (offset 107) */ + "p\0" + "glTexCoord2iv\0" + "\0" + /* _mesa_function_pool[4971]: CompressedTexImage1DARB (will be remapped) */ + "iiiiiip\0" + "glCompressedTexImage1D\0" + "glCompressedTexImage1DARB\0" + "\0" + /* _mesa_function_pool[5029]: Rotated (offset 299) */ + "dddd\0" + "glRotated\0" + "\0" + /* _mesa_function_pool[5045]: VertexAttrib2sNV (will be remapped) */ + "iii\0" + "glVertexAttrib2sNV\0" + "\0" + /* _mesa_function_pool[5069]: ReadPixels (offset 256) */ + "iiiiiip\0" + "glReadPixels\0" + "\0" + /* _mesa_function_pool[5091]: EdgeFlagv (offset 42) */ + "p\0" + "glEdgeFlagv\0" + "\0" + /* _mesa_function_pool[5106]: NormalPointerListIBM (dynamic) */ + "iipi\0" + "glNormalPointerListIBM\0" + "\0" + /* _mesa_function_pool[5135]: IndexPointerEXT (will be remapped) */ + "iiip\0" + "glIndexPointerEXT\0" + "\0" + /* _mesa_function_pool[5159]: Color4iv (offset 32) */ + "p\0" + "glColor4iv\0" + "\0" + /* _mesa_function_pool[5173]: TexParameterf (offset 178) */ + "iif\0" + "glTexParameterf\0" + "\0" + /* _mesa_function_pool[5194]: TexParameteri (offset 180) */ + "iii\0" + "glTexParameteri\0" + "\0" + /* _mesa_function_pool[5215]: NormalPointerEXT (will be remapped) */ + "iiip\0" + "glNormalPointerEXT\0" + "\0" + /* _mesa_function_pool[5240]: MultiTexCoord3dARB (offset 392) */ + "iddd\0" + "glMultiTexCoord3d\0" + "glMultiTexCoord3dARB\0" + "\0" + /* _mesa_function_pool[5285]: MultiTexCoord2iARB (offset 388) */ + "iii\0" + "glMultiTexCoord2i\0" + "glMultiTexCoord2iARB\0" + "\0" + /* _mesa_function_pool[5329]: DrawPixels (offset 257) */ + "iiiip\0" + "glDrawPixels\0" + "\0" + /* _mesa_function_pool[5349]: ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (dynamic) */ + "iffffffff\0" + "glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN\0" + "\0" + /* _mesa_function_pool[5409]: MultiTexCoord2svARB (offset 391) */ + "ip\0" + "glMultiTexCoord2sv\0" + "glMultiTexCoord2svARB\0" + "\0" + /* _mesa_function_pool[5454]: ReplacementCodeubvSUN (dynamic) */ + "p\0" + "glReplacementCodeubvSUN\0" + "\0" + /* _mesa_function_pool[5481]: Uniform3iARB (will be remapped) */ + "iiii\0" + "glUniform3i\0" + "glUniform3iARB\0" + "\0" + /* _mesa_function_pool[5514]: GetFragmentMaterialfvSGIX (dynamic) */ + "iip\0" + "glGetFragmentMaterialfvSGIX\0" + "\0" + /* _mesa_function_pool[5547]: GetShaderInfoLog (will be remapped) */ + "iipp\0" + "glGetShaderInfoLog\0" + "\0" + /* _mesa_function_pool[5572]: WeightivARB (dynamic) */ + "ip\0" + "glWeightivARB\0" + "\0" + /* _mesa_function_pool[5590]: PollInstrumentsSGIX (dynamic) */ + "p\0" + "glPollInstrumentsSGIX\0" + "\0" + /* _mesa_function_pool[5615]: GlobalAlphaFactordSUN (dynamic) */ + "d\0" + "glGlobalAlphaFactordSUN\0" + "\0" + /* _mesa_function_pool[5642]: GetFinalCombinerInputParameterfvNV (will be remapped) */ + "iip\0" + "glGetFinalCombinerInputParameterfvNV\0" + "\0" + /* _mesa_function_pool[5684]: GenerateMipmapEXT (will be remapped) */ + "i\0" + "glGenerateMipmap\0" + "glGenerateMipmapEXT\0" + "\0" + /* _mesa_function_pool[5724]: GenLists (offset 5) */ + "i\0" + "glGenLists\0" + "\0" + /* _mesa_function_pool[5738]: SetFragmentShaderConstantATI (will be remapped) */ + "ip\0" + "glSetFragmentShaderConstantATI\0" + "\0" + /* _mesa_function_pool[5773]: GetMapAttribParameterivNV (dynamic) */ + "iiip\0" + "glGetMapAttribParameterivNV\0" + "\0" + /* _mesa_function_pool[5807]: CreateShaderObjectARB (will be remapped) */ + "i\0" + "glCreateShaderObjectARB\0" + "\0" + /* _mesa_function_pool[5834]: GetSharpenTexFuncSGIS (dynamic) */ + "ip\0" + "glGetSharpenTexFuncSGIS\0" + "\0" + /* _mesa_function_pool[5862]: BufferDataARB (will be remapped) */ + "iipi\0" + "glBufferData\0" + "glBufferDataARB\0" + "\0" + /* _mesa_function_pool[5897]: FlushVertexArrayRangeNV (will be remapped) */ + "\0" + "glFlushVertexArrayRangeNV\0" + "\0" + /* _mesa_function_pool[5925]: MapGrid2d (offset 226) */ + "iddidd\0" + "glMapGrid2d\0" + "\0" + /* _mesa_function_pool[5945]: MapGrid2f (offset 227) */ + "iffiff\0" + "glMapGrid2f\0" + "\0" + /* _mesa_function_pool[5965]: SampleMapATI (will be remapped) */ + "iii\0" + "glSampleMapATI\0" + "\0" + /* _mesa_function_pool[5985]: VertexPointerEXT (will be remapped) */ + "iiiip\0" + "glVertexPointerEXT\0" + "\0" + /* _mesa_function_pool[6011]: GetTexFilterFuncSGIS (dynamic) */ + "iip\0" + "glGetTexFilterFuncSGIS\0" + "\0" + /* _mesa_function_pool[6039]: Scissor (offset 176) */ + "iiii\0" + "glScissor\0" + "\0" + /* _mesa_function_pool[6055]: Fogf (offset 153) */ + "if\0" + "glFogf\0" + "\0" + /* _mesa_function_pool[6066]: GetCombinerOutputParameterfvNV (will be remapped) */ + "iiip\0" + "glGetCombinerOutputParameterfvNV\0" + "\0" + /* _mesa_function_pool[6105]: TexSubImage1D (offset 332) */ + "iiiiiip\0" + "glTexSubImage1D\0" + "glTexSubImage1DEXT\0" + "\0" + /* _mesa_function_pool[6149]: VertexAttrib1sARB (will be remapped) */ + "ii\0" + "glVertexAttrib1s\0" + "glVertexAttrib1sARB\0" + "\0" + /* _mesa_function_pool[6190]: FenceSync (will be remapped) */ + "ii\0" + "glFenceSync\0" + "\0" + /* _mesa_function_pool[6206]: Color4usv (offset 40) */ + "p\0" + "glColor4usv\0" + "\0" + /* _mesa_function_pool[6221]: Fogi (offset 155) */ + "ii\0" + "glFogi\0" + "\0" + /* _mesa_function_pool[6232]: DepthRange (offset 288) */ + "dd\0" + "glDepthRange\0" + "\0" + /* _mesa_function_pool[6249]: RasterPos3iv (offset 75) */ + "p\0" + "glRasterPos3iv\0" + "\0" + /* _mesa_function_pool[6267]: FinalCombinerInputNV (will be remapped) */ + "iiii\0" + "glFinalCombinerInputNV\0" + "\0" + /* _mesa_function_pool[6296]: TexCoord2i (offset 106) */ + "ii\0" + "glTexCoord2i\0" + "\0" + /* _mesa_function_pool[6313]: PixelMapfv (offset 251) */ + "iip\0" + "glPixelMapfv\0" + "\0" + /* _mesa_function_pool[6331]: Color4ui (offset 37) */ + "iiii\0" + "glColor4ui\0" + "\0" + /* _mesa_function_pool[6348]: RasterPos3s (offset 76) */ + "iii\0" + "glRasterPos3s\0" + "\0" + /* _mesa_function_pool[6367]: Color3usv (offset 24) */ + "p\0" + "glColor3usv\0" + "\0" + /* _mesa_function_pool[6382]: FlushRasterSGIX (dynamic) */ + "\0" + "glFlushRasterSGIX\0" + "\0" + /* _mesa_function_pool[6402]: TexCoord2f (offset 104) */ + "ff\0" + "glTexCoord2f\0" + "\0" + /* _mesa_function_pool[6419]: ReplacementCodeuiTexCoord2fVertex3fSUN (dynamic) */ + "ifffff\0" + "glReplacementCodeuiTexCoord2fVertex3fSUN\0" + "\0" + /* _mesa_function_pool[6468]: TexCoord2d (offset 102) */ + "dd\0" + "glTexCoord2d\0" + "\0" + /* _mesa_function_pool[6485]: RasterPos3d (offset 70) */ + "ddd\0" + "glRasterPos3d\0" + "\0" + /* _mesa_function_pool[6504]: RasterPos3f (offset 72) */ + "fff\0" + "glRasterPos3f\0" + "\0" + /* _mesa_function_pool[6523]: Uniform1fARB (will be remapped) */ + "if\0" + "glUniform1f\0" + "glUniform1fARB\0" + "\0" + /* _mesa_function_pool[6554]: AreTexturesResident (offset 322) */ + "ipp\0" + "glAreTexturesResident\0" + "glAreTexturesResidentEXT\0" + "\0" + /* _mesa_function_pool[6606]: TexCoord2s (offset 108) */ + "ii\0" + "glTexCoord2s\0" + "\0" + /* _mesa_function_pool[6623]: StencilOpSeparate (will be remapped) */ + "iiii\0" + "glStencilOpSeparate\0" + "glStencilOpSeparateATI\0" + "\0" + /* _mesa_function_pool[6672]: ColorTableParameteriv (offset 341) */ + "iip\0" + "glColorTableParameteriv\0" + "glColorTableParameterivSGI\0" + "\0" + /* _mesa_function_pool[6728]: FogCoordPointerListIBM (dynamic) */ + "iipi\0" + "glFogCoordPointerListIBM\0" + "\0" + /* _mesa_function_pool[6759]: WindowPos3dMESA (will be remapped) */ + "ddd\0" + "glWindowPos3d\0" + "glWindowPos3dARB\0" + "glWindowPos3dMESA\0" + "\0" + /* _mesa_function_pool[6813]: Color4us (offset 39) */ + "iiii\0" + "glColor4us\0" + "\0" + /* _mesa_function_pool[6830]: PointParameterfvEXT (will be remapped) */ + "ip\0" + "glPointParameterfv\0" + "glPointParameterfvARB\0" + "glPointParameterfvEXT\0" + "glPointParameterfvSGIS\0" + "\0" + /* _mesa_function_pool[6920]: Color3bv (offset 10) */ + "p\0" + "glColor3bv\0" + "\0" + /* _mesa_function_pool[6934]: WindowPos2fvMESA (will be remapped) */ + "p\0" + "glWindowPos2fv\0" + "glWindowPos2fvARB\0" + "glWindowPos2fvMESA\0" + "\0" + /* _mesa_function_pool[6989]: SecondaryColor3bvEXT (will be remapped) */ + "p\0" + "glSecondaryColor3bv\0" + "glSecondaryColor3bvEXT\0" + "\0" + /* _mesa_function_pool[7035]: VertexPointerListIBM (dynamic) */ + "iiipi\0" + "glVertexPointerListIBM\0" + "\0" + /* _mesa_function_pool[7065]: GetProgramLocalParameterfvARB (will be remapped) */ + "iip\0" + "glGetProgramLocalParameterfvARB\0" + "\0" + /* _mesa_function_pool[7102]: FragmentMaterialfSGIX (dynamic) */ + "iif\0" + "glFragmentMaterialfSGIX\0" + "\0" + /* _mesa_function_pool[7131]: TexCoord2fNormal3fVertex3fSUN (dynamic) */ + "ffffffff\0" + "glTexCoord2fNormal3fVertex3fSUN\0" + "\0" + /* _mesa_function_pool[7173]: RenderbufferStorageEXT (will be remapped) */ + "iiii\0" + "glRenderbufferStorage\0" + "glRenderbufferStorageEXT\0" + "\0" + /* _mesa_function_pool[7226]: IsFenceNV (will be remapped) */ + "i\0" + "glIsFenceNV\0" + "\0" + /* _mesa_function_pool[7241]: AttachObjectARB (will be remapped) */ + "ii\0" + "glAttachObjectARB\0" + "\0" + /* _mesa_function_pool[7263]: GetFragmentLightivSGIX (dynamic) */ + "iip\0" + "glGetFragmentLightivSGIX\0" + "\0" + /* _mesa_function_pool[7293]: UniformMatrix2fvARB (will be remapped) */ + "iiip\0" + "glUniformMatrix2fv\0" + "glUniformMatrix2fvARB\0" + "\0" + /* _mesa_function_pool[7340]: MultiTexCoord2fARB (offset 386) */ + "iff\0" + "glMultiTexCoord2f\0" + "glMultiTexCoord2fARB\0" + "\0" + /* _mesa_function_pool[7384]: ColorTable (offset 339) */ + "iiiiip\0" + "glColorTable\0" + "glColorTableSGI\0" + "glColorTableEXT\0" + "\0" + /* _mesa_function_pool[7437]: IndexPointer (offset 314) */ + "iip\0" + "glIndexPointer\0" + "\0" + /* _mesa_function_pool[7457]: Accum (offset 213) */ + "if\0" + "glAccum\0" + "\0" + /* _mesa_function_pool[7469]: GetTexImage (offset 281) */ + "iiiip\0" + "glGetTexImage\0" + "\0" + /* _mesa_function_pool[7490]: MapControlPointsNV (dynamic) */ + "iiiiiiiip\0" + "glMapControlPointsNV\0" + "\0" + /* _mesa_function_pool[7522]: ConvolutionFilter2D (offset 349) */ + "iiiiiip\0" + "glConvolutionFilter2D\0" + "glConvolutionFilter2DEXT\0" + "\0" + /* _mesa_function_pool[7578]: Finish (offset 216) */ + "\0" + "glFinish\0" + "\0" + /* _mesa_function_pool[7589]: MapParameterfvNV (dynamic) */ + "iip\0" + "glMapParameterfvNV\0" + "\0" + /* _mesa_function_pool[7613]: ClearStencil (offset 207) */ + "i\0" + "glClearStencil\0" + "\0" + /* _mesa_function_pool[7631]: VertexAttrib3dvARB (will be remapped) */ + "ip\0" + "glVertexAttrib3dv\0" + "glVertexAttrib3dvARB\0" + "\0" + /* _mesa_function_pool[7674]: HintPGI (dynamic) */ + "ii\0" + "glHintPGI\0" + "\0" + /* _mesa_function_pool[7688]: ConvolutionParameteriv (offset 353) */ + "iip\0" + "glConvolutionParameteriv\0" + "glConvolutionParameterivEXT\0" + "\0" + /* _mesa_function_pool[7746]: Color4s (offset 33) */ + "iiii\0" + "glColor4s\0" + "\0" + /* _mesa_function_pool[7762]: InterleavedArrays (offset 317) */ + "iip\0" + "glInterleavedArrays\0" + "\0" + /* _mesa_function_pool[7787]: RasterPos2fv (offset 65) */ + "p\0" + "glRasterPos2fv\0" + "\0" + /* _mesa_function_pool[7805]: TexCoord1fv (offset 97) */ + "p\0" + "glTexCoord1fv\0" + "\0" + /* _mesa_function_pool[7822]: Vertex2d (offset 126) */ + "dd\0" + "glVertex2d\0" + "\0" + /* _mesa_function_pool[7837]: CullParameterdvEXT (will be remapped) */ + "ip\0" + "glCullParameterdvEXT\0" + "\0" + /* _mesa_function_pool[7862]: ProgramNamedParameter4fNV (will be remapped) */ + "iipffff\0" + "glProgramNamedParameter4fNV\0" + "\0" + /* _mesa_function_pool[7899]: Color3fVertex3fSUN (dynamic) */ + "ffffff\0" + "glColor3fVertex3fSUN\0" + "\0" + /* _mesa_function_pool[7928]: ProgramEnvParameter4fvARB (will be remapped) */ + "iip\0" + "glProgramEnvParameter4fvARB\0" + "glProgramParameter4fvNV\0" + "\0" + /* _mesa_function_pool[7985]: Color4i (offset 31) */ + "iiii\0" + "glColor4i\0" + "\0" + /* _mesa_function_pool[8001]: Color4f (offset 29) */ + "ffff\0" + "glColor4f\0" + "\0" + /* _mesa_function_pool[8017]: RasterPos4fv (offset 81) */ + "p\0" + "glRasterPos4fv\0" + "\0" + /* _mesa_function_pool[8035]: Color4d (offset 27) */ + "dddd\0" + "glColor4d\0" + "\0" + /* _mesa_function_pool[8051]: ClearIndex (offset 205) */ + "f\0" + "glClearIndex\0" + "\0" + /* _mesa_function_pool[8067]: Color4b (offset 25) */ + "iiii\0" + "glColor4b\0" + "\0" + /* _mesa_function_pool[8083]: LoadMatrixd (offset 292) */ + "p\0" + "glLoadMatrixd\0" + "\0" + /* _mesa_function_pool[8100]: FragmentLightModeliSGIX (dynamic) */ + "ii\0" + "glFragmentLightModeliSGIX\0" + "\0" + /* _mesa_function_pool[8130]: RasterPos2dv (offset 63) */ + "p\0" + "glRasterPos2dv\0" + "\0" + /* _mesa_function_pool[8148]: ConvolutionParameterfv (offset 351) */ + "iip\0" + "glConvolutionParameterfv\0" + "glConvolutionParameterfvEXT\0" + "\0" + /* _mesa_function_pool[8206]: TbufferMask3DFX (dynamic) */ + "i\0" + "glTbufferMask3DFX\0" + "\0" + /* _mesa_function_pool[8227]: GetTexGendv (offset 278) */ + "iip\0" + "glGetTexGendv\0" + "\0" + /* _mesa_function_pool[8246]: LoadProgramNV (will be remapped) */ + "iiip\0" + "glLoadProgramNV\0" + "\0" + /* _mesa_function_pool[8268]: WaitSync (will be remapped) */ + "iii\0" + "glWaitSync\0" + "\0" + /* _mesa_function_pool[8284]: EndList (offset 1) */ + "\0" + "glEndList\0" + "\0" + /* _mesa_function_pool[8296]: VertexAttrib4fvNV (will be remapped) */ + "ip\0" + "glVertexAttrib4fvNV\0" + "\0" + /* _mesa_function_pool[8320]: GetAttachedObjectsARB (will be remapped) */ + "iipp\0" + "glGetAttachedObjectsARB\0" + "\0" + /* _mesa_function_pool[8350]: Uniform3fvARB (will be remapped) */ + "iip\0" + "glUniform3fv\0" + "glUniform3fvARB\0" + "\0" + /* _mesa_function_pool[8384]: EvalCoord1fv (offset 231) */ + "p\0" + "glEvalCoord1fv\0" + "\0" + /* _mesa_function_pool[8402]: DrawRangeElements (offset 338) */ + "iiiiip\0" + "glDrawRangeElements\0" + "glDrawRangeElementsEXT\0" + "\0" + /* _mesa_function_pool[8453]: EvalMesh2 (offset 238) */ + "iiiii\0" + "glEvalMesh2\0" + "\0" + /* _mesa_function_pool[8472]: Vertex4fv (offset 145) */ + "p\0" + "glVertex4fv\0" + "\0" + /* _mesa_function_pool[8487]: SpriteParameterfvSGIX (dynamic) */ + "ip\0" + "glSpriteParameterfvSGIX\0" + "\0" + /* _mesa_function_pool[8515]: CheckFramebufferStatusEXT (will be remapped) */ + "i\0" + "glCheckFramebufferStatus\0" + "glCheckFramebufferStatusEXT\0" + "\0" + /* _mesa_function_pool[8571]: GlobalAlphaFactoruiSUN (dynamic) */ + "i\0" + "glGlobalAlphaFactoruiSUN\0" + "\0" + /* _mesa_function_pool[8599]: GetHandleARB (will be remapped) */ + "i\0" + "glGetHandleARB\0" + "\0" + /* _mesa_function_pool[8617]: GetVertexAttribivARB (will be remapped) */ + "iip\0" + "glGetVertexAttribiv\0" + "glGetVertexAttribivARB\0" + "\0" + /* _mesa_function_pool[8665]: GetCombinerInputParameterfvNV (will be remapped) */ + "iiiip\0" + "glGetCombinerInputParameterfvNV\0" + "\0" + /* _mesa_function_pool[8704]: CreateProgram (will be remapped) */ + "\0" + "glCreateProgram\0" + "\0" + /* _mesa_function_pool[8722]: LoadTransposeMatrixdARB (will be remapped) */ + "p\0" + "glLoadTransposeMatrixd\0" + "glLoadTransposeMatrixdARB\0" + "\0" + /* _mesa_function_pool[8774]: GetMinmax (offset 364) */ + "iiiip\0" + "glGetMinmax\0" + "glGetMinmaxEXT\0" + "\0" + /* _mesa_function_pool[8808]: StencilFuncSeparate (will be remapped) */ + "iiii\0" + "glStencilFuncSeparate\0" + "\0" + /* _mesa_function_pool[8836]: SecondaryColor3sEXT (will be remapped) */ + "iii\0" + "glSecondaryColor3s\0" + "glSecondaryColor3sEXT\0" + "\0" + /* _mesa_function_pool[8882]: Color3fVertex3fvSUN (dynamic) */ + "pp\0" + "glColor3fVertex3fvSUN\0" + "\0" + /* _mesa_function_pool[8908]: Normal3fv (offset 57) */ + "p\0" + "glNormal3fv\0" + "\0" + /* _mesa_function_pool[8923]: GlobalAlphaFactorbSUN (dynamic) */ + "i\0" + "glGlobalAlphaFactorbSUN\0" + "\0" + /* _mesa_function_pool[8950]: Color3us (offset 23) */ + "iii\0" + "glColor3us\0" + "\0" + /* _mesa_function_pool[8966]: ImageTransformParameterfvHP (dynamic) */ + "iip\0" + "glImageTransformParameterfvHP\0" + "\0" + /* _mesa_function_pool[9001]: VertexAttrib4ivARB (will be remapped) */ + "ip\0" + "glVertexAttrib4iv\0" + "glVertexAttrib4ivARB\0" + "\0" + /* _mesa_function_pool[9044]: End (offset 43) */ + "\0" + "glEnd\0" + "\0" + /* _mesa_function_pool[9052]: VertexAttrib3fNV (will be remapped) */ + "ifff\0" + "glVertexAttrib3fNV\0" + "\0" + /* _mesa_function_pool[9077]: VertexAttribs2dvNV (will be remapped) */ + "iip\0" + "glVertexAttribs2dvNV\0" + "\0" + /* _mesa_function_pool[9103]: GetQueryObjectui64vEXT (will be remapped) */ + "iip\0" + "glGetQueryObjectui64vEXT\0" + "\0" + /* _mesa_function_pool[9133]: MultiTexCoord3fvARB (offset 395) */ + "ip\0" + "glMultiTexCoord3fv\0" + "glMultiTexCoord3fvARB\0" + "\0" + /* _mesa_function_pool[9178]: SecondaryColor3dEXT (will be remapped) */ + "ddd\0" + "glSecondaryColor3d\0" + "glSecondaryColor3dEXT\0" + "\0" + /* _mesa_function_pool[9224]: Color3ub (offset 19) */ + "iii\0" + "glColor3ub\0" + "\0" + /* _mesa_function_pool[9240]: GetProgramParameterfvNV (will be remapped) */ + "iiip\0" + "glGetProgramParameterfvNV\0" + "\0" + /* _mesa_function_pool[9272]: TangentPointerEXT (dynamic) */ + "iip\0" + "glTangentPointerEXT\0" + "\0" + /* _mesa_function_pool[9297]: Color4fNormal3fVertex3fvSUN (dynamic) */ + "ppp\0" + "glColor4fNormal3fVertex3fvSUN\0" + "\0" + /* _mesa_function_pool[9332]: GetInstrumentsSGIX (dynamic) */ + "\0" + "glGetInstrumentsSGIX\0" + "\0" + /* _mesa_function_pool[9355]: Color3ui (offset 21) */ + "iii\0" + "glColor3ui\0" + "\0" + /* _mesa_function_pool[9371]: EvalMapsNV (dynamic) */ + "ii\0" + "glEvalMapsNV\0" + "\0" + /* _mesa_function_pool[9388]: TexSubImage2D (offset 333) */ + "iiiiiiiip\0" + "glTexSubImage2D\0" + "glTexSubImage2DEXT\0" + "\0" + /* _mesa_function_pool[9434]: FragmentLightivSGIX (dynamic) */ + "iip\0" + "glFragmentLightivSGIX\0" + "\0" + /* _mesa_function_pool[9461]: GetTexParameterPointervAPPLE (will be remapped) */ + "iip\0" + "glGetTexParameterPointervAPPLE\0" + "\0" + /* _mesa_function_pool[9497]: TexGenfv (offset 191) */ + "iip\0" + "glTexGenfv\0" + "\0" + /* _mesa_function_pool[9513]: PixelTransformParameterfvEXT (dynamic) */ + "iip\0" + "glPixelTransformParameterfvEXT\0" + "\0" + /* _mesa_function_pool[9549]: VertexAttrib4bvARB (will be remapped) */ + "ip\0" + "glVertexAttrib4bv\0" + "glVertexAttrib4bvARB\0" + "\0" + /* _mesa_function_pool[9592]: AlphaFragmentOp2ATI (will be remapped) */ + "iiiiiiiii\0" + "glAlphaFragmentOp2ATI\0" + "\0" + /* _mesa_function_pool[9625]: MultiTexCoord4sARB (offset 406) */ + "iiiii\0" + "glMultiTexCoord4s\0" + "glMultiTexCoord4sARB\0" + "\0" + /* _mesa_function_pool[9671]: GetFragmentMaterialivSGIX (dynamic) */ + "iip\0" + "glGetFragmentMaterialivSGIX\0" + "\0" + /* _mesa_function_pool[9704]: WindowPos4dMESA (will be remapped) */ + "dddd\0" + "glWindowPos4dMESA\0" + "\0" + /* _mesa_function_pool[9728]: WeightPointerARB (dynamic) */ + "iiip\0" + "glWeightPointerARB\0" + "\0" + /* _mesa_function_pool[9753]: WindowPos2dMESA (will be remapped) */ + "dd\0" + "glWindowPos2d\0" + "glWindowPos2dARB\0" + "glWindowPos2dMESA\0" + "\0" + /* _mesa_function_pool[9806]: FramebufferTexture3DEXT (will be remapped) */ + "iiiiii\0" + "glFramebufferTexture3D\0" + "glFramebufferTexture3DEXT\0" + "\0" + /* _mesa_function_pool[9863]: BlendEquation (offset 337) */ + "i\0" + "glBlendEquation\0" + "glBlendEquationEXT\0" + "\0" + /* _mesa_function_pool[9901]: VertexAttrib3dNV (will be remapped) */ + "iddd\0" + "glVertexAttrib3dNV\0" + "\0" + /* _mesa_function_pool[9926]: VertexAttrib3dARB (will be remapped) */ + "iddd\0" + "glVertexAttrib3d\0" + "glVertexAttrib3dARB\0" + "\0" + /* _mesa_function_pool[9969]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */ + "ppppp\0" + "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN\0" + "\0" + /* _mesa_function_pool[10033]: VertexAttrib4fARB (will be remapped) */ + "iffff\0" + "glVertexAttrib4f\0" + "glVertexAttrib4fARB\0" + "\0" + /* _mesa_function_pool[10077]: GetError (offset 261) */ + "\0" + "glGetError\0" + "\0" + /* _mesa_function_pool[10090]: IndexFuncEXT (dynamic) */ + "if\0" + "glIndexFuncEXT\0" + "\0" + /* _mesa_function_pool[10109]: TexCoord3dv (offset 111) */ + "p\0" + "glTexCoord3dv\0" + "\0" + /* _mesa_function_pool[10126]: Indexdv (offset 45) */ + "p\0" + "glIndexdv\0" + "\0" + /* _mesa_function_pool[10139]: FramebufferTexture2DEXT (will be remapped) */ + "iiiii\0" + "glFramebufferTexture2D\0" + "glFramebufferTexture2DEXT\0" + "\0" + /* _mesa_function_pool[10195]: Normal3s (offset 60) */ + "iii\0" + "glNormal3s\0" + "\0" + /* _mesa_function_pool[10211]: PushName (offset 201) */ + "i\0" + "glPushName\0" + "\0" + /* _mesa_function_pool[10225]: MultiTexCoord2dvARB (offset 385) */ + "ip\0" + "glMultiTexCoord2dv\0" + "glMultiTexCoord2dvARB\0" + "\0" + /* _mesa_function_pool[10270]: CullParameterfvEXT (will be remapped) */ + "ip\0" + "glCullParameterfvEXT\0" + "\0" + /* _mesa_function_pool[10295]: Normal3i (offset 58) */ + "iii\0" + "glNormal3i\0" + "\0" + /* _mesa_function_pool[10311]: ProgramNamedParameter4fvNV (will be remapped) */ + "iipp\0" + "glProgramNamedParameter4fvNV\0" + "\0" + /* _mesa_function_pool[10346]: SecondaryColorPointerEXT (will be remapped) */ + "iiip\0" + "glSecondaryColorPointer\0" + "glSecondaryColorPointerEXT\0" + "\0" + /* _mesa_function_pool[10403]: VertexAttrib4fvARB (will be remapped) */ + "ip\0" + "glVertexAttrib4fv\0" + "glVertexAttrib4fvARB\0" + "\0" + /* _mesa_function_pool[10446]: ColorPointerListIBM (dynamic) */ + "iiipi\0" + "glColorPointerListIBM\0" + "\0" + /* _mesa_function_pool[10475]: GetActiveUniformARB (will be remapped) */ + "iiipppp\0" + "glGetActiveUniform\0" + "glGetActiveUniformARB\0" + "\0" + /* _mesa_function_pool[10525]: ImageTransformParameteriHP (dynamic) */ + "iii\0" + "glImageTransformParameteriHP\0" + "\0" + /* _mesa_function_pool[10559]: Normal3b (offset 52) */ + "iii\0" + "glNormal3b\0" + "\0" + /* _mesa_function_pool[10575]: Normal3d (offset 54) */ + "ddd\0" + "glNormal3d\0" + "\0" + /* _mesa_function_pool[10591]: Normal3f (offset 56) */ + "fff\0" + "glNormal3f\0" + "\0" + /* _mesa_function_pool[10607]: MultiTexCoord1svARB (offset 383) */ + "ip\0" + "glMultiTexCoord1sv\0" + "glMultiTexCoord1svARB\0" + "\0" + /* _mesa_function_pool[10652]: Indexi (offset 48) */ + "i\0" + "glIndexi\0" + "\0" + /* _mesa_function_pool[10664]: EndQueryARB (will be remapped) */ + "i\0" + "glEndQuery\0" + "glEndQueryARB\0" + "\0" + /* _mesa_function_pool[10692]: DeleteFencesNV (will be remapped) */ + "ip\0" + "glDeleteFencesNV\0" + "\0" + /* _mesa_function_pool[10713]: DepthMask (offset 211) */ + "i\0" + "glDepthMask\0" + "\0" + /* _mesa_function_pool[10728]: IsShader (will be remapped) */ + "i\0" + "glIsShader\0" + "\0" + /* _mesa_function_pool[10742]: Indexf (offset 46) */ + "f\0" + "glIndexf\0" + "\0" + /* _mesa_function_pool[10754]: GetImageTransformParameterivHP (dynamic) */ + "iip\0" + "glGetImageTransformParameterivHP\0" + "\0" + /* _mesa_function_pool[10792]: Indexd (offset 44) */ + "d\0" + "glIndexd\0" + "\0" + /* _mesa_function_pool[10804]: GetMaterialiv (offset 270) */ + "iip\0" + "glGetMaterialiv\0" + "\0" + /* _mesa_function_pool[10825]: StencilOp (offset 244) */ + "iii\0" + "glStencilOp\0" + "\0" + /* _mesa_function_pool[10842]: WindowPos4ivMESA (will be remapped) */ + "p\0" + "glWindowPos4ivMESA\0" + "\0" + /* _mesa_function_pool[10864]: MultiTexCoord3svARB (offset 399) */ + "ip\0" + "glMultiTexCoord3sv\0" + "glMultiTexCoord3svARB\0" + "\0" + /* _mesa_function_pool[10909]: TexEnvfv (offset 185) */ + "iip\0" + "glTexEnvfv\0" + "\0" + /* _mesa_function_pool[10925]: MultiTexCoord4iARB (offset 404) */ + "iiiii\0" + "glMultiTexCoord4i\0" + "glMultiTexCoord4iARB\0" + "\0" + /* _mesa_function_pool[10971]: Indexs (offset 50) */ + "i\0" + "glIndexs\0" + "\0" + /* _mesa_function_pool[10983]: Binormal3ivEXT (dynamic) */ + "p\0" + "glBinormal3ivEXT\0" + "\0" + /* _mesa_function_pool[11003]: ResizeBuffersMESA (will be remapped) */ + "\0" + "glResizeBuffersMESA\0" + "\0" + /* _mesa_function_pool[11025]: GetUniformivARB (will be remapped) */ + "iip\0" + "glGetUniformiv\0" + "glGetUniformivARB\0" + "\0" + /* _mesa_function_pool[11063]: PixelTexGenParameteriSGIS (will be remapped) */ + "ii\0" + "glPixelTexGenParameteriSGIS\0" + "\0" + /* _mesa_function_pool[11095]: VertexPointervINTEL (dynamic) */ + "iip\0" + "glVertexPointervINTEL\0" + "\0" + /* _mesa_function_pool[11122]: Vertex2i (offset 130) */ + "ii\0" + "glVertex2i\0" + "\0" + /* _mesa_function_pool[11137]: LoadMatrixf (offset 291) */ + "p\0" + "glLoadMatrixf\0" + "\0" + /* _mesa_function_pool[11154]: Vertex2f (offset 128) */ + "ff\0" + "glVertex2f\0" + "\0" + /* _mesa_function_pool[11169]: ReplacementCodeuiColor4fNormal3fVertex3fvSUN (dynamic) */ + "pppp\0" + "glReplacementCodeuiColor4fNormal3fVertex3fvSUN\0" + "\0" + /* _mesa_function_pool[11222]: Color4bv (offset 26) */ + "p\0" + "glColor4bv\0" + "\0" + /* _mesa_function_pool[11236]: VertexPointer (offset 321) */ + "iiip\0" + "glVertexPointer\0" + "\0" + /* _mesa_function_pool[11258]: SecondaryColor3uiEXT (will be remapped) */ + "iii\0" + "glSecondaryColor3ui\0" + "glSecondaryColor3uiEXT\0" + "\0" + /* _mesa_function_pool[11306]: StartInstrumentsSGIX (dynamic) */ + "\0" + "glStartInstrumentsSGIX\0" + "\0" + /* _mesa_function_pool[11331]: SecondaryColor3usvEXT (will be remapped) */ + "p\0" + "glSecondaryColor3usv\0" + "glSecondaryColor3usvEXT\0" + "\0" + /* _mesa_function_pool[11379]: VertexAttrib2fvNV (will be remapped) */ + "ip\0" + "glVertexAttrib2fvNV\0" + "\0" + /* _mesa_function_pool[11403]: ProgramLocalParameter4dvARB (will be remapped) */ + "iip\0" + "glProgramLocalParameter4dvARB\0" + "\0" + /* _mesa_function_pool[11438]: DeleteLists (offset 4) */ + "ii\0" + "glDeleteLists\0" + "\0" + /* _mesa_function_pool[11456]: LogicOp (offset 242) */ + "i\0" + "glLogicOp\0" + "\0" + /* _mesa_function_pool[11469]: MatrixIndexuivARB (dynamic) */ + "ip\0" + "glMatrixIndexuivARB\0" + "\0" + /* _mesa_function_pool[11493]: Vertex2s (offset 132) */ + "ii\0" + "glVertex2s\0" + "\0" + /* _mesa_function_pool[11508]: RenderbufferStorageMultisample (will be remapped) */ + "iiiii\0" + "glRenderbufferStorageMultisample\0" + "\0" + /* _mesa_function_pool[11548]: TexCoord4fv (offset 121) */ + "p\0" + "glTexCoord4fv\0" + "\0" + /* _mesa_function_pool[11565]: Tangent3sEXT (dynamic) */ + "iii\0" + "glTangent3sEXT\0" + "\0" + /* _mesa_function_pool[11585]: GlobalAlphaFactorfSUN (dynamic) */ + "f\0" + "glGlobalAlphaFactorfSUN\0" + "\0" + /* _mesa_function_pool[11612]: MultiTexCoord3iARB (offset 396) */ + "iiii\0" + "glMultiTexCoord3i\0" + "glMultiTexCoord3iARB\0" + "\0" + /* _mesa_function_pool[11657]: IsProgram (will be remapped) */ + "i\0" + "glIsProgram\0" + "\0" + /* _mesa_function_pool[11672]: TexCoordPointerListIBM (dynamic) */ + "iiipi\0" + "glTexCoordPointerListIBM\0" + "\0" + /* _mesa_function_pool[11704]: GlobalAlphaFactorusSUN (dynamic) */ + "i\0" + "glGlobalAlphaFactorusSUN\0" + "\0" + /* _mesa_function_pool[11732]: VertexAttrib2dvNV (will be remapped) */ + "ip\0" + "glVertexAttrib2dvNV\0" + "\0" + /* _mesa_function_pool[11756]: FramebufferRenderbufferEXT (will be remapped) */ + "iiii\0" + "glFramebufferRenderbuffer\0" + "glFramebufferRenderbufferEXT\0" + "\0" + /* _mesa_function_pool[11817]: VertexAttrib1dvNV (will be remapped) */ + "ip\0" + "glVertexAttrib1dvNV\0" + "\0" + /* _mesa_function_pool[11841]: GenTextures (offset 328) */ + "ip\0" + "glGenTextures\0" + "glGenTexturesEXT\0" + "\0" + /* _mesa_function_pool[11876]: SetFenceNV (will be remapped) */ + "ii\0" + "glSetFenceNV\0" + "\0" + /* _mesa_function_pool[11893]: FramebufferTexture1DEXT (will be remapped) */ + "iiiii\0" + "glFramebufferTexture1D\0" + "glFramebufferTexture1DEXT\0" + "\0" + /* _mesa_function_pool[11949]: GetCombinerOutputParameterivNV (will be remapped) */ + "iiip\0" + "glGetCombinerOutputParameterivNV\0" + "\0" + /* _mesa_function_pool[11988]: MultiModeDrawArraysIBM (will be remapped) */ + "pppii\0" + "glMultiModeDrawArraysIBM\0" + "\0" + /* _mesa_function_pool[12020]: PixelTexGenParameterivSGIS (will be remapped) */ + "ip\0" + "glPixelTexGenParameterivSGIS\0" + "\0" + /* _mesa_function_pool[12053]: TextureNormalEXT (dynamic) */ + "i\0" + "glTextureNormalEXT\0" + "\0" + /* _mesa_function_pool[12075]: IndexPointerListIBM (dynamic) */ + "iipi\0" + "glIndexPointerListIBM\0" + "\0" + /* _mesa_function_pool[12103]: WeightfvARB (dynamic) */ + "ip\0" + "glWeightfvARB\0" + "\0" + /* _mesa_function_pool[12121]: RasterPos2sv (offset 69) */ + "p\0" + "glRasterPos2sv\0" + "\0" + /* _mesa_function_pool[12139]: Color4ubv (offset 36) */ + "p\0" + "glColor4ubv\0" + "\0" + /* _mesa_function_pool[12154]: DrawBuffer (offset 202) */ + "i\0" + "glDrawBuffer\0" + "\0" + /* _mesa_function_pool[12170]: TexCoord2fv (offset 105) */ + "p\0" + "glTexCoord2fv\0" + "\0" + /* _mesa_function_pool[12187]: WindowPos4fMESA (will be remapped) */ + "ffff\0" + "glWindowPos4fMESA\0" + "\0" + /* _mesa_function_pool[12211]: TexCoord1sv (offset 101) */ + "p\0" + "glTexCoord1sv\0" + "\0" + /* _mesa_function_pool[12228]: WindowPos3dvMESA (will be remapped) */ + "p\0" + "glWindowPos3dv\0" + "glWindowPos3dvARB\0" + "glWindowPos3dvMESA\0" + "\0" + /* _mesa_function_pool[12283]: DepthFunc (offset 245) */ + "i\0" + "glDepthFunc\0" + "\0" + /* _mesa_function_pool[12298]: PixelMapusv (offset 253) */ + "iip\0" + "glPixelMapusv\0" + "\0" + /* _mesa_function_pool[12317]: GetQueryObjecti64vEXT (will be remapped) */ + "iip\0" + "glGetQueryObjecti64vEXT\0" + "\0" + /* _mesa_function_pool[12346]: MultiTexCoord1dARB (offset 376) */ + "id\0" + "glMultiTexCoord1d\0" + "glMultiTexCoord1dARB\0" + "\0" + /* _mesa_function_pool[12389]: PointParameterivNV (will be remapped) */ + "ip\0" + "glPointParameteriv\0" + "glPointParameterivNV\0" + "\0" + /* _mesa_function_pool[12433]: BlendFunc (offset 241) */ + "ii\0" + "glBlendFunc\0" + "\0" + /* _mesa_function_pool[12449]: Uniform2fvARB (will be remapped) */ + "iip\0" + "glUniform2fv\0" + "glUniform2fvARB\0" + "\0" + /* _mesa_function_pool[12483]: BufferParameteriAPPLE (will be remapped) */ + "iii\0" + "glBufferParameteriAPPLE\0" + "\0" + /* _mesa_function_pool[12512]: MultiTexCoord3dvARB (offset 393) */ + "ip\0" + "glMultiTexCoord3dv\0" + "glMultiTexCoord3dvARB\0" + "\0" + /* _mesa_function_pool[12557]: ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (dynamic) */ + "pppp\0" + "glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN\0" + "\0" + /* _mesa_function_pool[12613]: DeleteObjectARB (will be remapped) */ + "i\0" + "glDeleteObjectARB\0" + "\0" + /* _mesa_function_pool[12634]: MatrixIndexPointerARB (dynamic) */ + "iiip\0" + "glMatrixIndexPointerARB\0" + "\0" + /* _mesa_function_pool[12664]: ProgramNamedParameter4dvNV (will be remapped) */ + "iipp\0" + "glProgramNamedParameter4dvNV\0" + "\0" + /* _mesa_function_pool[12699]: Tangent3fvEXT (dynamic) */ + "p\0" + "glTangent3fvEXT\0" + "\0" + /* _mesa_function_pool[12718]: Flush (offset 217) */ + "\0" + "glFlush\0" + "\0" + /* _mesa_function_pool[12728]: Color4uiv (offset 38) */ + "p\0" + "glColor4uiv\0" + "\0" + /* _mesa_function_pool[12743]: GenVertexArrays (will be remapped) */ + "ip\0" + "glGenVertexArrays\0" + "\0" + /* _mesa_function_pool[12765]: RasterPos3sv (offset 77) */ + "p\0" + "glRasterPos3sv\0" + "\0" + /* _mesa_function_pool[12783]: BindFramebufferEXT (will be remapped) */ + "ii\0" + "glBindFramebuffer\0" + "glBindFramebufferEXT\0" + "\0" + /* _mesa_function_pool[12826]: ReferencePlaneSGIX (dynamic) */ + "p\0" + "glReferencePlaneSGIX\0" + "\0" + /* _mesa_function_pool[12850]: PushAttrib (offset 219) */ + "i\0" + "glPushAttrib\0" + "\0" + /* _mesa_function_pool[12866]: RasterPos2i (offset 66) */ + "ii\0" + "glRasterPos2i\0" + "\0" + /* _mesa_function_pool[12884]: ValidateProgramARB (will be remapped) */ + "i\0" + "glValidateProgram\0" + "glValidateProgramARB\0" + "\0" + /* _mesa_function_pool[12926]: TexParameteriv (offset 181) */ + "iip\0" + "glTexParameteriv\0" + "\0" + /* _mesa_function_pool[12948]: UnlockArraysEXT (will be remapped) */ + "\0" + "glUnlockArraysEXT\0" + "\0" + /* _mesa_function_pool[12968]: TexCoord2fColor3fVertex3fSUN (dynamic) */ + "ffffffff\0" + "glTexCoord2fColor3fVertex3fSUN\0" + "\0" + /* _mesa_function_pool[13009]: WindowPos3fvMESA (will be remapped) */ + "p\0" + "glWindowPos3fv\0" + "glWindowPos3fvARB\0" + "glWindowPos3fvMESA\0" + "\0" + /* _mesa_function_pool[13064]: RasterPos2f (offset 64) */ + "ff\0" + "glRasterPos2f\0" + "\0" + /* _mesa_function_pool[13082]: VertexAttrib1svNV (will be remapped) */ + "ip\0" + "glVertexAttrib1svNV\0" + "\0" + /* _mesa_function_pool[13106]: RasterPos2d (offset 62) */ + "dd\0" + "glRasterPos2d\0" + "\0" + /* _mesa_function_pool[13124]: RasterPos3fv (offset 73) */ + "p\0" + "glRasterPos3fv\0" + "\0" + /* _mesa_function_pool[13142]: CopyTexSubImage3D (offset 373) */ + "iiiiiiiii\0" + "glCopyTexSubImage3D\0" + "glCopyTexSubImage3DEXT\0" + "\0" + /* _mesa_function_pool[13196]: VertexAttrib2dARB (will be remapped) */ + "idd\0" + "glVertexAttrib2d\0" + "glVertexAttrib2dARB\0" + "\0" + /* _mesa_function_pool[13238]: Color4ub (offset 35) */ + "iiii\0" + "glColor4ub\0" + "\0" + /* _mesa_function_pool[13255]: GetInteger64v (will be remapped) */ + "ip\0" + "glGetInteger64v\0" + "\0" + /* _mesa_function_pool[13275]: TextureColorMaskSGIS (dynamic) */ + "iiii\0" + "glTextureColorMaskSGIS\0" + "\0" + /* _mesa_function_pool[13304]: RasterPos2s (offset 68) */ + "ii\0" + "glRasterPos2s\0" + "\0" + /* _mesa_function_pool[13322]: GetColorTable (offset 343) */ + "iiip\0" + "glGetColorTable\0" + "glGetColorTableSGI\0" + "glGetColorTableEXT\0" + "\0" + /* _mesa_function_pool[13382]: SelectBuffer (offset 195) */ + "ip\0" + "glSelectBuffer\0" + "\0" + /* _mesa_function_pool[13401]: Indexiv (offset 49) */ + "p\0" + "glIndexiv\0" + "\0" + /* _mesa_function_pool[13414]: TexCoord3i (offset 114) */ + "iii\0" + "glTexCoord3i\0" + "\0" + /* _mesa_function_pool[13432]: CopyColorTable (offset 342) */ + "iiiii\0" + "glCopyColorTable\0" + "glCopyColorTableSGI\0" + "\0" + /* _mesa_function_pool[13476]: GetHistogramParameterfv (offset 362) */ + "iip\0" + "glGetHistogramParameterfv\0" + "glGetHistogramParameterfvEXT\0" + "\0" + /* _mesa_function_pool[13536]: Frustum (offset 289) */ + "dddddd\0" + "glFrustum\0" + "\0" + /* _mesa_function_pool[13554]: GetString (offset 275) */ + "i\0" + "glGetString\0" + "\0" + /* _mesa_function_pool[13569]: ColorPointervINTEL (dynamic) */ + "iip\0" + "glColorPointervINTEL\0" + "\0" + /* _mesa_function_pool[13595]: TexEnvf (offset 184) */ + "iif\0" + "glTexEnvf\0" + "\0" + /* _mesa_function_pool[13610]: TexCoord3d (offset 110) */ + "ddd\0" + "glTexCoord3d\0" + "\0" + /* _mesa_function_pool[13628]: AlphaFragmentOp1ATI (will be remapped) */ + "iiiiii\0" + "glAlphaFragmentOp1ATI\0" + "\0" + /* _mesa_function_pool[13658]: TexCoord3f (offset 112) */ + "fff\0" + "glTexCoord3f\0" + "\0" + /* _mesa_function_pool[13676]: MultiTexCoord3ivARB (offset 397) */ + "ip\0" + "glMultiTexCoord3iv\0" + "glMultiTexCoord3ivARB\0" + "\0" + /* _mesa_function_pool[13721]: MultiTexCoord2sARB (offset 390) */ + "iii\0" + "glMultiTexCoord2s\0" + "glMultiTexCoord2sARB\0" + "\0" + /* _mesa_function_pool[13765]: VertexAttrib1dvARB (will be remapped) */ + "ip\0" + "glVertexAttrib1dv\0" + "glVertexAttrib1dvARB\0" + "\0" + /* _mesa_function_pool[13808]: DeleteTextures (offset 327) */ + "ip\0" + "glDeleteTextures\0" + "glDeleteTexturesEXT\0" + "\0" + /* _mesa_function_pool[13849]: TexCoordPointerEXT (will be remapped) */ + "iiiip\0" + "glTexCoordPointerEXT\0" + "\0" + /* _mesa_function_pool[13877]: TexSubImage4DSGIS (dynamic) */ + "iiiiiiiiiiiip\0" + "glTexSubImage4DSGIS\0" + "\0" + /* _mesa_function_pool[13912]: TexCoord3s (offset 116) */ + "iii\0" + "glTexCoord3s\0" + "\0" + /* _mesa_function_pool[13930]: GetTexLevelParameteriv (offset 285) */ + "iiip\0" + "glGetTexLevelParameteriv\0" + "\0" + /* _mesa_function_pool[13961]: CombinerStageParameterfvNV (dynamic) */ + "iip\0" + "glCombinerStageParameterfvNV\0" + "\0" + /* _mesa_function_pool[13995]: StopInstrumentsSGIX (dynamic) */ + "i\0" + "glStopInstrumentsSGIX\0" + "\0" + /* _mesa_function_pool[14020]: TexCoord4fColor4fNormal3fVertex4fSUN (dynamic) */ + "fffffffffffffff\0" + "glTexCoord4fColor4fNormal3fVertex4fSUN\0" + "\0" + /* _mesa_function_pool[14076]: ClearAccum (offset 204) */ + "ffff\0" + "glClearAccum\0" + "\0" + /* _mesa_function_pool[14095]: DeformSGIX (dynamic) */ + "i\0" + "glDeformSGIX\0" + "\0" + /* _mesa_function_pool[14111]: GetVertexAttribfvARB (will be remapped) */ + "iip\0" + "glGetVertexAttribfv\0" + "glGetVertexAttribfvARB\0" + "\0" + /* _mesa_function_pool[14159]: SecondaryColor3ivEXT (will be remapped) */ + "p\0" + "glSecondaryColor3iv\0" + "glSecondaryColor3ivEXT\0" + "\0" + /* _mesa_function_pool[14205]: TexCoord4iv (offset 123) */ + "p\0" + "glTexCoord4iv\0" + "\0" + /* _mesa_function_pool[14222]: UniformMatrix4x2fv (will be remapped) */ + "iiip\0" + "glUniformMatrix4x2fv\0" + "\0" + /* _mesa_function_pool[14249]: GetDetailTexFuncSGIS (dynamic) */ + "ip\0" + "glGetDetailTexFuncSGIS\0" + "\0" + /* _mesa_function_pool[14276]: GetCombinerStageParameterfvNV (dynamic) */ + "iip\0" + "glGetCombinerStageParameterfvNV\0" + "\0" + /* _mesa_function_pool[14313]: PolygonOffset (offset 319) */ + "ff\0" + "glPolygonOffset\0" + "\0" + /* _mesa_function_pool[14333]: BindVertexArray (will be remapped) */ + "i\0" + "glBindVertexArray\0" + "\0" + /* _mesa_function_pool[14354]: Color4ubVertex2fvSUN (dynamic) */ + "pp\0" + "glColor4ubVertex2fvSUN\0" + "\0" + /* _mesa_function_pool[14381]: Rectd (offset 86) */ + "dddd\0" + "glRectd\0" + "\0" + /* _mesa_function_pool[14395]: TexFilterFuncSGIS (dynamic) */ + "iiip\0" + "glTexFilterFuncSGIS\0" + "\0" + /* _mesa_function_pool[14421]: SampleMaskSGIS (will be remapped) */ + "fi\0" + "glSampleMaskSGIS\0" + "glSampleMaskEXT\0" + "\0" + /* _mesa_function_pool[14458]: GetAttribLocationARB (will be remapped) */ + "ip\0" + "glGetAttribLocation\0" + "glGetAttribLocationARB\0" + "\0" + /* _mesa_function_pool[14505]: RasterPos3i (offset 74) */ + "iii\0" + "glRasterPos3i\0" + "\0" + /* _mesa_function_pool[14524]: VertexAttrib4ubvARB (will be remapped) */ + "ip\0" + "glVertexAttrib4ubv\0" + "glVertexAttrib4ubvARB\0" + "\0" + /* _mesa_function_pool[14569]: DetailTexFuncSGIS (dynamic) */ + "iip\0" + "glDetailTexFuncSGIS\0" + "\0" + /* _mesa_function_pool[14594]: Normal3fVertex3fSUN (dynamic) */ + "ffffff\0" + "glNormal3fVertex3fSUN\0" + "\0" + /* _mesa_function_pool[14624]: CopyTexImage2D (offset 324) */ + "iiiiiiii\0" + "glCopyTexImage2D\0" + "glCopyTexImage2DEXT\0" + "\0" + /* _mesa_function_pool[14671]: GetBufferPointervARB (will be remapped) */ + "iip\0" + "glGetBufferPointerv\0" + "glGetBufferPointervARB\0" + "\0" + /* _mesa_function_pool[14719]: ProgramEnvParameter4fARB (will be remapped) */ + "iiffff\0" + "glProgramEnvParameter4fARB\0" + "glProgramParameter4fNV\0" + "\0" + /* _mesa_function_pool[14777]: Uniform3ivARB (will be remapped) */ + "iip\0" + "glUniform3iv\0" + "glUniform3ivARB\0" + "\0" + /* _mesa_function_pool[14811]: Lightfv (offset 160) */ + "iip\0" + "glLightfv\0" + "\0" + /* _mesa_function_pool[14826]: ClearDepth (offset 208) */ + "d\0" + "glClearDepth\0" + "\0" + /* _mesa_function_pool[14842]: GetFenceivNV (will be remapped) */ + "iip\0" + "glGetFenceivNV\0" + "\0" + /* _mesa_function_pool[14862]: WindowPos4dvMESA (will be remapped) */ + "p\0" + "glWindowPos4dvMESA\0" + "\0" + /* _mesa_function_pool[14884]: ColorSubTable (offset 346) */ + "iiiiip\0" + "glColorSubTable\0" + "glColorSubTableEXT\0" + "\0" + /* _mesa_function_pool[14927]: Color4fv (offset 30) */ + "p\0" + "glColor4fv\0" + "\0" + /* _mesa_function_pool[14941]: MultiTexCoord4ivARB (offset 405) */ + "ip\0" + "glMultiTexCoord4iv\0" + "glMultiTexCoord4ivARB\0" + "\0" + /* _mesa_function_pool[14986]: ProgramLocalParameters4fvEXT (will be remapped) */ + "iiip\0" + "glProgramLocalParameters4fvEXT\0" + "\0" + /* _mesa_function_pool[15023]: ColorPointer (offset 308) */ + "iiip\0" + "glColorPointer\0" + "\0" + /* _mesa_function_pool[15044]: Rects (offset 92) */ + "iiii\0" + "glRects\0" + "\0" + /* _mesa_function_pool[15058]: GetMapAttribParameterfvNV (dynamic) */ + "iiip\0" + "glGetMapAttribParameterfvNV\0" + "\0" + /* _mesa_function_pool[15092]: Lightiv (offset 162) */ + "iip\0" + "glLightiv\0" + "\0" + /* _mesa_function_pool[15107]: VertexAttrib4sARB (will be remapped) */ + "iiiii\0" + "glVertexAttrib4s\0" + "glVertexAttrib4sARB\0" + "\0" + /* _mesa_function_pool[15151]: GetQueryObjectuivARB (will be remapped) */ + "iip\0" + "glGetQueryObjectuiv\0" + "glGetQueryObjectuivARB\0" + "\0" + /* _mesa_function_pool[15199]: GetTexParameteriv (offset 283) */ + "iip\0" + "glGetTexParameteriv\0" + "\0" + /* _mesa_function_pool[15224]: MapParameterivNV (dynamic) */ + "iip\0" + "glMapParameterivNV\0" + "\0" + /* _mesa_function_pool[15248]: GenRenderbuffersEXT (will be remapped) */ + "ip\0" + "glGenRenderbuffers\0" + "glGenRenderbuffersEXT\0" + "\0" + /* _mesa_function_pool[15293]: VertexAttrib2dvARB (will be remapped) */ + "ip\0" + "glVertexAttrib2dv\0" + "glVertexAttrib2dvARB\0" + "\0" + /* _mesa_function_pool[15336]: EdgeFlagPointerEXT (will be remapped) */ + "iip\0" + "glEdgeFlagPointerEXT\0" + "\0" + /* _mesa_function_pool[15362]: VertexAttribs2svNV (will be remapped) */ + "iip\0" + "glVertexAttribs2svNV\0" + "\0" + /* _mesa_function_pool[15388]: WeightbvARB (dynamic) */ + "ip\0" + "glWeightbvARB\0" + "\0" + /* _mesa_function_pool[15406]: VertexAttrib2fvARB (will be remapped) */ + "ip\0" + "glVertexAttrib2fv\0" + "glVertexAttrib2fvARB\0" + "\0" + /* _mesa_function_pool[15449]: GetBufferParameterivARB (will be remapped) */ + "iip\0" + "glGetBufferParameteriv\0" + "glGetBufferParameterivARB\0" + "\0" + /* _mesa_function_pool[15503]: Rectdv (offset 87) */ + "pp\0" + "glRectdv\0" + "\0" + /* _mesa_function_pool[15516]: ListParameteriSGIX (dynamic) */ + "iii\0" + "glListParameteriSGIX\0" + "\0" + /* _mesa_function_pool[15542]: ReplacementCodeuiColor4fNormal3fVertex3fSUN (dynamic) */ + "iffffffffff\0" + "glReplacementCodeuiColor4fNormal3fVertex3fSUN\0" + "\0" + /* _mesa_function_pool[15601]: InstrumentsBufferSGIX (dynamic) */ + "ip\0" + "glInstrumentsBufferSGIX\0" + "\0" + /* _mesa_function_pool[15629]: VertexAttrib4NivARB (will be remapped) */ + "ip\0" + "glVertexAttrib4Niv\0" + "glVertexAttrib4NivARB\0" + "\0" + /* _mesa_function_pool[15674]: GetAttachedShaders (will be remapped) */ + "iipp\0" + "glGetAttachedShaders\0" + "\0" + /* _mesa_function_pool[15701]: GenVertexArraysAPPLE (will be remapped) */ + "ip\0" + "glGenVertexArraysAPPLE\0" + "\0" + /* _mesa_function_pool[15728]: Materialiv (offset 172) */ + "iip\0" + "glMaterialiv\0" + "\0" + /* _mesa_function_pool[15746]: PushClientAttrib (offset 335) */ + "i\0" + "glPushClientAttrib\0" + "\0" + /* _mesa_function_pool[15768]: ProgramEnvParameters4fvEXT (will be remapped) */ + "iiip\0" + "glProgramEnvParameters4fvEXT\0" + "\0" + /* _mesa_function_pool[15803]: TexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */ + "pppp\0" + "glTexCoord2fColor4fNormal3fVertex3fvSUN\0" + "\0" + /* _mesa_function_pool[15849]: WindowPos2iMESA (will be remapped) */ + "ii\0" + "glWindowPos2i\0" + "glWindowPos2iARB\0" + "glWindowPos2iMESA\0" + "\0" + /* _mesa_function_pool[15902]: SecondaryColor3fvEXT (will be remapped) */ + "p\0" + "glSecondaryColor3fv\0" + "glSecondaryColor3fvEXT\0" + "\0" + /* _mesa_function_pool[15948]: PolygonMode (offset 174) */ + "ii\0" + "glPolygonMode\0" + "\0" + /* _mesa_function_pool[15966]: CompressedTexSubImage1DARB (will be remapped) */ + "iiiiiip\0" + "glCompressedTexSubImage1D\0" + "glCompressedTexSubImage1DARB\0" + "\0" + /* _mesa_function_pool[16030]: GetVertexAttribivNV (will be remapped) */ + "iip\0" + "glGetVertexAttribivNV\0" + "\0" + /* _mesa_function_pool[16057]: GetProgramStringARB (will be remapped) */ + "iip\0" + "glGetProgramStringARB\0" + "\0" + /* _mesa_function_pool[16084]: TexBumpParameterfvATI (will be remapped) */ + "ip\0" + "glTexBumpParameterfvATI\0" + "\0" + /* _mesa_function_pool[16112]: CompileShaderARB (will be remapped) */ + "i\0" + "glCompileShader\0" + "glCompileShaderARB\0" + "\0" + /* _mesa_function_pool[16150]: DeleteShader (will be remapped) */ + "i\0" + "glDeleteShader\0" + "\0" + /* _mesa_function_pool[16168]: DisableClientState (offset 309) */ + "i\0" + "glDisableClientState\0" + "\0" + /* _mesa_function_pool[16192]: TexGeni (offset 192) */ + "iii\0" + "glTexGeni\0" + "\0" + /* _mesa_function_pool[16207]: TexGenf (offset 190) */ + "iif\0" + "glTexGenf\0" + "\0" + /* _mesa_function_pool[16222]: Uniform3fARB (will be remapped) */ + "ifff\0" + "glUniform3f\0" + "glUniform3fARB\0" + "\0" + /* _mesa_function_pool[16255]: TexGend (offset 188) */ + "iid\0" + "glTexGend\0" + "\0" + /* _mesa_function_pool[16270]: ListParameterfvSGIX (dynamic) */ + "iip\0" + "glListParameterfvSGIX\0" + "\0" + /* _mesa_function_pool[16297]: GetPolygonStipple (offset 274) */ + "p\0" + "glGetPolygonStipple\0" + "\0" + /* _mesa_function_pool[16320]: Tangent3dvEXT (dynamic) */ + "p\0" + "glTangent3dvEXT\0" + "\0" + /* _mesa_function_pool[16339]: GetVertexAttribfvNV (will be remapped) */ + "iip\0" + "glGetVertexAttribfvNV\0" + "\0" + /* _mesa_function_pool[16366]: WindowPos3sMESA (will be remapped) */ + "iii\0" + "glWindowPos3s\0" + "glWindowPos3sARB\0" + "glWindowPos3sMESA\0" + "\0" + /* _mesa_function_pool[16420]: VertexAttrib2svNV (will be remapped) */ + "ip\0" + "glVertexAttrib2svNV\0" + "\0" + /* _mesa_function_pool[16444]: VertexAttribs1fvNV (will be remapped) */ + "iip\0" + "glVertexAttribs1fvNV\0" + "\0" + /* _mesa_function_pool[16470]: TexCoord2fVertex3fvSUN (dynamic) */ + "pp\0" + "glTexCoord2fVertex3fvSUN\0" + "\0" + /* _mesa_function_pool[16499]: WindowPos4sMESA (will be remapped) */ + "iiii\0" + "glWindowPos4sMESA\0" + "\0" + /* _mesa_function_pool[16523]: VertexAttrib4NuivARB (will be remapped) */ + "ip\0" + "glVertexAttrib4Nuiv\0" + "glVertexAttrib4NuivARB\0" + "\0" + /* _mesa_function_pool[16570]: ClientActiveTextureARB (offset 375) */ + "i\0" + "glClientActiveTexture\0" + "glClientActiveTextureARB\0" + "\0" + /* _mesa_function_pool[16620]: PixelTexGenSGIX (will be remapped) */ + "i\0" + "glPixelTexGenSGIX\0" + "\0" + /* _mesa_function_pool[16641]: ReplacementCodeusvSUN (dynamic) */ + "p\0" + "glReplacementCodeusvSUN\0" + "\0" + /* _mesa_function_pool[16668]: Uniform4fARB (will be remapped) */ + "iffff\0" + "glUniform4f\0" + "glUniform4fARB\0" + "\0" + /* _mesa_function_pool[16702]: Color4sv (offset 34) */ + "p\0" + "glColor4sv\0" + "\0" + /* _mesa_function_pool[16716]: FlushMappedBufferRange (will be remapped) */ + "iii\0" + "glFlushMappedBufferRange\0" + "\0" + /* _mesa_function_pool[16746]: IsProgramNV (will be remapped) */ + "i\0" + "glIsProgramARB\0" + "glIsProgramNV\0" + "\0" + /* _mesa_function_pool[16778]: FlushMappedBufferRangeAPPLE (will be remapped) */ + "iii\0" + "glFlushMappedBufferRangeAPPLE\0" + "\0" + /* _mesa_function_pool[16813]: PixelZoom (offset 246) */ + "ff\0" + "glPixelZoom\0" + "\0" + /* _mesa_function_pool[16829]: ReplacementCodePointerSUN (dynamic) */ + "iip\0" + "glReplacementCodePointerSUN\0" + "\0" + /* _mesa_function_pool[16862]: ProgramEnvParameter4dARB (will be remapped) */ + "iidddd\0" + "glProgramEnvParameter4dARB\0" + "glProgramParameter4dNV\0" + "\0" + /* _mesa_function_pool[16920]: ColorTableParameterfv (offset 340) */ + "iip\0" + "glColorTableParameterfv\0" + "glColorTableParameterfvSGI\0" + "\0" + /* _mesa_function_pool[16976]: FragmentLightModelfSGIX (dynamic) */ + "if\0" + "glFragmentLightModelfSGIX\0" + "\0" + /* _mesa_function_pool[17006]: Binormal3bvEXT (dynamic) */ + "p\0" + "glBinormal3bvEXT\0" + "\0" + /* _mesa_function_pool[17026]: PixelMapuiv (offset 252) */ + "iip\0" + "glPixelMapuiv\0" + "\0" + /* _mesa_function_pool[17045]: Color3dv (offset 12) */ + "p\0" + "glColor3dv\0" + "\0" + /* _mesa_function_pool[17059]: IsTexture (offset 330) */ + "i\0" + "glIsTexture\0" + "glIsTextureEXT\0" + "\0" + /* _mesa_function_pool[17089]: VertexWeightfvEXT (dynamic) */ + "p\0" + "glVertexWeightfvEXT\0" + "\0" + /* _mesa_function_pool[17112]: VertexAttrib1dARB (will be remapped) */ + "id\0" + "glVertexAttrib1d\0" + "glVertexAttrib1dARB\0" + "\0" + /* _mesa_function_pool[17153]: ImageTransformParameterivHP (dynamic) */ + "iip\0" + "glImageTransformParameterivHP\0" + "\0" + /* _mesa_function_pool[17188]: TexCoord4i (offset 122) */ + "iiii\0" + "glTexCoord4i\0" + "\0" + /* _mesa_function_pool[17207]: DeleteQueriesARB (will be remapped) */ + "ip\0" + "glDeleteQueries\0" + "glDeleteQueriesARB\0" + "\0" + /* _mesa_function_pool[17246]: Color4ubVertex2fSUN (dynamic) */ + "iiiiff\0" + "glColor4ubVertex2fSUN\0" + "\0" + /* _mesa_function_pool[17276]: FragmentColorMaterialSGIX (dynamic) */ + "ii\0" + "glFragmentColorMaterialSGIX\0" + "\0" + /* _mesa_function_pool[17308]: CurrentPaletteMatrixARB (dynamic) */ + "i\0" + "glCurrentPaletteMatrixARB\0" + "\0" + /* _mesa_function_pool[17337]: GetMapdv (offset 266) */ + "iip\0" + "glGetMapdv\0" + "\0" + /* _mesa_function_pool[17353]: SamplePatternSGIS (will be remapped) */ + "i\0" + "glSamplePatternSGIS\0" + "glSamplePatternEXT\0" + "\0" + /* _mesa_function_pool[17395]: PixelStoref (offset 249) */ + "if\0" + "glPixelStoref\0" + "\0" + /* _mesa_function_pool[17413]: IsQueryARB (will be remapped) */ + "i\0" + "glIsQuery\0" + "glIsQueryARB\0" + "\0" + /* _mesa_function_pool[17439]: ReplacementCodeuiColor4ubVertex3fSUN (dynamic) */ + "iiiiifff\0" + "glReplacementCodeuiColor4ubVertex3fSUN\0" + "\0" + /* _mesa_function_pool[17488]: PixelStorei (offset 250) */ + "ii\0" + "glPixelStorei\0" + "\0" + /* _mesa_function_pool[17506]: VertexAttrib4usvARB (will be remapped) */ + "ip\0" + "glVertexAttrib4usv\0" + "glVertexAttrib4usvARB\0" + "\0" + /* _mesa_function_pool[17551]: LinkProgramARB (will be remapped) */ + "i\0" + "glLinkProgram\0" + "glLinkProgramARB\0" + "\0" + /* _mesa_function_pool[17585]: VertexAttrib2fNV (will be remapped) */ + "iff\0" + "glVertexAttrib2fNV\0" + "\0" + /* _mesa_function_pool[17609]: ShaderSourceARB (will be remapped) */ + "iipp\0" + "glShaderSource\0" + "glShaderSourceARB\0" + "\0" + /* _mesa_function_pool[17648]: FragmentMaterialiSGIX (dynamic) */ + "iii\0" + "glFragmentMaterialiSGIX\0" + "\0" + /* _mesa_function_pool[17677]: EvalCoord2dv (offset 233) */ + "p\0" + "glEvalCoord2dv\0" + "\0" + /* _mesa_function_pool[17695]: VertexAttrib3svARB (will be remapped) */ + "ip\0" + "glVertexAttrib3sv\0" + "glVertexAttrib3svARB\0" + "\0" + /* _mesa_function_pool[17738]: ColorMaterial (offset 151) */ + "ii\0" + "glColorMaterial\0" + "\0" + /* _mesa_function_pool[17758]: CompressedTexSubImage3DARB (will be remapped) */ + "iiiiiiiiiip\0" + "glCompressedTexSubImage3D\0" + "glCompressedTexSubImage3DARB\0" + "\0" + /* _mesa_function_pool[17826]: WindowPos2ivMESA (will be remapped) */ + "p\0" + "glWindowPos2iv\0" + "glWindowPos2ivARB\0" + "glWindowPos2ivMESA\0" + "\0" + /* _mesa_function_pool[17881]: IsFramebufferEXT (will be remapped) */ + "i\0" + "glIsFramebuffer\0" + "glIsFramebufferEXT\0" + "\0" + /* _mesa_function_pool[17919]: Uniform4ivARB (will be remapped) */ + "iip\0" + "glUniform4iv\0" + "glUniform4ivARB\0" + "\0" + /* _mesa_function_pool[17953]: GetVertexAttribdvARB (will be remapped) */ + "iip\0" + "glGetVertexAttribdv\0" + "glGetVertexAttribdvARB\0" + "\0" + /* _mesa_function_pool[18001]: TexBumpParameterivATI (will be remapped) */ + "ip\0" + "glTexBumpParameterivATI\0" + "\0" + /* _mesa_function_pool[18029]: GetSeparableFilter (offset 359) */ + "iiippp\0" + "glGetSeparableFilter\0" + "glGetSeparableFilterEXT\0" + "\0" + /* _mesa_function_pool[18082]: Binormal3dEXT (dynamic) */ + "ddd\0" + "glBinormal3dEXT\0" + "\0" + /* _mesa_function_pool[18103]: SpriteParameteriSGIX (dynamic) */ + "ii\0" + "glSpriteParameteriSGIX\0" + "\0" + /* _mesa_function_pool[18130]: RequestResidentProgramsNV (will be remapped) */ + "ip\0" + "glRequestResidentProgramsNV\0" + "\0" + /* _mesa_function_pool[18162]: TagSampleBufferSGIX (dynamic) */ + "\0" + "glTagSampleBufferSGIX\0" + "\0" + /* _mesa_function_pool[18186]: ReplacementCodeusSUN (dynamic) */ + "i\0" + "glReplacementCodeusSUN\0" + "\0" + /* _mesa_function_pool[18212]: FeedbackBuffer (offset 194) */ + "iip\0" + "glFeedbackBuffer\0" + "\0" + /* _mesa_function_pool[18234]: RasterPos2iv (offset 67) */ + "p\0" + "glRasterPos2iv\0" + "\0" + /* _mesa_function_pool[18252]: TexImage1D (offset 182) */ + "iiiiiiip\0" + "glTexImage1D\0" + "\0" + /* _mesa_function_pool[18275]: ListParameterivSGIX (dynamic) */ + "iip\0" + "glListParameterivSGIX\0" + "\0" + /* _mesa_function_pool[18302]: MultiDrawElementsEXT (will be remapped) */ + "ipipi\0" + "glMultiDrawElements\0" + "glMultiDrawElementsEXT\0" + "\0" + /* _mesa_function_pool[18352]: Color3s (offset 17) */ + "iii\0" + "glColor3s\0" + "\0" + /* _mesa_function_pool[18367]: Uniform1ivARB (will be remapped) */ + "iip\0" + "glUniform1iv\0" + "glUniform1ivARB\0" + "\0" + /* _mesa_function_pool[18401]: WindowPos2sMESA (will be remapped) */ + "ii\0" + "glWindowPos2s\0" + "glWindowPos2sARB\0" + "glWindowPos2sMESA\0" + "\0" + /* _mesa_function_pool[18454]: WeightusvARB (dynamic) */ + "ip\0" + "glWeightusvARB\0" + "\0" + /* _mesa_function_pool[18473]: TexCoordPointer (offset 320) */ + "iiip\0" + "glTexCoordPointer\0" + "\0" + /* _mesa_function_pool[18497]: FogCoordPointerEXT (will be remapped) */ + "iip\0" + "glFogCoordPointer\0" + "glFogCoordPointerEXT\0" + "\0" + /* _mesa_function_pool[18541]: IndexMaterialEXT (dynamic) */ + "ii\0" + "glIndexMaterialEXT\0" + "\0" + /* _mesa_function_pool[18564]: Color3i (offset 15) */ + "iii\0" + "glColor3i\0" + "\0" + /* _mesa_function_pool[18579]: FrontFace (offset 157) */ + "i\0" + "glFrontFace\0" + "\0" + /* _mesa_function_pool[18594]: EvalCoord2d (offset 232) */ + "dd\0" + "glEvalCoord2d\0" + "\0" + /* _mesa_function_pool[18612]: SecondaryColor3ubvEXT (will be remapped) */ + "p\0" + "glSecondaryColor3ubv\0" + "glSecondaryColor3ubvEXT\0" + "\0" + /* _mesa_function_pool[18660]: EvalCoord2f (offset 234) */ + "ff\0" + "glEvalCoord2f\0" + "\0" + /* _mesa_function_pool[18678]: VertexAttrib4dvARB (will be remapped) */ + "ip\0" + "glVertexAttrib4dv\0" + "glVertexAttrib4dvARB\0" + "\0" + /* _mesa_function_pool[18721]: BindAttribLocationARB (will be remapped) */ + "iip\0" + "glBindAttribLocation\0" + "glBindAttribLocationARB\0" + "\0" + /* _mesa_function_pool[18771]: Color3b (offset 9) */ + "iii\0" + "glColor3b\0" + "\0" + /* _mesa_function_pool[18786]: MultiTexCoord2dARB (offset 384) */ + "idd\0" + "glMultiTexCoord2d\0" + "glMultiTexCoord2dARB\0" + "\0" + /* _mesa_function_pool[18830]: ExecuteProgramNV (will be remapped) */ + "iip\0" + "glExecuteProgramNV\0" + "\0" + /* _mesa_function_pool[18854]: Color3f (offset 13) */ + "fff\0" + "glColor3f\0" + "\0" + /* _mesa_function_pool[18869]: LightEnviSGIX (dynamic) */ + "ii\0" + "glLightEnviSGIX\0" + "\0" + /* _mesa_function_pool[18889]: Color3d (offset 11) */ + "ddd\0" + "glColor3d\0" + "\0" + /* _mesa_function_pool[18904]: Normal3dv (offset 55) */ + "p\0" + "glNormal3dv\0" + "\0" + /* _mesa_function_pool[18919]: Lightf (offset 159) */ + "iif\0" + "glLightf\0" + "\0" + /* _mesa_function_pool[18933]: ReplacementCodeuiSUN (dynamic) */ + "i\0" + "glReplacementCodeuiSUN\0" + "\0" + /* _mesa_function_pool[18959]: MatrixMode (offset 293) */ + "i\0" + "glMatrixMode\0" + "\0" + /* _mesa_function_pool[18975]: GetPixelMapusv (offset 273) */ + "ip\0" + "glGetPixelMapusv\0" + "\0" + /* _mesa_function_pool[18996]: Lighti (offset 161) */ + "iii\0" + "glLighti\0" + "\0" + /* _mesa_function_pool[19010]: VertexAttribPointerNV (will be remapped) */ + "iiiip\0" + "glVertexAttribPointerNV\0" + "\0" + /* _mesa_function_pool[19041]: GetFramebufferAttachmentParameterivEXT (will be remapped) */ + "iiip\0" + "glGetFramebufferAttachmentParameteriv\0" + "glGetFramebufferAttachmentParameterivEXT\0" + "\0" + /* _mesa_function_pool[19126]: PixelTransformParameterfEXT (dynamic) */ + "iif\0" + "glPixelTransformParameterfEXT\0" + "\0" + /* _mesa_function_pool[19161]: MultiTexCoord4dvARB (offset 401) */ + "ip\0" + "glMultiTexCoord4dv\0" + "glMultiTexCoord4dvARB\0" + "\0" + /* _mesa_function_pool[19206]: PixelTransformParameteriEXT (dynamic) */ + "iii\0" + "glPixelTransformParameteriEXT\0" + "\0" + /* _mesa_function_pool[19241]: GetDoublev (offset 260) */ + "ip\0" + "glGetDoublev\0" + "\0" + /* _mesa_function_pool[19258]: MultMatrixd (offset 295) */ + "p\0" + "glMultMatrixd\0" + "\0" + /* _mesa_function_pool[19275]: MultMatrixf (offset 294) */ + "p\0" + "glMultMatrixf\0" + "\0" + /* _mesa_function_pool[19292]: TexCoord2fColor4ubVertex3fSUN (dynamic) */ + "ffiiiifff\0" + "glTexCoord2fColor4ubVertex3fSUN\0" + "\0" + /* _mesa_function_pool[19335]: Uniform1iARB (will be remapped) */ + "ii\0" + "glUniform1i\0" + "glUniform1iARB\0" + "\0" + /* _mesa_function_pool[19366]: VertexAttribPointerARB (will be remapped) */ + "iiiiip\0" + "glVertexAttribPointer\0" + "glVertexAttribPointerARB\0" + "\0" + /* _mesa_function_pool[19421]: SharpenTexFuncSGIS (dynamic) */ + "iip\0" + "glSharpenTexFuncSGIS\0" + "\0" + /* _mesa_function_pool[19447]: MultiTexCoord4fvARB (offset 403) */ + "ip\0" + "glMultiTexCoord4fv\0" + "glMultiTexCoord4fvARB\0" + "\0" + /* _mesa_function_pool[19492]: UniformMatrix2x3fv (will be remapped) */ + "iiip\0" + "glUniformMatrix2x3fv\0" + "\0" + /* _mesa_function_pool[19519]: TrackMatrixNV (will be remapped) */ + "iiii\0" + "glTrackMatrixNV\0" + "\0" + /* _mesa_function_pool[19541]: CombinerParameteriNV (will be remapped) */ + "ii\0" + "glCombinerParameteriNV\0" + "\0" + /* _mesa_function_pool[19568]: DeleteAsyncMarkersSGIX (dynamic) */ + "ii\0" + "glDeleteAsyncMarkersSGIX\0" + "\0" + /* _mesa_function_pool[19597]: IsAsyncMarkerSGIX (dynamic) */ + "i\0" + "glIsAsyncMarkerSGIX\0" + "\0" + /* _mesa_function_pool[19620]: FrameZoomSGIX (dynamic) */ + "i\0" + "glFrameZoomSGIX\0" + "\0" + /* _mesa_function_pool[19639]: Normal3fVertex3fvSUN (dynamic) */ + "pp\0" + "glNormal3fVertex3fvSUN\0" + "\0" + /* _mesa_function_pool[19666]: RasterPos4sv (offset 85) */ + "p\0" + "glRasterPos4sv\0" + "\0" + /* _mesa_function_pool[19684]: VertexAttrib4NsvARB (will be remapped) */ + "ip\0" + "glVertexAttrib4Nsv\0" + "glVertexAttrib4NsvARB\0" + "\0" + /* _mesa_function_pool[19729]: VertexAttrib3fvARB (will be remapped) */ + "ip\0" + "glVertexAttrib3fv\0" + "glVertexAttrib3fvARB\0" + "\0" + /* _mesa_function_pool[19772]: ClearColor (offset 206) */ + "ffff\0" + "glClearColor\0" + "\0" + /* _mesa_function_pool[19791]: GetSynciv (will be remapped) */ + "iiipp\0" + "glGetSynciv\0" + "\0" + /* _mesa_function_pool[19810]: DeleteFramebuffersEXT (will be remapped) */ + "ip\0" + "glDeleteFramebuffers\0" + "glDeleteFramebuffersEXT\0" + "\0" + /* _mesa_function_pool[19859]: GlobalAlphaFactorsSUN (dynamic) */ + "i\0" + "glGlobalAlphaFactorsSUN\0" + "\0" + /* _mesa_function_pool[19886]: TexEnviv (offset 187) */ + "iip\0" + "glTexEnviv\0" + "\0" + /* _mesa_function_pool[19902]: TexSubImage3D (offset 372) */ + "iiiiiiiiiip\0" + "glTexSubImage3D\0" + "glTexSubImage3DEXT\0" + "\0" + /* _mesa_function_pool[19950]: Tangent3fEXT (dynamic) */ + "fff\0" + "glTangent3fEXT\0" + "\0" + /* _mesa_function_pool[19970]: SecondaryColor3uivEXT (will be remapped) */ + "p\0" + "glSecondaryColor3uiv\0" + "glSecondaryColor3uivEXT\0" + "\0" + /* _mesa_function_pool[20018]: MatrixIndexubvARB (dynamic) */ + "ip\0" + "glMatrixIndexubvARB\0" + "\0" + /* _mesa_function_pool[20042]: Color4fNormal3fVertex3fSUN (dynamic) */ + "ffffffffff\0" + "glColor4fNormal3fVertex3fSUN\0" + "\0" + /* _mesa_function_pool[20083]: PixelTexGenParameterfSGIS (will be remapped) */ + "if\0" + "glPixelTexGenParameterfSGIS\0" + "\0" + /* _mesa_function_pool[20115]: CreateShader (will be remapped) */ + "i\0" + "glCreateShader\0" + "\0" + /* _mesa_function_pool[20133]: GetColorTableParameterfv (offset 344) */ + "iip\0" + "glGetColorTableParameterfv\0" + "glGetColorTableParameterfvSGI\0" + "glGetColorTableParameterfvEXT\0" + "\0" + /* _mesa_function_pool[20225]: FragmentLightModelfvSGIX (dynamic) */ + "ip\0" + "glFragmentLightModelfvSGIX\0" + "\0" + /* _mesa_function_pool[20256]: Bitmap (offset 8) */ + "iiffffp\0" + "glBitmap\0" + "\0" + /* _mesa_function_pool[20274]: MultiTexCoord3fARB (offset 394) */ + "ifff\0" + "glMultiTexCoord3f\0" + "glMultiTexCoord3fARB\0" + "\0" + /* _mesa_function_pool[20319]: GetTexLevelParameterfv (offset 284) */ + "iiip\0" + "glGetTexLevelParameterfv\0" + "\0" + /* _mesa_function_pool[20350]: GetPixelTexGenParameterfvSGIS (will be remapped) */ + "ip\0" + "glGetPixelTexGenParameterfvSGIS\0" + "\0" + /* _mesa_function_pool[20386]: GenFramebuffersEXT (will be remapped) */ + "ip\0" + "glGenFramebuffers\0" + "glGenFramebuffersEXT\0" + "\0" + /* _mesa_function_pool[20429]: GetProgramParameterdvNV (will be remapped) */ + "iiip\0" + "glGetProgramParameterdvNV\0" + "\0" + /* _mesa_function_pool[20461]: Vertex2sv (offset 133) */ + "p\0" + "glVertex2sv\0" + "\0" + /* _mesa_function_pool[20476]: GetIntegerv (offset 263) */ + "ip\0" + "glGetIntegerv\0" + "\0" + /* _mesa_function_pool[20494]: IsVertexArrayAPPLE (will be remapped) */ + "i\0" + "glIsVertexArray\0" + "glIsVertexArrayAPPLE\0" + "\0" + /* _mesa_function_pool[20534]: FragmentLightfvSGIX (dynamic) */ + "iip\0" + "glFragmentLightfvSGIX\0" + "\0" + /* _mesa_function_pool[20561]: DetachShader (will be remapped) */ + "ii\0" + "glDetachShader\0" + "\0" + /* _mesa_function_pool[20580]: VertexAttrib4NubARB (will be remapped) */ + "iiiii\0" + "glVertexAttrib4Nub\0" + "glVertexAttrib4NubARB\0" + "\0" + /* _mesa_function_pool[20628]: GetProgramEnvParameterfvARB (will be remapped) */ + "iip\0" + "glGetProgramEnvParameterfvARB\0" + "\0" + /* _mesa_function_pool[20663]: GetTrackMatrixivNV (will be remapped) */ + "iiip\0" + "glGetTrackMatrixivNV\0" + "\0" + /* _mesa_function_pool[20690]: VertexAttrib3svNV (will be remapped) */ + "ip\0" + "glVertexAttrib3svNV\0" + "\0" + /* _mesa_function_pool[20714]: Uniform4fvARB (will be remapped) */ + "iip\0" + "glUniform4fv\0" + "glUniform4fvARB\0" + "\0" + /* _mesa_function_pool[20748]: MultTransposeMatrixfARB (will be remapped) */ + "p\0" + "glMultTransposeMatrixf\0" + "glMultTransposeMatrixfARB\0" + "\0" + /* _mesa_function_pool[20800]: GetTexEnviv (offset 277) */ + "iip\0" + "glGetTexEnviv\0" + "\0" + /* _mesa_function_pool[20819]: ColorFragmentOp1ATI (will be remapped) */ + "iiiiiii\0" + "glColorFragmentOp1ATI\0" + "\0" + /* _mesa_function_pool[20850]: GetUniformfvARB (will be remapped) */ + "iip\0" + "glGetUniformfv\0" + "glGetUniformfvARB\0" + "\0" + /* _mesa_function_pool[20888]: PopClientAttrib (offset 334) */ + "\0" + "glPopClientAttrib\0" + "\0" + /* _mesa_function_pool[20908]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */ + "iffffffffffff\0" + "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN\0" + "\0" + /* _mesa_function_pool[20979]: DetachObjectARB (will be remapped) */ + "ii\0" + "glDetachObjectARB\0" + "\0" + /* _mesa_function_pool[21001]: VertexBlendARB (dynamic) */ + "i\0" + "glVertexBlendARB\0" + "\0" + /* _mesa_function_pool[21021]: WindowPos3iMESA (will be remapped) */ + "iii\0" + "glWindowPos3i\0" + "glWindowPos3iARB\0" + "glWindowPos3iMESA\0" + "\0" + /* _mesa_function_pool[21075]: SeparableFilter2D (offset 360) */ + "iiiiiipp\0" + "glSeparableFilter2D\0" + "glSeparableFilter2DEXT\0" + "\0" + /* _mesa_function_pool[21128]: ReplacementCodeuiColor4ubVertex3fvSUN (dynamic) */ + "ppp\0" + "glReplacementCodeuiColor4ubVertex3fvSUN\0" + "\0" + /* _mesa_function_pool[21173]: Map1d (offset 220) */ + "iddiip\0" + "glMap1d\0" + "\0" + /* _mesa_function_pool[21189]: Map1f (offset 221) */ + "iffiip\0" + "glMap1f\0" + "\0" + /* _mesa_function_pool[21205]: CompressedTexImage2DARB (will be remapped) */ + "iiiiiiip\0" + "glCompressedTexImage2D\0" + "glCompressedTexImage2DARB\0" + "\0" + /* _mesa_function_pool[21264]: ArrayElement (offset 306) */ + "i\0" + "glArrayElement\0" + "glArrayElementEXT\0" + "\0" + /* _mesa_function_pool[21300]: TexImage2D (offset 183) */ + "iiiiiiiip\0" + "glTexImage2D\0" + "\0" + /* _mesa_function_pool[21324]: DepthBoundsEXT (will be remapped) */ + "dd\0" + "glDepthBoundsEXT\0" + "\0" + /* _mesa_function_pool[21345]: ProgramParameters4fvNV (will be remapped) */ + "iiip\0" + "glProgramParameters4fvNV\0" + "\0" + /* _mesa_function_pool[21376]: DeformationMap3fSGIX (dynamic) */ + "iffiiffiiffiip\0" + "glDeformationMap3fSGIX\0" + "\0" + /* _mesa_function_pool[21415]: GetProgramivNV (will be remapped) */ + "iip\0" + "glGetProgramivNV\0" + "\0" + /* _mesa_function_pool[21437]: GetMinmaxParameteriv (offset 366) */ + "iip\0" + "glGetMinmaxParameteriv\0" + "glGetMinmaxParameterivEXT\0" + "\0" + /* _mesa_function_pool[21491]: PixelTransferf (offset 247) */ + "if\0" + "glPixelTransferf\0" + "\0" + /* _mesa_function_pool[21512]: CopyTexImage1D (offset 323) */ + "iiiiiii\0" + "glCopyTexImage1D\0" + "glCopyTexImage1DEXT\0" + "\0" + /* _mesa_function_pool[21558]: PushMatrix (offset 298) */ + "\0" + "glPushMatrix\0" + "\0" + /* _mesa_function_pool[21573]: Fogiv (offset 156) */ + "ip\0" + "glFogiv\0" + "\0" + /* _mesa_function_pool[21585]: TexCoord1dv (offset 95) */ + "p\0" + "glTexCoord1dv\0" + "\0" + /* _mesa_function_pool[21602]: AlphaFragmentOp3ATI (will be remapped) */ + "iiiiiiiiiiii\0" + "glAlphaFragmentOp3ATI\0" + "\0" + /* _mesa_function_pool[21638]: PixelTransferi (offset 248) */ + "ii\0" + "glPixelTransferi\0" + "\0" + /* _mesa_function_pool[21659]: GetVertexAttribdvNV (will be remapped) */ + "iip\0" + "glGetVertexAttribdvNV\0" + "\0" + /* _mesa_function_pool[21686]: VertexAttrib3fvNV (will be remapped) */ + "ip\0" + "glVertexAttrib3fvNV\0" + "\0" + /* _mesa_function_pool[21710]: Rotatef (offset 300) */ + "ffff\0" + "glRotatef\0" + "\0" + /* _mesa_function_pool[21726]: GetFinalCombinerInputParameterivNV (will be remapped) */ + "iip\0" + "glGetFinalCombinerInputParameterivNV\0" + "\0" + /* _mesa_function_pool[21768]: Vertex3i (offset 138) */ + "iii\0" + "glVertex3i\0" + "\0" + /* _mesa_function_pool[21784]: Vertex3f (offset 136) */ + "fff\0" + "glVertex3f\0" + "\0" + /* _mesa_function_pool[21800]: Clear (offset 203) */ + "i\0" + "glClear\0" + "\0" + /* _mesa_function_pool[21811]: Vertex3d (offset 134) */ + "ddd\0" + "glVertex3d\0" + "\0" + /* _mesa_function_pool[21827]: GetMapParameterivNV (dynamic) */ + "iip\0" + "glGetMapParameterivNV\0" + "\0" + /* _mesa_function_pool[21854]: Uniform4iARB (will be remapped) */ + "iiiii\0" + "glUniform4i\0" + "glUniform4iARB\0" + "\0" + /* _mesa_function_pool[21888]: ReadBuffer (offset 254) */ + "i\0" + "glReadBuffer\0" + "\0" + /* _mesa_function_pool[21904]: ConvolutionParameteri (offset 352) */ + "iii\0" + "glConvolutionParameteri\0" + "glConvolutionParameteriEXT\0" + "\0" + /* _mesa_function_pool[21960]: Ortho (offset 296) */ + "dddddd\0" + "glOrtho\0" + "\0" + /* _mesa_function_pool[21976]: Binormal3sEXT (dynamic) */ + "iii\0" + "glBinormal3sEXT\0" + "\0" + /* _mesa_function_pool[21997]: ListBase (offset 6) */ + "i\0" + "glListBase\0" + "\0" + /* _mesa_function_pool[22011]: Vertex3s (offset 140) */ + "iii\0" + "glVertex3s\0" + "\0" + /* _mesa_function_pool[22027]: ConvolutionParameterf (offset 350) */ + "iif\0" + "glConvolutionParameterf\0" + "glConvolutionParameterfEXT\0" + "\0" + /* _mesa_function_pool[22083]: GetColorTableParameteriv (offset 345) */ + "iip\0" + "glGetColorTableParameteriv\0" + "glGetColorTableParameterivSGI\0" + "glGetColorTableParameterivEXT\0" + "\0" + /* _mesa_function_pool[22175]: ProgramEnvParameter4dvARB (will be remapped) */ + "iip\0" + "glProgramEnvParameter4dvARB\0" + "glProgramParameter4dvNV\0" + "\0" + /* _mesa_function_pool[22232]: ShadeModel (offset 177) */ + "i\0" + "glShadeModel\0" + "\0" + /* _mesa_function_pool[22248]: VertexAttribs2fvNV (will be remapped) */ + "iip\0" + "glVertexAttribs2fvNV\0" + "\0" + /* _mesa_function_pool[22274]: Rectiv (offset 91) */ + "pp\0" + "glRectiv\0" + "\0" + /* _mesa_function_pool[22287]: UseProgramObjectARB (will be remapped) */ + "i\0" + "glUseProgram\0" + "glUseProgramObjectARB\0" + "\0" + /* _mesa_function_pool[22325]: GetMapParameterfvNV (dynamic) */ + "iip\0" + "glGetMapParameterfvNV\0" + "\0" + /* _mesa_function_pool[22352]: PassTexCoordATI (will be remapped) */ + "iii\0" + "glPassTexCoordATI\0" + "\0" + /* _mesa_function_pool[22375]: DeleteProgram (will be remapped) */ + "i\0" + "glDeleteProgram\0" + "\0" + /* _mesa_function_pool[22394]: Tangent3ivEXT (dynamic) */ + "p\0" + "glTangent3ivEXT\0" + "\0" + /* _mesa_function_pool[22413]: Tangent3dEXT (dynamic) */ + "ddd\0" + "glTangent3dEXT\0" + "\0" + /* _mesa_function_pool[22433]: SecondaryColor3dvEXT (will be remapped) */ + "p\0" + "glSecondaryColor3dv\0" + "glSecondaryColor3dvEXT\0" + "\0" + /* _mesa_function_pool[22479]: Vertex2fv (offset 129) */ + "p\0" + "glVertex2fv\0" + "\0" + /* _mesa_function_pool[22494]: MultiDrawArraysEXT (will be remapped) */ + "ippi\0" + "glMultiDrawArrays\0" + "glMultiDrawArraysEXT\0" + "\0" + /* _mesa_function_pool[22539]: BindRenderbufferEXT (will be remapped) */ + "ii\0" + "glBindRenderbuffer\0" + "glBindRenderbufferEXT\0" + "\0" + /* _mesa_function_pool[22584]: MultiTexCoord4dARB (offset 400) */ + "idddd\0" + "glMultiTexCoord4d\0" + "glMultiTexCoord4dARB\0" + "\0" + /* _mesa_function_pool[22630]: Vertex3sv (offset 141) */ + "p\0" + "glVertex3sv\0" + "\0" + /* _mesa_function_pool[22645]: SecondaryColor3usEXT (will be remapped) */ + "iii\0" + "glSecondaryColor3us\0" + "glSecondaryColor3usEXT\0" + "\0" + /* _mesa_function_pool[22693]: ProgramLocalParameter4fvARB (will be remapped) */ + "iip\0" + "glProgramLocalParameter4fvARB\0" + "\0" + /* _mesa_function_pool[22728]: DeleteProgramsNV (will be remapped) */ + "ip\0" + "glDeleteProgramsARB\0" + "glDeleteProgramsNV\0" + "\0" + /* _mesa_function_pool[22771]: EvalMesh1 (offset 236) */ + "iii\0" + "glEvalMesh1\0" + "\0" + /* _mesa_function_pool[22788]: MultiTexCoord1sARB (offset 382) */ + "ii\0" + "glMultiTexCoord1s\0" + "glMultiTexCoord1sARB\0" + "\0" + /* _mesa_function_pool[22831]: ReplacementCodeuiColor3fVertex3fSUN (dynamic) */ + "iffffff\0" + "glReplacementCodeuiColor3fVertex3fSUN\0" + "\0" + /* _mesa_function_pool[22878]: GetVertexAttribPointervNV (will be remapped) */ + "iip\0" + "glGetVertexAttribPointerv\0" + "glGetVertexAttribPointervARB\0" + "glGetVertexAttribPointervNV\0" + "\0" + /* _mesa_function_pool[22966]: MultiTexCoord1dvARB (offset 377) */ + "ip\0" + "glMultiTexCoord1dv\0" + "glMultiTexCoord1dvARB\0" + "\0" + /* _mesa_function_pool[23011]: Uniform2iARB (will be remapped) */ + "iii\0" + "glUniform2i\0" + "glUniform2iARB\0" + "\0" + /* _mesa_function_pool[23043]: Vertex2iv (offset 131) */ + "p\0" + "glVertex2iv\0" + "\0" + /* _mesa_function_pool[23058]: GetProgramStringNV (will be remapped) */ + "iip\0" + "glGetProgramStringNV\0" + "\0" + /* _mesa_function_pool[23084]: ColorPointerEXT (will be remapped) */ + "iiiip\0" + "glColorPointerEXT\0" + "\0" + /* _mesa_function_pool[23109]: LineWidth (offset 168) */ + "f\0" + "glLineWidth\0" + "\0" + /* _mesa_function_pool[23124]: MapBufferARB (will be remapped) */ + "ii\0" + "glMapBuffer\0" + "glMapBufferARB\0" + "\0" + /* _mesa_function_pool[23155]: MultiDrawElementsBaseVertex (will be remapped) */ + "ipipip\0" + "glMultiDrawElementsBaseVertex\0" + "\0" + /* _mesa_function_pool[23193]: Binormal3svEXT (dynamic) */ + "p\0" + "glBinormal3svEXT\0" + "\0" + /* _mesa_function_pool[23213]: ApplyTextureEXT (dynamic) */ + "i\0" + "glApplyTextureEXT\0" + "\0" + /* _mesa_function_pool[23234]: TexGendv (offset 189) */ + "iip\0" + "glTexGendv\0" + "\0" + /* _mesa_function_pool[23250]: TextureMaterialEXT (dynamic) */ + "ii\0" + "glTextureMaterialEXT\0" + "\0" + /* _mesa_function_pool[23275]: TextureLightEXT (dynamic) */ + "i\0" + "glTextureLightEXT\0" + "\0" + /* _mesa_function_pool[23296]: ResetMinmax (offset 370) */ + "i\0" + "glResetMinmax\0" + "glResetMinmaxEXT\0" + "\0" + /* _mesa_function_pool[23330]: SpriteParameterfSGIX (dynamic) */ + "if\0" + "glSpriteParameterfSGIX\0" + "\0" + /* _mesa_function_pool[23357]: EnableClientState (offset 313) */ + "i\0" + "glEnableClientState\0" + "\0" + /* _mesa_function_pool[23380]: VertexAttrib4sNV (will be remapped) */ + "iiiii\0" + "glVertexAttrib4sNV\0" + "\0" + /* _mesa_function_pool[23406]: GetConvolutionParameterfv (offset 357) */ + "iip\0" + "glGetConvolutionParameterfv\0" + "glGetConvolutionParameterfvEXT\0" + "\0" + /* _mesa_function_pool[23470]: VertexAttribs4dvNV (will be remapped) */ + "iip\0" + "glVertexAttribs4dvNV\0" + "\0" + /* _mesa_function_pool[23496]: VertexAttrib4dARB (will be remapped) */ + "idddd\0" + "glVertexAttrib4d\0" + "glVertexAttrib4dARB\0" + "\0" + /* _mesa_function_pool[23540]: GetTexBumpParameterfvATI (will be remapped) */ + "ip\0" + "glGetTexBumpParameterfvATI\0" + "\0" + /* _mesa_function_pool[23571]: ProgramNamedParameter4dNV (will be remapped) */ + "iipdddd\0" + "glProgramNamedParameter4dNV\0" + "\0" + /* _mesa_function_pool[23608]: GetMaterialfv (offset 269) */ + "iip\0" + "glGetMaterialfv\0" + "\0" + /* _mesa_function_pool[23629]: VertexWeightfEXT (dynamic) */ + "f\0" + "glVertexWeightfEXT\0" + "\0" + /* _mesa_function_pool[23651]: Binormal3fEXT (dynamic) */ + "fff\0" + "glBinormal3fEXT\0" + "\0" + /* _mesa_function_pool[23672]: CallList (offset 2) */ + "i\0" + "glCallList\0" + "\0" + /* _mesa_function_pool[23686]: Materialfv (offset 170) */ + "iip\0" + "glMaterialfv\0" + "\0" + /* _mesa_function_pool[23704]: TexCoord3fv (offset 113) */ + "p\0" + "glTexCoord3fv\0" + "\0" + /* _mesa_function_pool[23721]: FogCoordfvEXT (will be remapped) */ + "p\0" + "glFogCoordfv\0" + "glFogCoordfvEXT\0" + "\0" + /* _mesa_function_pool[23753]: MultiTexCoord1ivARB (offset 381) */ + "ip\0" + "glMultiTexCoord1iv\0" + "glMultiTexCoord1ivARB\0" + "\0" + /* _mesa_function_pool[23798]: SecondaryColor3ubEXT (will be remapped) */ + "iii\0" + "glSecondaryColor3ub\0" + "glSecondaryColor3ubEXT\0" + "\0" + /* _mesa_function_pool[23846]: MultiTexCoord2ivARB (offset 389) */ + "ip\0" + "glMultiTexCoord2iv\0" + "glMultiTexCoord2ivARB\0" + "\0" + /* _mesa_function_pool[23891]: FogFuncSGIS (dynamic) */ + "ip\0" + "glFogFuncSGIS\0" + "\0" + /* _mesa_function_pool[23909]: CopyTexSubImage2D (offset 326) */ + "iiiiiiii\0" + "glCopyTexSubImage2D\0" + "glCopyTexSubImage2DEXT\0" + "\0" + /* _mesa_function_pool[23962]: GetObjectParameterivARB (will be remapped) */ + "iip\0" + "glGetObjectParameterivARB\0" + "\0" + /* _mesa_function_pool[23993]: Color3iv (offset 16) */ + "p\0" + "glColor3iv\0" + "\0" + /* _mesa_function_pool[24007]: TexCoord4fVertex4fSUN (dynamic) */ + "ffffffff\0" + "glTexCoord4fVertex4fSUN\0" + "\0" + /* _mesa_function_pool[24041]: DrawElements (offset 311) */ + "iiip\0" + "glDrawElements\0" + "\0" + /* _mesa_function_pool[24062]: BindVertexArrayAPPLE (will be remapped) */ + "i\0" + "glBindVertexArrayAPPLE\0" + "\0" + /* _mesa_function_pool[24088]: GetProgramLocalParameterdvARB (will be remapped) */ + "iip\0" + "glGetProgramLocalParameterdvARB\0" + "\0" + /* _mesa_function_pool[24125]: GetHistogramParameteriv (offset 363) */ + "iip\0" + "glGetHistogramParameteriv\0" + "glGetHistogramParameterivEXT\0" + "\0" + /* _mesa_function_pool[24185]: MultiTexCoord1iARB (offset 380) */ + "ii\0" + "glMultiTexCoord1i\0" + "glMultiTexCoord1iARB\0" + "\0" + /* _mesa_function_pool[24228]: GetConvolutionFilter (offset 356) */ + "iiip\0" + "glGetConvolutionFilter\0" + "glGetConvolutionFilterEXT\0" + "\0" + /* _mesa_function_pool[24283]: GetProgramivARB (will be remapped) */ + "iip\0" + "glGetProgramivARB\0" + "\0" + /* _mesa_function_pool[24306]: BlendFuncSeparateEXT (will be remapped) */ + "iiii\0" + "glBlendFuncSeparate\0" + "glBlendFuncSeparateEXT\0" + "glBlendFuncSeparateINGR\0" + "\0" + /* _mesa_function_pool[24379]: MapBufferRange (will be remapped) */ + "iiii\0" + "glMapBufferRange\0" + "\0" + /* _mesa_function_pool[24402]: ProgramParameters4dvNV (will be remapped) */ + "iiip\0" + "glProgramParameters4dvNV\0" + "\0" + /* _mesa_function_pool[24433]: TexCoord2fColor3fVertex3fvSUN (dynamic) */ + "ppp\0" + "glTexCoord2fColor3fVertex3fvSUN\0" + "\0" + /* _mesa_function_pool[24470]: EvalPoint2 (offset 239) */ + "ii\0" + "glEvalPoint2\0" + "\0" + /* _mesa_function_pool[24487]: EvalPoint1 (offset 237) */ + "i\0" + "glEvalPoint1\0" + "\0" + /* _mesa_function_pool[24503]: Binormal3dvEXT (dynamic) */ + "p\0" + "glBinormal3dvEXT\0" + "\0" + /* _mesa_function_pool[24523]: PopMatrix (offset 297) */ + "\0" + "glPopMatrix\0" + "\0" + /* _mesa_function_pool[24537]: FinishFenceNV (will be remapped) */ + "i\0" + "glFinishFenceNV\0" + "\0" + /* _mesa_function_pool[24556]: GetFogFuncSGIS (dynamic) */ + "p\0" + "glGetFogFuncSGIS\0" + "\0" + /* _mesa_function_pool[24576]: GetUniformLocationARB (will be remapped) */ + "ip\0" + "glGetUniformLocation\0" + "glGetUniformLocationARB\0" + "\0" + /* _mesa_function_pool[24625]: SecondaryColor3fEXT (will be remapped) */ + "fff\0" + "glSecondaryColor3f\0" + "glSecondaryColor3fEXT\0" + "\0" + /* _mesa_function_pool[24671]: GetTexGeniv (offset 280) */ + "iip\0" + "glGetTexGeniv\0" + "\0" + /* _mesa_function_pool[24690]: CombinerInputNV (will be remapped) */ + "iiiiii\0" + "glCombinerInputNV\0" + "\0" + /* _mesa_function_pool[24716]: VertexAttrib3sARB (will be remapped) */ + "iiii\0" + "glVertexAttrib3s\0" + "glVertexAttrib3sARB\0" + "\0" + /* _mesa_function_pool[24759]: ReplacementCodeuiNormal3fVertex3fvSUN (dynamic) */ + "ppp\0" + "glReplacementCodeuiNormal3fVertex3fvSUN\0" + "\0" + /* _mesa_function_pool[24804]: Map2d (offset 222) */ + "iddiiddiip\0" + "glMap2d\0" + "\0" + /* _mesa_function_pool[24824]: Map2f (offset 223) */ + "iffiiffiip\0" + "glMap2f\0" + "\0" + /* _mesa_function_pool[24844]: ProgramStringARB (will be remapped) */ + "iiip\0" + "glProgramStringARB\0" + "\0" + /* _mesa_function_pool[24869]: Vertex4s (offset 148) */ + "iiii\0" + "glVertex4s\0" + "\0" + /* _mesa_function_pool[24886]: TexCoord4fVertex4fvSUN (dynamic) */ + "pp\0" + "glTexCoord4fVertex4fvSUN\0" + "\0" + /* _mesa_function_pool[24915]: VertexAttrib3sNV (will be remapped) */ + "iiii\0" + "glVertexAttrib3sNV\0" + "\0" + /* _mesa_function_pool[24940]: VertexAttrib1fNV (will be remapped) */ + "if\0" + "glVertexAttrib1fNV\0" + "\0" + /* _mesa_function_pool[24963]: Vertex4f (offset 144) */ + "ffff\0" + "glVertex4f\0" + "\0" + /* _mesa_function_pool[24980]: EvalCoord1d (offset 228) */ + "d\0" + "glEvalCoord1d\0" + "\0" + /* _mesa_function_pool[24997]: Vertex4d (offset 142) */ + "dddd\0" + "glVertex4d\0" + "\0" + /* _mesa_function_pool[25014]: RasterPos4dv (offset 79) */ + "p\0" + "glRasterPos4dv\0" + "\0" + /* _mesa_function_pool[25032]: FragmentLightfSGIX (dynamic) */ + "iif\0" + "glFragmentLightfSGIX\0" + "\0" + /* _mesa_function_pool[25058]: GetCompressedTexImageARB (will be remapped) */ + "iip\0" + "glGetCompressedTexImage\0" + "glGetCompressedTexImageARB\0" + "\0" + /* _mesa_function_pool[25114]: GetTexGenfv (offset 279) */ + "iip\0" + "glGetTexGenfv\0" + "\0" + /* _mesa_function_pool[25133]: Vertex4i (offset 146) */ + "iiii\0" + "glVertex4i\0" + "\0" + /* _mesa_function_pool[25150]: VertexWeightPointerEXT (dynamic) */ + "iiip\0" + "glVertexWeightPointerEXT\0" + "\0" + /* _mesa_function_pool[25181]: GetHistogram (offset 361) */ + "iiiip\0" + "glGetHistogram\0" + "glGetHistogramEXT\0" + "\0" + /* _mesa_function_pool[25221]: ActiveStencilFaceEXT (will be remapped) */ + "i\0" + "glActiveStencilFaceEXT\0" + "\0" + /* _mesa_function_pool[25247]: StencilFuncSeparateATI (will be remapped) */ + "iiii\0" + "glStencilFuncSeparateATI\0" + "\0" + /* _mesa_function_pool[25278]: Materialf (offset 169) */ + "iif\0" + "glMaterialf\0" + "\0" + /* _mesa_function_pool[25295]: GetShaderSourceARB (will be remapped) */ + "iipp\0" + "glGetShaderSource\0" + "glGetShaderSourceARB\0" + "\0" + /* _mesa_function_pool[25340]: IglooInterfaceSGIX (dynamic) */ + "ip\0" + "glIglooInterfaceSGIX\0" + "\0" + /* _mesa_function_pool[25365]: Materiali (offset 171) */ + "iii\0" + "glMateriali\0" + "\0" + /* _mesa_function_pool[25382]: VertexAttrib4dNV (will be remapped) */ + "idddd\0" + "glVertexAttrib4dNV\0" + "\0" + /* _mesa_function_pool[25408]: MultiModeDrawElementsIBM (will be remapped) */ + "ppipii\0" + "glMultiModeDrawElementsIBM\0" + "\0" + /* _mesa_function_pool[25443]: Indexsv (offset 51) */ + "p\0" + "glIndexsv\0" + "\0" + /* _mesa_function_pool[25456]: MultiTexCoord4svARB (offset 407) */ + "ip\0" + "glMultiTexCoord4sv\0" + "glMultiTexCoord4svARB\0" + "\0" + /* _mesa_function_pool[25501]: LightModelfv (offset 164) */ + "ip\0" + "glLightModelfv\0" + "\0" + /* _mesa_function_pool[25520]: TexCoord2dv (offset 103) */ + "p\0" + "glTexCoord2dv\0" + "\0" + /* _mesa_function_pool[25537]: GenQueriesARB (will be remapped) */ + "ip\0" + "glGenQueries\0" + "glGenQueriesARB\0" + "\0" + /* _mesa_function_pool[25570]: EvalCoord1dv (offset 229) */ + "p\0" + "glEvalCoord1dv\0" + "\0" + /* _mesa_function_pool[25588]: ReplacementCodeuiVertex3fSUN (dynamic) */ + "ifff\0" + "glReplacementCodeuiVertex3fSUN\0" + "\0" + /* _mesa_function_pool[25625]: Translated (offset 303) */ + "ddd\0" + "glTranslated\0" + "\0" + /* _mesa_function_pool[25643]: Translatef (offset 304) */ + "fff\0" + "glTranslatef\0" + "\0" + /* _mesa_function_pool[25661]: StencilMask (offset 209) */ + "i\0" + "glStencilMask\0" + "\0" + /* _mesa_function_pool[25678]: Tangent3iEXT (dynamic) */ + "iii\0" + "glTangent3iEXT\0" + "\0" + /* _mesa_function_pool[25698]: GetLightiv (offset 265) */ + "iip\0" + "glGetLightiv\0" + "\0" + /* _mesa_function_pool[25716]: DrawMeshArraysSUN (dynamic) */ + "iiii\0" + "glDrawMeshArraysSUN\0" + "\0" + /* _mesa_function_pool[25742]: IsList (offset 287) */ + "i\0" + "glIsList\0" + "\0" + /* _mesa_function_pool[25754]: IsSync (will be remapped) */ + "i\0" + "glIsSync\0" + "\0" + /* _mesa_function_pool[25766]: RenderMode (offset 196) */ + "i\0" + "glRenderMode\0" + "\0" + /* _mesa_function_pool[25782]: GetMapControlPointsNV (dynamic) */ + "iiiiiip\0" + "glGetMapControlPointsNV\0" + "\0" + /* _mesa_function_pool[25815]: DrawBuffersARB (will be remapped) */ + "ip\0" + "glDrawBuffers\0" + "glDrawBuffersARB\0" + "glDrawBuffersATI\0" + "\0" + /* _mesa_function_pool[25867]: ProgramLocalParameter4fARB (will be remapped) */ + "iiffff\0" + "glProgramLocalParameter4fARB\0" + "\0" + /* _mesa_function_pool[25904]: SpriteParameterivSGIX (dynamic) */ + "ip\0" + "glSpriteParameterivSGIX\0" + "\0" + /* _mesa_function_pool[25932]: ProvokingVertexEXT (will be remapped) */ + "i\0" + "glProvokingVertexEXT\0" + "glProvokingVertex\0" + "\0" + /* _mesa_function_pool[25974]: MultiTexCoord1fARB (offset 378) */ + "if\0" + "glMultiTexCoord1f\0" + "glMultiTexCoord1fARB\0" + "\0" + /* _mesa_function_pool[26017]: LoadName (offset 198) */ + "i\0" + "glLoadName\0" + "\0" + /* _mesa_function_pool[26031]: VertexAttribs4ubvNV (will be remapped) */ + "iip\0" + "glVertexAttribs4ubvNV\0" + "\0" + /* _mesa_function_pool[26058]: WeightsvARB (dynamic) */ + "ip\0" + "glWeightsvARB\0" + "\0" + /* _mesa_function_pool[26076]: Uniform1fvARB (will be remapped) */ + "iip\0" + "glUniform1fv\0" + "glUniform1fvARB\0" + "\0" + /* _mesa_function_pool[26110]: CopyTexSubImage1D (offset 325) */ + "iiiiii\0" + "glCopyTexSubImage1D\0" + "glCopyTexSubImage1DEXT\0" + "\0" + /* _mesa_function_pool[26161]: CullFace (offset 152) */ + "i\0" + "glCullFace\0" + "\0" + /* _mesa_function_pool[26175]: BindTexture (offset 307) */ + "ii\0" + "glBindTexture\0" + "glBindTextureEXT\0" + "\0" + /* _mesa_function_pool[26210]: BeginFragmentShaderATI (will be remapped) */ + "\0" + "glBeginFragmentShaderATI\0" + "\0" + /* _mesa_function_pool[26237]: MultiTexCoord4fARB (offset 402) */ + "iffff\0" + "glMultiTexCoord4f\0" + "glMultiTexCoord4fARB\0" + "\0" + /* _mesa_function_pool[26283]: VertexAttribs3svNV (will be remapped) */ + "iip\0" + "glVertexAttribs3svNV\0" + "\0" + /* _mesa_function_pool[26309]: StencilFunc (offset 243) */ + "iii\0" + "glStencilFunc\0" + "\0" + /* _mesa_function_pool[26328]: CopyPixels (offset 255) */ + "iiiii\0" + "glCopyPixels\0" + "\0" + /* _mesa_function_pool[26348]: Rectsv (offset 93) */ + "pp\0" + "glRectsv\0" + "\0" + /* _mesa_function_pool[26361]: ReplacementCodeuivSUN (dynamic) */ + "p\0" + "glReplacementCodeuivSUN\0" + "\0" + /* _mesa_function_pool[26388]: EnableVertexAttribArrayARB (will be remapped) */ + "i\0" + "glEnableVertexAttribArray\0" + "glEnableVertexAttribArrayARB\0" + "\0" + /* _mesa_function_pool[26446]: NormalPointervINTEL (dynamic) */ + "ip\0" + "glNormalPointervINTEL\0" + "\0" + /* _mesa_function_pool[26472]: CopyConvolutionFilter2D (offset 355) */ + "iiiiii\0" + "glCopyConvolutionFilter2D\0" + "glCopyConvolutionFilter2DEXT\0" + "\0" + /* _mesa_function_pool[26535]: WindowPos3ivMESA (will be remapped) */ + "p\0" + "glWindowPos3iv\0" + "glWindowPos3ivARB\0" + "glWindowPos3ivMESA\0" + "\0" + /* _mesa_function_pool[26590]: CopyBufferSubData (will be remapped) */ + "iiiii\0" + "glCopyBufferSubData\0" + "\0" + /* _mesa_function_pool[26617]: NormalPointer (offset 318) */ + "iip\0" + "glNormalPointer\0" + "\0" + /* _mesa_function_pool[26638]: TexParameterfv (offset 179) */ + "iip\0" + "glTexParameterfv\0" + "\0" + /* _mesa_function_pool[26660]: IsBufferARB (will be remapped) */ + "i\0" + "glIsBuffer\0" + "glIsBufferARB\0" + "\0" + /* _mesa_function_pool[26688]: WindowPos4iMESA (will be remapped) */ + "iiii\0" + "glWindowPos4iMESA\0" + "\0" + /* _mesa_function_pool[26712]: VertexAttrib4uivARB (will be remapped) */ + "ip\0" + "glVertexAttrib4uiv\0" + "glVertexAttrib4uivARB\0" + "\0" + /* _mesa_function_pool[26757]: Tangent3bvEXT (dynamic) */ + "p\0" + "glTangent3bvEXT\0" + "\0" + /* _mesa_function_pool[26776]: UniformMatrix3x4fv (will be remapped) */ + "iiip\0" + "glUniformMatrix3x4fv\0" + "\0" + /* _mesa_function_pool[26803]: ClipPlane (offset 150) */ + "ip\0" + "glClipPlane\0" + "\0" + /* _mesa_function_pool[26819]: Recti (offset 90) */ + "iiii\0" + "glRecti\0" + "\0" + /* _mesa_function_pool[26833]: DrawRangeElementsBaseVertex (will be remapped) */ + "iiiiipi\0" + "glDrawRangeElementsBaseVertex\0" + "\0" + /* _mesa_function_pool[26872]: TexCoordPointervINTEL (dynamic) */ + "iip\0" + "glTexCoordPointervINTEL\0" + "\0" + /* _mesa_function_pool[26901]: DeleteBuffersARB (will be remapped) */ + "ip\0" + "glDeleteBuffers\0" + "glDeleteBuffersARB\0" + "\0" + /* _mesa_function_pool[26940]: WindowPos4fvMESA (will be remapped) */ + "p\0" + "glWindowPos4fvMESA\0" + "\0" + /* _mesa_function_pool[26962]: GetPixelMapuiv (offset 272) */ + "ip\0" + "glGetPixelMapuiv\0" + "\0" + /* _mesa_function_pool[26983]: Rectf (offset 88) */ + "ffff\0" + "glRectf\0" + "\0" + /* _mesa_function_pool[26997]: VertexAttrib1sNV (will be remapped) */ + "ii\0" + "glVertexAttrib1sNV\0" + "\0" + /* _mesa_function_pool[27020]: Indexfv (offset 47) */ + "p\0" + "glIndexfv\0" + "\0" + /* _mesa_function_pool[27033]: SecondaryColor3svEXT (will be remapped) */ + "p\0" + "glSecondaryColor3sv\0" + "glSecondaryColor3svEXT\0" + "\0" + /* _mesa_function_pool[27079]: LoadTransposeMatrixfARB (will be remapped) */ + "p\0" + "glLoadTransposeMatrixf\0" + "glLoadTransposeMatrixfARB\0" + "\0" + /* _mesa_function_pool[27131]: GetPointerv (offset 329) */ + "ip\0" + "glGetPointerv\0" + "glGetPointervEXT\0" + "\0" + /* _mesa_function_pool[27166]: Tangent3bEXT (dynamic) */ + "iii\0" + "glTangent3bEXT\0" + "\0" + /* _mesa_function_pool[27186]: CombinerParameterfNV (will be remapped) */ + "if\0" + "glCombinerParameterfNV\0" + "\0" + /* _mesa_function_pool[27213]: IndexMask (offset 212) */ + "i\0" + "glIndexMask\0" + "\0" + /* _mesa_function_pool[27228]: BindProgramNV (will be remapped) */ + "ii\0" + "glBindProgramARB\0" + "glBindProgramNV\0" + "\0" + /* _mesa_function_pool[27265]: VertexAttrib4svARB (will be remapped) */ + "ip\0" + "glVertexAttrib4sv\0" + "glVertexAttrib4svARB\0" + "\0" + /* _mesa_function_pool[27308]: GetFloatv (offset 262) */ + "ip\0" + "glGetFloatv\0" + "\0" + /* _mesa_function_pool[27324]: CreateDebugObjectMESA (dynamic) */ + "\0" + "glCreateDebugObjectMESA\0" + "\0" + /* _mesa_function_pool[27350]: GetShaderiv (will be remapped) */ + "iip\0" + "glGetShaderiv\0" + "\0" + /* _mesa_function_pool[27369]: ClientWaitSync (will be remapped) */ + "iii\0" + "glClientWaitSync\0" + "\0" + /* _mesa_function_pool[27391]: TexCoord4s (offset 124) */ + "iiii\0" + "glTexCoord4s\0" + "\0" + /* _mesa_function_pool[27410]: TexCoord3sv (offset 117) */ + "p\0" + "glTexCoord3sv\0" + "\0" + /* _mesa_function_pool[27427]: BindFragmentShaderATI (will be remapped) */ + "i\0" + "glBindFragmentShaderATI\0" + "\0" + /* _mesa_function_pool[27454]: PopAttrib (offset 218) */ + "\0" + "glPopAttrib\0" + "\0" + /* _mesa_function_pool[27468]: Fogfv (offset 154) */ + "ip\0" + "glFogfv\0" + "\0" + /* _mesa_function_pool[27480]: UnmapBufferARB (will be remapped) */ + "i\0" + "glUnmapBuffer\0" + "glUnmapBufferARB\0" + "\0" + /* _mesa_function_pool[27514]: InitNames (offset 197) */ + "\0" + "glInitNames\0" + "\0" + /* _mesa_function_pool[27528]: Normal3sv (offset 61) */ + "p\0" + "glNormal3sv\0" + "\0" + /* _mesa_function_pool[27543]: Minmax (offset 368) */ + "iii\0" + "glMinmax\0" + "glMinmaxEXT\0" + "\0" + /* _mesa_function_pool[27569]: TexCoord4d (offset 118) */ + "dddd\0" + "glTexCoord4d\0" + "\0" + /* _mesa_function_pool[27588]: DeformationMap3dSGIX (dynamic) */ + "iddiiddiiddiip\0" + "glDeformationMap3dSGIX\0" + "\0" + /* _mesa_function_pool[27627]: TexCoord4f (offset 120) */ + "ffff\0" + "glTexCoord4f\0" + "\0" + /* _mesa_function_pool[27646]: FogCoorddvEXT (will be remapped) */ + "p\0" + "glFogCoorddv\0" + "glFogCoorddvEXT\0" + "\0" + /* _mesa_function_pool[27678]: FinishTextureSUNX (dynamic) */ + "\0" + "glFinishTextureSUNX\0" + "\0" + /* _mesa_function_pool[27700]: GetFragmentLightfvSGIX (dynamic) */ + "iip\0" + "glGetFragmentLightfvSGIX\0" + "\0" + /* _mesa_function_pool[27730]: Binormal3fvEXT (dynamic) */ + "p\0" + "glBinormal3fvEXT\0" + "\0" + /* _mesa_function_pool[27750]: GetBooleanv (offset 258) */ + "ip\0" + "glGetBooleanv\0" + "\0" + /* _mesa_function_pool[27768]: ColorFragmentOp3ATI (will be remapped) */ + "iiiiiiiiiiiii\0" + "glColorFragmentOp3ATI\0" + "\0" + /* _mesa_function_pool[27805]: Hint (offset 158) */ + "ii\0" + "glHint\0" + "\0" + /* _mesa_function_pool[27816]: Color4dv (offset 28) */ + "p\0" + "glColor4dv\0" + "\0" + /* _mesa_function_pool[27830]: VertexAttrib2svARB (will be remapped) */ + "ip\0" + "glVertexAttrib2sv\0" + "glVertexAttrib2svARB\0" + "\0" + /* _mesa_function_pool[27873]: AreProgramsResidentNV (will be remapped) */ + "ipp\0" + "glAreProgramsResidentNV\0" + "\0" + /* _mesa_function_pool[27902]: WindowPos3svMESA (will be remapped) */ + "p\0" + "glWindowPos3sv\0" + "glWindowPos3svARB\0" + "glWindowPos3svMESA\0" + "\0" + /* _mesa_function_pool[27957]: CopyColorSubTable (offset 347) */ + "iiiii\0" + "glCopyColorSubTable\0" + "glCopyColorSubTableEXT\0" + "\0" + /* _mesa_function_pool[28007]: WeightdvARB (dynamic) */ + "ip\0" + "glWeightdvARB\0" + "\0" + /* _mesa_function_pool[28025]: DeleteRenderbuffersEXT (will be remapped) */ + "ip\0" + "glDeleteRenderbuffers\0" + "glDeleteRenderbuffersEXT\0" + "\0" + /* _mesa_function_pool[28076]: VertexAttrib4NubvARB (will be remapped) */ + "ip\0" + "glVertexAttrib4Nubv\0" + "glVertexAttrib4NubvARB\0" + "\0" + /* _mesa_function_pool[28123]: VertexAttrib3dvNV (will be remapped) */ + "ip\0" + "glVertexAttrib3dvNV\0" + "\0" + /* _mesa_function_pool[28147]: GetObjectParameterfvARB (will be remapped) */ + "iip\0" + "glGetObjectParameterfvARB\0" + "\0" + /* _mesa_function_pool[28178]: Vertex4iv (offset 147) */ + "p\0" + "glVertex4iv\0" + "\0" + /* _mesa_function_pool[28193]: GetProgramEnvParameterdvARB (will be remapped) */ + "iip\0" + "glGetProgramEnvParameterdvARB\0" + "\0" + /* _mesa_function_pool[28228]: TexCoord4dv (offset 119) */ + "p\0" + "glTexCoord4dv\0" + "\0" + /* _mesa_function_pool[28245]: LockArraysEXT (will be remapped) */ + "ii\0" + "glLockArraysEXT\0" + "\0" + /* _mesa_function_pool[28265]: Begin (offset 7) */ + "i\0" + "glBegin\0" + "\0" + /* _mesa_function_pool[28276]: LightModeli (offset 165) */ + "ii\0" + "glLightModeli\0" + "\0" + /* _mesa_function_pool[28294]: Rectfv (offset 89) */ + "pp\0" + "glRectfv\0" + "\0" + /* _mesa_function_pool[28307]: LightModelf (offset 163) */ + "if\0" + "glLightModelf\0" + "\0" + /* _mesa_function_pool[28325]: GetTexParameterfv (offset 282) */ + "iip\0" + "glGetTexParameterfv\0" + "\0" + /* _mesa_function_pool[28350]: GetLightfv (offset 264) */ + "iip\0" + "glGetLightfv\0" + "\0" + /* _mesa_function_pool[28368]: PixelTransformParameterivEXT (dynamic) */ + "iip\0" + "glPixelTransformParameterivEXT\0" + "\0" + /* _mesa_function_pool[28404]: BinormalPointerEXT (dynamic) */ + "iip\0" + "glBinormalPointerEXT\0" + "\0" + /* _mesa_function_pool[28430]: VertexAttrib1dNV (will be remapped) */ + "id\0" + "glVertexAttrib1dNV\0" + "\0" + /* _mesa_function_pool[28453]: GetCombinerInputParameterivNV (will be remapped) */ + "iiiip\0" + "glGetCombinerInputParameterivNV\0" + "\0" + /* _mesa_function_pool[28492]: Disable (offset 214) */ + "i\0" + "glDisable\0" + "\0" + /* _mesa_function_pool[28505]: MultiTexCoord2fvARB (offset 387) */ + "ip\0" + "glMultiTexCoord2fv\0" + "glMultiTexCoord2fvARB\0" + "\0" + /* _mesa_function_pool[28550]: GetRenderbufferParameterivEXT (will be remapped) */ + "iip\0" + "glGetRenderbufferParameteriv\0" + "glGetRenderbufferParameterivEXT\0" + "\0" + /* _mesa_function_pool[28616]: CombinerParameterivNV (will be remapped) */ + "ip\0" + "glCombinerParameterivNV\0" + "\0" + /* _mesa_function_pool[28644]: GenFragmentShadersATI (will be remapped) */ + "i\0" + "glGenFragmentShadersATI\0" + "\0" + /* _mesa_function_pool[28671]: DrawArrays (offset 310) */ + "iii\0" + "glDrawArrays\0" + "glDrawArraysEXT\0" + "\0" + /* _mesa_function_pool[28705]: WeightuivARB (dynamic) */ + "ip\0" + "glWeightuivARB\0" + "\0" + /* _mesa_function_pool[28724]: VertexAttrib2sARB (will be remapped) */ + "iii\0" + "glVertexAttrib2s\0" + "glVertexAttrib2sARB\0" + "\0" + /* _mesa_function_pool[28766]: ColorMask (offset 210) */ + "iiii\0" + "glColorMask\0" + "\0" + /* _mesa_function_pool[28784]: GenAsyncMarkersSGIX (dynamic) */ + "i\0" + "glGenAsyncMarkersSGIX\0" + "\0" + /* _mesa_function_pool[28809]: Tangent3svEXT (dynamic) */ + "p\0" + "glTangent3svEXT\0" + "\0" + /* _mesa_function_pool[28828]: GetListParameterivSGIX (dynamic) */ + "iip\0" + "glGetListParameterivSGIX\0" + "\0" + /* _mesa_function_pool[28858]: BindBufferARB (will be remapped) */ + "ii\0" + "glBindBuffer\0" + "glBindBufferARB\0" + "\0" + /* _mesa_function_pool[28891]: GetInfoLogARB (will be remapped) */ + "iipp\0" + "glGetInfoLogARB\0" + "\0" + /* _mesa_function_pool[28913]: RasterPos4iv (offset 83) */ + "p\0" + "glRasterPos4iv\0" + "\0" + /* _mesa_function_pool[28931]: Enable (offset 215) */ + "i\0" + "glEnable\0" + "\0" + /* _mesa_function_pool[28943]: LineStipple (offset 167) */ + "ii\0" + "glLineStipple\0" + "\0" + /* _mesa_function_pool[28961]: VertexAttribs4svNV (will be remapped) */ + "iip\0" + "glVertexAttribs4svNV\0" + "\0" + /* _mesa_function_pool[28987]: EdgeFlagPointerListIBM (dynamic) */ + "ipi\0" + "glEdgeFlagPointerListIBM\0" + "\0" + /* _mesa_function_pool[29017]: UniformMatrix3x2fv (will be remapped) */ + "iiip\0" + "glUniformMatrix3x2fv\0" + "\0" + /* _mesa_function_pool[29044]: GetMinmaxParameterfv (offset 365) */ + "iip\0" + "glGetMinmaxParameterfv\0" + "glGetMinmaxParameterfvEXT\0" + "\0" + /* _mesa_function_pool[29098]: VertexAttrib1fvARB (will be remapped) */ + "ip\0" + "glVertexAttrib1fv\0" + "glVertexAttrib1fvARB\0" + "\0" + /* _mesa_function_pool[29141]: GenBuffersARB (will be remapped) */ + "ip\0" + "glGenBuffers\0" + "glGenBuffersARB\0" + "\0" + /* _mesa_function_pool[29174]: VertexAttribs1svNV (will be remapped) */ + "iip\0" + "glVertexAttribs1svNV\0" + "\0" + /* _mesa_function_pool[29200]: Vertex3fv (offset 137) */ + "p\0" + "glVertex3fv\0" + "\0" + /* _mesa_function_pool[29215]: GetTexBumpParameterivATI (will be remapped) */ + "ip\0" + "glGetTexBumpParameterivATI\0" + "\0" + /* _mesa_function_pool[29246]: Binormal3bEXT (dynamic) */ + "iii\0" + "glBinormal3bEXT\0" + "\0" + /* _mesa_function_pool[29267]: FragmentMaterialivSGIX (dynamic) */ + "iip\0" + "glFragmentMaterialivSGIX\0" + "\0" + /* _mesa_function_pool[29297]: IsRenderbufferEXT (will be remapped) */ + "i\0" + "glIsRenderbuffer\0" + "glIsRenderbufferEXT\0" + "\0" + /* _mesa_function_pool[29337]: GenProgramsNV (will be remapped) */ + "ip\0" + "glGenProgramsARB\0" + "glGenProgramsNV\0" + "\0" + /* _mesa_function_pool[29374]: VertexAttrib4dvNV (will be remapped) */ + "ip\0" + "glVertexAttrib4dvNV\0" + "\0" + /* _mesa_function_pool[29398]: EndFragmentShaderATI (will be remapped) */ + "\0" + "glEndFragmentShaderATI\0" + "\0" + /* _mesa_function_pool[29423]: Binormal3iEXT (dynamic) */ + "iii\0" + "glBinormal3iEXT\0" + "\0" + /* _mesa_function_pool[29444]: WindowPos2fMESA (will be remapped) */ + "ff\0" + "glWindowPos2f\0" + "glWindowPos2fARB\0" + "glWindowPos2fMESA\0" + "\0" + ; + +/* these functions need to be remapped */ +static const struct { + GLint pool_index; + GLint remap_index; +} MESA_remap_table_functions[] = { + { 1461, AttachShader_remap_index }, + { 8704, CreateProgram_remap_index }, + { 20115, CreateShader_remap_index }, + { 22375, DeleteProgram_remap_index }, + { 16150, DeleteShader_remap_index }, + { 20561, DetachShader_remap_index }, + { 15674, GetAttachedShaders_remap_index }, + { 4244, GetProgramInfoLog_remap_index }, + { 361, GetProgramiv_remap_index }, + { 5547, GetShaderInfoLog_remap_index }, + { 27350, GetShaderiv_remap_index }, + { 11657, IsProgram_remap_index }, + { 10728, IsShader_remap_index }, + { 8808, StencilFuncSeparate_remap_index }, + { 3487, StencilMaskSeparate_remap_index }, + { 6623, StencilOpSeparate_remap_index }, + { 19492, UniformMatrix2x3fv_remap_index }, + { 2615, UniformMatrix2x4fv_remap_index }, + { 29017, UniformMatrix3x2fv_remap_index }, + { 26776, UniformMatrix3x4fv_remap_index }, + { 14222, UniformMatrix4x2fv_remap_index }, + { 2937, UniformMatrix4x3fv_remap_index }, + { 8722, LoadTransposeMatrixdARB_remap_index }, + { 27079, LoadTransposeMatrixfARB_remap_index }, + { 4817, MultTransposeMatrixdARB_remap_index }, + { 20748, MultTransposeMatrixfARB_remap_index }, + { 172, SampleCoverageARB_remap_index }, + { 4971, CompressedTexImage1DARB_remap_index }, + { 21205, CompressedTexImage2DARB_remap_index }, + { 3550, CompressedTexImage3DARB_remap_index }, + { 15966, CompressedTexSubImage1DARB_remap_index }, + { 1880, CompressedTexSubImage2DARB_remap_index }, + { 17758, CompressedTexSubImage3DARB_remap_index }, + { 25058, GetCompressedTexImageARB_remap_index }, + { 3395, DisableVertexAttribArrayARB_remap_index }, + { 26388, EnableVertexAttribArrayARB_remap_index }, + { 28193, GetProgramEnvParameterdvARB_remap_index }, + { 20628, GetProgramEnvParameterfvARB_remap_index }, + { 24088, GetProgramLocalParameterdvARB_remap_index }, + { 7065, GetProgramLocalParameterfvARB_remap_index }, + { 16057, GetProgramStringARB_remap_index }, + { 24283, GetProgramivARB_remap_index }, + { 17953, GetVertexAttribdvARB_remap_index }, + { 14111, GetVertexAttribfvARB_remap_index }, + { 8617, GetVertexAttribivARB_remap_index }, + { 16862, ProgramEnvParameter4dARB_remap_index }, + { 22175, ProgramEnvParameter4dvARB_remap_index }, + { 14719, ProgramEnvParameter4fARB_remap_index }, + { 7928, ProgramEnvParameter4fvARB_remap_index }, + { 3513, ProgramLocalParameter4dARB_remap_index }, + { 11403, ProgramLocalParameter4dvARB_remap_index }, + { 25867, ProgramLocalParameter4fARB_remap_index }, + { 22693, ProgramLocalParameter4fvARB_remap_index }, + { 24844, ProgramStringARB_remap_index }, + { 17112, VertexAttrib1dARB_remap_index }, + { 13765, VertexAttrib1dvARB_remap_index }, + { 3688, VertexAttrib1fARB_remap_index }, + { 29098, VertexAttrib1fvARB_remap_index }, + { 6149, VertexAttrib1sARB_remap_index }, + { 2054, VertexAttrib1svARB_remap_index }, + { 13196, VertexAttrib2dARB_remap_index }, + { 15293, VertexAttrib2dvARB_remap_index }, + { 1480, VertexAttrib2fARB_remap_index }, + { 15406, VertexAttrib2fvARB_remap_index }, + { 28724, VertexAttrib2sARB_remap_index }, + { 27830, VertexAttrib2svARB_remap_index }, + { 9926, VertexAttrib3dARB_remap_index }, + { 7631, VertexAttrib3dvARB_remap_index }, + { 1567, VertexAttrib3fARB_remap_index }, + { 19729, VertexAttrib3fvARB_remap_index }, + { 24716, VertexAttrib3sARB_remap_index }, + { 17695, VertexAttrib3svARB_remap_index }, + { 4270, VertexAttrib4NbvARB_remap_index }, + { 15629, VertexAttrib4NivARB_remap_index }, + { 19684, VertexAttrib4NsvARB_remap_index }, + { 20580, VertexAttrib4NubARB_remap_index }, + { 28076, VertexAttrib4NubvARB_remap_index }, + { 16523, VertexAttrib4NuivARB_remap_index }, + { 2810, VertexAttrib4NusvARB_remap_index }, + { 9549, VertexAttrib4bvARB_remap_index }, + { 23496, VertexAttrib4dARB_remap_index }, + { 18678, VertexAttrib4dvARB_remap_index }, + { 10033, VertexAttrib4fARB_remap_index }, + { 10403, VertexAttrib4fvARB_remap_index }, + { 9001, VertexAttrib4ivARB_remap_index }, + { 15107, VertexAttrib4sARB_remap_index }, + { 27265, VertexAttrib4svARB_remap_index }, + { 14524, VertexAttrib4ubvARB_remap_index }, + { 26712, VertexAttrib4uivARB_remap_index }, + { 17506, VertexAttrib4usvARB_remap_index }, + { 19366, VertexAttribPointerARB_remap_index }, + { 28858, BindBufferARB_remap_index }, + { 5862, BufferDataARB_remap_index }, + { 1382, BufferSubDataARB_remap_index }, + { 26901, DeleteBuffersARB_remap_index }, + { 29141, GenBuffersARB_remap_index }, + { 15449, GetBufferParameterivARB_remap_index }, + { 14671, GetBufferPointervARB_remap_index }, + { 1335, GetBufferSubDataARB_remap_index }, + { 26660, IsBufferARB_remap_index }, + { 23124, MapBufferARB_remap_index }, + { 27480, UnmapBufferARB_remap_index }, + { 268, BeginQueryARB_remap_index }, + { 17207, DeleteQueriesARB_remap_index }, + { 10664, EndQueryARB_remap_index }, + { 25537, GenQueriesARB_remap_index }, + { 1772, GetQueryObjectivARB_remap_index }, + { 15151, GetQueryObjectuivARB_remap_index }, + { 1624, GetQueryivARB_remap_index }, + { 17413, IsQueryARB_remap_index }, + { 7241, AttachObjectARB_remap_index }, + { 16112, CompileShaderARB_remap_index }, + { 2879, CreateProgramObjectARB_remap_index }, + { 5807, CreateShaderObjectARB_remap_index }, + { 12613, DeleteObjectARB_remap_index }, + { 20979, DetachObjectARB_remap_index }, + { 10475, GetActiveUniformARB_remap_index }, + { 8320, GetAttachedObjectsARB_remap_index }, + { 8599, GetHandleARB_remap_index }, + { 28891, GetInfoLogARB_remap_index }, + { 28147, GetObjectParameterfvARB_remap_index }, + { 23962, GetObjectParameterivARB_remap_index }, + { 25295, GetShaderSourceARB_remap_index }, + { 24576, GetUniformLocationARB_remap_index }, + { 20850, GetUniformfvARB_remap_index }, + { 11025, GetUniformivARB_remap_index }, + { 17551, LinkProgramARB_remap_index }, + { 17609, ShaderSourceARB_remap_index }, + { 6523, Uniform1fARB_remap_index }, + { 26076, Uniform1fvARB_remap_index }, + { 19335, Uniform1iARB_remap_index }, + { 18367, Uniform1ivARB_remap_index }, + { 2003, Uniform2fARB_remap_index }, + { 12449, Uniform2fvARB_remap_index }, + { 23011, Uniform2iARB_remap_index }, + { 2123, Uniform2ivARB_remap_index }, + { 16222, Uniform3fARB_remap_index }, + { 8350, Uniform3fvARB_remap_index }, + { 5481, Uniform3iARB_remap_index }, + { 14777, Uniform3ivARB_remap_index }, + { 16668, Uniform4fARB_remap_index }, + { 20714, Uniform4fvARB_remap_index }, + { 21854, Uniform4iARB_remap_index }, + { 17919, Uniform4ivARB_remap_index }, + { 7293, UniformMatrix2fvARB_remap_index }, + { 17, UniformMatrix3fvARB_remap_index }, + { 2475, UniformMatrix4fvARB_remap_index }, + { 22287, UseProgramObjectARB_remap_index }, + { 12884, ValidateProgramARB_remap_index }, + { 18721, BindAttribLocationARB_remap_index }, + { 4315, GetActiveAttribARB_remap_index }, + { 14458, GetAttribLocationARB_remap_index }, + { 25815, DrawBuffersARB_remap_index }, + { 11508, RenderbufferStorageMultisample_remap_index }, + { 16716, FlushMappedBufferRange_remap_index }, + { 24379, MapBufferRange_remap_index }, + { 14333, BindVertexArray_remap_index }, + { 12743, GenVertexArrays_remap_index }, + { 26590, CopyBufferSubData_remap_index }, + { 27369, ClientWaitSync_remap_index }, + { 2394, DeleteSync_remap_index }, + { 6190, FenceSync_remap_index }, + { 13255, GetInteger64v_remap_index }, + { 19791, GetSynciv_remap_index }, + { 25754, IsSync_remap_index }, + { 8268, WaitSync_remap_index }, + { 3363, DrawElementsBaseVertex_remap_index }, + { 26833, DrawRangeElementsBaseVertex_remap_index }, + { 23155, MultiDrawElementsBaseVertex_remap_index }, + { 4680, PolygonOffsetEXT_remap_index }, + { 20350, GetPixelTexGenParameterfvSGIS_remap_index }, + { 3895, GetPixelTexGenParameterivSGIS_remap_index }, + { 20083, PixelTexGenParameterfSGIS_remap_index }, + { 580, PixelTexGenParameterfvSGIS_remap_index }, + { 11063, PixelTexGenParameteriSGIS_remap_index }, + { 12020, PixelTexGenParameterivSGIS_remap_index }, + { 14421, SampleMaskSGIS_remap_index }, + { 17353, SamplePatternSGIS_remap_index }, + { 23084, ColorPointerEXT_remap_index }, + { 15336, EdgeFlagPointerEXT_remap_index }, + { 5135, IndexPointerEXT_remap_index }, + { 5215, NormalPointerEXT_remap_index }, + { 13849, TexCoordPointerEXT_remap_index }, + { 5985, VertexPointerEXT_remap_index }, + { 3165, PointParameterfEXT_remap_index }, + { 6830, PointParameterfvEXT_remap_index }, + { 28245, LockArraysEXT_remap_index }, + { 12948, UnlockArraysEXT_remap_index }, + { 7837, CullParameterdvEXT_remap_index }, + { 10270, CullParameterfvEXT_remap_index }, + { 1151, SecondaryColor3bEXT_remap_index }, + { 6989, SecondaryColor3bvEXT_remap_index }, + { 9178, SecondaryColor3dEXT_remap_index }, + { 22433, SecondaryColor3dvEXT_remap_index }, + { 24625, SecondaryColor3fEXT_remap_index }, + { 15902, SecondaryColor3fvEXT_remap_index }, + { 426, SecondaryColor3iEXT_remap_index }, + { 14159, SecondaryColor3ivEXT_remap_index }, + { 8836, SecondaryColor3sEXT_remap_index }, + { 27033, SecondaryColor3svEXT_remap_index }, + { 23798, SecondaryColor3ubEXT_remap_index }, + { 18612, SecondaryColor3ubvEXT_remap_index }, + { 11258, SecondaryColor3uiEXT_remap_index }, + { 19970, SecondaryColor3uivEXT_remap_index }, + { 22645, SecondaryColor3usEXT_remap_index }, + { 11331, SecondaryColor3usvEXT_remap_index }, + { 10346, SecondaryColorPointerEXT_remap_index }, + { 22494, MultiDrawArraysEXT_remap_index }, + { 18302, MultiDrawElementsEXT_remap_index }, + { 18497, FogCoordPointerEXT_remap_index }, + { 4044, FogCoorddEXT_remap_index }, + { 27646, FogCoorddvEXT_remap_index }, + { 4105, FogCoordfEXT_remap_index }, + { 23721, FogCoordfvEXT_remap_index }, + { 16620, PixelTexGenSGIX_remap_index }, + { 24306, BlendFuncSeparateEXT_remap_index }, + { 5897, FlushVertexArrayRangeNV_remap_index }, + { 4629, VertexArrayRangeNV_remap_index }, + { 24690, CombinerInputNV_remap_index }, + { 1946, CombinerOutputNV_remap_index }, + { 27186, CombinerParameterfNV_remap_index }, + { 4549, CombinerParameterfvNV_remap_index }, + { 19541, CombinerParameteriNV_remap_index }, + { 28616, CombinerParameterivNV_remap_index }, + { 6267, FinalCombinerInputNV_remap_index }, + { 8665, GetCombinerInputParameterfvNV_remap_index }, + { 28453, GetCombinerInputParameterivNV_remap_index }, + { 6066, GetCombinerOutputParameterfvNV_remap_index }, + { 11949, GetCombinerOutputParameterivNV_remap_index }, + { 5642, GetFinalCombinerInputParameterfvNV_remap_index }, + { 21726, GetFinalCombinerInputParameterivNV_remap_index }, + { 11003, ResizeBuffersMESA_remap_index }, + { 9753, WindowPos2dMESA_remap_index }, + { 944, WindowPos2dvMESA_remap_index }, + { 29444, WindowPos2fMESA_remap_index }, + { 6934, WindowPos2fvMESA_remap_index }, + { 15849, WindowPos2iMESA_remap_index }, + { 17826, WindowPos2ivMESA_remap_index }, + { 18401, WindowPos2sMESA_remap_index }, + { 4885, WindowPos2svMESA_remap_index }, + { 6759, WindowPos3dMESA_remap_index }, + { 12228, WindowPos3dvMESA_remap_index }, + { 472, WindowPos3fMESA_remap_index }, + { 13009, WindowPos3fvMESA_remap_index }, + { 21021, WindowPos3iMESA_remap_index }, + { 26535, WindowPos3ivMESA_remap_index }, + { 16366, WindowPos3sMESA_remap_index }, + { 27902, WindowPos3svMESA_remap_index }, + { 9704, WindowPos4dMESA_remap_index }, + { 14862, WindowPos4dvMESA_remap_index }, + { 12187, WindowPos4fMESA_remap_index }, + { 26940, WindowPos4fvMESA_remap_index }, + { 26688, WindowPos4iMESA_remap_index }, + { 10842, WindowPos4ivMESA_remap_index }, + { 16499, WindowPos4sMESA_remap_index }, + { 2857, WindowPos4svMESA_remap_index }, + { 11988, MultiModeDrawArraysIBM_remap_index }, + { 25408, MultiModeDrawElementsIBM_remap_index }, + { 10692, DeleteFencesNV_remap_index }, + { 24537, FinishFenceNV_remap_index }, + { 3287, GenFencesNV_remap_index }, + { 14842, GetFenceivNV_remap_index }, + { 7226, IsFenceNV_remap_index }, + { 11876, SetFenceNV_remap_index }, + { 3744, TestFenceNV_remap_index }, + { 27873, AreProgramsResidentNV_remap_index }, + { 27228, BindProgramNV_remap_index }, + { 22728, DeleteProgramsNV_remap_index }, + { 18830, ExecuteProgramNV_remap_index }, + { 29337, GenProgramsNV_remap_index }, + { 20429, GetProgramParameterdvNV_remap_index }, + { 9240, GetProgramParameterfvNV_remap_index }, + { 23058, GetProgramStringNV_remap_index }, + { 21415, GetProgramivNV_remap_index }, + { 20663, GetTrackMatrixivNV_remap_index }, + { 22878, GetVertexAttribPointervNV_remap_index }, + { 21659, GetVertexAttribdvNV_remap_index }, + { 16339, GetVertexAttribfvNV_remap_index }, + { 16030, GetVertexAttribivNV_remap_index }, + { 16746, IsProgramNV_remap_index }, + { 8246, LoadProgramNV_remap_index }, + { 24402, ProgramParameters4dvNV_remap_index }, + { 21345, ProgramParameters4fvNV_remap_index }, + { 18130, RequestResidentProgramsNV_remap_index }, + { 19519, TrackMatrixNV_remap_index }, + { 28430, VertexAttrib1dNV_remap_index }, + { 11817, VertexAttrib1dvNV_remap_index }, + { 24940, VertexAttrib1fNV_remap_index }, + { 2245, VertexAttrib1fvNV_remap_index }, + { 26997, VertexAttrib1sNV_remap_index }, + { 13082, VertexAttrib1svNV_remap_index }, + { 4220, VertexAttrib2dNV_remap_index }, + { 11732, VertexAttrib2dvNV_remap_index }, + { 17585, VertexAttrib2fNV_remap_index }, + { 11379, VertexAttrib2fvNV_remap_index }, + { 5045, VertexAttrib2sNV_remap_index }, + { 16420, VertexAttrib2svNV_remap_index }, + { 9901, VertexAttrib3dNV_remap_index }, + { 28123, VertexAttrib3dvNV_remap_index }, + { 9052, VertexAttrib3fNV_remap_index }, + { 21686, VertexAttrib3fvNV_remap_index }, + { 24915, VertexAttrib3sNV_remap_index }, + { 20690, VertexAttrib3svNV_remap_index }, + { 25382, VertexAttrib4dNV_remap_index }, + { 29374, VertexAttrib4dvNV_remap_index }, + { 3945, VertexAttrib4fNV_remap_index }, + { 8296, VertexAttrib4fvNV_remap_index }, + { 23380, VertexAttrib4sNV_remap_index }, + { 1293, VertexAttrib4svNV_remap_index }, + { 4378, VertexAttrib4ubNV_remap_index }, + { 734, VertexAttrib4ubvNV_remap_index }, + { 19010, VertexAttribPointerNV_remap_index }, + { 2097, VertexAttribs1dvNV_remap_index }, + { 16444, VertexAttribs1fvNV_remap_index }, + { 29174, VertexAttribs1svNV_remap_index }, + { 9077, VertexAttribs2dvNV_remap_index }, + { 22248, VertexAttribs2fvNV_remap_index }, + { 15362, VertexAttribs2svNV_remap_index }, + { 4577, VertexAttribs3dvNV_remap_index }, + { 1977, VertexAttribs3fvNV_remap_index }, + { 26283, VertexAttribs3svNV_remap_index }, + { 23470, VertexAttribs4dvNV_remap_index }, + { 4603, VertexAttribs4fvNV_remap_index }, + { 28961, VertexAttribs4svNV_remap_index }, + { 26031, VertexAttribs4ubvNV_remap_index }, + { 23540, GetTexBumpParameterfvATI_remap_index }, + { 29215, GetTexBumpParameterivATI_remap_index }, + { 16084, TexBumpParameterfvATI_remap_index }, + { 18001, TexBumpParameterivATI_remap_index }, + { 13628, AlphaFragmentOp1ATI_remap_index }, + { 9592, AlphaFragmentOp2ATI_remap_index }, + { 21602, AlphaFragmentOp3ATI_remap_index }, + { 26210, BeginFragmentShaderATI_remap_index }, + { 27427, BindFragmentShaderATI_remap_index }, + { 20819, ColorFragmentOp1ATI_remap_index }, + { 3823, ColorFragmentOp2ATI_remap_index }, + { 27768, ColorFragmentOp3ATI_remap_index }, + { 4722, DeleteFragmentShaderATI_remap_index }, + { 29398, EndFragmentShaderATI_remap_index }, + { 28644, GenFragmentShadersATI_remap_index }, + { 22352, PassTexCoordATI_remap_index }, + { 5965, SampleMapATI_remap_index }, + { 5738, SetFragmentShaderConstantATI_remap_index }, + { 319, PointParameteriNV_remap_index }, + { 12389, PointParameterivNV_remap_index }, + { 25221, ActiveStencilFaceEXT_remap_index }, + { 24062, BindVertexArrayAPPLE_remap_index }, + { 2522, DeleteVertexArraysAPPLE_remap_index }, + { 15701, GenVertexArraysAPPLE_remap_index }, + { 20494, IsVertexArrayAPPLE_remap_index }, + { 775, GetProgramNamedParameterdvNV_remap_index }, + { 3128, GetProgramNamedParameterfvNV_remap_index }, + { 23571, ProgramNamedParameter4dNV_remap_index }, + { 12664, ProgramNamedParameter4dvNV_remap_index }, + { 7862, ProgramNamedParameter4fNV_remap_index }, + { 10311, ProgramNamedParameter4fvNV_remap_index }, + { 21324, DepthBoundsEXT_remap_index }, + { 1043, BlendEquationSeparateEXT_remap_index }, + { 12783, BindFramebufferEXT_remap_index }, + { 22539, BindRenderbufferEXT_remap_index }, + { 8515, CheckFramebufferStatusEXT_remap_index }, + { 19810, DeleteFramebuffersEXT_remap_index }, + { 28025, DeleteRenderbuffersEXT_remap_index }, + { 11756, FramebufferRenderbufferEXT_remap_index }, + { 11893, FramebufferTexture1DEXT_remap_index }, + { 10139, FramebufferTexture2DEXT_remap_index }, + { 9806, FramebufferTexture3DEXT_remap_index }, + { 20386, GenFramebuffersEXT_remap_index }, + { 15248, GenRenderbuffersEXT_remap_index }, + { 5684, GenerateMipmapEXT_remap_index }, + { 19041, GetFramebufferAttachmentParameterivEXT_remap_index }, + { 28550, GetRenderbufferParameterivEXT_remap_index }, + { 17881, IsFramebufferEXT_remap_index }, + { 29297, IsRenderbufferEXT_remap_index }, + { 7173, RenderbufferStorageEXT_remap_index }, + { 651, BlitFramebufferEXT_remap_index }, + { 12483, BufferParameteriAPPLE_remap_index }, + { 16778, FlushMappedBufferRangeAPPLE_remap_index }, + { 2701, FramebufferTextureLayerEXT_remap_index }, + { 25932, ProvokingVertexEXT_remap_index }, + { 9461, GetTexParameterPointervAPPLE_remap_index }, + { 4405, TextureRangeAPPLE_remap_index }, + { 25247, StencilFuncSeparateATI_remap_index }, + { 15768, ProgramEnvParameters4fvEXT_remap_index }, + { 14986, ProgramLocalParameters4fvEXT_remap_index }, + { 12317, GetQueryObjecti64vEXT_remap_index }, + { 9103, GetQueryObjectui64vEXT_remap_index }, + { -1, -1 } +}; + +/* these functions are in the ABI, but have alternative names */ +static const struct gl_function_remap MESA_alt_functions[] = { + /* from GL_EXT_blend_color */ + { 2440, _gloffset_BlendColor }, + /* from GL_EXT_blend_minmax */ + { 9863, _gloffset_BlendEquation }, + /* from GL_EXT_color_subtable */ + { 14884, _gloffset_ColorSubTable }, + { 27957, _gloffset_CopyColorSubTable }, + /* from GL_EXT_convolution */ + { 213, _gloffset_ConvolutionFilter1D }, + { 2284, _gloffset_CopyConvolutionFilter1D }, + { 3624, _gloffset_GetConvolutionParameteriv }, + { 7522, _gloffset_ConvolutionFilter2D }, + { 7688, _gloffset_ConvolutionParameteriv }, + { 8148, _gloffset_ConvolutionParameterfv }, + { 18029, _gloffset_GetSeparableFilter }, + { 21075, _gloffset_SeparableFilter2D }, + { 21904, _gloffset_ConvolutionParameteri }, + { 22027, _gloffset_ConvolutionParameterf }, + { 23406, _gloffset_GetConvolutionParameterfv }, + { 24228, _gloffset_GetConvolutionFilter }, + { 26472, _gloffset_CopyConvolutionFilter2D }, + /* from GL_EXT_copy_texture */ + { 13142, _gloffset_CopyTexSubImage3D }, + { 14624, _gloffset_CopyTexImage2D }, + { 21512, _gloffset_CopyTexImage1D }, + { 23909, _gloffset_CopyTexSubImage2D }, + { 26110, _gloffset_CopyTexSubImage1D }, + /* from GL_EXT_draw_range_elements */ + { 8402, _gloffset_DrawRangeElements }, + /* from GL_EXT_histogram */ + { 812, _gloffset_Histogram }, + { 3088, _gloffset_ResetHistogram }, + { 8774, _gloffset_GetMinmax }, + { 13476, _gloffset_GetHistogramParameterfv }, + { 21437, _gloffset_GetMinmaxParameteriv }, + { 23296, _gloffset_ResetMinmax }, + { 24125, _gloffset_GetHistogramParameteriv }, + { 25181, _gloffset_GetHistogram }, + { 27543, _gloffset_Minmax }, + { 29044, _gloffset_GetMinmaxParameterfv }, + /* from GL_EXT_paletted_texture */ + { 7384, _gloffset_ColorTable }, + { 13322, _gloffset_GetColorTable }, + { 20133, _gloffset_GetColorTableParameterfv }, + { 22083, _gloffset_GetColorTableParameteriv }, + /* from GL_EXT_subtexture */ + { 6105, _gloffset_TexSubImage1D }, + { 9388, _gloffset_TexSubImage2D }, + /* from GL_EXT_texture3D */ + { 1658, _gloffset_TexImage3D }, + { 19902, _gloffset_TexSubImage3D }, + /* from GL_EXT_texture_object */ + { 2964, _gloffset_PrioritizeTextures }, + { 6554, _gloffset_AreTexturesResident }, + { 11841, _gloffset_GenTextures }, + { 13808, _gloffset_DeleteTextures }, + { 17059, _gloffset_IsTexture }, + { 26175, _gloffset_BindTexture }, + /* from GL_EXT_vertex_array */ + { 21264, _gloffset_ArrayElement }, + { 27131, _gloffset_GetPointerv }, + { 28671, _gloffset_DrawArrays }, + /* from GL_SGI_color_table */ + { 6672, _gloffset_ColorTableParameteriv }, + { 7384, _gloffset_ColorTable }, + { 13322, _gloffset_GetColorTable }, + { 13432, _gloffset_CopyColorTable }, + { 16920, _gloffset_ColorTableParameterfv }, + { 20133, _gloffset_GetColorTableParameterfv }, + { 22083, _gloffset_GetColorTableParameteriv }, + /* from GL_VERSION_1_3 */ + { 381, _gloffset_MultiTexCoord3sARB }, + { 613, _gloffset_ActiveTextureARB }, + { 3761, _gloffset_MultiTexCoord1fvARB }, + { 5240, _gloffset_MultiTexCoord3dARB }, + { 5285, _gloffset_MultiTexCoord2iARB }, + { 5409, _gloffset_MultiTexCoord2svARB }, + { 7340, _gloffset_MultiTexCoord2fARB }, + { 9133, _gloffset_MultiTexCoord3fvARB }, + { 9625, _gloffset_MultiTexCoord4sARB }, + { 10225, _gloffset_MultiTexCoord2dvARB }, + { 10607, _gloffset_MultiTexCoord1svARB }, + { 10864, _gloffset_MultiTexCoord3svARB }, + { 10925, _gloffset_MultiTexCoord4iARB }, + { 11612, _gloffset_MultiTexCoord3iARB }, + { 12346, _gloffset_MultiTexCoord1dARB }, + { 12512, _gloffset_MultiTexCoord3dvARB }, + { 13676, _gloffset_MultiTexCoord3ivARB }, + { 13721, _gloffset_MultiTexCoord2sARB }, + { 14941, _gloffset_MultiTexCoord4ivARB }, + { 16570, _gloffset_ClientActiveTextureARB }, + { 18786, _gloffset_MultiTexCoord2dARB }, + { 19161, _gloffset_MultiTexCoord4dvARB }, + { 19447, _gloffset_MultiTexCoord4fvARB }, + { 20274, _gloffset_MultiTexCoord3fARB }, + { 22584, _gloffset_MultiTexCoord4dARB }, + { 22788, _gloffset_MultiTexCoord1sARB }, + { 22966, _gloffset_MultiTexCoord1dvARB }, + { 23753, _gloffset_MultiTexCoord1ivARB }, + { 23846, _gloffset_MultiTexCoord2ivARB }, + { 24185, _gloffset_MultiTexCoord1iARB }, + { 25456, _gloffset_MultiTexCoord4svARB }, + { 25974, _gloffset_MultiTexCoord1fARB }, + { 26237, _gloffset_MultiTexCoord4fARB }, + { 28505, _gloffset_MultiTexCoord2fvARB }, + { -1, -1 } +}; + +#endif /* need_MESA_remap_table */ + +#if defined(need_GL_3DFX_tbuffer) +static const struct gl_function_remap GL_3DFX_tbuffer_functions[] = { + { 8206, -1 }, /* TbufferMask3DFX */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_APPLE_flush_buffer_range) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_APPLE_flush_buffer_range_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_APPLE_texture_range) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_APPLE_texture_range_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_APPLE_vertex_array_object) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_APPLE_vertex_array_object_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ARB_copy_buffer) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ARB_copy_buffer_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ARB_draw_buffers) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ARB_draw_buffers_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ARB_draw_elements_base_vertex) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ARB_draw_elements_base_vertex_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ARB_framebuffer_object) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ARB_framebuffer_object_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ARB_map_buffer_range) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ARB_map_buffer_range_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ARB_matrix_palette) +static const struct gl_function_remap GL_ARB_matrix_palette_functions[] = { + { 3339, -1 }, /* MatrixIndexusvARB */ + { 11469, -1 }, /* MatrixIndexuivARB */ + { 12634, -1 }, /* MatrixIndexPointerARB */ + { 17308, -1 }, /* CurrentPaletteMatrixARB */ + { 20018, -1 }, /* MatrixIndexubvARB */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_ARB_multisample) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ARB_multisample_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ARB_occlusion_query) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ARB_occlusion_query_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ARB_point_parameters) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ARB_point_parameters_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ARB_provoking_vertex) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ARB_provoking_vertex_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ARB_shader_objects) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ARB_shader_objects_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ARB_sync) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ARB_sync_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ARB_texture_compression) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ARB_texture_compression_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ARB_transpose_matrix) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ARB_transpose_matrix_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ARB_vertex_array_object) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ARB_vertex_array_object_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ARB_vertex_blend) +static const struct gl_function_remap GL_ARB_vertex_blend_functions[] = { + { 2226, -1 }, /* WeightubvARB */ + { 5572, -1 }, /* WeightivARB */ + { 9728, -1 }, /* WeightPointerARB */ + { 12103, -1 }, /* WeightfvARB */ + { 15388, -1 }, /* WeightbvARB */ + { 18454, -1 }, /* WeightusvARB */ + { 21001, -1 }, /* VertexBlendARB */ + { 26058, -1 }, /* WeightsvARB */ + { 28007, -1 }, /* WeightdvARB */ + { 28705, -1 }, /* WeightuivARB */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_ARB_vertex_buffer_object) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ARB_vertex_buffer_object_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ARB_vertex_program) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ARB_vertex_program_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ARB_vertex_shader) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ARB_vertex_shader_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ARB_window_pos) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ARB_window_pos_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ATI_blend_equation_separate) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ATI_blend_equation_separate_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ATI_draw_buffers) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ATI_draw_buffers_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ATI_envmap_bumpmap) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ATI_envmap_bumpmap_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ATI_fragment_shader) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ATI_fragment_shader_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_ATI_separate_stencil) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_ATI_separate_stencil_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_blend_color) +static const struct gl_function_remap GL_EXT_blend_color_functions[] = { + { 2440, _gloffset_BlendColor }, + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_blend_equation_separate) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_blend_equation_separate_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_blend_func_separate) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_blend_func_separate_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_blend_minmax) +static const struct gl_function_remap GL_EXT_blend_minmax_functions[] = { + { 9863, _gloffset_BlendEquation }, + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_color_subtable) +static const struct gl_function_remap GL_EXT_color_subtable_functions[] = { + { 14884, _gloffset_ColorSubTable }, + { 27957, _gloffset_CopyColorSubTable }, + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_compiled_vertex_array) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_compiled_vertex_array_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_convolution) +static const struct gl_function_remap GL_EXT_convolution_functions[] = { + { 213, _gloffset_ConvolutionFilter1D }, + { 2284, _gloffset_CopyConvolutionFilter1D }, + { 3624, _gloffset_GetConvolutionParameteriv }, + { 7522, _gloffset_ConvolutionFilter2D }, + { 7688, _gloffset_ConvolutionParameteriv }, + { 8148, _gloffset_ConvolutionParameterfv }, + { 18029, _gloffset_GetSeparableFilter }, + { 21075, _gloffset_SeparableFilter2D }, + { 21904, _gloffset_ConvolutionParameteri }, + { 22027, _gloffset_ConvolutionParameterf }, + { 23406, _gloffset_GetConvolutionParameterfv }, + { 24228, _gloffset_GetConvolutionFilter }, + { 26472, _gloffset_CopyConvolutionFilter2D }, + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_coordinate_frame) +static const struct gl_function_remap GL_EXT_coordinate_frame_functions[] = { + { 9272, -1 }, /* TangentPointerEXT */ + { 10983, -1 }, /* Binormal3ivEXT */ + { 11565, -1 }, /* Tangent3sEXT */ + { 12699, -1 }, /* Tangent3fvEXT */ + { 16320, -1 }, /* Tangent3dvEXT */ + { 17006, -1 }, /* Binormal3bvEXT */ + { 18082, -1 }, /* Binormal3dEXT */ + { 19950, -1 }, /* Tangent3fEXT */ + { 21976, -1 }, /* Binormal3sEXT */ + { 22394, -1 }, /* Tangent3ivEXT */ + { 22413, -1 }, /* Tangent3dEXT */ + { 23193, -1 }, /* Binormal3svEXT */ + { 23651, -1 }, /* Binormal3fEXT */ + { 24503, -1 }, /* Binormal3dvEXT */ + { 25678, -1 }, /* Tangent3iEXT */ + { 26757, -1 }, /* Tangent3bvEXT */ + { 27166, -1 }, /* Tangent3bEXT */ + { 27730, -1 }, /* Binormal3fvEXT */ + { 28404, -1 }, /* BinormalPointerEXT */ + { 28809, -1 }, /* Tangent3svEXT */ + { 29246, -1 }, /* Binormal3bEXT */ + { 29423, -1 }, /* Binormal3iEXT */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_copy_texture) +static const struct gl_function_remap GL_EXT_copy_texture_functions[] = { + { 13142, _gloffset_CopyTexSubImage3D }, + { 14624, _gloffset_CopyTexImage2D }, + { 21512, _gloffset_CopyTexImage1D }, + { 23909, _gloffset_CopyTexSubImage2D }, + { 26110, _gloffset_CopyTexSubImage1D }, + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_cull_vertex) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_cull_vertex_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_depth_bounds_test) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_depth_bounds_test_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_draw_range_elements) +static const struct gl_function_remap GL_EXT_draw_range_elements_functions[] = { + { 8402, _gloffset_DrawRangeElements }, + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_fog_coord) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_fog_coord_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_framebuffer_blit) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_framebuffer_blit_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_framebuffer_object) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_framebuffer_object_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_gpu_program_parameters) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_gpu_program_parameters_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_histogram) +static const struct gl_function_remap GL_EXT_histogram_functions[] = { + { 812, _gloffset_Histogram }, + { 3088, _gloffset_ResetHistogram }, + { 8774, _gloffset_GetMinmax }, + { 13476, _gloffset_GetHistogramParameterfv }, + { 21437, _gloffset_GetMinmaxParameteriv }, + { 23296, _gloffset_ResetMinmax }, + { 24125, _gloffset_GetHistogramParameteriv }, + { 25181, _gloffset_GetHistogram }, + { 27543, _gloffset_Minmax }, + { 29044, _gloffset_GetMinmaxParameterfv }, + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_index_func) +static const struct gl_function_remap GL_EXT_index_func_functions[] = { + { 10090, -1 }, /* IndexFuncEXT */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_index_material) +static const struct gl_function_remap GL_EXT_index_material_functions[] = { + { 18541, -1 }, /* IndexMaterialEXT */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_light_texture) +static const struct gl_function_remap GL_EXT_light_texture_functions[] = { + { 23213, -1 }, /* ApplyTextureEXT */ + { 23250, -1 }, /* TextureMaterialEXT */ + { 23275, -1 }, /* TextureLightEXT */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_multi_draw_arrays) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_multi_draw_arrays_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_multisample) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_multisample_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_paletted_texture) +static const struct gl_function_remap GL_EXT_paletted_texture_functions[] = { + { 7384, _gloffset_ColorTable }, + { 13322, _gloffset_GetColorTable }, + { 20133, _gloffset_GetColorTableParameterfv }, + { 22083, _gloffset_GetColorTableParameteriv }, + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_pixel_transform) +static const struct gl_function_remap GL_EXT_pixel_transform_functions[] = { + { 9513, -1 }, /* PixelTransformParameterfvEXT */ + { 19126, -1 }, /* PixelTransformParameterfEXT */ + { 19206, -1 }, /* PixelTransformParameteriEXT */ + { 28368, -1 }, /* PixelTransformParameterivEXT */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_point_parameters) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_point_parameters_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_polygon_offset) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_polygon_offset_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_provoking_vertex) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_provoking_vertex_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_secondary_color) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_secondary_color_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_stencil_two_side) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_stencil_two_side_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_subtexture) +static const struct gl_function_remap GL_EXT_subtexture_functions[] = { + { 6105, _gloffset_TexSubImage1D }, + { 9388, _gloffset_TexSubImage2D }, + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_texture3D) +static const struct gl_function_remap GL_EXT_texture3D_functions[] = { + { 1658, _gloffset_TexImage3D }, + { 19902, _gloffset_TexSubImage3D }, + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_texture_array) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_texture_array_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_texture_object) +static const struct gl_function_remap GL_EXT_texture_object_functions[] = { + { 2964, _gloffset_PrioritizeTextures }, + { 6554, _gloffset_AreTexturesResident }, + { 11841, _gloffset_GenTextures }, + { 13808, _gloffset_DeleteTextures }, + { 17059, _gloffset_IsTexture }, + { 26175, _gloffset_BindTexture }, + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_texture_perturb_normal) +static const struct gl_function_remap GL_EXT_texture_perturb_normal_functions[] = { + { 12053, -1 }, /* TextureNormalEXT */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_timer_query) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_timer_query_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_vertex_array) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_vertex_array_functions[] = { + { 21264, _gloffset_ArrayElement }, + { 27131, _gloffset_GetPointerv }, + { 28671, _gloffset_DrawArrays }, + { -1, -1 } +}; +#endif + +#if defined(need_GL_EXT_vertex_weighting) +static const struct gl_function_remap GL_EXT_vertex_weighting_functions[] = { + { 17089, -1 }, /* VertexWeightfvEXT */ + { 23629, -1 }, /* VertexWeightfEXT */ + { 25150, -1 }, /* VertexWeightPointerEXT */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_HP_image_transform) +static const struct gl_function_remap GL_HP_image_transform_functions[] = { + { 2157, -1 }, /* GetImageTransformParameterfvHP */ + { 3305, -1 }, /* ImageTransformParameterfHP */ + { 8966, -1 }, /* ImageTransformParameterfvHP */ + { 10525, -1 }, /* ImageTransformParameteriHP */ + { 10754, -1 }, /* GetImageTransformParameterivHP */ + { 17153, -1 }, /* ImageTransformParameterivHP */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_IBM_multimode_draw_arrays) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_IBM_multimode_draw_arrays_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_IBM_vertex_array_lists) +static const struct gl_function_remap GL_IBM_vertex_array_lists_functions[] = { + { 3857, -1 }, /* SecondaryColorPointerListIBM */ + { 5106, -1 }, /* NormalPointerListIBM */ + { 6728, -1 }, /* FogCoordPointerListIBM */ + { 7035, -1 }, /* VertexPointerListIBM */ + { 10446, -1 }, /* ColorPointerListIBM */ + { 11672, -1 }, /* TexCoordPointerListIBM */ + { 12075, -1 }, /* IndexPointerListIBM */ + { 28987, -1 }, /* EdgeFlagPointerListIBM */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_INGR_blend_func_separate) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_INGR_blend_func_separate_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_INTEL_parallel_arrays) +static const struct gl_function_remap GL_INTEL_parallel_arrays_functions[] = { + { 11095, -1 }, /* VertexPointervINTEL */ + { 13569, -1 }, /* ColorPointervINTEL */ + { 26446, -1 }, /* NormalPointervINTEL */ + { 26872, -1 }, /* TexCoordPointervINTEL */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_MESA_resize_buffers) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_MESA_resize_buffers_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_MESA_shader_debug) +static const struct gl_function_remap GL_MESA_shader_debug_functions[] = { + { 1522, -1 }, /* GetDebugLogLengthMESA */ + { 3063, -1 }, /* ClearDebugLogMESA */ + { 4018, -1 }, /* GetDebugLogMESA */ + { 27324, -1 }, /* CreateDebugObjectMESA */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_MESA_window_pos) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_MESA_window_pos_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_NV_evaluators) +static const struct gl_function_remap GL_NV_evaluators_functions[] = { + { 5773, -1 }, /* GetMapAttribParameterivNV */ + { 7490, -1 }, /* MapControlPointsNV */ + { 7589, -1 }, /* MapParameterfvNV */ + { 9371, -1 }, /* EvalMapsNV */ + { 15058, -1 }, /* GetMapAttribParameterfvNV */ + { 15224, -1 }, /* MapParameterivNV */ + { 21827, -1 }, /* GetMapParameterivNV */ + { 22325, -1 }, /* GetMapParameterfvNV */ + { 25782, -1 }, /* GetMapControlPointsNV */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_NV_fence) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_NV_fence_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_NV_fragment_program) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_NV_fragment_program_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_NV_point_sprite) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_NV_point_sprite_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_NV_register_combiners) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_NV_register_combiners_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_NV_register_combiners2) +static const struct gl_function_remap GL_NV_register_combiners2_functions[] = { + { 13961, -1 }, /* CombinerStageParameterfvNV */ + { 14276, -1 }, /* GetCombinerStageParameterfvNV */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_NV_vertex_array_range) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_NV_vertex_array_range_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_NV_vertex_program) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_NV_vertex_program_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_PGI_misc_hints) +static const struct gl_function_remap GL_PGI_misc_hints_functions[] = { + { 7674, -1 }, /* HintPGI */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGIS_detail_texture) +static const struct gl_function_remap GL_SGIS_detail_texture_functions[] = { + { 14249, -1 }, /* GetDetailTexFuncSGIS */ + { 14569, -1 }, /* DetailTexFuncSGIS */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGIS_fog_function) +static const struct gl_function_remap GL_SGIS_fog_function_functions[] = { + { 23891, -1 }, /* FogFuncSGIS */ + { 24556, -1 }, /* GetFogFuncSGIS */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGIS_multisample) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_SGIS_multisample_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGIS_pixel_texture) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_SGIS_pixel_texture_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGIS_point_parameters) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_SGIS_point_parameters_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGIS_sharpen_texture) +static const struct gl_function_remap GL_SGIS_sharpen_texture_functions[] = { + { 5834, -1 }, /* GetSharpenTexFuncSGIS */ + { 19421, -1 }, /* SharpenTexFuncSGIS */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGIS_texture4D) +static const struct gl_function_remap GL_SGIS_texture4D_functions[] = { + { 894, -1 }, /* TexImage4DSGIS */ + { 13877, -1 }, /* TexSubImage4DSGIS */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGIS_texture_color_mask) +static const struct gl_function_remap GL_SGIS_texture_color_mask_functions[] = { + { 13275, -1 }, /* TextureColorMaskSGIS */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGIS_texture_filter4) +static const struct gl_function_remap GL_SGIS_texture_filter4_functions[] = { + { 6011, -1 }, /* GetTexFilterFuncSGIS */ + { 14395, -1 }, /* TexFilterFuncSGIS */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGIX_async) +static const struct gl_function_remap GL_SGIX_async_functions[] = { + { 3014, -1 }, /* AsyncMarkerSGIX */ + { 3997, -1 }, /* FinishAsyncSGIX */ + { 4703, -1 }, /* PollAsyncSGIX */ + { 19568, -1 }, /* DeleteAsyncMarkersSGIX */ + { 19597, -1 }, /* IsAsyncMarkerSGIX */ + { 28784, -1 }, /* GenAsyncMarkersSGIX */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGIX_flush_raster) +static const struct gl_function_remap GL_SGIX_flush_raster_functions[] = { + { 6382, -1 }, /* FlushRasterSGIX */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGIX_fragment_lighting) +static const struct gl_function_remap GL_SGIX_fragment_lighting_functions[] = { + { 2410, -1 }, /* FragmentMaterialfvSGIX */ + { 2906, -1 }, /* FragmentLightModelivSGIX */ + { 4654, -1 }, /* FragmentLightiSGIX */ + { 5514, -1 }, /* GetFragmentMaterialfvSGIX */ + { 7102, -1 }, /* FragmentMaterialfSGIX */ + { 7263, -1 }, /* GetFragmentLightivSGIX */ + { 8100, -1 }, /* FragmentLightModeliSGIX */ + { 9434, -1 }, /* FragmentLightivSGIX */ + { 9671, -1 }, /* GetFragmentMaterialivSGIX */ + { 16976, -1 }, /* FragmentLightModelfSGIX */ + { 17276, -1 }, /* FragmentColorMaterialSGIX */ + { 17648, -1 }, /* FragmentMaterialiSGIX */ + { 18869, -1 }, /* LightEnviSGIX */ + { 20225, -1 }, /* FragmentLightModelfvSGIX */ + { 20534, -1 }, /* FragmentLightfvSGIX */ + { 25032, -1 }, /* FragmentLightfSGIX */ + { 27700, -1 }, /* GetFragmentLightfvSGIX */ + { 29267, -1 }, /* FragmentMaterialivSGIX */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGIX_framezoom) +static const struct gl_function_remap GL_SGIX_framezoom_functions[] = { + { 19620, -1 }, /* FrameZoomSGIX */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGIX_igloo_interface) +static const struct gl_function_remap GL_SGIX_igloo_interface_functions[] = { + { 25340, -1 }, /* IglooInterfaceSGIX */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGIX_instruments) +static const struct gl_function_remap GL_SGIX_instruments_functions[] = { + { 2573, -1 }, /* ReadInstrumentsSGIX */ + { 5590, -1 }, /* PollInstrumentsSGIX */ + { 9332, -1 }, /* GetInstrumentsSGIX */ + { 11306, -1 }, /* StartInstrumentsSGIX */ + { 13995, -1 }, /* StopInstrumentsSGIX */ + { 15601, -1 }, /* InstrumentsBufferSGIX */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGIX_list_priority) +static const struct gl_function_remap GL_SGIX_list_priority_functions[] = { + { 1125, -1 }, /* ListParameterfSGIX */ + { 2763, -1 }, /* GetListParameterfvSGIX */ + { 15516, -1 }, /* ListParameteriSGIX */ + { 16270, -1 }, /* ListParameterfvSGIX */ + { 18275, -1 }, /* ListParameterivSGIX */ + { 28828, -1 }, /* GetListParameterivSGIX */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGIX_pixel_texture) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_SGIX_pixel_texture_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGIX_polynomial_ffd) +static const struct gl_function_remap GL_SGIX_polynomial_ffd_functions[] = { + { 3251, -1 }, /* LoadIdentityDeformationMapSGIX */ + { 14095, -1 }, /* DeformSGIX */ + { 21376, -1 }, /* DeformationMap3fSGIX */ + { 27588, -1 }, /* DeformationMap3dSGIX */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGIX_reference_plane) +static const struct gl_function_remap GL_SGIX_reference_plane_functions[] = { + { 12826, -1 }, /* ReferencePlaneSGIX */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGIX_sprite) +static const struct gl_function_remap GL_SGIX_sprite_functions[] = { + { 8487, -1 }, /* SpriteParameterfvSGIX */ + { 18103, -1 }, /* SpriteParameteriSGIX */ + { 23330, -1 }, /* SpriteParameterfSGIX */ + { 25904, -1 }, /* SpriteParameterivSGIX */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGIX_tag_sample_buffer) +static const struct gl_function_remap GL_SGIX_tag_sample_buffer_functions[] = { + { 18162, -1 }, /* TagSampleBufferSGIX */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SGI_color_table) +static const struct gl_function_remap GL_SGI_color_table_functions[] = { + { 6672, _gloffset_ColorTableParameteriv }, + { 7384, _gloffset_ColorTable }, + { 13322, _gloffset_GetColorTable }, + { 13432, _gloffset_CopyColorTable }, + { 16920, _gloffset_ColorTableParameterfv }, + { 20133, _gloffset_GetColorTableParameterfv }, + { 22083, _gloffset_GetColorTableParameteriv }, + { -1, -1 } +}; +#endif + +#if defined(need_GL_SUNX_constant_data) +static const struct gl_function_remap GL_SUNX_constant_data_functions[] = { + { 27678, -1 }, /* FinishTextureSUNX */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SUN_global_alpha) +static const struct gl_function_remap GL_SUN_global_alpha_functions[] = { + { 3035, -1 }, /* GlobalAlphaFactorubSUN */ + { 4193, -1 }, /* GlobalAlphaFactoriSUN */ + { 5615, -1 }, /* GlobalAlphaFactordSUN */ + { 8571, -1 }, /* GlobalAlphaFactoruiSUN */ + { 8923, -1 }, /* GlobalAlphaFactorbSUN */ + { 11585, -1 }, /* GlobalAlphaFactorfSUN */ + { 11704, -1 }, /* GlobalAlphaFactorusSUN */ + { 19859, -1 }, /* GlobalAlphaFactorsSUN */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SUN_mesh_array) +static const struct gl_function_remap GL_SUN_mesh_array_functions[] = { + { 25716, -1 }, /* DrawMeshArraysSUN */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SUN_triangle_list) +static const struct gl_function_remap GL_SUN_triangle_list_functions[] = { + { 3971, -1 }, /* ReplacementCodeubSUN */ + { 5454, -1 }, /* ReplacementCodeubvSUN */ + { 16641, -1 }, /* ReplacementCodeusvSUN */ + { 16829, -1 }, /* ReplacementCodePointerSUN */ + { 18186, -1 }, /* ReplacementCodeusSUN */ + { 18933, -1 }, /* ReplacementCodeuiSUN */ + { 26361, -1 }, /* ReplacementCodeuivSUN */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_SUN_vertex) +static const struct gl_function_remap GL_SUN_vertex_functions[] = { + { 999, -1 }, /* ReplacementCodeuiColor3fVertex3fvSUN */ + { 1197, -1 }, /* TexCoord4fColor4fNormal3fVertex4fvSUN */ + { 1423, -1 }, /* TexCoord2fColor4ubVertex3fvSUN */ + { 1699, -1 }, /* ReplacementCodeuiVertex3fvSUN */ + { 1833, -1 }, /* ReplacementCodeuiTexCoord2fVertex3fvSUN */ + { 2346, -1 }, /* ReplacementCodeuiNormal3fVertex3fSUN */ + { 2642, -1 }, /* Color4ubVertex3fvSUN */ + { 4074, -1 }, /* Color4ubVertex3fSUN */ + { 4150, -1 }, /* TexCoord2fVertex3fSUN */ + { 4449, -1 }, /* TexCoord2fColor4fNormal3fVertex3fSUN */ + { 4779, -1 }, /* TexCoord2fNormal3fVertex3fvSUN */ + { 5349, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN */ + { 6419, -1 }, /* ReplacementCodeuiTexCoord2fVertex3fSUN */ + { 7131, -1 }, /* TexCoord2fNormal3fVertex3fSUN */ + { 7899, -1 }, /* Color3fVertex3fSUN */ + { 8882, -1 }, /* Color3fVertex3fvSUN */ + { 9297, -1 }, /* Color4fNormal3fVertex3fvSUN */ + { 9969, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN */ + { 11169, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fvSUN */ + { 12557, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN */ + { 12968, -1 }, /* TexCoord2fColor3fVertex3fSUN */ + { 14020, -1 }, /* TexCoord4fColor4fNormal3fVertex4fSUN */ + { 14354, -1 }, /* Color4ubVertex2fvSUN */ + { 14594, -1 }, /* Normal3fVertex3fSUN */ + { 15542, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fSUN */ + { 15803, -1 }, /* TexCoord2fColor4fNormal3fVertex3fvSUN */ + { 16470, -1 }, /* TexCoord2fVertex3fvSUN */ + { 17246, -1 }, /* Color4ubVertex2fSUN */ + { 17439, -1 }, /* ReplacementCodeuiColor4ubVertex3fSUN */ + { 19292, -1 }, /* TexCoord2fColor4ubVertex3fSUN */ + { 19639, -1 }, /* Normal3fVertex3fvSUN */ + { 20042, -1 }, /* Color4fNormal3fVertex3fSUN */ + { 20908, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN */ + { 21128, -1 }, /* ReplacementCodeuiColor4ubVertex3fvSUN */ + { 22831, -1 }, /* ReplacementCodeuiColor3fVertex3fSUN */ + { 24007, -1 }, /* TexCoord4fVertex4fSUN */ + { 24433, -1 }, /* TexCoord2fColor3fVertex3fvSUN */ + { 24759, -1 }, /* ReplacementCodeuiNormal3fVertex3fvSUN */ + { 24886, -1 }, /* TexCoord4fVertex4fvSUN */ + { 25588, -1 }, /* ReplacementCodeuiVertex3fSUN */ + { -1, -1 } +}; +#endif + +#if defined(need_GL_VERSION_1_3) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_VERSION_1_3_functions[] = { + { 381, _gloffset_MultiTexCoord3sARB }, + { 613, _gloffset_ActiveTextureARB }, + { 3761, _gloffset_MultiTexCoord1fvARB }, + { 5240, _gloffset_MultiTexCoord3dARB }, + { 5285, _gloffset_MultiTexCoord2iARB }, + { 5409, _gloffset_MultiTexCoord2svARB }, + { 7340, _gloffset_MultiTexCoord2fARB }, + { 9133, _gloffset_MultiTexCoord3fvARB }, + { 9625, _gloffset_MultiTexCoord4sARB }, + { 10225, _gloffset_MultiTexCoord2dvARB }, + { 10607, _gloffset_MultiTexCoord1svARB }, + { 10864, _gloffset_MultiTexCoord3svARB }, + { 10925, _gloffset_MultiTexCoord4iARB }, + { 11612, _gloffset_MultiTexCoord3iARB }, + { 12346, _gloffset_MultiTexCoord1dARB }, + { 12512, _gloffset_MultiTexCoord3dvARB }, + { 13676, _gloffset_MultiTexCoord3ivARB }, + { 13721, _gloffset_MultiTexCoord2sARB }, + { 14941, _gloffset_MultiTexCoord4ivARB }, + { 16570, _gloffset_ClientActiveTextureARB }, + { 18786, _gloffset_MultiTexCoord2dARB }, + { 19161, _gloffset_MultiTexCoord4dvARB }, + { 19447, _gloffset_MultiTexCoord4fvARB }, + { 20274, _gloffset_MultiTexCoord3fARB }, + { 22584, _gloffset_MultiTexCoord4dARB }, + { 22788, _gloffset_MultiTexCoord1sARB }, + { 22966, _gloffset_MultiTexCoord1dvARB }, + { 23753, _gloffset_MultiTexCoord1ivARB }, + { 23846, _gloffset_MultiTexCoord2ivARB }, + { 24185, _gloffset_MultiTexCoord1iARB }, + { 25456, _gloffset_MultiTexCoord4svARB }, + { 25974, _gloffset_MultiTexCoord1fARB }, + { 26237, _gloffset_MultiTexCoord4fARB }, + { 28505, _gloffset_MultiTexCoord2fvARB }, + { -1, -1 } +}; +#endif + +#if defined(need_GL_VERSION_1_4) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_VERSION_1_4_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_VERSION_1_5) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_VERSION_1_5_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_VERSION_2_0) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_VERSION_2_0_functions[] = { + { -1, -1 } +}; +#endif + +#if defined(need_GL_VERSION_2_1) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_VERSION_2_1_functions[] = { + { -1, -1 } +}; +#endif + -- cgit v1.2.3 From 17ef1f6074d6107c167f1956a5c60993904c0b72 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 8 Oct 2009 10:33:57 +0800 Subject: mesa: Enable remap table in core. This enables the remap table in core. driInitExtensions is adapted to use the remap table. All uses of extension_helper.h are replaced by remap_helper.h. The chicken-egg problem of the DRI drivers is also solved. It is now also possible to pass NULL extensions to driInitExtensions. It will cause driInitExtensions to map all known functions. This functionality is used by software drivers and EGL_i915. Signed-off-by: Chia-I Wu --- src/gallium/state_trackers/dri/dri_extensions.c | 10 ++- src/gallium/state_trackers/dri/dri_screen.c | 5 -- src/gallium/state_trackers/egl/egl_context.c | 67 ------------------ src/gallium/state_trackers/egl/egl_tracker.c | 4 +- src/mesa/drivers/dri/common/utils.c | 94 +++++-------------------- src/mesa/drivers/dri/common/utils.h | 32 +-------- src/mesa/drivers/dri/i810/i810context.c | 2 +- src/mesa/drivers/dri/i810/i810screen.c | 4 -- src/mesa/drivers/dri/intel/intel_extensions.c | 3 +- src/mesa/drivers/dri/intel/intel_screen.c | 24 ------- src/mesa/drivers/dri/mach64/mach64_context.c | 2 +- src/mesa/drivers/dri/mach64/mach64_screen.c | 14 ---- src/mesa/drivers/dri/mga/mga_xmesa.c | 18 +---- src/mesa/drivers/dri/r128/r128_context.c | 4 +- src/mesa/drivers/dri/r128/r128_screen.c | 14 ---- src/mesa/drivers/dri/r200/r200_context.c | 16 ++--- src/mesa/drivers/dri/r300/r300_context.c | 8 +-- src/mesa/drivers/dri/r600/r600_context.c | 8 +-- src/mesa/drivers/dri/radeon/radeon_context.c | 6 +- src/mesa/drivers/dri/radeon/radeon_screen.c | 54 -------------- src/mesa/drivers/dri/savage/savage_xmesa.c | 14 +--- src/mesa/drivers/dri/sis/sis_context.c | 6 +- src/mesa/drivers/dri/sis/sis_screen.c | 12 ---- src/mesa/drivers/dri/swrast/swrast.c | 74 +------------------ src/mesa/drivers/dri/tdfx/tdfx_context.c | 6 +- src/mesa/drivers/dri/tdfx/tdfx_screen.c | 16 ----- src/mesa/drivers/dri/unichrome/via_context.c | 4 +- src/mesa/drivers/dri/unichrome/via_screen.c | 14 ---- src/mesa/drivers/x11/xm_api.c | 73 ------------------- src/mesa/main/context.c | 3 + src/mesa/sources.mak | 1 + 31 files changed, 66 insertions(+), 546 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/dri/dri_extensions.c b/src/gallium/state_trackers/dri/dri_extensions.c index 800d462e32..78c4cd8375 100644 --- a/src/gallium/state_trackers/dri/dri_extensions.c +++ b/src/gallium/state_trackers/dri/dri_extensions.c @@ -59,12 +59,13 @@ #define need_GL_NV_vertex_program #define need_GL_VERSION_2_0 #define need_GL_VERSION_2_1 -#include "extension_helper.h" +#include "main/remap_helper.h" +#include "utils.h" /** * Extension strings exported by the driver. */ -const struct dri_extension card_extensions[] = { +static const struct dri_extension card_extensions[] = { {"GL_ARB_fragment_shader", NULL}, {"GL_ARB_map_buffer_range", GL_ARB_map_buffer_range_functions}, {"GL_ARB_multisample", GL_ARB_multisample_functions}, @@ -127,10 +128,7 @@ dri_init_extensions(struct dri_context *ctx) * capabilities of the pipe_screen. This is actually something * that can/should be done inside st_create_context(). */ - if (ctx) - driInitExtensions(ctx->st->ctx, card_extensions, GL_TRUE); - else - driInitExtensions(NULL, card_extensions, GL_FALSE); + driInitExtensions(ctx->st->ctx, card_extensions, GL_TRUE); } /* vim: set sw=3 ts=8 sts=3 expandtab: */ diff --git a/src/gallium/state_trackers/dri/dri_screen.c b/src/gallium/state_trackers/dri/dri_screen.c index 884b6d5011..cb864d45d5 100644 --- a/src/gallium/state_trackers/dri/dri_screen.c +++ b/src/gallium/state_trackers/dri/dri_screen.c @@ -226,8 +226,6 @@ dri_init_screen(__DRIscreenPrivate * sPriv) const __DRIconfig **configs; struct dri1_create_screen_arg arg; - dri_init_extensions(NULL); - screen = CALLOC_STRUCT(dri_screen); if (!screen) return NULL; @@ -292,9 +290,6 @@ dri_init_screen2(__DRIscreenPrivate * sPriv) struct dri_screen *screen; struct drm_create_screen_arg arg; - /* Set up dispatch table to cope with all known extensions */ - dri_init_extensions(NULL); - screen = CALLOC_STRUCT(dri_screen); if (!screen) goto fail; diff --git a/src/gallium/state_trackers/egl/egl_context.c b/src/gallium/state_trackers/egl/egl_context.c index e21a4a1095..fee186c601 100644 --- a/src/gallium/state_trackers/egl/egl_context.c +++ b/src/gallium/state_trackers/egl/egl_context.c @@ -16,73 +16,6 @@ #include "GL/internal/glcore.h" -#define need_GL_ARB_multisample -#define need_GL_ARB_point_parameters -#define need_GL_ARB_texture_compression -#define need_GL_ARB_vertex_buffer_object -#define need_GL_ARB_vertex_program -#define need_GL_ARB_window_pos -#define need_GL_EXT_blend_color -#define need_GL_EXT_blend_equation_separate -#define need_GL_EXT_blend_func_separate -#define need_GL_EXT_blend_minmax -#define need_GL_EXT_cull_vertex -#define need_GL_EXT_fog_coord -#define need_GL_EXT_framebuffer_object -#define need_GL_EXT_multi_draw_arrays -#define need_GL_EXT_secondary_color -#define need_GL_NV_vertex_program -#include "extension_helper.h" - -/** - * TODO HACK! FUGLY! - * Copied for intel extentions. - */ -const struct dri_extension card_extensions[] = { - {"GL_ARB_multisample", GL_ARB_multisample_functions}, - {"GL_ARB_multitexture", NULL}, - {"GL_ARB_point_parameters", GL_ARB_point_parameters_functions}, - {"GL_ARB_texture_border_clamp", NULL}, - {"GL_ARB_texture_compression", GL_ARB_texture_compression_functions}, - {"GL_ARB_texture_cube_map", NULL}, - {"GL_ARB_texture_env_add", NULL}, - {"GL_ARB_texture_env_combine", NULL}, - {"GL_ARB_texture_env_dot3", NULL}, - {"GL_ARB_texture_mirrored_repeat", NULL}, - {"GL_ARB_texture_rectangle", NULL}, - {"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions}, - {"GL_ARB_pixel_buffer_object", NULL}, - {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions}, - {"GL_ARB_window_pos", GL_ARB_window_pos_functions}, - {"GL_EXT_blend_color", GL_EXT_blend_color_functions}, - {"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions}, - {"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions}, - {"GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions}, - {"GL_EXT_blend_subtract", NULL}, - {"GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions}, - {"GL_EXT_fog_coord", GL_EXT_fog_coord_functions}, - {"GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions}, - {"GL_EXT_multi_draw_arrays", GL_EXT_multi_draw_arrays_functions}, - {"GL_EXT_packed_depth_stencil", NULL}, - {"GL_EXT_pixel_buffer_object", NULL}, - {"GL_EXT_secondary_color", GL_EXT_secondary_color_functions}, - {"GL_EXT_stencil_wrap", NULL}, - {"GL_EXT_texture_edge_clamp", NULL}, - {"GL_EXT_texture_env_combine", NULL}, - {"GL_EXT_texture_env_dot3", NULL}, - {"GL_EXT_texture_filter_anisotropic", NULL}, - {"GL_EXT_texture_lod_bias", NULL}, - {"GL_3DFX_texture_compression_FXT1", NULL}, - {"GL_APPLE_client_storage", NULL}, - {"GL_MESA_pack_invert", NULL}, - {"GL_MESA_ycbcr_texture", NULL}, - {"GL_NV_blend_square", NULL}, - {"GL_NV_vertex_program", GL_NV_vertex_program_functions}, - {"GL_NV_vertex_program1_1", NULL}, - {"GL_SGIS_generate_mipmap", NULL }, - {NULL, NULL} -}; - _EGLContext * drm_create_context(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, _EGLContext *share_list, const EGLint *attrib_list) { diff --git a/src/gallium/state_trackers/egl/egl_tracker.c b/src/gallium/state_trackers/egl/egl_tracker.c index 5140755001..8d29bf490b 100644 --- a/src/gallium/state_trackers/egl/egl_tracker.c +++ b/src/gallium/state_trackers/egl/egl_tracker.c @@ -16,7 +16,6 @@ /** HACK */ void* driDriverAPI; -extern const struct dri_extension card_extensions[]; /* @@ -168,8 +167,7 @@ drm_initialize(_EGLDriver *drv, _EGLDisplay *disp, EGLint *major, EGLint *minor) goto err_screen; dev->winsys = dev->screen->winsys; - /* TODO HACK */ - driInitExtensions(NULL, card_extensions, GL_FALSE); + driInitExtensions(NULL, NULL, GL_FALSE); drm_update_res(dev); res = dev->res; diff --git a/src/mesa/drivers/dri/common/utils.c b/src/mesa/drivers/dri/common/utils.c index 66f277c10b..b272eb74ea 100644 --- a/src/mesa/drivers/dri/common/utils.c +++ b/src/mesa/drivers/dri/common/utils.c @@ -38,9 +38,6 @@ #include "utils.h" -int driDispatchRemapTable[ driDispatchRemapTable_size ]; - - unsigned driParseDebugString( const char * debug, const struct dri_debug_control * control ) @@ -142,7 +139,7 @@ driGetRendererString( char * buffer, const char * hardware_name, #define need_GL_EXT_blend_func_separate #define need_GL_NV_vertex_program -#include "extension_helper.h" +#include "main/remap_helper.h" static const struct dri_extension all_mesa_extensions[] = { { "GL_ARB_draw_buffers", GL_ARB_draw_buffers_functions }, @@ -165,8 +162,12 @@ static const struct dri_extension all_mesa_extensions[] = { /** - * Enable extensions supported by the driver. + * Enable and map extensions supported by the driver. * + * When ctx is NULL, extensions are not enabled, but their functions + * are still mapped. When extensions_to_enable is NULL, all static + * functions known to mesa core are mapped. + * * \bug * ARB_imaging isn't handled properly. In Mesa, enabling ARB_imaging also * enables all the sub-extensions that are folded into it. This means that @@ -181,18 +182,23 @@ void driInitExtensions( GLcontext * ctx, unsigned i; if ( first_time ) { - for ( i = 0 ; i < driDispatchRemapTable_size ; i++ ) { - driDispatchRemapTable[i] = -1; - } - first_time = 0; - driInitExtensions( ctx, all_mesa_extensions, GL_FALSE ); + driInitExtensions( NULL, all_mesa_extensions, GL_FALSE ); } if ( (ctx != NULL) && enable_imaging ) { _mesa_enable_imaging_extensions( ctx ); } + /* The caller is too lazy to list any extension */ + if ( extensions_to_enable == NULL ) { + /* Map the static functions. Together with those mapped by remap + * table, this should cover everything mesa core knows. + */ + _mesa_map_static_functions(); + return; + } + for ( i = 0 ; extensions_to_enable[i].name != NULL ; i++ ) { driInitSingleExtension( ctx, & extensions_to_enable[i] ); } @@ -202,80 +208,18 @@ void driInitExtensions( GLcontext * ctx, /** - * Enable and add dispatch functions for a single extension + * Enable and map functions for a single extension * * \param ctx Context where extension is to be enabled. * \param ext Extension that is to be enabled. * - * \sa driInitExtensions, _mesa_enable_extension, _glapi_add_entrypoint - * - * \todo - * Determine if it would be better to use \c strlen instead of the hardcoded - * for-loops. + * \sa driInitExtensions, _mesa_enable_extension, _mesa_map_function_array */ void driInitSingleExtension( GLcontext * ctx, const struct dri_extension * ext ) { - unsigned i; - - if ( ext->functions != NULL ) { - for ( i = 0 ; ext->functions[i].strings != NULL ; i++ ) { - const char * functions[16]; - const char * parameter_signature; - const char * str = ext->functions[i].strings; - unsigned j; - unsigned offset; - - - /* Separate the parameter signature from the rest of the string. - * If the parameter signature is empty (i.e., the string starts - * with a NUL character), then the function has a void parameter - * list. - */ - parameter_signature = str; - while ( str[0] != '\0' ) { - str++; - } - str++; - - - /* Divide the string into the substrings that name each - * entry-point for the function. - */ - for ( j = 0 ; j < 16 ; j++ ) { - if ( str[0] == '\0' ) { - functions[j] = NULL; - break; - } - - functions[j] = str; - - while ( str[0] != '\0' ) { - str++; - } - str++; - } - - - /* Add each entry-point to the dispatch table. - */ - offset = _glapi_add_dispatch( functions, parameter_signature ); - if (offset == -1) { -#if 0 /* this causes noise with egl */ - fprintf(stderr, "DISPATCH ERROR! _glapi_add_dispatch failed " - "to add %s!\n", functions[0]); -#endif - } - else if (ext->functions[i].remap_index != -1) { - driDispatchRemapTable[ ext->functions[i].remap_index ] = - offset; - } - else if (ext->functions[i].offset != offset) { - fprintf(stderr, "DISPATCH ERROR! %s -> %u != %u\n", - functions[0], offset, ext->functions[i].offset); - } - } + _mesa_map_function_array(ext->functions); } if ( ctx != NULL ) { diff --git a/src/mesa/drivers/dri/common/utils.h b/src/mesa/drivers/dri/common/utils.h index 9e9e5bc224..2aa6de66c1 100644 --- a/src/mesa/drivers/dri/common/utils.h +++ b/src/mesa/drivers/dri/common/utils.h @@ -31,6 +31,7 @@ #include #include #include "main/context.h" +#include "main/remap.h" typedef struct __DRIutilversionRec2 __DRIutilversion2; @@ -39,35 +40,6 @@ struct dri_debug_control { unsigned flag; }; -/** - * Description of the entry-points and parameters for an OpenGL function. - */ -struct dri_extension_function { - /** - * \brief - * Packed string describing the parameter signature and the entry-point - * names. - * - * The parameter signature and the names of the entry-points for this - * function are packed into a single string. The substrings are - * separated by NUL characters. The whole string is terminated by - * two consecutive NUL characters. - */ - const char * strings; - - - /** - * Location in the remap table where the dispatch offset should be - * stored. - */ - int remap_index; - - /** - * Offset of the function in the dispatch table. - */ - int offset; -}; - /** * Description of the API for an extension to OpenGL. */ @@ -83,7 +55,7 @@ struct dri_extension { * is terminated by a structure with a \c NULL * \c dri_extension_function::strings pointer. */ - const struct dri_extension_function * functions; + const struct gl_function_remap * functions; }; /** diff --git a/src/mesa/drivers/dri/i810/i810context.c b/src/mesa/drivers/dri/i810/i810context.c index 6785655686..7311b2e765 100644 --- a/src/mesa/drivers/dri/i810/i810context.c +++ b/src/mesa/drivers/dri/i810/i810context.c @@ -116,7 +116,7 @@ static void i810BufferSize(GLframebuffer *buffer, GLuint *width, GLuint *height) /* Extension strings exported by the i810 driver. */ -const struct dri_extension card_extensions[] = +static const struct dri_extension card_extensions[] = { { "GL_ARB_multitexture", NULL }, { "GL_ARB_texture_env_add", NULL }, diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index 6e49f3466c..a9ee61132e 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -53,8 +53,6 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "GL/internal/dri_interface.h" -extern const struct dri_extension card_extensions[]; - static const __DRIconfig ** i810FillInModes( __DRIscreenPrivate *psp, unsigned pixel_bits, unsigned depth_bits, @@ -166,8 +164,6 @@ i810InitScreen(__DRIscreen *sPriv) return NULL; } - driInitExtensions( NULL, card_extensions, GL_TRUE ); - if (sPriv->devPrivSize != sizeof(I810DRIRec)) { fprintf(stderr,"\nERROR! sizeof(I810DRIRec) does not match passed size from device driver\n"); return GL_FALSE; diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index 2eb08a8f05..b6754c9fcb 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -28,6 +28,7 @@ #include "intel_chipset.h" #include "intel_context.h" #include "intel_extensions.h" +#include "utils.h" #define need_GL_ARB_copy_buffer @@ -63,7 +64,7 @@ #define need_GL_VERSION_2_0 #define need_GL_VERSION_2_1 -#include "extension_helper.h" +#include "main/remap_helper.h" /** diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 24f7fbc992..41342ddcae 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -696,18 +696,6 @@ static const __DRIconfig **intelInitScreen(__DRIscreenPrivate *psp) return NULL; } - /* Calling driInitExtensions here, with a NULL context pointer, - * does not actually enable the extensions. It just makes sure - * that all the dispatch offsets for all the extensions that - * *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is - * called, but we can't enable the extensions until we have a - * context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - intelInitExtensions(NULL, GL_TRUE); - if (!intelInitDriver(psp)) return NULL; @@ -760,18 +748,6 @@ __DRIconfig **intelInitScreen2(__DRIscreenPrivate *psp) int color; __DRIconfig **configs = NULL; - /* Calling driInitExtensions here, with a NULL context pointer, - * does not actually enable the extensions. It just makes sure - * that all the dispatch offsets for all the extensions that - * *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is - * called, but we can't enable the extensions until we have a - * context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - intelInitExtensions(NULL, GL_TRUE); - /* Allocate the private area */ intelScreen = (intelScreenPrivate *) CALLOC(sizeof(intelScreenPrivate)); if (!intelScreen) { diff --git a/src/mesa/drivers/dri/mach64/mach64_context.c b/src/mesa/drivers/dri/mach64/mach64_context.c index 9c7f513c6f..2bca293b3c 100644 --- a/src/mesa/drivers/dri/mach64/mach64_context.c +++ b/src/mesa/drivers/dri/mach64/mach64_context.c @@ -76,7 +76,7 @@ static const struct dri_debug_control debug_control[] = { NULL, 0 } }; -const struct dri_extension card_extensions[] = +static const struct dri_extension card_extensions[] = { { "GL_ARB_multitexture", NULL }, { "GL_EXT_texture_edge_clamp", NULL }, diff --git a/src/mesa/drivers/dri/mach64/mach64_screen.c b/src/mesa/drivers/dri/mach64/mach64_screen.c index 6440027ca4..43aac899f7 100644 --- a/src/mesa/drivers/dri/mach64/mach64_screen.c +++ b/src/mesa/drivers/dri/mach64/mach64_screen.c @@ -67,8 +67,6 @@ static const GLuint __driNConfigOptions = 3; static const GLuint __driNConfigOptions = 2; #endif -extern const struct dri_extension card_extensions[]; - static const __DRIconfig ** mach64FillInModes( __DRIscreenPrivate *psp, unsigned pixel_bits, unsigned depth_bits, @@ -436,18 +434,6 @@ mach64InitScreen(__DRIscreenPrivate *psp) return NULL; } - /* Calling driInitExtensions here, with a NULL context pointer, - * does not actually enable the extensions. It just makes sure - * that all the dispatch offsets for all the extensions that - * *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is - * called, but we can't enable the extensions until we have a - * context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - if (!mach64InitDriver(psp)) return NULL; diff --git a/src/mesa/drivers/dri/mga/mga_xmesa.c b/src/mesa/drivers/dri/mga/mga_xmesa.c index 0dc76fea50..03fd9b6fc1 100644 --- a/src/mesa/drivers/dri/mga/mga_xmesa.c +++ b/src/mesa/drivers/dri/mga/mga_xmesa.c @@ -78,7 +78,7 @@ #endif #define need_GL_APPLE_vertex_array_object #define need_GL_NV_vertex_program -#include "extension_helper.h" +#include "main/remap_helper.h" /* MGA configuration */ @@ -945,22 +945,6 @@ static const __DRIconfig **mgaInitScreen(__DRIscreen *psp) return NULL; - /* Calling driInitExtensions here, with a NULL context pointer, - * does not actually enable the extensions. It just makes sure - * that all the dispatch offsets for all the extensions that - * *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is - * called, but we can't enable the extensions until we have a - * context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - - driInitExtensions( NULL, card_extensions, GL_FALSE ); - driInitExtensions( NULL, g400_extensions, GL_FALSE ); - driInitExtensions(NULL, ARB_vp_extensions, GL_FALSE); - driInitExtensions( NULL, NV_vp_extensions, GL_FALSE ); - if (!mgaInitDriver(psp)) return NULL; diff --git a/src/mesa/drivers/dri/r128/r128_context.c b/src/mesa/drivers/dri/r128/r128_context.c index f511a67bad..0b250876c5 100644 --- a/src/mesa/drivers/dri/r128/r128_context.c +++ b/src/mesa/drivers/dri/r128/r128_context.c @@ -68,9 +68,9 @@ int R128_DEBUG = 0; #define need_GL_EXT_blend_minmax #define need_GL_EXT_fog_coord #define need_GL_EXT_secondary_color -#include "extension_helper.h" +#include "main/remap_helper.h" -const struct dri_extension card_extensions[] = +static const struct dri_extension card_extensions[] = { { "GL_ARB_multitexture", NULL }, { "GL_ARB_texture_env_add", NULL }, diff --git a/src/mesa/drivers/dri/r128/r128_screen.c b/src/mesa/drivers/dri/r128/r128_screen.c index f5bcc2f290..a68b019776 100644 --- a/src/mesa/drivers/dri/r128/r128_screen.c +++ b/src/mesa/drivers/dri/r128/r128_screen.c @@ -74,8 +74,6 @@ static const GLuint __driNConfigOptions = 4; static const GLuint __driNConfigOptions = 3; #endif -extern const struct dri_extension card_extensions[]; - #if 1 /* Including xf86PciInfo.h introduces a bunch of errors... */ @@ -493,18 +491,6 @@ r128InitScreen(__DRIscreenPrivate *psp) &psp->drm_version, & drm_expected ) ) return NULL; - /* Calling driInitExtensions here, with a NULL context pointer, - * does not actually enable the extensions. It just makes sure - * that all the dispatch offsets for all the extensions that - * *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is - * called, but we can't enable the extensions until we have a - * context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - if (!r128InitDriver(psp)) return NULL; diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 3ddb5bf7d6..e3ae839235 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -75,7 +75,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define need_GL_NV_vertex_program #define need_GL_ARB_point_parameters #define need_GL_EXT_framebuffer_object -#include "extension_helper.h" +#include "main/remap_helper.h" #define DRIVER_DATE "20060602" @@ -115,7 +115,7 @@ static const GLubyte *r200GetString( GLcontext *ctx, GLenum name ) /* Extension strings exported by the R200 driver. */ -const struct dri_extension card_extensions[] = +static const struct dri_extension card_extensions[] = { { "GL_ARB_multitexture", NULL }, { "GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions}, @@ -146,31 +146,31 @@ const struct dri_extension card_extensions[] = { NULL, NULL } }; -const struct dri_extension blend_extensions[] = { +static const struct dri_extension blend_extensions[] = { { "GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions }, { "GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions }, { NULL, NULL } }; -const struct dri_extension ARB_vp_extension[] = { +static const struct dri_extension ARB_vp_extension[] = { { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions } }; -const struct dri_extension NV_vp_extension[] = { +static const struct dri_extension NV_vp_extension[] = { { "GL_NV_vertex_program", GL_NV_vertex_program_functions } }; -const struct dri_extension ATI_fs_extension[] = { +static const struct dri_extension ATI_fs_extension[] = { { "GL_ATI_fragment_shader", GL_ATI_fragment_shader_functions } }; -const struct dri_extension point_extensions[] = { +static const struct dri_extension point_extensions[] = { { "GL_ARB_point_sprite", NULL }, { "GL_ARB_point_parameters", GL_ARB_point_parameters_functions }, { NULL, NULL } }; -const struct dri_extension mm_extensions[] = { +static const struct dri_extension mm_extensions[] = { { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, { NULL, NULL } }; diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 2c2b16aa98..6f66e970e4 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -90,10 +90,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define need_GL_ATI_separate_stencil #define need_GL_NV_vertex_program -#include "extension_helper.h" +#include "main/remap_helper.h" -const struct dri_extension card_extensions[] = { +static const struct dri_extension card_extensions[] = { /* *INDENT-OFF* */ {"GL_ARB_depth_texture", NULL}, {"GL_ARB_fragment_program", NULL}, @@ -145,7 +145,7 @@ const struct dri_extension card_extensions[] = { }; -const struct dri_extension mm_extensions[] = { +static const struct dri_extension mm_extensions[] = { { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions }, { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, { NULL, NULL } @@ -155,7 +155,7 @@ const struct dri_extension mm_extensions[] = { * The GL 2.0 functions are needed to make display lists work with * functions added by GL_ATI_separate_stencil. */ -const struct dri_extension gl_20_extension[] = { +static const struct dri_extension gl_20_extension[] = { {"GL_VERSION_2_0", GL_VERSION_2_0_functions }, }; diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index e6791b46f0..c1bf76deb8 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -92,9 +92,9 @@ int hw_tcl_on = 1; #define need_GL_ATI_separate_stencil #define need_GL_NV_vertex_program -#include "extension_helper.h" +#include "main/remap_helper.h" -const struct dri_extension card_extensions[] = { +static const struct dri_extension card_extensions[] = { /* *INDENT-OFF* */ {"GL_ARB_depth_texture", NULL}, {"GL_ARB_fragment_program", NULL}, @@ -145,7 +145,7 @@ const struct dri_extension card_extensions[] = { }; -const struct dri_extension mm_extensions[] = { +static const struct dri_extension mm_extensions[] = { { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, { NULL, NULL } }; @@ -154,7 +154,7 @@ const struct dri_extension mm_extensions[] = { * The GL 2.0 functions are needed to make display lists work with * functions added by GL_ATI_separate_stencil. */ -const struct dri_extension gl_20_extension[] = { +static const struct dri_extension gl_20_extension[] = { {"GL_VERSION_2_0", GL_VERSION_2_0_functions }, }; diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index 8f4485aee7..5e700be4a5 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -69,7 +69,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define need_GL_EXT_fog_coord #define need_GL_EXT_secondary_color #define need_GL_EXT_framebuffer_object -#include "extension_helper.h" +#include "main/remap_helper.h" #define DRIVER_DATE "20061018" @@ -79,7 +79,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. /* Extension strings exported by the R100 driver. */ -const struct dri_extension card_extensions[] = +static const struct dri_extension card_extensions[] = { { "GL_ARB_multitexture", NULL }, { "GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions}, @@ -109,7 +109,7 @@ const struct dri_extension card_extensions[] = { NULL, NULL } }; -const struct dri_extension mm_extensions[] = { +static const struct dri_extension mm_extensions[] = { { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, { NULL, NULL } }; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 573eb6c9c1..2fb2d37cf1 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -141,12 +141,6 @@ DRI_CONF_BEGIN DRI_CONF_END; static const GLuint __driNConfigOptions = 17; -extern const struct dri_extension blend_extensions[]; -extern const struct dri_extension ARB_vp_extension[]; -extern const struct dri_extension NV_vp_extension[]; -extern const struct dri_extension ATI_fs_extension[]; -extern const struct dri_extension point_extensions[]; - #elif defined(RADEON_R300) || defined(RADEON_R600) #define DRI_CONF_FP_OPTIMIZATION_SPEED 0 @@ -218,13 +212,8 @@ DRI_CONF_BEGIN DRI_CONF_END; static const GLuint __driNConfigOptions = 17; -extern const struct dri_extension gl_20_extension[]; - #endif -extern const struct dri_extension card_extensions[]; -extern const struct dri_extension mm_extensions[]; - static int getSwapInfo( __DRIdrawablePrivate *dPriv, __DRIswapInfo * sInfo ); static int @@ -1619,27 +1608,6 @@ radeonInitScreen(__DRIscreenPrivate *psp) return NULL; } - /* Calling driInitExtensions here, with a NULL context pointer, - * does not actually enable the extensions. It just makes sure - * that all the dispatch offsets for all the extensions that - * *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create - * is called, but we can't enable the extensions until we have a - * context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); -#if defined(RADEON_R200) - driInitExtensions( NULL, blend_extensions, GL_FALSE ); - driInitSingleExtension( NULL, ARB_vp_extension ); - driInitSingleExtension( NULL, NV_vp_extension ); - driInitSingleExtension( NULL, ATI_fs_extension ); - driInitExtensions( NULL, point_extensions, GL_FALSE ); -#elif (defined(RADEON_R300) || defined(RADEON_R600)) - driInitSingleExtension( NULL, gl_20_extension ); -#endif - if (!radeonInitDriver(psp)) return NULL; @@ -1672,28 +1640,6 @@ __DRIconfig **radeonInitScreen2(__DRIscreenPrivate *psp) int color; __DRIconfig **configs = NULL; - /* Calling driInitExtensions here, with a NULL context pointer, - * does not actually enable the extensions. It just makes sure - * that all the dispatch offsets for all the extensions that - * *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create - * is called, but we can't enable the extensions until we have a - * context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - driInitExtensions( NULL, mm_extensions, GL_FALSE ); -#if defined(RADEON_R200) - driInitExtensions( NULL, blend_extensions, GL_FALSE ); - driInitSingleExtension( NULL, ARB_vp_extension ); - driInitSingleExtension( NULL, NV_vp_extension ); - driInitSingleExtension( NULL, ATI_fs_extension ); - driInitExtensions( NULL, point_extensions, GL_FALSE ); -#elif (defined(RADEON_R300) || defined(RADEON_R600)) - driInitSingleExtension( NULL, gl_20_extension ); -#endif - if (!radeonInitDriver(psp)) { return NULL; } diff --git a/src/mesa/drivers/dri/savage/savage_xmesa.c b/src/mesa/drivers/dri/savage/savage_xmesa.c index 931ceff0a8..0fccf50a03 100644 --- a/src/mesa/drivers/dri/savage/savage_xmesa.c +++ b/src/mesa/drivers/dri/savage/savage_xmesa.c @@ -59,7 +59,7 @@ #include "texmem.h" #define need_GL_EXT_secondary_color -#include "extension_helper.h" +#include "main/remap_helper.h" #include "xmlpool.h" @@ -980,18 +980,6 @@ savageInitScreen(__DRIscreenPrivate *psp) &psp->drm_version, & drm_expected ) ) return NULL; - /* Calling driInitExtensions here, with a NULL context pointer, - * does not actually enable the extensions. It just makes sure - * that all the dispatch offsets for all the extensions that - * *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is - * called, but we can't enable the extensions until we have a - * context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - if (!savageInitDriver(psp)) return NULL; diff --git a/src/mesa/drivers/dri/sis/sis_context.c b/src/mesa/drivers/dri/sis/sis_context.c index a070fe3d79..f501e7ad2e 100644 --- a/src/mesa/drivers/dri/sis/sis_context.c +++ b/src/mesa/drivers/dri/sis/sis_context.c @@ -59,7 +59,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define need_GL_EXT_fog_coord #define need_GL_EXT_secondary_color -#include "extension_helper.h" +#include "main/remap_helper.h" #ifndef SIS_DEBUG int SIS_DEBUG = 0; @@ -69,7 +69,7 @@ int GlobalCurrentHwcx = -1; int GlobalHwcxCountBase = 1; int GlobalCmdQueueLen = 0; -struct dri_extension card_extensions[] = +static struct dri_extension card_extensions[] = { { "GL_ARB_multitexture", NULL }, { "GL_ARB_texture_border_clamp", NULL }, @@ -83,7 +83,7 @@ struct dri_extension card_extensions[] = { NULL, NULL } }; -struct dri_extension card_extensions_6326[] = +static struct dri_extension card_extensions_6326[] = { /*{ "GL_ARB_texture_border_clamp", NULL },*/ /*{ "GL_ARB_texture_mirrored_repeat", NULL },*/ diff --git a/src/mesa/drivers/dri/sis/sis_screen.c b/src/mesa/drivers/dri/sis/sis_screen.c index b5f04ae28d..fec9158236 100644 --- a/src/mesa/drivers/dri/sis/sis_screen.c +++ b/src/mesa/drivers/dri/sis/sis_screen.c @@ -298,18 +298,6 @@ sisInitScreen(__DRIscreenPrivate *psp) &psp->drm_version, &drm_expected)) return NULL; - /* Calling driInitExtensions here, with a NULL context pointer, - * does not actually enable the extensions. It just makes sure - * that all the dispatch offsets for all the extensions that - * *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is - * called, but we can't enable the extensions until we have a - * context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - psp->private = sisCreateScreen(psp); if (!psp->private) { diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index f4947daa06..df5221b135 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -49,78 +49,6 @@ #include "swrast_priv.h" -#define need_GL_VERSION_1_3 -#define need_GL_VERSION_1_4 -#define need_GL_VERSION_1_5 -#define need_GL_VERSION_2_0 -#define need_GL_VERSION_2_1 - -/* sw extensions for imaging */ -#define need_GL_EXT_blend_color -#define need_GL_EXT_blend_minmax -#define need_GL_EXT_convolution -#define need_GL_EXT_histogram -#define need_GL_SGI_color_table - -/* sw extensions not associated with some GL version */ -#define need_GL_ARB_draw_elements_base_vertex -#define need_GL_ARB_shader_objects -#define need_GL_ARB_vertex_array_object -#define need_GL_ARB_vertex_program -#define need_GL_ARB_sync -#define need_GL_APPLE_vertex_array_object -#define need_GL_ATI_fragment_shader -#define need_GL_ATI_separate_stencil -#define need_GL_EXT_depth_bounds_test -#define need_GL_EXT_framebuffer_object -#define need_GL_EXT_framebuffer_blit -#define need_GL_EXT_gpu_program_parameters -#define need_GL_EXT_paletted_texture -#define need_GL_EXT_stencil_two_side -#define need_GL_MESA_resize_buffers -#define need_GL_NV_vertex_program -#define need_GL_NV_fragment_program - -#include "extension_helper.h" - -const struct dri_extension card_extensions[] = -{ - { "GL_VERSION_1_3", GL_VERSION_1_3_functions }, - { "GL_VERSION_1_4", GL_VERSION_1_4_functions }, - { "GL_VERSION_1_5", GL_VERSION_1_5_functions }, - { "GL_VERSION_2_0", GL_VERSION_2_0_functions }, - { "GL_VERSION_2_1", GL_VERSION_2_1_functions }, - - { "GL_EXT_blend_color", GL_EXT_blend_color_functions }, - { "GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions }, - { "GL_EXT_convolution", GL_EXT_convolution_functions }, - { "GL_EXT_histogram", GL_EXT_histogram_functions }, - { "GL_SGI_color_table", GL_SGI_color_table_functions }, - - { "GL_ARB_depth_clamp", NULL }, - { "GL_ARB_draw_elements_base_vertex", GL_ARB_draw_elements_base_vertex_functions }, - { "GL_ARB_shader_objects", GL_ARB_shader_objects_functions }, - { "GL_ARB_vertex_array_object", GL_ARB_vertex_array_object_functions }, - { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions }, - { "GL_ARB_sync", GL_ARB_sync_functions }, - { "GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions }, - { "GL_ATI_fragment_shader", GL_ATI_fragment_shader_functions }, - { "GL_ATI_separate_stencil", GL_ATI_separate_stencil_functions }, - { "GL_EXT_depth_bounds_test", GL_EXT_depth_bounds_test_functions }, - { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, - { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions }, - { "GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions }, - { "GL_EXT_paletted_texture", GL_EXT_paletted_texture_functions }, - { "GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions }, - { "GL_MESA_resize_buffers", GL_MESA_resize_buffers_functions }, - { "GL_NV_depth_clamp", NULL }, - { "GL_NV_vertex_program", GL_NV_vertex_program_functions }, - { "GL_NV_fragment_program", GL_NV_fragment_program_functions }, - { "GL_NV_fragment_program_option", NULL }, - { NULL, NULL } -}; - - /** * Screen and config-related functions */ @@ -244,7 +172,7 @@ driCreateNewScreen(int scrn, const __DRIextension **extensions, *driver_configs = (const __DRIconfig **) driConcatConfigs(configs24, configs32); - driInitExtensions( NULL, card_extensions, GL_FALSE ); + driInitExtensions( NULL, NULL, GL_FALSE ); return psp; } diff --git a/src/mesa/drivers/dri/tdfx/tdfx_context.c b/src/mesa/drivers/dri/tdfx/tdfx_context.c index 68b5027561..e742d414a5 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_context.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_context.c @@ -68,13 +68,13 @@ #define need_GL_EXT_paletted_texture /* #define need_GL_EXT_secondary_color */ /* #define need_GL_NV_vertex_program */ -#include "extension_helper.h" +#include "main/remap_helper.h" /** * Common extension strings exported by all cards */ -const struct dri_extension card_extensions[] = +static const struct dri_extension card_extensions[] = { { "GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions }, { "GL_ARB_texture_mirrored_repeat", NULL }, @@ -107,7 +107,7 @@ const struct dri_extension card_extensions[] = /** * Extension strings exported only by Naplam (e.g., Voodoo4 & Voodoo5) cards. */ -const struct dri_extension napalm_extensions[] = +static const struct dri_extension napalm_extensions[] = { { "GL_ARB_texture_env_combine", NULL }, { "GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions }, diff --git a/src/mesa/drivers/dri/tdfx/tdfx_screen.c b/src/mesa/drivers/dri/tdfx/tdfx_screen.c index 58bd48b294..d8a4b401c0 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_screen.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_screen.c @@ -69,9 +69,6 @@ static const __DRIextension *tdfxExtensions[] = { static const GLuint __driNConfigOptions = 1; -extern const struct dri_extension card_extensions[]; -extern const struct dri_extension napalm_extensions[]; - static GLboolean tdfxCreateScreen( __DRIscreenPrivate *sPriv ) { @@ -418,19 +415,6 @@ tdfxInitScreen(__DRIscreen *psp) &psp->drm_version, & drm_expected ) ) return NULL; - /* Calling driInitExtensions here, with a NULL context pointer, - * does not actually enable the extensions. It just makes sure - * that all the dispatch offsets for all the extensions that - * *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is - * called, but we can't enable the extensions until we have a - * context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - driInitExtensions( NULL, napalm_extensions, GL_FALSE ); - if (!tdfxInitDriver(psp)) return NULL; diff --git a/src/mesa/drivers/dri/unichrome/via_context.c b/src/mesa/drivers/dri/unichrome/via_context.c index 6eb19ac079..5be1cf32c2 100644 --- a/src/mesa/drivers/dri/unichrome/via_context.c +++ b/src/mesa/drivers/dri/unichrome/via_context.c @@ -65,7 +65,7 @@ #define need_GL_ARB_point_parameters #define need_GL_EXT_fog_coord #define need_GL_EXT_secondary_color -#include "extension_helper.h" +#include "main/remap_helper.h" #define DRIVER_DATE "20060710" @@ -362,7 +362,7 @@ void viaReAllocateBuffers(GLcontext *ctx, GLframebuffer *drawbuffer, /* Extension strings exported by the Unichrome driver. */ -const struct dri_extension card_extensions[] = +static const struct dri_extension card_extensions[] = { { "GL_ARB_multitexture", NULL }, { "GL_ARB_point_parameters", GL_ARB_point_parameters_functions }, diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 3dbb570571..7cfc60a015 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -62,8 +62,6 @@ DRI_CONF_BEGIN DRI_CONF_END; static const GLuint __driNConfigOptions = 3; -extern const struct dri_extension card_extensions[]; - static drmBufMapPtr via_create_empty_buffers(void) { drmBufMapPtr retval; @@ -393,18 +391,6 @@ viaInitScreen(__DRIscreenPrivate *psp) &psp->drm_version, & drm_expected) ) return NULL; - /* Calling driInitExtensions here, with a NULL context pointer, - * does not actually enable the extensions. It just makes sure - * that all the dispatch offsets for all the extensions that - * *might* be enables are known. This is needed because the - * dispatch offsets need to be known when _mesa_context_create is - * called, but we can't enable the extensions until we have a - * context pointer. - * - * Hello chicken. Hello egg. How are you two today? - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); - if (!viaInitDriver(psp)) return NULL; diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 79b058634c..bf767bcedd 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -1303,71 +1303,6 @@ xmesa_convert_from_x_visual_type( int visualType ) /**********************************************************************/ -#ifdef IN_DRI_DRIVER -#define need_GL_VERSION_1_3 -#define need_GL_VERSION_1_4 -#define need_GL_VERSION_1_5 -#define need_GL_VERSION_2_0 - -/* sw extensions for imaging */ -#define need_GL_EXT_blend_color -#define need_GL_EXT_blend_minmax -#define need_GL_EXT_convolution -#define need_GL_EXT_histogram -#define need_GL_SGI_color_table - -/* sw extensions not associated with some GL version */ -#define need_GL_ARB_draw_elements_base_vertex -#define need_GL_ARB_shader_objects -#define need_GL_ARB_sync -#define need_GL_ARB_vertex_program -#define need_GL_APPLE_vertex_array_object -#define need_GL_ATI_fragment_shader -#define need_GL_EXT_depth_bounds_test -#define need_GL_EXT_framebuffer_object -#define need_GL_EXT_framebuffer_blit -#define need_GL_EXT_gpu_program_parameters -#define need_GL_EXT_paletted_texture -#define need_GL_MESA_resize_buffers -#define need_GL_NV_vertex_program -#define need_GL_NV_fragment_program - -#include "extension_helper.h" -#include "utils.h" - -const struct dri_extension card_extensions[] = -{ - { "GL_VERSION_1_3", GL_VERSION_1_3_functions }, - { "GL_VERSION_1_4", GL_VERSION_1_4_functions }, - { "GL_VERSION_1_5", GL_VERSION_1_5_functions }, - { "GL_VERSION_2_0", GL_VERSION_2_0_functions }, - - { "GL_EXT_blend_color", GL_EXT_blend_color_functions }, - { "GL_EXT_blend_minmax", GL_EXT_blend_minmax_functions }, - { "GL_EXT_convolution", GL_EXT_convolution_functions }, - { "GL_EXT_histogram", GL_EXT_histogram_functions }, - { "GL_SGI_color_table", GL_SGI_color_table_functions }, - - { "GL_ARB_depth_clamp", NULL }, - { "GL_ARB_draw_elements_base_vertex", GL_ARB_draw_elements_base_vertex_functions }, - { "GL_ARB_shader_objects", GL_ARB_shader_objects_functions }, - { "GL_ARB_sync", GL_ARB_sync_functions }, - { "GL_ARB_vertex_program", GL_ARB_vertex_program_functions }, - { "GL_APPLE_vertex_array_object", GL_APPLE_vertex_array_object_functions }, - { "GL_ATI_fragment_shader", GL_ATI_fragment_shader_functions }, - { "GL_EXT_depth_bounds_test", GL_EXT_depth_bounds_test_functions }, - { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, - { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions }, - { "GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions }, - { "GL_EXT_paletted_texture", GL_EXT_paletted_texture_functions }, - { "GL_MESA_resize_buffers", GL_MESA_resize_buffers_functions }, - { "GL_NV_depth_clamp", NULL }, - { "GL_NV_vertex_program", GL_NV_vertex_program_functions }, - { "GL_NV_fragment_program", GL_NV_fragment_program_functions }, - { NULL, NULL } -}; -#endif - /* * Create a new X/Mesa visual. * Input: display - X11 display @@ -1413,14 +1348,6 @@ XMesaVisual XMesaCreateVisual( XMesaDisplay *display, XMesaVisual v; GLint red_bits, green_bits, blue_bits, alpha_bits; -#ifdef IN_DRI_DRIVER - /* driInitExtensions() should be called once per screen to setup extension - * indices. There is no need to call it when the context is created since - * XMesa enables mesa sw extensions on its own. - */ - driInitExtensions( NULL, card_extensions, GL_FALSE ); -#endif - #ifndef XFree86Server /* For debugging only */ if (_mesa_getenv("MESA_XSYNC")) { diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 490b8f0f33..ea820d77b3 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -117,6 +117,7 @@ #include "syncobj.h" #endif #include "rastpos.h" +#include "remap.h" #include "scissor.h" #include "shared.h" #include "simple_list.h" @@ -407,6 +408,8 @@ one_time_init( GLcontext *ctx ) _mesa_get_cpu_features(); + _mesa_init_remap_table(); + _mesa_init_sqrt_table(); for (i = 0; i < 256; i++) { diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index 7107538cee..0838014e93 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -55,6 +55,7 @@ MAIN_SOURCES = \ main/rastpos.c \ main/rbadaptors.c \ main/readpix.c \ + main/remap.c \ main/renderbuffer.c \ main/scissor.c \ main/shaders.c \ -- cgit v1.2.3 From 3d16088ff0b369c877e2aae87ddc7322d70ecc7d Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 8 Oct 2009 11:52:11 +0800 Subject: mesa/dri: Remove extension_helper.h. Signed-off-by: Chia-I Wu --- src/mesa/drivers/dri/common/extension_helper.h | 6647 ------------------------ src/mesa/glapi/Makefile | 5 - 2 files changed, 6652 deletions(-) delete mode 100644 src/mesa/drivers/dri/common/extension_helper.h (limited to 'src') diff --git a/src/mesa/drivers/dri/common/extension_helper.h b/src/mesa/drivers/dri/common/extension_helper.h deleted file mode 100644 index 5e86324eec..0000000000 --- a/src/mesa/drivers/dri/common/extension_helper.h +++ /dev/null @@ -1,6647 +0,0 @@ -/* DO NOT EDIT - This file generated automatically by extension_helper.py (from Mesa) script */ - -/* - * (C) Copyright IBM Corporation 2005 - * 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 - * IBM, - * 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 "utils.h" -#include "glapi/dispatch.h" - -#ifndef NULL -# define NULL 0 -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char UniformMatrix3fvARB_names[] = - "iiip\0" /* Parameter signature */ - "glUniformMatrix3fv\0" - "glUniformMatrix3fvARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_multisample) -static const char SampleCoverageARB_names[] = - "fi\0" /* Parameter signature */ - "glSampleCoverage\0" - "glSampleCoverageARB\0" - ""; -#endif - -#if defined(need_GL_EXT_convolution) -static const char ConvolutionFilter1D_names[] = - "iiiiip\0" /* Parameter signature */ - "glConvolutionFilter1D\0" - "glConvolutionFilter1DEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) -static const char BeginQueryARB_names[] = - "ii\0" /* Parameter signature */ - "glBeginQuery\0" - "glBeginQueryARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_NV_point_sprite) -static const char PointParameteriNV_names[] = - "ii\0" /* Parameter signature */ - "glPointParameteri\0" - "glPointParameteriNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) -static const char GetProgramiv_names[] = - "iip\0" /* Parameter signature */ - "glGetProgramiv\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord3sARB_names[] = - "iiii\0" /* Parameter signature */ - "glMultiTexCoord3s\0" - "glMultiTexCoord3sARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) -static const char SecondaryColor3iEXT_names[] = - "iii\0" /* Parameter signature */ - "glSecondaryColor3i\0" - "glSecondaryColor3iEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) -static const char WindowPos3fMESA_names[] = - "fff\0" /* Parameter signature */ - "glWindowPos3f\0" - "glWindowPos3fARB\0" - "glWindowPos3fMESA\0" - ""; -#endif - -#if defined(need_GL_SGIS_pixel_texture) -static const char PixelTexGenParameterfvSGIS_names[] = - "ip\0" /* Parameter signature */ - "glPixelTexGenParameterfvSGIS\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char ActiveTextureARB_names[] = - "i\0" /* Parameter signature */ - "glActiveTexture\0" - "glActiveTextureARB\0" - ""; -#endif - -#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_blit) -static const char BlitFramebufferEXT_names[] = - "iiiiiiiiii\0" /* Parameter signature */ - "glBlitFramebuffer\0" - "glBlitFramebufferEXT\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib4ubvNV_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib4ubvNV\0" - ""; -#endif - -#if defined(need_GL_NV_fragment_program) -static const char GetProgramNamedParameterdvNV_names[] = - "iipp\0" /* Parameter signature */ - "glGetProgramNamedParameterdvNV\0" - ""; -#endif - -#if defined(need_GL_EXT_histogram) -static const char Histogram_names[] = - "iiii\0" /* Parameter signature */ - "glHistogram\0" - "glHistogramEXT\0" - ""; -#endif - -#if defined(need_GL_SGIS_texture4D) -static const char TexImage4DSGIS_names[] = - "iiiiiiiiiip\0" /* Parameter signature */ - "glTexImage4DSGIS\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) -static const char WindowPos2dvMESA_names[] = - "p\0" /* Parameter signature */ - "glWindowPos2dv\0" - "glWindowPos2dvARB\0" - "glWindowPos2dvMESA\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char ReplacementCodeuiColor3fVertex3fvSUN_names[] = - "ppp\0" /* Parameter signature */ - "glReplacementCodeuiColor3fVertex3fvSUN\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_EXT_blend_equation_separate) || defined(need_GL_ATI_blend_equation_separate) -static const char BlendEquationSeparateEXT_names[] = - "ii\0" /* Parameter signature */ - "glBlendEquationSeparate\0" - "glBlendEquationSeparateEXT\0" - "glBlendEquationSeparateATI\0" - ""; -#endif - -#if defined(need_GL_SGIX_list_priority) -static const char ListParameterfSGIX_names[] = - "iif\0" /* Parameter signature */ - "glListParameterfSGIX\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) -static const char SecondaryColor3bEXT_names[] = - "iii\0" /* Parameter signature */ - "glSecondaryColor3b\0" - "glSecondaryColor3bEXT\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char TexCoord4fColor4fNormal3fVertex4fvSUN_names[] = - "pppp\0" /* Parameter signature */ - "glTexCoord4fColor4fNormal3fVertex4fvSUN\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib4svNV_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib4svNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) -static const char GetBufferSubDataARB_names[] = - "iiip\0" /* Parameter signature */ - "glGetBufferSubData\0" - "glGetBufferSubDataARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) -static const char BufferSubDataARB_names[] = - "iiip\0" /* Parameter signature */ - "glBufferSubData\0" - "glBufferSubDataARB\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char TexCoord2fColor4ubVertex3fvSUN_names[] = - "ppp\0" /* Parameter signature */ - "glTexCoord2fColor4ubVertex3fvSUN\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) -static const char AttachShader_names[] = - "ii\0" /* Parameter signature */ - "glAttachShader\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib2fARB_names[] = - "iff\0" /* Parameter signature */ - "glVertexAttrib2f\0" - "glVertexAttrib2fARB\0" - ""; -#endif - -#if defined(need_GL_MESA_shader_debug) -static const char GetDebugLogLengthMESA_names[] = - "iii\0" /* Parameter signature */ - "glGetDebugLogLengthMESA\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib3fARB_names[] = - "ifff\0" /* Parameter signature */ - "glVertexAttrib3f\0" - "glVertexAttrib3fARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) -static const char GetQueryivARB_names[] = - "iip\0" /* Parameter signature */ - "glGetQueryiv\0" - "glGetQueryivARB\0" - ""; -#endif - -#if defined(need_GL_EXT_texture3D) -static const char TexImage3D_names[] = - "iiiiiiiiip\0" /* Parameter signature */ - "glTexImage3D\0" - "glTexImage3DEXT\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char ReplacementCodeuiVertex3fvSUN_names[] = - "pp\0" /* Parameter signature */ - "glReplacementCodeuiVertex3fvSUN\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) -static const char GetQueryObjectivARB_names[] = - "iip\0" /* Parameter signature */ - "glGetQueryObjectiv\0" - "glGetQueryObjectivARB\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char ReplacementCodeuiTexCoord2fVertex3fvSUN_names[] = - "ppp\0" /* Parameter signature */ - "glReplacementCodeuiTexCoord2fVertex3fvSUN\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression) -static const char CompressedTexSubImage2DARB_names[] = - "iiiiiiiip\0" /* Parameter signature */ - "glCompressedTexSubImage2D\0" - "glCompressedTexSubImage2DARB\0" - ""; -#endif - -#if defined(need_GL_NV_register_combiners) -static const char CombinerOutputNV_names[] = - "iiiiiiiiii\0" /* Parameter signature */ - "glCombinerOutputNV\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttribs3fvNV_names[] = - "iip\0" /* Parameter signature */ - "glVertexAttribs3fvNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char Uniform2fARB_names[] = - "iff\0" /* Parameter signature */ - "glUniform2f\0" - "glUniform2fARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib1svARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib1sv\0" - "glVertexAttrib1svARB\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttribs1dvNV_names[] = - "iip\0" /* Parameter signature */ - "glVertexAttribs1dvNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char Uniform2ivARB_names[] = - "iip\0" /* Parameter signature */ - "glUniform2iv\0" - "glUniform2ivARB\0" - ""; -#endif - -#if defined(need_GL_HP_image_transform) -static const char GetImageTransformParameterfvHP_names[] = - "iip\0" /* Parameter signature */ - "glGetImageTransformParameterfvHP\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_blend) -static const char WeightubvARB_names[] = - "ip\0" /* Parameter signature */ - "glWeightubvARB\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib1fvNV_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib1fvNV\0" - ""; -#endif - -#if defined(need_GL_EXT_convolution) -static const char CopyConvolutionFilter1D_names[] = - "iiiii\0" /* Parameter signature */ - "glCopyConvolutionFilter1D\0" - "glCopyConvolutionFilter1DEXT\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char ReplacementCodeuiNormal3fVertex3fSUN_names[] = - "iffffff\0" /* Parameter signature */ - "glReplacementCodeuiNormal3fVertex3fSUN\0" - ""; -#endif - -#if defined(need_GL_ARB_sync) -static const char DeleteSync_names[] = - "i\0" /* Parameter signature */ - "glDeleteSync\0" - ""; -#endif - -#if defined(need_GL_SGIX_fragment_lighting) -static const char FragmentMaterialfvSGIX_names[] = - "iip\0" /* Parameter signature */ - "glFragmentMaterialfvSGIX\0" - ""; -#endif - -#if defined(need_GL_EXT_blend_color) -static const char BlendColor_names[] = - "ffff\0" /* Parameter signature */ - "glBlendColor\0" - "glBlendColorEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char UniformMatrix4fvARB_names[] = - "iiip\0" /* Parameter signature */ - "glUniformMatrix4fv\0" - "glUniformMatrix4fvARB\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_array_object) || defined(need_GL_APPLE_vertex_array_object) -static const char DeleteVertexArraysAPPLE_names[] = - "ip\0" /* Parameter signature */ - "glDeleteVertexArrays\0" - "glDeleteVertexArraysAPPLE\0" - ""; -#endif - -#if defined(need_GL_SGIX_instruments) -static const char ReadInstrumentsSGIX_names[] = - "i\0" /* Parameter signature */ - "glReadInstrumentsSGIX\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_1) -static const char UniformMatrix2x4fv_names[] = - "iiip\0" /* Parameter signature */ - "glUniformMatrix2x4fv\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char Color4ubVertex3fvSUN_names[] = - "pp\0" /* Parameter signature */ - "glColor4ubVertex3fvSUN\0" - ""; -#endif - -#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_texture_array) -static const char FramebufferTextureLayerEXT_names[] = - "iiiii\0" /* Parameter signature */ - "glFramebufferTextureLayer\0" - "glFramebufferTextureLayerEXT\0" - ""; -#endif - -#if defined(need_GL_SGIX_list_priority) -static const char GetListParameterfvSGIX_names[] = - "iip\0" /* Parameter signature */ - "glGetListParameterfvSGIX\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib4NusvARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib4Nusv\0" - "glVertexAttrib4NusvARB\0" - ""; -#endif - -#if defined(need_GL_MESA_window_pos) -static const char WindowPos4svMESA_names[] = - "p\0" /* Parameter signature */ - "glWindowPos4svMESA\0" - ""; -#endif - -#if defined(need_GL_ARB_shader_objects) -static const char CreateProgramObjectARB_names[] = - "\0" /* Parameter signature */ - "glCreateProgramObjectARB\0" - ""; -#endif - -#if defined(need_GL_SGIX_fragment_lighting) -static const char FragmentLightModelivSGIX_names[] = - "ip\0" /* Parameter signature */ - "glFragmentLightModelivSGIX\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_1) -static const char UniformMatrix4x3fv_names[] = - "iiip\0" /* Parameter signature */ - "glUniformMatrix4x3fv\0" - ""; -#endif - -#if defined(need_GL_EXT_texture_object) -static const char PrioritizeTextures_names[] = - "ipp\0" /* Parameter signature */ - "glPrioritizeTextures\0" - "glPrioritizeTexturesEXT\0" - ""; -#endif - -#if defined(need_GL_SGIX_async) -static const char AsyncMarkerSGIX_names[] = - "i\0" /* Parameter signature */ - "glAsyncMarkerSGIX\0" - ""; -#endif - -#if defined(need_GL_SUN_global_alpha) -static const char GlobalAlphaFactorubSUN_names[] = - "i\0" /* Parameter signature */ - "glGlobalAlphaFactorubSUN\0" - ""; -#endif - -#if defined(need_GL_MESA_shader_debug) -static const char ClearDebugLogMESA_names[] = - "iii\0" /* Parameter signature */ - "glClearDebugLogMESA\0" - ""; -#endif - -#if defined(need_GL_EXT_histogram) -static const char ResetHistogram_names[] = - "i\0" /* Parameter signature */ - "glResetHistogram\0" - "glResetHistogramEXT\0" - ""; -#endif - -#if defined(need_GL_NV_fragment_program) -static const char GetProgramNamedParameterfvNV_names[] = - "iipp\0" /* Parameter signature */ - "glGetProgramNamedParameterfvNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_point_parameters) || defined(need_GL_EXT_point_parameters) || defined(need_GL_SGIS_point_parameters) -static const char PointParameterfEXT_names[] = - "if\0" /* Parameter signature */ - "glPointParameterf\0" - "glPointParameterfARB\0" - "glPointParameterfEXT\0" - "glPointParameterfSGIS\0" - ""; -#endif - -#if defined(need_GL_SGIX_polynomial_ffd) -static const char LoadIdentityDeformationMapSGIX_names[] = - "i\0" /* Parameter signature */ - "glLoadIdentityDeformationMapSGIX\0" - ""; -#endif - -#if defined(need_GL_NV_fence) -static const char GenFencesNV_names[] = - "ip\0" /* Parameter signature */ - "glGenFencesNV\0" - ""; -#endif - -#if defined(need_GL_HP_image_transform) -static const char ImageTransformParameterfHP_names[] = - "iif\0" /* Parameter signature */ - "glImageTransformParameterfHP\0" - ""; -#endif - -#if defined(need_GL_ARB_matrix_palette) -static const char MatrixIndexusvARB_names[] = - "ip\0" /* Parameter signature */ - "glMatrixIndexusvARB\0" - ""; -#endif - -#if defined(need_GL_ARB_draw_elements_base_vertex) -static const char DrawElementsBaseVertex_names[] = - "iiipi\0" /* Parameter signature */ - "glDrawElementsBaseVertex\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char DisableVertexAttribArrayARB_names[] = - "i\0" /* Parameter signature */ - "glDisableVertexAttribArray\0" - "glDisableVertexAttribArrayARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) -static const char StencilMaskSeparate_names[] = - "ii\0" /* Parameter signature */ - "glStencilMaskSeparate\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_program) -static const char ProgramLocalParameter4dARB_names[] = - "iidddd\0" /* Parameter signature */ - "glProgramLocalParameter4dARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression) -static const char CompressedTexImage3DARB_names[] = - "iiiiiiiip\0" /* Parameter signature */ - "glCompressedTexImage3D\0" - "glCompressedTexImage3DARB\0" - ""; -#endif - -#if defined(need_GL_EXT_convolution) -static const char GetConvolutionParameteriv_names[] = - "iip\0" /* Parameter signature */ - "glGetConvolutionParameteriv\0" - "glGetConvolutionParameterivEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib1fARB_names[] = - "if\0" /* Parameter signature */ - "glVertexAttrib1f\0" - "glVertexAttrib1fARB\0" - ""; -#endif - -#if defined(need_GL_NV_fence) -static const char TestFenceNV_names[] = - "i\0" /* Parameter signature */ - "glTestFenceNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord1fvARB_names[] = - "ip\0" /* Parameter signature */ - "glMultiTexCoord1fv\0" - "glMultiTexCoord1fvARB\0" - ""; -#endif - -#if defined(need_GL_ATI_fragment_shader) -static const char ColorFragmentOp2ATI_names[] = - "iiiiiiiiii\0" /* Parameter signature */ - "glColorFragmentOp2ATI\0" - ""; -#endif - -#if defined(need_GL_IBM_vertex_array_lists) -static const char SecondaryColorPointerListIBM_names[] = - "iiipi\0" /* Parameter signature */ - "glSecondaryColorPointerListIBM\0" - ""; -#endif - -#if defined(need_GL_SGIS_pixel_texture) -static const char GetPixelTexGenParameterivSGIS_names[] = - "ip\0" /* Parameter signature */ - "glGetPixelTexGenParameterivSGIS\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib4fNV_names[] = - "iffff\0" /* Parameter signature */ - "glVertexAttrib4fNV\0" - ""; -#endif - -#if defined(need_GL_SUN_triangle_list) -static const char ReplacementCodeubSUN_names[] = - "i\0" /* Parameter signature */ - "glReplacementCodeubSUN\0" - ""; -#endif - -#if defined(need_GL_SGIX_async) -static const char FinishAsyncSGIX_names[] = - "p\0" /* Parameter signature */ - "glFinishAsyncSGIX\0" - ""; -#endif - -#if defined(need_GL_MESA_shader_debug) -static const char GetDebugLogMESA_names[] = - "iiiipp\0" /* Parameter signature */ - "glGetDebugLogMESA\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord) -static const char FogCoorddEXT_names[] = - "d\0" /* Parameter signature */ - "glFogCoordd\0" - "glFogCoorddEXT\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char Color4ubVertex3fSUN_names[] = - "iiiifff\0" /* Parameter signature */ - "glColor4ubVertex3fSUN\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord) -static const char FogCoordfEXT_names[] = - "f\0" /* Parameter signature */ - "glFogCoordf\0" - "glFogCoordfEXT\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char TexCoord2fVertex3fSUN_names[] = - "fffff\0" /* Parameter signature */ - "glTexCoord2fVertex3fSUN\0" - ""; -#endif - -#if defined(need_GL_SUN_global_alpha) -static const char GlobalAlphaFactoriSUN_names[] = - "i\0" /* Parameter signature */ - "glGlobalAlphaFactoriSUN\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib2dNV_names[] = - "idd\0" /* Parameter signature */ - "glVertexAttrib2dNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) -static const char GetProgramInfoLog_names[] = - "iipp\0" /* Parameter signature */ - "glGetProgramInfoLog\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib4NbvARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib4Nbv\0" - "glVertexAttrib4NbvARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_shader) -static const char GetActiveAttribARB_names[] = - "iiipppp\0" /* Parameter signature */ - "glGetActiveAttrib\0" - "glGetActiveAttribARB\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib4ubNV_names[] = - "iiiii\0" /* Parameter signature */ - "glVertexAttrib4ubNV\0" - ""; -#endif - -#if defined(need_GL_APPLE_texture_range) -static const char TextureRangeAPPLE_names[] = - "iip\0" /* Parameter signature */ - "glTextureRangeAPPLE\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char TexCoord2fColor4fNormal3fVertex3fSUN_names[] = - "ffffffffffff\0" /* Parameter signature */ - "glTexCoord2fColor4fNormal3fVertex3fSUN\0" - ""; -#endif - -#if defined(need_GL_NV_register_combiners) -static const char CombinerParameterfvNV_names[] = - "ip\0" /* Parameter signature */ - "glCombinerParameterfvNV\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttribs3dvNV_names[] = - "iip\0" /* Parameter signature */ - "glVertexAttribs3dvNV\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttribs4fvNV_names[] = - "iip\0" /* Parameter signature */ - "glVertexAttribs4fvNV\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_array_range) -static const char VertexArrayRangeNV_names[] = - "ip\0" /* Parameter signature */ - "glVertexArrayRangeNV\0" - ""; -#endif - -#if defined(need_GL_SGIX_fragment_lighting) -static const char FragmentLightiSGIX_names[] = - "iii\0" /* Parameter signature */ - "glFragmentLightiSGIX\0" - ""; -#endif - -#if defined(need_GL_EXT_polygon_offset) -static const char PolygonOffsetEXT_names[] = - "ff\0" /* Parameter signature */ - "glPolygonOffsetEXT\0" - ""; -#endif - -#if defined(need_GL_SGIX_async) -static const char PollAsyncSGIX_names[] = - "p\0" /* Parameter signature */ - "glPollAsyncSGIX\0" - ""; -#endif - -#if defined(need_GL_ATI_fragment_shader) -static const char DeleteFragmentShaderATI_names[] = - "i\0" /* Parameter signature */ - "glDeleteFragmentShaderATI\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char TexCoord2fNormal3fVertex3fvSUN_names[] = - "ppp\0" /* Parameter signature */ - "glTexCoord2fNormal3fVertex3fvSUN\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_transpose_matrix) -static const char MultTransposeMatrixdARB_names[] = - "p\0" /* Parameter signature */ - "glMultTransposeMatrixd\0" - "glMultTransposeMatrixdARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) -static const char WindowPos2svMESA_names[] = - "p\0" /* Parameter signature */ - "glWindowPos2sv\0" - "glWindowPos2svARB\0" - "glWindowPos2svMESA\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression) -static const char CompressedTexImage1DARB_names[] = - "iiiiiip\0" /* Parameter signature */ - "glCompressedTexImage1D\0" - "glCompressedTexImage1DARB\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib2sNV_names[] = - "iii\0" /* Parameter signature */ - "glVertexAttrib2sNV\0" - ""; -#endif - -#if defined(need_GL_IBM_vertex_array_lists) -static const char NormalPointerListIBM_names[] = - "iipi\0" /* Parameter signature */ - "glNormalPointerListIBM\0" - ""; -#endif - -#if defined(need_GL_EXT_vertex_array) -static const char IndexPointerEXT_names[] = - "iiip\0" /* Parameter signature */ - "glIndexPointerEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_vertex_array) -static const char NormalPointerEXT_names[] = - "iiip\0" /* Parameter signature */ - "glNormalPointerEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord3dARB_names[] = - "iddd\0" /* Parameter signature */ - "glMultiTexCoord3d\0" - "glMultiTexCoord3dARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord2iARB_names[] = - "iii\0" /* Parameter signature */ - "glMultiTexCoord2i\0" - "glMultiTexCoord2iARB\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN_names[] = - "iffffffff\0" /* Parameter signature */ - "glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord2svARB_names[] = - "ip\0" /* Parameter signature */ - "glMultiTexCoord2sv\0" - "glMultiTexCoord2svARB\0" - ""; -#endif - -#if defined(need_GL_SUN_triangle_list) -static const char ReplacementCodeubvSUN_names[] = - "p\0" /* Parameter signature */ - "glReplacementCodeubvSUN\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char Uniform3iARB_names[] = - "iiii\0" /* Parameter signature */ - "glUniform3i\0" - "glUniform3iARB\0" - ""; -#endif - -#if defined(need_GL_SGIX_fragment_lighting) -static const char GetFragmentMaterialfvSGIX_names[] = - "iip\0" /* Parameter signature */ - "glGetFragmentMaterialfvSGIX\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) -static const char GetShaderInfoLog_names[] = - "iipp\0" /* Parameter signature */ - "glGetShaderInfoLog\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_blend) -static const char WeightivARB_names[] = - "ip\0" /* Parameter signature */ - "glWeightivARB\0" - ""; -#endif - -#if defined(need_GL_SGIX_instruments) -static const char PollInstrumentsSGIX_names[] = - "p\0" /* Parameter signature */ - "glPollInstrumentsSGIX\0" - ""; -#endif - -#if defined(need_GL_SUN_global_alpha) -static const char GlobalAlphaFactordSUN_names[] = - "d\0" /* Parameter signature */ - "glGlobalAlphaFactordSUN\0" - ""; -#endif - -#if defined(need_GL_NV_register_combiners) -static const char GetFinalCombinerInputParameterfvNV_names[] = - "iip\0" /* Parameter signature */ - "glGetFinalCombinerInputParameterfvNV\0" - ""; -#endif - -#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) -static const char GenerateMipmapEXT_names[] = - "i\0" /* Parameter signature */ - "glGenerateMipmap\0" - "glGenerateMipmapEXT\0" - ""; -#endif - -#if defined(need_GL_ATI_fragment_shader) -static const char SetFragmentShaderConstantATI_names[] = - "ip\0" /* Parameter signature */ - "glSetFragmentShaderConstantATI\0" - ""; -#endif - -#if defined(need_GL_NV_evaluators) -static const char GetMapAttribParameterivNV_names[] = - "iiip\0" /* Parameter signature */ - "glGetMapAttribParameterivNV\0" - ""; -#endif - -#if defined(need_GL_ARB_shader_objects) -static const char CreateShaderObjectARB_names[] = - "i\0" /* Parameter signature */ - "glCreateShaderObjectARB\0" - ""; -#endif - -#if defined(need_GL_SGIS_sharpen_texture) -static const char GetSharpenTexFuncSGIS_names[] = - "ip\0" /* Parameter signature */ - "glGetSharpenTexFuncSGIS\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) -static const char BufferDataARB_names[] = - "iipi\0" /* Parameter signature */ - "glBufferData\0" - "glBufferDataARB\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_array_range) -static const char FlushVertexArrayRangeNV_names[] = - "\0" /* Parameter signature */ - "glFlushVertexArrayRangeNV\0" - ""; -#endif - -#if defined(need_GL_ATI_fragment_shader) -static const char SampleMapATI_names[] = - "iii\0" /* Parameter signature */ - "glSampleMapATI\0" - ""; -#endif - -#if defined(need_GL_EXT_vertex_array) -static const char VertexPointerEXT_names[] = - "iiiip\0" /* Parameter signature */ - "glVertexPointerEXT\0" - ""; -#endif - -#if defined(need_GL_SGIS_texture_filter4) -static const char GetTexFilterFuncSGIS_names[] = - "iip\0" /* Parameter signature */ - "glGetTexFilterFuncSGIS\0" - ""; -#endif - -#if defined(need_GL_NV_register_combiners) -static const char GetCombinerOutputParameterfvNV_names[] = - "iiip\0" /* Parameter signature */ - "glGetCombinerOutputParameterfvNV\0" - ""; -#endif - -#if defined(need_GL_EXT_subtexture) -static const char TexSubImage1D_names[] = - "iiiiiip\0" /* Parameter signature */ - "glTexSubImage1D\0" - "glTexSubImage1DEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib1sARB_names[] = - "ii\0" /* Parameter signature */ - "glVertexAttrib1s\0" - "glVertexAttrib1sARB\0" - ""; -#endif - -#if defined(need_GL_ARB_sync) -static const char FenceSync_names[] = - "ii\0" /* Parameter signature */ - "glFenceSync\0" - ""; -#endif - -#if defined(need_GL_NV_register_combiners) -static const char FinalCombinerInputNV_names[] = - "iiii\0" /* Parameter signature */ - "glFinalCombinerInputNV\0" - ""; -#endif - -#if defined(need_GL_SGIX_flush_raster) -static const char FlushRasterSGIX_names[] = - "\0" /* Parameter signature */ - "glFlushRasterSGIX\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char ReplacementCodeuiTexCoord2fVertex3fSUN_names[] = - "ifffff\0" /* Parameter signature */ - "glReplacementCodeuiTexCoord2fVertex3fSUN\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char Uniform1fARB_names[] = - "if\0" /* Parameter signature */ - "glUniform1f\0" - "glUniform1fARB\0" - ""; -#endif - -#if defined(need_GL_EXT_texture_object) -static const char AreTexturesResident_names[] = - "ipp\0" /* Parameter signature */ - "glAreTexturesResident\0" - "glAreTexturesResidentEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ATI_separate_stencil) -static const char StencilOpSeparate_names[] = - "iiii\0" /* Parameter signature */ - "glStencilOpSeparate\0" - "glStencilOpSeparateATI\0" - ""; -#endif - -#if defined(need_GL_SGI_color_table) -static const char ColorTableParameteriv_names[] = - "iip\0" /* Parameter signature */ - "glColorTableParameteriv\0" - "glColorTableParameterivSGI\0" - ""; -#endif - -#if defined(need_GL_IBM_vertex_array_lists) -static const char FogCoordPointerListIBM_names[] = - "iipi\0" /* Parameter signature */ - "glFogCoordPointerListIBM\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) -static const char WindowPos3dMESA_names[] = - "ddd\0" /* Parameter signature */ - "glWindowPos3d\0" - "glWindowPos3dARB\0" - "glWindowPos3dMESA\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_point_parameters) || defined(need_GL_EXT_point_parameters) || defined(need_GL_SGIS_point_parameters) -static const char PointParameterfvEXT_names[] = - "ip\0" /* Parameter signature */ - "glPointParameterfv\0" - "glPointParameterfvARB\0" - "glPointParameterfvEXT\0" - "glPointParameterfvSGIS\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) -static const char WindowPos2fvMESA_names[] = - "p\0" /* Parameter signature */ - "glWindowPos2fv\0" - "glWindowPos2fvARB\0" - "glWindowPos2fvMESA\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) -static const char SecondaryColor3bvEXT_names[] = - "p\0" /* Parameter signature */ - "glSecondaryColor3bv\0" - "glSecondaryColor3bvEXT\0" - ""; -#endif - -#if defined(need_GL_IBM_vertex_array_lists) -static const char VertexPointerListIBM_names[] = - "iiipi\0" /* Parameter signature */ - "glVertexPointerListIBM\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_program) -static const char GetProgramLocalParameterfvARB_names[] = - "iip\0" /* Parameter signature */ - "glGetProgramLocalParameterfvARB\0" - ""; -#endif - -#if defined(need_GL_SGIX_fragment_lighting) -static const char FragmentMaterialfSGIX_names[] = - "iif\0" /* Parameter signature */ - "glFragmentMaterialfSGIX\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char TexCoord2fNormal3fVertex3fSUN_names[] = - "ffffffff\0" /* Parameter signature */ - "glTexCoord2fNormal3fVertex3fSUN\0" - ""; -#endif - -#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) -static const char RenderbufferStorageEXT_names[] = - "iiii\0" /* Parameter signature */ - "glRenderbufferStorage\0" - "glRenderbufferStorageEXT\0" - ""; -#endif - -#if defined(need_GL_NV_fence) -static const char IsFenceNV_names[] = - "i\0" /* Parameter signature */ - "glIsFenceNV\0" - ""; -#endif - -#if defined(need_GL_ARB_shader_objects) -static const char AttachObjectARB_names[] = - "ii\0" /* Parameter signature */ - "glAttachObjectARB\0" - ""; -#endif - -#if defined(need_GL_SGIX_fragment_lighting) -static const char GetFragmentLightivSGIX_names[] = - "iip\0" /* Parameter signature */ - "glGetFragmentLightivSGIX\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char UniformMatrix2fvARB_names[] = - "iiip\0" /* Parameter signature */ - "glUniformMatrix2fv\0" - "glUniformMatrix2fvARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord2fARB_names[] = - "iff\0" /* Parameter signature */ - "glMultiTexCoord2f\0" - "glMultiTexCoord2fARB\0" - ""; -#endif - -#if defined(need_GL_SGI_color_table) || defined(need_GL_EXT_paletted_texture) -static const char ColorTable_names[] = - "iiiiip\0" /* Parameter signature */ - "glColorTable\0" - "glColorTableSGI\0" - "glColorTableEXT\0" - ""; -#endif - -#if defined(need_GL_NV_evaluators) -static const char MapControlPointsNV_names[] = - "iiiiiiiip\0" /* Parameter signature */ - "glMapControlPointsNV\0" - ""; -#endif - -#if defined(need_GL_EXT_convolution) -static const char ConvolutionFilter2D_names[] = - "iiiiiip\0" /* Parameter signature */ - "glConvolutionFilter2D\0" - "glConvolutionFilter2DEXT\0" - ""; -#endif - -#if defined(need_GL_NV_evaluators) -static const char MapParameterfvNV_names[] = - "iip\0" /* Parameter signature */ - "glMapParameterfvNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib3dvARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib3dv\0" - "glVertexAttrib3dvARB\0" - ""; -#endif - -#if defined(need_GL_PGI_misc_hints) -static const char HintPGI_names[] = - "ii\0" /* Parameter signature */ - "glHintPGI\0" - ""; -#endif - -#if defined(need_GL_EXT_convolution) -static const char ConvolutionParameteriv_names[] = - "iip\0" /* Parameter signature */ - "glConvolutionParameteriv\0" - "glConvolutionParameterivEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_cull_vertex) -static const char CullParameterdvEXT_names[] = - "ip\0" /* Parameter signature */ - "glCullParameterdvEXT\0" - ""; -#endif - -#if defined(need_GL_NV_fragment_program) -static const char ProgramNamedParameter4fNV_names[] = - "iipffff\0" /* Parameter signature */ - "glProgramNamedParameter4fNV\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char Color3fVertex3fSUN_names[] = - "ffffff\0" /* Parameter signature */ - "glColor3fVertex3fSUN\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) -static const char ProgramEnvParameter4fvARB_names[] = - "iip\0" /* Parameter signature */ - "glProgramEnvParameter4fvARB\0" - "glProgramParameter4fvNV\0" - ""; -#endif - -#if defined(need_GL_SGIX_fragment_lighting) -static const char FragmentLightModeliSGIX_names[] = - "ii\0" /* Parameter signature */ - "glFragmentLightModeliSGIX\0" - ""; -#endif - -#if defined(need_GL_EXT_convolution) -static const char ConvolutionParameterfv_names[] = - "iip\0" /* Parameter signature */ - "glConvolutionParameterfv\0" - "glConvolutionParameterfvEXT\0" - ""; -#endif - -#if defined(need_GL_3DFX_tbuffer) -static const char TbufferMask3DFX_names[] = - "i\0" /* Parameter signature */ - "glTbufferMask3DFX\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char LoadProgramNV_names[] = - "iiip\0" /* Parameter signature */ - "glLoadProgramNV\0" - ""; -#endif - -#if defined(need_GL_ARB_sync) -static const char WaitSync_names[] = - "iii\0" /* Parameter signature */ - "glWaitSync\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib4fvNV_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib4fvNV\0" - ""; -#endif - -#if defined(need_GL_ARB_shader_objects) -static const char GetAttachedObjectsARB_names[] = - "iipp\0" /* Parameter signature */ - "glGetAttachedObjectsARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char Uniform3fvARB_names[] = - "iip\0" /* Parameter signature */ - "glUniform3fv\0" - "glUniform3fvARB\0" - ""; -#endif - -#if defined(need_GL_EXT_draw_range_elements) -static const char DrawRangeElements_names[] = - "iiiiip\0" /* Parameter signature */ - "glDrawRangeElements\0" - "glDrawRangeElementsEXT\0" - ""; -#endif - -#if defined(need_GL_SGIX_sprite) -static const char SpriteParameterfvSGIX_names[] = - "ip\0" /* Parameter signature */ - "glSpriteParameterfvSGIX\0" - ""; -#endif - -#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) -static const char CheckFramebufferStatusEXT_names[] = - "i\0" /* Parameter signature */ - "glCheckFramebufferStatus\0" - "glCheckFramebufferStatusEXT\0" - ""; -#endif - -#if defined(need_GL_SUN_global_alpha) -static const char GlobalAlphaFactoruiSUN_names[] = - "i\0" /* Parameter signature */ - "glGlobalAlphaFactoruiSUN\0" - ""; -#endif - -#if defined(need_GL_ARB_shader_objects) -static const char GetHandleARB_names[] = - "i\0" /* Parameter signature */ - "glGetHandleARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char GetVertexAttribivARB_names[] = - "iip\0" /* Parameter signature */ - "glGetVertexAttribiv\0" - "glGetVertexAttribivARB\0" - ""; -#endif - -#if defined(need_GL_NV_register_combiners) -static const char GetCombinerInputParameterfvNV_names[] = - "iiiip\0" /* Parameter signature */ - "glGetCombinerInputParameterfvNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) -static const char CreateProgram_names[] = - "\0" /* Parameter signature */ - "glCreateProgram\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_transpose_matrix) -static const char LoadTransposeMatrixdARB_names[] = - "p\0" /* Parameter signature */ - "glLoadTransposeMatrixd\0" - "glLoadTransposeMatrixdARB\0" - ""; -#endif - -#if defined(need_GL_EXT_histogram) -static const char GetMinmax_names[] = - "iiiip\0" /* Parameter signature */ - "glGetMinmax\0" - "glGetMinmaxEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) -static const char StencilFuncSeparate_names[] = - "iiii\0" /* Parameter signature */ - "glStencilFuncSeparate\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) -static const char SecondaryColor3sEXT_names[] = - "iii\0" /* Parameter signature */ - "glSecondaryColor3s\0" - "glSecondaryColor3sEXT\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char Color3fVertex3fvSUN_names[] = - "pp\0" /* Parameter signature */ - "glColor3fVertex3fvSUN\0" - ""; -#endif - -#if defined(need_GL_SUN_global_alpha) -static const char GlobalAlphaFactorbSUN_names[] = - "i\0" /* Parameter signature */ - "glGlobalAlphaFactorbSUN\0" - ""; -#endif - -#if defined(need_GL_HP_image_transform) -static const char ImageTransformParameterfvHP_names[] = - "iip\0" /* Parameter signature */ - "glImageTransformParameterfvHP\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib4ivARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib4iv\0" - "glVertexAttrib4ivARB\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib3fNV_names[] = - "ifff\0" /* Parameter signature */ - "glVertexAttrib3fNV\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttribs2dvNV_names[] = - "iip\0" /* Parameter signature */ - "glVertexAttribs2dvNV\0" - ""; -#endif - -#if defined(need_GL_EXT_timer_query) -static const char GetQueryObjectui64vEXT_names[] = - "iip\0" /* Parameter signature */ - "glGetQueryObjectui64vEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord3fvARB_names[] = - "ip\0" /* Parameter signature */ - "glMultiTexCoord3fv\0" - "glMultiTexCoord3fvARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) -static const char SecondaryColor3dEXT_names[] = - "ddd\0" /* Parameter signature */ - "glSecondaryColor3d\0" - "glSecondaryColor3dEXT\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char GetProgramParameterfvNV_names[] = - "iiip\0" /* Parameter signature */ - "glGetProgramParameterfvNV\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char TangentPointerEXT_names[] = - "iip\0" /* Parameter signature */ - "glTangentPointerEXT\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char Color4fNormal3fVertex3fvSUN_names[] = - "ppp\0" /* Parameter signature */ - "glColor4fNormal3fVertex3fvSUN\0" - ""; -#endif - -#if defined(need_GL_SGIX_instruments) -static const char GetInstrumentsSGIX_names[] = - "\0" /* Parameter signature */ - "glGetInstrumentsSGIX\0" - ""; -#endif - -#if defined(need_GL_NV_evaluators) -static const char EvalMapsNV_names[] = - "ii\0" /* Parameter signature */ - "glEvalMapsNV\0" - ""; -#endif - -#if defined(need_GL_EXT_subtexture) -static const char TexSubImage2D_names[] = - "iiiiiiiip\0" /* Parameter signature */ - "glTexSubImage2D\0" - "glTexSubImage2DEXT\0" - ""; -#endif - -#if defined(need_GL_SGIX_fragment_lighting) -static const char FragmentLightivSGIX_names[] = - "iip\0" /* Parameter signature */ - "glFragmentLightivSGIX\0" - ""; -#endif - -#if defined(need_GL_APPLE_texture_range) -static const char GetTexParameterPointervAPPLE_names[] = - "iip\0" /* Parameter signature */ - "glGetTexParameterPointervAPPLE\0" - ""; -#endif - -#if defined(need_GL_EXT_pixel_transform) -static const char PixelTransformParameterfvEXT_names[] = - "iip\0" /* Parameter signature */ - "glPixelTransformParameterfvEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib4bvARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib4bv\0" - "glVertexAttrib4bvARB\0" - ""; -#endif - -#if defined(need_GL_ATI_fragment_shader) -static const char AlphaFragmentOp2ATI_names[] = - "iiiiiiiii\0" /* Parameter signature */ - "glAlphaFragmentOp2ATI\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord4sARB_names[] = - "iiiii\0" /* Parameter signature */ - "glMultiTexCoord4s\0" - "glMultiTexCoord4sARB\0" - ""; -#endif - -#if defined(need_GL_SGIX_fragment_lighting) -static const char GetFragmentMaterialivSGIX_names[] = - "iip\0" /* Parameter signature */ - "glGetFragmentMaterialivSGIX\0" - ""; -#endif - -#if defined(need_GL_MESA_window_pos) -static const char WindowPos4dMESA_names[] = - "dddd\0" /* Parameter signature */ - "glWindowPos4dMESA\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_blend) -static const char WeightPointerARB_names[] = - "iiip\0" /* Parameter signature */ - "glWeightPointerARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) -static const char WindowPos2dMESA_names[] = - "dd\0" /* Parameter signature */ - "glWindowPos2d\0" - "glWindowPos2dARB\0" - "glWindowPos2dMESA\0" - ""; -#endif - -#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) -static const char FramebufferTexture3DEXT_names[] = - "iiiiii\0" /* Parameter signature */ - "glFramebufferTexture3D\0" - "glFramebufferTexture3DEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_blend_minmax) -static const char BlendEquation_names[] = - "i\0" /* Parameter signature */ - "glBlendEquation\0" - "glBlendEquationEXT\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib3dNV_names[] = - "iddd\0" /* Parameter signature */ - "glVertexAttrib3dNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib3dARB_names[] = - "iddd\0" /* Parameter signature */ - "glVertexAttrib3d\0" - "glVertexAttrib3dARB\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN_names[] = - "ppppp\0" /* Parameter signature */ - "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib4fARB_names[] = - "iffff\0" /* Parameter signature */ - "glVertexAttrib4f\0" - "glVertexAttrib4fARB\0" - ""; -#endif - -#if defined(need_GL_EXT_index_func) -static const char IndexFuncEXT_names[] = - "if\0" /* Parameter signature */ - "glIndexFuncEXT\0" - ""; -#endif - -#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) -static const char FramebufferTexture2DEXT_names[] = - "iiiii\0" /* Parameter signature */ - "glFramebufferTexture2D\0" - "glFramebufferTexture2DEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord2dvARB_names[] = - "ip\0" /* Parameter signature */ - "glMultiTexCoord2dv\0" - "glMultiTexCoord2dvARB\0" - ""; -#endif - -#if defined(need_GL_EXT_cull_vertex) -static const char CullParameterfvEXT_names[] = - "ip\0" /* Parameter signature */ - "glCullParameterfvEXT\0" - ""; -#endif - -#if defined(need_GL_NV_fragment_program) -static const char ProgramNamedParameter4fvNV_names[] = - "iipp\0" /* Parameter signature */ - "glProgramNamedParameter4fvNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) -static const char SecondaryColorPointerEXT_names[] = - "iiip\0" /* Parameter signature */ - "glSecondaryColorPointer\0" - "glSecondaryColorPointerEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib4fvARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib4fv\0" - "glVertexAttrib4fvARB\0" - ""; -#endif - -#if defined(need_GL_IBM_vertex_array_lists) -static const char ColorPointerListIBM_names[] = - "iiipi\0" /* Parameter signature */ - "glColorPointerListIBM\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char GetActiveUniformARB_names[] = - "iiipppp\0" /* Parameter signature */ - "glGetActiveUniform\0" - "glGetActiveUniformARB\0" - ""; -#endif - -#if defined(need_GL_HP_image_transform) -static const char ImageTransformParameteriHP_names[] = - "iii\0" /* Parameter signature */ - "glImageTransformParameteriHP\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord1svARB_names[] = - "ip\0" /* Parameter signature */ - "glMultiTexCoord1sv\0" - "glMultiTexCoord1svARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) -static const char EndQueryARB_names[] = - "i\0" /* Parameter signature */ - "glEndQuery\0" - "glEndQueryARB\0" - ""; -#endif - -#if defined(need_GL_NV_fence) -static const char DeleteFencesNV_names[] = - "ip\0" /* Parameter signature */ - "glDeleteFencesNV\0" - ""; -#endif - -#if defined(need_GL_SGIX_polynomial_ffd) -static const char DeformationMap3dSGIX_names[] = - "iddiiddiiddiip\0" /* Parameter signature */ - "glDeformationMap3dSGIX\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) -static const char IsShader_names[] = - "i\0" /* Parameter signature */ - "glIsShader\0" - ""; -#endif - -#if defined(need_GL_HP_image_transform) -static const char GetImageTransformParameterivHP_names[] = - "iip\0" /* Parameter signature */ - "glGetImageTransformParameterivHP\0" - ""; -#endif - -#if defined(need_GL_MESA_window_pos) -static const char WindowPos4ivMESA_names[] = - "p\0" /* Parameter signature */ - "glWindowPos4ivMESA\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord3svARB_names[] = - "ip\0" /* Parameter signature */ - "glMultiTexCoord3sv\0" - "glMultiTexCoord3svARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord4iARB_names[] = - "iiiii\0" /* Parameter signature */ - "glMultiTexCoord4i\0" - "glMultiTexCoord4iARB\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char Binormal3ivEXT_names[] = - "p\0" /* Parameter signature */ - "glBinormal3ivEXT\0" - ""; -#endif - -#if defined(need_GL_MESA_resize_buffers) -static const char ResizeBuffersMESA_names[] = - "\0" /* Parameter signature */ - "glResizeBuffersMESA\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char GetUniformivARB_names[] = - "iip\0" /* Parameter signature */ - "glGetUniformiv\0" - "glGetUniformivARB\0" - ""; -#endif - -#if defined(need_GL_SGIS_pixel_texture) -static const char PixelTexGenParameteriSGIS_names[] = - "ii\0" /* Parameter signature */ - "glPixelTexGenParameteriSGIS\0" - ""; -#endif - -#if defined(need_GL_INTEL_parallel_arrays) -static const char VertexPointervINTEL_names[] = - "iip\0" /* Parameter signature */ - "glVertexPointervINTEL\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char ReplacementCodeuiColor4fNormal3fVertex3fvSUN_names[] = - "pppp\0" /* Parameter signature */ - "glReplacementCodeuiColor4fNormal3fVertex3fvSUN\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) -static const char SecondaryColor3uiEXT_names[] = - "iii\0" /* Parameter signature */ - "glSecondaryColor3ui\0" - "glSecondaryColor3uiEXT\0" - ""; -#endif - -#if defined(need_GL_SGIX_instruments) -static const char StartInstrumentsSGIX_names[] = - "\0" /* Parameter signature */ - "glStartInstrumentsSGIX\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) -static const char SecondaryColor3usvEXT_names[] = - "p\0" /* Parameter signature */ - "glSecondaryColor3usv\0" - "glSecondaryColor3usvEXT\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib2fvNV_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib2fvNV\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_program) -static const char ProgramLocalParameter4dvARB_names[] = - "iip\0" /* Parameter signature */ - "glProgramLocalParameter4dvARB\0" - ""; -#endif - -#if defined(need_GL_ARB_matrix_palette) -static const char MatrixIndexuivARB_names[] = - "ip\0" /* Parameter signature */ - "glMatrixIndexuivARB\0" - ""; -#endif - -#if defined(need_GL_ARB_framebuffer_object) -static const char RenderbufferStorageMultisample_names[] = - "iiiii\0" /* Parameter signature */ - "glRenderbufferStorageMultisample\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char Tangent3sEXT_names[] = - "iii\0" /* Parameter signature */ - "glTangent3sEXT\0" - ""; -#endif - -#if defined(need_GL_SUN_global_alpha) -static const char GlobalAlphaFactorfSUN_names[] = - "f\0" /* Parameter signature */ - "glGlobalAlphaFactorfSUN\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord3iARB_names[] = - "iiii\0" /* Parameter signature */ - "glMultiTexCoord3i\0" - "glMultiTexCoord3iARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) -static const char IsProgram_names[] = - "i\0" /* Parameter signature */ - "glIsProgram\0" - ""; -#endif - -#if defined(need_GL_IBM_vertex_array_lists) -static const char TexCoordPointerListIBM_names[] = - "iiipi\0" /* Parameter signature */ - "glTexCoordPointerListIBM\0" - ""; -#endif - -#if defined(need_GL_SUN_global_alpha) -static const char GlobalAlphaFactorusSUN_names[] = - "i\0" /* Parameter signature */ - "glGlobalAlphaFactorusSUN\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib2dvNV_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib2dvNV\0" - ""; -#endif - -#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) -static const char FramebufferRenderbufferEXT_names[] = - "iiii\0" /* Parameter signature */ - "glFramebufferRenderbuffer\0" - "glFramebufferRenderbufferEXT\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib1dvNV_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib1dvNV\0" - ""; -#endif - -#if defined(need_GL_EXT_texture_object) -static const char GenTextures_names[] = - "ip\0" /* Parameter signature */ - "glGenTextures\0" - "glGenTexturesEXT\0" - ""; -#endif - -#if defined(need_GL_NV_fence) -static const char SetFenceNV_names[] = - "ii\0" /* Parameter signature */ - "glSetFenceNV\0" - ""; -#endif - -#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) -static const char FramebufferTexture1DEXT_names[] = - "iiiii\0" /* Parameter signature */ - "glFramebufferTexture1D\0" - "glFramebufferTexture1DEXT\0" - ""; -#endif - -#if defined(need_GL_NV_register_combiners) -static const char GetCombinerOutputParameterivNV_names[] = - "iiip\0" /* Parameter signature */ - "glGetCombinerOutputParameterivNV\0" - ""; -#endif - -#if defined(need_GL_SGIS_pixel_texture) -static const char PixelTexGenParameterivSGIS_names[] = - "ip\0" /* Parameter signature */ - "glPixelTexGenParameterivSGIS\0" - ""; -#endif - -#if defined(need_GL_EXT_texture_perturb_normal) -static const char TextureNormalEXT_names[] = - "i\0" /* Parameter signature */ - "glTextureNormalEXT\0" - ""; -#endif - -#if defined(need_GL_IBM_vertex_array_lists) -static const char IndexPointerListIBM_names[] = - "iipi\0" /* Parameter signature */ - "glIndexPointerListIBM\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_blend) -static const char WeightfvARB_names[] = - "ip\0" /* Parameter signature */ - "glWeightfvARB\0" - ""; -#endif - -#if defined(need_GL_MESA_window_pos) -static const char WindowPos4fMESA_names[] = - "ffff\0" /* Parameter signature */ - "glWindowPos4fMESA\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) -static const char WindowPos3dvMESA_names[] = - "p\0" /* Parameter signature */ - "glWindowPos3dv\0" - "glWindowPos3dvARB\0" - "glWindowPos3dvMESA\0" - ""; -#endif - -#if defined(need_GL_EXT_timer_query) -static const char GetQueryObjecti64vEXT_names[] = - "iip\0" /* Parameter signature */ - "glGetQueryObjecti64vEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord1dARB_names[] = - "id\0" /* Parameter signature */ - "glMultiTexCoord1d\0" - "glMultiTexCoord1dARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_NV_point_sprite) -static const char PointParameterivNV_names[] = - "ip\0" /* Parameter signature */ - "glPointParameteriv\0" - "glPointParameterivNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char Uniform2fvARB_names[] = - "iip\0" /* Parameter signature */ - "glUniform2fv\0" - "glUniform2fvARB\0" - ""; -#endif - -#if defined(need_GL_APPLE_flush_buffer_range) -static const char BufferParameteriAPPLE_names[] = - "iii\0" /* Parameter signature */ - "glBufferParameteriAPPLE\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord3dvARB_names[] = - "ip\0" /* Parameter signature */ - "glMultiTexCoord3dv\0" - "glMultiTexCoord3dvARB\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN_names[] = - "pppp\0" /* Parameter signature */ - "glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN\0" - ""; -#endif - -#if defined(need_GL_ARB_shader_objects) -static const char DeleteObjectARB_names[] = - "i\0" /* Parameter signature */ - "glDeleteObjectARB\0" - ""; -#endif - -#if defined(need_GL_ARB_matrix_palette) -static const char MatrixIndexPointerARB_names[] = - "iiip\0" /* Parameter signature */ - "glMatrixIndexPointerARB\0" - ""; -#endif - -#if defined(need_GL_NV_fragment_program) -static const char ProgramNamedParameter4dvNV_names[] = - "iipp\0" /* Parameter signature */ - "glProgramNamedParameter4dvNV\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char Tangent3fvEXT_names[] = - "p\0" /* Parameter signature */ - "glTangent3fvEXT\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_array_object) -static const char GenVertexArrays_names[] = - "ip\0" /* Parameter signature */ - "glGenVertexArrays\0" - ""; -#endif - -#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) -static const char BindFramebufferEXT_names[] = - "ii\0" /* Parameter signature */ - "glBindFramebuffer\0" - "glBindFramebufferEXT\0" - ""; -#endif - -#if defined(need_GL_SGIX_reference_plane) -static const char ReferencePlaneSGIX_names[] = - "p\0" /* Parameter signature */ - "glReferencePlaneSGIX\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char ValidateProgramARB_names[] = - "i\0" /* Parameter signature */ - "glValidateProgram\0" - "glValidateProgramARB\0" - ""; -#endif - -#if defined(need_GL_EXT_compiled_vertex_array) -static const char UnlockArraysEXT_names[] = - "\0" /* Parameter signature */ - "glUnlockArraysEXT\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char TexCoord2fColor3fVertex3fSUN_names[] = - "ffffffff\0" /* Parameter signature */ - "glTexCoord2fColor3fVertex3fSUN\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) -static const char WindowPos3fvMESA_names[] = - "p\0" /* Parameter signature */ - "glWindowPos3fv\0" - "glWindowPos3fvARB\0" - "glWindowPos3fvMESA\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib1svNV_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib1svNV\0" - ""; -#endif - -#if defined(need_GL_EXT_copy_texture) -static const char CopyTexSubImage3D_names[] = - "iiiiiiiii\0" /* Parameter signature */ - "glCopyTexSubImage3D\0" - "glCopyTexSubImage3DEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib2dARB_names[] = - "idd\0" /* Parameter signature */ - "glVertexAttrib2d\0" - "glVertexAttrib2dARB\0" - ""; -#endif - -#if defined(need_GL_ARB_sync) -static const char GetInteger64v_names[] = - "ip\0" /* Parameter signature */ - "glGetInteger64v\0" - ""; -#endif - -#if defined(need_GL_SGIS_texture_color_mask) -static const char TextureColorMaskSGIS_names[] = - "iiii\0" /* Parameter signature */ - "glTextureColorMaskSGIS\0" - ""; -#endif - -#if defined(need_GL_SGI_color_table) || defined(need_GL_EXT_paletted_texture) -static const char GetColorTable_names[] = - "iiip\0" /* Parameter signature */ - "glGetColorTable\0" - "glGetColorTableSGI\0" - "glGetColorTableEXT\0" - ""; -#endif - -#if defined(need_GL_SGI_color_table) -static const char CopyColorTable_names[] = - "iiiii\0" /* Parameter signature */ - "glCopyColorTable\0" - "glCopyColorTableSGI\0" - ""; -#endif - -#if defined(need_GL_EXT_histogram) -static const char GetHistogramParameterfv_names[] = - "iip\0" /* Parameter signature */ - "glGetHistogramParameterfv\0" - "glGetHistogramParameterfvEXT\0" - ""; -#endif - -#if defined(need_GL_INTEL_parallel_arrays) -static const char ColorPointervINTEL_names[] = - "iip\0" /* Parameter signature */ - "glColorPointervINTEL\0" - ""; -#endif - -#if defined(need_GL_ATI_fragment_shader) -static const char AlphaFragmentOp1ATI_names[] = - "iiiiii\0" /* Parameter signature */ - "glAlphaFragmentOp1ATI\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord3ivARB_names[] = - "ip\0" /* Parameter signature */ - "glMultiTexCoord3iv\0" - "glMultiTexCoord3ivARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord2sARB_names[] = - "iii\0" /* Parameter signature */ - "glMultiTexCoord2s\0" - "glMultiTexCoord2sARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib1dvARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib1dv\0" - "glVertexAttrib1dvARB\0" - ""; -#endif - -#if defined(need_GL_EXT_texture_object) -static const char DeleteTextures_names[] = - "ip\0" /* Parameter signature */ - "glDeleteTextures\0" - "glDeleteTexturesEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_vertex_array) -static const char TexCoordPointerEXT_names[] = - "iiiip\0" /* Parameter signature */ - "glTexCoordPointerEXT\0" - ""; -#endif - -#if defined(need_GL_SGIS_texture4D) -static const char TexSubImage4DSGIS_names[] = - "iiiiiiiiiiiip\0" /* Parameter signature */ - "glTexSubImage4DSGIS\0" - ""; -#endif - -#if defined(need_GL_NV_register_combiners2) -static const char CombinerStageParameterfvNV_names[] = - "iip\0" /* Parameter signature */ - "glCombinerStageParameterfvNV\0" - ""; -#endif - -#if defined(need_GL_SGIX_instruments) -static const char StopInstrumentsSGIX_names[] = - "i\0" /* Parameter signature */ - "glStopInstrumentsSGIX\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char TexCoord4fColor4fNormal3fVertex4fSUN_names[] = - "fffffffffffffff\0" /* Parameter signature */ - "glTexCoord4fColor4fNormal3fVertex4fSUN\0" - ""; -#endif - -#if defined(need_GL_SGIX_polynomial_ffd) -static const char DeformSGIX_names[] = - "i\0" /* Parameter signature */ - "glDeformSGIX\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char GetVertexAttribfvARB_names[] = - "iip\0" /* Parameter signature */ - "glGetVertexAttribfv\0" - "glGetVertexAttribfvARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) -static const char SecondaryColor3ivEXT_names[] = - "p\0" /* Parameter signature */ - "glSecondaryColor3iv\0" - "glSecondaryColor3ivEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_1) -static const char UniformMatrix4x2fv_names[] = - "iiip\0" /* Parameter signature */ - "glUniformMatrix4x2fv\0" - ""; -#endif - -#if defined(need_GL_SGIS_detail_texture) -static const char GetDetailTexFuncSGIS_names[] = - "ip\0" /* Parameter signature */ - "glGetDetailTexFuncSGIS\0" - ""; -#endif - -#if defined(need_GL_NV_register_combiners2) -static const char GetCombinerStageParameterfvNV_names[] = - "iip\0" /* Parameter signature */ - "glGetCombinerStageParameterfvNV\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_array_object) -static const char BindVertexArray_names[] = - "i\0" /* Parameter signature */ - "glBindVertexArray\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char Color4ubVertex2fvSUN_names[] = - "pp\0" /* Parameter signature */ - "glColor4ubVertex2fvSUN\0" - ""; -#endif - -#if defined(need_GL_SGIS_texture_filter4) -static const char TexFilterFuncSGIS_names[] = - "iiip\0" /* Parameter signature */ - "glTexFilterFuncSGIS\0" - ""; -#endif - -#if defined(need_GL_SGIS_multisample) || defined(need_GL_EXT_multisample) -static const char SampleMaskSGIS_names[] = - "fi\0" /* Parameter signature */ - "glSampleMaskSGIS\0" - "glSampleMaskEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_shader) -static const char GetAttribLocationARB_names[] = - "ip\0" /* Parameter signature */ - "glGetAttribLocation\0" - "glGetAttribLocationARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib4ubvARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib4ubv\0" - "glVertexAttrib4ubvARB\0" - ""; -#endif - -#if defined(need_GL_SGIS_detail_texture) -static const char DetailTexFuncSGIS_names[] = - "iip\0" /* Parameter signature */ - "glDetailTexFuncSGIS\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char Normal3fVertex3fSUN_names[] = - "ffffff\0" /* Parameter signature */ - "glNormal3fVertex3fSUN\0" - ""; -#endif - -#if defined(need_GL_EXT_copy_texture) -static const char CopyTexImage2D_names[] = - "iiiiiiii\0" /* Parameter signature */ - "glCopyTexImage2D\0" - "glCopyTexImage2DEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) -static const char GetBufferPointervARB_names[] = - "iip\0" /* Parameter signature */ - "glGetBufferPointerv\0" - "glGetBufferPointervARB\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) -static const char ProgramEnvParameter4fARB_names[] = - "iiffff\0" /* Parameter signature */ - "glProgramEnvParameter4fARB\0" - "glProgramParameter4fNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char Uniform3ivARB_names[] = - "iip\0" /* Parameter signature */ - "glUniform3iv\0" - "glUniform3ivARB\0" - ""; -#endif - -#if defined(need_GL_NV_fence) -static const char GetFenceivNV_names[] = - "iip\0" /* Parameter signature */ - "glGetFenceivNV\0" - ""; -#endif - -#if defined(need_GL_MESA_window_pos) -static const char WindowPos4dvMESA_names[] = - "p\0" /* Parameter signature */ - "glWindowPos4dvMESA\0" - ""; -#endif - -#if defined(need_GL_EXT_color_subtable) -static const char ColorSubTable_names[] = - "iiiiip\0" /* Parameter signature */ - "glColorSubTable\0" - "glColorSubTableEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord4ivARB_names[] = - "ip\0" /* Parameter signature */ - "glMultiTexCoord4iv\0" - "glMultiTexCoord4ivARB\0" - ""; -#endif - -#if defined(need_GL_EXT_gpu_program_parameters) -static const char ProgramLocalParameters4fvEXT_names[] = - "iiip\0" /* Parameter signature */ - "glProgramLocalParameters4fvEXT\0" - ""; -#endif - -#if defined(need_GL_NV_evaluators) -static const char GetMapAttribParameterfvNV_names[] = - "iiip\0" /* Parameter signature */ - "glGetMapAttribParameterfvNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib4sARB_names[] = - "iiiii\0" /* Parameter signature */ - "glVertexAttrib4s\0" - "glVertexAttrib4sARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) -static const char GetQueryObjectuivARB_names[] = - "iip\0" /* Parameter signature */ - "glGetQueryObjectuiv\0" - "glGetQueryObjectuivARB\0" - ""; -#endif - -#if defined(need_GL_NV_evaluators) -static const char MapParameterivNV_names[] = - "iip\0" /* Parameter signature */ - "glMapParameterivNV\0" - ""; -#endif - -#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) -static const char GenRenderbuffersEXT_names[] = - "ip\0" /* Parameter signature */ - "glGenRenderbuffers\0" - "glGenRenderbuffersEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib2dvARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib2dv\0" - "glVertexAttrib2dvARB\0" - ""; -#endif - -#if defined(need_GL_EXT_vertex_array) -static const char EdgeFlagPointerEXT_names[] = - "iip\0" /* Parameter signature */ - "glEdgeFlagPointerEXT\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttribs2svNV_names[] = - "iip\0" /* Parameter signature */ - "glVertexAttribs2svNV\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_blend) -static const char WeightbvARB_names[] = - "ip\0" /* Parameter signature */ - "glWeightbvARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib2fvARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib2fv\0" - "glVertexAttrib2fvARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) -static const char GetBufferParameterivARB_names[] = - "iip\0" /* Parameter signature */ - "glGetBufferParameteriv\0" - "glGetBufferParameterivARB\0" - ""; -#endif - -#if defined(need_GL_SGIX_list_priority) -static const char ListParameteriSGIX_names[] = - "iii\0" /* Parameter signature */ - "glListParameteriSGIX\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char ReplacementCodeuiColor4fNormal3fVertex3fSUN_names[] = - "iffffffffff\0" /* Parameter signature */ - "glReplacementCodeuiColor4fNormal3fVertex3fSUN\0" - ""; -#endif - -#if defined(need_GL_SGIX_instruments) -static const char InstrumentsBufferSGIX_names[] = - "ip\0" /* Parameter signature */ - "glInstrumentsBufferSGIX\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib4NivARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib4Niv\0" - "glVertexAttrib4NivARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) -static const char GetAttachedShaders_names[] = - "iipp\0" /* Parameter signature */ - "glGetAttachedShaders\0" - ""; -#endif - -#if defined(need_GL_APPLE_vertex_array_object) -static const char GenVertexArraysAPPLE_names[] = - "ip\0" /* Parameter signature */ - "glGenVertexArraysAPPLE\0" - ""; -#endif - -#if defined(need_GL_EXT_gpu_program_parameters) -static const char ProgramEnvParameters4fvEXT_names[] = - "iiip\0" /* Parameter signature */ - "glProgramEnvParameters4fvEXT\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char TexCoord2fColor4fNormal3fVertex3fvSUN_names[] = - "pppp\0" /* Parameter signature */ - "glTexCoord2fColor4fNormal3fVertex3fvSUN\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) -static const char WindowPos2iMESA_names[] = - "ii\0" /* Parameter signature */ - "glWindowPos2i\0" - "glWindowPos2iARB\0" - "glWindowPos2iMESA\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) -static const char SecondaryColor3fvEXT_names[] = - "p\0" /* Parameter signature */ - "glSecondaryColor3fv\0" - "glSecondaryColor3fvEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression) -static const char CompressedTexSubImage1DARB_names[] = - "iiiiiip\0" /* Parameter signature */ - "glCompressedTexSubImage1D\0" - "glCompressedTexSubImage1DARB\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char GetVertexAttribivNV_names[] = - "iip\0" /* Parameter signature */ - "glGetVertexAttribivNV\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_program) -static const char GetProgramStringARB_names[] = - "iip\0" /* Parameter signature */ - "glGetProgramStringARB\0" - ""; -#endif - -#if defined(need_GL_ATI_envmap_bumpmap) -static const char TexBumpParameterfvATI_names[] = - "ip\0" /* Parameter signature */ - "glTexBumpParameterfvATI\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char CompileShaderARB_names[] = - "i\0" /* Parameter signature */ - "glCompileShader\0" - "glCompileShaderARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) -static const char DeleteShader_names[] = - "i\0" /* Parameter signature */ - "glDeleteShader\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char Uniform3fARB_names[] = - "ifff\0" /* Parameter signature */ - "glUniform3f\0" - "glUniform3fARB\0" - ""; -#endif - -#if defined(need_GL_SGIX_list_priority) -static const char ListParameterfvSGIX_names[] = - "iip\0" /* Parameter signature */ - "glListParameterfvSGIX\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char Tangent3dvEXT_names[] = - "p\0" /* Parameter signature */ - "glTangent3dvEXT\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char GetVertexAttribfvNV_names[] = - "iip\0" /* Parameter signature */ - "glGetVertexAttribfvNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) -static const char WindowPos3sMESA_names[] = - "iii\0" /* Parameter signature */ - "glWindowPos3s\0" - "glWindowPos3sARB\0" - "glWindowPos3sMESA\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib2svNV_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib2svNV\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttribs1fvNV_names[] = - "iip\0" /* Parameter signature */ - "glVertexAttribs1fvNV\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char TexCoord2fVertex3fvSUN_names[] = - "pp\0" /* Parameter signature */ - "glTexCoord2fVertex3fvSUN\0" - ""; -#endif - -#if defined(need_GL_MESA_window_pos) -static const char WindowPos4sMESA_names[] = - "iiii\0" /* Parameter signature */ - "glWindowPos4sMESA\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib4NuivARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib4Nuiv\0" - "glVertexAttrib4NuivARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char ClientActiveTextureARB_names[] = - "i\0" /* Parameter signature */ - "glClientActiveTexture\0" - "glClientActiveTextureARB\0" - ""; -#endif - -#if defined(need_GL_SGIX_pixel_texture) -static const char PixelTexGenSGIX_names[] = - "i\0" /* Parameter signature */ - "glPixelTexGenSGIX\0" - ""; -#endif - -#if defined(need_GL_SUN_triangle_list) -static const char ReplacementCodeusvSUN_names[] = - "p\0" /* Parameter signature */ - "glReplacementCodeusvSUN\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char Uniform4fARB_names[] = - "iffff\0" /* Parameter signature */ - "glUniform4f\0" - "glUniform4fARB\0" - ""; -#endif - -#if defined(need_GL_ARB_map_buffer_range) -static const char FlushMappedBufferRange_names[] = - "iii\0" /* Parameter signature */ - "glFlushMappedBufferRange\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) -static const char IsProgramNV_names[] = - "i\0" /* Parameter signature */ - "glIsProgramARB\0" - "glIsProgramNV\0" - ""; -#endif - -#if defined(need_GL_APPLE_flush_buffer_range) -static const char FlushMappedBufferRangeAPPLE_names[] = - "iii\0" /* Parameter signature */ - "glFlushMappedBufferRangeAPPLE\0" - ""; -#endif - -#if defined(need_GL_SUN_triangle_list) -static const char ReplacementCodePointerSUN_names[] = - "iip\0" /* Parameter signature */ - "glReplacementCodePointerSUN\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) -static const char ProgramEnvParameter4dARB_names[] = - "iidddd\0" /* Parameter signature */ - "glProgramEnvParameter4dARB\0" - "glProgramParameter4dNV\0" - ""; -#endif - -#if defined(need_GL_SGI_color_table) -static const char ColorTableParameterfv_names[] = - "iip\0" /* Parameter signature */ - "glColorTableParameterfv\0" - "glColorTableParameterfvSGI\0" - ""; -#endif - -#if defined(need_GL_SGIX_fragment_lighting) -static const char FragmentLightModelfSGIX_names[] = - "if\0" /* Parameter signature */ - "glFragmentLightModelfSGIX\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char Binormal3bvEXT_names[] = - "p\0" /* Parameter signature */ - "glBinormal3bvEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_texture_object) -static const char IsTexture_names[] = - "i\0" /* Parameter signature */ - "glIsTexture\0" - "glIsTextureEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_vertex_weighting) -static const char VertexWeightfvEXT_names[] = - "p\0" /* Parameter signature */ - "glVertexWeightfvEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib1dARB_names[] = - "id\0" /* Parameter signature */ - "glVertexAttrib1d\0" - "glVertexAttrib1dARB\0" - ""; -#endif - -#if defined(need_GL_HP_image_transform) -static const char ImageTransformParameterivHP_names[] = - "iip\0" /* Parameter signature */ - "glImageTransformParameterivHP\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) -static const char DeleteQueriesARB_names[] = - "ip\0" /* Parameter signature */ - "glDeleteQueries\0" - "glDeleteQueriesARB\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char Color4ubVertex2fSUN_names[] = - "iiiiff\0" /* Parameter signature */ - "glColor4ubVertex2fSUN\0" - ""; -#endif - -#if defined(need_GL_SGIX_fragment_lighting) -static const char FragmentColorMaterialSGIX_names[] = - "ii\0" /* Parameter signature */ - "glFragmentColorMaterialSGIX\0" - ""; -#endif - -#if defined(need_GL_ARB_matrix_palette) -static const char CurrentPaletteMatrixARB_names[] = - "i\0" /* Parameter signature */ - "glCurrentPaletteMatrixARB\0" - ""; -#endif - -#if defined(need_GL_SGIS_multisample) || defined(need_GL_EXT_multisample) -static const char SamplePatternSGIS_names[] = - "i\0" /* Parameter signature */ - "glSamplePatternSGIS\0" - "glSamplePatternEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) -static const char IsQueryARB_names[] = - "i\0" /* Parameter signature */ - "glIsQuery\0" - "glIsQueryARB\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char ReplacementCodeuiColor4ubVertex3fSUN_names[] = - "iiiiifff\0" /* Parameter signature */ - "glReplacementCodeuiColor4ubVertex3fSUN\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib4usvARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib4usv\0" - "glVertexAttrib4usvARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char LinkProgramARB_names[] = - "i\0" /* Parameter signature */ - "glLinkProgram\0" - "glLinkProgramARB\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib2fNV_names[] = - "iff\0" /* Parameter signature */ - "glVertexAttrib2fNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char ShaderSourceARB_names[] = - "iipp\0" /* Parameter signature */ - "glShaderSource\0" - "glShaderSourceARB\0" - ""; -#endif - -#if defined(need_GL_SGIX_fragment_lighting) -static const char FragmentMaterialiSGIX_names[] = - "iii\0" /* Parameter signature */ - "glFragmentMaterialiSGIX\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib3svARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib3sv\0" - "glVertexAttrib3svARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression) -static const char CompressedTexSubImage3DARB_names[] = - "iiiiiiiiiip\0" /* Parameter signature */ - "glCompressedTexSubImage3D\0" - "glCompressedTexSubImage3DARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) -static const char WindowPos2ivMESA_names[] = - "p\0" /* Parameter signature */ - "glWindowPos2iv\0" - "glWindowPos2ivARB\0" - "glWindowPos2ivMESA\0" - ""; -#endif - -#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) -static const char IsFramebufferEXT_names[] = - "i\0" /* Parameter signature */ - "glIsFramebuffer\0" - "glIsFramebufferEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char Uniform4ivARB_names[] = - "iip\0" /* Parameter signature */ - "glUniform4iv\0" - "glUniform4ivARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char GetVertexAttribdvARB_names[] = - "iip\0" /* Parameter signature */ - "glGetVertexAttribdv\0" - "glGetVertexAttribdvARB\0" - ""; -#endif - -#if defined(need_GL_ATI_envmap_bumpmap) -static const char TexBumpParameterivATI_names[] = - "ip\0" /* Parameter signature */ - "glTexBumpParameterivATI\0" - ""; -#endif - -#if defined(need_GL_EXT_convolution) -static const char GetSeparableFilter_names[] = - "iiippp\0" /* Parameter signature */ - "glGetSeparableFilter\0" - "glGetSeparableFilterEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char Binormal3dEXT_names[] = - "ddd\0" /* Parameter signature */ - "glBinormal3dEXT\0" - ""; -#endif - -#if defined(need_GL_SGIX_sprite) -static const char SpriteParameteriSGIX_names[] = - "ii\0" /* Parameter signature */ - "glSpriteParameteriSGIX\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char RequestResidentProgramsNV_names[] = - "ip\0" /* Parameter signature */ - "glRequestResidentProgramsNV\0" - ""; -#endif - -#if defined(need_GL_SGIX_tag_sample_buffer) -static const char TagSampleBufferSGIX_names[] = - "\0" /* Parameter signature */ - "glTagSampleBufferSGIX\0" - ""; -#endif - -#if defined(need_GL_SUN_triangle_list) -static const char ReplacementCodeusSUN_names[] = - "i\0" /* Parameter signature */ - "glReplacementCodeusSUN\0" - ""; -#endif - -#if defined(need_GL_SGIX_list_priority) -static const char ListParameterivSGIX_names[] = - "iip\0" /* Parameter signature */ - "glListParameterivSGIX\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_multi_draw_arrays) -static const char MultiDrawElementsEXT_names[] = - "ipipi\0" /* Parameter signature */ - "glMultiDrawElements\0" - "glMultiDrawElementsEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char Uniform1ivARB_names[] = - "iip\0" /* Parameter signature */ - "glUniform1iv\0" - "glUniform1ivARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) -static const char WindowPos2sMESA_names[] = - "ii\0" /* Parameter signature */ - "glWindowPos2s\0" - "glWindowPos2sARB\0" - "glWindowPos2sMESA\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_blend) -static const char WeightusvARB_names[] = - "ip\0" /* Parameter signature */ - "glWeightusvARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord) -static const char FogCoordPointerEXT_names[] = - "iip\0" /* Parameter signature */ - "glFogCoordPointer\0" - "glFogCoordPointerEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_index_material) -static const char IndexMaterialEXT_names[] = - "ii\0" /* Parameter signature */ - "glIndexMaterialEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) -static const char SecondaryColor3ubvEXT_names[] = - "p\0" /* Parameter signature */ - "glSecondaryColor3ubv\0" - "glSecondaryColor3ubvEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib4dvARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib4dv\0" - "glVertexAttrib4dvARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_shader) -static const char BindAttribLocationARB_names[] = - "iip\0" /* Parameter signature */ - "glBindAttribLocation\0" - "glBindAttribLocationARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord2dARB_names[] = - "idd\0" /* Parameter signature */ - "glMultiTexCoord2d\0" - "glMultiTexCoord2dARB\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char ExecuteProgramNV_names[] = - "iip\0" /* Parameter signature */ - "glExecuteProgramNV\0" - ""; -#endif - -#if defined(need_GL_SGIX_fragment_lighting) -static const char LightEnviSGIX_names[] = - "ii\0" /* Parameter signature */ - "glLightEnviSGIX\0" - ""; -#endif - -#if defined(need_GL_SUN_triangle_list) -static const char ReplacementCodeuiSUN_names[] = - "i\0" /* Parameter signature */ - "glReplacementCodeuiSUN\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttribPointerNV_names[] = - "iiiip\0" /* Parameter signature */ - "glVertexAttribPointerNV\0" - ""; -#endif - -#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) -static const char GetFramebufferAttachmentParameterivEXT_names[] = - "iiip\0" /* Parameter signature */ - "glGetFramebufferAttachmentParameteriv\0" - "glGetFramebufferAttachmentParameterivEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_pixel_transform) -static const char PixelTransformParameterfEXT_names[] = - "iif\0" /* Parameter signature */ - "glPixelTransformParameterfEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord4dvARB_names[] = - "ip\0" /* Parameter signature */ - "glMultiTexCoord4dv\0" - "glMultiTexCoord4dvARB\0" - ""; -#endif - -#if defined(need_GL_EXT_pixel_transform) -static const char PixelTransformParameteriEXT_names[] = - "iii\0" /* Parameter signature */ - "glPixelTransformParameteriEXT\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char TexCoord2fColor4ubVertex3fSUN_names[] = - "ffiiiifff\0" /* Parameter signature */ - "glTexCoord2fColor4ubVertex3fSUN\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char Uniform1iARB_names[] = - "ii\0" /* Parameter signature */ - "glUniform1i\0" - "glUniform1iARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttribPointerARB_names[] = - "iiiiip\0" /* Parameter signature */ - "glVertexAttribPointer\0" - "glVertexAttribPointerARB\0" - ""; -#endif - -#if defined(need_GL_SGIS_sharpen_texture) -static const char SharpenTexFuncSGIS_names[] = - "iip\0" /* Parameter signature */ - "glSharpenTexFuncSGIS\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord4fvARB_names[] = - "ip\0" /* Parameter signature */ - "glMultiTexCoord4fv\0" - "glMultiTexCoord4fvARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_1) -static const char UniformMatrix2x3fv_names[] = - "iiip\0" /* Parameter signature */ - "glUniformMatrix2x3fv\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char TrackMatrixNV_names[] = - "iiii\0" /* Parameter signature */ - "glTrackMatrixNV\0" - ""; -#endif - -#if defined(need_GL_NV_register_combiners) -static const char CombinerParameteriNV_names[] = - "ii\0" /* Parameter signature */ - "glCombinerParameteriNV\0" - ""; -#endif - -#if defined(need_GL_SGIX_async) -static const char DeleteAsyncMarkersSGIX_names[] = - "ii\0" /* Parameter signature */ - "glDeleteAsyncMarkersSGIX\0" - ""; -#endif - -#if defined(need_GL_SGIX_async) -static const char IsAsyncMarkerSGIX_names[] = - "i\0" /* Parameter signature */ - "glIsAsyncMarkerSGIX\0" - ""; -#endif - -#if defined(need_GL_SGIX_framezoom) -static const char FrameZoomSGIX_names[] = - "i\0" /* Parameter signature */ - "glFrameZoomSGIX\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char Normal3fVertex3fvSUN_names[] = - "pp\0" /* Parameter signature */ - "glNormal3fVertex3fvSUN\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib4NsvARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib4Nsv\0" - "glVertexAttrib4NsvARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib3fvARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib3fv\0" - "glVertexAttrib3fvARB\0" - ""; -#endif - -#if defined(need_GL_ARB_sync) -static const char GetSynciv_names[] = - "iiipp\0" /* Parameter signature */ - "glGetSynciv\0" - ""; -#endif - -#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) -static const char DeleteFramebuffersEXT_names[] = - "ip\0" /* Parameter signature */ - "glDeleteFramebuffers\0" - "glDeleteFramebuffersEXT\0" - ""; -#endif - -#if defined(need_GL_SUN_global_alpha) -static const char GlobalAlphaFactorsSUN_names[] = - "i\0" /* Parameter signature */ - "glGlobalAlphaFactorsSUN\0" - ""; -#endif - -#if defined(need_GL_EXT_texture3D) -static const char TexSubImage3D_names[] = - "iiiiiiiiiip\0" /* Parameter signature */ - "glTexSubImage3D\0" - "glTexSubImage3DEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char Tangent3fEXT_names[] = - "fff\0" /* Parameter signature */ - "glTangent3fEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) -static const char SecondaryColor3uivEXT_names[] = - "p\0" /* Parameter signature */ - "glSecondaryColor3uiv\0" - "glSecondaryColor3uivEXT\0" - ""; -#endif - -#if defined(need_GL_ARB_matrix_palette) -static const char MatrixIndexubvARB_names[] = - "ip\0" /* Parameter signature */ - "glMatrixIndexubvARB\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char Color4fNormal3fVertex3fSUN_names[] = - "ffffffffff\0" /* Parameter signature */ - "glColor4fNormal3fVertex3fSUN\0" - ""; -#endif - -#if defined(need_GL_SGIS_pixel_texture) -static const char PixelTexGenParameterfSGIS_names[] = - "if\0" /* Parameter signature */ - "glPixelTexGenParameterfSGIS\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) -static const char CreateShader_names[] = - "i\0" /* Parameter signature */ - "glCreateShader\0" - ""; -#endif - -#if defined(need_GL_SGI_color_table) || defined(need_GL_EXT_paletted_texture) -static const char GetColorTableParameterfv_names[] = - "iip\0" /* Parameter signature */ - "glGetColorTableParameterfv\0" - "glGetColorTableParameterfvSGI\0" - "glGetColorTableParameterfvEXT\0" - ""; -#endif - -#if defined(need_GL_SGIX_fragment_lighting) -static const char FragmentLightModelfvSGIX_names[] = - "ip\0" /* Parameter signature */ - "glFragmentLightModelfvSGIX\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord3fARB_names[] = - "ifff\0" /* Parameter signature */ - "glMultiTexCoord3f\0" - "glMultiTexCoord3fARB\0" - ""; -#endif - -#if defined(need_GL_SGIS_pixel_texture) -static const char GetPixelTexGenParameterfvSGIS_names[] = - "ip\0" /* Parameter signature */ - "glGetPixelTexGenParameterfvSGIS\0" - ""; -#endif - -#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) -static const char GenFramebuffersEXT_names[] = - "ip\0" /* Parameter signature */ - "glGenFramebuffers\0" - "glGenFramebuffersEXT\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char GetProgramParameterdvNV_names[] = - "iiip\0" /* Parameter signature */ - "glGetProgramParameterdvNV\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_array_object) || defined(need_GL_APPLE_vertex_array_object) -static const char IsVertexArrayAPPLE_names[] = - "i\0" /* Parameter signature */ - "glIsVertexArray\0" - "glIsVertexArrayAPPLE\0" - ""; -#endif - -#if defined(need_GL_SGIX_fragment_lighting) -static const char FragmentLightfvSGIX_names[] = - "iip\0" /* Parameter signature */ - "glFragmentLightfvSGIX\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) -static const char DetachShader_names[] = - "ii\0" /* Parameter signature */ - "glDetachShader\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib4NubARB_names[] = - "iiiii\0" /* Parameter signature */ - "glVertexAttrib4Nub\0" - "glVertexAttrib4NubARB\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_program) -static const char GetProgramEnvParameterfvARB_names[] = - "iip\0" /* Parameter signature */ - "glGetProgramEnvParameterfvARB\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char GetTrackMatrixivNV_names[] = - "iiip\0" /* Parameter signature */ - "glGetTrackMatrixivNV\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib3svNV_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib3svNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char Uniform4fvARB_names[] = - "iip\0" /* Parameter signature */ - "glUniform4fv\0" - "glUniform4fvARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_transpose_matrix) -static const char MultTransposeMatrixfARB_names[] = - "p\0" /* Parameter signature */ - "glMultTransposeMatrixf\0" - "glMultTransposeMatrixfARB\0" - ""; -#endif - -#if defined(need_GL_ATI_fragment_shader) -static const char ColorFragmentOp1ATI_names[] = - "iiiiiii\0" /* Parameter signature */ - "glColorFragmentOp1ATI\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char GetUniformfvARB_names[] = - "iip\0" /* Parameter signature */ - "glGetUniformfv\0" - "glGetUniformfvARB\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN_names[] = - "iffffffffffff\0" /* Parameter signature */ - "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN\0" - ""; -#endif - -#if defined(need_GL_ARB_shader_objects) -static const char DetachObjectARB_names[] = - "ii\0" /* Parameter signature */ - "glDetachObjectARB\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_blend) -static const char VertexBlendARB_names[] = - "i\0" /* Parameter signature */ - "glVertexBlendARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) -static const char WindowPos3iMESA_names[] = - "iii\0" /* Parameter signature */ - "glWindowPos3i\0" - "glWindowPos3iARB\0" - "glWindowPos3iMESA\0" - ""; -#endif - -#if defined(need_GL_EXT_convolution) -static const char SeparableFilter2D_names[] = - "iiiiiipp\0" /* Parameter signature */ - "glSeparableFilter2D\0" - "glSeparableFilter2DEXT\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char ReplacementCodeuiColor4ubVertex3fvSUN_names[] = - "ppp\0" /* Parameter signature */ - "glReplacementCodeuiColor4ubVertex3fvSUN\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression) -static const char CompressedTexImage2DARB_names[] = - "iiiiiiip\0" /* Parameter signature */ - "glCompressedTexImage2D\0" - "glCompressedTexImage2DARB\0" - ""; -#endif - -#if defined(need_GL_EXT_vertex_array) -static const char ArrayElement_names[] = - "i\0" /* Parameter signature */ - "glArrayElement\0" - "glArrayElementEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_depth_bounds_test) -static const char DepthBoundsEXT_names[] = - "dd\0" /* Parameter signature */ - "glDepthBoundsEXT\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char ProgramParameters4fvNV_names[] = - "iiip\0" /* Parameter signature */ - "glProgramParameters4fvNV\0" - ""; -#endif - -#if defined(need_GL_SGIX_polynomial_ffd) -static const char DeformationMap3fSGIX_names[] = - "iffiiffiiffiip\0" /* Parameter signature */ - "glDeformationMap3fSGIX\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char GetProgramivNV_names[] = - "iip\0" /* Parameter signature */ - "glGetProgramivNV\0" - ""; -#endif - -#if defined(need_GL_EXT_histogram) -static const char GetMinmaxParameteriv_names[] = - "iip\0" /* Parameter signature */ - "glGetMinmaxParameteriv\0" - "glGetMinmaxParameterivEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_copy_texture) -static const char CopyTexImage1D_names[] = - "iiiiiii\0" /* Parameter signature */ - "glCopyTexImage1D\0" - "glCopyTexImage1DEXT\0" - ""; -#endif - -#if defined(need_GL_ATI_fragment_shader) -static const char AlphaFragmentOp3ATI_names[] = - "iiiiiiiiiiii\0" /* Parameter signature */ - "glAlphaFragmentOp3ATI\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char GetVertexAttribdvNV_names[] = - "iip\0" /* Parameter signature */ - "glGetVertexAttribdvNV\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib3fvNV_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib3fvNV\0" - ""; -#endif - -#if defined(need_GL_NV_register_combiners) -static const char GetFinalCombinerInputParameterivNV_names[] = - "iip\0" /* Parameter signature */ - "glGetFinalCombinerInputParameterivNV\0" - ""; -#endif - -#if defined(need_GL_NV_evaluators) -static const char GetMapParameterivNV_names[] = - "iip\0" /* Parameter signature */ - "glGetMapParameterivNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char Uniform4iARB_names[] = - "iiiii\0" /* Parameter signature */ - "glUniform4i\0" - "glUniform4iARB\0" - ""; -#endif - -#if defined(need_GL_EXT_convolution) -static const char ConvolutionParameteri_names[] = - "iii\0" /* Parameter signature */ - "glConvolutionParameteri\0" - "glConvolutionParameteriEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char Binormal3sEXT_names[] = - "iii\0" /* Parameter signature */ - "glBinormal3sEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_convolution) -static const char ConvolutionParameterf_names[] = - "iif\0" /* Parameter signature */ - "glConvolutionParameterf\0" - "glConvolutionParameterfEXT\0" - ""; -#endif - -#if defined(need_GL_SGI_color_table) || defined(need_GL_EXT_paletted_texture) -static const char GetColorTableParameteriv_names[] = - "iip\0" /* Parameter signature */ - "glGetColorTableParameteriv\0" - "glGetColorTableParameterivSGI\0" - "glGetColorTableParameterivEXT\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) -static const char ProgramEnvParameter4dvARB_names[] = - "iip\0" /* Parameter signature */ - "glProgramEnvParameter4dvARB\0" - "glProgramParameter4dvNV\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttribs2fvNV_names[] = - "iip\0" /* Parameter signature */ - "glVertexAttribs2fvNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char UseProgramObjectARB_names[] = - "i\0" /* Parameter signature */ - "glUseProgram\0" - "glUseProgramObjectARB\0" - ""; -#endif - -#if defined(need_GL_NV_evaluators) -static const char GetMapParameterfvNV_names[] = - "iip\0" /* Parameter signature */ - "glGetMapParameterfvNV\0" - ""; -#endif - -#if defined(need_GL_ATI_fragment_shader) -static const char PassTexCoordATI_names[] = - "iii\0" /* Parameter signature */ - "glPassTexCoordATI\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) -static const char DeleteProgram_names[] = - "i\0" /* Parameter signature */ - "glDeleteProgram\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char Tangent3ivEXT_names[] = - "p\0" /* Parameter signature */ - "glTangent3ivEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char Tangent3dEXT_names[] = - "ddd\0" /* Parameter signature */ - "glTangent3dEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) -static const char SecondaryColor3dvEXT_names[] = - "p\0" /* Parameter signature */ - "glSecondaryColor3dv\0" - "glSecondaryColor3dvEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_multi_draw_arrays) -static const char MultiDrawArraysEXT_names[] = - "ippi\0" /* Parameter signature */ - "glMultiDrawArrays\0" - "glMultiDrawArraysEXT\0" - ""; -#endif - -#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) -static const char BindRenderbufferEXT_names[] = - "ii\0" /* Parameter signature */ - "glBindRenderbuffer\0" - "glBindRenderbufferEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord4dARB_names[] = - "idddd\0" /* Parameter signature */ - "glMultiTexCoord4d\0" - "glMultiTexCoord4dARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) -static const char SecondaryColor3usEXT_names[] = - "iii\0" /* Parameter signature */ - "glSecondaryColor3us\0" - "glSecondaryColor3usEXT\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_program) -static const char ProgramLocalParameter4fvARB_names[] = - "iip\0" /* Parameter signature */ - "glProgramLocalParameter4fvARB\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) -static const char DeleteProgramsNV_names[] = - "ip\0" /* Parameter signature */ - "glDeleteProgramsARB\0" - "glDeleteProgramsNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord1sARB_names[] = - "ii\0" /* Parameter signature */ - "glMultiTexCoord1s\0" - "glMultiTexCoord1sARB\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char ReplacementCodeuiColor3fVertex3fSUN_names[] = - "iffffff\0" /* Parameter signature */ - "glReplacementCodeuiColor3fVertex3fSUN\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) -static const char GetVertexAttribPointervNV_names[] = - "iip\0" /* Parameter signature */ - "glGetVertexAttribPointerv\0" - "glGetVertexAttribPointervARB\0" - "glGetVertexAttribPointervNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord1dvARB_names[] = - "ip\0" /* Parameter signature */ - "glMultiTexCoord1dv\0" - "glMultiTexCoord1dvARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char Uniform2iARB_names[] = - "iii\0" /* Parameter signature */ - "glUniform2i\0" - "glUniform2iARB\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char GetProgramStringNV_names[] = - "iip\0" /* Parameter signature */ - "glGetProgramStringNV\0" - ""; -#endif - -#if defined(need_GL_EXT_vertex_array) -static const char ColorPointerEXT_names[] = - "iiiip\0" /* Parameter signature */ - "glColorPointerEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) -static const char MapBufferARB_names[] = - "ii\0" /* Parameter signature */ - "glMapBuffer\0" - "glMapBufferARB\0" - ""; -#endif - -#if defined(need_GL_ARB_draw_elements_base_vertex) -static const char MultiDrawElementsBaseVertex_names[] = - "ipipip\0" /* Parameter signature */ - "glMultiDrawElementsBaseVertex\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char Binormal3svEXT_names[] = - "p\0" /* Parameter signature */ - "glBinormal3svEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_light_texture) -static const char ApplyTextureEXT_names[] = - "i\0" /* Parameter signature */ - "glApplyTextureEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_light_texture) -static const char TextureMaterialEXT_names[] = - "ii\0" /* Parameter signature */ - "glTextureMaterialEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_light_texture) -static const char TextureLightEXT_names[] = - "i\0" /* Parameter signature */ - "glTextureLightEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_histogram) -static const char ResetMinmax_names[] = - "i\0" /* Parameter signature */ - "glResetMinmax\0" - "glResetMinmaxEXT\0" - ""; -#endif - -#if defined(need_GL_SGIX_sprite) -static const char SpriteParameterfSGIX_names[] = - "if\0" /* Parameter signature */ - "glSpriteParameterfSGIX\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib4sNV_names[] = - "iiiii\0" /* Parameter signature */ - "glVertexAttrib4sNV\0" - ""; -#endif - -#if defined(need_GL_EXT_convolution) -static const char GetConvolutionParameterfv_names[] = - "iip\0" /* Parameter signature */ - "glGetConvolutionParameterfv\0" - "glGetConvolutionParameterfvEXT\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttribs4dvNV_names[] = - "iip\0" /* Parameter signature */ - "glVertexAttribs4dvNV\0" - ""; -#endif - -#if defined(need_GL_IBM_multimode_draw_arrays) -static const char MultiModeDrawArraysIBM_names[] = - "pppii\0" /* Parameter signature */ - "glMultiModeDrawArraysIBM\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib4dARB_names[] = - "idddd\0" /* Parameter signature */ - "glVertexAttrib4d\0" - "glVertexAttrib4dARB\0" - ""; -#endif - -#if defined(need_GL_ATI_envmap_bumpmap) -static const char GetTexBumpParameterfvATI_names[] = - "ip\0" /* Parameter signature */ - "glGetTexBumpParameterfvATI\0" - ""; -#endif - -#if defined(need_GL_NV_fragment_program) -static const char ProgramNamedParameter4dNV_names[] = - "iipdddd\0" /* Parameter signature */ - "glProgramNamedParameter4dNV\0" - ""; -#endif - -#if defined(need_GL_EXT_vertex_weighting) -static const char VertexWeightfEXT_names[] = - "f\0" /* Parameter signature */ - "glVertexWeightfEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char Binormal3fEXT_names[] = - "fff\0" /* Parameter signature */ - "glBinormal3fEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord) -static const char FogCoordfvEXT_names[] = - "p\0" /* Parameter signature */ - "glFogCoordfv\0" - "glFogCoordfvEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord1ivARB_names[] = - "ip\0" /* Parameter signature */ - "glMultiTexCoord1iv\0" - "glMultiTexCoord1ivARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) -static const char SecondaryColor3ubEXT_names[] = - "iii\0" /* Parameter signature */ - "glSecondaryColor3ub\0" - "glSecondaryColor3ubEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord2ivARB_names[] = - "ip\0" /* Parameter signature */ - "glMultiTexCoord2iv\0" - "glMultiTexCoord2ivARB\0" - ""; -#endif - -#if defined(need_GL_SGIS_fog_function) -static const char FogFuncSGIS_names[] = - "ip\0" /* Parameter signature */ - "glFogFuncSGIS\0" - ""; -#endif - -#if defined(need_GL_EXT_copy_texture) -static const char CopyTexSubImage2D_names[] = - "iiiiiiii\0" /* Parameter signature */ - "glCopyTexSubImage2D\0" - "glCopyTexSubImage2DEXT\0" - ""; -#endif - -#if defined(need_GL_ARB_shader_objects) -static const char GetObjectParameterivARB_names[] = - "iip\0" /* Parameter signature */ - "glGetObjectParameterivARB\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char TexCoord4fVertex4fSUN_names[] = - "ffffffff\0" /* Parameter signature */ - "glTexCoord4fVertex4fSUN\0" - ""; -#endif - -#if defined(need_GL_APPLE_vertex_array_object) -static const char BindVertexArrayAPPLE_names[] = - "i\0" /* Parameter signature */ - "glBindVertexArrayAPPLE\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_program) -static const char GetProgramLocalParameterdvARB_names[] = - "iip\0" /* Parameter signature */ - "glGetProgramLocalParameterdvARB\0" - ""; -#endif - -#if defined(need_GL_EXT_histogram) -static const char GetHistogramParameteriv_names[] = - "iip\0" /* Parameter signature */ - "glGetHistogramParameteriv\0" - "glGetHistogramParameterivEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord1iARB_names[] = - "ii\0" /* Parameter signature */ - "glMultiTexCoord1i\0" - "glMultiTexCoord1iARB\0" - ""; -#endif - -#if defined(need_GL_EXT_convolution) -static const char GetConvolutionFilter_names[] = - "iiip\0" /* Parameter signature */ - "glGetConvolutionFilter\0" - "glGetConvolutionFilterEXT\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_program) -static const char GetProgramivARB_names[] = - "iip\0" /* Parameter signature */ - "glGetProgramivARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_blend_func_separate) || defined(need_GL_INGR_blend_func_separate) -static const char BlendFuncSeparateEXT_names[] = - "iiii\0" /* Parameter signature */ - "glBlendFuncSeparate\0" - "glBlendFuncSeparateEXT\0" - "glBlendFuncSeparateINGR\0" - ""; -#endif - -#if defined(need_GL_ARB_map_buffer_range) -static const char MapBufferRange_names[] = - "iiii\0" /* Parameter signature */ - "glMapBufferRange\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char ProgramParameters4dvNV_names[] = - "iiip\0" /* Parameter signature */ - "glProgramParameters4dvNV\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char TexCoord2fColor3fVertex3fvSUN_names[] = - "ppp\0" /* Parameter signature */ - "glTexCoord2fColor3fVertex3fvSUN\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char Binormal3dvEXT_names[] = - "p\0" /* Parameter signature */ - "glBinormal3dvEXT\0" - ""; -#endif - -#if defined(need_GL_NV_fence) -static const char FinishFenceNV_names[] = - "i\0" /* Parameter signature */ - "glFinishFenceNV\0" - ""; -#endif - -#if defined(need_GL_SGIS_fog_function) -static const char GetFogFuncSGIS_names[] = - "p\0" /* Parameter signature */ - "glGetFogFuncSGIS\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char GetUniformLocationARB_names[] = - "ip\0" /* Parameter signature */ - "glGetUniformLocation\0" - "glGetUniformLocationARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) -static const char SecondaryColor3fEXT_names[] = - "fff\0" /* Parameter signature */ - "glSecondaryColor3f\0" - "glSecondaryColor3fEXT\0" - ""; -#endif - -#if defined(need_GL_NV_register_combiners) -static const char CombinerInputNV_names[] = - "iiiiii\0" /* Parameter signature */ - "glCombinerInputNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib3sARB_names[] = - "iiii\0" /* Parameter signature */ - "glVertexAttrib3s\0" - "glVertexAttrib3sARB\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char ReplacementCodeuiNormal3fVertex3fvSUN_names[] = - "ppp\0" /* Parameter signature */ - "glReplacementCodeuiNormal3fVertex3fvSUN\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_program) -static const char ProgramStringARB_names[] = - "iiip\0" /* Parameter signature */ - "glProgramStringARB\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char TexCoord4fVertex4fvSUN_names[] = - "pp\0" /* Parameter signature */ - "glTexCoord4fVertex4fvSUN\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib3sNV_names[] = - "iiii\0" /* Parameter signature */ - "glVertexAttrib3sNV\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib1fNV_names[] = - "if\0" /* Parameter signature */ - "glVertexAttrib1fNV\0" - ""; -#endif - -#if defined(need_GL_SGIX_fragment_lighting) -static const char FragmentLightfSGIX_names[] = - "iif\0" /* Parameter signature */ - "glFragmentLightfSGIX\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_texture_compression) -static const char GetCompressedTexImageARB_names[] = - "iip\0" /* Parameter signature */ - "glGetCompressedTexImage\0" - "glGetCompressedTexImageARB\0" - ""; -#endif - -#if defined(need_GL_EXT_vertex_weighting) -static const char VertexWeightPointerEXT_names[] = - "iiip\0" /* Parameter signature */ - "glVertexWeightPointerEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_histogram) -static const char GetHistogram_names[] = - "iiiip\0" /* Parameter signature */ - "glGetHistogram\0" - "glGetHistogramEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_stencil_two_side) -static const char ActiveStencilFaceEXT_names[] = - "i\0" /* Parameter signature */ - "glActiveStencilFaceEXT\0" - ""; -#endif - -#if defined(need_GL_ATI_separate_stencil) -static const char StencilFuncSeparateATI_names[] = - "iiii\0" /* Parameter signature */ - "glStencilFuncSeparateATI\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char GetShaderSourceARB_names[] = - "iipp\0" /* Parameter signature */ - "glGetShaderSource\0" - "glGetShaderSourceARB\0" - ""; -#endif - -#if defined(need_GL_SGIX_igloo_interface) -static const char IglooInterfaceSGIX_names[] = - "ip\0" /* Parameter signature */ - "glIglooInterfaceSGIX\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib4dNV_names[] = - "idddd\0" /* Parameter signature */ - "glVertexAttrib4dNV\0" - ""; -#endif - -#if defined(need_GL_IBM_multimode_draw_arrays) -static const char MultiModeDrawElementsIBM_names[] = - "ppipii\0" /* Parameter signature */ - "glMultiModeDrawElementsIBM\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord4svARB_names[] = - "ip\0" /* Parameter signature */ - "glMultiTexCoord4sv\0" - "glMultiTexCoord4svARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_occlusion_query) -static const char GenQueriesARB_names[] = - "ip\0" /* Parameter signature */ - "glGenQueries\0" - "glGenQueriesARB\0" - ""; -#endif - -#if defined(need_GL_SUN_vertex) -static const char ReplacementCodeuiVertex3fSUN_names[] = - "ifff\0" /* Parameter signature */ - "glReplacementCodeuiVertex3fSUN\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char Tangent3iEXT_names[] = - "iii\0" /* Parameter signature */ - "glTangent3iEXT\0" - ""; -#endif - -#if defined(need_GL_SUN_mesh_array) -static const char DrawMeshArraysSUN_names[] = - "iiii\0" /* Parameter signature */ - "glDrawMeshArraysSUN\0" - ""; -#endif - -#if defined(need_GL_ARB_sync) -static const char IsSync_names[] = - "i\0" /* Parameter signature */ - "glIsSync\0" - ""; -#endif - -#if defined(need_GL_NV_evaluators) -static const char GetMapControlPointsNV_names[] = - "iiiiiip\0" /* Parameter signature */ - "glGetMapControlPointsNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_draw_buffers) || defined(need_GL_ATI_draw_buffers) -static const char DrawBuffersARB_names[] = - "ip\0" /* Parameter signature */ - "glDrawBuffers\0" - "glDrawBuffersARB\0" - "glDrawBuffersATI\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_program) -static const char ProgramLocalParameter4fARB_names[] = - "iiffff\0" /* Parameter signature */ - "glProgramLocalParameter4fARB\0" - ""; -#endif - -#if defined(need_GL_SGIX_sprite) -static const char SpriteParameterivSGIX_names[] = - "ip\0" /* Parameter signature */ - "glSpriteParameterivSGIX\0" - ""; -#endif - -#if defined(need_GL_EXT_provoking_vertex) || defined(need_GL_ARB_provoking_vertex) -static const char ProvokingVertexEXT_names[] = - "i\0" /* Parameter signature */ - "glProvokingVertexEXT\0" - "glProvokingVertex\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord1fARB_names[] = - "if\0" /* Parameter signature */ - "glMultiTexCoord1f\0" - "glMultiTexCoord1fARB\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttribs4ubvNV_names[] = - "iip\0" /* Parameter signature */ - "glVertexAttribs4ubvNV\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_blend) -static const char WeightsvARB_names[] = - "ip\0" /* Parameter signature */ - "glWeightsvARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_shader_objects) -static const char Uniform1fvARB_names[] = - "iip\0" /* Parameter signature */ - "glUniform1fv\0" - "glUniform1fvARB\0" - ""; -#endif - -#if defined(need_GL_EXT_copy_texture) -static const char CopyTexSubImage1D_names[] = - "iiiiii\0" /* Parameter signature */ - "glCopyTexSubImage1D\0" - "glCopyTexSubImage1DEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_texture_object) -static const char BindTexture_names[] = - "ii\0" /* Parameter signature */ - "glBindTexture\0" - "glBindTextureEXT\0" - ""; -#endif - -#if defined(need_GL_ATI_fragment_shader) -static const char BeginFragmentShaderATI_names[] = - "\0" /* Parameter signature */ - "glBeginFragmentShaderATI\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord4fARB_names[] = - "iffff\0" /* Parameter signature */ - "glMultiTexCoord4f\0" - "glMultiTexCoord4fARB\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttribs3svNV_names[] = - "iip\0" /* Parameter signature */ - "glVertexAttribs3svNV\0" - ""; -#endif - -#if defined(need_GL_SUN_triangle_list) -static const char ReplacementCodeuivSUN_names[] = - "p\0" /* Parameter signature */ - "glReplacementCodeuivSUN\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char EnableVertexAttribArrayARB_names[] = - "i\0" /* Parameter signature */ - "glEnableVertexAttribArray\0" - "glEnableVertexAttribArrayARB\0" - ""; -#endif - -#if defined(need_GL_INTEL_parallel_arrays) -static const char NormalPointervINTEL_names[] = - "ip\0" /* Parameter signature */ - "glNormalPointervINTEL\0" - ""; -#endif - -#if defined(need_GL_EXT_convolution) -static const char CopyConvolutionFilter2D_names[] = - "iiiiii\0" /* Parameter signature */ - "glCopyConvolutionFilter2D\0" - "glCopyConvolutionFilter2DEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) -static const char WindowPos3ivMESA_names[] = - "p\0" /* Parameter signature */ - "glWindowPos3iv\0" - "glWindowPos3ivARB\0" - "glWindowPos3ivMESA\0" - ""; -#endif - -#if defined(need_GL_ARB_copy_buffer) -static const char CopyBufferSubData_names[] = - "iiiii\0" /* Parameter signature */ - "glCopyBufferSubData\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) -static const char IsBufferARB_names[] = - "i\0" /* Parameter signature */ - "glIsBuffer\0" - "glIsBufferARB\0" - ""; -#endif - -#if defined(need_GL_MESA_window_pos) -static const char WindowPos4iMESA_names[] = - "iiii\0" /* Parameter signature */ - "glWindowPos4iMESA\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib4uivARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib4uiv\0" - "glVertexAttrib4uivARB\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char Tangent3bvEXT_names[] = - "p\0" /* Parameter signature */ - "glTangent3bvEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_1) -static const char UniformMatrix3x4fv_names[] = - "iiip\0" /* Parameter signature */ - "glUniformMatrix3x4fv\0" - ""; -#endif - -#if defined(need_GL_ARB_draw_elements_base_vertex) -static const char DrawRangeElementsBaseVertex_names[] = - "iiiiipi\0" /* Parameter signature */ - "glDrawRangeElementsBaseVertex\0" - ""; -#endif - -#if defined(need_GL_INTEL_parallel_arrays) -static const char TexCoordPointervINTEL_names[] = - "iip\0" /* Parameter signature */ - "glTexCoordPointervINTEL\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) -static const char DeleteBuffersARB_names[] = - "ip\0" /* Parameter signature */ - "glDeleteBuffers\0" - "glDeleteBuffersARB\0" - ""; -#endif - -#if defined(need_GL_MESA_window_pos) -static const char WindowPos4fvMESA_names[] = - "p\0" /* Parameter signature */ - "glWindowPos4fvMESA\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib1sNV_names[] = - "ii\0" /* Parameter signature */ - "glVertexAttrib1sNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_secondary_color) -static const char SecondaryColor3svEXT_names[] = - "p\0" /* Parameter signature */ - "glSecondaryColor3sv\0" - "glSecondaryColor3svEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) || defined(need_GL_ARB_transpose_matrix) -static const char LoadTransposeMatrixfARB_names[] = - "p\0" /* Parameter signature */ - "glLoadTransposeMatrixf\0" - "glLoadTransposeMatrixfARB\0" - ""; -#endif - -#if defined(need_GL_EXT_vertex_array) -static const char GetPointerv_names[] = - "ip\0" /* Parameter signature */ - "glGetPointerv\0" - "glGetPointervEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char Tangent3bEXT_names[] = - "iii\0" /* Parameter signature */ - "glTangent3bEXT\0" - ""; -#endif - -#if defined(need_GL_NV_register_combiners) -static const char CombinerParameterfNV_names[] = - "if\0" /* Parameter signature */ - "glCombinerParameterfNV\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) -static const char BindProgramNV_names[] = - "ii\0" /* Parameter signature */ - "glBindProgramARB\0" - "glBindProgramNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib4svARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib4sv\0" - "glVertexAttrib4svARB\0" - ""; -#endif - -#if defined(need_GL_MESA_shader_debug) -static const char CreateDebugObjectMESA_names[] = - "\0" /* Parameter signature */ - "glCreateDebugObjectMESA\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) -static const char GetShaderiv_names[] = - "iip\0" /* Parameter signature */ - "glGetShaderiv\0" - ""; -#endif - -#if defined(need_GL_ARB_sync) -static const char ClientWaitSync_names[] = - "iii\0" /* Parameter signature */ - "glClientWaitSync\0" - ""; -#endif - -#if defined(need_GL_ATI_fragment_shader) -static const char BindFragmentShaderATI_names[] = - "i\0" /* Parameter signature */ - "glBindFragmentShaderATI\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) -static const char UnmapBufferARB_names[] = - "i\0" /* Parameter signature */ - "glUnmapBuffer\0" - "glUnmapBufferARB\0" - ""; -#endif - -#if defined(need_GL_EXT_histogram) -static const char Minmax_names[] = - "iii\0" /* Parameter signature */ - "glMinmax\0" - "glMinmaxEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_EXT_fog_coord) -static const char FogCoorddvEXT_names[] = - "p\0" /* Parameter signature */ - "glFogCoorddv\0" - "glFogCoorddvEXT\0" - ""; -#endif - -#if defined(need_GL_SUNX_constant_data) -static const char FinishTextureSUNX_names[] = - "\0" /* Parameter signature */ - "glFinishTextureSUNX\0" - ""; -#endif - -#if defined(need_GL_SGIX_fragment_lighting) -static const char GetFragmentLightfvSGIX_names[] = - "iip\0" /* Parameter signature */ - "glGetFragmentLightfvSGIX\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char Binormal3fvEXT_names[] = - "p\0" /* Parameter signature */ - "glBinormal3fvEXT\0" - ""; -#endif - -#if defined(need_GL_ATI_fragment_shader) -static const char ColorFragmentOp3ATI_names[] = - "iiiiiiiiiiiii\0" /* Parameter signature */ - "glColorFragmentOp3ATI\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib2svARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib2sv\0" - "glVertexAttrib2svARB\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char AreProgramsResidentNV_names[] = - "ipp\0" /* Parameter signature */ - "glAreProgramsResidentNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) -static const char WindowPos3svMESA_names[] = - "p\0" /* Parameter signature */ - "glWindowPos3sv\0" - "glWindowPos3svARB\0" - "glWindowPos3svMESA\0" - ""; -#endif - -#if defined(need_GL_EXT_color_subtable) -static const char CopyColorSubTable_names[] = - "iiiii\0" /* Parameter signature */ - "glCopyColorSubTable\0" - "glCopyColorSubTableEXT\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_blend) -static const char WeightdvARB_names[] = - "ip\0" /* Parameter signature */ - "glWeightdvARB\0" - ""; -#endif - -#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) -static const char DeleteRenderbuffersEXT_names[] = - "ip\0" /* Parameter signature */ - "glDeleteRenderbuffers\0" - "glDeleteRenderbuffersEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib4NubvARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib4Nubv\0" - "glVertexAttrib4NubvARB\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib3dvNV_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib3dvNV\0" - ""; -#endif - -#if defined(need_GL_ARB_shader_objects) -static const char GetObjectParameterfvARB_names[] = - "iip\0" /* Parameter signature */ - "glGetObjectParameterfvARB\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_program) -static const char GetProgramEnvParameterdvARB_names[] = - "iip\0" /* Parameter signature */ - "glGetProgramEnvParameterdvARB\0" - ""; -#endif - -#if defined(need_GL_EXT_compiled_vertex_array) -static const char LockArraysEXT_names[] = - "ii\0" /* Parameter signature */ - "glLockArraysEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_pixel_transform) -static const char PixelTransformParameterivEXT_names[] = - "iip\0" /* Parameter signature */ - "glPixelTransformParameterivEXT\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char BinormalPointerEXT_names[] = - "iip\0" /* Parameter signature */ - "glBinormalPointerEXT\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib1dNV_names[] = - "id\0" /* Parameter signature */ - "glVertexAttrib1dNV\0" - ""; -#endif - -#if defined(need_GL_NV_register_combiners) -static const char GetCombinerInputParameterivNV_names[] = - "iiiip\0" /* Parameter signature */ - "glGetCombinerInputParameterivNV\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_3) -static const char MultiTexCoord2fvARB_names[] = - "ip\0" /* Parameter signature */ - "glMultiTexCoord2fv\0" - "glMultiTexCoord2fvARB\0" - ""; -#endif - -#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) -static const char GetRenderbufferParameterivEXT_names[] = - "iip\0" /* Parameter signature */ - "glGetRenderbufferParameteriv\0" - "glGetRenderbufferParameterivEXT\0" - ""; -#endif - -#if defined(need_GL_NV_register_combiners) -static const char CombinerParameterivNV_names[] = - "ip\0" /* Parameter signature */ - "glCombinerParameterivNV\0" - ""; -#endif - -#if defined(need_GL_ATI_fragment_shader) -static const char GenFragmentShadersATI_names[] = - "i\0" /* Parameter signature */ - "glGenFragmentShadersATI\0" - ""; -#endif - -#if defined(need_GL_EXT_vertex_array) -static const char DrawArrays_names[] = - "iii\0" /* Parameter signature */ - "glDrawArrays\0" - "glDrawArraysEXT\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_blend) -static const char WeightuivARB_names[] = - "ip\0" /* Parameter signature */ - "glWeightuivARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib2sARB_names[] = - "iii\0" /* Parameter signature */ - "glVertexAttrib2s\0" - "glVertexAttrib2sARB\0" - ""; -#endif - -#if defined(need_GL_SGIX_async) -static const char GenAsyncMarkersSGIX_names[] = - "i\0" /* Parameter signature */ - "glGenAsyncMarkersSGIX\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char Tangent3svEXT_names[] = - "p\0" /* Parameter signature */ - "glTangent3svEXT\0" - ""; -#endif - -#if defined(need_GL_SGIX_list_priority) -static const char GetListParameterivSGIX_names[] = - "iip\0" /* Parameter signature */ - "glGetListParameterivSGIX\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) -static const char BindBufferARB_names[] = - "ii\0" /* Parameter signature */ - "glBindBuffer\0" - "glBindBufferARB\0" - ""; -#endif - -#if defined(need_GL_ARB_shader_objects) -static const char GetInfoLogARB_names[] = - "iipp\0" /* Parameter signature */ - "glGetInfoLogARB\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttribs4svNV_names[] = - "iip\0" /* Parameter signature */ - "glVertexAttribs4svNV\0" - ""; -#endif - -#if defined(need_GL_IBM_vertex_array_lists) -static const char EdgeFlagPointerListIBM_names[] = - "ipi\0" /* Parameter signature */ - "glEdgeFlagPointerListIBM\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_1) -static const char UniformMatrix3x2fv_names[] = - "iiip\0" /* Parameter signature */ - "glUniformMatrix3x2fv\0" - ""; -#endif - -#if defined(need_GL_EXT_histogram) -static const char GetMinmaxParameterfv_names[] = - "iip\0" /* Parameter signature */ - "glGetMinmaxParameterfv\0" - "glGetMinmaxParameterfvEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_2_0) || defined(need_GL_ARB_vertex_program) -static const char VertexAttrib1fvARB_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib1fv\0" - "glVertexAttrib1fvARB\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_5) || defined(need_GL_ARB_vertex_buffer_object) -static const char GenBuffersARB_names[] = - "ip\0" /* Parameter signature */ - "glGenBuffers\0" - "glGenBuffersARB\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttribs1svNV_names[] = - "iip\0" /* Parameter signature */ - "glVertexAttribs1svNV\0" - ""; -#endif - -#if defined(need_GL_ATI_envmap_bumpmap) -static const char GetTexBumpParameterivATI_names[] = - "ip\0" /* Parameter signature */ - "glGetTexBumpParameterivATI\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char Binormal3bEXT_names[] = - "iii\0" /* Parameter signature */ - "glBinormal3bEXT\0" - ""; -#endif - -#if defined(need_GL_SGIX_fragment_lighting) -static const char FragmentMaterialivSGIX_names[] = - "iip\0" /* Parameter signature */ - "glFragmentMaterialivSGIX\0" - ""; -#endif - -#if defined(need_GL_ARB_framebuffer_object) || defined(need_GL_EXT_framebuffer_object) -static const char IsRenderbufferEXT_names[] = - "i\0" /* Parameter signature */ - "glIsRenderbuffer\0" - "glIsRenderbufferEXT\0" - ""; -#endif - -#if defined(need_GL_ARB_vertex_program) || defined(need_GL_NV_vertex_program) -static const char GenProgramsNV_names[] = - "ip\0" /* Parameter signature */ - "glGenProgramsARB\0" - "glGenProgramsNV\0" - ""; -#endif - -#if defined(need_GL_NV_vertex_program) -static const char VertexAttrib4dvNV_names[] = - "ip\0" /* Parameter signature */ - "glVertexAttrib4dvNV\0" - ""; -#endif - -#if defined(need_GL_ATI_fragment_shader) -static const char EndFragmentShaderATI_names[] = - "\0" /* Parameter signature */ - "glEndFragmentShaderATI\0" - ""; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const char Binormal3iEXT_names[] = - "iii\0" /* Parameter signature */ - "glBinormal3iEXT\0" - ""; -#endif - -#if defined(need_GL_VERSION_1_4) || defined(need_GL_ARB_window_pos) || defined(need_GL_MESA_window_pos) -static const char WindowPos2fMESA_names[] = - "ff\0" /* Parameter signature */ - "glWindowPos2f\0" - "glWindowPos2fARB\0" - "glWindowPos2fMESA\0" - ""; -#endif - -#if defined(need_GL_3DFX_tbuffer) -static const struct dri_extension_function GL_3DFX_tbuffer_functions[] = { - { TbufferMask3DFX_names, TbufferMask3DFX_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_APPLE_flush_buffer_range) -static const struct dri_extension_function GL_APPLE_flush_buffer_range_functions[] = { - { BufferParameteriAPPLE_names, BufferParameteriAPPLE_remap_index, -1 }, - { FlushMappedBufferRangeAPPLE_names, FlushMappedBufferRangeAPPLE_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_APPLE_texture_range) -static const struct dri_extension_function GL_APPLE_texture_range_functions[] = { - { TextureRangeAPPLE_names, TextureRangeAPPLE_remap_index, -1 }, - { GetTexParameterPointervAPPLE_names, GetTexParameterPointervAPPLE_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_APPLE_vertex_array_object) -static const struct dri_extension_function GL_APPLE_vertex_array_object_functions[] = { - { DeleteVertexArraysAPPLE_names, DeleteVertexArraysAPPLE_remap_index, -1 }, - { GenVertexArraysAPPLE_names, GenVertexArraysAPPLE_remap_index, -1 }, - { IsVertexArrayAPPLE_names, IsVertexArrayAPPLE_remap_index, -1 }, - { BindVertexArrayAPPLE_names, BindVertexArrayAPPLE_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ARB_copy_buffer) -static const struct dri_extension_function GL_ARB_copy_buffer_functions[] = { - { CopyBufferSubData_names, CopyBufferSubData_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ARB_draw_buffers) -static const struct dri_extension_function GL_ARB_draw_buffers_functions[] = { - { DrawBuffersARB_names, DrawBuffersARB_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ARB_draw_elements_base_vertex) -static const struct dri_extension_function GL_ARB_draw_elements_base_vertex_functions[] = { - { DrawElementsBaseVertex_names, DrawElementsBaseVertex_remap_index, -1 }, - { MultiDrawElementsBaseVertex_names, MultiDrawElementsBaseVertex_remap_index, -1 }, - { DrawRangeElementsBaseVertex_names, DrawRangeElementsBaseVertex_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ARB_framebuffer_object) -static const struct dri_extension_function GL_ARB_framebuffer_object_functions[] = { - { BlitFramebufferEXT_names, BlitFramebufferEXT_remap_index, -1 }, - { FramebufferTextureLayerEXT_names, FramebufferTextureLayerEXT_remap_index, -1 }, - { GenerateMipmapEXT_names, GenerateMipmapEXT_remap_index, -1 }, - { RenderbufferStorageEXT_names, RenderbufferStorageEXT_remap_index, -1 }, - { CheckFramebufferStatusEXT_names, CheckFramebufferStatusEXT_remap_index, -1 }, - { FramebufferTexture3DEXT_names, FramebufferTexture3DEXT_remap_index, -1 }, - { FramebufferTexture2DEXT_names, FramebufferTexture2DEXT_remap_index, -1 }, - { RenderbufferStorageMultisample_names, RenderbufferStorageMultisample_remap_index, -1 }, - { FramebufferRenderbufferEXT_names, FramebufferRenderbufferEXT_remap_index, -1 }, - { FramebufferTexture1DEXT_names, FramebufferTexture1DEXT_remap_index, -1 }, - { BindFramebufferEXT_names, BindFramebufferEXT_remap_index, -1 }, - { GenRenderbuffersEXT_names, GenRenderbuffersEXT_remap_index, -1 }, - { IsFramebufferEXT_names, IsFramebufferEXT_remap_index, -1 }, - { GetFramebufferAttachmentParameterivEXT_names, GetFramebufferAttachmentParameterivEXT_remap_index, -1 }, - { DeleteFramebuffersEXT_names, DeleteFramebuffersEXT_remap_index, -1 }, - { GenFramebuffersEXT_names, GenFramebuffersEXT_remap_index, -1 }, - { BindRenderbufferEXT_names, BindRenderbufferEXT_remap_index, -1 }, - { DeleteRenderbuffersEXT_names, DeleteRenderbuffersEXT_remap_index, -1 }, - { GetRenderbufferParameterivEXT_names, GetRenderbufferParameterivEXT_remap_index, -1 }, - { IsRenderbufferEXT_names, IsRenderbufferEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ARB_map_buffer_range) -static const struct dri_extension_function GL_ARB_map_buffer_range_functions[] = { - { FlushMappedBufferRange_names, FlushMappedBufferRange_remap_index, -1 }, - { MapBufferRange_names, MapBufferRange_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ARB_matrix_palette) -static const struct dri_extension_function GL_ARB_matrix_palette_functions[] = { - { MatrixIndexusvARB_names, MatrixIndexusvARB_remap_index, -1 }, - { MatrixIndexuivARB_names, MatrixIndexuivARB_remap_index, -1 }, - { MatrixIndexPointerARB_names, MatrixIndexPointerARB_remap_index, -1 }, - { CurrentPaletteMatrixARB_names, CurrentPaletteMatrixARB_remap_index, -1 }, - { MatrixIndexubvARB_names, MatrixIndexubvARB_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ARB_multisample) -static const struct dri_extension_function GL_ARB_multisample_functions[] = { - { SampleCoverageARB_names, SampleCoverageARB_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ARB_occlusion_query) -static const struct dri_extension_function GL_ARB_occlusion_query_functions[] = { - { BeginQueryARB_names, BeginQueryARB_remap_index, -1 }, - { GetQueryivARB_names, GetQueryivARB_remap_index, -1 }, - { GetQueryObjectivARB_names, GetQueryObjectivARB_remap_index, -1 }, - { EndQueryARB_names, EndQueryARB_remap_index, -1 }, - { GetQueryObjectuivARB_names, GetQueryObjectuivARB_remap_index, -1 }, - { DeleteQueriesARB_names, DeleteQueriesARB_remap_index, -1 }, - { IsQueryARB_names, IsQueryARB_remap_index, -1 }, - { GenQueriesARB_names, GenQueriesARB_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ARB_point_parameters) -static const struct dri_extension_function GL_ARB_point_parameters_functions[] = { - { PointParameterfEXT_names, PointParameterfEXT_remap_index, -1 }, - { PointParameterfvEXT_names, PointParameterfvEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ARB_provoking_vertex) -static const struct dri_extension_function GL_ARB_provoking_vertex_functions[] = { - { ProvokingVertexEXT_names, ProvokingVertexEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ARB_shader_objects) -static const struct dri_extension_function GL_ARB_shader_objects_functions[] = { - { UniformMatrix3fvARB_names, UniformMatrix3fvARB_remap_index, -1 }, - { Uniform2fARB_names, Uniform2fARB_remap_index, -1 }, - { Uniform2ivARB_names, Uniform2ivARB_remap_index, -1 }, - { UniformMatrix4fvARB_names, UniformMatrix4fvARB_remap_index, -1 }, - { CreateProgramObjectARB_names, CreateProgramObjectARB_remap_index, -1 }, - { Uniform3iARB_names, Uniform3iARB_remap_index, -1 }, - { CreateShaderObjectARB_names, CreateShaderObjectARB_remap_index, -1 }, - { Uniform1fARB_names, Uniform1fARB_remap_index, -1 }, - { AttachObjectARB_names, AttachObjectARB_remap_index, -1 }, - { UniformMatrix2fvARB_names, UniformMatrix2fvARB_remap_index, -1 }, - { GetAttachedObjectsARB_names, GetAttachedObjectsARB_remap_index, -1 }, - { Uniform3fvARB_names, Uniform3fvARB_remap_index, -1 }, - { GetHandleARB_names, GetHandleARB_remap_index, -1 }, - { GetActiveUniformARB_names, GetActiveUniformARB_remap_index, -1 }, - { GetUniformivARB_names, GetUniformivARB_remap_index, -1 }, - { Uniform2fvARB_names, Uniform2fvARB_remap_index, -1 }, - { DeleteObjectARB_names, DeleteObjectARB_remap_index, -1 }, - { ValidateProgramARB_names, ValidateProgramARB_remap_index, -1 }, - { Uniform3ivARB_names, Uniform3ivARB_remap_index, -1 }, - { CompileShaderARB_names, CompileShaderARB_remap_index, -1 }, - { Uniform3fARB_names, Uniform3fARB_remap_index, -1 }, - { Uniform4fARB_names, Uniform4fARB_remap_index, -1 }, - { LinkProgramARB_names, LinkProgramARB_remap_index, -1 }, - { ShaderSourceARB_names, ShaderSourceARB_remap_index, -1 }, - { Uniform4ivARB_names, Uniform4ivARB_remap_index, -1 }, - { Uniform1ivARB_names, Uniform1ivARB_remap_index, -1 }, - { Uniform1iARB_names, Uniform1iARB_remap_index, -1 }, - { Uniform4fvARB_names, Uniform4fvARB_remap_index, -1 }, - { GetUniformfvARB_names, GetUniformfvARB_remap_index, -1 }, - { DetachObjectARB_names, DetachObjectARB_remap_index, -1 }, - { Uniform4iARB_names, Uniform4iARB_remap_index, -1 }, - { UseProgramObjectARB_names, UseProgramObjectARB_remap_index, -1 }, - { Uniform2iARB_names, Uniform2iARB_remap_index, -1 }, - { GetObjectParameterivARB_names, GetObjectParameterivARB_remap_index, -1 }, - { GetUniformLocationARB_names, GetUniformLocationARB_remap_index, -1 }, - { GetShaderSourceARB_names, GetShaderSourceARB_remap_index, -1 }, - { Uniform1fvARB_names, Uniform1fvARB_remap_index, -1 }, - { GetObjectParameterfvARB_names, GetObjectParameterfvARB_remap_index, -1 }, - { GetInfoLogARB_names, GetInfoLogARB_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ARB_sync) -static const struct dri_extension_function GL_ARB_sync_functions[] = { - { DeleteSync_names, DeleteSync_remap_index, -1 }, - { FenceSync_names, FenceSync_remap_index, -1 }, - { WaitSync_names, WaitSync_remap_index, -1 }, - { GetInteger64v_names, GetInteger64v_remap_index, -1 }, - { GetSynciv_names, GetSynciv_remap_index, -1 }, - { IsSync_names, IsSync_remap_index, -1 }, - { ClientWaitSync_names, ClientWaitSync_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ARB_texture_compression) -static const struct dri_extension_function GL_ARB_texture_compression_functions[] = { - { CompressedTexSubImage2DARB_names, CompressedTexSubImage2DARB_remap_index, -1 }, - { CompressedTexImage3DARB_names, CompressedTexImage3DARB_remap_index, -1 }, - { CompressedTexImage1DARB_names, CompressedTexImage1DARB_remap_index, -1 }, - { CompressedTexSubImage1DARB_names, CompressedTexSubImage1DARB_remap_index, -1 }, - { CompressedTexSubImage3DARB_names, CompressedTexSubImage3DARB_remap_index, -1 }, - { CompressedTexImage2DARB_names, CompressedTexImage2DARB_remap_index, -1 }, - { GetCompressedTexImageARB_names, GetCompressedTexImageARB_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ARB_transpose_matrix) -static const struct dri_extension_function GL_ARB_transpose_matrix_functions[] = { - { MultTransposeMatrixdARB_names, MultTransposeMatrixdARB_remap_index, -1 }, - { LoadTransposeMatrixdARB_names, LoadTransposeMatrixdARB_remap_index, -1 }, - { MultTransposeMatrixfARB_names, MultTransposeMatrixfARB_remap_index, -1 }, - { LoadTransposeMatrixfARB_names, LoadTransposeMatrixfARB_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ARB_vertex_array_object) -static const struct dri_extension_function GL_ARB_vertex_array_object_functions[] = { - { DeleteVertexArraysAPPLE_names, DeleteVertexArraysAPPLE_remap_index, -1 }, - { GenVertexArrays_names, GenVertexArrays_remap_index, -1 }, - { BindVertexArray_names, BindVertexArray_remap_index, -1 }, - { IsVertexArrayAPPLE_names, IsVertexArrayAPPLE_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ARB_vertex_blend) -static const struct dri_extension_function GL_ARB_vertex_blend_functions[] = { - { WeightubvARB_names, WeightubvARB_remap_index, -1 }, - { WeightivARB_names, WeightivARB_remap_index, -1 }, - { WeightPointerARB_names, WeightPointerARB_remap_index, -1 }, - { WeightfvARB_names, WeightfvARB_remap_index, -1 }, - { WeightbvARB_names, WeightbvARB_remap_index, -1 }, - { WeightusvARB_names, WeightusvARB_remap_index, -1 }, - { VertexBlendARB_names, VertexBlendARB_remap_index, -1 }, - { WeightsvARB_names, WeightsvARB_remap_index, -1 }, - { WeightdvARB_names, WeightdvARB_remap_index, -1 }, - { WeightuivARB_names, WeightuivARB_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ARB_vertex_buffer_object) -static const struct dri_extension_function GL_ARB_vertex_buffer_object_functions[] = { - { GetBufferSubDataARB_names, GetBufferSubDataARB_remap_index, -1 }, - { BufferSubDataARB_names, BufferSubDataARB_remap_index, -1 }, - { BufferDataARB_names, BufferDataARB_remap_index, -1 }, - { GetBufferPointervARB_names, GetBufferPointervARB_remap_index, -1 }, - { GetBufferParameterivARB_names, GetBufferParameterivARB_remap_index, -1 }, - { MapBufferARB_names, MapBufferARB_remap_index, -1 }, - { IsBufferARB_names, IsBufferARB_remap_index, -1 }, - { DeleteBuffersARB_names, DeleteBuffersARB_remap_index, -1 }, - { UnmapBufferARB_names, UnmapBufferARB_remap_index, -1 }, - { BindBufferARB_names, BindBufferARB_remap_index, -1 }, - { GenBuffersARB_names, GenBuffersARB_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ARB_vertex_program) -static const struct dri_extension_function GL_ARB_vertex_program_functions[] = { - { VertexAttrib2fARB_names, VertexAttrib2fARB_remap_index, -1 }, - { VertexAttrib3fARB_names, VertexAttrib3fARB_remap_index, -1 }, - { VertexAttrib1svARB_names, VertexAttrib1svARB_remap_index, -1 }, - { VertexAttrib4NusvARB_names, VertexAttrib4NusvARB_remap_index, -1 }, - { DisableVertexAttribArrayARB_names, DisableVertexAttribArrayARB_remap_index, -1 }, - { ProgramLocalParameter4dARB_names, ProgramLocalParameter4dARB_remap_index, -1 }, - { VertexAttrib1fARB_names, VertexAttrib1fARB_remap_index, -1 }, - { VertexAttrib4NbvARB_names, VertexAttrib4NbvARB_remap_index, -1 }, - { VertexAttrib1sARB_names, VertexAttrib1sARB_remap_index, -1 }, - { GetProgramLocalParameterfvARB_names, GetProgramLocalParameterfvARB_remap_index, -1 }, - { VertexAttrib3dvARB_names, VertexAttrib3dvARB_remap_index, -1 }, - { ProgramEnvParameter4fvARB_names, ProgramEnvParameter4fvARB_remap_index, -1 }, - { GetVertexAttribivARB_names, GetVertexAttribivARB_remap_index, -1 }, - { VertexAttrib4ivARB_names, VertexAttrib4ivARB_remap_index, -1 }, - { VertexAttrib4bvARB_names, VertexAttrib4bvARB_remap_index, -1 }, - { VertexAttrib3dARB_names, VertexAttrib3dARB_remap_index, -1 }, - { VertexAttrib4fARB_names, VertexAttrib4fARB_remap_index, -1 }, - { VertexAttrib4fvARB_names, VertexAttrib4fvARB_remap_index, -1 }, - { ProgramLocalParameter4dvARB_names, ProgramLocalParameter4dvARB_remap_index, -1 }, - { VertexAttrib2dARB_names, VertexAttrib2dARB_remap_index, -1 }, - { VertexAttrib1dvARB_names, VertexAttrib1dvARB_remap_index, -1 }, - { GetVertexAttribfvARB_names, GetVertexAttribfvARB_remap_index, -1 }, - { VertexAttrib4ubvARB_names, VertexAttrib4ubvARB_remap_index, -1 }, - { ProgramEnvParameter4fARB_names, ProgramEnvParameter4fARB_remap_index, -1 }, - { VertexAttrib4sARB_names, VertexAttrib4sARB_remap_index, -1 }, - { VertexAttrib2dvARB_names, VertexAttrib2dvARB_remap_index, -1 }, - { VertexAttrib2fvARB_names, VertexAttrib2fvARB_remap_index, -1 }, - { VertexAttrib4NivARB_names, VertexAttrib4NivARB_remap_index, -1 }, - { GetProgramStringARB_names, GetProgramStringARB_remap_index, -1 }, - { VertexAttrib4NuivARB_names, VertexAttrib4NuivARB_remap_index, -1 }, - { IsProgramNV_names, IsProgramNV_remap_index, -1 }, - { ProgramEnvParameter4dARB_names, ProgramEnvParameter4dARB_remap_index, -1 }, - { VertexAttrib1dARB_names, VertexAttrib1dARB_remap_index, -1 }, - { VertexAttrib4usvARB_names, VertexAttrib4usvARB_remap_index, -1 }, - { VertexAttrib3svARB_names, VertexAttrib3svARB_remap_index, -1 }, - { GetVertexAttribdvARB_names, GetVertexAttribdvARB_remap_index, -1 }, - { VertexAttrib4dvARB_names, VertexAttrib4dvARB_remap_index, -1 }, - { VertexAttribPointerARB_names, VertexAttribPointerARB_remap_index, -1 }, - { VertexAttrib4NsvARB_names, VertexAttrib4NsvARB_remap_index, -1 }, - { VertexAttrib3fvARB_names, VertexAttrib3fvARB_remap_index, -1 }, - { VertexAttrib4NubARB_names, VertexAttrib4NubARB_remap_index, -1 }, - { GetProgramEnvParameterfvARB_names, GetProgramEnvParameterfvARB_remap_index, -1 }, - { ProgramEnvParameter4dvARB_names, ProgramEnvParameter4dvARB_remap_index, -1 }, - { ProgramLocalParameter4fvARB_names, ProgramLocalParameter4fvARB_remap_index, -1 }, - { DeleteProgramsNV_names, DeleteProgramsNV_remap_index, -1 }, - { GetVertexAttribPointervNV_names, GetVertexAttribPointervNV_remap_index, -1 }, - { VertexAttrib4dARB_names, VertexAttrib4dARB_remap_index, -1 }, - { GetProgramLocalParameterdvARB_names, GetProgramLocalParameterdvARB_remap_index, -1 }, - { GetProgramivARB_names, GetProgramivARB_remap_index, -1 }, - { VertexAttrib3sARB_names, VertexAttrib3sARB_remap_index, -1 }, - { ProgramStringARB_names, ProgramStringARB_remap_index, -1 }, - { ProgramLocalParameter4fARB_names, ProgramLocalParameter4fARB_remap_index, -1 }, - { EnableVertexAttribArrayARB_names, EnableVertexAttribArrayARB_remap_index, -1 }, - { VertexAttrib4uivARB_names, VertexAttrib4uivARB_remap_index, -1 }, - { BindProgramNV_names, BindProgramNV_remap_index, -1 }, - { VertexAttrib4svARB_names, VertexAttrib4svARB_remap_index, -1 }, - { VertexAttrib2svARB_names, VertexAttrib2svARB_remap_index, -1 }, - { VertexAttrib4NubvARB_names, VertexAttrib4NubvARB_remap_index, -1 }, - { GetProgramEnvParameterdvARB_names, GetProgramEnvParameterdvARB_remap_index, -1 }, - { VertexAttrib2sARB_names, VertexAttrib2sARB_remap_index, -1 }, - { VertexAttrib1fvARB_names, VertexAttrib1fvARB_remap_index, -1 }, - { GenProgramsNV_names, GenProgramsNV_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ARB_vertex_shader) -static const struct dri_extension_function GL_ARB_vertex_shader_functions[] = { - { GetActiveAttribARB_names, GetActiveAttribARB_remap_index, -1 }, - { GetAttribLocationARB_names, GetAttribLocationARB_remap_index, -1 }, - { BindAttribLocationARB_names, BindAttribLocationARB_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ARB_window_pos) -static const struct dri_extension_function GL_ARB_window_pos_functions[] = { - { WindowPos3fMESA_names, WindowPos3fMESA_remap_index, -1 }, - { WindowPos2dvMESA_names, WindowPos2dvMESA_remap_index, -1 }, - { WindowPos2svMESA_names, WindowPos2svMESA_remap_index, -1 }, - { WindowPos3dMESA_names, WindowPos3dMESA_remap_index, -1 }, - { WindowPos2fvMESA_names, WindowPos2fvMESA_remap_index, -1 }, - { WindowPos2dMESA_names, WindowPos2dMESA_remap_index, -1 }, - { WindowPos3dvMESA_names, WindowPos3dvMESA_remap_index, -1 }, - { WindowPos3fvMESA_names, WindowPos3fvMESA_remap_index, -1 }, - { WindowPos2iMESA_names, WindowPos2iMESA_remap_index, -1 }, - { WindowPos3sMESA_names, WindowPos3sMESA_remap_index, -1 }, - { WindowPos2ivMESA_names, WindowPos2ivMESA_remap_index, -1 }, - { WindowPos2sMESA_names, WindowPos2sMESA_remap_index, -1 }, - { WindowPos3iMESA_names, WindowPos3iMESA_remap_index, -1 }, - { WindowPos3ivMESA_names, WindowPos3ivMESA_remap_index, -1 }, - { WindowPos3svMESA_names, WindowPos3svMESA_remap_index, -1 }, - { WindowPos2fMESA_names, WindowPos2fMESA_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ATI_blend_equation_separate) -static const struct dri_extension_function GL_ATI_blend_equation_separate_functions[] = { - { BlendEquationSeparateEXT_names, BlendEquationSeparateEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ATI_draw_buffers) -static const struct dri_extension_function GL_ATI_draw_buffers_functions[] = { - { DrawBuffersARB_names, DrawBuffersARB_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ATI_envmap_bumpmap) -static const struct dri_extension_function GL_ATI_envmap_bumpmap_functions[] = { - { TexBumpParameterfvATI_names, TexBumpParameterfvATI_remap_index, -1 }, - { TexBumpParameterivATI_names, TexBumpParameterivATI_remap_index, -1 }, - { GetTexBumpParameterfvATI_names, GetTexBumpParameterfvATI_remap_index, -1 }, - { GetTexBumpParameterivATI_names, GetTexBumpParameterivATI_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ATI_fragment_shader) -static const struct dri_extension_function GL_ATI_fragment_shader_functions[] = { - { ColorFragmentOp2ATI_names, ColorFragmentOp2ATI_remap_index, -1 }, - { DeleteFragmentShaderATI_names, DeleteFragmentShaderATI_remap_index, -1 }, - { SetFragmentShaderConstantATI_names, SetFragmentShaderConstantATI_remap_index, -1 }, - { SampleMapATI_names, SampleMapATI_remap_index, -1 }, - { AlphaFragmentOp2ATI_names, AlphaFragmentOp2ATI_remap_index, -1 }, - { AlphaFragmentOp1ATI_names, AlphaFragmentOp1ATI_remap_index, -1 }, - { ColorFragmentOp1ATI_names, ColorFragmentOp1ATI_remap_index, -1 }, - { AlphaFragmentOp3ATI_names, AlphaFragmentOp3ATI_remap_index, -1 }, - { PassTexCoordATI_names, PassTexCoordATI_remap_index, -1 }, - { BeginFragmentShaderATI_names, BeginFragmentShaderATI_remap_index, -1 }, - { BindFragmentShaderATI_names, BindFragmentShaderATI_remap_index, -1 }, - { ColorFragmentOp3ATI_names, ColorFragmentOp3ATI_remap_index, -1 }, - { GenFragmentShadersATI_names, GenFragmentShadersATI_remap_index, -1 }, - { EndFragmentShaderATI_names, EndFragmentShaderATI_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_ATI_separate_stencil) -static const struct dri_extension_function GL_ATI_separate_stencil_functions[] = { - { StencilOpSeparate_names, StencilOpSeparate_remap_index, -1 }, - { StencilFuncSeparateATI_names, StencilFuncSeparateATI_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_blend_color) -static const struct dri_extension_function GL_EXT_blend_color_functions[] = { - { BlendColor_names, -1, 336 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_blend_equation_separate) -static const struct dri_extension_function GL_EXT_blend_equation_separate_functions[] = { - { BlendEquationSeparateEXT_names, BlendEquationSeparateEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_blend_func_separate) -static const struct dri_extension_function GL_EXT_blend_func_separate_functions[] = { - { BlendFuncSeparateEXT_names, BlendFuncSeparateEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_blend_minmax) -static const struct dri_extension_function GL_EXT_blend_minmax_functions[] = { - { BlendEquation_names, -1, 337 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_color_subtable) -static const struct dri_extension_function GL_EXT_color_subtable_functions[] = { - { ColorSubTable_names, -1, 346 }, - { CopyColorSubTable_names, -1, 347 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_compiled_vertex_array) -static const struct dri_extension_function GL_EXT_compiled_vertex_array_functions[] = { - { UnlockArraysEXT_names, UnlockArraysEXT_remap_index, -1 }, - { LockArraysEXT_names, LockArraysEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_convolution) -static const struct dri_extension_function GL_EXT_convolution_functions[] = { - { ConvolutionFilter1D_names, -1, 348 }, - { CopyConvolutionFilter1D_names, -1, 354 }, - { GetConvolutionParameteriv_names, -1, 358 }, - { ConvolutionFilter2D_names, -1, 349 }, - { ConvolutionParameteriv_names, -1, 353 }, - { ConvolutionParameterfv_names, -1, 351 }, - { GetSeparableFilter_names, -1, 359 }, - { SeparableFilter2D_names, -1, 360 }, - { ConvolutionParameteri_names, -1, 352 }, - { ConvolutionParameterf_names, -1, 350 }, - { GetConvolutionParameterfv_names, -1, 357 }, - { GetConvolutionFilter_names, -1, 356 }, - { CopyConvolutionFilter2D_names, -1, 355 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_coordinate_frame) -static const struct dri_extension_function GL_EXT_coordinate_frame_functions[] = { - { TangentPointerEXT_names, TangentPointerEXT_remap_index, -1 }, - { Binormal3ivEXT_names, Binormal3ivEXT_remap_index, -1 }, - { Tangent3sEXT_names, Tangent3sEXT_remap_index, -1 }, - { Tangent3fvEXT_names, Tangent3fvEXT_remap_index, -1 }, - { Tangent3dvEXT_names, Tangent3dvEXT_remap_index, -1 }, - { Binormal3bvEXT_names, Binormal3bvEXT_remap_index, -1 }, - { Binormal3dEXT_names, Binormal3dEXT_remap_index, -1 }, - { Tangent3fEXT_names, Tangent3fEXT_remap_index, -1 }, - { Binormal3sEXT_names, Binormal3sEXT_remap_index, -1 }, - { Tangent3ivEXT_names, Tangent3ivEXT_remap_index, -1 }, - { Tangent3dEXT_names, Tangent3dEXT_remap_index, -1 }, - { Binormal3svEXT_names, Binormal3svEXT_remap_index, -1 }, - { Binormal3fEXT_names, Binormal3fEXT_remap_index, -1 }, - { Binormal3dvEXT_names, Binormal3dvEXT_remap_index, -1 }, - { Tangent3iEXT_names, Tangent3iEXT_remap_index, -1 }, - { Tangent3bvEXT_names, Tangent3bvEXT_remap_index, -1 }, - { Tangent3bEXT_names, Tangent3bEXT_remap_index, -1 }, - { Binormal3fvEXT_names, Binormal3fvEXT_remap_index, -1 }, - { BinormalPointerEXT_names, BinormalPointerEXT_remap_index, -1 }, - { Tangent3svEXT_names, Tangent3svEXT_remap_index, -1 }, - { Binormal3bEXT_names, Binormal3bEXT_remap_index, -1 }, - { Binormal3iEXT_names, Binormal3iEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_copy_texture) -static const struct dri_extension_function GL_EXT_copy_texture_functions[] = { - { CopyTexSubImage3D_names, -1, 373 }, - { CopyTexImage2D_names, -1, 324 }, - { CopyTexImage1D_names, -1, 323 }, - { CopyTexSubImage2D_names, -1, 326 }, - { CopyTexSubImage1D_names, -1, 325 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_cull_vertex) -static const struct dri_extension_function GL_EXT_cull_vertex_functions[] = { - { CullParameterdvEXT_names, CullParameterdvEXT_remap_index, -1 }, - { CullParameterfvEXT_names, CullParameterfvEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_depth_bounds_test) -static const struct dri_extension_function GL_EXT_depth_bounds_test_functions[] = { - { DepthBoundsEXT_names, DepthBoundsEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_draw_range_elements) -static const struct dri_extension_function GL_EXT_draw_range_elements_functions[] = { - { DrawRangeElements_names, -1, 338 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_fog_coord) -static const struct dri_extension_function GL_EXT_fog_coord_functions[] = { - { FogCoorddEXT_names, FogCoorddEXT_remap_index, -1 }, - { FogCoordfEXT_names, FogCoordfEXT_remap_index, -1 }, - { FogCoordPointerEXT_names, FogCoordPointerEXT_remap_index, -1 }, - { FogCoordfvEXT_names, FogCoordfvEXT_remap_index, -1 }, - { FogCoorddvEXT_names, FogCoorddvEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_framebuffer_blit) -static const struct dri_extension_function GL_EXT_framebuffer_blit_functions[] = { - { BlitFramebufferEXT_names, BlitFramebufferEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_framebuffer_object) -static const struct dri_extension_function GL_EXT_framebuffer_object_functions[] = { - { GenerateMipmapEXT_names, GenerateMipmapEXT_remap_index, -1 }, - { RenderbufferStorageEXT_names, RenderbufferStorageEXT_remap_index, -1 }, - { CheckFramebufferStatusEXT_names, CheckFramebufferStatusEXT_remap_index, -1 }, - { FramebufferTexture3DEXT_names, FramebufferTexture3DEXT_remap_index, -1 }, - { FramebufferTexture2DEXT_names, FramebufferTexture2DEXT_remap_index, -1 }, - { FramebufferRenderbufferEXT_names, FramebufferRenderbufferEXT_remap_index, -1 }, - { FramebufferTexture1DEXT_names, FramebufferTexture1DEXT_remap_index, -1 }, - { BindFramebufferEXT_names, BindFramebufferEXT_remap_index, -1 }, - { GenRenderbuffersEXT_names, GenRenderbuffersEXT_remap_index, -1 }, - { IsFramebufferEXT_names, IsFramebufferEXT_remap_index, -1 }, - { GetFramebufferAttachmentParameterivEXT_names, GetFramebufferAttachmentParameterivEXT_remap_index, -1 }, - { DeleteFramebuffersEXT_names, DeleteFramebuffersEXT_remap_index, -1 }, - { GenFramebuffersEXT_names, GenFramebuffersEXT_remap_index, -1 }, - { BindRenderbufferEXT_names, BindRenderbufferEXT_remap_index, -1 }, - { DeleteRenderbuffersEXT_names, DeleteRenderbuffersEXT_remap_index, -1 }, - { GetRenderbufferParameterivEXT_names, GetRenderbufferParameterivEXT_remap_index, -1 }, - { IsRenderbufferEXT_names, IsRenderbufferEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_gpu_program_parameters) -static const struct dri_extension_function GL_EXT_gpu_program_parameters_functions[] = { - { ProgramLocalParameters4fvEXT_names, ProgramLocalParameters4fvEXT_remap_index, -1 }, - { ProgramEnvParameters4fvEXT_names, ProgramEnvParameters4fvEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_histogram) -static const struct dri_extension_function GL_EXT_histogram_functions[] = { - { Histogram_names, -1, 367 }, - { ResetHistogram_names, -1, 369 }, - { GetMinmax_names, -1, 364 }, - { GetHistogramParameterfv_names, -1, 362 }, - { GetMinmaxParameteriv_names, -1, 366 }, - { ResetMinmax_names, -1, 370 }, - { GetHistogramParameteriv_names, -1, 363 }, - { GetHistogram_names, -1, 361 }, - { Minmax_names, -1, 368 }, - { GetMinmaxParameterfv_names, -1, 365 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_index_func) -static const struct dri_extension_function GL_EXT_index_func_functions[] = { - { IndexFuncEXT_names, IndexFuncEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_index_material) -static const struct dri_extension_function GL_EXT_index_material_functions[] = { - { IndexMaterialEXT_names, IndexMaterialEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_light_texture) -static const struct dri_extension_function GL_EXT_light_texture_functions[] = { - { ApplyTextureEXT_names, ApplyTextureEXT_remap_index, -1 }, - { TextureMaterialEXT_names, TextureMaterialEXT_remap_index, -1 }, - { TextureLightEXT_names, TextureLightEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_multi_draw_arrays) -static const struct dri_extension_function GL_EXT_multi_draw_arrays_functions[] = { - { MultiDrawElementsEXT_names, MultiDrawElementsEXT_remap_index, -1 }, - { MultiDrawArraysEXT_names, MultiDrawArraysEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_multisample) -static const struct dri_extension_function GL_EXT_multisample_functions[] = { - { SampleMaskSGIS_names, SampleMaskSGIS_remap_index, -1 }, - { SamplePatternSGIS_names, SamplePatternSGIS_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_paletted_texture) -static const struct dri_extension_function GL_EXT_paletted_texture_functions[] = { - { ColorTable_names, -1, 339 }, - { GetColorTable_names, -1, 343 }, - { GetColorTableParameterfv_names, -1, 344 }, - { GetColorTableParameteriv_names, -1, 345 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_pixel_transform) -static const struct dri_extension_function GL_EXT_pixel_transform_functions[] = { - { PixelTransformParameterfvEXT_names, PixelTransformParameterfvEXT_remap_index, -1 }, - { PixelTransformParameterfEXT_names, PixelTransformParameterfEXT_remap_index, -1 }, - { PixelTransformParameteriEXT_names, PixelTransformParameteriEXT_remap_index, -1 }, - { PixelTransformParameterivEXT_names, PixelTransformParameterivEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_point_parameters) -static const struct dri_extension_function GL_EXT_point_parameters_functions[] = { - { PointParameterfEXT_names, PointParameterfEXT_remap_index, -1 }, - { PointParameterfvEXT_names, PointParameterfvEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_polygon_offset) -static const struct dri_extension_function GL_EXT_polygon_offset_functions[] = { - { PolygonOffsetEXT_names, PolygonOffsetEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_provoking_vertex) -static const struct dri_extension_function GL_EXT_provoking_vertex_functions[] = { - { ProvokingVertexEXT_names, ProvokingVertexEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_secondary_color) -static const struct dri_extension_function GL_EXT_secondary_color_functions[] = { - { SecondaryColor3iEXT_names, SecondaryColor3iEXT_remap_index, -1 }, - { SecondaryColor3bEXT_names, SecondaryColor3bEXT_remap_index, -1 }, - { SecondaryColor3bvEXT_names, SecondaryColor3bvEXT_remap_index, -1 }, - { SecondaryColor3sEXT_names, SecondaryColor3sEXT_remap_index, -1 }, - { SecondaryColor3dEXT_names, SecondaryColor3dEXT_remap_index, -1 }, - { SecondaryColorPointerEXT_names, SecondaryColorPointerEXT_remap_index, -1 }, - { SecondaryColor3uiEXT_names, SecondaryColor3uiEXT_remap_index, -1 }, - { SecondaryColor3usvEXT_names, SecondaryColor3usvEXT_remap_index, -1 }, - { SecondaryColor3ivEXT_names, SecondaryColor3ivEXT_remap_index, -1 }, - { SecondaryColor3fvEXT_names, SecondaryColor3fvEXT_remap_index, -1 }, - { SecondaryColor3ubvEXT_names, SecondaryColor3ubvEXT_remap_index, -1 }, - { SecondaryColor3uivEXT_names, SecondaryColor3uivEXT_remap_index, -1 }, - { SecondaryColor3dvEXT_names, SecondaryColor3dvEXT_remap_index, -1 }, - { SecondaryColor3usEXT_names, SecondaryColor3usEXT_remap_index, -1 }, - { SecondaryColor3ubEXT_names, SecondaryColor3ubEXT_remap_index, -1 }, - { SecondaryColor3fEXT_names, SecondaryColor3fEXT_remap_index, -1 }, - { SecondaryColor3svEXT_names, SecondaryColor3svEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_stencil_two_side) -static const struct dri_extension_function GL_EXT_stencil_two_side_functions[] = { - { ActiveStencilFaceEXT_names, ActiveStencilFaceEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_subtexture) -static const struct dri_extension_function GL_EXT_subtexture_functions[] = { - { TexSubImage1D_names, -1, 332 }, - { TexSubImage2D_names, -1, 333 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_texture3D) -static const struct dri_extension_function GL_EXT_texture3D_functions[] = { - { TexImage3D_names, -1, 371 }, - { TexSubImage3D_names, -1, 372 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_texture_array) -static const struct dri_extension_function GL_EXT_texture_array_functions[] = { - { FramebufferTextureLayerEXT_names, FramebufferTextureLayerEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_texture_object) -static const struct dri_extension_function GL_EXT_texture_object_functions[] = { - { PrioritizeTextures_names, -1, 331 }, - { AreTexturesResident_names, -1, 322 }, - { GenTextures_names, -1, 328 }, - { DeleteTextures_names, -1, 327 }, - { IsTexture_names, -1, 330 }, - { BindTexture_names, -1, 307 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_texture_perturb_normal) -static const struct dri_extension_function GL_EXT_texture_perturb_normal_functions[] = { - { TextureNormalEXT_names, TextureNormalEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_timer_query) -static const struct dri_extension_function GL_EXT_timer_query_functions[] = { - { GetQueryObjectui64vEXT_names, GetQueryObjectui64vEXT_remap_index, -1 }, - { GetQueryObjecti64vEXT_names, GetQueryObjecti64vEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_vertex_array) -static const struct dri_extension_function GL_EXT_vertex_array_functions[] = { - { IndexPointerEXT_names, IndexPointerEXT_remap_index, -1 }, - { NormalPointerEXT_names, NormalPointerEXT_remap_index, -1 }, - { VertexPointerEXT_names, VertexPointerEXT_remap_index, -1 }, - { TexCoordPointerEXT_names, TexCoordPointerEXT_remap_index, -1 }, - { EdgeFlagPointerEXT_names, EdgeFlagPointerEXT_remap_index, -1 }, - { ArrayElement_names, -1, 306 }, - { ColorPointerEXT_names, ColorPointerEXT_remap_index, -1 }, - { GetPointerv_names, -1, 329 }, - { DrawArrays_names, -1, 310 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_EXT_vertex_weighting) -static const struct dri_extension_function GL_EXT_vertex_weighting_functions[] = { - { VertexWeightfvEXT_names, VertexWeightfvEXT_remap_index, -1 }, - { VertexWeightfEXT_names, VertexWeightfEXT_remap_index, -1 }, - { VertexWeightPointerEXT_names, VertexWeightPointerEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_HP_image_transform) -static const struct dri_extension_function GL_HP_image_transform_functions[] = { - { GetImageTransformParameterfvHP_names, GetImageTransformParameterfvHP_remap_index, -1 }, - { ImageTransformParameterfHP_names, ImageTransformParameterfHP_remap_index, -1 }, - { ImageTransformParameterfvHP_names, ImageTransformParameterfvHP_remap_index, -1 }, - { ImageTransformParameteriHP_names, ImageTransformParameteriHP_remap_index, -1 }, - { GetImageTransformParameterivHP_names, GetImageTransformParameterivHP_remap_index, -1 }, - { ImageTransformParameterivHP_names, ImageTransformParameterivHP_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_IBM_multimode_draw_arrays) -static const struct dri_extension_function GL_IBM_multimode_draw_arrays_functions[] = { - { MultiModeDrawArraysIBM_names, MultiModeDrawArraysIBM_remap_index, -1 }, - { MultiModeDrawElementsIBM_names, MultiModeDrawElementsIBM_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_IBM_vertex_array_lists) -static const struct dri_extension_function GL_IBM_vertex_array_lists_functions[] = { - { SecondaryColorPointerListIBM_names, SecondaryColorPointerListIBM_remap_index, -1 }, - { NormalPointerListIBM_names, NormalPointerListIBM_remap_index, -1 }, - { FogCoordPointerListIBM_names, FogCoordPointerListIBM_remap_index, -1 }, - { VertexPointerListIBM_names, VertexPointerListIBM_remap_index, -1 }, - { ColorPointerListIBM_names, ColorPointerListIBM_remap_index, -1 }, - { TexCoordPointerListIBM_names, TexCoordPointerListIBM_remap_index, -1 }, - { IndexPointerListIBM_names, IndexPointerListIBM_remap_index, -1 }, - { EdgeFlagPointerListIBM_names, EdgeFlagPointerListIBM_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_INGR_blend_func_separate) -static const struct dri_extension_function GL_INGR_blend_func_separate_functions[] = { - { BlendFuncSeparateEXT_names, BlendFuncSeparateEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_INTEL_parallel_arrays) -static const struct dri_extension_function GL_INTEL_parallel_arrays_functions[] = { - { VertexPointervINTEL_names, VertexPointervINTEL_remap_index, -1 }, - { ColorPointervINTEL_names, ColorPointervINTEL_remap_index, -1 }, - { NormalPointervINTEL_names, NormalPointervINTEL_remap_index, -1 }, - { TexCoordPointervINTEL_names, TexCoordPointervINTEL_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_MESA_resize_buffers) -static const struct dri_extension_function GL_MESA_resize_buffers_functions[] = { - { ResizeBuffersMESA_names, ResizeBuffersMESA_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_MESA_shader_debug) -static const struct dri_extension_function GL_MESA_shader_debug_functions[] = { - { GetDebugLogLengthMESA_names, GetDebugLogLengthMESA_remap_index, -1 }, - { ClearDebugLogMESA_names, ClearDebugLogMESA_remap_index, -1 }, - { GetDebugLogMESA_names, GetDebugLogMESA_remap_index, -1 }, - { CreateDebugObjectMESA_names, CreateDebugObjectMESA_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_MESA_window_pos) -static const struct dri_extension_function GL_MESA_window_pos_functions[] = { - { WindowPos3fMESA_names, WindowPos3fMESA_remap_index, -1 }, - { WindowPos2dvMESA_names, WindowPos2dvMESA_remap_index, -1 }, - { WindowPos4svMESA_names, WindowPos4svMESA_remap_index, -1 }, - { WindowPos2svMESA_names, WindowPos2svMESA_remap_index, -1 }, - { WindowPos3dMESA_names, WindowPos3dMESA_remap_index, -1 }, - { WindowPos2fvMESA_names, WindowPos2fvMESA_remap_index, -1 }, - { WindowPos4dMESA_names, WindowPos4dMESA_remap_index, -1 }, - { WindowPos2dMESA_names, WindowPos2dMESA_remap_index, -1 }, - { WindowPos4ivMESA_names, WindowPos4ivMESA_remap_index, -1 }, - { WindowPos4fMESA_names, WindowPos4fMESA_remap_index, -1 }, - { WindowPos3dvMESA_names, WindowPos3dvMESA_remap_index, -1 }, - { WindowPos3fvMESA_names, WindowPos3fvMESA_remap_index, -1 }, - { WindowPos4dvMESA_names, WindowPos4dvMESA_remap_index, -1 }, - { WindowPos2iMESA_names, WindowPos2iMESA_remap_index, -1 }, - { WindowPos3sMESA_names, WindowPos3sMESA_remap_index, -1 }, - { WindowPos4sMESA_names, WindowPos4sMESA_remap_index, -1 }, - { WindowPos2ivMESA_names, WindowPos2ivMESA_remap_index, -1 }, - { WindowPos2sMESA_names, WindowPos2sMESA_remap_index, -1 }, - { WindowPos3iMESA_names, WindowPos3iMESA_remap_index, -1 }, - { WindowPos3ivMESA_names, WindowPos3ivMESA_remap_index, -1 }, - { WindowPos4iMESA_names, WindowPos4iMESA_remap_index, -1 }, - { WindowPos4fvMESA_names, WindowPos4fvMESA_remap_index, -1 }, - { WindowPos3svMESA_names, WindowPos3svMESA_remap_index, -1 }, - { WindowPos2fMESA_names, WindowPos2fMESA_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_NV_evaluators) -static const struct dri_extension_function GL_NV_evaluators_functions[] = { - { GetMapAttribParameterivNV_names, GetMapAttribParameterivNV_remap_index, -1 }, - { MapControlPointsNV_names, MapControlPointsNV_remap_index, -1 }, - { MapParameterfvNV_names, MapParameterfvNV_remap_index, -1 }, - { EvalMapsNV_names, EvalMapsNV_remap_index, -1 }, - { GetMapAttribParameterfvNV_names, GetMapAttribParameterfvNV_remap_index, -1 }, - { MapParameterivNV_names, MapParameterivNV_remap_index, -1 }, - { GetMapParameterivNV_names, GetMapParameterivNV_remap_index, -1 }, - { GetMapParameterfvNV_names, GetMapParameterfvNV_remap_index, -1 }, - { GetMapControlPointsNV_names, GetMapControlPointsNV_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_NV_fence) -static const struct dri_extension_function GL_NV_fence_functions[] = { - { GenFencesNV_names, GenFencesNV_remap_index, -1 }, - { TestFenceNV_names, TestFenceNV_remap_index, -1 }, - { IsFenceNV_names, IsFenceNV_remap_index, -1 }, - { DeleteFencesNV_names, DeleteFencesNV_remap_index, -1 }, - { SetFenceNV_names, SetFenceNV_remap_index, -1 }, - { GetFenceivNV_names, GetFenceivNV_remap_index, -1 }, - { FinishFenceNV_names, FinishFenceNV_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_NV_fragment_program) -static const struct dri_extension_function GL_NV_fragment_program_functions[] = { - { GetProgramNamedParameterdvNV_names, GetProgramNamedParameterdvNV_remap_index, -1 }, - { GetProgramNamedParameterfvNV_names, GetProgramNamedParameterfvNV_remap_index, -1 }, - { ProgramNamedParameter4fNV_names, ProgramNamedParameter4fNV_remap_index, -1 }, - { ProgramNamedParameter4fvNV_names, ProgramNamedParameter4fvNV_remap_index, -1 }, - { ProgramNamedParameter4dvNV_names, ProgramNamedParameter4dvNV_remap_index, -1 }, - { ProgramNamedParameter4dNV_names, ProgramNamedParameter4dNV_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_NV_point_sprite) -static const struct dri_extension_function GL_NV_point_sprite_functions[] = { - { PointParameteriNV_names, PointParameteriNV_remap_index, -1 }, - { PointParameterivNV_names, PointParameterivNV_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_NV_register_combiners) -static const struct dri_extension_function GL_NV_register_combiners_functions[] = { - { CombinerOutputNV_names, CombinerOutputNV_remap_index, -1 }, - { CombinerParameterfvNV_names, CombinerParameterfvNV_remap_index, -1 }, - { GetFinalCombinerInputParameterfvNV_names, GetFinalCombinerInputParameterfvNV_remap_index, -1 }, - { GetCombinerOutputParameterfvNV_names, GetCombinerOutputParameterfvNV_remap_index, -1 }, - { FinalCombinerInputNV_names, FinalCombinerInputNV_remap_index, -1 }, - { GetCombinerInputParameterfvNV_names, GetCombinerInputParameterfvNV_remap_index, -1 }, - { GetCombinerOutputParameterivNV_names, GetCombinerOutputParameterivNV_remap_index, -1 }, - { CombinerParameteriNV_names, CombinerParameteriNV_remap_index, -1 }, - { GetFinalCombinerInputParameterivNV_names, GetFinalCombinerInputParameterivNV_remap_index, -1 }, - { CombinerInputNV_names, CombinerInputNV_remap_index, -1 }, - { CombinerParameterfNV_names, CombinerParameterfNV_remap_index, -1 }, - { GetCombinerInputParameterivNV_names, GetCombinerInputParameterivNV_remap_index, -1 }, - { CombinerParameterivNV_names, CombinerParameterivNV_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_NV_register_combiners2) -static const struct dri_extension_function GL_NV_register_combiners2_functions[] = { - { CombinerStageParameterfvNV_names, CombinerStageParameterfvNV_remap_index, -1 }, - { GetCombinerStageParameterfvNV_names, GetCombinerStageParameterfvNV_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_NV_vertex_array_range) -static const struct dri_extension_function GL_NV_vertex_array_range_functions[] = { - { VertexArrayRangeNV_names, VertexArrayRangeNV_remap_index, -1 }, - { FlushVertexArrayRangeNV_names, FlushVertexArrayRangeNV_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_NV_vertex_program) -static const struct dri_extension_function GL_NV_vertex_program_functions[] = { - { VertexAttrib4ubvNV_names, VertexAttrib4ubvNV_remap_index, -1 }, - { VertexAttrib4svNV_names, VertexAttrib4svNV_remap_index, -1 }, - { VertexAttribs3fvNV_names, VertexAttribs3fvNV_remap_index, -1 }, - { VertexAttribs1dvNV_names, VertexAttribs1dvNV_remap_index, -1 }, - { VertexAttrib1fvNV_names, VertexAttrib1fvNV_remap_index, -1 }, - { VertexAttrib4fNV_names, VertexAttrib4fNV_remap_index, -1 }, - { VertexAttrib2dNV_names, VertexAttrib2dNV_remap_index, -1 }, - { VertexAttrib4ubNV_names, VertexAttrib4ubNV_remap_index, -1 }, - { VertexAttribs3dvNV_names, VertexAttribs3dvNV_remap_index, -1 }, - { VertexAttribs4fvNV_names, VertexAttribs4fvNV_remap_index, -1 }, - { VertexAttrib2sNV_names, VertexAttrib2sNV_remap_index, -1 }, - { ProgramEnvParameter4fvARB_names, ProgramEnvParameter4fvARB_remap_index, -1 }, - { LoadProgramNV_names, LoadProgramNV_remap_index, -1 }, - { VertexAttrib4fvNV_names, VertexAttrib4fvNV_remap_index, -1 }, - { VertexAttrib3fNV_names, VertexAttrib3fNV_remap_index, -1 }, - { VertexAttribs2dvNV_names, VertexAttribs2dvNV_remap_index, -1 }, - { GetProgramParameterfvNV_names, GetProgramParameterfvNV_remap_index, -1 }, - { VertexAttrib3dNV_names, VertexAttrib3dNV_remap_index, -1 }, - { VertexAttrib2fvNV_names, VertexAttrib2fvNV_remap_index, -1 }, - { VertexAttrib2dvNV_names, VertexAttrib2dvNV_remap_index, -1 }, - { VertexAttrib1dvNV_names, VertexAttrib1dvNV_remap_index, -1 }, - { VertexAttrib1svNV_names, VertexAttrib1svNV_remap_index, -1 }, - { ProgramEnvParameter4fARB_names, ProgramEnvParameter4fARB_remap_index, -1 }, - { VertexAttribs2svNV_names, VertexAttribs2svNV_remap_index, -1 }, - { GetVertexAttribivNV_names, GetVertexAttribivNV_remap_index, -1 }, - { GetVertexAttribfvNV_names, GetVertexAttribfvNV_remap_index, -1 }, - { VertexAttrib2svNV_names, VertexAttrib2svNV_remap_index, -1 }, - { VertexAttribs1fvNV_names, VertexAttribs1fvNV_remap_index, -1 }, - { IsProgramNV_names, IsProgramNV_remap_index, -1 }, - { ProgramEnvParameter4dARB_names, ProgramEnvParameter4dARB_remap_index, -1 }, - { VertexAttrib2fNV_names, VertexAttrib2fNV_remap_index, -1 }, - { RequestResidentProgramsNV_names, RequestResidentProgramsNV_remap_index, -1 }, - { ExecuteProgramNV_names, ExecuteProgramNV_remap_index, -1 }, - { VertexAttribPointerNV_names, VertexAttribPointerNV_remap_index, -1 }, - { TrackMatrixNV_names, TrackMatrixNV_remap_index, -1 }, - { GetProgramParameterdvNV_names, GetProgramParameterdvNV_remap_index, -1 }, - { GetTrackMatrixivNV_names, GetTrackMatrixivNV_remap_index, -1 }, - { VertexAttrib3svNV_names, VertexAttrib3svNV_remap_index, -1 }, - { ProgramParameters4fvNV_names, ProgramParameters4fvNV_remap_index, -1 }, - { GetProgramivNV_names, GetProgramivNV_remap_index, -1 }, - { GetVertexAttribdvNV_names, GetVertexAttribdvNV_remap_index, -1 }, - { VertexAttrib3fvNV_names, VertexAttrib3fvNV_remap_index, -1 }, - { ProgramEnvParameter4dvARB_names, ProgramEnvParameter4dvARB_remap_index, -1 }, - { VertexAttribs2fvNV_names, VertexAttribs2fvNV_remap_index, -1 }, - { DeleteProgramsNV_names, DeleteProgramsNV_remap_index, -1 }, - { GetVertexAttribPointervNV_names, GetVertexAttribPointervNV_remap_index, -1 }, - { GetProgramStringNV_names, GetProgramStringNV_remap_index, -1 }, - { VertexAttrib4sNV_names, VertexAttrib4sNV_remap_index, -1 }, - { VertexAttribs4dvNV_names, VertexAttribs4dvNV_remap_index, -1 }, - { ProgramParameters4dvNV_names, ProgramParameters4dvNV_remap_index, -1 }, - { VertexAttrib3sNV_names, VertexAttrib3sNV_remap_index, -1 }, - { VertexAttrib1fNV_names, VertexAttrib1fNV_remap_index, -1 }, - { VertexAttrib4dNV_names, VertexAttrib4dNV_remap_index, -1 }, - { VertexAttribs4ubvNV_names, VertexAttribs4ubvNV_remap_index, -1 }, - { VertexAttribs3svNV_names, VertexAttribs3svNV_remap_index, -1 }, - { VertexAttrib1sNV_names, VertexAttrib1sNV_remap_index, -1 }, - { BindProgramNV_names, BindProgramNV_remap_index, -1 }, - { AreProgramsResidentNV_names, AreProgramsResidentNV_remap_index, -1 }, - { VertexAttrib3dvNV_names, VertexAttrib3dvNV_remap_index, -1 }, - { VertexAttrib1dNV_names, VertexAttrib1dNV_remap_index, -1 }, - { VertexAttribs4svNV_names, VertexAttribs4svNV_remap_index, -1 }, - { VertexAttribs1svNV_names, VertexAttribs1svNV_remap_index, -1 }, - { GenProgramsNV_names, GenProgramsNV_remap_index, -1 }, - { VertexAttrib4dvNV_names, VertexAttrib4dvNV_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_PGI_misc_hints) -static const struct dri_extension_function GL_PGI_misc_hints_functions[] = { - { HintPGI_names, HintPGI_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGIS_detail_texture) -static const struct dri_extension_function GL_SGIS_detail_texture_functions[] = { - { GetDetailTexFuncSGIS_names, GetDetailTexFuncSGIS_remap_index, -1 }, - { DetailTexFuncSGIS_names, DetailTexFuncSGIS_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGIS_fog_function) -static const struct dri_extension_function GL_SGIS_fog_function_functions[] = { - { FogFuncSGIS_names, FogFuncSGIS_remap_index, -1 }, - { GetFogFuncSGIS_names, GetFogFuncSGIS_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGIS_multisample) -static const struct dri_extension_function GL_SGIS_multisample_functions[] = { - { SampleMaskSGIS_names, SampleMaskSGIS_remap_index, -1 }, - { SamplePatternSGIS_names, SamplePatternSGIS_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGIS_pixel_texture) -static const struct dri_extension_function GL_SGIS_pixel_texture_functions[] = { - { PixelTexGenParameterfvSGIS_names, PixelTexGenParameterfvSGIS_remap_index, -1 }, - { GetPixelTexGenParameterivSGIS_names, GetPixelTexGenParameterivSGIS_remap_index, -1 }, - { PixelTexGenParameteriSGIS_names, PixelTexGenParameteriSGIS_remap_index, -1 }, - { PixelTexGenParameterivSGIS_names, PixelTexGenParameterivSGIS_remap_index, -1 }, - { PixelTexGenParameterfSGIS_names, PixelTexGenParameterfSGIS_remap_index, -1 }, - { GetPixelTexGenParameterfvSGIS_names, GetPixelTexGenParameterfvSGIS_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGIS_point_parameters) -static const struct dri_extension_function GL_SGIS_point_parameters_functions[] = { - { PointParameterfEXT_names, PointParameterfEXT_remap_index, -1 }, - { PointParameterfvEXT_names, PointParameterfvEXT_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGIS_sharpen_texture) -static const struct dri_extension_function GL_SGIS_sharpen_texture_functions[] = { - { GetSharpenTexFuncSGIS_names, GetSharpenTexFuncSGIS_remap_index, -1 }, - { SharpenTexFuncSGIS_names, SharpenTexFuncSGIS_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGIS_texture4D) -static const struct dri_extension_function GL_SGIS_texture4D_functions[] = { - { TexImage4DSGIS_names, TexImage4DSGIS_remap_index, -1 }, - { TexSubImage4DSGIS_names, TexSubImage4DSGIS_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGIS_texture_color_mask) -static const struct dri_extension_function GL_SGIS_texture_color_mask_functions[] = { - { TextureColorMaskSGIS_names, TextureColorMaskSGIS_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGIS_texture_filter4) -static const struct dri_extension_function GL_SGIS_texture_filter4_functions[] = { - { GetTexFilterFuncSGIS_names, GetTexFilterFuncSGIS_remap_index, -1 }, - { TexFilterFuncSGIS_names, TexFilterFuncSGIS_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGIX_async) -static const struct dri_extension_function GL_SGIX_async_functions[] = { - { AsyncMarkerSGIX_names, AsyncMarkerSGIX_remap_index, -1 }, - { FinishAsyncSGIX_names, FinishAsyncSGIX_remap_index, -1 }, - { PollAsyncSGIX_names, PollAsyncSGIX_remap_index, -1 }, - { DeleteAsyncMarkersSGIX_names, DeleteAsyncMarkersSGIX_remap_index, -1 }, - { IsAsyncMarkerSGIX_names, IsAsyncMarkerSGIX_remap_index, -1 }, - { GenAsyncMarkersSGIX_names, GenAsyncMarkersSGIX_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGIX_flush_raster) -static const struct dri_extension_function GL_SGIX_flush_raster_functions[] = { - { FlushRasterSGIX_names, FlushRasterSGIX_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGIX_fragment_lighting) -static const struct dri_extension_function GL_SGIX_fragment_lighting_functions[] = { - { FragmentMaterialfvSGIX_names, FragmentMaterialfvSGIX_remap_index, -1 }, - { FragmentLightModelivSGIX_names, FragmentLightModelivSGIX_remap_index, -1 }, - { FragmentLightiSGIX_names, FragmentLightiSGIX_remap_index, -1 }, - { GetFragmentMaterialfvSGIX_names, GetFragmentMaterialfvSGIX_remap_index, -1 }, - { FragmentMaterialfSGIX_names, FragmentMaterialfSGIX_remap_index, -1 }, - { GetFragmentLightivSGIX_names, GetFragmentLightivSGIX_remap_index, -1 }, - { FragmentLightModeliSGIX_names, FragmentLightModeliSGIX_remap_index, -1 }, - { FragmentLightivSGIX_names, FragmentLightivSGIX_remap_index, -1 }, - { GetFragmentMaterialivSGIX_names, GetFragmentMaterialivSGIX_remap_index, -1 }, - { FragmentLightModelfSGIX_names, FragmentLightModelfSGIX_remap_index, -1 }, - { FragmentColorMaterialSGIX_names, FragmentColorMaterialSGIX_remap_index, -1 }, - { FragmentMaterialiSGIX_names, FragmentMaterialiSGIX_remap_index, -1 }, - { LightEnviSGIX_names, LightEnviSGIX_remap_index, -1 }, - { FragmentLightModelfvSGIX_names, FragmentLightModelfvSGIX_remap_index, -1 }, - { FragmentLightfvSGIX_names, FragmentLightfvSGIX_remap_index, -1 }, - { FragmentLightfSGIX_names, FragmentLightfSGIX_remap_index, -1 }, - { GetFragmentLightfvSGIX_names, GetFragmentLightfvSGIX_remap_index, -1 }, - { FragmentMaterialivSGIX_names, FragmentMaterialivSGIX_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGIX_framezoom) -static const struct dri_extension_function GL_SGIX_framezoom_functions[] = { - { FrameZoomSGIX_names, FrameZoomSGIX_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGIX_igloo_interface) -static const struct dri_extension_function GL_SGIX_igloo_interface_functions[] = { - { IglooInterfaceSGIX_names, IglooInterfaceSGIX_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGIX_instruments) -static const struct dri_extension_function GL_SGIX_instruments_functions[] = { - { ReadInstrumentsSGIX_names, ReadInstrumentsSGIX_remap_index, -1 }, - { PollInstrumentsSGIX_names, PollInstrumentsSGIX_remap_index, -1 }, - { GetInstrumentsSGIX_names, GetInstrumentsSGIX_remap_index, -1 }, - { StartInstrumentsSGIX_names, StartInstrumentsSGIX_remap_index, -1 }, - { StopInstrumentsSGIX_names, StopInstrumentsSGIX_remap_index, -1 }, - { InstrumentsBufferSGIX_names, InstrumentsBufferSGIX_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGIX_list_priority) -static const struct dri_extension_function GL_SGIX_list_priority_functions[] = { - { ListParameterfSGIX_names, ListParameterfSGIX_remap_index, -1 }, - { GetListParameterfvSGIX_names, GetListParameterfvSGIX_remap_index, -1 }, - { ListParameteriSGIX_names, ListParameteriSGIX_remap_index, -1 }, - { ListParameterfvSGIX_names, ListParameterfvSGIX_remap_index, -1 }, - { ListParameterivSGIX_names, ListParameterivSGIX_remap_index, -1 }, - { GetListParameterivSGIX_names, GetListParameterivSGIX_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGIX_pixel_texture) -static const struct dri_extension_function GL_SGIX_pixel_texture_functions[] = { - { PixelTexGenSGIX_names, PixelTexGenSGIX_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGIX_polynomial_ffd) -static const struct dri_extension_function GL_SGIX_polynomial_ffd_functions[] = { - { LoadIdentityDeformationMapSGIX_names, LoadIdentityDeformationMapSGIX_remap_index, -1 }, - { DeformationMap3dSGIX_names, DeformationMap3dSGIX_remap_index, -1 }, - { DeformSGIX_names, DeformSGIX_remap_index, -1 }, - { DeformationMap3fSGIX_names, DeformationMap3fSGIX_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGIX_reference_plane) -static const struct dri_extension_function GL_SGIX_reference_plane_functions[] = { - { ReferencePlaneSGIX_names, ReferencePlaneSGIX_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGIX_sprite) -static const struct dri_extension_function GL_SGIX_sprite_functions[] = { - { SpriteParameterfvSGIX_names, SpriteParameterfvSGIX_remap_index, -1 }, - { SpriteParameteriSGIX_names, SpriteParameteriSGIX_remap_index, -1 }, - { SpriteParameterfSGIX_names, SpriteParameterfSGIX_remap_index, -1 }, - { SpriteParameterivSGIX_names, SpriteParameterivSGIX_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGIX_tag_sample_buffer) -static const struct dri_extension_function GL_SGIX_tag_sample_buffer_functions[] = { - { TagSampleBufferSGIX_names, TagSampleBufferSGIX_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SGI_color_table) -static const struct dri_extension_function GL_SGI_color_table_functions[] = { - { ColorTableParameteriv_names, -1, 341 }, - { ColorTable_names, -1, 339 }, - { GetColorTable_names, -1, 343 }, - { CopyColorTable_names, -1, 342 }, - { ColorTableParameterfv_names, -1, 340 }, - { GetColorTableParameterfv_names, -1, 344 }, - { GetColorTableParameteriv_names, -1, 345 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SUNX_constant_data) -static const struct dri_extension_function GL_SUNX_constant_data_functions[] = { - { FinishTextureSUNX_names, FinishTextureSUNX_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SUN_global_alpha) -static const struct dri_extension_function GL_SUN_global_alpha_functions[] = { - { GlobalAlphaFactorubSUN_names, GlobalAlphaFactorubSUN_remap_index, -1 }, - { GlobalAlphaFactoriSUN_names, GlobalAlphaFactoriSUN_remap_index, -1 }, - { GlobalAlphaFactordSUN_names, GlobalAlphaFactordSUN_remap_index, -1 }, - { GlobalAlphaFactoruiSUN_names, GlobalAlphaFactoruiSUN_remap_index, -1 }, - { GlobalAlphaFactorbSUN_names, GlobalAlphaFactorbSUN_remap_index, -1 }, - { GlobalAlphaFactorfSUN_names, GlobalAlphaFactorfSUN_remap_index, -1 }, - { GlobalAlphaFactorusSUN_names, GlobalAlphaFactorusSUN_remap_index, -1 }, - { GlobalAlphaFactorsSUN_names, GlobalAlphaFactorsSUN_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SUN_mesh_array) -static const struct dri_extension_function GL_SUN_mesh_array_functions[] = { - { DrawMeshArraysSUN_names, DrawMeshArraysSUN_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SUN_triangle_list) -static const struct dri_extension_function GL_SUN_triangle_list_functions[] = { - { ReplacementCodeubSUN_names, ReplacementCodeubSUN_remap_index, -1 }, - { ReplacementCodeubvSUN_names, ReplacementCodeubvSUN_remap_index, -1 }, - { ReplacementCodeusvSUN_names, ReplacementCodeusvSUN_remap_index, -1 }, - { ReplacementCodePointerSUN_names, ReplacementCodePointerSUN_remap_index, -1 }, - { ReplacementCodeusSUN_names, ReplacementCodeusSUN_remap_index, -1 }, - { ReplacementCodeuiSUN_names, ReplacementCodeuiSUN_remap_index, -1 }, - { ReplacementCodeuivSUN_names, ReplacementCodeuivSUN_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_SUN_vertex) -static const struct dri_extension_function GL_SUN_vertex_functions[] = { - { ReplacementCodeuiColor3fVertex3fvSUN_names, ReplacementCodeuiColor3fVertex3fvSUN_remap_index, -1 }, - { TexCoord4fColor4fNormal3fVertex4fvSUN_names, TexCoord4fColor4fNormal3fVertex4fvSUN_remap_index, -1 }, - { TexCoord2fColor4ubVertex3fvSUN_names, TexCoord2fColor4ubVertex3fvSUN_remap_index, -1 }, - { ReplacementCodeuiVertex3fvSUN_names, ReplacementCodeuiVertex3fvSUN_remap_index, -1 }, - { ReplacementCodeuiTexCoord2fVertex3fvSUN_names, ReplacementCodeuiTexCoord2fVertex3fvSUN_remap_index, -1 }, - { ReplacementCodeuiNormal3fVertex3fSUN_names, ReplacementCodeuiNormal3fVertex3fSUN_remap_index, -1 }, - { Color4ubVertex3fvSUN_names, Color4ubVertex3fvSUN_remap_index, -1 }, - { Color4ubVertex3fSUN_names, Color4ubVertex3fSUN_remap_index, -1 }, - { TexCoord2fVertex3fSUN_names, TexCoord2fVertex3fSUN_remap_index, -1 }, - { TexCoord2fColor4fNormal3fVertex3fSUN_names, TexCoord2fColor4fNormal3fVertex3fSUN_remap_index, -1 }, - { TexCoord2fNormal3fVertex3fvSUN_names, TexCoord2fNormal3fVertex3fvSUN_remap_index, -1 }, - { ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN_names, ReplacementCodeuiTexCoord2fNormal3fVertex3fSUN_remap_index, -1 }, - { ReplacementCodeuiTexCoord2fVertex3fSUN_names, ReplacementCodeuiTexCoord2fVertex3fSUN_remap_index, -1 }, - { TexCoord2fNormal3fVertex3fSUN_names, TexCoord2fNormal3fVertex3fSUN_remap_index, -1 }, - { Color3fVertex3fSUN_names, Color3fVertex3fSUN_remap_index, -1 }, - { Color3fVertex3fvSUN_names, Color3fVertex3fvSUN_remap_index, -1 }, - { Color4fNormal3fVertex3fvSUN_names, Color4fNormal3fVertex3fvSUN_remap_index, -1 }, - { ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN_names, ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN_remap_index, -1 }, - { ReplacementCodeuiColor4fNormal3fVertex3fvSUN_names, ReplacementCodeuiColor4fNormal3fVertex3fvSUN_remap_index, -1 }, - { ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN_names, ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN_remap_index, -1 }, - { TexCoord2fColor3fVertex3fSUN_names, TexCoord2fColor3fVertex3fSUN_remap_index, -1 }, - { TexCoord4fColor4fNormal3fVertex4fSUN_names, TexCoord4fColor4fNormal3fVertex4fSUN_remap_index, -1 }, - { Color4ubVertex2fvSUN_names, Color4ubVertex2fvSUN_remap_index, -1 }, - { Normal3fVertex3fSUN_names, Normal3fVertex3fSUN_remap_index, -1 }, - { ReplacementCodeuiColor4fNormal3fVertex3fSUN_names, ReplacementCodeuiColor4fNormal3fVertex3fSUN_remap_index, -1 }, - { TexCoord2fColor4fNormal3fVertex3fvSUN_names, TexCoord2fColor4fNormal3fVertex3fvSUN_remap_index, -1 }, - { TexCoord2fVertex3fvSUN_names, TexCoord2fVertex3fvSUN_remap_index, -1 }, - { Color4ubVertex2fSUN_names, Color4ubVertex2fSUN_remap_index, -1 }, - { ReplacementCodeuiColor4ubVertex3fSUN_names, ReplacementCodeuiColor4ubVertex3fSUN_remap_index, -1 }, - { TexCoord2fColor4ubVertex3fSUN_names, TexCoord2fColor4ubVertex3fSUN_remap_index, -1 }, - { Normal3fVertex3fvSUN_names, Normal3fVertex3fvSUN_remap_index, -1 }, - { Color4fNormal3fVertex3fSUN_names, Color4fNormal3fVertex3fSUN_remap_index, -1 }, - { ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN_names, ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN_remap_index, -1 }, - { ReplacementCodeuiColor4ubVertex3fvSUN_names, ReplacementCodeuiColor4ubVertex3fvSUN_remap_index, -1 }, - { ReplacementCodeuiColor3fVertex3fSUN_names, ReplacementCodeuiColor3fVertex3fSUN_remap_index, -1 }, - { TexCoord4fVertex4fSUN_names, TexCoord4fVertex4fSUN_remap_index, -1 }, - { TexCoord2fColor3fVertex3fvSUN_names, TexCoord2fColor3fVertex3fvSUN_remap_index, -1 }, - { ReplacementCodeuiNormal3fVertex3fvSUN_names, ReplacementCodeuiNormal3fVertex3fvSUN_remap_index, -1 }, - { TexCoord4fVertex4fvSUN_names, TexCoord4fVertex4fvSUN_remap_index, -1 }, - { ReplacementCodeuiVertex3fSUN_names, ReplacementCodeuiVertex3fSUN_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_VERSION_1_3) -static const struct dri_extension_function GL_VERSION_1_3_functions[] = { - { SampleCoverageARB_names, SampleCoverageARB_remap_index, -1 }, - { MultiTexCoord3sARB_names, -1, 398 }, - { ActiveTextureARB_names, -1, 374 }, - { CompressedTexSubImage2DARB_names, CompressedTexSubImage2DARB_remap_index, -1 }, - { CompressedTexImage3DARB_names, CompressedTexImage3DARB_remap_index, -1 }, - { MultiTexCoord1fvARB_names, -1, 379 }, - { MultTransposeMatrixdARB_names, MultTransposeMatrixdARB_remap_index, -1 }, - { CompressedTexImage1DARB_names, CompressedTexImage1DARB_remap_index, -1 }, - { MultiTexCoord3dARB_names, -1, 392 }, - { MultiTexCoord2iARB_names, -1, 388 }, - { MultiTexCoord2svARB_names, -1, 391 }, - { MultiTexCoord2fARB_names, -1, 386 }, - { LoadTransposeMatrixdARB_names, LoadTransposeMatrixdARB_remap_index, -1 }, - { MultiTexCoord3fvARB_names, -1, 395 }, - { MultiTexCoord4sARB_names, -1, 406 }, - { MultiTexCoord2dvARB_names, -1, 385 }, - { MultiTexCoord1svARB_names, -1, 383 }, - { MultiTexCoord3svARB_names, -1, 399 }, - { MultiTexCoord4iARB_names, -1, 404 }, - { MultiTexCoord3iARB_names, -1, 396 }, - { MultiTexCoord1dARB_names, -1, 376 }, - { MultiTexCoord3dvARB_names, -1, 393 }, - { MultiTexCoord3ivARB_names, -1, 397 }, - { MultiTexCoord2sARB_names, -1, 390 }, - { MultiTexCoord4ivARB_names, -1, 405 }, - { CompressedTexSubImage1DARB_names, CompressedTexSubImage1DARB_remap_index, -1 }, - { ClientActiveTextureARB_names, -1, 375 }, - { CompressedTexSubImage3DARB_names, CompressedTexSubImage3DARB_remap_index, -1 }, - { MultiTexCoord2dARB_names, -1, 384 }, - { MultiTexCoord4dvARB_names, -1, 401 }, - { MultiTexCoord4fvARB_names, -1, 403 }, - { MultiTexCoord3fARB_names, -1, 394 }, - { MultTransposeMatrixfARB_names, MultTransposeMatrixfARB_remap_index, -1 }, - { CompressedTexImage2DARB_names, CompressedTexImage2DARB_remap_index, -1 }, - { MultiTexCoord4dARB_names, -1, 400 }, - { MultiTexCoord1sARB_names, -1, 382 }, - { MultiTexCoord1dvARB_names, -1, 377 }, - { MultiTexCoord1ivARB_names, -1, 381 }, - { MultiTexCoord2ivARB_names, -1, 389 }, - { MultiTexCoord1iARB_names, -1, 380 }, - { GetCompressedTexImageARB_names, GetCompressedTexImageARB_remap_index, -1 }, - { MultiTexCoord4svARB_names, -1, 407 }, - { MultiTexCoord1fARB_names, -1, 378 }, - { MultiTexCoord4fARB_names, -1, 402 }, - { LoadTransposeMatrixfARB_names, LoadTransposeMatrixfARB_remap_index, -1 }, - { MultiTexCoord2fvARB_names, -1, 387 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_VERSION_1_4) -static const struct dri_extension_function GL_VERSION_1_4_functions[] = { - { PointParameteriNV_names, PointParameteriNV_remap_index, -1 }, - { SecondaryColor3iEXT_names, SecondaryColor3iEXT_remap_index, -1 }, - { WindowPos3fMESA_names, WindowPos3fMESA_remap_index, -1 }, - { WindowPos2dvMESA_names, WindowPos2dvMESA_remap_index, -1 }, - { SecondaryColor3bEXT_names, SecondaryColor3bEXT_remap_index, -1 }, - { PointParameterfEXT_names, PointParameterfEXT_remap_index, -1 }, - { FogCoorddEXT_names, FogCoorddEXT_remap_index, -1 }, - { FogCoordfEXT_names, FogCoordfEXT_remap_index, -1 }, - { WindowPos2svMESA_names, WindowPos2svMESA_remap_index, -1 }, - { WindowPos3dMESA_names, WindowPos3dMESA_remap_index, -1 }, - { PointParameterfvEXT_names, PointParameterfvEXT_remap_index, -1 }, - { WindowPos2fvMESA_names, WindowPos2fvMESA_remap_index, -1 }, - { SecondaryColor3bvEXT_names, SecondaryColor3bvEXT_remap_index, -1 }, - { SecondaryColor3sEXT_names, SecondaryColor3sEXT_remap_index, -1 }, - { SecondaryColor3dEXT_names, SecondaryColor3dEXT_remap_index, -1 }, - { WindowPos2dMESA_names, WindowPos2dMESA_remap_index, -1 }, - { SecondaryColorPointerEXT_names, SecondaryColorPointerEXT_remap_index, -1 }, - { SecondaryColor3uiEXT_names, SecondaryColor3uiEXT_remap_index, -1 }, - { SecondaryColor3usvEXT_names, SecondaryColor3usvEXT_remap_index, -1 }, - { WindowPos3dvMESA_names, WindowPos3dvMESA_remap_index, -1 }, - { PointParameterivNV_names, PointParameterivNV_remap_index, -1 }, - { WindowPos3fvMESA_names, WindowPos3fvMESA_remap_index, -1 }, - { SecondaryColor3ivEXT_names, SecondaryColor3ivEXT_remap_index, -1 }, - { WindowPos2iMESA_names, WindowPos2iMESA_remap_index, -1 }, - { SecondaryColor3fvEXT_names, SecondaryColor3fvEXT_remap_index, -1 }, - { WindowPos3sMESA_names, WindowPos3sMESA_remap_index, -1 }, - { WindowPos2ivMESA_names, WindowPos2ivMESA_remap_index, -1 }, - { MultiDrawElementsEXT_names, MultiDrawElementsEXT_remap_index, -1 }, - { WindowPos2sMESA_names, WindowPos2sMESA_remap_index, -1 }, - { FogCoordPointerEXT_names, FogCoordPointerEXT_remap_index, -1 }, - { SecondaryColor3ubvEXT_names, SecondaryColor3ubvEXT_remap_index, -1 }, - { SecondaryColor3uivEXT_names, SecondaryColor3uivEXT_remap_index, -1 }, - { WindowPos3iMESA_names, WindowPos3iMESA_remap_index, -1 }, - { SecondaryColor3dvEXT_names, SecondaryColor3dvEXT_remap_index, -1 }, - { MultiDrawArraysEXT_names, MultiDrawArraysEXT_remap_index, -1 }, - { SecondaryColor3usEXT_names, SecondaryColor3usEXT_remap_index, -1 }, - { FogCoordfvEXT_names, FogCoordfvEXT_remap_index, -1 }, - { SecondaryColor3ubEXT_names, SecondaryColor3ubEXT_remap_index, -1 }, - { BlendFuncSeparateEXT_names, BlendFuncSeparateEXT_remap_index, -1 }, - { SecondaryColor3fEXT_names, SecondaryColor3fEXT_remap_index, -1 }, - { WindowPos3ivMESA_names, WindowPos3ivMESA_remap_index, -1 }, - { SecondaryColor3svEXT_names, SecondaryColor3svEXT_remap_index, -1 }, - { FogCoorddvEXT_names, FogCoorddvEXT_remap_index, -1 }, - { WindowPos3svMESA_names, WindowPos3svMESA_remap_index, -1 }, - { WindowPos2fMESA_names, WindowPos2fMESA_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_VERSION_1_5) -static const struct dri_extension_function GL_VERSION_1_5_functions[] = { - { BeginQueryARB_names, BeginQueryARB_remap_index, -1 }, - { GetBufferSubDataARB_names, GetBufferSubDataARB_remap_index, -1 }, - { BufferSubDataARB_names, BufferSubDataARB_remap_index, -1 }, - { GetQueryivARB_names, GetQueryivARB_remap_index, -1 }, - { GetQueryObjectivARB_names, GetQueryObjectivARB_remap_index, -1 }, - { BufferDataARB_names, BufferDataARB_remap_index, -1 }, - { EndQueryARB_names, EndQueryARB_remap_index, -1 }, - { GetBufferPointervARB_names, GetBufferPointervARB_remap_index, -1 }, - { GetQueryObjectuivARB_names, GetQueryObjectuivARB_remap_index, -1 }, - { GetBufferParameterivARB_names, GetBufferParameterivARB_remap_index, -1 }, - { DeleteQueriesARB_names, DeleteQueriesARB_remap_index, -1 }, - { IsQueryARB_names, IsQueryARB_remap_index, -1 }, - { MapBufferARB_names, MapBufferARB_remap_index, -1 }, - { GenQueriesARB_names, GenQueriesARB_remap_index, -1 }, - { IsBufferARB_names, IsBufferARB_remap_index, -1 }, - { DeleteBuffersARB_names, DeleteBuffersARB_remap_index, -1 }, - { UnmapBufferARB_names, UnmapBufferARB_remap_index, -1 }, - { BindBufferARB_names, BindBufferARB_remap_index, -1 }, - { GenBuffersARB_names, GenBuffersARB_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_VERSION_2_0) -static const struct dri_extension_function GL_VERSION_2_0_functions[] = { - { UniformMatrix3fvARB_names, UniformMatrix3fvARB_remap_index, -1 }, - { GetProgramiv_names, GetProgramiv_remap_index, -1 }, - { BlendEquationSeparateEXT_names, BlendEquationSeparateEXT_remap_index, -1 }, - { AttachShader_names, AttachShader_remap_index, -1 }, - { VertexAttrib2fARB_names, VertexAttrib2fARB_remap_index, -1 }, - { VertexAttrib3fARB_names, VertexAttrib3fARB_remap_index, -1 }, - { Uniform2fARB_names, Uniform2fARB_remap_index, -1 }, - { VertexAttrib1svARB_names, VertexAttrib1svARB_remap_index, -1 }, - { Uniform2ivARB_names, Uniform2ivARB_remap_index, -1 }, - { UniformMatrix4fvARB_names, UniformMatrix4fvARB_remap_index, -1 }, - { VertexAttrib4NusvARB_names, VertexAttrib4NusvARB_remap_index, -1 }, - { DisableVertexAttribArrayARB_names, DisableVertexAttribArrayARB_remap_index, -1 }, - { StencilMaskSeparate_names, StencilMaskSeparate_remap_index, -1 }, - { VertexAttrib1fARB_names, VertexAttrib1fARB_remap_index, -1 }, - { GetProgramInfoLog_names, GetProgramInfoLog_remap_index, -1 }, - { VertexAttrib4NbvARB_names, VertexAttrib4NbvARB_remap_index, -1 }, - { GetActiveAttribARB_names, GetActiveAttribARB_remap_index, -1 }, - { Uniform3iARB_names, Uniform3iARB_remap_index, -1 }, - { GetShaderInfoLog_names, GetShaderInfoLog_remap_index, -1 }, - { VertexAttrib1sARB_names, VertexAttrib1sARB_remap_index, -1 }, - { Uniform1fARB_names, Uniform1fARB_remap_index, -1 }, - { StencilOpSeparate_names, StencilOpSeparate_remap_index, -1 }, - { UniformMatrix2fvARB_names, UniformMatrix2fvARB_remap_index, -1 }, - { VertexAttrib3dvARB_names, VertexAttrib3dvARB_remap_index, -1 }, - { Uniform3fvARB_names, Uniform3fvARB_remap_index, -1 }, - { GetVertexAttribivARB_names, GetVertexAttribivARB_remap_index, -1 }, - { CreateProgram_names, CreateProgram_remap_index, -1 }, - { StencilFuncSeparate_names, StencilFuncSeparate_remap_index, -1 }, - { VertexAttrib4ivARB_names, VertexAttrib4ivARB_remap_index, -1 }, - { VertexAttrib4bvARB_names, VertexAttrib4bvARB_remap_index, -1 }, - { VertexAttrib3dARB_names, VertexAttrib3dARB_remap_index, -1 }, - { VertexAttrib4fARB_names, VertexAttrib4fARB_remap_index, -1 }, - { VertexAttrib4fvARB_names, VertexAttrib4fvARB_remap_index, -1 }, - { GetActiveUniformARB_names, GetActiveUniformARB_remap_index, -1 }, - { IsShader_names, IsShader_remap_index, -1 }, - { GetUniformivARB_names, GetUniformivARB_remap_index, -1 }, - { IsProgram_names, IsProgram_remap_index, -1 }, - { Uniform2fvARB_names, Uniform2fvARB_remap_index, -1 }, - { ValidateProgramARB_names, ValidateProgramARB_remap_index, -1 }, - { VertexAttrib2dARB_names, VertexAttrib2dARB_remap_index, -1 }, - { VertexAttrib1dvARB_names, VertexAttrib1dvARB_remap_index, -1 }, - { GetVertexAttribfvARB_names, GetVertexAttribfvARB_remap_index, -1 }, - { GetAttribLocationARB_names, GetAttribLocationARB_remap_index, -1 }, - { VertexAttrib4ubvARB_names, VertexAttrib4ubvARB_remap_index, -1 }, - { Uniform3ivARB_names, Uniform3ivARB_remap_index, -1 }, - { VertexAttrib4sARB_names, VertexAttrib4sARB_remap_index, -1 }, - { VertexAttrib2dvARB_names, VertexAttrib2dvARB_remap_index, -1 }, - { VertexAttrib2fvARB_names, VertexAttrib2fvARB_remap_index, -1 }, - { VertexAttrib4NivARB_names, VertexAttrib4NivARB_remap_index, -1 }, - { GetAttachedShaders_names, GetAttachedShaders_remap_index, -1 }, - { CompileShaderARB_names, CompileShaderARB_remap_index, -1 }, - { DeleteShader_names, DeleteShader_remap_index, -1 }, - { Uniform3fARB_names, Uniform3fARB_remap_index, -1 }, - { VertexAttrib4NuivARB_names, VertexAttrib4NuivARB_remap_index, -1 }, - { Uniform4fARB_names, Uniform4fARB_remap_index, -1 }, - { VertexAttrib1dARB_names, VertexAttrib1dARB_remap_index, -1 }, - { VertexAttrib4usvARB_names, VertexAttrib4usvARB_remap_index, -1 }, - { LinkProgramARB_names, LinkProgramARB_remap_index, -1 }, - { ShaderSourceARB_names, ShaderSourceARB_remap_index, -1 }, - { VertexAttrib3svARB_names, VertexAttrib3svARB_remap_index, -1 }, - { Uniform4ivARB_names, Uniform4ivARB_remap_index, -1 }, - { GetVertexAttribdvARB_names, GetVertexAttribdvARB_remap_index, -1 }, - { Uniform1ivARB_names, Uniform1ivARB_remap_index, -1 }, - { VertexAttrib4dvARB_names, VertexAttrib4dvARB_remap_index, -1 }, - { BindAttribLocationARB_names, BindAttribLocationARB_remap_index, -1 }, - { Uniform1iARB_names, Uniform1iARB_remap_index, -1 }, - { VertexAttribPointerARB_names, VertexAttribPointerARB_remap_index, -1 }, - { VertexAttrib4NsvARB_names, VertexAttrib4NsvARB_remap_index, -1 }, - { VertexAttrib3fvARB_names, VertexAttrib3fvARB_remap_index, -1 }, - { CreateShader_names, CreateShader_remap_index, -1 }, - { DetachShader_names, DetachShader_remap_index, -1 }, - { VertexAttrib4NubARB_names, VertexAttrib4NubARB_remap_index, -1 }, - { Uniform4fvARB_names, Uniform4fvARB_remap_index, -1 }, - { GetUniformfvARB_names, GetUniformfvARB_remap_index, -1 }, - { Uniform4iARB_names, Uniform4iARB_remap_index, -1 }, - { UseProgramObjectARB_names, UseProgramObjectARB_remap_index, -1 }, - { DeleteProgram_names, DeleteProgram_remap_index, -1 }, - { GetVertexAttribPointervNV_names, GetVertexAttribPointervNV_remap_index, -1 }, - { Uniform2iARB_names, Uniform2iARB_remap_index, -1 }, - { VertexAttrib4dARB_names, VertexAttrib4dARB_remap_index, -1 }, - { GetUniformLocationARB_names, GetUniformLocationARB_remap_index, -1 }, - { VertexAttrib3sARB_names, VertexAttrib3sARB_remap_index, -1 }, - { GetShaderSourceARB_names, GetShaderSourceARB_remap_index, -1 }, - { DrawBuffersARB_names, DrawBuffersARB_remap_index, -1 }, - { Uniform1fvARB_names, Uniform1fvARB_remap_index, -1 }, - { EnableVertexAttribArrayARB_names, EnableVertexAttribArrayARB_remap_index, -1 }, - { VertexAttrib4uivARB_names, VertexAttrib4uivARB_remap_index, -1 }, - { VertexAttrib4svARB_names, VertexAttrib4svARB_remap_index, -1 }, - { GetShaderiv_names, GetShaderiv_remap_index, -1 }, - { VertexAttrib2svARB_names, VertexAttrib2svARB_remap_index, -1 }, - { VertexAttrib4NubvARB_names, VertexAttrib4NubvARB_remap_index, -1 }, - { VertexAttrib2sARB_names, VertexAttrib2sARB_remap_index, -1 }, - { VertexAttrib1fvARB_names, VertexAttrib1fvARB_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - -#if defined(need_GL_VERSION_2_1) -static const struct dri_extension_function GL_VERSION_2_1_functions[] = { - { UniformMatrix2x4fv_names, UniformMatrix2x4fv_remap_index, -1 }, - { UniformMatrix4x3fv_names, UniformMatrix4x3fv_remap_index, -1 }, - { UniformMatrix4x2fv_names, UniformMatrix4x2fv_remap_index, -1 }, - { UniformMatrix2x3fv_names, UniformMatrix2x3fv_remap_index, -1 }, - { UniformMatrix3x4fv_names, UniformMatrix3x4fv_remap_index, -1 }, - { UniformMatrix3x2fv_names, UniformMatrix3x2fv_remap_index, -1 }, - { NULL, 0, 0 } -}; -#endif - diff --git a/src/mesa/glapi/Makefile b/src/mesa/glapi/Makefile index 08c376a4b0..684fbfefc1 100644 --- a/src/mesa/glapi/Makefile +++ b/src/mesa/glapi/Makefile @@ -13,7 +13,6 @@ OUTPUTS = glprocs.h glapitemp.h glapioffsets.h glapitable.h dispatch.h \ ../x86/glapi_x86.S \ ../x86-64/glapi_x86-64.S \ ../sparc/glapi_sparc.S \ - ../drivers/dri/common/extension_helper.h \ ../../glx/x11/indirect.c \ ../../glx/x11/indirect.h \ ../../glx/x11/indirect_init.c \ @@ -105,10 +104,6 @@ dispatch.h $(GLX_DIR)/dispatch.h: gl_table.py $(COMMON) ../sparc/glapi_sparc.S: gl_SPARC_asm.py $(COMMON) $(PYTHON2) $(PYTHON_FLAGS) $< > $@ - -../drivers/dri/common/extension_helper.h: extension_helper.py $(COMMON) - $(PYTHON2) $(PYTHON_FLAGS) $< > $@ - ../../glx/x11/indirect.c: glX_proto_send.py $(COMMON_GLX) $(PYTHON2) $(PYTHON_FLAGS) $< -m proto | $(INDENT) $(INDENT_FLAGS) > $@ -- cgit v1.2.3 From 22884db174b9fb0736cec1c6a192f8b9a97500c1 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 16 Oct 2009 16:01:57 +0800 Subject: glapi: Move dispatch marcos to glapidispatch.h. dispatch.h is kept as a wrapper to glapidispatch.h. Signed-off-by: Chia-I Wu --- src/mesa/glapi/Makefile | 5 +- src/mesa/glapi/dispatch.h | 3982 +-------------------------------------- src/mesa/glapi/gl_table.py | 5 +- src/mesa/glapi/glapidispatch.h | 4005 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 4014 insertions(+), 3983 deletions(-) create mode 100644 src/mesa/glapi/glapidispatch.h (limited to 'src') diff --git a/src/mesa/glapi/Makefile b/src/mesa/glapi/Makefile index 684fbfefc1..fb6be1a3a9 100644 --- a/src/mesa/glapi/Makefile +++ b/src/mesa/glapi/Makefile @@ -7,7 +7,7 @@ TOP = ../../.. include $(TOP)/configs/current -OUTPUTS = glprocs.h glapitemp.h glapioffsets.h glapitable.h dispatch.h \ +OUTPUTS = glprocs.h glapitemp.h glapioffsets.h glapitable.h glapidispatch.h \ ../main/enums.c \ ../main/remap_helper.h \ ../x86/glapi_x86.S \ @@ -41,6 +41,7 @@ SERVER_OUTPUTS = \ $(GLX_DIR)/glapitemp.h \ $(GLX_DIR)/glapitable.h \ $(GLX_DIR)/glapioffsets.h \ + $(GLX_DIR)/glapidispatch.h \ $(GLX_DIR)/glprocs.h \ $(GLX_DIR)/dispatch.h \ $(SERVER_GLAPI_FILES) @@ -86,7 +87,7 @@ glapioffsets.h $(GLX_DIR)/glapioffsets.h: gl_offsets.py $(COMMON) glapitable.h $(GLX_DIR)/glapitable.h: gl_table.py $(COMMON) $(PYTHON2) $(PYTHON_FLAGS) $< > $@ -dispatch.h $(GLX_DIR)/dispatch.h: gl_table.py $(COMMON) +glapidispatch.h $(GLX_DIR)/glapidispatch.h: gl_table.py $(COMMON) $(PYTHON2) $(PYTHON_FLAGS) $< -m remap_table > $@ ../main/enums.c: gl_enums.py $(COMMON) diff --git a/src/mesa/glapi/dispatch.h b/src/mesa/glapi/dispatch.h index efbd56fa71..dafcf3e8f2 100644 --- a/src/mesa/glapi/dispatch.h +++ b/src/mesa/glapi/dispatch.h @@ -1,5 +1,3 @@ -/* DO NOT EDIT - This file generated automatically by gl_table.py (from Mesa) script */ - /* * (C) Copyright IBM Corporation 2005 * All Rights Reserved. @@ -25,3982 +23,10 @@ * SOFTWARE. */ -#if !defined( _DISPATCH_H_ ) -# define _DISPATCH_H_ - +#ifndef _DISPATCH_H +#define _DISPATCH_H #include "glapitable.h" -/** - * \file dispatch.h - * Macros for handling GL dispatch tables. - * - * For each known GL function, there are 3 macros in this file. The first - * macro is named CALL_FuncName and is used to call that GL function using - * the specified dispatch table. The other 2 macros, called GET_FuncName - * can SET_FuncName, are used to get and set the dispatch pointer for the - * named function in the specified dispatch table. - */ - -#define CALL_by_offset(disp, cast, offset, parameters) \ - (*(cast (GET_by_offset(disp, offset)))) parameters -#define GET_by_offset(disp, offset) \ - (offset >= 0) ? (((_glapi_proc *)(disp))[offset]) : NULL -#define SET_by_offset(disp, offset, fn) \ - do { \ - if ( (offset) < 0 ) { \ - /* fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, %s)!\n", */ \ - /* __func__, __LINE__, disp, offset, # fn); */ \ - /* abort(); */ \ - } \ - else { \ - ( (_glapi_proc *) (disp) )[offset] = (_glapi_proc) fn; \ - } \ - } while(0) - -#define CALL_NewList(disp, parameters) (*((disp)->NewList)) parameters -#define GET_NewList(disp) ((disp)->NewList) -#define SET_NewList(disp, fn) ((disp)->NewList = fn) -#define CALL_EndList(disp, parameters) (*((disp)->EndList)) parameters -#define GET_EndList(disp) ((disp)->EndList) -#define SET_EndList(disp, fn) ((disp)->EndList = fn) -#define CALL_CallList(disp, parameters) (*((disp)->CallList)) parameters -#define GET_CallList(disp) ((disp)->CallList) -#define SET_CallList(disp, fn) ((disp)->CallList = fn) -#define CALL_CallLists(disp, parameters) (*((disp)->CallLists)) parameters -#define GET_CallLists(disp) ((disp)->CallLists) -#define SET_CallLists(disp, fn) ((disp)->CallLists = fn) -#define CALL_DeleteLists(disp, parameters) (*((disp)->DeleteLists)) parameters -#define GET_DeleteLists(disp) ((disp)->DeleteLists) -#define SET_DeleteLists(disp, fn) ((disp)->DeleteLists = fn) -#define CALL_GenLists(disp, parameters) (*((disp)->GenLists)) parameters -#define GET_GenLists(disp) ((disp)->GenLists) -#define SET_GenLists(disp, fn) ((disp)->GenLists = fn) -#define CALL_ListBase(disp, parameters) (*((disp)->ListBase)) parameters -#define GET_ListBase(disp) ((disp)->ListBase) -#define SET_ListBase(disp, fn) ((disp)->ListBase = fn) -#define CALL_Begin(disp, parameters) (*((disp)->Begin)) parameters -#define GET_Begin(disp) ((disp)->Begin) -#define SET_Begin(disp, fn) ((disp)->Begin = fn) -#define CALL_Bitmap(disp, parameters) (*((disp)->Bitmap)) parameters -#define GET_Bitmap(disp) ((disp)->Bitmap) -#define SET_Bitmap(disp, fn) ((disp)->Bitmap = fn) -#define CALL_Color3b(disp, parameters) (*((disp)->Color3b)) parameters -#define GET_Color3b(disp) ((disp)->Color3b) -#define SET_Color3b(disp, fn) ((disp)->Color3b = fn) -#define CALL_Color3bv(disp, parameters) (*((disp)->Color3bv)) parameters -#define GET_Color3bv(disp) ((disp)->Color3bv) -#define SET_Color3bv(disp, fn) ((disp)->Color3bv = fn) -#define CALL_Color3d(disp, parameters) (*((disp)->Color3d)) parameters -#define GET_Color3d(disp) ((disp)->Color3d) -#define SET_Color3d(disp, fn) ((disp)->Color3d = fn) -#define CALL_Color3dv(disp, parameters) (*((disp)->Color3dv)) parameters -#define GET_Color3dv(disp) ((disp)->Color3dv) -#define SET_Color3dv(disp, fn) ((disp)->Color3dv = fn) -#define CALL_Color3f(disp, parameters) (*((disp)->Color3f)) parameters -#define GET_Color3f(disp) ((disp)->Color3f) -#define SET_Color3f(disp, fn) ((disp)->Color3f = fn) -#define CALL_Color3fv(disp, parameters) (*((disp)->Color3fv)) parameters -#define GET_Color3fv(disp) ((disp)->Color3fv) -#define SET_Color3fv(disp, fn) ((disp)->Color3fv = fn) -#define CALL_Color3i(disp, parameters) (*((disp)->Color3i)) parameters -#define GET_Color3i(disp) ((disp)->Color3i) -#define SET_Color3i(disp, fn) ((disp)->Color3i = fn) -#define CALL_Color3iv(disp, parameters) (*((disp)->Color3iv)) parameters -#define GET_Color3iv(disp) ((disp)->Color3iv) -#define SET_Color3iv(disp, fn) ((disp)->Color3iv = fn) -#define CALL_Color3s(disp, parameters) (*((disp)->Color3s)) parameters -#define GET_Color3s(disp) ((disp)->Color3s) -#define SET_Color3s(disp, fn) ((disp)->Color3s = fn) -#define CALL_Color3sv(disp, parameters) (*((disp)->Color3sv)) parameters -#define GET_Color3sv(disp) ((disp)->Color3sv) -#define SET_Color3sv(disp, fn) ((disp)->Color3sv = fn) -#define CALL_Color3ub(disp, parameters) (*((disp)->Color3ub)) parameters -#define GET_Color3ub(disp) ((disp)->Color3ub) -#define SET_Color3ub(disp, fn) ((disp)->Color3ub = fn) -#define CALL_Color3ubv(disp, parameters) (*((disp)->Color3ubv)) parameters -#define GET_Color3ubv(disp) ((disp)->Color3ubv) -#define SET_Color3ubv(disp, fn) ((disp)->Color3ubv = fn) -#define CALL_Color3ui(disp, parameters) (*((disp)->Color3ui)) parameters -#define GET_Color3ui(disp) ((disp)->Color3ui) -#define SET_Color3ui(disp, fn) ((disp)->Color3ui = fn) -#define CALL_Color3uiv(disp, parameters) (*((disp)->Color3uiv)) parameters -#define GET_Color3uiv(disp) ((disp)->Color3uiv) -#define SET_Color3uiv(disp, fn) ((disp)->Color3uiv = fn) -#define CALL_Color3us(disp, parameters) (*((disp)->Color3us)) parameters -#define GET_Color3us(disp) ((disp)->Color3us) -#define SET_Color3us(disp, fn) ((disp)->Color3us = fn) -#define CALL_Color3usv(disp, parameters) (*((disp)->Color3usv)) parameters -#define GET_Color3usv(disp) ((disp)->Color3usv) -#define SET_Color3usv(disp, fn) ((disp)->Color3usv = fn) -#define CALL_Color4b(disp, parameters) (*((disp)->Color4b)) parameters -#define GET_Color4b(disp) ((disp)->Color4b) -#define SET_Color4b(disp, fn) ((disp)->Color4b = fn) -#define CALL_Color4bv(disp, parameters) (*((disp)->Color4bv)) parameters -#define GET_Color4bv(disp) ((disp)->Color4bv) -#define SET_Color4bv(disp, fn) ((disp)->Color4bv = fn) -#define CALL_Color4d(disp, parameters) (*((disp)->Color4d)) parameters -#define GET_Color4d(disp) ((disp)->Color4d) -#define SET_Color4d(disp, fn) ((disp)->Color4d = fn) -#define CALL_Color4dv(disp, parameters) (*((disp)->Color4dv)) parameters -#define GET_Color4dv(disp) ((disp)->Color4dv) -#define SET_Color4dv(disp, fn) ((disp)->Color4dv = fn) -#define CALL_Color4f(disp, parameters) (*((disp)->Color4f)) parameters -#define GET_Color4f(disp) ((disp)->Color4f) -#define SET_Color4f(disp, fn) ((disp)->Color4f = fn) -#define CALL_Color4fv(disp, parameters) (*((disp)->Color4fv)) parameters -#define GET_Color4fv(disp) ((disp)->Color4fv) -#define SET_Color4fv(disp, fn) ((disp)->Color4fv = fn) -#define CALL_Color4i(disp, parameters) (*((disp)->Color4i)) parameters -#define GET_Color4i(disp) ((disp)->Color4i) -#define SET_Color4i(disp, fn) ((disp)->Color4i = fn) -#define CALL_Color4iv(disp, parameters) (*((disp)->Color4iv)) parameters -#define GET_Color4iv(disp) ((disp)->Color4iv) -#define SET_Color4iv(disp, fn) ((disp)->Color4iv = fn) -#define CALL_Color4s(disp, parameters) (*((disp)->Color4s)) parameters -#define GET_Color4s(disp) ((disp)->Color4s) -#define SET_Color4s(disp, fn) ((disp)->Color4s = fn) -#define CALL_Color4sv(disp, parameters) (*((disp)->Color4sv)) parameters -#define GET_Color4sv(disp) ((disp)->Color4sv) -#define SET_Color4sv(disp, fn) ((disp)->Color4sv = fn) -#define CALL_Color4ub(disp, parameters) (*((disp)->Color4ub)) parameters -#define GET_Color4ub(disp) ((disp)->Color4ub) -#define SET_Color4ub(disp, fn) ((disp)->Color4ub = fn) -#define CALL_Color4ubv(disp, parameters) (*((disp)->Color4ubv)) parameters -#define GET_Color4ubv(disp) ((disp)->Color4ubv) -#define SET_Color4ubv(disp, fn) ((disp)->Color4ubv = fn) -#define CALL_Color4ui(disp, parameters) (*((disp)->Color4ui)) parameters -#define GET_Color4ui(disp) ((disp)->Color4ui) -#define SET_Color4ui(disp, fn) ((disp)->Color4ui = fn) -#define CALL_Color4uiv(disp, parameters) (*((disp)->Color4uiv)) parameters -#define GET_Color4uiv(disp) ((disp)->Color4uiv) -#define SET_Color4uiv(disp, fn) ((disp)->Color4uiv = fn) -#define CALL_Color4us(disp, parameters) (*((disp)->Color4us)) parameters -#define GET_Color4us(disp) ((disp)->Color4us) -#define SET_Color4us(disp, fn) ((disp)->Color4us = fn) -#define CALL_Color4usv(disp, parameters) (*((disp)->Color4usv)) parameters -#define GET_Color4usv(disp) ((disp)->Color4usv) -#define SET_Color4usv(disp, fn) ((disp)->Color4usv = fn) -#define CALL_EdgeFlag(disp, parameters) (*((disp)->EdgeFlag)) parameters -#define GET_EdgeFlag(disp) ((disp)->EdgeFlag) -#define SET_EdgeFlag(disp, fn) ((disp)->EdgeFlag = fn) -#define CALL_EdgeFlagv(disp, parameters) (*((disp)->EdgeFlagv)) parameters -#define GET_EdgeFlagv(disp) ((disp)->EdgeFlagv) -#define SET_EdgeFlagv(disp, fn) ((disp)->EdgeFlagv = fn) -#define CALL_End(disp, parameters) (*((disp)->End)) parameters -#define GET_End(disp) ((disp)->End) -#define SET_End(disp, fn) ((disp)->End = fn) -#define CALL_Indexd(disp, parameters) (*((disp)->Indexd)) parameters -#define GET_Indexd(disp) ((disp)->Indexd) -#define SET_Indexd(disp, fn) ((disp)->Indexd = fn) -#define CALL_Indexdv(disp, parameters) (*((disp)->Indexdv)) parameters -#define GET_Indexdv(disp) ((disp)->Indexdv) -#define SET_Indexdv(disp, fn) ((disp)->Indexdv = fn) -#define CALL_Indexf(disp, parameters) (*((disp)->Indexf)) parameters -#define GET_Indexf(disp) ((disp)->Indexf) -#define SET_Indexf(disp, fn) ((disp)->Indexf = fn) -#define CALL_Indexfv(disp, parameters) (*((disp)->Indexfv)) parameters -#define GET_Indexfv(disp) ((disp)->Indexfv) -#define SET_Indexfv(disp, fn) ((disp)->Indexfv = fn) -#define CALL_Indexi(disp, parameters) (*((disp)->Indexi)) parameters -#define GET_Indexi(disp) ((disp)->Indexi) -#define SET_Indexi(disp, fn) ((disp)->Indexi = fn) -#define CALL_Indexiv(disp, parameters) (*((disp)->Indexiv)) parameters -#define GET_Indexiv(disp) ((disp)->Indexiv) -#define SET_Indexiv(disp, fn) ((disp)->Indexiv = fn) -#define CALL_Indexs(disp, parameters) (*((disp)->Indexs)) parameters -#define GET_Indexs(disp) ((disp)->Indexs) -#define SET_Indexs(disp, fn) ((disp)->Indexs = fn) -#define CALL_Indexsv(disp, parameters) (*((disp)->Indexsv)) parameters -#define GET_Indexsv(disp) ((disp)->Indexsv) -#define SET_Indexsv(disp, fn) ((disp)->Indexsv = fn) -#define CALL_Normal3b(disp, parameters) (*((disp)->Normal3b)) parameters -#define GET_Normal3b(disp) ((disp)->Normal3b) -#define SET_Normal3b(disp, fn) ((disp)->Normal3b = fn) -#define CALL_Normal3bv(disp, parameters) (*((disp)->Normal3bv)) parameters -#define GET_Normal3bv(disp) ((disp)->Normal3bv) -#define SET_Normal3bv(disp, fn) ((disp)->Normal3bv = fn) -#define CALL_Normal3d(disp, parameters) (*((disp)->Normal3d)) parameters -#define GET_Normal3d(disp) ((disp)->Normal3d) -#define SET_Normal3d(disp, fn) ((disp)->Normal3d = fn) -#define CALL_Normal3dv(disp, parameters) (*((disp)->Normal3dv)) parameters -#define GET_Normal3dv(disp) ((disp)->Normal3dv) -#define SET_Normal3dv(disp, fn) ((disp)->Normal3dv = fn) -#define CALL_Normal3f(disp, parameters) (*((disp)->Normal3f)) parameters -#define GET_Normal3f(disp) ((disp)->Normal3f) -#define SET_Normal3f(disp, fn) ((disp)->Normal3f = fn) -#define CALL_Normal3fv(disp, parameters) (*((disp)->Normal3fv)) parameters -#define GET_Normal3fv(disp) ((disp)->Normal3fv) -#define SET_Normal3fv(disp, fn) ((disp)->Normal3fv = fn) -#define CALL_Normal3i(disp, parameters) (*((disp)->Normal3i)) parameters -#define GET_Normal3i(disp) ((disp)->Normal3i) -#define SET_Normal3i(disp, fn) ((disp)->Normal3i = fn) -#define CALL_Normal3iv(disp, parameters) (*((disp)->Normal3iv)) parameters -#define GET_Normal3iv(disp) ((disp)->Normal3iv) -#define SET_Normal3iv(disp, fn) ((disp)->Normal3iv = fn) -#define CALL_Normal3s(disp, parameters) (*((disp)->Normal3s)) parameters -#define GET_Normal3s(disp) ((disp)->Normal3s) -#define SET_Normal3s(disp, fn) ((disp)->Normal3s = fn) -#define CALL_Normal3sv(disp, parameters) (*((disp)->Normal3sv)) parameters -#define GET_Normal3sv(disp) ((disp)->Normal3sv) -#define SET_Normal3sv(disp, fn) ((disp)->Normal3sv = fn) -#define CALL_RasterPos2d(disp, parameters) (*((disp)->RasterPos2d)) parameters -#define GET_RasterPos2d(disp) ((disp)->RasterPos2d) -#define SET_RasterPos2d(disp, fn) ((disp)->RasterPos2d = fn) -#define CALL_RasterPos2dv(disp, parameters) (*((disp)->RasterPos2dv)) parameters -#define GET_RasterPos2dv(disp) ((disp)->RasterPos2dv) -#define SET_RasterPos2dv(disp, fn) ((disp)->RasterPos2dv = fn) -#define CALL_RasterPos2f(disp, parameters) (*((disp)->RasterPos2f)) parameters -#define GET_RasterPos2f(disp) ((disp)->RasterPos2f) -#define SET_RasterPos2f(disp, fn) ((disp)->RasterPos2f = fn) -#define CALL_RasterPos2fv(disp, parameters) (*((disp)->RasterPos2fv)) parameters -#define GET_RasterPos2fv(disp) ((disp)->RasterPos2fv) -#define SET_RasterPos2fv(disp, fn) ((disp)->RasterPos2fv = fn) -#define CALL_RasterPos2i(disp, parameters) (*((disp)->RasterPos2i)) parameters -#define GET_RasterPos2i(disp) ((disp)->RasterPos2i) -#define SET_RasterPos2i(disp, fn) ((disp)->RasterPos2i = fn) -#define CALL_RasterPos2iv(disp, parameters) (*((disp)->RasterPos2iv)) parameters -#define GET_RasterPos2iv(disp) ((disp)->RasterPos2iv) -#define SET_RasterPos2iv(disp, fn) ((disp)->RasterPos2iv = fn) -#define CALL_RasterPos2s(disp, parameters) (*((disp)->RasterPos2s)) parameters -#define GET_RasterPos2s(disp) ((disp)->RasterPos2s) -#define SET_RasterPos2s(disp, fn) ((disp)->RasterPos2s = fn) -#define CALL_RasterPos2sv(disp, parameters) (*((disp)->RasterPos2sv)) parameters -#define GET_RasterPos2sv(disp) ((disp)->RasterPos2sv) -#define SET_RasterPos2sv(disp, fn) ((disp)->RasterPos2sv = fn) -#define CALL_RasterPos3d(disp, parameters) (*((disp)->RasterPos3d)) parameters -#define GET_RasterPos3d(disp) ((disp)->RasterPos3d) -#define SET_RasterPos3d(disp, fn) ((disp)->RasterPos3d = fn) -#define CALL_RasterPos3dv(disp, parameters) (*((disp)->RasterPos3dv)) parameters -#define GET_RasterPos3dv(disp) ((disp)->RasterPos3dv) -#define SET_RasterPos3dv(disp, fn) ((disp)->RasterPos3dv = fn) -#define CALL_RasterPos3f(disp, parameters) (*((disp)->RasterPos3f)) parameters -#define GET_RasterPos3f(disp) ((disp)->RasterPos3f) -#define SET_RasterPos3f(disp, fn) ((disp)->RasterPos3f = fn) -#define CALL_RasterPos3fv(disp, parameters) (*((disp)->RasterPos3fv)) parameters -#define GET_RasterPos3fv(disp) ((disp)->RasterPos3fv) -#define SET_RasterPos3fv(disp, fn) ((disp)->RasterPos3fv = fn) -#define CALL_RasterPos3i(disp, parameters) (*((disp)->RasterPos3i)) parameters -#define GET_RasterPos3i(disp) ((disp)->RasterPos3i) -#define SET_RasterPos3i(disp, fn) ((disp)->RasterPos3i = fn) -#define CALL_RasterPos3iv(disp, parameters) (*((disp)->RasterPos3iv)) parameters -#define GET_RasterPos3iv(disp) ((disp)->RasterPos3iv) -#define SET_RasterPos3iv(disp, fn) ((disp)->RasterPos3iv = fn) -#define CALL_RasterPos3s(disp, parameters) (*((disp)->RasterPos3s)) parameters -#define GET_RasterPos3s(disp) ((disp)->RasterPos3s) -#define SET_RasterPos3s(disp, fn) ((disp)->RasterPos3s = fn) -#define CALL_RasterPos3sv(disp, parameters) (*((disp)->RasterPos3sv)) parameters -#define GET_RasterPos3sv(disp) ((disp)->RasterPos3sv) -#define SET_RasterPos3sv(disp, fn) ((disp)->RasterPos3sv = fn) -#define CALL_RasterPos4d(disp, parameters) (*((disp)->RasterPos4d)) parameters -#define GET_RasterPos4d(disp) ((disp)->RasterPos4d) -#define SET_RasterPos4d(disp, fn) ((disp)->RasterPos4d = fn) -#define CALL_RasterPos4dv(disp, parameters) (*((disp)->RasterPos4dv)) parameters -#define GET_RasterPos4dv(disp) ((disp)->RasterPos4dv) -#define SET_RasterPos4dv(disp, fn) ((disp)->RasterPos4dv = fn) -#define CALL_RasterPos4f(disp, parameters) (*((disp)->RasterPos4f)) parameters -#define GET_RasterPos4f(disp) ((disp)->RasterPos4f) -#define SET_RasterPos4f(disp, fn) ((disp)->RasterPos4f = fn) -#define CALL_RasterPos4fv(disp, parameters) (*((disp)->RasterPos4fv)) parameters -#define GET_RasterPos4fv(disp) ((disp)->RasterPos4fv) -#define SET_RasterPos4fv(disp, fn) ((disp)->RasterPos4fv = fn) -#define CALL_RasterPos4i(disp, parameters) (*((disp)->RasterPos4i)) parameters -#define GET_RasterPos4i(disp) ((disp)->RasterPos4i) -#define SET_RasterPos4i(disp, fn) ((disp)->RasterPos4i = fn) -#define CALL_RasterPos4iv(disp, parameters) (*((disp)->RasterPos4iv)) parameters -#define GET_RasterPos4iv(disp) ((disp)->RasterPos4iv) -#define SET_RasterPos4iv(disp, fn) ((disp)->RasterPos4iv = fn) -#define CALL_RasterPos4s(disp, parameters) (*((disp)->RasterPos4s)) parameters -#define GET_RasterPos4s(disp) ((disp)->RasterPos4s) -#define SET_RasterPos4s(disp, fn) ((disp)->RasterPos4s = fn) -#define CALL_RasterPos4sv(disp, parameters) (*((disp)->RasterPos4sv)) parameters -#define GET_RasterPos4sv(disp) ((disp)->RasterPos4sv) -#define SET_RasterPos4sv(disp, fn) ((disp)->RasterPos4sv = fn) -#define CALL_Rectd(disp, parameters) (*((disp)->Rectd)) parameters -#define GET_Rectd(disp) ((disp)->Rectd) -#define SET_Rectd(disp, fn) ((disp)->Rectd = fn) -#define CALL_Rectdv(disp, parameters) (*((disp)->Rectdv)) parameters -#define GET_Rectdv(disp) ((disp)->Rectdv) -#define SET_Rectdv(disp, fn) ((disp)->Rectdv = fn) -#define CALL_Rectf(disp, parameters) (*((disp)->Rectf)) parameters -#define GET_Rectf(disp) ((disp)->Rectf) -#define SET_Rectf(disp, fn) ((disp)->Rectf = fn) -#define CALL_Rectfv(disp, parameters) (*((disp)->Rectfv)) parameters -#define GET_Rectfv(disp) ((disp)->Rectfv) -#define SET_Rectfv(disp, fn) ((disp)->Rectfv = fn) -#define CALL_Recti(disp, parameters) (*((disp)->Recti)) parameters -#define GET_Recti(disp) ((disp)->Recti) -#define SET_Recti(disp, fn) ((disp)->Recti = fn) -#define CALL_Rectiv(disp, parameters) (*((disp)->Rectiv)) parameters -#define GET_Rectiv(disp) ((disp)->Rectiv) -#define SET_Rectiv(disp, fn) ((disp)->Rectiv = fn) -#define CALL_Rects(disp, parameters) (*((disp)->Rects)) parameters -#define GET_Rects(disp) ((disp)->Rects) -#define SET_Rects(disp, fn) ((disp)->Rects = fn) -#define CALL_Rectsv(disp, parameters) (*((disp)->Rectsv)) parameters -#define GET_Rectsv(disp) ((disp)->Rectsv) -#define SET_Rectsv(disp, fn) ((disp)->Rectsv = fn) -#define CALL_TexCoord1d(disp, parameters) (*((disp)->TexCoord1d)) parameters -#define GET_TexCoord1d(disp) ((disp)->TexCoord1d) -#define SET_TexCoord1d(disp, fn) ((disp)->TexCoord1d = fn) -#define CALL_TexCoord1dv(disp, parameters) (*((disp)->TexCoord1dv)) parameters -#define GET_TexCoord1dv(disp) ((disp)->TexCoord1dv) -#define SET_TexCoord1dv(disp, fn) ((disp)->TexCoord1dv = fn) -#define CALL_TexCoord1f(disp, parameters) (*((disp)->TexCoord1f)) parameters -#define GET_TexCoord1f(disp) ((disp)->TexCoord1f) -#define SET_TexCoord1f(disp, fn) ((disp)->TexCoord1f = fn) -#define CALL_TexCoord1fv(disp, parameters) (*((disp)->TexCoord1fv)) parameters -#define GET_TexCoord1fv(disp) ((disp)->TexCoord1fv) -#define SET_TexCoord1fv(disp, fn) ((disp)->TexCoord1fv = fn) -#define CALL_TexCoord1i(disp, parameters) (*((disp)->TexCoord1i)) parameters -#define GET_TexCoord1i(disp) ((disp)->TexCoord1i) -#define SET_TexCoord1i(disp, fn) ((disp)->TexCoord1i = fn) -#define CALL_TexCoord1iv(disp, parameters) (*((disp)->TexCoord1iv)) parameters -#define GET_TexCoord1iv(disp) ((disp)->TexCoord1iv) -#define SET_TexCoord1iv(disp, fn) ((disp)->TexCoord1iv = fn) -#define CALL_TexCoord1s(disp, parameters) (*((disp)->TexCoord1s)) parameters -#define GET_TexCoord1s(disp) ((disp)->TexCoord1s) -#define SET_TexCoord1s(disp, fn) ((disp)->TexCoord1s = fn) -#define CALL_TexCoord1sv(disp, parameters) (*((disp)->TexCoord1sv)) parameters -#define GET_TexCoord1sv(disp) ((disp)->TexCoord1sv) -#define SET_TexCoord1sv(disp, fn) ((disp)->TexCoord1sv = fn) -#define CALL_TexCoord2d(disp, parameters) (*((disp)->TexCoord2d)) parameters -#define GET_TexCoord2d(disp) ((disp)->TexCoord2d) -#define SET_TexCoord2d(disp, fn) ((disp)->TexCoord2d = fn) -#define CALL_TexCoord2dv(disp, parameters) (*((disp)->TexCoord2dv)) parameters -#define GET_TexCoord2dv(disp) ((disp)->TexCoord2dv) -#define SET_TexCoord2dv(disp, fn) ((disp)->TexCoord2dv = fn) -#define CALL_TexCoord2f(disp, parameters) (*((disp)->TexCoord2f)) parameters -#define GET_TexCoord2f(disp) ((disp)->TexCoord2f) -#define SET_TexCoord2f(disp, fn) ((disp)->TexCoord2f = fn) -#define CALL_TexCoord2fv(disp, parameters) (*((disp)->TexCoord2fv)) parameters -#define GET_TexCoord2fv(disp) ((disp)->TexCoord2fv) -#define SET_TexCoord2fv(disp, fn) ((disp)->TexCoord2fv = fn) -#define CALL_TexCoord2i(disp, parameters) (*((disp)->TexCoord2i)) parameters -#define GET_TexCoord2i(disp) ((disp)->TexCoord2i) -#define SET_TexCoord2i(disp, fn) ((disp)->TexCoord2i = fn) -#define CALL_TexCoord2iv(disp, parameters) (*((disp)->TexCoord2iv)) parameters -#define GET_TexCoord2iv(disp) ((disp)->TexCoord2iv) -#define SET_TexCoord2iv(disp, fn) ((disp)->TexCoord2iv = fn) -#define CALL_TexCoord2s(disp, parameters) (*((disp)->TexCoord2s)) parameters -#define GET_TexCoord2s(disp) ((disp)->TexCoord2s) -#define SET_TexCoord2s(disp, fn) ((disp)->TexCoord2s = fn) -#define CALL_TexCoord2sv(disp, parameters) (*((disp)->TexCoord2sv)) parameters -#define GET_TexCoord2sv(disp) ((disp)->TexCoord2sv) -#define SET_TexCoord2sv(disp, fn) ((disp)->TexCoord2sv = fn) -#define CALL_TexCoord3d(disp, parameters) (*((disp)->TexCoord3d)) parameters -#define GET_TexCoord3d(disp) ((disp)->TexCoord3d) -#define SET_TexCoord3d(disp, fn) ((disp)->TexCoord3d = fn) -#define CALL_TexCoord3dv(disp, parameters) (*((disp)->TexCoord3dv)) parameters -#define GET_TexCoord3dv(disp) ((disp)->TexCoord3dv) -#define SET_TexCoord3dv(disp, fn) ((disp)->TexCoord3dv = fn) -#define CALL_TexCoord3f(disp, parameters) (*((disp)->TexCoord3f)) parameters -#define GET_TexCoord3f(disp) ((disp)->TexCoord3f) -#define SET_TexCoord3f(disp, fn) ((disp)->TexCoord3f = fn) -#define CALL_TexCoord3fv(disp, parameters) (*((disp)->TexCoord3fv)) parameters -#define GET_TexCoord3fv(disp) ((disp)->TexCoord3fv) -#define SET_TexCoord3fv(disp, fn) ((disp)->TexCoord3fv = fn) -#define CALL_TexCoord3i(disp, parameters) (*((disp)->TexCoord3i)) parameters -#define GET_TexCoord3i(disp) ((disp)->TexCoord3i) -#define SET_TexCoord3i(disp, fn) ((disp)->TexCoord3i = fn) -#define CALL_TexCoord3iv(disp, parameters) (*((disp)->TexCoord3iv)) parameters -#define GET_TexCoord3iv(disp) ((disp)->TexCoord3iv) -#define SET_TexCoord3iv(disp, fn) ((disp)->TexCoord3iv = fn) -#define CALL_TexCoord3s(disp, parameters) (*((disp)->TexCoord3s)) parameters -#define GET_TexCoord3s(disp) ((disp)->TexCoord3s) -#define SET_TexCoord3s(disp, fn) ((disp)->TexCoord3s = fn) -#define CALL_TexCoord3sv(disp, parameters) (*((disp)->TexCoord3sv)) parameters -#define GET_TexCoord3sv(disp) ((disp)->TexCoord3sv) -#define SET_TexCoord3sv(disp, fn) ((disp)->TexCoord3sv = fn) -#define CALL_TexCoord4d(disp, parameters) (*((disp)->TexCoord4d)) parameters -#define GET_TexCoord4d(disp) ((disp)->TexCoord4d) -#define SET_TexCoord4d(disp, fn) ((disp)->TexCoord4d = fn) -#define CALL_TexCoord4dv(disp, parameters) (*((disp)->TexCoord4dv)) parameters -#define GET_TexCoord4dv(disp) ((disp)->TexCoord4dv) -#define SET_TexCoord4dv(disp, fn) ((disp)->TexCoord4dv = fn) -#define CALL_TexCoord4f(disp, parameters) (*((disp)->TexCoord4f)) parameters -#define GET_TexCoord4f(disp) ((disp)->TexCoord4f) -#define SET_TexCoord4f(disp, fn) ((disp)->TexCoord4f = fn) -#define CALL_TexCoord4fv(disp, parameters) (*((disp)->TexCoord4fv)) parameters -#define GET_TexCoord4fv(disp) ((disp)->TexCoord4fv) -#define SET_TexCoord4fv(disp, fn) ((disp)->TexCoord4fv = fn) -#define CALL_TexCoord4i(disp, parameters) (*((disp)->TexCoord4i)) parameters -#define GET_TexCoord4i(disp) ((disp)->TexCoord4i) -#define SET_TexCoord4i(disp, fn) ((disp)->TexCoord4i = fn) -#define CALL_TexCoord4iv(disp, parameters) (*((disp)->TexCoord4iv)) parameters -#define GET_TexCoord4iv(disp) ((disp)->TexCoord4iv) -#define SET_TexCoord4iv(disp, fn) ((disp)->TexCoord4iv = fn) -#define CALL_TexCoord4s(disp, parameters) (*((disp)->TexCoord4s)) parameters -#define GET_TexCoord4s(disp) ((disp)->TexCoord4s) -#define SET_TexCoord4s(disp, fn) ((disp)->TexCoord4s = fn) -#define CALL_TexCoord4sv(disp, parameters) (*((disp)->TexCoord4sv)) parameters -#define GET_TexCoord4sv(disp) ((disp)->TexCoord4sv) -#define SET_TexCoord4sv(disp, fn) ((disp)->TexCoord4sv = fn) -#define CALL_Vertex2d(disp, parameters) (*((disp)->Vertex2d)) parameters -#define GET_Vertex2d(disp) ((disp)->Vertex2d) -#define SET_Vertex2d(disp, fn) ((disp)->Vertex2d = fn) -#define CALL_Vertex2dv(disp, parameters) (*((disp)->Vertex2dv)) parameters -#define GET_Vertex2dv(disp) ((disp)->Vertex2dv) -#define SET_Vertex2dv(disp, fn) ((disp)->Vertex2dv = fn) -#define CALL_Vertex2f(disp, parameters) (*((disp)->Vertex2f)) parameters -#define GET_Vertex2f(disp) ((disp)->Vertex2f) -#define SET_Vertex2f(disp, fn) ((disp)->Vertex2f = fn) -#define CALL_Vertex2fv(disp, parameters) (*((disp)->Vertex2fv)) parameters -#define GET_Vertex2fv(disp) ((disp)->Vertex2fv) -#define SET_Vertex2fv(disp, fn) ((disp)->Vertex2fv = fn) -#define CALL_Vertex2i(disp, parameters) (*((disp)->Vertex2i)) parameters -#define GET_Vertex2i(disp) ((disp)->Vertex2i) -#define SET_Vertex2i(disp, fn) ((disp)->Vertex2i = fn) -#define CALL_Vertex2iv(disp, parameters) (*((disp)->Vertex2iv)) parameters -#define GET_Vertex2iv(disp) ((disp)->Vertex2iv) -#define SET_Vertex2iv(disp, fn) ((disp)->Vertex2iv = fn) -#define CALL_Vertex2s(disp, parameters) (*((disp)->Vertex2s)) parameters -#define GET_Vertex2s(disp) ((disp)->Vertex2s) -#define SET_Vertex2s(disp, fn) ((disp)->Vertex2s = fn) -#define CALL_Vertex2sv(disp, parameters) (*((disp)->Vertex2sv)) parameters -#define GET_Vertex2sv(disp) ((disp)->Vertex2sv) -#define SET_Vertex2sv(disp, fn) ((disp)->Vertex2sv = fn) -#define CALL_Vertex3d(disp, parameters) (*((disp)->Vertex3d)) parameters -#define GET_Vertex3d(disp) ((disp)->Vertex3d) -#define SET_Vertex3d(disp, fn) ((disp)->Vertex3d = fn) -#define CALL_Vertex3dv(disp, parameters) (*((disp)->Vertex3dv)) parameters -#define GET_Vertex3dv(disp) ((disp)->Vertex3dv) -#define SET_Vertex3dv(disp, fn) ((disp)->Vertex3dv = fn) -#define CALL_Vertex3f(disp, parameters) (*((disp)->Vertex3f)) parameters -#define GET_Vertex3f(disp) ((disp)->Vertex3f) -#define SET_Vertex3f(disp, fn) ((disp)->Vertex3f = fn) -#define CALL_Vertex3fv(disp, parameters) (*((disp)->Vertex3fv)) parameters -#define GET_Vertex3fv(disp) ((disp)->Vertex3fv) -#define SET_Vertex3fv(disp, fn) ((disp)->Vertex3fv = fn) -#define CALL_Vertex3i(disp, parameters) (*((disp)->Vertex3i)) parameters -#define GET_Vertex3i(disp) ((disp)->Vertex3i) -#define SET_Vertex3i(disp, fn) ((disp)->Vertex3i = fn) -#define CALL_Vertex3iv(disp, parameters) (*((disp)->Vertex3iv)) parameters -#define GET_Vertex3iv(disp) ((disp)->Vertex3iv) -#define SET_Vertex3iv(disp, fn) ((disp)->Vertex3iv = fn) -#define CALL_Vertex3s(disp, parameters) (*((disp)->Vertex3s)) parameters -#define GET_Vertex3s(disp) ((disp)->Vertex3s) -#define SET_Vertex3s(disp, fn) ((disp)->Vertex3s = fn) -#define CALL_Vertex3sv(disp, parameters) (*((disp)->Vertex3sv)) parameters -#define GET_Vertex3sv(disp) ((disp)->Vertex3sv) -#define SET_Vertex3sv(disp, fn) ((disp)->Vertex3sv = fn) -#define CALL_Vertex4d(disp, parameters) (*((disp)->Vertex4d)) parameters -#define GET_Vertex4d(disp) ((disp)->Vertex4d) -#define SET_Vertex4d(disp, fn) ((disp)->Vertex4d = fn) -#define CALL_Vertex4dv(disp, parameters) (*((disp)->Vertex4dv)) parameters -#define GET_Vertex4dv(disp) ((disp)->Vertex4dv) -#define SET_Vertex4dv(disp, fn) ((disp)->Vertex4dv = fn) -#define CALL_Vertex4f(disp, parameters) (*((disp)->Vertex4f)) parameters -#define GET_Vertex4f(disp) ((disp)->Vertex4f) -#define SET_Vertex4f(disp, fn) ((disp)->Vertex4f = fn) -#define CALL_Vertex4fv(disp, parameters) (*((disp)->Vertex4fv)) parameters -#define GET_Vertex4fv(disp) ((disp)->Vertex4fv) -#define SET_Vertex4fv(disp, fn) ((disp)->Vertex4fv = fn) -#define CALL_Vertex4i(disp, parameters) (*((disp)->Vertex4i)) parameters -#define GET_Vertex4i(disp) ((disp)->Vertex4i) -#define SET_Vertex4i(disp, fn) ((disp)->Vertex4i = fn) -#define CALL_Vertex4iv(disp, parameters) (*((disp)->Vertex4iv)) parameters -#define GET_Vertex4iv(disp) ((disp)->Vertex4iv) -#define SET_Vertex4iv(disp, fn) ((disp)->Vertex4iv = fn) -#define CALL_Vertex4s(disp, parameters) (*((disp)->Vertex4s)) parameters -#define GET_Vertex4s(disp) ((disp)->Vertex4s) -#define SET_Vertex4s(disp, fn) ((disp)->Vertex4s = fn) -#define CALL_Vertex4sv(disp, parameters) (*((disp)->Vertex4sv)) parameters -#define GET_Vertex4sv(disp) ((disp)->Vertex4sv) -#define SET_Vertex4sv(disp, fn) ((disp)->Vertex4sv = fn) -#define CALL_ClipPlane(disp, parameters) (*((disp)->ClipPlane)) parameters -#define GET_ClipPlane(disp) ((disp)->ClipPlane) -#define SET_ClipPlane(disp, fn) ((disp)->ClipPlane = fn) -#define CALL_ColorMaterial(disp, parameters) (*((disp)->ColorMaterial)) parameters -#define GET_ColorMaterial(disp) ((disp)->ColorMaterial) -#define SET_ColorMaterial(disp, fn) ((disp)->ColorMaterial = fn) -#define CALL_CullFace(disp, parameters) (*((disp)->CullFace)) parameters -#define GET_CullFace(disp) ((disp)->CullFace) -#define SET_CullFace(disp, fn) ((disp)->CullFace = fn) -#define CALL_Fogf(disp, parameters) (*((disp)->Fogf)) parameters -#define GET_Fogf(disp) ((disp)->Fogf) -#define SET_Fogf(disp, fn) ((disp)->Fogf = fn) -#define CALL_Fogfv(disp, parameters) (*((disp)->Fogfv)) parameters -#define GET_Fogfv(disp) ((disp)->Fogfv) -#define SET_Fogfv(disp, fn) ((disp)->Fogfv = fn) -#define CALL_Fogi(disp, parameters) (*((disp)->Fogi)) parameters -#define GET_Fogi(disp) ((disp)->Fogi) -#define SET_Fogi(disp, fn) ((disp)->Fogi = fn) -#define CALL_Fogiv(disp, parameters) (*((disp)->Fogiv)) parameters -#define GET_Fogiv(disp) ((disp)->Fogiv) -#define SET_Fogiv(disp, fn) ((disp)->Fogiv = fn) -#define CALL_FrontFace(disp, parameters) (*((disp)->FrontFace)) parameters -#define GET_FrontFace(disp) ((disp)->FrontFace) -#define SET_FrontFace(disp, fn) ((disp)->FrontFace = fn) -#define CALL_Hint(disp, parameters) (*((disp)->Hint)) parameters -#define GET_Hint(disp) ((disp)->Hint) -#define SET_Hint(disp, fn) ((disp)->Hint = fn) -#define CALL_Lightf(disp, parameters) (*((disp)->Lightf)) parameters -#define GET_Lightf(disp) ((disp)->Lightf) -#define SET_Lightf(disp, fn) ((disp)->Lightf = fn) -#define CALL_Lightfv(disp, parameters) (*((disp)->Lightfv)) parameters -#define GET_Lightfv(disp) ((disp)->Lightfv) -#define SET_Lightfv(disp, fn) ((disp)->Lightfv = fn) -#define CALL_Lighti(disp, parameters) (*((disp)->Lighti)) parameters -#define GET_Lighti(disp) ((disp)->Lighti) -#define SET_Lighti(disp, fn) ((disp)->Lighti = fn) -#define CALL_Lightiv(disp, parameters) (*((disp)->Lightiv)) parameters -#define GET_Lightiv(disp) ((disp)->Lightiv) -#define SET_Lightiv(disp, fn) ((disp)->Lightiv = fn) -#define CALL_LightModelf(disp, parameters) (*((disp)->LightModelf)) parameters -#define GET_LightModelf(disp) ((disp)->LightModelf) -#define SET_LightModelf(disp, fn) ((disp)->LightModelf = fn) -#define CALL_LightModelfv(disp, parameters) (*((disp)->LightModelfv)) parameters -#define GET_LightModelfv(disp) ((disp)->LightModelfv) -#define SET_LightModelfv(disp, fn) ((disp)->LightModelfv = fn) -#define CALL_LightModeli(disp, parameters) (*((disp)->LightModeli)) parameters -#define GET_LightModeli(disp) ((disp)->LightModeli) -#define SET_LightModeli(disp, fn) ((disp)->LightModeli = fn) -#define CALL_LightModeliv(disp, parameters) (*((disp)->LightModeliv)) parameters -#define GET_LightModeliv(disp) ((disp)->LightModeliv) -#define SET_LightModeliv(disp, fn) ((disp)->LightModeliv = fn) -#define CALL_LineStipple(disp, parameters) (*((disp)->LineStipple)) parameters -#define GET_LineStipple(disp) ((disp)->LineStipple) -#define SET_LineStipple(disp, fn) ((disp)->LineStipple = fn) -#define CALL_LineWidth(disp, parameters) (*((disp)->LineWidth)) parameters -#define GET_LineWidth(disp) ((disp)->LineWidth) -#define SET_LineWidth(disp, fn) ((disp)->LineWidth = fn) -#define CALL_Materialf(disp, parameters) (*((disp)->Materialf)) parameters -#define GET_Materialf(disp) ((disp)->Materialf) -#define SET_Materialf(disp, fn) ((disp)->Materialf = fn) -#define CALL_Materialfv(disp, parameters) (*((disp)->Materialfv)) parameters -#define GET_Materialfv(disp) ((disp)->Materialfv) -#define SET_Materialfv(disp, fn) ((disp)->Materialfv = fn) -#define CALL_Materiali(disp, parameters) (*((disp)->Materiali)) parameters -#define GET_Materiali(disp) ((disp)->Materiali) -#define SET_Materiali(disp, fn) ((disp)->Materiali = fn) -#define CALL_Materialiv(disp, parameters) (*((disp)->Materialiv)) parameters -#define GET_Materialiv(disp) ((disp)->Materialiv) -#define SET_Materialiv(disp, fn) ((disp)->Materialiv = fn) -#define CALL_PointSize(disp, parameters) (*((disp)->PointSize)) parameters -#define GET_PointSize(disp) ((disp)->PointSize) -#define SET_PointSize(disp, fn) ((disp)->PointSize = fn) -#define CALL_PolygonMode(disp, parameters) (*((disp)->PolygonMode)) parameters -#define GET_PolygonMode(disp) ((disp)->PolygonMode) -#define SET_PolygonMode(disp, fn) ((disp)->PolygonMode = fn) -#define CALL_PolygonStipple(disp, parameters) (*((disp)->PolygonStipple)) parameters -#define GET_PolygonStipple(disp) ((disp)->PolygonStipple) -#define SET_PolygonStipple(disp, fn) ((disp)->PolygonStipple = fn) -#define CALL_Scissor(disp, parameters) (*((disp)->Scissor)) parameters -#define GET_Scissor(disp) ((disp)->Scissor) -#define SET_Scissor(disp, fn) ((disp)->Scissor = fn) -#define CALL_ShadeModel(disp, parameters) (*((disp)->ShadeModel)) parameters -#define GET_ShadeModel(disp) ((disp)->ShadeModel) -#define SET_ShadeModel(disp, fn) ((disp)->ShadeModel = fn) -#define CALL_TexParameterf(disp, parameters) (*((disp)->TexParameterf)) parameters -#define GET_TexParameterf(disp) ((disp)->TexParameterf) -#define SET_TexParameterf(disp, fn) ((disp)->TexParameterf = fn) -#define CALL_TexParameterfv(disp, parameters) (*((disp)->TexParameterfv)) parameters -#define GET_TexParameterfv(disp) ((disp)->TexParameterfv) -#define SET_TexParameterfv(disp, fn) ((disp)->TexParameterfv = fn) -#define CALL_TexParameteri(disp, parameters) (*((disp)->TexParameteri)) parameters -#define GET_TexParameteri(disp) ((disp)->TexParameteri) -#define SET_TexParameteri(disp, fn) ((disp)->TexParameteri = fn) -#define CALL_TexParameteriv(disp, parameters) (*((disp)->TexParameteriv)) parameters -#define GET_TexParameteriv(disp) ((disp)->TexParameteriv) -#define SET_TexParameteriv(disp, fn) ((disp)->TexParameteriv = fn) -#define CALL_TexImage1D(disp, parameters) (*((disp)->TexImage1D)) parameters -#define GET_TexImage1D(disp) ((disp)->TexImage1D) -#define SET_TexImage1D(disp, fn) ((disp)->TexImage1D = fn) -#define CALL_TexImage2D(disp, parameters) (*((disp)->TexImage2D)) parameters -#define GET_TexImage2D(disp) ((disp)->TexImage2D) -#define SET_TexImage2D(disp, fn) ((disp)->TexImage2D = fn) -#define CALL_TexEnvf(disp, parameters) (*((disp)->TexEnvf)) parameters -#define GET_TexEnvf(disp) ((disp)->TexEnvf) -#define SET_TexEnvf(disp, fn) ((disp)->TexEnvf = fn) -#define CALL_TexEnvfv(disp, parameters) (*((disp)->TexEnvfv)) parameters -#define GET_TexEnvfv(disp) ((disp)->TexEnvfv) -#define SET_TexEnvfv(disp, fn) ((disp)->TexEnvfv = fn) -#define CALL_TexEnvi(disp, parameters) (*((disp)->TexEnvi)) parameters -#define GET_TexEnvi(disp) ((disp)->TexEnvi) -#define SET_TexEnvi(disp, fn) ((disp)->TexEnvi = fn) -#define CALL_TexEnviv(disp, parameters) (*((disp)->TexEnviv)) parameters -#define GET_TexEnviv(disp) ((disp)->TexEnviv) -#define SET_TexEnviv(disp, fn) ((disp)->TexEnviv = fn) -#define CALL_TexGend(disp, parameters) (*((disp)->TexGend)) parameters -#define GET_TexGend(disp) ((disp)->TexGend) -#define SET_TexGend(disp, fn) ((disp)->TexGend = fn) -#define CALL_TexGendv(disp, parameters) (*((disp)->TexGendv)) parameters -#define GET_TexGendv(disp) ((disp)->TexGendv) -#define SET_TexGendv(disp, fn) ((disp)->TexGendv = fn) -#define CALL_TexGenf(disp, parameters) (*((disp)->TexGenf)) parameters -#define GET_TexGenf(disp) ((disp)->TexGenf) -#define SET_TexGenf(disp, fn) ((disp)->TexGenf = fn) -#define CALL_TexGenfv(disp, parameters) (*((disp)->TexGenfv)) parameters -#define GET_TexGenfv(disp) ((disp)->TexGenfv) -#define SET_TexGenfv(disp, fn) ((disp)->TexGenfv = fn) -#define CALL_TexGeni(disp, parameters) (*((disp)->TexGeni)) parameters -#define GET_TexGeni(disp) ((disp)->TexGeni) -#define SET_TexGeni(disp, fn) ((disp)->TexGeni = fn) -#define CALL_TexGeniv(disp, parameters) (*((disp)->TexGeniv)) parameters -#define GET_TexGeniv(disp) ((disp)->TexGeniv) -#define SET_TexGeniv(disp, fn) ((disp)->TexGeniv = fn) -#define CALL_FeedbackBuffer(disp, parameters) (*((disp)->FeedbackBuffer)) parameters -#define GET_FeedbackBuffer(disp) ((disp)->FeedbackBuffer) -#define SET_FeedbackBuffer(disp, fn) ((disp)->FeedbackBuffer = fn) -#define CALL_SelectBuffer(disp, parameters) (*((disp)->SelectBuffer)) parameters -#define GET_SelectBuffer(disp) ((disp)->SelectBuffer) -#define SET_SelectBuffer(disp, fn) ((disp)->SelectBuffer = fn) -#define CALL_RenderMode(disp, parameters) (*((disp)->RenderMode)) parameters -#define GET_RenderMode(disp) ((disp)->RenderMode) -#define SET_RenderMode(disp, fn) ((disp)->RenderMode = fn) -#define CALL_InitNames(disp, parameters) (*((disp)->InitNames)) parameters -#define GET_InitNames(disp) ((disp)->InitNames) -#define SET_InitNames(disp, fn) ((disp)->InitNames = fn) -#define CALL_LoadName(disp, parameters) (*((disp)->LoadName)) parameters -#define GET_LoadName(disp) ((disp)->LoadName) -#define SET_LoadName(disp, fn) ((disp)->LoadName = fn) -#define CALL_PassThrough(disp, parameters) (*((disp)->PassThrough)) parameters -#define GET_PassThrough(disp) ((disp)->PassThrough) -#define SET_PassThrough(disp, fn) ((disp)->PassThrough = fn) -#define CALL_PopName(disp, parameters) (*((disp)->PopName)) parameters -#define GET_PopName(disp) ((disp)->PopName) -#define SET_PopName(disp, fn) ((disp)->PopName = fn) -#define CALL_PushName(disp, parameters) (*((disp)->PushName)) parameters -#define GET_PushName(disp) ((disp)->PushName) -#define SET_PushName(disp, fn) ((disp)->PushName = fn) -#define CALL_DrawBuffer(disp, parameters) (*((disp)->DrawBuffer)) parameters -#define GET_DrawBuffer(disp) ((disp)->DrawBuffer) -#define SET_DrawBuffer(disp, fn) ((disp)->DrawBuffer = fn) -#define CALL_Clear(disp, parameters) (*((disp)->Clear)) parameters -#define GET_Clear(disp) ((disp)->Clear) -#define SET_Clear(disp, fn) ((disp)->Clear = fn) -#define CALL_ClearAccum(disp, parameters) (*((disp)->ClearAccum)) parameters -#define GET_ClearAccum(disp) ((disp)->ClearAccum) -#define SET_ClearAccum(disp, fn) ((disp)->ClearAccum = fn) -#define CALL_ClearIndex(disp, parameters) (*((disp)->ClearIndex)) parameters -#define GET_ClearIndex(disp) ((disp)->ClearIndex) -#define SET_ClearIndex(disp, fn) ((disp)->ClearIndex = fn) -#define CALL_ClearColor(disp, parameters) (*((disp)->ClearColor)) parameters -#define GET_ClearColor(disp) ((disp)->ClearColor) -#define SET_ClearColor(disp, fn) ((disp)->ClearColor = fn) -#define CALL_ClearStencil(disp, parameters) (*((disp)->ClearStencil)) parameters -#define GET_ClearStencil(disp) ((disp)->ClearStencil) -#define SET_ClearStencil(disp, fn) ((disp)->ClearStencil = fn) -#define CALL_ClearDepth(disp, parameters) (*((disp)->ClearDepth)) parameters -#define GET_ClearDepth(disp) ((disp)->ClearDepth) -#define SET_ClearDepth(disp, fn) ((disp)->ClearDepth = fn) -#define CALL_StencilMask(disp, parameters) (*((disp)->StencilMask)) parameters -#define GET_StencilMask(disp) ((disp)->StencilMask) -#define SET_StencilMask(disp, fn) ((disp)->StencilMask = fn) -#define CALL_ColorMask(disp, parameters) (*((disp)->ColorMask)) parameters -#define GET_ColorMask(disp) ((disp)->ColorMask) -#define SET_ColorMask(disp, fn) ((disp)->ColorMask = fn) -#define CALL_DepthMask(disp, parameters) (*((disp)->DepthMask)) parameters -#define GET_DepthMask(disp) ((disp)->DepthMask) -#define SET_DepthMask(disp, fn) ((disp)->DepthMask = fn) -#define CALL_IndexMask(disp, parameters) (*((disp)->IndexMask)) parameters -#define GET_IndexMask(disp) ((disp)->IndexMask) -#define SET_IndexMask(disp, fn) ((disp)->IndexMask = fn) -#define CALL_Accum(disp, parameters) (*((disp)->Accum)) parameters -#define GET_Accum(disp) ((disp)->Accum) -#define SET_Accum(disp, fn) ((disp)->Accum = fn) -#define CALL_Disable(disp, parameters) (*((disp)->Disable)) parameters -#define GET_Disable(disp) ((disp)->Disable) -#define SET_Disable(disp, fn) ((disp)->Disable = fn) -#define CALL_Enable(disp, parameters) (*((disp)->Enable)) parameters -#define GET_Enable(disp) ((disp)->Enable) -#define SET_Enable(disp, fn) ((disp)->Enable = fn) -#define CALL_Finish(disp, parameters) (*((disp)->Finish)) parameters -#define GET_Finish(disp) ((disp)->Finish) -#define SET_Finish(disp, fn) ((disp)->Finish = fn) -#define CALL_Flush(disp, parameters) (*((disp)->Flush)) parameters -#define GET_Flush(disp) ((disp)->Flush) -#define SET_Flush(disp, fn) ((disp)->Flush = fn) -#define CALL_PopAttrib(disp, parameters) (*((disp)->PopAttrib)) parameters -#define GET_PopAttrib(disp) ((disp)->PopAttrib) -#define SET_PopAttrib(disp, fn) ((disp)->PopAttrib = fn) -#define CALL_PushAttrib(disp, parameters) (*((disp)->PushAttrib)) parameters -#define GET_PushAttrib(disp) ((disp)->PushAttrib) -#define SET_PushAttrib(disp, fn) ((disp)->PushAttrib = fn) -#define CALL_Map1d(disp, parameters) (*((disp)->Map1d)) parameters -#define GET_Map1d(disp) ((disp)->Map1d) -#define SET_Map1d(disp, fn) ((disp)->Map1d = fn) -#define CALL_Map1f(disp, parameters) (*((disp)->Map1f)) parameters -#define GET_Map1f(disp) ((disp)->Map1f) -#define SET_Map1f(disp, fn) ((disp)->Map1f = fn) -#define CALL_Map2d(disp, parameters) (*((disp)->Map2d)) parameters -#define GET_Map2d(disp) ((disp)->Map2d) -#define SET_Map2d(disp, fn) ((disp)->Map2d = fn) -#define CALL_Map2f(disp, parameters) (*((disp)->Map2f)) parameters -#define GET_Map2f(disp) ((disp)->Map2f) -#define SET_Map2f(disp, fn) ((disp)->Map2f = fn) -#define CALL_MapGrid1d(disp, parameters) (*((disp)->MapGrid1d)) parameters -#define GET_MapGrid1d(disp) ((disp)->MapGrid1d) -#define SET_MapGrid1d(disp, fn) ((disp)->MapGrid1d = fn) -#define CALL_MapGrid1f(disp, parameters) (*((disp)->MapGrid1f)) parameters -#define GET_MapGrid1f(disp) ((disp)->MapGrid1f) -#define SET_MapGrid1f(disp, fn) ((disp)->MapGrid1f = fn) -#define CALL_MapGrid2d(disp, parameters) (*((disp)->MapGrid2d)) parameters -#define GET_MapGrid2d(disp) ((disp)->MapGrid2d) -#define SET_MapGrid2d(disp, fn) ((disp)->MapGrid2d = fn) -#define CALL_MapGrid2f(disp, parameters) (*((disp)->MapGrid2f)) parameters -#define GET_MapGrid2f(disp) ((disp)->MapGrid2f) -#define SET_MapGrid2f(disp, fn) ((disp)->MapGrid2f = fn) -#define CALL_EvalCoord1d(disp, parameters) (*((disp)->EvalCoord1d)) parameters -#define GET_EvalCoord1d(disp) ((disp)->EvalCoord1d) -#define SET_EvalCoord1d(disp, fn) ((disp)->EvalCoord1d = fn) -#define CALL_EvalCoord1dv(disp, parameters) (*((disp)->EvalCoord1dv)) parameters -#define GET_EvalCoord1dv(disp) ((disp)->EvalCoord1dv) -#define SET_EvalCoord1dv(disp, fn) ((disp)->EvalCoord1dv = fn) -#define CALL_EvalCoord1f(disp, parameters) (*((disp)->EvalCoord1f)) parameters -#define GET_EvalCoord1f(disp) ((disp)->EvalCoord1f) -#define SET_EvalCoord1f(disp, fn) ((disp)->EvalCoord1f = fn) -#define CALL_EvalCoord1fv(disp, parameters) (*((disp)->EvalCoord1fv)) parameters -#define GET_EvalCoord1fv(disp) ((disp)->EvalCoord1fv) -#define SET_EvalCoord1fv(disp, fn) ((disp)->EvalCoord1fv = fn) -#define CALL_EvalCoord2d(disp, parameters) (*((disp)->EvalCoord2d)) parameters -#define GET_EvalCoord2d(disp) ((disp)->EvalCoord2d) -#define SET_EvalCoord2d(disp, fn) ((disp)->EvalCoord2d = fn) -#define CALL_EvalCoord2dv(disp, parameters) (*((disp)->EvalCoord2dv)) parameters -#define GET_EvalCoord2dv(disp) ((disp)->EvalCoord2dv) -#define SET_EvalCoord2dv(disp, fn) ((disp)->EvalCoord2dv = fn) -#define CALL_EvalCoord2f(disp, parameters) (*((disp)->EvalCoord2f)) parameters -#define GET_EvalCoord2f(disp) ((disp)->EvalCoord2f) -#define SET_EvalCoord2f(disp, fn) ((disp)->EvalCoord2f = fn) -#define CALL_EvalCoord2fv(disp, parameters) (*((disp)->EvalCoord2fv)) parameters -#define GET_EvalCoord2fv(disp) ((disp)->EvalCoord2fv) -#define SET_EvalCoord2fv(disp, fn) ((disp)->EvalCoord2fv = fn) -#define CALL_EvalMesh1(disp, parameters) (*((disp)->EvalMesh1)) parameters -#define GET_EvalMesh1(disp) ((disp)->EvalMesh1) -#define SET_EvalMesh1(disp, fn) ((disp)->EvalMesh1 = fn) -#define CALL_EvalPoint1(disp, parameters) (*((disp)->EvalPoint1)) parameters -#define GET_EvalPoint1(disp) ((disp)->EvalPoint1) -#define SET_EvalPoint1(disp, fn) ((disp)->EvalPoint1 = fn) -#define CALL_EvalMesh2(disp, parameters) (*((disp)->EvalMesh2)) parameters -#define GET_EvalMesh2(disp) ((disp)->EvalMesh2) -#define SET_EvalMesh2(disp, fn) ((disp)->EvalMesh2 = fn) -#define CALL_EvalPoint2(disp, parameters) (*((disp)->EvalPoint2)) parameters -#define GET_EvalPoint2(disp) ((disp)->EvalPoint2) -#define SET_EvalPoint2(disp, fn) ((disp)->EvalPoint2 = fn) -#define CALL_AlphaFunc(disp, parameters) (*((disp)->AlphaFunc)) parameters -#define GET_AlphaFunc(disp) ((disp)->AlphaFunc) -#define SET_AlphaFunc(disp, fn) ((disp)->AlphaFunc = fn) -#define CALL_BlendFunc(disp, parameters) (*((disp)->BlendFunc)) parameters -#define GET_BlendFunc(disp) ((disp)->BlendFunc) -#define SET_BlendFunc(disp, fn) ((disp)->BlendFunc = fn) -#define CALL_LogicOp(disp, parameters) (*((disp)->LogicOp)) parameters -#define GET_LogicOp(disp) ((disp)->LogicOp) -#define SET_LogicOp(disp, fn) ((disp)->LogicOp = fn) -#define CALL_StencilFunc(disp, parameters) (*((disp)->StencilFunc)) parameters -#define GET_StencilFunc(disp) ((disp)->StencilFunc) -#define SET_StencilFunc(disp, fn) ((disp)->StencilFunc = fn) -#define CALL_StencilOp(disp, parameters) (*((disp)->StencilOp)) parameters -#define GET_StencilOp(disp) ((disp)->StencilOp) -#define SET_StencilOp(disp, fn) ((disp)->StencilOp = fn) -#define CALL_DepthFunc(disp, parameters) (*((disp)->DepthFunc)) parameters -#define GET_DepthFunc(disp) ((disp)->DepthFunc) -#define SET_DepthFunc(disp, fn) ((disp)->DepthFunc = fn) -#define CALL_PixelZoom(disp, parameters) (*((disp)->PixelZoom)) parameters -#define GET_PixelZoom(disp) ((disp)->PixelZoom) -#define SET_PixelZoom(disp, fn) ((disp)->PixelZoom = fn) -#define CALL_PixelTransferf(disp, parameters) (*((disp)->PixelTransferf)) parameters -#define GET_PixelTransferf(disp) ((disp)->PixelTransferf) -#define SET_PixelTransferf(disp, fn) ((disp)->PixelTransferf = fn) -#define CALL_PixelTransferi(disp, parameters) (*((disp)->PixelTransferi)) parameters -#define GET_PixelTransferi(disp) ((disp)->PixelTransferi) -#define SET_PixelTransferi(disp, fn) ((disp)->PixelTransferi = fn) -#define CALL_PixelStoref(disp, parameters) (*((disp)->PixelStoref)) parameters -#define GET_PixelStoref(disp) ((disp)->PixelStoref) -#define SET_PixelStoref(disp, fn) ((disp)->PixelStoref = fn) -#define CALL_PixelStorei(disp, parameters) (*((disp)->PixelStorei)) parameters -#define GET_PixelStorei(disp) ((disp)->PixelStorei) -#define SET_PixelStorei(disp, fn) ((disp)->PixelStorei = fn) -#define CALL_PixelMapfv(disp, parameters) (*((disp)->PixelMapfv)) parameters -#define GET_PixelMapfv(disp) ((disp)->PixelMapfv) -#define SET_PixelMapfv(disp, fn) ((disp)->PixelMapfv = fn) -#define CALL_PixelMapuiv(disp, parameters) (*((disp)->PixelMapuiv)) parameters -#define GET_PixelMapuiv(disp) ((disp)->PixelMapuiv) -#define SET_PixelMapuiv(disp, fn) ((disp)->PixelMapuiv = fn) -#define CALL_PixelMapusv(disp, parameters) (*((disp)->PixelMapusv)) parameters -#define GET_PixelMapusv(disp) ((disp)->PixelMapusv) -#define SET_PixelMapusv(disp, fn) ((disp)->PixelMapusv = fn) -#define CALL_ReadBuffer(disp, parameters) (*((disp)->ReadBuffer)) parameters -#define GET_ReadBuffer(disp) ((disp)->ReadBuffer) -#define SET_ReadBuffer(disp, fn) ((disp)->ReadBuffer = fn) -#define CALL_CopyPixels(disp, parameters) (*((disp)->CopyPixels)) parameters -#define GET_CopyPixels(disp) ((disp)->CopyPixels) -#define SET_CopyPixels(disp, fn) ((disp)->CopyPixels = fn) -#define CALL_ReadPixels(disp, parameters) (*((disp)->ReadPixels)) parameters -#define GET_ReadPixels(disp) ((disp)->ReadPixels) -#define SET_ReadPixels(disp, fn) ((disp)->ReadPixels = fn) -#define CALL_DrawPixels(disp, parameters) (*((disp)->DrawPixels)) parameters -#define GET_DrawPixels(disp) ((disp)->DrawPixels) -#define SET_DrawPixels(disp, fn) ((disp)->DrawPixels = fn) -#define CALL_GetBooleanv(disp, parameters) (*((disp)->GetBooleanv)) parameters -#define GET_GetBooleanv(disp) ((disp)->GetBooleanv) -#define SET_GetBooleanv(disp, fn) ((disp)->GetBooleanv = fn) -#define CALL_GetClipPlane(disp, parameters) (*((disp)->GetClipPlane)) parameters -#define GET_GetClipPlane(disp) ((disp)->GetClipPlane) -#define SET_GetClipPlane(disp, fn) ((disp)->GetClipPlane = fn) -#define CALL_GetDoublev(disp, parameters) (*((disp)->GetDoublev)) parameters -#define GET_GetDoublev(disp) ((disp)->GetDoublev) -#define SET_GetDoublev(disp, fn) ((disp)->GetDoublev = fn) -#define CALL_GetError(disp, parameters) (*((disp)->GetError)) parameters -#define GET_GetError(disp) ((disp)->GetError) -#define SET_GetError(disp, fn) ((disp)->GetError = fn) -#define CALL_GetFloatv(disp, parameters) (*((disp)->GetFloatv)) parameters -#define GET_GetFloatv(disp) ((disp)->GetFloatv) -#define SET_GetFloatv(disp, fn) ((disp)->GetFloatv = fn) -#define CALL_GetIntegerv(disp, parameters) (*((disp)->GetIntegerv)) parameters -#define GET_GetIntegerv(disp) ((disp)->GetIntegerv) -#define SET_GetIntegerv(disp, fn) ((disp)->GetIntegerv = fn) -#define CALL_GetLightfv(disp, parameters) (*((disp)->GetLightfv)) parameters -#define GET_GetLightfv(disp) ((disp)->GetLightfv) -#define SET_GetLightfv(disp, fn) ((disp)->GetLightfv = fn) -#define CALL_GetLightiv(disp, parameters) (*((disp)->GetLightiv)) parameters -#define GET_GetLightiv(disp) ((disp)->GetLightiv) -#define SET_GetLightiv(disp, fn) ((disp)->GetLightiv = fn) -#define CALL_GetMapdv(disp, parameters) (*((disp)->GetMapdv)) parameters -#define GET_GetMapdv(disp) ((disp)->GetMapdv) -#define SET_GetMapdv(disp, fn) ((disp)->GetMapdv = fn) -#define CALL_GetMapfv(disp, parameters) (*((disp)->GetMapfv)) parameters -#define GET_GetMapfv(disp) ((disp)->GetMapfv) -#define SET_GetMapfv(disp, fn) ((disp)->GetMapfv = fn) -#define CALL_GetMapiv(disp, parameters) (*((disp)->GetMapiv)) parameters -#define GET_GetMapiv(disp) ((disp)->GetMapiv) -#define SET_GetMapiv(disp, fn) ((disp)->GetMapiv = fn) -#define CALL_GetMaterialfv(disp, parameters) (*((disp)->GetMaterialfv)) parameters -#define GET_GetMaterialfv(disp) ((disp)->GetMaterialfv) -#define SET_GetMaterialfv(disp, fn) ((disp)->GetMaterialfv = fn) -#define CALL_GetMaterialiv(disp, parameters) (*((disp)->GetMaterialiv)) parameters -#define GET_GetMaterialiv(disp) ((disp)->GetMaterialiv) -#define SET_GetMaterialiv(disp, fn) ((disp)->GetMaterialiv = fn) -#define CALL_GetPixelMapfv(disp, parameters) (*((disp)->GetPixelMapfv)) parameters -#define GET_GetPixelMapfv(disp) ((disp)->GetPixelMapfv) -#define SET_GetPixelMapfv(disp, fn) ((disp)->GetPixelMapfv = fn) -#define CALL_GetPixelMapuiv(disp, parameters) (*((disp)->GetPixelMapuiv)) parameters -#define GET_GetPixelMapuiv(disp) ((disp)->GetPixelMapuiv) -#define SET_GetPixelMapuiv(disp, fn) ((disp)->GetPixelMapuiv = fn) -#define CALL_GetPixelMapusv(disp, parameters) (*((disp)->GetPixelMapusv)) parameters -#define GET_GetPixelMapusv(disp) ((disp)->GetPixelMapusv) -#define SET_GetPixelMapusv(disp, fn) ((disp)->GetPixelMapusv = fn) -#define CALL_GetPolygonStipple(disp, parameters) (*((disp)->GetPolygonStipple)) parameters -#define GET_GetPolygonStipple(disp) ((disp)->GetPolygonStipple) -#define SET_GetPolygonStipple(disp, fn) ((disp)->GetPolygonStipple = fn) -#define CALL_GetString(disp, parameters) (*((disp)->GetString)) parameters -#define GET_GetString(disp) ((disp)->GetString) -#define SET_GetString(disp, fn) ((disp)->GetString = fn) -#define CALL_GetTexEnvfv(disp, parameters) (*((disp)->GetTexEnvfv)) parameters -#define GET_GetTexEnvfv(disp) ((disp)->GetTexEnvfv) -#define SET_GetTexEnvfv(disp, fn) ((disp)->GetTexEnvfv = fn) -#define CALL_GetTexEnviv(disp, parameters) (*((disp)->GetTexEnviv)) parameters -#define GET_GetTexEnviv(disp) ((disp)->GetTexEnviv) -#define SET_GetTexEnviv(disp, fn) ((disp)->GetTexEnviv = fn) -#define CALL_GetTexGendv(disp, parameters) (*((disp)->GetTexGendv)) parameters -#define GET_GetTexGendv(disp) ((disp)->GetTexGendv) -#define SET_GetTexGendv(disp, fn) ((disp)->GetTexGendv = fn) -#define CALL_GetTexGenfv(disp, parameters) (*((disp)->GetTexGenfv)) parameters -#define GET_GetTexGenfv(disp) ((disp)->GetTexGenfv) -#define SET_GetTexGenfv(disp, fn) ((disp)->GetTexGenfv = fn) -#define CALL_GetTexGeniv(disp, parameters) (*((disp)->GetTexGeniv)) parameters -#define GET_GetTexGeniv(disp) ((disp)->GetTexGeniv) -#define SET_GetTexGeniv(disp, fn) ((disp)->GetTexGeniv = fn) -#define CALL_GetTexImage(disp, parameters) (*((disp)->GetTexImage)) parameters -#define GET_GetTexImage(disp) ((disp)->GetTexImage) -#define SET_GetTexImage(disp, fn) ((disp)->GetTexImage = fn) -#define CALL_GetTexParameterfv(disp, parameters) (*((disp)->GetTexParameterfv)) parameters -#define GET_GetTexParameterfv(disp) ((disp)->GetTexParameterfv) -#define SET_GetTexParameterfv(disp, fn) ((disp)->GetTexParameterfv = fn) -#define CALL_GetTexParameteriv(disp, parameters) (*((disp)->GetTexParameteriv)) parameters -#define GET_GetTexParameteriv(disp) ((disp)->GetTexParameteriv) -#define SET_GetTexParameteriv(disp, fn) ((disp)->GetTexParameteriv = fn) -#define CALL_GetTexLevelParameterfv(disp, parameters) (*((disp)->GetTexLevelParameterfv)) parameters -#define GET_GetTexLevelParameterfv(disp) ((disp)->GetTexLevelParameterfv) -#define SET_GetTexLevelParameterfv(disp, fn) ((disp)->GetTexLevelParameterfv = fn) -#define CALL_GetTexLevelParameteriv(disp, parameters) (*((disp)->GetTexLevelParameteriv)) parameters -#define GET_GetTexLevelParameteriv(disp) ((disp)->GetTexLevelParameteriv) -#define SET_GetTexLevelParameteriv(disp, fn) ((disp)->GetTexLevelParameteriv = fn) -#define CALL_IsEnabled(disp, parameters) (*((disp)->IsEnabled)) parameters -#define GET_IsEnabled(disp) ((disp)->IsEnabled) -#define SET_IsEnabled(disp, fn) ((disp)->IsEnabled = fn) -#define CALL_IsList(disp, parameters) (*((disp)->IsList)) parameters -#define GET_IsList(disp) ((disp)->IsList) -#define SET_IsList(disp, fn) ((disp)->IsList = fn) -#define CALL_DepthRange(disp, parameters) (*((disp)->DepthRange)) parameters -#define GET_DepthRange(disp) ((disp)->DepthRange) -#define SET_DepthRange(disp, fn) ((disp)->DepthRange = fn) -#define CALL_Frustum(disp, parameters) (*((disp)->Frustum)) parameters -#define GET_Frustum(disp) ((disp)->Frustum) -#define SET_Frustum(disp, fn) ((disp)->Frustum = fn) -#define CALL_LoadIdentity(disp, parameters) (*((disp)->LoadIdentity)) parameters -#define GET_LoadIdentity(disp) ((disp)->LoadIdentity) -#define SET_LoadIdentity(disp, fn) ((disp)->LoadIdentity = fn) -#define CALL_LoadMatrixf(disp, parameters) (*((disp)->LoadMatrixf)) parameters -#define GET_LoadMatrixf(disp) ((disp)->LoadMatrixf) -#define SET_LoadMatrixf(disp, fn) ((disp)->LoadMatrixf = fn) -#define CALL_LoadMatrixd(disp, parameters) (*((disp)->LoadMatrixd)) parameters -#define GET_LoadMatrixd(disp) ((disp)->LoadMatrixd) -#define SET_LoadMatrixd(disp, fn) ((disp)->LoadMatrixd = fn) -#define CALL_MatrixMode(disp, parameters) (*((disp)->MatrixMode)) parameters -#define GET_MatrixMode(disp) ((disp)->MatrixMode) -#define SET_MatrixMode(disp, fn) ((disp)->MatrixMode = fn) -#define CALL_MultMatrixf(disp, parameters) (*((disp)->MultMatrixf)) parameters -#define GET_MultMatrixf(disp) ((disp)->MultMatrixf) -#define SET_MultMatrixf(disp, fn) ((disp)->MultMatrixf = fn) -#define CALL_MultMatrixd(disp, parameters) (*((disp)->MultMatrixd)) parameters -#define GET_MultMatrixd(disp) ((disp)->MultMatrixd) -#define SET_MultMatrixd(disp, fn) ((disp)->MultMatrixd = fn) -#define CALL_Ortho(disp, parameters) (*((disp)->Ortho)) parameters -#define GET_Ortho(disp) ((disp)->Ortho) -#define SET_Ortho(disp, fn) ((disp)->Ortho = fn) -#define CALL_PopMatrix(disp, parameters) (*((disp)->PopMatrix)) parameters -#define GET_PopMatrix(disp) ((disp)->PopMatrix) -#define SET_PopMatrix(disp, fn) ((disp)->PopMatrix = fn) -#define CALL_PushMatrix(disp, parameters) (*((disp)->PushMatrix)) parameters -#define GET_PushMatrix(disp) ((disp)->PushMatrix) -#define SET_PushMatrix(disp, fn) ((disp)->PushMatrix = fn) -#define CALL_Rotated(disp, parameters) (*((disp)->Rotated)) parameters -#define GET_Rotated(disp) ((disp)->Rotated) -#define SET_Rotated(disp, fn) ((disp)->Rotated = fn) -#define CALL_Rotatef(disp, parameters) (*((disp)->Rotatef)) parameters -#define GET_Rotatef(disp) ((disp)->Rotatef) -#define SET_Rotatef(disp, fn) ((disp)->Rotatef = fn) -#define CALL_Scaled(disp, parameters) (*((disp)->Scaled)) parameters -#define GET_Scaled(disp) ((disp)->Scaled) -#define SET_Scaled(disp, fn) ((disp)->Scaled = fn) -#define CALL_Scalef(disp, parameters) (*((disp)->Scalef)) parameters -#define GET_Scalef(disp) ((disp)->Scalef) -#define SET_Scalef(disp, fn) ((disp)->Scalef = fn) -#define CALL_Translated(disp, parameters) (*((disp)->Translated)) parameters -#define GET_Translated(disp) ((disp)->Translated) -#define SET_Translated(disp, fn) ((disp)->Translated = fn) -#define CALL_Translatef(disp, parameters) (*((disp)->Translatef)) parameters -#define GET_Translatef(disp) ((disp)->Translatef) -#define SET_Translatef(disp, fn) ((disp)->Translatef = fn) -#define CALL_Viewport(disp, parameters) (*((disp)->Viewport)) parameters -#define GET_Viewport(disp) ((disp)->Viewport) -#define SET_Viewport(disp, fn) ((disp)->Viewport = fn) -#define CALL_ArrayElement(disp, parameters) (*((disp)->ArrayElement)) parameters -#define GET_ArrayElement(disp) ((disp)->ArrayElement) -#define SET_ArrayElement(disp, fn) ((disp)->ArrayElement = fn) -#define CALL_BindTexture(disp, parameters) (*((disp)->BindTexture)) parameters -#define GET_BindTexture(disp) ((disp)->BindTexture) -#define SET_BindTexture(disp, fn) ((disp)->BindTexture = fn) -#define CALL_ColorPointer(disp, parameters) (*((disp)->ColorPointer)) parameters -#define GET_ColorPointer(disp) ((disp)->ColorPointer) -#define SET_ColorPointer(disp, fn) ((disp)->ColorPointer = fn) -#define CALL_DisableClientState(disp, parameters) (*((disp)->DisableClientState)) parameters -#define GET_DisableClientState(disp) ((disp)->DisableClientState) -#define SET_DisableClientState(disp, fn) ((disp)->DisableClientState = fn) -#define CALL_DrawArrays(disp, parameters) (*((disp)->DrawArrays)) parameters -#define GET_DrawArrays(disp) ((disp)->DrawArrays) -#define SET_DrawArrays(disp, fn) ((disp)->DrawArrays = fn) -#define CALL_DrawElements(disp, parameters) (*((disp)->DrawElements)) parameters -#define GET_DrawElements(disp) ((disp)->DrawElements) -#define SET_DrawElements(disp, fn) ((disp)->DrawElements = fn) -#define CALL_EdgeFlagPointer(disp, parameters) (*((disp)->EdgeFlagPointer)) parameters -#define GET_EdgeFlagPointer(disp) ((disp)->EdgeFlagPointer) -#define SET_EdgeFlagPointer(disp, fn) ((disp)->EdgeFlagPointer = fn) -#define CALL_EnableClientState(disp, parameters) (*((disp)->EnableClientState)) parameters -#define GET_EnableClientState(disp) ((disp)->EnableClientState) -#define SET_EnableClientState(disp, fn) ((disp)->EnableClientState = fn) -#define CALL_IndexPointer(disp, parameters) (*((disp)->IndexPointer)) parameters -#define GET_IndexPointer(disp) ((disp)->IndexPointer) -#define SET_IndexPointer(disp, fn) ((disp)->IndexPointer = fn) -#define CALL_Indexub(disp, parameters) (*((disp)->Indexub)) parameters -#define GET_Indexub(disp) ((disp)->Indexub) -#define SET_Indexub(disp, fn) ((disp)->Indexub = fn) -#define CALL_Indexubv(disp, parameters) (*((disp)->Indexubv)) parameters -#define GET_Indexubv(disp) ((disp)->Indexubv) -#define SET_Indexubv(disp, fn) ((disp)->Indexubv = fn) -#define CALL_InterleavedArrays(disp, parameters) (*((disp)->InterleavedArrays)) parameters -#define GET_InterleavedArrays(disp) ((disp)->InterleavedArrays) -#define SET_InterleavedArrays(disp, fn) ((disp)->InterleavedArrays = fn) -#define CALL_NormalPointer(disp, parameters) (*((disp)->NormalPointer)) parameters -#define GET_NormalPointer(disp) ((disp)->NormalPointer) -#define SET_NormalPointer(disp, fn) ((disp)->NormalPointer = fn) -#define CALL_PolygonOffset(disp, parameters) (*((disp)->PolygonOffset)) parameters -#define GET_PolygonOffset(disp) ((disp)->PolygonOffset) -#define SET_PolygonOffset(disp, fn) ((disp)->PolygonOffset = fn) -#define CALL_TexCoordPointer(disp, parameters) (*((disp)->TexCoordPointer)) parameters -#define GET_TexCoordPointer(disp) ((disp)->TexCoordPointer) -#define SET_TexCoordPointer(disp, fn) ((disp)->TexCoordPointer = fn) -#define CALL_VertexPointer(disp, parameters) (*((disp)->VertexPointer)) parameters -#define GET_VertexPointer(disp) ((disp)->VertexPointer) -#define SET_VertexPointer(disp, fn) ((disp)->VertexPointer = fn) -#define CALL_AreTexturesResident(disp, parameters) (*((disp)->AreTexturesResident)) parameters -#define GET_AreTexturesResident(disp) ((disp)->AreTexturesResident) -#define SET_AreTexturesResident(disp, fn) ((disp)->AreTexturesResident = fn) -#define CALL_CopyTexImage1D(disp, parameters) (*((disp)->CopyTexImage1D)) parameters -#define GET_CopyTexImage1D(disp) ((disp)->CopyTexImage1D) -#define SET_CopyTexImage1D(disp, fn) ((disp)->CopyTexImage1D = fn) -#define CALL_CopyTexImage2D(disp, parameters) (*((disp)->CopyTexImage2D)) parameters -#define GET_CopyTexImage2D(disp) ((disp)->CopyTexImage2D) -#define SET_CopyTexImage2D(disp, fn) ((disp)->CopyTexImage2D = fn) -#define CALL_CopyTexSubImage1D(disp, parameters) (*((disp)->CopyTexSubImage1D)) parameters -#define GET_CopyTexSubImage1D(disp) ((disp)->CopyTexSubImage1D) -#define SET_CopyTexSubImage1D(disp, fn) ((disp)->CopyTexSubImage1D = fn) -#define CALL_CopyTexSubImage2D(disp, parameters) (*((disp)->CopyTexSubImage2D)) parameters -#define GET_CopyTexSubImage2D(disp) ((disp)->CopyTexSubImage2D) -#define SET_CopyTexSubImage2D(disp, fn) ((disp)->CopyTexSubImage2D = fn) -#define CALL_DeleteTextures(disp, parameters) (*((disp)->DeleteTextures)) parameters -#define GET_DeleteTextures(disp) ((disp)->DeleteTextures) -#define SET_DeleteTextures(disp, fn) ((disp)->DeleteTextures = fn) -#define CALL_GenTextures(disp, parameters) (*((disp)->GenTextures)) parameters -#define GET_GenTextures(disp) ((disp)->GenTextures) -#define SET_GenTextures(disp, fn) ((disp)->GenTextures = fn) -#define CALL_GetPointerv(disp, parameters) (*((disp)->GetPointerv)) parameters -#define GET_GetPointerv(disp) ((disp)->GetPointerv) -#define SET_GetPointerv(disp, fn) ((disp)->GetPointerv = fn) -#define CALL_IsTexture(disp, parameters) (*((disp)->IsTexture)) parameters -#define GET_IsTexture(disp) ((disp)->IsTexture) -#define SET_IsTexture(disp, fn) ((disp)->IsTexture = fn) -#define CALL_PrioritizeTextures(disp, parameters) (*((disp)->PrioritizeTextures)) parameters -#define GET_PrioritizeTextures(disp) ((disp)->PrioritizeTextures) -#define SET_PrioritizeTextures(disp, fn) ((disp)->PrioritizeTextures = fn) -#define CALL_TexSubImage1D(disp, parameters) (*((disp)->TexSubImage1D)) parameters -#define GET_TexSubImage1D(disp) ((disp)->TexSubImage1D) -#define SET_TexSubImage1D(disp, fn) ((disp)->TexSubImage1D = fn) -#define CALL_TexSubImage2D(disp, parameters) (*((disp)->TexSubImage2D)) parameters -#define GET_TexSubImage2D(disp) ((disp)->TexSubImage2D) -#define SET_TexSubImage2D(disp, fn) ((disp)->TexSubImage2D = fn) -#define CALL_PopClientAttrib(disp, parameters) (*((disp)->PopClientAttrib)) parameters -#define GET_PopClientAttrib(disp) ((disp)->PopClientAttrib) -#define SET_PopClientAttrib(disp, fn) ((disp)->PopClientAttrib = fn) -#define CALL_PushClientAttrib(disp, parameters) (*((disp)->PushClientAttrib)) parameters -#define GET_PushClientAttrib(disp) ((disp)->PushClientAttrib) -#define SET_PushClientAttrib(disp, fn) ((disp)->PushClientAttrib = fn) -#define CALL_BlendColor(disp, parameters) (*((disp)->BlendColor)) parameters -#define GET_BlendColor(disp) ((disp)->BlendColor) -#define SET_BlendColor(disp, fn) ((disp)->BlendColor = fn) -#define CALL_BlendEquation(disp, parameters) (*((disp)->BlendEquation)) parameters -#define GET_BlendEquation(disp) ((disp)->BlendEquation) -#define SET_BlendEquation(disp, fn) ((disp)->BlendEquation = fn) -#define CALL_DrawRangeElements(disp, parameters) (*((disp)->DrawRangeElements)) parameters -#define GET_DrawRangeElements(disp) ((disp)->DrawRangeElements) -#define SET_DrawRangeElements(disp, fn) ((disp)->DrawRangeElements = fn) -#define CALL_ColorTable(disp, parameters) (*((disp)->ColorTable)) parameters -#define GET_ColorTable(disp) ((disp)->ColorTable) -#define SET_ColorTable(disp, fn) ((disp)->ColorTable = fn) -#define CALL_ColorTableParameterfv(disp, parameters) (*((disp)->ColorTableParameterfv)) parameters -#define GET_ColorTableParameterfv(disp) ((disp)->ColorTableParameterfv) -#define SET_ColorTableParameterfv(disp, fn) ((disp)->ColorTableParameterfv = fn) -#define CALL_ColorTableParameteriv(disp, parameters) (*((disp)->ColorTableParameteriv)) parameters -#define GET_ColorTableParameteriv(disp) ((disp)->ColorTableParameteriv) -#define SET_ColorTableParameteriv(disp, fn) ((disp)->ColorTableParameteriv = fn) -#define CALL_CopyColorTable(disp, parameters) (*((disp)->CopyColorTable)) parameters -#define GET_CopyColorTable(disp) ((disp)->CopyColorTable) -#define SET_CopyColorTable(disp, fn) ((disp)->CopyColorTable = fn) -#define CALL_GetColorTable(disp, parameters) (*((disp)->GetColorTable)) parameters -#define GET_GetColorTable(disp) ((disp)->GetColorTable) -#define SET_GetColorTable(disp, fn) ((disp)->GetColorTable = fn) -#define CALL_GetColorTableParameterfv(disp, parameters) (*((disp)->GetColorTableParameterfv)) parameters -#define GET_GetColorTableParameterfv(disp) ((disp)->GetColorTableParameterfv) -#define SET_GetColorTableParameterfv(disp, fn) ((disp)->GetColorTableParameterfv = fn) -#define CALL_GetColorTableParameteriv(disp, parameters) (*((disp)->GetColorTableParameteriv)) parameters -#define GET_GetColorTableParameteriv(disp) ((disp)->GetColorTableParameteriv) -#define SET_GetColorTableParameteriv(disp, fn) ((disp)->GetColorTableParameteriv = fn) -#define CALL_ColorSubTable(disp, parameters) (*((disp)->ColorSubTable)) parameters -#define GET_ColorSubTable(disp) ((disp)->ColorSubTable) -#define SET_ColorSubTable(disp, fn) ((disp)->ColorSubTable = fn) -#define CALL_CopyColorSubTable(disp, parameters) (*((disp)->CopyColorSubTable)) parameters -#define GET_CopyColorSubTable(disp) ((disp)->CopyColorSubTable) -#define SET_CopyColorSubTable(disp, fn) ((disp)->CopyColorSubTable = fn) -#define CALL_ConvolutionFilter1D(disp, parameters) (*((disp)->ConvolutionFilter1D)) parameters -#define GET_ConvolutionFilter1D(disp) ((disp)->ConvolutionFilter1D) -#define SET_ConvolutionFilter1D(disp, fn) ((disp)->ConvolutionFilter1D = fn) -#define CALL_ConvolutionFilter2D(disp, parameters) (*((disp)->ConvolutionFilter2D)) parameters -#define GET_ConvolutionFilter2D(disp) ((disp)->ConvolutionFilter2D) -#define SET_ConvolutionFilter2D(disp, fn) ((disp)->ConvolutionFilter2D = fn) -#define CALL_ConvolutionParameterf(disp, parameters) (*((disp)->ConvolutionParameterf)) parameters -#define GET_ConvolutionParameterf(disp) ((disp)->ConvolutionParameterf) -#define SET_ConvolutionParameterf(disp, fn) ((disp)->ConvolutionParameterf = fn) -#define CALL_ConvolutionParameterfv(disp, parameters) (*((disp)->ConvolutionParameterfv)) parameters -#define GET_ConvolutionParameterfv(disp) ((disp)->ConvolutionParameterfv) -#define SET_ConvolutionParameterfv(disp, fn) ((disp)->ConvolutionParameterfv = fn) -#define CALL_ConvolutionParameteri(disp, parameters) (*((disp)->ConvolutionParameteri)) parameters -#define GET_ConvolutionParameteri(disp) ((disp)->ConvolutionParameteri) -#define SET_ConvolutionParameteri(disp, fn) ((disp)->ConvolutionParameteri = fn) -#define CALL_ConvolutionParameteriv(disp, parameters) (*((disp)->ConvolutionParameteriv)) parameters -#define GET_ConvolutionParameteriv(disp) ((disp)->ConvolutionParameteriv) -#define SET_ConvolutionParameteriv(disp, fn) ((disp)->ConvolutionParameteriv = fn) -#define CALL_CopyConvolutionFilter1D(disp, parameters) (*((disp)->CopyConvolutionFilter1D)) parameters -#define GET_CopyConvolutionFilter1D(disp) ((disp)->CopyConvolutionFilter1D) -#define SET_CopyConvolutionFilter1D(disp, fn) ((disp)->CopyConvolutionFilter1D = fn) -#define CALL_CopyConvolutionFilter2D(disp, parameters) (*((disp)->CopyConvolutionFilter2D)) parameters -#define GET_CopyConvolutionFilter2D(disp) ((disp)->CopyConvolutionFilter2D) -#define SET_CopyConvolutionFilter2D(disp, fn) ((disp)->CopyConvolutionFilter2D = fn) -#define CALL_GetConvolutionFilter(disp, parameters) (*((disp)->GetConvolutionFilter)) parameters -#define GET_GetConvolutionFilter(disp) ((disp)->GetConvolutionFilter) -#define SET_GetConvolutionFilter(disp, fn) ((disp)->GetConvolutionFilter = fn) -#define CALL_GetConvolutionParameterfv(disp, parameters) (*((disp)->GetConvolutionParameterfv)) parameters -#define GET_GetConvolutionParameterfv(disp) ((disp)->GetConvolutionParameterfv) -#define SET_GetConvolutionParameterfv(disp, fn) ((disp)->GetConvolutionParameterfv = fn) -#define CALL_GetConvolutionParameteriv(disp, parameters) (*((disp)->GetConvolutionParameteriv)) parameters -#define GET_GetConvolutionParameteriv(disp) ((disp)->GetConvolutionParameteriv) -#define SET_GetConvolutionParameteriv(disp, fn) ((disp)->GetConvolutionParameteriv = fn) -#define CALL_GetSeparableFilter(disp, parameters) (*((disp)->GetSeparableFilter)) parameters -#define GET_GetSeparableFilter(disp) ((disp)->GetSeparableFilter) -#define SET_GetSeparableFilter(disp, fn) ((disp)->GetSeparableFilter = fn) -#define CALL_SeparableFilter2D(disp, parameters) (*((disp)->SeparableFilter2D)) parameters -#define GET_SeparableFilter2D(disp) ((disp)->SeparableFilter2D) -#define SET_SeparableFilter2D(disp, fn) ((disp)->SeparableFilter2D = fn) -#define CALL_GetHistogram(disp, parameters) (*((disp)->GetHistogram)) parameters -#define GET_GetHistogram(disp) ((disp)->GetHistogram) -#define SET_GetHistogram(disp, fn) ((disp)->GetHistogram = fn) -#define CALL_GetHistogramParameterfv(disp, parameters) (*((disp)->GetHistogramParameterfv)) parameters -#define GET_GetHistogramParameterfv(disp) ((disp)->GetHistogramParameterfv) -#define SET_GetHistogramParameterfv(disp, fn) ((disp)->GetHistogramParameterfv = fn) -#define CALL_GetHistogramParameteriv(disp, parameters) (*((disp)->GetHistogramParameteriv)) parameters -#define GET_GetHistogramParameteriv(disp) ((disp)->GetHistogramParameteriv) -#define SET_GetHistogramParameteriv(disp, fn) ((disp)->GetHistogramParameteriv = fn) -#define CALL_GetMinmax(disp, parameters) (*((disp)->GetMinmax)) parameters -#define GET_GetMinmax(disp) ((disp)->GetMinmax) -#define SET_GetMinmax(disp, fn) ((disp)->GetMinmax = fn) -#define CALL_GetMinmaxParameterfv(disp, parameters) (*((disp)->GetMinmaxParameterfv)) parameters -#define GET_GetMinmaxParameterfv(disp) ((disp)->GetMinmaxParameterfv) -#define SET_GetMinmaxParameterfv(disp, fn) ((disp)->GetMinmaxParameterfv = fn) -#define CALL_GetMinmaxParameteriv(disp, parameters) (*((disp)->GetMinmaxParameteriv)) parameters -#define GET_GetMinmaxParameteriv(disp) ((disp)->GetMinmaxParameteriv) -#define SET_GetMinmaxParameteriv(disp, fn) ((disp)->GetMinmaxParameteriv = fn) -#define CALL_Histogram(disp, parameters) (*((disp)->Histogram)) parameters -#define GET_Histogram(disp) ((disp)->Histogram) -#define SET_Histogram(disp, fn) ((disp)->Histogram = fn) -#define CALL_Minmax(disp, parameters) (*((disp)->Minmax)) parameters -#define GET_Minmax(disp) ((disp)->Minmax) -#define SET_Minmax(disp, fn) ((disp)->Minmax = fn) -#define CALL_ResetHistogram(disp, parameters) (*((disp)->ResetHistogram)) parameters -#define GET_ResetHistogram(disp) ((disp)->ResetHistogram) -#define SET_ResetHistogram(disp, fn) ((disp)->ResetHistogram = fn) -#define CALL_ResetMinmax(disp, parameters) (*((disp)->ResetMinmax)) parameters -#define GET_ResetMinmax(disp) ((disp)->ResetMinmax) -#define SET_ResetMinmax(disp, fn) ((disp)->ResetMinmax = fn) -#define CALL_TexImage3D(disp, parameters) (*((disp)->TexImage3D)) parameters -#define GET_TexImage3D(disp) ((disp)->TexImage3D) -#define SET_TexImage3D(disp, fn) ((disp)->TexImage3D = fn) -#define CALL_TexSubImage3D(disp, parameters) (*((disp)->TexSubImage3D)) parameters -#define GET_TexSubImage3D(disp) ((disp)->TexSubImage3D) -#define SET_TexSubImage3D(disp, fn) ((disp)->TexSubImage3D = fn) -#define CALL_CopyTexSubImage3D(disp, parameters) (*((disp)->CopyTexSubImage3D)) parameters -#define GET_CopyTexSubImage3D(disp) ((disp)->CopyTexSubImage3D) -#define SET_CopyTexSubImage3D(disp, fn) ((disp)->CopyTexSubImage3D = fn) -#define CALL_ActiveTextureARB(disp, parameters) (*((disp)->ActiveTextureARB)) parameters -#define GET_ActiveTextureARB(disp) ((disp)->ActiveTextureARB) -#define SET_ActiveTextureARB(disp, fn) ((disp)->ActiveTextureARB = fn) -#define CALL_ClientActiveTextureARB(disp, parameters) (*((disp)->ClientActiveTextureARB)) parameters -#define GET_ClientActiveTextureARB(disp) ((disp)->ClientActiveTextureARB) -#define SET_ClientActiveTextureARB(disp, fn) ((disp)->ClientActiveTextureARB = fn) -#define CALL_MultiTexCoord1dARB(disp, parameters) (*((disp)->MultiTexCoord1dARB)) parameters -#define GET_MultiTexCoord1dARB(disp) ((disp)->MultiTexCoord1dARB) -#define SET_MultiTexCoord1dARB(disp, fn) ((disp)->MultiTexCoord1dARB = fn) -#define CALL_MultiTexCoord1dvARB(disp, parameters) (*((disp)->MultiTexCoord1dvARB)) parameters -#define GET_MultiTexCoord1dvARB(disp) ((disp)->MultiTexCoord1dvARB) -#define SET_MultiTexCoord1dvARB(disp, fn) ((disp)->MultiTexCoord1dvARB = fn) -#define CALL_MultiTexCoord1fARB(disp, parameters) (*((disp)->MultiTexCoord1fARB)) parameters -#define GET_MultiTexCoord1fARB(disp) ((disp)->MultiTexCoord1fARB) -#define SET_MultiTexCoord1fARB(disp, fn) ((disp)->MultiTexCoord1fARB = fn) -#define CALL_MultiTexCoord1fvARB(disp, parameters) (*((disp)->MultiTexCoord1fvARB)) parameters -#define GET_MultiTexCoord1fvARB(disp) ((disp)->MultiTexCoord1fvARB) -#define SET_MultiTexCoord1fvARB(disp, fn) ((disp)->MultiTexCoord1fvARB = fn) -#define CALL_MultiTexCoord1iARB(disp, parameters) (*((disp)->MultiTexCoord1iARB)) parameters -#define GET_MultiTexCoord1iARB(disp) ((disp)->MultiTexCoord1iARB) -#define SET_MultiTexCoord1iARB(disp, fn) ((disp)->MultiTexCoord1iARB = fn) -#define CALL_MultiTexCoord1ivARB(disp, parameters) (*((disp)->MultiTexCoord1ivARB)) parameters -#define GET_MultiTexCoord1ivARB(disp) ((disp)->MultiTexCoord1ivARB) -#define SET_MultiTexCoord1ivARB(disp, fn) ((disp)->MultiTexCoord1ivARB = fn) -#define CALL_MultiTexCoord1sARB(disp, parameters) (*((disp)->MultiTexCoord1sARB)) parameters -#define GET_MultiTexCoord1sARB(disp) ((disp)->MultiTexCoord1sARB) -#define SET_MultiTexCoord1sARB(disp, fn) ((disp)->MultiTexCoord1sARB = fn) -#define CALL_MultiTexCoord1svARB(disp, parameters) (*((disp)->MultiTexCoord1svARB)) parameters -#define GET_MultiTexCoord1svARB(disp) ((disp)->MultiTexCoord1svARB) -#define SET_MultiTexCoord1svARB(disp, fn) ((disp)->MultiTexCoord1svARB = fn) -#define CALL_MultiTexCoord2dARB(disp, parameters) (*((disp)->MultiTexCoord2dARB)) parameters -#define GET_MultiTexCoord2dARB(disp) ((disp)->MultiTexCoord2dARB) -#define SET_MultiTexCoord2dARB(disp, fn) ((disp)->MultiTexCoord2dARB = fn) -#define CALL_MultiTexCoord2dvARB(disp, parameters) (*((disp)->MultiTexCoord2dvARB)) parameters -#define GET_MultiTexCoord2dvARB(disp) ((disp)->MultiTexCoord2dvARB) -#define SET_MultiTexCoord2dvARB(disp, fn) ((disp)->MultiTexCoord2dvARB = fn) -#define CALL_MultiTexCoord2fARB(disp, parameters) (*((disp)->MultiTexCoord2fARB)) parameters -#define GET_MultiTexCoord2fARB(disp) ((disp)->MultiTexCoord2fARB) -#define SET_MultiTexCoord2fARB(disp, fn) ((disp)->MultiTexCoord2fARB = fn) -#define CALL_MultiTexCoord2fvARB(disp, parameters) (*((disp)->MultiTexCoord2fvARB)) parameters -#define GET_MultiTexCoord2fvARB(disp) ((disp)->MultiTexCoord2fvARB) -#define SET_MultiTexCoord2fvARB(disp, fn) ((disp)->MultiTexCoord2fvARB = fn) -#define CALL_MultiTexCoord2iARB(disp, parameters) (*((disp)->MultiTexCoord2iARB)) parameters -#define GET_MultiTexCoord2iARB(disp) ((disp)->MultiTexCoord2iARB) -#define SET_MultiTexCoord2iARB(disp, fn) ((disp)->MultiTexCoord2iARB = fn) -#define CALL_MultiTexCoord2ivARB(disp, parameters) (*((disp)->MultiTexCoord2ivARB)) parameters -#define GET_MultiTexCoord2ivARB(disp) ((disp)->MultiTexCoord2ivARB) -#define SET_MultiTexCoord2ivARB(disp, fn) ((disp)->MultiTexCoord2ivARB = fn) -#define CALL_MultiTexCoord2sARB(disp, parameters) (*((disp)->MultiTexCoord2sARB)) parameters -#define GET_MultiTexCoord2sARB(disp) ((disp)->MultiTexCoord2sARB) -#define SET_MultiTexCoord2sARB(disp, fn) ((disp)->MultiTexCoord2sARB = fn) -#define CALL_MultiTexCoord2svARB(disp, parameters) (*((disp)->MultiTexCoord2svARB)) parameters -#define GET_MultiTexCoord2svARB(disp) ((disp)->MultiTexCoord2svARB) -#define SET_MultiTexCoord2svARB(disp, fn) ((disp)->MultiTexCoord2svARB = fn) -#define CALL_MultiTexCoord3dARB(disp, parameters) (*((disp)->MultiTexCoord3dARB)) parameters -#define GET_MultiTexCoord3dARB(disp) ((disp)->MultiTexCoord3dARB) -#define SET_MultiTexCoord3dARB(disp, fn) ((disp)->MultiTexCoord3dARB = fn) -#define CALL_MultiTexCoord3dvARB(disp, parameters) (*((disp)->MultiTexCoord3dvARB)) parameters -#define GET_MultiTexCoord3dvARB(disp) ((disp)->MultiTexCoord3dvARB) -#define SET_MultiTexCoord3dvARB(disp, fn) ((disp)->MultiTexCoord3dvARB = fn) -#define CALL_MultiTexCoord3fARB(disp, parameters) (*((disp)->MultiTexCoord3fARB)) parameters -#define GET_MultiTexCoord3fARB(disp) ((disp)->MultiTexCoord3fARB) -#define SET_MultiTexCoord3fARB(disp, fn) ((disp)->MultiTexCoord3fARB = fn) -#define CALL_MultiTexCoord3fvARB(disp, parameters) (*((disp)->MultiTexCoord3fvARB)) parameters -#define GET_MultiTexCoord3fvARB(disp) ((disp)->MultiTexCoord3fvARB) -#define SET_MultiTexCoord3fvARB(disp, fn) ((disp)->MultiTexCoord3fvARB = fn) -#define CALL_MultiTexCoord3iARB(disp, parameters) (*((disp)->MultiTexCoord3iARB)) parameters -#define GET_MultiTexCoord3iARB(disp) ((disp)->MultiTexCoord3iARB) -#define SET_MultiTexCoord3iARB(disp, fn) ((disp)->MultiTexCoord3iARB = fn) -#define CALL_MultiTexCoord3ivARB(disp, parameters) (*((disp)->MultiTexCoord3ivARB)) parameters -#define GET_MultiTexCoord3ivARB(disp) ((disp)->MultiTexCoord3ivARB) -#define SET_MultiTexCoord3ivARB(disp, fn) ((disp)->MultiTexCoord3ivARB = fn) -#define CALL_MultiTexCoord3sARB(disp, parameters) (*((disp)->MultiTexCoord3sARB)) parameters -#define GET_MultiTexCoord3sARB(disp) ((disp)->MultiTexCoord3sARB) -#define SET_MultiTexCoord3sARB(disp, fn) ((disp)->MultiTexCoord3sARB = fn) -#define CALL_MultiTexCoord3svARB(disp, parameters) (*((disp)->MultiTexCoord3svARB)) parameters -#define GET_MultiTexCoord3svARB(disp) ((disp)->MultiTexCoord3svARB) -#define SET_MultiTexCoord3svARB(disp, fn) ((disp)->MultiTexCoord3svARB = fn) -#define CALL_MultiTexCoord4dARB(disp, parameters) (*((disp)->MultiTexCoord4dARB)) parameters -#define GET_MultiTexCoord4dARB(disp) ((disp)->MultiTexCoord4dARB) -#define SET_MultiTexCoord4dARB(disp, fn) ((disp)->MultiTexCoord4dARB = fn) -#define CALL_MultiTexCoord4dvARB(disp, parameters) (*((disp)->MultiTexCoord4dvARB)) parameters -#define GET_MultiTexCoord4dvARB(disp) ((disp)->MultiTexCoord4dvARB) -#define SET_MultiTexCoord4dvARB(disp, fn) ((disp)->MultiTexCoord4dvARB = fn) -#define CALL_MultiTexCoord4fARB(disp, parameters) (*((disp)->MultiTexCoord4fARB)) parameters -#define GET_MultiTexCoord4fARB(disp) ((disp)->MultiTexCoord4fARB) -#define SET_MultiTexCoord4fARB(disp, fn) ((disp)->MultiTexCoord4fARB = fn) -#define CALL_MultiTexCoord4fvARB(disp, parameters) (*((disp)->MultiTexCoord4fvARB)) parameters -#define GET_MultiTexCoord4fvARB(disp) ((disp)->MultiTexCoord4fvARB) -#define SET_MultiTexCoord4fvARB(disp, fn) ((disp)->MultiTexCoord4fvARB = fn) -#define CALL_MultiTexCoord4iARB(disp, parameters) (*((disp)->MultiTexCoord4iARB)) parameters -#define GET_MultiTexCoord4iARB(disp) ((disp)->MultiTexCoord4iARB) -#define SET_MultiTexCoord4iARB(disp, fn) ((disp)->MultiTexCoord4iARB = fn) -#define CALL_MultiTexCoord4ivARB(disp, parameters) (*((disp)->MultiTexCoord4ivARB)) parameters -#define GET_MultiTexCoord4ivARB(disp) ((disp)->MultiTexCoord4ivARB) -#define SET_MultiTexCoord4ivARB(disp, fn) ((disp)->MultiTexCoord4ivARB = fn) -#define CALL_MultiTexCoord4sARB(disp, parameters) (*((disp)->MultiTexCoord4sARB)) parameters -#define GET_MultiTexCoord4sARB(disp) ((disp)->MultiTexCoord4sARB) -#define SET_MultiTexCoord4sARB(disp, fn) ((disp)->MultiTexCoord4sARB = fn) -#define CALL_MultiTexCoord4svARB(disp, parameters) (*((disp)->MultiTexCoord4svARB)) parameters -#define GET_MultiTexCoord4svARB(disp) ((disp)->MultiTexCoord4svARB) -#define SET_MultiTexCoord4svARB(disp, fn) ((disp)->MultiTexCoord4svARB = fn) - -#if !defined(IN_DRI_DRIVER) - -#define CALL_AttachShader(disp, parameters) (*((disp)->AttachShader)) parameters -#define GET_AttachShader(disp) ((disp)->AttachShader) -#define SET_AttachShader(disp, fn) ((disp)->AttachShader = fn) -#define CALL_CreateProgram(disp, parameters) (*((disp)->CreateProgram)) parameters -#define GET_CreateProgram(disp) ((disp)->CreateProgram) -#define SET_CreateProgram(disp, fn) ((disp)->CreateProgram = fn) -#define CALL_CreateShader(disp, parameters) (*((disp)->CreateShader)) parameters -#define GET_CreateShader(disp) ((disp)->CreateShader) -#define SET_CreateShader(disp, fn) ((disp)->CreateShader = fn) -#define CALL_DeleteProgram(disp, parameters) (*((disp)->DeleteProgram)) parameters -#define GET_DeleteProgram(disp) ((disp)->DeleteProgram) -#define SET_DeleteProgram(disp, fn) ((disp)->DeleteProgram = fn) -#define CALL_DeleteShader(disp, parameters) (*((disp)->DeleteShader)) parameters -#define GET_DeleteShader(disp) ((disp)->DeleteShader) -#define SET_DeleteShader(disp, fn) ((disp)->DeleteShader = fn) -#define CALL_DetachShader(disp, parameters) (*((disp)->DetachShader)) parameters -#define GET_DetachShader(disp) ((disp)->DetachShader) -#define SET_DetachShader(disp, fn) ((disp)->DetachShader = fn) -#define CALL_GetAttachedShaders(disp, parameters) (*((disp)->GetAttachedShaders)) parameters -#define GET_GetAttachedShaders(disp) ((disp)->GetAttachedShaders) -#define SET_GetAttachedShaders(disp, fn) ((disp)->GetAttachedShaders = fn) -#define CALL_GetProgramInfoLog(disp, parameters) (*((disp)->GetProgramInfoLog)) parameters -#define GET_GetProgramInfoLog(disp) ((disp)->GetProgramInfoLog) -#define SET_GetProgramInfoLog(disp, fn) ((disp)->GetProgramInfoLog = fn) -#define CALL_GetProgramiv(disp, parameters) (*((disp)->GetProgramiv)) parameters -#define GET_GetProgramiv(disp) ((disp)->GetProgramiv) -#define SET_GetProgramiv(disp, fn) ((disp)->GetProgramiv = fn) -#define CALL_GetShaderInfoLog(disp, parameters) (*((disp)->GetShaderInfoLog)) parameters -#define GET_GetShaderInfoLog(disp) ((disp)->GetShaderInfoLog) -#define SET_GetShaderInfoLog(disp, fn) ((disp)->GetShaderInfoLog = fn) -#define CALL_GetShaderiv(disp, parameters) (*((disp)->GetShaderiv)) parameters -#define GET_GetShaderiv(disp) ((disp)->GetShaderiv) -#define SET_GetShaderiv(disp, fn) ((disp)->GetShaderiv = fn) -#define CALL_IsProgram(disp, parameters) (*((disp)->IsProgram)) parameters -#define GET_IsProgram(disp) ((disp)->IsProgram) -#define SET_IsProgram(disp, fn) ((disp)->IsProgram = fn) -#define CALL_IsShader(disp, parameters) (*((disp)->IsShader)) parameters -#define GET_IsShader(disp) ((disp)->IsShader) -#define SET_IsShader(disp, fn) ((disp)->IsShader = fn) -#define CALL_StencilFuncSeparate(disp, parameters) (*((disp)->StencilFuncSeparate)) parameters -#define GET_StencilFuncSeparate(disp) ((disp)->StencilFuncSeparate) -#define SET_StencilFuncSeparate(disp, fn) ((disp)->StencilFuncSeparate = fn) -#define CALL_StencilMaskSeparate(disp, parameters) (*((disp)->StencilMaskSeparate)) parameters -#define GET_StencilMaskSeparate(disp) ((disp)->StencilMaskSeparate) -#define SET_StencilMaskSeparate(disp, fn) ((disp)->StencilMaskSeparate = fn) -#define CALL_StencilOpSeparate(disp, parameters) (*((disp)->StencilOpSeparate)) parameters -#define GET_StencilOpSeparate(disp) ((disp)->StencilOpSeparate) -#define SET_StencilOpSeparate(disp, fn) ((disp)->StencilOpSeparate = fn) -#define CALL_UniformMatrix2x3fv(disp, parameters) (*((disp)->UniformMatrix2x3fv)) parameters -#define GET_UniformMatrix2x3fv(disp) ((disp)->UniformMatrix2x3fv) -#define SET_UniformMatrix2x3fv(disp, fn) ((disp)->UniformMatrix2x3fv = fn) -#define CALL_UniformMatrix2x4fv(disp, parameters) (*((disp)->UniformMatrix2x4fv)) parameters -#define GET_UniformMatrix2x4fv(disp) ((disp)->UniformMatrix2x4fv) -#define SET_UniformMatrix2x4fv(disp, fn) ((disp)->UniformMatrix2x4fv = fn) -#define CALL_UniformMatrix3x2fv(disp, parameters) (*((disp)->UniformMatrix3x2fv)) parameters -#define GET_UniformMatrix3x2fv(disp) ((disp)->UniformMatrix3x2fv) -#define SET_UniformMatrix3x2fv(disp, fn) ((disp)->UniformMatrix3x2fv = fn) -#define CALL_UniformMatrix3x4fv(disp, parameters) (*((disp)->UniformMatrix3x4fv)) parameters -#define GET_UniformMatrix3x4fv(disp) ((disp)->UniformMatrix3x4fv) -#define SET_UniformMatrix3x4fv(disp, fn) ((disp)->UniformMatrix3x4fv = fn) -#define CALL_UniformMatrix4x2fv(disp, parameters) (*((disp)->UniformMatrix4x2fv)) parameters -#define GET_UniformMatrix4x2fv(disp) ((disp)->UniformMatrix4x2fv) -#define SET_UniformMatrix4x2fv(disp, fn) ((disp)->UniformMatrix4x2fv = fn) -#define CALL_UniformMatrix4x3fv(disp, parameters) (*((disp)->UniformMatrix4x3fv)) parameters -#define GET_UniformMatrix4x3fv(disp) ((disp)->UniformMatrix4x3fv) -#define SET_UniformMatrix4x3fv(disp, fn) ((disp)->UniformMatrix4x3fv = fn) -#define CALL_LoadTransposeMatrixdARB(disp, parameters) (*((disp)->LoadTransposeMatrixdARB)) parameters -#define GET_LoadTransposeMatrixdARB(disp) ((disp)->LoadTransposeMatrixdARB) -#define SET_LoadTransposeMatrixdARB(disp, fn) ((disp)->LoadTransposeMatrixdARB = fn) -#define CALL_LoadTransposeMatrixfARB(disp, parameters) (*((disp)->LoadTransposeMatrixfARB)) parameters -#define GET_LoadTransposeMatrixfARB(disp) ((disp)->LoadTransposeMatrixfARB) -#define SET_LoadTransposeMatrixfARB(disp, fn) ((disp)->LoadTransposeMatrixfARB = fn) -#define CALL_MultTransposeMatrixdARB(disp, parameters) (*((disp)->MultTransposeMatrixdARB)) parameters -#define GET_MultTransposeMatrixdARB(disp) ((disp)->MultTransposeMatrixdARB) -#define SET_MultTransposeMatrixdARB(disp, fn) ((disp)->MultTransposeMatrixdARB = fn) -#define CALL_MultTransposeMatrixfARB(disp, parameters) (*((disp)->MultTransposeMatrixfARB)) parameters -#define GET_MultTransposeMatrixfARB(disp) ((disp)->MultTransposeMatrixfARB) -#define SET_MultTransposeMatrixfARB(disp, fn) ((disp)->MultTransposeMatrixfARB = fn) -#define CALL_SampleCoverageARB(disp, parameters) (*((disp)->SampleCoverageARB)) parameters -#define GET_SampleCoverageARB(disp) ((disp)->SampleCoverageARB) -#define SET_SampleCoverageARB(disp, fn) ((disp)->SampleCoverageARB = fn) -#define CALL_CompressedTexImage1DARB(disp, parameters) (*((disp)->CompressedTexImage1DARB)) parameters -#define GET_CompressedTexImage1DARB(disp) ((disp)->CompressedTexImage1DARB) -#define SET_CompressedTexImage1DARB(disp, fn) ((disp)->CompressedTexImage1DARB = fn) -#define CALL_CompressedTexImage2DARB(disp, parameters) (*((disp)->CompressedTexImage2DARB)) parameters -#define GET_CompressedTexImage2DARB(disp) ((disp)->CompressedTexImage2DARB) -#define SET_CompressedTexImage2DARB(disp, fn) ((disp)->CompressedTexImage2DARB = fn) -#define CALL_CompressedTexImage3DARB(disp, parameters) (*((disp)->CompressedTexImage3DARB)) parameters -#define GET_CompressedTexImage3DARB(disp) ((disp)->CompressedTexImage3DARB) -#define SET_CompressedTexImage3DARB(disp, fn) ((disp)->CompressedTexImage3DARB = fn) -#define CALL_CompressedTexSubImage1DARB(disp, parameters) (*((disp)->CompressedTexSubImage1DARB)) parameters -#define GET_CompressedTexSubImage1DARB(disp) ((disp)->CompressedTexSubImage1DARB) -#define SET_CompressedTexSubImage1DARB(disp, fn) ((disp)->CompressedTexSubImage1DARB = fn) -#define CALL_CompressedTexSubImage2DARB(disp, parameters) (*((disp)->CompressedTexSubImage2DARB)) parameters -#define GET_CompressedTexSubImage2DARB(disp) ((disp)->CompressedTexSubImage2DARB) -#define SET_CompressedTexSubImage2DARB(disp, fn) ((disp)->CompressedTexSubImage2DARB = fn) -#define CALL_CompressedTexSubImage3DARB(disp, parameters) (*((disp)->CompressedTexSubImage3DARB)) parameters -#define GET_CompressedTexSubImage3DARB(disp) ((disp)->CompressedTexSubImage3DARB) -#define SET_CompressedTexSubImage3DARB(disp, fn) ((disp)->CompressedTexSubImage3DARB = fn) -#define CALL_GetCompressedTexImageARB(disp, parameters) (*((disp)->GetCompressedTexImageARB)) parameters -#define GET_GetCompressedTexImageARB(disp) ((disp)->GetCompressedTexImageARB) -#define SET_GetCompressedTexImageARB(disp, fn) ((disp)->GetCompressedTexImageARB = fn) -#define CALL_DisableVertexAttribArrayARB(disp, parameters) (*((disp)->DisableVertexAttribArrayARB)) parameters -#define GET_DisableVertexAttribArrayARB(disp) ((disp)->DisableVertexAttribArrayARB) -#define SET_DisableVertexAttribArrayARB(disp, fn) ((disp)->DisableVertexAttribArrayARB = fn) -#define CALL_EnableVertexAttribArrayARB(disp, parameters) (*((disp)->EnableVertexAttribArrayARB)) parameters -#define GET_EnableVertexAttribArrayARB(disp) ((disp)->EnableVertexAttribArrayARB) -#define SET_EnableVertexAttribArrayARB(disp, fn) ((disp)->EnableVertexAttribArrayARB = fn) -#define CALL_GetProgramEnvParameterdvARB(disp, parameters) (*((disp)->GetProgramEnvParameterdvARB)) parameters -#define GET_GetProgramEnvParameterdvARB(disp) ((disp)->GetProgramEnvParameterdvARB) -#define SET_GetProgramEnvParameterdvARB(disp, fn) ((disp)->GetProgramEnvParameterdvARB = fn) -#define CALL_GetProgramEnvParameterfvARB(disp, parameters) (*((disp)->GetProgramEnvParameterfvARB)) parameters -#define GET_GetProgramEnvParameterfvARB(disp) ((disp)->GetProgramEnvParameterfvARB) -#define SET_GetProgramEnvParameterfvARB(disp, fn) ((disp)->GetProgramEnvParameterfvARB = fn) -#define CALL_GetProgramLocalParameterdvARB(disp, parameters) (*((disp)->GetProgramLocalParameterdvARB)) parameters -#define GET_GetProgramLocalParameterdvARB(disp) ((disp)->GetProgramLocalParameterdvARB) -#define SET_GetProgramLocalParameterdvARB(disp, fn) ((disp)->GetProgramLocalParameterdvARB = fn) -#define CALL_GetProgramLocalParameterfvARB(disp, parameters) (*((disp)->GetProgramLocalParameterfvARB)) parameters -#define GET_GetProgramLocalParameterfvARB(disp) ((disp)->GetProgramLocalParameterfvARB) -#define SET_GetProgramLocalParameterfvARB(disp, fn) ((disp)->GetProgramLocalParameterfvARB = fn) -#define CALL_GetProgramStringARB(disp, parameters) (*((disp)->GetProgramStringARB)) parameters -#define GET_GetProgramStringARB(disp) ((disp)->GetProgramStringARB) -#define SET_GetProgramStringARB(disp, fn) ((disp)->GetProgramStringARB = fn) -#define CALL_GetProgramivARB(disp, parameters) (*((disp)->GetProgramivARB)) parameters -#define GET_GetProgramivARB(disp) ((disp)->GetProgramivARB) -#define SET_GetProgramivARB(disp, fn) ((disp)->GetProgramivARB = fn) -#define CALL_GetVertexAttribdvARB(disp, parameters) (*((disp)->GetVertexAttribdvARB)) parameters -#define GET_GetVertexAttribdvARB(disp) ((disp)->GetVertexAttribdvARB) -#define SET_GetVertexAttribdvARB(disp, fn) ((disp)->GetVertexAttribdvARB = fn) -#define CALL_GetVertexAttribfvARB(disp, parameters) (*((disp)->GetVertexAttribfvARB)) parameters -#define GET_GetVertexAttribfvARB(disp) ((disp)->GetVertexAttribfvARB) -#define SET_GetVertexAttribfvARB(disp, fn) ((disp)->GetVertexAttribfvARB = fn) -#define CALL_GetVertexAttribivARB(disp, parameters) (*((disp)->GetVertexAttribivARB)) parameters -#define GET_GetVertexAttribivARB(disp) ((disp)->GetVertexAttribivARB) -#define SET_GetVertexAttribivARB(disp, fn) ((disp)->GetVertexAttribivARB = fn) -#define CALL_ProgramEnvParameter4dARB(disp, parameters) (*((disp)->ProgramEnvParameter4dARB)) parameters -#define GET_ProgramEnvParameter4dARB(disp) ((disp)->ProgramEnvParameter4dARB) -#define SET_ProgramEnvParameter4dARB(disp, fn) ((disp)->ProgramEnvParameter4dARB = fn) -#define CALL_ProgramEnvParameter4dvARB(disp, parameters) (*((disp)->ProgramEnvParameter4dvARB)) parameters -#define GET_ProgramEnvParameter4dvARB(disp) ((disp)->ProgramEnvParameter4dvARB) -#define SET_ProgramEnvParameter4dvARB(disp, fn) ((disp)->ProgramEnvParameter4dvARB = fn) -#define CALL_ProgramEnvParameter4fARB(disp, parameters) (*((disp)->ProgramEnvParameter4fARB)) parameters -#define GET_ProgramEnvParameter4fARB(disp) ((disp)->ProgramEnvParameter4fARB) -#define SET_ProgramEnvParameter4fARB(disp, fn) ((disp)->ProgramEnvParameter4fARB = fn) -#define CALL_ProgramEnvParameter4fvARB(disp, parameters) (*((disp)->ProgramEnvParameter4fvARB)) parameters -#define GET_ProgramEnvParameter4fvARB(disp) ((disp)->ProgramEnvParameter4fvARB) -#define SET_ProgramEnvParameter4fvARB(disp, fn) ((disp)->ProgramEnvParameter4fvARB = fn) -#define CALL_ProgramLocalParameter4dARB(disp, parameters) (*((disp)->ProgramLocalParameter4dARB)) parameters -#define GET_ProgramLocalParameter4dARB(disp) ((disp)->ProgramLocalParameter4dARB) -#define SET_ProgramLocalParameter4dARB(disp, fn) ((disp)->ProgramLocalParameter4dARB = fn) -#define CALL_ProgramLocalParameter4dvARB(disp, parameters) (*((disp)->ProgramLocalParameter4dvARB)) parameters -#define GET_ProgramLocalParameter4dvARB(disp) ((disp)->ProgramLocalParameter4dvARB) -#define SET_ProgramLocalParameter4dvARB(disp, fn) ((disp)->ProgramLocalParameter4dvARB = fn) -#define CALL_ProgramLocalParameter4fARB(disp, parameters) (*((disp)->ProgramLocalParameter4fARB)) parameters -#define GET_ProgramLocalParameter4fARB(disp) ((disp)->ProgramLocalParameter4fARB) -#define SET_ProgramLocalParameter4fARB(disp, fn) ((disp)->ProgramLocalParameter4fARB = fn) -#define CALL_ProgramLocalParameter4fvARB(disp, parameters) (*((disp)->ProgramLocalParameter4fvARB)) parameters -#define GET_ProgramLocalParameter4fvARB(disp) ((disp)->ProgramLocalParameter4fvARB) -#define SET_ProgramLocalParameter4fvARB(disp, fn) ((disp)->ProgramLocalParameter4fvARB = fn) -#define CALL_ProgramStringARB(disp, parameters) (*((disp)->ProgramStringARB)) parameters -#define GET_ProgramStringARB(disp) ((disp)->ProgramStringARB) -#define SET_ProgramStringARB(disp, fn) ((disp)->ProgramStringARB = fn) -#define CALL_VertexAttrib1dARB(disp, parameters) (*((disp)->VertexAttrib1dARB)) parameters -#define GET_VertexAttrib1dARB(disp) ((disp)->VertexAttrib1dARB) -#define SET_VertexAttrib1dARB(disp, fn) ((disp)->VertexAttrib1dARB = fn) -#define CALL_VertexAttrib1dvARB(disp, parameters) (*((disp)->VertexAttrib1dvARB)) parameters -#define GET_VertexAttrib1dvARB(disp) ((disp)->VertexAttrib1dvARB) -#define SET_VertexAttrib1dvARB(disp, fn) ((disp)->VertexAttrib1dvARB = fn) -#define CALL_VertexAttrib1fARB(disp, parameters) (*((disp)->VertexAttrib1fARB)) parameters -#define GET_VertexAttrib1fARB(disp) ((disp)->VertexAttrib1fARB) -#define SET_VertexAttrib1fARB(disp, fn) ((disp)->VertexAttrib1fARB = fn) -#define CALL_VertexAttrib1fvARB(disp, parameters) (*((disp)->VertexAttrib1fvARB)) parameters -#define GET_VertexAttrib1fvARB(disp) ((disp)->VertexAttrib1fvARB) -#define SET_VertexAttrib1fvARB(disp, fn) ((disp)->VertexAttrib1fvARB = fn) -#define CALL_VertexAttrib1sARB(disp, parameters) (*((disp)->VertexAttrib1sARB)) parameters -#define GET_VertexAttrib1sARB(disp) ((disp)->VertexAttrib1sARB) -#define SET_VertexAttrib1sARB(disp, fn) ((disp)->VertexAttrib1sARB = fn) -#define CALL_VertexAttrib1svARB(disp, parameters) (*((disp)->VertexAttrib1svARB)) parameters -#define GET_VertexAttrib1svARB(disp) ((disp)->VertexAttrib1svARB) -#define SET_VertexAttrib1svARB(disp, fn) ((disp)->VertexAttrib1svARB = fn) -#define CALL_VertexAttrib2dARB(disp, parameters) (*((disp)->VertexAttrib2dARB)) parameters -#define GET_VertexAttrib2dARB(disp) ((disp)->VertexAttrib2dARB) -#define SET_VertexAttrib2dARB(disp, fn) ((disp)->VertexAttrib2dARB = fn) -#define CALL_VertexAttrib2dvARB(disp, parameters) (*((disp)->VertexAttrib2dvARB)) parameters -#define GET_VertexAttrib2dvARB(disp) ((disp)->VertexAttrib2dvARB) -#define SET_VertexAttrib2dvARB(disp, fn) ((disp)->VertexAttrib2dvARB = fn) -#define CALL_VertexAttrib2fARB(disp, parameters) (*((disp)->VertexAttrib2fARB)) parameters -#define GET_VertexAttrib2fARB(disp) ((disp)->VertexAttrib2fARB) -#define SET_VertexAttrib2fARB(disp, fn) ((disp)->VertexAttrib2fARB = fn) -#define CALL_VertexAttrib2fvARB(disp, parameters) (*((disp)->VertexAttrib2fvARB)) parameters -#define GET_VertexAttrib2fvARB(disp) ((disp)->VertexAttrib2fvARB) -#define SET_VertexAttrib2fvARB(disp, fn) ((disp)->VertexAttrib2fvARB = fn) -#define CALL_VertexAttrib2sARB(disp, parameters) (*((disp)->VertexAttrib2sARB)) parameters -#define GET_VertexAttrib2sARB(disp) ((disp)->VertexAttrib2sARB) -#define SET_VertexAttrib2sARB(disp, fn) ((disp)->VertexAttrib2sARB = fn) -#define CALL_VertexAttrib2svARB(disp, parameters) (*((disp)->VertexAttrib2svARB)) parameters -#define GET_VertexAttrib2svARB(disp) ((disp)->VertexAttrib2svARB) -#define SET_VertexAttrib2svARB(disp, fn) ((disp)->VertexAttrib2svARB = fn) -#define CALL_VertexAttrib3dARB(disp, parameters) (*((disp)->VertexAttrib3dARB)) parameters -#define GET_VertexAttrib3dARB(disp) ((disp)->VertexAttrib3dARB) -#define SET_VertexAttrib3dARB(disp, fn) ((disp)->VertexAttrib3dARB = fn) -#define CALL_VertexAttrib3dvARB(disp, parameters) (*((disp)->VertexAttrib3dvARB)) parameters -#define GET_VertexAttrib3dvARB(disp) ((disp)->VertexAttrib3dvARB) -#define SET_VertexAttrib3dvARB(disp, fn) ((disp)->VertexAttrib3dvARB = fn) -#define CALL_VertexAttrib3fARB(disp, parameters) (*((disp)->VertexAttrib3fARB)) parameters -#define GET_VertexAttrib3fARB(disp) ((disp)->VertexAttrib3fARB) -#define SET_VertexAttrib3fARB(disp, fn) ((disp)->VertexAttrib3fARB = fn) -#define CALL_VertexAttrib3fvARB(disp, parameters) (*((disp)->VertexAttrib3fvARB)) parameters -#define GET_VertexAttrib3fvARB(disp) ((disp)->VertexAttrib3fvARB) -#define SET_VertexAttrib3fvARB(disp, fn) ((disp)->VertexAttrib3fvARB = fn) -#define CALL_VertexAttrib3sARB(disp, parameters) (*((disp)->VertexAttrib3sARB)) parameters -#define GET_VertexAttrib3sARB(disp) ((disp)->VertexAttrib3sARB) -#define SET_VertexAttrib3sARB(disp, fn) ((disp)->VertexAttrib3sARB = fn) -#define CALL_VertexAttrib3svARB(disp, parameters) (*((disp)->VertexAttrib3svARB)) parameters -#define GET_VertexAttrib3svARB(disp) ((disp)->VertexAttrib3svARB) -#define SET_VertexAttrib3svARB(disp, fn) ((disp)->VertexAttrib3svARB = fn) -#define CALL_VertexAttrib4NbvARB(disp, parameters) (*((disp)->VertexAttrib4NbvARB)) parameters -#define GET_VertexAttrib4NbvARB(disp) ((disp)->VertexAttrib4NbvARB) -#define SET_VertexAttrib4NbvARB(disp, fn) ((disp)->VertexAttrib4NbvARB = fn) -#define CALL_VertexAttrib4NivARB(disp, parameters) (*((disp)->VertexAttrib4NivARB)) parameters -#define GET_VertexAttrib4NivARB(disp) ((disp)->VertexAttrib4NivARB) -#define SET_VertexAttrib4NivARB(disp, fn) ((disp)->VertexAttrib4NivARB = fn) -#define CALL_VertexAttrib4NsvARB(disp, parameters) (*((disp)->VertexAttrib4NsvARB)) parameters -#define GET_VertexAttrib4NsvARB(disp) ((disp)->VertexAttrib4NsvARB) -#define SET_VertexAttrib4NsvARB(disp, fn) ((disp)->VertexAttrib4NsvARB = fn) -#define CALL_VertexAttrib4NubARB(disp, parameters) (*((disp)->VertexAttrib4NubARB)) parameters -#define GET_VertexAttrib4NubARB(disp) ((disp)->VertexAttrib4NubARB) -#define SET_VertexAttrib4NubARB(disp, fn) ((disp)->VertexAttrib4NubARB = fn) -#define CALL_VertexAttrib4NubvARB(disp, parameters) (*((disp)->VertexAttrib4NubvARB)) parameters -#define GET_VertexAttrib4NubvARB(disp) ((disp)->VertexAttrib4NubvARB) -#define SET_VertexAttrib4NubvARB(disp, fn) ((disp)->VertexAttrib4NubvARB = fn) -#define CALL_VertexAttrib4NuivARB(disp, parameters) (*((disp)->VertexAttrib4NuivARB)) parameters -#define GET_VertexAttrib4NuivARB(disp) ((disp)->VertexAttrib4NuivARB) -#define SET_VertexAttrib4NuivARB(disp, fn) ((disp)->VertexAttrib4NuivARB = fn) -#define CALL_VertexAttrib4NusvARB(disp, parameters) (*((disp)->VertexAttrib4NusvARB)) parameters -#define GET_VertexAttrib4NusvARB(disp) ((disp)->VertexAttrib4NusvARB) -#define SET_VertexAttrib4NusvARB(disp, fn) ((disp)->VertexAttrib4NusvARB = fn) -#define CALL_VertexAttrib4bvARB(disp, parameters) (*((disp)->VertexAttrib4bvARB)) parameters -#define GET_VertexAttrib4bvARB(disp) ((disp)->VertexAttrib4bvARB) -#define SET_VertexAttrib4bvARB(disp, fn) ((disp)->VertexAttrib4bvARB = fn) -#define CALL_VertexAttrib4dARB(disp, parameters) (*((disp)->VertexAttrib4dARB)) parameters -#define GET_VertexAttrib4dARB(disp) ((disp)->VertexAttrib4dARB) -#define SET_VertexAttrib4dARB(disp, fn) ((disp)->VertexAttrib4dARB = fn) -#define CALL_VertexAttrib4dvARB(disp, parameters) (*((disp)->VertexAttrib4dvARB)) parameters -#define GET_VertexAttrib4dvARB(disp) ((disp)->VertexAttrib4dvARB) -#define SET_VertexAttrib4dvARB(disp, fn) ((disp)->VertexAttrib4dvARB = fn) -#define CALL_VertexAttrib4fARB(disp, parameters) (*((disp)->VertexAttrib4fARB)) parameters -#define GET_VertexAttrib4fARB(disp) ((disp)->VertexAttrib4fARB) -#define SET_VertexAttrib4fARB(disp, fn) ((disp)->VertexAttrib4fARB = fn) -#define CALL_VertexAttrib4fvARB(disp, parameters) (*((disp)->VertexAttrib4fvARB)) parameters -#define GET_VertexAttrib4fvARB(disp) ((disp)->VertexAttrib4fvARB) -#define SET_VertexAttrib4fvARB(disp, fn) ((disp)->VertexAttrib4fvARB = fn) -#define CALL_VertexAttrib4ivARB(disp, parameters) (*((disp)->VertexAttrib4ivARB)) parameters -#define GET_VertexAttrib4ivARB(disp) ((disp)->VertexAttrib4ivARB) -#define SET_VertexAttrib4ivARB(disp, fn) ((disp)->VertexAttrib4ivARB = fn) -#define CALL_VertexAttrib4sARB(disp, parameters) (*((disp)->VertexAttrib4sARB)) parameters -#define GET_VertexAttrib4sARB(disp) ((disp)->VertexAttrib4sARB) -#define SET_VertexAttrib4sARB(disp, fn) ((disp)->VertexAttrib4sARB = fn) -#define CALL_VertexAttrib4svARB(disp, parameters) (*((disp)->VertexAttrib4svARB)) parameters -#define GET_VertexAttrib4svARB(disp) ((disp)->VertexAttrib4svARB) -#define SET_VertexAttrib4svARB(disp, fn) ((disp)->VertexAttrib4svARB = fn) -#define CALL_VertexAttrib4ubvARB(disp, parameters) (*((disp)->VertexAttrib4ubvARB)) parameters -#define GET_VertexAttrib4ubvARB(disp) ((disp)->VertexAttrib4ubvARB) -#define SET_VertexAttrib4ubvARB(disp, fn) ((disp)->VertexAttrib4ubvARB = fn) -#define CALL_VertexAttrib4uivARB(disp, parameters) (*((disp)->VertexAttrib4uivARB)) parameters -#define GET_VertexAttrib4uivARB(disp) ((disp)->VertexAttrib4uivARB) -#define SET_VertexAttrib4uivARB(disp, fn) ((disp)->VertexAttrib4uivARB = fn) -#define CALL_VertexAttrib4usvARB(disp, parameters) (*((disp)->VertexAttrib4usvARB)) parameters -#define GET_VertexAttrib4usvARB(disp) ((disp)->VertexAttrib4usvARB) -#define SET_VertexAttrib4usvARB(disp, fn) ((disp)->VertexAttrib4usvARB = fn) -#define CALL_VertexAttribPointerARB(disp, parameters) (*((disp)->VertexAttribPointerARB)) parameters -#define GET_VertexAttribPointerARB(disp) ((disp)->VertexAttribPointerARB) -#define SET_VertexAttribPointerARB(disp, fn) ((disp)->VertexAttribPointerARB = fn) -#define CALL_BindBufferARB(disp, parameters) (*((disp)->BindBufferARB)) parameters -#define GET_BindBufferARB(disp) ((disp)->BindBufferARB) -#define SET_BindBufferARB(disp, fn) ((disp)->BindBufferARB = fn) -#define CALL_BufferDataARB(disp, parameters) (*((disp)->BufferDataARB)) parameters -#define GET_BufferDataARB(disp) ((disp)->BufferDataARB) -#define SET_BufferDataARB(disp, fn) ((disp)->BufferDataARB = fn) -#define CALL_BufferSubDataARB(disp, parameters) (*((disp)->BufferSubDataARB)) parameters -#define GET_BufferSubDataARB(disp) ((disp)->BufferSubDataARB) -#define SET_BufferSubDataARB(disp, fn) ((disp)->BufferSubDataARB = fn) -#define CALL_DeleteBuffersARB(disp, parameters) (*((disp)->DeleteBuffersARB)) parameters -#define GET_DeleteBuffersARB(disp) ((disp)->DeleteBuffersARB) -#define SET_DeleteBuffersARB(disp, fn) ((disp)->DeleteBuffersARB = fn) -#define CALL_GenBuffersARB(disp, parameters) (*((disp)->GenBuffersARB)) parameters -#define GET_GenBuffersARB(disp) ((disp)->GenBuffersARB) -#define SET_GenBuffersARB(disp, fn) ((disp)->GenBuffersARB = fn) -#define CALL_GetBufferParameterivARB(disp, parameters) (*((disp)->GetBufferParameterivARB)) parameters -#define GET_GetBufferParameterivARB(disp) ((disp)->GetBufferParameterivARB) -#define SET_GetBufferParameterivARB(disp, fn) ((disp)->GetBufferParameterivARB = fn) -#define CALL_GetBufferPointervARB(disp, parameters) (*((disp)->GetBufferPointervARB)) parameters -#define GET_GetBufferPointervARB(disp) ((disp)->GetBufferPointervARB) -#define SET_GetBufferPointervARB(disp, fn) ((disp)->GetBufferPointervARB = fn) -#define CALL_GetBufferSubDataARB(disp, parameters) (*((disp)->GetBufferSubDataARB)) parameters -#define GET_GetBufferSubDataARB(disp) ((disp)->GetBufferSubDataARB) -#define SET_GetBufferSubDataARB(disp, fn) ((disp)->GetBufferSubDataARB = fn) -#define CALL_IsBufferARB(disp, parameters) (*((disp)->IsBufferARB)) parameters -#define GET_IsBufferARB(disp) ((disp)->IsBufferARB) -#define SET_IsBufferARB(disp, fn) ((disp)->IsBufferARB = fn) -#define CALL_MapBufferARB(disp, parameters) (*((disp)->MapBufferARB)) parameters -#define GET_MapBufferARB(disp) ((disp)->MapBufferARB) -#define SET_MapBufferARB(disp, fn) ((disp)->MapBufferARB = fn) -#define CALL_UnmapBufferARB(disp, parameters) (*((disp)->UnmapBufferARB)) parameters -#define GET_UnmapBufferARB(disp) ((disp)->UnmapBufferARB) -#define SET_UnmapBufferARB(disp, fn) ((disp)->UnmapBufferARB = fn) -#define CALL_BeginQueryARB(disp, parameters) (*((disp)->BeginQueryARB)) parameters -#define GET_BeginQueryARB(disp) ((disp)->BeginQueryARB) -#define SET_BeginQueryARB(disp, fn) ((disp)->BeginQueryARB = fn) -#define CALL_DeleteQueriesARB(disp, parameters) (*((disp)->DeleteQueriesARB)) parameters -#define GET_DeleteQueriesARB(disp) ((disp)->DeleteQueriesARB) -#define SET_DeleteQueriesARB(disp, fn) ((disp)->DeleteQueriesARB = fn) -#define CALL_EndQueryARB(disp, parameters) (*((disp)->EndQueryARB)) parameters -#define GET_EndQueryARB(disp) ((disp)->EndQueryARB) -#define SET_EndQueryARB(disp, fn) ((disp)->EndQueryARB = fn) -#define CALL_GenQueriesARB(disp, parameters) (*((disp)->GenQueriesARB)) parameters -#define GET_GenQueriesARB(disp) ((disp)->GenQueriesARB) -#define SET_GenQueriesARB(disp, fn) ((disp)->GenQueriesARB = fn) -#define CALL_GetQueryObjectivARB(disp, parameters) (*((disp)->GetQueryObjectivARB)) parameters -#define GET_GetQueryObjectivARB(disp) ((disp)->GetQueryObjectivARB) -#define SET_GetQueryObjectivARB(disp, fn) ((disp)->GetQueryObjectivARB = fn) -#define CALL_GetQueryObjectuivARB(disp, parameters) (*((disp)->GetQueryObjectuivARB)) parameters -#define GET_GetQueryObjectuivARB(disp) ((disp)->GetQueryObjectuivARB) -#define SET_GetQueryObjectuivARB(disp, fn) ((disp)->GetQueryObjectuivARB = fn) -#define CALL_GetQueryivARB(disp, parameters) (*((disp)->GetQueryivARB)) parameters -#define GET_GetQueryivARB(disp) ((disp)->GetQueryivARB) -#define SET_GetQueryivARB(disp, fn) ((disp)->GetQueryivARB = fn) -#define CALL_IsQueryARB(disp, parameters) (*((disp)->IsQueryARB)) parameters -#define GET_IsQueryARB(disp) ((disp)->IsQueryARB) -#define SET_IsQueryARB(disp, fn) ((disp)->IsQueryARB = fn) -#define CALL_AttachObjectARB(disp, parameters) (*((disp)->AttachObjectARB)) parameters -#define GET_AttachObjectARB(disp) ((disp)->AttachObjectARB) -#define SET_AttachObjectARB(disp, fn) ((disp)->AttachObjectARB = fn) -#define CALL_CompileShaderARB(disp, parameters) (*((disp)->CompileShaderARB)) parameters -#define GET_CompileShaderARB(disp) ((disp)->CompileShaderARB) -#define SET_CompileShaderARB(disp, fn) ((disp)->CompileShaderARB = fn) -#define CALL_CreateProgramObjectARB(disp, parameters) (*((disp)->CreateProgramObjectARB)) parameters -#define GET_CreateProgramObjectARB(disp) ((disp)->CreateProgramObjectARB) -#define SET_CreateProgramObjectARB(disp, fn) ((disp)->CreateProgramObjectARB = fn) -#define CALL_CreateShaderObjectARB(disp, parameters) (*((disp)->CreateShaderObjectARB)) parameters -#define GET_CreateShaderObjectARB(disp) ((disp)->CreateShaderObjectARB) -#define SET_CreateShaderObjectARB(disp, fn) ((disp)->CreateShaderObjectARB = fn) -#define CALL_DeleteObjectARB(disp, parameters) (*((disp)->DeleteObjectARB)) parameters -#define GET_DeleteObjectARB(disp) ((disp)->DeleteObjectARB) -#define SET_DeleteObjectARB(disp, fn) ((disp)->DeleteObjectARB = fn) -#define CALL_DetachObjectARB(disp, parameters) (*((disp)->DetachObjectARB)) parameters -#define GET_DetachObjectARB(disp) ((disp)->DetachObjectARB) -#define SET_DetachObjectARB(disp, fn) ((disp)->DetachObjectARB = fn) -#define CALL_GetActiveUniformARB(disp, parameters) (*((disp)->GetActiveUniformARB)) parameters -#define GET_GetActiveUniformARB(disp) ((disp)->GetActiveUniformARB) -#define SET_GetActiveUniformARB(disp, fn) ((disp)->GetActiveUniformARB = fn) -#define CALL_GetAttachedObjectsARB(disp, parameters) (*((disp)->GetAttachedObjectsARB)) parameters -#define GET_GetAttachedObjectsARB(disp) ((disp)->GetAttachedObjectsARB) -#define SET_GetAttachedObjectsARB(disp, fn) ((disp)->GetAttachedObjectsARB = fn) -#define CALL_GetHandleARB(disp, parameters) (*((disp)->GetHandleARB)) parameters -#define GET_GetHandleARB(disp) ((disp)->GetHandleARB) -#define SET_GetHandleARB(disp, fn) ((disp)->GetHandleARB = fn) -#define CALL_GetInfoLogARB(disp, parameters) (*((disp)->GetInfoLogARB)) parameters -#define GET_GetInfoLogARB(disp) ((disp)->GetInfoLogARB) -#define SET_GetInfoLogARB(disp, fn) ((disp)->GetInfoLogARB = fn) -#define CALL_GetObjectParameterfvARB(disp, parameters) (*((disp)->GetObjectParameterfvARB)) parameters -#define GET_GetObjectParameterfvARB(disp) ((disp)->GetObjectParameterfvARB) -#define SET_GetObjectParameterfvARB(disp, fn) ((disp)->GetObjectParameterfvARB = fn) -#define CALL_GetObjectParameterivARB(disp, parameters) (*((disp)->GetObjectParameterivARB)) parameters -#define GET_GetObjectParameterivARB(disp) ((disp)->GetObjectParameterivARB) -#define SET_GetObjectParameterivARB(disp, fn) ((disp)->GetObjectParameterivARB = fn) -#define CALL_GetShaderSourceARB(disp, parameters) (*((disp)->GetShaderSourceARB)) parameters -#define GET_GetShaderSourceARB(disp) ((disp)->GetShaderSourceARB) -#define SET_GetShaderSourceARB(disp, fn) ((disp)->GetShaderSourceARB = fn) -#define CALL_GetUniformLocationARB(disp, parameters) (*((disp)->GetUniformLocationARB)) parameters -#define GET_GetUniformLocationARB(disp) ((disp)->GetUniformLocationARB) -#define SET_GetUniformLocationARB(disp, fn) ((disp)->GetUniformLocationARB = fn) -#define CALL_GetUniformfvARB(disp, parameters) (*((disp)->GetUniformfvARB)) parameters -#define GET_GetUniformfvARB(disp) ((disp)->GetUniformfvARB) -#define SET_GetUniformfvARB(disp, fn) ((disp)->GetUniformfvARB = fn) -#define CALL_GetUniformivARB(disp, parameters) (*((disp)->GetUniformivARB)) parameters -#define GET_GetUniformivARB(disp) ((disp)->GetUniformivARB) -#define SET_GetUniformivARB(disp, fn) ((disp)->GetUniformivARB = fn) -#define CALL_LinkProgramARB(disp, parameters) (*((disp)->LinkProgramARB)) parameters -#define GET_LinkProgramARB(disp) ((disp)->LinkProgramARB) -#define SET_LinkProgramARB(disp, fn) ((disp)->LinkProgramARB = fn) -#define CALL_ShaderSourceARB(disp, parameters) (*((disp)->ShaderSourceARB)) parameters -#define GET_ShaderSourceARB(disp) ((disp)->ShaderSourceARB) -#define SET_ShaderSourceARB(disp, fn) ((disp)->ShaderSourceARB = fn) -#define CALL_Uniform1fARB(disp, parameters) (*((disp)->Uniform1fARB)) parameters -#define GET_Uniform1fARB(disp) ((disp)->Uniform1fARB) -#define SET_Uniform1fARB(disp, fn) ((disp)->Uniform1fARB = fn) -#define CALL_Uniform1fvARB(disp, parameters) (*((disp)->Uniform1fvARB)) parameters -#define GET_Uniform1fvARB(disp) ((disp)->Uniform1fvARB) -#define SET_Uniform1fvARB(disp, fn) ((disp)->Uniform1fvARB = fn) -#define CALL_Uniform1iARB(disp, parameters) (*((disp)->Uniform1iARB)) parameters -#define GET_Uniform1iARB(disp) ((disp)->Uniform1iARB) -#define SET_Uniform1iARB(disp, fn) ((disp)->Uniform1iARB = fn) -#define CALL_Uniform1ivARB(disp, parameters) (*((disp)->Uniform1ivARB)) parameters -#define GET_Uniform1ivARB(disp) ((disp)->Uniform1ivARB) -#define SET_Uniform1ivARB(disp, fn) ((disp)->Uniform1ivARB = fn) -#define CALL_Uniform2fARB(disp, parameters) (*((disp)->Uniform2fARB)) parameters -#define GET_Uniform2fARB(disp) ((disp)->Uniform2fARB) -#define SET_Uniform2fARB(disp, fn) ((disp)->Uniform2fARB = fn) -#define CALL_Uniform2fvARB(disp, parameters) (*((disp)->Uniform2fvARB)) parameters -#define GET_Uniform2fvARB(disp) ((disp)->Uniform2fvARB) -#define SET_Uniform2fvARB(disp, fn) ((disp)->Uniform2fvARB = fn) -#define CALL_Uniform2iARB(disp, parameters) (*((disp)->Uniform2iARB)) parameters -#define GET_Uniform2iARB(disp) ((disp)->Uniform2iARB) -#define SET_Uniform2iARB(disp, fn) ((disp)->Uniform2iARB = fn) -#define CALL_Uniform2ivARB(disp, parameters) (*((disp)->Uniform2ivARB)) parameters -#define GET_Uniform2ivARB(disp) ((disp)->Uniform2ivARB) -#define SET_Uniform2ivARB(disp, fn) ((disp)->Uniform2ivARB = fn) -#define CALL_Uniform3fARB(disp, parameters) (*((disp)->Uniform3fARB)) parameters -#define GET_Uniform3fARB(disp) ((disp)->Uniform3fARB) -#define SET_Uniform3fARB(disp, fn) ((disp)->Uniform3fARB = fn) -#define CALL_Uniform3fvARB(disp, parameters) (*((disp)->Uniform3fvARB)) parameters -#define GET_Uniform3fvARB(disp) ((disp)->Uniform3fvARB) -#define SET_Uniform3fvARB(disp, fn) ((disp)->Uniform3fvARB = fn) -#define CALL_Uniform3iARB(disp, parameters) (*((disp)->Uniform3iARB)) parameters -#define GET_Uniform3iARB(disp) ((disp)->Uniform3iARB) -#define SET_Uniform3iARB(disp, fn) ((disp)->Uniform3iARB = fn) -#define CALL_Uniform3ivARB(disp, parameters) (*((disp)->Uniform3ivARB)) parameters -#define GET_Uniform3ivARB(disp) ((disp)->Uniform3ivARB) -#define SET_Uniform3ivARB(disp, fn) ((disp)->Uniform3ivARB = fn) -#define CALL_Uniform4fARB(disp, parameters) (*((disp)->Uniform4fARB)) parameters -#define GET_Uniform4fARB(disp) ((disp)->Uniform4fARB) -#define SET_Uniform4fARB(disp, fn) ((disp)->Uniform4fARB = fn) -#define CALL_Uniform4fvARB(disp, parameters) (*((disp)->Uniform4fvARB)) parameters -#define GET_Uniform4fvARB(disp) ((disp)->Uniform4fvARB) -#define SET_Uniform4fvARB(disp, fn) ((disp)->Uniform4fvARB = fn) -#define CALL_Uniform4iARB(disp, parameters) (*((disp)->Uniform4iARB)) parameters -#define GET_Uniform4iARB(disp) ((disp)->Uniform4iARB) -#define SET_Uniform4iARB(disp, fn) ((disp)->Uniform4iARB = fn) -#define CALL_Uniform4ivARB(disp, parameters) (*((disp)->Uniform4ivARB)) parameters -#define GET_Uniform4ivARB(disp) ((disp)->Uniform4ivARB) -#define SET_Uniform4ivARB(disp, fn) ((disp)->Uniform4ivARB = fn) -#define CALL_UniformMatrix2fvARB(disp, parameters) (*((disp)->UniformMatrix2fvARB)) parameters -#define GET_UniformMatrix2fvARB(disp) ((disp)->UniformMatrix2fvARB) -#define SET_UniformMatrix2fvARB(disp, fn) ((disp)->UniformMatrix2fvARB = fn) -#define CALL_UniformMatrix3fvARB(disp, parameters) (*((disp)->UniformMatrix3fvARB)) parameters -#define GET_UniformMatrix3fvARB(disp) ((disp)->UniformMatrix3fvARB) -#define SET_UniformMatrix3fvARB(disp, fn) ((disp)->UniformMatrix3fvARB = fn) -#define CALL_UniformMatrix4fvARB(disp, parameters) (*((disp)->UniformMatrix4fvARB)) parameters -#define GET_UniformMatrix4fvARB(disp) ((disp)->UniformMatrix4fvARB) -#define SET_UniformMatrix4fvARB(disp, fn) ((disp)->UniformMatrix4fvARB = fn) -#define CALL_UseProgramObjectARB(disp, parameters) (*((disp)->UseProgramObjectARB)) parameters -#define GET_UseProgramObjectARB(disp) ((disp)->UseProgramObjectARB) -#define SET_UseProgramObjectARB(disp, fn) ((disp)->UseProgramObjectARB = fn) -#define CALL_ValidateProgramARB(disp, parameters) (*((disp)->ValidateProgramARB)) parameters -#define GET_ValidateProgramARB(disp) ((disp)->ValidateProgramARB) -#define SET_ValidateProgramARB(disp, fn) ((disp)->ValidateProgramARB = fn) -#define CALL_BindAttribLocationARB(disp, parameters) (*((disp)->BindAttribLocationARB)) parameters -#define GET_BindAttribLocationARB(disp) ((disp)->BindAttribLocationARB) -#define SET_BindAttribLocationARB(disp, fn) ((disp)->BindAttribLocationARB = fn) -#define CALL_GetActiveAttribARB(disp, parameters) (*((disp)->GetActiveAttribARB)) parameters -#define GET_GetActiveAttribARB(disp) ((disp)->GetActiveAttribARB) -#define SET_GetActiveAttribARB(disp, fn) ((disp)->GetActiveAttribARB = fn) -#define CALL_GetAttribLocationARB(disp, parameters) (*((disp)->GetAttribLocationARB)) parameters -#define GET_GetAttribLocationARB(disp) ((disp)->GetAttribLocationARB) -#define SET_GetAttribLocationARB(disp, fn) ((disp)->GetAttribLocationARB = fn) -#define CALL_DrawBuffersARB(disp, parameters) (*((disp)->DrawBuffersARB)) parameters -#define GET_DrawBuffersARB(disp) ((disp)->DrawBuffersARB) -#define SET_DrawBuffersARB(disp, fn) ((disp)->DrawBuffersARB = fn) -#define CALL_RenderbufferStorageMultisample(disp, parameters) (*((disp)->RenderbufferStorageMultisample)) parameters -#define GET_RenderbufferStorageMultisample(disp) ((disp)->RenderbufferStorageMultisample) -#define SET_RenderbufferStorageMultisample(disp, fn) ((disp)->RenderbufferStorageMultisample = fn) -#define CALL_FlushMappedBufferRange(disp, parameters) (*((disp)->FlushMappedBufferRange)) parameters -#define GET_FlushMappedBufferRange(disp) ((disp)->FlushMappedBufferRange) -#define SET_FlushMappedBufferRange(disp, fn) ((disp)->FlushMappedBufferRange = fn) -#define CALL_MapBufferRange(disp, parameters) (*((disp)->MapBufferRange)) parameters -#define GET_MapBufferRange(disp) ((disp)->MapBufferRange) -#define SET_MapBufferRange(disp, fn) ((disp)->MapBufferRange = fn) -#define CALL_BindVertexArray(disp, parameters) (*((disp)->BindVertexArray)) parameters -#define GET_BindVertexArray(disp) ((disp)->BindVertexArray) -#define SET_BindVertexArray(disp, fn) ((disp)->BindVertexArray = fn) -#define CALL_GenVertexArrays(disp, parameters) (*((disp)->GenVertexArrays)) parameters -#define GET_GenVertexArrays(disp) ((disp)->GenVertexArrays) -#define SET_GenVertexArrays(disp, fn) ((disp)->GenVertexArrays = fn) -#define CALL_CopyBufferSubData(disp, parameters) (*((disp)->CopyBufferSubData)) parameters -#define GET_CopyBufferSubData(disp) ((disp)->CopyBufferSubData) -#define SET_CopyBufferSubData(disp, fn) ((disp)->CopyBufferSubData = fn) -#define CALL_ClientWaitSync(disp, parameters) (*((disp)->ClientWaitSync)) parameters -#define GET_ClientWaitSync(disp) ((disp)->ClientWaitSync) -#define SET_ClientWaitSync(disp, fn) ((disp)->ClientWaitSync = fn) -#define CALL_DeleteSync(disp, parameters) (*((disp)->DeleteSync)) parameters -#define GET_DeleteSync(disp) ((disp)->DeleteSync) -#define SET_DeleteSync(disp, fn) ((disp)->DeleteSync = fn) -#define CALL_FenceSync(disp, parameters) (*((disp)->FenceSync)) parameters -#define GET_FenceSync(disp) ((disp)->FenceSync) -#define SET_FenceSync(disp, fn) ((disp)->FenceSync = fn) -#define CALL_GetInteger64v(disp, parameters) (*((disp)->GetInteger64v)) parameters -#define GET_GetInteger64v(disp) ((disp)->GetInteger64v) -#define SET_GetInteger64v(disp, fn) ((disp)->GetInteger64v = fn) -#define CALL_GetSynciv(disp, parameters) (*((disp)->GetSynciv)) parameters -#define GET_GetSynciv(disp) ((disp)->GetSynciv) -#define SET_GetSynciv(disp, fn) ((disp)->GetSynciv = fn) -#define CALL_IsSync(disp, parameters) (*((disp)->IsSync)) parameters -#define GET_IsSync(disp) ((disp)->IsSync) -#define SET_IsSync(disp, fn) ((disp)->IsSync = fn) -#define CALL_WaitSync(disp, parameters) (*((disp)->WaitSync)) parameters -#define GET_WaitSync(disp) ((disp)->WaitSync) -#define SET_WaitSync(disp, fn) ((disp)->WaitSync = fn) -#define CALL_DrawElementsBaseVertex(disp, parameters) (*((disp)->DrawElementsBaseVertex)) parameters -#define GET_DrawElementsBaseVertex(disp) ((disp)->DrawElementsBaseVertex) -#define SET_DrawElementsBaseVertex(disp, fn) ((disp)->DrawElementsBaseVertex = fn) -#define CALL_DrawRangeElementsBaseVertex(disp, parameters) (*((disp)->DrawRangeElementsBaseVertex)) parameters -#define GET_DrawRangeElementsBaseVertex(disp) ((disp)->DrawRangeElementsBaseVertex) -#define SET_DrawRangeElementsBaseVertex(disp, fn) ((disp)->DrawRangeElementsBaseVertex = fn) -#define CALL_MultiDrawElementsBaseVertex(disp, parameters) (*((disp)->MultiDrawElementsBaseVertex)) parameters -#define GET_MultiDrawElementsBaseVertex(disp) ((disp)->MultiDrawElementsBaseVertex) -#define SET_MultiDrawElementsBaseVertex(disp, fn) ((disp)->MultiDrawElementsBaseVertex = fn) -#define CALL_PolygonOffsetEXT(disp, parameters) (*((disp)->PolygonOffsetEXT)) parameters -#define GET_PolygonOffsetEXT(disp) ((disp)->PolygonOffsetEXT) -#define SET_PolygonOffsetEXT(disp, fn) ((disp)->PolygonOffsetEXT = fn) -#define CALL_GetPixelTexGenParameterfvSGIS(disp, parameters) (*((disp)->GetPixelTexGenParameterfvSGIS)) parameters -#define GET_GetPixelTexGenParameterfvSGIS(disp) ((disp)->GetPixelTexGenParameterfvSGIS) -#define SET_GetPixelTexGenParameterfvSGIS(disp, fn) ((disp)->GetPixelTexGenParameterfvSGIS = fn) -#define CALL_GetPixelTexGenParameterivSGIS(disp, parameters) (*((disp)->GetPixelTexGenParameterivSGIS)) parameters -#define GET_GetPixelTexGenParameterivSGIS(disp) ((disp)->GetPixelTexGenParameterivSGIS) -#define SET_GetPixelTexGenParameterivSGIS(disp, fn) ((disp)->GetPixelTexGenParameterivSGIS = fn) -#define CALL_PixelTexGenParameterfSGIS(disp, parameters) (*((disp)->PixelTexGenParameterfSGIS)) parameters -#define GET_PixelTexGenParameterfSGIS(disp) ((disp)->PixelTexGenParameterfSGIS) -#define SET_PixelTexGenParameterfSGIS(disp, fn) ((disp)->PixelTexGenParameterfSGIS = fn) -#define CALL_PixelTexGenParameterfvSGIS(disp, parameters) (*((disp)->PixelTexGenParameterfvSGIS)) parameters -#define GET_PixelTexGenParameterfvSGIS(disp) ((disp)->PixelTexGenParameterfvSGIS) -#define SET_PixelTexGenParameterfvSGIS(disp, fn) ((disp)->PixelTexGenParameterfvSGIS = fn) -#define CALL_PixelTexGenParameteriSGIS(disp, parameters) (*((disp)->PixelTexGenParameteriSGIS)) parameters -#define GET_PixelTexGenParameteriSGIS(disp) ((disp)->PixelTexGenParameteriSGIS) -#define SET_PixelTexGenParameteriSGIS(disp, fn) ((disp)->PixelTexGenParameteriSGIS = fn) -#define CALL_PixelTexGenParameterivSGIS(disp, parameters) (*((disp)->PixelTexGenParameterivSGIS)) parameters -#define GET_PixelTexGenParameterivSGIS(disp) ((disp)->PixelTexGenParameterivSGIS) -#define SET_PixelTexGenParameterivSGIS(disp, fn) ((disp)->PixelTexGenParameterivSGIS = fn) -#define CALL_SampleMaskSGIS(disp, parameters) (*((disp)->SampleMaskSGIS)) parameters -#define GET_SampleMaskSGIS(disp) ((disp)->SampleMaskSGIS) -#define SET_SampleMaskSGIS(disp, fn) ((disp)->SampleMaskSGIS = fn) -#define CALL_SamplePatternSGIS(disp, parameters) (*((disp)->SamplePatternSGIS)) parameters -#define GET_SamplePatternSGIS(disp) ((disp)->SamplePatternSGIS) -#define SET_SamplePatternSGIS(disp, fn) ((disp)->SamplePatternSGIS = fn) -#define CALL_ColorPointerEXT(disp, parameters) (*((disp)->ColorPointerEXT)) parameters -#define GET_ColorPointerEXT(disp) ((disp)->ColorPointerEXT) -#define SET_ColorPointerEXT(disp, fn) ((disp)->ColorPointerEXT = fn) -#define CALL_EdgeFlagPointerEXT(disp, parameters) (*((disp)->EdgeFlagPointerEXT)) parameters -#define GET_EdgeFlagPointerEXT(disp) ((disp)->EdgeFlagPointerEXT) -#define SET_EdgeFlagPointerEXT(disp, fn) ((disp)->EdgeFlagPointerEXT = fn) -#define CALL_IndexPointerEXT(disp, parameters) (*((disp)->IndexPointerEXT)) parameters -#define GET_IndexPointerEXT(disp) ((disp)->IndexPointerEXT) -#define SET_IndexPointerEXT(disp, fn) ((disp)->IndexPointerEXT = fn) -#define CALL_NormalPointerEXT(disp, parameters) (*((disp)->NormalPointerEXT)) parameters -#define GET_NormalPointerEXT(disp) ((disp)->NormalPointerEXT) -#define SET_NormalPointerEXT(disp, fn) ((disp)->NormalPointerEXT = fn) -#define CALL_TexCoordPointerEXT(disp, parameters) (*((disp)->TexCoordPointerEXT)) parameters -#define GET_TexCoordPointerEXT(disp) ((disp)->TexCoordPointerEXT) -#define SET_TexCoordPointerEXT(disp, fn) ((disp)->TexCoordPointerEXT = fn) -#define CALL_VertexPointerEXT(disp, parameters) (*((disp)->VertexPointerEXT)) parameters -#define GET_VertexPointerEXT(disp) ((disp)->VertexPointerEXT) -#define SET_VertexPointerEXT(disp, fn) ((disp)->VertexPointerEXT = fn) -#define CALL_PointParameterfEXT(disp, parameters) (*((disp)->PointParameterfEXT)) parameters -#define GET_PointParameterfEXT(disp) ((disp)->PointParameterfEXT) -#define SET_PointParameterfEXT(disp, fn) ((disp)->PointParameterfEXT = fn) -#define CALL_PointParameterfvEXT(disp, parameters) (*((disp)->PointParameterfvEXT)) parameters -#define GET_PointParameterfvEXT(disp) ((disp)->PointParameterfvEXT) -#define SET_PointParameterfvEXT(disp, fn) ((disp)->PointParameterfvEXT = fn) -#define CALL_LockArraysEXT(disp, parameters) (*((disp)->LockArraysEXT)) parameters -#define GET_LockArraysEXT(disp) ((disp)->LockArraysEXT) -#define SET_LockArraysEXT(disp, fn) ((disp)->LockArraysEXT = fn) -#define CALL_UnlockArraysEXT(disp, parameters) (*((disp)->UnlockArraysEXT)) parameters -#define GET_UnlockArraysEXT(disp) ((disp)->UnlockArraysEXT) -#define SET_UnlockArraysEXT(disp, fn) ((disp)->UnlockArraysEXT = fn) -#define CALL_CullParameterdvEXT(disp, parameters) (*((disp)->CullParameterdvEXT)) parameters -#define GET_CullParameterdvEXT(disp) ((disp)->CullParameterdvEXT) -#define SET_CullParameterdvEXT(disp, fn) ((disp)->CullParameterdvEXT = fn) -#define CALL_CullParameterfvEXT(disp, parameters) (*((disp)->CullParameterfvEXT)) parameters -#define GET_CullParameterfvEXT(disp) ((disp)->CullParameterfvEXT) -#define SET_CullParameterfvEXT(disp, fn) ((disp)->CullParameterfvEXT = fn) -#define CALL_SecondaryColor3bEXT(disp, parameters) (*((disp)->SecondaryColor3bEXT)) parameters -#define GET_SecondaryColor3bEXT(disp) ((disp)->SecondaryColor3bEXT) -#define SET_SecondaryColor3bEXT(disp, fn) ((disp)->SecondaryColor3bEXT = fn) -#define CALL_SecondaryColor3bvEXT(disp, parameters) (*((disp)->SecondaryColor3bvEXT)) parameters -#define GET_SecondaryColor3bvEXT(disp) ((disp)->SecondaryColor3bvEXT) -#define SET_SecondaryColor3bvEXT(disp, fn) ((disp)->SecondaryColor3bvEXT = fn) -#define CALL_SecondaryColor3dEXT(disp, parameters) (*((disp)->SecondaryColor3dEXT)) parameters -#define GET_SecondaryColor3dEXT(disp) ((disp)->SecondaryColor3dEXT) -#define SET_SecondaryColor3dEXT(disp, fn) ((disp)->SecondaryColor3dEXT = fn) -#define CALL_SecondaryColor3dvEXT(disp, parameters) (*((disp)->SecondaryColor3dvEXT)) parameters -#define GET_SecondaryColor3dvEXT(disp) ((disp)->SecondaryColor3dvEXT) -#define SET_SecondaryColor3dvEXT(disp, fn) ((disp)->SecondaryColor3dvEXT = fn) -#define CALL_SecondaryColor3fEXT(disp, parameters) (*((disp)->SecondaryColor3fEXT)) parameters -#define GET_SecondaryColor3fEXT(disp) ((disp)->SecondaryColor3fEXT) -#define SET_SecondaryColor3fEXT(disp, fn) ((disp)->SecondaryColor3fEXT = fn) -#define CALL_SecondaryColor3fvEXT(disp, parameters) (*((disp)->SecondaryColor3fvEXT)) parameters -#define GET_SecondaryColor3fvEXT(disp) ((disp)->SecondaryColor3fvEXT) -#define SET_SecondaryColor3fvEXT(disp, fn) ((disp)->SecondaryColor3fvEXT = fn) -#define CALL_SecondaryColor3iEXT(disp, parameters) (*((disp)->SecondaryColor3iEXT)) parameters -#define GET_SecondaryColor3iEXT(disp) ((disp)->SecondaryColor3iEXT) -#define SET_SecondaryColor3iEXT(disp, fn) ((disp)->SecondaryColor3iEXT = fn) -#define CALL_SecondaryColor3ivEXT(disp, parameters) (*((disp)->SecondaryColor3ivEXT)) parameters -#define GET_SecondaryColor3ivEXT(disp) ((disp)->SecondaryColor3ivEXT) -#define SET_SecondaryColor3ivEXT(disp, fn) ((disp)->SecondaryColor3ivEXT = fn) -#define CALL_SecondaryColor3sEXT(disp, parameters) (*((disp)->SecondaryColor3sEXT)) parameters -#define GET_SecondaryColor3sEXT(disp) ((disp)->SecondaryColor3sEXT) -#define SET_SecondaryColor3sEXT(disp, fn) ((disp)->SecondaryColor3sEXT = fn) -#define CALL_SecondaryColor3svEXT(disp, parameters) (*((disp)->SecondaryColor3svEXT)) parameters -#define GET_SecondaryColor3svEXT(disp) ((disp)->SecondaryColor3svEXT) -#define SET_SecondaryColor3svEXT(disp, fn) ((disp)->SecondaryColor3svEXT = fn) -#define CALL_SecondaryColor3ubEXT(disp, parameters) (*((disp)->SecondaryColor3ubEXT)) parameters -#define GET_SecondaryColor3ubEXT(disp) ((disp)->SecondaryColor3ubEXT) -#define SET_SecondaryColor3ubEXT(disp, fn) ((disp)->SecondaryColor3ubEXT = fn) -#define CALL_SecondaryColor3ubvEXT(disp, parameters) (*((disp)->SecondaryColor3ubvEXT)) parameters -#define GET_SecondaryColor3ubvEXT(disp) ((disp)->SecondaryColor3ubvEXT) -#define SET_SecondaryColor3ubvEXT(disp, fn) ((disp)->SecondaryColor3ubvEXT = fn) -#define CALL_SecondaryColor3uiEXT(disp, parameters) (*((disp)->SecondaryColor3uiEXT)) parameters -#define GET_SecondaryColor3uiEXT(disp) ((disp)->SecondaryColor3uiEXT) -#define SET_SecondaryColor3uiEXT(disp, fn) ((disp)->SecondaryColor3uiEXT = fn) -#define CALL_SecondaryColor3uivEXT(disp, parameters) (*((disp)->SecondaryColor3uivEXT)) parameters -#define GET_SecondaryColor3uivEXT(disp) ((disp)->SecondaryColor3uivEXT) -#define SET_SecondaryColor3uivEXT(disp, fn) ((disp)->SecondaryColor3uivEXT = fn) -#define CALL_SecondaryColor3usEXT(disp, parameters) (*((disp)->SecondaryColor3usEXT)) parameters -#define GET_SecondaryColor3usEXT(disp) ((disp)->SecondaryColor3usEXT) -#define SET_SecondaryColor3usEXT(disp, fn) ((disp)->SecondaryColor3usEXT = fn) -#define CALL_SecondaryColor3usvEXT(disp, parameters) (*((disp)->SecondaryColor3usvEXT)) parameters -#define GET_SecondaryColor3usvEXT(disp) ((disp)->SecondaryColor3usvEXT) -#define SET_SecondaryColor3usvEXT(disp, fn) ((disp)->SecondaryColor3usvEXT = fn) -#define CALL_SecondaryColorPointerEXT(disp, parameters) (*((disp)->SecondaryColorPointerEXT)) parameters -#define GET_SecondaryColorPointerEXT(disp) ((disp)->SecondaryColorPointerEXT) -#define SET_SecondaryColorPointerEXT(disp, fn) ((disp)->SecondaryColorPointerEXT = fn) -#define CALL_MultiDrawArraysEXT(disp, parameters) (*((disp)->MultiDrawArraysEXT)) parameters -#define GET_MultiDrawArraysEXT(disp) ((disp)->MultiDrawArraysEXT) -#define SET_MultiDrawArraysEXT(disp, fn) ((disp)->MultiDrawArraysEXT = fn) -#define CALL_MultiDrawElementsEXT(disp, parameters) (*((disp)->MultiDrawElementsEXT)) parameters -#define GET_MultiDrawElementsEXT(disp) ((disp)->MultiDrawElementsEXT) -#define SET_MultiDrawElementsEXT(disp, fn) ((disp)->MultiDrawElementsEXT = fn) -#define CALL_FogCoordPointerEXT(disp, parameters) (*((disp)->FogCoordPointerEXT)) parameters -#define GET_FogCoordPointerEXT(disp) ((disp)->FogCoordPointerEXT) -#define SET_FogCoordPointerEXT(disp, fn) ((disp)->FogCoordPointerEXT = fn) -#define CALL_FogCoorddEXT(disp, parameters) (*((disp)->FogCoorddEXT)) parameters -#define GET_FogCoorddEXT(disp) ((disp)->FogCoorddEXT) -#define SET_FogCoorddEXT(disp, fn) ((disp)->FogCoorddEXT = fn) -#define CALL_FogCoorddvEXT(disp, parameters) (*((disp)->FogCoorddvEXT)) parameters -#define GET_FogCoorddvEXT(disp) ((disp)->FogCoorddvEXT) -#define SET_FogCoorddvEXT(disp, fn) ((disp)->FogCoorddvEXT = fn) -#define CALL_FogCoordfEXT(disp, parameters) (*((disp)->FogCoordfEXT)) parameters -#define GET_FogCoordfEXT(disp) ((disp)->FogCoordfEXT) -#define SET_FogCoordfEXT(disp, fn) ((disp)->FogCoordfEXT = fn) -#define CALL_FogCoordfvEXT(disp, parameters) (*((disp)->FogCoordfvEXT)) parameters -#define GET_FogCoordfvEXT(disp) ((disp)->FogCoordfvEXT) -#define SET_FogCoordfvEXT(disp, fn) ((disp)->FogCoordfvEXT = fn) -#define CALL_PixelTexGenSGIX(disp, parameters) (*((disp)->PixelTexGenSGIX)) parameters -#define GET_PixelTexGenSGIX(disp) ((disp)->PixelTexGenSGIX) -#define SET_PixelTexGenSGIX(disp, fn) ((disp)->PixelTexGenSGIX = fn) -#define CALL_BlendFuncSeparateEXT(disp, parameters) (*((disp)->BlendFuncSeparateEXT)) parameters -#define GET_BlendFuncSeparateEXT(disp) ((disp)->BlendFuncSeparateEXT) -#define SET_BlendFuncSeparateEXT(disp, fn) ((disp)->BlendFuncSeparateEXT = fn) -#define CALL_FlushVertexArrayRangeNV(disp, parameters) (*((disp)->FlushVertexArrayRangeNV)) parameters -#define GET_FlushVertexArrayRangeNV(disp) ((disp)->FlushVertexArrayRangeNV) -#define SET_FlushVertexArrayRangeNV(disp, fn) ((disp)->FlushVertexArrayRangeNV = fn) -#define CALL_VertexArrayRangeNV(disp, parameters) (*((disp)->VertexArrayRangeNV)) parameters -#define GET_VertexArrayRangeNV(disp) ((disp)->VertexArrayRangeNV) -#define SET_VertexArrayRangeNV(disp, fn) ((disp)->VertexArrayRangeNV = fn) -#define CALL_CombinerInputNV(disp, parameters) (*((disp)->CombinerInputNV)) parameters -#define GET_CombinerInputNV(disp) ((disp)->CombinerInputNV) -#define SET_CombinerInputNV(disp, fn) ((disp)->CombinerInputNV = fn) -#define CALL_CombinerOutputNV(disp, parameters) (*((disp)->CombinerOutputNV)) parameters -#define GET_CombinerOutputNV(disp) ((disp)->CombinerOutputNV) -#define SET_CombinerOutputNV(disp, fn) ((disp)->CombinerOutputNV = fn) -#define CALL_CombinerParameterfNV(disp, parameters) (*((disp)->CombinerParameterfNV)) parameters -#define GET_CombinerParameterfNV(disp) ((disp)->CombinerParameterfNV) -#define SET_CombinerParameterfNV(disp, fn) ((disp)->CombinerParameterfNV = fn) -#define CALL_CombinerParameterfvNV(disp, parameters) (*((disp)->CombinerParameterfvNV)) parameters -#define GET_CombinerParameterfvNV(disp) ((disp)->CombinerParameterfvNV) -#define SET_CombinerParameterfvNV(disp, fn) ((disp)->CombinerParameterfvNV = fn) -#define CALL_CombinerParameteriNV(disp, parameters) (*((disp)->CombinerParameteriNV)) parameters -#define GET_CombinerParameteriNV(disp) ((disp)->CombinerParameteriNV) -#define SET_CombinerParameteriNV(disp, fn) ((disp)->CombinerParameteriNV = fn) -#define CALL_CombinerParameterivNV(disp, parameters) (*((disp)->CombinerParameterivNV)) parameters -#define GET_CombinerParameterivNV(disp) ((disp)->CombinerParameterivNV) -#define SET_CombinerParameterivNV(disp, fn) ((disp)->CombinerParameterivNV = fn) -#define CALL_FinalCombinerInputNV(disp, parameters) (*((disp)->FinalCombinerInputNV)) parameters -#define GET_FinalCombinerInputNV(disp) ((disp)->FinalCombinerInputNV) -#define SET_FinalCombinerInputNV(disp, fn) ((disp)->FinalCombinerInputNV = fn) -#define CALL_GetCombinerInputParameterfvNV(disp, parameters) (*((disp)->GetCombinerInputParameterfvNV)) parameters -#define GET_GetCombinerInputParameterfvNV(disp) ((disp)->GetCombinerInputParameterfvNV) -#define SET_GetCombinerInputParameterfvNV(disp, fn) ((disp)->GetCombinerInputParameterfvNV = fn) -#define CALL_GetCombinerInputParameterivNV(disp, parameters) (*((disp)->GetCombinerInputParameterivNV)) parameters -#define GET_GetCombinerInputParameterivNV(disp) ((disp)->GetCombinerInputParameterivNV) -#define SET_GetCombinerInputParameterivNV(disp, fn) ((disp)->GetCombinerInputParameterivNV = fn) -#define CALL_GetCombinerOutputParameterfvNV(disp, parameters) (*((disp)->GetCombinerOutputParameterfvNV)) parameters -#define GET_GetCombinerOutputParameterfvNV(disp) ((disp)->GetCombinerOutputParameterfvNV) -#define SET_GetCombinerOutputParameterfvNV(disp, fn) ((disp)->GetCombinerOutputParameterfvNV = fn) -#define CALL_GetCombinerOutputParameterivNV(disp, parameters) (*((disp)->GetCombinerOutputParameterivNV)) parameters -#define GET_GetCombinerOutputParameterivNV(disp) ((disp)->GetCombinerOutputParameterivNV) -#define SET_GetCombinerOutputParameterivNV(disp, fn) ((disp)->GetCombinerOutputParameterivNV = fn) -#define CALL_GetFinalCombinerInputParameterfvNV(disp, parameters) (*((disp)->GetFinalCombinerInputParameterfvNV)) parameters -#define GET_GetFinalCombinerInputParameterfvNV(disp) ((disp)->GetFinalCombinerInputParameterfvNV) -#define SET_GetFinalCombinerInputParameterfvNV(disp, fn) ((disp)->GetFinalCombinerInputParameterfvNV = fn) -#define CALL_GetFinalCombinerInputParameterivNV(disp, parameters) (*((disp)->GetFinalCombinerInputParameterivNV)) parameters -#define GET_GetFinalCombinerInputParameterivNV(disp) ((disp)->GetFinalCombinerInputParameterivNV) -#define SET_GetFinalCombinerInputParameterivNV(disp, fn) ((disp)->GetFinalCombinerInputParameterivNV = fn) -#define CALL_ResizeBuffersMESA(disp, parameters) (*((disp)->ResizeBuffersMESA)) parameters -#define GET_ResizeBuffersMESA(disp) ((disp)->ResizeBuffersMESA) -#define SET_ResizeBuffersMESA(disp, fn) ((disp)->ResizeBuffersMESA = fn) -#define CALL_WindowPos2dMESA(disp, parameters) (*((disp)->WindowPos2dMESA)) parameters -#define GET_WindowPos2dMESA(disp) ((disp)->WindowPos2dMESA) -#define SET_WindowPos2dMESA(disp, fn) ((disp)->WindowPos2dMESA = fn) -#define CALL_WindowPos2dvMESA(disp, parameters) (*((disp)->WindowPos2dvMESA)) parameters -#define GET_WindowPos2dvMESA(disp) ((disp)->WindowPos2dvMESA) -#define SET_WindowPos2dvMESA(disp, fn) ((disp)->WindowPos2dvMESA = fn) -#define CALL_WindowPos2fMESA(disp, parameters) (*((disp)->WindowPos2fMESA)) parameters -#define GET_WindowPos2fMESA(disp) ((disp)->WindowPos2fMESA) -#define SET_WindowPos2fMESA(disp, fn) ((disp)->WindowPos2fMESA = fn) -#define CALL_WindowPos2fvMESA(disp, parameters) (*((disp)->WindowPos2fvMESA)) parameters -#define GET_WindowPos2fvMESA(disp) ((disp)->WindowPos2fvMESA) -#define SET_WindowPos2fvMESA(disp, fn) ((disp)->WindowPos2fvMESA = fn) -#define CALL_WindowPos2iMESA(disp, parameters) (*((disp)->WindowPos2iMESA)) parameters -#define GET_WindowPos2iMESA(disp) ((disp)->WindowPos2iMESA) -#define SET_WindowPos2iMESA(disp, fn) ((disp)->WindowPos2iMESA = fn) -#define CALL_WindowPos2ivMESA(disp, parameters) (*((disp)->WindowPos2ivMESA)) parameters -#define GET_WindowPos2ivMESA(disp) ((disp)->WindowPos2ivMESA) -#define SET_WindowPos2ivMESA(disp, fn) ((disp)->WindowPos2ivMESA = fn) -#define CALL_WindowPos2sMESA(disp, parameters) (*((disp)->WindowPos2sMESA)) parameters -#define GET_WindowPos2sMESA(disp) ((disp)->WindowPos2sMESA) -#define SET_WindowPos2sMESA(disp, fn) ((disp)->WindowPos2sMESA = fn) -#define CALL_WindowPos2svMESA(disp, parameters) (*((disp)->WindowPos2svMESA)) parameters -#define GET_WindowPos2svMESA(disp) ((disp)->WindowPos2svMESA) -#define SET_WindowPos2svMESA(disp, fn) ((disp)->WindowPos2svMESA = fn) -#define CALL_WindowPos3dMESA(disp, parameters) (*((disp)->WindowPos3dMESA)) parameters -#define GET_WindowPos3dMESA(disp) ((disp)->WindowPos3dMESA) -#define SET_WindowPos3dMESA(disp, fn) ((disp)->WindowPos3dMESA = fn) -#define CALL_WindowPos3dvMESA(disp, parameters) (*((disp)->WindowPos3dvMESA)) parameters -#define GET_WindowPos3dvMESA(disp) ((disp)->WindowPos3dvMESA) -#define SET_WindowPos3dvMESA(disp, fn) ((disp)->WindowPos3dvMESA = fn) -#define CALL_WindowPos3fMESA(disp, parameters) (*((disp)->WindowPos3fMESA)) parameters -#define GET_WindowPos3fMESA(disp) ((disp)->WindowPos3fMESA) -#define SET_WindowPos3fMESA(disp, fn) ((disp)->WindowPos3fMESA = fn) -#define CALL_WindowPos3fvMESA(disp, parameters) (*((disp)->WindowPos3fvMESA)) parameters -#define GET_WindowPos3fvMESA(disp) ((disp)->WindowPos3fvMESA) -#define SET_WindowPos3fvMESA(disp, fn) ((disp)->WindowPos3fvMESA = fn) -#define CALL_WindowPos3iMESA(disp, parameters) (*((disp)->WindowPos3iMESA)) parameters -#define GET_WindowPos3iMESA(disp) ((disp)->WindowPos3iMESA) -#define SET_WindowPos3iMESA(disp, fn) ((disp)->WindowPos3iMESA = fn) -#define CALL_WindowPos3ivMESA(disp, parameters) (*((disp)->WindowPos3ivMESA)) parameters -#define GET_WindowPos3ivMESA(disp) ((disp)->WindowPos3ivMESA) -#define SET_WindowPos3ivMESA(disp, fn) ((disp)->WindowPos3ivMESA = fn) -#define CALL_WindowPos3sMESA(disp, parameters) (*((disp)->WindowPos3sMESA)) parameters -#define GET_WindowPos3sMESA(disp) ((disp)->WindowPos3sMESA) -#define SET_WindowPos3sMESA(disp, fn) ((disp)->WindowPos3sMESA = fn) -#define CALL_WindowPos3svMESA(disp, parameters) (*((disp)->WindowPos3svMESA)) parameters -#define GET_WindowPos3svMESA(disp) ((disp)->WindowPos3svMESA) -#define SET_WindowPos3svMESA(disp, fn) ((disp)->WindowPos3svMESA = fn) -#define CALL_WindowPos4dMESA(disp, parameters) (*((disp)->WindowPos4dMESA)) parameters -#define GET_WindowPos4dMESA(disp) ((disp)->WindowPos4dMESA) -#define SET_WindowPos4dMESA(disp, fn) ((disp)->WindowPos4dMESA = fn) -#define CALL_WindowPos4dvMESA(disp, parameters) (*((disp)->WindowPos4dvMESA)) parameters -#define GET_WindowPos4dvMESA(disp) ((disp)->WindowPos4dvMESA) -#define SET_WindowPos4dvMESA(disp, fn) ((disp)->WindowPos4dvMESA = fn) -#define CALL_WindowPos4fMESA(disp, parameters) (*((disp)->WindowPos4fMESA)) parameters -#define GET_WindowPos4fMESA(disp) ((disp)->WindowPos4fMESA) -#define SET_WindowPos4fMESA(disp, fn) ((disp)->WindowPos4fMESA = fn) -#define CALL_WindowPos4fvMESA(disp, parameters) (*((disp)->WindowPos4fvMESA)) parameters -#define GET_WindowPos4fvMESA(disp) ((disp)->WindowPos4fvMESA) -#define SET_WindowPos4fvMESA(disp, fn) ((disp)->WindowPos4fvMESA = fn) -#define CALL_WindowPos4iMESA(disp, parameters) (*((disp)->WindowPos4iMESA)) parameters -#define GET_WindowPos4iMESA(disp) ((disp)->WindowPos4iMESA) -#define SET_WindowPos4iMESA(disp, fn) ((disp)->WindowPos4iMESA = fn) -#define CALL_WindowPos4ivMESA(disp, parameters) (*((disp)->WindowPos4ivMESA)) parameters -#define GET_WindowPos4ivMESA(disp) ((disp)->WindowPos4ivMESA) -#define SET_WindowPos4ivMESA(disp, fn) ((disp)->WindowPos4ivMESA = fn) -#define CALL_WindowPos4sMESA(disp, parameters) (*((disp)->WindowPos4sMESA)) parameters -#define GET_WindowPos4sMESA(disp) ((disp)->WindowPos4sMESA) -#define SET_WindowPos4sMESA(disp, fn) ((disp)->WindowPos4sMESA = fn) -#define CALL_WindowPos4svMESA(disp, parameters) (*((disp)->WindowPos4svMESA)) parameters -#define GET_WindowPos4svMESA(disp) ((disp)->WindowPos4svMESA) -#define SET_WindowPos4svMESA(disp, fn) ((disp)->WindowPos4svMESA = fn) -#define CALL_MultiModeDrawArraysIBM(disp, parameters) (*((disp)->MultiModeDrawArraysIBM)) parameters -#define GET_MultiModeDrawArraysIBM(disp) ((disp)->MultiModeDrawArraysIBM) -#define SET_MultiModeDrawArraysIBM(disp, fn) ((disp)->MultiModeDrawArraysIBM = fn) -#define CALL_MultiModeDrawElementsIBM(disp, parameters) (*((disp)->MultiModeDrawElementsIBM)) parameters -#define GET_MultiModeDrawElementsIBM(disp) ((disp)->MultiModeDrawElementsIBM) -#define SET_MultiModeDrawElementsIBM(disp, fn) ((disp)->MultiModeDrawElementsIBM = fn) -#define CALL_DeleteFencesNV(disp, parameters) (*((disp)->DeleteFencesNV)) parameters -#define GET_DeleteFencesNV(disp) ((disp)->DeleteFencesNV) -#define SET_DeleteFencesNV(disp, fn) ((disp)->DeleteFencesNV = fn) -#define CALL_FinishFenceNV(disp, parameters) (*((disp)->FinishFenceNV)) parameters -#define GET_FinishFenceNV(disp) ((disp)->FinishFenceNV) -#define SET_FinishFenceNV(disp, fn) ((disp)->FinishFenceNV = fn) -#define CALL_GenFencesNV(disp, parameters) (*((disp)->GenFencesNV)) parameters -#define GET_GenFencesNV(disp) ((disp)->GenFencesNV) -#define SET_GenFencesNV(disp, fn) ((disp)->GenFencesNV = fn) -#define CALL_GetFenceivNV(disp, parameters) (*((disp)->GetFenceivNV)) parameters -#define GET_GetFenceivNV(disp) ((disp)->GetFenceivNV) -#define SET_GetFenceivNV(disp, fn) ((disp)->GetFenceivNV = fn) -#define CALL_IsFenceNV(disp, parameters) (*((disp)->IsFenceNV)) parameters -#define GET_IsFenceNV(disp) ((disp)->IsFenceNV) -#define SET_IsFenceNV(disp, fn) ((disp)->IsFenceNV = fn) -#define CALL_SetFenceNV(disp, parameters) (*((disp)->SetFenceNV)) parameters -#define GET_SetFenceNV(disp) ((disp)->SetFenceNV) -#define SET_SetFenceNV(disp, fn) ((disp)->SetFenceNV = fn) -#define CALL_TestFenceNV(disp, parameters) (*((disp)->TestFenceNV)) parameters -#define GET_TestFenceNV(disp) ((disp)->TestFenceNV) -#define SET_TestFenceNV(disp, fn) ((disp)->TestFenceNV = fn) -#define CALL_AreProgramsResidentNV(disp, parameters) (*((disp)->AreProgramsResidentNV)) parameters -#define GET_AreProgramsResidentNV(disp) ((disp)->AreProgramsResidentNV) -#define SET_AreProgramsResidentNV(disp, fn) ((disp)->AreProgramsResidentNV = fn) -#define CALL_BindProgramNV(disp, parameters) (*((disp)->BindProgramNV)) parameters -#define GET_BindProgramNV(disp) ((disp)->BindProgramNV) -#define SET_BindProgramNV(disp, fn) ((disp)->BindProgramNV = fn) -#define CALL_DeleteProgramsNV(disp, parameters) (*((disp)->DeleteProgramsNV)) parameters -#define GET_DeleteProgramsNV(disp) ((disp)->DeleteProgramsNV) -#define SET_DeleteProgramsNV(disp, fn) ((disp)->DeleteProgramsNV = fn) -#define CALL_ExecuteProgramNV(disp, parameters) (*((disp)->ExecuteProgramNV)) parameters -#define GET_ExecuteProgramNV(disp) ((disp)->ExecuteProgramNV) -#define SET_ExecuteProgramNV(disp, fn) ((disp)->ExecuteProgramNV = fn) -#define CALL_GenProgramsNV(disp, parameters) (*((disp)->GenProgramsNV)) parameters -#define GET_GenProgramsNV(disp) ((disp)->GenProgramsNV) -#define SET_GenProgramsNV(disp, fn) ((disp)->GenProgramsNV = fn) -#define CALL_GetProgramParameterdvNV(disp, parameters) (*((disp)->GetProgramParameterdvNV)) parameters -#define GET_GetProgramParameterdvNV(disp) ((disp)->GetProgramParameterdvNV) -#define SET_GetProgramParameterdvNV(disp, fn) ((disp)->GetProgramParameterdvNV = fn) -#define CALL_GetProgramParameterfvNV(disp, parameters) (*((disp)->GetProgramParameterfvNV)) parameters -#define GET_GetProgramParameterfvNV(disp) ((disp)->GetProgramParameterfvNV) -#define SET_GetProgramParameterfvNV(disp, fn) ((disp)->GetProgramParameterfvNV = fn) -#define CALL_GetProgramStringNV(disp, parameters) (*((disp)->GetProgramStringNV)) parameters -#define GET_GetProgramStringNV(disp) ((disp)->GetProgramStringNV) -#define SET_GetProgramStringNV(disp, fn) ((disp)->GetProgramStringNV = fn) -#define CALL_GetProgramivNV(disp, parameters) (*((disp)->GetProgramivNV)) parameters -#define GET_GetProgramivNV(disp) ((disp)->GetProgramivNV) -#define SET_GetProgramivNV(disp, fn) ((disp)->GetProgramivNV = fn) -#define CALL_GetTrackMatrixivNV(disp, parameters) (*((disp)->GetTrackMatrixivNV)) parameters -#define GET_GetTrackMatrixivNV(disp) ((disp)->GetTrackMatrixivNV) -#define SET_GetTrackMatrixivNV(disp, fn) ((disp)->GetTrackMatrixivNV = fn) -#define CALL_GetVertexAttribPointervNV(disp, parameters) (*((disp)->GetVertexAttribPointervNV)) parameters -#define GET_GetVertexAttribPointervNV(disp) ((disp)->GetVertexAttribPointervNV) -#define SET_GetVertexAttribPointervNV(disp, fn) ((disp)->GetVertexAttribPointervNV = fn) -#define CALL_GetVertexAttribdvNV(disp, parameters) (*((disp)->GetVertexAttribdvNV)) parameters -#define GET_GetVertexAttribdvNV(disp) ((disp)->GetVertexAttribdvNV) -#define SET_GetVertexAttribdvNV(disp, fn) ((disp)->GetVertexAttribdvNV = fn) -#define CALL_GetVertexAttribfvNV(disp, parameters) (*((disp)->GetVertexAttribfvNV)) parameters -#define GET_GetVertexAttribfvNV(disp) ((disp)->GetVertexAttribfvNV) -#define SET_GetVertexAttribfvNV(disp, fn) ((disp)->GetVertexAttribfvNV = fn) -#define CALL_GetVertexAttribivNV(disp, parameters) (*((disp)->GetVertexAttribivNV)) parameters -#define GET_GetVertexAttribivNV(disp) ((disp)->GetVertexAttribivNV) -#define SET_GetVertexAttribivNV(disp, fn) ((disp)->GetVertexAttribivNV = fn) -#define CALL_IsProgramNV(disp, parameters) (*((disp)->IsProgramNV)) parameters -#define GET_IsProgramNV(disp) ((disp)->IsProgramNV) -#define SET_IsProgramNV(disp, fn) ((disp)->IsProgramNV = fn) -#define CALL_LoadProgramNV(disp, parameters) (*((disp)->LoadProgramNV)) parameters -#define GET_LoadProgramNV(disp) ((disp)->LoadProgramNV) -#define SET_LoadProgramNV(disp, fn) ((disp)->LoadProgramNV = fn) -#define CALL_ProgramParameters4dvNV(disp, parameters) (*((disp)->ProgramParameters4dvNV)) parameters -#define GET_ProgramParameters4dvNV(disp) ((disp)->ProgramParameters4dvNV) -#define SET_ProgramParameters4dvNV(disp, fn) ((disp)->ProgramParameters4dvNV = fn) -#define CALL_ProgramParameters4fvNV(disp, parameters) (*((disp)->ProgramParameters4fvNV)) parameters -#define GET_ProgramParameters4fvNV(disp) ((disp)->ProgramParameters4fvNV) -#define SET_ProgramParameters4fvNV(disp, fn) ((disp)->ProgramParameters4fvNV = fn) -#define CALL_RequestResidentProgramsNV(disp, parameters) (*((disp)->RequestResidentProgramsNV)) parameters -#define GET_RequestResidentProgramsNV(disp) ((disp)->RequestResidentProgramsNV) -#define SET_RequestResidentProgramsNV(disp, fn) ((disp)->RequestResidentProgramsNV = fn) -#define CALL_TrackMatrixNV(disp, parameters) (*((disp)->TrackMatrixNV)) parameters -#define GET_TrackMatrixNV(disp) ((disp)->TrackMatrixNV) -#define SET_TrackMatrixNV(disp, fn) ((disp)->TrackMatrixNV = fn) -#define CALL_VertexAttrib1dNV(disp, parameters) (*((disp)->VertexAttrib1dNV)) parameters -#define GET_VertexAttrib1dNV(disp) ((disp)->VertexAttrib1dNV) -#define SET_VertexAttrib1dNV(disp, fn) ((disp)->VertexAttrib1dNV = fn) -#define CALL_VertexAttrib1dvNV(disp, parameters) (*((disp)->VertexAttrib1dvNV)) parameters -#define GET_VertexAttrib1dvNV(disp) ((disp)->VertexAttrib1dvNV) -#define SET_VertexAttrib1dvNV(disp, fn) ((disp)->VertexAttrib1dvNV = fn) -#define CALL_VertexAttrib1fNV(disp, parameters) (*((disp)->VertexAttrib1fNV)) parameters -#define GET_VertexAttrib1fNV(disp) ((disp)->VertexAttrib1fNV) -#define SET_VertexAttrib1fNV(disp, fn) ((disp)->VertexAttrib1fNV = fn) -#define CALL_VertexAttrib1fvNV(disp, parameters) (*((disp)->VertexAttrib1fvNV)) parameters -#define GET_VertexAttrib1fvNV(disp) ((disp)->VertexAttrib1fvNV) -#define SET_VertexAttrib1fvNV(disp, fn) ((disp)->VertexAttrib1fvNV = fn) -#define CALL_VertexAttrib1sNV(disp, parameters) (*((disp)->VertexAttrib1sNV)) parameters -#define GET_VertexAttrib1sNV(disp) ((disp)->VertexAttrib1sNV) -#define SET_VertexAttrib1sNV(disp, fn) ((disp)->VertexAttrib1sNV = fn) -#define CALL_VertexAttrib1svNV(disp, parameters) (*((disp)->VertexAttrib1svNV)) parameters -#define GET_VertexAttrib1svNV(disp) ((disp)->VertexAttrib1svNV) -#define SET_VertexAttrib1svNV(disp, fn) ((disp)->VertexAttrib1svNV = fn) -#define CALL_VertexAttrib2dNV(disp, parameters) (*((disp)->VertexAttrib2dNV)) parameters -#define GET_VertexAttrib2dNV(disp) ((disp)->VertexAttrib2dNV) -#define SET_VertexAttrib2dNV(disp, fn) ((disp)->VertexAttrib2dNV = fn) -#define CALL_VertexAttrib2dvNV(disp, parameters) (*((disp)->VertexAttrib2dvNV)) parameters -#define GET_VertexAttrib2dvNV(disp) ((disp)->VertexAttrib2dvNV) -#define SET_VertexAttrib2dvNV(disp, fn) ((disp)->VertexAttrib2dvNV = fn) -#define CALL_VertexAttrib2fNV(disp, parameters) (*((disp)->VertexAttrib2fNV)) parameters -#define GET_VertexAttrib2fNV(disp) ((disp)->VertexAttrib2fNV) -#define SET_VertexAttrib2fNV(disp, fn) ((disp)->VertexAttrib2fNV = fn) -#define CALL_VertexAttrib2fvNV(disp, parameters) (*((disp)->VertexAttrib2fvNV)) parameters -#define GET_VertexAttrib2fvNV(disp) ((disp)->VertexAttrib2fvNV) -#define SET_VertexAttrib2fvNV(disp, fn) ((disp)->VertexAttrib2fvNV = fn) -#define CALL_VertexAttrib2sNV(disp, parameters) (*((disp)->VertexAttrib2sNV)) parameters -#define GET_VertexAttrib2sNV(disp) ((disp)->VertexAttrib2sNV) -#define SET_VertexAttrib2sNV(disp, fn) ((disp)->VertexAttrib2sNV = fn) -#define CALL_VertexAttrib2svNV(disp, parameters) (*((disp)->VertexAttrib2svNV)) parameters -#define GET_VertexAttrib2svNV(disp) ((disp)->VertexAttrib2svNV) -#define SET_VertexAttrib2svNV(disp, fn) ((disp)->VertexAttrib2svNV = fn) -#define CALL_VertexAttrib3dNV(disp, parameters) (*((disp)->VertexAttrib3dNV)) parameters -#define GET_VertexAttrib3dNV(disp) ((disp)->VertexAttrib3dNV) -#define SET_VertexAttrib3dNV(disp, fn) ((disp)->VertexAttrib3dNV = fn) -#define CALL_VertexAttrib3dvNV(disp, parameters) (*((disp)->VertexAttrib3dvNV)) parameters -#define GET_VertexAttrib3dvNV(disp) ((disp)->VertexAttrib3dvNV) -#define SET_VertexAttrib3dvNV(disp, fn) ((disp)->VertexAttrib3dvNV = fn) -#define CALL_VertexAttrib3fNV(disp, parameters) (*((disp)->VertexAttrib3fNV)) parameters -#define GET_VertexAttrib3fNV(disp) ((disp)->VertexAttrib3fNV) -#define SET_VertexAttrib3fNV(disp, fn) ((disp)->VertexAttrib3fNV = fn) -#define CALL_VertexAttrib3fvNV(disp, parameters) (*((disp)->VertexAttrib3fvNV)) parameters -#define GET_VertexAttrib3fvNV(disp) ((disp)->VertexAttrib3fvNV) -#define SET_VertexAttrib3fvNV(disp, fn) ((disp)->VertexAttrib3fvNV = fn) -#define CALL_VertexAttrib3sNV(disp, parameters) (*((disp)->VertexAttrib3sNV)) parameters -#define GET_VertexAttrib3sNV(disp) ((disp)->VertexAttrib3sNV) -#define SET_VertexAttrib3sNV(disp, fn) ((disp)->VertexAttrib3sNV = fn) -#define CALL_VertexAttrib3svNV(disp, parameters) (*((disp)->VertexAttrib3svNV)) parameters -#define GET_VertexAttrib3svNV(disp) ((disp)->VertexAttrib3svNV) -#define SET_VertexAttrib3svNV(disp, fn) ((disp)->VertexAttrib3svNV = fn) -#define CALL_VertexAttrib4dNV(disp, parameters) (*((disp)->VertexAttrib4dNV)) parameters -#define GET_VertexAttrib4dNV(disp) ((disp)->VertexAttrib4dNV) -#define SET_VertexAttrib4dNV(disp, fn) ((disp)->VertexAttrib4dNV = fn) -#define CALL_VertexAttrib4dvNV(disp, parameters) (*((disp)->VertexAttrib4dvNV)) parameters -#define GET_VertexAttrib4dvNV(disp) ((disp)->VertexAttrib4dvNV) -#define SET_VertexAttrib4dvNV(disp, fn) ((disp)->VertexAttrib4dvNV = fn) -#define CALL_VertexAttrib4fNV(disp, parameters) (*((disp)->VertexAttrib4fNV)) parameters -#define GET_VertexAttrib4fNV(disp) ((disp)->VertexAttrib4fNV) -#define SET_VertexAttrib4fNV(disp, fn) ((disp)->VertexAttrib4fNV = fn) -#define CALL_VertexAttrib4fvNV(disp, parameters) (*((disp)->VertexAttrib4fvNV)) parameters -#define GET_VertexAttrib4fvNV(disp) ((disp)->VertexAttrib4fvNV) -#define SET_VertexAttrib4fvNV(disp, fn) ((disp)->VertexAttrib4fvNV = fn) -#define CALL_VertexAttrib4sNV(disp, parameters) (*((disp)->VertexAttrib4sNV)) parameters -#define GET_VertexAttrib4sNV(disp) ((disp)->VertexAttrib4sNV) -#define SET_VertexAttrib4sNV(disp, fn) ((disp)->VertexAttrib4sNV = fn) -#define CALL_VertexAttrib4svNV(disp, parameters) (*((disp)->VertexAttrib4svNV)) parameters -#define GET_VertexAttrib4svNV(disp) ((disp)->VertexAttrib4svNV) -#define SET_VertexAttrib4svNV(disp, fn) ((disp)->VertexAttrib4svNV = fn) -#define CALL_VertexAttrib4ubNV(disp, parameters) (*((disp)->VertexAttrib4ubNV)) parameters -#define GET_VertexAttrib4ubNV(disp) ((disp)->VertexAttrib4ubNV) -#define SET_VertexAttrib4ubNV(disp, fn) ((disp)->VertexAttrib4ubNV = fn) -#define CALL_VertexAttrib4ubvNV(disp, parameters) (*((disp)->VertexAttrib4ubvNV)) parameters -#define GET_VertexAttrib4ubvNV(disp) ((disp)->VertexAttrib4ubvNV) -#define SET_VertexAttrib4ubvNV(disp, fn) ((disp)->VertexAttrib4ubvNV = fn) -#define CALL_VertexAttribPointerNV(disp, parameters) (*((disp)->VertexAttribPointerNV)) parameters -#define GET_VertexAttribPointerNV(disp) ((disp)->VertexAttribPointerNV) -#define SET_VertexAttribPointerNV(disp, fn) ((disp)->VertexAttribPointerNV = fn) -#define CALL_VertexAttribs1dvNV(disp, parameters) (*((disp)->VertexAttribs1dvNV)) parameters -#define GET_VertexAttribs1dvNV(disp) ((disp)->VertexAttribs1dvNV) -#define SET_VertexAttribs1dvNV(disp, fn) ((disp)->VertexAttribs1dvNV = fn) -#define CALL_VertexAttribs1fvNV(disp, parameters) (*((disp)->VertexAttribs1fvNV)) parameters -#define GET_VertexAttribs1fvNV(disp) ((disp)->VertexAttribs1fvNV) -#define SET_VertexAttribs1fvNV(disp, fn) ((disp)->VertexAttribs1fvNV = fn) -#define CALL_VertexAttribs1svNV(disp, parameters) (*((disp)->VertexAttribs1svNV)) parameters -#define GET_VertexAttribs1svNV(disp) ((disp)->VertexAttribs1svNV) -#define SET_VertexAttribs1svNV(disp, fn) ((disp)->VertexAttribs1svNV = fn) -#define CALL_VertexAttribs2dvNV(disp, parameters) (*((disp)->VertexAttribs2dvNV)) parameters -#define GET_VertexAttribs2dvNV(disp) ((disp)->VertexAttribs2dvNV) -#define SET_VertexAttribs2dvNV(disp, fn) ((disp)->VertexAttribs2dvNV = fn) -#define CALL_VertexAttribs2fvNV(disp, parameters) (*((disp)->VertexAttribs2fvNV)) parameters -#define GET_VertexAttribs2fvNV(disp) ((disp)->VertexAttribs2fvNV) -#define SET_VertexAttribs2fvNV(disp, fn) ((disp)->VertexAttribs2fvNV = fn) -#define CALL_VertexAttribs2svNV(disp, parameters) (*((disp)->VertexAttribs2svNV)) parameters -#define GET_VertexAttribs2svNV(disp) ((disp)->VertexAttribs2svNV) -#define SET_VertexAttribs2svNV(disp, fn) ((disp)->VertexAttribs2svNV = fn) -#define CALL_VertexAttribs3dvNV(disp, parameters) (*((disp)->VertexAttribs3dvNV)) parameters -#define GET_VertexAttribs3dvNV(disp) ((disp)->VertexAttribs3dvNV) -#define SET_VertexAttribs3dvNV(disp, fn) ((disp)->VertexAttribs3dvNV = fn) -#define CALL_VertexAttribs3fvNV(disp, parameters) (*((disp)->VertexAttribs3fvNV)) parameters -#define GET_VertexAttribs3fvNV(disp) ((disp)->VertexAttribs3fvNV) -#define SET_VertexAttribs3fvNV(disp, fn) ((disp)->VertexAttribs3fvNV = fn) -#define CALL_VertexAttribs3svNV(disp, parameters) (*((disp)->VertexAttribs3svNV)) parameters -#define GET_VertexAttribs3svNV(disp) ((disp)->VertexAttribs3svNV) -#define SET_VertexAttribs3svNV(disp, fn) ((disp)->VertexAttribs3svNV = fn) -#define CALL_VertexAttribs4dvNV(disp, parameters) (*((disp)->VertexAttribs4dvNV)) parameters -#define GET_VertexAttribs4dvNV(disp) ((disp)->VertexAttribs4dvNV) -#define SET_VertexAttribs4dvNV(disp, fn) ((disp)->VertexAttribs4dvNV = fn) -#define CALL_VertexAttribs4fvNV(disp, parameters) (*((disp)->VertexAttribs4fvNV)) parameters -#define GET_VertexAttribs4fvNV(disp) ((disp)->VertexAttribs4fvNV) -#define SET_VertexAttribs4fvNV(disp, fn) ((disp)->VertexAttribs4fvNV = fn) -#define CALL_VertexAttribs4svNV(disp, parameters) (*((disp)->VertexAttribs4svNV)) parameters -#define GET_VertexAttribs4svNV(disp) ((disp)->VertexAttribs4svNV) -#define SET_VertexAttribs4svNV(disp, fn) ((disp)->VertexAttribs4svNV = fn) -#define CALL_VertexAttribs4ubvNV(disp, parameters) (*((disp)->VertexAttribs4ubvNV)) parameters -#define GET_VertexAttribs4ubvNV(disp) ((disp)->VertexAttribs4ubvNV) -#define SET_VertexAttribs4ubvNV(disp, fn) ((disp)->VertexAttribs4ubvNV = fn) -#define CALL_GetTexBumpParameterfvATI(disp, parameters) (*((disp)->GetTexBumpParameterfvATI)) parameters -#define GET_GetTexBumpParameterfvATI(disp) ((disp)->GetTexBumpParameterfvATI) -#define SET_GetTexBumpParameterfvATI(disp, fn) ((disp)->GetTexBumpParameterfvATI = fn) -#define CALL_GetTexBumpParameterivATI(disp, parameters) (*((disp)->GetTexBumpParameterivATI)) parameters -#define GET_GetTexBumpParameterivATI(disp) ((disp)->GetTexBumpParameterivATI) -#define SET_GetTexBumpParameterivATI(disp, fn) ((disp)->GetTexBumpParameterivATI = fn) -#define CALL_TexBumpParameterfvATI(disp, parameters) (*((disp)->TexBumpParameterfvATI)) parameters -#define GET_TexBumpParameterfvATI(disp) ((disp)->TexBumpParameterfvATI) -#define SET_TexBumpParameterfvATI(disp, fn) ((disp)->TexBumpParameterfvATI = fn) -#define CALL_TexBumpParameterivATI(disp, parameters) (*((disp)->TexBumpParameterivATI)) parameters -#define GET_TexBumpParameterivATI(disp) ((disp)->TexBumpParameterivATI) -#define SET_TexBumpParameterivATI(disp, fn) ((disp)->TexBumpParameterivATI = fn) -#define CALL_AlphaFragmentOp1ATI(disp, parameters) (*((disp)->AlphaFragmentOp1ATI)) parameters -#define GET_AlphaFragmentOp1ATI(disp) ((disp)->AlphaFragmentOp1ATI) -#define SET_AlphaFragmentOp1ATI(disp, fn) ((disp)->AlphaFragmentOp1ATI = fn) -#define CALL_AlphaFragmentOp2ATI(disp, parameters) (*((disp)->AlphaFragmentOp2ATI)) parameters -#define GET_AlphaFragmentOp2ATI(disp) ((disp)->AlphaFragmentOp2ATI) -#define SET_AlphaFragmentOp2ATI(disp, fn) ((disp)->AlphaFragmentOp2ATI = fn) -#define CALL_AlphaFragmentOp3ATI(disp, parameters) (*((disp)->AlphaFragmentOp3ATI)) parameters -#define GET_AlphaFragmentOp3ATI(disp) ((disp)->AlphaFragmentOp3ATI) -#define SET_AlphaFragmentOp3ATI(disp, fn) ((disp)->AlphaFragmentOp3ATI = fn) -#define CALL_BeginFragmentShaderATI(disp, parameters) (*((disp)->BeginFragmentShaderATI)) parameters -#define GET_BeginFragmentShaderATI(disp) ((disp)->BeginFragmentShaderATI) -#define SET_BeginFragmentShaderATI(disp, fn) ((disp)->BeginFragmentShaderATI = fn) -#define CALL_BindFragmentShaderATI(disp, parameters) (*((disp)->BindFragmentShaderATI)) parameters -#define GET_BindFragmentShaderATI(disp) ((disp)->BindFragmentShaderATI) -#define SET_BindFragmentShaderATI(disp, fn) ((disp)->BindFragmentShaderATI = fn) -#define CALL_ColorFragmentOp1ATI(disp, parameters) (*((disp)->ColorFragmentOp1ATI)) parameters -#define GET_ColorFragmentOp1ATI(disp) ((disp)->ColorFragmentOp1ATI) -#define SET_ColorFragmentOp1ATI(disp, fn) ((disp)->ColorFragmentOp1ATI = fn) -#define CALL_ColorFragmentOp2ATI(disp, parameters) (*((disp)->ColorFragmentOp2ATI)) parameters -#define GET_ColorFragmentOp2ATI(disp) ((disp)->ColorFragmentOp2ATI) -#define SET_ColorFragmentOp2ATI(disp, fn) ((disp)->ColorFragmentOp2ATI = fn) -#define CALL_ColorFragmentOp3ATI(disp, parameters) (*((disp)->ColorFragmentOp3ATI)) parameters -#define GET_ColorFragmentOp3ATI(disp) ((disp)->ColorFragmentOp3ATI) -#define SET_ColorFragmentOp3ATI(disp, fn) ((disp)->ColorFragmentOp3ATI = fn) -#define CALL_DeleteFragmentShaderATI(disp, parameters) (*((disp)->DeleteFragmentShaderATI)) parameters -#define GET_DeleteFragmentShaderATI(disp) ((disp)->DeleteFragmentShaderATI) -#define SET_DeleteFragmentShaderATI(disp, fn) ((disp)->DeleteFragmentShaderATI = fn) -#define CALL_EndFragmentShaderATI(disp, parameters) (*((disp)->EndFragmentShaderATI)) parameters -#define GET_EndFragmentShaderATI(disp) ((disp)->EndFragmentShaderATI) -#define SET_EndFragmentShaderATI(disp, fn) ((disp)->EndFragmentShaderATI = fn) -#define CALL_GenFragmentShadersATI(disp, parameters) (*((disp)->GenFragmentShadersATI)) parameters -#define GET_GenFragmentShadersATI(disp) ((disp)->GenFragmentShadersATI) -#define SET_GenFragmentShadersATI(disp, fn) ((disp)->GenFragmentShadersATI = fn) -#define CALL_PassTexCoordATI(disp, parameters) (*((disp)->PassTexCoordATI)) parameters -#define GET_PassTexCoordATI(disp) ((disp)->PassTexCoordATI) -#define SET_PassTexCoordATI(disp, fn) ((disp)->PassTexCoordATI = fn) -#define CALL_SampleMapATI(disp, parameters) (*((disp)->SampleMapATI)) parameters -#define GET_SampleMapATI(disp) ((disp)->SampleMapATI) -#define SET_SampleMapATI(disp, fn) ((disp)->SampleMapATI = fn) -#define CALL_SetFragmentShaderConstantATI(disp, parameters) (*((disp)->SetFragmentShaderConstantATI)) parameters -#define GET_SetFragmentShaderConstantATI(disp) ((disp)->SetFragmentShaderConstantATI) -#define SET_SetFragmentShaderConstantATI(disp, fn) ((disp)->SetFragmentShaderConstantATI = fn) -#define CALL_PointParameteriNV(disp, parameters) (*((disp)->PointParameteriNV)) parameters -#define GET_PointParameteriNV(disp) ((disp)->PointParameteriNV) -#define SET_PointParameteriNV(disp, fn) ((disp)->PointParameteriNV = fn) -#define CALL_PointParameterivNV(disp, parameters) (*((disp)->PointParameterivNV)) parameters -#define GET_PointParameterivNV(disp) ((disp)->PointParameterivNV) -#define SET_PointParameterivNV(disp, fn) ((disp)->PointParameterivNV = fn) -#define CALL_ActiveStencilFaceEXT(disp, parameters) (*((disp)->ActiveStencilFaceEXT)) parameters -#define GET_ActiveStencilFaceEXT(disp) ((disp)->ActiveStencilFaceEXT) -#define SET_ActiveStencilFaceEXT(disp, fn) ((disp)->ActiveStencilFaceEXT = fn) -#define CALL_BindVertexArrayAPPLE(disp, parameters) (*((disp)->BindVertexArrayAPPLE)) parameters -#define GET_BindVertexArrayAPPLE(disp) ((disp)->BindVertexArrayAPPLE) -#define SET_BindVertexArrayAPPLE(disp, fn) ((disp)->BindVertexArrayAPPLE = fn) -#define CALL_DeleteVertexArraysAPPLE(disp, parameters) (*((disp)->DeleteVertexArraysAPPLE)) parameters -#define GET_DeleteVertexArraysAPPLE(disp) ((disp)->DeleteVertexArraysAPPLE) -#define SET_DeleteVertexArraysAPPLE(disp, fn) ((disp)->DeleteVertexArraysAPPLE = fn) -#define CALL_GenVertexArraysAPPLE(disp, parameters) (*((disp)->GenVertexArraysAPPLE)) parameters -#define GET_GenVertexArraysAPPLE(disp) ((disp)->GenVertexArraysAPPLE) -#define SET_GenVertexArraysAPPLE(disp, fn) ((disp)->GenVertexArraysAPPLE = fn) -#define CALL_IsVertexArrayAPPLE(disp, parameters) (*((disp)->IsVertexArrayAPPLE)) parameters -#define GET_IsVertexArrayAPPLE(disp) ((disp)->IsVertexArrayAPPLE) -#define SET_IsVertexArrayAPPLE(disp, fn) ((disp)->IsVertexArrayAPPLE = fn) -#define CALL_GetProgramNamedParameterdvNV(disp, parameters) (*((disp)->GetProgramNamedParameterdvNV)) parameters -#define GET_GetProgramNamedParameterdvNV(disp) ((disp)->GetProgramNamedParameterdvNV) -#define SET_GetProgramNamedParameterdvNV(disp, fn) ((disp)->GetProgramNamedParameterdvNV = fn) -#define CALL_GetProgramNamedParameterfvNV(disp, parameters) (*((disp)->GetProgramNamedParameterfvNV)) parameters -#define GET_GetProgramNamedParameterfvNV(disp) ((disp)->GetProgramNamedParameterfvNV) -#define SET_GetProgramNamedParameterfvNV(disp, fn) ((disp)->GetProgramNamedParameterfvNV = fn) -#define CALL_ProgramNamedParameter4dNV(disp, parameters) (*((disp)->ProgramNamedParameter4dNV)) parameters -#define GET_ProgramNamedParameter4dNV(disp) ((disp)->ProgramNamedParameter4dNV) -#define SET_ProgramNamedParameter4dNV(disp, fn) ((disp)->ProgramNamedParameter4dNV = fn) -#define CALL_ProgramNamedParameter4dvNV(disp, parameters) (*((disp)->ProgramNamedParameter4dvNV)) parameters -#define GET_ProgramNamedParameter4dvNV(disp) ((disp)->ProgramNamedParameter4dvNV) -#define SET_ProgramNamedParameter4dvNV(disp, fn) ((disp)->ProgramNamedParameter4dvNV = fn) -#define CALL_ProgramNamedParameter4fNV(disp, parameters) (*((disp)->ProgramNamedParameter4fNV)) parameters -#define GET_ProgramNamedParameter4fNV(disp) ((disp)->ProgramNamedParameter4fNV) -#define SET_ProgramNamedParameter4fNV(disp, fn) ((disp)->ProgramNamedParameter4fNV = fn) -#define CALL_ProgramNamedParameter4fvNV(disp, parameters) (*((disp)->ProgramNamedParameter4fvNV)) parameters -#define GET_ProgramNamedParameter4fvNV(disp) ((disp)->ProgramNamedParameter4fvNV) -#define SET_ProgramNamedParameter4fvNV(disp, fn) ((disp)->ProgramNamedParameter4fvNV = fn) -#define CALL_DepthBoundsEXT(disp, parameters) (*((disp)->DepthBoundsEXT)) parameters -#define GET_DepthBoundsEXT(disp) ((disp)->DepthBoundsEXT) -#define SET_DepthBoundsEXT(disp, fn) ((disp)->DepthBoundsEXT = fn) -#define CALL_BlendEquationSeparateEXT(disp, parameters) (*((disp)->BlendEquationSeparateEXT)) parameters -#define GET_BlendEquationSeparateEXT(disp) ((disp)->BlendEquationSeparateEXT) -#define SET_BlendEquationSeparateEXT(disp, fn) ((disp)->BlendEquationSeparateEXT = fn) -#define CALL_BindFramebufferEXT(disp, parameters) (*((disp)->BindFramebufferEXT)) parameters -#define GET_BindFramebufferEXT(disp) ((disp)->BindFramebufferEXT) -#define SET_BindFramebufferEXT(disp, fn) ((disp)->BindFramebufferEXT = fn) -#define CALL_BindRenderbufferEXT(disp, parameters) (*((disp)->BindRenderbufferEXT)) parameters -#define GET_BindRenderbufferEXT(disp) ((disp)->BindRenderbufferEXT) -#define SET_BindRenderbufferEXT(disp, fn) ((disp)->BindRenderbufferEXT = fn) -#define CALL_CheckFramebufferStatusEXT(disp, parameters) (*((disp)->CheckFramebufferStatusEXT)) parameters -#define GET_CheckFramebufferStatusEXT(disp) ((disp)->CheckFramebufferStatusEXT) -#define SET_CheckFramebufferStatusEXT(disp, fn) ((disp)->CheckFramebufferStatusEXT = fn) -#define CALL_DeleteFramebuffersEXT(disp, parameters) (*((disp)->DeleteFramebuffersEXT)) parameters -#define GET_DeleteFramebuffersEXT(disp) ((disp)->DeleteFramebuffersEXT) -#define SET_DeleteFramebuffersEXT(disp, fn) ((disp)->DeleteFramebuffersEXT = fn) -#define CALL_DeleteRenderbuffersEXT(disp, parameters) (*((disp)->DeleteRenderbuffersEXT)) parameters -#define GET_DeleteRenderbuffersEXT(disp) ((disp)->DeleteRenderbuffersEXT) -#define SET_DeleteRenderbuffersEXT(disp, fn) ((disp)->DeleteRenderbuffersEXT = fn) -#define CALL_FramebufferRenderbufferEXT(disp, parameters) (*((disp)->FramebufferRenderbufferEXT)) parameters -#define GET_FramebufferRenderbufferEXT(disp) ((disp)->FramebufferRenderbufferEXT) -#define SET_FramebufferRenderbufferEXT(disp, fn) ((disp)->FramebufferRenderbufferEXT = fn) -#define CALL_FramebufferTexture1DEXT(disp, parameters) (*((disp)->FramebufferTexture1DEXT)) parameters -#define GET_FramebufferTexture1DEXT(disp) ((disp)->FramebufferTexture1DEXT) -#define SET_FramebufferTexture1DEXT(disp, fn) ((disp)->FramebufferTexture1DEXT = fn) -#define CALL_FramebufferTexture2DEXT(disp, parameters) (*((disp)->FramebufferTexture2DEXT)) parameters -#define GET_FramebufferTexture2DEXT(disp) ((disp)->FramebufferTexture2DEXT) -#define SET_FramebufferTexture2DEXT(disp, fn) ((disp)->FramebufferTexture2DEXT = fn) -#define CALL_FramebufferTexture3DEXT(disp, parameters) (*((disp)->FramebufferTexture3DEXT)) parameters -#define GET_FramebufferTexture3DEXT(disp) ((disp)->FramebufferTexture3DEXT) -#define SET_FramebufferTexture3DEXT(disp, fn) ((disp)->FramebufferTexture3DEXT = fn) -#define CALL_GenFramebuffersEXT(disp, parameters) (*((disp)->GenFramebuffersEXT)) parameters -#define GET_GenFramebuffersEXT(disp) ((disp)->GenFramebuffersEXT) -#define SET_GenFramebuffersEXT(disp, fn) ((disp)->GenFramebuffersEXT = fn) -#define CALL_GenRenderbuffersEXT(disp, parameters) (*((disp)->GenRenderbuffersEXT)) parameters -#define GET_GenRenderbuffersEXT(disp) ((disp)->GenRenderbuffersEXT) -#define SET_GenRenderbuffersEXT(disp, fn) ((disp)->GenRenderbuffersEXT = fn) -#define CALL_GenerateMipmapEXT(disp, parameters) (*((disp)->GenerateMipmapEXT)) parameters -#define GET_GenerateMipmapEXT(disp) ((disp)->GenerateMipmapEXT) -#define SET_GenerateMipmapEXT(disp, fn) ((disp)->GenerateMipmapEXT = fn) -#define CALL_GetFramebufferAttachmentParameterivEXT(disp, parameters) (*((disp)->GetFramebufferAttachmentParameterivEXT)) parameters -#define GET_GetFramebufferAttachmentParameterivEXT(disp) ((disp)->GetFramebufferAttachmentParameterivEXT) -#define SET_GetFramebufferAttachmentParameterivEXT(disp, fn) ((disp)->GetFramebufferAttachmentParameterivEXT = fn) -#define CALL_GetRenderbufferParameterivEXT(disp, parameters) (*((disp)->GetRenderbufferParameterivEXT)) parameters -#define GET_GetRenderbufferParameterivEXT(disp) ((disp)->GetRenderbufferParameterivEXT) -#define SET_GetRenderbufferParameterivEXT(disp, fn) ((disp)->GetRenderbufferParameterivEXT = fn) -#define CALL_IsFramebufferEXT(disp, parameters) (*((disp)->IsFramebufferEXT)) parameters -#define GET_IsFramebufferEXT(disp) ((disp)->IsFramebufferEXT) -#define SET_IsFramebufferEXT(disp, fn) ((disp)->IsFramebufferEXT = fn) -#define CALL_IsRenderbufferEXT(disp, parameters) (*((disp)->IsRenderbufferEXT)) parameters -#define GET_IsRenderbufferEXT(disp) ((disp)->IsRenderbufferEXT) -#define SET_IsRenderbufferEXT(disp, fn) ((disp)->IsRenderbufferEXT = fn) -#define CALL_RenderbufferStorageEXT(disp, parameters) (*((disp)->RenderbufferStorageEXT)) parameters -#define GET_RenderbufferStorageEXT(disp) ((disp)->RenderbufferStorageEXT) -#define SET_RenderbufferStorageEXT(disp, fn) ((disp)->RenderbufferStorageEXT = fn) -#define CALL_BlitFramebufferEXT(disp, parameters) (*((disp)->BlitFramebufferEXT)) parameters -#define GET_BlitFramebufferEXT(disp) ((disp)->BlitFramebufferEXT) -#define SET_BlitFramebufferEXT(disp, fn) ((disp)->BlitFramebufferEXT = fn) -#define CALL_BufferParameteriAPPLE(disp, parameters) (*((disp)->BufferParameteriAPPLE)) parameters -#define GET_BufferParameteriAPPLE(disp) ((disp)->BufferParameteriAPPLE) -#define SET_BufferParameteriAPPLE(disp, fn) ((disp)->BufferParameteriAPPLE = fn) -#define CALL_FlushMappedBufferRangeAPPLE(disp, parameters) (*((disp)->FlushMappedBufferRangeAPPLE)) parameters -#define GET_FlushMappedBufferRangeAPPLE(disp) ((disp)->FlushMappedBufferRangeAPPLE) -#define SET_FlushMappedBufferRangeAPPLE(disp, fn) ((disp)->FlushMappedBufferRangeAPPLE = fn) -#define CALL_FramebufferTextureLayerEXT(disp, parameters) (*((disp)->FramebufferTextureLayerEXT)) parameters -#define GET_FramebufferTextureLayerEXT(disp) ((disp)->FramebufferTextureLayerEXT) -#define SET_FramebufferTextureLayerEXT(disp, fn) ((disp)->FramebufferTextureLayerEXT = fn) -#define CALL_ProvokingVertexEXT(disp, parameters) (*((disp)->ProvokingVertexEXT)) parameters -#define GET_ProvokingVertexEXT(disp) ((disp)->ProvokingVertexEXT) -#define SET_ProvokingVertexEXT(disp, fn) ((disp)->ProvokingVertexEXT = fn) -#define CALL_GetTexParameterPointervAPPLE(disp, parameters) (*((disp)->GetTexParameterPointervAPPLE)) parameters -#define GET_GetTexParameterPointervAPPLE(disp) ((disp)->GetTexParameterPointervAPPLE) -#define SET_GetTexParameterPointervAPPLE(disp, fn) ((disp)->GetTexParameterPointervAPPLE = fn) -#define CALL_TextureRangeAPPLE(disp, parameters) (*((disp)->TextureRangeAPPLE)) parameters -#define GET_TextureRangeAPPLE(disp) ((disp)->TextureRangeAPPLE) -#define SET_TextureRangeAPPLE(disp, fn) ((disp)->TextureRangeAPPLE = fn) -#define CALL_StencilFuncSeparateATI(disp, parameters) (*((disp)->StencilFuncSeparateATI)) parameters -#define GET_StencilFuncSeparateATI(disp) ((disp)->StencilFuncSeparateATI) -#define SET_StencilFuncSeparateATI(disp, fn) ((disp)->StencilFuncSeparateATI = fn) -#define CALL_ProgramEnvParameters4fvEXT(disp, parameters) (*((disp)->ProgramEnvParameters4fvEXT)) parameters -#define GET_ProgramEnvParameters4fvEXT(disp) ((disp)->ProgramEnvParameters4fvEXT) -#define SET_ProgramEnvParameters4fvEXT(disp, fn) ((disp)->ProgramEnvParameters4fvEXT = fn) -#define CALL_ProgramLocalParameters4fvEXT(disp, parameters) (*((disp)->ProgramLocalParameters4fvEXT)) parameters -#define GET_ProgramLocalParameters4fvEXT(disp) ((disp)->ProgramLocalParameters4fvEXT) -#define SET_ProgramLocalParameters4fvEXT(disp, fn) ((disp)->ProgramLocalParameters4fvEXT = fn) -#define CALL_GetQueryObjecti64vEXT(disp, parameters) (*((disp)->GetQueryObjecti64vEXT)) parameters -#define GET_GetQueryObjecti64vEXT(disp) ((disp)->GetQueryObjecti64vEXT) -#define SET_GetQueryObjecti64vEXT(disp, fn) ((disp)->GetQueryObjecti64vEXT = fn) -#define CALL_GetQueryObjectui64vEXT(disp, parameters) (*((disp)->GetQueryObjectui64vEXT)) parameters -#define GET_GetQueryObjectui64vEXT(disp) ((disp)->GetQueryObjectui64vEXT) -#define SET_GetQueryObjectui64vEXT(disp, fn) ((disp)->GetQueryObjectui64vEXT = fn) - -#else - -#define driDispatchRemapTable_size 387 -extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; - -#define AttachShader_remap_index 0 -#define CreateProgram_remap_index 1 -#define CreateShader_remap_index 2 -#define DeleteProgram_remap_index 3 -#define DeleteShader_remap_index 4 -#define DetachShader_remap_index 5 -#define GetAttachedShaders_remap_index 6 -#define GetProgramInfoLog_remap_index 7 -#define GetProgramiv_remap_index 8 -#define GetShaderInfoLog_remap_index 9 -#define GetShaderiv_remap_index 10 -#define IsProgram_remap_index 11 -#define IsShader_remap_index 12 -#define StencilFuncSeparate_remap_index 13 -#define StencilMaskSeparate_remap_index 14 -#define StencilOpSeparate_remap_index 15 -#define UniformMatrix2x3fv_remap_index 16 -#define UniformMatrix2x4fv_remap_index 17 -#define UniformMatrix3x2fv_remap_index 18 -#define UniformMatrix3x4fv_remap_index 19 -#define UniformMatrix4x2fv_remap_index 20 -#define UniformMatrix4x3fv_remap_index 21 -#define LoadTransposeMatrixdARB_remap_index 22 -#define LoadTransposeMatrixfARB_remap_index 23 -#define MultTransposeMatrixdARB_remap_index 24 -#define MultTransposeMatrixfARB_remap_index 25 -#define SampleCoverageARB_remap_index 26 -#define CompressedTexImage1DARB_remap_index 27 -#define CompressedTexImage2DARB_remap_index 28 -#define CompressedTexImage3DARB_remap_index 29 -#define CompressedTexSubImage1DARB_remap_index 30 -#define CompressedTexSubImage2DARB_remap_index 31 -#define CompressedTexSubImage3DARB_remap_index 32 -#define GetCompressedTexImageARB_remap_index 33 -#define DisableVertexAttribArrayARB_remap_index 34 -#define EnableVertexAttribArrayARB_remap_index 35 -#define GetProgramEnvParameterdvARB_remap_index 36 -#define GetProgramEnvParameterfvARB_remap_index 37 -#define GetProgramLocalParameterdvARB_remap_index 38 -#define GetProgramLocalParameterfvARB_remap_index 39 -#define GetProgramStringARB_remap_index 40 -#define GetProgramivARB_remap_index 41 -#define GetVertexAttribdvARB_remap_index 42 -#define GetVertexAttribfvARB_remap_index 43 -#define GetVertexAttribivARB_remap_index 44 -#define ProgramEnvParameter4dARB_remap_index 45 -#define ProgramEnvParameter4dvARB_remap_index 46 -#define ProgramEnvParameter4fARB_remap_index 47 -#define ProgramEnvParameter4fvARB_remap_index 48 -#define ProgramLocalParameter4dARB_remap_index 49 -#define ProgramLocalParameter4dvARB_remap_index 50 -#define ProgramLocalParameter4fARB_remap_index 51 -#define ProgramLocalParameter4fvARB_remap_index 52 -#define ProgramStringARB_remap_index 53 -#define VertexAttrib1dARB_remap_index 54 -#define VertexAttrib1dvARB_remap_index 55 -#define VertexAttrib1fARB_remap_index 56 -#define VertexAttrib1fvARB_remap_index 57 -#define VertexAttrib1sARB_remap_index 58 -#define VertexAttrib1svARB_remap_index 59 -#define VertexAttrib2dARB_remap_index 60 -#define VertexAttrib2dvARB_remap_index 61 -#define VertexAttrib2fARB_remap_index 62 -#define VertexAttrib2fvARB_remap_index 63 -#define VertexAttrib2sARB_remap_index 64 -#define VertexAttrib2svARB_remap_index 65 -#define VertexAttrib3dARB_remap_index 66 -#define VertexAttrib3dvARB_remap_index 67 -#define VertexAttrib3fARB_remap_index 68 -#define VertexAttrib3fvARB_remap_index 69 -#define VertexAttrib3sARB_remap_index 70 -#define VertexAttrib3svARB_remap_index 71 -#define VertexAttrib4NbvARB_remap_index 72 -#define VertexAttrib4NivARB_remap_index 73 -#define VertexAttrib4NsvARB_remap_index 74 -#define VertexAttrib4NubARB_remap_index 75 -#define VertexAttrib4NubvARB_remap_index 76 -#define VertexAttrib4NuivARB_remap_index 77 -#define VertexAttrib4NusvARB_remap_index 78 -#define VertexAttrib4bvARB_remap_index 79 -#define VertexAttrib4dARB_remap_index 80 -#define VertexAttrib4dvARB_remap_index 81 -#define VertexAttrib4fARB_remap_index 82 -#define VertexAttrib4fvARB_remap_index 83 -#define VertexAttrib4ivARB_remap_index 84 -#define VertexAttrib4sARB_remap_index 85 -#define VertexAttrib4svARB_remap_index 86 -#define VertexAttrib4ubvARB_remap_index 87 -#define VertexAttrib4uivARB_remap_index 88 -#define VertexAttrib4usvARB_remap_index 89 -#define VertexAttribPointerARB_remap_index 90 -#define BindBufferARB_remap_index 91 -#define BufferDataARB_remap_index 92 -#define BufferSubDataARB_remap_index 93 -#define DeleteBuffersARB_remap_index 94 -#define GenBuffersARB_remap_index 95 -#define GetBufferParameterivARB_remap_index 96 -#define GetBufferPointervARB_remap_index 97 -#define GetBufferSubDataARB_remap_index 98 -#define IsBufferARB_remap_index 99 -#define MapBufferARB_remap_index 100 -#define UnmapBufferARB_remap_index 101 -#define BeginQueryARB_remap_index 102 -#define DeleteQueriesARB_remap_index 103 -#define EndQueryARB_remap_index 104 -#define GenQueriesARB_remap_index 105 -#define GetQueryObjectivARB_remap_index 106 -#define GetQueryObjectuivARB_remap_index 107 -#define GetQueryivARB_remap_index 108 -#define IsQueryARB_remap_index 109 -#define AttachObjectARB_remap_index 110 -#define CompileShaderARB_remap_index 111 -#define CreateProgramObjectARB_remap_index 112 -#define CreateShaderObjectARB_remap_index 113 -#define DeleteObjectARB_remap_index 114 -#define DetachObjectARB_remap_index 115 -#define GetActiveUniformARB_remap_index 116 -#define GetAttachedObjectsARB_remap_index 117 -#define GetHandleARB_remap_index 118 -#define GetInfoLogARB_remap_index 119 -#define GetObjectParameterfvARB_remap_index 120 -#define GetObjectParameterivARB_remap_index 121 -#define GetShaderSourceARB_remap_index 122 -#define GetUniformLocationARB_remap_index 123 -#define GetUniformfvARB_remap_index 124 -#define GetUniformivARB_remap_index 125 -#define LinkProgramARB_remap_index 126 -#define ShaderSourceARB_remap_index 127 -#define Uniform1fARB_remap_index 128 -#define Uniform1fvARB_remap_index 129 -#define Uniform1iARB_remap_index 130 -#define Uniform1ivARB_remap_index 131 -#define Uniform2fARB_remap_index 132 -#define Uniform2fvARB_remap_index 133 -#define Uniform2iARB_remap_index 134 -#define Uniform2ivARB_remap_index 135 -#define Uniform3fARB_remap_index 136 -#define Uniform3fvARB_remap_index 137 -#define Uniform3iARB_remap_index 138 -#define Uniform3ivARB_remap_index 139 -#define Uniform4fARB_remap_index 140 -#define Uniform4fvARB_remap_index 141 -#define Uniform4iARB_remap_index 142 -#define Uniform4ivARB_remap_index 143 -#define UniformMatrix2fvARB_remap_index 144 -#define UniformMatrix3fvARB_remap_index 145 -#define UniformMatrix4fvARB_remap_index 146 -#define UseProgramObjectARB_remap_index 147 -#define ValidateProgramARB_remap_index 148 -#define BindAttribLocationARB_remap_index 149 -#define GetActiveAttribARB_remap_index 150 -#define GetAttribLocationARB_remap_index 151 -#define DrawBuffersARB_remap_index 152 -#define RenderbufferStorageMultisample_remap_index 153 -#define FlushMappedBufferRange_remap_index 154 -#define MapBufferRange_remap_index 155 -#define BindVertexArray_remap_index 156 -#define GenVertexArrays_remap_index 157 -#define CopyBufferSubData_remap_index 158 -#define ClientWaitSync_remap_index 159 -#define DeleteSync_remap_index 160 -#define FenceSync_remap_index 161 -#define GetInteger64v_remap_index 162 -#define GetSynciv_remap_index 163 -#define IsSync_remap_index 164 -#define WaitSync_remap_index 165 -#define DrawElementsBaseVertex_remap_index 166 -#define DrawRangeElementsBaseVertex_remap_index 167 -#define MultiDrawElementsBaseVertex_remap_index 168 -#define PolygonOffsetEXT_remap_index 169 -#define GetPixelTexGenParameterfvSGIS_remap_index 170 -#define GetPixelTexGenParameterivSGIS_remap_index 171 -#define PixelTexGenParameterfSGIS_remap_index 172 -#define PixelTexGenParameterfvSGIS_remap_index 173 -#define PixelTexGenParameteriSGIS_remap_index 174 -#define PixelTexGenParameterivSGIS_remap_index 175 -#define SampleMaskSGIS_remap_index 176 -#define SamplePatternSGIS_remap_index 177 -#define ColorPointerEXT_remap_index 178 -#define EdgeFlagPointerEXT_remap_index 179 -#define IndexPointerEXT_remap_index 180 -#define NormalPointerEXT_remap_index 181 -#define TexCoordPointerEXT_remap_index 182 -#define VertexPointerEXT_remap_index 183 -#define PointParameterfEXT_remap_index 184 -#define PointParameterfvEXT_remap_index 185 -#define LockArraysEXT_remap_index 186 -#define UnlockArraysEXT_remap_index 187 -#define CullParameterdvEXT_remap_index 188 -#define CullParameterfvEXT_remap_index 189 -#define SecondaryColor3bEXT_remap_index 190 -#define SecondaryColor3bvEXT_remap_index 191 -#define SecondaryColor3dEXT_remap_index 192 -#define SecondaryColor3dvEXT_remap_index 193 -#define SecondaryColor3fEXT_remap_index 194 -#define SecondaryColor3fvEXT_remap_index 195 -#define SecondaryColor3iEXT_remap_index 196 -#define SecondaryColor3ivEXT_remap_index 197 -#define SecondaryColor3sEXT_remap_index 198 -#define SecondaryColor3svEXT_remap_index 199 -#define SecondaryColor3ubEXT_remap_index 200 -#define SecondaryColor3ubvEXT_remap_index 201 -#define SecondaryColor3uiEXT_remap_index 202 -#define SecondaryColor3uivEXT_remap_index 203 -#define SecondaryColor3usEXT_remap_index 204 -#define SecondaryColor3usvEXT_remap_index 205 -#define SecondaryColorPointerEXT_remap_index 206 -#define MultiDrawArraysEXT_remap_index 207 -#define MultiDrawElementsEXT_remap_index 208 -#define FogCoordPointerEXT_remap_index 209 -#define FogCoorddEXT_remap_index 210 -#define FogCoorddvEXT_remap_index 211 -#define FogCoordfEXT_remap_index 212 -#define FogCoordfvEXT_remap_index 213 -#define PixelTexGenSGIX_remap_index 214 -#define BlendFuncSeparateEXT_remap_index 215 -#define FlushVertexArrayRangeNV_remap_index 216 -#define VertexArrayRangeNV_remap_index 217 -#define CombinerInputNV_remap_index 218 -#define CombinerOutputNV_remap_index 219 -#define CombinerParameterfNV_remap_index 220 -#define CombinerParameterfvNV_remap_index 221 -#define CombinerParameteriNV_remap_index 222 -#define CombinerParameterivNV_remap_index 223 -#define FinalCombinerInputNV_remap_index 224 -#define GetCombinerInputParameterfvNV_remap_index 225 -#define GetCombinerInputParameterivNV_remap_index 226 -#define GetCombinerOutputParameterfvNV_remap_index 227 -#define GetCombinerOutputParameterivNV_remap_index 228 -#define GetFinalCombinerInputParameterfvNV_remap_index 229 -#define GetFinalCombinerInputParameterivNV_remap_index 230 -#define ResizeBuffersMESA_remap_index 231 -#define WindowPos2dMESA_remap_index 232 -#define WindowPos2dvMESA_remap_index 233 -#define WindowPos2fMESA_remap_index 234 -#define WindowPos2fvMESA_remap_index 235 -#define WindowPos2iMESA_remap_index 236 -#define WindowPos2ivMESA_remap_index 237 -#define WindowPos2sMESA_remap_index 238 -#define WindowPos2svMESA_remap_index 239 -#define WindowPos3dMESA_remap_index 240 -#define WindowPos3dvMESA_remap_index 241 -#define WindowPos3fMESA_remap_index 242 -#define WindowPos3fvMESA_remap_index 243 -#define WindowPos3iMESA_remap_index 244 -#define WindowPos3ivMESA_remap_index 245 -#define WindowPos3sMESA_remap_index 246 -#define WindowPos3svMESA_remap_index 247 -#define WindowPos4dMESA_remap_index 248 -#define WindowPos4dvMESA_remap_index 249 -#define WindowPos4fMESA_remap_index 250 -#define WindowPos4fvMESA_remap_index 251 -#define WindowPos4iMESA_remap_index 252 -#define WindowPos4ivMESA_remap_index 253 -#define WindowPos4sMESA_remap_index 254 -#define WindowPos4svMESA_remap_index 255 -#define MultiModeDrawArraysIBM_remap_index 256 -#define MultiModeDrawElementsIBM_remap_index 257 -#define DeleteFencesNV_remap_index 258 -#define FinishFenceNV_remap_index 259 -#define GenFencesNV_remap_index 260 -#define GetFenceivNV_remap_index 261 -#define IsFenceNV_remap_index 262 -#define SetFenceNV_remap_index 263 -#define TestFenceNV_remap_index 264 -#define AreProgramsResidentNV_remap_index 265 -#define BindProgramNV_remap_index 266 -#define DeleteProgramsNV_remap_index 267 -#define ExecuteProgramNV_remap_index 268 -#define GenProgramsNV_remap_index 269 -#define GetProgramParameterdvNV_remap_index 270 -#define GetProgramParameterfvNV_remap_index 271 -#define GetProgramStringNV_remap_index 272 -#define GetProgramivNV_remap_index 273 -#define GetTrackMatrixivNV_remap_index 274 -#define GetVertexAttribPointervNV_remap_index 275 -#define GetVertexAttribdvNV_remap_index 276 -#define GetVertexAttribfvNV_remap_index 277 -#define GetVertexAttribivNV_remap_index 278 -#define IsProgramNV_remap_index 279 -#define LoadProgramNV_remap_index 280 -#define ProgramParameters4dvNV_remap_index 281 -#define ProgramParameters4fvNV_remap_index 282 -#define RequestResidentProgramsNV_remap_index 283 -#define TrackMatrixNV_remap_index 284 -#define VertexAttrib1dNV_remap_index 285 -#define VertexAttrib1dvNV_remap_index 286 -#define VertexAttrib1fNV_remap_index 287 -#define VertexAttrib1fvNV_remap_index 288 -#define VertexAttrib1sNV_remap_index 289 -#define VertexAttrib1svNV_remap_index 290 -#define VertexAttrib2dNV_remap_index 291 -#define VertexAttrib2dvNV_remap_index 292 -#define VertexAttrib2fNV_remap_index 293 -#define VertexAttrib2fvNV_remap_index 294 -#define VertexAttrib2sNV_remap_index 295 -#define VertexAttrib2svNV_remap_index 296 -#define VertexAttrib3dNV_remap_index 297 -#define VertexAttrib3dvNV_remap_index 298 -#define VertexAttrib3fNV_remap_index 299 -#define VertexAttrib3fvNV_remap_index 300 -#define VertexAttrib3sNV_remap_index 301 -#define VertexAttrib3svNV_remap_index 302 -#define VertexAttrib4dNV_remap_index 303 -#define VertexAttrib4dvNV_remap_index 304 -#define VertexAttrib4fNV_remap_index 305 -#define VertexAttrib4fvNV_remap_index 306 -#define VertexAttrib4sNV_remap_index 307 -#define VertexAttrib4svNV_remap_index 308 -#define VertexAttrib4ubNV_remap_index 309 -#define VertexAttrib4ubvNV_remap_index 310 -#define VertexAttribPointerNV_remap_index 311 -#define VertexAttribs1dvNV_remap_index 312 -#define VertexAttribs1fvNV_remap_index 313 -#define VertexAttribs1svNV_remap_index 314 -#define VertexAttribs2dvNV_remap_index 315 -#define VertexAttribs2fvNV_remap_index 316 -#define VertexAttribs2svNV_remap_index 317 -#define VertexAttribs3dvNV_remap_index 318 -#define VertexAttribs3fvNV_remap_index 319 -#define VertexAttribs3svNV_remap_index 320 -#define VertexAttribs4dvNV_remap_index 321 -#define VertexAttribs4fvNV_remap_index 322 -#define VertexAttribs4svNV_remap_index 323 -#define VertexAttribs4ubvNV_remap_index 324 -#define GetTexBumpParameterfvATI_remap_index 325 -#define GetTexBumpParameterivATI_remap_index 326 -#define TexBumpParameterfvATI_remap_index 327 -#define TexBumpParameterivATI_remap_index 328 -#define AlphaFragmentOp1ATI_remap_index 329 -#define AlphaFragmentOp2ATI_remap_index 330 -#define AlphaFragmentOp3ATI_remap_index 331 -#define BeginFragmentShaderATI_remap_index 332 -#define BindFragmentShaderATI_remap_index 333 -#define ColorFragmentOp1ATI_remap_index 334 -#define ColorFragmentOp2ATI_remap_index 335 -#define ColorFragmentOp3ATI_remap_index 336 -#define DeleteFragmentShaderATI_remap_index 337 -#define EndFragmentShaderATI_remap_index 338 -#define GenFragmentShadersATI_remap_index 339 -#define PassTexCoordATI_remap_index 340 -#define SampleMapATI_remap_index 341 -#define SetFragmentShaderConstantATI_remap_index 342 -#define PointParameteriNV_remap_index 343 -#define PointParameterivNV_remap_index 344 -#define ActiveStencilFaceEXT_remap_index 345 -#define BindVertexArrayAPPLE_remap_index 346 -#define DeleteVertexArraysAPPLE_remap_index 347 -#define GenVertexArraysAPPLE_remap_index 348 -#define IsVertexArrayAPPLE_remap_index 349 -#define GetProgramNamedParameterdvNV_remap_index 350 -#define GetProgramNamedParameterfvNV_remap_index 351 -#define ProgramNamedParameter4dNV_remap_index 352 -#define ProgramNamedParameter4dvNV_remap_index 353 -#define ProgramNamedParameter4fNV_remap_index 354 -#define ProgramNamedParameter4fvNV_remap_index 355 -#define DepthBoundsEXT_remap_index 356 -#define BlendEquationSeparateEXT_remap_index 357 -#define BindFramebufferEXT_remap_index 358 -#define BindRenderbufferEXT_remap_index 359 -#define CheckFramebufferStatusEXT_remap_index 360 -#define DeleteFramebuffersEXT_remap_index 361 -#define DeleteRenderbuffersEXT_remap_index 362 -#define FramebufferRenderbufferEXT_remap_index 363 -#define FramebufferTexture1DEXT_remap_index 364 -#define FramebufferTexture2DEXT_remap_index 365 -#define FramebufferTexture3DEXT_remap_index 366 -#define GenFramebuffersEXT_remap_index 367 -#define GenRenderbuffersEXT_remap_index 368 -#define GenerateMipmapEXT_remap_index 369 -#define GetFramebufferAttachmentParameterivEXT_remap_index 370 -#define GetRenderbufferParameterivEXT_remap_index 371 -#define IsFramebufferEXT_remap_index 372 -#define IsRenderbufferEXT_remap_index 373 -#define RenderbufferStorageEXT_remap_index 374 -#define BlitFramebufferEXT_remap_index 375 -#define BufferParameteriAPPLE_remap_index 376 -#define FlushMappedBufferRangeAPPLE_remap_index 377 -#define FramebufferTextureLayerEXT_remap_index 378 -#define ProvokingVertexEXT_remap_index 379 -#define GetTexParameterPointervAPPLE_remap_index 380 -#define TextureRangeAPPLE_remap_index 381 -#define StencilFuncSeparateATI_remap_index 382 -#define ProgramEnvParameters4fvEXT_remap_index 383 -#define ProgramLocalParameters4fvEXT_remap_index 384 -#define GetQueryObjecti64vEXT_remap_index 385 -#define GetQueryObjectui64vEXT_remap_index 386 - -#define CALL_AttachShader(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint)), driDispatchRemapTable[AttachShader_remap_index], parameters) -#define GET_AttachShader(disp) GET_by_offset(disp, driDispatchRemapTable[AttachShader_remap_index]) -#define SET_AttachShader(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AttachShader_remap_index], fn) -#define CALL_CreateProgram(disp, parameters) CALL_by_offset(disp, (GLuint (GLAPIENTRYP)(void)), driDispatchRemapTable[CreateProgram_remap_index], parameters) -#define GET_CreateProgram(disp) GET_by_offset(disp, driDispatchRemapTable[CreateProgram_remap_index]) -#define SET_CreateProgram(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CreateProgram_remap_index], fn) -#define CALL_CreateShader(disp, parameters) CALL_by_offset(disp, (GLuint (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[CreateShader_remap_index], parameters) -#define GET_CreateShader(disp) GET_by_offset(disp, driDispatchRemapTable[CreateShader_remap_index]) -#define SET_CreateShader(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CreateShader_remap_index], fn) -#define CALL_DeleteProgram(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[DeleteProgram_remap_index], parameters) -#define GET_DeleteProgram(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteProgram_remap_index]) -#define SET_DeleteProgram(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteProgram_remap_index], fn) -#define CALL_DeleteShader(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[DeleteShader_remap_index], parameters) -#define GET_DeleteShader(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteShader_remap_index]) -#define SET_DeleteShader(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteShader_remap_index], fn) -#define CALL_DetachShader(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint)), driDispatchRemapTable[DetachShader_remap_index], parameters) -#define GET_DetachShader(disp) GET_by_offset(disp, driDispatchRemapTable[DetachShader_remap_index]) -#define SET_DetachShader(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DetachShader_remap_index], fn) -#define CALL_GetAttachedShaders(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, GLsizei *, GLuint *)), driDispatchRemapTable[GetAttachedShaders_remap_index], parameters) -#define GET_GetAttachedShaders(disp) GET_by_offset(disp, driDispatchRemapTable[GetAttachedShaders_remap_index]) -#define SET_GetAttachedShaders(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetAttachedShaders_remap_index], fn) -#define CALL_GetProgramInfoLog(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, GLsizei *, GLchar *)), driDispatchRemapTable[GetProgramInfoLog_remap_index], parameters) -#define GET_GetProgramInfoLog(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramInfoLog_remap_index]) -#define SET_GetProgramInfoLog(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramInfoLog_remap_index], fn) -#define CALL_GetProgramiv(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetProgramiv_remap_index], parameters) -#define GET_GetProgramiv(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramiv_remap_index]) -#define SET_GetProgramiv(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramiv_remap_index], fn) -#define CALL_GetShaderInfoLog(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, GLsizei *, GLchar *)), driDispatchRemapTable[GetShaderInfoLog_remap_index], parameters) -#define GET_GetShaderInfoLog(disp) GET_by_offset(disp, driDispatchRemapTable[GetShaderInfoLog_remap_index]) -#define SET_GetShaderInfoLog(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetShaderInfoLog_remap_index], fn) -#define CALL_GetShaderiv(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetShaderiv_remap_index], parameters) -#define GET_GetShaderiv(disp) GET_by_offset(disp, driDispatchRemapTable[GetShaderiv_remap_index]) -#define SET_GetShaderiv(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetShaderiv_remap_index], fn) -#define CALL_IsProgram(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsProgram_remap_index], parameters) -#define GET_IsProgram(disp) GET_by_offset(disp, driDispatchRemapTable[IsProgram_remap_index]) -#define SET_IsProgram(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsProgram_remap_index], fn) -#define CALL_IsShader(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsShader_remap_index], parameters) -#define GET_IsShader(disp) GET_by_offset(disp, driDispatchRemapTable[IsShader_remap_index]) -#define SET_IsShader(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsShader_remap_index], fn) -#define CALL_StencilFuncSeparate(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint, GLuint)), driDispatchRemapTable[StencilFuncSeparate_remap_index], parameters) -#define GET_StencilFuncSeparate(disp) GET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparate_remap_index]) -#define SET_StencilFuncSeparate(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparate_remap_index], fn) -#define CALL_StencilMaskSeparate(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[StencilMaskSeparate_remap_index], parameters) -#define GET_StencilMaskSeparate(disp) GET_by_offset(disp, driDispatchRemapTable[StencilMaskSeparate_remap_index]) -#define SET_StencilMaskSeparate(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilMaskSeparate_remap_index], fn) -#define CALL_StencilOpSeparate(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum)), driDispatchRemapTable[StencilOpSeparate_remap_index], parameters) -#define GET_StencilOpSeparate(disp) GET_by_offset(disp, driDispatchRemapTable[StencilOpSeparate_remap_index]) -#define SET_StencilOpSeparate(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilOpSeparate_remap_index], fn) -#define CALL_UniformMatrix2x3fv(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix2x3fv_remap_index], parameters) -#define GET_UniformMatrix2x3fv(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix2x3fv_remap_index]) -#define SET_UniformMatrix2x3fv(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix2x3fv_remap_index], fn) -#define CALL_UniformMatrix2x4fv(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix2x4fv_remap_index], parameters) -#define GET_UniformMatrix2x4fv(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix2x4fv_remap_index]) -#define SET_UniformMatrix2x4fv(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix2x4fv_remap_index], fn) -#define CALL_UniformMatrix3x2fv(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix3x2fv_remap_index], parameters) -#define GET_UniformMatrix3x2fv(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix3x2fv_remap_index]) -#define SET_UniformMatrix3x2fv(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix3x2fv_remap_index], fn) -#define CALL_UniformMatrix3x4fv(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix3x4fv_remap_index], parameters) -#define GET_UniformMatrix3x4fv(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix3x4fv_remap_index]) -#define SET_UniformMatrix3x4fv(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix3x4fv_remap_index], fn) -#define CALL_UniformMatrix4x2fv(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix4x2fv_remap_index], parameters) -#define GET_UniformMatrix4x2fv(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix4x2fv_remap_index]) -#define SET_UniformMatrix4x2fv(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix4x2fv_remap_index], fn) -#define CALL_UniformMatrix4x3fv(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix4x3fv_remap_index], parameters) -#define GET_UniformMatrix4x3fv(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix4x3fv_remap_index]) -#define SET_UniformMatrix4x3fv(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix4x3fv_remap_index], fn) -#define CALL_LoadTransposeMatrixdARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[LoadTransposeMatrixdARB_remap_index], parameters) -#define GET_LoadTransposeMatrixdARB(disp) GET_by_offset(disp, driDispatchRemapTable[LoadTransposeMatrixdARB_remap_index]) -#define SET_LoadTransposeMatrixdARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LoadTransposeMatrixdARB_remap_index], fn) -#define CALL_LoadTransposeMatrixfARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[LoadTransposeMatrixfARB_remap_index], parameters) -#define GET_LoadTransposeMatrixfARB(disp) GET_by_offset(disp, driDispatchRemapTable[LoadTransposeMatrixfARB_remap_index]) -#define SET_LoadTransposeMatrixfARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LoadTransposeMatrixfARB_remap_index], fn) -#define CALL_MultTransposeMatrixdARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[MultTransposeMatrixdARB_remap_index], parameters) -#define GET_MultTransposeMatrixdARB(disp) GET_by_offset(disp, driDispatchRemapTable[MultTransposeMatrixdARB_remap_index]) -#define SET_MultTransposeMatrixdARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultTransposeMatrixdARB_remap_index], fn) -#define CALL_MultTransposeMatrixfARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[MultTransposeMatrixfARB_remap_index], parameters) -#define GET_MultTransposeMatrixfARB(disp) GET_by_offset(disp, driDispatchRemapTable[MultTransposeMatrixfARB_remap_index]) -#define SET_MultTransposeMatrixfARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultTransposeMatrixfARB_remap_index], fn) -#define CALL_SampleCoverageARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLclampf, GLboolean)), driDispatchRemapTable[SampleCoverageARB_remap_index], parameters) -#define GET_SampleCoverageARB(disp) GET_by_offset(disp, driDispatchRemapTable[SampleCoverageARB_remap_index]) -#define SET_SampleCoverageARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SampleCoverageARB_remap_index], fn) -#define CALL_CompressedTexImage1DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexImage1DARB_remap_index], parameters) -#define GET_CompressedTexImage1DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexImage1DARB_remap_index]) -#define SET_CompressedTexImage1DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexImage1DARB_remap_index], fn) -#define CALL_CompressedTexImage2DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexImage2DARB_remap_index], parameters) -#define GET_CompressedTexImage2DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexImage2DARB_remap_index]) -#define SET_CompressedTexImage2DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexImage2DARB_remap_index], fn) -#define CALL_CompressedTexImage3DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexImage3DARB_remap_index], parameters) -#define GET_CompressedTexImage3DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexImage3DARB_remap_index]) -#define SET_CompressedTexImage3DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexImage3DARB_remap_index], fn) -#define CALL_CompressedTexSubImage1DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexSubImage1DARB_remap_index], parameters) -#define GET_CompressedTexSubImage1DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage1DARB_remap_index]) -#define SET_CompressedTexSubImage1DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage1DARB_remap_index], fn) -#define CALL_CompressedTexSubImage2DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexSubImage2DARB_remap_index], parameters) -#define GET_CompressedTexSubImage2DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage2DARB_remap_index]) -#define SET_CompressedTexSubImage2DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage2DARB_remap_index], fn) -#define CALL_CompressedTexSubImage3DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexSubImage3DARB_remap_index], parameters) -#define GET_CompressedTexSubImage3DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage3DARB_remap_index]) -#define SET_CompressedTexSubImage3DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage3DARB_remap_index], fn) -#define CALL_GetCompressedTexImageARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLvoid *)), driDispatchRemapTable[GetCompressedTexImageARB_remap_index], parameters) -#define GET_GetCompressedTexImageARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetCompressedTexImageARB_remap_index]) -#define SET_GetCompressedTexImageARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetCompressedTexImageARB_remap_index], fn) -#define CALL_DisableVertexAttribArrayARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[DisableVertexAttribArrayARB_remap_index], parameters) -#define GET_DisableVertexAttribArrayARB(disp) GET_by_offset(disp, driDispatchRemapTable[DisableVertexAttribArrayARB_remap_index]) -#define SET_DisableVertexAttribArrayARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DisableVertexAttribArrayARB_remap_index], fn) -#define CALL_EnableVertexAttribArrayARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[EnableVertexAttribArrayARB_remap_index], parameters) -#define GET_EnableVertexAttribArrayARB(disp) GET_by_offset(disp, driDispatchRemapTable[EnableVertexAttribArrayARB_remap_index]) -#define SET_EnableVertexAttribArrayARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[EnableVertexAttribArrayARB_remap_index], fn) -#define CALL_GetProgramEnvParameterdvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLdouble *)), driDispatchRemapTable[GetProgramEnvParameterdvARB_remap_index], parameters) -#define GET_GetProgramEnvParameterdvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramEnvParameterdvARB_remap_index]) -#define SET_GetProgramEnvParameterdvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramEnvParameterdvARB_remap_index], fn) -#define CALL_GetProgramEnvParameterfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLfloat *)), driDispatchRemapTable[GetProgramEnvParameterfvARB_remap_index], parameters) -#define GET_GetProgramEnvParameterfvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramEnvParameterfvARB_remap_index]) -#define SET_GetProgramEnvParameterfvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramEnvParameterfvARB_remap_index], fn) -#define CALL_GetProgramLocalParameterdvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLdouble *)), driDispatchRemapTable[GetProgramLocalParameterdvARB_remap_index], parameters) -#define GET_GetProgramLocalParameterdvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramLocalParameterdvARB_remap_index]) -#define SET_GetProgramLocalParameterdvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramLocalParameterdvARB_remap_index], fn) -#define CALL_GetProgramLocalParameterfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLfloat *)), driDispatchRemapTable[GetProgramLocalParameterfvARB_remap_index], parameters) -#define GET_GetProgramLocalParameterfvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramLocalParameterfvARB_remap_index]) -#define SET_GetProgramLocalParameterfvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramLocalParameterfvARB_remap_index], fn) -#define CALL_GetProgramStringARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLvoid *)), driDispatchRemapTable[GetProgramStringARB_remap_index], parameters) -#define GET_GetProgramStringARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramStringARB_remap_index]) -#define SET_GetProgramStringARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramStringARB_remap_index], fn) -#define CALL_GetProgramivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetProgramivARB_remap_index], parameters) -#define GET_GetProgramivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramivARB_remap_index]) -#define SET_GetProgramivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramivARB_remap_index], fn) -#define CALL_GetVertexAttribdvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLdouble *)), driDispatchRemapTable[GetVertexAttribdvARB_remap_index], parameters) -#define GET_GetVertexAttribdvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribdvARB_remap_index]) -#define SET_GetVertexAttribdvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribdvARB_remap_index], fn) -#define CALL_GetVertexAttribfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLfloat *)), driDispatchRemapTable[GetVertexAttribfvARB_remap_index], parameters) -#define GET_GetVertexAttribfvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribfvARB_remap_index]) -#define SET_GetVertexAttribfvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribfvARB_remap_index], fn) -#define CALL_GetVertexAttribivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetVertexAttribivARB_remap_index], parameters) -#define GET_GetVertexAttribivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribivARB_remap_index]) -#define SET_GetVertexAttribivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribivARB_remap_index], fn) -#define CALL_ProgramEnvParameter4dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[ProgramEnvParameter4dARB_remap_index], parameters) -#define GET_ProgramEnvParameter4dARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4dARB_remap_index]) -#define SET_ProgramEnvParameter4dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4dARB_remap_index], fn) -#define CALL_ProgramEnvParameter4dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLdouble *)), driDispatchRemapTable[ProgramEnvParameter4dvARB_remap_index], parameters) -#define GET_ProgramEnvParameter4dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4dvARB_remap_index]) -#define SET_ProgramEnvParameter4dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4dvARB_remap_index], fn) -#define CALL_ProgramEnvParameter4fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[ProgramEnvParameter4fARB_remap_index], parameters) -#define GET_ProgramEnvParameter4fARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4fARB_remap_index]) -#define SET_ProgramEnvParameter4fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4fARB_remap_index], fn) -#define CALL_ProgramEnvParameter4fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLfloat *)), driDispatchRemapTable[ProgramEnvParameter4fvARB_remap_index], parameters) -#define GET_ProgramEnvParameter4fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4fvARB_remap_index]) -#define SET_ProgramEnvParameter4fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4fvARB_remap_index], fn) -#define CALL_ProgramLocalParameter4dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[ProgramLocalParameter4dARB_remap_index], parameters) -#define GET_ProgramLocalParameter4dARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4dARB_remap_index]) -#define SET_ProgramLocalParameter4dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4dARB_remap_index], fn) -#define CALL_ProgramLocalParameter4dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLdouble *)), driDispatchRemapTable[ProgramLocalParameter4dvARB_remap_index], parameters) -#define GET_ProgramLocalParameter4dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4dvARB_remap_index]) -#define SET_ProgramLocalParameter4dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4dvARB_remap_index], fn) -#define CALL_ProgramLocalParameter4fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[ProgramLocalParameter4fARB_remap_index], parameters) -#define GET_ProgramLocalParameter4fARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4fARB_remap_index]) -#define SET_ProgramLocalParameter4fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4fARB_remap_index], fn) -#define CALL_ProgramLocalParameter4fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLfloat *)), driDispatchRemapTable[ProgramLocalParameter4fvARB_remap_index], parameters) -#define GET_ProgramLocalParameter4fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4fvARB_remap_index]) -#define SET_ProgramLocalParameter4fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4fvARB_remap_index], fn) -#define CALL_ProgramStringARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[ProgramStringARB_remap_index], parameters) -#define GET_ProgramStringARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramStringARB_remap_index]) -#define SET_ProgramStringARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramStringARB_remap_index], fn) -#define CALL_VertexAttrib1dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble)), driDispatchRemapTable[VertexAttrib1dARB_remap_index], parameters) -#define GET_VertexAttrib1dARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dARB_remap_index]) -#define SET_VertexAttrib1dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dARB_remap_index], fn) -#define CALL_VertexAttrib1dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib1dvARB_remap_index], parameters) -#define GET_VertexAttrib1dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dvARB_remap_index]) -#define SET_VertexAttrib1dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dvARB_remap_index], fn) -#define CALL_VertexAttrib1fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat)), driDispatchRemapTable[VertexAttrib1fARB_remap_index], parameters) -#define GET_VertexAttrib1fARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fARB_remap_index]) -#define SET_VertexAttrib1fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fARB_remap_index], fn) -#define CALL_VertexAttrib1fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib1fvARB_remap_index], parameters) -#define GET_VertexAttrib1fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fvARB_remap_index]) -#define SET_VertexAttrib1fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fvARB_remap_index], fn) -#define CALL_VertexAttrib1sARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort)), driDispatchRemapTable[VertexAttrib1sARB_remap_index], parameters) -#define GET_VertexAttrib1sARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1sARB_remap_index]) -#define SET_VertexAttrib1sARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1sARB_remap_index], fn) -#define CALL_VertexAttrib1svARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib1svARB_remap_index], parameters) -#define GET_VertexAttrib1svARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1svARB_remap_index]) -#define SET_VertexAttrib1svARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1svARB_remap_index], fn) -#define CALL_VertexAttrib2dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib2dARB_remap_index], parameters) -#define GET_VertexAttrib2dARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dARB_remap_index]) -#define SET_VertexAttrib2dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dARB_remap_index], fn) -#define CALL_VertexAttrib2dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib2dvARB_remap_index], parameters) -#define GET_VertexAttrib2dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dvARB_remap_index]) -#define SET_VertexAttrib2dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dvARB_remap_index], fn) -#define CALL_VertexAttrib2fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib2fARB_remap_index], parameters) -#define GET_VertexAttrib2fARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fARB_remap_index]) -#define SET_VertexAttrib2fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fARB_remap_index], fn) -#define CALL_VertexAttrib2fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib2fvARB_remap_index], parameters) -#define GET_VertexAttrib2fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fvARB_remap_index]) -#define SET_VertexAttrib2fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fvARB_remap_index], fn) -#define CALL_VertexAttrib2sARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib2sARB_remap_index], parameters) -#define GET_VertexAttrib2sARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2sARB_remap_index]) -#define SET_VertexAttrib2sARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2sARB_remap_index], fn) -#define CALL_VertexAttrib2svARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib2svARB_remap_index], parameters) -#define GET_VertexAttrib2svARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2svARB_remap_index]) -#define SET_VertexAttrib2svARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2svARB_remap_index], fn) -#define CALL_VertexAttrib3dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib3dARB_remap_index], parameters) -#define GET_VertexAttrib3dARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dARB_remap_index]) -#define SET_VertexAttrib3dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dARB_remap_index], fn) -#define CALL_VertexAttrib3dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib3dvARB_remap_index], parameters) -#define GET_VertexAttrib3dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dvARB_remap_index]) -#define SET_VertexAttrib3dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dvARB_remap_index], fn) -#define CALL_VertexAttrib3fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib3fARB_remap_index], parameters) -#define GET_VertexAttrib3fARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fARB_remap_index]) -#define SET_VertexAttrib3fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fARB_remap_index], fn) -#define CALL_VertexAttrib3fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib3fvARB_remap_index], parameters) -#define GET_VertexAttrib3fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fvARB_remap_index]) -#define SET_VertexAttrib3fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fvARB_remap_index], fn) -#define CALL_VertexAttrib3sARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib3sARB_remap_index], parameters) -#define GET_VertexAttrib3sARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3sARB_remap_index]) -#define SET_VertexAttrib3sARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3sARB_remap_index], fn) -#define CALL_VertexAttrib3svARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib3svARB_remap_index], parameters) -#define GET_VertexAttrib3svARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3svARB_remap_index]) -#define SET_VertexAttrib3svARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3svARB_remap_index], fn) -#define CALL_VertexAttrib4NbvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLbyte *)), driDispatchRemapTable[VertexAttrib4NbvARB_remap_index], parameters) -#define GET_VertexAttrib4NbvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NbvARB_remap_index]) -#define SET_VertexAttrib4NbvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NbvARB_remap_index], fn) -#define CALL_VertexAttrib4NivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLint *)), driDispatchRemapTable[VertexAttrib4NivARB_remap_index], parameters) -#define GET_VertexAttrib4NivARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NivARB_remap_index]) -#define SET_VertexAttrib4NivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NivARB_remap_index], fn) -#define CALL_VertexAttrib4NsvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib4NsvARB_remap_index], parameters) -#define GET_VertexAttrib4NsvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NsvARB_remap_index]) -#define SET_VertexAttrib4NsvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NsvARB_remap_index], fn) -#define CALL_VertexAttrib4NubARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte)), driDispatchRemapTable[VertexAttrib4NubARB_remap_index], parameters) -#define GET_VertexAttrib4NubARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NubARB_remap_index]) -#define SET_VertexAttrib4NubARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NubARB_remap_index], fn) -#define CALL_VertexAttrib4NubvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLubyte *)), driDispatchRemapTable[VertexAttrib4NubvARB_remap_index], parameters) -#define GET_VertexAttrib4NubvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NubvARB_remap_index]) -#define SET_VertexAttrib4NubvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NubvARB_remap_index], fn) -#define CALL_VertexAttrib4NuivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLuint *)), driDispatchRemapTable[VertexAttrib4NuivARB_remap_index], parameters) -#define GET_VertexAttrib4NuivARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NuivARB_remap_index]) -#define SET_VertexAttrib4NuivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NuivARB_remap_index], fn) -#define CALL_VertexAttrib4NusvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLushort *)), driDispatchRemapTable[VertexAttrib4NusvARB_remap_index], parameters) -#define GET_VertexAttrib4NusvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NusvARB_remap_index]) -#define SET_VertexAttrib4NusvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NusvARB_remap_index], fn) -#define CALL_VertexAttrib4bvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLbyte *)), driDispatchRemapTable[VertexAttrib4bvARB_remap_index], parameters) -#define GET_VertexAttrib4bvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4bvARB_remap_index]) -#define SET_VertexAttrib4bvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4bvARB_remap_index], fn) -#define CALL_VertexAttrib4dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib4dARB_remap_index], parameters) -#define GET_VertexAttrib4dARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dARB_remap_index]) -#define SET_VertexAttrib4dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dARB_remap_index], fn) -#define CALL_VertexAttrib4dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib4dvARB_remap_index], parameters) -#define GET_VertexAttrib4dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dvARB_remap_index]) -#define SET_VertexAttrib4dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dvARB_remap_index], fn) -#define CALL_VertexAttrib4fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib4fARB_remap_index], parameters) -#define GET_VertexAttrib4fARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fARB_remap_index]) -#define SET_VertexAttrib4fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fARB_remap_index], fn) -#define CALL_VertexAttrib4fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib4fvARB_remap_index], parameters) -#define GET_VertexAttrib4fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fvARB_remap_index]) -#define SET_VertexAttrib4fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fvARB_remap_index], fn) -#define CALL_VertexAttrib4ivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLint *)), driDispatchRemapTable[VertexAttrib4ivARB_remap_index], parameters) -#define GET_VertexAttrib4ivARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ivARB_remap_index]) -#define SET_VertexAttrib4ivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ivARB_remap_index], fn) -#define CALL_VertexAttrib4sARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib4sARB_remap_index], parameters) -#define GET_VertexAttrib4sARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4sARB_remap_index]) -#define SET_VertexAttrib4sARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4sARB_remap_index], fn) -#define CALL_VertexAttrib4svARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib4svARB_remap_index], parameters) -#define GET_VertexAttrib4svARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4svARB_remap_index]) -#define SET_VertexAttrib4svARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4svARB_remap_index], fn) -#define CALL_VertexAttrib4ubvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLubyte *)), driDispatchRemapTable[VertexAttrib4ubvARB_remap_index], parameters) -#define GET_VertexAttrib4ubvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubvARB_remap_index]) -#define SET_VertexAttrib4ubvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubvARB_remap_index], fn) -#define CALL_VertexAttrib4uivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLuint *)), driDispatchRemapTable[VertexAttrib4uivARB_remap_index], parameters) -#define GET_VertexAttrib4uivARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4uivARB_remap_index]) -#define SET_VertexAttrib4uivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4uivARB_remap_index], fn) -#define CALL_VertexAttrib4usvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLushort *)), driDispatchRemapTable[VertexAttrib4usvARB_remap_index], parameters) -#define GET_VertexAttrib4usvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4usvARB_remap_index]) -#define SET_VertexAttrib4usvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4usvARB_remap_index], fn) -#define CALL_VertexAttribPointerARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *)), driDispatchRemapTable[VertexAttribPointerARB_remap_index], parameters) -#define GET_VertexAttribPointerARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribPointerARB_remap_index]) -#define SET_VertexAttribPointerARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribPointerARB_remap_index], fn) -#define CALL_BindBufferARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[BindBufferARB_remap_index], parameters) -#define GET_BindBufferARB(disp) GET_by_offset(disp, driDispatchRemapTable[BindBufferARB_remap_index]) -#define SET_BindBufferARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindBufferARB_remap_index], fn) -#define CALL_BufferDataARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizeiptrARB, const GLvoid *, GLenum)), driDispatchRemapTable[BufferDataARB_remap_index], parameters) -#define GET_BufferDataARB(disp) GET_by_offset(disp, driDispatchRemapTable[BufferDataARB_remap_index]) -#define SET_BufferDataARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BufferDataARB_remap_index], fn) -#define CALL_BufferSubDataARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *)), driDispatchRemapTable[BufferSubDataARB_remap_index], parameters) -#define GET_BufferSubDataARB(disp) GET_by_offset(disp, driDispatchRemapTable[BufferSubDataARB_remap_index]) -#define SET_BufferSubDataARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BufferSubDataARB_remap_index], fn) -#define CALL_DeleteBuffersARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteBuffersARB_remap_index], parameters) -#define GET_DeleteBuffersARB(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteBuffersARB_remap_index]) -#define SET_DeleteBuffersARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteBuffersARB_remap_index], fn) -#define CALL_GenBuffersARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenBuffersARB_remap_index], parameters) -#define GET_GenBuffersARB(disp) GET_by_offset(disp, driDispatchRemapTable[GenBuffersARB_remap_index]) -#define SET_GenBuffersARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenBuffersARB_remap_index], fn) -#define CALL_GetBufferParameterivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetBufferParameterivARB_remap_index], parameters) -#define GET_GetBufferParameterivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetBufferParameterivARB_remap_index]) -#define SET_GetBufferParameterivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetBufferParameterivARB_remap_index], fn) -#define CALL_GetBufferPointervARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLvoid **)), driDispatchRemapTable[GetBufferPointervARB_remap_index], parameters) -#define GET_GetBufferPointervARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetBufferPointervARB_remap_index]) -#define SET_GetBufferPointervARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetBufferPointervARB_remap_index], fn) -#define CALL_GetBufferSubDataARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *)), driDispatchRemapTable[GetBufferSubDataARB_remap_index], parameters) -#define GET_GetBufferSubDataARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetBufferSubDataARB_remap_index]) -#define SET_GetBufferSubDataARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetBufferSubDataARB_remap_index], fn) -#define CALL_IsBufferARB(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsBufferARB_remap_index], parameters) -#define GET_IsBufferARB(disp) GET_by_offset(disp, driDispatchRemapTable[IsBufferARB_remap_index]) -#define SET_IsBufferARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsBufferARB_remap_index], fn) -#define CALL_MapBufferARB(disp, parameters) CALL_by_offset(disp, (GLvoid * (GLAPIENTRYP)(GLenum, GLenum)), driDispatchRemapTable[MapBufferARB_remap_index], parameters) -#define GET_MapBufferARB(disp) GET_by_offset(disp, driDispatchRemapTable[MapBufferARB_remap_index]) -#define SET_MapBufferARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MapBufferARB_remap_index], fn) -#define CALL_UnmapBufferARB(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[UnmapBufferARB_remap_index], parameters) -#define GET_UnmapBufferARB(disp) GET_by_offset(disp, driDispatchRemapTable[UnmapBufferARB_remap_index]) -#define SET_UnmapBufferARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UnmapBufferARB_remap_index], fn) -#define CALL_BeginQueryARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[BeginQueryARB_remap_index], parameters) -#define GET_BeginQueryARB(disp) GET_by_offset(disp, driDispatchRemapTable[BeginQueryARB_remap_index]) -#define SET_BeginQueryARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BeginQueryARB_remap_index], fn) -#define CALL_DeleteQueriesARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteQueriesARB_remap_index], parameters) -#define GET_DeleteQueriesARB(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteQueriesARB_remap_index]) -#define SET_DeleteQueriesARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteQueriesARB_remap_index], fn) -#define CALL_EndQueryARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[EndQueryARB_remap_index], parameters) -#define GET_EndQueryARB(disp) GET_by_offset(disp, driDispatchRemapTable[EndQueryARB_remap_index]) -#define SET_EndQueryARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[EndQueryARB_remap_index], fn) -#define CALL_GenQueriesARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenQueriesARB_remap_index], parameters) -#define GET_GenQueriesARB(disp) GET_by_offset(disp, driDispatchRemapTable[GenQueriesARB_remap_index]) -#define SET_GenQueriesARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenQueriesARB_remap_index], fn) -#define CALL_GetQueryObjectivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetQueryObjectivARB_remap_index], parameters) -#define GET_GetQueryObjectivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetQueryObjectivARB_remap_index]) -#define SET_GetQueryObjectivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetQueryObjectivARB_remap_index], fn) -#define CALL_GetQueryObjectuivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLuint *)), driDispatchRemapTable[GetQueryObjectuivARB_remap_index], parameters) -#define GET_GetQueryObjectuivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetQueryObjectuivARB_remap_index]) -#define SET_GetQueryObjectuivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetQueryObjectuivARB_remap_index], fn) -#define CALL_GetQueryivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetQueryivARB_remap_index], parameters) -#define GET_GetQueryivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetQueryivARB_remap_index]) -#define SET_GetQueryivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetQueryivARB_remap_index], fn) -#define CALL_IsQueryARB(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsQueryARB_remap_index], parameters) -#define GET_IsQueryARB(disp) GET_by_offset(disp, driDispatchRemapTable[IsQueryARB_remap_index]) -#define SET_IsQueryARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsQueryARB_remap_index], fn) -#define CALL_AttachObjectARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLhandleARB)), driDispatchRemapTable[AttachObjectARB_remap_index], parameters) -#define GET_AttachObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[AttachObjectARB_remap_index]) -#define SET_AttachObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AttachObjectARB_remap_index], fn) -#define CALL_CompileShaderARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB)), driDispatchRemapTable[CompileShaderARB_remap_index], parameters) -#define GET_CompileShaderARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompileShaderARB_remap_index]) -#define SET_CompileShaderARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompileShaderARB_remap_index], fn) -#define CALL_CreateProgramObjectARB(disp, parameters) CALL_by_offset(disp, (GLhandleARB (GLAPIENTRYP)(void)), driDispatchRemapTable[CreateProgramObjectARB_remap_index], parameters) -#define GET_CreateProgramObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[CreateProgramObjectARB_remap_index]) -#define SET_CreateProgramObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CreateProgramObjectARB_remap_index], fn) -#define CALL_CreateShaderObjectARB(disp, parameters) CALL_by_offset(disp, (GLhandleARB (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[CreateShaderObjectARB_remap_index], parameters) -#define GET_CreateShaderObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[CreateShaderObjectARB_remap_index]) -#define SET_CreateShaderObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CreateShaderObjectARB_remap_index], fn) -#define CALL_DeleteObjectARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB)), driDispatchRemapTable[DeleteObjectARB_remap_index], parameters) -#define GET_DeleteObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteObjectARB_remap_index]) -#define SET_DeleteObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteObjectARB_remap_index], fn) -#define CALL_DetachObjectARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLhandleARB)), driDispatchRemapTable[DetachObjectARB_remap_index], parameters) -#define GET_DetachObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[DetachObjectARB_remap_index]) -#define SET_DetachObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DetachObjectARB_remap_index], fn) -#define CALL_GetActiveUniformARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *)), driDispatchRemapTable[GetActiveUniformARB_remap_index], parameters) -#define GET_GetActiveUniformARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetActiveUniformARB_remap_index]) -#define SET_GetActiveUniformARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetActiveUniformARB_remap_index], fn) -#define CALL_GetAttachedObjectsARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLsizei, GLsizei *, GLhandleARB *)), driDispatchRemapTable[GetAttachedObjectsARB_remap_index], parameters) -#define GET_GetAttachedObjectsARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetAttachedObjectsARB_remap_index]) -#define SET_GetAttachedObjectsARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetAttachedObjectsARB_remap_index], fn) -#define CALL_GetHandleARB(disp, parameters) CALL_by_offset(disp, (GLhandleARB (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[GetHandleARB_remap_index], parameters) -#define GET_GetHandleARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetHandleARB_remap_index]) -#define SET_GetHandleARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetHandleARB_remap_index], fn) -#define CALL_GetInfoLogARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *)), driDispatchRemapTable[GetInfoLogARB_remap_index], parameters) -#define GET_GetInfoLogARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetInfoLogARB_remap_index]) -#define SET_GetInfoLogARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetInfoLogARB_remap_index], fn) -#define CALL_GetObjectParameterfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLenum, GLfloat *)), driDispatchRemapTable[GetObjectParameterfvARB_remap_index], parameters) -#define GET_GetObjectParameterfvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetObjectParameterfvARB_remap_index]) -#define SET_GetObjectParameterfvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetObjectParameterfvARB_remap_index], fn) -#define CALL_GetObjectParameterivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLenum, GLint *)), driDispatchRemapTable[GetObjectParameterivARB_remap_index], parameters) -#define GET_GetObjectParameterivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetObjectParameterivARB_remap_index]) -#define SET_GetObjectParameterivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetObjectParameterivARB_remap_index], fn) -#define CALL_GetShaderSourceARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *)), driDispatchRemapTable[GetShaderSourceARB_remap_index], parameters) -#define GET_GetShaderSourceARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetShaderSourceARB_remap_index]) -#define SET_GetShaderSourceARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetShaderSourceARB_remap_index], fn) -#define CALL_GetUniformLocationARB(disp, parameters) CALL_by_offset(disp, (GLint (GLAPIENTRYP)(GLhandleARB, const GLcharARB *)), driDispatchRemapTable[GetUniformLocationARB_remap_index], parameters) -#define GET_GetUniformLocationARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetUniformLocationARB_remap_index]) -#define SET_GetUniformLocationARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetUniformLocationARB_remap_index], fn) -#define CALL_GetUniformfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLint, GLfloat *)), driDispatchRemapTable[GetUniformfvARB_remap_index], parameters) -#define GET_GetUniformfvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetUniformfvARB_remap_index]) -#define SET_GetUniformfvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetUniformfvARB_remap_index], fn) -#define CALL_GetUniformivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLint, GLint *)), driDispatchRemapTable[GetUniformivARB_remap_index], parameters) -#define GET_GetUniformivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetUniformivARB_remap_index]) -#define SET_GetUniformivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetUniformivARB_remap_index], fn) -#define CALL_LinkProgramARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB)), driDispatchRemapTable[LinkProgramARB_remap_index], parameters) -#define GET_LinkProgramARB(disp) GET_by_offset(disp, driDispatchRemapTable[LinkProgramARB_remap_index]) -#define SET_LinkProgramARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LinkProgramARB_remap_index], fn) -#define CALL_ShaderSourceARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLsizei, const GLcharARB **, const GLint *)), driDispatchRemapTable[ShaderSourceARB_remap_index], parameters) -#define GET_ShaderSourceARB(disp) GET_by_offset(disp, driDispatchRemapTable[ShaderSourceARB_remap_index]) -#define SET_ShaderSourceARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ShaderSourceARB_remap_index], fn) -#define CALL_Uniform1fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLfloat)), driDispatchRemapTable[Uniform1fARB_remap_index], parameters) -#define GET_Uniform1fARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform1fARB_remap_index]) -#define SET_Uniform1fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform1fARB_remap_index], fn) -#define CALL_Uniform1fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLfloat *)), driDispatchRemapTable[Uniform1fvARB_remap_index], parameters) -#define GET_Uniform1fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform1fvARB_remap_index]) -#define SET_Uniform1fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform1fvARB_remap_index], fn) -#define CALL_Uniform1iARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint)), driDispatchRemapTable[Uniform1iARB_remap_index], parameters) -#define GET_Uniform1iARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform1iARB_remap_index]) -#define SET_Uniform1iARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform1iARB_remap_index], fn) -#define CALL_Uniform1ivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLint *)), driDispatchRemapTable[Uniform1ivARB_remap_index], parameters) -#define GET_Uniform1ivARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform1ivARB_remap_index]) -#define SET_Uniform1ivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform1ivARB_remap_index], fn) -#define CALL_Uniform2fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLfloat, GLfloat)), driDispatchRemapTable[Uniform2fARB_remap_index], parameters) -#define GET_Uniform2fARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform2fARB_remap_index]) -#define SET_Uniform2fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform2fARB_remap_index], fn) -#define CALL_Uniform2fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLfloat *)), driDispatchRemapTable[Uniform2fvARB_remap_index], parameters) -#define GET_Uniform2fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform2fvARB_remap_index]) -#define SET_Uniform2fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform2fvARB_remap_index], fn) -#define CALL_Uniform2iARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint)), driDispatchRemapTable[Uniform2iARB_remap_index], parameters) -#define GET_Uniform2iARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform2iARB_remap_index]) -#define SET_Uniform2iARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform2iARB_remap_index], fn) -#define CALL_Uniform2ivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLint *)), driDispatchRemapTable[Uniform2ivARB_remap_index], parameters) -#define GET_Uniform2ivARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform2ivARB_remap_index]) -#define SET_Uniform2ivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform2ivARB_remap_index], fn) -#define CALL_Uniform3fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[Uniform3fARB_remap_index], parameters) -#define GET_Uniform3fARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform3fARB_remap_index]) -#define SET_Uniform3fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform3fARB_remap_index], fn) -#define CALL_Uniform3fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLfloat *)), driDispatchRemapTable[Uniform3fvARB_remap_index], parameters) -#define GET_Uniform3fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform3fvARB_remap_index]) -#define SET_Uniform3fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform3fvARB_remap_index], fn) -#define CALL_Uniform3iARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint, GLint)), driDispatchRemapTable[Uniform3iARB_remap_index], parameters) -#define GET_Uniform3iARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform3iARB_remap_index]) -#define SET_Uniform3iARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform3iARB_remap_index], fn) -#define CALL_Uniform3ivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLint *)), driDispatchRemapTable[Uniform3ivARB_remap_index], parameters) -#define GET_Uniform3ivARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform3ivARB_remap_index]) -#define SET_Uniform3ivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform3ivARB_remap_index], fn) -#define CALL_Uniform4fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[Uniform4fARB_remap_index], parameters) -#define GET_Uniform4fARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform4fARB_remap_index]) -#define SET_Uniform4fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform4fARB_remap_index], fn) -#define CALL_Uniform4fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLfloat *)), driDispatchRemapTable[Uniform4fvARB_remap_index], parameters) -#define GET_Uniform4fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform4fvARB_remap_index]) -#define SET_Uniform4fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform4fvARB_remap_index], fn) -#define CALL_Uniform4iARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint, GLint, GLint)), driDispatchRemapTable[Uniform4iARB_remap_index], parameters) -#define GET_Uniform4iARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform4iARB_remap_index]) -#define SET_Uniform4iARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform4iARB_remap_index], fn) -#define CALL_Uniform4ivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLint *)), driDispatchRemapTable[Uniform4ivARB_remap_index], parameters) -#define GET_Uniform4ivARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform4ivARB_remap_index]) -#define SET_Uniform4ivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform4ivARB_remap_index], fn) -#define CALL_UniformMatrix2fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix2fvARB_remap_index], parameters) -#define GET_UniformMatrix2fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix2fvARB_remap_index]) -#define SET_UniformMatrix2fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix2fvARB_remap_index], fn) -#define CALL_UniformMatrix3fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix3fvARB_remap_index], parameters) -#define GET_UniformMatrix3fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix3fvARB_remap_index]) -#define SET_UniformMatrix3fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix3fvARB_remap_index], fn) -#define CALL_UniformMatrix4fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix4fvARB_remap_index], parameters) -#define GET_UniformMatrix4fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix4fvARB_remap_index]) -#define SET_UniformMatrix4fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix4fvARB_remap_index], fn) -#define CALL_UseProgramObjectARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB)), driDispatchRemapTable[UseProgramObjectARB_remap_index], parameters) -#define GET_UseProgramObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[UseProgramObjectARB_remap_index]) -#define SET_UseProgramObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UseProgramObjectARB_remap_index], fn) -#define CALL_ValidateProgramARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB)), driDispatchRemapTable[ValidateProgramARB_remap_index], parameters) -#define GET_ValidateProgramARB(disp) GET_by_offset(disp, driDispatchRemapTable[ValidateProgramARB_remap_index]) -#define SET_ValidateProgramARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ValidateProgramARB_remap_index], fn) -#define CALL_BindAttribLocationARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLuint, const GLcharARB *)), driDispatchRemapTable[BindAttribLocationARB_remap_index], parameters) -#define GET_BindAttribLocationARB(disp) GET_by_offset(disp, driDispatchRemapTable[BindAttribLocationARB_remap_index]) -#define SET_BindAttribLocationARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindAttribLocationARB_remap_index], fn) -#define CALL_GetActiveAttribARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *)), driDispatchRemapTable[GetActiveAttribARB_remap_index], parameters) -#define GET_GetActiveAttribARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetActiveAttribARB_remap_index]) -#define SET_GetActiveAttribARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetActiveAttribARB_remap_index], fn) -#define CALL_GetAttribLocationARB(disp, parameters) CALL_by_offset(disp, (GLint (GLAPIENTRYP)(GLhandleARB, const GLcharARB *)), driDispatchRemapTable[GetAttribLocationARB_remap_index], parameters) -#define GET_GetAttribLocationARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetAttribLocationARB_remap_index]) -#define SET_GetAttribLocationARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetAttribLocationARB_remap_index], fn) -#define CALL_DrawBuffersARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLenum *)), driDispatchRemapTable[DrawBuffersARB_remap_index], parameters) -#define GET_DrawBuffersARB(disp) GET_by_offset(disp, driDispatchRemapTable[DrawBuffersARB_remap_index]) -#define SET_DrawBuffersARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DrawBuffersARB_remap_index], fn) -#define CALL_RenderbufferStorageMultisample(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, GLenum, GLsizei, GLsizei)), driDispatchRemapTable[RenderbufferStorageMultisample_remap_index], parameters) -#define GET_RenderbufferStorageMultisample(disp) GET_by_offset(disp, driDispatchRemapTable[RenderbufferStorageMultisample_remap_index]) -#define SET_RenderbufferStorageMultisample(disp, fn) SET_by_offset(disp, driDispatchRemapTable[RenderbufferStorageMultisample_remap_index], fn) -#define CALL_FlushMappedBufferRange(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLintptr, GLsizeiptr)), driDispatchRemapTable[FlushMappedBufferRange_remap_index], parameters) -#define GET_FlushMappedBufferRange(disp) GET_by_offset(disp, driDispatchRemapTable[FlushMappedBufferRange_remap_index]) -#define SET_FlushMappedBufferRange(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FlushMappedBufferRange_remap_index], fn) -#define CALL_MapBufferRange(disp, parameters) CALL_by_offset(disp, (GLvoid * (GLAPIENTRYP)(GLenum, GLintptr, GLsizeiptr, GLbitfield)), driDispatchRemapTable[MapBufferRange_remap_index], parameters) -#define GET_MapBufferRange(disp) GET_by_offset(disp, driDispatchRemapTable[MapBufferRange_remap_index]) -#define SET_MapBufferRange(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MapBufferRange_remap_index], fn) -#define CALL_BindVertexArray(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[BindVertexArray_remap_index], parameters) -#define GET_BindVertexArray(disp) GET_by_offset(disp, driDispatchRemapTable[BindVertexArray_remap_index]) -#define SET_BindVertexArray(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindVertexArray_remap_index], fn) -#define CALL_GenVertexArrays(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenVertexArrays_remap_index], parameters) -#define GET_GenVertexArrays(disp) GET_by_offset(disp, driDispatchRemapTable[GenVertexArrays_remap_index]) -#define SET_GenVertexArrays(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenVertexArrays_remap_index], fn) -#define CALL_CopyBufferSubData(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr)), driDispatchRemapTable[CopyBufferSubData_remap_index], parameters) -#define GET_CopyBufferSubData(disp) GET_by_offset(disp, driDispatchRemapTable[CopyBufferSubData_remap_index]) -#define SET_CopyBufferSubData(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CopyBufferSubData_remap_index], fn) -#define CALL_ClientWaitSync(disp, parameters) CALL_by_offset(disp, (GLenum (GLAPIENTRYP)(GLsync, GLbitfield, GLuint64)), driDispatchRemapTable[ClientWaitSync_remap_index], parameters) -#define GET_ClientWaitSync(disp) GET_by_offset(disp, driDispatchRemapTable[ClientWaitSync_remap_index]) -#define SET_ClientWaitSync(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ClientWaitSync_remap_index], fn) -#define CALL_DeleteSync(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsync)), driDispatchRemapTable[DeleteSync_remap_index], parameters) -#define GET_DeleteSync(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteSync_remap_index]) -#define SET_DeleteSync(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteSync_remap_index], fn) -#define CALL_FenceSync(disp, parameters) CALL_by_offset(disp, (GLsync (GLAPIENTRYP)(GLenum, GLbitfield)), driDispatchRemapTable[FenceSync_remap_index], parameters) -#define GET_FenceSync(disp) GET_by_offset(disp, driDispatchRemapTable[FenceSync_remap_index]) -#define SET_FenceSync(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FenceSync_remap_index], fn) -#define CALL_GetInteger64v(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint64 *)), driDispatchRemapTable[GetInteger64v_remap_index], parameters) -#define GET_GetInteger64v(disp) GET_by_offset(disp, driDispatchRemapTable[GetInteger64v_remap_index]) -#define SET_GetInteger64v(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetInteger64v_remap_index], fn) -#define CALL_GetSynciv(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsync, GLenum, GLsizei, GLsizei *, GLint *)), driDispatchRemapTable[GetSynciv_remap_index], parameters) -#define GET_GetSynciv(disp) GET_by_offset(disp, driDispatchRemapTable[GetSynciv_remap_index]) -#define SET_GetSynciv(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetSynciv_remap_index], fn) -#define CALL_IsSync(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLsync)), driDispatchRemapTable[IsSync_remap_index], parameters) -#define GET_IsSync(disp) GET_by_offset(disp, driDispatchRemapTable[IsSync_remap_index]) -#define SET_IsSync(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsSync_remap_index], fn) -#define CALL_WaitSync(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsync, GLbitfield, GLuint64)), driDispatchRemapTable[WaitSync_remap_index], parameters) -#define GET_WaitSync(disp) GET_by_offset(disp, driDispatchRemapTable[WaitSync_remap_index]) -#define SET_WaitSync(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WaitSync_remap_index], fn) -#define CALL_DrawElementsBaseVertex(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, GLenum, const GLvoid *, GLint)), driDispatchRemapTable[DrawElementsBaseVertex_remap_index], parameters) -#define GET_DrawElementsBaseVertex(disp) GET_by_offset(disp, driDispatchRemapTable[DrawElementsBaseVertex_remap_index]) -#define SET_DrawElementsBaseVertex(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DrawElementsBaseVertex_remap_index], fn) -#define CALL_DrawRangeElementsBaseVertex(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *, GLint)), driDispatchRemapTable[DrawRangeElementsBaseVertex_remap_index], parameters) -#define GET_DrawRangeElementsBaseVertex(disp) GET_by_offset(disp, driDispatchRemapTable[DrawRangeElementsBaseVertex_remap_index]) -#define SET_DrawRangeElementsBaseVertex(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DrawRangeElementsBaseVertex_remap_index], fn) -#define CALL_MultiDrawElementsBaseVertex(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLsizei *, GLenum, const GLvoid **, GLsizei, const GLint *)), driDispatchRemapTable[MultiDrawElementsBaseVertex_remap_index], parameters) -#define GET_MultiDrawElementsBaseVertex(disp) GET_by_offset(disp, driDispatchRemapTable[MultiDrawElementsBaseVertex_remap_index]) -#define SET_MultiDrawElementsBaseVertex(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultiDrawElementsBaseVertex_remap_index], fn) -#define CALL_PolygonOffsetEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat)), driDispatchRemapTable[PolygonOffsetEXT_remap_index], parameters) -#define GET_PolygonOffsetEXT(disp) GET_by_offset(disp, driDispatchRemapTable[PolygonOffsetEXT_remap_index]) -#define SET_PolygonOffsetEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PolygonOffsetEXT_remap_index], fn) -#define CALL_GetPixelTexGenParameterfvSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat *)), driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index], parameters) -#define GET_GetPixelTexGenParameterfvSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index]) -#define SET_GetPixelTexGenParameterfvSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index], fn) -#define CALL_GetPixelTexGenParameterivSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint *)), driDispatchRemapTable[GetPixelTexGenParameterivSGIS_remap_index], parameters) -#define GET_GetPixelTexGenParameterivSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[GetPixelTexGenParameterivSGIS_remap_index]) -#define SET_GetPixelTexGenParameterivSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetPixelTexGenParameterivSGIS_remap_index], fn) -#define CALL_PixelTexGenParameterfSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat)), driDispatchRemapTable[PixelTexGenParameterfSGIS_remap_index], parameters) -#define GET_PixelTexGenParameterfSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterfSGIS_remap_index]) -#define SET_PixelTexGenParameterfSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterfSGIS_remap_index], fn) -#define CALL_PixelTexGenParameterfvSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLfloat *)), driDispatchRemapTable[PixelTexGenParameterfvSGIS_remap_index], parameters) -#define GET_PixelTexGenParameterfvSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterfvSGIS_remap_index]) -#define SET_PixelTexGenParameterfvSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterfvSGIS_remap_index], fn) -#define CALL_PixelTexGenParameteriSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint)), driDispatchRemapTable[PixelTexGenParameteriSGIS_remap_index], parameters) -#define GET_PixelTexGenParameteriSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameteriSGIS_remap_index]) -#define SET_PixelTexGenParameteriSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameteriSGIS_remap_index], fn) -#define CALL_PixelTexGenParameterivSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLint *)), driDispatchRemapTable[PixelTexGenParameterivSGIS_remap_index], parameters) -#define GET_PixelTexGenParameterivSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterivSGIS_remap_index]) -#define SET_PixelTexGenParameterivSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterivSGIS_remap_index], fn) -#define CALL_SampleMaskSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLclampf, GLboolean)), driDispatchRemapTable[SampleMaskSGIS_remap_index], parameters) -#define GET_SampleMaskSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[SampleMaskSGIS_remap_index]) -#define SET_SampleMaskSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SampleMaskSGIS_remap_index], fn) -#define CALL_SamplePatternSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[SamplePatternSGIS_remap_index], parameters) -#define GET_SamplePatternSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[SamplePatternSGIS_remap_index]) -#define SET_SamplePatternSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SamplePatternSGIS_remap_index], fn) -#define CALL_ColorPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *)), driDispatchRemapTable[ColorPointerEXT_remap_index], parameters) -#define GET_ColorPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ColorPointerEXT_remap_index]) -#define SET_ColorPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ColorPointerEXT_remap_index], fn) -#define CALL_EdgeFlagPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLsizei, const GLboolean *)), driDispatchRemapTable[EdgeFlagPointerEXT_remap_index], parameters) -#define GET_EdgeFlagPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[EdgeFlagPointerEXT_remap_index]) -#define SET_EdgeFlagPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[EdgeFlagPointerEXT_remap_index], fn) -#define CALL_IndexPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, GLsizei, const GLvoid *)), driDispatchRemapTable[IndexPointerEXT_remap_index], parameters) -#define GET_IndexPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[IndexPointerEXT_remap_index]) -#define SET_IndexPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IndexPointerEXT_remap_index], fn) -#define CALL_NormalPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, GLsizei, const GLvoid *)), driDispatchRemapTable[NormalPointerEXT_remap_index], parameters) -#define GET_NormalPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[NormalPointerEXT_remap_index]) -#define SET_NormalPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[NormalPointerEXT_remap_index], fn) -#define CALL_TexCoordPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *)), driDispatchRemapTable[TexCoordPointerEXT_remap_index], parameters) -#define GET_TexCoordPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[TexCoordPointerEXT_remap_index]) -#define SET_TexCoordPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TexCoordPointerEXT_remap_index], fn) -#define CALL_VertexPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *)), driDispatchRemapTable[VertexPointerEXT_remap_index], parameters) -#define GET_VertexPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[VertexPointerEXT_remap_index]) -#define SET_VertexPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexPointerEXT_remap_index], fn) -#define CALL_PointParameterfEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat)), driDispatchRemapTable[PointParameterfEXT_remap_index], parameters) -#define GET_PointParameterfEXT(disp) GET_by_offset(disp, driDispatchRemapTable[PointParameterfEXT_remap_index]) -#define SET_PointParameterfEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PointParameterfEXT_remap_index], fn) -#define CALL_PointParameterfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLfloat *)), driDispatchRemapTable[PointParameterfvEXT_remap_index], parameters) -#define GET_PointParameterfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[PointParameterfvEXT_remap_index]) -#define SET_PointParameterfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PointParameterfvEXT_remap_index], fn) -#define CALL_LockArraysEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei)), driDispatchRemapTable[LockArraysEXT_remap_index], parameters) -#define GET_LockArraysEXT(disp) GET_by_offset(disp, driDispatchRemapTable[LockArraysEXT_remap_index]) -#define SET_LockArraysEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LockArraysEXT_remap_index], fn) -#define CALL_UnlockArraysEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[UnlockArraysEXT_remap_index], parameters) -#define GET_UnlockArraysEXT(disp) GET_by_offset(disp, driDispatchRemapTable[UnlockArraysEXT_remap_index]) -#define SET_UnlockArraysEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UnlockArraysEXT_remap_index], fn) -#define CALL_CullParameterdvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLdouble *)), driDispatchRemapTable[CullParameterdvEXT_remap_index], parameters) -#define GET_CullParameterdvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[CullParameterdvEXT_remap_index]) -#define SET_CullParameterdvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CullParameterdvEXT_remap_index], fn) -#define CALL_CullParameterfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat *)), driDispatchRemapTable[CullParameterfvEXT_remap_index], parameters) -#define GET_CullParameterfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[CullParameterfvEXT_remap_index]) -#define SET_CullParameterfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CullParameterfvEXT_remap_index], fn) -#define CALL_SecondaryColor3bEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLbyte, GLbyte, GLbyte)), driDispatchRemapTable[SecondaryColor3bEXT_remap_index], parameters) -#define GET_SecondaryColor3bEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3bEXT_remap_index]) -#define SET_SecondaryColor3bEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3bEXT_remap_index], fn) -#define CALL_SecondaryColor3bvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLbyte *)), driDispatchRemapTable[SecondaryColor3bvEXT_remap_index], parameters) -#define GET_SecondaryColor3bvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3bvEXT_remap_index]) -#define SET_SecondaryColor3bvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3bvEXT_remap_index], fn) -#define CALL_SecondaryColor3dEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[SecondaryColor3dEXT_remap_index], parameters) -#define GET_SecondaryColor3dEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3dEXT_remap_index]) -#define SET_SecondaryColor3dEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3dEXT_remap_index], fn) -#define CALL_SecondaryColor3dvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[SecondaryColor3dvEXT_remap_index], parameters) -#define GET_SecondaryColor3dvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3dvEXT_remap_index]) -#define SET_SecondaryColor3dvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3dvEXT_remap_index], fn) -#define CALL_SecondaryColor3fEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[SecondaryColor3fEXT_remap_index], parameters) -#define GET_SecondaryColor3fEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3fEXT_remap_index]) -#define SET_SecondaryColor3fEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3fEXT_remap_index], fn) -#define CALL_SecondaryColor3fvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[SecondaryColor3fvEXT_remap_index], parameters) -#define GET_SecondaryColor3fvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3fvEXT_remap_index]) -#define SET_SecondaryColor3fvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3fvEXT_remap_index], fn) -#define CALL_SecondaryColor3iEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint)), driDispatchRemapTable[SecondaryColor3iEXT_remap_index], parameters) -#define GET_SecondaryColor3iEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3iEXT_remap_index]) -#define SET_SecondaryColor3iEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3iEXT_remap_index], fn) -#define CALL_SecondaryColor3ivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLint *)), driDispatchRemapTable[SecondaryColor3ivEXT_remap_index], parameters) -#define GET_SecondaryColor3ivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ivEXT_remap_index]) -#define SET_SecondaryColor3ivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ivEXT_remap_index], fn) -#define CALL_SecondaryColor3sEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLshort, GLshort, GLshort)), driDispatchRemapTable[SecondaryColor3sEXT_remap_index], parameters) -#define GET_SecondaryColor3sEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3sEXT_remap_index]) -#define SET_SecondaryColor3sEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3sEXT_remap_index], fn) -#define CALL_SecondaryColor3svEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLshort *)), driDispatchRemapTable[SecondaryColor3svEXT_remap_index], parameters) -#define GET_SecondaryColor3svEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3svEXT_remap_index]) -#define SET_SecondaryColor3svEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3svEXT_remap_index], fn) -#define CALL_SecondaryColor3ubEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLubyte, GLubyte, GLubyte)), driDispatchRemapTable[SecondaryColor3ubEXT_remap_index], parameters) -#define GET_SecondaryColor3ubEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ubEXT_remap_index]) -#define SET_SecondaryColor3ubEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ubEXT_remap_index], fn) -#define CALL_SecondaryColor3ubvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLubyte *)), driDispatchRemapTable[SecondaryColor3ubvEXT_remap_index], parameters) -#define GET_SecondaryColor3ubvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ubvEXT_remap_index]) -#define SET_SecondaryColor3ubvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ubvEXT_remap_index], fn) -#define CALL_SecondaryColor3uiEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint, GLuint)), driDispatchRemapTable[SecondaryColor3uiEXT_remap_index], parameters) -#define GET_SecondaryColor3uiEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3uiEXT_remap_index]) -#define SET_SecondaryColor3uiEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3uiEXT_remap_index], fn) -#define CALL_SecondaryColor3uivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLuint *)), driDispatchRemapTable[SecondaryColor3uivEXT_remap_index], parameters) -#define GET_SecondaryColor3uivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3uivEXT_remap_index]) -#define SET_SecondaryColor3uivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3uivEXT_remap_index], fn) -#define CALL_SecondaryColor3usEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLushort, GLushort, GLushort)), driDispatchRemapTable[SecondaryColor3usEXT_remap_index], parameters) -#define GET_SecondaryColor3usEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3usEXT_remap_index]) -#define SET_SecondaryColor3usEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3usEXT_remap_index], fn) -#define CALL_SecondaryColor3usvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLushort *)), driDispatchRemapTable[SecondaryColor3usvEXT_remap_index], parameters) -#define GET_SecondaryColor3usvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3usvEXT_remap_index]) -#define SET_SecondaryColor3usvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3usvEXT_remap_index], fn) -#define CALL_SecondaryColorPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[SecondaryColorPointerEXT_remap_index], parameters) -#define GET_SecondaryColorPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColorPointerEXT_remap_index]) -#define SET_SecondaryColorPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColorPointerEXT_remap_index], fn) -#define CALL_MultiDrawArraysEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint *, GLsizei *, GLsizei)), driDispatchRemapTable[MultiDrawArraysEXT_remap_index], parameters) -#define GET_MultiDrawArraysEXT(disp) GET_by_offset(disp, driDispatchRemapTable[MultiDrawArraysEXT_remap_index]) -#define SET_MultiDrawArraysEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultiDrawArraysEXT_remap_index], fn) -#define CALL_MultiDrawElementsEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLsizei *, GLenum, const GLvoid **, GLsizei)), driDispatchRemapTable[MultiDrawElementsEXT_remap_index], parameters) -#define GET_MultiDrawElementsEXT(disp) GET_by_offset(disp, driDispatchRemapTable[MultiDrawElementsEXT_remap_index]) -#define SET_MultiDrawElementsEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultiDrawElementsEXT_remap_index], fn) -#define CALL_FogCoordPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[FogCoordPointerEXT_remap_index], parameters) -#define GET_FogCoordPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FogCoordPointerEXT_remap_index]) -#define SET_FogCoordPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FogCoordPointerEXT_remap_index], fn) -#define CALL_FogCoorddEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLdouble)), driDispatchRemapTable[FogCoorddEXT_remap_index], parameters) -#define GET_FogCoorddEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FogCoorddEXT_remap_index]) -#define SET_FogCoorddEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FogCoorddEXT_remap_index], fn) -#define CALL_FogCoorddvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[FogCoorddvEXT_remap_index], parameters) -#define GET_FogCoorddvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FogCoorddvEXT_remap_index]) -#define SET_FogCoorddvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FogCoorddvEXT_remap_index], fn) -#define CALL_FogCoordfEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat)), driDispatchRemapTable[FogCoordfEXT_remap_index], parameters) -#define GET_FogCoordfEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FogCoordfEXT_remap_index]) -#define SET_FogCoordfEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FogCoordfEXT_remap_index], fn) -#define CALL_FogCoordfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[FogCoordfvEXT_remap_index], parameters) -#define GET_FogCoordfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FogCoordfvEXT_remap_index]) -#define SET_FogCoordfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FogCoordfvEXT_remap_index], fn) -#define CALL_PixelTexGenSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[PixelTexGenSGIX_remap_index], parameters) -#define GET_PixelTexGenSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[PixelTexGenSGIX_remap_index]) -#define SET_PixelTexGenSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PixelTexGenSGIX_remap_index], fn) -#define CALL_BlendFuncSeparateEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum)), driDispatchRemapTable[BlendFuncSeparateEXT_remap_index], parameters) -#define GET_BlendFuncSeparateEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BlendFuncSeparateEXT_remap_index]) -#define SET_BlendFuncSeparateEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BlendFuncSeparateEXT_remap_index], fn) -#define CALL_FlushVertexArrayRangeNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[FlushVertexArrayRangeNV_remap_index], parameters) -#define GET_FlushVertexArrayRangeNV(disp) GET_by_offset(disp, driDispatchRemapTable[FlushVertexArrayRangeNV_remap_index]) -#define SET_FlushVertexArrayRangeNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FlushVertexArrayRangeNV_remap_index], fn) -#define CALL_VertexArrayRangeNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLvoid *)), driDispatchRemapTable[VertexArrayRangeNV_remap_index], parameters) -#define GET_VertexArrayRangeNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexArrayRangeNV_remap_index]) -#define SET_VertexArrayRangeNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexArrayRangeNV_remap_index], fn) -#define CALL_CombinerInputNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum)), driDispatchRemapTable[CombinerInputNV_remap_index], parameters) -#define GET_CombinerInputNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerInputNV_remap_index]) -#define SET_CombinerInputNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerInputNV_remap_index], fn) -#define CALL_CombinerOutputNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean)), driDispatchRemapTable[CombinerOutputNV_remap_index], parameters) -#define GET_CombinerOutputNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerOutputNV_remap_index]) -#define SET_CombinerOutputNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerOutputNV_remap_index], fn) -#define CALL_CombinerParameterfNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat)), driDispatchRemapTable[CombinerParameterfNV_remap_index], parameters) -#define GET_CombinerParameterfNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerParameterfNV_remap_index]) -#define SET_CombinerParameterfNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerParameterfNV_remap_index], fn) -#define CALL_CombinerParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLfloat *)), driDispatchRemapTable[CombinerParameterfvNV_remap_index], parameters) -#define GET_CombinerParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerParameterfvNV_remap_index]) -#define SET_CombinerParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerParameterfvNV_remap_index], fn) -#define CALL_CombinerParameteriNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint)), driDispatchRemapTable[CombinerParameteriNV_remap_index], parameters) -#define GET_CombinerParameteriNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerParameteriNV_remap_index]) -#define SET_CombinerParameteriNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerParameteriNV_remap_index], fn) -#define CALL_CombinerParameterivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLint *)), driDispatchRemapTable[CombinerParameterivNV_remap_index], parameters) -#define GET_CombinerParameterivNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerParameterivNV_remap_index]) -#define SET_CombinerParameterivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerParameterivNV_remap_index], fn) -#define CALL_FinalCombinerInputNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum)), driDispatchRemapTable[FinalCombinerInputNV_remap_index], parameters) -#define GET_FinalCombinerInputNV(disp) GET_by_offset(disp, driDispatchRemapTable[FinalCombinerInputNV_remap_index]) -#define SET_FinalCombinerInputNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FinalCombinerInputNV_remap_index], fn) -#define CALL_GetCombinerInputParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetCombinerInputParameterfvNV_remap_index], parameters) -#define GET_GetCombinerInputParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetCombinerInputParameterfvNV_remap_index]) -#define SET_GetCombinerInputParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetCombinerInputParameterfvNV_remap_index], fn) -#define CALL_GetCombinerInputParameterivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum, GLint *)), driDispatchRemapTable[GetCombinerInputParameterivNV_remap_index], parameters) -#define GET_GetCombinerInputParameterivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetCombinerInputParameterivNV_remap_index]) -#define SET_GetCombinerInputParameterivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetCombinerInputParameterivNV_remap_index], fn) -#define CALL_GetCombinerOutputParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetCombinerOutputParameterfvNV_remap_index], parameters) -#define GET_GetCombinerOutputParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetCombinerOutputParameterfvNV_remap_index]) -#define SET_GetCombinerOutputParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetCombinerOutputParameterfvNV_remap_index], fn) -#define CALL_GetCombinerOutputParameterivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLint *)), driDispatchRemapTable[GetCombinerOutputParameterivNV_remap_index], parameters) -#define GET_GetCombinerOutputParameterivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetCombinerOutputParameterivNV_remap_index]) -#define SET_GetCombinerOutputParameterivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetCombinerOutputParameterivNV_remap_index], fn) -#define CALL_GetFinalCombinerInputParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetFinalCombinerInputParameterfvNV_remap_index], parameters) -#define GET_GetFinalCombinerInputParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetFinalCombinerInputParameterfvNV_remap_index]) -#define SET_GetFinalCombinerInputParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFinalCombinerInputParameterfvNV_remap_index], fn) -#define CALL_GetFinalCombinerInputParameterivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetFinalCombinerInputParameterivNV_remap_index], parameters) -#define GET_GetFinalCombinerInputParameterivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetFinalCombinerInputParameterivNV_remap_index]) -#define SET_GetFinalCombinerInputParameterivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFinalCombinerInputParameterivNV_remap_index], fn) -#define CALL_ResizeBuffersMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[ResizeBuffersMESA_remap_index], parameters) -#define GET_ResizeBuffersMESA(disp) GET_by_offset(disp, driDispatchRemapTable[ResizeBuffersMESA_remap_index]) -#define SET_ResizeBuffersMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ResizeBuffersMESA_remap_index], fn) -#define CALL_WindowPos2dMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLdouble, GLdouble)), driDispatchRemapTable[WindowPos2dMESA_remap_index], parameters) -#define GET_WindowPos2dMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2dMESA_remap_index]) -#define SET_WindowPos2dMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2dMESA_remap_index], fn) -#define CALL_WindowPos2dvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[WindowPos2dvMESA_remap_index], parameters) -#define GET_WindowPos2dvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2dvMESA_remap_index]) -#define SET_WindowPos2dvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2dvMESA_remap_index], fn) -#define CALL_WindowPos2fMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat)), driDispatchRemapTable[WindowPos2fMESA_remap_index], parameters) -#define GET_WindowPos2fMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2fMESA_remap_index]) -#define SET_WindowPos2fMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2fMESA_remap_index], fn) -#define CALL_WindowPos2fvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[WindowPos2fvMESA_remap_index], parameters) -#define GET_WindowPos2fvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2fvMESA_remap_index]) -#define SET_WindowPos2fvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2fvMESA_remap_index], fn) -#define CALL_WindowPos2iMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint)), driDispatchRemapTable[WindowPos2iMESA_remap_index], parameters) -#define GET_WindowPos2iMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2iMESA_remap_index]) -#define SET_WindowPos2iMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2iMESA_remap_index], fn) -#define CALL_WindowPos2ivMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLint *)), driDispatchRemapTable[WindowPos2ivMESA_remap_index], parameters) -#define GET_WindowPos2ivMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2ivMESA_remap_index]) -#define SET_WindowPos2ivMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2ivMESA_remap_index], fn) -#define CALL_WindowPos2sMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLshort, GLshort)), driDispatchRemapTable[WindowPos2sMESA_remap_index], parameters) -#define GET_WindowPos2sMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2sMESA_remap_index]) -#define SET_WindowPos2sMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2sMESA_remap_index], fn) -#define CALL_WindowPos2svMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLshort *)), driDispatchRemapTable[WindowPos2svMESA_remap_index], parameters) -#define GET_WindowPos2svMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2svMESA_remap_index]) -#define SET_WindowPos2svMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2svMESA_remap_index], fn) -#define CALL_WindowPos3dMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[WindowPos3dMESA_remap_index], parameters) -#define GET_WindowPos3dMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3dMESA_remap_index]) -#define SET_WindowPos3dMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3dMESA_remap_index], fn) -#define CALL_WindowPos3dvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[WindowPos3dvMESA_remap_index], parameters) -#define GET_WindowPos3dvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3dvMESA_remap_index]) -#define SET_WindowPos3dvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3dvMESA_remap_index], fn) -#define CALL_WindowPos3fMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[WindowPos3fMESA_remap_index], parameters) -#define GET_WindowPos3fMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3fMESA_remap_index]) -#define SET_WindowPos3fMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3fMESA_remap_index], fn) -#define CALL_WindowPos3fvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[WindowPos3fvMESA_remap_index], parameters) -#define GET_WindowPos3fvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3fvMESA_remap_index]) -#define SET_WindowPos3fvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3fvMESA_remap_index], fn) -#define CALL_WindowPos3iMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint)), driDispatchRemapTable[WindowPos3iMESA_remap_index], parameters) -#define GET_WindowPos3iMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3iMESA_remap_index]) -#define SET_WindowPos3iMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3iMESA_remap_index], fn) -#define CALL_WindowPos3ivMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLint *)), driDispatchRemapTable[WindowPos3ivMESA_remap_index], parameters) -#define GET_WindowPos3ivMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3ivMESA_remap_index]) -#define SET_WindowPos3ivMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3ivMESA_remap_index], fn) -#define CALL_WindowPos3sMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLshort, GLshort, GLshort)), driDispatchRemapTable[WindowPos3sMESA_remap_index], parameters) -#define GET_WindowPos3sMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3sMESA_remap_index]) -#define SET_WindowPos3sMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3sMESA_remap_index], fn) -#define CALL_WindowPos3svMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLshort *)), driDispatchRemapTable[WindowPos3svMESA_remap_index], parameters) -#define GET_WindowPos3svMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3svMESA_remap_index]) -#define SET_WindowPos3svMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3svMESA_remap_index], fn) -#define CALL_WindowPos4dMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[WindowPos4dMESA_remap_index], parameters) -#define GET_WindowPos4dMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4dMESA_remap_index]) -#define SET_WindowPos4dMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4dMESA_remap_index], fn) -#define CALL_WindowPos4dvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[WindowPos4dvMESA_remap_index], parameters) -#define GET_WindowPos4dvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4dvMESA_remap_index]) -#define SET_WindowPos4dvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4dvMESA_remap_index], fn) -#define CALL_WindowPos4fMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[WindowPos4fMESA_remap_index], parameters) -#define GET_WindowPos4fMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4fMESA_remap_index]) -#define SET_WindowPos4fMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4fMESA_remap_index], fn) -#define CALL_WindowPos4fvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[WindowPos4fvMESA_remap_index], parameters) -#define GET_WindowPos4fvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4fvMESA_remap_index]) -#define SET_WindowPos4fvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4fvMESA_remap_index], fn) -#define CALL_WindowPos4iMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint, GLint)), driDispatchRemapTable[WindowPos4iMESA_remap_index], parameters) -#define GET_WindowPos4iMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4iMESA_remap_index]) -#define SET_WindowPos4iMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4iMESA_remap_index], fn) -#define CALL_WindowPos4ivMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLint *)), driDispatchRemapTable[WindowPos4ivMESA_remap_index], parameters) -#define GET_WindowPos4ivMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4ivMESA_remap_index]) -#define SET_WindowPos4ivMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4ivMESA_remap_index], fn) -#define CALL_WindowPos4sMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLshort, GLshort, GLshort, GLshort)), driDispatchRemapTable[WindowPos4sMESA_remap_index], parameters) -#define GET_WindowPos4sMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4sMESA_remap_index]) -#define SET_WindowPos4sMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4sMESA_remap_index], fn) -#define CALL_WindowPos4svMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLshort *)), driDispatchRemapTable[WindowPos4svMESA_remap_index], parameters) -#define GET_WindowPos4svMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4svMESA_remap_index]) -#define SET_WindowPos4svMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4svMESA_remap_index], fn) -#define CALL_MultiModeDrawArraysIBM(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLenum *, const GLint *, const GLsizei *, GLsizei, GLint)), driDispatchRemapTable[MultiModeDrawArraysIBM_remap_index], parameters) -#define GET_MultiModeDrawArraysIBM(disp) GET_by_offset(disp, driDispatchRemapTable[MultiModeDrawArraysIBM_remap_index]) -#define SET_MultiModeDrawArraysIBM(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultiModeDrawArraysIBM_remap_index], fn) -#define CALL_MultiModeDrawElementsIBM(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLenum *, const GLsizei *, GLenum, const GLvoid * const *, GLsizei, GLint)), driDispatchRemapTable[MultiModeDrawElementsIBM_remap_index], parameters) -#define GET_MultiModeDrawElementsIBM(disp) GET_by_offset(disp, driDispatchRemapTable[MultiModeDrawElementsIBM_remap_index]) -#define SET_MultiModeDrawElementsIBM(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultiModeDrawElementsIBM_remap_index], fn) -#define CALL_DeleteFencesNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteFencesNV_remap_index], parameters) -#define GET_DeleteFencesNV(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteFencesNV_remap_index]) -#define SET_DeleteFencesNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteFencesNV_remap_index], fn) -#define CALL_FinishFenceNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[FinishFenceNV_remap_index], parameters) -#define GET_FinishFenceNV(disp) GET_by_offset(disp, driDispatchRemapTable[FinishFenceNV_remap_index]) -#define SET_FinishFenceNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FinishFenceNV_remap_index], fn) -#define CALL_GenFencesNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenFencesNV_remap_index], parameters) -#define GET_GenFencesNV(disp) GET_by_offset(disp, driDispatchRemapTable[GenFencesNV_remap_index]) -#define SET_GenFencesNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenFencesNV_remap_index], fn) -#define CALL_GetFenceivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetFenceivNV_remap_index], parameters) -#define GET_GetFenceivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetFenceivNV_remap_index]) -#define SET_GetFenceivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFenceivNV_remap_index], fn) -#define CALL_IsFenceNV(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsFenceNV_remap_index], parameters) -#define GET_IsFenceNV(disp) GET_by_offset(disp, driDispatchRemapTable[IsFenceNV_remap_index]) -#define SET_IsFenceNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsFenceNV_remap_index], fn) -#define CALL_SetFenceNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum)), driDispatchRemapTable[SetFenceNV_remap_index], parameters) -#define GET_SetFenceNV(disp) GET_by_offset(disp, driDispatchRemapTable[SetFenceNV_remap_index]) -#define SET_SetFenceNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SetFenceNV_remap_index], fn) -#define CALL_TestFenceNV(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[TestFenceNV_remap_index], parameters) -#define GET_TestFenceNV(disp) GET_by_offset(disp, driDispatchRemapTable[TestFenceNV_remap_index]) -#define SET_TestFenceNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TestFenceNV_remap_index], fn) -#define CALL_AreProgramsResidentNV(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLsizei, const GLuint *, GLboolean *)), driDispatchRemapTable[AreProgramsResidentNV_remap_index], parameters) -#define GET_AreProgramsResidentNV(disp) GET_by_offset(disp, driDispatchRemapTable[AreProgramsResidentNV_remap_index]) -#define SET_AreProgramsResidentNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AreProgramsResidentNV_remap_index], fn) -#define CALL_BindProgramNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[BindProgramNV_remap_index], parameters) -#define GET_BindProgramNV(disp) GET_by_offset(disp, driDispatchRemapTable[BindProgramNV_remap_index]) -#define SET_BindProgramNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindProgramNV_remap_index], fn) -#define CALL_DeleteProgramsNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteProgramsNV_remap_index], parameters) -#define GET_DeleteProgramsNV(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteProgramsNV_remap_index]) -#define SET_DeleteProgramsNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteProgramsNV_remap_index], fn) -#define CALL_ExecuteProgramNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLfloat *)), driDispatchRemapTable[ExecuteProgramNV_remap_index], parameters) -#define GET_ExecuteProgramNV(disp) GET_by_offset(disp, driDispatchRemapTable[ExecuteProgramNV_remap_index]) -#define SET_ExecuteProgramNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ExecuteProgramNV_remap_index], fn) -#define CALL_GenProgramsNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenProgramsNV_remap_index], parameters) -#define GET_GenProgramsNV(disp) GET_by_offset(disp, driDispatchRemapTable[GenProgramsNV_remap_index]) -#define SET_GenProgramsNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenProgramsNV_remap_index], fn) -#define CALL_GetProgramParameterdvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLenum, GLdouble *)), driDispatchRemapTable[GetProgramParameterdvNV_remap_index], parameters) -#define GET_GetProgramParameterdvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramParameterdvNV_remap_index]) -#define SET_GetProgramParameterdvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramParameterdvNV_remap_index], fn) -#define CALL_GetProgramParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLenum, GLfloat *)), driDispatchRemapTable[GetProgramParameterfvNV_remap_index], parameters) -#define GET_GetProgramParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramParameterfvNV_remap_index]) -#define SET_GetProgramParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramParameterfvNV_remap_index], fn) -#define CALL_GetProgramStringNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLubyte *)), driDispatchRemapTable[GetProgramStringNV_remap_index], parameters) -#define GET_GetProgramStringNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramStringNV_remap_index]) -#define SET_GetProgramStringNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramStringNV_remap_index], fn) -#define CALL_GetProgramivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetProgramivNV_remap_index], parameters) -#define GET_GetProgramivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramivNV_remap_index]) -#define SET_GetProgramivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramivNV_remap_index], fn) -#define CALL_GetTrackMatrixivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLenum, GLint *)), driDispatchRemapTable[GetTrackMatrixivNV_remap_index], parameters) -#define GET_GetTrackMatrixivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetTrackMatrixivNV_remap_index]) -#define SET_GetTrackMatrixivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetTrackMatrixivNV_remap_index], fn) -#define CALL_GetVertexAttribPointervNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLvoid **)), driDispatchRemapTable[GetVertexAttribPointervNV_remap_index], parameters) -#define GET_GetVertexAttribPointervNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribPointervNV_remap_index]) -#define SET_GetVertexAttribPointervNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribPointervNV_remap_index], fn) -#define CALL_GetVertexAttribdvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLdouble *)), driDispatchRemapTable[GetVertexAttribdvNV_remap_index], parameters) -#define GET_GetVertexAttribdvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribdvNV_remap_index]) -#define SET_GetVertexAttribdvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribdvNV_remap_index], fn) -#define CALL_GetVertexAttribfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLfloat *)), driDispatchRemapTable[GetVertexAttribfvNV_remap_index], parameters) -#define GET_GetVertexAttribfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribfvNV_remap_index]) -#define SET_GetVertexAttribfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribfvNV_remap_index], fn) -#define CALL_GetVertexAttribivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetVertexAttribivNV_remap_index], parameters) -#define GET_GetVertexAttribivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribivNV_remap_index]) -#define SET_GetVertexAttribivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribivNV_remap_index], fn) -#define CALL_IsProgramNV(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsProgramNV_remap_index], parameters) -#define GET_IsProgramNV(disp) GET_by_offset(disp, driDispatchRemapTable[IsProgramNV_remap_index]) -#define SET_IsProgramNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsProgramNV_remap_index], fn) -#define CALL_LoadProgramNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLsizei, const GLubyte *)), driDispatchRemapTable[LoadProgramNV_remap_index], parameters) -#define GET_LoadProgramNV(disp) GET_by_offset(disp, driDispatchRemapTable[LoadProgramNV_remap_index]) -#define SET_LoadProgramNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LoadProgramNV_remap_index], fn) -#define CALL_ProgramParameters4dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, const GLdouble *)), driDispatchRemapTable[ProgramParameters4dvNV_remap_index], parameters) -#define GET_ProgramParameters4dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramParameters4dvNV_remap_index]) -#define SET_ProgramParameters4dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramParameters4dvNV_remap_index], fn) -#define CALL_ProgramParameters4fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, const GLfloat *)), driDispatchRemapTable[ProgramParameters4fvNV_remap_index], parameters) -#define GET_ProgramParameters4fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramParameters4fvNV_remap_index]) -#define SET_ProgramParameters4fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramParameters4fvNV_remap_index], fn) -#define CALL_RequestResidentProgramsNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[RequestResidentProgramsNV_remap_index], parameters) -#define GET_RequestResidentProgramsNV(disp) GET_by_offset(disp, driDispatchRemapTable[RequestResidentProgramsNV_remap_index]) -#define SET_RequestResidentProgramsNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[RequestResidentProgramsNV_remap_index], fn) -#define CALL_TrackMatrixNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLenum, GLenum)), driDispatchRemapTable[TrackMatrixNV_remap_index], parameters) -#define GET_TrackMatrixNV(disp) GET_by_offset(disp, driDispatchRemapTable[TrackMatrixNV_remap_index]) -#define SET_TrackMatrixNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TrackMatrixNV_remap_index], fn) -#define CALL_VertexAttrib1dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble)), driDispatchRemapTable[VertexAttrib1dNV_remap_index], parameters) -#define GET_VertexAttrib1dNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dNV_remap_index]) -#define SET_VertexAttrib1dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dNV_remap_index], fn) -#define CALL_VertexAttrib1dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib1dvNV_remap_index], parameters) -#define GET_VertexAttrib1dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dvNV_remap_index]) -#define SET_VertexAttrib1dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dvNV_remap_index], fn) -#define CALL_VertexAttrib1fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat)), driDispatchRemapTable[VertexAttrib1fNV_remap_index], parameters) -#define GET_VertexAttrib1fNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fNV_remap_index]) -#define SET_VertexAttrib1fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fNV_remap_index], fn) -#define CALL_VertexAttrib1fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib1fvNV_remap_index], parameters) -#define GET_VertexAttrib1fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fvNV_remap_index]) -#define SET_VertexAttrib1fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fvNV_remap_index], fn) -#define CALL_VertexAttrib1sNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort)), driDispatchRemapTable[VertexAttrib1sNV_remap_index], parameters) -#define GET_VertexAttrib1sNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1sNV_remap_index]) -#define SET_VertexAttrib1sNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1sNV_remap_index], fn) -#define CALL_VertexAttrib1svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib1svNV_remap_index], parameters) -#define GET_VertexAttrib1svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1svNV_remap_index]) -#define SET_VertexAttrib1svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1svNV_remap_index], fn) -#define CALL_VertexAttrib2dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib2dNV_remap_index], parameters) -#define GET_VertexAttrib2dNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dNV_remap_index]) -#define SET_VertexAttrib2dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dNV_remap_index], fn) -#define CALL_VertexAttrib2dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib2dvNV_remap_index], parameters) -#define GET_VertexAttrib2dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dvNV_remap_index]) -#define SET_VertexAttrib2dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dvNV_remap_index], fn) -#define CALL_VertexAttrib2fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib2fNV_remap_index], parameters) -#define GET_VertexAttrib2fNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fNV_remap_index]) -#define SET_VertexAttrib2fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fNV_remap_index], fn) -#define CALL_VertexAttrib2fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib2fvNV_remap_index], parameters) -#define GET_VertexAttrib2fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fvNV_remap_index]) -#define SET_VertexAttrib2fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fvNV_remap_index], fn) -#define CALL_VertexAttrib2sNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib2sNV_remap_index], parameters) -#define GET_VertexAttrib2sNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2sNV_remap_index]) -#define SET_VertexAttrib2sNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2sNV_remap_index], fn) -#define CALL_VertexAttrib2svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib2svNV_remap_index], parameters) -#define GET_VertexAttrib2svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2svNV_remap_index]) -#define SET_VertexAttrib2svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2svNV_remap_index], fn) -#define CALL_VertexAttrib3dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib3dNV_remap_index], parameters) -#define GET_VertexAttrib3dNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dNV_remap_index]) -#define SET_VertexAttrib3dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dNV_remap_index], fn) -#define CALL_VertexAttrib3dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib3dvNV_remap_index], parameters) -#define GET_VertexAttrib3dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dvNV_remap_index]) -#define SET_VertexAttrib3dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dvNV_remap_index], fn) -#define CALL_VertexAttrib3fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib3fNV_remap_index], parameters) -#define GET_VertexAttrib3fNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fNV_remap_index]) -#define SET_VertexAttrib3fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fNV_remap_index], fn) -#define CALL_VertexAttrib3fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib3fvNV_remap_index], parameters) -#define GET_VertexAttrib3fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fvNV_remap_index]) -#define SET_VertexAttrib3fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fvNV_remap_index], fn) -#define CALL_VertexAttrib3sNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib3sNV_remap_index], parameters) -#define GET_VertexAttrib3sNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3sNV_remap_index]) -#define SET_VertexAttrib3sNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3sNV_remap_index], fn) -#define CALL_VertexAttrib3svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib3svNV_remap_index], parameters) -#define GET_VertexAttrib3svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3svNV_remap_index]) -#define SET_VertexAttrib3svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3svNV_remap_index], fn) -#define CALL_VertexAttrib4dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib4dNV_remap_index], parameters) -#define GET_VertexAttrib4dNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dNV_remap_index]) -#define SET_VertexAttrib4dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dNV_remap_index], fn) -#define CALL_VertexAttrib4dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib4dvNV_remap_index], parameters) -#define GET_VertexAttrib4dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dvNV_remap_index]) -#define SET_VertexAttrib4dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dvNV_remap_index], fn) -#define CALL_VertexAttrib4fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib4fNV_remap_index], parameters) -#define GET_VertexAttrib4fNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fNV_remap_index]) -#define SET_VertexAttrib4fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fNV_remap_index], fn) -#define CALL_VertexAttrib4fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib4fvNV_remap_index], parameters) -#define GET_VertexAttrib4fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fvNV_remap_index]) -#define SET_VertexAttrib4fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fvNV_remap_index], fn) -#define CALL_VertexAttrib4sNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib4sNV_remap_index], parameters) -#define GET_VertexAttrib4sNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4sNV_remap_index]) -#define SET_VertexAttrib4sNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4sNV_remap_index], fn) -#define CALL_VertexAttrib4svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib4svNV_remap_index], parameters) -#define GET_VertexAttrib4svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4svNV_remap_index]) -#define SET_VertexAttrib4svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4svNV_remap_index], fn) -#define CALL_VertexAttrib4ubNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte)), driDispatchRemapTable[VertexAttrib4ubNV_remap_index], parameters) -#define GET_VertexAttrib4ubNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubNV_remap_index]) -#define SET_VertexAttrib4ubNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubNV_remap_index], fn) -#define CALL_VertexAttrib4ubvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLubyte *)), driDispatchRemapTable[VertexAttrib4ubvNV_remap_index], parameters) -#define GET_VertexAttrib4ubvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubvNV_remap_index]) -#define SET_VertexAttrib4ubvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubvNV_remap_index], fn) -#define CALL_VertexAttribPointerNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLint, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[VertexAttribPointerNV_remap_index], parameters) -#define GET_VertexAttribPointerNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribPointerNV_remap_index]) -#define SET_VertexAttribPointerNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribPointerNV_remap_index], fn) -#define CALL_VertexAttribs1dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLdouble *)), driDispatchRemapTable[VertexAttribs1dvNV_remap_index], parameters) -#define GET_VertexAttribs1dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs1dvNV_remap_index]) -#define SET_VertexAttribs1dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs1dvNV_remap_index], fn) -#define CALL_VertexAttribs1fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[VertexAttribs1fvNV_remap_index], parameters) -#define GET_VertexAttribs1fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs1fvNV_remap_index]) -#define SET_VertexAttribs1fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs1fvNV_remap_index], fn) -#define CALL_VertexAttribs1svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLshort *)), driDispatchRemapTable[VertexAttribs1svNV_remap_index], parameters) -#define GET_VertexAttribs1svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs1svNV_remap_index]) -#define SET_VertexAttribs1svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs1svNV_remap_index], fn) -#define CALL_VertexAttribs2dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLdouble *)), driDispatchRemapTable[VertexAttribs2dvNV_remap_index], parameters) -#define GET_VertexAttribs2dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs2dvNV_remap_index]) -#define SET_VertexAttribs2dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs2dvNV_remap_index], fn) -#define CALL_VertexAttribs2fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[VertexAttribs2fvNV_remap_index], parameters) -#define GET_VertexAttribs2fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs2fvNV_remap_index]) -#define SET_VertexAttribs2fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs2fvNV_remap_index], fn) -#define CALL_VertexAttribs2svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLshort *)), driDispatchRemapTable[VertexAttribs2svNV_remap_index], parameters) -#define GET_VertexAttribs2svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs2svNV_remap_index]) -#define SET_VertexAttribs2svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs2svNV_remap_index], fn) -#define CALL_VertexAttribs3dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLdouble *)), driDispatchRemapTable[VertexAttribs3dvNV_remap_index], parameters) -#define GET_VertexAttribs3dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs3dvNV_remap_index]) -#define SET_VertexAttribs3dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs3dvNV_remap_index], fn) -#define CALL_VertexAttribs3fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[VertexAttribs3fvNV_remap_index], parameters) -#define GET_VertexAttribs3fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs3fvNV_remap_index]) -#define SET_VertexAttribs3fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs3fvNV_remap_index], fn) -#define CALL_VertexAttribs3svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLshort *)), driDispatchRemapTable[VertexAttribs3svNV_remap_index], parameters) -#define GET_VertexAttribs3svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs3svNV_remap_index]) -#define SET_VertexAttribs3svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs3svNV_remap_index], fn) -#define CALL_VertexAttribs4dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLdouble *)), driDispatchRemapTable[VertexAttribs4dvNV_remap_index], parameters) -#define GET_VertexAttribs4dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs4dvNV_remap_index]) -#define SET_VertexAttribs4dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs4dvNV_remap_index], fn) -#define CALL_VertexAttribs4fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[VertexAttribs4fvNV_remap_index], parameters) -#define GET_VertexAttribs4fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs4fvNV_remap_index]) -#define SET_VertexAttribs4fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs4fvNV_remap_index], fn) -#define CALL_VertexAttribs4svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLshort *)), driDispatchRemapTable[VertexAttribs4svNV_remap_index], parameters) -#define GET_VertexAttribs4svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs4svNV_remap_index]) -#define SET_VertexAttribs4svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs4svNV_remap_index], fn) -#define CALL_VertexAttribs4ubvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *)), driDispatchRemapTable[VertexAttribs4ubvNV_remap_index], parameters) -#define GET_VertexAttribs4ubvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs4ubvNV_remap_index]) -#define SET_VertexAttribs4ubvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs4ubvNV_remap_index], fn) -#define CALL_GetTexBumpParameterfvATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat *)), driDispatchRemapTable[GetTexBumpParameterfvATI_remap_index], parameters) -#define GET_GetTexBumpParameterfvATI(disp) GET_by_offset(disp, driDispatchRemapTable[GetTexBumpParameterfvATI_remap_index]) -#define SET_GetTexBumpParameterfvATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetTexBumpParameterfvATI_remap_index], fn) -#define CALL_GetTexBumpParameterivATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint *)), driDispatchRemapTable[GetTexBumpParameterivATI_remap_index], parameters) -#define GET_GetTexBumpParameterivATI(disp) GET_by_offset(disp, driDispatchRemapTable[GetTexBumpParameterivATI_remap_index]) -#define SET_GetTexBumpParameterivATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetTexBumpParameterivATI_remap_index], fn) -#define CALL_TexBumpParameterfvATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLfloat *)), driDispatchRemapTable[TexBumpParameterfvATI_remap_index], parameters) -#define GET_TexBumpParameterfvATI(disp) GET_by_offset(disp, driDispatchRemapTable[TexBumpParameterfvATI_remap_index]) -#define SET_TexBumpParameterfvATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TexBumpParameterfvATI_remap_index], fn) -#define CALL_TexBumpParameterivATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLint *)), driDispatchRemapTable[TexBumpParameterivATI_remap_index], parameters) -#define GET_TexBumpParameterivATI(disp) GET_by_offset(disp, driDispatchRemapTable[TexBumpParameterivATI_remap_index]) -#define SET_TexBumpParameterivATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TexBumpParameterivATI_remap_index], fn) -#define CALL_AlphaFragmentOp1ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[AlphaFragmentOp1ATI_remap_index], parameters) -#define GET_AlphaFragmentOp1ATI(disp) GET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp1ATI_remap_index]) -#define SET_AlphaFragmentOp1ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp1ATI_remap_index], fn) -#define CALL_AlphaFragmentOp2ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[AlphaFragmentOp2ATI_remap_index], parameters) -#define GET_AlphaFragmentOp2ATI(disp) GET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp2ATI_remap_index]) -#define SET_AlphaFragmentOp2ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp2ATI_remap_index], fn) -#define CALL_AlphaFragmentOp3ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[AlphaFragmentOp3ATI_remap_index], parameters) -#define GET_AlphaFragmentOp3ATI(disp) GET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp3ATI_remap_index]) -#define SET_AlphaFragmentOp3ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp3ATI_remap_index], fn) -#define CALL_BeginFragmentShaderATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[BeginFragmentShaderATI_remap_index], parameters) -#define GET_BeginFragmentShaderATI(disp) GET_by_offset(disp, driDispatchRemapTable[BeginFragmentShaderATI_remap_index]) -#define SET_BeginFragmentShaderATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BeginFragmentShaderATI_remap_index], fn) -#define CALL_BindFragmentShaderATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[BindFragmentShaderATI_remap_index], parameters) -#define GET_BindFragmentShaderATI(disp) GET_by_offset(disp, driDispatchRemapTable[BindFragmentShaderATI_remap_index]) -#define SET_BindFragmentShaderATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindFragmentShaderATI_remap_index], fn) -#define CALL_ColorFragmentOp1ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[ColorFragmentOp1ATI_remap_index], parameters) -#define GET_ColorFragmentOp1ATI(disp) GET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp1ATI_remap_index]) -#define SET_ColorFragmentOp1ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp1ATI_remap_index], fn) -#define CALL_ColorFragmentOp2ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[ColorFragmentOp2ATI_remap_index], parameters) -#define GET_ColorFragmentOp2ATI(disp) GET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp2ATI_remap_index]) -#define SET_ColorFragmentOp2ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp2ATI_remap_index], fn) -#define CALL_ColorFragmentOp3ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[ColorFragmentOp3ATI_remap_index], parameters) -#define GET_ColorFragmentOp3ATI(disp) GET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp3ATI_remap_index]) -#define SET_ColorFragmentOp3ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp3ATI_remap_index], fn) -#define CALL_DeleteFragmentShaderATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[DeleteFragmentShaderATI_remap_index], parameters) -#define GET_DeleteFragmentShaderATI(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteFragmentShaderATI_remap_index]) -#define SET_DeleteFragmentShaderATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteFragmentShaderATI_remap_index], fn) -#define CALL_EndFragmentShaderATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[EndFragmentShaderATI_remap_index], parameters) -#define GET_EndFragmentShaderATI(disp) GET_by_offset(disp, driDispatchRemapTable[EndFragmentShaderATI_remap_index]) -#define SET_EndFragmentShaderATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[EndFragmentShaderATI_remap_index], fn) -#define CALL_GenFragmentShadersATI(disp, parameters) CALL_by_offset(disp, (GLuint (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[GenFragmentShadersATI_remap_index], parameters) -#define GET_GenFragmentShadersATI(disp) GET_by_offset(disp, driDispatchRemapTable[GenFragmentShadersATI_remap_index]) -#define SET_GenFragmentShadersATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenFragmentShadersATI_remap_index], fn) -#define CALL_PassTexCoordATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint, GLenum)), driDispatchRemapTable[PassTexCoordATI_remap_index], parameters) -#define GET_PassTexCoordATI(disp) GET_by_offset(disp, driDispatchRemapTable[PassTexCoordATI_remap_index]) -#define SET_PassTexCoordATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PassTexCoordATI_remap_index], fn) -#define CALL_SampleMapATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint, GLenum)), driDispatchRemapTable[SampleMapATI_remap_index], parameters) -#define GET_SampleMapATI(disp) GET_by_offset(disp, driDispatchRemapTable[SampleMapATI_remap_index]) -#define SET_SampleMapATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SampleMapATI_remap_index], fn) -#define CALL_SetFragmentShaderConstantATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[SetFragmentShaderConstantATI_remap_index], parameters) -#define GET_SetFragmentShaderConstantATI(disp) GET_by_offset(disp, driDispatchRemapTable[SetFragmentShaderConstantATI_remap_index]) -#define SET_SetFragmentShaderConstantATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SetFragmentShaderConstantATI_remap_index], fn) -#define CALL_PointParameteriNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint)), driDispatchRemapTable[PointParameteriNV_remap_index], parameters) -#define GET_PointParameteriNV(disp) GET_by_offset(disp, driDispatchRemapTable[PointParameteriNV_remap_index]) -#define SET_PointParameteriNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PointParameteriNV_remap_index], fn) -#define CALL_PointParameterivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLint *)), driDispatchRemapTable[PointParameterivNV_remap_index], parameters) -#define GET_PointParameterivNV(disp) GET_by_offset(disp, driDispatchRemapTable[PointParameterivNV_remap_index]) -#define SET_PointParameterivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PointParameterivNV_remap_index], fn) -#define CALL_ActiveStencilFaceEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[ActiveStencilFaceEXT_remap_index], parameters) -#define GET_ActiveStencilFaceEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ActiveStencilFaceEXT_remap_index]) -#define SET_ActiveStencilFaceEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ActiveStencilFaceEXT_remap_index], fn) -#define CALL_BindVertexArrayAPPLE(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[BindVertexArrayAPPLE_remap_index], parameters) -#define GET_BindVertexArrayAPPLE(disp) GET_by_offset(disp, driDispatchRemapTable[BindVertexArrayAPPLE_remap_index]) -#define SET_BindVertexArrayAPPLE(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindVertexArrayAPPLE_remap_index], fn) -#define CALL_DeleteVertexArraysAPPLE(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteVertexArraysAPPLE_remap_index], parameters) -#define GET_DeleteVertexArraysAPPLE(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteVertexArraysAPPLE_remap_index]) -#define SET_DeleteVertexArraysAPPLE(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteVertexArraysAPPLE_remap_index], fn) -#define CALL_GenVertexArraysAPPLE(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenVertexArraysAPPLE_remap_index], parameters) -#define GET_GenVertexArraysAPPLE(disp) GET_by_offset(disp, driDispatchRemapTable[GenVertexArraysAPPLE_remap_index]) -#define SET_GenVertexArraysAPPLE(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenVertexArraysAPPLE_remap_index], fn) -#define CALL_IsVertexArrayAPPLE(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsVertexArrayAPPLE_remap_index], parameters) -#define GET_IsVertexArrayAPPLE(disp) GET_by_offset(disp, driDispatchRemapTable[IsVertexArrayAPPLE_remap_index]) -#define SET_IsVertexArrayAPPLE(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsVertexArrayAPPLE_remap_index], fn) -#define CALL_GetProgramNamedParameterdvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, GLdouble *)), driDispatchRemapTable[GetProgramNamedParameterdvNV_remap_index], parameters) -#define GET_GetProgramNamedParameterdvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramNamedParameterdvNV_remap_index]) -#define SET_GetProgramNamedParameterdvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramNamedParameterdvNV_remap_index], fn) -#define CALL_GetProgramNamedParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, GLfloat *)), driDispatchRemapTable[GetProgramNamedParameterfvNV_remap_index], parameters) -#define GET_GetProgramNamedParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramNamedParameterfvNV_remap_index]) -#define SET_GetProgramNamedParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramNamedParameterfvNV_remap_index], fn) -#define CALL_ProgramNamedParameter4dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[ProgramNamedParameter4dNV_remap_index], parameters) -#define GET_ProgramNamedParameter4dNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4dNV_remap_index]) -#define SET_ProgramNamedParameter4dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4dNV_remap_index], fn) -#define CALL_ProgramNamedParameter4dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, const GLdouble *)), driDispatchRemapTable[ProgramNamedParameter4dvNV_remap_index], parameters) -#define GET_ProgramNamedParameter4dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4dvNV_remap_index]) -#define SET_ProgramNamedParameter4dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4dvNV_remap_index], fn) -#define CALL_ProgramNamedParameter4fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[ProgramNamedParameter4fNV_remap_index], parameters) -#define GET_ProgramNamedParameter4fNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4fNV_remap_index]) -#define SET_ProgramNamedParameter4fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4fNV_remap_index], fn) -#define CALL_ProgramNamedParameter4fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, const GLfloat *)), driDispatchRemapTable[ProgramNamedParameter4fvNV_remap_index], parameters) -#define GET_ProgramNamedParameter4fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4fvNV_remap_index]) -#define SET_ProgramNamedParameter4fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4fvNV_remap_index], fn) -#define CALL_DepthBoundsEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLclampd, GLclampd)), driDispatchRemapTable[DepthBoundsEXT_remap_index], parameters) -#define GET_DepthBoundsEXT(disp) GET_by_offset(disp, driDispatchRemapTable[DepthBoundsEXT_remap_index]) -#define SET_DepthBoundsEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DepthBoundsEXT_remap_index], fn) -#define CALL_BlendEquationSeparateEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum)), driDispatchRemapTable[BlendEquationSeparateEXT_remap_index], parameters) -#define GET_BlendEquationSeparateEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BlendEquationSeparateEXT_remap_index]) -#define SET_BlendEquationSeparateEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BlendEquationSeparateEXT_remap_index], fn) -#define CALL_BindFramebufferEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[BindFramebufferEXT_remap_index], parameters) -#define GET_BindFramebufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BindFramebufferEXT_remap_index]) -#define SET_BindFramebufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindFramebufferEXT_remap_index], fn) -#define CALL_BindRenderbufferEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[BindRenderbufferEXT_remap_index], parameters) -#define GET_BindRenderbufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BindRenderbufferEXT_remap_index]) -#define SET_BindRenderbufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindRenderbufferEXT_remap_index], fn) -#define CALL_CheckFramebufferStatusEXT(disp, parameters) CALL_by_offset(disp, (GLenum (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[CheckFramebufferStatusEXT_remap_index], parameters) -#define GET_CheckFramebufferStatusEXT(disp) GET_by_offset(disp, driDispatchRemapTable[CheckFramebufferStatusEXT_remap_index]) -#define SET_CheckFramebufferStatusEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CheckFramebufferStatusEXT_remap_index], fn) -#define CALL_DeleteFramebuffersEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteFramebuffersEXT_remap_index], parameters) -#define GET_DeleteFramebuffersEXT(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteFramebuffersEXT_remap_index]) -#define SET_DeleteFramebuffersEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteFramebuffersEXT_remap_index], fn) -#define CALL_DeleteRenderbuffersEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteRenderbuffersEXT_remap_index], parameters) -#define GET_DeleteRenderbuffersEXT(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteRenderbuffersEXT_remap_index]) -#define SET_DeleteRenderbuffersEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteRenderbuffersEXT_remap_index], fn) -#define CALL_FramebufferRenderbufferEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLuint)), driDispatchRemapTable[FramebufferRenderbufferEXT_remap_index], parameters) -#define GET_FramebufferRenderbufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferRenderbufferEXT_remap_index]) -#define SET_FramebufferRenderbufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferRenderbufferEXT_remap_index], fn) -#define CALL_FramebufferTexture1DEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLuint, GLint)), driDispatchRemapTable[FramebufferTexture1DEXT_remap_index], parameters) -#define GET_FramebufferTexture1DEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferTexture1DEXT_remap_index]) -#define SET_FramebufferTexture1DEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferTexture1DEXT_remap_index], fn) -#define CALL_FramebufferTexture2DEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLuint, GLint)), driDispatchRemapTable[FramebufferTexture2DEXT_remap_index], parameters) -#define GET_FramebufferTexture2DEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferTexture2DEXT_remap_index]) -#define SET_FramebufferTexture2DEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferTexture2DEXT_remap_index], fn) -#define CALL_FramebufferTexture3DEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLuint, GLint, GLint)), driDispatchRemapTable[FramebufferTexture3DEXT_remap_index], parameters) -#define GET_FramebufferTexture3DEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferTexture3DEXT_remap_index]) -#define SET_FramebufferTexture3DEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferTexture3DEXT_remap_index], fn) -#define CALL_GenFramebuffersEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenFramebuffersEXT_remap_index], parameters) -#define GET_GenFramebuffersEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GenFramebuffersEXT_remap_index]) -#define SET_GenFramebuffersEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenFramebuffersEXT_remap_index], fn) -#define CALL_GenRenderbuffersEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenRenderbuffersEXT_remap_index], parameters) -#define GET_GenRenderbuffersEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GenRenderbuffersEXT_remap_index]) -#define SET_GenRenderbuffersEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenRenderbuffersEXT_remap_index], fn) -#define CALL_GenerateMipmapEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[GenerateMipmapEXT_remap_index], parameters) -#define GET_GenerateMipmapEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GenerateMipmapEXT_remap_index]) -#define SET_GenerateMipmapEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenerateMipmapEXT_remap_index], fn) -#define CALL_GetFramebufferAttachmentParameterivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLint *)), driDispatchRemapTable[GetFramebufferAttachmentParameterivEXT_remap_index], parameters) -#define GET_GetFramebufferAttachmentParameterivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetFramebufferAttachmentParameterivEXT_remap_index]) -#define SET_GetFramebufferAttachmentParameterivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFramebufferAttachmentParameterivEXT_remap_index], fn) -#define CALL_GetRenderbufferParameterivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetRenderbufferParameterivEXT_remap_index], parameters) -#define GET_GetRenderbufferParameterivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetRenderbufferParameterivEXT_remap_index]) -#define SET_GetRenderbufferParameterivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetRenderbufferParameterivEXT_remap_index], fn) -#define CALL_IsFramebufferEXT(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsFramebufferEXT_remap_index], parameters) -#define GET_IsFramebufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[IsFramebufferEXT_remap_index]) -#define SET_IsFramebufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsFramebufferEXT_remap_index], fn) -#define CALL_IsRenderbufferEXT(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsRenderbufferEXT_remap_index], parameters) -#define GET_IsRenderbufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[IsRenderbufferEXT_remap_index]) -#define SET_IsRenderbufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsRenderbufferEXT_remap_index], fn) -#define CALL_RenderbufferStorageEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLsizei, GLsizei)), driDispatchRemapTable[RenderbufferStorageEXT_remap_index], parameters) -#define GET_RenderbufferStorageEXT(disp) GET_by_offset(disp, driDispatchRemapTable[RenderbufferStorageEXT_remap_index]) -#define SET_RenderbufferStorageEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[RenderbufferStorageEXT_remap_index], fn) -#define CALL_BlitFramebufferEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum)), driDispatchRemapTable[BlitFramebufferEXT_remap_index], parameters) -#define GET_BlitFramebufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BlitFramebufferEXT_remap_index]) -#define SET_BlitFramebufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BlitFramebufferEXT_remap_index], fn) -#define CALL_BufferParameteriAPPLE(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint)), driDispatchRemapTable[BufferParameteriAPPLE_remap_index], parameters) -#define GET_BufferParameteriAPPLE(disp) GET_by_offset(disp, driDispatchRemapTable[BufferParameteriAPPLE_remap_index]) -#define SET_BufferParameteriAPPLE(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BufferParameteriAPPLE_remap_index], fn) -#define CALL_FlushMappedBufferRangeAPPLE(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLintptr, GLsizeiptr)), driDispatchRemapTable[FlushMappedBufferRangeAPPLE_remap_index], parameters) -#define GET_FlushMappedBufferRangeAPPLE(disp) GET_by_offset(disp, driDispatchRemapTable[FlushMappedBufferRangeAPPLE_remap_index]) -#define SET_FlushMappedBufferRangeAPPLE(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FlushMappedBufferRangeAPPLE_remap_index], fn) -#define CALL_FramebufferTextureLayerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLuint, GLint, GLint)), driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index], parameters) -#define GET_FramebufferTextureLayerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index]) -#define SET_FramebufferTextureLayerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index], fn) -#define CALL_ProvokingVertexEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[ProvokingVertexEXT_remap_index], parameters) -#define GET_ProvokingVertexEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ProvokingVertexEXT_remap_index]) -#define SET_ProvokingVertexEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProvokingVertexEXT_remap_index], fn) -#define CALL_GetTexParameterPointervAPPLE(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLvoid **)), driDispatchRemapTable[GetTexParameterPointervAPPLE_remap_index], parameters) -#define GET_GetTexParameterPointervAPPLE(disp) GET_by_offset(disp, driDispatchRemapTable[GetTexParameterPointervAPPLE_remap_index]) -#define SET_GetTexParameterPointervAPPLE(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetTexParameterPointervAPPLE_remap_index], fn) -#define CALL_TextureRangeAPPLE(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, GLvoid *)), driDispatchRemapTable[TextureRangeAPPLE_remap_index], parameters) -#define GET_TextureRangeAPPLE(disp) GET_by_offset(disp, driDispatchRemapTable[TextureRangeAPPLE_remap_index]) -#define SET_TextureRangeAPPLE(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TextureRangeAPPLE_remap_index], fn) -#define CALL_StencilFuncSeparateATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint, GLuint)), driDispatchRemapTable[StencilFuncSeparateATI_remap_index], parameters) -#define GET_StencilFuncSeparateATI(disp) GET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparateATI_remap_index]) -#define SET_StencilFuncSeparateATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparateATI_remap_index], fn) -#define CALL_ProgramEnvParameters4fvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index], parameters) -#define GET_ProgramEnvParameters4fvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index]) -#define SET_ProgramEnvParameters4fvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index], fn) -#define CALL_ProgramLocalParameters4fvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[ProgramLocalParameters4fvEXT_remap_index], parameters) -#define GET_ProgramLocalParameters4fvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameters4fvEXT_remap_index]) -#define SET_ProgramLocalParameters4fvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameters4fvEXT_remap_index], fn) -#define CALL_GetQueryObjecti64vEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint64EXT *)), driDispatchRemapTable[GetQueryObjecti64vEXT_remap_index], parameters) -#define GET_GetQueryObjecti64vEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetQueryObjecti64vEXT_remap_index]) -#define SET_GetQueryObjecti64vEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetQueryObjecti64vEXT_remap_index], fn) -#define CALL_GetQueryObjectui64vEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLuint64EXT *)), driDispatchRemapTable[GetQueryObjectui64vEXT_remap_index], parameters) -#define GET_GetQueryObjectui64vEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetQueryObjectui64vEXT_remap_index]) -#define SET_GetQueryObjectui64vEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetQueryObjectui64vEXT_remap_index], fn) - -#endif /* !defined(IN_DRI_DRIVER) */ +#include "glapidispatch.h" -#endif /* !defined( _DISPATCH_H_ ) */ +#endif /* _DISPATCH_H */ diff --git a/src/mesa/glapi/gl_table.py b/src/mesa/glapi/gl_table.py index 55a33748ae..6cf26f89db 100644 --- a/src/mesa/glapi/gl_table.py +++ b/src/mesa/glapi/gl_table.py @@ -71,7 +71,7 @@ class PrintRemapTable(gl_XML.gl_print_base): def __init__(self): gl_XML.gl_print_base.__init__(self) - self.header_tag = '_DISPATCH_H_' + self.header_tag = '_GLAPI_DISPATCH_H_' self.name = "gl_table.py (from Mesa)" self.license = license.bsd_license_template % ("(C) Copyright IBM Corporation 2005", "IBM") return @@ -79,9 +79,8 @@ class PrintRemapTable(gl_XML.gl_print_base): def printRealHeader(self): print """ -#include "glapitable.h" /** - * \\file dispatch.h + * \\file glapidispatch.h * Macros for handling GL dispatch tables. * * For each known GL function, there are 3 macros in this file. The first diff --git a/src/mesa/glapi/glapidispatch.h b/src/mesa/glapi/glapidispatch.h new file mode 100644 index 0000000000..1d26dfb5bf --- /dev/null +++ b/src/mesa/glapi/glapidispatch.h @@ -0,0 +1,4005 @@ +/* DO NOT EDIT - This file generated automatically by gl_table.py (from Mesa) script */ + +/* + * (C) Copyright IBM Corporation 2005 + * 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 + * IBM, + * 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. + */ + +#if !defined( _GLAPI_DISPATCH_H_ ) +# define _GLAPI_DISPATCH_H_ + + +/** + * \file glapidispatch.h + * Macros for handling GL dispatch tables. + * + * For each known GL function, there are 3 macros in this file. The first + * macro is named CALL_FuncName and is used to call that GL function using + * the specified dispatch table. The other 2 macros, called GET_FuncName + * can SET_FuncName, are used to get and set the dispatch pointer for the + * named function in the specified dispatch table. + */ + +#define CALL_by_offset(disp, cast, offset, parameters) \ + (*(cast (GET_by_offset(disp, offset)))) parameters +#define GET_by_offset(disp, offset) \ + (offset >= 0) ? (((_glapi_proc *)(disp))[offset]) : NULL +#define SET_by_offset(disp, offset, fn) \ + do { \ + if ( (offset) < 0 ) { \ + /* fprintf( stderr, "[%s:%u] SET_by_offset(%p, %d, %s)!\n", */ \ + /* __func__, __LINE__, disp, offset, # fn); */ \ + /* abort(); */ \ + } \ + else { \ + ( (_glapi_proc *) (disp) )[offset] = (_glapi_proc) fn; \ + } \ + } while(0) + +#define CALL_NewList(disp, parameters) (*((disp)->NewList)) parameters +#define GET_NewList(disp) ((disp)->NewList) +#define SET_NewList(disp, fn) ((disp)->NewList = fn) +#define CALL_EndList(disp, parameters) (*((disp)->EndList)) parameters +#define GET_EndList(disp) ((disp)->EndList) +#define SET_EndList(disp, fn) ((disp)->EndList = fn) +#define CALL_CallList(disp, parameters) (*((disp)->CallList)) parameters +#define GET_CallList(disp) ((disp)->CallList) +#define SET_CallList(disp, fn) ((disp)->CallList = fn) +#define CALL_CallLists(disp, parameters) (*((disp)->CallLists)) parameters +#define GET_CallLists(disp) ((disp)->CallLists) +#define SET_CallLists(disp, fn) ((disp)->CallLists = fn) +#define CALL_DeleteLists(disp, parameters) (*((disp)->DeleteLists)) parameters +#define GET_DeleteLists(disp) ((disp)->DeleteLists) +#define SET_DeleteLists(disp, fn) ((disp)->DeleteLists = fn) +#define CALL_GenLists(disp, parameters) (*((disp)->GenLists)) parameters +#define GET_GenLists(disp) ((disp)->GenLists) +#define SET_GenLists(disp, fn) ((disp)->GenLists = fn) +#define CALL_ListBase(disp, parameters) (*((disp)->ListBase)) parameters +#define GET_ListBase(disp) ((disp)->ListBase) +#define SET_ListBase(disp, fn) ((disp)->ListBase = fn) +#define CALL_Begin(disp, parameters) (*((disp)->Begin)) parameters +#define GET_Begin(disp) ((disp)->Begin) +#define SET_Begin(disp, fn) ((disp)->Begin = fn) +#define CALL_Bitmap(disp, parameters) (*((disp)->Bitmap)) parameters +#define GET_Bitmap(disp) ((disp)->Bitmap) +#define SET_Bitmap(disp, fn) ((disp)->Bitmap = fn) +#define CALL_Color3b(disp, parameters) (*((disp)->Color3b)) parameters +#define GET_Color3b(disp) ((disp)->Color3b) +#define SET_Color3b(disp, fn) ((disp)->Color3b = fn) +#define CALL_Color3bv(disp, parameters) (*((disp)->Color3bv)) parameters +#define GET_Color3bv(disp) ((disp)->Color3bv) +#define SET_Color3bv(disp, fn) ((disp)->Color3bv = fn) +#define CALL_Color3d(disp, parameters) (*((disp)->Color3d)) parameters +#define GET_Color3d(disp) ((disp)->Color3d) +#define SET_Color3d(disp, fn) ((disp)->Color3d = fn) +#define CALL_Color3dv(disp, parameters) (*((disp)->Color3dv)) parameters +#define GET_Color3dv(disp) ((disp)->Color3dv) +#define SET_Color3dv(disp, fn) ((disp)->Color3dv = fn) +#define CALL_Color3f(disp, parameters) (*((disp)->Color3f)) parameters +#define GET_Color3f(disp) ((disp)->Color3f) +#define SET_Color3f(disp, fn) ((disp)->Color3f = fn) +#define CALL_Color3fv(disp, parameters) (*((disp)->Color3fv)) parameters +#define GET_Color3fv(disp) ((disp)->Color3fv) +#define SET_Color3fv(disp, fn) ((disp)->Color3fv = fn) +#define CALL_Color3i(disp, parameters) (*((disp)->Color3i)) parameters +#define GET_Color3i(disp) ((disp)->Color3i) +#define SET_Color3i(disp, fn) ((disp)->Color3i = fn) +#define CALL_Color3iv(disp, parameters) (*((disp)->Color3iv)) parameters +#define GET_Color3iv(disp) ((disp)->Color3iv) +#define SET_Color3iv(disp, fn) ((disp)->Color3iv = fn) +#define CALL_Color3s(disp, parameters) (*((disp)->Color3s)) parameters +#define GET_Color3s(disp) ((disp)->Color3s) +#define SET_Color3s(disp, fn) ((disp)->Color3s = fn) +#define CALL_Color3sv(disp, parameters) (*((disp)->Color3sv)) parameters +#define GET_Color3sv(disp) ((disp)->Color3sv) +#define SET_Color3sv(disp, fn) ((disp)->Color3sv = fn) +#define CALL_Color3ub(disp, parameters) (*((disp)->Color3ub)) parameters +#define GET_Color3ub(disp) ((disp)->Color3ub) +#define SET_Color3ub(disp, fn) ((disp)->Color3ub = fn) +#define CALL_Color3ubv(disp, parameters) (*((disp)->Color3ubv)) parameters +#define GET_Color3ubv(disp) ((disp)->Color3ubv) +#define SET_Color3ubv(disp, fn) ((disp)->Color3ubv = fn) +#define CALL_Color3ui(disp, parameters) (*((disp)->Color3ui)) parameters +#define GET_Color3ui(disp) ((disp)->Color3ui) +#define SET_Color3ui(disp, fn) ((disp)->Color3ui = fn) +#define CALL_Color3uiv(disp, parameters) (*((disp)->Color3uiv)) parameters +#define GET_Color3uiv(disp) ((disp)->Color3uiv) +#define SET_Color3uiv(disp, fn) ((disp)->Color3uiv = fn) +#define CALL_Color3us(disp, parameters) (*((disp)->Color3us)) parameters +#define GET_Color3us(disp) ((disp)->Color3us) +#define SET_Color3us(disp, fn) ((disp)->Color3us = fn) +#define CALL_Color3usv(disp, parameters) (*((disp)->Color3usv)) parameters +#define GET_Color3usv(disp) ((disp)->Color3usv) +#define SET_Color3usv(disp, fn) ((disp)->Color3usv = fn) +#define CALL_Color4b(disp, parameters) (*((disp)->Color4b)) parameters +#define GET_Color4b(disp) ((disp)->Color4b) +#define SET_Color4b(disp, fn) ((disp)->Color4b = fn) +#define CALL_Color4bv(disp, parameters) (*((disp)->Color4bv)) parameters +#define GET_Color4bv(disp) ((disp)->Color4bv) +#define SET_Color4bv(disp, fn) ((disp)->Color4bv = fn) +#define CALL_Color4d(disp, parameters) (*((disp)->Color4d)) parameters +#define GET_Color4d(disp) ((disp)->Color4d) +#define SET_Color4d(disp, fn) ((disp)->Color4d = fn) +#define CALL_Color4dv(disp, parameters) (*((disp)->Color4dv)) parameters +#define GET_Color4dv(disp) ((disp)->Color4dv) +#define SET_Color4dv(disp, fn) ((disp)->Color4dv = fn) +#define CALL_Color4f(disp, parameters) (*((disp)->Color4f)) parameters +#define GET_Color4f(disp) ((disp)->Color4f) +#define SET_Color4f(disp, fn) ((disp)->Color4f = fn) +#define CALL_Color4fv(disp, parameters) (*((disp)->Color4fv)) parameters +#define GET_Color4fv(disp) ((disp)->Color4fv) +#define SET_Color4fv(disp, fn) ((disp)->Color4fv = fn) +#define CALL_Color4i(disp, parameters) (*((disp)->Color4i)) parameters +#define GET_Color4i(disp) ((disp)->Color4i) +#define SET_Color4i(disp, fn) ((disp)->Color4i = fn) +#define CALL_Color4iv(disp, parameters) (*((disp)->Color4iv)) parameters +#define GET_Color4iv(disp) ((disp)->Color4iv) +#define SET_Color4iv(disp, fn) ((disp)->Color4iv = fn) +#define CALL_Color4s(disp, parameters) (*((disp)->Color4s)) parameters +#define GET_Color4s(disp) ((disp)->Color4s) +#define SET_Color4s(disp, fn) ((disp)->Color4s = fn) +#define CALL_Color4sv(disp, parameters) (*((disp)->Color4sv)) parameters +#define GET_Color4sv(disp) ((disp)->Color4sv) +#define SET_Color4sv(disp, fn) ((disp)->Color4sv = fn) +#define CALL_Color4ub(disp, parameters) (*((disp)->Color4ub)) parameters +#define GET_Color4ub(disp) ((disp)->Color4ub) +#define SET_Color4ub(disp, fn) ((disp)->Color4ub = fn) +#define CALL_Color4ubv(disp, parameters) (*((disp)->Color4ubv)) parameters +#define GET_Color4ubv(disp) ((disp)->Color4ubv) +#define SET_Color4ubv(disp, fn) ((disp)->Color4ubv = fn) +#define CALL_Color4ui(disp, parameters) (*((disp)->Color4ui)) parameters +#define GET_Color4ui(disp) ((disp)->Color4ui) +#define SET_Color4ui(disp, fn) ((disp)->Color4ui = fn) +#define CALL_Color4uiv(disp, parameters) (*((disp)->Color4uiv)) parameters +#define GET_Color4uiv(disp) ((disp)->Color4uiv) +#define SET_Color4uiv(disp, fn) ((disp)->Color4uiv = fn) +#define CALL_Color4us(disp, parameters) (*((disp)->Color4us)) parameters +#define GET_Color4us(disp) ((disp)->Color4us) +#define SET_Color4us(disp, fn) ((disp)->Color4us = fn) +#define CALL_Color4usv(disp, parameters) (*((disp)->Color4usv)) parameters +#define GET_Color4usv(disp) ((disp)->Color4usv) +#define SET_Color4usv(disp, fn) ((disp)->Color4usv = fn) +#define CALL_EdgeFlag(disp, parameters) (*((disp)->EdgeFlag)) parameters +#define GET_EdgeFlag(disp) ((disp)->EdgeFlag) +#define SET_EdgeFlag(disp, fn) ((disp)->EdgeFlag = fn) +#define CALL_EdgeFlagv(disp, parameters) (*((disp)->EdgeFlagv)) parameters +#define GET_EdgeFlagv(disp) ((disp)->EdgeFlagv) +#define SET_EdgeFlagv(disp, fn) ((disp)->EdgeFlagv = fn) +#define CALL_End(disp, parameters) (*((disp)->End)) parameters +#define GET_End(disp) ((disp)->End) +#define SET_End(disp, fn) ((disp)->End = fn) +#define CALL_Indexd(disp, parameters) (*((disp)->Indexd)) parameters +#define GET_Indexd(disp) ((disp)->Indexd) +#define SET_Indexd(disp, fn) ((disp)->Indexd = fn) +#define CALL_Indexdv(disp, parameters) (*((disp)->Indexdv)) parameters +#define GET_Indexdv(disp) ((disp)->Indexdv) +#define SET_Indexdv(disp, fn) ((disp)->Indexdv = fn) +#define CALL_Indexf(disp, parameters) (*((disp)->Indexf)) parameters +#define GET_Indexf(disp) ((disp)->Indexf) +#define SET_Indexf(disp, fn) ((disp)->Indexf = fn) +#define CALL_Indexfv(disp, parameters) (*((disp)->Indexfv)) parameters +#define GET_Indexfv(disp) ((disp)->Indexfv) +#define SET_Indexfv(disp, fn) ((disp)->Indexfv = fn) +#define CALL_Indexi(disp, parameters) (*((disp)->Indexi)) parameters +#define GET_Indexi(disp) ((disp)->Indexi) +#define SET_Indexi(disp, fn) ((disp)->Indexi = fn) +#define CALL_Indexiv(disp, parameters) (*((disp)->Indexiv)) parameters +#define GET_Indexiv(disp) ((disp)->Indexiv) +#define SET_Indexiv(disp, fn) ((disp)->Indexiv = fn) +#define CALL_Indexs(disp, parameters) (*((disp)->Indexs)) parameters +#define GET_Indexs(disp) ((disp)->Indexs) +#define SET_Indexs(disp, fn) ((disp)->Indexs = fn) +#define CALL_Indexsv(disp, parameters) (*((disp)->Indexsv)) parameters +#define GET_Indexsv(disp) ((disp)->Indexsv) +#define SET_Indexsv(disp, fn) ((disp)->Indexsv = fn) +#define CALL_Normal3b(disp, parameters) (*((disp)->Normal3b)) parameters +#define GET_Normal3b(disp) ((disp)->Normal3b) +#define SET_Normal3b(disp, fn) ((disp)->Normal3b = fn) +#define CALL_Normal3bv(disp, parameters) (*((disp)->Normal3bv)) parameters +#define GET_Normal3bv(disp) ((disp)->Normal3bv) +#define SET_Normal3bv(disp, fn) ((disp)->Normal3bv = fn) +#define CALL_Normal3d(disp, parameters) (*((disp)->Normal3d)) parameters +#define GET_Normal3d(disp) ((disp)->Normal3d) +#define SET_Normal3d(disp, fn) ((disp)->Normal3d = fn) +#define CALL_Normal3dv(disp, parameters) (*((disp)->Normal3dv)) parameters +#define GET_Normal3dv(disp) ((disp)->Normal3dv) +#define SET_Normal3dv(disp, fn) ((disp)->Normal3dv = fn) +#define CALL_Normal3f(disp, parameters) (*((disp)->Normal3f)) parameters +#define GET_Normal3f(disp) ((disp)->Normal3f) +#define SET_Normal3f(disp, fn) ((disp)->Normal3f = fn) +#define CALL_Normal3fv(disp, parameters) (*((disp)->Normal3fv)) parameters +#define GET_Normal3fv(disp) ((disp)->Normal3fv) +#define SET_Normal3fv(disp, fn) ((disp)->Normal3fv = fn) +#define CALL_Normal3i(disp, parameters) (*((disp)->Normal3i)) parameters +#define GET_Normal3i(disp) ((disp)->Normal3i) +#define SET_Normal3i(disp, fn) ((disp)->Normal3i = fn) +#define CALL_Normal3iv(disp, parameters) (*((disp)->Normal3iv)) parameters +#define GET_Normal3iv(disp) ((disp)->Normal3iv) +#define SET_Normal3iv(disp, fn) ((disp)->Normal3iv = fn) +#define CALL_Normal3s(disp, parameters) (*((disp)->Normal3s)) parameters +#define GET_Normal3s(disp) ((disp)->Normal3s) +#define SET_Normal3s(disp, fn) ((disp)->Normal3s = fn) +#define CALL_Normal3sv(disp, parameters) (*((disp)->Normal3sv)) parameters +#define GET_Normal3sv(disp) ((disp)->Normal3sv) +#define SET_Normal3sv(disp, fn) ((disp)->Normal3sv = fn) +#define CALL_RasterPos2d(disp, parameters) (*((disp)->RasterPos2d)) parameters +#define GET_RasterPos2d(disp) ((disp)->RasterPos2d) +#define SET_RasterPos2d(disp, fn) ((disp)->RasterPos2d = fn) +#define CALL_RasterPos2dv(disp, parameters) (*((disp)->RasterPos2dv)) parameters +#define GET_RasterPos2dv(disp) ((disp)->RasterPos2dv) +#define SET_RasterPos2dv(disp, fn) ((disp)->RasterPos2dv = fn) +#define CALL_RasterPos2f(disp, parameters) (*((disp)->RasterPos2f)) parameters +#define GET_RasterPos2f(disp) ((disp)->RasterPos2f) +#define SET_RasterPos2f(disp, fn) ((disp)->RasterPos2f = fn) +#define CALL_RasterPos2fv(disp, parameters) (*((disp)->RasterPos2fv)) parameters +#define GET_RasterPos2fv(disp) ((disp)->RasterPos2fv) +#define SET_RasterPos2fv(disp, fn) ((disp)->RasterPos2fv = fn) +#define CALL_RasterPos2i(disp, parameters) (*((disp)->RasterPos2i)) parameters +#define GET_RasterPos2i(disp) ((disp)->RasterPos2i) +#define SET_RasterPos2i(disp, fn) ((disp)->RasterPos2i = fn) +#define CALL_RasterPos2iv(disp, parameters) (*((disp)->RasterPos2iv)) parameters +#define GET_RasterPos2iv(disp) ((disp)->RasterPos2iv) +#define SET_RasterPos2iv(disp, fn) ((disp)->RasterPos2iv = fn) +#define CALL_RasterPos2s(disp, parameters) (*((disp)->RasterPos2s)) parameters +#define GET_RasterPos2s(disp) ((disp)->RasterPos2s) +#define SET_RasterPos2s(disp, fn) ((disp)->RasterPos2s = fn) +#define CALL_RasterPos2sv(disp, parameters) (*((disp)->RasterPos2sv)) parameters +#define GET_RasterPos2sv(disp) ((disp)->RasterPos2sv) +#define SET_RasterPos2sv(disp, fn) ((disp)->RasterPos2sv = fn) +#define CALL_RasterPos3d(disp, parameters) (*((disp)->RasterPos3d)) parameters +#define GET_RasterPos3d(disp) ((disp)->RasterPos3d) +#define SET_RasterPos3d(disp, fn) ((disp)->RasterPos3d = fn) +#define CALL_RasterPos3dv(disp, parameters) (*((disp)->RasterPos3dv)) parameters +#define GET_RasterPos3dv(disp) ((disp)->RasterPos3dv) +#define SET_RasterPos3dv(disp, fn) ((disp)->RasterPos3dv = fn) +#define CALL_RasterPos3f(disp, parameters) (*((disp)->RasterPos3f)) parameters +#define GET_RasterPos3f(disp) ((disp)->RasterPos3f) +#define SET_RasterPos3f(disp, fn) ((disp)->RasterPos3f = fn) +#define CALL_RasterPos3fv(disp, parameters) (*((disp)->RasterPos3fv)) parameters +#define GET_RasterPos3fv(disp) ((disp)->RasterPos3fv) +#define SET_RasterPos3fv(disp, fn) ((disp)->RasterPos3fv = fn) +#define CALL_RasterPos3i(disp, parameters) (*((disp)->RasterPos3i)) parameters +#define GET_RasterPos3i(disp) ((disp)->RasterPos3i) +#define SET_RasterPos3i(disp, fn) ((disp)->RasterPos3i = fn) +#define CALL_RasterPos3iv(disp, parameters) (*((disp)->RasterPos3iv)) parameters +#define GET_RasterPos3iv(disp) ((disp)->RasterPos3iv) +#define SET_RasterPos3iv(disp, fn) ((disp)->RasterPos3iv = fn) +#define CALL_RasterPos3s(disp, parameters) (*((disp)->RasterPos3s)) parameters +#define GET_RasterPos3s(disp) ((disp)->RasterPos3s) +#define SET_RasterPos3s(disp, fn) ((disp)->RasterPos3s = fn) +#define CALL_RasterPos3sv(disp, parameters) (*((disp)->RasterPos3sv)) parameters +#define GET_RasterPos3sv(disp) ((disp)->RasterPos3sv) +#define SET_RasterPos3sv(disp, fn) ((disp)->RasterPos3sv = fn) +#define CALL_RasterPos4d(disp, parameters) (*((disp)->RasterPos4d)) parameters +#define GET_RasterPos4d(disp) ((disp)->RasterPos4d) +#define SET_RasterPos4d(disp, fn) ((disp)->RasterPos4d = fn) +#define CALL_RasterPos4dv(disp, parameters) (*((disp)->RasterPos4dv)) parameters +#define GET_RasterPos4dv(disp) ((disp)->RasterPos4dv) +#define SET_RasterPos4dv(disp, fn) ((disp)->RasterPos4dv = fn) +#define CALL_RasterPos4f(disp, parameters) (*((disp)->RasterPos4f)) parameters +#define GET_RasterPos4f(disp) ((disp)->RasterPos4f) +#define SET_RasterPos4f(disp, fn) ((disp)->RasterPos4f = fn) +#define CALL_RasterPos4fv(disp, parameters) (*((disp)->RasterPos4fv)) parameters +#define GET_RasterPos4fv(disp) ((disp)->RasterPos4fv) +#define SET_RasterPos4fv(disp, fn) ((disp)->RasterPos4fv = fn) +#define CALL_RasterPos4i(disp, parameters) (*((disp)->RasterPos4i)) parameters +#define GET_RasterPos4i(disp) ((disp)->RasterPos4i) +#define SET_RasterPos4i(disp, fn) ((disp)->RasterPos4i = fn) +#define CALL_RasterPos4iv(disp, parameters) (*((disp)->RasterPos4iv)) parameters +#define GET_RasterPos4iv(disp) ((disp)->RasterPos4iv) +#define SET_RasterPos4iv(disp, fn) ((disp)->RasterPos4iv = fn) +#define CALL_RasterPos4s(disp, parameters) (*((disp)->RasterPos4s)) parameters +#define GET_RasterPos4s(disp) ((disp)->RasterPos4s) +#define SET_RasterPos4s(disp, fn) ((disp)->RasterPos4s = fn) +#define CALL_RasterPos4sv(disp, parameters) (*((disp)->RasterPos4sv)) parameters +#define GET_RasterPos4sv(disp) ((disp)->RasterPos4sv) +#define SET_RasterPos4sv(disp, fn) ((disp)->RasterPos4sv = fn) +#define CALL_Rectd(disp, parameters) (*((disp)->Rectd)) parameters +#define GET_Rectd(disp) ((disp)->Rectd) +#define SET_Rectd(disp, fn) ((disp)->Rectd = fn) +#define CALL_Rectdv(disp, parameters) (*((disp)->Rectdv)) parameters +#define GET_Rectdv(disp) ((disp)->Rectdv) +#define SET_Rectdv(disp, fn) ((disp)->Rectdv = fn) +#define CALL_Rectf(disp, parameters) (*((disp)->Rectf)) parameters +#define GET_Rectf(disp) ((disp)->Rectf) +#define SET_Rectf(disp, fn) ((disp)->Rectf = fn) +#define CALL_Rectfv(disp, parameters) (*((disp)->Rectfv)) parameters +#define GET_Rectfv(disp) ((disp)->Rectfv) +#define SET_Rectfv(disp, fn) ((disp)->Rectfv = fn) +#define CALL_Recti(disp, parameters) (*((disp)->Recti)) parameters +#define GET_Recti(disp) ((disp)->Recti) +#define SET_Recti(disp, fn) ((disp)->Recti = fn) +#define CALL_Rectiv(disp, parameters) (*((disp)->Rectiv)) parameters +#define GET_Rectiv(disp) ((disp)->Rectiv) +#define SET_Rectiv(disp, fn) ((disp)->Rectiv = fn) +#define CALL_Rects(disp, parameters) (*((disp)->Rects)) parameters +#define GET_Rects(disp) ((disp)->Rects) +#define SET_Rects(disp, fn) ((disp)->Rects = fn) +#define CALL_Rectsv(disp, parameters) (*((disp)->Rectsv)) parameters +#define GET_Rectsv(disp) ((disp)->Rectsv) +#define SET_Rectsv(disp, fn) ((disp)->Rectsv = fn) +#define CALL_TexCoord1d(disp, parameters) (*((disp)->TexCoord1d)) parameters +#define GET_TexCoord1d(disp) ((disp)->TexCoord1d) +#define SET_TexCoord1d(disp, fn) ((disp)->TexCoord1d = fn) +#define CALL_TexCoord1dv(disp, parameters) (*((disp)->TexCoord1dv)) parameters +#define GET_TexCoord1dv(disp) ((disp)->TexCoord1dv) +#define SET_TexCoord1dv(disp, fn) ((disp)->TexCoord1dv = fn) +#define CALL_TexCoord1f(disp, parameters) (*((disp)->TexCoord1f)) parameters +#define GET_TexCoord1f(disp) ((disp)->TexCoord1f) +#define SET_TexCoord1f(disp, fn) ((disp)->TexCoord1f = fn) +#define CALL_TexCoord1fv(disp, parameters) (*((disp)->TexCoord1fv)) parameters +#define GET_TexCoord1fv(disp) ((disp)->TexCoord1fv) +#define SET_TexCoord1fv(disp, fn) ((disp)->TexCoord1fv = fn) +#define CALL_TexCoord1i(disp, parameters) (*((disp)->TexCoord1i)) parameters +#define GET_TexCoord1i(disp) ((disp)->TexCoord1i) +#define SET_TexCoord1i(disp, fn) ((disp)->TexCoord1i = fn) +#define CALL_TexCoord1iv(disp, parameters) (*((disp)->TexCoord1iv)) parameters +#define GET_TexCoord1iv(disp) ((disp)->TexCoord1iv) +#define SET_TexCoord1iv(disp, fn) ((disp)->TexCoord1iv = fn) +#define CALL_TexCoord1s(disp, parameters) (*((disp)->TexCoord1s)) parameters +#define GET_TexCoord1s(disp) ((disp)->TexCoord1s) +#define SET_TexCoord1s(disp, fn) ((disp)->TexCoord1s = fn) +#define CALL_TexCoord1sv(disp, parameters) (*((disp)->TexCoord1sv)) parameters +#define GET_TexCoord1sv(disp) ((disp)->TexCoord1sv) +#define SET_TexCoord1sv(disp, fn) ((disp)->TexCoord1sv = fn) +#define CALL_TexCoord2d(disp, parameters) (*((disp)->TexCoord2d)) parameters +#define GET_TexCoord2d(disp) ((disp)->TexCoord2d) +#define SET_TexCoord2d(disp, fn) ((disp)->TexCoord2d = fn) +#define CALL_TexCoord2dv(disp, parameters) (*((disp)->TexCoord2dv)) parameters +#define GET_TexCoord2dv(disp) ((disp)->TexCoord2dv) +#define SET_TexCoord2dv(disp, fn) ((disp)->TexCoord2dv = fn) +#define CALL_TexCoord2f(disp, parameters) (*((disp)->TexCoord2f)) parameters +#define GET_TexCoord2f(disp) ((disp)->TexCoord2f) +#define SET_TexCoord2f(disp, fn) ((disp)->TexCoord2f = fn) +#define CALL_TexCoord2fv(disp, parameters) (*((disp)->TexCoord2fv)) parameters +#define GET_TexCoord2fv(disp) ((disp)->TexCoord2fv) +#define SET_TexCoord2fv(disp, fn) ((disp)->TexCoord2fv = fn) +#define CALL_TexCoord2i(disp, parameters) (*((disp)->TexCoord2i)) parameters +#define GET_TexCoord2i(disp) ((disp)->TexCoord2i) +#define SET_TexCoord2i(disp, fn) ((disp)->TexCoord2i = fn) +#define CALL_TexCoord2iv(disp, parameters) (*((disp)->TexCoord2iv)) parameters +#define GET_TexCoord2iv(disp) ((disp)->TexCoord2iv) +#define SET_TexCoord2iv(disp, fn) ((disp)->TexCoord2iv = fn) +#define CALL_TexCoord2s(disp, parameters) (*((disp)->TexCoord2s)) parameters +#define GET_TexCoord2s(disp) ((disp)->TexCoord2s) +#define SET_TexCoord2s(disp, fn) ((disp)->TexCoord2s = fn) +#define CALL_TexCoord2sv(disp, parameters) (*((disp)->TexCoord2sv)) parameters +#define GET_TexCoord2sv(disp) ((disp)->TexCoord2sv) +#define SET_TexCoord2sv(disp, fn) ((disp)->TexCoord2sv = fn) +#define CALL_TexCoord3d(disp, parameters) (*((disp)->TexCoord3d)) parameters +#define GET_TexCoord3d(disp) ((disp)->TexCoord3d) +#define SET_TexCoord3d(disp, fn) ((disp)->TexCoord3d = fn) +#define CALL_TexCoord3dv(disp, parameters) (*((disp)->TexCoord3dv)) parameters +#define GET_TexCoord3dv(disp) ((disp)->TexCoord3dv) +#define SET_TexCoord3dv(disp, fn) ((disp)->TexCoord3dv = fn) +#define CALL_TexCoord3f(disp, parameters) (*((disp)->TexCoord3f)) parameters +#define GET_TexCoord3f(disp) ((disp)->TexCoord3f) +#define SET_TexCoord3f(disp, fn) ((disp)->TexCoord3f = fn) +#define CALL_TexCoord3fv(disp, parameters) (*((disp)->TexCoord3fv)) parameters +#define GET_TexCoord3fv(disp) ((disp)->TexCoord3fv) +#define SET_TexCoord3fv(disp, fn) ((disp)->TexCoord3fv = fn) +#define CALL_TexCoord3i(disp, parameters) (*((disp)->TexCoord3i)) parameters +#define GET_TexCoord3i(disp) ((disp)->TexCoord3i) +#define SET_TexCoord3i(disp, fn) ((disp)->TexCoord3i = fn) +#define CALL_TexCoord3iv(disp, parameters) (*((disp)->TexCoord3iv)) parameters +#define GET_TexCoord3iv(disp) ((disp)->TexCoord3iv) +#define SET_TexCoord3iv(disp, fn) ((disp)->TexCoord3iv = fn) +#define CALL_TexCoord3s(disp, parameters) (*((disp)->TexCoord3s)) parameters +#define GET_TexCoord3s(disp) ((disp)->TexCoord3s) +#define SET_TexCoord3s(disp, fn) ((disp)->TexCoord3s = fn) +#define CALL_TexCoord3sv(disp, parameters) (*((disp)->TexCoord3sv)) parameters +#define GET_TexCoord3sv(disp) ((disp)->TexCoord3sv) +#define SET_TexCoord3sv(disp, fn) ((disp)->TexCoord3sv = fn) +#define CALL_TexCoord4d(disp, parameters) (*((disp)->TexCoord4d)) parameters +#define GET_TexCoord4d(disp) ((disp)->TexCoord4d) +#define SET_TexCoord4d(disp, fn) ((disp)->TexCoord4d = fn) +#define CALL_TexCoord4dv(disp, parameters) (*((disp)->TexCoord4dv)) parameters +#define GET_TexCoord4dv(disp) ((disp)->TexCoord4dv) +#define SET_TexCoord4dv(disp, fn) ((disp)->TexCoord4dv = fn) +#define CALL_TexCoord4f(disp, parameters) (*((disp)->TexCoord4f)) parameters +#define GET_TexCoord4f(disp) ((disp)->TexCoord4f) +#define SET_TexCoord4f(disp, fn) ((disp)->TexCoord4f = fn) +#define CALL_TexCoord4fv(disp, parameters) (*((disp)->TexCoord4fv)) parameters +#define GET_TexCoord4fv(disp) ((disp)->TexCoord4fv) +#define SET_TexCoord4fv(disp, fn) ((disp)->TexCoord4fv = fn) +#define CALL_TexCoord4i(disp, parameters) (*((disp)->TexCoord4i)) parameters +#define GET_TexCoord4i(disp) ((disp)->TexCoord4i) +#define SET_TexCoord4i(disp, fn) ((disp)->TexCoord4i = fn) +#define CALL_TexCoord4iv(disp, parameters) (*((disp)->TexCoord4iv)) parameters +#define GET_TexCoord4iv(disp) ((disp)->TexCoord4iv) +#define SET_TexCoord4iv(disp, fn) ((disp)->TexCoord4iv = fn) +#define CALL_TexCoord4s(disp, parameters) (*((disp)->TexCoord4s)) parameters +#define GET_TexCoord4s(disp) ((disp)->TexCoord4s) +#define SET_TexCoord4s(disp, fn) ((disp)->TexCoord4s = fn) +#define CALL_TexCoord4sv(disp, parameters) (*((disp)->TexCoord4sv)) parameters +#define GET_TexCoord4sv(disp) ((disp)->TexCoord4sv) +#define SET_TexCoord4sv(disp, fn) ((disp)->TexCoord4sv = fn) +#define CALL_Vertex2d(disp, parameters) (*((disp)->Vertex2d)) parameters +#define GET_Vertex2d(disp) ((disp)->Vertex2d) +#define SET_Vertex2d(disp, fn) ((disp)->Vertex2d = fn) +#define CALL_Vertex2dv(disp, parameters) (*((disp)->Vertex2dv)) parameters +#define GET_Vertex2dv(disp) ((disp)->Vertex2dv) +#define SET_Vertex2dv(disp, fn) ((disp)->Vertex2dv = fn) +#define CALL_Vertex2f(disp, parameters) (*((disp)->Vertex2f)) parameters +#define GET_Vertex2f(disp) ((disp)->Vertex2f) +#define SET_Vertex2f(disp, fn) ((disp)->Vertex2f = fn) +#define CALL_Vertex2fv(disp, parameters) (*((disp)->Vertex2fv)) parameters +#define GET_Vertex2fv(disp) ((disp)->Vertex2fv) +#define SET_Vertex2fv(disp, fn) ((disp)->Vertex2fv = fn) +#define CALL_Vertex2i(disp, parameters) (*((disp)->Vertex2i)) parameters +#define GET_Vertex2i(disp) ((disp)->Vertex2i) +#define SET_Vertex2i(disp, fn) ((disp)->Vertex2i = fn) +#define CALL_Vertex2iv(disp, parameters) (*((disp)->Vertex2iv)) parameters +#define GET_Vertex2iv(disp) ((disp)->Vertex2iv) +#define SET_Vertex2iv(disp, fn) ((disp)->Vertex2iv = fn) +#define CALL_Vertex2s(disp, parameters) (*((disp)->Vertex2s)) parameters +#define GET_Vertex2s(disp) ((disp)->Vertex2s) +#define SET_Vertex2s(disp, fn) ((disp)->Vertex2s = fn) +#define CALL_Vertex2sv(disp, parameters) (*((disp)->Vertex2sv)) parameters +#define GET_Vertex2sv(disp) ((disp)->Vertex2sv) +#define SET_Vertex2sv(disp, fn) ((disp)->Vertex2sv = fn) +#define CALL_Vertex3d(disp, parameters) (*((disp)->Vertex3d)) parameters +#define GET_Vertex3d(disp) ((disp)->Vertex3d) +#define SET_Vertex3d(disp, fn) ((disp)->Vertex3d = fn) +#define CALL_Vertex3dv(disp, parameters) (*((disp)->Vertex3dv)) parameters +#define GET_Vertex3dv(disp) ((disp)->Vertex3dv) +#define SET_Vertex3dv(disp, fn) ((disp)->Vertex3dv = fn) +#define CALL_Vertex3f(disp, parameters) (*((disp)->Vertex3f)) parameters +#define GET_Vertex3f(disp) ((disp)->Vertex3f) +#define SET_Vertex3f(disp, fn) ((disp)->Vertex3f = fn) +#define CALL_Vertex3fv(disp, parameters) (*((disp)->Vertex3fv)) parameters +#define GET_Vertex3fv(disp) ((disp)->Vertex3fv) +#define SET_Vertex3fv(disp, fn) ((disp)->Vertex3fv = fn) +#define CALL_Vertex3i(disp, parameters) (*((disp)->Vertex3i)) parameters +#define GET_Vertex3i(disp) ((disp)->Vertex3i) +#define SET_Vertex3i(disp, fn) ((disp)->Vertex3i = fn) +#define CALL_Vertex3iv(disp, parameters) (*((disp)->Vertex3iv)) parameters +#define GET_Vertex3iv(disp) ((disp)->Vertex3iv) +#define SET_Vertex3iv(disp, fn) ((disp)->Vertex3iv = fn) +#define CALL_Vertex3s(disp, parameters) (*((disp)->Vertex3s)) parameters +#define GET_Vertex3s(disp) ((disp)->Vertex3s) +#define SET_Vertex3s(disp, fn) ((disp)->Vertex3s = fn) +#define CALL_Vertex3sv(disp, parameters) (*((disp)->Vertex3sv)) parameters +#define GET_Vertex3sv(disp) ((disp)->Vertex3sv) +#define SET_Vertex3sv(disp, fn) ((disp)->Vertex3sv = fn) +#define CALL_Vertex4d(disp, parameters) (*((disp)->Vertex4d)) parameters +#define GET_Vertex4d(disp) ((disp)->Vertex4d) +#define SET_Vertex4d(disp, fn) ((disp)->Vertex4d = fn) +#define CALL_Vertex4dv(disp, parameters) (*((disp)->Vertex4dv)) parameters +#define GET_Vertex4dv(disp) ((disp)->Vertex4dv) +#define SET_Vertex4dv(disp, fn) ((disp)->Vertex4dv = fn) +#define CALL_Vertex4f(disp, parameters) (*((disp)->Vertex4f)) parameters +#define GET_Vertex4f(disp) ((disp)->Vertex4f) +#define SET_Vertex4f(disp, fn) ((disp)->Vertex4f = fn) +#define CALL_Vertex4fv(disp, parameters) (*((disp)->Vertex4fv)) parameters +#define GET_Vertex4fv(disp) ((disp)->Vertex4fv) +#define SET_Vertex4fv(disp, fn) ((disp)->Vertex4fv = fn) +#define CALL_Vertex4i(disp, parameters) (*((disp)->Vertex4i)) parameters +#define GET_Vertex4i(disp) ((disp)->Vertex4i) +#define SET_Vertex4i(disp, fn) ((disp)->Vertex4i = fn) +#define CALL_Vertex4iv(disp, parameters) (*((disp)->Vertex4iv)) parameters +#define GET_Vertex4iv(disp) ((disp)->Vertex4iv) +#define SET_Vertex4iv(disp, fn) ((disp)->Vertex4iv = fn) +#define CALL_Vertex4s(disp, parameters) (*((disp)->Vertex4s)) parameters +#define GET_Vertex4s(disp) ((disp)->Vertex4s) +#define SET_Vertex4s(disp, fn) ((disp)->Vertex4s = fn) +#define CALL_Vertex4sv(disp, parameters) (*((disp)->Vertex4sv)) parameters +#define GET_Vertex4sv(disp) ((disp)->Vertex4sv) +#define SET_Vertex4sv(disp, fn) ((disp)->Vertex4sv = fn) +#define CALL_ClipPlane(disp, parameters) (*((disp)->ClipPlane)) parameters +#define GET_ClipPlane(disp) ((disp)->ClipPlane) +#define SET_ClipPlane(disp, fn) ((disp)->ClipPlane = fn) +#define CALL_ColorMaterial(disp, parameters) (*((disp)->ColorMaterial)) parameters +#define GET_ColorMaterial(disp) ((disp)->ColorMaterial) +#define SET_ColorMaterial(disp, fn) ((disp)->ColorMaterial = fn) +#define CALL_CullFace(disp, parameters) (*((disp)->CullFace)) parameters +#define GET_CullFace(disp) ((disp)->CullFace) +#define SET_CullFace(disp, fn) ((disp)->CullFace = fn) +#define CALL_Fogf(disp, parameters) (*((disp)->Fogf)) parameters +#define GET_Fogf(disp) ((disp)->Fogf) +#define SET_Fogf(disp, fn) ((disp)->Fogf = fn) +#define CALL_Fogfv(disp, parameters) (*((disp)->Fogfv)) parameters +#define GET_Fogfv(disp) ((disp)->Fogfv) +#define SET_Fogfv(disp, fn) ((disp)->Fogfv = fn) +#define CALL_Fogi(disp, parameters) (*((disp)->Fogi)) parameters +#define GET_Fogi(disp) ((disp)->Fogi) +#define SET_Fogi(disp, fn) ((disp)->Fogi = fn) +#define CALL_Fogiv(disp, parameters) (*((disp)->Fogiv)) parameters +#define GET_Fogiv(disp) ((disp)->Fogiv) +#define SET_Fogiv(disp, fn) ((disp)->Fogiv = fn) +#define CALL_FrontFace(disp, parameters) (*((disp)->FrontFace)) parameters +#define GET_FrontFace(disp) ((disp)->FrontFace) +#define SET_FrontFace(disp, fn) ((disp)->FrontFace = fn) +#define CALL_Hint(disp, parameters) (*((disp)->Hint)) parameters +#define GET_Hint(disp) ((disp)->Hint) +#define SET_Hint(disp, fn) ((disp)->Hint = fn) +#define CALL_Lightf(disp, parameters) (*((disp)->Lightf)) parameters +#define GET_Lightf(disp) ((disp)->Lightf) +#define SET_Lightf(disp, fn) ((disp)->Lightf = fn) +#define CALL_Lightfv(disp, parameters) (*((disp)->Lightfv)) parameters +#define GET_Lightfv(disp) ((disp)->Lightfv) +#define SET_Lightfv(disp, fn) ((disp)->Lightfv = fn) +#define CALL_Lighti(disp, parameters) (*((disp)->Lighti)) parameters +#define GET_Lighti(disp) ((disp)->Lighti) +#define SET_Lighti(disp, fn) ((disp)->Lighti = fn) +#define CALL_Lightiv(disp, parameters) (*((disp)->Lightiv)) parameters +#define GET_Lightiv(disp) ((disp)->Lightiv) +#define SET_Lightiv(disp, fn) ((disp)->Lightiv = fn) +#define CALL_LightModelf(disp, parameters) (*((disp)->LightModelf)) parameters +#define GET_LightModelf(disp) ((disp)->LightModelf) +#define SET_LightModelf(disp, fn) ((disp)->LightModelf = fn) +#define CALL_LightModelfv(disp, parameters) (*((disp)->LightModelfv)) parameters +#define GET_LightModelfv(disp) ((disp)->LightModelfv) +#define SET_LightModelfv(disp, fn) ((disp)->LightModelfv = fn) +#define CALL_LightModeli(disp, parameters) (*((disp)->LightModeli)) parameters +#define GET_LightModeli(disp) ((disp)->LightModeli) +#define SET_LightModeli(disp, fn) ((disp)->LightModeli = fn) +#define CALL_LightModeliv(disp, parameters) (*((disp)->LightModeliv)) parameters +#define GET_LightModeliv(disp) ((disp)->LightModeliv) +#define SET_LightModeliv(disp, fn) ((disp)->LightModeliv = fn) +#define CALL_LineStipple(disp, parameters) (*((disp)->LineStipple)) parameters +#define GET_LineStipple(disp) ((disp)->LineStipple) +#define SET_LineStipple(disp, fn) ((disp)->LineStipple = fn) +#define CALL_LineWidth(disp, parameters) (*((disp)->LineWidth)) parameters +#define GET_LineWidth(disp) ((disp)->LineWidth) +#define SET_LineWidth(disp, fn) ((disp)->LineWidth = fn) +#define CALL_Materialf(disp, parameters) (*((disp)->Materialf)) parameters +#define GET_Materialf(disp) ((disp)->Materialf) +#define SET_Materialf(disp, fn) ((disp)->Materialf = fn) +#define CALL_Materialfv(disp, parameters) (*((disp)->Materialfv)) parameters +#define GET_Materialfv(disp) ((disp)->Materialfv) +#define SET_Materialfv(disp, fn) ((disp)->Materialfv = fn) +#define CALL_Materiali(disp, parameters) (*((disp)->Materiali)) parameters +#define GET_Materiali(disp) ((disp)->Materiali) +#define SET_Materiali(disp, fn) ((disp)->Materiali = fn) +#define CALL_Materialiv(disp, parameters) (*((disp)->Materialiv)) parameters +#define GET_Materialiv(disp) ((disp)->Materialiv) +#define SET_Materialiv(disp, fn) ((disp)->Materialiv = fn) +#define CALL_PointSize(disp, parameters) (*((disp)->PointSize)) parameters +#define GET_PointSize(disp) ((disp)->PointSize) +#define SET_PointSize(disp, fn) ((disp)->PointSize = fn) +#define CALL_PolygonMode(disp, parameters) (*((disp)->PolygonMode)) parameters +#define GET_PolygonMode(disp) ((disp)->PolygonMode) +#define SET_PolygonMode(disp, fn) ((disp)->PolygonMode = fn) +#define CALL_PolygonStipple(disp, parameters) (*((disp)->PolygonStipple)) parameters +#define GET_PolygonStipple(disp) ((disp)->PolygonStipple) +#define SET_PolygonStipple(disp, fn) ((disp)->PolygonStipple = fn) +#define CALL_Scissor(disp, parameters) (*((disp)->Scissor)) parameters +#define GET_Scissor(disp) ((disp)->Scissor) +#define SET_Scissor(disp, fn) ((disp)->Scissor = fn) +#define CALL_ShadeModel(disp, parameters) (*((disp)->ShadeModel)) parameters +#define GET_ShadeModel(disp) ((disp)->ShadeModel) +#define SET_ShadeModel(disp, fn) ((disp)->ShadeModel = fn) +#define CALL_TexParameterf(disp, parameters) (*((disp)->TexParameterf)) parameters +#define GET_TexParameterf(disp) ((disp)->TexParameterf) +#define SET_TexParameterf(disp, fn) ((disp)->TexParameterf = fn) +#define CALL_TexParameterfv(disp, parameters) (*((disp)->TexParameterfv)) parameters +#define GET_TexParameterfv(disp) ((disp)->TexParameterfv) +#define SET_TexParameterfv(disp, fn) ((disp)->TexParameterfv = fn) +#define CALL_TexParameteri(disp, parameters) (*((disp)->TexParameteri)) parameters +#define GET_TexParameteri(disp) ((disp)->TexParameteri) +#define SET_TexParameteri(disp, fn) ((disp)->TexParameteri = fn) +#define CALL_TexParameteriv(disp, parameters) (*((disp)->TexParameteriv)) parameters +#define GET_TexParameteriv(disp) ((disp)->TexParameteriv) +#define SET_TexParameteriv(disp, fn) ((disp)->TexParameteriv = fn) +#define CALL_TexImage1D(disp, parameters) (*((disp)->TexImage1D)) parameters +#define GET_TexImage1D(disp) ((disp)->TexImage1D) +#define SET_TexImage1D(disp, fn) ((disp)->TexImage1D = fn) +#define CALL_TexImage2D(disp, parameters) (*((disp)->TexImage2D)) parameters +#define GET_TexImage2D(disp) ((disp)->TexImage2D) +#define SET_TexImage2D(disp, fn) ((disp)->TexImage2D = fn) +#define CALL_TexEnvf(disp, parameters) (*((disp)->TexEnvf)) parameters +#define GET_TexEnvf(disp) ((disp)->TexEnvf) +#define SET_TexEnvf(disp, fn) ((disp)->TexEnvf = fn) +#define CALL_TexEnvfv(disp, parameters) (*((disp)->TexEnvfv)) parameters +#define GET_TexEnvfv(disp) ((disp)->TexEnvfv) +#define SET_TexEnvfv(disp, fn) ((disp)->TexEnvfv = fn) +#define CALL_TexEnvi(disp, parameters) (*((disp)->TexEnvi)) parameters +#define GET_TexEnvi(disp) ((disp)->TexEnvi) +#define SET_TexEnvi(disp, fn) ((disp)->TexEnvi = fn) +#define CALL_TexEnviv(disp, parameters) (*((disp)->TexEnviv)) parameters +#define GET_TexEnviv(disp) ((disp)->TexEnviv) +#define SET_TexEnviv(disp, fn) ((disp)->TexEnviv = fn) +#define CALL_TexGend(disp, parameters) (*((disp)->TexGend)) parameters +#define GET_TexGend(disp) ((disp)->TexGend) +#define SET_TexGend(disp, fn) ((disp)->TexGend = fn) +#define CALL_TexGendv(disp, parameters) (*((disp)->TexGendv)) parameters +#define GET_TexGendv(disp) ((disp)->TexGendv) +#define SET_TexGendv(disp, fn) ((disp)->TexGendv = fn) +#define CALL_TexGenf(disp, parameters) (*((disp)->TexGenf)) parameters +#define GET_TexGenf(disp) ((disp)->TexGenf) +#define SET_TexGenf(disp, fn) ((disp)->TexGenf = fn) +#define CALL_TexGenfv(disp, parameters) (*((disp)->TexGenfv)) parameters +#define GET_TexGenfv(disp) ((disp)->TexGenfv) +#define SET_TexGenfv(disp, fn) ((disp)->TexGenfv = fn) +#define CALL_TexGeni(disp, parameters) (*((disp)->TexGeni)) parameters +#define GET_TexGeni(disp) ((disp)->TexGeni) +#define SET_TexGeni(disp, fn) ((disp)->TexGeni = fn) +#define CALL_TexGeniv(disp, parameters) (*((disp)->TexGeniv)) parameters +#define GET_TexGeniv(disp) ((disp)->TexGeniv) +#define SET_TexGeniv(disp, fn) ((disp)->TexGeniv = fn) +#define CALL_FeedbackBuffer(disp, parameters) (*((disp)->FeedbackBuffer)) parameters +#define GET_FeedbackBuffer(disp) ((disp)->FeedbackBuffer) +#define SET_FeedbackBuffer(disp, fn) ((disp)->FeedbackBuffer = fn) +#define CALL_SelectBuffer(disp, parameters) (*((disp)->SelectBuffer)) parameters +#define GET_SelectBuffer(disp) ((disp)->SelectBuffer) +#define SET_SelectBuffer(disp, fn) ((disp)->SelectBuffer = fn) +#define CALL_RenderMode(disp, parameters) (*((disp)->RenderMode)) parameters +#define GET_RenderMode(disp) ((disp)->RenderMode) +#define SET_RenderMode(disp, fn) ((disp)->RenderMode = fn) +#define CALL_InitNames(disp, parameters) (*((disp)->InitNames)) parameters +#define GET_InitNames(disp) ((disp)->InitNames) +#define SET_InitNames(disp, fn) ((disp)->InitNames = fn) +#define CALL_LoadName(disp, parameters) (*((disp)->LoadName)) parameters +#define GET_LoadName(disp) ((disp)->LoadName) +#define SET_LoadName(disp, fn) ((disp)->LoadName = fn) +#define CALL_PassThrough(disp, parameters) (*((disp)->PassThrough)) parameters +#define GET_PassThrough(disp) ((disp)->PassThrough) +#define SET_PassThrough(disp, fn) ((disp)->PassThrough = fn) +#define CALL_PopName(disp, parameters) (*((disp)->PopName)) parameters +#define GET_PopName(disp) ((disp)->PopName) +#define SET_PopName(disp, fn) ((disp)->PopName = fn) +#define CALL_PushName(disp, parameters) (*((disp)->PushName)) parameters +#define GET_PushName(disp) ((disp)->PushName) +#define SET_PushName(disp, fn) ((disp)->PushName = fn) +#define CALL_DrawBuffer(disp, parameters) (*((disp)->DrawBuffer)) parameters +#define GET_DrawBuffer(disp) ((disp)->DrawBuffer) +#define SET_DrawBuffer(disp, fn) ((disp)->DrawBuffer = fn) +#define CALL_Clear(disp, parameters) (*((disp)->Clear)) parameters +#define GET_Clear(disp) ((disp)->Clear) +#define SET_Clear(disp, fn) ((disp)->Clear = fn) +#define CALL_ClearAccum(disp, parameters) (*((disp)->ClearAccum)) parameters +#define GET_ClearAccum(disp) ((disp)->ClearAccum) +#define SET_ClearAccum(disp, fn) ((disp)->ClearAccum = fn) +#define CALL_ClearIndex(disp, parameters) (*((disp)->ClearIndex)) parameters +#define GET_ClearIndex(disp) ((disp)->ClearIndex) +#define SET_ClearIndex(disp, fn) ((disp)->ClearIndex = fn) +#define CALL_ClearColor(disp, parameters) (*((disp)->ClearColor)) parameters +#define GET_ClearColor(disp) ((disp)->ClearColor) +#define SET_ClearColor(disp, fn) ((disp)->ClearColor = fn) +#define CALL_ClearStencil(disp, parameters) (*((disp)->ClearStencil)) parameters +#define GET_ClearStencil(disp) ((disp)->ClearStencil) +#define SET_ClearStencil(disp, fn) ((disp)->ClearStencil = fn) +#define CALL_ClearDepth(disp, parameters) (*((disp)->ClearDepth)) parameters +#define GET_ClearDepth(disp) ((disp)->ClearDepth) +#define SET_ClearDepth(disp, fn) ((disp)->ClearDepth = fn) +#define CALL_StencilMask(disp, parameters) (*((disp)->StencilMask)) parameters +#define GET_StencilMask(disp) ((disp)->StencilMask) +#define SET_StencilMask(disp, fn) ((disp)->StencilMask = fn) +#define CALL_ColorMask(disp, parameters) (*((disp)->ColorMask)) parameters +#define GET_ColorMask(disp) ((disp)->ColorMask) +#define SET_ColorMask(disp, fn) ((disp)->ColorMask = fn) +#define CALL_DepthMask(disp, parameters) (*((disp)->DepthMask)) parameters +#define GET_DepthMask(disp) ((disp)->DepthMask) +#define SET_DepthMask(disp, fn) ((disp)->DepthMask = fn) +#define CALL_IndexMask(disp, parameters) (*((disp)->IndexMask)) parameters +#define GET_IndexMask(disp) ((disp)->IndexMask) +#define SET_IndexMask(disp, fn) ((disp)->IndexMask = fn) +#define CALL_Accum(disp, parameters) (*((disp)->Accum)) parameters +#define GET_Accum(disp) ((disp)->Accum) +#define SET_Accum(disp, fn) ((disp)->Accum = fn) +#define CALL_Disable(disp, parameters) (*((disp)->Disable)) parameters +#define GET_Disable(disp) ((disp)->Disable) +#define SET_Disable(disp, fn) ((disp)->Disable = fn) +#define CALL_Enable(disp, parameters) (*((disp)->Enable)) parameters +#define GET_Enable(disp) ((disp)->Enable) +#define SET_Enable(disp, fn) ((disp)->Enable = fn) +#define CALL_Finish(disp, parameters) (*((disp)->Finish)) parameters +#define GET_Finish(disp) ((disp)->Finish) +#define SET_Finish(disp, fn) ((disp)->Finish = fn) +#define CALL_Flush(disp, parameters) (*((disp)->Flush)) parameters +#define GET_Flush(disp) ((disp)->Flush) +#define SET_Flush(disp, fn) ((disp)->Flush = fn) +#define CALL_PopAttrib(disp, parameters) (*((disp)->PopAttrib)) parameters +#define GET_PopAttrib(disp) ((disp)->PopAttrib) +#define SET_PopAttrib(disp, fn) ((disp)->PopAttrib = fn) +#define CALL_PushAttrib(disp, parameters) (*((disp)->PushAttrib)) parameters +#define GET_PushAttrib(disp) ((disp)->PushAttrib) +#define SET_PushAttrib(disp, fn) ((disp)->PushAttrib = fn) +#define CALL_Map1d(disp, parameters) (*((disp)->Map1d)) parameters +#define GET_Map1d(disp) ((disp)->Map1d) +#define SET_Map1d(disp, fn) ((disp)->Map1d = fn) +#define CALL_Map1f(disp, parameters) (*((disp)->Map1f)) parameters +#define GET_Map1f(disp) ((disp)->Map1f) +#define SET_Map1f(disp, fn) ((disp)->Map1f = fn) +#define CALL_Map2d(disp, parameters) (*((disp)->Map2d)) parameters +#define GET_Map2d(disp) ((disp)->Map2d) +#define SET_Map2d(disp, fn) ((disp)->Map2d = fn) +#define CALL_Map2f(disp, parameters) (*((disp)->Map2f)) parameters +#define GET_Map2f(disp) ((disp)->Map2f) +#define SET_Map2f(disp, fn) ((disp)->Map2f = fn) +#define CALL_MapGrid1d(disp, parameters) (*((disp)->MapGrid1d)) parameters +#define GET_MapGrid1d(disp) ((disp)->MapGrid1d) +#define SET_MapGrid1d(disp, fn) ((disp)->MapGrid1d = fn) +#define CALL_MapGrid1f(disp, parameters) (*((disp)->MapGrid1f)) parameters +#define GET_MapGrid1f(disp) ((disp)->MapGrid1f) +#define SET_MapGrid1f(disp, fn) ((disp)->MapGrid1f = fn) +#define CALL_MapGrid2d(disp, parameters) (*((disp)->MapGrid2d)) parameters +#define GET_MapGrid2d(disp) ((disp)->MapGrid2d) +#define SET_MapGrid2d(disp, fn) ((disp)->MapGrid2d = fn) +#define CALL_MapGrid2f(disp, parameters) (*((disp)->MapGrid2f)) parameters +#define GET_MapGrid2f(disp) ((disp)->MapGrid2f) +#define SET_MapGrid2f(disp, fn) ((disp)->MapGrid2f = fn) +#define CALL_EvalCoord1d(disp, parameters) (*((disp)->EvalCoord1d)) parameters +#define GET_EvalCoord1d(disp) ((disp)->EvalCoord1d) +#define SET_EvalCoord1d(disp, fn) ((disp)->EvalCoord1d = fn) +#define CALL_EvalCoord1dv(disp, parameters) (*((disp)->EvalCoord1dv)) parameters +#define GET_EvalCoord1dv(disp) ((disp)->EvalCoord1dv) +#define SET_EvalCoord1dv(disp, fn) ((disp)->EvalCoord1dv = fn) +#define CALL_EvalCoord1f(disp, parameters) (*((disp)->EvalCoord1f)) parameters +#define GET_EvalCoord1f(disp) ((disp)->EvalCoord1f) +#define SET_EvalCoord1f(disp, fn) ((disp)->EvalCoord1f = fn) +#define CALL_EvalCoord1fv(disp, parameters) (*((disp)->EvalCoord1fv)) parameters +#define GET_EvalCoord1fv(disp) ((disp)->EvalCoord1fv) +#define SET_EvalCoord1fv(disp, fn) ((disp)->EvalCoord1fv = fn) +#define CALL_EvalCoord2d(disp, parameters) (*((disp)->EvalCoord2d)) parameters +#define GET_EvalCoord2d(disp) ((disp)->EvalCoord2d) +#define SET_EvalCoord2d(disp, fn) ((disp)->EvalCoord2d = fn) +#define CALL_EvalCoord2dv(disp, parameters) (*((disp)->EvalCoord2dv)) parameters +#define GET_EvalCoord2dv(disp) ((disp)->EvalCoord2dv) +#define SET_EvalCoord2dv(disp, fn) ((disp)->EvalCoord2dv = fn) +#define CALL_EvalCoord2f(disp, parameters) (*((disp)->EvalCoord2f)) parameters +#define GET_EvalCoord2f(disp) ((disp)->EvalCoord2f) +#define SET_EvalCoord2f(disp, fn) ((disp)->EvalCoord2f = fn) +#define CALL_EvalCoord2fv(disp, parameters) (*((disp)->EvalCoord2fv)) parameters +#define GET_EvalCoord2fv(disp) ((disp)->EvalCoord2fv) +#define SET_EvalCoord2fv(disp, fn) ((disp)->EvalCoord2fv = fn) +#define CALL_EvalMesh1(disp, parameters) (*((disp)->EvalMesh1)) parameters +#define GET_EvalMesh1(disp) ((disp)->EvalMesh1) +#define SET_EvalMesh1(disp, fn) ((disp)->EvalMesh1 = fn) +#define CALL_EvalPoint1(disp, parameters) (*((disp)->EvalPoint1)) parameters +#define GET_EvalPoint1(disp) ((disp)->EvalPoint1) +#define SET_EvalPoint1(disp, fn) ((disp)->EvalPoint1 = fn) +#define CALL_EvalMesh2(disp, parameters) (*((disp)->EvalMesh2)) parameters +#define GET_EvalMesh2(disp) ((disp)->EvalMesh2) +#define SET_EvalMesh2(disp, fn) ((disp)->EvalMesh2 = fn) +#define CALL_EvalPoint2(disp, parameters) (*((disp)->EvalPoint2)) parameters +#define GET_EvalPoint2(disp) ((disp)->EvalPoint2) +#define SET_EvalPoint2(disp, fn) ((disp)->EvalPoint2 = fn) +#define CALL_AlphaFunc(disp, parameters) (*((disp)->AlphaFunc)) parameters +#define GET_AlphaFunc(disp) ((disp)->AlphaFunc) +#define SET_AlphaFunc(disp, fn) ((disp)->AlphaFunc = fn) +#define CALL_BlendFunc(disp, parameters) (*((disp)->BlendFunc)) parameters +#define GET_BlendFunc(disp) ((disp)->BlendFunc) +#define SET_BlendFunc(disp, fn) ((disp)->BlendFunc = fn) +#define CALL_LogicOp(disp, parameters) (*((disp)->LogicOp)) parameters +#define GET_LogicOp(disp) ((disp)->LogicOp) +#define SET_LogicOp(disp, fn) ((disp)->LogicOp = fn) +#define CALL_StencilFunc(disp, parameters) (*((disp)->StencilFunc)) parameters +#define GET_StencilFunc(disp) ((disp)->StencilFunc) +#define SET_StencilFunc(disp, fn) ((disp)->StencilFunc = fn) +#define CALL_StencilOp(disp, parameters) (*((disp)->StencilOp)) parameters +#define GET_StencilOp(disp) ((disp)->StencilOp) +#define SET_StencilOp(disp, fn) ((disp)->StencilOp = fn) +#define CALL_DepthFunc(disp, parameters) (*((disp)->DepthFunc)) parameters +#define GET_DepthFunc(disp) ((disp)->DepthFunc) +#define SET_DepthFunc(disp, fn) ((disp)->DepthFunc = fn) +#define CALL_PixelZoom(disp, parameters) (*((disp)->PixelZoom)) parameters +#define GET_PixelZoom(disp) ((disp)->PixelZoom) +#define SET_PixelZoom(disp, fn) ((disp)->PixelZoom = fn) +#define CALL_PixelTransferf(disp, parameters) (*((disp)->PixelTransferf)) parameters +#define GET_PixelTransferf(disp) ((disp)->PixelTransferf) +#define SET_PixelTransferf(disp, fn) ((disp)->PixelTransferf = fn) +#define CALL_PixelTransferi(disp, parameters) (*((disp)->PixelTransferi)) parameters +#define GET_PixelTransferi(disp) ((disp)->PixelTransferi) +#define SET_PixelTransferi(disp, fn) ((disp)->PixelTransferi = fn) +#define CALL_PixelStoref(disp, parameters) (*((disp)->PixelStoref)) parameters +#define GET_PixelStoref(disp) ((disp)->PixelStoref) +#define SET_PixelStoref(disp, fn) ((disp)->PixelStoref = fn) +#define CALL_PixelStorei(disp, parameters) (*((disp)->PixelStorei)) parameters +#define GET_PixelStorei(disp) ((disp)->PixelStorei) +#define SET_PixelStorei(disp, fn) ((disp)->PixelStorei = fn) +#define CALL_PixelMapfv(disp, parameters) (*((disp)->PixelMapfv)) parameters +#define GET_PixelMapfv(disp) ((disp)->PixelMapfv) +#define SET_PixelMapfv(disp, fn) ((disp)->PixelMapfv = fn) +#define CALL_PixelMapuiv(disp, parameters) (*((disp)->PixelMapuiv)) parameters +#define GET_PixelMapuiv(disp) ((disp)->PixelMapuiv) +#define SET_PixelMapuiv(disp, fn) ((disp)->PixelMapuiv = fn) +#define CALL_PixelMapusv(disp, parameters) (*((disp)->PixelMapusv)) parameters +#define GET_PixelMapusv(disp) ((disp)->PixelMapusv) +#define SET_PixelMapusv(disp, fn) ((disp)->PixelMapusv = fn) +#define CALL_ReadBuffer(disp, parameters) (*((disp)->ReadBuffer)) parameters +#define GET_ReadBuffer(disp) ((disp)->ReadBuffer) +#define SET_ReadBuffer(disp, fn) ((disp)->ReadBuffer = fn) +#define CALL_CopyPixels(disp, parameters) (*((disp)->CopyPixels)) parameters +#define GET_CopyPixels(disp) ((disp)->CopyPixels) +#define SET_CopyPixels(disp, fn) ((disp)->CopyPixels = fn) +#define CALL_ReadPixels(disp, parameters) (*((disp)->ReadPixels)) parameters +#define GET_ReadPixels(disp) ((disp)->ReadPixels) +#define SET_ReadPixels(disp, fn) ((disp)->ReadPixels = fn) +#define CALL_DrawPixels(disp, parameters) (*((disp)->DrawPixels)) parameters +#define GET_DrawPixels(disp) ((disp)->DrawPixels) +#define SET_DrawPixels(disp, fn) ((disp)->DrawPixels = fn) +#define CALL_GetBooleanv(disp, parameters) (*((disp)->GetBooleanv)) parameters +#define GET_GetBooleanv(disp) ((disp)->GetBooleanv) +#define SET_GetBooleanv(disp, fn) ((disp)->GetBooleanv = fn) +#define CALL_GetClipPlane(disp, parameters) (*((disp)->GetClipPlane)) parameters +#define GET_GetClipPlane(disp) ((disp)->GetClipPlane) +#define SET_GetClipPlane(disp, fn) ((disp)->GetClipPlane = fn) +#define CALL_GetDoublev(disp, parameters) (*((disp)->GetDoublev)) parameters +#define GET_GetDoublev(disp) ((disp)->GetDoublev) +#define SET_GetDoublev(disp, fn) ((disp)->GetDoublev = fn) +#define CALL_GetError(disp, parameters) (*((disp)->GetError)) parameters +#define GET_GetError(disp) ((disp)->GetError) +#define SET_GetError(disp, fn) ((disp)->GetError = fn) +#define CALL_GetFloatv(disp, parameters) (*((disp)->GetFloatv)) parameters +#define GET_GetFloatv(disp) ((disp)->GetFloatv) +#define SET_GetFloatv(disp, fn) ((disp)->GetFloatv = fn) +#define CALL_GetIntegerv(disp, parameters) (*((disp)->GetIntegerv)) parameters +#define GET_GetIntegerv(disp) ((disp)->GetIntegerv) +#define SET_GetIntegerv(disp, fn) ((disp)->GetIntegerv = fn) +#define CALL_GetLightfv(disp, parameters) (*((disp)->GetLightfv)) parameters +#define GET_GetLightfv(disp) ((disp)->GetLightfv) +#define SET_GetLightfv(disp, fn) ((disp)->GetLightfv = fn) +#define CALL_GetLightiv(disp, parameters) (*((disp)->GetLightiv)) parameters +#define GET_GetLightiv(disp) ((disp)->GetLightiv) +#define SET_GetLightiv(disp, fn) ((disp)->GetLightiv = fn) +#define CALL_GetMapdv(disp, parameters) (*((disp)->GetMapdv)) parameters +#define GET_GetMapdv(disp) ((disp)->GetMapdv) +#define SET_GetMapdv(disp, fn) ((disp)->GetMapdv = fn) +#define CALL_GetMapfv(disp, parameters) (*((disp)->GetMapfv)) parameters +#define GET_GetMapfv(disp) ((disp)->GetMapfv) +#define SET_GetMapfv(disp, fn) ((disp)->GetMapfv = fn) +#define CALL_GetMapiv(disp, parameters) (*((disp)->GetMapiv)) parameters +#define GET_GetMapiv(disp) ((disp)->GetMapiv) +#define SET_GetMapiv(disp, fn) ((disp)->GetMapiv = fn) +#define CALL_GetMaterialfv(disp, parameters) (*((disp)->GetMaterialfv)) parameters +#define GET_GetMaterialfv(disp) ((disp)->GetMaterialfv) +#define SET_GetMaterialfv(disp, fn) ((disp)->GetMaterialfv = fn) +#define CALL_GetMaterialiv(disp, parameters) (*((disp)->GetMaterialiv)) parameters +#define GET_GetMaterialiv(disp) ((disp)->GetMaterialiv) +#define SET_GetMaterialiv(disp, fn) ((disp)->GetMaterialiv = fn) +#define CALL_GetPixelMapfv(disp, parameters) (*((disp)->GetPixelMapfv)) parameters +#define GET_GetPixelMapfv(disp) ((disp)->GetPixelMapfv) +#define SET_GetPixelMapfv(disp, fn) ((disp)->GetPixelMapfv = fn) +#define CALL_GetPixelMapuiv(disp, parameters) (*((disp)->GetPixelMapuiv)) parameters +#define GET_GetPixelMapuiv(disp) ((disp)->GetPixelMapuiv) +#define SET_GetPixelMapuiv(disp, fn) ((disp)->GetPixelMapuiv = fn) +#define CALL_GetPixelMapusv(disp, parameters) (*((disp)->GetPixelMapusv)) parameters +#define GET_GetPixelMapusv(disp) ((disp)->GetPixelMapusv) +#define SET_GetPixelMapusv(disp, fn) ((disp)->GetPixelMapusv = fn) +#define CALL_GetPolygonStipple(disp, parameters) (*((disp)->GetPolygonStipple)) parameters +#define GET_GetPolygonStipple(disp) ((disp)->GetPolygonStipple) +#define SET_GetPolygonStipple(disp, fn) ((disp)->GetPolygonStipple = fn) +#define CALL_GetString(disp, parameters) (*((disp)->GetString)) parameters +#define GET_GetString(disp) ((disp)->GetString) +#define SET_GetString(disp, fn) ((disp)->GetString = fn) +#define CALL_GetTexEnvfv(disp, parameters) (*((disp)->GetTexEnvfv)) parameters +#define GET_GetTexEnvfv(disp) ((disp)->GetTexEnvfv) +#define SET_GetTexEnvfv(disp, fn) ((disp)->GetTexEnvfv = fn) +#define CALL_GetTexEnviv(disp, parameters) (*((disp)->GetTexEnviv)) parameters +#define GET_GetTexEnviv(disp) ((disp)->GetTexEnviv) +#define SET_GetTexEnviv(disp, fn) ((disp)->GetTexEnviv = fn) +#define CALL_GetTexGendv(disp, parameters) (*((disp)->GetTexGendv)) parameters +#define GET_GetTexGendv(disp) ((disp)->GetTexGendv) +#define SET_GetTexGendv(disp, fn) ((disp)->GetTexGendv = fn) +#define CALL_GetTexGenfv(disp, parameters) (*((disp)->GetTexGenfv)) parameters +#define GET_GetTexGenfv(disp) ((disp)->GetTexGenfv) +#define SET_GetTexGenfv(disp, fn) ((disp)->GetTexGenfv = fn) +#define CALL_GetTexGeniv(disp, parameters) (*((disp)->GetTexGeniv)) parameters +#define GET_GetTexGeniv(disp) ((disp)->GetTexGeniv) +#define SET_GetTexGeniv(disp, fn) ((disp)->GetTexGeniv = fn) +#define CALL_GetTexImage(disp, parameters) (*((disp)->GetTexImage)) parameters +#define GET_GetTexImage(disp) ((disp)->GetTexImage) +#define SET_GetTexImage(disp, fn) ((disp)->GetTexImage = fn) +#define CALL_GetTexParameterfv(disp, parameters) (*((disp)->GetTexParameterfv)) parameters +#define GET_GetTexParameterfv(disp) ((disp)->GetTexParameterfv) +#define SET_GetTexParameterfv(disp, fn) ((disp)->GetTexParameterfv = fn) +#define CALL_GetTexParameteriv(disp, parameters) (*((disp)->GetTexParameteriv)) parameters +#define GET_GetTexParameteriv(disp) ((disp)->GetTexParameteriv) +#define SET_GetTexParameteriv(disp, fn) ((disp)->GetTexParameteriv = fn) +#define CALL_GetTexLevelParameterfv(disp, parameters) (*((disp)->GetTexLevelParameterfv)) parameters +#define GET_GetTexLevelParameterfv(disp) ((disp)->GetTexLevelParameterfv) +#define SET_GetTexLevelParameterfv(disp, fn) ((disp)->GetTexLevelParameterfv = fn) +#define CALL_GetTexLevelParameteriv(disp, parameters) (*((disp)->GetTexLevelParameteriv)) parameters +#define GET_GetTexLevelParameteriv(disp) ((disp)->GetTexLevelParameteriv) +#define SET_GetTexLevelParameteriv(disp, fn) ((disp)->GetTexLevelParameteriv = fn) +#define CALL_IsEnabled(disp, parameters) (*((disp)->IsEnabled)) parameters +#define GET_IsEnabled(disp) ((disp)->IsEnabled) +#define SET_IsEnabled(disp, fn) ((disp)->IsEnabled = fn) +#define CALL_IsList(disp, parameters) (*((disp)->IsList)) parameters +#define GET_IsList(disp) ((disp)->IsList) +#define SET_IsList(disp, fn) ((disp)->IsList = fn) +#define CALL_DepthRange(disp, parameters) (*((disp)->DepthRange)) parameters +#define GET_DepthRange(disp) ((disp)->DepthRange) +#define SET_DepthRange(disp, fn) ((disp)->DepthRange = fn) +#define CALL_Frustum(disp, parameters) (*((disp)->Frustum)) parameters +#define GET_Frustum(disp) ((disp)->Frustum) +#define SET_Frustum(disp, fn) ((disp)->Frustum = fn) +#define CALL_LoadIdentity(disp, parameters) (*((disp)->LoadIdentity)) parameters +#define GET_LoadIdentity(disp) ((disp)->LoadIdentity) +#define SET_LoadIdentity(disp, fn) ((disp)->LoadIdentity = fn) +#define CALL_LoadMatrixf(disp, parameters) (*((disp)->LoadMatrixf)) parameters +#define GET_LoadMatrixf(disp) ((disp)->LoadMatrixf) +#define SET_LoadMatrixf(disp, fn) ((disp)->LoadMatrixf = fn) +#define CALL_LoadMatrixd(disp, parameters) (*((disp)->LoadMatrixd)) parameters +#define GET_LoadMatrixd(disp) ((disp)->LoadMatrixd) +#define SET_LoadMatrixd(disp, fn) ((disp)->LoadMatrixd = fn) +#define CALL_MatrixMode(disp, parameters) (*((disp)->MatrixMode)) parameters +#define GET_MatrixMode(disp) ((disp)->MatrixMode) +#define SET_MatrixMode(disp, fn) ((disp)->MatrixMode = fn) +#define CALL_MultMatrixf(disp, parameters) (*((disp)->MultMatrixf)) parameters +#define GET_MultMatrixf(disp) ((disp)->MultMatrixf) +#define SET_MultMatrixf(disp, fn) ((disp)->MultMatrixf = fn) +#define CALL_MultMatrixd(disp, parameters) (*((disp)->MultMatrixd)) parameters +#define GET_MultMatrixd(disp) ((disp)->MultMatrixd) +#define SET_MultMatrixd(disp, fn) ((disp)->MultMatrixd = fn) +#define CALL_Ortho(disp, parameters) (*((disp)->Ortho)) parameters +#define GET_Ortho(disp) ((disp)->Ortho) +#define SET_Ortho(disp, fn) ((disp)->Ortho = fn) +#define CALL_PopMatrix(disp, parameters) (*((disp)->PopMatrix)) parameters +#define GET_PopMatrix(disp) ((disp)->PopMatrix) +#define SET_PopMatrix(disp, fn) ((disp)->PopMatrix = fn) +#define CALL_PushMatrix(disp, parameters) (*((disp)->PushMatrix)) parameters +#define GET_PushMatrix(disp) ((disp)->PushMatrix) +#define SET_PushMatrix(disp, fn) ((disp)->PushMatrix = fn) +#define CALL_Rotated(disp, parameters) (*((disp)->Rotated)) parameters +#define GET_Rotated(disp) ((disp)->Rotated) +#define SET_Rotated(disp, fn) ((disp)->Rotated = fn) +#define CALL_Rotatef(disp, parameters) (*((disp)->Rotatef)) parameters +#define GET_Rotatef(disp) ((disp)->Rotatef) +#define SET_Rotatef(disp, fn) ((disp)->Rotatef = fn) +#define CALL_Scaled(disp, parameters) (*((disp)->Scaled)) parameters +#define GET_Scaled(disp) ((disp)->Scaled) +#define SET_Scaled(disp, fn) ((disp)->Scaled = fn) +#define CALL_Scalef(disp, parameters) (*((disp)->Scalef)) parameters +#define GET_Scalef(disp) ((disp)->Scalef) +#define SET_Scalef(disp, fn) ((disp)->Scalef = fn) +#define CALL_Translated(disp, parameters) (*((disp)->Translated)) parameters +#define GET_Translated(disp) ((disp)->Translated) +#define SET_Translated(disp, fn) ((disp)->Translated = fn) +#define CALL_Translatef(disp, parameters) (*((disp)->Translatef)) parameters +#define GET_Translatef(disp) ((disp)->Translatef) +#define SET_Translatef(disp, fn) ((disp)->Translatef = fn) +#define CALL_Viewport(disp, parameters) (*((disp)->Viewport)) parameters +#define GET_Viewport(disp) ((disp)->Viewport) +#define SET_Viewport(disp, fn) ((disp)->Viewport = fn) +#define CALL_ArrayElement(disp, parameters) (*((disp)->ArrayElement)) parameters +#define GET_ArrayElement(disp) ((disp)->ArrayElement) +#define SET_ArrayElement(disp, fn) ((disp)->ArrayElement = fn) +#define CALL_BindTexture(disp, parameters) (*((disp)->BindTexture)) parameters +#define GET_BindTexture(disp) ((disp)->BindTexture) +#define SET_BindTexture(disp, fn) ((disp)->BindTexture = fn) +#define CALL_ColorPointer(disp, parameters) (*((disp)->ColorPointer)) parameters +#define GET_ColorPointer(disp) ((disp)->ColorPointer) +#define SET_ColorPointer(disp, fn) ((disp)->ColorPointer = fn) +#define CALL_DisableClientState(disp, parameters) (*((disp)->DisableClientState)) parameters +#define GET_DisableClientState(disp) ((disp)->DisableClientState) +#define SET_DisableClientState(disp, fn) ((disp)->DisableClientState = fn) +#define CALL_DrawArrays(disp, parameters) (*((disp)->DrawArrays)) parameters +#define GET_DrawArrays(disp) ((disp)->DrawArrays) +#define SET_DrawArrays(disp, fn) ((disp)->DrawArrays = fn) +#define CALL_DrawElements(disp, parameters) (*((disp)->DrawElements)) parameters +#define GET_DrawElements(disp) ((disp)->DrawElements) +#define SET_DrawElements(disp, fn) ((disp)->DrawElements = fn) +#define CALL_EdgeFlagPointer(disp, parameters) (*((disp)->EdgeFlagPointer)) parameters +#define GET_EdgeFlagPointer(disp) ((disp)->EdgeFlagPointer) +#define SET_EdgeFlagPointer(disp, fn) ((disp)->EdgeFlagPointer = fn) +#define CALL_EnableClientState(disp, parameters) (*((disp)->EnableClientState)) parameters +#define GET_EnableClientState(disp) ((disp)->EnableClientState) +#define SET_EnableClientState(disp, fn) ((disp)->EnableClientState = fn) +#define CALL_IndexPointer(disp, parameters) (*((disp)->IndexPointer)) parameters +#define GET_IndexPointer(disp) ((disp)->IndexPointer) +#define SET_IndexPointer(disp, fn) ((disp)->IndexPointer = fn) +#define CALL_Indexub(disp, parameters) (*((disp)->Indexub)) parameters +#define GET_Indexub(disp) ((disp)->Indexub) +#define SET_Indexub(disp, fn) ((disp)->Indexub = fn) +#define CALL_Indexubv(disp, parameters) (*((disp)->Indexubv)) parameters +#define GET_Indexubv(disp) ((disp)->Indexubv) +#define SET_Indexubv(disp, fn) ((disp)->Indexubv = fn) +#define CALL_InterleavedArrays(disp, parameters) (*((disp)->InterleavedArrays)) parameters +#define GET_InterleavedArrays(disp) ((disp)->InterleavedArrays) +#define SET_InterleavedArrays(disp, fn) ((disp)->InterleavedArrays = fn) +#define CALL_NormalPointer(disp, parameters) (*((disp)->NormalPointer)) parameters +#define GET_NormalPointer(disp) ((disp)->NormalPointer) +#define SET_NormalPointer(disp, fn) ((disp)->NormalPointer = fn) +#define CALL_PolygonOffset(disp, parameters) (*((disp)->PolygonOffset)) parameters +#define GET_PolygonOffset(disp) ((disp)->PolygonOffset) +#define SET_PolygonOffset(disp, fn) ((disp)->PolygonOffset = fn) +#define CALL_TexCoordPointer(disp, parameters) (*((disp)->TexCoordPointer)) parameters +#define GET_TexCoordPointer(disp) ((disp)->TexCoordPointer) +#define SET_TexCoordPointer(disp, fn) ((disp)->TexCoordPointer = fn) +#define CALL_VertexPointer(disp, parameters) (*((disp)->VertexPointer)) parameters +#define GET_VertexPointer(disp) ((disp)->VertexPointer) +#define SET_VertexPointer(disp, fn) ((disp)->VertexPointer = fn) +#define CALL_AreTexturesResident(disp, parameters) (*((disp)->AreTexturesResident)) parameters +#define GET_AreTexturesResident(disp) ((disp)->AreTexturesResident) +#define SET_AreTexturesResident(disp, fn) ((disp)->AreTexturesResident = fn) +#define CALL_CopyTexImage1D(disp, parameters) (*((disp)->CopyTexImage1D)) parameters +#define GET_CopyTexImage1D(disp) ((disp)->CopyTexImage1D) +#define SET_CopyTexImage1D(disp, fn) ((disp)->CopyTexImage1D = fn) +#define CALL_CopyTexImage2D(disp, parameters) (*((disp)->CopyTexImage2D)) parameters +#define GET_CopyTexImage2D(disp) ((disp)->CopyTexImage2D) +#define SET_CopyTexImage2D(disp, fn) ((disp)->CopyTexImage2D = fn) +#define CALL_CopyTexSubImage1D(disp, parameters) (*((disp)->CopyTexSubImage1D)) parameters +#define GET_CopyTexSubImage1D(disp) ((disp)->CopyTexSubImage1D) +#define SET_CopyTexSubImage1D(disp, fn) ((disp)->CopyTexSubImage1D = fn) +#define CALL_CopyTexSubImage2D(disp, parameters) (*((disp)->CopyTexSubImage2D)) parameters +#define GET_CopyTexSubImage2D(disp) ((disp)->CopyTexSubImage2D) +#define SET_CopyTexSubImage2D(disp, fn) ((disp)->CopyTexSubImage2D = fn) +#define CALL_DeleteTextures(disp, parameters) (*((disp)->DeleteTextures)) parameters +#define GET_DeleteTextures(disp) ((disp)->DeleteTextures) +#define SET_DeleteTextures(disp, fn) ((disp)->DeleteTextures = fn) +#define CALL_GenTextures(disp, parameters) (*((disp)->GenTextures)) parameters +#define GET_GenTextures(disp) ((disp)->GenTextures) +#define SET_GenTextures(disp, fn) ((disp)->GenTextures = fn) +#define CALL_GetPointerv(disp, parameters) (*((disp)->GetPointerv)) parameters +#define GET_GetPointerv(disp) ((disp)->GetPointerv) +#define SET_GetPointerv(disp, fn) ((disp)->GetPointerv = fn) +#define CALL_IsTexture(disp, parameters) (*((disp)->IsTexture)) parameters +#define GET_IsTexture(disp) ((disp)->IsTexture) +#define SET_IsTexture(disp, fn) ((disp)->IsTexture = fn) +#define CALL_PrioritizeTextures(disp, parameters) (*((disp)->PrioritizeTextures)) parameters +#define GET_PrioritizeTextures(disp) ((disp)->PrioritizeTextures) +#define SET_PrioritizeTextures(disp, fn) ((disp)->PrioritizeTextures = fn) +#define CALL_TexSubImage1D(disp, parameters) (*((disp)->TexSubImage1D)) parameters +#define GET_TexSubImage1D(disp) ((disp)->TexSubImage1D) +#define SET_TexSubImage1D(disp, fn) ((disp)->TexSubImage1D = fn) +#define CALL_TexSubImage2D(disp, parameters) (*((disp)->TexSubImage2D)) parameters +#define GET_TexSubImage2D(disp) ((disp)->TexSubImage2D) +#define SET_TexSubImage2D(disp, fn) ((disp)->TexSubImage2D = fn) +#define CALL_PopClientAttrib(disp, parameters) (*((disp)->PopClientAttrib)) parameters +#define GET_PopClientAttrib(disp) ((disp)->PopClientAttrib) +#define SET_PopClientAttrib(disp, fn) ((disp)->PopClientAttrib = fn) +#define CALL_PushClientAttrib(disp, parameters) (*((disp)->PushClientAttrib)) parameters +#define GET_PushClientAttrib(disp) ((disp)->PushClientAttrib) +#define SET_PushClientAttrib(disp, fn) ((disp)->PushClientAttrib = fn) +#define CALL_BlendColor(disp, parameters) (*((disp)->BlendColor)) parameters +#define GET_BlendColor(disp) ((disp)->BlendColor) +#define SET_BlendColor(disp, fn) ((disp)->BlendColor = fn) +#define CALL_BlendEquation(disp, parameters) (*((disp)->BlendEquation)) parameters +#define GET_BlendEquation(disp) ((disp)->BlendEquation) +#define SET_BlendEquation(disp, fn) ((disp)->BlendEquation = fn) +#define CALL_DrawRangeElements(disp, parameters) (*((disp)->DrawRangeElements)) parameters +#define GET_DrawRangeElements(disp) ((disp)->DrawRangeElements) +#define SET_DrawRangeElements(disp, fn) ((disp)->DrawRangeElements = fn) +#define CALL_ColorTable(disp, parameters) (*((disp)->ColorTable)) parameters +#define GET_ColorTable(disp) ((disp)->ColorTable) +#define SET_ColorTable(disp, fn) ((disp)->ColorTable = fn) +#define CALL_ColorTableParameterfv(disp, parameters) (*((disp)->ColorTableParameterfv)) parameters +#define GET_ColorTableParameterfv(disp) ((disp)->ColorTableParameterfv) +#define SET_ColorTableParameterfv(disp, fn) ((disp)->ColorTableParameterfv = fn) +#define CALL_ColorTableParameteriv(disp, parameters) (*((disp)->ColorTableParameteriv)) parameters +#define GET_ColorTableParameteriv(disp) ((disp)->ColorTableParameteriv) +#define SET_ColorTableParameteriv(disp, fn) ((disp)->ColorTableParameteriv = fn) +#define CALL_CopyColorTable(disp, parameters) (*((disp)->CopyColorTable)) parameters +#define GET_CopyColorTable(disp) ((disp)->CopyColorTable) +#define SET_CopyColorTable(disp, fn) ((disp)->CopyColorTable = fn) +#define CALL_GetColorTable(disp, parameters) (*((disp)->GetColorTable)) parameters +#define GET_GetColorTable(disp) ((disp)->GetColorTable) +#define SET_GetColorTable(disp, fn) ((disp)->GetColorTable = fn) +#define CALL_GetColorTableParameterfv(disp, parameters) (*((disp)->GetColorTableParameterfv)) parameters +#define GET_GetColorTableParameterfv(disp) ((disp)->GetColorTableParameterfv) +#define SET_GetColorTableParameterfv(disp, fn) ((disp)->GetColorTableParameterfv = fn) +#define CALL_GetColorTableParameteriv(disp, parameters) (*((disp)->GetColorTableParameteriv)) parameters +#define GET_GetColorTableParameteriv(disp) ((disp)->GetColorTableParameteriv) +#define SET_GetColorTableParameteriv(disp, fn) ((disp)->GetColorTableParameteriv = fn) +#define CALL_ColorSubTable(disp, parameters) (*((disp)->ColorSubTable)) parameters +#define GET_ColorSubTable(disp) ((disp)->ColorSubTable) +#define SET_ColorSubTable(disp, fn) ((disp)->ColorSubTable = fn) +#define CALL_CopyColorSubTable(disp, parameters) (*((disp)->CopyColorSubTable)) parameters +#define GET_CopyColorSubTable(disp) ((disp)->CopyColorSubTable) +#define SET_CopyColorSubTable(disp, fn) ((disp)->CopyColorSubTable = fn) +#define CALL_ConvolutionFilter1D(disp, parameters) (*((disp)->ConvolutionFilter1D)) parameters +#define GET_ConvolutionFilter1D(disp) ((disp)->ConvolutionFilter1D) +#define SET_ConvolutionFilter1D(disp, fn) ((disp)->ConvolutionFilter1D = fn) +#define CALL_ConvolutionFilter2D(disp, parameters) (*((disp)->ConvolutionFilter2D)) parameters +#define GET_ConvolutionFilter2D(disp) ((disp)->ConvolutionFilter2D) +#define SET_ConvolutionFilter2D(disp, fn) ((disp)->ConvolutionFilter2D = fn) +#define CALL_ConvolutionParameterf(disp, parameters) (*((disp)->ConvolutionParameterf)) parameters +#define GET_ConvolutionParameterf(disp) ((disp)->ConvolutionParameterf) +#define SET_ConvolutionParameterf(disp, fn) ((disp)->ConvolutionParameterf = fn) +#define CALL_ConvolutionParameterfv(disp, parameters) (*((disp)->ConvolutionParameterfv)) parameters +#define GET_ConvolutionParameterfv(disp) ((disp)->ConvolutionParameterfv) +#define SET_ConvolutionParameterfv(disp, fn) ((disp)->ConvolutionParameterfv = fn) +#define CALL_ConvolutionParameteri(disp, parameters) (*((disp)->ConvolutionParameteri)) parameters +#define GET_ConvolutionParameteri(disp) ((disp)->ConvolutionParameteri) +#define SET_ConvolutionParameteri(disp, fn) ((disp)->ConvolutionParameteri = fn) +#define CALL_ConvolutionParameteriv(disp, parameters) (*((disp)->ConvolutionParameteriv)) parameters +#define GET_ConvolutionParameteriv(disp) ((disp)->ConvolutionParameteriv) +#define SET_ConvolutionParameteriv(disp, fn) ((disp)->ConvolutionParameteriv = fn) +#define CALL_CopyConvolutionFilter1D(disp, parameters) (*((disp)->CopyConvolutionFilter1D)) parameters +#define GET_CopyConvolutionFilter1D(disp) ((disp)->CopyConvolutionFilter1D) +#define SET_CopyConvolutionFilter1D(disp, fn) ((disp)->CopyConvolutionFilter1D = fn) +#define CALL_CopyConvolutionFilter2D(disp, parameters) (*((disp)->CopyConvolutionFilter2D)) parameters +#define GET_CopyConvolutionFilter2D(disp) ((disp)->CopyConvolutionFilter2D) +#define SET_CopyConvolutionFilter2D(disp, fn) ((disp)->CopyConvolutionFilter2D = fn) +#define CALL_GetConvolutionFilter(disp, parameters) (*((disp)->GetConvolutionFilter)) parameters +#define GET_GetConvolutionFilter(disp) ((disp)->GetConvolutionFilter) +#define SET_GetConvolutionFilter(disp, fn) ((disp)->GetConvolutionFilter = fn) +#define CALL_GetConvolutionParameterfv(disp, parameters) (*((disp)->GetConvolutionParameterfv)) parameters +#define GET_GetConvolutionParameterfv(disp) ((disp)->GetConvolutionParameterfv) +#define SET_GetConvolutionParameterfv(disp, fn) ((disp)->GetConvolutionParameterfv = fn) +#define CALL_GetConvolutionParameteriv(disp, parameters) (*((disp)->GetConvolutionParameteriv)) parameters +#define GET_GetConvolutionParameteriv(disp) ((disp)->GetConvolutionParameteriv) +#define SET_GetConvolutionParameteriv(disp, fn) ((disp)->GetConvolutionParameteriv = fn) +#define CALL_GetSeparableFilter(disp, parameters) (*((disp)->GetSeparableFilter)) parameters +#define GET_GetSeparableFilter(disp) ((disp)->GetSeparableFilter) +#define SET_GetSeparableFilter(disp, fn) ((disp)->GetSeparableFilter = fn) +#define CALL_SeparableFilter2D(disp, parameters) (*((disp)->SeparableFilter2D)) parameters +#define GET_SeparableFilter2D(disp) ((disp)->SeparableFilter2D) +#define SET_SeparableFilter2D(disp, fn) ((disp)->SeparableFilter2D = fn) +#define CALL_GetHistogram(disp, parameters) (*((disp)->GetHistogram)) parameters +#define GET_GetHistogram(disp) ((disp)->GetHistogram) +#define SET_GetHistogram(disp, fn) ((disp)->GetHistogram = fn) +#define CALL_GetHistogramParameterfv(disp, parameters) (*((disp)->GetHistogramParameterfv)) parameters +#define GET_GetHistogramParameterfv(disp) ((disp)->GetHistogramParameterfv) +#define SET_GetHistogramParameterfv(disp, fn) ((disp)->GetHistogramParameterfv = fn) +#define CALL_GetHistogramParameteriv(disp, parameters) (*((disp)->GetHistogramParameteriv)) parameters +#define GET_GetHistogramParameteriv(disp) ((disp)->GetHistogramParameteriv) +#define SET_GetHistogramParameteriv(disp, fn) ((disp)->GetHistogramParameteriv = fn) +#define CALL_GetMinmax(disp, parameters) (*((disp)->GetMinmax)) parameters +#define GET_GetMinmax(disp) ((disp)->GetMinmax) +#define SET_GetMinmax(disp, fn) ((disp)->GetMinmax = fn) +#define CALL_GetMinmaxParameterfv(disp, parameters) (*((disp)->GetMinmaxParameterfv)) parameters +#define GET_GetMinmaxParameterfv(disp) ((disp)->GetMinmaxParameterfv) +#define SET_GetMinmaxParameterfv(disp, fn) ((disp)->GetMinmaxParameterfv = fn) +#define CALL_GetMinmaxParameteriv(disp, parameters) (*((disp)->GetMinmaxParameteriv)) parameters +#define GET_GetMinmaxParameteriv(disp) ((disp)->GetMinmaxParameteriv) +#define SET_GetMinmaxParameteriv(disp, fn) ((disp)->GetMinmaxParameteriv = fn) +#define CALL_Histogram(disp, parameters) (*((disp)->Histogram)) parameters +#define GET_Histogram(disp) ((disp)->Histogram) +#define SET_Histogram(disp, fn) ((disp)->Histogram = fn) +#define CALL_Minmax(disp, parameters) (*((disp)->Minmax)) parameters +#define GET_Minmax(disp) ((disp)->Minmax) +#define SET_Minmax(disp, fn) ((disp)->Minmax = fn) +#define CALL_ResetHistogram(disp, parameters) (*((disp)->ResetHistogram)) parameters +#define GET_ResetHistogram(disp) ((disp)->ResetHistogram) +#define SET_ResetHistogram(disp, fn) ((disp)->ResetHistogram = fn) +#define CALL_ResetMinmax(disp, parameters) (*((disp)->ResetMinmax)) parameters +#define GET_ResetMinmax(disp) ((disp)->ResetMinmax) +#define SET_ResetMinmax(disp, fn) ((disp)->ResetMinmax = fn) +#define CALL_TexImage3D(disp, parameters) (*((disp)->TexImage3D)) parameters +#define GET_TexImage3D(disp) ((disp)->TexImage3D) +#define SET_TexImage3D(disp, fn) ((disp)->TexImage3D = fn) +#define CALL_TexSubImage3D(disp, parameters) (*((disp)->TexSubImage3D)) parameters +#define GET_TexSubImage3D(disp) ((disp)->TexSubImage3D) +#define SET_TexSubImage3D(disp, fn) ((disp)->TexSubImage3D = fn) +#define CALL_CopyTexSubImage3D(disp, parameters) (*((disp)->CopyTexSubImage3D)) parameters +#define GET_CopyTexSubImage3D(disp) ((disp)->CopyTexSubImage3D) +#define SET_CopyTexSubImage3D(disp, fn) ((disp)->CopyTexSubImage3D = fn) +#define CALL_ActiveTextureARB(disp, parameters) (*((disp)->ActiveTextureARB)) parameters +#define GET_ActiveTextureARB(disp) ((disp)->ActiveTextureARB) +#define SET_ActiveTextureARB(disp, fn) ((disp)->ActiveTextureARB = fn) +#define CALL_ClientActiveTextureARB(disp, parameters) (*((disp)->ClientActiveTextureARB)) parameters +#define GET_ClientActiveTextureARB(disp) ((disp)->ClientActiveTextureARB) +#define SET_ClientActiveTextureARB(disp, fn) ((disp)->ClientActiveTextureARB = fn) +#define CALL_MultiTexCoord1dARB(disp, parameters) (*((disp)->MultiTexCoord1dARB)) parameters +#define GET_MultiTexCoord1dARB(disp) ((disp)->MultiTexCoord1dARB) +#define SET_MultiTexCoord1dARB(disp, fn) ((disp)->MultiTexCoord1dARB = fn) +#define CALL_MultiTexCoord1dvARB(disp, parameters) (*((disp)->MultiTexCoord1dvARB)) parameters +#define GET_MultiTexCoord1dvARB(disp) ((disp)->MultiTexCoord1dvARB) +#define SET_MultiTexCoord1dvARB(disp, fn) ((disp)->MultiTexCoord1dvARB = fn) +#define CALL_MultiTexCoord1fARB(disp, parameters) (*((disp)->MultiTexCoord1fARB)) parameters +#define GET_MultiTexCoord1fARB(disp) ((disp)->MultiTexCoord1fARB) +#define SET_MultiTexCoord1fARB(disp, fn) ((disp)->MultiTexCoord1fARB = fn) +#define CALL_MultiTexCoord1fvARB(disp, parameters) (*((disp)->MultiTexCoord1fvARB)) parameters +#define GET_MultiTexCoord1fvARB(disp) ((disp)->MultiTexCoord1fvARB) +#define SET_MultiTexCoord1fvARB(disp, fn) ((disp)->MultiTexCoord1fvARB = fn) +#define CALL_MultiTexCoord1iARB(disp, parameters) (*((disp)->MultiTexCoord1iARB)) parameters +#define GET_MultiTexCoord1iARB(disp) ((disp)->MultiTexCoord1iARB) +#define SET_MultiTexCoord1iARB(disp, fn) ((disp)->MultiTexCoord1iARB = fn) +#define CALL_MultiTexCoord1ivARB(disp, parameters) (*((disp)->MultiTexCoord1ivARB)) parameters +#define GET_MultiTexCoord1ivARB(disp) ((disp)->MultiTexCoord1ivARB) +#define SET_MultiTexCoord1ivARB(disp, fn) ((disp)->MultiTexCoord1ivARB = fn) +#define CALL_MultiTexCoord1sARB(disp, parameters) (*((disp)->MultiTexCoord1sARB)) parameters +#define GET_MultiTexCoord1sARB(disp) ((disp)->MultiTexCoord1sARB) +#define SET_MultiTexCoord1sARB(disp, fn) ((disp)->MultiTexCoord1sARB = fn) +#define CALL_MultiTexCoord1svARB(disp, parameters) (*((disp)->MultiTexCoord1svARB)) parameters +#define GET_MultiTexCoord1svARB(disp) ((disp)->MultiTexCoord1svARB) +#define SET_MultiTexCoord1svARB(disp, fn) ((disp)->MultiTexCoord1svARB = fn) +#define CALL_MultiTexCoord2dARB(disp, parameters) (*((disp)->MultiTexCoord2dARB)) parameters +#define GET_MultiTexCoord2dARB(disp) ((disp)->MultiTexCoord2dARB) +#define SET_MultiTexCoord2dARB(disp, fn) ((disp)->MultiTexCoord2dARB = fn) +#define CALL_MultiTexCoord2dvARB(disp, parameters) (*((disp)->MultiTexCoord2dvARB)) parameters +#define GET_MultiTexCoord2dvARB(disp) ((disp)->MultiTexCoord2dvARB) +#define SET_MultiTexCoord2dvARB(disp, fn) ((disp)->MultiTexCoord2dvARB = fn) +#define CALL_MultiTexCoord2fARB(disp, parameters) (*((disp)->MultiTexCoord2fARB)) parameters +#define GET_MultiTexCoord2fARB(disp) ((disp)->MultiTexCoord2fARB) +#define SET_MultiTexCoord2fARB(disp, fn) ((disp)->MultiTexCoord2fARB = fn) +#define CALL_MultiTexCoord2fvARB(disp, parameters) (*((disp)->MultiTexCoord2fvARB)) parameters +#define GET_MultiTexCoord2fvARB(disp) ((disp)->MultiTexCoord2fvARB) +#define SET_MultiTexCoord2fvARB(disp, fn) ((disp)->MultiTexCoord2fvARB = fn) +#define CALL_MultiTexCoord2iARB(disp, parameters) (*((disp)->MultiTexCoord2iARB)) parameters +#define GET_MultiTexCoord2iARB(disp) ((disp)->MultiTexCoord2iARB) +#define SET_MultiTexCoord2iARB(disp, fn) ((disp)->MultiTexCoord2iARB = fn) +#define CALL_MultiTexCoord2ivARB(disp, parameters) (*((disp)->MultiTexCoord2ivARB)) parameters +#define GET_MultiTexCoord2ivARB(disp) ((disp)->MultiTexCoord2ivARB) +#define SET_MultiTexCoord2ivARB(disp, fn) ((disp)->MultiTexCoord2ivARB = fn) +#define CALL_MultiTexCoord2sARB(disp, parameters) (*((disp)->MultiTexCoord2sARB)) parameters +#define GET_MultiTexCoord2sARB(disp) ((disp)->MultiTexCoord2sARB) +#define SET_MultiTexCoord2sARB(disp, fn) ((disp)->MultiTexCoord2sARB = fn) +#define CALL_MultiTexCoord2svARB(disp, parameters) (*((disp)->MultiTexCoord2svARB)) parameters +#define GET_MultiTexCoord2svARB(disp) ((disp)->MultiTexCoord2svARB) +#define SET_MultiTexCoord2svARB(disp, fn) ((disp)->MultiTexCoord2svARB = fn) +#define CALL_MultiTexCoord3dARB(disp, parameters) (*((disp)->MultiTexCoord3dARB)) parameters +#define GET_MultiTexCoord3dARB(disp) ((disp)->MultiTexCoord3dARB) +#define SET_MultiTexCoord3dARB(disp, fn) ((disp)->MultiTexCoord3dARB = fn) +#define CALL_MultiTexCoord3dvARB(disp, parameters) (*((disp)->MultiTexCoord3dvARB)) parameters +#define GET_MultiTexCoord3dvARB(disp) ((disp)->MultiTexCoord3dvARB) +#define SET_MultiTexCoord3dvARB(disp, fn) ((disp)->MultiTexCoord3dvARB = fn) +#define CALL_MultiTexCoord3fARB(disp, parameters) (*((disp)->MultiTexCoord3fARB)) parameters +#define GET_MultiTexCoord3fARB(disp) ((disp)->MultiTexCoord3fARB) +#define SET_MultiTexCoord3fARB(disp, fn) ((disp)->MultiTexCoord3fARB = fn) +#define CALL_MultiTexCoord3fvARB(disp, parameters) (*((disp)->MultiTexCoord3fvARB)) parameters +#define GET_MultiTexCoord3fvARB(disp) ((disp)->MultiTexCoord3fvARB) +#define SET_MultiTexCoord3fvARB(disp, fn) ((disp)->MultiTexCoord3fvARB = fn) +#define CALL_MultiTexCoord3iARB(disp, parameters) (*((disp)->MultiTexCoord3iARB)) parameters +#define GET_MultiTexCoord3iARB(disp) ((disp)->MultiTexCoord3iARB) +#define SET_MultiTexCoord3iARB(disp, fn) ((disp)->MultiTexCoord3iARB = fn) +#define CALL_MultiTexCoord3ivARB(disp, parameters) (*((disp)->MultiTexCoord3ivARB)) parameters +#define GET_MultiTexCoord3ivARB(disp) ((disp)->MultiTexCoord3ivARB) +#define SET_MultiTexCoord3ivARB(disp, fn) ((disp)->MultiTexCoord3ivARB = fn) +#define CALL_MultiTexCoord3sARB(disp, parameters) (*((disp)->MultiTexCoord3sARB)) parameters +#define GET_MultiTexCoord3sARB(disp) ((disp)->MultiTexCoord3sARB) +#define SET_MultiTexCoord3sARB(disp, fn) ((disp)->MultiTexCoord3sARB = fn) +#define CALL_MultiTexCoord3svARB(disp, parameters) (*((disp)->MultiTexCoord3svARB)) parameters +#define GET_MultiTexCoord3svARB(disp) ((disp)->MultiTexCoord3svARB) +#define SET_MultiTexCoord3svARB(disp, fn) ((disp)->MultiTexCoord3svARB = fn) +#define CALL_MultiTexCoord4dARB(disp, parameters) (*((disp)->MultiTexCoord4dARB)) parameters +#define GET_MultiTexCoord4dARB(disp) ((disp)->MultiTexCoord4dARB) +#define SET_MultiTexCoord4dARB(disp, fn) ((disp)->MultiTexCoord4dARB = fn) +#define CALL_MultiTexCoord4dvARB(disp, parameters) (*((disp)->MultiTexCoord4dvARB)) parameters +#define GET_MultiTexCoord4dvARB(disp) ((disp)->MultiTexCoord4dvARB) +#define SET_MultiTexCoord4dvARB(disp, fn) ((disp)->MultiTexCoord4dvARB = fn) +#define CALL_MultiTexCoord4fARB(disp, parameters) (*((disp)->MultiTexCoord4fARB)) parameters +#define GET_MultiTexCoord4fARB(disp) ((disp)->MultiTexCoord4fARB) +#define SET_MultiTexCoord4fARB(disp, fn) ((disp)->MultiTexCoord4fARB = fn) +#define CALL_MultiTexCoord4fvARB(disp, parameters) (*((disp)->MultiTexCoord4fvARB)) parameters +#define GET_MultiTexCoord4fvARB(disp) ((disp)->MultiTexCoord4fvARB) +#define SET_MultiTexCoord4fvARB(disp, fn) ((disp)->MultiTexCoord4fvARB = fn) +#define CALL_MultiTexCoord4iARB(disp, parameters) (*((disp)->MultiTexCoord4iARB)) parameters +#define GET_MultiTexCoord4iARB(disp) ((disp)->MultiTexCoord4iARB) +#define SET_MultiTexCoord4iARB(disp, fn) ((disp)->MultiTexCoord4iARB = fn) +#define CALL_MultiTexCoord4ivARB(disp, parameters) (*((disp)->MultiTexCoord4ivARB)) parameters +#define GET_MultiTexCoord4ivARB(disp) ((disp)->MultiTexCoord4ivARB) +#define SET_MultiTexCoord4ivARB(disp, fn) ((disp)->MultiTexCoord4ivARB = fn) +#define CALL_MultiTexCoord4sARB(disp, parameters) (*((disp)->MultiTexCoord4sARB)) parameters +#define GET_MultiTexCoord4sARB(disp) ((disp)->MultiTexCoord4sARB) +#define SET_MultiTexCoord4sARB(disp, fn) ((disp)->MultiTexCoord4sARB = fn) +#define CALL_MultiTexCoord4svARB(disp, parameters) (*((disp)->MultiTexCoord4svARB)) parameters +#define GET_MultiTexCoord4svARB(disp) ((disp)->MultiTexCoord4svARB) +#define SET_MultiTexCoord4svARB(disp, fn) ((disp)->MultiTexCoord4svARB = fn) + +#if !defined(IN_DRI_DRIVER) + +#define CALL_AttachShader(disp, parameters) (*((disp)->AttachShader)) parameters +#define GET_AttachShader(disp) ((disp)->AttachShader) +#define SET_AttachShader(disp, fn) ((disp)->AttachShader = fn) +#define CALL_CreateProgram(disp, parameters) (*((disp)->CreateProgram)) parameters +#define GET_CreateProgram(disp) ((disp)->CreateProgram) +#define SET_CreateProgram(disp, fn) ((disp)->CreateProgram = fn) +#define CALL_CreateShader(disp, parameters) (*((disp)->CreateShader)) parameters +#define GET_CreateShader(disp) ((disp)->CreateShader) +#define SET_CreateShader(disp, fn) ((disp)->CreateShader = fn) +#define CALL_DeleteProgram(disp, parameters) (*((disp)->DeleteProgram)) parameters +#define GET_DeleteProgram(disp) ((disp)->DeleteProgram) +#define SET_DeleteProgram(disp, fn) ((disp)->DeleteProgram = fn) +#define CALL_DeleteShader(disp, parameters) (*((disp)->DeleteShader)) parameters +#define GET_DeleteShader(disp) ((disp)->DeleteShader) +#define SET_DeleteShader(disp, fn) ((disp)->DeleteShader = fn) +#define CALL_DetachShader(disp, parameters) (*((disp)->DetachShader)) parameters +#define GET_DetachShader(disp) ((disp)->DetachShader) +#define SET_DetachShader(disp, fn) ((disp)->DetachShader = fn) +#define CALL_GetAttachedShaders(disp, parameters) (*((disp)->GetAttachedShaders)) parameters +#define GET_GetAttachedShaders(disp) ((disp)->GetAttachedShaders) +#define SET_GetAttachedShaders(disp, fn) ((disp)->GetAttachedShaders = fn) +#define CALL_GetProgramInfoLog(disp, parameters) (*((disp)->GetProgramInfoLog)) parameters +#define GET_GetProgramInfoLog(disp) ((disp)->GetProgramInfoLog) +#define SET_GetProgramInfoLog(disp, fn) ((disp)->GetProgramInfoLog = fn) +#define CALL_GetProgramiv(disp, parameters) (*((disp)->GetProgramiv)) parameters +#define GET_GetProgramiv(disp) ((disp)->GetProgramiv) +#define SET_GetProgramiv(disp, fn) ((disp)->GetProgramiv = fn) +#define CALL_GetShaderInfoLog(disp, parameters) (*((disp)->GetShaderInfoLog)) parameters +#define GET_GetShaderInfoLog(disp) ((disp)->GetShaderInfoLog) +#define SET_GetShaderInfoLog(disp, fn) ((disp)->GetShaderInfoLog = fn) +#define CALL_GetShaderiv(disp, parameters) (*((disp)->GetShaderiv)) parameters +#define GET_GetShaderiv(disp) ((disp)->GetShaderiv) +#define SET_GetShaderiv(disp, fn) ((disp)->GetShaderiv = fn) +#define CALL_IsProgram(disp, parameters) (*((disp)->IsProgram)) parameters +#define GET_IsProgram(disp) ((disp)->IsProgram) +#define SET_IsProgram(disp, fn) ((disp)->IsProgram = fn) +#define CALL_IsShader(disp, parameters) (*((disp)->IsShader)) parameters +#define GET_IsShader(disp) ((disp)->IsShader) +#define SET_IsShader(disp, fn) ((disp)->IsShader = fn) +#define CALL_StencilFuncSeparate(disp, parameters) (*((disp)->StencilFuncSeparate)) parameters +#define GET_StencilFuncSeparate(disp) ((disp)->StencilFuncSeparate) +#define SET_StencilFuncSeparate(disp, fn) ((disp)->StencilFuncSeparate = fn) +#define CALL_StencilMaskSeparate(disp, parameters) (*((disp)->StencilMaskSeparate)) parameters +#define GET_StencilMaskSeparate(disp) ((disp)->StencilMaskSeparate) +#define SET_StencilMaskSeparate(disp, fn) ((disp)->StencilMaskSeparate = fn) +#define CALL_StencilOpSeparate(disp, parameters) (*((disp)->StencilOpSeparate)) parameters +#define GET_StencilOpSeparate(disp) ((disp)->StencilOpSeparate) +#define SET_StencilOpSeparate(disp, fn) ((disp)->StencilOpSeparate = fn) +#define CALL_UniformMatrix2x3fv(disp, parameters) (*((disp)->UniformMatrix2x3fv)) parameters +#define GET_UniformMatrix2x3fv(disp) ((disp)->UniformMatrix2x3fv) +#define SET_UniformMatrix2x3fv(disp, fn) ((disp)->UniformMatrix2x3fv = fn) +#define CALL_UniformMatrix2x4fv(disp, parameters) (*((disp)->UniformMatrix2x4fv)) parameters +#define GET_UniformMatrix2x4fv(disp) ((disp)->UniformMatrix2x4fv) +#define SET_UniformMatrix2x4fv(disp, fn) ((disp)->UniformMatrix2x4fv = fn) +#define CALL_UniformMatrix3x2fv(disp, parameters) (*((disp)->UniformMatrix3x2fv)) parameters +#define GET_UniformMatrix3x2fv(disp) ((disp)->UniformMatrix3x2fv) +#define SET_UniformMatrix3x2fv(disp, fn) ((disp)->UniformMatrix3x2fv = fn) +#define CALL_UniformMatrix3x4fv(disp, parameters) (*((disp)->UniformMatrix3x4fv)) parameters +#define GET_UniformMatrix3x4fv(disp) ((disp)->UniformMatrix3x4fv) +#define SET_UniformMatrix3x4fv(disp, fn) ((disp)->UniformMatrix3x4fv = fn) +#define CALL_UniformMatrix4x2fv(disp, parameters) (*((disp)->UniformMatrix4x2fv)) parameters +#define GET_UniformMatrix4x2fv(disp) ((disp)->UniformMatrix4x2fv) +#define SET_UniformMatrix4x2fv(disp, fn) ((disp)->UniformMatrix4x2fv = fn) +#define CALL_UniformMatrix4x3fv(disp, parameters) (*((disp)->UniformMatrix4x3fv)) parameters +#define GET_UniformMatrix4x3fv(disp) ((disp)->UniformMatrix4x3fv) +#define SET_UniformMatrix4x3fv(disp, fn) ((disp)->UniformMatrix4x3fv = fn) +#define CALL_LoadTransposeMatrixdARB(disp, parameters) (*((disp)->LoadTransposeMatrixdARB)) parameters +#define GET_LoadTransposeMatrixdARB(disp) ((disp)->LoadTransposeMatrixdARB) +#define SET_LoadTransposeMatrixdARB(disp, fn) ((disp)->LoadTransposeMatrixdARB = fn) +#define CALL_LoadTransposeMatrixfARB(disp, parameters) (*((disp)->LoadTransposeMatrixfARB)) parameters +#define GET_LoadTransposeMatrixfARB(disp) ((disp)->LoadTransposeMatrixfARB) +#define SET_LoadTransposeMatrixfARB(disp, fn) ((disp)->LoadTransposeMatrixfARB = fn) +#define CALL_MultTransposeMatrixdARB(disp, parameters) (*((disp)->MultTransposeMatrixdARB)) parameters +#define GET_MultTransposeMatrixdARB(disp) ((disp)->MultTransposeMatrixdARB) +#define SET_MultTransposeMatrixdARB(disp, fn) ((disp)->MultTransposeMatrixdARB = fn) +#define CALL_MultTransposeMatrixfARB(disp, parameters) (*((disp)->MultTransposeMatrixfARB)) parameters +#define GET_MultTransposeMatrixfARB(disp) ((disp)->MultTransposeMatrixfARB) +#define SET_MultTransposeMatrixfARB(disp, fn) ((disp)->MultTransposeMatrixfARB = fn) +#define CALL_SampleCoverageARB(disp, parameters) (*((disp)->SampleCoverageARB)) parameters +#define GET_SampleCoverageARB(disp) ((disp)->SampleCoverageARB) +#define SET_SampleCoverageARB(disp, fn) ((disp)->SampleCoverageARB = fn) +#define CALL_CompressedTexImage1DARB(disp, parameters) (*((disp)->CompressedTexImage1DARB)) parameters +#define GET_CompressedTexImage1DARB(disp) ((disp)->CompressedTexImage1DARB) +#define SET_CompressedTexImage1DARB(disp, fn) ((disp)->CompressedTexImage1DARB = fn) +#define CALL_CompressedTexImage2DARB(disp, parameters) (*((disp)->CompressedTexImage2DARB)) parameters +#define GET_CompressedTexImage2DARB(disp) ((disp)->CompressedTexImage2DARB) +#define SET_CompressedTexImage2DARB(disp, fn) ((disp)->CompressedTexImage2DARB = fn) +#define CALL_CompressedTexImage3DARB(disp, parameters) (*((disp)->CompressedTexImage3DARB)) parameters +#define GET_CompressedTexImage3DARB(disp) ((disp)->CompressedTexImage3DARB) +#define SET_CompressedTexImage3DARB(disp, fn) ((disp)->CompressedTexImage3DARB = fn) +#define CALL_CompressedTexSubImage1DARB(disp, parameters) (*((disp)->CompressedTexSubImage1DARB)) parameters +#define GET_CompressedTexSubImage1DARB(disp) ((disp)->CompressedTexSubImage1DARB) +#define SET_CompressedTexSubImage1DARB(disp, fn) ((disp)->CompressedTexSubImage1DARB = fn) +#define CALL_CompressedTexSubImage2DARB(disp, parameters) (*((disp)->CompressedTexSubImage2DARB)) parameters +#define GET_CompressedTexSubImage2DARB(disp) ((disp)->CompressedTexSubImage2DARB) +#define SET_CompressedTexSubImage2DARB(disp, fn) ((disp)->CompressedTexSubImage2DARB = fn) +#define CALL_CompressedTexSubImage3DARB(disp, parameters) (*((disp)->CompressedTexSubImage3DARB)) parameters +#define GET_CompressedTexSubImage3DARB(disp) ((disp)->CompressedTexSubImage3DARB) +#define SET_CompressedTexSubImage3DARB(disp, fn) ((disp)->CompressedTexSubImage3DARB = fn) +#define CALL_GetCompressedTexImageARB(disp, parameters) (*((disp)->GetCompressedTexImageARB)) parameters +#define GET_GetCompressedTexImageARB(disp) ((disp)->GetCompressedTexImageARB) +#define SET_GetCompressedTexImageARB(disp, fn) ((disp)->GetCompressedTexImageARB = fn) +#define CALL_DisableVertexAttribArrayARB(disp, parameters) (*((disp)->DisableVertexAttribArrayARB)) parameters +#define GET_DisableVertexAttribArrayARB(disp) ((disp)->DisableVertexAttribArrayARB) +#define SET_DisableVertexAttribArrayARB(disp, fn) ((disp)->DisableVertexAttribArrayARB = fn) +#define CALL_EnableVertexAttribArrayARB(disp, parameters) (*((disp)->EnableVertexAttribArrayARB)) parameters +#define GET_EnableVertexAttribArrayARB(disp) ((disp)->EnableVertexAttribArrayARB) +#define SET_EnableVertexAttribArrayARB(disp, fn) ((disp)->EnableVertexAttribArrayARB = fn) +#define CALL_GetProgramEnvParameterdvARB(disp, parameters) (*((disp)->GetProgramEnvParameterdvARB)) parameters +#define GET_GetProgramEnvParameterdvARB(disp) ((disp)->GetProgramEnvParameterdvARB) +#define SET_GetProgramEnvParameterdvARB(disp, fn) ((disp)->GetProgramEnvParameterdvARB = fn) +#define CALL_GetProgramEnvParameterfvARB(disp, parameters) (*((disp)->GetProgramEnvParameterfvARB)) parameters +#define GET_GetProgramEnvParameterfvARB(disp) ((disp)->GetProgramEnvParameterfvARB) +#define SET_GetProgramEnvParameterfvARB(disp, fn) ((disp)->GetProgramEnvParameterfvARB = fn) +#define CALL_GetProgramLocalParameterdvARB(disp, parameters) (*((disp)->GetProgramLocalParameterdvARB)) parameters +#define GET_GetProgramLocalParameterdvARB(disp) ((disp)->GetProgramLocalParameterdvARB) +#define SET_GetProgramLocalParameterdvARB(disp, fn) ((disp)->GetProgramLocalParameterdvARB = fn) +#define CALL_GetProgramLocalParameterfvARB(disp, parameters) (*((disp)->GetProgramLocalParameterfvARB)) parameters +#define GET_GetProgramLocalParameterfvARB(disp) ((disp)->GetProgramLocalParameterfvARB) +#define SET_GetProgramLocalParameterfvARB(disp, fn) ((disp)->GetProgramLocalParameterfvARB = fn) +#define CALL_GetProgramStringARB(disp, parameters) (*((disp)->GetProgramStringARB)) parameters +#define GET_GetProgramStringARB(disp) ((disp)->GetProgramStringARB) +#define SET_GetProgramStringARB(disp, fn) ((disp)->GetProgramStringARB = fn) +#define CALL_GetProgramivARB(disp, parameters) (*((disp)->GetProgramivARB)) parameters +#define GET_GetProgramivARB(disp) ((disp)->GetProgramivARB) +#define SET_GetProgramivARB(disp, fn) ((disp)->GetProgramivARB = fn) +#define CALL_GetVertexAttribdvARB(disp, parameters) (*((disp)->GetVertexAttribdvARB)) parameters +#define GET_GetVertexAttribdvARB(disp) ((disp)->GetVertexAttribdvARB) +#define SET_GetVertexAttribdvARB(disp, fn) ((disp)->GetVertexAttribdvARB = fn) +#define CALL_GetVertexAttribfvARB(disp, parameters) (*((disp)->GetVertexAttribfvARB)) parameters +#define GET_GetVertexAttribfvARB(disp) ((disp)->GetVertexAttribfvARB) +#define SET_GetVertexAttribfvARB(disp, fn) ((disp)->GetVertexAttribfvARB = fn) +#define CALL_GetVertexAttribivARB(disp, parameters) (*((disp)->GetVertexAttribivARB)) parameters +#define GET_GetVertexAttribivARB(disp) ((disp)->GetVertexAttribivARB) +#define SET_GetVertexAttribivARB(disp, fn) ((disp)->GetVertexAttribivARB = fn) +#define CALL_ProgramEnvParameter4dARB(disp, parameters) (*((disp)->ProgramEnvParameter4dARB)) parameters +#define GET_ProgramEnvParameter4dARB(disp) ((disp)->ProgramEnvParameter4dARB) +#define SET_ProgramEnvParameter4dARB(disp, fn) ((disp)->ProgramEnvParameter4dARB = fn) +#define CALL_ProgramEnvParameter4dvARB(disp, parameters) (*((disp)->ProgramEnvParameter4dvARB)) parameters +#define GET_ProgramEnvParameter4dvARB(disp) ((disp)->ProgramEnvParameter4dvARB) +#define SET_ProgramEnvParameter4dvARB(disp, fn) ((disp)->ProgramEnvParameter4dvARB = fn) +#define CALL_ProgramEnvParameter4fARB(disp, parameters) (*((disp)->ProgramEnvParameter4fARB)) parameters +#define GET_ProgramEnvParameter4fARB(disp) ((disp)->ProgramEnvParameter4fARB) +#define SET_ProgramEnvParameter4fARB(disp, fn) ((disp)->ProgramEnvParameter4fARB = fn) +#define CALL_ProgramEnvParameter4fvARB(disp, parameters) (*((disp)->ProgramEnvParameter4fvARB)) parameters +#define GET_ProgramEnvParameter4fvARB(disp) ((disp)->ProgramEnvParameter4fvARB) +#define SET_ProgramEnvParameter4fvARB(disp, fn) ((disp)->ProgramEnvParameter4fvARB = fn) +#define CALL_ProgramLocalParameter4dARB(disp, parameters) (*((disp)->ProgramLocalParameter4dARB)) parameters +#define GET_ProgramLocalParameter4dARB(disp) ((disp)->ProgramLocalParameter4dARB) +#define SET_ProgramLocalParameter4dARB(disp, fn) ((disp)->ProgramLocalParameter4dARB = fn) +#define CALL_ProgramLocalParameter4dvARB(disp, parameters) (*((disp)->ProgramLocalParameter4dvARB)) parameters +#define GET_ProgramLocalParameter4dvARB(disp) ((disp)->ProgramLocalParameter4dvARB) +#define SET_ProgramLocalParameter4dvARB(disp, fn) ((disp)->ProgramLocalParameter4dvARB = fn) +#define CALL_ProgramLocalParameter4fARB(disp, parameters) (*((disp)->ProgramLocalParameter4fARB)) parameters +#define GET_ProgramLocalParameter4fARB(disp) ((disp)->ProgramLocalParameter4fARB) +#define SET_ProgramLocalParameter4fARB(disp, fn) ((disp)->ProgramLocalParameter4fARB = fn) +#define CALL_ProgramLocalParameter4fvARB(disp, parameters) (*((disp)->ProgramLocalParameter4fvARB)) parameters +#define GET_ProgramLocalParameter4fvARB(disp) ((disp)->ProgramLocalParameter4fvARB) +#define SET_ProgramLocalParameter4fvARB(disp, fn) ((disp)->ProgramLocalParameter4fvARB = fn) +#define CALL_ProgramStringARB(disp, parameters) (*((disp)->ProgramStringARB)) parameters +#define GET_ProgramStringARB(disp) ((disp)->ProgramStringARB) +#define SET_ProgramStringARB(disp, fn) ((disp)->ProgramStringARB = fn) +#define CALL_VertexAttrib1dARB(disp, parameters) (*((disp)->VertexAttrib1dARB)) parameters +#define GET_VertexAttrib1dARB(disp) ((disp)->VertexAttrib1dARB) +#define SET_VertexAttrib1dARB(disp, fn) ((disp)->VertexAttrib1dARB = fn) +#define CALL_VertexAttrib1dvARB(disp, parameters) (*((disp)->VertexAttrib1dvARB)) parameters +#define GET_VertexAttrib1dvARB(disp) ((disp)->VertexAttrib1dvARB) +#define SET_VertexAttrib1dvARB(disp, fn) ((disp)->VertexAttrib1dvARB = fn) +#define CALL_VertexAttrib1fARB(disp, parameters) (*((disp)->VertexAttrib1fARB)) parameters +#define GET_VertexAttrib1fARB(disp) ((disp)->VertexAttrib1fARB) +#define SET_VertexAttrib1fARB(disp, fn) ((disp)->VertexAttrib1fARB = fn) +#define CALL_VertexAttrib1fvARB(disp, parameters) (*((disp)->VertexAttrib1fvARB)) parameters +#define GET_VertexAttrib1fvARB(disp) ((disp)->VertexAttrib1fvARB) +#define SET_VertexAttrib1fvARB(disp, fn) ((disp)->VertexAttrib1fvARB = fn) +#define CALL_VertexAttrib1sARB(disp, parameters) (*((disp)->VertexAttrib1sARB)) parameters +#define GET_VertexAttrib1sARB(disp) ((disp)->VertexAttrib1sARB) +#define SET_VertexAttrib1sARB(disp, fn) ((disp)->VertexAttrib1sARB = fn) +#define CALL_VertexAttrib1svARB(disp, parameters) (*((disp)->VertexAttrib1svARB)) parameters +#define GET_VertexAttrib1svARB(disp) ((disp)->VertexAttrib1svARB) +#define SET_VertexAttrib1svARB(disp, fn) ((disp)->VertexAttrib1svARB = fn) +#define CALL_VertexAttrib2dARB(disp, parameters) (*((disp)->VertexAttrib2dARB)) parameters +#define GET_VertexAttrib2dARB(disp) ((disp)->VertexAttrib2dARB) +#define SET_VertexAttrib2dARB(disp, fn) ((disp)->VertexAttrib2dARB = fn) +#define CALL_VertexAttrib2dvARB(disp, parameters) (*((disp)->VertexAttrib2dvARB)) parameters +#define GET_VertexAttrib2dvARB(disp) ((disp)->VertexAttrib2dvARB) +#define SET_VertexAttrib2dvARB(disp, fn) ((disp)->VertexAttrib2dvARB = fn) +#define CALL_VertexAttrib2fARB(disp, parameters) (*((disp)->VertexAttrib2fARB)) parameters +#define GET_VertexAttrib2fARB(disp) ((disp)->VertexAttrib2fARB) +#define SET_VertexAttrib2fARB(disp, fn) ((disp)->VertexAttrib2fARB = fn) +#define CALL_VertexAttrib2fvARB(disp, parameters) (*((disp)->VertexAttrib2fvARB)) parameters +#define GET_VertexAttrib2fvARB(disp) ((disp)->VertexAttrib2fvARB) +#define SET_VertexAttrib2fvARB(disp, fn) ((disp)->VertexAttrib2fvARB = fn) +#define CALL_VertexAttrib2sARB(disp, parameters) (*((disp)->VertexAttrib2sARB)) parameters +#define GET_VertexAttrib2sARB(disp) ((disp)->VertexAttrib2sARB) +#define SET_VertexAttrib2sARB(disp, fn) ((disp)->VertexAttrib2sARB = fn) +#define CALL_VertexAttrib2svARB(disp, parameters) (*((disp)->VertexAttrib2svARB)) parameters +#define GET_VertexAttrib2svARB(disp) ((disp)->VertexAttrib2svARB) +#define SET_VertexAttrib2svARB(disp, fn) ((disp)->VertexAttrib2svARB = fn) +#define CALL_VertexAttrib3dARB(disp, parameters) (*((disp)->VertexAttrib3dARB)) parameters +#define GET_VertexAttrib3dARB(disp) ((disp)->VertexAttrib3dARB) +#define SET_VertexAttrib3dARB(disp, fn) ((disp)->VertexAttrib3dARB = fn) +#define CALL_VertexAttrib3dvARB(disp, parameters) (*((disp)->VertexAttrib3dvARB)) parameters +#define GET_VertexAttrib3dvARB(disp) ((disp)->VertexAttrib3dvARB) +#define SET_VertexAttrib3dvARB(disp, fn) ((disp)->VertexAttrib3dvARB = fn) +#define CALL_VertexAttrib3fARB(disp, parameters) (*((disp)->VertexAttrib3fARB)) parameters +#define GET_VertexAttrib3fARB(disp) ((disp)->VertexAttrib3fARB) +#define SET_VertexAttrib3fARB(disp, fn) ((disp)->VertexAttrib3fARB = fn) +#define CALL_VertexAttrib3fvARB(disp, parameters) (*((disp)->VertexAttrib3fvARB)) parameters +#define GET_VertexAttrib3fvARB(disp) ((disp)->VertexAttrib3fvARB) +#define SET_VertexAttrib3fvARB(disp, fn) ((disp)->VertexAttrib3fvARB = fn) +#define CALL_VertexAttrib3sARB(disp, parameters) (*((disp)->VertexAttrib3sARB)) parameters +#define GET_VertexAttrib3sARB(disp) ((disp)->VertexAttrib3sARB) +#define SET_VertexAttrib3sARB(disp, fn) ((disp)->VertexAttrib3sARB = fn) +#define CALL_VertexAttrib3svARB(disp, parameters) (*((disp)->VertexAttrib3svARB)) parameters +#define GET_VertexAttrib3svARB(disp) ((disp)->VertexAttrib3svARB) +#define SET_VertexAttrib3svARB(disp, fn) ((disp)->VertexAttrib3svARB = fn) +#define CALL_VertexAttrib4NbvARB(disp, parameters) (*((disp)->VertexAttrib4NbvARB)) parameters +#define GET_VertexAttrib4NbvARB(disp) ((disp)->VertexAttrib4NbvARB) +#define SET_VertexAttrib4NbvARB(disp, fn) ((disp)->VertexAttrib4NbvARB = fn) +#define CALL_VertexAttrib4NivARB(disp, parameters) (*((disp)->VertexAttrib4NivARB)) parameters +#define GET_VertexAttrib4NivARB(disp) ((disp)->VertexAttrib4NivARB) +#define SET_VertexAttrib4NivARB(disp, fn) ((disp)->VertexAttrib4NivARB = fn) +#define CALL_VertexAttrib4NsvARB(disp, parameters) (*((disp)->VertexAttrib4NsvARB)) parameters +#define GET_VertexAttrib4NsvARB(disp) ((disp)->VertexAttrib4NsvARB) +#define SET_VertexAttrib4NsvARB(disp, fn) ((disp)->VertexAttrib4NsvARB = fn) +#define CALL_VertexAttrib4NubARB(disp, parameters) (*((disp)->VertexAttrib4NubARB)) parameters +#define GET_VertexAttrib4NubARB(disp) ((disp)->VertexAttrib4NubARB) +#define SET_VertexAttrib4NubARB(disp, fn) ((disp)->VertexAttrib4NubARB = fn) +#define CALL_VertexAttrib4NubvARB(disp, parameters) (*((disp)->VertexAttrib4NubvARB)) parameters +#define GET_VertexAttrib4NubvARB(disp) ((disp)->VertexAttrib4NubvARB) +#define SET_VertexAttrib4NubvARB(disp, fn) ((disp)->VertexAttrib4NubvARB = fn) +#define CALL_VertexAttrib4NuivARB(disp, parameters) (*((disp)->VertexAttrib4NuivARB)) parameters +#define GET_VertexAttrib4NuivARB(disp) ((disp)->VertexAttrib4NuivARB) +#define SET_VertexAttrib4NuivARB(disp, fn) ((disp)->VertexAttrib4NuivARB = fn) +#define CALL_VertexAttrib4NusvARB(disp, parameters) (*((disp)->VertexAttrib4NusvARB)) parameters +#define GET_VertexAttrib4NusvARB(disp) ((disp)->VertexAttrib4NusvARB) +#define SET_VertexAttrib4NusvARB(disp, fn) ((disp)->VertexAttrib4NusvARB = fn) +#define CALL_VertexAttrib4bvARB(disp, parameters) (*((disp)->VertexAttrib4bvARB)) parameters +#define GET_VertexAttrib4bvARB(disp) ((disp)->VertexAttrib4bvARB) +#define SET_VertexAttrib4bvARB(disp, fn) ((disp)->VertexAttrib4bvARB = fn) +#define CALL_VertexAttrib4dARB(disp, parameters) (*((disp)->VertexAttrib4dARB)) parameters +#define GET_VertexAttrib4dARB(disp) ((disp)->VertexAttrib4dARB) +#define SET_VertexAttrib4dARB(disp, fn) ((disp)->VertexAttrib4dARB = fn) +#define CALL_VertexAttrib4dvARB(disp, parameters) (*((disp)->VertexAttrib4dvARB)) parameters +#define GET_VertexAttrib4dvARB(disp) ((disp)->VertexAttrib4dvARB) +#define SET_VertexAttrib4dvARB(disp, fn) ((disp)->VertexAttrib4dvARB = fn) +#define CALL_VertexAttrib4fARB(disp, parameters) (*((disp)->VertexAttrib4fARB)) parameters +#define GET_VertexAttrib4fARB(disp) ((disp)->VertexAttrib4fARB) +#define SET_VertexAttrib4fARB(disp, fn) ((disp)->VertexAttrib4fARB = fn) +#define CALL_VertexAttrib4fvARB(disp, parameters) (*((disp)->VertexAttrib4fvARB)) parameters +#define GET_VertexAttrib4fvARB(disp) ((disp)->VertexAttrib4fvARB) +#define SET_VertexAttrib4fvARB(disp, fn) ((disp)->VertexAttrib4fvARB = fn) +#define CALL_VertexAttrib4ivARB(disp, parameters) (*((disp)->VertexAttrib4ivARB)) parameters +#define GET_VertexAttrib4ivARB(disp) ((disp)->VertexAttrib4ivARB) +#define SET_VertexAttrib4ivARB(disp, fn) ((disp)->VertexAttrib4ivARB = fn) +#define CALL_VertexAttrib4sARB(disp, parameters) (*((disp)->VertexAttrib4sARB)) parameters +#define GET_VertexAttrib4sARB(disp) ((disp)->VertexAttrib4sARB) +#define SET_VertexAttrib4sARB(disp, fn) ((disp)->VertexAttrib4sARB = fn) +#define CALL_VertexAttrib4svARB(disp, parameters) (*((disp)->VertexAttrib4svARB)) parameters +#define GET_VertexAttrib4svARB(disp) ((disp)->VertexAttrib4svARB) +#define SET_VertexAttrib4svARB(disp, fn) ((disp)->VertexAttrib4svARB = fn) +#define CALL_VertexAttrib4ubvARB(disp, parameters) (*((disp)->VertexAttrib4ubvARB)) parameters +#define GET_VertexAttrib4ubvARB(disp) ((disp)->VertexAttrib4ubvARB) +#define SET_VertexAttrib4ubvARB(disp, fn) ((disp)->VertexAttrib4ubvARB = fn) +#define CALL_VertexAttrib4uivARB(disp, parameters) (*((disp)->VertexAttrib4uivARB)) parameters +#define GET_VertexAttrib4uivARB(disp) ((disp)->VertexAttrib4uivARB) +#define SET_VertexAttrib4uivARB(disp, fn) ((disp)->VertexAttrib4uivARB = fn) +#define CALL_VertexAttrib4usvARB(disp, parameters) (*((disp)->VertexAttrib4usvARB)) parameters +#define GET_VertexAttrib4usvARB(disp) ((disp)->VertexAttrib4usvARB) +#define SET_VertexAttrib4usvARB(disp, fn) ((disp)->VertexAttrib4usvARB = fn) +#define CALL_VertexAttribPointerARB(disp, parameters) (*((disp)->VertexAttribPointerARB)) parameters +#define GET_VertexAttribPointerARB(disp) ((disp)->VertexAttribPointerARB) +#define SET_VertexAttribPointerARB(disp, fn) ((disp)->VertexAttribPointerARB = fn) +#define CALL_BindBufferARB(disp, parameters) (*((disp)->BindBufferARB)) parameters +#define GET_BindBufferARB(disp) ((disp)->BindBufferARB) +#define SET_BindBufferARB(disp, fn) ((disp)->BindBufferARB = fn) +#define CALL_BufferDataARB(disp, parameters) (*((disp)->BufferDataARB)) parameters +#define GET_BufferDataARB(disp) ((disp)->BufferDataARB) +#define SET_BufferDataARB(disp, fn) ((disp)->BufferDataARB = fn) +#define CALL_BufferSubDataARB(disp, parameters) (*((disp)->BufferSubDataARB)) parameters +#define GET_BufferSubDataARB(disp) ((disp)->BufferSubDataARB) +#define SET_BufferSubDataARB(disp, fn) ((disp)->BufferSubDataARB = fn) +#define CALL_DeleteBuffersARB(disp, parameters) (*((disp)->DeleteBuffersARB)) parameters +#define GET_DeleteBuffersARB(disp) ((disp)->DeleteBuffersARB) +#define SET_DeleteBuffersARB(disp, fn) ((disp)->DeleteBuffersARB = fn) +#define CALL_GenBuffersARB(disp, parameters) (*((disp)->GenBuffersARB)) parameters +#define GET_GenBuffersARB(disp) ((disp)->GenBuffersARB) +#define SET_GenBuffersARB(disp, fn) ((disp)->GenBuffersARB = fn) +#define CALL_GetBufferParameterivARB(disp, parameters) (*((disp)->GetBufferParameterivARB)) parameters +#define GET_GetBufferParameterivARB(disp) ((disp)->GetBufferParameterivARB) +#define SET_GetBufferParameterivARB(disp, fn) ((disp)->GetBufferParameterivARB = fn) +#define CALL_GetBufferPointervARB(disp, parameters) (*((disp)->GetBufferPointervARB)) parameters +#define GET_GetBufferPointervARB(disp) ((disp)->GetBufferPointervARB) +#define SET_GetBufferPointervARB(disp, fn) ((disp)->GetBufferPointervARB = fn) +#define CALL_GetBufferSubDataARB(disp, parameters) (*((disp)->GetBufferSubDataARB)) parameters +#define GET_GetBufferSubDataARB(disp) ((disp)->GetBufferSubDataARB) +#define SET_GetBufferSubDataARB(disp, fn) ((disp)->GetBufferSubDataARB = fn) +#define CALL_IsBufferARB(disp, parameters) (*((disp)->IsBufferARB)) parameters +#define GET_IsBufferARB(disp) ((disp)->IsBufferARB) +#define SET_IsBufferARB(disp, fn) ((disp)->IsBufferARB = fn) +#define CALL_MapBufferARB(disp, parameters) (*((disp)->MapBufferARB)) parameters +#define GET_MapBufferARB(disp) ((disp)->MapBufferARB) +#define SET_MapBufferARB(disp, fn) ((disp)->MapBufferARB = fn) +#define CALL_UnmapBufferARB(disp, parameters) (*((disp)->UnmapBufferARB)) parameters +#define GET_UnmapBufferARB(disp) ((disp)->UnmapBufferARB) +#define SET_UnmapBufferARB(disp, fn) ((disp)->UnmapBufferARB = fn) +#define CALL_BeginQueryARB(disp, parameters) (*((disp)->BeginQueryARB)) parameters +#define GET_BeginQueryARB(disp) ((disp)->BeginQueryARB) +#define SET_BeginQueryARB(disp, fn) ((disp)->BeginQueryARB = fn) +#define CALL_DeleteQueriesARB(disp, parameters) (*((disp)->DeleteQueriesARB)) parameters +#define GET_DeleteQueriesARB(disp) ((disp)->DeleteQueriesARB) +#define SET_DeleteQueriesARB(disp, fn) ((disp)->DeleteQueriesARB = fn) +#define CALL_EndQueryARB(disp, parameters) (*((disp)->EndQueryARB)) parameters +#define GET_EndQueryARB(disp) ((disp)->EndQueryARB) +#define SET_EndQueryARB(disp, fn) ((disp)->EndQueryARB = fn) +#define CALL_GenQueriesARB(disp, parameters) (*((disp)->GenQueriesARB)) parameters +#define GET_GenQueriesARB(disp) ((disp)->GenQueriesARB) +#define SET_GenQueriesARB(disp, fn) ((disp)->GenQueriesARB = fn) +#define CALL_GetQueryObjectivARB(disp, parameters) (*((disp)->GetQueryObjectivARB)) parameters +#define GET_GetQueryObjectivARB(disp) ((disp)->GetQueryObjectivARB) +#define SET_GetQueryObjectivARB(disp, fn) ((disp)->GetQueryObjectivARB = fn) +#define CALL_GetQueryObjectuivARB(disp, parameters) (*((disp)->GetQueryObjectuivARB)) parameters +#define GET_GetQueryObjectuivARB(disp) ((disp)->GetQueryObjectuivARB) +#define SET_GetQueryObjectuivARB(disp, fn) ((disp)->GetQueryObjectuivARB = fn) +#define CALL_GetQueryivARB(disp, parameters) (*((disp)->GetQueryivARB)) parameters +#define GET_GetQueryivARB(disp) ((disp)->GetQueryivARB) +#define SET_GetQueryivARB(disp, fn) ((disp)->GetQueryivARB = fn) +#define CALL_IsQueryARB(disp, parameters) (*((disp)->IsQueryARB)) parameters +#define GET_IsQueryARB(disp) ((disp)->IsQueryARB) +#define SET_IsQueryARB(disp, fn) ((disp)->IsQueryARB = fn) +#define CALL_AttachObjectARB(disp, parameters) (*((disp)->AttachObjectARB)) parameters +#define GET_AttachObjectARB(disp) ((disp)->AttachObjectARB) +#define SET_AttachObjectARB(disp, fn) ((disp)->AttachObjectARB = fn) +#define CALL_CompileShaderARB(disp, parameters) (*((disp)->CompileShaderARB)) parameters +#define GET_CompileShaderARB(disp) ((disp)->CompileShaderARB) +#define SET_CompileShaderARB(disp, fn) ((disp)->CompileShaderARB = fn) +#define CALL_CreateProgramObjectARB(disp, parameters) (*((disp)->CreateProgramObjectARB)) parameters +#define GET_CreateProgramObjectARB(disp) ((disp)->CreateProgramObjectARB) +#define SET_CreateProgramObjectARB(disp, fn) ((disp)->CreateProgramObjectARB = fn) +#define CALL_CreateShaderObjectARB(disp, parameters) (*((disp)->CreateShaderObjectARB)) parameters +#define GET_CreateShaderObjectARB(disp) ((disp)->CreateShaderObjectARB) +#define SET_CreateShaderObjectARB(disp, fn) ((disp)->CreateShaderObjectARB = fn) +#define CALL_DeleteObjectARB(disp, parameters) (*((disp)->DeleteObjectARB)) parameters +#define GET_DeleteObjectARB(disp) ((disp)->DeleteObjectARB) +#define SET_DeleteObjectARB(disp, fn) ((disp)->DeleteObjectARB = fn) +#define CALL_DetachObjectARB(disp, parameters) (*((disp)->DetachObjectARB)) parameters +#define GET_DetachObjectARB(disp) ((disp)->DetachObjectARB) +#define SET_DetachObjectARB(disp, fn) ((disp)->DetachObjectARB = fn) +#define CALL_GetActiveUniformARB(disp, parameters) (*((disp)->GetActiveUniformARB)) parameters +#define GET_GetActiveUniformARB(disp) ((disp)->GetActiveUniformARB) +#define SET_GetActiveUniformARB(disp, fn) ((disp)->GetActiveUniformARB = fn) +#define CALL_GetAttachedObjectsARB(disp, parameters) (*((disp)->GetAttachedObjectsARB)) parameters +#define GET_GetAttachedObjectsARB(disp) ((disp)->GetAttachedObjectsARB) +#define SET_GetAttachedObjectsARB(disp, fn) ((disp)->GetAttachedObjectsARB = fn) +#define CALL_GetHandleARB(disp, parameters) (*((disp)->GetHandleARB)) parameters +#define GET_GetHandleARB(disp) ((disp)->GetHandleARB) +#define SET_GetHandleARB(disp, fn) ((disp)->GetHandleARB = fn) +#define CALL_GetInfoLogARB(disp, parameters) (*((disp)->GetInfoLogARB)) parameters +#define GET_GetInfoLogARB(disp) ((disp)->GetInfoLogARB) +#define SET_GetInfoLogARB(disp, fn) ((disp)->GetInfoLogARB = fn) +#define CALL_GetObjectParameterfvARB(disp, parameters) (*((disp)->GetObjectParameterfvARB)) parameters +#define GET_GetObjectParameterfvARB(disp) ((disp)->GetObjectParameterfvARB) +#define SET_GetObjectParameterfvARB(disp, fn) ((disp)->GetObjectParameterfvARB = fn) +#define CALL_GetObjectParameterivARB(disp, parameters) (*((disp)->GetObjectParameterivARB)) parameters +#define GET_GetObjectParameterivARB(disp) ((disp)->GetObjectParameterivARB) +#define SET_GetObjectParameterivARB(disp, fn) ((disp)->GetObjectParameterivARB = fn) +#define CALL_GetShaderSourceARB(disp, parameters) (*((disp)->GetShaderSourceARB)) parameters +#define GET_GetShaderSourceARB(disp) ((disp)->GetShaderSourceARB) +#define SET_GetShaderSourceARB(disp, fn) ((disp)->GetShaderSourceARB = fn) +#define CALL_GetUniformLocationARB(disp, parameters) (*((disp)->GetUniformLocationARB)) parameters +#define GET_GetUniformLocationARB(disp) ((disp)->GetUniformLocationARB) +#define SET_GetUniformLocationARB(disp, fn) ((disp)->GetUniformLocationARB = fn) +#define CALL_GetUniformfvARB(disp, parameters) (*((disp)->GetUniformfvARB)) parameters +#define GET_GetUniformfvARB(disp) ((disp)->GetUniformfvARB) +#define SET_GetUniformfvARB(disp, fn) ((disp)->GetUniformfvARB = fn) +#define CALL_GetUniformivARB(disp, parameters) (*((disp)->GetUniformivARB)) parameters +#define GET_GetUniformivARB(disp) ((disp)->GetUniformivARB) +#define SET_GetUniformivARB(disp, fn) ((disp)->GetUniformivARB = fn) +#define CALL_LinkProgramARB(disp, parameters) (*((disp)->LinkProgramARB)) parameters +#define GET_LinkProgramARB(disp) ((disp)->LinkProgramARB) +#define SET_LinkProgramARB(disp, fn) ((disp)->LinkProgramARB = fn) +#define CALL_ShaderSourceARB(disp, parameters) (*((disp)->ShaderSourceARB)) parameters +#define GET_ShaderSourceARB(disp) ((disp)->ShaderSourceARB) +#define SET_ShaderSourceARB(disp, fn) ((disp)->ShaderSourceARB = fn) +#define CALL_Uniform1fARB(disp, parameters) (*((disp)->Uniform1fARB)) parameters +#define GET_Uniform1fARB(disp) ((disp)->Uniform1fARB) +#define SET_Uniform1fARB(disp, fn) ((disp)->Uniform1fARB = fn) +#define CALL_Uniform1fvARB(disp, parameters) (*((disp)->Uniform1fvARB)) parameters +#define GET_Uniform1fvARB(disp) ((disp)->Uniform1fvARB) +#define SET_Uniform1fvARB(disp, fn) ((disp)->Uniform1fvARB = fn) +#define CALL_Uniform1iARB(disp, parameters) (*((disp)->Uniform1iARB)) parameters +#define GET_Uniform1iARB(disp) ((disp)->Uniform1iARB) +#define SET_Uniform1iARB(disp, fn) ((disp)->Uniform1iARB = fn) +#define CALL_Uniform1ivARB(disp, parameters) (*((disp)->Uniform1ivARB)) parameters +#define GET_Uniform1ivARB(disp) ((disp)->Uniform1ivARB) +#define SET_Uniform1ivARB(disp, fn) ((disp)->Uniform1ivARB = fn) +#define CALL_Uniform2fARB(disp, parameters) (*((disp)->Uniform2fARB)) parameters +#define GET_Uniform2fARB(disp) ((disp)->Uniform2fARB) +#define SET_Uniform2fARB(disp, fn) ((disp)->Uniform2fARB = fn) +#define CALL_Uniform2fvARB(disp, parameters) (*((disp)->Uniform2fvARB)) parameters +#define GET_Uniform2fvARB(disp) ((disp)->Uniform2fvARB) +#define SET_Uniform2fvARB(disp, fn) ((disp)->Uniform2fvARB = fn) +#define CALL_Uniform2iARB(disp, parameters) (*((disp)->Uniform2iARB)) parameters +#define GET_Uniform2iARB(disp) ((disp)->Uniform2iARB) +#define SET_Uniform2iARB(disp, fn) ((disp)->Uniform2iARB = fn) +#define CALL_Uniform2ivARB(disp, parameters) (*((disp)->Uniform2ivARB)) parameters +#define GET_Uniform2ivARB(disp) ((disp)->Uniform2ivARB) +#define SET_Uniform2ivARB(disp, fn) ((disp)->Uniform2ivARB = fn) +#define CALL_Uniform3fARB(disp, parameters) (*((disp)->Uniform3fARB)) parameters +#define GET_Uniform3fARB(disp) ((disp)->Uniform3fARB) +#define SET_Uniform3fARB(disp, fn) ((disp)->Uniform3fARB = fn) +#define CALL_Uniform3fvARB(disp, parameters) (*((disp)->Uniform3fvARB)) parameters +#define GET_Uniform3fvARB(disp) ((disp)->Uniform3fvARB) +#define SET_Uniform3fvARB(disp, fn) ((disp)->Uniform3fvARB = fn) +#define CALL_Uniform3iARB(disp, parameters) (*((disp)->Uniform3iARB)) parameters +#define GET_Uniform3iARB(disp) ((disp)->Uniform3iARB) +#define SET_Uniform3iARB(disp, fn) ((disp)->Uniform3iARB = fn) +#define CALL_Uniform3ivARB(disp, parameters) (*((disp)->Uniform3ivARB)) parameters +#define GET_Uniform3ivARB(disp) ((disp)->Uniform3ivARB) +#define SET_Uniform3ivARB(disp, fn) ((disp)->Uniform3ivARB = fn) +#define CALL_Uniform4fARB(disp, parameters) (*((disp)->Uniform4fARB)) parameters +#define GET_Uniform4fARB(disp) ((disp)->Uniform4fARB) +#define SET_Uniform4fARB(disp, fn) ((disp)->Uniform4fARB = fn) +#define CALL_Uniform4fvARB(disp, parameters) (*((disp)->Uniform4fvARB)) parameters +#define GET_Uniform4fvARB(disp) ((disp)->Uniform4fvARB) +#define SET_Uniform4fvARB(disp, fn) ((disp)->Uniform4fvARB = fn) +#define CALL_Uniform4iARB(disp, parameters) (*((disp)->Uniform4iARB)) parameters +#define GET_Uniform4iARB(disp) ((disp)->Uniform4iARB) +#define SET_Uniform4iARB(disp, fn) ((disp)->Uniform4iARB = fn) +#define CALL_Uniform4ivARB(disp, parameters) (*((disp)->Uniform4ivARB)) parameters +#define GET_Uniform4ivARB(disp) ((disp)->Uniform4ivARB) +#define SET_Uniform4ivARB(disp, fn) ((disp)->Uniform4ivARB = fn) +#define CALL_UniformMatrix2fvARB(disp, parameters) (*((disp)->UniformMatrix2fvARB)) parameters +#define GET_UniformMatrix2fvARB(disp) ((disp)->UniformMatrix2fvARB) +#define SET_UniformMatrix2fvARB(disp, fn) ((disp)->UniformMatrix2fvARB = fn) +#define CALL_UniformMatrix3fvARB(disp, parameters) (*((disp)->UniformMatrix3fvARB)) parameters +#define GET_UniformMatrix3fvARB(disp) ((disp)->UniformMatrix3fvARB) +#define SET_UniformMatrix3fvARB(disp, fn) ((disp)->UniformMatrix3fvARB = fn) +#define CALL_UniformMatrix4fvARB(disp, parameters) (*((disp)->UniformMatrix4fvARB)) parameters +#define GET_UniformMatrix4fvARB(disp) ((disp)->UniformMatrix4fvARB) +#define SET_UniformMatrix4fvARB(disp, fn) ((disp)->UniformMatrix4fvARB = fn) +#define CALL_UseProgramObjectARB(disp, parameters) (*((disp)->UseProgramObjectARB)) parameters +#define GET_UseProgramObjectARB(disp) ((disp)->UseProgramObjectARB) +#define SET_UseProgramObjectARB(disp, fn) ((disp)->UseProgramObjectARB = fn) +#define CALL_ValidateProgramARB(disp, parameters) (*((disp)->ValidateProgramARB)) parameters +#define GET_ValidateProgramARB(disp) ((disp)->ValidateProgramARB) +#define SET_ValidateProgramARB(disp, fn) ((disp)->ValidateProgramARB = fn) +#define CALL_BindAttribLocationARB(disp, parameters) (*((disp)->BindAttribLocationARB)) parameters +#define GET_BindAttribLocationARB(disp) ((disp)->BindAttribLocationARB) +#define SET_BindAttribLocationARB(disp, fn) ((disp)->BindAttribLocationARB = fn) +#define CALL_GetActiveAttribARB(disp, parameters) (*((disp)->GetActiveAttribARB)) parameters +#define GET_GetActiveAttribARB(disp) ((disp)->GetActiveAttribARB) +#define SET_GetActiveAttribARB(disp, fn) ((disp)->GetActiveAttribARB = fn) +#define CALL_GetAttribLocationARB(disp, parameters) (*((disp)->GetAttribLocationARB)) parameters +#define GET_GetAttribLocationARB(disp) ((disp)->GetAttribLocationARB) +#define SET_GetAttribLocationARB(disp, fn) ((disp)->GetAttribLocationARB = fn) +#define CALL_DrawBuffersARB(disp, parameters) (*((disp)->DrawBuffersARB)) parameters +#define GET_DrawBuffersARB(disp) ((disp)->DrawBuffersARB) +#define SET_DrawBuffersARB(disp, fn) ((disp)->DrawBuffersARB = fn) +#define CALL_RenderbufferStorageMultisample(disp, parameters) (*((disp)->RenderbufferStorageMultisample)) parameters +#define GET_RenderbufferStorageMultisample(disp) ((disp)->RenderbufferStorageMultisample) +#define SET_RenderbufferStorageMultisample(disp, fn) ((disp)->RenderbufferStorageMultisample = fn) +#define CALL_FlushMappedBufferRange(disp, parameters) (*((disp)->FlushMappedBufferRange)) parameters +#define GET_FlushMappedBufferRange(disp) ((disp)->FlushMappedBufferRange) +#define SET_FlushMappedBufferRange(disp, fn) ((disp)->FlushMappedBufferRange = fn) +#define CALL_MapBufferRange(disp, parameters) (*((disp)->MapBufferRange)) parameters +#define GET_MapBufferRange(disp) ((disp)->MapBufferRange) +#define SET_MapBufferRange(disp, fn) ((disp)->MapBufferRange = fn) +#define CALL_BindVertexArray(disp, parameters) (*((disp)->BindVertexArray)) parameters +#define GET_BindVertexArray(disp) ((disp)->BindVertexArray) +#define SET_BindVertexArray(disp, fn) ((disp)->BindVertexArray = fn) +#define CALL_GenVertexArrays(disp, parameters) (*((disp)->GenVertexArrays)) parameters +#define GET_GenVertexArrays(disp) ((disp)->GenVertexArrays) +#define SET_GenVertexArrays(disp, fn) ((disp)->GenVertexArrays = fn) +#define CALL_CopyBufferSubData(disp, parameters) (*((disp)->CopyBufferSubData)) parameters +#define GET_CopyBufferSubData(disp) ((disp)->CopyBufferSubData) +#define SET_CopyBufferSubData(disp, fn) ((disp)->CopyBufferSubData = fn) +#define CALL_ClientWaitSync(disp, parameters) (*((disp)->ClientWaitSync)) parameters +#define GET_ClientWaitSync(disp) ((disp)->ClientWaitSync) +#define SET_ClientWaitSync(disp, fn) ((disp)->ClientWaitSync = fn) +#define CALL_DeleteSync(disp, parameters) (*((disp)->DeleteSync)) parameters +#define GET_DeleteSync(disp) ((disp)->DeleteSync) +#define SET_DeleteSync(disp, fn) ((disp)->DeleteSync = fn) +#define CALL_FenceSync(disp, parameters) (*((disp)->FenceSync)) parameters +#define GET_FenceSync(disp) ((disp)->FenceSync) +#define SET_FenceSync(disp, fn) ((disp)->FenceSync = fn) +#define CALL_GetInteger64v(disp, parameters) (*((disp)->GetInteger64v)) parameters +#define GET_GetInteger64v(disp) ((disp)->GetInteger64v) +#define SET_GetInteger64v(disp, fn) ((disp)->GetInteger64v = fn) +#define CALL_GetSynciv(disp, parameters) (*((disp)->GetSynciv)) parameters +#define GET_GetSynciv(disp) ((disp)->GetSynciv) +#define SET_GetSynciv(disp, fn) ((disp)->GetSynciv = fn) +#define CALL_IsSync(disp, parameters) (*((disp)->IsSync)) parameters +#define GET_IsSync(disp) ((disp)->IsSync) +#define SET_IsSync(disp, fn) ((disp)->IsSync = fn) +#define CALL_WaitSync(disp, parameters) (*((disp)->WaitSync)) parameters +#define GET_WaitSync(disp) ((disp)->WaitSync) +#define SET_WaitSync(disp, fn) ((disp)->WaitSync = fn) +#define CALL_DrawElementsBaseVertex(disp, parameters) (*((disp)->DrawElementsBaseVertex)) parameters +#define GET_DrawElementsBaseVertex(disp) ((disp)->DrawElementsBaseVertex) +#define SET_DrawElementsBaseVertex(disp, fn) ((disp)->DrawElementsBaseVertex = fn) +#define CALL_DrawRangeElementsBaseVertex(disp, parameters) (*((disp)->DrawRangeElementsBaseVertex)) parameters +#define GET_DrawRangeElementsBaseVertex(disp) ((disp)->DrawRangeElementsBaseVertex) +#define SET_DrawRangeElementsBaseVertex(disp, fn) ((disp)->DrawRangeElementsBaseVertex = fn) +#define CALL_MultiDrawElementsBaseVertex(disp, parameters) (*((disp)->MultiDrawElementsBaseVertex)) parameters +#define GET_MultiDrawElementsBaseVertex(disp) ((disp)->MultiDrawElementsBaseVertex) +#define SET_MultiDrawElementsBaseVertex(disp, fn) ((disp)->MultiDrawElementsBaseVertex = fn) +#define CALL_PolygonOffsetEXT(disp, parameters) (*((disp)->PolygonOffsetEXT)) parameters +#define GET_PolygonOffsetEXT(disp) ((disp)->PolygonOffsetEXT) +#define SET_PolygonOffsetEXT(disp, fn) ((disp)->PolygonOffsetEXT = fn) +#define CALL_GetPixelTexGenParameterfvSGIS(disp, parameters) (*((disp)->GetPixelTexGenParameterfvSGIS)) parameters +#define GET_GetPixelTexGenParameterfvSGIS(disp) ((disp)->GetPixelTexGenParameterfvSGIS) +#define SET_GetPixelTexGenParameterfvSGIS(disp, fn) ((disp)->GetPixelTexGenParameterfvSGIS = fn) +#define CALL_GetPixelTexGenParameterivSGIS(disp, parameters) (*((disp)->GetPixelTexGenParameterivSGIS)) parameters +#define GET_GetPixelTexGenParameterivSGIS(disp) ((disp)->GetPixelTexGenParameterivSGIS) +#define SET_GetPixelTexGenParameterivSGIS(disp, fn) ((disp)->GetPixelTexGenParameterivSGIS = fn) +#define CALL_PixelTexGenParameterfSGIS(disp, parameters) (*((disp)->PixelTexGenParameterfSGIS)) parameters +#define GET_PixelTexGenParameterfSGIS(disp) ((disp)->PixelTexGenParameterfSGIS) +#define SET_PixelTexGenParameterfSGIS(disp, fn) ((disp)->PixelTexGenParameterfSGIS = fn) +#define CALL_PixelTexGenParameterfvSGIS(disp, parameters) (*((disp)->PixelTexGenParameterfvSGIS)) parameters +#define GET_PixelTexGenParameterfvSGIS(disp) ((disp)->PixelTexGenParameterfvSGIS) +#define SET_PixelTexGenParameterfvSGIS(disp, fn) ((disp)->PixelTexGenParameterfvSGIS = fn) +#define CALL_PixelTexGenParameteriSGIS(disp, parameters) (*((disp)->PixelTexGenParameteriSGIS)) parameters +#define GET_PixelTexGenParameteriSGIS(disp) ((disp)->PixelTexGenParameteriSGIS) +#define SET_PixelTexGenParameteriSGIS(disp, fn) ((disp)->PixelTexGenParameteriSGIS = fn) +#define CALL_PixelTexGenParameterivSGIS(disp, parameters) (*((disp)->PixelTexGenParameterivSGIS)) parameters +#define GET_PixelTexGenParameterivSGIS(disp) ((disp)->PixelTexGenParameterivSGIS) +#define SET_PixelTexGenParameterivSGIS(disp, fn) ((disp)->PixelTexGenParameterivSGIS = fn) +#define CALL_SampleMaskSGIS(disp, parameters) (*((disp)->SampleMaskSGIS)) parameters +#define GET_SampleMaskSGIS(disp) ((disp)->SampleMaskSGIS) +#define SET_SampleMaskSGIS(disp, fn) ((disp)->SampleMaskSGIS = fn) +#define CALL_SamplePatternSGIS(disp, parameters) (*((disp)->SamplePatternSGIS)) parameters +#define GET_SamplePatternSGIS(disp) ((disp)->SamplePatternSGIS) +#define SET_SamplePatternSGIS(disp, fn) ((disp)->SamplePatternSGIS = fn) +#define CALL_ColorPointerEXT(disp, parameters) (*((disp)->ColorPointerEXT)) parameters +#define GET_ColorPointerEXT(disp) ((disp)->ColorPointerEXT) +#define SET_ColorPointerEXT(disp, fn) ((disp)->ColorPointerEXT = fn) +#define CALL_EdgeFlagPointerEXT(disp, parameters) (*((disp)->EdgeFlagPointerEXT)) parameters +#define GET_EdgeFlagPointerEXT(disp) ((disp)->EdgeFlagPointerEXT) +#define SET_EdgeFlagPointerEXT(disp, fn) ((disp)->EdgeFlagPointerEXT = fn) +#define CALL_IndexPointerEXT(disp, parameters) (*((disp)->IndexPointerEXT)) parameters +#define GET_IndexPointerEXT(disp) ((disp)->IndexPointerEXT) +#define SET_IndexPointerEXT(disp, fn) ((disp)->IndexPointerEXT = fn) +#define CALL_NormalPointerEXT(disp, parameters) (*((disp)->NormalPointerEXT)) parameters +#define GET_NormalPointerEXT(disp) ((disp)->NormalPointerEXT) +#define SET_NormalPointerEXT(disp, fn) ((disp)->NormalPointerEXT = fn) +#define CALL_TexCoordPointerEXT(disp, parameters) (*((disp)->TexCoordPointerEXT)) parameters +#define GET_TexCoordPointerEXT(disp) ((disp)->TexCoordPointerEXT) +#define SET_TexCoordPointerEXT(disp, fn) ((disp)->TexCoordPointerEXT = fn) +#define CALL_VertexPointerEXT(disp, parameters) (*((disp)->VertexPointerEXT)) parameters +#define GET_VertexPointerEXT(disp) ((disp)->VertexPointerEXT) +#define SET_VertexPointerEXT(disp, fn) ((disp)->VertexPointerEXT = fn) +#define CALL_PointParameterfEXT(disp, parameters) (*((disp)->PointParameterfEXT)) parameters +#define GET_PointParameterfEXT(disp) ((disp)->PointParameterfEXT) +#define SET_PointParameterfEXT(disp, fn) ((disp)->PointParameterfEXT = fn) +#define CALL_PointParameterfvEXT(disp, parameters) (*((disp)->PointParameterfvEXT)) parameters +#define GET_PointParameterfvEXT(disp) ((disp)->PointParameterfvEXT) +#define SET_PointParameterfvEXT(disp, fn) ((disp)->PointParameterfvEXT = fn) +#define CALL_LockArraysEXT(disp, parameters) (*((disp)->LockArraysEXT)) parameters +#define GET_LockArraysEXT(disp) ((disp)->LockArraysEXT) +#define SET_LockArraysEXT(disp, fn) ((disp)->LockArraysEXT = fn) +#define CALL_UnlockArraysEXT(disp, parameters) (*((disp)->UnlockArraysEXT)) parameters +#define GET_UnlockArraysEXT(disp) ((disp)->UnlockArraysEXT) +#define SET_UnlockArraysEXT(disp, fn) ((disp)->UnlockArraysEXT = fn) +#define CALL_CullParameterdvEXT(disp, parameters) (*((disp)->CullParameterdvEXT)) parameters +#define GET_CullParameterdvEXT(disp) ((disp)->CullParameterdvEXT) +#define SET_CullParameterdvEXT(disp, fn) ((disp)->CullParameterdvEXT = fn) +#define CALL_CullParameterfvEXT(disp, parameters) (*((disp)->CullParameterfvEXT)) parameters +#define GET_CullParameterfvEXT(disp) ((disp)->CullParameterfvEXT) +#define SET_CullParameterfvEXT(disp, fn) ((disp)->CullParameterfvEXT = fn) +#define CALL_SecondaryColor3bEXT(disp, parameters) (*((disp)->SecondaryColor3bEXT)) parameters +#define GET_SecondaryColor3bEXT(disp) ((disp)->SecondaryColor3bEXT) +#define SET_SecondaryColor3bEXT(disp, fn) ((disp)->SecondaryColor3bEXT = fn) +#define CALL_SecondaryColor3bvEXT(disp, parameters) (*((disp)->SecondaryColor3bvEXT)) parameters +#define GET_SecondaryColor3bvEXT(disp) ((disp)->SecondaryColor3bvEXT) +#define SET_SecondaryColor3bvEXT(disp, fn) ((disp)->SecondaryColor3bvEXT = fn) +#define CALL_SecondaryColor3dEXT(disp, parameters) (*((disp)->SecondaryColor3dEXT)) parameters +#define GET_SecondaryColor3dEXT(disp) ((disp)->SecondaryColor3dEXT) +#define SET_SecondaryColor3dEXT(disp, fn) ((disp)->SecondaryColor3dEXT = fn) +#define CALL_SecondaryColor3dvEXT(disp, parameters) (*((disp)->SecondaryColor3dvEXT)) parameters +#define GET_SecondaryColor3dvEXT(disp) ((disp)->SecondaryColor3dvEXT) +#define SET_SecondaryColor3dvEXT(disp, fn) ((disp)->SecondaryColor3dvEXT = fn) +#define CALL_SecondaryColor3fEXT(disp, parameters) (*((disp)->SecondaryColor3fEXT)) parameters +#define GET_SecondaryColor3fEXT(disp) ((disp)->SecondaryColor3fEXT) +#define SET_SecondaryColor3fEXT(disp, fn) ((disp)->SecondaryColor3fEXT = fn) +#define CALL_SecondaryColor3fvEXT(disp, parameters) (*((disp)->SecondaryColor3fvEXT)) parameters +#define GET_SecondaryColor3fvEXT(disp) ((disp)->SecondaryColor3fvEXT) +#define SET_SecondaryColor3fvEXT(disp, fn) ((disp)->SecondaryColor3fvEXT = fn) +#define CALL_SecondaryColor3iEXT(disp, parameters) (*((disp)->SecondaryColor3iEXT)) parameters +#define GET_SecondaryColor3iEXT(disp) ((disp)->SecondaryColor3iEXT) +#define SET_SecondaryColor3iEXT(disp, fn) ((disp)->SecondaryColor3iEXT = fn) +#define CALL_SecondaryColor3ivEXT(disp, parameters) (*((disp)->SecondaryColor3ivEXT)) parameters +#define GET_SecondaryColor3ivEXT(disp) ((disp)->SecondaryColor3ivEXT) +#define SET_SecondaryColor3ivEXT(disp, fn) ((disp)->SecondaryColor3ivEXT = fn) +#define CALL_SecondaryColor3sEXT(disp, parameters) (*((disp)->SecondaryColor3sEXT)) parameters +#define GET_SecondaryColor3sEXT(disp) ((disp)->SecondaryColor3sEXT) +#define SET_SecondaryColor3sEXT(disp, fn) ((disp)->SecondaryColor3sEXT = fn) +#define CALL_SecondaryColor3svEXT(disp, parameters) (*((disp)->SecondaryColor3svEXT)) parameters +#define GET_SecondaryColor3svEXT(disp) ((disp)->SecondaryColor3svEXT) +#define SET_SecondaryColor3svEXT(disp, fn) ((disp)->SecondaryColor3svEXT = fn) +#define CALL_SecondaryColor3ubEXT(disp, parameters) (*((disp)->SecondaryColor3ubEXT)) parameters +#define GET_SecondaryColor3ubEXT(disp) ((disp)->SecondaryColor3ubEXT) +#define SET_SecondaryColor3ubEXT(disp, fn) ((disp)->SecondaryColor3ubEXT = fn) +#define CALL_SecondaryColor3ubvEXT(disp, parameters) (*((disp)->SecondaryColor3ubvEXT)) parameters +#define GET_SecondaryColor3ubvEXT(disp) ((disp)->SecondaryColor3ubvEXT) +#define SET_SecondaryColor3ubvEXT(disp, fn) ((disp)->SecondaryColor3ubvEXT = fn) +#define CALL_SecondaryColor3uiEXT(disp, parameters) (*((disp)->SecondaryColor3uiEXT)) parameters +#define GET_SecondaryColor3uiEXT(disp) ((disp)->SecondaryColor3uiEXT) +#define SET_SecondaryColor3uiEXT(disp, fn) ((disp)->SecondaryColor3uiEXT = fn) +#define CALL_SecondaryColor3uivEXT(disp, parameters) (*((disp)->SecondaryColor3uivEXT)) parameters +#define GET_SecondaryColor3uivEXT(disp) ((disp)->SecondaryColor3uivEXT) +#define SET_SecondaryColor3uivEXT(disp, fn) ((disp)->SecondaryColor3uivEXT = fn) +#define CALL_SecondaryColor3usEXT(disp, parameters) (*((disp)->SecondaryColor3usEXT)) parameters +#define GET_SecondaryColor3usEXT(disp) ((disp)->SecondaryColor3usEXT) +#define SET_SecondaryColor3usEXT(disp, fn) ((disp)->SecondaryColor3usEXT = fn) +#define CALL_SecondaryColor3usvEXT(disp, parameters) (*((disp)->SecondaryColor3usvEXT)) parameters +#define GET_SecondaryColor3usvEXT(disp) ((disp)->SecondaryColor3usvEXT) +#define SET_SecondaryColor3usvEXT(disp, fn) ((disp)->SecondaryColor3usvEXT = fn) +#define CALL_SecondaryColorPointerEXT(disp, parameters) (*((disp)->SecondaryColorPointerEXT)) parameters +#define GET_SecondaryColorPointerEXT(disp) ((disp)->SecondaryColorPointerEXT) +#define SET_SecondaryColorPointerEXT(disp, fn) ((disp)->SecondaryColorPointerEXT = fn) +#define CALL_MultiDrawArraysEXT(disp, parameters) (*((disp)->MultiDrawArraysEXT)) parameters +#define GET_MultiDrawArraysEXT(disp) ((disp)->MultiDrawArraysEXT) +#define SET_MultiDrawArraysEXT(disp, fn) ((disp)->MultiDrawArraysEXT = fn) +#define CALL_MultiDrawElementsEXT(disp, parameters) (*((disp)->MultiDrawElementsEXT)) parameters +#define GET_MultiDrawElementsEXT(disp) ((disp)->MultiDrawElementsEXT) +#define SET_MultiDrawElementsEXT(disp, fn) ((disp)->MultiDrawElementsEXT = fn) +#define CALL_FogCoordPointerEXT(disp, parameters) (*((disp)->FogCoordPointerEXT)) parameters +#define GET_FogCoordPointerEXT(disp) ((disp)->FogCoordPointerEXT) +#define SET_FogCoordPointerEXT(disp, fn) ((disp)->FogCoordPointerEXT = fn) +#define CALL_FogCoorddEXT(disp, parameters) (*((disp)->FogCoorddEXT)) parameters +#define GET_FogCoorddEXT(disp) ((disp)->FogCoorddEXT) +#define SET_FogCoorddEXT(disp, fn) ((disp)->FogCoorddEXT = fn) +#define CALL_FogCoorddvEXT(disp, parameters) (*((disp)->FogCoorddvEXT)) parameters +#define GET_FogCoorddvEXT(disp) ((disp)->FogCoorddvEXT) +#define SET_FogCoorddvEXT(disp, fn) ((disp)->FogCoorddvEXT = fn) +#define CALL_FogCoordfEXT(disp, parameters) (*((disp)->FogCoordfEXT)) parameters +#define GET_FogCoordfEXT(disp) ((disp)->FogCoordfEXT) +#define SET_FogCoordfEXT(disp, fn) ((disp)->FogCoordfEXT = fn) +#define CALL_FogCoordfvEXT(disp, parameters) (*((disp)->FogCoordfvEXT)) parameters +#define GET_FogCoordfvEXT(disp) ((disp)->FogCoordfvEXT) +#define SET_FogCoordfvEXT(disp, fn) ((disp)->FogCoordfvEXT = fn) +#define CALL_PixelTexGenSGIX(disp, parameters) (*((disp)->PixelTexGenSGIX)) parameters +#define GET_PixelTexGenSGIX(disp) ((disp)->PixelTexGenSGIX) +#define SET_PixelTexGenSGIX(disp, fn) ((disp)->PixelTexGenSGIX = fn) +#define CALL_BlendFuncSeparateEXT(disp, parameters) (*((disp)->BlendFuncSeparateEXT)) parameters +#define GET_BlendFuncSeparateEXT(disp) ((disp)->BlendFuncSeparateEXT) +#define SET_BlendFuncSeparateEXT(disp, fn) ((disp)->BlendFuncSeparateEXT = fn) +#define CALL_FlushVertexArrayRangeNV(disp, parameters) (*((disp)->FlushVertexArrayRangeNV)) parameters +#define GET_FlushVertexArrayRangeNV(disp) ((disp)->FlushVertexArrayRangeNV) +#define SET_FlushVertexArrayRangeNV(disp, fn) ((disp)->FlushVertexArrayRangeNV = fn) +#define CALL_VertexArrayRangeNV(disp, parameters) (*((disp)->VertexArrayRangeNV)) parameters +#define GET_VertexArrayRangeNV(disp) ((disp)->VertexArrayRangeNV) +#define SET_VertexArrayRangeNV(disp, fn) ((disp)->VertexArrayRangeNV = fn) +#define CALL_CombinerInputNV(disp, parameters) (*((disp)->CombinerInputNV)) parameters +#define GET_CombinerInputNV(disp) ((disp)->CombinerInputNV) +#define SET_CombinerInputNV(disp, fn) ((disp)->CombinerInputNV = fn) +#define CALL_CombinerOutputNV(disp, parameters) (*((disp)->CombinerOutputNV)) parameters +#define GET_CombinerOutputNV(disp) ((disp)->CombinerOutputNV) +#define SET_CombinerOutputNV(disp, fn) ((disp)->CombinerOutputNV = fn) +#define CALL_CombinerParameterfNV(disp, parameters) (*((disp)->CombinerParameterfNV)) parameters +#define GET_CombinerParameterfNV(disp) ((disp)->CombinerParameterfNV) +#define SET_CombinerParameterfNV(disp, fn) ((disp)->CombinerParameterfNV = fn) +#define CALL_CombinerParameterfvNV(disp, parameters) (*((disp)->CombinerParameterfvNV)) parameters +#define GET_CombinerParameterfvNV(disp) ((disp)->CombinerParameterfvNV) +#define SET_CombinerParameterfvNV(disp, fn) ((disp)->CombinerParameterfvNV = fn) +#define CALL_CombinerParameteriNV(disp, parameters) (*((disp)->CombinerParameteriNV)) parameters +#define GET_CombinerParameteriNV(disp) ((disp)->CombinerParameteriNV) +#define SET_CombinerParameteriNV(disp, fn) ((disp)->CombinerParameteriNV = fn) +#define CALL_CombinerParameterivNV(disp, parameters) (*((disp)->CombinerParameterivNV)) parameters +#define GET_CombinerParameterivNV(disp) ((disp)->CombinerParameterivNV) +#define SET_CombinerParameterivNV(disp, fn) ((disp)->CombinerParameterivNV = fn) +#define CALL_FinalCombinerInputNV(disp, parameters) (*((disp)->FinalCombinerInputNV)) parameters +#define GET_FinalCombinerInputNV(disp) ((disp)->FinalCombinerInputNV) +#define SET_FinalCombinerInputNV(disp, fn) ((disp)->FinalCombinerInputNV = fn) +#define CALL_GetCombinerInputParameterfvNV(disp, parameters) (*((disp)->GetCombinerInputParameterfvNV)) parameters +#define GET_GetCombinerInputParameterfvNV(disp) ((disp)->GetCombinerInputParameterfvNV) +#define SET_GetCombinerInputParameterfvNV(disp, fn) ((disp)->GetCombinerInputParameterfvNV = fn) +#define CALL_GetCombinerInputParameterivNV(disp, parameters) (*((disp)->GetCombinerInputParameterivNV)) parameters +#define GET_GetCombinerInputParameterivNV(disp) ((disp)->GetCombinerInputParameterivNV) +#define SET_GetCombinerInputParameterivNV(disp, fn) ((disp)->GetCombinerInputParameterivNV = fn) +#define CALL_GetCombinerOutputParameterfvNV(disp, parameters) (*((disp)->GetCombinerOutputParameterfvNV)) parameters +#define GET_GetCombinerOutputParameterfvNV(disp) ((disp)->GetCombinerOutputParameterfvNV) +#define SET_GetCombinerOutputParameterfvNV(disp, fn) ((disp)->GetCombinerOutputParameterfvNV = fn) +#define CALL_GetCombinerOutputParameterivNV(disp, parameters) (*((disp)->GetCombinerOutputParameterivNV)) parameters +#define GET_GetCombinerOutputParameterivNV(disp) ((disp)->GetCombinerOutputParameterivNV) +#define SET_GetCombinerOutputParameterivNV(disp, fn) ((disp)->GetCombinerOutputParameterivNV = fn) +#define CALL_GetFinalCombinerInputParameterfvNV(disp, parameters) (*((disp)->GetFinalCombinerInputParameterfvNV)) parameters +#define GET_GetFinalCombinerInputParameterfvNV(disp) ((disp)->GetFinalCombinerInputParameterfvNV) +#define SET_GetFinalCombinerInputParameterfvNV(disp, fn) ((disp)->GetFinalCombinerInputParameterfvNV = fn) +#define CALL_GetFinalCombinerInputParameterivNV(disp, parameters) (*((disp)->GetFinalCombinerInputParameterivNV)) parameters +#define GET_GetFinalCombinerInputParameterivNV(disp) ((disp)->GetFinalCombinerInputParameterivNV) +#define SET_GetFinalCombinerInputParameterivNV(disp, fn) ((disp)->GetFinalCombinerInputParameterivNV = fn) +#define CALL_ResizeBuffersMESA(disp, parameters) (*((disp)->ResizeBuffersMESA)) parameters +#define GET_ResizeBuffersMESA(disp) ((disp)->ResizeBuffersMESA) +#define SET_ResizeBuffersMESA(disp, fn) ((disp)->ResizeBuffersMESA = fn) +#define CALL_WindowPos2dMESA(disp, parameters) (*((disp)->WindowPos2dMESA)) parameters +#define GET_WindowPos2dMESA(disp) ((disp)->WindowPos2dMESA) +#define SET_WindowPos2dMESA(disp, fn) ((disp)->WindowPos2dMESA = fn) +#define CALL_WindowPos2dvMESA(disp, parameters) (*((disp)->WindowPos2dvMESA)) parameters +#define GET_WindowPos2dvMESA(disp) ((disp)->WindowPos2dvMESA) +#define SET_WindowPos2dvMESA(disp, fn) ((disp)->WindowPos2dvMESA = fn) +#define CALL_WindowPos2fMESA(disp, parameters) (*((disp)->WindowPos2fMESA)) parameters +#define GET_WindowPos2fMESA(disp) ((disp)->WindowPos2fMESA) +#define SET_WindowPos2fMESA(disp, fn) ((disp)->WindowPos2fMESA = fn) +#define CALL_WindowPos2fvMESA(disp, parameters) (*((disp)->WindowPos2fvMESA)) parameters +#define GET_WindowPos2fvMESA(disp) ((disp)->WindowPos2fvMESA) +#define SET_WindowPos2fvMESA(disp, fn) ((disp)->WindowPos2fvMESA = fn) +#define CALL_WindowPos2iMESA(disp, parameters) (*((disp)->WindowPos2iMESA)) parameters +#define GET_WindowPos2iMESA(disp) ((disp)->WindowPos2iMESA) +#define SET_WindowPos2iMESA(disp, fn) ((disp)->WindowPos2iMESA = fn) +#define CALL_WindowPos2ivMESA(disp, parameters) (*((disp)->WindowPos2ivMESA)) parameters +#define GET_WindowPos2ivMESA(disp) ((disp)->WindowPos2ivMESA) +#define SET_WindowPos2ivMESA(disp, fn) ((disp)->WindowPos2ivMESA = fn) +#define CALL_WindowPos2sMESA(disp, parameters) (*((disp)->WindowPos2sMESA)) parameters +#define GET_WindowPos2sMESA(disp) ((disp)->WindowPos2sMESA) +#define SET_WindowPos2sMESA(disp, fn) ((disp)->WindowPos2sMESA = fn) +#define CALL_WindowPos2svMESA(disp, parameters) (*((disp)->WindowPos2svMESA)) parameters +#define GET_WindowPos2svMESA(disp) ((disp)->WindowPos2svMESA) +#define SET_WindowPos2svMESA(disp, fn) ((disp)->WindowPos2svMESA = fn) +#define CALL_WindowPos3dMESA(disp, parameters) (*((disp)->WindowPos3dMESA)) parameters +#define GET_WindowPos3dMESA(disp) ((disp)->WindowPos3dMESA) +#define SET_WindowPos3dMESA(disp, fn) ((disp)->WindowPos3dMESA = fn) +#define CALL_WindowPos3dvMESA(disp, parameters) (*((disp)->WindowPos3dvMESA)) parameters +#define GET_WindowPos3dvMESA(disp) ((disp)->WindowPos3dvMESA) +#define SET_WindowPos3dvMESA(disp, fn) ((disp)->WindowPos3dvMESA = fn) +#define CALL_WindowPos3fMESA(disp, parameters) (*((disp)->WindowPos3fMESA)) parameters +#define GET_WindowPos3fMESA(disp) ((disp)->WindowPos3fMESA) +#define SET_WindowPos3fMESA(disp, fn) ((disp)->WindowPos3fMESA = fn) +#define CALL_WindowPos3fvMESA(disp, parameters) (*((disp)->WindowPos3fvMESA)) parameters +#define GET_WindowPos3fvMESA(disp) ((disp)->WindowPos3fvMESA) +#define SET_WindowPos3fvMESA(disp, fn) ((disp)->WindowPos3fvMESA = fn) +#define CALL_WindowPos3iMESA(disp, parameters) (*((disp)->WindowPos3iMESA)) parameters +#define GET_WindowPos3iMESA(disp) ((disp)->WindowPos3iMESA) +#define SET_WindowPos3iMESA(disp, fn) ((disp)->WindowPos3iMESA = fn) +#define CALL_WindowPos3ivMESA(disp, parameters) (*((disp)->WindowPos3ivMESA)) parameters +#define GET_WindowPos3ivMESA(disp) ((disp)->WindowPos3ivMESA) +#define SET_WindowPos3ivMESA(disp, fn) ((disp)->WindowPos3ivMESA = fn) +#define CALL_WindowPos3sMESA(disp, parameters) (*((disp)->WindowPos3sMESA)) parameters +#define GET_WindowPos3sMESA(disp) ((disp)->WindowPos3sMESA) +#define SET_WindowPos3sMESA(disp, fn) ((disp)->WindowPos3sMESA = fn) +#define CALL_WindowPos3svMESA(disp, parameters) (*((disp)->WindowPos3svMESA)) parameters +#define GET_WindowPos3svMESA(disp) ((disp)->WindowPos3svMESA) +#define SET_WindowPos3svMESA(disp, fn) ((disp)->WindowPos3svMESA = fn) +#define CALL_WindowPos4dMESA(disp, parameters) (*((disp)->WindowPos4dMESA)) parameters +#define GET_WindowPos4dMESA(disp) ((disp)->WindowPos4dMESA) +#define SET_WindowPos4dMESA(disp, fn) ((disp)->WindowPos4dMESA = fn) +#define CALL_WindowPos4dvMESA(disp, parameters) (*((disp)->WindowPos4dvMESA)) parameters +#define GET_WindowPos4dvMESA(disp) ((disp)->WindowPos4dvMESA) +#define SET_WindowPos4dvMESA(disp, fn) ((disp)->WindowPos4dvMESA = fn) +#define CALL_WindowPos4fMESA(disp, parameters) (*((disp)->WindowPos4fMESA)) parameters +#define GET_WindowPos4fMESA(disp) ((disp)->WindowPos4fMESA) +#define SET_WindowPos4fMESA(disp, fn) ((disp)->WindowPos4fMESA = fn) +#define CALL_WindowPos4fvMESA(disp, parameters) (*((disp)->WindowPos4fvMESA)) parameters +#define GET_WindowPos4fvMESA(disp) ((disp)->WindowPos4fvMESA) +#define SET_WindowPos4fvMESA(disp, fn) ((disp)->WindowPos4fvMESA = fn) +#define CALL_WindowPos4iMESA(disp, parameters) (*((disp)->WindowPos4iMESA)) parameters +#define GET_WindowPos4iMESA(disp) ((disp)->WindowPos4iMESA) +#define SET_WindowPos4iMESA(disp, fn) ((disp)->WindowPos4iMESA = fn) +#define CALL_WindowPos4ivMESA(disp, parameters) (*((disp)->WindowPos4ivMESA)) parameters +#define GET_WindowPos4ivMESA(disp) ((disp)->WindowPos4ivMESA) +#define SET_WindowPos4ivMESA(disp, fn) ((disp)->WindowPos4ivMESA = fn) +#define CALL_WindowPos4sMESA(disp, parameters) (*((disp)->WindowPos4sMESA)) parameters +#define GET_WindowPos4sMESA(disp) ((disp)->WindowPos4sMESA) +#define SET_WindowPos4sMESA(disp, fn) ((disp)->WindowPos4sMESA = fn) +#define CALL_WindowPos4svMESA(disp, parameters) (*((disp)->WindowPos4svMESA)) parameters +#define GET_WindowPos4svMESA(disp) ((disp)->WindowPos4svMESA) +#define SET_WindowPos4svMESA(disp, fn) ((disp)->WindowPos4svMESA = fn) +#define CALL_MultiModeDrawArraysIBM(disp, parameters) (*((disp)->MultiModeDrawArraysIBM)) parameters +#define GET_MultiModeDrawArraysIBM(disp) ((disp)->MultiModeDrawArraysIBM) +#define SET_MultiModeDrawArraysIBM(disp, fn) ((disp)->MultiModeDrawArraysIBM = fn) +#define CALL_MultiModeDrawElementsIBM(disp, parameters) (*((disp)->MultiModeDrawElementsIBM)) parameters +#define GET_MultiModeDrawElementsIBM(disp) ((disp)->MultiModeDrawElementsIBM) +#define SET_MultiModeDrawElementsIBM(disp, fn) ((disp)->MultiModeDrawElementsIBM = fn) +#define CALL_DeleteFencesNV(disp, parameters) (*((disp)->DeleteFencesNV)) parameters +#define GET_DeleteFencesNV(disp) ((disp)->DeleteFencesNV) +#define SET_DeleteFencesNV(disp, fn) ((disp)->DeleteFencesNV = fn) +#define CALL_FinishFenceNV(disp, parameters) (*((disp)->FinishFenceNV)) parameters +#define GET_FinishFenceNV(disp) ((disp)->FinishFenceNV) +#define SET_FinishFenceNV(disp, fn) ((disp)->FinishFenceNV = fn) +#define CALL_GenFencesNV(disp, parameters) (*((disp)->GenFencesNV)) parameters +#define GET_GenFencesNV(disp) ((disp)->GenFencesNV) +#define SET_GenFencesNV(disp, fn) ((disp)->GenFencesNV = fn) +#define CALL_GetFenceivNV(disp, parameters) (*((disp)->GetFenceivNV)) parameters +#define GET_GetFenceivNV(disp) ((disp)->GetFenceivNV) +#define SET_GetFenceivNV(disp, fn) ((disp)->GetFenceivNV = fn) +#define CALL_IsFenceNV(disp, parameters) (*((disp)->IsFenceNV)) parameters +#define GET_IsFenceNV(disp) ((disp)->IsFenceNV) +#define SET_IsFenceNV(disp, fn) ((disp)->IsFenceNV = fn) +#define CALL_SetFenceNV(disp, parameters) (*((disp)->SetFenceNV)) parameters +#define GET_SetFenceNV(disp) ((disp)->SetFenceNV) +#define SET_SetFenceNV(disp, fn) ((disp)->SetFenceNV = fn) +#define CALL_TestFenceNV(disp, parameters) (*((disp)->TestFenceNV)) parameters +#define GET_TestFenceNV(disp) ((disp)->TestFenceNV) +#define SET_TestFenceNV(disp, fn) ((disp)->TestFenceNV = fn) +#define CALL_AreProgramsResidentNV(disp, parameters) (*((disp)->AreProgramsResidentNV)) parameters +#define GET_AreProgramsResidentNV(disp) ((disp)->AreProgramsResidentNV) +#define SET_AreProgramsResidentNV(disp, fn) ((disp)->AreProgramsResidentNV = fn) +#define CALL_BindProgramNV(disp, parameters) (*((disp)->BindProgramNV)) parameters +#define GET_BindProgramNV(disp) ((disp)->BindProgramNV) +#define SET_BindProgramNV(disp, fn) ((disp)->BindProgramNV = fn) +#define CALL_DeleteProgramsNV(disp, parameters) (*((disp)->DeleteProgramsNV)) parameters +#define GET_DeleteProgramsNV(disp) ((disp)->DeleteProgramsNV) +#define SET_DeleteProgramsNV(disp, fn) ((disp)->DeleteProgramsNV = fn) +#define CALL_ExecuteProgramNV(disp, parameters) (*((disp)->ExecuteProgramNV)) parameters +#define GET_ExecuteProgramNV(disp) ((disp)->ExecuteProgramNV) +#define SET_ExecuteProgramNV(disp, fn) ((disp)->ExecuteProgramNV = fn) +#define CALL_GenProgramsNV(disp, parameters) (*((disp)->GenProgramsNV)) parameters +#define GET_GenProgramsNV(disp) ((disp)->GenProgramsNV) +#define SET_GenProgramsNV(disp, fn) ((disp)->GenProgramsNV = fn) +#define CALL_GetProgramParameterdvNV(disp, parameters) (*((disp)->GetProgramParameterdvNV)) parameters +#define GET_GetProgramParameterdvNV(disp) ((disp)->GetProgramParameterdvNV) +#define SET_GetProgramParameterdvNV(disp, fn) ((disp)->GetProgramParameterdvNV = fn) +#define CALL_GetProgramParameterfvNV(disp, parameters) (*((disp)->GetProgramParameterfvNV)) parameters +#define GET_GetProgramParameterfvNV(disp) ((disp)->GetProgramParameterfvNV) +#define SET_GetProgramParameterfvNV(disp, fn) ((disp)->GetProgramParameterfvNV = fn) +#define CALL_GetProgramStringNV(disp, parameters) (*((disp)->GetProgramStringNV)) parameters +#define GET_GetProgramStringNV(disp) ((disp)->GetProgramStringNV) +#define SET_GetProgramStringNV(disp, fn) ((disp)->GetProgramStringNV = fn) +#define CALL_GetProgramivNV(disp, parameters) (*((disp)->GetProgramivNV)) parameters +#define GET_GetProgramivNV(disp) ((disp)->GetProgramivNV) +#define SET_GetProgramivNV(disp, fn) ((disp)->GetProgramivNV = fn) +#define CALL_GetTrackMatrixivNV(disp, parameters) (*((disp)->GetTrackMatrixivNV)) parameters +#define GET_GetTrackMatrixivNV(disp) ((disp)->GetTrackMatrixivNV) +#define SET_GetTrackMatrixivNV(disp, fn) ((disp)->GetTrackMatrixivNV = fn) +#define CALL_GetVertexAttribPointervNV(disp, parameters) (*((disp)->GetVertexAttribPointervNV)) parameters +#define GET_GetVertexAttribPointervNV(disp) ((disp)->GetVertexAttribPointervNV) +#define SET_GetVertexAttribPointervNV(disp, fn) ((disp)->GetVertexAttribPointervNV = fn) +#define CALL_GetVertexAttribdvNV(disp, parameters) (*((disp)->GetVertexAttribdvNV)) parameters +#define GET_GetVertexAttribdvNV(disp) ((disp)->GetVertexAttribdvNV) +#define SET_GetVertexAttribdvNV(disp, fn) ((disp)->GetVertexAttribdvNV = fn) +#define CALL_GetVertexAttribfvNV(disp, parameters) (*((disp)->GetVertexAttribfvNV)) parameters +#define GET_GetVertexAttribfvNV(disp) ((disp)->GetVertexAttribfvNV) +#define SET_GetVertexAttribfvNV(disp, fn) ((disp)->GetVertexAttribfvNV = fn) +#define CALL_GetVertexAttribivNV(disp, parameters) (*((disp)->GetVertexAttribivNV)) parameters +#define GET_GetVertexAttribivNV(disp) ((disp)->GetVertexAttribivNV) +#define SET_GetVertexAttribivNV(disp, fn) ((disp)->GetVertexAttribivNV = fn) +#define CALL_IsProgramNV(disp, parameters) (*((disp)->IsProgramNV)) parameters +#define GET_IsProgramNV(disp) ((disp)->IsProgramNV) +#define SET_IsProgramNV(disp, fn) ((disp)->IsProgramNV = fn) +#define CALL_LoadProgramNV(disp, parameters) (*((disp)->LoadProgramNV)) parameters +#define GET_LoadProgramNV(disp) ((disp)->LoadProgramNV) +#define SET_LoadProgramNV(disp, fn) ((disp)->LoadProgramNV = fn) +#define CALL_ProgramParameters4dvNV(disp, parameters) (*((disp)->ProgramParameters4dvNV)) parameters +#define GET_ProgramParameters4dvNV(disp) ((disp)->ProgramParameters4dvNV) +#define SET_ProgramParameters4dvNV(disp, fn) ((disp)->ProgramParameters4dvNV = fn) +#define CALL_ProgramParameters4fvNV(disp, parameters) (*((disp)->ProgramParameters4fvNV)) parameters +#define GET_ProgramParameters4fvNV(disp) ((disp)->ProgramParameters4fvNV) +#define SET_ProgramParameters4fvNV(disp, fn) ((disp)->ProgramParameters4fvNV = fn) +#define CALL_RequestResidentProgramsNV(disp, parameters) (*((disp)->RequestResidentProgramsNV)) parameters +#define GET_RequestResidentProgramsNV(disp) ((disp)->RequestResidentProgramsNV) +#define SET_RequestResidentProgramsNV(disp, fn) ((disp)->RequestResidentProgramsNV = fn) +#define CALL_TrackMatrixNV(disp, parameters) (*((disp)->TrackMatrixNV)) parameters +#define GET_TrackMatrixNV(disp) ((disp)->TrackMatrixNV) +#define SET_TrackMatrixNV(disp, fn) ((disp)->TrackMatrixNV = fn) +#define CALL_VertexAttrib1dNV(disp, parameters) (*((disp)->VertexAttrib1dNV)) parameters +#define GET_VertexAttrib1dNV(disp) ((disp)->VertexAttrib1dNV) +#define SET_VertexAttrib1dNV(disp, fn) ((disp)->VertexAttrib1dNV = fn) +#define CALL_VertexAttrib1dvNV(disp, parameters) (*((disp)->VertexAttrib1dvNV)) parameters +#define GET_VertexAttrib1dvNV(disp) ((disp)->VertexAttrib1dvNV) +#define SET_VertexAttrib1dvNV(disp, fn) ((disp)->VertexAttrib1dvNV = fn) +#define CALL_VertexAttrib1fNV(disp, parameters) (*((disp)->VertexAttrib1fNV)) parameters +#define GET_VertexAttrib1fNV(disp) ((disp)->VertexAttrib1fNV) +#define SET_VertexAttrib1fNV(disp, fn) ((disp)->VertexAttrib1fNV = fn) +#define CALL_VertexAttrib1fvNV(disp, parameters) (*((disp)->VertexAttrib1fvNV)) parameters +#define GET_VertexAttrib1fvNV(disp) ((disp)->VertexAttrib1fvNV) +#define SET_VertexAttrib1fvNV(disp, fn) ((disp)->VertexAttrib1fvNV = fn) +#define CALL_VertexAttrib1sNV(disp, parameters) (*((disp)->VertexAttrib1sNV)) parameters +#define GET_VertexAttrib1sNV(disp) ((disp)->VertexAttrib1sNV) +#define SET_VertexAttrib1sNV(disp, fn) ((disp)->VertexAttrib1sNV = fn) +#define CALL_VertexAttrib1svNV(disp, parameters) (*((disp)->VertexAttrib1svNV)) parameters +#define GET_VertexAttrib1svNV(disp) ((disp)->VertexAttrib1svNV) +#define SET_VertexAttrib1svNV(disp, fn) ((disp)->VertexAttrib1svNV = fn) +#define CALL_VertexAttrib2dNV(disp, parameters) (*((disp)->VertexAttrib2dNV)) parameters +#define GET_VertexAttrib2dNV(disp) ((disp)->VertexAttrib2dNV) +#define SET_VertexAttrib2dNV(disp, fn) ((disp)->VertexAttrib2dNV = fn) +#define CALL_VertexAttrib2dvNV(disp, parameters) (*((disp)->VertexAttrib2dvNV)) parameters +#define GET_VertexAttrib2dvNV(disp) ((disp)->VertexAttrib2dvNV) +#define SET_VertexAttrib2dvNV(disp, fn) ((disp)->VertexAttrib2dvNV = fn) +#define CALL_VertexAttrib2fNV(disp, parameters) (*((disp)->VertexAttrib2fNV)) parameters +#define GET_VertexAttrib2fNV(disp) ((disp)->VertexAttrib2fNV) +#define SET_VertexAttrib2fNV(disp, fn) ((disp)->VertexAttrib2fNV = fn) +#define CALL_VertexAttrib2fvNV(disp, parameters) (*((disp)->VertexAttrib2fvNV)) parameters +#define GET_VertexAttrib2fvNV(disp) ((disp)->VertexAttrib2fvNV) +#define SET_VertexAttrib2fvNV(disp, fn) ((disp)->VertexAttrib2fvNV = fn) +#define CALL_VertexAttrib2sNV(disp, parameters) (*((disp)->VertexAttrib2sNV)) parameters +#define GET_VertexAttrib2sNV(disp) ((disp)->VertexAttrib2sNV) +#define SET_VertexAttrib2sNV(disp, fn) ((disp)->VertexAttrib2sNV = fn) +#define CALL_VertexAttrib2svNV(disp, parameters) (*((disp)->VertexAttrib2svNV)) parameters +#define GET_VertexAttrib2svNV(disp) ((disp)->VertexAttrib2svNV) +#define SET_VertexAttrib2svNV(disp, fn) ((disp)->VertexAttrib2svNV = fn) +#define CALL_VertexAttrib3dNV(disp, parameters) (*((disp)->VertexAttrib3dNV)) parameters +#define GET_VertexAttrib3dNV(disp) ((disp)->VertexAttrib3dNV) +#define SET_VertexAttrib3dNV(disp, fn) ((disp)->VertexAttrib3dNV = fn) +#define CALL_VertexAttrib3dvNV(disp, parameters) (*((disp)->VertexAttrib3dvNV)) parameters +#define GET_VertexAttrib3dvNV(disp) ((disp)->VertexAttrib3dvNV) +#define SET_VertexAttrib3dvNV(disp, fn) ((disp)->VertexAttrib3dvNV = fn) +#define CALL_VertexAttrib3fNV(disp, parameters) (*((disp)->VertexAttrib3fNV)) parameters +#define GET_VertexAttrib3fNV(disp) ((disp)->VertexAttrib3fNV) +#define SET_VertexAttrib3fNV(disp, fn) ((disp)->VertexAttrib3fNV = fn) +#define CALL_VertexAttrib3fvNV(disp, parameters) (*((disp)->VertexAttrib3fvNV)) parameters +#define GET_VertexAttrib3fvNV(disp) ((disp)->VertexAttrib3fvNV) +#define SET_VertexAttrib3fvNV(disp, fn) ((disp)->VertexAttrib3fvNV = fn) +#define CALL_VertexAttrib3sNV(disp, parameters) (*((disp)->VertexAttrib3sNV)) parameters +#define GET_VertexAttrib3sNV(disp) ((disp)->VertexAttrib3sNV) +#define SET_VertexAttrib3sNV(disp, fn) ((disp)->VertexAttrib3sNV = fn) +#define CALL_VertexAttrib3svNV(disp, parameters) (*((disp)->VertexAttrib3svNV)) parameters +#define GET_VertexAttrib3svNV(disp) ((disp)->VertexAttrib3svNV) +#define SET_VertexAttrib3svNV(disp, fn) ((disp)->VertexAttrib3svNV = fn) +#define CALL_VertexAttrib4dNV(disp, parameters) (*((disp)->VertexAttrib4dNV)) parameters +#define GET_VertexAttrib4dNV(disp) ((disp)->VertexAttrib4dNV) +#define SET_VertexAttrib4dNV(disp, fn) ((disp)->VertexAttrib4dNV = fn) +#define CALL_VertexAttrib4dvNV(disp, parameters) (*((disp)->VertexAttrib4dvNV)) parameters +#define GET_VertexAttrib4dvNV(disp) ((disp)->VertexAttrib4dvNV) +#define SET_VertexAttrib4dvNV(disp, fn) ((disp)->VertexAttrib4dvNV = fn) +#define CALL_VertexAttrib4fNV(disp, parameters) (*((disp)->VertexAttrib4fNV)) parameters +#define GET_VertexAttrib4fNV(disp) ((disp)->VertexAttrib4fNV) +#define SET_VertexAttrib4fNV(disp, fn) ((disp)->VertexAttrib4fNV = fn) +#define CALL_VertexAttrib4fvNV(disp, parameters) (*((disp)->VertexAttrib4fvNV)) parameters +#define GET_VertexAttrib4fvNV(disp) ((disp)->VertexAttrib4fvNV) +#define SET_VertexAttrib4fvNV(disp, fn) ((disp)->VertexAttrib4fvNV = fn) +#define CALL_VertexAttrib4sNV(disp, parameters) (*((disp)->VertexAttrib4sNV)) parameters +#define GET_VertexAttrib4sNV(disp) ((disp)->VertexAttrib4sNV) +#define SET_VertexAttrib4sNV(disp, fn) ((disp)->VertexAttrib4sNV = fn) +#define CALL_VertexAttrib4svNV(disp, parameters) (*((disp)->VertexAttrib4svNV)) parameters +#define GET_VertexAttrib4svNV(disp) ((disp)->VertexAttrib4svNV) +#define SET_VertexAttrib4svNV(disp, fn) ((disp)->VertexAttrib4svNV = fn) +#define CALL_VertexAttrib4ubNV(disp, parameters) (*((disp)->VertexAttrib4ubNV)) parameters +#define GET_VertexAttrib4ubNV(disp) ((disp)->VertexAttrib4ubNV) +#define SET_VertexAttrib4ubNV(disp, fn) ((disp)->VertexAttrib4ubNV = fn) +#define CALL_VertexAttrib4ubvNV(disp, parameters) (*((disp)->VertexAttrib4ubvNV)) parameters +#define GET_VertexAttrib4ubvNV(disp) ((disp)->VertexAttrib4ubvNV) +#define SET_VertexAttrib4ubvNV(disp, fn) ((disp)->VertexAttrib4ubvNV = fn) +#define CALL_VertexAttribPointerNV(disp, parameters) (*((disp)->VertexAttribPointerNV)) parameters +#define GET_VertexAttribPointerNV(disp) ((disp)->VertexAttribPointerNV) +#define SET_VertexAttribPointerNV(disp, fn) ((disp)->VertexAttribPointerNV = fn) +#define CALL_VertexAttribs1dvNV(disp, parameters) (*((disp)->VertexAttribs1dvNV)) parameters +#define GET_VertexAttribs1dvNV(disp) ((disp)->VertexAttribs1dvNV) +#define SET_VertexAttribs1dvNV(disp, fn) ((disp)->VertexAttribs1dvNV = fn) +#define CALL_VertexAttribs1fvNV(disp, parameters) (*((disp)->VertexAttribs1fvNV)) parameters +#define GET_VertexAttribs1fvNV(disp) ((disp)->VertexAttribs1fvNV) +#define SET_VertexAttribs1fvNV(disp, fn) ((disp)->VertexAttribs1fvNV = fn) +#define CALL_VertexAttribs1svNV(disp, parameters) (*((disp)->VertexAttribs1svNV)) parameters +#define GET_VertexAttribs1svNV(disp) ((disp)->VertexAttribs1svNV) +#define SET_VertexAttribs1svNV(disp, fn) ((disp)->VertexAttribs1svNV = fn) +#define CALL_VertexAttribs2dvNV(disp, parameters) (*((disp)->VertexAttribs2dvNV)) parameters +#define GET_VertexAttribs2dvNV(disp) ((disp)->VertexAttribs2dvNV) +#define SET_VertexAttribs2dvNV(disp, fn) ((disp)->VertexAttribs2dvNV = fn) +#define CALL_VertexAttribs2fvNV(disp, parameters) (*((disp)->VertexAttribs2fvNV)) parameters +#define GET_VertexAttribs2fvNV(disp) ((disp)->VertexAttribs2fvNV) +#define SET_VertexAttribs2fvNV(disp, fn) ((disp)->VertexAttribs2fvNV = fn) +#define CALL_VertexAttribs2svNV(disp, parameters) (*((disp)->VertexAttribs2svNV)) parameters +#define GET_VertexAttribs2svNV(disp) ((disp)->VertexAttribs2svNV) +#define SET_VertexAttribs2svNV(disp, fn) ((disp)->VertexAttribs2svNV = fn) +#define CALL_VertexAttribs3dvNV(disp, parameters) (*((disp)->VertexAttribs3dvNV)) parameters +#define GET_VertexAttribs3dvNV(disp) ((disp)->VertexAttribs3dvNV) +#define SET_VertexAttribs3dvNV(disp, fn) ((disp)->VertexAttribs3dvNV = fn) +#define CALL_VertexAttribs3fvNV(disp, parameters) (*((disp)->VertexAttribs3fvNV)) parameters +#define GET_VertexAttribs3fvNV(disp) ((disp)->VertexAttribs3fvNV) +#define SET_VertexAttribs3fvNV(disp, fn) ((disp)->VertexAttribs3fvNV = fn) +#define CALL_VertexAttribs3svNV(disp, parameters) (*((disp)->VertexAttribs3svNV)) parameters +#define GET_VertexAttribs3svNV(disp) ((disp)->VertexAttribs3svNV) +#define SET_VertexAttribs3svNV(disp, fn) ((disp)->VertexAttribs3svNV = fn) +#define CALL_VertexAttribs4dvNV(disp, parameters) (*((disp)->VertexAttribs4dvNV)) parameters +#define GET_VertexAttribs4dvNV(disp) ((disp)->VertexAttribs4dvNV) +#define SET_VertexAttribs4dvNV(disp, fn) ((disp)->VertexAttribs4dvNV = fn) +#define CALL_VertexAttribs4fvNV(disp, parameters) (*((disp)->VertexAttribs4fvNV)) parameters +#define GET_VertexAttribs4fvNV(disp) ((disp)->VertexAttribs4fvNV) +#define SET_VertexAttribs4fvNV(disp, fn) ((disp)->VertexAttribs4fvNV = fn) +#define CALL_VertexAttribs4svNV(disp, parameters) (*((disp)->VertexAttribs4svNV)) parameters +#define GET_VertexAttribs4svNV(disp) ((disp)->VertexAttribs4svNV) +#define SET_VertexAttribs4svNV(disp, fn) ((disp)->VertexAttribs4svNV = fn) +#define CALL_VertexAttribs4ubvNV(disp, parameters) (*((disp)->VertexAttribs4ubvNV)) parameters +#define GET_VertexAttribs4ubvNV(disp) ((disp)->VertexAttribs4ubvNV) +#define SET_VertexAttribs4ubvNV(disp, fn) ((disp)->VertexAttribs4ubvNV = fn) +#define CALL_GetTexBumpParameterfvATI(disp, parameters) (*((disp)->GetTexBumpParameterfvATI)) parameters +#define GET_GetTexBumpParameterfvATI(disp) ((disp)->GetTexBumpParameterfvATI) +#define SET_GetTexBumpParameterfvATI(disp, fn) ((disp)->GetTexBumpParameterfvATI = fn) +#define CALL_GetTexBumpParameterivATI(disp, parameters) (*((disp)->GetTexBumpParameterivATI)) parameters +#define GET_GetTexBumpParameterivATI(disp) ((disp)->GetTexBumpParameterivATI) +#define SET_GetTexBumpParameterivATI(disp, fn) ((disp)->GetTexBumpParameterivATI = fn) +#define CALL_TexBumpParameterfvATI(disp, parameters) (*((disp)->TexBumpParameterfvATI)) parameters +#define GET_TexBumpParameterfvATI(disp) ((disp)->TexBumpParameterfvATI) +#define SET_TexBumpParameterfvATI(disp, fn) ((disp)->TexBumpParameterfvATI = fn) +#define CALL_TexBumpParameterivATI(disp, parameters) (*((disp)->TexBumpParameterivATI)) parameters +#define GET_TexBumpParameterivATI(disp) ((disp)->TexBumpParameterivATI) +#define SET_TexBumpParameterivATI(disp, fn) ((disp)->TexBumpParameterivATI = fn) +#define CALL_AlphaFragmentOp1ATI(disp, parameters) (*((disp)->AlphaFragmentOp1ATI)) parameters +#define GET_AlphaFragmentOp1ATI(disp) ((disp)->AlphaFragmentOp1ATI) +#define SET_AlphaFragmentOp1ATI(disp, fn) ((disp)->AlphaFragmentOp1ATI = fn) +#define CALL_AlphaFragmentOp2ATI(disp, parameters) (*((disp)->AlphaFragmentOp2ATI)) parameters +#define GET_AlphaFragmentOp2ATI(disp) ((disp)->AlphaFragmentOp2ATI) +#define SET_AlphaFragmentOp2ATI(disp, fn) ((disp)->AlphaFragmentOp2ATI = fn) +#define CALL_AlphaFragmentOp3ATI(disp, parameters) (*((disp)->AlphaFragmentOp3ATI)) parameters +#define GET_AlphaFragmentOp3ATI(disp) ((disp)->AlphaFragmentOp3ATI) +#define SET_AlphaFragmentOp3ATI(disp, fn) ((disp)->AlphaFragmentOp3ATI = fn) +#define CALL_BeginFragmentShaderATI(disp, parameters) (*((disp)->BeginFragmentShaderATI)) parameters +#define GET_BeginFragmentShaderATI(disp) ((disp)->BeginFragmentShaderATI) +#define SET_BeginFragmentShaderATI(disp, fn) ((disp)->BeginFragmentShaderATI = fn) +#define CALL_BindFragmentShaderATI(disp, parameters) (*((disp)->BindFragmentShaderATI)) parameters +#define GET_BindFragmentShaderATI(disp) ((disp)->BindFragmentShaderATI) +#define SET_BindFragmentShaderATI(disp, fn) ((disp)->BindFragmentShaderATI = fn) +#define CALL_ColorFragmentOp1ATI(disp, parameters) (*((disp)->ColorFragmentOp1ATI)) parameters +#define GET_ColorFragmentOp1ATI(disp) ((disp)->ColorFragmentOp1ATI) +#define SET_ColorFragmentOp1ATI(disp, fn) ((disp)->ColorFragmentOp1ATI = fn) +#define CALL_ColorFragmentOp2ATI(disp, parameters) (*((disp)->ColorFragmentOp2ATI)) parameters +#define GET_ColorFragmentOp2ATI(disp) ((disp)->ColorFragmentOp2ATI) +#define SET_ColorFragmentOp2ATI(disp, fn) ((disp)->ColorFragmentOp2ATI = fn) +#define CALL_ColorFragmentOp3ATI(disp, parameters) (*((disp)->ColorFragmentOp3ATI)) parameters +#define GET_ColorFragmentOp3ATI(disp) ((disp)->ColorFragmentOp3ATI) +#define SET_ColorFragmentOp3ATI(disp, fn) ((disp)->ColorFragmentOp3ATI = fn) +#define CALL_DeleteFragmentShaderATI(disp, parameters) (*((disp)->DeleteFragmentShaderATI)) parameters +#define GET_DeleteFragmentShaderATI(disp) ((disp)->DeleteFragmentShaderATI) +#define SET_DeleteFragmentShaderATI(disp, fn) ((disp)->DeleteFragmentShaderATI = fn) +#define CALL_EndFragmentShaderATI(disp, parameters) (*((disp)->EndFragmentShaderATI)) parameters +#define GET_EndFragmentShaderATI(disp) ((disp)->EndFragmentShaderATI) +#define SET_EndFragmentShaderATI(disp, fn) ((disp)->EndFragmentShaderATI = fn) +#define CALL_GenFragmentShadersATI(disp, parameters) (*((disp)->GenFragmentShadersATI)) parameters +#define GET_GenFragmentShadersATI(disp) ((disp)->GenFragmentShadersATI) +#define SET_GenFragmentShadersATI(disp, fn) ((disp)->GenFragmentShadersATI = fn) +#define CALL_PassTexCoordATI(disp, parameters) (*((disp)->PassTexCoordATI)) parameters +#define GET_PassTexCoordATI(disp) ((disp)->PassTexCoordATI) +#define SET_PassTexCoordATI(disp, fn) ((disp)->PassTexCoordATI = fn) +#define CALL_SampleMapATI(disp, parameters) (*((disp)->SampleMapATI)) parameters +#define GET_SampleMapATI(disp) ((disp)->SampleMapATI) +#define SET_SampleMapATI(disp, fn) ((disp)->SampleMapATI = fn) +#define CALL_SetFragmentShaderConstantATI(disp, parameters) (*((disp)->SetFragmentShaderConstantATI)) parameters +#define GET_SetFragmentShaderConstantATI(disp) ((disp)->SetFragmentShaderConstantATI) +#define SET_SetFragmentShaderConstantATI(disp, fn) ((disp)->SetFragmentShaderConstantATI = fn) +#define CALL_PointParameteriNV(disp, parameters) (*((disp)->PointParameteriNV)) parameters +#define GET_PointParameteriNV(disp) ((disp)->PointParameteriNV) +#define SET_PointParameteriNV(disp, fn) ((disp)->PointParameteriNV = fn) +#define CALL_PointParameterivNV(disp, parameters) (*((disp)->PointParameterivNV)) parameters +#define GET_PointParameterivNV(disp) ((disp)->PointParameterivNV) +#define SET_PointParameterivNV(disp, fn) ((disp)->PointParameterivNV = fn) +#define CALL_ActiveStencilFaceEXT(disp, parameters) (*((disp)->ActiveStencilFaceEXT)) parameters +#define GET_ActiveStencilFaceEXT(disp) ((disp)->ActiveStencilFaceEXT) +#define SET_ActiveStencilFaceEXT(disp, fn) ((disp)->ActiveStencilFaceEXT = fn) +#define CALL_BindVertexArrayAPPLE(disp, parameters) (*((disp)->BindVertexArrayAPPLE)) parameters +#define GET_BindVertexArrayAPPLE(disp) ((disp)->BindVertexArrayAPPLE) +#define SET_BindVertexArrayAPPLE(disp, fn) ((disp)->BindVertexArrayAPPLE = fn) +#define CALL_DeleteVertexArraysAPPLE(disp, parameters) (*((disp)->DeleteVertexArraysAPPLE)) parameters +#define GET_DeleteVertexArraysAPPLE(disp) ((disp)->DeleteVertexArraysAPPLE) +#define SET_DeleteVertexArraysAPPLE(disp, fn) ((disp)->DeleteVertexArraysAPPLE = fn) +#define CALL_GenVertexArraysAPPLE(disp, parameters) (*((disp)->GenVertexArraysAPPLE)) parameters +#define GET_GenVertexArraysAPPLE(disp) ((disp)->GenVertexArraysAPPLE) +#define SET_GenVertexArraysAPPLE(disp, fn) ((disp)->GenVertexArraysAPPLE = fn) +#define CALL_IsVertexArrayAPPLE(disp, parameters) (*((disp)->IsVertexArrayAPPLE)) parameters +#define GET_IsVertexArrayAPPLE(disp) ((disp)->IsVertexArrayAPPLE) +#define SET_IsVertexArrayAPPLE(disp, fn) ((disp)->IsVertexArrayAPPLE = fn) +#define CALL_GetProgramNamedParameterdvNV(disp, parameters) (*((disp)->GetProgramNamedParameterdvNV)) parameters +#define GET_GetProgramNamedParameterdvNV(disp) ((disp)->GetProgramNamedParameterdvNV) +#define SET_GetProgramNamedParameterdvNV(disp, fn) ((disp)->GetProgramNamedParameterdvNV = fn) +#define CALL_GetProgramNamedParameterfvNV(disp, parameters) (*((disp)->GetProgramNamedParameterfvNV)) parameters +#define GET_GetProgramNamedParameterfvNV(disp) ((disp)->GetProgramNamedParameterfvNV) +#define SET_GetProgramNamedParameterfvNV(disp, fn) ((disp)->GetProgramNamedParameterfvNV = fn) +#define CALL_ProgramNamedParameter4dNV(disp, parameters) (*((disp)->ProgramNamedParameter4dNV)) parameters +#define GET_ProgramNamedParameter4dNV(disp) ((disp)->ProgramNamedParameter4dNV) +#define SET_ProgramNamedParameter4dNV(disp, fn) ((disp)->ProgramNamedParameter4dNV = fn) +#define CALL_ProgramNamedParameter4dvNV(disp, parameters) (*((disp)->ProgramNamedParameter4dvNV)) parameters +#define GET_ProgramNamedParameter4dvNV(disp) ((disp)->ProgramNamedParameter4dvNV) +#define SET_ProgramNamedParameter4dvNV(disp, fn) ((disp)->ProgramNamedParameter4dvNV = fn) +#define CALL_ProgramNamedParameter4fNV(disp, parameters) (*((disp)->ProgramNamedParameter4fNV)) parameters +#define GET_ProgramNamedParameter4fNV(disp) ((disp)->ProgramNamedParameter4fNV) +#define SET_ProgramNamedParameter4fNV(disp, fn) ((disp)->ProgramNamedParameter4fNV = fn) +#define CALL_ProgramNamedParameter4fvNV(disp, parameters) (*((disp)->ProgramNamedParameter4fvNV)) parameters +#define GET_ProgramNamedParameter4fvNV(disp) ((disp)->ProgramNamedParameter4fvNV) +#define SET_ProgramNamedParameter4fvNV(disp, fn) ((disp)->ProgramNamedParameter4fvNV = fn) +#define CALL_DepthBoundsEXT(disp, parameters) (*((disp)->DepthBoundsEXT)) parameters +#define GET_DepthBoundsEXT(disp) ((disp)->DepthBoundsEXT) +#define SET_DepthBoundsEXT(disp, fn) ((disp)->DepthBoundsEXT = fn) +#define CALL_BlendEquationSeparateEXT(disp, parameters) (*((disp)->BlendEquationSeparateEXT)) parameters +#define GET_BlendEquationSeparateEXT(disp) ((disp)->BlendEquationSeparateEXT) +#define SET_BlendEquationSeparateEXT(disp, fn) ((disp)->BlendEquationSeparateEXT = fn) +#define CALL_BindFramebufferEXT(disp, parameters) (*((disp)->BindFramebufferEXT)) parameters +#define GET_BindFramebufferEXT(disp) ((disp)->BindFramebufferEXT) +#define SET_BindFramebufferEXT(disp, fn) ((disp)->BindFramebufferEXT = fn) +#define CALL_BindRenderbufferEXT(disp, parameters) (*((disp)->BindRenderbufferEXT)) parameters +#define GET_BindRenderbufferEXT(disp) ((disp)->BindRenderbufferEXT) +#define SET_BindRenderbufferEXT(disp, fn) ((disp)->BindRenderbufferEXT = fn) +#define CALL_CheckFramebufferStatusEXT(disp, parameters) (*((disp)->CheckFramebufferStatusEXT)) parameters +#define GET_CheckFramebufferStatusEXT(disp) ((disp)->CheckFramebufferStatusEXT) +#define SET_CheckFramebufferStatusEXT(disp, fn) ((disp)->CheckFramebufferStatusEXT = fn) +#define CALL_DeleteFramebuffersEXT(disp, parameters) (*((disp)->DeleteFramebuffersEXT)) parameters +#define GET_DeleteFramebuffersEXT(disp) ((disp)->DeleteFramebuffersEXT) +#define SET_DeleteFramebuffersEXT(disp, fn) ((disp)->DeleteFramebuffersEXT = fn) +#define CALL_DeleteRenderbuffersEXT(disp, parameters) (*((disp)->DeleteRenderbuffersEXT)) parameters +#define GET_DeleteRenderbuffersEXT(disp) ((disp)->DeleteRenderbuffersEXT) +#define SET_DeleteRenderbuffersEXT(disp, fn) ((disp)->DeleteRenderbuffersEXT = fn) +#define CALL_FramebufferRenderbufferEXT(disp, parameters) (*((disp)->FramebufferRenderbufferEXT)) parameters +#define GET_FramebufferRenderbufferEXT(disp) ((disp)->FramebufferRenderbufferEXT) +#define SET_FramebufferRenderbufferEXT(disp, fn) ((disp)->FramebufferRenderbufferEXT = fn) +#define CALL_FramebufferTexture1DEXT(disp, parameters) (*((disp)->FramebufferTexture1DEXT)) parameters +#define GET_FramebufferTexture1DEXT(disp) ((disp)->FramebufferTexture1DEXT) +#define SET_FramebufferTexture1DEXT(disp, fn) ((disp)->FramebufferTexture1DEXT = fn) +#define CALL_FramebufferTexture2DEXT(disp, parameters) (*((disp)->FramebufferTexture2DEXT)) parameters +#define GET_FramebufferTexture2DEXT(disp) ((disp)->FramebufferTexture2DEXT) +#define SET_FramebufferTexture2DEXT(disp, fn) ((disp)->FramebufferTexture2DEXT = fn) +#define CALL_FramebufferTexture3DEXT(disp, parameters) (*((disp)->FramebufferTexture3DEXT)) parameters +#define GET_FramebufferTexture3DEXT(disp) ((disp)->FramebufferTexture3DEXT) +#define SET_FramebufferTexture3DEXT(disp, fn) ((disp)->FramebufferTexture3DEXT = fn) +#define CALL_GenFramebuffersEXT(disp, parameters) (*((disp)->GenFramebuffersEXT)) parameters +#define GET_GenFramebuffersEXT(disp) ((disp)->GenFramebuffersEXT) +#define SET_GenFramebuffersEXT(disp, fn) ((disp)->GenFramebuffersEXT = fn) +#define CALL_GenRenderbuffersEXT(disp, parameters) (*((disp)->GenRenderbuffersEXT)) parameters +#define GET_GenRenderbuffersEXT(disp) ((disp)->GenRenderbuffersEXT) +#define SET_GenRenderbuffersEXT(disp, fn) ((disp)->GenRenderbuffersEXT = fn) +#define CALL_GenerateMipmapEXT(disp, parameters) (*((disp)->GenerateMipmapEXT)) parameters +#define GET_GenerateMipmapEXT(disp) ((disp)->GenerateMipmapEXT) +#define SET_GenerateMipmapEXT(disp, fn) ((disp)->GenerateMipmapEXT = fn) +#define CALL_GetFramebufferAttachmentParameterivEXT(disp, parameters) (*((disp)->GetFramebufferAttachmentParameterivEXT)) parameters +#define GET_GetFramebufferAttachmentParameterivEXT(disp) ((disp)->GetFramebufferAttachmentParameterivEXT) +#define SET_GetFramebufferAttachmentParameterivEXT(disp, fn) ((disp)->GetFramebufferAttachmentParameterivEXT = fn) +#define CALL_GetRenderbufferParameterivEXT(disp, parameters) (*((disp)->GetRenderbufferParameterivEXT)) parameters +#define GET_GetRenderbufferParameterivEXT(disp) ((disp)->GetRenderbufferParameterivEXT) +#define SET_GetRenderbufferParameterivEXT(disp, fn) ((disp)->GetRenderbufferParameterivEXT = fn) +#define CALL_IsFramebufferEXT(disp, parameters) (*((disp)->IsFramebufferEXT)) parameters +#define GET_IsFramebufferEXT(disp) ((disp)->IsFramebufferEXT) +#define SET_IsFramebufferEXT(disp, fn) ((disp)->IsFramebufferEXT = fn) +#define CALL_IsRenderbufferEXT(disp, parameters) (*((disp)->IsRenderbufferEXT)) parameters +#define GET_IsRenderbufferEXT(disp) ((disp)->IsRenderbufferEXT) +#define SET_IsRenderbufferEXT(disp, fn) ((disp)->IsRenderbufferEXT = fn) +#define CALL_RenderbufferStorageEXT(disp, parameters) (*((disp)->RenderbufferStorageEXT)) parameters +#define GET_RenderbufferStorageEXT(disp) ((disp)->RenderbufferStorageEXT) +#define SET_RenderbufferStorageEXT(disp, fn) ((disp)->RenderbufferStorageEXT = fn) +#define CALL_BlitFramebufferEXT(disp, parameters) (*((disp)->BlitFramebufferEXT)) parameters +#define GET_BlitFramebufferEXT(disp) ((disp)->BlitFramebufferEXT) +#define SET_BlitFramebufferEXT(disp, fn) ((disp)->BlitFramebufferEXT = fn) +#define CALL_BufferParameteriAPPLE(disp, parameters) (*((disp)->BufferParameteriAPPLE)) parameters +#define GET_BufferParameteriAPPLE(disp) ((disp)->BufferParameteriAPPLE) +#define SET_BufferParameteriAPPLE(disp, fn) ((disp)->BufferParameteriAPPLE = fn) +#define CALL_FlushMappedBufferRangeAPPLE(disp, parameters) (*((disp)->FlushMappedBufferRangeAPPLE)) parameters +#define GET_FlushMappedBufferRangeAPPLE(disp) ((disp)->FlushMappedBufferRangeAPPLE) +#define SET_FlushMappedBufferRangeAPPLE(disp, fn) ((disp)->FlushMappedBufferRangeAPPLE = fn) +#define CALL_FramebufferTextureLayerEXT(disp, parameters) (*((disp)->FramebufferTextureLayerEXT)) parameters +#define GET_FramebufferTextureLayerEXT(disp) ((disp)->FramebufferTextureLayerEXT) +#define SET_FramebufferTextureLayerEXT(disp, fn) ((disp)->FramebufferTextureLayerEXT = fn) +#define CALL_ProvokingVertexEXT(disp, parameters) (*((disp)->ProvokingVertexEXT)) parameters +#define GET_ProvokingVertexEXT(disp) ((disp)->ProvokingVertexEXT) +#define SET_ProvokingVertexEXT(disp, fn) ((disp)->ProvokingVertexEXT = fn) +#define CALL_GetTexParameterPointervAPPLE(disp, parameters) (*((disp)->GetTexParameterPointervAPPLE)) parameters +#define GET_GetTexParameterPointervAPPLE(disp) ((disp)->GetTexParameterPointervAPPLE) +#define SET_GetTexParameterPointervAPPLE(disp, fn) ((disp)->GetTexParameterPointervAPPLE = fn) +#define CALL_TextureRangeAPPLE(disp, parameters) (*((disp)->TextureRangeAPPLE)) parameters +#define GET_TextureRangeAPPLE(disp) ((disp)->TextureRangeAPPLE) +#define SET_TextureRangeAPPLE(disp, fn) ((disp)->TextureRangeAPPLE = fn) +#define CALL_StencilFuncSeparateATI(disp, parameters) (*((disp)->StencilFuncSeparateATI)) parameters +#define GET_StencilFuncSeparateATI(disp) ((disp)->StencilFuncSeparateATI) +#define SET_StencilFuncSeparateATI(disp, fn) ((disp)->StencilFuncSeparateATI = fn) +#define CALL_ProgramEnvParameters4fvEXT(disp, parameters) (*((disp)->ProgramEnvParameters4fvEXT)) parameters +#define GET_ProgramEnvParameters4fvEXT(disp) ((disp)->ProgramEnvParameters4fvEXT) +#define SET_ProgramEnvParameters4fvEXT(disp, fn) ((disp)->ProgramEnvParameters4fvEXT = fn) +#define CALL_ProgramLocalParameters4fvEXT(disp, parameters) (*((disp)->ProgramLocalParameters4fvEXT)) parameters +#define GET_ProgramLocalParameters4fvEXT(disp) ((disp)->ProgramLocalParameters4fvEXT) +#define SET_ProgramLocalParameters4fvEXT(disp, fn) ((disp)->ProgramLocalParameters4fvEXT = fn) +#define CALL_GetQueryObjecti64vEXT(disp, parameters) (*((disp)->GetQueryObjecti64vEXT)) parameters +#define GET_GetQueryObjecti64vEXT(disp) ((disp)->GetQueryObjecti64vEXT) +#define SET_GetQueryObjecti64vEXT(disp, fn) ((disp)->GetQueryObjecti64vEXT = fn) +#define CALL_GetQueryObjectui64vEXT(disp, parameters) (*((disp)->GetQueryObjectui64vEXT)) parameters +#define GET_GetQueryObjectui64vEXT(disp) ((disp)->GetQueryObjectui64vEXT) +#define SET_GetQueryObjectui64vEXT(disp, fn) ((disp)->GetQueryObjectui64vEXT = fn) + +#else + +#define driDispatchRemapTable_size 387 +extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; + +#define AttachShader_remap_index 0 +#define CreateProgram_remap_index 1 +#define CreateShader_remap_index 2 +#define DeleteProgram_remap_index 3 +#define DeleteShader_remap_index 4 +#define DetachShader_remap_index 5 +#define GetAttachedShaders_remap_index 6 +#define GetProgramInfoLog_remap_index 7 +#define GetProgramiv_remap_index 8 +#define GetShaderInfoLog_remap_index 9 +#define GetShaderiv_remap_index 10 +#define IsProgram_remap_index 11 +#define IsShader_remap_index 12 +#define StencilFuncSeparate_remap_index 13 +#define StencilMaskSeparate_remap_index 14 +#define StencilOpSeparate_remap_index 15 +#define UniformMatrix2x3fv_remap_index 16 +#define UniformMatrix2x4fv_remap_index 17 +#define UniformMatrix3x2fv_remap_index 18 +#define UniformMatrix3x4fv_remap_index 19 +#define UniformMatrix4x2fv_remap_index 20 +#define UniformMatrix4x3fv_remap_index 21 +#define LoadTransposeMatrixdARB_remap_index 22 +#define LoadTransposeMatrixfARB_remap_index 23 +#define MultTransposeMatrixdARB_remap_index 24 +#define MultTransposeMatrixfARB_remap_index 25 +#define SampleCoverageARB_remap_index 26 +#define CompressedTexImage1DARB_remap_index 27 +#define CompressedTexImage2DARB_remap_index 28 +#define CompressedTexImage3DARB_remap_index 29 +#define CompressedTexSubImage1DARB_remap_index 30 +#define CompressedTexSubImage2DARB_remap_index 31 +#define CompressedTexSubImage3DARB_remap_index 32 +#define GetCompressedTexImageARB_remap_index 33 +#define DisableVertexAttribArrayARB_remap_index 34 +#define EnableVertexAttribArrayARB_remap_index 35 +#define GetProgramEnvParameterdvARB_remap_index 36 +#define GetProgramEnvParameterfvARB_remap_index 37 +#define GetProgramLocalParameterdvARB_remap_index 38 +#define GetProgramLocalParameterfvARB_remap_index 39 +#define GetProgramStringARB_remap_index 40 +#define GetProgramivARB_remap_index 41 +#define GetVertexAttribdvARB_remap_index 42 +#define GetVertexAttribfvARB_remap_index 43 +#define GetVertexAttribivARB_remap_index 44 +#define ProgramEnvParameter4dARB_remap_index 45 +#define ProgramEnvParameter4dvARB_remap_index 46 +#define ProgramEnvParameter4fARB_remap_index 47 +#define ProgramEnvParameter4fvARB_remap_index 48 +#define ProgramLocalParameter4dARB_remap_index 49 +#define ProgramLocalParameter4dvARB_remap_index 50 +#define ProgramLocalParameter4fARB_remap_index 51 +#define ProgramLocalParameter4fvARB_remap_index 52 +#define ProgramStringARB_remap_index 53 +#define VertexAttrib1dARB_remap_index 54 +#define VertexAttrib1dvARB_remap_index 55 +#define VertexAttrib1fARB_remap_index 56 +#define VertexAttrib1fvARB_remap_index 57 +#define VertexAttrib1sARB_remap_index 58 +#define VertexAttrib1svARB_remap_index 59 +#define VertexAttrib2dARB_remap_index 60 +#define VertexAttrib2dvARB_remap_index 61 +#define VertexAttrib2fARB_remap_index 62 +#define VertexAttrib2fvARB_remap_index 63 +#define VertexAttrib2sARB_remap_index 64 +#define VertexAttrib2svARB_remap_index 65 +#define VertexAttrib3dARB_remap_index 66 +#define VertexAttrib3dvARB_remap_index 67 +#define VertexAttrib3fARB_remap_index 68 +#define VertexAttrib3fvARB_remap_index 69 +#define VertexAttrib3sARB_remap_index 70 +#define VertexAttrib3svARB_remap_index 71 +#define VertexAttrib4NbvARB_remap_index 72 +#define VertexAttrib4NivARB_remap_index 73 +#define VertexAttrib4NsvARB_remap_index 74 +#define VertexAttrib4NubARB_remap_index 75 +#define VertexAttrib4NubvARB_remap_index 76 +#define VertexAttrib4NuivARB_remap_index 77 +#define VertexAttrib4NusvARB_remap_index 78 +#define VertexAttrib4bvARB_remap_index 79 +#define VertexAttrib4dARB_remap_index 80 +#define VertexAttrib4dvARB_remap_index 81 +#define VertexAttrib4fARB_remap_index 82 +#define VertexAttrib4fvARB_remap_index 83 +#define VertexAttrib4ivARB_remap_index 84 +#define VertexAttrib4sARB_remap_index 85 +#define VertexAttrib4svARB_remap_index 86 +#define VertexAttrib4ubvARB_remap_index 87 +#define VertexAttrib4uivARB_remap_index 88 +#define VertexAttrib4usvARB_remap_index 89 +#define VertexAttribPointerARB_remap_index 90 +#define BindBufferARB_remap_index 91 +#define BufferDataARB_remap_index 92 +#define BufferSubDataARB_remap_index 93 +#define DeleteBuffersARB_remap_index 94 +#define GenBuffersARB_remap_index 95 +#define GetBufferParameterivARB_remap_index 96 +#define GetBufferPointervARB_remap_index 97 +#define GetBufferSubDataARB_remap_index 98 +#define IsBufferARB_remap_index 99 +#define MapBufferARB_remap_index 100 +#define UnmapBufferARB_remap_index 101 +#define BeginQueryARB_remap_index 102 +#define DeleteQueriesARB_remap_index 103 +#define EndQueryARB_remap_index 104 +#define GenQueriesARB_remap_index 105 +#define GetQueryObjectivARB_remap_index 106 +#define GetQueryObjectuivARB_remap_index 107 +#define GetQueryivARB_remap_index 108 +#define IsQueryARB_remap_index 109 +#define AttachObjectARB_remap_index 110 +#define CompileShaderARB_remap_index 111 +#define CreateProgramObjectARB_remap_index 112 +#define CreateShaderObjectARB_remap_index 113 +#define DeleteObjectARB_remap_index 114 +#define DetachObjectARB_remap_index 115 +#define GetActiveUniformARB_remap_index 116 +#define GetAttachedObjectsARB_remap_index 117 +#define GetHandleARB_remap_index 118 +#define GetInfoLogARB_remap_index 119 +#define GetObjectParameterfvARB_remap_index 120 +#define GetObjectParameterivARB_remap_index 121 +#define GetShaderSourceARB_remap_index 122 +#define GetUniformLocationARB_remap_index 123 +#define GetUniformfvARB_remap_index 124 +#define GetUniformivARB_remap_index 125 +#define LinkProgramARB_remap_index 126 +#define ShaderSourceARB_remap_index 127 +#define Uniform1fARB_remap_index 128 +#define Uniform1fvARB_remap_index 129 +#define Uniform1iARB_remap_index 130 +#define Uniform1ivARB_remap_index 131 +#define Uniform2fARB_remap_index 132 +#define Uniform2fvARB_remap_index 133 +#define Uniform2iARB_remap_index 134 +#define Uniform2ivARB_remap_index 135 +#define Uniform3fARB_remap_index 136 +#define Uniform3fvARB_remap_index 137 +#define Uniform3iARB_remap_index 138 +#define Uniform3ivARB_remap_index 139 +#define Uniform4fARB_remap_index 140 +#define Uniform4fvARB_remap_index 141 +#define Uniform4iARB_remap_index 142 +#define Uniform4ivARB_remap_index 143 +#define UniformMatrix2fvARB_remap_index 144 +#define UniformMatrix3fvARB_remap_index 145 +#define UniformMatrix4fvARB_remap_index 146 +#define UseProgramObjectARB_remap_index 147 +#define ValidateProgramARB_remap_index 148 +#define BindAttribLocationARB_remap_index 149 +#define GetActiveAttribARB_remap_index 150 +#define GetAttribLocationARB_remap_index 151 +#define DrawBuffersARB_remap_index 152 +#define RenderbufferStorageMultisample_remap_index 153 +#define FlushMappedBufferRange_remap_index 154 +#define MapBufferRange_remap_index 155 +#define BindVertexArray_remap_index 156 +#define GenVertexArrays_remap_index 157 +#define CopyBufferSubData_remap_index 158 +#define ClientWaitSync_remap_index 159 +#define DeleteSync_remap_index 160 +#define FenceSync_remap_index 161 +#define GetInteger64v_remap_index 162 +#define GetSynciv_remap_index 163 +#define IsSync_remap_index 164 +#define WaitSync_remap_index 165 +#define DrawElementsBaseVertex_remap_index 166 +#define DrawRangeElementsBaseVertex_remap_index 167 +#define MultiDrawElementsBaseVertex_remap_index 168 +#define PolygonOffsetEXT_remap_index 169 +#define GetPixelTexGenParameterfvSGIS_remap_index 170 +#define GetPixelTexGenParameterivSGIS_remap_index 171 +#define PixelTexGenParameterfSGIS_remap_index 172 +#define PixelTexGenParameterfvSGIS_remap_index 173 +#define PixelTexGenParameteriSGIS_remap_index 174 +#define PixelTexGenParameterivSGIS_remap_index 175 +#define SampleMaskSGIS_remap_index 176 +#define SamplePatternSGIS_remap_index 177 +#define ColorPointerEXT_remap_index 178 +#define EdgeFlagPointerEXT_remap_index 179 +#define IndexPointerEXT_remap_index 180 +#define NormalPointerEXT_remap_index 181 +#define TexCoordPointerEXT_remap_index 182 +#define VertexPointerEXT_remap_index 183 +#define PointParameterfEXT_remap_index 184 +#define PointParameterfvEXT_remap_index 185 +#define LockArraysEXT_remap_index 186 +#define UnlockArraysEXT_remap_index 187 +#define CullParameterdvEXT_remap_index 188 +#define CullParameterfvEXT_remap_index 189 +#define SecondaryColor3bEXT_remap_index 190 +#define SecondaryColor3bvEXT_remap_index 191 +#define SecondaryColor3dEXT_remap_index 192 +#define SecondaryColor3dvEXT_remap_index 193 +#define SecondaryColor3fEXT_remap_index 194 +#define SecondaryColor3fvEXT_remap_index 195 +#define SecondaryColor3iEXT_remap_index 196 +#define SecondaryColor3ivEXT_remap_index 197 +#define SecondaryColor3sEXT_remap_index 198 +#define SecondaryColor3svEXT_remap_index 199 +#define SecondaryColor3ubEXT_remap_index 200 +#define SecondaryColor3ubvEXT_remap_index 201 +#define SecondaryColor3uiEXT_remap_index 202 +#define SecondaryColor3uivEXT_remap_index 203 +#define SecondaryColor3usEXT_remap_index 204 +#define SecondaryColor3usvEXT_remap_index 205 +#define SecondaryColorPointerEXT_remap_index 206 +#define MultiDrawArraysEXT_remap_index 207 +#define MultiDrawElementsEXT_remap_index 208 +#define FogCoordPointerEXT_remap_index 209 +#define FogCoorddEXT_remap_index 210 +#define FogCoorddvEXT_remap_index 211 +#define FogCoordfEXT_remap_index 212 +#define FogCoordfvEXT_remap_index 213 +#define PixelTexGenSGIX_remap_index 214 +#define BlendFuncSeparateEXT_remap_index 215 +#define FlushVertexArrayRangeNV_remap_index 216 +#define VertexArrayRangeNV_remap_index 217 +#define CombinerInputNV_remap_index 218 +#define CombinerOutputNV_remap_index 219 +#define CombinerParameterfNV_remap_index 220 +#define CombinerParameterfvNV_remap_index 221 +#define CombinerParameteriNV_remap_index 222 +#define CombinerParameterivNV_remap_index 223 +#define FinalCombinerInputNV_remap_index 224 +#define GetCombinerInputParameterfvNV_remap_index 225 +#define GetCombinerInputParameterivNV_remap_index 226 +#define GetCombinerOutputParameterfvNV_remap_index 227 +#define GetCombinerOutputParameterivNV_remap_index 228 +#define GetFinalCombinerInputParameterfvNV_remap_index 229 +#define GetFinalCombinerInputParameterivNV_remap_index 230 +#define ResizeBuffersMESA_remap_index 231 +#define WindowPos2dMESA_remap_index 232 +#define WindowPos2dvMESA_remap_index 233 +#define WindowPos2fMESA_remap_index 234 +#define WindowPos2fvMESA_remap_index 235 +#define WindowPos2iMESA_remap_index 236 +#define WindowPos2ivMESA_remap_index 237 +#define WindowPos2sMESA_remap_index 238 +#define WindowPos2svMESA_remap_index 239 +#define WindowPos3dMESA_remap_index 240 +#define WindowPos3dvMESA_remap_index 241 +#define WindowPos3fMESA_remap_index 242 +#define WindowPos3fvMESA_remap_index 243 +#define WindowPos3iMESA_remap_index 244 +#define WindowPos3ivMESA_remap_index 245 +#define WindowPos3sMESA_remap_index 246 +#define WindowPos3svMESA_remap_index 247 +#define WindowPos4dMESA_remap_index 248 +#define WindowPos4dvMESA_remap_index 249 +#define WindowPos4fMESA_remap_index 250 +#define WindowPos4fvMESA_remap_index 251 +#define WindowPos4iMESA_remap_index 252 +#define WindowPos4ivMESA_remap_index 253 +#define WindowPos4sMESA_remap_index 254 +#define WindowPos4svMESA_remap_index 255 +#define MultiModeDrawArraysIBM_remap_index 256 +#define MultiModeDrawElementsIBM_remap_index 257 +#define DeleteFencesNV_remap_index 258 +#define FinishFenceNV_remap_index 259 +#define GenFencesNV_remap_index 260 +#define GetFenceivNV_remap_index 261 +#define IsFenceNV_remap_index 262 +#define SetFenceNV_remap_index 263 +#define TestFenceNV_remap_index 264 +#define AreProgramsResidentNV_remap_index 265 +#define BindProgramNV_remap_index 266 +#define DeleteProgramsNV_remap_index 267 +#define ExecuteProgramNV_remap_index 268 +#define GenProgramsNV_remap_index 269 +#define GetProgramParameterdvNV_remap_index 270 +#define GetProgramParameterfvNV_remap_index 271 +#define GetProgramStringNV_remap_index 272 +#define GetProgramivNV_remap_index 273 +#define GetTrackMatrixivNV_remap_index 274 +#define GetVertexAttribPointervNV_remap_index 275 +#define GetVertexAttribdvNV_remap_index 276 +#define GetVertexAttribfvNV_remap_index 277 +#define GetVertexAttribivNV_remap_index 278 +#define IsProgramNV_remap_index 279 +#define LoadProgramNV_remap_index 280 +#define ProgramParameters4dvNV_remap_index 281 +#define ProgramParameters4fvNV_remap_index 282 +#define RequestResidentProgramsNV_remap_index 283 +#define TrackMatrixNV_remap_index 284 +#define VertexAttrib1dNV_remap_index 285 +#define VertexAttrib1dvNV_remap_index 286 +#define VertexAttrib1fNV_remap_index 287 +#define VertexAttrib1fvNV_remap_index 288 +#define VertexAttrib1sNV_remap_index 289 +#define VertexAttrib1svNV_remap_index 290 +#define VertexAttrib2dNV_remap_index 291 +#define VertexAttrib2dvNV_remap_index 292 +#define VertexAttrib2fNV_remap_index 293 +#define VertexAttrib2fvNV_remap_index 294 +#define VertexAttrib2sNV_remap_index 295 +#define VertexAttrib2svNV_remap_index 296 +#define VertexAttrib3dNV_remap_index 297 +#define VertexAttrib3dvNV_remap_index 298 +#define VertexAttrib3fNV_remap_index 299 +#define VertexAttrib3fvNV_remap_index 300 +#define VertexAttrib3sNV_remap_index 301 +#define VertexAttrib3svNV_remap_index 302 +#define VertexAttrib4dNV_remap_index 303 +#define VertexAttrib4dvNV_remap_index 304 +#define VertexAttrib4fNV_remap_index 305 +#define VertexAttrib4fvNV_remap_index 306 +#define VertexAttrib4sNV_remap_index 307 +#define VertexAttrib4svNV_remap_index 308 +#define VertexAttrib4ubNV_remap_index 309 +#define VertexAttrib4ubvNV_remap_index 310 +#define VertexAttribPointerNV_remap_index 311 +#define VertexAttribs1dvNV_remap_index 312 +#define VertexAttribs1fvNV_remap_index 313 +#define VertexAttribs1svNV_remap_index 314 +#define VertexAttribs2dvNV_remap_index 315 +#define VertexAttribs2fvNV_remap_index 316 +#define VertexAttribs2svNV_remap_index 317 +#define VertexAttribs3dvNV_remap_index 318 +#define VertexAttribs3fvNV_remap_index 319 +#define VertexAttribs3svNV_remap_index 320 +#define VertexAttribs4dvNV_remap_index 321 +#define VertexAttribs4fvNV_remap_index 322 +#define VertexAttribs4svNV_remap_index 323 +#define VertexAttribs4ubvNV_remap_index 324 +#define GetTexBumpParameterfvATI_remap_index 325 +#define GetTexBumpParameterivATI_remap_index 326 +#define TexBumpParameterfvATI_remap_index 327 +#define TexBumpParameterivATI_remap_index 328 +#define AlphaFragmentOp1ATI_remap_index 329 +#define AlphaFragmentOp2ATI_remap_index 330 +#define AlphaFragmentOp3ATI_remap_index 331 +#define BeginFragmentShaderATI_remap_index 332 +#define BindFragmentShaderATI_remap_index 333 +#define ColorFragmentOp1ATI_remap_index 334 +#define ColorFragmentOp2ATI_remap_index 335 +#define ColorFragmentOp3ATI_remap_index 336 +#define DeleteFragmentShaderATI_remap_index 337 +#define EndFragmentShaderATI_remap_index 338 +#define GenFragmentShadersATI_remap_index 339 +#define PassTexCoordATI_remap_index 340 +#define SampleMapATI_remap_index 341 +#define SetFragmentShaderConstantATI_remap_index 342 +#define PointParameteriNV_remap_index 343 +#define PointParameterivNV_remap_index 344 +#define ActiveStencilFaceEXT_remap_index 345 +#define BindVertexArrayAPPLE_remap_index 346 +#define DeleteVertexArraysAPPLE_remap_index 347 +#define GenVertexArraysAPPLE_remap_index 348 +#define IsVertexArrayAPPLE_remap_index 349 +#define GetProgramNamedParameterdvNV_remap_index 350 +#define GetProgramNamedParameterfvNV_remap_index 351 +#define ProgramNamedParameter4dNV_remap_index 352 +#define ProgramNamedParameter4dvNV_remap_index 353 +#define ProgramNamedParameter4fNV_remap_index 354 +#define ProgramNamedParameter4fvNV_remap_index 355 +#define DepthBoundsEXT_remap_index 356 +#define BlendEquationSeparateEXT_remap_index 357 +#define BindFramebufferEXT_remap_index 358 +#define BindRenderbufferEXT_remap_index 359 +#define CheckFramebufferStatusEXT_remap_index 360 +#define DeleteFramebuffersEXT_remap_index 361 +#define DeleteRenderbuffersEXT_remap_index 362 +#define FramebufferRenderbufferEXT_remap_index 363 +#define FramebufferTexture1DEXT_remap_index 364 +#define FramebufferTexture2DEXT_remap_index 365 +#define FramebufferTexture3DEXT_remap_index 366 +#define GenFramebuffersEXT_remap_index 367 +#define GenRenderbuffersEXT_remap_index 368 +#define GenerateMipmapEXT_remap_index 369 +#define GetFramebufferAttachmentParameterivEXT_remap_index 370 +#define GetRenderbufferParameterivEXT_remap_index 371 +#define IsFramebufferEXT_remap_index 372 +#define IsRenderbufferEXT_remap_index 373 +#define RenderbufferStorageEXT_remap_index 374 +#define BlitFramebufferEXT_remap_index 375 +#define BufferParameteriAPPLE_remap_index 376 +#define FlushMappedBufferRangeAPPLE_remap_index 377 +#define FramebufferTextureLayerEXT_remap_index 378 +#define ProvokingVertexEXT_remap_index 379 +#define GetTexParameterPointervAPPLE_remap_index 380 +#define TextureRangeAPPLE_remap_index 381 +#define StencilFuncSeparateATI_remap_index 382 +#define ProgramEnvParameters4fvEXT_remap_index 383 +#define ProgramLocalParameters4fvEXT_remap_index 384 +#define GetQueryObjecti64vEXT_remap_index 385 +#define GetQueryObjectui64vEXT_remap_index 386 + +#define CALL_AttachShader(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint)), driDispatchRemapTable[AttachShader_remap_index], parameters) +#define GET_AttachShader(disp) GET_by_offset(disp, driDispatchRemapTable[AttachShader_remap_index]) +#define SET_AttachShader(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AttachShader_remap_index], fn) +#define CALL_CreateProgram(disp, parameters) CALL_by_offset(disp, (GLuint (GLAPIENTRYP)(void)), driDispatchRemapTable[CreateProgram_remap_index], parameters) +#define GET_CreateProgram(disp) GET_by_offset(disp, driDispatchRemapTable[CreateProgram_remap_index]) +#define SET_CreateProgram(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CreateProgram_remap_index], fn) +#define CALL_CreateShader(disp, parameters) CALL_by_offset(disp, (GLuint (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[CreateShader_remap_index], parameters) +#define GET_CreateShader(disp) GET_by_offset(disp, driDispatchRemapTable[CreateShader_remap_index]) +#define SET_CreateShader(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CreateShader_remap_index], fn) +#define CALL_DeleteProgram(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[DeleteProgram_remap_index], parameters) +#define GET_DeleteProgram(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteProgram_remap_index]) +#define SET_DeleteProgram(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteProgram_remap_index], fn) +#define CALL_DeleteShader(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[DeleteShader_remap_index], parameters) +#define GET_DeleteShader(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteShader_remap_index]) +#define SET_DeleteShader(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteShader_remap_index], fn) +#define CALL_DetachShader(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint)), driDispatchRemapTable[DetachShader_remap_index], parameters) +#define GET_DetachShader(disp) GET_by_offset(disp, driDispatchRemapTable[DetachShader_remap_index]) +#define SET_DetachShader(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DetachShader_remap_index], fn) +#define CALL_GetAttachedShaders(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, GLsizei *, GLuint *)), driDispatchRemapTable[GetAttachedShaders_remap_index], parameters) +#define GET_GetAttachedShaders(disp) GET_by_offset(disp, driDispatchRemapTable[GetAttachedShaders_remap_index]) +#define SET_GetAttachedShaders(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetAttachedShaders_remap_index], fn) +#define CALL_GetProgramInfoLog(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, GLsizei *, GLchar *)), driDispatchRemapTable[GetProgramInfoLog_remap_index], parameters) +#define GET_GetProgramInfoLog(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramInfoLog_remap_index]) +#define SET_GetProgramInfoLog(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramInfoLog_remap_index], fn) +#define CALL_GetProgramiv(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetProgramiv_remap_index], parameters) +#define GET_GetProgramiv(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramiv_remap_index]) +#define SET_GetProgramiv(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramiv_remap_index], fn) +#define CALL_GetShaderInfoLog(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, GLsizei *, GLchar *)), driDispatchRemapTable[GetShaderInfoLog_remap_index], parameters) +#define GET_GetShaderInfoLog(disp) GET_by_offset(disp, driDispatchRemapTable[GetShaderInfoLog_remap_index]) +#define SET_GetShaderInfoLog(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetShaderInfoLog_remap_index], fn) +#define CALL_GetShaderiv(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetShaderiv_remap_index], parameters) +#define GET_GetShaderiv(disp) GET_by_offset(disp, driDispatchRemapTable[GetShaderiv_remap_index]) +#define SET_GetShaderiv(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetShaderiv_remap_index], fn) +#define CALL_IsProgram(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsProgram_remap_index], parameters) +#define GET_IsProgram(disp) GET_by_offset(disp, driDispatchRemapTable[IsProgram_remap_index]) +#define SET_IsProgram(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsProgram_remap_index], fn) +#define CALL_IsShader(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsShader_remap_index], parameters) +#define GET_IsShader(disp) GET_by_offset(disp, driDispatchRemapTable[IsShader_remap_index]) +#define SET_IsShader(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsShader_remap_index], fn) +#define CALL_StencilFuncSeparate(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint, GLuint)), driDispatchRemapTable[StencilFuncSeparate_remap_index], parameters) +#define GET_StencilFuncSeparate(disp) GET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparate_remap_index]) +#define SET_StencilFuncSeparate(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparate_remap_index], fn) +#define CALL_StencilMaskSeparate(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[StencilMaskSeparate_remap_index], parameters) +#define GET_StencilMaskSeparate(disp) GET_by_offset(disp, driDispatchRemapTable[StencilMaskSeparate_remap_index]) +#define SET_StencilMaskSeparate(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilMaskSeparate_remap_index], fn) +#define CALL_StencilOpSeparate(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum)), driDispatchRemapTable[StencilOpSeparate_remap_index], parameters) +#define GET_StencilOpSeparate(disp) GET_by_offset(disp, driDispatchRemapTable[StencilOpSeparate_remap_index]) +#define SET_StencilOpSeparate(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilOpSeparate_remap_index], fn) +#define CALL_UniformMatrix2x3fv(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix2x3fv_remap_index], parameters) +#define GET_UniformMatrix2x3fv(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix2x3fv_remap_index]) +#define SET_UniformMatrix2x3fv(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix2x3fv_remap_index], fn) +#define CALL_UniformMatrix2x4fv(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix2x4fv_remap_index], parameters) +#define GET_UniformMatrix2x4fv(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix2x4fv_remap_index]) +#define SET_UniformMatrix2x4fv(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix2x4fv_remap_index], fn) +#define CALL_UniformMatrix3x2fv(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix3x2fv_remap_index], parameters) +#define GET_UniformMatrix3x2fv(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix3x2fv_remap_index]) +#define SET_UniformMatrix3x2fv(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix3x2fv_remap_index], fn) +#define CALL_UniformMatrix3x4fv(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix3x4fv_remap_index], parameters) +#define GET_UniformMatrix3x4fv(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix3x4fv_remap_index]) +#define SET_UniformMatrix3x4fv(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix3x4fv_remap_index], fn) +#define CALL_UniformMatrix4x2fv(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix4x2fv_remap_index], parameters) +#define GET_UniformMatrix4x2fv(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix4x2fv_remap_index]) +#define SET_UniformMatrix4x2fv(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix4x2fv_remap_index], fn) +#define CALL_UniformMatrix4x3fv(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix4x3fv_remap_index], parameters) +#define GET_UniformMatrix4x3fv(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix4x3fv_remap_index]) +#define SET_UniformMatrix4x3fv(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix4x3fv_remap_index], fn) +#define CALL_LoadTransposeMatrixdARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[LoadTransposeMatrixdARB_remap_index], parameters) +#define GET_LoadTransposeMatrixdARB(disp) GET_by_offset(disp, driDispatchRemapTable[LoadTransposeMatrixdARB_remap_index]) +#define SET_LoadTransposeMatrixdARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LoadTransposeMatrixdARB_remap_index], fn) +#define CALL_LoadTransposeMatrixfARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[LoadTransposeMatrixfARB_remap_index], parameters) +#define GET_LoadTransposeMatrixfARB(disp) GET_by_offset(disp, driDispatchRemapTable[LoadTransposeMatrixfARB_remap_index]) +#define SET_LoadTransposeMatrixfARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LoadTransposeMatrixfARB_remap_index], fn) +#define CALL_MultTransposeMatrixdARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[MultTransposeMatrixdARB_remap_index], parameters) +#define GET_MultTransposeMatrixdARB(disp) GET_by_offset(disp, driDispatchRemapTable[MultTransposeMatrixdARB_remap_index]) +#define SET_MultTransposeMatrixdARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultTransposeMatrixdARB_remap_index], fn) +#define CALL_MultTransposeMatrixfARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[MultTransposeMatrixfARB_remap_index], parameters) +#define GET_MultTransposeMatrixfARB(disp) GET_by_offset(disp, driDispatchRemapTable[MultTransposeMatrixfARB_remap_index]) +#define SET_MultTransposeMatrixfARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultTransposeMatrixfARB_remap_index], fn) +#define CALL_SampleCoverageARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLclampf, GLboolean)), driDispatchRemapTable[SampleCoverageARB_remap_index], parameters) +#define GET_SampleCoverageARB(disp) GET_by_offset(disp, driDispatchRemapTable[SampleCoverageARB_remap_index]) +#define SET_SampleCoverageARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SampleCoverageARB_remap_index], fn) +#define CALL_CompressedTexImage1DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLint, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexImage1DARB_remap_index], parameters) +#define GET_CompressedTexImage1DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexImage1DARB_remap_index]) +#define SET_CompressedTexImage1DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexImage1DARB_remap_index], fn) +#define CALL_CompressedTexImage2DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexImage2DARB_remap_index], parameters) +#define GET_CompressedTexImage2DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexImage2DARB_remap_index]) +#define SET_CompressedTexImage2DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexImage2DARB_remap_index], fn) +#define CALL_CompressedTexImage3DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexImage3DARB_remap_index], parameters) +#define GET_CompressedTexImage3DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexImage3DARB_remap_index]) +#define SET_CompressedTexImage3DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexImage3DARB_remap_index], fn) +#define CALL_CompressedTexSubImage1DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLint, GLsizei, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexSubImage1DARB_remap_index], parameters) +#define GET_CompressedTexSubImage1DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage1DARB_remap_index]) +#define SET_CompressedTexSubImage1DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage1DARB_remap_index], fn) +#define CALL_CompressedTexSubImage2DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexSubImage2DARB_remap_index], parameters) +#define GET_CompressedTexSubImage2DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage2DARB_remap_index]) +#define SET_CompressedTexSubImage2DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage2DARB_remap_index], fn) +#define CALL_CompressedTexSubImage3DARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[CompressedTexSubImage3DARB_remap_index], parameters) +#define GET_CompressedTexSubImage3DARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage3DARB_remap_index]) +#define SET_CompressedTexSubImage3DARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompressedTexSubImage3DARB_remap_index], fn) +#define CALL_GetCompressedTexImageARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint, GLvoid *)), driDispatchRemapTable[GetCompressedTexImageARB_remap_index], parameters) +#define GET_GetCompressedTexImageARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetCompressedTexImageARB_remap_index]) +#define SET_GetCompressedTexImageARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetCompressedTexImageARB_remap_index], fn) +#define CALL_DisableVertexAttribArrayARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[DisableVertexAttribArrayARB_remap_index], parameters) +#define GET_DisableVertexAttribArrayARB(disp) GET_by_offset(disp, driDispatchRemapTable[DisableVertexAttribArrayARB_remap_index]) +#define SET_DisableVertexAttribArrayARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DisableVertexAttribArrayARB_remap_index], fn) +#define CALL_EnableVertexAttribArrayARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[EnableVertexAttribArrayARB_remap_index], parameters) +#define GET_EnableVertexAttribArrayARB(disp) GET_by_offset(disp, driDispatchRemapTable[EnableVertexAttribArrayARB_remap_index]) +#define SET_EnableVertexAttribArrayARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[EnableVertexAttribArrayARB_remap_index], fn) +#define CALL_GetProgramEnvParameterdvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLdouble *)), driDispatchRemapTable[GetProgramEnvParameterdvARB_remap_index], parameters) +#define GET_GetProgramEnvParameterdvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramEnvParameterdvARB_remap_index]) +#define SET_GetProgramEnvParameterdvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramEnvParameterdvARB_remap_index], fn) +#define CALL_GetProgramEnvParameterfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLfloat *)), driDispatchRemapTable[GetProgramEnvParameterfvARB_remap_index], parameters) +#define GET_GetProgramEnvParameterfvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramEnvParameterfvARB_remap_index]) +#define SET_GetProgramEnvParameterfvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramEnvParameterfvARB_remap_index], fn) +#define CALL_GetProgramLocalParameterdvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLdouble *)), driDispatchRemapTable[GetProgramLocalParameterdvARB_remap_index], parameters) +#define GET_GetProgramLocalParameterdvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramLocalParameterdvARB_remap_index]) +#define SET_GetProgramLocalParameterdvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramLocalParameterdvARB_remap_index], fn) +#define CALL_GetProgramLocalParameterfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLfloat *)), driDispatchRemapTable[GetProgramLocalParameterfvARB_remap_index], parameters) +#define GET_GetProgramLocalParameterfvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramLocalParameterfvARB_remap_index]) +#define SET_GetProgramLocalParameterfvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramLocalParameterfvARB_remap_index], fn) +#define CALL_GetProgramStringARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLvoid *)), driDispatchRemapTable[GetProgramStringARB_remap_index], parameters) +#define GET_GetProgramStringARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramStringARB_remap_index]) +#define SET_GetProgramStringARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramStringARB_remap_index], fn) +#define CALL_GetProgramivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetProgramivARB_remap_index], parameters) +#define GET_GetProgramivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramivARB_remap_index]) +#define SET_GetProgramivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramivARB_remap_index], fn) +#define CALL_GetVertexAttribdvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLdouble *)), driDispatchRemapTable[GetVertexAttribdvARB_remap_index], parameters) +#define GET_GetVertexAttribdvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribdvARB_remap_index]) +#define SET_GetVertexAttribdvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribdvARB_remap_index], fn) +#define CALL_GetVertexAttribfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLfloat *)), driDispatchRemapTable[GetVertexAttribfvARB_remap_index], parameters) +#define GET_GetVertexAttribfvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribfvARB_remap_index]) +#define SET_GetVertexAttribfvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribfvARB_remap_index], fn) +#define CALL_GetVertexAttribivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetVertexAttribivARB_remap_index], parameters) +#define GET_GetVertexAttribivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribivARB_remap_index]) +#define SET_GetVertexAttribivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribivARB_remap_index], fn) +#define CALL_ProgramEnvParameter4dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[ProgramEnvParameter4dARB_remap_index], parameters) +#define GET_ProgramEnvParameter4dARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4dARB_remap_index]) +#define SET_ProgramEnvParameter4dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4dARB_remap_index], fn) +#define CALL_ProgramEnvParameter4dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLdouble *)), driDispatchRemapTable[ProgramEnvParameter4dvARB_remap_index], parameters) +#define GET_ProgramEnvParameter4dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4dvARB_remap_index]) +#define SET_ProgramEnvParameter4dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4dvARB_remap_index], fn) +#define CALL_ProgramEnvParameter4fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[ProgramEnvParameter4fARB_remap_index], parameters) +#define GET_ProgramEnvParameter4fARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4fARB_remap_index]) +#define SET_ProgramEnvParameter4fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4fARB_remap_index], fn) +#define CALL_ProgramEnvParameter4fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLfloat *)), driDispatchRemapTable[ProgramEnvParameter4fvARB_remap_index], parameters) +#define GET_ProgramEnvParameter4fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4fvARB_remap_index]) +#define SET_ProgramEnvParameter4fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameter4fvARB_remap_index], fn) +#define CALL_ProgramLocalParameter4dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[ProgramLocalParameter4dARB_remap_index], parameters) +#define GET_ProgramLocalParameter4dARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4dARB_remap_index]) +#define SET_ProgramLocalParameter4dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4dARB_remap_index], fn) +#define CALL_ProgramLocalParameter4dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLdouble *)), driDispatchRemapTable[ProgramLocalParameter4dvARB_remap_index], parameters) +#define GET_ProgramLocalParameter4dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4dvARB_remap_index]) +#define SET_ProgramLocalParameter4dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4dvARB_remap_index], fn) +#define CALL_ProgramLocalParameter4fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[ProgramLocalParameter4fARB_remap_index], parameters) +#define GET_ProgramLocalParameter4fARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4fARB_remap_index]) +#define SET_ProgramLocalParameter4fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4fARB_remap_index], fn) +#define CALL_ProgramLocalParameter4fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLfloat *)), driDispatchRemapTable[ProgramLocalParameter4fvARB_remap_index], parameters) +#define GET_ProgramLocalParameter4fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4fvARB_remap_index]) +#define SET_ProgramLocalParameter4fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameter4fvARB_remap_index], fn) +#define CALL_ProgramStringARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[ProgramStringARB_remap_index], parameters) +#define GET_ProgramStringARB(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramStringARB_remap_index]) +#define SET_ProgramStringARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramStringARB_remap_index], fn) +#define CALL_VertexAttrib1dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble)), driDispatchRemapTable[VertexAttrib1dARB_remap_index], parameters) +#define GET_VertexAttrib1dARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dARB_remap_index]) +#define SET_VertexAttrib1dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dARB_remap_index], fn) +#define CALL_VertexAttrib1dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib1dvARB_remap_index], parameters) +#define GET_VertexAttrib1dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dvARB_remap_index]) +#define SET_VertexAttrib1dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dvARB_remap_index], fn) +#define CALL_VertexAttrib1fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat)), driDispatchRemapTable[VertexAttrib1fARB_remap_index], parameters) +#define GET_VertexAttrib1fARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fARB_remap_index]) +#define SET_VertexAttrib1fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fARB_remap_index], fn) +#define CALL_VertexAttrib1fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib1fvARB_remap_index], parameters) +#define GET_VertexAttrib1fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fvARB_remap_index]) +#define SET_VertexAttrib1fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fvARB_remap_index], fn) +#define CALL_VertexAttrib1sARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort)), driDispatchRemapTable[VertexAttrib1sARB_remap_index], parameters) +#define GET_VertexAttrib1sARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1sARB_remap_index]) +#define SET_VertexAttrib1sARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1sARB_remap_index], fn) +#define CALL_VertexAttrib1svARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib1svARB_remap_index], parameters) +#define GET_VertexAttrib1svARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1svARB_remap_index]) +#define SET_VertexAttrib1svARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1svARB_remap_index], fn) +#define CALL_VertexAttrib2dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib2dARB_remap_index], parameters) +#define GET_VertexAttrib2dARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dARB_remap_index]) +#define SET_VertexAttrib2dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dARB_remap_index], fn) +#define CALL_VertexAttrib2dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib2dvARB_remap_index], parameters) +#define GET_VertexAttrib2dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dvARB_remap_index]) +#define SET_VertexAttrib2dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dvARB_remap_index], fn) +#define CALL_VertexAttrib2fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib2fARB_remap_index], parameters) +#define GET_VertexAttrib2fARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fARB_remap_index]) +#define SET_VertexAttrib2fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fARB_remap_index], fn) +#define CALL_VertexAttrib2fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib2fvARB_remap_index], parameters) +#define GET_VertexAttrib2fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fvARB_remap_index]) +#define SET_VertexAttrib2fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fvARB_remap_index], fn) +#define CALL_VertexAttrib2sARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib2sARB_remap_index], parameters) +#define GET_VertexAttrib2sARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2sARB_remap_index]) +#define SET_VertexAttrib2sARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2sARB_remap_index], fn) +#define CALL_VertexAttrib2svARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib2svARB_remap_index], parameters) +#define GET_VertexAttrib2svARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2svARB_remap_index]) +#define SET_VertexAttrib2svARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2svARB_remap_index], fn) +#define CALL_VertexAttrib3dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib3dARB_remap_index], parameters) +#define GET_VertexAttrib3dARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dARB_remap_index]) +#define SET_VertexAttrib3dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dARB_remap_index], fn) +#define CALL_VertexAttrib3dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib3dvARB_remap_index], parameters) +#define GET_VertexAttrib3dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dvARB_remap_index]) +#define SET_VertexAttrib3dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dvARB_remap_index], fn) +#define CALL_VertexAttrib3fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib3fARB_remap_index], parameters) +#define GET_VertexAttrib3fARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fARB_remap_index]) +#define SET_VertexAttrib3fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fARB_remap_index], fn) +#define CALL_VertexAttrib3fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib3fvARB_remap_index], parameters) +#define GET_VertexAttrib3fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fvARB_remap_index]) +#define SET_VertexAttrib3fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fvARB_remap_index], fn) +#define CALL_VertexAttrib3sARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib3sARB_remap_index], parameters) +#define GET_VertexAttrib3sARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3sARB_remap_index]) +#define SET_VertexAttrib3sARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3sARB_remap_index], fn) +#define CALL_VertexAttrib3svARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib3svARB_remap_index], parameters) +#define GET_VertexAttrib3svARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3svARB_remap_index]) +#define SET_VertexAttrib3svARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3svARB_remap_index], fn) +#define CALL_VertexAttrib4NbvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLbyte *)), driDispatchRemapTable[VertexAttrib4NbvARB_remap_index], parameters) +#define GET_VertexAttrib4NbvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NbvARB_remap_index]) +#define SET_VertexAttrib4NbvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NbvARB_remap_index], fn) +#define CALL_VertexAttrib4NivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLint *)), driDispatchRemapTable[VertexAttrib4NivARB_remap_index], parameters) +#define GET_VertexAttrib4NivARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NivARB_remap_index]) +#define SET_VertexAttrib4NivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NivARB_remap_index], fn) +#define CALL_VertexAttrib4NsvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib4NsvARB_remap_index], parameters) +#define GET_VertexAttrib4NsvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NsvARB_remap_index]) +#define SET_VertexAttrib4NsvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NsvARB_remap_index], fn) +#define CALL_VertexAttrib4NubARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte)), driDispatchRemapTable[VertexAttrib4NubARB_remap_index], parameters) +#define GET_VertexAttrib4NubARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NubARB_remap_index]) +#define SET_VertexAttrib4NubARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NubARB_remap_index], fn) +#define CALL_VertexAttrib4NubvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLubyte *)), driDispatchRemapTable[VertexAttrib4NubvARB_remap_index], parameters) +#define GET_VertexAttrib4NubvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NubvARB_remap_index]) +#define SET_VertexAttrib4NubvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NubvARB_remap_index], fn) +#define CALL_VertexAttrib4NuivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLuint *)), driDispatchRemapTable[VertexAttrib4NuivARB_remap_index], parameters) +#define GET_VertexAttrib4NuivARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NuivARB_remap_index]) +#define SET_VertexAttrib4NuivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NuivARB_remap_index], fn) +#define CALL_VertexAttrib4NusvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLushort *)), driDispatchRemapTable[VertexAttrib4NusvARB_remap_index], parameters) +#define GET_VertexAttrib4NusvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NusvARB_remap_index]) +#define SET_VertexAttrib4NusvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4NusvARB_remap_index], fn) +#define CALL_VertexAttrib4bvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLbyte *)), driDispatchRemapTable[VertexAttrib4bvARB_remap_index], parameters) +#define GET_VertexAttrib4bvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4bvARB_remap_index]) +#define SET_VertexAttrib4bvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4bvARB_remap_index], fn) +#define CALL_VertexAttrib4dARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib4dARB_remap_index], parameters) +#define GET_VertexAttrib4dARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dARB_remap_index]) +#define SET_VertexAttrib4dARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dARB_remap_index], fn) +#define CALL_VertexAttrib4dvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib4dvARB_remap_index], parameters) +#define GET_VertexAttrib4dvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dvARB_remap_index]) +#define SET_VertexAttrib4dvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dvARB_remap_index], fn) +#define CALL_VertexAttrib4fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib4fARB_remap_index], parameters) +#define GET_VertexAttrib4fARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fARB_remap_index]) +#define SET_VertexAttrib4fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fARB_remap_index], fn) +#define CALL_VertexAttrib4fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib4fvARB_remap_index], parameters) +#define GET_VertexAttrib4fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fvARB_remap_index]) +#define SET_VertexAttrib4fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fvARB_remap_index], fn) +#define CALL_VertexAttrib4ivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLint *)), driDispatchRemapTable[VertexAttrib4ivARB_remap_index], parameters) +#define GET_VertexAttrib4ivARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ivARB_remap_index]) +#define SET_VertexAttrib4ivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ivARB_remap_index], fn) +#define CALL_VertexAttrib4sARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib4sARB_remap_index], parameters) +#define GET_VertexAttrib4sARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4sARB_remap_index]) +#define SET_VertexAttrib4sARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4sARB_remap_index], fn) +#define CALL_VertexAttrib4svARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib4svARB_remap_index], parameters) +#define GET_VertexAttrib4svARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4svARB_remap_index]) +#define SET_VertexAttrib4svARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4svARB_remap_index], fn) +#define CALL_VertexAttrib4ubvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLubyte *)), driDispatchRemapTable[VertexAttrib4ubvARB_remap_index], parameters) +#define GET_VertexAttrib4ubvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubvARB_remap_index]) +#define SET_VertexAttrib4ubvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubvARB_remap_index], fn) +#define CALL_VertexAttrib4uivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLuint *)), driDispatchRemapTable[VertexAttrib4uivARB_remap_index], parameters) +#define GET_VertexAttrib4uivARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4uivARB_remap_index]) +#define SET_VertexAttrib4uivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4uivARB_remap_index], fn) +#define CALL_VertexAttrib4usvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLushort *)), driDispatchRemapTable[VertexAttrib4usvARB_remap_index], parameters) +#define GET_VertexAttrib4usvARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4usvARB_remap_index]) +#define SET_VertexAttrib4usvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4usvARB_remap_index], fn) +#define CALL_VertexAttribPointerARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *)), driDispatchRemapTable[VertexAttribPointerARB_remap_index], parameters) +#define GET_VertexAttribPointerARB(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribPointerARB_remap_index]) +#define SET_VertexAttribPointerARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribPointerARB_remap_index], fn) +#define CALL_BindBufferARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[BindBufferARB_remap_index], parameters) +#define GET_BindBufferARB(disp) GET_by_offset(disp, driDispatchRemapTable[BindBufferARB_remap_index]) +#define SET_BindBufferARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindBufferARB_remap_index], fn) +#define CALL_BufferDataARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizeiptrARB, const GLvoid *, GLenum)), driDispatchRemapTable[BufferDataARB_remap_index], parameters) +#define GET_BufferDataARB(disp) GET_by_offset(disp, driDispatchRemapTable[BufferDataARB_remap_index]) +#define SET_BufferDataARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BufferDataARB_remap_index], fn) +#define CALL_BufferSubDataARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLintptrARB, GLsizeiptrARB, const GLvoid *)), driDispatchRemapTable[BufferSubDataARB_remap_index], parameters) +#define GET_BufferSubDataARB(disp) GET_by_offset(disp, driDispatchRemapTable[BufferSubDataARB_remap_index]) +#define SET_BufferSubDataARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BufferSubDataARB_remap_index], fn) +#define CALL_DeleteBuffersARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteBuffersARB_remap_index], parameters) +#define GET_DeleteBuffersARB(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteBuffersARB_remap_index]) +#define SET_DeleteBuffersARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteBuffersARB_remap_index], fn) +#define CALL_GenBuffersARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenBuffersARB_remap_index], parameters) +#define GET_GenBuffersARB(disp) GET_by_offset(disp, driDispatchRemapTable[GenBuffersARB_remap_index]) +#define SET_GenBuffersARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenBuffersARB_remap_index], fn) +#define CALL_GetBufferParameterivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetBufferParameterivARB_remap_index], parameters) +#define GET_GetBufferParameterivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetBufferParameterivARB_remap_index]) +#define SET_GetBufferParameterivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetBufferParameterivARB_remap_index], fn) +#define CALL_GetBufferPointervARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLvoid **)), driDispatchRemapTable[GetBufferPointervARB_remap_index], parameters) +#define GET_GetBufferPointervARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetBufferPointervARB_remap_index]) +#define SET_GetBufferPointervARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetBufferPointervARB_remap_index], fn) +#define CALL_GetBufferSubDataARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLintptrARB, GLsizeiptrARB, GLvoid *)), driDispatchRemapTable[GetBufferSubDataARB_remap_index], parameters) +#define GET_GetBufferSubDataARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetBufferSubDataARB_remap_index]) +#define SET_GetBufferSubDataARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetBufferSubDataARB_remap_index], fn) +#define CALL_IsBufferARB(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsBufferARB_remap_index], parameters) +#define GET_IsBufferARB(disp) GET_by_offset(disp, driDispatchRemapTable[IsBufferARB_remap_index]) +#define SET_IsBufferARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsBufferARB_remap_index], fn) +#define CALL_MapBufferARB(disp, parameters) CALL_by_offset(disp, (GLvoid * (GLAPIENTRYP)(GLenum, GLenum)), driDispatchRemapTable[MapBufferARB_remap_index], parameters) +#define GET_MapBufferARB(disp) GET_by_offset(disp, driDispatchRemapTable[MapBufferARB_remap_index]) +#define SET_MapBufferARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MapBufferARB_remap_index], fn) +#define CALL_UnmapBufferARB(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[UnmapBufferARB_remap_index], parameters) +#define GET_UnmapBufferARB(disp) GET_by_offset(disp, driDispatchRemapTable[UnmapBufferARB_remap_index]) +#define SET_UnmapBufferARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UnmapBufferARB_remap_index], fn) +#define CALL_BeginQueryARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[BeginQueryARB_remap_index], parameters) +#define GET_BeginQueryARB(disp) GET_by_offset(disp, driDispatchRemapTable[BeginQueryARB_remap_index]) +#define SET_BeginQueryARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BeginQueryARB_remap_index], fn) +#define CALL_DeleteQueriesARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteQueriesARB_remap_index], parameters) +#define GET_DeleteQueriesARB(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteQueriesARB_remap_index]) +#define SET_DeleteQueriesARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteQueriesARB_remap_index], fn) +#define CALL_EndQueryARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[EndQueryARB_remap_index], parameters) +#define GET_EndQueryARB(disp) GET_by_offset(disp, driDispatchRemapTable[EndQueryARB_remap_index]) +#define SET_EndQueryARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[EndQueryARB_remap_index], fn) +#define CALL_GenQueriesARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenQueriesARB_remap_index], parameters) +#define GET_GenQueriesARB(disp) GET_by_offset(disp, driDispatchRemapTable[GenQueriesARB_remap_index]) +#define SET_GenQueriesARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenQueriesARB_remap_index], fn) +#define CALL_GetQueryObjectivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetQueryObjectivARB_remap_index], parameters) +#define GET_GetQueryObjectivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetQueryObjectivARB_remap_index]) +#define SET_GetQueryObjectivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetQueryObjectivARB_remap_index], fn) +#define CALL_GetQueryObjectuivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLuint *)), driDispatchRemapTable[GetQueryObjectuivARB_remap_index], parameters) +#define GET_GetQueryObjectuivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetQueryObjectuivARB_remap_index]) +#define SET_GetQueryObjectuivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetQueryObjectuivARB_remap_index], fn) +#define CALL_GetQueryivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetQueryivARB_remap_index], parameters) +#define GET_GetQueryivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetQueryivARB_remap_index]) +#define SET_GetQueryivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetQueryivARB_remap_index], fn) +#define CALL_IsQueryARB(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsQueryARB_remap_index], parameters) +#define GET_IsQueryARB(disp) GET_by_offset(disp, driDispatchRemapTable[IsQueryARB_remap_index]) +#define SET_IsQueryARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsQueryARB_remap_index], fn) +#define CALL_AttachObjectARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLhandleARB)), driDispatchRemapTable[AttachObjectARB_remap_index], parameters) +#define GET_AttachObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[AttachObjectARB_remap_index]) +#define SET_AttachObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AttachObjectARB_remap_index], fn) +#define CALL_CompileShaderARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB)), driDispatchRemapTable[CompileShaderARB_remap_index], parameters) +#define GET_CompileShaderARB(disp) GET_by_offset(disp, driDispatchRemapTable[CompileShaderARB_remap_index]) +#define SET_CompileShaderARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CompileShaderARB_remap_index], fn) +#define CALL_CreateProgramObjectARB(disp, parameters) CALL_by_offset(disp, (GLhandleARB (GLAPIENTRYP)(void)), driDispatchRemapTable[CreateProgramObjectARB_remap_index], parameters) +#define GET_CreateProgramObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[CreateProgramObjectARB_remap_index]) +#define SET_CreateProgramObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CreateProgramObjectARB_remap_index], fn) +#define CALL_CreateShaderObjectARB(disp, parameters) CALL_by_offset(disp, (GLhandleARB (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[CreateShaderObjectARB_remap_index], parameters) +#define GET_CreateShaderObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[CreateShaderObjectARB_remap_index]) +#define SET_CreateShaderObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CreateShaderObjectARB_remap_index], fn) +#define CALL_DeleteObjectARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB)), driDispatchRemapTable[DeleteObjectARB_remap_index], parameters) +#define GET_DeleteObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteObjectARB_remap_index]) +#define SET_DeleteObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteObjectARB_remap_index], fn) +#define CALL_DetachObjectARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLhandleARB)), driDispatchRemapTable[DetachObjectARB_remap_index], parameters) +#define GET_DetachObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[DetachObjectARB_remap_index]) +#define SET_DetachObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DetachObjectARB_remap_index], fn) +#define CALL_GetActiveUniformARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *)), driDispatchRemapTable[GetActiveUniformARB_remap_index], parameters) +#define GET_GetActiveUniformARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetActiveUniformARB_remap_index]) +#define SET_GetActiveUniformARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetActiveUniformARB_remap_index], fn) +#define CALL_GetAttachedObjectsARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLsizei, GLsizei *, GLhandleARB *)), driDispatchRemapTable[GetAttachedObjectsARB_remap_index], parameters) +#define GET_GetAttachedObjectsARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetAttachedObjectsARB_remap_index]) +#define SET_GetAttachedObjectsARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetAttachedObjectsARB_remap_index], fn) +#define CALL_GetHandleARB(disp, parameters) CALL_by_offset(disp, (GLhandleARB (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[GetHandleARB_remap_index], parameters) +#define GET_GetHandleARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetHandleARB_remap_index]) +#define SET_GetHandleARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetHandleARB_remap_index], fn) +#define CALL_GetInfoLogARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *)), driDispatchRemapTable[GetInfoLogARB_remap_index], parameters) +#define GET_GetInfoLogARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetInfoLogARB_remap_index]) +#define SET_GetInfoLogARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetInfoLogARB_remap_index], fn) +#define CALL_GetObjectParameterfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLenum, GLfloat *)), driDispatchRemapTable[GetObjectParameterfvARB_remap_index], parameters) +#define GET_GetObjectParameterfvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetObjectParameterfvARB_remap_index]) +#define SET_GetObjectParameterfvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetObjectParameterfvARB_remap_index], fn) +#define CALL_GetObjectParameterivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLenum, GLint *)), driDispatchRemapTable[GetObjectParameterivARB_remap_index], parameters) +#define GET_GetObjectParameterivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetObjectParameterivARB_remap_index]) +#define SET_GetObjectParameterivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetObjectParameterivARB_remap_index], fn) +#define CALL_GetShaderSourceARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLsizei, GLsizei *, GLcharARB *)), driDispatchRemapTable[GetShaderSourceARB_remap_index], parameters) +#define GET_GetShaderSourceARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetShaderSourceARB_remap_index]) +#define SET_GetShaderSourceARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetShaderSourceARB_remap_index], fn) +#define CALL_GetUniformLocationARB(disp, parameters) CALL_by_offset(disp, (GLint (GLAPIENTRYP)(GLhandleARB, const GLcharARB *)), driDispatchRemapTable[GetUniformLocationARB_remap_index], parameters) +#define GET_GetUniformLocationARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetUniformLocationARB_remap_index]) +#define SET_GetUniformLocationARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetUniformLocationARB_remap_index], fn) +#define CALL_GetUniformfvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLint, GLfloat *)), driDispatchRemapTable[GetUniformfvARB_remap_index], parameters) +#define GET_GetUniformfvARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetUniformfvARB_remap_index]) +#define SET_GetUniformfvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetUniformfvARB_remap_index], fn) +#define CALL_GetUniformivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLint, GLint *)), driDispatchRemapTable[GetUniformivARB_remap_index], parameters) +#define GET_GetUniformivARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetUniformivARB_remap_index]) +#define SET_GetUniformivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetUniformivARB_remap_index], fn) +#define CALL_LinkProgramARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB)), driDispatchRemapTable[LinkProgramARB_remap_index], parameters) +#define GET_LinkProgramARB(disp) GET_by_offset(disp, driDispatchRemapTable[LinkProgramARB_remap_index]) +#define SET_LinkProgramARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LinkProgramARB_remap_index], fn) +#define CALL_ShaderSourceARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLsizei, const GLcharARB **, const GLint *)), driDispatchRemapTable[ShaderSourceARB_remap_index], parameters) +#define GET_ShaderSourceARB(disp) GET_by_offset(disp, driDispatchRemapTable[ShaderSourceARB_remap_index]) +#define SET_ShaderSourceARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ShaderSourceARB_remap_index], fn) +#define CALL_Uniform1fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLfloat)), driDispatchRemapTable[Uniform1fARB_remap_index], parameters) +#define GET_Uniform1fARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform1fARB_remap_index]) +#define SET_Uniform1fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform1fARB_remap_index], fn) +#define CALL_Uniform1fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLfloat *)), driDispatchRemapTable[Uniform1fvARB_remap_index], parameters) +#define GET_Uniform1fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform1fvARB_remap_index]) +#define SET_Uniform1fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform1fvARB_remap_index], fn) +#define CALL_Uniform1iARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint)), driDispatchRemapTable[Uniform1iARB_remap_index], parameters) +#define GET_Uniform1iARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform1iARB_remap_index]) +#define SET_Uniform1iARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform1iARB_remap_index], fn) +#define CALL_Uniform1ivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLint *)), driDispatchRemapTable[Uniform1ivARB_remap_index], parameters) +#define GET_Uniform1ivARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform1ivARB_remap_index]) +#define SET_Uniform1ivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform1ivARB_remap_index], fn) +#define CALL_Uniform2fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLfloat, GLfloat)), driDispatchRemapTable[Uniform2fARB_remap_index], parameters) +#define GET_Uniform2fARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform2fARB_remap_index]) +#define SET_Uniform2fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform2fARB_remap_index], fn) +#define CALL_Uniform2fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLfloat *)), driDispatchRemapTable[Uniform2fvARB_remap_index], parameters) +#define GET_Uniform2fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform2fvARB_remap_index]) +#define SET_Uniform2fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform2fvARB_remap_index], fn) +#define CALL_Uniform2iARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint)), driDispatchRemapTable[Uniform2iARB_remap_index], parameters) +#define GET_Uniform2iARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform2iARB_remap_index]) +#define SET_Uniform2iARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform2iARB_remap_index], fn) +#define CALL_Uniform2ivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLint *)), driDispatchRemapTable[Uniform2ivARB_remap_index], parameters) +#define GET_Uniform2ivARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform2ivARB_remap_index]) +#define SET_Uniform2ivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform2ivARB_remap_index], fn) +#define CALL_Uniform3fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[Uniform3fARB_remap_index], parameters) +#define GET_Uniform3fARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform3fARB_remap_index]) +#define SET_Uniform3fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform3fARB_remap_index], fn) +#define CALL_Uniform3fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLfloat *)), driDispatchRemapTable[Uniform3fvARB_remap_index], parameters) +#define GET_Uniform3fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform3fvARB_remap_index]) +#define SET_Uniform3fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform3fvARB_remap_index], fn) +#define CALL_Uniform3iARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint, GLint)), driDispatchRemapTable[Uniform3iARB_remap_index], parameters) +#define GET_Uniform3iARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform3iARB_remap_index]) +#define SET_Uniform3iARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform3iARB_remap_index], fn) +#define CALL_Uniform3ivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLint *)), driDispatchRemapTable[Uniform3ivARB_remap_index], parameters) +#define GET_Uniform3ivARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform3ivARB_remap_index]) +#define SET_Uniform3ivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform3ivARB_remap_index], fn) +#define CALL_Uniform4fARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[Uniform4fARB_remap_index], parameters) +#define GET_Uniform4fARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform4fARB_remap_index]) +#define SET_Uniform4fARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform4fARB_remap_index], fn) +#define CALL_Uniform4fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLfloat *)), driDispatchRemapTable[Uniform4fvARB_remap_index], parameters) +#define GET_Uniform4fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform4fvARB_remap_index]) +#define SET_Uniform4fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform4fvARB_remap_index], fn) +#define CALL_Uniform4iARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint, GLint, GLint)), driDispatchRemapTable[Uniform4iARB_remap_index], parameters) +#define GET_Uniform4iARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform4iARB_remap_index]) +#define SET_Uniform4iARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform4iARB_remap_index], fn) +#define CALL_Uniform4ivARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, const GLint *)), driDispatchRemapTable[Uniform4ivARB_remap_index], parameters) +#define GET_Uniform4ivARB(disp) GET_by_offset(disp, driDispatchRemapTable[Uniform4ivARB_remap_index]) +#define SET_Uniform4ivARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[Uniform4ivARB_remap_index], fn) +#define CALL_UniformMatrix2fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix2fvARB_remap_index], parameters) +#define GET_UniformMatrix2fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix2fvARB_remap_index]) +#define SET_UniformMatrix2fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix2fvARB_remap_index], fn) +#define CALL_UniformMatrix3fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix3fvARB_remap_index], parameters) +#define GET_UniformMatrix3fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix3fvARB_remap_index]) +#define SET_UniformMatrix3fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix3fvARB_remap_index], fn) +#define CALL_UniformMatrix4fvARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei, GLboolean, const GLfloat *)), driDispatchRemapTable[UniformMatrix4fvARB_remap_index], parameters) +#define GET_UniformMatrix4fvARB(disp) GET_by_offset(disp, driDispatchRemapTable[UniformMatrix4fvARB_remap_index]) +#define SET_UniformMatrix4fvARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UniformMatrix4fvARB_remap_index], fn) +#define CALL_UseProgramObjectARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB)), driDispatchRemapTable[UseProgramObjectARB_remap_index], parameters) +#define GET_UseProgramObjectARB(disp) GET_by_offset(disp, driDispatchRemapTable[UseProgramObjectARB_remap_index]) +#define SET_UseProgramObjectARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UseProgramObjectARB_remap_index], fn) +#define CALL_ValidateProgramARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB)), driDispatchRemapTable[ValidateProgramARB_remap_index], parameters) +#define GET_ValidateProgramARB(disp) GET_by_offset(disp, driDispatchRemapTable[ValidateProgramARB_remap_index]) +#define SET_ValidateProgramARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ValidateProgramARB_remap_index], fn) +#define CALL_BindAttribLocationARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLuint, const GLcharARB *)), driDispatchRemapTable[BindAttribLocationARB_remap_index], parameters) +#define GET_BindAttribLocationARB(disp) GET_by_offset(disp, driDispatchRemapTable[BindAttribLocationARB_remap_index]) +#define SET_BindAttribLocationARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindAttribLocationARB_remap_index], fn) +#define CALL_GetActiveAttribARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLhandleARB, GLuint, GLsizei, GLsizei *, GLint *, GLenum *, GLcharARB *)), driDispatchRemapTable[GetActiveAttribARB_remap_index], parameters) +#define GET_GetActiveAttribARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetActiveAttribARB_remap_index]) +#define SET_GetActiveAttribARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetActiveAttribARB_remap_index], fn) +#define CALL_GetAttribLocationARB(disp, parameters) CALL_by_offset(disp, (GLint (GLAPIENTRYP)(GLhandleARB, const GLcharARB *)), driDispatchRemapTable[GetAttribLocationARB_remap_index], parameters) +#define GET_GetAttribLocationARB(disp) GET_by_offset(disp, driDispatchRemapTable[GetAttribLocationARB_remap_index]) +#define SET_GetAttribLocationARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetAttribLocationARB_remap_index], fn) +#define CALL_DrawBuffersARB(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLenum *)), driDispatchRemapTable[DrawBuffersARB_remap_index], parameters) +#define GET_DrawBuffersARB(disp) GET_by_offset(disp, driDispatchRemapTable[DrawBuffersARB_remap_index]) +#define SET_DrawBuffersARB(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DrawBuffersARB_remap_index], fn) +#define CALL_RenderbufferStorageMultisample(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, GLenum, GLsizei, GLsizei)), driDispatchRemapTable[RenderbufferStorageMultisample_remap_index], parameters) +#define GET_RenderbufferStorageMultisample(disp) GET_by_offset(disp, driDispatchRemapTable[RenderbufferStorageMultisample_remap_index]) +#define SET_RenderbufferStorageMultisample(disp, fn) SET_by_offset(disp, driDispatchRemapTable[RenderbufferStorageMultisample_remap_index], fn) +#define CALL_FlushMappedBufferRange(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLintptr, GLsizeiptr)), driDispatchRemapTable[FlushMappedBufferRange_remap_index], parameters) +#define GET_FlushMappedBufferRange(disp) GET_by_offset(disp, driDispatchRemapTable[FlushMappedBufferRange_remap_index]) +#define SET_FlushMappedBufferRange(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FlushMappedBufferRange_remap_index], fn) +#define CALL_MapBufferRange(disp, parameters) CALL_by_offset(disp, (GLvoid * (GLAPIENTRYP)(GLenum, GLintptr, GLsizeiptr, GLbitfield)), driDispatchRemapTable[MapBufferRange_remap_index], parameters) +#define GET_MapBufferRange(disp) GET_by_offset(disp, driDispatchRemapTable[MapBufferRange_remap_index]) +#define SET_MapBufferRange(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MapBufferRange_remap_index], fn) +#define CALL_BindVertexArray(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[BindVertexArray_remap_index], parameters) +#define GET_BindVertexArray(disp) GET_by_offset(disp, driDispatchRemapTable[BindVertexArray_remap_index]) +#define SET_BindVertexArray(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindVertexArray_remap_index], fn) +#define CALL_GenVertexArrays(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenVertexArrays_remap_index], parameters) +#define GET_GenVertexArrays(disp) GET_by_offset(disp, driDispatchRemapTable[GenVertexArrays_remap_index]) +#define SET_GenVertexArrays(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenVertexArrays_remap_index], fn) +#define CALL_CopyBufferSubData(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLintptr, GLintptr, GLsizeiptr)), driDispatchRemapTable[CopyBufferSubData_remap_index], parameters) +#define GET_CopyBufferSubData(disp) GET_by_offset(disp, driDispatchRemapTable[CopyBufferSubData_remap_index]) +#define SET_CopyBufferSubData(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CopyBufferSubData_remap_index], fn) +#define CALL_ClientWaitSync(disp, parameters) CALL_by_offset(disp, (GLenum (GLAPIENTRYP)(GLsync, GLbitfield, GLuint64)), driDispatchRemapTable[ClientWaitSync_remap_index], parameters) +#define GET_ClientWaitSync(disp) GET_by_offset(disp, driDispatchRemapTable[ClientWaitSync_remap_index]) +#define SET_ClientWaitSync(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ClientWaitSync_remap_index], fn) +#define CALL_DeleteSync(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsync)), driDispatchRemapTable[DeleteSync_remap_index], parameters) +#define GET_DeleteSync(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteSync_remap_index]) +#define SET_DeleteSync(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteSync_remap_index], fn) +#define CALL_FenceSync(disp, parameters) CALL_by_offset(disp, (GLsync (GLAPIENTRYP)(GLenum, GLbitfield)), driDispatchRemapTable[FenceSync_remap_index], parameters) +#define GET_FenceSync(disp) GET_by_offset(disp, driDispatchRemapTable[FenceSync_remap_index]) +#define SET_FenceSync(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FenceSync_remap_index], fn) +#define CALL_GetInteger64v(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint64 *)), driDispatchRemapTable[GetInteger64v_remap_index], parameters) +#define GET_GetInteger64v(disp) GET_by_offset(disp, driDispatchRemapTable[GetInteger64v_remap_index]) +#define SET_GetInteger64v(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetInteger64v_remap_index], fn) +#define CALL_GetSynciv(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsync, GLenum, GLsizei, GLsizei *, GLint *)), driDispatchRemapTable[GetSynciv_remap_index], parameters) +#define GET_GetSynciv(disp) GET_by_offset(disp, driDispatchRemapTable[GetSynciv_remap_index]) +#define SET_GetSynciv(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetSynciv_remap_index], fn) +#define CALL_IsSync(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLsync)), driDispatchRemapTable[IsSync_remap_index], parameters) +#define GET_IsSync(disp) GET_by_offset(disp, driDispatchRemapTable[IsSync_remap_index]) +#define SET_IsSync(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsSync_remap_index], fn) +#define CALL_WaitSync(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsync, GLbitfield, GLuint64)), driDispatchRemapTable[WaitSync_remap_index], parameters) +#define GET_WaitSync(disp) GET_by_offset(disp, driDispatchRemapTable[WaitSync_remap_index]) +#define SET_WaitSync(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WaitSync_remap_index], fn) +#define CALL_DrawElementsBaseVertex(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, GLenum, const GLvoid *, GLint)), driDispatchRemapTable[DrawElementsBaseVertex_remap_index], parameters) +#define GET_DrawElementsBaseVertex(disp) GET_by_offset(disp, driDispatchRemapTable[DrawElementsBaseVertex_remap_index]) +#define SET_DrawElementsBaseVertex(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DrawElementsBaseVertex_remap_index], fn) +#define CALL_DrawRangeElementsBaseVertex(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLsizei, GLenum, const GLvoid *, GLint)), driDispatchRemapTable[DrawRangeElementsBaseVertex_remap_index], parameters) +#define GET_DrawRangeElementsBaseVertex(disp) GET_by_offset(disp, driDispatchRemapTable[DrawRangeElementsBaseVertex_remap_index]) +#define SET_DrawRangeElementsBaseVertex(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DrawRangeElementsBaseVertex_remap_index], fn) +#define CALL_MultiDrawElementsBaseVertex(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLsizei *, GLenum, const GLvoid **, GLsizei, const GLint *)), driDispatchRemapTable[MultiDrawElementsBaseVertex_remap_index], parameters) +#define GET_MultiDrawElementsBaseVertex(disp) GET_by_offset(disp, driDispatchRemapTable[MultiDrawElementsBaseVertex_remap_index]) +#define SET_MultiDrawElementsBaseVertex(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultiDrawElementsBaseVertex_remap_index], fn) +#define CALL_PolygonOffsetEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat)), driDispatchRemapTable[PolygonOffsetEXT_remap_index], parameters) +#define GET_PolygonOffsetEXT(disp) GET_by_offset(disp, driDispatchRemapTable[PolygonOffsetEXT_remap_index]) +#define SET_PolygonOffsetEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PolygonOffsetEXT_remap_index], fn) +#define CALL_GetPixelTexGenParameterfvSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat *)), driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index], parameters) +#define GET_GetPixelTexGenParameterfvSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index]) +#define SET_GetPixelTexGenParameterfvSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetPixelTexGenParameterfvSGIS_remap_index], fn) +#define CALL_GetPixelTexGenParameterivSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint *)), driDispatchRemapTable[GetPixelTexGenParameterivSGIS_remap_index], parameters) +#define GET_GetPixelTexGenParameterivSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[GetPixelTexGenParameterivSGIS_remap_index]) +#define SET_GetPixelTexGenParameterivSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetPixelTexGenParameterivSGIS_remap_index], fn) +#define CALL_PixelTexGenParameterfSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat)), driDispatchRemapTable[PixelTexGenParameterfSGIS_remap_index], parameters) +#define GET_PixelTexGenParameterfSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterfSGIS_remap_index]) +#define SET_PixelTexGenParameterfSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterfSGIS_remap_index], fn) +#define CALL_PixelTexGenParameterfvSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLfloat *)), driDispatchRemapTable[PixelTexGenParameterfvSGIS_remap_index], parameters) +#define GET_PixelTexGenParameterfvSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterfvSGIS_remap_index]) +#define SET_PixelTexGenParameterfvSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterfvSGIS_remap_index], fn) +#define CALL_PixelTexGenParameteriSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint)), driDispatchRemapTable[PixelTexGenParameteriSGIS_remap_index], parameters) +#define GET_PixelTexGenParameteriSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameteriSGIS_remap_index]) +#define SET_PixelTexGenParameteriSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameteriSGIS_remap_index], fn) +#define CALL_PixelTexGenParameterivSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLint *)), driDispatchRemapTable[PixelTexGenParameterivSGIS_remap_index], parameters) +#define GET_PixelTexGenParameterivSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterivSGIS_remap_index]) +#define SET_PixelTexGenParameterivSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PixelTexGenParameterivSGIS_remap_index], fn) +#define CALL_SampleMaskSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLclampf, GLboolean)), driDispatchRemapTable[SampleMaskSGIS_remap_index], parameters) +#define GET_SampleMaskSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[SampleMaskSGIS_remap_index]) +#define SET_SampleMaskSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SampleMaskSGIS_remap_index], fn) +#define CALL_SamplePatternSGIS(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[SamplePatternSGIS_remap_index], parameters) +#define GET_SamplePatternSGIS(disp) GET_by_offset(disp, driDispatchRemapTable[SamplePatternSGIS_remap_index]) +#define SET_SamplePatternSGIS(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SamplePatternSGIS_remap_index], fn) +#define CALL_ColorPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *)), driDispatchRemapTable[ColorPointerEXT_remap_index], parameters) +#define GET_ColorPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ColorPointerEXT_remap_index]) +#define SET_ColorPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ColorPointerEXT_remap_index], fn) +#define CALL_EdgeFlagPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLsizei, const GLboolean *)), driDispatchRemapTable[EdgeFlagPointerEXT_remap_index], parameters) +#define GET_EdgeFlagPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[EdgeFlagPointerEXT_remap_index]) +#define SET_EdgeFlagPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[EdgeFlagPointerEXT_remap_index], fn) +#define CALL_IndexPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, GLsizei, const GLvoid *)), driDispatchRemapTable[IndexPointerEXT_remap_index], parameters) +#define GET_IndexPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[IndexPointerEXT_remap_index]) +#define SET_IndexPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IndexPointerEXT_remap_index], fn) +#define CALL_NormalPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, GLsizei, const GLvoid *)), driDispatchRemapTable[NormalPointerEXT_remap_index], parameters) +#define GET_NormalPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[NormalPointerEXT_remap_index]) +#define SET_NormalPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[NormalPointerEXT_remap_index], fn) +#define CALL_TexCoordPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *)), driDispatchRemapTable[TexCoordPointerEXT_remap_index], parameters) +#define GET_TexCoordPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[TexCoordPointerEXT_remap_index]) +#define SET_TexCoordPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TexCoordPointerEXT_remap_index], fn) +#define CALL_VertexPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLenum, GLsizei, GLsizei, const GLvoid *)), driDispatchRemapTable[VertexPointerEXT_remap_index], parameters) +#define GET_VertexPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[VertexPointerEXT_remap_index]) +#define SET_VertexPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexPointerEXT_remap_index], fn) +#define CALL_PointParameterfEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat)), driDispatchRemapTable[PointParameterfEXT_remap_index], parameters) +#define GET_PointParameterfEXT(disp) GET_by_offset(disp, driDispatchRemapTable[PointParameterfEXT_remap_index]) +#define SET_PointParameterfEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PointParameterfEXT_remap_index], fn) +#define CALL_PointParameterfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLfloat *)), driDispatchRemapTable[PointParameterfvEXT_remap_index], parameters) +#define GET_PointParameterfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[PointParameterfvEXT_remap_index]) +#define SET_PointParameterfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PointParameterfvEXT_remap_index], fn) +#define CALL_LockArraysEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLsizei)), driDispatchRemapTable[LockArraysEXT_remap_index], parameters) +#define GET_LockArraysEXT(disp) GET_by_offset(disp, driDispatchRemapTable[LockArraysEXT_remap_index]) +#define SET_LockArraysEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LockArraysEXT_remap_index], fn) +#define CALL_UnlockArraysEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[UnlockArraysEXT_remap_index], parameters) +#define GET_UnlockArraysEXT(disp) GET_by_offset(disp, driDispatchRemapTable[UnlockArraysEXT_remap_index]) +#define SET_UnlockArraysEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[UnlockArraysEXT_remap_index], fn) +#define CALL_CullParameterdvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLdouble *)), driDispatchRemapTable[CullParameterdvEXT_remap_index], parameters) +#define GET_CullParameterdvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[CullParameterdvEXT_remap_index]) +#define SET_CullParameterdvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CullParameterdvEXT_remap_index], fn) +#define CALL_CullParameterfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat *)), driDispatchRemapTable[CullParameterfvEXT_remap_index], parameters) +#define GET_CullParameterfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[CullParameterfvEXT_remap_index]) +#define SET_CullParameterfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CullParameterfvEXT_remap_index], fn) +#define CALL_SecondaryColor3bEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLbyte, GLbyte, GLbyte)), driDispatchRemapTable[SecondaryColor3bEXT_remap_index], parameters) +#define GET_SecondaryColor3bEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3bEXT_remap_index]) +#define SET_SecondaryColor3bEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3bEXT_remap_index], fn) +#define CALL_SecondaryColor3bvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLbyte *)), driDispatchRemapTable[SecondaryColor3bvEXT_remap_index], parameters) +#define GET_SecondaryColor3bvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3bvEXT_remap_index]) +#define SET_SecondaryColor3bvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3bvEXT_remap_index], fn) +#define CALL_SecondaryColor3dEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[SecondaryColor3dEXT_remap_index], parameters) +#define GET_SecondaryColor3dEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3dEXT_remap_index]) +#define SET_SecondaryColor3dEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3dEXT_remap_index], fn) +#define CALL_SecondaryColor3dvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[SecondaryColor3dvEXT_remap_index], parameters) +#define GET_SecondaryColor3dvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3dvEXT_remap_index]) +#define SET_SecondaryColor3dvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3dvEXT_remap_index], fn) +#define CALL_SecondaryColor3fEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[SecondaryColor3fEXT_remap_index], parameters) +#define GET_SecondaryColor3fEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3fEXT_remap_index]) +#define SET_SecondaryColor3fEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3fEXT_remap_index], fn) +#define CALL_SecondaryColor3fvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[SecondaryColor3fvEXT_remap_index], parameters) +#define GET_SecondaryColor3fvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3fvEXT_remap_index]) +#define SET_SecondaryColor3fvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3fvEXT_remap_index], fn) +#define CALL_SecondaryColor3iEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint)), driDispatchRemapTable[SecondaryColor3iEXT_remap_index], parameters) +#define GET_SecondaryColor3iEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3iEXT_remap_index]) +#define SET_SecondaryColor3iEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3iEXT_remap_index], fn) +#define CALL_SecondaryColor3ivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLint *)), driDispatchRemapTable[SecondaryColor3ivEXT_remap_index], parameters) +#define GET_SecondaryColor3ivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ivEXT_remap_index]) +#define SET_SecondaryColor3ivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ivEXT_remap_index], fn) +#define CALL_SecondaryColor3sEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLshort, GLshort, GLshort)), driDispatchRemapTable[SecondaryColor3sEXT_remap_index], parameters) +#define GET_SecondaryColor3sEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3sEXT_remap_index]) +#define SET_SecondaryColor3sEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3sEXT_remap_index], fn) +#define CALL_SecondaryColor3svEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLshort *)), driDispatchRemapTable[SecondaryColor3svEXT_remap_index], parameters) +#define GET_SecondaryColor3svEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3svEXT_remap_index]) +#define SET_SecondaryColor3svEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3svEXT_remap_index], fn) +#define CALL_SecondaryColor3ubEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLubyte, GLubyte, GLubyte)), driDispatchRemapTable[SecondaryColor3ubEXT_remap_index], parameters) +#define GET_SecondaryColor3ubEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ubEXT_remap_index]) +#define SET_SecondaryColor3ubEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ubEXT_remap_index], fn) +#define CALL_SecondaryColor3ubvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLubyte *)), driDispatchRemapTable[SecondaryColor3ubvEXT_remap_index], parameters) +#define GET_SecondaryColor3ubvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ubvEXT_remap_index]) +#define SET_SecondaryColor3ubvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3ubvEXT_remap_index], fn) +#define CALL_SecondaryColor3uiEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint, GLuint)), driDispatchRemapTable[SecondaryColor3uiEXT_remap_index], parameters) +#define GET_SecondaryColor3uiEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3uiEXT_remap_index]) +#define SET_SecondaryColor3uiEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3uiEXT_remap_index], fn) +#define CALL_SecondaryColor3uivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLuint *)), driDispatchRemapTable[SecondaryColor3uivEXT_remap_index], parameters) +#define GET_SecondaryColor3uivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3uivEXT_remap_index]) +#define SET_SecondaryColor3uivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3uivEXT_remap_index], fn) +#define CALL_SecondaryColor3usEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLushort, GLushort, GLushort)), driDispatchRemapTable[SecondaryColor3usEXT_remap_index], parameters) +#define GET_SecondaryColor3usEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3usEXT_remap_index]) +#define SET_SecondaryColor3usEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3usEXT_remap_index], fn) +#define CALL_SecondaryColor3usvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLushort *)), driDispatchRemapTable[SecondaryColor3usvEXT_remap_index], parameters) +#define GET_SecondaryColor3usvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColor3usvEXT_remap_index]) +#define SET_SecondaryColor3usvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColor3usvEXT_remap_index], fn) +#define CALL_SecondaryColorPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[SecondaryColorPointerEXT_remap_index], parameters) +#define GET_SecondaryColorPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[SecondaryColorPointerEXT_remap_index]) +#define SET_SecondaryColorPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SecondaryColorPointerEXT_remap_index], fn) +#define CALL_MultiDrawArraysEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint *, GLsizei *, GLsizei)), driDispatchRemapTable[MultiDrawArraysEXT_remap_index], parameters) +#define GET_MultiDrawArraysEXT(disp) GET_by_offset(disp, driDispatchRemapTable[MultiDrawArraysEXT_remap_index]) +#define SET_MultiDrawArraysEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultiDrawArraysEXT_remap_index], fn) +#define CALL_MultiDrawElementsEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLsizei *, GLenum, const GLvoid **, GLsizei)), driDispatchRemapTable[MultiDrawElementsEXT_remap_index], parameters) +#define GET_MultiDrawElementsEXT(disp) GET_by_offset(disp, driDispatchRemapTable[MultiDrawElementsEXT_remap_index]) +#define SET_MultiDrawElementsEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultiDrawElementsEXT_remap_index], fn) +#define CALL_FogCoordPointerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[FogCoordPointerEXT_remap_index], parameters) +#define GET_FogCoordPointerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FogCoordPointerEXT_remap_index]) +#define SET_FogCoordPointerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FogCoordPointerEXT_remap_index], fn) +#define CALL_FogCoorddEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLdouble)), driDispatchRemapTable[FogCoorddEXT_remap_index], parameters) +#define GET_FogCoorddEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FogCoorddEXT_remap_index]) +#define SET_FogCoorddEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FogCoorddEXT_remap_index], fn) +#define CALL_FogCoorddvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[FogCoorddvEXT_remap_index], parameters) +#define GET_FogCoorddvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FogCoorddvEXT_remap_index]) +#define SET_FogCoorddvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FogCoorddvEXT_remap_index], fn) +#define CALL_FogCoordfEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat)), driDispatchRemapTable[FogCoordfEXT_remap_index], parameters) +#define GET_FogCoordfEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FogCoordfEXT_remap_index]) +#define SET_FogCoordfEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FogCoordfEXT_remap_index], fn) +#define CALL_FogCoordfvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[FogCoordfvEXT_remap_index], parameters) +#define GET_FogCoordfvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FogCoordfvEXT_remap_index]) +#define SET_FogCoordfvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FogCoordfvEXT_remap_index], fn) +#define CALL_PixelTexGenSGIX(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[PixelTexGenSGIX_remap_index], parameters) +#define GET_PixelTexGenSGIX(disp) GET_by_offset(disp, driDispatchRemapTable[PixelTexGenSGIX_remap_index]) +#define SET_PixelTexGenSGIX(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PixelTexGenSGIX_remap_index], fn) +#define CALL_BlendFuncSeparateEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum)), driDispatchRemapTable[BlendFuncSeparateEXT_remap_index], parameters) +#define GET_BlendFuncSeparateEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BlendFuncSeparateEXT_remap_index]) +#define SET_BlendFuncSeparateEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BlendFuncSeparateEXT_remap_index], fn) +#define CALL_FlushVertexArrayRangeNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[FlushVertexArrayRangeNV_remap_index], parameters) +#define GET_FlushVertexArrayRangeNV(disp) GET_by_offset(disp, driDispatchRemapTable[FlushVertexArrayRangeNV_remap_index]) +#define SET_FlushVertexArrayRangeNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FlushVertexArrayRangeNV_remap_index], fn) +#define CALL_VertexArrayRangeNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLvoid *)), driDispatchRemapTable[VertexArrayRangeNV_remap_index], parameters) +#define GET_VertexArrayRangeNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexArrayRangeNV_remap_index]) +#define SET_VertexArrayRangeNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexArrayRangeNV_remap_index], fn) +#define CALL_CombinerInputNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum)), driDispatchRemapTable[CombinerInputNV_remap_index], parameters) +#define GET_CombinerInputNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerInputNV_remap_index]) +#define SET_CombinerInputNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerInputNV_remap_index], fn) +#define CALL_CombinerOutputNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLenum, GLboolean, GLboolean, GLboolean)), driDispatchRemapTable[CombinerOutputNV_remap_index], parameters) +#define GET_CombinerOutputNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerOutputNV_remap_index]) +#define SET_CombinerOutputNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerOutputNV_remap_index], fn) +#define CALL_CombinerParameterfNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat)), driDispatchRemapTable[CombinerParameterfNV_remap_index], parameters) +#define GET_CombinerParameterfNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerParameterfNV_remap_index]) +#define SET_CombinerParameterfNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerParameterfNV_remap_index], fn) +#define CALL_CombinerParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLfloat *)), driDispatchRemapTable[CombinerParameterfvNV_remap_index], parameters) +#define GET_CombinerParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerParameterfvNV_remap_index]) +#define SET_CombinerParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerParameterfvNV_remap_index], fn) +#define CALL_CombinerParameteriNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint)), driDispatchRemapTable[CombinerParameteriNV_remap_index], parameters) +#define GET_CombinerParameteriNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerParameteriNV_remap_index]) +#define SET_CombinerParameteriNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerParameteriNV_remap_index], fn) +#define CALL_CombinerParameterivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLint *)), driDispatchRemapTable[CombinerParameterivNV_remap_index], parameters) +#define GET_CombinerParameterivNV(disp) GET_by_offset(disp, driDispatchRemapTable[CombinerParameterivNV_remap_index]) +#define SET_CombinerParameterivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CombinerParameterivNV_remap_index], fn) +#define CALL_FinalCombinerInputNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum)), driDispatchRemapTable[FinalCombinerInputNV_remap_index], parameters) +#define GET_FinalCombinerInputNV(disp) GET_by_offset(disp, driDispatchRemapTable[FinalCombinerInputNV_remap_index]) +#define SET_FinalCombinerInputNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FinalCombinerInputNV_remap_index], fn) +#define CALL_GetCombinerInputParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetCombinerInputParameterfvNV_remap_index], parameters) +#define GET_GetCombinerInputParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetCombinerInputParameterfvNV_remap_index]) +#define SET_GetCombinerInputParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetCombinerInputParameterfvNV_remap_index], fn) +#define CALL_GetCombinerInputParameterivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLenum, GLint *)), driDispatchRemapTable[GetCombinerInputParameterivNV_remap_index], parameters) +#define GET_GetCombinerInputParameterivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetCombinerInputParameterivNV_remap_index]) +#define SET_GetCombinerInputParameterivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetCombinerInputParameterivNV_remap_index], fn) +#define CALL_GetCombinerOutputParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetCombinerOutputParameterfvNV_remap_index], parameters) +#define GET_GetCombinerOutputParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetCombinerOutputParameterfvNV_remap_index]) +#define SET_GetCombinerOutputParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetCombinerOutputParameterfvNV_remap_index], fn) +#define CALL_GetCombinerOutputParameterivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLint *)), driDispatchRemapTable[GetCombinerOutputParameterivNV_remap_index], parameters) +#define GET_GetCombinerOutputParameterivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetCombinerOutputParameterivNV_remap_index]) +#define SET_GetCombinerOutputParameterivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetCombinerOutputParameterivNV_remap_index], fn) +#define CALL_GetFinalCombinerInputParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLfloat *)), driDispatchRemapTable[GetFinalCombinerInputParameterfvNV_remap_index], parameters) +#define GET_GetFinalCombinerInputParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetFinalCombinerInputParameterfvNV_remap_index]) +#define SET_GetFinalCombinerInputParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFinalCombinerInputParameterfvNV_remap_index], fn) +#define CALL_GetFinalCombinerInputParameterivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetFinalCombinerInputParameterivNV_remap_index], parameters) +#define GET_GetFinalCombinerInputParameterivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetFinalCombinerInputParameterivNV_remap_index]) +#define SET_GetFinalCombinerInputParameterivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFinalCombinerInputParameterivNV_remap_index], fn) +#define CALL_ResizeBuffersMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[ResizeBuffersMESA_remap_index], parameters) +#define GET_ResizeBuffersMESA(disp) GET_by_offset(disp, driDispatchRemapTable[ResizeBuffersMESA_remap_index]) +#define SET_ResizeBuffersMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ResizeBuffersMESA_remap_index], fn) +#define CALL_WindowPos2dMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLdouble, GLdouble)), driDispatchRemapTable[WindowPos2dMESA_remap_index], parameters) +#define GET_WindowPos2dMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2dMESA_remap_index]) +#define SET_WindowPos2dMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2dMESA_remap_index], fn) +#define CALL_WindowPos2dvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[WindowPos2dvMESA_remap_index], parameters) +#define GET_WindowPos2dvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2dvMESA_remap_index]) +#define SET_WindowPos2dvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2dvMESA_remap_index], fn) +#define CALL_WindowPos2fMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat)), driDispatchRemapTable[WindowPos2fMESA_remap_index], parameters) +#define GET_WindowPos2fMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2fMESA_remap_index]) +#define SET_WindowPos2fMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2fMESA_remap_index], fn) +#define CALL_WindowPos2fvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[WindowPos2fvMESA_remap_index], parameters) +#define GET_WindowPos2fvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2fvMESA_remap_index]) +#define SET_WindowPos2fvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2fvMESA_remap_index], fn) +#define CALL_WindowPos2iMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint)), driDispatchRemapTable[WindowPos2iMESA_remap_index], parameters) +#define GET_WindowPos2iMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2iMESA_remap_index]) +#define SET_WindowPos2iMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2iMESA_remap_index], fn) +#define CALL_WindowPos2ivMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLint *)), driDispatchRemapTable[WindowPos2ivMESA_remap_index], parameters) +#define GET_WindowPos2ivMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2ivMESA_remap_index]) +#define SET_WindowPos2ivMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2ivMESA_remap_index], fn) +#define CALL_WindowPos2sMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLshort, GLshort)), driDispatchRemapTable[WindowPos2sMESA_remap_index], parameters) +#define GET_WindowPos2sMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2sMESA_remap_index]) +#define SET_WindowPos2sMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2sMESA_remap_index], fn) +#define CALL_WindowPos2svMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLshort *)), driDispatchRemapTable[WindowPos2svMESA_remap_index], parameters) +#define GET_WindowPos2svMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos2svMESA_remap_index]) +#define SET_WindowPos2svMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos2svMESA_remap_index], fn) +#define CALL_WindowPos3dMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[WindowPos3dMESA_remap_index], parameters) +#define GET_WindowPos3dMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3dMESA_remap_index]) +#define SET_WindowPos3dMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3dMESA_remap_index], fn) +#define CALL_WindowPos3dvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[WindowPos3dvMESA_remap_index], parameters) +#define GET_WindowPos3dvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3dvMESA_remap_index]) +#define SET_WindowPos3dvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3dvMESA_remap_index], fn) +#define CALL_WindowPos3fMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[WindowPos3fMESA_remap_index], parameters) +#define GET_WindowPos3fMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3fMESA_remap_index]) +#define SET_WindowPos3fMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3fMESA_remap_index], fn) +#define CALL_WindowPos3fvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[WindowPos3fvMESA_remap_index], parameters) +#define GET_WindowPos3fvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3fvMESA_remap_index]) +#define SET_WindowPos3fvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3fvMESA_remap_index], fn) +#define CALL_WindowPos3iMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint)), driDispatchRemapTable[WindowPos3iMESA_remap_index], parameters) +#define GET_WindowPos3iMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3iMESA_remap_index]) +#define SET_WindowPos3iMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3iMESA_remap_index], fn) +#define CALL_WindowPos3ivMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLint *)), driDispatchRemapTable[WindowPos3ivMESA_remap_index], parameters) +#define GET_WindowPos3ivMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3ivMESA_remap_index]) +#define SET_WindowPos3ivMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3ivMESA_remap_index], fn) +#define CALL_WindowPos3sMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLshort, GLshort, GLshort)), driDispatchRemapTable[WindowPos3sMESA_remap_index], parameters) +#define GET_WindowPos3sMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3sMESA_remap_index]) +#define SET_WindowPos3sMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3sMESA_remap_index], fn) +#define CALL_WindowPos3svMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLshort *)), driDispatchRemapTable[WindowPos3svMESA_remap_index], parameters) +#define GET_WindowPos3svMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos3svMESA_remap_index]) +#define SET_WindowPos3svMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos3svMESA_remap_index], fn) +#define CALL_WindowPos4dMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[WindowPos4dMESA_remap_index], parameters) +#define GET_WindowPos4dMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4dMESA_remap_index]) +#define SET_WindowPos4dMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4dMESA_remap_index], fn) +#define CALL_WindowPos4dvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLdouble *)), driDispatchRemapTable[WindowPos4dvMESA_remap_index], parameters) +#define GET_WindowPos4dvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4dvMESA_remap_index]) +#define SET_WindowPos4dvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4dvMESA_remap_index], fn) +#define CALL_WindowPos4fMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[WindowPos4fMESA_remap_index], parameters) +#define GET_WindowPos4fMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4fMESA_remap_index]) +#define SET_WindowPos4fMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4fMESA_remap_index], fn) +#define CALL_WindowPos4fvMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLfloat *)), driDispatchRemapTable[WindowPos4fvMESA_remap_index], parameters) +#define GET_WindowPos4fvMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4fvMESA_remap_index]) +#define SET_WindowPos4fvMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4fvMESA_remap_index], fn) +#define CALL_WindowPos4iMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint, GLint)), driDispatchRemapTable[WindowPos4iMESA_remap_index], parameters) +#define GET_WindowPos4iMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4iMESA_remap_index]) +#define SET_WindowPos4iMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4iMESA_remap_index], fn) +#define CALL_WindowPos4ivMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLint *)), driDispatchRemapTable[WindowPos4ivMESA_remap_index], parameters) +#define GET_WindowPos4ivMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4ivMESA_remap_index]) +#define SET_WindowPos4ivMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4ivMESA_remap_index], fn) +#define CALL_WindowPos4sMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLshort, GLshort, GLshort, GLshort)), driDispatchRemapTable[WindowPos4sMESA_remap_index], parameters) +#define GET_WindowPos4sMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4sMESA_remap_index]) +#define SET_WindowPos4sMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4sMESA_remap_index], fn) +#define CALL_WindowPos4svMESA(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLshort *)), driDispatchRemapTable[WindowPos4svMESA_remap_index], parameters) +#define GET_WindowPos4svMESA(disp) GET_by_offset(disp, driDispatchRemapTable[WindowPos4svMESA_remap_index]) +#define SET_WindowPos4svMESA(disp, fn) SET_by_offset(disp, driDispatchRemapTable[WindowPos4svMESA_remap_index], fn) +#define CALL_MultiModeDrawArraysIBM(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLenum *, const GLint *, const GLsizei *, GLsizei, GLint)), driDispatchRemapTable[MultiModeDrawArraysIBM_remap_index], parameters) +#define GET_MultiModeDrawArraysIBM(disp) GET_by_offset(disp, driDispatchRemapTable[MultiModeDrawArraysIBM_remap_index]) +#define SET_MultiModeDrawArraysIBM(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultiModeDrawArraysIBM_remap_index], fn) +#define CALL_MultiModeDrawElementsIBM(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(const GLenum *, const GLsizei *, GLenum, const GLvoid * const *, GLsizei, GLint)), driDispatchRemapTable[MultiModeDrawElementsIBM_remap_index], parameters) +#define GET_MultiModeDrawElementsIBM(disp) GET_by_offset(disp, driDispatchRemapTable[MultiModeDrawElementsIBM_remap_index]) +#define SET_MultiModeDrawElementsIBM(disp, fn) SET_by_offset(disp, driDispatchRemapTable[MultiModeDrawElementsIBM_remap_index], fn) +#define CALL_DeleteFencesNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteFencesNV_remap_index], parameters) +#define GET_DeleteFencesNV(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteFencesNV_remap_index]) +#define SET_DeleteFencesNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteFencesNV_remap_index], fn) +#define CALL_FinishFenceNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[FinishFenceNV_remap_index], parameters) +#define GET_FinishFenceNV(disp) GET_by_offset(disp, driDispatchRemapTable[FinishFenceNV_remap_index]) +#define SET_FinishFenceNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FinishFenceNV_remap_index], fn) +#define CALL_GenFencesNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenFencesNV_remap_index], parameters) +#define GET_GenFencesNV(disp) GET_by_offset(disp, driDispatchRemapTable[GenFencesNV_remap_index]) +#define SET_GenFencesNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenFencesNV_remap_index], fn) +#define CALL_GetFenceivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetFenceivNV_remap_index], parameters) +#define GET_GetFenceivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetFenceivNV_remap_index]) +#define SET_GetFenceivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFenceivNV_remap_index], fn) +#define CALL_IsFenceNV(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsFenceNV_remap_index], parameters) +#define GET_IsFenceNV(disp) GET_by_offset(disp, driDispatchRemapTable[IsFenceNV_remap_index]) +#define SET_IsFenceNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsFenceNV_remap_index], fn) +#define CALL_SetFenceNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum)), driDispatchRemapTable[SetFenceNV_remap_index], parameters) +#define GET_SetFenceNV(disp) GET_by_offset(disp, driDispatchRemapTable[SetFenceNV_remap_index]) +#define SET_SetFenceNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SetFenceNV_remap_index], fn) +#define CALL_TestFenceNV(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[TestFenceNV_remap_index], parameters) +#define GET_TestFenceNV(disp) GET_by_offset(disp, driDispatchRemapTable[TestFenceNV_remap_index]) +#define SET_TestFenceNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TestFenceNV_remap_index], fn) +#define CALL_AreProgramsResidentNV(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLsizei, const GLuint *, GLboolean *)), driDispatchRemapTable[AreProgramsResidentNV_remap_index], parameters) +#define GET_AreProgramsResidentNV(disp) GET_by_offset(disp, driDispatchRemapTable[AreProgramsResidentNV_remap_index]) +#define SET_AreProgramsResidentNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AreProgramsResidentNV_remap_index], fn) +#define CALL_BindProgramNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[BindProgramNV_remap_index], parameters) +#define GET_BindProgramNV(disp) GET_by_offset(disp, driDispatchRemapTable[BindProgramNV_remap_index]) +#define SET_BindProgramNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindProgramNV_remap_index], fn) +#define CALL_DeleteProgramsNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteProgramsNV_remap_index], parameters) +#define GET_DeleteProgramsNV(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteProgramsNV_remap_index]) +#define SET_DeleteProgramsNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteProgramsNV_remap_index], fn) +#define CALL_ExecuteProgramNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, const GLfloat *)), driDispatchRemapTable[ExecuteProgramNV_remap_index], parameters) +#define GET_ExecuteProgramNV(disp) GET_by_offset(disp, driDispatchRemapTable[ExecuteProgramNV_remap_index]) +#define SET_ExecuteProgramNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ExecuteProgramNV_remap_index], fn) +#define CALL_GenProgramsNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenProgramsNV_remap_index], parameters) +#define GET_GenProgramsNV(disp) GET_by_offset(disp, driDispatchRemapTable[GenProgramsNV_remap_index]) +#define SET_GenProgramsNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenProgramsNV_remap_index], fn) +#define CALL_GetProgramParameterdvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLenum, GLdouble *)), driDispatchRemapTable[GetProgramParameterdvNV_remap_index], parameters) +#define GET_GetProgramParameterdvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramParameterdvNV_remap_index]) +#define SET_GetProgramParameterdvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramParameterdvNV_remap_index], fn) +#define CALL_GetProgramParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLenum, GLfloat *)), driDispatchRemapTable[GetProgramParameterfvNV_remap_index], parameters) +#define GET_GetProgramParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramParameterfvNV_remap_index]) +#define SET_GetProgramParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramParameterfvNV_remap_index], fn) +#define CALL_GetProgramStringNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLubyte *)), driDispatchRemapTable[GetProgramStringNV_remap_index], parameters) +#define GET_GetProgramStringNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramStringNV_remap_index]) +#define SET_GetProgramStringNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramStringNV_remap_index], fn) +#define CALL_GetProgramivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetProgramivNV_remap_index], parameters) +#define GET_GetProgramivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramivNV_remap_index]) +#define SET_GetProgramivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramivNV_remap_index], fn) +#define CALL_GetTrackMatrixivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLenum, GLint *)), driDispatchRemapTable[GetTrackMatrixivNV_remap_index], parameters) +#define GET_GetTrackMatrixivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetTrackMatrixivNV_remap_index]) +#define SET_GetTrackMatrixivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetTrackMatrixivNV_remap_index], fn) +#define CALL_GetVertexAttribPointervNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLvoid **)), driDispatchRemapTable[GetVertexAttribPointervNV_remap_index], parameters) +#define GET_GetVertexAttribPointervNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribPointervNV_remap_index]) +#define SET_GetVertexAttribPointervNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribPointervNV_remap_index], fn) +#define CALL_GetVertexAttribdvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLdouble *)), driDispatchRemapTable[GetVertexAttribdvNV_remap_index], parameters) +#define GET_GetVertexAttribdvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribdvNV_remap_index]) +#define SET_GetVertexAttribdvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribdvNV_remap_index], fn) +#define CALL_GetVertexAttribfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLfloat *)), driDispatchRemapTable[GetVertexAttribfvNV_remap_index], parameters) +#define GET_GetVertexAttribfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribfvNV_remap_index]) +#define SET_GetVertexAttribfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribfvNV_remap_index], fn) +#define CALL_GetVertexAttribivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint *)), driDispatchRemapTable[GetVertexAttribivNV_remap_index], parameters) +#define GET_GetVertexAttribivNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetVertexAttribivNV_remap_index]) +#define SET_GetVertexAttribivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetVertexAttribivNV_remap_index], fn) +#define CALL_IsProgramNV(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsProgramNV_remap_index], parameters) +#define GET_IsProgramNV(disp) GET_by_offset(disp, driDispatchRemapTable[IsProgramNV_remap_index]) +#define SET_IsProgramNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsProgramNV_remap_index], fn) +#define CALL_LoadProgramNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLsizei, const GLubyte *)), driDispatchRemapTable[LoadProgramNV_remap_index], parameters) +#define GET_LoadProgramNV(disp) GET_by_offset(disp, driDispatchRemapTable[LoadProgramNV_remap_index]) +#define SET_LoadProgramNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[LoadProgramNV_remap_index], fn) +#define CALL_ProgramParameters4dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, const GLdouble *)), driDispatchRemapTable[ProgramParameters4dvNV_remap_index], parameters) +#define GET_ProgramParameters4dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramParameters4dvNV_remap_index]) +#define SET_ProgramParameters4dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramParameters4dvNV_remap_index], fn) +#define CALL_ProgramParameters4fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, const GLfloat *)), driDispatchRemapTable[ProgramParameters4fvNV_remap_index], parameters) +#define GET_ProgramParameters4fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramParameters4fvNV_remap_index]) +#define SET_ProgramParameters4fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramParameters4fvNV_remap_index], fn) +#define CALL_RequestResidentProgramsNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[RequestResidentProgramsNV_remap_index], parameters) +#define GET_RequestResidentProgramsNV(disp) GET_by_offset(disp, driDispatchRemapTable[RequestResidentProgramsNV_remap_index]) +#define SET_RequestResidentProgramsNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[RequestResidentProgramsNV_remap_index], fn) +#define CALL_TrackMatrixNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLenum, GLenum)), driDispatchRemapTable[TrackMatrixNV_remap_index], parameters) +#define GET_TrackMatrixNV(disp) GET_by_offset(disp, driDispatchRemapTable[TrackMatrixNV_remap_index]) +#define SET_TrackMatrixNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TrackMatrixNV_remap_index], fn) +#define CALL_VertexAttrib1dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble)), driDispatchRemapTable[VertexAttrib1dNV_remap_index], parameters) +#define GET_VertexAttrib1dNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dNV_remap_index]) +#define SET_VertexAttrib1dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dNV_remap_index], fn) +#define CALL_VertexAttrib1dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib1dvNV_remap_index], parameters) +#define GET_VertexAttrib1dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dvNV_remap_index]) +#define SET_VertexAttrib1dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1dvNV_remap_index], fn) +#define CALL_VertexAttrib1fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat)), driDispatchRemapTable[VertexAttrib1fNV_remap_index], parameters) +#define GET_VertexAttrib1fNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fNV_remap_index]) +#define SET_VertexAttrib1fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fNV_remap_index], fn) +#define CALL_VertexAttrib1fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib1fvNV_remap_index], parameters) +#define GET_VertexAttrib1fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fvNV_remap_index]) +#define SET_VertexAttrib1fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1fvNV_remap_index], fn) +#define CALL_VertexAttrib1sNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort)), driDispatchRemapTable[VertexAttrib1sNV_remap_index], parameters) +#define GET_VertexAttrib1sNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1sNV_remap_index]) +#define SET_VertexAttrib1sNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1sNV_remap_index], fn) +#define CALL_VertexAttrib1svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib1svNV_remap_index], parameters) +#define GET_VertexAttrib1svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib1svNV_remap_index]) +#define SET_VertexAttrib1svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib1svNV_remap_index], fn) +#define CALL_VertexAttrib2dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib2dNV_remap_index], parameters) +#define GET_VertexAttrib2dNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dNV_remap_index]) +#define SET_VertexAttrib2dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dNV_remap_index], fn) +#define CALL_VertexAttrib2dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib2dvNV_remap_index], parameters) +#define GET_VertexAttrib2dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dvNV_remap_index]) +#define SET_VertexAttrib2dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2dvNV_remap_index], fn) +#define CALL_VertexAttrib2fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib2fNV_remap_index], parameters) +#define GET_VertexAttrib2fNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fNV_remap_index]) +#define SET_VertexAttrib2fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fNV_remap_index], fn) +#define CALL_VertexAttrib2fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib2fvNV_remap_index], parameters) +#define GET_VertexAttrib2fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fvNV_remap_index]) +#define SET_VertexAttrib2fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2fvNV_remap_index], fn) +#define CALL_VertexAttrib2sNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib2sNV_remap_index], parameters) +#define GET_VertexAttrib2sNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2sNV_remap_index]) +#define SET_VertexAttrib2sNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2sNV_remap_index], fn) +#define CALL_VertexAttrib2svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib2svNV_remap_index], parameters) +#define GET_VertexAttrib2svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib2svNV_remap_index]) +#define SET_VertexAttrib2svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib2svNV_remap_index], fn) +#define CALL_VertexAttrib3dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib3dNV_remap_index], parameters) +#define GET_VertexAttrib3dNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dNV_remap_index]) +#define SET_VertexAttrib3dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dNV_remap_index], fn) +#define CALL_VertexAttrib3dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib3dvNV_remap_index], parameters) +#define GET_VertexAttrib3dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dvNV_remap_index]) +#define SET_VertexAttrib3dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3dvNV_remap_index], fn) +#define CALL_VertexAttrib3fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib3fNV_remap_index], parameters) +#define GET_VertexAttrib3fNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fNV_remap_index]) +#define SET_VertexAttrib3fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fNV_remap_index], fn) +#define CALL_VertexAttrib3fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib3fvNV_remap_index], parameters) +#define GET_VertexAttrib3fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fvNV_remap_index]) +#define SET_VertexAttrib3fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3fvNV_remap_index], fn) +#define CALL_VertexAttrib3sNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib3sNV_remap_index], parameters) +#define GET_VertexAttrib3sNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3sNV_remap_index]) +#define SET_VertexAttrib3sNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3sNV_remap_index], fn) +#define CALL_VertexAttrib3svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib3svNV_remap_index], parameters) +#define GET_VertexAttrib3svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib3svNV_remap_index]) +#define SET_VertexAttrib3svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib3svNV_remap_index], fn) +#define CALL_VertexAttrib4dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[VertexAttrib4dNV_remap_index], parameters) +#define GET_VertexAttrib4dNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dNV_remap_index]) +#define SET_VertexAttrib4dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dNV_remap_index], fn) +#define CALL_VertexAttrib4dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLdouble *)), driDispatchRemapTable[VertexAttrib4dvNV_remap_index], parameters) +#define GET_VertexAttrib4dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dvNV_remap_index]) +#define SET_VertexAttrib4dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4dvNV_remap_index], fn) +#define CALL_VertexAttrib4fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[VertexAttrib4fNV_remap_index], parameters) +#define GET_VertexAttrib4fNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fNV_remap_index]) +#define SET_VertexAttrib4fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fNV_remap_index], fn) +#define CALL_VertexAttrib4fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[VertexAttrib4fvNV_remap_index], parameters) +#define GET_VertexAttrib4fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fvNV_remap_index]) +#define SET_VertexAttrib4fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4fvNV_remap_index], fn) +#define CALL_VertexAttrib4sNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLshort, GLshort, GLshort, GLshort)), driDispatchRemapTable[VertexAttrib4sNV_remap_index], parameters) +#define GET_VertexAttrib4sNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4sNV_remap_index]) +#define SET_VertexAttrib4sNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4sNV_remap_index], fn) +#define CALL_VertexAttrib4svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLshort *)), driDispatchRemapTable[VertexAttrib4svNV_remap_index], parameters) +#define GET_VertexAttrib4svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4svNV_remap_index]) +#define SET_VertexAttrib4svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4svNV_remap_index], fn) +#define CALL_VertexAttrib4ubNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLubyte, GLubyte, GLubyte, GLubyte)), driDispatchRemapTable[VertexAttrib4ubNV_remap_index], parameters) +#define GET_VertexAttrib4ubNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubNV_remap_index]) +#define SET_VertexAttrib4ubNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubNV_remap_index], fn) +#define CALL_VertexAttrib4ubvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLubyte *)), driDispatchRemapTable[VertexAttrib4ubvNV_remap_index], parameters) +#define GET_VertexAttrib4ubvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubvNV_remap_index]) +#define SET_VertexAttrib4ubvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttrib4ubvNV_remap_index], fn) +#define CALL_VertexAttribPointerNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLint, GLenum, GLsizei, const GLvoid *)), driDispatchRemapTable[VertexAttribPointerNV_remap_index], parameters) +#define GET_VertexAttribPointerNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribPointerNV_remap_index]) +#define SET_VertexAttribPointerNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribPointerNV_remap_index], fn) +#define CALL_VertexAttribs1dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLdouble *)), driDispatchRemapTable[VertexAttribs1dvNV_remap_index], parameters) +#define GET_VertexAttribs1dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs1dvNV_remap_index]) +#define SET_VertexAttribs1dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs1dvNV_remap_index], fn) +#define CALL_VertexAttribs1fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[VertexAttribs1fvNV_remap_index], parameters) +#define GET_VertexAttribs1fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs1fvNV_remap_index]) +#define SET_VertexAttribs1fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs1fvNV_remap_index], fn) +#define CALL_VertexAttribs1svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLshort *)), driDispatchRemapTable[VertexAttribs1svNV_remap_index], parameters) +#define GET_VertexAttribs1svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs1svNV_remap_index]) +#define SET_VertexAttribs1svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs1svNV_remap_index], fn) +#define CALL_VertexAttribs2dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLdouble *)), driDispatchRemapTable[VertexAttribs2dvNV_remap_index], parameters) +#define GET_VertexAttribs2dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs2dvNV_remap_index]) +#define SET_VertexAttribs2dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs2dvNV_remap_index], fn) +#define CALL_VertexAttribs2fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[VertexAttribs2fvNV_remap_index], parameters) +#define GET_VertexAttribs2fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs2fvNV_remap_index]) +#define SET_VertexAttribs2fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs2fvNV_remap_index], fn) +#define CALL_VertexAttribs2svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLshort *)), driDispatchRemapTable[VertexAttribs2svNV_remap_index], parameters) +#define GET_VertexAttribs2svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs2svNV_remap_index]) +#define SET_VertexAttribs2svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs2svNV_remap_index], fn) +#define CALL_VertexAttribs3dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLdouble *)), driDispatchRemapTable[VertexAttribs3dvNV_remap_index], parameters) +#define GET_VertexAttribs3dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs3dvNV_remap_index]) +#define SET_VertexAttribs3dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs3dvNV_remap_index], fn) +#define CALL_VertexAttribs3fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[VertexAttribs3fvNV_remap_index], parameters) +#define GET_VertexAttribs3fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs3fvNV_remap_index]) +#define SET_VertexAttribs3fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs3fvNV_remap_index], fn) +#define CALL_VertexAttribs3svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLshort *)), driDispatchRemapTable[VertexAttribs3svNV_remap_index], parameters) +#define GET_VertexAttribs3svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs3svNV_remap_index]) +#define SET_VertexAttribs3svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs3svNV_remap_index], fn) +#define CALL_VertexAttribs4dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLdouble *)), driDispatchRemapTable[VertexAttribs4dvNV_remap_index], parameters) +#define GET_VertexAttribs4dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs4dvNV_remap_index]) +#define SET_VertexAttribs4dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs4dvNV_remap_index], fn) +#define CALL_VertexAttribs4fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[VertexAttribs4fvNV_remap_index], parameters) +#define GET_VertexAttribs4fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs4fvNV_remap_index]) +#define SET_VertexAttribs4fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs4fvNV_remap_index], fn) +#define CALL_VertexAttribs4svNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLshort *)), driDispatchRemapTable[VertexAttribs4svNV_remap_index], parameters) +#define GET_VertexAttribs4svNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs4svNV_remap_index]) +#define SET_VertexAttribs4svNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs4svNV_remap_index], fn) +#define CALL_VertexAttribs4ubvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *)), driDispatchRemapTable[VertexAttribs4ubvNV_remap_index], parameters) +#define GET_VertexAttribs4ubvNV(disp) GET_by_offset(disp, driDispatchRemapTable[VertexAttribs4ubvNV_remap_index]) +#define SET_VertexAttribs4ubvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[VertexAttribs4ubvNV_remap_index], fn) +#define CALL_GetTexBumpParameterfvATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLfloat *)), driDispatchRemapTable[GetTexBumpParameterfvATI_remap_index], parameters) +#define GET_GetTexBumpParameterfvATI(disp) GET_by_offset(disp, driDispatchRemapTable[GetTexBumpParameterfvATI_remap_index]) +#define SET_GetTexBumpParameterfvATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetTexBumpParameterfvATI_remap_index], fn) +#define CALL_GetTexBumpParameterivATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint *)), driDispatchRemapTable[GetTexBumpParameterivATI_remap_index], parameters) +#define GET_GetTexBumpParameterivATI(disp) GET_by_offset(disp, driDispatchRemapTable[GetTexBumpParameterivATI_remap_index]) +#define SET_GetTexBumpParameterivATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetTexBumpParameterivATI_remap_index], fn) +#define CALL_TexBumpParameterfvATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLfloat *)), driDispatchRemapTable[TexBumpParameterfvATI_remap_index], parameters) +#define GET_TexBumpParameterfvATI(disp) GET_by_offset(disp, driDispatchRemapTable[TexBumpParameterfvATI_remap_index]) +#define SET_TexBumpParameterfvATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TexBumpParameterfvATI_remap_index], fn) +#define CALL_TexBumpParameterivATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLint *)), driDispatchRemapTable[TexBumpParameterivATI_remap_index], parameters) +#define GET_TexBumpParameterivATI(disp) GET_by_offset(disp, driDispatchRemapTable[TexBumpParameterivATI_remap_index]) +#define SET_TexBumpParameterivATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TexBumpParameterivATI_remap_index], fn) +#define CALL_AlphaFragmentOp1ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[AlphaFragmentOp1ATI_remap_index], parameters) +#define GET_AlphaFragmentOp1ATI(disp) GET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp1ATI_remap_index]) +#define SET_AlphaFragmentOp1ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp1ATI_remap_index], fn) +#define CALL_AlphaFragmentOp2ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[AlphaFragmentOp2ATI_remap_index], parameters) +#define GET_AlphaFragmentOp2ATI(disp) GET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp2ATI_remap_index]) +#define SET_AlphaFragmentOp2ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp2ATI_remap_index], fn) +#define CALL_AlphaFragmentOp3ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[AlphaFragmentOp3ATI_remap_index], parameters) +#define GET_AlphaFragmentOp3ATI(disp) GET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp3ATI_remap_index]) +#define SET_AlphaFragmentOp3ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[AlphaFragmentOp3ATI_remap_index], fn) +#define CALL_BeginFragmentShaderATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[BeginFragmentShaderATI_remap_index], parameters) +#define GET_BeginFragmentShaderATI(disp) GET_by_offset(disp, driDispatchRemapTable[BeginFragmentShaderATI_remap_index]) +#define SET_BeginFragmentShaderATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BeginFragmentShaderATI_remap_index], fn) +#define CALL_BindFragmentShaderATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[BindFragmentShaderATI_remap_index], parameters) +#define GET_BindFragmentShaderATI(disp) GET_by_offset(disp, driDispatchRemapTable[BindFragmentShaderATI_remap_index]) +#define SET_BindFragmentShaderATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindFragmentShaderATI_remap_index], fn) +#define CALL_ColorFragmentOp1ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[ColorFragmentOp1ATI_remap_index], parameters) +#define GET_ColorFragmentOp1ATI(disp) GET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp1ATI_remap_index]) +#define SET_ColorFragmentOp1ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp1ATI_remap_index], fn) +#define CALL_ColorFragmentOp2ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[ColorFragmentOp2ATI_remap_index], parameters) +#define GET_ColorFragmentOp2ATI(disp) GET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp2ATI_remap_index]) +#define SET_ColorFragmentOp2ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp2ATI_remap_index], fn) +#define CALL_ColorFragmentOp3ATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint, GLuint)), driDispatchRemapTable[ColorFragmentOp3ATI_remap_index], parameters) +#define GET_ColorFragmentOp3ATI(disp) GET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp3ATI_remap_index]) +#define SET_ColorFragmentOp3ATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ColorFragmentOp3ATI_remap_index], fn) +#define CALL_DeleteFragmentShaderATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[DeleteFragmentShaderATI_remap_index], parameters) +#define GET_DeleteFragmentShaderATI(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteFragmentShaderATI_remap_index]) +#define SET_DeleteFragmentShaderATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteFragmentShaderATI_remap_index], fn) +#define CALL_EndFragmentShaderATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(void)), driDispatchRemapTable[EndFragmentShaderATI_remap_index], parameters) +#define GET_EndFragmentShaderATI(disp) GET_by_offset(disp, driDispatchRemapTable[EndFragmentShaderATI_remap_index]) +#define SET_EndFragmentShaderATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[EndFragmentShaderATI_remap_index], fn) +#define CALL_GenFragmentShadersATI(disp, parameters) CALL_by_offset(disp, (GLuint (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[GenFragmentShadersATI_remap_index], parameters) +#define GET_GenFragmentShadersATI(disp) GET_by_offset(disp, driDispatchRemapTable[GenFragmentShadersATI_remap_index]) +#define SET_GenFragmentShadersATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenFragmentShadersATI_remap_index], fn) +#define CALL_PassTexCoordATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint, GLenum)), driDispatchRemapTable[PassTexCoordATI_remap_index], parameters) +#define GET_PassTexCoordATI(disp) GET_by_offset(disp, driDispatchRemapTable[PassTexCoordATI_remap_index]) +#define SET_PassTexCoordATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PassTexCoordATI_remap_index], fn) +#define CALL_SampleMapATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLuint, GLenum)), driDispatchRemapTable[SampleMapATI_remap_index], parameters) +#define GET_SampleMapATI(disp) GET_by_offset(disp, driDispatchRemapTable[SampleMapATI_remap_index]) +#define SET_SampleMapATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SampleMapATI_remap_index], fn) +#define CALL_SetFragmentShaderConstantATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, const GLfloat *)), driDispatchRemapTable[SetFragmentShaderConstantATI_remap_index], parameters) +#define GET_SetFragmentShaderConstantATI(disp) GET_by_offset(disp, driDispatchRemapTable[SetFragmentShaderConstantATI_remap_index]) +#define SET_SetFragmentShaderConstantATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[SetFragmentShaderConstantATI_remap_index], fn) +#define CALL_PointParameteriNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLint)), driDispatchRemapTable[PointParameteriNV_remap_index], parameters) +#define GET_PointParameteriNV(disp) GET_by_offset(disp, driDispatchRemapTable[PointParameteriNV_remap_index]) +#define SET_PointParameteriNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PointParameteriNV_remap_index], fn) +#define CALL_PointParameterivNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, const GLint *)), driDispatchRemapTable[PointParameterivNV_remap_index], parameters) +#define GET_PointParameterivNV(disp) GET_by_offset(disp, driDispatchRemapTable[PointParameterivNV_remap_index]) +#define SET_PointParameterivNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[PointParameterivNV_remap_index], fn) +#define CALL_ActiveStencilFaceEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[ActiveStencilFaceEXT_remap_index], parameters) +#define GET_ActiveStencilFaceEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ActiveStencilFaceEXT_remap_index]) +#define SET_ActiveStencilFaceEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ActiveStencilFaceEXT_remap_index], fn) +#define CALL_BindVertexArrayAPPLE(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[BindVertexArrayAPPLE_remap_index], parameters) +#define GET_BindVertexArrayAPPLE(disp) GET_by_offset(disp, driDispatchRemapTable[BindVertexArrayAPPLE_remap_index]) +#define SET_BindVertexArrayAPPLE(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindVertexArrayAPPLE_remap_index], fn) +#define CALL_DeleteVertexArraysAPPLE(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteVertexArraysAPPLE_remap_index], parameters) +#define GET_DeleteVertexArraysAPPLE(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteVertexArraysAPPLE_remap_index]) +#define SET_DeleteVertexArraysAPPLE(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteVertexArraysAPPLE_remap_index], fn) +#define CALL_GenVertexArraysAPPLE(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenVertexArraysAPPLE_remap_index], parameters) +#define GET_GenVertexArraysAPPLE(disp) GET_by_offset(disp, driDispatchRemapTable[GenVertexArraysAPPLE_remap_index]) +#define SET_GenVertexArraysAPPLE(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenVertexArraysAPPLE_remap_index], fn) +#define CALL_IsVertexArrayAPPLE(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsVertexArrayAPPLE_remap_index], parameters) +#define GET_IsVertexArrayAPPLE(disp) GET_by_offset(disp, driDispatchRemapTable[IsVertexArrayAPPLE_remap_index]) +#define SET_IsVertexArrayAPPLE(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsVertexArrayAPPLE_remap_index], fn) +#define CALL_GetProgramNamedParameterdvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, GLdouble *)), driDispatchRemapTable[GetProgramNamedParameterdvNV_remap_index], parameters) +#define GET_GetProgramNamedParameterdvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramNamedParameterdvNV_remap_index]) +#define SET_GetProgramNamedParameterdvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramNamedParameterdvNV_remap_index], fn) +#define CALL_GetProgramNamedParameterfvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, GLfloat *)), driDispatchRemapTable[GetProgramNamedParameterfvNV_remap_index], parameters) +#define GET_GetProgramNamedParameterfvNV(disp) GET_by_offset(disp, driDispatchRemapTable[GetProgramNamedParameterfvNV_remap_index]) +#define SET_GetProgramNamedParameterfvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetProgramNamedParameterfvNV_remap_index], fn) +#define CALL_ProgramNamedParameter4dNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, GLdouble, GLdouble, GLdouble, GLdouble)), driDispatchRemapTable[ProgramNamedParameter4dNV_remap_index], parameters) +#define GET_ProgramNamedParameter4dNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4dNV_remap_index]) +#define SET_ProgramNamedParameter4dNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4dNV_remap_index], fn) +#define CALL_ProgramNamedParameter4dvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, const GLdouble *)), driDispatchRemapTable[ProgramNamedParameter4dvNV_remap_index], parameters) +#define GET_ProgramNamedParameter4dvNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4dvNV_remap_index]) +#define SET_ProgramNamedParameter4dvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4dvNV_remap_index], fn) +#define CALL_ProgramNamedParameter4fNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, GLfloat, GLfloat, GLfloat, GLfloat)), driDispatchRemapTable[ProgramNamedParameter4fNV_remap_index], parameters) +#define GET_ProgramNamedParameter4fNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4fNV_remap_index]) +#define SET_ProgramNamedParameter4fNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4fNV_remap_index], fn) +#define CALL_ProgramNamedParameter4fvNV(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLsizei, const GLubyte *, const GLfloat *)), driDispatchRemapTable[ProgramNamedParameter4fvNV_remap_index], parameters) +#define GET_ProgramNamedParameter4fvNV(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4fvNV_remap_index]) +#define SET_ProgramNamedParameter4fvNV(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramNamedParameter4fvNV_remap_index], fn) +#define CALL_DepthBoundsEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLclampd, GLclampd)), driDispatchRemapTable[DepthBoundsEXT_remap_index], parameters) +#define GET_DepthBoundsEXT(disp) GET_by_offset(disp, driDispatchRemapTable[DepthBoundsEXT_remap_index]) +#define SET_DepthBoundsEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DepthBoundsEXT_remap_index], fn) +#define CALL_BlendEquationSeparateEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum)), driDispatchRemapTable[BlendEquationSeparateEXT_remap_index], parameters) +#define GET_BlendEquationSeparateEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BlendEquationSeparateEXT_remap_index]) +#define SET_BlendEquationSeparateEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BlendEquationSeparateEXT_remap_index], fn) +#define CALL_BindFramebufferEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[BindFramebufferEXT_remap_index], parameters) +#define GET_BindFramebufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BindFramebufferEXT_remap_index]) +#define SET_BindFramebufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindFramebufferEXT_remap_index], fn) +#define CALL_BindRenderbufferEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint)), driDispatchRemapTable[BindRenderbufferEXT_remap_index], parameters) +#define GET_BindRenderbufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BindRenderbufferEXT_remap_index]) +#define SET_BindRenderbufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BindRenderbufferEXT_remap_index], fn) +#define CALL_CheckFramebufferStatusEXT(disp, parameters) CALL_by_offset(disp, (GLenum (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[CheckFramebufferStatusEXT_remap_index], parameters) +#define GET_CheckFramebufferStatusEXT(disp) GET_by_offset(disp, driDispatchRemapTable[CheckFramebufferStatusEXT_remap_index]) +#define SET_CheckFramebufferStatusEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[CheckFramebufferStatusEXT_remap_index], fn) +#define CALL_DeleteFramebuffersEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteFramebuffersEXT_remap_index], parameters) +#define GET_DeleteFramebuffersEXT(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteFramebuffersEXT_remap_index]) +#define SET_DeleteFramebuffersEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteFramebuffersEXT_remap_index], fn) +#define CALL_DeleteRenderbuffersEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, const GLuint *)), driDispatchRemapTable[DeleteRenderbuffersEXT_remap_index], parameters) +#define GET_DeleteRenderbuffersEXT(disp) GET_by_offset(disp, driDispatchRemapTable[DeleteRenderbuffersEXT_remap_index]) +#define SET_DeleteRenderbuffersEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[DeleteRenderbuffersEXT_remap_index], fn) +#define CALL_FramebufferRenderbufferEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLuint)), driDispatchRemapTable[FramebufferRenderbufferEXT_remap_index], parameters) +#define GET_FramebufferRenderbufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferRenderbufferEXT_remap_index]) +#define SET_FramebufferRenderbufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferRenderbufferEXT_remap_index], fn) +#define CALL_FramebufferTexture1DEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLuint, GLint)), driDispatchRemapTable[FramebufferTexture1DEXT_remap_index], parameters) +#define GET_FramebufferTexture1DEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferTexture1DEXT_remap_index]) +#define SET_FramebufferTexture1DEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferTexture1DEXT_remap_index], fn) +#define CALL_FramebufferTexture2DEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLuint, GLint)), driDispatchRemapTable[FramebufferTexture2DEXT_remap_index], parameters) +#define GET_FramebufferTexture2DEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferTexture2DEXT_remap_index]) +#define SET_FramebufferTexture2DEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferTexture2DEXT_remap_index], fn) +#define CALL_FramebufferTexture3DEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLuint, GLint, GLint)), driDispatchRemapTable[FramebufferTexture3DEXT_remap_index], parameters) +#define GET_FramebufferTexture3DEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferTexture3DEXT_remap_index]) +#define SET_FramebufferTexture3DEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferTexture3DEXT_remap_index], fn) +#define CALL_GenFramebuffersEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenFramebuffersEXT_remap_index], parameters) +#define GET_GenFramebuffersEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GenFramebuffersEXT_remap_index]) +#define SET_GenFramebuffersEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenFramebuffersEXT_remap_index], fn) +#define CALL_GenRenderbuffersEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLsizei, GLuint *)), driDispatchRemapTable[GenRenderbuffersEXT_remap_index], parameters) +#define GET_GenRenderbuffersEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GenRenderbuffersEXT_remap_index]) +#define SET_GenRenderbuffersEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenRenderbuffersEXT_remap_index], fn) +#define CALL_GenerateMipmapEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[GenerateMipmapEXT_remap_index], parameters) +#define GET_GenerateMipmapEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GenerateMipmapEXT_remap_index]) +#define SET_GenerateMipmapEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GenerateMipmapEXT_remap_index], fn) +#define CALL_GetFramebufferAttachmentParameterivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLenum, GLint *)), driDispatchRemapTable[GetFramebufferAttachmentParameterivEXT_remap_index], parameters) +#define GET_GetFramebufferAttachmentParameterivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetFramebufferAttachmentParameterivEXT_remap_index]) +#define SET_GetFramebufferAttachmentParameterivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetFramebufferAttachmentParameterivEXT_remap_index], fn) +#define CALL_GetRenderbufferParameterivEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint *)), driDispatchRemapTable[GetRenderbufferParameterivEXT_remap_index], parameters) +#define GET_GetRenderbufferParameterivEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetRenderbufferParameterivEXT_remap_index]) +#define SET_GetRenderbufferParameterivEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetRenderbufferParameterivEXT_remap_index], fn) +#define CALL_IsFramebufferEXT(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsFramebufferEXT_remap_index], parameters) +#define GET_IsFramebufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[IsFramebufferEXT_remap_index]) +#define SET_IsFramebufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsFramebufferEXT_remap_index], fn) +#define CALL_IsRenderbufferEXT(disp, parameters) CALL_by_offset(disp, (GLboolean (GLAPIENTRYP)(GLuint)), driDispatchRemapTable[IsRenderbufferEXT_remap_index], parameters) +#define GET_IsRenderbufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[IsRenderbufferEXT_remap_index]) +#define SET_IsRenderbufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[IsRenderbufferEXT_remap_index], fn) +#define CALL_RenderbufferStorageEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLsizei, GLsizei)), driDispatchRemapTable[RenderbufferStorageEXT_remap_index], parameters) +#define GET_RenderbufferStorageEXT(disp) GET_by_offset(disp, driDispatchRemapTable[RenderbufferStorageEXT_remap_index]) +#define SET_RenderbufferStorageEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[RenderbufferStorageEXT_remap_index], fn) +#define CALL_BlitFramebufferEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum)), driDispatchRemapTable[BlitFramebufferEXT_remap_index], parameters) +#define GET_BlitFramebufferEXT(disp) GET_by_offset(disp, driDispatchRemapTable[BlitFramebufferEXT_remap_index]) +#define SET_BlitFramebufferEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BlitFramebufferEXT_remap_index], fn) +#define CALL_BufferParameteriAPPLE(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint)), driDispatchRemapTable[BufferParameteriAPPLE_remap_index], parameters) +#define GET_BufferParameteriAPPLE(disp) GET_by_offset(disp, driDispatchRemapTable[BufferParameteriAPPLE_remap_index]) +#define SET_BufferParameteriAPPLE(disp, fn) SET_by_offset(disp, driDispatchRemapTable[BufferParameteriAPPLE_remap_index], fn) +#define CALL_FlushMappedBufferRangeAPPLE(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLintptr, GLsizeiptr)), driDispatchRemapTable[FlushMappedBufferRangeAPPLE_remap_index], parameters) +#define GET_FlushMappedBufferRangeAPPLE(disp) GET_by_offset(disp, driDispatchRemapTable[FlushMappedBufferRangeAPPLE_remap_index]) +#define SET_FlushMappedBufferRangeAPPLE(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FlushMappedBufferRangeAPPLE_remap_index], fn) +#define CALL_FramebufferTextureLayerEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLuint, GLint, GLint)), driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index], parameters) +#define GET_FramebufferTextureLayerEXT(disp) GET_by_offset(disp, driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index]) +#define SET_FramebufferTextureLayerEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[FramebufferTextureLayerEXT_remap_index], fn) +#define CALL_ProvokingVertexEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum)), driDispatchRemapTable[ProvokingVertexEXT_remap_index], parameters) +#define GET_ProvokingVertexEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ProvokingVertexEXT_remap_index]) +#define SET_ProvokingVertexEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProvokingVertexEXT_remap_index], fn) +#define CALL_GetTexParameterPointervAPPLE(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLvoid **)), driDispatchRemapTable[GetTexParameterPointervAPPLE_remap_index], parameters) +#define GET_GetTexParameterPointervAPPLE(disp) GET_by_offset(disp, driDispatchRemapTable[GetTexParameterPointervAPPLE_remap_index]) +#define SET_GetTexParameterPointervAPPLE(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetTexParameterPointervAPPLE_remap_index], fn) +#define CALL_TextureRangeAPPLE(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLsizei, GLvoid *)), driDispatchRemapTable[TextureRangeAPPLE_remap_index], parameters) +#define GET_TextureRangeAPPLE(disp) GET_by_offset(disp, driDispatchRemapTable[TextureRangeAPPLE_remap_index]) +#define SET_TextureRangeAPPLE(disp, fn) SET_by_offset(disp, driDispatchRemapTable[TextureRangeAPPLE_remap_index], fn) +#define CALL_StencilFuncSeparateATI(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLenum, GLint, GLuint)), driDispatchRemapTable[StencilFuncSeparateATI_remap_index], parameters) +#define GET_StencilFuncSeparateATI(disp) GET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparateATI_remap_index]) +#define SET_StencilFuncSeparateATI(disp, fn) SET_by_offset(disp, driDispatchRemapTable[StencilFuncSeparateATI_remap_index], fn) +#define CALL_ProgramEnvParameters4fvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index], parameters) +#define GET_ProgramEnvParameters4fvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index]) +#define SET_ProgramEnvParameters4fvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramEnvParameters4fvEXT_remap_index], fn) +#define CALL_ProgramLocalParameters4fvEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLenum, GLuint, GLsizei, const GLfloat *)), driDispatchRemapTable[ProgramLocalParameters4fvEXT_remap_index], parameters) +#define GET_ProgramLocalParameters4fvEXT(disp) GET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameters4fvEXT_remap_index]) +#define SET_ProgramLocalParameters4fvEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[ProgramLocalParameters4fvEXT_remap_index], fn) +#define CALL_GetQueryObjecti64vEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLint64EXT *)), driDispatchRemapTable[GetQueryObjecti64vEXT_remap_index], parameters) +#define GET_GetQueryObjecti64vEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetQueryObjecti64vEXT_remap_index]) +#define SET_GetQueryObjecti64vEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetQueryObjecti64vEXT_remap_index], fn) +#define CALL_GetQueryObjectui64vEXT(disp, parameters) CALL_by_offset(disp, (void (GLAPIENTRYP)(GLuint, GLenum, GLuint64EXT *)), driDispatchRemapTable[GetQueryObjectui64vEXT_remap_index], parameters) +#define GET_GetQueryObjectui64vEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetQueryObjectui64vEXT_remap_index]) +#define SET_GetQueryObjectui64vEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetQueryObjectui64vEXT_remap_index], fn) + +#endif /* !defined(IN_DRI_DRIVER) */ + +#endif /* !defined( _GLAPI_DISPATCH_H_ ) */ -- cgit v1.2.3 From 6e99e6ddbf488f6955e34ef0bc438fdcb4d90f74 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 16 Oct 2009 16:04:06 +0800 Subject: glapi: Always build libglapi.a. This is made possible by making glapioffsets.h and glapidispatch.h internal headers of glapi. They should only be included indirectly through dispatch.h by mesa. Signed-off-by: Chia-I Wu --- src/mesa/Makefile | 6 +----- src/mesa/glapi/dispatch.h | 5 +++++ src/mesa/glapi/gl_offsets.py | 7 +++++-- src/mesa/glapi/gl_table.py | 6 ++++-- src/mesa/glapi/glapidispatch.h | 6 ++++-- src/mesa/glapi/glapioffsets.h | 6 ++++-- src/mesa/glapi/remap_helper.py | 1 - src/mesa/main/api_arrayelt.c | 1 - src/mesa/main/context.c | 1 - src/mesa/main/dispatch.c | 2 +- src/mesa/main/remap_helper.h | 1 - src/mesa/main/vtxfmt_tmp.h | 1 - 12 files changed, 24 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/mesa/Makefile b/src/mesa/Makefile index 8300b30144..6f58ad6161 100644 --- a/src/mesa/Makefile +++ b/src/mesa/Makefile @@ -39,11 +39,7 @@ libmesagallium.a: $(MESA_GALLIUM_OBJECTS) # Make archive of gl* API dispatcher functions only libglapi.a: $(GLAPI_OBJECTS) - @if [ "${WINDOW_SYSTEM}" = "dri" ] ; then \ - touch libglapi.a ; \ - else \ - $(MKLIB) -o glapi -static $(GLAPI_OBJECTS) ; \ - fi + $(MKLIB) -o glapi -static $(GLAPI_OBJECTS) ###################################################################### # Device drivers diff --git a/src/mesa/glapi/dispatch.h b/src/mesa/glapi/dispatch.h index dafcf3e8f2..6623d52469 100644 --- a/src/mesa/glapi/dispatch.h +++ b/src/mesa/glapi/dispatch.h @@ -26,7 +26,12 @@ #ifndef _DISPATCH_H #define _DISPATCH_H +#ifdef IN_DRI_DRIVER +#define _GLAPI_USE_REMAP_TABLE +#endif + #include "glapitable.h" +#include "glapioffsets.h" #include "glapidispatch.h" #endif /* _DISPATCH_H */ diff --git a/src/mesa/glapi/gl_offsets.py b/src/mesa/glapi/gl_offsets.py index 59f8d372b0..ca6c90ffd8 100644 --- a/src/mesa/glapi/gl_offsets.py +++ b/src/mesa/glapi/gl_offsets.py @@ -43,6 +43,9 @@ class PrintGlOffsets(gl_XML.gl_print_base): def printBody(self, api): abi = [ "1.0", "1.1", "1.2", "GL_ARB_multitexture" ] + print '/* this file should not be included directly in mesa */' + print '' + functions = [] abi_functions = [] count = 0 @@ -60,7 +63,7 @@ class PrintGlOffsets(gl_XML.gl_print_base): last_static = f.offset print '' - print '#if !defined(IN_DRI_DRIVER)' + print '#if !defined(_GLAPI_USE_REMAP_TABLE)' print '' for [f, index] in functions: @@ -76,7 +79,7 @@ class PrintGlOffsets(gl_XML.gl_print_base): print '#define _gloffset_%s driDispatchRemapTable[%s_remap_index]' % (f.name, f.name) print '' - print '#endif /* !defined(IN_DRI_DRIVER) */' + print '#endif /* !defined(_GLAPI_USE_REMAP_TABLE) */' return diff --git a/src/mesa/glapi/gl_table.py b/src/mesa/glapi/gl_table.py index 6cf26f89db..0e05b3431a 100644 --- a/src/mesa/glapi/gl_table.py +++ b/src/mesa/glapi/gl_table.py @@ -79,6 +79,8 @@ class PrintRemapTable(gl_XML.gl_print_base): def printRealHeader(self): print """ +/* this file should not be included directly in mesa */ + /** * \\file glapidispatch.h * Macros for handling GL dispatch tables. @@ -132,7 +134,7 @@ class PrintRemapTable(gl_XML.gl_print_base): print '' - print '#if !defined(IN_DRI_DRIVER)' + print '#if !defined(_GLAPI_USE_REMAP_TABLE)' print '' for [f, index] in functions: @@ -162,7 +164,7 @@ class PrintRemapTable(gl_XML.gl_print_base): print '' - print '#endif /* !defined(IN_DRI_DRIVER) */' + print '#endif /* !defined(_GLAPI_USE_REMAP_TABLE) */' return diff --git a/src/mesa/glapi/glapidispatch.h b/src/mesa/glapi/glapidispatch.h index 1d26dfb5bf..d6ba92824a 100644 --- a/src/mesa/glapi/glapidispatch.h +++ b/src/mesa/glapi/glapidispatch.h @@ -29,6 +29,8 @@ # define _GLAPI_DISPATCH_H_ +/* this file should not be included directly in mesa */ + /** * \file glapidispatch.h * Macros for handling GL dispatch tables. @@ -1281,7 +1283,7 @@ #define GET_MultiTexCoord4svARB(disp) ((disp)->MultiTexCoord4svARB) #define SET_MultiTexCoord4svARB(disp, fn) ((disp)->MultiTexCoord4svARB = fn) -#if !defined(IN_DRI_DRIVER) +#if !defined(_GLAPI_USE_REMAP_TABLE) #define CALL_AttachShader(disp, parameters) (*((disp)->AttachShader)) parameters #define GET_AttachShader(disp) ((disp)->AttachShader) @@ -4000,6 +4002,6 @@ extern int driDispatchRemapTable[ driDispatchRemapTable_size ]; #define GET_GetQueryObjectui64vEXT(disp) GET_by_offset(disp, driDispatchRemapTable[GetQueryObjectui64vEXT_remap_index]) #define SET_GetQueryObjectui64vEXT(disp, fn) SET_by_offset(disp, driDispatchRemapTable[GetQueryObjectui64vEXT_remap_index], fn) -#endif /* !defined(IN_DRI_DRIVER) */ +#endif /* !defined(_GLAPI_USE_REMAP_TABLE) */ #endif /* !defined( _GLAPI_DISPATCH_H_ ) */ diff --git a/src/mesa/glapi/glapioffsets.h b/src/mesa/glapi/glapioffsets.h index a3807744ff..3d10260a05 100644 --- a/src/mesa/glapi/glapioffsets.h +++ b/src/mesa/glapi/glapioffsets.h @@ -29,6 +29,8 @@ #if !defined( _GLAPI_OFFSETS_H_ ) # define _GLAPI_OFFSETS_H_ +/* this file should not be included directly in mesa */ + #define _gloffset_NewList 0 #define _gloffset_EndList 1 #define _gloffset_CallList 2 @@ -438,7 +440,7 @@ #define _gloffset_MultiTexCoord4sARB 406 #define _gloffset_MultiTexCoord4svARB 407 -#if !defined(IN_DRI_DRIVER) +#if !defined(_GLAPI_USE_REMAP_TABLE) #define _gloffset_AttachShader 408 #define _gloffset_CreateProgram 409 @@ -1219,6 +1221,6 @@ #define _gloffset_GetQueryObjecti64vEXT driDispatchRemapTable[GetQueryObjecti64vEXT_remap_index] #define _gloffset_GetQueryObjectui64vEXT driDispatchRemapTable[GetQueryObjectui64vEXT_remap_index] -#endif /* !defined(IN_DRI_DRIVER) */ +#endif /* !defined(_GLAPI_USE_REMAP_TABLE) */ #endif /* !defined( _GLAPI_OFFSETS_H_ ) */ diff --git a/src/mesa/glapi/remap_helper.py b/src/mesa/glapi/remap_helper.py index 7e68a908e3..e47583a5d3 100644 --- a/src/mesa/glapi/remap_helper.py +++ b/src/mesa/glapi/remap_helper.py @@ -65,7 +65,6 @@ class PrintGlRemap(gl_XML.gl_print_base): def printRealHeader(self): print '#include "glapi/dispatch.h"' - print '#include "glapi/glapioffsets.h"' print '' return diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c index a058227110..469b4529f9 100644 --- a/src/mesa/main/api_arrayelt.c +++ b/src/mesa/main/api_arrayelt.c @@ -32,7 +32,6 @@ #include "context.h" #include "imports.h" #include "macros.h" -#include "glapi/glapioffsets.h" #include "glapi/dispatch.h" typedef void (GLAPIENTRY *array_func)( const void * ); diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index ea820d77b3..c57d7c10b6 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -133,7 +133,6 @@ #include "viewport.h" #include "vtxfmt.h" #include "glapi/glthread.h" -#include "glapi/glapioffsets.h" #include "glapi/glapitable.h" #include "shader/program.h" #include "shader/prog_print.h" diff --git a/src/mesa/main/dispatch.c b/src/mesa/main/dispatch.c index bf1a013789..97d213e8e1 100644 --- a/src/mesa/main/dispatch.c +++ b/src/mesa/main/dispatch.c @@ -43,6 +43,7 @@ #include "main/compiler.h" #include "glapi/glapi.h" #include "glapi/glapitable.h" +#include "glapi/glapidispatch.h" #include "glapi/glthread.h" @@ -88,7 +89,6 @@ #define GLAPIENTRY #endif -#include "glapi/dispatch.h" #include "glapi/glapitemp.h" #endif /* USE_X86_ASM */ diff --git a/src/mesa/main/remap_helper.h b/src/mesa/main/remap_helper.h index 89192d37e5..3886f41862 100644 --- a/src/mesa/main/remap_helper.h +++ b/src/mesa/main/remap_helper.h @@ -26,7 +26,6 @@ */ #include "glapi/dispatch.h" -#include "glapi/glapioffsets.h" struct gl_function_remap { GLint func_index; diff --git a/src/mesa/main/vtxfmt_tmp.h b/src/mesa/main/vtxfmt_tmp.h index d56a2bb95e..ae636fb24f 100644 --- a/src/mesa/main/vtxfmt_tmp.h +++ b/src/mesa/main/vtxfmt_tmp.h @@ -30,7 +30,6 @@ #endif #include "glapi/dispatch.h" -#include "glapi/glapioffsets.h" static void GLAPIENTRY TAG(ArrayElement)( GLint i ) { -- cgit v1.2.3 From c84a05676497ff7263f3ea8203b868071c4f678f Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Fri, 23 Oct 2009 18:40:13 +0200 Subject: nouveau: nv30: use r5g6b5 as z16 format --- src/gallium/drivers/nv30/nv30_fragtex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nv30/nv30_fragtex.c b/src/gallium/drivers/nv30/nv30_fragtex.c index f5f17d4071..3dd636f4ee 100644 --- a/src/gallium/drivers/nv30/nv30_fragtex.c +++ b/src/gallium/drivers/nv30/nv30_fragtex.c @@ -29,7 +29,7 @@ nv30_texture_formats[] = { _(A8_UNORM , L8 , ZERO, ZERO, ZERO, S1, X, X, X, X), _(I8_UNORM , L8 , S1, S1, S1, S1, X, X, X, X), _(A8L8_UNORM , A8L8 , S1, S1, S1, S1, X, X, X, Y), -// _(Z16_UNORM , Z16 , S1, S1, S1, ONE, X, X, X, X), + _(Z16_UNORM , R5G6B5 , S1, S1, S1, ONE, X, X, X, X), _(Z24S8_UNORM , A8R8G8B8, S1, S1, S1, ONE, X, X, X, X), _(DXT1_RGB , DXT1 , S1, S1, S1, ONE, X, Y, Z, W), _(DXT1_RGBA , DXT1 , S1, S1, S1, S1, X, Y, Z, W), -- cgit v1.2.3 From d9014a13e72b6682a959217d38050f3252628edb Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Fri, 23 Oct 2009 18:42:21 +0200 Subject: nouveau: nv30: Relax some limits. We can render to z24s8 buffer even if color buffer is 16 bits. --- src/gallium/drivers/nv30/nv30_screen.c | 10 ++++++++-- src/gallium/drivers/nv30/nv30_state_fb.c | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c index bb40e1803d..221ae1b5f8 100644 --- a/src/gallium/drivers/nv30/nv30_screen.c +++ b/src/gallium/drivers/nv30/nv30_screen.c @@ -102,13 +102,19 @@ nv30_screen_surface_format_supported(struct pipe_screen *pscreen, struct pipe_surface *front = ((struct nouveau_winsys *) pscreen->winsys)->front; if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) { - return (format == front->format); + switch (format) { + case PIPE_FORMAT_A8R8G8B8_UNORM: + case PIPE_FORMAT_R5G6B5_UNORM: + return TRUE; + default: + break; + } } else if (tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) { switch (format) { case PIPE_FORMAT_Z24S8_UNORM: case PIPE_FORMAT_Z24X8_UNORM: - return (front->format == PIPE_FORMAT_A8R8G8B8_UNORM); + return TRUE; case PIPE_FORMAT_Z16_UNORM: return (front->format == PIPE_FORMAT_R5G6B5_UNORM); default: diff --git a/src/gallium/drivers/nv30/nv30_state_fb.c b/src/gallium/drivers/nv30/nv30_state_fb.c index f90681b0f9..4d6a67e56d 100644 --- a/src/gallium/drivers/nv30/nv30_state_fb.c +++ b/src/gallium/drivers/nv30/nv30_state_fb.c @@ -92,7 +92,7 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) assert(0); } - if (colour_bits != zeta_bits) { + if (colour_bits > zeta_bits) { return FALSE; } -- cgit v1.2.3 From 255a90a7bd829904554889dd19a16d86fc7f9274 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Fri, 23 Oct 2009 20:05:31 +0200 Subject: nv50: add depth texture formats, and a few others, too --- src/gallium/drivers/nv50/nv50_screen.c | 14 +++++++++ src/gallium/drivers/nv50/nv50_state_validate.c | 39 +++++++++++------------- src/gallium/drivers/nv50/nv50_tex.c | 42 +++++++++++++++++++------- src/gallium/drivers/nv50/nv50_texture.h | 13 ++++++++ 4 files changed, 76 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index 63dce0f4c2..c672ea471a 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -38,6 +38,11 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen, case PIPE_FORMAT_X8R8G8B8_UNORM: case PIPE_FORMAT_A8R8G8B8_UNORM: case PIPE_FORMAT_R5G6B5_UNORM: + case PIPE_FORMAT_R16G16B16A16_SNORM: + case PIPE_FORMAT_R16G16B16A16_UNORM: + case PIPE_FORMAT_R32G32B32A32_FLOAT: + case PIPE_FORMAT_R16G16_SNORM: + case PIPE_FORMAT_R16G16_UNORM: return TRUE; default: break; @@ -57,6 +62,8 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen, switch (format) { case PIPE_FORMAT_A8R8G8B8_UNORM: case PIPE_FORMAT_X8R8G8B8_UNORM: + case PIPE_FORMAT_A8R8G8B8_SRGB: + case PIPE_FORMAT_X8R8G8B8_SRGB: case PIPE_FORMAT_A1R5G5B5_UNORM: case PIPE_FORMAT_A4R4G4B4_UNORM: case PIPE_FORMAT_R5G6B5_UNORM: @@ -68,6 +75,13 @@ nv50_screen_is_format_supported(struct pipe_screen *pscreen, case PIPE_FORMAT_DXT1_RGBA: case PIPE_FORMAT_DXT3_RGBA: case PIPE_FORMAT_DXT5_RGBA: + case PIPE_FORMAT_Z24S8_UNORM: + case PIPE_FORMAT_Z32_FLOAT: + case PIPE_FORMAT_R16G16B16A16_SNORM: + case PIPE_FORMAT_R16G16B16A16_UNORM: + case PIPE_FORMAT_R32G32B32A32_FLOAT: + case PIPE_FORMAT_R16G16_SNORM: + case PIPE_FORMAT_R16G16_UNORM: return TRUE; default: break; diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index 012911f41b..956a700615 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -23,6 +23,12 @@ #include "nv50_context.h" #include "nouveau/nouveau_stateobj.h" +#define NV50_CBUF_FORMAT_CASE(n) \ + case PIPE_FORMAT_##n: so_data(so, NV50TCL_RT_FORMAT_##n); break + +#define NV50_ZETA_FORMAT_CASE(n) \ + case PIPE_FORMAT_##n: so_data(so, NV50TCL_ZETA_FORMAT_##n); break + static void nv50_state_validate_fb(struct nv50_context *nv50) { @@ -54,15 +60,14 @@ nv50_state_validate_fb(struct nv50_context *nv50) so_reloc (so, bo, fb->cbufs[i]->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW | NOUVEAU_BO_RDWR, 0, 0); switch (fb->cbufs[i]->format) { - case PIPE_FORMAT_A8R8G8B8_UNORM: - so_data(so, NV50TCL_RT_FORMAT_A8R8G8B8_UNORM); - break; - case PIPE_FORMAT_X8R8G8B8_UNORM: - so_data(so, NV50TCL_RT_FORMAT_X8R8G8B8_UNORM); - break; - case PIPE_FORMAT_R5G6B5_UNORM: - so_data(so, NV50TCL_RT_FORMAT_R5G6B5_UNORM); - break; + NV50_CBUF_FORMAT_CASE(A8R8G8B8_UNORM); + NV50_CBUF_FORMAT_CASE(X8R8G8B8_UNORM); + NV50_CBUF_FORMAT_CASE(R5G6B5_UNORM); + NV50_CBUF_FORMAT_CASE(R16G16B16A16_SNORM); + NV50_CBUF_FORMAT_CASE(R16G16B16A16_UNORM); + NV50_CBUF_FORMAT_CASE(R32G32B32A32_FLOAT); + NV50_CBUF_FORMAT_CASE(R16G16_SNORM); + NV50_CBUF_FORMAT_CASE(R16G16_UNORM); default: NOUVEAU_ERR("AIIII unknown format %s\n", pf_name(fb->cbufs[i]->format)); @@ -96,18 +101,10 @@ nv50_state_validate_fb(struct nv50_context *nv50) so_reloc (so, bo, fb->zsbuf->offset, NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW | NOUVEAU_BO_RDWR, 0, 0); switch (fb->zsbuf->format) { - case PIPE_FORMAT_Z32_FLOAT: - so_data(so, NV50TCL_ZETA_FORMAT_Z32_FLOAT); - break; - case PIPE_FORMAT_Z24S8_UNORM: - so_data(so, NV50TCL_ZETA_FORMAT_Z24S8_UNORM); - break; - case PIPE_FORMAT_X8Z24_UNORM: - so_data(so, NV50TCL_ZETA_FORMAT_X8Z24_UNORM); - break; - case PIPE_FORMAT_S8Z24_UNORM: - so_data(so, NV50TCL_ZETA_FORMAT_S8Z24_UNORM); - break; + NV50_ZETA_FORMAT_CASE(S8Z24_UNORM); + NV50_ZETA_FORMAT_CASE(X8Z24_UNORM); + NV50_ZETA_FORMAT_CASE(Z24S8_UNORM); + NV50_ZETA_FORMAT_CASE(Z32_FLOAT); default: NOUVEAU_ERR("AIIII unknown format %s\n", pf_name(fb->zsbuf->format)); diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index e12a6ad648..52ccdaa407 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -25,16 +25,18 @@ #include "nouveau/nouveau_stateobj.h" -#define _(pf, tt, r, g, b, a, tf) \ +#define _MIXED(pf, t0, t1, t2, t3, cr, cg, cb, ca, f) \ { \ PIPE_FORMAT_##pf, \ - NV50TIC_0_0_MAPR_##r | NV50TIC_0_0_TYPER_##tt | \ - NV50TIC_0_0_MAPG_##g | NV50TIC_0_0_TYPEG_##tt | \ - NV50TIC_0_0_MAPB_##b | NV50TIC_0_0_TYPEB_##tt | \ - NV50TIC_0_0_MAPA_##a | NV50TIC_0_0_TYPEA_##tt | \ - NV50TIC_0_0_FMT_##tf \ + NV50TIC_0_0_MAPR_##cr | NV50TIC_0_0_TYPER_##t0 | \ + NV50TIC_0_0_MAPG_##cg | NV50TIC_0_0_TYPEG_##t1 | \ + NV50TIC_0_0_MAPB_##cb | NV50TIC_0_0_TYPEB_##t2 | \ + NV50TIC_0_0_MAPA_##ca | NV50TIC_0_0_TYPEA_##t3 | \ + NV50TIC_0_0_FMT_##f \ } +#define _(pf, t, cr, cg, cb, ca, f) _MIXED(pf, t, t, t, t, cr, cg, cb, ca, f) + struct nv50_texture_format { enum pipe_format pf; uint32_t hw; @@ -46,7 +48,9 @@ struct nv50_texture_format { static const struct nv50_texture_format nv50_tex_format_list[] = { _(A8R8G8B8_UNORM, UNORM, C2, C1, C0, C3, 8_8_8_8), + _(A8R8G8B8_SRGB, UNORM, C2, C1, C0, C3, 8_8_8_8), _(X8R8G8B8_UNORM, UNORM, C2, C1, C0, ONE, 8_8_8_8), + _(X8R8G8B8_SRGB, UNORM, C2, C1, C0, ONE, 8_8_8_8), _(A1R5G5B5_UNORM, UNORM, C2, C1, C0, C3, 1_5_5_5), _(A4R4G4B4_UNORM, UNORM, C2, C1, C0, C3, 4_4_4_4), @@ -61,16 +65,30 @@ static const struct nv50_texture_format nv50_tex_format_list[] = _(DXT1_RGB, UNORM, C0, C1, C2, ONE, DXT1), _(DXT1_RGBA, UNORM, C0, C1, C2, C3, DXT1), _(DXT3_RGBA, UNORM, C0, C1, C2, C3, DXT3), - _(DXT5_RGBA, UNORM, C0, C1, C2, C3, DXT5) + _(DXT5_RGBA, UNORM, C0, C1, C2, C3, DXT5), + + _MIXED(Z24S8_UNORM, UINT, UNORM, UINT, UINT, C1, C1, C1, ONE, 24_8), + + _(R16G16B16A16_SNORM, UNORM, C0, C1, C2, C3, 16_16_16_16), + _(R16G16B16A16_UNORM, SNORM, C0, C1, C2, C3, 16_16_16_16), + _(R32G32B32A32_FLOAT, FLOAT, C0, C1, C2, C3, 32_32_32_32), + + _(R16G16_SNORM, SNORM, C0, C1, ZERO, ONE, 16_16), + _(R16G16_UNORM, UNORM, C0, C1, ZERO, ONE, 16_16), + + _MIXED(Z32_FLOAT, FLOAT, UINT, UINT, UINT, C0, C0, C0, ONE, 32_DEPTH) + }; #undef _ +#undef _MIXED static int nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so, struct nv50_miptree *mt, int unit) { unsigned i; + uint32_t mode; for (i = 0; i < NV50_TEX_FORMAT_LIST_SIZE; i++) if (nv50_tex_format_list[i].pf == mt->base.base.format) @@ -78,13 +96,15 @@ nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so, if (i == NV50_TEX_FORMAT_LIST_SIZE) return 1; + mode = (nv50->sampler[unit]->normalized ? 0xd0005000 : 0x5001d000) | + (mt->base.bo->tile_mode << 22); + if (pf_type(mt->base.base.format) == PIPE_FORMAT_TYPE_SRGB) + mode |= 0x0400; + so_data (so, nv50_tex_format_list[i].hw); so_reloc(so, mt->base.bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW | NOUVEAU_BO_RD, 0, 0); - if (nv50->sampler[unit]->normalized) - so_data (so, 0xd0005000 | mt->base.bo->tile_mode << 22); - else - so_data (so, 0x5001d000 | mt->base.bo->tile_mode << 22); + so_data (so, mode); so_data (so, 0x00300000); so_data (so, mt->base.base.width[0]); so_data (so, (mt->base.base.last_level << 28) | diff --git a/src/gallium/drivers/nv50/nv50_texture.h b/src/gallium/drivers/nv50/nv50_texture.h index 13f74c11c6..d531e61132 100644 --- a/src/gallium/drivers/nv50/nv50_texture.h +++ b/src/gallium/drivers/nv50/nv50_texture.h @@ -38,18 +38,26 @@ #define NV50TIC_0_0_TYPEA_MASK 0x00038000 #define NV50TIC_0_0_TYPEA_UNORM 0x00010000 #define NV50TIC_0_0_TYPEA_SNORM 0x00008000 +#define NV50TIC_0_0_TYPEA_SINT 0x00018000 +#define NV50TIC_0_0_TYPEA_UINT 0x00020000 #define NV50TIC_0_0_TYPEA_FLOAT 0x00038000 #define NV50TIC_0_0_TYPEB_MASK 0x00007000 #define NV50TIC_0_0_TYPEB_UNORM 0x00002000 #define NV50TIC_0_0_TYPEB_SNORM 0x00001000 +#define NV50TIC_0_0_TYPEB_SINT 0x00003000 +#define NV50TIC_0_0_TYPEB_UINT 0x00004000 #define NV50TIC_0_0_TYPEB_FLOAT 0x00007000 #define NV50TIC_0_0_TYPEG_MASK 0x00000e00 #define NV50TIC_0_0_TYPEG_UNORM 0x00000400 #define NV50TIC_0_0_TYPEG_SNORM 0x00000200 +#define NV50TIC_0_0_TYPEG_SINT 0x00000600 +#define NV50TIC_0_0_TYPEG_UINT 0x00000800 #define NV50TIC_0_0_TYPEG_FLOAT 0x00000e00 #define NV50TIC_0_0_TYPER_MASK 0x000001c0 #define NV50TIC_0_0_TYPER_UNORM 0x00000080 #define NV50TIC_0_0_TYPER_SNORM 0x00000040 +#define NV50TIC_0_0_TYPER_SINT 0x000000c0 +#define NV50TIC_0_0_TYPER_UINT 0x00000100 #define NV50TIC_0_0_TYPER_FLOAT 0x000001c0 #define NV50TIC_0_0_FMT_MASK 0x0000003f #define NV50TIC_0_0_FMT_32_32_32_32 0x00000001 @@ -57,6 +65,7 @@ #define NV50TIC_0_0_FMT_32_32 0x00000004 #define NV50TIC_0_0_FMT_8_8_8_8 0x00000008 #define NV50TIC_0_0_FMT_2_10_10_10 0x00000009 +#define NV50TIC_0_0_FMT_16_16 0x0000000c #define NV50TIC_0_0_FMT_32 0x0000000f #define NV50TIC_0_0_FMT_4_4_4_4 0x00000012 /* #define NV50TIC_0_0_FMT_1_5_5_5 0x00000013 */ @@ -65,12 +74,16 @@ #define NV50TIC_0_0_FMT_8_8 0x00000018 #define NV50TIC_0_0_FMT_16 0x0000001b #define NV50TIC_0_0_FMT_8 0x0000001d +#define NV50TIC_0_0_FMT_5_9_9_9 0x00000020 #define NV50TIC_0_0_FMT_10_11_11 0x00000021 #define NV50TIC_0_0_FMT_DXT1 0x00000024 #define NV50TIC_0_0_FMT_DXT3 0x00000025 #define NV50TIC_0_0_FMT_DXT5 0x00000026 #define NV50TIC_0_0_FMT_RGTC1 0x00000027 #define NV50TIC_0_0_FMT_RGTC2 0x00000028 +#define NV50TIC_0_0_FMT_24_8 0x00000029 +#define NV50TIC_0_0_FMT_32_DEPTH 0x0000002f +#define NV50TIC_0_0_FMT_32_8 0x00000030 #define NV50TIC_0_1_OFFSET_LOW_MASK 0xffffffff #define NV50TIC_0_1_OFFSET_LOW_SHIFT 0 -- cgit v1.2.3 From c738c9ab67859f3d4412417333d0f023dd18dc19 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Fri, 23 Oct 2009 22:17:44 +0200 Subject: nv50: fix address reg code Contained some rather obvious thinking errors before, and didn't consider offsets from TGSI ADDRESS regs. --- src/gallium/drivers/nv50/nv50_program.c | 67 ++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 5c691877e0..ff6ff578f4 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -32,9 +32,11 @@ #include "nv50_context.h" #define NV50_SU_MAX_TEMP 64 -#define NV50_SU_MAX_ADDR 7 +#define NV50_SU_MAX_ADDR 4 //#define NV50_PROGRAM_DUMP +/* $a5 and $a6 always seem to be 0, and using $a7 gives you noise */ + /* ARL - gallium craps itself on progs/vp/arl.txt * * MSB - Like MAD, but MUL+SUB @@ -470,16 +472,28 @@ set_immd(struct nv50_pc *pc, struct nv50_reg *imm, struct nv50_program_exec *e) e->inst[1] |= (val >> 6) << 2; } +static INLINE void +set_addr(struct nv50_program_exec *e, struct nv50_reg *a) +{ + assert(!(e->inst[0] & 0x0c000000)); + assert(!(e->inst[1] & 0x00000004)); + + e->inst[0] |= (a->hw & 3) << 26; + e->inst[1] |= (a->hw >> 2) << 2; +} + static void -emit_set_addr(struct nv50_pc *pc, struct nv50_reg *dst, unsigned val) +emit_add_addr_imm(struct nv50_pc *pc, struct nv50_reg *dst, + struct nv50_reg *src0, uint16_t src1_val) { struct nv50_program_exec *e = exec(pc); - assert(val <= 0xffff); - e->inst[0] = 0xd0000000 | ((val & 0xffff) << 9); + e->inst[0] = 0xd0000000 | (src1_val << 9); e->inst[1] = 0x20000000; - e->inst[0] |= dst->hw << 2; set_long(pc, e); + e->inst[0] |= dst->hw << 2; + if (src0) /* otherwise will add to $a0, which is always 0 */ + set_addr(e, src0); emit(pc, e); } @@ -488,9 +502,10 @@ static struct nv50_reg * alloc_addr(struct nv50_pc *pc, struct nv50_reg *ref) { int i; - struct nv50_reg *a = NULL; + struct nv50_reg *a_tgsi = NULL, *a = NULL; if (!ref) { + /* allocate for TGSI address reg */ for (i = 0; i < NV50_SU_MAX_ADDR; ++i) { if (pc->r_addr[i].index >= 0) continue; @@ -506,6 +521,13 @@ alloc_addr(struct nv50_pc *pc, struct nv50_reg *ref) return NULL; } + /* Allocate and set an address reg so we can access 'ref'. + * + * If and r_addr has index < 0, it is not reserved for TGSI, + * and index will be the negative of the TGSI addr index the + * value in rhw is relative to, or -256 if rhw is an offset + * from 0. If rhw < 0, the reg has not been initialized. + */ for (i = NV50_SU_MAX_ADDR - 1; i >= 0; --i) { if (pc->r_addr[i].index >= 0) /* occupied for TGSI */ continue; @@ -516,17 +538,25 @@ alloc_addr(struct nv50_pc *pc, struct nv50_reg *ref) if (!a && pc->r_addr[i].acc != pc->insn_cur) a = &pc->r_addr[i]; - if (ref->hw - pc->r_addr[i].rhw < 128) { - /* alloc'd & suitable */ + if (ref->hw - pc->r_addr[i].rhw >= 128) + continue; + + if ((ref->acc >= 0 && pc->r_addr[i].index == -256) || + (ref->acc < 0 && -pc->r_addr[i].index == ref->index)) { pc->r_addr[i].acc = pc->insn_cur; return &pc->r_addr[i]; } } assert(a); - emit_set_addr(pc, a, ref->hw * 4); - a->rhw = ref->hw % 128; + if (ref->acc < 0) + a_tgsi = pc->addr[ref->index]; + + emit_add_addr_imm(pc, a, a_tgsi, (ref->hw & ~0x7f) * 4); + + a->rhw = ref->hw & ~0x7f; a->acc = pc->insn_cur; + a->index = a_tgsi ? -ref->index : -256; return a; } @@ -563,23 +593,13 @@ emit_interp(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *iv, emit(pc, e); } -static INLINE void -set_addr(struct nv50_program_exec *e, struct nv50_reg *a) -{ - assert(!(e->inst[0] & 0x0c000000)); - assert(!(e->inst[1] & 0x00000004)); - - e->inst[0] |= (a->hw & 3) << 26; - e->inst[1] |= (a->hw >> 2) << 2; -} - static void set_data(struct nv50_pc *pc, struct nv50_reg *src, unsigned m, unsigned s, struct nv50_program_exec *e) { set_long(pc, e); - e->param.index = src->hw; + e->param.index = src->hw & 127; e->param.shift = s; e->param.mask = m << (s % 32); @@ -1569,7 +1589,8 @@ tgsi_src(struct nv50_pc *pc, int chan, const struct tgsi_full_src_register *src, swz = tgsi_util_get_src_register_swizzle( &src->SrcRegisterInd, 0); ctor_reg(r, P_CONST, - src->SrcRegisterInd.Index * 4 + swz, c); + src->SrcRegisterInd.Index * 4 + swz, + src->SrcRegister.Index * 4 + c); r->acc = -1; break; case TGSI_FILE_IMMEDIATE: @@ -2743,7 +2764,7 @@ ctor_nv50_pc(struct nv50_pc *pc, struct nv50_program *p) return FALSE; } for (i = 0; i < NV50_SU_MAX_ADDR; ++i) - ctor_reg(&pc->r_addr[i], P_ADDR, -1, i + 1); + ctor_reg(&pc->r_addr[i], P_ADDR, -256, i + 1); return TRUE; } -- cgit v1.2.3 From ad67326f12c0d6298cffc0fc4e421ddc02b3cb07 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Fri, 23 Oct 2009 21:38:37 +0200 Subject: nv50: allow all 127 TEMP regs We should really learn to not waste so many though. --- src/gallium/drivers/nv50/nv50_program.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index ff6ff578f4..dd7634c58a 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -31,7 +31,7 @@ #include "nv50_context.h" -#define NV50_SU_MAX_TEMP 64 +#define NV50_SU_MAX_TEMP 127 #define NV50_SU_MAX_ADDR 4 //#define NV50_PROGRAM_DUMP @@ -452,6 +452,8 @@ set_dst(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_program_exec *e) } alloc_reg(pc, dst); + if (dst->hw > 63) + set_long(pc, e); e->inst[0] |= (dst->hw << 2); } @@ -642,6 +644,8 @@ emit_mov(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src) } alloc_reg(pc, src); + if (src->hw > 63) + set_long(pc, e); e->inst[0] |= (src->hw << 9); } @@ -701,6 +705,8 @@ set_src_0_restricted(struct nv50_pc *pc, struct nv50_reg *src, } alloc_reg(pc, src); + if (src->hw > 63) + set_long(pc, e); e->inst[0] |= (src->hw << 9); } @@ -719,6 +725,8 @@ set_src_0(struct nv50_pc *pc, struct nv50_reg *src, struct nv50_program_exec *e) } alloc_reg(pc, src); + if (src->hw > 63) + set_long(pc, e); e->inst[0] |= (src->hw << 9); } @@ -745,6 +753,8 @@ set_src_1(struct nv50_pc *pc, struct nv50_reg *src, struct nv50_program_exec *e) } alloc_reg(pc, src); + if (src->hw > 63) + set_long(pc, e); e->inst[0] |= ((src->hw & 127) << 16); } @@ -813,11 +823,12 @@ emit_add(struct nv50_pc *pc, struct nv50_reg *dst, { struct nv50_program_exec *e = exec(pc); - e->inst[0] |= 0xb0000000; + e->inst[0] = 0xb0000000; + alloc_reg(pc, src1); check_swap_src_0_1(pc, &src0, &src1); - if (!pc->allow32 || src0->neg || src1->neg) { + if (!pc->allow32 || (src0->neg | src1->neg) || src1->hw > 63) { set_long(pc, e); e->inst[1] |= (src0->neg << 26) | (src1->neg << 27); } @@ -873,6 +884,7 @@ static INLINE void emit_sub(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src0, struct nv50_reg *src1) { + assert(src0 != src1); src1->neg ^= 1; emit_add(pc, dst, src0, src1); src1->neg ^= 1; @@ -904,6 +916,7 @@ static INLINE void emit_msb(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src0, struct nv50_reg *src1, struct nv50_reg *src2) { + assert(src2 != src0 && src2 != src1); src2->neg ^= 1; emit_mad(pc, dst, src0, src1, src2); src2->neg ^= 1; -- cgit v1.2.3 From 99e728a13ea8518efc7e27242093b43470f102d6 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Fri, 23 Oct 2009 21:57:42 +0200 Subject: nv50: fix saturation outside of tx_insn case --- src/gallium/drivers/nv50/nv50_program.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index dd7634c58a..3f834b5736 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -1821,7 +1821,7 @@ nv50_program_tx_insn(struct nv50_pc *pc, for (c = 0; c < 4; c++) { if (!(mask & (1 << c)) || dst[c]->type == P_TEMP) continue; - rdst[c] = dst[c]; + /* rdst[c] = dst[c]; */ /* done above */ dst[c] = temp_temp(pc); } } @@ -2150,8 +2150,10 @@ nv50_program_tx_insn(struct nv50_pc *pc, for (c = 0; c < 4; c++) { if (!(mask & (1 << c))) continue; - /* in this case we saturate later */ - if (dst[c]->type == P_TEMP && dst[c]->index < 0) + /* In this case we saturate later, and dst[c] won't + * be another temp_temp (and thus lost), since rdst + * already is TEMP (see above). */ + if (rdst[c]->type == P_TEMP && rdst[c]->index < 0) continue; emit_sat(pc, rdst[c], dst[c]); } -- cgit v1.2.3 From 683722740c85fb6b8c0a930e8a4dce51e1709464 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Fri, 23 Oct 2009 22:00:06 +0200 Subject: nv50: do SIGN_SET as one instruction --- src/gallium/drivers/nv50/nv50_program.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 3f834b5736..9ccc4f5a16 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -986,7 +986,6 @@ emit_precossin(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src) /* 0x80 == src is float */ #define CVT_F32_F32 0xc4 #define CVT_F32_S32 0x44 -#define CVT_F32_U32 0x64 #define CVT_S32_F32 0x8c #define CVT_S32_S32 0x0c #define CVT_NEG 0x20 @@ -1644,11 +1643,7 @@ tgsi_src(struct nv50_pc *pc, int chan, const struct tgsi_full_src_register *src, break; case TGSI_UTIL_SIGN_SET: temp = temp_temp(pc); - emit_abs(pc, temp, r); - if (neg) - temp->neg = 1; - else - emit_neg(pc, temp, temp); + emit_cvt(pc, temp, r, -1, CVTOP_ABS, CVT_F32_F32 | CVT_NEG); r = temp; break; default: -- cgit v1.2.3 From 5e4f5e41a487e9baa8a63842327d83cee659622e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 23 Oct 2009 14:37:14 -0600 Subject: mesa: change s3tc vs. fxt1 priority when choosing compressed formats --- src/mesa/main/texformat.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index c709004784..9d5534e396 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -1590,25 +1590,25 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_COMPRESSED_INTENSITY_ARB: return &_mesa_texformat_intensity; case GL_COMPRESSED_RGB_ARB: -#if FEATURE_texture_fxt1 - if (ctx->Extensions.TDFX_texture_compression_FXT1) - return &_mesa_texformat_rgb_fxt1; -#endif #if FEATURE_texture_s3tc if (ctx->Extensions.EXT_texture_compression_s3tc || ctx->Extensions.S3_s3tc) return &_mesa_texformat_rgb_dxt1; #endif - return &_mesa_texformat_rgb; - case GL_COMPRESSED_RGBA_ARB: #if FEATURE_texture_fxt1 if (ctx->Extensions.TDFX_texture_compression_FXT1) - return &_mesa_texformat_rgba_fxt1; + return &_mesa_texformat_rgb_fxt1; #endif + return &_mesa_texformat_rgb; + case GL_COMPRESSED_RGBA_ARB: #if FEATURE_texture_s3tc if (ctx->Extensions.EXT_texture_compression_s3tc || ctx->Extensions.S3_s3tc) - return &_mesa_texformat_rgba_dxt3; /* Not rgba_dxt1, see spec */ + return &_mesa_texformat_rgba_dxt5; /* Not rgba_dxt1, see spec */ +#endif +#if FEATURE_texture_fxt1 + if (ctx->Extensions.TDFX_texture_compression_FXT1) + return &_mesa_texformat_rgba_fxt1; #endif return &_mesa_texformat_rgba; default: -- cgit v1.2.3 From 9528dc6ed8d09eba0dc3be17dc5e9ef4add8083c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 23 Oct 2009 14:37:41 -0600 Subject: mesa: added _mesa_compressed_format_to_glenum() Maps a compressed MESA_FORMAT_x to correspding GLenum. Needed for querying a texture's actual format when a generic format was originally requested. --- src/mesa/main/texcompress.c | 50 +++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/texcompress.h | 4 ++++ 2 files changed, 54 insertions(+) (limited to 'src') diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index c1b8c7675a..2cda4dd859 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -360,3 +360,53 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img, return addr; } + + +/** + * Given a compressed MESA_FORMAT_x value, return the corresponding + * GLenum for that format. + * This is needed for glGetTexLevelParameter(GL_TEXTURE_INTERNAL_FORMAT) + * which must return the specific texture format used when the user might + * have originally specified a generic compressed format in their + * glTexImage2D() call. + * For non-compressed textures, we always return the user-specified + * internal format unchanged. + */ +GLenum +_mesa_compressed_format_to_glenum(GLcontext *ctx, GLuint mesaFormat) +{ + switch (mesaFormat) { +#if FEATURE_texture_fxt1 + case MESA_FORMAT_RGB_FXT1: + return GL_COMPRESSED_RGB_FXT1_3DFX; + case MESA_FORMAT_RGBA_FXT1: + return GL_COMPRESSED_RGBA_FXT1_3DFX; +#endif +#if FEATURE_texture_s3tc + case MESA_FORMAT_RGB_DXT1: + return GL_COMPRESSED_RGB_S3TC_DXT1_EXT; + case MESA_FORMAT_RGBA_DXT1: + return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; + case MESA_FORMAT_RGBA_DXT3: + return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; + case MESA_FORMAT_RGBA_DXT5: + return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; +#if FEATURE_EXT_texture_sRGB + case MESA_FORMAT_SRGB_DXT1: + return GL_COMPRESSED_SRGB_S3TC_DXT1_EXT; + case MESA_FORMAT_SRGBA_DXT1: + return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT; + case MESA_FORMAT_SRGBA_DXT3: + return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; + case MESA_FORMAT_SRGBA_DXT5: + return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; +#endif +#endif + default: + _mesa_problem(ctx, "Unexpected mesa texture format in" + " _mesa_compressed_format_to_glenum()"); + return 0; + } +} + + diff --git a/src/mesa/main/texcompress.h b/src/mesa/main/texcompress.h index 44f3338222..0f1a38f88e 100644 --- a/src/mesa/main/texcompress.h +++ b/src/mesa/main/texcompress.h @@ -52,6 +52,10 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img, GLsizei width, const GLubyte *image); +extern GLenum +_mesa_compressed_format_to_glenum(GLcontext *ctx, GLuint mesaFormat); + + extern void _mesa_init_texture_s3tc( GLcontext *ctx ); -- cgit v1.2.3 From cd62b4f00a11e9c548bd61652f88ab772d8421b8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 23 Oct 2009 14:40:40 -0600 Subject: mesa: fix GL_TEXTURE_INTERNAL_FORMAT query for compressed formats Need to return the actual compressed format when the user originally requested a generic compressed format. --- src/mesa/main/texparam.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index b2fbe2205b..9d1fdd0566 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -776,7 +776,15 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, *params = img->Depth; break; case GL_TEXTURE_INTERNAL_FORMAT: - *params = img->InternalFormat; + if (img->IsCompressed) { + /* need to return the actual compressed format */ + *params = _mesa_compressed_format_to_glenum(ctx, + img->TexFormat->MesaFormat); + } + else { + /* return the user's requested internal format */ + *params = img->InternalFormat; + } break; case GL_TEXTURE_BORDER: *params = img->Border; -- cgit v1.2.3 From 2d17dbfb5346b6d75e87c839148cbe125bf5cd6d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 9 Jul 2009 09:32:21 -0700 Subject: intel: Keep track of x,y offsets in miptrees and use them for blitting. By just using offsets, we confused the hardware's tiling calculations, resulting in failures in miptree validation and blit clears. Fixes piglit fbo-clearmipmap. Bug #23552. (automatic mipmap generation) --- src/mesa/drivers/dri/i965/brw_tex_layout.c | 7 +- src/mesa/drivers/dri/intel/intel_blit.c | 19 ++-- src/mesa/drivers/dri/intel/intel_fbo.c | 24 ++--- src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 137 +++++++++++-------------- src/mesa/drivers/dri/intel/intel_mipmap_tree.h | 29 ++---- src/mesa/drivers/dri/intel/intel_regions.h | 2 + src/mesa/drivers/dri/intel/intel_tex_copy.c | 17 +-- src/mesa/drivers/dri/intel/intel_tex_image.c | 23 +++-- 8 files changed, 118 insertions(+), 140 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_tex_layout.c b/src/mesa/drivers/dri/i965/brw_tex_layout.c index 5986cbffad..e59e52ed86 100644 --- a/src/mesa/drivers/dri/i965/brw_tex_layout.c +++ b/src/mesa/drivers/dri/i965/brw_tex_layout.c @@ -86,10 +86,10 @@ GLboolean brw_miptree_layout(struct intel_context *intel, mt->pitch = intel_miptree_pitch_align(intel, mt, tiling, mt->pitch); if (mt->compressed) { - qpitch = (y_pitch + ALIGN(minify(y_pitch), align_h) + 11 * align_h) / 4 * mt->pitch * mt->cpp; + qpitch = (y_pitch + ALIGN(minify(y_pitch), align_h) + 11 * align_h) / 4; mt->total_height = (y_pitch + ALIGN(minify(y_pitch), align_h) + 11 * align_h) / 4 * 6; } else { - qpitch = (y_pitch + ALIGN(minify(y_pitch), align_h) + 11 * align_h) * mt->pitch * mt->cpp; + qpitch = (y_pitch + ALIGN(minify(y_pitch), align_h) + 11 * align_h); mt->total_height = (y_pitch + ALIGN(minify(y_pitch), align_h) + 11 * align_h) * 6; } @@ -102,7 +102,8 @@ GLboolean brw_miptree_layout(struct intel_context *intel, height, 1); for (q = 0; q < nr_images; q++) - intel_miptree_set_image_offset_ex(mt, level, q, x, y, q * qpitch); + intel_miptree_set_image_offset(mt, level, q, + x, y + q * qpitch); if (mt->compressed) img_height = MAX2(1, height/4); diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index 0c5be4c798..ec4a5b492a 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -441,6 +441,10 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) intel_region_buffer(intel, irb->region, all ? INTEL_WRITE_FULL : INTEL_WRITE_PART); + int x1 = b.x1 + irb->region->draw_x; + int y1 = b.y1 + irb->region->draw_y; + int x2 = b.x2 + irb->region->draw_x; + int y2 = b.y2 + irb->region->draw_y; GLuint clearVal; GLint pitch, cpp; @@ -449,11 +453,10 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) pitch = irb->region->pitch; cpp = irb->region->cpp; - DBG("%s dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n", + DBG("%s dst:buf(%p)/%d %d,%d sz:%dx%d\n", __FUNCTION__, irb->region->buffer, (pitch * cpp), - irb->region->draw_offset, - b.x1, b.y1, b.x2 - b.x1, b.y2 - b.y1); + x1, y1, x2 - x1, y2 - y1); BR13 = 0xf0 << 16; CMD = XY_COLOR_BLT_CMD; @@ -526,17 +529,17 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) buf, irb->Base.Name); */ - assert(b.x1 < b.x2); - assert(b.y1 < b.y2); + assert(x1 < x2); + assert(y1 < y2); BEGIN_BATCH(6, REFERENCES_CLIPRECTS); OUT_BATCH(CMD); OUT_BATCH(BR13); - OUT_BATCH((b.y1 << 16) | b.x1); - OUT_BATCH((b.y2 << 16) | b.x2); + OUT_BATCH((y1 << 16) | x1); + OUT_BATCH((y2 << 16) | x2); OUT_RELOC(write_buffer, I915_GEM_DOMAIN_RENDER, I915_GEM_DOMAIN_RENDER, - irb->region->draw_offset); + 0); OUT_BATCH(clearVal); ADVANCE_BATCH(); clearMask &= ~bufBit; /* turn off bit, for faster loop exit */ diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 804c034840..cf007d5b62 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -571,7 +571,7 @@ intel_render_texture(GLcontext * ctx, = att->Texture->Image[att->CubeMapFace][att->TextureLevel]; struct intel_renderbuffer *irb = intel_renderbuffer(att->Renderbuffer); struct intel_texture_image *intel_image; - GLuint imageOffset; + GLuint dst_x, dst_y; (void) fb; @@ -618,18 +618,16 @@ intel_render_texture(GLcontext * ctx, } /* compute offset of the particular 2D image within the texture region */ - imageOffset = intel_miptree_image_offset(intel_image->mt, - att->CubeMapFace, - att->TextureLevel); - - if (att->Texture->Target == GL_TEXTURE_3D) { - const GLuint *offsets = intel_miptree_depth_offsets(intel_image->mt, - att->TextureLevel); - imageOffset += offsets[att->Zoffset]; - } - - /* store that offset in the region */ - intel_image->mt->region->draw_offset = imageOffset; + intel_miptree_get_image_offset(intel_image->mt, + att->TextureLevel, + att->CubeMapFace, + att->Zoffset, + &dst_x, &dst_y); + + intel_image->mt->region->draw_offset = (dst_y * intel_image->mt->pitch + + dst_x) * intel_image->mt->cpp; + intel_image->mt->region->draw_x = dst_x; + intel_image->mt->region->draw_y = dst_y; /* update drawing region, etc */ intel_draw_buffer(ctx, fb); diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 4f5101a312..0589d82db2 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -287,9 +287,10 @@ intel_miptree_release(struct intel_context *intel, intel_region_release(&((*mt)->region)); - for (i = 0; i < MAX_TEXTURE_LEVELS; i++) - if ((*mt)->level[i].image_offset) - free((*mt)->level[i].image_offset); + for (i = 0; i < MAX_TEXTURE_LEVELS; i++) { + free((*mt)->level[i].x_offset); + free((*mt)->level[i].y_offset); + } free(*mt); } @@ -350,82 +351,58 @@ intel_miptree_set_level_info(struct intel_mipmap_tree *mt, mt->level[level].height = h; mt->level[level].depth = d; mt->level[level].level_offset = (x + y * mt->pitch) * mt->cpp; + mt->level[level].level_x = x; + mt->level[level].level_y = y; mt->level[level].nr_images = nr_images; DBG("%s level %d size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__, level, w, h, d, x, y, mt->level[level].level_offset); - /* Not sure when this would happen, but anyway: - */ - if (mt->level[level].image_offset) { - free(mt->level[level].image_offset); - mt->level[level].image_offset = NULL; - } - assert(nr_images); + assert(!mt->level[level].x_offset); - mt->level[level].image_offset = malloc(nr_images * sizeof(GLuint)); - mt->level[level].image_offset[0] = 0; + mt->level[level].x_offset = malloc(nr_images * sizeof(GLuint)); + mt->level[level].x_offset[0] = mt->level[level].level_x; + mt->level[level].y_offset = malloc(nr_images * sizeof(GLuint)); + mt->level[level].y_offset[0] = mt->level[level].level_y; } void -intel_miptree_set_image_offset_ex(struct intel_mipmap_tree *mt, - GLuint level, GLuint img, - GLuint x, GLuint y, - GLuint offset) +intel_miptree_set_image_offset(struct intel_mipmap_tree *mt, + GLuint level, GLuint img, + GLuint x, GLuint y) { if (img == 0 && level == 0) assert(x == 0 && y == 0); assert(img < mt->level[level].nr_images); - mt->level[level].image_offset[img] = (x + y * mt->pitch) * mt->cpp + offset; + mt->level[level].x_offset[img] = mt->level[level].level_x + x; + mt->level[level].y_offset[img] = mt->level[level].level_y + y; - DBG("%s level %d img %d pos %d,%d image_offset %x\n", - __FUNCTION__, level, img, x, y, mt->level[level].image_offset[img]); + DBG("%s level %d img %d pos %d,%d\n", + __FUNCTION__, level, img, + mt->level[level].x_offset[img], mt->level[level].y_offset[img]); } void -intel_miptree_set_image_offset(struct intel_mipmap_tree *mt, - GLuint level, GLuint img, - GLuint x, GLuint y) -{ - intel_miptree_set_image_offset_ex(mt, level, img, x, y, 0); -} - - -/* Although we use the image_offset[] array to store relative offsets - * to cube faces, Mesa doesn't know anything about this and expects - * each cube face to be treated as a separate image. - * - * These functions present that view to mesa: - */ -const GLuint * -intel_miptree_depth_offsets(struct intel_mipmap_tree *mt, GLuint level) -{ - static const GLuint zero = 0; - - if (mt->target != GL_TEXTURE_3D || mt->level[level].nr_images == 1) - return &zero; - else - return mt->level[level].image_offset; -} - - -GLuint -intel_miptree_image_offset(struct intel_mipmap_tree *mt, - GLuint face, GLuint level) +intel_miptree_get_image_offset(struct intel_mipmap_tree *mt, + GLuint level, GLuint face, GLuint depth, + GLuint *x, GLuint *y) { - if (mt->target == GL_TEXTURE_CUBE_MAP_ARB) - return (mt->level[level].level_offset + - mt->level[level].image_offset[face]); - else - return mt->level[level].level_offset; + if (mt->target == GL_TEXTURE_CUBE_MAP_ARB) { + *x = mt->level[level].x_offset[face]; + *y = mt->level[level].y_offset[face]; + } else if (mt->target == GL_TEXTURE_3D) { + *x = mt->level[level].x_offset[depth]; + *y = mt->level[level].y_offset[depth]; + } else { + *x = mt->level[level].x_offset[0]; + *y = mt->level[level].y_offset[0]; + } } - - /** * Map a teximage in a mipmap tree. * \param row_stride returns row stride in bytes @@ -441,6 +418,7 @@ intel_miptree_image_map(struct intel_context * intel, GLuint level, GLuint * row_stride, GLuint * image_offsets) { + GLuint x, y; DBG("%s \n", __FUNCTION__); if (row_stride) @@ -449,17 +427,23 @@ intel_miptree_image_map(struct intel_context * intel, if (mt->target == GL_TEXTURE_3D) { int i; - for (i = 0; i < mt->level[level].depth; i++) - image_offsets[i] = mt->level[level].image_offset[i] / mt->cpp; + for (i = 0; i < mt->level[level].depth; i++) { + + intel_miptree_get_image_offset(mt, level, face, i, + &x, &y); + image_offsets[i] = x + y * mt->pitch; + } + + return intel_region_map(intel, mt->region); } else { assert(mt->level[level].depth == 1); - assert(mt->target == GL_TEXTURE_CUBE_MAP || - mt->level[level].image_offset[0] == 0); + intel_miptree_get_image_offset(mt, level, face, 0, + &x, &y); image_offsets[0] = 0; - } - return (intel_region_map(intel, mt->region) + - intel_miptree_image_offset(mt, face, level)); + return intel_region_map(intel, mt->region) + + (x + y * mt->pitch) * mt->cpp; + } } void @@ -484,20 +468,19 @@ intel_miptree_image_data(struct intel_context *intel, GLuint src_image_pitch) { GLuint depth = dst->level[level].depth; - GLuint dst_offset = intel_miptree_image_offset(dst, face, level); - const GLuint *dst_depth_offset = intel_miptree_depth_offsets(dst, level); GLuint i; - GLuint height = 0; DBG("%s: %d/%d\n", __FUNCTION__, face, level); for (i = 0; i < depth; i++) { + GLuint dst_x, dst_y, height; + + intel_miptree_get_image_offset(dst, level, face, i, &dst_x, &dst_y); + height = dst->level[level].height; if(dst->compressed) height = (height + 3) / 4; intel_region_data(intel, - dst->region, - dst_offset + dst_depth_offset[i], /* dst_offset */ - 0, 0, /* dstx, dsty */ + dst->region, 0, dst_x, dst_y, src, src_row_pitch, 0, 0, /* source x, y */ @@ -519,10 +502,7 @@ intel_miptree_image_copy(struct intel_context *intel, GLuint width = src->level[level].width; GLuint height = src->level[level].height; GLuint depth = src->level[level].depth; - GLuint dst_offset = intel_miptree_image_offset(dst, face, level); - GLuint src_offset = intel_miptree_image_offset(src, face, level); - const GLuint *dst_depth_offset = intel_miptree_depth_offsets(dst, level); - const GLuint *src_depth_offset = intel_miptree_depth_offsets(src, level); + GLuint src_x, src_y, dst_x, dst_y; GLuint i; GLboolean success; @@ -535,22 +515,23 @@ intel_miptree_image_copy(struct intel_context *intel, } for (i = 0; i < depth; i++) { + intel_miptree_get_image_offset(src, level, face, i, &src_x, &src_y); + intel_miptree_get_image_offset(dst, level, face, i, &dst_x, &dst_y); success = intel_region_copy(intel, - dst->region, dst_offset + dst_depth_offset[i], - 0, 0, - src->region, src_offset + src_depth_offset[i], - 0, 0, width, height, GL_COPY); + dst->region, 0, dst_x, dst_y, + src->region, 0, src_x, src_y, width, height, + GL_COPY); if (!success) { GLubyte *src_ptr, *dst_ptr; src_ptr = intel_region_map(intel, src->region); dst_ptr = intel_region_map(intel, dst->region); - _mesa_copy_rect(dst_ptr + dst_offset + dst_depth_offset[i], + _mesa_copy_rect(dst_ptr + dst->cpp * (dst_x + dst_y * dst->pitch), dst->cpp, dst->pitch, 0, 0, width, height, - src_ptr + src_offset + src_depth_offset[i], + src_ptr + src->cpp * (src_x + src_y * src->pitch), src->pitch, 0, 0); intel_region_unmap(intel, src->region); diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h index c890b2a0d0..3bce54daa1 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h @@ -70,6 +70,10 @@ struct intel_mipmap_level * always zero in that case. */ GLuint level_offset; + /** Offset to this miptree level, used in computing x_offset. */ + GLuint level_x; + /** Offset to this miptree level, used in computing y_offset. */ + GLuint level_y; GLuint width; GLuint height; /** Depth of the mipmap at this level: 1 for 1D/2D/CUBE, n for 3D. */ @@ -86,7 +90,7 @@ struct intel_mipmap_level * compute the offsets of depth/cube images within a mipmap level, * so have to store them as a lookup table. */ - GLuint *image_offset; + GLuint *x_offset, *y_offset; }; struct intel_mipmap_tree @@ -176,19 +180,10 @@ GLubyte *intel_miptree_image_map(struct intel_context *intel, void intel_miptree_image_unmap(struct intel_context *intel, struct intel_mipmap_tree *mt); - -/* Return the linear offset of an image relative to the start of the - * tree: - */ -GLuint intel_miptree_image_offset(struct intel_mipmap_tree *mt, - GLuint face, GLuint level); - -/* Return pointers to each 2d slice within an image. Indexed by depth - * value. - */ -const GLuint *intel_miptree_depth_offsets(struct intel_mipmap_tree *mt, - GLuint level); - +void +intel_miptree_get_image_offset(struct intel_mipmap_tree *mt, + GLuint level, GLuint face, GLuint depth, + GLuint *x, GLuint *y); void intel_miptree_set_level_info(struct intel_mipmap_tree *mt, GLuint level, @@ -196,16 +191,10 @@ void intel_miptree_set_level_info(struct intel_mipmap_tree *mt, GLuint x, GLuint y, GLuint w, GLuint h, GLuint d); -void intel_miptree_set_image_offset_ex(struct intel_mipmap_tree *mt, - GLuint level, - GLuint img, GLuint x, GLuint y, - GLuint offset); - void intel_miptree_set_image_offset(struct intel_mipmap_tree *mt, GLuint level, GLuint img, GLuint x, GLuint y); - /* Upload an image into a tree */ void intel_miptree_image_data(struct intel_context *intel, diff --git a/src/mesa/drivers/dri/intel/intel_regions.h b/src/mesa/drivers/dri/intel/intel_regions.h index 0d379bdc6e..535fcd7be0 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.h +++ b/src/mesa/drivers/dri/intel/intel_regions.h @@ -62,6 +62,8 @@ struct intel_region GLuint map_refcount; /**< Reference count for mapping */ GLuint draw_offset; /**< Offset of drawing address within the region */ + GLuint draw_x, draw_y; /**< Offset of drawing within the region */ + uint32_t tiling; /**< Which tiling mode the region is in */ uint32_t bit_6_swizzle; /**< GEM flag for address swizzling requirement */ drmAddress classic_map; /**< drmMap of the region when not in GEM mode */ diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index b241c11625..9d58b11b14 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -115,20 +115,22 @@ do_copy_texsubimage(struct intel_context *intel, drm_intel_bo *dst_bo = intel_region_buffer(intel, intelImage->mt->region, INTEL_WRITE_PART); - GLuint image_offset = intel_miptree_image_offset(intelImage->mt, - intelImage->face, - intelImage->level); const GLint orig_x = x; const GLint orig_y = y; + GLuint image_x, image_y; GLshort src_pitch; + intel_miptree_get_image_offset(intelImage->mt, + intelImage->level, + intelImage->face, + 0, + &image_x, &image_y); /* Update dst for clipped src. Need to also clip the source rect. */ dstx += x - orig_x; dsty += y - orig_y; /* Can't blit to tiled buffers with non-tile-aligned offset. */ - if (intelImage->mt->region->tiling != I915_TILING_NONE && - (image_offset & 4095) != 0) { + if (intelImage->mt->region->tiling == I915_TILING_Y) { UNLOCK_HARDWARE(intel); return GL_FALSE; } @@ -160,9 +162,10 @@ do_copy_texsubimage(struct intel_context *intel, src->tiling, intelImage->mt->pitch, dst_bo, - image_offset, + 0, intelImage->mt->region->tiling, - x, y, dstx, dsty, width, height, + x, y, image_x + dstx, image_y + dsty, + width, height, GL_COPY)) { UNLOCK_HARDWARE(intel); return GL_FALSE; diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index c5f5220837..2e0945c365 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -204,7 +204,7 @@ try_pbo_upload(struct intel_context *intel, { struct intel_buffer_object *pbo = intel_buffer_object(unpack->BufferObj); GLuint src_offset, src_stride; - GLuint dst_offset, dst_stride; + GLuint dst_x, dst_y, dst_stride; if (unpack->BufferObj->Name == 0 || intel->ctx._ImageTransferState || @@ -221,9 +221,9 @@ try_pbo_upload(struct intel_context *intel, else src_stride = width; - dst_offset = intel_miptree_image_offset(intelImage->mt, - intelImage->face, - intelImage->level); + intel_miptree_get_image_offset(intelImage->mt, intelImage->level, + intelImage->face, 0, + &dst_x, &dst_y); dst_stride = intelImage->mt->pitch; @@ -239,8 +239,8 @@ try_pbo_upload(struct intel_context *intel, if (!intelEmitCopyBlit(intel, intelImage->mt->cpp, src_stride, src_buffer, src_offset, GL_FALSE, - dst_stride, dst_buffer, dst_offset, GL_FALSE, - 0, 0, 0, 0, width, height, + dst_stride, dst_buffer, 0, GL_FALSE, + 0, 0, dst_x, dst_y, width, height, GL_COPY)) { UNLOCK_HARDWARE(intel); return GL_FALSE; @@ -262,7 +262,7 @@ try_pbo_zcopy(struct intel_context *intel, { struct intel_buffer_object *pbo = intel_buffer_object(unpack->BufferObj); GLuint src_offset, src_stride; - GLuint dst_offset, dst_stride; + GLuint dst_x, dst_y, dst_stride; if (unpack->BufferObj->Name == 0 || intel->ctx._ImageTransferState || @@ -279,13 +279,14 @@ try_pbo_zcopy(struct intel_context *intel, else src_stride = width; - dst_offset = intel_miptree_image_offset(intelImage->mt, - intelImage->face, - intelImage->level); + intel_miptree_get_image_offset(intelImage->mt, intelImage->level, + intelImage->face, 0, + &dst_x, &dst_y); dst_stride = intelImage->mt->pitch; - if (src_stride != dst_stride || dst_offset != 0 || src_offset != 0) { + if (src_stride != dst_stride || dst_x != 0 || dst_y != 0 || + src_offset != 0) { DBG("%s: failure 2\n", __FUNCTION__); return GL_FALSE; } -- cgit v1.2.3 From bfd51dc34d45ba584683c70b1f854a513d9104d3 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 7 Jul 2009 19:33:55 -0700 Subject: i965: Annotate _NEW_COLOR dependency for brw_update_renderbuffer_surface(). --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') 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 f7cc5153a8..1dd8a0728a 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -564,6 +564,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw, key.cpp = 4; key.draw_offset = 0; } + /* _NEW_COLOR */ memcpy(key.color_mask, ctx->Color.ColorMask, sizeof(key.color_mask)); key.color_blend = (!ctx->Color._LogicOpEnabled && @@ -696,7 +697,7 @@ static void prepare_wm_surfaces(struct brw_context *brw ) GLuint i; int old_nr_surfaces; - /* _NEW_BUFFERS */ + /* _NEW_BUFFERS | _NEW_COLOR */ /* Update surfaces for drawing buffers */ if (ctx->DrawBuffer->_NumColorDrawBuffers >= 1) { for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) { -- cgit v1.2.3 From 0acb057ad16264b976b00aa7c6ecf285ca8c19e7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 23 Oct 2009 16:36:15 -0600 Subject: mesa: fix broken _mesa_str_checksum() --- src/mesa/main/imports.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 30fa55997e..91d8d156b8 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -934,9 +934,9 @@ _mesa_str_checksum(const char *str) unsigned int sum, i; const char *c; sum = i = 1; - for (c = str; *c; c++) + for (c = str; *c; c++, i++) sum += *c * (i % 100); - return sum; + return sum + i; } -- cgit v1.2.3 From b17c885a8aa88ef06f384330d59aeb23b73350bb Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Fri, 23 Oct 2009 09:35:36 -0400 Subject: st/xorg: fix text with component alpha rendering --- src/gallium/state_trackers/xorg/xorg_composite.c | 50 +++++++++++++++--------- src/gallium/state_trackers/xorg/xorg_exa_tgsi.c | 11 ++++-- src/gallium/state_trackers/xorg/xorg_exa_tgsi.h | 7 +++- 3 files changed, 45 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 7366fa7b85..1bc3350e8b 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -109,6 +109,7 @@ blend_for_op(struct xorg_composite_blend *blend, blend->rgb_dst = PIPE_BLENDFACTOR_INV_SRC_COLOR; } } + return supported; } @@ -257,8 +258,15 @@ bind_shaders(struct exa_context *exa, int op, if (pMaskPicture) { vs_traits |= VS_MASK; fs_traits |= FS_MASK; - if (pMaskPicture->componentAlpha) - fs_traits |= FS_COMPONENT_ALPHA; + if (pMaskPicture->componentAlpha) { + struct xorg_composite_blend blend; + blend_for_op(&blend, op, + pSrcPicture, pMaskPicture, NULL); + if (blend.alpha_src) { + fs_traits |= FS_CA_SRCALPHA; + } else + fs_traits |= FS_CA_FULL; + } } shader = xorg_shaders_get(exa->renderer->shaders, vs_traits, fs_traits); @@ -289,21 +297,27 @@ bind_samplers(struct exa_context *exa, int op, exa->pipe->flush(exa->pipe, PIPE_FLUSH_RENDER_CACHE, NULL); if (pSrcPicture && pSrc) { - unsigned src_wrap = render_repeat_to_gallium( - pSrcPicture->repeatType); - int filter; - - render_filter_to_gallium(pSrcPicture->filter, &filter); - - src_sampler.wrap_s = src_wrap; - src_sampler.wrap_t = src_wrap; - src_sampler.min_img_filter = filter; - src_sampler.mag_img_filter = filter; - src_sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST; - src_sampler.normalized_coords = 1; - samplers[0] = &src_sampler; - exa->bound_textures[0] = pSrc->tex; - ++exa->num_bound_samplers; + if (exa->has_solid_color) { + debug_assert(!"solid color with textures"); + samplers[0] = NULL; + exa->bound_textures[0] = NULL; + } else { + unsigned src_wrap = render_repeat_to_gallium( + pSrcPicture->repeatType); + int filter; + + render_filter_to_gallium(pSrcPicture->filter, &filter); + + src_sampler.wrap_s = src_wrap; + src_sampler.wrap_t = src_wrap; + src_sampler.min_img_filter = filter; + src_sampler.mag_img_filter = filter; + src_sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST; + src_sampler.normalized_coords = 1; + samplers[0] = &src_sampler; + exa->bound_textures[0] = pSrc->tex; + exa->num_bound_samplers = 1; + } } if (pMaskPicture && pMask) { @@ -321,7 +335,7 @@ bind_samplers(struct exa_context *exa, int op, mask_sampler.normalized_coords = 1; samplers[1] = &mask_sampler; exa->bound_textures[1] = pMask->tex; - ++exa->num_bound_samplers; + exa->num_bound_samplers = 2; } cso_set_samplers(exa->renderer->cso, exa->num_bound_samplers, diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c index abb00824eb..3c90dab3c5 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c @@ -55,10 +55,13 @@ src_in_mask(struct ureg_program *ureg, struct ureg_dst dst, struct ureg_src src, struct ureg_src mask, - boolean component_alpha) + int component_alpha) { - if (component_alpha) { + if (component_alpha == FS_CA_FULL) { ureg_MUL(ureg, dst, src, mask); + } else if (component_alpha == FS_CA_SRCALPHA) { + ureg_MUL(ureg, dst, + ureg_scalar(src, TGSI_SWIZZLE_W), mask); } else { ureg_MUL(ureg, dst, src, @@ -289,7 +292,7 @@ create_fs(struct pipe_context *pipe, boolean is_solid = fs_traits & FS_SOLID_FILL; boolean is_lingrad = fs_traits & FS_LINGRAD_FILL; boolean is_radgrad = fs_traits & FS_RADGRAD_FILL; - boolean is_comp_alpha = fs_traits & FS_COMPONENT_ALPHA; + unsigned comp_alpha = fs_traits & FS_COMPONENT_ALPHA; ureg = ureg_create(TGSI_PROCESSOR_FRAGMENT); if (ureg == NULL) @@ -386,7 +389,7 @@ create_fs(struct pipe_context *pipe, ureg_TEX(ureg, mask, TGSI_TEXTURE_2D, mask_pos, mask_sampler); /* src IN mask */ - src_in_mask(ureg, out, ureg_src(src), ureg_src(mask), is_comp_alpha); + src_in_mask(ureg, out, ureg_src(src), ureg_src(mask), comp_alpha); ureg_release_temporary(ureg, mask); } diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h index c290d44e8f..0ea44fa137 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h @@ -24,7 +24,12 @@ enum xorg_fs_traits { FS_FILL = (FS_SOLID_FILL | FS_LINGRAD_FILL | FS_RADGRAD_FILL), - FS_COMPONENT_ALPHA = 1 << 5 + /* src.rgba * mask.rgba */ + FS_CA_FULL = 1 << 5, + /* src.aaaa * mask.rgba */ + FS_CA_SRCALPHA = 1 << 6, + FS_COMPONENT_ALPHA = (FS_CA_FULL | + FS_CA_SRCALPHA) }; struct xorg_shader { -- cgit v1.2.3 From dc8b139aa23899b00baa919fd7f46c74bf4ef205 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 23 Oct 2009 18:21:59 -0600 Subject: mesa: remove FBO texture depth/stencil test The texture format should not be checked until validation time since the format might be changed by a subsequent glTexImage() call. --- src/mesa/main/fbobject.c | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 825a23090b..ed1db0feca 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1511,18 +1511,6 @@ framebuffer_texture(GLcontext *ctx, const char *caller, GLenum target, return; } - if (texObj && attachment == GL_DEPTH_STENCIL_ATTACHMENT) { - /* the texture format must be depth+stencil */ - const struct gl_texture_image *texImg; - texImg = texObj->Image[0][texObj->BaseLevel]; - if (!texImg || texImg->_BaseFormat != GL_DEPTH_STENCIL) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glFramebufferTexture%sEXT(texture is not" - " DEPTH_STENCIL format)", caller); - return; - } - } - FLUSH_CURRENT(ctx, _NEW_BUFFERS); /* The above doesn't fully flush the drivers in the way that a * glFlush does, but that is required here: -- cgit v1.2.3 From 9b50ceac03975e75940713313363df1bdd5c19dc Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 23 Oct 2009 11:34:14 -0600 Subject: mesa: more detailed error messages in fbo code --- src/mesa/main/fbobject.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 87061aeb0d..18f6cec91e 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -34,6 +34,7 @@ #include "buffers.h" #include "context.h" +#include "enums.h" #include "fbobject.h" #include "framebuffer.h" #include "hash.h" @@ -1665,7 +1666,8 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment, att = _mesa_get_attachment(ctx, fb, attachment); if (att == NULL) { _mesa_error(ctx, GL_INVALID_ENUM, - "glFramebufferRenderbufferEXT(attachment)"); + "glFramebufferRenderbufferEXT(invalid attachment %s)", + _mesa_lookup_enum_by_nr(attachment)); return; } @@ -1673,7 +1675,8 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment, rb = _mesa_lookup_renderbuffer(ctx, renderbuffer); if (!rb) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glFramebufferRenderbufferEXT(renderbuffer)"); + "glFramebufferRenderbufferEXT(non-existant" + " renderbuffer %u)", renderbuffer); return; } } -- cgit v1.2.3 From d66965c9a1e932444c2538b4221df07fea4c557f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 23 Oct 2009 13:06:13 -0600 Subject: mesa: remove misplaced VERBOSE_TEXTURE tests --- src/mesa/main/blend.c | 6 +++--- src/mesa/main/depth.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c index 39cf6153e2..830e3b2e51 100644 --- a/src/mesa/main/blend.c +++ b/src/mesa/main/blend.c @@ -72,7 +72,7 @@ _mesa_BlendFuncSeparateEXT( GLenum sfactorRGB, GLenum dfactorRGB, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glBlendFuncSeparate %s %s %s %s\n", _mesa_lookup_enum_by_nr(sfactorRGB), _mesa_lookup_enum_by_nr(dfactorRGB), @@ -250,7 +250,7 @@ _mesa_BlendEquation( GLenum mode ) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glBlendEquation %s\n", _mesa_lookup_enum_by_nr(mode)); @@ -278,7 +278,7 @@ _mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA ) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glBlendEquationSeparateEXT %s %s\n", _mesa_lookup_enum_by_nr(modeRGB), _mesa_lookup_enum_by_nr(modeA)); diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c index 91c036ef96..f187205b97 100644 --- a/src/mesa/main/depth.c +++ b/src/mesa/main/depth.c @@ -63,7 +63,7 @@ _mesa_DepthFunc( GLenum func ) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glDepthFunc %s\n", _mesa_lookup_enum_by_nr(func)); switch (func) { @@ -99,7 +99,7 @@ _mesa_DepthMask( GLboolean flag ) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - if (MESA_VERBOSE & (VERBOSE_API|VERBOSE_TEXTURE)) + if (MESA_VERBOSE & VERBOSE_API) _mesa_debug(ctx, "glDepthMask %d\n", flag); /* -- cgit v1.2.3 From 81a4d34f07d95e6a4bf6ab105efbee4fed116e55 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 23 Oct 2009 13:20:03 -0600 Subject: mesa: rework error checking code for glGetCompressedTexImage() Do all error checking in new getcompressedteximage_error_check() func. Move some additional PBO checks out of the driver fallbacks into the error checking functions. --- src/mesa/main/texgetimage.c | 170 +++++++++++++++++++++++++++++++------------- 1 file changed, 122 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 14d6fc7659..2520019923 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.5 + * Version: 7.7 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * Copyright (c) 2009 VMware, Inc. @@ -31,6 +31,7 @@ #include "glheader.h" #include "bufferobj.h" +#include "enums.h" #include "context.h" #include "image.h" #include "texcompress.h" @@ -130,9 +131,10 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, 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)"); + /* out of memory or other unexpected error */ + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage(map PBO failed)"); return; + } /* was an offset into the PBO. * Now make it a real, client-side pointer inside the mapped region. @@ -321,20 +323,13 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { /* 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); + 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, - "glGetCompressedTexImage(PBO is mapped)"); + /* out of memory or other unexpected error */ + _mesa_error(ctx, GL_OUT_OF_MEMORY, + "glGetCompresssedTexImage(map PBO failed)"); return; } img = ADD_POINTERS(buf, img); @@ -479,7 +474,14 @@ getteximage_error_check(GLcontext *ctx, GLenum target, GLint level, texImage->Height, texImage->Depth, format, type, pixels)) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetTexImage(invalid PBO access)"); + "glGetTexImage(out of bounds PBO write)"); + return GL_TRUE; + } + + /* PBO should not be mapped */ + if (_mesa_bufferobj_mapped(ctx->Pack.BufferObj)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetTexImage(PBO is mapped)"); return GL_TRUE; } } @@ -514,6 +516,17 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, texUnit = _mesa_get_current_tex_unit(ctx); texObj = _mesa_select_tex_object(ctx, texUnit, target); + if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) { + struct gl_texture_image *texImage = + _mesa_select_tex_image(ctx, texObj, target, level); + _mesa_debug(ctx, "glGetTexImage(tex %u) format = %d, w=%d, h=%d," + " dstFmt=0x%x, dstType=0x%x\n", + texObj->Name, + texImage->TexFormat->MesaFormat, + texImage->Width, texImage->Height, + format, type); + } + _mesa_lock_texture(ctx, texObj); { struct gl_texture_image *texImage = @@ -527,55 +540,116 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, } -void GLAPIENTRY -_mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) + +/** + * Do error checking for a glGetCompressedTexImage() call. + * \return GL_TRUE if any error, GL_FALSE if no errors. + */ +static GLboolean +getcompressedteximage_error_check(GLcontext *ctx, GLenum target, GLint level, + GLvoid *img) { const struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; - GLint maxLevels; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + const GLuint maxLevels = _mesa_max_texture_levels(ctx, target); + + if (maxLevels == 0) { + _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImage(target=0x%x)", + target); + return GL_TRUE; + } + + if (level < 0 || level >= maxLevels) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glGetCompressedTexImageARB(bad level = %d)", level); + return GL_TRUE; + } + + if (_mesa_is_proxy_texture(target)) { + _mesa_error(ctx, GL_INVALID_ENUM, + "glGetCompressedTexImageARB(bad target = %s)", + _mesa_lookup_enum_by_nr(target)); + return GL_TRUE; + } texUnit = _mesa_get_current_tex_unit(ctx); texObj = _mesa_select_tex_object(ctx, texUnit, target); + if (!texObj) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB"); - return; + _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB(target)"); + return GL_TRUE; + } + + texImage = _mesa_select_tex_image(ctx, texObj, target, level); + + if (!texImage) { + /* probably invalid mipmap level */ + _mesa_error(ctx, GL_INVALID_VALUE, + "glGetCompressedTexImageARB(level)"); + return GL_TRUE; } - maxLevels = _mesa_max_texture_levels(ctx, target); - ASSERT(maxLevels > 0); /* 0 indicates bad target, caught above */ + if (!texImage->IsCompressed) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetCompressedTexImageARB(texture is not compressed)"); + return GL_TRUE; + } - if (level < 0 || level >= maxLevels) { - _mesa_error(ctx, GL_INVALID_VALUE, "glGetCompressedTexImageARB(level)"); - return; + if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { + /* make sure PBO is not mapped */ + if (_mesa_bufferobj_mapped(ctx->Pack.BufferObj)) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetCompressedTexImage(PBO is mapped)"); + return GL_TRUE; + } + + /* do bounds checking on PBO write */ + if ((const GLubyte *) img + texImage->CompressedSize > + (const GLubyte *) ctx->Pack.BufferObj->Size) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glGetCompressedTexImage(out of bounds PBO write)"); + return GL_TRUE; + } } - if (_mesa_is_proxy_texture(target)) { - _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB(target)"); + return GL_FALSE; +} + + +void GLAPIENTRY +_mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) +{ + const struct gl_texture_unit *texUnit; + struct gl_texture_object *texObj; + GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); + + if (getcompressedteximage_error_check(ctx, target, level, img)) { return; } + texUnit = _mesa_get_current_tex_unit(ctx); + texObj = _mesa_select_tex_object(ctx, texUnit, target); + + if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) { + struct gl_texture_image *texImage = + _mesa_select_tex_image(ctx, texObj, target, level); + _mesa_debug(ctx, + "glGetCompressedTexImage(tex %u) format = %d, w=%d, h=%d\n", + texObj->Name, + texImage->TexFormat->MesaFormat, + texImage->Width, texImage->Height); + } + _mesa_lock_texture(ctx, texObj); { - texImage = _mesa_select_tex_image(ctx, texObj, target, level); - if (texImage) { - if (texImage->IsCompressed) { - /* this typically calls _mesa_get_compressed_teximage() */ - ctx->Driver.GetCompressedTexImage(ctx, target, level, img, - texObj, texImage); - } - else { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glGetCompressedTexImageARB"); - } - } - else { - /* probably invalid mipmap level */ - _mesa_error(ctx, GL_INVALID_VALUE, - "glGetCompressedTexImageARB(level)"); - } + struct gl_texture_image *texImage = + _mesa_select_tex_image(ctx, texObj, target, level); + + /* this typically calls _mesa_get_compressed_teximage() */ + ctx->Driver.GetCompressedTexImage(ctx, target, level, img, + texObj, texImage); } _mesa_unlock_texture(ctx, texObj); } -- cgit v1.2.3 From 346250b190b023b6fbd2bde5ce3ad94a8d544e20 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 23 Oct 2009 16:31:48 -0600 Subject: mesa: refactor, new print_shader_info() --- src/mesa/shader/shader_api.c | 61 ++++++++++++++++++++++++++------------------ 1 file changed, 36 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index f473bd1173..30fa58ea52 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -1498,6 +1498,41 @@ _mesa_link_program(GLcontext *ctx, GLuint program) } +/** + * Print basic shader info (for debug). + */ +static void +print_shader_info(const struct gl_shader_program *shProg) +{ + GLuint i; + + _mesa_printf("Mesa: glUseProgram(%u)\n", shProg->Name); + for (i = 0; i < shProg->NumShaders; i++) { + const char *s; + switch (shProg->Shaders[i]->Type) { + case GL_VERTEX_SHADER: + s = "vertex"; + break; + case GL_FRAGMENT_SHADER: + s = "fragment"; + break; + case GL_GEOMETRY_SHADER: + s = "geometry"; + break; + default: + s = ""; + } + _mesa_printf(" %s shader %u, checksum %u\n", s, + shProg->Shaders[i]->Name, + shProg->Shaders[i]->SourceChecksum); + } + if (shProg->VertexProgram) + _mesa_printf(" vert prog %u\n", shProg->VertexProgram->Base.Id); + if (shProg->FragmentProgram) + _mesa_printf(" frag prog %u\n", shProg->FragmentProgram->Base.Id); +} + + /** * Called via ctx->Driver.UseProgram() */ @@ -1527,31 +1562,7 @@ _mesa_use_program(GLcontext *ctx, GLuint program) /* debug code */ if (ctx->Shader.Flags & GLSL_USE_PROG) { - GLuint i; - _mesa_printf("Mesa: glUseProgram(%u)\n", shProg->Name); - for (i = 0; i < shProg->NumShaders; i++) { - const char *s; - switch (shProg->Shaders[i]->Type) { - case GL_VERTEX_SHADER: - s = "vertex"; - break; - case GL_FRAGMENT_SHADER: - s = "fragment"; - break; - case GL_GEOMETRY_SHADER: - s = "geometry"; - break; - default: - s = ""; - } - _mesa_printf(" %s shader %u, checksum %u\n", s, - shProg->Shaders[i]->Name, - shProg->Shaders[i]->SourceChecksum); - } - if (shProg->VertexProgram) - _mesa_printf(" vert prog %u\n", shProg->VertexProgram->Base.Id); - if (shProg->FragmentProgram) - _mesa_printf(" frag prog %u\n", shProg->FragmentProgram->Base.Id); + print_shader_info(shProg); } } else { -- cgit v1.2.3 From 26f1ad65b988fe55ae12a99994e4c63aaab899a0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 23 Oct 2009 18:15:55 -0600 Subject: mesa: simplify att->CubeMapFace assignment --- src/mesa/main/fbobject.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 18f6cec91e..85d3d3db99 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -240,12 +240,7 @@ _mesa_set_texture_attachment(GLcontext *ctx, /* always update these fields */ att->TextureLevel = level; - if (IS_CUBE_FACE(texTarget)) { - att->CubeMapFace = texTarget - GL_TEXTURE_CUBE_MAP_POSITIVE_X; - } - else { - att->CubeMapFace = 0; - } + att->CubeMapFace = _mesa_tex_target_to_face(texTarget); att->Zoffset = zoffset; att->Complete = GL_FALSE; -- cgit v1.2.3 From 94a63dccdd79268cf37587c93e3dec0d02dad457 Mon Sep 17 00:00:00 2001 From: Joakim Sindholt Date: Sat, 24 Oct 2009 02:38:28 +0200 Subject: r300g: fix scons build yet again --- src/gallium/drivers/r300/SConscript | 3 --- src/gallium/drivers/r300/r300_render.c | 3 ++- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/SConscript b/src/gallium/drivers/r300/SConscript index b4c8ba2015..97989040d2 100644 --- a/src/gallium/drivers/r300/SConscript +++ b/src/gallium/drivers/r300/SConscript @@ -9,8 +9,6 @@ env.Append(CPPPATH = ['#/src/mesa/drivers/dri/r300/compiler', '#/include', '#/sr r300 = env.ConvenienceLibrary( target = 'r300', source = [ - 'r3xx_fs.c', - 'r5xx_fs.c', 'r300_chipset.c', 'r300_clear.c', 'r300_context.c', @@ -25,7 +23,6 @@ r300 = env.ConvenienceLibrary( 'r300_state_derived.c', 'r300_state_invariant.c', 'r300_vs.c', - 'r300_surface.c', 'r300_texture.c', 'r300_tgsi_to_rc.c', ] + r300compiler) + r300compiler diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 6e2bcc62da..6f392402bd 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -76,7 +76,6 @@ boolean r300_draw_range_elements(struct pipe_context* pipe, unsigned count) { struct r300_context* r300 = r300_context(pipe); - CS_LOCALS(r300); uint32_t prim = r300_translate_primitive(mode); struct pipe_vertex_buffer* aos = r300->vertex_buffers; unsigned aos_count = r300->vertex_buffer_count; @@ -84,6 +83,8 @@ boolean r300_draw_range_elements(struct pipe_context* pipe, unsigned packet_size; unsigned i; bool invalid = FALSE; + + CS_LOCALS(r300); validate: for (i = 0; i < aos_count; i++) { -- cgit v1.2.3 From eb732b1bbb4e4bdd018ee9a1653a62fd8dce2d55 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 24 Oct 2009 08:41:08 -0600 Subject: mesa: additional comments in format code --- src/mesa/main/formats.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 45ac39a818..d6a1ec81b6 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -39,7 +39,8 @@ struct gl_format_info /** * Base format is one of GL_RGB, GL_RGBA, GL_ALPHA, GL_LUMINANCE, - * GL_LUMINANCE_ALPHA, GL_INTENSITY, GL_COLOR_INDEX, GL_DEPTH_COMPONENT. + * GL_LUMINANCE_ALPHA, GL_INTENSITY, GL_YCBCR_MESA, GL_COLOR_INDEX, + * GL_DEPTH_COMPONENT, GL_STENCIL_INDEX, GL_DEPTH_STENCIL. */ GLenum BaseFormat; @@ -577,6 +578,11 @@ _mesa_get_format_info(gl_format format) } +/** + * Return bytes needed to store a block of pixels in the given format. + * Normally, a block is 1x1 (a single pixel). But for compressed formats + * a block may be 4x4 or 8x4, etc. + */ GLuint _mesa_get_format_bytes(gl_format format) { @@ -586,6 +592,11 @@ _mesa_get_format_bytes(gl_format format) } +/** + * Return bits per component for the given format. + * \param format one of MESA_FORMAT_x + * \param pname the component, such as GL_RED_BITS, GL_TEXTURE_BLUE_BITS, etc. + */ GLint _mesa_get_format_bits(gl_format format, GLenum pname) { @@ -636,6 +647,15 @@ _mesa_get_format_bits(gl_format format, GLenum pname) } +/** + * Return the data type (or more specifically, the data representation) + * for the given format. + * The return value will be one of: + * GL_UNSIGNED_NORMALIZED = unsigned int representing [0,1] + * GL_SIGNED_NORMALIZED = signed int representing [-1, 1] + * GL_UNSIGNED_INT = an ordinary unsigned integer + * GL_FLOAT = an ordinary float + */ GLenum _mesa_get_format_datatype(gl_format format) { @@ -644,6 +664,12 @@ _mesa_get_format_datatype(gl_format format) } +/** + * Return the basic format for the given type. The result will be + * one of GL_RGB, GL_RGBA, GL_ALPHA, GL_LUMINANCE, GL_LUMINANCE_ALPHA, + * GL_INTENSITY, GL_YCBCR_MESA, GL_COLOR_INDEX, GL_DEPTH_COMPONENT, + * GL_STENCIL_INDEX, GL_DEPTH_STENCIL. + */ GLenum _mesa_get_format_base_format(gl_format format) { @@ -652,6 +678,7 @@ _mesa_get_format_base_format(gl_format format) } +/** Is the given format a compressed format? */ GLboolean _mesa_is_format_compressed(gl_format format) { -- cgit v1.2.3 From bee6794eb126bc8af87726a2456d0ebc36eb721d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 24 Oct 2009 08:43:16 -0600 Subject: mesa: added _mesa_get_format_name() --- src/mesa/main/formats.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/formats.h | 3 ++ 2 files changed, 78 insertions(+) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index d6a1ec81b6..773a8f70b3 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -37,6 +37,9 @@ struct gl_format_info { gl_format Name; + /** text name for debugging */ + const char *StrName; + /** * Base format is one of GL_RGB, GL_RGBA, GL_ALPHA, GL_LUMINANCE, * GL_LUMINANCE_ALPHA, GL_INTENSITY, GL_YCBCR_MESA, GL_COLOR_INDEX, @@ -77,6 +80,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = { { MESA_FORMAT_NONE, /* Name */ + "MESA_FORMAT_NONE", /* StrName */ GL_NONE, /* BaseFormat */ GL_NONE, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -85,6 +89,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_RGBA8888, /* Name */ + "MESA_FORMAT_RGBA8888", /* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ @@ -93,6 +98,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_RGBA8888_REV, /* Name */ + "MESA_FORMAT_RGBA8888_REV", /* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ @@ -101,6 +107,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_ARGB8888, /* Name */ + "MESA_FORMAT_ARGB8888", /* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ @@ -109,6 +116,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_ARGB8888_REV, /* Name */ + "MESA_FORMAT_ARGB8888_REV", /* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 8, /* Red/Green/Blue/AlphaBits */ @@ -117,6 +125,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_XRGB8888, /* Name */ + "MESA_FORMAT_XRGB8888", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ @@ -125,6 +134,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_RGB888, /* Name */ + "MESA_FORMAT_RGB888", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ @@ -133,6 +143,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_BGR888, /* Name */ + "MESA_FORMAT_BGR888", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ @@ -141,6 +152,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_RGB565, /* Name */ + "MESA_FORMAT_RGB565", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 5, 6, 5, 0, /* Red/Green/Blue/AlphaBits */ @@ -149,6 +161,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_RGB565_REV, /* Name */ + "MESA_FORMAT_RGB565_REV", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 5, 6, 5, 0, /* Red/Green/Blue/AlphaBits */ @@ -157,6 +170,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_ARGB4444, /* Name */ + "MESA_FORMAT_ARGB4444", /* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 4, 4, 4, 4, /* Red/Green/Blue/AlphaBits */ @@ -165,6 +179,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_ARGB4444_REV, /* Name */ + "MESA_FORMAT_ARGB4444_REV", /* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 4, 4, 4, 4, /* Red/Green/Blue/AlphaBits */ @@ -173,6 +188,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_RGBA5551, /* Name */ + "MESA_FORMAT_RGBA5551", /* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */ @@ -181,6 +197,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_ARGB1555, /* Name */ + "MESA_FORMAT_ARGB1555", /* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */ @@ -189,6 +206,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_ARGB1555_REV, /* Name */ + "MESA_FORMAT_ARGB1555_REV", /* StrName */ GL_RGBA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 5, 5, 5, 1, /* Red/Green/Blue/AlphaBits */ @@ -197,6 +215,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_AL88, /* Name */ + "MESA_FORMAT_AL88", /* StrName */ GL_LUMINANCE_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */ @@ -205,6 +224,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_AL88_REV, /* Name */ + "MESA_FORMAT_AL88_REV", /* StrName */ GL_LUMINANCE_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */ @@ -213,6 +233,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_RGB332, /* Name */ + "MESA_FORMAT_RGB332", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 3, 3, 2, 0, /* Red/Green/Blue/AlphaBits */ @@ -221,6 +242,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_A8, /* Name */ + "MESA_FORMAT_A8", /* StrName */ GL_ALPHA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 8, /* Red/Green/Blue/AlphaBits */ @@ -229,6 +251,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_L8, /* Name */ + "MESA_FORMAT_L8", /* StrName */ GL_LUMINANCE, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -237,6 +260,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_I8, /* Name */ + "MESA_FORMAT_I8", /* StrName */ GL_INTENSITY, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -245,6 +269,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_CI8, /* Name */ + "MESA_FORMAT_CI8", /* StrName */ GL_COLOR_INDEX, /* BaseFormat */ GL_UNSIGNED_INT, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -253,6 +278,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_YCBCR, /* Name */ + "MESA_FORMAT_YCBCR", /* StrName */ GL_YCBCR_MESA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -261,6 +287,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_YCBCR_REV, /* Name */ + "MESA_FORMAT_YCBCR_REV", /* StrName */ GL_YCBCR_MESA, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -269,6 +296,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_Z24_S8, /* Name */ + "MESA_FORMAT_Z24_S8", /* StrName */ GL_DEPTH_STENCIL, /* BaseFormat */ GL_UNSIGNED_INT, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -277,6 +305,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_S8_Z24, /* Name */ + "MESA_FORMAT_S8_Z24", /* StrName */ GL_DEPTH_STENCIL, /* BaseFormat */ GL_UNSIGNED_INT, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -285,6 +314,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_Z16, /* Name */ + "MESA_FORMAT_Z16", /* StrName */ GL_DEPTH_COMPONENT, /* BaseFormat */ GL_UNSIGNED_INT, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -293,6 +323,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_X8_Z24, /* Name */ + "MESA_FORMAT_X8_Z24", /* StrName */ GL_DEPTH_COMPONENT, /* BaseFormat */ GL_UNSIGNED_INT, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -301,6 +332,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_Z32, /* Name */ + "MESA_FORMAT_Z32", /* StrName */ GL_DEPTH_COMPONENT, /* BaseFormat */ GL_UNSIGNED_INT, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -309,6 +341,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_S8, /* Name */ + "MESA_FORMAT_S8", /* StrName */ GL_STENCIL_INDEX, /* BaseFormat */ GL_UNSIGNED_INT, /* DataType */ 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ @@ -317,6 +350,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_SRGB8, + "MESA_FORMAT_SRGB8", GL_RGB, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, @@ -325,6 +359,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_SRGBA8, + "MESA_FORMAT_SRGBA8", GL_RGBA, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, @@ -333,6 +368,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_SARGB8, + "MESA_FORMAT_SARGB8", GL_RGBA, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, @@ -341,6 +377,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_SL8, + "MESA_FORMAT_SL8", GL_LUMINANCE_ALPHA, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 8, @@ -349,6 +386,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_SLA8, + "MESA_FORMAT_SLA8", GL_LUMINANCE_ALPHA, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 8, @@ -357,6 +395,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_SRGB_DXT1, /* Name */ + "MESA_FORMAT_SRGB_DXT1", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 4, 4, 4, 0, /* approx Red/Green/Blue/AlphaBits */ @@ -365,6 +404,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_SRGBA_DXT1, + "MESA_FORMAT_SRGBA_DXT1", GL_RGBA, GL_UNSIGNED_NORMALIZED, 4, 4, 4, 4, @@ -373,6 +413,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_SRGBA_DXT3, + "MESA_FORMAT_SRGBA_DXT3", GL_RGBA, GL_UNSIGNED_NORMALIZED, 4, 4, 4, 4, @@ -381,6 +422,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_SRGBA_DXT5, + "MESA_FORMAT_SRGBA_DXT5", GL_RGBA, GL_UNSIGNED_NORMALIZED, 4, 4, 4, 4, @@ -390,6 +432,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = { MESA_FORMAT_RGB_FXT1, + "MESA_FORMAT_RGB_FXT1", GL_RGB, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, @@ -398,6 +441,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_RGBA_FXT1, + "MESA_FORMAT_RGBA_FXT1", GL_RGBA, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, @@ -407,6 +451,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = { MESA_FORMAT_RGB_DXT1, /* Name */ + "MESA_FORMAT_RGB_DXT1", /* StrName */ GL_RGB, /* BaseFormat */ GL_UNSIGNED_NORMALIZED, /* DataType */ 4, 4, 4, 0, /* approx Red/Green/Blue/AlphaBits */ @@ -415,6 +460,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_RGBA_DXT1, + "MESA_FORMAT_RGBA_DXT1", GL_RGBA, GL_UNSIGNED_NORMALIZED, 4, 4, 4, 4, @@ -423,6 +469,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_RGBA_DXT3, + "MESA_FORMAT_RGBA_DXT3", GL_RGBA, GL_UNSIGNED_NORMALIZED, 4, 4, 4, 4, @@ -431,6 +478,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_RGBA_DXT5, + "MESA_FORMAT_RGBA_DXT5", GL_RGBA, GL_UNSIGNED_NORMALIZED, 4, 4, 4, 4, @@ -439,6 +487,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_RGBA_FLOAT32, + "MESA_FORMAT_RGBA_FLOAT32", GL_RGBA, GL_FLOAT, 32, 32, 32, 32, @@ -447,6 +496,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_RGBA_FLOAT16, + "MESA_FORMAT_RGBA_FLOAT16", GL_RGBA, GL_FLOAT, 16, 16, 16, 16, @@ -455,6 +505,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_RGB_FLOAT32, + "MESA_FORMAT_RGB_FLOAT32", GL_RGB, GL_FLOAT, 32, 32, 32, 0, @@ -463,6 +514,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_RGB_FLOAT16, + "MESA_FORMAT_RGB_FLOAT16", GL_RGB, GL_FLOAT, 16, 16, 16, 0, @@ -471,6 +523,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_ALPHA_FLOAT32, + "MESA_FORMAT_ALPHA_FLOAT32", GL_ALPHA, GL_FLOAT, 0, 0, 0, 32, @@ -479,6 +532,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_ALPHA_FLOAT16, + "MESA_FORMAT_ALPHA_FLOAT16", GL_ALPHA, GL_FLOAT, 0, 0, 0, 16, @@ -487,6 +541,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_LUMINANCE_FLOAT32, + "MESA_FORMAT_LUMINANCE_FLOAT32", GL_ALPHA, GL_FLOAT, 0, 0, 0, 0, @@ -495,6 +550,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_LUMINANCE_FLOAT16, + "MESA_FORMAT_LUMINANCE_FLOAT16", GL_ALPHA, GL_FLOAT, 0, 0, 0, 0, @@ -503,6 +559,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32, + "MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32", GL_LUMINANCE_ALPHA, GL_FLOAT, 0, 0, 0, 32, @@ -511,6 +568,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16, + "MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16", GL_LUMINANCE_ALPHA, GL_FLOAT, 0, 0, 0, 16, @@ -519,6 +577,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_INTENSITY_FLOAT32, + "MESA_FORMAT_INTENSITY_FLOAT32", GL_INTENSITY, GL_FLOAT, 0, 0, 0, 0, @@ -527,6 +586,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_INTENSITY_FLOAT16, + "MESA_FORMAT_INTENSITY_FLOAT16", GL_INTENSITY, GL_FLOAT, 0, 0, 0, 0, @@ -535,6 +595,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_DUDV8, + "MESA_FORMAT_DUDV8", GL_DUDV_ATI, GL_SIGNED_NORMALIZED, 0, 0, 0, 0, @@ -543,6 +604,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_SIGNED_RGBA8888, + "MESA_FORMAT_SIGNED_RGBA8888", GL_RGBA, GL_SIGNED_NORMALIZED, 8, 8, 8, 8, @@ -551,6 +613,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_SIGNED_RGBA8888_REV, + "MESA_FORMAT_SIGNED_RGBA8888_REV", GL_RGBA, GL_SIGNED_NORMALIZED, 8, 8, 8, 8, @@ -559,6 +622,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = }, { MESA_FORMAT_SIGNED_RGBA_16, + "MESA_FORMAT_SIGNED_RGBA_16", GL_RGBA, GL_SIGNED_NORMALIZED, 16, 16, 16, 16, @@ -578,6 +642,17 @@ _mesa_get_format_info(gl_format format) } +/** Return string name of format (for debugging) */ +const char * +_mesa_get_format_name(gl_format format) +{ + const struct gl_format_info *info = _mesa_get_format_info(format); + ASSERT(info->BytesPerBlock); + return info->StrName; +} + + + /** * Return bytes needed to store a block of pixels in the given format. * Normally, a block is 1x1 (a single pixel). But for compressed formats diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index f8b4a6cdf4..72f1b1e287 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -140,6 +140,9 @@ typedef enum } gl_format; +extern const char * +_mesa_get_format_name(gl_format format); + extern GLuint _mesa_get_format_bytes(gl_format format); -- cgit v1.2.3 From 7b16c43e436715bef9118fdb28ca8a9ad91b1e66 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 24 Oct 2009 11:33:10 -0600 Subject: mesa: added _mesa_get_format_block_size() --- src/mesa/main/formats.c | 16 ++++++++++++++++ src/mesa/main/formats.h | 3 +++ 2 files changed, 19 insertions(+) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 773a8f70b3..72d043c4c3 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -753,6 +753,22 @@ _mesa_get_format_base_format(gl_format format) } +/** + * Return the block size (in pixels) for the given format. Normally + * the block size is 1x1. But compressed formats will have block sizes + * of 4x4 or 8x4 pixels, etc. + * \param bw returns block width in pixels + * \param bh returns block height in pixels + */ +void +_mesa_get_format_block_size(gl_format format, GLuint *bw, GLuint *bh) +{ + const struct gl_format_info *info = _mesa_get_format_info(format); + *bw = info->BlockWidth; + *bh = info->BlockHeight; +} + + /** Is the given format a compressed format? */ GLboolean _mesa_is_format_compressed(gl_format format) diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 72f1b1e287..91ea023077 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -155,6 +155,9 @@ _mesa_get_format_datatype(gl_format format); extern GLenum _mesa_get_format_base_format(gl_format format); +extern void +_mesa_get_format_block_size(gl_format format, GLuint *bw, GLuint *bh); + extern GLboolean _mesa_is_format_compressed(gl_format format); -- cgit v1.2.3 From d255aaf54f9a4398247698408bd45698b1cefe58 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 24 Oct 2009 11:33:58 -0600 Subject: mesa: remove hard-coded block sizes --- src/mesa/main/texstore.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index d0d4250352..ff6931156e 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3670,14 +3670,18 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, GLubyte *dest; const GLubyte *src; const gl_format texFormat = texImage->TexFormat; + GLuint bw, bh; + _mesa_get_format_block_size(texFormat, &bw, &bh); + + (void) level; (void) format; /* these should have been caught sooner */ - ASSERT((width & 3) == 0 || width == 2 || width == 1); - ASSERT((height & 3) == 0 || height == 2 || height == 1); - ASSERT((xoffset & 3) == 0); - ASSERT((yoffset & 3) == 0); + ASSERT((width % bw) == 0 || width == 2 || width == 1); + ASSERT((height % bh) == 0 || height == 2 || height == 1); + ASSERT((xoffset % bw) == 0); + ASSERT((yoffset % bh) == 0); /* get pointer to src pixels (may be in a pbo which we'll map here) */ data = _mesa_validate_pbo_compressed_teximage(ctx, imageSize, data, @@ -3696,7 +3700,7 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, (GLubyte *) texImage->Data); bytesPerRow = srcRowStride; - rows = height / 4; + rows = height / bh; /* rows in blocks */ for (i = 0; i < rows; i++) { MEMCPY(dest, src, bytesPerRow); -- cgit v1.2.3 From 2c3787f5130f79c3adbb9e8e1ace8935c919876f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 24 Oct 2009 11:34:27 -0600 Subject: mesa: move assertion after declaration --- src/mesa/main/depthstencil.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/depthstencil.c b/src/mesa/main/depthstencil.c index 6fefdac1e3..193c7f8255 100644 --- a/src/mesa/main/depthstencil.c +++ b/src/mesa/main/depthstencil.c @@ -329,8 +329,8 @@ put_mono_values_z24(GLcontext *ctx, struct gl_renderbuffer *z24rb, } } else { - assert(dsrb->Format == MESA_FORMAT_S8_Z24); const GLuint shiftedVal = *((GLuint *) value); + assert(dsrb->Format == MESA_FORMAT_S8_Z24); for (i = 0; i < count; i++) { if (!mask || mask[i]) { temp[i] = shiftedVal | (temp[i] & 0xff000000); -- cgit v1.2.3 From 1ad9671db7bd60fa84266f30f46555b4e45bcb08 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 24 Oct 2009 11:41:25 -0600 Subject: mesa: s/GLuint/gl_format/ --- src/mesa/main/texcompress.c | 6 +++--- src/mesa/main/texcompress.h | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index 5713b2c00d..76f2f232f4 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -131,7 +131,7 @@ _mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all) GLuint _mesa_compressed_texture_size( GLcontext *ctx, GLsizei width, GLsizei height, GLsizei depth, - GLuint mesaFormat ) + gl_format mesaFormat ) { return _mesa_format_image_size(mesaFormat, width, height, depth); } @@ -210,7 +210,7 @@ _mesa_compressed_texture_size_glenum(GLcontext *ctx, * \return stride, in bytes, between rows for compressed image */ GLint -_mesa_compressed_row_stride(GLuint mesaFormat, GLsizei width) +_mesa_compressed_row_stride(gl_format mesaFormat, GLsizei width) { GLint stride; @@ -261,7 +261,7 @@ _mesa_compressed_row_stride(GLuint mesaFormat, GLsizei width) */ GLubyte * _mesa_compressed_image_address(GLint col, GLint row, GLint img, - GLuint mesaFormat, + gl_format mesaFormat, GLsizei width, const GLubyte *image) { GLubyte *addr; diff --git a/src/mesa/main/texcompress.h b/src/mesa/main/texcompress.h index 44f3338222..13af148394 100644 --- a/src/mesa/main/texcompress.h +++ b/src/mesa/main/texcompress.h @@ -26,6 +26,7 @@ #define TEXCOMPRESS_H #include "mtypes.h" +#include "formats.h" #if _HAVE_FULL_GL @@ -35,7 +36,7 @@ _mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all); extern GLuint _mesa_compressed_texture_size( GLcontext *ctx, GLsizei width, GLsizei height, GLsizei depth, - GLuint mesaFormat ); + gl_format mesaFormat ); extern GLuint _mesa_compressed_texture_size_glenum(GLcontext *ctx, @@ -43,12 +44,12 @@ _mesa_compressed_texture_size_glenum(GLcontext *ctx, GLsizei depth, GLenum glformat); extern GLint -_mesa_compressed_row_stride(GLuint mesaFormat, GLsizei width); +_mesa_compressed_row_stride(gl_format mesaFormat, GLsizei width); extern GLubyte * _mesa_compressed_image_address(GLint col, GLint row, GLint img, - GLuint mesaFormat, + gl_format mesaFormat, GLsizei width, const GLubyte *image); -- cgit v1.2.3 From 5c8282769601ba30c00f04dac15d1dad6d67db6e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 24 Oct 2009 11:52:31 -0600 Subject: mesa: simplify _mesa_compressed_row_stride(), _mesa_compressed_image_address() _mesa_compressed_row_stride() can go away soon. _mesa_compressed_image_address() can be generalized and moved to formats.c --- src/mesa/main/texcompress.c | 91 ++++++++------------------------------------- 1 file changed, 15 insertions(+), 76 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index 76f2f232f4..b07265d6d8 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -212,40 +212,7 @@ _mesa_compressed_texture_size_glenum(GLcontext *ctx, GLint _mesa_compressed_row_stride(gl_format mesaFormat, GLsizei width) { - GLint stride; - - switch (mesaFormat) { -#if FEATURE_texture_fxt1 - case MESA_FORMAT_RGB_FXT1: - case MESA_FORMAT_RGBA_FXT1: - stride = ((width + 7) / 8) * 16; /* 16 bytes per 8x4 tile */ - break; -#endif -#if FEATURE_texture_s3tc - case MESA_FORMAT_RGB_DXT1: - case MESA_FORMAT_RGBA_DXT1: -#if FEATURE_EXT_texture_sRGB - case MESA_FORMAT_SRGB_DXT1: - case MESA_FORMAT_SRGBA_DXT1: -#endif - stride = ((width + 3) / 4) * 8; /* 8 bytes per 4x4 tile */ - break; - case MESA_FORMAT_RGBA_DXT3: - case MESA_FORMAT_RGBA_DXT5: -#if FEATURE_EXT_texture_sRGB - case MESA_FORMAT_SRGBA_DXT3: - case MESA_FORMAT_SRGBA_DXT5: -#endif - stride = ((width + 3) / 4) * 16; /* 16 bytes per 4x4 tile */ - break; -#endif - default: - _mesa_problem(NULL, "bad mesaFormat in _mesa_compressed_row_stride"); - return 0; - } - - assert(stride == _mesa_format_row_stride(mesaFormat, width)); - + GLint stride = _mesa_format_row_stride(mesaFormat, width); return stride; } @@ -253,58 +220,30 @@ _mesa_compressed_row_stride(gl_format mesaFormat, GLsizei width) /* * Return the address of the pixel at (col, row, img) in a * compressed texture image. - * \param col, row, img - image position (3D) + * \param col, row, img - image position (3D), should be a multiple of the + * format's block size. * \param format - compressed image format - * \param width - image width + * \param width - image width (stride) in pixels * \param image - the image address - * \return address of pixel at (row, col) + * \return address of pixel at (row, col, img) */ GLubyte * _mesa_compressed_image_address(GLint col, GLint row, GLint img, gl_format mesaFormat, GLsizei width, const GLubyte *image) { - GLubyte *addr; + /* XXX only 2D images implemented, not 3D */ + const GLuint blockSize = _mesa_get_format_bytes(mesaFormat); + GLuint bw, bh; + GLint offset; - (void) img; + _mesa_get_format_block_size(mesaFormat, &bw, &bh); - /* We try to spot a "complete" subtexture "above" ROW, COL; - * this texture is given by appropriate rounding of WIDTH x ROW. - * Then we just add the amount left (usually on the left). - * - * Example for X*Y microtiles (Z bytes each) - * offset = Z * (((width + X - 1) / X) * (row / Y) + col / X); - */ + ASSERT(col % bw == 0); + ASSERT(row % bh == 0); - switch (mesaFormat) { -#if FEATURE_texture_fxt1 - case MESA_FORMAT_RGB_FXT1: - case MESA_FORMAT_RGBA_FXT1: - addr = (GLubyte *) image + 16 * (((width + 7) / 8) * (row / 4) + col / 8); - break; -#endif -#if FEATURE_texture_s3tc - case MESA_FORMAT_RGB_DXT1: - case MESA_FORMAT_RGBA_DXT1: -#if FEATURE_EXT_texture_sRGB - case MESA_FORMAT_SRGB_DXT1: - case MESA_FORMAT_SRGBA_DXT1: -#endif - addr = (GLubyte *) image + 8 * (((width + 3) / 4) * (row / 4) + col / 4); - break; - case MESA_FORMAT_RGBA_DXT3: - case MESA_FORMAT_RGBA_DXT5: -#if FEATURE_EXT_texture_sRGB - case MESA_FORMAT_SRGBA_DXT3: - case MESA_FORMAT_SRGBA_DXT5: -#endif - addr = (GLubyte *) image + 16 * (((width + 3) / 4) * (row / 4) + col / 4); - break; -#endif - default: - _mesa_problem(NULL, "bad mesaFormat in _mesa_compressed_image_address"); - addr = NULL; - } + offset = ((width + bw - 1) / bw) * (row / bh) + col / bw; + offset *= blockSize; - return addr; + return (GLubyte *) image + offset; } -- cgit v1.2.3 From bea245ac2fecc312caec8f4af53174e4fb180103 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 24 Oct 2009 12:04:09 -0600 Subject: mesa: minor clean-ups in _mesa_store_compressed_texsubimage2d() --- src/mesa/main/texstore.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index ff6931156e..e6a63b8603 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3670,6 +3670,7 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, GLubyte *dest; const GLubyte *src; const gl_format texFormat = texImage->TexFormat; + const GLint destWidth = texImage->Width; GLuint bw, bh; _mesa_get_format_block_size(texFormat, &bw, &bh); @@ -3693,15 +3694,15 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, srcRowStride = _mesa_compressed_row_stride(texFormat, width); src = (const GLubyte *) data; - destRowStride = _mesa_compressed_row_stride(texFormat, texImage->Width); + destRowStride = _mesa_compressed_row_stride(texFormat, destWidth); dest = _mesa_compressed_image_address(xoffset, yoffset, 0, - texFormat, - texImage->Width, + texFormat, destWidth, (GLubyte *) texImage->Data); - bytesPerRow = srcRowStride; + bytesPerRow = srcRowStride; /* bytes per row of blocks */ rows = height / bh; /* rows in blocks */ + /* copy rows of blocks */ for (i = 0; i < rows; i++) { MEMCPY(dest, src, bytesPerRow); dest += destRowStride; -- cgit v1.2.3 From 35efc6a1b3e3dada2cf9bd3a503c1b84f4bcb7f5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 24 Oct 2009 16:28:24 -0600 Subject: mesa: change compressed texture size calls Replace calls to ctx->Driver.CompressedTextureSize with calls to _mesa_format_image_size. The former always called the later. --- src/mesa/drivers/dri/intel/intel_tex_image.c | 9 ++++----- src/mesa/drivers/dri/radeon/radeon_texture.c | 10 ++++------ src/mesa/drivers/dri/tdfx/tdfx_tex.c | 14 ++++---------- src/mesa/drivers/dri/unichrome/via_tex.c | 14 ++++---------- src/mesa/main/mipmap.c | 8 +++----- src/mesa/state_tracker/st_cb_texture.c | 9 ++++----- 6 files changed, 23 insertions(+), 41 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index b159010b8e..cbe29f61a2 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -488,11 +488,10 @@ intelTexImage(GLcontext * ctx, else { /* Allocate regular memory and store the image there temporarily. */ if (_mesa_is_format_compressed(texImage->TexFormat)) { - sizeInBytes = ctx->Driver.CompressedTextureSize(ctx, - texImage->Width, - texImage->Height, - texImage->Depth, - texImage->TexFormat); + sizeInBytes = _mesa_format_image_size(texImage->TexFormat, + texImage->Width, + texImage->Height, + texImage->Depth); dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width); assert(dims != 3); diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 8e9276c5ae..1a48e8c955 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -580,12 +580,10 @@ static void radeon_teximage( } else { int size; if (_mesa_is_format_compressed(texImage->TexFormat)) { - size = ctx->Driver.CompressedTextureSize(ctx, - texImage->Width, - texImage->Height, - texImage->Depth, - texImage->TexFormat); - + size = _mesa_format_image_size(texImage->TexFormat, + texImage->Width, + texImage->Height, + texImage->Depth); } else { size = texImage->Width * texImage->Height * texImage->Depth * _mesa_get_format_bytes(texImage->TexFormat); } diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index 0cd9051613..63783d6ecd 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -1408,11 +1408,8 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, texelBytes = _mesa_get_format_bytes(texImage->TexFormat); if (_mesa_is_format_compressed(texImage->TexFormat)) { - GLuint compressedSize = ctx->Driver.CompressedTextureSize(ctx, - mml->width, - mml->height, - 1, - mesaFormat); + GLuint compressedSize = _mesa_format_image_size(mesaFormat, mml->width, + mml->height, 1); dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, mml->width); texImage->Data = _mesa_alloc_texmemory(compressedSize); } else { @@ -1637,11 +1634,8 @@ tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target, /* allocate new storage for texture image, if needed */ if (!texImage->Data) { - compressedSize = ctx->Driver.CompressedTextureSize(ctx, - mml->width, - mml->height, - 1, - mesaFormat); + compressedSize = _mesa_format_image_size(mesaFormat, mml->width, + mml->height, 1); texImage->Data = _mesa_alloc_texmemory(compressedSize); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D"); diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index a72dcd6be2..1bc5ddc429 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -672,7 +672,6 @@ static void viaTexImage(GLcontext *ctx, struct via_texture_object *viaObj = (struct via_texture_object *)texObj; struct via_texture_image *viaImage = (struct via_texture_image *)texImage; int heaps[3], nheaps, i; - GLuint compressedSize; if (!is_empty_list(&vmesa->freed_tex_buffers)) { viaCheckBreadcrumb(vmesa, 0); @@ -692,14 +691,6 @@ static void viaTexImage(GLcontext *ctx, texelBytes = _mesa_get_format_bytes(texImage->TexFormat); - if (texelBytes == 0) { - /* compressed format */ - compressedSize = - ctx->Driver.CompressedTextureSize(ctx, texImage->Width, - texImage->Height, texImage->Depth, - texImage->TexFormat); - } - /* Minimum pitch of 32 bytes */ if (postConvWidth * texelBytes < 32) { postConvWidth = 32 / texelBytes; @@ -711,7 +702,10 @@ static void viaTexImage(GLcontext *ctx, /* allocate memory */ if (_mesa_is_format_compressed(texImage->TexFormat)) - sizeInBytes = compressedSize; + sizeInBytes = _mesa_format_image_size(texImage->TexFormat, + texImage->Width, + texImage->Height, + texImage->Depth); else sizeInBytes = postConvWidth * postConvHeight * texelBytes; diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 694d593330..40cf43dfff 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1618,11 +1618,9 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, * Setup src and dest data pointers. */ if (_mesa_is_format_compressed(dstImage->TexFormat)) { - GLuint dstCompressedSize - = ctx->Driver.CompressedTextureSize(ctx, dstImage->Width, - dstImage->Height, - dstImage->Depth, - dstImage->TexFormat); + GLuint dstCompressedSize = + _mesa_format_image_size(dstImage->TexFormat, dstImage->Width, + dstImage->Height, dstImage->Depth); ASSERT(dstCompressedSize > 0); dstImage->Data = _mesa_alloc_texmemory(dstCompressedSize); diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 01b8e5fd77..f68620aec4 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -694,11 +694,10 @@ st_TexImage(GLcontext * ctx, else { /* Allocate regular memory and store the image there temporarily. */ if (_mesa_is_format_compressed(texImage->TexFormat)) { - sizeInBytes = ctx->Driver.CompressedTextureSize(ctx, - texImage->Width, - texImage->Height, - texImage->Depth, - texImage->TexFormat); + sizeInBytes = _mesa_format_image_size(texImage->TexFormat, + texImage->Width, + texImage->Height, + texImage->Depth); dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width); assert(dims != 3); -- cgit v1.2.3 From 4c00981b22b28141af1442e5a679d0923b4358ae Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 24 Oct 2009 16:34:18 -0600 Subject: mesa: remove ctx->Driver.CompressedTextureSize() hook It always just called _mesa_compressed_texture_size() anyway. --- src/mesa/drivers/common/driverfuncs.c | 1 - src/mesa/main/dd.h | 7 ------- src/mesa/state_tracker/st_cb_texture.c | 1 - 3 files changed, 9 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index f09106b77c..fe659a6224 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -115,7 +115,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->CompressedTexSubImage2D = _mesa_store_compressed_texsubimage2d; driver->CompressedTexSubImage3D = _mesa_store_compressed_texsubimage3d; driver->GetCompressedTexImage = _mesa_get_compressed_teximage; - driver->CompressedTextureSize = _mesa_compressed_texture_size; driver->BindTexture = NULL; driver->NewTextureObject = _mesa_new_texture_object; driver->DeleteTexture = _mesa_delete_texture_object; diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 64bf9cba19..5f7c9cb6a3 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -475,13 +475,6 @@ struct dd_function_table { struct gl_texture_object *texObj, struct gl_texture_image *texImage); - /** - * Called to query number of bytes of storage needed to store the - * specified compressed texture. - */ - GLuint (*CompressedTextureSize)( GLcontext *ctx, GLsizei width, - GLsizei height, GLsizei depth, - GLuint mesaFormat ); /*@}*/ /** diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index f68620aec4..8ba7c8e53f 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1973,7 +1973,6 @@ st_init_texture_functions(struct dd_function_table *functions) /* compressed texture functions */ functions->CompressedTexImage2D = st_CompressedTexImage2D; functions->GetCompressedTexImage = st_GetCompressedTexImage; - functions->CompressedTextureSize = _mesa_compressed_texture_size; functions->NewTextureObject = st_NewTextureObject; functions->NewTextureImage = st_NewTextureImage; -- cgit v1.2.3 From d6ee86c77a8e1543557fd64c1f1c354baa0a8ad8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 24 Oct 2009 16:49:57 -0600 Subject: mesa: remove _mesa_compressed_texture_size() Use _mesa_format_image_size() instead. --- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 2 +- src/mesa/drivers/glide/fxddtex.c | 16 ++++++---------- src/mesa/main/texcompress.c | 24 ------------------------ src/mesa/main/texcompress.h | 6 ------ src/mesa/main/texgetimage.c | 10 ++++------ src/mesa/main/texparam.c | 8 ++------ 6 files changed, 13 insertions(+), 53 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index 86f596deb9..dadc72f4c1 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -37,7 +37,7 @@ static GLuint radeon_compressed_texture_size(GLcontext *ctx, GLsizei width, GLsizei height, GLsizei depth, GLuint mesaFormat) { - GLuint size = _mesa_compressed_texture_size(ctx, width, height, depth, mesaFormat); + GLuint size = _mesa_format_image_size(mesaFormat, width, height, depth); if (mesaFormat == MESA_FORMAT_RGB_DXT1 || mesaFormat == MESA_FORMAT_RGBA_DXT1) { diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index a820cb818e..128c17e08b 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -1397,11 +1397,9 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, /* allocate mipmap buffer */ assert(!texImage->Data); if (_mesa_is_format_compressed(texImage->TexFormat)) { - texImage->CompressedSize = _mesa_compressed_texture_size(ctx, - mml->width, - mml->height, - 1, - internalFormat); + texImage->CompressedSize = _mesa_format_image_size(texImage->TexFormat, + mml->width, + mml->height, 1); dstRowStride = _mesa_compressed_row_stride(internalFormat, mml->width); texImage->Data = _mesa_malloc(texImage->CompressedSize); } else { @@ -1664,11 +1662,9 @@ fxDDCompressedTexImage2D (GLcontext *ctx, GLenum target, /* allocate new storage for texture image, if needed */ if (!texImage->Data) { - texImage->CompressedSize = _mesa_compressed_texture_size(ctx, - mml->width, - mml->height, - 1, - internalFormat); + texImage->CompressedSize = _mesa_format_image_size(texImage->TexFormat, + mml->width, + mml->height, 1); texImage->Data = _mesa_malloc(texImage->CompressedSize); if (!texImage->Data) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D"); diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index b07265d6d8..ad10993307 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -113,30 +113,6 @@ _mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all) } - -/** - * Return number of bytes needed to store a texture of the given size - * using the specified (compressed?) format. - * This is called via the ctx->Driver.CompressedTextureSize function, - * unless a device driver overrides it. A driver might override this - * if it needs to use an unusual or padded texture memory layout. - * - * \param width texture width in texels. - * \param height texture height in texels. - * \param depth texture depth in texels. - * \param mesaFormat one of the MESA_FORMAT_* compressed formats - * - * \return size in bytes, or zero if bad format - */ -GLuint -_mesa_compressed_texture_size( GLcontext *ctx, - GLsizei width, GLsizei height, GLsizei depth, - gl_format mesaFormat ) -{ - return _mesa_format_image_size(mesaFormat, width, height, depth); -} - - /** * As above, but format is specified by a GLenum (GL_COMPRESSED_*) token. * diff --git a/src/mesa/main/texcompress.h b/src/mesa/main/texcompress.h index 13af148394..70247098b2 100644 --- a/src/mesa/main/texcompress.h +++ b/src/mesa/main/texcompress.h @@ -33,11 +33,6 @@ extern GLuint _mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all); -extern GLuint -_mesa_compressed_texture_size( GLcontext *ctx, - GLsizei width, GLsizei height, GLsizei depth, - gl_format mesaFormat ); - extern GLuint _mesa_compressed_texture_size_glenum(GLcontext *ctx, GLsizei width, GLsizei height, @@ -64,7 +59,6 @@ _mesa_init_texture_fxt1( GLcontext *ctx ); /* no-op macros */ #define _mesa_get_compressed_formats( c, f ) 0 -#define _mesa_compressed_texture_size( c, w, h, d, f ) 0 #define _mesa_compressed_texture_size_glenum( c, w, h, d, f ) 0 #define _mesa_compressed_row_stride( f, w) 0 #define _mesa_compressed_image_address(c, r, i, f, w, i2 ) 0 diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index d5cd4b2b9d..1f0a3d793f 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -320,12 +320,10 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - GLuint size; - - /* 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); + const GLuint size = _mesa_format_image_size(texImage->TexFormat, + texImage->Width, + texImage->Height, + texImage->Depth); if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { /* pack texture image into a PBO */ diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index a6b611dffb..afa66f149c 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -853,12 +853,8 @@ _mesa_GetTexLevelParameteriv( GLenum target, GLint level, /* GL_ARB_texture_compression */ case GL_TEXTURE_COMPRESSED_IMAGE_SIZE: if (_mesa_is_format_compressed(img->TexFormat) && !isProxy) { - /* Don't use ctx->Driver.CompressedTextureSize() since that - * may returned a padded hardware size. - */ - *params = _mesa_compressed_texture_size(ctx, img->Width, - img->Height, img->Depth, - texFormat); + *params = _mesa_format_image_size(texFormat, img->Width, + img->Height, img->Depth); } else { _mesa_error(ctx, GL_INVALID_OPERATION, -- cgit v1.2.3 From 118dfe16887d1ec4d3b96d49b76fffa0d2924132 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 25 Oct 2009 05:05:27 +0100 Subject: r300g: added support for 3D textures Mipmaps not tested. Also, I am not sure why piglit/texturing/tex3d needs to have color tolerance +-1 to pass. The classic Mesa driver doesn't need that. --- src/gallium/drivers/r300/r300_context.h | 3 ++ src/gallium/drivers/r300/r300_screen.c | 59 ++++++++++----------------------- src/gallium/drivers/r300/r300_texture.c | 39 ++++++++++++++++------ src/gallium/drivers/r300/r300_texture.h | 3 ++ 4 files changed, 51 insertions(+), 53 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 30b80fa9db..4d73567bbe 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -181,6 +181,9 @@ struct r300_texture { /* Offsets into the buffer. */ unsigned offset[PIPE_MAX_TEXTURE_LEVELS]; + /* Size of one zslice or face based on the texture target */ + unsigned layer_size[PIPE_MAX_TEXTURE_LEVELS]; + /** * If non-zero, override the natural texture layout with * a custom stride (in bytes). diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 1d9f91d0f7..f581f0ca09 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -119,32 +119,13 @@ static int r300_get_param(struct pipe_screen* pscreen, int param) case PIPE_CAP_TEXTURE_SHADOW_MAP: return 1; case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: - if (r300screen->caps->is_r500) { - /* 13 == 4096x4096 */ - return 13; - } else { - /* 12 == 2048x2048 */ - return 12; - } case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: - /* So, technically, the limit is the same as above, but some math - * shows why this is silly. Assuming RGBA, 4cpp, we can see that - * 4096*4096*4096 = 64.0 GiB exactly, so it's not exactly - * practical. However, if at some point a game really wants this, - * then we can remove or raise this limit. */ - if (r300screen->caps->is_r500) { - /* 9 == 256x256x256 */ - return 9; - } else { - /* 8 == 128*128*128 */ - return 8; - } case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: if (r300screen->caps->is_r500) { - /* 13 == 4096x4096 */ + /* 13 == 4096 */ return 13; } else { - /* 12 == 2048x2048 */ + /* 12 == 2048 */ return 12; } case PIPE_CAP_TEXTURE_MIRROR_CLAMP: @@ -191,8 +172,8 @@ static float r300_get_paramf(struct pipe_screen* pscreen, int param) } } -static boolean check_tex_2d_format(enum pipe_format format, uint32_t usage, - boolean is_r500) +static boolean check_tex_format(enum pipe_format format, uint32_t usage, + boolean is_r500) { uint32_t retval = 0; @@ -286,7 +267,6 @@ static boolean check_tex_2d_format(enum pipe_format format, uint32_t usage, return (retval >= usage); } -/* XXX moar targets */ static boolean r300_is_format_supported(struct pipe_screen* pscreen, enum pipe_format format, enum pipe_texture_target target, @@ -294,15 +274,17 @@ static boolean r300_is_format_supported(struct pipe_screen* pscreen, unsigned geom_flags) { switch (target) { + case PIPE_TEXTURE_1D: /* handle 1D textures as 2D ones */ case PIPE_TEXTURE_2D: - return check_tex_2d_format(format, tex_usage, - r300_screen(pscreen)->caps->is_r500); - case PIPE_TEXTURE_1D: case PIPE_TEXTURE_3D: + return check_tex_format(format, tex_usage, + r300_screen(pscreen)->caps->is_r500); + case PIPE_TEXTURE_CUBE: debug_printf("r300: Implementation error: Unsupported format " "target: %d\n", target); break; + default: debug_printf("r300: Fatal: This is not a format target: %d\n", target); @@ -322,22 +304,9 @@ r300_get_tex_transfer(struct pipe_screen *screen, { struct r300_texture *tex = (struct r300_texture *)texture; struct r300_transfer *trans; - unsigned offset = 0; /* in bytes */ + unsigned offset; - /* XXX Add support for these things */ - if (texture->target == PIPE_TEXTURE_CUBE) { - debug_printf("PIPE_TEXTURE_CUBE is not yet supported.\n"); - /* offset = tex->image_offset[level][face]; */ - } - else if (texture->target == PIPE_TEXTURE_3D) { - debug_printf("PIPE_TEXTURE_3D is not yet supported.\n"); - /* offset = tex->image_offset[level][zslice]; */ - } - else { - offset = tex->offset[level]; - assert(face == 0); - assert(zslice == 0); - } + offset = r300_texture_get_offset(tex, level, zslice, face); /* in bytes */ trans = CALLOC_STRUCT(r300_transfer); if (trans) { @@ -352,6 +321,12 @@ r300_get_tex_transfer(struct pipe_screen *screen, trans->transfer.nblocksy = texture->nblocksy[level]; trans->transfer.stride = r300_texture_get_stride(tex, level); trans->transfer.usage = usage; + + /* XXX not sure whether it's required to set these two, + the driver doesn't use them */ + trans->transfer.zslice = zslice; + trans->transfer.face = face; + trans->offset = offset; } return &trans->transfer; diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 3c8ff24e17..37c7910d80 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -36,7 +36,7 @@ static void r300_setup_texture_state(struct r300_texture* tex) state->format0 = R300_TX_WIDTH((pt->width[0] - 1) & 0x7ff) | R300_TX_HEIGHT((pt->height[0] - 1) & 0x7ff) | R300_TX_DEPTH(util_logbase2(pt->depth[0]) & 0xf) | - R300_TX_NUM_LEVELS(pt->last_level) | + R300_TX_NUM_LEVELS(pt->last_level & 0xf) | R300_TX_PITCH_EN; /* XXX */ @@ -48,7 +48,8 @@ static void r300_setup_texture_state(struct r300_texture* tex) state->format1 |= R300_TX_FORMAT_3D; } - state->format2 = (r300_texture_get_stride(tex, 0) / pt->block.size) - 1; + state->format2 = ((r300_texture_get_stride(tex, 0) / pt->block.size) - 1) + & 0x1fff; /* Don't worry about accidentally setting this bit on non-r500; * the kernel should catch it. */ @@ -63,6 +64,26 @@ static void r300_setup_texture_state(struct r300_texture* tex) pt->width[0], pt->height[0], pt->last_level); } +unsigned r300_texture_get_offset(struct r300_texture* tex, unsigned level, + unsigned zslice, unsigned face) +{ + unsigned offset = tex->offset[level]; + + switch (tex->tex.target) { + case PIPE_TEXTURE_3D: + assert(face == 0); + return offset + zslice * tex->layer_size[level]; + + case PIPE_TEXTURE_CUBE: + assert(zslice == 0); + return offset + face * tex->layer_size[level]; + + default: + assert(zslice == 0 && face == 0); + return offset; + } +} + /** * Return the stride, in bytes, of the texture images of the given texture * at the given level. @@ -84,7 +105,7 @@ unsigned r300_texture_get_stride(struct r300_texture* tex, unsigned level) static void r300_setup_miptree(struct r300_texture* tex) { struct pipe_texture* base = &tex->tex; - int stride, size; + int stride, size, layer_size; int i; for (i = 0; i <= base->last_level; i++) { @@ -98,10 +119,12 @@ static void r300_setup_miptree(struct r300_texture* tex) base->nblocksy[i] = pf_get_nblocksy(&base->block, base->height[i]); stride = r300_texture_get_stride(tex, i); - size = stride * base->nblocksy[i] * base->depth[i]; + layer_size = stride * base->nblocksy[i]; + size = layer_size * base->depth[i]; tex->offset[i] = align(tex->size, 32); tex->size = tex->offset[i] + size; + tex->layer_size[i] = layer_size; debug_printf("r300: Texture miptree: Level %d " "(%dx%dx%d px, pitch %d bytes)\n", @@ -161,8 +184,7 @@ static struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen, struct pipe_surface* surface = CALLOC_STRUCT(pipe_surface); unsigned offset; - /* XXX this is certainly dependent on tex target */ - offset = tex->offset[level]; + offset = r300_texture_get_offset(tex, level, zslice, face); if (surface) { pipe_reference_init(&surface->reference, 1); @@ -191,11 +213,6 @@ static struct pipe_texture* { struct r300_texture* tex; - if (base->target != PIPE_TEXTURE_2D || - base->depth[0] != 1) { - return NULL; - } - tex = CALLOC_STRUCT(r300_texture); if (!tex) { return NULL; diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h index 55d1a0ac5c..35e06a9acb 100644 --- a/src/gallium/drivers/r300/r300_texture.h +++ b/src/gallium/drivers/r300/r300_texture.h @@ -33,6 +33,9 @@ void r300_init_screen_texture_functions(struct pipe_screen* screen); unsigned r300_texture_get_stride(struct r300_texture* tex, unsigned level); +unsigned r300_texture_get_offset(struct r300_texture* tex, unsigned level, + unsigned zslice, unsigned face); + /* Note the signature of R300_EASY_TX_FORMAT(A, R, G, B, FORMAT)... */ static INLINE uint32_t r300_translate_texformat(enum pipe_format format) { -- cgit v1.2.3 From c2df759cd73e281c4698c717e0ab89757a7affd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 25 Oct 2009 09:57:53 +0100 Subject: r300g: fix redefining mipmaps and fetching from them --- src/gallium/drivers/r300/r300_texture.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 37c7910d80..762806822c 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -36,8 +36,9 @@ static void r300_setup_texture_state(struct r300_texture* tex) state->format0 = R300_TX_WIDTH((pt->width[0] - 1) & 0x7ff) | R300_TX_HEIGHT((pt->height[0] - 1) & 0x7ff) | R300_TX_DEPTH(util_logbase2(pt->depth[0]) & 0xf) | - R300_TX_NUM_LEVELS(pt->last_level & 0xf) | - R300_TX_PITCH_EN; + R300_TX_NUM_LEVELS(pt->last_level & 0xf);/* | + R300_TX_PITCH_EN;*/ + /* XXX TX_PITCH_EN breaks rendering mipmap levels > 0, weard */ /* XXX */ state->format1 = r300_translate_texformat(pt->format); @@ -194,6 +195,10 @@ static struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen, surface->height = texture->height[level]; surface->offset = offset; surface->usage = flags; + surface->zslice = zslice; + surface->texture = texture; + surface->face = face; + surface->level = level; } return surface; -- cgit v1.2.3 From b4f6907b8d8a966df56c06155049c52dadea105f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 22 Oct 2009 20:42:16 +0100 Subject: llvmpipe: Move a few format/sampling functions into better space. --- src/gallium/drivers/llvmpipe/Makefile | 1 + src/gallium/drivers/llvmpipe/SConscript | 1 + src/gallium/drivers/llvmpipe/lp_bld_format.h | 16 --- src/gallium/drivers/llvmpipe/lp_bld_format_soa.c | 71 ------------- src/gallium/drivers/llvmpipe/lp_bld_sample.c | 124 +++++++++++++++++++++++ src/gallium/drivers/llvmpipe/lp_bld_sample.h | 9 ++ src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c | 59 +++++------ 7 files changed, 158 insertions(+), 123 deletions(-) create mode 100644 src/gallium/drivers/llvmpipe/lp_bld_sample.c (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/Makefile b/src/gallium/drivers/llvmpipe/Makefile index b96ee23a99..ea771392b1 100644 --- a/src/gallium/drivers/llvmpipe/Makefile +++ b/src/gallium/drivers/llvmpipe/Makefile @@ -22,6 +22,7 @@ C_SOURCES = \ lp_bld_intr.c \ lp_bld_logic.c \ lp_bld_pack.c \ + lp_bld_sample.c \ lp_bld_sample_soa.c \ lp_bld_swizzle.c \ lp_bld_struct.c \ diff --git a/src/gallium/drivers/llvmpipe/SConscript b/src/gallium/drivers/llvmpipe/SConscript index 403e4daa43..72e445b881 100644 --- a/src/gallium/drivers/llvmpipe/SConscript +++ b/src/gallium/drivers/llvmpipe/SConscript @@ -34,6 +34,7 @@ llvmpipe = env.ConvenienceLibrary( 'lp_bld_interp.c', 'lp_bld_intr.c', 'lp_bld_pack.c', + 'lp_bld_sample.c', 'lp_bld_sample_soa.c', 'lp_bld_struct.c', 'lp_bld_logic.c', diff --git a/src/gallium/drivers/llvmpipe/lp_bld_format.h b/src/gallium/drivers/llvmpipe/lp_bld_format.h index c087fc986e..1ea694509d 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_format.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_format.h @@ -91,14 +91,6 @@ lp_build_store_rgba_aos(LLVMBuilderRef builder, LLVMValueRef ptr, LLVMValueRef rgba); -LLVMValueRef -lp_build_gather(LLVMBuilderRef builder, - unsigned length, - unsigned src_width, - unsigned dst_width, - LLVMValueRef base_ptr, - LLVMValueRef offsets); - void lp_build_unpack_rgba_soa(LLVMBuilderRef builder, @@ -108,12 +100,4 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder, LLVMValueRef *rgba); -void -lp_build_load_rgba_soa(LLVMBuilderRef builder, - const struct util_format_description *format_desc, - struct lp_type type, - LLVMValueRef base_ptr, - LLVMValueRef offsets, - LLVMValueRef *rgba); - #endif /* !LP_BLD_FORMAT_H */ diff --git a/src/gallium/drivers/llvmpipe/lp_bld_format_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_format_soa.c index 66bebdcdec..60ad4c0ee6 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_format_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_format_soa.c @@ -34,55 +34,6 @@ #include "lp_bld_format.h" -/** - * Gather elements from scatter positions in memory into a single vector. - * - * @param src_width src element width - * @param dst_width result element width (source will be expanded to fit) - * @param length length of the offsets, - * @param base_ptr base pointer, should be a i8 pointer type. - * @param offsets vector with offsets - */ -LLVMValueRef -lp_build_gather(LLVMBuilderRef builder, - unsigned length, - unsigned src_width, - unsigned dst_width, - LLVMValueRef base_ptr, - LLVMValueRef offsets) -{ - LLVMTypeRef src_type = LLVMIntType(src_width); - LLVMTypeRef src_ptr_type = LLVMPointerType(src_type, 0); - LLVMTypeRef dst_elem_type = LLVMIntType(dst_width); - LLVMTypeRef dst_vec_type = LLVMVectorType(dst_elem_type, length); - LLVMValueRef res; - unsigned i; - - res = LLVMGetUndef(dst_vec_type); - for(i = 0; i < length; ++i) { - LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0); - LLVMValueRef elem_offset; - LLVMValueRef elem_ptr; - LLVMValueRef elem; - - elem_offset = LLVMBuildExtractElement(builder, offsets, index, ""); - elem_ptr = LLVMBuildGEP(builder, base_ptr, &elem_offset, 1, ""); - elem_ptr = LLVMBuildBitCast(builder, elem_ptr, src_ptr_type, ""); - elem = LLVMBuildLoad(builder, elem_ptr, ""); - - assert(src_width <= dst_width); - if(src_width > dst_width) - elem = LLVMBuildTrunc(builder, elem, dst_elem_type, ""); - if(src_width < dst_width) - elem = LLVMBuildZExt(builder, elem, dst_elem_type, ""); - - res = LLVMBuildInsertElement(builder, res, elem, index, ""); - } - - return res; -} - - static LLVMValueRef lp_build_format_swizzle(struct lp_type type, const LLVMValueRef *inputs, @@ -185,25 +136,3 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder, } } } - - -void -lp_build_load_rgba_soa(LLVMBuilderRef builder, - const struct util_format_description *format_desc, - struct lp_type type, - LLVMValueRef base_ptr, - LLVMValueRef offsets, - LLVMValueRef *rgba) -{ - LLVMValueRef packed; - - assert(format_desc->block.width == 1); - assert(format_desc->block.height == 1); - assert(format_desc->block.bits <= type.width); - - packed = lp_build_gather(builder, - type.length, format_desc->block.bits, type.width, - base_ptr, offsets); - - lp_build_unpack_rgba_soa(builder, format_desc, type, packed, rgba); -} diff --git a/src/gallium/drivers/llvmpipe/lp_bld_sample.c b/src/gallium/drivers/llvmpipe/lp_bld_sample.c new file mode 100644 index 0000000000..b0543f22c9 --- /dev/null +++ b/src/gallium/drivers/llvmpipe/lp_bld_sample.c @@ -0,0 +1,124 @@ +/************************************************************************** + * + * Copyright 2009 VMware, Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. + * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR + * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +/** + * @file + * Texture sampling -- common code. + * + * @author Jose Fonseca + */ + +#include "pipe/p_defines.h" +#include "pipe/p_state.h" +#include "util/u_format.h" +#include "util/u_math.h" +#include "lp_bld_debug.h" +#include "lp_bld_format.h" +#include "lp_bld_sample.h" + + +void +lp_sampler_static_state(struct lp_sampler_static_state *state, + const struct pipe_texture *texture, + const struct pipe_sampler_state *sampler) +{ + memset(state, 0, sizeof *state); + + if(!texture) + return; + + if(!sampler) + return; + + state->format = texture->format; + state->target = texture->target; + state->pot_width = util_is_pot(texture->width[0]); + state->pot_height = util_is_pot(texture->height[0]); + state->pot_depth = util_is_pot(texture->depth[0]); + + state->wrap_s = sampler->wrap_s; + state->wrap_t = sampler->wrap_t; + state->wrap_r = sampler->wrap_r; + state->min_img_filter = sampler->min_img_filter; + state->min_mip_filter = sampler->min_mip_filter; + state->mag_img_filter = sampler->mag_img_filter; + if(sampler->compare_mode) { + state->compare_mode = sampler->compare_mode; + state->compare_func = sampler->compare_func; + } + state->normalized_coords = sampler->normalized_coords; + state->prefilter = sampler->prefilter; +} + + +/** + * Gather elements from scatter positions in memory into a single vector. + * + * @param src_width src element width + * @param dst_width result element width (source will be expanded to fit) + * @param length length of the offsets, + * @param base_ptr base pointer, should be a i8 pointer type. + * @param offsets vector with offsets + */ +LLVMValueRef +lp_build_gather(LLVMBuilderRef builder, + unsigned length, + unsigned src_width, + unsigned dst_width, + LLVMValueRef base_ptr, + LLVMValueRef offsets) +{ + LLVMTypeRef src_type = LLVMIntType(src_width); + LLVMTypeRef src_ptr_type = LLVMPointerType(src_type, 0); + LLVMTypeRef dst_elem_type = LLVMIntType(dst_width); + LLVMTypeRef dst_vec_type = LLVMVectorType(dst_elem_type, length); + LLVMValueRef res; + unsigned i; + + res = LLVMGetUndef(dst_vec_type); + for(i = 0; i < length; ++i) { + LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), i, 0); + LLVMValueRef elem_offset; + LLVMValueRef elem_ptr; + LLVMValueRef elem; + + elem_offset = LLVMBuildExtractElement(builder, offsets, index, ""); + elem_ptr = LLVMBuildGEP(builder, base_ptr, &elem_offset, 1, ""); + elem_ptr = LLVMBuildBitCast(builder, elem_ptr, src_ptr_type, ""); + elem = LLVMBuildLoad(builder, elem_ptr, ""); + + assert(src_width <= dst_width); + if(src_width > dst_width) + elem = LLVMBuildTrunc(builder, elem, dst_elem_type, ""); + if(src_width < dst_width) + elem = LLVMBuildZExt(builder, elem, dst_elem_type, ""); + + res = LLVMBuildInsertElement(builder, res, elem, index, ""); + } + + return res; +} diff --git a/src/gallium/drivers/llvmpipe/lp_bld_sample.h b/src/gallium/drivers/llvmpipe/lp_bld_sample.h index 403d0e4836..2b56179eb8 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_sample.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_sample.h @@ -119,6 +119,15 @@ lp_sampler_static_state(struct lp_sampler_static_state *state, const struct pipe_sampler_state *sampler); +LLVMValueRef +lp_build_gather(LLVMBuilderRef builder, + unsigned length, + unsigned src_width, + unsigned dst_width, + LLVMValueRef base_ptr, + LLVMValueRef offsets); + + void lp_build_sample_soa(LLVMBuilderRef builder, const struct lp_sampler_static_state *static_state, diff --git a/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c index 1a47ca32d2..4af0454935 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c @@ -27,7 +27,7 @@ /** * @file - * Texture sampling. + * Texture sampling -- SoA. * * @author Jose Fonseca */ @@ -48,41 +48,6 @@ #include "lp_bld_sample.h" -void -lp_sampler_static_state(struct lp_sampler_static_state *state, - const struct pipe_texture *texture, - const struct pipe_sampler_state *sampler) -{ - memset(state, 0, sizeof *state); - - if(!texture) - return; - - if(!sampler) - return; - - state->format = texture->format; - state->target = texture->target; - state->pot_width = util_is_pot(texture->width[0]); - state->pot_height = util_is_pot(texture->height[0]); - state->pot_depth = util_is_pot(texture->depth[0]); - - state->wrap_s = sampler->wrap_s; - state->wrap_t = sampler->wrap_t; - state->wrap_r = sampler->wrap_r; - state->min_img_filter = sampler->min_img_filter; - state->min_mip_filter = sampler->min_mip_filter; - state->mag_img_filter = sampler->mag_img_filter; - if(sampler->compare_mode) { - state->compare_mode = sampler->compare_mode; - state->compare_func = sampler->compare_func; - } - state->normalized_coords = sampler->normalized_coords; - state->prefilter = sampler->prefilter; -} - - - /** * Keep all information for sampling code generation in a single place. */ @@ -110,6 +75,28 @@ struct lp_build_sample_context }; +static void +lp_build_load_rgba_soa(LLVMBuilderRef builder, + const struct util_format_description *format_desc, + struct lp_type type, + LLVMValueRef base_ptr, + LLVMValueRef offsets, + LLVMValueRef *rgba) +{ + LLVMValueRef packed; + + assert(format_desc->block.width == 1); + assert(format_desc->block.height == 1); + assert(format_desc->block.bits <= type.width); + + packed = lp_build_gather(builder, + type.length, format_desc->block.bits, type.width, + base_ptr, offsets); + + lp_build_unpack_rgba_soa(builder, format_desc, type, packed, rgba); +} + + static void lp_build_sample_texel(struct lp_build_sample_context *bld, LLVMValueRef x, -- cgit v1.2.3 From 232b5864647d4c8d6cebb0845c046f1612e6054d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 22 Oct 2009 20:58:35 +0100 Subject: llvmpipe: Eliminate lp_build_load_rgba_aos. --- src/gallium/drivers/llvmpipe/lp_bld_format.h | 16 +----------- src/gallium/drivers/llvmpipe/lp_bld_format_aos.c | 32 +----------------------- src/gallium/drivers/llvmpipe/lp_test_format.c | 19 +++++++++----- 3 files changed, 15 insertions(+), 52 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_format.h b/src/gallium/drivers/llvmpipe/lp_bld_format.h index 1ea694509d..b30537b2e9 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_format.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_format.h @@ -51,7 +51,7 @@ struct lp_type; */ LLVMValueRef lp_build_unpack_rgba_aos(LLVMBuilderRef builder, - enum pipe_format format, + const struct util_format_description *desc, LLVMValueRef packed); @@ -66,20 +66,6 @@ lp_build_pack_rgba_aos(LLVMBuilderRef builder, LLVMValueRef rgba); -/** - * Load a pixel into its RGBA components. - * - * @param ptr value with the pointer to the packed pixel. Pointer type is - * irrelevant. - * - * @return RGBA in a 4 floats vector. - */ -LLVMValueRef -lp_build_load_rgba_aos(LLVMBuilderRef builder, - enum pipe_format format, - LLVMValueRef ptr); - - /** * Store a pixel. * diff --git a/src/gallium/drivers/llvmpipe/lp_bld_format_aos.c b/src/gallium/drivers/llvmpipe/lp_bld_format_aos.c index b9b5d84bed..840e54e558 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_format_aos.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_format_aos.c @@ -33,10 +33,9 @@ LLVMValueRef lp_build_unpack_rgba_aos(LLVMBuilderRef builder, - enum pipe_format format, + const struct util_format_description *desc, LLVMValueRef packed) { - const struct util_format_description *desc; LLVMTypeRef type; LLVMValueRef shifted, casted, scaled, masked; LLVMValueRef shifts[4]; @@ -49,8 +48,6 @@ lp_build_unpack_rgba_aos(LLVMBuilderRef builder, unsigned shift; unsigned i; - desc = util_format_description(format); - /* FIXME: Support more formats */ assert(desc->layout == UTIL_FORMAT_LAYOUT_ARITH); assert(desc->block.width == 1); @@ -249,33 +246,6 @@ lp_build_pack_rgba_aos(LLVMBuilderRef builder, } -LLVMValueRef -lp_build_load_rgba_aos(LLVMBuilderRef builder, - enum pipe_format format, - LLVMValueRef ptr) -{ - const struct util_format_description *desc; - LLVMTypeRef type; - LLVMValueRef packed; - - desc = util_format_description(format); - - /* FIXME: Support more formats */ - assert(desc->layout == UTIL_FORMAT_LAYOUT_ARITH); - assert(desc->block.width == 1); - assert(desc->block.height == 1); - assert(desc->block.bits <= 32); - - type = LLVMIntType(desc->block.bits); - - ptr = LLVMBuildBitCast(builder, ptr, LLVMPointerType(type, 0), ""); - - packed = LLVMBuildLoad(builder, ptr, ""); - - return lp_build_unpack_rgba_aos(builder, format, packed); -} - - void lp_build_store_rgba_aos(LLVMBuilderRef builder, enum pipe_format format, diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c index 5dc8297fe9..6e501195f8 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_format.c +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c @@ -89,34 +89,41 @@ struct pixel_test_case test_cases[] = }; -typedef void (*load_ptr_t)(const void *, float *); +typedef void (*load_ptr_t)(const uint32_t packed, float *); static LLVMValueRef add_load_rgba_test(LLVMModuleRef module, enum pipe_format format) { + const struct util_format_description *desc; LLVMTypeRef args[2]; LLVMValueRef func; - LLVMValueRef ptr; + LLVMValueRef packed; LLVMValueRef rgba_ptr; LLVMBasicBlockRef block; LLVMBuilderRef builder; LLVMValueRef rgba; - args[0] = LLVMPointerType(LLVMInt8Type(), 0); + desc = util_format_description(format); + + args[0] = LLVMInt32Type(); args[1] = LLVMPointerType(LLVMVectorType(LLVMFloatType(), 4), 0); func = LLVMAddFunction(module, "load", LLVMFunctionType(LLVMVoidType(), args, 2, 0)); LLVMSetFunctionCallConv(func, LLVMCCallConv); - ptr = LLVMGetParam(func, 0); + packed = LLVMGetParam(func, 0); rgba_ptr = LLVMGetParam(func, 1); block = LLVMAppendBasicBlock(func, "entry"); builder = LLVMCreateBuilder(); LLVMPositionBuilderAtEnd(builder, block); - rgba = lp_build_load_rgba_aos(builder, format, ptr); + if(desc->block.bits < 32) + packed = LLVMBuildTrunc(builder, packed, LLVMIntType(desc->block.bits), ""); + + rgba = lp_build_unpack_rgba_aos(builder, desc, packed); + LLVMBuildStore(builder, rgba, rgba_ptr); LLVMBuildRetVoid(builder); @@ -224,7 +231,7 @@ test_format(const struct pixel_test_case *test) memset(unpacked, 0, sizeof unpacked); packed = 0; - load_ptr(&test->packed, unpacked); + load_ptr(test->packed, unpacked); store_ptr(&packed, unpacked); success = TRUE; -- cgit v1.2.3 From 17afb6dd6959a3df692a6a49e6370e81ebe00038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 22 Oct 2009 21:06:03 +0100 Subject: llvmpipe: Eliminate lp_build_store_rgba_aos. --- src/gallium/drivers/llvmpipe/lp_bld_format.h | 14 +---------- src/gallium/drivers/llvmpipe/lp_bld_format_aos.c | 32 +----------------------- src/gallium/drivers/llvmpipe/lp_test_format.c | 19 ++++++++++---- 3 files changed, 16 insertions(+), 49 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_format.h b/src/gallium/drivers/llvmpipe/lp_bld_format.h index b30537b2e9..42ee3c7d90 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_format.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_format.h @@ -62,22 +62,10 @@ lp_build_unpack_rgba_aos(LLVMBuilderRef builder, */ LLVMValueRef lp_build_pack_rgba_aos(LLVMBuilderRef builder, - enum pipe_format format, + const struct util_format_description *desc, LLVMValueRef rgba); -/** - * Store a pixel. - * - * @param rgba 4 float vector with the unpacked components. - */ -void -lp_build_store_rgba_aos(LLVMBuilderRef builder, - enum pipe_format format, - LLVMValueRef ptr, - LLVMValueRef rgba); - - void lp_build_unpack_rgba_soa(LLVMBuilderRef builder, const struct util_format_description *format_desc, diff --git a/src/gallium/drivers/llvmpipe/lp_bld_format_aos.c b/src/gallium/drivers/llvmpipe/lp_bld_format_aos.c index 840e54e558..0591d77860 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_format_aos.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_format_aos.c @@ -150,10 +150,9 @@ lp_build_unpack_rgba_aos(LLVMBuilderRef builder, LLVMValueRef lp_build_pack_rgba_aos(LLVMBuilderRef builder, - enum pipe_format format, + const struct util_format_description *desc, LLVMValueRef rgba) { - const struct util_format_description *desc; LLVMTypeRef type; LLVMValueRef packed = NULL; LLVMValueRef swizzles[4]; @@ -164,8 +163,6 @@ lp_build_pack_rgba_aos(LLVMBuilderRef builder, unsigned shift; unsigned i, j; - desc = util_format_description(format); - assert(desc->layout == UTIL_FORMAT_LAYOUT_ARITH); assert(desc->block.width == 1); assert(desc->block.height == 1); @@ -244,30 +241,3 @@ lp_build_pack_rgba_aos(LLVMBuilderRef builder, return packed; } - - -void -lp_build_store_rgba_aos(LLVMBuilderRef builder, - enum pipe_format format, - LLVMValueRef ptr, - LLVMValueRef rgba) -{ - const struct util_format_description *desc; - LLVMTypeRef type; - LLVMValueRef packed; - - desc = util_format_description(format); - - assert(desc->layout == UTIL_FORMAT_LAYOUT_ARITH); - assert(desc->block.width == 1); - assert(desc->block.height == 1); - - type = LLVMIntType(desc->block.bits); - - packed = lp_build_pack_rgba_aos(builder, format, rgba); - - ptr = LLVMBuildBitCast(builder, ptr, LLVMPointerType(type, 0), ""); - - LLVMBuildStore(builder, packed, ptr); -} - diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c index 6e501195f8..0fe47426f6 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_format.c +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c @@ -133,27 +133,31 @@ add_load_rgba_test(LLVMModuleRef module, } -typedef void (*store_ptr_t)(void *, const float *); +typedef void (*store_ptr_t)(uint32_t *, const float *); static LLVMValueRef add_store_rgba_test(LLVMModuleRef module, enum pipe_format format) { + const struct util_format_description *desc; LLVMTypeRef args[2]; LLVMValueRef func; - LLVMValueRef ptr; + LLVMValueRef packed_ptr; LLVMValueRef rgba_ptr; LLVMBasicBlockRef block; LLVMBuilderRef builder; LLVMValueRef rgba; + LLVMValueRef packed; + + desc = util_format_description(format); - args[0] = LLVMPointerType(LLVMInt8Type(), 0); + args[0] = LLVMPointerType(LLVMInt32Type(), 0); args[1] = LLVMPointerType(LLVMVectorType(LLVMFloatType(), 4), 0); func = LLVMAddFunction(module, "store", LLVMFunctionType(LLVMVoidType(), args, 2, 0)); LLVMSetFunctionCallConv(func, LLVMCCallConv); - ptr = LLVMGetParam(func, 0); + packed_ptr = LLVMGetParam(func, 0); rgba_ptr = LLVMGetParam(func, 1); block = LLVMAppendBasicBlock(func, "entry"); @@ -162,7 +166,12 @@ add_store_rgba_test(LLVMModuleRef module, rgba = LLVMBuildLoad(builder, rgba_ptr, ""); - lp_build_store_rgba_aos(builder, format, ptr, rgba); + packed = lp_build_pack_rgba_aos(builder, desc, rgba); + + if(desc->block.bits < 32) + packed = LLVMBuildZExt(builder, packed, LLVMInt32Type(), ""); + + LLVMBuildStore(builder, packed, packed_ptr); LLVMBuildRetVoid(builder); -- cgit v1.2.3 From fedd054d534206a5ebd6fed204aa97cbb5053b3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 22 Oct 2009 21:16:26 +0100 Subject: llvmpipe: Share testing infrastructure with lp_test_format. --- src/gallium/drivers/llvmpipe/SConscript | 2 +- src/gallium/drivers/llvmpipe/lp_test_format.c | 67 ++++++++++++++++++--------- 2 files changed, 46 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/SConscript b/src/gallium/drivers/llvmpipe/SConscript index 72e445b881..169e0abc2b 100644 --- a/src/gallium/drivers/llvmpipe/SConscript +++ b/src/gallium/drivers/llvmpipe/SConscript @@ -77,7 +77,7 @@ env.Prepend(LIBS = [llvmpipe] + auxiliaries) env.Program( target = 'lp_test_format', - source = ['lp_test_format.c'], + source = ['lp_test_format.c', 'lp_test_main.c'], ) env.Program( diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c index 0fe47426f6..b2403ad521 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_format.c +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c @@ -39,6 +39,7 @@ #include "util/u_format.h" #include "lp_bld_format.h" +#include "lp_test.h" struct pixel_test_case @@ -89,14 +90,37 @@ struct pixel_test_case test_cases[] = }; +void +write_tsv_header(FILE *fp) +{ + fprintf(fp, + "result\t" + "format\n"); + + fflush(fp); +} + + +static void +write_tsv_row(FILE *fp, + const struct util_format_description *desc, + boolean success) +{ + fprintf(fp, "%s\t", success ? "pass" : "fail"); + + fprintf(fp, "%s\n", desc->name); + + fflush(fp); +} + + typedef void (*load_ptr_t)(const uint32_t packed, float *); static LLVMValueRef add_load_rgba_test(LLVMModuleRef module, - enum pipe_format format) + const struct util_format_description *desc) { - const struct util_format_description *desc; LLVMTypeRef args[2]; LLVMValueRef func; LLVMValueRef packed; @@ -105,8 +129,6 @@ add_load_rgba_test(LLVMModuleRef module, LLVMBuilderRef builder; LLVMValueRef rgba; - desc = util_format_description(format); - args[0] = LLVMInt32Type(); args[1] = LLVMPointerType(LLVMVectorType(LLVMFloatType(), 4), 0); @@ -138,9 +160,8 @@ typedef void (*store_ptr_t)(uint32_t *, const float *); static LLVMValueRef add_store_rgba_test(LLVMModuleRef module, - enum pipe_format format) + const struct util_format_description *desc) { - const struct util_format_description *desc; LLVMTypeRef args[2]; LLVMValueRef func; LLVMValueRef packed_ptr; @@ -150,8 +171,6 @@ add_store_rgba_test(LLVMModuleRef module, LLVMValueRef rgba; LLVMValueRef packed; - desc = util_format_description(format); - args[0] = LLVMPointerType(LLVMInt32Type(), 0); args[1] = LLVMPointerType(LLVMVectorType(LLVMFloatType(), 4), 0); @@ -181,7 +200,7 @@ add_store_rgba_test(LLVMModuleRef module, static boolean -test_format(const struct pixel_test_case *test) +test_format(unsigned verbose, FILE *fp, const struct pixel_test_case *test) { LLVMModuleRef module = NULL; LLVMValueRef load = NULL; @@ -203,8 +222,8 @@ test_format(const struct pixel_test_case *test) module = LLVMModuleCreateWithName("test"); - load = add_load_rgba_test(module, test->format); - store = add_store_rgba_test(module, test->format); + load = add_load_rgba_test(module, desc); + store = add_store_rgba_test(module, desc); if(LLVMVerifyModule(module, LLVMPrintMessageAction, &error)) { LLVMDumpModule(module); @@ -266,25 +285,29 @@ test_format(const struct pixel_test_case *test) if(pass) LLVMDisposePassManager(pass); + if(fp) + write_tsv_row(fp, desc, success); + return success; } -int main(int argc, char **argv) +boolean +test_all(unsigned verbose, FILE *fp) { unsigned i; - int ret; + bool success = TRUE; -#ifdef LLVM_NATIVE_ARCH - LLVMLinkInJIT(); - LLVMInitializeNativeTarget(); -#endif + for (i = 0; i < sizeof(test_cases)/sizeof(test_cases[0]); ++i) + if(!test_format(verbose, fp, &test_cases[i])) + success = FALSE; - util_cpu_detect(); + return success; +} - for (i = 0; i < sizeof(test_cases)/sizeof(test_cases[0]); ++i) - if(!test_format(&test_cases[i])) - ret = 1; - return ret; +boolean +test_some(unsigned verbose, FILE *fp, unsigned long n) +{ + return test_all(verbose, fp); } -- cgit v1.2.3 From bc93e9181cf179a797679d30cd1a3a563e1756c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 22 Oct 2009 22:37:06 +0100 Subject: llvmpipe: Factor our pixel offset computation. --- src/gallium/drivers/llvmpipe/lp_bld_sample.c | 66 ++++++++++++++++++++++++ src/gallium/drivers/llvmpipe/lp_bld_sample.h | 11 ++++ src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c | 49 +++--------------- 3 files changed, 83 insertions(+), 43 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_sample.c b/src/gallium/drivers/llvmpipe/lp_bld_sample.c index b0543f22c9..4d272bea87 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_sample.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_sample.c @@ -37,6 +37,9 @@ #include "util/u_format.h" #include "util/u_math.h" #include "lp_bld_debug.h" +#include "lp_bld_const.h" +#include "lp_bld_arit.h" +#include "lp_bld_type.h" #include "lp_bld_format.h" #include "lp_bld_sample.h" @@ -122,3 +125,66 @@ lp_build_gather(LLVMBuilderRef builder, return res; } + + +/** + * Compute the offset of a pixel. + * + * x, y, y_stride are vectors + */ +LLVMValueRef +lp_build_sample_offset(struct lp_build_context *bld, + const struct util_format_description *format_desc, + LLVMValueRef x, + LLVMValueRef y, + LLVMValueRef y_stride, + LLVMValueRef data_ptr) +{ + LLVMValueRef x_stride; + LLVMValueRef offset; + + x_stride = lp_build_const_scalar(bld->type, format_desc->block.bits/8); + + if(format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) { + LLVMValueRef x_lo, x_hi; + LLVMValueRef y_lo, y_hi; + LLVMValueRef x_stride_lo, x_stride_hi; + LLVMValueRef y_stride_lo, y_stride_hi; + LLVMValueRef x_offset_lo, x_offset_hi; + LLVMValueRef y_offset_lo, y_offset_hi; + LLVMValueRef offset_lo, offset_hi; + + x_lo = LLVMBuildAnd(bld->builder, x, bld->one, ""); + y_lo = LLVMBuildAnd(bld->builder, y, bld->one, ""); + + x_hi = LLVMBuildLShr(bld->builder, x, bld->one, ""); + y_hi = LLVMBuildLShr(bld->builder, y, bld->one, ""); + + x_stride_lo = x_stride; + y_stride_lo = lp_build_const_scalar(bld->type, 2*format_desc->block.bits/8); + + x_stride_hi = lp_build_const_scalar(bld->type, 4*format_desc->block.bits/8); + y_stride_hi = LLVMBuildShl(bld->builder, y_stride, bld->one, ""); + + x_offset_lo = lp_build_mul(bld, x_lo, x_stride_lo); + y_offset_lo = lp_build_mul(bld, y_lo, y_stride_lo); + offset_lo = lp_build_add(bld, x_offset_lo, y_offset_lo); + + x_offset_hi = lp_build_mul(bld, x_hi, x_stride_hi); + y_offset_hi = lp_build_mul(bld, y_hi, y_stride_hi); + offset_hi = lp_build_add(bld, x_offset_hi, y_offset_hi); + + offset = lp_build_add(bld, offset_hi, offset_lo); + } + else { + LLVMValueRef x_offset; + LLVMValueRef y_offset; + + x_offset = lp_build_mul(bld, x, x_stride); + y_offset = lp_build_mul(bld, y, y_stride); + + offset = lp_build_add(bld, x_offset, y_offset); + } + + return offset; +} diff --git a/src/gallium/drivers/llvmpipe/lp_bld_sample.h b/src/gallium/drivers/llvmpipe/lp_bld_sample.h index 2b56179eb8..8cb8210ca7 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_sample.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_sample.h @@ -40,7 +40,9 @@ struct pipe_texture; struct pipe_sampler_state; +struct util_format_description; struct lp_type; +struct lp_build_context; /** @@ -128,6 +130,15 @@ lp_build_gather(LLVMBuilderRef builder, LLVMValueRef offsets); +LLVMValueRef +lp_build_sample_offset(struct lp_build_context *bld, + const struct util_format_description *format_desc, + LLVMValueRef x, + LLVMValueRef y, + LLVMValueRef y_stride, + LLVMValueRef data_ptr); + + void lp_build_sample_soa(LLVMBuilderRef builder, const struct lp_sampler_static_state *static_state, diff --git a/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c index 4af0454935..6aa7ad4b45 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c @@ -106,51 +106,14 @@ lp_build_sample_texel(struct lp_build_sample_context *bld, LLVMValueRef *texel) { struct lp_build_context *int_coord_bld = &bld->int_coord_bld; - LLVMValueRef x_stride; LLVMValueRef offset; - x_stride = lp_build_const_scalar(bld->int_coord_type, bld->format_desc->block.bits/8); - - if(bld->format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) { - LLVMValueRef x_lo, x_hi; - LLVMValueRef y_lo, y_hi; - LLVMValueRef x_stride_lo, x_stride_hi; - LLVMValueRef y_stride_lo, y_stride_hi; - LLVMValueRef x_offset_lo, x_offset_hi; - LLVMValueRef y_offset_lo, y_offset_hi; - LLVMValueRef offset_lo, offset_hi; - - x_lo = LLVMBuildAnd(bld->builder, x, int_coord_bld->one, ""); - y_lo = LLVMBuildAnd(bld->builder, y, int_coord_bld->one, ""); - - x_hi = LLVMBuildLShr(bld->builder, x, int_coord_bld->one, ""); - y_hi = LLVMBuildLShr(bld->builder, y, int_coord_bld->one, ""); - - x_stride_lo = x_stride; - y_stride_lo = lp_build_const_scalar(bld->int_coord_type, 2*bld->format_desc->block.bits/8); - - x_stride_hi = lp_build_const_scalar(bld->int_coord_type, 4*bld->format_desc->block.bits/8); - y_stride_hi = LLVMBuildShl(bld->builder, y_stride, int_coord_bld->one, ""); - - x_offset_lo = lp_build_mul(int_coord_bld, x_lo, x_stride_lo); - y_offset_lo = lp_build_mul(int_coord_bld, y_lo, y_stride_lo); - offset_lo = lp_build_add(int_coord_bld, x_offset_lo, y_offset_lo); - - x_offset_hi = lp_build_mul(int_coord_bld, x_hi, x_stride_hi); - y_offset_hi = lp_build_mul(int_coord_bld, y_hi, y_stride_hi); - offset_hi = lp_build_add(int_coord_bld, x_offset_hi, y_offset_hi); - - offset = lp_build_add(int_coord_bld, offset_hi, offset_lo); - } - else { - LLVMValueRef x_offset; - LLVMValueRef y_offset; - - x_offset = lp_build_mul(int_coord_bld, x, x_stride); - y_offset = lp_build_mul(int_coord_bld, y, y_stride); - - offset = lp_build_add(int_coord_bld, x_offset, y_offset); - } + offset = lp_build_sample_offset(&bld->int_coord_bld, + bld->format_desc, + x, + y, + y_stride, + data_ptr); lp_build_load_rgba_soa(bld->builder, bld->format_desc, -- cgit v1.2.3 From a55b305c5b3be3fed8112d44878e712cf09303ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 22 Oct 2009 22:44:32 +0100 Subject: llvmpipe: Merge lp_build_load_rgba_soa into lp_build_sample_texel. --- src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c | 48 ++++++++---------------- 1 file changed, 16 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c index 6aa7ad4b45..a7d2118c9b 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c @@ -75,28 +75,6 @@ struct lp_build_sample_context }; -static void -lp_build_load_rgba_soa(LLVMBuilderRef builder, - const struct util_format_description *format_desc, - struct lp_type type, - LLVMValueRef base_ptr, - LLVMValueRef offsets, - LLVMValueRef *rgba) -{ - LLVMValueRef packed; - - assert(format_desc->block.width == 1); - assert(format_desc->block.height == 1); - assert(format_desc->block.bits <= type.width); - - packed = lp_build_gather(builder, - type.length, format_desc->block.bits, type.width, - base_ptr, offsets); - - lp_build_unpack_rgba_soa(builder, format_desc, type, packed, rgba); -} - - static void lp_build_sample_texel(struct lp_build_sample_context *bld, LLVMValueRef x, @@ -105,22 +83,28 @@ lp_build_sample_texel(struct lp_build_sample_context *bld, LLVMValueRef data_ptr, LLVMValueRef *texel) { - struct lp_build_context *int_coord_bld = &bld->int_coord_bld; LLVMValueRef offset; + LLVMValueRef packed; offset = lp_build_sample_offset(&bld->int_coord_bld, bld->format_desc, - x, - y, - y_stride, + x, y, y_stride, data_ptr); - lp_build_load_rgba_soa(bld->builder, - bld->format_desc, - bld->texel_type, - data_ptr, - offset, - texel); + assert(bld->format_desc->block.width == 1); + assert(bld->format_desc->block.height == 1); + assert(bld->format_desc->block.bits <= bld->texel_type.width); + + packed = lp_build_gather(bld->builder, + bld->texel_type.length, + bld->format_desc->block.bits, + bld->texel_type.width, + data_ptr, offset); + + lp_build_unpack_rgba_soa(bld->builder, + bld->format_desc, + bld->texel_type, + packed, texel); } -- cgit v1.2.3 From b544ab72994a7eda1e8c17fa217213ff3713dd99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 25 Oct 2009 09:03:18 +0000 Subject: llvmpipe: Add inlines to quickly generate types matching the native SIMD register bitwidth. --- src/gallium/drivers/llvmpipe/lp_bld_type.h | 94 +++++++++++++++++++++++++++- src/gallium/drivers/llvmpipe/lp_test_blend.c | 20 +++--- 2 files changed, 102 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_type.h b/src/gallium/drivers/llvmpipe/lp_bld_type.h index 46c298fa20..2fb233d335 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_type.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_type.h @@ -42,14 +42,19 @@ #include +/** + * Native SIMD register width. + * + * 128 for all architectures we care about. + */ +#define LP_NATIVE_VECTOR_WIDTH 128 + /** * Several functions can only cope with vectors of length up to this value. * You may need to increase that value if you want to represent bigger vectors. */ #define LP_MAX_VECTOR_LENGTH 16 -#define LP_MAX_TYPE_WIDTH 64 - /** * The LLVM type system can't conveniently express all the things we care about @@ -134,6 +139,91 @@ struct lp_build_context }; +static INLINE struct lp_type +lp_type_float(unsigned width) +{ + struct lp_type res_type; + + memset(&res_type, 0, sizeof res_type); + res_type.floating = TRUE; + res_type.sign = TRUE; + res_type.width = width; + res_type.length = LP_NATIVE_VECTOR_WIDTH / width; + + return res_type; +} + + +static INLINE struct lp_type +lp_type_int(unsigned width) +{ + struct lp_type res_type; + + memset(&res_type, 0, sizeof res_type); + res_type.sign = TRUE; + res_type.width = width; + res_type.length = LP_NATIVE_VECTOR_WIDTH / width; + + return res_type; +} + + +static INLINE struct lp_type +lp_type_uint(unsigned width) +{ + struct lp_type res_type; + + memset(&res_type, 0, sizeof res_type); + res_type.width = width; + res_type.length = LP_NATIVE_VECTOR_WIDTH / width; + + return res_type; +} + + +static INLINE struct lp_type +lp_type_unorm(unsigned width) +{ + struct lp_type res_type; + + memset(&res_type, 0, sizeof res_type); + res_type.norm = TRUE; + res_type.width = width; + res_type.length = LP_NATIVE_VECTOR_WIDTH / width; + + return res_type; +} + + +static INLINE struct lp_type +lp_type_fixed(unsigned width) +{ + struct lp_type res_type; + + memset(&res_type, 0, sizeof res_type); + res_type.sign = TRUE; + res_type.fixed = TRUE; + res_type.width = width; + res_type.length = LP_NATIVE_VECTOR_WIDTH / width; + + return res_type; +} + + +static INLINE struct lp_type +lp_type_ufixed(unsigned width) +{ + struct lp_type res_type; + + memset(&res_type, 0, sizeof res_type); + res_type.fixed = TRUE; + res_type.width = width; + res_type.length = LP_NATIVE_VECTOR_WIDTH / width; + + return res_type; +} + + LLVMTypeRef lp_build_elem_type(struct lp_type type); diff --git a/src/gallium/drivers/llvmpipe/lp_test_blend.c b/src/gallium/drivers/llvmpipe/lp_test_blend.c index e3af81cffb..149fec1d54 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_blend.c +++ b/src/gallium/drivers/llvmpipe/lp_test_blend.c @@ -530,11 +530,11 @@ test_one(unsigned verbose, success = TRUE; for(i = 0; i < n && success; ++i) { if(mode == AoS) { - uint8_t src[LP_MAX_VECTOR_LENGTH*LP_MAX_TYPE_WIDTH/8]; - uint8_t dst[LP_MAX_VECTOR_LENGTH*LP_MAX_TYPE_WIDTH/8]; - uint8_t con[LP_MAX_VECTOR_LENGTH*LP_MAX_TYPE_WIDTH/8]; - uint8_t res[LP_MAX_VECTOR_LENGTH*LP_MAX_TYPE_WIDTH/8]; - uint8_t ref[LP_MAX_VECTOR_LENGTH*LP_MAX_TYPE_WIDTH/8]; + uint8_t src[LP_NATIVE_VECTOR_WIDTH/8]; + uint8_t dst[LP_NATIVE_VECTOR_WIDTH/8]; + uint8_t con[LP_NATIVE_VECTOR_WIDTH/8]; + uint8_t res[LP_NATIVE_VECTOR_WIDTH/8]; + uint8_t ref[LP_NATIVE_VECTOR_WIDTH/8]; int64_t start_counter = 0; int64_t end_counter = 0; @@ -595,11 +595,11 @@ test_one(unsigned verbose, if(mode == SoA) { const unsigned stride = type.length*type.width/8; - uint8_t src[4*LP_MAX_VECTOR_LENGTH*LP_MAX_TYPE_WIDTH/8]; - uint8_t dst[4*LP_MAX_VECTOR_LENGTH*LP_MAX_TYPE_WIDTH/8]; - uint8_t con[4*LP_MAX_VECTOR_LENGTH*LP_MAX_TYPE_WIDTH/8]; - uint8_t res[4*LP_MAX_VECTOR_LENGTH*LP_MAX_TYPE_WIDTH/8]; - uint8_t ref[4*LP_MAX_VECTOR_LENGTH*LP_MAX_TYPE_WIDTH/8]; + uint8_t src[4*LP_NATIVE_VECTOR_WIDTH/8]; + uint8_t dst[4*LP_NATIVE_VECTOR_WIDTH/8]; + uint8_t con[4*LP_NATIVE_VECTOR_WIDTH/8]; + uint8_t res[4*LP_NATIVE_VECTOR_WIDTH/8]; + uint8_t ref[4*LP_NATIVE_VECTOR_WIDTH/8]; int64_t start_counter = 0; int64_t end_counter = 0; boolean mismatch; -- cgit v1.2.3 From 8d80fd3f554cab2db962a903ce4eaba7c8fed7ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 25 Oct 2009 09:03:50 +0000 Subject: llvmpipe: Allow different signs when unpacking. --- src/gallium/drivers/llvmpipe/lp_bld_pack.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_pack.c b/src/gallium/drivers/llvmpipe/lp_bld_pack.c index fe82fda039..bc360ad77a 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_pack.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_pack.c @@ -159,11 +159,10 @@ lp_build_unpack2(LLVMBuilderRef builder, assert(!src_type.floating); assert(!dst_type.floating); - assert(dst_type.sign == src_type.sign); assert(dst_type.width == src_type.width * 2); assert(dst_type.length * 2 == src_type.length); - if(src_type.sign) { + if(dst_type.sign && src_type.sign) { /* Replicate the sign bit in the most significant bits */ msb = LLVMBuildAShr(builder, src, lp_build_int_const_scalar(src_type, src_type.width - 1), ""); } -- cgit v1.2.3 From abff4214ef870f26d5c64adac1235b9e9438a51e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 25 Oct 2009 09:06:05 +0000 Subject: llvmpipe: Split the format swizzling step from the unpacking. --- src/gallium/drivers/llvmpipe/lp_bld_format.h | 7 ++++ src/gallium/drivers/llvmpipe/lp_bld_format_soa.c | 43 +++++++++++++++--------- 2 files changed, 34 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_format.h b/src/gallium/drivers/llvmpipe/lp_bld_format.h index 42ee3c7d90..8b08c016c0 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_format.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_format.h @@ -42,6 +42,13 @@ struct util_format_description; struct lp_type; +void +lp_build_format_swizzle_soa(const struct util_format_description *format_desc, + struct lp_type type, + const LLVMValueRef *unswizzled, + LLVMValueRef *swizzled); + + /** * Unpack a pixel into its RGBA components. * diff --git a/src/gallium/drivers/llvmpipe/lp_bld_format_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_format_soa.c index 60ad4c0ee6..64151d169d 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_format_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_format_soa.c @@ -35,16 +35,16 @@ static LLVMValueRef -lp_build_format_swizzle(struct lp_type type, - const LLVMValueRef *inputs, - enum util_format_swizzle swizzle) +lp_build_format_swizzle_chan_soa(struct lp_type type, + const LLVMValueRef *unswizzled, + enum util_format_swizzle swizzle) { switch (swizzle) { case UTIL_FORMAT_SWIZZLE_X: case UTIL_FORMAT_SWIZZLE_Y: case UTIL_FORMAT_SWIZZLE_Z: case UTIL_FORMAT_SWIZZLE_W: - return inputs[swizzle]; + return unswizzled[swizzle]; case UTIL_FORMAT_SWIZZLE_0: return lp_build_zero(type); case UTIL_FORMAT_SWIZZLE_1: @@ -58,6 +58,28 @@ lp_build_format_swizzle(struct lp_type type, } +void +lp_build_format_swizzle_soa(const struct util_format_description *format_desc, + struct lp_type type, + const LLVMValueRef *unswizzled, + LLVMValueRef *swizzled) +{ + if(format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) { + enum util_format_swizzle swizzle = format_desc->swizzle[0]; + LLVMValueRef depth = lp_build_format_swizzle_chan_soa(type, unswizzled, swizzle); + swizzled[2] = swizzled[1] = swizzled[0] = depth; + swizzled[3] = lp_build_one(type); + } + else { + unsigned chan; + for (chan = 0; chan < 4; ++chan) { + enum util_format_swizzle swizzle = format_desc->swizzle[chan]; + swizzled[chan] = lp_build_format_swizzle_chan_soa(type, unswizzled, swizzle); + } + } +} + + void lp_build_unpack_rgba_soa(LLVMBuilderRef builder, const struct util_format_description *format_desc, @@ -123,16 +145,5 @@ lp_build_unpack_rgba_soa(LLVMBuilderRef builder, start = stop; } - if(format_desc->colorspace == UTIL_FORMAT_COLORSPACE_ZS) { - enum util_format_swizzle swizzle = format_desc->swizzle[0]; - LLVMValueRef depth = lp_build_format_swizzle(type, inputs, swizzle); - rgba[2] = rgba[1] = rgba[0] = depth; - rgba[3] = lp_build_one(type); - } - else { - for (chan = 0; chan < 4; ++chan) { - enum util_format_swizzle swizzle = format_desc->swizzle[chan]; - rgba[chan] = lp_build_format_swizzle(type, inputs, swizzle); - } - } + lp_build_format_swizzle_soa(format_desc, type, inputs, rgba); } -- cgit v1.2.3 From 47d241be9ff89b65b978dd4fe4ea7473e07fa2c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 25 Oct 2009 09:09:23 +0000 Subject: llvmpipe: New function to unpack rgba8 formats into 4 x u8n AoS. --- src/gallium/drivers/llvmpipe/lp_bld_format.h | 19 ++- src/gallium/drivers/llvmpipe/lp_bld_format_aos.c | 141 +++++++++++++++++++++++ 2 files changed, 148 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_format.h b/src/gallium/drivers/llvmpipe/lp_bld_format.h index 8b08c016c0..fa560576be 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_format.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_format.h @@ -49,24 +49,19 @@ lp_build_format_swizzle_soa(const struct util_format_description *format_desc, LLVMValueRef *swizzled); -/** - * Unpack a pixel into its RGBA components. - * - * @param packed integer. - * - * @return RGBA in a 4 floats vector. - */ LLVMValueRef lp_build_unpack_rgba_aos(LLVMBuilderRef builder, const struct util_format_description *desc, LLVMValueRef packed); -/** - * Pack a pixel. - * - * @param rgba 4 float vector with the unpacked components. - */ +LLVMValueRef +lp_build_unpack_rgba8_aos(LLVMBuilderRef builder, + const struct util_format_description *desc, + struct lp_type type, + LLVMValueRef packed); + + LLVMValueRef lp_build_pack_rgba_aos(LLVMBuilderRef builder, const struct util_format_description *desc, diff --git a/src/gallium/drivers/llvmpipe/lp_bld_format_aos.c b/src/gallium/drivers/llvmpipe/lp_bld_format_aos.c index 0591d77860..5836e0173f 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_format_aos.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_format_aos.c @@ -25,12 +25,34 @@ * **************************************************************************/ +/** + * @file + * AoS pixel format manipulation. + * + * @author Jose Fonseca + */ + +#include "util/u_cpu_detect.h" #include "util/u_format.h" +#include "lp_bld_type.h" +#include "lp_bld_const.h" +#include "lp_bld_logic.h" +#include "lp_bld_swizzle.h" #include "lp_bld_format.h" +/** + * Unpack a single pixel into its RGBA components. + * + * @param packed integer. + * + * @return RGBA in a 4 floats vector. + * + * XXX: This is mostly for reference and testing -- operating a single pixel at + * a time is rarely if ever needed. + */ LLVMValueRef lp_build_unpack_rgba_aos(LLVMBuilderRef builder, const struct util_format_description *desc, @@ -148,6 +170,125 @@ lp_build_unpack_rgba_aos(LLVMBuilderRef builder, } +/** + * Take a vector with packed pixels and unpack into a rgba8 vector. + * + * Formats with bit depth smaller than 32bits are accepted, but they must be + * padded to 32bits. + */ +LLVMValueRef +lp_build_unpack_rgba8_aos(LLVMBuilderRef builder, + const struct util_format_description *desc, + struct lp_type type, + LLVMValueRef packed) +{ + struct lp_build_context bld; + bool rgba8; + LLVMValueRef res; + unsigned i; + + lp_build_context_init(&bld, builder, type); + + /* FIXME: Support more formats */ + assert(desc->layout == UTIL_FORMAT_LAYOUT_ARITH); + assert(desc->block.width == 1); + assert(desc->block.height == 1); + assert(desc->block.bits <= 32); + + assert(!type.floating); + assert(!type.fixed); + assert(type.norm); + assert(type.width == 8); + assert(type.length % 4 == 0); + + rgba8 = TRUE; + for(i = 0; i < 4; ++i) { + assert(desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED || + desc->channel[i].type == UTIL_FORMAT_TYPE_VOID); + if(desc->channel[0].size != 8) + rgba8 = FALSE; + } + + if(rgba8) { + /* + * The pixel is already in a rgba8 format variant. All it is necessary + * is to swizzle the channels. + */ + + unsigned char swizzles[4]; + boolean zeros[4]; /* bitwise AND mask */ + boolean ones[4]; /* bitwise OR mask */ + boolean swizzles_needed = FALSE; + boolean zeros_needed = FALSE; + boolean ones_needed = FALSE; + + for(i = 0; i < 4; ++i) { + enum util_format_swizzle swizzle = desc->swizzle[i]; + + /* Initialize with the no-op case */ + swizzles[i] = util_cpu_caps.little_endian ? 3 - i : i; + zeros[i] = TRUE; + ones[i] = FALSE; + + switch (swizzle) { + case UTIL_FORMAT_SWIZZLE_X: + case UTIL_FORMAT_SWIZZLE_Y: + case UTIL_FORMAT_SWIZZLE_Z: + case UTIL_FORMAT_SWIZZLE_W: + if(swizzle != swizzles[i]) { + swizzles[i] = swizzle; + swizzles_needed = TRUE; + } + break; + case UTIL_FORMAT_SWIZZLE_0: + zeros[i] = FALSE; + zeros_needed = TRUE; + break; + case UTIL_FORMAT_SWIZZLE_1: + ones[i] = TRUE; + ones_needed = TRUE; + break; + case UTIL_FORMAT_SWIZZLE_NONE: + assert(0); + break; + } + } + + res = packed; + + if(swizzles_needed) + res = lp_build_swizzle1_aos(&bld, res, swizzles); + + if(zeros_needed) { + /* Mask out zero channels */ + LLVMValueRef mask = lp_build_const_mask_aos(type, zeros); + res = LLVMBuildAnd(builder, res, mask, ""); + } + + if(ones_needed) { + /* Or one channels */ + LLVMValueRef mask = lp_build_const_mask_aos(type, ones); + res = LLVMBuildOr(builder, res, mask, ""); + } + } + else { + /* FIXME */ + assert(0); + res = lp_build_undef(type); + } + + return res; +} + + +/** + * Pack a single pixel. + * + * @param rgba 4 float vector with the unpacked components. + * + * XXX: This is mostly for reference and testing -- operating a single pixel at + * a time is rarely if ever needed. + */ LLVMValueRef lp_build_pack_rgba_aos(LLVMBuilderRef builder, const struct util_format_description *desc, -- cgit v1.2.3 From bfd7a9ca967e5521fb3847db8615127c3ee7b9b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 25 Oct 2009 09:09:59 +0000 Subject: llvmpipe: New module to help make assertions about formats. --- src/gallium/drivers/llvmpipe/Makefile | 1 + src/gallium/drivers/llvmpipe/SConscript | 1 + src/gallium/drivers/llvmpipe/lp_bld_format.h | 4 ++ src/gallium/drivers/llvmpipe/lp_bld_format_query.c | 72 ++++++++++++++++++++++ 4 files changed, 78 insertions(+) create mode 100644 src/gallium/drivers/llvmpipe/lp_bld_format_query.c (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/Makefile b/src/gallium/drivers/llvmpipe/Makefile index ea771392b1..96c014e592 100644 --- a/src/gallium/drivers/llvmpipe/Makefile +++ b/src/gallium/drivers/llvmpipe/Makefile @@ -17,6 +17,7 @@ C_SOURCES = \ lp_bld_depth.c \ lp_bld_flow.c \ lp_bld_format_aos.c \ + lp_bld_format_query.c \ lp_bld_format_soa.c \ lp_bld_interp.c \ lp_bld_intr.c \ diff --git a/src/gallium/drivers/llvmpipe/SConscript b/src/gallium/drivers/llvmpipe/SConscript index 169e0abc2b..52983039fd 100644 --- a/src/gallium/drivers/llvmpipe/SConscript +++ b/src/gallium/drivers/llvmpipe/SConscript @@ -30,6 +30,7 @@ llvmpipe = env.ConvenienceLibrary( 'lp_bld_depth.c', 'lp_bld_flow.c', 'lp_bld_format_aos.c', + 'lp_bld_format_query.c', 'lp_bld_format_soa.c', 'lp_bld_interp.c', 'lp_bld_intr.c', diff --git a/src/gallium/drivers/llvmpipe/lp_bld_format.h b/src/gallium/drivers/llvmpipe/lp_bld_format.h index fa560576be..970bee379f 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_format.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_format.h @@ -42,6 +42,10 @@ struct util_format_description; struct lp_type; +boolean +lp_format_is_rgba8(const struct util_format_description *desc); + + void lp_build_format_swizzle_soa(const struct util_format_description *format_desc, struct lp_type type, diff --git a/src/gallium/drivers/llvmpipe/lp_bld_format_query.c b/src/gallium/drivers/llvmpipe/lp_bld_format_query.c new file mode 100644 index 0000000000..f3832d07ff --- /dev/null +++ b/src/gallium/drivers/llvmpipe/lp_bld_format_query.c @@ -0,0 +1,72 @@ +/************************************************************************** + * + * 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 + * Utility functions to make assertions about formats. + * + * This module centralizes most of logic used when determining what algorithm + * is most suitable (i.e., most efficient yet correct) for a given format. + * + * It might be possible to move some of these functions to u_format module, + * but since tiny differences in the format my render it more/less + * appropriate to a given algorithm it is impossible to make any long term + * guarantee about the semantics of these functions. + * + * @author Jose Fonseca + */ + + +#include "util/u_format.h" + +#include "lp_bld_format.h" + + +/** + * Whether this format is a 4 rgba8 variant + */ +boolean +lp_format_is_rgba8(const struct util_format_description *desc) +{ + unsigned chan; + + if(desc->block.width != 1 || + desc->block.height != 1 || + desc->block.bits != 32) + return FALSE; + + for(chan = 0; chan < 4; ++chan) { + if(desc->channel[chan].type != UTIL_FORMAT_TYPE_UNSIGNED && + desc->channel[chan].type != UTIL_FORMAT_TYPE_SIGNED && + desc->channel[chan].type != UTIL_FORMAT_TYPE_VOID) + return FALSE; + if(desc->channel[chan].size != 8) + return FALSE; + } + + return TRUE; +} -- cgit v1.2.3 From f3893ca9c8bfdba9323ef2fc179ac203e85eda70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 25 Oct 2009 09:16:38 +0000 Subject: llvmpipe: Make lerping work for 8.8 fixed point values. --- src/gallium/drivers/llvmpipe/lp_bld_arit.c | 54 +++++++++++++++++++++++++++--- 1 file changed, 50 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.c b/src/gallium/drivers/llvmpipe/lp_bld_arit.c index 83ca06acf8..93e797cb44 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_arit.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.c @@ -361,6 +361,8 @@ lp_build_mul(struct lp_build_context *bld, LLVMValueRef b) { const struct lp_type type = bld->type; + LLVMValueRef shift; + LLVMValueRef res; if(a == bld->zero) return bld->zero; @@ -394,10 +396,31 @@ lp_build_mul(struct lp_build_context *bld, assert(0); } - if(LLVMIsConstant(a) && LLVMIsConstant(b)) - return LLVMConstMul(a, b); + if(type.fixed) + shift = lp_build_int_const_scalar(type, type.width/2); + else + shift = NULL; + + if(LLVMIsConstant(a) && LLVMIsConstant(b)) { + res = LLVMConstMul(a, b); + if(shift) { + if(type.sign) + res = LLVMConstAShr(res, shift); + else + res = LLVMConstLShr(res, shift); + } + } + else { + res = LLVMBuildMul(bld->builder, a, b, ""); + if(shift) { + if(type.sign) + res = LLVMBuildAShr(bld->builder, res, shift, ""); + else + res = LLVMBuildLShr(bld->builder, res, shift, ""); + } + } - return LLVMBuildMul(bld->builder, a, b, ""); + return res; } @@ -432,13 +455,36 @@ lp_build_div(struct lp_build_context *bld, } +/** + * Linear interpolation. + * + * This also works for integer values with a few caveats. + * + * @sa http://www.stereopsis.com/doubleblend.html + */ LLVMValueRef lp_build_lerp(struct lp_build_context *bld, LLVMValueRef x, LLVMValueRef v0, LLVMValueRef v1) { - return lp_build_add(bld, v0, lp_build_mul(bld, x, lp_build_sub(bld, v1, v0))); + LLVMValueRef delta; + LLVMValueRef res; + + delta = lp_build_sub(bld, v1, v0); + + res = lp_build_mul(bld, x, delta); + + res = lp_build_add(bld, v0, res); + + if(bld->type.fixed) + /* XXX: This step is necessary for lerping 8bit colors stored on 16bits, + * but it will be wrong for other uses. Basically we need a more + * powerful lp_type, capable of further distinguishing the values + * interpretation from the value storage. */ + res = LLVMBuildAnd(bld->builder, res, lp_build_int_const_scalar(bld->type, (1 << bld->type.width/2) - 1), ""); + + return res; } -- cgit v1.2.3 From e1342f871b2ec1ed0293f564540d03aaa11b1720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 25 Oct 2009 09:51:57 +0000 Subject: llvmpipe: Fast path for sampling rgba8 textures with linear filtering. Implement Keith's suggestion of doing most of the sampling with 16x8 and 8x16 AoS, and only doing the conversion to floating point SoA at the very last step. Improves gloss performance by 10%. --- src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c | 268 ++++++++++++++++++++++- 1 file changed, 256 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c index a7d2118c9b..f7a030fb8c 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c @@ -38,12 +38,15 @@ #include "util/u_memory.h" #include "util/u_math.h" #include "util/u_format.h" +#include "util/u_cpu_detect.h" #include "lp_bld_debug.h" #include "lp_bld_type.h" #include "lp_bld_const.h" +#include "lp_bld_conv.h" #include "lp_bld_arit.h" #include "lp_bld_logic.h" #include "lp_bld_swizzle.h" +#include "lp_bld_pack.h" #include "lp_bld_format.h" #include "lp_bld_sample.h" @@ -76,12 +79,12 @@ struct lp_build_sample_context static void -lp_build_sample_texel(struct lp_build_sample_context *bld, - LLVMValueRef x, - LLVMValueRef y, - LLVMValueRef y_stride, - LLVMValueRef data_ptr, - LLVMValueRef *texel) +lp_build_sample_texel_soa(struct lp_build_sample_context *bld, + LLVMValueRef x, + LLVMValueRef y, + LLVMValueRef y_stride, + LLVMValueRef data_ptr, + LLVMValueRef *texel) { LLVMValueRef offset; LLVMValueRef packed; @@ -108,6 +111,32 @@ lp_build_sample_texel(struct lp_build_sample_context *bld, } +static LLVMValueRef +lp_build_sample_packed(struct lp_build_sample_context *bld, + LLVMValueRef x, + LLVMValueRef y, + LLVMValueRef y_stride, + LLVMValueRef data_ptr) +{ + LLVMValueRef offset; + + offset = lp_build_sample_offset(&bld->int_coord_bld, + bld->format_desc, + x, y, y_stride, + data_ptr); + + assert(bld->format_desc->block.width == 1); + assert(bld->format_desc->block.height == 1); + assert(bld->format_desc->block.bits <= bld->texel_type.width); + + return lp_build_gather(bld->builder, + bld->texel_type.length, + bld->format_desc->block.bits, + bld->texel_type.width, + data_ptr, offset); +} + + static LLVMValueRef lp_build_sample_wrap(struct lp_build_sample_context *bld, LLVMValueRef coord, @@ -174,7 +203,7 @@ lp_build_sample_2d_nearest_soa(struct lp_build_sample_context *bld, x = lp_build_sample_wrap(bld, x, width, bld->static_state->pot_width, bld->static_state->wrap_s); y = lp_build_sample_wrap(bld, y, height, bld->static_state->pot_height, bld->static_state->wrap_t); - lp_build_sample_texel(bld, x, y, stride, data_ptr, texel); + lp_build_sample_texel_soa(bld, x, y, stride, data_ptr, texel); } @@ -220,10 +249,10 @@ lp_build_sample_2d_linear_soa(struct lp_build_sample_context *bld, x1 = lp_build_sample_wrap(bld, x1, width, bld->static_state->pot_width, bld->static_state->wrap_s); y1 = lp_build_sample_wrap(bld, y1, height, bld->static_state->pot_height, bld->static_state->wrap_t); - lp_build_sample_texel(bld, x0, y0, stride, data_ptr, neighbors[0][0]); - lp_build_sample_texel(bld, x1, y0, stride, data_ptr, neighbors[0][1]); - lp_build_sample_texel(bld, x0, y1, stride, data_ptr, neighbors[1][0]); - lp_build_sample_texel(bld, x1, y1, stride, data_ptr, neighbors[1][1]); + lp_build_sample_texel_soa(bld, x0, y0, stride, data_ptr, neighbors[0][0]); + lp_build_sample_texel_soa(bld, x1, y0, stride, data_ptr, neighbors[0][1]); + lp_build_sample_texel_soa(bld, x0, y1, stride, data_ptr, neighbors[1][0]); + lp_build_sample_texel_soa(bld, x1, y1, stride, data_ptr, neighbors[1][1]); /* TODO: Don't interpolate missing channels */ for(chan = 0; chan < 4; ++chan) { @@ -237,6 +266,218 @@ lp_build_sample_2d_linear_soa(struct lp_build_sample_context *bld, } +static void +lp_build_rgba8_to_f32_soa(LLVMBuilderRef builder, + struct lp_type dst_type, + LLVMValueRef packed, + LLVMValueRef *rgba) +{ + LLVMValueRef mask = lp_build_int_const_scalar(dst_type, 0xff); + unsigned chan; + + /* Decode the input vector components */ + for (chan = 0; chan < 4; ++chan) { + unsigned start = chan*8; + unsigned stop = start + 8; + LLVMValueRef input; + + input = packed; + + if(start) + input = LLVMBuildLShr(builder, input, lp_build_int_const_scalar(dst_type, start), ""); + + if(stop < 32) + input = LLVMBuildAnd(builder, input, mask, ""); + + input = lp_build_unsigned_norm_to_float(builder, 8, dst_type, input); + + rgba[chan] = input; + } +} + + +static void +lp_build_sample_2d_linear_aos(struct lp_build_sample_context *bld, + LLVMValueRef s, + LLVMValueRef t, + LLVMValueRef width, + LLVMValueRef height, + LLVMValueRef stride, + LLVMValueRef data_ptr, + LLVMValueRef *texel) +{ + LLVMBuilderRef builder = bld->builder; + struct lp_build_context i32, h16, u8n; + LLVMTypeRef i32_vec_type, h16_vec_type, u8n_vec_type; + LLVMValueRef f32_c256, i32_c8, i32_c128, i32_c255; + LLVMValueRef s_ipart, s_fpart, s_fpart_lo, s_fpart_hi; + LLVMValueRef t_ipart, t_fpart, t_fpart_lo, t_fpart_hi; + LLVMValueRef x0, x1; + LLVMValueRef y0, y1; + LLVMValueRef neighbors[2][2]; + LLVMValueRef neighbors_lo[2][2]; + LLVMValueRef neighbors_hi[2][2]; + LLVMValueRef packed, packed_lo, packed_hi; + LLVMValueRef unswizzled[4]; + + lp_build_context_init(&i32, builder, lp_type_int(32)); + lp_build_context_init(&h16, builder, lp_type_ufixed(16)); + lp_build_context_init(&u8n, builder, lp_type_unorm(8)); + + i32_vec_type = lp_build_vec_type(i32.type); + h16_vec_type = lp_build_vec_type(h16.type); + u8n_vec_type = lp_build_vec_type(u8n.type); + + f32_c256 = lp_build_const_scalar(bld->coord_type, 256.0); + s = lp_build_mul(&bld->coord_bld, s, f32_c256); + t = lp_build_mul(&bld->coord_bld, t, f32_c256); + + s = LLVMBuildFPToSI(builder, s, i32_vec_type, ""); + t = LLVMBuildFPToSI(builder, t, i32_vec_type, ""); + + i32_c128 = lp_build_int_const_scalar(i32.type, -128); + s = LLVMBuildAdd(builder, s, i32_c128, ""); + t = LLVMBuildAdd(builder, t, i32_c128, ""); + + i32_c8 = lp_build_int_const_scalar(i32.type, 8); + s_ipart = LLVMBuildAShr(builder, s, i32_c8, ""); + t_ipart = LLVMBuildAShr(builder, t, i32_c8, ""); + + i32_c255 = lp_build_int_const_scalar(i32.type, 255); + s_fpart = LLVMBuildAnd(builder, s, i32_c255, ""); + t_fpart = LLVMBuildAnd(builder, t, i32_c255, ""); + + x0 = s_ipart; + y0 = t_ipart; + + x0 = lp_build_sample_wrap(bld, x0, width, bld->static_state->pot_width, bld->static_state->wrap_s); + y0 = lp_build_sample_wrap(bld, y0, height, bld->static_state->pot_height, bld->static_state->wrap_t); + + x1 = lp_build_add(&bld->int_coord_bld, x0, bld->int_coord_bld.one); + y1 = lp_build_add(&bld->int_coord_bld, y0, bld->int_coord_bld.one); + + x1 = lp_build_sample_wrap(bld, x1, width, bld->static_state->pot_width, bld->static_state->wrap_s); + y1 = lp_build_sample_wrap(bld, y1, height, bld->static_state->pot_height, bld->static_state->wrap_t); + + /* + * Transform 4 x i32 in + * + * s_fpart = {s0, s1, s2, s3} + * + * into 8 x i16 + * + * s_fpart = {00, s0, 00, s1, 00, s2, 00, s3} + * + * into two 8 x i16 + * + * s_fpart_lo = {s0, s0, s0, s0, s1, s1, s1, s1} + * s_fpart_hi = {s2, s2, s2, s2, s3, s3, s3, s3} + * + * and likewise for t_fpart. There is no risk of loosing precision here + * since the fractional parts only use the lower 8bits. + */ + + s_fpart = LLVMBuildBitCast(builder, s_fpart, h16_vec_type, ""); + t_fpart = LLVMBuildBitCast(builder, t_fpart, h16_vec_type, ""); + + { + LLVMTypeRef elem_type = LLVMInt32Type(); + LLVMValueRef shuffles_lo[LP_MAX_VECTOR_LENGTH]; + LLVMValueRef shuffles_hi[LP_MAX_VECTOR_LENGTH]; + LLVMValueRef shuffle_lo; + LLVMValueRef shuffle_hi; + unsigned i, j; + + for(j = 0; j < h16.type.length; j += 4) { + unsigned subindex = util_cpu_caps.little_endian ? 0 : 1; + LLVMValueRef index; + + index = LLVMConstInt(elem_type, j/2 + subindex, 0); + for(i = 0; i < 4; ++i) + shuffles_lo[j + i] = index; + + index = LLVMConstInt(elem_type, h16.type.length/2 + j/2 + subindex, 0); + for(i = 0; i < 4; ++i) + shuffles_hi[j + i] = index; + } + + shuffle_lo = LLVMConstVector(shuffles_lo, h16.type.length); + shuffle_hi = LLVMConstVector(shuffles_hi, h16.type.length); + + s_fpart_lo = LLVMBuildShuffleVector(builder, s_fpart, h16.undef, shuffle_lo, ""); + t_fpart_lo = LLVMBuildShuffleVector(builder, t_fpart, h16.undef, shuffle_lo, ""); + s_fpart_hi = LLVMBuildShuffleVector(builder, s_fpart, h16.undef, shuffle_hi, ""); + t_fpart_hi = LLVMBuildShuffleVector(builder, t_fpart, h16.undef, shuffle_hi, ""); + } + + /* + * Fetch the pixels as 4 x 32bit (rgba order might differ): + * + * rgba0 rgba1 rgba2 rgba3 + * + * bit cast them into 16 x u8 + * + * r0 g0 b0 a0 r1 g1 b1 a1 r2 g2 b2 a2 r3 g3 b3 a3 + * + * unpack them into two 8 x i16: + * + * r0 g0 b0 a0 r1 g1 b1 a1 + * r2 g2 b2 a2 r3 g3 b3 a3 + * + * The higher 8 bits of the resulting elements will be zero. + */ + + neighbors[0][0] = lp_build_sample_packed(bld, x0, y0, stride, data_ptr); + neighbors[0][1] = lp_build_sample_packed(bld, x1, y0, stride, data_ptr); + neighbors[1][0] = lp_build_sample_packed(bld, x0, y1, stride, data_ptr); + neighbors[1][1] = lp_build_sample_packed(bld, x1, y1, stride, data_ptr); + + neighbors[0][0] = LLVMBuildBitCast(builder, neighbors[0][0], u8n_vec_type, ""); + neighbors[0][1] = LLVMBuildBitCast(builder, neighbors[0][1], u8n_vec_type, ""); + neighbors[1][0] = LLVMBuildBitCast(builder, neighbors[1][0], u8n_vec_type, ""); + neighbors[1][1] = LLVMBuildBitCast(builder, neighbors[1][1], u8n_vec_type, ""); + + lp_build_unpack2(builder, u8n.type, h16.type, neighbors[0][0], &neighbors_lo[0][0], &neighbors_hi[0][0]); + lp_build_unpack2(builder, u8n.type, h16.type, neighbors[0][1], &neighbors_lo[0][1], &neighbors_hi[0][1]); + lp_build_unpack2(builder, u8n.type, h16.type, neighbors[1][0], &neighbors_lo[1][0], &neighbors_hi[1][0]); + lp_build_unpack2(builder, u8n.type, h16.type, neighbors[1][1], &neighbors_lo[1][1], &neighbors_hi[1][1]); + + /* + * Linear interpolate with 8.8 fixed point. + */ + + packed_lo = lp_build_lerp_2d(&h16, + s_fpart_lo, t_fpart_lo, + neighbors_lo[0][0], + neighbors_lo[0][1], + neighbors_lo[1][0], + neighbors_lo[1][1]); + + packed_hi = lp_build_lerp_2d(&h16, + s_fpart_hi, t_fpart_hi, + neighbors_hi[0][0], + neighbors_hi[0][1], + neighbors_hi[1][0], + neighbors_hi[1][1]); + + packed = lp_build_pack2(builder, h16.type, u8n.type, packed_lo, packed_hi); + + /* + * Convert to SoA and swizzle. + */ + + packed = LLVMBuildBitCast(builder, packed, i32_vec_type, ""); + + lp_build_rgba8_to_f32_soa(bld->builder, + bld->texel_type, + packed, unswizzled); + + lp_build_format_swizzle_soa(bld->format_desc, + bld->texel_type, unswizzled, + texel); +} + + static void lp_build_sample_compare(struct lp_build_sample_context *bld, LLVMValueRef p, @@ -336,7 +577,10 @@ lp_build_sample_soa(LLVMBuilderRef builder, break; case PIPE_TEX_FILTER_LINEAR: case PIPE_TEX_FILTER_ANISO: - lp_build_sample_2d_linear_soa(&bld, s, t, width, height, stride, data_ptr, texel); + if(lp_format_is_rgba8(bld.format_desc)) + lp_build_sample_2d_linear_aos(&bld, s, t, width, height, stride, data_ptr, texel); + else + lp_build_sample_2d_linear_soa(&bld, s, t, width, height, stride, data_ptr, texel); break; default: assert(0); -- cgit v1.2.3 From e4c5e01c109e51baaad23e90d08e8543b0fd6c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 25 Oct 2009 11:48:17 +0000 Subject: llvmpipe: Immediate multiplication. --- src/gallium/drivers/llvmpipe/lp_bld_arit.c | 54 ++++++++++++++++++++++++ src/gallium/drivers/llvmpipe/lp_bld_arit.h | 5 +++ src/gallium/drivers/llvmpipe/lp_bld_interp.c | 30 +------------ src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c | 7 ++- 4 files changed, 64 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.c b/src/gallium/drivers/llvmpipe/lp_bld_arit.c index 93e797cb44..9c59677a74 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_arit.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.c @@ -47,6 +47,7 @@ #include "util/u_memory.h" #include "util/u_debug.h" +#include "util/u_math.h" #include "util/u_string.h" #include "util/u_cpu_detect.h" @@ -424,6 +425,59 @@ lp_build_mul(struct lp_build_context *bld, } +/** + * Small vector x scale multiplication optimization. + */ +LLVMValueRef +lp_build_mul_imm(struct lp_build_context *bld, + LLVMValueRef a, + int b) +{ + LLVMValueRef factor; + + if(b == 0) + return bld->zero; + + if(b == 1) + return a; + + if(b == -1) + return LLVMBuildNeg(bld->builder, a, ""); + + if(b == 2 && bld->type.floating) + return lp_build_add(bld, a, a); + + if(util_is_pot(b)) { + unsigned shift = ffs(b) - 1; + + if(bld->type.floating) { +#if 0 + /* + * Power of two multiplication by directly manipulating the mantissa. + * + * XXX: This might not be always faster, it will introduce a small error + * for multiplication by zero, and it will produce wrong results + * for Inf and NaN. + */ + unsigned mantissa = lp_mantissa(bld->type); + factor = lp_build_int_const_scalar(bld->type, (unsigned long long)shift << mantissa); + a = LLVMBuildBitCast(bld->builder, a, lp_build_int_vec_type(bld->type), ""); + a = LLVMBuildAdd(bld->builder, a, factor, ""); + a = LLVMBuildBitCast(bld->builder, a, lp_build_vec_type(bld->type), ""); + return a; +#endif + } + else { + factor = lp_build_const_scalar(bld->type, shift); + return LLVMBuildShl(bld->builder, a, factor, ""); + } + } + + factor = lp_build_const_scalar(bld->type, (double)b); + return lp_build_mul(bld, a, factor); +} + + /** * Generate a / b */ diff --git a/src/gallium/drivers/llvmpipe/lp_bld_arit.h b/src/gallium/drivers/llvmpipe/lp_bld_arit.h index 4e568c055e..62be4b9aee 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_arit.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_arit.h @@ -66,6 +66,11 @@ lp_build_mul(struct lp_build_context *bld, LLVMValueRef a, LLVMValueRef b); +LLVMValueRef +lp_build_mul_imm(struct lp_build_context *bld, + LLVMValueRef a, + int b); + LLVMValueRef lp_build_div(struct lp_build_context *bld, LLVMValueRef a, diff --git a/src/gallium/drivers/llvmpipe/lp_bld_interp.c b/src/gallium/drivers/llvmpipe/lp_bld_interp.c index 338dbca6d1..818c0e943e 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_interp.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_interp.c @@ -108,32 +108,6 @@ coeffs_init(struct lp_build_interp_soa_context *bld, } -/** - * Small vector x scale multiplication optimization. - * - * TODO: Should be elsewhere. - */ -static LLVMValueRef -coeff_multiply(struct lp_build_interp_soa_context *bld, - LLVMValueRef coeff, - int step) -{ - LLVMValueRef factor; - - switch(step) { - case 0: - return bld->base.zero; - case 1: - return coeff; - case 2: - return lp_build_add(&bld->base, coeff, coeff); - default: - factor = lp_build_const_scalar(bld->base.type, (double)step); - return lp_build_mul(&bld->base, coeff, factor); - } -} - - /** * Multiply the dadx and dady with the xstep and ystep respectively. */ @@ -149,8 +123,8 @@ coeffs_update(struct lp_build_interp_soa_context *bld) if (mode != TGSI_INTERPOLATE_CONSTANT) { for(chan = 0; chan < NUM_CHANNELS; ++chan) { if(mask & (1 << chan)) { - bld->dadx[attrib][chan] = coeff_multiply(bld, bld->dadx[attrib][chan], bld->xstep); - bld->dady[attrib][chan] = coeff_multiply(bld, bld->dady[attrib][chan], bld->ystep); + bld->dadx[attrib][chan] = lp_build_mul_imm(&bld->base, bld->dadx[attrib][chan], bld->xstep); + bld->dady[attrib][chan] = lp_build_mul_imm(&bld->base, bld->dady[attrib][chan], bld->ystep); } } } diff --git a/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c index f7a030fb8c..42e4ee6986 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c @@ -309,7 +309,7 @@ lp_build_sample_2d_linear_aos(struct lp_build_sample_context *bld, LLVMBuilderRef builder = bld->builder; struct lp_build_context i32, h16, u8n; LLVMTypeRef i32_vec_type, h16_vec_type, u8n_vec_type; - LLVMValueRef f32_c256, i32_c8, i32_c128, i32_c255; + LLVMValueRef i32_c8, i32_c128, i32_c255; LLVMValueRef s_ipart, s_fpart, s_fpart_lo, s_fpart_hi; LLVMValueRef t_ipart, t_fpart, t_fpart_lo, t_fpart_hi; LLVMValueRef x0, x1; @@ -328,9 +328,8 @@ lp_build_sample_2d_linear_aos(struct lp_build_sample_context *bld, h16_vec_type = lp_build_vec_type(h16.type); u8n_vec_type = lp_build_vec_type(u8n.type); - f32_c256 = lp_build_const_scalar(bld->coord_type, 256.0); - s = lp_build_mul(&bld->coord_bld, s, f32_c256); - t = lp_build_mul(&bld->coord_bld, t, f32_c256); + s = lp_build_mul_imm(&bld->coord_bld, s, 256); + t = lp_build_mul_imm(&bld->coord_bld, t, 256); s = LLVMBuildFPToSI(builder, s, i32_vec_type, ""); t = LLVMBuildFPToSI(builder, t, i32_vec_type, ""); -- cgit v1.2.3 From 5fcb75758c50bd10e8bd730e55bcbf73614eeb60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 25 Oct 2009 11:49:01 +0000 Subject: llvmpipe: Dump the sampler state of the shader key. --- src/gallium/drivers/llvmpipe/lp_state_fs.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 7728ba6076..530a2d448c 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -400,6 +400,7 @@ generate_fragment(struct llvmpipe_context *lp, #ifdef DEBUG tgsi_dump(shader->base.tokens, 0); if(key->depth.enabled) { + debug_printf("depth.format = %s\n", pf_name(key->zsbuf_format)); debug_printf("depth.func = %s\n", debug_dump_func(key->depth.func, TRUE)); debug_printf("depth.writemask = %u\n", key->depth.writemask); } @@ -419,6 +420,23 @@ generate_fragment(struct llvmpipe_context *lp, debug_printf("alpha_dst_factor = %s\n", debug_dump_blend_factor(key->blend.alpha_dst_factor, TRUE)); } debug_printf("blend.colormask = 0x%x\n", key->blend.colormask); + for(i = 0; i < PIPE_MAX_SAMPLERS; ++i) { + if(key->sampler[i].format) { + debug_printf("sampler[%u] = \n", i); + debug_printf(" .format = %s\n", pf_name(key->sampler[i].format)); + debug_printf(" .target = %u\n", key->sampler[i].target); + debug_printf(" .pot = %u%u%u\n", key->sampler[i].pot_width, key->sampler[i].pot_height, key->sampler[i].pot_depth); + debug_printf(" .wrap = %u %u %u\n", key->sampler[i].wrap_s, key->sampler[i].wrap_t, key->sampler[i].wrap_r); + debug_printf(" .min_img_filter = %u\n", key->sampler[i].min_img_filter); + debug_printf(" .min_mip_filter = %u\n", key->sampler[i].min_mip_filter); + debug_printf(" .mag_img_filter = %u\n", key->sampler[i].mag_img_filter); + if(key->sampler[i].compare_mode) + debug_printf(" .compare_mode = %s\n", debug_dump_blend_func(key->sampler[i].compare_func, TRUE)); + debug_printf(" .normalized_coords = %u\n", key->sampler[i].normalized_coords); + debug_printf(" .prefilter = %u\n", key->sampler[i].prefilter); + } + } + #endif variant = CALLOC_STRUCT(lp_fragment_shader_variant); -- cgit v1.2.3 From 47f0529806cff6be84ce4d3637aad4f2e3e0693a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 25 Oct 2009 12:26:39 +0000 Subject: util: Human readable output of texture states. --- src/gallium/auxiliary/util/u_debug_dump.c | 80 +++++++++++++++++++++++++++++++ src/gallium/auxiliary/util/u_debug_dump.h | 12 +++++ 2 files changed, 92 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_debug_dump.c b/src/gallium/auxiliary/util/u_debug_dump.c index 6bdecde048..09866880ae 100644 --- a/src/gallium/auxiliary/util/u_debug_dump.c +++ b/src/gallium/auxiliary/util/u_debug_dump.c @@ -187,3 +187,83 @@ debug_dump_func_short_names[] = { }; DEFINE_DEBUG_DUMP_CONTINUOUS(func) + + +static const char * +debug_dump_tex_target_names[] = { + "PIPE_TEXTURE_1D", + "PIPE_TEXTURE_2D", + "PIPE_TEXTURE_3D", + "PIPE_TEXTURE_CUBE" +}; + +static const char * +debug_dump_tex_target_short_names[] = { + "1d", + "2d", + "3d", + "cube" +}; + +DEFINE_DEBUG_DUMP_CONTINUOUS(tex_target) + + +static const char * +debug_dump_tex_wrap_names[] = { + "PIPE_TEX_WRAP_REPEAT", + "PIPE_TEX_WRAP_CLAMP", + "PIPE_TEX_WRAP_CLAMP_TO_EDGE", + "PIPE_TEX_WRAP_CLAMP_TO_BORDER", + "PIPE_TEX_WRAP_MIRROR_REPEAT", + "PIPE_TEX_WRAP_MIRROR_CLAMP", + "PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE", + "PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER" +}; + +static const char * +debug_dump_tex_wrap_short_names[] = { + "repeat", + "clamp", + "clamp_to_edge", + "clamp_to_border", + "mirror_repeat", + "mirror_clamp", + "mirror_clamp_to_edge", + "mirror_clamp_to_border" +}; + +DEFINE_DEBUG_DUMP_CONTINUOUS(tex_wrap) + + +static const char * +debug_dump_tex_mipfilter_names[] = { + "PIPE_TEX_MIPFILTER_NEAREST", + "PIPE_TEX_MIPFILTER_LINEAR", + "PIPE_TEX_MIPFILTER_NONE" +}; + +static const char * +debug_dump_tex_mipfilter_short_names[] = { + "nearest", + "linear", + "none" +}; + +DEFINE_DEBUG_DUMP_CONTINUOUS(tex_mipfilter) + + +static const char * +debug_dump_tex_filter_names[] = { + "PIPE_TEX_FILTER_NEAREST", + "PIPE_TEX_FILTER_LINEAR", + "PIPE_TEX_FILTER_ANISO" +}; + +static const char * +debug_dump_tex_filter_short_names[] = { + "nearest", + "linear", + "aniso" +}; + +DEFINE_DEBUG_DUMP_CONTINUOUS(tex_filter) diff --git a/src/gallium/auxiliary/util/u_debug_dump.h b/src/gallium/auxiliary/util/u_debug_dump.h index 102935559c..19b130ad18 100644 --- a/src/gallium/auxiliary/util/u_debug_dump.h +++ b/src/gallium/auxiliary/util/u_debug_dump.h @@ -54,6 +54,18 @@ debug_dump_blend_func(unsigned value, boolean shortened); const char * debug_dump_func(unsigned value, boolean shortened); +const char * +debug_dump_tex_target(unsigned value, boolean shortened); + +const char * +debug_dump_tex_wrap(unsigned value, boolean shortened); + +const char * +debug_dump_tex_mipfilter(unsigned value, boolean shortened); + +const char * +debug_dump_tex_filter(unsigned value, boolean shortened); + /* FIXME: Move the other debug_dump_xxx functions out of u_debug.h into here. */ -- cgit v1.2.3 From 88e08d7c6de89279c737dbf5139492b39f96dc43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 25 Oct 2009 12:27:14 +0000 Subject: llvmpipe: Human friendlier sampler state dump. --- src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c | 4 +++- src/gallium/drivers/llvmpipe/lp_state_fs.c | 27 +++++++++++++++++------- 2 files changed, 22 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c index 42e4ee6986..47b68b71e2 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_sample_soa.c @@ -35,6 +35,7 @@ #include "pipe/p_defines.h" #include "pipe/p_state.h" #include "util/u_debug.h" +#include "util/u_debug_dump.h" #include "util/u_memory.h" #include "util/u_math.h" #include "util/u_format.h" @@ -171,7 +172,8 @@ lp_build_sample_wrap(struct lp_build_sample_context *bld, case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: /* FIXME */ - _debug_printf("warning: failed to translate texture wrap mode %u\n", wrap_mode); + _debug_printf("warning: failed to translate texture wrap mode %s\n", + debug_dump_tex_wrap(wrap_mode, TRUE)); coord = lp_build_max(int_coord_bld, coord, int_coord_bld->zero); coord = lp_build_min(int_coord_bld, coord, length_minus_one); break; diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 530a2d448c..2e9aa9fffe 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -423,15 +423,26 @@ generate_fragment(struct llvmpipe_context *lp, for(i = 0; i < PIPE_MAX_SAMPLERS; ++i) { if(key->sampler[i].format) { debug_printf("sampler[%u] = \n", i); - debug_printf(" .format = %s\n", pf_name(key->sampler[i].format)); - debug_printf(" .target = %u\n", key->sampler[i].target); - debug_printf(" .pot = %u%u%u\n", key->sampler[i].pot_width, key->sampler[i].pot_height, key->sampler[i].pot_depth); - debug_printf(" .wrap = %u %u %u\n", key->sampler[i].wrap_s, key->sampler[i].wrap_t, key->sampler[i].wrap_r); - debug_printf(" .min_img_filter = %u\n", key->sampler[i].min_img_filter); - debug_printf(" .min_mip_filter = %u\n", key->sampler[i].min_mip_filter); - debug_printf(" .mag_img_filter = %u\n", key->sampler[i].mag_img_filter); + debug_printf(" .format = %s\n", + pf_name(key->sampler[i].format)); + debug_printf(" .target = %s\n", + debug_dump_tex_target(key->sampler[i].target, TRUE)); + debug_printf(" .pot = %u %u %u\n", + key->sampler[i].pot_width, + key->sampler[i].pot_height, + key->sampler[i].pot_depth); + debug_printf(" .wrap = %s %s %s\n", + debug_dump_tex_wrap(key->sampler[i].wrap_s, TRUE), + debug_dump_tex_wrap(key->sampler[i].wrap_t, TRUE), + debug_dump_tex_wrap(key->sampler[i].wrap_r, TRUE)); + debug_printf(" .min_img_filter = %s\n", + debug_dump_tex_filter(key->sampler[i].min_img_filter, TRUE)); + debug_printf(" .min_mip_filter = %s\n", + debug_dump_tex_mipfilter(key->sampler[i].min_mip_filter, TRUE)); + debug_printf(" .mag_img_filter = %s\n", + debug_dump_tex_filter(key->sampler[i].mag_img_filter, TRUE)); if(key->sampler[i].compare_mode) - debug_printf(" .compare_mode = %s\n", debug_dump_blend_func(key->sampler[i].compare_func, TRUE)); + debug_printf(" .compare_mode = %s\n", debug_dump_func(key->sampler[i].compare_func, TRUE)); debug_printf(" .normalized_coords = %u\n", key->sampler[i].normalized_coords); debug_printf(" .prefilter = %u\n", key->sampler[i].prefilter); } -- cgit v1.2.3 From 3a49497f102f2b64a8755d3cf65b7c0386e95aac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 25 Oct 2009 21:11:54 +0000 Subject: gallium: Move enum pipe_error into p_defines.h. It's really just another define. No need for its own header. --- src/gallium/auxiliary/cso_cache/cso_context.h | 2 +- src/gallium/auxiliary/pipebuffer/pb_buffer.h | 2 +- .../auxiliary/pipebuffer/pb_buffer_fenced.c | 2 +- src/gallium/auxiliary/pipebuffer/pb_bufmgr.h | 2 +- src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c | 1 - src/gallium/auxiliary/pipebuffer/pb_validate.c | 2 +- src/gallium/auxiliary/pipebuffer/pb_validate.h | 2 +- src/gallium/auxiliary/util/u_hash_table.h | 2 +- src/gallium/auxiliary/util/u_keymap.c | 2 +- src/gallium/auxiliary/util/u_upload_mgr.c | 2 +- src/gallium/include/pipe/p_defines.h | 17 ++++++ src/gallium/include/pipe/p_error.h | 65 ---------------------- 12 files changed, 26 insertions(+), 75 deletions(-) delete mode 100644 src/gallium/include/pipe/p_error.h (limited to 'src') diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index b04e98bfa1..69630e98ba 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.h +++ b/src/gallium/auxiliary/cso_cache/cso_context.h @@ -31,7 +31,7 @@ #include "pipe/p_context.h" #include "pipe/p_state.h" -#include "pipe/p_error.h" +#include "pipe/p_defines.h" #ifdef __cplusplus diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer.h b/src/gallium/auxiliary/pipebuffer/pb_buffer.h index 2590546cb4..4ef372233f 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer.h +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer.h @@ -46,7 +46,7 @@ #include "pipe/p_compiler.h" #include "util/u_debug.h" -#include "pipe/p_error.h" +#include "pipe/p_defines.h" #include "pipe/p_state.h" diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c index d31476228c..a0b116304f 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c @@ -42,7 +42,7 @@ #endif #include "pipe/p_compiler.h" -#include "pipe/p_error.h" +#include "pipe/p_defines.h" #include "util/u_debug.h" #include "pipe/p_thread.h" #include "util/u_memory.h" diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h index 39ab8e722c..8c8d713078 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr.h @@ -51,7 +51,7 @@ #include "pipe/p_compiler.h" -#include "pipe/p_error.h" +#include "pipe/p_defines.h" #ifdef __cplusplus diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c index e7352e90db..d21910d0bf 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_slab.c @@ -37,7 +37,6 @@ */ #include "pipe/p_compiler.h" -#include "pipe/p_error.h" #include "util/u_debug.h" #include "pipe/p_thread.h" #include "pipe/p_defines.h" diff --git a/src/gallium/auxiliary/pipebuffer/pb_validate.c b/src/gallium/auxiliary/pipebuffer/pb_validate.c index 150fd50618..ce40c0cf0e 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_validate.c +++ b/src/gallium/auxiliary/pipebuffer/pb_validate.c @@ -34,7 +34,7 @@ #include "pipe/p_compiler.h" -#include "pipe/p_error.h" +#include "pipe/p_defines.h" #include "util/u_memory.h" #include "util/u_debug.h" diff --git a/src/gallium/auxiliary/pipebuffer/pb_validate.h b/src/gallium/auxiliary/pipebuffer/pb_validate.h index dfb84df1ce..3c93f30f20 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_validate.h +++ b/src/gallium/auxiliary/pipebuffer/pb_validate.h @@ -37,7 +37,7 @@ #include "pipe/p_compiler.h" -#include "pipe/p_error.h" +#include "pipe/p_defines.h" #ifdef __cplusplus extern "C" { diff --git a/src/gallium/auxiliary/util/u_hash_table.h b/src/gallium/auxiliary/util/u_hash_table.h index 258a31aec8..51ec10a804 100644 --- a/src/gallium/auxiliary/util/u_hash_table.h +++ b/src/gallium/auxiliary/util/u_hash_table.h @@ -35,7 +35,7 @@ #define U_HASH_TABLE_H_ -#include "pipe/p_error.h" +#include "pipe/p_defines.h" #ifdef __cplusplus diff --git a/src/gallium/auxiliary/util/u_keymap.c b/src/gallium/auxiliary/util/u_keymap.c index f856395ca9..c4b9eb3d9b 100644 --- a/src/gallium/auxiliary/util/u_keymap.c +++ b/src/gallium/auxiliary/util/u_keymap.c @@ -36,7 +36,7 @@ #include "pipe/p_compiler.h" #include "util/u_debug.h" -#include "pipe/p_error.h" +#include "pipe/p_defines.h" #include "cso_cache/cso_hash.h" diff --git a/src/gallium/auxiliary/util/u_upload_mgr.c b/src/gallium/auxiliary/util/u_upload_mgr.c index eb635c9f14..975ee89c45 100644 --- a/src/gallium/auxiliary/util/u_upload_mgr.c +++ b/src/gallium/auxiliary/util/u_upload_mgr.c @@ -29,7 +29,7 @@ * coalescing small buffers into larger ones. */ -#include "pipe/p_error.h" +#include "pipe/p_defines.h" #include "pipe/p_inlines.h" #include "pipe/p_screen.h" #include "util/u_memory.h" diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index f8fa1e3f49..52887ea0ad 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -34,6 +34,23 @@ extern "C" { #endif +/** + * Gallium error codes. + * + * - A zero value always means success. + * - A negative value always means failure. + * - The meaning of a positive value is function dependent. + */ +enum pipe_error { + PIPE_OK = 0, + PIPE_ERROR = -1, /**< Generic error */ + PIPE_ERROR_BAD_INPUT = -2, + PIPE_ERROR_OUT_OF_MEMORY = -3, + PIPE_ERROR_RETRY = -4 + /* TODO */ +}; + + #define PIPE_BLENDFACTOR_ONE 0x1 #define PIPE_BLENDFACTOR_SRC_COLOR 0x2 #define PIPE_BLENDFACTOR_SRC_ALPHA 0x3 diff --git a/src/gallium/include/pipe/p_error.h b/src/gallium/include/pipe/p_error.h deleted file mode 100644 index b865b22635..0000000000 --- a/src/gallium/include/pipe/p_error.h +++ /dev/null @@ -1,65 +0,0 @@ -/************************************************************************** - * - * 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. - * - **************************************************************************/ - -/** - * @file - * Gallium error codes. - * - * @author José Fonseca - */ - -#ifndef P_ERROR_H_ -#define P_ERROR_H_ - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * Gallium error codes. - * - * - A zero value always means success. - * - A negative value always means failure. - * - The meaning of a positive value is function dependent. - */ -enum pipe_error { - PIPE_OK = 0, - PIPE_ERROR = -1, /**< Generic error */ - PIPE_ERROR_BAD_INPUT = -2, - PIPE_ERROR_OUT_OF_MEMORY = -3, - PIPE_ERROR_RETRY = -4 - /* TODO */ -}; - - -#ifdef __cplusplus -} -#endif - -#endif /* P_ERROR_H_ */ -- cgit v1.2.3 From 54bb414e00a4daedbe530b9933bc11bac4ae7149 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 25 Oct 2009 16:59:08 -0600 Subject: mesa: clean-up, simplify compressed texture size checking --- src/mesa/main/texcompress.c | 61 +++++++++++++-------------------------------- src/mesa/main/texcompress.h | 6 ++--- src/mesa/main/teximage.c | 20 ++++++++++++--- 3 files changed, 36 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index ad10993307..423ad2490c 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -114,67 +114,42 @@ _mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all) /** - * As above, but format is specified by a GLenum (GL_COMPRESSED_*) token. - * - * Note: This function CAN NOT return a padded hardware texture size. - * That's why we don't call the ctx->Driver.CompressedTextureSize() function. - * - * We use this function to validate the parameter - * of glCompressedTex[Sub]Image1/2/3D(), which must be an exact match. + * Convert a compressed MESA_FORMAT_x to a GLenum. */ -GLuint -_mesa_compressed_texture_size_glenum(GLcontext *ctx, - GLsizei width, GLsizei height, - GLsizei depth, GLenum glformat) +gl_format +_mesa_glenum_to_compressed_format(GLenum format) { - gl_format mesaFormat; - - switch (glformat) { -#if FEATURE_texture_fxt1 + switch (format) { case GL_COMPRESSED_RGB_FXT1_3DFX: - mesaFormat = MESA_FORMAT_RGB_FXT1; - break; + return MESA_FORMAT_RGB_FXT1; case GL_COMPRESSED_RGBA_FXT1_3DFX: - mesaFormat = MESA_FORMAT_RGBA_FXT1; - break; -#endif -#if FEATURE_texture_s3tc + return MESA_FORMAT_RGBA_FXT1; + case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: case GL_RGB_S3TC: - mesaFormat = MESA_FORMAT_RGB_DXT1; - break; + return MESA_FORMAT_RGB_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: case GL_RGB4_S3TC: - mesaFormat = MESA_FORMAT_RGBA_DXT1; - break; + return MESA_FORMAT_RGBA_DXT1; case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: case GL_RGBA_S3TC: - mesaFormat = MESA_FORMAT_RGBA_DXT3; - break; + return MESA_FORMAT_RGBA_DXT3; case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: case GL_RGBA4_S3TC: - mesaFormat = MESA_FORMAT_RGBA_DXT5; - break; -#if FEATURE_EXT_texture_sRGB + return MESA_FORMAT_RGBA_DXT5; + case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: - mesaFormat = MESA_FORMAT_SRGB_DXT1; - break; + return MESA_FORMAT_SRGB_DXT1; case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: - mesaFormat = MESA_FORMAT_SRGBA_DXT1; - break; + return MESA_FORMAT_SRGBA_DXT1; case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: - mesaFormat = MESA_FORMAT_SRGBA_DXT3; - break; + return MESA_FORMAT_SRGBA_DXT3; case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: - mesaFormat = MESA_FORMAT_SRGBA_DXT5; - break; -#endif -#endif + return MESA_FORMAT_SRGBA_DXT5; + default: - return 0; + return MESA_FORMAT_NONE; } - - return _mesa_format_image_size(mesaFormat, width, height, depth); } diff --git a/src/mesa/main/texcompress.h b/src/mesa/main/texcompress.h index 70247098b2..43cd741895 100644 --- a/src/mesa/main/texcompress.h +++ b/src/mesa/main/texcompress.h @@ -33,10 +33,8 @@ extern GLuint _mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all); -extern GLuint -_mesa_compressed_texture_size_glenum(GLcontext *ctx, - GLsizei width, GLsizei height, - GLsizei depth, GLenum glformat); +extern gl_format +_mesa_glenum_to_compressed_format(GLenum format); extern GLint _mesa_compressed_row_stride(gl_format mesaFormat, GLsizei width); diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 52d2886d0a..4fbfeb8582 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -3034,6 +3034,20 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, /**********************************************************************/ +/** + * Return expected size of a compressed texture. + */ +static GLuint +compressed_tex_size(GLsizei width, GLsizei height, GLsizei depth, + GLenum glformat) +{ + gl_format mesaFormat = _mesa_glenum_to_compressed_format(glformat); + return _mesa_format_image_size(mesaFormat, width, height, depth); +} + + + + /** * Error checking for glCompressedTexImage[123]D(). * \return error code or GL_NO_ERROR. @@ -3116,8 +3130,7 @@ compressed_texture_error_check(GLcontext *ctx, GLint dimensions, if (level < 0 || level >= maxLevels) return GL_INVALID_VALUE; - expectedSize = _mesa_compressed_texture_size_glenum(ctx, width, height, - depth, internalFormat); + expectedSize = compressed_tex_size(width, height, depth, internalFormat); if (expectedSize != imageSize) return GL_INVALID_VALUE; @@ -3211,8 +3224,7 @@ compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions, if ((height & 3) != 0 && height != 2 && height != 1) return GL_INVALID_VALUE; - expectedSize = _mesa_compressed_texture_size_glenum(ctx, width, height, - depth, format); + expectedSize = compressed_tex_size(width, height, depth, format); if (expectedSize != imageSize) return GL_INVALID_VALUE; -- cgit v1.2.3 From 07ad6393cb31d8f1f086f9c46705334ef9cf25f6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 25 Oct 2009 17:07:06 -0600 Subject: mesa: fix-up error checking related to compressed texture block size --- src/mesa/main/teximage.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 4fbfeb8582..bd5ad56258 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -3046,6 +3046,15 @@ compressed_tex_size(GLsizei width, GLsizei height, GLsizei depth, } +/* + * Return compressed texture block size, in pixels. + */ +static void +get_compressed_block_size(GLenum glformat, GLuint *bw, GLuint *bh) +{ + gl_format mesaFormat = _mesa_glenum_to_compressed_format(glformat); + _mesa_get_format_block_size(mesaFormat, bw, bh); +} /** @@ -3163,6 +3172,7 @@ compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions, GLenum format, GLsizei imageSize) { GLint expectedSize, maxLevels = 0, maxTextureSize; + GLuint bw, bh; (void) zoffset; if (dimensions == 1) { @@ -3212,16 +3222,18 @@ compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions, if (level < 0 || level >= maxLevels) return GL_INVALID_VALUE; - /* XXX these tests are specific to the compressed format. - * this code should be generalized in some way. + /* + * do checks which depend on compression block size */ - if ((xoffset & 3) != 0 || (yoffset & 3) != 0) + get_compressed_block_size(format, &bw, &bh); + + if ((xoffset % bw != 0) || (yoffset % bh != 0)) return GL_INVALID_VALUE; - if ((width & 3) != 0 && width != 2 && width != 1) + if ((width % bw != 0) && width != 2 && width != 1) return GL_INVALID_VALUE; - if ((height & 3) != 0 && height != 2 && height != 1) + if ((height % bh != 0) && height != 2 && height != 1) return GL_INVALID_VALUE; expectedSize = compressed_tex_size(width, height, depth, format); -- cgit v1.2.3 From 82bcc1c5d27b825db7f002c3c183bd1dc7833438 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 25 Oct 2009 17:15:02 -0600 Subject: mesa: simplify texture_row_stride() helper --- src/mesa/main/texstore.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index e6a63b8603..6887521f55 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3223,17 +3223,8 @@ texture_size(const struct gl_texture_image *texImage) static GLuint texture_row_stride(const struct gl_texture_image *texImage) { - GLuint stride; - - if (_mesa_is_format_compressed(texImage->TexFormat)) { - stride = _mesa_compressed_row_stride(texImage->TexFormat, + GLuint stride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width); - } - else { - GLuint texelBytes = _mesa_get_format_bytes(texImage->TexFormat); - stride = texImage->RowStride * texelBytes; - } - return stride; } -- cgit v1.2.3 From 2594168e9f3cdc4ac53c925486491167837cda30 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 25 Oct 2009 17:20:13 -0600 Subject: mesa: begin removing _mesa_compressed_row_stride() calls Use equivalent _mesa_format_row_stride() function instead. --- src/mesa/main/mipmap.c | 2 +- src/mesa/main/texstore.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 40cf43dfff..b602d920df 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -1661,7 +1661,7 @@ _mesa_generate_mipmap(GLcontext *ctx, GLenum target, /* compress image from dstData into dstImage->Data */ const GLenum srcFormat = _mesa_get_format_base_format(convertFormat); GLint dstRowStride - = _mesa_compressed_row_stride(dstImage->TexFormat, dstWidth); + = _mesa_format_row_stride(dstImage->TexFormat, dstWidth); ASSERT(srcFormat == GL_RGB || srcFormat == GL_RGBA); _mesa_texstore(ctx, 2, dstImage->_BaseFormat, diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 6887521f55..dd146254b4 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3682,10 +3682,10 @@ _mesa_store_compressed_texsubimage2d(GLcontext *ctx, GLenum target, if (!data) return; - srcRowStride = _mesa_compressed_row_stride(texFormat, width); + srcRowStride = _mesa_format_row_stride(texFormat, width); src = (const GLubyte *) data; - destRowStride = _mesa_compressed_row_stride(texFormat, destWidth); + destRowStride = _mesa_format_row_stride(texFormat, destWidth); dest = _mesa_compressed_image_address(xoffset, yoffset, 0, texFormat, destWidth, (GLubyte *) texImage->Data); -- cgit v1.2.3 From 253e7fee5dc7f0872987b214a6fa162db5e2aa19 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 25 Oct 2009 17:21:11 -0600 Subject: mesa: remove _mesa_compressed_row_stride() calls --- src/mesa/state_tracker/st_cb_texture.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 8ba7c8e53f..4397adbc12 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -698,8 +698,7 @@ st_TexImage(GLcontext * ctx, texImage->Width, texImage->Height, texImage->Depth); - dstRowStride = - _mesa_compressed_row_stride(texImage->TexFormat, width); + dstRowStride = _mesa_format_row_stride(texImage->TexFormat, width); assert(dims != 3); } else { -- cgit v1.2.3 From c83b7587608e1791e092739cc9753ad0e895f25d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 25 Oct 2009 17:21:25 -0600 Subject: glide: remove _mesa_compressed_row_stride() calls And fix incorrect first parameter. --- src/mesa/drivers/glide/fxddtex.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index 128c17e08b..9fcbf96114 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -1400,7 +1400,7 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, texImage->CompressedSize = _mesa_format_image_size(texImage->TexFormat, mml->width, mml->height, 1); - dstRowStride = _mesa_compressed_row_stride(internalFormat, mml->width); + dstRowStride = _mesa_format_row_stride(texImage->TexFormat, mml->width); texImage->Data = _mesa_malloc(texImage->CompressedSize); } else { dstRowStride = mml->width * texelBytes; @@ -1521,7 +1521,7 @@ fxDDTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); if (_mesa_is_format_compressed(texImage->TexFormat)) { - dstRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, mml->width); + dstRowStride = _mesa_format_row_stride(texImage->TexFormat, mml->width); } else { dstRowStride = mml->width * texelBytes; } @@ -1688,10 +1688,10 @@ fxDDCompressedTexImage2D (GLcontext *ctx, GLenum target, * we replicate the data over the padded area. * For now, we take 2) + 3) but texelfetchers will be wrong! */ - GLuint srcRowStride = _mesa_compressed_row_stride(internalFormat, width); + GLuint srcRowStride = _mesa_format_row_stride(texImage->TexFormat, width); - GLuint destRowStride = _mesa_compressed_row_stride(internalFormat, - mml->width); + GLuint destRowStride = _mesa_format_row_stride(texImage->TexFormat, + mml->width); _mesa_upscale_teximage2d(srcRowStride, (height+3) / 4, destRowStride, (mml->height+3) / 4, @@ -1739,10 +1739,9 @@ fxDDCompressedTexSubImage2D( GLcontext *ctx, GLenum target, mml = FX_MIPMAP_DATA(texImage); assert(mml); - srcRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, width); + srcRowStride = _mesa_format_row_stride(texImage->TexFormat, width); - destRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, - mml->width); + destRowStride = _mesa_format_row_stride(texImage->TexFormat, mml->width); dest = _mesa_compressed_image_address(xoffset, yoffset, 0, texImage->InternalFormat, mml->width, @@ -1760,10 +1759,9 @@ fxDDCompressedTexSubImage2D( GLcontext *ctx, GLenum target, * see fxDDCompressedTexImage2D for caveats */ if (mml->wScale != 1 || mml->hScale != 1) { - srcRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, texImage->Width); + srcRowStride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width); - destRowStride = _mesa_compressed_row_stride(texImage->InternalFormat, - mml->width); + destRowStride = _mesa_format_row_stride(texImage->TexFormat, mml->width); _mesa_upscale_teximage2d(srcRowStride, texImage->Height / 4, destRowStride, mml->height / 4, 1, texImage->Data, destRowStride, -- cgit v1.2.3 From e3f2efc4f14d6f0d06560d2acfac73628f5a74a6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 25 Oct 2009 17:23:37 -0600 Subject: mesa: remove calls to _mesa_compressed_row_stride() --- src/mesa/drivers/dri/intel/intel_tex_image.c | 2 +- src/mesa/drivers/dri/intel/intel_tex_subimage.c | 2 +- src/mesa/drivers/dri/radeon/radeon_texture.c | 8 ++++---- src/mesa/drivers/dri/tdfx/tdfx_tex.c | 16 ++++++++-------- src/mesa/drivers/dri/unichrome/via_tex.c | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index cbe29f61a2..daf6d9da0e 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -493,7 +493,7 @@ intelTexImage(GLcontext * ctx, texImage->Height, texImage->Depth); dstRowStride = - _mesa_compressed_row_stride(texImage->TexFormat, width); + _mesa_format_row_stride(texImage->TexFormat, width); assert(dims != 3); } else { diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c index cc329dae58..1f68208266 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c +++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c @@ -87,7 +87,7 @@ intelTexSubimage(GLcontext * ctx, else { if (_mesa_is_format_compressed(texImage->TexFormat)) { dstRowStride = - _mesa_compressed_row_stride(texImage->TexFormat, width); + _mesa_format_row_stride(texImage->TexFormat, width); assert(dims != 3); } else { diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 1a48e8c955..d8e81237d0 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -605,7 +605,7 @@ static void radeon_teximage( if (compressed) { if (image->mt) { uint32_t srcRowStride, bytesPerRow, rows; - srcRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width); + srcRowStride = _mesa_format_row_stride(texImage->TexFormat, width); bytesPerRow = srcRowStride; rows = (height + 3) / 4; copy_rows(texImage->Data, image->mt->levels[level].rowstride, @@ -755,7 +755,7 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve uint32_t srcRowStride, bytesPerRow, rows; GLubyte *img_start; if (!image->mt) { - dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, texImage->Width); + dstRowStride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width); img_start = _mesa_compressed_image_address(xoffset, yoffset, 0, texImage->TexFormat, texImage->Width, texImage->Data); @@ -764,7 +764,7 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve uint32_t blocks_x = dstRowStride / (image->mt->bpp * 4); img_start = texImage->Data + image->mt->bpp * 4 * (blocks_x * (yoffset / 4) + xoffset / 4); } - srcRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width); + srcRowStride = _mesa_format_row_stride(texImage->TexFormat, width); bytesPerRow = srcRowStride; rows = (height + 3) / 4; @@ -887,7 +887,7 @@ static void migrate_image_to_miptree(radeon_mipmap_tree *mt, radeon_texture_imag /* need to confirm this value is correct */ if (mt->compressed) { height = (image->base.Height + 3) / 4; - srcrowstride = _mesa_compressed_row_stride(image->base.TexFormat, image->base.Width); + srcrowstride = _mesa_format_row_stride(image->base.TexFormat, image->base.Width); } else { height = image->base.Height * image->base.Depth; srcrowstride = image->base.Width * _mesa_get_format_bytes(image->base.TexFormat); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index 63783d6ecd..af434315c1 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -1410,7 +1410,7 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, if (_mesa_is_format_compressed(texImage->TexFormat)) { GLuint compressedSize = _mesa_format_image_size(mesaFormat, mml->width, mml->height, 1); - dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, mml->width); + dstRowStride = _mesa_format_row_stride(texImage->TexFormat, mml->width); texImage->Data = _mesa_alloc_texmemory(compressedSize); } else { dstRowStride = mml->width * texelBytes; @@ -1488,7 +1488,7 @@ tdfxTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, texelBytes = _mesa_get_format_bytes(texImage->TexFormat); if (_mesa_is_format_compressed(texImage->TexFormat)) { - dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, mml->width); + dstRowStride = _mesa_format_row_stride(texImage->TexFormat, mml->width); } else { dstRowStride = mml->width * texelBytes; } @@ -1660,9 +1660,9 @@ tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target, * For now, we take 2) + 3) but texelfetchers will be wrong! */ const GLuint mesaFormat = texImage->TexFormat; - GLuint srcRowStride = _mesa_compressed_row_stride(mesaFormat, width); + GLuint srcRowStride = _mesa_format_row_stride(mesaFormat, width); - GLuint destRowStride = _mesa_compressed_row_stride(mesaFormat, + GLuint destRowStride = _mesa_format_row_stride(mesaFormat, mml->width); _mesa_upscale_teximage2d(srcRowStride, (height+3) / 4, @@ -1707,9 +1707,9 @@ tdfxCompressedTexSubImage2D( GLcontext *ctx, GLenum target, mml = TDFX_TEXIMAGE_DATA(texImage); assert(mml); - srcRowStride = _mesa_compressed_row_stride(mesaFormat, width); + srcRowStride = _mesa_format_row_stride(mesaFormat, width); - destRowStride = _mesa_compressed_row_stride(mesaFormat, mml->width); + destRowStride = _mesa_format_row_stride(mesaFormat, mml->width); dest = _mesa_compressed_image_address(xoffset, yoffset, 0, mesaFormat, mml->width, @@ -1727,9 +1727,9 @@ tdfxCompressedTexSubImage2D( GLcontext *ctx, GLenum target, * see fxDDCompressedTexImage2D for caveats */ if (mml->wScale != 1 || mml->hScale != 1) { - srcRowStride = _mesa_compressed_row_stride(mesaFormat, texImage->Width); + srcRowStride = _mesa_format_row_stride(mesaFormat, texImage->Width); - destRowStride = _mesa_compressed_row_stride(mesaFormat, mml->width); + destRowStride = _mesa_format_row_stride(mesaFormat, mml->width); _mesa_upscale_teximage2d(srcRowStride, texImage->Height / 4, destRowStride, mml->height / 4, 1, texImage->Data, destRowStride, diff --git a/src/mesa/drivers/dri/unichrome/via_tex.c b/src/mesa/drivers/dri/unichrome/via_tex.c index 1bc5ddc429..24924d2613 100644 --- a/src/mesa/drivers/dri/unichrome/via_tex.c +++ b/src/mesa/drivers/dri/unichrome/via_tex.c @@ -785,7 +785,7 @@ static void viaTexImage(GLcontext *ctx, GLboolean success; if (_mesa_is_format_compressed(texImage->TexFormat)) { - dstRowStride = _mesa_compressed_row_stride(texImage->TexFormat, width); + dstRowStride = _mesa_format_row_stride(texImage->TexFormat, width); } else { dstRowStride = postConvWidth * _mesa_get_format_bytes(texImage->TexFormat); -- cgit v1.2.3 From 20c6c5853261b31ecd50d58e0aae9b92f25e41db Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 25 Oct 2009 17:25:46 -0600 Subject: mesa: remove _mesa_compressed_row_stride() --- src/mesa/main/texcompress.c | 15 --------------- src/mesa/main/texcompress.h | 5 ----- 2 files changed, 20 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index 423ad2490c..262e8236ed 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -153,21 +153,6 @@ _mesa_glenum_to_compressed_format(GLenum format) } -/* - * Compute the bytes per row in a compressed texture image. - * We use this for computing the destination address for sub-texture updates. - * \param mesaFormat one of the MESA_FORMAT_* compressed formats - * \param width image width in pixels - * \return stride, in bytes, between rows for compressed image - */ -GLint -_mesa_compressed_row_stride(gl_format mesaFormat, GLsizei width) -{ - GLint stride = _mesa_format_row_stride(mesaFormat, width); - return stride; -} - - /* * Return the address of the pixel at (col, row, img) in a * compressed texture image. diff --git a/src/mesa/main/texcompress.h b/src/mesa/main/texcompress.h index 43cd741895..d6c16e936c 100644 --- a/src/mesa/main/texcompress.h +++ b/src/mesa/main/texcompress.h @@ -36,10 +36,6 @@ _mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all); extern gl_format _mesa_glenum_to_compressed_format(GLenum format); -extern GLint -_mesa_compressed_row_stride(gl_format mesaFormat, GLsizei width); - - extern GLubyte * _mesa_compressed_image_address(GLint col, GLint row, GLint img, gl_format mesaFormat, @@ -58,7 +54,6 @@ _mesa_init_texture_fxt1( GLcontext *ctx ); /* no-op macros */ #define _mesa_get_compressed_formats( c, f ) 0 #define _mesa_compressed_texture_size_glenum( c, w, h, d, f ) 0 -#define _mesa_compressed_row_stride( f, w) 0 #define _mesa_compressed_image_address(c, r, i, f, w, i2 ) 0 #define _mesa_compress_teximage( c, w, h, sF, s, sRS, dF, d, drs ) ((void)0) -- cgit v1.2.3 From 355b5bde5056297f4f1636850449b91626958408 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 25 Oct 2009 17:32:56 -0600 Subject: mesa: remove _mesa_compressed_texture_size_glenum() stub --- src/mesa/main/texcompress.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texcompress.h b/src/mesa/main/texcompress.h index d6c16e936c..5ac93ddd18 100644 --- a/src/mesa/main/texcompress.h +++ b/src/mesa/main/texcompress.h @@ -53,7 +53,6 @@ _mesa_init_texture_fxt1( GLcontext *ctx ); /* no-op macros */ #define _mesa_get_compressed_formats( c, f ) 0 -#define _mesa_compressed_texture_size_glenum( c, w, h, d, f ) 0 #define _mesa_compressed_image_address(c, r, i, f, w, i2 ) 0 #define _mesa_compress_teximage( c, w, h, sF, s, sRS, dF, d, drs ) ((void)0) -- cgit v1.2.3 From 11caea687e3f10ae12d33e44edf84635f73047dd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sun, 25 Oct 2009 18:06:18 -0600 Subject: mesa: choose texture format in core mesa, not drivers Call the ctx->Driver.ChooseTextureFormat() function from core Mesa's _mesa_[Copy]TexImage functions instead of in the driver functions. One less thing for drivers to do. --- src/mesa/drivers/dri/intel/intel_tex_image.c | 6 ---- src/mesa/drivers/dri/r200/r200_texstate.c | 4 +-- src/mesa/drivers/dri/r300/r300_texstate.c | 3 -- src/mesa/drivers/dri/r600/r600_texstate.c | 4 +-- src/mesa/drivers/dri/radeon/radeon_fbo.c | 3 ++ src/mesa/drivers/dri/radeon/radeon_texstate.c | 4 +-- src/mesa/drivers/dri/radeon/radeon_texture.c | 3 -- src/mesa/drivers/dri/tdfx/tdfx_tex.c | 11 ------ src/mesa/drivers/glide/fxddtex.c | 12 ------- src/mesa/main/teximage.c | 48 +++++++++++++++++++++++++++ src/mesa/main/texstore.c | 16 --------- src/mesa/state_tracker/st_cb_texture.c | 4 --- 12 files changed, 54 insertions(+), 64 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index daf6d9da0e..ef5902a5e5 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -330,10 +330,6 @@ intelTexImage(GLcontext * ctx, &postConvHeight); } - /* choose the texture format */ - texImage->TexFormat = intelChooseTextureFormat(ctx, internalFormat, - format, type); - if (_mesa_is_format_compressed(texImage->TexFormat)) { texelBytes = 0; } @@ -787,8 +783,6 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, intelImage->face = target_to_face(target); intelImage->level = level; - texImage->TexFormat = intelChooseTextureFormat(&intel->ctx, internalFormat, - type, format); texImage->RowStride = rb->region->pitch; intel_miptree_reference(&intelImage->mt, intelObj->mt); diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index 20ec6fffaf..7d0afa1add 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -835,9 +835,7 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo _mesa_init_teximage_fields(radeon->glCtx, target, texImage, rb->base.Width, rb->base.Height, 1, 0, rb->cpp); texImage->RowStride = rb->pitch / rb->cpp; - texImage->TexFormat = radeonChooseTextureFormat(radeon->glCtx, - internalFormat, - type, format, 0); + rImage->bo = rb->bo; radeon_bo_ref(rImage->bo); t->bo = rb->bo; diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 63f0154cd3..b7bb8bfadc 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -444,9 +444,6 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo _mesa_init_teximage_fields(radeon->glCtx, target, texImage, rb->base.Width, rb->base.Height, 1, 0, rb->cpp); texImage->RowStride = rb->pitch / rb->cpp; - texImage->TexFormat = radeonChooseTextureFormat(radeon->glCtx, - internalFormat, - type, format, 0); rImage->bo = rb->bo; radeon_bo_ref(rImage->bo); t->bo = rb->bo; diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c index 63d88f83d6..a083f9afc0 100644 --- a/src/mesa/drivers/dri/r600/r600_texstate.c +++ b/src/mesa/drivers/dri/r600/r600_texstate.c @@ -907,9 +907,7 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo _mesa_init_teximage_fields(radeon->glCtx, target, texImage, rb->base.Width, rb->base.Height, 1, 0, rb->cpp); texImage->RowStride = rb->pitch / rb->cpp; - texImage->TexFormat = radeonChooseTextureFormat(radeon->glCtx, - internalFormat, - type, format, 0); + rImage->bo = rb->bo; radeon_bo_ref(rImage->bo); t->bo = rb->bo; diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 40846828c5..3f0ab83996 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -385,6 +385,9 @@ restart: texImage->TexFormat); return GL_FALSE; } + /* XXX why is the tex format being set here? + * I think this can be removed. + */ texImage->TexFormat = radeonChooseTextureFormat(ctx, texImage->InternalFormat, 0, _mesa_get_format_datatype(texImage->TexFormat), 1); diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index c7786381ae..0fd9a138d6 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -709,9 +709,7 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_ _mesa_init_teximage_fields(radeon->glCtx, target, texImage, rb->base.Width, rb->base.Height, 1, 0, rb->cpp); texImage->RowStride = rb->pitch / rb->cpp; - texImage->TexFormat = radeonChooseTextureFormat(radeon->glCtx, - internalFormat, - type, format, 0); + rImage->bo = rb->bo; radeon_bo_ref(rImage->bo); t->bo = rb->bo; diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index d8e81237d0..9b391620c6 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -538,9 +538,6 @@ static void radeon_teximage( &postConvHeight); } - /* Choose and fill in the texture format for this image */ - texImage->TexFormat = radeonChooseTextureFormat(ctx, internalFormat, format, type, 0); - if (_mesa_is_format_compressed(texImage->TexFormat)) { texelBytes = 0; } else { diff --git a/src/mesa/drivers/dri/tdfx/tdfx_tex.c b/src/mesa/drivers/dri/tdfx/tdfx_tex.c index af434315c1..0aa09e733b 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_tex.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_tex.c @@ -1396,11 +1396,6 @@ tdfxTexImage2D(GLcontext *ctx, GLenum target, GLint level, } #endif - /* choose the texture format */ - assert(ctx->Driver.ChooseTextureFormat); - texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, - internalFormat, format, type); - assert(texImage->TexFormat); mesaFormat = texImage->TexFormat; mml->glideFormat = fxGlideFormat(mesaFormat); ti->info.format = mml->glideFormat; @@ -1618,12 +1613,6 @@ tdfxCompressedTexImage2D (GLcontext *ctx, GLenum target, mml->height = height * mml->hScale; - /* choose the texture format */ - assert(ctx->Driver.ChooseTextureFormat); - texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, - internalFormat, -1/*format*/, -1/*type*/); - assert(texImage->TexFormat); - /* Determine the appropriate Glide texel format, * given the user's internal texture format hint. */ diff --git a/src/mesa/drivers/glide/fxddtex.c b/src/mesa/drivers/glide/fxddtex.c index 9fcbf96114..a863b028ad 100644 --- a/src/mesa/drivers/glide/fxddtex.c +++ b/src/mesa/drivers/glide/fxddtex.c @@ -1384,11 +1384,6 @@ fxDDTexImage2D(GLcontext * ctx, GLenum target, GLint level, } #endif - /* choose the texture format */ - assert(ctx->Driver.ChooseTextureFormat); - texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, - internalFormat, format, type); - assert(texImage->TexFormat); texelBytes = _mesa_get_format_bytes(texImage->TexFormat->MesaFormat); /*if (!fxMesa->HaveTexFmt) assert(texelBytes == 1 || texelBytes == 2);*/ @@ -1648,13 +1643,6 @@ fxDDCompressedTexImage2D (GLcontext *ctx, GLenum target, mml->width = width * mml->wScale; mml->height = height * mml->hScale; - - /* choose the texture format */ - assert(ctx->Driver.ChooseTextureFormat); - texImage->TexFormat = (*ctx->Driver.ChooseTextureFormat)(ctx, - internalFormat, -1/*format*/, -1/*type*/); - assert(texImage->TexFormat); - /* Determine the appropriate Glide texel format, * given the user's internal texture format hint. */ diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index bd5ad56258..2555934eca 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -2195,6 +2195,12 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, postConvWidth, 1, 1, border, internalFormat); + /* Choose actual texture format */ + texImage->TexFormat = + ctx->Driver.ChooseTextureFormat(ctx, internalFormat, + format, type); + ASSERT(texImage->TexFormat != MESA_FORMAT_NONE); + /* Give the texture to the driver. may be null. */ ASSERT(ctx->Driver.TexImage1D); ctx->Driver.TexImage1D(ctx, target, level, internalFormat, @@ -2311,6 +2317,12 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, postConvWidth, postConvHeight, 1, border, internalFormat); + /* Choose actual texture format */ + texImage->TexFormat = + ctx->Driver.ChooseTextureFormat(ctx, internalFormat, + format, type); + ASSERT(texImage->TexFormat != MESA_FORMAT_NONE); + /* Give the texture to the driver. may be null. */ ASSERT(ctx->Driver.TexImage2D); ctx->Driver.TexImage2D(ctx, target, level, internalFormat, @@ -2423,6 +2435,12 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, width, height, depth, border, internalFormat); + /* Choose actual texture format */ + texImage->TexFormat = + ctx->Driver.ChooseTextureFormat(ctx, internalFormat, + format, type); + ASSERT(texImage->TexFormat != MESA_FORMAT_NONE); + /* Give the texture to the driver. may be null. */ ASSERT(ctx->Driver.TexImage3D); ctx->Driver.TexImage3D(ctx, target, level, internalFormat, @@ -2735,6 +2753,12 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, _mesa_init_teximage_fields(ctx, target, texImage, postConvWidth, 1, 1, border, internalFormat); + /* Choose actual texture format */ + texImage->TexFormat = + ctx->Driver.ChooseTextureFormat(ctx, internalFormat, + GL_NONE, GL_NONE); + ASSERT(texImage->TexFormat != MESA_FORMAT_NONE); + ASSERT(ctx->Driver.CopyTexImage1D); ctx->Driver.CopyTexImage1D(ctx, target, level, internalFormat, x, y, width, border); @@ -2812,6 +2836,12 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, postConvWidth, postConvHeight, 1, border, internalFormat); + /* Choose actual texture format */ + texImage->TexFormat = + ctx->Driver.ChooseTextureFormat(ctx, internalFormat, + GL_NONE, GL_NONE); + ASSERT(texImage->TexFormat != MESA_FORMAT_NONE); + ASSERT(ctx->Driver.CopyTexImage2D); ctx->Driver.CopyTexImage2D(ctx, target, level, internalFormat, x, y, width, height, border); @@ -3290,6 +3320,12 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, _mesa_init_teximage_fields(ctx, target, texImage, width, 1, 1, border, internalFormat); + /* Choose actual texture format */ + texImage->TexFormat = + ctx->Driver.ChooseTextureFormat(ctx, internalFormat, + GL_NONE, GL_NONE); + ASSERT(texImage->TexFormat != MESA_FORMAT_NONE); + ASSERT(ctx->Driver.CompressedTexImage1D); ctx->Driver.CompressedTexImage1D(ctx, target, level, internalFormat, width, border, @@ -3396,6 +3432,12 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, _mesa_init_teximage_fields(ctx, target, texImage, width, height, 1, border, internalFormat); + /* Choose actual texture format */ + texImage->TexFormat = + ctx->Driver.ChooseTextureFormat(ctx, internalFormat, + GL_NONE, GL_NONE); + ASSERT(texImage->TexFormat != MESA_FORMAT_NONE); + ASSERT(ctx->Driver.CompressedTexImage2D); ctx->Driver.CompressedTexImage2D(ctx, target, level, internalFormat, width, height, @@ -3501,6 +3543,12 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, width, height, depth, border, internalFormat); + /* Choose actual texture format */ + texImage->TexFormat = + ctx->Driver.ChooseTextureFormat(ctx, internalFormat, + GL_NONE, GL_NONE); + ASSERT(texImage->TexFormat != MESA_FORMAT_NONE); + ASSERT(ctx->Driver.CompressedTexImage3D); ctx->Driver.CompressedTexImage3D(ctx, target, level, internalFormat, diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index dd146254b4..692923ba0a 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3250,10 +3250,6 @@ _mesa_store_teximage1d(GLcontext *ctx, GLenum target, GLint level, GLuint sizeInBytes; (void) border; - texImage->TexFormat - = ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type); - ASSERT(texImage->TexFormat); - /* allocate memory */ sizeInBytes = texture_size(texImage); texImage->Data = _mesa_alloc_texmemory(sizeInBytes); @@ -3311,10 +3307,6 @@ _mesa_store_teximage2d(GLcontext *ctx, GLenum target, GLint level, GLuint sizeInBytes; (void) border; - texImage->TexFormat - = ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type); - ASSERT(texImage->TexFormat); - /* allocate memory */ sizeInBytes = texture_size(texImage); texImage->Data = _mesa_alloc_texmemory(sizeInBytes); @@ -3368,10 +3360,6 @@ _mesa_store_teximage3d(GLcontext *ctx, GLenum target, GLint level, GLuint sizeInBytes; (void) border; - texImage->TexFormat - = ctx->Driver.ChooseTextureFormat(ctx, internalFormat, format, type); - ASSERT(texImage->TexFormat); - /* allocate memory */ sizeInBytes = texture_size(texImage); texImage->Data = _mesa_alloc_texmemory(sizeInBytes); @@ -3570,10 +3558,6 @@ _mesa_store_compressed_teximage2d(GLcontext *ctx, GLenum target, GLint level, ASSERT(texImage->Depth == 1); ASSERT(texImage->Data == NULL); /* was freed in glCompressedTexImage2DARB */ - texImage->TexFormat - = ctx->Driver.ChooseTextureFormat(ctx, internalFormat, 0, 0); - ASSERT(texImage->TexFormat); - /* allocate storage */ texImage->Data = _mesa_alloc_texmemory(imageSize); if (!texImage->Data) { diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 4397adbc12..e8bb720acc 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -555,10 +555,6 @@ st_TexImage(GLcontext * ctx, } #endif - /* choose the texture format */ - texImage->TexFormat = st_ChooseTextureFormat(ctx, internalFormat, - format, type); - _mesa_set_fetch_functions(texImage, dims); if (_mesa_is_format_compressed(texImage->TexFormat)) { -- cgit v1.2.3 From 827002f5ff990f8676385583275d6b8090abfb7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 26 Oct 2009 01:46:21 +0100 Subject: r300g: add cubemap support Also, set a pitch for rectangles only. --- src/gallium/drivers/r300/r300_screen.c | 6 +--- src/gallium/drivers/r300/r300_texture.c | 55 +++++++++++++++++++++------------ 2 files changed, 37 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index f581f0ca09..6eaf35bd4b 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -277,14 +277,10 @@ static boolean r300_is_format_supported(struct pipe_screen* pscreen, case PIPE_TEXTURE_1D: /* handle 1D textures as 2D ones */ case PIPE_TEXTURE_2D: case PIPE_TEXTURE_3D: + case PIPE_TEXTURE_CUBE: return check_tex_format(format, tex_usage, r300_screen(pscreen)->caps->is_r500); - case PIPE_TEXTURE_CUBE: - debug_printf("r300: Implementation error: Unsupported format " - "target: %d\n", target); - break; - default: debug_printf("r300: Fatal: This is not a format target: %d\n", target); diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 762806822c..2a33393a8c 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -27,18 +27,31 @@ #include "r300_context.h" #include "r300_texture.h" +#include "r300_screen.h" -static void r300_setup_texture_state(struct r300_texture* tex) +static void r300_setup_texture_state(struct r300_texture* tex, boolean is_r500) { struct r300_texture_state* state = &tex->state; struct pipe_texture *pt = &tex->tex; + unsigned stride; state->format0 = R300_TX_WIDTH((pt->width[0] - 1) & 0x7ff) | - R300_TX_HEIGHT((pt->height[0] - 1) & 0x7ff) | - R300_TX_DEPTH(util_logbase2(pt->depth[0]) & 0xf) | - R300_TX_NUM_LEVELS(pt->last_level & 0xf);/* | - R300_TX_PITCH_EN;*/ - /* XXX TX_PITCH_EN breaks rendering mipmap levels > 0, weard */ + R300_TX_HEIGHT((pt->height[0] - 1) & 0x7ff); + + if (!util_is_power_of_two(pt->width[0]) || + !util_is_power_of_two(pt->height[0])) { + + /* rectangles love this */ + state->format0 |= R300_TX_PITCH_EN; + + stride = r300_texture_get_stride(tex, 0) / pt->block.size; + state->format2 = (stride - 1) & 0x1fff; + } + else { + /* power of two textures (3D, mipmaps, and no pitch) */ + state->format0 |= R300_TX_DEPTH(util_logbase2(pt->depth[0]) & 0xf) | + R300_TX_NUM_LEVELS(pt->last_level & 0xf); + } /* XXX */ state->format1 = r300_translate_texformat(pt->format); @@ -49,17 +62,17 @@ static void r300_setup_texture_state(struct r300_texture* tex) state->format1 |= R300_TX_FORMAT_3D; } - state->format2 = ((r300_texture_get_stride(tex, 0) / pt->block.size) - 1) - & 0x1fff; - - /* Don't worry about accidentally setting this bit on non-r500; - * the kernel should catch it. */ - if (pt->width[0] > 2048) { - state->format2 |= R500_TXWIDTH_BIT11; - } - if (pt->height[0] > 2048) { - state->format2 |= R500_TXHEIGHT_BIT11; + /* large textures on r500 */ + if (is_r500) + { + if (pt->width[0] > 2048) { + state->format2 |= R500_TXWIDTH_BIT11; + } + if (pt->height[0] > 2048) { + state->format2 |= R500_TXHEIGHT_BIT11; + } } + assert(is_r500 || (pt->width[0] <= 2048 && pt->height[0] <= 2048)); debug_printf("r300: Set texture state (%dx%d, %d levels)\n", pt->width[0], pt->height[0], pt->last_level); @@ -121,7 +134,11 @@ static void r300_setup_miptree(struct r300_texture* tex) stride = r300_texture_get_stride(tex, i); layer_size = stride * base->nblocksy[i]; - size = layer_size * base->depth[i]; + + if (base->target == PIPE_TEXTURE_CUBE) + size = layer_size * 6; + else + size = layer_size * base->depth[i]; tex->offset[i] = align(tex->size, 32); tex->size = tex->offset[i] + size; @@ -151,7 +168,7 @@ static struct pipe_texture* r300_setup_miptree(tex); - r300_setup_texture_state(tex); + r300_setup_texture_state(tex, r300_screen(screen)->caps->is_r500); tex->buffer = screen->buffer_create(screen, 1024, PIPE_BUFFER_USAGE_PIXEL, @@ -229,7 +246,7 @@ static struct pipe_texture* tex->stride_override = *stride; - r300_setup_texture_state(tex); + r300_setup_texture_state(tex, r300_screen(screen)->caps->is_r500); pipe_buffer_reference(&tex->buffer, buffer); -- cgit v1.2.3 From 5241b9568c1f97eb9aca8be5eb7a3ef659d9917f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 26 Oct 2009 01:47:55 +0100 Subject: r300g: read occlusion query results from both Z pipes on RV530 --- src/gallium/drivers/r300/r300_query.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_query.c b/src/gallium/drivers/r300/r300_query.c index 007f11efae..ca00b043c5 100644 --- a/src/gallium/drivers/r300/r300_query.c +++ b/src/gallium/drivers/r300/r300_query.c @@ -113,7 +113,7 @@ static boolean r300_get_query_result(struct pipe_context* pipe, unsigned flags = PIPE_BUFFER_USAGE_CPU_READ; uint32_t* map; uint32_t temp = 0; - unsigned i; + unsigned i, num_results; if (q->flushed == FALSE) pipe->flush(pipe, 0, NULL); @@ -125,7 +125,13 @@ static boolean r300_get_query_result(struct pipe_context* pipe, if (!map) return FALSE; map += q->offset / 4; - for (i = 0; i < r300screen->caps->num_frag_pipes; i++) { + + if (r300screen->caps->family == CHIP_FAMILY_RV530) + num_results = r300screen->caps->num_z_pipes; + else + num_results = r300screen->caps->num_frag_pipes; + + for (i = 0; i < num_results; i++) { if (*map == ~0U) { /* Looks like our results aren't ready yet. */ if (wait) { -- cgit v1.2.3 From 6b8ce4cc4f9acdd9227e26a812dd911f45b623a5 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Fri, 23 Oct 2009 16:18:10 -0400 Subject: st/xorg: add yuv shaders --- src/gallium/state_trackers/xorg/xorg_exa_tgsi.c | 75 +++++++++++++++++++++++-- src/gallium/state_trackers/xorg/xorg_exa_tgsi.h | 8 +-- src/gallium/state_trackers/xorg/xorg_xv.c | 16 +++--- 3 files changed, 83 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c index 3c90dab3c5..9503891701 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c @@ -277,6 +277,70 @@ create_vs(struct pipe_context *pipe, return ureg_create_shader_and_destroy(ureg, pipe); } +static void * +create_yuv_shader(struct pipe_context *pipe, struct ureg_program *ureg) +{ + struct ureg_src y_sampler, u_sampler, v_sampler; + struct ureg_src pos; + struct ureg_src matrow0, matrow1, matrow2; + struct ureg_dst y, u, v, rgb; + struct ureg_dst out = ureg_DECL_output(ureg, + TGSI_SEMANTIC_COLOR, + 0); + + pos = ureg_DECL_fs_input(ureg, + TGSI_SEMANTIC_GENERIC, + 0, + TGSI_INTERPOLATE_PERSPECTIVE); + + rgb = ureg_DECL_temporary(ureg); + y = ureg_DECL_temporary(ureg); + u = ureg_DECL_temporary(ureg); + v = ureg_DECL_temporary(ureg); + + y_sampler = ureg_DECL_sampler(ureg, 0); + u_sampler = ureg_DECL_sampler(ureg, 1); + v_sampler = ureg_DECL_sampler(ureg, 2); + + matrow0 = ureg_DECL_constant(ureg, 0); + matrow1 = ureg_DECL_constant(ureg, 1); + matrow2 = ureg_DECL_constant(ureg, 2); + + ureg_TEX(ureg, y, + TGSI_TEXTURE_2D, pos, y_sampler); + ureg_TEX(ureg, u, + TGSI_TEXTURE_2D, pos, u_sampler); + ureg_TEX(ureg, v, + TGSI_TEXTURE_2D, pos, v_sampler); + + ureg_MUL(ureg, rgb, + ureg_scalar(ureg_src(y), TGSI_SWIZZLE_X), + matrow0); + ureg_MAD(ureg, rgb, + ureg_scalar(ureg_src(u), TGSI_SWIZZLE_X), + matrow1, + ureg_src(rgb)); + ureg_MAD(ureg, rgb, + ureg_scalar(ureg_src(v), TGSI_SWIZZLE_X), + matrow2, + ureg_src(rgb)); + + /* rgb.a = 1; */ + ureg_MOV(ureg, ureg_writemask(rgb, TGSI_WRITEMASK_W), + ureg_scalar(matrow0, TGSI_SWIZZLE_X)); + + ureg_MOV(ureg, out, ureg_src(rgb)); + + ureg_release_temporary(ureg, rgb); + ureg_release_temporary(ureg, y); + ureg_release_temporary(ureg, u); + ureg_release_temporary(ureg, v); + + ureg_END(ureg); + + return ureg_create_shader_and_destroy(ureg, pipe); +} + static void * create_fs(struct pipe_context *pipe, unsigned fs_traits) @@ -293,13 +357,14 @@ create_fs(struct pipe_context *pipe, boolean is_lingrad = fs_traits & FS_LINGRAD_FILL; boolean is_radgrad = fs_traits & FS_RADGRAD_FILL; unsigned comp_alpha = fs_traits & FS_COMPONENT_ALPHA; + boolean is_yuv = fs_traits & FS_YUV; ureg = ureg_create(TGSI_PROCESSOR_FRAGMENT); if (ureg == NULL) return 0; - /* it has to be either a fill or a composite op */ - debug_assert(is_fill ^ is_composite); + /* it has to be either a fill, a composite op or a yuv conversion */ + debug_assert((is_fill ^ is_composite) ^ is_yuv); out = ureg_DECL_output(ureg, TGSI_SEMANTIC_COLOR, @@ -311,8 +376,7 @@ create_fs(struct pipe_context *pipe, TGSI_SEMANTIC_GENERIC, 0, TGSI_INTERPOLATE_PERSPECTIVE); - } else { - debug_assert(is_fill); + } else if (is_fill) { if (is_solid) src_input = ureg_DECL_fs_input(ureg, TGSI_SEMANTIC_COLOR, @@ -323,6 +387,9 @@ create_fs(struct pipe_context *pipe, TGSI_SEMANTIC_POSITION, 0, TGSI_INTERPOLATE_PERSPECTIVE); + } else { + debug_assert(is_yuv); + return create_yuv_shader(pipe, ureg); } if (has_mask) { diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h index 0ea44fa137..b373d1357b 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h @@ -21,13 +21,13 @@ enum xorg_fs_traits { FS_SOLID_FILL = 1 << 2, FS_LINGRAD_FILL = 1 << 3, FS_RADGRAD_FILL = 1 << 4, + FS_CA_FULL = 1 << 5, /* src.rgba * mask.rgba */ + FS_CA_SRCALPHA = 1 << 6, /* src.aaaa * mask.rgba */ + FS_YUV = 1<< 7, + FS_FILL = (FS_SOLID_FILL | FS_LINGRAD_FILL | FS_RADGRAD_FILL), - /* src.rgba * mask.rgba */ - FS_CA_FULL = 1 << 5, - /* src.aaaa * mask.rgba */ - FS_CA_SRCALPHA = 1 << 6, FS_COMPONENT_ALPHA = (FS_CA_FULL | FS_CA_SRCALPHA) }; diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index efac9275b2..6d057b4c75 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -20,16 +20,16 @@ /* The ITU-R BT.601 conversion matrix for SDTV. */ static const float bt_601[] = { - 1.0, 0.0, 1.4075, - 1.0, -0.3455, -0.7169, - 1.0, 1.7790, 0. + 1.0, 0.0, 1.4075, 0, + 1.0, -0.3455, -0.7169, 0, + 1.0, 1.7790, 0., 0, }; /* The ITU-R BT.709 conversion matrix for HDTV. */ static const float bt_709[] = { - 1.0, 0.0, 1.581, - 1.0, -0.1881, -0.47, - 1.0, 1.8629, 0. + 1.0, 0.0, 1.581, 0, + 1.0, -0.1881, -0.47, 0, + 1.0, 1.8629, 0., 0, }; #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) @@ -284,8 +284,8 @@ static void setup_video_constants(struct xorg_renderer *r, boolean hdtv) { struct pipe_context *pipe = r->pipe; - const int param_bytes = 9 * sizeof(float); - struct pipe_constant_buffer *cbuf = &r->vs_const_buffer; + const int param_bytes = 12 * sizeof(float); + struct pipe_constant_buffer *cbuf = &r->fs_const_buffer; pipe_buffer_reference(&cbuf->buffer, NULL); cbuf->buffer = pipe_buffer_create(pipe->screen, 16, -- cgit v1.2.3 From a9f8baf00b264a9b370ecb611334af3063674ce5 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Sat, 24 Oct 2009 01:05:40 -0400 Subject: st/xorg: add yuv vertex shader plus some general fixes --- src/gallium/state_trackers/xorg/xorg_exa_tgsi.c | 15 +++ src/gallium/state_trackers/xorg/xorg_exa_tgsi.h | 4 +- src/gallium/state_trackers/xorg/xorg_renderer.c | 45 +++++++ src/gallium/state_trackers/xorg/xorg_renderer.h | 2 +- src/gallium/state_trackers/xorg/xorg_xv.c | 167 +++++++++++++++++++----- 5 files changed, 200 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c index 9503891701..7cb11dc42b 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c @@ -236,6 +236,7 @@ create_vs(struct pipe_context *pipe, boolean is_fill = vs_traits & VS_FILL; boolean is_composite = vs_traits & VS_COMPOSITE; boolean has_mask = vs_traits & VS_MASK; + boolean is_yuv = vs_traits & VS_YUV; unsigned input_slot = 0; ureg = ureg_create(TGSI_PROCESSOR_VERTEX); @@ -254,6 +255,20 @@ create_vs(struct pipe_context *pipe, const0, const1); ureg_MOV(ureg, dst, src); + if (is_yuv) { + src = ureg_DECL_vs_input(ureg, input_slot++); + dst = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 0); + ureg_MOV(ureg, dst, src); + + src = ureg_DECL_vs_input(ureg, input_slot++); + dst = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 1); + ureg_MOV(ureg, dst, src); + + src = ureg_DECL_vs_input(ureg, input_slot++); + dst = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 2); + ureg_MOV(ureg, dst, src); + } + if (is_composite) { src = ureg_DECL_vs_input(ureg, input_slot++); dst = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 0); diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h index b373d1357b..d3bfa304c2 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h @@ -9,10 +9,12 @@ enum xorg_vs_traits { VS_SOLID_FILL = 1 << 2, VS_LINGRAD_FILL = 1 << 3, VS_RADGRAD_FILL = 1 << 4, + VS_YUV = 1 << 5, + + VS_FILL = (VS_SOLID_FILL | VS_LINGRAD_FILL | VS_RADGRAD_FILL) - /*VS_TRANSFORM = 1 << 5*/ }; enum xorg_fs_traits { diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 51941f091c..ec5268f9d6 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -224,6 +224,44 @@ setup_vertex_data2(struct xorg_renderer *r, sizeof(r->vertices3)); } +static struct pipe_buffer * +setup_vertex_data_yuv(struct xorg_renderer *r, + float srcX, float srcY, + float dstX, float dstY, + float width, float height, + struct pipe_texture **tex) +{ + float s0, t0, s1, t1; + float spt0[2], spt1[2]; + + spt0[0] = srcX; + spt0[1] = srcY; + spt1[0] = srcX + width; + spt1[1] = srcY + height; + + s0 = spt0[0] / tex[0]->width[0]; + t0 = spt0[1] / tex[0]->height[0]; + s1 = spt1[0] / tex[0]->width[0]; + t1 = spt1[1] / tex[0]->height[0]; + + /* 1st vertex */ + setup_vertex1(r->vertices2[0], dstX, dstY, s0, t0); + /* 2nd vertex */ + setup_vertex1(r->vertices2[1], dstX + width, dstY, + s1, t0); + /* 3rd vertex */ + setup_vertex1(r->vertices2[2], dstX + width, dstY + height, + s1, t1); + /* 4th vertex */ + setup_vertex1(r->vertices2[3], dstX, dstY + height, + s0, t1); + + + return pipe_user_buffer_create(r->pipe->screen, + r->vertices2, + sizeof(r->vertices2)); +} + static void @@ -825,6 +863,13 @@ void renderer_draw_textures(struct xorg_renderer *r, textures[0], textures[1], src_matrix, mask_matrix); break; + case 3: + buf = setup_vertex_data_yuv(r, + pos[0], pos[1], + pos[2], pos[3], + width, height, + textures); + break; default: debug_assert(!"Unsupported number of textures"); break; diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h index 3e37c9aa93..f86ef670be 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.h +++ b/src/gallium/state_trackers/xorg/xorg_renderer.h @@ -16,7 +16,7 @@ struct xorg_renderer { struct pipe_constant_buffer vs_const_buffer; struct pipe_constant_buffer fs_const_buffer; - /* we should combine these two */ + /* we should combine these three */ float vertices2[4][2][4]; float vertices3[4][3][4]; }; diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index 6d057b4c75..983310f9b5 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -6,6 +6,9 @@ #include "xorg_exa.h" #include "xorg_renderer.h" +#include "xorg_exa_tgsi.h" + +#include "cso_cache/cso_context.h" #include "pipe/p_screen.h" #include "pipe/p_inlines.h" @@ -280,43 +283,144 @@ copy_packed_data(ScrnInfoPtr pScrn, screen->tex_transfer_destroy(vtrans); } + +static void +setup_vs_video_constants(struct xorg_renderer *r, struct exa_pixmap_priv *dst) +{ + int width = dst->tex->width[0]; + int height = dst->tex->height[0]; + const int param_bytes = 8 * sizeof(float); + float vs_consts[8] = { + 2.f/width, 2.f/height, 1, 1, + -1, -1, 0, 0 + }; + + renderer_set_constants(r, PIPE_SHADER_VERTEX, + vs_consts, param_bytes); +} + static void -setup_video_constants(struct xorg_renderer *r, boolean hdtv) +setup_fs_video_constants(struct xorg_renderer *r, boolean hdtv) { - struct pipe_context *pipe = r->pipe; const int param_bytes = 12 * sizeof(float); - struct pipe_constant_buffer *cbuf = &r->fs_const_buffer; + const float *video_constants = (hdtv) ? bt_709 : bt_601; + + renderer_set_constants(r, PIPE_SHADER_FRAGMENT, + video_constants, param_bytes); +} + +static void +draw_yuv(struct xorg_xv_port_priv *port, int src_x, int src_y, + int dst_x, int dst_y, + int w, int h) +{ + int pos[4] = {src_x, src_y, + dst_x, dst_y}; + struct pipe_texture **textures = port->yuv[port->current_set]; + + renderer_draw_textures(port->r, + pos, w, h, + textures, + 3, /*bound samplers/textures */ + NULL, NULL /* no transformations */); +} + +static void +bind_blend_state(struct xorg_xv_port_priv *port) +{ + struct pipe_blend_state blend; + + memset(&blend, 0, sizeof(struct pipe_blend_state)); + blend.blend_enable = 1; + blend.colormask |= PIPE_MASK_RGBA; + + /* porter&duff src */ + blend.rgb_src_factor = PIPE_BLENDFACTOR_ONE; + blend.alpha_src_factor = PIPE_BLENDFACTOR_ONE; + blend.rgb_dst_factor = PIPE_BLENDFACTOR_ZERO; + blend.alpha_dst_factor = PIPE_BLENDFACTOR_ZERO; - pipe_buffer_reference(&cbuf->buffer, NULL); - cbuf->buffer = pipe_buffer_create(pipe->screen, 16, - PIPE_BUFFER_USAGE_CONSTANT, - param_bytes); + cso_set_blend(port->r->cso, &blend); +} + + +static void +bind_shaders(struct xorg_xv_port_priv *port) +{ + unsigned vs_traits = 0, fs_traits = 0; + struct xorg_shader shader; - if (cbuf->buffer) { - const float *video_constants = (hdtv) ? bt_709 : bt_601; + vs_traits |= VS_YUV; + fs_traits |= FS_YUV; - pipe_buffer_write(pipe->screen, cbuf->buffer, - 0, param_bytes, video_constants); + shader = xorg_shaders_get(port->r->shaders, vs_traits, fs_traits); + cso_set_vertex_shader_handle(port->r->cso, shader.vs); + cso_set_fragment_shader_handle(port->r->cso, shader.fs); +} + +static INLINE void +conditional_flush(struct pipe_context *pipe, struct pipe_texture **tex, + int num) +{ + int i; + for (i = 0; i < num; ++i) { + if (tex[i] && pipe->is_texture_referenced(pipe, tex[i], 0, 0) & + PIPE_REFERENCED_FOR_WRITE) { + pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); + return; + } } - pipe->set_constant_buffer(pipe, PIPE_SHADER_FRAGMENT, 0, cbuf); +} + +static void +bind_samplers(struct xorg_xv_port_priv *port) +{ + struct pipe_sampler_state *samplers[PIPE_MAX_SAMPLERS]; + struct pipe_sampler_state sampler; + struct pipe_texture **dst = port->yuv[port->current_set]; + + memset(&sampler, 0, sizeof(struct pipe_sampler_state)); + + conditional_flush(port->r->pipe, dst, 3); + + sampler.wrap_s = PIPE_TEX_WRAP_CLAMP; + sampler.wrap_t = PIPE_TEX_WRAP_CLAMP; + sampler.min_img_filter = PIPE_TEX_FILTER_LINEAR; + sampler.mag_img_filter = PIPE_TEX_FILTER_LINEAR; + sampler.min_mip_filter = PIPE_TEX_MIPFILTER_NEAREST; + sampler.normalized_coords = 1; + + samplers[0] = &sampler; + samplers[1] = &sampler; + samplers[2] = &sampler; + + + cso_set_samplers(port->r->cso, 3, + (const struct pipe_sampler_state **)samplers); + cso_set_sampler_textures(port->r->cso, 3, + dst); } static int display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id, RegionPtr dstRegion, + int src_x, int src_y, int src_w, int src_h, + int dstX, int dstY, short width, short height, - int x1, int y1, int x2, int y2, - short src_w, short src_h, short drw_w, short drw_h, PixmapPtr pPixmap) { + modesettingPtr ms = modesettingPTR(pScrn); BoxPtr pbox; int nbox; int dxo, dyo; Bool hdtv; - float tc0[2], tc1[2], tc2[2]; + int x, y, w, h; + struct exa_pixmap_priv *dst = exaGetPixmapDriverPrivate(pPixmap); + + if (!dst || !dst->tex) + XORG_FALLBACK("Xv destination %s", !dst ? "!dst" : "!dst->tex"); hdtv = ((src_w >= RES_720P_X) && (src_h >= RES_720P_Y)); - setup_video_constants(pPriv->r, hdtv); REGION_TRANSLATE(pScrn->pScreen, dstRegion, -pPixmap->screen_x, -pPixmap->screen_y); @@ -327,32 +431,32 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id, pbox = REGION_RECTS(dstRegion); nbox = REGION_NUM_RECTS(dstRegion); + renderer_bind_framebuffer(pPriv->r, dst); + renderer_bind_viewport(pPriv->r, dst); + bind_blend_state(pPriv); + renderer_bind_rasterizer(pPriv->r); + bind_shaders(pPriv); + bind_samplers(pPriv); + setup_vs_video_constants(pPriv->r, dst); + setup_fs_video_constants(pPriv->r, hdtv); + while (nbox--) { int box_x1 = pbox->x1; int box_y1 = pbox->y1; int box_x2 = pbox->x2; int box_y2 = pbox->y2; - tc0[0] = (double) (box_x1 - dxo) / (double) drw_w; /* u0 */ - tc0[1] = (double) (box_y1 - dyo) / (double) drw_h; /* v0 */ - tc1[0] = (double) (box_x2 - dxo) / (double) drw_w; /* u1 */ - tc1[1] = tc0[1]; - tc2[0] = tc0[0]; - tc2[1] = (double) (box_y2 - dyo) / (double) drw_h; /* v1 */ - -#if 0 x = box_x1; y = box_y1; w = box_x2 - box_x1; h = box_y2 - box_y1; + draw_yuv(pPriv, x, y, x, y, w, h); + pbox++; - draw_yuv(pScrn, x, y, w, h, &src, 1, FALSE, - 0, tc0, tc1, tc2, 1, - pPriv->conversionData); -#endif } DamageDamageRegion(&pPixmap->drawable, dstRegion); + return TRUE; } @@ -412,9 +516,10 @@ put_image(ScrnInfoPtr pScrn, pPixmap = (PixmapPtr)pDraw; } - display_video(pScrn, pPriv, id, clipBoxes, width, height, - x1, y1, x2, y2, - src_w, src_h, drw_w, drw_h, pPixmap); + display_video(pScrn, pPriv, id, clipBoxes, + src_x, src_y, src_w, src_h, + drw_x, drw_y, + drw_w, drw_h, pPixmap); pPriv->current_set = (pPriv->current_set + 1) & 1; return Success; -- cgit v1.2.3 From 0b069d648b787636cc57149f47a06fb16f7629ab Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Sat, 24 Oct 2009 01:29:27 -0400 Subject: st/xorg: stop overflowing yuv buffers --- src/gallium/state_trackers/xorg/xorg_exa_tgsi.c | 2 +- src/gallium/state_trackers/xorg/xorg_xv.c | 55 ++++++++++++++++--------- 2 files changed, 37 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c index 7cb11dc42b..30fcff8a49 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c @@ -247,7 +247,7 @@ create_vs(struct pipe_context *pipe, const1 = ureg_DECL_constant(ureg, 1); /* it has to be either a fill or a composite op */ - debug_assert(is_fill ^ is_composite); + debug_assert((is_fill ^ is_composite) ^ is_yuv); src = ureg_DECL_vs_input(ureg, input_slot++); dst = ureg_DECL_output(ureg, TGSI_SEMANTIC_POSITION, 0); diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index 983310f9b5..b054ba8066 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -216,6 +216,7 @@ copy_packed_data(ScrnInfoPtr pScrn, char *ymap, *vmap, *umap; unsigned char y1, y2, u, v; int yidx, uidx, vidx; + int y_array_size = w * h; src = buf + (top * srcPitch) + (left << 1); @@ -232,13 +233,12 @@ copy_packed_data(ScrnInfoPtr pScrn, PIPE_TRANSFER_WRITE, left, top, w, h); - ymap = screen->transfer_map(screen, ytrans); - umap = screen->transfer_map(screen, utrans); - vmap = screen->transfer_map(screen, vtrans); + ymap = (char*)screen->transfer_map(screen, ytrans); + umap = (char*)screen->transfer_map(screen, utrans); + vmap = (char*)screen->transfer_map(screen, vtrans); switch (id) { case FOURCC_YV12: { - int y_array_size = w * h; for (i = 0; i < w; ++i) { for (j = 0; i < h; ++j) { /*XXX use src? */ @@ -252,22 +252,39 @@ copy_packed_data(ScrnInfoPtr pScrn, } } break; + case FOURCC_UYVY: + for (i = 0; i < y_array_size; i +=2 ) { + /* extracting two pixels */ + u = buf[0]; + y1 = buf[1]; + v = buf[2]; + y2 = buf[3]; + buf += 4; + + ymap[yidx++] = y1; + ymap[yidx++] = y2; + umap[uidx++] = u; + umap[uidx++] = u; + vmap[vidx++] = v; + vmap[vidx++] = v; + } + break; case FOURCC_YUY2: - for (j = 0; j < h; ++j) { - for (i = 0; i < w; ++i) { - /* extracting two pixels */ - y1 = buf[0]; - u = buf[1]; - y2 = buf[2]; - v = buf[3]; - - ymap[yidx++] = y1; - ymap[yidx++] = y2; - umap[uidx++] = u; - umap[uidx++] = u; - vmap[vidx++] = v; - vmap[vidx++] = v; - } + for (i = 0; i < y_array_size; i +=2 ) { + /* extracting two pixels */ + y1 = buf[0]; + u = buf[1]; + y2 = buf[2]; + v = buf[3]; + + buf += 4; + + ymap[yidx++] = y1; + ymap[yidx++] = y2; + umap[uidx++] = u; + umap[uidx++] = u; + vmap[vidx++] = v; + vmap[vidx++] = v; } break; default: -- cgit v1.2.3 From b5fb60041edfa62c16e918829df22c4a52c09da9 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Sat, 24 Oct 2009 01:43:47 -0400 Subject: st/xorg: initialize indexes before reswizzling for yuv --- src/gallium/state_trackers/xorg/xorg_xv.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index b054ba8066..f4b0d564d6 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -237,6 +237,8 @@ copy_packed_data(ScrnInfoPtr pScrn, umap = (char*)screen->transfer_map(screen, utrans); vmap = (char*)screen->transfer_map(screen, vtrans); + yidx = uidx = vidx = 0; + switch (id) { case FOURCC_YV12: { for (i = 0; i < w; ++i) { -- cgit v1.2.3 From c9d715da3936149b0d4ca9fef2f8b235bf9389b7 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sun, 25 Oct 2009 20:20:45 -0700 Subject: mesa: Add remap.c to SConscript. Signed-off-by: Chia-I Wu --- src/mesa/SConscript | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/SConscript b/src/mesa/SConscript index cad5676320..6810ad8321 100644 --- a/src/mesa/SConscript +++ b/src/mesa/SConscript @@ -78,6 +78,7 @@ if env['platform'] != 'winddk': 'main/rastpos.c', 'main/rbadaptors.c', 'main/readpix.c', + 'main/remap.c', 'main/renderbuffer.c', 'main/scissor.c', 'main/shaders.c', -- cgit v1.2.3 From 48dad9c93fd6fb46bf33a58a87de79eb5ffd6e67 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 26 Oct 2009 10:42:45 -0600 Subject: intel: fix GL state bugs in intel_texture_bitmap() Need to push texture state and polygon state too. Fixes rendering glitches seen in progs/demos/engine when changing the rendering mode (wireframe, texture modes). This makes bitmap rendering a little slower, unfortunately. --- src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index b543a0bbc3..18e6ebd17c 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -435,13 +435,14 @@ intel_texture_bitmap(GLcontext * ctx, } /* Save GL state before we start setting up our drawing */ - _mesa_PushAttrib(GL_ENABLE_BIT | GL_CURRENT_BIT | - GL_VIEWPORT_BIT); + _mesa_PushAttrib(GL_ENABLE_BIT | GL_CURRENT_BIT | GL_POLYGON_BIT | + GL_TEXTURE_BIT | GL_VIEWPORT_BIT); _mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT | GL_CLIENT_PIXEL_STORE_BIT); old_active_texture = ctx->Texture.CurrentUnit; _mesa_Disable(GL_POLYGON_STIPPLE); + _mesa_PolygonMode(GL_FRONT_AND_BACK, GL_FILL); /* Upload our bitmap data to an alpha texture */ _mesa_ActiveTextureARB(GL_TEXTURE0_ARB); @@ -501,8 +502,6 @@ intel_texture_bitmap(GLcontext * ctx, meta_restore_vertex_program(&intel->meta); _mesa_PopClientAttrib(); - _mesa_Disable(GL_TEXTURE_2D); /* asserted that it was disabled at entry */ - _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture); _mesa_PopAttrib(); _mesa_DeleteTextures(1, &texname); -- cgit v1.2.3 From 42732611d3bd3c428b376089a58c40537bbfe180 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 27 Oct 2009 09:13:27 -0600 Subject: draw: Fix memory leak. This would only be hit if we got and invalid index_size. --- src/gallium/auxiliary/draw/draw_pt_vcache.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache.c b/src/gallium/auxiliary/draw/draw_pt_vcache.c index 1a0527be63..d3f179ced1 100644 --- a/src/gallium/auxiliary/draw/draw_pt_vcache.c +++ b/src/gallium/auxiliary/draw/draw_pt_vcache.c @@ -394,6 +394,7 @@ vcache_check_run( struct draw_pt_front_end *frontend, default: assert(0); + FREE(storage); return; } } @@ -422,6 +423,7 @@ vcache_check_run( struct draw_pt_front_end *frontend, default: assert(0); + FREE(storage); return; } } -- cgit v1.2.3 From f9e334cb32152fd342ac6b1dd4776215af6e1d49 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 09:27:44 -0600 Subject: Revert "i965: fix hacked Fallback usage in brw_prepare_vertices()" This reverts commit 8810b8f67135185d1044746bb861fe2ff997626c. It turns out the i965 driver uses the intel->Fallback field as a boolean, not as a bitmask. The intelFallback() function is a no-op in the i965 driver. It would have been nice if there were some comments about this. I'll fix that next... --- src/mesa/drivers/dri/i965/brw_context.h | 2 -- src/mesa/drivers/dri/i965/brw_draw_upload.c | 6 ++---- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index b1e7ec8465..da0e091bfd 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -116,8 +116,6 @@ */ -#define BRW_FALLBACK_DRAW (INTEL_FALLBACK_DRIVER << 0) - #define BRW_MAX_CURBE (32*16) struct brw_context; diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 4f8ceb37bd..9d089e113e 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -375,10 +375,9 @@ static void brw_prepare_vertices(struct brw_context *brw) * isn't an issue at this point. */ if (brw->vb.nr_enabled >= BRW_VEP_MAX) { - FALLBACK(intel, BRW_FALLBACK_DRAW, GL_TRUE); + intel->Fallback = 1; return; } - FALLBACK(intel, BRW_FALLBACK_DRAW, GL_FALSE); for (i = 0; i < brw->vb.nr_enabled; i++) { struct brw_vertex_element *input = brw->vb.enabled[i]; @@ -428,10 +427,9 @@ static void brw_prepare_vertices(struct brw_context *brw) /* Position array not properly enabled: */ if (input->glarray->StrideB == 0) { - FALLBACK(intel, BRW_FALLBACK_DRAW, GL_TRUE); + intel->Fallback = 1; return; } - FALLBACK(intel, BRW_FALLBACK_DRAW, GL_FALSE); interleave = input->glarray->StrideB; ptr = input->glarray->Ptr; -- cgit v1.2.3 From 43dc91f8bbb69499a6a0326a78e434b313f73c2c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 09:31:31 -0600 Subject: i965: be clear that the Fallback field is a boolean, not a bitfield --- src/mesa/drivers/dri/i965/brw_draw_upload.c | 4 ++-- src/mesa/drivers/dri/i965/brw_fallback.c | 6 +++++- src/mesa/drivers/dri/i965/brw_state_upload.c | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 9d089e113e..348c66154f 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -375,7 +375,7 @@ static void brw_prepare_vertices(struct brw_context *brw) * isn't an issue at this point. */ if (brw->vb.nr_enabled >= BRW_VEP_MAX) { - intel->Fallback = 1; + intel->Fallback = GL_TRUE; /* boolean, not bitfield */ return; } @@ -427,7 +427,7 @@ static void brw_prepare_vertices(struct brw_context *brw) /* Position array not properly enabled: */ if (input->glarray->StrideB == 0) { - intel->Fallback = 1; + intel->Fallback = GL_TRUE; /* boolean, not bitfield */ return; } diff --git a/src/mesa/drivers/dri/i965/brw_fallback.c b/src/mesa/drivers/dri/i965/brw_fallback.c index d27c6c24ca..562a17844b 100644 --- a/src/mesa/drivers/dri/i965/brw_fallback.c +++ b/src/mesa/drivers/dri/i965/brw_fallback.c @@ -133,7 +133,11 @@ const struct brw_tracked_state brw_check_fallback = { -/* Not used: +/** + * Called by the INTEL_FALLBACK() macro. + * NOTE: this is a no-op for the i965 driver. The brw->intel.Fallback + * field is treated as a boolean, not a bitmask. It's only set in a + * couple of places. */ void intelFallback( struct intel_context *intel, GLuint bit, GLboolean mode ) { diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index b817b741e7..ee447afa62 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -308,7 +308,7 @@ void brw_validate_state( struct brw_context *brw ) if (brw->state.dirty.brw & BRW_NEW_CONTEXT) brw_clear_batch_cache(brw); - brw->intel.Fallback = 0; + brw->intel.Fallback = GL_FALSE; /* boolean, not bitfield */ /* do prepare stage for all atoms */ for (i = 0; i < Elements(atoms); i++) { -- cgit v1.2.3 From 8a1f239ca9ccb61cd6713d1138e24492c84163c5 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 27 Oct 2009 17:35:06 +0100 Subject: st/xorg: Adopt to new dirty clip rect type --- src/gallium/state_trackers/xorg/xorg_driver.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 847647c1e4..26cf2dd772 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -484,11 +484,12 @@ static void xorgBlockHandler(int i, pointer blockData, pointer pTimeout, BoxPtr rect = REGION_RECTS(dirty); int i; + /* XXX no need for copy? */ for (i = 0; i < num_cliprects; i++, rect++) { - clip[i].x = rect->x1; - clip[i].y = rect->y1; - clip[i].width = rect->x2 - rect->x1; - clip[i].height = rect->y2 - rect->y1; + clip[i].x1 = rect->x1; + clip[i].y1 = rect->y1; + clip[i].x2 = rect->x2; + clip[i].y2 = rect->y2; } /* TODO query connector property to see if this is needed */ -- cgit v1.2.3 From 70b17db918a2784296434877a43b4c4036be792a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 27 Oct 2009 10:26:09 -0700 Subject: i915: Fix driver for the miptree x/y offset changes. Bug #24734. --- src/mesa/drivers/dri/i915/i830_texstate.c | 13 ++++++++++--- src/mesa/drivers/dri/i915/i915_texstate.c | 13 ++++++++++--- 2 files changed, 20 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index 6f998fa6f7..20ff46b0b0 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -160,11 +160,18 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) pitch = intelObj->pitchOverride; } else { + GLuint dst_x, dst_y; + + intel_miptree_get_image_offset(intelObj->mt, intelObj->firstLevel, 0, 0, + &dst_x, &dst_y); + dri_bo_reference(intelObj->mt->region->buffer); i830->state.tex_buffer[unit] = intelObj->mt->region->buffer; - i830->state.tex_offset[unit] = intel_miptree_image_offset(intelObj->mt, - 0, intelObj-> - firstLevel); + /* XXX: This calculation is probably broken for tiled images with + * a non-page-aligned offset. + */ + i830->state.tex_offset[unit] = (dst_x + dst_y * intelObj->mt->pitch) * + intelObj->mt->cpp; format = translate_texture_format(firstImage->TexFormat->MesaFormat, firstImage->InternalFormat); diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index 32d4b30cf9..998a04f794 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -171,11 +171,18 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) pitch = intelObj->pitchOverride; } else { + GLuint dst_x, dst_y; + + intel_miptree_get_image_offset(intelObj->mt, intelObj->firstLevel, 0, 0, + &dst_x, &dst_y); + dri_bo_reference(intelObj->mt->region->buffer); i915->state.tex_buffer[unit] = intelObj->mt->region->buffer; - i915->state.tex_offset[unit] = intel_miptree_image_offset(intelObj->mt, - 0, intelObj-> - firstLevel); + /* XXX: This calculation is probably broken for tiled images with + * a non-page-aligned offset. + */ + i915->state.tex_offset[unit] = (dst_x + dst_y * intelObj->mt->pitch) * + intelObj->mt->cpp; format = translate_texture_format(firstImage->TexFormat->MesaFormat, firstImage->InternalFormat, -- cgit v1.2.3 From 517ae7a3b65bca6770e8738464aa0ef526cc88b4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 16:28:39 -0600 Subject: glsl: fix memory leak A slightly modified version of a patch from Vinson Lee. --- src/mesa/shader/slang/slang_link.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 71038d2d94..144c126525 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -104,7 +104,7 @@ link_varying_vars(GLcontext *ctx, GLuint *map, i, firstVarying, newFile; GLbitfield *inOutFlags; - map = (GLuint *) malloc(prog->Varying->NumParameters * sizeof(GLuint)); + map = (GLuint *) _mesa_malloc(prog->Varying->NumParameters * sizeof(GLuint)); if (!map) return GL_FALSE; @@ -135,6 +135,7 @@ link_varying_vars(GLcontext *ctx, &shProg->Varying->Parameters[j]; if (var->Size != v->Size) { link_error(shProg, "mismatched varying variable types"); + _mesa_free(map); return GL_FALSE; } if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_CENTROID)) { @@ -142,6 +143,7 @@ link_varying_vars(GLcontext *ctx, _mesa_snprintf(msg, sizeof(msg), "centroid modifier mismatch for '%s'", var->Name); link_error(shProg, msg); + _mesa_free(map); return GL_FALSE; } if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_INVARIANT)) { @@ -149,6 +151,7 @@ link_varying_vars(GLcontext *ctx, _mesa_snprintf(msg, sizeof(msg), "invariant modifier mismatch for '%s'", var->Name); link_error(shProg, msg); + _mesa_free(map); return GL_FALSE; } } @@ -160,6 +163,7 @@ link_varying_vars(GLcontext *ctx, if (shProg->Varying->NumParameters > ctx->Const.MaxVarying) { link_error(shProg, "Too many varying variables"); + _mesa_free(map); return GL_FALSE; } @@ -199,7 +203,7 @@ link_varying_vars(GLcontext *ctx, } } - free(map); + _mesa_free(map); /* these will get recomputed before linking is completed */ prog->InputsRead = 0x0; -- cgit v1.2.3 From 22575abdec73312e010e016e381f7cf8761ad652 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 16:39:01 -0600 Subject: intel: fix src offset bug in do_copy_texsubimage() Use src->draw_offset intead of zero. Zero usually worked, except when the src renderbuffer is actually a texture mipmap level higher than zero. Fixes progs/test/blitfb.c test. --- src/mesa/drivers/dri/intel/intel_tex_copy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 9d58b11b14..95dee60f9c 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -158,7 +158,7 @@ do_copy_texsubimage(struct intel_context *intel, intelImage->mt->cpp, src_pitch, src->buffer, - 0, + src->draw_offset, src->tiling, intelImage->mt->pitch, dst_bo, -- cgit v1.2.3 From 7d967b9b7c08aea2a471c5bf6aced8bfafdae874 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Wed, 28 Oct 2009 00:30:45 +0100 Subject: nv50: activate more lanes in a warp MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some cards have crippling defaults set and use only 4 of 32 lanes. This should activate 16 on these. Those that allow 32 by default should still do so. Found out by Marcin Kościelnicki. --- src/gallium/drivers/nv50/nv50_screen.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index c672ea471a..c8d0f1e4d8 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -309,6 +309,10 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) so_method(so, screen->tesla, 0x121c, 1); so_data (so, 1); + /* try to activate all/more lanes (threads) in a warp */ + so_method(so, screen->tesla, 0x1400, 1); + so_data (so, 0xf); + so_method(so, screen->tesla, 0x13bc, 1); so_data (so, 0x54); /* origin is top left (set to 1 for bottom left) */ -- cgit v1.2.3 From fe818ea797033d77b814ee88c5b4e220226556ab Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 26 Oct 2009 10:42:45 -0600 Subject: intel: fix GL state bugs in intel_texture_bitmap() Need to push texture state and polygon state too. Fixes rendering glitches seen in progs/demos/engine when changing the rendering mode (wireframe, texture modes). This makes bitmap rendering a little slower, unfortunately. --- src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index 9a0bcc07a5..f313f8e442 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -435,13 +435,14 @@ intel_texture_bitmap(GLcontext * ctx, } /* Save GL state before we start setting up our drawing */ - _mesa_PushAttrib(GL_ENABLE_BIT | GL_CURRENT_BIT | - GL_VIEWPORT_BIT); + _mesa_PushAttrib(GL_ENABLE_BIT | GL_CURRENT_BIT | GL_POLYGON_BIT | + GL_TEXTURE_BIT | GL_VIEWPORT_BIT); _mesa_PushClientAttrib(GL_CLIENT_VERTEX_ARRAY_BIT | GL_CLIENT_PIXEL_STORE_BIT); old_active_texture = ctx->Texture.CurrentUnit; _mesa_Disable(GL_POLYGON_STIPPLE); + _mesa_PolygonMode(GL_FRONT_AND_BACK, GL_FILL); /* Upload our bitmap data to an alpha texture */ _mesa_ActiveTextureARB(GL_TEXTURE0_ARB); @@ -501,8 +502,6 @@ intel_texture_bitmap(GLcontext * ctx, meta_restore_vertex_program(&intel->meta); _mesa_PopClientAttrib(); - _mesa_Disable(GL_TEXTURE_2D); /* asserted that it was disabled at entry */ - _mesa_ActiveTextureARB(GL_TEXTURE0_ARB + old_active_texture); _mesa_PopAttrib(); _mesa_DeleteTextures(1, &texname); -- cgit v1.2.3 From b7ab7d362764bfc646e7d801fdba5c7c79c7c04f Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 27 Oct 2009 09:13:27 -0600 Subject: draw: Fix memory leak. This would only be hit if we got and invalid index_size. --- src/gallium/auxiliary/draw/draw_pt_vcache.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache.c b/src/gallium/auxiliary/draw/draw_pt_vcache.c index 1a0527be63..d3f179ced1 100644 --- a/src/gallium/auxiliary/draw/draw_pt_vcache.c +++ b/src/gallium/auxiliary/draw/draw_pt_vcache.c @@ -394,6 +394,7 @@ vcache_check_run( struct draw_pt_front_end *frontend, default: assert(0); + FREE(storage); return; } } @@ -422,6 +423,7 @@ vcache_check_run( struct draw_pt_front_end *frontend, default: assert(0); + FREE(storage); return; } } -- cgit v1.2.3 From 755161b88843f3cfead9a02e076d1a04687d9082 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 09:27:44 -0600 Subject: Revert "i965: fix hacked Fallback usage in brw_prepare_vertices()" This reverts commit 8810b8f67135185d1044746bb861fe2ff997626c. It turns out the i965 driver uses the intel->Fallback field as a boolean, not as a bitmask. The intelFallback() function is a no-op in the i965 driver. It would have been nice if there were some comments about this. I'll fix that next... --- src/mesa/drivers/dri/i965/brw_context.h | 2 -- src/mesa/drivers/dri/i965/brw_draw_upload.c | 6 ++---- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 01b6a4a168..7834569761 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -116,8 +116,6 @@ */ -#define BRW_FALLBACK_DRAW (INTEL_FALLBACK_DRIVER << 0) - #define BRW_MAX_CURBE (32*16) struct brw_context; diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 375afadcbe..a3ff6c58d8 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -375,10 +375,9 @@ static void brw_prepare_vertices(struct brw_context *brw) * isn't an issue at this point. */ if (brw->vb.nr_enabled >= BRW_VEP_MAX) { - FALLBACK(intel, BRW_FALLBACK_DRAW, GL_TRUE); + intel->Fallback = 1; return; } - FALLBACK(intel, BRW_FALLBACK_DRAW, GL_FALSE); for (i = 0; i < brw->vb.nr_enabled; i++) { struct brw_vertex_element *input = brw->vb.enabled[i]; @@ -428,10 +427,9 @@ static void brw_prepare_vertices(struct brw_context *brw) /* Position array not properly enabled: */ if (input->glarray->StrideB == 0) { - FALLBACK(intel, BRW_FALLBACK_DRAW, GL_TRUE); + intel->Fallback = 1; return; } - FALLBACK(intel, BRW_FALLBACK_DRAW, GL_FALSE); interleave = input->glarray->StrideB; ptr = input->glarray->Ptr; -- cgit v1.2.3 From e9b17d6477f99838fc7f261ea1b8d47eea12f42f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 09:31:31 -0600 Subject: i965: be clear that the Fallback field is a boolean, not a bitfield --- src/mesa/drivers/dri/i965/brw_draw_upload.c | 4 ++-- src/mesa/drivers/dri/i965/brw_fallback.c | 6 +++++- src/mesa/drivers/dri/i965/brw_state_upload.c | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index a3ff6c58d8..0fefbd9d81 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -375,7 +375,7 @@ static void brw_prepare_vertices(struct brw_context *brw) * isn't an issue at this point. */ if (brw->vb.nr_enabled >= BRW_VEP_MAX) { - intel->Fallback = 1; + intel->Fallback = GL_TRUE; /* boolean, not bitfield */ return; } @@ -427,7 +427,7 @@ static void brw_prepare_vertices(struct brw_context *brw) /* Position array not properly enabled: */ if (input->glarray->StrideB == 0) { - intel->Fallback = 1; + intel->Fallback = GL_TRUE; /* boolean, not bitfield */ return; } diff --git a/src/mesa/drivers/dri/i965/brw_fallback.c b/src/mesa/drivers/dri/i965/brw_fallback.c index d27c6c24ca..562a17844b 100644 --- a/src/mesa/drivers/dri/i965/brw_fallback.c +++ b/src/mesa/drivers/dri/i965/brw_fallback.c @@ -133,7 +133,11 @@ const struct brw_tracked_state brw_check_fallback = { -/* Not used: +/** + * Called by the INTEL_FALLBACK() macro. + * NOTE: this is a no-op for the i965 driver. The brw->intel.Fallback + * field is treated as a boolean, not a bitmask. It's only set in a + * couple of places. */ void intelFallback( struct intel_context *intel, GLuint bit, GLboolean mode ) { diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index b817b741e7..ee447afa62 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -308,7 +308,7 @@ void brw_validate_state( struct brw_context *brw ) if (brw->state.dirty.brw & BRW_NEW_CONTEXT) brw_clear_batch_cache(brw); - brw->intel.Fallback = 0; + brw->intel.Fallback = GL_FALSE; /* boolean, not bitfield */ /* do prepare stage for all atoms */ for (i = 0; i < Elements(atoms); i++) { -- cgit v1.2.3 From 4f9f5a78408dbd86b2f9c25ee8a15581b9122fcc Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 27 Oct 2009 10:26:09 -0700 Subject: i915: Fix driver for the miptree x/y offset changes. Bug #24734. --- src/mesa/drivers/dri/i915/i830_texstate.c | 12 ++++++++++-- src/mesa/drivers/dri/i915/i915_texstate.c | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index f270a13781..20ff46b0b0 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -160,10 +160,18 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) pitch = intelObj->pitchOverride; } else { + GLuint dst_x, dst_y; + + intel_miptree_get_image_offset(intelObj->mt, intelObj->firstLevel, 0, 0, + &dst_x, &dst_y); + dri_bo_reference(intelObj->mt->region->buffer); i830->state.tex_buffer[unit] = intelObj->mt->region->buffer; - i830->state.tex_offset[unit] = - intel_miptree_image_offset(intelObj->mt, 0, intelObj->firstLevel, 0); + /* XXX: This calculation is probably broken for tiled images with + * a non-page-aligned offset. + */ + i830->state.tex_offset[unit] = (dst_x + dst_y * intelObj->mt->pitch) * + intelObj->mt->cpp; format = translate_texture_format(firstImage->TexFormat->MesaFormat, firstImage->InternalFormat); diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index b2f82f5655..998a04f794 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -171,10 +171,18 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) pitch = intelObj->pitchOverride; } else { + GLuint dst_x, dst_y; + + intel_miptree_get_image_offset(intelObj->mt, intelObj->firstLevel, 0, 0, + &dst_x, &dst_y); + dri_bo_reference(intelObj->mt->region->buffer); i915->state.tex_buffer[unit] = intelObj->mt->region->buffer; - i915->state.tex_offset[unit] = - intel_miptree_image_offset(intelObj->mt, 0, intelObj->firstLevel, 0); + /* XXX: This calculation is probably broken for tiled images with + * a non-page-aligned offset. + */ + i915->state.tex_offset[unit] = (dst_x + dst_y * intelObj->mt->pitch) * + intelObj->mt->cpp; format = translate_texture_format(firstImage->TexFormat->MesaFormat, firstImage->InternalFormat, -- cgit v1.2.3 From 4c2a7bc4380017bec53a88cd9a8385cad73a9f0d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 16:28:39 -0600 Subject: glsl: fix memory leak A slightly modified version of a patch from Vinson Lee. --- src/mesa/shader/slang/slang_link.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 71038d2d94..144c126525 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -104,7 +104,7 @@ link_varying_vars(GLcontext *ctx, GLuint *map, i, firstVarying, newFile; GLbitfield *inOutFlags; - map = (GLuint *) malloc(prog->Varying->NumParameters * sizeof(GLuint)); + map = (GLuint *) _mesa_malloc(prog->Varying->NumParameters * sizeof(GLuint)); if (!map) return GL_FALSE; @@ -135,6 +135,7 @@ link_varying_vars(GLcontext *ctx, &shProg->Varying->Parameters[j]; if (var->Size != v->Size) { link_error(shProg, "mismatched varying variable types"); + _mesa_free(map); return GL_FALSE; } if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_CENTROID)) { @@ -142,6 +143,7 @@ link_varying_vars(GLcontext *ctx, _mesa_snprintf(msg, sizeof(msg), "centroid modifier mismatch for '%s'", var->Name); link_error(shProg, msg); + _mesa_free(map); return GL_FALSE; } if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_INVARIANT)) { @@ -149,6 +151,7 @@ link_varying_vars(GLcontext *ctx, _mesa_snprintf(msg, sizeof(msg), "invariant modifier mismatch for '%s'", var->Name); link_error(shProg, msg); + _mesa_free(map); return GL_FALSE; } } @@ -160,6 +163,7 @@ link_varying_vars(GLcontext *ctx, if (shProg->Varying->NumParameters > ctx->Const.MaxVarying) { link_error(shProg, "Too many varying variables"); + _mesa_free(map); return GL_FALSE; } @@ -199,7 +203,7 @@ link_varying_vars(GLcontext *ctx, } } - free(map); + _mesa_free(map); /* these will get recomputed before linking is completed */ prog->InputsRead = 0x0; -- cgit v1.2.3 From 3e45788d5dd7af4635988d8fd9f1bfaa77d1dd9c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 16:39:01 -0600 Subject: intel: fix src offset bug in do_copy_texsubimage() Use src->draw_offset intead of zero. Zero usually worked, except when the src renderbuffer is actually a texture mipmap level higher than zero. Fixes progs/test/blitfb.c test. --- src/mesa/drivers/dri/intel/intel_tex_copy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index c7c48e3d97..7e0fed89f4 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -158,7 +158,7 @@ do_copy_texsubimage(struct intel_context *intel, intelImage->mt->cpp, src_pitch, src->buffer, - 0, + src->draw_offset, src->tiling, intelImage->mt->pitch, dst_bo, -- cgit v1.2.3 From 33531614de94d396d10a3bed4a020abe2e2a40b5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 26 Oct 2009 17:00:48 -0600 Subject: intel: fix comment, formatting --- src/mesa/drivers/dri/intel/intel_buffers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index e7357e78c5..a36438b5e8 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -192,7 +192,7 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) } else { /* Get the intel_renderbuffer for the single colorbuffer we're drawing - * into, and set up cliprects if it's . + * into, and set up cliprects if it's a DRI1 window front buffer. */ if (fb->Name == 0) { intel->constant_cliprect = intel->driScreen->dri2.enabled; @@ -209,7 +209,7 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) if (!intel->constant_cliprect && intel->front_cliprects) intel_batchbuffer_flush(intel->batch); intel->front_cliprects = GL_FALSE; - colorRegions[0]= intel_get_rb_region(fb, BUFFER_BACK_LEFT); + colorRegions[0] = intel_get_rb_region(fb, BUFFER_BACK_LEFT); } } else { -- cgit v1.2.3 From 72cb441c2feb7e5f11fc84a2d9f551da94ce2f16 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 13:51:51 -0600 Subject: mesa: avoid redundant state setting in glClientActiveTexture Plus add code for verbose/debugging. --- src/mesa/main/texstate.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c index 16492bd7bc..c735e18aff 100644 --- a/src/mesa/main/texstate.c +++ b/src/mesa/main/texstate.c @@ -318,11 +318,18 @@ _mesa_ClientActiveTextureARB(GLenum texture) GLuint texUnit = texture - GL_TEXTURE0; ASSERT_OUTSIDE_BEGIN_END(ctx); + if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) + _mesa_debug(ctx, "glClientActiveTexture %s\n", + _mesa_lookup_enum_by_nr(texture)); + if (texUnit >= ctx->Const.MaxTextureCoordUnits) { _mesa_error(ctx, GL_INVALID_ENUM, "glClientActiveTexture(texture)"); return; } + if (ctx->Array.ActiveTexture == texUnit) + return; + FLUSH_VERTICES(ctx, _NEW_ARRAY); ctx->Array.ActiveTexture = texUnit; } -- cgit v1.2.3 From 58a4328e96160ad6c529edb321cdc5ea929a3f02 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 13:52:37 -0600 Subject: mesa: minor code clean-up in client_state() --- src/mesa/main/enable.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c index 4383aed669..12ce14c5d0 100644 --- a/src/mesa/main/enable.c +++ b/src/mesa/main/enable.c @@ -55,46 +55,47 @@ static void client_state(GLcontext *ctx, GLenum cap, GLboolean state) { + struct gl_array_object *arrayObj = ctx->Array.ArrayObj; GLuint flag; GLboolean *var; switch (cap) { case GL_VERTEX_ARRAY: - var = &ctx->Array.ArrayObj->Vertex.Enabled; + var = &arrayObj->Vertex.Enabled; flag = _NEW_ARRAY_VERTEX; break; case GL_NORMAL_ARRAY: - var = &ctx->Array.ArrayObj->Normal.Enabled; + var = &arrayObj->Normal.Enabled; flag = _NEW_ARRAY_NORMAL; break; case GL_COLOR_ARRAY: - var = &ctx->Array.ArrayObj->Color.Enabled; + var = &arrayObj->Color.Enabled; flag = _NEW_ARRAY_COLOR0; break; case GL_INDEX_ARRAY: - var = &ctx->Array.ArrayObj->Index.Enabled; + var = &arrayObj->Index.Enabled; flag = _NEW_ARRAY_INDEX; break; case GL_TEXTURE_COORD_ARRAY: - var = &ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled; + var = &arrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled; flag = _NEW_ARRAY_TEXCOORD(ctx->Array.ActiveTexture); break; case GL_EDGE_FLAG_ARRAY: - var = &ctx->Array.ArrayObj->EdgeFlag.Enabled; + var = &arrayObj->EdgeFlag.Enabled; flag = _NEW_ARRAY_EDGEFLAG; break; case GL_FOG_COORDINATE_ARRAY_EXT: - var = &ctx->Array.ArrayObj->FogCoord.Enabled; + var = &arrayObj->FogCoord.Enabled; flag = _NEW_ARRAY_FOGCOORD; break; case GL_SECONDARY_COLOR_ARRAY_EXT: - var = &ctx->Array.ArrayObj->SecondaryColor.Enabled; + var = &arrayObj->SecondaryColor.Enabled; flag = _NEW_ARRAY_COLOR1; break; #if FEATURE_point_size_array case GL_POINT_SIZE_ARRAY_OES: - var = &ctx->Array.ArrayObj->PointSize.Enabled; + var = &arrayObj->PointSize.Enabled; flag = _NEW_ARRAY_POINT_SIZE; break; #endif @@ -120,7 +121,7 @@ client_state(GLcontext *ctx, GLenum cap, GLboolean state) { GLint n = (GLint) cap - GL_VERTEX_ATTRIB_ARRAY0_NV; ASSERT(n < Elements(ctx->Array.ArrayObj->VertexAttrib)); - var = &ctx->Array.ArrayObj->VertexAttrib[n].Enabled; + var = &arrayObj->VertexAttrib[n].Enabled; flag = _NEW_ARRAY_ATTRIB(n); } break; -- cgit v1.2.3 From 403181b91355c733883d0a6d7f48440212226d45 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 13:59:32 -0600 Subject: mesa: more texture debug code changes, improvements --- src/mesa/main/debug.c | 93 ++++++++++++++++++++++++++++++++++++--------------- src/mesa/main/debug.h | 6 ++-- 2 files changed, 69 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index 0e35617575..24ced0d6c9 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -58,6 +58,31 @@ const char *_mesa_prim_name[GL_POLYGON+4] = { "unknown state" }; + +static const char * +tex_target_name(GLenum tgt) +{ + static const struct { + GLenum target; + const char *name; + } tex_targets[] = { + { GL_TEXTURE_1D, "GL_TEXTURE_1D" }, + { GL_TEXTURE_2D, "GL_TEXTURE_2D" }, + { GL_TEXTURE_3D, "GL_TEXTURE_3D" }, + { GL_TEXTURE_CUBE_MAP, "GL_TEXTURE_CUBE_MAP" }, + { GL_TEXTURE_RECTANGLE, "GL_TEXTURE_RECTANGLE" }, + { GL_TEXTURE_1D_ARRAY_EXT, "GL_TEXTURE_1D_ARRAY" }, + { GL_TEXTURE_2D_ARRAY_EXT, "GL_TEXTURE_2D_ARRAY" } + }; + GLuint i; + for (i = 0; i < Elements(tex_targets); i++) { + if (tex_targets[i].target == tgt) + return tex_targets[i].name; + } + return "UNKNOWN TEX TARGET"; +} + + void _mesa_print_state( const char *msg, GLuint state ) { @@ -291,7 +316,7 @@ write_texture_image(struct gl_texture_object *texObj, buffer, texObj, img); /* make filename */ - _mesa_sprintf(s, "/tmp/teximage%u.ppm", texObj->Name); + _mesa_sprintf(s, "/tmp/tex%u.l%u.f%u.ppm", texObj->Name, level, face); _mesa_printf(" Writing image level %u to %s\n", level, s); write_ppm(s, buffer, img->Width, img->Height, 4, 0, 1, 2, GL_FALSE); @@ -342,27 +367,36 @@ write_renderbuffer_image(const struct gl_renderbuffer *rb) } -static GLboolean DumpImages; +/** How many texture images (mipmap levels, faces) to write to files */ +#define WRITE_NONE 0 +#define WRITE_ONE 1 +#define WRITE_ALL 2 + +static GLuint WriteImages; static void -dump_texture(struct gl_texture_object *texObj) +dump_texture(struct gl_texture_object *texObj, GLuint writeImages) { - int i; + const GLuint numFaces = texObj->Target == GL_TEXTURE_CUBE_MAP ? 6 : 1; GLboolean written = GL_FALSE; + GLuint i, j; _mesa_printf("Texture %u\n", texObj->Name); - _mesa_printf(" Target 0x%x\n", texObj->Target); + _mesa_printf(" Target %s\n", tex_target_name(texObj->Target)); for (i = 0; i < MAX_TEXTURE_LEVELS; i++) { - struct gl_texture_image *texImg = texObj->Image[0][i]; - if (texImg) { - _mesa_printf(" Image %u: %d x %d x %d, format %u at %p\n", i, - texImg->Width, texImg->Height, texImg->Depth, - texImg->TexFormat->MesaFormat, texImg->Data); - if (DumpImages && !written) { - GLuint face = 0; - write_texture_image(texObj, face, i); - written = GL_TRUE; + for (j = 0; j < numFaces; j++) { + struct gl_texture_image *texImg = texObj->Image[j][i]; + if (texImg) { + _mesa_printf(" Face %u level %u: %d x %d x %d, format %u at %p\n", + j, i, + texImg->Width, texImg->Height, texImg->Depth, + texImg->TexFormat->MesaFormat, texImg->Data); + if (writeImages == WRITE_ALL || + (writeImages == WRITE_ONE && !written)) { + write_texture_image(texObj, j, i); + written = GL_TRUE; + } } } } @@ -373,13 +407,12 @@ dump_texture(struct gl_texture_object *texObj) * Dump a single texture. */ void -_mesa_dump_texture(GLuint texture, GLboolean dumpImages) +_mesa_dump_texture(GLuint texture, GLuint writeImages) { GET_CURRENT_CONTEXT(ctx); struct gl_texture_object *texObj = _mesa_lookup_texture(ctx, texture); if (texObj) { - DumpImages = dumpImages; - dump_texture(texObj); + dump_texture(texObj, writeImages); } } @@ -389,7 +422,7 @@ dump_texture_cb(GLuint id, void *data, void *userData) { struct gl_texture_object *texObj = (struct gl_texture_object *) data; (void) userData; - dump_texture(texObj); + dump_texture(texObj, WriteImages); } @@ -398,38 +431,44 @@ dump_texture_cb(GLuint id, void *data, void *userData) * If dumpImages is true, write PPM of level[0] image to a file. */ void -_mesa_dump_textures(GLboolean dumpImages) +_mesa_dump_textures(GLuint writeImages) { GET_CURRENT_CONTEXT(ctx); - DumpImages = dumpImages; + WriteImages = writeImages; _mesa_HashWalk(ctx->Shared->TexObjects, dump_texture_cb, ctx); } static void -dump_renderbuffer_cb(GLuint id, void *data, void *userData) +dump_renderbuffer(const struct gl_renderbuffer *rb, GLboolean writeImage) { - const struct gl_renderbuffer *rb = (const struct gl_renderbuffer *) data; - (void) userData; - _mesa_printf("Renderbuffer %u: %u x %u IntFormat = %s\n", rb->Name, rb->Width, rb->Height, _mesa_lookup_enum_by_nr(rb->InternalFormat)); - if (DumpImages) { + if (writeImage) { write_renderbuffer_image(rb); } } +static void +dump_renderbuffer_cb(GLuint id, void *data, void *userData) +{ + const struct gl_renderbuffer *rb = (const struct gl_renderbuffer *) data; + (void) userData; + dump_renderbuffer(rb, WriteImages); +} + + /** * Print basic info about all renderbuffers to stdout. * If dumpImages is true, write PPM of level[0] image to a file. */ void -_mesa_dump_renderbuffers(GLboolean dumpImages) +_mesa_dump_renderbuffers(GLboolean writeImages) { GET_CURRENT_CONTEXT(ctx); - DumpImages = dumpImages; + WriteImages = writeImages; _mesa_HashWalk(ctx->Shared->RenderBuffers, dump_renderbuffer_cb, ctx); } diff --git a/src/mesa/main/debug.h b/src/mesa/main/debug.h index f66f774a45..d12ea602dd 100644 --- a/src/mesa/main/debug.h +++ b/src/mesa/main/debug.h @@ -58,13 +58,13 @@ extern void _mesa_init_debug( GLcontext *ctx ); #endif extern void -_mesa_dump_texture(GLuint texture, GLboolean dumpImages); +_mesa_dump_texture(GLuint texture, GLuint writeImages); extern void -_mesa_dump_textures(GLboolean dumpImages); +_mesa_dump_textures(GLuint writeImages); extern void -_mesa_dump_renderbuffers(GLboolean dumpImages); +_mesa_dump_renderbuffers(GLboolean writeImages); extern void _mesa_dump_color_buffer(const char *filename); -- cgit v1.2.3 From 05ec586851290698730990cd810e1fe4d74d2749 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 14:16:59 -0600 Subject: mesa: s/Bilt/Blit --- src/mesa/drivers/common/meta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index b38f22e130..64b77d864c 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -1025,7 +1025,7 @@ init_blit_depth_pixels(GLcontext *ctx) /** - * Try to do a glBiltFramebuffer using no-copy texturing. + * Try to do a glBlitFramebuffer using no-copy texturing. * We can do this when the src renderbuffer is actually a texture. * But if the src buffer == dst buffer we cannot do this. * -- cgit v1.2.3 From 7fd8c6ca2a6e94d60c02e9c271b00c565c2464cb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 16:37:00 -0600 Subject: intel: use _mesa_get_current_tex_unit() helper --- src/mesa/drivers/dri/intel/intel_tex_copy.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 7e0fed89f4..0284687164 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -29,6 +29,7 @@ #include "main/enums.h" #include "main/image.h" #include "main/teximage.h" +#include "main/texstate.h" #include "main/mipmap.h" #include "drivers/common/meta.h" @@ -183,8 +184,7 @@ intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border) { - struct gl_texture_unit *texUnit = - &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); struct gl_texture_object *texObj = _mesa_select_tex_object(ctx, texUnit, target); struct gl_texture_image *texImage = @@ -231,8 +231,7 @@ intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { - struct gl_texture_unit *texUnit = - &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); struct gl_texture_object *texObj = _mesa_select_tex_object(ctx, texUnit, target); struct gl_texture_image *texImage = @@ -247,7 +246,7 @@ intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level, */ ctx->Driver.TexImage2D(ctx, target, level, internalFormat, width, height, border, - GL_RGBA, CHAN_TYPE, NULL, + GL_RGBA, GL_UNSIGNED_BYTE, NULL, &ctx->DefaultPacking, texObj, texImage); srcx = x; @@ -277,8 +276,7 @@ static void intelCopyTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width) { - struct gl_texture_unit *texUnit = - &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); struct gl_texture_object *texObj = _mesa_select_tex_object(ctx, texUnit, target); struct gl_texture_image *texImage = @@ -303,8 +301,7 @@ intelCopyTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) { - struct gl_texture_unit *texUnit = - &ctx->Texture.Unit[ctx->Texture.CurrentUnit]; + struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); struct gl_texture_object *texObj = _mesa_select_tex_object(ctx, texUnit, target); struct gl_texture_image *texImage = -- cgit v1.2.3 From 3c716669211c00d106ded2df342b4a2525f4795b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 16:37:25 -0600 Subject: intel: minor clean-up, comments --- src/mesa/drivers/dri/intel/intel_tex_copy.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 0284687164..bb21dd5ed9 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -93,8 +93,7 @@ do_copy_texsubimage(struct intel_context *intel, GLint x, GLint y, GLsizei width, GLsizei height) { GLcontext *ctx = &intel->ctx; - const struct intel_region *src = - get_teximage_source(intel, internalFormat); + const struct intel_region *src = get_teximage_source(intel, internalFormat); if (!intelImage->mt || !src) { if (INTEL_DEBUG & DEBUG_FALLBACKS) @@ -121,6 +120,7 @@ do_copy_texsubimage(struct intel_context *intel, GLuint image_x, image_y; GLshort src_pitch; + /* get dest x/y in destination texture */ intel_miptree_get_image_offset(intelImage->mt, intelImage->level, intelImage->face, @@ -155,6 +155,7 @@ do_copy_texsubimage(struct intel_context *intel, src_pitch = src->pitch; } + /* blit from src buffer to texture */ if (!intelEmitCopyBlit(intel, intelImage->mt->cpp, src_pitch, -- cgit v1.2.3 From 507cf530b951b5a65999dd4ed7529824bd035087 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 16:55:31 -0600 Subject: via: silence unused var warnings --- src/mesa/drivers/dri/unichrome/via_ioctl.c | 2 -- src/mesa/drivers/dri/unichrome/via_screen.c | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/unichrome/via_ioctl.c b/src/mesa/drivers/dri/unichrome/via_ioctl.c index 6746f552ae..b34c133600 100644 --- a/src/mesa/drivers/dri/unichrome/via_ioctl.c +++ b/src/mesa/drivers/dri/unichrome/via_ioctl.c @@ -886,8 +886,6 @@ void viaFlushDmaLocked(struct via_context *vmesa, GLuint flags) else if (vmesa->numClipRects) { drm_clip_rect_t *pbox = vmesa->pClipRects; __DRIdrawablePrivate *dPriv = vmesa->driDrawable; - struct via_renderbuffer *const vrb = - (struct via_renderbuffer *) dPriv->driverPrivate; for (i = 0; i < vmesa->numClipRects; i++) { drm_clip_rect_t b; diff --git a/src/mesa/drivers/dri/unichrome/via_screen.c b/src/mesa/drivers/dri/unichrome/via_screen.c index 7cfc60a015..966ac41474 100644 --- a/src/mesa/drivers/dri/unichrome/via_screen.c +++ b/src/mesa/drivers/dri/unichrome/via_screen.c @@ -208,7 +208,9 @@ viaCreateBuffer(__DRIscreenPrivate *driScrnPriv, const __GLcontextModes *mesaVis, GLboolean isPixmap) { +#if 0 viaScreenPrivate *screen = (viaScreenPrivate *) driScrnPriv->private; +#endif GLboolean swStencil = (mesaVis->stencilBits > 0 && mesaVis->depthBits != 24); -- cgit v1.2.3 From 21f8d31cfd9612fdf2bd39901472a6f3f11ddfda Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 16:59:23 -0600 Subject: mesa: debug code for glBlitFramebuffer() --- src/mesa/main/fbobject.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 0040099a69..55709ebf9e 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -51,6 +51,9 @@ /** Set this to 1 to help debug FBO incompleteness problems */ #define DEBUG_FBO 0 +/** Set this to 1 to debug/log glBlitFramebuffer() calls */ +#define DEBUG_BLIT 0 + /** * Notes: @@ -1932,6 +1935,20 @@ _mesa_GenerateMipmapEXT(GLenum target) #if FEATURE_EXT_framebuffer_blit + +static const struct gl_renderbuffer_attachment * +find_attachment(const struct gl_framebuffer *fb, const struct gl_renderbuffer *rb) +{ + GLuint i; + for (i = 0; i < Elements(fb->Attachment); i++) { + if (fb->Attachment[i].Renderbuffer == rb) + return &fb->Attachment[i]; + } + return NULL; +} + + + /** * Blit rectangular region, optionally from one framebuffer to another. * @@ -2059,6 +2076,44 @@ _mesa_BlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, return; } + /* Debug code */ + if (DEBUG_BLIT) { + _mesa_printf("glBlitFramebuffer(%d, %d, %d, %d, %d, %d, %d, %d," + " 0x%x, 0x%x)\n", + srcX0, srcY0, srcX1, srcY1, + dstX0, dstY0, dstX1, dstY1, + mask, filter); + if (colorReadRb) { + const struct gl_renderbuffer_attachment *att; + + att = find_attachment(readFb, colorReadRb); + _mesa_printf(" Src FBO %u RB %u (%dx%d) ", + readFb->Name, colorReadRb->Name, + colorReadRb->Width, colorReadRb->Height); + if (att && att->Texture) { + _mesa_printf("Tex %u tgt 0x%x level %u face %u", + att->Texture->Name, + att->Texture->Target, + att->TextureLevel, + att->CubeMapFace); + } + _mesa_printf("\n"); + + att = find_attachment(drawFb, colorDrawRb); + _mesa_printf(" Dst FBO %u RB %u (%dx%d) ", + drawFb->Name, colorDrawRb->Name, + colorDrawRb->Width, colorDrawRb->Height); + if (att && att->Texture) { + _mesa_printf("Tex %u tgt 0x%x level %u face %u", + att->Texture->Name, + att->Texture->Target, + att->TextureLevel, + att->CubeMapFace); + } + _mesa_printf("\n"); + } + } + ASSERT(ctx->Driver.BlitFramebuffer); ctx->Driver.BlitFramebuffer(ctx, srcX0, srcY0, srcX1, srcY1, -- cgit v1.2.3 From f8155ef51f10bd7f084ea676f7b70af8ef429caa Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 17:01:26 -0600 Subject: intel: silence warning --- src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index f313f8e442..99330b6ddf 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -33,6 +33,7 @@ #include "main/macros.h" #include "main/bufferobj.h" #include "main/pixelstore.h" +#include "main/polygon.h" #include "main/state.h" #include "main/teximage.h" #include "main/texenv.h" -- cgit v1.2.3 From 52374d7e4cc183fb783a7012b026d4254ca43b14 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 17:05:08 -0600 Subject: radeon: add case for MESA_FORMAT_X8_Z24 in radeon_create_renderbuffer() --- src/mesa/drivers/dri/radeon/radeon_fbo.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 3f0ab83996..9e6e8994fa 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -280,12 +280,17 @@ radeon_create_renderbuffer(gl_format format, __DRIdrawablePrivate *driDrawPriv) rrb->base.DataType = GL_UNSIGNED_SHORT; rrb->base._BaseFormat = GL_DEPTH_COMPONENT; break; + case MESA_FORMAT_X8_Z24: + rrb->base.DataType = GL_UNSIGNED_INT; + rrb->base._BaseFormat = GL_DEPTH_COMPONENT; + break; case MESA_FORMAT_S8_Z24: rrb->base.DataType = GL_UNSIGNED_INT_24_8_EXT; rrb->base._BaseFormat = GL_DEPTH_STENCIL; break; default: - fprintf(stderr, "%s: Unknown format 0x%04x\n", __FUNCTION__, format); + fprintf(stderr, "%s: Unknown format %s\n", + __FUNCTION__, _mesa_get_format_name(format)); _mesa_delete_renderbuffer(&rrb->base); return NULL; } -- cgit v1.2.3 From b7eea8c616092f5473a323fba585b04c47ae2010 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 17:34:29 -0600 Subject: intel: added region draw_x/y offsets in x/y_tile_swizzle() funcs This fixes the second part of bug 23552. --- src/mesa/drivers/dri/intel/intel_span.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 8df4990880..e71366a182 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -163,6 +163,9 @@ static uint32_t x_tile_swizzle(struct intel_renderbuffer *irb, int x_tile_number, y_tile_number; int tile_off, tile_base; + x += irb->region->draw_x; + y += irb->region->draw_y; + tile_stride = (irb->region->pitch * irb->region->cpp) << 3; xbyte = x * irb->region->cpp; @@ -218,6 +221,9 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb, int x_tile_number, y_tile_number; int tile_off, tile_base; + x += irb->region->draw_x; + y += irb->region->draw_y; + tile_stride = (irb->region->pitch * irb->region->cpp) << 5; xbyte = x * irb->region->cpp; -- cgit v1.2.3 From 2643a7ba2972ab8284aa911cc92ab0be163cb92f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 20 Oct 2009 14:51:53 -0700 Subject: intel: Fix flipped condition in ARB_sync GetSYnciv(GL_SYNC_STATUS). Bug #24435 (cherry picked from commit d56125a298106d81e10674f1c4b3b43b51a5139d) --- src/mesa/drivers/dri/intel/intel_syncobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_syncobj.c b/src/mesa/drivers/dri/intel/intel_syncobj.c index 1286fe929b..0d7889d3c2 100644 --- a/src/mesa/drivers/dri/intel/intel_syncobj.c +++ b/src/mesa/drivers/dri/intel/intel_syncobj.c @@ -114,7 +114,7 @@ static void intel_check_sync(GLcontext *ctx, struct gl_sync_object *s) { struct intel_sync_object *sync = (struct intel_sync_object *)s; - if (sync->bo && drm_intel_bo_busy(sync->bo)) { + if (sync->bo && !drm_intel_bo_busy(sync->bo)) { drm_intel_bo_unreference(sync->bo); sync->bo = NULL; s->StatusFlag = 1; -- cgit v1.2.3 From 0f255d195651f104a0c0bed84039b656d94ac4cc Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 27 Oct 2009 11:44:56 -0700 Subject: ARB prog parser: Don't leak symbol table header structures --- src/mesa/shader/symbol_table.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/symbol_table.c b/src/mesa/shader/symbol_table.c index 7a9aa7b8f6..42601a7765 100644 --- a/src/mesa/shader/symbol_table.c +++ b/src/mesa/shader/symbol_table.c @@ -73,6 +73,9 @@ struct symbol { /** */ struct symbol_header { + /** Linkage in list of all headers in a given symbol table. */ + struct symbol_header *next; + /** Symbol name. */ const char *name; @@ -102,6 +105,9 @@ struct _mesa_symbol_table { /** Top of scope stack. */ struct scope_level *current_scope; + + /** List of all symbol headers in the table. */ + struct symbol_header *hdr; }; @@ -301,6 +307,8 @@ _mesa_symbol_table_add_symbol(struct _mesa_symbol_table *table, hdr->name = name; hash_table_insert(table->ht, hdr, name); + hdr->next = table->hdr; + table->hdr = hdr; } check_symbol_table(table); @@ -341,10 +349,18 @@ _mesa_symbol_table_ctor(void) void _mesa_symbol_table_dtor(struct _mesa_symbol_table *table) { + struct symbol_header *hdr; + struct symbol_header *next; + while (table->current_scope != NULL) { _mesa_symbol_table_pop_scope(table); } + for (hdr = table->hdr; hdr != NULL; hdr = next) { + next = hdr->next; + _mesa_free(hdr); + } + hash_table_dtor(table->ht); free(table); } -- cgit v1.2.3 From 8df9587d68752f3369cc1eda1606d3b7c1041ec6 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 27 Oct 2009 11:46:29 -0700 Subject: ARB prog parser: Don't leak program string The program string is kept in the program object. On the second call into glProgramStringARB the previous kept string would be leaked. --- src/mesa/shader/program_parse.y | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index ae9e15ae5a..c3152aa2f8 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -2278,6 +2278,10 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str, _mesa_memcpy (strz, str, len); strz[len] = '\0'; + if (state->prog->String != NULL) { + _mesa_free(state->prog->String); + } + state->prog->String = strz; state->st = _mesa_symbol_table_ctor(); -- cgit v1.2.3 From 93dae6761bc90bbd43b450d2673620ec189b2c7a Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 27 Oct 2009 13:40:18 -0700 Subject: ARB prog parser: Fix epic memory leak in lexer / parser interface Anything that matched IDENTIFIER was strdup'ed and returned to the parser. However, almost every case of IDENTIFIER in the parser just dropped the returned string on the floor. Every swizzle string, every option string, every use of a variable, etc. leaked memory. Create a temporary buffer in the parser state (string_dumpster and dumpster_size). Return strings from the lexer to the parser in the buffer. Grow the buffer as needed. When the parser needs to keep a string (i.e., delcaring a new variable), let it make a copy then. The only leak that valgrind now detects is /occasionally/ the copy of the program string in gl_program::String is leaked. I'm not seeing how. :( --- src/mesa/shader/lex.yy.c | 445 ++++++++++++++++++++---------------- src/mesa/shader/program_lexer.l | 45 +++- src/mesa/shader/program_parse.tab.c | 21 +- src/mesa/shader/program_parse.y | 17 +- src/mesa/shader/program_parser.h | 16 ++ 5 files changed, 337 insertions(+), 207 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/lex.yy.c b/src/mesa/shader/lex.yy.c index fefef573ee..728c2dc272 100644 --- a/src/mesa/shader/lex.yy.c +++ b/src/mesa/shader/lex.yy.c @@ -53,7 +53,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -84,6 +83,8 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -157,7 +158,15 @@ typedef void* yyscan_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -918,7 +927,7 @@ static yyconst flex_int16_t yy_chk[1023] = if (condition) { \ return token; \ } else { \ - yylval->string = strdup(yytext); \ + yylval->string = return_string(yyextra, yytext); \ return IDENTIFIER; \ } \ } while (0) @@ -941,7 +950,7 @@ static yyconst flex_int16_t yy_chk[1023] = yylval->temp_inst.SaturateMode = SATURATE_ ## sat; \ return token; \ } else { \ - yylval->string = strdup(yytext); \ + yylval->string = return_string(yyextra, yytext); \ return IDENTIFIER; \ } \ } while (0) @@ -949,6 +958,45 @@ static yyconst flex_int16_t yy_chk[1023] = #define SWIZZLE_INVAL MAKE_SWIZZLE4(SWIZZLE_NIL, SWIZZLE_NIL, \ SWIZZLE_NIL, SWIZZLE_NIL) +/** + * Send a string to the parser using asm_parser_state::string_dumpster + * + * Sends a string to the parser using asm_parser_state::string_dumpster as a + * temporary storage buffer. Data previously stored in + * asm_parser_state::string_dumpster will be lost. If + * asm_parser_state::string_dumpster is not large enough to hold the new + * string, the buffer size will be increased. The buffer size is \b never + * decreased. + * + * \param state Assembler parser state tracking + * \param str String to be passed to the parser + * + * \return + * A pointer to asm_parser_state::string_dumpster on success or \c NULL on + * failure. Currently the only failure case is \c ENOMEM. + */ +static char * +return_string(struct asm_parser_state *state, const char *str) +{ + const size_t len = strlen(str); + + if (len >= state->dumpster_size) { + char *const dumpster = _mesa_realloc(state->string_dumpster, + state->dumpster_size, + len + 1); + if (dumpster == NULL) { + return NULL; + } + + state->string_dumpster = dumpster; + state->dumpster_size = len + 1; + } + + memcpy(state->string_dumpster, str, len + 1); + return state->string_dumpster; +} + + static unsigned mask_from_char(char c) { @@ -1004,7 +1052,7 @@ swiz_from_char(char c) } while(0); #define YY_EXTRA_TYPE struct asm_parser_state * -#line 1008 "lex.yy.c" +#line 1056 "lex.yy.c" #define INITIAL 0 @@ -1141,7 +1189,12 @@ static int input (yyscan_t yyscanner ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -1149,7 +1202,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1160,7 +1213,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - unsigned n; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1245,10 +1298,10 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 137 "program_lexer.l" +#line 176 "program_lexer.l" -#line 1252 "lex.yy.c" +#line 1305 "lex.yy.c" yylval = yylval_param; @@ -1337,17 +1390,17 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 139 "program_lexer.l" +#line 178 "program_lexer.l" { return ARBvp_10; } YY_BREAK case 2: YY_RULE_SETUP -#line 140 "program_lexer.l" +#line 179 "program_lexer.l" { return ARBfp_10; } YY_BREAK case 3: YY_RULE_SETUP -#line 141 "program_lexer.l" +#line 180 "program_lexer.l" { yylval->integer = at_address; return_token_or_IDENTIFIER(require_ARB_vp, ADDRESS); @@ -1355,760 +1408,760 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 145 "program_lexer.l" +#line 184 "program_lexer.l" { return ALIAS; } YY_BREAK case 5: YY_RULE_SETUP -#line 146 "program_lexer.l" +#line 185 "program_lexer.l" { return ATTRIB; } YY_BREAK case 6: YY_RULE_SETUP -#line 147 "program_lexer.l" +#line 186 "program_lexer.l" { return END; } YY_BREAK case 7: YY_RULE_SETUP -#line 148 "program_lexer.l" +#line 187 "program_lexer.l" { return OPTION; } YY_BREAK case 8: YY_RULE_SETUP -#line 149 "program_lexer.l" +#line 188 "program_lexer.l" { return OUTPUT; } YY_BREAK case 9: YY_RULE_SETUP -#line 150 "program_lexer.l" +#line 189 "program_lexer.l" { return PARAM; } YY_BREAK case 10: YY_RULE_SETUP -#line 151 "program_lexer.l" +#line 190 "program_lexer.l" { yylval->integer = at_temp; return TEMP; } YY_BREAK case 11: YY_RULE_SETUP -#line 153 "program_lexer.l" +#line 192 "program_lexer.l" { return_opcode( 1, VECTOR_OP, ABS, OFF); } YY_BREAK case 12: YY_RULE_SETUP -#line 154 "program_lexer.l" +#line 193 "program_lexer.l" { return_opcode(require_ARB_fp, VECTOR_OP, ABS, ZERO_ONE); } YY_BREAK case 13: YY_RULE_SETUP -#line 155 "program_lexer.l" +#line 194 "program_lexer.l" { return_opcode( 1, BIN_OP, ADD, OFF); } YY_BREAK case 14: YY_RULE_SETUP -#line 156 "program_lexer.l" +#line 195 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, ADD, ZERO_ONE); } YY_BREAK case 15: YY_RULE_SETUP -#line 157 "program_lexer.l" +#line 196 "program_lexer.l" { return_opcode(require_ARB_vp, ARL, ARL, OFF); } YY_BREAK case 16: YY_RULE_SETUP -#line 159 "program_lexer.l" +#line 198 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, CMP, OFF); } YY_BREAK case 17: YY_RULE_SETUP -#line 160 "program_lexer.l" +#line 199 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, CMP, ZERO_ONE); } YY_BREAK case 18: YY_RULE_SETUP -#line 161 "program_lexer.l" +#line 200 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, COS, OFF); } YY_BREAK case 19: YY_RULE_SETUP -#line 162 "program_lexer.l" +#line 201 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, COS, ZERO_ONE); } YY_BREAK case 20: YY_RULE_SETUP -#line 164 "program_lexer.l" +#line 203 "program_lexer.l" { return_opcode( 1, BIN_OP, DP3, OFF); } YY_BREAK case 21: YY_RULE_SETUP -#line 165 "program_lexer.l" +#line 204 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, DP3, ZERO_ONE); } YY_BREAK case 22: YY_RULE_SETUP -#line 166 "program_lexer.l" +#line 205 "program_lexer.l" { return_opcode( 1, BIN_OP, DP4, OFF); } YY_BREAK case 23: YY_RULE_SETUP -#line 167 "program_lexer.l" +#line 206 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, DP4, ZERO_ONE); } YY_BREAK case 24: YY_RULE_SETUP -#line 168 "program_lexer.l" +#line 207 "program_lexer.l" { return_opcode( 1, BIN_OP, DPH, OFF); } YY_BREAK case 25: YY_RULE_SETUP -#line 169 "program_lexer.l" +#line 208 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, DPH, ZERO_ONE); } YY_BREAK case 26: YY_RULE_SETUP -#line 170 "program_lexer.l" +#line 209 "program_lexer.l" { return_opcode( 1, BIN_OP, DST, OFF); } YY_BREAK case 27: YY_RULE_SETUP -#line 171 "program_lexer.l" +#line 210 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, DST, ZERO_ONE); } YY_BREAK case 28: YY_RULE_SETUP -#line 173 "program_lexer.l" +#line 212 "program_lexer.l" { return_opcode( 1, SCALAR_OP, EX2, OFF); } YY_BREAK case 29: YY_RULE_SETUP -#line 174 "program_lexer.l" +#line 213 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, EX2, ZERO_ONE); } YY_BREAK case 30: YY_RULE_SETUP -#line 175 "program_lexer.l" +#line 214 "program_lexer.l" { return_opcode(require_ARB_vp, SCALAR_OP, EXP, OFF); } YY_BREAK case 31: YY_RULE_SETUP -#line 177 "program_lexer.l" +#line 216 "program_lexer.l" { return_opcode( 1, VECTOR_OP, FLR, OFF); } YY_BREAK case 32: YY_RULE_SETUP -#line 178 "program_lexer.l" +#line 217 "program_lexer.l" { return_opcode(require_ARB_fp, VECTOR_OP, FLR, ZERO_ONE); } YY_BREAK case 33: YY_RULE_SETUP -#line 179 "program_lexer.l" +#line 218 "program_lexer.l" { return_opcode( 1, VECTOR_OP, FRC, OFF); } YY_BREAK case 34: YY_RULE_SETUP -#line 180 "program_lexer.l" +#line 219 "program_lexer.l" { return_opcode(require_ARB_fp, VECTOR_OP, FRC, ZERO_ONE); } YY_BREAK case 35: YY_RULE_SETUP -#line 182 "program_lexer.l" +#line 221 "program_lexer.l" { return_opcode(require_ARB_fp, KIL, KIL, OFF); } YY_BREAK case 36: YY_RULE_SETUP -#line 184 "program_lexer.l" +#line 223 "program_lexer.l" { return_opcode( 1, VECTOR_OP, LIT, OFF); } YY_BREAK case 37: YY_RULE_SETUP -#line 185 "program_lexer.l" +#line 224 "program_lexer.l" { return_opcode(require_ARB_fp, VECTOR_OP, LIT, ZERO_ONE); } YY_BREAK case 38: YY_RULE_SETUP -#line 186 "program_lexer.l" +#line 225 "program_lexer.l" { return_opcode( 1, SCALAR_OP, LG2, OFF); } YY_BREAK case 39: YY_RULE_SETUP -#line 187 "program_lexer.l" +#line 226 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, LG2, ZERO_ONE); } YY_BREAK case 40: YY_RULE_SETUP -#line 188 "program_lexer.l" +#line 227 "program_lexer.l" { return_opcode(require_ARB_vp, SCALAR_OP, LOG, OFF); } YY_BREAK case 41: YY_RULE_SETUP -#line 189 "program_lexer.l" +#line 228 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, LRP, OFF); } YY_BREAK case 42: YY_RULE_SETUP -#line 190 "program_lexer.l" +#line 229 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, LRP, ZERO_ONE); } YY_BREAK case 43: YY_RULE_SETUP -#line 192 "program_lexer.l" +#line 231 "program_lexer.l" { return_opcode( 1, TRI_OP, MAD, OFF); } YY_BREAK case 44: YY_RULE_SETUP -#line 193 "program_lexer.l" +#line 232 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, MAD, ZERO_ONE); } YY_BREAK case 45: YY_RULE_SETUP -#line 194 "program_lexer.l" +#line 233 "program_lexer.l" { return_opcode( 1, BIN_OP, MAX, OFF); } YY_BREAK case 46: YY_RULE_SETUP -#line 195 "program_lexer.l" +#line 234 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, MAX, ZERO_ONE); } YY_BREAK case 47: YY_RULE_SETUP -#line 196 "program_lexer.l" +#line 235 "program_lexer.l" { return_opcode( 1, BIN_OP, MIN, OFF); } YY_BREAK case 48: YY_RULE_SETUP -#line 197 "program_lexer.l" +#line 236 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, MIN, ZERO_ONE); } YY_BREAK case 49: YY_RULE_SETUP -#line 198 "program_lexer.l" +#line 237 "program_lexer.l" { return_opcode( 1, VECTOR_OP, MOV, OFF); } YY_BREAK case 50: YY_RULE_SETUP -#line 199 "program_lexer.l" +#line 238 "program_lexer.l" { return_opcode(require_ARB_fp, VECTOR_OP, MOV, ZERO_ONE); } YY_BREAK case 51: YY_RULE_SETUP -#line 200 "program_lexer.l" +#line 239 "program_lexer.l" { return_opcode( 1, BIN_OP, MUL, OFF); } YY_BREAK case 52: YY_RULE_SETUP -#line 201 "program_lexer.l" +#line 240 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, MUL, ZERO_ONE); } YY_BREAK case 53: YY_RULE_SETUP -#line 203 "program_lexer.l" +#line 242 "program_lexer.l" { return_opcode( 1, BINSC_OP, POW, OFF); } YY_BREAK case 54: YY_RULE_SETUP -#line 204 "program_lexer.l" +#line 243 "program_lexer.l" { return_opcode(require_ARB_fp, BINSC_OP, POW, ZERO_ONE); } YY_BREAK case 55: YY_RULE_SETUP -#line 206 "program_lexer.l" +#line 245 "program_lexer.l" { return_opcode( 1, SCALAR_OP, RCP, OFF); } YY_BREAK case 56: YY_RULE_SETUP -#line 207 "program_lexer.l" +#line 246 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, RCP, ZERO_ONE); } YY_BREAK case 57: YY_RULE_SETUP -#line 208 "program_lexer.l" +#line 247 "program_lexer.l" { return_opcode( 1, SCALAR_OP, RSQ, OFF); } YY_BREAK case 58: YY_RULE_SETUP -#line 209 "program_lexer.l" +#line 248 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, RSQ, ZERO_ONE); } YY_BREAK case 59: YY_RULE_SETUP -#line 211 "program_lexer.l" +#line 250 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SCS, OFF); } YY_BREAK case 60: YY_RULE_SETUP -#line 212 "program_lexer.l" +#line 251 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SCS, ZERO_ONE); } YY_BREAK case 61: YY_RULE_SETUP -#line 213 "program_lexer.l" +#line 252 "program_lexer.l" { return_opcode( 1, BIN_OP, SGE, OFF); } YY_BREAK case 62: YY_RULE_SETUP -#line 214 "program_lexer.l" +#line 253 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, SGE, ZERO_ONE); } YY_BREAK case 63: YY_RULE_SETUP -#line 215 "program_lexer.l" +#line 254 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SIN, OFF); } YY_BREAK case 64: YY_RULE_SETUP -#line 216 "program_lexer.l" +#line 255 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SIN, ZERO_ONE); } YY_BREAK case 65: YY_RULE_SETUP -#line 217 "program_lexer.l" +#line 256 "program_lexer.l" { return_opcode( 1, BIN_OP, SLT, OFF); } YY_BREAK case 66: YY_RULE_SETUP -#line 218 "program_lexer.l" +#line 257 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, SLT, ZERO_ONE); } YY_BREAK case 67: YY_RULE_SETUP -#line 219 "program_lexer.l" +#line 258 "program_lexer.l" { return_opcode( 1, BIN_OP, SUB, OFF); } YY_BREAK case 68: YY_RULE_SETUP -#line 220 "program_lexer.l" +#line 259 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, SUB, ZERO_ONE); } YY_BREAK case 69: YY_RULE_SETUP -#line 221 "program_lexer.l" +#line 260 "program_lexer.l" { return_opcode( 1, SWZ, SWZ, OFF); } YY_BREAK case 70: YY_RULE_SETUP -#line 222 "program_lexer.l" +#line 261 "program_lexer.l" { return_opcode(require_ARB_fp, SWZ, SWZ, ZERO_ONE); } YY_BREAK case 71: YY_RULE_SETUP -#line 224 "program_lexer.l" +#line 263 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TEX, OFF); } YY_BREAK case 72: YY_RULE_SETUP -#line 225 "program_lexer.l" +#line 264 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TEX, ZERO_ONE); } YY_BREAK case 73: YY_RULE_SETUP -#line 226 "program_lexer.l" +#line 265 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, OFF); } YY_BREAK case 74: YY_RULE_SETUP -#line 227 "program_lexer.l" +#line 266 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, ZERO_ONE); } YY_BREAK case 75: YY_RULE_SETUP -#line 228 "program_lexer.l" +#line 267 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, OFF); } YY_BREAK case 76: YY_RULE_SETUP -#line 229 "program_lexer.l" +#line 268 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, ZERO_ONE); } YY_BREAK case 77: YY_RULE_SETUP -#line 231 "program_lexer.l" +#line 270 "program_lexer.l" { return_opcode( 1, BIN_OP, XPD, OFF); } YY_BREAK case 78: YY_RULE_SETUP -#line 232 "program_lexer.l" +#line 271 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, XPD, ZERO_ONE); } YY_BREAK case 79: YY_RULE_SETUP -#line 234 "program_lexer.l" +#line 273 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); } YY_BREAK case 80: YY_RULE_SETUP -#line 235 "program_lexer.l" +#line 274 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); } YY_BREAK case 81: YY_RULE_SETUP -#line 236 "program_lexer.l" +#line 275 "program_lexer.l" { return PROGRAM; } YY_BREAK case 82: YY_RULE_SETUP -#line 237 "program_lexer.l" +#line 276 "program_lexer.l" { return STATE; } YY_BREAK case 83: YY_RULE_SETUP -#line 238 "program_lexer.l" +#line 277 "program_lexer.l" { return RESULT; } YY_BREAK case 84: YY_RULE_SETUP -#line 240 "program_lexer.l" +#line 279 "program_lexer.l" { return AMBIENT; } YY_BREAK case 85: YY_RULE_SETUP -#line 241 "program_lexer.l" +#line 280 "program_lexer.l" { return ATTENUATION; } YY_BREAK case 86: YY_RULE_SETUP -#line 242 "program_lexer.l" +#line 281 "program_lexer.l" { return BACK; } YY_BREAK case 87: YY_RULE_SETUP -#line 243 "program_lexer.l" +#line 282 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, CLIP); } YY_BREAK case 88: YY_RULE_SETUP -#line 244 "program_lexer.l" +#line 283 "program_lexer.l" { return COLOR; } YY_BREAK case 89: YY_RULE_SETUP -#line 245 "program_lexer.l" +#line 284 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, DEPTH); } YY_BREAK case 90: YY_RULE_SETUP -#line 246 "program_lexer.l" +#line 285 "program_lexer.l" { return DIFFUSE; } YY_BREAK case 91: YY_RULE_SETUP -#line 247 "program_lexer.l" +#line 286 "program_lexer.l" { return DIRECTION; } YY_BREAK case 92: YY_RULE_SETUP -#line 248 "program_lexer.l" +#line 287 "program_lexer.l" { return EMISSION; } YY_BREAK case 93: YY_RULE_SETUP -#line 249 "program_lexer.l" +#line 288 "program_lexer.l" { return ENV; } YY_BREAK case 94: YY_RULE_SETUP -#line 250 "program_lexer.l" +#line 289 "program_lexer.l" { return EYE; } YY_BREAK case 95: YY_RULE_SETUP -#line 251 "program_lexer.l" +#line 290 "program_lexer.l" { return FOGCOORD; } YY_BREAK case 96: YY_RULE_SETUP -#line 252 "program_lexer.l" +#line 291 "program_lexer.l" { return FOG; } YY_BREAK case 97: YY_RULE_SETUP -#line 253 "program_lexer.l" +#line 292 "program_lexer.l" { return FRONT; } YY_BREAK case 98: YY_RULE_SETUP -#line 254 "program_lexer.l" +#line 293 "program_lexer.l" { return HALF; } YY_BREAK case 99: YY_RULE_SETUP -#line 255 "program_lexer.l" +#line 294 "program_lexer.l" { return INVERSE; } YY_BREAK case 100: YY_RULE_SETUP -#line 256 "program_lexer.l" +#line 295 "program_lexer.l" { return INVTRANS; } YY_BREAK case 101: YY_RULE_SETUP -#line 257 "program_lexer.l" +#line 296 "program_lexer.l" { return LIGHT; } YY_BREAK case 102: YY_RULE_SETUP -#line 258 "program_lexer.l" +#line 297 "program_lexer.l" { return LIGHTMODEL; } YY_BREAK case 103: YY_RULE_SETUP -#line 259 "program_lexer.l" +#line 298 "program_lexer.l" { return LIGHTPROD; } YY_BREAK case 104: YY_RULE_SETUP -#line 260 "program_lexer.l" +#line 299 "program_lexer.l" { return LOCAL; } YY_BREAK case 105: YY_RULE_SETUP -#line 261 "program_lexer.l" +#line 300 "program_lexer.l" { return MATERIAL; } YY_BREAK case 106: YY_RULE_SETUP -#line 262 "program_lexer.l" +#line 301 "program_lexer.l" { return MAT_PROGRAM; } YY_BREAK case 107: YY_RULE_SETUP -#line 263 "program_lexer.l" +#line 302 "program_lexer.l" { return MATRIX; } YY_BREAK case 108: YY_RULE_SETUP -#line 264 "program_lexer.l" +#line 303 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, MATRIXINDEX); } YY_BREAK case 109: YY_RULE_SETUP -#line 265 "program_lexer.l" +#line 304 "program_lexer.l" { return MODELVIEW; } YY_BREAK case 110: YY_RULE_SETUP -#line 266 "program_lexer.l" +#line 305 "program_lexer.l" { return MVP; } YY_BREAK case 111: YY_RULE_SETUP -#line 267 "program_lexer.l" +#line 306 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, NORMAL); } YY_BREAK case 112: YY_RULE_SETUP -#line 268 "program_lexer.l" +#line 307 "program_lexer.l" { return OBJECT; } YY_BREAK case 113: YY_RULE_SETUP -#line 269 "program_lexer.l" +#line 308 "program_lexer.l" { return PALETTE; } YY_BREAK case 114: YY_RULE_SETUP -#line 270 "program_lexer.l" +#line 309 "program_lexer.l" { return PARAMS; } YY_BREAK case 115: YY_RULE_SETUP -#line 271 "program_lexer.l" +#line 310 "program_lexer.l" { return PLANE; } YY_BREAK case 116: YY_RULE_SETUP -#line 272 "program_lexer.l" +#line 311 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, POINT_TOK); } YY_BREAK case 117: YY_RULE_SETUP -#line 273 "program_lexer.l" +#line 312 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, POINTSIZE); } YY_BREAK case 118: YY_RULE_SETUP -#line 274 "program_lexer.l" +#line 313 "program_lexer.l" { return POSITION; } YY_BREAK case 119: YY_RULE_SETUP -#line 275 "program_lexer.l" +#line 314 "program_lexer.l" { return PRIMARY; } YY_BREAK case 120: YY_RULE_SETUP -#line 276 "program_lexer.l" +#line 315 "program_lexer.l" { return PROJECTION; } YY_BREAK case 121: YY_RULE_SETUP -#line 277 "program_lexer.l" +#line 316 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, RANGE); } YY_BREAK case 122: YY_RULE_SETUP -#line 278 "program_lexer.l" +#line 317 "program_lexer.l" { return ROW; } YY_BREAK case 123: YY_RULE_SETUP -#line 279 "program_lexer.l" +#line 318 "program_lexer.l" { return SCENECOLOR; } YY_BREAK case 124: YY_RULE_SETUP -#line 280 "program_lexer.l" +#line 319 "program_lexer.l" { return SECONDARY; } YY_BREAK case 125: YY_RULE_SETUP -#line 281 "program_lexer.l" +#line 320 "program_lexer.l" { return SHININESS; } YY_BREAK case 126: YY_RULE_SETUP -#line 282 "program_lexer.l" +#line 321 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, SIZE_TOK); } YY_BREAK case 127: YY_RULE_SETUP -#line 283 "program_lexer.l" +#line 322 "program_lexer.l" { return SPECULAR; } YY_BREAK case 128: YY_RULE_SETUP -#line 284 "program_lexer.l" +#line 323 "program_lexer.l" { return SPOT; } YY_BREAK case 129: YY_RULE_SETUP -#line 285 "program_lexer.l" +#line 324 "program_lexer.l" { return TEXCOORD; } YY_BREAK case 130: YY_RULE_SETUP -#line 286 "program_lexer.l" +#line 325 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, TEXENV); } YY_BREAK case 131: YY_RULE_SETUP -#line 287 "program_lexer.l" +#line 326 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN); } YY_BREAK case 132: YY_RULE_SETUP -#line 288 "program_lexer.l" +#line 327 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_Q); } YY_BREAK case 133: YY_RULE_SETUP -#line 289 "program_lexer.l" +#line 328 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_S); } YY_BREAK case 134: YY_RULE_SETUP -#line 290 "program_lexer.l" +#line 329 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_T); } YY_BREAK case 135: YY_RULE_SETUP -#line 291 "program_lexer.l" +#line 330 "program_lexer.l" { return TEXTURE; } YY_BREAK case 136: YY_RULE_SETUP -#line 292 "program_lexer.l" +#line 331 "program_lexer.l" { return TRANSPOSE; } YY_BREAK case 137: YY_RULE_SETUP -#line 293 "program_lexer.l" +#line 332 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, VTXATTRIB); } YY_BREAK case 138: YY_RULE_SETUP -#line 294 "program_lexer.l" +#line 333 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, WEIGHT); } YY_BREAK case 139: YY_RULE_SETUP -#line 296 "program_lexer.l" +#line 335 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEXTURE_UNIT); } YY_BREAK case 140: YY_RULE_SETUP -#line 297 "program_lexer.l" +#line 336 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_1D); } YY_BREAK case 141: YY_RULE_SETUP -#line 298 "program_lexer.l" +#line 337 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_2D); } YY_BREAK case 142: YY_RULE_SETUP -#line 299 "program_lexer.l" +#line 338 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_3D); } YY_BREAK case 143: YY_RULE_SETUP -#line 300 "program_lexer.l" +#line 339 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_CUBE); } YY_BREAK case 144: YY_RULE_SETUP -#line 301 "program_lexer.l" +#line 340 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_rect, TEX_RECT); } YY_BREAK case 145: YY_RULE_SETUP -#line 302 "program_lexer.l" +#line 341 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW1D); } YY_BREAK case 146: YY_RULE_SETUP -#line 303 "program_lexer.l" +#line 342 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW2D); } YY_BREAK case 147: YY_RULE_SETUP -#line 304 "program_lexer.l" +#line 343 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_rect, TEX_SHADOWRECT); } YY_BREAK case 148: YY_RULE_SETUP -#line 305 "program_lexer.l" +#line 344 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY1D); } YY_BREAK case 149: YY_RULE_SETUP -#line 306 "program_lexer.l" +#line 345 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY2D); } YY_BREAK case 150: YY_RULE_SETUP -#line 307 "program_lexer.l" +#line 346 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW1D); } YY_BREAK case 151: YY_RULE_SETUP -#line 308 "program_lexer.l" +#line 347 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); } YY_BREAK case 152: YY_RULE_SETUP -#line 310 "program_lexer.l" +#line 349 "program_lexer.l" { - yylval->string = strdup(yytext); + yylval->string = return_string(yyextra, yytext); return IDENTIFIER; } YY_BREAK case 153: YY_RULE_SETUP -#line 315 "program_lexer.l" +#line 354 "program_lexer.l" { return DOT_DOT; } YY_BREAK case 154: YY_RULE_SETUP -#line 317 "program_lexer.l" +#line 356 "program_lexer.l" { yylval->integer = strtol(yytext, NULL, 10); return INTEGER; @@ -2116,7 +2169,7 @@ YY_RULE_SETUP YY_BREAK case 155: YY_RULE_SETUP -#line 321 "program_lexer.l" +#line 360 "program_lexer.l" { yylval->real = _mesa_strtod(yytext, NULL); return REAL; @@ -2128,7 +2181,7 @@ case 156: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 325 "program_lexer.l" +#line 364 "program_lexer.l" { yylval->real = _mesa_strtod(yytext, NULL); return REAL; @@ -2136,7 +2189,7 @@ YY_RULE_SETUP YY_BREAK case 157: YY_RULE_SETUP -#line 329 "program_lexer.l" +#line 368 "program_lexer.l" { yylval->real = _mesa_strtod(yytext, NULL); return REAL; @@ -2144,7 +2197,7 @@ YY_RULE_SETUP YY_BREAK case 158: YY_RULE_SETUP -#line 333 "program_lexer.l" +#line 372 "program_lexer.l" { yylval->real = _mesa_strtod(yytext, NULL); return REAL; @@ -2152,7 +2205,7 @@ YY_RULE_SETUP YY_BREAK case 159: YY_RULE_SETUP -#line 338 "program_lexer.l" +#line 377 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; @@ -2161,7 +2214,7 @@ YY_RULE_SETUP YY_BREAK case 160: YY_RULE_SETUP -#line 344 "program_lexer.l" +#line 383 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2171,7 +2224,7 @@ YY_RULE_SETUP YY_BREAK case 161: YY_RULE_SETUP -#line 350 "program_lexer.l" +#line 389 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; @@ -2180,7 +2233,7 @@ YY_RULE_SETUP YY_BREAK case 162: YY_RULE_SETUP -#line 355 "program_lexer.l" +#line 394 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; @@ -2189,7 +2242,7 @@ YY_RULE_SETUP YY_BREAK case 163: YY_RULE_SETUP -#line 361 "program_lexer.l" +#line 400 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2199,7 +2252,7 @@ YY_RULE_SETUP YY_BREAK case 164: YY_RULE_SETUP -#line 367 "program_lexer.l" +#line 406 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2209,7 +2262,7 @@ YY_RULE_SETUP YY_BREAK case 165: YY_RULE_SETUP -#line 373 "program_lexer.l" +#line 412 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; @@ -2218,7 +2271,7 @@ YY_RULE_SETUP YY_BREAK case 166: YY_RULE_SETUP -#line 379 "program_lexer.l" +#line 418 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2228,7 +2281,7 @@ YY_RULE_SETUP YY_BREAK case 167: YY_RULE_SETUP -#line 386 "program_lexer.l" +#line 425 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2240,7 +2293,7 @@ YY_RULE_SETUP YY_BREAK case 168: YY_RULE_SETUP -#line 395 "program_lexer.l" +#line 434 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; @@ -2249,7 +2302,7 @@ YY_RULE_SETUP YY_BREAK case 169: YY_RULE_SETUP -#line 401 "program_lexer.l" +#line 440 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2259,7 +2312,7 @@ YY_RULE_SETUP YY_BREAK case 170: YY_RULE_SETUP -#line 407 "program_lexer.l" +#line 446 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; @@ -2268,7 +2321,7 @@ YY_RULE_SETUP YY_BREAK case 171: YY_RULE_SETUP -#line 412 "program_lexer.l" +#line 451 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; @@ -2277,7 +2330,7 @@ YY_RULE_SETUP YY_BREAK case 172: YY_RULE_SETUP -#line 418 "program_lexer.l" +#line 457 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2287,7 +2340,7 @@ YY_RULE_SETUP YY_BREAK case 173: YY_RULE_SETUP -#line 424 "program_lexer.l" +#line 463 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2297,7 +2350,7 @@ YY_RULE_SETUP YY_BREAK case 174: YY_RULE_SETUP -#line 430 "program_lexer.l" +#line 469 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; @@ -2306,7 +2359,7 @@ YY_RULE_SETUP YY_BREAK case 175: YY_RULE_SETUP -#line 436 "program_lexer.l" +#line 475 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2316,7 +2369,7 @@ YY_RULE_SETUP YY_BREAK case 176: YY_RULE_SETUP -#line 444 "program_lexer.l" +#line 483 "program_lexer.l" { if (require_ARB_vp) { return TEXGEN_R; @@ -2330,7 +2383,7 @@ YY_RULE_SETUP YY_BREAK case 177: YY_RULE_SETUP -#line 455 "program_lexer.l" +#line 494 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2342,13 +2395,13 @@ YY_RULE_SETUP YY_BREAK case 178: YY_RULE_SETUP -#line 464 "program_lexer.l" +#line 503 "program_lexer.l" { return DOT; } YY_BREAK case 179: /* rule 179 can match eol */ YY_RULE_SETUP -#line 466 "program_lexer.l" +#line 505 "program_lexer.l" { yylloc->first_line++; yylloc->first_column = 1; @@ -2359,7 +2412,7 @@ YY_RULE_SETUP YY_BREAK case 180: YY_RULE_SETUP -#line 473 "program_lexer.l" +#line 512 "program_lexer.l" /* eat whitespace */ ; YY_BREAK case 181: @@ -2367,20 +2420,20 @@ case 181: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 474 "program_lexer.l" +#line 513 "program_lexer.l" /* eat comments */ ; YY_BREAK case 182: YY_RULE_SETUP -#line 475 "program_lexer.l" +#line 514 "program_lexer.l" { return yytext[0]; } YY_BREAK case 183: YY_RULE_SETUP -#line 476 "program_lexer.l" +#line 515 "program_lexer.l" ECHO; YY_BREAK -#line 2384 "lex.yy.c" +#line 2437 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -3148,8 +3201,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ @@ -3555,7 +3608,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 476 "program_lexer.l" +#line 515 "program_lexer.l" diff --git a/src/mesa/shader/program_lexer.l b/src/mesa/shader/program_lexer.l index c2803ff707..6c4fad3037 100644 --- a/src/mesa/shader/program_lexer.l +++ b/src/mesa/shader/program_lexer.l @@ -40,7 +40,7 @@ if (condition) { \ return token; \ } else { \ - yylval->string = strdup(yytext); \ + yylval->string = return_string(yyextra, yytext); \ return IDENTIFIER; \ } \ } while (0) @@ -63,7 +63,7 @@ yylval->temp_inst.SaturateMode = SATURATE_ ## sat; \ return token; \ } else { \ - yylval->string = strdup(yytext); \ + yylval->string = return_string(yyextra, yytext); \ return IDENTIFIER; \ } \ } while (0) @@ -71,6 +71,45 @@ #define SWIZZLE_INVAL MAKE_SWIZZLE4(SWIZZLE_NIL, SWIZZLE_NIL, \ SWIZZLE_NIL, SWIZZLE_NIL) +/** + * Send a string to the parser using asm_parser_state::string_dumpster + * + * Sends a string to the parser using asm_parser_state::string_dumpster as a + * temporary storage buffer. Data previously stored in + * asm_parser_state::string_dumpster will be lost. If + * asm_parser_state::string_dumpster is not large enough to hold the new + * string, the buffer size will be increased. The buffer size is \b never + * decreased. + * + * \param state Assembler parser state tracking + * \param str String to be passed to the parser + * + * \return + * A pointer to asm_parser_state::string_dumpster on success or \c NULL on + * failure. Currently the only failure case is \c ENOMEM. + */ +static char * +return_string(struct asm_parser_state *state, const char *str) +{ + const size_t len = strlen(str); + + if (len >= state->dumpster_size) { + char *const dumpster = _mesa_realloc(state->string_dumpster, + state->dumpster_size, + len + 1); + if (dumpster == NULL) { + return NULL; + } + + state->string_dumpster = dumpster; + state->dumpster_size = len + 1; + } + + memcpy(state->string_dumpster, str, len + 1); + return state->string_dumpster; +} + + static unsigned mask_from_char(char c) { @@ -308,7 +347,7 @@ ARRAYSHADOW1D { return_token_or_IDENTIFIER(require_ARB_fp && require ARRAYSHADOW2D { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); } [_a-zA-Z$][_a-zA-Z0-9$]* { - yylval->string = strdup(yytext); + yylval->string = return_string(yyextra, yytext); return IDENTIFIER; } diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c index c255e912ed..261b605a2d 100644 --- a/src/mesa/shader/program_parse.tab.c +++ b/src/mesa/shader/program_parse.tab.c @@ -4565,7 +4565,7 @@ yyreduce: "undefined variable binding in ALIAS statement"); YYERROR; } else { - _mesa_symbol_table_add_symbol(state->st, 0, (yyvsp[(2) - (4)].string), target); + _mesa_symbol_table_add_symbol(state->st, 0, strdup((yyvsp[(2) - (4)].string)), target); } ;} break; @@ -4896,10 +4896,14 @@ declare_variable(struct asm_parser_state *state, char *name, enum asm_type t, if (exist != NULL) { yyerror(locp, state, "redeclared identifier"); } else { - s = calloc(1, sizeof(struct asm_symbol)); - s->name = name; + const size_t name_len = strlen(name); + + s = calloc(1, sizeof(struct asm_symbol) + name_len + 1); + s->name = (char *)(s + 1); s->type = t; + memcpy((char *) s->name, name, name_len + 1); + switch (t) { case at_temp: if (state->prog->NumTemporaries >= state->limits->MaxTemps) { @@ -5147,6 +5151,11 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str, _mesa_memcpy (strz, str, len); strz[len] = '\0'; + if (state->prog->String != NULL) { + _mesa_free(state->prog->String); + state->prog->String = NULL; + } + state->prog->String = strz; state->st = _mesa_symbol_table_ctor(); @@ -5236,7 +5245,6 @@ error: for (sym = state->sym; sym != NULL; sym = temp) { temp = sym->next; - _mesa_free((void *) sym->name); _mesa_free(sym); } state->sym = NULL; @@ -5244,6 +5252,11 @@ error: _mesa_symbol_table_dtor(state->st); state->st = NULL; + if (state->string_dumpster != NULL) { + _mesa_free(state->string_dumpster); + state->dumpster_size = 0; + } + return result; } diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index c3152aa2f8..a23625d3fb 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -1919,7 +1919,7 @@ ALIAS_statement: ALIAS IDENTIFIER '=' IDENTIFIER "undefined variable binding in ALIAS statement"); YYERROR; } else { - _mesa_symbol_table_add_symbol(state->st, 0, $2, target); + _mesa_symbol_table_add_symbol(state->st, 0, strdup($2), target); } } ; @@ -2027,10 +2027,14 @@ declare_variable(struct asm_parser_state *state, char *name, enum asm_type t, if (exist != NULL) { yyerror(locp, state, "redeclared identifier"); } else { - s = calloc(1, sizeof(struct asm_symbol)); - s->name = name; + const size_t name_len = strlen(name); + + s = calloc(1, sizeof(struct asm_symbol) + name_len + 1); + s->name = (char *)(s + 1); s->type = t; + memcpy((char *) s->name, name, name_len + 1); + switch (t) { case at_temp: if (state->prog->NumTemporaries >= state->limits->MaxTemps) { @@ -2280,6 +2284,7 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str, if (state->prog->String != NULL) { _mesa_free(state->prog->String); + state->prog->String = NULL; } state->prog->String = strz; @@ -2371,7 +2376,6 @@ error: for (sym = state->sym; sym != NULL; sym = temp) { temp = sym->next; - _mesa_free((void *) sym->name); _mesa_free(sym); } state->sym = NULL; @@ -2379,5 +2383,10 @@ error: _mesa_symbol_table_dtor(state->st); state->st = NULL; + if (state->string_dumpster != NULL) { + _mesa_free(state->string_dumpster); + state->dumpster_size = 0; + } + return result; } diff --git a/src/mesa/shader/program_parser.h b/src/mesa/shader/program_parser.h index fa47d84565..8d8b4d89bc 100644 --- a/src/mesa/shader/program_parser.h +++ b/src/mesa/shader/program_parser.h @@ -38,6 +38,13 @@ enum asm_type { at_output, }; +/** + * \note + * Objects of this type are allocated as the object plus the name of the + * symbol. That is, malloc(sizeof(struct asm_symbol) + strlen(name) + 1). + * Alternately, asm_symbol::name could be moved to the bottom of the structure + * and declared as 'char name[0];'. + */ struct asm_symbol { struct asm_symbol *next; /**< List linkage for freeing. */ const char *name; @@ -157,6 +164,15 @@ struct asm_parser_state { /*@}*/ + /** + * Buffer to hold strings transfered from the lexer to the parser + */ + /*@{*/ + char *string_dumpster; /**< String data transfered. */ + size_t dumpster_size; /**< Total size, in bytes, of the buffer. */ + /*@}*/ + + /** * Selected limits copied from gl_constants * -- cgit v1.2.3 From 2947d1420270476730711892909c3683bb6c5bff Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Sun, 25 Oct 2009 12:19:38 -0400 Subject: st/xorg: fix xv --- src/gallium/state_trackers/xorg/xorg_exa_tgsi.c | 13 +++++-------- src/gallium/state_trackers/xorg/xorg_renderer.c | 1 + src/gallium/state_trackers/xorg/xorg_xv.c | 16 +++++++++++++++- 3 files changed, 21 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c index 30fcff8a49..83cc12fea9 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c @@ -259,14 +259,6 @@ create_vs(struct pipe_context *pipe, src = ureg_DECL_vs_input(ureg, input_slot++); dst = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 0); ureg_MOV(ureg, dst, src); - - src = ureg_DECL_vs_input(ureg, input_slot++); - dst = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 1); - ureg_MOV(ureg, dst, src); - - src = ureg_DECL_vs_input(ureg, input_slot++); - dst = ureg_DECL_output(ureg, TGSI_SEMANTIC_GENERIC, 2); - ureg_MOV(ureg, dst, src); } if (is_composite) { @@ -328,6 +320,11 @@ create_yuv_shader(struct pipe_context *pipe, struct ureg_program *ureg) ureg_TEX(ureg, v, TGSI_TEXTURE_2D, pos, v_sampler); + ureg_SUB(ureg, u, ureg_src(u), + ureg_scalar(matrow0, TGSI_SWIZZLE_W)); + ureg_SUB(ureg, v, ureg_src(v), + ureg_scalar(matrow0, TGSI_SWIZZLE_W)); + ureg_MUL(ureg, rgb, ureg_scalar(ureg_src(y), TGSI_SWIZZLE_X), matrow0); diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index ec5268f9d6..a740e862b7 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -869,6 +869,7 @@ void renderer_draw_textures(struct xorg_renderer *r, pos[2], pos[3], width, height, textures); + num_textures = 1; break; default: debug_assert(!"Unsupported number of textures"); diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index f4b0d564d6..2a3a42bdea 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -22,17 +22,31 @@ /* The ITU-R BT.601 conversion matrix for SDTV. */ +/* original, matrix, but we transpose it to + * make the shader easier static const float bt_601[] = { - 1.0, 0.0, 1.4075, 0, + 1.0, 0.0, 1.4075, , 1.0, -0.3455, -0.7169, 0, 1.0, 1.7790, 0., 0, +};*/ +static const float bt_601[] = { + 1.0, 1.0, 1.0, 0.5, + 0.0, -0.3455, 1.7790, 0, + 1.4075, -0.7169, 0., 0, }; /* The ITU-R BT.709 conversion matrix for HDTV. */ +/* original, but we transpose to make the conversion + * in the shader easier static const float bt_709[] = { 1.0, 0.0, 1.581, 0, 1.0, -0.1881, -0.47, 0, 1.0, 1.8629, 0., 0, +};*/ +static const float bt_709[] = { + 1.0, 1.0, 1.0, 0.5, + 0.0, -0.1881, 1.8629, 0, + 1.581,-0.47 , 0.0, 0, }; #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) -- cgit v1.2.3 From b44304efdee562b294e542ea0e47d6c758816ee8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 20:09:33 -0600 Subject: glsl: avoid redundant state changes in _mesa_use_program() --- src/mesa/shader/shader_api.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 30fa58ea52..453cd3964a 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -1547,8 +1547,6 @@ _mesa_use_program(GLcontext *ctx, GLuint program) return; } - FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); - if (program) { shProg = _mesa_lookup_shader_program_err(ctx, program, "glUseProgram"); if (!shProg) { @@ -1569,7 +1567,10 @@ _mesa_use_program(GLcontext *ctx, GLuint program) shProg = NULL; } - _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentProgram, shProg); + if (ctx->Shader.CurrentProgram != shProg) { + FLUSH_VERTICES(ctx, _NEW_PROGRAM | _NEW_PROGRAM_CONSTANTS); + _mesa_reference_shader_program(ctx, &ctx->Shader.CurrentProgram, shProg); + } } -- cgit v1.2.3 From dd5691e8020df30c47e6d0e43a68b4f301ea4ea9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 20:10:30 -0600 Subject: mesa: code refactoring to eliminate a switch stmt in bind_buffer_object() --- src/mesa/main/bufferobj.c | 111 +++++++++++++++++++--------------------------- 1 file changed, 45 insertions(+), 66 deletions(-) (limited to 'src') diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index 189b5e1655..52c4995b0a 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -52,51 +52,55 @@ /** - * Get the buffer object bound to the specified target in a GL context. - * - * \param ctx GL context - * \param target Buffer object target to be retrieved. Currently this must - * be either \c GL_ARRAY_BUFFER or \c GL_ELEMENT_ARRAY_BUFFER. - * \return A pointer to the buffer object bound to \c target in the + * Return pointer to address of a buffer object target. + * \param ctx the GL context + * \param target the buffer object target to be retrieved. + * \return pointer to pointer to the buffer object bound to \c target in the * specified context or \c NULL if \c target is invalid. */ -static INLINE struct gl_buffer_object * -get_buffer(GLcontext *ctx, GLenum target) +static INLINE struct gl_buffer_object ** +get_buffer_target(GLcontext *ctx, GLenum target) { - struct gl_buffer_object * bufObj = NULL; - switch (target) { - case GL_ARRAY_BUFFER_ARB: - bufObj = ctx->Array.ArrayBufferObj; - break; - case GL_ELEMENT_ARRAY_BUFFER_ARB: - bufObj = ctx->Array.ElementArrayBufferObj; - break; - case GL_PIXEL_PACK_BUFFER_EXT: - bufObj = ctx->Pack.BufferObj; - break; - case GL_PIXEL_UNPACK_BUFFER_EXT: - bufObj = ctx->Unpack.BufferObj; - break; - case GL_COPY_READ_BUFFER: - if (ctx->Extensions.ARB_copy_buffer) { - bufObj = ctx->CopyReadBuffer; - } - break; - case GL_COPY_WRITE_BUFFER: - if (ctx->Extensions.ARB_copy_buffer) { - bufObj = ctx->CopyWriteBuffer; - } - break; - default: - /* error must be recorded by caller */ - return NULL; + case GL_ARRAY_BUFFER_ARB: + return &ctx->Array.ArrayBufferObj; + case GL_ELEMENT_ARRAY_BUFFER_ARB: + return &ctx->Array.ElementArrayBufferObj; + case GL_PIXEL_PACK_BUFFER_EXT: + return &ctx->Pack.BufferObj; + case GL_PIXEL_UNPACK_BUFFER_EXT: + return &ctx->Unpack.BufferObj; + case GL_COPY_READ_BUFFER: + if (ctx->Extensions.ARB_copy_buffer) { + return &ctx->CopyReadBuffer; + } + break; + case GL_COPY_WRITE_BUFFER: + if (ctx->Extensions.ARB_copy_buffer) { + return &ctx->CopyWriteBuffer; + } + break; + default: + return NULL; } + return NULL; +} - /* bufObj should point to NullBufferObj or a user-created buffer object */ - ASSERT(bufObj); - return bufObj; +/** + * Get the buffer object bound to the specified target in a GL context. + * \param ctx the GL context + * \param target the buffer object target to be retrieved. + * \return pointer to the buffer object bound to \c target in the + * specified context or \c NULL if \c target is invalid. + */ +static INLINE struct gl_buffer_object * +get_buffer(GLcontext *ctx, GLenum target) +{ + struct gl_buffer_object **bufObj = get_buffer_target(ctx, target); + if (bufObj) + return *bufObj; + return NULL; } @@ -552,6 +556,7 @@ _mesa_init_buffer_objects( GLcontext *ctx ) /** * Bind the specified target to buffer for the specified context. + * Called by glBindBuffer() and other functions. */ static void bind_buffer_object(GLcontext *ctx, GLenum target, GLuint buffer) @@ -560,40 +565,14 @@ bind_buffer_object(GLcontext *ctx, GLenum target, GLuint buffer) struct gl_buffer_object *newBufObj = NULL; struct gl_buffer_object **bindTarget = NULL; - switch (target) { - case GL_ARRAY_BUFFER_ARB: - bindTarget = &ctx->Array.ArrayBufferObj; - break; - case GL_ELEMENT_ARRAY_BUFFER_ARB: - bindTarget = &ctx->Array.ElementArrayBufferObj; - break; - case GL_PIXEL_PACK_BUFFER_EXT: - bindTarget = &ctx->Pack.BufferObj; - break; - case GL_PIXEL_UNPACK_BUFFER_EXT: - bindTarget = &ctx->Unpack.BufferObj; - break; - case GL_COPY_READ_BUFFER: - if (ctx->Extensions.ARB_copy_buffer) { - bindTarget = &ctx->CopyReadBuffer; - } - break; - case GL_COPY_WRITE_BUFFER: - if (ctx->Extensions.ARB_copy_buffer) { - bindTarget = &ctx->CopyWriteBuffer; - } - break; - default: - ; /* no-op / we'll hit the follow error test next */ - } - + bindTarget = get_buffer_target(ctx, target); if (!bindTarget) { _mesa_error(ctx, GL_INVALID_ENUM, "glBindBufferARB(target 0x%x)"); return; } /* Get pointer to old buffer object (to be unbound) */ - oldBufObj = get_buffer(ctx, target); + oldBufObj = *bindTarget; if (oldBufObj && oldBufObj->Name == buffer) return; /* rebinding the same buffer object- no change */ -- cgit v1.2.3 From 9519603f7405a1043ea39bf1dfaf4c88529ce2d1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 21:15:36 -0600 Subject: mesa: simplify teximage code with get_current_tex_object() --- src/mesa/main/teximage.c | 98 +++++++++++++++++++----------------------------- 1 file changed, 38 insertions(+), 60 deletions(-) (limited to 'src') diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 465da6b046..cede1cce8d 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1022,6 +1022,18 @@ _mesa_clear_texture_image(GLcontext *ctx, struct gl_texture_image *texImage) } +/** + * Return pointer to texture object for given target on current texture unit. + */ +static struct gl_texture_object * +get_current_tex_object(GLcontext *ctx, GLenum target) +{ + struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); + return _mesa_select_tex_object(ctx, texUnit, target); +} + + + /** * This is the fallback for Driver.TestProxyTexImage(). Test the texture * level, width, height and depth against the ctx->Const limits for textures. @@ -2164,7 +2176,6 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, if (target == GL_TEXTURE_1D) { /* non-proxy target */ - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; const GLuint face = _mesa_tex_target_to_face(target); @@ -2177,8 +2188,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) _mesa_update_state(ctx); - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { texImage = _mesa_get_tex_image(ctx, texObj, target, level); @@ -2278,7 +2288,6 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, (ctx->Extensions.MESA_texture_array && target == GL_TEXTURE_1D_ARRAY_EXT)) { /* non-proxy target */ - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; const GLuint face = _mesa_tex_target_to_face(target); @@ -2292,8 +2301,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) _mesa_update_state(ctx); - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { texImage = _mesa_get_tex_image(ctx, texObj, target, level); @@ -2389,7 +2397,6 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, (ctx->Extensions.MESA_texture_array && target == GL_TEXTURE_2D_ARRAY_EXT)) { /* non-proxy target */ - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; const GLuint face = _mesa_tex_target_to_face(target); @@ -2402,8 +2409,7 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) _mesa_update_state(ctx); - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { texImage = _mesa_get_tex_image(ctx, texObj, target, level); @@ -2486,7 +2492,6 @@ _mesa_TexSubImage1D( GLenum target, GLint level, const GLvoid *pixels ) { GLsizei postConvWidth = width; - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage = NULL; GET_CURRENT_CONTEXT(ctx); @@ -2514,8 +2519,7 @@ _mesa_TexSubImage1D( GLenum target, GLint level, } - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = get_current_tex_object(ctx, target); assert(texObj); _mesa_lock_texture(ctx, texObj); @@ -2553,7 +2557,6 @@ _mesa_TexSubImage2D( GLenum target, GLint level, const GLvoid *pixels ) { GLsizei postConvWidth = width, postConvHeight = height; - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GET_CURRENT_CONTEXT(ctx); @@ -2582,8 +2585,7 @@ _mesa_TexSubImage2D( GLenum target, GLint level, return; /* error was detected */ } - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -2621,7 +2623,6 @@ _mesa_TexSubImage3D( GLenum target, GLint level, GLenum format, GLenum type, const GLvoid *pixels ) { - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GET_CURRENT_CONTEXT(ctx); @@ -2642,8 +2643,7 @@ _mesa_TexSubImage3D( GLenum target, GLint level, return; /* error was detected */ } - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -2684,7 +2684,6 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, GLint x, GLint y, GLsizei width, GLint border ) { - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLsizei postConvWidth = width; @@ -2711,8 +2710,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, postConvWidth, 1, border)) return; - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -2756,7 +2754,6 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) { - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLsizei postConvWidth = width, postConvHeight = height; @@ -2784,8 +2781,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, postConvWidth, postConvHeight, border)) return; - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -2829,7 +2825,6 @@ void GLAPIENTRY _mesa_CopyTexSubImage1D( GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width ) { - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLsizei postConvWidth = width; @@ -2850,8 +2845,7 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, if (copytexsubimage_error_check1(ctx, 1, target, level)) return; - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -2894,7 +2888,6 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) { - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLsizei postConvWidth = width, postConvHeight = height; @@ -2912,8 +2905,7 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, if (copytexsubimage_error_check1(ctx, 2, target, level)) return; - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -2959,7 +2951,6 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ) { - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLsizei postConvWidth = width, postConvHeight = height; @@ -2977,8 +2968,7 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, if (copytexsubimage_error_check1(ctx, 3, target, level)) return; - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -3230,7 +3220,6 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, if (target == GL_TEXTURE_1D) { /* non-proxy target */ - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLenum error = compressed_texture_error_check(ctx, 1, target, level, @@ -3240,8 +3229,7 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, return; } - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -3292,11 +3280,10 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, } else { /* store the teximage parameters */ - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + + texObj = get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -3334,9 +3321,9 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB)) { /* non-proxy target */ - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; + GLenum error = compressed_texture_error_check(ctx, 2, target, level, internalFormat, width, height, 1, border, imageSize); if (error) { @@ -3344,8 +3331,7 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, return; } - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -3398,11 +3384,10 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, } else { /* store the teximage parameters */ - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + + texObj = get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -3437,7 +3422,6 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, if (target == GL_TEXTURE_3D) { /* non-proxy target */ - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLenum error = compressed_texture_error_check(ctx, 3, target, level, @@ -3447,8 +3431,8 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, return; } - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = get_current_tex_object(ctx, target); + _mesa_lock_texture(ctx, texObj); { texImage = _mesa_get_tex_image(ctx, texObj, target, level); @@ -3500,11 +3484,11 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, } else { /* store the teximage parameters */ - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + + texObj = get_current_tex_object(ctx, target); + _mesa_lock_texture(ctx, texObj); { texImage = _mesa_select_tex_image(ctx, texObj, target, level); @@ -3526,7 +3510,6 @@ _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data) { - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLenum error; @@ -3542,8 +3525,7 @@ _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, return; } - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -3582,7 +3564,6 @@ _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, GLenum format, GLsizei imageSize, const GLvoid *data) { - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLenum error; @@ -3599,8 +3580,7 @@ _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, return; } - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -3640,7 +3620,6 @@ _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data) { - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLenum error; @@ -3656,8 +3635,7 @@ _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, return; } - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { -- cgit v1.2.3 From f3c29bd74f01370a6bbff1329966ca9d1864315f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 21:03:44 -0600 Subject: mesa: consolidate CompressedTexSubImage1/2/3DARB() error checking --- src/mesa/main/teximage.c | 86 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 58 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index cede1cce8d..f632c10e76 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -3202,6 +3202,55 @@ compressed_subtexture_error_check(GLcontext *ctx, GLint dimensions, } +/** + * Do second part of glCompressedTexSubImage error checking. + * \return GL_TRUE if error found, GL_FALSE otherwise. + */ +static GLboolean +compressed_subtexture_error_check2(GLcontext *ctx, GLuint dims, + GLsizei width, GLsizei height, + GLsizei depth, GLenum format, + struct gl_texture_image *texImage) +{ + + if ((GLint) format != texImage->InternalFormat) { + _mesa_error(ctx, GL_INVALID_OPERATION, + "glCompressedTexSubImage%uD(format=0x%x)", dims, format); + return GL_TRUE; + } + + if (((width == 1 || width == 2) && + (GLuint) width != texImage->Width) || + (width > texImage->Width)) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glCompressedTexSubImage%uD(width=%d)", dims, width); + return GL_TRUE; + } + + if (dims >= 2) { + if (((height == 1 || height == 2) && + (GLuint) height != texImage->Height) || + (height > texImage->Height)) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glCompressedTexSubImage%uD(height=%d)", dims, height); + return GL_TRUE; + } + } + + if (dims >= 3) { + if (((depth == 1 || depth == 2) && + (GLuint) depth != texImage->Depth) || + (depth > texImage->Depth)) { + _mesa_error(ctx, GL_INVALID_VALUE, + "glCompressedTexSubImage%uD(depth=%d)", dims, depth); + return GL_TRUE; + } + } + + return GL_FALSE; +} + + void GLAPIENTRY _mesa_CompressedTexImage1DARB(GLenum target, GLint level, @@ -3532,14 +3581,9 @@ _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, texImage = _mesa_select_tex_image(ctx, texObj, target, level); assert(texImage); - if ((GLint) format != texImage->InternalFormat) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glCompressedTexSubImage1D(format)"); - } - else if ((width == 1 || width == 2) && - (GLuint) width != texImage->Width) { - _mesa_error(ctx, GL_INVALID_VALUE, - "glCompressedTexSubImage1D(width)"); + if (compressed_subtexture_error_check2(ctx, 1, width, 1, 1, + format, texImage)) { + /* error was recorded */ } else if (width > 0) { if (ctx->Driver.CompressedTexSubImage1D) { @@ -3587,15 +3631,9 @@ _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, texImage = _mesa_select_tex_image(ctx, texObj, target, level); assert(texImage); - if ((GLint) format != texImage->InternalFormat) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glCompressedTexSubImage2D(format)"); - } - else if (((width == 1 || width == 2) - && (GLuint) width != texImage->Width) || - ((height == 1 || height == 2) - && (GLuint) height != texImage->Height)) { - _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage2D(size)"); + if (compressed_subtexture_error_check2(ctx, 2, width, height, 1, + format, texImage)) { + /* error was recorded */ } else if (width > 0 && height > 0) { if (ctx->Driver.CompressedTexSubImage2D) { @@ -3642,17 +3680,9 @@ _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, texImage = _mesa_select_tex_image(ctx, texObj, target, level); assert(texImage); - if ((GLint) format != texImage->InternalFormat) { - _mesa_error(ctx, GL_INVALID_OPERATION, - "glCompressedTexSubImage3D(format)"); - } - else if (((width == 1 || width == 2) - && (GLuint) width != texImage->Width) || - ((height == 1 || height == 2) - && (GLuint) height != texImage->Height) || - ((depth == 1 || depth == 2) - && (GLuint) depth != texImage->Depth)) { - _mesa_error(ctx, GL_INVALID_VALUE, "glCompressedTexSubImage3D(size)"); + if (compressed_subtexture_error_check2(ctx, 3, width, height, depth, + format, texImage)) { + /* error was recorded */ } else if (width > 0 && height > 0 && depth > 0) { if (ctx->Driver.CompressedTexSubImage3D) { -- cgit v1.2.3 From 6bc1e9fd6989483fbc1c94730a8014b4c62b242c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 27 Oct 2009 21:39:44 -0600 Subject: mesa: consolidate _mesa_CompressedTexSubImage[123]DARB() functions --- src/mesa/main/teximage.c | 152 +++++++++++++++++------------------------------ 1 file changed, 56 insertions(+), 96 deletions(-) (limited to 'src') diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index f632c10e76..fe11adb6f1 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -3554,10 +3554,14 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, } -void GLAPIENTRY -_mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, - GLsizei width, GLenum format, - GLsizei imageSize, const GLvoid *data) +/** + * Common helper for glCompressedTexSubImage1/2/3D(). + */ +static void +compressed_tex_sub_image(GLuint dims, GLenum target, GLint level, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + GLenum format, GLsizei imageSize, const GLvoid *data) { struct gl_texture_object *texObj; struct gl_texture_image *texImage; @@ -3565,12 +3569,12 @@ _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - error = compressed_subtexture_error_check(ctx, 1, target, level, + error = compressed_subtexture_error_check(ctx, dims, target, level, xoffset, 0, 0, /* pos */ - width, 1, 1, /* size */ + width, height, depth, /* size */ format, imageSize); if (error) { - _mesa_error(ctx, error, "glCompressedTexSubImage1D"); + _mesa_error(ctx, error, "glCompressedTexSubImage%uD", dims); return; } @@ -3581,16 +3585,40 @@ _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, texImage = _mesa_select_tex_image(ctx, texObj, target, level); assert(texImage); - if (compressed_subtexture_error_check2(ctx, 1, width, 1, 1, + if (compressed_subtexture_error_check2(ctx, dims, width, height, depth, format, texImage)) { /* error was recorded */ } - else if (width > 0) { - if (ctx->Driver.CompressedTexSubImage1D) { - ctx->Driver.CompressedTexSubImage1D(ctx, target, level, - xoffset, width, - format, imageSize, data, - texObj, texImage); + else if (width > 0 && height > 0 && depth > 0) { + switch (dims) { + case 1: + if (ctx->Driver.CompressedTexSubImage1D) { + ctx->Driver.CompressedTexSubImage1D(ctx, target, level, + xoffset, width, + format, imageSize, data, + texObj, texImage); + } + break; + case 2: + if (ctx->Driver.CompressedTexSubImage2D) { + ctx->Driver.CompressedTexSubImage2D(ctx, target, level, + xoffset, yoffset, + width, height, + format, imageSize, data, + texObj, texImage); + } + break; + case 3: + if (ctx->Driver.CompressedTexSubImage3D) { + ctx->Driver.CompressedTexSubImage3D(ctx, target, level, + xoffset, yoffset, zoffset, + width, height, depth, + format, imageSize, data, + texObj, texImage); + } + break; + default: + ; } check_gen_mipmap(ctx, target, texObj, level); @@ -3602,53 +3630,24 @@ _mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, } +void GLAPIENTRY +_mesa_CompressedTexSubImage1DARB(GLenum target, GLint level, GLint xoffset, + GLsizei width, GLenum format, + GLsizei imageSize, const GLvoid *data) +{ + compressed_tex_sub_image(1, target, level, xoffset, 0, 0, width, 1, 1, + format, imageSize, data); +} + + void GLAPIENTRY _mesa_CompressedTexSubImage2DARB(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) { - struct gl_texture_object *texObj; - struct gl_texture_image *texImage; - GLenum error; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - - error = compressed_subtexture_error_check(ctx, 2, target, level, - xoffset, yoffset, 0, /* pos */ - width, height, 1, /* size */ - format, imageSize); - if (error) { - /* XXX proxy target? */ - _mesa_error(ctx, error, "glCompressedTexSubImage2D"); - return; - } - - texObj = get_current_tex_object(ctx, target); - - _mesa_lock_texture(ctx, texObj); - { - texImage = _mesa_select_tex_image(ctx, texObj, target, level); - assert(texImage); - - if (compressed_subtexture_error_check2(ctx, 2, width, height, 1, - format, texImage)) { - /* error was recorded */ - } - else if (width > 0 && height > 0) { - if (ctx->Driver.CompressedTexSubImage2D) { - ctx->Driver.CompressedTexSubImage2D(ctx, target, level, - xoffset, yoffset, width, height, - format, imageSize, data, - texObj, texImage); - } - - check_gen_mipmap(ctx, target, texObj, level); - - ctx->NewState |= _NEW_TEXTURE; - } - } - _mesa_unlock_texture(ctx, texObj); + compressed_tex_sub_image(2, target, level, xoffset, yoffset, 0, + width, height, 1, format, imageSize, data); } @@ -3658,47 +3657,8 @@ _mesa_CompressedTexSubImage3DARB(GLenum target, GLint level, GLint xoffset, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data) { - struct gl_texture_object *texObj; - struct gl_texture_image *texImage; - GLenum error; - GET_CURRENT_CONTEXT(ctx); - ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); - - error = compressed_subtexture_error_check(ctx, 3, target, level, - xoffset, yoffset, zoffset,/*pos*/ - width, height, depth, /*size*/ - format, imageSize); - if (error) { - _mesa_error(ctx, error, "glCompressedTexSubImage3D"); - return; - } - - texObj = get_current_tex_object(ctx, target); - - _mesa_lock_texture(ctx, texObj); - { - texImage = _mesa_select_tex_image(ctx, texObj, target, level); - assert(texImage); - - if (compressed_subtexture_error_check2(ctx, 3, width, height, depth, - format, texImage)) { - /* error was recorded */ - } - else if (width > 0 && height > 0 && depth > 0) { - if (ctx->Driver.CompressedTexSubImage3D) { - ctx->Driver.CompressedTexSubImage3D(ctx, target, level, - xoffset, yoffset, zoffset, - width, height, depth, - format, imageSize, data, - texObj, texImage); - } - - check_gen_mipmap(ctx, target, texObj, level); - - ctx->NewState |= _NEW_TEXTURE; - } - } - _mesa_unlock_texture(ctx, texObj); + compressed_tex_sub_image(3, target, level, xoffset, yoffset, zoffset, + width, height, depth, format, imageSize, data); } -- cgit v1.2.3 From 095e66f695ce1d869a824d9e22f63b54c95ca0ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 27 Oct 2009 20:09:53 +0000 Subject: llvmpipe: Implement round() for MSVC. --- src/gallium/drivers/llvmpipe/lp_test_main.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_test_main.c b/src/gallium/drivers/llvmpipe/lp_test_main.c index d4767ff52b..82fada5a35 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_main.c +++ b/src/gallium/drivers/llvmpipe/lp_test_main.c @@ -40,6 +40,18 @@ #include "lp_test.h" +#ifdef PIPE_CC_MSVC +static INLINE double +round(double x) +{ + if (x >= 0.0) + return floor(x + 0.5); + else + return ceil(x - 0.5); +} +#endif + + void dump_type(FILE *fp, struct lp_type type) -- cgit v1.2.3 From 0426227b68be9ad4ab7ed3591e77f31f3e21fbec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 27 Oct 2009 20:29:19 +0000 Subject: util: Fix cpuid on MSVC. --- src/gallium/auxiliary/util/u_cpu_detect.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c index c93e0db23c..623b1fd694 100644 --- a/src/gallium/auxiliary/util/u_cpu_detect.c +++ b/src/gallium/auxiliary/util/u_cpu_detect.c @@ -67,6 +67,9 @@ #if defined(PIPE_OS_WINDOWS) #include +#if defined(MSVC) +#include +#endif #endif @@ -337,6 +340,7 @@ static int has_cpuid(void) /** * @sa cpuid.h included in gcc-4.3 onwards. + * @sa http://msdn.microsoft.com/en-us/library/hskdteyh.aspx */ static INLINE int cpuid(uint32_t ax, uint32_t *p) @@ -366,7 +370,7 @@ cpuid(uint32_t ax, uint32_t *p) ); ret = 0; #elif defined(PIPE_CC_MSVC) - __cpuid(ax, p); + __cpuid(p, ax); ret = 0; #endif -- cgit v1.2.3 From 5eba607db6c50181bb12be5aee3735aafb40372e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 27 Oct 2009 20:45:53 +0000 Subject: util: Drop return value from cpuid(). --- src/gallium/auxiliary/util/u_cpu_detect.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c index 623b1fd694..facbe69173 100644 --- a/src/gallium/auxiliary/util/u_cpu_detect.c +++ b/src/gallium/auxiliary/util/u_cpu_detect.c @@ -76,7 +76,6 @@ struct util_cpu_caps util_cpu_caps; static int has_cpuid(void); -static int cpuid(uint32_t ax, uint32_t *p); #if defined(PIPE_ARCH_X86) @@ -342,11 +341,9 @@ static int has_cpuid(void) * @sa cpuid.h included in gcc-4.3 onwards. * @sa http://msdn.microsoft.com/en-us/library/hskdteyh.aspx */ -static INLINE int +static INLINE void cpuid(uint32_t ax, uint32_t *p) { - int ret = -1; - #if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86) __asm __volatile ( "xchgl %%ebx, %1\n\t" @@ -358,7 +355,6 @@ cpuid(uint32_t ax, uint32_t *p) "=d" (p[3]) : "0" (ax) ); - ret = 0; #elif defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64) __asm __volatile ( "cpuid\n\t" @@ -368,14 +364,14 @@ cpuid(uint32_t ax, uint32_t *p) "=d" (p[3]) : "0" (ax) ); - ret = 0; #elif defined(PIPE_CC_MSVC) __cpuid(p, ax); - - ret = 0; +#else + p[0] = 0; + p[1] = 0; + p[2] = 0; + p[3] = 0; #endif - - return ret; } #endif /* X86 or X86_64 */ -- cgit v1.2.3 From 182ff3e47a2d18917cdf3344c2ce95bd0a460784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Wed, 28 Oct 2009 11:05:32 +0000 Subject: llvmpipe: Make sure the JIT engine and X86 target are linked on MSVC build. Basically mimic the llvm 2.6 way of linking execution engines and targets. --- src/gallium/drivers/llvmpipe/Makefile | 3 ++ src/gallium/drivers/llvmpipe/SConscript | 1 + src/gallium/drivers/llvmpipe/lp_bld_misc.cpp | 62 ++++++++++++++++++++++++++++ src/gallium/drivers/llvmpipe/lp_bld_misc.h | 50 ++++++++++++++++++++++ src/gallium/drivers/llvmpipe/lp_jit.c | 3 +- src/gallium/drivers/llvmpipe/lp_test_main.c | 3 +- 6 files changed, 118 insertions(+), 4 deletions(-) create mode 100644 src/gallium/drivers/llvmpipe/lp_bld_misc.cpp create mode 100644 src/gallium/drivers/llvmpipe/lp_bld_misc.h (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/Makefile b/src/gallium/drivers/llvmpipe/Makefile index 96c014e592..cdf318844c 100644 --- a/src/gallium/drivers/llvmpipe/Makefile +++ b/src/gallium/drivers/llvmpipe/Makefile @@ -57,6 +57,9 @@ C_SOURCES = \ lp_tile_cache.c \ lp_tile_soa.c +CPP_SOURCES = \ + lp_bld_misc.cpp + include ../../Makefile.template lp_tile_soa.c: lp_tile_soa.py ../../auxiliary/util/u_format_parse.py ../../auxiliary/util/u_format_access.py ../../auxiliary/util/u_format.csv diff --git a/src/gallium/drivers/llvmpipe/SConscript b/src/gallium/drivers/llvmpipe/SConscript index 52983039fd..f4410f8201 100644 --- a/src/gallium/drivers/llvmpipe/SConscript +++ b/src/gallium/drivers/llvmpipe/SConscript @@ -34,6 +34,7 @@ llvmpipe = env.ConvenienceLibrary( 'lp_bld_format_soa.c', 'lp_bld_interp.c', 'lp_bld_intr.c', + 'lp_bld_misc.cpp', 'lp_bld_pack.c', 'lp_bld_sample.c', 'lp_bld_sample_soa.c', diff --git a/src/gallium/drivers/llvmpipe/lp_bld_misc.cpp b/src/gallium/drivers/llvmpipe/lp_bld_misc.cpp new file mode 100644 index 0000000000..c9acaf1f16 --- /dev/null +++ b/src/gallium/drivers/llvmpipe/lp_bld_misc.cpp @@ -0,0 +1,62 @@ +/************************************************************************** + * + * 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 "llvm/Config/config.h" + +#include "pipe/p_config.h" + +#include "lp_bld_misc.h" + + +#ifndef LLVM_NATIVE_ARCH + +namespace llvm { + extern void LinkInJIT(); +} + + +void +LLVMLinkInJIT(void) +{ + llvm::LinkInJIT(); +} + + +extern "C" int X86TargetMachineModule; + + +void +LLVMInitializeNativeTarget(void) +{ +#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) + X86TargetMachineModule = 1; +#endif +} + + +#endif diff --git a/src/gallium/drivers/llvmpipe/lp_bld_misc.h b/src/gallium/drivers/llvmpipe/lp_bld_misc.h new file mode 100644 index 0000000000..51a84c5e25 --- /dev/null +++ b/src/gallium/drivers/llvmpipe/lp_bld_misc.h @@ -0,0 +1,50 @@ +/************************************************************************** + * + * 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 LP_BLD_MISC_H +#define LP_BLD_MISC_H + + +#ifdef __cplusplus +extern "C" { +#endif + + +void +LLVMLinkInJIT(void); + +void +LLVMInitializeNativeTarget(void); + + +#ifdef __cplusplus +} +#endif + + +#endif /* !LP_BLD_MISC_H */ diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c index 1126bf90b9..13535dd638 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.c +++ b/src/gallium/drivers/llvmpipe/lp_jit.c @@ -39,6 +39,7 @@ #include "util/u_cpu_detect.h" #include "lp_screen.h" #include "lp_bld_intr.h" +#include "lp_bld_misc.h" #include "lp_jit.h" @@ -156,10 +157,8 @@ lp_jit_screen_init(struct llvmpipe_screen *screen) util_cpu_caps.has_sse4_1 = 0; #endif -#ifdef LLVM_NATIVE_ARCH LLVMLinkInJIT(); LLVMInitializeNativeTarget(); -#endif screen->module = LLVMModuleCreateWithName("llvmpipe"); diff --git a/src/gallium/drivers/llvmpipe/lp_test_main.c b/src/gallium/drivers/llvmpipe/lp_test_main.c index 82fada5a35..314544aa9a 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_main.c +++ b/src/gallium/drivers/llvmpipe/lp_test_main.c @@ -37,6 +37,7 @@ #include "util/u_cpu_detect.h" #include "lp_bld_const.h" +#include "lp_bld_misc.h" #include "lp_test.h" @@ -379,10 +380,8 @@ int main(int argc, char **argv) n = atoi(argv[i]); } -#ifdef LLVM_NATIVE_ARCH LLVMLinkInJIT(); LLVMInitializeNativeTarget(); -#endif util_cpu_detect(); -- cgit v1.2.3 From a7d0665c00053839065592c339bfb298187a82be Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 28 Oct 2009 11:09:50 -0600 Subject: intel: Fix memory leak in event of mip tree allocation failure Signed-off-by: Brian Paul --- src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 0589d82db2..459e8fbd4b 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -134,8 +134,10 @@ intel_miptree_create(struct intel_context *intel, /* * pitch == 0 || height == 0 indicates the null texture */ - if (!mt || !mt->pitch || !mt->total_height) + if (!mt || !mt->pitch || !mt->total_height) { + free(mt); return NULL; + } mt->region = intel_region_alloc(intel, tiling, -- cgit v1.2.3 From 5e3b2baae74e6cde494b2fe5c6b32e3e8ef0ce87 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 28 Oct 2009 11:11:30 -0600 Subject: mesa: include imports.h to silence warning --- src/mesa/shader/symbol_table.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/shader/symbol_table.c b/src/mesa/shader/symbol_table.c index 42601a7765..73eeb616f3 100644 --- a/src/mesa/shader/symbol_table.c +++ b/src/mesa/shader/symbol_table.c @@ -26,6 +26,7 @@ #include #include +#include "main/imports.h" #include "symbol_table.h" #include "hash_table.h" -- cgit v1.2.3 From 0219cd0961e6b47761fe6984dc6c0a8bfa6057d8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 28 Oct 2009 11:13:21 -0600 Subject: mesa: remove unneeded #includes --- src/mesa/shader/hash_table.c | 4 ---- src/mesa/shader/symbol_table.c | 5 ----- 2 files changed, 9 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/hash_table.c b/src/mesa/shader/hash_table.c index 881179f9d8..e89a2564d7 100644 --- a/src/mesa/shader/hash_table.c +++ b/src/mesa/shader/hash_table.c @@ -27,10 +27,6 @@ * * \author Ian Romanick */ -#include -#include - -#include #include "main/imports.h" #include "main/simple_list.h" diff --git a/src/mesa/shader/symbol_table.c b/src/mesa/shader/symbol_table.c index 73eeb616f3..1f6d9b844d 100644 --- a/src/mesa/shader/symbol_table.c +++ b/src/mesa/shader/symbol_table.c @@ -20,11 +20,6 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ -#include -#include -#include -#include -#include #include "main/imports.h" #include "symbol_table.h" -- cgit v1.2.3 From c0a61c8442af3cfa810098d34bf6a21d11a5d720 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 28 Oct 2009 13:09:44 -0600 Subject: intel: Fix memory leak in case of renderbuffer bad format Signed-off-by: Brian Paul --- src/mesa/drivers/dri/intel/intel_fbo.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index cf007d5b62..a49868bfef 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -385,6 +385,7 @@ intel_create_renderbuffer(GLenum intFormat) default: _mesa_problem(NULL, "Unexpected intFormat in intel_create_renderbuffer"); + _mesa_free(irb); return NULL; } -- cgit v1.2.3 From c451011d99a33350d70766f902ad09a0b606f7c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 28 Oct 2009 01:38:40 +0100 Subject: mesa/st: fix crash in st_texture_image_copy Signed-off-by: Corbin Simpson --- src/mesa/state_tracker/st_texture.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index ba8d1e8cc1..3f30137747 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -342,12 +342,21 @@ st_texture_image_copy(struct pipe_context *pipe, src_surface = screen->get_tex_surface(screen, src, face, srcLevel, i, PIPE_BUFFER_USAGE_GPU_READ); - pipe->surface_copy(pipe, - dst_surface, - 0, 0, /* destX, Y */ - src_surface, - 0, 0, /* srcX, Y */ - width, height); + if (pipe->surface_copy) { + pipe->surface_copy(pipe, + dst_surface, + 0, 0, /* destX, Y */ + src_surface, + 0, 0, /* srcX, Y */ + width, height); + } else { + util_surface_copy(pipe, FALSE, + dst_surface, + 0, 0, /* destX, Y */ + src_surface, + 0, 0, /* srcX, Y */ + width, height); + } pipe_surface_reference(&src_surface, NULL); pipe_surface_reference(&dst_surface, NULL); -- cgit v1.2.3 From 0e44884aada4e4bd6384245d9ae065da5aca7f3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 28 Oct 2009 02:19:52 +0100 Subject: r300g: fix blending and do some optimizations Signed-off-by: Corbin Simpson --- src/gallium/drivers/r300/r300_emit.c | 1 + src/gallium/drivers/r300/r300_state.c | 101 ++++++++++++++++++---------------- 2 files changed, 54 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 258c38fefd..096165a292 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -31,6 +31,7 @@ #include "r300_screen.h" #include "r300_state_derived.h" #include "r300_state_inlines.h" +#include "r300_texture.h" #include "r300_vs.h" void r300_emit_blend_state(struct r300_context* r300, diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index a3e1bc621a..5d28837ef7 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -49,46 +49,47 @@ static void* r300_create_blend_state(struct pipe_context* pipe, { struct r300_blend_state* blend = CALLOC_STRUCT(r300_blend_state); + if (state->blend_enable) { - unsigned eqRGB = state->rgb_func; - unsigned srcRGB = state->rgb_src_factor; - unsigned dstRGB = state->rgb_dst_factor; - - unsigned eqA = state->alpha_func; - unsigned srcA = state->alpha_src_factor; - unsigned dstA = state->alpha_dst_factor; - - if (srcA != srcRGB || - dstA != dstRGB || - eqA != eqRGB) { - blend->alpha_blend_control = - r300_translate_blend_function(eqA) | - (r300_translate_blend_factor(srcA) << - R300_SRC_BLEND_SHIFT) | - (r300_translate_blend_factor(dstA) << - R300_DST_BLEND_SHIFT); - blend->blend_control |= R300_ALPHA_BLEND_ENABLE | - R300_SEPARATE_ALPHA_ENABLE; - } else { - blend->alpha_blend_control = R300_COMB_FCN_ADD_CLAMP | - (R300_BLEND_GL_ONE << R300_SRC_BLEND_SHIFT) | - (R300_BLEND_GL_ZERO << R300_DST_BLEND_SHIFT); - } - } - if (state->blend_enable) { - /* XXX for now, always do separate alpha... - * is it faster to do it with one reg? */ - blend->blend_control |= R300_READ_ENABLE | - r300_translate_blend_function(state->rgb_func) | - (r300_translate_blend_factor(state->rgb_src_factor) << - R300_SRC_BLEND_SHIFT) | - (r300_translate_blend_factor(state->rgb_dst_factor) << - R300_DST_BLEND_SHIFT); - } else { - blend->blend_control = - R300_COMB_FCN_ADD_CLAMP | - (R300_BLEND_GL_ONE << R300_SRC_BLEND_SHIFT) | - (R300_BLEND_GL_ZERO << R300_DST_BLEND_SHIFT); + unsigned eqRGB = state->rgb_func; + unsigned srcRGB = state->rgb_src_factor; + unsigned dstRGB = state->rgb_dst_factor; + + unsigned eqA = state->alpha_func; + unsigned srcA = state->alpha_src_factor; + unsigned dstA = state->alpha_dst_factor; + + /* despite the name, ALPHA_BLEND_ENABLE has nothing to do with alpha, + * this is just the crappy D3D naming */ + blend->blend_control = R300_ALPHA_BLEND_ENABLE | + r300_translate_blend_function(eqRGB) | + ( r300_translate_blend_factor(srcRGB) << R300_SRC_BLEND_SHIFT) | + ( r300_translate_blend_factor(dstRGB) << R300_DST_BLEND_SHIFT); + + /* optimization: some operations do not require the destination color */ + if (eqRGB == PIPE_BLEND_MIN || eqA == PIPE_BLEND_MIN || + eqRGB == PIPE_BLEND_MAX || eqA == PIPE_BLEND_MAX || + dstRGB != PIPE_BLENDFACTOR_ZERO || + dstA != PIPE_BLENDFACTOR_ZERO || + srcRGB == PIPE_BLENDFACTOR_DST_COLOR || + srcRGB == PIPE_BLENDFACTOR_DST_ALPHA || + srcRGB == PIPE_BLENDFACTOR_INV_DST_COLOR || + srcRGB == PIPE_BLENDFACTOR_INV_DST_ALPHA || + srcA == PIPE_BLENDFACTOR_DST_ALPHA || + srcA == PIPE_BLENDFACTOR_INV_DST_ALPHA) + blend->blend_control |= R300_READ_ENABLE; + + /* XXX implement the optimization with DISCARD_SRC_PIXELS*/ + /* XXX implement the optimization with SRC_ALPHA_?_NO_READ */ + + /* separate alpha */ + if (srcA != srcRGB || dstA != dstRGB || eqA != eqRGB) { + blend->blend_control |= R300_SEPARATE_ALPHA_ENABLE; + blend->alpha_blend_control = + r300_translate_blend_function(eqA) | + (r300_translate_blend_factor(srcA) << R300_SRC_BLEND_SHIFT) | + (r300_translate_blend_factor(dstA) << R300_DST_BLEND_SHIFT); + } } /* PIPE_LOGICOP_* don't need to be translated, fortunately. */ @@ -122,25 +123,29 @@ static void r300_delete_blend_state(struct pipe_context* pipe, FREE(state); } +/* Convert float to 10bit integer */ +static unsigned float_to_fixed10(float f) +{ + return CLAMP((unsigned)(f * 1023.9f), 0, 1023); +} + /* Set blend color. * Setup both R300 and R500 registers, figure out later which one to write. */ static void r300_set_blend_color(struct pipe_context* pipe, const struct pipe_blend_color* color) { struct r300_context* r300 = r300_context(pipe); - ubyte ur, ug, ub, ua; - - ur = float_to_ubyte(color->color[0]); - ug = float_to_ubyte(color->color[1]); - ub = float_to_ubyte(color->color[2]); - ua = float_to_ubyte(color->color[3]); util_pack_color(color->color, PIPE_FORMAT_A8R8G8B8_UNORM, &r300->blend_color_state->blend_color); - /* XXX this is wrong */ - r300->blend_color_state->blend_color_red_alpha = ur | (ua << 16); - r300->blend_color_state->blend_color_green_blue = ub | (ug << 16); + /* XXX if FP16 blending is enabled, we should use the FP16 format */ + r300->blend_color_state->blend_color_red_alpha = + float_to_fixed10(color->color[0]) | + (float_to_fixed10(color->color[3]) << 16); + r300->blend_color_state->blend_color_green_blue = + float_to_fixed10(color->color[2]) | + (float_to_fixed10(color->color[1]) << 16); r300->dirty_state |= R300_NEW_BLEND_COLOR; } -- cgit v1.2.3 From a1d726aae8fcacfa1eb1d76ce9c46adaafeaf4a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 28 Oct 2009 02:21:49 +0100 Subject: r300g: fix the WRAP_T mode when using 1D textures Signed-off-by: Corbin Simpson --- src/gallium/drivers/r300/r300_emit.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 096165a292..8bfa2932c9 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -532,10 +532,17 @@ void r300_emit_texture(struct r300_context* r300, struct r300_texture* tex, unsigned offset) { + uint32_t filter0 = sampler->filter0; CS_LOCALS(r300); + /* to emulate 1D textures through 2D ones correctly */ + if (tex->tex.height[0] == 1) { + filter0 &= ~R300_TX_WRAP_T_MASK; + filter0 |= R300_TX_WRAP_T(R300_TX_CLAMP_TO_EDGE); + } + BEGIN_CS(16); - OUT_CS_REG(R300_TX_FILTER0_0 + (offset * 4), sampler->filter0 | + OUT_CS_REG(R300_TX_FILTER0_0 + (offset * 4), filter0 | (offset << 28)); OUT_CS_REG(R300_TX_FILTER1_0 + (offset * 4), sampler->filter1); OUT_CS_REG(R300_TX_BORDER_COLOR_0 + (offset * 4), sampler->border_color); -- cgit v1.2.3 From bcfde429139476c2d04baddaf671651cfc860145 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 28 Oct 2009 02:43:51 +0100 Subject: r300g: fix emitting the stencil-ref and alpha-ref values Signed-off-by: Corbin Simpson DSA really needs its head examined someday. ~ C. --- src/gallium/drivers/r300/r300_emit.c | 16 ++++++++++------ src/gallium/drivers/r300/r300_reg.h | 2 ++ src/gallium/drivers/r300/r300_state.c | 24 +++++++++++++++++++----- 3 files changed, 31 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 8bfa2932c9..2a8e4a9f41 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -102,19 +102,23 @@ void r300_emit_dsa_state(struct r300_context* r300, struct r300_screen* r300screen = r300_screen(r300->context.screen); CS_LOCALS(r300); - BEGIN_CS(r300screen->caps->is_r500 ? 8 : 8); + BEGIN_CS(r300screen->caps->is_r500 ? 10 : 8); OUT_CS_REG(R300_FG_ALPHA_FUNC, dsa->alpha_function); - /* XXX figure out the r300 counterpart for this */ - if (r300screen->caps->is_r500) { - /* OUT_CS_REG(R500_FG_ALPHA_VALUE, dsa->alpha_reference); */ - } + + /* not needed since we use the 8bit alpha ref */ + /*if (r300screen->caps->is_r500) { + OUT_CS_REG(R500_FG_ALPHA_VALUE, dsa->alpha_reference); + }*/ + OUT_CS_REG_SEQ(R300_ZB_CNTL, 3); OUT_CS(dsa->z_buffer_control); OUT_CS(dsa->z_stencil_control); OUT_CS(dsa->stencil_ref_mask); OUT_CS_REG(R300_ZB_ZTOP, r300->ztop_state.z_buffer_top); + + /* XXX it seems r3xx doesn't support STENCILREFMASK_BF */ if (r300screen->caps->is_r500) { - /* OUT_CS_REG(R500_ZB_STENCILREFMASK_BF, dsa->stencil_ref_bf); */ + OUT_CS_REG(R500_ZB_STENCILREFMASK_BF, dsa->stencil_ref_bf); } END_CS; } diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h index e920b2a5e7..babc3c709e 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -2416,6 +2416,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_Z_WRITE_ENABLE (1 << 2) # define R300_Z_SIGNED_COMPARE (1 << 3) # define R300_STENCIL_FRONT_BACK (1 << 4) +# define R500_STENCIL_ZSIGNED_MAGNITUDE (1 << 5) +# define R500_STENCIL_REFMASK_FRONT_BACK (1 << 6) #define R300_ZB_ZSTENCILCNTL 0x4f04 /* functions */ diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 5d28837ef7..5db8c69dec 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -198,6 +198,8 @@ static void* r300_create_dsa_state(struct pipe_context* pipe, const struct pipe_depth_stencil_alpha_state* state) { + struct r300_capabilities *caps = + r300_screen(r300_context(pipe)->context.screen)->caps; struct r300_dsa_state* dsa = CALLOC_STRUCT(r300_dsa_state); /* Depth test setup. */ @@ -242,9 +244,16 @@ static void* (r300_translate_stencil_op(state->stencil[1].zfail_op) << R300_S_BACK_ZFAIL_OP_SHIFT); - dsa->stencil_ref_bf = (state->stencil[1].ref_value) | - (state->stencil[1].valuemask << R300_STENCILMASK_SHIFT) | - (state->stencil[1].writemask << R300_STENCILWRITEMASK_SHIFT); + /* XXX it seems r3xx doesn't support STENCILREFMASK_BF */ + if (caps->is_r500) + { + dsa->z_buffer_control |= R500_STENCIL_REFMASK_FRONT_BACK; + dsa->stencil_ref_bf = (state->stencil[1].ref_value) | + (state->stencil[1].valuemask << + R300_STENCILMASK_SHIFT) | + (state->stencil[1].writemask << + R300_STENCILWRITEMASK_SHIFT); + } } } @@ -253,8 +262,13 @@ static void* dsa->alpha_function = r300_translate_alpha_function(state->alpha.func) | R300_FG_ALPHA_FUNC_ENABLE; - dsa->alpha_reference = CLAMP(state->alpha.ref_value * 1023.0f, - 0, 1023); + + /* XXX figure out why emitting 10bit alpha ref causes CS to dump */ + /* always use 8bit alpha ref */ + dsa->alpha_function |= float_to_ubyte(state->alpha.ref_value); + + if (caps->is_r500) + dsa->alpha_function |= R500_FG_ALPHA_FUNC_8BIT; } return (void*)dsa; -- cgit v1.2.3 From 81c51bb67f97c60e21a5e7cf87e154bb46ee481b Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 28 Oct 2009 10:02:23 -0700 Subject: r300g: Fix XXX. Nothing strange here. --- src/gallium/drivers/r300/r300_texture.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 2a33393a8c..3e90fea6c8 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -53,7 +53,6 @@ static void r300_setup_texture_state(struct r300_texture* tex, boolean is_r500) R300_TX_NUM_LEVELS(pt->last_level & 0xf); } - /* XXX */ state->format1 = r300_translate_texformat(pt->format); if (pt->target == PIPE_TEXTURE_CUBE) { state->format1 |= R300_TX_FORMAT_CUBIC_MAP; -- cgit v1.2.3 From 6007e2e0085d9131b22dc8a98d7500a66a0e4c97 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 28 Oct 2009 11:47:24 -0700 Subject: r300g: Clear up a bit of the buffer reference stuff. Still need to actually get reference info from winsys somehow. Doing added buffers is easy, but knowing whether a flush has happened is a bit tricky. --- src/gallium/drivers/r300/r300_context.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index c34fbb1123..e45564b54e 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -76,26 +76,23 @@ static void r300_destroy_context(struct pipe_context* context) } static unsigned int -r300_is_texture_referenced( struct pipe_context *pipe, - struct pipe_texture *texture, - unsigned face, unsigned level) +r300_is_texture_referenced(struct pipe_context *pipe, + struct pipe_texture *texture, + unsigned face, unsigned level) { - /** - * FIXME: Optimize. - */ + struct pipe_buffer* buf; - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; + r300_get_texture_buffer(texture, &buf, NULL); + + return pipe->is_buffer_referenced(pipe, buf); } static unsigned int -r300_is_buffer_referenced( struct pipe_context *pipe, - struct pipe_buffer *buf) +r300_is_buffer_referenced(struct pipe_context *pipe, + struct pipe_buffer *buf) { - /** - * FIXME: Optimize. - */ - - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; + /* XXX */ + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; } static void r300_flush_cb(void *data) -- cgit v1.2.3 From e7c8a2763855c35af1d141b67551b364e6579051 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 18 Oct 2009 18:06:51 +0200 Subject: r300g: add some texture formats --- src/gallium/drivers/r300/r300_screen.c | 2 ++ src/gallium/drivers/r300/r300_texture.h | 7 +++++++ 2 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 6eaf35bd4b..6efa17cbaf 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -197,6 +197,8 @@ static boolean check_tex_format(enum pipe_format format, uint32_t usage, case PIPE_FORMAT_DXT3_RGBA: case PIPE_FORMAT_DXT5_RGBA: case PIPE_FORMAT_YCBCR: + case PIPE_FORMAT_L8_UNORM: + case PIPE_FORMAT_A8L8_UNORM: retval = usage & PIPE_TEXTURE_USAGE_SAMPLER; break; diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h index 35e06a9acb..a18e0cbe1a 100644 --- a/src/gallium/drivers/r300/r300_texture.h +++ b/src/gallium/drivers/r300/r300_texture.h @@ -85,6 +85,13 @@ static INLINE uint32_t r300_translate_texformat(enum pipe_format format) case PIPE_FORMAT_Z24S8_UNORM: case PIPE_FORMAT_Z24X8_UNORM: return R300_EASY_TX_FORMAT(X, X, X, X, W24_FP); + + case PIPE_FORMAT_A8L8_UNORM: + return R300_EASY_TX_FORMAT(X, X, X, Y, Y8X8); + + case PIPE_FORMAT_L8_UNORM: + return R300_EASY_TX_FORMAT(X, X, X, ONE, X8); + default: debug_printf("r300: Implementation error: " "Got unsupported texture format %s in %s\n", -- cgit v1.2.3 From 23d8d15bedb7178bedde9b994be3925a160c193d Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 28 Oct 2009 11:58:13 -0700 Subject: r300g: Keep texture formats organized. --- src/gallium/drivers/r300/r300_texture.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_texture.h b/src/gallium/drivers/r300/r300_texture.h index a18e0cbe1a..55ceb1a513 100644 --- a/src/gallium/drivers/r300/r300_texture.h +++ b/src/gallium/drivers/r300/r300_texture.h @@ -43,6 +43,8 @@ static INLINE uint32_t r300_translate_texformat(enum pipe_format format) /* X8 */ case PIPE_FORMAT_I8_UNORM: return R300_EASY_TX_FORMAT(X, X, X, X, X8); + case PIPE_FORMAT_L8_UNORM: + return R300_EASY_TX_FORMAT(X, X, X, ONE, X8); /* X16 */ case PIPE_FORMAT_R16_UNORM: return R300_EASY_TX_FORMAT(X, X, X, X, X16); @@ -51,6 +53,9 @@ static INLINE uint32_t r300_translate_texformat(enum pipe_format format) R300_TX_FORMAT_SIGNED; case PIPE_FORMAT_Z16_UNORM: return R300_EASY_TX_FORMAT(X, X, X, X, X16); + /* Y8X8 */ + case PIPE_FORMAT_A8L8_UNORM: + return R300_EASY_TX_FORMAT(X, X, X, Y, Y8X8); /* W8Z8Y8X8 */ case PIPE_FORMAT_A8R8G8B8_UNORM: return R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8); @@ -86,12 +91,6 @@ static INLINE uint32_t r300_translate_texformat(enum pipe_format format) case PIPE_FORMAT_Z24X8_UNORM: return R300_EASY_TX_FORMAT(X, X, X, X, W24_FP); - case PIPE_FORMAT_A8L8_UNORM: - return R300_EASY_TX_FORMAT(X, X, X, Y, Y8X8); - - case PIPE_FORMAT_L8_UNORM: - return R300_EASY_TX_FORMAT(X, X, X, ONE, X8); - default: debug_printf("r300: Implementation error: " "Got unsupported texture format %s in %s\n", -- cgit v1.2.3 From f3d8d534e6f1d102d71338d58fbaa98c382f1858 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 28 Oct 2009 12:11:52 -0700 Subject: r300g: Use u_trim_pipe_prim to prevent lockups from incorrect vert counts. Adapted from osiris' version on his tree. --- src/gallium/drivers/r300/r300_render.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 6f392402bd..c36350d29e 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -26,6 +26,7 @@ #include "pipe/p_inlines.h" #include "util/u_memory.h" +#include "util/u_prim.h" #include "r300_cs.h" #include "r300_context.h" @@ -86,6 +87,10 @@ boolean r300_draw_range_elements(struct pipe_context* pipe, CS_LOCALS(r300); + if (!u_trim_pipe_prim(mode, &count)) { + return FALSE; + } + validate: for (i = 0; i < aos_count; i++) { if (!r300->winsys->add_buffer(r300->winsys, aos[i].buffer, @@ -191,6 +196,10 @@ boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe, struct r300_context* r300 = r300_context(pipe); int i; + if (!u_trim_pipe_prim(mode, &count)) { + return FALSE; + } + for (i = 0; i < r300->vertex_buffer_count; i++) { void* buf = pipe_buffer_map(pipe->screen, r300->vertex_buffers[i].buffer, -- cgit v1.2.3 From 660acd60d00366c97fbe7caf3995a75ce935a19b Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 28 Oct 2009 15:36:53 -0400 Subject: r600: add occlusion query support Based on initial patch from Stephan Schmid . Basic idea is to dump the zpass count at the start and end of the query and subtract to get the total number of visible fragments. HW writes alternating qwords for up to 4 DBs. On the first pass, we start at buffer address + 0; on the second pass, we start at buffer address + 8 (bytes). The resulting buffer at the end of the query looks like: qw[0]: db0 start qw[1]: db0 end ... qw[6]: db3 start qw[7]: db3 end The MSB of each qword is the valid bit and the lower 63 bits are the zpass count for that DB. OQ on RV740 is disabled at the moment as it only seems to report results for half of its DBs. This needs further investigation. Signed-off-by: Alex Deucher --- src/mesa/drivers/dri/r600/r600_context.c | 31 +++++++++++++-- src/mesa/drivers/dri/r600/r700_chip.c | 54 +++++++++++++++++++++++++++ src/mesa/drivers/dri/r600/r700_state.c | 1 + src/mesa/drivers/dri/radeon/radeon_queryobj.c | 33 +++++++++++++--- 4 files changed, 109 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index c1bf76deb8..6de151d51b 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -64,6 +64,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r600_cmdbuf.h" #include "r600_emit.h" #include "radeon_bocs_wrapper.h" +#include "radeon_queryobj.h" #include "r700_state.h" #include "r700_ioctl.h" @@ -73,11 +74,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "utils.h" #include "xmlpool.h" /* for symbolic values of enum-type options */ -/* hw_tcl_on derives from future_hw_tcl_on when its safe to change it. */ -int future_hw_tcl_on = 1; -int hw_tcl_on = 1; - #define need_GL_VERSION_2_0 +#define need_GL_ARB_occlusion_query #define need_GL_ARB_point_parameters #define need_GL_ARB_vertex_program #define need_GL_EXT_blend_equation_separate @@ -98,6 +96,7 @@ static const struct dri_extension card_extensions[] = { /* *INDENT-OFF* */ {"GL_ARB_depth_texture", NULL}, {"GL_ARB_fragment_program", NULL}, + {"GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions}, {"GL_ARB_multitexture", NULL}, {"GL_ARB_point_parameters", GL_ARB_point_parameters_functions}, {"GL_ARB_shadow", NULL}, @@ -204,6 +203,24 @@ static void r600_fallback(GLcontext *ctx, GLuint bit, GLboolean mode) context->radeon.Fallback &= ~bit; } +static void r600_emit_query_finish(radeonContextPtr radeon) +{ + context_t *context = (context_t*) radeon; + BATCH_LOCALS(&context->radeon); + + struct radeon_query_object *query = radeon->query.current; + + BEGIN_BATCH_NO_AUTOSTATE(4 + 2); + R600_OUT_BATCH(CP_PACKET3(R600_IT_EVENT_WRITE, 2)); + R600_OUT_BATCH(ZPASS_DONE); + R600_OUT_BATCH(query->curr_offset + 8); /* hw writes qwords */ + R600_OUT_BATCH(0x00000000); + R600_OUT_BATCH_RELOC(VGT_EVENT_INITIATOR, query->bo, 0, 0, RADEON_GEM_DOMAIN_GTT, 0); + END_BATCH(); + assert(query->curr_offset < RADEON_QUERY_PAGE_SIZE); + query->emitted_begin = GL_FALSE; +} + static void r600_init_vtbl(radeonContextPtr radeon) { radeon->vtbl.get_lock = r600_get_lock; @@ -212,6 +229,7 @@ static void r600_init_vtbl(radeonContextPtr radeon) radeon->vtbl.swtcl_flush = NULL; radeon->vtbl.pre_emit_atoms = r600_vtbl_pre_emit_atoms; radeon->vtbl.fallback = r600_fallback; + radeon->vtbl.emit_query_finish = r600_emit_query_finish; } static void r600InitConstValues(GLcontext *ctx, radeonScreenPtr screen) @@ -302,6 +320,10 @@ static void r600InitGLExtensions(GLcontext *ctx) { _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); } + + /* XXX: RV740 only seems to report results from half of its DBs */ + if (r600->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV740) + _mesa_disable_extension(ctx, "GL_ARB_occlusion_query"); } /* Create the device specific rendering context. @@ -340,6 +362,7 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual, r700InitStateFuncs(&functions); r600InitTextureFuncs(&functions); r700InitShaderFuncs(&functions); + radeonInitQueryObjFunctions(&functions); r700InitIoctlFuncs(&functions); radeonInitBufferObjectFuncs(&functions); diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index 75b97c56cd..ace3d24f06 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -1100,6 +1100,32 @@ static void r700SendVSConsts(GLcontext *ctx, struct radeon_state_atom *atom) COMMIT_BATCH(); } +static void r700SendQueryBegin(GLcontext *ctx, struct radeon_state_atom *atom) +{ + radeonContextPtr radeon = RADEON_CONTEXT(ctx); + struct radeon_query_object *query = radeon->query.current; + BATCH_LOCALS(radeon); + radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); + + /* clear the buffer */ + radeon_bo_map(query->bo, GL_FALSE); + memset(query->bo->ptr, 0, 4 * 2 * sizeof(uint64_t)); /* 4 DBs, 2 qwords each */ + radeon_bo_unmap(query->bo); + + radeon_cs_space_check_with_bo(radeon->cmdbuf.cs, + query->bo, + 0, RADEON_GEM_DOMAIN_GTT); + + BEGIN_BATCH_NO_AUTOSTATE(4 + 2); + R600_OUT_BATCH(CP_PACKET3(R600_IT_EVENT_WRITE, 2)); + R600_OUT_BATCH(ZPASS_DONE); + R600_OUT_BATCH(query->curr_offset); /* hw writes qwords */ + R600_OUT_BATCH(0x00000000); + R600_OUT_BATCH_RELOC(VGT_EVENT_INITIATOR, query->bo, 0, 0, RADEON_GEM_DOMAIN_GTT, 0); + END_BATCH(); + query->emitted_begin = GL_TRUE; +} + static int check_always(GLcontext *ctx, struct radeon_state_atom *atom) { return atom->cmd_size; @@ -1208,6 +1234,20 @@ static int check_vs_consts(GLcontext *ctx, struct radeon_state_atom *atom) return count; } +static int check_queryobj(GLcontext *ctx, struct radeon_state_atom *atom) +{ + radeonContextPtr radeon = RADEON_CONTEXT(ctx); + struct radeon_query_object *query = radeon->query.current; + int count; + + if (!query || query->emitted_begin) + count = 0; + else + count = atom->cmd_size; + radeon_print(RADEON_STATE, RADEON_TRACE, "%s %d\n", __func__, count); + return count; +} + #define ALLOC_STATE( ATOM, CHK, SZ, EMIT ) \ do { \ context->atoms.ATOM.cmd_size = (SZ); \ @@ -1221,6 +1261,19 @@ do { \ insert_at_tail(&context->radeon.hw.atomlist, &context->atoms.ATOM); \ } while (0) +static void r600_init_query_stateobj(radeonContextPtr radeon, int SZ) +{ + radeon->query.queryobj.cmd_size = (SZ); + radeon->query.queryobj.cmd = NULL; + radeon->query.queryobj.name = "queryobj"; + radeon->query.queryobj.idx = 0; + radeon->query.queryobj.check = check_queryobj; + radeon->query.queryobj.dirty = GL_FALSE; + radeon->query.queryobj.emit = r700SendQueryBegin; + radeon->hw.max_state_size += (SZ); + insert_at_tail(&radeon->hw.atomlist, &radeon->query.queryobj); +} + void r600InitAtoms(context_t *context) { radeon_print(RADEON_STATE, RADEON_NORMAL, "%s %p\n", __func__, context); @@ -1260,6 +1313,7 @@ void r600InitAtoms(context_t *context) ALLOC_STATE(tx, tx, (R700_TEXTURE_NUMBERUNITS * 20), r700SendTexState); ALLOC_STATE(tx_smplr, tx, (R700_TEXTURE_NUMBERUNITS * 5), r700SendTexSamplerState); ALLOC_STATE(tx_brdr_clr, tx, (R700_TEXTURE_NUMBERUNITS * 6), r700SendTexBorderColorState); + r600_init_query_stateobj(&context->radeon, 6 * 2); context->radeon.hw.is_dirty = GL_TRUE; context->radeon.hw.all_dirty = GL_TRUE; diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index 9a6a68a68c..0b676362f8 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -1675,6 +1675,7 @@ void r700InitState(GLcontext * ctx) //------------------- SETfield(r700->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIZ_ENABLE_shift, FORCE_HIZ_ENABLE_mask); SETfield(r700->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIS_ENABLE0_shift, FORCE_HIS_ENABLE0_mask); SETfield(r700->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIS_ENABLE1_shift, FORCE_HIS_ENABLE1_mask); + SETbit(r700->DB_RENDER_OVERRIDE.u32All, NOOP_CULL_DISABLE_bit); r700->DB_ALPHA_TO_MASK.u32All = 0; SETfield(r700->DB_ALPHA_TO_MASK.u32All, 2, ALPHA_TO_MASK_OFFSET0_shift, ALPHA_TO_MASK_OFFSET0_mask); diff --git a/src/mesa/drivers/dri/radeon/radeon_queryobj.c b/src/mesa/drivers/dri/radeon/radeon_queryobj.c index b79d864ba2..6539c36268 100644 --- a/src/mesa/drivers/dri/radeon/radeon_queryobj.c +++ b/src/mesa/drivers/dri/radeon/radeon_queryobj.c @@ -47,8 +47,8 @@ static int radeonQueryIsFlushed(GLcontext *ctx, struct gl_query_object *q) static void radeonQueryGetResult(GLcontext *ctx, struct gl_query_object *q) { + radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = (struct radeon_query_object *)q; - uint32_t *result; int i; radeon_print(RADEON_STATE, RADEON_VERBOSE, @@ -57,12 +57,33 @@ static void radeonQueryGetResult(GLcontext *ctx, struct gl_query_object *q) radeon_bo_map(query->bo, GL_FALSE); - result = query->bo->ptr; - query->Base.Result = 0; - for (i = 0; i < query->curr_offset/sizeof(uint32_t); ++i) { - query->Base.Result += result[i]; - radeon_print(RADEON_STATE, RADEON_TRACE, "result[%d] = %d\n", i, result[i]); + if (IS_R600_CLASS(radeon->radeonScreen)) { + /* ZPASS EVENT writes alternating qwords + * At query start we set the start offset to 0 and + * hw writes zpass start counts to qwords 0, 2, 4, 6. + * At query end we set the start offset to 8 and + * hw writes zpass end counts to qwords 1, 3, 5, 7. + * then we substract. MSB is the valid bit. + */ + uint64_t *result = query->bo->ptr; + for (i = 0; i < 8; i += 2) { + uint64_t start = result[i]; + uint64_t end = result[i + 1]; + if ((start & 0x8000000000000000) && (end & 0x8000000000000000)) { + uint64_t query_count = end - start; + query->Base.Result += query_count; + + } + radeon_print(RADEON_STATE, RADEON_TRACE, + "%d start: %lx, end: %lx %ld\n", i, start, end, end - start); + } + } else { + uint32_t *result = query->bo->ptr; + for (i = 0; i < query->curr_offset/sizeof(uint32_t); ++i) { + query->Base.Result += result[i]; + radeon_print(RADEON_STATE, RADEON_TRACE, "result[%d] = %d\n", i, result[i]); + } } radeon_bo_unmap(query->bo); -- cgit v1.2.3 From 24c61c8c2e2747f73b963a7019485eb5105b853c Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Sun, 25 Oct 2009 19:47:41 -0400 Subject: st/xorg: fix src coordinates in the video acceleration paths --- src/gallium/state_trackers/xorg/xorg_xv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index 2a3a42bdea..c3d9454245 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -484,7 +484,7 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id, w = box_x2 - box_x1; h = box_y2 - box_y1; - draw_yuv(pPriv, x, y, x, y, w, h); + draw_yuv(pPriv, src_x, src_y, x, y, w, h); pbox++; } -- cgit v1.2.3 From 96128fdf2f959e2b59eca8f234dc6f3adf7a553f Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 28 Oct 2009 17:59:49 -0600 Subject: mesa: Fix memory leak if we run out of memory Signed-off-by: Brian Paul --- src/mesa/main/texstore.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index a22db628d3..d3237959e0 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -589,8 +589,12 @@ _mesa_make_temp_chan_image(GLcontext *ctx, GLuint dims, /* unpack and transfer the source image */ tempImage = (GLchan *) _mesa_malloc(srcWidth * srcHeight * srcDepth * components * sizeof(GLchan)); - if (!tempImage) + if (!tempImage) { + if (freeSrcImage) { + _mesa_free((void *) srcAddr); + } return NULL; + } dst = tempImage; for (img = 0; img < srcDepth; img++) { -- cgit v1.2.3 From 7ac233ec15743763996e59c8b283f7c2e78a7210 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 28 Oct 2009 19:33:48 -0600 Subject: mesa: choose texture format in _mesa_get_fallback_texture() --- src/mesa/main/texobj.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index 678845ece0..f69379da46 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -33,6 +33,7 @@ #include "context.h" #include "enums.h" #include "fbobject.h" +#include "formats.h" #include "hash.h" #include "imports.h" #include "macros.h" @@ -740,6 +741,10 @@ _mesa_get_fallback_texture(GLcontext *ctx) _mesa_init_teximage_fields(ctx, GL_TEXTURE_2D, texImage, 8, 8, 1, 0, GL_RGBA); + texImage->TexFormat = + ctx->Driver.ChooseTextureFormat(ctx, GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE); + ASSERT(texImage->TexFormat != MESA_FORMAT_NONE); + /* set image data */ ctx->Driver.TexImage2D(ctx, GL_TEXTURE_2D, 0, GL_RGBA, 8, 8, 0, -- cgit v1.2.3 From 1e7517f059b1f3601502a199b05453eabfe56cdb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 28 Oct 2009 19:38:12 -0600 Subject: swrast: fix texel decoding in opt_sample_rgba_2d() --- src/mesa/swrast/s_texfilter.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index db03c6aa39..0bb988e3ef 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -1391,11 +1391,11 @@ opt_sample_rgba_2d(GLcontext *ctx, const GLint col = IFLOOR(texcoords[i][0] * width) & colMask; const GLint row = IFLOOR(texcoords[i][1] * height) & rowMask; const GLint pos = (row << shift) | col; - const GLubyte *texel = ((GLubyte *) img->Data) + (pos << 2); /* pos*4 */ - rgba[i][RCOMP] = UBYTE_TO_FLOAT(texel[3]); - rgba[i][GCOMP] = UBYTE_TO_FLOAT(texel[2]); - rgba[i][BCOMP] = UBYTE_TO_FLOAT(texel[1]); - rgba[i][ACOMP] = UBYTE_TO_FLOAT(texel[0]); + const GLuint texel = *((GLuint *) img->Data + pos); + rgba[i][RCOMP] = UBYTE_TO_FLOAT( (texel >> 24) ); + rgba[i][GCOMP] = UBYTE_TO_FLOAT( (texel >> 16) & 0xff ); + rgba[i][BCOMP] = UBYTE_TO_FLOAT( (texel >> 8) & 0xff ); + rgba[i][ACOMP] = UBYTE_TO_FLOAT( (texel ) & 0xff ); } } -- cgit v1.2.3 From 0103d7a47a6f42d8bb7199b5bd55097e3b0b92a4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 28 Oct 2009 19:40:56 -0600 Subject: swrast: clean up and remove dead code in triangle functions --- src/mesa/swrast/s_triangle.c | 104 +++++++++++++++++++------------------------ 1 file changed, 47 insertions(+), 57 deletions(-) (limited to 'src') diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 005d7a4c82..fdd7314f3b 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -134,15 +134,17 @@ _swrast_culltriangle( GLcontext *ctx, #define SETUP_CODE \ struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; \ - struct gl_texture_object *obj = \ + const struct gl_texture_object *obj = \ ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \ - const GLint b = obj->BaseLevel; \ - const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ - const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ - const GLint twidth_log2 = obj->Image[0][b]->WidthLog2; \ - const GLubyte *texture = (const GLubyte *) obj->Image[0][b]->Data; \ - const GLint smask = obj->Image[0][b]->Width - 1; \ - const GLint tmask = obj->Image[0][b]->Height - 1; \ + const struct gl_texture_image *texImg = \ + obj->Image[0][obj->BaseLevel]; \ + const GLfloat twidth = (GLfloat) texImg->Width; \ + const GLfloat theight = (GLfloat) texImg->Height; \ + const GLint twidth_log2 = texImg->WidthLog2; \ + const GLubyte *texture = (const GLubyte *) texImg->Data; \ + const GLint smask = texImg->Width - 1; \ + const GLint tmask = texImg->Height - 1; \ + ASSERT(texImg->TexFormat == MESA_FORMAT_RGB888); \ if (!rb || !texture) { \ return; \ } @@ -186,15 +188,17 @@ _swrast_culltriangle( GLcontext *ctx, #define SETUP_CODE \ struct gl_renderbuffer *rb = ctx->DrawBuffer->_ColorDrawBuffers[0]; \ - struct gl_texture_object *obj = \ + const struct gl_texture_object *obj = \ ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \ - const GLint b = obj->BaseLevel; \ - const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ - const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ - const GLint twidth_log2 = obj->Image[0][b]->WidthLog2; \ - const GLubyte *texture = (const GLubyte *) obj->Image[0][b]->Data; \ - const GLint smask = obj->Image[0][b]->Width - 1; \ - const GLint tmask = obj->Image[0][b]->Height - 1; \ + const struct gl_texture_image *texImg = \ + obj->Image[0][obj->BaseLevel]; \ + const GLfloat twidth = (GLfloat) texImg->Width; \ + const GLfloat theight = (GLfloat) texImg->Height; \ + const GLint twidth_log2 = texImg->WidthLog2; \ + const GLubyte *texture = (const GLubyte *) texImg->Data; \ + const GLint smask = texImg->Width - 1; \ + const GLint tmask = texImg->Height - 1; \ + ASSERT(texImg->TexFormat == MESA_FORMAT_RGB888); \ if (!rb || !texture) { \ return; \ } @@ -536,16 +540,17 @@ affine_span(GLcontext *ctx, SWspan *span, #define SETUP_CODE \ struct affine_info info; \ struct gl_texture_unit *unit = ctx->Texture.Unit+0; \ - struct gl_texture_object *obj = \ + const struct gl_texture_object *obj = \ ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \ - const GLint b = obj->BaseLevel; \ - const GLfloat twidth = (GLfloat) obj->Image[0][b]->Width; \ - const GLfloat theight = (GLfloat) obj->Image[0][b]->Height; \ - info.texture = (const GLchan *) obj->Image[0][b]->Data; \ - info.twidth_log2 = obj->Image[0][b]->WidthLog2; \ - info.smask = obj->Image[0][b]->Width - 1; \ - info.tmask = obj->Image[0][b]->Height - 1; \ - info.format = obj->Image[0][b]->TexFormat; \ + const struct gl_texture_image *texImg = \ + obj->Image[0][obj->BaseLevel]; \ + const GLfloat twidth = (GLfloat) texImg->Width; \ + const GLfloat theight = (GLfloat) texImg->Height; \ + info.texture = (const GLchan *) texImg->Data; \ + info.twidth_log2 = texImg->WidthLog2; \ + info.smask = texImg->Width - 1; \ + info.tmask = texImg->Height - 1; \ + info.format = texImg->TexFormat; \ info.filter = obj->MinFilter; \ info.envmode = unit->EnvMode; \ span.arrayMask |= SPAN_RGBA; \ @@ -563,25 +568,17 @@ affine_span(GLcontext *ctx, SWspan *span, } \ \ switch (info.format) { \ - case MESA_FORMAT_A8: \ - case MESA_FORMAT_L8: \ - case MESA_FORMAT_I8: \ - info.tbytesline = obj->Image[0][b]->Width; \ - break; \ - case MESA_FORMAT_AL88: \ - info.tbytesline = obj->Image[0][b]->Width * 2; \ - break; \ case MESA_FORMAT_RGB888: \ - info.tbytesline = obj->Image[0][b]->Width * 3; \ + info.tbytesline = texImg->Width * 3; \ break; \ case MESA_FORMAT_RGBA8888: \ - info.tbytesline = obj->Image[0][b]->Width * 4; \ + info.tbytesline = texImg->Width * 4; \ break; \ default: \ _mesa_problem(NULL, "Bad texture format in affine_texture_triangle");\ return; \ } \ - info.tsize = obj->Image[0][b]->Height * info.tbytesline; + info.tsize = texImg->Height * info.tbytesline; #define RENDER_SPAN( span ) affine_span(ctx, &span, &info); @@ -807,14 +804,15 @@ fast_persp_span(GLcontext *ctx, SWspan *span, #define SETUP_CODE \ struct persp_info info; \ const struct gl_texture_unit *unit = ctx->Texture.Unit+0; \ - struct gl_texture_object *obj = \ + const struct gl_texture_object *obj = \ ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; \ - const GLint b = obj->BaseLevel; \ - info.texture = (const GLchan *) obj->Image[0][b]->Data; \ - info.twidth_log2 = obj->Image[0][b]->WidthLog2; \ - info.smask = obj->Image[0][b]->Width - 1; \ - info.tmask = obj->Image[0][b]->Height - 1; \ - info.format = obj->Image[0][b]->TexFormat; \ + const struct gl_texture_image *texImg = \ + obj->Image[0][obj->BaseLevel]; \ + info.texture = (const GLchan *) texImg->Data; \ + info.twidth_log2 = texImg->WidthLog2; \ + info.smask = texImg->Width - 1; \ + info.tmask = texImg->Height - 1; \ + info.format = texImg->TexFormat; \ info.filter = obj->MinFilter; \ info.envmode = unit->EnvMode; \ \ @@ -831,25 +829,17 @@ fast_persp_span(GLcontext *ctx, SWspan *span, } \ \ switch (info.format) { \ - case MESA_FORMAT_A8: \ - case MESA_FORMAT_L8: \ - case MESA_FORMAT_I8: \ - info.tbytesline = obj->Image[0][b]->Width; \ - break; \ - case MESA_FORMAT_AL88: \ - info.tbytesline = obj->Image[0][b]->Width * 2; \ - break; \ case MESA_FORMAT_RGB888: \ - info.tbytesline = obj->Image[0][b]->Width * 3; \ + info.tbytesline = texImg->Width * 3; \ break; \ case MESA_FORMAT_RGBA8888: \ - info.tbytesline = obj->Image[0][b]->Width * 4; \ + info.tbytesline = texImg->Width * 4; \ break; \ default: \ _mesa_problem(NULL, "Bad texture format in persp_textured_triangle");\ return; \ } \ - info.tsize = obj->Image[0][b]->Height * info.tbytesline; + info.tsize = texImg->Height * info.tbytesline; #define RENDER_SPAN( span ) \ span.interpMask &= ~SPAN_RGBA; \ @@ -1067,9 +1057,9 @@ _swrast_choose_triangle( GLcontext *ctx ) texObj2D = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; texImg = texObj2D ? texObj2D->Image[0][texObj2D->BaseLevel] : NULL; - format = texImg ? texImg->TexFormat : -1; - minFilter = texObj2D ? texObj2D->MinFilter : (GLenum) 0; - magFilter = texObj2D ? texObj2D->MagFilter : (GLenum) 0; + format = texImg ? texImg->TexFormat : MESA_FORMAT_NONE; + minFilter = texObj2D ? texObj2D->MinFilter : GL_NONE; + magFilter = texObj2D ? texObj2D->MagFilter : GL_NONE; envMode = ctx->Texture.Unit[0].EnvMode; /* First see if we can use an optimized 2-D texture function */ -- cgit v1.2.3 From 88bb4b593576a2977b2fe36794bd4d3dbc72063e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 28 Oct 2009 19:41:24 -0600 Subject: swrast: check for single texture unit in _swrast_choose_triangle() --- src/mesa/swrast/s_triangle.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index fdd7314f3b..f417578d89 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -1066,6 +1066,7 @@ _swrast_choose_triangle( GLcontext *ctx ) if (ctx->Texture._EnabledCoordUnits == 0x1 && !ctx->FragmentProgram._Current && !ctx->ATIFragmentShader._Enabled + && ctx->Texture._EnabledUnits == 0x1 && ctx->Texture.Unit[0]._ReallyEnabled == TEXTURE_2D_BIT && texObj2D->WrapS == GL_REPEAT && texObj2D->WrapT == GL_REPEAT -- cgit v1.2.3 From 086f9fc0e2aef27f54eda87c733685500555bf20 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 28 Oct 2009 19:46:26 -0600 Subject: swrast: fix RGB, RGBA texturing code Fix backward component ordering for RGB textures. Only optimize RGBA texture case if running little endian. This restriction could be lifted with a little work. --- src/mesa/swrast/s_triangle.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index f417578d89..5ecc7692c5 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -159,9 +159,9 @@ _swrast_culltriangle( GLcontext *ctx, GLint t = FixedToInt(span.intTex[1]) & tmask; \ GLint pos = (t << twidth_log2) + s; \ pos = pos + pos + pos; /* multiply by 3 */ \ - rgb[i][RCOMP] = texture[pos]; \ + rgb[i][RCOMP] = texture[pos+2]; \ rgb[i][GCOMP] = texture[pos+1]; \ - rgb[i][BCOMP] = texture[pos+2]; \ + rgb[i][BCOMP] = texture[pos+0]; \ span.intTex[0] += span.intTexStep[0]; \ span.intTex[1] += span.intTexStep[1]; \ } \ @@ -215,9 +215,9 @@ _swrast_culltriangle( GLcontext *ctx, GLint t = FixedToInt(span.intTex[1]) & tmask; \ GLint pos = (t << twidth_log2) + s; \ pos = pos + pos + pos; /* multiply by 3 */ \ - rgb[i][RCOMP] = texture[pos]; \ + rgb[i][RCOMP] = texture[pos+2]; \ rgb[i][GCOMP] = texture[pos+1]; \ - rgb[i][BCOMP] = texture[pos+2]; \ + rgb[i][BCOMP] = texture[pos+0]; \ zRow[i] = z; \ span.array->mask[i] = 1; \ } \ @@ -1101,7 +1101,13 @@ _swrast_choose_triangle( GLcontext *ctx ) #if CHAN_BITS != 8 USE(general_triangle); #else - USE(affine_textured_triangle); + if (format == MESA_FORMAT_RGBA8888 && !_mesa_little_endian()) + /* We only handle RGBA8888 correctly on little endian + * in the optimized code above. + */ + USE(general_triangle); + else + USE(affine_textured_triangle); #endif } } -- cgit v1.2.3 From bc143b1a9ffc16af27b2e7183ca3ec59ad5a7c89 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 28 Oct 2009 21:25:56 -0600 Subject: mesa: minor code movement --- src/mesa/main/texcompress.c | 62 ++++++++++++++++++++++----------------------- src/mesa/main/texcompress.h | 7 +++-- 2 files changed, 33 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index 11f8857fa7..a4f1926ab3 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -153,38 +153,6 @@ _mesa_glenum_to_compressed_format(GLenum format) } -/* - * Return the address of the pixel at (col, row, img) in a - * compressed texture image. - * \param col, row, img - image position (3D), should be a multiple of the - * format's block size. - * \param format - compressed image format - * \param width - image width (stride) in pixels - * \param image - the image address - * \return address of pixel at (row, col, img) - */ -GLubyte * -_mesa_compressed_image_address(GLint col, GLint row, GLint img, - gl_format mesaFormat, - GLsizei width, const GLubyte *image) -{ - /* XXX only 2D images implemented, not 3D */ - const GLuint blockSize = _mesa_get_format_bytes(mesaFormat); - GLuint bw, bh; - GLint offset; - - _mesa_get_format_block_size(mesaFormat, &bw, &bh); - - ASSERT(col % bw == 0); - ASSERT(row % bh == 0); - - offset = ((width + bw - 1) / bw) * (row / bh) + col / bw; - offset *= blockSize; - - return (GLubyte *) image + offset; -} - - /** * Given a compressed MESA_FORMAT_x value, return the corresponding * GLenum for that format. @@ -233,3 +201,33 @@ _mesa_compressed_format_to_glenum(GLcontext *ctx, GLuint mesaFormat) } +/* + * Return the address of the pixel at (col, row, img) in a + * compressed texture image. + * \param col, row, img - image position (3D), should be a multiple of the + * format's block size. + * \param format - compressed image format + * \param width - image width (stride) in pixels + * \param image - the image address + * \return address of pixel at (row, col, img) + */ +GLubyte * +_mesa_compressed_image_address(GLint col, GLint row, GLint img, + gl_format mesaFormat, + GLsizei width, const GLubyte *image) +{ + /* XXX only 2D images implemented, not 3D */ + const GLuint blockSize = _mesa_get_format_bytes(mesaFormat); + GLuint bw, bh; + GLint offset; + + _mesa_get_format_block_size(mesaFormat, &bw, &bh); + + ASSERT(col % bw == 0); + ASSERT(row % bh == 0); + + offset = ((width + bw - 1) / bw) * (row / bh) + col / bw; + offset *= blockSize; + + return (GLubyte *) image + offset; +} diff --git a/src/mesa/main/texcompress.h b/src/mesa/main/texcompress.h index 9c58425fc9..418416746c 100644 --- a/src/mesa/main/texcompress.h +++ b/src/mesa/main/texcompress.h @@ -36,16 +36,15 @@ _mesa_get_compressed_formats(GLcontext *ctx, GLint *formats, GLboolean all); extern gl_format _mesa_glenum_to_compressed_format(GLenum format); +extern GLenum +_mesa_compressed_format_to_glenum(GLcontext *ctx, GLuint mesaFormat); + extern GLubyte * _mesa_compressed_image_address(GLint col, GLint row, GLint img, gl_format mesaFormat, GLsizei width, const GLubyte *image); -extern GLenum -_mesa_compressed_format_to_glenum(GLcontext *ctx, GLuint mesaFormat); - - extern void _mesa_init_texture_s3tc( GLcontext *ctx ); -- cgit v1.2.3 From 960d49b387ff4b64f802097c5013beee4de3649d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 28 Oct 2009 21:43:50 -0600 Subject: mesa: move some gl_texture_image and gl_renderbuffer fields around --- src/mesa/main/mtypes.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 41acc6fdda..94d29a7dbb 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1120,13 +1120,15 @@ typedef void (*StoreTexelFunc)(struct gl_texture_image *texImage, */ struct gl_texture_image { + GLint InternalFormat; /**< Internal format as given by the user */ GLenum _BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_ALPHA, * GL_LUMINANCE, GL_LUMINANCE_ALPHA, * GL_INTENSITY, GL_COLOR_INDEX, * GL_DEPTH_COMPONENT or GL_DEPTH_STENCIL_EXT * only. Used for choosing TexEnv arithmetic. */ - GLint InternalFormat; /**< Internal format as given by the user */ + GLuint TexFormat; /**< The actual format: MESA_FORMAT_x */ + GLuint Border; /**< 0 or 1 */ GLuint Width; /**< = 2^WidthLog2 + 2*Border */ GLuint Height; /**< = 2^HeightLog2 + 2*Border */ @@ -1144,8 +1146,6 @@ struct gl_texture_image GLboolean IsClientData; /**< Data owned by client? */ GLboolean _IsPowerOfTwo; /**< Are all dimensions powers of two? */ - GLuint TexFormat; /**< XXX Really gl_format */ - struct gl_texture_object *TexObject; /**< Pointer back to parent object */ FetchTexelFuncC FetchTexelc; /**< GLchan texel fetch function pointer */ @@ -2069,10 +2069,12 @@ struct gl_renderbuffer GLuint Name; GLint RefCount; GLuint Width, Height; + GLenum InternalFormat; /**< The user-specified format */ GLenum _BaseFormat; /**< Either GL_RGB, GL_RGBA, GL_DEPTH_COMPONENT or GL_STENCIL_INDEX. */ GLuint Format; /**< The actual format: MESA_FORMAT_x */ + GLubyte NumSamples; GLenum DataType; /**< Type of values passed to the Get/Put functions */ -- cgit v1.2.3 From bd36ca9b76bf7cba96fdef71b2ea73d3fa8dfd26 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 28 Oct 2009 21:46:37 -0600 Subject: mesa: re-remove s3v and trident driver files These were removed from master but a few files came back from the texformat-rework branch. --- src/mesa/drivers/dri/s3v/s3v_tex.c | 544 ------------------------- src/mesa/drivers/dri/s3v/s3v_xmesa.c | 341 ---------------- src/mesa/drivers/dri/trident/trident_context.c | 465 --------------------- 3 files changed, 1350 deletions(-) delete mode 100644 src/mesa/drivers/dri/s3v/s3v_tex.c delete mode 100644 src/mesa/drivers/dri/s3v/s3v_xmesa.c delete mode 100644 src/mesa/drivers/dri/trident/trident_context.c (limited to 'src') diff --git a/src/mesa/drivers/dri/s3v/s3v_tex.c b/src/mesa/drivers/dri/s3v/s3v_tex.c deleted file mode 100644 index 517f5e5ca7..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_tex.c +++ /dev/null @@ -1,544 +0,0 @@ -/* - * Author: Max Lingua - */ - -#include "main/glheader.h" -#include "main/mtypes.h" -#include "main/simple_list.h" -#include "main/enums.h" -#include "main/mm.h" -#include "main/texstore.h" -#include "main/teximage.h" -#include "swrast/swrast.h" - -#include "s3v_context.h" -#include "s3v_tex.h" - - -extern void s3vSwapOutTexObj(s3vContextPtr vmesa, s3vTextureObjectPtr t); -extern void s3vDestroyTexObj(s3vContextPtr vmesa, s3vTextureObjectPtr t); - -/* -static GLuint s3vComputeLodBias(GLfloat bias) -{ -#if TEX_DEBUG_ON - DEBUG_TEX(("*** s3vComputeLodBias ***\n")); -#endif - return bias; -} -*/ - -static void s3vSetTexWrapping(s3vContextPtr vmesa, - s3vTextureObjectPtr t, - GLenum wraps, GLenum wrapt) -{ - GLuint t0 = t->TextureCMD; - GLuint cmd = vmesa->CMD; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vSetTexWrapping: #%i ***\n", ++times)); -#endif - - - t0 &= ~TEX_WRAP_MASK; - cmd &= ~TEX_WRAP_MASK; - - if ((wraps != GL_CLAMP) || (wrapt != GL_CLAMP)) { - DEBUG(("TEX_WRAP_ON\n")); - t0 |= TEX_WRAP_ON; - cmd |= TEX_WRAP_ON; - } - - cmd |= TEX_WRAP_ON; /* FIXME: broken if off */ - t->TextureCMD = t0; - vmesa->CMD = cmd; -} - - -static void s3vSetTexFilter(s3vContextPtr vmesa, - s3vTextureObjectPtr t, - GLenum minf, GLenum magf) -{ - GLuint t0 = t->TextureCMD; - GLuint cmd = vmesa->CMD; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vSetTexFilter: #%i ***\n", ++times)); -#endif - - t0 &= ~TEX_FILTER_MASK; - cmd &= ~TEX_FILTER_MASK; - - switch (minf) { - case GL_NEAREST: - DEBUG(("GL_NEAREST\n")); - t0 |= NEAREST; - cmd |= NEAREST; - break; - case GL_LINEAR: - DEBUG(("GL_LINEAR\n")); - t0 |= LINEAR; - cmd |= LINEAR; - break; - case GL_NEAREST_MIPMAP_NEAREST: - DEBUG(("GL_MIPMAP_NEAREST\n")); - t0 |= MIP_NEAREST; - cmd |= MIP_NEAREST; - break; - case GL_LINEAR_MIPMAP_NEAREST: - DEBUG(("GL_LINEAR_MIPMAP_NEAREST\n")); - t0 |= LINEAR_MIP_NEAREST; - cmd |= LINEAR_MIP_NEAREST; - break; - case GL_NEAREST_MIPMAP_LINEAR: - DEBUG(("GL_NEAREST_MIPMAP_LINEAR\n")); - t0 |= MIP_LINEAR; - cmd |= MIP_LINEAR; - break; - case GL_LINEAR_MIPMAP_LINEAR: - DEBUG(("GL_LINEAR_MIPMAP_LINEAR\n")); - t0 |= LINEAR_MIP_LINEAR; - cmd |= LINEAR_MIP_LINEAR; - break; - default: - break; - } - /* FIXME: bilinear? */ - -#if 0 - switch (magf) { - case GL_NEAREST: - break; - case GL_LINEAR: - break; - default: - break; - } -#endif - - t->TextureCMD = t0; - - DEBUG(("CMD was = 0x%x\n", vmesa->CMD)); - DEBUG(("CMD is = 0x%x\n", cmd)); - - vmesa->CMD = cmd; - /* CMDCHANGE(); */ -} - - -static void s3vSetTexBorderColor(s3vContextPtr vmesa, - s3vTextureObjectPtr 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]); - -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vSetTexBorderColor: #%i ***\n", ++times)); -#endif - - /*FIXME: it should depend on tex col format */ - /* switch(t0 ... t->TextureColorMode) */ - - /* case TEX_COL_ARGB1555: */ - t->TextureBorderColor = S3VIRGEPACKCOLOR555(c[0], c[1], c[2], c[3]); - - DEBUG(("TextureBorderColor = 0x%x\n", t->TextureBorderColor)); - - vmesa->TextureBorderColor = t->TextureBorderColor; -} - -static void s3vTexParameter( GLcontext *ctx, GLenum target, - struct gl_texture_object *tObj, - GLenum pname, const GLfloat *params ) -{ - s3vContextPtr vmesa = S3V_CONTEXT(ctx); - s3vTextureObjectPtr t = (s3vTextureObjectPtr) tObj->DriverData; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vTexParameter: #%i ***\n", ++times)); -#endif - - if (!t) return; - - /* Can't do the update now as we don't know whether to flush - * vertices or not. Setting vmesa->new_state means that - * s3vUpdateTextureState() will be called before any triangles are - * rendered. If a statechange has occurred, it will be detected at - * that point, and buffered vertices flushed. - */ - switch (pname) { - case GL_TEXTURE_MIN_FILTER: - case GL_TEXTURE_MAG_FILTER: - s3vSetTexFilter( vmesa, t, tObj->MinFilter, tObj->MagFilter ); - break; - - case GL_TEXTURE_WRAP_S: - case GL_TEXTURE_WRAP_T: - s3vSetTexWrapping( vmesa, t, tObj->WrapS, tObj->WrapT ); - break; - - case GL_TEXTURE_BORDER_COLOR: - s3vSetTexBorderColor( vmesa, t, tObj->BorderColor ); - break; - - case GL_TEXTURE_BASE_LEVEL: - case GL_TEXTURE_MAX_LEVEL: - case GL_TEXTURE_MIN_LOD: - case GL_TEXTURE_MAX_LOD: - /* This isn't the most efficient solution but there doesn't appear to - * be a nice alternative for Virge. Since there's no LOD clamping, - * we just have to rely on loading the right subset of mipmap levels - * to simulate a clamped LOD. - */ - s3vSwapOutTexObj( vmesa, t ); - break; - - default: - return; - } - - if (t == vmesa->CurrentTexObj[0]) - vmesa->dirty |= S3V_UPLOAD_TEX0; - -#if 0 - if (t == vmesa->CurrentTexObj[1]) { - vmesa->dirty |= S3V_UPLOAD_TEX1; - } -#endif -} - - -static void s3vTexEnv( GLcontext *ctx, GLenum target, - GLenum pname, const GLfloat *param ) -{ - s3vContextPtr vmesa = S3V_CONTEXT( ctx ); - GLuint unit = ctx->Texture.CurrentUnit; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vTexEnv: #%i ***\n", ++times)); -#endif - - /* Only one env color. Need a fallback if env colors are different - * and texture setup references env color in both units. - */ - switch (pname) { - case GL_TEXTURE_ENV_COLOR: { - struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - GLfloat *fc = texUnit->EnvColor; - GLuint r, g, b, a, col; - CLAMPED_FLOAT_TO_UBYTE(r, fc[0]); - CLAMPED_FLOAT_TO_UBYTE(g, fc[1]); - CLAMPED_FLOAT_TO_UBYTE(b, fc[2]); - CLAMPED_FLOAT_TO_UBYTE(a, fc[3]); - - col = ((a << 24) | - (r << 16) | - (g << 8) | - (b << 0)); - - break; - } - case GL_TEXTURE_ENV_MODE: - vmesa->TexEnvImageFmt[unit] = 0; /* force recalc of env state */ - break; - case GL_TEXTURE_LOD_BIAS_EXT: { -/* - struct gl_texture_object *tObj = - ctx->Texture.Unit[unit]._Current; - - s3vTextureObjectPtr t = (s3vTextureObjectPtr) tObj->DriverData; -*/ - break; - } - default: - break; - } -} - -static void s3vTexImage1D( GLcontext *ctx, GLenum target, GLint level, - GLint internalFormat, - GLint width, GLint border, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *pack, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ) -{ - s3vContextPtr vmesa = S3V_CONTEXT( ctx ); - s3vTextureObjectPtr t = (s3vTextureObjectPtr) texObj->DriverData; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vTexImage1D: #%i ***\n", ++times)); -#endif - -#if 1 - if (t) { -#if _TEXFLUSH - DMAFLUSH(); -#endif - s3vSwapOutTexObj( vmesa, t ); -/* - s3vDestroyTexObj( vmesa, t ); - texObj->DriverData = 0; -*/ - } -#endif - _mesa_store_teximage1d( ctx, target, level, internalFormat, - width, border, format, type, - pixels, pack, texObj, texImage ); -} - -static void s3vTexSubImage1D( GLcontext *ctx, - GLenum target, - GLint level, - GLint xoffset, - GLsizei width, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *pack, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ) -{ - s3vContextPtr vmesa = S3V_CONTEXT( ctx ); - s3vTextureObjectPtr t = (s3vTextureObjectPtr) texObj->DriverData; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vTexSubImage1D: #%i ***\n", ++times)); -#endif - -#if 1 - if (t) { -#if _TEXFLUSH - DMAFLUSH(); -#endif - s3vSwapOutTexObj( vmesa, t ); -/* - s3vDestroyTexObj( vmesa, t ); - texObj->DriverData = 0; -*/ - } -#endif - _mesa_store_texsubimage1d(ctx, target, level, xoffset, width, - format, type, pixels, pack, texObj, - texImage); -} - -static void s3vTexImage2D( GLcontext *ctx, GLenum target, GLint level, - GLint internalFormat, - GLint width, GLint height, GLint border, - GLenum format, GLenum type, const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ) -{ - s3vContextPtr vmesa = S3V_CONTEXT( ctx ); - s3vTextureObjectPtr t = (s3vTextureObjectPtr) texObj->DriverData; - -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vTexImage2D: #%i ***\n", ++times)); -#endif - -#if 1 - if (t) { -#if _TEXFLUSH - DMAFLUSH(); -#endif - s3vSwapOutTexObj( vmesa, t ); -/* - s3vDestroyTexObj( vmesa, t ); - texObj->DriverData = 0; -*/ - } -#endif - _mesa_store_teximage2d( ctx, target, level, internalFormat, - width, height, border, format, type, - pixels, packing, texObj, texImage ); -} - -static void s3vTexSubImage2D( GLcontext *ctx, - GLenum target, - GLint level, - GLint xoffset, GLint yoffset, - GLsizei width, GLsizei height, - GLenum format, GLenum type, - const GLvoid *pixels, - const struct gl_pixelstore_attrib *packing, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage ) -{ - s3vContextPtr vmesa = S3V_CONTEXT( ctx ); - s3vTextureObjectPtr t = (s3vTextureObjectPtr) texObj->DriverData; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vTexSubImage2D: #%i ***\n", ++times)); -#endif - -#if 1 - if (t) { -#if _TEXFLUSH - DMAFLUSH(); -#endif - s3vSwapOutTexObj( vmesa, t ); -/* - s3vDestroyTexObj( vmesa, t ); - texObj->DriverData = 0; -*/ - } -#endif - _mesa_store_texsubimage2d(ctx, target, level, xoffset, yoffset, width, - height, format, type, pixels, packing, texObj, - texImage); -} - - -static void s3vBindTexture( GLcontext *ctx, GLenum target, - struct gl_texture_object *tObj ) -{ - s3vContextPtr vmesa = S3V_CONTEXT( ctx ); - s3vTextureObjectPtr t = (s3vTextureObjectPtr) tObj->DriverData; - GLuint cmd = vmesa->CMD; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vBindTexture: #%i ***\n", ++times)); -#endif - - if (!t) { -/* - GLfloat bias = ctx->Texture.Unit[ctx->Texture.CurrentUnit].LodBias; -*/ - t = CALLOC_STRUCT(s3v_texture_object_t); - - /* Initialize non-image-dependent parts of the state: - */ - t->globj = tObj; -#if 0 - if (target == GL_TEXTURE_2D) { - } else - if (target == GL_TEXTURE_1D) { - } - -#if X_BYTE_ORDER == X_LITTLE_ENDIAN - t->TextureFormat = (TF_LittleEndian | -#else - t->TextureFormat = (TF_BigEndian | -#endif -#endif - t->dirty_images = ~0; - - tObj->DriverData = t; - make_empty_list( t ); -#if 0 - s3vSetTexWrapping( vmesa, t, tObj->WrapS, tObj->WrapT ); - s3vSetTexFilter( vmesa, t, tObj->MinFilter, tObj->MagFilter ); - s3vSetTexBorderColor( vmesa, t, tObj->BorderColor ); -#endif - } - - cmd = vmesa->CMD & ~MIP_MASK; - vmesa->dirty |= S3V_UPLOAD_TEX0; - vmesa->TexOffset = t->TextureBaseAddr[tObj->BaseLevel]; - vmesa->TexStride = t->Pitch; - cmd |= MIPMAP_LEVEL(t->WidthLog2); - vmesa->CMD = cmd; - vmesa->restore_primitive = -1; -#if 0 - printf("t->TextureBaseAddr[0] = 0x%x\n", t->TextureBaseAddr[0]); - printf("t->TextureBaseAddr[1] = 0x%x\n", t->TextureBaseAddr[1]); - printf("t->TextureBaseAddr[2] = 0x%x\n", t->TextureBaseAddr[2]); -#endif -} - - -static void s3vDeleteTexture( GLcontext *ctx, struct gl_texture_object *tObj ) -{ - s3vTextureObjectPtr t = (s3vTextureObjectPtr)tObj->DriverData; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vDeleteTexture: #%i ***\n", ++times)); -#endif - - if (t) { - s3vContextPtr vmesa = S3V_CONTEXT( ctx ); - -#if _TEXFLUSH - if (vmesa) { - DMAFLUSH(); - } -#endif - - s3vDestroyTexObj( vmesa, t ); - tObj->DriverData = 0; - - } -} - -static GLboolean s3vIsTextureResident( GLcontext *ctx, - struct gl_texture_object *tObj ) -{ - s3vTextureObjectPtr t = (s3vTextureObjectPtr)tObj->DriverData; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vIsTextureResident: #%i ***\n", ++times)); -#endif - - return (t && t->MemBlock); -} - -static void s3vInitTextureObjects( GLcontext *ctx ) -{ - /* s3vContextPtr vmesa = S3V_CONTEXT(ctx); */ - struct gl_texture_object *texObj; - GLuint tmp = ctx->Texture.CurrentUnit; -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vInitTextureObjects: #%i ***\n", ++times)); -#endif - -#if 1 - ctx->Texture.CurrentUnit = 0; - - texObj = ctx->Texture.Unit[0].CurrentTex[TEXTURE_1D_INDEX]; - s3vBindTexture( ctx, GL_TEXTURE_1D, texObj ); - - texObj = ctx->Texture.Unit[0].CurrentTex[TEXTURE_2D_INDEX]; - s3vBindTexture( ctx, GL_TEXTURE_2D, texObj ); -#endif - -#if 0 - ctx->Texture.CurrentUnit = 1; - - texObj = ctx->Texture.Unit[1].CurrentTex[TEXTURE_1D_INDEX]; - s3vBindTexture( ctx, GL_TEXTURE_1D, texObj ); - - texObj = ctx->Texture.Unit[1].CurrentTex[TEXTURE_2D_INDEX]; - s3vBindTexture( ctx, GL_TEXTURE_2D, texObj ); -#endif - - ctx->Texture.CurrentUnit = tmp; -} - - -void s3vInitTextureFuncs( GLcontext *ctx ) -{ -#if TEX_DEBUG_ON - static unsigned int times=0; - DEBUG_TEX(("*** s3vInitTextureFuncs: #%i ***\n", ++times)); -#endif - - ctx->Driver.TexEnv = s3vTexEnv; - ctx->Driver.TexImage2D = s3vTexImage2D; - ctx->Driver.TexSubImage2D = s3vTexSubImage2D; - ctx->Driver.BindTexture = s3vBindTexture; - ctx->Driver.DeleteTexture = s3vDeleteTexture; - ctx->Driver.TexParameter = s3vTexParameter; - ctx->Driver.UpdateTexturePalette = 0; - ctx->Driver.IsTextureResident = s3vIsTextureResident; - - s3vInitTextureObjects( ctx ); -} diff --git a/src/mesa/drivers/dri/s3v/s3v_xmesa.c b/src/mesa/drivers/dri/s3v/s3v_xmesa.c deleted file mode 100644 index f1e123d676..0000000000 --- a/src/mesa/drivers/dri/s3v/s3v_xmesa.c +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Author: Max Lingua - */ - -#include "s3v_context.h" -#include "s3v_vb.h" -#include "s3v_dri.h" -#include "main/context.h" -#include "main/matrix.h" -#include "main/framebuffer.h" -#include "main/renderbuffer.h" -#include "main/viewport.h" - -#include "swrast/swrast.h" -#include "swrast_setup/swrast_setup.h" -#include "tnl/tnl.h" -#include "vbo/vbo.h" - -/* #define DEBUG(str) printf str */ - -static const __DRIconfig ** -s3vInitScreen(__DRIscreen *sPriv) -{ - sPriv->private = (void *) s3vCreateScreen( sPriv ); - - if (!sPriv->private) { - s3vDestroyScreen( sPriv ); - return GL_FALSE; - } - - return NULL; -} - -static void -s3vDestroyContext(__DRIcontextPrivate *driContextPriv) -{ - s3vContextPtr vmesa = (s3vContextPtr)driContextPriv->driverPrivate; - - if (vmesa) { - _swsetup_DestroyContext( vmesa->glCtx ); - _tnl_DestroyContext( vmesa->glCtx ); - _vbo_DestroyContext( vmesa->glCtx ); - _swrast_DestroyContext( vmesa->glCtx ); - - s3vFreeVB( vmesa->glCtx ); - - /* free the Mesa context */ - vmesa->glCtx->DriverCtx = NULL; - _mesa_destroy_context(vmesa->glCtx); - - _mesa_free(vmesa); - driContextPriv->driverPrivate = NULL; - } -} - - -static GLboolean -s3vCreateBuffer( __DRIscreenPrivate *driScrnPriv, - __DRIdrawablePrivate *driDrawPriv, - const __GLcontextModes *mesaVis, - GLboolean isPixmap ) -{ - s3vScreenPtr screen = (s3vScreenPtr) driScrnPriv->private; - - if (isPixmap) { - return GL_FALSE; /* not implemented */ - } - else { - struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis); - - { - driRenderbuffer *frontRb - = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp, - screen->frontOffset, screen->frontPitch, - driDrawPriv); - s3vSetSpanFunctions(frontRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); - } - - if (mesaVis->doubleBufferMode) { - driRenderbuffer *backRb - = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp, - screen->backOffset, screen->backPitch, - driDrawPriv); - s3vSetSpanFunctions(backRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); - backRb->backBuffer = GL_TRUE; - } - - if (mesaVis->depthBits == 16) { - driRenderbuffer *depthRb - = driNewRenderbuffer(MESA_FORMAT_Z16, NULL, screen->cpp, - screen->depthOffset, screen->depthPitch, - driDrawPriv); - s3vSetSpanFunctions(depthRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); - } - else if (mesaVis->depthBits == 24) { - driRenderbuffer *depthRb - = driNewRenderbuffer(MESA_FORMAT_Z24_S8, NULL, screen->cpp, - screen->depthOffset, screen->depthPitch, - driDrawPriv); - s3vSetSpanFunctions(depthRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); - } - - /* no h/w stencil yet? - if (mesaVis->stencilBits > 0) { - driRenderbuffer *stencilRb - = driNewRenderbuffer(MESA_FORMAT_S8, NULL, - screen->cpp, screen->depthOffset, - screen->depthPitch, driDrawPriv); - s3vSetSpanFunctions(stencilRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); - } - */ - - _mesa_add_soft_renderbuffers(fb, - GL_FALSE, /* color */ - GL_FALSE, /* depth */ - mesaVis->stencilBits > 0, - mesaVis->accumRedBits > 0, - GL_FALSE, /* alpha */ - GL_FALSE /* aux */); - driDrawPriv->driverPrivate = (void *) fb; - - return (driDrawPriv->driverPrivate != NULL); - } -} - - -static void -s3vDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) -{ - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); -} - -static void -s3vSwapBuffers(__DRIdrawablePrivate *drawablePrivate) -{ - __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate; - __DRIscreenPrivate *sPriv; - GLcontext *ctx; - s3vContextPtr vmesa; - s3vScreenPtr s3vscrn; - - vmesa = (s3vContextPtr) dPriv->driContextPriv->driverPrivate; - sPriv = vmesa->driScreen; - s3vscrn = vmesa->s3vScreen; - ctx = vmesa->glCtx; - - DEBUG(("*** s3vSwapBuffers ***\n")); - -/* DMAFLUSH(); */ - - _mesa_notifySwapBuffers( ctx ); - - vmesa = (s3vContextPtr) dPriv->driContextPriv->driverPrivate; -/* driScrnPriv = vmesa->driScreen; */ - -/* if (vmesa->EnabledFlags & S3V_BACK_BUFFER) */ - -/* _mesa_notifySwapBuffers( ctx ); */ -#if 1 -{ - int x0, y0, x1, y1; -/* - int nRect = dPriv->numClipRects; - XF86DRIClipRectPtr pRect = dPriv->pClipRects; - - __DRIscreenPrivate *driScrnPriv = vmesa->driScreen; -*/ - -/* - DEBUG(("s3vSwapBuffers: S3V_BACK_BUFFER = 1 - nClip = %i\n", nRect)); -*/ -/* vmesa->drawOffset=vmesa->s3vScreen->backOffset; */ - - x0 = dPriv->x; - y0 = dPriv->y; - - x1 = x0 + dPriv->w - 1; - y1 = y0 + dPriv->h - 1; - - DMAOUT_CHECK(BITBLT_SRC_BASE, 15); - DMAOUT(vmesa->s3vScreen->backOffset); - DMAOUT(0); /* 0xc0000000 */ - DMAOUT( ((x0 << 16) | x1) ); - DMAOUT( ((y0 << 16) | y1) ); - DMAOUT( (vmesa->DestStride << 16) | vmesa->SrcStride ); - DMAOUT( (~(0)) ); - DMAOUT( (~(0)) ); - DMAOUT(0); - DMAOUT(0); - /* FIXME */ - DMAOUT(0); - DMAOUT(0); - DMAOUT( (0x01 | /* Autoexecute */ - 0x02 | /* clip */ - 0x04 | /* 16 bit */ - 0x20 | /* draw */ - 0x400 | /* word alignment (bit 10=1) */ - (0x2 << 11) | /* offset = 1 byte */ - (0xCC << 17) | /* rop #204 */ - (0x3 << 25)) ); /* l-r, t-b */ - DMAOUT(vmesa->ScissorWH); - DMAOUT( /* 0 */ vmesa->SrcXY ); - DMAOUT( (dPriv->x << 16) | dPriv->y ); - DMAFINISH(); - - DMAFLUSH(); - - vmesa->restore_primitive = -1; - -} -#endif -} - -static GLboolean -s3vMakeCurrent(__DRIcontextPrivate *driContextPriv, - __DRIdrawablePrivate *driDrawPriv, - __DRIdrawablePrivate *driReadPriv) -{ - int x1,x2,y1,y2; - int cx, cy, cw, ch; - unsigned int src_stride, dest_stride; - int cl; - - s3vContextPtr vmesa; - __DRIdrawablePrivate *dPriv = driDrawPriv; - vmesa = (s3vContextPtr) dPriv->driContextPriv->driverPrivate; - - DEBUG(("s3vMakeCurrent\n")); - - DEBUG(("dPriv->x=%i y=%i w=%i h=%i\n", dPriv->x, dPriv->y, - dPriv->w, dPriv->h)); - - if (driContextPriv) { - GET_CURRENT_CONTEXT(ctx); - s3vContextPtr oldVirgeCtx = ctx ? S3V_CONTEXT(ctx) : NULL; - s3vContextPtr newVirgeCtx = (s3vContextPtr) driContextPriv->driverPrivate; - - if ( newVirgeCtx != oldVirgeCtx ) { - - newVirgeCtx->dirty = ~0; - cl = 1; - DEBUG(("newVirgeCtx != oldVirgeCtx\n")); -/* s3vUpdateClipping(newVirgeCtx->glCtx ); */ - } - - if (newVirgeCtx->driDrawable != driDrawPriv) { - newVirgeCtx->driDrawable = driDrawPriv; - DEBUG(("driDrawable != driDrawPriv\n")); - s3vUpdateWindow ( newVirgeCtx->glCtx ); - s3vUpdateViewportOffset( newVirgeCtx->glCtx ); -/* s3vUpdateClipping(newVirgeCtx->glCtx ); */ - } -/* - s3vUpdateWindow ( newVirgeCtx->glCtx ); - s3vUpdateViewportOffset( newVirgeCtx->glCtx ); -*/ - -/* - _mesa_make_current( newVirgeCtx->glCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate ); - - _mesa_set_viewport(newVirgeCtx->glCtx, 0, 0, - newVirgeCtx->driDrawable->w, - newVirgeCtx->driDrawable->h); -*/ - -#if 0 - newVirgeCtx->Window &= ~W_GIDMask; - newVirgeCtx->Window |= (driDrawPriv->index << 5); - CHECK_DMA_BUFFER(newVirgeCtx,1); - WRITE(newVirgeCtx->buf, S3VWindow, newVirgeCtx->Window); -#endif - - newVirgeCtx->new_state |= S3V_NEW_WINDOW; /* FIXME */ - - _mesa_make_current( newVirgeCtx->glCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate ); - - if (!newVirgeCtx->glCtx->Viewport.Width) { - _mesa_set_viewport(newVirgeCtx->glCtx, 0, 0, - driDrawPriv->w, driDrawPriv->h); - -/* s3vUpdateClipping(newVirgeCtx->glCtx ); */ - } - -/* - if (cl) { - s3vUpdateClipping(newVirgeCtx->glCtx ); - cl =0; - } -*/ - - newVirgeCtx->new_state |= S3V_NEW_CLIP; - - if (1) { - cx = dPriv->x; - cw = dPriv->w; - cy = dPriv->y; - ch = dPriv->h; - } - - x1 = y1 = 0; - x2 = cw-1; - y2 = ch-1; - - /* src_stride = vmesa->s3vScreen->w * vmesa->s3vScreen->cpp; - dest_stride = ((x2+31)&~31) * vmesa->s3vScreen->cpp; */ - src_stride = vmesa->driScreen->fbWidth * 2; - dest_stride = ((x2+31)&~31) * 2; - } else { - _mesa_make_current( NULL, NULL, NULL ); - } - - return GL_TRUE; -} - - -static GLboolean -s3vUnbindContext( __DRIcontextPrivate *driContextPriv ) -{ - return GL_TRUE; -} - -const struct __DriverAPIRec driDriverAPI = { - .InitScreen = s3vInitScreen, - .DestroyScreen = s3vDestroyScreen, - .CreateContext = s3vCreateContext, - .DestroyContext = s3vDestroyContext, - .CreateBuffer = s3vCreateBuffer, - .DestroyBuffer = s3vDestroyBuffer, - .SwapBuffers = s3vSwapBuffers, - .MakeCurrent = s3vMakeCurrent, - .UnbindContext = s3vUnbindContext, -}; diff --git a/src/mesa/drivers/dri/trident/trident_context.c b/src/mesa/drivers/dri/trident/trident_context.c deleted file mode 100644 index b693a95ece..0000000000 --- a/src/mesa/drivers/dri/trident/trident_context.c +++ /dev/null @@ -1,465 +0,0 @@ -/* - * Copyright 2002 by Alan Hourihane, Sychdyn, North Wales, UK. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Authors: Alan Hourihane, - * - * Trident CyberBladeXP driver. - * - */ -#include "trident_dri.h" -#include "trident_context.h" -#include "trident_lock.h" - -#include "swrast/swrast.h" -#include "swrast_setup/swrast_setup.h" -#include "vbo/vbo.h" - -#include "tnl/tnl.h" -#include "tnl/t_pipeline.h" - -#include "main/context.h" -#include "main/simple_list.h" -#include "main/matrix.h" -#include "main/extensions.h" -#include "main/framebuffer.h" -#include "main/renderbuffer.h" -#include "main/viewport.h" -#if defined(USE_X86_ASM) -#include "x86/common_x86_asm.h" -#endif -#include "main/simple_list.h" -#include "main/mm.h" -#include "drirenderbuffer.h" - -#include "drivers/common/driverfuncs.h" -#include "dri_util.h" -#include "utils.h" - -static const struct tnl_pipeline_stage *trident_pipeline[] = { - &_tnl_vertex_transform_stage, - &_tnl_normal_transform_stage, - &_tnl_lighting_stage, - &_tnl_texgen_stage, - &_tnl_texture_transform_stage, - &_tnl_render_stage, - 0, -}; - - -static GLboolean -tridentCreateContext( const __GLcontextModes *glVisual, - __DRIcontextPrivate *driContextPriv, - void *sharedContextPrivate) -{ - GLcontext *ctx, *shareCtx; - __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; - tridentContextPtr tmesa; - tridentScreenPtr tridentscrn; - struct dd_function_table functions; -#if 0 - drm_trident_sarea_t *saPriv=(drm_trident_sarea_t *)(((char*)sPriv->pSAREA)+ - sizeof(XF86DRISAREARec)); -#endif - - tmesa = (tridentContextPtr) CALLOC( sizeof(*tmesa) ); - if ( !tmesa ) return GL_FALSE; - - /* Allocate the Mesa context */ - if (sharedContextPrivate) - shareCtx = ((tridentContextPtr) sharedContextPrivate)->glCtx; - else - shareCtx = NULL; - - _mesa_init_driver_functions(&functions); - - tmesa->glCtx = - _mesa_create_context(glVisual, shareCtx, &functions, (void *)tmesa); - - if (!tmesa->glCtx) { - FREE(tmesa); - return GL_FALSE; - } - - tmesa->driContext = driContextPriv; - tmesa->driScreen = sPriv; - tmesa->driDrawable = NULL; /* Set by XMesaMakeCurrent */ - - tmesa->hHWContext = driContextPriv->hHWContext; - tmesa->driHwLock = (drmLock *)&sPriv->pSAREA->lock; - tmesa->driFd = sPriv->fd; -#if 0 - tmesa->sarea = saPriv; -#endif - - tridentscrn = tmesa->tridentScreen = (tridentScreenPtr)(sPriv->private); - - ctx = tmesa->glCtx; - - ctx->Const.MaxTextureLevels = 13; /* 4K by 4K? Is that right? */ - ctx->Const.MaxTextureUnits = 1; /* Permedia 3 */ - - ctx->Const.MinLineWidth = 0.0; - ctx->Const.MaxLineWidth = 255.0; - - ctx->Const.MinLineWidthAA = 0.0; - ctx->Const.MaxLineWidthAA = 65536.0; - - ctx->Const.MinPointSize = 0.0; - ctx->Const.MaxPointSize = 255.0; - - ctx->Const.MinPointSizeAA = 0.5; /* 4x4 quality mode */ - ctx->Const.MaxPointSizeAA = 16.0; - ctx->Const.PointSizeGranularity = 0.25; - - ctx->Const.MaxDrawBuffers = 1; - -#if 0 - tmesa->texHeap = mmInit( 0, tmesa->tridentScreen->textureSize ); - - make_empty_list(&tmesa->TexObjList); - make_empty_list(&tmesa->SwappedOut); - - tmesa->CurrentTexObj[0] = 0; - tmesa->CurrentTexObj[1] = 0; /* Permedia 3, second texture */ - - tmesa->RenderIndex = ~0; -#endif - - /* Initialize the software rasterizer and helper modules. - */ - _swrast_CreateContext( ctx ); - _vbo_CreateContext( ctx ); - _tnl_CreateContext( ctx ); - _swsetup_CreateContext( ctx ); - - /* Install the customized pipeline: - */ - _tnl_destroy_pipeline( ctx ); - _tnl_install_pipeline( ctx, trident_pipeline ); - - /* Configure swrast to match hardware characteristics: - */ - _swrast_allow_pixel_fog( ctx, GL_FALSE ); - _swrast_allow_vertex_fog( ctx, GL_TRUE ); - - tridentInitVB( ctx ); - tridentDDInitExtensions( ctx ); - tridentDDInitDriverFuncs( ctx ); - tridentDDInitStateFuncs( ctx ); -#if 0 - tridentDDInitSpanFuncs( ctx ); - tridentDDInitTextureFuncs( ctx ); -#endif - tridentDDInitTriFuncs( ctx ); - tridentDDInitState( tmesa ); - - driContextPriv->driverPrivate = (void *)tmesa; - - UNLOCK_HARDWARE(tmesa); - - return GL_TRUE; -} - -static void -tridentDestroyContext(__DRIcontextPrivate *driContextPriv) -{ - tridentContextPtr tmesa = (tridentContextPtr)driContextPriv->driverPrivate; - - if (tmesa) { - _swsetup_DestroyContext( tmesa->glCtx ); - _tnl_DestroyContext( tmesa->glCtx ); - _vbo_DestroyContext( tmesa->glCtx ); - _swrast_DestroyContext( tmesa->glCtx ); - - /* free the Mesa context */ - tmesa->glCtx->DriverCtx = NULL; - _mesa_destroy_context(tmesa->glCtx); - - _mesa_free(tmesa); - driContextPriv->driverPrivate = NULL; - } -} - - -static GLboolean -tridentCreateBuffer( __DRIscreenPrivate *driScrnPriv, - __DRIdrawablePrivate *driDrawPriv, - const __GLcontextModes *mesaVis, - GLboolean isPixmap ) -{ - tridentScreenPtr screen = (tridentScreenPtr) driScrnPriv->private; - - if (isPixmap) { - return GL_FALSE; /* not implemented */ - } - else { - struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis); - - { - driRenderbuffer *frontRb - = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp, - screen->frontOffset, screen->frontPitch, - driDrawPriv); - /* - tridentSetSpanFunctions(frontRb, mesaVis); - */ - _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); - } - - if (mesaVis->doubleBufferMode) { - driRenderbuffer *backRb - = driNewRenderbuffer(MESA_FORMAT_ARGB8888, NULL, screen->cpp, - screen->backOffset, screen->backPitch, - driDrawPriv); - /* - tridentSetSpanFunctions(backRb, mesaVis); - */ - _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); - } - - if (mesaVis->depthBits == 16) { - driRenderbuffer *depthRb - = driNewRenderbuffer(MESA_FORMAT_Z16, NULL, screen->cpp, - screen->depthOffset, screen->depthPitch, - driDrawPriv); - /* - tridentSetSpanFunctions(depthRb, mesaVis); - */ - _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); - } - else if (mesaVis->depthBits == 24) { - driRenderbuffer *depthRb - = driNewRenderbuffer(MESA_FORMAT_Z24_S8, NULL, screen->cpp, - screen->depthOffset, screen->depthPitch, - driDrawPriv); - /* - tridentSetSpanFunctions(depthRb, mesaVis); - */ - _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); - } - - /* no h/w stencil? - if (mesaVis->stencilBits > 0 && !swStencil) { - driRenderbuffer *stencilRb - = driNewRenderbuffer(MESA_FORMAT_S8); - tridentSetSpanFunctions(stencilRb, mesaVis); - _mesa_add_renderbuffer(fb, BUFFER_STENCIL, &stencilRb->Base); - } - */ - - _mesa_add_soft_renderbuffers(fb, - GL_FALSE, /* color */ - GL_FALSE, /* depth */ - mesaVis->stencilBits > 0, - mesaVis->accumRedBits > 0, - GL_FALSE, /* alpha */ - GL_FALSE /* aux */); - driDrawPriv->driverPrivate = (void *) fb; - - return (driDrawPriv->driverPrivate != NULL); - } -} - - -static void -tridentDestroyBuffer(__DRIdrawablePrivate *driDrawPriv) -{ - _mesa_reference_framebuffer((GLframebuffer **)(&(driDrawPriv->driverPrivate)), NULL); -} - -static void -tridentSwapBuffers(__DRIdrawablePrivate *drawablePrivate) -{ - __DRIdrawablePrivate *dPriv = (__DRIdrawablePrivate *) drawablePrivate; - - if (dPriv->driContextPriv && dPriv->driContextPriv->driverPrivate) { - tridentContextPtr tmesa; - GLcontext *ctx; - tmesa = (tridentContextPtr) dPriv->driContextPriv->driverPrivate; - ctx = tmesa->glCtx; - if (ctx->Visual.doubleBufferMode) { - _mesa_notifySwapBuffers( ctx ); /* flush pending rendering comands */ - tridentCopyBuffer( dPriv ); - } - } - else { - /* XXX this shouldn't be an error but we can't handle it for now */ - _mesa_problem(NULL, "tridentSwapBuffers: drawable has no context!\n"); - } -} - -static GLboolean -tridentMakeCurrent(__DRIcontextPrivate *driContextPriv, - __DRIdrawablePrivate *driDrawPriv, - __DRIdrawablePrivate *driReadPriv) -{ - if (driContextPriv) { - GET_CURRENT_CONTEXT(ctx); - tridentContextPtr oldCtx = ctx ? TRIDENT_CONTEXT(ctx) : NULL; - tridentContextPtr newCtx = (tridentContextPtr) driContextPriv->driverPrivate; - - if ( newCtx != oldCtx ) { - newCtx->dirty = ~0; - } - - if (newCtx->driDrawable != driDrawPriv) { - newCtx->driDrawable = driDrawPriv; -#if 0 - tridentUpdateWindow ( newCtx->glCtx ); - tridentUpdateViewportOffset( newCtx->glCtx ); -#endif - } - - newCtx->drawOffset = newCtx->tridentScreen->backOffset; - newCtx->drawPitch = newCtx->tridentScreen->backPitch; - - _mesa_make_current( newCtx->glCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate ); - - if (!newCtx->glCtx->Viewport.Width) { - _mesa_set_viewport(newCtx->glCtx, 0, 0, - driDrawPriv->w, driDrawPriv->h); - } - } else { - _mesa_make_current( NULL, NULL, NULL ); - } - return GL_TRUE; -} - - -static GLboolean -tridentUnbindContext( __DRIcontextPrivate *driContextPriv ) -{ - return GL_TRUE; -} - - -static tridentScreenPtr -tridentCreateScreen( __DRIscreenPrivate *sPriv ) -{ - TRIDENTDRIPtr tDRIPriv = (TRIDENTDRIPtr)sPriv->pDevPriv; - tridentScreenPtr tridentScreen; - - if (sPriv->devPrivSize != sizeof(TRIDENTDRIRec)) { - fprintf(stderr,"\nERROR! sizeof(TRIDENTDRIRec) does not match passed size from device driver\n"); - return GL_FALSE; - } - - /* Allocate the private area */ - tridentScreen = (tridentScreenPtr) CALLOC( sizeof(*tridentScreen) ); - if ( !tridentScreen ) return NULL; - - tridentScreen->driScreen = sPriv; - - tridentScreen->frontOffset = tDRIPriv->frontOffset; - tridentScreen->backOffset = tDRIPriv->backOffset; - tridentScreen->depthOffset = tDRIPriv->depthOffset; - tridentScreen->frontPitch = tDRIPriv->frontPitch; - tridentScreen->backPitch = tDRIPriv->backPitch; - tridentScreen->depthPitch = tDRIPriv->depthPitch; - tridentScreen->width = tDRIPriv->width; - tridentScreen->height = tDRIPriv->height; - -printf("%d %d\n",tridentScreen->width,tridentScreen->height); -printf("%d %d\n",tridentScreen->frontPitch,tridentScreen->backPitch); -printf("offset 0x%x 0x%x\n",tridentScreen->backOffset,tridentScreen->depthOffset); - - tridentScreen->mmio.handle = tDRIPriv->regs; - tridentScreen->mmio.size = 0x20000; - - if (drmMap(sPriv->fd, - tridentScreen->mmio.handle, tridentScreen->mmio.size, - (drmAddressPtr)&tridentScreen->mmio.map)) { - FREE(tridentScreen); - return GL_FALSE; - } -printf("MAPPED at %p\n", tridentScreen->mmio.map); - - return tridentScreen; -} - -/* Destroy the device specific screen private data struct. - */ -static void -tridentDestroyScreen( __DRIscreenPrivate *sPriv ) -{ - tridentScreenPtr tridentScreen = (tridentScreenPtr)sPriv->private; - - FREE(tridentScreen); -} - -static GLboolean -tridentInitDriver(__DRIscreenPrivate *sPriv) -{ - sPriv->private = (void *) tridentCreateScreen( sPriv ); - - if (!sPriv->private) { - tridentDestroyScreen( sPriv ); - return GL_FALSE; - } - - return GL_TRUE; -} - -/** - * This is the driver specific part of the createNewScreen entry point. - * - * \todo maybe fold this into intelInitDriver - * - * \return the __GLcontextModes supported by this driver - */ -const __DRIconfig **tridentInitScreen(__DRIscreenPrivate *psp) -{ - static const __DRIversion ddx_expected = { 4, 0, 0 }; - static const __DRIversion dri_expected = { 3, 1, 0 }; - static const __DRIversion drm_expected = { 1, 0, 0 }; - - if ( ! driCheckDriDdxDrmVersions2( "Trident", - &psp->dri_version, & dri_expected, - &psp->ddx_version, & ddx_expected, - &psp->drm_version, & drm_expected ) ) - return NULL; - - if (!tridentInitDriver(psp)) - return NULL; - - /* Wait... what? This driver doesn't report any modes... */ -#if 0 - TRIDENTDRIPtr dri_priv = (TRIDENTDRIPtr) psp->pDevPriv; - *driver_modes = tridentFillInModes( dri_priv->bytesPerPixel * 8, - GL_TRUE ); -#endif - - return NULL; -} - -const struct __DriverAPIRec driDriverAPI = { - tridentInitScreen, - tridentDestroyScreen, - tridentCreateContext, - tridentDestroyContext, - tridentCreateBuffer, - tridentDestroyBuffer, - tridentSwapBuffers, - tridentMakeCurrent, - tridentUnbindContext, -}; -- cgit v1.2.3 From c6bd5fae0c2af1256ad552d583d9659712807214 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 28 Oct 2009 21:52:37 -0600 Subject: mesa: remove old, unused #define --- src/mesa/main/texstore.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 8ee378e667..36228e671f 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1087,8 +1087,6 @@ _mesa_texstore_x8_z24(TEXSTORE_PARAMS) } -#define STRIDE_3D 0 - /** * Store a 16-bit integer depth component texture image. */ -- cgit v1.2.3 From 59b29516af2d4d8f83723559921a3709eb77a7d2 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Wed, 28 Oct 2009 22:14:01 -0600 Subject: swrast: added braces --- src/mesa/swrast/s_triangle.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index 5ecc7692c5..d80a6761f4 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -1101,13 +1101,15 @@ _swrast_choose_triangle( GLcontext *ctx ) #if CHAN_BITS != 8 USE(general_triangle); #else - if (format == MESA_FORMAT_RGBA8888 && !_mesa_little_endian()) + if (format == MESA_FORMAT_RGBA8888 && !_mesa_little_endian()) { /* We only handle RGBA8888 correctly on little endian * in the optimized code above. */ USE(general_triangle); - else + } + else { USE(affine_textured_triangle); + } #endif } } -- cgit v1.2.3 From da1fb3be8293df9f89aaec726f32d73e03d57fb6 Mon Sep 17 00:00:00 2001 From: Cooper Yuan Date: Thu, 29 Oct 2009 20:20:59 +0800 Subject: r300g: Fix bytes_per_line calculation error while displaying surface --- src/gallium/winsys/drm/radeon/core/radeon_buffer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c index 0a7b5ecb09..81cd9dc4fb 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c @@ -218,7 +218,7 @@ static void radeon_display_surface(struct pipe_winsys *pws, ximage->data = data; ximage->width = psurf->width; ximage->height = psurf->height; - ximage->bytes_per_line = r300tex->stride_override; + ximage->bytes_per_line = psurf->width * (ximage->bits_per_pixel >> 3); XPutImage(rvl_ctx->display, rvl_ctx->drawable, XDefaultGC(rvl_ctx->display, rvl_ctx->screen), -- cgit v1.2.3 From e2131e017184a595a735e7ea1eced1552b8a7d22 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 07:47:34 -0600 Subject: radeon: fix incorrect Z format in radeon_alloc_renderbuffer_storage() And update error message. --- src/mesa/drivers/dri/radeon/radeon_fbo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 8dda47fcd1..bf69cd9337 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -133,7 +133,7 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT32: - rb->Format = MESA_FORMAT_Z32; + rb->Format = MESA_FORMAT_X8_Z24; rb->DataType = GL_UNSIGNED_INT; cpp = 4; break; @@ -145,7 +145,7 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, break; default: _mesa_problem(ctx, - "Unexpected format in intel_alloc_renderbuffer_storage"); + "Unexpected format in radeon_alloc_renderbuffer_storage"); return GL_FALSE; } -- cgit v1.2.3 From 920f023e8b3a5c2af0877530dc1707d2e50c5d4b Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 29 Oct 2009 15:19:59 +0800 Subject: mesa/main: Never return NULL in _mesa_get_texstore_func. Signed-off-by: Chia-I Wu --- src/mesa/main/texstore.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 36228e671f..01fea476ae 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3083,6 +3083,26 @@ texstore_funcs[MESA_FORMAT_COUNT] = }; +static GLboolean +_mesa_texstore_null(TEXSTORE_PARAMS) +{ + (void) ctx; (void) dims; + (void) baseInternalFormat; + (void) dstFormat; + (void) dstAddr; + (void) dstXoffset; (void) dstYoffset; (void) dstZoffset; + (void) dstRowStride; (void) dstImageOffsets; + (void) srcWidth; (void) srcHeight; (void) srcDepth; + (void) srcFormat; (void) srcType; + (void) srcAddr; + (void) srcPacking; + + /* should never happen */ + _mesa_problem(NULL, "_mesa_texstore_null() is called"); + return GL_FALSE; +} + + /** * Return the StoreTexImageFunc pointer to store an image in the given format. */ @@ -3096,7 +3116,11 @@ _mesa_get_texstore_func(gl_format format) } #endif ASSERT(texstore_funcs[format].Name == format); - return texstore_funcs[format].Store; + + if (texstore_funcs[format].Store) + return texstore_funcs[format].Store; + else + return _mesa_texstore_null; } @@ -3112,8 +3136,6 @@ _mesa_texstore(TEXSTORE_PARAMS) storeImage = _mesa_get_texstore_func(dstFormat); - assert(storeImage); - success = storeImage(ctx, dims, baseInternalFormat, dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, dstRowStride, dstImageOffsets, -- cgit v1.2.3 From 20e20fc5afa7525e247fd607e04d9adfffe730b4 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 29 Oct 2009 14:14:04 +0800 Subject: mesa/main: Make FEATURE_texture_fxt1 follow feature conventions. Also remove the unused initialization and GLchan fetch functions. Signed-off-by: Chia-I Wu --- src/mesa/main/context.c | 3 --- src/mesa/main/texcompress.h | 3 --- src/mesa/main/texcompress_fxt1.c | 35 ++++++----------------------------- src/mesa/main/texcompress_fxt1.h | 22 ++++++++++++++-------- 4 files changed, 20 insertions(+), 43 deletions(-) (limited to 'src') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index c57d7c10b6..1d540eb732 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -706,9 +706,6 @@ init_attrib_groups(GLcontext *ctx) #if FEATURE_texture_s3tc _mesa_init_texture_s3tc( ctx ); #endif -#if FEATURE_texture_fxt1 - _mesa_init_texture_fxt1( ctx ); -#endif /* Miscellaneous */ ctx->NewState = _NEW_ALL; diff --git a/src/mesa/main/texcompress.h b/src/mesa/main/texcompress.h index 418416746c..d4873db54a 100644 --- a/src/mesa/main/texcompress.h +++ b/src/mesa/main/texcompress.h @@ -48,9 +48,6 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img, extern void _mesa_init_texture_s3tc( GLcontext *ctx ); -extern void -_mesa_init_texture_fxt1( GLcontext *ctx ); - #else /* _HAVE_FULL_GL */ diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index ef42fb92b7..85becb80d2 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -41,6 +41,9 @@ #include "texstore.h" +#if FEATURE_texture_fxt1 + + static void fxt1_encode (GLuint width, GLuint height, GLint comps, const void *source, GLint srcRowStride, @@ -51,16 +54,6 @@ fxt1_decode_1 (const void *texture, GLint stride, GLint i, GLint j, GLchan *rgba); -/** - * Called during context initialization. - */ -void -_mesa_init_texture_fxt1( GLcontext *ctx ) -{ - (void) ctx; -} - - /** * Store user's image in rgb_fxt1 format. */ @@ -175,15 +168,6 @@ _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS) } -void -_mesa_fetch_texel_2d_rgba_fxt1( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - (void) k; - fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, texel); -} - - void _mesa_fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) @@ -199,16 +183,6 @@ _mesa_fetch_texel_2d_f_rgba_fxt1( const struct gl_texture_image *texImage, } -void -_mesa_fetch_texel_2d_rgb_fxt1( const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel ) -{ - (void) k; - fxt1_decode_1(texImage->Data, texImage->RowStride, i, j, texel); - texel[ACOMP] = 255; -} - - void _mesa_fetch_texel_2d_f_rgb_fxt1( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) @@ -1673,3 +1647,6 @@ fxt1_decode_1 (const void *texture, GLint stride, /* in pixels */ decode_1[mode](code, t, rgba); } + + +#endif /* FEATURE_texture_fxt1 */ diff --git a/src/mesa/main/texcompress_fxt1.h b/src/mesa/main/texcompress_fxt1.h index b74f955fcd..d63ca71e21 100644 --- a/src/mesa/main/texcompress_fxt1.h +++ b/src/mesa/main/texcompress_fxt1.h @@ -25,29 +25,35 @@ #ifndef TEXCOMPRESS_FXT1_H #define TEXCOMPRESS_FXT1_H +#include "main/mtypes.h" #include "texstore.h" +#if FEATURE_texture_fxt1 + extern GLboolean _mesa_texstore_rgb_fxt1(TEXSTORE_PARAMS); extern GLboolean _mesa_texstore_rgba_fxt1(TEXSTORE_PARAMS); -extern void -_mesa_fetch_texel_2d_rgba_fxt1(const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel); - extern void _mesa_fetch_texel_2d_f_rgba_fxt1(const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel); -extern void -_mesa_fetch_texel_2d_rgb_fxt1(const struct gl_texture_image *texImage, - GLint i, GLint j, GLint k, GLchan *texel); - extern void _mesa_fetch_texel_2d_f_rgb_fxt1(const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel); +#else /* FEATURE_texture_fxt1 */ + +/* these are used only in texstore_funcs[] */ +#define _mesa_texstore_rgb_fxt1 NULL +#define _mesa_texstore_rgba_fxt1 NULL + +/* these are used only in texfetch_funcs[] */ +#define _mesa_fetch_texel_2d_f_rgba_fxt1 NULL +#define _mesa_fetch_texel_2d_f_rgb_fxt1 NULL + +#endif /* FEATURE_texture_fxt1 */ #endif /* TEXCOMPRESS_FXT1_H */ -- cgit v1.2.3 From 59798cd8864b601e035cf2414517cd90d24ed786 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 29 Oct 2009 14:59:42 +0800 Subject: mesa/main: Make FEATURE_texture_s3tc follow feature conventions. Signed-off-by: Chia-I Wu --- src/mesa/main/context.c | 4 +--- src/mesa/main/texcompress.h | 5 ----- src/mesa/main/texcompress_s3tc.c | 8 +++++++- src/mesa/main/texcompress_s3tc.h | 31 +++++++++++++++++++++++++++++++ 4 files changed, 39 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 1d540eb732..101d3c6b67 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -123,7 +123,7 @@ #include "simple_list.h" #include "state.h" #include "stencil.h" -#include "texcompress.h" +#include "texcompress_s3tc.h" #include "teximage.h" #include "texobj.h" #include "texstate.h" @@ -703,9 +703,7 @@ init_attrib_groups(GLcontext *ctx) if (!_mesa_init_texture( ctx )) return GL_FALSE; -#if FEATURE_texture_s3tc _mesa_init_texture_s3tc( ctx ); -#endif /* Miscellaneous */ ctx->NewState = _NEW_ALL; diff --git a/src/mesa/main/texcompress.h b/src/mesa/main/texcompress.h index d4873db54a..5e73a3149b 100644 --- a/src/mesa/main/texcompress.h +++ b/src/mesa/main/texcompress.h @@ -44,11 +44,6 @@ _mesa_compressed_image_address(GLint col, GLint row, GLint img, gl_format mesaFormat, GLsizei width, const GLubyte *image); - -extern void -_mesa_init_texture_s3tc( GLcontext *ctx ); - - #else /* _HAVE_FULL_GL */ /* no-op macros */ diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index 9fc73fec51..b271a539a7 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -44,6 +44,10 @@ #include "texcompress_s3tc.h" #include "texstore.h" + +#if FEATURE_texture_s3tc + + #ifdef __MINGW32__ #define DXTN_LIBNAME "dxtn.dll" #define RTLD_LAZY 0 @@ -564,5 +568,7 @@ _mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage, texel[BCOMP] = nonlinear_to_linear(rgba[BCOMP]); texel[ACOMP] = CHAN_TO_FLOAT(rgba[ACOMP]); } -#endif +#endif /* FEATURE_EXT_texture_sRGB */ + +#endif /* FEATURE_texture_s3tc */ diff --git a/src/mesa/main/texcompress_s3tc.h b/src/mesa/main/texcompress_s3tc.h index 4041d244d1..2e7688d366 100644 --- a/src/mesa/main/texcompress_s3tc.h +++ b/src/mesa/main/texcompress_s3tc.h @@ -25,8 +25,12 @@ #ifndef TEXCOMPRESS_S3TC_H #define TEXCOMPRESS_S3TC_H +#include "main/mtypes.h" #include "texstore.h" + +#if FEATURE_texture_s3tc + extern GLboolean _mesa_texstore_rgb_dxt1(TEXSTORE_PARAMS); @@ -71,5 +75,32 @@ extern void _mesa_fetch_texel_2d_f_srgba_dxt5(const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel); +extern void +_mesa_init_texture_s3tc(GLcontext *ctx); + +#else /* FEATURE_texture_s3tc */ + +/* these are used only in texstore_funcs[] */ +#define _mesa_texstore_rgb_dxt1 NULL +#define _mesa_texstore_rgba_dxt1 NULL +#define _mesa_texstore_rgba_dxt3 NULL +#define _mesa_texstore_rgba_dxt5 NULL + +/* these are used only in texfetch_funcs[] */ +#define _mesa_fetch_texel_2d_f_rgb_dxt1 NULL +#define _mesa_fetch_texel_2d_f_rgba_dxt1 NULL +#define _mesa_fetch_texel_2d_f_rgba_dxt3 NULL +#define _mesa_fetch_texel_2d_f_rgba_dxt5 NULL +#define _mesa_fetch_texel_2d_f_srgb_dxt1 NULL +#define _mesa_fetch_texel_2d_f_srgba_dxt1 NULL +#define _mesa_fetch_texel_2d_f_srgba_dxt3 NULL +#define _mesa_fetch_texel_2d_f_srgba_dxt5 NULL + +static INLINE void +_mesa_init_texture_s3tc(GLcontext *ctx) +{ +} + +#endif /* FEATURE_texture_s3tc */ #endif /* TEXCOMPRESS_S3TC_H */ -- cgit v1.2.3 From 9927d7f31c5c46c7b061cf8e13324ac4a837c4b7 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Fri, 2 Oct 2009 15:32:04 +0800 Subject: mesa: Fix compilation errors and warnings when features are disabled. Some of the fixes are cherry-picked from opengl-es branch. Signed-off-by: Chia-I Wu --- src/mesa/main/fbobject.c | 2 ++ src/mesa/main/texparam.c | 2 +- src/mesa/main/texstore.c | 21 ++++++++++----------- src/mesa/state_tracker/st_cb_blit.c | 2 ++ 4 files changed, 15 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 1d6ccf7fdd..4c6528bcf7 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -650,6 +650,8 @@ _mesa_test_framebuffer_completeness(GLcontext *ctx, struct gl_framebuffer *fb) return; } } +#else + (void) j; #endif if (numImages == 0) { diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 4258476092..79298e867a 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -600,7 +600,7 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params) iparams[1] = (GLint) params[1]; iparams[2] = (GLint) params[2]; iparams[3] = (GLint) params[3]; - need_update = set_tex_parameteri(ctx, target, iparams); + need_update = set_tex_parameteri(ctx, texObj, pname, iparams); } break; #endif diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 01fea476ae..7b449d03be 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -277,16 +277,6 @@ compute_component_mapping(GLenum inFormat, GLenum outFormat, } -#if !FEATURE_convolve -static void -_mesa_adjust_image_for_convolution(GLcontext *ctx, GLuint dims, - GLsizei *srcWidth, GLsizei *srcHeight) -{ - /* no-op */ -} -#endif - - /** * Make a temporary (color) texture image with GLfloat components. * Apply all needed pixel unpacking and pixel transfer operations. @@ -353,7 +343,7 @@ make_temp_float_image(GLcontext *ctx, GLuint dims, const GLuint postConvTransferOps = (transferOps & IMAGE_POST_CONVOLUTION_BITS) | IMAGE_CLAMP_BIT; GLint img, row; - GLint convWidth, convHeight; + GLint convWidth = srcWidth, convHeight = srcHeight; GLfloat *convImage; /* pre-convolution image buffer (3D) */ @@ -3004,6 +2994,15 @@ _mesa_texstore_sla8(TEXSTORE_PARAMS) return k; } +#else + +/* these are used only in texstore_funcs[] below */ +#define _mesa_texstore_srgb8 NULL +#define _mesa_texstore_srgba8 NULL +#define _mesa_texstore_sargb8 NULL +#define _mesa_texstore_sl8 NULL +#define _mesa_texstore_sla8 NULL + #endif /* FEATURE_EXT_texture_sRGB */ diff --git a/src/mesa/state_tracker/st_cb_blit.c b/src/mesa/state_tracker/st_cb_blit.c index 5626e25323..563615ed0d 100644 --- a/src/mesa/state_tracker/st_cb_blit.c +++ b/src/mesa/state_tracker/st_cb_blit.c @@ -64,6 +64,7 @@ st_destroy_blit(struct st_context *st) } +#if FEATURE_EXT_framebuffer_blit static void st_BlitFramebuffer(GLcontext *ctx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, @@ -206,6 +207,7 @@ st_BlitFramebuffer(GLcontext *ctx, } } } +#endif /* FEATURE_EXT_framebuffer_blit */ -- cgit v1.2.3 From 1f1bfe8cb5c74ee8708fb717a19d8389c9fadb80 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 07:54:44 -0600 Subject: mesa: move declaration to prevent unused var warning --- src/mesa/main/texstore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 7b449d03be..6237511e9f 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3108,8 +3108,8 @@ _mesa_texstore_null(TEXSTORE_PARAMS) static StoreTexImageFunc _mesa_get_texstore_func(gl_format format) { - GLuint i; #ifdef DEBUG + GLuint i; for (i = 0; i < MESA_FORMAT_COUNT; i++) { ASSERT(texstore_funcs[i].Name == i); } -- cgit v1.2.3 From c2f5eb71485e0d4d717bad7ab94fdb4a75f7e38f Mon Sep 17 00:00:00 2001 From: David Heidelberger Date: Thu, 29 Oct 2009 09:54:31 -0600 Subject: st/mesa: Fix nouveau glxinfo after merging texformat-rework. Signed-off-by: David Heidelberger Signed-off-by: Brian Paul --- src/mesa/state_tracker/st_format.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 0be2737272..7c6615fe04 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -218,6 +218,8 @@ st_mesa_format_to_pipe_format(gl_format mesaFormat) case MESA_FORMAT_ARGB8888_REV: case MESA_FORMAT_ARGB8888: return PIPE_FORMAT_A8R8G8B8_UNORM; + case MESA_FORMAT_XRGB8888: + return PIPE_FORMAT_X8R8G8B8_UNORM; case MESA_FORMAT_ARGB1555: return PIPE_FORMAT_A1R5G5B5_UNORM; case MESA_FORMAT_ARGB4444: @@ -287,6 +289,8 @@ st_pipe_format_to_mesa_format(enum pipe_format pipeFormat) switch (pipeFormat) { case PIPE_FORMAT_A8R8G8B8_UNORM: return MESA_FORMAT_ARGB8888; + case PIPE_FORMAT_X8R8G8B8_UNORM: + return MESA_FORMAT_XRGB8888; case PIPE_FORMAT_A1R5G5B5_UNORM: return MESA_FORMAT_ARGB1555; case PIPE_FORMAT_A4R4G4B4_UNORM: @@ -698,6 +702,8 @@ translate_gallium_format_to_mesa_format(enum pipe_format format) switch (format) { case PIPE_FORMAT_A8R8G8B8_UNORM: return MESA_FORMAT_ARGB8888; + case PIPE_FORMAT_X8R8G8B8_UNORM: + return MESA_FORMAT_XRGB8888; case PIPE_FORMAT_A1R5G5B5_UNORM: return MESA_FORMAT_ARGB1555; case PIPE_FORMAT_A4R4G4B4_UNORM: -- cgit v1.2.3 From 10a509564fa13f036b1b177fafae4337928a39a9 Mon Sep 17 00:00:00 2001 From: David Heidelberger Date: Thu, 29 Oct 2009 09:56:12 -0600 Subject: st/mesa: Add conversion from PIPE_FORMAT_X8Z24_UNORM to MESA_FORMAT_S8_Z24. Fix glxgears and openarena for Nouveau (no more asserts and crash). Signed-off-by: David Heidelberger --- src/mesa/state_tracker/st_format.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 7c6615fe04..02d3bd943d 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -311,6 +311,7 @@ st_pipe_format_to_mesa_format(enum pipe_format pipeFormat) return MESA_FORMAT_Z32; case PIPE_FORMAT_Z24S8_UNORM: return MESA_FORMAT_Z24_S8; + case PIPE_FORMAT_X8Z24_UNORM: case PIPE_FORMAT_S8Z24_UNORM: return MESA_FORMAT_S8_Z24; case PIPE_FORMAT_S8_UNORM: @@ -724,6 +725,7 @@ translate_gallium_format_to_mesa_format(enum pipe_format format) return MESA_FORMAT_Z32; case PIPE_FORMAT_Z24S8_UNORM: return MESA_FORMAT_Z24_S8; + case PIPE_FORMAT_X8Z24_UNORM: case PIPE_FORMAT_S8Z24_UNORM: return MESA_FORMAT_S8_Z24; case PIPE_FORMAT_YCBCR: -- cgit v1.2.3 From 41892e9b17e4e252ce1e73bc2dbc9d24eb13001b Mon Sep 17 00:00:00 2001 From: David Heidelberger Date: Thu, 29 Oct 2009 10:14:39 -0600 Subject: st/mesa: fix PIPE_FORMAT_X8Z24 <> MESA_FORMAT_X8_Z24 conversion Signed-off-by: David Heidelberger Signed-off-by: Brian Paul --- src/mesa/state_tracker/st_format.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 02d3bd943d..bb57adbf32 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -312,6 +312,7 @@ st_pipe_format_to_mesa_format(enum pipe_format pipeFormat) case PIPE_FORMAT_Z24S8_UNORM: return MESA_FORMAT_Z24_S8; case PIPE_FORMAT_X8Z24_UNORM: + return MESA_FORMAT_X8_Z24; case PIPE_FORMAT_S8Z24_UNORM: return MESA_FORMAT_S8_Z24; case PIPE_FORMAT_S8_UNORM: @@ -726,6 +727,7 @@ translate_gallium_format_to_mesa_format(enum pipe_format format) case PIPE_FORMAT_Z24S8_UNORM: return MESA_FORMAT_Z24_S8; case PIPE_FORMAT_X8Z24_UNORM: + return MESA_FORMAT_X8_Z24; case PIPE_FORMAT_S8Z24_UNORM: return MESA_FORMAT_S8_Z24; case PIPE_FORMAT_YCBCR: -- cgit v1.2.3 From c89f5b6ac86d46af4f0311fa76db6186825fbf1e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 08:28:52 -0600 Subject: glsl: make shader substitution a little better --- src/mesa/main/shaders.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/main/shaders.c b/src/mesa/main/shaders.c index 96fd8695a5..d0dc7e551c 100644 --- a/src/mesa/main/shaders.c +++ b/src/mesa/main/shaders.c @@ -26,6 +26,12 @@ #include "glheader.h" #include "context.h" #include "shaders.h" +#include "shader/shader_api.h" + + +/** Define this to enable shader substitution (see below) */ +#define SHADER_SUBST 0 + /** @@ -404,7 +410,6 @@ _mesa_read_shader(const char *fname) } - /** * Called via glShaderSource() and glShaderSourceARB() API functions. * Basically, concatenate the source code strings into one long string @@ -418,6 +423,7 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, GLint *offsets; GLsizei i, totalLength; GLcharARB *source; + GLuint checksum; if (!shaderObj || string == NULL) { _mesa_error(ctx, GL_INVALID_VALUE, "glShaderSourceARB"); @@ -469,15 +475,16 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, source[totalLength - 1] = '\0'; source[totalLength - 2] = '\0'; - if (0) { + if (SHADER_SUBST) { /* Compute the shader's source code checksum then try to open a file * named newshader_. If it exists, use it in place of the * original shader source code. For debugging. */ - const GLuint checksum = _mesa_str_checksum(source); char filename[100]; GLcharARB *newSource; + checksum = _mesa_str_checksum(source); + sprintf(filename, "newshader_%d", checksum); newSource = _mesa_read_shader(filename); @@ -491,6 +498,12 @@ _mesa_ShaderSourceARB(GLhandleARB shaderObj, GLsizei count, ctx->Driver.ShaderSource(ctx, shaderObj, source); + if (SHADER_SUBST) { + struct gl_shader *sh = _mesa_lookup_shader(ctx, shaderObj); + if (sh) + sh->SourceChecksum = checksum; /* save original checksum */ + } + _mesa_free(offsets); } -- cgit v1.2.3 From cf7040594e7987c021903f022784e2c6dae2db36 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 09:31:29 -0600 Subject: mesa: remove unneedded is_srgb_teximage() function Use _mesa_get_format_color_encoding() function instead. --- src/mesa/main/texgetimage.c | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 1338d4552d..9a88ec9ce3 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -44,29 +44,6 @@ #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) { - 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]. @@ -224,7 +201,8 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, } } #if FEATURE_EXT_texture_sRGB - else if (is_srgb_teximage(texImage)) { + else if (_mesa_get_format_color_encoding(texImage->TexFormat) + == GL_SRGB) { /* special case this since need to backconvert values */ /* convert row to RGBA format */ GLfloat rgba[MAX_WIDTH][4]; -- cgit v1.2.3 From d580c0c8f7cad69b808118ef2aa6161f62f160d8 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 09:19:24 -0600 Subject: mesa: fix some tests in subtexture_error_check2() Don't use hard-coded compressed block sizes. Update comments and error strings. --- src/mesa/main/teximage.c | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 0db98795dc..13053ce9ba 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1538,6 +1538,11 @@ subtexture_error_check( GLcontext *ctx, GLuint dimensions, return GL_FALSE; } + +/** + * Do second part of glTexSubImage which depends on the destination texture. + * \return GL_TRUE if error recorded, GL_FALSE otherwise + */ static GLboolean subtexture_error_check2( GLcontext *ctx, GLuint dimensions, GLenum target, GLint level, @@ -1585,41 +1590,35 @@ subtexture_error_check2( GLcontext *ctx, GLuint dimensions, } } -#if FEATURE_EXT_texture_sRGB - if (destTex->InternalFormat == GL_COMPRESSED_SRGB_S3TC_DXT1_EXT || - destTex->InternalFormat == GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT || - destTex->InternalFormat == GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT || - destTex->InternalFormat == GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT) { - if ((width & 0x3) || (height & 0x3) || - (xoffset & 0x3) || (yoffset & 0x3)) - _mesa_error(ctx, GL_INVALID_OPERATION, - "glTexSubImage%dD(size or offset not multiple of 4)", - dimensions); - return GL_TRUE; - } -#endif - if (_mesa_is_format_compressed(destTex->TexFormat)) { + GLuint bw, bh; + if (!target_can_be_compressed(ctx, target)) { _mesa_error(ctx, GL_INVALID_ENUM, - "glTexSubImage%D(target)", dimensions); + "glTexSubImage%D(target=%s)", dimensions, + _mesa_lookup_enum_by_nr(target)); return GL_TRUE; } - /* offset must be multiple of 4 */ - if ((xoffset & 3) || (yoffset & 3)) { + + /* do tests which depend on compression block size */ + _mesa_get_format_block_size(destTex->TexFormat, &bw, &bh); + + /* offset must be multiple of block size */ + if ((xoffset % bw != 0) || (yoffset % bh != 0)) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glTexSubImage%D(xoffset or yoffset)", dimensions); + "glTexSubImage%D(xoffset = %d, yoffset = %d)", + dimensions, xoffset, yoffset); return GL_TRUE; } - /* size must be multiple of 4 or equal to whole texture size */ - if ((width & 3) && (GLuint) width != destTex->Width) { + /* size must be multiple of bw by bh or equal to whole texture size */ + if ((width % bw != 0) && (GLuint) width != destTex->Width) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glTexSubImage%D(width)", dimensions); + "glTexSubImage%D(width = %d)", dimensions, width); return GL_TRUE; } - if ((height & 3) && (GLuint) height != destTex->Height) { + if ((height % bh != 0) && (GLuint) height != destTex->Height) { _mesa_error(ctx, GL_INVALID_OPERATION, - "glTexSubImage%D(width)", dimensions); + "glTexSubImage%D(height = %d)", dimensions, height); return GL_TRUE; } } -- cgit v1.2.3 From 67df4fb56bcb72eddcfc187454d95b663cc43578 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 09:25:16 -0600 Subject: mesa: move, clean-up _mesa_print_texture() --- src/mesa/main/debug.c | 61 ++++++++++++++++++++++++++++++++++++++++++++++++ src/mesa/main/debug.h | 3 +++ src/mesa/main/teximage.c | 57 -------------------------------------------- 3 files changed, 64 insertions(+), 57 deletions(-) (limited to 'src') diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index ee8cc29301..a42113edca 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -574,3 +574,64 @@ _mesa_dump_stencil_buffer(const char *filename) _mesa_free(buf); _mesa_free(buf2); } + + +/** + * Quick and dirty function to "print" a texture to stdout. + */ +void +_mesa_print_texture(GLcontext *ctx, const struct gl_texture_image *img) +{ +#if CHAN_TYPE != GL_UNSIGNED_BYTE + _mesa_problem(NULL, "PrintTexture not supported"); +#else + GLuint i, j, c; + const GLubyte *data = (const GLubyte *) img->Data; + + if (!data) { + _mesa_printf("No texture data\n"); + return; + } + + /* XXX add more formats or make into a new format utility function */ + switch (img->TexFormat) { + case MESA_FORMAT_A8: + case MESA_FORMAT_L8: + case MESA_FORMAT_I8: + case MESA_FORMAT_CI8: + c = 1; + break; + case MESA_FORMAT_AL88: + case MESA_FORMAT_AL88_REV: + c = 2; + break; + case MESA_FORMAT_RGB888: + case MESA_FORMAT_BGR888: + c = 3; + break; + case MESA_FORMAT_RGBA8888: + case MESA_FORMAT_ARGB8888: + c = 4; + break; + default: + _mesa_problem(NULL, "error in PrintTexture\n"); + return; + } + + for (i = 0; i < img->Height; i++) { + for (j = 0; j < img->Width; j++) { + if (c==1) + _mesa_printf("%02x ", data[0]); + else if (c==2) + _mesa_printf("%02x%02x ", data[0], data[1]); + else if (c==3) + _mesa_printf("%02x%02x%02x ", data[0], data[1], data[2]); + else if (c==4) + _mesa_printf("%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]); + data += (img->RowStride - img->Width) * c; + } + /* XXX use img->ImageStride here */ + _mesa_printf("\n"); + } +#endif +} diff --git a/src/mesa/main/debug.h b/src/mesa/main/debug.h index d12ea602dd..0449cb1798 100644 --- a/src/mesa/main/debug.h +++ b/src/mesa/main/debug.h @@ -75,4 +75,7 @@ _mesa_dump_depth_buffer(const char *filename); extern void _mesa_dump_stencil_buffer(const char *filename); +extern void +_mesa_print_texture(GLcontext *ctx, const struct gl_texture_image *img); + #endif diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 13053ce9ba..73a555a181 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -82,63 +82,6 @@ _mesa_free_texmemory(void *m) } - - -#if 0 -static void PrintTexture(GLcontext *ctx, const struct gl_texture_image *img) -{ -#if CHAN_TYPE != GL_UNSIGNED_BYTE - _mesa_problem(NULL, "PrintTexture not supported"); -#else - GLuint i, j, c; - const GLubyte *data = (const GLubyte *) img->Data; - - if (!data) { - _mesa_printf("No texture data\n"); - return; - } - - switch (img->Format) { - case GL_ALPHA: - case GL_LUMINANCE: - case GL_INTENSITY: - case GL_COLOR_INDEX: - c = 1; - break; - case GL_LUMINANCE_ALPHA: - c = 2; - break; - case GL_RGB: - c = 3; - break; - case GL_RGBA: - c = 4; - break; - default: - _mesa_problem(NULL, "error in PrintTexture\n"); - return; - } - - for (i = 0; i < img->Height; i++) { - for (j = 0; j < img->Width; j++) { - if (c==1) - _mesa_printf("%02x ", data[0]); - else if (c==2) - _mesa_printf("%02x%02x ", data[0], data[1]); - else if (c==3) - _mesa_printf("%02x%02x%02x ", data[0], data[1], data[2]); - else if (c==4) - _mesa_printf("%02x%02x%02x%02x ", data[0], data[1], data[2], data[3]); - data += (img->RowStride - img->Width) * c; - } - /* XXX use img->ImageStride here */ - _mesa_printf("\n"); - } -#endif -} -#endif - - /* * Compute floor(log_base_2(n)). * If n < 0 return -1. -- cgit v1.2.3 From 99bbf4b4f55b3b0038cbaadefb92ea4a73af6e0a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 10:05:06 -0600 Subject: mesa: consolidate some code in _mesa_GetTexImage() --- src/mesa/main/texgetimage.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 9a88ec9ce3..2a6c358e41 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -488,6 +488,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, { const struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; + struct gl_texture_image *texImage; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); @@ -497,10 +498,9 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, texUnit = _mesa_get_current_tex_unit(ctx); texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = _mesa_select_tex_image(ctx, texObj, target, level); if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) { - struct gl_texture_image *texImage = - _mesa_select_tex_image(ctx, texObj, target, level); _mesa_debug(ctx, "glGetTexImage(tex %u) format = %s, w=%d, h=%d," " dstFmt=0x%x, dstType=0x%x\n", texObj->Name, @@ -511,10 +511,6 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, _mesa_lock_texture(ctx, texObj); { - struct gl_texture_image *texImage = - _mesa_select_tex_image(ctx, texObj, target, level); - - /* typically, this will call _mesa_get_teximage() */ ctx->Driver.GetTexImage(ctx, target, level, format, type, pixels, texObj, texImage); } -- cgit v1.2.3 From 01ee5c63d3a8334f20e3fcaf6d19ba00bddf8268 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 10:44:46 -0600 Subject: mesa: move pixels==NULL check in glGetTexImage() --- src/mesa/main/texgetimage.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 2a6c358e41..0b439f2e2e 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -111,17 +111,12 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, /* out of memory or other unexpected error */ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage(map PBO failed)"); 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; @@ -318,10 +313,6 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, } img = ADD_POINTERS(buf, img); } - else if (!img) { - /* not an error */ - return; - } /* just memcpy, no pixelstore or pixel transfer */ _mesa_memcpy(img, texImage->Data, size); @@ -496,6 +487,11 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, return; } + if (_mesa_is_bufferobj(ctx->Pack.BufferObj) && !pixels) { + /* not an error, do nothing */ + return; + } + texUnit = _mesa_get_current_tex_unit(ctx); texObj = _mesa_select_tex_object(ctx, texUnit, target); texImage = _mesa_select_tex_image(ctx, texObj, target, level); @@ -614,6 +610,11 @@ _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) return; } + if (_mesa_is_bufferobj(ctx->Pack.BufferObj) && !img) { + /* not an error, do nothing */ + return; + } + texUnit = _mesa_get_current_tex_unit(ctx); texObj = _mesa_select_tex_object(ctx, texUnit, target); -- cgit v1.2.3 From dcb4716802878690908a101b1c196737851d4151 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 10:50:10 -0600 Subject: intel: added fast memcpy path for glGetTexImage() --- src/mesa/drivers/dri/intel/intel_tex_image.c | 105 ++++++++++++++++++++++++++- 1 file changed, 102 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 7e57e99be6..0199837cbe 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -6,6 +6,7 @@ #include "main/bufferobj.h" #include "main/convolve.h" #include "main/context.h" +#include "main/image.h" #include "main/texcompress.h" #include "main/texstore.h" #include "main/texgetimage.h" @@ -618,6 +619,100 @@ intelCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level, } +/** + * Try to use memcpy() to do a glGetTexImage(). + * \return GL_TRUE if done, GL_FALSE otherwise + */ +static GLboolean +memcpy_get_tex_image(GLcontext *ctx, GLenum target, GLint level, + GLenum format, GLenum type, GLvoid * pixels, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage) +{ + GLboolean memCopy = GL_FALSE; + + /* Texture image should have been mapped already */ + assert(texImage->Data); + + /* + * Check if the src/dst formats are compatible. + * Also note that GL's pixel transfer ops don't apply to glGetTexImage() + * so we don't have to worry about those. + */ + if ((texObj->Target == GL_TEXTURE_1D || + texObj->Target == GL_TEXTURE_2D || + texObj->Target == GL_TEXTURE_RECTANGLE || + (texObj->Target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && + texObj->Target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) { + if (texImage->TexFormat == MESA_FORMAT_ARGB8888 && + format == GL_BGRA && + type == GL_UNSIGNED_BYTE && + _mesa_little_endian()) { + memCopy = GL_TRUE; + } + else if (texImage->TexFormat == MESA_FORMAT_AL88 && + format == GL_LUMINANCE_ALPHA && + type == GL_UNSIGNED_BYTE && + _mesa_little_endian()) { + memCopy = GL_TRUE; + } + else if (texImage->TexFormat == MESA_FORMAT_L8 && + format == GL_LUMINANCE && + type == GL_UNSIGNED_BYTE) { + memCopy = GL_TRUE; + } + else if (texImage->TexFormat == MESA_FORMAT_A8 && + format == GL_ALPHA && + type == GL_UNSIGNED_BYTE) { + memCopy = GL_TRUE; + } + } + + if (memCopy) { + struct gl_pixelstore_attrib *pack = &ctx->Pack; + + if (_mesa_is_bufferobj(pack->BufferObj)) { + /* Packing texture image into a PBO */ + GLubyte *buf = (GLubyte *) + ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, + GL_WRITE_ONLY_ARB, pack->BufferObj); + if (!buf) { + /* out of memory or other unexpected error */ + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage(map PBO failed)"); + return GL_TRUE; /* failed, but done */ + } + pixels = ADD_POINTERS(buf, pixels); + } + + { + const GLuint bpp = _mesa_get_format_bytes(texImage->TexFormat); + const GLuint bytesPerRow = texImage->Width * bpp; + GLubyte *dst = + _mesa_image_address2d(&ctx->Pack, pixels, texImage->Width, + texImage->Height, format, type, 0, 0); + const GLint dstRowStride = + _mesa_image_row_stride(&ctx->Pack, texImage->Width, format, type); + const GLubyte *src = texImage->Data; + const GLint srcRowStride = texImage->RowStride * bpp; + GLuint row; + + printf("Fast getteximage!\n"); + for (row = 0; row < texImage->Height; row++) { + memcpy(dst, src, bytesPerRow); + dst += dstRowStride; + src += srcRowStride; + } + } + + if (_mesa_is_bufferobj(pack->BufferObj)) { + ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, pack->BufferObj); + } + } + + return memCopy; +} + + /** * Need to map texture image into memory before copying image data, * then unmap it. @@ -667,9 +762,13 @@ intel_get_tex_image(GLcontext * ctx, GLenum target, GLint level, if (compressed) { _mesa_get_compressed_teximage(ctx, target, level, pixels, texObj, texImage); - } else { - _mesa_get_teximage(ctx, target, level, format, type, pixels, - texObj, texImage); + } + else { + if (!memcpy_get_tex_image(ctx, target, level, format, type, pixels, + texObj, texImage)) { + _mesa_get_teximage(ctx, target, level, format, type, pixels, + texObj, texImage); + } } -- cgit v1.2.3 From 2b628d43c0a2f9a14ea1e87dbdcac512fca7198a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 10:53:26 -0600 Subject: mesa: consolidate some code in _mesa_GetCompressedTexImageARB() --- src/mesa/main/texgetimage.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 0b439f2e2e..fbd61d5ae6 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -603,6 +603,7 @@ _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) { const struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; + struct gl_texture_image *texImage; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); @@ -617,10 +618,9 @@ _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) texUnit = _mesa_get_current_tex_unit(ctx); texObj = _mesa_select_tex_object(ctx, texUnit, target); + texImage = _mesa_select_tex_image(ctx, texObj, target, level); if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) { - struct gl_texture_image *texImage = - _mesa_select_tex_image(ctx, texObj, target, level); _mesa_debug(ctx, "glGetCompressedTexImage(tex %u) format = %s, w=%d, h=%d\n", texObj->Name, @@ -630,10 +630,6 @@ _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) _mesa_lock_texture(ctx, texObj); { - struct gl_texture_image *texImage = - _mesa_select_tex_image(ctx, texObj, target, level); - - /* this typically calls _mesa_get_compressed_teximage() */ ctx->Driver.GetCompressedTexImage(ctx, target, level, img, texObj, texImage); } -- cgit v1.2.3 From 1596f714d2377036152bd126949c6526fdb06fbf Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 10:56:13 -0600 Subject: intel: remove debug code --- src/mesa/drivers/dri/intel/intel_tex_image.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 0199837cbe..c861fc552f 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -696,7 +696,6 @@ memcpy_get_tex_image(GLcontext *ctx, GLenum target, GLint level, const GLint srcRowStride = texImage->RowStride * bpp; GLuint row; - printf("Fast getteximage!\n"); for (row = 0; row < texImage->Height; row++) { memcpy(dst, src, bytesPerRow); dst += dstRowStride; -- cgit v1.2.3 From fb0084e69e3326b49aca8ca004e19acb7f8c8555 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 26 Oct 2009 09:15:42 -0700 Subject: intel: Clean up merge leftover from the DRI2 swap throttling. --- src/mesa/drivers/dri/intel/intel_batchbuffer.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c index 6aa36d10b1..e94b8368cd 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c @@ -201,11 +201,6 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file, drm_intel_bo_reference(intel->first_post_swapbuffers_batch); } - if (intel->first_post_swapbuffers_batch == NULL) { - intel->first_post_swapbuffers_batch = intel->batch->buf; - drm_intel_bo_reference(intel->first_post_swapbuffers_batch); - } - if (used == 0) { batch->cliprect_mode = IGNORE_CLIPRECTS; return; -- cgit v1.2.3 From 6eb6a0e9cbed6ba5543d54e277f7ac11a0612070 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 26 Oct 2009 09:37:53 -0700 Subject: intel: Don't bother MI_FLUSHing on glFlush in the DRI2 case. We only need it when drawing to the front buffer, which we never do for DRI2. No significant performance difference, but the flush is definitely gone from the end of every batchbuffer. --- src/mesa/drivers/dri/intel/intel_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index c3432497ca..a7d94ced9a 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -484,7 +484,7 @@ intel_flush(GLcontext *ctx, GLboolean needs_mi_flush) * lands onscreen in a timely manner, even if the X Server doesn't trigger * a flush for us. */ - if (needs_mi_flush) + if (!intel->driScreen->dri2.enabled && needs_mi_flush) intel_batchbuffer_emit_mi_flush(intel->batch); if (intel->batch->map != intel->batch->ptr) -- cgit v1.2.3 From 32ec3f26731ac998b6fda7ce596ec568d6f76eeb Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 28 Oct 2009 16:35:16 -0700 Subject: mesa: Mostly fix swrast's ARB_depth_clamp support. I'd written a testcase for the hard part of the extension enablement, so naturally the easy stuff was completely broken. There are still issues, as I'm seeing FLOAT_TO_UINT(max_f) == 0x0 when max_f == 1.0, but it gets piglit depth-clamp-range closer to success. --- src/mesa/swrast/s_depth.c | 28 +++++++++++++++++++--------- src/mesa/swrast/s_span.c | 10 +++++++--- 2 files changed, 26 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c index 393590c673..c37a54eb3e 100644 --- a/src/mesa/swrast/s_depth.c +++ b/src/mesa/swrast/s_depth.c @@ -506,22 +506,32 @@ _swrast_depth_clamp_span( GLcontext *ctx, SWspan *span ) struct gl_renderbuffer *rb = fb->_DepthBuffer; const GLuint count = span->end; GLuint *zValues = span->array->z; - GLuint near, far; + GLuint min, max; + GLfloat min_f, max_f; int i; + if (ctx->Viewport.Near < ctx->Viewport.Far) { + min_f = ctx->Viewport.Near; + max_f = ctx->Viewport.Far; + } else { + min_f = ctx->Viewport.Far; + max_f = ctx->Viewport.Near; + } + if (rb->DataType == GL_UNSIGNED_SHORT) { - near = FLOAT_TO_UINT(ctx->Viewport.Near); - far = FLOAT_TO_UINT(ctx->Viewport.Far); + CLAMPED_FLOAT_TO_USHORT(min, min_f); + CLAMPED_FLOAT_TO_USHORT(max, max_f); } else { assert(rb->DataType == GL_UNSIGNED_INT); - CLAMPED_FLOAT_TO_USHORT(near, ctx->Viewport.Near); - CLAMPED_FLOAT_TO_USHORT(far, ctx->Viewport.Far); + min = FLOAT_TO_UINT(min_f); + max = FLOAT_TO_UINT(max_f); } + for (i = 0; i < count; i++) { - if (zValues[i] < near) - zValues[i] = near; - if (zValues[i] > far) - zValues[i] = far; + if (zValues[i] < min) + zValues[i] = min; + if (zValues[i] > max) + zValues[i] = max; } } diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 704230d1d7..d36c8132f6 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -880,14 +880,14 @@ _swrast_write_index_span( GLcontext *ctx, SWspan *span) stipple_polygon_span(ctx, span); } - if (ctx->Transform.DepthClamp) - _swrast_depth_clamp_span(ctx, span); - /* Stencil and Z testing */ if (ctx->Stencil._Enabled || ctx->Depth.Test) { if (!(span->arrayMask & SPAN_Z)) _swrast_span_interpolate_z(ctx, span); + if (ctx->Transform.DepthClamp) + _swrast_depth_clamp_span(ctx, span); + if (ctx->Stencil._Enabled) { if (!_swrast_stencil_and_ztest_span(ctx, span)) { span->arrayMask = origArrayMask; @@ -1356,6 +1356,10 @@ _swrast_write_rgba_span( GLcontext *ctx, SWspan *span) if (ctx->Stencil._Enabled || ctx->Depth.Test) { if (!(span->arrayMask & SPAN_Z)) _swrast_span_interpolate_z(ctx, span); + + if (ctx->Transform.DepthClamp) + _swrast_depth_clamp_span(ctx, span); + if (ctx->Stencil._Enabled) { /* Combined Z/stencil tests */ if (!_swrast_stencil_and_ztest_span(ctx, span)) { -- cgit v1.2.3 From 92e7c6a2581b5f612a84587500399bb00318c6f0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 28 Oct 2009 16:36:35 -0700 Subject: i965: Fix fallout from ARB_depth_clamp enablement that broke glDepthRange. If a backwards glDepthRange was supplied (as with the old Quake no-z-clearing hack), the hardware would have always clamped because we weren't clamping to the min of near/far and the max of near/far. Also, we shouldn't be clamping to near/far at all when not in depth clamp mode (this usually didn't matter since near/far are usually the same as the 0.0, 1.0 clamping you do for fixed-point depth). This should fix funny depth issues in PlaneShift, and fixes piglit depth-clamp-range --- src/mesa/drivers/dri/i965/brw_cc.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c index 1088a7a607..5cca605c3f 100644 --- a/src/mesa/drivers/dri/i965/brw_cc.c +++ b/src/mesa/drivers/dri/i965/brw_cc.c @@ -44,9 +44,15 @@ static void prepare_cc_vp( struct brw_context *brw ) memset(&ccv, 0, sizeof(ccv)); - /* _NEW_VIEWPORT */ - ccv.min_depth = ctx->Viewport.Near; - ccv.max_depth = ctx->Viewport.Far; + /* _NEW_TRANSOFORM */ + if (ctx->Transform.DepthClamp) { + /* _NEW_VIEWPORT */ + ccv.min_depth = MIN2(ctx->Viewport.Near, ctx->Viewport.Far); + ccv.max_depth = MAX2(ctx->Viewport.Near, ctx->Viewport.Far); + } else { + ccv.min_depth = 0.0; + ccv.max_depth = 1.0; + } dri_bo_unreference(brw->cc.vp_bo); brw->cc.vp_bo = brw_cache_data( &brw->cache, BRW_CC_VP, &ccv, NULL, 0 ); @@ -54,7 +60,7 @@ static void prepare_cc_vp( struct brw_context *brw ) const struct brw_tracked_state brw_cc_vp = { .dirty = { - .mesa = _NEW_VIEWPORT, + .mesa = _NEW_VIEWPORT | _NEW_TRANSFORM, .brw = BRW_NEW_CONTEXT, .cache = 0 }, -- cgit v1.2.3 From ea414e331802e49d59eb2ddd2466d58a383bc931 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 11:04:11 -0600 Subject: intel: check for single memcpy() in memcpy_get_tex_image() --- src/mesa/drivers/dri/intel/intel_tex_image.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index c861fc552f..6301444c34 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -696,11 +696,16 @@ memcpy_get_tex_image(GLcontext *ctx, GLenum target, GLint level, const GLint srcRowStride = texImage->RowStride * bpp; GLuint row; - for (row = 0; row < texImage->Height; row++) { - memcpy(dst, src, bytesPerRow); - dst += dstRowStride; - src += srcRowStride; - } + if (bytesPerRow == dstRowStride && bytesPerRow == dstRowStride) { + memcpy(dst, src, bytesPerRow * texImage->Height); + } + else { + for (row = 0; row < texImage->Height; row++) { + memcpy(dst, src, bytesPerRow); + dst += dstRowStride; + src += srcRowStride; + } + } } if (_mesa_is_bufferobj(pack->BufferObj)) { -- cgit v1.2.3 From 374447244165b3b79892cb6840a76ea4c2f21f1e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 29 Oct 2009 10:36:22 -0700 Subject: i965: Replace a MIN(MAX()) with CLAMP(). --- src/mesa/drivers/dri/i965/brw_wm_sampler_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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 dff466587a..416ffc9761 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c @@ -228,8 +228,8 @@ static void brw_update_sampler_state(struct wm_sampler_entry *key, */ sampler->ss0.base_level = U_FIXED(0, 1); - sampler->ss1.max_lod = U_FIXED(MIN2(MAX2(key->maxlod, 0), 13), 6); - sampler->ss1.min_lod = U_FIXED(MIN2(MAX2(key->minlod, 0), 13), 6); + sampler->ss1.max_lod = U_FIXED(CLAMP(key->maxlod, 0, 13), 6); + sampler->ss1.min_lod = U_FIXED(CLAMP(key->minlod, 0, 13), 6); sampler->ss2.default_color_pointer = sdc_bo->offset >> 5; /* reloc */ } -- cgit v1.2.3 From f8f40b53a6a4551630e25bfd7f6e12334bb0f3f8 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 29 Oct 2009 11:52:28 -0700 Subject: i915: Implement min/max LOD clamping with the hardware. This gets us expected behavior for clamping between mipmap levels, and avoids relayout of textures for doing clamping. Fixes piglit lodclamp-between. --- src/mesa/drivers/dri/i915/i915_texstate.c | 12 ++++-- src/mesa/drivers/dri/i965/brw_wm_sampler_state.c | 13 ------- src/mesa/drivers/dri/intel/intel_context.h | 13 +++++++ src/mesa/drivers/dri/intel/intel_tex_validate.c | 48 ++++++++++++------------ 4 files changed, 46 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index 3a20e9c3ab..1397f04a59 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -27,6 +27,7 @@ #include "main/mtypes.h" #include "main/enums.h" +#include "main/macros.h" #include "intel_mipmap_tree.h" #include "intel_tex.h" @@ -200,10 +201,10 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) } state[I915_TEXREG_MS4] = - ((((pitch / 4) - 1) << MS4_PITCH_SHIFT) | MS4_CUBE_FACE_ENA_MASK | - ((((intelObj->lastLevel - intelObj->firstLevel) * 4)) << - MS4_MAX_LOD_SHIFT) | ((firstImage->Depth - 1) << - MS4_VOLUME_DEPTH_SHIFT)); + ((((pitch / 4) - 1) << MS4_PITCH_SHIFT) | + MS4_CUBE_FACE_ENA_MASK | + (U_FIXED(CLAMP(tObj->MaxLod, 0.0, 11.0), 2) << MS4_MAX_LOD_SHIFT) | + ((firstImage->Depth - 1) << MS4_VOLUME_DEPTH_SHIFT)); { @@ -333,6 +334,9 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) (translate_wrap_mode(wr) << SS3_TCZ_ADDR_MODE_SHIFT)); state[I915_TEXREG_SS3] |= (unit << SS3_TEXTUREMAP_INDEX_SHIFT); + state[I915_TEXREG_SS3] |= (U_FIXED(CLAMP(tObj->MinLod, 0.0, 11.0), 4) << + SS3_MIN_LOD_SHIFT); + } /* convert border color from float to ubyte */ 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 416ffc9761..0acb027431 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c @@ -66,19 +66,6 @@ static GLuint translate_wrap_mode( GLenum wrap ) } } - -static GLuint U_FIXED(GLfloat value, GLuint frac_bits) -{ - value *= (1<prim.flush) \ diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c index d5b562f5e5..504993989a 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_validate.c +++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c @@ -5,6 +5,7 @@ #include "intel_batchbuffer.h" #include "intel_mipmap_tree.h" #include "intel_tex.h" +#include "intel_chipset.h" #define FILE_DEBUG_FLAG DEBUG_TEXTURE @@ -14,7 +15,8 @@ * GL_TEXTURE_MAX_LOD, GL_TEXTURE_BASE_LEVEL, and GL_TEXTURE_MAX_LEVEL. */ static void -intel_calculate_first_last_level(struct intel_texture_object *intelObj) +intel_calculate_first_last_level(struct intel_context *intel, + struct intel_texture_object *intelObj) { struct gl_texture_object *tObj = &intelObj->base; const struct gl_texture_image *const baseImage = @@ -40,27 +42,27 @@ intel_calculate_first_last_level(struct intel_texture_object *intelObj) firstLevel = lastLevel = tObj->BaseLevel; } else { -#ifdef I915 - firstLevel = tObj->BaseLevel + (GLint) (tObj->MinLod + 0.5); - firstLevel = MAX2(firstLevel, tObj->BaseLevel); - firstLevel = MIN2(firstLevel, tObj->BaseLevel + baseImage->MaxLog2); - lastLevel = tObj->BaseLevel + (GLint) (tObj->MaxLod + 0.5); - lastLevel = MAX2(lastLevel, tObj->BaseLevel); - lastLevel = MIN2(lastLevel, tObj->BaseLevel + baseImage->MaxLog2); - lastLevel = MIN2(lastLevel, tObj->MaxLevel); - lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */ -#else - /* Currently not taking min/max lod into account here, those - * values are programmed as sampler state elsewhere and we - * upload the same mipmap levels regardless. Not sure if - * this makes sense as it means it isn't possible for the app - * to use min/max lod to reduce texture memory pressure: - */ - firstLevel = tObj->BaseLevel; - lastLevel = MIN2(tObj->BaseLevel + baseImage->MaxLog2, - tObj->MaxLevel); - lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */ -#endif + if (!IS_9XX(intel->intelScreen->deviceID)) { + firstLevel = tObj->BaseLevel + (GLint) (tObj->MinLod + 0.5); + firstLevel = MAX2(firstLevel, tObj->BaseLevel); + firstLevel = MIN2(firstLevel, tObj->BaseLevel + baseImage->MaxLog2); + lastLevel = tObj->BaseLevel + (GLint) (tObj->MaxLod + 0.5); + lastLevel = MAX2(lastLevel, tObj->BaseLevel); + lastLevel = MIN2(lastLevel, tObj->BaseLevel + baseImage->MaxLog2); + lastLevel = MIN2(lastLevel, tObj->MaxLevel); + lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */ + } else { + /* Min/max LOD are taken into account in sampler state. We don't + * want to re-layout textures just because clamping has been applied + * since it means a bunch of blitting around and probably no memory + * savings (since we have to keep the other levels around anyway). + */ + firstLevel = tObj->BaseLevel; + lastLevel = MIN2(tObj->BaseLevel + baseImage->MaxLog2, + tObj->MaxLevel); + /* need at least one level */ + lastLevel = MAX2(firstLevel, lastLevel); + } } break; case GL_TEXTURE_RECTANGLE_NV: @@ -135,7 +137,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) /* What levels must the tree include at a minimum? */ - intel_calculate_first_last_level(intelObj); + intel_calculate_first_last_level(intel, intelObj); firstImage = intel_texture_image(intelObj->base.Image[0][intelObj->firstLevel]); -- cgit v1.2.3 From a7fa56a64b8963e74e93f3bac8ac80813f4a9778 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Mon, 26 Oct 2009 07:43:49 -0400 Subject: st/xorg: fix scaling ov xv data, plus some cleanups --- src/gallium/state_trackers/xorg/xorg_renderer.c | 47 +++++++++++++++++-------- src/gallium/state_trackers/xorg/xorg_renderer.h | 5 +++ src/gallium/state_trackers/xorg/xorg_xv.c | 33 ++++++++++------- 3 files changed, 57 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index a740e862b7..ac2c4935a5 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -226,9 +226,8 @@ setup_vertex_data2(struct xorg_renderer *r, static struct pipe_buffer * setup_vertex_data_yuv(struct xorg_renderer *r, - float srcX, float srcY, - float dstX, float dstY, - float width, float height, + float srcX, float srcY, float srcW, float srcH, + float dstX, float dstY, float dstW, float dstH, struct pipe_texture **tex) { float s0, t0, s1, t1; @@ -236,8 +235,8 @@ setup_vertex_data_yuv(struct xorg_renderer *r, spt0[0] = srcX; spt0[1] = srcY; - spt1[0] = srcX + width; - spt1[1] = srcY + height; + spt1[0] = srcX + srcW; + spt1[1] = srcY + srcH; s0 = spt0[0] / tex[0]->width[0]; t0 = spt0[1] / tex[0]->height[0]; @@ -247,13 +246,13 @@ setup_vertex_data_yuv(struct xorg_renderer *r, /* 1st vertex */ setup_vertex1(r->vertices2[0], dstX, dstY, s0, t0); /* 2nd vertex */ - setup_vertex1(r->vertices2[1], dstX + width, dstY, + setup_vertex1(r->vertices2[1], dstX + dstW, dstY, s1, t0); /* 3rd vertex */ - setup_vertex1(r->vertices2[2], dstX + width, dstY + height, + setup_vertex1(r->vertices2[2], dstX + dstW, dstY + dstH, s1, t1); /* 4th vertex */ - setup_vertex1(r->vertices2[3], dstX, dstY + height, + setup_vertex1(r->vertices2[3], dstX, dstY + dstH, s0, t1); @@ -864,13 +863,6 @@ void renderer_draw_textures(struct xorg_renderer *r, src_matrix, mask_matrix); break; case 3: - buf = setup_vertex_data_yuv(r, - pos[0], pos[1], - pos[2], pos[3], - width, height, - textures); - num_textures = 1; - break; default: debug_assert(!"Unsupported number of textures"); break; @@ -888,3 +880,28 @@ void renderer_draw_textures(struct xorg_renderer *r, pipe_buffer_reference(&buf, NULL); } } + +void renderer_draw_yuv(struct xorg_renderer *r, + int src_x, int src_y, int src_w, int src_h, + int dst_x, int dst_y, int dst_w, int dst_h, + struct pipe_texture **textures) +{ + struct pipe_context *pipe = r->pipe; + struct pipe_buffer *buf = 0; + + buf = setup_vertex_data_yuv(r, + src_x, src_y, src_w, src_h, + dst_x, dst_y, dst_w, dst_h, + textures); + + if (buf) { + const int num_attribs = 2; /*pos + tex coord*/ + + util_draw_vertex_buffer(pipe, buf, 0, + PIPE_PRIM_TRIANGLE_FAN, + 4, /* verts */ + num_attribs); /* attribs/vert */ + + pipe_buffer_reference(&buf, NULL); + } +} diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h index f86ef670be..34c9ee4541 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.h +++ b/src/gallium/state_trackers/xorg/xorg_renderer.h @@ -51,5 +51,10 @@ void renderer_draw_textures(struct xorg_renderer *r, float *src_matrix, float *mask_matrix); +void renderer_draw_yuv(struct xorg_renderer *r, + int src_x, int src_y, int src_w, int src_h, + int dst_x, int dst_y, int dst_w, int dst_h, + struct pipe_texture **textures); + #endif diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index c3d9454245..2b935c0f73 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -343,19 +343,16 @@ setup_fs_video_constants(struct xorg_renderer *r, boolean hdtv) } static void -draw_yuv(struct xorg_xv_port_priv *port, int src_x, int src_y, - int dst_x, int dst_y, - int w, int h) +draw_yuv(struct xorg_xv_port_priv *port, + int src_x, int src_y, int src_w, int src_h, + int dst_x, int dst_y, int dst_w, int dst_h) { - int pos[4] = {src_x, src_y, - dst_x, dst_y}; struct pipe_texture **textures = port->yuv[port->current_set]; - renderer_draw_textures(port->r, - pos, w, h, - textures, - 3, /*bound samplers/textures */ - NULL, NULL /* no transformations */); + renderer_draw_yuv(port->r, + src_x, src_y, src_w, src_h, + dst_x, dst_y, dst_w, dst_h, + textures); } static void @@ -438,8 +435,7 @@ static int display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id, RegionPtr dstRegion, int src_x, int src_y, int src_w, int src_h, - int dstX, int dstY, - short width, short height, + int dstX, int dstY, int dst_w, int dst_h, PixmapPtr pPixmap) { modesettingPtr ms = modesettingPTR(pScrn); @@ -478,13 +474,24 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id, int box_y1 = pbox->y1; int box_x2 = pbox->x2; int box_y2 = pbox->y2; + float diff_x = (float)src_w / (float)dst_w; + float diff_y = (float)src_h / (float)dst_h; + int offset_x = box_x1 - dstX; + int offset_y = box_y1 - dstY; + int offset_w; + int offset_h; x = box_x1; y = box_y1; w = box_x2 - box_x1; h = box_y2 - box_y1; - draw_yuv(pPriv, src_x, src_y, x, y, w, h); + offset_w = dst_w - w; + offset_h = dst_h - h; + + draw_yuv(pPriv, src_x + offset_x*diff_x, src_y + offset_y*diff_y, + src_w - offset_w*diff_x, src_h - offset_h*diff_x, + x, y, w, h); pbox++; } -- cgit v1.2.3 From c6164ff155189007c02aabb31549f5f4dc767d1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 29 Oct 2009 20:03:51 +0000 Subject: mesa: Add MESA_FORMAT_Z24_X8. --- src/mesa/main/formats.c | 14 +++++++++++++ src/mesa/main/formats.h | 1 + src/mesa/main/texfetch.c | 7 +++++++ src/mesa/main/texstore.c | 41 +++++++++++++++++++++++++++++++++++++- src/mesa/state_tracker/st_format.c | 2 ++ 5 files changed, 64 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 72d043c4c3..aed313445f 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -330,6 +330,15 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 24, 0, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 4 /* BlockWidth/Height,Bytes */ }, + { + MESA_FORMAT_Z24_X8, /* Name */ + "MESA_FORMAT_Z24_X8", /* StrName */ + GL_DEPTH_COMPONENT, /* BaseFormat */ + GL_UNSIGNED_INT, /* DataType */ + 0, 0, 0, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 24, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, { MESA_FORMAT_Z32, /* Name */ "MESA_FORMAT_Z32", /* StrName */ @@ -1004,6 +1013,11 @@ _mesa_format_to_type_and_comps(gl_format format, *comps = 1; return; + case MESA_FORMAT_Z24_X8: + *datatype = GL_UNSIGNED_INT; + *comps = 1; + return; + case MESA_FORMAT_Z32: *datatype = GL_UNSIGNED_INT; *comps = 1; diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index 91ea023077..fa6359f5c8 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -77,6 +77,7 @@ typedef enum MESA_FORMAT_S8_Z24, /* SSSS SSSS ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ MESA_FORMAT_Z16, /* ZZZZ ZZZZ ZZZZ ZZZZ */ MESA_FORMAT_X8_Z24, /* xxxx xxxx ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ + MESA_FORMAT_Z24_X8, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ xxxx xxxx */ MESA_FORMAT_Z32, /* ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ ZZZZ */ MESA_FORMAT_S8, /* SSSS SSSS */ /*@}*/ diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c index e6e28aef19..314ccb7b65 100644 --- a/src/mesa/main/texfetch.c +++ b/src/mesa/main/texfetch.c @@ -529,6 +529,13 @@ texfetch_funcs[MESA_FORMAT_COUNT] = fetch_texel_3d_f_s8_z24, store_texel_s8_z24 }, + { + MESA_FORMAT_Z24_X8, + fetch_texel_1d_f_z24_s8, + fetch_texel_2d_f_z24_s8, + fetch_texel_3d_f_z24_s8, + store_texel_z24_s8 + }, { MESA_FORMAT_Z32, fetch_texel_1d_f_z32, diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 6237511e9f..14cad6b32f 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1077,6 +1077,44 @@ _mesa_texstore_x8_z24(TEXSTORE_PARAMS) } +/** + * Store a 24-bit integer depth component texture image. + */ +static GLboolean +_mesa_texstore_z24_x8(TEXSTORE_PARAMS) +{ + const GLuint depthScale = 0xffffff; + const GLuint texelBytes = 4; + + (void) dims; + ASSERT(dstFormat == MESA_FORMAT_Z24_X8); + + { + /* general path */ + GLint img, row; + for (img = 0; img < srcDepth; img++) { + GLubyte *dstRow = (GLubyte *) dstAddr + + dstImageOffsets[dstZoffset + img] * texelBytes + + dstYoffset * dstRowStride + + dstXoffset * texelBytes; + for (row = 0; row < srcHeight; row++) { + const GLvoid *src = _mesa_image_address(dims, srcPacking, + srcAddr, srcWidth, srcHeight, srcFormat, srcType, img, row, 0); + GLuint *dst = (GLuint *) dstRow; + GLint i; + _mesa_unpack_depth_span(ctx, srcWidth, + GL_UNSIGNED_INT, dst, + depthScale, srcType, src, srcPacking); + for (i = 0; i < srcWidth; i++) + dst[i] <<= 8; + dstRow += dstRowStride; + } + } + } + return GL_TRUE; +} + + /** * Store a 16-bit integer depth component texture image. */ @@ -3012,7 +3050,7 @@ _mesa_texstore_sla8(TEXSTORE_PARAMS) * Table mapping MESA_FORMAT_8 to _mesa_texstore_*() * XXX this is somewhat temporary. */ -static struct { +const static struct { gl_format Name; StoreTexImageFunc Store; } @@ -3046,6 +3084,7 @@ texstore_funcs[MESA_FORMAT_COUNT] = { MESA_FORMAT_S8_Z24, _mesa_texstore_s8_z24 }, { MESA_FORMAT_Z16, _mesa_texstore_z16 }, { MESA_FORMAT_X8_Z24, _mesa_texstore_x8_z24 }, + { MESA_FORMAT_Z24_X8, _mesa_texstore_z24_x8 }, { MESA_FORMAT_Z32, _mesa_texstore_z32 }, { MESA_FORMAT_S8, NULL/*_mesa_texstore_s8*/ }, { MESA_FORMAT_SRGB8, _mesa_texstore_srgb8 }, diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index bb57adbf32..02f80057c2 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -309,6 +309,8 @@ st_pipe_format_to_mesa_format(enum pipe_format pipeFormat) return MESA_FORMAT_Z16; case PIPE_FORMAT_Z32_UNORM: return MESA_FORMAT_Z32; + case PIPE_FORMAT_Z24X8_UNORM: + return MESA_FORMAT_Z24_X8; case PIPE_FORMAT_Z24S8_UNORM: return MESA_FORMAT_Z24_S8; case PIPE_FORMAT_X8Z24_UNORM: -- cgit v1.2.3 From a0959bcee5df4272db40a56c468f8c7cc299d5ef Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 14:16:18 -0600 Subject: i965: minor code reformatting --- src/mesa/drivers/dri/i965/brw_wm_fp.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index 4e3edfbbff..4ef437e2fa 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -971,13 +971,12 @@ static void emit_fb_write( struct brw_wm_compile *c ) if (brw->state.nr_color_regions > 1) { for (i = 0 ; i < brw->state.nr_color_regions; i++) { outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DATA0 + i); - last_inst = inst = emit_op(c, - WM_FB_WRITE, dst_mask(dst_undef(),0), 0, - outcolor, payload_r0_depth, outdepth); + last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(), 0), + 0, outcolor, payload_r0_depth, outdepth); inst->Aux = (i<<1); if (c->fp_fragcolor_emitted) { outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLOR); - last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0), + last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(), 0), 0, outcolor, payload_r0_depth, outdepth); inst->Aux = (i<<1); } -- cgit v1.2.3 From a8d233e509a2c1aada7cd4e83b126ba06cb90565 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 14:29:55 -0600 Subject: i965: use macros to get/set prog_instruction::Aux field This makes things a bit easier to remember/understand. --- src/mesa/drivers/dri/i965/brw_wm.h | 6 ++++++ src/mesa/drivers/dri/i965/brw_wm_fp.c | 8 ++++---- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 4 ++-- src/mesa/drivers/dri/i965/brw_wm_pass0.c | 4 ++-- 4 files changed, 14 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 872b1f3ecf..f13a958a44 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -271,6 +271,12 @@ struct brw_wm_compile { }; +/** Bits for prog_instruction::Aux field */ +#define INST_AUX_EOT 0x1 +#define INST_AUX_TARGET(T) (T << 1) +#define INST_AUX_GET_TARGET(AUX) ((AUX) >> 1) + + GLuint brw_wm_nr_args( GLuint opcode ); GLuint brw_wm_is_scalar_result( GLuint opcode ); diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index 4ef437e2fa..d33fd9abed 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -973,15 +973,15 @@ static void emit_fb_write( struct brw_wm_compile *c ) outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DATA0 + i); last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(), 0), 0, outcolor, payload_r0_depth, outdepth); - inst->Aux = (i<<1); + inst->Aux = INST_AUX_TARGET(i); if (c->fp_fragcolor_emitted) { outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLOR); last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(), 0), 0, outcolor, payload_r0_depth, outdepth); - inst->Aux = (i<<1); + inst->Aux = INST_AUX_TARGET(i); } } - last_inst->Aux |= 1; //eot + last_inst->Aux |= INST_AUX_EOT; } else { /* if gl_FragData[0] is written, use it, else use gl_FragColor */ @@ -992,7 +992,7 @@ static void emit_fb_write( struct brw_wm_compile *c ) inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(),0), 0, outcolor, payload_r0_depth, outdepth); - inst->Aux = 1|(0<<1); + inst->Aux = INST_AUX_EOT | INST_AUX_TARGET(0); } } diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index c9fe1dd8ad..28d6d4eba5 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -841,8 +841,8 @@ static void emit_fb_write(struct brw_wm_compile *c, nr += 2; } - target = inst->Aux >> 1; - eot = inst->Aux & 1; + target = INST_AUX_GET_TARGET(inst->Aux); + eot = inst->Aux & INST_AUX_EOT; fire_fb_write(c, 0, nr, target, eot); } diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass0.c b/src/mesa/drivers/dri/i965/brw_wm_pass0.c index 6279258339..602b1351ef 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_pass0.c +++ b/src/mesa/drivers/dri/i965/brw_wm_pass0.c @@ -322,8 +322,8 @@ translate_insn(struct brw_wm_compile *c, out->tex_unit = inst->TexSrcUnit; out->tex_idx = inst->TexSrcTarget; out->tex_shadow = inst->TexShadow; - out->eot = inst->Aux & 1; - out->target = inst->Aux >> 1; + out->eot = inst->Aux & INST_AUX_EOT; + out->target = INST_AUX_GET_TARGET(inst->Aux); /* Args: */ -- cgit v1.2.3 From 9ef33b86855c4d000271774030bd1b19b6d79687 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 14:53:53 -0600 Subject: i965: don't use context state in emit_fb_write() Put the state that we care about in the hash key. Issue spotted by Keith Whitwell. --- src/mesa/drivers/dri/i965/brw_wm.c | 2 ++ src/mesa/drivers/dri/i965/brw_wm.h | 1 + src/mesa/drivers/dri/i965/brw_wm_fp.c | 4 ++-- 3 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 5a2ac1a651..eeb25980fa 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -325,6 +325,8 @@ static void brw_wm_populate_key( struct brw_context *brw, key->drawable_height = brw->intel.driDrawable->h; } + key->nr_color_regions = brw->state.nr_color_regions; + /* CACHE_NEW_VS_PROG */ key->vp_outputs_written = brw->vs.prog_data->outputs_written & DO_SETUP_BITS; diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index f13a958a44..d0f30607d0 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -67,6 +67,7 @@ struct brw_wm_prog_key { GLuint flat_shade:1; GLuint linear_color:1; /**< linear interpolation vs perspective interp */ GLuint runtime_check_aads_emit:1; + GLuint nr_color_regions:2; GLbitfield proj_attrib_mask; /**< one bit per fragment program attribute */ GLuint shadowtex_mask:16; diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index d33fd9abed..9a0aea872b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -968,8 +968,8 @@ static void emit_fb_write( struct brw_wm_compile *c ) /* The inst->Aux field is used for FB write target and the EOT marker */ - if (brw->state.nr_color_regions > 1) { - for (i = 0 ; i < brw->state.nr_color_regions; i++) { + if (c->key.nr_color_regions > 1) { + for (i = 0 ; i < c->key.nr_color_regions; i++) { outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DATA0 + i); last_inst = inst = emit_op(c, WM_FB_WRITE, dst_mask(dst_undef(), 0), 0, outcolor, payload_r0_depth, outdepth); -- cgit v1.2.3 From 7648c80ac8dd0631c5a0f86ad03347675a48eee6 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 15:00:18 -0600 Subject: i965: remove unused var --- src/mesa/drivers/dri/i965/brw_wm_fp.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index 9a0aea872b..53fdd06f42 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -964,7 +964,6 @@ static void emit_fb_write( struct brw_wm_compile *c ) GLuint i; struct prog_instruction *inst, *last_inst; - struct brw_context *brw = c->func.brw; /* The inst->Aux field is used for FB write target and the EOT marker */ -- cgit v1.2.3 From 198ec96d364dabd82952a451eeda7937db383f0d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 15:01:02 -0600 Subject: i965: define, use BRW_MAX_DRAW_BUFFERS i965 might support more than 4 color draw buffers. But if not, this protects from breakage if the Mesa limit is raised. --- src/mesa/drivers/dri/i965/brw_context.c | 1 + src/mesa/drivers/dri/i965/brw_context.h | 9 ++++++--- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index c300c33adc..48685c087b 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -105,6 +105,7 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis, TNL_CONTEXT(ctx)->Driver.RunPipeline = _tnl_run_pipeline; + ctx->Const.MaxDrawBuffers = BRW_MAX_DRAW_BUFFERS; ctx->Const.MaxTextureImageUnits = BRW_MAX_TEX_UNIT; ctx->Const.MaxTextureCoordUnits = 8; /* Mesa limit */ ctx->Const.MaxTextureUnits = MIN2(ctx->Const.MaxTextureCoordUnits, diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 7834569761..59f9475b5a 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -252,20 +252,23 @@ struct brw_vs_ouput_sizes { /** Number of texture sampler units */ #define BRW_MAX_TEX_UNIT 16 +/** Max number of render targets in a shader */ +#define BRW_MAX_DRAW_BUFFERS 4 + /** * Size of our surface binding table for the WM. * This contains pointers to the drawing surfaces and current texture * objects and shader constant buffers (+2). */ -#define BRW_WM_MAX_SURF (MAX_DRAW_BUFFERS + BRW_MAX_TEX_UNIT + 1) +#define BRW_WM_MAX_SURF (BRW_MAX_DRAW_BUFFERS + BRW_MAX_TEX_UNIT + 1) /** * Helpers to convert drawing buffers, textures and constant buffers * to surface binding table indexes, for WM. */ #define SURF_INDEX_DRAW(d) (d) -#define SURF_INDEX_FRAG_CONST_BUFFER (MAX_DRAW_BUFFERS) -#define SURF_INDEX_TEXTURE(t) (MAX_DRAW_BUFFERS + 1 + (t)) +#define SURF_INDEX_FRAG_CONST_BUFFER (BRW_MAX_DRAW_BUFFERS) +#define SURF_INDEX_TEXTURE(t) (BRW_MAX_DRAW_BUFFERS + 1 + (t)) /** * Size of surface binding table for the VS. 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 73ae06eea1..3b2c6a25be 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -709,7 +709,7 @@ static void prepare_wm_surfaces(struct brw_context *brw ) } old_nr_surfaces = brw->wm.nr_surfaces; - brw->wm.nr_surfaces = MAX_DRAW_BUFFERS; + brw->wm.nr_surfaces = BRW_MAX_DRAW_BUFFERS; if (brw->wm.surf_bo[SURF_INDEX_FRAG_CONST_BUFFER] != NULL) brw->wm.nr_surfaces = SURF_INDEX_FRAG_CONST_BUFFER + 1; -- cgit v1.2.3 From 861fec163c1ae7e431956db0a08989d841e2b74e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 15:29:41 -0600 Subject: i965: avoid shader translation on window resize If the fragment shader doesn't use FRAG_ATTRIB_WPOS (gl_FragCoord) we don't need to worry about the window size and origin in brw_wm_populate_key(). This avoids re-generating the i965 shader code when a window is resized. Issue spotted by Keith Whitwell. --- src/mesa/drivers/dri/i965/brw_wm.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index eeb25980fa..964ee104c2 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -308,6 +308,9 @@ static void brw_wm_populate_key( struct brw_context *brw, * from the incoming screen origin relative position we get as part of our * payload. * + * This is only needed for the WM_WPOSXY opcode when the fragment program + * uses the gl_FragCoord input. + * * We could avoid recompiling by including this as a constant referenced by * our program, but if we were to do that it would also be nice to handle * getting that constant updated at batchbuffer submit time (when we @@ -316,13 +319,15 @@ static void brw_wm_populate_key( struct brw_context *brw, * just avoid using this as key data if the program doesn't use * fragment.position. * - * This pretty much becomes moot with DRI2 and redirected buffers anyway, - * as our origins will always be zero then. + * For DRI2 the origin_x/y will always be (0,0) but we still need the + * drawable height in order to invert the Y axis. */ - if (brw->intel.driDrawable != NULL) { - key->origin_x = brw->intel.driDrawable->x; - key->origin_y = brw->intel.driDrawable->y; - key->drawable_height = brw->intel.driDrawable->h; + if (fp->program.Base.InputsRead & FRAG_BIT_WPOS) { + if (brw->intel.driDrawable != NULL) { + key->origin_x = brw->intel.driDrawable->x; + key->origin_y = brw->intel.driDrawable->y; + key->drawable_height = brw->intel.driDrawable->h; + } } key->nr_color_regions = brw->state.nr_color_regions; -- cgit v1.2.3 From 4b377ae292f75645ef356bd3bfac407230faf73a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 29 Oct 2009 13:35:03 -0700 Subject: i915: Correct and make use of the defines for 32-bit depth texture modes. Previously, S8_Z24 depth textures would always be treated as intensity. Fixes piglit depth-tex-modes. --- src/mesa/drivers/dri/i915/i915_reg.h | 6 +++--- src/mesa/drivers/dri/i915/i915_texstate.c | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_reg.h b/src/mesa/drivers/dri/i915/i915_reg.h index b5fa7fddb9..7f31ff674f 100644 --- a/src/mesa/drivers/dri/i915/i915_reg.h +++ b/src/mesa/drivers/dri/i915/i915_reg.h @@ -626,9 +626,9 @@ #define MT_32BIT_AWVU2101010 (0xA<<3) #define MT_32BIT_GR1616 (0xB<<3) #define MT_32BIT_VU1616 (0xC<<3) -#define MT_32BIT_xI824 (0xD<<3) -#define MT_32BIT_xA824 (0xE<<3) -#define MT_32BIT_xL824 (0xF<<3) +#define MT_32BIT_x8I24 (0xD<<3) +#define MT_32BIT_x8L24 (0xE<<3) +#define MT_32BIT_x8A24 (0xF<<3) #define MT_422_YCRCB_SWAPY (0<<3) /* SURFACE_422 */ #define MT_422_YCRCB_NORMAL (1<<3) #define MT_422_YCRCB_SWAPUV (2<<3) diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index 1397f04a59..0c29c558ec 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -82,7 +82,12 @@ translate_texture_format(gl_format mesa_format, GLuint internal_format, case MESA_FORMAT_RGBA_DXT5: return (MAPSURF_COMPRESSED | MT_COMPRESS_DXT4_5); case MESA_FORMAT_S8_Z24: - return (MAPSURF_32BIT | MT_32BIT_xI824); + if (DepthMode == GL_ALPHA) + return (MAPSURF_32BIT | MT_32BIT_x8A24); + else if (DepthMode == GL_INTENSITY) + return (MAPSURF_32BIT | MT_32BIT_x8I24); + else + return (MAPSURF_32BIT | MT_32BIT_x8L24); default: fprintf(stderr, "%s: bad image format %x\n", __FUNCTION__, mesa_format); abort(); -- cgit v1.2.3 From 8a9afe71b8d89a2a967cb37f5b5b00d86de387bc Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 29 Oct 2009 14:38:44 -0700 Subject: i915: Fix 1D texture mapping in the t coordinate. Fixes piglit tex1d-2dborder test. --- src/mesa/drivers/dri/i915/i915_texstate.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index 0c29c558ec..bea47f5af8 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -305,6 +305,12 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) GLenum wt = tObj->WrapT; GLenum wr = tObj->WrapR; + /* We program 1D textures as 2D textures, so the 2D texcoord could + * result in sampling border values if we don't set the T wrap to + * repeat. + */ + if (tObj->Target == GL_TEXTURE_1D) + wt = GL_REPEAT; /* 3D textures don't seem to respect the border color. * Fallback if there's ever a danger that they might refer to -- cgit v1.2.3 From 035b21f365f563cba9bf9b8cb4fef613ceb9d3ac Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 15:57:22 -0600 Subject: i965: make brw_wm_prog_key a little smaller GLushort is big enough for the swizzle and origin fields. The key could probably be made smaller still by re-ordering things. I'll hold off on that until after the outputswritten64 branch is merged. The key will get a little larger again with the GLbitfield64 fields. --- src/mesa/drivers/dri/i965/brw_wm.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index d0f30607d0..dd4644fc36 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -74,11 +74,11 @@ struct brw_wm_prog_key { GLuint yuvtex_mask:16; GLuint yuvtex_swap_mask:16; /* UV swaped */ - GLuint tex_swizzles[BRW_MAX_TEX_UNIT]; + GLushort tex_swizzles[BRW_MAX_TEX_UNIT]; GLuint program_string_id:32; - GLuint origin_x, origin_y; - GLuint drawable_height; + GLushort origin_x, origin_y; + GLushort drawable_height; GLuint vp_outputs_written; }; -- cgit v1.2.3 From 26d22b094bb7b2f37d4bc8edfeb1b2a9a1c96d88 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 16:02:35 -0600 Subject: i965: make brw_sf_prog_key::sprite_origin_lower_left one bit Shrinks size of key to 8 bytes from 12. Note that progs/demos/spriteblast.c is still broken. --- src/mesa/drivers/dri/i965/brw_sf.c | 2 +- src/mesa/drivers/dri/i965/brw_sf.h | 4 ++-- src/mesa/drivers/dri/i965/brw_sf_emit.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_sf.c b/src/mesa/drivers/dri/i965/brw_sf.c index e1c2c7777b..f350cbd74e 100644 --- a/src/mesa/drivers/dri/i965/brw_sf.c +++ b/src/mesa/drivers/dri/i965/brw_sf.c @@ -161,7 +161,7 @@ static void upload_sf_prog(struct brw_context *brw) } key.do_point_sprite = ctx->Point.PointSprite; - key.SpriteOrigin = ctx->Point.SpriteOrigin; + key.sprite_origin_lower_left = (ctx->Point.SpriteOrigin == GL_LOWER_LEFT); /* _NEW_LIGHT */ key.do_flat_shading = (ctx->Light.ShadeModel == GL_FLAT); key.do_twoside_color = (ctx->Light.Enabled && ctx->Light.Model.TwoSide); diff --git a/src/mesa/drivers/dri/i965/brw_sf.h b/src/mesa/drivers/dri/i965/brw_sf.h index 6426b6df9f..e415bbd775 100644 --- a/src/mesa/drivers/dri/i965/brw_sf.h +++ b/src/mesa/drivers/dri/i965/brw_sf.h @@ -52,8 +52,8 @@ struct brw_sf_prog_key { GLuint frontface_ccw:1; GLuint do_point_sprite:1; GLuint linear_color:1; /**< linear interp vs. perspective interp */ - GLuint pad:25; - GLenum SpriteOrigin; + GLuint sprite_origin_lower_left:1; + GLuint pad:24; }; struct brw_sf_point_tex { diff --git a/src/mesa/drivers/dri/i965/brw_sf_emit.c b/src/mesa/drivers/dri/i965/brw_sf_emit.c index ca8f97f9f9..561fcd501b 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_emit.c +++ b/src/mesa/drivers/dri/i965/brw_sf_emit.c @@ -551,7 +551,7 @@ void brw_emit_point_sprite_setup( struct brw_sf_compile *c, GLboolean allocate) BRW_MATH_DATA_SCALAR, BRW_MATH_PRECISION_FULL); - if (c->key.SpriteOrigin == GL_LOWER_LEFT) { + if (c->key.sprite_origin_lower_left) { brw_MUL(p, c->m1Cx, c->tmp, c->inv_w[0]); brw_MOV(p, vec1(suboffset(c->m1Cx, 1)), brw_imm_f(0.0)); brw_MUL(p, c->m2Cy, c->tmp, negate(c->inv_w[0])); @@ -570,7 +570,7 @@ void brw_emit_point_sprite_setup( struct brw_sf_compile *c, GLboolean allocate) { brw_set_predicate_control_flag_value(p, pc); if (tex->CoordReplace) { - if (c->key.SpriteOrigin == GL_LOWER_LEFT) { + if (c->key.sprite_origin_lower_left) { brw_MUL(p, c->m3C0, c->inv_w[0], brw_imm_f(1.0)); brw_MOV(p, vec1(suboffset(c->m3C0, 0)), brw_imm_f(0.0)); } -- cgit v1.2.3 From 217a40d8d92d377e73ed1ab5a326703fab779dd1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 16:06:30 -0600 Subject: i965: indentation fix --- src/mesa/drivers/dri/i965/brw_sf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_sf.h b/src/mesa/drivers/dri/i965/brw_sf.h index e415bbd775..e835229a1d 100644 --- a/src/mesa/drivers/dri/i965/brw_sf.h +++ b/src/mesa/drivers/dri/i965/brw_sf.h @@ -57,7 +57,7 @@ struct brw_sf_prog_key { }; struct brw_sf_point_tex { - GLboolean CoordReplace; + GLboolean CoordReplace; }; struct brw_sf_compile { -- cgit v1.2.3 From bde7874317bfbab284397bc611fc71263cbc0975 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 16:26:09 -0600 Subject: mesa: refactor _mesa_get_teximage() code Break different formats into different functions to make it easier to read. --- src/mesa/main/texgetimage.c | 460 +++++++++++++++++++++++++++++--------------- 1 file changed, 302 insertions(+), 158 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index fbd61d5ae6..3dff86feb1 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -85,9 +85,279 @@ type_with_negative_values(GLenum type) } +/** + * glGetTexImage for color index pixels. + */ +static void +get_tex_color_index(GLcontext *ctx, GLuint dimensions, + GLenum format, GLenum type, GLvoid *pixels, + const struct gl_texture_image *texImage) +{ + const GLint width = texImage->Width; + const GLint height = texImage->Height; + const GLint depth = texImage->Depth; + const GLuint indexBits = + _mesa_get_format_bits(texImage->TexFormat, GL_TEXTURE_INDEX_SIZE_EXT); + const GLbitfield transferOps = 0x0; + GLint img, row, col; + + for (img = 0; img < depth; img++) { + for (row = 0; row < height; row++) { + GLuint indexRow[MAX_WIDTH]; + void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels, + width, height, format, type, + img, row, 0); + assert(dest); + + if (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 (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, transferOps); + } + } +} + + +/** + * glGetTexImage for depth/Z pixels. + */ +static void +get_tex_depth(GLcontext *ctx, GLuint dimensions, + GLenum format, GLenum type, GLvoid *pixels, + const struct gl_texture_image *texImage) +{ + const GLint width = texImage->Width; + const GLint height = texImage->Height; + const GLint depth = texImage->Depth; + GLint img, row, col; + + for (img = 0; img < depth; img++) { + for (row = 0; row < height; row++) { + GLfloat depthRow[MAX_WIDTH]; + void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels, + width, height, format, type, + img, row, 0); + assert(dest); + + 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); + } + } +} + + +/** + * glGetTexImage for depth/stencil pixels. + */ +static void +get_tex_depth_stencil(GLcontext *ctx, GLuint dimensions, + GLenum format, GLenum type, GLvoid *pixels, + const struct gl_texture_image *texImage) +{ + const GLint width = texImage->Width; + const GLint height = texImage->Height; + const GLint depth = texImage->Depth; + const GLuint *src = (const GLuint *) texImage->Data; + GLint img, row; + + for (img = 0; img < depth; img++) { + for (row = 0; row < height; row++) { + void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels, + width, height, format, type, + img, row, 0); + _mesa_memcpy(dest, src, width * sizeof(GLuint)); + if (ctx->Pack.SwapBytes) { + _mesa_swap4((GLuint *) dest, width); + } + + src += width * row + width * height * img; + } + } +} + + +/** + * glGetTexImage for YCbCr pixels. + */ +static void +get_tex_ycbcr(GLcontext *ctx, GLuint dimensions, + GLenum format, GLenum type, GLvoid *pixels, + const struct gl_texture_image *texImage) +{ + const GLint width = texImage->Width; + const GLint height = texImage->Height; + const GLint depth = texImage->Depth; + const GLint rowstride = texImage->RowStride; + const GLushort *src = (const GLushort *) texImage->Data; + GLint img, row; + + for (img = 0; img < depth; img++) { + for (row = 0; row < height; row++) { + void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels, + width, height, format, type, + img, row, 0); + _mesa_memcpy(dest, src, width * sizeof(GLushort)); + + /* check for byte swapping */ + if ((texImage->TexFormat == MESA_FORMAT_YCBCR + && type == GL_UNSIGNED_SHORT_8_8_REV_MESA) || + (texImage->TexFormat == 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); + } + + src += rowstride; + } + } +} + + +/** + * glGetTexImagefor sRGB pixels; + */ +static void +get_tex_srgb(GLcontext *ctx, GLuint dimensions, + GLenum format, GLenum type, GLvoid *pixels, + const struct gl_texture_image *texImage) +{ + const GLint width = texImage->Width; + const GLint height = texImage->Height; + const GLint depth = texImage->Depth; + const GLbitfield transferOps = 0x0; + GLint img, row; + + for (img = 0; img < depth; img++) { + for (row = 0; row < height; row++) { + void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels, + width, height, format, type, + img, row, 0); + + GLfloat rgba[MAX_WIDTH][4]; + GLint col; + + /* convert row to RGBA format */ + 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); + } + } +} + + +/** + * glGetTexImagefor RGBA, Luminance, etc. pixels. + * This is the slow way since we use texture sampling. + */ +static void +get_tex_rgba(GLcontext *ctx, GLuint dimensions, + GLenum format, GLenum type, GLvoid *pixels, + const struct gl_texture_image *texImage) +{ + const GLint width = texImage->Width; + const GLint height = texImage->Height; + const GLint depth = texImage->Depth; + /* Normally, no pixel transfer ops are performed during glGetTexImage. + * The only possible exception is component clamping to [0,1]. + */ + GLbitfield transferOps = 0x0; + GLint img, row; + + for (img = 0; img < depth; img++) { + for (row = 0; row < height; row++) { + void *dest = _mesa_image_address(dimensions, &ctx->Pack, pixels, + width, height, format, type, + img, row, 0); + GLfloat rgba[MAX_WIDTH][4]; + GLint col; + GLenum dataType = _mesa_get_format_datatype(texImage->TexFormat); + + /* 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) && + (dataType == GL_FLOAT || + 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.0F; + rgba[col][GCOMP] = 0.0F; + rgba[col][BCOMP] = 0.0F; + } + else if (texImage->_BaseFormat == GL_LUMINANCE) { + rgba[col][GCOMP] = 0.0F; + rgba[col][BCOMP] = 0.0F; + rgba[col][ACOMP] = 1.0F; + } + else if (texImage->_BaseFormat == GL_LUMINANCE_ALPHA) { + rgba[col][GCOMP] = 0.0F; + rgba[col][BCOMP] = 0.0F; + } + else if (texImage->_BaseFormat == GL_INTENSITY) { + rgba[col][GCOMP] = 0.0F; + rgba[col][BCOMP] = 0.0F; + rgba[col][ACOMP] = 1.0F; + } + } + _mesa_pack_rgba_span_float(ctx, width, (GLfloat (*)[4]) rgba, + format, type, dest, + &ctx->Pack, transferOps); + } + } +} + + /** * This is the software fallback for Driver.GetTexImage(). * All error checking will have been done before this routine is called. + * The texture image must be mapped. */ void _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, @@ -95,7 +365,21 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - const GLuint dimensions = (target == GL_TEXTURE_3D) ? 3 : 2; + GLuint dimensions; + + /* If we get here, the texture image should be mapped */ + assert(texImage->Data); + + switch (target) { + case GL_TEXTURE_1D: + dimensions = 1; + break; + case GL_TEXTURE_3D: + dimensions = 3; + break; + default: + dimensions = 2; + } if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { /* Packing texture image into a PBO. @@ -118,163 +402,23 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, pixels = ADD_POINTERS(buf, pixels); } - { - 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; - GLuint indexBits = _mesa_get_format_bits(texImage->TexFormat, GL_TEXTURE_INDEX_SIZE_EXT); - /* Can't use FetchTexel here because that returns RGBA */ - if (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 (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 == MESA_FORMAT_YCBCR - && type == GL_UNSIGNED_SHORT_8_8_REV_MESA) || - (texImage->TexFormat == 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 (_mesa_get_format_color_encoding(texImage->TexFormat) - == GL_SRGB) { - /* 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; - GLenum dataType = - _mesa_get_format_datatype(texImage->TexFormat); - - /* 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) && - (dataType == GL_FLOAT || - 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 (format == GL_COLOR_INDEX) { + get_tex_color_index(ctx, dimensions, format, type, pixels, texImage); + } + else if (format == GL_DEPTH_COMPONENT) { + get_tex_depth(ctx, dimensions, format, type, pixels, texImage); + } + else if (format == GL_DEPTH_STENCIL_EXT) { + get_tex_depth_stencil(ctx, dimensions, format, type, pixels, texImage); + } + else if (format == GL_YCBCR_MESA) { + get_tex_ycbcr(ctx, dimensions, format, type, pixels, texImage); + } + else if (_mesa_get_format_color_encoding(texImage->TexFormat) == GL_SRGB) { + get_tex_srgb(ctx, dimensions, format, type, pixels, texImage); + } + else { + get_tex_rgba(ctx, dimensions, format, type, pixels, texImage); } if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { -- cgit v1.2.3 From fcbf66364032743abeb41a82a5ceaf68a15d900f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 16:29:31 -0600 Subject: mesa: lift memcpy_get_tex_image() code from intel driver into core Mesa The code should work for any driver. --- src/mesa/main/texgetimage.c | 84 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 83 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 3dff86feb1..10c6947c37 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -354,6 +354,85 @@ get_tex_rgba(GLcontext *ctx, GLuint dimensions, } +/** + * Try to do glGetTexImage() with simple memcpy(). + * \return GL_TRUE if done, GL_FALSE otherwise + */ +static GLboolean +get_tex_memcpy(GLcontext *ctx, GLenum format, GLenum type, GLvoid *pixels, + const struct gl_texture_object *texObj, + const struct gl_texture_image *texImage) +{ + GLboolean memCopy = GL_FALSE; + + /* Texture image should have been mapped already */ + assert(texImage->Data); + + /* + * Check if the src/dst formats are compatible. + * Also note that GL's pixel transfer ops don't apply to glGetTexImage() + * so we don't have to worry about those. + * XXX more format combinations could be supported here. + */ + if ((texObj->Target == GL_TEXTURE_1D || + texObj->Target == GL_TEXTURE_2D || + texObj->Target == GL_TEXTURE_RECTANGLE || + (texObj->Target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && + texObj->Target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) { + if (texImage->TexFormat == MESA_FORMAT_ARGB8888 && + format == GL_BGRA && + type == GL_UNSIGNED_BYTE && + !ctx->Pack.SwapBytes && + _mesa_little_endian()) { + memCopy = GL_TRUE; + } + else if (texImage->TexFormat == MESA_FORMAT_AL88 && + format == GL_LUMINANCE_ALPHA && + type == GL_UNSIGNED_BYTE && + !ctx->Pack.SwapBytes && + _mesa_little_endian()) { + memCopy = GL_TRUE; + } + else if (texImage->TexFormat == MESA_FORMAT_L8 && + format == GL_LUMINANCE && + type == GL_UNSIGNED_BYTE) { + memCopy = GL_TRUE; + } + else if (texImage->TexFormat == MESA_FORMAT_A8 && + format == GL_ALPHA && + type == GL_UNSIGNED_BYTE) { + memCopy = GL_TRUE; + } + } + + if (memCopy) { + const GLuint bpp = _mesa_get_format_bytes(texImage->TexFormat); + const GLuint bytesPerRow = texImage->Width * bpp; + GLubyte *dst = + _mesa_image_address2d(&ctx->Pack, pixels, texImage->Width, + texImage->Height, format, type, 0, 0); + const GLint dstRowStride = + _mesa_image_row_stride(&ctx->Pack, texImage->Width, format, type); + const GLubyte *src = texImage->Data; + const GLint srcRowStride = texImage->RowStride * bpp; + GLuint row; + + if (bytesPerRow == dstRowStride && bytesPerRow == srcRowStride) { + memcpy(dst, src, bytesPerRow * texImage->Height); + } + else { + for (row = 0; row < texImage->Height; row++) { + memcpy(dst, src, bytesPerRow); + dst += dstRowStride; + src += srcRowStride; + } + } + } + + return memCopy; +} + + /** * This is the software fallback for Driver.GetTexImage(). * All error checking will have been done before this routine is called. @@ -402,7 +481,10 @@ _mesa_get_teximage(GLcontext *ctx, GLenum target, GLint level, pixels = ADD_POINTERS(buf, pixels); } - if (format == GL_COLOR_INDEX) { + if (get_tex_memcpy(ctx, format, type, pixels, texObj, texImage)) { + /* all done */ + } + else if (format == GL_COLOR_INDEX) { get_tex_color_index(ctx, dimensions, format, type, pixels, texImage); } else if (format == GL_DEPTH_COMPONENT) { -- cgit v1.2.3 From d0b6147291fe42d7d733b3d0e5b10c4f4f08030f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 16:30:36 -0600 Subject: intel: remove memcpy_get_tex_image() code This has been lifted into core Mesa where it can be used for all drivers that use the _mesa_get_teximage() fallback for ctx->Driver.GetTexImage(). --- src/mesa/drivers/dri/intel/intel_tex_image.c | 105 +-------------------------- 1 file changed, 2 insertions(+), 103 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 6301444c34..3dce1b0a87 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -619,104 +619,6 @@ intelCompressedTexImage2D( GLcontext *ctx, GLenum target, GLint level, } -/** - * Try to use memcpy() to do a glGetTexImage(). - * \return GL_TRUE if done, GL_FALSE otherwise - */ -static GLboolean -memcpy_get_tex_image(GLcontext *ctx, GLenum target, GLint level, - GLenum format, GLenum type, GLvoid * pixels, - struct gl_texture_object *texObj, - struct gl_texture_image *texImage) -{ - GLboolean memCopy = GL_FALSE; - - /* Texture image should have been mapped already */ - assert(texImage->Data); - - /* - * Check if the src/dst formats are compatible. - * Also note that GL's pixel transfer ops don't apply to glGetTexImage() - * so we don't have to worry about those. - */ - if ((texObj->Target == GL_TEXTURE_1D || - texObj->Target == GL_TEXTURE_2D || - texObj->Target == GL_TEXTURE_RECTANGLE || - (texObj->Target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && - texObj->Target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z))) { - if (texImage->TexFormat == MESA_FORMAT_ARGB8888 && - format == GL_BGRA && - type == GL_UNSIGNED_BYTE && - _mesa_little_endian()) { - memCopy = GL_TRUE; - } - else if (texImage->TexFormat == MESA_FORMAT_AL88 && - format == GL_LUMINANCE_ALPHA && - type == GL_UNSIGNED_BYTE && - _mesa_little_endian()) { - memCopy = GL_TRUE; - } - else if (texImage->TexFormat == MESA_FORMAT_L8 && - format == GL_LUMINANCE && - type == GL_UNSIGNED_BYTE) { - memCopy = GL_TRUE; - } - else if (texImage->TexFormat == MESA_FORMAT_A8 && - format == GL_ALPHA && - type == GL_UNSIGNED_BYTE) { - memCopy = GL_TRUE; - } - } - - if (memCopy) { - struct gl_pixelstore_attrib *pack = &ctx->Pack; - - if (_mesa_is_bufferobj(pack->BufferObj)) { - /* Packing texture image into a PBO */ - GLubyte *buf = (GLubyte *) - ctx->Driver.MapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, - GL_WRITE_ONLY_ARB, pack->BufferObj); - if (!buf) { - /* out of memory or other unexpected error */ - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glGetTexImage(map PBO failed)"); - return GL_TRUE; /* failed, but done */ - } - pixels = ADD_POINTERS(buf, pixels); - } - - { - const GLuint bpp = _mesa_get_format_bytes(texImage->TexFormat); - const GLuint bytesPerRow = texImage->Width * bpp; - GLubyte *dst = - _mesa_image_address2d(&ctx->Pack, pixels, texImage->Width, - texImage->Height, format, type, 0, 0); - const GLint dstRowStride = - _mesa_image_row_stride(&ctx->Pack, texImage->Width, format, type); - const GLubyte *src = texImage->Data; - const GLint srcRowStride = texImage->RowStride * bpp; - GLuint row; - - if (bytesPerRow == dstRowStride && bytesPerRow == dstRowStride) { - memcpy(dst, src, bytesPerRow * texImage->Height); - } - else { - for (row = 0; row < texImage->Height; row++) { - memcpy(dst, src, bytesPerRow); - dst += dstRowStride; - src += srcRowStride; - } - } - } - - if (_mesa_is_bufferobj(pack->BufferObj)) { - ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, pack->BufferObj); - } - } - - return memCopy; -} - - /** * Need to map texture image into memory before copying image data, * then unmap it. @@ -768,11 +670,8 @@ intel_get_tex_image(GLcontext * ctx, GLenum target, GLint level, texObj, texImage); } else { - if (!memcpy_get_tex_image(ctx, target, level, format, type, pixels, - texObj, texImage)) { - _mesa_get_teximage(ctx, target, level, format, type, pixels, - texObj, texImage); - } + _mesa_get_teximage(ctx, target, level, format, type, pixels, + texObj, texImage); } -- cgit v1.2.3 From b924579bd4afaf5daa9df8d4f120f42fa20cafc6 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Thu, 29 Oct 2009 19:42:12 -0400 Subject: r600: Add support for ARB_depth_clamp --- src/mesa/drivers/dri/r600/r600_context.c | 1 + src/mesa/drivers/dri/r600/r700_state.c | 15 +++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index 6de151d51b..dbd233729c 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -94,6 +94,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. static const struct dri_extension card_extensions[] = { /* *INDENT-OFF* */ + {"GL_ARB_depth_clamp", NULL}, {"GL_ARB_depth_texture", NULL}, {"GL_ARB_fragment_program", NULL}, {"GL_ARB_occlusion_query", GL_ARB_occlusion_query_functions}, diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index 2b42bfa3f9..b278887266 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -1030,6 +1030,7 @@ static void r700UpdateWindow(GLcontext * ctx, int id) //-------------------- GLfloat tz = v[MAT_TZ] * depthScale; R600_STATECHANGE(context, vpt); + R600_STATECHANGE(context, cl); r700->viewport[id].PA_CL_VPORT_XSCALE.f32All = sx; r700->viewport[id].PA_CL_VPORT_XOFFSET.f32All = tx; @@ -1040,6 +1041,18 @@ static void r700UpdateWindow(GLcontext * ctx, int id) //-------------------- r700->viewport[id].PA_CL_VPORT_ZSCALE.f32All = sz; r700->viewport[id].PA_CL_VPORT_ZOFFSET.f32All = tz; + if (ctx->Transform.DepthClamp) { + r700->viewport[id].PA_SC_VPORT_ZMIN_0.f32All = MIN2(ctx->Viewport.Near, ctx->Viewport.Far); + r700->viewport[id].PA_SC_VPORT_ZMAX_0.f32All = MAX2(ctx->Viewport.Near, ctx->Viewport.Far); + SETbit(r700->PA_CL_CLIP_CNTL.u32All, ZCLIP_NEAR_DISABLE_bit); + SETbit(r700->PA_CL_CLIP_CNTL.u32All, ZCLIP_FAR_DISABLE_bit); + } else { + r700->viewport[id].PA_SC_VPORT_ZMIN_0.f32All = 0.0; + r700->viewport[id].PA_SC_VPORT_ZMAX_0.f32All = 1.0; + CLEARbit(r700->PA_CL_CLIP_CNTL.u32All, ZCLIP_NEAR_DISABLE_bit); + CLEARbit(r700->PA_CL_CLIP_CNTL.u32All, ZCLIP_FAR_DISABLE_bit); + } + r700->viewport[id].enabled = GL_TRUE; r700SetScissor(context); @@ -1345,8 +1358,6 @@ void r700SetScissor(context_t *context) //--------------- SETfield(r700->viewport[id].PA_SC_VPORT_SCISSOR_0_BR.u32All, y2, PA_SC_VPORT_SCISSOR_0_BR__BR_Y_shift, PA_SC_VPORT_SCISSOR_0_BR__BR_Y_mask); - r700->viewport[id].PA_SC_VPORT_ZMIN_0.u32All = 0; - r700->viewport[id].PA_SC_VPORT_ZMAX_0.u32All = 0x3F800000; r700->viewport[id].enabled = GL_TRUE; } -- cgit v1.2.3 From c243e8dd23e8827afe926ec6314ffdfa15b3f7ab Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Thu, 29 Oct 2009 19:44:35 -0400 Subject: r600: remove the no rrb messages --- src/mesa/drivers/dri/r600/r700_chip.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index ace3d24f06..47b38d2e36 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -358,7 +358,6 @@ static void r700SendDepthTargetState(GLcontext *ctx, struct radeon_state_atom *a rrb = radeon_get_depthbuffer(&context->radeon); if (!rrb || !rrb->bo) { - fprintf(stderr, "no rrb\n"); return; } @@ -400,7 +399,6 @@ static void r700SendRenderTargetState(GLcontext *ctx, struct radeon_state_atom * rrb = radeon_get_colorbuffer(&context->radeon); if (!rrb || !rrb->bo) { - fprintf(stderr, "no rrb\n"); return; } -- cgit v1.2.3 From f920d496e1b5b01a3ba9bcd7dcff5c19bc109da2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 17:49:50 -0600 Subject: mesa: fix _mesa_texstore_argb8888() for MESA_FORMAT_XRGB8888 If we hit the general path and call _mesa_make_temp_chan_image() we always want to get a GL_RGBA texture. We were getting a 3-channel GL_RGB texture before and that messed up the memory layout. --- src/mesa/main/texstore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 14cad6b32f..e48d472061 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1406,7 +1406,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + const GLenum baseFormat = GL_RGBA; ASSERT(dstFormat == MESA_FORMAT_ARGB8888 || dstFormat == MESA_FORMAT_ARGB8888_REV || -- cgit v1.2.3 From 4a253431abf43a0638afb43605b44a8742b72a60 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 29 Oct 2009 19:12:50 -0600 Subject: intel: update intel_create_renderbuffer(format), add XRGB support Pass a gl_format to intel_create_renderbuffer() instead of GLenum. Add cases for MESA_FORMAT_XRGB8888 textures and renderbuffers. However, we don't yet create any renderbuffers or textures with that format. It seems the default alpha value is zero instead of one. Need to investigate that first. --- src/mesa/drivers/dri/i915/i830_texstate.c | 2 ++ src/mesa/drivers/dri/i915/i830_vtbl.c | 1 + src/mesa/drivers/dri/i915/i915_texstate.c | 2 ++ src/mesa/drivers/dri/i915/i915_vtbl.c | 1 + src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 7 ++++ src/mesa/drivers/dri/intel/intel_blit.c | 1 + src/mesa/drivers/dri/intel/intel_fbo.c | 44 +++++++++--------------- src/mesa/drivers/dri/intel/intel_fbo.h | 2 +- src/mesa/drivers/dri/intel/intel_pixel_draw.c | 2 +- src/mesa/drivers/dri/intel/intel_screen.c | 14 ++++---- src/mesa/drivers/dri/intel/intel_span.c | 15 ++++++++ src/mesa/drivers/dri/intel/intel_tex_format.c | 2 ++ 12 files changed, 57 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index 28263fbe3c..f4bbb53b86 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -59,6 +59,8 @@ translate_texture_format(GLuint mesa_format, GLuint internal_format) return MAPSURF_32BIT | MT_32BIT_XRGB8888; else return MAPSURF_32BIT | MT_32BIT_ARGB8888; + case MESA_FORMAT_XRGB8888: + return MAPSURF_32BIT | MT_32BIT_XRGB8888; case MESA_FORMAT_YCBCR_REV: return (MAPSURF_422 | MT_422_YCRCB_NORMAL); case MESA_FORMAT_YCBCR: diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index 22f8bc7f19..4133696129 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -647,6 +647,7 @@ i830_state_draw_region(struct intel_context *intel, if (irb != NULL) { switch (irb->texformat) { case MESA_FORMAT_ARGB8888: + case MESA_FORMAT_XRGB8888: value |= DV_PF_8888; break; case MESA_FORMAT_RGB565: diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index bea47f5af8..d6689af53f 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -60,6 +60,8 @@ translate_texture_format(gl_format mesa_format, GLuint internal_format, return MAPSURF_32BIT | MT_32BIT_XRGB8888; else return MAPSURF_32BIT | MT_32BIT_ARGB8888; + case MESA_FORMAT_XRGB8888: + return MAPSURF_32BIT | MT_32BIT_XRGB8888; case MESA_FORMAT_YCBCR_REV: return (MAPSURF_422 | MT_422_YCRCB_NORMAL); case MESA_FORMAT_YCBCR: diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index d84df1a142..3c1b2dd0b0 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -589,6 +589,7 @@ i915_state_draw_region(struct intel_context *intel, if (irb != NULL) { switch (irb->texformat) { case MESA_FORMAT_ARGB8888: + case MESA_FORMAT_XRGB8888: value |= DV_PF_8888; break; case MESA_FORMAT_RGB565: 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 3b2c6a25be..0bf735c0f2 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -96,7 +96,11 @@ static GLuint translate_tex_format( gl_format mesa_format, else return BRW_SURFACEFORMAT_B8G8R8A8_UNORM; + case MESA_FORMAT_XRGB8888: + return BRW_SURFACEFORMAT_B8G8R8X8_UNORM; + case MESA_FORMAT_RGBA8888_REV: + _mesa_problem(NULL, "unexpected format in i965:translate_tex_format()"); if (internal_format == GL_RGB) return BRW_SURFACEFORMAT_R8G8B8X8_UNORM; else @@ -531,6 +535,9 @@ brw_update_renderbuffer_surface(struct brw_context *brw, case MESA_FORMAT_ARGB8888: key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; break; + case MESA_FORMAT_XRGB8888: + key.surface_format = BRW_SURFACEFORMAT_B8G8R8X8_UNORM; + break; case MESA_FORMAT_RGB565: key.surface_format = BRW_SURFACEFORMAT_B5G6R5_UNORM; break; diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index 55d97a0f76..817223da41 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -498,6 +498,7 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) switch (irb->texformat) { case MESA_FORMAT_ARGB8888: + case MESA_FORMAT_XRGB8888: clearVal = intel->ClearColor8888; break; case MESA_FORMAT_RGB565: diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index d006389f5a..9c780d40cc 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -292,7 +292,7 @@ intel_renderbuffer_set_region(struct intel_renderbuffer *rb, * not a user-created renderbuffer. */ struct intel_renderbuffer * -intel_create_renderbuffer(GLenum intFormat) +intel_create_renderbuffer(gl_format format) { GET_CURRENT_CONTEXT(ctx); @@ -308,48 +308,30 @@ intel_create_renderbuffer(GLenum intFormat) _mesa_init_renderbuffer(&irb->Base, name); irb->Base.ClassID = INTEL_RB_CLASS; - switch (intFormat) { - case GL_RGB5: - irb->Base.Format = MESA_FORMAT_RGB565; + switch (format) { + case MESA_FORMAT_RGB565: irb->Base._BaseFormat = GL_RGB; irb->Base.DataType = GL_UNSIGNED_BYTE; - irb->texformat = MESA_FORMAT_RGB565; break; - case GL_RGB8: - irb->Base.Format = MESA_FORMAT_ARGB8888; /* XXX: NEED XRGB8888 */ + case MESA_FORMAT_XRGB8888: irb->Base._BaseFormat = GL_RGB; irb->Base.DataType = GL_UNSIGNED_BYTE; - irb->texformat = MESA_FORMAT_ARGB8888; /* XXX: NEED XRGB8888 */ break; - case GL_RGBA8: - irb->Base.Format = MESA_FORMAT_ARGB8888; + case MESA_FORMAT_ARGB8888: irb->Base._BaseFormat = GL_RGBA; irb->Base.DataType = GL_UNSIGNED_BYTE; - irb->texformat = MESA_FORMAT_ARGB8888; - break; - case GL_STENCIL_INDEX8_EXT: - irb->Base.Format = MESA_FORMAT_S8_Z24; - irb->Base._BaseFormat = GL_STENCIL_INDEX; - irb->Base.DataType = GL_UNSIGNED_BYTE; - irb->texformat = MESA_FORMAT_S8_Z24; break; - case GL_DEPTH_COMPONENT16: - irb->Base.Format = MESA_FORMAT_Z16; + case MESA_FORMAT_Z16: irb->Base._BaseFormat = GL_DEPTH_COMPONENT; irb->Base.DataType = GL_UNSIGNED_SHORT; - irb->texformat = MESA_FORMAT_Z16; break; - case GL_DEPTH_COMPONENT24: - irb->Base.Format = MESA_FORMAT_S8_Z24; + case MESA_FORMAT_X8_Z24: irb->Base._BaseFormat = GL_DEPTH_COMPONENT; irb->Base.DataType = GL_UNSIGNED_INT; - irb->texformat = MESA_FORMAT_S8_Z24; break; - case GL_DEPTH24_STENCIL8_EXT: - irb->Base.Format = MESA_FORMAT_S8_Z24; + case MESA_FORMAT_S8_Z24: irb->Base._BaseFormat = GL_DEPTH_STENCIL; irb->Base.DataType = GL_UNSIGNED_INT_24_8_EXT; - irb->texformat = MESA_FORMAT_S8_Z24; break; default: _mesa_problem(NULL, @@ -358,7 +340,10 @@ intel_create_renderbuffer(GLenum intFormat) return NULL; } - irb->Base.InternalFormat = intFormat; + assert(irb->Base._BaseFormat == _mesa_get_format_base_format(format)); + irb->Base.Format = format; + irb->Base.InternalFormat = irb->Base._BaseFormat; + irb->texformat = format; /* intel-specific methods */ irb->Base.Delete = intel_delete_renderbuffer; @@ -442,6 +427,10 @@ intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb, irb->Base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGBA8 texture OK\n"); } + else if (texImage->TexFormat == MESA_FORMAT_XRGB8888) { + irb->Base.DataType = GL_UNSIGNED_BYTE; + DBG("Render to XGBA8 texture OK\n"); + } else if (texImage->TexFormat == MESA_FORMAT_RGB565) { irb->Base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGB5 texture OK\n"); @@ -644,6 +633,7 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) switch (irb->texformat) { case MESA_FORMAT_ARGB8888: + case MESA_FORMAT_XRGB8888: case MESA_FORMAT_RGB565: case MESA_FORMAT_ARGB1555: case MESA_FORMAT_ARGB4444: diff --git a/src/mesa/drivers/dri/intel/intel_fbo.h b/src/mesa/drivers/dri/intel/intel_fbo.h index e0584e3494..50a8a95985 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.h +++ b/src/mesa/drivers/dri/intel/intel_fbo.h @@ -115,7 +115,7 @@ intel_renderbuffer_set_region(struct intel_renderbuffer *irb, extern struct intel_renderbuffer * -intel_create_renderbuffer(GLenum intFormat); +intel_create_renderbuffer(gl_format format); extern void diff --git a/src/mesa/drivers/dri/intel/intel_pixel_draw.c b/src/mesa/drivers/dri/intel/intel_pixel_draw.c index 5ffa847fd4..9b382e3622 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_draw.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_draw.c @@ -169,7 +169,7 @@ intel_stencil_drawpixels(GLcontext * ctx, * buffer. */ depth_irb = intel_get_renderbuffer(ctx->DrawBuffer, BUFFER_DEPTH); - irb = intel_create_renderbuffer(GL_RGBA8); + irb = intel_create_renderbuffer(MESA_FORMAT_ARGB8888); rb = &irb->Base; irb->Base.Width = depth_irb->Base.Width; irb->Base.Height = depth_irb->Base.Height; diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 41342ddcae..62c322b4ed 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -349,7 +349,7 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv, else { GLboolean swStencil = (mesaVis->stencilBits > 0 && mesaVis->depthBits != 24); - GLenum rgbFormat; + gl_format rgbFormat; struct intel_framebuffer *intel_fb = CALLOC_STRUCT(intel_framebuffer); @@ -359,11 +359,11 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv, _mesa_initialize_framebuffer(&intel_fb->Base, mesaVis); if (mesaVis->redBits == 5) - rgbFormat = GL_RGB5; + rgbFormat = MESA_FORMAT_RGB565; else if (mesaVis->alphaBits == 0) - rgbFormat = GL_RGB8; + rgbFormat = MESA_FORMAT_ARGB8888; /* XXX change to XRGB someday */ else - rgbFormat = GL_RGBA8; + rgbFormat = MESA_FORMAT_ARGB8888; /* setup the hardware-based renderbuffers */ intel_fb->color_rb[0] = intel_create_renderbuffer(rgbFormat); @@ -382,7 +382,7 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv, if (mesaVis->stencilBits == 8) { /* combined depth/stencil buffer */ struct intel_renderbuffer *depthStencilRb - = intel_create_renderbuffer(GL_DEPTH24_STENCIL8_EXT); + = intel_create_renderbuffer(MESA_FORMAT_S8_Z24); /* note: bind RB to two attachment points */ _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH, &depthStencilRb->Base); @@ -390,7 +390,7 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv, &depthStencilRb->Base); } else { struct intel_renderbuffer *depthRb - = intel_create_renderbuffer(GL_DEPTH_COMPONENT24); + = intel_create_renderbuffer(MESA_FORMAT_X8_Z24); _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH, &depthRb->Base); } @@ -398,7 +398,7 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv, else if (mesaVis->depthBits == 16) { /* just 16-bit depth buffer, no hw stencil */ struct intel_renderbuffer *depthRb - = intel_create_renderbuffer(GL_DEPTH_COMPONENT16); + = intel_create_renderbuffer(MESA_FORMAT_Z16); _mesa_add_renderbuffer(&intel_fb->Base, BUFFER_DEPTH, &depthRb->Base); } diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index a36c077fbd..b0484a9959 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -651,8 +651,23 @@ intel_set_span_functions(struct intel_context *intel, break; } break; + case MESA_FORMAT_XRGB8888: + switch (tiling) { + case I915_TILING_NONE: + default: + intelInitPointers_xRGB8888(rb); + break; + case I915_TILING_X: + intel_XTile_InitPointers_xRGB8888(rb); + break; + case I915_TILING_Y: + intel_YTile_InitPointers_xRGB8888(rb); + break; + } + break; case MESA_FORMAT_ARGB8888: if (0 /*rb->AlphaBits == 0*/) { /* XXX: Need xRGB8888 Mesa format */ + /* XXX remove this code someday when we enable XRGB surfaces */ /* 8888 RGBx */ switch (tiling) { case I915_TILING_NONE: diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c index eca0f6d572..f37a545c7f 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_format.c +++ b/src/mesa/drivers/dri/intel/intel_tex_format.c @@ -50,6 +50,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) { return MESA_FORMAT_RGB565; } + /* XXX use MESA_FORMAT_XRGB8888 someday */ return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565; case GL_RGBA8: @@ -69,6 +70,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_RGB10: case GL_RGB12: case GL_RGB16: + /* XXX use MESA_FORMAT_XRGB8888 someday */ return MESA_FORMAT_ARGB8888; case GL_RGB5: -- cgit v1.2.3 From ca9c413647bf9efb5ed770e3a655bc758075aec7 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 30 Oct 2009 08:03:10 +0000 Subject: softpipe: Respect gl_rasterization_rules in primitive setup. --- src/gallium/drivers/softpipe/sp_setup.c | 40 +++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_setup.c b/src/gallium/drivers/softpipe/sp_setup.c index 00fb52a64f..615581b95f 100644 --- a/src/gallium/drivers/softpipe/sp_setup.c +++ b/src/gallium/drivers/softpipe/sp_setup.c @@ -87,6 +87,8 @@ struct setup_context { float oneoverarea; int facing; + float pixel_offset; + struct quad_header quad[MAX_QUADS]; struct quad_header *quad_ptrs[MAX_QUADS]; unsigned count; @@ -379,6 +381,16 @@ static boolean setup_sort_vertices( struct setup_context *setup, ((det > 0.0) ^ (setup->softpipe->rasterizer->front_winding == PIPE_WINDING_CW)); + /* Prepare pixel offset for rasterisation: + * - pixel center (0.5, 0.5) for GL, or + * - assume (0.0, 0.0) for other APIs. + */ + if (setup->softpipe->rasterizer->gl_rasterization_rules) { + setup->pixel_offset = 0.5f; + } else { + setup->pixel_offset = 0.0f; + } + return TRUE; } @@ -427,7 +439,7 @@ static void tri_linear_coeff( struct setup_context *setup, /* calculate a0 as the value which would be sampled for the * fragment at (0,0), taking into account that we want to sample at - * pixel centers, in other words (0.5, 0.5). + * pixel centers, in other words (pixel_offset, pixel_offset). * * this is neat but unfortunately not a good way to do things for * triangles with very large values of dadx or dady as it will @@ -438,8 +450,8 @@ static void tri_linear_coeff( struct setup_context *setup, * instead - i'll switch to this later. */ coef->a0[i] = (setup->vmin[vertSlot][i] - - (dadx * (setup->vmin[0][0] - 0.5f) + - dady * (setup->vmin[0][1] - 0.5f))); + (dadx * (setup->vmin[0][0] - setup->pixel_offset) + + dady * (setup->vmin[0][1] - setup->pixel_offset))); /* debug_printf("attr[%d].%c: %f dx:%f dy:%f\n", @@ -487,8 +499,8 @@ static void tri_persp_coeff( struct setup_context *setup, coef->dadx[i] = dadx; coef->dady[i] = dady; coef->a0[i] = (mina - - (dadx * (setup->vmin[0][0] - 0.5f) + - dady * (setup->vmin[0][1] - 0.5f))); + (dadx * (setup->vmin[0][0] - setup->pixel_offset) + + dady * (setup->vmin[0][1] - setup->pixel_offset))); } @@ -575,12 +587,12 @@ static void setup_tri_coefficients( struct setup_context *setup ) static void setup_tri_edges( struct setup_context *setup ) { - float vmin_x = setup->vmin[0][0] + 0.5f; - float vmid_x = setup->vmid[0][0] + 0.5f; + float vmin_x = setup->vmin[0][0] + setup->pixel_offset; + float vmid_x = setup->vmid[0][0] + setup->pixel_offset; - float vmin_y = setup->vmin[0][1] - 0.5f; - float vmid_y = setup->vmid[0][1] - 0.5f; - float vmax_y = setup->vmax[0][1] - 0.5f; + float vmin_y = setup->vmin[0][1] - setup->pixel_offset; + float vmid_y = setup->vmid[0][1] - setup->pixel_offset; + float vmax_y = setup->vmax[0][1] - setup->pixel_offset; setup->emaj.sy = ceilf(vmin_y); setup->emaj.lines = (int) ceilf(vmax_y - setup->emaj.sy); @@ -780,8 +792,8 @@ line_linear_coeff(const struct setup_context *setup, coef->dadx[i] = dadx; coef->dady[i] = dady; coef->a0[i] = (setup->vmin[vertSlot][i] - - (dadx * (setup->vmin[0][0] - 0.5f) + - dady * (setup->vmin[0][1] - 0.5f))); + (dadx * (setup->vmin[0][0] - setup->pixel_offset) + + dady * (setup->vmin[0][1] - setup->pixel_offset))); } @@ -803,8 +815,8 @@ line_persp_coeff(const struct setup_context *setup, coef->dadx[i] = dadx; coef->dady[i] = dady; coef->a0[i] = (setup->vmin[vertSlot][i] - - (dadx * (setup->vmin[0][0] - 0.5f) + - dady * (setup->vmin[0][1] - 0.5f))); + (dadx * (setup->vmin[0][0] - setup->pixel_offset) + + dady * (setup->vmin[0][1] - setup->pixel_offset))); } -- cgit v1.2.3 From 35506dec6734a1ae777dc16981cb19e514f41897 Mon Sep 17 00:00:00 2001 From: Chow Loong Jin Date: Wed, 28 Oct 2009 14:34:14 +0800 Subject: Add --with-dri-searchpath argument * Add an extra argument to configure which allows for specifying different DRI driver search paths to libGL (FDO #24766) Signed-off-by: Dan Nicholson --- src/mesa/drivers/dri/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/Makefile b/src/mesa/drivers/dri/Makefile index 32db097861..264648c3fb 100644 --- a/src/mesa/drivers/dri/Makefile +++ b/src/mesa/drivers/dri/Makefile @@ -25,7 +25,7 @@ pcedit = sed \ -e 's,@INSTALL_LIB_DIR@,$(INSTALL_LIB_DIR),' \ -e 's,@INSTALL_INC_DIR@,$(INSTALL_INC_DIR),' \ -e 's,@VERSION@,$(MESA_MAJOR).$(MESA_MINOR).$(MESA_TINY),' \ - -e 's,@DRI_DRIVER_DIR@,$(DRI_DRIVER_SEARCH_DIR),' \ + -e 's,@DRI_DRIVER_DIR@,$(DRI_DRIVER_INSTALL_DIR),' \ -e 's,@DRI_PC_REQ_PRIV@,$(DRI_PC_REQ_PRIV),' dri.pc: dri.pc.in -- cgit v1.2.3 From 71cd40bccf8dcbf628a7d7d3f7c877d547338c5a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 30 Oct 2009 08:19:50 -0600 Subject: mesa: fix incorrect format info for MESA_FORMAT_SL8 Fixes bugs 24798 and 24801. --- src/mesa/main/formats.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index aed313445f..e9b33e489a 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -387,11 +387,11 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = { MESA_FORMAT_SL8, "MESA_FORMAT_SL8", - GL_LUMINANCE_ALPHA, + GL_LUMINANCE, GL_UNSIGNED_NORMALIZED, - 0, 0, 0, 8, + 0, 0, 0, 0, 8, 0, 0, 0, 0, - 1, 1, 2 + 1, 1, 1 }, { MESA_FORMAT_SLA8, -- cgit v1.2.3 From 730a3de9f9774710ad5bbea2f32dc3af3c764732 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 30 Oct 2009 08:30:59 -0600 Subject: mesa: fix inverted buffer object test Fixes bug 24799. --- src/mesa/main/texgetimage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 10c6947c37..e4a9ac14b1 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -713,7 +713,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, return; } - if (_mesa_is_bufferobj(ctx->Pack.BufferObj) && !pixels) { + if (!_mesa_is_bufferobj(ctx->Pack.BufferObj) && !pixels) { /* not an error, do nothing */ return; } -- cgit v1.2.3 From 409469fb70682cd819ab405e0f92a4659381cfbe Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 30 Oct 2009 09:12:11 -0600 Subject: intel: fix up some XRGB breakage We weren't choosing the right XRGB span functions for reading the framebuffer. XRGB formats still aren't turned on yet though. --- src/mesa/drivers/dri/intel/intel_fbo.c | 5 ++++- src/mesa/drivers/dri/intel/intel_screen.c | 2 +- src/mesa/drivers/dri/intel/intel_span.c | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 9c780d40cc..d8ac4d3663 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -314,6 +314,10 @@ intel_create_renderbuffer(gl_format format) irb->Base.DataType = GL_UNSIGNED_BYTE; break; case MESA_FORMAT_XRGB8888: + /* XXX this is a hack since XRGB surfaces don't seem to work + * properly yet. Reading the alpha channel returns 0 instead of 1. + */ + format = MESA_FORMAT_ARGB8888; irb->Base._BaseFormat = GL_RGB; irb->Base.DataType = GL_UNSIGNED_BYTE; break; @@ -340,7 +344,6 @@ intel_create_renderbuffer(gl_format format) return NULL; } - assert(irb->Base._BaseFormat == _mesa_get_format_base_format(format)); irb->Base.Format = format; irb->Base.InternalFormat = irb->Base._BaseFormat; irb->texformat = format; diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 62c322b4ed..789135b49f 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -361,7 +361,7 @@ intelCreateBuffer(__DRIscreenPrivate * driScrnPriv, if (mesaVis->redBits == 5) rgbFormat = MESA_FORMAT_RGB565; else if (mesaVis->alphaBits == 0) - rgbFormat = MESA_FORMAT_ARGB8888; /* XXX change to XRGB someday */ + rgbFormat = MESA_FORMAT_XRGB8888; else rgbFormat = MESA_FORMAT_ARGB8888; diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index b0484a9959..927e4fd982 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -666,7 +666,7 @@ intel_set_span_functions(struct intel_context *intel, } break; case MESA_FORMAT_ARGB8888: - if (0 /*rb->AlphaBits == 0*/) { /* XXX: Need xRGB8888 Mesa format */ + if (rb->_BaseFormat == GL_RGB) { /* XXX remove this code someday when we enable XRGB surfaces */ /* 8888 RGBx */ switch (tiling) { -- cgit v1.2.3 From 5f7d5d3ea3932ef6028b21bb22d8d28dbdd9fa9f Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Wed, 28 Oct 2009 18:02:22 +0200 Subject: r600: use AUTO_INDEX for draw - saves cmd buffer space also seems we can use INDX_OFFSET if start != 0 --- src/mesa/drivers/dri/r600/r700_render.c | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index 9cf984f966..dc117183cb 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -259,8 +259,6 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim uint32_t vgt_index_type = 0; uint32_t vgt_primitive_type = 0; uint32_t vgt_num_indices = 0; - TNLcontext *tnl = TNL_CONTEXT(ctx); - struct vertex_buffer *vb = &tnl->vb; GLboolean bUseDrawIndex; if(NULL != context->ind_buf.bo) @@ -287,6 +285,7 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim total_emit = 3 /* VGT_PRIMITIVE_TYPE */ + 2 /* VGT_INDEX_TYPE */ + 2 /* NUM_INSTANCES */ + + 3 /* VGT_INDEX_OFFSET */ + 5 + 2; /* DRAW_INDEX */ } else @@ -294,7 +293,8 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim total_emit = 3 /* VGT_PRIMITIVE_TYPE */ + 2 /* VGT_INDEX_TYPE */ + 2 /* NUM_INSTANCES */ - + num_indices + 3; /* DRAW_INDEX_IMMD */ + + 3 /* VGT_INDEX_OFFSET */ + + 3; /* DRAW_INDEX_IMMD */ } BEGIN_BATCH_NO_AUTOSTATE(total_emit); @@ -332,13 +332,15 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim } else { - SETfield(vgt_draw_initiator, DI_SRC_SEL_IMMEDIATE, SOURCE_SELECT_shift, SOURCE_SELECT_mask); + SETfield(vgt_draw_initiator, DI_SRC_SEL_AUTO_INDEX, SOURCE_SELECT_shift, SOURCE_SELECT_mask); } SETfield(vgt_draw_initiator, DI_MAJOR_MODE_0, MAJOR_MODE_shift, MAJOR_MODE_mask); if(GL_TRUE == bUseDrawIndex) { + R600_OUT_BATCH_REGSEQ(VGT_INDX_OFFSET, 1); + R600_OUT_BATCH(0); R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX, 3)); R600_OUT_BATCH(context->ind_buf.bo_offset); R600_OUT_BATCH(0); @@ -351,21 +353,11 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim } else { - R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX_IMMD, (num_indices + 1))); + R600_OUT_BATCH_REGSEQ(VGT_INDX_OFFSET, 1); + R600_OUT_BATCH(start); + R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX_AUTO,1)); R600_OUT_BATCH(vgt_num_indices); R600_OUT_BATCH(vgt_draw_initiator); - - for (i = start; i < (start + num_indices); i++) - { - if(vb->Elts) - { - R600_OUT_BATCH(vb->Elts[i]); - } - else - { - R600_OUT_BATCH(i); - } - } } END_BATCH(); @@ -391,7 +383,7 @@ static GLuint r700PredictRenderSize(GLcontext* ctx, else { for (i = 0; i < nr_prims; ++i) { - dwords += prim[i].count + 10; + dwords += 13; } } -- cgit v1.2.3 From 57864f6e0450c589059e07534e2af152bbefa75f Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Fri, 30 Oct 2009 11:51:24 -0400 Subject: r600: fix a warning, update comments --- src/mesa/drivers/dri/r600/r700_render.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index dc117183cb..268bfd8bf0 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -253,7 +253,7 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim { context_t *context = R700_CONTEXT(ctx); BATCH_LOCALS(&context->radeon); - int type, i, total_emit; + int type, total_emit; int num_indices; uint32_t vgt_draw_initiator = 0; uint32_t vgt_index_type = 0; @@ -294,7 +294,7 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim + 2 /* VGT_INDEX_TYPE */ + 2 /* NUM_INSTANCES */ + 3 /* VGT_INDEX_OFFSET */ - + 3; /* DRAW_INDEX_IMMD */ + + 3; /* DRAW_INDEX_AUTO */ } BEGIN_BATCH_NO_AUTOSTATE(total_emit); @@ -335,7 +335,7 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim SETfield(vgt_draw_initiator, DI_SRC_SEL_AUTO_INDEX, SOURCE_SELECT_shift, SOURCE_SELECT_mask); } - SETfield(vgt_draw_initiator, DI_MAJOR_MODE_0, MAJOR_MODE_shift, MAJOR_MODE_mask); + SETfield(vgt_draw_initiator, DI_MAJOR_MODE_0, MAJOR_MODE_shift, MAJOR_MODE_mask); if(GL_TRUE == bUseDrawIndex) { -- cgit v1.2.3 From 703a836d4075b0e95633020765000430192986bb Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Fri, 30 Oct 2009 15:02:34 -0400 Subject: r600: fill in some missing tex formats This improves shadowtex since the component ordering is at least correct now, but I'm not sure how to deal with texturing from a depth surface yet due to differences in depth and color tile layouts. Signed-off-by: Alex Deucher --- src/mesa/drivers/dri/r600/r600_texstate.c | 46 +++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c index c2f2be1d4c..6357d52523 100644 --- a/src/mesa/drivers/dri/r600/r600_texstate.c +++ b/src/mesa/drivers/dri/r600/r600_texstate.c @@ -85,10 +85,21 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, + FORMAT_COMP_X_shift, FORMAT_COMP_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, + FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, + FORMAT_COMP_X_shift, FORMAT_COMP_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, + FORMAT_COMP_W_shift, FORMAT_COMP_W_mask); switch (mesa_format) /* This is mesa format. */ { case MESA_FORMAT_RGBA8888: + case MESA_FORMAT_SIGNED_RGBA8888: SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); @@ -100,8 +111,19 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_X, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + if (mesa_format == MESA_FORMAT_SIGNED_RGBA8888) { + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, + FORMAT_COMP_X_shift, FORMAT_COMP_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, + FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, + FORMAT_COMP_Z_shift, FORMAT_COMP_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, + FORMAT_COMP_W_shift, FORMAT_COMP_W_mask); + } break; case MESA_FORMAT_RGBA8888_REV: + case MESA_FORMAT_SIGNED_RGBA8888_REV: SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); @@ -113,6 +135,16 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); SETfield(t->SQ_TEX_RESOURCE4, SQ_SEL_W, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); + if (mesa_format == MESA_FORMAT_SIGNED_RGBA8888_REV) { + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, + FORMAT_COMP_X_shift, FORMAT_COMP_X_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, + FORMAT_COMP_Y_shift, FORMAT_COMP_Y_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, + FORMAT_COMP_Z_shift, FORMAT_COMP_Z_mask); + SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_SIGNED, + FORMAT_COMP_W_shift, FORMAT_COMP_W_mask); + } break; case MESA_FORMAT_ARGB8888: SETfield(t->SQ_TEX_RESOURCE1, FMT_8_8_8_8, @@ -479,14 +511,22 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_shift, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); break; case MESA_FORMAT_Z16: + case MESA_FORMAT_X8_Z24: case MESA_FORMAT_S8_Z24: + case MESA_FORMAT_Z24_S8: case MESA_FORMAT_Z32: + case MESA_FORMAT_S8: switch (mesa_format) { case MESA_FORMAT_Z16: SETfield(t->SQ_TEX_RESOURCE1, FMT_16, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); break; + case MESA_FORMAT_X8_Z24: case MESA_FORMAT_S8_Z24: + SETfield(t->SQ_TEX_RESOURCE1, FMT_8_24, + SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); + break; + case MESA_FORMAT_Z24_S8: SETfield(t->SQ_TEX_RESOURCE1, FMT_24_8, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); break; @@ -494,6 +534,12 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa SETfield(t->SQ_TEX_RESOURCE1, FMT_32, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); break; + case MESA_FORMAT_S8: + SETfield(t->SQ_TEX_RESOURCE1, FMT_8, + SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_shift, SQ_TEX_RESOURCE_WORD1_0__DATA_FORMAT_mask); + break; + default: + break; }; switch (tObj->DepthMode) { case GL_LUMINANCE: /* X, X, X, ONE */ -- cgit v1.2.3 From b568a2c808cc2258c354bf14f640bb1f6eaba4ba Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Fri, 30 Oct 2009 15:08:09 -0400 Subject: r600: remove duplicate line --- src/mesa/drivers/dri/r600/r600_texstate.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c index 6357d52523..27c8354923 100644 --- a/src/mesa/drivers/dri/r600/r600_texstate.c +++ b/src/mesa/drivers/dri/r600/r600_texstate.c @@ -85,7 +85,6 @@ static GLboolean r600GetTexFormat(struct gl_texture_object *tObj, gl_format mesa CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Y_mask); CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_Z_mask); CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); - CLEARfield(t->SQ_TEX_RESOURCE4, SQ_TEX_RESOURCE_WORD4_0__DST_SEL_W_mask); SETfield(t->SQ_TEX_RESOURCE4, SQ_FORMAT_COMP_UNSIGNED, FORMAT_COMP_X_shift, FORMAT_COMP_X_mask); -- cgit v1.2.3 From 2073006c9566b08888b4338748a843c645bd0db1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 30 Oct 2009 12:26:54 -0700 Subject: intel: Set the texture format in the TFP path. This fixes a regression in piglit's tfp test as of 11caea687e3f10ae12d33e44edf84635f73047dd. Additionally, set the texture format for the RGB textures to MESA_FORMAT_XRGB8888 and support it in the hw paths so that hopefully sw fallbacks involving TFP get better alpha behavior. The radeon drivers appear to need the same fix. Bug #24803 --- src/mesa/drivers/dri/intel/intel_tex_image.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 3dce1b0a87..3412e761ca 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -6,6 +6,7 @@ #include "main/bufferobj.h" #include "main/convolve.h" #include "main/context.h" +#include "main/formats.h" #include "main/image.h" #include "main/texcompress.h" #include "main/texstore.h" @@ -741,7 +742,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; - int level = 0, type, format, internalFormat; + int level = 0, internalFormat; texUnit = &intel->ctx.Texture.Unit[intel->ctx.Texture.CurrentUnit]; texObj = _mesa_select_tex_object(&intel->ctx, texUnit, target); @@ -759,8 +760,6 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, if (rb->region == NULL) return; - type = GL_BGRA; - format = GL_UNSIGNED_BYTE; if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT) internalFormat = GL_RGB; else @@ -791,6 +790,10 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, intelImage->face = target_to_face(target); intelImage->level = level; + if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT) + texImage->TexFormat = MESA_FORMAT_XRGB8888; + else + texImage->TexFormat = MESA_FORMAT_ARGB8888; texImage->RowStride = rb->region->pitch; intel_miptree_reference(&intelImage->mt, intelObj->mt); -- cgit v1.2.3 From 2c30ee9bd69ed606b984c051748a7cdb34905eeb Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 30 Oct 2009 13:20:13 -0700 Subject: i965: Fix BRW_WM_MAX_INSN to reflect current limits. Part of fixing bug #24355. --- src/mesa/drivers/dri/i965/brw_wm.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index dd4644fc36..47aa4da306 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -154,13 +154,12 @@ struct brw_wm_instruction { }; -#define BRW_WM_MAX_INSN (MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS*3 + FRAG_ATTRIB_MAX + 3) +#define BRW_WM_MAX_INSN (MAX_PROGRAM_INSTRUCTIONS*3 + FRAG_ATTRIB_MAX + 3) #define BRW_WM_MAX_GRF 128 /* hardware limit */ #define BRW_WM_MAX_VREG (BRW_WM_MAX_INSN * 4) #define BRW_WM_MAX_REF (BRW_WM_MAX_INSN * 12) #define BRW_WM_MAX_PARAM 256 #define BRW_WM_MAX_CONST 256 -#define BRW_WM_MAX_KILLS MAX_NV_FRAGMENT_PROGRAM_INSTRUCTIONS #define BRW_WM_MAX_SUBROUTINE 16 -- cgit v1.2.3 From cb132406ded760a622513cd1ab86bf83bb945671 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 30 Oct 2009 13:28:44 -0700 Subject: i965: Add an index assert on get_fp_inst array like other compiler arrays. --- src/mesa/drivers/dri/i965/brw_wm_fp.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index 53fdd06f42..0e86d75dea 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -181,6 +181,7 @@ static void release_temp( struct brw_wm_compile *c, struct prog_dst_register tem static struct prog_instruction *get_fp_inst(struct brw_wm_compile *c) { + assert(c->nr_fp_insns < BRW_WM_MAX_INSN); return &c->prog_instructions[c->nr_fp_insns++]; } -- cgit v1.2.3 From 21a3a79371c34b20fb3de2af0f031856468bdfed Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 30 Oct 2009 15:36:10 -0700 Subject: intel: Fix up z24_x8 depth spans since the texformat merge. --- src/mesa/drivers/dri/intel/intel_span.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 927e4fd982..b5e3cad3ff 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -359,18 +359,11 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb, #define INTEL_TAG(name) name##_z16 #include "intel_depthtmp.h" -/* z24 depthbuffer functions. */ +/* z24x8 depthbuffer functions. */ #define INTEL_VALUE_TYPE GLuint #define INTEL_WRITE_DEPTH(offset, d) pwrite_32(irb, offset, d) #define INTEL_READ_DEPTH(offset) pread_32(irb, offset) -#define INTEL_TAG(name) name##_z24 -#include "intel_depthtmp.h" - -/* z24s8 depthbuffer functions. */ -#define INTEL_VALUE_TYPE GLuint -#define INTEL_WRITE_DEPTH(offset, d) pwrite_32(irb, offset, d) -#define INTEL_READ_DEPTH(offset) pread_32(irb, offset) -#define INTEL_TAG(name) name##_z24_s8 +#define INTEL_TAG(name) name##_z24_x8 #include "intel_depthtmp.h" @@ -711,6 +704,7 @@ intel_set_span_functions(struct intel_context *intel, break; } break; + case MESA_FORMAT_X8_Z24: case MESA_FORMAT_S8_Z24: /* There are a few different ways SW asks us to access the S8Z24 data: * Z24 depth-only depth reads @@ -721,13 +715,13 @@ intel_set_span_functions(struct intel_context *intel, switch (tiling) { case I915_TILING_NONE: default: - intelInitDepthPointers_z24_s8(rb); + intelInitDepthPointers_z24_x8(rb); break; case I915_TILING_X: - intel_XTile_InitDepthPointers_z24_s8(rb); + intel_XTile_InitDepthPointers_z24_x8(rb); break; case I915_TILING_Y: - intel_YTile_InitDepthPointers_z24_s8(rb); + intel_YTile_InitDepthPointers_z24_x8(rb); break; } } else if (rb->Format == MESA_FORMAT_S8) { -- cgit v1.2.3 From d63c29ef20b26aa90fb310216011d03253e4f09b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 30 Oct 2009 17:22:58 -0700 Subject: x86: Fix the test for negative pixel count in optimized rgb565 spans. There's a bunch of bogus looking stuff the count handling in this code, but this fixes the testcases we have. --- src/mesa/x86/read_rgba_span_x86.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/x86/read_rgba_span_x86.S b/src/mesa/x86/read_rgba_span_x86.S index 80144b889c..92b1c2d902 100644 --- a/src/mesa/x86/read_rgba_span_x86.S +++ b/src/mesa/x86/read_rgba_span_x86.S @@ -522,7 +522,7 @@ _generic_read_RGBA_span_RGB565_MMX: addl $32,%esp sarl $2, %ecx - jle .L01 /* Bail early if the count is negative. */ + jl .L01 /* Bail early if the count is negative. */ jmp .L02 .L03: -- cgit v1.2.3 From 7c8bed62e0165a0be3363f7abf81bf9e30341e00 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 30 Oct 2009 15:33:11 -0700 Subject: intel: Use GTT mapping when available for swrast. This improves piglit quick.tests runtime from 19:33 minutes to 6:06 on my GM45. It should also hide most of the A17 swizzling issues, though they'll still exist when swapping occurs (which is the kernel's problem either way). --- src/mesa/drivers/dri/intel/intel_depthtmp.h | 10 ++++ src/mesa/drivers/dri/intel/intel_span.c | 73 ++++++++++++++++++++++++++++- src/mesa/drivers/dri/intel/intel_spantmp.h | 6 +++ 3 files changed, 88 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_depthtmp.h b/src/mesa/drivers/dri/intel/intel_depthtmp.h index 16d7708453..a9c75d44cf 100644 --- a/src/mesa/drivers/dri/intel/intel_depthtmp.h +++ b/src/mesa/drivers/dri/intel/intel_depthtmp.h @@ -30,6 +30,16 @@ * all the tiling styles. */ +#define VALUE_TYPE INTEL_VALUE_TYPE +#define WRITE_DEPTH(_x, _y, d) \ + (*(INTEL_VALUE_TYPE *)(irb->region->buffer->virtual + \ + NO_TILE(_x, _y)) = d) +#define READ_DEPTH(d, _x, _y) \ + d = *(INTEL_VALUE_TYPE *)(irb->region->buffer->virtual + \ + NO_TILE(_x, _y)) +#define TAG(x) INTEL_TAG(intel_gttmap_##x) +#include "depthtmp.h" + #define VALUE_TYPE INTEL_VALUE_TYPE #define WRITE_DEPTH(_x, _y, d) INTEL_WRITE_DEPTH(NO_TILE(_x, _y), d) #define READ_DEPTH(d, _x, _y) d = INTEL_READ_DEPTH(NO_TILE(_x, _y)) diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index b5e3cad3ff..638e05f2ad 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -266,8 +266,11 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb, unsigned int num_cliprects; \ struct drm_clip_rect *cliprects; \ int x_off, y_off; \ + int pitch = irb->region->pitch * irb->region->cpp; \ + void *buf = irb->region->buffer->virtual; \ GLuint p; \ (void) p; \ + (void)buf; (void)pitch; /* unused for non-gttmap. */ \ intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off); /* XXX FBO: this is identical to the macro in spantmp2.h except we get @@ -347,6 +350,9 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb, unsigned int num_cliprects; \ struct drm_clip_rect *cliprects; \ int x_off, y_off; \ + int pitch = irb->region->pitch * irb->region->cpp; \ + void *buf = irb->region->buffer->virtual; \ + (void)buf; (void)pitch; /* unused for non-gttmap. */ \ intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off); @@ -367,6 +373,15 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb, #include "intel_depthtmp.h" +/** + ** 8-bit stencil function (XXX FBO: This is obsolete) + **/ +/* XXX */ +#define WRITE_STENCIL(_x, _y, d) pwrite_8(irb, NO_TILE(_x, _y) + 3, d) +#define READ_STENCIL(d, _x, _y) d = pread_8(irb, NO_TILE(_x, _y) + 3); +#define TAG(x) intel_gttmap_##x##_z24_s8 +#include "stenciltmp.h" + /** ** 8-bit stencil function (XXX FBO: This is obsolete) **/ @@ -399,6 +414,9 @@ intel_renderbuffer_map(struct intel_context *intel, struct gl_renderbuffer *rb) if (irb == NULL || irb->region == NULL) return; + if (intel->intelScreen->kernel_exec_fencing) + drm_intel_gem_bo_map_gtt(irb->region->buffer); + intel_set_span_functions(intel, rb); } @@ -411,7 +429,10 @@ intel_renderbuffer_unmap(struct intel_context *intel, if (irb == NULL || irb->region == NULL) return; - clear_span_cache(irb); + if (intel->intelScreen->kernel_exec_fencing) + drm_intel_gem_bo_unmap_gtt(irb->region->buffer); + else + clear_span_cache(irb); rb->GetRow = NULL; rb->PutRow = NULL; @@ -601,6 +622,56 @@ intel_set_span_functions(struct intel_context *intel, else tiling = I915_TILING_NONE; + if (intel->intelScreen->kernel_exec_fencing) { + switch (irb->texformat) { + case MESA_FORMAT_RGB565: + intel_gttmap_InitPointers_RGB565(rb); + break; + case MESA_FORMAT_ARGB4444: + intel_gttmap_InitPointers_ARGB4444(rb); + break; + case MESA_FORMAT_ARGB1555: + intel_gttmap_InitPointers_ARGB1555(rb); + break; + case MESA_FORMAT_XRGB8888: + intel_gttmap_InitPointers_xRGB8888(rb); + break; + case MESA_FORMAT_ARGB8888: + if (rb->_BaseFormat == GL_RGB) { + /* XXX remove this code someday when we enable XRGB surfaces */ + /* 8888 RGBx */ + intel_gttmap_InitPointers_xRGB8888(rb); + } else { + intel_gttmap_InitPointers_ARGB8888(rb); + } + break; + case MESA_FORMAT_Z16: + intel_gttmap_InitDepthPointers_z16(rb); + break; + case MESA_FORMAT_X8_Z24: + intel_gttmap_InitDepthPointers_z24_x8(rb); + break; + case MESA_FORMAT_S8_Z24: + /* There are a few different ways SW asks us to access the S8Z24 data: + * Z24 depth-only depth reads + * S8Z24 depth reads + * S8Z24 stencil reads. + */ + if (rb->Format == MESA_FORMAT_S8_Z24) { + intel_gttmap_InitDepthPointers_z24_x8(rb); + } else if (rb->Format == MESA_FORMAT_S8) { + intel_gttmap_InitStencilPointers_z24_s8(rb); + } + break; + default: + _mesa_problem(NULL, + "Unexpected MesaFormat %d in intelSetSpanFunctions", + irb->texformat); + break; + } + return; + } + switch (irb->texformat) { case MESA_FORMAT_RGB565: switch (tiling) { diff --git a/src/mesa/drivers/dri/intel/intel_spantmp.h b/src/mesa/drivers/dri/intel/intel_spantmp.h index ead0b1c168..98cc6585f4 100644 --- a/src/mesa/drivers/dri/intel/intel_spantmp.h +++ b/src/mesa/drivers/dri/intel/intel_spantmp.h @@ -30,6 +30,12 @@ * all the tiling styles. */ +#define SPANTMP_PIXEL_FMT INTEL_PIXEL_FMT +#define SPANTMP_PIXEL_TYPE INTEL_PIXEL_TYPE +#define TAG(x) INTEL_TAG(intel_gttmap_##x) +#define TAG2(x, y) INTEL_TAG(intel_gttmap_##x##y) +#include "spantmp2.h" + #define SPANTMP_PIXEL_FMT INTEL_PIXEL_FMT #define SPANTMP_PIXEL_TYPE INTEL_PIXEL_TYPE #define PUT_VALUE(_x, _y, v) INTEL_WRITE_VALUE(NO_TILE(_x, _y), v) -- cgit v1.2.3 From a71edc9455ef81a8dd5ec284e88061a585e63580 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 30 Oct 2009 19:03:44 -0600 Subject: mesa: better error message --- src/mesa/main/teximage.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 73a555a181..69ef2cca5e 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1268,8 +1268,8 @@ texture_error_check( GLcontext *ctx, GLenum target, if (_mesa_base_tex_format(ctx, internalFormat) < 0) { if (!isProxy) { _mesa_error(ctx, GL_INVALID_VALUE, - "glTexImage%dD(internalFormat=0x%x)", - dimensions, internalFormat); + "glTexImage%dD(internalFormat=%s)", + dimensions, _mesa_lookup_enum_by_nr(internalFormat)); } return GL_TRUE; } -- cgit v1.2.3 From df5615de1f1bfc68417eb2a6381fe3d8ab9ac035 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 30 Oct 2009 19:05:50 -0600 Subject: ARB prog parser: new set_src_reg(), set_dst_reg() helpers These functions do sanity checks on the register file and index. --- src/mesa/shader/program_parse.y | 83 +++++++++++++++++++++++++++-------------- 1 file changed, 55 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index 20bde83af7..32b058400c 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -66,8 +66,14 @@ static int validate_inputs(struct YYLTYPE *locp, static void init_dst_reg(struct prog_dst_register *r); +static void set_dst_reg(struct prog_dst_register *r, + gl_register_file file, GLint index); + static void init_src_reg(struct asm_src_register *r); +static void set_src_reg(struct asm_src_register *r, + gl_register_file file, GLint index); + static void asm_instruction_set_operands(struct asm_instruction *inst, const struct prog_dst_register *dst, const struct asm_src_register *src0, const struct asm_src_register *src1, const struct asm_src_register *src2); @@ -580,9 +586,7 @@ scalarUse: srcReg scalarSuffix temp_sym.param_binding_begin = ~0; initialize_symbol_from_const(state->prog, & temp_sym, & $1); - init_src_reg(& $$); - $$.Base.File = PROGRAM_CONSTANT; - $$.Base.Index = temp_sym.param_binding_begin; + set_src_reg(& $$, PROGRAM_CONSTANT, temp_sym.param_binding_begin); } ; @@ -644,9 +648,7 @@ maskedDstReg: dstReg optionalMask optionalCcMask maskedAddrReg: addrReg addrWriteMask { - init_dst_reg(& $$); - $$.File = PROGRAM_ADDRESS; - $$.Index = 0; + set_dst_reg(& $$, PROGRAM_ADDRESS, 0); $$.WriteMask = $2.mask; } ; @@ -776,16 +778,13 @@ srcReg: USED_IDENTIFIER /* temporaryReg | progParamSingle */ init_src_reg(& $$); switch (s->type) { case at_temp: - $$.Base.File = PROGRAM_TEMPORARY; - $$.Base.Index = s->temp_binding; + set_src_reg(& $$, PROGRAM_TEMPORARY, s->temp_binding); break; case at_param: - $$.Base.File = s->param_binding_type; - $$.Base.Index = s->param_binding_begin; + set_src_reg(& $$, s->param_binding_type, s->param_binding_begin); break; case at_attrib: - $$.Base.File = PROGRAM_INPUT; - $$.Base.Index = s->attrib_binding; + set_src_reg(& $$, PROGRAM_INPUT, s->attrib_binding); state->prog->InputsRead |= (1U << $$.Base.Index); if (!validate_inputs(& @1, state)) { @@ -800,9 +799,7 @@ srcReg: USED_IDENTIFIER /* temporaryReg | progParamSingle */ } | attribBinding { - init_src_reg(& $$); - $$.Base.File = PROGRAM_INPUT; - $$.Base.Index = $1; + set_src_reg(& $$, PROGRAM_INPUT, $1); state->prog->InputsRead |= (1U << $$.Base.Index); if (!validate_inputs(& @1, state)) { @@ -832,19 +829,16 @@ srcReg: USED_IDENTIFIER /* temporaryReg | progParamSingle */ } | paramSingleItemUse { - init_src_reg(& $$); - $$.Base.File = ($1.name != NULL) + gl_register_file file = ($1.name != NULL) ? $1.param_binding_type : PROGRAM_CONSTANT; - $$.Base.Index = $1.param_binding_begin; + set_src_reg(& $$, file, $1.param_binding_begin); } ; dstReg: resultBinding { - init_dst_reg(& $$); - $$.File = PROGRAM_OUTPUT; - $$.Index = $1; + set_dst_reg(& $$, PROGRAM_OUTPUT, $1); } | USED_IDENTIFIER /* temporaryReg | vertexResultReg */ { @@ -859,19 +853,15 @@ dstReg: resultBinding YYERROR; } - init_dst_reg(& $$); switch (s->type) { case at_temp: - $$.File = PROGRAM_TEMPORARY; - $$.Index = s->temp_binding; + set_dst_reg(& $$, PROGRAM_TEMPORARY, s->temp_binding); break; case at_output: - $$.File = PROGRAM_OUTPUT; - $$.Index = s->output_binding; + set_dst_reg(& $$, PROGRAM_OUTPUT, s->output_binding); break; default: - $$.File = s->param_binding_type; - $$.Index = s->param_binding_begin; + set_dst_reg(& $$, s->param_binding_type, s->param_binding_begin); break; } } @@ -2263,6 +2253,26 @@ init_dst_reg(struct prog_dst_register *r) } +/** Like init_dst_reg() but set the File and Index fields. */ +void +set_dst_reg(struct prog_dst_register *r, gl_register_file file, GLint index) +{ + const GLint maxIndex = 1 << INST_INDEX_BITS; + const GLint minIndex = 0; + ASSERT(index >= minIndex); + ASSERT(index <= maxIndex); + ASSERT(file == PROGRAM_TEMPORARY || + file == PROGRAM_ADDRESS || + file == PROGRAM_OUTPUT); + memset(r, 0, sizeof(*r)); + r->File = file; + r->Index = index; + r->WriteMask = WRITEMASK_XYZW; + r->CondMask = COND_TR; + r->CondSwizzle = SWIZZLE_NOOP; +} + + void init_src_reg(struct asm_src_register *r) { @@ -2273,6 +2283,23 @@ init_src_reg(struct asm_src_register *r) } +/** Like init_src_reg() but set the File and Index fields. */ +void +set_src_reg(struct asm_src_register *r, gl_register_file file, GLint index) +{ + const GLint maxIndex = (1 << INST_INDEX_BITS) - 1; + const GLint minIndex = -(1 << INST_INDEX_BITS); + ASSERT(index >= minIndex); + ASSERT(index <= maxIndex); + ASSERT(file < PROGRAM_FILE_MAX); + memset(r, 0, sizeof(*r)); + r->Base.File = file; + r->Base.Index = index; + r->Base.Swizzle = SWIZZLE_NOOP; + r->Symbol = NULL; +} + + /** * Validate the set of inputs used by a program * -- cgit v1.2.3 From 5e9f97f0eae5519b7273f0e17000b9d5152f3274 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 30 Oct 2009 19:06:56 -0600 Subject: ARB prog parser: regenerated files --- src/mesa/shader/program_parse.tab.c | 613 +++++++++++++++++++----------------- src/mesa/shader/program_parse.tab.h | 2 +- 2 files changed, 321 insertions(+), 294 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c index 6e4095eca6..7f45e0987d 100644 --- a/src/mesa/shader/program_parse.tab.c +++ b/src/mesa/shader/program_parse.tab.c @@ -353,8 +353,14 @@ static int validate_inputs(struct YYLTYPE *locp, static void init_dst_reg(struct prog_dst_register *r); +static void set_dst_reg(struct prog_dst_register *r, + gl_register_file file, GLint index); + static void init_src_reg(struct asm_src_register *r); +static void set_src_reg(struct asm_src_register *r, + gl_register_file file, GLint index); + static void asm_instruction_set_operands(struct asm_instruction *inst, const struct prog_dst_register *dst, const struct asm_src_register *src0, const struct asm_src_register *src1, const struct asm_src_register *src2); @@ -414,7 +420,7 @@ static struct asm_instruction *asm_instruction_copy_ctor( #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 116 "program_parse.y" +#line 122 "program_parse.y" { struct asm_instruction *inst; struct asm_symbol *sym; @@ -441,7 +447,7 @@ typedef union YYSTYPE } ext_swizzle; } /* Line 187 of yacc.c. */ -#line 445 "program_parse.tab.c" +#line 451 "program_parse.tab.c" YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 @@ -463,14 +469,14 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ -#line 261 "program_parse.y" +#line 267 "program_parse.y" extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, void *yyscanner); /* Line 216 of yacc.c. */ -#line 474 "program_parse.tab.c" +#line 480 "program_parse.tab.c" #ifdef short # undef short @@ -871,35 +877,35 @@ static const yytype_int16 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 268, 268, 271, 279, 291, 292, 295, 317, 318, - 321, 336, 339, 344, 351, 352, 353, 354, 355, 356, - 357, 360, 361, 362, 365, 371, 377, 383, 390, 396, - 403, 447, 452, 462, 506, 512, 513, 514, 515, 516, - 517, 518, 519, 520, 521, 522, 523, 526, 538, 546, - 563, 570, 589, 600, 620, 645, 654, 687, 694, 709, - 759, 801, 812, 833, 843, 849, 880, 897, 897, 899, - 906, 918, 919, 920, 923, 937, 951, 969, 980, 992, - 994, 995, 996, 997, 1000, 1000, 1000, 1000, 1001, 1004, - 1008, 1013, 1020, 1027, 1034, 1057, 1080, 1081, 1082, 1083, - 1084, 1085, 1088, 1106, 1110, 1116, 1120, 1124, 1128, 1137, - 1146, 1150, 1155, 1161, 1172, 1172, 1173, 1175, 1179, 1183, - 1187, 1193, 1193, 1195, 1211, 1234, 1237, 1248, 1254, 1260, - 1261, 1268, 1274, 1280, 1288, 1294, 1300, 1308, 1314, 1320, - 1328, 1329, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, - 1340, 1341, 1342, 1345, 1354, 1358, 1362, 1368, 1377, 1381, - 1385, 1394, 1398, 1404, 1410, 1417, 1422, 1430, 1440, 1442, - 1450, 1456, 1460, 1464, 1470, 1481, 1490, 1494, 1499, 1503, - 1507, 1511, 1517, 1524, 1528, 1534, 1542, 1553, 1560, 1564, - 1570, 1580, 1591, 1595, 1613, 1622, 1625, 1631, 1635, 1639, - 1645, 1656, 1661, 1666, 1671, 1676, 1681, 1689, 1692, 1697, - 1710, 1718, 1729, 1737, 1737, 1739, 1739, 1741, 1751, 1756, - 1763, 1773, 1782, 1787, 1794, 1804, 1814, 1826, 1826, 1827, - 1827, 1829, 1839, 1847, 1857, 1865, 1873, 1882, 1893, 1897, - 1903, 1904, 1905, 1908, 1908, 1911, 1946, 1950, 1950, 1953, - 1959, 1967, 1980, 1989, 1998, 2002, 2011, 2020, 2031, 2038, - 2043, 2052, 2064, 2067, 2076, 2087, 2088, 2089, 2092, 2093, - 2094, 2097, 2098, 2101, 2102, 2105, 2106, 2109, 2120, 2131, - 2142, 2163, 2164 + 0, 274, 274, 277, 285, 297, 298, 301, 323, 324, + 327, 342, 345, 350, 357, 358, 359, 360, 361, 362, + 363, 366, 367, 368, 371, 377, 383, 389, 396, 402, + 409, 453, 458, 468, 512, 518, 519, 520, 521, 522, + 523, 524, 525, 526, 527, 528, 529, 532, 544, 552, + 569, 576, 593, 604, 624, 649, 656, 689, 696, 711, + 761, 800, 809, 830, 839, 843, 870, 887, 887, 889, + 896, 908, 909, 910, 913, 927, 941, 959, 970, 982, + 984, 985, 986, 987, 990, 990, 990, 990, 991, 994, + 998, 1003, 1010, 1017, 1024, 1047, 1070, 1071, 1072, 1073, + 1074, 1075, 1078, 1096, 1100, 1106, 1110, 1114, 1118, 1127, + 1136, 1140, 1145, 1151, 1162, 1162, 1163, 1165, 1169, 1173, + 1177, 1183, 1183, 1185, 1201, 1224, 1227, 1238, 1244, 1250, + 1251, 1258, 1264, 1270, 1278, 1284, 1290, 1298, 1304, 1310, + 1318, 1319, 1322, 1323, 1324, 1325, 1326, 1327, 1328, 1329, + 1330, 1331, 1332, 1335, 1344, 1348, 1352, 1358, 1367, 1371, + 1375, 1384, 1388, 1394, 1400, 1407, 1412, 1420, 1430, 1432, + 1440, 1446, 1450, 1454, 1460, 1471, 1480, 1484, 1489, 1493, + 1497, 1501, 1507, 1514, 1518, 1524, 1532, 1543, 1550, 1554, + 1560, 1570, 1581, 1585, 1603, 1612, 1615, 1621, 1625, 1629, + 1635, 1646, 1651, 1656, 1661, 1666, 1671, 1679, 1682, 1687, + 1700, 1708, 1719, 1727, 1727, 1729, 1729, 1731, 1741, 1746, + 1753, 1763, 1772, 1777, 1784, 1794, 1804, 1816, 1816, 1817, + 1817, 1819, 1829, 1837, 1847, 1855, 1863, 1872, 1883, 1887, + 1893, 1894, 1895, 1898, 1898, 1901, 1936, 1940, 1940, 1943, + 1949, 1957, 1970, 1979, 1988, 1992, 2001, 2010, 2021, 2028, + 2033, 2042, 2054, 2057, 2066, 2077, 2078, 2079, 2082, 2083, + 2084, 2087, 2088, 2091, 2092, 2095, 2096, 2099, 2110, 2121, + 2132, 2153, 2154 }; #endif @@ -2197,7 +2203,7 @@ yyreduce: switch (yyn) { case 3: -#line 272 "program_parse.y" +#line 278 "program_parse.y" { if (state->prog->Target != GL_VERTEX_PROGRAM_ARB) { yyerror(& (yylsp[(1) - (1)]), state, "invalid fragment program header"); @@ -2208,7 +2214,7 @@ yyreduce: break; case 4: -#line 280 "program_parse.y" +#line 286 "program_parse.y" { if (state->prog->Target != GL_FRAGMENT_PROGRAM_ARB) { yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex program header"); @@ -2221,7 +2227,7 @@ yyreduce: break; case 7: -#line 296 "program_parse.y" +#line 302 "program_parse.y" { int valid = 0; @@ -2244,7 +2250,7 @@ yyreduce: break; case 10: -#line 322 "program_parse.y" +#line 328 "program_parse.y" { if ((yyvsp[(1) - (2)].inst) != NULL) { if (state->inst_tail == NULL) { @@ -2262,7 +2268,7 @@ yyreduce: break; case 12: -#line 340 "program_parse.y" +#line 346 "program_parse.y" { (yyval.inst) = (yyvsp[(1) - (1)].inst); state->prog->NumAluInstructions++; @@ -2270,7 +2276,7 @@ yyreduce: break; case 13: -#line 345 "program_parse.y" +#line 351 "program_parse.y" { (yyval.inst) = (yyvsp[(1) - (1)].inst); state->prog->NumTexInstructions++; @@ -2278,49 +2284,49 @@ yyreduce: break; case 24: -#line 366 "program_parse.y" +#line 372 "program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_ARL, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); ;} break; case 25: -#line 372 "program_parse.y" +#line 378 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); ;} break; case 26: -#line 378 "program_parse.y" +#line 384 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); ;} break; case 27: -#line 384 "program_parse.y" +#line 390 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL); ;} break; case 28: -#line 391 "program_parse.y" +#line 397 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL); ;} break; case 29: -#line 398 "program_parse.y" +#line 404 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (8)].temp_inst), & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), & (yyvsp[(6) - (8)].src_reg), & (yyvsp[(8) - (8)].src_reg)); ;} break; case 30: -#line 404 "program_parse.y" +#line 410 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (8)].temp_inst), & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), NULL, NULL); if ((yyval.inst) != NULL) { @@ -2365,7 +2371,7 @@ yyreduce: break; case 31: -#line 448 "program_parse.y" +#line 454 "program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_KIL, NULL, & (yyvsp[(2) - (2)].src_reg), NULL, NULL); state->fragment.UsesKill = 1; @@ -2373,7 +2379,7 @@ yyreduce: break; case 32: -#line 453 "program_parse.y" +#line 459 "program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_KIL_NV, NULL, NULL, NULL, NULL); (yyval.inst)->Base.DstReg.CondMask = (yyvsp[(2) - (2)].dst_reg).CondMask; @@ -2384,7 +2390,7 @@ yyreduce: break; case 33: -#line 463 "program_parse.y" +#line 469 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (12)].temp_inst), & (yyvsp[(2) - (12)].dst_reg), & (yyvsp[(4) - (12)].src_reg), & (yyvsp[(6) - (12)].src_reg), & (yyvsp[(8) - (12)].src_reg)); if ((yyval.inst) != NULL) { @@ -2429,74 +2435,74 @@ yyreduce: break; case 34: -#line 507 "program_parse.y" +#line 513 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; case 35: -#line 512 "program_parse.y" +#line 518 "program_parse.y" { (yyval.integer) = TEXTURE_1D_INDEX; ;} break; case 36: -#line 513 "program_parse.y" +#line 519 "program_parse.y" { (yyval.integer) = TEXTURE_2D_INDEX; ;} break; case 37: -#line 514 "program_parse.y" +#line 520 "program_parse.y" { (yyval.integer) = TEXTURE_3D_INDEX; ;} break; case 38: -#line 515 "program_parse.y" +#line 521 "program_parse.y" { (yyval.integer) = TEXTURE_CUBE_INDEX; ;} break; case 39: -#line 516 "program_parse.y" +#line 522 "program_parse.y" { (yyval.integer) = TEXTURE_RECT_INDEX; ;} break; case 40: -#line 517 "program_parse.y" +#line 523 "program_parse.y" { (yyval.integer) = -TEXTURE_1D_INDEX; ;} break; case 41: -#line 518 "program_parse.y" +#line 524 "program_parse.y" { (yyval.integer) = -TEXTURE_2D_INDEX; ;} break; case 42: -#line 519 "program_parse.y" +#line 525 "program_parse.y" { (yyval.integer) = -TEXTURE_RECT_INDEX; ;} break; case 43: -#line 520 "program_parse.y" +#line 526 "program_parse.y" { (yyval.integer) = TEXTURE_1D_ARRAY_INDEX; ;} break; case 44: -#line 521 "program_parse.y" +#line 527 "program_parse.y" { (yyval.integer) = TEXTURE_2D_ARRAY_INDEX; ;} break; case 45: -#line 522 "program_parse.y" +#line 528 "program_parse.y" { (yyval.integer) = -TEXTURE_1D_ARRAY_INDEX; ;} break; case 46: -#line 523 "program_parse.y" +#line 529 "program_parse.y" { (yyval.integer) = -TEXTURE_2D_ARRAY_INDEX; ;} break; case 47: -#line 527 "program_parse.y" +#line 533 "program_parse.y" { /* FIXME: Is this correct? Should the extenedSwizzle be applied * FIXME: to the existing swizzle? @@ -2509,7 +2515,7 @@ yyreduce: break; case 48: -#line 539 "program_parse.y" +#line 545 "program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (2)].src_reg); @@ -2520,7 +2526,7 @@ yyreduce: break; case 49: -#line 547 "program_parse.y" +#line 553 "program_parse.y" { (yyval.src_reg) = (yyvsp[(3) - (4)].src_reg); @@ -2538,7 +2544,7 @@ yyreduce: break; case 50: -#line 564 "program_parse.y" +#line 570 "program_parse.y" { (yyval.src_reg) = (yyvsp[(1) - (2)].src_reg); @@ -2548,7 +2554,7 @@ yyreduce: break; case 51: -#line 571 "program_parse.y" +#line 577 "program_parse.y" { struct asm_symbol temp_sym; @@ -2561,14 +2567,12 @@ yyreduce: temp_sym.param_binding_begin = ~0; initialize_symbol_from_const(state->prog, & temp_sym, & (yyvsp[(1) - (1)].vector)); - init_src_reg(& (yyval.src_reg)); - (yyval.src_reg).Base.File = PROGRAM_CONSTANT; - (yyval.src_reg).Base.Index = temp_sym.param_binding_begin; + set_src_reg(& (yyval.src_reg), PROGRAM_CONSTANT, temp_sym.param_binding_begin); ;} break; case 52: -#line 590 "program_parse.y" +#line 594 "program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (3)].src_reg); @@ -2582,7 +2586,7 @@ yyreduce: break; case 53: -#line 601 "program_parse.y" +#line 605 "program_parse.y" { (yyval.src_reg) = (yyvsp[(3) - (5)].src_reg); @@ -2602,7 +2606,7 @@ yyreduce: break; case 54: -#line 621 "program_parse.y" +#line 625 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (3)].dst_reg); (yyval.dst_reg).WriteMask = (yyvsp[(2) - (3)].swiz_mask).mask; @@ -2628,17 +2632,15 @@ yyreduce: break; case 55: -#line 646 "program_parse.y" +#line 650 "program_parse.y" { - init_dst_reg(& (yyval.dst_reg)); - (yyval.dst_reg).File = PROGRAM_ADDRESS; - (yyval.dst_reg).Index = 0; + set_dst_reg(& (yyval.dst_reg), PROGRAM_ADDRESS, 0); (yyval.dst_reg).WriteMask = (yyvsp[(2) - (2)].swiz_mask).mask; ;} break; case 56: -#line 655 "program_parse.y" +#line 657 "program_parse.y" { const unsigned xyzw_valid = ((yyvsp[(1) - (7)].ext_swizzle).xyzw_valid << 0) @@ -2672,7 +2674,7 @@ yyreduce: break; case 57: -#line 688 "program_parse.y" +#line 690 "program_parse.y" { (yyval.ext_swizzle) = (yyvsp[(2) - (2)].ext_swizzle); (yyval.ext_swizzle).negate = ((yyvsp[(1) - (2)].negate)) ? 1 : 0; @@ -2680,7 +2682,7 @@ yyreduce: break; case 58: -#line 695 "program_parse.y" +#line 697 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) != 0) && ((yyvsp[(1) - (1)].integer) != 1)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector"); @@ -2698,7 +2700,7 @@ yyreduce: break; case 59: -#line 710 "program_parse.y" +#line 712 "program_parse.y" { if (strlen((yyvsp[(1) - (1)].string)) > 1) { yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector"); @@ -2749,7 +2751,7 @@ yyreduce: break; case 60: -#line 760 "program_parse.y" +#line 762 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2769,16 +2771,13 @@ yyreduce: init_src_reg(& (yyval.src_reg)); switch (s->type) { case at_temp: - (yyval.src_reg).Base.File = PROGRAM_TEMPORARY; - (yyval.src_reg).Base.Index = s->temp_binding; + set_src_reg(& (yyval.src_reg), PROGRAM_TEMPORARY, s->temp_binding); break; case at_param: - (yyval.src_reg).Base.File = s->param_binding_type; - (yyval.src_reg).Base.Index = s->param_binding_begin; + set_src_reg(& (yyval.src_reg), s->param_binding_type, s->param_binding_begin); break; case at_attrib: - (yyval.src_reg).Base.File = PROGRAM_INPUT; - (yyval.src_reg).Base.Index = s->attrib_binding; + set_src_reg(& (yyval.src_reg), PROGRAM_INPUT, s->attrib_binding); state->prog->InputsRead |= (1U << (yyval.src_reg).Base.Index); if (!validate_inputs(& (yylsp[(1) - (1)]), state)) { @@ -2794,11 +2793,9 @@ yyreduce: break; case 61: -#line 802 "program_parse.y" +#line 801 "program_parse.y" { - init_src_reg(& (yyval.src_reg)); - (yyval.src_reg).Base.File = PROGRAM_INPUT; - (yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].attrib); + set_src_reg(& (yyval.src_reg), PROGRAM_INPUT, (yyvsp[(1) - (1)].attrib)); state->prog->InputsRead |= (1U << (yyval.src_reg).Base.Index); if (!validate_inputs(& (yylsp[(1) - (1)]), state)) { @@ -2808,7 +2805,7 @@ yyreduce: break; case 62: -#line 813 "program_parse.y" +#line 810 "program_parse.y" { if (! (yyvsp[(3) - (4)].src_reg).Base.RelAddr && ((unsigned) (yyvsp[(3) - (4)].src_reg).Base.Index >= (yyvsp[(1) - (4)].sym)->param_binding_length)) { @@ -2832,27 +2829,24 @@ yyreduce: break; case 63: -#line 834 "program_parse.y" +#line 831 "program_parse.y" { - init_src_reg(& (yyval.src_reg)); - (yyval.src_reg).Base.File = ((yyvsp[(1) - (1)].temp_sym).name != NULL) + gl_register_file file = ((yyvsp[(1) - (1)].temp_sym).name != NULL) ? (yyvsp[(1) - (1)].temp_sym).param_binding_type : PROGRAM_CONSTANT; - (yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].temp_sym).param_binding_begin; + set_src_reg(& (yyval.src_reg), file, (yyvsp[(1) - (1)].temp_sym).param_binding_begin); ;} break; case 64: -#line 844 "program_parse.y" +#line 840 "program_parse.y" { - init_dst_reg(& (yyval.dst_reg)); - (yyval.dst_reg).File = PROGRAM_OUTPUT; - (yyval.dst_reg).Index = (yyvsp[(1) - (1)].result); + set_dst_reg(& (yyval.dst_reg), PROGRAM_OUTPUT, (yyvsp[(1) - (1)].result)); ;} break; case 65: -#line 850 "program_parse.y" +#line 844 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2865,26 +2859,22 @@ yyreduce: YYERROR; } - init_dst_reg(& (yyval.dst_reg)); switch (s->type) { case at_temp: - (yyval.dst_reg).File = PROGRAM_TEMPORARY; - (yyval.dst_reg).Index = s->temp_binding; + set_dst_reg(& (yyval.dst_reg), PROGRAM_TEMPORARY, s->temp_binding); break; case at_output: - (yyval.dst_reg).File = PROGRAM_OUTPUT; - (yyval.dst_reg).Index = s->output_binding; + set_dst_reg(& (yyval.dst_reg), PROGRAM_OUTPUT, s->output_binding); break; default: - (yyval.dst_reg).File = s->param_binding_type; - (yyval.dst_reg).Index = s->param_binding_begin; + set_dst_reg(& (yyval.dst_reg), s->param_binding_type, s->param_binding_begin); break; } ;} break; case 66: -#line 881 "program_parse.y" +#line 871 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2902,7 +2892,7 @@ yyreduce: break; case 69: -#line 900 "program_parse.y" +#line 890 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].integer); @@ -2910,7 +2900,7 @@ yyreduce: break; case 70: -#line 907 "program_parse.y" +#line 897 "program_parse.y" { /* FINISHME: Add support for multiple address registers. */ @@ -2923,22 +2913,22 @@ yyreduce: break; case 71: -#line 918 "program_parse.y" +#line 908 "program_parse.y" { (yyval.integer) = 0; ;} break; case 72: -#line 919 "program_parse.y" +#line 909 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; case 73: -#line 920 "program_parse.y" +#line 910 "program_parse.y" { (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;} break; case 74: -#line 924 "program_parse.y" +#line 914 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 63)) { char s[100]; @@ -2953,7 +2943,7 @@ yyreduce: break; case 75: -#line 938 "program_parse.y" +#line 928 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 64)) { char s[100]; @@ -2968,7 +2958,7 @@ yyreduce: break; case 76: -#line 952 "program_parse.y" +#line 942 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); @@ -2987,7 +2977,7 @@ yyreduce: break; case 77: -#line 970 "program_parse.y" +#line 960 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, "invalid address component selector"); @@ -2999,7 +2989,7 @@ yyreduce: break; case 78: -#line 981 "program_parse.y" +#line 971 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, @@ -3012,31 +3002,31 @@ yyreduce: break; case 83: -#line 997 "program_parse.y" +#line 987 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; case 88: -#line 1001 "program_parse.y" +#line 991 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; case 89: -#line 1005 "program_parse.y" +#line 995 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(2) - (3)].dst_reg); ;} break; case 90: -#line 1009 "program_parse.y" +#line 999 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(2) - (3)].dst_reg); ;} break; case 91: -#line 1013 "program_parse.y" +#line 1003 "program_parse.y" { (yyval.dst_reg).CondMask = COND_TR; (yyval.dst_reg).CondSwizzle = SWIZZLE_NOOP; @@ -3045,7 +3035,7 @@ yyreduce: break; case 92: -#line 1021 "program_parse.y" +#line 1011 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); (yyval.dst_reg).CondSwizzle = (yyvsp[(2) - (2)].swiz_mask).swizzle; @@ -3053,7 +3043,7 @@ yyreduce: break; case 93: -#line 1028 "program_parse.y" +#line 1018 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); (yyval.dst_reg).CondSwizzle = (yyvsp[(2) - (2)].swiz_mask).swizzle; @@ -3061,7 +3051,7 @@ yyreduce: break; case 94: -#line 1035 "program_parse.y" +#line 1025 "program_parse.y" { const int cond = _mesa_parse_cc((yyvsp[(1) - (1)].string)); if ((cond == 0) || ((yyvsp[(1) - (1)].string)[2] != '\0')) { @@ -3085,7 +3075,7 @@ yyreduce: break; case 95: -#line 1058 "program_parse.y" +#line 1048 "program_parse.y" { const int cond = _mesa_parse_cc((yyvsp[(1) - (1)].string)); if ((cond == 0) || ((yyvsp[(1) - (1)].string)[2] != '\0')) { @@ -3109,7 +3099,7 @@ yyreduce: break; case 102: -#line 1089 "program_parse.y" +#line 1079 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (4)].string), at_attrib, & (yylsp[(2) - (4)])); @@ -3128,42 +3118,42 @@ yyreduce: break; case 103: -#line 1107 "program_parse.y" +#line 1097 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} break; case 104: -#line 1111 "program_parse.y" +#line 1101 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} break; case 105: -#line 1117 "program_parse.y" +#line 1107 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_POS; ;} break; case 106: -#line 1121 "program_parse.y" +#line 1111 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_WEIGHT; ;} break; case 107: -#line 1125 "program_parse.y" +#line 1115 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_NORMAL; ;} break; case 108: -#line 1129 "program_parse.y" +#line 1119 "program_parse.y" { if (!state->ctx->Extensions.EXT_secondary_color) { yyerror(& (yylsp[(2) - (2)]), state, "GL_EXT_secondary_color not supported"); @@ -3175,7 +3165,7 @@ yyreduce: break; case 109: -#line 1138 "program_parse.y" +#line 1128 "program_parse.y" { if (!state->ctx->Extensions.EXT_fog_coord) { yyerror(& (yylsp[(1) - (1)]), state, "GL_EXT_fog_coord not supported"); @@ -3187,14 +3177,14 @@ yyreduce: break; case 110: -#line 1147 "program_parse.y" +#line 1137 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} break; case 111: -#line 1151 "program_parse.y" +#line 1141 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; @@ -3202,14 +3192,14 @@ yyreduce: break; case 112: -#line 1156 "program_parse.y" +#line 1146 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_GENERIC0 + (yyvsp[(3) - (4)].integer); ;} break; case 113: -#line 1162 "program_parse.y" +#line 1152 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxAttribs) { yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex attribute reference"); @@ -3221,35 +3211,35 @@ yyreduce: break; case 117: -#line 1176 "program_parse.y" +#line 1166 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_WPOS; ;} break; case 118: -#line 1180 "program_parse.y" +#line 1170 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_COL0 + (yyvsp[(2) - (2)].integer); ;} break; case 119: -#line 1184 "program_parse.y" +#line 1174 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_FOGC; ;} break; case 120: -#line 1188 "program_parse.y" +#line 1178 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} break; case 123: -#line 1196 "program_parse.y" +#line 1186 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (3)].string), at_param, & (yylsp[(2) - (3)])); @@ -3266,7 +3256,7 @@ yyreduce: break; case 124: -#line 1212 "program_parse.y" +#line 1202 "program_parse.y" { if (((yyvsp[(4) - (6)].integer) != 0) && ((unsigned) (yyvsp[(4) - (6)].integer) != (yyvsp[(6) - (6)].temp_sym).param_binding_length)) { yyerror(& (yylsp[(4) - (6)]), state, @@ -3289,14 +3279,14 @@ yyreduce: break; case 125: -#line 1234 "program_parse.y" +#line 1224 "program_parse.y" { (yyval.integer) = 0; ;} break; case 126: -#line 1238 "program_parse.y" +#line 1228 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - (1)].integer) > state->limits->MaxParameters)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid parameter array size"); @@ -3308,21 +3298,21 @@ yyreduce: break; case 127: -#line 1249 "program_parse.y" +#line 1239 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(2) - (2)].temp_sym); ;} break; case 128: -#line 1255 "program_parse.y" +#line 1245 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(3) - (4)].temp_sym); ;} break; case 130: -#line 1262 "program_parse.y" +#line 1252 "program_parse.y" { (yyvsp[(1) - (3)].temp_sym).param_binding_length += (yyvsp[(3) - (3)].temp_sym).param_binding_length; (yyval.temp_sym) = (yyvsp[(1) - (3)].temp_sym); @@ -3330,7 +3320,7 @@ yyreduce: break; case 131: -#line 1269 "program_parse.y" +#line 1259 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3339,7 +3329,7 @@ yyreduce: break; case 132: -#line 1275 "program_parse.y" +#line 1265 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3348,7 +3338,7 @@ yyreduce: break; case 133: -#line 1281 "program_parse.y" +#line 1271 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3357,7 +3347,7 @@ yyreduce: break; case 134: -#line 1289 "program_parse.y" +#line 1279 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3366,7 +3356,7 @@ yyreduce: break; case 135: -#line 1295 "program_parse.y" +#line 1285 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3375,7 +3365,7 @@ yyreduce: break; case 136: -#line 1301 "program_parse.y" +#line 1291 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3384,7 +3374,7 @@ yyreduce: break; case 137: -#line 1309 "program_parse.y" +#line 1299 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3393,7 +3383,7 @@ yyreduce: break; case 138: -#line 1315 "program_parse.y" +#line 1305 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3402,7 +3392,7 @@ yyreduce: break; case 139: -#line 1321 "program_parse.y" +#line 1311 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3411,72 +3401,72 @@ yyreduce: break; case 140: -#line 1328 "program_parse.y" +#line 1318 "program_parse.y" { memcpy((yyval.state), (yyvsp[(1) - (1)].state), sizeof((yyval.state))); ;} break; case 141: -#line 1329 "program_parse.y" +#line 1319 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 142: -#line 1332 "program_parse.y" +#line 1322 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 143: -#line 1333 "program_parse.y" +#line 1323 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 144: -#line 1334 "program_parse.y" +#line 1324 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 145: -#line 1335 "program_parse.y" +#line 1325 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 146: -#line 1336 "program_parse.y" +#line 1326 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 147: -#line 1337 "program_parse.y" +#line 1327 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 148: -#line 1338 "program_parse.y" +#line 1328 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 149: -#line 1339 "program_parse.y" +#line 1329 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 150: -#line 1340 "program_parse.y" +#line 1330 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 151: -#line 1341 "program_parse.y" +#line 1331 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 152: -#line 1342 "program_parse.y" +#line 1332 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 153: -#line 1346 "program_parse.y" +#line 1336 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_MATERIAL; @@ -3486,28 +3476,28 @@ yyreduce: break; case 154: -#line 1355 "program_parse.y" +#line 1345 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; case 155: -#line 1359 "program_parse.y" +#line 1349 "program_parse.y" { (yyval.integer) = STATE_EMISSION; ;} break; case 156: -#line 1363 "program_parse.y" +#line 1353 "program_parse.y" { (yyval.integer) = STATE_SHININESS; ;} break; case 157: -#line 1369 "program_parse.y" +#line 1359 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHT; @@ -3517,21 +3507,21 @@ yyreduce: break; case 158: -#line 1378 "program_parse.y" +#line 1368 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; case 159: -#line 1382 "program_parse.y" +#line 1372 "program_parse.y" { (yyval.integer) = STATE_POSITION; ;} break; case 160: -#line 1386 "program_parse.y" +#line 1376 "program_parse.y" { if (!state->ctx->Extensions.EXT_point_parameters) { yyerror(& (yylsp[(1) - (1)]), state, "GL_ARB_point_parameters not supported"); @@ -3543,28 +3533,28 @@ yyreduce: break; case 161: -#line 1395 "program_parse.y" +#line 1385 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; case 162: -#line 1399 "program_parse.y" +#line 1389 "program_parse.y" { (yyval.integer) = STATE_HALF_VECTOR; ;} break; case 163: -#line 1405 "program_parse.y" +#line 1395 "program_parse.y" { (yyval.integer) = STATE_SPOT_DIRECTION; ;} break; case 164: -#line 1411 "program_parse.y" +#line 1401 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (2)].state)[1]; @@ -3572,7 +3562,7 @@ yyreduce: break; case 165: -#line 1418 "program_parse.y" +#line 1408 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_AMBIENT; @@ -3580,7 +3570,7 @@ yyreduce: break; case 166: -#line 1423 "program_parse.y" +#line 1413 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_SCENECOLOR; @@ -3589,7 +3579,7 @@ yyreduce: break; case 167: -#line 1431 "program_parse.y" +#line 1421 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTPROD; @@ -3600,7 +3590,7 @@ yyreduce: break; case 169: -#line 1443 "program_parse.y" +#line 1433 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(3) - (3)].integer); @@ -3609,35 +3599,35 @@ yyreduce: break; case 170: -#line 1451 "program_parse.y" +#line 1441 "program_parse.y" { (yyval.integer) = STATE_TEXENV_COLOR; ;} break; case 171: -#line 1457 "program_parse.y" +#line 1447 "program_parse.y" { (yyval.integer) = STATE_AMBIENT; ;} break; case 172: -#line 1461 "program_parse.y" +#line 1451 "program_parse.y" { (yyval.integer) = STATE_DIFFUSE; ;} break; case 173: -#line 1465 "program_parse.y" +#line 1455 "program_parse.y" { (yyval.integer) = STATE_SPECULAR; ;} break; case 174: -#line 1471 "program_parse.y" +#line 1461 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxLights) { yyerror(& (yylsp[(1) - (1)]), state, "invalid light selector"); @@ -3649,7 +3639,7 @@ yyreduce: break; case 175: -#line 1482 "program_parse.y" +#line 1472 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_TEXGEN; @@ -3659,49 +3649,49 @@ yyreduce: break; case 176: -#line 1491 "program_parse.y" +#line 1481 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S; ;} break; case 177: -#line 1495 "program_parse.y" +#line 1485 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_OBJECT_S; ;} break; case 178: -#line 1500 "program_parse.y" +#line 1490 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S; ;} break; case 179: -#line 1504 "program_parse.y" +#line 1494 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S; ;} break; case 180: -#line 1508 "program_parse.y" +#line 1498 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S; ;} break; case 181: -#line 1512 "program_parse.y" +#line 1502 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S; ;} break; case 182: -#line 1518 "program_parse.y" +#line 1508 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); @@ -3709,21 +3699,21 @@ yyreduce: break; case 183: -#line 1525 "program_parse.y" +#line 1515 "program_parse.y" { (yyval.integer) = STATE_FOG_COLOR; ;} break; case 184: -#line 1529 "program_parse.y" +#line 1519 "program_parse.y" { (yyval.integer) = STATE_FOG_PARAMS; ;} break; case 185: -#line 1535 "program_parse.y" +#line 1525 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_CLIPPLANE; @@ -3732,7 +3722,7 @@ yyreduce: break; case 186: -#line 1543 "program_parse.y" +#line 1533 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxClipPlanes) { yyerror(& (yylsp[(1) - (1)]), state, "invalid clip plane selector"); @@ -3744,7 +3734,7 @@ yyreduce: break; case 187: -#line 1554 "program_parse.y" +#line 1544 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); @@ -3752,21 +3742,21 @@ yyreduce: break; case 188: -#line 1561 "program_parse.y" +#line 1551 "program_parse.y" { (yyval.integer) = STATE_POINT_SIZE; ;} break; case 189: -#line 1565 "program_parse.y" +#line 1555 "program_parse.y" { (yyval.integer) = STATE_POINT_ATTENUATION; ;} break; case 190: -#line 1571 "program_parse.y" +#line 1561 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (5)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (5)].state)[1]; @@ -3777,7 +3767,7 @@ yyreduce: break; case 191: -#line 1581 "program_parse.y" +#line 1571 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (2)].state)[1]; @@ -3788,7 +3778,7 @@ yyreduce: break; case 192: -#line 1591 "program_parse.y" +#line 1581 "program_parse.y" { (yyval.state)[2] = 0; (yyval.state)[3] = 3; @@ -3796,7 +3786,7 @@ yyreduce: break; case 193: -#line 1596 "program_parse.y" +#line 1586 "program_parse.y" { /* It seems logical that the matrix row range specifier would have * to specify a range or more than one row (i.e., $5 > $3). @@ -3815,7 +3805,7 @@ yyreduce: break; case 194: -#line 1614 "program_parse.y" +#line 1604 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (3)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (3)].state)[1]; @@ -3824,42 +3814,42 @@ yyreduce: break; case 195: -#line 1622 "program_parse.y" +#line 1612 "program_parse.y" { (yyval.integer) = 0; ;} break; case 196: -#line 1626 "program_parse.y" +#line 1616 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; case 197: -#line 1632 "program_parse.y" +#line 1622 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVERSE; ;} break; case 198: -#line 1636 "program_parse.y" +#line 1626 "program_parse.y" { (yyval.integer) = STATE_MATRIX_TRANSPOSE; ;} break; case 199: -#line 1640 "program_parse.y" +#line 1630 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVTRANS; ;} break; case 200: -#line 1646 "program_parse.y" +#line 1636 "program_parse.y" { if ((yyvsp[(1) - (1)].integer) > 3) { yyerror(& (yylsp[(1) - (1)]), state, "invalid matrix row reference"); @@ -3871,7 +3861,7 @@ yyreduce: break; case 201: -#line 1657 "program_parse.y" +#line 1647 "program_parse.y" { (yyval.state)[0] = STATE_MODELVIEW_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); @@ -3879,7 +3869,7 @@ yyreduce: break; case 202: -#line 1662 "program_parse.y" +#line 1652 "program_parse.y" { (yyval.state)[0] = STATE_PROJECTION_MATRIX; (yyval.state)[1] = 0; @@ -3887,7 +3877,7 @@ yyreduce: break; case 203: -#line 1667 "program_parse.y" +#line 1657 "program_parse.y" { (yyval.state)[0] = STATE_MVP_MATRIX; (yyval.state)[1] = 0; @@ -3895,7 +3885,7 @@ yyreduce: break; case 204: -#line 1672 "program_parse.y" +#line 1662 "program_parse.y" { (yyval.state)[0] = STATE_TEXTURE_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); @@ -3903,7 +3893,7 @@ yyreduce: break; case 205: -#line 1677 "program_parse.y" +#line 1667 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; @@ -3911,7 +3901,7 @@ yyreduce: break; case 206: -#line 1682 "program_parse.y" +#line 1672 "program_parse.y" { (yyval.state)[0] = STATE_PROGRAM_MATRIX; (yyval.state)[1] = (yyvsp[(3) - (4)].integer); @@ -3919,21 +3909,21 @@ yyreduce: break; case 207: -#line 1689 "program_parse.y" +#line 1679 "program_parse.y" { (yyval.integer) = 0; ;} break; case 208: -#line 1693 "program_parse.y" +#line 1683 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 209: -#line 1698 "program_parse.y" +#line 1688 "program_parse.y" { /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix * zero is valid. @@ -3948,7 +3938,7 @@ yyreduce: break; case 210: -#line 1711 "program_parse.y" +#line 1701 "program_parse.y" { /* Since GL_ARB_matrix_palette isn't supported, just let any value * through here. The error will be generated later. @@ -3958,7 +3948,7 @@ yyreduce: break; case 211: -#line 1719 "program_parse.y" +#line 1709 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxProgramMatrices) { yyerror(& (yylsp[(1) - (1)]), state, "invalid program matrix selector"); @@ -3970,7 +3960,7 @@ yyreduce: break; case 212: -#line 1730 "program_parse.y" +#line 1720 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_DEPTH_RANGE; @@ -3978,7 +3968,7 @@ yyreduce: break; case 217: -#line 1742 "program_parse.y" +#line 1732 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -3989,7 +3979,7 @@ yyreduce: break; case 218: -#line 1752 "program_parse.y" +#line 1742 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); @@ -3997,7 +3987,7 @@ yyreduce: break; case 219: -#line 1757 "program_parse.y" +#line 1747 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); @@ -4005,7 +3995,7 @@ yyreduce: break; case 220: -#line 1764 "program_parse.y" +#line 1754 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4016,7 +4006,7 @@ yyreduce: break; case 221: -#line 1774 "program_parse.y" +#line 1764 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4027,7 +4017,7 @@ yyreduce: break; case 222: -#line 1783 "program_parse.y" +#line 1773 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); @@ -4035,7 +4025,7 @@ yyreduce: break; case 223: -#line 1788 "program_parse.y" +#line 1778 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); @@ -4043,7 +4033,7 @@ yyreduce: break; case 224: -#line 1795 "program_parse.y" +#line 1785 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4054,7 +4044,7 @@ yyreduce: break; case 225: -#line 1805 "program_parse.y" +#line 1795 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxEnvParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid environment parameter reference"); @@ -4065,7 +4055,7 @@ yyreduce: break; case 226: -#line 1815 "program_parse.y" +#line 1805 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxLocalParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid local parameter reference"); @@ -4076,7 +4066,7 @@ yyreduce: break; case 231: -#line 1830 "program_parse.y" +#line 1820 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4087,7 +4077,7 @@ yyreduce: break; case 232: -#line 1840 "program_parse.y" +#line 1830 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4098,7 +4088,7 @@ yyreduce: break; case 233: -#line 1848 "program_parse.y" +#line 1838 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (float) (yyvsp[(1) - (1)].integer); @@ -4109,7 +4099,7 @@ yyreduce: break; case 234: -#line 1858 "program_parse.y" +#line 1848 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (3)].real); @@ -4120,7 +4110,7 @@ yyreduce: break; case 235: -#line 1866 "program_parse.y" +#line 1856 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (5)].real); @@ -4131,7 +4121,7 @@ yyreduce: break; case 236: -#line 1875 "program_parse.y" +#line 1865 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (7)].real); @@ -4142,7 +4132,7 @@ yyreduce: break; case 237: -#line 1884 "program_parse.y" +#line 1874 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (9)].real); @@ -4153,41 +4143,41 @@ yyreduce: break; case 238: -#line 1894 "program_parse.y" +#line 1884 "program_parse.y" { (yyval.real) = ((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].real) : (yyvsp[(2) - (2)].real); ;} break; case 239: -#line 1898 "program_parse.y" +#line 1888 "program_parse.y" { (yyval.real) = (float)(((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].integer) : (yyvsp[(2) - (2)].integer)); ;} break; case 240: -#line 1903 "program_parse.y" +#line 1893 "program_parse.y" { (yyval.negate) = FALSE; ;} break; case 241: -#line 1904 "program_parse.y" +#line 1894 "program_parse.y" { (yyval.negate) = TRUE; ;} break; case 242: -#line 1905 "program_parse.y" +#line 1895 "program_parse.y" { (yyval.negate) = FALSE; ;} break; case 243: -#line 1908 "program_parse.y" +#line 1898 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; case 245: -#line 1912 "program_parse.y" +#line 1902 "program_parse.y" { /* NV_fragment_program_option defines the size qualifiers in a * fairly broken way. "SHORT" or "LONG" can optionally be used @@ -4224,18 +4214,18 @@ yyreduce: break; case 246: -#line 1946 "program_parse.y" +#line 1936 "program_parse.y" { ;} break; case 247: -#line 1950 "program_parse.y" +#line 1940 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; case 249: -#line 1954 "program_parse.y" +#line 1944 "program_parse.y" { if (!declare_variable(state, (yyvsp[(3) - (3)].string), (yyvsp[(0) - (3)].integer), & (yylsp[(3) - (3)]))) { YYERROR; @@ -4244,7 +4234,7 @@ yyreduce: break; case 250: -#line 1960 "program_parse.y" +#line 1950 "program_parse.y" { if (!declare_variable(state, (yyvsp[(1) - (1)].string), (yyvsp[(0) - (1)].integer), & (yylsp[(1) - (1)]))) { YYERROR; @@ -4253,7 +4243,7 @@ yyreduce: break; case 251: -#line 1968 "program_parse.y" +#line 1958 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(3) - (5)].string), at_output, & (yylsp[(3) - (5)])); @@ -4267,7 +4257,7 @@ yyreduce: break; case 252: -#line 1981 "program_parse.y" +#line 1971 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_HPOS; @@ -4279,7 +4269,7 @@ yyreduce: break; case 253: -#line 1990 "program_parse.y" +#line 1980 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_FOGC; @@ -4291,14 +4281,14 @@ yyreduce: break; case 254: -#line 1999 "program_parse.y" +#line 1989 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (2)].result); ;} break; case 255: -#line 2003 "program_parse.y" +#line 1993 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_PSIZ; @@ -4310,7 +4300,7 @@ yyreduce: break; case 256: -#line 2012 "program_parse.y" +#line 2002 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_TEX0 + (yyvsp[(3) - (3)].integer); @@ -4322,7 +4312,7 @@ yyreduce: break; case 257: -#line 2021 "program_parse.y" +#line 2011 "program_parse.y" { if (state->mode == ARB_fragment) { (yyval.result) = FRAG_RESULT_DEPTH; @@ -4334,14 +4324,14 @@ yyreduce: break; case 258: -#line 2032 "program_parse.y" +#line 2022 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (3)].integer) + (yyvsp[(3) - (3)].integer); ;} break; case 259: -#line 2038 "program_parse.y" +#line 2028 "program_parse.y" { (yyval.integer) = (state->mode == ARB_vertex) ? VERT_RESULT_COL0 @@ -4350,7 +4340,7 @@ yyreduce: break; case 260: -#line 2044 "program_parse.y" +#line 2034 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_COL0; @@ -4362,7 +4352,7 @@ yyreduce: break; case 261: -#line 2053 "program_parse.y" +#line 2043 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_BFC0; @@ -4374,14 +4364,14 @@ yyreduce: break; case 262: -#line 2064 "program_parse.y" +#line 2054 "program_parse.y" { (yyval.integer) = 0; ;} break; case 263: -#line 2068 "program_parse.y" +#line 2058 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 0; @@ -4393,7 +4383,7 @@ yyreduce: break; case 264: -#line 2077 "program_parse.y" +#line 2067 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 1; @@ -4405,67 +4395,67 @@ yyreduce: break; case 265: -#line 2087 "program_parse.y" +#line 2077 "program_parse.y" { (yyval.integer) = 0; ;} break; case 266: -#line 2088 "program_parse.y" +#line 2078 "program_parse.y" { (yyval.integer) = 0; ;} break; case 267: -#line 2089 "program_parse.y" +#line 2079 "program_parse.y" { (yyval.integer) = 1; ;} break; case 268: -#line 2092 "program_parse.y" +#line 2082 "program_parse.y" { (yyval.integer) = 0; ;} break; case 269: -#line 2093 "program_parse.y" +#line 2083 "program_parse.y" { (yyval.integer) = 0; ;} break; case 270: -#line 2094 "program_parse.y" +#line 2084 "program_parse.y" { (yyval.integer) = 1; ;} break; case 271: -#line 2097 "program_parse.y" +#line 2087 "program_parse.y" { (yyval.integer) = 0; ;} break; case 272: -#line 2098 "program_parse.y" +#line 2088 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 273: -#line 2101 "program_parse.y" +#line 2091 "program_parse.y" { (yyval.integer) = 0; ;} break; case 274: -#line 2102 "program_parse.y" +#line 2092 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 275: -#line 2105 "program_parse.y" +#line 2095 "program_parse.y" { (yyval.integer) = 0; ;} break; case 276: -#line 2106 "program_parse.y" +#line 2096 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 277: -#line 2110 "program_parse.y" +#line 2100 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureCoordUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture coordinate unit selector"); @@ -4477,7 +4467,7 @@ yyreduce: break; case 278: -#line 2121 "program_parse.y" +#line 2111 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureImageUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture image unit selector"); @@ -4489,7 +4479,7 @@ yyreduce: break; case 279: -#line 2132 "program_parse.y" +#line 2122 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture unit selector"); @@ -4501,7 +4491,7 @@ yyreduce: break; case 280: -#line 2143 "program_parse.y" +#line 2133 "program_parse.y" { struct asm_symbol *exist = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(2) - (4)].string)); @@ -4524,7 +4514,7 @@ yyreduce: /* Line 1267 of yacc.c. */ -#line 4528 "program_parse.tab.c" +#line 4518 "program_parse.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -4744,7 +4734,7 @@ yyreturn: } -#line 2167 "program_parse.y" +#line 2157 "program_parse.y" void @@ -4844,6 +4834,26 @@ init_dst_reg(struct prog_dst_register *r) } +/** Like init_dst_reg() but set the File and Index fields. */ +void +set_dst_reg(struct prog_dst_register *r, gl_register_file file, GLint index) +{ + const GLint maxIndex = 1 << INST_INDEX_BITS; + const GLint minIndex = 0; + ASSERT(index >= minIndex); + ASSERT(index <= maxIndex); + ASSERT(file == PROGRAM_TEMPORARY || + file == PROGRAM_ADDRESS || + file == PROGRAM_OUTPUT); + memset(r, 0, sizeof(*r)); + r->File = file; + r->Index = index; + r->WriteMask = WRITEMASK_XYZW; + r->CondMask = COND_TR; + r->CondSwizzle = SWIZZLE_NOOP; +} + + void init_src_reg(struct asm_src_register *r) { @@ -4854,6 +4864,23 @@ init_src_reg(struct asm_src_register *r) } +/** Like init_src_reg() but set the File and Index fields. */ +void +set_src_reg(struct asm_src_register *r, gl_register_file file, GLint index) +{ + const GLint maxIndex = (1 << INST_INDEX_BITS) - 1; + const GLint minIndex = -(1 << INST_INDEX_BITS); + ASSERT(index >= minIndex); + ASSERT(index <= maxIndex); + ASSERT(file < PROGRAM_FILE_MAX); + memset(r, 0, sizeof(*r)); + r->Base.File = file; + r->Base.Index = index; + r->Base.Swizzle = SWIZZLE_NOOP; + r->Symbol = NULL; +} + + /** * Validate the set of inputs used by a program * diff --git a/src/mesa/shader/program_parse.tab.h b/src/mesa/shader/program_parse.tab.h index ae6dd8c34e..25048065c1 100644 --- a/src/mesa/shader/program_parse.tab.h +++ b/src/mesa/shader/program_parse.tab.h @@ -258,7 +258,7 @@ #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 116 "program_parse.y" +#line 122 "program_parse.y" { struct asm_instruction *inst; struct asm_symbol *sym; -- cgit v1.2.3 From 5cf7c8e2d58a877bfc786f866d4e0d363ddd22aa Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 31 Oct 2009 15:48:59 +1000 Subject: radeon: use _mesa_get_current_tex_unit --- src/mesa/drivers/dri/radeon/radeon_texstate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index 0fd9a138d6..d6e8d4984a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -661,7 +661,7 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_ rmesa = pDRICtx->driverPrivate; rfb = dPriv->driverPrivate; - texUnit = &radeon->glCtx->Texture.Unit[radeon->glCtx->Texture.CurrentUnit]; + texUnit = _mesa_get_current_tex_unit(radeon->glCtx); texObj = _mesa_select_tex_object(radeon->glCtx, texUnit, target); texImage = _mesa_get_tex_image(radeon->glCtx, texObj, target, 0); -- cgit v1.2.3 From ace78d90ded52d8fe4b3b077abf9a4db381dce16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 29 Oct 2009 23:48:59 +0100 Subject: r300g: fix crash in r300_is_texture_referenced Also, a subtle fix in emitting a texture state --- src/gallium/drivers/r300/r300_context.c | 2 +- src/gallium/drivers/r300/r300_emit.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index e45564b54e..02f201b49a 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -80,7 +80,7 @@ r300_is_texture_referenced(struct pipe_context *pipe, struct pipe_texture *texture, unsigned face, unsigned level) { - struct pipe_buffer* buf; + struct pipe_buffer* buf = 0; r300_get_texture_buffer(texture, &buf, NULL); diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 2a8e4a9f41..3b0b41e486 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -540,7 +540,7 @@ void r300_emit_texture(struct r300_context* r300, CS_LOCALS(r300); /* to emulate 1D textures through 2D ones correctly */ - if (tex->tex.height[0] == 1) { + if (tex->tex.target == PIPE_TEXTURE_1D) { filter0 &= ~R300_TX_WRAP_T_MASK; filter0 |= R300_TX_WRAP_T(R300_TX_CLAMP_TO_EDGE); } -- cgit v1.2.3 From 11180b44717943d767b64f0b658f31b6c2594aa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 30 Oct 2009 13:08:37 +0100 Subject: r300g: remove unnecessary assertions Also, correct typos in comments. --- src/gallium/drivers/r300/r300_reg.h | 4 ++-- src/gallium/drivers/r300/r300_state.c | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h index babc3c709e..1e4d3f5d70 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -862,10 +862,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_POINTSIZE_X_MASK 0xffff0000 # define R300_POINTSIZE_MAX (R300_POINTSIZE_Y_MASK / 6) -/* Blue fill color */ +/* Red fill color */ #define R500_GA_FILL_R 0x4220 -/* Blue fill color */ +/* Green fill color */ #define R500_GA_FILL_G 0x4224 /* Blue fill color */ diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 5db8c69dec..1e7fabf683 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -608,17 +608,14 @@ static void r300_set_viewport_state(struct pipe_context* pipe, r300->viewport_state->vte_control = R300_VTX_W0_FMT; if (state->scale[0] != 1.0f) { - assert(state->scale[0] != 0.0f); r300->viewport_state->xscale = state->scale[0]; r300->viewport_state->vte_control |= R300_VPORT_X_SCALE_ENA; } if (state->scale[1] != 1.0f) { - assert(state->scale[1] != 0.0f); r300->viewport_state->yscale = state->scale[1]; r300->viewport_state->vte_control |= R300_VPORT_Y_SCALE_ENA; } if (state->scale[2] != 1.0f) { - assert(state->scale[2] != 0.0f); r300->viewport_state->zscale = state->scale[2]; r300->viewport_state->vte_control |= R300_VPORT_Z_SCALE_ENA; } -- cgit v1.2.3 From 63c9450ae776ff4207422442dd8c3d9d13a05e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 30 Oct 2009 18:19:25 +0100 Subject: r300g: add precalculating of pixel pitch, add a new NPOT flag --- src/gallium/drivers/r300/r300_context.h | 8 ++++++++ src/gallium/drivers/r300/r300_emit.c | 16 ++++++++------- src/gallium/drivers/r300/r300_texture.c | 35 +++++++++++++++++++++++---------- 3 files changed, 42 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 4d73567bbe..cee0734d21 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -181,6 +181,9 @@ struct r300_texture { /* Offsets into the buffer. */ unsigned offset[PIPE_MAX_TEXTURE_LEVELS]; + /* A pitch for each mip-level */ + unsigned pitch[PIPE_MAX_TEXTURE_LEVELS]; + /* Size of one zslice or face based on the texture target */ unsigned layer_size[PIPE_MAX_TEXTURE_LEVELS]; @@ -197,6 +200,11 @@ struct r300_texture { /* Total size of this texture, in bytes. */ unsigned size; + /* Whether this texture has non-power-of-two dimensions. + * It can be either a regular texture or a rectangle one. + */ + boolean is_npot; + /* Pipe buffer backing this texture. */ struct pipe_buffer* buffer; diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 3b0b41e486..be38fbc619 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -285,21 +285,22 @@ void r300_emit_fb_state(struct r300_context* r300, struct pipe_framebuffer_state* fb) { struct r300_texture* tex; - unsigned pixpitch; + struct pipe_surface* surf; int i; CS_LOCALS(r300); BEGIN_CS((10 * fb->nr_cbufs) + (fb->zsbuf ? 10 : 0) + 4); for (i = 0; i < fb->nr_cbufs; i++) { - tex = (struct r300_texture*)fb->cbufs[i]->texture; + surf = fb->cbufs[i]; + tex = (struct r300_texture*)surf->texture; assert(tex && tex->buffer && "cbuf is marked, but NULL!"); - pixpitch = r300_texture_get_stride(tex, 0) / tex->tex.block.size; + /* XXX I still need to figure out how to set the mipmap level here */ OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0 + (4 * i), 1); OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0); OUT_CS_REG_SEQ(R300_RB3D_COLORPITCH0 + (4 * i), 1); - OUT_CS_RELOC(tex->buffer, pixpitch | + OUT_CS_RELOC(tex->buffer, tex->pitch[surf->level] | r300_translate_colorformat(tex->tex.format), 0, RADEON_GEM_DOMAIN_VRAM, 0); @@ -308,9 +309,9 @@ void r300_emit_fb_state(struct r300_context* r300, } if (fb->zsbuf) { - tex = (struct r300_texture*)fb->zsbuf->texture; + surf = fb->zsbuf; + tex = (struct r300_texture*)surf->texture; assert(tex && tex->buffer && "zsbuf is marked, but NULL!"); - pixpitch = r300_texture_get_stride(tex, 0) / tex->tex.block.size; OUT_CS_REG_SEQ(R300_ZB_DEPTHOFFSET, 1); OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0); @@ -318,7 +319,8 @@ void r300_emit_fb_state(struct r300_context* r300, OUT_CS_REG(R300_ZB_FORMAT, r300_translate_zsformat(tex->tex.format)); OUT_CS_REG_SEQ(R300_ZB_DEPTHPITCH, 1); - OUT_CS_RELOC(tex->buffer, pixpitch, 0, RADEON_GEM_DOMAIN_VRAM, 0); + OUT_CS_RELOC(tex->buffer, tex->pitch[surf->level], 0, + RADEON_GEM_DOMAIN_VRAM, 0); } OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 3e90fea6c8..7199918a84 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -33,21 +33,15 @@ static void r300_setup_texture_state(struct r300_texture* tex, boolean is_r500) { struct r300_texture_state* state = &tex->state; struct pipe_texture *pt = &tex->tex; - unsigned stride; state->format0 = R300_TX_WIDTH((pt->width[0] - 1) & 0x7ff) | R300_TX_HEIGHT((pt->height[0] - 1) & 0x7ff); - if (!util_is_power_of_two(pt->width[0]) || - !util_is_power_of_two(pt->height[0])) { - + if (tex->is_npot) { /* rectangles love this */ state->format0 |= R300_TX_PITCH_EN; - - stride = r300_texture_get_stride(tex, 0) / pt->block.size; - state->format2 = (stride - 1) & 0x1fff; - } - else { + state->format2 = (tex->pitch[0] - 1) & 0x1fff; + } else { /* power of two textures (3D, mipmaps, and no pitch) */ state->format0 |= R300_TX_DEPTH(util_logbase2(pt->depth[0]) & 0xf) | R300_TX_NUM_LEVELS(pt->last_level & 0xf); @@ -143,6 +137,12 @@ static void r300_setup_miptree(struct r300_texture* tex) tex->size = tex->offset[i] + size; tex->layer_size[i] = layer_size; + if (tex->is_npot) { + tex->pitch[i] = stride / base->block.size; + } else { + tex->pitch[i] = base->width[i]; + } + debug_printf("r300: Texture miptree: Level %d " "(%dx%dx%d px, pitch %d bytes)\n", i, base->width[i], base->height[i], base->depth[i], @@ -150,6 +150,12 @@ static void r300_setup_miptree(struct r300_texture* tex) } } +static void r300_setup_flags(struct r300_texture* tex) +{ + tex->is_npot = !util_is_power_of_two(tex->tex.width[0]) || + !util_is_power_of_two(tex->tex.height[0]); +} + /* Create a new texture. */ static struct pipe_texture* r300_texture_create(struct pipe_screen* screen, @@ -165,8 +171,8 @@ static struct pipe_texture* pipe_reference_init(&tex->tex.reference, 1); tex->tex.screen = screen; + r300_setup_flags(tex); r300_setup_miptree(tex); - r300_setup_texture_state(tex, r300_screen(screen)->caps->is_r500); tex->buffer = screen->buffer_create(screen, 1024, @@ -234,6 +240,13 @@ static struct pipe_texture* { struct r300_texture* tex; + /* Support only 2D textures without mipmaps */ + if (base->target != PIPE_TEXTURE_2D || + base->depth[0] != 1 || + base->last_level != 0) { + return NULL; + } + tex = CALLOC_STRUCT(r300_texture); if (!tex) { return NULL; @@ -244,7 +257,9 @@ static struct pipe_texture* tex->tex.screen = screen; tex->stride_override = *stride; + tex->pitch[0] = *stride / base->block.size; + r300_setup_flags(tex); r300_setup_texture_state(tex, r300_screen(screen)->caps->is_r500); pipe_buffer_reference(&tex->buffer, buffer); -- cgit v1.2.3 From a8f85dceb5e721437ba30ec540cd0bf8ee454325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 31 Oct 2009 05:34:46 +0100 Subject: r300g: fix reading from the destination buffer in blending --- src/gallium/drivers/r300/r300_state.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 1e7fabf683..3ac627e959 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -75,7 +75,9 @@ static void* r300_create_blend_state(struct pipe_context* pipe, srcRGB == PIPE_BLENDFACTOR_DST_ALPHA || srcRGB == PIPE_BLENDFACTOR_INV_DST_COLOR || srcRGB == PIPE_BLENDFACTOR_INV_DST_ALPHA || + srcA == PIPE_BLENDFACTOR_DST_COLOR || srcA == PIPE_BLENDFACTOR_DST_ALPHA || + srcA == PIPE_BLENDFACTOR_INV_DST_COLOR || srcA == PIPE_BLENDFACTOR_INV_DST_ALPHA) blend->blend_control |= R300_READ_ENABLE; -- cgit v1.2.3 From 3f60130b87a4a75f1b7cb6e0b854001bbe8f7ec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 31 Oct 2009 05:38:25 +0100 Subject: r300g: pretend NPOT support It's requires to get GL2.1, therefore, much more piglit tests can be used for testing. Figure out later how to emulate this. --- src/gallium/drivers/r300/r300_screen.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 6efa17cbaf..390b63007e 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -84,7 +84,9 @@ static int r300_get_param(struct pipe_screen* pscreen, int param) /* XXX I'm told this goes up to 16 */ return 8; case PIPE_CAP_NPOT_TEXTURES: - return 0; + /* XXX enable now to get GL2.1 API, + * figure out later how to emulate this */ + return 1; case PIPE_CAP_TWO_SIDED_STENCIL: if (r300screen->caps->is_r500) { return 1; -- cgit v1.2.3 From c9928ac3ee5dc0d10127388f9312779a6c59da7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 31 Oct 2009 07:23:00 +0100 Subject: r300g: correct the pitch calculation for smaller mipmaps --- src/gallium/drivers/r300/r300_emit.c | 2 +- src/gallium/drivers/r300/r300_texture.c | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index be38fbc619..22cf9cac2a 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -305,7 +305,7 @@ void r300_emit_fb_state(struct r300_context* r300, RADEON_GEM_DOMAIN_VRAM, 0); OUT_CS_REG(R300_US_OUT_FMT_0 + (4 * i), - r300_translate_out_fmt(fb->cbufs[i]->format)); + r300_translate_out_fmt(surf->format)); } if (fb->zsbuf) { diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 7199918a84..aea25cf71d 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -136,12 +136,7 @@ static void r300_setup_miptree(struct r300_texture* tex) tex->offset[i] = align(tex->size, 32); tex->size = tex->offset[i] + size; tex->layer_size[i] = layer_size; - - if (tex->is_npot) { - tex->pitch[i] = stride / base->block.size; - } else { - tex->pitch[i] = base->width[i]; - } + tex->pitch[i] = stride / base->block.size; debug_printf("r300: Texture miptree: Level %d " "(%dx%dx%d px, pitch %d bytes)\n", -- cgit v1.2.3 From 73b45b06690c95cf24cb6f9a81d61269ad51f9dd Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Sat, 31 Oct 2009 21:23:37 +1000 Subject: radeon: add missing include --- src/mesa/drivers/dri/radeon/radeon_texstate.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index d6e8d4984a..429977a8bc 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -39,6 +39,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/context.h" #include "main/macros.h" #include "main/teximage.h" +#include "main/texstate.h" #include "main/texobj.h" #include "main/enums.h" -- cgit v1.2.3 From 525f529d138168386224136dc45abb858677bac7 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 31 Oct 2009 11:25:48 +0100 Subject: nv50: make MRTs work We have to indicate to the hw whether the FP exports multiple colour results. Method 0x121c is used to specify the number of RTs. Also deactivate zeta explicitly if there's no zsbuf. --- src/gallium/drivers/nv50/nv50_program.c | 4 ++++ src/gallium/drivers/nv50/nv50_state_validate.c | 11 +++++++++++ 2 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 9ccc4f5a16..c3edc02cb5 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -2644,6 +2644,10 @@ nv50_program_tx_prep(struct nv50_pc *pc) pc->result[2].rhw = rid; p->cfg.high_result = rid; + + /* separate/different colour results for MRTs ? */ + if (pc->result_nr - (p->info.writes_z ? 1 : 0) > 1) + p->cfg.regs[2] |= 1; } if (pc->immd_nr) { diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index 956a700615..a13d64b7fa 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -37,6 +37,14 @@ nv50_state_validate_fb(struct nv50_context *nv50) struct pipe_framebuffer_state *fb = &nv50->framebuffer; unsigned i, w, h, gw = 0; + /* Set nr of active RTs. Don't know what 0xfac6880 does, but + * at least 0x880 was required to draw to more than 1 RT. + * In some special cases, 0xfac6880 is not used, we probably + * don't hit any of these though. + */ + so_method(so, tesla, 0x121c, 1); + so_data (so, 0x0fac6880 | fb->nr_cbufs); + for (i = 0; i < fb->nr_cbufs; i++) { struct pipe_texture *pt = fb->cbufs[i]->texture; struct nouveau_bo *bo = nv50_miptree(pt)->base.bo; @@ -121,6 +129,9 @@ nv50_state_validate_fb(struct nv50_context *nv50) so_data (so, fb->zsbuf->width); so_data (so, fb->zsbuf->height); so_data (so, 0x00010001); + } else { + so_method(so, tesla, 0x1538, 1); + so_data (so, 0); } so_method(so, tesla, NV50TCL_VIEWPORT_HORIZ, 2); -- cgit v1.2.3 From 9831e1f76cd020e1cde2b13e03149415319a8135 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 31 Oct 2009 13:38:22 +0100 Subject: nv50: use SIFC also for shader upload Adds a more generic SIFC transfer function. --- src/gallium/drivers/nv50/nv50_context.h | 11 +++- src/gallium/drivers/nv50/nv50_program.c | 79 +++++++++-------------------- src/gallium/drivers/nv50/nv50_transfer.c | 86 ++++++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+), 56 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index 33667e8765..890defb90c 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -196,7 +196,8 @@ extern void nv50_clear(struct pipe_context *pipe, unsigned buffers, extern void nv50_vertprog_validate(struct nv50_context *nv50); extern void nv50_fragprog_validate(struct nv50_context *nv50); extern void nv50_linkage_validate(struct nv50_context *nv50); -extern void nv50_program_destroy(struct nv50_context *nv50, struct nv50_program *p); +extern void nv50_program_destroy(struct nv50_context *nv50, + struct nv50_program *p); /* nv50_state_validate.c */ extern boolean nv50_state_validate(struct nv50_context *nv50); @@ -210,4 +211,12 @@ extern void nv50_so_init_sifc(struct nv50_context *nv50, /* nv50_tex.c */ extern void nv50_tex_validate(struct nv50_context *); +/* nv50_transfer.c */ +extern void +nv50_upload_sifc(struct nv50_context *nv50, + struct nouveau_bo *bo, unsigned dst_offset, unsigned reloc, + unsigned dst_format, int dst_w, int dst_h, int dst_pitch, + void *src, unsigned src_format, int src_pitch, + int x, int y, int w, int h, int cpp); + #endif diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index c3edc02cb5..faf638949f 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -2980,11 +2980,8 @@ static void nv50_program_validate_code(struct nv50_context *nv50, struct nv50_program *p) { struct nouveau_channel *chan = nv50->screen->base.channel; - struct nouveau_grobj *tesla = nv50->screen->tesla; struct nv50_program_exec *e; - struct nouveau_stateobj *so; - const unsigned flags = NOUVEAU_BO_VRAM | NOUVEAU_BO_WR; - unsigned start, count, *up, *ptr; + uint32_t *up, i; boolean upload = FALSE; if (!p->bo) { @@ -2999,32 +2996,37 @@ nv50_program_validate_code(struct nv50_context *nv50, struct nv50_program *p) if (!upload) return; - for (e = p->exec_head; e; e = e->next) { + up = MALLOC(p->exec_size * 4); + + for (i = 0, e = p->exec_head; e; e = e->next) { unsigned ei, ci, bs; - if (e->param.index < 0) - continue; + if (e->param.index >= 0 && e->param.mask) { + bs = (e->inst[1] >> 22) & 0x07; + assert(bs < 2); + ei = e->param.shift >> 5; + ci = e->param.index; + if (bs == 0) + ci += p->data[bs]->start; - if (e->param.mask == 0) { + e->inst[ei] &= ~e->param.mask; + e->inst[ei] |= (ci << e->param.shift); + } else + if (e->param.index >= 0) { + /* zero mask means param is a jump/branch offset */ assert(!(e->param.index & 1)); /* seem to be 8 byte steps */ ei = (e->param.index >> 1) + 0 /* START_ID */; e->inst[0] &= 0xf0000fff; e->inst[0] |= ei << 12; - continue; } - bs = (e->inst[1] >> 22) & 0x07; - assert(bs < 2); - ei = e->param.shift >> 5; - ci = e->param.index; - if (bs == 0) - ci += p->data[bs]->start; - - e->inst[ei] &= ~e->param.mask; - e->inst[ei] |= (ci << e->param.shift); + up[i++] = e->inst[0]; + if (is_long(e)) + up[i++] = e->inst[1]; } + assert(i == p->exec_size); if (p->data[0]) p->data_start[0] = p->data[0]->start; @@ -3037,45 +3039,12 @@ nv50_program_validate_code(struct nv50_context *nv50, struct nv50_program *p) NOUVEAU_ERR("0x%08x\n", e->inst[1]); } #endif - - up = ptr = MALLOC(p->exec_size * 4); - for (e = p->exec_head; e; e = e->next) { - *(ptr++) = e->inst[0]; - if (is_long(e)) - *(ptr++) = e->inst[1]; - } - - so = so_new(4,2); - so_method(so, nv50->screen->tesla, NV50TCL_CB_DEF_ADDRESS_HIGH, 3); - so_reloc (so, p->bo, 0, flags | NOUVEAU_BO_HIGH, 0, 0); - so_reloc (so, p->bo, 0, flags | NOUVEAU_BO_LOW, 0, 0); - so_data (so, (NV50_CB_PUPLOAD << 16) | 0x0800); //(p->exec_size * 4)); - - start = 0; count = p->exec_size; - while (count) { - struct nouveau_channel *chan = nv50->screen->base.channel; - unsigned nr; - - so_emit(chan, so); - - nr = MIN2(count, 2047); - nr = MIN2(chan->pushbuf->remaining, nr); - if (chan->pushbuf->remaining < (nr + 3)) { - FIRE_RING(chan); - continue; - } - - BEGIN_RING(chan, tesla, NV50TCL_CB_ADDR, 1); - OUT_RING (chan, (start << 8) | NV50_CB_PUPLOAD); - BEGIN_RING(chan, tesla, NV50TCL_CB_DATA(0) | 0x40000000, nr); - OUT_RINGp (chan, up + start, nr); - - start += nr; - count -= nr; - } + nv50_upload_sifc(nv50, p->bo, 0, NOUVEAU_BO_VRAM, + NV50_2D_DST_FORMAT_R8_UNORM, 65536, 1, 262144, + up, NV50_2D_SIFC_FORMAT_R8_UNORM, 0, + 0, 0, p->exec_size * 4, 1, 1); FREE(up); - so_ref(NULL, &so); } void diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c index 9c289026bb..f1eb672336 100644 --- a/src/gallium/drivers/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nv50/nv50_transfer.c @@ -237,3 +237,89 @@ nv50_transfer_init_screen_functions(struct pipe_screen *pscreen) pscreen->transfer_map = nv50_transfer_map; pscreen->transfer_unmap = nv50_transfer_unmap; } + +void +nv50_upload_sifc(struct nv50_context *nv50, + struct nouveau_bo *bo, unsigned dst_offset, unsigned reloc, + unsigned dst_format, int dst_w, int dst_h, int dst_pitch, + void *src, unsigned src_format, int src_pitch, + int x, int y, int w, int h, int cpp) +{ + struct nouveau_channel *chan = nv50->screen->base.channel; + struct nouveau_grobj *eng2d = nv50->screen->eng2d; + struct nouveau_grobj *tesla = nv50->screen->tesla; + unsigned line_dwords = (w * cpp + 3) / 4; + + reloc |= NOUVEAU_BO_WR; + + WAIT_RING (chan, 32); + + if (bo->tile_flags) { + BEGIN_RING(chan, eng2d, NV50_2D_DST_FORMAT, 5); + OUT_RING (chan, dst_format); + OUT_RING (chan, 0); + OUT_RING (chan, bo->tile_mode << 4); + OUT_RING (chan, 1); + OUT_RING (chan, 0); + } else { + BEGIN_RING(chan, eng2d, NV50_2D_DST_FORMAT, 2); + OUT_RING (chan, dst_format); + OUT_RING (chan, 1); + BEGIN_RING(chan, eng2d, NV50_2D_DST_PITCH, 1); + OUT_RING (chan, dst_pitch); + } + + BEGIN_RING(chan, eng2d, NV50_2D_DST_WIDTH, 4); + OUT_RING (chan, dst_w); + OUT_RING (chan, dst_h); + OUT_RELOCh(chan, bo, dst_offset, reloc); + OUT_RELOCl(chan, bo, dst_offset, reloc); + + /* NV50_2D_OPERATION_SRCCOPY assumed already set */ + + BEGIN_RING(chan, eng2d, NV50_2D_SIFC_UNK0800, 2); + OUT_RING (chan, 0); + OUT_RING (chan, src_format); + BEGIN_RING(chan, eng2d, NV50_2D_SIFC_WIDTH, 10); + OUT_RING (chan, w); + OUT_RING (chan, h); + OUT_RING (chan, 0); + OUT_RING (chan, 1); + OUT_RING (chan, 0); + OUT_RING (chan, 1); + OUT_RING (chan, 0); + OUT_RING (chan, x); + OUT_RING (chan, 0); + OUT_RING (chan, y); + + while (h--) { + const uint32_t *p = src; + unsigned count = line_dwords; + + while (count) { + unsigned nr = MIN2(count, 1792); + + if (chan->pushbuf->remaining <= nr) { + FIRE_RING (chan); + + BEGIN_RING(chan, eng2d, + NV50_2D_DST_ADDRESS_HIGH, 2); + OUT_RELOCh(chan, bo, dst_offset, reloc); + OUT_RELOCl(chan, bo, dst_offset, reloc); + } + assert(chan->pushbuf->remaining > nr); + + BEGIN_RING(chan, eng2d, + NV50_2D_SIFC_DATA | (2 << 29), nr); + OUT_RINGp (chan, p, nr); + + p += nr; + count -= nr; + } + + src += src_pitch; + } + + BEGIN_RING(chan, tesla, 0x1440, 1); + OUT_RING (chan, 0); +} -- cgit v1.2.3 From 91232b7004d7a9fbf4f99bb9ec4e5eea8e1c6eef Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Sat, 24 Oct 2009 17:36:48 -0400 Subject: nouveau: Support X8R8G8B8 textures on nv30, nv40 and RTs on nv10-nv40. --- src/gallium/drivers/nv04/nv04_surface_2d.c | 1 + src/gallium/drivers/nv10/nv10_state_emit.c | 3 +++ src/gallium/drivers/nv20/nv20_state_emit.c | 3 +++ src/gallium/drivers/nv30/nv30_fragtex.c | 1 + src/gallium/drivers/nv30/nv30_state_fb.c | 3 +++ src/gallium/drivers/nv40/nv40_fragtex.c | 1 + src/gallium/drivers/nv40/nv40_state_fb.c | 3 +++ 7 files changed, 15 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nv04/nv04_surface_2d.c b/src/gallium/drivers/nv04/nv04_surface_2d.c index 8c7eb367e2..8be134b83d 100644 --- a/src/gallium/drivers/nv04/nv04_surface_2d.c +++ b/src/gallium/drivers/nv04/nv04_surface_2d.c @@ -42,6 +42,7 @@ nv04_rect_format(enum pipe_format format) case PIPE_FORMAT_A8L8_UNORM: case PIPE_FORMAT_Z16_UNORM: return NV04_GDI_RECTANGLE_TEXT_COLOR_FORMAT_A16R5G6B5; + case PIPE_FORMAT_X8R8G8B8_UNORM: case PIPE_FORMAT_A8R8G8B8_UNORM: case PIPE_FORMAT_Z24S8_UNORM: case PIPE_FORMAT_Z24X8_UNORM: diff --git a/src/gallium/drivers/nv10/nv10_state_emit.c b/src/gallium/drivers/nv10/nv10_state_emit.c index d8691ef9c6..2577ab73b5 100644 --- a/src/gallium/drivers/nv10/nv10_state_emit.c +++ b/src/gallium/drivers/nv10/nv10_state_emit.c @@ -129,6 +129,9 @@ static void nv10_state_emit_framebuffer(struct nv10_context* nv10) rt_format = NV10TCL_RT_FORMAT_TYPE_LINEAR; switch (colour_format) { + case PIPE_FORMAT_X8R8G8B8_UNORM: + rt_format |= NV10TCL_RT_FORMAT_COLOR_X8R8G8B8; + break; case PIPE_FORMAT_A8R8G8B8_UNORM: case 0: rt_format |= NV10TCL_RT_FORMAT_COLOR_A8R8G8B8; diff --git a/src/gallium/drivers/nv20/nv20_state_emit.c b/src/gallium/drivers/nv20/nv20_state_emit.c index 4042f46d05..0122b1c2cd 100644 --- a/src/gallium/drivers/nv20/nv20_state_emit.c +++ b/src/gallium/drivers/nv20/nv20_state_emit.c @@ -135,6 +135,9 @@ static void nv20_state_emit_framebuffer(struct nv20_context* nv20) rt_format = NV20TCL_RT_FORMAT_TYPE_LINEAR | 0x20; switch (colour_format) { + case PIPE_FORMAT_X8R8G8B8_UNORM: + rt_format |= NV20TCL_RT_FORMAT_COLOR_X8R8G8B8; + break; case PIPE_FORMAT_A8R8G8B8_UNORM: case 0: rt_format |= NV20TCL_RT_FORMAT_COLOR_A8R8G8B8; diff --git a/src/gallium/drivers/nv30/nv30_fragtex.c b/src/gallium/drivers/nv30/nv30_fragtex.c index 3dd636f4ee..dca760cae6 100644 --- a/src/gallium/drivers/nv30/nv30_fragtex.c +++ b/src/gallium/drivers/nv30/nv30_fragtex.c @@ -21,6 +21,7 @@ struct nv30_texture_format { static struct nv30_texture_format nv30_texture_formats[] = { + _(X8R8G8B8_UNORM, A8R8G8B8, S1, S1, S1, ONE, X, Y, Z, W), _(A8R8G8B8_UNORM, A8R8G8B8, S1, S1, S1, S1, X, Y, Z, W), _(A1R5G5B5_UNORM, A1R5G5B5, S1, S1, S1, S1, X, Y, Z, W), _(A4R4G4B4_UNORM, A4R4G4B4, S1, S1, S1, S1, X, Y, Z, W), diff --git a/src/gallium/drivers/nv30/nv30_state_fb.c b/src/gallium/drivers/nv30/nv30_state_fb.c index 4d6a67e56d..6f6d1740d6 100644 --- a/src/gallium/drivers/nv30/nv30_state_fb.c +++ b/src/gallium/drivers/nv30/nv30_state_fb.c @@ -66,6 +66,9 @@ nv30_state_framebuffer_validate(struct nv30_context *nv30) } switch (colour_format) { + case PIPE_FORMAT_X8R8G8B8_UNORM: + rt_format |= NV34TCL_RT_FORMAT_COLOR_X8R8G8B8; + break; case PIPE_FORMAT_A8R8G8B8_UNORM: case 0: rt_format |= NV34TCL_RT_FORMAT_COLOR_A8R8G8B8; diff --git a/src/gallium/drivers/nv40/nv40_fragtex.c b/src/gallium/drivers/nv40/nv40_fragtex.c index f6cdf31dfe..e2ec57564d 100644 --- a/src/gallium/drivers/nv40/nv40_fragtex.c +++ b/src/gallium/drivers/nv40/nv40_fragtex.c @@ -23,6 +23,7 @@ struct nv40_texture_format { static struct nv40_texture_format nv40_texture_formats[] = { + _(X8R8G8B8_UNORM, A8R8G8B8, S1, S1, S1, ONE, X, Y, Z, W, 0, 0, 0, 0), _(A8R8G8B8_UNORM, A8R8G8B8, S1, S1, S1, S1, X, Y, Z, W, 0, 0, 0, 0), _(A1R5G5B5_UNORM, A1R5G5B5, S1, S1, S1, S1, X, Y, Z, W, 0, 0, 0, 0), _(A4R4G4B4_UNORM, A4R4G4B4, S1, S1, S1, S1, X, Y, Z, W, 0, 0, 0, 0), diff --git a/src/gallium/drivers/nv40/nv40_state_fb.c b/src/gallium/drivers/nv40/nv40_state_fb.c index c2f739157a..1c7a7cd64f 100644 --- a/src/gallium/drivers/nv40/nv40_state_fb.c +++ b/src/gallium/drivers/nv40/nv40_state_fb.c @@ -57,6 +57,9 @@ nv40_state_framebuffer_validate(struct nv40_context *nv40) rt_format = NV40TCL_RT_FORMAT_TYPE_LINEAR; switch (colour_format) { + case PIPE_FORMAT_X8R8G8B8_UNORM: + rt_format |= NV40TCL_RT_FORMAT_COLOR_X8R8G8B8; + break; case PIPE_FORMAT_A8R8G8B8_UNORM: case 0: rt_format |= NV40TCL_RT_FORMAT_COLOR_A8R8G8B8; -- cgit v1.2.3 From 1cc16e1b831cef8e1573cc998cee3e55179bb830 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 31 Oct 2009 20:46:59 +0100 Subject: nv50: fix textures with block size != cpp First, using width * block size as pitch is evidently wrong if a block contains more than 1 texel. For tiled textures, since a block occupies a contiguous area of memory, y addressing in m2mf has to be done by block index, not the y coordinate itself. This should fix compressed textures. --- src/gallium/drivers/nv50/nv50_miptree.c | 35 ++++++++++------------ src/gallium/drivers/nv50/nv50_transfer.c | 50 ++++++++++++++++++++------------ 2 files changed, 48 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c index 93479a0314..229a59cb74 100644 --- a/src/gallium/drivers/nv50/nv50_miptree.c +++ b/src/gallium/drivers/nv50/nv50_miptree.c @@ -26,6 +26,16 @@ #include "nv50_context.h" +static INLINE uint32_t +get_tile_mode(unsigned ny) +{ + if (ny > 32) return 4; + if (ny > 16) return 3; + if (ny > 8) return 2; + if (ny > 4) return 1; + return 0; +} + static struct pipe_texture * nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp) { @@ -34,7 +44,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp) struct pipe_texture *pt = &mt->base.base; unsigned width = tmp->width[0], height = tmp->height[0]; unsigned depth = tmp->depth[0]; - uint32_t tile_mode, tile_flags, tile_h; + uint32_t tile_flags; int ret, i, l; *pt = *tmp; @@ -57,13 +67,6 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp) break; } - if (pt->height[0] > 32) tile_mode = 4; - else if (pt->height[0] > 16) tile_mode = 3; - else if (pt->height[0] > 8) tile_mode = 2; - else if (pt->height[0] > 4) tile_mode = 1; - else tile_mode = 0; - tile_h = 1 << (tile_mode + 2); - switch (pt->target) { case PIPE_TEXTURE_3D: mt->image_nr = pt->depth[0]; @@ -86,28 +89,22 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp) pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height); lvl->image_offset = CALLOC(mt->image_nr, sizeof(int)); - lvl->pitch = align(pt->width[l] * pt->block.size, 64); - lvl->tile_mode = tile_mode; + lvl->pitch = align(pt->nblocksx[l] * pt->block.size, 64); + lvl->tile_mode = get_tile_mode(pt->nblocksy[l]); width = MAX2(1, width >> 1); height = MAX2(1, height >> 1); depth = MAX2(1, depth >> 1); - - if (tile_mode && height <= (tile_h >> 1)) { - tile_mode--; - tile_h >>= 1; - } } for (i = 0; i < mt->image_nr; i++) { for (l = 0; l <= pt->last_level; l++) { struct nv50_miptree_level *lvl = &mt->level[l]; int size; - tile_h = 1 << (lvl->tile_mode + 2); + unsigned tile_ny = 1 << (lvl->tile_mode + 2); - size = align(pt->width[l], 8) * pt->block.size; - size = align(size, 64); - size *= align(pt->height[l], tile_h); + size = align(pt->nblocksx[l] * pt->block.size, 64); + size *= align(pt->nblocksy[l], tile_ny); lvl->image_offset[i] = mt->total_size; diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c index f1eb672336..9c008090b8 100644 --- a/src/gallium/drivers/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nv50/nv50_transfer.c @@ -124,7 +124,7 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, struct nv50_miptree *mt = nv50_miptree(pt); struct nv50_miptree_level *lvl = &mt->level[level]; struct nv50_transfer *tx; - unsigned image = 0; + unsigned nx, ny, image = 0; int ret; if (pt->target == PIPE_TEXTURE_CUBE) @@ -142,9 +142,16 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->base.width = w; tx->base.height = h; tx->base.block = pt->block; - tx->base.nblocksx = pt->nblocksx[level]; - tx->base.nblocksy = pt->nblocksy[level]; - tx->base.stride = (w * pt->block.size); + if (!pt->nblocksx[level]) { + tx->base.nblocksx = pf_get_nblocksx(&pt->block, + pt->width[level]); + tx->base.nblocksy = pf_get_nblocksy(&pt->block, + pt->height[level]); + } else { + tx->base.nblocksx = pt->nblocksx[level]; + tx->base.nblocksy = pt->nblocksy[level]; + } + tx->base.stride = tx->base.nblocksx * pt->block.size; tx->base.usage = usage; tx->level_pitch = lvl->pitch; @@ -152,24 +159,28 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->level_height = mt->base.base.height[level]; tx->level_offset = lvl->image_offset[image]; tx->level_tiling = lvl->tile_mode; - tx->level_x = x; - tx->level_y = y; + tx->level_x = pf_get_nblocksx(&tx->base.block, x); + tx->level_y = pf_get_nblocksy(&tx->base.block, y); ret = nouveau_bo_new(dev, NOUVEAU_BO_GART | NOUVEAU_BO_MAP, 0, - w * pt->block.size * h, &tx->bo); + tx->base.nblocksy * tx->base.stride, &tx->bo); if (ret) { FREE(tx); return NULL; } if (usage & PIPE_TRANSFER_READ) { + nx = pf_get_nblocksx(&tx->base.block, tx->base.width); + ny = pf_get_nblocksy(&tx->base.block, tx->base.height); + nv50_transfer_rect_m2mf(pscreen, mt->base.bo, tx->level_offset, tx->level_pitch, tx->level_tiling, x, y, - tx->level_width, tx->level_height, - tx->bo, 0, tx->base.stride, - tx->bo->tile_mode, 0, 0, - tx->base.width, tx->base.height, - tx->base.block.size, w, h, + tx->base.nblocksx, tx->base.nblocksy, + tx->bo, 0, + tx->base.stride, tx->bo->tile_mode, + 0, 0, + tx->base.nblocksx, tx->base.nblocksy, + tx->base.block.size, nx, ny, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART, NOUVEAU_BO_GART); } @@ -183,17 +194,20 @@ nv50_transfer_del(struct pipe_transfer *ptx) struct nv50_transfer *tx = (struct nv50_transfer *)ptx; struct nv50_miptree *mt = nv50_miptree(ptx->texture); + unsigned nx = pf_get_nblocksx(&tx->base.block, tx->base.width); + unsigned ny = pf_get_nblocksy(&tx->base.block, tx->base.height); + if (ptx->usage & PIPE_TRANSFER_WRITE) { struct pipe_screen *pscreen = ptx->texture->screen; - nv50_transfer_rect_m2mf(pscreen, tx->bo, 0, tx->base.stride, - tx->bo->tile_mode, 0, 0, - tx->base.width, tx->base.height, + nv50_transfer_rect_m2mf(pscreen, tx->bo, 0, + tx->base.stride, tx->bo->tile_mode, + 0, 0, + tx->base.nblocksx, tx->base.nblocksy, mt->base.bo, tx->level_offset, tx->level_pitch, tx->level_tiling, tx->level_x, tx->level_y, - tx->level_width, tx->level_height, - tx->base.block.size, tx->base.width, - tx->base.height, + tx->base.nblocksx, tx->base.nblocksy, + tx->base.block.size, nx, ny, NOUVEAU_BO_GART, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART); } -- cgit v1.2.3 From 99e308a0e0479971fe3a8a0aba586e19456e4b88 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sun, 1 Nov 2009 14:27:35 +0100 Subject: nv50: implement TGSI_OPCODE_AND/OR/XOR Will use AND for gl_FrontFacing, the face input is either 0 or 0xffffffff. --- src/gallium/drivers/nv50/nv50_program.c | 47 +++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index faf638949f..5944a0b7ff 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -890,6 +890,43 @@ emit_sub(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src0, src1->neg ^= 1; } +static void +emit_bitop2(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src0, + struct nv50_reg *src1, unsigned op) +{ + struct nv50_program_exec *e = exec(pc); + + e->inst[0] = 0xd0000000; + set_long(pc, e); + + check_swap_src_0_1(pc, &src0, &src1); + set_dst(pc, dst, e); + set_src_0(pc, src0, e); + + if (op != TGSI_OPCODE_AND && op != TGSI_OPCODE_OR && + op != TGSI_OPCODE_XOR) + assert(!"invalid bit op"); + + if (src1->type == P_IMMD && src0->type == P_TEMP && pc->allow32) { + set_immd(pc, src1, e); + if (op == TGSI_OPCODE_OR) + e->inst[0] |= 0x0100; + else + if (op == TGSI_OPCODE_XOR) + e->inst[0] |= 0x8000; + } else { + set_src_1(pc, src1, e); + e->inst[1] |= 0x04000000; /* 32 bit */ + if (op == TGSI_OPCODE_OR) + e->inst[1] |= 0x4000; + else + if (op == TGSI_OPCODE_XOR) + e->inst[1] |= 0x8000; + } + + emit(pc, e); +} + static void emit_mad(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src0, struct nv50_reg *src1, struct nv50_reg *src2) @@ -1838,6 +1875,16 @@ nv50_program_tx_insn(struct nv50_pc *pc, emit_add(pc, dst[c], src[0][c], src[1][c]); } break; + case TGSI_OPCODE_AND: + case TGSI_OPCODE_XOR: + case TGSI_OPCODE_OR: + for (c = 0; c < 4; c++) { + if (!(mask & (1 << c))) + continue; + emit_bitop2(pc, dst[c], src[0][c], src[1][c], + inst->Instruction.Opcode); + } + break; case TGSI_OPCODE_ARL: assert(src[0][0]); temp = temp_temp(pc); -- cgit v1.2.3 From 496c9eaacfabc4df4e6fb5ba230e60dc660554c8 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sun, 1 Nov 2009 14:04:54 +0100 Subject: nv50: make IF condition safe Don't assume that a SET that writes to IF's argument directly precedes the IF. --- src/gallium/drivers/nv50/nv50_program.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 5944a0b7ff..66190f070d 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -2026,7 +2026,9 @@ nv50_program_tx_insn(struct nv50_pc *pc, case TGSI_OPCODE_IF: /* emitting a join_at may not be necessary */ assert(pc->if_lvl < MAX_IF_DEPTH); - set_pred_wr(pc, 1, 0, pc->if_cond); + /* set_pred_wr(pc, 1, 0, pc->if_cond); */ + emit_cvt(pc, NULL, src[0][0], 0, CVTOP_ABS | CVTOP_RN, + CVT_F32_F32); emit_branch(pc, 0, 2, &pc->br_join[pc->if_lvl]); pc->if_insn[pc->if_lvl++] = pc->p->exec_tail; terminate_mbb(pc); -- cgit v1.2.3 From 5de8f9744015d3645a12dac244ad47daf8481dd2 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sun, 1 Nov 2009 14:15:30 +0100 Subject: nv50: handle TGSI_SEMANTIC_FACE --- src/gallium/drivers/nv50/nv50_program.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 66190f070d..27827c7ecf 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -2463,6 +2463,23 @@ load_interpolant(struct nv50_pc *pc, struct nv50_reg *reg) emit_interp(pc, reg, iv, mode); } +/* The face input is always at v[255] (varying space), with a + * value of 0 for back-facing, and 0xffffffff for front-facing. + */ +static void +load_frontfacing(struct nv50_pc *pc, struct nv50_reg *a) +{ + struct nv50_reg *one = alloc_immd(pc, 1.0f); + + assert(a->rhw == -1); + alloc_reg(pc, a); /* do this before rhw is set */ + a->rhw = 255; + load_interpolant(pc, a); + emit_bitop2(pc, a, a, one, TGSI_OPCODE_AND); + + FREE(one); +} + static boolean nv50_program_tx_prep(struct nv50_pc *pc) { @@ -2607,6 +2624,8 @@ nv50_program_tx_prep(struct nv50_pc *pc) int rid, aid; unsigned n = 0, m = pc->attr_nr - flat_nr; + pc->allow32 = TRUE; + int base = (TGSI_SEMANTIC_POSITION == p->info.input_semantic_name[0]) ? 0 : 1; @@ -2635,6 +2654,12 @@ nv50_program_tx_prep(struct nv50_pc *pc) p->cfg.io[n].hw = rid = aid; i = p->cfg.io[n].id_fp; + if (p->info.input_semantic_name[n] == + TGSI_SEMANTIC_FACE) { + load_frontfacing(pc, &pc->attr[i * 4]); + continue; + } + for (c = 0; c < 4; ++c) { if (!pc->attr[i * 4 + c].acc) continue; -- cgit v1.2.3 From cab749a1d0046f59ca10f96d2e6343404e5f2616 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 1 Nov 2009 09:24:02 -0800 Subject: r300g: Adopt osiris' PSC data and swizzle. A fair amount more flexible and easier to maintain. --- src/gallium/drivers/r300/r300_state_inlines.h | 128 ++++++++++++++++++-------- 1 file changed, 88 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index ec11a41253..176e59f281 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -402,58 +402,106 @@ static INLINE uint32_t r300_translate_gb_pipes(int pipe_count) return 0; } +/* Utility function to count the number of components in RGBAZS formats. + * XXX should go to util or p_format.h */ +static INLINE unsigned pf_component_count(enum pipe_format format) { + unsigned count = 0; + + if (pf_layout(format) != PIPE_FORMAT_LAYOUT_RGBAZS) { + return count; + } + + if (pf_size_x(format)) { + count++; + } + if (pf_size_y(format)) { + count++; + } + if (pf_size_z(format)) { + count++; + } + if (pf_size_w(format)) { + count++; + } + + return count; +} + /* Translate pipe_formats into PSC vertex types. */ static INLINE uint16_t r300_translate_vertex_data_type(enum pipe_format format) { - switch (format) { - case PIPE_FORMAT_R32_FLOAT: - return R300_DATA_TYPE_FLOAT_1; - break; - case PIPE_FORMAT_R32G32_FLOAT: - return R300_DATA_TYPE_FLOAT_2; - break; - case PIPE_FORMAT_R32G32B32_FLOAT: - return R300_DATA_TYPE_FLOAT_3; - break; - case PIPE_FORMAT_R32G32B32A32_FLOAT: - return R300_DATA_TYPE_FLOAT_4; - break; - case PIPE_FORMAT_R8G8B8A8_UNORM: - return R300_DATA_TYPE_BYTE | - R300_NORMALIZE; + uint32_t result = 0; + unsigned components = pf_component_count(format); + + if (pf_layout(format) != PIPE_FORMAT_LAYOUT_RGBAZS) { + debug_printf("r300: Bad format %s in %s\n", pf_name(format), + __FUNCTION__); + return 0; + } + + switch (pf_type(format)) { + /* Half-floats, floats, doubles */ + case PIPE_FORMAT_TYPE_FLOAT: + switch (pf_size_x(format)) { + case 4: + result = R300_DATA_TYPE_FLOAT_1 + (components - 1); + break; + default: + assert(0); + } + break; + /* Normalized unsigned ints */ + case PIPE_FORMAT_TYPE_UNORM: + /* Normalized signed ints */ + case PIPE_FORMAT_TYPE_SNORM: + /* Non-normalized unsigned ints */ + case PIPE_FORMAT_TYPE_USCALED: + /* Non-normalized signed ints */ + case PIPE_FORMAT_TYPE_SSCALED: + switch (pf_size_x(format)) { + case 1: + result = R300_DATA_TYPE_BYTE; + break; + case 2: + if (components > 2) { + result = R300_DATA_TYPE_SHORT_4; + } else { + result = R300_DATA_TYPE_SHORT_2; + } + break; + default: + assert(0); + } break; default: - debug_printf("r300: Implementation error: " - "Bad vertex data format %s!\n", pf_name(format)); assert(0); - break; } - return 0; + + if (pf_type(format) == PIPE_FORMAT_TYPE_SSCALED) { + result |= R300_SIGNED; + } else if (pf_type(format) == PIPE_FORMAT_TYPE_UNORM) { + result |= R300_NORMALIZE; + } else if (pf_type(format) == PIPE_FORMAT_TYPE_SNORM) { + result |= (R300_SIGNED | R300_NORMALIZE); + } + + return result; } static INLINE uint16_t r300_translate_vertex_data_swizzle(enum pipe_format format) { - switch (format) { - case PIPE_FORMAT_R32_FLOAT: - return R300_VAP_SWIZZLE_X001; - break; - case PIPE_FORMAT_R32G32_FLOAT: - return R300_VAP_SWIZZLE_XY01; - break; - case PIPE_FORMAT_R32G32B32_FLOAT: - return R300_VAP_SWIZZLE_XYZ1; - break; - case PIPE_FORMAT_R32G32B32A32_FLOAT: - case PIPE_FORMAT_R8G8B8A8_UNORM: - return R300_VAP_SWIZZLE_XYZW; - break; - default: - debug_printf("r300: Implementation error: " - "Bad vertex data format %s!\n", pf_name(format)); - assert(0); - break; + + if (pf_layout(format) != PIPE_FORMAT_LAYOUT_RGBAZS) { + debug_printf("r300: Bad format %s in %s\n", pf_name(format), + __FUNCTION__); + return 0; } - return 0; + + return ((pf_swizzle_x(format) << R300_SWIZZLE_SELECT_X_SHIFT) | + (pf_swizzle_y(format) << R300_SWIZZLE_SELECT_Y_SHIFT) | + (pf_swizzle_z(format) << R300_SWIZZLE_SELECT_Z_SHIFT) | + (pf_swizzle_w(format) << R300_SWIZZLE_SELECT_W_SHIFT) | + (0xf << R300_WRITE_ENA_SHIFT)); } #endif /* R300_STATE_INLINES_H */ -- cgit v1.2.3 From 2db46af8758bf77a2748460f617d0ead5b08a454 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 21 Oct 2009 21:17:43 +0200 Subject: r300g: split constant buffer and shader emittion --- src/gallium/drivers/r300/r300_context.c | 2 - src/gallium/drivers/r300/r300_context.h | 16 ++-- src/gallium/drivers/r300/r300_emit.c | 157 ++++++++++++++++++++------------ src/gallium/drivers/r300/r300_emit.h | 21 +++-- src/gallium/drivers/r300/r300_state.c | 54 +++++------ 5 files changed, 152 insertions(+), 98 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 02f201b49a..f974147ea4 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -22,8 +22,6 @@ #include "draw/draw_context.h" -#include "pipe/p_inlines.h" - #include "tgsi/tgsi_scan.h" #include "util/u_hash_table.h" diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index cee0734d21..b1738452de 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -26,6 +26,7 @@ #include "draw/draw_vertex.h" #include "pipe/p_context.h" +#include "pipe/p_inlines.h" struct r300_fragment_shader; struct r300_vertex_shader; @@ -119,10 +120,10 @@ struct r300_ztop_state { #define R300_NEW_BLEND 0x00000001 #define R300_NEW_BLEND_COLOR 0x00000002 #define R300_NEW_CLIP 0x00000004 -#define R300_NEW_CONSTANTS 0x00000008 -#define R300_NEW_DSA 0x00000010 -#define R300_NEW_FRAMEBUFFERS 0x00000020 -#define R300_NEW_FRAGMENT_SHADER 0x00000040 +#define R300_NEW_DSA 0x00000008 +#define R300_NEW_FRAMEBUFFERS 0x00000010 +#define R300_NEW_FRAGMENT_SHADER 0x00000020 +#define R300_NEW_FRAGMENT_SHADER_CONSTANTS 0x00000040 #define R300_NEW_RASTERIZER 0x00000080 #define R300_NEW_RS_BLOCK 0x00000100 #define R300_NEW_SAMPLER 0x00000200 @@ -132,9 +133,10 @@ struct r300_ztop_state { #define R300_ANY_NEW_TEXTURES 0x03fc0000 #define R300_NEW_VERTEX_FORMAT 0x04000000 #define R300_NEW_VERTEX_SHADER 0x08000000 -#define R300_NEW_VIEWPORT 0x10000000 -#define R300_NEW_QUERY 0x20000000 -#define R300_NEW_KITCHEN_SINK 0x3fffffff +#define R300_NEW_VERTEX_SHADER_CONSTANTS 0x10000000 +#define R300_NEW_VIEWPORT 0x20000000 +#define R300_NEW_QUERY 0x40000000 +#define R300_NEW_KITCHEN_SINK 0x7fffffff /* The next several objects are not pure Radeon state; they inherit from * various Gallium classes. */ diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 22cf9cac2a..de27f0939b 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -178,18 +178,15 @@ static uint32_t pack_float24(float f) } void r300_emit_fragment_program_code(struct r300_context* r300, - struct rX00_fragment_program_code* generic_code, - struct r300_constant_buffer* externals) + struct rX00_fragment_program_code* generic_code) { struct r300_fragment_program_code * code = &generic_code->code.r300; - struct rc_constant_list * constants = &generic_code->constants; int i; CS_LOCALS(r300); BEGIN_CS(15 + code->alu.length * 4 + - (code->tex.length ? (1 + code->tex.length) : 0) + - (constants->Count ? (1 + constants->Count * 4) : 0)); + (code->tex.length ? (1 + code->tex.length) : 0)); OUT_CS_REG(R300_US_CONFIG, code->config); OUT_CS_REG(R300_US_PIXSIZE, code->pixsize); @@ -221,32 +218,41 @@ void r300_emit_fragment_program_code(struct r300_context* r300, OUT_CS(code->tex.inst[i]); } - if (constants->Count) { - OUT_CS_REG_SEQ(R300_PFS_PARAM_0_X, constants->Count * 4); - for(i = 0; i < constants->Count; ++i) { - const float * data = get_shader_constant(r300, &constants->Constants[i], externals); - OUT_CS(pack_float24(data[0])); - OUT_CS(pack_float24(data[1])); - OUT_CS(pack_float24(data[2])); - OUT_CS(pack_float24(data[3])); - } - } + END_CS; +} + +void r300_emit_fs_constant_buffer(struct r300_context* r300, + struct rc_constant_list* constants) +{ + int i; + CS_LOCALS(r300); + + if (constants->Count == 0) + return; + BEGIN_CS(constants->Count * 4 + 1); + OUT_CS_REG_SEQ(R300_PFS_PARAM_0_X, constants->Count * 4); + for(i = 0; i < constants->Count; ++i) { + const float * data = get_shader_constant(r300, + &constants->Constants[i], + &r300->shader_constants[PIPE_SHADER_FRAGMENT]); + OUT_CS(pack_float24(data[0])); + OUT_CS(pack_float24(data[1])); + OUT_CS(pack_float24(data[2])); + OUT_CS(pack_float24(data[3])); + } END_CS; } void r500_emit_fragment_program_code(struct r300_context* r300, - struct rX00_fragment_program_code* generic_code, - struct r300_constant_buffer* externals) + struct rX00_fragment_program_code* generic_code) { struct r500_fragment_program_code * code = &generic_code->code.r500; - struct rc_constant_list * constants = &generic_code->constants; int i; CS_LOCALS(r300); BEGIN_CS(13 + - ((code->inst_end + 1) * 6) + - (constants->Count ? (3 + (constants->Count * 4)) : 0)); + ((code->inst_end + 1) * 6)); OUT_CS_REG(R500_US_CONFIG, 0); OUT_CS_REG(R500_US_PIXSIZE, code->max_temp_idx); OUT_CS_REG(R500_US_CODE_RANGE, @@ -266,18 +272,30 @@ void r500_emit_fragment_program_code(struct r300_context* r300, OUT_CS(code->inst[i].inst5); } - if (constants->Count) { - OUT_CS_REG(R500_GA_US_VECTOR_INDEX, R500_GA_US_VECTOR_INDEX_TYPE_CONST); - OUT_CS_ONE_REG(R500_GA_US_VECTOR_DATA, constants->Count * 4); - for (i = 0; i < constants->Count; i++) { - const float * data = get_shader_constant(r300, &constants->Constants[i], externals); - OUT_CS_32F(data[0]); - OUT_CS_32F(data[1]); - OUT_CS_32F(data[2]); - OUT_CS_32F(data[3]); - } - } + END_CS; +} + +void r500_emit_fs_constant_buffer(struct r300_context* r300, + struct rc_constant_list* constants) +{ + int i; + CS_LOCALS(r300); + + if (constants->Count == 0) + return; + BEGIN_CS(constants->Count * 4 + 2); + OUT_CS_REG(R500_GA_US_VECTOR_INDEX, R500_GA_US_VECTOR_INDEX_TYPE_CONST); + OUT_CS_ONE_REG(R500_GA_US_VECTOR_DATA, constants->Count * 4); + for (i = 0; i < constants->Count; i++) { + const float * data = get_shader_constant(r300, + &constants->Constants[i], + &r300->shader_constants[PIPE_SHADER_FRAGMENT]); + OUT_CS_32F(data[0]); + OUT_CS_32F(data[1]); + OUT_CS_32F(data[2]); + OUT_CS_32F(data[3]); + } END_CS; } @@ -621,8 +639,7 @@ void r300_emit_vertex_format_state(struct r300_context* r300) } void r300_emit_vertex_program_code(struct r300_context* r300, - struct r300_vertex_program_code* code, - struct r300_constant_buffer* constants) + struct r300_vertex_program_code* code) { int i; struct r300_screen* r300screen = r300_screen(r300->context.screen); @@ -635,12 +652,7 @@ void r300_emit_vertex_program_code(struct r300_context* r300, return; } - if (code->constants.Count) { - BEGIN_CS(14 + code->length + (code->constants.Count * 4)); - } else { - BEGIN_CS(11 + code->length); - } - + BEGIN_CS(11 + code->length); /* R300_VAP_PVS_CODE_CNTL_0 * R300_VAP_PVS_CONST_CNTL * R300_VAP_PVS_CODE_CNTL_1 @@ -658,20 +670,6 @@ void r300_emit_vertex_program_code(struct r300_context* r300, for (i = 0; i < code->length; i++) OUT_CS(code->body.d[i]); - if (code->constants.Count) { - OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG, - (r300screen->caps->is_r500 ? - R500_PVS_CONST_START : R300_PVS_CONST_START)); - OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, code->constants.Count * 4); - for (i = 0; i < code->constants.Count; i++) { - const float * data = get_shader_constant(r300, &code->constants.Constants[i], constants); - OUT_CS_32F(data[0]); - OUT_CS_32F(data[1]); - OUT_CS_32F(data[2]); - OUT_CS_32F(data[3]); - } - } - 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) | @@ -683,7 +681,40 @@ void r300_emit_vertex_program_code(struct r300_context* r300, void r300_emit_vertex_shader(struct r300_context* r300, struct r300_vertex_shader* vs) { - r300_emit_vertex_program_code(r300, &vs->code, &r300->shader_constants[PIPE_SHADER_VERTEX]); + r300_emit_vertex_program_code(r300, &vs->code); +} + +void r300_emit_vs_constant_buffer(struct r300_context* r300, + struct rc_constant_list* constants) +{ + 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," + " but has_tcl is FALSE!\n"); + return; + } + + if (constants->Count == 0) + return; + + BEGIN_CS(constants->Count * 4 + 3); + OUT_CS_REG(R300_VAP_PVS_VECTOR_INDX_REG, + (r300screen->caps->is_r500 ? + R500_PVS_CONST_START : R300_PVS_CONST_START)); + OUT_CS_ONE_REG(R300_VAP_PVS_UPLOAD_DATA, constants->Count * 4); + for (i = 0; i < constants->Count; i++) { + const float * data = get_shader_constant(r300, + &constants->Constants[i], + &r300->shader_constants[PIPE_SHADER_VERTEX]); + OUT_CS_32F(data[0]); + OUT_CS_32F(data[1]); + OUT_CS_32F(data[2]); + OUT_CS_32F(data[3]); + } + END_CS; } void r300_emit_viewport_state(struct r300_context* r300, @@ -822,13 +853,22 @@ validate: if (r300->dirty_state & R300_NEW_FRAGMENT_SHADER) { if (r300screen->caps->is_r500) { - r500_emit_fragment_program_code(r300, &r300->fs->code, &r300->shader_constants[PIPE_SHADER_FRAGMENT]); + r500_emit_fragment_program_code(r300, &r300->fs->code); } else { - r300_emit_fragment_program_code(r300, &r300->fs->code, &r300->shader_constants[PIPE_SHADER_FRAGMENT]); + r300_emit_fragment_program_code(r300, &r300->fs->code); } r300->dirty_state &= ~R300_NEW_FRAGMENT_SHADER; } + if (r300->dirty_state & R300_NEW_FRAGMENT_SHADER_CONSTANTS) { + if (r300screen->caps->is_r500) { + r500_emit_fs_constant_buffer(r300, &r300->fs->code.constants); + } else { + r300_emit_fs_constant_buffer(r300, &r300->fs->code.constants); + } + r300->dirty_state &= ~R300_NEW_FRAGMENT_SHADER_CONSTANTS; + } + if (r300->dirty_state & R300_NEW_FRAMEBUFFERS) { r300_emit_fb_state(r300, &r300->framebuffer_state); r300->dirty_state &= ~R300_NEW_FRAMEBUFFERS; @@ -887,6 +927,11 @@ validate: r300->dirty_state &= ~R300_NEW_VERTEX_SHADER; } + if (r300->dirty_state & R300_NEW_VERTEX_SHADER_CONSTANTS) { + r300_emit_vs_constant_buffer(r300, &r300->vs->code.constants); + r300->dirty_state &= ~R300_NEW_VERTEX_SHADER_CONSTANTS; + } + /* XXX assert(r300->dirty_state == 0); */ diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h index 02ac5bebbd..6befca72ce 100644 --- a/src/gallium/drivers/r300/r300_emit.h +++ b/src/gallium/drivers/r300/r300_emit.h @@ -23,6 +23,9 @@ #ifndef R300_EMIT_H #define R300_EMIT_H +#include "r300_context.h" +#include "radeon_code.h" + struct rX00_fragment_program_code; struct r300_vertex_program_code; @@ -39,12 +42,16 @@ void r300_emit_dsa_state(struct r300_context* r300, struct r300_dsa_state* dsa); void r300_emit_fragment_program_code(struct r300_context* r300, - struct rX00_fragment_program_code* generic_code, - struct r300_constant_buffer* externals); + struct rX00_fragment_program_code* generic_code); + +void r300_emit_fs_constant_buffer(struct r300_context* r300, + struct rc_constant_list* constants); void r500_emit_fragment_program_code(struct r300_context* r300, - struct rX00_fragment_program_code* generic_code, - struct r300_constant_buffer* externals); + struct rX00_fragment_program_code* generic_code); + +void r500_emit_fs_constant_buffer(struct r300_context* r300, + struct rc_constant_list* constants); void r300_emit_fb_state(struct r300_context* r300, struct pipe_framebuffer_state* fb); @@ -72,8 +79,10 @@ void r300_emit_vertex_buffer(struct r300_context* r300); void r300_emit_vertex_format_state(struct r300_context* r300); void r300_emit_vertex_program_code(struct r300_context* r300, - struct r300_vertex_program_code* code, - struct r300_constant_buffer* constants); + struct r300_vertex_program_code* code); + +void r300_emit_vs_constant_buffer(struct r300_context* r300, + struct rc_constant_list* constants); void r300_emit_vertex_shader(struct r300_context* r300, struct r300_vertex_shader* vs); diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 3ac627e959..4cf01389d2 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -166,31 +166,6 @@ static void r300_set_clip_state(struct pipe_context* pipe, } } -static void - r300_set_constant_buffer(struct pipe_context* pipe, - uint shader, uint index, - const struct pipe_constant_buffer* buffer) -{ - struct r300_context* r300 = r300_context(pipe); - - /* This entire chunk of code seems ever-so-slightly baked. - * It's as if I've got pipe_buffer* matryoshkas... */ - if (buffer && buffer->buffer && buffer->buffer->size) { - void* map = pipe->winsys->buffer_map(pipe->winsys, buffer->buffer, - PIPE_BUFFER_USAGE_CPU_READ); - memcpy(r300->shader_constants[shader].constants, - map, buffer->buffer->size); - pipe->winsys->buffer_unmap(pipe->winsys, buffer->buffer); - - r300->shader_constants[shader].count = - buffer->buffer->size / (sizeof(float) * 4); - } else { - r300->shader_constants[shader].count = 0; - } - - r300->dirty_state |= R300_NEW_CONSTANTS; -} - /* Create a new depth, stencil, and alpha state based on the CSO dsa state. * * This contains the depth buffer, stencil buffer, alpha test, and such. @@ -345,7 +320,7 @@ static void r300_bind_fs_state(struct pipe_context* pipe, void* shader) r300->fs = fs; - r300->dirty_state |= R300_NEW_FRAGMENT_SHADER; + r300->dirty_state |= R300_NEW_FRAGMENT_SHADER | R300_NEW_FRAGMENT_SHADER_CONSTANTS; } /* Delete fragment shader state. */ @@ -702,7 +677,7 @@ static void r300_bind_vs_state(struct pipe_context* pipe, void* shader) draw_bind_vertex_shader(r300->draw, vs->draw); r300->vs = vs; - r300->dirty_state |= R300_NEW_VERTEX_SHADER; + r300->dirty_state |= R300_NEW_VERTEX_SHADER | R300_NEW_VERTEX_SHADER_CONSTANTS; } else { draw_bind_vertex_shader(r300->draw, (struct draw_vertex_shader*)shader); @@ -726,6 +701,31 @@ static void r300_delete_vs_state(struct pipe_context* pipe, void* shader) } } +static void r300_set_constant_buffer(struct pipe_context *pipe, + uint shader, uint index, + const struct pipe_constant_buffer *buf) +{ + struct r300_context* r300 = r300_context(pipe); + void *mapped; + + if (buf == NULL || buf->buffer->size == 0 || + (mapped = pipe_buffer_map(pipe->screen, buf->buffer, PIPE_BUFFER_USAGE_CPU_READ)) == NULL) + { + r300->shader_constants[shader].count = 0; + return; + } + + assert((buf->buffer->size % 4 * sizeof(float)) == 0); + memcpy(r300->shader_constants[shader].constants, mapped, buf->buffer->size); + r300->shader_constants[shader].count = buf->buffer->size / (4 * sizeof(float)); + pipe_buffer_unmap(pipe->screen, buf->buffer); + + if (shader == PIPE_SHADER_VERTEX) + r300->dirty_state |= R300_NEW_VERTEX_SHADER_CONSTANTS; + else if (shader == PIPE_SHADER_FRAGMENT) + r300->dirty_state |= R300_NEW_FRAGMENT_SHADER_CONSTANTS; +} + void r300_init_state_functions(struct r300_context* r300) { r300->context.create_blend_state = r300_create_blend_state; -- cgit v1.2.3 From 3d73852121f13832f6bc87918798ff96589d0349 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 1 Nov 2009 18:50:52 +0100 Subject: r300g: fix geometry corruptions PVS flush is needed before changing the vertex shader or vertex shader constants. --- src/gallium/drivers/r300/r300_emit.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index de27f0939b..5b03c1aa6c 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -652,7 +652,7 @@ void r300_emit_vertex_program_code(struct r300_context* r300, return; } - BEGIN_CS(11 + code->length); + BEGIN_CS(9 + code->length); /* R300_VAP_PVS_CODE_CNTL_0 * R300_VAP_PVS_CONST_CNTL * R300_VAP_PVS_CODE_CNTL_1 @@ -674,7 +674,6 @@ void r300_emit_vertex_program_code(struct r300_context* r300, R300_PVS_NUM_CNTLRS(5) | R300_PVS_NUM_FPUS(r300screen->caps->num_vert_fpus) | R300_PVS_VF_MAX_VTX_NUM(12)); - OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0); END_CS; } @@ -749,6 +748,15 @@ void r300_flush_textures(struct r300_context* r300) END_CS; } +static void r300_flush_pvs(struct r300_context* r300) +{ + CS_LOCALS(r300); + + BEGIN_CS(2); + OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0); + END_CS; +} + /* Emit all dirty state. */ void r300_emit_dirty_state(struct r300_context* r300) { @@ -922,6 +930,10 @@ validate: r300->dirty_state &= ~R300_NEW_VERTEX_FORMAT; } + if (r300->dirty_state & (R300_NEW_VERTEX_SHADER | R300_NEW_VERTEX_SHADER_CONSTANTS)) { + r300_flush_pvs(r300); + } + if (r300->dirty_state & R300_NEW_VERTEX_SHADER) { r300_emit_vertex_shader(r300, r300->vs); r300->dirty_state &= ~R300_NEW_VERTEX_SHADER; -- cgit v1.2.3 From 1f630fa0167ed799556a764178772c096a3ddeba Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 1 Nov 2009 11:54:52 -0800 Subject: r300g: Miscellania. Avoid draw segfaults, s/true/TRUE/, etc. Cleared out my git stash. --- src/gallium/drivers/r300/r300_context.h | 2 +- src/gallium/drivers/r300/r300_debug.c | 6 +++--- src/gallium/drivers/r300/r300_emit.c | 2 +- src/gallium/drivers/r300/r300_state.c | 28 +++++++++++++++++++++------- src/gallium/drivers/r300/r300_vs.c | 4 ++-- 5 files changed, 28 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index b1738452de..ae7015634c 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -339,7 +339,7 @@ void r300_init_surface_functions(struct r300_context* r300); static INLINE boolean DBG_ON(struct r300_context * ctx, unsigned flags) { - return (ctx->debug & flags) ? true : false; + return (ctx->debug & flags) ? TRUE : FALSE; } static INLINE void DBG(struct r300_context * ctx, unsigned flags, const char * fmt, ...) diff --git a/src/gallium/drivers/r300/r300_debug.c b/src/gallium/drivers/r300/r300_debug.c index 421253ca72..2a6ed54ac9 100644 --- a/src/gallium/drivers/r300/r300_debug.c +++ b/src/gallium/drivers/r300/r300_debug.c @@ -49,7 +49,7 @@ static struct debug_option debug_options[] = { void r300_init_debug(struct r300_context * ctx) { const char * options = debug_get_option("RADEON_DEBUG", 0); - boolean printhint = false; + boolean printhint = FALSE; size_t length; struct debug_option * opt; @@ -71,14 +71,14 @@ void r300_init_debug(struct r300_context * ctx) if (!opt->name) { debug_printf("Unknown debug option: %s\n", options); - printhint = true; + printhint = TRUE; } options += length; } if (!ctx->debug) - printhint = true; + printhint = TRUE; } if (printhint || ctx->debug & DBG_HELP) { diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 5b03c1aa6c..79972dbb49 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -800,7 +800,7 @@ validate: for (i = 0; i < r300->texture_count; i++) { tex = r300->textures[i]; if (!tex) - continue; + continue; if (!r300->winsys->add_buffer(r300->winsys, tex->buffer, RADEON_GEM_DOMAIN_GTT | RADEON_GEM_DOMAIN_VRAM, 0)) { r300->context.flush(&r300->context, 0, NULL); diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 4cf01389d2..af063d4b20 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -281,7 +281,9 @@ static void { struct r300_context* r300 = r300_context(pipe); - draw_flush(r300->draw); + if (r300->draw) { + draw_flush(r300->draw); + } r300->framebuffer_state = *state; @@ -444,10 +446,13 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state) struct r300_context* r300 = r300_context(pipe); struct r300_rs_state* rs = (struct r300_rs_state*)state; - draw_flush(r300->draw); - draw_set_rasterizer_state(r300->draw, &rs->rs); + if (r300->draw) { + draw_flush(r300->draw); + draw_set_rasterizer_state(r300->draw, &rs->rs); + } r300->rs_state = rs; + /* XXX Clean these up when we move to atom emits */ r300->dirty_state |= R300_NEW_RASTERIZER; r300->dirty_state |= R300_NEW_RS_BLOCK; r300->dirty_state |= R300_NEW_SCISSOR; @@ -623,8 +628,10 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe, r300->vertex_buffer_count = count; - draw_flush(r300->draw); - draw_set_vertex_buffers(r300->draw, count, buffers); + if (r300->draw) { + draw_flush(r300->draw); + draw_set_vertex_buffers(r300->draw, count, buffers); + } } static void r300_set_vertex_elements(struct pipe_context* pipe, @@ -633,8 +640,15 @@ static void r300_set_vertex_elements(struct pipe_context* pipe, { struct r300_context* r300 = r300_context(pipe); - draw_flush(r300->draw); - draw_set_vertex_elements(r300->draw, count, elements); + memcpy(r300->vertex_elements, elements, + sizeof(struct pipe_vertex_element) * count); + + r300->vertex_element_count = count; + + if (r300->draw) { + draw_flush(r300->draw); + draw_set_vertex_elements(r300->draw, count, elements); + } } static void* r300_create_vs_state(struct pipe_context* pipe, diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c index eca85879a7..74ef416dc1 100644 --- a/src/gallium/drivers/r300/r300_vs.c +++ b/src/gallium/drivers/r300/r300_vs.c @@ -37,7 +37,7 @@ static void set_vertex_inputs_outputs(struct r300_vertex_program_compiler * c) struct tgsi_shader_info* info = &vs->info; struct tgsi_parse_context parser; struct tgsi_full_declaration * decl; - boolean pointsize = false; + boolean pointsize = FALSE; int out_colors = 0; int colors = 0; int out_generic = 0; @@ -52,7 +52,7 @@ static void set_vertex_inputs_outputs(struct r300_vertex_program_compiler * c) for (i = 0; i < info->num_outputs; i++) { switch (info->output_semantic_name[i]) { case TGSI_SEMANTIC_PSIZE: - pointsize = true; + pointsize = TRUE; break; case TGSI_SEMANTIC_COLOR: out_colors++; -- cgit v1.2.3 From 87d7c1aa15a944d64e43b217e18553256f9fb681 Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Sun, 1 Nov 2009 18:25:59 -0500 Subject: nouveau: Assume all texture blankets are linear for now. --- src/gallium/drivers/nv30/nv30_miptree.c | 3 +++ src/gallium/drivers/nv40/nv40_miptree.c | 3 +++ src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c | 3 +-- 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c index 17acca61ab..280696d450 100644 --- a/src/gallium/drivers/nv30/nv30_miptree.c +++ b/src/gallium/drivers/nv30/nv30_miptree.c @@ -147,6 +147,9 @@ nv30_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt, mt->level[0].pitch = stride[0]; mt->level[0].image_offset = CALLOC(1, sizeof(unsigned)); + /* Assume whoever created this buffer expects it to be linear for now */ + mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR; + pipe_buffer_reference(&mt->buffer, pb); return &mt->base; } diff --git a/src/gallium/drivers/nv40/nv40_miptree.c b/src/gallium/drivers/nv40/nv40_miptree.c index 5a201ccf45..465dd3b069 100644 --- a/src/gallium/drivers/nv40/nv40_miptree.c +++ b/src/gallium/drivers/nv40/nv40_miptree.c @@ -141,6 +141,9 @@ nv40_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt, mt->level[0].pitch = stride[0]; mt->level[0].image_offset = CALLOC(1, sizeof(unsigned)); + /* Assume whoever created this buffer expects it to be linear for now */ + mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR; + pipe_buffer_reference(&mt->buffer, pb); return &mt->base; } diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c index f512c0e5f3..317dc44d22 100644 --- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c +++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c @@ -21,8 +21,7 @@ dri_surface_from_handle(struct drm_api *api, struct pipe_screen *pscreen, struct pipe_texture tmpl; memset(&tmpl, 0, sizeof(tmpl)); - tmpl.tex_usage = PIPE_TEXTURE_USAGE_PRIMARY | - NOUVEAU_TEXTURE_USAGE_LINEAR; + tmpl.tex_usage = PIPE_TEXTURE_USAGE_PRIMARY; tmpl.target = PIPE_TEXTURE_2D; tmpl.last_level = 0; tmpl.depth[0] = 1; -- cgit v1.2.3 From eb699d64ec7057032139baccedcb0694ca41d706 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 30 Oct 2009 08:27:17 +0000 Subject: softpipe: Sanitise shader semantic and interpolator handling. Handle the remaining semantic names and indices. Respect color interpolator when not flatshading. --- src/gallium/drivers/softpipe/sp_state_derived.c | 34 ++++++++----------------- 1 file changed, 10 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index 1faeca1c2a..3bc96b9538 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -66,8 +66,6 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe) if (vinfo->num_attribs == 0) { /* compute vertex layout now */ const struct sp_fragment_shader *spfs = softpipe->fs; - const enum interp_mode colorInterp - = softpipe->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR; struct vertex_info *vinfo_vbuf = &softpipe->vertex_info_vbuf; const uint num = draw_num_vs_outputs(softpipe->draw); uint i; @@ -108,33 +106,21 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe) switch (spfs->info.input_semantic_name[i]) { case TGSI_SEMANTIC_POSITION: - src = draw_find_vs_output(softpipe->draw, - TGSI_SEMANTIC_POSITION, 0); - draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_POS, src); + interp = INTERP_POS; break; case TGSI_SEMANTIC_COLOR: - src = draw_find_vs_output(softpipe->draw, TGSI_SEMANTIC_COLOR, - spfs->info.input_semantic_index[i]); - draw_emit_vertex_attr(vinfo, EMIT_4F, colorInterp, src); + if (softpipe->rasterizer->flatshade) { + interp = INTERP_CONSTANT; + } break; - - case TGSI_SEMANTIC_FOG: - src = draw_find_vs_output(softpipe->draw, TGSI_SEMANTIC_FOG, 0); - draw_emit_vertex_attr(vinfo, EMIT_4F, interp, src); - break; - - case TGSI_SEMANTIC_GENERIC: - case TGSI_SEMANTIC_FACE: - /* this includes texcoords and varying vars */ - src = draw_find_vs_output(softpipe->draw, TGSI_SEMANTIC_GENERIC, - spfs->info.input_semantic_index[i]); - draw_emit_vertex_attr(vinfo, EMIT_4F, interp, src); - break; - - default: - assert(0); } + + /* this includes texcoords and varying vars */ + src = draw_find_vs_output(softpipe->draw, + spfs->info.input_semantic_name[i], + spfs->info.input_semantic_index[i]); + draw_emit_vertex_attr(vinfo, EMIT_4F, interp, src); } softpipe->psize_slot = draw_find_vs_output(softpipe->draw, -- cgit v1.2.3 From 0a7d50ed7e7608eaccba8e9648685e740065c384 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Sat, 31 Oct 2009 09:09:26 +0000 Subject: gallium: Cleanup predicate and condition code TGSI tokens. There is little point in having a special TGSI token just to handle predicate register updates. Remove tgsi_dst_register_ext_predicate token and instead use a new PREDICATE register file to update predicates. Actually, the contents of the obsolete token are being moved to tgsi_instruction_ext_predicate, where they should be from the very beginning. Remove the NVIDIA-specific condition code tokens -- nobody uses them and they can be emulated with predicates if needed. Introduce PIPE_CAP_SM3 that indicates whether a driver supports SM3-level instructions, and in particular predicates. Add PIPE_CAP_MAX_PREDICATE_REGISTERS that can be used to query the driver how many predicate registers it supports (currently it would be 1). --- src/gallium/include/pipe/p_defines.h | 2 + src/gallium/include/pipe/p_shader_tokens.h | 117 +++++------------------------ 2 files changed, 20 insertions(+), 99 deletions(-) (limited to 'src') diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 52887ea0ad..6a61aea8fd 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -333,6 +333,8 @@ enum pipe_transfer_usage { #define PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS 26 #define PIPE_CAP_TGSI_CONT_SUPPORTED 27 #define PIPE_CAP_BLEND_EQUATION_SEPARATE 28 +#define PIPE_CAP_SM3 29 /*< Shader Model 3 supported */ +#define PIPE_CAP_MAX_PREDICATE_REGISTERS 30 /** diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index de338c4877..d4c8aadaf9 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -1,6 +1,7 @@ /************************************************************************** * * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2009 VMware, Inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -25,8 +26,8 @@ * **************************************************************************/ -#ifndef TGSI_TOKEN_H -#define TGSI_TOKEN_H +#ifndef P_SHADER_TOKENS_H +#define P_SHADER_TOKENS_H #ifdef __cplusplus extern "C" { @@ -79,6 +80,7 @@ enum tgsi_file_type { TGSI_FILE_ADDRESS =6, TGSI_FILE_IMMEDIATE =7, TGSI_FILE_LOOP =8, + TGSI_FILE_PREDICATE =9, TGSI_FILE_COUNT /**< how many TGSI_FILE_ types */ }; @@ -319,7 +321,6 @@ struct tgsi_instruction * instruction, including the instruction word. */ -#define TGSI_INSTRUCTION_EXT_TYPE_NV 0 #define TGSI_INSTRUCTION_EXT_TYPE_LABEL 1 #define TGSI_INSTRUCTION_EXT_TYPE_TEXTURE 2 #define TGSI_INSTRUCTION_EXT_TYPE_PREDICATE 3 @@ -332,9 +333,6 @@ struct tgsi_instruction_ext }; /* - * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_NV, it should - * be cast to tgsi_instruction_ext_nv. - * * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_LABEL, it * should be cast to tgsi_instruction_ext_label. * @@ -348,56 +346,11 @@ struct tgsi_instruction_ext * follows. */ -#define TGSI_PRECISION_DEFAULT 0 -#define TGSI_PRECISION_FLOAT32 1 -#define TGSI_PRECISION_FLOAT16 2 -#define TGSI_PRECISION_FIXED12 3 - -#define TGSI_CC_GT 0 -#define TGSI_CC_EQ 1 -#define TGSI_CC_LT 2 -#define TGSI_CC_GE 3 -#define TGSI_CC_LE 4 -#define TGSI_CC_NE 5 -#define TGSI_CC_TR 6 -#define TGSI_CC_FL 7 - #define TGSI_SWIZZLE_X 0 #define TGSI_SWIZZLE_Y 1 #define TGSI_SWIZZLE_Z 2 #define TGSI_SWIZZLE_W 3 -/** - * Precision controls the precision at which the operation should be executed. - * - * CondDstUpdate enables condition code register writes. When this field is - * TRUE, CondDstIndex specifies the index of the condition code register to - * update. - * - * CondFlowEnable enables conditional execution of the operation. When this - * field is TRUE, CondFlowIndex specifies the index of the condition code - * register to test against CondMask with component swizzle controled by - * CondSwizzleX, CondSwizzleY, CondSwizzleZ and CondSwizzleW. If the test fails, - * the operation is not executed. - */ - -struct tgsi_instruction_ext_nv -{ - unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_NV */ - unsigned Precision : 4; /* TGSI_PRECISION_ */ - unsigned CondDstIndex : 4; /* UINT */ - unsigned CondFlowIndex : 4; /* UINT */ - unsigned CondMask : 4; /* TGSI_CC_ */ - unsigned CondSwizzleX : 2; /* TGSI_SWIZZLE_ */ - unsigned CondSwizzleY : 2; /* TGSI_SWIZZLE_ */ - unsigned CondSwizzleZ : 2; /* TGSI_SWIZZLE_ */ - unsigned CondSwizzleW : 2; /* TGSI_SWIZZLE_ */ - unsigned CondDstUpdate : 1; /* BOOL */ - unsigned CondFlowEnable : 1; /* BOOL */ - unsigned Padding : 1; - unsigned Extended : 1; /* BOOL */ -}; - struct tgsi_instruction_ext_label { unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_LABEL */ @@ -425,13 +378,21 @@ struct tgsi_instruction_ext_texture unsigned Extended : 1; /* BOOL */ }; +/* + * For SM3, the following constraint applies. + * - Swizzle is either set to identity or replicate. + */ struct tgsi_instruction_ext_predicate { - unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_PREDICATE */ - unsigned PredDstIndex : 4; /* UINT */ - unsigned PredWriteMask : 4; /* TGSI_WRITEMASK_ */ - unsigned Padding : 19; - unsigned Extended : 1; /* BOOL */ + unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_PREDICATE */ + unsigned SwizzleX : 2; /* TGSI_SWIZZLE_x */ + unsigned SwizzleY : 2; /* TGSI_SWIZZLE_x */ + unsigned SwizzleZ : 2; /* TGSI_SWIZZLE_x */ + unsigned SwizzleW : 2; /* TGSI_SWIZZLE_x */ + unsigned Negate : 1; /* BOOL */ + unsigned SrcIndex : 8; /* UINT */ + unsigned Padding : 10; + unsigned Extended : 1; /* BOOL */ }; /** @@ -546,9 +507,7 @@ struct tgsi_dst_register * Then, if tgsi_dst_register::Indirect is TRUE, tgsi_src_register follows. */ -#define TGSI_DST_REGISTER_EXT_TYPE_CONDCODE 0 #define TGSI_DST_REGISTER_EXT_TYPE_MODULATE 1 -#define TGSI_DST_REGISTER_EXT_TYPE_PREDICATE 2 struct tgsi_dst_register_ext { @@ -560,30 +519,12 @@ struct tgsi_dst_register_ext /** * Extra destination register modifiers * - * If tgsi_dst_register_ext::Type is TGSI_DST_REGISTER_EXT_TYPE_CONDCODE, - * it should be cast to tgsi_dst_register_ext_condcode. - * * If tgsi_dst_register_ext::Type is TGSI_DST_REGISTER_EXT_TYPE_MODULATE, * it should be cast to tgsi_dst_register_ext_modulate. * - * If tgsi_dst_register_ext::Type is TGSI_DST_REGISTER_EXT_TYPE_PREDICATE, - * it should be cast to tgsi_dst_register_ext_predicate. - * * If tgsi_dst_register_ext::Extended is TRUE, another tgsi_dst_register_ext * follows. */ -struct tgsi_dst_register_ext_concode -{ - unsigned Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_CONDCODE */ - unsigned CondMask : 4; /* TGSI_CC_ */ - unsigned CondSwizzleX : 2; /* TGSI_SWIZZLE_ */ - unsigned CondSwizzleY : 2; /* TGSI_SWIZZLE_ */ - unsigned CondSwizzleZ : 2; /* TGSI_SWIZZLE_ */ - unsigned CondSwizzleW : 2; /* TGSI_SWIZZLE_ */ - unsigned CondSrcIndex : 4; /* UINT */ - unsigned Padding : 11; - unsigned Extended : 1; /* BOOL */ -}; #define TGSI_MODULATE_1X 0 #define TGSI_MODULATE_2X 1 @@ -602,30 +543,8 @@ struct tgsi_dst_register_ext_modulate unsigned Extended : 1; /* BOOL */ }; -/* - * Currently, the following constraints apply. - * - * - PredSwizzleXYZW is either set to identity or replicate. - * - PredSrcIndex is 0. - */ - -struct tgsi_dst_register_ext_predicate -{ - unsigned Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_PREDICATE */ - unsigned PredSwizzleX : 2; /* TGSI_SWIZZLE_ */ - unsigned PredSwizzleY : 2; /* TGSI_SWIZZLE_ */ - unsigned PredSwizzleZ : 2; /* TGSI_SWIZZLE_ */ - unsigned PredSwizzleW : 2; /* TGSI_SWIZZLE_ */ - unsigned PredSrcIndex : 4; /* UINT */ - unsigned Negate : 1; /* BOOL */ - unsigned Padding : 14; - unsigned Extended : 1; /* BOOL */ -}; - - #ifdef __cplusplus } #endif -#endif /* TGSI_TOKEN_H */ - +#endif /* P_SHADER_TOKENS_H */ -- cgit v1.2.3 From aa2b2e5d7d53ddd08425536edddec509a8834bfc Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 2 Nov 2009 09:41:40 +0000 Subject: tgsi: Update for gallium interface changes. --- src/gallium/auxiliary/tgsi/tgsi_build.c | 266 +++++++++---------------------- src/gallium/auxiliary/tgsi/tgsi_build.h | 62 +++---- src/gallium/auxiliary/tgsi/tgsi_dump.c | 3 +- src/gallium/auxiliary/tgsi/tgsi_dump_c.c | 120 +------------- src/gallium/auxiliary/tgsi/tgsi_exec.c | 199 +++-------------------- src/gallium/auxiliary/tgsi/tgsi_exec.h | 7 +- src/gallium/auxiliary/tgsi/tgsi_parse.c | 13 +- src/gallium/auxiliary/tgsi/tgsi_parse.h | 3 +- src/gallium/auxiliary/tgsi/tgsi_sanity.c | 3 +- src/gallium/auxiliary/tgsi/tgsi_text.c | 3 +- 10 files changed, 137 insertions(+), 542 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index d45561362d..4fa10e2f7e 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -472,9 +472,9 @@ tgsi_default_full_instruction( void ) unsigned i; full_instruction.Instruction = tgsi_default_instruction(); - full_instruction.InstructionExtNv = tgsi_default_instruction_ext_nv(); full_instruction.InstructionExtLabel = tgsi_default_instruction_ext_label(); full_instruction.InstructionExtTexture = tgsi_default_instruction_ext_texture(); + full_instruction.InstructionExtPredicate = tgsi_default_instruction_ext_predicate(); for( i = 0; i < TGSI_FULL_MAX_DST_REGISTERS; i++ ) { full_instruction.FullDstRegisters[i] = tgsi_default_full_dst_register(); } @@ -512,34 +512,6 @@ tgsi_build_full_instruction( header ); prev_token = (struct tgsi_token *) instruction; - if( tgsi_compare_instruction_ext_nv( - full_inst->InstructionExtNv, - tgsi_default_instruction_ext_nv() ) ) { - struct tgsi_instruction_ext_nv *instruction_ext_nv; - - if( maxsize <= size ) - return 0; - instruction_ext_nv = - (struct tgsi_instruction_ext_nv *) &tokens[size]; - size++; - - *instruction_ext_nv = tgsi_build_instruction_ext_nv( - full_inst->InstructionExtNv.Precision, - full_inst->InstructionExtNv.CondDstIndex, - full_inst->InstructionExtNv.CondFlowIndex, - full_inst->InstructionExtNv.CondMask, - full_inst->InstructionExtNv.CondSwizzleX, - full_inst->InstructionExtNv.CondSwizzleY, - full_inst->InstructionExtNv.CondSwizzleZ, - full_inst->InstructionExtNv.CondSwizzleW, - full_inst->InstructionExtNv.CondDstUpdate, - full_inst->InstructionExtNv.CondFlowEnable, - prev_token, - instruction, - header ); - prev_token = (struct tgsi_token *) instruction_ext_nv; - } - if( tgsi_compare_instruction_ext_label( full_inst->InstructionExtLabel, tgsi_default_instruction_ext_label() ) ) { @@ -578,6 +550,29 @@ tgsi_build_full_instruction( prev_token = (struct tgsi_token *) instruction_ext_texture; } + if (tgsi_compare_instruction_ext_predicate(full_inst->InstructionExtPredicate, + tgsi_default_instruction_ext_predicate())) { + struct tgsi_instruction_ext_predicate *instruction_ext_predicate; + + if (maxsize <= size) { + return 0; + } + instruction_ext_predicate = (struct tgsi_instruction_ext_predicate *)&tokens[size]; + size++; + + *instruction_ext_predicate = + tgsi_build_instruction_ext_predicate(full_inst->InstructionExtPredicate.SrcIndex, + full_inst->InstructionExtPredicate.Negate, + full_inst->InstructionExtPredicate.SwizzleX, + full_inst->InstructionExtPredicate.SwizzleY, + full_inst->InstructionExtPredicate.SwizzleZ, + full_inst->InstructionExtPredicate.SwizzleW, + prev_token, + instruction, + header); + prev_token = (struct tgsi_token *)instruction_ext_predicate; + } + for( i = 0; i < full_inst->Instruction.NumDstRegs; i++ ) { const struct tgsi_full_dst_register *reg = &full_inst->FullDstRegisters[i]; struct tgsi_dst_register *dst_register; @@ -597,30 +592,6 @@ tgsi_build_full_instruction( header ); prev_token = (struct tgsi_token *) dst_register; - if( tgsi_compare_dst_register_ext_concode( - reg->DstRegisterExtConcode, - tgsi_default_dst_register_ext_concode() ) ) { - struct tgsi_dst_register_ext_concode *dst_register_ext_concode; - - if( maxsize <= size ) - return 0; - dst_register_ext_concode = - (struct tgsi_dst_register_ext_concode *) &tokens[size]; - size++; - - *dst_register_ext_concode = tgsi_build_dst_register_ext_concode( - reg->DstRegisterExtConcode.CondMask, - reg->DstRegisterExtConcode.CondSwizzleX, - reg->DstRegisterExtConcode.CondSwizzleY, - reg->DstRegisterExtConcode.CondSwizzleZ, - reg->DstRegisterExtConcode.CondSwizzleW, - reg->DstRegisterExtConcode.CondSrcIndex, - prev_token, - instruction, - header ); - prev_token = (struct tgsi_token *) dst_register_ext_concode; - } - if( tgsi_compare_dst_register_ext_modulate( reg->DstRegisterExtModulate, tgsi_default_dst_register_ext_modulate() ) ) { @@ -775,29 +746,6 @@ tgsi_build_full_instruction( return size; } -struct tgsi_instruction_ext_nv -tgsi_default_instruction_ext_nv( void ) -{ - struct tgsi_instruction_ext_nv instruction_ext_nv; - - instruction_ext_nv.Type = TGSI_INSTRUCTION_EXT_TYPE_NV; - instruction_ext_nv.Precision = TGSI_PRECISION_DEFAULT; - instruction_ext_nv.CondDstIndex = 0; - instruction_ext_nv.CondFlowIndex = 0; - instruction_ext_nv.CondMask = TGSI_CC_TR; - instruction_ext_nv.CondSwizzleX = TGSI_SWIZZLE_X; - instruction_ext_nv.CondSwizzleY = TGSI_SWIZZLE_Y; - instruction_ext_nv.CondSwizzleZ = TGSI_SWIZZLE_Z; - instruction_ext_nv.CondSwizzleW = TGSI_SWIZZLE_W; - instruction_ext_nv.CondDstUpdate = 0; - instruction_ext_nv.CondFlowEnable = 0; - instruction_ext_nv.Padding = 0; - instruction_ext_nv.Extended = 0; - - return instruction_ext_nv; -} - - /** test for inequality of 32-bit values pointed to by a and b */ static INLINE boolean compare32(const void *a, const void *b) @@ -805,53 +753,6 @@ compare32(const void *a, const void *b) return *((uint32_t *) a) != *((uint32_t *) b); } - -unsigned -tgsi_compare_instruction_ext_nv( - struct tgsi_instruction_ext_nv a, - struct tgsi_instruction_ext_nv b ) -{ - a.Padding = b.Padding = 0; - a.Extended = b.Extended = 0; - return compare32(&a, &b); -} - -struct tgsi_instruction_ext_nv -tgsi_build_instruction_ext_nv( - unsigned precision, - unsigned cond_dst_index, - unsigned cond_flow_index, - unsigned cond_mask, - unsigned cond_swizzle_x, - unsigned cond_swizzle_y, - unsigned cond_swizzle_z, - unsigned cond_swizzle_w, - unsigned cond_dst_update, - unsigned cond_flow_enable, - struct tgsi_token *prev_token, - struct tgsi_instruction *instruction, - struct tgsi_header *header ) -{ - struct tgsi_instruction_ext_nv instruction_ext_nv; - - instruction_ext_nv = tgsi_default_instruction_ext_nv(); - instruction_ext_nv.Precision = precision; - instruction_ext_nv.CondDstIndex = cond_dst_index; - instruction_ext_nv.CondFlowIndex = cond_flow_index; - instruction_ext_nv.CondMask = cond_mask; - instruction_ext_nv.CondSwizzleX = cond_swizzle_x; - instruction_ext_nv.CondSwizzleY = cond_swizzle_y; - instruction_ext_nv.CondSwizzleZ = cond_swizzle_z; - instruction_ext_nv.CondSwizzleW = cond_swizzle_w; - instruction_ext_nv.CondDstUpdate = cond_dst_update; - instruction_ext_nv.CondFlowEnable = cond_flow_enable; - - prev_token->Extended = 1; - instruction_grow( instruction, header ); - - return instruction_ext_nv; -} - struct tgsi_instruction_ext_label tgsi_default_instruction_ext_label( void ) { @@ -934,6 +835,60 @@ tgsi_build_instruction_ext_texture( return instruction_ext_texture; } +struct tgsi_instruction_ext_predicate +tgsi_default_instruction_ext_predicate(void) +{ + struct tgsi_instruction_ext_predicate instruction_ext_predicate; + + instruction_ext_predicate.Type = TGSI_INSTRUCTION_EXT_TYPE_PREDICATE; + instruction_ext_predicate.SwizzleX = TGSI_SWIZZLE_X; + instruction_ext_predicate.SwizzleY = TGSI_SWIZZLE_Y; + instruction_ext_predicate.SwizzleZ = TGSI_SWIZZLE_Z; + instruction_ext_predicate.SwizzleW = TGSI_SWIZZLE_W; + instruction_ext_predicate.Negate = 0; + instruction_ext_predicate.SrcIndex = 0; + instruction_ext_predicate.Padding = 0; + instruction_ext_predicate.Extended = 0; + + return instruction_ext_predicate; +} + +unsigned +tgsi_compare_instruction_ext_predicate(struct tgsi_instruction_ext_predicate a, + struct tgsi_instruction_ext_predicate b) +{ + a.Padding = b.Padding = 0; + a.Extended = b.Extended = 0; + return compare32(&a, &b); +} + +struct tgsi_instruction_ext_predicate +tgsi_build_instruction_ext_predicate(unsigned index, + unsigned negate, + unsigned swizzleX, + unsigned swizzleY, + unsigned swizzleZ, + unsigned swizzleW, + struct tgsi_token *prev_token, + struct tgsi_instruction *instruction, + struct tgsi_header *header) +{ + struct tgsi_instruction_ext_predicate instruction_ext_predicate; + + instruction_ext_predicate = tgsi_default_instruction_ext_predicate(); + instruction_ext_predicate.SwizzleX = swizzleX; + instruction_ext_predicate.SwizzleY = swizzleY; + instruction_ext_predicate.SwizzleZ = swizzleZ; + instruction_ext_predicate.SwizzleW = swizzleW; + instruction_ext_predicate.Negate = negate; + instruction_ext_predicate.SrcIndex = index; + + prev_token->Extended = 1; + instruction_grow(instruction, header); + + return instruction_ext_predicate; +} + struct tgsi_src_register tgsi_default_src_register( void ) { @@ -1148,77 +1103,12 @@ tgsi_default_full_dst_register( void ) full_dst_register.DstRegister = tgsi_default_dst_register(); full_dst_register.DstRegisterInd = tgsi_default_src_register(); - full_dst_register.DstRegisterExtConcode = - tgsi_default_dst_register_ext_concode(); full_dst_register.DstRegisterExtModulate = tgsi_default_dst_register_ext_modulate(); return full_dst_register; } -struct tgsi_dst_register_ext_concode -tgsi_default_dst_register_ext_concode( void ) -{ - struct tgsi_dst_register_ext_concode dst_register_ext_concode; - - dst_register_ext_concode.Type = TGSI_DST_REGISTER_EXT_TYPE_CONDCODE; - dst_register_ext_concode.CondMask = TGSI_CC_TR; - dst_register_ext_concode.CondSwizzleX = TGSI_SWIZZLE_X; - dst_register_ext_concode.CondSwizzleY = TGSI_SWIZZLE_Y; - dst_register_ext_concode.CondSwizzleZ = TGSI_SWIZZLE_Z; - dst_register_ext_concode.CondSwizzleW = TGSI_SWIZZLE_W; - dst_register_ext_concode.CondSrcIndex = 0; - dst_register_ext_concode.Padding = 0; - dst_register_ext_concode.Extended = 0; - - return dst_register_ext_concode; -} - -unsigned -tgsi_compare_dst_register_ext_concode( - struct tgsi_dst_register_ext_concode a, - struct tgsi_dst_register_ext_concode b ) -{ - a.Padding = b.Padding = 0; - a.Extended = b.Extended = 0; - return compare32(&a, &b); -} - -struct tgsi_dst_register_ext_concode -tgsi_build_dst_register_ext_concode( - unsigned cc, - unsigned swizzle_x, - unsigned swizzle_y, - unsigned swizzle_z, - unsigned swizzle_w, - int index, - struct tgsi_token *prev_token, - struct tgsi_instruction *instruction, - struct tgsi_header *header ) -{ - struct tgsi_dst_register_ext_concode dst_register_ext_concode; - - assert( cc <= TGSI_CC_FL ); - assert( swizzle_x <= TGSI_SWIZZLE_W ); - assert( swizzle_y <= TGSI_SWIZZLE_W ); - assert( swizzle_z <= TGSI_SWIZZLE_W ); - assert( swizzle_w <= TGSI_SWIZZLE_W ); - assert( index >= -32768 && index <= 32767 ); - - dst_register_ext_concode = tgsi_default_dst_register_ext_concode(); - dst_register_ext_concode.CondMask = cc; - dst_register_ext_concode.CondSwizzleX = swizzle_x; - dst_register_ext_concode.CondSwizzleY = swizzle_y; - dst_register_ext_concode.CondSwizzleZ = swizzle_z; - dst_register_ext_concode.CondSwizzleW = swizzle_w; - dst_register_ext_concode.CondSrcIndex = index; - - prev_token->Extended = 1; - instruction_grow( instruction, header ); - - return dst_register_ext_concode; -} - struct tgsi_dst_register_ext_modulate tgsi_default_dst_register_ext_modulate( void ) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.h b/src/gallium/auxiliary/tgsi/tgsi_build.h index 9ae1705f6c..669712eb8f 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.h +++ b/src/gallium/auxiliary/tgsi/tgsi_build.h @@ -157,30 +157,6 @@ tgsi_build_full_instruction( struct tgsi_header *header, unsigned maxsize ); -struct tgsi_instruction_ext_nv -tgsi_default_instruction_ext_nv( void ); - -unsigned -tgsi_compare_instruction_ext_nv( - struct tgsi_instruction_ext_nv a, - struct tgsi_instruction_ext_nv b ); - -struct tgsi_instruction_ext_nv -tgsi_build_instruction_ext_nv( - unsigned precision, - unsigned cond_dst_index, - unsigned cond_flow_index, - unsigned cond_mask, - unsigned cond_swizzle_x, - unsigned cond_swizzle_y, - unsigned cond_swizzle_z, - unsigned cond_swizzle_w, - unsigned cond_dst_update, - unsigned cond_flow_enable, - struct tgsi_token *prev_token, - struct tgsi_instruction *instruction, - struct tgsi_header *header ); - struct tgsi_instruction_ext_label tgsi_default_instruction_ext_label( void ); @@ -211,6 +187,24 @@ tgsi_build_instruction_ext_texture( struct tgsi_instruction *instruction, struct tgsi_header *header ); +struct tgsi_instruction_ext_predicate +tgsi_default_instruction_ext_predicate(void); + +unsigned +tgsi_compare_instruction_ext_predicate(struct tgsi_instruction_ext_predicate a, + struct tgsi_instruction_ext_predicate b); + +struct tgsi_instruction_ext_predicate +tgsi_build_instruction_ext_predicate(unsigned index, + unsigned negate, + unsigned swizzleX, + unsigned swizzleY, + unsigned swizzleZ, + unsigned swizzleW, + struct tgsi_token *prev_token, + struct tgsi_instruction *instruction, + struct tgsi_header *header); + struct tgsi_src_register tgsi_default_src_register( void ); @@ -275,26 +269,6 @@ tgsi_build_dst_register( struct tgsi_full_dst_register tgsi_default_full_dst_register( void ); -struct tgsi_dst_register_ext_concode -tgsi_default_dst_register_ext_concode( void ); - -unsigned -tgsi_compare_dst_register_ext_concode( - struct tgsi_dst_register_ext_concode a, - struct tgsi_dst_register_ext_concode b ); - -struct tgsi_dst_register_ext_concode -tgsi_build_dst_register_ext_concode( - unsigned cc, - unsigned swizzle_x, - unsigned swizzle_y, - unsigned swizzle_z, - unsigned swizzle_w, - int index, - struct tgsi_token *prev_token, - struct tgsi_instruction *instruction, - struct tgsi_header *header ); - struct tgsi_dst_register_ext_modulate tgsi_default_dst_register_ext_modulate( void ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index 3a584a10a1..d16e64f9c5 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -100,7 +100,8 @@ static const char *file_names[TGSI_FILE_COUNT] = "SAMP", "ADDR", "IMM", - "LOOP" + "LOOP", + "PRED" }; static const char *interpolate_names[] = diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c index c7dbdb3bd2..4648051e29 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c @@ -79,7 +79,8 @@ static const char *TGSI_FILES[TGSI_FILE_COUNT] = "FILE_SAMPLER", "FILE_ADDRESS", "FILE_IMMEDIATE", - "FILE_LOOP" + "FILE_LOOP", + "FILE_PREDICATE" }; static const char *TGSI_INTERPOLATES[] = @@ -114,32 +115,11 @@ static const char *TGSI_SATS[] = static const char *TGSI_INSTRUCTION_EXTS[] = { - "INSTRUCTION_EXT_TYPE_NV", + "", "INSTRUCTION_EXT_TYPE_LABEL", "INSTRUCTION_EXT_TYPE_TEXTURE" }; -static const char *TGSI_PRECISIONS[] = -{ - "PRECISION_DEFAULT", - "PRECISION_FLOAT32", - "PRECISION_FLOAT16", - "PRECISION_FIXED12" -}; - -static const char *TGSI_CCS[] = -{ - "CC_GT", - "CC_EQ", - "CC_LT", - "CC_UN", - "CC_GE", - "CC_LE", - "CC_NE", - "CC_TR", - "CC_FL" -}; - static const char *TGSI_SWIZZLES[] = { "SWIZZLE_X", @@ -189,7 +169,7 @@ static const char *TGSI_WRITEMASKS[] = static const char *TGSI_DST_REGISTER_EXTS[] = { - "DST_REGISTER_EXT_TYPE_CONDCODE", + "", "DST_REGISTER_EXT_TYPE_MODULATE" }; @@ -317,60 +297,6 @@ dump_instruction_verbose( UIX( inst->Instruction.Padding ); } - if( deflt || tgsi_compare_instruction_ext_nv( inst->InstructionExtNv, fi->InstructionExtNv ) ) { - EOL(); - TXT( "\nType : " ); - ENM( inst->InstructionExtNv.Type, TGSI_INSTRUCTION_EXTS ); - if( deflt || fi->InstructionExtNv.Precision != inst->InstructionExtNv.Precision ) { - TXT( "\nPrecision : " ); - ENM( inst->InstructionExtNv.Precision, TGSI_PRECISIONS ); - } - if( deflt || fi->InstructionExtNv.CondDstIndex != inst->InstructionExtNv.CondDstIndex ) { - TXT( "\nCondDstIndex : " ); - UID( inst->InstructionExtNv.CondDstIndex ); - } - if( deflt || fi->InstructionExtNv.CondFlowIndex != inst->InstructionExtNv.CondFlowIndex ) { - TXT( "\nCondFlowIndex : " ); - UID( inst->InstructionExtNv.CondFlowIndex ); - } - if( deflt || fi->InstructionExtNv.CondMask != inst->InstructionExtNv.CondMask ) { - TXT( "\nCondMask : " ); - ENM( inst->InstructionExtNv.CondMask, TGSI_CCS ); - } - if( deflt || fi->InstructionExtNv.CondSwizzleX != inst->InstructionExtNv.CondSwizzleX ) { - TXT( "\nCondSwizzleX : " ); - ENM( inst->InstructionExtNv.CondSwizzleX, TGSI_SWIZZLES ); - } - if( deflt || fi->InstructionExtNv.CondSwizzleY != inst->InstructionExtNv.CondSwizzleY ) { - TXT( "\nCondSwizzleY : " ); - ENM( inst->InstructionExtNv.CondSwizzleY, TGSI_SWIZZLES ); - } - if( deflt || fi->InstructionExtNv.CondSwizzleZ != inst->InstructionExtNv.CondSwizzleZ ) { - TXT( "\nCondSwizzleZ : " ); - ENM( inst->InstructionExtNv.CondSwizzleZ, TGSI_SWIZZLES ); - } - if( deflt || fi->InstructionExtNv.CondSwizzleW != inst->InstructionExtNv.CondSwizzleW ) { - TXT( "\nCondSwizzleW : " ); - ENM( inst->InstructionExtNv.CondSwizzleW, TGSI_SWIZZLES ); - } - if( deflt || fi->InstructionExtNv.CondDstUpdate != inst->InstructionExtNv.CondDstUpdate ) { - TXT( "\nCondDstUpdate : " ); - UID( inst->InstructionExtNv.CondDstUpdate ); - } - if( deflt || fi->InstructionExtNv.CondFlowEnable != inst->InstructionExtNv.CondFlowEnable ) { - TXT( "\nCondFlowEnable: " ); - UID( inst->InstructionExtNv.CondFlowEnable ); - } - if( ignored ) { - TXT( "\nPadding : " ); - UIX( inst->InstructionExtNv.Padding ); - if( deflt || fi->InstructionExtNv.Extended != inst->InstructionExtNv.Extended ) { - TXT( "\nExtended : " ); - UID( inst->InstructionExtNv.Extended ); - } - } - } - if( deflt || tgsi_compare_instruction_ext_label( inst->InstructionExtLabel, fi->InstructionExtLabel ) ) { EOL(); TXT( "\nType : " ); @@ -441,44 +367,6 @@ dump_instruction_verbose( } } - if( deflt || tgsi_compare_dst_register_ext_concode( dst->DstRegisterExtConcode, fd->DstRegisterExtConcode ) ) { - EOL(); - TXT( "\nType : " ); - ENM( dst->DstRegisterExtConcode.Type, TGSI_DST_REGISTER_EXTS ); - if( deflt || fd->DstRegisterExtConcode.CondMask != dst->DstRegisterExtConcode.CondMask ) { - TXT( "\nCondMask : " ); - ENM( dst->DstRegisterExtConcode.CondMask, TGSI_CCS ); - } - if( deflt || fd->DstRegisterExtConcode.CondSwizzleX != dst->DstRegisterExtConcode.CondSwizzleX ) { - TXT( "\nCondSwizzleX: " ); - ENM( dst->DstRegisterExtConcode.CondSwizzleX, TGSI_SWIZZLES ); - } - if( deflt || fd->DstRegisterExtConcode.CondSwizzleY != dst->DstRegisterExtConcode.CondSwizzleY ) { - TXT( "\nCondSwizzleY: " ); - ENM( dst->DstRegisterExtConcode.CondSwizzleY, TGSI_SWIZZLES ); - } - if( deflt || fd->DstRegisterExtConcode.CondSwizzleZ != dst->DstRegisterExtConcode.CondSwizzleZ ) { - TXT( "\nCondSwizzleZ: " ); - ENM( dst->DstRegisterExtConcode.CondSwizzleZ, TGSI_SWIZZLES ); - } - if( deflt || fd->DstRegisterExtConcode.CondSwizzleW != dst->DstRegisterExtConcode.CondSwizzleW ) { - TXT( "\nCondSwizzleW: " ); - ENM( dst->DstRegisterExtConcode.CondSwizzleW, TGSI_SWIZZLES ); - } - if( deflt || fd->DstRegisterExtConcode.CondSrcIndex != dst->DstRegisterExtConcode.CondSrcIndex ) { - TXT( "\nCondSrcIndex: " ); - UID( dst->DstRegisterExtConcode.CondSrcIndex ); - } - if( ignored ) { - TXT( "\nPadding : " ); - UIX( dst->DstRegisterExtConcode.Padding ); - if( deflt || fd->DstRegisterExtConcode.Extended != dst->DstRegisterExtConcode.Extended ) { - TXT( "\nExtended : " ); - UID( dst->DstRegisterExtConcode.Extended ); - } - } - } - if( deflt || tgsi_compare_dst_register_ext_modulate( dst->DstRegisterExtModulate, fd->DstRegisterExtModulate ) ) { EOL(); TXT( "\nType : " ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 14f0fc4e38..1989045985 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -107,6 +107,7 @@ #define TEMP_HALF_I TGSI_EXEC_TEMP_HALF_I #define TEMP_HALF_C TGSI_EXEC_TEMP_HALF_C #define TEMP_R0 TGSI_EXEC_TEMP_R0 +#define TEMP_P0 TGSI_EXEC_TEMP_P0 #define IS_CHANNEL_ENABLED(INST, CHAN)\ ((INST).FullDstRegisters[0].DstRegister.WriteMask & (1 << (CHAN))) @@ -1187,6 +1188,17 @@ fetch_src_file_channel( chan->u[3] = mach->Addrs[index->i[3]].xyzw[swizzle].u[3]; break; + case TGSI_FILE_PREDICATE: + assert(index->i[0] < TGSI_EXEC_NUM_PREDS); + assert(index->i[1] < TGSI_EXEC_NUM_PREDS); + assert(index->i[2] < TGSI_EXEC_NUM_PREDS); + assert(index->i[3] < TGSI_EXEC_NUM_PREDS); + chan->u[0] = mach->Addrs[0].xyzw[swizzle].u[0]; + chan->u[1] = mach->Addrs[0].xyzw[swizzle].u[1]; + chan->u[2] = mach->Addrs[0].xyzw[swizzle].u[2]; + chan->u[3] = mach->Addrs[0].xyzw[swizzle].u[3]; + break; + case TGSI_FILE_OUTPUT: /* vertex/fragment output vars can be read too */ chan->u[0] = mach->Outputs[index->i[0]].xyzw[swizzle].u[0]; @@ -1466,119 +1478,17 @@ store_dest( dst = &mach->Addrs[index].xyzw[chan_index]; break; + case TGSI_FILE_PREDICATE: + index = reg->DstRegister.Index; + assert(index < TGSI_EXEC_NUM_PREDS); + dst = &mach->Addrs[index].xyzw[chan_index]; + break; + default: assert( 0 ); return; } - if (inst->InstructionExtNv.CondFlowEnable) { - union tgsi_exec_channel *cc = &mach->Temps[TEMP_CC_I].xyzw[TEMP_CC_C]; - uint swizzle; - uint shift; - uint mask; - uint test; - - /* Only CC0 supported. - */ - assert( inst->InstructionExtNv.CondFlowIndex < 1 ); - - switch (chan_index) { - case CHAN_X: - swizzle = inst->InstructionExtNv.CondSwizzleX; - break; - case CHAN_Y: - swizzle = inst->InstructionExtNv.CondSwizzleY; - break; - case CHAN_Z: - swizzle = inst->InstructionExtNv.CondSwizzleZ; - break; - case CHAN_W: - swizzle = inst->InstructionExtNv.CondSwizzleW; - break; - default: - assert( 0 ); - return; - } - - switch (swizzle) { - case TGSI_SWIZZLE_X: - shift = TGSI_EXEC_CC_X_SHIFT; - mask = TGSI_EXEC_CC_X_MASK; - break; - case TGSI_SWIZZLE_Y: - shift = TGSI_EXEC_CC_Y_SHIFT; - mask = TGSI_EXEC_CC_Y_MASK; - break; - case TGSI_SWIZZLE_Z: - shift = TGSI_EXEC_CC_Z_SHIFT; - mask = TGSI_EXEC_CC_Z_MASK; - break; - case TGSI_SWIZZLE_W: - shift = TGSI_EXEC_CC_W_SHIFT; - mask = TGSI_EXEC_CC_W_MASK; - break; - default: - assert( 0 ); - return; - } - - switch (inst->InstructionExtNv.CondMask) { - case TGSI_CC_GT: - test = ~(TGSI_EXEC_CC_GT << shift) & mask; - for (i = 0; i < QUAD_SIZE; i++) - if (cc->u[i] & test) - execmask &= ~(1 << i); - break; - - case TGSI_CC_EQ: - test = ~(TGSI_EXEC_CC_EQ << shift) & mask; - for (i = 0; i < QUAD_SIZE; i++) - if (cc->u[i] & test) - execmask &= ~(1 << i); - break; - - case TGSI_CC_LT: - test = ~(TGSI_EXEC_CC_LT << shift) & mask; - for (i = 0; i < QUAD_SIZE; i++) - if (cc->u[i] & test) - execmask &= ~(1 << i); - break; - - case TGSI_CC_GE: - test = ~((TGSI_EXEC_CC_GT | TGSI_EXEC_CC_EQ) << shift) & mask; - for (i = 0; i < QUAD_SIZE; i++) - if (cc->u[i] & test) - execmask &= ~(1 << i); - break; - - case TGSI_CC_LE: - test = ~((TGSI_EXEC_CC_LT | TGSI_EXEC_CC_EQ) << shift) & mask; - for (i = 0; i < QUAD_SIZE; i++) - if (cc->u[i] & test) - execmask &= ~(1 << i); - break; - - case TGSI_CC_NE: - test = ~((TGSI_EXEC_CC_GT | TGSI_EXEC_CC_LT | TGSI_EXEC_CC_UN) << shift) & mask; - for (i = 0; i < QUAD_SIZE; i++) - if (cc->u[i] & test) - execmask &= ~(1 << i); - break; - - case TGSI_CC_TR: - break; - - case TGSI_CC_FL: - for (i = 0; i < QUAD_SIZE; i++) - execmask &= ~(1 << i); - break; - - default: - assert( 0 ); - return; - } - } - switch (inst->Instruction.Saturate) { case TGSI_SAT_NONE: for (i = 0; i < QUAD_SIZE; i++) @@ -1613,51 +1523,6 @@ store_dest( default: assert( 0 ); } - - if (inst->InstructionExtNv.CondDstUpdate) { - union tgsi_exec_channel *cc = &mach->Temps[TEMP_CC_I].xyzw[TEMP_CC_C]; - uint shift; - uint mask; - - /* Only CC0 supported. - */ - assert( inst->InstructionExtNv.CondDstIndex < 1 ); - - switch (chan_index) { - case CHAN_X: - shift = TGSI_EXEC_CC_X_SHIFT; - mask = ~TGSI_EXEC_CC_X_MASK; - break; - case CHAN_Y: - shift = TGSI_EXEC_CC_Y_SHIFT; - mask = ~TGSI_EXEC_CC_Y_MASK; - break; - case CHAN_Z: - shift = TGSI_EXEC_CC_Z_SHIFT; - mask = ~TGSI_EXEC_CC_Z_MASK; - break; - case CHAN_W: - shift = TGSI_EXEC_CC_W_SHIFT; - mask = ~TGSI_EXEC_CC_W_MASK; - break; - default: - assert( 0 ); - return; - } - - for (i = 0; i < QUAD_SIZE; i++) - if (execmask & (1 << i)) { - cc->u[i] &= mask; - if (dst->f[i] < 0.0f) - cc->u[i] |= TGSI_EXEC_CC_LT << shift; - else if (dst->f[i] > 0.0f) - cc->u[i] |= TGSI_EXEC_CC_GT << shift; - else if (dst->f[i] == 0.0f) - cc->u[i] |= TGSI_EXEC_CC_EQ << shift; - else - cc->u[i] |= TGSI_EXEC_CC_UN << shift; - } - } } #define FETCH(VAL,INDEX,CHAN)\ @@ -1717,32 +1582,8 @@ exec_kilp(struct tgsi_exec_machine *mach, { uint kilmask; /* bit 0 = pixel 0, bit 1 = pixel 1, etc */ - if (inst->InstructionExtNv.CondFlowEnable) { - uint swizzle[4]; - uint chan_index; - - kilmask = 0x0; - - swizzle[0] = inst->InstructionExtNv.CondSwizzleX; - swizzle[1] = inst->InstructionExtNv.CondSwizzleY; - swizzle[2] = inst->InstructionExtNv.CondSwizzleZ; - swizzle[3] = inst->InstructionExtNv.CondSwizzleW; - - for (chan_index = 0; chan_index < 4; chan_index++) - { - uint i; - - for (i = 0; i < 4; i++) { - /* TODO: evaluate the condition code */ - if (0) - kilmask |= 1 << i; - } - } - } - else { - /* "unconditional" kil */ - kilmask = mach->ExecMask; - } + /* "unconditional" kil */ + kilmask = mach->ExecMask; mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0] |= kilmask; } diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h index c72f76809d..08df15ec6a 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.h +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h @@ -168,7 +168,12 @@ struct tgsi_exec_labels #define TGSI_EXEC_TEMP_ADDR (TGSI_EXEC_NUM_TEMPS + 8) #define TGSI_EXEC_NUM_ADDRS 1 -#define TGSI_EXEC_NUM_TEMP_EXTRAS 9 + +/* predicate register */ +#define TGSI_EXEC_TEMP_P0 (TGSI_EXEC_NUM_TEMPS + 9) +#define TGSI_EXEC_NUM_PREDS 1 + +#define TGSI_EXEC_NUM_TEMP_EXTRAS 10 diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c index f742c71936..83f9df1183 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.c +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c @@ -181,10 +181,6 @@ tgsi_parse_token( next_token( ctx, &token ); switch( token.Type ) { - case TGSI_INSTRUCTION_EXT_TYPE_NV: - copy_token(&inst->InstructionExtNv, &token); - break; - case TGSI_INSTRUCTION_EXT_TYPE_LABEL: copy_token(&inst->InstructionExtLabel, &token); break; @@ -193,6 +189,10 @@ tgsi_parse_token( copy_token(&inst->InstructionExtTexture, &token); break; + case TGSI_INSTRUCTION_EXT_TYPE_PREDICATE: + copy_token(&inst->InstructionExtPredicate, &token); + break; + default: assert( 0 ); } @@ -220,11 +220,6 @@ tgsi_parse_token( next_token( ctx, &token ); switch( token.Type ) { - case TGSI_DST_REGISTER_EXT_TYPE_CONDCODE: - copy_token(&inst->FullDstRegisters[i].DstRegisterExtConcode, - &token); - break; - case TGSI_DST_REGISTER_EXT_TYPE_MODULATE: copy_token(&inst->FullDstRegisters[i].DstRegisterExtModulate, &token); diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h b/src/gallium/auxiliary/tgsi/tgsi_parse.h index 602131398d..76f1676d85 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.h +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h @@ -49,7 +49,6 @@ struct tgsi_full_dst_register { struct tgsi_dst_register DstRegister; struct tgsi_src_register DstRegisterInd; - struct tgsi_dst_register_ext_concode DstRegisterExtConcode; struct tgsi_dst_register_ext_modulate DstRegisterExtModulate; }; @@ -81,9 +80,9 @@ struct tgsi_full_immediate struct tgsi_full_instruction { struct tgsi_instruction Instruction; - struct tgsi_instruction_ext_nv InstructionExtNv; struct tgsi_instruction_ext_label InstructionExtLabel; struct tgsi_instruction_ext_texture InstructionExtTexture; + struct tgsi_instruction_ext_predicate InstructionExtPredicate; struct tgsi_full_dst_register FullDstRegisters[TGSI_FULL_MAX_DST_REGISTERS]; struct tgsi_full_src_register FullSrcRegisters[TGSI_FULL_MAX_SRC_REGISTERS]; uint Flags; /**< user-defined usage */ diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c b/src/gallium/auxiliary/tgsi/tgsi_sanity.c index 53e13b30e6..36e27ea52f 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c @@ -141,7 +141,8 @@ static const char *file_names[TGSI_FILE_COUNT] = "SAMP", "ADDR", "IMM", - "LOOP" + "LOOP", + "PRED" }; static boolean diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index 87d9cd7b3f..d2b03ffb2f 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -232,7 +232,8 @@ static const char *file_names[TGSI_FILE_COUNT] = "SAMP", "ADDR", "IMM", - "LOOP" + "LOOP", + "PRED" }; static boolean -- cgit v1.2.3 From 962ece954068646f8e2c0e9ea81395ab7eaf5ee8 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 2 Nov 2009 09:42:28 +0000 Subject: tgsi/ureg: Update for gallium interface changes. --- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 56 ++++++++++++++++++++++++++-------- src/gallium/auxiliary/tgsi/tgsi_ureg.h | 35 +++++++++++++++------ 2 files changed, 69 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 8cb574ea43..1ef16d144c 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -29,6 +29,7 @@ #include "pipe/p_context.h" #include "pipe/p_state.h" #include "tgsi/tgsi_ureg.h" +#include "tgsi/tgsi_build.h" #include "tgsi/tgsi_info.h" #include "tgsi/tgsi_dump.h" #include "tgsi/tgsi_sanity.h" @@ -46,7 +47,6 @@ union tgsi_any_token { struct tgsi_immediate imm; union tgsi_immediate_data imm_data; struct tgsi_instruction insn; - struct tgsi_instruction_ext_nv insn_ext_nv; struct tgsi_instruction_ext_label insn_ext_label; struct tgsi_instruction_ext_texture insn_ext_texture; struct tgsi_instruction_ext_predicate insn_ext_predicate; @@ -54,9 +54,7 @@ union tgsi_any_token { struct tgsi_src_register_ext_mod src_ext_mod; struct tgsi_dimension dim; struct tgsi_dst_register dst; - struct tgsi_dst_register_ext_concode dst_ext_code; struct tgsi_dst_register_ext_modulate dst_ext_mod; - struct tgsi_dst_register_ext_predicate dst_ext_pred; unsigned value; }; @@ -74,6 +72,7 @@ struct ureg_tokens { #define UREG_MAX_IMMEDIATE 32 #define UREG_MAX_TEMP 256 #define UREG_MAX_ADDR 2 +#define UREG_MAX_PRED 1 #define DOMAIN_DECL 0 #define DOMAIN_INSN 1 @@ -117,6 +116,7 @@ struct ureg_program unsigned nr_constant_ranges; unsigned nr_addrs; + unsigned nr_preds; unsigned nr_instructions; struct ureg_tokens domain[2]; @@ -416,6 +416,19 @@ struct ureg_dst ureg_DECL_address( struct ureg_program *ureg ) return ureg_dst_register( TGSI_FILE_ADDRESS, 0 ); } +/* Allocate a new predicate register. + */ +struct ureg_dst +ureg_DECL_predicate(struct ureg_program *ureg) +{ + if (ureg->nr_preds < UREG_MAX_PRED) { + return ureg_dst_register(TGSI_FILE_PREDICATE, ureg->nr_preds++); + } + + assert(0); + return ureg_dst_register(TGSI_FILE_PREDICATE, 0); +} + /* Allocate a new sampler. */ struct ureg_src ureg_DECL_sampler( struct ureg_program *ureg, @@ -631,14 +644,16 @@ unsigned ureg_emit_insn(struct ureg_program *ureg, unsigned opcode, boolean saturate, + boolean predicate, unsigned num_dst, unsigned num_src ) { union tgsi_any_token *out; + uint count = predicate ? 2 : 1; validate( opcode, num_dst, num_src ); - out = get_tokens( ureg, DOMAIN_INSN, 1 ); + out = get_tokens( ureg, DOMAIN_INSN, count ); out[0].value = 0; out[0].insn.Type = TGSI_TOKEN_TYPE_INSTRUCTION; out[0].insn.NrTokens = 0; @@ -647,11 +662,17 @@ ureg_emit_insn(struct ureg_program *ureg, out[0].insn.NumDstRegs = num_dst; out[0].insn.NumSrcRegs = num_src; out[0].insn.Padding = 0; - out[0].insn.Extended = 0; - + + if (predicate) { + out[0].insn.Extended = 1; + out[1].insn_ext_predicate = tgsi_default_instruction_ext_predicate(); + } else { + out[0].insn.Extended = 0; + } + ureg->nr_instructions++; - return ureg->domain[DOMAIN_INSN].count - 1; + return ureg->domain[DOMAIN_INSN].count - count; } @@ -739,10 +760,12 @@ ureg_insn(struct ureg_program *ureg, { unsigned insn, i; boolean saturate; + boolean predicate; saturate = nr_dst ? dst[0].Saturate : FALSE; + predicate = nr_dst ? dst[0].Predicate : FALSE; - insn = ureg_emit_insn( ureg, opcode, saturate, nr_dst, nr_src ); + insn = ureg_emit_insn( ureg, opcode, saturate, predicate, nr_dst, nr_src ); for (i = 0; i < nr_dst; i++) ureg_emit_dst( ureg, dst[i] ); @@ -764,12 +787,14 @@ ureg_tex_insn(struct ureg_program *ureg, { unsigned insn, i; boolean saturate; + boolean predicate; saturate = nr_dst ? dst[0].Saturate : FALSE; + predicate = nr_dst ? dst[0].Predicate : FALSE; - insn = ureg_emit_insn( ureg, opcode, saturate, nr_dst, nr_src ); + insn = ureg_emit_insn( ureg, opcode, saturate, predicate, nr_dst, nr_src ); - ureg_emit_texture( ureg, insn, target ); \ + ureg_emit_texture( ureg, insn, target ); for (i = 0; i < nr_dst; i++) ureg_emit_dst( ureg, dst[i] ); @@ -790,9 +815,9 @@ ureg_label_insn(struct ureg_program *ureg, { unsigned insn, i; - insn = ureg_emit_insn( ureg, opcode, FALSE, 0, nr_src ); + insn = ureg_emit_insn( ureg, opcode, FALSE, FALSE, 0, nr_src ); - ureg_emit_label( ureg, insn, label_token ); \ + ureg_emit_label( ureg, insn, label_token ); for (i = 0; i < nr_src; i++) ureg_emit_src( ureg, src[i] ); @@ -929,6 +954,13 @@ static void emit_decls( struct ureg_program *ureg ) 0, ureg->nr_addrs ); } + if (ureg->nr_preds) { + emit_decl_range(ureg, + TGSI_FILE_PREDICATE, + 0, + ureg->nr_preds); + } + for (i = 0; i < ureg->nr_immediates; i++) { emit_immediate( ureg, ureg->immediate[i].v ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index f04f443b9e..36c0bd2dcf 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -67,6 +67,7 @@ struct ureg_dst unsigned WriteMask : 4; /* TGSI_WRITEMASK_ */ unsigned Indirect : 1; /* BOOL */ unsigned Saturate : 1; /* BOOL */ + unsigned Predicate : 1; int Index : 16; /* SINT */ unsigned Pad1 : 5; unsigned Pad2 : 1; /* BOOL */ @@ -153,6 +154,9 @@ ureg_release_temporary( struct ureg_program *ureg, struct ureg_dst ureg_DECL_address( struct ureg_program * ); +struct ureg_dst +ureg_DECL_predicate(struct ureg_program *); + /* Supply an index to the sampler declaration as this is the hook to * the external pipe_sampler state. Users of this function probably * don't want just any sampler, but a specific one which they've set @@ -270,6 +274,7 @@ unsigned ureg_emit_insn(struct ureg_program *ureg, unsigned opcode, boolean saturate, + boolean predicate, unsigned num_dst, unsigned num_src ); @@ -300,7 +305,7 @@ ureg_fixup_insn_size(struct ureg_program *ureg, static INLINE void ureg_##op( struct ureg_program *ureg ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn( ureg, opcode, FALSE, 0, 0 ); \ + unsigned insn = ureg_emit_insn( ureg, opcode, FALSE, FALSE, 0, 0 );\ ureg_fixup_insn_size( ureg, insn ); \ } @@ -309,7 +314,7 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ struct ureg_src src ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn( ureg, opcode, FALSE, 0, 1 ); \ + unsigned insn = ureg_emit_insn( ureg, opcode, FALSE, FALSE, 0, 1 );\ ureg_emit_src( ureg, src ); \ ureg_fixup_insn_size( ureg, insn ); \ } @@ -319,7 +324,7 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ unsigned *label_token ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn( ureg, opcode, FALSE, 0, 0 ); \ + unsigned insn = ureg_emit_insn( ureg, opcode, FALSE, FALSE, 0, 0 );\ ureg_emit_label( ureg, insn, label_token ); \ ureg_fixup_insn_size( ureg, insn ); \ } @@ -330,7 +335,7 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ unsigned *label_token ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn( ureg, opcode, FALSE, 0, 1 ); \ + unsigned insn = ureg_emit_insn( ureg, opcode, FALSE, FALSE, 0, 1 );\ ureg_emit_label( ureg, insn, label_token ); \ ureg_emit_src( ureg, src ); \ ureg_fixup_insn_size( ureg, insn ); \ @@ -341,7 +346,7 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ struct ureg_dst dst ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn( ureg, opcode, dst.Saturate, 1, 0 ); \ + unsigned insn = ureg_emit_insn( ureg, opcode, dst.Saturate, dst.Predicate, 1, 0 );\ ureg_emit_dst( ureg, dst ); \ ureg_fixup_insn_size( ureg, insn ); \ } @@ -353,7 +358,7 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ struct ureg_src src ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn( ureg, opcode, dst.Saturate, 1, 1 ); \ + unsigned insn = ureg_emit_insn( ureg, opcode, dst.Saturate, dst.Predicate, 1, 1 );\ ureg_emit_dst( ureg, dst ); \ ureg_emit_src( ureg, src ); \ ureg_fixup_insn_size( ureg, insn ); \ @@ -366,7 +371,7 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ struct ureg_src src1 ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn( ureg, opcode, dst.Saturate, 1, 2 ); \ + unsigned insn = ureg_emit_insn( ureg, opcode, dst.Saturate, dst.Predicate, 1, 2 );\ ureg_emit_dst( ureg, dst ); \ ureg_emit_src( ureg, src0 ); \ ureg_emit_src( ureg, src1 ); \ @@ -381,7 +386,7 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ struct ureg_src src1 ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn( ureg, opcode, dst.Saturate, 1, 2 ); \ + unsigned insn = ureg_emit_insn( ureg, opcode, dst.Saturate, dst.Predicate, 1, 2 );\ ureg_emit_texture( ureg, insn, target ); \ ureg_emit_dst( ureg, dst ); \ ureg_emit_src( ureg, src0 ); \ @@ -397,7 +402,7 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ struct ureg_src src2 ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn( ureg, opcode, dst.Saturate, 1, 3 ); \ + unsigned insn = ureg_emit_insn( ureg, opcode, dst.Saturate, dst.Predicate, 1, 3 );\ ureg_emit_dst( ureg, dst ); \ ureg_emit_src( ureg, src0 ); \ ureg_emit_src( ureg, src1 ); \ @@ -415,7 +420,7 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ struct ureg_src src3 ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn( ureg, opcode, dst.Saturate, 1, 4 ); \ + unsigned insn = ureg_emit_insn( ureg, opcode, dst.Saturate, dst.Predicate, 1, 4 );\ ureg_emit_texture( ureg, insn, target ); \ ureg_emit_dst( ureg, dst ); \ ureg_emit_src( ureg, src0 ); \ @@ -497,6 +502,14 @@ ureg_saturate( struct ureg_dst reg ) return reg; } +static INLINE struct ureg_dst +ureg_predicate(struct ureg_dst reg) +{ + assert(reg.File != TGSI_FILE_NULL); + reg.Predicate = 1; + return reg; +} + static INLINE struct ureg_dst ureg_dst_indirect( struct ureg_dst reg, struct ureg_src addr ) { @@ -530,6 +543,7 @@ ureg_dst( struct ureg_src src ) dst.IndirectIndex = src.IndirectIndex; dst.IndirectSwizzle = src.IndirectSwizzle; dst.Saturate = 0; + dst.Predicate = 0; dst.Index = src.Index; dst.Pad1 = 0; dst.Pad2 = 0; @@ -571,6 +585,7 @@ ureg_dst_undef( void ) dst.IndirectIndex = 0; dst.IndirectSwizzle = 0; dst.Saturate = 0; + dst.Predicate = 0; dst.Index = 0; dst.Pad1 = 0; dst.Pad2 = 0; -- cgit v1.2.3 From a40055f4b608a8f3c07218172ed169214db19236 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 2 Nov 2009 06:51:47 -0700 Subject: gallium/util: add casts to silence warnings --- src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c index a0b116304f..2ef4293d4d 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c @@ -540,7 +540,7 @@ fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list) fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head); assert(!fenced_buf->fence); debug_printf("%10p %7u %7u\n", - fenced_buf, + (void *) fenced_buf, fenced_buf->base.base.size, p_atomic_read(&fenced_buf->base.base.reference.count)); curr = next; @@ -554,10 +554,10 @@ fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list) fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head); signaled = ops->fence_signalled(ops, fenced_buf->fence, 0); debug_printf("%10p %7u %7u %10p %s\n", - fenced_buf, + (void *) fenced_buf, fenced_buf->base.base.size, p_atomic_read(&fenced_buf->base.base.reference.count), - fenced_buf->fence, + (void *) fenced_buf->fence, signaled == 0 ? "y" : "n"); curr = next; next = curr->next; -- cgit v1.2.3 From c02cd82b463661def7842f910dc561313559df80 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 2 Nov 2009 06:52:05 -0700 Subject: mesa: fix incorrect approx bits/channel for fxt1 formats See bug 24806. --- src/mesa/main/formats.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index e9b33e489a..7d0e2d2914 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -444,7 +444,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = "MESA_FORMAT_RGB_FXT1", GL_RGB, GL_UNSIGNED_NORMALIZED, - 8, 8, 8, 0, + 4, 4, 4, 0, /* approx Red/Green/BlueBits */ 0, 0, 0, 0, 0, 8, 4, 16 /* 16 bytes per 8x4 block */ }, @@ -453,7 +453,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = "MESA_FORMAT_RGBA_FXT1", GL_RGBA, GL_UNSIGNED_NORMALIZED, - 8, 8, 8, 8, + 4, 4, 4, 1, /* approx Red/Green/Blue/AlphaBits */ 0, 0, 0, 0, 0, 8, 4, 16 /* 16 bytes per 8x4 block */ }, -- cgit v1.2.3 From c379fbbe244bf6778c5bd66c1f2118f83b08f90d Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 2 Nov 2009 14:59:52 +0000 Subject: tgsi/ureg: Add negate and swizzle for predicates. --- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 72 +++++++++++++-- src/gallium/auxiliary/tgsi/tgsi_ureg.h | 158 +++++++++++++++++++++++++++++---- 2 files changed, 208 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 1ef16d144c..67af953e09 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -206,9 +206,13 @@ ureg_dst_register( unsigned file, dst.IndirectIndex = 0; dst.IndirectSwizzle = 0; dst.Saturate = 0; + dst.Predicate = 0; + dst.PredNegate = 0; + dst.PredSwizzleX = TGSI_SWIZZLE_X; + dst.PredSwizzleY = TGSI_SWIZZLE_Y; + dst.PredSwizzleZ = TGSI_SWIZZLE_Z; + dst.PredSwizzleW = TGSI_SWIZZLE_W; dst.Index = index; - dst.Pad1 = 0; - dst.Pad2 = 0; return dst; } @@ -645,6 +649,11 @@ ureg_emit_insn(struct ureg_program *ureg, unsigned opcode, boolean saturate, boolean predicate, + boolean pred_negate, + unsigned pred_swizzle_x, + unsigned pred_swizzle_y, + unsigned pred_swizzle_z, + unsigned pred_swizzle_w, unsigned num_dst, unsigned num_src ) { @@ -666,6 +675,11 @@ ureg_emit_insn(struct ureg_program *ureg, if (predicate) { out[0].insn.Extended = 1; out[1].insn_ext_predicate = tgsi_default_instruction_ext_predicate(); + out[1].insn_ext_predicate.Negate = pred_negate; + out[1].insn_ext_predicate.SwizzleX = pred_swizzle_x; + out[1].insn_ext_predicate.SwizzleY = pred_swizzle_y; + out[1].insn_ext_predicate.SwizzleZ = pred_swizzle_z; + out[1].insn_ext_predicate.SwizzleW = pred_swizzle_w; } else { out[0].insn.Extended = 0; } @@ -761,11 +775,30 @@ ureg_insn(struct ureg_program *ureg, unsigned insn, i; boolean saturate; boolean predicate; + boolean negate; + unsigned swizzle[4]; saturate = nr_dst ? dst[0].Saturate : FALSE; predicate = nr_dst ? dst[0].Predicate : FALSE; + if (predicate) { + negate = dst[0].PredNegate; + swizzle[0] = dst[0].PredSwizzleX; + swizzle[1] = dst[0].PredSwizzleY; + swizzle[2] = dst[0].PredSwizzleZ; + swizzle[3] = dst[0].PredSwizzleW; + } - insn = ureg_emit_insn( ureg, opcode, saturate, predicate, nr_dst, nr_src ); + insn = ureg_emit_insn(ureg, + opcode, + saturate, + predicate, + negate, + swizzle[0], + swizzle[1], + swizzle[2], + swizzle[3], + nr_dst, + nr_src); for (i = 0; i < nr_dst; i++) ureg_emit_dst( ureg, dst[i] ); @@ -788,11 +821,30 @@ ureg_tex_insn(struct ureg_program *ureg, unsigned insn, i; boolean saturate; boolean predicate; + boolean negate; + unsigned swizzle[4]; saturate = nr_dst ? dst[0].Saturate : FALSE; predicate = nr_dst ? dst[0].Predicate : FALSE; + if (predicate) { + negate = dst[0].PredNegate; + swizzle[0] = dst[0].PredSwizzleX; + swizzle[1] = dst[0].PredSwizzleY; + swizzle[2] = dst[0].PredSwizzleZ; + swizzle[3] = dst[0].PredSwizzleW; + } - insn = ureg_emit_insn( ureg, opcode, saturate, predicate, nr_dst, nr_src ); + insn = ureg_emit_insn(ureg, + opcode, + saturate, + predicate, + negate, + swizzle[0], + swizzle[1], + swizzle[2], + swizzle[3], + nr_dst, + nr_src); ureg_emit_texture( ureg, insn, target ); @@ -815,7 +867,17 @@ ureg_label_insn(struct ureg_program *ureg, { unsigned insn, i; - insn = ureg_emit_insn( ureg, opcode, FALSE, FALSE, 0, nr_src ); + insn = ureg_emit_insn(ureg, + opcode, + FALSE, + FALSE, + FALSE, + TGSI_SWIZZLE_X, + TGSI_SWIZZLE_Y, + TGSI_SWIZZLE_Z, + TGSI_SWIZZLE_W, + 0, + nr_src); ureg_emit_label( ureg, insn, label_token ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index 36c0bd2dcf..a3bc99140c 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -68,9 +68,12 @@ struct ureg_dst unsigned Indirect : 1; /* BOOL */ unsigned Saturate : 1; /* BOOL */ unsigned Predicate : 1; + unsigned PredNegate : 1; /* BOOL */ + unsigned PredSwizzleX: 2; /* TGSI_SWIZZLE_ */ + unsigned PredSwizzleY: 2; /* TGSI_SWIZZLE_ */ + unsigned PredSwizzleZ: 2; /* TGSI_SWIZZLE_ */ + unsigned PredSwizzleW: 2; /* TGSI_SWIZZLE_ */ int Index : 16; /* SINT */ - unsigned Pad1 : 5; - unsigned Pad2 : 1; /* BOOL */ int IndirectIndex : 16; /* SINT */ int IndirectSwizzle : 2; /* TGSI_SWIZZLE_ */ }; @@ -275,6 +278,11 @@ ureg_emit_insn(struct ureg_program *ureg, unsigned opcode, boolean saturate, boolean predicate, + boolean pred_negate, + unsigned pred_swizzle_x, + unsigned pred_swizzle_y, + unsigned pred_swizzle_z, + unsigned pred_swizzle_w, unsigned num_dst, unsigned num_src ); @@ -305,7 +313,17 @@ ureg_fixup_insn_size(struct ureg_program *ureg, static INLINE void ureg_##op( struct ureg_program *ureg ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn( ureg, opcode, FALSE, FALSE, 0, 0 );\ + unsigned insn = ureg_emit_insn(ureg, \ + opcode, \ + FALSE, \ + FALSE, \ + FALSE, \ + TGSI_SWIZZLE_X, \ + TGSI_SWIZZLE_Y, \ + TGSI_SWIZZLE_Z, \ + TGSI_SWIZZLE_W, \ + 0, \ + 0); \ ureg_fixup_insn_size( ureg, insn ); \ } @@ -314,7 +332,17 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ struct ureg_src src ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn( ureg, opcode, FALSE, FALSE, 0, 1 );\ + unsigned insn = ureg_emit_insn(ureg, \ + opcode, \ + FALSE, \ + FALSE, \ + FALSE, \ + TGSI_SWIZZLE_X, \ + TGSI_SWIZZLE_Y, \ + TGSI_SWIZZLE_Z, \ + TGSI_SWIZZLE_W, \ + 0, \ + 1); \ ureg_emit_src( ureg, src ); \ ureg_fixup_insn_size( ureg, insn ); \ } @@ -324,7 +352,17 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ unsigned *label_token ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn( ureg, opcode, FALSE, FALSE, 0, 0 );\ + unsigned insn = ureg_emit_insn(ureg, \ + opcode, \ + FALSE, \ + FALSE, \ + FALSE, \ + TGSI_SWIZZLE_X, \ + TGSI_SWIZZLE_Y, \ + TGSI_SWIZZLE_Z, \ + TGSI_SWIZZLE_W, \ + 0, \ + 0); \ ureg_emit_label( ureg, insn, label_token ); \ ureg_fixup_insn_size( ureg, insn ); \ } @@ -335,7 +373,17 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ unsigned *label_token ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn( ureg, opcode, FALSE, FALSE, 0, 1 );\ + unsigned insn = ureg_emit_insn(ureg, \ + opcode, \ + FALSE, \ + FALSE, \ + FALSE, \ + TGSI_SWIZZLE_X, \ + TGSI_SWIZZLE_Y, \ + TGSI_SWIZZLE_Z, \ + TGSI_SWIZZLE_W, \ + 0, \ + 1); \ ureg_emit_label( ureg, insn, label_token ); \ ureg_emit_src( ureg, src ); \ ureg_fixup_insn_size( ureg, insn ); \ @@ -346,7 +394,17 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ struct ureg_dst dst ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn( ureg, opcode, dst.Saturate, dst.Predicate, 1, 0 );\ + unsigned insn = ureg_emit_insn(ureg, \ + opcode, \ + dst.Saturate, \ + dst.Predicate, \ + dst.PredNegate, \ + dst.PredSwizzleX, \ + dst.PredSwizzleY, \ + dst.PredSwizzleZ, \ + dst.PredSwizzleW, \ + 1, \ + 0); \ ureg_emit_dst( ureg, dst ); \ ureg_fixup_insn_size( ureg, insn ); \ } @@ -358,7 +416,17 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ struct ureg_src src ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn( ureg, opcode, dst.Saturate, dst.Predicate, 1, 1 );\ + unsigned insn = ureg_emit_insn(ureg, \ + opcode, \ + dst.Saturate, \ + dst.Predicate, \ + dst.PredNegate, \ + dst.PredSwizzleX, \ + dst.PredSwizzleY, \ + dst.PredSwizzleZ, \ + dst.PredSwizzleW, \ + 1, \ + 1); \ ureg_emit_dst( ureg, dst ); \ ureg_emit_src( ureg, src ); \ ureg_fixup_insn_size( ureg, insn ); \ @@ -371,7 +439,17 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ struct ureg_src src1 ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn( ureg, opcode, dst.Saturate, dst.Predicate, 1, 2 );\ + unsigned insn = ureg_emit_insn(ureg, \ + opcode, \ + dst.Saturate, \ + dst.Predicate, \ + dst.PredNegate, \ + dst.PredSwizzleX, \ + dst.PredSwizzleY, \ + dst.PredSwizzleZ, \ + dst.PredSwizzleW, \ + 1, \ + 2); \ ureg_emit_dst( ureg, dst ); \ ureg_emit_src( ureg, src0 ); \ ureg_emit_src( ureg, src1 ); \ @@ -386,7 +464,17 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ struct ureg_src src1 ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn( ureg, opcode, dst.Saturate, dst.Predicate, 1, 2 );\ + unsigned insn = ureg_emit_insn(ureg, \ + opcode, \ + dst.Saturate, \ + dst.Predicate, \ + dst.PredNegate, \ + dst.PredSwizzleX, \ + dst.PredSwizzleY, \ + dst.PredSwizzleZ, \ + dst.PredSwizzleW, \ + 1, \ + 2); \ ureg_emit_texture( ureg, insn, target ); \ ureg_emit_dst( ureg, dst ); \ ureg_emit_src( ureg, src0 ); \ @@ -402,7 +490,17 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ struct ureg_src src2 ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn( ureg, opcode, dst.Saturate, dst.Predicate, 1, 3 );\ + unsigned insn = ureg_emit_insn(ureg, \ + opcode, \ + dst.Saturate, \ + dst.Predicate, \ + dst.PredNegate, \ + dst.PredSwizzleX, \ + dst.PredSwizzleY, \ + dst.PredSwizzleZ, \ + dst.PredSwizzleW, \ + 1, \ + 3); \ ureg_emit_dst( ureg, dst ); \ ureg_emit_src( ureg, src0 ); \ ureg_emit_src( ureg, src1 ); \ @@ -420,7 +518,17 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ struct ureg_src src3 ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn( ureg, opcode, dst.Saturate, dst.Predicate, 1, 4 );\ + unsigned insn = ureg_emit_insn(ureg, \ + opcode, \ + dst.Saturate, \ + dst.Predicate, \ + dst.PredNegate, \ + dst.PredSwizzleX, \ + dst.PredSwizzleY, \ + dst.PredSwizzleZ, \ + dst.PredSwizzleW, \ + 1, \ + 4); \ ureg_emit_texture( ureg, insn, target ); \ ureg_emit_dst( ureg, dst ); \ ureg_emit_src( ureg, src0 ); \ @@ -503,10 +611,20 @@ ureg_saturate( struct ureg_dst reg ) } static INLINE struct ureg_dst -ureg_predicate(struct ureg_dst reg) +ureg_predicate(struct ureg_dst reg, + boolean negate, + unsigned swizzle_x, + unsigned swizzle_y, + unsigned swizzle_z, + unsigned swizzle_w) { assert(reg.File != TGSI_FILE_NULL); reg.Predicate = 1; + reg.PredNegate = negate; + reg.PredSwizzleX = swizzle_x; + reg.PredSwizzleY = swizzle_y; + reg.PredSwizzleZ = swizzle_z; + reg.PredSwizzleW = swizzle_w; return reg; } @@ -544,9 +662,12 @@ ureg_dst( struct ureg_src src ) dst.IndirectSwizzle = src.IndirectSwizzle; dst.Saturate = 0; dst.Predicate = 0; + dst.PredNegate = 0; + dst.PredSwizzleX = TGSI_SWIZZLE_X; + dst.PredSwizzleY = TGSI_SWIZZLE_Y; + dst.PredSwizzleZ = TGSI_SWIZZLE_Z; + dst.PredSwizzleW = TGSI_SWIZZLE_W; dst.Index = src.Index; - dst.Pad1 = 0; - dst.Pad2 = 0; return dst; } @@ -586,9 +707,12 @@ ureg_dst_undef( void ) dst.IndirectSwizzle = 0; dst.Saturate = 0; dst.Predicate = 0; + dst.PredNegate = 0; + dst.PredSwizzleX = TGSI_SWIZZLE_X; + dst.PredSwizzleY = TGSI_SWIZZLE_Y; + dst.PredSwizzleZ = TGSI_SWIZZLE_Z; + dst.PredSwizzleW = TGSI_SWIZZLE_W; dst.Index = 0; - dst.Pad1 = 0; - dst.Pad2 = 0; return dst; } -- cgit v1.2.3 From d00cbba403640c82683a876fa795cd638f1bbc24 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Sun, 1 Nov 2009 21:38:48 +0100 Subject: r600: implement EXP op in compiler --- src/mesa/drivers/dri/r600/r700_assembler.c | 132 ++++++++++++++++++++++++++++- src/mesa/drivers/dri/r600/r700_assembler.h | 1 + 2 files changed, 130 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 917318c02a..fbf1f29fa3 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -2729,6 +2729,133 @@ GLboolean assemble_EX2(r700_AssemblerBase *pAsm) { return assemble_math_function(pAsm, SQ_OP2_INST_EXP_IEEE); } + +GLboolean assemble_EXP(r700_AssemblerBase *pAsm) +{ + BITS tmp; + + checkop1(pAsm); + + tmp = gethelpr(pAsm); + + // FLOOR tmp.x, a.x + // EX2 dst.x tmp.x + + if (pAsm->pILInst->DstReg.WriteMask & 0x1) { + pAsm->D.dst.opcode = SQ_OP2_INST_FLOOR; + + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp; + pAsm->D.dst.writex = 1; + + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + pAsm->D.dst.opcode = SQ_OP2_INST_EXP_IEEE; + pAsm->D.dst.math = 1; + + if( GL_FALSE == assemble_dst(pAsm) ) + { + return GL_FALSE; + } + + pAsm->D.dst.writey = pAsm->D.dst.writez = pAsm->D.dst.writew = 0; + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = DST_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp; + + setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); + noneg_PVSSRC(&(pAsm->S[0].src)); + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + } + + // FRACT dst.y a.x + + if ((pAsm->pILInst->DstReg.WriteMask >> 1) & 0x1) { + pAsm->D.dst.opcode = SQ_OP2_INST_FRACT; + + if( GL_FALSE == assemble_dst(pAsm) ) + { + return GL_FALSE; + } + + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + + pAsm->D.dst.writex = pAsm->D.dst.writez = pAsm->D.dst.writew = 0; + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + } + + // EX2 dst.z, a.x + + if ((pAsm->pILInst->DstReg.WriteMask >> 2) & 0x1) { + pAsm->D.dst.opcode = SQ_OP2_INST_EXP_IEEE; + pAsm->D.dst.math = 1; + + if( GL_FALSE == assemble_dst(pAsm) ) + { + return GL_FALSE; + } + + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + + pAsm->D.dst.writex = pAsm->D.dst.writey = pAsm->D.dst.writew = 0; + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + } + + // MOV dst.w 1.0 + + if ((pAsm->pILInst->DstReg.WriteMask >> 3) & 0x1) { + pAsm->D.dst.opcode = SQ_OP2_INST_MOV; + + if( GL_FALSE == assemble_dst(pAsm) ) + { + return GL_FALSE; + } + + pAsm->D.dst.writex = pAsm->D.dst.writey = pAsm->D.dst.writez = 0; + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp; + + setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_1); + noneg_PVSSRC(&(pAsm->S[0].src)); + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + } + + return GL_TRUE; +} GLboolean assemble_FLR(r700_AssemblerBase *pAsm) { @@ -4004,10 +4131,9 @@ GLboolean AssembleInstr(GLuint uiNumberInsts, return GL_FALSE; break; case OPCODE_EXP: - radeon_error("Not yet implemented instruction OPCODE_EXP \n"); - //if ( GL_FALSE == assemble_BAD("EXP") ) + if ( GL_FALSE == assemble_EXP(pR700AsmCode) ) return GL_FALSE; - break; // approx of EX2 + break; case OPCODE_FLR: if ( GL_FALSE == assemble_FLR(pR700AsmCode) ) diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index 8cbca066e9..317feb1b7d 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -477,6 +477,7 @@ GLboolean assemble_COS(r700_AssemblerBase *pAsm); GLboolean assemble_DOT(r700_AssemblerBase *pAsm); GLboolean assemble_DST(r700_AssemblerBase *pAsm); GLboolean assemble_EX2(r700_AssemblerBase *pAsm); +GLboolean assemble_EXP(r700_AssemblerBase *pAsm); GLboolean assemble_FLR(r700_AssemblerBase *pAsm); GLboolean assemble_FLR_INT(r700_AssemblerBase *pAsm); GLboolean assemble_FRC(r700_AssemblerBase *pAsm); -- cgit v1.2.3 From 213ec8251cb3e859b41306eae4092d89592c33db Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Sun, 1 Nov 2009 22:28:02 +0100 Subject: r600: implement LOG op in compiler --- src/mesa/drivers/dri/r600/r700_assembler.c | 216 ++++++++++++++++++++++++++++- src/mesa/drivers/dri/r600/r700_assembler.h | 1 + 2 files changed, 214 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index fbf1f29fa3..e0d7d4fa6b 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -3037,6 +3037,217 @@ GLboolean assemble_LRP(r700_AssemblerBase *pAsm) return GL_TRUE; } +GLboolean assemble_LOG(r700_AssemblerBase *pAsm) +{ + BITS tmp1, tmp2, tmp3; + + checkop1(pAsm); + + tmp1 = gethelpr(pAsm); + tmp2 = gethelpr(pAsm); + tmp3 = gethelpr(pAsm); + + // FIXME: The hardware can do fabs() directly on input + // elements, but the compiler doesn't have the + // capability to use that. + + // MAX tmp1.x, a.x, -a.x (fabs(a.x)) + + pAsm->D.dst.opcode = SQ_OP2_INST_MAX; + + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp1; + pAsm->D.dst.writex = 1; + + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + + pAsm->S[1].bits = pAsm->S[0].bits; + flipneg_PVSSRC(&(pAsm->S[1].src)); + + if ( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + // Entire algo: + // + // LG2 tmp2.x, tmp1.x + // FLOOR tmp3.x, tmp2.x + // MOV dst.x, tmp3.x + // ADD tmp3.x, tmp2.x, -tmp3.x + // EX2 dst.y, tmp3.x + // MOV dst.z, tmp2.x + // MOV dst.w, 1.0 + + // LG2 tmp2.x, tmp1.x + // FLOOR tmp3.x, tmp2.x + + pAsm->D.dst.opcode = SQ_OP2_INST_LOG_IEEE; + pAsm->D.dst.math = 1; + + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp2; + pAsm->D.dst.writex = 1; + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = DST_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp1; + + setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); + noneg_PVSSRC(&(pAsm->S[0].src)); + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + pAsm->D.dst.opcode = SQ_OP2_INST_FLOOR; + + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp3; + pAsm->D.dst.writex = 1; + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = DST_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp2; + + setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); + noneg_PVSSRC(&(pAsm->S[0].src)); + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + // MOV dst.x, tmp3.x + + pAsm->D.dst.opcode = SQ_OP2_INST_MOV; + + if( GL_FALSE == assemble_dst(pAsm) ) + { + return GL_FALSE; + } + + pAsm->D.dst.writey = pAsm->D.dst.writez = pAsm->D.dst.writew = 0; + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = DST_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp3; + + setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); + noneg_PVSSRC(&(pAsm->S[0].src)); + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + // ADD tmp3.x, tmp2.x, -tmp3.x + // EX2 dst.y, tmp3.x + + pAsm->D.dst.opcode = SQ_OP2_INST_ADD; + + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp3; + pAsm->D.dst.writex = 1; + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = DST_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp2; + + setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); + noneg_PVSSRC(&(pAsm->S[0].src)); + + setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); + pAsm->S[1].src.rtype = DST_REG_TEMPORARY; + pAsm->S[1].src.reg = tmp3; + + setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_X); + neg_PVSSRC(&(pAsm->S[1].src)); + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + pAsm->D.dst.opcode = SQ_OP2_INST_EXP_IEEE; + pAsm->D.dst.math = 1; + + if( GL_FALSE == assemble_dst(pAsm) ) + { + return GL_FALSE; + } + + pAsm->D.dst.writex = pAsm->D.dst.writez = pAsm->D.dst.writew = 0; + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = DST_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp3; + + setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); + noneg_PVSSRC(&(pAsm->S[0].src)); + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + // MOV dst.z, tmp2.x + + pAsm->D.dst.opcode = SQ_OP2_INST_MOV; + + if( GL_FALSE == assemble_dst(pAsm) ) + { + return GL_FALSE; + } + + pAsm->D.dst.writex = pAsm->D.dst.writey = pAsm->D.dst.writew = 0; + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = DST_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp2; + + setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); + noneg_PVSSRC(&(pAsm->S[0].src)); + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + // MOV dst.w 1.0 + + pAsm->D.dst.opcode = SQ_OP2_INST_MOV; + + if( GL_FALSE == assemble_dst(pAsm) ) + { + return GL_FALSE; + } + + pAsm->D.dst.writex = pAsm->D.dst.writey = pAsm->D.dst.writez = 0; + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp1; + + setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_1); + noneg_PVSSRC(&(pAsm->S[0].src)); + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + return GL_TRUE; +} + GLboolean assemble_MAD(struct r700_AssemblerBase *pAsm) { int tmp, ii; @@ -4166,10 +4377,9 @@ GLboolean AssembleInstr(GLuint uiNumberInsts, return GL_FALSE; break; case OPCODE_LOG: - radeon_error("Not yet implemented instruction OPCODE_LOG \n"); - //if ( GL_FALSE == assemble_BAD("LOG") ) + if ( GL_FALSE == assemble_LOG(pR700AsmCode) ) return GL_FALSE; - break; // approx of LG2 + break; case OPCODE_MAD: if ( GL_FALSE == assemble_MAD(pR700AsmCode) ) diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index 317feb1b7d..c66db502a1 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -484,6 +484,7 @@ GLboolean assemble_FRC(r700_AssemblerBase *pAsm); GLboolean assemble_KIL(r700_AssemblerBase *pAsm); GLboolean assemble_LG2(r700_AssemblerBase *pAsm); GLboolean assemble_LRP(r700_AssemblerBase *pAsm); +GLboolean assemble_LOG(r700_AssemblerBase *pAsm); GLboolean assemble_MAD(r700_AssemblerBase *pAsm); GLboolean assemble_LIT(r700_AssemblerBase *pAsm); GLboolean assemble_MAX(r700_AssemblerBase *pAsm); -- cgit v1.2.3 From e0556657526a7fe53d6e17cf70ffa6a8ee35e0a9 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 2 Nov 2009 12:35:47 -0700 Subject: glx: Fix memory leak if XF86DRICreateDrawable() fails Signed-off-by: Brian Paul --- src/glx/x11/dri_glx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c index ab24bd8ffe..4f7acb6cc3 100644 --- a/src/glx/x11/dri_glx.c +++ b/src/glx/x11/dri_glx.c @@ -596,8 +596,10 @@ driCreateDrawable(__GLXscreenConfigs * psc, pdraw->drawable = drawable; pdraw->psc = psc; - if (!XF86DRICreateDrawable(psc->dpy, psc->scr, drawable, &hwDrawable)) + if (!XF86DRICreateDrawable(psc->dpy, psc->scr, drawable, &hwDrawable)) { + Xfree(pdraw); return NULL; + } /* Create a new drawable */ pdraw->driDrawable = -- cgit v1.2.3 From 731810f8546174e45c717b0a9aa289a26593dfa0 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 2 Nov 2009 12:44:14 -0800 Subject: ARB prog parser: Fix a couple issues with previous merge from mesa_7_6_branch Since the addition of support for Nvidia condition codes, the lexer internally uses handle_ident to select between returning IDENTIFIER and USED_IDENTIFIER. Also, use return_string instead of strdup. Fixes bug #24809. --- src/mesa/shader/lex.yy.c | 382 +++++++++++++++++++++------------------- src/mesa/shader/program_lexer.l | 8 +- 2 files changed, 200 insertions(+), 190 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/lex.yy.c b/src/mesa/shader/lex.yy.c index 5e605274aa..fc78b30fb4 100644 --- a/src/mesa/shader/lex.yy.c +++ b/src/mesa/shader/lex.yy.c @@ -53,7 +53,6 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; -#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -84,6 +83,8 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif +#endif /* ! C99 */ + #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -157,7 +158,15 @@ typedef void* yyscan_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -1057,8 +1066,7 @@ static yyconst flex_int16_t yy_chk[1368] = if (condition) { \ return token; \ } else { \ - yylval->string = return_string(yyextra, yytext); \ - return IDENTIFIER; \ + return handle_ident(yyextra, yytext, yylval); \ } \ } while (0) @@ -1082,8 +1090,7 @@ static yyconst flex_int16_t yy_chk[1368] = yylval->temp_inst.Opcode = OPCODE_ ## opcode; \ return token; \ } else { \ - yylval->string = return_string(yyextra, yytext); \ - return IDENTIFIER; \ + return handle_ident(yyextra, yytext, yylval); \ } \ } while (0) @@ -1174,7 +1181,7 @@ swiz_from_char(char c) static int handle_ident(struct asm_parser_state *state, const char *text, YYSTYPE *lval) { - lval->string = strdup(text); + lval->string = return_string(state, text); return (_mesa_symbol_table_find_symbol(state->st, 0, text) == NULL) ? IDENTIFIER : USED_IDENTIFIER; @@ -1193,7 +1200,7 @@ handle_ident(struct asm_parser_state *state, const char *text, YYSTYPE *lval) } while(0); #define YY_EXTRA_TYPE struct asm_parser_state * -#line 1197 "lex.yy.c" +#line 1204 "lex.yy.c" #define INITIAL 0 @@ -1330,7 +1337,12 @@ static int input (yyscan_t yyscanner ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -1338,7 +1350,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO fwrite( yytext, yyleng, 1, yyout ) +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1349,7 +1361,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - unsigned n; \ + size_t n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1434,10 +1446,10 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 198 "program_lexer.l" +#line 196 "program_lexer.l" -#line 1441 "lex.yy.c" +#line 1453 "lex.yy.c" yylval = yylval_param; @@ -1526,17 +1538,17 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 200 "program_lexer.l" +#line 198 "program_lexer.l" { return ARBvp_10; } YY_BREAK case 2: YY_RULE_SETUP -#line 201 "program_lexer.l" +#line 199 "program_lexer.l" { return ARBfp_10; } YY_BREAK case 3: YY_RULE_SETUP -#line 202 "program_lexer.l" +#line 200 "program_lexer.l" { yylval->integer = at_address; return_token_or_IDENTIFIER(require_ARB_vp, ADDRESS); @@ -1544,692 +1556,692 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 206 "program_lexer.l" +#line 204 "program_lexer.l" { return ALIAS; } YY_BREAK case 5: YY_RULE_SETUP -#line 207 "program_lexer.l" +#line 205 "program_lexer.l" { return ATTRIB; } YY_BREAK case 6: YY_RULE_SETUP -#line 208 "program_lexer.l" +#line 206 "program_lexer.l" { return END; } YY_BREAK case 7: YY_RULE_SETUP -#line 209 "program_lexer.l" +#line 207 "program_lexer.l" { return OPTION; } YY_BREAK case 8: YY_RULE_SETUP -#line 210 "program_lexer.l" +#line 208 "program_lexer.l" { return OUTPUT; } YY_BREAK case 9: YY_RULE_SETUP -#line 211 "program_lexer.l" +#line 209 "program_lexer.l" { return PARAM; } YY_BREAK case 10: YY_RULE_SETUP -#line 212 "program_lexer.l" +#line 210 "program_lexer.l" { yylval->integer = at_temp; return TEMP; } YY_BREAK case 11: YY_RULE_SETUP -#line 214 "program_lexer.l" +#line 212 "program_lexer.l" { return_opcode( 1, VECTOR_OP, ABS, 3); } YY_BREAK case 12: YY_RULE_SETUP -#line 215 "program_lexer.l" +#line 213 "program_lexer.l" { return_opcode( 1, BIN_OP, ADD, 3); } YY_BREAK case 13: YY_RULE_SETUP -#line 216 "program_lexer.l" +#line 214 "program_lexer.l" { return_opcode(require_ARB_vp, ARL, ARL, 3); } YY_BREAK case 14: YY_RULE_SETUP -#line 218 "program_lexer.l" +#line 216 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, CMP, 3); } YY_BREAK case 15: YY_RULE_SETUP -#line 219 "program_lexer.l" +#line 217 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, COS, 3); } YY_BREAK case 16: YY_RULE_SETUP -#line 221 "program_lexer.l" +#line 219 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, DDX, 3); } YY_BREAK case 17: YY_RULE_SETUP -#line 222 "program_lexer.l" +#line 220 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, DDY, 3); } YY_BREAK case 18: YY_RULE_SETUP -#line 223 "program_lexer.l" +#line 221 "program_lexer.l" { return_opcode( 1, BIN_OP, DP3, 3); } YY_BREAK case 19: YY_RULE_SETUP -#line 224 "program_lexer.l" +#line 222 "program_lexer.l" { return_opcode( 1, BIN_OP, DP4, 3); } YY_BREAK case 20: YY_RULE_SETUP -#line 225 "program_lexer.l" +#line 223 "program_lexer.l" { return_opcode( 1, BIN_OP, DPH, 3); } YY_BREAK case 21: YY_RULE_SETUP -#line 226 "program_lexer.l" +#line 224 "program_lexer.l" { return_opcode( 1, BIN_OP, DST, 3); } YY_BREAK case 22: YY_RULE_SETUP -#line 228 "program_lexer.l" +#line 226 "program_lexer.l" { return_opcode( 1, SCALAR_OP, EX2, 3); } YY_BREAK case 23: YY_RULE_SETUP -#line 229 "program_lexer.l" +#line 227 "program_lexer.l" { return_opcode(require_ARB_vp, SCALAR_OP, EXP, 3); } YY_BREAK case 24: YY_RULE_SETUP -#line 231 "program_lexer.l" +#line 229 "program_lexer.l" { return_opcode( 1, VECTOR_OP, FLR, 3); } YY_BREAK case 25: YY_RULE_SETUP -#line 232 "program_lexer.l" +#line 230 "program_lexer.l" { return_opcode( 1, VECTOR_OP, FRC, 3); } YY_BREAK case 26: YY_RULE_SETUP -#line 234 "program_lexer.l" +#line 232 "program_lexer.l" { return_opcode(require_ARB_fp, KIL, KIL, 3); } YY_BREAK case 27: YY_RULE_SETUP -#line 236 "program_lexer.l" +#line 234 "program_lexer.l" { return_opcode( 1, VECTOR_OP, LIT, 3); } YY_BREAK case 28: YY_RULE_SETUP -#line 237 "program_lexer.l" +#line 235 "program_lexer.l" { return_opcode( 1, SCALAR_OP, LG2, 3); } YY_BREAK case 29: YY_RULE_SETUP -#line 238 "program_lexer.l" +#line 236 "program_lexer.l" { return_opcode(require_ARB_vp, SCALAR_OP, LOG, 3); } YY_BREAK case 30: YY_RULE_SETUP -#line 239 "program_lexer.l" +#line 237 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, LRP, 3); } YY_BREAK case 31: YY_RULE_SETUP -#line 241 "program_lexer.l" +#line 239 "program_lexer.l" { return_opcode( 1, TRI_OP, MAD, 3); } YY_BREAK case 32: YY_RULE_SETUP -#line 242 "program_lexer.l" +#line 240 "program_lexer.l" { return_opcode( 1, BIN_OP, MAX, 3); } YY_BREAK case 33: YY_RULE_SETUP -#line 243 "program_lexer.l" +#line 241 "program_lexer.l" { return_opcode( 1, BIN_OP, MIN, 3); } YY_BREAK case 34: YY_RULE_SETUP -#line 244 "program_lexer.l" +#line 242 "program_lexer.l" { return_opcode( 1, VECTOR_OP, MOV, 3); } YY_BREAK case 35: YY_RULE_SETUP -#line 245 "program_lexer.l" +#line 243 "program_lexer.l" { return_opcode( 1, BIN_OP, MUL, 3); } YY_BREAK case 36: YY_RULE_SETUP -#line 247 "program_lexer.l" +#line 245 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK2H, 4); } YY_BREAK case 37: YY_RULE_SETUP -#line 248 "program_lexer.l" +#line 246 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK2US, 5); } YY_BREAK case 38: YY_RULE_SETUP -#line 249 "program_lexer.l" +#line 247 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK4B, 4); } YY_BREAK case 39: YY_RULE_SETUP -#line 250 "program_lexer.l" +#line 248 "program_lexer.l" { return_opcode(require_NV_fp, VECTOR_OP, PK4UB, 5); } YY_BREAK case 40: YY_RULE_SETUP -#line 251 "program_lexer.l" +#line 249 "program_lexer.l" { return_opcode( 1, BINSC_OP, POW, 3); } YY_BREAK case 41: YY_RULE_SETUP -#line 253 "program_lexer.l" +#line 251 "program_lexer.l" { return_opcode( 1, SCALAR_OP, RCP, 3); } YY_BREAK case 42: YY_RULE_SETUP -#line 254 "program_lexer.l" +#line 252 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, RFL, 3); } YY_BREAK case 43: YY_RULE_SETUP -#line 255 "program_lexer.l" +#line 253 "program_lexer.l" { return_opcode( 1, SCALAR_OP, RSQ, 3); } YY_BREAK case 44: YY_RULE_SETUP -#line 257 "program_lexer.l" +#line 255 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SCS, 3); } YY_BREAK case 45: YY_RULE_SETUP -#line 258 "program_lexer.l" +#line 256 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SEQ, 3); } YY_BREAK case 46: YY_RULE_SETUP -#line 259 "program_lexer.l" +#line 257 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SFL, 3); } YY_BREAK case 47: YY_RULE_SETUP -#line 260 "program_lexer.l" +#line 258 "program_lexer.l" { return_opcode( 1, BIN_OP, SGE, 3); } YY_BREAK case 48: YY_RULE_SETUP -#line 261 "program_lexer.l" +#line 259 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SGT, 3); } YY_BREAK case 49: YY_RULE_SETUP -#line 262 "program_lexer.l" +#line 260 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SIN, 3); } YY_BREAK case 50: YY_RULE_SETUP -#line 263 "program_lexer.l" +#line 261 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SLE, 3); } YY_BREAK case 51: YY_RULE_SETUP -#line 264 "program_lexer.l" +#line 262 "program_lexer.l" { return_opcode( 1, BIN_OP, SLT, 3); } YY_BREAK case 52: YY_RULE_SETUP -#line 265 "program_lexer.l" +#line 263 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, SNE, 3); } YY_BREAK case 53: YY_RULE_SETUP -#line 266 "program_lexer.l" +#line 264 "program_lexer.l" { return_opcode(require_NV_fp, BIN_OP, STR, 3); } YY_BREAK case 54: YY_RULE_SETUP -#line 267 "program_lexer.l" +#line 265 "program_lexer.l" { return_opcode( 1, BIN_OP, SUB, 3); } YY_BREAK case 55: YY_RULE_SETUP -#line 268 "program_lexer.l" +#line 266 "program_lexer.l" { return_opcode( 1, SWZ, SWZ, 3); } YY_BREAK case 56: YY_RULE_SETUP -#line 270 "program_lexer.l" +#line 268 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TEX, 3); } YY_BREAK case 57: YY_RULE_SETUP -#line 271 "program_lexer.l" +#line 269 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, 3); } YY_BREAK case 58: YY_RULE_SETUP -#line 272 "program_lexer.l" +#line 270 "program_lexer.l" { return_opcode(require_NV_fp, TXD_OP, TXD, 3); } YY_BREAK case 59: YY_RULE_SETUP -#line 273 "program_lexer.l" +#line 271 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, 3); } YY_BREAK case 60: YY_RULE_SETUP -#line 275 "program_lexer.l" +#line 273 "program_lexer.l" { return_opcode(require_NV_fp, SCALAR_OP, UP2H, 4); } YY_BREAK case 61: YY_RULE_SETUP -#line 276 "program_lexer.l" +#line 274 "program_lexer.l" { return_opcode(require_NV_fp, SCALAR_OP, UP2US, 5); } YY_BREAK case 62: YY_RULE_SETUP -#line 277 "program_lexer.l" +#line 275 "program_lexer.l" { return_opcode(require_NV_fp, SCALAR_OP, UP4B, 4); } YY_BREAK case 63: YY_RULE_SETUP -#line 278 "program_lexer.l" +#line 276 "program_lexer.l" { return_opcode(require_NV_fp, SCALAR_OP, UP4UB, 5); } YY_BREAK case 64: YY_RULE_SETUP -#line 280 "program_lexer.l" +#line 278 "program_lexer.l" { return_opcode(require_NV_fp, TRI_OP, X2D, 3); } YY_BREAK case 65: YY_RULE_SETUP -#line 281 "program_lexer.l" +#line 279 "program_lexer.l" { return_opcode( 1, BIN_OP, XPD, 3); } YY_BREAK case 66: YY_RULE_SETUP -#line 283 "program_lexer.l" +#line 281 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); } YY_BREAK case 67: YY_RULE_SETUP -#line 284 "program_lexer.l" +#line 282 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); } YY_BREAK case 68: YY_RULE_SETUP -#line 285 "program_lexer.l" +#line 283 "program_lexer.l" { return PROGRAM; } YY_BREAK case 69: YY_RULE_SETUP -#line 286 "program_lexer.l" +#line 284 "program_lexer.l" { return STATE; } YY_BREAK case 70: YY_RULE_SETUP -#line 287 "program_lexer.l" +#line 285 "program_lexer.l" { return RESULT; } YY_BREAK case 71: YY_RULE_SETUP -#line 289 "program_lexer.l" +#line 287 "program_lexer.l" { return AMBIENT; } YY_BREAK case 72: YY_RULE_SETUP -#line 290 "program_lexer.l" +#line 288 "program_lexer.l" { return ATTENUATION; } YY_BREAK case 73: YY_RULE_SETUP -#line 291 "program_lexer.l" +#line 289 "program_lexer.l" { return BACK; } YY_BREAK case 74: YY_RULE_SETUP -#line 292 "program_lexer.l" +#line 290 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, CLIP); } YY_BREAK case 75: YY_RULE_SETUP -#line 293 "program_lexer.l" +#line 291 "program_lexer.l" { return COLOR; } YY_BREAK case 76: YY_RULE_SETUP -#line 294 "program_lexer.l" +#line 292 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, DEPTH); } YY_BREAK case 77: YY_RULE_SETUP -#line 295 "program_lexer.l" +#line 293 "program_lexer.l" { return DIFFUSE; } YY_BREAK case 78: YY_RULE_SETUP -#line 296 "program_lexer.l" +#line 294 "program_lexer.l" { return DIRECTION; } YY_BREAK case 79: YY_RULE_SETUP -#line 297 "program_lexer.l" +#line 295 "program_lexer.l" { return EMISSION; } YY_BREAK case 80: YY_RULE_SETUP -#line 298 "program_lexer.l" +#line 296 "program_lexer.l" { return ENV; } YY_BREAK case 81: YY_RULE_SETUP -#line 299 "program_lexer.l" +#line 297 "program_lexer.l" { return EYE; } YY_BREAK case 82: YY_RULE_SETUP -#line 300 "program_lexer.l" +#line 298 "program_lexer.l" { return FOGCOORD; } YY_BREAK case 83: YY_RULE_SETUP -#line 301 "program_lexer.l" +#line 299 "program_lexer.l" { return FOG; } YY_BREAK case 84: YY_RULE_SETUP -#line 302 "program_lexer.l" +#line 300 "program_lexer.l" { return FRONT; } YY_BREAK case 85: YY_RULE_SETUP -#line 303 "program_lexer.l" +#line 301 "program_lexer.l" { return HALF; } YY_BREAK case 86: YY_RULE_SETUP -#line 304 "program_lexer.l" +#line 302 "program_lexer.l" { return INVERSE; } YY_BREAK case 87: YY_RULE_SETUP -#line 305 "program_lexer.l" +#line 303 "program_lexer.l" { return INVTRANS; } YY_BREAK case 88: YY_RULE_SETUP -#line 306 "program_lexer.l" +#line 304 "program_lexer.l" { return LIGHT; } YY_BREAK case 89: YY_RULE_SETUP -#line 307 "program_lexer.l" +#line 305 "program_lexer.l" { return LIGHTMODEL; } YY_BREAK case 90: YY_RULE_SETUP -#line 308 "program_lexer.l" +#line 306 "program_lexer.l" { return LIGHTPROD; } YY_BREAK case 91: YY_RULE_SETUP -#line 309 "program_lexer.l" +#line 307 "program_lexer.l" { return LOCAL; } YY_BREAK case 92: YY_RULE_SETUP -#line 310 "program_lexer.l" +#line 308 "program_lexer.l" { return MATERIAL; } YY_BREAK case 93: YY_RULE_SETUP -#line 311 "program_lexer.l" +#line 309 "program_lexer.l" { return MAT_PROGRAM; } YY_BREAK case 94: YY_RULE_SETUP -#line 312 "program_lexer.l" +#line 310 "program_lexer.l" { return MATRIX; } YY_BREAK case 95: YY_RULE_SETUP -#line 313 "program_lexer.l" +#line 311 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, MATRIXINDEX); } YY_BREAK case 96: YY_RULE_SETUP -#line 314 "program_lexer.l" +#line 312 "program_lexer.l" { return MODELVIEW; } YY_BREAK case 97: YY_RULE_SETUP -#line 315 "program_lexer.l" +#line 313 "program_lexer.l" { return MVP; } YY_BREAK case 98: YY_RULE_SETUP -#line 316 "program_lexer.l" +#line 314 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, NORMAL); } YY_BREAK case 99: YY_RULE_SETUP -#line 317 "program_lexer.l" +#line 315 "program_lexer.l" { return OBJECT; } YY_BREAK case 100: YY_RULE_SETUP -#line 318 "program_lexer.l" +#line 316 "program_lexer.l" { return PALETTE; } YY_BREAK case 101: YY_RULE_SETUP -#line 319 "program_lexer.l" +#line 317 "program_lexer.l" { return PARAMS; } YY_BREAK case 102: YY_RULE_SETUP -#line 320 "program_lexer.l" +#line 318 "program_lexer.l" { return PLANE; } YY_BREAK case 103: YY_RULE_SETUP -#line 321 "program_lexer.l" +#line 319 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, POINT_TOK); } YY_BREAK case 104: YY_RULE_SETUP -#line 322 "program_lexer.l" +#line 320 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, POINTSIZE); } YY_BREAK case 105: YY_RULE_SETUP -#line 323 "program_lexer.l" +#line 321 "program_lexer.l" { return POSITION; } YY_BREAK case 106: YY_RULE_SETUP -#line 324 "program_lexer.l" +#line 322 "program_lexer.l" { return PRIMARY; } YY_BREAK case 107: YY_RULE_SETUP -#line 325 "program_lexer.l" +#line 323 "program_lexer.l" { return PROJECTION; } YY_BREAK case 108: YY_RULE_SETUP -#line 326 "program_lexer.l" +#line 324 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, RANGE); } YY_BREAK case 109: YY_RULE_SETUP -#line 327 "program_lexer.l" +#line 325 "program_lexer.l" { return ROW; } YY_BREAK case 110: YY_RULE_SETUP -#line 328 "program_lexer.l" +#line 326 "program_lexer.l" { return SCENECOLOR; } YY_BREAK case 111: YY_RULE_SETUP -#line 329 "program_lexer.l" +#line 327 "program_lexer.l" { return SECONDARY; } YY_BREAK case 112: YY_RULE_SETUP -#line 330 "program_lexer.l" +#line 328 "program_lexer.l" { return SHININESS; } YY_BREAK case 113: YY_RULE_SETUP -#line 331 "program_lexer.l" +#line 329 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, SIZE_TOK); } YY_BREAK case 114: YY_RULE_SETUP -#line 332 "program_lexer.l" +#line 330 "program_lexer.l" { return SPECULAR; } YY_BREAK case 115: YY_RULE_SETUP -#line 333 "program_lexer.l" +#line 331 "program_lexer.l" { return SPOT; } YY_BREAK case 116: YY_RULE_SETUP -#line 334 "program_lexer.l" +#line 332 "program_lexer.l" { return TEXCOORD; } YY_BREAK case 117: YY_RULE_SETUP -#line 335 "program_lexer.l" +#line 333 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, TEXENV); } YY_BREAK case 118: YY_RULE_SETUP -#line 336 "program_lexer.l" +#line 334 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN); } YY_BREAK case 119: YY_RULE_SETUP -#line 337 "program_lexer.l" +#line 335 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_Q); } YY_BREAK case 120: YY_RULE_SETUP -#line 338 "program_lexer.l" +#line 336 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_S); } YY_BREAK case 121: YY_RULE_SETUP -#line 339 "program_lexer.l" +#line 337 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_T); } YY_BREAK case 122: YY_RULE_SETUP -#line 340 "program_lexer.l" +#line 338 "program_lexer.l" { return TEXTURE; } YY_BREAK case 123: YY_RULE_SETUP -#line 341 "program_lexer.l" +#line 339 "program_lexer.l" { return TRANSPOSE; } YY_BREAK case 124: YY_RULE_SETUP -#line 342 "program_lexer.l" +#line 340 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, VTXATTRIB); } YY_BREAK case 125: YY_RULE_SETUP -#line 343 "program_lexer.l" +#line 341 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, WEIGHT); } YY_BREAK case 126: YY_RULE_SETUP -#line 345 "program_lexer.l" +#line 343 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEXTURE_UNIT); } YY_BREAK case 127: YY_RULE_SETUP -#line 346 "program_lexer.l" +#line 344 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_1D); } YY_BREAK case 128: YY_RULE_SETUP -#line 347 "program_lexer.l" +#line 345 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_2D); } YY_BREAK case 129: YY_RULE_SETUP -#line 348 "program_lexer.l" +#line 346 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_3D); } YY_BREAK case 130: YY_RULE_SETUP -#line 349 "program_lexer.l" +#line 347 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_CUBE); } YY_BREAK case 131: YY_RULE_SETUP -#line 350 "program_lexer.l" +#line 348 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_rect, TEX_RECT); } YY_BREAK case 132: YY_RULE_SETUP -#line 351 "program_lexer.l" +#line 349 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW1D); } YY_BREAK case 133: YY_RULE_SETUP -#line 352 "program_lexer.l" +#line 350 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW2D); } YY_BREAK case 134: YY_RULE_SETUP -#line 353 "program_lexer.l" +#line 351 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_rect, TEX_SHADOWRECT); } YY_BREAK case 135: YY_RULE_SETUP -#line 354 "program_lexer.l" +#line 352 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY1D); } YY_BREAK case 136: YY_RULE_SETUP -#line 355 "program_lexer.l" +#line 353 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY2D); } YY_BREAK case 137: YY_RULE_SETUP -#line 356 "program_lexer.l" +#line 354 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW1D); } YY_BREAK case 138: YY_RULE_SETUP -#line 357 "program_lexer.l" +#line 355 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); } YY_BREAK case 139: YY_RULE_SETUP -#line 359 "program_lexer.l" +#line 357 "program_lexer.l" { return handle_ident(yyextra, yytext, yylval); } YY_BREAK case 140: YY_RULE_SETUP -#line 361 "program_lexer.l" +#line 359 "program_lexer.l" { return DOT_DOT; } YY_BREAK case 141: YY_RULE_SETUP -#line 363 "program_lexer.l" +#line 361 "program_lexer.l" { yylval->integer = strtol(yytext, NULL, 10); return INTEGER; @@ -2237,7 +2249,7 @@ YY_RULE_SETUP YY_BREAK case 142: YY_RULE_SETUP -#line 367 "program_lexer.l" +#line 365 "program_lexer.l" { yylval->real = _mesa_strtod(yytext, NULL); return REAL; @@ -2249,7 +2261,7 @@ case 143: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 371 "program_lexer.l" +#line 369 "program_lexer.l" { yylval->real = _mesa_strtod(yytext, NULL); return REAL; @@ -2257,7 +2269,7 @@ YY_RULE_SETUP YY_BREAK case 144: YY_RULE_SETUP -#line 375 "program_lexer.l" +#line 373 "program_lexer.l" { yylval->real = _mesa_strtod(yytext, NULL); return REAL; @@ -2265,7 +2277,7 @@ YY_RULE_SETUP YY_BREAK case 145: YY_RULE_SETUP -#line 379 "program_lexer.l" +#line 377 "program_lexer.l" { yylval->real = _mesa_strtod(yytext, NULL); return REAL; @@ -2273,7 +2285,7 @@ YY_RULE_SETUP YY_BREAK case 146: YY_RULE_SETUP -#line 384 "program_lexer.l" +#line 382 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; @@ -2282,7 +2294,7 @@ YY_RULE_SETUP YY_BREAK case 147: YY_RULE_SETUP -#line 390 "program_lexer.l" +#line 388 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2292,7 +2304,7 @@ YY_RULE_SETUP YY_BREAK case 148: YY_RULE_SETUP -#line 396 "program_lexer.l" +#line 394 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; @@ -2301,7 +2313,7 @@ YY_RULE_SETUP YY_BREAK case 149: YY_RULE_SETUP -#line 401 "program_lexer.l" +#line 399 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; @@ -2310,7 +2322,7 @@ YY_RULE_SETUP YY_BREAK case 150: YY_RULE_SETUP -#line 407 "program_lexer.l" +#line 405 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2320,7 +2332,7 @@ YY_RULE_SETUP YY_BREAK case 151: YY_RULE_SETUP -#line 413 "program_lexer.l" +#line 411 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2330,7 +2342,7 @@ YY_RULE_SETUP YY_BREAK case 152: YY_RULE_SETUP -#line 419 "program_lexer.l" +#line 417 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; @@ -2339,7 +2351,7 @@ YY_RULE_SETUP YY_BREAK case 153: YY_RULE_SETUP -#line 425 "program_lexer.l" +#line 423 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2349,7 +2361,7 @@ YY_RULE_SETUP YY_BREAK case 154: YY_RULE_SETUP -#line 432 "program_lexer.l" +#line 430 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2361,7 +2373,7 @@ YY_RULE_SETUP YY_BREAK case 155: YY_RULE_SETUP -#line 441 "program_lexer.l" +#line 439 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; @@ -2370,7 +2382,7 @@ YY_RULE_SETUP YY_BREAK case 156: YY_RULE_SETUP -#line 447 "program_lexer.l" +#line 445 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2380,7 +2392,7 @@ YY_RULE_SETUP YY_BREAK case 157: YY_RULE_SETUP -#line 453 "program_lexer.l" +#line 451 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; @@ -2389,7 +2401,7 @@ YY_RULE_SETUP YY_BREAK case 158: YY_RULE_SETUP -#line 458 "program_lexer.l" +#line 456 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; @@ -2398,7 +2410,7 @@ YY_RULE_SETUP YY_BREAK case 159: YY_RULE_SETUP -#line 464 "program_lexer.l" +#line 462 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2408,7 +2420,7 @@ YY_RULE_SETUP YY_BREAK case 160: YY_RULE_SETUP -#line 470 "program_lexer.l" +#line 468 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2418,7 +2430,7 @@ YY_RULE_SETUP YY_BREAK case 161: YY_RULE_SETUP -#line 476 "program_lexer.l" +#line 474 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; @@ -2427,7 +2439,7 @@ YY_RULE_SETUP YY_BREAK case 162: YY_RULE_SETUP -#line 482 "program_lexer.l" +#line 480 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2437,7 +2449,7 @@ YY_RULE_SETUP YY_BREAK case 163: YY_RULE_SETUP -#line 490 "program_lexer.l" +#line 488 "program_lexer.l" { if (require_ARB_vp) { return TEXGEN_R; @@ -2451,7 +2463,7 @@ YY_RULE_SETUP YY_BREAK case 164: YY_RULE_SETUP -#line 501 "program_lexer.l" +#line 499 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2463,13 +2475,13 @@ YY_RULE_SETUP YY_BREAK case 165: YY_RULE_SETUP -#line 510 "program_lexer.l" +#line 508 "program_lexer.l" { return DOT; } YY_BREAK case 166: /* rule 166 can match eol */ YY_RULE_SETUP -#line 512 "program_lexer.l" +#line 510 "program_lexer.l" { yylloc->first_line++; yylloc->first_column = 1; @@ -2480,7 +2492,7 @@ YY_RULE_SETUP YY_BREAK case 167: YY_RULE_SETUP -#line 519 "program_lexer.l" +#line 517 "program_lexer.l" /* eat whitespace */ ; YY_BREAK case 168: @@ -2488,20 +2500,20 @@ case 168: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 520 "program_lexer.l" +#line 518 "program_lexer.l" /* eat comments */ ; YY_BREAK case 169: YY_RULE_SETUP -#line 521 "program_lexer.l" +#line 519 "program_lexer.l" { return yytext[0]; } YY_BREAK case 170: YY_RULE_SETUP -#line 522 "program_lexer.l" +#line 520 "program_lexer.l" ECHO; YY_BREAK -#line 2505 "lex.yy.c" +#line 2517 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -3269,8 +3281,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ @@ -3676,7 +3688,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 522 "program_lexer.l" +#line 520 "program_lexer.l" diff --git a/src/mesa/shader/program_lexer.l b/src/mesa/shader/program_lexer.l index b50fb3c7dc..e8dae7bc26 100644 --- a/src/mesa/shader/program_lexer.l +++ b/src/mesa/shader/program_lexer.l @@ -46,8 +46,7 @@ if (condition) { \ return token; \ } else { \ - yylval->string = return_string(yyextra, yytext); \ - return IDENTIFIER; \ + return handle_ident(yyextra, yytext, yylval); \ } \ } while (0) @@ -71,8 +70,7 @@ yylval->temp_inst.Opcode = OPCODE_ ## opcode; \ return token; \ } else { \ - yylval->string = return_string(yyextra, yytext); \ - return IDENTIFIER; \ + return handle_ident(yyextra, yytext, yylval); \ } \ } while (0) @@ -163,7 +161,7 @@ swiz_from_char(char c) static int handle_ident(struct asm_parser_state *state, const char *text, YYSTYPE *lval) { - lval->string = strdup(text); + lval->string = return_string(state, text); return (_mesa_symbol_table_find_symbol(state->st, 0, text) == NULL) ? IDENTIFIER : USED_IDENTIFIER; -- cgit v1.2.3 From b8fdb900fb9b1c8b1e9ec88509624237307a869a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 31 Oct 2009 08:07:23 -0600 Subject: mesa: make _mesa_get_current_tex_objec() public --- src/mesa/main/teximage.c | 61 ++++++++++++++++++++++++------------------------ src/mesa/main/teximage.h | 3 +++ 2 files changed, 33 insertions(+), 31 deletions(-) (limited to 'src') diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 69ef2cca5e..b10076875b 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -582,6 +582,17 @@ _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit, } +/** + * Return pointer to texture object for given target on current texture unit. + */ +struct gl_texture_object * +_mesa_get_current_tex_object(GLcontext *ctx, GLenum target) +{ + struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); + return _mesa_select_tex_object(ctx, texUnit, target); +} + + /** * Get a texture image pointer from a texture object, given a texture * target and mipmap level. The target and level parameters should @@ -963,18 +974,6 @@ _mesa_clear_texture_image(GLcontext *ctx, struct gl_texture_image *texImage) } -/** - * Return pointer to texture object for given target on current texture unit. - */ -static struct gl_texture_object * -get_current_tex_object(GLcontext *ctx, GLenum target) -{ - struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); - return _mesa_select_tex_object(ctx, texUnit, target); -} - - - /** * This is the fallback for Driver.TestProxyTexImage(). Test the texture * level, width, height and depth against the ctx->Const limits for textures. @@ -2128,7 +2127,7 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) _mesa_update_state(ctx); - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { texImage = _mesa_get_tex_image(ctx, texObj, target, level); @@ -2249,7 +2248,7 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) _mesa_update_state(ctx); - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { texImage = _mesa_get_tex_image(ctx, texObj, target, level); @@ -2365,7 +2364,7 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, if (ctx->NewState & _MESA_NEW_TRANSFER_STATE) _mesa_update_state(ctx); - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { texImage = _mesa_get_tex_image(ctx, texObj, target, level); @@ -2457,7 +2456,7 @@ _mesa_TexSubImage1D( GLenum target, GLint level, { GLsizei postConvWidth = width; struct gl_texture_object *texObj; - struct gl_texture_image *texImage = NULL; + struct gl_texture_image *texImage; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END_AND_FLUSH(ctx); @@ -2483,7 +2482,7 @@ _mesa_TexSubImage1D( GLenum target, GLint level, } - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); assert(texObj); _mesa_lock_texture(ctx, texObj); @@ -2549,7 +2548,7 @@ _mesa_TexSubImage2D( GLenum target, GLint level, return; /* error was detected */ } - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -2607,7 +2606,7 @@ _mesa_TexSubImage3D( GLenum target, GLint level, return; /* error was detected */ } - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -2674,7 +2673,7 @@ _mesa_CopyTexImage1D( GLenum target, GLint level, postConvWidth, 1, border)) return; - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -2753,7 +2752,7 @@ _mesa_CopyTexImage2D( GLenum target, GLint level, GLenum internalFormat, postConvWidth, postConvHeight, border)) return; - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -2825,7 +2824,7 @@ _mesa_CopyTexSubImage1D( GLenum target, GLint level, if (copytexsubimage_error_check1(ctx, 1, target, level)) return; - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -2885,7 +2884,7 @@ _mesa_CopyTexSubImage2D( GLenum target, GLint level, if (copytexsubimage_error_check1(ctx, 2, target, level)) return; - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -2948,7 +2947,7 @@ _mesa_CopyTexSubImage3D( GLenum target, GLint level, if (copytexsubimage_error_check1(ctx, 3, target, level)) return; - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -3282,7 +3281,7 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, return; } - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -3344,7 +3343,7 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, struct gl_texture_object *texObj; struct gl_texture_image *texImage; - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -3392,7 +3391,7 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, return; } - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -3456,7 +3455,7 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, struct gl_texture_object *texObj; struct gl_texture_image *texImage; - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -3500,7 +3499,7 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, return; } - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -3564,7 +3563,7 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, struct gl_texture_object *texObj; struct gl_texture_image *texImage; - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { @@ -3606,7 +3605,7 @@ compressed_tex_sub_image(GLuint dims, GLenum target, GLint level, return; } - texObj = get_current_tex_object(ctx, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); { diff --git a/src/mesa/main/teximage.h b/src/mesa/main/teximage.h index 094177da79..97c9018319 100644 --- a/src/mesa/main/teximage.h +++ b/src/mesa/main/teximage.h @@ -86,6 +86,9 @@ extern struct gl_texture_object * _mesa_select_tex_object(GLcontext *ctx, const struct gl_texture_unit *texUnit, GLenum target); +extern struct gl_texture_object * +_mesa_get_current_tex_object(GLcontext *ctx, GLenum target); + extern struct gl_texture_image * _mesa_select_tex_image(GLcontext *ctx, const struct gl_texture_object *texObj, -- cgit v1.2.3 From 1afe60e802e22318a7a10a8ab2fa4f8222f98e31 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 31 Oct 2009 08:07:46 -0600 Subject: mesa: use _mesa_get_current_tex_object() --- src/mesa/main/texgetimage.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index e4a9ac14b1..2f88718933 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -559,7 +559,6 @@ static GLboolean getteximage_error_check(GLcontext *ctx, GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels ) { - const struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; const GLuint maxLevels = _mesa_max_texture_levels(ctx, target); @@ -613,8 +612,7 @@ getteximage_error_check(GLcontext *ctx, GLenum target, GLint level, return GL_TRUE; } - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = _mesa_get_current_tex_object(ctx, target); if (!texObj || _mesa_is_proxy_texture(target)) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetTexImage(target)"); @@ -703,7 +701,6 @@ void GLAPIENTRY _mesa_GetTexImage( GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels ) { - const struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GET_CURRENT_CONTEXT(ctx); @@ -718,8 +715,7 @@ _mesa_GetTexImage( GLenum target, GLint level, GLenum format, return; } - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = _mesa_get_current_tex_object(ctx, target); texImage = _mesa_select_tex_image(ctx, texObj, target, level); if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) { @@ -749,7 +745,6 @@ static GLboolean getcompressedteximage_error_check(GLcontext *ctx, GLenum target, GLint level, GLvoid *img) { - const struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; const GLuint maxLevels = _mesa_max_texture_levels(ctx, target); @@ -773,9 +768,7 @@ getcompressedteximage_error_check(GLcontext *ctx, GLenum target, GLint level, return GL_TRUE; } - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); - + texObj = _mesa_get_current_tex_object(ctx, target); if (!texObj) { _mesa_error(ctx, GL_INVALID_ENUM, "glGetCompressedTexImageARB(target)"); return GL_TRUE; @@ -827,7 +820,6 @@ getcompressedteximage_error_check(GLcontext *ctx, GLenum target, GLint level, void GLAPIENTRY _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) { - const struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GET_CURRENT_CONTEXT(ctx); @@ -842,8 +834,7 @@ _mesa_GetCompressedTexImageARB(GLenum target, GLint level, GLvoid *img) return; } - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = _mesa_get_current_tex_object(ctx, target); texImage = _mesa_select_tex_image(ctx, texObj, target, level); if (MESA_VERBOSE & (VERBOSE_API | VERBOSE_TEXTURE)) { -- cgit v1.2.3 From 7157479b253b3051f1ec454a39b2aff825bab047 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 31 Oct 2009 08:08:05 -0600 Subject: mesa: use _mesa_get_current_tex_object() --- src/mesa/drivers/common/meta.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 22cd6de564..a431519143 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2464,7 +2464,6 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLsizei postConvWidth = width, postConvHeight = height; @@ -2472,8 +2471,7 @@ copy_tex_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, GLint bpp; void *buf; - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = _mesa_get_current_tex_object(ctx, target); texImage = _mesa_get_tex_image(ctx, texObj, target, level); format = _mesa_base_tex_format(ctx, internalFormat); @@ -2583,15 +2581,13 @@ copy_tex_sub_image(GLcontext *ctx, GLuint dims, GLenum target, GLint level, GLint x, GLint y, GLsizei width, GLsizei height) { - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; GLenum format, type; GLint bpp; void *buf; - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = _mesa_get_current_tex_object(ctx, target); texImage = _mesa_select_tex_image(ctx, texObj, target, level); format = _mesa_get_format_base_format(texImage->TexFormat); -- cgit v1.2.3 From 644d8fd363ca7d8f40f4fa319919985cc002df9e Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Sat, 31 Oct 2009 08:08:19 -0600 Subject: mesa: added comment --- src/mesa/main/texparam.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 79298e867a..ab170cde35 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -79,6 +79,8 @@ validate_texture_wrap_mode(GLcontext * ctx, GLenum target, GLenum wrap) /** * Get current texture object for given target. * Return NULL if any error. + * Note that this is different from _mesa_select_tex_object() in that proxy + * targets are not accepted. */ static struct gl_texture_object * get_texobj(GLcontext *ctx, GLenum target) -- cgit v1.2.3 From 0197348641614188c400d7c616573bb7f1eea781 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 3 Nov 2009 09:26:32 -0700 Subject: st/mesa: fix tests for depth and depth/stencil texture formats --- src/mesa/state_tracker/st_cb_texture.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 50675b5896..e8e81ede00 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1313,7 +1313,8 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, srcX, srcY, width, height); - if (baseFormat == GL_DEPTH_COMPONENT && + if ((baseFormat == GL_DEPTH_COMPONENT || + baseFormat == GL_DEPTH_STENCIL) && pf_is_depth_and_stencil(stImage->pt->format)) transfer_usage = PIPE_TRANSFER_READ_WRITE; else @@ -1326,7 +1327,7 @@ fallback_copy_texsubimage(GLcontext *ctx, GLenum target, GLint level, destX, destY, width, height); if (baseFormat == GL_DEPTH_COMPONENT || - baseFormat == GL_DEPTH24_STENCIL8) { + baseFormat == GL_DEPTH_STENCIL) { const GLboolean scaleOrBias = (ctx->Pixel.DepthScale != 1.0F || ctx->Pixel.DepthBias != 0.0F); GLint row, yStep; @@ -1453,7 +1454,7 @@ st_copy_texsubimage(GLcontext *ctx, struct gl_texture_image *texImage = _mesa_select_tex_image(ctx, texObj, target, level); struct st_texture_image *stImage = st_texture_image(texImage); - const GLenum texBaseFormat = texImage->InternalFormat; + const GLenum texBaseFormat = texImage->_BaseFormat; struct gl_framebuffer *fb = ctx->ReadBuffer; struct st_renderbuffer *strb; struct pipe_context *pipe = ctx->st->pipe; @@ -1474,12 +1475,9 @@ st_copy_texsubimage(GLcontext *ctx, /* determine if copying depth or color data */ if (texBaseFormat == GL_DEPTH_COMPONENT || - texBaseFormat == GL_DEPTH24_STENCIL8) { + texBaseFormat == GL_DEPTH_STENCIL) { strb = st_renderbuffer(fb->_DepthBuffer); } - else if (texBaseFormat == GL_DEPTH_STENCIL_EXT) { - strb = st_renderbuffer(fb->_StencilBuffer); - } else { /* texBaseFormat == GL_RGB, GL_RGBA, GL_ALPHA, etc */ strb = st_renderbuffer(fb->_ColorReadBuffer); -- cgit v1.2.3 From e60ebebb392d1d4c47541766737b5a79685a24d5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 3 Nov 2009 09:30:20 -0700 Subject: st/mesa: don't use util_blit_pixels_writemask() for depth or depth/stencil util_blit_pixels_writemask() only works for color formats at this time. Also, it might never work for depth/stencil surfaces since we can't get handle stencil values in a fragment shader. Fixes glCopyTexSubImage(GL_DEPTH_COMPONENT). --- src/mesa/state_tracker/st_cb_texture.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index e8e81ede00..f45b3e6032 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1560,6 +1560,8 @@ st_copy_texsubimage(GLcontext *ctx, use_fallback = GL_FALSE; } else if (format_writemask && + texBaseFormat != GL_DEPTH_COMPONENT && + texBaseFormat != GL_DEPTH_STENCIL && screen->is_format_supported(screen, src_format, PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER, -- cgit v1.2.3 From a0cd2b7029e1ac6699b807baa255e7fd2abe7f54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 3 Nov 2009 16:16:05 +0100 Subject: st/mesa: clip pixels in draw_stencil_pixels to avoid crash Signed-off-by: Brian Paul --- src/mesa/state_tracker/st_cb_drawpixels.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index c655690603..2a227a7fde 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -661,6 +661,15 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, const GLboolean zoom = ctx->Pixel.ZoomX != 1.0 || ctx->Pixel.ZoomY != 1.0; GLint skipPixels; ubyte *stmap; + struct gl_pixelstore_attrib clippedUnpack = *unpack; + + if (!zoom) { + if (!_mesa_clip_drawpixels(ctx, &x, &y, &width, &height, + &clippedUnpack)) { + /* totally clipped */ + return; + } + } strb = st_renderbuffer(ctx->DrawBuffer-> Attachment[BUFFER_STENCIL].Renderbuffer); @@ -681,7 +690,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, stmap = screen->transfer_map(screen, pt); - pixels = _mesa_map_pbo_source(ctx, unpack, pixels); + pixels = _mesa_map_pbo_source(ctx, &clippedUnpack, pixels); assert(pixels); /* if width > MAX_WIDTH, have to process image in chunks */ @@ -694,17 +703,18 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, GLubyte sValues[MAX_WIDTH]; GLuint zValues[MAX_WIDTH]; GLenum destType = GL_UNSIGNED_BYTE; - const GLvoid *source = _mesa_image_address2d(unpack, pixels, + const GLvoid *source = _mesa_image_address2d(&clippedUnpack, pixels, width, height, format, type, row, skipPixels); _mesa_unpack_stencil_span(ctx, spanWidth, destType, sValues, - type, source, unpack, + type, source, &clippedUnpack, ctx->_ImageTransferState); if (format == GL_DEPTH_STENCIL) { _mesa_unpack_depth_span(ctx, spanWidth, GL_UNSIGNED_INT, zValues, - (1 << 24) - 1, type, source, unpack); + (1 << 24) - 1, type, source, + &clippedUnpack); } if (zoom) { @@ -775,7 +785,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, skipPixels += spanWidth; } - _mesa_unmap_pbo_source(ctx, unpack); + _mesa_unmap_pbo_source(ctx, &clippedUnpack); /* unmap the stencil buffer */ screen->transfer_unmap(screen, pt); -- cgit v1.2.3 From bcbfda71b03303d3f008a6f3cf8cb7d9667bf8d2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 2 Nov 2009 12:40:04 -0700 Subject: intel: avoid unnecessary front buffer flushing/updating Before, if we just called glXMakeCurrent() and didn't render anything we'd still trigger a flushFrontBuffer() call. Now only set the intel->front_buffer_dirty field at state validation time just before we draw something. NOTE: additional calls to intel_check_front_buffer_rendering() might be needed if I missed some rendering paths. --- src/mesa/drivers/dri/i915/intel_tris.c | 1 + src/mesa/drivers/dri/i965/brw_state_upload.c | 3 +++ src/mesa/drivers/dri/intel/intel_buffers.c | 21 +++++++++++++++++++-- src/mesa/drivers/dri/intel/intel_buffers.h | 2 ++ src/mesa/drivers/dri/intel/intel_span.c | 2 ++ 5 files changed, 27 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c index c3cbba8404..bc527aae47 100644 --- a/src/mesa/drivers/dri/i915/intel_tris.c +++ b/src/mesa/drivers/dri/i915/intel_tris.c @@ -1088,6 +1088,7 @@ intelRenderStart(GLcontext * ctx) { struct intel_context *intel = intel_context(ctx); + intel_check_front_buffer_rendering(intel); intel->vtbl.render_start(intel_context(ctx)); intel->vtbl.emit_state(intel); } diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index ee447afa62..f4283bda1b 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -34,6 +34,7 @@ #include "brw_context.h" #include "brw_state.h" #include "intel_batchbuffer.h" +#include "intel_buffers.h" /* This is used to initialize brw->state.atoms[]. We could use this * list directly except for a single atom, brw_constant_buffer, which @@ -324,6 +325,8 @@ void brw_validate_state( struct brw_context *brw ) } } + intel_check_front_buffer_rendering(intel); + /* Make sure that the textures which are referenced by the current * brw fragment program are actually present/valid. * If this fails, we can experience GPU lock-ups. diff --git a/src/mesa/drivers/dri/intel/intel_buffers.c b/src/mesa/drivers/dri/intel/intel_buffers.c index 639ffa6437..6b12d484d8 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.c +++ b/src/mesa/drivers/dri/intel/intel_buffers.c @@ -132,6 +132,25 @@ intel_get_cliprects(struct intel_context *intel, } +/** + * Check if we're about to draw into the front color buffer. + * If so, set the intel->front_buffer_dirty field to true. + */ +void +intel_check_front_buffer_rendering(struct intel_context *intel) +{ + const struct gl_framebuffer *fb = intel->ctx.DrawBuffer; + if (fb->Name == 0) { + /* drawing to window system buffer */ + if (fb->_NumColorDrawBuffers > 0) { + if (fb->_ColorDrawBufferIndexes[0] == BUFFER_FRONT_LEFT) { + intel->front_buffer_dirty = GL_TRUE; + } + } + } +} + + /** * Update the hardware state for drawing into a window or framebuffer object. * @@ -202,8 +221,6 @@ intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb) intel_batchbuffer_flush(intel->batch); intel->front_cliprects = GL_TRUE; colorRegions[0] = intel_get_rb_region(fb, BUFFER_FRONT_LEFT); - - intel->front_buffer_dirty = GL_TRUE; } else { if (!intel->constant_cliprect && intel->front_cliprects) diff --git a/src/mesa/drivers/dri/intel/intel_buffers.h b/src/mesa/drivers/dri/intel/intel_buffers.h index 6069d38e9e..d7800f2ca2 100644 --- a/src/mesa/drivers/dri/intel/intel_buffers.h +++ b/src/mesa/drivers/dri/intel/intel_buffers.h @@ -45,6 +45,8 @@ extern struct intel_region *intel_readbuf_region(struct intel_context *intel); extern struct intel_region *intel_drawbuf_region(struct intel_context *intel); +extern void intel_check_front_buffer_rendering(struct intel_context *intel); + extern void intel_draw_buffer(GLcontext * ctx, struct gl_framebuffer *fb); extern void intelInitBufferFuncs(struct dd_function_table *functions); diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 638e05f2ad..bab13e3665 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -501,6 +501,8 @@ intel_map_unmap_framebuffer(struct intel_context *intel, else intel_renderbuffer_unmap(intel, fb->_StencilBuffer->Wrapped); } + + intel_check_front_buffer_rendering(intel); } /** -- cgit v1.2.3 From 2d11c48223adb78353ca32f0cc07941957310389 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 2 Nov 2009 12:58:51 -0700 Subject: mesa: added assertion, another comment --- src/mesa/main/buffers.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index d8b5f3b1f4..b5acda8823 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -344,7 +344,7 @@ _mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers) /** * Helper function to set the GL_DRAW_BUFFER state in the context and - * current FBO. + * current FBO. Called via glDrawBuffer(), glDrawBuffersARB() * * All error checking will have been done prior to calling this function * so nothing should go wrong at this point. @@ -392,6 +392,8 @@ _mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers, GLuint buf, count = 0; for (buf = 0; buf < n; buf++ ) { if (destMask[buf]) { + /* only one bit should be set in the destMask[buf] field */ + ASSERT(_mesa_bitcount(destMask[buf]) == 1); fb->_ColorDrawBufferIndexes[buf] = _mesa_ffs(destMask[buf]) - 1; fb->ColorDrawBuffer[buf] = buffers[buf]; count = buf + 1; -- cgit v1.2.3 From b28c637382cd3c3fcd54cd77062dab3df78230a9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 2 Nov 2009 13:20:19 -0700 Subject: mesa: use ffs() to shorten loop in _mesa_drawbuffers() --- src/mesa/main/buffers.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index b5acda8823..cdd16a8ad1 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -375,15 +375,19 @@ _mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers, destMask = mask; } + /* + * If n==1, destMask[0] may have up to four bits set. + * Otherwise, destMask[x] can only have one bit set. + */ if (n == 1) { - GLuint buf, count = 0; + GLuint count = 0, destMask0 = destMask[0]; /* init to -1 to help catch errors */ fb->_ColorDrawBufferIndexes[0] = -1; - for (buf = 0; buf < BUFFER_COUNT; buf++) { - if (destMask[0] & (1 << buf)) { - fb->_ColorDrawBufferIndexes[count] = buf; - count++; - } + while (destMask0) { + GLint bufIndex = _mesa_ffs(destMask0) - 1; + fb->_ColorDrawBufferIndexes[count] = bufIndex; + count++; + destMask0 &= ~(1 << bufIndex); } fb->ColorDrawBuffer[0] = buffers[0]; fb->_NumColorDrawBuffers = count; -- cgit v1.2.3 From 8df699b3bb1aa05b633f05b121d09d812c86a22d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 2 Nov 2009 14:41:17 -0700 Subject: mesa: avoid extraneous _NEW_BUFFER state in _mesa_drawbuffers() --- src/mesa/main/buffers.c | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index cdd16a8ad1..028644fe4b 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -362,6 +362,7 @@ _mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers, { struct gl_framebuffer *fb = ctx->DrawBuffer; GLbitfield mask[MAX_DRAW_BUFFERS]; + GLboolean newState = GL_FALSE; if (!destMask) { /* compute destMask values now */ @@ -382,35 +383,50 @@ _mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers, if (n == 1) { GLuint count = 0, destMask0 = destMask[0]; /* init to -1 to help catch errors */ - fb->_ColorDrawBufferIndexes[0] = -1; + //fb->_ColorDrawBufferIndexes[0] = -1; while (destMask0) { GLint bufIndex = _mesa_ffs(destMask0) - 1; - fb->_ColorDrawBufferIndexes[count] = bufIndex; + if (fb->_ColorDrawBufferIndexes[count] != bufIndex) { + fb->_ColorDrawBufferIndexes[count] = bufIndex; + newState = GL_TRUE; + } count++; destMask0 &= ~(1 << bufIndex); } fb->ColorDrawBuffer[0] = buffers[0]; - fb->_NumColorDrawBuffers = count; + if (fb->_NumColorDrawBuffers != count) { + fb->_NumColorDrawBuffers = count; + newState = GL_TRUE; + } } else { GLuint buf, count = 0; for (buf = 0; buf < n; buf++ ) { if (destMask[buf]) { + GLint bufIndex = _mesa_ffs(destMask[buf]) - 1; /* only one bit should be set in the destMask[buf] field */ ASSERT(_mesa_bitcount(destMask[buf]) == 1); - fb->_ColorDrawBufferIndexes[buf] = _mesa_ffs(destMask[buf]) - 1; + if (fb->_ColorDrawBufferIndexes[buf] != bufIndex) { + fb->_ColorDrawBufferIndexes[buf] = bufIndex; + newState = GL_TRUE; + } fb->ColorDrawBuffer[buf] = buffers[buf]; count = buf + 1; } else { - fb->_ColorDrawBufferIndexes[buf] = -1; + if (fb->_ColorDrawBufferIndexes[buf] != -1) { + fb->_ColorDrawBufferIndexes[buf] = -1; + newState = GL_TRUE; + } } } /* set remaining outputs to -1 (GL_NONE) */ while (buf < ctx->Const.MaxDrawBuffers) { - fb->_ColorDrawBufferIndexes[buf] = -1; + if (fb->_ColorDrawBufferIndexes[buf] != -1) { + fb->_ColorDrawBufferIndexes[buf] = -1; + buf++; + } fb->ColorDrawBuffer[buf] = GL_NONE; - buf++; } fb->_NumColorDrawBuffers = count; } @@ -419,11 +435,15 @@ _mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers, /* also set context drawbuffer state */ GLuint buf; for (buf = 0; buf < ctx->Const.MaxDrawBuffers; buf++) { - ctx->Color.DrawBuffer[buf] = fb->ColorDrawBuffer[buf]; + if (ctx->Color.DrawBuffer[buf] != fb->ColorDrawBuffer[buf]) { + ctx->Color.DrawBuffer[buf] = fb->ColorDrawBuffer[buf]; + newState = GL_TRUE; + } } } - ctx->NewState |= _NEW_BUFFERS; + if (newState) + ctx->NewState |= _NEW_BUFFERS; } -- cgit v1.2.3 From c7048f9d9f91ef8c3ef35e31976adbf686349c41 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 2 Nov 2009 15:27:57 -0700 Subject: mesa: use FLUSH_VERTICES() in _mesa_drawbuffers() --- src/mesa/main/buffers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 028644fe4b..740ac3f4ae 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -443,7 +443,7 @@ _mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers, } if (newState) - ctx->NewState |= _NEW_BUFFERS; + FLUSH_VERTICES(ctx, _NEW_BUFFERS); } -- cgit v1.2.3 From 18af75e5011cc31b52d62befba2cacfd353ce638 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 2 Nov 2009 15:29:03 -0700 Subject: mesa: avoid extraneous _NEW_BUFFER changes in _mesa_BindFramebufferEXT() --- src/mesa/main/fbobject.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 4c6528bcf7..4229ede8c0 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1228,8 +1228,6 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) return; } - FLUSH_CURRENT(ctx, _NEW_BUFFERS); - if (framebuffer) { /* Binding a user-created framebuffer object */ newFb = _mesa_lookup_framebuffer(ctx, framebuffer); @@ -1268,12 +1266,14 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) /* * OK, now bind the new Draw/Read framebuffers, if they're changing. */ - if (bindReadBuf) { - if (ctx->ReadBuffer == newFbread) + if (ctx->ReadBuffer == newFbread) { bindReadBuf = GL_FALSE; /* no change */ - else + } + else { + FLUSH_VERTICES(ctx, _NEW_BUFFERS); _mesa_reference_framebuffer(&ctx->ReadBuffer, newFbread); + } } if (bindDrawBuf) { @@ -1282,10 +1282,13 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) check_end_texture_render(ctx, ctx->DrawBuffer); } - if (ctx->DrawBuffer == newFb) + if (ctx->DrawBuffer == newFb) { bindDrawBuf = GL_FALSE; /* no change */ - else + } + else { + FLUSH_VERTICES(ctx, _NEW_BUFFERS); _mesa_reference_framebuffer(&ctx->DrawBuffer, newFb); + } if (newFb->Name != 0) { /* check if newly bound framebuffer has any texture attachments */ -- cgit v1.2.3 From 5698d7cd7557659440f8417716839ba07cffc5a5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 2 Nov 2009 15:29:54 -0700 Subject: mesa: clean-up formatting --- src/mesa/main/buffers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 740ac3f4ae..e76cf87cb0 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -338,7 +338,7 @@ _mesa_DrawBuffersARB(GLsizei n, const GLenum *buffers) if (ctx->Driver.DrawBuffers) ctx->Driver.DrawBuffers(ctx, n, buffers); else if (ctx->Driver.DrawBuffer) - ctx->Driver.DrawBuffer(ctx, n>0? buffers[0]:GL_NONE); + ctx->Driver.DrawBuffer(ctx, n > 0 ? buffers[0] : GL_NONE); } -- cgit v1.2.3 From 4de18fb093e700ee33ed49035ab77f4a9453329a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 2 Nov 2009 15:30:51 -0700 Subject: mesa: fix indentation --- src/mesa/main/fbobject.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 4229ede8c0..f9aea27860 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -712,8 +712,7 @@ _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer) ASSERT_OUTSIDE_BEGIN_END(ctx); if (target != GL_RENDERBUFFER_EXT) { - _mesa_error(ctx, GL_INVALID_ENUM, - "glBindRenderbufferEXT(target)"); + _mesa_error(ctx, GL_INVALID_ENUM, "glBindRenderbufferEXT(target)"); return; } -- cgit v1.2.3 From 800e553e7a1703e33e54f45d0638b67001665fc5 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 2 Nov 2009 15:39:39 -0700 Subject: mesa: clean-up, remove some flushing in FBO functions Remove some unneeded flushes. Replace FLUSH_CURRENT w/ FLUSH_VERTICES in other places. --- src/mesa/main/fbobject.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index f9aea27860..319d0f2ce9 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -716,7 +716,9 @@ _mesa_BindRenderbufferEXT(GLenum target, GLuint renderbuffer) return; } - FLUSH_CURRENT(ctx, _NEW_BUFFERS); + /* No need to flush here since the render buffer binding has no + * effect on rendering state. + */ if (renderbuffer) { newRb = _mesa_lookup_renderbuffer(ctx, renderbuffer); @@ -1093,7 +1095,9 @@ _mesa_GetRenderbufferParameterivEXT(GLenum target, GLenum pname, GLint *params) return; } - FLUSH_VERTICES(ctx, _NEW_BUFFERS); + /* No need to flush here since we're just quering state which is + * not effected by rendering. + */ switch (pname) { case GL_RENDERBUFFER_WIDTH_EXT: @@ -1308,7 +1312,7 @@ _mesa_DeleteFramebuffersEXT(GLsizei n, const GLuint *framebuffers) GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); - FLUSH_CURRENT(ctx, _NEW_BUFFERS); + FLUSH_VERTICES(ctx, _NEW_BUFFERS); for (i = 0; i < n; i++) { if (framebuffers[i] > 0) { @@ -1413,7 +1417,7 @@ _mesa_CheckFramebufferStatusEXT(GLenum target) return GL_FRAMEBUFFER_COMPLETE_EXT; } - FLUSH_VERTICES(ctx, _NEW_BUFFERS); + /* No need to flush here */ if (buffer->_Status != GL_FRAMEBUFFER_COMPLETE) { _mesa_test_framebuffer_completeness(ctx, buffer); @@ -1529,7 +1533,7 @@ framebuffer_texture(GLcontext *ctx, const char *caller, GLenum target, return; } - FLUSH_CURRENT(ctx, _NEW_BUFFERS); + FLUSH_VERTICES(ctx, _NEW_BUFFERS); _glthread_LOCK_MUTEX(fb->Mutex); if (texObj) { @@ -1709,7 +1713,7 @@ _mesa_FramebufferRenderbufferEXT(GLenum target, GLenum attachment, } - FLUSH_CURRENT(ctx, _NEW_BUFFERS); + FLUSH_VERTICES(ctx, _NEW_BUFFERS); assert(ctx->Driver.FramebufferRenderbuffer); ctx->Driver.FramebufferRenderbuffer(ctx, fb, attachment, rb); @@ -1785,7 +1789,7 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, } } - FLUSH_CURRENT(ctx, _NEW_BUFFERS); + /* No need to flush here */ switch (pname) { case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT: -- cgit v1.2.3 From 7ccf60ae40b2a201d446400bc8329df51e83cb6c Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 3 Nov 2009 09:55:28 +0000 Subject: tgsi: Up tgsi_exec's control flow nesting to 32. --- src/gallium/auxiliary/tgsi/tgsi_exec.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h index 08df15ec6a..471f591dd6 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.h +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h @@ -177,9 +177,9 @@ struct tgsi_exec_labels -#define TGSI_EXEC_MAX_COND_NESTING 20 -#define TGSI_EXEC_MAX_LOOP_NESTING 20 -#define TGSI_EXEC_MAX_CALL_NESTING 20 +#define TGSI_EXEC_MAX_COND_NESTING 32 +#define TGSI_EXEC_MAX_LOOP_NESTING 32 +#define TGSI_EXEC_MAX_CALL_NESTING 32 /* The maximum number of input attributes per vertex. For 2D * input register files, this is the stride between two 1D -- cgit v1.2.3 From a2e868b977dfbd170b8016c0386a773f2cdd0b73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Mon, 2 Nov 2009 09:47:24 +0000 Subject: python/retrace: Add missing colon. --- src/gallium/state_trackers/python/retrace/interpreter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index f4ed2fde4d..c3bc6bc43c 100755 --- a/src/gallium/state_trackers/python/retrace/interpreter.py +++ b/src/gallium/state_trackers/python/retrace/interpreter.py @@ -314,7 +314,7 @@ class Screen(Object): if texture is None: return None transfer = Transfer(texture.get_surface(face, level, zslice), x, y, w, h) - if transfer and usage & gallium.PIPE_TRANSFER_READ + if transfer and usage & gallium.PIPE_TRANSFER_READ: if self.interpreter.options.all: self.interpreter.present(transfer.surface, 'transf_read', x, y, w, h) return transfer -- cgit v1.2.3 From 3e8f665c1eae5c93c1349e04476950dcd7a42073 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Mon, 2 Nov 2009 09:47:47 +0000 Subject: python/retrace: Cope with null constant buffers. --- src/gallium/state_trackers/python/retrace/interpreter.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index c3bc6bc43c..348f2e4368 100755 --- a/src/gallium/state_trackers/python/retrace/interpreter.py +++ b/src/gallium/state_trackers/python/retrace/interpreter.py @@ -459,7 +459,7 @@ class Context(Object): sys.stdout.flush() def set_constant_buffer(self, shader, index, buffer): - if buffer is not None: + if buffer is not None and buffer.buffer is not None: self.real.set_constant_buffer(shader, index, buffer.buffer) self.dump_constant_buffer(buffer.buffer) -- cgit v1.2.3 From 677a055fa0cf7b6476c716be187513c41060d417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 3 Nov 2009 13:10:58 +0000 Subject: llvmpipe: Respect gl_rasterization_rules in primitive setup. Based on Michal's identical commit for softpipe (ca9c413647bf9efb5ed770e3a655bc758075aec7). --- src/gallium/drivers/llvmpipe/lp_setup.c | 48 ++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index c43b3da450..11ebfa0236 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -90,6 +90,8 @@ struct setup_context { float oneoverarea; int facing; + float pixel_offset; + struct quad_header quad[MAX_QUADS]; struct quad_header *quad_ptrs[MAX_QUADS]; unsigned count; @@ -483,6 +485,16 @@ static boolean setup_sort_vertices( struct setup_context *setup, ((det > 0.0) ^ (setup->llvmpipe->rasterizer->front_winding == PIPE_WINDING_CW)); + /* Prepare pixel offset for rasterisation: + * - pixel center (0.5, 0.5) for GL, or + * - assume (0.0, 0.0) for other APIs. + */ + if (setup->llvmpipe->rasterizer->gl_rasterization_rules) { + setup->pixel_offset = 0.5f; + } else { + setup->pixel_offset = 0.0f; + } + return TRUE; } @@ -508,7 +520,7 @@ static void tri_pos_coeff( struct setup_context *setup, /* calculate a0 as the value which would be sampled for the * fragment at (0,0), taking into account that we want to sample at - * pixel centers, in other words (0.5, 0.5). + * pixel centers, in other words (pixel_offset, pixel_offset). * * this is neat but unfortunately not a good way to do things for * triangles with very large values of dadx or dady as it will @@ -519,8 +531,8 @@ static void tri_pos_coeff( struct setup_context *setup, * instead - i'll switch to this later. */ setup->coef.a0[0][i] = (setup->vmin[vertSlot][i] - - (dadx * (setup->vmin[0][0] - 0.5f) + - dady * (setup->vmin[0][1] - 0.5f))); + (dadx * (setup->vmin[0][0] - setup->pixel_offset) + + dady * (setup->vmin[0][1] - setup->pixel_offset))); /* debug_printf("attr[%d].%c: %f dx:%f dy:%f\n", @@ -609,8 +621,8 @@ static void tri_linear_coeff( struct setup_context *setup, * instead - i'll switch to this later. */ setup->coef.a0[1 + attrib][i] = (setup->vmin[vertSlot][i] - - (dadx * (setup->vmin[0][0] - 0.5f) + - dady * (setup->vmin[0][1] - 0.5f))); + (dadx * (setup->vmin[0][0] - setup->pixel_offset) + + dady * (setup->vmin[0][1] - setup->pixel_offset))); /* debug_printf("attr[%d].%c: %f dx:%f dy:%f\n", @@ -661,8 +673,8 @@ static void tri_persp_coeff( struct setup_context *setup, setup->coef.dadx[1 + attrib][i] = dadx; setup->coef.dady[1 + attrib][i] = dady; setup->coef.a0[1 + attrib][i] = (mina - - (dadx * (setup->vmin[0][0] - 0.5f) + - dady * (setup->vmin[0][1] - 0.5f))); + (dadx * (setup->vmin[0][0] - setup->pixel_offset) + + dady * (setup->vmin[0][1] - setup->pixel_offset))); } } @@ -746,12 +758,12 @@ static void setup_tri_coefficients( struct setup_context *setup ) static void setup_tri_edges( struct setup_context *setup ) { - float vmin_x = setup->vmin[0][0] + 0.5f; - float vmid_x = setup->vmid[0][0] + 0.5f; + float vmin_x = setup->vmin[0][0] + setup->pixel_offset; + float vmid_x = setup->vmid[0][0] + setup->pixel_offset; - float vmin_y = setup->vmin[0][1] - 0.5f; - float vmid_y = setup->vmid[0][1] - 0.5f; - float vmax_y = setup->vmax[0][1] - 0.5f; + float vmin_y = setup->vmin[0][1] - setup->pixel_offset; + float vmid_y = setup->vmid[0][1] - setup->pixel_offset; + float vmax_y = setup->vmax[0][1] - setup->pixel_offset; setup->emaj.sy = ceilf(vmin_y); setup->emaj.lines = (int) ceilf(vmax_y - setup->emaj.sy); @@ -950,8 +962,8 @@ linear_pos_coeff(struct setup_context *setup, setup->coef.dadx[0][i] = dadx; setup->coef.dady[0][i] = dady; setup->coef.a0[0][i] = (setup->vmin[vertSlot][i] - - (dadx * (setup->vmin[0][0] - 0.5f) + - dady * (setup->vmin[0][1] - 0.5f))); + (dadx * (setup->vmin[0][0] - setup->pixel_offset) + + dady * (setup->vmin[0][1] - setup->pixel_offset))); } @@ -972,8 +984,8 @@ line_linear_coeff(struct setup_context *setup, setup->coef.dadx[1 + attrib][i] = dadx; setup->coef.dady[1 + attrib][i] = dady; setup->coef.a0[1 + attrib][i] = (setup->vmin[vertSlot][i] - - (dadx * (setup->vmin[0][0] - 0.5f) + - dady * (setup->vmin[0][1] - 0.5f))); + (dadx * (setup->vmin[0][0] - setup->pixel_offset) + + dady * (setup->vmin[0][1] - setup->pixel_offset))); } } @@ -998,8 +1010,8 @@ line_persp_coeff(struct setup_context *setup, setup->coef.dadx[1 + attrib][i] = dadx; setup->coef.dady[1 + attrib][i] = dady; setup->coef.a0[1 + attrib][i] = (setup->vmin[vertSlot][i] - - (dadx * (setup->vmin[0][0] - 0.5f) + - dady * (setup->vmin[0][1] - 0.5f))); + (dadx * (setup->vmin[0][0] - setup->pixel_offset) + + dady * (setup->vmin[0][1] - setup->pixel_offset))); } } -- cgit v1.2.3 From 026cf84bbbd939f0ae573a9841bb49aaa1d9ae75 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 23 Aug 2009 11:22:41 +0100 Subject: llvmpipe: remove old prim_setup draw stage Everything now goes through the draw_vbuf handler, the same as regular drivers. Based on Keith's commit 4fe0fc3eba1f79beda890a5016359d549bab6ad4. --- src/gallium/drivers/llvmpipe/Makefile | 1 - src/gallium/drivers/llvmpipe/SConscript | 1 - src/gallium/drivers/llvmpipe/lp_context.c | 26 ++-- src/gallium/drivers/llvmpipe/lp_context.h | 5 +- src/gallium/drivers/llvmpipe/lp_prim_setup.c | 190 ------------------------ src/gallium/drivers/llvmpipe/lp_prim_setup.h | 85 ----------- src/gallium/drivers/llvmpipe/lp_prim_vbuf.c | 107 ++++--------- src/gallium/drivers/llvmpipe/lp_prim_vbuf.h | 4 +- src/gallium/drivers/llvmpipe/lp_setup.c | 1 - src/gallium/drivers/llvmpipe/lp_state_derived.c | 25 ++-- 10 files changed, 59 insertions(+), 386 deletions(-) delete mode 100644 src/gallium/drivers/llvmpipe/lp_prim_setup.c delete mode 100644 src/gallium/drivers/llvmpipe/lp_prim_setup.h (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/Makefile b/src/gallium/drivers/llvmpipe/Makefile index cdf318844c..e038a5229e 100644 --- a/src/gallium/drivers/llvmpipe/Makefile +++ b/src/gallium/drivers/llvmpipe/Makefile @@ -35,7 +35,6 @@ C_SOURCES = \ lp_draw_arrays.c \ lp_flush.c \ lp_jit.c \ - lp_prim_setup.c \ lp_prim_vbuf.c \ lp_setup.c \ lp_query.c \ diff --git a/src/gallium/drivers/llvmpipe/SConscript b/src/gallium/drivers/llvmpipe/SConscript index f4410f8201..3bd2e70013 100644 --- a/src/gallium/drivers/llvmpipe/SConscript +++ b/src/gallium/drivers/llvmpipe/SConscript @@ -49,7 +49,6 @@ llvmpipe = env.ConvenienceLibrary( 'lp_draw_arrays.c', 'lp_flush.c', 'lp_jit.c', - 'lp_prim_setup.c', 'lp_prim_vbuf.c', 'lp_setup.c', 'lp_query.c', diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index 202cb8ef43..57e71f3e98 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -31,13 +31,13 @@ */ #include "draw/draw_context.h" +#include "draw/draw_vbuf.h" #include "pipe/p_defines.h" #include "util/u_math.h" #include "util/u_memory.h" #include "lp_clear.h" #include "lp_context.h" #include "lp_flush.h" -#include "lp_prim_setup.h" #include "lp_prim_vbuf.h" #include "lp_state.h" #include "lp_surface.h" @@ -264,21 +264,21 @@ llvmpipe_create( struct pipe_screen *screen ) (struct tgsi_sampler **) llvmpipe->tgsi.vert_samplers_list); - llvmpipe->setup = lp_draw_render_stage(llvmpipe); - if (!llvmpipe->setup) - goto fail; - if (debug_get_bool_option( "LP_NO_RAST", FALSE )) llvmpipe->no_rast = TRUE; - if (debug_get_bool_option( "LP_NO_VBUF", FALSE )) { - /* Deprecated path -- vbuf is the intended interface to the draw module: - */ - draw_set_rasterize_stage(llvmpipe->draw, llvmpipe->setup); - } - else { - lp_init_vbuf(llvmpipe); - } + llvmpipe->vbuf_backend = lp_create_vbuf_backend(llvmpipe); + if (!llvmpipe->vbuf_backend) + goto fail; + + llvmpipe->vbuf = draw_vbuf_stage(llvmpipe->draw, llvmpipe->vbuf_backend); + if (!llvmpipe->vbuf) + goto fail; + + draw_set_rasterize_stage(llvmpipe->draw, llvmpipe->vbuf); + draw_set_render(llvmpipe->draw, llvmpipe->vbuf_backend); + + /* plug in AA line/point stages */ draw_install_aaline_stage(llvmpipe->draw, &llvmpipe->pipe); diff --git a/src/gallium/drivers/llvmpipe/lp_context.h b/src/gallium/drivers/llvmpipe/lp_context.h index 7df340554e..3ad95d0bfc 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.h +++ b/src/gallium/drivers/llvmpipe/lp_context.h @@ -121,9 +121,10 @@ struct llvmpipe_context { /** The primitive drawing context */ struct draw_context *draw; - struct draw_stage *setup; + + /** Draw module backend */ + struct vbuf_render *vbuf_backend; struct draw_stage *vbuf; - struct llvmpipe_vbuf_render *vbuf_render; boolean dirty_render_cache; diff --git a/src/gallium/drivers/llvmpipe/lp_prim_setup.c b/src/gallium/drivers/llvmpipe/lp_prim_setup.c deleted file mode 100644 index b14f8fb99d..0000000000 --- a/src/gallium/drivers/llvmpipe/lp_prim_setup.c +++ /dev/null @@ -1,190 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * 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. - * - **************************************************************************/ - -/** - * \brief A draw stage that drives our triangle setup routines from - * within the draw pipeline. One of two ways to drive setup, the - * other being in lp_prim_vbuf.c. - * - * \author Keith Whitwell - * \author Brian Paul - */ - - -#include "lp_context.h" -#include "lp_setup.h" -#include "lp_state.h" -#include "lp_prim_setup.h" -#include "draw/draw_pipe.h" -#include "draw/draw_vertex.h" -#include "util/u_memory.h" - -/** - * Triangle setup info (derived from draw_stage). - * Also used for line drawing (taking some liberties). - */ -struct setup_stage { - struct draw_stage stage; /**< This must be first (base class) */ - - struct setup_context *setup; -}; - - - -/** - * Basically a cast wrapper. - */ -static INLINE struct setup_stage *setup_stage( struct draw_stage *stage ) -{ - return (struct setup_stage *)stage; -} - - -typedef const float (*cptrf4)[4]; - -static void -do_tri(struct draw_stage *stage, struct prim_header *prim) -{ - struct setup_stage *setup = setup_stage( stage ); - - llvmpipe_setup_tri( setup->setup, - (cptrf4)prim->v[0]->data, - (cptrf4)prim->v[1]->data, - (cptrf4)prim->v[2]->data ); -} - -static void -do_line(struct draw_stage *stage, struct prim_header *prim) -{ - struct setup_stage *setup = setup_stage( stage ); - - llvmpipe_setup_line( setup->setup, - (cptrf4)prim->v[0]->data, - (cptrf4)prim->v[1]->data ); -} - -static void -do_point(struct draw_stage *stage, struct prim_header *prim) -{ - struct setup_stage *setup = setup_stage( stage ); - - llvmpipe_setup_point( setup->setup, - (cptrf4)prim->v[0]->data ); -} - - - - -static void setup_begin( struct draw_stage *stage ) -{ - struct setup_stage *setup = setup_stage(stage); - - llvmpipe_setup_prepare( setup->setup ); - - stage->point = do_point; - stage->line = do_line; - stage->tri = do_tri; -} - - -static void setup_first_point( struct draw_stage *stage, - struct prim_header *header ) -{ - setup_begin(stage); - stage->point( stage, header ); -} - -static void setup_first_line( struct draw_stage *stage, - struct prim_header *header ) -{ - setup_begin(stage); - stage->line( stage, header ); -} - - -static void setup_first_tri( struct draw_stage *stage, - struct prim_header *header ) -{ - setup_begin(stage); - stage->tri( stage, header ); -} - - - -static void setup_flush( struct draw_stage *stage, - unsigned flags ) -{ - stage->point = setup_first_point; - stage->line = setup_first_line; - stage->tri = setup_first_tri; -} - - -static void reset_stipple_counter( struct draw_stage *stage ) -{ -} - - -static void render_destroy( struct draw_stage *stage ) -{ - struct setup_stage *ssetup = setup_stage(stage); - llvmpipe_setup_destroy_context(ssetup->setup); - FREE( stage ); -} - - -/** - * Create a new primitive setup/render stage. - */ -struct draw_stage *lp_draw_render_stage( struct llvmpipe_context *llvmpipe ) -{ - struct setup_stage *sstage = CALLOC_STRUCT(setup_stage); - - sstage->setup = llvmpipe_setup_create_context(llvmpipe); - sstage->stage.draw = llvmpipe->draw; - sstage->stage.point = setup_first_point; - sstage->stage.line = setup_first_line; - sstage->stage.tri = setup_first_tri; - sstage->stage.flush = setup_flush; - sstage->stage.reset_stipple_counter = reset_stipple_counter; - sstage->stage.destroy = render_destroy; - - return (struct draw_stage *)sstage; -} - -struct setup_context * -lp_draw_setup_context( struct draw_stage *stage ) -{ - struct setup_stage *ssetup = setup_stage(stage); - return ssetup->setup; -} - -void -lp_draw_flush( struct draw_stage *stage ) -{ - stage->flush( stage, 0 ); -} diff --git a/src/gallium/drivers/llvmpipe/lp_prim_setup.h b/src/gallium/drivers/llvmpipe/lp_prim_setup.h deleted file mode 100644 index da6cae6375..0000000000 --- a/src/gallium/drivers/llvmpipe/lp_prim_setup.h +++ /dev/null @@ -1,85 +0,0 @@ -/************************************************************************** - * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. - * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR - * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - **************************************************************************/ - - -#ifndef LP_PRIM_SETUP_H -#define LP_PRIM_SETUP_H - - -/** - * vbuf is a special stage to gather the stream of triangles, lines, points - * together and reconstruct vertex buffers for hardware upload. - * - * First attempt, work in progress. - * - * TODO: - * - separate out vertex buffer building and primitive emit, ie >1 draw per vb. - * - tell vbuf stage how to build hw vertices directly - * - pass vbuf stage a buffer pointer for direct emit to agp/vram. - * - * - * - * Vertices are just an array of floats, with all the attributes - * packed. We currently assume a layout like: - * - * attr[0][0..3] - window position - * attr[1..n][0..3] - remaining attributes. - * - * Attributes are assumed to be 4 floats wide but are packed so that - * all the enabled attributes run contiguously. - */ - - -struct draw_stage; -struct llvmpipe_context; - - -typedef void (*vbuf_draw_func)( struct pipe_context *pipe, - unsigned prim, - const ushort *elements, - unsigned nr_elements, - const void *vertex_buffer, - unsigned nr_vertices ); - - -extern struct draw_stage * -lp_draw_render_stage( struct llvmpipe_context *llvmpipe ); - -extern struct setup_context * -lp_draw_setup_context( struct draw_stage * ); - -extern void -lp_draw_flush( struct draw_stage * ); - - -extern struct draw_stage * -lp_draw_vbuf_stage( struct draw_context *draw_context, - struct pipe_context *pipe, - vbuf_draw_func draw ); - - -#endif /* LP_PRIM_SETUP_H */ diff --git a/src/gallium/drivers/llvmpipe/lp_prim_vbuf.c b/src/gallium/drivers/llvmpipe/lp_prim_vbuf.c index c394dcb61d..4abff4eccc 100644 --- a/src/gallium/drivers/llvmpipe/lp_prim_vbuf.c +++ b/src/gallium/drivers/llvmpipe/lp_prim_vbuf.c @@ -37,10 +37,9 @@ #include "lp_context.h" +#include "lp_setup.h" #include "lp_state.h" #include "lp_prim_vbuf.h" -#include "lp_prim_setup.h" -#include "lp_setup.h" #include "draw/draw_context.h" #include "draw/draw_vbuf.h" #include "util/u_memory.h" @@ -59,6 +58,8 @@ struct llvmpipe_vbuf_render { struct vbuf_render base; struct llvmpipe_context *llvmpipe; + struct setup_context *setup; + uint prim; uint vertex_size; uint nr_vertices; @@ -75,6 +76,11 @@ llvmpipe_vbuf_render(struct vbuf_render *vbr) } + + + + + static const struct vertex_info * lp_vbuf_get_vertex_info(struct vbuf_render *vbr) { @@ -105,36 +111,6 @@ lp_vbuf_allocate_vertices(struct vbuf_render *vbr, static void lp_vbuf_release_vertices(struct vbuf_render *vbr) { -#if 0 - { - struct llvmpipe_vbuf_render *cvbr = llvmpipe_vbuf_render(vbr); - const struct vertex_info *info = - llvmpipe_get_vbuf_vertex_info(cvbr->llvmpipe); - const float *vtx = (const float *) cvbr->vertex_buffer; - uint i, j; - debug_printf("%s (vtx_size = %u, vtx_used = %u)\n", - __FUNCTION__, cvbr->vertex_size, cvbr->nr_vertices); - for (i = 0; i < cvbr->nr_vertices; i++) { - for (j = 0; j < info->num_attribs; j++) { - uint k; - switch (info->attrib[j].emit) { - case EMIT_4F: k = 4; break; - case EMIT_3F: k = 3; break; - case EMIT_2F: k = 2; break; - case EMIT_1F: k = 1; break; - default: assert(0); - } - debug_printf("Vert %u attr %u: ", i, j); - while (k-- > 0) { - debug_printf("%g ", vtx[0]); - vtx++; - } - debug_printf("\n"); - } - } - } -#endif - /* keep the old allocation for next time */ } @@ -160,11 +136,7 @@ static boolean lp_vbuf_set_primitive(struct vbuf_render *vbr, unsigned prim) { struct llvmpipe_vbuf_render *cvbr = llvmpipe_vbuf_render(vbr); - - /* XXX: break this dependency - make setup_context live under - * llvmpipe, rename the old "setup" draw stage to something else. - */ - struct setup_context *setup_ctx = lp_draw_setup_context(cvbr->llvmpipe->setup); + struct setup_context *setup_ctx = cvbr->setup; llvmpipe_setup_prepare( setup_ctx ); @@ -193,14 +165,9 @@ lp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) struct llvmpipe_context *llvmpipe = cvbr->llvmpipe; const unsigned stride = llvmpipe->vertex_info_vbuf.size * sizeof(float); const void *vertex_buffer = cvbr->vertex_buffer; + struct setup_context *setup_ctx = cvbr->setup; unsigned i; - /* XXX: break this dependency - make setup_context live under - * llvmpipe, rename the old "setup" draw stage to something else. - */ - struct draw_stage *setup = llvmpipe->setup; - struct setup_context *setup_ctx = lp_draw_setup_context(setup); - switch (cvbr->prim) { case PIPE_PRIM_POINTS: for (i = 0; i < nr; i++) { @@ -367,11 +334,6 @@ lp_vbuf_draw(struct vbuf_render *vbr, const ushort *indices, uint nr) default: assert(0); } - - /* XXX: why are we calling this??? If we had to call something, it - * would be a function in lp_setup.c: - */ - lp_draw_flush( setup ); } @@ -384,17 +346,12 @@ lp_vbuf_draw_arrays(struct vbuf_render *vbr, uint start, uint nr) { struct llvmpipe_vbuf_render *cvbr = llvmpipe_vbuf_render(vbr); struct llvmpipe_context *llvmpipe = cvbr->llvmpipe; + struct setup_context *setup_ctx = cvbr->setup; const unsigned stride = llvmpipe->vertex_info_vbuf.size * sizeof(float); const void *vertex_buffer = (void *) get_vert(cvbr->vertex_buffer, start, stride); unsigned i; - /* XXX: break this dependency - make setup_context live under - * llvmpipe, rename the old "setup" draw stage to something else. - */ - struct draw_stage *setup = llvmpipe->setup; - struct setup_context *setup_ctx = lp_draw_setup_context(setup); - switch (cvbr->prim) { case PIPE_PRIM_POINTS: for (i = 0; i < nr; i++) { @@ -568,40 +525,38 @@ static void lp_vbuf_destroy(struct vbuf_render *vbr) { struct llvmpipe_vbuf_render *cvbr = llvmpipe_vbuf_render(vbr); - cvbr->llvmpipe->vbuf_render = NULL; + llvmpipe_setup_destroy_context(cvbr->setup); FREE(cvbr); } /** - * Initialize the post-transform vertex buffer information for the given - * context. + * Create the post-transform vertex handler for the given context. */ -void -lp_init_vbuf(struct llvmpipe_context *lp) +struct vbuf_render * +lp_create_vbuf_backend(struct llvmpipe_context *lp) { - assert(lp->draw); + struct llvmpipe_vbuf_render *cvbr = CALLOC_STRUCT(llvmpipe_vbuf_render); - lp->vbuf_render = CALLOC_STRUCT(llvmpipe_vbuf_render); + assert(lp->draw); - lp->vbuf_render->base.max_indices = LP_MAX_VBUF_INDEXES; - lp->vbuf_render->base.max_vertex_buffer_bytes = LP_MAX_VBUF_SIZE; - lp->vbuf_render->base.get_vertex_info = lp_vbuf_get_vertex_info; - lp->vbuf_render->base.allocate_vertices = lp_vbuf_allocate_vertices; - lp->vbuf_render->base.map_vertices = lp_vbuf_map_vertices; - lp->vbuf_render->base.unmap_vertices = lp_vbuf_unmap_vertices; - lp->vbuf_render->base.set_primitive = lp_vbuf_set_primitive; - lp->vbuf_render->base.draw = lp_vbuf_draw; - lp->vbuf_render->base.draw_arrays = lp_vbuf_draw_arrays; - lp->vbuf_render->base.release_vertices = lp_vbuf_release_vertices; - lp->vbuf_render->base.destroy = lp_vbuf_destroy; + cvbr->base.max_indices = LP_MAX_VBUF_INDEXES; + cvbr->base.max_vertex_buffer_bytes = LP_MAX_VBUF_SIZE; - lp->vbuf_render->llvmpipe = lp; + cvbr->base.get_vertex_info = lp_vbuf_get_vertex_info; + cvbr->base.allocate_vertices = lp_vbuf_allocate_vertices; + cvbr->base.map_vertices = lp_vbuf_map_vertices; + cvbr->base.unmap_vertices = lp_vbuf_unmap_vertices; + cvbr->base.set_primitive = lp_vbuf_set_primitive; + cvbr->base.draw = lp_vbuf_draw; + cvbr->base.draw_arrays = lp_vbuf_draw_arrays; + cvbr->base.release_vertices = lp_vbuf_release_vertices; + cvbr->base.destroy = lp_vbuf_destroy; - lp->vbuf = draw_vbuf_stage(lp->draw, &lp->vbuf_render->base); + cvbr->llvmpipe = lp; - draw_set_rasterize_stage(lp->draw, lp->vbuf); + cvbr->setup = llvmpipe_setup_create_context(cvbr->llvmpipe); - draw_set_render(lp->draw, &lp->vbuf_render->base); + return &cvbr->base; } diff --git a/src/gallium/drivers/llvmpipe/lp_prim_vbuf.h b/src/gallium/drivers/llvmpipe/lp_prim_vbuf.h index 6c4e6063e6..0676e2f42a 100644 --- a/src/gallium/drivers/llvmpipe/lp_prim_vbuf.h +++ b/src/gallium/drivers/llvmpipe/lp_prim_vbuf.h @@ -31,8 +31,8 @@ struct llvmpipe_context; -extern void -lp_init_vbuf(struct llvmpipe_context *llvmpipe); +extern struct vbuf_render * +lp_create_vbuf_backend(struct llvmpipe_context *llvmpipe); #endif /* LP_VBUF_H */ diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 11ebfa0236..ffcbc9a379 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -33,7 +33,6 @@ */ #include "lp_context.h" -#include "lp_prim_setup.h" #include "lp_quad.h" #include "lp_setup.h" #include "lp_state.h" diff --git a/src/gallium/drivers/llvmpipe/lp_state_derived.c b/src/gallium/drivers/llvmpipe/lp_state_derived.c index 30fb41ea65..31eaadda21 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_derived.c +++ b/src/gallium/drivers/llvmpipe/lp_state_derived.c @@ -67,24 +67,19 @@ llvmpipe_get_vertex_info(struct llvmpipe_context *llvmpipe) const struct lp_fragment_shader *lpfs = llvmpipe->fs; const enum interp_mode colorInterp = llvmpipe->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR; + struct vertex_info *vinfo_vbuf = &llvmpipe->vertex_info_vbuf; + const uint num = draw_num_vs_outputs(llvmpipe->draw); uint i; - if (llvmpipe->vbuf) { - /* if using the post-transform vertex buffer, tell draw_vbuf to - * simply emit the whole post-xform vertex as-is: - */ - struct vertex_info *vinfo_vbuf = &llvmpipe->vertex_info_vbuf; - const uint num = draw_num_vs_outputs(llvmpipe->draw); - uint i; - - /* No longer any need to try and emit draw vertex_header info. - */ - vinfo_vbuf->num_attribs = 0; - for (i = 0; i < num; i++) { - draw_emit_vertex_attr(vinfo_vbuf, EMIT_4F, INTERP_PERSPECTIVE, i); - } - draw_compute_vertex_size(vinfo_vbuf); + /* Tell draw_vbuf to simply emit the whole post-xform vertex + * as-is. No longer any need to try and emit draw vertex_header + * info. + */ + vinfo_vbuf->num_attribs = 0; + for (i = 0; i < num; i++) { + draw_emit_vertex_attr(vinfo_vbuf, EMIT_4F, INTERP_PERSPECTIVE, i); } + draw_compute_vertex_size(vinfo_vbuf); /* * Loop over fragment shader inputs, searching for the matching output -- cgit v1.2.3 From ceb6728725a1eefe35a4d8371b2ff0abe212b5ad Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 30 Oct 2009 08:27:17 +0000 Subject: llvmpipe: Sanitise shader semantic and interpolator handling. Handle the remaining semantic names and indices. Respect color interpolator when not flatshading. Based on Michal's softpipe commit eb699d64ec7057032139baccedcb0694ca41d706. --- src/gallium/drivers/llvmpipe/lp_state_derived.c | 34 ++++++++----------------- 1 file changed, 10 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_state_derived.c b/src/gallium/drivers/llvmpipe/lp_state_derived.c index 31eaadda21..c753b183c0 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_derived.c +++ b/src/gallium/drivers/llvmpipe/lp_state_derived.c @@ -65,8 +65,6 @@ llvmpipe_get_vertex_info(struct llvmpipe_context *llvmpipe) if (vinfo->num_attribs == 0) { /* compute vertex layout now */ const struct lp_fragment_shader *lpfs = llvmpipe->fs; - const enum interp_mode colorInterp - = llvmpipe->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR; struct vertex_info *vinfo_vbuf = &llvmpipe->vertex_info_vbuf; const uint num = draw_num_vs_outputs(llvmpipe->draw); uint i; @@ -107,33 +105,21 @@ llvmpipe_get_vertex_info(struct llvmpipe_context *llvmpipe) switch (lpfs->info.input_semantic_name[i]) { case TGSI_SEMANTIC_POSITION: - src = draw_find_vs_output(llvmpipe->draw, - TGSI_SEMANTIC_POSITION, 0); - draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_POS, src); + interp = INTERP_POS; break; case TGSI_SEMANTIC_COLOR: - src = draw_find_vs_output(llvmpipe->draw, TGSI_SEMANTIC_COLOR, - lpfs->info.input_semantic_index[i]); - draw_emit_vertex_attr(vinfo, EMIT_4F, colorInterp, src); + if (llvmpipe->rasterizer->flatshade) { + interp = INTERP_CONSTANT; + } break; - - case TGSI_SEMANTIC_FOG: - src = draw_find_vs_output(llvmpipe->draw, TGSI_SEMANTIC_FOG, 0); - draw_emit_vertex_attr(vinfo, EMIT_4F, interp, src); - break; - - case TGSI_SEMANTIC_GENERIC: - case TGSI_SEMANTIC_FACE: - /* this includes texcoords and varying vars */ - src = draw_find_vs_output(llvmpipe->draw, TGSI_SEMANTIC_GENERIC, - lpfs->info.input_semantic_index[i]); - draw_emit_vertex_attr(vinfo, EMIT_4F, interp, src); - break; - - default: - assert(0); } + + /* this includes texcoords and varying vars */ + src = draw_find_vs_output(llvmpipe->draw, + lpfs->info.input_semantic_name[i], + lpfs->info.input_semantic_index[i]); + draw_emit_vertex_attr(vinfo, EMIT_4F, interp, src); } llvmpipe->psize_slot = draw_find_vs_output(llvmpipe->draw, -- cgit v1.2.3 From e713a95c96e4af9d3b97ab8383fff3ccf98b012d Mon Sep 17 00:00:00 2001 From: Karl Schultz Date: Tue, 3 Nov 2009 16:05:12 -0700 Subject: mesa: added GLAPIENTRY keywords for sync object functions Signed-off-by: Brian Paul --- src/mesa/main/syncobj.c | 12 ++++++------ src/mesa/main/syncobj.h | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c index 64f923ff91..ac3f9eb175 100644 --- a/src/mesa/main/syncobj.c +++ b/src/mesa/main/syncobj.c @@ -190,7 +190,7 @@ _mesa_unref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj) } -GLboolean +GLboolean GLAPIENTRY _mesa_IsSync(GLsync sync) { GET_CURRENT_CONTEXT(ctx); @@ -201,7 +201,7 @@ _mesa_IsSync(GLsync sync) } -void +void GLAPIENTRY _mesa_DeleteSync(GLsync sync) { GET_CURRENT_CONTEXT(ctx); @@ -231,7 +231,7 @@ _mesa_DeleteSync(GLsync sync) } -GLsync +GLsync GLAPIENTRY _mesa_FenceSync(GLenum condition, GLbitfield flags) { GET_CURRENT_CONTEXT(ctx); @@ -278,7 +278,7 @@ _mesa_FenceSync(GLenum condition, GLbitfield flags) } -GLenum +GLenum GLAPIENTRY _mesa_ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) { GET_CURRENT_CONTEXT(ctx); @@ -319,7 +319,7 @@ _mesa_ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) } -void +void GLAPIENTRY _mesa_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) { GET_CURRENT_CONTEXT(ctx); @@ -348,7 +348,7 @@ _mesa_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) } -void +void GLAPIENTRY _mesa_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values) { diff --git a/src/mesa/main/syncobj.h b/src/mesa/main/syncobj.h index fc160af289..f23fa281e2 100644 --- a/src/mesa/main/syncobj.h +++ b/src/mesa/main/syncobj.h @@ -48,22 +48,22 @@ _mesa_ref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj); extern void _mesa_unref_sync_object(GLcontext *ctx, struct gl_sync_object *syncObj); -extern GLboolean +extern GLboolean GLAPIENTRY _mesa_IsSync(GLsync sync); -extern void +extern void GLAPIENTRY _mesa_DeleteSync(GLsync sync); -extern GLsync +extern GLsync GLAPIENTRY _mesa_FenceSync(GLenum condition, GLbitfield flags); -extern GLenum +extern GLenum GLAPIENTRY _mesa_ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout); -extern void +extern void GLAPIENTRY _mesa_WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout); -extern void +extern void GLAPIENTRY _mesa_GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -- cgit v1.2.3 From 077eb0d81ca88a8f2b9182b3a274b11a81bab974 Mon Sep 17 00:00:00 2001 From: Karl Schultz Date: Tue, 3 Nov 2009 16:07:01 -0700 Subject: windows: remove old entrypoints from mesa.def file Signed-off-by: Brian Paul --- src/mesa/drivers/windows/gdi/mesa.def | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/windows/gdi/mesa.def b/src/mesa/drivers/windows/gdi/mesa.def index bd3e5b2137..05817fde16 100644 --- a/src/mesa/drivers/windows/gdi/mesa.def +++ b/src/mesa/drivers/windows/gdi/mesa.def @@ -867,12 +867,6 @@ EXPORTS _glapi_get_proc_address _mesa_add_soft_renderbuffers _mesa_add_renderbuffer - _mesa_begin_query - _mesa_buffer_data - _mesa_buffer_get_subdata - _mesa_buffer_map - _mesa_buffer_subdata - _mesa_buffer_unmap _mesa_bzero _mesa_calloc _mesa_choose_tex_format @@ -880,9 +874,7 @@ EXPORTS _mesa_create_framebuffer _mesa_create_visual _mesa_delete_array_object - _mesa_delete_buffer_object _mesa_delete_program - _mesa_delete_query _mesa_delete_texture_object _mesa_destroy_framebuffer _mesa_destroy_visual @@ -892,7 +884,6 @@ EXPORTS _mesa_enable_2_0_extensions _mesa_enable_2_1_extensions _mesa_enable_sw_extensions - _mesa_end_query _mesa_error _mesa_finish_render_texture _mesa_framebuffer_renderbuffer @@ -911,10 +902,8 @@ EXPORTS _mesa_memcpy _mesa_memset _mesa_new_array_object - _mesa_new_buffer_object _mesa_new_framebuffer _mesa_new_program - _mesa_new_query_object _mesa_new_renderbuffer _mesa_new_soft_renderbuffer _mesa_new_texture_image @@ -943,7 +932,6 @@ EXPORTS _mesa_update_framebuffer_visual _mesa_use_program _mesa_Viewport - _mesa_wait_query _swrast_Accum _swrast_Bitmap _swrast_BlitFramebuffer -- cgit v1.2.3 From 6eb71519f7d08344b7f9819db22980f9c6fade3c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 3 Nov 2009 16:13:22 -0700 Subject: mesa: (GLint64) casts in get.c to silence Visual Studio warnings Revised version of a patch from Karl Schultz. --- src/mesa/main/get.c | 344 +++++++++++++++++++++++------------------------ src/mesa/main/get_gen.py | 2 +- 2 files changed, 173 insertions(+), 173 deletions(-) (limited to 'src') diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 477ed01030..604b106217 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -5580,16 +5580,16 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) switch (pname) { case GL_ACCUM_RED_BITS: - params[0] = ctx->DrawBuffer->Visual.accumRedBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.accumRedBits); break; case GL_ACCUM_GREEN_BITS: - params[0] = ctx->DrawBuffer->Visual.accumGreenBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.accumGreenBits); break; case GL_ACCUM_BLUE_BITS: - params[0] = ctx->DrawBuffer->Visual.accumBlueBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.accumBlueBits); break; case GL_ACCUM_ALPHA_BITS: - params[0] = ctx->DrawBuffer->Visual.accumAlphaBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.accumAlphaBits); break; case GL_ACCUM_CLEAR_VALUE: params[0] = FLOAT_TO_INT64(ctx->Accum.ClearColor[0]); @@ -5601,7 +5601,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = IROUND64(ctx->Pixel.AlphaBias); break; case GL_ALPHA_BITS: - params[0] = ctx->DrawBuffer->Visual.alphaBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.alphaBits); break; case GL_ALPHA_SCALE: params[0] = IROUND64(ctx->Pixel.AlphaScale); @@ -5616,13 +5616,13 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = FLOAT_TO_INT64(ctx->Color.AlphaRef); break; case GL_ATTRIB_STACK_DEPTH: - params[0] = ctx->AttribStackDepth; + params[0] = (GLint64)(ctx->AttribStackDepth); break; case GL_AUTO_NORMAL: params[0] = BOOLEAN_TO_INT64(ctx->Eval.AutoNormal); break; case GL_AUX_BUFFERS: - params[0] = ctx->DrawBuffer->Visual.numAuxBuffers; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.numAuxBuffers); break; case GL_BLEND: params[0] = BOOLEAN_TO_INT64(ctx->Color.BlendEnabled); @@ -5661,13 +5661,13 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = IROUND64(ctx->Pixel.BlueBias); break; case GL_BLUE_BITS: - params[0] = ctx->DrawBuffer->Visual.blueBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.blueBits); break; case GL_BLUE_SCALE: params[0] = IROUND64(ctx->Pixel.BlueScale); break; case GL_CLIENT_ATTRIB_STACK_DEPTH: - params[0] = ctx->ClientAttribStackDepth; + params[0] = (GLint64)(ctx->ClientAttribStackDepth); break; case GL_CLIP_PLANE0: params[0] = BOOLEAN_TO_INT64((ctx->Transform.ClipPlanesEnabled >> 0) & 1); @@ -5703,10 +5703,10 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = ENUM_TO_INT64(ctx->Light.ColorMaterialMode); break; case GL_COLOR_WRITEMASK: - params[0] = ctx->Color.ColorMask[RCOMP] ? 1 : 0; - params[1] = ctx->Color.ColorMask[GCOMP] ? 1 : 0; - params[2] = ctx->Color.ColorMask[BCOMP] ? 1 : 0; - params[3] = ctx->Color.ColorMask[ACOMP] ? 1 : 0; + params[0] = (GLint64)(ctx->Color.ColorMask[RCOMP] ? 1 : 0); + params[1] = (GLint64)(ctx->Color.ColorMask[GCOMP] ? 1 : 0); + params[2] = (GLint64)(ctx->Color.ColorMask[BCOMP] ? 1 : 0); + params[3] = (GLint64)(ctx->Color.ColorMask[ACOMP] ? 1 : 0); break; case GL_CULL_FACE: params[0] = BOOLEAN_TO_INT64(ctx->Polygon.CullFlag); @@ -5787,7 +5787,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = IROUND64(ctx->Pixel.DepthBias); break; case GL_DEPTH_BITS: - params[0] = ctx->DrawBuffer->Visual.depthBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.depthBits); break; case GL_DEPTH_CLEAR_VALUE: params[0] = FLOAT_TO_INT64(((GLfloat) ctx->Depth.Clear)); @@ -5824,7 +5824,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) } break; case GL_FEEDBACK_BUFFER_SIZE: - params[0] = ctx->Feedback.BufferSize; + params[0] = (GLint64)(ctx->Feedback.BufferSize); break; case GL_FEEDBACK_BUFFER_TYPE: params[0] = ENUM_TO_INT64(ctx->Feedback.Type); @@ -5863,28 +5863,28 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = IROUND64(ctx->Pixel.GreenBias); break; case GL_GREEN_BITS: - params[0] = ctx->DrawBuffer->Visual.greenBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.greenBits); break; case GL_GREEN_SCALE: params[0] = IROUND64(ctx->Pixel.GreenScale); break; case GL_INDEX_BITS: - params[0] = ctx->DrawBuffer->Visual.indexBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.indexBits); break; case GL_INDEX_CLEAR_VALUE: - params[0] = ctx->Color.ClearIndex; + params[0] = (GLint64)(ctx->Color.ClearIndex); break; case GL_INDEX_MODE: params[0] = BOOLEAN_TO_INT64(!ctx->DrawBuffer->Visual.rgbMode); break; case GL_INDEX_OFFSET: - params[0] = ctx->Pixel.IndexOffset; + params[0] = (GLint64)(ctx->Pixel.IndexOffset); break; case GL_INDEX_SHIFT: - params[0] = ctx->Pixel.IndexShift; + params[0] = (GLint64)(ctx->Pixel.IndexShift); break; case GL_INDEX_WRITEMASK: - params[0] = ctx->Color.IndexMask; + params[0] = (GLint64)(ctx->Color.IndexMask); break; case GL_LIGHT0: params[0] = BOOLEAN_TO_INT64(ctx->Light.Light[0].Enabled); @@ -5938,10 +5938,10 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = BOOLEAN_TO_INT64(ctx->Line.StippleFlag); break; case GL_LINE_STIPPLE_PATTERN: - params[0] = ctx->Line.StipplePattern; + params[0] = (GLint64)(ctx->Line.StipplePattern); break; case GL_LINE_STIPPLE_REPEAT: - params[0] = ctx->Line.StippleFactor; + params[0] = (GLint64)(ctx->Line.StippleFactor); break; case GL_LINE_WIDTH: params[0] = IROUND64(ctx->Line.Width); @@ -5958,10 +5958,10 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[1] = IROUND64(ctx->Const.MaxLineWidth); break; case GL_LIST_BASE: - params[0] = ctx->List.ListBase; + params[0] = (GLint64)(ctx->List.ListBase); break; case GL_LIST_INDEX: - params[0] = (ctx->ListState.CurrentList ? ctx->ListState.CurrentList->Name : 0); + params[0] = (GLint64)((ctx->ListState.CurrentList ? ctx->ListState.CurrentList->Name : 0)); break; case GL_LIST_MODE: { @@ -5992,7 +5992,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[1] = IROUND64(ctx->Eval.MapGrid1u2); break; case GL_MAP1_GRID_SEGMENTS: - params[0] = ctx->Eval.MapGrid1un; + params[0] = (GLint64)(ctx->Eval.MapGrid1un); break; case GL_MAP1_INDEX: params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map1Index); @@ -6028,8 +6028,8 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[3] = IROUND64(ctx->Eval.MapGrid2v2); break; case GL_MAP2_GRID_SEGMENTS: - params[0] = ctx->Eval.MapGrid2un; - params[1] = ctx->Eval.MapGrid2vn; + params[0] = (GLint64)(ctx->Eval.MapGrid2un); + params[1] = (GLint64)(ctx->Eval.MapGrid2vn); break; case GL_MAP2_INDEX: params[0] = BOOLEAN_TO_INT64(ctx->Eval.Map2Index); @@ -6065,53 +6065,53 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = ENUM_TO_INT64(ctx->Transform.MatrixMode); break; case GL_MAX_ATTRIB_STACK_DEPTH: - params[0] = MAX_ATTRIB_STACK_DEPTH; + params[0] = (GLint64)(MAX_ATTRIB_STACK_DEPTH); break; case GL_MAX_CLIENT_ATTRIB_STACK_DEPTH: - params[0] = MAX_CLIENT_ATTRIB_STACK_DEPTH; + params[0] = (GLint64)(MAX_CLIENT_ATTRIB_STACK_DEPTH); break; case GL_MAX_CLIP_PLANES: - params[0] = ctx->Const.MaxClipPlanes; + params[0] = (GLint64)(ctx->Const.MaxClipPlanes); break; case GL_MAX_ELEMENTS_VERTICES: - params[0] = ctx->Const.MaxArrayLockSize; + params[0] = (GLint64)(ctx->Const.MaxArrayLockSize); break; case GL_MAX_ELEMENTS_INDICES: - params[0] = ctx->Const.MaxArrayLockSize; + params[0] = (GLint64)(ctx->Const.MaxArrayLockSize); break; case GL_MAX_EVAL_ORDER: - params[0] = MAX_EVAL_ORDER; + params[0] = (GLint64)(MAX_EVAL_ORDER); break; case GL_MAX_LIGHTS: - params[0] = ctx->Const.MaxLights; + params[0] = (GLint64)(ctx->Const.MaxLights); break; case GL_MAX_LIST_NESTING: - params[0] = MAX_LIST_NESTING; + params[0] = (GLint64)(MAX_LIST_NESTING); break; case GL_MAX_MODELVIEW_STACK_DEPTH: - params[0] = MAX_MODELVIEW_STACK_DEPTH; + params[0] = (GLint64)(MAX_MODELVIEW_STACK_DEPTH); break; case GL_MAX_NAME_STACK_DEPTH: - params[0] = MAX_NAME_STACK_DEPTH; + params[0] = (GLint64)(MAX_NAME_STACK_DEPTH); break; case GL_MAX_PIXEL_MAP_TABLE: - params[0] = MAX_PIXEL_MAP_TABLE; + params[0] = (GLint64)(MAX_PIXEL_MAP_TABLE); break; case GL_MAX_PROJECTION_STACK_DEPTH: - params[0] = MAX_PROJECTION_STACK_DEPTH; + params[0] = (GLint64)(MAX_PROJECTION_STACK_DEPTH); break; case GL_MAX_TEXTURE_SIZE: - params[0] = 1 << (ctx->Const.MaxTextureLevels - 1); + params[0] = (GLint64)(1 << (ctx->Const.MaxTextureLevels - 1)); break; case GL_MAX_3D_TEXTURE_SIZE: - params[0] = 1 << (ctx->Const.Max3DTextureLevels - 1); + params[0] = (GLint64)(1 << (ctx->Const.Max3DTextureLevels - 1)); break; case GL_MAX_TEXTURE_STACK_DEPTH: - params[0] = MAX_TEXTURE_STACK_DEPTH; + params[0] = (GLint64)(MAX_TEXTURE_STACK_DEPTH); break; case GL_MAX_VIEWPORT_DIMS: - params[0] = ctx->Const.MaxViewportWidth; - params[1] = ctx->Const.MaxViewportHeight; + params[0] = (GLint64)(ctx->Const.MaxViewportWidth); + params[1] = (GLint64)(ctx->Const.MaxViewportHeight); break; case GL_MODELVIEW_MATRIX: { @@ -6135,37 +6135,37 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) } break; case GL_MODELVIEW_STACK_DEPTH: - params[0] = ctx->ModelviewMatrixStack.Depth + 1; + params[0] = (GLint64)(ctx->ModelviewMatrixStack.Depth + 1); break; case GL_NAME_STACK_DEPTH: - params[0] = ctx->Select.NameStackDepth; + params[0] = (GLint64)(ctx->Select.NameStackDepth); break; case GL_NORMALIZE: params[0] = BOOLEAN_TO_INT64(ctx->Transform.Normalize); break; case GL_PACK_ALIGNMENT: - params[0] = ctx->Pack.Alignment; + params[0] = (GLint64)(ctx->Pack.Alignment); break; case GL_PACK_LSB_FIRST: params[0] = BOOLEAN_TO_INT64(ctx->Pack.LsbFirst); break; case GL_PACK_ROW_LENGTH: - params[0] = ctx->Pack.RowLength; + params[0] = (GLint64)(ctx->Pack.RowLength); break; case GL_PACK_SKIP_PIXELS: - params[0] = ctx->Pack.SkipPixels; + params[0] = (GLint64)(ctx->Pack.SkipPixels); break; case GL_PACK_SKIP_ROWS: - params[0] = ctx->Pack.SkipRows; + params[0] = (GLint64)(ctx->Pack.SkipRows); break; case GL_PACK_SWAP_BYTES: params[0] = BOOLEAN_TO_INT64(ctx->Pack.SwapBytes); break; case GL_PACK_SKIP_IMAGES_EXT: - params[0] = ctx->Pack.SkipImages; + params[0] = (GLint64)(ctx->Pack.SkipImages); break; case GL_PACK_IMAGE_HEIGHT_EXT: - params[0] = ctx->Pack.ImageHeight; + params[0] = (GLint64)(ctx->Pack.ImageHeight); break; case GL_PACK_INVERT_MESA: params[0] = BOOLEAN_TO_INT64(ctx->Pack.Invert); @@ -6174,34 +6174,34 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = ENUM_TO_INT64(ctx->Hint.PerspectiveCorrection); break; case GL_PIXEL_MAP_A_TO_A_SIZE: - params[0] = ctx->PixelMaps.AtoA.Size; + params[0] = (GLint64)(ctx->PixelMaps.AtoA.Size); break; case GL_PIXEL_MAP_B_TO_B_SIZE: - params[0] = ctx->PixelMaps.BtoB.Size; + params[0] = (GLint64)(ctx->PixelMaps.BtoB.Size); break; case GL_PIXEL_MAP_G_TO_G_SIZE: - params[0] = ctx->PixelMaps.GtoG.Size; + params[0] = (GLint64)(ctx->PixelMaps.GtoG.Size); break; case GL_PIXEL_MAP_I_TO_A_SIZE: - params[0] = ctx->PixelMaps.ItoA.Size; + params[0] = (GLint64)(ctx->PixelMaps.ItoA.Size); break; case GL_PIXEL_MAP_I_TO_B_SIZE: - params[0] = ctx->PixelMaps.ItoB.Size; + params[0] = (GLint64)(ctx->PixelMaps.ItoB.Size); break; case GL_PIXEL_MAP_I_TO_G_SIZE: - params[0] = ctx->PixelMaps.ItoG.Size; + params[0] = (GLint64)(ctx->PixelMaps.ItoG.Size); break; case GL_PIXEL_MAP_I_TO_I_SIZE: - params[0] = ctx->PixelMaps.ItoI.Size; + params[0] = (GLint64)(ctx->PixelMaps.ItoI.Size); break; case GL_PIXEL_MAP_I_TO_R_SIZE: - params[0] = ctx->PixelMaps.ItoR.Size; + params[0] = (GLint64)(ctx->PixelMaps.ItoR.Size); break; case GL_PIXEL_MAP_R_TO_R_SIZE: - params[0] = ctx->PixelMaps.RtoR.Size; + params[0] = (GLint64)(ctx->PixelMaps.RtoR.Size); break; case GL_PIXEL_MAP_S_TO_S_SIZE: - params[0] = ctx->PixelMaps.StoS.Size; + params[0] = (GLint64)(ctx->PixelMaps.StoS.Size); break; case GL_POINT_SIZE: params[0] = IROUND64(ctx->Point.Size); @@ -6290,7 +6290,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) } break; case GL_PROJECTION_STACK_DEPTH: - params[0] = ctx->ProjectionMatrixStack.Depth + 1; + params[0] = (GLint64)(ctx->ProjectionMatrixStack.Depth + 1); break; case GL_READ_BUFFER: params[0] = ENUM_TO_INT64(ctx->ReadBuffer->ColorReadBuffer); @@ -6299,7 +6299,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = IROUND64(ctx->Pixel.RedBias); break; case GL_RED_BITS: - params[0] = ctx->DrawBuffer->Visual.redBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.redBits); break; case GL_RED_SCALE: params[0] = IROUND64(ctx->Pixel.RedScale); @@ -6314,16 +6314,16 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = BOOLEAN_TO_INT64(ctx->DrawBuffer->Visual.rgbMode); break; case GL_SCISSOR_BOX: - params[0] = ctx->Scissor.X; - params[1] = ctx->Scissor.Y; - params[2] = ctx->Scissor.Width; - params[3] = ctx->Scissor.Height; + params[0] = (GLint64)(ctx->Scissor.X); + params[1] = (GLint64)(ctx->Scissor.Y); + params[2] = (GLint64)(ctx->Scissor.Width); + params[3] = (GLint64)(ctx->Scissor.Height); break; case GL_SCISSOR_TEST: params[0] = BOOLEAN_TO_INT64(ctx->Scissor.Enabled); break; case GL_SELECTION_BUFFER_SIZE: - params[0] = ctx->Select.BufferSize; + params[0] = (GLint64)(ctx->Select.BufferSize); break; case GL_SHADE_MODEL: params[0] = ENUM_TO_INT64(ctx->Light.ShadeModel); @@ -6332,10 +6332,10 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = BOOLEAN_TO_INT64(ctx->Texture.SharedPalette); break; case GL_STENCIL_BITS: - params[0] = ctx->DrawBuffer->Visual.stencilBits; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.stencilBits); break; case GL_STENCIL_CLEAR_VALUE: - params[0] = ctx->Stencil.Clear; + params[0] = (GLint64)(ctx->Stencil.Clear); break; case GL_STENCIL_FAIL: params[0] = ENUM_TO_INT64(ctx->Stencil.FailFunc[ctx->Stencil.ActiveFace]); @@ -6350,22 +6350,22 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = ENUM_TO_INT64(ctx->Stencil.ZPassFunc[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_REF: - params[0] = ctx->Stencil.Ref[ctx->Stencil.ActiveFace]; + params[0] = (GLint64)(ctx->Stencil.Ref[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_TEST: params[0] = BOOLEAN_TO_INT64(ctx->Stencil.Enabled); break; case GL_STENCIL_VALUE_MASK: - params[0] = ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]; + params[0] = (GLint64)(ctx->Stencil.ValueMask[ctx->Stencil.ActiveFace]); break; case GL_STENCIL_WRITEMASK: - params[0] = ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]; + params[0] = (GLint64)(ctx->Stencil.WriteMask[ctx->Stencil.ActiveFace]); break; case GL_STEREO: params[0] = BOOLEAN_TO_INT64(ctx->DrawBuffer->Visual.stereoMode); break; case GL_SUBPIXEL_BITS: - params[0] = ctx->Const.SubPixelBits; + params[0] = (GLint64)(ctx->Const.SubPixelBits); break; case GL_TEXTURE_1D: params[0] = BOOLEAN_TO_INT64(_mesa_IsEnabled(GL_TEXTURE_1D)); @@ -6385,21 +6385,21 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = BOOLEAN_TO_INT64(_mesa_IsEnabled(GL_TEXTURE_2D_ARRAY_EXT)); break; case GL_TEXTURE_BINDING_1D: - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name; + params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_INDEX]->Name); break; case GL_TEXTURE_BINDING_2D: - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name; + params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_INDEX]->Name); break; case GL_TEXTURE_BINDING_3D: - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name; + params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_3D_INDEX]->Name); break; case GL_TEXTURE_BINDING_1D_ARRAY_EXT: CHECK_EXT1(MESA_texture_array, "GetInteger64v"); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name; + params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_1D_ARRAY_INDEX]->Name); break; case GL_TEXTURE_BINDING_2D_ARRAY_EXT: CHECK_EXT1(MESA_texture_array, "GetInteger64v"); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name; + params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_2D_ARRAY_INDEX]->Name); break; case GL_TEXTURE_GEN_S: params[0] = BOOLEAN_TO_INT64(((ctx->Texture.Unit[ctx->Texture.CurrentUnit].TexGenEnabled & S_BIT) ? 1 : 0)); @@ -6435,40 +6435,40 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) } break; case GL_TEXTURE_STACK_DEPTH: - params[0] = ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1; + params[0] = (GLint64)(ctx->TextureMatrixStack[ctx->Texture.CurrentUnit].Depth + 1); break; case GL_UNPACK_ALIGNMENT: - params[0] = ctx->Unpack.Alignment; + params[0] = (GLint64)(ctx->Unpack.Alignment); break; case GL_UNPACK_LSB_FIRST: params[0] = BOOLEAN_TO_INT64(ctx->Unpack.LsbFirst); break; case GL_UNPACK_ROW_LENGTH: - params[0] = ctx->Unpack.RowLength; + params[0] = (GLint64)(ctx->Unpack.RowLength); break; case GL_UNPACK_SKIP_PIXELS: - params[0] = ctx->Unpack.SkipPixels; + params[0] = (GLint64)(ctx->Unpack.SkipPixels); break; case GL_UNPACK_SKIP_ROWS: - params[0] = ctx->Unpack.SkipRows; + params[0] = (GLint64)(ctx->Unpack.SkipRows); break; case GL_UNPACK_SWAP_BYTES: params[0] = BOOLEAN_TO_INT64(ctx->Unpack.SwapBytes); break; case GL_UNPACK_SKIP_IMAGES_EXT: - params[0] = ctx->Unpack.SkipImages; + params[0] = (GLint64)(ctx->Unpack.SkipImages); break; case GL_UNPACK_IMAGE_HEIGHT_EXT: - params[0] = ctx->Unpack.ImageHeight; + params[0] = (GLint64)(ctx->Unpack.ImageHeight); break; case GL_UNPACK_CLIENT_STORAGE_APPLE: params[0] = BOOLEAN_TO_INT64(ctx->Unpack.ClientStorage); break; case GL_VIEWPORT: - params[0] = ctx->Viewport.X; - params[1] = ctx->Viewport.Y; - params[2] = ctx->Viewport.Width; - params[3] = ctx->Viewport.Height; + params[0] = (GLint64)(ctx->Viewport.X); + params[1] = (GLint64)(ctx->Viewport.Y); + params[2] = (GLint64)(ctx->Viewport.Width); + params[3] = (GLint64)(ctx->Viewport.Height); break; case GL_ZOOM_X: params[0] = IROUND64(ctx->Pixel.ZoomX); @@ -6480,16 +6480,16 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->Vertex.Enabled); break; case GL_VERTEX_ARRAY_SIZE: - params[0] = ctx->Array.ArrayObj->Vertex.Size; + params[0] = (GLint64)(ctx->Array.ArrayObj->Vertex.Size); break; case GL_VERTEX_ARRAY_TYPE: params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->Vertex.Type); break; case GL_VERTEX_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->Vertex.Stride; + params[0] = (GLint64)(ctx->Array.ArrayObj->Vertex.Stride); break; case GL_VERTEX_ARRAY_COUNT_EXT: - params[0] = 0; + params[0] = (GLint64)(0); break; case GL_NORMAL_ARRAY: params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->Normal.Enabled); @@ -6498,25 +6498,25 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->Normal.Type); break; case GL_NORMAL_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->Normal.Stride; + params[0] = (GLint64)(ctx->Array.ArrayObj->Normal.Stride); break; case GL_NORMAL_ARRAY_COUNT_EXT: - params[0] = 0; + params[0] = (GLint64)(0); break; case GL_COLOR_ARRAY: params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->Color.Enabled); break; case GL_COLOR_ARRAY_SIZE: - params[0] = ctx->Array.ArrayObj->Color.Size; + params[0] = (GLint64)(ctx->Array.ArrayObj->Color.Size); break; case GL_COLOR_ARRAY_TYPE: params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->Color.Type); break; case GL_COLOR_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->Color.Stride; + params[0] = (GLint64)(ctx->Array.ArrayObj->Color.Stride); break; case GL_COLOR_ARRAY_COUNT_EXT: - params[0] = 0; + params[0] = (GLint64)(0); break; case GL_INDEX_ARRAY: params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->Index.Enabled); @@ -6525,46 +6525,46 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->Index.Type); break; case GL_INDEX_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->Index.Stride; + params[0] = (GLint64)(ctx->Array.ArrayObj->Index.Stride); break; case GL_INDEX_ARRAY_COUNT_EXT: - params[0] = 0; + params[0] = (GLint64)(0); break; case GL_TEXTURE_COORD_ARRAY: params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Enabled); break; case GL_TEXTURE_COORD_ARRAY_SIZE: - params[0] = ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Size; + params[0] = (GLint64)(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Size); break; case GL_TEXTURE_COORD_ARRAY_TYPE: params[0] = ENUM_TO_INT64(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Type); break; case GL_TEXTURE_COORD_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Stride; + params[0] = (GLint64)(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].Stride); break; case GL_TEXTURE_COORD_ARRAY_COUNT_EXT: - params[0] = 0; + params[0] = (GLint64)(0); break; case GL_EDGE_FLAG_ARRAY: params[0] = BOOLEAN_TO_INT64(ctx->Array.ArrayObj->EdgeFlag.Enabled); break; case GL_EDGE_FLAG_ARRAY_STRIDE: - params[0] = ctx->Array.ArrayObj->EdgeFlag.Stride; + params[0] = (GLint64)(ctx->Array.ArrayObj->EdgeFlag.Stride); break; case GL_EDGE_FLAG_ARRAY_COUNT_EXT: - params[0] = 0; + params[0] = (GLint64)(0); break; case GL_MAX_TEXTURE_UNITS_ARB: CHECK_EXT1(ARB_multitexture, "GetInteger64v"); - params[0] = ctx->Const.MaxTextureUnits; + params[0] = (GLint64)(ctx->Const.MaxTextureUnits); break; case GL_ACTIVE_TEXTURE_ARB: CHECK_EXT1(ARB_multitexture, "GetInteger64v"); - params[0] = GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit; + params[0] = (GLint64)(GL_TEXTURE0_ARB + ctx->Texture.CurrentUnit); break; case GL_CLIENT_ACTIVE_TEXTURE_ARB: CHECK_EXT1(ARB_multitexture, "GetInteger64v"); - params[0] = GL_TEXTURE0_ARB + ctx->Array.ActiveTexture; + params[0] = (GLint64)(GL_TEXTURE0_ARB + ctx->Array.ActiveTexture); break; case GL_TEXTURE_CUBE_MAP_ARB: CHECK_EXT1(ARB_texture_cube_map, "GetInteger64v"); @@ -6572,17 +6572,17 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_TEXTURE_BINDING_CUBE_MAP_ARB: CHECK_EXT1(ARB_texture_cube_map, "GetInteger64v"); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name; + params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_CUBE_INDEX]->Name); break; case GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB: CHECK_EXT1(ARB_texture_cube_map, "GetInteger64v"); - params[0] = (1 << (ctx->Const.MaxCubeTextureLevels - 1)); + params[0] = (GLint64)((1 << (ctx->Const.MaxCubeTextureLevels - 1))); break; case GL_TEXTURE_COMPRESSION_HINT_ARB: - params[0] = ctx->Hint.TextureCompression; + params[0] = (GLint64)(ctx->Hint.TextureCompression); break; case GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB: - params[0] = _mesa_get_compressed_formats(ctx, NULL, GL_FALSE); + params[0] = (GLint64)(_mesa_get_compressed_formats(ctx, NULL, GL_FALSE)); break; case GL_COMPRESSED_TEXTURE_FORMATS_ARB: { @@ -6595,11 +6595,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_ARRAY_ELEMENT_LOCK_FIRST_EXT: CHECK_EXT1(EXT_compiled_vertex_array, "GetInteger64v"); - params[0] = ctx->Array.LockFirst; + params[0] = (GLint64)(ctx->Array.LockFirst); break; case GL_ARRAY_ELEMENT_LOCK_COUNT_EXT: CHECK_EXT1(EXT_compiled_vertex_array, "GetInteger64v"); - params[0] = ctx->Array.LockCount; + params[0] = (GLint64)(ctx->Array.LockCount); break; case GL_TRANSPOSE_COLOR_MATRIX_ARB: { @@ -6707,10 +6707,10 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) } break; case GL_COLOR_MATRIX_STACK_DEPTH_SGI: - params[0] = ctx->ColorMatrixStack.Depth + 1; + params[0] = (GLint64)(ctx->ColorMatrixStack.Depth + 1); break; case GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI: - params[0] = MAX_COLOR_STACK_DEPTH; + params[0] = (GLint64)(MAX_COLOR_STACK_DEPTH); break; case GL_POST_COLOR_MATRIX_RED_SCALE_SGI: params[0] = IROUND64(ctx->Pixel.PostColorMatrixScale[0]); @@ -6828,11 +6828,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT: CHECK_EXT1(EXT_secondary_color, "GetInteger64v"); - params[0] = ctx->Array.ArrayObj->SecondaryColor.Stride; + params[0] = (GLint64)(ctx->Array.ArrayObj->SecondaryColor.Stride); break; case GL_SECONDARY_COLOR_ARRAY_SIZE_EXT: CHECK_EXT1(EXT_secondary_color, "GetInteger64v"); - params[0] = ctx->Array.ArrayObj->SecondaryColor.Size; + params[0] = (GLint64)(ctx->Array.ArrayObj->SecondaryColor.Size); break; case GL_CURRENT_FOG_COORDINATE_EXT: CHECK_EXT1(EXT_fog_coord, "GetInteger64v"); @@ -6851,7 +6851,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_FOG_COORDINATE_ARRAY_STRIDE_EXT: CHECK_EXT1(EXT_fog_coord, "GetInteger64v"); - params[0] = ctx->Array.ArrayObj->FogCoord.Stride; + params[0] = (GLint64)(ctx->Array.ArrayObj->FogCoord.Stride); break; case GL_FOG_COORDINATE_SOURCE_EXT: CHECK_EXT1(EXT_fog_coord, "GetInteger64v"); @@ -6884,10 +6884,10 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = BOOLEAN_TO_INT64(ctx->Multisample.SampleCoverageInvert); break; case GL_SAMPLE_BUFFERS_ARB: - params[0] = ctx->DrawBuffer->Visual.sampleBuffers; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.sampleBuffers); break; case GL_SAMPLES_ARB: - params[0] = ctx->DrawBuffer->Visual.samples; + params[0] = (GLint64)(ctx->DrawBuffer->Visual.samples); break; case GL_RASTER_POSITION_UNCLIPPED_IBM: CHECK_EXT1(IBM_rasterpos_clip, "GetInteger64v"); @@ -6911,7 +6911,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_VERTEX_PROGRAM_BINDING_NV: CHECK_EXT1(NV_vertex_program, "GetInteger64v"); - params[0] = (ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0); + params[0] = (GLint64)((ctx->VertexProgram.Current ? ctx->VertexProgram.Current->Base.Id : 0)); break; case GL_VERTEX_ATTRIB_ARRAY0_NV: CHECK_EXT1(NV_vertex_program, "GetInteger64v"); @@ -7047,11 +7047,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_FRAGMENT_PROGRAM_BINDING_NV: CHECK_EXT1(NV_fragment_program, "GetInteger64v"); - params[0] = ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0; + params[0] = (GLint64)(ctx->FragmentProgram.Current ? ctx->FragmentProgram.Current->Base.Id : 0); break; case GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV: CHECK_EXT1(NV_fragment_program, "GetInteger64v"); - params[0] = MAX_NV_FRAGMENT_PROGRAM_PARAMS; + params[0] = (GLint64)(MAX_NV_FRAGMENT_PROGRAM_PARAMS); break; case GL_TEXTURE_RECTANGLE_NV: CHECK_EXT1(NV_texture_rectangle, "GetInteger64v"); @@ -7059,11 +7059,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_TEXTURE_BINDING_RECTANGLE_NV: CHECK_EXT1(NV_texture_rectangle, "GetInteger64v"); - params[0] = ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name; + params[0] = (GLint64)(ctx->Texture.Unit[ctx->Texture.CurrentUnit].CurrentTex[TEXTURE_RECT_INDEX]->Name); break; case GL_MAX_RECTANGLE_TEXTURE_SIZE_NV: CHECK_EXT1(NV_texture_rectangle, "GetInteger64v"); - params[0] = ctx->Const.MaxTextureRectSize; + params[0] = (GLint64)(ctx->Const.MaxTextureRectSize); break; case GL_STENCIL_TEST_TWO_SIDE_EXT: CHECK_EXT1(EXT_stencil_two_side, "GetInteger64v"); @@ -7082,42 +7082,42 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[0] = IROUND64(ctx->Const.MaxSpotExponent); break; case GL_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayBufferObj->Name; + params[0] = (GLint64)(ctx->Array.ArrayBufferObj->Name); break; case GL_VERTEX_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->Vertex.BufferObj->Name; + params[0] = (GLint64)(ctx->Array.ArrayObj->Vertex.BufferObj->Name); break; case GL_NORMAL_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->Normal.BufferObj->Name; + params[0] = (GLint64)(ctx->Array.ArrayObj->Normal.BufferObj->Name); break; case GL_COLOR_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->Color.BufferObj->Name; + params[0] = (GLint64)(ctx->Array.ArrayObj->Color.BufferObj->Name); break; case GL_INDEX_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->Index.BufferObj->Name; + params[0] = (GLint64)(ctx->Array.ArrayObj->Index.BufferObj->Name); break; case GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name; + params[0] = (GLint64)(ctx->Array.ArrayObj->TexCoord[ctx->Array.ActiveTexture].BufferObj->Name); break; case GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->EdgeFlag.BufferObj->Name; + params[0] = (GLint64)(ctx->Array.ArrayObj->EdgeFlag.BufferObj->Name); break; case GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->SecondaryColor.BufferObj->Name; + params[0] = (GLint64)(ctx->Array.ArrayObj->SecondaryColor.BufferObj->Name); break; case GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ArrayObj->FogCoord.BufferObj->Name; + params[0] = (GLint64)(ctx->Array.ArrayObj->FogCoord.BufferObj->Name); break; case GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB: - params[0] = ctx->Array.ElementArrayBufferObj->Name; + params[0] = (GLint64)(ctx->Array.ElementArrayBufferObj->Name); break; case GL_PIXEL_PACK_BUFFER_BINDING_EXT: CHECK_EXT1(EXT_pixel_buffer_object, "GetInteger64v"); - params[0] = ctx->Pack.BufferObj->Name; + params[0] = (GLint64)(ctx->Pack.BufferObj->Name); break; case GL_PIXEL_UNPACK_BUFFER_BINDING_EXT: CHECK_EXT1(EXT_pixel_buffer_object, "GetInteger64v"); - params[0] = ctx->Unpack.BufferObj->Name; + params[0] = (GLint64)(ctx->Unpack.BufferObj->Name); break; case GL_VERTEX_PROGRAM_ARB: CHECK_EXT2(ARB_vertex_program, NV_vertex_program, "GetInteger64v"); @@ -7133,11 +7133,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB: CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program, "GetInteger64v"); - params[0] = ctx->Const.MaxProgramMatrixStackDepth; + params[0] = (GLint64)(ctx->Const.MaxProgramMatrixStackDepth); break; case GL_MAX_PROGRAM_MATRICES_ARB: CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program, "GetInteger64v"); - params[0] = ctx->Const.MaxProgramMatrices; + params[0] = (GLint64)(ctx->Const.MaxProgramMatrices); break; case GL_CURRENT_MATRIX_STACK_DEPTH_ARB: CHECK_EXT3(ARB_vertex_program, ARB_fragment_program, NV_vertex_program, "GetInteger64v"); @@ -7189,11 +7189,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_MAX_VERTEX_ATTRIBS_ARB: CHECK_EXT1(ARB_vertex_program, "GetInteger64v"); - params[0] = ctx->Const.VertexProgram.MaxAttribs; + params[0] = (GLint64)(ctx->Const.VertexProgram.MaxAttribs); break; case GL_PROGRAM_ERROR_POSITION_ARB: CHECK_EXT4(NV_vertex_program, ARB_vertex_program, NV_fragment_program, ARB_fragment_program, "GetInteger64v"); - params[0] = ctx->Program.ErrorPos; + params[0] = (GLint64)(ctx->Program.ErrorPos); break; case GL_FRAGMENT_PROGRAM_ARB: CHECK_EXT1(ARB_fragment_program, "GetInteger64v"); @@ -7201,11 +7201,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_MAX_TEXTURE_COORDS_ARB: CHECK_EXT2(ARB_fragment_program, NV_fragment_program, "GetInteger64v"); - params[0] = ctx->Const.MaxTextureCoordUnits; + params[0] = (GLint64)(ctx->Const.MaxTextureCoordUnits); break; case GL_MAX_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXT2(ARB_fragment_program, NV_fragment_program, "GetInteger64v"); - params[0] = ctx->Const.MaxTextureImageUnits; + params[0] = (GLint64)(ctx->Const.MaxTextureImageUnits); break; case GL_DEPTH_BOUNDS_TEST_EXT: CHECK_EXT1(EXT_depth_bounds_test, "GetInteger64v"); @@ -7217,7 +7217,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) params[1] = IROUND64(ctx->Depth.BoundsMax); break; case GL_MAX_DRAW_BUFFERS_ARB: - params[0] = ctx->Const.MaxDrawBuffers; + params[0] = (GLint64)(ctx->Const.MaxDrawBuffers); break; case GL_DRAW_BUFFER0_ARB: params[0] = ENUM_TO_INT64(ctx->DrawBuffer->ColorDrawBuffer[0]); @@ -7257,31 +7257,31 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: CHECK_EXT1(OES_read_format, "GetInteger64v"); - params[0] = ctx->Const.ColorReadType; + params[0] = (GLint64)(ctx->Const.ColorReadType); break; case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: CHECK_EXT1(OES_read_format, "GetInteger64v"); - params[0] = ctx->Const.ColorReadFormat; + params[0] = (GLint64)(ctx->Const.ColorReadFormat); break; case GL_NUM_FRAGMENT_REGISTERS_ATI: CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = 6; + params[0] = (GLint64)(6); break; case GL_NUM_FRAGMENT_CONSTANTS_ATI: CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = 8; + params[0] = (GLint64)(8); break; case GL_NUM_PASSES_ATI: CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = 2; + params[0] = (GLint64)(2); break; case GL_NUM_INSTRUCTIONS_PER_PASS_ATI: CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = 8; + params[0] = (GLint64)(8); break; case GL_NUM_INSTRUCTIONS_TOTAL_ATI: CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = 16; + params[0] = (GLint64)(16); break; case GL_COLOR_ALPHA_PAIRING_ATI: CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); @@ -7289,23 +7289,23 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_NUM_LOOPBACK_COMPONENTS_ATI: CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = 3; + params[0] = (GLint64)(3); break; case GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI: CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); - params[0] = 3; + params[0] = (GLint64)(3); break; case GL_STENCIL_BACK_FUNC: params[0] = ENUM_TO_INT64(ctx->Stencil.Function[1]); break; case GL_STENCIL_BACK_VALUE_MASK: - params[0] = ctx->Stencil.ValueMask[1]; + params[0] = (GLint64)(ctx->Stencil.ValueMask[1]); break; case GL_STENCIL_BACK_WRITEMASK: - params[0] = ctx->Stencil.WriteMask[1]; + params[0] = (GLint64)(ctx->Stencil.WriteMask[1]); break; case GL_STENCIL_BACK_REF: - params[0] = ctx->Stencil.Ref[1]; + params[0] = (GLint64)(ctx->Stencil.Ref[1]); break; case GL_STENCIL_BACK_FAIL: params[0] = ENUM_TO_INT64(ctx->Stencil.FailFunc[1]); @@ -7318,23 +7318,23 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_FRAMEBUFFER_BINDING_EXT: CHECK_EXT1(EXT_framebuffer_object, "GetInteger64v"); - params[0] = ctx->DrawBuffer->Name; + params[0] = (GLint64)(ctx->DrawBuffer->Name); break; case GL_RENDERBUFFER_BINDING_EXT: CHECK_EXT1(EXT_framebuffer_object, "GetInteger64v"); - params[0] = ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0; + params[0] = (GLint64)(ctx->CurrentRenderbuffer ? ctx->CurrentRenderbuffer->Name : 0); break; case GL_MAX_COLOR_ATTACHMENTS_EXT: CHECK_EXT1(EXT_framebuffer_object, "GetInteger64v"); - params[0] = ctx->Const.MaxColorAttachments; + params[0] = (GLint64)(ctx->Const.MaxColorAttachments); break; case GL_MAX_RENDERBUFFER_SIZE_EXT: CHECK_EXT1(EXT_framebuffer_object, "GetInteger64v"); - params[0] = ctx->Const.MaxRenderbufferSize; + params[0] = (GLint64)(ctx->Const.MaxRenderbufferSize); break; case GL_READ_FRAMEBUFFER_BINDING_EXT: CHECK_EXT1(EXT_framebuffer_blit, "GetInteger64v"); - params[0] = ctx->ReadBuffer->Name; + params[0] = (GLint64)(ctx->ReadBuffer->Name); break; case GL_PROVOKING_VERTEX_EXT: CHECK_EXT1(EXT_provoking_vertex, "GetInteger64v"); @@ -7346,7 +7346,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB: CHECK_EXT1(ARB_fragment_shader, "GetInteger64v"); - params[0] = ctx->Const.FragmentProgram.MaxUniformComponents; + params[0] = (GLint64)(ctx->Const.FragmentProgram.MaxUniformComponents); break; case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB: CHECK_EXT1(ARB_fragment_shader, "GetInteger64v"); @@ -7354,31 +7354,31 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetInteger64v"); - params[0] = ctx->Const.VertexProgram.MaxUniformComponents; + params[0] = (GLint64)(ctx->Const.VertexProgram.MaxUniformComponents); break; case GL_MAX_VARYING_FLOATS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetInteger64v"); - params[0] = ctx->Const.MaxVarying * 4; + params[0] = (GLint64)(ctx->Const.MaxVarying * 4); break; case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetInteger64v"); - params[0] = ctx->Const.MaxVertexTextureImageUnits; + params[0] = (GLint64)(ctx->Const.MaxVertexTextureImageUnits); break; case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetInteger64v"); - params[0] = MAX_COMBINED_TEXTURE_IMAGE_UNITS; + params[0] = (GLint64)(MAX_COMBINED_TEXTURE_IMAGE_UNITS); break; case GL_CURRENT_PROGRAM: CHECK_EXT1(ARB_shader_objects, "GetInteger64v"); - params[0] = ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0; + params[0] = (GLint64)(ctx->Shader.CurrentProgram ? ctx->Shader.CurrentProgram->Name : 0); break; case GL_MAX_SAMPLES: CHECK_EXT1(ARB_framebuffer_object, "GetInteger64v"); - params[0] = ctx->Const.MaxSamples; + params[0] = (GLint64)(ctx->Const.MaxSamples); break; case GL_VERTEX_ARRAY_BINDING_APPLE: CHECK_EXT1(APPLE_vertex_array_object, "GetInteger64v"); - params[0] = ctx->Array.ArrayObj->Name; + params[0] = (GLint64)(ctx->Array.ArrayObj->Name); break; case GL_TEXTURE_CUBE_MAP_SEAMLESS: CHECK_EXT1(ARB_seamless_cube_map, "GetInteger64v"); diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py index 2878c1b552..c7babd1c81 100644 --- a/src/mesa/main/get_gen.py +++ b/src/mesa/main/get_gen.py @@ -1042,7 +1042,7 @@ def ConversionFunc(fromType, toType): elif fromType == GLint and toType == GLfloat: # but not GLfloatN! return "(GLfloat)" elif fromType == GLint and toType == GLint64: - return "" + return "(GLint64)" elif fromType == GLint64 and toType == GLfloat: # but not GLfloatN! return "(GLfloat)" else: -- cgit v1.2.3 From 040e1d008f8f8258f1b0ee0fcdf4906e0979fb66 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Tue, 3 Nov 2009 23:19:56 +0100 Subject: nv50: add 3d texture tiling and mip-mapping Mip-mapped 3D textures are not arrays of 2D layers with a mip-map layout like 2D textures, therefore we cannot use image_nr == depth for them. Making use of "volume tiling" modes now, the allowed modes are 0xZY where Z <= 5 and y <= 5. --- src/gallium/drivers/nv50/nv50_context.h | 12 ++++++ src/gallium/drivers/nv50/nv50_miptree.c | 63 +++++++++++++++++++++----------- src/gallium/drivers/nv50/nv50_tex.c | 37 ++++++++++++++++--- src/gallium/drivers/nv50/nv50_transfer.c | 39 +++++++++++++++----- 4 files changed, 114 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index 890defb90c..4b0f062295 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -69,6 +69,18 @@ struct nv50_sampler_stateobj { unsigned tsc[8]; }; +static INLINE unsigned +get_tile_height(uint32_t tile_mode) +{ + return 1 << ((tile_mode & 0xf) + 2); +} + +static INLINE unsigned +get_tile_depth(uint32_t tile_mode) +{ + return 1 << (tile_mode >> 4); +} + struct nv50_miptree_level { int *image_offset; unsigned pitch; diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c index 229a59cb74..9c20c5cc28 100644 --- a/src/gallium/drivers/nv50/nv50_miptree.c +++ b/src/gallium/drivers/nv50/nv50_miptree.c @@ -26,14 +26,33 @@ #include "nv50_context.h" +/* The restrictions in tile mode selection probably aren't necessary. */ static INLINE uint32_t -get_tile_mode(unsigned ny) +get_tile_mode(unsigned ny, unsigned d) { - if (ny > 32) return 4; - if (ny > 16) return 3; - if (ny > 8) return 2; - if (ny > 4) return 1; - return 0; + uint32_t tile_mode = 0x00; + + if (ny > 32) tile_mode = 0x04; /* height 64 tiles */ + else + if (ny > 16) tile_mode = 0x03; /* height 32 tiles */ + else + if (ny > 8) tile_mode = 0x02; /* height 16 tiles */ + else + if (ny > 4) tile_mode = 0x01; /* height 8 tiles */ + + if (d == 1) + return tile_mode; + else + if (tile_mode > 0x02) + tile_mode = 0x02; + + if (d > 16 && tile_mode < 0x02) + return tile_mode | 0x50; /* depth 32 tiles */ + if (d > 8) return tile_mode | 0x40; /* depth 16 tiles */ + if (d > 4) return tile_mode | 0x30; /* depth 8 tiles */ + if (d > 2) return tile_mode | 0x20; /* depth 4 tiles */ + + return tile_mode | 0x10; } static struct pipe_texture * @@ -43,7 +62,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp) struct nv50_miptree *mt = CALLOC_STRUCT(nv50_miptree); struct pipe_texture *pt = &mt->base.base; unsigned width = tmp->width[0], height = tmp->height[0]; - unsigned depth = tmp->depth[0]; + unsigned depth = tmp->depth[0], image_alignment; uint32_t tile_flags; int ret, i, l; @@ -67,17 +86,8 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp) break; } - switch (pt->target) { - case PIPE_TEXTURE_3D: - mt->image_nr = pt->depth[0]; - break; - case PIPE_TEXTURE_CUBE: - mt->image_nr = 6; - break; - default: - mt->image_nr = 1; - break; - } + /* XXX: texture arrays */ + mt->image_nr = (pt->target == PIPE_TEXTURE_CUBE) ? 6 : 1; for (l = 0; l <= pt->last_level; l++) { struct nv50_miptree_level *lvl = &mt->level[l]; @@ -90,26 +100,35 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp) lvl->image_offset = CALLOC(mt->image_nr, sizeof(int)); lvl->pitch = align(pt->nblocksx[l] * pt->block.size, 64); - lvl->tile_mode = get_tile_mode(pt->nblocksy[l]); + lvl->tile_mode = get_tile_mode(pt->nblocksy[l], depth); width = MAX2(1, width >> 1); height = MAX2(1, height >> 1); depth = MAX2(1, depth >> 1); } + image_alignment = get_tile_height(mt->level[0].tile_mode) * 64; + image_alignment *= get_tile_depth(mt->level[0].tile_mode); + + /* NOTE the distinction between arrays of mip-mapped 2D textures and + * mip-mapped 3D textures. We can't use image_nr == depth for 3D mip. + */ for (i = 0; i < mt->image_nr; i++) { for (l = 0; l <= pt->last_level; l++) { struct nv50_miptree_level *lvl = &mt->level[l]; int size; - unsigned tile_ny = 1 << (lvl->tile_mode + 2); + unsigned tile_h = get_tile_height(lvl->tile_mode); + unsigned tile_d = get_tile_depth(lvl->tile_mode); - size = align(pt->nblocksx[l] * pt->block.size, 64); - size *= align(pt->nblocksy[l], tile_ny); + size = lvl->pitch; + size *= align(pt->nblocksy[l], tile_h); + size *= align(pt->depth[l], tile_d); lvl->image_offset[i] = mt->total_size; mt->total_size += size; } + mt->total_size = align(mt->total_size, image_alignment); } ret = nouveau_bo_new_tile(dev, NOUVEAU_BO_VRAM, 256, mt->total_size, diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index 52ccdaa407..2813f54477 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -96,19 +96,44 @@ nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so, if (i == NV50_TEX_FORMAT_LIST_SIZE) return 1; - mode = (nv50->sampler[unit]->normalized ? 0xd0005000 : 0x5001d000) | - (mt->base.bo->tile_mode << 22); + if (nv50->sampler[unit]->normalized) + mode = 0x50001000 | (1 << 31); + else { + mode = 0x50001000 | (7 << 14); + assert(mt->base.base.target == PIPE_TEXTURE_2D); + } + + mode |= ((mt->base.bo->tile_mode & 0x0f) << 22) | + ((mt->base.bo->tile_mode & 0xf0) << 21); + if (pf_type(mt->base.base.format) == PIPE_FORMAT_TYPE_SRGB) mode |= 0x0400; + switch (mt->base.base.target) { + case PIPE_TEXTURE_1D: + break; + case PIPE_TEXTURE_2D: + mode |= (1 << 14); + break; + case PIPE_TEXTURE_3D: + mode |= (2 << 14); + break; + case PIPE_TEXTURE_CUBE: + mode |= (3 << 14); + break; + default: + assert(!"unsupported texture target"); + break; + } + so_data (so, nv50_tex_format_list[i].hw); so_reloc(so, mt->base.bo, 0, NOUVEAU_BO_VRAM | NOUVEAU_BO_LOW | - NOUVEAU_BO_RD, 0, 0); + NOUVEAU_BO_RD, 0, 0); so_data (so, mode); so_data (so, 0x00300000); - so_data (so, mt->base.base.width[0]); + so_data (so, mt->base.base.width[0] | (1 << 31)); so_data (so, (mt->base.base.last_level << 28) | - (mt->base.base.depth[0] << 16) | mt->base.base.height[0]); + (mt->base.base.depth[0] << 16) | mt->base.base.height[0]); so_data (so, 0x03000000); so_data (so, mt->base.base.last_level << 4); @@ -124,7 +149,7 @@ nv50_tex_validate(struct nv50_context *nv50) unsigned i, unit, push; push = MAX2(nv50->miptree_nr, nv50->state.miptree_nr) * 2 + 23 + 6; - so = so_new(nv50->miptree_nr * 9 + push, nv50->miptree_nr + 2); + so = so_new(nv50->miptree_nr * 9 + push, nv50->miptree_nr * 2 + 2); nv50_so_init_sifc(nv50, so, nv50->screen->tic, NOUVEAU_BO_VRAM, nv50->miptree_nr * 8 * 4); diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c index 9c008090b8..ea61357aaa 100644 --- a/src/gallium/drivers/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nv50/nv50_transfer.c @@ -12,6 +12,7 @@ struct nv50_transfer { int level_pitch; int level_width; int level_height; + int level_depth; int level_x; int level_y; }; @@ -20,10 +21,10 @@ static void nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, struct nouveau_bo *src_bo, unsigned src_offset, int src_pitch, unsigned src_tile_mode, - int sx, int sy, int sw, int sh, + int sx, int sy, int sw, int sh, int sd, struct nouveau_bo *dst_bo, unsigned dst_offset, int dst_pitch, unsigned dst_tile_mode, - int dx, int dy, int dw, int dh, + int dx, int dy, int dw, int dh, int dd, int cpp, int width, int height, unsigned src_reloc, unsigned dst_reloc) { @@ -51,7 +52,7 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, OUT_RING (chan, src_tile_mode << 4); OUT_RING (chan, sw * cpp); OUT_RING (chan, sh); - OUT_RING (chan, 1); + OUT_RING (chan, sd); OUT_RING (chan, 0); } @@ -70,7 +71,7 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, OUT_RING (chan, dst_tile_mode << 4); OUT_RING (chan, dw * cpp); OUT_RING (chan, dh); - OUT_RING (chan, 1); + OUT_RING (chan, dd); OUT_RING (chan, 0); } @@ -114,6 +115,20 @@ nv50_transfer_rect_m2mf(struct pipe_screen *pscreen, } } +static INLINE unsigned +get_zslice_offset(unsigned tile_mode, unsigned z, unsigned pitch, unsigned ny) +{ + unsigned tile_h = get_tile_height(tile_mode); + unsigned tile_d = get_tile_depth(tile_mode); + + /* pitch_2d == to next slice within this volume-tile */ + /* pitch_3d == to next slice in next 2D array of blocks */ + unsigned pitch_2d = tile_h * 64; + unsigned pitch_3d = tile_d * align(ny, tile_h) * pitch; + + return (z % tile_d) * pitch_2d + (z / tile_d) * pitch_3d; +} + static struct pipe_transfer * nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, unsigned face, unsigned level, unsigned zslice, @@ -129,9 +144,6 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, if (pt->target == PIPE_TEXTURE_CUBE) image = face; - else - if (pt->target == PIPE_TEXTURE_3D) - image = zslice; tx = CALLOC_STRUCT(nv50_transfer); if (!tx) @@ -157,6 +169,7 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->level_pitch = lvl->pitch; tx->level_width = mt->base.base.width[level]; tx->level_height = mt->base.base.height[level]; + tx->level_depth = mt->base.base.depth[level]; tx->level_offset = lvl->image_offset[image]; tx->level_tiling = lvl->tile_mode; tx->level_x = pf_get_nblocksx(&tx->base.block, x); @@ -168,6 +181,11 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, return NULL; } + if (pt->target == PIPE_TEXTURE_3D) + tx->level_offset += get_zslice_offset(lvl->tile_mode, zslice, + lvl->pitch, + tx->base.nblocksy); + if (usage & PIPE_TRANSFER_READ) { nx = pf_get_nblocksx(&tx->base.block, tx->base.width); ny = pf_get_nblocksy(&tx->base.block, tx->base.height); @@ -176,10 +194,11 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->level_pitch, tx->level_tiling, x, y, tx->base.nblocksx, tx->base.nblocksy, + tx->level_depth, tx->bo, 0, tx->base.stride, tx->bo->tile_mode, 0, 0, - tx->base.nblocksx, tx->base.nblocksy, + tx->base.nblocksx, tx->base.nblocksy, 1, tx->base.block.size, nx, ny, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART, NOUVEAU_BO_GART); @@ -199,14 +218,16 @@ nv50_transfer_del(struct pipe_transfer *ptx) if (ptx->usage & PIPE_TRANSFER_WRITE) { struct pipe_screen *pscreen = ptx->texture->screen; + nv50_transfer_rect_m2mf(pscreen, tx->bo, 0, tx->base.stride, tx->bo->tile_mode, 0, 0, - tx->base.nblocksx, tx->base.nblocksy, + tx->base.nblocksx, tx->base.nblocksy, 1, mt->base.bo, tx->level_offset, tx->level_pitch, tx->level_tiling, tx->level_x, tx->level_y, tx->base.nblocksx, tx->base.nblocksy, + tx->level_depth, tx->base.block.size, nx, ny, NOUVEAU_BO_GART, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART); -- cgit v1.2.3 From 317ccfe0dfbfda13f58a26f661324d883b25a316 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Tue, 3 Nov 2009 22:09:32 +0100 Subject: nv50: add abs-modifier for emit_minmax --- src/gallium/drivers/nv50/nv50_program.c | 48 +++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 27827c7ecf..64a0b571a5 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -88,12 +88,16 @@ struct nv50_reg { int index; int hw; - int neg; + int mod; int rhw; /* result hw for FP outputs, or interpolant index */ int acc; /* instruction where this reg is last read (first insn == 1) */ }; +#define NV50_MOD_NEG 1 +#define NV50_MOD_ABS 2 +#define NV50_MOD_SAT 4 + /* arbitrary limits */ #define MAX_IF_DEPTH 4 #define MAX_LOOP_DEPTH 4 @@ -152,7 +156,7 @@ ctor_reg(struct nv50_reg *reg, unsigned type, int index, int hw) reg->type = type; reg->index = index; reg->hw = hw; - reg->neg = 0; + reg->mod = 0; reg->rhw = -1; reg->acc = 0; } @@ -460,8 +464,12 @@ set_dst(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_program_exec *e) static INLINE void set_immd(struct nv50_pc *pc, struct nv50_reg *imm, struct nv50_program_exec *e) { + unsigned val; float f = pc->immd_buf[imm->hw]; - unsigned val = fui(imm->neg ? -f : f); + + if (imm->mod & NV50_MOD_ABS) + f = fabsf(f); + val = fui((imm->mod & NV50_MOD_NEG) ? -f : f); set_long(pc, e); /*XXX: can't be predicated - bits overlap.. catch cases where both @@ -801,12 +809,12 @@ emit_mul(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src0, set_dst(pc, dst, e); set_src_0(pc, src0, e); if (src1->type == P_IMMD && !is_long(e)) { - if (src0->neg) + if (src0->mod & NV50_MOD_NEG) e->inst[0] |= 0x00008000; set_immd(pc, src1, e); } else { set_src_1(pc, src1, e); - if (src0->neg ^ src1->neg) { + if ((src0->mod ^ src1->mod) & NV50_MOD_NEG) { if (is_long(e)) e->inst[1] |= 0x08000000; else @@ -828,9 +836,10 @@ emit_add(struct nv50_pc *pc, struct nv50_reg *dst, alloc_reg(pc, src1); check_swap_src_0_1(pc, &src0, &src1); - if (!pc->allow32 || (src0->neg | src1->neg) || src1->hw > 63) { + if (!pc->allow32 || (src0->mod | src1->mod) || src1->hw > 63) { set_long(pc, e); - e->inst[1] |= (src0->neg << 26) | (src1->neg << 27); + e->inst[1] |= ((src0->mod & NV50_MOD_NEG) << 26) | + ((src1->mod & NV50_MOD_NEG) << 27); } set_dst(pc, dst, e); @@ -877,6 +886,11 @@ emit_minmax(struct nv50_pc *pc, unsigned sub, struct nv50_reg *dst, set_src_0(pc, src0, e); set_src_1(pc, src1, e); + if (src0->mod & NV50_MOD_ABS) + e->inst[1] |= 0x00100000; + if (src1->mod & NV50_MOD_ABS) + e->inst[1] |= 0x00080000; + emit(pc, e); } @@ -885,9 +899,9 @@ emit_sub(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src0, struct nv50_reg *src1) { assert(src0 != src1); - src1->neg ^= 1; + src1->mod ^= NV50_MOD_NEG; emit_add(pc, dst, src0, src1); - src1->neg ^= 1; + src1->mod ^= NV50_MOD_NEG; } static void @@ -941,9 +955,9 @@ emit_mad(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src0, set_src_1(pc, src1, e); set_src_2(pc, src2, e); - if (src0->neg ^ src1->neg) + if ((src0->mod ^ src1->mod) & NV50_MOD_NEG) e->inst[1] |= 0x04000000; - if (src2->neg) + if (src2->mod & NV50_MOD_NEG) e->inst[1] |= 0x08000000; emit(pc, e); @@ -954,9 +968,9 @@ emit_msb(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src0, struct nv50_reg *src1, struct nv50_reg *src2) { assert(src2 != src0 && src2 != src1); - src2->neg ^= 1; + src2->mod ^= NV50_MOD_NEG; emit_mad(pc, dst, src0, src1, src2); - src2->neg ^= 1; + src2->mod ^= NV50_MOD_NEG; } static void @@ -1230,7 +1244,7 @@ emit_kil(struct nv50_pc *pc, struct nv50_reg *src) const int r_pred = 1; unsigned cvn = CVT_F32_F32; - if (src->neg) + if (src->mod & NV50_MOD_NEG) cvn |= CVT_NEG; /* write predicate reg */ emit_cvt(pc, NULL, src, r_pred, CVTOP_RN, cvn); @@ -1408,7 +1422,7 @@ emit_ddy(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src) assert(src->type == P_TEMP); - if (!src->neg) /* ! double negation */ + if (!(src->mod & NV50_MOD_NEG)) /* ! double negation */ emit_neg(pc, src, src); e->inst[0] = 0xc0150000; @@ -1671,7 +1685,7 @@ tgsi_src(struct nv50_pc *pc, int chan, const struct tgsi_full_src_register *src, break; case TGSI_UTIL_SIGN_TOGGLE: if (neg) - r->neg = 1; + r->mod = NV50_MOD_NEG; else { temp = temp_temp(pc); emit_neg(pc, temp, r); @@ -2207,7 +2221,7 @@ nv50_program_tx_insn(struct nv50_pc *pc, for (c = 0; c < 4; c++) { if (!src[i][c]) continue; - src[i][c]->neg = 0; + src[i][c]->mod = 0; if (src[i][c]->index == -1 && src[i][c]->type == P_IMMD) FREE(src[i][c]); else -- cgit v1.2.3 From 618e3b89f6ecdf422132ecea19315b326dd348ec Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Tue, 3 Nov 2009 23:30:18 +0100 Subject: nv50: fix shader emit_tex for cube textures --- src/gallium/drivers/nv50/nv50_program.c | 50 ++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 64a0b571a5..bf50982dd1 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -1257,11 +1257,37 @@ emit_kil(struct nv50_pc *pc, struct nv50_reg *src) emit(pc, e); } +static void +load_cube_tex_coords(struct nv50_pc *pc, struct nv50_reg *t[4], + struct nv50_reg **src, boolean proj) +{ + int mod[3] = { src[0]->mod, src[1]->mod, src[2]->mod }; + + src[0]->mod |= NV50_MOD_ABS; + src[1]->mod |= NV50_MOD_ABS; + src[2]->mod |= NV50_MOD_ABS; + + emit_minmax(pc, 4, t[2], src[0], src[1]); + emit_minmax(pc, 4, t[2], src[2], t[2]); + + src[0]->mod = mod[0]; + src[1]->mod = mod[1]; + src[2]->mod = mod[2]; + + if (proj && 0 /* looks more correct without this */) + emit_mul(pc, t[2], t[2], src[3]); + emit_flop(pc, 0, t[2], t[2]); + + emit_mul(pc, t[0], src[0], t[2]); + emit_mul(pc, t[1], src[1], t[2]); + emit_mul(pc, t[2], src[2], t[2]); +} + static void emit_tex(struct nv50_pc *pc, struct nv50_reg **dst, unsigned mask, struct nv50_reg **src, unsigned unit, unsigned type, boolean proj) { - struct nv50_reg *temp, *t[4]; + struct nv50_reg *t[4]; struct nv50_program_exec *e; unsigned c, mode, dim; @@ -1290,6 +1316,9 @@ emit_tex(struct nv50_pc *pc, struct nv50_reg **dst, unsigned mask, /* some cards need t[0]'s hw index to be a multiple of 4 */ alloc_temp4(pc, t, 0); + if (type == TGSI_TEXTURE_CUBE) { + load_cube_tex_coords(pc, t, src, proj); + } else if (proj) { if (src[0]->type == P_TEMP && src[0]->rhw != -1) { mode = pc->interp_mode[src[0]->index]; @@ -1314,17 +1343,8 @@ emit_tex(struct nv50_pc *pc, struct nv50_reg **dst, unsigned mask, */ } } else { - if (type == TGSI_TEXTURE_CUBE) { - temp = temp_temp(pc); - emit_minmax(pc, 4, temp, src[0], src[1]); - emit_minmax(pc, 4, temp, temp, src[2]); - emit_flop(pc, 0, temp, temp); - for (c = 0; c < 3; c++) - emit_mul(pc, t[c], src[c], temp); - } else { - for (c = 0; c < dim; c++) - emit_mov(pc, t[c], src[c]); - } + for (c = 0; c < dim; c++) + emit_mov(pc, t[c], src[c]); } e = exec(pc); @@ -1337,14 +1357,16 @@ emit_tex(struct nv50_pc *pc, struct nv50_reg **dst, unsigned mask, if (dim == 2) e->inst[0] |= 0x00400000; else - if (dim == 3) + if (dim == 3) { e->inst[0] |= 0x00800000; + if (type == TGSI_TEXTURE_CUBE) + e->inst[0] |= 0x08000000; + } e->inst[0] |= (mask & 0x3) << 25; e->inst[1] |= (mask & 0xc) << 12; emit(pc, e); - #if 1 c = 0; if (mask & 1) emit_mov(pc, dst[0], t[c++]); -- cgit v1.2.3 From 767bc8eb5a0bbaf9fde9d760e8460d34c51d2991 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 4 Nov 2009 11:47:10 +0000 Subject: tgsi/ureg: Allow for multiple extended instruction tokens. For example, we would like to have a predicate and texture token in one instruction to do predicated texture sampling. --- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 42 ++++++----- src/gallium/auxiliary/tgsi/tgsi_ureg.h | 127 ++++++++++++++++++--------------- 2 files changed, 94 insertions(+), 75 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 67af953e09..4731e3bde8 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -644,7 +644,7 @@ static void validate( unsigned opcode, #endif } -unsigned +struct ureg_emit_insn_result ureg_emit_insn(struct ureg_program *ureg, unsigned opcode, boolean saturate, @@ -659,6 +659,7 @@ ureg_emit_insn(struct ureg_program *ureg, { union tgsi_any_token *out; uint count = predicate ? 2 : 1; + struct ureg_emit_insn_result result; validate( opcode, num_dst, num_src ); @@ -672,6 +673,8 @@ ureg_emit_insn(struct ureg_program *ureg, out[0].insn.NumSrcRegs = num_src; out[0].insn.Padding = 0; + result.insn_token = ureg->domain[DOMAIN_INSN].count - count; + if (predicate) { out[0].insn.Extended = 1; out[1].insn_ext_predicate = tgsi_default_instruction_ext_predicate(); @@ -680,19 +683,23 @@ ureg_emit_insn(struct ureg_program *ureg, out[1].insn_ext_predicate.SwizzleY = pred_swizzle_y; out[1].insn_ext_predicate.SwizzleZ = pred_swizzle_z; out[1].insn_ext_predicate.SwizzleW = pred_swizzle_w; + + result.extended_token = result.insn_token + 1; } else { out[0].insn.Extended = 0; + + result.extended_token = result.insn_token; } ureg->nr_instructions++; - return ureg->domain[DOMAIN_INSN].count - count; + return result; } void ureg_emit_label(struct ureg_program *ureg, - unsigned insn_token, + unsigned extended_token, unsigned *label_token ) { union tgsi_any_token *out, *insn; @@ -701,9 +708,9 @@ ureg_emit_label(struct ureg_program *ureg, return; out = get_tokens( ureg, DOMAIN_INSN, 1 ); - insn = retrieve_token( ureg, DOMAIN_INSN, insn_token ); + insn = retrieve_token( ureg, DOMAIN_INSN, extended_token ); - insn->insn.Extended = 1; + insn->token.Extended = 1; out[0].value = 0; out[0].insn_ext_label.Type = TGSI_INSTRUCTION_EXT_TYPE_LABEL; @@ -737,15 +744,15 @@ ureg_fixup_label(struct ureg_program *ureg, void ureg_emit_texture(struct ureg_program *ureg, - unsigned insn_token, + unsigned extended_token, unsigned target ) { union tgsi_any_token *out, *insn; out = get_tokens( ureg, DOMAIN_INSN, 1 ); - insn = retrieve_token( ureg, DOMAIN_INSN, insn_token ); + insn = retrieve_token( ureg, DOMAIN_INSN, extended_token ); - insn->insn.Extended = 1; + insn->token.Extended = 1; out[0].value = 0; out[0].insn_ext_texture.Type = TGSI_INSTRUCTION_EXT_TYPE_TEXTURE; @@ -772,7 +779,8 @@ ureg_insn(struct ureg_program *ureg, const struct ureg_src *src, unsigned nr_src ) { - unsigned insn, i; + struct ureg_emit_insn_result insn; + unsigned i; boolean saturate; boolean predicate; boolean negate; @@ -806,7 +814,7 @@ ureg_insn(struct ureg_program *ureg, for (i = 0; i < nr_src; i++) ureg_emit_src( ureg, src[i] ); - ureg_fixup_insn_size( ureg, insn ); + ureg_fixup_insn_size( ureg, insn.insn_token ); } void @@ -818,7 +826,8 @@ ureg_tex_insn(struct ureg_program *ureg, const struct ureg_src *src, unsigned nr_src ) { - unsigned insn, i; + struct ureg_emit_insn_result insn; + unsigned i; boolean saturate; boolean predicate; boolean negate; @@ -846,7 +855,7 @@ ureg_tex_insn(struct ureg_program *ureg, nr_dst, nr_src); - ureg_emit_texture( ureg, insn, target ); + ureg_emit_texture( ureg, insn.extended_token, target ); for (i = 0; i < nr_dst; i++) ureg_emit_dst( ureg, dst[i] ); @@ -854,7 +863,7 @@ ureg_tex_insn(struct ureg_program *ureg, for (i = 0; i < nr_src; i++) ureg_emit_src( ureg, src[i] ); - ureg_fixup_insn_size( ureg, insn ); + ureg_fixup_insn_size( ureg, insn.insn_token ); } @@ -865,7 +874,8 @@ ureg_label_insn(struct ureg_program *ureg, unsigned nr_src, unsigned *label_token ) { - unsigned insn, i; + struct ureg_emit_insn_result insn; + unsigned i; insn = ureg_emit_insn(ureg, opcode, @@ -879,12 +889,12 @@ ureg_label_insn(struct ureg_program *ureg, 0, nr_src); - ureg_emit_label( ureg, insn, label_token ); + ureg_emit_label( ureg, insn.extended_token, label_token ); for (i = 0; i < nr_src; i++) ureg_emit_src( ureg, src[i] ); - ureg_fixup_insn_size( ureg, insn ); + ureg_fixup_insn_size( ureg, insn.insn_token ); } diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index a3bc99140c..dae4291194 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -273,7 +273,12 @@ ureg_label_insn(struct ureg_program *ureg, * Internal instruction helpers, don't call these directly: */ -unsigned +struct ureg_emit_insn_result { + unsigned insn_token; /*< Used to fixup insn size. */ + unsigned extended_token; /*< Used to set the Extended bit, usually the same as insn_token. */ +}; + +struct ureg_emit_insn_result ureg_emit_insn(struct ureg_program *ureg, unsigned opcode, boolean saturate, @@ -323,7 +328,7 @@ static INLINE void ureg_##op( struct ureg_program *ureg ) \ TGSI_SWIZZLE_Z, \ TGSI_SWIZZLE_W, \ 0, \ - 0); \ + 0).insn_token; \ ureg_fixup_insn_size( ureg, insn ); \ } @@ -342,7 +347,7 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ TGSI_SWIZZLE_Z, \ TGSI_SWIZZLE_W, \ 0, \ - 1); \ + 1).insn_token; \ ureg_emit_src( ureg, src ); \ ureg_fixup_insn_size( ureg, insn ); \ } @@ -352,19 +357,20 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ unsigned *label_token ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn(ureg, \ - opcode, \ - FALSE, \ - FALSE, \ - FALSE, \ - TGSI_SWIZZLE_X, \ - TGSI_SWIZZLE_Y, \ - TGSI_SWIZZLE_Z, \ - TGSI_SWIZZLE_W, \ - 0, \ - 0); \ - ureg_emit_label( ureg, insn, label_token ); \ - ureg_fixup_insn_size( ureg, insn ); \ + struct ureg_emit_insn_result insn; \ + insn = ureg_emit_insn(ureg, \ + opcode, \ + FALSE, \ + FALSE, \ + FALSE, \ + TGSI_SWIZZLE_X, \ + TGSI_SWIZZLE_Y, \ + TGSI_SWIZZLE_Z, \ + TGSI_SWIZZLE_W, \ + 0, \ + 0); \ + ureg_emit_label( ureg, insn.extended_token, label_token ); \ + ureg_fixup_insn_size( ureg, insn.insn_token ); \ } #define OP01_LBL( op ) \ @@ -373,20 +379,21 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ unsigned *label_token ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn(ureg, \ - opcode, \ - FALSE, \ - FALSE, \ - FALSE, \ - TGSI_SWIZZLE_X, \ - TGSI_SWIZZLE_Y, \ - TGSI_SWIZZLE_Z, \ - TGSI_SWIZZLE_W, \ - 0, \ - 1); \ - ureg_emit_label( ureg, insn, label_token ); \ + struct ureg_emit_insn_result insn; \ + insn = ureg_emit_insn(ureg, \ + opcode, \ + FALSE, \ + FALSE, \ + FALSE, \ + TGSI_SWIZZLE_X, \ + TGSI_SWIZZLE_Y, \ + TGSI_SWIZZLE_Z, \ + TGSI_SWIZZLE_W, \ + 0, \ + 1); \ + ureg_emit_label( ureg, insn.extended_token, label_token ); \ ureg_emit_src( ureg, src ); \ - ureg_fixup_insn_size( ureg, insn ); \ + ureg_fixup_insn_size( ureg, insn.insn_token ); \ } #define OP10( op ) \ @@ -404,7 +411,7 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ dst.PredSwizzleZ, \ dst.PredSwizzleW, \ 1, \ - 0); \ + 0).insn_token; \ ureg_emit_dst( ureg, dst ); \ ureg_fixup_insn_size( ureg, insn ); \ } @@ -426,7 +433,7 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ dst.PredSwizzleZ, \ dst.PredSwizzleW, \ 1, \ - 1); \ + 1).insn_token; \ ureg_emit_dst( ureg, dst ); \ ureg_emit_src( ureg, src ); \ ureg_fixup_insn_size( ureg, insn ); \ @@ -449,7 +456,7 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ dst.PredSwizzleZ, \ dst.PredSwizzleW, \ 1, \ - 2); \ + 2).insn_token; \ ureg_emit_dst( ureg, dst ); \ ureg_emit_src( ureg, src0 ); \ ureg_emit_src( ureg, src1 ); \ @@ -464,22 +471,23 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ struct ureg_src src1 ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn(ureg, \ - opcode, \ - dst.Saturate, \ - dst.Predicate, \ - dst.PredNegate, \ - dst.PredSwizzleX, \ - dst.PredSwizzleY, \ - dst.PredSwizzleZ, \ - dst.PredSwizzleW, \ - 1, \ - 2); \ - ureg_emit_texture( ureg, insn, target ); \ + struct ureg_emit_insn_result insn; \ + insn = ureg_emit_insn(ureg, \ + opcode, \ + dst.Saturate, \ + dst.Predicate, \ + dst.PredNegate, \ + dst.PredSwizzleX, \ + dst.PredSwizzleY, \ + dst.PredSwizzleZ, \ + dst.PredSwizzleW, \ + 1, \ + 2); \ + ureg_emit_texture( ureg, insn.extended_token, target ); \ ureg_emit_dst( ureg, dst ); \ ureg_emit_src( ureg, src0 ); \ ureg_emit_src( ureg, src1 ); \ - ureg_fixup_insn_size( ureg, insn ); \ + ureg_fixup_insn_size( ureg, insn.insn_token ); \ } #define OP13( op ) \ @@ -500,7 +508,7 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ dst.PredSwizzleZ, \ dst.PredSwizzleW, \ 1, \ - 3); \ + 3).insn_token; \ ureg_emit_dst( ureg, dst ); \ ureg_emit_src( ureg, src0 ); \ ureg_emit_src( ureg, src1 ); \ @@ -518,24 +526,25 @@ static INLINE void ureg_##op( struct ureg_program *ureg, \ struct ureg_src src3 ) \ { \ unsigned opcode = TGSI_OPCODE_##op; \ - unsigned insn = ureg_emit_insn(ureg, \ - opcode, \ - dst.Saturate, \ - dst.Predicate, \ - dst.PredNegate, \ - dst.PredSwizzleX, \ - dst.PredSwizzleY, \ - dst.PredSwizzleZ, \ - dst.PredSwizzleW, \ - 1, \ - 4); \ - ureg_emit_texture( ureg, insn, target ); \ + struct ureg_emit_insn_result insn; \ + insn = ureg_emit_insn(ureg, \ + opcode, \ + dst.Saturate, \ + dst.Predicate, \ + dst.PredNegate, \ + dst.PredSwizzleX, \ + dst.PredSwizzleY, \ + dst.PredSwizzleZ, \ + dst.PredSwizzleW, \ + 1, \ + 4); \ + ureg_emit_texture( ureg, insn.extended_token, target ); \ ureg_emit_dst( ureg, dst ); \ ureg_emit_src( ureg, src0 ); \ ureg_emit_src( ureg, src1 ); \ ureg_emit_src( ureg, src2 ); \ ureg_emit_src( ureg, src3 ); \ - ureg_fixup_insn_size( ureg, insn ); \ + ureg_fixup_insn_size( ureg, insn.insn_token ); \ } -- cgit v1.2.3 From 0b4ea45e8aded79557da3a51bb88c9bbacfa07dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 3 Nov 2009 19:47:51 +0000 Subject: util: Remove homegrown Windows KM profiler. It's not sampling based so its results are biased towards functions called many times. --- src/gallium/auxiliary/util/SConscript | 1 - src/gallium/auxiliary/util/u_debug.h | 11 - src/gallium/auxiliary/util/u_debug_profile.c | 320 --------------------------- 3 files changed, 332 deletions(-) delete mode 100644 src/gallium/auxiliary/util/u_debug_profile.c (limited to 'src') diff --git a/src/gallium/auxiliary/util/SConscript b/src/gallium/auxiliary/util/SConscript index 2187935fa4..8d99106d0b 100644 --- a/src/gallium/auxiliary/util/SConscript +++ b/src/gallium/auxiliary/util/SConscript @@ -28,7 +28,6 @@ util = env.ConvenienceLibrary( 'u_debug.c', 'u_debug_dump.c', 'u_debug_memory.c', - 'u_debug_profile.c', 'u_debug_stack.c', 'u_debug_symbol.c', 'u_draw_quad.c', diff --git a/src/gallium/auxiliary/util/u_debug.h b/src/gallium/auxiliary/util/u_debug.h index b8c56fd600..abd834c741 100644 --- a/src/gallium/auxiliary/util/u_debug.h +++ b/src/gallium/auxiliary/util/u_debug.h @@ -351,17 +351,6 @@ void debug_memory_end(unsigned long beginning); -#if defined(PROFILE) && defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) - -void -debug_profile_start(void); - -void -debug_profile_stop(void); - -#endif - - #ifdef DEBUG struct pipe_surface; struct pipe_transfer; diff --git a/src/gallium/auxiliary/util/u_debug_profile.c b/src/gallium/auxiliary/util/u_debug_profile.c deleted file mode 100644 index d765b50144..0000000000 --- a/src/gallium/auxiliary/util/u_debug_profile.c +++ /dev/null @@ -1,320 +0,0 @@ -/************************************************************************** - * - * 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. - * - **************************************************************************/ - -/** - * @file - * Poor-man profiling. - * - * @author José Fonseca - * - * @sa http://blogs.msdn.com/joshpoley/archive/2008/03/12/poor-man-s-profiler.aspx - * @sa http://www.johnpanzer.com/aci_cuj/index.html - */ - -#include "pipe/p_config.h" - -#if defined(PROFILE) && defined(PIPE_SUBSYSTEM_WINDOWS_DISPLAY) - -#include -#include - -#include "util/u_debug.h" -#include "util/u_string.h" - - -#define PROFILE_TABLE_SIZE (1024*1024) -#define FILE_NAME_SIZE 256 - -struct debug_profile_entry -{ - uintptr_t caller; - uintptr_t callee; - uint64_t samples; -}; - -static unsigned long enabled = 0; - -static WCHAR wFileName[FILE_NAME_SIZE] = L"\\??\\c:\\00000000.prof"; -static ULONG_PTR iFile = 0; - -static struct debug_profile_entry *table = NULL; -static unsigned long free_table_entries = 0; -static unsigned long max_table_entries = 0; - -uint64_t start_stamp = 0; -uint64_t end_stamp = 0; - - -static void -debug_profile_entry(uintptr_t caller, uintptr_t callee, uint64_t samples) -{ - unsigned hash = ( caller + callee ) & PROFILE_TABLE_SIZE - 1; - - while(1) { - if(table[hash].caller == 0 && table[hash].callee == 0) { - table[hash].caller = caller; - table[hash].callee = callee; - table[hash].samples = samples; - --free_table_entries; - break; - } - else if(table[hash].caller == caller && table[hash].callee == callee) { - table[hash].samples += samples; - break; - } - else { - ++hash; - } - } -} - - -static uintptr_t caller_stack[1024]; -static unsigned last_caller = 0; - - -static int64_t delta(void) { - int64_t result = end_stamp - start_stamp; - if(result > UINT64_C(0xffffffff)) - result = 0; - return result; -} - - -static void __cdecl -debug_profile_enter(uintptr_t callee) -{ - uintptr_t caller = last_caller ? caller_stack[last_caller - 1] : 0; - - if (caller) - debug_profile_entry(caller, 0, delta()); - debug_profile_entry(caller, callee, 1); - caller_stack[last_caller++] = callee; -} - - -static void __cdecl -debug_profile_exit(uintptr_t callee) -{ - debug_profile_entry(callee, 0, delta()); - if(last_caller) - --last_caller; -} - - -/** - * Called at the start of every method or function. - * - * @sa http://msdn.microsoft.com/en-us/library/c63a9b7h.aspx - */ -void __declspec(naked) __cdecl -_penter(void) { - _asm { - push eax - mov eax, [enabled] - test eax, eax - jz skip - - push edx - - rdtsc - mov dword ptr [end_stamp], eax - mov dword ptr [end_stamp+4], edx - - xor eax, eax - mov [enabled], eax - - mov eax, [esp+8] - - push ebx - push ecx - push ebp - push edi - push esi - - push eax - call debug_profile_enter - add esp, 4 - - pop esi - pop edi - pop ebp - pop ecx - pop ebx - - mov eax, 1 - mov [enabled], eax - - rdtsc - mov dword ptr [start_stamp], eax - mov dword ptr [start_stamp+4], edx - - pop edx -skip: - pop eax - ret - } -} - - -/** - * Called at the end of Calls the end of every method or function. - * - * @sa http://msdn.microsoft.com/en-us/library/xc11y76y.aspx - */ -void __declspec(naked) __cdecl -_pexit(void) { - _asm { - push eax - mov eax, [enabled] - test eax, eax - jz skip - - push edx - - rdtsc - mov dword ptr [end_stamp], eax - mov dword ptr [end_stamp+4], edx - - xor eax, eax - mov [enabled], eax - - mov eax, [esp+8] - - push ebx - push ecx - push ebp - push edi - push esi - - push eax - call debug_profile_exit - add esp, 4 - - pop esi - pop edi - pop ebp - pop ecx - pop ebx - - mov eax, 1 - mov [enabled], eax - - rdtsc - mov dword ptr [start_stamp], eax - mov dword ptr [start_stamp+4], edx - - pop edx -skip: - pop eax - ret - } -} - - -/** - * Reference function for calibration. - */ -void __declspec(naked) -__debug_profile_reference(void) { - _asm { - call _penter - call _pexit - ret - } -} - - -void -debug_profile_start(void) -{ - WCHAR *p; - - /* increment starting from the less significant digit */ - p = &wFileName[14]; - while(1) { - if(*p == '9') { - *p-- = '0'; - } - else { - *p += 1; - break; - } - } - - table = EngMapFile(wFileName, - PROFILE_TABLE_SIZE*sizeof(struct debug_profile_entry), - &iFile); - if(table) { - unsigned i; - - free_table_entries = max_table_entries = PROFILE_TABLE_SIZE; - memset(table, 0, PROFILE_TABLE_SIZE*sizeof(struct debug_profile_entry)); - - table[0].caller = (uintptr_t)&__debug_profile_reference; - table[0].callee = 0; - table[0].samples = 0; - --free_table_entries; - - _asm { - push edx - push eax - - rdtsc - mov dword ptr [start_stamp], eax - mov dword ptr [start_stamp+4], edx - - pop edx - pop eax - } - - last_caller = 0; - - enabled = 1; - - for(i = 0; i < 8; ++i) { - _asm { - call __debug_profile_reference - } - } - } -} - - -void -debug_profile_stop(void) -{ - enabled = 0; - - if(iFile) - EngUnmapFile(iFile); - iFile = 0; - table = NULL; - free_table_entries = max_table_entries = 0; -} - -#endif /* PROFILE */ -- cgit v1.2.3 From 51f7763c00ca47d522ea62457fdce5df5c89d5b2 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 4 Nov 2009 07:14:55 -0700 Subject: glslcompiler: Fix Mac OS build. Signed-off-by: Brian Paul --- src/mesa/drivers/glslcompiler/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/glslcompiler/Makefile b/src/mesa/drivers/glslcompiler/Makefile index ffe4e0a234..fa8293d039 100644 --- a/src/mesa/drivers/glslcompiler/Makefile +++ b/src/mesa/drivers/glslcompiler/Makefile @@ -37,7 +37,7 @@ glslcompiler: $(OBJECTS) glslcompiler.o: glslcompiler.c - $(CC) -c $(CFLAGS) $(INCLUDES) glslcompiler.c -o $@ + $(CC) -c $(INCLUDES) $(CFLAGS) glslcompiler.c -o $@ clean: -- cgit v1.2.3 From 3040b2ee9dcb5fcf7660ae8ee2cd3f7d86e7da47 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Wed, 4 Nov 2009 14:48:25 +0000 Subject: Fix YTILE spantmp functions --- src/mesa/drivers/dri/intel/intel_spantmp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_spantmp.h b/src/mesa/drivers/dri/intel/intel_spantmp.h index 98cc6585f4..bad03398f6 100644 --- a/src/mesa/drivers/dri/intel/intel_spantmp.h +++ b/src/mesa/drivers/dri/intel/intel_spantmp.h @@ -54,8 +54,8 @@ #define SPANTMP_PIXEL_FMT INTEL_PIXEL_FMT #define SPANTMP_PIXEL_TYPE INTEL_PIXEL_TYPE -#define PUT_VALUE(_x, _y, v) INTEL_WRITE_VALUE(X_TILE(_x, _y), v) -#define GET_VALUE(_x, _y) INTEL_READ_VALUE(X_TILE(_x, _y)) +#define PUT_VALUE(_x, _y, v) INTEL_WRITE_VALUE(Y_TILE(_x, _y), v) +#define GET_VALUE(_x, _y) INTEL_READ_VALUE(Y_TILE(_x, _y)) #define TAG(x) INTEL_TAG(intel_YTile_##x) #define TAG2(x, y) INTEL_TAG(intel_YTile_##x)##y #include "spantmp2.h" -- cgit v1.2.3 From f1b91ccc0839f5088b86c3fe81eed957c1f91293 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Wed, 4 Nov 2009 14:48:25 +0000 Subject: Fix YTILE spantmp functions --- src/mesa/drivers/dri/intel/intel_spantmp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_spantmp.h b/src/mesa/drivers/dri/intel/intel_spantmp.h index ead0b1c168..35df969be3 100644 --- a/src/mesa/drivers/dri/intel/intel_spantmp.h +++ b/src/mesa/drivers/dri/intel/intel_spantmp.h @@ -48,8 +48,8 @@ #define SPANTMP_PIXEL_FMT INTEL_PIXEL_FMT #define SPANTMP_PIXEL_TYPE INTEL_PIXEL_TYPE -#define PUT_VALUE(_x, _y, v) INTEL_WRITE_VALUE(X_TILE(_x, _y), v) -#define GET_VALUE(_x, _y) INTEL_READ_VALUE(X_TILE(_x, _y)) +#define PUT_VALUE(_x, _y, v) INTEL_WRITE_VALUE(Y_TILE(_x, _y), v) +#define GET_VALUE(_x, _y) INTEL_READ_VALUE(Y_TILE(_x, _y)) #define TAG(x) INTEL_TAG(intel_YTile_##x) #define TAG2(x, y) INTEL_TAG(intel_YTile_##x)##y #include "spantmp2.h" -- cgit v1.2.3 From 70dade8afeadf83c6c993b39d3322e7c9353eea7 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 4 Nov 2009 14:43:24 -0500 Subject: r600: fix count prediction for IB case Signed-off-by: Alex Deucher --- src/mesa/drivers/dri/r600/r700_render.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index 268bfd8bf0..b20b129d17 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -379,7 +379,7 @@ static GLuint r700PredictRenderSize(GLcontext* ctx, dwords = PRE_EMIT_STATE_BUFSZ; if (ib) - dwords += nr_prims * 14; + dwords += nr_prims * 17; else { for (i = 0; i < nr_prims; ++i) { -- cgit v1.2.3 From 9fce12b894c3af33d7a0732332446893682a48d5 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 4 Nov 2009 16:59:13 -0500 Subject: r600: rework draw functions Seems INDX_OFFSET doesn't work properly on some cards, so change back to immediate mode indices. Seems to only affect DRI1. Needs more investigation. Rework and clean up the draw functions. Signed-off-by: Alex Deucher --- src/mesa/drivers/dri/r600/r700_render.c | 198 +++++++++++++++++++++----------- 1 file changed, 134 insertions(+), 64 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index b20b129d17..c345b9d8ac 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -259,16 +259,6 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim uint32_t vgt_index_type = 0; uint32_t vgt_primitive_type = 0; uint32_t vgt_num_indices = 0; - GLboolean bUseDrawIndex; - - if(NULL != context->ind_buf.bo) - { - bUseDrawIndex = GL_TRUE; - } - else - { - bUseDrawIndex = GL_FALSE; - } type = r700PrimitiveType(prim); num_indices = r700NumVerts(end - start, prim); @@ -280,85 +270,154 @@ static void r700RunRenderPrimitive(GLcontext * ctx, int start, int end, int prim if (type < 0 || num_indices <= 0) return; - if(GL_TRUE == bUseDrawIndex) - { - total_emit = 3 /* VGT_PRIMITIVE_TYPE */ - + 2 /* VGT_INDEX_TYPE */ - + 2 /* NUM_INSTANCES */ - + 3 /* VGT_INDEX_OFFSET */ - + 5 + 2; /* DRAW_INDEX */ - } - else - { - total_emit = 3 /* VGT_PRIMITIVE_TYPE */ - + 2 /* VGT_INDEX_TYPE */ - + 2 /* NUM_INSTANCES */ - + 3 /* VGT_INDEX_OFFSET */ - + 3; /* DRAW_INDEX_AUTO */ - } - - BEGIN_BATCH_NO_AUTOSTATE(total_emit); - // prim SETfield(vgt_primitive_type, type, VGT_PRIMITIVE_TYPE__PRIM_TYPE_shift, VGT_PRIMITIVE_TYPE__PRIM_TYPE_mask); - R600_OUT_BATCH(CP_PACKET3(R600_IT_SET_CONFIG_REG, 1)); - R600_OUT_BATCH(mmVGT_PRIMITIVE_TYPE - ASIC_CONFIG_BASE_INDEX); - R600_OUT_BATCH(vgt_primitive_type); - // index type SETfield(vgt_index_type, DI_INDEX_SIZE_32_BIT, INDEX_TYPE_shift, INDEX_TYPE_mask); - if(GL_TRUE == bUseDrawIndex) + if(GL_TRUE != context->ind_buf.is_32bit) { - if(GL_TRUE != context->ind_buf.is_32bit) - { SETfield(vgt_index_type, DI_INDEX_SIZE_16_BIT, INDEX_TYPE_shift, INDEX_TYPE_mask); - } } + vgt_num_indices = num_indices; + SETfield(vgt_draw_initiator, DI_SRC_SEL_DMA, SOURCE_SELECT_shift, SOURCE_SELECT_mask); + SETfield(vgt_draw_initiator, DI_MAJOR_MODE_0, MAJOR_MODE_shift, MAJOR_MODE_mask); + + total_emit = 3 /* VGT_PRIMITIVE_TYPE */ + + 2 /* VGT_INDEX_TYPE */ + + 2 /* NUM_INSTANCES */ + + 5 + 2; /* DRAW_INDEX */ + + BEGIN_BATCH_NO_AUTOSTATE(total_emit); + // prim + R600_OUT_BATCH_REGSEQ(VGT_PRIMITIVE_TYPE, 1); + R600_OUT_BATCH(vgt_primitive_type); + // index type R600_OUT_BATCH(CP_PACKET3(R600_IT_INDEX_TYPE, 0)); R600_OUT_BATCH(vgt_index_type); - // num instances R600_OUT_BATCH(CP_PACKET3(R600_IT_NUM_INSTANCES, 0)); R600_OUT_BATCH(1); - // draw packet - vgt_num_indices = num_indices; + R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX, 3)); + R600_OUT_BATCH(context->ind_buf.bo_offset); + R600_OUT_BATCH(0); + R600_OUT_BATCH(vgt_num_indices); + R600_OUT_BATCH(vgt_draw_initiator); + R600_OUT_BATCH_RELOC(context->ind_buf.bo_offset, + context->ind_buf.bo, + context->ind_buf.bo_offset, + RADEON_GEM_DOMAIN_GTT, 0, 0); + END_BATCH(); + COMMIT_BATCH(); +} + +static void r700RunRenderPrimitiveImmediate(GLcontext * ctx, int start, int end, int prim) +{ + context_t *context = R700_CONTEXT(ctx); + BATCH_LOCALS(&context->radeon); + int type, i; + uint32_t num_indices, total_emit = 0; + uint32_t vgt_draw_initiator = 0; + uint32_t vgt_index_type = 0; + uint32_t vgt_primitive_type = 0; + uint32_t vgt_num_indices = 0; + + type = r700PrimitiveType(prim); + num_indices = r700NumVerts(end - start, prim); - if(GL_TRUE == bUseDrawIndex) + radeon_print(RADEON_RENDER, RADEON_TRACE, + "%s type %x num_indices %d\n", + __func__, type, num_indices); + + if (type < 0 || num_indices <= 0) + return; + + SETfield(vgt_primitive_type, type, + VGT_PRIMITIVE_TYPE__PRIM_TYPE_shift, VGT_PRIMITIVE_TYPE__PRIM_TYPE_mask); + + if (num_indices > 0xffff) { - SETfield(vgt_draw_initiator, DI_SRC_SEL_DMA, SOURCE_SELECT_shift, SOURCE_SELECT_mask); + SETfield(vgt_index_type, DI_INDEX_SIZE_32_BIT, INDEX_TYPE_shift, INDEX_TYPE_mask); } else { - SETfield(vgt_draw_initiator, DI_SRC_SEL_AUTO_INDEX, SOURCE_SELECT_shift, SOURCE_SELECT_mask); + SETfield(vgt_index_type, DI_INDEX_SIZE_16_BIT, INDEX_TYPE_shift, INDEX_TYPE_mask); } + vgt_num_indices = num_indices; SETfield(vgt_draw_initiator, DI_MAJOR_MODE_0, MAJOR_MODE_shift, MAJOR_MODE_mask); - if(GL_TRUE == bUseDrawIndex) + if (start == 0) { - R600_OUT_BATCH_REGSEQ(VGT_INDX_OFFSET, 1); - R600_OUT_BATCH(0); - R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX, 3)); - R600_OUT_BATCH(context->ind_buf.bo_offset); - R600_OUT_BATCH(0); - R600_OUT_BATCH(vgt_num_indices); - R600_OUT_BATCH(vgt_draw_initiator); - R600_OUT_BATCH_RELOC(context->ind_buf.bo_offset, - context->ind_buf.bo, - context->ind_buf.bo_offset, - RADEON_GEM_DOMAIN_GTT, 0, 0); + SETfield(vgt_draw_initiator, DI_SRC_SEL_AUTO_INDEX, SOURCE_SELECT_shift, SOURCE_SELECT_mask); } else { - R600_OUT_BATCH_REGSEQ(VGT_INDX_OFFSET, 1); - R600_OUT_BATCH(start); - R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX_AUTO,1)); + if (num_indices > 0xffff) + { + total_emit += num_indices; + } + else + { + total_emit += (num_indices + 1) / 2; + } + SETfield(vgt_draw_initiator, DI_SRC_SEL_IMMEDIATE, SOURCE_SELECT_shift, SOURCE_SELECT_mask); + } + + total_emit += 3 /* VGT_PRIMITIVE_TYPE */ + + 2 /* VGT_INDEX_TYPE */ + + 2 /* NUM_INSTANCES */ + + 3; /* DRAW */ + + BEGIN_BATCH_NO_AUTOSTATE(total_emit); + // prim + R600_OUT_BATCH_REGSEQ(VGT_PRIMITIVE_TYPE, 1); + R600_OUT_BATCH(vgt_primitive_type); + // index type + R600_OUT_BATCH(CP_PACKET3(R600_IT_INDEX_TYPE, 0)); + R600_OUT_BATCH(vgt_index_type); + // num instances + R600_OUT_BATCH(CP_PACKET3(R600_IT_NUM_INSTANCES, 0)); + R600_OUT_BATCH(1); + // draw packet + if(start == 0) + { + R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX_AUTO, 1)); R600_OUT_BATCH(vgt_num_indices); R600_OUT_BATCH(vgt_draw_initiator); } + else + { + if (num_indices > 0xffff) + { + R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX_IMMD, (num_indices + 1))); + R600_OUT_BATCH(vgt_num_indices); + R600_OUT_BATCH(vgt_draw_initiator); + for (i = start; i < (start + num_indices); i++) + { + R600_OUT_BATCH(i); + } + } + else + { + R600_OUT_BATCH(CP_PACKET3(R600_IT_DRAW_INDEX_IMMD, (((num_indices + 1) / 2) + 1))); + R600_OUT_BATCH(vgt_num_indices); + R600_OUT_BATCH(vgt_draw_initiator); + for (i = start; i < (start + num_indices); i += 2) + { + if ((i + 1) == (start + num_indices)) + { + R600_OUT_BATCH(i); + } + else + { + R600_OUT_BATCH(((i + 1) << 16) | (i)); + } + } + } + } END_BATCH(); COMMIT_BATCH(); @@ -379,11 +438,16 @@ static GLuint r700PredictRenderSize(GLcontext* ctx, dwords = PRE_EMIT_STATE_BUFSZ; if (ib) - dwords += nr_prims * 17; + dwords += nr_prims * 14; else { for (i = 0; i < nr_prims; ++i) { - dwords += 13; + if (prim[i].start == 0) + dwords += 10; + else if (prim[i].count > 0xffff) + dwords += prim[i].count + 10; + else + dwords += ((prim[i].count + 1) / 2) + 10; } } @@ -840,10 +904,16 @@ static GLboolean r700TryDrawPrims(GLcontext *ctx, radeon_debug_add_indent(); for (i = 0; i < nr_prims; ++i) { - r700RunRenderPrimitive(ctx, - prim[i].start, - prim[i].start + prim[i].count, - prim[i].mode); + if (context->ind_buf.bo) + r700RunRenderPrimitive(ctx, + prim[i].start, + prim[i].start + prim[i].count, + prim[i].mode); + else + r700RunRenderPrimitiveImmediate(ctx, + prim[i].start, + prim[i].start + prim[i].count, + prim[i].mode); } radeon_debug_remove_indent(); -- cgit v1.2.3 From 4c5a758d064d1a8fca245d4ffeb2f80ba8c781e3 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 4 Nov 2009 18:08:44 -0500 Subject: st/xorg: these flushes shouldn't be necessary performance optimization --- src/gallium/state_trackers/xorg/xorg_composite.c | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 1bc3350e8b..a8d779b8ad 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -290,12 +290,6 @@ bind_samplers(struct exa_context *exa, int op, memset(&src_sampler, 0, sizeof(struct pipe_sampler_state)); memset(&mask_sampler, 0, sizeof(struct pipe_sampler_state)); - if ((pSrc && exa->pipe->is_texture_referenced(exa->pipe, pSrc->tex, 0, 0) & - PIPE_REFERENCED_FOR_WRITE) || - (pMask && exa->pipe->is_texture_referenced(exa->pipe, pMask->tex, 0, 0) & - PIPE_REFERENCED_FOR_WRITE)) - exa->pipe->flush(exa->pipe, PIPE_FLUSH_RENDER_CACHE, NULL); - if (pSrcPicture && pSrc) { if (exa->has_solid_color) { debug_assert(!"solid color with textures"); -- cgit v1.2.3 From fe86f8d73268785b31bc8d5a278a233bff42034d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 4 Nov 2009 17:26:48 -0700 Subject: ARB prog parser: include variable name in error text --- src/mesa/shader/program_parse.tab.c | 1065 ++++++++++++++++++++++++----------- src/mesa/shader/program_parse.tab.h | 151 +---- src/mesa/shader/program_parse.y | 5 +- 3 files changed, 751 insertions(+), 470 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c index 7f45e0987d..e57c83ea65 100644 --- a/src/mesa/shader/program_parse.tab.c +++ b/src/mesa/shader/program_parse.tab.c @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton implementation for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,7 +28,7 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ @@ -47,7 +46,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.3" +#define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -55,235 +54,20 @@ /* Pure parsers. */ #define YYPURE 1 -/* Using locations. */ -#define YYLSP_NEEDED 1 - +/* Push parsers. */ +#define YYPUSH 0 +/* Pull parsers. */ +#define YYPULL 1 -/* Tokens. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - /* Put the tokens into the symbol table, so that GDB and other debuggers - know about them. */ - enum yytokentype { - ARBvp_10 = 258, - ARBfp_10 = 259, - ADDRESS = 260, - ALIAS = 261, - ATTRIB = 262, - OPTION = 263, - OUTPUT = 264, - PARAM = 265, - TEMP = 266, - END = 267, - BIN_OP = 268, - BINSC_OP = 269, - SAMPLE_OP = 270, - SCALAR_OP = 271, - TRI_OP = 272, - VECTOR_OP = 273, - ARL = 274, - KIL = 275, - SWZ = 276, - TXD_OP = 277, - INTEGER = 278, - REAL = 279, - AMBIENT = 280, - ATTENUATION = 281, - BACK = 282, - CLIP = 283, - COLOR = 284, - DEPTH = 285, - DIFFUSE = 286, - DIRECTION = 287, - EMISSION = 288, - ENV = 289, - EYE = 290, - FOG = 291, - FOGCOORD = 292, - FRAGMENT = 293, - FRONT = 294, - HALF = 295, - INVERSE = 296, - INVTRANS = 297, - LIGHT = 298, - LIGHTMODEL = 299, - LIGHTPROD = 300, - LOCAL = 301, - MATERIAL = 302, - MAT_PROGRAM = 303, - MATRIX = 304, - MATRIXINDEX = 305, - MODELVIEW = 306, - MVP = 307, - NORMAL = 308, - OBJECT = 309, - PALETTE = 310, - PARAMS = 311, - PLANE = 312, - POINT_TOK = 313, - POINTSIZE = 314, - POSITION = 315, - PRIMARY = 316, - PROGRAM = 317, - PROJECTION = 318, - RANGE = 319, - RESULT = 320, - ROW = 321, - SCENECOLOR = 322, - SECONDARY = 323, - SHININESS = 324, - SIZE_TOK = 325, - SPECULAR = 326, - SPOT = 327, - STATE = 328, - TEXCOORD = 329, - TEXENV = 330, - TEXGEN = 331, - TEXGEN_Q = 332, - TEXGEN_R = 333, - TEXGEN_S = 334, - TEXGEN_T = 335, - TEXTURE = 336, - TRANSPOSE = 337, - TEXTURE_UNIT = 338, - TEX_1D = 339, - TEX_2D = 340, - TEX_3D = 341, - TEX_CUBE = 342, - TEX_RECT = 343, - TEX_SHADOW1D = 344, - TEX_SHADOW2D = 345, - TEX_SHADOWRECT = 346, - TEX_ARRAY1D = 347, - TEX_ARRAY2D = 348, - TEX_ARRAYSHADOW1D = 349, - TEX_ARRAYSHADOW2D = 350, - VERTEX = 351, - VTXATTRIB = 352, - WEIGHT = 353, - IDENTIFIER = 354, - USED_IDENTIFIER = 355, - MASK4 = 356, - MASK3 = 357, - MASK2 = 358, - MASK1 = 359, - SWIZZLE = 360, - DOT_DOT = 361, - DOT = 362 - }; -#endif -/* Tokens. */ -#define ARBvp_10 258 -#define ARBfp_10 259 -#define ADDRESS 260 -#define ALIAS 261 -#define ATTRIB 262 -#define OPTION 263 -#define OUTPUT 264 -#define PARAM 265 -#define TEMP 266 -#define END 267 -#define BIN_OP 268 -#define BINSC_OP 269 -#define SAMPLE_OP 270 -#define SCALAR_OP 271 -#define TRI_OP 272 -#define VECTOR_OP 273 -#define ARL 274 -#define KIL 275 -#define SWZ 276 -#define TXD_OP 277 -#define INTEGER 278 -#define REAL 279 -#define AMBIENT 280 -#define ATTENUATION 281 -#define BACK 282 -#define CLIP 283 -#define COLOR 284 -#define DEPTH 285 -#define DIFFUSE 286 -#define DIRECTION 287 -#define EMISSION 288 -#define ENV 289 -#define EYE 290 -#define FOG 291 -#define FOGCOORD 292 -#define FRAGMENT 293 -#define FRONT 294 -#define HALF 295 -#define INVERSE 296 -#define INVTRANS 297 -#define LIGHT 298 -#define LIGHTMODEL 299 -#define LIGHTPROD 300 -#define LOCAL 301 -#define MATERIAL 302 -#define MAT_PROGRAM 303 -#define MATRIX 304 -#define MATRIXINDEX 305 -#define MODELVIEW 306 -#define MVP 307 -#define NORMAL 308 -#define OBJECT 309 -#define PALETTE 310 -#define PARAMS 311 -#define PLANE 312 -#define POINT_TOK 313 -#define POINTSIZE 314 -#define POSITION 315 -#define PRIMARY 316 -#define PROGRAM 317 -#define PROJECTION 318 -#define RANGE 319 -#define RESULT 320 -#define ROW 321 -#define SCENECOLOR 322 -#define SECONDARY 323 -#define SHININESS 324 -#define SIZE_TOK 325 -#define SPECULAR 326 -#define SPOT 327 -#define STATE 328 -#define TEXCOORD 329 -#define TEXENV 330 -#define TEXGEN 331 -#define TEXGEN_Q 332 -#define TEXGEN_R 333 -#define TEXGEN_S 334 -#define TEXGEN_T 335 -#define TEXTURE 336 -#define TRANSPOSE 337 -#define TEXTURE_UNIT 338 -#define TEX_1D 339 -#define TEX_2D 340 -#define TEX_3D 341 -#define TEX_CUBE 342 -#define TEX_RECT 343 -#define TEX_SHADOW1D 344 -#define TEX_SHADOW2D 345 -#define TEX_SHADOWRECT 346 -#define TEX_ARRAY1D 347 -#define TEX_ARRAY2D 348 -#define TEX_ARRAYSHADOW1D 349 -#define TEX_ARRAYSHADOW2D 350 -#define VERTEX 351 -#define VTXATTRIB 352 -#define WEIGHT 353 -#define IDENTIFIER 354 -#define USED_IDENTIFIER 355 -#define MASK4 356 -#define MASK3 357 -#define MASK2 358 -#define MASK1 359 -#define SWIZZLE 360 -#define DOT_DOT 361 -#define DOT 362 - +/* Using locations. */ +#define YYLSP_NEEDED 1 /* Copy the first part of user declarations. */ + +/* Line 189 of yacc.c */ #line 1 "program_parse.y" /* @@ -400,6 +184,9 @@ static struct asm_instruction *asm_instruction_copy_ctor( #define YYLEX_PARAM state->scanner +/* Line 189 of yacc.c */ +#line 189 "program_parse.tab.c" + /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 @@ -418,10 +205,130 @@ static struct asm_instruction *asm_instruction_copy_ctor( # define YYTOKEN_TABLE 0 #endif + +/* Tokens. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + /* Put the tokens into the symbol table, so that GDB and other debuggers + know about them. */ + enum yytokentype { + ARBvp_10 = 258, + ARBfp_10 = 259, + ADDRESS = 260, + ALIAS = 261, + ATTRIB = 262, + OPTION = 263, + OUTPUT = 264, + PARAM = 265, + TEMP = 266, + END = 267, + BIN_OP = 268, + BINSC_OP = 269, + SAMPLE_OP = 270, + SCALAR_OP = 271, + TRI_OP = 272, + VECTOR_OP = 273, + ARL = 274, + KIL = 275, + SWZ = 276, + TXD_OP = 277, + INTEGER = 278, + REAL = 279, + AMBIENT = 280, + ATTENUATION = 281, + BACK = 282, + CLIP = 283, + COLOR = 284, + DEPTH = 285, + DIFFUSE = 286, + DIRECTION = 287, + EMISSION = 288, + ENV = 289, + EYE = 290, + FOG = 291, + FOGCOORD = 292, + FRAGMENT = 293, + FRONT = 294, + HALF = 295, + INVERSE = 296, + INVTRANS = 297, + LIGHT = 298, + LIGHTMODEL = 299, + LIGHTPROD = 300, + LOCAL = 301, + MATERIAL = 302, + MAT_PROGRAM = 303, + MATRIX = 304, + MATRIXINDEX = 305, + MODELVIEW = 306, + MVP = 307, + NORMAL = 308, + OBJECT = 309, + PALETTE = 310, + PARAMS = 311, + PLANE = 312, + POINT_TOK = 313, + POINTSIZE = 314, + POSITION = 315, + PRIMARY = 316, + PROGRAM = 317, + PROJECTION = 318, + RANGE = 319, + RESULT = 320, + ROW = 321, + SCENECOLOR = 322, + SECONDARY = 323, + SHININESS = 324, + SIZE_TOK = 325, + SPECULAR = 326, + SPOT = 327, + STATE = 328, + TEXCOORD = 329, + TEXENV = 330, + TEXGEN = 331, + TEXGEN_Q = 332, + TEXGEN_R = 333, + TEXGEN_S = 334, + TEXGEN_T = 335, + TEXTURE = 336, + TRANSPOSE = 337, + TEXTURE_UNIT = 338, + TEX_1D = 339, + TEX_2D = 340, + TEX_3D = 341, + TEX_CUBE = 342, + TEX_RECT = 343, + TEX_SHADOW1D = 344, + TEX_SHADOW2D = 345, + TEX_SHADOWRECT = 346, + TEX_ARRAY1D = 347, + TEX_ARRAY2D = 348, + TEX_ARRAYSHADOW1D = 349, + TEX_ARRAYSHADOW2D = 350, + VERTEX = 351, + VTXATTRIB = 352, + WEIGHT = 353, + IDENTIFIER = 354, + USED_IDENTIFIER = 355, + MASK4 = 356, + MASK3 = 357, + MASK2 = 358, + MASK1 = 359, + SWIZZLE = 360, + DOT_DOT = 361, + DOT = 362 + }; +#endif + + + #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 122 "program_parse.y" { + +/* Line 214 of yacc.c */ +#line 122 "program_parse.y" + struct asm_instruction *inst; struct asm_symbol *sym; struct asm_symbol temp_sym; @@ -445,13 +352,15 @@ typedef union YYSTYPE unsigned xyzw_valid:1; unsigned negate:1; } ext_swizzle; -} -/* Line 187 of yacc.c. */ -#line 451 "program_parse.tab.c" - YYSTYPE; + + + +/* Line 214 of yacc.c */ +#line 360 "program_parse.tab.c" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED @@ -469,14 +378,16 @@ typedef struct YYLTYPE /* Copy the second part of user declarations. */ + +/* Line 264 of yacc.c */ #line 267 "program_parse.y" extern int yylex(YYSTYPE *yylval_param, YYLTYPE *yylloc_param, void *yyscanner); -/* Line 216 of yacc.c. */ -#line 480 "program_parse.tab.c" +/* Line 264 of yacc.c */ +#line 391 "program_parse.tab.c" #ifdef short # undef short @@ -551,14 +462,14 @@ typedef short int yytype_int16; #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int -YYID (int i) +YYID (int yyi) #else static int -YYID (i) - int i; +YYID (yyi) + int yyi; #endif { - return i; + return yyi; } #endif @@ -640,9 +551,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; - YYSTYPE yyvs; - YYLTYPE yyls; + yytype_int16 yyss_alloc; + YYSTYPE yyvs_alloc; + YYLTYPE yyls_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ @@ -677,12 +588,12 @@ union yyalloc elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ -# define YYSTACK_RELOCATE(Stack) \ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack, Stack, yysize); \ - Stack = &yyptr->Stack; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ @@ -905,7 +816,7 @@ static const yytype_uint16 yyrline[] = 1949, 1957, 1970, 1979, 1988, 1992, 2001, 2010, 2021, 2028, 2033, 2042, 2054, 2057, 2066, 2077, 2078, 2079, 2082, 2083, 2084, 2087, 2088, 2091, 2092, 2095, 2096, 2099, 2110, 2121, - 2132, 2153, 2154 + 2132, 2154, 2155 }; #endif @@ -1553,17 +1464,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp, state) #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void -yy_stack_print (bottom, top) - yytype_int16 *bottom; - yytype_int16 *top; +yy_stack_print (yybottom, yytop) + yytype_int16 *yybottom; + yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); - for (; bottom <= top; ++bottom) - YYFPRINTF (stderr, " %d", *bottom); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } YYFPRINTF (stderr, "\n"); } @@ -1599,11 +1513,11 @@ yy_reduce_print (yyvsp, yylsp, yyrule, state) /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { - fprintf (stderr, " $%d = ", yyi + 1); + YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) , &(yylsp[(yyi + 1) - (yynrhs)]) , state); - fprintf (stderr, "\n"); + YYFPRINTF (stderr, "\n"); } } @@ -1887,10 +1801,8 @@ yydestruct (yymsg, yytype, yyvaluep, yylocationp, state) break; } } - /* Prevent warnings from -Wmissing-prototypes. */ - #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); @@ -1909,10 +1821,9 @@ int yyparse (); - -/*----------. -| yyparse. | -`----------*/ +/*-------------------------. +| yyparse or yypush_parse. | +`-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ @@ -1936,24 +1847,59 @@ yyparse (state) #endif #endif { - /* The look-ahead symbol. */ +/* The lookahead symbol. */ int yychar; -/* The semantic value of the look-ahead symbol. */ +/* The semantic value of the lookahead symbol. */ YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; -/* Location data for the look-ahead symbol. */ +/* Location data for the lookahead symbol. */ YYLTYPE yylloc; - int yystate; + /* Number of syntax errors so far. */ + int yynerrs; + + int yystate; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus; + + /* The stacks and their tools: + `yyss': related to states. + `yyvs': related to semantic values. + `yyls': related to locations. + + Refer to the stacks thru separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* The state stack. */ + yytype_int16 yyssa[YYINITDEPTH]; + yytype_int16 *yyss; + yytype_int16 *yyssp; + + /* The semantic value stack. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs; + YYSTYPE *yyvsp; + + /* The location stack. */ + YYLTYPE yylsa[YYINITDEPTH]; + YYLTYPE *yyls; + YYLTYPE *yylsp; + + /* The locations where the error started and ended. */ + YYLTYPE yyerror_range[2]; + + YYSIZE_T yystacksize; + int yyn; int yyresult; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - /* Look-ahead token as an internal (translated) token number. */ - int yytoken = 0; + /* Lookahead token as an internal (translated) token number. */ + int yytoken; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + YYLTYPE yyloc; + #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; @@ -1961,63 +1907,37 @@ YYLTYPE yylloc; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif - /* Three stacks and their tools: - `yyss': related to states, - `yyvs': related to semantic values, - `yyls': related to locations. - - Refer to the stacks thru separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss = yyssa; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs = yyvsa; - YYSTYPE *yyvsp; - - /* The location stack. */ - YYLTYPE yylsa[YYINITDEPTH]; - YYLTYPE *yyls = yylsa; - YYLTYPE *yylsp; - /* The locations where the error started and ended. */ - YYLTYPE yyerror_range[2]; - #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) - YYSIZE_T yystacksize = YYINITDEPTH; - - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - YYLTYPE yyloc; - /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; + yytoken = 0; + yyss = yyssa; + yyvs = yyvsa; + yyls = yylsa; + yystacksize = YYINITDEPTH; + YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ + yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ - yyssp = yyss; yyvsp = yyvs; yylsp = yyls; + #if YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; - yylloc.first_column = yylloc.last_column = 0; + yylloc.first_column = yylloc.last_column = 1; #endif goto yysetstate; @@ -2056,6 +1976,7 @@ YYLTYPE yylloc; &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); + yyls = yyls1; yyss = yyss1; yyvs = yyvs1; @@ -2077,9 +1998,9 @@ YYLTYPE yylloc; (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss); - YYSTACK_RELOCATE (yyvs); - YYSTACK_RELOCATE (yyls); + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); + YYSTACK_RELOCATE (yyls_alloc, yyls); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); @@ -2100,6 +2021,9 @@ YYLTYPE yylloc; YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + if (yystate == YYFINAL) + YYACCEPT; + goto yybackup; /*-----------. @@ -2108,16 +2032,16 @@ YYLTYPE yylloc; yybackup: /* Do appropriate processing given the current state. Read a - look-ahead token if we need one and don't already have one. */ + lookahead token if we need one and don't already have one. */ - /* First try to decide what to do without reference to look-ahead token. */ + /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; - /* Not known => get a look-ahead token if don't already have one. */ + /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); @@ -2149,20 +2073,16 @@ yybackup: goto yyreduce; } - if (yyn == YYFINAL) - YYACCEPT; - /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; - /* Shift the look-ahead token. */ + /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - /* Discard the shifted token unless it is eof. */ - if (yychar != YYEOF) - yychar = YYEMPTY; + /* Discard the shifted token. */ + yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; @@ -2203,6 +2123,8 @@ yyreduce: switch (yyn) { case 3: + +/* Line 1455 of yacc.c */ #line 278 "program_parse.y" { if (state->prog->Target != GL_VERTEX_PROGRAM_ARB) { @@ -2214,6 +2136,8 @@ yyreduce: break; case 4: + +/* Line 1455 of yacc.c */ #line 286 "program_parse.y" { if (state->prog->Target != GL_FRAGMENT_PROGRAM_ARB) { @@ -2227,6 +2151,8 @@ yyreduce: break; case 7: + +/* Line 1455 of yacc.c */ #line 302 "program_parse.y" { int valid = 0; @@ -2250,6 +2176,8 @@ yyreduce: break; case 10: + +/* Line 1455 of yacc.c */ #line 328 "program_parse.y" { if ((yyvsp[(1) - (2)].inst) != NULL) { @@ -2268,6 +2196,8 @@ yyreduce: break; case 12: + +/* Line 1455 of yacc.c */ #line 346 "program_parse.y" { (yyval.inst) = (yyvsp[(1) - (1)].inst); @@ -2276,6 +2206,8 @@ yyreduce: break; case 13: + +/* Line 1455 of yacc.c */ #line 351 "program_parse.y" { (yyval.inst) = (yyvsp[(1) - (1)].inst); @@ -2284,6 +2216,8 @@ yyreduce: break; case 24: + +/* Line 1455 of yacc.c */ #line 372 "program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_ARL, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); @@ -2291,6 +2225,8 @@ yyreduce: break; case 25: + +/* Line 1455 of yacc.c */ #line 378 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); @@ -2298,6 +2234,8 @@ yyreduce: break; case 26: + +/* Line 1455 of yacc.c */ #line 384 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (4)].temp_inst), & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); @@ -2305,6 +2243,8 @@ yyreduce: break; case 27: + +/* Line 1455 of yacc.c */ #line 390 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL); @@ -2312,6 +2252,8 @@ yyreduce: break; case 28: + +/* Line 1455 of yacc.c */ #line 397 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (6)].temp_inst), & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL); @@ -2319,6 +2261,8 @@ yyreduce: break; case 29: + +/* Line 1455 of yacc.c */ #line 404 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (8)].temp_inst), & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), & (yyvsp[(6) - (8)].src_reg), & (yyvsp[(8) - (8)].src_reg)); @@ -2326,6 +2270,8 @@ yyreduce: break; case 30: + +/* Line 1455 of yacc.c */ #line 410 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (8)].temp_inst), & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), NULL, NULL); @@ -2371,6 +2317,8 @@ yyreduce: break; case 31: + +/* Line 1455 of yacc.c */ #line 454 "program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_KIL, NULL, & (yyvsp[(2) - (2)].src_reg), NULL, NULL); @@ -2379,6 +2327,8 @@ yyreduce: break; case 32: + +/* Line 1455 of yacc.c */ #line 459 "program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_KIL_NV, NULL, NULL, NULL, NULL); @@ -2390,6 +2340,8 @@ yyreduce: break; case 33: + +/* Line 1455 of yacc.c */ #line 469 "program_parse.y" { (yyval.inst) = asm_instruction_copy_ctor(& (yyvsp[(1) - (12)].temp_inst), & (yyvsp[(2) - (12)].dst_reg), & (yyvsp[(4) - (12)].src_reg), & (yyvsp[(6) - (12)].src_reg), & (yyvsp[(8) - (12)].src_reg)); @@ -2435,6 +2387,8 @@ yyreduce: break; case 34: + +/* Line 1455 of yacc.c */ #line 513 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); @@ -2442,66 +2396,92 @@ yyreduce: break; case 35: + +/* Line 1455 of yacc.c */ #line 518 "program_parse.y" { (yyval.integer) = TEXTURE_1D_INDEX; ;} break; case 36: + +/* Line 1455 of yacc.c */ #line 519 "program_parse.y" { (yyval.integer) = TEXTURE_2D_INDEX; ;} break; case 37: + +/* Line 1455 of yacc.c */ #line 520 "program_parse.y" { (yyval.integer) = TEXTURE_3D_INDEX; ;} break; case 38: + +/* Line 1455 of yacc.c */ #line 521 "program_parse.y" { (yyval.integer) = TEXTURE_CUBE_INDEX; ;} break; case 39: + +/* Line 1455 of yacc.c */ #line 522 "program_parse.y" { (yyval.integer) = TEXTURE_RECT_INDEX; ;} break; case 40: + +/* Line 1455 of yacc.c */ #line 523 "program_parse.y" { (yyval.integer) = -TEXTURE_1D_INDEX; ;} break; case 41: + +/* Line 1455 of yacc.c */ #line 524 "program_parse.y" { (yyval.integer) = -TEXTURE_2D_INDEX; ;} break; case 42: + +/* Line 1455 of yacc.c */ #line 525 "program_parse.y" { (yyval.integer) = -TEXTURE_RECT_INDEX; ;} break; case 43: + +/* Line 1455 of yacc.c */ #line 526 "program_parse.y" { (yyval.integer) = TEXTURE_1D_ARRAY_INDEX; ;} break; case 44: + +/* Line 1455 of yacc.c */ #line 527 "program_parse.y" { (yyval.integer) = TEXTURE_2D_ARRAY_INDEX; ;} break; case 45: + +/* Line 1455 of yacc.c */ #line 528 "program_parse.y" { (yyval.integer) = -TEXTURE_1D_ARRAY_INDEX; ;} break; case 46: + +/* Line 1455 of yacc.c */ #line 529 "program_parse.y" { (yyval.integer) = -TEXTURE_2D_ARRAY_INDEX; ;} break; case 47: + +/* Line 1455 of yacc.c */ #line 533 "program_parse.y" { /* FIXME: Is this correct? Should the extenedSwizzle be applied @@ -2515,6 +2495,8 @@ yyreduce: break; case 48: + +/* Line 1455 of yacc.c */ #line 545 "program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (2)].src_reg); @@ -2526,6 +2508,8 @@ yyreduce: break; case 49: + +/* Line 1455 of yacc.c */ #line 553 "program_parse.y" { (yyval.src_reg) = (yyvsp[(3) - (4)].src_reg); @@ -2544,6 +2528,8 @@ yyreduce: break; case 50: + +/* Line 1455 of yacc.c */ #line 570 "program_parse.y" { (yyval.src_reg) = (yyvsp[(1) - (2)].src_reg); @@ -2554,6 +2540,8 @@ yyreduce: break; case 51: + +/* Line 1455 of yacc.c */ #line 577 "program_parse.y" { struct asm_symbol temp_sym; @@ -2572,6 +2560,8 @@ yyreduce: break; case 52: + +/* Line 1455 of yacc.c */ #line 594 "program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (3)].src_reg); @@ -2586,6 +2576,8 @@ yyreduce: break; case 53: + +/* Line 1455 of yacc.c */ #line 605 "program_parse.y" { (yyval.src_reg) = (yyvsp[(3) - (5)].src_reg); @@ -2606,6 +2598,8 @@ yyreduce: break; case 54: + +/* Line 1455 of yacc.c */ #line 625 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (3)].dst_reg); @@ -2632,6 +2626,8 @@ yyreduce: break; case 55: + +/* Line 1455 of yacc.c */ #line 650 "program_parse.y" { set_dst_reg(& (yyval.dst_reg), PROGRAM_ADDRESS, 0); @@ -2640,6 +2636,8 @@ yyreduce: break; case 56: + +/* Line 1455 of yacc.c */ #line 657 "program_parse.y" { const unsigned xyzw_valid = @@ -2674,6 +2672,8 @@ yyreduce: break; case 57: + +/* Line 1455 of yacc.c */ #line 690 "program_parse.y" { (yyval.ext_swizzle) = (yyvsp[(2) - (2)].ext_swizzle); @@ -2682,6 +2682,8 @@ yyreduce: break; case 58: + +/* Line 1455 of yacc.c */ #line 697 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) != 0) && ((yyvsp[(1) - (1)].integer) != 1)) { @@ -2700,6 +2702,8 @@ yyreduce: break; case 59: + +/* Line 1455 of yacc.c */ #line 712 "program_parse.y" { if (strlen((yyvsp[(1) - (1)].string)) > 1) { @@ -2751,6 +2755,8 @@ yyreduce: break; case 60: + +/* Line 1455 of yacc.c */ #line 762 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) @@ -2793,6 +2799,8 @@ yyreduce: break; case 61: + +/* Line 1455 of yacc.c */ #line 801 "program_parse.y" { set_src_reg(& (yyval.src_reg), PROGRAM_INPUT, (yyvsp[(1) - (1)].attrib)); @@ -2805,6 +2813,8 @@ yyreduce: break; case 62: + +/* Line 1455 of yacc.c */ #line 810 "program_parse.y" { if (! (yyvsp[(3) - (4)].src_reg).Base.RelAddr @@ -2829,6 +2839,8 @@ yyreduce: break; case 63: + +/* Line 1455 of yacc.c */ #line 831 "program_parse.y" { gl_register_file file = ((yyvsp[(1) - (1)].temp_sym).name != NULL) @@ -2839,6 +2851,8 @@ yyreduce: break; case 64: + +/* Line 1455 of yacc.c */ #line 840 "program_parse.y" { set_dst_reg(& (yyval.dst_reg), PROGRAM_OUTPUT, (yyvsp[(1) - (1)].result)); @@ -2846,6 +2860,8 @@ yyreduce: break; case 65: + +/* Line 1455 of yacc.c */ #line 844 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) @@ -2874,6 +2890,8 @@ yyreduce: break; case 66: + +/* Line 1455 of yacc.c */ #line 871 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) @@ -2892,6 +2910,8 @@ yyreduce: break; case 69: + +/* Line 1455 of yacc.c */ #line 890 "program_parse.y" { init_src_reg(& (yyval.src_reg)); @@ -2900,6 +2920,8 @@ yyreduce: break; case 70: + +/* Line 1455 of yacc.c */ #line 897 "program_parse.y" { /* FINISHME: Add support for multiple address registers. @@ -2913,21 +2935,29 @@ yyreduce: break; case 71: + +/* Line 1455 of yacc.c */ #line 908 "program_parse.y" { (yyval.integer) = 0; ;} break; case 72: + +/* Line 1455 of yacc.c */ #line 909 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; case 73: + +/* Line 1455 of yacc.c */ #line 910 "program_parse.y" { (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;} break; case 74: + +/* Line 1455 of yacc.c */ #line 914 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 63)) { @@ -2943,6 +2973,8 @@ yyreduce: break; case 75: + +/* Line 1455 of yacc.c */ #line 928 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 64)) { @@ -2958,6 +2990,8 @@ yyreduce: break; case 76: + +/* Line 1455 of yacc.c */ #line 942 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) @@ -2977,6 +3011,8 @@ yyreduce: break; case 77: + +/* Line 1455 of yacc.c */ #line 960 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { @@ -2989,6 +3025,8 @@ yyreduce: break; case 78: + +/* Line 1455 of yacc.c */ #line 971 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { @@ -3002,16 +3040,22 @@ yyreduce: break; case 83: + +/* Line 1455 of yacc.c */ #line 987 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; case 88: + +/* Line 1455 of yacc.c */ #line 991 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; case 89: + +/* Line 1455 of yacc.c */ #line 995 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(2) - (3)].dst_reg); @@ -3019,6 +3063,8 @@ yyreduce: break; case 90: + +/* Line 1455 of yacc.c */ #line 999 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(2) - (3)].dst_reg); @@ -3026,6 +3072,8 @@ yyreduce: break; case 91: + +/* Line 1455 of yacc.c */ #line 1003 "program_parse.y" { (yyval.dst_reg).CondMask = COND_TR; @@ -3035,6 +3083,8 @@ yyreduce: break; case 92: + +/* Line 1455 of yacc.c */ #line 1011 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); @@ -3043,6 +3093,8 @@ yyreduce: break; case 93: + +/* Line 1455 of yacc.c */ #line 1018 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); @@ -3051,6 +3103,8 @@ yyreduce: break; case 94: + +/* Line 1455 of yacc.c */ #line 1025 "program_parse.y" { const int cond = _mesa_parse_cc((yyvsp[(1) - (1)].string)); @@ -3075,6 +3129,8 @@ yyreduce: break; case 95: + +/* Line 1455 of yacc.c */ #line 1048 "program_parse.y" { const int cond = _mesa_parse_cc((yyvsp[(1) - (1)].string)); @@ -3099,6 +3155,8 @@ yyreduce: break; case 102: + +/* Line 1455 of yacc.c */ #line 1079 "program_parse.y" { struct asm_symbol *const s = @@ -3118,6 +3176,8 @@ yyreduce: break; case 103: + +/* Line 1455 of yacc.c */ #line 1097 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); @@ -3125,6 +3185,8 @@ yyreduce: break; case 104: + +/* Line 1455 of yacc.c */ #line 1101 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); @@ -3132,6 +3194,8 @@ yyreduce: break; case 105: + +/* Line 1455 of yacc.c */ #line 1107 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_POS; @@ -3139,6 +3203,8 @@ yyreduce: break; case 106: + +/* Line 1455 of yacc.c */ #line 1111 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_WEIGHT; @@ -3146,6 +3212,8 @@ yyreduce: break; case 107: + +/* Line 1455 of yacc.c */ #line 1115 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_NORMAL; @@ -3153,6 +3221,8 @@ yyreduce: break; case 108: + +/* Line 1455 of yacc.c */ #line 1119 "program_parse.y" { if (!state->ctx->Extensions.EXT_secondary_color) { @@ -3165,6 +3235,8 @@ yyreduce: break; case 109: + +/* Line 1455 of yacc.c */ #line 1128 "program_parse.y" { if (!state->ctx->Extensions.EXT_fog_coord) { @@ -3177,6 +3249,8 @@ yyreduce: break; case 110: + +/* Line 1455 of yacc.c */ #line 1137 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); @@ -3184,6 +3258,8 @@ yyreduce: break; case 111: + +/* Line 1455 of yacc.c */ #line 1141 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); @@ -3192,6 +3268,8 @@ yyreduce: break; case 112: + +/* Line 1455 of yacc.c */ #line 1146 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_GENERIC0 + (yyvsp[(3) - (4)].integer); @@ -3199,6 +3277,8 @@ yyreduce: break; case 113: + +/* Line 1455 of yacc.c */ #line 1152 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxAttribs) { @@ -3211,6 +3291,8 @@ yyreduce: break; case 117: + +/* Line 1455 of yacc.c */ #line 1166 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_WPOS; @@ -3218,6 +3300,8 @@ yyreduce: break; case 118: + +/* Line 1455 of yacc.c */ #line 1170 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_COL0 + (yyvsp[(2) - (2)].integer); @@ -3225,6 +3309,8 @@ yyreduce: break; case 119: + +/* Line 1455 of yacc.c */ #line 1174 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_FOGC; @@ -3232,6 +3318,8 @@ yyreduce: break; case 120: + +/* Line 1455 of yacc.c */ #line 1178 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); @@ -3239,6 +3327,8 @@ yyreduce: break; case 123: + +/* Line 1455 of yacc.c */ #line 1186 "program_parse.y" { struct asm_symbol *const s = @@ -3256,6 +3346,8 @@ yyreduce: break; case 124: + +/* Line 1455 of yacc.c */ #line 1202 "program_parse.y" { if (((yyvsp[(4) - (6)].integer) != 0) && ((unsigned) (yyvsp[(4) - (6)].integer) != (yyvsp[(6) - (6)].temp_sym).param_binding_length)) { @@ -3279,6 +3371,8 @@ yyreduce: break; case 125: + +/* Line 1455 of yacc.c */ #line 1224 "program_parse.y" { (yyval.integer) = 0; @@ -3286,6 +3380,8 @@ yyreduce: break; case 126: + +/* Line 1455 of yacc.c */ #line 1228 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - (1)].integer) > state->limits->MaxParameters)) { @@ -3298,6 +3394,8 @@ yyreduce: break; case 127: + +/* Line 1455 of yacc.c */ #line 1239 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(2) - (2)].temp_sym); @@ -3305,6 +3403,8 @@ yyreduce: break; case 128: + +/* Line 1455 of yacc.c */ #line 1245 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(3) - (4)].temp_sym); @@ -3312,6 +3412,8 @@ yyreduce: break; case 130: + +/* Line 1455 of yacc.c */ #line 1252 "program_parse.y" { (yyvsp[(1) - (3)].temp_sym).param_binding_length += (yyvsp[(3) - (3)].temp_sym).param_binding_length; @@ -3320,6 +3422,8 @@ yyreduce: break; case 131: + +/* Line 1455 of yacc.c */ #line 1259 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); @@ -3329,6 +3433,8 @@ yyreduce: break; case 132: + +/* Line 1455 of yacc.c */ #line 1265 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); @@ -3338,6 +3444,8 @@ yyreduce: break; case 133: + +/* Line 1455 of yacc.c */ #line 1271 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); @@ -3347,6 +3455,8 @@ yyreduce: break; case 134: + +/* Line 1455 of yacc.c */ #line 1279 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); @@ -3356,6 +3466,8 @@ yyreduce: break; case 135: + +/* Line 1455 of yacc.c */ #line 1285 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); @@ -3365,6 +3477,8 @@ yyreduce: break; case 136: + +/* Line 1455 of yacc.c */ #line 1291 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); @@ -3374,6 +3488,8 @@ yyreduce: break; case 137: + +/* Line 1455 of yacc.c */ #line 1299 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); @@ -3383,6 +3499,8 @@ yyreduce: break; case 138: + +/* Line 1455 of yacc.c */ #line 1305 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); @@ -3392,6 +3510,8 @@ yyreduce: break; case 139: + +/* Line 1455 of yacc.c */ #line 1311 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); @@ -3401,71 +3521,99 @@ yyreduce: break; case 140: + +/* Line 1455 of yacc.c */ #line 1318 "program_parse.y" { memcpy((yyval.state), (yyvsp[(1) - (1)].state), sizeof((yyval.state))); ;} break; case 141: + +/* Line 1455 of yacc.c */ #line 1319 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 142: + +/* Line 1455 of yacc.c */ #line 1322 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 143: + +/* Line 1455 of yacc.c */ #line 1323 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 144: + +/* Line 1455 of yacc.c */ #line 1324 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 145: + +/* Line 1455 of yacc.c */ #line 1325 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 146: + +/* Line 1455 of yacc.c */ #line 1326 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 147: + +/* Line 1455 of yacc.c */ #line 1327 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 148: + +/* Line 1455 of yacc.c */ #line 1328 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 149: + +/* Line 1455 of yacc.c */ #line 1329 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 150: + +/* Line 1455 of yacc.c */ #line 1330 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 151: + +/* Line 1455 of yacc.c */ #line 1331 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 152: + +/* Line 1455 of yacc.c */ #line 1332 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 153: + +/* Line 1455 of yacc.c */ #line 1336 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); @@ -3476,6 +3624,8 @@ yyreduce: break; case 154: + +/* Line 1455 of yacc.c */ #line 1345 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); @@ -3483,6 +3633,8 @@ yyreduce: break; case 155: + +/* Line 1455 of yacc.c */ #line 1349 "program_parse.y" { (yyval.integer) = STATE_EMISSION; @@ -3490,6 +3642,8 @@ yyreduce: break; case 156: + +/* Line 1455 of yacc.c */ #line 1353 "program_parse.y" { (yyval.integer) = STATE_SHININESS; @@ -3497,6 +3651,8 @@ yyreduce: break; case 157: + +/* Line 1455 of yacc.c */ #line 1359 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); @@ -3507,6 +3663,8 @@ yyreduce: break; case 158: + +/* Line 1455 of yacc.c */ #line 1368 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); @@ -3514,6 +3672,8 @@ yyreduce: break; case 159: + +/* Line 1455 of yacc.c */ #line 1372 "program_parse.y" { (yyval.integer) = STATE_POSITION; @@ -3521,6 +3681,8 @@ yyreduce: break; case 160: + +/* Line 1455 of yacc.c */ #line 1376 "program_parse.y" { if (!state->ctx->Extensions.EXT_point_parameters) { @@ -3533,6 +3695,8 @@ yyreduce: break; case 161: + +/* Line 1455 of yacc.c */ #line 1385 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); @@ -3540,6 +3704,8 @@ yyreduce: break; case 162: + +/* Line 1455 of yacc.c */ #line 1389 "program_parse.y" { (yyval.integer) = STATE_HALF_VECTOR; @@ -3547,6 +3713,8 @@ yyreduce: break; case 163: + +/* Line 1455 of yacc.c */ #line 1395 "program_parse.y" { (yyval.integer) = STATE_SPOT_DIRECTION; @@ -3554,6 +3722,8 @@ yyreduce: break; case 164: + +/* Line 1455 of yacc.c */ #line 1401 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (2)].state)[0]; @@ -3562,6 +3732,8 @@ yyreduce: break; case 165: + +/* Line 1455 of yacc.c */ #line 1408 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); @@ -3570,6 +3742,8 @@ yyreduce: break; case 166: + +/* Line 1455 of yacc.c */ #line 1413 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); @@ -3579,6 +3753,8 @@ yyreduce: break; case 167: + +/* Line 1455 of yacc.c */ #line 1421 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); @@ -3590,6 +3766,8 @@ yyreduce: break; case 169: + +/* Line 1455 of yacc.c */ #line 1433 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); @@ -3599,6 +3777,8 @@ yyreduce: break; case 170: + +/* Line 1455 of yacc.c */ #line 1441 "program_parse.y" { (yyval.integer) = STATE_TEXENV_COLOR; @@ -3606,6 +3786,8 @@ yyreduce: break; case 171: + +/* Line 1455 of yacc.c */ #line 1447 "program_parse.y" { (yyval.integer) = STATE_AMBIENT; @@ -3613,6 +3795,8 @@ yyreduce: break; case 172: + +/* Line 1455 of yacc.c */ #line 1451 "program_parse.y" { (yyval.integer) = STATE_DIFFUSE; @@ -3620,6 +3804,8 @@ yyreduce: break; case 173: + +/* Line 1455 of yacc.c */ #line 1455 "program_parse.y" { (yyval.integer) = STATE_SPECULAR; @@ -3627,6 +3813,8 @@ yyreduce: break; case 174: + +/* Line 1455 of yacc.c */ #line 1461 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxLights) { @@ -3639,6 +3827,8 @@ yyreduce: break; case 175: + +/* Line 1455 of yacc.c */ #line 1472 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); @@ -3649,6 +3839,8 @@ yyreduce: break; case 176: + +/* Line 1455 of yacc.c */ #line 1481 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S; @@ -3656,6 +3848,8 @@ yyreduce: break; case 177: + +/* Line 1455 of yacc.c */ #line 1485 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_OBJECT_S; @@ -3663,6 +3857,8 @@ yyreduce: break; case 178: + +/* Line 1455 of yacc.c */ #line 1490 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S; @@ -3670,6 +3866,8 @@ yyreduce: break; case 179: + +/* Line 1455 of yacc.c */ #line 1494 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S; @@ -3677,6 +3875,8 @@ yyreduce: break; case 180: + +/* Line 1455 of yacc.c */ #line 1498 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S; @@ -3684,6 +3884,8 @@ yyreduce: break; case 181: + +/* Line 1455 of yacc.c */ #line 1502 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S; @@ -3691,6 +3893,8 @@ yyreduce: break; case 182: + +/* Line 1455 of yacc.c */ #line 1508 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); @@ -3699,6 +3903,8 @@ yyreduce: break; case 183: + +/* Line 1455 of yacc.c */ #line 1515 "program_parse.y" { (yyval.integer) = STATE_FOG_COLOR; @@ -3706,6 +3912,8 @@ yyreduce: break; case 184: + +/* Line 1455 of yacc.c */ #line 1519 "program_parse.y" { (yyval.integer) = STATE_FOG_PARAMS; @@ -3713,6 +3921,8 @@ yyreduce: break; case 185: + +/* Line 1455 of yacc.c */ #line 1525 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); @@ -3722,6 +3932,8 @@ yyreduce: break; case 186: + +/* Line 1455 of yacc.c */ #line 1533 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxClipPlanes) { @@ -3734,6 +3946,8 @@ yyreduce: break; case 187: + +/* Line 1455 of yacc.c */ #line 1544 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); @@ -3742,6 +3956,8 @@ yyreduce: break; case 188: + +/* Line 1455 of yacc.c */ #line 1551 "program_parse.y" { (yyval.integer) = STATE_POINT_SIZE; @@ -3749,6 +3965,8 @@ yyreduce: break; case 189: + +/* Line 1455 of yacc.c */ #line 1555 "program_parse.y" { (yyval.integer) = STATE_POINT_ATTENUATION; @@ -3756,6 +3974,8 @@ yyreduce: break; case 190: + +/* Line 1455 of yacc.c */ #line 1561 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (5)].state)[0]; @@ -3767,6 +3987,8 @@ yyreduce: break; case 191: + +/* Line 1455 of yacc.c */ #line 1571 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (2)].state)[0]; @@ -3778,6 +4000,8 @@ yyreduce: break; case 192: + +/* Line 1455 of yacc.c */ #line 1581 "program_parse.y" { (yyval.state)[2] = 0; @@ -3786,6 +4010,8 @@ yyreduce: break; case 193: + +/* Line 1455 of yacc.c */ #line 1586 "program_parse.y" { /* It seems logical that the matrix row range specifier would have @@ -3805,6 +4031,8 @@ yyreduce: break; case 194: + +/* Line 1455 of yacc.c */ #line 1604 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (3)].state)[0]; @@ -3814,6 +4042,8 @@ yyreduce: break; case 195: + +/* Line 1455 of yacc.c */ #line 1612 "program_parse.y" { (yyval.integer) = 0; @@ -3821,6 +4051,8 @@ yyreduce: break; case 196: + +/* Line 1455 of yacc.c */ #line 1616 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); @@ -3828,6 +4060,8 @@ yyreduce: break; case 197: + +/* Line 1455 of yacc.c */ #line 1622 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVERSE; @@ -3835,6 +4069,8 @@ yyreduce: break; case 198: + +/* Line 1455 of yacc.c */ #line 1626 "program_parse.y" { (yyval.integer) = STATE_MATRIX_TRANSPOSE; @@ -3842,6 +4078,8 @@ yyreduce: break; case 199: + +/* Line 1455 of yacc.c */ #line 1630 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVTRANS; @@ -3849,6 +4087,8 @@ yyreduce: break; case 200: + +/* Line 1455 of yacc.c */ #line 1636 "program_parse.y" { if ((yyvsp[(1) - (1)].integer) > 3) { @@ -3861,6 +4101,8 @@ yyreduce: break; case 201: + +/* Line 1455 of yacc.c */ #line 1647 "program_parse.y" { (yyval.state)[0] = STATE_MODELVIEW_MATRIX; @@ -3869,6 +4111,8 @@ yyreduce: break; case 202: + +/* Line 1455 of yacc.c */ #line 1652 "program_parse.y" { (yyval.state)[0] = STATE_PROJECTION_MATRIX; @@ -3877,6 +4121,8 @@ yyreduce: break; case 203: + +/* Line 1455 of yacc.c */ #line 1657 "program_parse.y" { (yyval.state)[0] = STATE_MVP_MATRIX; @@ -3885,6 +4131,8 @@ yyreduce: break; case 204: + +/* Line 1455 of yacc.c */ #line 1662 "program_parse.y" { (yyval.state)[0] = STATE_TEXTURE_MATRIX; @@ -3893,6 +4141,8 @@ yyreduce: break; case 205: + +/* Line 1455 of yacc.c */ #line 1667 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); @@ -3901,6 +4151,8 @@ yyreduce: break; case 206: + +/* Line 1455 of yacc.c */ #line 1672 "program_parse.y" { (yyval.state)[0] = STATE_PROGRAM_MATRIX; @@ -3909,6 +4161,8 @@ yyreduce: break; case 207: + +/* Line 1455 of yacc.c */ #line 1679 "program_parse.y" { (yyval.integer) = 0; @@ -3916,6 +4170,8 @@ yyreduce: break; case 208: + +/* Line 1455 of yacc.c */ #line 1683 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); @@ -3923,6 +4179,8 @@ yyreduce: break; case 209: + +/* Line 1455 of yacc.c */ #line 1688 "program_parse.y" { /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix @@ -3938,6 +4196,8 @@ yyreduce: break; case 210: + +/* Line 1455 of yacc.c */ #line 1701 "program_parse.y" { /* Since GL_ARB_matrix_palette isn't supported, just let any value @@ -3948,6 +4208,8 @@ yyreduce: break; case 211: + +/* Line 1455 of yacc.c */ #line 1709 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxProgramMatrices) { @@ -3960,6 +4222,8 @@ yyreduce: break; case 212: + +/* Line 1455 of yacc.c */ #line 1720 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); @@ -3968,6 +4232,8 @@ yyreduce: break; case 217: + +/* Line 1455 of yacc.c */ #line 1732 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); @@ -3979,6 +4245,8 @@ yyreduce: break; case 218: + +/* Line 1455 of yacc.c */ #line 1742 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); @@ -3987,6 +4255,8 @@ yyreduce: break; case 219: + +/* Line 1455 of yacc.c */ #line 1747 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); @@ -3995,6 +4265,8 @@ yyreduce: break; case 220: + +/* Line 1455 of yacc.c */ #line 1754 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); @@ -4006,6 +4278,8 @@ yyreduce: break; case 221: + +/* Line 1455 of yacc.c */ #line 1764 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); @@ -4017,6 +4291,8 @@ yyreduce: break; case 222: + +/* Line 1455 of yacc.c */ #line 1773 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); @@ -4025,6 +4301,8 @@ yyreduce: break; case 223: + +/* Line 1455 of yacc.c */ #line 1778 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); @@ -4033,6 +4311,8 @@ yyreduce: break; case 224: + +/* Line 1455 of yacc.c */ #line 1785 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); @@ -4044,6 +4324,8 @@ yyreduce: break; case 225: + +/* Line 1455 of yacc.c */ #line 1795 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxEnvParams) { @@ -4055,6 +4337,8 @@ yyreduce: break; case 226: + +/* Line 1455 of yacc.c */ #line 1805 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxLocalParams) { @@ -4066,6 +4350,8 @@ yyreduce: break; case 231: + +/* Line 1455 of yacc.c */ #line 1820 "program_parse.y" { (yyval.vector).count = 4; @@ -4077,6 +4363,8 @@ yyreduce: break; case 232: + +/* Line 1455 of yacc.c */ #line 1830 "program_parse.y" { (yyval.vector).count = 1; @@ -4088,6 +4376,8 @@ yyreduce: break; case 233: + +/* Line 1455 of yacc.c */ #line 1838 "program_parse.y" { (yyval.vector).count = 1; @@ -4099,6 +4389,8 @@ yyreduce: break; case 234: + +/* Line 1455 of yacc.c */ #line 1848 "program_parse.y" { (yyval.vector).count = 4; @@ -4110,6 +4402,8 @@ yyreduce: break; case 235: + +/* Line 1455 of yacc.c */ #line 1856 "program_parse.y" { (yyval.vector).count = 4; @@ -4121,6 +4415,8 @@ yyreduce: break; case 236: + +/* Line 1455 of yacc.c */ #line 1865 "program_parse.y" { (yyval.vector).count = 4; @@ -4132,6 +4428,8 @@ yyreduce: break; case 237: + +/* Line 1455 of yacc.c */ #line 1874 "program_parse.y" { (yyval.vector).count = 4; @@ -4143,6 +4441,8 @@ yyreduce: break; case 238: + +/* Line 1455 of yacc.c */ #line 1884 "program_parse.y" { (yyval.real) = ((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].real) : (yyvsp[(2) - (2)].real); @@ -4150,6 +4450,8 @@ yyreduce: break; case 239: + +/* Line 1455 of yacc.c */ #line 1888 "program_parse.y" { (yyval.real) = (float)(((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].integer) : (yyvsp[(2) - (2)].integer)); @@ -4157,26 +4459,36 @@ yyreduce: break; case 240: + +/* Line 1455 of yacc.c */ #line 1893 "program_parse.y" { (yyval.negate) = FALSE; ;} break; case 241: + +/* Line 1455 of yacc.c */ #line 1894 "program_parse.y" { (yyval.negate) = TRUE; ;} break; case 242: + +/* Line 1455 of yacc.c */ #line 1895 "program_parse.y" { (yyval.negate) = FALSE; ;} break; case 243: + +/* Line 1455 of yacc.c */ #line 1898 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; case 245: + +/* Line 1455 of yacc.c */ #line 1902 "program_parse.y" { /* NV_fragment_program_option defines the size qualifiers in a @@ -4214,17 +4526,23 @@ yyreduce: break; case 246: + +/* Line 1455 of yacc.c */ #line 1936 "program_parse.y" { ;} break; case 247: + +/* Line 1455 of yacc.c */ #line 1940 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; case 249: + +/* Line 1455 of yacc.c */ #line 1944 "program_parse.y" { if (!declare_variable(state, (yyvsp[(3) - (3)].string), (yyvsp[(0) - (3)].integer), & (yylsp[(3) - (3)]))) { @@ -4234,6 +4552,8 @@ yyreduce: break; case 250: + +/* Line 1455 of yacc.c */ #line 1950 "program_parse.y" { if (!declare_variable(state, (yyvsp[(1) - (1)].string), (yyvsp[(0) - (1)].integer), & (yylsp[(1) - (1)]))) { @@ -4243,6 +4563,8 @@ yyreduce: break; case 251: + +/* Line 1455 of yacc.c */ #line 1958 "program_parse.y" { struct asm_symbol *const s = @@ -4257,6 +4579,8 @@ yyreduce: break; case 252: + +/* Line 1455 of yacc.c */ #line 1971 "program_parse.y" { if (state->mode == ARB_vertex) { @@ -4269,6 +4593,8 @@ yyreduce: break; case 253: + +/* Line 1455 of yacc.c */ #line 1980 "program_parse.y" { if (state->mode == ARB_vertex) { @@ -4281,6 +4607,8 @@ yyreduce: break; case 254: + +/* Line 1455 of yacc.c */ #line 1989 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (2)].result); @@ -4288,6 +4616,8 @@ yyreduce: break; case 255: + +/* Line 1455 of yacc.c */ #line 1993 "program_parse.y" { if (state->mode == ARB_vertex) { @@ -4300,6 +4630,8 @@ yyreduce: break; case 256: + +/* Line 1455 of yacc.c */ #line 2002 "program_parse.y" { if (state->mode == ARB_vertex) { @@ -4312,6 +4644,8 @@ yyreduce: break; case 257: + +/* Line 1455 of yacc.c */ #line 2011 "program_parse.y" { if (state->mode == ARB_fragment) { @@ -4324,6 +4658,8 @@ yyreduce: break; case 258: + +/* Line 1455 of yacc.c */ #line 2022 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (3)].integer) + (yyvsp[(3) - (3)].integer); @@ -4331,6 +4667,8 @@ yyreduce: break; case 259: + +/* Line 1455 of yacc.c */ #line 2028 "program_parse.y" { (yyval.integer) = (state->mode == ARB_vertex) @@ -4340,6 +4678,8 @@ yyreduce: break; case 260: + +/* Line 1455 of yacc.c */ #line 2034 "program_parse.y" { if (state->mode == ARB_vertex) { @@ -4352,6 +4692,8 @@ yyreduce: break; case 261: + +/* Line 1455 of yacc.c */ #line 2043 "program_parse.y" { if (state->mode == ARB_vertex) { @@ -4364,6 +4706,8 @@ yyreduce: break; case 262: + +/* Line 1455 of yacc.c */ #line 2054 "program_parse.y" { (yyval.integer) = 0; @@ -4371,6 +4715,8 @@ yyreduce: break; case 263: + +/* Line 1455 of yacc.c */ #line 2058 "program_parse.y" { if (state->mode == ARB_vertex) { @@ -4383,6 +4729,8 @@ yyreduce: break; case 264: + +/* Line 1455 of yacc.c */ #line 2067 "program_parse.y" { if (state->mode == ARB_vertex) { @@ -4395,66 +4743,92 @@ yyreduce: break; case 265: + +/* Line 1455 of yacc.c */ #line 2077 "program_parse.y" { (yyval.integer) = 0; ;} break; case 266: + +/* Line 1455 of yacc.c */ #line 2078 "program_parse.y" { (yyval.integer) = 0; ;} break; case 267: + +/* Line 1455 of yacc.c */ #line 2079 "program_parse.y" { (yyval.integer) = 1; ;} break; case 268: + +/* Line 1455 of yacc.c */ #line 2082 "program_parse.y" { (yyval.integer) = 0; ;} break; case 269: + +/* Line 1455 of yacc.c */ #line 2083 "program_parse.y" { (yyval.integer) = 0; ;} break; case 270: + +/* Line 1455 of yacc.c */ #line 2084 "program_parse.y" { (yyval.integer) = 1; ;} break; case 271: + +/* Line 1455 of yacc.c */ #line 2087 "program_parse.y" { (yyval.integer) = 0; ;} break; case 272: + +/* Line 1455 of yacc.c */ #line 2088 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 273: + +/* Line 1455 of yacc.c */ #line 2091 "program_parse.y" { (yyval.integer) = 0; ;} break; case 274: + +/* Line 1455 of yacc.c */ #line 2092 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 275: + +/* Line 1455 of yacc.c */ #line 2095 "program_parse.y" { (yyval.integer) = 0; ;} break; case 276: + +/* Line 1455 of yacc.c */ #line 2096 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 277: + +/* Line 1455 of yacc.c */ #line 2100 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureCoordUnits) { @@ -4467,6 +4841,8 @@ yyreduce: break; case 278: + +/* Line 1455 of yacc.c */ #line 2111 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureImageUnits) { @@ -4479,6 +4855,8 @@ yyreduce: break; case 279: + +/* Line 1455 of yacc.c */ #line 2122 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureUnits) { @@ -4491,6 +4869,8 @@ yyreduce: break; case 280: + +/* Line 1455 of yacc.c */ #line 2133 "program_parse.y" { struct asm_symbol *exist = (struct asm_symbol *) @@ -4498,9 +4878,10 @@ yyreduce: struct asm_symbol *target = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(4) - (4)].string)); - if (exist != NULL) { - yyerror(& (yylsp[(2) - (4)]), state, "redeclared identifier"); + char m[1000]; + _mesa_snprintf(m, sizeof(m), "redeclared identifier: %s", (yyvsp[(2) - (4)].string)); + yyerror(& (yylsp[(2) - (4)]), state, m); YYERROR; } else if (target == NULL) { yyerror(& (yylsp[(4) - (4)]), state, @@ -4513,8 +4894,9 @@ yyreduce: break; -/* Line 1267 of yacc.c. */ -#line 4518 "program_parse.tab.c" + +/* Line 1455 of yacc.c */ +#line 4900 "program_parse.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -4590,7 +4972,7 @@ yyerrlab: if (yyerrstatus == 3) { - /* If just tried and failed to reuse look-ahead token after an + /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) @@ -4607,7 +4989,7 @@ yyerrlab: } } - /* Else will try to reuse look-ahead token after shifting the error + /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; @@ -4665,14 +5047,11 @@ yyerrlab1: YY_STACK_PRINT (yyss, yyssp); } - if (yyn == YYFINAL) - YYACCEPT; - *++yyvsp = yylval; yyerror_range[1] = yylloc; /* Using YYLLOC is tempting, but would change the location of - the look-ahead. YYLOC is available though. */ + the lookahead. YYLOC is available though. */ YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); *++yylsp = yyloc; @@ -4697,7 +5076,7 @@ yyabortlab: yyresult = 1; goto yyreturn; -#ifndef yyoverflow +#if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ @@ -4708,7 +5087,7 @@ yyexhaustedlab: #endif yyreturn: - if (yychar != YYEOF && yychar != YYEMPTY) + if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc, state); /* Do not reclaim the symbols of the rule which action triggered @@ -4734,7 +5113,9 @@ yyreturn: } -#line 2157 "program_parse.y" + +/* Line 1675 of yacc.c */ +#line 2158 "program_parse.y" void diff --git a/src/mesa/shader/program_parse.tab.h b/src/mesa/shader/program_parse.tab.h index 25048065c1..406100c859 100644 --- a/src/mesa/shader/program_parse.tab.h +++ b/src/mesa/shader/program_parse.tab.h @@ -1,24 +1,23 @@ -/* A Bison parser, made by GNU Bison 2.3. */ -/* Skeleton interface for Bison's Yacc-like parsers in C +/* A Bison parser, made by GNU Bison 2.4.1. */ - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 +/* Skeleton interface for Bison's Yacc-like parsers in C + + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. - - This program is free software; you can redistribute it and/or modify + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2, or (at your option) - any later version. - + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. */ + along with this program. If not, see . */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work @@ -29,10 +28,11 @@ special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. - + This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ + /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE @@ -146,120 +146,16 @@ DOT = 362 }; #endif -/* Tokens. */ -#define ARBvp_10 258 -#define ARBfp_10 259 -#define ADDRESS 260 -#define ALIAS 261 -#define ATTRIB 262 -#define OPTION 263 -#define OUTPUT 264 -#define PARAM 265 -#define TEMP 266 -#define END 267 -#define BIN_OP 268 -#define BINSC_OP 269 -#define SAMPLE_OP 270 -#define SCALAR_OP 271 -#define TRI_OP 272 -#define VECTOR_OP 273 -#define ARL 274 -#define KIL 275 -#define SWZ 276 -#define TXD_OP 277 -#define INTEGER 278 -#define REAL 279 -#define AMBIENT 280 -#define ATTENUATION 281 -#define BACK 282 -#define CLIP 283 -#define COLOR 284 -#define DEPTH 285 -#define DIFFUSE 286 -#define DIRECTION 287 -#define EMISSION 288 -#define ENV 289 -#define EYE 290 -#define FOG 291 -#define FOGCOORD 292 -#define FRAGMENT 293 -#define FRONT 294 -#define HALF 295 -#define INVERSE 296 -#define INVTRANS 297 -#define LIGHT 298 -#define LIGHTMODEL 299 -#define LIGHTPROD 300 -#define LOCAL 301 -#define MATERIAL 302 -#define MAT_PROGRAM 303 -#define MATRIX 304 -#define MATRIXINDEX 305 -#define MODELVIEW 306 -#define MVP 307 -#define NORMAL 308 -#define OBJECT 309 -#define PALETTE 310 -#define PARAMS 311 -#define PLANE 312 -#define POINT_TOK 313 -#define POINTSIZE 314 -#define POSITION 315 -#define PRIMARY 316 -#define PROGRAM 317 -#define PROJECTION 318 -#define RANGE 319 -#define RESULT 320 -#define ROW 321 -#define SCENECOLOR 322 -#define SECONDARY 323 -#define SHININESS 324 -#define SIZE_TOK 325 -#define SPECULAR 326 -#define SPOT 327 -#define STATE 328 -#define TEXCOORD 329 -#define TEXENV 330 -#define TEXGEN 331 -#define TEXGEN_Q 332 -#define TEXGEN_R 333 -#define TEXGEN_S 334 -#define TEXGEN_T 335 -#define TEXTURE 336 -#define TRANSPOSE 337 -#define TEXTURE_UNIT 338 -#define TEX_1D 339 -#define TEX_2D 340 -#define TEX_3D 341 -#define TEX_CUBE 342 -#define TEX_RECT 343 -#define TEX_SHADOW1D 344 -#define TEX_SHADOW2D 345 -#define TEX_SHADOWRECT 346 -#define TEX_ARRAY1D 347 -#define TEX_ARRAY2D 348 -#define TEX_ARRAYSHADOW1D 349 -#define TEX_ARRAYSHADOW2D 350 -#define VERTEX 351 -#define VTXATTRIB 352 -#define WEIGHT 353 -#define IDENTIFIER 354 -#define USED_IDENTIFIER 355 -#define MASK4 356 -#define MASK3 357 -#define MASK2 358 -#define MASK1 359 -#define SWIZZLE 360 -#define DOT_DOT 361 -#define DOT 362 - #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE -#line 122 "program_parse.y" { + +/* Line 1676 of yacc.c */ +#line 122 "program_parse.y" + struct asm_instruction *inst; struct asm_symbol *sym; struct asm_symbol temp_sym; @@ -283,13 +179,15 @@ typedef union YYSTYPE unsigned xyzw_valid:1; unsigned negate:1; } ext_swizzle; -} -/* Line 1489 of yacc.c. */ -#line 289 "program_parse.tab.h" - YYSTYPE; + + + +/* Line 1676 of yacc.c */ +#line 187 "program_parse.tab.h" +} YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 -# define YYSTYPE_IS_TRIVIAL 1 #endif @@ -308,3 +206,4 @@ typedef struct YYLTYPE #endif + diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index 32b058400c..5767c51759 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -2136,9 +2136,10 @@ ALIAS_statement: ALIAS IDENTIFIER '=' USED_IDENTIFIER struct asm_symbol *target = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, $4); - if (exist != NULL) { - yyerror(& @2, state, "redeclared identifier"); + char m[1000]; + _mesa_snprintf(m, sizeof(m), "redeclared identifier: %s", $2); + yyerror(& @2, state, m); YYERROR; } else if (target == NULL) { yyerror(& @4, state, -- cgit v1.2.3 From 76aa0c0fd3d972000cb6707a3834128cea2f9738 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 4 Nov 2009 17:42:01 -0700 Subject: mesa: silence warning from gcc 4.4.1 --- src/mesa/main/imports.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 91d8d156b8..46ffb929b6 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -108,8 +108,8 @@ _mesa_align_malloc(size_t bytes, unsigned long alignment) { #if defined(HAVE_POSIX_MEMALIGN) void *mem; - - (void) posix_memalign(& mem, alignment, bytes); + int err = posix_memalign(& mem, alignment, bytes); + (void) err; return mem; #elif defined(_WIN32) && defined(_MSC_VER) return _aligned_malloc(bytes, alignment); -- cgit v1.2.3 From bc4ad7c2ae069a7d361f2210d39dbb91777cce76 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 4 Nov 2009 17:42:30 -0700 Subject: mesa: fix broken pack_histogram() case for GLhalf --- src/mesa/main/histogram.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c index ceb0d5a6a8..4c46f92787 100644 --- a/src/mesa/main/histogram.c +++ b/src/mesa/main/histogram.c @@ -186,16 +186,17 @@ pack_histogram( GLcontext *ctx, { /* temporarily store as GLuints */ GLuint temp[4*HISTOGRAM_TABLE_SIZE]; - GLhalfARB *dst = (GLhalfARB *) destination; + GLuint *dst = temp; + GLhalfARB *half = destination; GLuint i; /* get GLuint values */ PACK_MACRO(GLuint); /* convert to GLhalf */ for (i = 0; i < n * comps; i++) { - dst[i] = _mesa_float_to_half((GLfloat) temp[i]); + half[i] = _mesa_float_to_half((GLfloat) temp[i]); } if (packing->SwapBytes) { - _mesa_swap2((GLushort *) dst, n * comps); + _mesa_swap2((GLushort *) half, n * comps); } } break; -- cgit v1.2.3 From 1c3f7ab74ce492d6c92f2e3a0f29957fa9a71d96 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 4 Nov 2009 17:51:21 -0700 Subject: vbo: fix out-of-bounds array access The exec->vtx.inputs[] array was being written past its end. This was clobbering the following vbo_exec_context::eval state. Probably not noticed since evaluators and immediate mode rendering don't happen at the same time. Fixed the loop in vbo_exec_vtx_init(). Changed the size of the vbo_exec_context::vtx.arrays[] array. Added a bunch of debug-build assertions. Issue found by Vinson Lee. --- src/mesa/vbo/vbo_exec.h | 2 +- src/mesa/vbo/vbo_exec_api.c | 6 ++++++ src/mesa/vbo/vbo_exec_draw.c | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h index e0f44892cf..7fb5926160 100644 --- a/src/mesa/vbo/vbo_exec.h +++ b/src/mesa/vbo/vbo_exec.h @@ -103,7 +103,7 @@ struct vbo_exec_context GLubyte active_sz[VBO_ATTRIB_MAX]; GLfloat *attrptr[VBO_ATTRIB_MAX]; - struct gl_client_array arrays[VBO_ATTRIB_MAX]; + struct gl_client_array arrays[VERT_ATTRIB_MAX]; /* According to program mode, the values above plus current * values are squashed down to the 32 attributes passed to the diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index 387d4ee3d4..acc7647900 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -695,8 +695,14 @@ void vbo_exec_vtx_init( struct vbo_exec_context *exec ) _mesa_install_exec_vtxfmt( exec->ctx, &exec->vtxfmt ); for (i = 0 ; i < VBO_ATTRIB_MAX ; i++) { + ASSERT(i < Elements(exec->vtx.attrsz)); exec->vtx.attrsz[i] = 0; + ASSERT(i < Elements(exec->vtx.active_sz)); exec->vtx.active_sz[i] = 0; + } + for (i = 0 ; i < VERT_ATTRIB_MAX; i++) { + ASSERT(i < Elements(exec->vtx.inputs)); + ASSERT(i < Elements(exec->vtx.arrays)); exec->vtx.inputs[i] = &exec->vtx.arrays[i]; } diff --git a/src/mesa/vbo/vbo_exec_draw.c b/src/mesa/vbo/vbo_exec_draw.c index 0c258c535e..f41d629450 100644 --- a/src/mesa/vbo/vbo_exec_draw.c +++ b/src/mesa/vbo/vbo_exec_draw.c @@ -172,6 +172,7 @@ vbo_exec_bind_arrays( GLcontext *ctx ) exec->vtx.inputs[attr] = &vbo->legacy_currval[attr]; } for (attr = 0; attr < MAT_ATTRIB_MAX; attr++) { + ASSERT(attr + 16 < Elements(exec->vtx.inputs)); exec->vtx.inputs[attr + 16] = &vbo->mat_currval[attr]; } map = vbo->map_vp_none; @@ -184,6 +185,7 @@ vbo_exec_bind_arrays( GLcontext *ctx ) */ for (attr = 0; attr < 16; attr++) { exec->vtx.inputs[attr] = &vbo->legacy_currval[attr]; + ASSERT(attr + 16 < Elements(exec->vtx.inputs)); exec->vtx.inputs[attr + 16] = &vbo->generic_currval[attr]; } map = vbo->map_vp_arb; @@ -212,6 +214,8 @@ vbo_exec_bind_arrays( GLcontext *ctx ) if (exec->vtx.attrsz[src]) { /* override the default array set above */ + ASSERT(attr < Elements(exec->vtx.inputs)); + ASSERT(attr < Elements(exec->vtx.arrays)); /* arrays[] */ exec->vtx.inputs[attr] = &arrays[attr]; if (_mesa_is_bufferobj(exec->vtx.bufferobj)) { -- cgit v1.2.3 From 7c623905bc032480a0765093825f3bd105345121 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 4 Nov 2009 17:58:43 -0700 Subject: mesa: added cast to silence warning --- src/mesa/main/histogram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/histogram.c b/src/mesa/main/histogram.c index 4c46f92787..2b3e62c7d5 100644 --- a/src/mesa/main/histogram.c +++ b/src/mesa/main/histogram.c @@ -187,7 +187,7 @@ pack_histogram( GLcontext *ctx, /* temporarily store as GLuints */ GLuint temp[4*HISTOGRAM_TABLE_SIZE]; GLuint *dst = temp; - GLhalfARB *half = destination; + GLhalfARB *half = (GLhalfARB *) destination; GLuint i; /* get GLuint values */ PACK_MACRO(GLuint); -- cgit v1.2.3 From ad96c0d851f6c3696fa6ae0c1f6ad56e849bc739 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 3 Nov 2009 16:48:48 +0100 Subject: r300g: add color channel masking Signed-off-by: Corbin Simpson --- src/gallium/drivers/r300/r300_context.h | 1 + src/gallium/drivers/r300/r300_emit.c | 6 +++--- src/gallium/drivers/r300/r300_state.c | 14 ++++++++++++++ src/gallium/drivers/r300/r300_state_invariant.c | 3 +-- 4 files changed, 19 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index ae7015634c..8c65c04d01 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -34,6 +34,7 @@ struct r300_vertex_shader; struct r300_blend_state { uint32_t blend_control; /* R300_RB3D_CBLEND: 0x4e04 */ uint32_t alpha_blend_control; /* R300_RB3D_ABLEND: 0x4e08 */ + uint32_t color_channel_mask; /* R300_RB3D_COLOR_CHANNEL_MASK: 0x4e0c */ uint32_t rop; /* R300_RB3D_ROPCNTL: 0x4e18 */ uint32_t dither; /* R300_RB3D_DITHER_CTL: 0x4e50 */ }; diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 79972dbb49..8fe9a68886 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -38,10 +38,11 @@ void r300_emit_blend_state(struct r300_context* r300, struct r300_blend_state* blend) { CS_LOCALS(r300); - BEGIN_CS(7); - OUT_CS_REG_SEQ(R300_RB3D_CBLEND, 2); + BEGIN_CS(8); + OUT_CS_REG_SEQ(R300_RB3D_CBLEND, 3); OUT_CS(blend->blend_control); OUT_CS(blend->alpha_blend_control); + OUT_CS(blend->color_channel_mask); OUT_CS_REG(R300_RB3D_ROPCNTL, blend->rop); OUT_CS_REG(R300_RB3D_DITHER_CTL, blend->dither); END_CS; @@ -313,7 +314,6 @@ void r300_emit_fb_state(struct r300_context* r300, tex = (struct r300_texture*)surf->texture; assert(tex && tex->buffer && "cbuf is marked, but NULL!"); - /* XXX I still need to figure out how to set the mipmap level here */ OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0 + (4 * i), 1); OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0); diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index af063d4b20..242ec9f365 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -100,6 +100,20 @@ static void* r300_create_blend_state(struct pipe_context* pipe, (state->logicop_func) << R300_RB3D_ROPCNTL_ROP_SHIFT; } + /* Color Channel Mask */ + if (state->colormask & PIPE_MASK_R) { + blend->color_channel_mask |= RB3D_COLOR_CHANNEL_MASK_RED_MASK0; + } + if (state->colormask & PIPE_MASK_G) { + blend->color_channel_mask |= RB3D_COLOR_CHANNEL_MASK_GREEN_MASK0; + } + if (state->colormask & PIPE_MASK_B) { + blend->color_channel_mask |= RB3D_COLOR_CHANNEL_MASK_BLUE_MASK0; + } + if (state->colormask & PIPE_MASK_A) { + blend->color_channel_mask |= RB3D_COLOR_CHANNEL_MASK_ALPHA_MASK0; + } + if (state->dither) { blend->dither = R300_RB3D_DITHER_CTL_DITHER_MODE_LUT | R300_RB3D_DITHER_CTL_ALPHA_DITHER_MODE_LUT; diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c index 4865f16058..7e4d5c7c72 100644 --- a/src/gallium/drivers/r300/r300_state_invariant.c +++ b/src/gallium/drivers/r300/r300_state_invariant.c @@ -84,7 +84,7 @@ void r300_emit_invariant_state(struct r300_context* r300) END_CS; /* XXX unsorted stuff from surface_fill */ - BEGIN_CS(64 + (caps->has_tcl ? 5 : 0) + (caps->is_r500 ? 4 : 0)); + BEGIN_CS(62 + (caps->has_tcl ? 5 : 0) + (caps->is_r500 ? 4 : 0)); /* Flush PVS. */ OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0); @@ -125,7 +125,6 @@ void r300_emit_invariant_state(struct r300_context* r300) OUT_CS_REG(R300_SC_HYPERZ, 0x0000001C); OUT_CS_REG(R300_SC_EDGERULE, 0x2DA49525); OUT_CS_REG(R300_RB3D_CCTL, 0x00000000); - OUT_CS_REG(RB3D_COLOR_CHANNEL_MASK, 0x0000000F); OUT_CS_REG(R300_RB3D_AARESOLVE_CTL, 0x00000000); if (caps->is_r500) { OUT_CS_REG(R500_RB3D_DISCARD_SRC_PIXEL_LTE_THRESHOLD, 0x00000000); -- cgit v1.2.3 From 07190888bdc41f53bf8ea30c9e2ee4a61b42d802 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 3 Nov 2009 16:50:09 +0100 Subject: r300g: set the correct offset in a colorbuffer surface Suggested by Joakim Sindholt. Also, put flushing of colorbuffers _before_ the framebuffer state setup, suggested by docs. Signed-off-by: Corbin Simpson --- src/gallium/drivers/r300/r300_emit.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 8fe9a68886..fc823ad31f 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -309,13 +309,20 @@ void r300_emit_fb_state(struct r300_context* r300, CS_LOCALS(r300); BEGIN_CS((10 * fb->nr_cbufs) + (fb->zsbuf ? 10 : 0) + 4); + OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, + R300_RB3D_DSTCACHE_CTLSTAT_DC_FREE_FREE_3D_TAGS | + R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D); + OUT_CS_REG(R300_ZB_ZCACHE_CTLSTAT, + R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE | + R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE); + for (i = 0; i < fb->nr_cbufs; i++) { surf = fb->cbufs[i]; tex = (struct r300_texture*)surf->texture; assert(tex && tex->buffer && "cbuf is marked, but NULL!"); OUT_CS_REG_SEQ(R300_RB3D_COLOROFFSET0 + (4 * i), 1); - OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0); + OUT_CS_RELOC(tex->buffer, surf->offset, 0, RADEON_GEM_DOMAIN_VRAM, 0); OUT_CS_REG_SEQ(R300_RB3D_COLORPITCH0 + (4 * i), 1); OUT_CS_RELOC(tex->buffer, tex->pitch[surf->level] | @@ -332,7 +339,7 @@ void r300_emit_fb_state(struct r300_context* r300, assert(tex && tex->buffer && "zsbuf is marked, but NULL!"); OUT_CS_REG_SEQ(R300_ZB_DEPTHOFFSET, 1); - OUT_CS_RELOC(tex->buffer, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0); + OUT_CS_RELOC(tex->buffer, surf->offset, 0, RADEON_GEM_DOMAIN_VRAM, 0); OUT_CS_REG(R300_ZB_FORMAT, r300_translate_zsformat(tex->tex.format)); @@ -341,12 +348,6 @@ void r300_emit_fb_state(struct r300_context* r300, RADEON_GEM_DOMAIN_VRAM, 0); } - OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, - R300_RB3D_DSTCACHE_CTLSTAT_DC_FREE_FREE_3D_TAGS | - R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D); - OUT_CS_REG(R300_ZB_ZCACHE_CTLSTAT, - R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE | - R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE); END_CS; } -- cgit v1.2.3 From 4671005a4317fa37aea8786740470a40906fbfa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 3 Nov 2009 16:58:39 +0100 Subject: r300g: fix the size of CS when emitting the fragprog constant buffer Signed-off-by: Corbin Simpson --- src/gallium/drivers/r300/r300_emit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index fc823ad31f..6415c59c2d 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -285,7 +285,7 @@ void r500_emit_fs_constant_buffer(struct r300_context* r300, if (constants->Count == 0) return; - BEGIN_CS(constants->Count * 4 + 2); + BEGIN_CS(constants->Count * 4 + 3); OUT_CS_REG(R500_GA_US_VECTOR_INDEX, R500_GA_US_VECTOR_INDEX_TYPE_CONST); OUT_CS_ONE_REG(R500_GA_US_VECTOR_DATA, constants->Count * 4); for (i = 0; i < constants->Count; i++) { -- cgit v1.2.3 From c2e47191d72e16aaa1fae4f47bbed7639c2ff201 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 4 Nov 2009 10:56:44 +0100 Subject: r300g: add polygon mode Signed-off-by: Corbin Simpson --- src/gallium/drivers/r300/r300_context.h | 1 + src/gallium/drivers/r300/r300_emit.c | 3 ++- src/gallium/drivers/r300/r300_state.c | 27 +++++++++++++++++++ src/gallium/drivers/r300/r300_state_inlines.h | 36 +++++++++++++++++++++++++ src/gallium/drivers/r300/r300_state_invariant.c | 3 +-- 5 files changed, 67 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 8c65c04d01..850e5a41c9 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -78,6 +78,7 @@ struct r300_rs_state { uint32_t line_stipple_config; /* R300_GA_LINE_STIPPLE_CONFIG: 0x4328 */ uint32_t line_stipple_value; /* R300_GA_LINE_STIPPLE_VALUE: 0x4260 */ uint32_t color_control; /* R300_GA_COLOR_CONTROL: 0x4278 */ + uint32_t polygon_mode; /* R300_GA_POLY_MODE: 0x4288 */ }; struct r300_rs_block { diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 6415c59c2d..69ce5966e8 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -483,7 +483,7 @@ void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs) { CS_LOCALS(r300); - BEGIN_CS(20); + BEGIN_CS(22); OUT_CS_REG(R300_VAP_CNTL_STATUS, rs->vap_control_status); OUT_CS_REG(R300_GA_POINT_SIZE, rs->point_size); OUT_CS_REG_SEQ(R300_GA_POINT_MINMAX, 2); @@ -499,6 +499,7 @@ void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs) OUT_CS_REG(R300_GA_LINE_STIPPLE_CONFIG, rs->line_stipple_config); OUT_CS_REG(R300_GA_LINE_STIPPLE_VALUE, rs->line_stipple_value); OUT_CS_REG(R300_GA_COLOR_CONTROL, rs->color_control); + OUT_CS_REG(R300_GA_POLY_MODE, rs->polygon_mode); END_CS; } diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 242ec9f365..658a8cba13 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -398,25 +398,52 @@ static void* r300_create_rs_state(struct pipe_context* pipe, rs->line_control = pack_float_16_6x(state->line_width) | R300_GA_LINE_CNTL_END_TYPE_COMP; + /* XXX I think there is something wrong with the polygon mode, + * XXX re-test when r300g is in a better shape */ + + /* Enable polygon mode */ + if (state->fill_cw != PIPE_POLYGON_MODE_FILL || + state->fill_ccw != PIPE_POLYGON_MODE_FILL) { + rs->polygon_mode = R300_GA_POLY_MODE_DUAL; + } + /* Radeons don't think in "CW/CCW", they think in "front/back". */ if (state->front_winding == PIPE_WINDING_CW) { rs->cull_mode = R300_FRONT_FACE_CW; + /* Polygon offset */ if (state->offset_cw) { rs->polygon_offset_enable |= R300_FRONT_ENABLE; } if (state->offset_ccw) { rs->polygon_offset_enable |= R300_BACK_ENABLE; } + + /* Polygon mode */ + if (rs->polygon_mode) { + rs->polygon_mode |= + r300_translate_polygon_mode_front(state->fill_cw); + rs->polygon_mode |= + r300_translate_polygon_mode_back(state->fill_ccw); + } } else { rs->cull_mode = R300_FRONT_FACE_CCW; + /* Polygon offset */ if (state->offset_ccw) { rs->polygon_offset_enable |= R300_FRONT_ENABLE; } if (state->offset_cw) { rs->polygon_offset_enable |= R300_BACK_ENABLE; } + + /* Polygon mode */ + if (rs->polygon_mode) { + rs->polygon_mode |= + r300_translate_polygon_mode_front(state->fill_ccw); + rs->polygon_mode |= + r300_translate_polygon_mode_back(state->fill_cw); + } } if (state->front_winding & state->cull_mode) { rs->cull_mode |= R300_CULL_FRONT; diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index 176e59f281..52b9650fc1 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -504,4 +504,40 @@ r300_translate_vertex_data_swizzle(enum pipe_format format) { (0xf << R300_WRITE_ENA_SHIFT)); } +static INLINE uint32_t +r300_translate_polygon_mode_front(unsigned mode) { + switch (mode) + { + case PIPE_POLYGON_MODE_FILL: + return R300_GA_POLY_MODE_FRONT_PTYPE_TRI; + case PIPE_POLYGON_MODE_LINE: + return R300_GA_POLY_MODE_FRONT_PTYPE_LINE; + case PIPE_POLYGON_MODE_POINT: + return R300_GA_POLY_MODE_FRONT_PTYPE_POINT; + + default: + debug_printf("r300: Bad polygon mode %i in %s\n", mode, + __FUNCTION__); + return R300_GA_POLY_MODE_FRONT_PTYPE_TRI; + } +} + +static INLINE uint32_t +r300_translate_polygon_mode_back(unsigned mode) { + switch (mode) + { + case PIPE_POLYGON_MODE_FILL: + return R300_GA_POLY_MODE_BACK_PTYPE_TRI; + case PIPE_POLYGON_MODE_LINE: + return R300_GA_POLY_MODE_BACK_PTYPE_LINE; + case PIPE_POLYGON_MODE_POINT: + return R300_GA_POLY_MODE_BACK_PTYPE_POINT; + + default: + debug_printf("r300: Bad polygon mode %i in %s\n", mode, + __FUNCTION__); + return R300_GA_POLY_MODE_BACK_PTYPE_TRI; + } +} + #endif /* R300_STATE_INLINES_H */ diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c index 7e4d5c7c72..c07e6ae676 100644 --- a/src/gallium/drivers/r300/r300_state_invariant.c +++ b/src/gallium/drivers/r300/r300_state_invariant.c @@ -84,7 +84,7 @@ void r300_emit_invariant_state(struct r300_context* r300) END_CS; /* XXX unsorted stuff from surface_fill */ - BEGIN_CS(62 + (caps->has_tcl ? 5 : 0) + (caps->is_r500 ? 4 : 0)); + BEGIN_CS(60 + (caps->has_tcl ? 5 : 0) + (caps->is_r500 ? 4 : 0)); /* Flush PVS. */ OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0); @@ -114,7 +114,6 @@ void r300_emit_invariant_state(struct r300_context* r300) /* XXX this big chunk should be refactored into rs_state */ OUT_CS_REG(R300_GA_SOLID_RG, 0x00000000); OUT_CS_REG(R300_GA_SOLID_BA, 0x00000000); - OUT_CS_REG(R300_GA_POLY_MODE, 0x00000000); OUT_CS_REG(R300_GA_ROUND_MODE, 0x00000001); OUT_CS_REG(R300_GA_OFFSET, 0x00000000); OUT_CS_REG(R300_GA_FOG_SCALE, 0x3DBF1412); -- cgit v1.2.3 From c621c100b25c83ee9790ed39b27bd95a13a69377 Mon Sep 17 00:00:00 2001 From: Cooper Yuan Date: Thu, 5 Nov 2009 15:59:27 +0800 Subject: g3dvl: add scissor setting --- src/gallium/auxiliary/vl/vl_compositor.c | 4 ++++ src/gallium/auxiliary/vl/vl_compositor.h | 1 + src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 7 +++++++ src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h | 1 + 4 files changed, 13 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index b36dbeb208..cda6dc134a 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -473,8 +473,12 @@ void vl_compositor_render(struct vl_compositor *compositor, compositor->viewport.translate[2] = 0; compositor->viewport.translate[3] = 0; + compositor->scissor.maxx = compositor->fb_state.width; + compositor->scissor.maxy = compositor->fb_state.height; + compositor->pipe->set_framebuffer_state(compositor->pipe, &compositor->fb_state); compositor->pipe->set_viewport_state(compositor->pipe, &compositor->viewport); + compositor->pipe->set_scissor_state(compositor->pipe, &compositor->scissor); compositor->pipe->bind_sampler_states(compositor->pipe, 1, &compositor->sampler); compositor->pipe->set_sampler_textures(compositor->pipe, 1, &src_surface); compositor->pipe->bind_vs_state(compositor->pipe, compositor->vertex_shader); diff --git a/src/gallium/auxiliary/vl/vl_compositor.h b/src/gallium/auxiliary/vl/vl_compositor.h index 17e2afd353..f441901a75 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.h +++ b/src/gallium/auxiliary/vl/vl_compositor.h @@ -44,6 +44,7 @@ struct vl_compositor void *vertex_shader; void *fragment_shader; struct pipe_viewport_state viewport; + struct pipe_scissor_state scissor; struct pipe_vertex_buffer vertex_bufs[2]; struct pipe_vertex_element vertex_elems[2]; struct pipe_constant_buffer vs_const_buf, fs_const_buf; diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index 6b3614821c..12eef78b76 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -721,6 +721,11 @@ init_pipe_state(struct vl_mpeg12_mc_renderer *r) r->viewport.translate[2] = 0; r->viewport.translate[3] = 0; + r->scissor.maxx = r->pot_buffers ? + util_next_power_of_two(r->picture_width) : r->picture_width; + r->scissor.maxy = r->pot_buffers ? + util_next_power_of_two(r->picture_height) : r->picture_height; + r->fb_state.width = r->pot_buffers ? util_next_power_of_two(r->picture_width) : r->picture_width; r->fb_state.height = r->pot_buffers ? @@ -1270,6 +1275,7 @@ flush(struct vl_mpeg12_mc_renderer *r) r->pipe->set_framebuffer_state(r->pipe, &r->fb_state); r->pipe->set_viewport_state(r->pipe, &r->viewport); + r->pipe->set_scissor_state(r->pipe, &r->scissor); vs_consts = pipe_buffer_map ( @@ -1386,6 +1392,7 @@ flush(struct vl_mpeg12_mc_renderer *r) vb_start += num_macroblocks[MACROBLOCK_TYPE_BI_FIELD_PRED] * 24; } + r->pipe->clear(r->pipe, 1, a, 1, 0); r->pipe->flush(r->pipe, PIPE_FLUSH_RENDER_CACHE, r->fence); pipe_surface_reference(&r->fb_state.cbufs[0], NULL); diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h index 5d2c1273ee..64184337a0 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.h @@ -62,6 +62,7 @@ struct vl_mpeg12_mc_renderer unsigned macroblocks_per_batch; struct pipe_viewport_state viewport; + struct pipe_scissor_state scissor; struct pipe_constant_buffer vs_const_buf; struct pipe_constant_buffer fs_const_buf; struct pipe_framebuffer_state fb_state; -- cgit v1.2.3 From e0590159ce68e0fc9bac21bcfddc9193f4ccdac5 Mon Sep 17 00:00:00 2001 From: Cooper Yuan Date: Thu, 5 Nov 2009 16:06:01 +0800 Subject: g3dvl: remove a debug line --- src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index 12eef78b76..c4ba69817f 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -1392,7 +1392,6 @@ flush(struct vl_mpeg12_mc_renderer *r) vb_start += num_macroblocks[MACROBLOCK_TYPE_BI_FIELD_PRED] * 24; } - r->pipe->clear(r->pipe, 1, a, 1, 0); r->pipe->flush(r->pipe, PIPE_FLUSH_RENDER_CACHE, r->fence); pipe_surface_reference(&r->fb_state.cbufs[0], NULL); -- cgit v1.2.3 From 67034b9efce43a7b83f79e44beb6d4e8f6dff22a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 5 Nov 2009 17:05:20 +0000 Subject: softpipe: Implement PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE for destination. It is a valid and tested combination on D3D9. --- src/gallium/drivers/softpipe/sp_quad_blend.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_quad_blend.c b/src/gallium/drivers/softpipe/sp_quad_blend.c index 0ad0b98654..fe6b6cec35 100644 --- a/src/gallium/drivers/softpipe/sp_quad_blend.c +++ b/src/gallium/drivers/softpipe/sp_quad_blend.c @@ -478,7 +478,15 @@ blend_quad(struct quad_stage *qs, VEC4_MUL(dest[2], dest[2], dest[2]); /* B */ break; case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: - assert(0); /* illegal */ + { + const float *alpha = quadColor[3]; + float diff[4], temp[4]; + VEC4_SUB(diff, one, dest[3]); + VEC4_MIN(temp, alpha, diff); + VEC4_MUL(dest[0], quadColor[0], temp); /* R */ + VEC4_MUL(dest[1], quadColor[1], temp); /* G */ + VEC4_MUL(dest[2], quadColor[2], temp); /* B */ + } break; case PIPE_BLENDFACTOR_CONST_COLOR: { @@ -600,7 +608,7 @@ blend_quad(struct quad_stage *qs, VEC4_MUL(dest[3], dest[3], dest[3]); /* A */ break; case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: - assert(0); /* illegal */ + /* dest = dest * 1 NO-OP, leave dest as-is */ break; case PIPE_BLENDFACTOR_CONST_COLOR: /* fall-through */ -- cgit v1.2.3 From d971069fc6f5dcec64b1f1a60a8a2e7063aaf018 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 5 Nov 2009 13:16:19 -0700 Subject: mesa: fix infinite loop bug in _mesa_drawbuffers() Fixes bug 24946. This regression came from 8df699b3bb1aa05b633f05b121d09d812c86a22d. --- src/mesa/main/buffers.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index e76cf87cb0..7f77c5d772 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -424,9 +424,10 @@ _mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers, while (buf < ctx->Const.MaxDrawBuffers) { if (fb->_ColorDrawBufferIndexes[buf] != -1) { fb->_ColorDrawBufferIndexes[buf] = -1; - buf++; + newState = GL_TRUE; } fb->ColorDrawBuffer[buf] = GL_NONE; + buf++; } fb->_NumColorDrawBuffers = count; } -- cgit v1.2.3 From 63191bd244f18fd78bebb9586d2b85ab9d5b38e2 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 5 Nov 2009 16:48:50 -0700 Subject: xmesa: pass pixmap to clip_for_xgetimage() The code was assuming ctx->DrawBuffer == ctx->ReadBuffer. Passing the pixmap is simpler and better. Fixes a potential segfault. --- src/mesa/drivers/x11/xm_span.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/x11/xm_span.c b/src/mesa/drivers/x11/xm_span.c index 309cefcb8e..c39d87c451 100644 --- a/src/mesa/drivers/x11/xm_span.c +++ b/src/mesa/drivers/x11/xm_span.c @@ -3773,7 +3773,7 @@ static void put_values_ci_ximage( PUT_VALUES_ARGS ) * else return number of pixels to skip in the destination array. */ static int -clip_for_xgetimage(GLcontext *ctx, GLuint *n, GLint *x, GLint *y) +clip_for_xgetimage(GLcontext *ctx, XMesaPixmap pixmap, GLuint *n, GLint *x, GLint *y) { XMesaContext xmesa = XMESA_CONTEXT(ctx); XMesaBuffer source = XMESA_BUFFER(ctx->DrawBuffer); @@ -3783,7 +3783,7 @@ clip_for_xgetimage(GLcontext *ctx, GLuint *n, GLint *x, GLint *y) GLint dx, dy; if (source->type == PBUFFER || source->type == PIXMAP) return 0; - XTranslateCoordinates(xmesa->display, source->frontxrb->pixmap, rootWin, + XTranslateCoordinates(xmesa->display, pixmap, rootWin, *x, *y, &dx, &dy, &child); if (dx >= screenWidth) { /* totally clipped on right */ @@ -3827,7 +3827,7 @@ get_row_ci(GLcontext *ctx, struct gl_renderbuffer *rb, #ifndef XFree86Server XMesaImage *span = NULL; int error; - int k = clip_for_xgetimage(ctx, &n, &x, &y); + int k = clip_for_xgetimage(ctx, xrb->pixmap, &n, &x, &y); if (k < 0) return; index += k; @@ -3892,7 +3892,7 @@ get_row_rgba(GLcontext *ctx, struct gl_renderbuffer *rb, #else int k; y = YFLIP(xrb, y); - k = clip_for_xgetimage(ctx, &n, &x, &y); + k = clip_for_xgetimage(ctx, xrb->pixmap, &n, &x, &y); if (k < 0) return; rgba += k; -- cgit v1.2.3 From 25728860fcb65b53cf7212d54d39a01a3dc90a49 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Fri, 6 Nov 2009 00:17:43 -0500 Subject: st/xorg: unify vertex buffer handling first step on our way to batching --- src/gallium/state_trackers/xorg/xorg_renderer.c | 130 ++++++++++++------------ src/gallium/state_trackers/xorg/xorg_renderer.h | 4 +- 2 files changed, 66 insertions(+), 68 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index ac2c4935a5..c11f250e69 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -56,32 +56,32 @@ renderer_init_state(struct xorg_renderer *r) static INLINE void -setup_vertex0(float vertex[2][4], float x, float y, +setup_vertex0(float *vertex, float x, float y, float color[4]) { - vertex[0][0] = x; - vertex[0][1] = y; - vertex[0][2] = 0.f; /*z*/ - vertex[0][3] = 1.f; /*w*/ - - vertex[1][0] = color[0]; /*r*/ - vertex[1][1] = color[1]; /*g*/ - vertex[1][2] = color[2]; /*b*/ - vertex[1][3] = color[3]; /*a*/ + vertex[0] = x; + vertex[1] = y; + vertex[2] = 0.f; /*z*/ + vertex[3] = 1.f; /*w*/ + + vertex[4] = color[0]; /*r*/ + vertex[5] = color[1]; /*g*/ + vertex[6] = color[2]; /*b*/ + vertex[7] = color[3]; /*a*/ } static INLINE void -setup_vertex1(float vertex[2][4], float x, float y, float s, float t) +setup_vertex1(float *vertex, float x, float y, float s, float t) { - vertex[0][0] = x; - vertex[0][1] = y; - vertex[0][2] = 0.f; /*z*/ - vertex[0][3] = 1.f; /*w*/ - - vertex[1][0] = s; /*s*/ - vertex[1][1] = t; /*t*/ - vertex[1][2] = 0.f; /*r*/ - vertex[1][3] = 1.f; /*q*/ + vertex[0] = x; + vertex[1] = y; + vertex[2] = 0.f; /*z*/ + vertex[3] = 1.f; /*w*/ + + vertex[4] = s; /*s*/ + vertex[5] = t; /*t*/ + vertex[6] = 0.f; /*r*/ + vertex[7] = 1.f; /*q*/ } static struct pipe_buffer * @@ -109,17 +109,17 @@ setup_vertex_data1(struct xorg_renderer *r, t1 = pt1[1] / src->height[0]; /* 1st vertex */ - setup_vertex1(r->vertices2[0], dstX, dstY, s0, t0); + setup_vertex1(r->vertices, dstX, dstY, s0, t0); /* 2nd vertex */ - setup_vertex1(r->vertices2[1], dstX + width, dstY, s1, t0); + setup_vertex1(r->vertices + 2*4, dstX + width, dstY, s1, t0); /* 3rd vertex */ - setup_vertex1(r->vertices2[2], dstX + width, dstY + height, s1, t1); + setup_vertex1(r->vertices + 4*4, dstX + width, dstY + height, s1, t1); /* 4th vertex */ - setup_vertex1(r->vertices2[3], dstX, dstY + height, s0, t1); + setup_vertex1(r->vertices + 6*4, dstX, dstY + height, s0, t1); return pipe_user_buffer_create(r->pipe->screen, - r->vertices2, - sizeof(r->vertices2)); + r->vertices, + sizeof(float)*8*4); } static struct pipe_buffer * @@ -129,37 +129,37 @@ setup_vertex_data_tex(struct xorg_renderer *r, float z) { /* 1st vertex */ - setup_vertex1(r->vertices2[0], x0, y0, s0, t0); + setup_vertex1(r->vertices, x0, y0, s0, t0); /* 2nd vertex */ - setup_vertex1(r->vertices2[1], x1, y0, s1, t0); + setup_vertex1(r->vertices + 2*4, x1, y0, s1, t0); /* 3rd vertex */ - setup_vertex1(r->vertices2[2], x1, y1, s1, t1); + setup_vertex1(r->vertices + 4*4, x1, y1, s1, t1); /* 4th vertex */ - setup_vertex1(r->vertices2[3], x0, y1, s0, t1); + setup_vertex1(r->vertices + 6*4, x0, y1, s0, t1); return pipe_user_buffer_create(r->pipe->screen, - r->vertices2, - sizeof(r->vertices2)); + r->vertices, + sizeof(float)*8*4); } static INLINE void -setup_vertex2(float vertex[3][4], float x, float y, +setup_vertex2(float *vertex, float x, float y, float s0, float t0, float s1, float t1) { - vertex[0][0] = x; - vertex[0][1] = y; - vertex[0][2] = 0.f; /*z*/ - vertex[0][3] = 1.f; /*w*/ - - vertex[1][0] = s0; /*s*/ - vertex[1][1] = t0; /*t*/ - vertex[1][2] = 0.f; /*r*/ - vertex[1][3] = 1.f; /*q*/ - - vertex[2][0] = s1; /*s*/ - vertex[2][1] = t1; /*t*/ - vertex[2][2] = 0.f; /*r*/ - vertex[2][3] = 1.f; /*q*/ + vertex[0] = x; + vertex[1] = y; + vertex[2] = 0.f; /*z*/ + vertex[3] = 1.f; /*w*/ + + vertex[4] = s0; /*s*/ + vertex[5] = t0; /*t*/ + vertex[6] = 0.f; /*r*/ + vertex[7] = 1.f; /*q*/ + + vertex[8] = s1; /*s*/ + vertex[9] = t1; /*t*/ + vertex[10] = 0.f; /*r*/ + vertex[11] = 1.f; /*q*/ } static struct pipe_buffer * @@ -206,22 +206,22 @@ setup_vertex_data2(struct xorg_renderer *r, mask_t1 = mpt1[1] / mask->height[0]; /* 1st vertex */ - setup_vertex2(r->vertices3[0], dstX, dstY, + setup_vertex2(r->vertices, dstX, dstY, src_s0, src_t0, mask_s0, mask_t0); /* 2nd vertex */ - setup_vertex2(r->vertices3[1], dstX + width, dstY, + setup_vertex2(r->vertices + 3*4, dstX + width, dstY, src_s1, src_t0, mask_s1, mask_t0); /* 3rd vertex */ - setup_vertex2(r->vertices3[2], dstX + width, dstY + height, + setup_vertex2(r->vertices + 6*4, dstX + width, dstY + height, src_s1, src_t1, mask_s1, mask_t1); /* 4th vertex */ - setup_vertex2(r->vertices3[3], dstX, dstY + height, + setup_vertex2(r->vertices + 9*4, dstX, dstY + height, src_s0, src_t1, mask_s0, mask_t1); return pipe_user_buffer_create(r->pipe->screen, - r->vertices3, - sizeof(r->vertices3)); + r->vertices, + sizeof(float)*12*4); } static struct pipe_buffer * @@ -244,21 +244,21 @@ setup_vertex_data_yuv(struct xorg_renderer *r, t1 = spt1[1] / tex[0]->height[0]; /* 1st vertex */ - setup_vertex1(r->vertices2[0], dstX, dstY, s0, t0); + setup_vertex1(r->vertices, dstX, dstY, s0, t0); /* 2nd vertex */ - setup_vertex1(r->vertices2[1], dstX + dstW, dstY, + setup_vertex1(r->vertices + 2*4, dstX + dstW, dstY, s1, t0); /* 3rd vertex */ - setup_vertex1(r->vertices2[2], dstX + dstW, dstY + dstH, + setup_vertex1(r->vertices + 4*4, dstX + dstW, dstY + dstH, s1, t1); /* 4th vertex */ - setup_vertex1(r->vertices2[3], dstX, dstY + dstH, + setup_vertex1(r->vertices + 6*4, dstX, dstY + dstH, s0, t1); return pipe_user_buffer_create(r->pipe->screen, - r->vertices2, - sizeof(r->vertices2)); + r->vertices, + sizeof(float)*8*4); } @@ -797,17 +797,17 @@ void renderer_draw_solid_rect(struct xorg_renderer *r, debug_printf("solid rect[(%d, %d), (%d, %d)], rgba[%f, %f, %f, %f]\n", x0, y0, x1, y1, color[0], color[1], color[2], color[3]);*/ /* 1st vertex */ - setup_vertex0(r->vertices2[0], x0, y0, color); + setup_vertex0(r->vertices, x0, y0, color); /* 2nd vertex */ - setup_vertex0(r->vertices2[1], x1, y0, color); + setup_vertex0(r->vertices + 2*4, x1, y0, color); /* 3rd vertex */ - setup_vertex0(r->vertices2[2], x1, y1, color); + setup_vertex0(r->vertices + 4*4, x1, y1, color); /* 4th vertex */ - setup_vertex0(r->vertices2[3], x0, y1, color); + setup_vertex0(r->vertices + 6*4, x0, y1, color); buf = pipe_user_buffer_create(pipe->screen, - r->vertices2, - sizeof(r->vertices2)); + r->vertices, + sizeof(float)*8*4); if (buf) { diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h index 34c9ee4541..f92f186eb6 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.h +++ b/src/gallium/state_trackers/xorg/xorg_renderer.h @@ -16,9 +16,7 @@ struct xorg_renderer { struct pipe_constant_buffer vs_const_buffer; struct pipe_constant_buffer fs_const_buffer; - /* we should combine these three */ - float vertices2[4][2][4]; - float vertices3[4][3][4]; + float vertices[4*3*4]; }; struct xorg_renderer *renderer_create(struct pipe_context *pipe); -- cgit v1.2.3 From 244591ae7b2582a1d1f5d2fdc2d3812643104eb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 6 Nov 2009 12:04:20 +0000 Subject: gallium: Add UNSYNCHRONIZED cpu access flag. Document others. --- src/gallium/include/pipe/p_defines.h | 59 ++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 6a61aea8fd..fd14dc8e92 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -225,9 +225,10 @@ enum pipe_transfer_usage { }; -/** +/* * Buffer usage flags */ + #define PIPE_BUFFER_USAGE_CPU_READ (1 << 0) #define PIPE_BUFFER_USAGE_CPU_WRITE (1 << 1) #define PIPE_BUFFER_USAGE_GPU_READ (1 << 2) @@ -236,9 +237,63 @@ enum pipe_transfer_usage { #define PIPE_BUFFER_USAGE_VERTEX (1 << 5) #define PIPE_BUFFER_USAGE_INDEX (1 << 6) #define PIPE_BUFFER_USAGE_CONSTANT (1 << 7) + +/* + * CPU access flags. + * + * These flags should only be used for texture transfers or when mapping + * buffers. + * + * Note that the PIPE_BUFFER_USAGE_CPU_xxx flags above are also used for + * mapping. Either PIPE_BUFFER_USAGE_CPU_READ or PIPE_BUFFER_USAGE_CPU_WRITE + * must be set. + */ + +/** + * Discards the memory within the mapped region. + * + * It should not be used with PIPE_BUFFER_USAGE_CPU_READ. + * + * See also: + * - OpenGL's ARB_map_buffer_range extension, MAP_INVALIDATE_RANGE_BIT flag. + * - Direct3D's D3DLOCK_DISCARD flag. + */ #define PIPE_BUFFER_USAGE_DISCARD (1 << 8) + +/** + * Fail if the resource cannot be mapped immediately. + * + * See also: + * - Direct3D's D3DLOCK_DONOTWAIT flag. + * - Mesa3D's MESA_MAP_NOWAIT_BIT flag. + * - WDDM's D3DDDICB_LOCKFLAGS.DonotWait flag. + */ #define PIPE_BUFFER_USAGE_DONTBLOCK (1 << 9) -#define PIPE_BUFFER_USAGE_FLUSH_EXPLICIT (1 << 10) /**< See pipe_screen::buffer_flush_mapped_range */ + +/** + * Do not attempt to synchronize pending operations on the resource when mapping. + * + * It should not be used with PIPE_BUFFER_USAGE_CPU_READ. + * + * See also: + * - OpenGL's ARB_map_buffer_range extension, MAP_UNSYNCHRONIZED_BIT flag. + * - Direct3D's D3DLOCK_NOOVERWRITE flag. + * - WDDM's D3DDDICB_LOCKFLAGS.IgnoreSync flag. + */ +#define PIPE_BUFFER_USAGE_UNSYNCHRONIZED (1 << 10) + +/** + * Written ranges will be notified later with + * pipe_screen::buffer_flush_mapped_range. + * + * It should not be used with PIPE_BUFFER_USAGE_CPU_READ. + * + * See also: + * - pipe_screen::buffer_flush_mapped_range + * - OpenGL's ARB_map_buffer_range extension, MAP_FLUSH_EXPLICIT_BIT flag. + */ +#define PIPE_BUFFER_USAGE_FLUSH_EXPLICIT (1 << 11) + /** Pipe driver custom usage flags should be greater or equal to this value */ #define PIPE_BUFFER_USAGE_CUSTOM (1 << 16) -- cgit v1.2.3 From f611425101eab5c4b41407c38966f4deca542f56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 6 Nov 2009 12:04:49 +0000 Subject: mesa: Translate MAP_UNSYNCHRONIZED_BIT. --- src/mesa/state_tracker/st_cb_bufferobjects.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index 8e09d0b932..63196afba9 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -239,6 +239,9 @@ st_bufferobj_map_range(GLcontext *ctx, GLenum target, if (access & GL_MAP_FLUSH_EXPLICIT_BIT) flags |= PIPE_BUFFER_USAGE_FLUSH_EXPLICIT; + if (access & GL_MAP_UNSYNCHRONIZED_BIT) + flags |= PIPE_BUFFER_USAGE_UNSYNCHRONIZED; + /* ... other flags ... */ -- cgit v1.2.3 From 577a598dc905d435a31422bb6135ee9d4352f6b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 6 Nov 2009 12:05:43 +0000 Subject: mesa: Export S3_s3tc as well. Used in Quake3. --- src/mesa/state_tracker/st_extensions.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 3f835d38dd..57fe72d76a 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -284,6 +284,7 @@ void st_init_extensions(struct st_context *st) PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_SAMPLER, 0)) { ctx->Extensions.EXT_texture_compression_s3tc = GL_TRUE; + ctx->Extensions.S3_s3tc = GL_TRUE; } /* ycbcr support */ -- cgit v1.2.3 From 38d3c156dc64679e5602816070a0bac4f1f39302 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 6 Nov 2009 07:59:18 -0700 Subject: intel: call intel_check_front_buffer_rendering() in intelClear() fixes bug 24953. --- src/mesa/drivers/dri/intel/intel_clear.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index fb62f0f430..1cf41ee6b8 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -33,6 +33,7 @@ #include "intel_context.h" #include "intel_blit.h" +#include "intel_buffers.h" #include "intel_chipset.h" #include "intel_clear.h" #include "intel_fbo.h" @@ -75,6 +76,8 @@ intelClear(GLcontext *ctx, GLbitfield mask) struct gl_framebuffer *fb = ctx->DrawBuffer; GLuint i; + intel_check_front_buffer_rendering(intel); + if (0) fprintf(stderr, "%s\n", __FUNCTION__); -- cgit v1.2.3 From 96e938f62c729fab74601627d54c9c4cf499ebdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 6 Nov 2009 15:08:05 +0000 Subject: llvmpipe: Fix build with llvm 2.6. Fixes bug 24949. --- src/gallium/drivers/llvmpipe/lp_bld_misc.cpp | 7 +++---- src/gallium/drivers/llvmpipe/lp_bld_misc.h | 8 +++++++- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_misc.cpp b/src/gallium/drivers/llvmpipe/lp_bld_misc.cpp index c9acaf1f16..d3f78c06d9 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_misc.cpp +++ b/src/gallium/drivers/llvmpipe/lp_bld_misc.cpp @@ -26,8 +26,6 @@ **************************************************************************/ -#include "llvm/Config/config.h" - #include "pipe/p_config.h" #include "lp_bld_misc.h" @@ -50,12 +48,13 @@ LLVMLinkInJIT(void) extern "C" int X86TargetMachineModule; -void +int LLVMInitializeNativeTarget(void) { #if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) - X86TargetMachineModule = 1; + X86TargetMachineModule = 1; #endif + return 0; } diff --git a/src/gallium/drivers/llvmpipe/lp_bld_misc.h b/src/gallium/drivers/llvmpipe/lp_bld_misc.h index 51a84c5e25..0e787e0b9c 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_misc.h +++ b/src/gallium/drivers/llvmpipe/lp_bld_misc.h @@ -30,17 +30,23 @@ #define LP_BLD_MISC_H +#include "llvm/Config/config.h" + #ifdef __cplusplus extern "C" { #endif +#ifndef LLVM_NATIVE_ARCH + void LLVMLinkInJIT(void); -void +int LLVMInitializeNativeTarget(void); +#endif /* !LLVM_NATIVE_ARCH */ + #ifdef __cplusplus } -- cgit v1.2.3 From 1c7337d46eab0cfd36ebc0ad22c5a66ec9b91d39 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 4 Nov 2009 12:03:44 -0800 Subject: Revert "ARB prog parser: Fix epic memory leak in lexer / parser interface" This reverts commit 93dae6761bc90bbd43b450d2673620ec189b2c7a. This change was completely broken when the parser uses multiple strings in a single production. It would be nice if bug fixes could initially land somewhere other than the stable branch. --- src/mesa/shader/lex.yy.c | 445 ++++++++++++++++-------------------- src/mesa/shader/program_lexer.l | 45 +--- src/mesa/shader/program_parse.tab.c | 21 +- src/mesa/shader/program_parse.y | 17 +- src/mesa/shader/program_parser.h | 16 -- 5 files changed, 207 insertions(+), 337 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/lex.yy.c b/src/mesa/shader/lex.yy.c index 728c2dc272..fefef573ee 100644 --- a/src/mesa/shader/lex.yy.c +++ b/src/mesa/shader/lex.yy.c @@ -53,6 +53,7 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -83,8 +84,6 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! C99 */ - #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -158,15 +157,7 @@ typedef void* yyscan_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else #define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -927,7 +918,7 @@ static yyconst flex_int16_t yy_chk[1023] = if (condition) { \ return token; \ } else { \ - yylval->string = return_string(yyextra, yytext); \ + yylval->string = strdup(yytext); \ return IDENTIFIER; \ } \ } while (0) @@ -950,7 +941,7 @@ static yyconst flex_int16_t yy_chk[1023] = yylval->temp_inst.SaturateMode = SATURATE_ ## sat; \ return token; \ } else { \ - yylval->string = return_string(yyextra, yytext); \ + yylval->string = strdup(yytext); \ return IDENTIFIER; \ } \ } while (0) @@ -958,45 +949,6 @@ static yyconst flex_int16_t yy_chk[1023] = #define SWIZZLE_INVAL MAKE_SWIZZLE4(SWIZZLE_NIL, SWIZZLE_NIL, \ SWIZZLE_NIL, SWIZZLE_NIL) -/** - * Send a string to the parser using asm_parser_state::string_dumpster - * - * Sends a string to the parser using asm_parser_state::string_dumpster as a - * temporary storage buffer. Data previously stored in - * asm_parser_state::string_dumpster will be lost. If - * asm_parser_state::string_dumpster is not large enough to hold the new - * string, the buffer size will be increased. The buffer size is \b never - * decreased. - * - * \param state Assembler parser state tracking - * \param str String to be passed to the parser - * - * \return - * A pointer to asm_parser_state::string_dumpster on success or \c NULL on - * failure. Currently the only failure case is \c ENOMEM. - */ -static char * -return_string(struct asm_parser_state *state, const char *str) -{ - const size_t len = strlen(str); - - if (len >= state->dumpster_size) { - char *const dumpster = _mesa_realloc(state->string_dumpster, - state->dumpster_size, - len + 1); - if (dumpster == NULL) { - return NULL; - } - - state->string_dumpster = dumpster; - state->dumpster_size = len + 1; - } - - memcpy(state->string_dumpster, str, len + 1); - return state->string_dumpster; -} - - static unsigned mask_from_char(char c) { @@ -1052,7 +1004,7 @@ swiz_from_char(char c) } while(0); #define YY_EXTRA_TYPE struct asm_parser_state * -#line 1056 "lex.yy.c" +#line 1008 "lex.yy.c" #define INITIAL 0 @@ -1189,12 +1141,7 @@ static int input (yyscan_t yyscanner ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else #define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -1202,7 +1149,7 @@ static int input (yyscan_t yyscanner ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) +#define ECHO fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1213,7 +1160,7 @@ static int input (yyscan_t yyscanner ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + unsigned n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -1298,10 +1245,10 @@ YY_DECL register int yy_act; struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; -#line 176 "program_lexer.l" +#line 137 "program_lexer.l" -#line 1305 "lex.yy.c" +#line 1252 "lex.yy.c" yylval = yylval_param; @@ -1390,17 +1337,17 @@ do_action: /* This label is used only to access EOF actions. */ case 1: YY_RULE_SETUP -#line 178 "program_lexer.l" +#line 139 "program_lexer.l" { return ARBvp_10; } YY_BREAK case 2: YY_RULE_SETUP -#line 179 "program_lexer.l" +#line 140 "program_lexer.l" { return ARBfp_10; } YY_BREAK case 3: YY_RULE_SETUP -#line 180 "program_lexer.l" +#line 141 "program_lexer.l" { yylval->integer = at_address; return_token_or_IDENTIFIER(require_ARB_vp, ADDRESS); @@ -1408,760 +1355,760 @@ YY_RULE_SETUP YY_BREAK case 4: YY_RULE_SETUP -#line 184 "program_lexer.l" +#line 145 "program_lexer.l" { return ALIAS; } YY_BREAK case 5: YY_RULE_SETUP -#line 185 "program_lexer.l" +#line 146 "program_lexer.l" { return ATTRIB; } YY_BREAK case 6: YY_RULE_SETUP -#line 186 "program_lexer.l" +#line 147 "program_lexer.l" { return END; } YY_BREAK case 7: YY_RULE_SETUP -#line 187 "program_lexer.l" +#line 148 "program_lexer.l" { return OPTION; } YY_BREAK case 8: YY_RULE_SETUP -#line 188 "program_lexer.l" +#line 149 "program_lexer.l" { return OUTPUT; } YY_BREAK case 9: YY_RULE_SETUP -#line 189 "program_lexer.l" +#line 150 "program_lexer.l" { return PARAM; } YY_BREAK case 10: YY_RULE_SETUP -#line 190 "program_lexer.l" +#line 151 "program_lexer.l" { yylval->integer = at_temp; return TEMP; } YY_BREAK case 11: YY_RULE_SETUP -#line 192 "program_lexer.l" +#line 153 "program_lexer.l" { return_opcode( 1, VECTOR_OP, ABS, OFF); } YY_BREAK case 12: YY_RULE_SETUP -#line 193 "program_lexer.l" +#line 154 "program_lexer.l" { return_opcode(require_ARB_fp, VECTOR_OP, ABS, ZERO_ONE); } YY_BREAK case 13: YY_RULE_SETUP -#line 194 "program_lexer.l" +#line 155 "program_lexer.l" { return_opcode( 1, BIN_OP, ADD, OFF); } YY_BREAK case 14: YY_RULE_SETUP -#line 195 "program_lexer.l" +#line 156 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, ADD, ZERO_ONE); } YY_BREAK case 15: YY_RULE_SETUP -#line 196 "program_lexer.l" +#line 157 "program_lexer.l" { return_opcode(require_ARB_vp, ARL, ARL, OFF); } YY_BREAK case 16: YY_RULE_SETUP -#line 198 "program_lexer.l" +#line 159 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, CMP, OFF); } YY_BREAK case 17: YY_RULE_SETUP -#line 199 "program_lexer.l" +#line 160 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, CMP, ZERO_ONE); } YY_BREAK case 18: YY_RULE_SETUP -#line 200 "program_lexer.l" +#line 161 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, COS, OFF); } YY_BREAK case 19: YY_RULE_SETUP -#line 201 "program_lexer.l" +#line 162 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, COS, ZERO_ONE); } YY_BREAK case 20: YY_RULE_SETUP -#line 203 "program_lexer.l" +#line 164 "program_lexer.l" { return_opcode( 1, BIN_OP, DP3, OFF); } YY_BREAK case 21: YY_RULE_SETUP -#line 204 "program_lexer.l" +#line 165 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, DP3, ZERO_ONE); } YY_BREAK case 22: YY_RULE_SETUP -#line 205 "program_lexer.l" +#line 166 "program_lexer.l" { return_opcode( 1, BIN_OP, DP4, OFF); } YY_BREAK case 23: YY_RULE_SETUP -#line 206 "program_lexer.l" +#line 167 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, DP4, ZERO_ONE); } YY_BREAK case 24: YY_RULE_SETUP -#line 207 "program_lexer.l" +#line 168 "program_lexer.l" { return_opcode( 1, BIN_OP, DPH, OFF); } YY_BREAK case 25: YY_RULE_SETUP -#line 208 "program_lexer.l" +#line 169 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, DPH, ZERO_ONE); } YY_BREAK case 26: YY_RULE_SETUP -#line 209 "program_lexer.l" +#line 170 "program_lexer.l" { return_opcode( 1, BIN_OP, DST, OFF); } YY_BREAK case 27: YY_RULE_SETUP -#line 210 "program_lexer.l" +#line 171 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, DST, ZERO_ONE); } YY_BREAK case 28: YY_RULE_SETUP -#line 212 "program_lexer.l" +#line 173 "program_lexer.l" { return_opcode( 1, SCALAR_OP, EX2, OFF); } YY_BREAK case 29: YY_RULE_SETUP -#line 213 "program_lexer.l" +#line 174 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, EX2, ZERO_ONE); } YY_BREAK case 30: YY_RULE_SETUP -#line 214 "program_lexer.l" +#line 175 "program_lexer.l" { return_opcode(require_ARB_vp, SCALAR_OP, EXP, OFF); } YY_BREAK case 31: YY_RULE_SETUP -#line 216 "program_lexer.l" +#line 177 "program_lexer.l" { return_opcode( 1, VECTOR_OP, FLR, OFF); } YY_BREAK case 32: YY_RULE_SETUP -#line 217 "program_lexer.l" +#line 178 "program_lexer.l" { return_opcode(require_ARB_fp, VECTOR_OP, FLR, ZERO_ONE); } YY_BREAK case 33: YY_RULE_SETUP -#line 218 "program_lexer.l" +#line 179 "program_lexer.l" { return_opcode( 1, VECTOR_OP, FRC, OFF); } YY_BREAK case 34: YY_RULE_SETUP -#line 219 "program_lexer.l" +#line 180 "program_lexer.l" { return_opcode(require_ARB_fp, VECTOR_OP, FRC, ZERO_ONE); } YY_BREAK case 35: YY_RULE_SETUP -#line 221 "program_lexer.l" +#line 182 "program_lexer.l" { return_opcode(require_ARB_fp, KIL, KIL, OFF); } YY_BREAK case 36: YY_RULE_SETUP -#line 223 "program_lexer.l" +#line 184 "program_lexer.l" { return_opcode( 1, VECTOR_OP, LIT, OFF); } YY_BREAK case 37: YY_RULE_SETUP -#line 224 "program_lexer.l" +#line 185 "program_lexer.l" { return_opcode(require_ARB_fp, VECTOR_OP, LIT, ZERO_ONE); } YY_BREAK case 38: YY_RULE_SETUP -#line 225 "program_lexer.l" +#line 186 "program_lexer.l" { return_opcode( 1, SCALAR_OP, LG2, OFF); } YY_BREAK case 39: YY_RULE_SETUP -#line 226 "program_lexer.l" +#line 187 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, LG2, ZERO_ONE); } YY_BREAK case 40: YY_RULE_SETUP -#line 227 "program_lexer.l" +#line 188 "program_lexer.l" { return_opcode(require_ARB_vp, SCALAR_OP, LOG, OFF); } YY_BREAK case 41: YY_RULE_SETUP -#line 228 "program_lexer.l" +#line 189 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, LRP, OFF); } YY_BREAK case 42: YY_RULE_SETUP -#line 229 "program_lexer.l" +#line 190 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, LRP, ZERO_ONE); } YY_BREAK case 43: YY_RULE_SETUP -#line 231 "program_lexer.l" +#line 192 "program_lexer.l" { return_opcode( 1, TRI_OP, MAD, OFF); } YY_BREAK case 44: YY_RULE_SETUP -#line 232 "program_lexer.l" +#line 193 "program_lexer.l" { return_opcode(require_ARB_fp, TRI_OP, MAD, ZERO_ONE); } YY_BREAK case 45: YY_RULE_SETUP -#line 233 "program_lexer.l" +#line 194 "program_lexer.l" { return_opcode( 1, BIN_OP, MAX, OFF); } YY_BREAK case 46: YY_RULE_SETUP -#line 234 "program_lexer.l" +#line 195 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, MAX, ZERO_ONE); } YY_BREAK case 47: YY_RULE_SETUP -#line 235 "program_lexer.l" +#line 196 "program_lexer.l" { return_opcode( 1, BIN_OP, MIN, OFF); } YY_BREAK case 48: YY_RULE_SETUP -#line 236 "program_lexer.l" +#line 197 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, MIN, ZERO_ONE); } YY_BREAK case 49: YY_RULE_SETUP -#line 237 "program_lexer.l" +#line 198 "program_lexer.l" { return_opcode( 1, VECTOR_OP, MOV, OFF); } YY_BREAK case 50: YY_RULE_SETUP -#line 238 "program_lexer.l" +#line 199 "program_lexer.l" { return_opcode(require_ARB_fp, VECTOR_OP, MOV, ZERO_ONE); } YY_BREAK case 51: YY_RULE_SETUP -#line 239 "program_lexer.l" +#line 200 "program_lexer.l" { return_opcode( 1, BIN_OP, MUL, OFF); } YY_BREAK case 52: YY_RULE_SETUP -#line 240 "program_lexer.l" +#line 201 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, MUL, ZERO_ONE); } YY_BREAK case 53: YY_RULE_SETUP -#line 242 "program_lexer.l" +#line 203 "program_lexer.l" { return_opcode( 1, BINSC_OP, POW, OFF); } YY_BREAK case 54: YY_RULE_SETUP -#line 243 "program_lexer.l" +#line 204 "program_lexer.l" { return_opcode(require_ARB_fp, BINSC_OP, POW, ZERO_ONE); } YY_BREAK case 55: YY_RULE_SETUP -#line 245 "program_lexer.l" +#line 206 "program_lexer.l" { return_opcode( 1, SCALAR_OP, RCP, OFF); } YY_BREAK case 56: YY_RULE_SETUP -#line 246 "program_lexer.l" +#line 207 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, RCP, ZERO_ONE); } YY_BREAK case 57: YY_RULE_SETUP -#line 247 "program_lexer.l" +#line 208 "program_lexer.l" { return_opcode( 1, SCALAR_OP, RSQ, OFF); } YY_BREAK case 58: YY_RULE_SETUP -#line 248 "program_lexer.l" +#line 209 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, RSQ, ZERO_ONE); } YY_BREAK case 59: YY_RULE_SETUP -#line 250 "program_lexer.l" +#line 211 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SCS, OFF); } YY_BREAK case 60: YY_RULE_SETUP -#line 251 "program_lexer.l" +#line 212 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SCS, ZERO_ONE); } YY_BREAK case 61: YY_RULE_SETUP -#line 252 "program_lexer.l" +#line 213 "program_lexer.l" { return_opcode( 1, BIN_OP, SGE, OFF); } YY_BREAK case 62: YY_RULE_SETUP -#line 253 "program_lexer.l" +#line 214 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, SGE, ZERO_ONE); } YY_BREAK case 63: YY_RULE_SETUP -#line 254 "program_lexer.l" +#line 215 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SIN, OFF); } YY_BREAK case 64: YY_RULE_SETUP -#line 255 "program_lexer.l" +#line 216 "program_lexer.l" { return_opcode(require_ARB_fp, SCALAR_OP, SIN, ZERO_ONE); } YY_BREAK case 65: YY_RULE_SETUP -#line 256 "program_lexer.l" +#line 217 "program_lexer.l" { return_opcode( 1, BIN_OP, SLT, OFF); } YY_BREAK case 66: YY_RULE_SETUP -#line 257 "program_lexer.l" +#line 218 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, SLT, ZERO_ONE); } YY_BREAK case 67: YY_RULE_SETUP -#line 258 "program_lexer.l" +#line 219 "program_lexer.l" { return_opcode( 1, BIN_OP, SUB, OFF); } YY_BREAK case 68: YY_RULE_SETUP -#line 259 "program_lexer.l" +#line 220 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, SUB, ZERO_ONE); } YY_BREAK case 69: YY_RULE_SETUP -#line 260 "program_lexer.l" +#line 221 "program_lexer.l" { return_opcode( 1, SWZ, SWZ, OFF); } YY_BREAK case 70: YY_RULE_SETUP -#line 261 "program_lexer.l" +#line 222 "program_lexer.l" { return_opcode(require_ARB_fp, SWZ, SWZ, ZERO_ONE); } YY_BREAK case 71: YY_RULE_SETUP -#line 263 "program_lexer.l" +#line 224 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TEX, OFF); } YY_BREAK case 72: YY_RULE_SETUP -#line 264 "program_lexer.l" +#line 225 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TEX, ZERO_ONE); } YY_BREAK case 73: YY_RULE_SETUP -#line 265 "program_lexer.l" +#line 226 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, OFF); } YY_BREAK case 74: YY_RULE_SETUP -#line 266 "program_lexer.l" +#line 227 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXB, ZERO_ONE); } YY_BREAK case 75: YY_RULE_SETUP -#line 267 "program_lexer.l" +#line 228 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, OFF); } YY_BREAK case 76: YY_RULE_SETUP -#line 268 "program_lexer.l" +#line 229 "program_lexer.l" { return_opcode(require_ARB_fp, SAMPLE_OP, TXP, ZERO_ONE); } YY_BREAK case 77: YY_RULE_SETUP -#line 270 "program_lexer.l" +#line 231 "program_lexer.l" { return_opcode( 1, BIN_OP, XPD, OFF); } YY_BREAK case 78: YY_RULE_SETUP -#line 271 "program_lexer.l" +#line 232 "program_lexer.l" { return_opcode(require_ARB_fp, BIN_OP, XPD, ZERO_ONE); } YY_BREAK case 79: YY_RULE_SETUP -#line 273 "program_lexer.l" +#line 234 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_vp, VERTEX); } YY_BREAK case 80: YY_RULE_SETUP -#line 274 "program_lexer.l" +#line 235 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, FRAGMENT); } YY_BREAK case 81: YY_RULE_SETUP -#line 275 "program_lexer.l" +#line 236 "program_lexer.l" { return PROGRAM; } YY_BREAK case 82: YY_RULE_SETUP -#line 276 "program_lexer.l" +#line 237 "program_lexer.l" { return STATE; } YY_BREAK case 83: YY_RULE_SETUP -#line 277 "program_lexer.l" +#line 238 "program_lexer.l" { return RESULT; } YY_BREAK case 84: YY_RULE_SETUP -#line 279 "program_lexer.l" +#line 240 "program_lexer.l" { return AMBIENT; } YY_BREAK case 85: YY_RULE_SETUP -#line 280 "program_lexer.l" +#line 241 "program_lexer.l" { return ATTENUATION; } YY_BREAK case 86: YY_RULE_SETUP -#line 281 "program_lexer.l" +#line 242 "program_lexer.l" { return BACK; } YY_BREAK case 87: YY_RULE_SETUP -#line 282 "program_lexer.l" +#line 243 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, CLIP); } YY_BREAK case 88: YY_RULE_SETUP -#line 283 "program_lexer.l" +#line 244 "program_lexer.l" { return COLOR; } YY_BREAK case 89: YY_RULE_SETUP -#line 284 "program_lexer.l" +#line 245 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, DEPTH); } YY_BREAK case 90: YY_RULE_SETUP -#line 285 "program_lexer.l" +#line 246 "program_lexer.l" { return DIFFUSE; } YY_BREAK case 91: YY_RULE_SETUP -#line 286 "program_lexer.l" +#line 247 "program_lexer.l" { return DIRECTION; } YY_BREAK case 92: YY_RULE_SETUP -#line 287 "program_lexer.l" +#line 248 "program_lexer.l" { return EMISSION; } YY_BREAK case 93: YY_RULE_SETUP -#line 288 "program_lexer.l" +#line 249 "program_lexer.l" { return ENV; } YY_BREAK case 94: YY_RULE_SETUP -#line 289 "program_lexer.l" +#line 250 "program_lexer.l" { return EYE; } YY_BREAK case 95: YY_RULE_SETUP -#line 290 "program_lexer.l" +#line 251 "program_lexer.l" { return FOGCOORD; } YY_BREAK case 96: YY_RULE_SETUP -#line 291 "program_lexer.l" +#line 252 "program_lexer.l" { return FOG; } YY_BREAK case 97: YY_RULE_SETUP -#line 292 "program_lexer.l" +#line 253 "program_lexer.l" { return FRONT; } YY_BREAK case 98: YY_RULE_SETUP -#line 293 "program_lexer.l" +#line 254 "program_lexer.l" { return HALF; } YY_BREAK case 99: YY_RULE_SETUP -#line 294 "program_lexer.l" +#line 255 "program_lexer.l" { return INVERSE; } YY_BREAK case 100: YY_RULE_SETUP -#line 295 "program_lexer.l" +#line 256 "program_lexer.l" { return INVTRANS; } YY_BREAK case 101: YY_RULE_SETUP -#line 296 "program_lexer.l" +#line 257 "program_lexer.l" { return LIGHT; } YY_BREAK case 102: YY_RULE_SETUP -#line 297 "program_lexer.l" +#line 258 "program_lexer.l" { return LIGHTMODEL; } YY_BREAK case 103: YY_RULE_SETUP -#line 298 "program_lexer.l" +#line 259 "program_lexer.l" { return LIGHTPROD; } YY_BREAK case 104: YY_RULE_SETUP -#line 299 "program_lexer.l" +#line 260 "program_lexer.l" { return LOCAL; } YY_BREAK case 105: YY_RULE_SETUP -#line 300 "program_lexer.l" +#line 261 "program_lexer.l" { return MATERIAL; } YY_BREAK case 106: YY_RULE_SETUP -#line 301 "program_lexer.l" +#line 262 "program_lexer.l" { return MAT_PROGRAM; } YY_BREAK case 107: YY_RULE_SETUP -#line 302 "program_lexer.l" +#line 263 "program_lexer.l" { return MATRIX; } YY_BREAK case 108: YY_RULE_SETUP -#line 303 "program_lexer.l" +#line 264 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, MATRIXINDEX); } YY_BREAK case 109: YY_RULE_SETUP -#line 304 "program_lexer.l" +#line 265 "program_lexer.l" { return MODELVIEW; } YY_BREAK case 110: YY_RULE_SETUP -#line 305 "program_lexer.l" +#line 266 "program_lexer.l" { return MVP; } YY_BREAK case 111: YY_RULE_SETUP -#line 306 "program_lexer.l" +#line 267 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, NORMAL); } YY_BREAK case 112: YY_RULE_SETUP -#line 307 "program_lexer.l" +#line 268 "program_lexer.l" { return OBJECT; } YY_BREAK case 113: YY_RULE_SETUP -#line 308 "program_lexer.l" +#line 269 "program_lexer.l" { return PALETTE; } YY_BREAK case 114: YY_RULE_SETUP -#line 309 "program_lexer.l" +#line 270 "program_lexer.l" { return PARAMS; } YY_BREAK case 115: YY_RULE_SETUP -#line 310 "program_lexer.l" +#line 271 "program_lexer.l" { return PLANE; } YY_BREAK case 116: YY_RULE_SETUP -#line 311 "program_lexer.l" +#line 272 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, POINT_TOK); } YY_BREAK case 117: YY_RULE_SETUP -#line 312 "program_lexer.l" +#line 273 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, POINTSIZE); } YY_BREAK case 118: YY_RULE_SETUP -#line 313 "program_lexer.l" +#line 274 "program_lexer.l" { return POSITION; } YY_BREAK case 119: YY_RULE_SETUP -#line 314 "program_lexer.l" +#line 275 "program_lexer.l" { return PRIMARY; } YY_BREAK case 120: YY_RULE_SETUP -#line 315 "program_lexer.l" +#line 276 "program_lexer.l" { return PROJECTION; } YY_BREAK case 121: YY_RULE_SETUP -#line 316 "program_lexer.l" +#line 277 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, RANGE); } YY_BREAK case 122: YY_RULE_SETUP -#line 317 "program_lexer.l" +#line 278 "program_lexer.l" { return ROW; } YY_BREAK case 123: YY_RULE_SETUP -#line 318 "program_lexer.l" +#line 279 "program_lexer.l" { return SCENECOLOR; } YY_BREAK case 124: YY_RULE_SETUP -#line 319 "program_lexer.l" +#line 280 "program_lexer.l" { return SECONDARY; } YY_BREAK case 125: YY_RULE_SETUP -#line 320 "program_lexer.l" +#line 281 "program_lexer.l" { return SHININESS; } YY_BREAK case 126: YY_RULE_SETUP -#line 321 "program_lexer.l" +#line 282 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, SIZE_TOK); } YY_BREAK case 127: YY_RULE_SETUP -#line 322 "program_lexer.l" +#line 283 "program_lexer.l" { return SPECULAR; } YY_BREAK case 128: YY_RULE_SETUP -#line 323 "program_lexer.l" +#line 284 "program_lexer.l" { return SPOT; } YY_BREAK case 129: YY_RULE_SETUP -#line 324 "program_lexer.l" +#line 285 "program_lexer.l" { return TEXCOORD; } YY_BREAK case 130: YY_RULE_SETUP -#line 325 "program_lexer.l" +#line 286 "program_lexer.l" { return_token_or_DOT(require_ARB_fp, TEXENV); } YY_BREAK case 131: YY_RULE_SETUP -#line 326 "program_lexer.l" +#line 287 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN); } YY_BREAK case 132: YY_RULE_SETUP -#line 327 "program_lexer.l" +#line 288 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_Q); } YY_BREAK case 133: YY_RULE_SETUP -#line 328 "program_lexer.l" +#line 289 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_S); } YY_BREAK case 134: YY_RULE_SETUP -#line 329 "program_lexer.l" +#line 290 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, TEXGEN_T); } YY_BREAK case 135: YY_RULE_SETUP -#line 330 "program_lexer.l" +#line 291 "program_lexer.l" { return TEXTURE; } YY_BREAK case 136: YY_RULE_SETUP -#line 331 "program_lexer.l" +#line 292 "program_lexer.l" { return TRANSPOSE; } YY_BREAK case 137: YY_RULE_SETUP -#line 332 "program_lexer.l" +#line 293 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, VTXATTRIB); } YY_BREAK case 138: YY_RULE_SETUP -#line 333 "program_lexer.l" +#line 294 "program_lexer.l" { return_token_or_DOT(require_ARB_vp, WEIGHT); } YY_BREAK case 139: YY_RULE_SETUP -#line 335 "program_lexer.l" +#line 296 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEXTURE_UNIT); } YY_BREAK case 140: YY_RULE_SETUP -#line 336 "program_lexer.l" +#line 297 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_1D); } YY_BREAK case 141: YY_RULE_SETUP -#line 337 "program_lexer.l" +#line 298 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_2D); } YY_BREAK case 142: YY_RULE_SETUP -#line 338 "program_lexer.l" +#line 299 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_3D); } YY_BREAK case 143: YY_RULE_SETUP -#line 339 "program_lexer.l" +#line 300 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp, TEX_CUBE); } YY_BREAK case 144: YY_RULE_SETUP -#line 340 "program_lexer.l" +#line 301 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_rect, TEX_RECT); } YY_BREAK case 145: YY_RULE_SETUP -#line 341 "program_lexer.l" +#line 302 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW1D); } YY_BREAK case 146: YY_RULE_SETUP -#line 342 "program_lexer.l" +#line 303 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow, TEX_SHADOW2D); } YY_BREAK case 147: YY_RULE_SETUP -#line 343 "program_lexer.l" +#line 304 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_rect, TEX_SHADOWRECT); } YY_BREAK case 148: YY_RULE_SETUP -#line 344 "program_lexer.l" +#line 305 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY1D); } YY_BREAK case 149: YY_RULE_SETUP -#line 345 "program_lexer.l" +#line 306 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_texarray, TEX_ARRAY2D); } YY_BREAK case 150: YY_RULE_SETUP -#line 346 "program_lexer.l" +#line 307 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW1D); } YY_BREAK case 151: YY_RULE_SETUP -#line 347 "program_lexer.l" +#line 308 "program_lexer.l" { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); } YY_BREAK case 152: YY_RULE_SETUP -#line 349 "program_lexer.l" +#line 310 "program_lexer.l" { - yylval->string = return_string(yyextra, yytext); + yylval->string = strdup(yytext); return IDENTIFIER; } YY_BREAK case 153: YY_RULE_SETUP -#line 354 "program_lexer.l" +#line 315 "program_lexer.l" { return DOT_DOT; } YY_BREAK case 154: YY_RULE_SETUP -#line 356 "program_lexer.l" +#line 317 "program_lexer.l" { yylval->integer = strtol(yytext, NULL, 10); return INTEGER; @@ -2169,7 +2116,7 @@ YY_RULE_SETUP YY_BREAK case 155: YY_RULE_SETUP -#line 360 "program_lexer.l" +#line 321 "program_lexer.l" { yylval->real = _mesa_strtod(yytext, NULL); return REAL; @@ -2181,7 +2128,7 @@ case 156: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 364 "program_lexer.l" +#line 325 "program_lexer.l" { yylval->real = _mesa_strtod(yytext, NULL); return REAL; @@ -2189,7 +2136,7 @@ YY_RULE_SETUP YY_BREAK case 157: YY_RULE_SETUP -#line 368 "program_lexer.l" +#line 329 "program_lexer.l" { yylval->real = _mesa_strtod(yytext, NULL); return REAL; @@ -2197,7 +2144,7 @@ YY_RULE_SETUP YY_BREAK case 158: YY_RULE_SETUP -#line 372 "program_lexer.l" +#line 333 "program_lexer.l" { yylval->real = _mesa_strtod(yytext, NULL); return REAL; @@ -2205,7 +2152,7 @@ YY_RULE_SETUP YY_BREAK case 159: YY_RULE_SETUP -#line 377 "program_lexer.l" +#line 338 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; @@ -2214,7 +2161,7 @@ YY_RULE_SETUP YY_BREAK case 160: YY_RULE_SETUP -#line 383 "program_lexer.l" +#line 344 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2224,7 +2171,7 @@ YY_RULE_SETUP YY_BREAK case 161: YY_RULE_SETUP -#line 389 "program_lexer.l" +#line 350 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; @@ -2233,7 +2180,7 @@ YY_RULE_SETUP YY_BREAK case 162: YY_RULE_SETUP -#line 394 "program_lexer.l" +#line 355 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; @@ -2242,7 +2189,7 @@ YY_RULE_SETUP YY_BREAK case 163: YY_RULE_SETUP -#line 400 "program_lexer.l" +#line 361 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2252,7 +2199,7 @@ YY_RULE_SETUP YY_BREAK case 164: YY_RULE_SETUP -#line 406 "program_lexer.l" +#line 367 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2262,7 +2209,7 @@ YY_RULE_SETUP YY_BREAK case 165: YY_RULE_SETUP -#line 412 "program_lexer.l" +#line 373 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; @@ -2271,7 +2218,7 @@ YY_RULE_SETUP YY_BREAK case 166: YY_RULE_SETUP -#line 418 "program_lexer.l" +#line 379 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2281,7 +2228,7 @@ YY_RULE_SETUP YY_BREAK case 167: YY_RULE_SETUP -#line 425 "program_lexer.l" +#line 386 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2293,7 +2240,7 @@ YY_RULE_SETUP YY_BREAK case 168: YY_RULE_SETUP -#line 434 "program_lexer.l" +#line 395 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_NOOP; yylval->swiz_mask.mask = WRITEMASK_XYZW; @@ -2302,7 +2249,7 @@ YY_RULE_SETUP YY_BREAK case 169: YY_RULE_SETUP -#line 440 "program_lexer.l" +#line 401 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XY @@ -2312,7 +2259,7 @@ YY_RULE_SETUP YY_BREAK case 170: YY_RULE_SETUP -#line 446 "program_lexer.l" +#line 407 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_XZW; @@ -2321,7 +2268,7 @@ YY_RULE_SETUP YY_BREAK case 171: YY_RULE_SETUP -#line 451 "program_lexer.l" +#line 412 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_YZW; @@ -2330,7 +2277,7 @@ YY_RULE_SETUP YY_BREAK case 172: YY_RULE_SETUP -#line 457 "program_lexer.l" +#line 418 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_X @@ -2340,7 +2287,7 @@ YY_RULE_SETUP YY_BREAK case 173: YY_RULE_SETUP -#line 463 "program_lexer.l" +#line 424 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_Y @@ -2350,7 +2297,7 @@ YY_RULE_SETUP YY_BREAK case 174: YY_RULE_SETUP -#line 469 "program_lexer.l" +#line 430 "program_lexer.l" { yylval->swiz_mask.swizzle = SWIZZLE_INVAL; yylval->swiz_mask.mask = WRITEMASK_ZW; @@ -2359,7 +2306,7 @@ YY_RULE_SETUP YY_BREAK case 175: YY_RULE_SETUP -#line 475 "program_lexer.l" +#line 436 "program_lexer.l" { const unsigned s = swiz_from_char(yytext[1]); yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(s, s, s, s); @@ -2369,7 +2316,7 @@ YY_RULE_SETUP YY_BREAK case 176: YY_RULE_SETUP -#line 483 "program_lexer.l" +#line 444 "program_lexer.l" { if (require_ARB_vp) { return TEXGEN_R; @@ -2383,7 +2330,7 @@ YY_RULE_SETUP YY_BREAK case 177: YY_RULE_SETUP -#line 494 "program_lexer.l" +#line 455 "program_lexer.l" { yylval->swiz_mask.swizzle = MAKE_SWIZZLE4(swiz_from_char(yytext[1]), swiz_from_char(yytext[2]), @@ -2395,13 +2342,13 @@ YY_RULE_SETUP YY_BREAK case 178: YY_RULE_SETUP -#line 503 "program_lexer.l" +#line 464 "program_lexer.l" { return DOT; } YY_BREAK case 179: /* rule 179 can match eol */ YY_RULE_SETUP -#line 505 "program_lexer.l" +#line 466 "program_lexer.l" { yylloc->first_line++; yylloc->first_column = 1; @@ -2412,7 +2359,7 @@ YY_RULE_SETUP YY_BREAK case 180: YY_RULE_SETUP -#line 512 "program_lexer.l" +#line 473 "program_lexer.l" /* eat whitespace */ ; YY_BREAK case 181: @@ -2420,20 +2367,20 @@ case 181: yyg->yy_c_buf_p = yy_cp -= 1; YY_DO_BEFORE_ACTION; /* set up yytext again */ YY_RULE_SETUP -#line 513 "program_lexer.l" +#line 474 "program_lexer.l" /* eat comments */ ; YY_BREAK case 182: YY_RULE_SETUP -#line 514 "program_lexer.l" +#line 475 "program_lexer.l" { return yytext[0]; } YY_BREAK case 183: YY_RULE_SETUP -#line 515 "program_lexer.l" +#line 476 "program_lexer.l" ECHO; YY_BREAK -#line 2437 "lex.yy.c" +#line 2384 "lex.yy.c" case YY_STATE_EOF(INITIAL): yyterminate(); @@ -3201,8 +3148,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ @@ -3608,7 +3555,7 @@ void yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" -#line 515 "program_lexer.l" +#line 476 "program_lexer.l" diff --git a/src/mesa/shader/program_lexer.l b/src/mesa/shader/program_lexer.l index 6c4fad3037..c2803ff707 100644 --- a/src/mesa/shader/program_lexer.l +++ b/src/mesa/shader/program_lexer.l @@ -40,7 +40,7 @@ if (condition) { \ return token; \ } else { \ - yylval->string = return_string(yyextra, yytext); \ + yylval->string = strdup(yytext); \ return IDENTIFIER; \ } \ } while (0) @@ -63,7 +63,7 @@ yylval->temp_inst.SaturateMode = SATURATE_ ## sat; \ return token; \ } else { \ - yylval->string = return_string(yyextra, yytext); \ + yylval->string = strdup(yytext); \ return IDENTIFIER; \ } \ } while (0) @@ -71,45 +71,6 @@ #define SWIZZLE_INVAL MAKE_SWIZZLE4(SWIZZLE_NIL, SWIZZLE_NIL, \ SWIZZLE_NIL, SWIZZLE_NIL) -/** - * Send a string to the parser using asm_parser_state::string_dumpster - * - * Sends a string to the parser using asm_parser_state::string_dumpster as a - * temporary storage buffer. Data previously stored in - * asm_parser_state::string_dumpster will be lost. If - * asm_parser_state::string_dumpster is not large enough to hold the new - * string, the buffer size will be increased. The buffer size is \b never - * decreased. - * - * \param state Assembler parser state tracking - * \param str String to be passed to the parser - * - * \return - * A pointer to asm_parser_state::string_dumpster on success or \c NULL on - * failure. Currently the only failure case is \c ENOMEM. - */ -static char * -return_string(struct asm_parser_state *state, const char *str) -{ - const size_t len = strlen(str); - - if (len >= state->dumpster_size) { - char *const dumpster = _mesa_realloc(state->string_dumpster, - state->dumpster_size, - len + 1); - if (dumpster == NULL) { - return NULL; - } - - state->string_dumpster = dumpster; - state->dumpster_size = len + 1; - } - - memcpy(state->string_dumpster, str, len + 1); - return state->string_dumpster; -} - - static unsigned mask_from_char(char c) { @@ -347,7 +308,7 @@ ARRAYSHADOW1D { return_token_or_IDENTIFIER(require_ARB_fp && require ARRAYSHADOW2D { return_token_or_IDENTIFIER(require_ARB_fp && require_shadow && require_texarray, TEX_ARRAYSHADOW2D); } [_a-zA-Z$][_a-zA-Z0-9$]* { - yylval->string = return_string(yyextra, yytext); + yylval->string = strdup(yytext); return IDENTIFIER; } diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c index 261b605a2d..c255e912ed 100644 --- a/src/mesa/shader/program_parse.tab.c +++ b/src/mesa/shader/program_parse.tab.c @@ -4565,7 +4565,7 @@ yyreduce: "undefined variable binding in ALIAS statement"); YYERROR; } else { - _mesa_symbol_table_add_symbol(state->st, 0, strdup((yyvsp[(2) - (4)].string)), target); + _mesa_symbol_table_add_symbol(state->st, 0, (yyvsp[(2) - (4)].string), target); } ;} break; @@ -4896,14 +4896,10 @@ declare_variable(struct asm_parser_state *state, char *name, enum asm_type t, if (exist != NULL) { yyerror(locp, state, "redeclared identifier"); } else { - const size_t name_len = strlen(name); - - s = calloc(1, sizeof(struct asm_symbol) + name_len + 1); - s->name = (char *)(s + 1); + s = calloc(1, sizeof(struct asm_symbol)); + s->name = name; s->type = t; - memcpy((char *) s->name, name, name_len + 1); - switch (t) { case at_temp: if (state->prog->NumTemporaries >= state->limits->MaxTemps) { @@ -5151,11 +5147,6 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str, _mesa_memcpy (strz, str, len); strz[len] = '\0'; - if (state->prog->String != NULL) { - _mesa_free(state->prog->String); - state->prog->String = NULL; - } - state->prog->String = strz; state->st = _mesa_symbol_table_ctor(); @@ -5245,6 +5236,7 @@ error: for (sym = state->sym; sym != NULL; sym = temp) { temp = sym->next; + _mesa_free((void *) sym->name); _mesa_free(sym); } state->sym = NULL; @@ -5252,11 +5244,6 @@ error: _mesa_symbol_table_dtor(state->st); state->st = NULL; - if (state->string_dumpster != NULL) { - _mesa_free(state->string_dumpster); - state->dumpster_size = 0; - } - return result; } diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index a23625d3fb..c3152aa2f8 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -1919,7 +1919,7 @@ ALIAS_statement: ALIAS IDENTIFIER '=' IDENTIFIER "undefined variable binding in ALIAS statement"); YYERROR; } else { - _mesa_symbol_table_add_symbol(state->st, 0, strdup($2), target); + _mesa_symbol_table_add_symbol(state->st, 0, $2, target); } } ; @@ -2027,14 +2027,10 @@ declare_variable(struct asm_parser_state *state, char *name, enum asm_type t, if (exist != NULL) { yyerror(locp, state, "redeclared identifier"); } else { - const size_t name_len = strlen(name); - - s = calloc(1, sizeof(struct asm_symbol) + name_len + 1); - s->name = (char *)(s + 1); + s = calloc(1, sizeof(struct asm_symbol)); + s->name = name; s->type = t; - memcpy((char *) s->name, name, name_len + 1); - switch (t) { case at_temp: if (state->prog->NumTemporaries >= state->limits->MaxTemps) { @@ -2284,7 +2280,6 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str, if (state->prog->String != NULL) { _mesa_free(state->prog->String); - state->prog->String = NULL; } state->prog->String = strz; @@ -2376,6 +2371,7 @@ error: for (sym = state->sym; sym != NULL; sym = temp) { temp = sym->next; + _mesa_free((void *) sym->name); _mesa_free(sym); } state->sym = NULL; @@ -2383,10 +2379,5 @@ error: _mesa_symbol_table_dtor(state->st); state->st = NULL; - if (state->string_dumpster != NULL) { - _mesa_free(state->string_dumpster); - state->dumpster_size = 0; - } - return result; } diff --git a/src/mesa/shader/program_parser.h b/src/mesa/shader/program_parser.h index 8d8b4d89bc..fa47d84565 100644 --- a/src/mesa/shader/program_parser.h +++ b/src/mesa/shader/program_parser.h @@ -38,13 +38,6 @@ enum asm_type { at_output, }; -/** - * \note - * Objects of this type are allocated as the object plus the name of the - * symbol. That is, malloc(sizeof(struct asm_symbol) + strlen(name) + 1). - * Alternately, asm_symbol::name could be moved to the bottom of the structure - * and declared as 'char name[0];'. - */ struct asm_symbol { struct asm_symbol *next; /**< List linkage for freeing. */ const char *name; @@ -164,15 +157,6 @@ struct asm_parser_state { /*@}*/ - /** - * Buffer to hold strings transfered from the lexer to the parser - */ - /*@{*/ - char *string_dumpster; /**< String data transfered. */ - size_t dumpster_size; /**< Total size, in bytes, of the buffer. */ - /*@}*/ - - /** * Selected limits copied from gl_constants * -- cgit v1.2.3 From 301a9b7e28f7404b8f6d8c34649f0035b49a8249 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 5 Nov 2009 14:15:56 -0800 Subject: ARB prog parser: Release strings returned from the lexer that don't need to be kept --- src/mesa/shader/program_parse.y | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index c3152aa2f8..b2db2958be 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -291,6 +291,8 @@ option: OPTION IDENTIFIER ';' } + free($2); + if (!valid) { const char *const err_str = (state->mode == ARB_vertex) ? "invalid ARB vertex program option" @@ -591,12 +593,17 @@ extSwizSel: INTEGER } | IDENTIFIER { + char s; + if (strlen($1) > 1) { yyerror(& @1, state, "invalid extended swizzle selector"); YYERROR; } - switch ($1[0]) { + s = $1[0]; + free($1); + + switch (s) { case 'x': $$.swz = SWIZZLE_X; $$.xyzw_valid = 1; @@ -644,6 +651,8 @@ srcReg: IDENTIFIER /* temporaryReg | progParamSingle */ struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, $1); + free($1); + if (s == NULL) { yyerror(& @1, state, "invalid operand variable"); YYERROR; @@ -734,6 +743,8 @@ dstReg: resultBinding struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, $1); + free($1); + if (s == NULL) { yyerror(& @1, state, "invalid operand variable"); YYERROR; @@ -765,6 +776,8 @@ progParamArray: IDENTIFIER struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, $1); + free($1); + if (s == NULL) { yyerror(& @1, state, "invalid operand variable"); YYERROR; @@ -832,6 +845,8 @@ addrReg: IDENTIFIER struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, $1); + free($1); + if (s == NULL) { yyerror(& @1, state, "invalid array member"); YYERROR; @@ -894,6 +909,7 @@ ATTRIB_statement: ATTRIB IDENTIFIER '=' attribBinding declare_variable(state, $2, at_attrib, & @2); if (s == NULL) { + free($2); YYERROR; } else { s->attrib_binding = $4; @@ -1001,6 +1017,7 @@ PARAM_singleStmt: PARAM IDENTIFIER paramSingleInit declare_variable(state, $2, at_param, & @2); if (s == NULL) { + free($2); YYERROR; } else { s->param_binding_type = $3.param_binding_type; @@ -1014,6 +1031,7 @@ PARAM_singleStmt: PARAM IDENTIFIER paramSingleInit PARAM_multipleStmt: PARAM IDENTIFIER '[' optArraySize ']' paramMultipleInit { if (($4 != 0) && ((unsigned) $4 != $6.param_binding_length)) { + free($2); yyerror(& @4, state, "parameter array size and number of bindings must match"); YYERROR; @@ -1022,6 +1040,7 @@ PARAM_multipleStmt: PARAM IDENTIFIER '[' optArraySize ']' paramMultipleInit declare_variable(state, $2, $6.type, & @2); if (s == NULL) { + free($2); YYERROR; } else { s->param_binding_type = $6.param_binding_type; @@ -1717,12 +1736,14 @@ ADDRESS_statement: ADDRESS { $$ = $1; } varNameList varNameList: varNameList ',' IDENTIFIER { if (!declare_variable(state, $3, $0, & @3)) { + free($3); YYERROR; } } | IDENTIFIER { if (!declare_variable(state, $1, $0, & @1)) { + free($1); YYERROR; } } @@ -1734,6 +1755,7 @@ OUTPUT_statement: OUTPUT IDENTIFIER '=' resultBinding declare_variable(state, $2, at_output, & @2); if (s == NULL) { + free($2); YYERROR; } else { s->output_binding = $4; @@ -1911,10 +1933,14 @@ ALIAS_statement: ALIAS IDENTIFIER '=' IDENTIFIER _mesa_symbol_table_find_symbol(state->st, 0, $4); + free($4); + if (exist != NULL) { + free($2); yyerror(& @2, state, "redeclared identifier"); YYERROR; } else if (target == NULL) { + free($2); yyerror(& @4, state, "undefined variable binding in ALIAS statement"); YYERROR; -- cgit v1.2.3 From d8e256f9236d3e9dfd433c3a59718f0fdf1ca79a Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 5 Nov 2009 14:17:07 -0800 Subject: ARB prog parser: Release old program string in _mesa_parse_arb_{fragment,vertex}_program The program structure passed to _mesa_parse_arb_program is just a place holder. The stings that actually need to be released are only known to the functions calling _mesa_parse_arb_program, so they should be freed there. --- src/mesa/shader/arbprogparse.c | 6 ++++++ src/mesa/shader/program_parse.y | 4 ---- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/arbprogparse.c b/src/mesa/shader/arbprogparse.c index 05ee4f563e..dd732b6666 100644 --- a/src/mesa/shader/arbprogparse.c +++ b/src/mesa/shader/arbprogparse.c @@ -87,6 +87,9 @@ _mesa_parse_arb_fragment_program(GLcontext* ctx, GLenum target, return; } + if (program->Base.String != NULL) + _mesa_free(program->Base.String); + /* Copy the relevant contents of the arb_program struct into the * fragment_program struct. */ @@ -178,6 +181,9 @@ _mesa_parse_arb_vertex_program(GLcontext *ctx, GLenum target, return; } + if (program->Base.String != NULL) + _mesa_free(program->Base.String); + /* Copy the relevant contents of the arb_program struct into the * vertex_program struct. */ diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index b2db2958be..aad5eeb7da 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -2304,10 +2304,6 @@ _mesa_parse_arb_program(GLcontext *ctx, GLenum target, const GLubyte *str, _mesa_memcpy (strz, str, len); strz[len] = '\0'; - if (state->prog->String != NULL) { - _mesa_free(state->prog->String); - } - state->prog->String = strz; state->st = _mesa_symbol_table_ctor(); -- cgit v1.2.3 From 9348ac03ce23392013ba22c22a182eea4453027a Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 5 Nov 2009 14:20:16 -0800 Subject: ARB prog parser: Regenerate parser from previous commits. --- src/mesa/shader/program_parse.tab.c | 510 +++++++++++++++++++----------------- 1 file changed, 268 insertions(+), 242 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c index c255e912ed..b7bac7e5a3 100644 --- a/src/mesa/shader/program_parse.tab.c +++ b/src/mesa/shader/program_parse.tab.c @@ -763,33 +763,33 @@ static const yytype_int16 yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { - 0, 256, 256, 259, 267, 279, 280, 283, 305, 306, - 309, 324, 327, 332, 339, 340, 341, 342, 343, 344, - 345, 348, 349, 352, 358, 365, 372, 380, 387, 395, - 440, 447, 453, 454, 455, 456, 457, 458, 459, 460, - 461, 462, 463, 464, 467, 480, 493, 506, 528, 537, - 570, 577, 592, 642, 684, 695, 716, 726, 732, 763, - 780, 780, 782, 789, 801, 802, 803, 806, 818, 830, - 848, 859, 871, 873, 874, 875, 876, 879, 879, 879, - 879, 880, 883, 884, 885, 886, 887, 888, 891, 909, - 913, 919, 923, 927, 931, 940, 949, 953, 958, 964, - 975, 975, 976, 978, 982, 986, 990, 996, 996, 998, - 1014, 1037, 1040, 1051, 1057, 1063, 1064, 1071, 1077, 1083, - 1091, 1097, 1103, 1111, 1117, 1123, 1131, 1132, 1135, 1136, - 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1148, - 1157, 1161, 1165, 1171, 1180, 1184, 1188, 1197, 1201, 1207, - 1213, 1220, 1225, 1233, 1243, 1245, 1253, 1259, 1263, 1267, - 1273, 1284, 1293, 1297, 1302, 1306, 1310, 1314, 1320, 1327, - 1331, 1337, 1345, 1356, 1363, 1367, 1373, 1383, 1394, 1398, - 1416, 1425, 1428, 1434, 1438, 1442, 1448, 1459, 1464, 1469, - 1474, 1479, 1484, 1492, 1495, 1500, 1513, 1521, 1532, 1540, - 1540, 1542, 1542, 1544, 1554, 1559, 1566, 1576, 1585, 1590, - 1597, 1607, 1617, 1629, 1629, 1630, 1630, 1632, 1642, 1650, - 1660, 1668, 1676, 1685, 1696, 1700, 1706, 1707, 1708, 1711, - 1711, 1714, 1714, 1717, 1723, 1731, 1744, 1753, 1762, 1766, - 1775, 1784, 1795, 1802, 1807, 1816, 1828, 1831, 1840, 1851, - 1852, 1853, 1856, 1857, 1858, 1861, 1862, 1865, 1866, 1869, - 1870, 1873, 1884, 1895, 1906 + 0, 256, 256, 259, 267, 279, 280, 283, 307, 308, + 311, 326, 329, 334, 341, 342, 343, 344, 345, 346, + 347, 350, 351, 354, 360, 367, 374, 382, 389, 397, + 442, 449, 455, 456, 457, 458, 459, 460, 461, 462, + 463, 464, 465, 466, 469, 482, 495, 508, 530, 539, + 572, 579, 594, 649, 693, 704, 725, 735, 741, 774, + 793, 793, 795, 802, 814, 815, 816, 819, 831, 843, + 863, 874, 886, 888, 889, 890, 891, 894, 894, 894, + 894, 895, 898, 899, 900, 901, 902, 903, 906, 925, + 929, 935, 939, 943, 947, 956, 965, 969, 974, 980, + 991, 991, 992, 994, 998, 1002, 1006, 1012, 1012, 1014, + 1031, 1056, 1059, 1070, 1076, 1082, 1083, 1090, 1096, 1102, + 1110, 1116, 1122, 1130, 1136, 1142, 1150, 1151, 1154, 1155, + 1156, 1157, 1158, 1159, 1160, 1161, 1162, 1163, 1164, 1167, + 1176, 1180, 1184, 1190, 1199, 1203, 1207, 1216, 1220, 1226, + 1232, 1239, 1244, 1252, 1262, 1264, 1272, 1278, 1282, 1286, + 1292, 1303, 1312, 1316, 1321, 1325, 1329, 1333, 1339, 1346, + 1350, 1356, 1364, 1375, 1382, 1386, 1392, 1402, 1413, 1417, + 1435, 1444, 1447, 1453, 1457, 1461, 1467, 1478, 1483, 1488, + 1493, 1498, 1503, 1511, 1514, 1519, 1532, 1540, 1551, 1559, + 1559, 1561, 1561, 1563, 1573, 1578, 1585, 1595, 1604, 1609, + 1616, 1626, 1636, 1648, 1648, 1649, 1649, 1651, 1661, 1669, + 1679, 1687, 1695, 1704, 1715, 1719, 1725, 1726, 1727, 1730, + 1730, 1733, 1733, 1736, 1743, 1752, 1766, 1775, 1784, 1788, + 1797, 1806, 1817, 1824, 1829, 1838, 1850, 1853, 1862, 1873, + 1874, 1875, 1878, 1879, 1880, 1883, 1884, 1887, 1888, 1891, + 1892, 1895, 1906, 1917, 1928 }; #endif @@ -2107,6 +2107,8 @@ yyreduce: } + free((yyvsp[(2) - (3)].string)); + if (!valid) { const char *const err_str = (state->mode == ARB_vertex) ? "invalid ARB vertex program option" @@ -2121,7 +2123,7 @@ yyreduce: case 10: /* Line 1455 of yacc.c */ -#line 310 "program_parse.y" +#line 312 "program_parse.y" { if ((yyvsp[(1) - (2)].inst) != NULL) { if (state->inst_tail == NULL) { @@ -2141,7 +2143,7 @@ yyreduce: case 12: /* Line 1455 of yacc.c */ -#line 328 "program_parse.y" +#line 330 "program_parse.y" { (yyval.inst) = (yyvsp[(1) - (1)].inst); state->prog->NumAluInstructions++; @@ -2151,7 +2153,7 @@ yyreduce: case 13: /* Line 1455 of yacc.c */ -#line 333 "program_parse.y" +#line 335 "program_parse.y" { (yyval.inst) = (yyvsp[(1) - (1)].inst); state->prog->NumTexInstructions++; @@ -2161,7 +2163,7 @@ yyreduce: case 23: /* Line 1455 of yacc.c */ -#line 353 "program_parse.y" +#line 355 "program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_ARL, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); ;} @@ -2170,7 +2172,7 @@ yyreduce: case 24: /* Line 1455 of yacc.c */ -#line 359 "program_parse.y" +#line 361 "program_parse.y" { (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (4)].temp_inst).Opcode, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (4)].temp_inst).SaturateMode; @@ -2180,7 +2182,7 @@ yyreduce: case 25: /* Line 1455 of yacc.c */ -#line 366 "program_parse.y" +#line 368 "program_parse.y" { (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (4)].temp_inst).Opcode, & (yyvsp[(2) - (4)].dst_reg), & (yyvsp[(4) - (4)].src_reg), NULL, NULL); (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (4)].temp_inst).SaturateMode; @@ -2190,7 +2192,7 @@ yyreduce: case 26: /* Line 1455 of yacc.c */ -#line 373 "program_parse.y" +#line 375 "program_parse.y" { (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (6)].temp_inst).Opcode, & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL); (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (6)].temp_inst).SaturateMode; @@ -2200,7 +2202,7 @@ yyreduce: case 27: /* Line 1455 of yacc.c */ -#line 381 "program_parse.y" +#line 383 "program_parse.y" { (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (6)].temp_inst).Opcode, & (yyvsp[(2) - (6)].dst_reg), & (yyvsp[(4) - (6)].src_reg), & (yyvsp[(6) - (6)].src_reg), NULL); (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (6)].temp_inst).SaturateMode; @@ -2210,7 +2212,7 @@ yyreduce: case 28: /* Line 1455 of yacc.c */ -#line 389 "program_parse.y" +#line 391 "program_parse.y" { (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (8)].temp_inst).Opcode, & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), & (yyvsp[(6) - (8)].src_reg), & (yyvsp[(8) - (8)].src_reg)); (yyval.inst)->Base.SaturateMode = (yyvsp[(1) - (8)].temp_inst).SaturateMode; @@ -2220,7 +2222,7 @@ yyreduce: case 29: /* Line 1455 of yacc.c */ -#line 396 "program_parse.y" +#line 398 "program_parse.y" { (yyval.inst) = asm_instruction_ctor((yyvsp[(1) - (8)].temp_inst).Opcode, & (yyvsp[(2) - (8)].dst_reg), & (yyvsp[(4) - (8)].src_reg), NULL, NULL); if ((yyval.inst) != NULL) { @@ -2268,7 +2270,7 @@ yyreduce: case 30: /* Line 1455 of yacc.c */ -#line 441 "program_parse.y" +#line 443 "program_parse.y" { (yyval.inst) = asm_instruction_ctor(OPCODE_KIL, NULL, & (yyvsp[(2) - (2)].src_reg), NULL, NULL); state->fragment.UsesKill = 1; @@ -2278,7 +2280,7 @@ yyreduce: case 31: /* Line 1455 of yacc.c */ -#line 448 "program_parse.y" +#line 450 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} @@ -2287,91 +2289,91 @@ yyreduce: case 32: /* Line 1455 of yacc.c */ -#line 453 "program_parse.y" +#line 455 "program_parse.y" { (yyval.integer) = TEXTURE_1D_INDEX; ;} break; case 33: /* Line 1455 of yacc.c */ -#line 454 "program_parse.y" +#line 456 "program_parse.y" { (yyval.integer) = TEXTURE_2D_INDEX; ;} break; case 34: /* Line 1455 of yacc.c */ -#line 455 "program_parse.y" +#line 457 "program_parse.y" { (yyval.integer) = TEXTURE_3D_INDEX; ;} break; case 35: /* Line 1455 of yacc.c */ -#line 456 "program_parse.y" +#line 458 "program_parse.y" { (yyval.integer) = TEXTURE_CUBE_INDEX; ;} break; case 36: /* Line 1455 of yacc.c */ -#line 457 "program_parse.y" +#line 459 "program_parse.y" { (yyval.integer) = TEXTURE_RECT_INDEX; ;} break; case 37: /* Line 1455 of yacc.c */ -#line 458 "program_parse.y" +#line 460 "program_parse.y" { (yyval.integer) = -TEXTURE_1D_INDEX; ;} break; case 38: /* Line 1455 of yacc.c */ -#line 459 "program_parse.y" +#line 461 "program_parse.y" { (yyval.integer) = -TEXTURE_2D_INDEX; ;} break; case 39: /* Line 1455 of yacc.c */ -#line 460 "program_parse.y" +#line 462 "program_parse.y" { (yyval.integer) = -TEXTURE_RECT_INDEX; ;} break; case 40: /* Line 1455 of yacc.c */ -#line 461 "program_parse.y" +#line 463 "program_parse.y" { (yyval.integer) = TEXTURE_1D_ARRAY_INDEX; ;} break; case 41: /* Line 1455 of yacc.c */ -#line 462 "program_parse.y" +#line 464 "program_parse.y" { (yyval.integer) = TEXTURE_2D_ARRAY_INDEX; ;} break; case 42: /* Line 1455 of yacc.c */ -#line 463 "program_parse.y" +#line 465 "program_parse.y" { (yyval.integer) = -TEXTURE_1D_ARRAY_INDEX; ;} break; case 43: /* Line 1455 of yacc.c */ -#line 464 "program_parse.y" +#line 466 "program_parse.y" { (yyval.integer) = -TEXTURE_2D_ARRAY_INDEX; ;} break; case 44: /* Line 1455 of yacc.c */ -#line 468 "program_parse.y" +#line 470 "program_parse.y" { /* FIXME: Is this correct? Should the extenedSwizzle be applied * FIXME: to the existing swizzle? @@ -2387,7 +2389,7 @@ yyreduce: case 45: /* Line 1455 of yacc.c */ -#line 481 "program_parse.y" +#line 483 "program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (3)].src_reg); @@ -2403,7 +2405,7 @@ yyreduce: case 46: /* Line 1455 of yacc.c */ -#line 494 "program_parse.y" +#line 496 "program_parse.y" { (yyval.src_reg) = (yyvsp[(2) - (3)].src_reg); @@ -2419,7 +2421,7 @@ yyreduce: case 47: /* Line 1455 of yacc.c */ -#line 507 "program_parse.y" +#line 509 "program_parse.y" { (yyval.dst_reg) = (yyvsp[(1) - (2)].dst_reg); (yyval.dst_reg).WriteMask = (yyvsp[(2) - (2)].swiz_mask).mask; @@ -2444,7 +2446,7 @@ yyreduce: case 48: /* Line 1455 of yacc.c */ -#line 529 "program_parse.y" +#line 531 "program_parse.y" { init_dst_reg(& (yyval.dst_reg)); (yyval.dst_reg).File = PROGRAM_ADDRESS; @@ -2456,7 +2458,7 @@ yyreduce: case 49: /* Line 1455 of yacc.c */ -#line 538 "program_parse.y" +#line 540 "program_parse.y" { const unsigned xyzw_valid = ((yyvsp[(1) - (7)].ext_swizzle).xyzw_valid << 0) @@ -2492,7 +2494,7 @@ yyreduce: case 50: /* Line 1455 of yacc.c */ -#line 571 "program_parse.y" +#line 573 "program_parse.y" { (yyval.ext_swizzle) = (yyvsp[(2) - (2)].ext_swizzle); (yyval.ext_swizzle).negate = ((yyvsp[(1) - (2)].negate)) ? 1 : 0; @@ -2502,7 +2504,7 @@ yyreduce: case 51: /* Line 1455 of yacc.c */ -#line 578 "program_parse.y" +#line 580 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) != 0) && ((yyvsp[(1) - (1)].integer) != 1)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector"); @@ -2522,14 +2524,19 @@ yyreduce: case 52: /* Line 1455 of yacc.c */ -#line 593 "program_parse.y" +#line 595 "program_parse.y" { + char s; + if (strlen((yyvsp[(1) - (1)].string)) > 1) { yyerror(& (yylsp[(1) - (1)]), state, "invalid extended swizzle selector"); YYERROR; } - switch ((yyvsp[(1) - (1)].string)[0]) { + s = (yyvsp[(1) - (1)].string)[0]; + free((yyvsp[(1) - (1)].string)); + + switch (s) { case 'x': (yyval.ext_swizzle).swz = SWIZZLE_X; (yyval.ext_swizzle).xyzw_valid = 1; @@ -2575,11 +2582,13 @@ yyreduce: case 53: /* Line 1455 of yacc.c */ -#line 643 "program_parse.y" +#line 650 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); + free((yyvsp[(1) - (1)].string)); + if (s == NULL) { yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable"); YYERROR; @@ -2622,7 +2631,7 @@ yyreduce: case 54: /* Line 1455 of yacc.c */ -#line 685 "program_parse.y" +#line 694 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.File = PROGRAM_INPUT; @@ -2638,7 +2647,7 @@ yyreduce: case 55: /* Line 1455 of yacc.c */ -#line 696 "program_parse.y" +#line 705 "program_parse.y" { if (! (yyvsp[(3) - (4)].src_reg).Base.RelAddr && ((unsigned) (yyvsp[(3) - (4)].src_reg).Base.Index >= (yyvsp[(1) - (4)].sym)->param_binding_length)) { @@ -2664,7 +2673,7 @@ yyreduce: case 56: /* Line 1455 of yacc.c */ -#line 717 "program_parse.y" +#line 726 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.File = ((yyvsp[(1) - (1)].temp_sym).name != NULL) @@ -2677,7 +2686,7 @@ yyreduce: case 57: /* Line 1455 of yacc.c */ -#line 727 "program_parse.y" +#line 736 "program_parse.y" { init_dst_reg(& (yyval.dst_reg)); (yyval.dst_reg).File = PROGRAM_OUTPUT; @@ -2688,11 +2697,13 @@ yyreduce: case 58: /* Line 1455 of yacc.c */ -#line 733 "program_parse.y" +#line 742 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); + free((yyvsp[(1) - (1)].string)); + if (s == NULL) { yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable"); YYERROR; @@ -2722,11 +2733,13 @@ yyreduce: case 59: /* Line 1455 of yacc.c */ -#line 764 "program_parse.y" +#line 775 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); + free((yyvsp[(1) - (1)].string)); + if (s == NULL) { yyerror(& (yylsp[(1) - (1)]), state, "invalid operand variable"); YYERROR; @@ -2742,7 +2755,7 @@ yyreduce: case 62: /* Line 1455 of yacc.c */ -#line 783 "program_parse.y" +#line 796 "program_parse.y" { init_src_reg(& (yyval.src_reg)); (yyval.src_reg).Base.Index = (yyvsp[(1) - (1)].integer); @@ -2752,7 +2765,7 @@ yyreduce: case 63: /* Line 1455 of yacc.c */ -#line 790 "program_parse.y" +#line 803 "program_parse.y" { /* FINISHME: Add support for multiple address registers. */ @@ -2767,28 +2780,28 @@ yyreduce: case 64: /* Line 1455 of yacc.c */ -#line 801 "program_parse.y" +#line 814 "program_parse.y" { (yyval.integer) = 0; ;} break; case 65: /* Line 1455 of yacc.c */ -#line 802 "program_parse.y" +#line 815 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} break; case 66: /* Line 1455 of yacc.c */ -#line 803 "program_parse.y" +#line 816 "program_parse.y" { (yyval.integer) = -(yyvsp[(2) - (2)].integer); ;} break; case 67: /* Line 1455 of yacc.c */ -#line 807 "program_parse.y" +#line 820 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 63)) { yyerror(& (yylsp[(1) - (1)]), state, @@ -2803,7 +2816,7 @@ yyreduce: case 68: /* Line 1455 of yacc.c */ -#line 819 "program_parse.y" +#line 832 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 64)) { yyerror(& (yylsp[(1) - (1)]), state, @@ -2818,11 +2831,13 @@ yyreduce: case 69: /* Line 1455 of yacc.c */ -#line 831 "program_parse.y" +#line 844 "program_parse.y" { struct asm_symbol *const s = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(1) - (1)].string)); + free((yyvsp[(1) - (1)].string)); + if (s == NULL) { yyerror(& (yylsp[(1) - (1)]), state, "invalid array member"); YYERROR; @@ -2839,7 +2854,7 @@ yyreduce: case 70: /* Line 1455 of yacc.c */ -#line 849 "program_parse.y" +#line 864 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, "invalid address component selector"); @@ -2853,7 +2868,7 @@ yyreduce: case 71: /* Line 1455 of yacc.c */ -#line 860 "program_parse.y" +#line 875 "program_parse.y" { if ((yyvsp[(1) - (1)].swiz_mask).mask != WRITEMASK_X) { yyerror(& (yylsp[(1) - (1)]), state, @@ -2868,26 +2883,27 @@ yyreduce: case 76: /* Line 1455 of yacc.c */ -#line 876 "program_parse.y" +#line 891 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; case 81: /* Line 1455 of yacc.c */ -#line 880 "program_parse.y" +#line 895 "program_parse.y" { (yyval.swiz_mask).swizzle = SWIZZLE_NOOP; (yyval.swiz_mask).mask = WRITEMASK_XYZW; ;} break; case 88: /* Line 1455 of yacc.c */ -#line 892 "program_parse.y" +#line 907 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (4)].string), at_attrib, & (yylsp[(2) - (4)])); if (s == NULL) { + free((yyvsp[(2) - (4)].string)); YYERROR; } else { s->attrib_binding = (yyvsp[(4) - (4)].attrib); @@ -2903,7 +2919,7 @@ yyreduce: case 89: /* Line 1455 of yacc.c */ -#line 910 "program_parse.y" +#line 926 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} @@ -2912,7 +2928,7 @@ yyreduce: case 90: /* Line 1455 of yacc.c */ -#line 914 "program_parse.y" +#line 930 "program_parse.y" { (yyval.attrib) = (yyvsp[(2) - (2)].attrib); ;} @@ -2921,7 +2937,7 @@ yyreduce: case 91: /* Line 1455 of yacc.c */ -#line 920 "program_parse.y" +#line 936 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_POS; ;} @@ -2930,7 +2946,7 @@ yyreduce: case 92: /* Line 1455 of yacc.c */ -#line 924 "program_parse.y" +#line 940 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_WEIGHT; ;} @@ -2939,7 +2955,7 @@ yyreduce: case 93: /* Line 1455 of yacc.c */ -#line 928 "program_parse.y" +#line 944 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_NORMAL; ;} @@ -2948,7 +2964,7 @@ yyreduce: case 94: /* Line 1455 of yacc.c */ -#line 932 "program_parse.y" +#line 948 "program_parse.y" { if (!state->ctx->Extensions.EXT_secondary_color) { yyerror(& (yylsp[(2) - (2)]), state, "GL_EXT_secondary_color not supported"); @@ -2962,7 +2978,7 @@ yyreduce: case 95: /* Line 1455 of yacc.c */ -#line 941 "program_parse.y" +#line 957 "program_parse.y" { if (!state->ctx->Extensions.EXT_fog_coord) { yyerror(& (yylsp[(1) - (1)]), state, "GL_EXT_fog_coord not supported"); @@ -2976,7 +2992,7 @@ yyreduce: case 96: /* Line 1455 of yacc.c */ -#line 950 "program_parse.y" +#line 966 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} @@ -2985,7 +3001,7 @@ yyreduce: case 97: /* Line 1455 of yacc.c */ -#line 954 "program_parse.y" +#line 970 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; @@ -2995,7 +3011,7 @@ yyreduce: case 98: /* Line 1455 of yacc.c */ -#line 959 "program_parse.y" +#line 975 "program_parse.y" { (yyval.attrib) = VERT_ATTRIB_GENERIC0 + (yyvsp[(3) - (4)].integer); ;} @@ -3004,7 +3020,7 @@ yyreduce: case 99: /* Line 1455 of yacc.c */ -#line 965 "program_parse.y" +#line 981 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxAttribs) { yyerror(& (yylsp[(1) - (1)]), state, "invalid vertex attribute reference"); @@ -3018,7 +3034,7 @@ yyreduce: case 103: /* Line 1455 of yacc.c */ -#line 979 "program_parse.y" +#line 995 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_WPOS; ;} @@ -3027,7 +3043,7 @@ yyreduce: case 104: /* Line 1455 of yacc.c */ -#line 983 "program_parse.y" +#line 999 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_COL0 + (yyvsp[(2) - (2)].integer); ;} @@ -3036,7 +3052,7 @@ yyreduce: case 105: /* Line 1455 of yacc.c */ -#line 987 "program_parse.y" +#line 1003 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_FOGC; ;} @@ -3045,7 +3061,7 @@ yyreduce: case 106: /* Line 1455 of yacc.c */ -#line 991 "program_parse.y" +#line 1007 "program_parse.y" { (yyval.attrib) = FRAG_ATTRIB_TEX0 + (yyvsp[(2) - (2)].integer); ;} @@ -3054,12 +3070,13 @@ yyreduce: case 109: /* Line 1455 of yacc.c */ -#line 999 "program_parse.y" +#line 1015 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (3)].string), at_param, & (yylsp[(2) - (3)])); if (s == NULL) { + free((yyvsp[(2) - (3)].string)); YYERROR; } else { s->param_binding_type = (yyvsp[(3) - (3)].temp_sym).param_binding_type; @@ -3073,9 +3090,10 @@ yyreduce: case 110: /* Line 1455 of yacc.c */ -#line 1015 "program_parse.y" +#line 1032 "program_parse.y" { if (((yyvsp[(4) - (6)].integer) != 0) && ((unsigned) (yyvsp[(4) - (6)].integer) != (yyvsp[(6) - (6)].temp_sym).param_binding_length)) { + free((yyvsp[(2) - (6)].string)); yyerror(& (yylsp[(4) - (6)]), state, "parameter array size and number of bindings must match"); YYERROR; @@ -3084,6 +3102,7 @@ yyreduce: declare_variable(state, (yyvsp[(2) - (6)].string), (yyvsp[(6) - (6)].temp_sym).type, & (yylsp[(2) - (6)])); if (s == NULL) { + free((yyvsp[(2) - (6)].string)); YYERROR; } else { s->param_binding_type = (yyvsp[(6) - (6)].temp_sym).param_binding_type; @@ -3098,7 +3117,7 @@ yyreduce: case 111: /* Line 1455 of yacc.c */ -#line 1037 "program_parse.y" +#line 1056 "program_parse.y" { (yyval.integer) = 0; ;} @@ -3107,7 +3126,7 @@ yyreduce: case 112: /* Line 1455 of yacc.c */ -#line 1041 "program_parse.y" +#line 1060 "program_parse.y" { if (((yyvsp[(1) - (1)].integer) < 1) || ((unsigned) (yyvsp[(1) - (1)].integer) > state->limits->MaxParameters)) { yyerror(& (yylsp[(1) - (1)]), state, "invalid parameter array size"); @@ -3121,7 +3140,7 @@ yyreduce: case 113: /* Line 1455 of yacc.c */ -#line 1052 "program_parse.y" +#line 1071 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(2) - (2)].temp_sym); ;} @@ -3130,7 +3149,7 @@ yyreduce: case 114: /* Line 1455 of yacc.c */ -#line 1058 "program_parse.y" +#line 1077 "program_parse.y" { (yyval.temp_sym) = (yyvsp[(3) - (4)].temp_sym); ;} @@ -3139,7 +3158,7 @@ yyreduce: case 116: /* Line 1455 of yacc.c */ -#line 1065 "program_parse.y" +#line 1084 "program_parse.y" { (yyvsp[(1) - (3)].temp_sym).param_binding_length += (yyvsp[(3) - (3)].temp_sym).param_binding_length; (yyval.temp_sym) = (yyvsp[(1) - (3)].temp_sym); @@ -3149,7 +3168,7 @@ yyreduce: case 117: /* Line 1455 of yacc.c */ -#line 1072 "program_parse.y" +#line 1091 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3160,7 +3179,7 @@ yyreduce: case 118: /* Line 1455 of yacc.c */ -#line 1078 "program_parse.y" +#line 1097 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3171,7 +3190,7 @@ yyreduce: case 119: /* Line 1455 of yacc.c */ -#line 1084 "program_parse.y" +#line 1103 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3182,7 +3201,7 @@ yyreduce: case 120: /* Line 1455 of yacc.c */ -#line 1092 "program_parse.y" +#line 1111 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3193,7 +3212,7 @@ yyreduce: case 121: /* Line 1455 of yacc.c */ -#line 1098 "program_parse.y" +#line 1117 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3204,7 +3223,7 @@ yyreduce: case 122: /* Line 1455 of yacc.c */ -#line 1104 "program_parse.y" +#line 1123 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3215,7 +3234,7 @@ yyreduce: case 123: /* Line 1455 of yacc.c */ -#line 1112 "program_parse.y" +#line 1131 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3226,7 +3245,7 @@ yyreduce: case 124: /* Line 1455 of yacc.c */ -#line 1118 "program_parse.y" +#line 1137 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3237,7 +3256,7 @@ yyreduce: case 125: /* Line 1455 of yacc.c */ -#line 1124 "program_parse.y" +#line 1143 "program_parse.y" { memset(& (yyval.temp_sym), 0, sizeof((yyval.temp_sym))); (yyval.temp_sym).param_binding_begin = ~0; @@ -3248,98 +3267,98 @@ yyreduce: case 126: /* Line 1455 of yacc.c */ -#line 1131 "program_parse.y" +#line 1150 "program_parse.y" { memcpy((yyval.state), (yyvsp[(1) - (1)].state), sizeof((yyval.state))); ;} break; case 127: /* Line 1455 of yacc.c */ -#line 1132 "program_parse.y" +#line 1151 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 128: /* Line 1455 of yacc.c */ -#line 1135 "program_parse.y" +#line 1154 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 129: /* Line 1455 of yacc.c */ -#line 1136 "program_parse.y" +#line 1155 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 130: /* Line 1455 of yacc.c */ -#line 1137 "program_parse.y" +#line 1156 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 131: /* Line 1455 of yacc.c */ -#line 1138 "program_parse.y" +#line 1157 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 132: /* Line 1455 of yacc.c */ -#line 1139 "program_parse.y" +#line 1158 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 133: /* Line 1455 of yacc.c */ -#line 1140 "program_parse.y" +#line 1159 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 134: /* Line 1455 of yacc.c */ -#line 1141 "program_parse.y" +#line 1160 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 135: /* Line 1455 of yacc.c */ -#line 1142 "program_parse.y" +#line 1161 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 136: /* Line 1455 of yacc.c */ -#line 1143 "program_parse.y" +#line 1162 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 137: /* Line 1455 of yacc.c */ -#line 1144 "program_parse.y" +#line 1163 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 138: /* Line 1455 of yacc.c */ -#line 1145 "program_parse.y" +#line 1164 "program_parse.y" { memcpy((yyval.state), (yyvsp[(2) - (2)].state), sizeof((yyval.state))); ;} break; case 139: /* Line 1455 of yacc.c */ -#line 1149 "program_parse.y" +#line 1168 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_MATERIAL; @@ -3351,7 +3370,7 @@ yyreduce: case 140: /* Line 1455 of yacc.c */ -#line 1158 "program_parse.y" +#line 1177 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -3360,7 +3379,7 @@ yyreduce: case 141: /* Line 1455 of yacc.c */ -#line 1162 "program_parse.y" +#line 1181 "program_parse.y" { (yyval.integer) = STATE_EMISSION; ;} @@ -3369,7 +3388,7 @@ yyreduce: case 142: /* Line 1455 of yacc.c */ -#line 1166 "program_parse.y" +#line 1185 "program_parse.y" { (yyval.integer) = STATE_SHININESS; ;} @@ -3378,7 +3397,7 @@ yyreduce: case 143: /* Line 1455 of yacc.c */ -#line 1172 "program_parse.y" +#line 1191 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHT; @@ -3390,7 +3409,7 @@ yyreduce: case 144: /* Line 1455 of yacc.c */ -#line 1181 "program_parse.y" +#line 1200 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -3399,7 +3418,7 @@ yyreduce: case 145: /* Line 1455 of yacc.c */ -#line 1185 "program_parse.y" +#line 1204 "program_parse.y" { (yyval.integer) = STATE_POSITION; ;} @@ -3408,7 +3427,7 @@ yyreduce: case 146: /* Line 1455 of yacc.c */ -#line 1189 "program_parse.y" +#line 1208 "program_parse.y" { if (!state->ctx->Extensions.EXT_point_parameters) { yyerror(& (yylsp[(1) - (1)]), state, "GL_ARB_point_parameters not supported"); @@ -3422,7 +3441,7 @@ yyreduce: case 147: /* Line 1455 of yacc.c */ -#line 1198 "program_parse.y" +#line 1217 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (2)].integer); ;} @@ -3431,7 +3450,7 @@ yyreduce: case 148: /* Line 1455 of yacc.c */ -#line 1202 "program_parse.y" +#line 1221 "program_parse.y" { (yyval.integer) = STATE_HALF_VECTOR; ;} @@ -3440,7 +3459,7 @@ yyreduce: case 149: /* Line 1455 of yacc.c */ -#line 1208 "program_parse.y" +#line 1227 "program_parse.y" { (yyval.integer) = STATE_SPOT_DIRECTION; ;} @@ -3449,7 +3468,7 @@ yyreduce: case 150: /* Line 1455 of yacc.c */ -#line 1214 "program_parse.y" +#line 1233 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (2)].state)[1]; @@ -3459,7 +3478,7 @@ yyreduce: case 151: /* Line 1455 of yacc.c */ -#line 1221 "program_parse.y" +#line 1240 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_AMBIENT; @@ -3469,7 +3488,7 @@ yyreduce: case 152: /* Line 1455 of yacc.c */ -#line 1226 "program_parse.y" +#line 1245 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTMODEL_SCENECOLOR; @@ -3480,7 +3499,7 @@ yyreduce: case 153: /* Line 1455 of yacc.c */ -#line 1234 "program_parse.y" +#line 1253 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_LIGHTPROD; @@ -3493,7 +3512,7 @@ yyreduce: case 155: /* Line 1455 of yacc.c */ -#line 1246 "program_parse.y" +#line 1265 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(3) - (3)].integer); @@ -3504,7 +3523,7 @@ yyreduce: case 156: /* Line 1455 of yacc.c */ -#line 1254 "program_parse.y" +#line 1273 "program_parse.y" { (yyval.integer) = STATE_TEXENV_COLOR; ;} @@ -3513,7 +3532,7 @@ yyreduce: case 157: /* Line 1455 of yacc.c */ -#line 1260 "program_parse.y" +#line 1279 "program_parse.y" { (yyval.integer) = STATE_AMBIENT; ;} @@ -3522,7 +3541,7 @@ yyreduce: case 158: /* Line 1455 of yacc.c */ -#line 1264 "program_parse.y" +#line 1283 "program_parse.y" { (yyval.integer) = STATE_DIFFUSE; ;} @@ -3531,7 +3550,7 @@ yyreduce: case 159: /* Line 1455 of yacc.c */ -#line 1268 "program_parse.y" +#line 1287 "program_parse.y" { (yyval.integer) = STATE_SPECULAR; ;} @@ -3540,7 +3559,7 @@ yyreduce: case 160: /* Line 1455 of yacc.c */ -#line 1274 "program_parse.y" +#line 1293 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxLights) { yyerror(& (yylsp[(1) - (1)]), state, "invalid light selector"); @@ -3554,7 +3573,7 @@ yyreduce: case 161: /* Line 1455 of yacc.c */ -#line 1285 "program_parse.y" +#line 1304 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_TEXGEN; @@ -3566,7 +3585,7 @@ yyreduce: case 162: /* Line 1455 of yacc.c */ -#line 1294 "program_parse.y" +#line 1313 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S; ;} @@ -3575,7 +3594,7 @@ yyreduce: case 163: /* Line 1455 of yacc.c */ -#line 1298 "program_parse.y" +#line 1317 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_OBJECT_S; ;} @@ -3584,7 +3603,7 @@ yyreduce: case 164: /* Line 1455 of yacc.c */ -#line 1303 "program_parse.y" +#line 1322 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_S - STATE_TEXGEN_EYE_S; ;} @@ -3593,7 +3612,7 @@ yyreduce: case 165: /* Line 1455 of yacc.c */ -#line 1307 "program_parse.y" +#line 1326 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_T - STATE_TEXGEN_EYE_S; ;} @@ -3602,7 +3621,7 @@ yyreduce: case 166: /* Line 1455 of yacc.c */ -#line 1311 "program_parse.y" +#line 1330 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_R - STATE_TEXGEN_EYE_S; ;} @@ -3611,7 +3630,7 @@ yyreduce: case 167: /* Line 1455 of yacc.c */ -#line 1315 "program_parse.y" +#line 1334 "program_parse.y" { (yyval.integer) = STATE_TEXGEN_EYE_Q - STATE_TEXGEN_EYE_S; ;} @@ -3620,7 +3639,7 @@ yyreduce: case 168: /* Line 1455 of yacc.c */ -#line 1321 "program_parse.y" +#line 1340 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); @@ -3630,7 +3649,7 @@ yyreduce: case 169: /* Line 1455 of yacc.c */ -#line 1328 "program_parse.y" +#line 1347 "program_parse.y" { (yyval.integer) = STATE_FOG_COLOR; ;} @@ -3639,7 +3658,7 @@ yyreduce: case 170: /* Line 1455 of yacc.c */ -#line 1332 "program_parse.y" +#line 1351 "program_parse.y" { (yyval.integer) = STATE_FOG_PARAMS; ;} @@ -3648,7 +3667,7 @@ yyreduce: case 171: /* Line 1455 of yacc.c */ -#line 1338 "program_parse.y" +#line 1357 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_CLIPPLANE; @@ -3659,7 +3678,7 @@ yyreduce: case 172: /* Line 1455 of yacc.c */ -#line 1346 "program_parse.y" +#line 1365 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxClipPlanes) { yyerror(& (yylsp[(1) - (1)]), state, "invalid clip plane selector"); @@ -3673,7 +3692,7 @@ yyreduce: case 173: /* Line 1455 of yacc.c */ -#line 1357 "program_parse.y" +#line 1376 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = (yyvsp[(2) - (2)].integer); @@ -3683,7 +3702,7 @@ yyreduce: case 174: /* Line 1455 of yacc.c */ -#line 1364 "program_parse.y" +#line 1383 "program_parse.y" { (yyval.integer) = STATE_POINT_SIZE; ;} @@ -3692,7 +3711,7 @@ yyreduce: case 175: /* Line 1455 of yacc.c */ -#line 1368 "program_parse.y" +#line 1387 "program_parse.y" { (yyval.integer) = STATE_POINT_ATTENUATION; ;} @@ -3701,7 +3720,7 @@ yyreduce: case 176: /* Line 1455 of yacc.c */ -#line 1374 "program_parse.y" +#line 1393 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (5)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (5)].state)[1]; @@ -3714,7 +3733,7 @@ yyreduce: case 177: /* Line 1455 of yacc.c */ -#line 1384 "program_parse.y" +#line 1403 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (2)].state)[0]; (yyval.state)[1] = (yyvsp[(1) - (2)].state)[1]; @@ -3727,7 +3746,7 @@ yyreduce: case 178: /* Line 1455 of yacc.c */ -#line 1394 "program_parse.y" +#line 1413 "program_parse.y" { (yyval.state)[2] = 0; (yyval.state)[3] = 3; @@ -3737,7 +3756,7 @@ yyreduce: case 179: /* Line 1455 of yacc.c */ -#line 1399 "program_parse.y" +#line 1418 "program_parse.y" { /* It seems logical that the matrix row range specifier would have * to specify a range or more than one row (i.e., $5 > $3). @@ -3758,7 +3777,7 @@ yyreduce: case 180: /* Line 1455 of yacc.c */ -#line 1417 "program_parse.y" +#line 1436 "program_parse.y" { (yyval.state)[0] = (yyvsp[(2) - (3)].state)[0]; (yyval.state)[1] = (yyvsp[(2) - (3)].state)[1]; @@ -3769,7 +3788,7 @@ yyreduce: case 181: /* Line 1455 of yacc.c */ -#line 1425 "program_parse.y" +#line 1444 "program_parse.y" { (yyval.integer) = 0; ;} @@ -3778,7 +3797,7 @@ yyreduce: case 182: /* Line 1455 of yacc.c */ -#line 1429 "program_parse.y" +#line 1448 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} @@ -3787,7 +3806,7 @@ yyreduce: case 183: /* Line 1455 of yacc.c */ -#line 1435 "program_parse.y" +#line 1454 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVERSE; ;} @@ -3796,7 +3815,7 @@ yyreduce: case 184: /* Line 1455 of yacc.c */ -#line 1439 "program_parse.y" +#line 1458 "program_parse.y" { (yyval.integer) = STATE_MATRIX_TRANSPOSE; ;} @@ -3805,7 +3824,7 @@ yyreduce: case 185: /* Line 1455 of yacc.c */ -#line 1443 "program_parse.y" +#line 1462 "program_parse.y" { (yyval.integer) = STATE_MATRIX_INVTRANS; ;} @@ -3814,7 +3833,7 @@ yyreduce: case 186: /* Line 1455 of yacc.c */ -#line 1449 "program_parse.y" +#line 1468 "program_parse.y" { if ((yyvsp[(1) - (1)].integer) > 3) { yyerror(& (yylsp[(1) - (1)]), state, "invalid matrix row reference"); @@ -3828,7 +3847,7 @@ yyreduce: case 187: /* Line 1455 of yacc.c */ -#line 1460 "program_parse.y" +#line 1479 "program_parse.y" { (yyval.state)[0] = STATE_MODELVIEW_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); @@ -3838,7 +3857,7 @@ yyreduce: case 188: /* Line 1455 of yacc.c */ -#line 1465 "program_parse.y" +#line 1484 "program_parse.y" { (yyval.state)[0] = STATE_PROJECTION_MATRIX; (yyval.state)[1] = 0; @@ -3848,7 +3867,7 @@ yyreduce: case 189: /* Line 1455 of yacc.c */ -#line 1470 "program_parse.y" +#line 1489 "program_parse.y" { (yyval.state)[0] = STATE_MVP_MATRIX; (yyval.state)[1] = 0; @@ -3858,7 +3877,7 @@ yyreduce: case 190: /* Line 1455 of yacc.c */ -#line 1475 "program_parse.y" +#line 1494 "program_parse.y" { (yyval.state)[0] = STATE_TEXTURE_MATRIX; (yyval.state)[1] = (yyvsp[(2) - (2)].integer); @@ -3868,7 +3887,7 @@ yyreduce: case 191: /* Line 1455 of yacc.c */ -#line 1480 "program_parse.y" +#line 1499 "program_parse.y" { yyerror(& (yylsp[(1) - (4)]), state, "GL_ARB_matrix_palette not supported"); YYERROR; @@ -3878,7 +3897,7 @@ yyreduce: case 192: /* Line 1455 of yacc.c */ -#line 1485 "program_parse.y" +#line 1504 "program_parse.y" { (yyval.state)[0] = STATE_PROGRAM_MATRIX; (yyval.state)[1] = (yyvsp[(3) - (4)].integer); @@ -3888,7 +3907,7 @@ yyreduce: case 193: /* Line 1455 of yacc.c */ -#line 1492 "program_parse.y" +#line 1511 "program_parse.y" { (yyval.integer) = 0; ;} @@ -3897,7 +3916,7 @@ yyreduce: case 194: /* Line 1455 of yacc.c */ -#line 1496 "program_parse.y" +#line 1515 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} @@ -3906,7 +3925,7 @@ yyreduce: case 195: /* Line 1455 of yacc.c */ -#line 1501 "program_parse.y" +#line 1520 "program_parse.y" { /* Since GL_ARB_vertex_blend isn't supported, only modelview matrix * zero is valid. @@ -3923,7 +3942,7 @@ yyreduce: case 196: /* Line 1455 of yacc.c */ -#line 1514 "program_parse.y" +#line 1533 "program_parse.y" { /* Since GL_ARB_matrix_palette isn't supported, just let any value * through here. The error will be generated later. @@ -3935,7 +3954,7 @@ yyreduce: case 197: /* Line 1455 of yacc.c */ -#line 1522 "program_parse.y" +#line 1541 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxProgramMatrices) { yyerror(& (yylsp[(1) - (1)]), state, "invalid program matrix selector"); @@ -3949,7 +3968,7 @@ yyreduce: case 198: /* Line 1455 of yacc.c */ -#line 1533 "program_parse.y" +#line 1552 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = STATE_DEPTH_RANGE; @@ -3959,7 +3978,7 @@ yyreduce: case 203: /* Line 1455 of yacc.c */ -#line 1545 "program_parse.y" +#line 1564 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -3972,7 +3991,7 @@ yyreduce: case 204: /* Line 1455 of yacc.c */ -#line 1555 "program_parse.y" +#line 1574 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); @@ -3982,7 +4001,7 @@ yyreduce: case 205: /* Line 1455 of yacc.c */ -#line 1560 "program_parse.y" +#line 1579 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); @@ -3992,7 +4011,7 @@ yyreduce: case 206: /* Line 1455 of yacc.c */ -#line 1567 "program_parse.y" +#line 1586 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4005,7 +4024,7 @@ yyreduce: case 207: /* Line 1455 of yacc.c */ -#line 1577 "program_parse.y" +#line 1596 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4018,7 +4037,7 @@ yyreduce: case 208: /* Line 1455 of yacc.c */ -#line 1586 "program_parse.y" +#line 1605 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (1)].integer); (yyval.state)[1] = (yyvsp[(1) - (1)].integer); @@ -4028,7 +4047,7 @@ yyreduce: case 209: /* Line 1455 of yacc.c */ -#line 1591 "program_parse.y" +#line 1610 "program_parse.y" { (yyval.state)[0] = (yyvsp[(1) - (3)].integer); (yyval.state)[1] = (yyvsp[(3) - (3)].integer); @@ -4038,7 +4057,7 @@ yyreduce: case 210: /* Line 1455 of yacc.c */ -#line 1598 "program_parse.y" +#line 1617 "program_parse.y" { memset((yyval.state), 0, sizeof((yyval.state))); (yyval.state)[0] = state->state_param_enum; @@ -4051,7 +4070,7 @@ yyreduce: case 211: /* Line 1455 of yacc.c */ -#line 1608 "program_parse.y" +#line 1627 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxEnvParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid environment parameter reference"); @@ -4064,7 +4083,7 @@ yyreduce: case 212: /* Line 1455 of yacc.c */ -#line 1618 "program_parse.y" +#line 1637 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->limits->MaxLocalParams) { yyerror(& (yylsp[(1) - (1)]), state, "invalid local parameter reference"); @@ -4077,7 +4096,7 @@ yyreduce: case 217: /* Line 1455 of yacc.c */ -#line 1633 "program_parse.y" +#line 1652 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4090,7 +4109,7 @@ yyreduce: case 218: /* Line 1455 of yacc.c */ -#line 1643 "program_parse.y" +#line 1662 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (yyvsp[(1) - (1)].real); @@ -4103,7 +4122,7 @@ yyreduce: case 219: /* Line 1455 of yacc.c */ -#line 1651 "program_parse.y" +#line 1670 "program_parse.y" { (yyval.vector).count = 1; (yyval.vector).data[0] = (float) (yyvsp[(1) - (1)].integer); @@ -4116,7 +4135,7 @@ yyreduce: case 220: /* Line 1455 of yacc.c */ -#line 1661 "program_parse.y" +#line 1680 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (3)].real); @@ -4129,7 +4148,7 @@ yyreduce: case 221: /* Line 1455 of yacc.c */ -#line 1669 "program_parse.y" +#line 1688 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (5)].real); @@ -4142,7 +4161,7 @@ yyreduce: case 222: /* Line 1455 of yacc.c */ -#line 1678 "program_parse.y" +#line 1697 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (7)].real); @@ -4155,7 +4174,7 @@ yyreduce: case 223: /* Line 1455 of yacc.c */ -#line 1687 "program_parse.y" +#line 1706 "program_parse.y" { (yyval.vector).count = 4; (yyval.vector).data[0] = (yyvsp[(2) - (9)].real); @@ -4168,7 +4187,7 @@ yyreduce: case 224: /* Line 1455 of yacc.c */ -#line 1697 "program_parse.y" +#line 1716 "program_parse.y" { (yyval.real) = ((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].real) : (yyvsp[(2) - (2)].real); ;} @@ -4177,7 +4196,7 @@ yyreduce: case 225: /* Line 1455 of yacc.c */ -#line 1701 "program_parse.y" +#line 1720 "program_parse.y" { (yyval.real) = (float)(((yyvsp[(1) - (2)].negate)) ? -(yyvsp[(2) - (2)].integer) : (yyvsp[(2) - (2)].integer)); ;} @@ -4186,44 +4205,45 @@ yyreduce: case 226: /* Line 1455 of yacc.c */ -#line 1706 "program_parse.y" +#line 1725 "program_parse.y" { (yyval.negate) = FALSE; ;} break; case 227: /* Line 1455 of yacc.c */ -#line 1707 "program_parse.y" +#line 1726 "program_parse.y" { (yyval.negate) = TRUE; ;} break; case 228: /* Line 1455 of yacc.c */ -#line 1708 "program_parse.y" +#line 1727 "program_parse.y" { (yyval.negate) = FALSE; ;} break; case 229: /* Line 1455 of yacc.c */ -#line 1711 "program_parse.y" +#line 1730 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; case 231: /* Line 1455 of yacc.c */ -#line 1714 "program_parse.y" +#line 1733 "program_parse.y" { (yyval.integer) = (yyvsp[(1) - (1)].integer); ;} break; case 233: /* Line 1455 of yacc.c */ -#line 1718 "program_parse.y" +#line 1737 "program_parse.y" { if (!declare_variable(state, (yyvsp[(3) - (3)].string), (yyvsp[(0) - (3)].integer), & (yylsp[(3) - (3)]))) { + free((yyvsp[(3) - (3)].string)); YYERROR; } ;} @@ -4232,9 +4252,10 @@ yyreduce: case 234: /* Line 1455 of yacc.c */ -#line 1724 "program_parse.y" +#line 1744 "program_parse.y" { if (!declare_variable(state, (yyvsp[(1) - (1)].string), (yyvsp[(0) - (1)].integer), & (yylsp[(1) - (1)]))) { + free((yyvsp[(1) - (1)].string)); YYERROR; } ;} @@ -4243,12 +4264,13 @@ yyreduce: case 235: /* Line 1455 of yacc.c */ -#line 1732 "program_parse.y" +#line 1753 "program_parse.y" { struct asm_symbol *const s = declare_variable(state, (yyvsp[(2) - (4)].string), at_output, & (yylsp[(2) - (4)])); if (s == NULL) { + free((yyvsp[(2) - (4)].string)); YYERROR; } else { s->output_binding = (yyvsp[(4) - (4)].result); @@ -4259,7 +4281,7 @@ yyreduce: case 236: /* Line 1455 of yacc.c */ -#line 1745 "program_parse.y" +#line 1767 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_HPOS; @@ -4273,7 +4295,7 @@ yyreduce: case 237: /* Line 1455 of yacc.c */ -#line 1754 "program_parse.y" +#line 1776 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_FOGC; @@ -4287,7 +4309,7 @@ yyreduce: case 238: /* Line 1455 of yacc.c */ -#line 1763 "program_parse.y" +#line 1785 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (2)].result); ;} @@ -4296,7 +4318,7 @@ yyreduce: case 239: /* Line 1455 of yacc.c */ -#line 1767 "program_parse.y" +#line 1789 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_PSIZ; @@ -4310,7 +4332,7 @@ yyreduce: case 240: /* Line 1455 of yacc.c */ -#line 1776 "program_parse.y" +#line 1798 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.result) = VERT_RESULT_TEX0 + (yyvsp[(3) - (3)].integer); @@ -4324,7 +4346,7 @@ yyreduce: case 241: /* Line 1455 of yacc.c */ -#line 1785 "program_parse.y" +#line 1807 "program_parse.y" { if (state->mode == ARB_fragment) { (yyval.result) = FRAG_RESULT_DEPTH; @@ -4338,7 +4360,7 @@ yyreduce: case 242: /* Line 1455 of yacc.c */ -#line 1796 "program_parse.y" +#line 1818 "program_parse.y" { (yyval.result) = (yyvsp[(2) - (3)].integer) + (yyvsp[(3) - (3)].integer); ;} @@ -4347,7 +4369,7 @@ yyreduce: case 243: /* Line 1455 of yacc.c */ -#line 1802 "program_parse.y" +#line 1824 "program_parse.y" { (yyval.integer) = (state->mode == ARB_vertex) ? VERT_RESULT_COL0 @@ -4358,7 +4380,7 @@ yyreduce: case 244: /* Line 1455 of yacc.c */ -#line 1808 "program_parse.y" +#line 1830 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_COL0; @@ -4372,7 +4394,7 @@ yyreduce: case 245: /* Line 1455 of yacc.c */ -#line 1817 "program_parse.y" +#line 1839 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = VERT_RESULT_BFC0; @@ -4386,7 +4408,7 @@ yyreduce: case 246: /* Line 1455 of yacc.c */ -#line 1828 "program_parse.y" +#line 1850 "program_parse.y" { (yyval.integer) = 0; ;} @@ -4395,7 +4417,7 @@ yyreduce: case 247: /* Line 1455 of yacc.c */ -#line 1832 "program_parse.y" +#line 1854 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 0; @@ -4409,7 +4431,7 @@ yyreduce: case 248: /* Line 1455 of yacc.c */ -#line 1841 "program_parse.y" +#line 1863 "program_parse.y" { if (state->mode == ARB_vertex) { (yyval.integer) = 1; @@ -4423,91 +4445,91 @@ yyreduce: case 249: /* Line 1455 of yacc.c */ -#line 1851 "program_parse.y" +#line 1873 "program_parse.y" { (yyval.integer) = 0; ;} break; case 250: /* Line 1455 of yacc.c */ -#line 1852 "program_parse.y" +#line 1874 "program_parse.y" { (yyval.integer) = 0; ;} break; case 251: /* Line 1455 of yacc.c */ -#line 1853 "program_parse.y" +#line 1875 "program_parse.y" { (yyval.integer) = 1; ;} break; case 252: /* Line 1455 of yacc.c */ -#line 1856 "program_parse.y" +#line 1878 "program_parse.y" { (yyval.integer) = 0; ;} break; case 253: /* Line 1455 of yacc.c */ -#line 1857 "program_parse.y" +#line 1879 "program_parse.y" { (yyval.integer) = 0; ;} break; case 254: /* Line 1455 of yacc.c */ -#line 1858 "program_parse.y" +#line 1880 "program_parse.y" { (yyval.integer) = 1; ;} break; case 255: /* Line 1455 of yacc.c */ -#line 1861 "program_parse.y" +#line 1883 "program_parse.y" { (yyval.integer) = 0; ;} break; case 256: /* Line 1455 of yacc.c */ -#line 1862 "program_parse.y" +#line 1884 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 257: /* Line 1455 of yacc.c */ -#line 1865 "program_parse.y" +#line 1887 "program_parse.y" { (yyval.integer) = 0; ;} break; case 258: /* Line 1455 of yacc.c */ -#line 1866 "program_parse.y" +#line 1888 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 259: /* Line 1455 of yacc.c */ -#line 1869 "program_parse.y" +#line 1891 "program_parse.y" { (yyval.integer) = 0; ;} break; case 260: /* Line 1455 of yacc.c */ -#line 1870 "program_parse.y" +#line 1892 "program_parse.y" { (yyval.integer) = (yyvsp[(2) - (3)].integer); ;} break; case 261: /* Line 1455 of yacc.c */ -#line 1874 "program_parse.y" +#line 1896 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureCoordUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture coordinate unit selector"); @@ -4521,7 +4543,7 @@ yyreduce: case 262: /* Line 1455 of yacc.c */ -#line 1885 "program_parse.y" +#line 1907 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureImageUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture image unit selector"); @@ -4535,7 +4557,7 @@ yyreduce: case 263: /* Line 1455 of yacc.c */ -#line 1896 "program_parse.y" +#line 1918 "program_parse.y" { if ((unsigned) (yyvsp[(1) - (1)].integer) >= state->MaxTextureUnits) { yyerror(& (yylsp[(1) - (1)]), state, "invalid texture unit selector"); @@ -4549,7 +4571,7 @@ yyreduce: case 264: /* Line 1455 of yacc.c */ -#line 1907 "program_parse.y" +#line 1929 "program_parse.y" { struct asm_symbol *exist = (struct asm_symbol *) _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(2) - (4)].string)); @@ -4557,10 +4579,14 @@ yyreduce: _mesa_symbol_table_find_symbol(state->st, 0, (yyvsp[(4) - (4)].string)); + free((yyvsp[(4) - (4)].string)); + if (exist != NULL) { + free((yyvsp[(2) - (4)].string)); yyerror(& (yylsp[(2) - (4)]), state, "redeclared identifier"); YYERROR; } else if (target == NULL) { + free((yyvsp[(2) - (4)].string)); yyerror(& (yylsp[(4) - (4)]), state, "undefined variable binding in ALIAS statement"); YYERROR; @@ -4573,7 +4599,7 @@ yyreduce: /* Line 1455 of yacc.c */ -#line 4577 "program_parse.tab.c" +#line 4603 "program_parse.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); @@ -4792,7 +4818,7 @@ yyreturn: /* Line 1675 of yacc.c */ -#line 1927 "program_parse.y" +#line 1953 "program_parse.y" struct asm_instruction * -- cgit v1.2.3 From caf3038123d6d29afd7d1f0cd6db98a2282c3ca1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Mon, 26 Oct 2009 09:28:32 -0700 Subject: Make a convenient int for what chipset generation we're on. gen2/3/4 are easier to say than "8xx, 915-945/g33/pineview, 965/g45/misc", and compares on generation are often easier than stringing together a bunch of chipset checks. --- src/mesa/drivers/dri/intel/intel_context.c | 17 ++++++++++++----- src/mesa/drivers/dri/intel/intel_context.h | 5 +++++ src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 2 +- src/mesa/drivers/dri/intel/intel_regions.c | 3 +-- src/mesa/drivers/dri/intel/intel_tex_validate.c | 2 +- 5 files changed, 20 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index a7d94ced9a..e0022ad548 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -477,7 +477,7 @@ intel_flush(GLcontext *ctx, GLboolean needs_mi_flush) if (intel->Fallback) _swrast_flush(ctx); - if (!IS_965(intel->intelScreen->deviceID)) + if (intel->gen < 4) INTEL_FIREVERTICES(intel); /* Emit a flush so that any frontbuffer rendering that might have occurred @@ -614,6 +614,13 @@ intelInitContext(struct intel_context *intel, intel->sarea = intelScreen->sarea; intel->driContext = driContextPriv; + if (IS_965(intel->intelScreen->deviceID)) + intel->gen = 4; + else if (IS_9XX(intel->intelScreen->deviceID)) + intel->gen = 3; + else + intel->gen = 2; + /* Dri stuff */ intel->hHWContext = driContextPriv->hHWContext; intel->driFd = sPriv->fd; @@ -621,7 +628,7 @@ intelInitContext(struct intel_context *intel, driParseConfigFiles(&intel->optionCache, &intelScreen->optionCache, intel->driScreen->myNum, - IS_965(intelScreen->deviceID) ? "i965" : "i915"); + (intel->gen >= 4) ? "i965" : "i915"); if (intelScreen->deviceID == PCI_CHIP_I865_G) intel->maxBatchSize = 4096; else @@ -683,7 +690,7 @@ intelInitContext(struct intel_context *intel, meta_init_metaops(ctx, &intel->meta); ctx->Const.MaxColorAttachments = 4; /* XXX FBO: review this */ - if (IS_965(intelScreen->deviceID)) { + if (intel->gen >= 4) { if (MAX_WIDTH > 8192) ctx->Const.MaxRenderbufferSize = 8192; } else { @@ -720,7 +727,7 @@ intelInitContext(struct intel_context *intel, break; } - if (IS_965(intelScreen->deviceID)) + if (intel->gen >= 4) intel->polygon_offset_scale /= 0xffff; intel->RenderIndex = ~0; @@ -733,7 +740,7 @@ intelInitContext(struct intel_context *intel, intel->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS); - if (IS_965(intelScreen->deviceID) && !intel->intelScreen->irq_active) { + if (intel->gen >= 4 && !intel->intelScreen->irq_active) { _mesa_printf("IRQs not active. Exiting\n"); exit(1); } diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 356fa4d1e5..2fc224e51a 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -183,6 +183,11 @@ struct intel_context dri_bufmgr *bufmgr; unsigned int maxBatchSize; + /** + * Generation number of the hardware: 2 is 8xx, 3 is 9xx pre-965, 4 is 965. + */ + int gen; + struct intel_region *front_region; struct intel_region *back_region; struct intel_region *depth_region; diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 3996c100a5..2a19816e12 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -122,7 +122,7 @@ intel_miptree_create(struct intel_context *intel, if (intel->use_texture_tiling && compress_byte == 0 && intel->intelScreen->kernel_exec_fencing) { - if (IS_965(intel->intelScreen->deviceID) && + if (intel->gen >= 4 && (base_format == GL_DEPTH_COMPONENT || base_format == GL_DEPTH_STENCIL_EXT)) tiling = I915_TILING_Y; diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c index a86c66a844..80975163d4 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.c +++ b/src/mesa/drivers/dri/intel/intel_regions.c @@ -582,8 +582,7 @@ intel_recreate_static(struct intel_context *intel, * instead of which tiling mode it is. Guess. */ if (region_desc->tiled) { - if (IS_965(intel->intelScreen->deviceID) && - region_desc == &intelScreen->depth) + if (intel->gen >= 4 && region_desc == &intelScreen->depth) region->tiling = I915_TILING_Y; else region->tiling = I915_TILING_X; diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c index 504993989a..df93b3b759 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_validate.c +++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c @@ -42,7 +42,7 @@ intel_calculate_first_last_level(struct intel_context *intel, firstLevel = lastLevel = tObj->BaseLevel; } else { - if (!IS_9XX(intel->intelScreen->deviceID)) { + if (intel->gen == 2) { firstLevel = tObj->BaseLevel + (GLint) (tObj->MinLod + 0.5); firstLevel = MAX2(firstLevel, tObj->BaseLevel); firstLevel = MIN2(firstLevel, tObj->BaseLevel + baseImage->MaxLog2); -- cgit v1.2.3 From 8e0f40d28777f1ae599a95312788fe29a0515a0d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 3 Nov 2009 17:18:36 -0800 Subject: intel: Use PIPE_CONTROL on gen4 hardware for doing pipeline flushing. This should do all the things that MI_FLUSH did, but it can be pipelined so that further rendering isn't blocked on the flush completion unless necessary. --- src/mesa/drivers/dri/i915/i830_vtbl.c | 10 -------- src/mesa/drivers/dri/i915/i915_vtbl.c | 7 ------ src/mesa/drivers/dri/i965/brw_draw.c | 8 ++---- src/mesa/drivers/dri/i965/brw_vtbl.c | 15 ------------ src/mesa/drivers/dri/intel/intel_batchbuffer.c | 34 ++++++++++++++++++++++++-- src/mesa/drivers/dri/intel/intel_batchbuffer.h | 12 +++------ src/mesa/drivers/dri/intel/intel_context.h | 2 -- 7 files changed, 37 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index 4133696129..a6f554701e 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -719,15 +719,6 @@ i830_new_batch(struct intel_context *intel) assert(!intel->no_batch_wrap); } - - -static GLuint -i830_flush_cmd(void) -{ - return MI_FLUSH | FLUSH_MAP_CACHE; -} - - static void i830_assert_not_dirty( struct intel_context *intel ) { @@ -753,7 +744,6 @@ i830InitVtbl(struct i830_context *i830) i830->intel.vtbl.reduced_primitive_state = i830_reduced_primitive_state; i830->intel.vtbl.set_draw_region = i830_set_draw_region; i830->intel.vtbl.update_texture_state = i830UpdateTextureState; - i830->intel.vtbl.flush_cmd = i830_flush_cmd; i830->intel.vtbl.render_start = i830_render_start; i830->intel.vtbl.render_prevalidate = i830_render_prevalidate; i830->intel.vtbl.assert_not_dirty = i830_assert_not_dirty; diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index 3c1b2dd0b0..77ba8d5581 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -672,12 +672,6 @@ i915_new_batch(struct intel_context *intel) assert(!intel->no_batch_wrap); } -static GLuint -i915_flush_cmd(void) -{ - return MI_FLUSH | FLUSH_MAP_CACHE; -} - static void i915_assert_not_dirty( struct intel_context *intel ) { @@ -699,7 +693,6 @@ i915InitVtbl(struct i915_context *i915) i915->intel.vtbl.render_prevalidate = i915_render_prevalidate; i915->intel.vtbl.set_draw_region = i915_set_draw_region; i915->intel.vtbl.update_texture_state = i915UpdateTextureState; - i915->intel.vtbl.flush_cmd = i915_flush_cmd; i915->intel.vtbl.assert_not_dirty = i915_assert_not_dirty; i915->intel.vtbl.finish_batch = intel_finish_vb; } diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index 44bb7bd588..8bcb6083f7 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -153,18 +153,14 @@ static void brw_emit_prim(struct brw_context *brw, * the besides the draw code. */ if (intel->always_flush_cache) { - BEGIN_BATCH(1, IGNORE_CLIPRECTS); - OUT_BATCH(intel->vtbl.flush_cmd()); - ADVANCE_BATCH(); + intel_batchbuffer_emit_mi_flush(intel->batch); } if (prim_packet.verts_per_instance) { intel_batchbuffer_data( brw->intel.batch, &prim_packet, sizeof(prim_packet), LOOP_CLIPRECTS); } if (intel->always_flush_cache) { - BEGIN_BATCH(1, IGNORE_CLIPRECTS); - OUT_BATCH(intel->vtbl.flush_cmd()); - ADVANCE_BATCH(); + intel_batchbuffer_emit_mi_flush(intel->batch); } brw->no_batch_wrap = GL_FALSE; diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c index 124fde25fe..114e6bd018 100644 --- a/src/mesa/drivers/dri/i965/brw_vtbl.c +++ b/src/mesa/drivers/dri/i965/brw_vtbl.c @@ -175,20 +175,6 @@ static void brw_note_fence( struct intel_context *intel, GLuint fence ) brw_context(&intel->ctx)->state.dirty.brw |= BRW_NEW_FENCE; } -/* called from intelWaitForIdle() and intelFlush() - * - * For now, just flush everything. Could be smarter later. - */ -static GLuint brw_flush_cmd( void ) -{ - struct brw_mi_flush flush; - flush.opcode = CMD_MI_FLUSH; - flush.pad = 0; - flush.flags = BRW_FLUSH_STATE_CACHE; - return *(GLuint *)&flush; -} - - static void brw_invalidate_state( struct intel_context *intel, GLuint new_state ) { /* nothing */ @@ -209,6 +195,5 @@ void brwInitVtbl( struct brw_context *brw ) brw->intel.vtbl.finish_batch = brw_finish_batch; brw->intel.vtbl.destroy = brw_destroy_context; brw->intel.vtbl.set_draw_region = brw_set_draw_region; - brw->intel.vtbl.flush_cmd = brw_flush_cmd; brw->intel.vtbl.debug_batch = brw_debug_batch; } diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c index e94b8368cd..ca6e2fa5b1 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c @@ -210,10 +210,10 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file, fprintf(stderr, "%s:%d: Batchbuffer flush with %db used\n", file, line, used); + batch->reserved_space = 0; /* Emit a flush if the bufmgr doesn't do it for us. */ if (intel->always_flush_cache || !intel->ttm) { - *(GLuint *) (batch->ptr) = intel->vtbl.flush_cmd(); - batch->ptr += 4; + intel_batchbuffer_emit_mi_flush(batch); used = batch->ptr - batch->map; } @@ -244,6 +244,8 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file, if (intel->vtbl.finish_batch) intel->vtbl.finish_batch(intel); + batch->reserved_space = BATCH_RESERVED; + /* TODO: Just pass the relocation list and dma buffer up to the * kernel. */ @@ -299,3 +301,31 @@ intel_batchbuffer_data(struct intel_batchbuffer *batch, __memcpy(batch->ptr, data, bytes); batch->ptr += bytes; } + +/* Emit a pipelined flush to either flush render and texture cache for + * reading from a FBO-drawn texture, or flush so that frontbuffer + * render appears on the screen in DRI1. + * + * This is also used for the always_flush_cache driconf debug option. + */ +void +intel_batchbuffer_emit_mi_flush(struct intel_batchbuffer *batch) +{ + struct intel_context *intel = batch->intel; + + if (intel->gen >= 4) { + BEGIN_BATCH(4, IGNORE_CLIPRECTS); + OUT_BATCH(_3DSTATE_PIPE_CONTROL | + PIPE_CONTROL_INSTRUCTION_FLUSH | + PIPE_CONTROL_WRITE_FLUSH | + PIPE_CONTROL_NO_WRITE); + OUT_BATCH(0); /* write address */ + OUT_BATCH(0); /* write data */ + OUT_BATCH(0); /* write data */ + ADVANCE_BATCH(); + } else { + BEGIN_BATCH(1, IGNORE_CLIPRECTS); + OUT_BATCH(MI_FLUSH); + ADVANCE_BATCH(); + } +} diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.h b/src/mesa/drivers/dri/intel/intel_batchbuffer.h index d4899aab7f..d4a94454dd 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.h +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.h @@ -62,6 +62,7 @@ struct intel_batchbuffer } emit; GLuint dirty_state; + GLuint reserved_space; }; struct intel_batchbuffer *intel_batchbuffer_alloc(struct intel_context @@ -95,6 +96,7 @@ GLboolean intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch, uint32_t read_domains, uint32_t write_domain, uint32_t offset); +void intel_batchbuffer_emit_mi_flush(struct intel_batchbuffer *batch); /* Inline functions - might actually be better off with these * non-inlined. Certainly better off switching all command packets to @@ -104,7 +106,7 @@ GLboolean intel_batchbuffer_emit_reloc(struct intel_batchbuffer *batch, static INLINE GLint intel_batchbuffer_space(struct intel_batchbuffer *batch) { - return (batch->size - BATCH_RESERVED) - (batch->ptr - batch->map); + return (batch->size - batch->reserved_space) - (batch->ptr - batch->map); } @@ -173,12 +175,4 @@ intel_batchbuffer_require_space(struct intel_batchbuffer *batch, intel->batch->emit.start_ptr = NULL; \ } while(0) - -static INLINE void -intel_batchbuffer_emit_mi_flush(struct intel_batchbuffer *batch) -{ - intel_batchbuffer_require_space(batch, 4, IGNORE_CLIPRECTS); - intel_batchbuffer_emit_dword(batch, MI_FLUSH); -} - #endif diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 2fc224e51a..84fbfc564c 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -117,8 +117,6 @@ struct intel_context struct intel_region * depth_region, GLuint num_regions); - GLuint (*flush_cmd) (void); - void (*reduced_primitive_state) (struct intel_context * intel, GLenum rprim); -- cgit v1.2.3 From bb2dd50be00000b66218bc6a9e6be8de70b31493 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 3 Nov 2009 17:30:46 -0800 Subject: intel: Remove obsolete comment about GEM in the spans code. --- src/mesa/drivers/dri/intel/intel_span.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index bab13e3665..3607c7dded 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -292,7 +292,6 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb, #define Y_FLIP(_y) ((_y) * yScale + yBias) -/* XXX with GEM, these need to tell the kernel */ #define HW_LOCK() #define HW_UNLOCK() -- cgit v1.2.3 From 2bc8bcdcd334db715f8916f80ef4f4bc5f9a170d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 3 Nov 2009 17:40:13 -0800 Subject: i965: Remove an XXX comment for testing some code that seems to work. --- src/mesa/drivers/dri/i965/brw_wm_fp.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index 0e86d75dea..a453250e79 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -448,7 +448,6 @@ static void emit_interp( struct brw_wm_compile *c, break; case FRAG_ATTRIB_FACE: - /* XXX review/test this case */ emit_op(c, WM_FRONTFACING, dst_mask(dst, WRITEMASK_X), -- cgit v1.2.3 From 8f30ceaaefc33401b08739a16ce1c5638d6432fa Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Nov 2009 13:41:48 -0800 Subject: intel: Remove duplicated arguments from intel_miptree_match_image(). --- src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 5 +++-- src/mesa/drivers/dri/intel/intel_mipmap_tree.h | 3 +-- src/mesa/drivers/dri/intel/intel_tex_image.c | 9 +++------ 3 files changed, 7 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 2a19816e12..e082ebc799 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -315,10 +315,11 @@ intel_miptree_release(struct intel_context *intel, */ GLboolean intel_miptree_match_image(struct intel_mipmap_tree *mt, - struct gl_texture_image *image, - GLuint face, GLuint level) + struct gl_texture_image *image) { GLboolean isCompressed = _mesa_is_format_compressed(image->TexFormat); + struct intel_texture_image *intelImage = intel_texture_image(image); + GLuint level = intelImage->level; /* Images with borders are never pulled into mipmap trees. */ diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h index 3bce54daa1..b19c548def 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h @@ -165,8 +165,7 @@ void intel_miptree_release(struct intel_context *intel, /* Check if an image fits an existing mipmap tree layout */ GLboolean intel_miptree_match_image(struct intel_mipmap_tree *mt, - struct gl_texture_image *image, - GLuint face, GLuint level); + struct gl_texture_image *image); /* Return a pointer to an image within a tree. Return image stride as * well. diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 3412e761ca..0644277c05 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -368,8 +368,7 @@ intelTexImage(GLcontext * ctx, intelObj->mt->first_level == level && intelObj->mt->last_level == level && intelObj->mt->target != GL_TEXTURE_CUBE_MAP_ARB && - !intel_miptree_match_image(intelObj->mt, &intelImage->base, - intelImage->face, intelImage->level)) { + !intel_miptree_match_image(intelObj->mt, &intelImage->base)) { DBG("release it\n"); intel_miptree_release(intel, &intelObj->mt); @@ -386,8 +385,7 @@ intelTexImage(GLcontext * ctx, assert(!intelImage->mt); if (intelObj->mt && - intel_miptree_match_image(intelObj->mt, &intelImage->base, - intelImage->face, intelImage->level)) { + intel_miptree_match_image(intelObj->mt, &intelImage->base)) { intel_miptree_reference(&intelImage->mt, intelObj->mt); assert(intelImage->mt); @@ -797,8 +795,7 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, texImage->RowStride = rb->region->pitch; intel_miptree_reference(&intelImage->mt, intelObj->mt); - if (!intel_miptree_match_image(intelObj->mt, &intelImage->base, - intelImage->face, intelImage->level)) { + if (!intel_miptree_match_image(intelObj->mt, &intelImage->base)) { fprintf(stderr, "miptree doesn't match image\n"); } -- cgit v1.2.3 From ee7dfbbd6cc85f221b371bf512bd1571744158e8 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Nov 2009 16:49:05 -0800 Subject: intel: Use _mesa_get_current_tex_object() to clean up TFP path. --- src/mesa/drivers/dri/intel/intel_tex_image.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_image.c b/src/mesa/drivers/dri/intel/intel_tex_image.c index 0644277c05..66d61f93ea 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_image.c +++ b/src/mesa/drivers/dri/intel/intel_tex_image.c @@ -115,7 +115,8 @@ guess_and_alloc_mipmap_tree(struct intel_context *intel, */ if ((intelObj->base.MinFilter == GL_NEAREST || intelObj->base.MinFilter == GL_LINEAR) && - intelImage->level == firstLevel) { + intelImage->level == firstLevel && + (intel->gen < 4 || firstLevel == 0)) { lastLevel = firstLevel; } else { @@ -733,17 +734,16 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, { struct intel_framebuffer *intel_fb = dPriv->driverPrivate; struct intel_context *intel = pDRICtx->driverPrivate; + GLcontext *ctx = &intel->ctx; struct intel_texture_object *intelObj; struct intel_texture_image *intelImage; struct intel_mipmap_tree *mt; struct intel_renderbuffer *rb; - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; struct gl_texture_image *texImage; int level = 0, internalFormat; - texUnit = &intel->ctx.Texture.Unit[intel->ctx.Texture.CurrentUnit]; - texObj = _mesa_select_tex_object(&intel->ctx, texUnit, target); + texObj = _mesa_get_current_tex_object(ctx, target); intelObj = intel_texture_object(texObj); if (!intelObj) -- cgit v1.2.3 From 8df81bca1704aef2f5cdc4052ef313d8f84f5d06 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Nov 2009 15:11:02 -0800 Subject: intel: Clean up some extra struct indirection in finalize. --- src/mesa/drivers/dri/intel/intel_tex_validate.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c index df93b3b759..dbef288615 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_validate.c +++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c @@ -138,8 +138,7 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) /* What levels must the tree include at a minimum? */ intel_calculate_first_last_level(intel, intelObj); - firstImage = - intel_texture_image(intelObj->base.Image[0][intelObj->firstLevel]); + firstImage = intel_texture_image(tObj->Image[0][intelObj->firstLevel]); /* Fallback case: */ -- cgit v1.2.3 From 6b68482e6869bdc03339ef5380d7273e14a61a56 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Nov 2009 14:31:30 -0800 Subject: mesa: Attempt to pair up Driver.RenderTexture and FinishRenderTexture() This is probably not 100% complete (bind vs unbind may still not pair up exactly), but it should help out drivers which are relying on FinishRenderTexture to be called when we're done rendering to a particular texture level, not just when we're done rendering to the object at all. This is the case for the one consumer of FinishRenderTexture() so far: the gallium state tracker. Noticed when trying to make use of FRT() in the intel driver. --- src/mesa/main/fbobject.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 319d0f2ce9..c4454550db 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -233,9 +233,13 @@ _mesa_set_texture_attachment(GLcontext *ctx, if (att->Texture == texObj) { /* re-attaching same texture */ ASSERT(att->Type == GL_TEXTURE); + if (ctx->Driver.FinishRenderTexture) + ctx->Driver.FinishRenderTexture(ctx, att); } else { /* new attachment */ + if (ctx->Driver.FinishRenderTexture && att->Texture) + ctx->Driver.FinishRenderTexture(ctx, att); _mesa_remove_attachment(ctx, att); att->Type = GL_TEXTURE; assert(!att->Texture); -- cgit v1.2.3 From 75bdbdd90b15c8704d87ca195a364ff6a42edbb1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Nov 2009 14:54:09 -0800 Subject: intel: Don't validate in a texture image used as a render target. Otherwise, we could lose track of rendering to that image, which could easily happen during mipmap generation. --- src/mesa/drivers/dri/intel/intel_fbo.c | 18 ++++++++---------- src/mesa/drivers/dri/intel/intel_tex_obj.h | 1 + src/mesa/drivers/dri/intel/intel_tex_validate.c | 7 ++++++- 3 files changed, 15 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index d8ac4d3663..5615040946 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -577,6 +577,7 @@ intel_render_texture(GLcontext * ctx, dst_x) * intel_image->mt->cpp; intel_image->mt->region->draw_x = dst_x; intel_image->mt->region->draw_y = dst_y; + intel_image->used_as_render_target = GL_TRUE; /* update drawing region, etc */ intel_draw_buffer(ctx, fb); @@ -590,16 +591,13 @@ static void intel_finish_render_texture(GLcontext * ctx, struct gl_renderbuffer_attachment *att) { - /* no-op - * Previously we released the renderbuffer's intel_region but - * that's not necessary and actually caused problems when trying - * to do a glRead/CopyPixels from the renderbuffer later. - * The region will be released later if the texture is replaced - * or the renderbuffer deleted. - * - * The intention of this driver hook is more of a "done rendering - * to texture, please re-twiddle/etc if necessary". - */ + struct gl_texture_object *tex_obj = att->Texture; + struct gl_texture_image *image = + tex_obj->Image[att->CubeMapFace][att->TextureLevel]; + struct intel_texture_image *intel_image = intel_texture_image(image); + + /* Flag that this image may now be validated into the object's miptree. */ + intel_image->used_as_render_target = GL_FALSE; } diff --git a/src/mesa/drivers/dri/intel/intel_tex_obj.h b/src/mesa/drivers/dri/intel/intel_tex_obj.h index 5a93461525..3ad10d3d23 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_obj.h +++ b/src/mesa/drivers/dri/intel/intel_tex_obj.h @@ -66,6 +66,7 @@ struct intel_texture_image * Else there is no image data. */ struct intel_mipmap_tree *mt; + GLboolean used_as_render_target; }; static INLINE struct intel_texture_object * diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c index dbef288615..c9a24ac398 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_validate.c +++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c @@ -222,8 +222,13 @@ intel_finalize_mipmap_tree(struct intel_context *intel, GLuint unit) intel_texture_image(intelObj->base.Image[face][i]); /* Need to import images in main memory or held in other trees. + * If it's a render target, then its data isn't needed to be in + * the object tree (otherwise we'd be FBO incomplete), and we need + * to keep track of the image's MT as needing to be pulled in still, + * or we'll lose the rendering that's done to it. */ - if (intelObj->mt != intelImage->mt) { + if (intelObj->mt != intelImage->mt && + !intelImage->used_as_render_target) { copy_image_data_to_tree(intel, intelObj, intelImage); } } -- cgit v1.2.3 From 1166294d1dd253da63620235100a11f1981aa86d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 4 Nov 2009 17:31:01 -0800 Subject: intel: Finish removing the fallback code for bug #16697. I fixed it properly as of 7216679c1998b49ff5b08e6b43f8d5779415bf54. --- src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index e082ebc799..abb3024bfb 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -321,12 +321,8 @@ intel_miptree_match_image(struct intel_mipmap_tree *mt, struct intel_texture_image *intelImage = intel_texture_image(image); GLuint level = intelImage->level; - /* Images with borders are never pulled into mipmap trees. - */ - if (image->Border || - ((image->_BaseFormat == GL_DEPTH_COMPONENT) && - ((image->TexObject->WrapS == GL_CLAMP_TO_BORDER) || - (image->TexObject->WrapT == GL_CLAMP_TO_BORDER)))) + /* Images with borders are never pulled into mipmap trees. */ + if (image->Border) return GL_FALSE; if (image->InternalFormat != mt->internal_format || -- cgit v1.2.3 From 8395da2e8af40367714c70afe299568272f36cc8 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 5 Nov 2009 10:25:34 -0800 Subject: i965: Always pass the size argument to brw_cache_data. This keeps the individual state files from having to export their structures for brw_state_cache initialization. --- src/mesa/drivers/dri/i965/brw_cc.c | 3 +- src/mesa/drivers/dri/i965/brw_context.h | 1 - src/mesa/drivers/dri/i965/brw_sf_state.c | 3 +- src/mesa/drivers/dri/i965/brw_state.h | 8 +--- src/mesa/drivers/dri/i965/brw_state_cache.c | 59 ++++++------------------ src/mesa/drivers/dri/i965/brw_wm_sampler_state.c | 4 +- 6 files changed, 21 insertions(+), 57 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c index 5cca605c3f..d4ccd28c9e 100644 --- a/src/mesa/drivers/dri/i965/brw_cc.c +++ b/src/mesa/drivers/dri/i965/brw_cc.c @@ -55,7 +55,8 @@ static void prepare_cc_vp( struct brw_context *brw ) } dri_bo_unreference(brw->cc.vp_bo); - brw->cc.vp_bo = brw_cache_data( &brw->cache, BRW_CC_VP, &ccv, NULL, 0 ); + brw->cc.vp_bo = brw_cache_data(&brw->cache, BRW_CC_VP, &ccv, sizeof(ccv), + NULL, 0); } const struct brw_tracked_state brw_cc_vp = { diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 59f9475b5a..e01930a4a0 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -333,7 +333,6 @@ struct brw_cache { struct brw_cache_item **items; GLuint size, n_items; - GLuint key_size[BRW_MAX_CACHE]; /* for fixed-size keys */ GLuint aux_size[BRW_MAX_CACHE]; char *name[BRW_MAX_CACHE]; diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c index bc0f076073..d6b47b5d8d 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_state.c +++ b/src/mesa/drivers/dri/i965/brw_sf_state.c @@ -93,7 +93,8 @@ static void upload_sf_vp(struct brw_context *brw) } dri_bo_unreference(brw->sf.vp_bo); - brw->sf.vp_bo = brw_cache_data( &brw->cache, BRW_SF_VP, &sfv, NULL, 0 ); + brw->sf.vp_bo = brw_cache_data(&brw->cache, BRW_SF_VP, &sfv, sizeof(sfv), + NULL, 0); } const struct brw_tracked_state brw_sf_vp = { diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index d639656b9d..ab6f158080 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -119,16 +119,10 @@ void brw_destroy_state(struct brw_context *brw); dri_bo *brw_cache_data(struct brw_cache *cache, enum brw_cache_id cache_id, const void *data, + GLuint size, dri_bo **reloc_bufs, GLuint nr_reloc_bufs); -dri_bo *brw_cache_data_sz(struct brw_cache *cache, - enum brw_cache_id cache_id, - const void *data, - GLuint data_size, - dri_bo **reloc_bufs, - GLuint nr_reloc_bufs); - dri_bo *brw_upload_cache( struct brw_cache *cache, enum brw_cache_id cache_id, const void *key, diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c index c262e1db8b..d2ab624783 100644 --- a/src/mesa/drivers/dri/i965/brw_state_cache.c +++ b/src/mesa/drivers/dri/i965/brw_state_cache.c @@ -275,15 +275,22 @@ brw_upload_cache( struct brw_cache *cache, /** - * This doesn't really work with aux data. Use search/upload instead + * Wrapper around brw_cache_data_sz using the cache_id's canonical key size. + * + * If nr_reloc_bufs is nonzero, brw_search_cache()/brw_upload_cache() would be + * better to use, as the potentially changing offsets in the data-used-as-key + * will result in excessive cache misses. + * + * If aux data is involved, use search/upload instead. + */ dri_bo * -brw_cache_data_sz(struct brw_cache *cache, - enum brw_cache_id cache_id, - const void *data, - GLuint data_size, - dri_bo **reloc_bufs, - GLuint nr_reloc_bufs) +brw_cache_data(struct brw_cache *cache, + enum brw_cache_id cache_id, + const void *data, + GLuint data_size, + dri_bo **reloc_bufs, + GLuint nr_reloc_bufs) { dri_bo *bo; struct brw_cache_item *item; @@ -306,25 +313,6 @@ brw_cache_data_sz(struct brw_cache *cache, return bo; } - -/** - * Wrapper around brw_cache_data_sz using the cache_id's canonical key size. - * - * If nr_reloc_bufs is nonzero, brw_search_cache()/brw_upload_cache() would be - * better to use, as the potentially changing offsets in the data-used-as-key - * will result in excessive cache misses. - */ -dri_bo * -brw_cache_data(struct brw_cache *cache, - enum brw_cache_id cache_id, - const void *data, - dri_bo **reloc_bufs, - GLuint nr_reloc_bufs) -{ - return brw_cache_data_sz(cache, cache_id, data, cache->key_size[cache_id], - reloc_bufs, nr_reloc_bufs); -} - enum pool_type { DW_SURFACE_STATE, DW_GENERAL_STATE @@ -335,11 +323,9 @@ static void brw_init_cache_id(struct brw_cache *cache, const char *name, enum brw_cache_id id, - GLuint key_size, GLuint aux_size) { cache->name[id] = strdup(name); - cache->key_size[id] = key_size; cache->aux_size[id] = aux_size; } @@ -359,91 +345,76 @@ brw_init_non_surface_cache(struct brw_context *brw) brw_init_cache_id(cache, "CC_VP", BRW_CC_VP, - sizeof(struct brw_cc_viewport), 0); brw_init_cache_id(cache, "CC_UNIT", BRW_CC_UNIT, - sizeof(struct brw_cc_unit_state), 0); brw_init_cache_id(cache, "WM_PROG", BRW_WM_PROG, - sizeof(struct brw_wm_prog_key), sizeof(struct brw_wm_prog_data)); brw_init_cache_id(cache, "SAMPLER_DEFAULT_COLOR", BRW_SAMPLER_DEFAULT_COLOR, - sizeof(struct brw_sampler_default_color), 0); brw_init_cache_id(cache, "SAMPLER", BRW_SAMPLER, - 0, /* variable key/data size */ 0); brw_init_cache_id(cache, "WM_UNIT", BRW_WM_UNIT, - sizeof(struct brw_wm_unit_state), 0); brw_init_cache_id(cache, "SF_PROG", BRW_SF_PROG, - sizeof(struct brw_sf_prog_key), sizeof(struct brw_sf_prog_data)); brw_init_cache_id(cache, "SF_VP", BRW_SF_VP, - sizeof(struct brw_sf_viewport), 0); brw_init_cache_id(cache, "SF_UNIT", BRW_SF_UNIT, - sizeof(struct brw_sf_unit_state), 0); brw_init_cache_id(cache, "VS_UNIT", BRW_VS_UNIT, - sizeof(struct brw_vs_unit_state), 0); brw_init_cache_id(cache, "VS_PROG", BRW_VS_PROG, - sizeof(struct brw_vs_prog_key), sizeof(struct brw_vs_prog_data)); brw_init_cache_id(cache, "CLIP_UNIT", BRW_CLIP_UNIT, - sizeof(struct brw_clip_unit_state), 0); brw_init_cache_id(cache, "CLIP_PROG", BRW_CLIP_PROG, - sizeof(struct brw_clip_prog_key), sizeof(struct brw_clip_prog_data)); brw_init_cache_id(cache, "GS_UNIT", BRW_GS_UNIT, - sizeof(struct brw_gs_unit_state), 0); brw_init_cache_id(cache, "GS_PROG", BRW_GS_PROG, - sizeof(struct brw_gs_prog_key), sizeof(struct brw_gs_prog_data)); } @@ -463,13 +434,11 @@ brw_init_surface_cache(struct brw_context *brw) brw_init_cache_id(cache, "SS_SURFACE", BRW_SS_SURFACE, - sizeof(struct brw_surface_state), 0); brw_init_cache_id(cache, "SS_SURF_BIND", BRW_SS_SURF_BIND, - 0, 0); } 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 0acb027431..aa2e519588 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c @@ -73,8 +73,8 @@ static dri_bo *upload_default_color( struct brw_context *brw, COPY_4V(sdc.color, color); - return brw_cache_data( &brw->cache, BRW_SAMPLER_DEFAULT_COLOR, &sdc, - NULL, 0 ); + return brw_cache_data(&brw->cache, BRW_SAMPLER_DEFAULT_COLOR, + &sdc, sizeof(sdc), NULL, 0); } -- cgit v1.2.3 From 3105f3aa88e4b59eed3c7f175af77fbdb4af5924 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 6 Nov 2009 13:52:48 -0700 Subject: intel: better front color buffer test in intelClear() --- src/mesa/drivers/dri/intel/intel_clear.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_clear.c b/src/mesa/drivers/dri/intel/intel_clear.c index 1cf41ee6b8..f682ee3de5 100644 --- a/src/mesa/drivers/dri/intel/intel_clear.c +++ b/src/mesa/drivers/dri/intel/intel_clear.c @@ -33,7 +33,6 @@ #include "intel_context.h" #include "intel_blit.h" -#include "intel_buffers.h" #include "intel_chipset.h" #include "intel_clear.h" #include "intel_fbo.h" @@ -76,7 +75,9 @@ intelClear(GLcontext *ctx, GLbitfield mask) struct gl_framebuffer *fb = ctx->DrawBuffer; GLuint i; - intel_check_front_buffer_rendering(intel); + if (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_FRONT_RIGHT)) { + intel->front_buffer_dirty = GL_TRUE; + } if (0) fprintf(stderr, "%s\n", __FUNCTION__); -- cgit v1.2.3 From ee0a9e6e10060287747d9dd4afead3cbbb168e09 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 12 Jun 2009 12:37:25 -0700 Subject: mesa: Fix up the remove_dead_code pass to operate on a channel basis. This cleans up a bunch of instructions in GLSL programs to have limited writemasks, which would translate to wins in shaders that hit the i965 brw_wm_glsl.c path by depending less on in-driver optimizations. It will also help hit other optimization passes I'm looking at. --- src/mesa/shader/prog_optimize.c | 84 +++++++++++++++++++++++++++-------------- 1 file changed, 56 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c index 9d937488e3..e627715b5a 100644 --- a/src/mesa/shader/prog_optimize.c +++ b/src/mesa/shader/prog_optimize.c @@ -187,11 +187,10 @@ _mesa_consolidate_registers(struct gl_program *prog) static void _mesa_remove_dead_code(struct gl_program *prog) { - GLboolean tempWritten[MAX_PROGRAM_TEMPS], tempRead[MAX_PROGRAM_TEMPS]; + GLboolean tempRead[MAX_PROGRAM_TEMPS][4]; GLboolean *removeInst; /* per-instruction removal flag */ - GLuint i, rem; + GLuint i, rem = 0, comp; - memset(tempWritten, 0, sizeof(tempWritten)); memset(tempRead, 0, sizeof(tempRead)); if (dbg) { @@ -217,11 +216,27 @@ _mesa_remove_dead_code(struct gl_program *prog) if (inst->SrcReg[j].RelAddr) { if (dbg) _mesa_printf("abort remove dead code (indirect temp)\n"); - _mesa_free(removeInst); - return; + goto done; } - tempRead[index] = GL_TRUE; + for (comp = 0; comp < 4; comp++) { + GLuint swz = (inst->SrcReg[j].Swizzle >> (3 * comp)) & 0x7; + + switch (swz) { + case SWIZZLE_X: + tempRead[index][0] = GL_TRUE; + break; + case SWIZZLE_Y: + tempRead[index][1] = GL_TRUE; + break; + case SWIZZLE_Z: + tempRead[index][2] = GL_TRUE; + break; + case SWIZZLE_W: + tempRead[index][3] = GL_TRUE; + break; + } + } } } @@ -233,50 +248,63 @@ _mesa_remove_dead_code(struct gl_program *prog) if (inst->DstReg.RelAddr) { if (dbg) _mesa_printf("abort remove dead code (indirect temp)\n"); - _mesa_free(removeInst); - return; + goto done; } - tempWritten[index] = GL_TRUE; if (inst->CondUpdate) { /* If we're writing to this register and setting condition * codes we cannot remove the instruction. Prevent removal * by setting the 'read' flag. */ - tempRead[index] = GL_TRUE; + tempRead[index][0] = GL_TRUE; + tempRead[index][1] = GL_TRUE; + tempRead[index][2] = GL_TRUE; + tempRead[index][3] = GL_TRUE; } } } - if (dbg) { - for (i = 0; i < MAX_PROGRAM_TEMPS; i++) { - if (tempWritten[i] && !tempRead[i]) - _mesa_printf("Remove writes to tmp %u\n", i); - } - } - /* find instructions that write to dead registers, flag for removal */ for (i = 0; i < prog->NumInstructions; i++) { - const struct prog_instruction *inst = prog->Instructions + i; - if (inst->DstReg.File == PROGRAM_TEMPORARY) { - GLint index = inst->DstReg.Index; - removeInst[i] = (tempWritten[index] && !tempRead[index]); - if (dbg && removeInst[i]) { - _mesa_printf("Remove inst %u: ", i); - _mesa_print_instruction(inst); - } + struct prog_instruction *inst = prog->Instructions + i; + const GLuint numDst = _mesa_num_inst_dst_regs(inst->Opcode); + + if (numDst != 0 && inst->DstReg.File == PROGRAM_TEMPORARY) { + GLint chan, index = inst->DstReg.Index; + + for (chan = 0; chan < 4; chan++) { + if (!tempRead[index][chan] && + inst->DstReg.WriteMask & (1 << chan)) { + if (dbg) { + _mesa_printf("Remove writemask on %u.%c\n", i, + chan == 3 ? 'w' : 'x' + chan); + } + inst->DstReg.WriteMask &= ~(1 << chan); + rem++; + } + } + + if (inst->DstReg.WriteMask == 0) { + /* If we cleared all writes, the instruction can be removed. */ + if (dbg) + _mesa_printf("Remove instruction %u: \n", i); + removeInst[i] = GL_TRUE; + } } } /* now remove the instructions which aren't needed */ rem = remove_instructions(prog, removeInst); - _mesa_free(removeInst); - if (dbg) { - _mesa_printf("Optimize: End dead code removal. %u instructions removed\n", rem); + _mesa_printf("Optimize: End dead code removal.\n"); + _mesa_printf(" %u channel writes removed\n", rem); + _mesa_printf(" %u instructions removed\n", rem); /*_mesa_print_program(prog);*/ } + +done: + _mesa_free(removeInst); } -- cgit v1.2.3 From e4e312d493847e07ced026b93d2b588b8036ae02 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 16 May 2009 01:47:44 -0700 Subject: mesa: Add an optimization path to remove use of pointless MOVs. GLSL code such as: vec4 result = {0, 1, 0, 0}; gl_FragColor = result; emits code like: 0: MOV TEMP[0], CONST[0]; 1: MOV OUTPUT[1], TEMP[0]; and this replaces it with: 0: MOV TEMP[0], CONST[0]; 1: MOV OUTPUT[1], CONST[0]; Even when the dead code eliminator fails to clean up a now-useless MOV instruction (since it doesn't do live/dead ranges), this should at reduce dependencies. --- src/mesa/shader/prog_optimize.c | 84 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 83 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c index e627715b5a..5aff16be46 100644 --- a/src/mesa/shader/prog_optimize.c +++ b/src/mesa/shader/prog_optimize.c @@ -38,7 +38,6 @@ static GLboolean dbg = GL_FALSE; - /** * In 'prog' remove instruction[i] if removeFlags[i] == TRUE. * \return number of instructions removed @@ -354,6 +353,87 @@ find_next_temp_use(const struct gl_program *prog, GLuint start, GLuint index) } +/** + * Try to remove use of extraneous MOV instructions, to free them up for dead + * code removal. + */ +static void +_mesa_remove_extra_move_use(struct gl_program *prog) +{ + GLuint i; + + if (dbg) { + _mesa_printf("Optimize: Begin remove extra move use\n"); + _mesa_print_program(prog); + } + + /* + * Look for sequences such as this: + * MOV tmpX, arg0; + * FOO tmpY, tmpX, arg1; + * and convert into: + * MOV tmpX, arg0; + * FOO tmpY, arg0, arg1; + */ + + for (i = 0; i < prog->NumInstructions - 1; i++) { + const struct prog_instruction *mov = prog->Instructions + i; + struct prog_instruction *inst2 = prog->Instructions + i + 1; + int arg; + + if (mov->Opcode != OPCODE_MOV || + mov->DstReg.File != PROGRAM_TEMPORARY || + mov->DstReg.RelAddr || + mov->DstReg.CondMask != COND_TR || + mov->SaturateMode != SATURATE_OFF) + continue; + + for (arg = 0; arg < _mesa_num_inst_src_regs(inst2->Opcode); arg++) { + int comp; + + if (inst2->SrcReg[arg].File != mov->DstReg.File || + inst2->SrcReg[arg].Index != mov->DstReg.Index || + inst2->SrcReg[arg].RelAddr || + inst2->SrcReg[arg].Abs) + continue; + + /* Check that all the sources for this arg of inst2 come from inst1 + * or constants. + */ + for (comp = 0; comp < 4; comp++) { + int src_swz = GET_SWZ(inst2->SrcReg[arg].Swizzle, comp); + + /* If the MOV didn't write that channel, can't use it. */ + if (src_swz <= SWIZZLE_W && + (mov->DstReg.WriteMask & (1 << src_swz)) == 0) + break; + } + if (comp != 4) + continue; + + /* Adjust the swizzles of inst2 to point at MOV's source */ + for (comp = 0; comp < 4; comp++) { + int inst2_swz = GET_SWZ(inst2->SrcReg[arg].Swizzle, comp); + + if (inst2_swz <= SWIZZLE_W) { + GLuint s = GET_SWZ(mov->SrcReg[0].Swizzle, inst2_swz); + inst2->SrcReg[arg].Swizzle &= ~(7 << (3 * comp)); + inst2->SrcReg[arg].Swizzle |= s << (3 * comp); + inst2->SrcReg[arg].Negate ^= (((mov->SrcReg[0].Negate >> + inst2_swz) & 0x1) << comp); + } + } + inst2->SrcReg[arg].File = mov->SrcReg[0].File; + inst2->SrcReg[arg].Index = mov->SrcReg[0].Index; + } + } + + if (dbg) { + _mesa_printf("Optimize: End remove extra move use.\n"); + /*_mesa_print_program(prog);*/ + } +} + /** * Try to remove extraneous MOV instructions from the given program. */ @@ -851,6 +931,8 @@ _mesa_reallocate_registers(struct gl_program *prog) void _mesa_optimize_program(GLcontext *ctx, struct gl_program *program) { + _mesa_remove_extra_move_use(program); + if (1) _mesa_remove_dead_code(program); -- cgit v1.2.3 From f3cacfe216fb58b913bbc23de49d696a33da69e1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 6 Nov 2009 13:04:54 -0800 Subject: mesa: Fix remove_instructions to successfully remove when removeFlags[0]. This fixes the dead code elimination to work on the particular code mentioned in the previous commit. --- src/mesa/shader/prog_optimize.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c index 5aff16be46..b4658cb37f 100644 --- a/src/mesa/shader/prog_optimize.c +++ b/src/mesa/shader/prog_optimize.c @@ -73,6 +73,12 @@ remove_instructions(struct gl_program *prog, const GLboolean *removeFlags) } } } + /* Finish removing if the first instruction was to be removed. */ + if (removeCount > 0) { + GLint removeStart = removeEnd - removeCount + 1; + _mesa_delete_instructions(prog, removeStart, removeCount); + removeStart = removeCount = 0; /* reset removal info */ + } return totalRemoved; } -- cgit v1.2.3 From 6b0bcfafab7b380ee71da1a7754f4c09614811d6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 6 Nov 2009 14:06:08 -0800 Subject: mesa: Reduce the source channels considered in optimization passes. Depending on the writemask or the opcode, we can often trim the source channels considered used for dead code elimination. This saves actual instructions on 965 in the non-GLSL path for glean glsl1, and cleans up the writemasks of programs even further. --- src/mesa/shader/prog_optimize.c | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c index b4658cb37f..94d3dce6ea 100644 --- a/src/mesa/shader/prog_optimize.c +++ b/src/mesa/shader/prog_optimize.c @@ -38,6 +38,39 @@ static GLboolean dbg = GL_FALSE; +/* Returns the mask of channels read from the given srcreg in this instruction. + */ +static GLuint +get_src_arg_mask(const struct prog_instruction *inst, int arg) +{ + int writemask = inst->DstReg.WriteMask; + + if (inst->CondUpdate) + writemask = WRITEMASK_XYZW; + + switch (inst->Opcode) { + case OPCODE_MOV: + case OPCODE_ABS: + case OPCODE_ADD: + case OPCODE_MUL: + case OPCODE_SUB: + return writemask; + case OPCODE_RCP: + case OPCODE_SIN: + case OPCODE_COS: + case OPCODE_RSQ: + case OPCODE_POW: + case OPCODE_EX2: + return WRITEMASK_X; + case OPCODE_DP2: + return WRITEMASK_XY; + case OPCODE_DP3: + return WRITEMASK_XYZ; + default: + return WRITEMASK_XYZW; + } +} + /** * In 'prog' remove instruction[i] if removeFlags[i] == TRUE. * \return number of instructions removed @@ -217,6 +250,7 @@ _mesa_remove_dead_code(struct gl_program *prog) if (inst->SrcReg[j].File == PROGRAM_TEMPORARY) { const GLuint index = inst->SrcReg[j].Index; ASSERT(index < MAX_PROGRAM_TEMPS); + int read_mask = get_src_arg_mask(inst, j); if (inst->SrcReg[j].RelAddr) { if (dbg) @@ -227,6 +261,9 @@ _mesa_remove_dead_code(struct gl_program *prog) for (comp = 0; comp < 4; comp++) { GLuint swz = (inst->SrcReg[j].Swizzle >> (3 * comp)) & 0x7; + if ((read_mask & (1 << comp)) == 0) + continue; + switch (swz) { case SWIZZLE_X: tempRead[index][0] = GL_TRUE; @@ -396,6 +433,7 @@ _mesa_remove_extra_move_use(struct gl_program *prog) for (arg = 0; arg < _mesa_num_inst_src_regs(inst2->Opcode); arg++) { int comp; + int read_mask = get_src_arg_mask(inst2, arg); if (inst2->SrcReg[arg].File != mov->DstReg.File || inst2->SrcReg[arg].Index != mov->DstReg.Index || @@ -410,7 +448,8 @@ _mesa_remove_extra_move_use(struct gl_program *prog) int src_swz = GET_SWZ(inst2->SrcReg[arg].Swizzle, comp); /* If the MOV didn't write that channel, can't use it. */ - if (src_swz <= SWIZZLE_W && + if ((read_mask & (1 << comp)) && + src_swz <= SWIZZLE_W && (mov->DstReg.WriteMask & (1 << src_swz)) == 0) break; } -- cgit v1.2.3 From 26d2ce0a09f1aac628519cf3473fcabd3f149446 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Fri, 6 Nov 2009 14:52:49 -0800 Subject: GLX: Change GLX client vendor string to "Mesa Project and SGI" This change allows a certain closed-source browser plug-in to work with open-source drivers. --- src/glx/x11/glxcmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/glx/x11/glxcmds.c b/src/glx/x11/glxcmds.c index c63116bab7..daa9076471 100644 --- a/src/glx/x11/glxcmds.c +++ b/src/glx/x11/glxcmds.c @@ -50,7 +50,7 @@ #include #endif -static const char __glXGLXClientVendorName[] = "SGI"; +static const char __glXGLXClientVendorName[] = "Mesa Project and SGI"; static const char __glXGLXClientVersion[] = "1.4"; -- cgit v1.2.3 From 6c44d399bd23e734f2302897ee74e4869ff33816 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Fri, 6 Nov 2009 00:37:37 -0500 Subject: st/xorg: make the buffer size global --- src/gallium/state_trackers/xorg/xorg_renderer.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h index f92f186eb6..c556028b48 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.h +++ b/src/gallium/state_trackers/xorg/xorg_renderer.h @@ -7,6 +7,14 @@ struct xorg_shaders; struct exa_pixmap_priv; +/* max number of vertices * + * max number of attributes per vertex * + * max number of components per attribute + * + * currently the max is 5 quads + */ +#define BUF_SIZE (20 * 3 * 4) + struct xorg_renderer { struct pipe_context *pipe; @@ -16,7 +24,7 @@ struct xorg_renderer { struct pipe_constant_buffer vs_const_buffer; struct pipe_constant_buffer fs_const_buffer; - float vertices[4*3*4]; + float vertices[BUF_SIZE]; }; struct xorg_renderer *renderer_create(struct pipe_context *pipe); -- cgit v1.2.3 From 3f7df23ff50fc7cd86db9a27c11cca9c10bd63eb Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Fri, 6 Nov 2009 04:23:33 -0500 Subject: st/xorg: use quads instead of triangle fans easier to split, accumulate and batch those --- src/gallium/state_trackers/xorg/xorg_renderer.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index c11f250e69..42fd7304a2 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -629,7 +629,7 @@ static void renderer_copy_texture(struct xorg_renderer *r, if (buf) { util_draw_vertex_buffer(r->pipe, buf, 0, - PIPE_PRIM_TRIANGLE_FAN, + PIPE_PRIM_QUADS, 4, /* verts */ 2); /* attribs/vert */ @@ -812,7 +812,7 @@ void renderer_draw_solid_rect(struct xorg_renderer *r, if (buf) { util_draw_vertex_buffer(pipe, buf, 0, - PIPE_PRIM_TRIANGLE_FAN, + PIPE_PRIM_QUADS, 4, /* verts */ 2); /* attribs/vert */ @@ -873,7 +873,7 @@ void renderer_draw_textures(struct xorg_renderer *r, num_attribs += num_textures; util_draw_vertex_buffer(pipe, buf, 0, - PIPE_PRIM_TRIANGLE_FAN, + PIPE_PRIM_QUADS, 4, /* verts */ num_attribs); /* attribs/vert */ @@ -898,7 +898,7 @@ void renderer_draw_yuv(struct xorg_renderer *r, const int num_attribs = 2; /*pos + tex coord*/ util_draw_vertex_buffer(pipe, buf, 0, - PIPE_PRIM_TRIANGLE_FAN, + PIPE_PRIM_QUADS, 4, /* verts */ num_attribs); /* attribs/vert */ -- cgit v1.2.3 From e1730632aa5ca1dbb0edd484e2357246ec537abb Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Fri, 6 Nov 2009 05:30:53 -0500 Subject: st/xorg: start accumulating vertices in a common buffer --- src/gallium/state_trackers/xorg/xorg_renderer.c | 128 +++++++++++++++--------- src/gallium/state_trackers/xorg/xorg_renderer.h | 8 ++ 2 files changed, 88 insertions(+), 48 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 42fd7304a2..08aaef7735 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -44,6 +44,19 @@ static INLINE void map_point(float *mat, float x, float y, } } +static INLINE struct pipe_buffer * +renderer_buffer_create(struct xorg_renderer *r) +{ + struct pipe_buffer *buf = + pipe_user_buffer_create(r->pipe->screen, + r->vertices, + sizeof(float)* + r->num_vertices); + r->num_vertices = 0; + + return buf; +} + static void renderer_init_state(struct xorg_renderer *r) { @@ -56,9 +69,12 @@ renderer_init_state(struct xorg_renderer *r) static INLINE void -setup_vertex0(float *vertex, float x, float y, - float color[4]) +add_vertex_color(struct xorg_renderer *r, + float x, float y, + float color[4]) { + float *vertex = r->vertices + r->num_vertices; + vertex[0] = x; vertex[1] = y; vertex[2] = 0.f; /*z*/ @@ -68,11 +84,16 @@ setup_vertex0(float *vertex, float x, float y, vertex[5] = color[1]; /*g*/ vertex[6] = color[2]; /*b*/ vertex[7] = color[3]; /*a*/ + + r->num_vertices += 8; } static INLINE void -setup_vertex1(float *vertex, float x, float y, float s, float t) +add_vertex_1tex(struct xorg_renderer *r, + float x, float y, float s, float t) { + float *vertex = r->vertices + r->num_vertices; + vertex[0] = x; vertex[1] = y; vertex[2] = 0.f; /*z*/ @@ -82,6 +103,8 @@ setup_vertex1(float *vertex, float x, float y, float s, float t) vertex[5] = t; /*t*/ vertex[6] = 0.f; /*r*/ vertex[7] = 1.f; /*q*/ + + r->num_vertices += 8; } static struct pipe_buffer * @@ -109,17 +132,15 @@ setup_vertex_data1(struct xorg_renderer *r, t1 = pt1[1] / src->height[0]; /* 1st vertex */ - setup_vertex1(r->vertices, dstX, dstY, s0, t0); + add_vertex_1tex(r, dstX, dstY, s0, t0); /* 2nd vertex */ - setup_vertex1(r->vertices + 2*4, dstX + width, dstY, s1, t0); + add_vertex_1tex(r, dstX + width, dstY, s1, t0); /* 3rd vertex */ - setup_vertex1(r->vertices + 4*4, dstX + width, dstY + height, s1, t1); + add_vertex_1tex(r, dstX + width, dstY + height, s1, t1); /* 4th vertex */ - setup_vertex1(r->vertices + 6*4, dstX, dstY + height, s0, t1); + add_vertex_1tex(r, dstX, dstY + height, s0, t1); - return pipe_user_buffer_create(r->pipe->screen, - r->vertices, - sizeof(float)*8*4); + return renderer_buffer_create(r); } static struct pipe_buffer * @@ -129,23 +150,24 @@ setup_vertex_data_tex(struct xorg_renderer *r, float z) { /* 1st vertex */ - setup_vertex1(r->vertices, x0, y0, s0, t0); + add_vertex_1tex(r, x0, y0, s0, t0); /* 2nd vertex */ - setup_vertex1(r->vertices + 2*4, x1, y0, s1, t0); + add_vertex_1tex(r, x1, y0, s1, t0); /* 3rd vertex */ - setup_vertex1(r->vertices + 4*4, x1, y1, s1, t1); + add_vertex_1tex(r, x1, y1, s1, t1); /* 4th vertex */ - setup_vertex1(r->vertices + 6*4, x0, y1, s0, t1); + add_vertex_1tex(r, x0, y1, s0, t1); - return pipe_user_buffer_create(r->pipe->screen, - r->vertices, - sizeof(float)*8*4); + return renderer_buffer_create(r); } static INLINE void -setup_vertex2(float *vertex, float x, float y, - float s0, float t0, float s1, float t1) +add_vertex_2tex(struct xorg_renderer *r, + float x, float y, + float s0, float t0, float s1, float t1) { + float *vertex = r->vertices + r->num_vertices; + vertex[0] = x; vertex[1] = y; vertex[2] = 0.f; /*z*/ @@ -160,6 +182,8 @@ setup_vertex2(float *vertex, float x, float y, vertex[9] = t1; /*t*/ vertex[10] = 0.f; /*r*/ vertex[11] = 1.f; /*q*/ + + r->num_vertices += 12; } static struct pipe_buffer * @@ -206,22 +230,20 @@ setup_vertex_data2(struct xorg_renderer *r, mask_t1 = mpt1[1] / mask->height[0]; /* 1st vertex */ - setup_vertex2(r->vertices, dstX, dstY, - src_s0, src_t0, mask_s0, mask_t0); + add_vertex_2tex(r, dstX, dstY, + src_s0, src_t0, mask_s0, mask_t0); /* 2nd vertex */ - setup_vertex2(r->vertices + 3*4, dstX + width, dstY, - src_s1, src_t0, mask_s1, mask_t0); + add_vertex_2tex(r, dstX + width, dstY, + src_s1, src_t0, mask_s1, mask_t0); /* 3rd vertex */ - setup_vertex2(r->vertices + 6*4, dstX + width, dstY + height, - src_s1, src_t1, mask_s1, mask_t1); + add_vertex_2tex(r, dstX + width, dstY + height, + src_s1, src_t1, mask_s1, mask_t1); /* 4th vertex */ - setup_vertex2(r->vertices + 9*4, dstX, dstY + height, - src_s0, src_t1, mask_s0, mask_t1); + add_vertex_2tex(r, dstX, dstY + height, + src_s0, src_t1, mask_s0, mask_t1); - return pipe_user_buffer_create(r->pipe->screen, - r->vertices, - sizeof(float)*12*4); + return renderer_buffer_create(r); } static struct pipe_buffer * @@ -244,21 +266,18 @@ setup_vertex_data_yuv(struct xorg_renderer *r, t1 = spt1[1] / tex[0]->height[0]; /* 1st vertex */ - setup_vertex1(r->vertices, dstX, dstY, s0, t0); + add_vertex_1tex(r, dstX, dstY, s0, t0); /* 2nd vertex */ - setup_vertex1(r->vertices + 2*4, dstX + dstW, dstY, - s1, t0); + add_vertex_1tex(r, dstX + dstW, dstY, + s1, t0); /* 3rd vertex */ - setup_vertex1(r->vertices + 4*4, dstX + dstW, dstY + dstH, - s1, t1); + add_vertex_1tex(r, dstX + dstW, dstY + dstH, + s1, t1); /* 4th vertex */ - setup_vertex1(r->vertices + 6*4, dstX, dstY + dstH, - s0, t1); - + add_vertex_1tex(r, dstX, dstY + dstH, + s0, t1); - return pipe_user_buffer_create(r->pipe->screen, - r->vertices, - sizeof(float)*8*4); + return renderer_buffer_create(r); } @@ -797,17 +816,15 @@ void renderer_draw_solid_rect(struct xorg_renderer *r, debug_printf("solid rect[(%d, %d), (%d, %d)], rgba[%f, %f, %f, %f]\n", x0, y0, x1, y1, color[0], color[1], color[2], color[3]);*/ /* 1st vertex */ - setup_vertex0(r->vertices, x0, y0, color); + add_vertex_color(r, x0, y0, color); /* 2nd vertex */ - setup_vertex0(r->vertices + 2*4, x1, y0, color); + add_vertex_color(r, x1, y0, color); /* 3rd vertex */ - setup_vertex0(r->vertices + 4*4, x1, y1, color); + add_vertex_color(r, x1, y1, color); /* 4th vertex */ - setup_vertex0(r->vertices + 6*4, x0, y1, color); + add_vertex_color(r, x0, y1, color); - buf = pipe_user_buffer_create(pipe->screen, - r->vertices, - sizeof(float)*8*4); + buf = renderer_buffer_create(r); if (buf) { @@ -905,3 +922,18 @@ void renderer_draw_yuv(struct xorg_renderer *r, pipe_buffer_reference(&buf, NULL); } } + +void renderer_begin_solid(struct xorg_renderer *r, + float *color) +{ +} + +void renderer_solid(struct xorg_renderer *r, + int x0, int y0, + int x1, int y1) +{ +} + +void renderer_end_solid(struct xorg_renderer *r) +{ +} diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h index c556028b48..9ab554f63f 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.h +++ b/src/gallium/state_trackers/xorg/xorg_renderer.h @@ -25,6 +25,7 @@ struct xorg_renderer { struct pipe_constant_buffer fs_const_buffer; float vertices[BUF_SIZE]; + int num_vertices; }; struct xorg_renderer *renderer_create(struct pipe_context *pipe); @@ -62,5 +63,12 @@ void renderer_draw_yuv(struct xorg_renderer *r, int dst_x, int dst_y, int dst_w, int dst_h, struct pipe_texture **textures); +void renderer_begin_solid(struct xorg_renderer *r, + float *color); +void renderer_solid(struct xorg_renderer *r, + int x0, int y0, + int x1, int y1); +void renderer_end_solid(struct xorg_renderer *r); + #endif -- cgit v1.2.3 From 4322346f3fd03788a79d056ca7bce2db25bc9d88 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Fri, 6 Nov 2009 07:36:47 -0500 Subject: st/xorg: batch solid fill requests instead of lots of very small transfers, one larger is a lot better for performance --- src/gallium/state_trackers/xorg/xorg_composite.c | 14 ++-- src/gallium/state_trackers/xorg/xorg_exa.c | 46 +------------ src/gallium/state_trackers/xorg/xorg_renderer.c | 88 ++++++++++++++---------- src/gallium/state_trackers/xorg/xorg_renderer.h | 13 ++-- 4 files changed, 66 insertions(+), 95 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index a8d779b8ad..93fcdaf44d 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -440,9 +440,11 @@ void xorg_composite(struct exa_context *exa, int dstX, int dstY, int width, int height) { if (exa->num_bound_samplers == 0 ) { /* solid fill */ - renderer_draw_solid_rect(exa->renderer, - dstX, dstY, dstX + width, dstY + height, - exa->solid_color); + renderer_begin_solid(exa->renderer); + renderer_solid(exa->renderer, + dstX, dstY, dstX + width, dstY + height, + exa->solid_color); + renderer_draw_flush(exa->renderer); } else { int pos[6] = {srcX, srcY, maskX, maskY, dstX, dstY}; float *src_matrix = NULL; @@ -492,6 +494,8 @@ boolean xorg_solid_bind_state(struct exa_context *exa, cso_set_vertex_shader_handle(exa->renderer->cso, shader.vs); cso_set_fragment_shader_handle(exa->renderer->cso, shader.fs); + renderer_begin_solid(exa->renderer); + return TRUE; } @@ -499,7 +503,7 @@ void xorg_solid(struct exa_context *exa, struct exa_pixmap_priv *pixmap, int x0, int y0, int x1, int y1) { - renderer_draw_solid_rect(exa->renderer, - x0, y0, x1, y1, exa->solid_color); + renderer_solid(exa->renderer, + x0, y0, x1, y1, exa->solid_color); } diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index bd97baae2b..99362e01f2 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -46,7 +46,6 @@ #include "util/u_rect.h" #define DEBUG_PRINT 0 -#define DEBUG_SOLID 0 #define ACCEL_ENABLED TRUE /* @@ -277,6 +276,8 @@ ExaDone(PixmapPtr pPixmap) if (!priv) return; + renderer_draw_flush(exa->renderer); + xorg_exa_common_done(exa); } @@ -319,10 +320,6 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) XORG_FALLBACK("format %s", pf_name(priv->tex->format)); } -#if DEBUG_SOLID - fg = 0xffff0000; -#endif - return ACCEL_ENABLED && xorg_solid_bind_state(exa, priv, fg); } @@ -338,46 +335,7 @@ ExaSolid(PixmapPtr pPixmap, int x0, int y0, int x1, int y1) debug_printf("\tExaSolid(%d, %d, %d, %d)\n", x0, y0, x1, y1); #endif -#if 0 - if (x0 == 0 && y0 == 0 && - x1 == priv->tex->width[0] && - y1 == priv->tex->height[0]) { - exa->ctx->clear(exa->pipe, PIPE_CLEAR_COLOR, - exa->solid_color, 1., 0); - } else -#endif - -#if DEBUG_SOLID - exa->solid_color[0] = 0.f; - exa->solid_color[1] = 1.f; - exa->solid_color[2] = 0.f; - exa->solid_color[3] = 1.f; - xorg_solid(exa, priv, 0, 0, 1024, 768); - exa->solid_color[0] = 1.f; - exa->solid_color[1] = 0.f; - exa->solid_color[2] = 0.f; - exa->solid_color[3] = 1.f; - xorg_solid(exa, priv, 0, 0, 300, 300); - xorg_solid(exa, priv, 300, 300, 350, 350); - xorg_solid(exa, priv, 350, 350, 500, 500); - - xorg_solid(exa, priv, - priv->tex->width[0] - 10, - priv->tex->height[0] - 10, - priv->tex->width[0], - priv->tex->height[0]); - - exa->solid_color[0] = 0.f; - exa->solid_color[1] = 0.f; - exa->solid_color[2] = 1.f; - exa->solid_color[3] = 1.f; - - exa->has_solid_color = FALSE; - ExaPrepareCopy(pPixmap, pPixmap, 0, 0, GXcopy, 0xffffffff); - ExaCopy(pPixmap, 0, 0, 50, 50, 500, 500); -#else xorg_solid(exa, priv, x0, y0, x1, y1) ; -#endif } static Bool diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 08aaef7735..52cde5428b 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -57,6 +57,37 @@ renderer_buffer_create(struct xorg_renderer *r) return buf; } +static INLINE void +renderer_draw(struct xorg_renderer *r) +{ + struct pipe_context *pipe = r->pipe; + struct pipe_buffer *buf = 0; + + if (!r->num_vertices) + return; + + buf = renderer_buffer_create(r); + + + if (buf) { + util_draw_vertex_buffer(pipe, buf, 0, + PIPE_PRIM_QUADS, + 4, /* verts */ + 2); /* attribs/vert */ + + pipe_buffer_reference(&buf, NULL); + } +} + +static INLINE void +renderer_draw_conditional(struct xorg_renderer *r, + int next_batch) +{ + if (r->num_vertices + next_batch >= BUF_SIZE || + (next_batch == 0 && r->num_vertices)) + renderer_draw(r); +} + static void renderer_init_state(struct xorg_renderer *r) { @@ -804,39 +835,6 @@ void renderer_copy_pixmap(struct xorg_renderer *r, } } -void renderer_draw_solid_rect(struct xorg_renderer *r, - int x0, int y0, - int x1, int y1, - float *color) -{ - struct pipe_context *pipe = r->pipe; - struct pipe_buffer *buf = 0; - - /* - debug_printf("solid rect[(%d, %d), (%d, %d)], rgba[%f, %f, %f, %f]\n", - x0, y0, x1, y1, color[0], color[1], color[2], color[3]);*/ - /* 1st vertex */ - add_vertex_color(r, x0, y0, color); - /* 2nd vertex */ - add_vertex_color(r, x1, y0, color); - /* 3rd vertex */ - add_vertex_color(r, x1, y1, color); - /* 4th vertex */ - add_vertex_color(r, x0, y1, color); - - buf = renderer_buffer_create(r); - - - if (buf) { - util_draw_vertex_buffer(pipe, buf, 0, - PIPE_PRIM_QUADS, - 4, /* verts */ - 2); /* attribs/vert */ - - pipe_buffer_reference(&buf, NULL); - } -} - void renderer_draw_textures(struct xorg_renderer *r, int *pos, int width, int height, @@ -923,17 +921,33 @@ void renderer_draw_yuv(struct xorg_renderer *r, } } -void renderer_begin_solid(struct xorg_renderer *r, - float *color) +void renderer_begin_solid(struct xorg_renderer *r) { + r->num_vertices = 0; } void renderer_solid(struct xorg_renderer *r, int x0, int y0, - int x1, int y1) + int x1, int y1, + float *color) { + /* + debug_printf("solid rect[(%d, %d), (%d, %d)], rgba[%f, %f, %f, %f]\n", + x0, y0, x1, y1, color[0], color[1], color[2], color[3]);*/ + + renderer_draw_conditional(r, 4 * 8); + + /* 1st vertex */ + add_vertex_color(r, x0, y0, color); + /* 2nd vertex */ + add_vertex_color(r, x1, y0, color); + /* 3rd vertex */ + add_vertex_color(r, x1, y1, color); + /* 4th vertex */ + add_vertex_color(r, x0, y1, color); } -void renderer_end_solid(struct xorg_renderer *r) +void renderer_draw_flush(struct xorg_renderer *r) { + renderer_draw_conditional(r, 0); } diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h index 9ab554f63f..2f85a8860b 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.h +++ b/src/gallium/state_trackers/xorg/xorg_renderer.h @@ -45,11 +45,6 @@ void renderer_copy_pixmap(struct xorg_renderer *r, struct exa_pixmap_priv *src_priv, int sx, int sy, int width, int height); -void renderer_draw_solid_rect(struct xorg_renderer *r, - int x0, int y0, - int x1, int y1, - float *color); - void renderer_draw_textures(struct xorg_renderer *r, int *pos, int width, int height, @@ -63,12 +58,12 @@ void renderer_draw_yuv(struct xorg_renderer *r, int dst_x, int dst_y, int dst_w, int dst_h, struct pipe_texture **textures); -void renderer_begin_solid(struct xorg_renderer *r, - float *color); +void renderer_begin_solid(struct xorg_renderer *r); void renderer_solid(struct xorg_renderer *r, int x0, int y0, - int x1, int y1); -void renderer_end_solid(struct xorg_renderer *r); + int x1, int y1, + float *color); +void renderer_draw_flush(struct xorg_renderer *r); #endif -- cgit v1.2.3 From e521bf7706a5527ad5750baef78feaa961f73ecc Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Fri, 6 Nov 2009 08:31:16 -0500 Subject: st/xorg: implement batching for the composite op something is broken so disabled for now --- src/gallium/state_trackers/xorg/xorg_composite.c | 18 +- src/gallium/state_trackers/xorg/xorg_exa.c | 4 +- src/gallium/state_trackers/xorg/xorg_renderer.c | 200 ++++++++++++++--------- src/gallium/state_trackers/xorg/xorg_renderer.h | 29 +++- 4 files changed, 161 insertions(+), 90 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 93fcdaf44d..8947d0a67c 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -431,6 +431,14 @@ boolean xorg_composite_bind_state(struct exa_context *exa, setup_transforms(exa, pSrcPicture, pMaskPicture); + if (exa->num_bound_samplers == 0 ) { /* solid fill */ + renderer_begin_solid(exa->renderer); + } else { + renderer_begin_textures(exa->renderer, + exa->bound_textures, + exa->num_bound_samplers); + } + return TRUE; } @@ -440,11 +448,9 @@ void xorg_composite(struct exa_context *exa, int dstX, int dstY, int width, int height) { if (exa->num_bound_samplers == 0 ) { /* solid fill */ - renderer_begin_solid(exa->renderer); renderer_solid(exa->renderer, dstX, dstY, dstX + width, dstY + height, exa->solid_color); - renderer_draw_flush(exa->renderer); } else { int pos[6] = {srcX, srcY, maskX, maskY, dstX, dstY}; float *src_matrix = NULL; @@ -455,11 +461,19 @@ void xorg_composite(struct exa_context *exa, if (exa->transform.has_mask) mask_matrix = exa->transform.mask; +#if 1 renderer_draw_textures(exa->renderer, pos, width, height, exa->bound_textures, exa->num_bound_samplers, src_matrix, mask_matrix); +#else + renderer_texture(exa->renderer, + pos, width, height, + exa->bound_textures, + exa->num_bound_samplers, + src_matrix, mask_matrix); +#endif } } diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 99362e01f2..20cfa25d97 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -89,6 +89,8 @@ exa_get_pipe_format(int depth, enum pipe_format *format, int *bbp) static void xorg_exa_common_done(struct exa_context *exa) { + renderer_draw_flush(exa->renderer); + exa->copy.src = NULL; exa->copy.dst = NULL; exa->transform.has_src = FALSE; @@ -276,8 +278,6 @@ ExaDone(PixmapPtr pPixmap) if (!priv) return; - renderer_draw_flush(exa->renderer); - xorg_exa_common_done(exa); } diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 52cde5428b..947f4ca531 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -73,7 +73,7 @@ renderer_draw(struct xorg_renderer *r) util_draw_vertex_buffer(pipe, buf, 0, PIPE_PRIM_QUADS, 4, /* verts */ - 2); /* attribs/vert */ + r->num_attributes); /* attribs/vert */ pipe_buffer_reference(&buf, NULL); } @@ -138,11 +138,11 @@ add_vertex_1tex(struct xorg_renderer *r, r->num_vertices += 8; } -static struct pipe_buffer * -setup_vertex_data1(struct xorg_renderer *r, - float srcX, float srcY, float dstX, float dstY, - float width, float height, - struct pipe_texture *src, float *src_matrix) +static void +add_vertex_data1(struct xorg_renderer *r, + float srcX, float srcY, float dstX, float dstY, + float width, float height, + struct pipe_texture *src, float *src_matrix) { float s0, t0, s1, t1; float pt0[2], pt1[2]; @@ -170,8 +170,6 @@ setup_vertex_data1(struct xorg_renderer *r, add_vertex_1tex(r, dstX + width, dstY + height, s1, t1); /* 4th vertex */ add_vertex_1tex(r, dstX, dstY + height, s0, t1); - - return renderer_buffer_create(r); } static struct pipe_buffer * @@ -217,13 +215,13 @@ add_vertex_2tex(struct xorg_renderer *r, r->num_vertices += 12; } -static struct pipe_buffer * -setup_vertex_data2(struct xorg_renderer *r, - float srcX, float srcY, float maskX, float maskY, - float dstX, float dstY, float width, float height, - struct pipe_texture *src, - struct pipe_texture *mask, - float *src_matrix, float *mask_matrix) +static void +add_vertex_data2(struct xorg_renderer *r, + float srcX, float srcY, float maskX, float maskY, + float dstX, float dstY, float width, float height, + struct pipe_texture *src, + struct pipe_texture *mask, + float *src_matrix, float *mask_matrix) { float src_s0, src_t0, src_s1, src_t1; float mask_s0, mask_t0, mask_s1, mask_t1; @@ -272,9 +270,6 @@ setup_vertex_data2(struct xorg_renderer *r, /* 4th vertex */ add_vertex_2tex(r, dstX, dstY + height, src_s0, src_t1, mask_s0, mask_t1); - - - return renderer_buffer_create(r); } static struct pipe_buffer * @@ -835,67 +830,6 @@ void renderer_copy_pixmap(struct xorg_renderer *r, } } -void renderer_draw_textures(struct xorg_renderer *r, - int *pos, - int width, int height, - struct pipe_texture **textures, - int num_textures, - float *src_matrix, float *mask_matrix) -{ - struct pipe_context *pipe = r->pipe; - struct pipe_buffer *buf = 0; - -#if 0 - if (src_matrix) { - debug_printf("src_matrix = \n"); - debug_printf("%f, %f, %f\n", src_matrix[0], src_matrix[1], src_matrix[2]); - debug_printf("%f, %f, %f\n", src_matrix[3], src_matrix[4], src_matrix[5]); - debug_printf("%f, %f, %f\n", src_matrix[6], src_matrix[7], src_matrix[8]); - } - if (mask_matrix) { - debug_printf("mask_matrix = \n"); - debug_printf("%f, %f, %f\n", mask_matrix[0], mask_matrix[1], mask_matrix[2]); - debug_printf("%f, %f, %f\n", mask_matrix[3], mask_matrix[4], mask_matrix[5]); - debug_printf("%f, %f, %f\n", mask_matrix[6], mask_matrix[7], mask_matrix[8]); - } -#endif - - switch(num_textures) { - case 1: - buf = setup_vertex_data1(r, - pos[0], pos[1], /* src */ - pos[4], pos[5], /* dst */ - width, height, - textures[0], src_matrix); - break; - case 2: - buf = setup_vertex_data2(r, - pos[0], pos[1], /* src */ - pos[2], pos[3], /* mask */ - pos[4], pos[5], /* dst */ - width, height, - textures[0], textures[1], - src_matrix, mask_matrix); - break; - case 3: - default: - debug_assert(!"Unsupported number of textures"); - break; - } - - if (buf) { - int num_attribs = 1; /*pos*/ - num_attribs += num_textures; - - util_draw_vertex_buffer(pipe, buf, 0, - PIPE_PRIM_QUADS, - 4, /* verts */ - num_attribs); /* attribs/vert */ - - pipe_buffer_reference(&buf, NULL); - } -} - void renderer_draw_yuv(struct xorg_renderer *r, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, @@ -924,6 +858,7 @@ void renderer_draw_yuv(struct xorg_renderer *r, void renderer_begin_solid(struct xorg_renderer *r) { r->num_vertices = 0; + r->num_attributes = 2; } void renderer_solid(struct xorg_renderer *r, @@ -951,3 +886,110 @@ void renderer_draw_flush(struct xorg_renderer *r) { renderer_draw_conditional(r, 0); } + +void renderer_begin_textures(struct xorg_renderer *r, + struct pipe_texture **textures, + int num_textures) +{ + r->num_attributes = 1 + num_textures; +} + +void renderer_texture(struct xorg_renderer *r, + int *pos, + int width, int height, + struct pipe_texture **textures, + int num_textures, + float *src_matrix, + float *mask_matrix) +{ + +#if 0 + if (src_matrix) { + debug_printf("src_matrix = \n"); + debug_printf("%f, %f, %f\n", src_matrix[0], src_matrix[1], src_matrix[2]); + debug_printf("%f, %f, %f\n", src_matrix[3], src_matrix[4], src_matrix[5]); + debug_printf("%f, %f, %f\n", src_matrix[6], src_matrix[7], src_matrix[8]); + } + if (mask_matrix) { + debug_printf("mask_matrix = \n"); + debug_printf("%f, %f, %f\n", mask_matrix[0], mask_matrix[1], mask_matrix[2]); + debug_printf("%f, %f, %f\n", mask_matrix[3], mask_matrix[4], mask_matrix[5]); + debug_printf("%f, %f, %f\n", mask_matrix[6], mask_matrix[7], mask_matrix[8]); + } +#endif + + switch(r->num_attributes) { + case 2: + renderer_draw_conditional(r, 4 * 8); + add_vertex_data1(r, + pos[0], pos[1], /* src */ + pos[4], pos[5], /* dst */ + width, height, + textures[0], src_matrix); + break; + case 3: + renderer_draw_conditional(r, 4 * 12); + add_vertex_data2(r, + pos[0], pos[1], /* src */ + pos[2], pos[3], /* mask */ + pos[4], pos[5], /* dst */ + width, height, + textures[0], textures[1], + src_matrix, mask_matrix); + break; + default: + debug_assert(!"Unsupported number of textures"); + break; + } +} + + +void renderer_draw_textures(struct xorg_renderer *r, + int *pos, + int width, int height, + struct pipe_texture **textures, + int num_textures, + float *src_matrix, float *mask_matrix) +{ +#if 0 + if (src_matrix) { + debug_printf("src_matrix = \n"); + debug_printf("%f, %f, %f\n", src_matrix[0], src_matrix[1], src_matrix[2]); + debug_printf("%f, %f, %f\n", src_matrix[3], src_matrix[4], src_matrix[5]); + debug_printf("%f, %f, %f\n", src_matrix[6], src_matrix[7], src_matrix[8]); + } + if (mask_matrix) { + debug_printf("mask_matrix = \n"); + debug_printf("%f, %f, %f\n", mask_matrix[0], mask_matrix[1], mask_matrix[2]); + debug_printf("%f, %f, %f\n", mask_matrix[3], mask_matrix[4], mask_matrix[5]); + debug_printf("%f, %f, %f\n", mask_matrix[6], mask_matrix[7], mask_matrix[8]); + } +#endif + + r->num_attributes = 1 + num_textures; + switch(num_textures) { + case 1: + add_vertex_data1(r, + pos[0], pos[1], /* src */ + pos[4], pos[5], /* dst */ + width, height, + textures[0], src_matrix); + break; + case 2: + add_vertex_data2(r, + pos[0], pos[1], /* src */ + pos[2], pos[3], /* mask */ + pos[4], pos[5], /* dst */ + width, height, + textures[0], textures[1], + src_matrix, mask_matrix); + break; + case 3: + default: + debug_assert(!"Unsupported number of textures"); + break; + } + + renderer_draw(r); +} + diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h index 2f85a8860b..780d97fe85 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.h +++ b/src/gallium/state_trackers/xorg/xorg_renderer.h @@ -26,6 +26,8 @@ struct xorg_renderer { float vertices[BUF_SIZE]; int num_vertices; + + int num_attributes; }; struct xorg_renderer *renderer_create(struct pipe_context *pipe); @@ -45,13 +47,6 @@ void renderer_copy_pixmap(struct xorg_renderer *r, struct exa_pixmap_priv *src_priv, int sx, int sy, int width, int height); -void renderer_draw_textures(struct xorg_renderer *r, - int *pos, - int width, int height, - struct pipe_texture **textures, - int num_textures, - float *src_matrix, - float *mask_matrix); void renderer_draw_yuv(struct xorg_renderer *r, int src_x, int src_y, int src_w, int src_h, @@ -64,6 +59,26 @@ void renderer_solid(struct xorg_renderer *r, int x1, int y1, float *color); +void renderer_begin_textures(struct xorg_renderer *r, + struct pipe_texture **textures, + int num_textures); +void renderer_texture(struct xorg_renderer *r, + int *pos, + int width, int height, + struct pipe_texture **textures, + int num_textures, + float *src_matrix, + float *mask_matrix); + void renderer_draw_flush(struct xorg_renderer *r); + +void renderer_draw_textures(struct xorg_renderer *r, + int *pos, + int width, int height, + struct pipe_texture **textures, + int num_textures, + float *src_matrix, float *mask_matrix); + + #endif -- cgit v1.2.3 From 0f34cdf6210b748db77c5eba2993637f4af6faeb Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 12 Aug 2009 12:56:35 -0700 Subject: i965: Collect GLSL src/dst regs up in generic code. This matches brw_wm_emit.c, which we'll be using shortly. There's a possible penalty here in that we'll allocate registers for unused channels, since we aren't doing ref tracking like brw_wm_pass*.c does. However, my measurements on GM965 don't show any for either OA or UT2004 with the GLSL path forced. --- src/mesa/drivers/dri/i965/brw_wm.h | 2 ++ src/mesa/drivers/dri/i965/brw_wm_glsl.c | 22 +++++++++++++++------- 2 files changed, 17 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 47aa4da306..f841d25870 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -162,6 +162,8 @@ struct brw_wm_instruction { #define BRW_WM_MAX_CONST 256 #define BRW_WM_MAX_SUBROUTINE 16 +/* used in masks next to WRITEMASK_*. */ +#define SATURATE (1<<5) /* New opcodes to track internal operations required for WM unit. diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 28d6d4eba5..fd6d6c5602 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -2771,6 +2771,21 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) if (c->fp->use_const_buffer) fetch_constants(c, inst); + if (inst->Opcode != OPCODE_ARL) { + for (j = 0; j < 4; j++) { + if (inst->DstReg.WriteMask & (1 << j)) + dst[j] = get_dst_reg(c, inst, j); + else + dst[j] = brw_null_reg(); + } + } + for (j = 0; j < brw_wm_nr_args(inst->Opcode); j++) + get_argument_regs(c, inst, j, args[j], WRITEMASK_XYZW); + + dst_flags = inst->DstReg.WriteMask; + if (inst->SaturateMode == SATURATE_ZERO_ONE) + dst_flags |= SATURATE; + if (inst->CondUpdate) brw_set_conditionalmod(p, BRW_CONDITIONAL_NZ); else @@ -2866,13 +2881,6 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) break; case OPCODE_DDX: case OPCODE_DDY: - for (j = 0; j < 4; j++) { - if (inst->DstReg.WriteMask & (1 << j)) - dst[j] = get_dst_reg(c, inst, j); - else - dst[j] = brw_null_reg(); - } - get_argument_regs(c, inst, 0, args[0], WRITEMASK_XYZW); emit_ddxy(p, dst, dst_flags, (inst->Opcode == OPCODE_DDX), args[0]); break; -- cgit v1.2.3 From 71af5080722afcbbb8a935138d95214ef7afe219 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 11 Aug 2009 16:31:19 -0700 Subject: i965: Share basic ALU ops between brw_wm_glsl and brw_wm_emit.c This drops support for get_src_reg_imm in these, but the prospect of getting brw_wm_pass*.c onto our GLSL path is well worth some temporary pain. --- src/mesa/drivers/dri/i965/brw_wm.h | 17 +++++ src/mesa/drivers/dri/i965/brw_wm_emit.c | 32 +++++----- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 106 ++------------------------------ 3 files changed, 38 insertions(+), 117 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index f841d25870..93f79dbfe5 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -308,6 +308,23 @@ void brw_wm_lookup_iz( GLuint line_aa, GLboolean brw_wm_is_glsl(const struct gl_fragment_program *fp); void brw_wm_glsl_emit(struct brw_context *brw, struct brw_wm_compile *c); +/* brw_wm_emit.c */ +void emit_alu1(struct brw_compile *p, + struct brw_instruction *(*func)(struct brw_compile *, + struct brw_reg, + struct brw_reg), + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0); +void emit_alu2(struct brw_compile *p, + struct brw_instruction *(*func)(struct brw_compile *, + struct brw_reg, + struct brw_reg, + struct brw_reg), + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1); void emit_ddxy(struct brw_compile *p, const struct brw_reg *dst, GLuint mask, diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index bf80a2942a..5e41a3f571 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -352,13 +352,13 @@ void emit_ddxy(struct brw_compile *p, brw_set_saturate(p, 0); } -static void emit_alu1( struct brw_compile *p, - struct brw_instruction *(*func)(struct brw_compile *, - struct brw_reg, - struct brw_reg), - const struct brw_reg *dst, - GLuint mask, - const struct brw_reg *arg0 ) +void emit_alu1(struct brw_compile *p, + struct brw_instruction *(*func)(struct brw_compile *, + struct brw_reg, + struct brw_reg), + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0) { GLuint i; @@ -376,15 +376,15 @@ static void emit_alu1( struct brw_compile *p, } -static void emit_alu2( struct brw_compile *p, - struct brw_instruction *(*func)(struct brw_compile *, - struct brw_reg, - struct brw_reg, - struct brw_reg), - const struct brw_reg *dst, - GLuint mask, - const struct brw_reg *arg0, - const struct brw_reg *arg1 ) +void emit_alu2(struct brw_compile *p, + struct brw_instruction *(*func)(struct brw_compile *, + struct brw_reg, + struct brw_reg, + struct brw_reg), + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1) { GLuint i; diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index fd6d6c5602..fdd31d4ed5 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -668,26 +668,6 @@ static void emit_trunc( struct brw_wm_compile *c, brw_set_saturate(p, 0); } -static void emit_mov( struct brw_wm_compile *c, - const struct prog_instruction *inst) -{ - int i; - struct brw_compile *p = &c->func; - GLuint mask = inst->DstReg.WriteMask; - brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF); - for (i = 0; i < 4; i++) { - if (mask & (1<func; - struct brw_reg src0, src1, dst; - GLuint mask = inst->DstReg.WriteMask; - int i; - brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); - for (i = 0 ; i < 4; i++) { - if (mask & (1<func; - struct brw_reg src0, src1, dst; - GLuint mask = inst->DstReg.WriteMask; - int i; - brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); - for (i = 0 ; i < 4; i++) { - if (mask & (1<func; - struct brw_reg src0, dst; - GLuint mask = inst->DstReg.WriteMask; - int i; - brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); - for (i = 0 ; i < 4; i++) { - if (mask & (1<SaturateMode != SATURATE_OFF) - brw_set_saturate(p, 0); -} - -static void emit_flr(struct brw_wm_compile *c, - const struct prog_instruction *inst) -{ - struct brw_compile *p = &c->func; - struct brw_reg src0, dst; - GLuint mask = inst->DstReg.WriteMask; - int i; - brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); - for (i = 0 ; i < 4; i++) { - if (mask & (1< Date: Tue, 11 Aug 2009 16:47:15 -0700 Subject: i965: Use a normal alu1 emit for OPCODE_TRUNC. --- src/mesa/drivers/dri/i965/brw_wm_emit.c | 16 +--------------- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 20 +------------------- 2 files changed, 2 insertions(+), 34 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 5e41a3f571..215515d10b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -422,20 +422,6 @@ static void emit_mad( struct brw_compile *p, } } -static void emit_trunc( struct brw_compile *p, - const struct brw_reg *dst, - GLuint mask, - const struct brw_reg *arg0) -{ - GLuint i; - - for (i = 0; i < 4; i++) { - if (mask & (1<func; - GLuint mask = inst->DstReg.WriteMask; - brw_set_saturate(p, inst->SaturateMode != SATURATE_OFF); - for (i = 0; i < 4; i++) { - if (mask & (1< Date: Tue, 11 Aug 2009 17:52:44 -0700 Subject: i965: Add generic GLSL code for unaliasing a 3-arg opcode, and share LRP code. --- src/mesa/drivers/dri/i965/brw_wm.h | 6 ++ src/mesa/drivers/dri/i965/brw_wm_emit.c | 12 ++-- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 98 ++++++++++++++++++++------------- 3 files changed, 71 insertions(+), 45 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 93f79dbfe5..66902bab65 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -330,5 +330,11 @@ void emit_ddxy(struct brw_compile *p, GLuint mask, GLboolean is_ddx, const struct brw_reg *arg0); +void emit_lrp(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1, + const struct brw_reg *arg2); #endif diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 215515d10b..9e637ef3f2 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -422,12 +422,12 @@ static void emit_mad( struct brw_compile *p, } } -static void emit_lrp( struct brw_compile *p, - const struct brw_reg *dst, - GLuint mask, - const struct brw_reg *arg0, - const struct brw_reg *arg1, - const struct brw_reg *arg2 ) +void emit_lrp(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1, + const struct brw_reg *arg2) { GLuint i; diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index cd5a59463c..458d06187a 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -650,6 +650,63 @@ static void invoke_subroutine( struct brw_wm_compile *c, } } +/* Workaround for using brw_wm_emit.c's emit functions, which expect + * destination regs to be uniquely written. Moves arguments out to + * temporaries as necessary for instructions which use their destination as + * a temporary. + */ +static void +unalias3(struct brw_wm_compile *c, + void (*func)(struct brw_compile *c, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1, + const struct brw_reg *arg2), + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1, + const struct brw_reg *arg2) +{ + struct brw_compile *p = &c->func; + struct brw_reg tmp_arg0[4], tmp_arg1[4], tmp_arg2[4]; + int i, j; + int mark = mark_tmps(c); + + for (j = 0; j < 4; j++) { + tmp_arg0[j] = arg0[j]; + tmp_arg1[j] = arg1[j]; + tmp_arg2[j] = arg2[j]; + } + + for (i = 0; i < 4; i++) { + if (mask & (1<func; - GLuint mask = inst->DstReg.WriteMask; - struct brw_reg dst, tmp1, tmp2, src0, src1, src2; - int i; - int mark = mark_tmps(c); - for (i = 0; i < 4; i++) { - if (mask & (1<SaturateMode != SATURATE_OFF) ? 1 : 0); - brw_MAC(p, dst, src0, tmp1); - brw_set_saturate(p, 0); - } - release_tmps(c, mark); - } -} - /** * For GLSL shaders, this KIL will be unconditional. * It may be contained inside an IF/ENDIF structure of course. @@ -2722,7 +2741,8 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) emit_alu1(p, brw_RNDD, dst, dst_flags, args[0]); break; case OPCODE_LRP: - emit_lrp(c, inst); + unalias3(c, emit_lrp, + dst, dst_flags, args[0], args[1], args[2]); break; case OPCODE_TRUNC: emit_alu1(p, brw_RNDZ, dst, dst_flags, args[0]); -- cgit v1.2.3 From bad5b120be8de37cf8481d865790298fd9651381 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 11 Aug 2009 19:13:52 -0700 Subject: i965: Share the DP3, DP4, and DPH between brw_wm_glsl.c and brw_wm_emit.c --- src/mesa/drivers/dri/i965/brw_wm.h | 15 ++++++ src/mesa/drivers/dri/i965/brw_wm_emit.c | 30 ++++++------ src/mesa/drivers/dri/i965/brw_wm_glsl.c | 87 ++------------------------------- 3 files changed, 33 insertions(+), 99 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 66902bab65..18f17f2488 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -330,6 +330,21 @@ void emit_ddxy(struct brw_compile *p, GLuint mask, GLboolean is_ddx, const struct brw_reg *arg0); +void emit_dp3(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1); +void emit_dp4(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1); +void emit_dph(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1); void emit_lrp(struct brw_compile *p, const struct brw_reg *dst, GLuint mask, diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 9e637ef3f2..bc5abb942b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -594,11 +594,11 @@ static void emit_min( struct brw_compile *p, } -static void emit_dp3( struct brw_compile *p, - const struct brw_reg *dst, - GLuint mask, - const struct brw_reg *arg0, - const struct brw_reg *arg1 ) +void emit_dp3(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1) { int dst_chan = _mesa_ffs(mask & WRITEMASK_XYZW) - 1; @@ -616,11 +616,11 @@ static void emit_dp3( struct brw_compile *p, } -static void emit_dp4( struct brw_compile *p, - const struct brw_reg *dst, - GLuint mask, - const struct brw_reg *arg0, - const struct brw_reg *arg1 ) +void emit_dp4(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1) { int dst_chan = _mesa_ffs(mask & WRITEMASK_XYZW) - 1; @@ -639,11 +639,11 @@ static void emit_dp4( struct brw_compile *p, } -static void emit_dph( struct brw_compile *p, - const struct brw_reg *dst, - GLuint mask, - const struct brw_reg *arg0, - const struct brw_reg *arg1 ) +void emit_dph(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1) { const int dst_chan = _mesa_ffs(mask & WRITEMASK_XYZW) - 1; diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 458d06187a..536eac8851 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -1038,87 +1038,6 @@ static void emit_xpd(struct brw_wm_compile *c, brw_set_saturate(p, 0); } -static void emit_dp3(struct brw_wm_compile *c, - const struct prog_instruction *inst) -{ - struct brw_reg src0[3], src1[3], dst; - int i; - struct brw_compile *p = &c->func; - GLuint mask = inst->DstReg.WriteMask; - int dst_chan = _mesa_ffs(mask & WRITEMASK_XYZW) - 1; - - if (!(mask & WRITEMASK_XYZW)) - return; - - assert(is_power_of_two(mask & WRITEMASK_XYZW)); - - for (i = 0; i < 3; 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, dst_chan); - 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); - brw_MAC(p, dst, src0[2], src1[2]); - brw_set_saturate(p, 0); -} - -static void emit_dp4(struct brw_wm_compile *c, - const struct prog_instruction *inst) -{ - struct brw_reg src0[4], src1[4], dst; - int i; - struct brw_compile *p = &c->func; - GLuint mask = inst->DstReg.WriteMask; - int dst_chan = _mesa_ffs(mask & WRITEMASK_XYZW) - 1; - - if (!(mask & WRITEMASK_XYZW)) - return; - - assert(is_power_of_two(mask & WRITEMASK_XYZW)); - - for (i = 0; i < 4; 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, dst_chan); - 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]); - brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); - brw_MAC(p, dst, src0[3], src1[3]); - brw_set_saturate(p, 0); -} - -static void emit_dph(struct brw_wm_compile *c, - const struct prog_instruction *inst) -{ - struct brw_reg src0[4], src1[4], dst; - int i; - struct brw_compile *p = &c->func; - GLuint mask = inst->DstReg.WriteMask; - int dst_chan = _mesa_ffs(mask & WRITEMASK_XYZW) - 1; - - if (!(mask & WRITEMASK_XYZW)) - return; - - assert(is_power_of_two(mask & WRITEMASK_XYZW)); - - for (i = 0; i < 4; 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, dst_chan); - 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]); - brw_set_saturate(p, (inst->SaturateMode != SATURATE_OFF) ? 1 : 0); - brw_ADD(p, dst, dst, src1[3]); - brw_set_saturate(p, 0); -} - /** * Emit a scalar instruction, like RCP, RSQ, LOG, EXP. * Note that the result of the function is smeared across the dest @@ -2752,16 +2671,16 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) emit_alu1(p, brw_MOV, dst, dst_flags, args[0]); break; case OPCODE_DP3: - emit_dp3(c, inst); + emit_dp3(p, dst, dst_flags, args[0], args[1]); break; case OPCODE_DP4: - emit_dp4(c, inst); + emit_dp4(p, dst, dst_flags, args[0], args[1]); break; case OPCODE_XPD: emit_xpd(c, inst); break; case OPCODE_DPH: - emit_dph(c, inst); + emit_dph(p, dst, dst_flags, args[0], args[1]); break; case OPCODE_RCP: emit_rcp(c, inst); -- cgit v1.2.3 From 726ad1560660a1fc769c87e0ea16f8b3334df0d2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 11 Aug 2009 19:17:31 -0700 Subject: i965: Share OPCODE_MAD between brw_wm_glsl.c and brw_wm_emit.c --- src/mesa/drivers/dri/i965/brw_wm.h | 6 ++++++ src/mesa/drivers/dri/i965/brw_wm_emit.c | 12 ++++++------ src/mesa/drivers/dri/i965/brw_wm_glsl.c | 25 +------------------------ 3 files changed, 13 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 18f17f2488..e0445aaf52 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -351,5 +351,11 @@ void emit_lrp(struct brw_compile *p, const struct brw_reg *arg0, const struct brw_reg *arg1, const struct brw_reg *arg2); +void emit_mad(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1, + const struct brw_reg *arg2); #endif diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index bc5abb942b..6cdc4f7483 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -402,12 +402,12 @@ void emit_alu2(struct brw_compile *p, } -static void emit_mad( struct brw_compile *p, - const struct brw_reg *dst, - GLuint mask, - const struct brw_reg *arg0, - const struct brw_reg *arg1, - const struct brw_reg *arg2 ) +void emit_mad(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1, + const struct brw_reg *arg2) { GLuint i; diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 536eac8851..55e3e9fa7f 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -1214,29 +1214,6 @@ static void emit_kil(struct brw_wm_compile *c) brw_pop_insn_state(p); } -static void emit_mad(struct brw_wm_compile *c, - const struct prog_instruction *inst) -{ - struct brw_compile *p = &c->func; - GLuint mask = inst->DstReg.WriteMask; - struct brw_reg dst, src0, src1, src2; - int i; - - for (i = 0; i < 4; i++) { - if (mask & (1<SaturateMode != SATURATE_OFF) ? 1 : 0); - brw_ADD(p, dst, dst, src2); - brw_set_saturate(p, 0); - } - } -} - static void emit_sop(struct brw_wm_compile *c, const struct prog_instruction *inst, GLuint cond) { @@ -2734,7 +2711,7 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) emit_pow(c, inst); break; case OPCODE_MAD: - emit_mad(c, inst); + emit_mad(p, dst, dst_flags, args[0], args[1], args[2]); break; case OPCODE_NOISE1: emit_noise1(c, inst); -- cgit v1.2.3 From 7059aa0eff9ff6ec361e584b413f63b25762a89c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 11 Aug 2009 21:17:14 -0700 Subject: i965: Share the sop opcodes between brw_wm_glsl.c and brw_wm_emit.c. --- src/mesa/drivers/dri/i965/brw_wm.h | 6 +++ src/mesa/drivers/dri/i965/brw_wm_emit.c | 19 ++++---- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 78 +++++---------------------------- 3 files changed, 29 insertions(+), 74 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index e0445aaf52..df8e467aaf 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -357,5 +357,11 @@ void emit_mad(struct brw_compile *p, const struct brw_reg *arg0, const struct brw_reg *arg1, const struct brw_reg *arg2); +void emit_sop(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + GLuint cond, + const struct brw_reg *arg0, + const struct brw_reg *arg1); #endif diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 6cdc4f7483..41ebadb553 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -447,21 +447,24 @@ void emit_lrp(struct brw_compile *p, } } -static void emit_sop( struct brw_compile *p, - const struct brw_reg *dst, - GLuint mask, - GLuint cond, - const struct brw_reg *arg0, - const struct brw_reg *arg1 ) +void emit_sop(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + GLuint cond, + const struct brw_reg *arg0, + const struct brw_reg *arg1) { GLuint i; for (i = 0; i < 4; i++) { if (mask & (1<func; - GLuint mask = inst->DstReg.WriteMask; - struct brw_reg dst, src0, src1; - int i; - - for (i = 0; i < 4; i++) { - if (mask & (1< Date: Wed, 12 Aug 2009 09:52:44 -0700 Subject: i965: Share math functions between brw_wm_glsl.c and brw_wm_emit.c. --- src/mesa/drivers/dri/i965/brw_wm.h | 16 +++ src/mesa/drivers/dri/i965/brw_wm_emit.c | 139 +++++++++++++++---------- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 177 ++------------------------------ 3 files changed, 111 insertions(+), 221 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index df8e467aaf..7d470e8dfe 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -357,11 +357,27 @@ void emit_mad(struct brw_compile *p, const struct brw_reg *arg0, const struct brw_reg *arg1, const struct brw_reg *arg2); +void emit_math1(struct brw_wm_compile *c, + GLuint function, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0); +void emit_math2(struct brw_wm_compile *c, + GLuint function, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1); void emit_sop(struct brw_compile *p, const struct brw_reg *dst, GLuint mask, GLuint cond, const struct brw_reg *arg0, const struct brw_reg *arg1); +void emit_xpd(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1); #endif diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 41ebadb553..763fe4b4d6 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -665,11 +665,11 @@ void emit_dph(struct brw_compile *p, } -static void emit_xpd( struct brw_compile *p, - const struct brw_reg *dst, - GLuint mask, - const struct brw_reg *arg0, - const struct brw_reg *arg1 ) +void emit_xpd(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1) { GLuint i; @@ -690,41 +690,68 @@ static void emit_xpd( struct brw_compile *p, } -static void emit_math1( struct brw_compile *p, - GLuint function, - const struct brw_reg *dst, - GLuint mask, - const struct brw_reg *arg0 ) +void emit_math1(struct brw_wm_compile *c, + GLuint function, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0) { + struct brw_compile *p = &c->func; int dst_chan = _mesa_ffs(mask & WRITEMASK_XYZW) - 1; + GLuint saturate = ((mask & SATURATE) ? + BRW_MATH_SATURATE_SATURATE : + BRW_MATH_SATURATE_NONE); if (!(mask & WRITEMASK_XYZW)) return; /* Do not emit dead code */ assert(is_power_of_two(mask & WRITEMASK_XYZW)); + /* If compressed, this will write message reg 2,3 from arg0.x's 16 + * channels. + */ brw_MOV(p, brw_message_reg(2), arg0[0]); /* Send two messages to perform all 16 operations: */ - brw_math_16(p, - dst[dst_chan], + brw_push_insn_state(p); + brw_set_compression_control(p, BRW_COMPRESSION_NONE); + brw_math(p, + dst[dst_chan], + function, + saturate, + 2, + brw_null_reg(), + BRW_MATH_DATA_VECTOR, + BRW_MATH_PRECISION_FULL); + + if (c->dispatch_width == 16) { + brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF); + brw_math(p, + offset(dst[dst_chan],1), function, - (mask & SATURATE) ? BRW_MATH_SATURATE_SATURATE : BRW_MATH_SATURATE_NONE, - 2, + saturate, + 3, brw_null_reg(), + BRW_MATH_DATA_VECTOR, BRW_MATH_PRECISION_FULL); + } + brw_pop_insn_state(p); } -static void emit_math2( struct brw_compile *p, - GLuint function, - const struct brw_reg *dst, - GLuint mask, - const struct brw_reg *arg0, - const struct brw_reg *arg1) +void emit_math2(struct brw_wm_compile *c, + GLuint function, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1) { + struct brw_compile *p = &c->func; int dst_chan = _mesa_ffs(mask & WRITEMASK_XYZW) - 1; + GLuint saturate = ((mask & SATURATE) ? + BRW_MATH_SATURATE_SATURATE : + BRW_MATH_SATURATE_NONE); if (!(mask & WRITEMASK_XYZW)) return; /* Do not emit dead code */ @@ -735,37 +762,41 @@ static void emit_math2( struct brw_compile *p, brw_set_compression_control(p, BRW_COMPRESSION_NONE); brw_MOV(p, brw_message_reg(2), arg0[0]); - brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF); - brw_MOV(p, brw_message_reg(4), sechalf(arg0[0])); + if (c->dispatch_width == 16) { + brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF); + brw_MOV(p, brw_message_reg(4), sechalf(arg0[0])); + } brw_set_compression_control(p, BRW_COMPRESSION_NONE); brw_MOV(p, brw_message_reg(3), arg1[0]); - brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF); - brw_MOV(p, brw_message_reg(5), sechalf(arg1[0])); + if (c->dispatch_width == 16) { + brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF); + brw_MOV(p, brw_message_reg(5), sechalf(arg1[0])); + } - - /* Send two messages to perform all 16 operations: - */ brw_set_compression_control(p, BRW_COMPRESSION_NONE); brw_math(p, dst[dst_chan], function, - (mask & SATURATE) ? BRW_MATH_SATURATE_SATURATE : BRW_MATH_SATURATE_NONE, + saturate, 2, brw_null_reg(), BRW_MATH_DATA_VECTOR, BRW_MATH_PRECISION_FULL); - brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF); - brw_math(p, - offset(dst[dst_chan],1), - function, - (mask & SATURATE) ? BRW_MATH_SATURATE_SATURATE : BRW_MATH_SATURATE_NONE, - 4, - brw_null_reg(), - BRW_MATH_DATA_VECTOR, - BRW_MATH_PRECISION_FULL); - + /* Send two messages to perform all 16 operations: + */ + if (c->dispatch_width == 16) { + brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF); + brw_math(p, + offset(dst[dst_chan],1), + function, + saturate, + 4, + brw_null_reg(), + BRW_MATH_DATA_VECTOR, + BRW_MATH_PRECISION_FULL); + } brw_pop_insn_state(p); } @@ -909,11 +940,13 @@ static void emit_txb( struct brw_wm_compile *c, } -static void emit_lit( struct brw_compile *p, - const struct brw_reg *dst, - GLuint mask, - const struct brw_reg *arg0 ) +static void emit_lit(struct brw_wm_compile *c, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0) { + struct brw_compile *p = &c->func; + assert((mask & WRITEMASK_XW) == 0); if (mask & WRITEMASK_Y) { @@ -923,7 +956,7 @@ static void emit_lit( struct brw_compile *p, } if (mask & WRITEMASK_Z) { - emit_math2(p, BRW_MATH_FUNCTION_POW, + emit_math2(c, BRW_MATH_FUNCTION_POW, &dst[2], WRITEMASK_X | (mask & SATURATE), &arg0[1], @@ -1380,27 +1413,27 @@ void brw_wm_emit( struct brw_wm_compile *c ) /* Higher math functions: */ case OPCODE_RCP: - emit_math1(p, BRW_MATH_FUNCTION_INV, dst, dst_flags, args[0]); + emit_math1(c, BRW_MATH_FUNCTION_INV, dst, dst_flags, args[0]); break; case OPCODE_RSQ: - emit_math1(p, BRW_MATH_FUNCTION_RSQ, dst, dst_flags, args[0]); + emit_math1(c, BRW_MATH_FUNCTION_RSQ, dst, dst_flags, args[0]); break; case OPCODE_SIN: - emit_math1(p, BRW_MATH_FUNCTION_SIN, dst, dst_flags, args[0]); + emit_math1(c, BRW_MATH_FUNCTION_SIN, dst, dst_flags, args[0]); break; case OPCODE_COS: - emit_math1(p, BRW_MATH_FUNCTION_COS, dst, dst_flags, args[0]); + emit_math1(c, BRW_MATH_FUNCTION_COS, dst, dst_flags, args[0]); break; case OPCODE_EX2: - emit_math1(p, BRW_MATH_FUNCTION_EXP, dst, dst_flags, args[0]); + emit_math1(c, BRW_MATH_FUNCTION_EXP, dst, dst_flags, args[0]); break; case OPCODE_LG2: - emit_math1(p, BRW_MATH_FUNCTION_LOG, dst, dst_flags, args[0]); + emit_math1(c, BRW_MATH_FUNCTION_LOG, dst, dst_flags, args[0]); break; case OPCODE_SCS: @@ -1408,13 +1441,13 @@ void brw_wm_emit( struct brw_wm_compile *c ) * fixup for 16-element execution. */ if (dst_flags & WRITEMASK_X) - emit_math1(p, BRW_MATH_FUNCTION_COS, dst, (dst_flags&SATURATE)|WRITEMASK_X, args[0]); + emit_math1(c, BRW_MATH_FUNCTION_COS, dst, (dst_flags&SATURATE)|WRITEMASK_X, args[0]); if (dst_flags & WRITEMASK_Y) - emit_math1(p, BRW_MATH_FUNCTION_SIN, dst+1, (dst_flags&SATURATE)|WRITEMASK_X, args[0]); + emit_math1(c, BRW_MATH_FUNCTION_SIN, dst+1, (dst_flags&SATURATE)|WRITEMASK_X, args[0]); break; case OPCODE_POW: - emit_math2(p, BRW_MATH_FUNCTION_POW, dst, dst_flags, args[0], args[1]); + emit_math2(c, BRW_MATH_FUNCTION_POW, dst, dst_flags, args[0], args[1]); break; /* Comparisons: @@ -1452,7 +1485,7 @@ void brw_wm_emit( struct brw_wm_compile *c ) break; case OPCODE_LIT: - emit_lit(p, dst, dst_flags, args[0]); + emit_lit(c, dst, dst_flags, args[0]); break; /* Texturing operations: diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 2df47344d5..02b119154f 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -550,42 +550,6 @@ 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. 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, - 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, channel); - const GLfloat *param = - c->fp->program.Base.Parameters->ParameterValues[src->Index]; - GLfloat value = param[component]; - if (src->Negate & (1 << channel)) - value = -value; - if (src->Abs) - value = FABSF(value); -#if 0 - printf(" form immed value %f for chan %d\n", value, channel); -#endif - return brw_imm_f(value); - } - else { - return get_src_reg(c, inst, srcRegIndex, channel); - } -} - - /** * Subroutines are minimal support for resusable instruction sequences. * They are implemented as simply as possible to minimise overhead: there @@ -1013,100 +977,6 @@ static void emit_frontfacing(struct brw_wm_compile *c, brw_set_predicate_control_flag_value(p, 0xff); } -static void emit_xpd(struct brw_wm_compile *c, - const struct prog_instruction *inst) -{ - int i; - struct brw_compile *p = &c->func; - GLuint mask = inst->DstReg.WriteMask; - for (i = 0; i < 4; i++) { - GLuint i2 = (i+2)%3; - GLuint i1 = (i+1)%3; - if (mask & (1<SaturateMode != SATURATE_OFF); - brw_MAC(p, dst, src0, src1); - brw_set_saturate(p, 0); - } - } - brw_set_saturate(p, 0); -} - -/** - * Emit a scalar instruction, like RCP, RSQ, LOG, EXP. - * Note that the result of the function is smeared across the dest - * register's X, Y, Z and W channels (subject to writemasking of course). - */ -static void emit_math1(struct brw_wm_compile *c, - const struct prog_instruction *inst, GLuint func) -{ - struct brw_compile *p = &c->func; - struct brw_reg src0, dst; - GLuint mask = inst->DstReg.WriteMask; - int dst_chan = _mesa_ffs(mask & WRITEMASK_XYZW) - 1; - - if (!(mask & WRITEMASK_XYZW)) - return; - - assert(is_power_of_two(mask & WRITEMASK_XYZW)); - - /* Get first component of source register */ - dst = get_dst_reg(c, inst, dst_chan); - src0 = get_src_reg(c, inst, 0, 0); - - brw_MOV(p, brw_message_reg(2), src0); - brw_math(p, - dst, - func, - (inst->SaturateMode != SATURATE_OFF) ? BRW_MATH_SATURATE_SATURATE : BRW_MATH_SATURATE_NONE, - 2, - brw_null_reg(), - BRW_MATH_DATA_VECTOR, - BRW_MATH_PRECISION_FULL); -} - -static void emit_rcp(struct brw_wm_compile *c, - const struct prog_instruction *inst) -{ - emit_math1(c, inst, BRW_MATH_FUNCTION_INV); -} - -static void emit_rsq(struct brw_wm_compile *c, - const struct prog_instruction *inst) -{ - emit_math1(c, inst, BRW_MATH_FUNCTION_RSQ); -} - -static void emit_sin(struct brw_wm_compile *c, - const struct prog_instruction *inst) -{ - emit_math1(c, inst, BRW_MATH_FUNCTION_SIN); -} - -static void emit_cos(struct brw_wm_compile *c, - const struct prog_instruction *inst) -{ - emit_math1(c, inst, BRW_MATH_FUNCTION_COS); -} - -static void emit_ex2(struct brw_wm_compile *c, - const struct prog_instruction *inst) -{ - emit_math1(c, inst, BRW_MATH_FUNCTION_EXP); -} - -static void emit_lg2(struct brw_wm_compile *c, - const struct prog_instruction *inst) -{ - emit_math1(c, inst, BRW_MATH_FUNCTION_LOG); -} - static void emit_arl(struct brw_wm_compile *c, const struct prog_instruction *inst) { @@ -1169,36 +1039,6 @@ static void emit_min_max(struct brw_wm_compile *c, release_tmps(c, mark); } -static void emit_pow(struct brw_wm_compile *c, - const struct prog_instruction *inst) -{ - struct brw_compile *p = &c->func; - struct brw_reg dst, src0, src1; - GLuint mask = inst->DstReg.WriteMask; - int dst_chan = _mesa_ffs(mask & WRITEMASK_XYZW) - 1; - - if (!(mask & WRITEMASK_XYZW)) - return; - - assert(is_power_of_two(mask & WRITEMASK_XYZW)); - - dst = get_dst_reg(c, inst, dst_chan); - 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); - - brw_math(p, - dst, - BRW_MATH_FUNCTION_POW, - (inst->SaturateMode != SATURATE_OFF) ? BRW_MATH_SATURATE_SATURATE : BRW_MATH_SATURATE_NONE, - 2, - brw_null_reg(), - BRW_MATH_DATA_VECTOR, - BRW_MATH_PRECISION_FULL); -} - /** * For GLSL shaders, this KIL will be unconditional. * It may be contained inside an IF/ENDIF structure of course. @@ -2594,28 +2434,28 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) emit_dp4(p, dst, dst_flags, args[0], args[1]); break; case OPCODE_XPD: - emit_xpd(c, inst); + emit_xpd(p, dst, dst_flags, args[0], args[1]); break; case OPCODE_DPH: emit_dph(p, dst, dst_flags, args[0], args[1]); break; case OPCODE_RCP: - emit_rcp(c, inst); + emit_math1(c, BRW_MATH_FUNCTION_INV, dst, dst_flags, args[0]); break; case OPCODE_RSQ: - emit_rsq(c, inst); + emit_math1(c, BRW_MATH_FUNCTION_RSQ, dst, dst_flags, args[0]); break; case OPCODE_SIN: - emit_sin(c, inst); + emit_math1(c, BRW_MATH_FUNCTION_SIN, dst, dst_flags, args[0]); break; case OPCODE_COS: - emit_cos(c, inst); + emit_math1(c, BRW_MATH_FUNCTION_COS, dst, dst_flags, args[0]); break; case OPCODE_EX2: - emit_ex2(c, inst); + emit_math1(c, BRW_MATH_FUNCTION_EXP, dst, dst_flags, args[0]); break; case OPCODE_LG2: - emit_lg2(c, inst); + emit_math1(c, BRW_MATH_FUNCTION_LOG, dst, dst_flags, args[0]); break; case OPCODE_MIN: case OPCODE_MAX: @@ -2654,7 +2494,8 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) emit_alu2(p, brw_MUL, dst, dst_flags, args[0], args[1]); break; case OPCODE_POW: - emit_pow(c, inst); + emit_math2(c, BRW_MATH_FUNCTION_POW, + dst, dst_flags, args[0], args[1]); break; case OPCODE_MAD: emit_mad(p, dst, dst_flags, args[0], args[1], args[2]); -- cgit v1.2.3 From 2b58c31257f8900067276b6d6537bb2ce54b1b10 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 12 Aug 2009 10:19:31 -0700 Subject: i965: Share most of the WM functions between brw_wm_glsl.c and brw_wm_emit.c The PINTERP code should be faster for brw_wm_glsl.c now since brw_wm_emit.c's had been improved, and pixel_w should no longer stomp on a neighbor to dst. --- src/mesa/drivers/dri/i965/brw_wm.h | 34 +++++ src/mesa/drivers/dri/i965/brw_wm_emit.c | 115 ++++++++------ src/mesa/drivers/dri/i965/brw_wm_glsl.c | 257 +------------------------------- 3 files changed, 109 insertions(+), 297 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 7d470e8dfe..eba828f6e3 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -325,11 +325,19 @@ void emit_alu2(struct brw_compile *p, GLuint mask, const struct brw_reg *arg0, const struct brw_reg *arg1); +void emit_cinterp(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0); void emit_ddxy(struct brw_compile *p, const struct brw_reg *dst, GLuint mask, GLboolean is_ddx, const struct brw_reg *arg0); +void emit_delta_xy(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0); void emit_dp3(struct brw_compile *p, const struct brw_reg *dst, GLuint mask, @@ -345,6 +353,14 @@ void emit_dph(struct brw_compile *p, GLuint mask, const struct brw_reg *arg0, const struct brw_reg *arg1); +void emit_frontfacing(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask); +void emit_linterp(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *deltas); void emit_lrp(struct brw_compile *p, const struct brw_reg *dst, GLuint mask, @@ -368,12 +384,30 @@ void emit_math2(struct brw_wm_compile *c, GLuint mask, const struct brw_reg *arg0, const struct brw_reg *arg1); +void emit_pinterp(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *deltas, + const struct brw_reg *w); +void emit_pixel_xy(struct brw_wm_compile *c, + const struct brw_reg *dst, + GLuint mask); +void emit_pixel_w(struct brw_wm_compile *c, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *deltas); void emit_sop(struct brw_compile *p, const struct brw_reg *dst, GLuint mask, GLuint cond, const struct brw_reg *arg0, const struct brw_reg *arg1); +void emit_wpos_xy(struct brw_wm_compile *c, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0); void emit_xpd(struct brw_compile *p, const struct brw_reg *dst, GLuint mask, diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 763fe4b4d6..6eaa2792be 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -44,6 +44,7 @@ static INLINE struct brw_reg sechalf( struct brw_reg reg ) return reg; } + /* Payload R0: * * R0.0 -- pixel mask, one bit for each of 4 pixels in 4 tiles, @@ -60,42 +61,50 @@ static INLINE struct brw_reg sechalf( struct brw_reg reg ) * R1.8 -- ? */ - -static void emit_pixel_xy(struct brw_compile *p, - const struct brw_reg *dst, - GLuint mask) +void emit_pixel_xy(struct brw_wm_compile *c, + const struct brw_reg *dst, + GLuint mask) { + struct brw_compile *p = &c->func; struct brw_reg r1 = brw_vec1_grf(1, 0); struct brw_reg r1_uw = retype(r1, BRW_REGISTER_TYPE_UW); + struct brw_reg dst0_uw, dst1_uw; + brw_push_insn_state(p); brw_set_compression_control(p, BRW_COMPRESSION_NONE); + if (c->dispatch_width == 16) { + dst0_uw = vec16(retype(dst[0], BRW_REGISTER_TYPE_UW)); + dst1_uw = vec16(retype(dst[1], BRW_REGISTER_TYPE_UW)); + } else { + dst0_uw = vec8(retype(dst[0], BRW_REGISTER_TYPE_UW)); + dst1_uw = vec8(retype(dst[1], BRW_REGISTER_TYPE_UW)); + } + /* Calculate pixel centers by adding 1 or 0 to each of the * micro-tile coordinates passed in r1. */ if (mask & WRITEMASK_X) { brw_ADD(p, - vec16(retype(dst[0], BRW_REGISTER_TYPE_UW)), + dst0_uw, stride(suboffset(r1_uw, 4), 2, 4, 0), brw_imm_v(0x10101010)); } if (mask & WRITEMASK_Y) { brw_ADD(p, - vec16(retype(dst[1], BRW_REGISTER_TYPE_UW)), + dst1_uw, stride(suboffset(r1_uw,5), 2, 4, 0), brw_imm_v(0x11001100)); } - - brw_set_compression_control(p, BRW_COMPRESSION_COMPRESSED); + brw_pop_insn_state(p); } - -static void emit_delta_xy(struct brw_compile *p, - const struct brw_reg *dst, - GLuint mask, - const struct brw_reg *arg0) +void emit_delta_xy(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0) { struct brw_reg r1 = brw_vec1_grf(1, 0); @@ -118,10 +127,10 @@ static void emit_delta_xy(struct brw_compile *p, } } -static void emit_wpos_xy(struct brw_wm_compile *c, - const struct brw_reg *dst, - GLuint mask, - const struct brw_reg *arg0) +void emit_wpos_xy(struct brw_wm_compile *c, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0) { struct brw_compile *p = &c->func; @@ -146,12 +155,14 @@ static void emit_wpos_xy(struct brw_wm_compile *c, } -static void emit_pixel_w( struct brw_compile *p, - const struct brw_reg *dst, - GLuint mask, - const struct brw_reg *arg0, - const struct brw_reg *deltas) +void emit_pixel_w(struct brw_wm_compile *c, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *deltas) { + struct brw_compile *p = &c->func; + /* Don't need this if all you are doing is interpolating color, for * instance. */ @@ -165,21 +176,29 @@ static void emit_pixel_w( struct brw_compile *p, brw_MAC(p, brw_message_reg(2), suboffset(interp3, 1), deltas[1]); /* Calc w */ - brw_math_16( p, dst[3], - BRW_MATH_FUNCTION_INV, - BRW_MATH_SATURATE_NONE, - 2, brw_null_reg(), - BRW_MATH_PRECISION_FULL); + if (c->dispatch_width == 16) { + brw_math_16(p, dst[3], + BRW_MATH_FUNCTION_INV, + BRW_MATH_SATURATE_NONE, + 2, brw_null_reg(), + BRW_MATH_PRECISION_FULL); + } else { + brw_math(p, dst[3], + BRW_MATH_FUNCTION_INV, + BRW_MATH_SATURATE_NONE, + 2, brw_null_reg(), + BRW_MATH_DATA_VECTOR, + BRW_MATH_PRECISION_FULL); + } } } - -static void emit_linterp( struct brw_compile *p, - const struct brw_reg *dst, - GLuint mask, - const struct brw_reg *arg0, - const struct brw_reg *deltas ) +void emit_linterp(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *deltas) { struct brw_reg interp[4]; GLuint nr = arg0[0].nr; @@ -199,12 +218,12 @@ static void emit_linterp( struct brw_compile *p, } -static void emit_pinterp( struct brw_compile *p, - const struct brw_reg *dst, - GLuint mask, - const struct brw_reg *arg0, - const struct brw_reg *deltas, - const struct brw_reg *w) +void emit_pinterp(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *deltas, + const struct brw_reg *w) { struct brw_reg interp[4]; GLuint nr = arg0[0].nr; @@ -229,10 +248,10 @@ static void emit_pinterp( struct brw_compile *p, } -static void emit_cinterp( struct brw_compile *p, - const struct brw_reg *dst, - GLuint mask, - const struct brw_reg *arg0 ) +void emit_cinterp(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0) { struct brw_reg interp[4]; GLuint nr = arg0[0].nr; @@ -251,9 +270,9 @@ 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 ) +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; @@ -1316,7 +1335,7 @@ void brw_wm_emit( struct brw_wm_compile *c ) /* Generated instructions for calculating triangle interpolants: */ case WM_PIXELXY: - emit_pixel_xy(p, dst, dst_flags); + emit_pixel_xy(c, dst, dst_flags); break; case WM_DELTAXY: @@ -1328,7 +1347,7 @@ void brw_wm_emit( struct brw_wm_compile *c ) break; case WM_PIXELW: - emit_pixel_w(p, dst, dst_flags, args[0], args[1]); + emit_pixel_w(c, dst, dst_flags, args[0], args[1]); break; case WM_LINTERP: diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 02b119154f..d0987362a4 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -671,67 +671,6 @@ unalias3(struct brw_wm_compile *c, release_tmps(c, mark); } -static void emit_pixel_xy(struct brw_wm_compile *c, - const struct prog_instruction *inst) -{ - struct brw_reg r1 = brw_vec1_grf(1, 0); - struct brw_reg r1_uw = retype(r1, BRW_REGISTER_TYPE_UW); - - struct brw_reg dst0, dst1; - struct brw_compile *p = &c->func; - GLuint mask = inst->DstReg.WriteMask; - - 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. - */ - if (mask & WRITEMASK_X) { - brw_ADD(p, - vec8(retype(dst0, BRW_REGISTER_TYPE_UW)), - stride(suboffset(r1_uw, 4), 2, 4, 0), - brw_imm_v(0x10101010)); - } - - if (mask & WRITEMASK_Y) { - brw_ADD(p, - vec8(retype(dst1, BRW_REGISTER_TYPE_UW)), - stride(suboffset(r1_uw, 5), 2, 4, 0), - brw_imm_v(0x11001100)); - } -} - -static void emit_delta_xy(struct brw_wm_compile *c, - const struct prog_instruction *inst) -{ - struct brw_reg r1 = brw_vec1_grf(1, 0); - struct brw_reg dst0, dst1, src0, src1; - struct brw_compile *p = &c->func; - GLuint mask = inst->DstReg.WriteMask; - - dst0 = get_dst_reg(c, inst, 0); - dst1 = get_dst_reg(c, inst, 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. - */ - if (mask & WRITEMASK_X) { - brw_ADD(p, - dst0, - retype(src0, BRW_REGISTER_TYPE_UW), - negate(r1)); - } - - if (mask & WRITEMASK_Y) { - brw_ADD(p, - dst1, - retype(src1, BRW_REGISTER_TYPE_UW), - negate(suboffset(r1,1))); - - } -} - static void fire_fb_write( struct brw_wm_compile *c, GLuint base_reg, GLuint nr, @@ -829,154 +768,6 @@ static void emit_fb_write(struct brw_wm_compile *c, fire_fb_write(c, 0, nr, target, eot); } -static void emit_pixel_w( struct brw_wm_compile *c, - const struct prog_instruction *inst) -{ - struct brw_compile *p = &c->func; - GLuint mask = inst->DstReg.WriteMask; - if (mask & WRITEMASK_W) { - struct brw_reg dst, src0, delta0, delta1; - struct brw_reg interp3; - - dst = get_dst_reg(c, inst, 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); - - interp3 = brw_vec1_grf(src0.nr+1, 4); - /* Calc 1/w - just linterp wpos[3] optimized by putting the - * result straight into a message reg. - */ - brw_LINE(p, brw_null_reg(), interp3, delta0); - brw_MAC(p, brw_message_reg(2), suboffset(interp3, 1), delta1); - - /* Calc w */ - brw_math_16( p, dst, - BRW_MATH_FUNCTION_INV, - BRW_MATH_SATURATE_NONE, - 2, brw_null_reg(), - BRW_MATH_PRECISION_FULL); - } -} - -static void emit_linterp(struct brw_wm_compile *c, - const struct prog_instruction *inst) -{ - struct brw_compile *p = &c->func; - GLuint mask = inst->DstReg.WriteMask; - struct brw_reg interp[4]; - struct brw_reg dst, delta0, delta1; - struct brw_reg src0; - GLuint nr, i; - - 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); - interp[1] = brw_vec1_grf(nr, 4); - interp[2] = brw_vec1_grf(nr+1, 0); - interp[3] = brw_vec1_grf(nr+1, 4); - - for(i = 0; i < 4; i++ ) { - if (mask & (1<func; - GLuint mask = inst->DstReg.WriteMask; - - struct brw_reg interp[4]; - struct brw_reg dst, src0; - GLuint nr, i; - - src0 = get_src_reg(c, inst, 0, 0); - nr = src0.nr; - - interp[0] = brw_vec1_grf(nr, 0); - interp[1] = brw_vec1_grf(nr, 4); - interp[2] = brw_vec1_grf(nr+1, 0); - interp[3] = brw_vec1_grf(nr+1, 4); - - for(i = 0; i < 4; i++ ) { - if (mask & (1<func; - GLuint mask = inst->DstReg.WriteMask; - - struct brw_reg interp[4]; - struct brw_reg dst, delta0, delta1; - struct brw_reg src0, w; - GLuint nr, i; - - 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); - interp[1] = brw_vec1_grf(nr, 4); - interp[2] = brw_vec1_grf(nr+1, 0); - interp[3] = brw_vec1_grf(nr+1, 4); - - for(i = 0; i < 4; i++ ) { - if (mask & (1<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<func; - GLuint mask = inst->DstReg.WriteMask; - struct brw_reg src0[2], dst[2]; - - dst[0] = get_dst_reg(c, inst, 0); - dst[1] = get_dst_reg(c, inst, 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. - */ - if (mask & WRITEMASK_X) { - /* X' = X - origin_x */ - brw_ADD(p, - dst[0], - retype(src0[0], BRW_REGISTER_TYPE_W), - brw_imm_d(0 - c->key.origin_x)); - } - - if (mask & WRITEMASK_Y) { - /* Y' = height - (Y - origin_y) = height + origin_y - Y */ - brw_ADD(p, - dst[1], - negate(retype(src0[1], BRW_REGISTER_TYPE_W)), - brw_imm_d(c->key.origin_y + c->key.drawable_height - 1)); - } -} /* TODO BIAS on SIMD8 not working yet... @@ -2378,31 +2137,31 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) switch (inst->Opcode) { case WM_PIXELXY: - emit_pixel_xy(c, inst); + emit_pixel_xy(c, dst, dst_flags); break; case WM_DELTAXY: - emit_delta_xy(c, inst); + emit_delta_xy(p, dst, dst_flags, args[0]); break; case WM_PIXELW: - emit_pixel_w(c, inst); + emit_pixel_w(c, dst, dst_flags, args[0], args[1]); break; case WM_LINTERP: - emit_linterp(c, inst); + emit_linterp(p, dst, dst_flags, args[0], args[1]); break; case WM_PINTERP: - emit_pinterp(c, inst); + emit_pinterp(p, dst, dst_flags, args[0], args[1], args[2]); break; case WM_CINTERP: - emit_cinterp(c, inst); + emit_cinterp(p, dst, dst_flags, args[0]); break; case WM_WPOSXY: - emit_wpos_xy(c, inst); + emit_wpos_xy(c, dst, dst_flags, args[0]); break; case WM_FB_WRITE: emit_fb_write(c, inst); break; case WM_FRONTFACING: - emit_frontfacing(c, inst); + emit_frontfacing(p, dst, dst_flags); break; case OPCODE_ADD: emit_alu2(p, brw_ADD, dst, dst_flags, args[0], args[1]); -- cgit v1.2.3 From cfa927766ab610a9a76730d337d77008d876ebbd Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 19 Aug 2009 11:48:09 -0700 Subject: i965: Share emit_fb_write() between brw_wm_emit.c and brw_wm_glsl.c This should fix issues with antialiased lines in GLSL. --- src/mesa/drivers/dri/i965/brw_wm.h | 6 ++ src/mesa/drivers/dri/i965/brw_wm_emit.c | 56 +++++++++--------- src/mesa/drivers/dri/i965/brw_wm_fp.c | 4 +- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 101 +------------------------------- 4 files changed, 40 insertions(+), 127 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index eba828f6e3..bde0c366bd 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -353,6 +353,12 @@ void emit_dph(struct brw_compile *p, GLuint mask, const struct brw_reg *arg0, const struct brw_reg *arg1); +void emit_fb_write(struct brw_wm_compile *c, + struct brw_reg *arg0, + struct brw_reg *arg1, + struct brw_reg *arg2, + GLuint target, + GLuint eot); void emit_frontfacing(struct brw_compile *p, const struct brw_reg *dst, GLuint mask); diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 6eaa2792be..d02e3cb9ac 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -1042,7 +1042,13 @@ static void fire_fb_write( struct brw_wm_compile *c, GLuint eot ) { struct brw_compile *p = &c->func; - + struct brw_reg dst; + + if (c->dispatch_width == 16) + dst = retype(vec16(brw_null_reg()), BRW_REGISTER_TYPE_UW); + else + dst = retype(vec8(brw_null_reg()), BRW_REGISTER_TYPE_UW); + /* Pass through control information: */ /* mov (8) m1.0<1>:ud r1.0<8;8,1>:ud { Align1 NoMask } */ @@ -1059,7 +1065,7 @@ static void fire_fb_write( struct brw_wm_compile *c, /* Send framebuffer write message: */ /* send (16) null.0<1>:uw m0 r0.0<8;8,1>:uw 0x85a04000:ud { Align1 EOT } */ brw_fb_WRITE(p, - retype(vec16(brw_null_reg()), BRW_REGISTER_TYPE_UW), + dst, base_reg, retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW), target, @@ -1091,12 +1097,12 @@ static void emit_aa( struct brw_wm_compile *c, * \param arg1 the pass-through depth value * \param arg2 the shader-computed depth value */ -static void emit_fb_write( struct brw_wm_compile *c, - struct brw_reg *arg0, - struct brw_reg *arg1, - struct brw_reg *arg2, - GLuint target, - GLuint eot) +void emit_fb_write(struct brw_wm_compile *c, + struct brw_reg *arg0, + struct brw_reg *arg1, + struct brw_reg *arg2, + GLuint target, + GLuint eot) { struct brw_compile *p = &c->func; GLuint nr = 2; @@ -1110,30 +1116,27 @@ static void emit_fb_write( struct brw_wm_compile *c, /* I don't really understand how this achieves the color interleave * (ie RGBARGBA) in the result: [Do the saturation here] */ - { - brw_push_insn_state(p); - - for (channel = 0; channel < 4; 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_push_insn_state(p); - brw_set_compression_control(p, BRW_COMPRESSION_NONE); - brw_MOV(p, - brw_message_reg(nr + channel), - arg0[channel]); - + for (channel = 0; channel < 4; 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_set_compression_control(p, BRW_COMPRESSION_NONE); + brw_MOV(p, + brw_message_reg(nr + channel), + arg0[channel]); + + if (c->dispatch_width == 16) { brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF); brw_MOV(p, brw_message_reg(nr + channel + 4), sechalf(arg0[channel])); } - - /* skip over the regs populated above: - */ - nr += 8; - - brw_pop_insn_state(p); } + /* skip over the regs populated above: + */ + nr += 8; + brw_pop_insn_state(p); if (c->key.source_depth_to_render_target) { @@ -1183,7 +1186,7 @@ static void emit_fb_write( struct brw_wm_compile *c, get_element_ud(brw_vec8_grf(1,0), 6), brw_imm_ud(1<<26)); - jmp = brw_JMPI(p, ip, ip, brw_imm_d(0)); + jmp = brw_JMPI(p, ip, ip, brw_imm_w(0)); { emit_aa(c, arg1, 2); fire_fb_write(c, 0, nr, target, eot); @@ -1197,7 +1200,6 @@ static void emit_fb_write( struct brw_wm_compile *c, } } - /** * Move a GPR to scratch memory. */ diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index a453250e79..549afd31de 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -956,7 +956,7 @@ static void precalc_txp( struct brw_wm_compile *c, -static void emit_fb_write( struct brw_wm_compile *c ) +static void emit_render_target_writes( struct brw_wm_compile *c ) { struct prog_src_register payload_r0_depth = src_reg(PROGRAM_PAYLOAD, PAYLOAD_DEPTH); struct prog_src_register outdepth = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DEPTH); @@ -1153,7 +1153,7 @@ void brw_wm_pass_fp( struct brw_wm_compile *c ) out->DstReg.WriteMask = 0; break; case OPCODE_END: - emit_fb_write(c); + emit_render_target_writes(c); break; case OPCODE_PRINT: break; diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index d0987362a4..be89bcf4ba 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -671,103 +671,6 @@ unalias3(struct brw_wm_compile *c, release_tmps(c, mark); } -static void fire_fb_write( struct brw_wm_compile *c, - GLuint base_reg, - GLuint nr, - GLuint target, - GLuint eot) -{ - struct brw_compile *p = &c->func; - /* Pass through control information: - */ - /* mov (8) m1.0<1>:ud r1.0<8;8,1>:ud { Align1 NoMask } */ - { - brw_push_insn_state(p); - brw_set_mask_control(p, BRW_MASK_DISABLE); /* ? */ - brw_MOV(p, - brw_message_reg(base_reg + 1), - brw_vec8_grf(1, 0)); - brw_pop_insn_state(p); - } - /* Send framebuffer write message: */ - brw_fb_WRITE(p, - retype(vec8(brw_null_reg()), BRW_REGISTER_TYPE_UW), - base_reg, - retype(brw_vec8_grf(0, 0), BRW_REGISTER_TYPE_UW), - target, - nr, - 0, - eot); -} - -static void emit_fb_write(struct brw_wm_compile *c, - const struct prog_instruction *inst) -{ - struct brw_compile *p = &c->func; - int nr = 2; - int channel; - GLuint target, eot; - struct brw_reg src0; - - /* Reserve a space for AA - may not be needed: - */ - if (c->key.aa_dest_stencil_reg) - nr += 1; - - brw_push_insn_state(p); - for (channel = 0; channel < 4; 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); - } - /* skip over the regs populated above: */ - nr += 8; - brw_pop_insn_state(p); - - if (c->key.source_depth_to_render_target) { - if (c->key.computes_depth) { - src0 = get_src_reg(c, inst, 2, 2); - brw_MOV(p, brw_message_reg(nr), src0); - } - else { - src0 = get_src_reg(c, inst, 1, 1); - brw_MOV(p, brw_message_reg(nr), src0); - } - - nr += 2; - } - - if (c->key.dest_depth_reg) { - const GLuint comp = c->key.dest_depth_reg / 2; - const GLuint off = c->key.dest_depth_reg % 2; - - if (off != 0) { - /* XXX this code needs review/testing */ - struct brw_reg arg1_0 = get_src_reg(c, inst, 1, comp); - struct brw_reg arg1_1 = get_src_reg(c, inst, 1, comp+1); - - brw_push_insn_state(p); - brw_set_compression_control(p, BRW_COMPRESSION_NONE); - - brw_MOV(p, brw_message_reg(nr), offset(arg1_0, 1)); - /* 2nd half? */ - brw_MOV(p, brw_message_reg(nr+1), arg1_1); - brw_pop_insn_state(p); - } - else - { - struct brw_reg src = get_src_reg(c, inst, 1, 1); - brw_MOV(p, brw_message_reg(nr), src); - } - nr += 2; - } - - target = INST_AUX_GET_TARGET(inst->Aux); - eot = inst->Aux & INST_AUX_EOT; - fire_fb_write(c, 0, nr, target, eot); -} - static void emit_arl(struct brw_wm_compile *c, const struct prog_instruction *inst) { @@ -2158,7 +2061,9 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) emit_wpos_xy(c, dst, dst_flags, args[0]); break; case WM_FB_WRITE: - emit_fb_write(c, inst); + emit_fb_write(c, args[0], args[1], args[2], + INST_AUX_GET_TARGET(inst->Aux), + inst->Aux & INST_AUX_EOT); break; case WM_FRONTFACING: emit_frontfacing(p, dst, dst_flags); -- cgit v1.2.3 From ec66644ed0af976cacb069ca7c7f0d6731666359 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 19 Aug 2009 11:57:32 -0700 Subject: i965: Share min/max between brw_wm_emit.c and brw_wm_glsl.c --- src/mesa/drivers/dri/i965/brw_wm.h | 10 ++++ src/mesa/drivers/dri/i965/brw_wm_emit.c | 20 +++---- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 102 ++++++++++++++++---------------- 3 files changed, 72 insertions(+), 60 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index bde0c366bd..1fa2f1c06c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -390,6 +390,16 @@ void emit_math2(struct brw_wm_compile *c, GLuint mask, const struct brw_reg *arg0, const struct brw_reg *arg1); +void emit_min(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1); +void emit_max(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1); void emit_pinterp(struct brw_compile *p, const struct brw_reg *dst, GLuint mask, diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index d02e3cb9ac..9cd1fedacb 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -567,11 +567,11 @@ static void emit_cmp( struct brw_compile *p, } } -static void emit_max( struct brw_compile *p, - const struct brw_reg *dst, - GLuint mask, - const struct brw_reg *arg0, - const struct brw_reg *arg1 ) +void emit_max(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1) { GLuint i; @@ -591,11 +591,11 @@ static void emit_max( struct brw_compile *p, } } -static void emit_min( struct brw_compile *p, - const struct brw_reg *dst, - GLuint mask, - const struct brw_reg *arg0, - const struct brw_reg *arg1 ) +void emit_min(struct brw_compile *p, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1) { GLuint i; diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index be89bcf4ba..9d3bc66f49 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -671,6 +671,55 @@ unalias3(struct brw_wm_compile *c, release_tmps(c, mark); } +/* Workaround for using brw_wm_emit.c's emit functions, which expect + * destination regs to be uniquely written. Moves arguments out to + * temporaries as necessary for instructions which use their destination as + * a temporary. + */ +static void +unalias2(struct brw_wm_compile *c, + void (*func)(struct brw_compile *c, + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1), + const struct brw_reg *dst, + GLuint mask, + const struct brw_reg *arg0, + const struct brw_reg *arg1) +{ + struct brw_compile *p = &c->func; + struct brw_reg tmp_arg0[4], tmp_arg1[4]; + int i, j; + int mark = mark_tmps(c); + + for (j = 0; j < 4; j++) { + tmp_arg0[j] = arg0[j]; + tmp_arg1[j] = arg1[j]; + } + + for (i = 0; i < 4; i++) { + if (mask & (1<func; - 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); - - 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); -} - /** * For GLSL shaders, this KIL will be unconditional. * It may be contained inside an IF/ENDIF structure of course. @@ -2122,8 +2122,10 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) emit_math1(c, BRW_MATH_FUNCTION_LOG, dst, dst_flags, args[0]); break; case OPCODE_MIN: + unalias2(c, emit_min, dst, dst_flags, args[0], args[1]); + break; case OPCODE_MAX: - emit_min_max(c, inst); + unalias2(c, emit_max, dst, dst_flags, args[0], args[1]); break; case OPCODE_DDX: case OPCODE_DDY: -- cgit v1.2.3 From 8baee3d25beb616f6d5ba575684e889d60e38740 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 6 Nov 2009 17:45:13 -0800 Subject: i965: Use Compr4 instruction compression mode on G4X and newer. No statistically significant performance difference at n=3 with either openarena or my GL demo, but cutting program size seems like a good thing to be doing for the hypothetical app that has a working set near icache size. --- src/mesa/drivers/dri/i965/brw_eu.h | 10 +++++----- src/mesa/drivers/dri/i965/brw_eu_emit.c | 3 ++- src/mesa/drivers/dri/i965/brw_wm_emit.c | 33 ++++++++++++++++++++++----------- 3 files changed, 29 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_eu.h b/src/mesa/drivers/dri/i965/brw_eu.h index 30603bdd0e..39eb88d7c2 100644 --- a/src/mesa/drivers/dri/i965/brw_eu.h +++ b/src/mesa/drivers/dri/i965/brw_eu.h @@ -170,11 +170,11 @@ static INLINE struct brw_reg brw_reg( GLuint file, GLuint writemask ) { struct brw_reg reg; - if (type == BRW_GENERAL_REGISTER_FILE) + if (file == BRW_GENERAL_REGISTER_FILE) assert(nr < BRW_MAX_GRF); - else if (type == BRW_MESSAGE_REGISTER_FILE) - assert(nr < BRW_MAX_MRF); - else if (type == BRW_ARCHITECTURE_REGISTER_FILE) + else if (file == BRW_MESSAGE_REGISTER_FILE) + assert((nr & ~(1 << 7)) < BRW_MAX_MRF); + else if (file == BRW_ARCHITECTURE_REGISTER_FILE) assert(nr <= BRW_ARF_IP); reg.type = type; @@ -538,7 +538,7 @@ static INLINE struct brw_reg brw_mask_reg( GLuint subnr ) static INLINE struct brw_reg brw_message_reg( GLuint nr ) { - assert(nr < BRW_MAX_MRF); + assert((nr & ~(1 << 7)) < BRW_MAX_MRF); return brw_vec8_reg(BRW_MESSAGE_REGISTER_FILE, nr, 0); diff --git a/src/mesa/drivers/dri/i965/brw_eu_emit.c b/src/mesa/drivers/dri/i965/brw_eu_emit.c index 241cdc33f8..7ceabba288 100644 --- a/src/mesa/drivers/dri/i965/brw_eu_emit.c +++ b/src/mesa/drivers/dri/i965/brw_eu_emit.c @@ -55,7 +55,8 @@ static void guess_execution_size( struct brw_instruction *insn, static void brw_set_dest( struct brw_instruction *insn, struct brw_reg dest ) { - if (dest.type != BRW_ARCHITECTURE_REGISTER_FILE) + if (dest.file != BRW_ARCHITECTURE_REGISTER_FILE && + dest.file != BRW_MESSAGE_REGISTER_FILE) assert(dest.nr < 128); insn->bits1.da1.dest_reg_file = dest.file; diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 9cd1fedacb..eb37ea1864 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -1105,6 +1105,7 @@ void emit_fb_write(struct brw_wm_compile *c, GLuint eot) { struct brw_compile *p = &c->func; + struct brw_context *brw = p->brw; GLuint nr = 2; GLuint channel; @@ -1119,18 +1120,28 @@ void emit_fb_write(struct brw_wm_compile *c, brw_push_insn_state(p); for (channel = 0; channel < 4; 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_set_compression_control(p, BRW_COMPRESSION_NONE); - brw_MOV(p, - brw_message_reg(nr + channel), - arg0[channel]); - - if (c->dispatch_width == 16) { - brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF); + if (c->dispatch_width == 16 && (BRW_IS_G4X(brw) || BRW_IS_IGDNG(brw))) { + /* By setting the high bit of the MRF register number, we indicate + * that we want COMPR4 mode - instead of doing the usual destination + * + 1 for the second half we get destination + 4. + */ brw_MOV(p, - brw_message_reg(nr + channel + 4), - sechalf(arg0[channel])); + brw_message_reg(nr + channel + (1 << 7)), + arg0[channel]); + } else { + /* 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_set_compression_control(p, BRW_COMPRESSION_NONE); + brw_MOV(p, + brw_message_reg(nr + channel), + arg0[channel]); + + if (c->dispatch_width == 16) { + brw_set_compression_control(p, BRW_COMPRESSION_2NDHALF); + brw_MOV(p, + brw_message_reg(nr + channel + 4), + sechalf(arg0[channel])); + } } } /* skip over the regs populated above: -- cgit v1.2.3 From 44cb5b5c663da4d218448cfd2386b431de35c8d2 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 7 Nov 2009 10:46:47 +0100 Subject: nv50: enable all 32 threads of a warp This should be the default setting. See also 7d967b9b7c08aea2a471c5bf6aced8bfafdae874. --- src/gallium/drivers/nv50/nv50_screen.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_screen.c b/src/gallium/drivers/nv50/nv50_screen.c index c8d0f1e4d8..e1b2f11239 100644 --- a/src/gallium/drivers/nv50/nv50_screen.c +++ b/src/gallium/drivers/nv50/nv50_screen.c @@ -309,7 +309,9 @@ nv50_screen_create(struct pipe_winsys *ws, struct nouveau_device *dev) so_method(so, screen->tesla, 0x121c, 1); so_data (so, 1); - /* try to activate all/more lanes (threads) in a warp */ + /* activate all 32 lanes (threads) in a warp */ + so_method(so, screen->tesla, 0x19a0, 1); + so_data (so, 0x2); so_method(so, screen->tesla, 0x1400, 1); so_data (so, 0xf); -- cgit v1.2.3 From 18768393d19dedee7d4282e84905bb396dd30960 Mon Sep 17 00:00:00 2001 From: brian Date: Sat, 7 Nov 2009 08:18:03 -0700 Subject: mesa: move code after decl Fixes bug 24967. --- src/mesa/shader/prog_optimize.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c index 94d3dce6ea..8638754e24 100644 --- a/src/mesa/shader/prog_optimize.c +++ b/src/mesa/shader/prog_optimize.c @@ -249,8 +249,9 @@ _mesa_remove_dead_code(struct gl_program *prog) for (j = 0; j < numSrc; j++) { if (inst->SrcReg[j].File == PROGRAM_TEMPORARY) { const GLuint index = inst->SrcReg[j].Index; + GLuint read_mask; ASSERT(index < MAX_PROGRAM_TEMPS); - int read_mask = get_src_arg_mask(inst, j); + read_mask = get_src_arg_mask(inst, j); if (inst->SrcReg[j].RelAddr) { if (dbg) -- cgit v1.2.3 From 57d77c6a4474beecdd22b97a8f5af6e4d2833d97 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Sat, 7 Nov 2009 19:31:18 +0000 Subject: i915g: Fix comment in is buffer referenced --- src/gallium/drivers/i915/i915_context.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/i915/i915_context.c b/src/gallium/drivers/i915/i915_context.c index e745f3342d..94c8aee30f 100644 --- a/src/gallium/drivers/i915/i915_context.c +++ b/src/gallium/drivers/i915/i915_context.c @@ -155,15 +155,11 @@ static unsigned int i915_is_buffer_referenced(struct pipe_context *pipe, struct pipe_buffer *buf) { - /** - * FIXME: Return the corrent result. We can't alays return referenced - * since it causes a double flush within the vbo module. + /* + * Since we never expose hardware buffers to the state tracker + * they can never be referenced, so this isn't a lie */ -#if 0 - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; -#else return 0; -#endif } -- cgit v1.2.3 From 6acb26eadfcb3c21fd09d0b22804b49de9a82cf7 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 25 Oct 2009 13:22:22 +0100 Subject: r300g: move vborender context function to seperate file r300g: Un-migrate r300_draw_render. It'll make maintaining the SW TCL path easier. --- src/gallium/drivers/r300/r300_render.c | 5 ++++- src/gallium/drivers/r300/r300_render.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index c36350d29e..634c803f2a 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -20,6 +20,9 @@ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/* r300_render: Vertex and index buffer primitive emission. Contains both + * HW TCL fastpath rendering, and SW TCL Draw-assisted rendering. */ + #include "draw/draw_context.h" #include "draw/draw_vbuf.h" @@ -38,7 +41,7 @@ /* r300_render: Vertex and index buffer primitive emission. */ #define R300_MAX_VBO_SIZE (1024 * 1024) -static uint32_t r300_translate_primitive(unsigned prim) +uint32_t r300_translate_primitive(unsigned prim) { switch (prim) { case PIPE_PRIM_POINTS: diff --git a/src/gallium/drivers/r300/r300_render.h b/src/gallium/drivers/r300/r300_render.h index 3d8f47ba75..3f8ac1fb7a 100644 --- a/src/gallium/drivers/r300/r300_render.h +++ b/src/gallium/drivers/r300/r300_render.h @@ -23,6 +23,8 @@ #ifndef R300_RENDER_H #define R300_RENDER_H +uint32_t r300_translate_primitive(unsigned prim); + boolean r300_draw_range_elements(struct pipe_context* pipe, struct pipe_buffer* indexBuffer, unsigned indexSize, -- cgit v1.2.3 From c7dfffc5d5078e3cf1c28c230177cbbb43b91131 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 25 Oct 2009 12:08:02 +0100 Subject: r300g: enable CS dumping --- src/gallium/drivers/r300/r300_cs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_cs.h b/src/gallium/drivers/r300/r300_cs.h index 883f0a02dc..86ba91db52 100644 --- a/src/gallium/drivers/r300/r300_cs.h +++ b/src/gallium/drivers/r300/r300_cs.h @@ -34,8 +34,8 @@ #define MAX_CS_SIZE 64 * 1024 / 4 -#define VERY_VERBOSE_CS 0 -#define VERY_VERBOSE_REGISTERS 0 +#define VERY_VERBOSE_CS 1 +#define VERY_VERBOSE_REGISTERS 1 /* XXX stolen from radeon_drm.h */ #define RADEON_GEM_DOMAIN_CPU 0x1 -- cgit v1.2.3 From d8592d1724d8c8fd0b36eb21f4007b52f809e062 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 1 Nov 2009 17:04:32 +0100 Subject: r300g: add missing flush --- src/gallium/drivers/r300/r300_state.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 658a8cba13..bed886fad0 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -577,6 +577,8 @@ static void r300_set_sampler_textures(struct pipe_context* pipe, if (count > 8) { return; } + + r300->context.flush(&r300->context, 0, NULL); for (i = 0; i < count; i++) { if (r300->textures[i] != (struct r300_texture*)texture[i]) { -- cgit v1.2.3 From 3445f476977ae403cef9ca15661fa0f96ff50eca Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 25 Oct 2009 13:53:25 +0100 Subject: r300g: VBOs WIP --- src/gallium/drivers/r300/Makefile | 1 + src/gallium/drivers/r300/r300_context.c | 14 +- src/gallium/drivers/r300/r300_context.h | 27 +-- src/gallium/drivers/r300/r300_emit.c | 108 +++++++++++- src/gallium/drivers/r300/r300_emit.h | 12 ++ src/gallium/drivers/r300/r300_render.c | 135 +++++++-------- src/gallium/drivers/r300/r300_state.c | 13 +- src/gallium/drivers/r300/r300_state_derived.c | 14 +- src/gallium/drivers/r300/r300_vbo.c | 226 ++++++++++++++++++++++++++ src/gallium/drivers/r300/r300_vbo.h | 36 ++++ 10 files changed, 477 insertions(+), 109 deletions(-) create mode 100644 src/gallium/drivers/r300/r300_vbo.c create mode 100644 src/gallium/drivers/r300/r300_vbo.h (limited to 'src') diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile index f73d80de88..d13bb7a36b 100644 --- a/src/gallium/drivers/r300/Makefile +++ b/src/gallium/drivers/r300/Makefile @@ -17,6 +17,7 @@ C_SOURCES = \ r300_state.c \ r300_state_derived.c \ r300_state_invariant.c \ + r300_vbo.c \ r300_vs.c \ r300_texture.c \ r300_tgsi_to_rc.c diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index f974147ea4..b520e5929e 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -104,6 +104,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, struct r300_winsys* r300_winsys) { struct r300_context* r300 = CALLOC_STRUCT(r300_context); + struct r300_screen* r300screen = r300_screen(screen); if (!r300) return NULL; @@ -119,9 +120,16 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->context.clear = r300_clear; - r300->context.draw_arrays = r300_draw_arrays; - r300->context.draw_elements = r300_draw_elements; - r300->context.draw_range_elements = r300_swtcl_draw_range_elements; + if (r300screen->caps->has_tcl) + { + r300->context.draw_arrays = r300_draw_arrays; + r300->context.draw_elements = r300_draw_elements; + r300->context.draw_range_elements = r300_draw_range_elements; + } + else + { + assert(0); + } r300->context.is_texture_referenced = r300_is_texture_referenced; r300->context.is_buffer_referenced = r300_is_buffer_referenced; diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 850e5a41c9..a6748852d8 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -216,18 +216,19 @@ struct r300_texture { struct r300_texture_state state; }; -struct r300_vertex_format { +struct r300_vertex_info { /* Parent class */ struct vertex_info vinfo; - /* R300_VAP_PROG_STREAK_CNTL_[0-7] */ - uint32_t vap_prog_stream_cntl[8]; - /* R300_VAP_PROG_STREAK_CNTL_EXT_[0-7] */ - uint32_t vap_prog_stream_cntl_ext[8]; /* Map of vertex attributes into PVS memory for HW TCL, * or GA memory for SW TCL. */ int vs_tab[16]; /* Map of rasterizer attributes from GB through RS to US. */ int fs_tab[16]; + + /* R300_VAP_PROG_STREAK_CNTL_[0-7] */ + uint32_t vap_prog_stream_cntl[8]; + /* R300_VAP_PROG_STREAK_CNTL_EXT_[0-7] */ + uint32_t vap_prog_stream_cntl_ext[8]; }; extern struct pipe_viewport_state r300_viewport_identity; @@ -256,7 +257,7 @@ struct r300_context { * depends on the combination of both currently loaded shaders. */ struct util_hash_table* shader_hash_table; /* Vertex formatting information. */ - struct r300_vertex_format* vertex_info; + struct r300_vertex_info* vertex_info; /* Various CSO state objects. */ /* Blend state. */ @@ -285,12 +286,6 @@ struct r300_context { /* Texture states. */ struct r300_texture* textures[8]; int texture_count; - /* Vertex buffers for Gallium. */ - struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS]; - int vertex_buffer_count; - /* Vertex elements for Gallium. */ - struct pipe_vertex_element vertex_elements[PIPE_MAX_ATTRIBS]; - int vertex_element_count; /* Vertex shader. */ struct r300_vertex_shader* vs; /* Viewport state. */ @@ -298,6 +293,14 @@ struct r300_context { /* ZTOP state. */ struct r300_ztop_state ztop_state; + /* Vertex buffers for Gallium. */ + struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; + int vbuf_count; + /* Vertex elements for Gallium. */ + struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS]; + int aos_count; + unsigned hw_prim; + /* Bitmask of dirty state objects. */ uint32_t dirty_state; /* Flag indicating whether or not the HW is dirty. */ diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 69ce5966e8..92e6ec606c 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -582,7 +582,48 @@ void r300_emit_texture(struct r300_context* r300, END_CS; } -void r300_emit_vertex_buffer(struct r300_context* r300) +void r300_emit_aos(struct r300_context* r300, unsigned offset) +{ + struct pipe_vertex_buffer *vbuf = r300->vertex_buffer; + struct pipe_vertex_element *velem = r300->vertex_element; + CS_LOCALS(r300); + int i; + unsigned packet_size = (r300->aos_count * 3 + 1) / 2; + BEGIN_CS(2 + packet_size + r300->aos_count * 2); + OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, packet_size); + OUT_CS(r300->aos_count); + for (i = 0; i < r300->aos_count - 1; i += 2) { + int buf_num1 = velem[i].vertex_buffer_index; + int buf_num2 = velem[i+1].vertex_buffer_index; + assert(vbuf[buf_num1].stride % 4 == 0 && pf_get_size(velem[i].src_format) % 4 == 0); + assert(vbuf[buf_num2].stride % 4 == 0 && pf_get_size(velem[i+1].src_format) % 4 == 0); + OUT_CS((pf_get_size(velem[i].src_format) >> 2) | (vbuf[buf_num1].stride << 6) | + (pf_get_size(velem[i+1].src_format) << 14) | (vbuf[buf_num2].stride << 22)); + OUT_CS(vbuf[buf_num1].buffer_offset + velem[i].src_offset + + offset * vbuf[buf_num1].stride); + OUT_CS(vbuf[buf_num2].buffer_offset + velem[i+1].src_offset + + offset * vbuf[buf_num2].stride); + } + if (r300->aos_count & 1) { + int buf_num = velem[i].vertex_buffer_index; + assert(vbuf[buf_num].stride % 4 == 0 && pf_get_size(velem[i].src_format) % 4 == 0); + OUT_CS((pf_get_size(velem[i].src_format) >> 2) | (vbuf[buf_num].stride << 6)); + OUT_CS(vbuf[buf_num].buffer_offset + velem[i].src_offset + + offset * vbuf[buf_num].stride); + } + + for (i = 0; i < r300->aos_count; i++) { + cs_winsys->write_cs_reloc(cs_winsys, + vbuf[velem[i].vertex_buffer_index].buffer, + RADEON_GEM_DOMAIN_GTT, + 0, + 0); + cs_count -= 2; + } + END_CS; +} +#if 0 +void r300_emit_draw_packet(struct r300_context* r300) { CS_LOCALS(r300); @@ -605,6 +646,65 @@ void r300_emit_vertex_buffer(struct r300_context* r300) OUT_CS_RELOC(r300->vbo, 0, RADEON_GEM_DOMAIN_GTT, 0, 0); END_CS; } +#endif +void r300_emit_draw_arrays(struct r300_context *r300, + unsigned count) +{ + CS_LOCALS(r300); + assert(count < 65536); + + BEGIN_CS(4); + OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, count); + OUT_CS_PKT3(R300_PACKET3_3D_DRAW_VBUF_2, 0); + OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (count << 16) | + r300->hw_prim); + END_CS; +} + +void r300_emit_draw_elements(struct r300_context *r300, + struct pipe_buffer* indexBuffer, + unsigned indexSize, + unsigned minIndex, + unsigned maxIndex, + unsigned start, + unsigned count) +{ + CS_LOCALS(r300); + assert(indexSize == 4 || indexSize == 2); + assert(count < 65536); + assert((start * indexSize) % 4 == 0); + + uint32_t size_dwords; + uint32_t skip_dwords = indexSize * start / sizeof(uint32_t); + assert(skip_dwords == 0); + + BEGIN_CS(10); + OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, maxIndex); + OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, 0); + if (indexSize == 4) { + size_dwords = count + start; + OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (count << 16) | + R300_VAP_VF_CNTL__INDEX_SIZE_32bit | r300->hw_prim); + } else { + size_dwords = (count + start + 1) / 2; + OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | + (count << 16) | r300->hw_prim); + } + + OUT_CS_PKT3(R300_PACKET3_INDX_BUFFER, 2); + OUT_CS(R300_INDX_BUFFER_ONE_REG_WR | (R300_VAP_PORT_IDX0 >> 2) | + (0 << R300_INDX_BUFFER_SKIP_SHIFT)); + OUT_CS(skip_dwords); + OUT_CS(size_dwords); + cs_winsys->write_cs_reloc(cs_winsys, + indexBuffer, + RADEON_GEM_DOMAIN_GTT, + 0, + 0); + cs_count -= 2; + + END_CS; +} void r300_emit_vertex_format_state(struct r300_context* r300) { @@ -771,8 +871,6 @@ void r300_emit_dirty_state(struct r300_context* r300) return; } - r300_update_derived_state(r300); - /* Clean out BOs. */ r300->winsys->reset_bos(r300->winsys); @@ -823,7 +921,7 @@ validate: goto validate; } } else { - debug_printf("No VBO while emitting dirty state!\n"); + // debug_printf("No VBO while emitting dirty state!\n"); } if (!r300->winsys->validate(r300->winsys)) { r300->context.flush(&r300->context, 0, NULL); @@ -951,7 +1049,7 @@ validate: */ /* Finally, emit the VBO. */ - r300_emit_vertex_buffer(r300); + //r300_emit_vertex_buffer(r300); r300->dirty_hw++; } diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h index 6befca72ce..b4fdfecde0 100644 --- a/src/gallium/drivers/r300/r300_emit.h +++ b/src/gallium/drivers/r300/r300_emit.h @@ -29,6 +29,8 @@ struct rX00_fragment_program_code; struct r300_vertex_program_code; +void r300_emit_aos(struct r300_context* r300, unsigned offset); + void r300_emit_blend_state(struct r300_context* r300, struct r300_blend_state* blend); @@ -38,6 +40,16 @@ void r300_emit_blend_color_state(struct r300_context* r300, void r300_emit_clip_state(struct r300_context* r300, struct pipe_clip_state* clip); +void r300_emit_draw_arrays(struct r300_context *r300, unsigned count); + +void r300_emit_draw_elements(struct r300_context *r300, + struct pipe_buffer* indexBuffer, + unsigned indexSize, + unsigned minIndex, + unsigned maxIndex, + unsigned start, + unsigned count); + void r300_emit_dsa_state(struct r300_context* r300, struct r300_dsa_state* dsa); diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 634c803f2a..86aaf841dd 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -31,6 +31,7 @@ #include "util/u_memory.h" #include "util/u_prim.h" +#include "r300_vbo.h" #include "r300_cs.h" #include "r300_context.h" #include "r300_emit.h" @@ -69,98 +70,64 @@ uint32_t r300_translate_primitive(unsigned prim) } } -/* This is the fast-path drawing & emission for HW TCL. */ -boolean r300_draw_range_elements(struct pipe_context* pipe, - struct pipe_buffer* indexBuffer, - unsigned indexSize, - unsigned minIndex, - unsigned maxIndex, - unsigned mode, - unsigned start, - unsigned count) +static boolean setup_vertex_buffers(struct r300_context *r300) { - struct r300_context* r300 = r300_context(pipe); - uint32_t prim = r300_translate_primitive(mode); - struct pipe_vertex_buffer* aos = r300->vertex_buffers; - unsigned aos_count = r300->vertex_buffer_count; - short* indices; - unsigned packet_size; - unsigned i; - bool invalid = FALSE; - - CS_LOCALS(r300); - - if (!u_trim_pipe_prim(mode, &count)) { - return FALSE; - } + unsigned vbuf_count = r300->aos_count; + struct pipe_vertex_buffer *vbuf= r300->vertex_buffer; + struct pipe_vertex_element *velem= r300->vertex_element; + bool invalid = false; validate: - for (i = 0; i < aos_count; i++) { - if (!r300->winsys->add_buffer(r300->winsys, aos[i].buffer, - RADEON_GEM_DOMAIN_GTT, 0)) { - pipe->flush(pipe, 0, NULL); + for (int i = 0; i < vbuf_count; i++) { + if (!r300->winsys->add_buffer(r300->winsys, vbuf[velem[i].vertex_buffer_index].buffer, + RADEON_GEM_DOMAIN_GTT, 0)) { + r300->context.flush(&r300->context, 0, NULL); goto validate; } } + if (!r300->winsys->validate(r300->winsys)) { - pipe->flush(pipe, 0, NULL); + r300->context.flush(&r300->context, 0, NULL); if (invalid) { /* Well, hell. */ debug_printf("r300: Stuck in validation loop, gonna quit now."); exit(1); } - invalid = TRUE; + invalid = true; goto validate; } - r300_emit_dirty_state(r300); + return invalid; +} - packet_size = (aos_count >> 1) * 3 + (aos_count & 1) * 2; - - BEGIN_CS(3 + packet_size + (aos_count * 2)); - OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, packet_size); - OUT_CS(aos_count); - for (i = 0; i < aos_count - 1; i += 2) { - OUT_CS(aos[i].stride | - (aos[i].stride << 8) | - (aos[i + 1].stride << 16) | - (aos[i + 1].stride << 24)); - OUT_CS(aos[i].buffer_offset + start * 4 * aos[i].stride); - OUT_CS(aos[i + 1].buffer_offset + start * 4 * aos[i + 1].stride); - } - if (aos_count & 1) { - OUT_CS(aos[i].stride | (aos[i].stride << 8)); - OUT_CS(aos[i].buffer_offset + start * 4 * aos[i].stride); - } - for (i = 0; i < aos_count; i++) { - OUT_CS_RELOC(aos[i].buffer, 0, RADEON_GEM_DOMAIN_GTT, 0, 0); - } - END_CS; +/* This is the fast-path drawing & emission for HW TCL. */ +boolean r300_draw_range_elements(struct pipe_context* pipe, + struct pipe_buffer* indexBuffer, + unsigned indexSize, + unsigned minIndex, + unsigned maxIndex, + unsigned mode, + unsigned start, + unsigned count) +{ + struct r300_context* r300 = r300_context(pipe); - if (indexBuffer) { - indices = (short*)pipe_buffer_map(pipe->screen, indexBuffer, - PIPE_BUFFER_USAGE_CPU_READ); + r300_update_derived_state(r300); - /* Set the starting point. */ - indices += start; + setup_vertex_buffers(r300); - BEGIN_CS(2 + (count+1)/2); - OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, (count + 1)/2); - OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (count << 16) | prim); - for (i = 0; i < count - 1; i += 2) { - OUT_CS(indices[i + 1] << 16 | indices[i]); - } - if (count % 2) { - OUT_CS(indices[count - 1]); - } - END_CS; - } else { - 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) | - prim); - END_CS; - } + setup_vertex_attributes(r300); + + setup_index_buffer(r300, indexBuffer, indexSize); + + r300->hw_prim = r300_translate_primitive(mode); + + r300_emit_dirty_state(r300); + + r300_emit_aos(r300, 0); + + r300_emit_draw_elements(r300, indexBuffer, indexSize, minIndex, maxIndex, + start, count); return TRUE; } @@ -178,7 +145,23 @@ boolean r300_draw_elements(struct pipe_context* pipe, boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode, unsigned start, unsigned count) { - return pipe->draw_elements(pipe, NULL, 0, mode, start, count); + struct r300_context* r300 = r300_context(pipe); + + r300_update_derived_state(r300); + + setup_vertex_buffers(r300); + + setup_vertex_attributes(r300); + + r300->hw_prim = r300_translate_primitive(mode); + + r300_emit_dirty_state(r300); + + r300_emit_aos(r300, start); + + r300_emit_draw_arrays(r300, count); + + return TRUE; } /**************************************************************************** @@ -196,7 +179,9 @@ boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe, unsigned start, unsigned count) { + assert(0); struct r300_context* r300 = r300_context(pipe); +#if 0 int i; if (!u_trim_pipe_prim(mode, &count)) { @@ -236,7 +221,7 @@ boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe, draw_set_mapped_element_buffer_range(r300->draw, 0, start, start + count - 1, NULL); } - +#endif return TRUE; } diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index bed886fad0..e0b85ab768 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -666,10 +666,9 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe, { struct r300_context* r300 = r300_context(pipe); - memcpy(r300->vertex_buffers, buffers, + memcpy(r300->vertex_buffer, buffers, sizeof(struct pipe_vertex_buffer) * count); - - r300->vertex_buffer_count = count; + r300->vbuf_count = count; if (r300->draw) { draw_flush(r300->draw); @@ -683,10 +682,10 @@ static void r300_set_vertex_elements(struct pipe_context* pipe, { struct r300_context* r300 = r300_context(pipe); - memcpy(r300->vertex_elements, elements, - sizeof(struct pipe_vertex_element) * count); - - r300->vertex_element_count = count; + memcpy(r300->vertex_element, + elements, + sizeof(struct pipe_vertex_element) * count); + r300->aos_count = count; if (r300->draw) { draw_flush(r300->draw); diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 7d000e9e2d..14d7bb094c 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -63,7 +63,7 @@ int r300_shader_key_compare(void* key1, void* key2) { /* Set up the vs_tab and routes. */ static void r300_vs_tab_routes(struct r300_context* r300, - struct r300_vertex_format* vformat) + struct r300_vertex_info* vformat) { struct r300_screen* r300screen = r300_screen(r300->context.screen); struct vertex_info* vinfo = &vformat->vinfo; @@ -219,7 +219,7 @@ static void r300_vs_tab_routes(struct r300_context* r300, /* Update the PSC tables. */ static void r300_vertex_psc(struct r300_context* r300, - struct r300_vertex_format* vformat) + struct r300_vertex_info* vformat) { struct r300_screen* r300screen = r300_screen(r300->context.screen); struct vertex_info* vinfo = &vformat->vinfo; @@ -282,7 +282,7 @@ static void r300_vertex_psc(struct r300_context* r300, /* Set up the mappings from GB to US, for RS block. */ static void r300_update_fs_tab(struct r300_context* r300, - struct r300_vertex_format* vformat) + struct r300_vertex_info* vformat) { struct tgsi_shader_info* info = &r300->fs->info; int i, cols = 0, texs = 0, cols_emitted = 0; @@ -455,13 +455,13 @@ static void r300_update_rs_block(struct r300_context* r300, /* Update the vertex format. */ static void r300_update_derived_shader_state(struct r300_context* r300) { - struct r300_shader_key* key; - struct r300_vertex_format* vformat; + struct r300_vertex_info* vformat; struct r300_rs_block* rs_block; - struct r300_shader_derived_value* value; int i; /* + struct r300_shader_key* key; + struct r300_shader_derived_value* value; key = CALLOC_STRUCT(r300_shader_key); key->vs = r300->vs; key->fs = r300->fs; @@ -486,7 +486,7 @@ static void r300_update_derived_shader_state(struct r300_context* r300) } */ /* XXX This will be refactored ASAP. */ - vformat = CALLOC_STRUCT(r300_vertex_format); + vformat = CALLOC_STRUCT(r300_vertex_info); rs_block = CALLOC_STRUCT(r300_rs_block); for (i = 0; i < 16; i++) { diff --git a/src/gallium/drivers/r300/r300_vbo.c b/src/gallium/drivers/r300/r300_vbo.c new file mode 100644 index 0000000000..e032641286 --- /dev/null +++ b/src/gallium/drivers/r300/r300_vbo.c @@ -0,0 +1,226 @@ +/* + * Copyright 2009 Maciej Cencora + * + * 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_vbo.h" + +#include "pipe/p_format.h" + +#include "r300_cs.h" +#include "r300_context.h" +#include "r300_reg.h" +#include "r300_winsys.h" + +static void translate_vertex_format(enum pipe_format format, + unsigned nr_comps, + unsigned component_size, + unsigned dst_loc, + uint32_t *hw_fmt1, + uint32_t *hw_fmt2) +{ + uint32_t fmt1 = 0; + + switch (pf_type(format)) + { + case PIPE_FORMAT_TYPE_FLOAT: + assert(component_size == 4); + fmt1 = R300_DATA_TYPE_FLOAT_1 + nr_comps - 1; + break; + case PIPE_FORMAT_TYPE_UNORM: + case PIPE_FORMAT_TYPE_SNORM: + case PIPE_FORMAT_TYPE_USCALED: + case PIPE_FORMAT_TYPE_SSCALED: + if (component_size == 1) + { + assert(nr_comps == 4); + fmt1 = R300_DATA_TYPE_BYTE; + } + else if (component_size == 2) + { + if (nr_comps == 2) + fmt1 = R300_DATA_TYPE_SHORT_2; + else if (nr_comps == 4) + fmt1 = R300_DATA_TYPE_SHORT_4; + else + assert(0); + } + else + { + assert(0); + } + + if (pf_type(format) == PIPE_FORMAT_TYPE_SNORM) + { + fmt1 |= R300_SIGNED; + } + else if (pf_type(format) == PIPE_FORMAT_TYPE_SSCALED) + { + fmt1 |= R300_SIGNED; + fmt1 |= R300_NORMALIZE; + } + else if (pf_type(format) == PIPE_FORMAT_TYPE_USCALED) + { + fmt1 |= R300_NORMALIZE; + } + break; + default: + assert(0); + break; + } + + *hw_fmt1 = fmt1 | (dst_loc << R300_DST_VEC_LOC_SHIFT); + *hw_fmt2 = (pf_swizzle_x(format) << R300_SWIZZLE_SELECT_X_SHIFT) | + (pf_swizzle_y(format) << R300_SWIZZLE_SELECT_Y_SHIFT) | + (pf_swizzle_z(format) << R300_SWIZZLE_SELECT_Z_SHIFT) | + (pf_swizzle_w(format) << R300_SWIZZLE_SELECT_W_SHIFT) | + (0xf << R300_WRITE_ENA_SHIFT); +} + +static INLINE void setup_vertex_attribute(struct r300_vertex_info *vinfo, + struct pipe_vertex_element *vert_elem, + unsigned attr_num) +{ + uint32_t hw_fmt1, hw_fmt2; + translate_vertex_format(vert_elem->src_format, + vert_elem->nr_components, + pf_size_x(vert_elem->src_format), + attr_num, + &hw_fmt1, + &hw_fmt2); + + if (attr_num % 2 == 0) + { + vinfo->vap_prog_stream_cntl[attr_num >> 1] = hw_fmt1; + vinfo->vap_prog_stream_cntl_ext[attr_num >> 1] = hw_fmt2; + } + else + { + vinfo->vap_prog_stream_cntl[attr_num >> 1] |= hw_fmt1 << 16; + vinfo->vap_prog_stream_cntl_ext[attr_num >> 1] |= hw_fmt2 << 16; + } +} + +static void finish_vertex_attribs_setup(struct r300_vertex_info *vinfo, + unsigned attribs_num) +{ + uint32_t last_vec_bit = (attribs_num % 2 == 0) ? (R300_LAST_VEC << 16) : R300_LAST_VEC; + + assert(attribs_num > 0 && attribs_num <= 16); + vinfo->vap_prog_stream_cntl[(attribs_num - 1) >> 1] |= last_vec_bit; +} + +void setup_vertex_attributes(struct r300_context *r300) +{ + for (int i=0; iaos_count; i++) + { + struct pipe_vertex_element *vert_elem = &r300->vertex_element[i]; + + setup_vertex_attribute(r300->vertex_info, vert_elem, i); + } + + finish_vertex_attribs_setup(r300->vertex_info, r300->aos_count); +} + +static void setup_vertex_array(struct r300_context *r300, struct pipe_vertex_element *element) +{ +} + +static void finish_vertex_arrays_setup(struct r300_context *r300) +{ +} + +static bool format_is_supported(enum pipe_format format, int nr_components) +{ + if (pf_layout(format) != PIPE_FORMAT_LAYOUT_RGBAZS) + return false; + + if ((pf_size_x(format) != pf_size_y(format)) || + (pf_size_x(format) != pf_size_z(format)) || + (pf_size_x(format) != pf_size_w(format))) + return false; + + /* Following should be supported as long as stride is 4 bytes aligned */ + if (pf_size_x(format) != 1 && nr_components != 4) + return false; + + if (pf_size_x(format) != 2 && !(nr_components == 2 || nr_components == 4)) + return false; + + if (pf_size_x(format) == 3 || pf_size_x(format) > 4) + return false; + + return true; +} + +static INLINE int get_buffer_offset(struct r300_context *r300, + unsigned int buf_nr, + unsigned int elem_offset) +{ + return r300->vertex_buffer[buf_nr].buffer_offset + elem_offset; +} + +/** + */ +static void setup_vertex_buffers(struct r300_context *r300) +{ + for (int i=0; iaos_count; i++) + { + struct pipe_vertex_element *vert_elem = &r300->vertex_element[i]; + if (!format_is_supported(vert_elem->src_format, vert_elem->nr_components)) + { + assert(0); + /* use translate module to convert the data */ + /* + struct pipe_buffer *buf; + const unsigned int max_index = r300->vertex_buffers[vert_elem->vertex_buffer_index].max_index; + buf = pipe_buffer_create(r300->context.screen, 4, usage, vert_elem->nr_components * max_index * sizeof(float)); + */ + } + + if (get_buffer_offset(r300, vert_elem->vertex_buffer_index, vert_elem->src_offset) % 4 != 0) + { + /* need to align buffer */ + assert(0); + } + setup_vertex_array(r300, vert_elem); + } + + finish_vertex_arrays_setup(r300); +} + +void setup_index_buffer(struct r300_context *r300, + struct pipe_buffer* indexBuffer, + unsigned indexSize) +{ + assert(indexSize = 2); + + if (!r300->winsys->add_buffer(r300->winsys, indexBuffer, RADEON_GEM_DOMAIN_GTT, 0)) + { + assert(0); + } + + if (!r300->winsys->validate(r300->winsys)) + { + assert(0); + } +} + diff --git a/src/gallium/drivers/r300/r300_vbo.h b/src/gallium/drivers/r300/r300_vbo.h new file mode 100644 index 0000000000..7afa75899c --- /dev/null +++ b/src/gallium/drivers/r300/r300_vbo.h @@ -0,0 +1,36 @@ +/* + * Copyright 2009 Maciej Cencora + * + * 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_VBO_H +#define R300_VBO_H + +struct r300_context; +struct pipe_buffer; + +void setup_vertex_attributes(struct r300_context *r300); + +void setup_index_buffer(struct r300_context *r300, + struct pipe_buffer* indexBuffer, + unsigned indexSize); + +#endif -- cgit v1.2.3 From 1ef0341ea7ee08284ebafe4f347643e1190d5777 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 25 Oct 2009 13:51:45 +0100 Subject: r300g: don't hang GPU on misbehaving apps --- src/gallium/drivers/r300/r300_render.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 86aaf841dd..cbda30227d 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -112,6 +112,9 @@ boolean r300_draw_range_elements(struct pipe_context* pipe, { struct r300_context* r300 = r300_context(pipe); + if (!u_trim_pipe_prim(mode, &count)) + return false; + r300_update_derived_state(r300); setup_vertex_buffers(r300); @@ -147,6 +150,9 @@ boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode, { struct r300_context* r300 = r300_context(pipe); + if (!u_trim_pipe_prim(mode, &count)) + return false; + r300_update_derived_state(r300); setup_vertex_buffers(r300); -- cgit v1.2.3 From 24c6fdbd32a84314c81897d0d1567121ed1c6118 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 6 Nov 2009 20:21:38 -0800 Subject: r300g: Use common state funcs for translating vert formats. --- src/gallium/drivers/r300/r300_vbo.c | 78 +++---------------------------------- 1 file changed, 6 insertions(+), 72 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_vbo.c b/src/gallium/drivers/r300/r300_vbo.c index e032641286..37b5c9224f 100644 --- a/src/gallium/drivers/r300/r300_vbo.c +++ b/src/gallium/drivers/r300/r300_vbo.c @@ -27,85 +27,19 @@ #include "r300_cs.h" #include "r300_context.h" +#include "r300_state_inlines.h" #include "r300_reg.h" #include "r300_winsys.h" -static void translate_vertex_format(enum pipe_format format, - unsigned nr_comps, - unsigned component_size, - unsigned dst_loc, - uint32_t *hw_fmt1, - uint32_t *hw_fmt2) -{ - uint32_t fmt1 = 0; - - switch (pf_type(format)) - { - case PIPE_FORMAT_TYPE_FLOAT: - assert(component_size == 4); - fmt1 = R300_DATA_TYPE_FLOAT_1 + nr_comps - 1; - break; - case PIPE_FORMAT_TYPE_UNORM: - case PIPE_FORMAT_TYPE_SNORM: - case PIPE_FORMAT_TYPE_USCALED: - case PIPE_FORMAT_TYPE_SSCALED: - if (component_size == 1) - { - assert(nr_comps == 4); - fmt1 = R300_DATA_TYPE_BYTE; - } - else if (component_size == 2) - { - if (nr_comps == 2) - fmt1 = R300_DATA_TYPE_SHORT_2; - else if (nr_comps == 4) - fmt1 = R300_DATA_TYPE_SHORT_4; - else - assert(0); - } - else - { - assert(0); - } - - if (pf_type(format) == PIPE_FORMAT_TYPE_SNORM) - { - fmt1 |= R300_SIGNED; - } - else if (pf_type(format) == PIPE_FORMAT_TYPE_SSCALED) - { - fmt1 |= R300_SIGNED; - fmt1 |= R300_NORMALIZE; - } - else if (pf_type(format) == PIPE_FORMAT_TYPE_USCALED) - { - fmt1 |= R300_NORMALIZE; - } - break; - default: - assert(0); - break; - } - - *hw_fmt1 = fmt1 | (dst_loc << R300_DST_VEC_LOC_SHIFT); - *hw_fmt2 = (pf_swizzle_x(format) << R300_SWIZZLE_SELECT_X_SHIFT) | - (pf_swizzle_y(format) << R300_SWIZZLE_SELECT_Y_SHIFT) | - (pf_swizzle_z(format) << R300_SWIZZLE_SELECT_Z_SHIFT) | - (pf_swizzle_w(format) << R300_SWIZZLE_SELECT_W_SHIFT) | - (0xf << R300_WRITE_ENA_SHIFT); -} - static INLINE void setup_vertex_attribute(struct r300_vertex_info *vinfo, struct pipe_vertex_element *vert_elem, unsigned attr_num) { - uint32_t hw_fmt1, hw_fmt2; - translate_vertex_format(vert_elem->src_format, - vert_elem->nr_components, - pf_size_x(vert_elem->src_format), - attr_num, - &hw_fmt1, - &hw_fmt2); + uint16_t hw_fmt1, hw_fmt2; + + hw_fmt1 = r300_translate_vertex_data_type(vert_elem->src_format) | + (attr_num << R300_DST_VEC_LOC_SHIFT); + hw_fmt2 = r300_translate_vertex_data_swizzle(vert_elem->src_format); if (attr_num % 2 == 0) { -- cgit v1.2.3 From 96b729f926fafeca6479eed0933bc4275fb7843b Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 7 Nov 2009 09:47:01 -0800 Subject: r300g: Don't pass hw_prim around in the context. And some other fixes. --- src/gallium/drivers/r300/r300_context.h | 1 - src/gallium/drivers/r300/r300_emit.c | 58 ------------------------- src/gallium/drivers/r300/r300_emit.h | 10 ----- src/gallium/drivers/r300/r300_render.c | 76 +++++++++++++++++++++++++++++---- src/gallium/drivers/r300/r300_vbo.c | 10 +++-- 5 files changed, 74 insertions(+), 81 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index a6748852d8..8d14c53f49 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -299,7 +299,6 @@ struct r300_context { /* Vertex elements for Gallium. */ struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS]; int aos_count; - unsigned hw_prim; /* Bitmask of dirty state objects. */ uint32_t dirty_state; diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 92e6ec606c..ec1d521800 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -647,64 +647,6 @@ void r300_emit_draw_packet(struct r300_context* r300) END_CS; } #endif -void r300_emit_draw_arrays(struct r300_context *r300, - unsigned count) -{ - CS_LOCALS(r300); - assert(count < 65536); - - BEGIN_CS(4); - OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, count); - OUT_CS_PKT3(R300_PACKET3_3D_DRAW_VBUF_2, 0); - OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (count << 16) | - r300->hw_prim); - END_CS; -} - -void r300_emit_draw_elements(struct r300_context *r300, - struct pipe_buffer* indexBuffer, - unsigned indexSize, - unsigned minIndex, - unsigned maxIndex, - unsigned start, - unsigned count) -{ - CS_LOCALS(r300); - assert(indexSize == 4 || indexSize == 2); - assert(count < 65536); - assert((start * indexSize) % 4 == 0); - - uint32_t size_dwords; - uint32_t skip_dwords = indexSize * start / sizeof(uint32_t); - assert(skip_dwords == 0); - - BEGIN_CS(10); - OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, maxIndex); - OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, 0); - if (indexSize == 4) { - size_dwords = count + start; - OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (count << 16) | - R300_VAP_VF_CNTL__INDEX_SIZE_32bit | r300->hw_prim); - } else { - size_dwords = (count + start + 1) / 2; - OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | - (count << 16) | r300->hw_prim); - } - - OUT_CS_PKT3(R300_PACKET3_INDX_BUFFER, 2); - OUT_CS(R300_INDX_BUFFER_ONE_REG_WR | (R300_VAP_PORT_IDX0 >> 2) | - (0 << R300_INDX_BUFFER_SKIP_SHIFT)); - OUT_CS(skip_dwords); - OUT_CS(size_dwords); - cs_winsys->write_cs_reloc(cs_winsys, - indexBuffer, - RADEON_GEM_DOMAIN_GTT, - 0, - 0); - cs_count -= 2; - - END_CS; -} void r300_emit_vertex_format_state(struct r300_context* r300) { diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h index b4fdfecde0..7c83c5166d 100644 --- a/src/gallium/drivers/r300/r300_emit.h +++ b/src/gallium/drivers/r300/r300_emit.h @@ -40,16 +40,6 @@ void r300_emit_blend_color_state(struct r300_context* r300, void r300_emit_clip_state(struct r300_context* r300, struct pipe_clip_state* clip); -void r300_emit_draw_arrays(struct r300_context *r300, unsigned count); - -void r300_emit_draw_elements(struct r300_context *r300, - struct pipe_buffer* indexBuffer, - unsigned indexSize, - unsigned minIndex, - unsigned maxIndex, - unsigned start, - unsigned count); - void r300_emit_dsa_state(struct r300_context* r300, struct r300_dsa_state* dsa); diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index cbda30227d..6f7c645334 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -31,13 +31,13 @@ #include "util/u_memory.h" #include "util/u_prim.h" -#include "r300_vbo.h" #include "r300_cs.h" #include "r300_context.h" #include "r300_emit.h" #include "r300_reg.h" #include "r300_render.h" #include "r300_state_derived.h" +#include "r300_vbo.h" /* r300_render: Vertex and index buffer primitive emission. */ #define R300_MAX_VBO_SIZE (1024 * 1024) @@ -70,6 +70,70 @@ uint32_t r300_translate_primitive(unsigned prim) } } +static void r300_emit_draw_arrays(struct r300_context *r300, + unsigned mode, + unsigned count) +{ + CS_LOCALS(r300); + assert(count < 65536); + + BEGIN_CS(4); + OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, count); + OUT_CS_PKT3(R300_PACKET3_3D_DRAW_VBUF_2, 0); + OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (count << 16) | + r300_translate_primitive(mode)); + END_CS; +} + +static void r300_emit_draw_elements(struct r300_context *r300, + struct pipe_buffer* indexBuffer, + unsigned indexSize, + unsigned minIndex, + unsigned maxIndex, + unsigned mode, + unsigned start, + unsigned count) +{ + CS_LOCALS(r300); + assert(indexSize == 4 || indexSize == 2); + assert(count < 65536); + assert((start * indexSize) % 4 == 0); + + uint32_t size_dwords; + uint32_t skip_dwords = indexSize * start / sizeof(uint32_t); + assert(skip_dwords == 0); + + BEGIN_CS(10); + OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, maxIndex); + OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, 0); + if (indexSize == 4) { + size_dwords = count + start; + OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (count << 16) | + R300_VAP_VF_CNTL__INDEX_SIZE_32bit | + r300_translate_primitive(mode)); + } else { + size_dwords = (count + start + 1) / 2; + OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (count << 16) | + r300_translate_primitive(mode)); + } + + OUT_CS_PKT3(R300_PACKET3_INDX_BUFFER, 2); + OUT_CS(R300_INDX_BUFFER_ONE_REG_WR | (R300_VAP_PORT_IDX0 >> 2) | + (0 << R300_INDX_BUFFER_SKIP_SHIFT)); + OUT_CS(skip_dwords); + OUT_CS(size_dwords); + /* XXX hax */ + cs_winsys->write_cs_reloc(cs_winsys, + indexBuffer, + RADEON_GEM_DOMAIN_GTT, + 0, + 0); + cs_count -= 2; + + END_CS; +} + + static boolean setup_vertex_buffers(struct r300_context *r300) { unsigned vbuf_count = r300->aos_count; @@ -123,14 +187,12 @@ boolean r300_draw_range_elements(struct pipe_context* pipe, setup_index_buffer(r300, indexBuffer, indexSize); - r300->hw_prim = r300_translate_primitive(mode); - r300_emit_dirty_state(r300); r300_emit_aos(r300, 0); r300_emit_draw_elements(r300, indexBuffer, indexSize, minIndex, maxIndex, - start, count); + mode, start, count); return TRUE; } @@ -159,13 +221,11 @@ boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode, setup_vertex_attributes(r300); - r300->hw_prim = r300_translate_primitive(mode); - r300_emit_dirty_state(r300); r300_emit_aos(r300, start); - r300_emit_draw_arrays(r300, count); + r300_emit_draw_arrays(r300, mode, count); return TRUE; } @@ -186,8 +246,8 @@ boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe, unsigned count) { assert(0); - struct r300_context* r300 = r300_context(pipe); #if 0 + struct r300_context* r300 = r300_context(pipe); int i; if (!u_trim_pipe_prim(mode, &count)) { diff --git a/src/gallium/drivers/r300/r300_vbo.c b/src/gallium/drivers/r300/r300_vbo.c index 37b5c9224f..ab6f5c5942 100644 --- a/src/gallium/drivers/r300/r300_vbo.c +++ b/src/gallium/drivers/r300/r300_vbo.c @@ -56,7 +56,8 @@ static INLINE void setup_vertex_attribute(struct r300_vertex_info *vinfo, static void finish_vertex_attribs_setup(struct r300_vertex_info *vinfo, unsigned attribs_num) { - uint32_t last_vec_bit = (attribs_num % 2 == 0) ? (R300_LAST_VEC << 16) : R300_LAST_VEC; + uint32_t last_vec_bit = (attribs_num % 2 == 0) ? + (R300_LAST_VEC << 16) : R300_LAST_VEC; assert(attribs_num > 0 && attribs_num <= 16); vinfo->vap_prog_stream_cntl[(attribs_num - 1) >> 1] |= last_vec_bit; @@ -64,10 +65,11 @@ static void finish_vertex_attribs_setup(struct r300_vertex_info *vinfo, void setup_vertex_attributes(struct r300_context *r300) { - for (int i=0; iaos_count; i++) - { - struct pipe_vertex_element *vert_elem = &r300->vertex_element[i]; + struct pipe_vertex_element *vert_elem; + int i; + for (i = 0; i < r300->aos_count; i++) { + vert_elem = &r300->vertex_element[i]; setup_vertex_attribute(r300->vertex_info, vert_elem, i); } -- cgit v1.2.3 From 7518d9b1b7369f6e5ca1fdaf6a34e39a4acace9a Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 7 Nov 2009 10:05:31 -0800 Subject: r300g: Clean up r300_setup_vertex_buffers. --- src/gallium/drivers/r300/r300_render.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 6f7c645334..e28af7600a 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -134,16 +134,16 @@ static void r300_emit_draw_elements(struct r300_context *r300, } -static boolean setup_vertex_buffers(struct r300_context *r300) +static boolean r300_setup_vertex_buffers(struct r300_context *r300) { unsigned vbuf_count = r300->aos_count; - struct pipe_vertex_buffer *vbuf= r300->vertex_buffer; - struct pipe_vertex_element *velem= r300->vertex_element; - bool invalid = false; + struct pipe_vertex_buffer *vbuf = r300->vertex_buffer; + struct pipe_vertex_element *velem = r300->vertex_element; validate: for (int i = 0; i < vbuf_count; i++) { - if (!r300->winsys->add_buffer(r300->winsys, vbuf[velem[i].vertex_buffer_index].buffer, + if (!r300->winsys->add_buffer(r300->winsys, + vbuf[velem[i].vertex_buffer_index].buffer, RADEON_GEM_DOMAIN_GTT, 0)) { r300->context.flush(&r300->context, 0, NULL); goto validate; @@ -152,16 +152,10 @@ validate: if (!r300->winsys->validate(r300->winsys)) { r300->context.flush(&r300->context, 0, NULL); - if (invalid) { - /* Well, hell. */ - debug_printf("r300: Stuck in validation loop, gonna quit now."); - exit(1); - } - invalid = true; - goto validate; + return r300->winsys->validate(r300->winsys); } - return invalid; + return TRUE; } /* This is the fast-path drawing & emission for HW TCL. */ @@ -181,7 +175,9 @@ boolean r300_draw_range_elements(struct pipe_context* pipe, r300_update_derived_state(r300); - setup_vertex_buffers(r300); + if (!r300_setup_vertex_buffers(r300)) { + return FALSE; + } setup_vertex_attributes(r300); @@ -217,7 +213,9 @@ boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode, r300_update_derived_state(r300); - setup_vertex_buffers(r300); + if (!r300_setup_vertex_buffers(r300)) { + return FALSE; + } setup_vertex_attributes(r300); -- cgit v1.2.3 From 7da3cc4241b8550ccc1ec5ba3c93334094f5fb11 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 7 Nov 2009 10:14:07 -0800 Subject: r300g: Clean up indexbuf render, switch to RELOC macro. --- src/gallium/drivers/r300/r300_render.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index e28af7600a..b4351d541d 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -94,41 +94,43 @@ static void r300_emit_draw_elements(struct r300_context *r300, unsigned start, unsigned count) { + uint32_t count_dwords; + uint32_t offset_dwords = indexSize * start / sizeof(uint32_t); CS_LOCALS(r300); + + /* XXX most of these are stupid */ assert(indexSize == 4 || indexSize == 2); assert(count < 65536); assert((start * indexSize) % 4 == 0); - - uint32_t size_dwords; - uint32_t skip_dwords = indexSize * start / sizeof(uint32_t); - assert(skip_dwords == 0); + assert(offset_dwords == 0); BEGIN_CS(10); OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, maxIndex); OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, 0); if (indexSize == 4) { - size_dwords = count + start; + count_dwords = count + start; OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (count << 16) | R300_VAP_VF_CNTL__INDEX_SIZE_32bit | r300_translate_primitive(mode)); } else { - size_dwords = (count + start + 1) / 2; + count_dwords = (count + start + 1) / 2; OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (count << 16) | r300_translate_primitive(mode)); } + /* INDX_BUFFER is a truly special packet3. + * Unlike most other packet3, where the offset is after the count, + * the order is reversed, so the relocation ends up carrying the + * size of the indexbuf instead of the offset. + * + * XXX Fix offset + */ OUT_CS_PKT3(R300_PACKET3_INDX_BUFFER, 2); OUT_CS(R300_INDX_BUFFER_ONE_REG_WR | (R300_VAP_PORT_IDX0 >> 2) | (0 << R300_INDX_BUFFER_SKIP_SHIFT)); - OUT_CS(skip_dwords); - OUT_CS(size_dwords); - /* XXX hax */ - cs_winsys->write_cs_reloc(cs_winsys, - indexBuffer, - RADEON_GEM_DOMAIN_GTT, - 0, - 0); - cs_count -= 2; + OUT_CS(offset_dwords); + OUT_CS_RELOC(indexBuffer, count_dwords, + RADEON_GEM_DOMAIN_GTT, 0, 0); END_CS; } -- cgit v1.2.3 From b6c3954138ef70ea7d2cbd3ba9519f404ef616d7 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 7 Nov 2009 10:26:57 -0800 Subject: r300g: s/false/FALSE/ Also s/true/TRUE/ --- src/gallium/drivers/r300/r300_render.c | 4 ++-- src/gallium/drivers/r300/r300_vbo.c | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index b4351d541d..1532de367f 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -173,7 +173,7 @@ boolean r300_draw_range_elements(struct pipe_context* pipe, struct r300_context* r300 = r300_context(pipe); if (!u_trim_pipe_prim(mode, &count)) - return false; + return FALSE; r300_update_derived_state(r300); @@ -211,7 +211,7 @@ boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode, struct r300_context* r300 = r300_context(pipe); if (!u_trim_pipe_prim(mode, &count)) - return false; + return FALSE; r300_update_derived_state(r300); diff --git a/src/gallium/drivers/r300/r300_vbo.c b/src/gallium/drivers/r300/r300_vbo.c index ab6f5c5942..be74a49eb8 100644 --- a/src/gallium/drivers/r300/r300_vbo.c +++ b/src/gallium/drivers/r300/r300_vbo.c @@ -84,27 +84,27 @@ static void finish_vertex_arrays_setup(struct r300_context *r300) { } -static bool format_is_supported(enum pipe_format format, int nr_components) +static boolean format_is_supported(enum pipe_format format, int nr_components) { if (pf_layout(format) != PIPE_FORMAT_LAYOUT_RGBAZS) - return false; + return FALSE; if ((pf_size_x(format) != pf_size_y(format)) || (pf_size_x(format) != pf_size_z(format)) || (pf_size_x(format) != pf_size_w(format))) - return false; + return FALSE; /* Following should be supported as long as stride is 4 bytes aligned */ if (pf_size_x(format) != 1 && nr_components != 4) - return false; + return FALSE; if (pf_size_x(format) != 2 && !(nr_components == 2 || nr_components == 4)) - return false; + return FALSE; if (pf_size_x(format) == 3 || pf_size_x(format) > 4) - return false; + return FALSE; - return true; + return TRUE; } static INLINE int get_buffer_offset(struct r300_context *r300, -- cgit v1.2.3 From 746c01b3b2f77d8d8ba14fc517d04dbaf080d77d Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 7 Nov 2009 10:34:00 -0800 Subject: r300g: Moar vbo cleanup. --- src/gallium/drivers/r300/r300_vbo.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_vbo.c b/src/gallium/drivers/r300/r300_vbo.c index be74a49eb8..cec79ec97e 100644 --- a/src/gallium/drivers/r300/r300_vbo.c +++ b/src/gallium/drivers/r300/r300_vbo.c @@ -118,13 +118,16 @@ static INLINE int get_buffer_offset(struct r300_context *r300, */ static void setup_vertex_buffers(struct r300_context *r300) { - for (int i=0; iaos_count; i++) + struct pipe_vertex_element *vert_elem; + int i; + + for (i = 0; i < r300->aos_count; i++) { - struct pipe_vertex_element *vert_elem = &r300->vertex_element[i]; - if (!format_is_supported(vert_elem->src_format, vert_elem->nr_components)) - { + vert_elem = &r300->vertex_element[i]; + if (!format_is_supported(vert_elem->src_format, + vert_elem->nr_components)) { + /* XXX use translate module to convert the data */ assert(0); - /* use translate module to convert the data */ /* struct pipe_buffer *buf; const unsigned int max_index = r300->vertex_buffers[vert_elem->vertex_buffer_index].max_index; @@ -132,9 +135,10 @@ static void setup_vertex_buffers(struct r300_context *r300) */ } - if (get_buffer_offset(r300, vert_elem->vertex_buffer_index, vert_elem->src_offset) % 4 != 0) - { - /* need to align buffer */ + if (get_buffer_offset(r300, + vert_elem->vertex_buffer_index, + vert_elem->src_offset) % 4) { + /* XXX need to align buffer */ assert(0); } setup_vertex_array(r300, vert_elem); -- cgit v1.2.3 From ef513776b5bdd11968d2ca03862e9d1ac48e099f Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 7 Nov 2009 10:39:42 -0800 Subject: r300g: Don't assert on oversized VBOs, just return FALSE. --- src/gallium/drivers/r300/r300_render.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 1532de367f..89bf749b5f 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -75,7 +75,6 @@ static void r300_emit_draw_arrays(struct r300_context *r300, unsigned count) { CS_LOCALS(r300); - assert(count < 65536); BEGIN_CS(4); OUT_CS_REG(R300_VAP_VF_MAX_VTX_INDX, count); @@ -100,7 +99,6 @@ static void r300_emit_draw_elements(struct r300_context *r300, /* XXX most of these are stupid */ assert(indexSize == 4 || indexSize == 2); - assert(count < 65536); assert((start * indexSize) % 4 == 0); assert(offset_dwords == 0); @@ -172,8 +170,13 @@ boolean r300_draw_range_elements(struct pipe_context* pipe, { struct r300_context* r300 = r300_context(pipe); - if (!u_trim_pipe_prim(mode, &count)) + if (!u_trim_pipe_prim(mode, &count)) { return FALSE; + } + + if (count > 65535) { + return FALSE; + } r300_update_derived_state(r300); @@ -210,8 +213,13 @@ boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode, { struct r300_context* r300 = r300_context(pipe); - if (!u_trim_pipe_prim(mode, &count)) + if (!u_trim_pipe_prim(mode, &count)) { return FALSE; + } + + if (count > 65535) { + return FALSE; + } r300_update_derived_state(r300); -- cgit v1.2.3 From cd5b2a93d5c9c60dbe72ebc963dcddf0db0b665c Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 7 Nov 2009 10:52:06 -0800 Subject: r300g: Comments. --- src/gallium/drivers/r300/r300_render.c | 3 ++- src/gallium/drivers/r300/r300_vbo.c | 14 +++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 89bf749b5f..0df9a94610 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -243,7 +243,8 @@ boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode, * keep these functions separated so that they are easier to locate. ~C. * ***************************************************************************/ -/* Draw-based drawing for SW TCL chipsets. */ +/* Draw-based drawing for SW TCL chipsets. + * XXX currently broken as fucking hell. */ boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe, struct pipe_buffer* indexBuffer, unsigned indexSize, diff --git a/src/gallium/drivers/r300/r300_vbo.c b/src/gallium/drivers/r300/r300_vbo.c index cec79ec97e..d8b356a061 100644 --- a/src/gallium/drivers/r300/r300_vbo.c +++ b/src/gallium/drivers/r300/r300_vbo.c @@ -21,6 +21,9 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. */ +/* r300_vbo: Various helpers for emitting vertex buffers. Needs cleanup, + * refactoring, etc. */ + #include "r300_vbo.h" #include "pipe/p_format.h" @@ -76,6 +79,7 @@ void setup_vertex_attributes(struct r300_context *r300) finish_vertex_attribs_setup(r300->vertex_info, r300->aos_count); } +/* XXX WTF are these doing? */ static void setup_vertex_array(struct r300_context *r300, struct pipe_vertex_element *element) { } @@ -84,6 +88,7 @@ static void finish_vertex_arrays_setup(struct r300_context *r300) { } +/* XXX move/integrate this with the checks in r300_state_inlines */ static boolean format_is_supported(enum pipe_format format, int nr_components) { if (pf_layout(format) != PIPE_FORMAT_LAYOUT_RGBAZS) @@ -151,16 +156,15 @@ void setup_index_buffer(struct r300_context *r300, struct pipe_buffer* indexBuffer, unsigned indexSize) { + /* XXX I call BS; why is this different from the assert in r300_render? */ assert(indexSize = 2); - if (!r300->winsys->add_buffer(r300->winsys, indexBuffer, RADEON_GEM_DOMAIN_GTT, 0)) - { + if (!r300->winsys->add_buffer(r300->winsys, indexBuffer, + RADEON_GEM_DOMAIN_GTT, 0)) { assert(0); } - if (!r300->winsys->validate(r300->winsys)) - { + if (!r300->winsys->validate(r300->winsys)) { assert(0); } } - -- cgit v1.2.3 From 0fe5f0c09abce9d540d51942eab08b2248243943 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 7 Nov 2009 11:49:39 -0800 Subject: r300g: Be more verbose in what's killing us WRT vert formats. --- src/gallium/drivers/r300/r300_state_inlines.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index 52b9650fc1..e53db3d0b5 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -434,8 +434,8 @@ r300_translate_vertex_data_type(enum pipe_format format) { unsigned components = pf_component_count(format); if (pf_layout(format) != PIPE_FORMAT_LAYOUT_RGBAZS) { - debug_printf("r300: Bad format %s in %s\n", pf_name(format), - __FUNCTION__); + debug_printf("r300: Bad format %s in %s:%d\n", pf_name(format), + __FUNCTION__, __LINE__); return 0; } @@ -447,6 +447,8 @@ r300_translate_vertex_data_type(enum pipe_format format) { result = R300_DATA_TYPE_FLOAT_1 + (components - 1); break; default: + debug_printf("r300: Bad format %s in %s:%d\n", + pf_name(format), __FUNCTION__, __LINE__); assert(0); } break; @@ -470,10 +472,16 @@ r300_translate_vertex_data_type(enum pipe_format format) { } break; default: + debug_printf("r300: Bad format %s in %s:%d\n", + pf_name(format), __FUNCTION__, __LINE__); + debug_printf("r300: pf_size_x(format) == %d\n", + pf_size_x(format)); assert(0); } break; default: + debug_printf("r300: Bad format %s in %s:%d\n", + pf_name(format), __FUNCTION__, __LINE__); assert(0); } @@ -492,8 +500,8 @@ static INLINE uint16_t r300_translate_vertex_data_swizzle(enum pipe_format format) { if (pf_layout(format) != PIPE_FORMAT_LAYOUT_RGBAZS) { - debug_printf("r300: Bad format %s in %s\n", pf_name(format), - __FUNCTION__); + debug_printf("r300: Bad format %s in %s:%d\n", + pf_name(format), __FUNCTION__, __LINE__); return 0; } -- cgit v1.2.3 From c4fa0e4caa0aeb5cce9bd871f9156da25a9ec404 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 7 Nov 2009 13:07:52 -0800 Subject: r300g: Remove faulty assert. --- src/gallium/drivers/r300/r300_vbo.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_vbo.c b/src/gallium/drivers/r300/r300_vbo.c index d8b356a061..7e88bf3b7c 100644 --- a/src/gallium/drivers/r300/r300_vbo.c +++ b/src/gallium/drivers/r300/r300_vbo.c @@ -152,13 +152,11 @@ static void setup_vertex_buffers(struct r300_context *r300) finish_vertex_arrays_setup(r300); } +/* XXX these shouldn't be asserts since we can work around bad indexbufs */ void setup_index_buffer(struct r300_context *r300, struct pipe_buffer* indexBuffer, unsigned indexSize) { - /* XXX I call BS; why is this different from the assert in r300_render? */ - assert(indexSize = 2); - if (!r300->winsys->add_buffer(r300->winsys, indexBuffer, RADEON_GEM_DOMAIN_GTT, 0)) { assert(0); -- cgit v1.2.3 From fa6916cfef6a75eacdbf927a02f64a5a37c3b0d9 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 7 Nov 2009 13:12:15 -0800 Subject: r300g: Remove do-nothing functions. --- src/gallium/drivers/r300/r300_vbo.c | 12 ------------ 1 file changed, 12 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_vbo.c b/src/gallium/drivers/r300/r300_vbo.c index 7e88bf3b7c..d3f2ce799a 100644 --- a/src/gallium/drivers/r300/r300_vbo.c +++ b/src/gallium/drivers/r300/r300_vbo.c @@ -79,15 +79,6 @@ void setup_vertex_attributes(struct r300_context *r300) finish_vertex_attribs_setup(r300->vertex_info, r300->aos_count); } -/* XXX WTF are these doing? */ -static void setup_vertex_array(struct r300_context *r300, struct pipe_vertex_element *element) -{ -} - -static void finish_vertex_arrays_setup(struct r300_context *r300) -{ -} - /* XXX move/integrate this with the checks in r300_state_inlines */ static boolean format_is_supported(enum pipe_format format, int nr_components) { @@ -146,10 +137,7 @@ static void setup_vertex_buffers(struct r300_context *r300) /* XXX need to align buffer */ assert(0); } - setup_vertex_array(r300, vert_elem); } - - finish_vertex_arrays_setup(r300); } /* XXX these shouldn't be asserts since we can work around bad indexbufs */ -- cgit v1.2.3 From 9f49db6f843885620a52a06721d5972afb29f21a Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 7 Nov 2009 13:37:07 -0800 Subject: r300g: Minor code cleanup to avoid confusion. --- src/gallium/drivers/r300/r300_render.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 0df9a94610..fa057324f8 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -136,12 +136,11 @@ static void r300_emit_draw_elements(struct r300_context *r300, static boolean r300_setup_vertex_buffers(struct r300_context *r300) { - unsigned vbuf_count = r300->aos_count; struct pipe_vertex_buffer *vbuf = r300->vertex_buffer; struct pipe_vertex_element *velem = r300->vertex_element; validate: - for (int i = 0; i < vbuf_count; i++) { + for (int i = 0; i < r300->aos_count; i++) { if (!r300->winsys->add_buffer(r300->winsys, vbuf[velem[i].vertex_buffer_index].buffer, RADEON_GEM_DOMAIN_GTT, 0)) { -- cgit v1.2.3 From 547e939afb980c2fcc3edbbb07dba0f44be785c1 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 7 Nov 2009 14:14:19 -0800 Subject: r300g: DCE. This must never have been called before; it's completely wrong. --- src/gallium/drivers/r300/r300_state_inlines.h | 2 +- src/gallium/drivers/r300/r300_vbo.c | 27 +-------------------------- 2 files changed, 2 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index e53db3d0b5..b0f3386c62 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -436,7 +436,7 @@ r300_translate_vertex_data_type(enum pipe_format format) { if (pf_layout(format) != PIPE_FORMAT_LAYOUT_RGBAZS) { debug_printf("r300: Bad format %s in %s:%d\n", pf_name(format), __FUNCTION__, __LINE__); - return 0; + assert(0); } switch (pf_type(format)) { diff --git a/src/gallium/drivers/r300/r300_vbo.c b/src/gallium/drivers/r300/r300_vbo.c index d3f2ce799a..1d45fd590c 100644 --- a/src/gallium/drivers/r300/r300_vbo.c +++ b/src/gallium/drivers/r300/r300_vbo.c @@ -79,30 +79,6 @@ void setup_vertex_attributes(struct r300_context *r300) finish_vertex_attribs_setup(r300->vertex_info, r300->aos_count); } -/* XXX move/integrate this with the checks in r300_state_inlines */ -static boolean format_is_supported(enum pipe_format format, int nr_components) -{ - if (pf_layout(format) != PIPE_FORMAT_LAYOUT_RGBAZS) - return FALSE; - - if ((pf_size_x(format) != pf_size_y(format)) || - (pf_size_x(format) != pf_size_z(format)) || - (pf_size_x(format) != pf_size_w(format))) - return FALSE; - - /* Following should be supported as long as stride is 4 bytes aligned */ - if (pf_size_x(format) != 1 && nr_components != 4) - return FALSE; - - if (pf_size_x(format) != 2 && !(nr_components == 2 || nr_components == 4)) - return FALSE; - - if (pf_size_x(format) == 3 || pf_size_x(format) > 4) - return FALSE; - - return TRUE; -} - static INLINE int get_buffer_offset(struct r300_context *r300, unsigned int buf_nr, unsigned int elem_offset) @@ -110,8 +86,7 @@ static INLINE int get_buffer_offset(struct r300_context *r300, return r300->vertex_buffer[buf_nr].buffer_offset + elem_offset; } -/** - */ +/* XXX not called at all */ static void setup_vertex_buffers(struct r300_context *r300) { struct pipe_vertex_element *vert_elem; -- cgit v1.2.3 From a12fc1a9c4d544b015b40ff0266b8c8726d16f75 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 7 Nov 2009 14:32:31 -0800 Subject: r300g: Organize inlined state. --- src/gallium/drivers/r300/r300_state_inlines.h | 72 +++++++++++++-------------- 1 file changed, 36 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h index b0f3386c62..e6c1cb54da 100644 --- a/src/gallium/drivers/r300/r300_state_inlines.h +++ b/src/gallium/drivers/r300/r300_state_inlines.h @@ -191,6 +191,42 @@ static INLINE uint32_t r300_translate_alpha_function(int alpha_func) return 0; } +static INLINE uint32_t +r300_translate_polygon_mode_front(unsigned mode) { + switch (mode) + { + case PIPE_POLYGON_MODE_FILL: + return R300_GA_POLY_MODE_FRONT_PTYPE_TRI; + case PIPE_POLYGON_MODE_LINE: + return R300_GA_POLY_MODE_FRONT_PTYPE_LINE; + case PIPE_POLYGON_MODE_POINT: + return R300_GA_POLY_MODE_FRONT_PTYPE_POINT; + + default: + debug_printf("r300: Bad polygon mode %i in %s\n", mode, + __FUNCTION__); + return R300_GA_POLY_MODE_FRONT_PTYPE_TRI; + } +} + +static INLINE uint32_t +r300_translate_polygon_mode_back(unsigned mode) { + switch (mode) + { + case PIPE_POLYGON_MODE_FILL: + return R300_GA_POLY_MODE_BACK_PTYPE_TRI; + case PIPE_POLYGON_MODE_LINE: + return R300_GA_POLY_MODE_BACK_PTYPE_LINE; + case PIPE_POLYGON_MODE_POINT: + return R300_GA_POLY_MODE_BACK_PTYPE_POINT; + + default: + debug_printf("r300: Bad polygon mode %i in %s\n", mode, + __FUNCTION__); + return R300_GA_POLY_MODE_BACK_PTYPE_TRI; + } +} + /* Texture sampler state. */ static INLINE uint32_t r300_translate_wrap(int wrap) @@ -512,40 +548,4 @@ r300_translate_vertex_data_swizzle(enum pipe_format format) { (0xf << R300_WRITE_ENA_SHIFT)); } -static INLINE uint32_t -r300_translate_polygon_mode_front(unsigned mode) { - switch (mode) - { - case PIPE_POLYGON_MODE_FILL: - return R300_GA_POLY_MODE_FRONT_PTYPE_TRI; - case PIPE_POLYGON_MODE_LINE: - return R300_GA_POLY_MODE_FRONT_PTYPE_LINE; - case PIPE_POLYGON_MODE_POINT: - return R300_GA_POLY_MODE_FRONT_PTYPE_POINT; - - default: - debug_printf("r300: Bad polygon mode %i in %s\n", mode, - __FUNCTION__); - return R300_GA_POLY_MODE_FRONT_PTYPE_TRI; - } -} - -static INLINE uint32_t -r300_translate_polygon_mode_back(unsigned mode) { - switch (mode) - { - case PIPE_POLYGON_MODE_FILL: - return R300_GA_POLY_MODE_BACK_PTYPE_TRI; - case PIPE_POLYGON_MODE_LINE: - return R300_GA_POLY_MODE_BACK_PTYPE_LINE; - case PIPE_POLYGON_MODE_POINT: - return R300_GA_POLY_MODE_BACK_PTYPE_POINT; - - default: - debug_printf("r300: Bad polygon mode %i in %s\n", mode, - __FUNCTION__); - return R300_GA_POLY_MODE_BACK_PTYPE_TRI; - } -} - #endif /* R300_STATE_INLINES_H */ -- cgit v1.2.3 From 7452877cf64b48c58f70f73f3eda9bf2692bb9a6 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 2 Nov 2009 13:37:47 -0800 Subject: prog parse: Handle GL_FRAGMENT_PROGRAM_NV in glProgramStringARB --- src/mesa/shader/arbprogram.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/shader/arbprogram.c index 4d8cff0700..ca71a3939c 100644 --- a/src/mesa/shader/arbprogram.c +++ b/src/mesa/shader/arbprogram.c @@ -37,6 +37,7 @@ #include "main/mtypes.h" #include "arbprogram.h" #include "arbprogparse.h" +#include "nvfragparse.h" #include "program.h" @@ -428,6 +429,7 @@ void GLAPIENTRY _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, const GLvoid *string) { + struct gl_program *base; GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); @@ -442,22 +444,30 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, && ctx->Extensions.ARB_vertex_program) { struct gl_vertex_program *prog = ctx->VertexProgram.Current; _mesa_parse_arb_vertex_program(ctx, target, string, len, prog); - - if (ctx->Program.ErrorPos == -1 && ctx->Driver.ProgramStringNotify) - ctx->Driver.ProgramStringNotify( ctx, target, &prog->Base ); + + base = & prog->Base; } else if (target == GL_FRAGMENT_PROGRAM_ARB && ctx->Extensions.ARB_fragment_program) { struct gl_fragment_program *prog = ctx->FragmentProgram.Current; _mesa_parse_arb_fragment_program(ctx, target, string, len, prog); - if (ctx->Program.ErrorPos == -1 && ctx->Driver.ProgramStringNotify) - ctx->Driver.ProgramStringNotify( ctx, target, &prog->Base ); + base = & prog->Base; + } + else if (target == GL_FRAGMENT_PROGRAM_NV + && ctx->Extensions.NV_fragment_program) { + struct gl_fragment_program *prog = ctx->FragmentProgram.Current; + _mesa_parse_nv_fragment_program(ctx, target, string, len, prog); + + base = & prog->Base; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(target)"); return; } + + if (ctx->Program.ErrorPos == -1 && ctx->Driver.ProgramStringNotify) + ctx->Driver.ProgramStringNotify( ctx, target, base ); } -- cgit v1.2.3 From 289db82b2d42b0d79fd0c01781612bd4e69a9474 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 2 Nov 2009 13:38:15 -0800 Subject: prog parse: Handle GL_FRAGMENT_PROGRAM_ARB in glLoadProgramNV --- src/mesa/shader/nvprogram.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/mesa/shader/nvprogram.c b/src/mesa/shader/nvprogram.c index 471a7358a2..80ed410c24 100644 --- a/src/mesa/shader/nvprogram.c +++ b/src/mesa/shader/nvprogram.c @@ -47,6 +47,7 @@ #include "prog_instruction.h" #include "nvfragparse.h" #include "nvvertparse.h" +#include "arbprogparse.h" #include "nvprogram.h" @@ -643,6 +644,20 @@ _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, } _mesa_parse_nv_fragment_program(ctx, target, program, len, fprog); } + else if (target == GL_FRAGMENT_PROGRAM_ARB + && ctx->Extensions.ARB_fragment_program) { + struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog; + if (!fprog || prog == &_mesa_DummyProgram) { + fprog = (struct gl_fragment_program *) + ctx->Driver.NewProgram(ctx, target, id); + if (!fprog) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glLoadProgramNV"); + return; + } + _mesa_HashInsert(ctx->Shared->Programs, id, fprog); + } + _mesa_parse_arb_fragment_program(ctx, target, program, len, fprog); + } else { _mesa_error(ctx, GL_INVALID_ENUM, "glLoadProgramNV(target)"); } -- cgit v1.2.3 From 6d2ceda780967848b6147061287095c35bc9d92f Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 2 Nov 2009 14:08:51 -0800 Subject: prog parse: Handle GL_VERTEX_PROGRAM_NV in glProgramStringARB Handle both NV vertex programs and NV vertex state programs passed to glProgramStringARB. --- src/mesa/shader/arbprogram.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/arbprogram.c b/src/mesa/shader/arbprogram.c index ca71a3939c..eb537cd1b9 100644 --- a/src/mesa/shader/arbprogram.c +++ b/src/mesa/shader/arbprogram.c @@ -38,6 +38,7 @@ #include "arbprogram.h" #include "arbprogparse.h" #include "nvfragparse.h" +#include "nvvertparse.h" #include "program.h" @@ -435,18 +436,39 @@ _mesa_ProgramStringARB(GLenum target, GLenum format, GLsizei len, FLUSH_VERTICES(ctx, _NEW_PROGRAM); + if (!ctx->Extensions.ARB_vertex_program + && !ctx->Extensions.ARB_fragment_program) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glProgramStringARB()"); + return; + } + if (format != GL_PROGRAM_FORMAT_ASCII_ARB) { _mesa_error(ctx, GL_INVALID_ENUM, "glProgramStringARB(format)"); return; } + /* The first couple cases are complicated. The same enum value is used for + * ARB and NV vertex programs. If the target is a vertex program, parse it + * using the ARB grammar if the string starts with "!!ARB" or if + * NV_vertex_program is not supported. + */ if (target == GL_VERTEX_PROGRAM_ARB - && ctx->Extensions.ARB_vertex_program) { + && ctx->Extensions.ARB_vertex_program + && ((strncmp(string, "!!ARB", 5) == 0) + || !ctx->Extensions.NV_vertex_program)) { struct gl_vertex_program *prog = ctx->VertexProgram.Current; _mesa_parse_arb_vertex_program(ctx, target, string, len, prog); base = & prog->Base; } + else if ((target == GL_VERTEX_PROGRAM_ARB + || target == GL_VERTEX_STATE_PROGRAM_NV) + && ctx->Extensions.NV_vertex_program) { + struct gl_vertex_program *prog = ctx->VertexProgram.Current; + _mesa_parse_nv_vertex_program(ctx, target, string, len, prog); + + base = & prog->Base; + } else if (target == GL_FRAGMENT_PROGRAM_ARB && ctx->Extensions.ARB_fragment_program) { struct gl_fragment_program *prog = ctx->FragmentProgram.Current; -- cgit v1.2.3 From 2cda507fa170c040e207190dee44d1be5e8572f7 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 2 Nov 2009 14:10:38 -0800 Subject: prog parse: Handle GL_VERTEX_PROGRAM_ARB in glLoadProgramNV --- src/mesa/shader/nvprogram.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/nvprogram.c b/src/mesa/shader/nvprogram.c index 80ed410c24..fd6cbb0f40 100644 --- a/src/mesa/shader/nvprogram.c +++ b/src/mesa/shader/nvprogram.c @@ -596,6 +596,12 @@ _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, GET_CURRENT_CONTEXT(ctx); ASSERT_OUTSIDE_BEGIN_END(ctx); + if (!ctx->Extensions.NV_vertex_program + && !ctx->Extensions.NV_fragment_program) { + _mesa_error(ctx, GL_INVALID_OPERATION, "glLoadProgramNV()"); + return; + } + if (id == 0) { _mesa_error(ctx, GL_INVALID_VALUE, "glLoadProgramNV(id)"); return; @@ -628,7 +634,13 @@ _mesa_LoadProgramNV(GLenum target, GLuint id, GLsizei len, } _mesa_HashInsert(ctx->Shared->Programs, id, vprog); } - _mesa_parse_nv_vertex_program(ctx, target, program, len, vprog); + + if (ctx->Extensions.ARB_vertex_program + && (strncmp((char *) program, "!!ARB", 5) == 0)) { + _mesa_parse_arb_vertex_program(ctx, target, program, len, vprog); + } else { + _mesa_parse_nv_vertex_program(ctx, target, program, len, vprog); + } } else if (target == GL_FRAGMENT_PROGRAM_NV && ctx->Extensions.NV_fragment_program) { -- cgit v1.2.3 From ee28a69188d5054f996d0f5fc12820b024ef96a6 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 8 Nov 2009 09:35:07 -0800 Subject: r300g: Fix build error on old compilers. This dead code was still getting compiled, causing a bad ref in the lib. --- src/gallium/drivers/r300/r300_vbo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_vbo.c b/src/gallium/drivers/r300/r300_vbo.c index 1d45fd590c..5ad6b9c215 100644 --- a/src/gallium/drivers/r300/r300_vbo.c +++ b/src/gallium/drivers/r300/r300_vbo.c @@ -85,7 +85,7 @@ static INLINE int get_buffer_offset(struct r300_context *r300, { return r300->vertex_buffer[buf_nr].buffer_offset + elem_offset; } - +#if 0 /* XXX not called at all */ static void setup_vertex_buffers(struct r300_context *r300) { @@ -95,9 +95,9 @@ static void setup_vertex_buffers(struct r300_context *r300) for (i = 0; i < r300->aos_count; i++) { vert_elem = &r300->vertex_element[i]; + /* XXX use translate module to convert the data */ if (!format_is_supported(vert_elem->src_format, vert_elem->nr_components)) { - /* XXX use translate module to convert the data */ assert(0); /* struct pipe_buffer *buf; @@ -114,7 +114,7 @@ static void setup_vertex_buffers(struct r300_context *r300) } } } - +#endif /* XXX these shouldn't be asserts since we can work around bad indexbufs */ void setup_index_buffer(struct r300_context *r300, struct pipe_buffer* indexBuffer, -- cgit v1.2.3 From 0525cb1273a51343fba0a94d01d115e4256d1db2 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 8 Nov 2009 09:56:02 -0800 Subject: r300g: Fix is_buffer_referenced. --- src/gallium/drivers/r300/r300_context.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index b520e5929e..43d7ff3ed3 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -89,8 +89,11 @@ static unsigned int r300_is_buffer_referenced(struct pipe_context *pipe, struct pipe_buffer *buf) { - /* XXX */ - return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; + /* This only checks to see whether actual hardware buffers are + * referenced. Since we use managed BOs and transfers, it's actually not + * possible for pipe_buffers to ever reference the actual hardware, so + * buffers are never referenced. */ + return 0; } static void r300_flush_cb(void *data) -- cgit v1.2.3 From b6f93e2607f1bbc5b2f478f0a57d7786dd7d73a5 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 8 Nov 2009 11:32:32 -0800 Subject: r300g: Enable PSC/RS dump with new debugging flags. --- src/gallium/drivers/r300/r300_emit.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index ec1d521800..b3d9db676a 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -510,6 +510,8 @@ void r300_emit_rs_block_state(struct r300_context* r300, struct r300_screen* r300screen = r300_screen(r300->context.screen); CS_LOCALS(r300); + DBG(r300, DBG_DRAW, "r300: RS emit:\n"); + BEGIN_CS(21); if (r300screen->caps->is_r500) { OUT_CS_REG_SEQ(R500_RS_IP_0, 8); @@ -518,7 +520,7 @@ void r300_emit_rs_block_state(struct r300_context* r300, } for (i = 0; i < 8; i++) { OUT_CS(rs->ip[i]); - /* debug_printf("ip %d: 0x%08x\n", i, rs->ip[i]); */ + DBG(r300, DBG_DRAW, " : ip %d: 0x%08x\n", i, rs->ip[i]); } OUT_CS_REG_SEQ(R300_RS_COUNT, 2); @@ -532,11 +534,11 @@ void r300_emit_rs_block_state(struct r300_context* r300, } for (i = 0; i < 8; i++) { OUT_CS(rs->inst[i]); - /* debug_printf("inst %d: 0x%08x\n", i, rs->inst[i]); */ + DBG(r300, DBG_DRAW, " : inst %d: 0x%08x\n", i, rs->inst[i]); } - /* debug_printf("count: 0x%08x inst_count: 0x%08x\n", rs->count, - * rs->inst_count); */ + DBG(r300, DBG_DRAW, " : count: 0x%08x inst_count: 0x%08x\n", + rs->count, rs->inst_count); END_CS; } @@ -653,6 +655,8 @@ void r300_emit_vertex_format_state(struct r300_context* r300) int i; CS_LOCALS(r300); + DBG(r300, DBG_DRAW, "r300: VAP/PSC emit:\n"); + BEGIN_CS(26); OUT_CS_REG(R300_VAP_VTX_SIZE, r300->vertex_info->vinfo.size); @@ -662,22 +666,22 @@ void r300_emit_vertex_format_state(struct r300_context* r300) OUT_CS_REG_SEQ(R300_VAP_OUTPUT_VTX_FMT_0, 2); OUT_CS(r300->vertex_info->vinfo.hwfmt[2]); OUT_CS(r300->vertex_info->vinfo.hwfmt[3]); - /* for (i = 0; i < 4; i++) { - * debug_printf("hwfmt%d: 0x%08x\n", i, - * r300->vertex_info->vinfo.hwfmt[i]); - * } */ + for (i = 0; i < 4; i++) { + DBG(r300, DBG_DRAW, " : hwfmt%d: 0x%08x\n", i, + r300->vertex_info->vinfo.hwfmt[i]); + } OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_0, 8); for (i = 0; i < 8; i++) { OUT_CS(r300->vertex_info->vap_prog_stream_cntl[i]); - /* debug_printf("prog_stream_cntl%d: 0x%08x\n", i, - * r300->vertex_info->vap_prog_stream_cntl[i]); */ + DBG(r300, DBG_DRAW, " : prog_stream_cntl%d: 0x%08x\n", i, + r300->vertex_info->vap_prog_stream_cntl[i]); } OUT_CS_REG_SEQ(R300_VAP_PROG_STREAM_CNTL_EXT_0, 8); for (i = 0; i < 8; i++) { OUT_CS(r300->vertex_info->vap_prog_stream_cntl_ext[i]); - /* debug_printf("prog_stream_cntl_ext%d: 0x%08x\n", i, - * r300->vertex_info->vap_prog_stream_cntl_ext[i]); */ + DBG(r300, DBG_DRAW, " : prog_stream_cntl_ext%d: 0x%08x\n", i, + r300->vertex_info->vap_prog_stream_cntl_ext[i]); } END_CS; } -- cgit v1.2.3 From 11d9edf4c9c75d5a41fb0a1757441ad315330bea Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 8 Nov 2009 11:45:57 -0800 Subject: r300g: Unify context names for counts. From the SW TCL fixups. --- src/gallium/drivers/r300/r300_context.c | 2 +- src/gallium/drivers/r300/r300_context.h | 4 ++-- src/gallium/drivers/r300/r300_emit.c | 16 ++++++++++------ src/gallium/drivers/r300/r300_render.c | 2 +- src/gallium/drivers/r300/r300_state.c | 4 ++-- src/gallium/drivers/r300/r300_vbo.c | 5 +++-- 6 files changed, 19 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 43d7ff3ed3..ae23329b83 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -158,6 +158,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, /* Open up the OQ BO. */ r300->oqbo = screen->buffer_create(screen, 4096, PIPE_BUFFER_USAGE_VERTEX, 4096); + make_empty_list(&r300->query_list); r300_init_flush_functions(r300); @@ -172,6 +173,5 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->winsys->set_flush_cb(r300->winsys, r300_flush_cb, r300); r300->dirty_state = R300_NEW_KITCHEN_SINK; r300->dirty_hw++; - make_empty_list(&r300->query_list); return &r300->context; } diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 8d14c53f49..f954ba7f9a 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -295,10 +295,10 @@ struct r300_context { /* Vertex buffers for Gallium. */ struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; - int vbuf_count; + int vertex_buffer_count; /* Vertex elements for Gallium. */ struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS]; - int aos_count; + int vertex_element_count; /* Bitmask of dirty state objects. */ uint32_t dirty_state; diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index b3d9db676a..eeb97a2d37 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -584,17 +584,20 @@ void r300_emit_texture(struct r300_context* r300, END_CS; } +/* XXX I can't read this and that's not good */ void r300_emit_aos(struct r300_context* r300, unsigned offset) { struct pipe_vertex_buffer *vbuf = r300->vertex_buffer; struct pipe_vertex_element *velem = r300->vertex_element; CS_LOCALS(r300); int i; - unsigned packet_size = (r300->aos_count * 3 + 1) / 2; - BEGIN_CS(2 + packet_size + r300->aos_count * 2); + unsigned aos_count = r300->vertex_element_count; + + unsigned packet_size = (aos_count * 3 + 1) / 2; + BEGIN_CS(2 + packet_size + aos_count * 2); OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, packet_size); - OUT_CS(r300->aos_count); - for (i = 0; i < r300->aos_count - 1; i += 2) { + OUT_CS(aos_count); + for (i = 0; i < aos_count - 1; i += 2) { int buf_num1 = velem[i].vertex_buffer_index; int buf_num2 = velem[i+1].vertex_buffer_index; assert(vbuf[buf_num1].stride % 4 == 0 && pf_get_size(velem[i].src_format) % 4 == 0); @@ -606,7 +609,7 @@ void r300_emit_aos(struct r300_context* r300, unsigned offset) OUT_CS(vbuf[buf_num2].buffer_offset + velem[i+1].src_offset + offset * vbuf[buf_num2].stride); } - if (r300->aos_count & 1) { + if (aos_count & 1) { int buf_num = velem[i].vertex_buffer_index; assert(vbuf[buf_num].stride % 4 == 0 && pf_get_size(velem[i].src_format) % 4 == 0); OUT_CS((pf_get_size(velem[i].src_format) >> 2) | (vbuf[buf_num].stride << 6)); @@ -614,7 +617,8 @@ void r300_emit_aos(struct r300_context* r300, unsigned offset) offset * vbuf[buf_num].stride); } - for (i = 0; i < r300->aos_count; i++) { + /* XXX bare CS reloc */ + for (i = 0; i < aos_count; i++) { cs_winsys->write_cs_reloc(cs_winsys, vbuf[velem[i].vertex_buffer_index].buffer, RADEON_GEM_DOMAIN_GTT, diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index fa057324f8..1ff3e64b44 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -140,7 +140,7 @@ static boolean r300_setup_vertex_buffers(struct r300_context *r300) struct pipe_vertex_element *velem = r300->vertex_element; validate: - for (int i = 0; i < r300->aos_count; i++) { + for (int i = 0; i < r300->vertex_element_count; i++) { if (!r300->winsys->add_buffer(r300->winsys, vbuf[velem[i].vertex_buffer_index].buffer, RADEON_GEM_DOMAIN_GTT, 0)) { diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index e0b85ab768..d1eced61db 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -668,7 +668,7 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe, memcpy(r300->vertex_buffer, buffers, sizeof(struct pipe_vertex_buffer) * count); - r300->vbuf_count = count; + r300->vertex_buffer_count = count; if (r300->draw) { draw_flush(r300->draw); @@ -685,7 +685,7 @@ static void r300_set_vertex_elements(struct pipe_context* pipe, memcpy(r300->vertex_element, elements, sizeof(struct pipe_vertex_element) * count); - r300->aos_count = count; + r300->vertex_element_count = count; if (r300->draw) { draw_flush(r300->draw); diff --git a/src/gallium/drivers/r300/r300_vbo.c b/src/gallium/drivers/r300/r300_vbo.c index 5ad6b9c215..a6a159667a 100644 --- a/src/gallium/drivers/r300/r300_vbo.c +++ b/src/gallium/drivers/r300/r300_vbo.c @@ -71,12 +71,13 @@ void setup_vertex_attributes(struct r300_context *r300) struct pipe_vertex_element *vert_elem; int i; - for (i = 0; i < r300->aos_count; i++) { + for (i = 0; i < r300->vertex_element_count; i++) { vert_elem = &r300->vertex_element[i]; setup_vertex_attribute(r300->vertex_info, vert_elem, i); } - finish_vertex_attribs_setup(r300->vertex_info, r300->aos_count); + finish_vertex_attribs_setup(r300->vertex_info, + r300->vertex_element_count); } static INLINE int get_buffer_offset(struct r300_context *r300, -- cgit v1.2.3 From fe898638086370ed86a9ce76b21fa8ebb88c4b08 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 8 Nov 2009 14:07:01 -0800 Subject: r300g: Protect against possibly missing Draw pointer. Part of the SW TCL revival. --- src/gallium/drivers/r300/r300_state_derived.c | 47 +++++++++++++++++---------- 1 file changed, 29 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 14d7bb094c..7166694edf 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -170,20 +170,30 @@ static void r300_vs_tab_routes(struct r300_context* r300, } tab[0] = 0; } - draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, - draw_find_vs_output(r300->draw, TGSI_SEMANTIC_POSITION, 0)); + + /* Position. */ + if (r300->draw) { + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, + draw_find_vs_output(r300->draw, TGSI_SEMANTIC_POSITION, 0)); + } vinfo->hwfmt[1] |= R300_INPUT_CNTL_POS; vinfo->hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT; + /* Point size. */ if (psize) { - draw_emit_vertex_attr(vinfo, EMIT_1F_PSIZE, INTERP_POS, - draw_find_vs_output(r300->draw, TGSI_SEMANTIC_PSIZE, 0)); + if (r300->draw) { + draw_emit_vertex_attr(vinfo, EMIT_1F_PSIZE, INTERP_POS, + draw_find_vs_output(r300->draw, TGSI_SEMANTIC_PSIZE, 0)); + } vinfo->hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT; } + /* Colors. */ for (i = 0; i < cols; i++) { - draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_LINEAR, - draw_find_vs_output(r300->draw, TGSI_SEMANTIC_COLOR, i)); + if (r300->draw) { + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_LINEAR, + draw_find_vs_output(r300->draw, TGSI_SEMANTIC_COLOR, i)); + } vinfo->hwfmt[1] |= R300_INPUT_CNTL_COLOR; vinfo->hwfmt[2] |= (R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << i); } @@ -192,28 +202,27 @@ static void r300_vs_tab_routes(struct r300_context* r300, * This gets around a double-increment problem. */ i = 0; + /* Fog. This is a special-cased texcoord. */ if (fog) { i++; - draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, - draw_find_vs_output(r300->draw, TGSI_SEMANTIC_FOG, 0)); + if (r300->draw) { + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, + draw_find_vs_output(r300->draw, TGSI_SEMANTIC_FOG, 0)); + } vinfo->hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i); vinfo->hwfmt[3] |= (4 << (3 * i)); } + /* Texcoords. */ for (; i < texs; i++) { - draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, - draw_find_vs_output(r300->draw, TGSI_SEMANTIC_GENERIC, i)); + if (r300->draw) { + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, + draw_find_vs_output(r300->draw, TGSI_SEMANTIC_GENERIC, i)); + } vinfo->hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i); vinfo->hwfmt[3] |= (4 << (3 * i)); } - /* Handle the case where the vertex shader will be generating some of - * the attribs based on its inputs. */ - if (r300screen->caps->has_tcl && - info->num_inputs < info->num_outputs) { - vinfo->num_attribs = info->num_inputs; - } - draw_compute_vertex_size(vinfo); } @@ -455,6 +464,7 @@ static void r300_update_rs_block(struct r300_context* r300, /* Update the vertex format. */ static void r300_update_derived_shader_state(struct r300_context* r300) { + struct r300_screen* r300screen = r300_screen(r300->context.screen); struct r300_vertex_info* vformat; struct r300_rs_block* rs_block; int i; @@ -543,7 +553,8 @@ static void r300_update_ztop(struct r300_context* r300) void r300_update_derived_state(struct r300_context* r300) { - if (r300->dirty_state & + /* XXX */ + if (TRUE || r300->dirty_state & (R300_NEW_FRAGMENT_SHADER | R300_NEW_VERTEX_SHADER)) { r300_update_derived_shader_state(r300); } -- cgit v1.2.3 From c9167d868cfb2ba821f01e0217e3880c5df4c97b Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 8 Nov 2009 14:51:52 -0800 Subject: r300g: Fix up SW TCL rendering functions. They don't work, but at least they're clean now. --- src/gallium/drivers/r300/r300_render.c | 68 ++++++++++++++++++++++++---------- src/gallium/drivers/r300/r300_render.h | 5 +++ 2 files changed, 53 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 1ff3e64b44..62e1456ed3 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -242,8 +242,44 @@ boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode, * keep these functions separated so that they are easier to locate. ~C. * ***************************************************************************/ -/* Draw-based drawing for SW TCL chipsets. - * XXX currently broken as fucking hell. */ +/* SW TCL arrays, using Draw. */ +boolean r300_swtcl_draw_arrays(struct pipe_context* pipe, + unsigned mode, + unsigned start, + unsigned count) +{ + struct r300_context* r300 = r300_context(pipe); + int i; + + if (!u_trim_pipe_prim(mode, &count)) { + return FALSE; + } + + for (i = 0; i < r300->vertex_buffer_count; i++) { + void* buf = pipe_buffer_map(pipe->screen, + r300->vertex_buffer[i].buffer, + PIPE_BUFFER_USAGE_CPU_READ); + draw_set_mapped_vertex_buffer(r300->draw, i, buf); + } + + draw_set_mapped_element_buffer(r300->draw, 0, NULL); + + draw_set_mapped_constant_buffer(r300->draw, + r300->shader_constants[PIPE_SHADER_VERTEX].constants, + r300->shader_constants[PIPE_SHADER_VERTEX].count * + (sizeof(float) * 4)); + + draw_arrays(r300->draw, mode, start, count); + + for (i = 0; i < r300->vertex_buffer_count; i++) { + pipe_buffer_unmap(pipe->screen, r300->vertex_buffer[i].buffer); + draw_set_mapped_vertex_buffer(r300->draw, i, NULL); + } + + return TRUE; +} + +/* SW TCL elements, using Draw. */ boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe, struct pipe_buffer* indexBuffer, unsigned indexSize, @@ -253,8 +289,6 @@ boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe, unsigned start, unsigned count) { - assert(0); -#if 0 struct r300_context* r300 = r300_context(pipe); int i; @@ -264,19 +298,15 @@ boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe, for (i = 0; i < r300->vertex_buffer_count; i++) { void* buf = pipe_buffer_map(pipe->screen, - r300->vertex_buffers[i].buffer, + r300->vertex_buffer[i].buffer, PIPE_BUFFER_USAGE_CPU_READ); draw_set_mapped_vertex_buffer(r300->draw, i, buf); } - if (indexBuffer) { - void* indices = pipe_buffer_map(pipe->screen, indexBuffer, - PIPE_BUFFER_USAGE_CPU_READ); - draw_set_mapped_element_buffer_range(r300->draw, indexSize, - minIndex, maxIndex, indices); - } else { - draw_set_mapped_element_buffer(r300->draw, 0, NULL); - } + void* indices = pipe_buffer_map(pipe->screen, indexBuffer, + PIPE_BUFFER_USAGE_CPU_READ); + draw_set_mapped_element_buffer_range(r300->draw, indexSize, + minIndex, maxIndex, indices); draw_set_mapped_constant_buffer(r300->draw, r300->shader_constants[PIPE_SHADER_VERTEX].constants, @@ -286,16 +316,14 @@ boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe, draw_arrays(r300->draw, mode, start, count); for (i = 0; i < r300->vertex_buffer_count; i++) { - pipe_buffer_unmap(pipe->screen, r300->vertex_buffers[i].buffer); + pipe_buffer_unmap(pipe->screen, r300->vertex_buffer[i].buffer); draw_set_mapped_vertex_buffer(r300->draw, i, NULL); } - if (indexBuffer) { - pipe_buffer_unmap(pipe->screen, indexBuffer); - draw_set_mapped_element_buffer_range(r300->draw, 0, start, - start + count - 1, NULL); - } -#endif + pipe_buffer_unmap(pipe->screen, indexBuffer); + draw_set_mapped_element_buffer_range(r300->draw, 0, start, + start + count - 1, NULL); + return TRUE; } diff --git a/src/gallium/drivers/r300/r300_render.h b/src/gallium/drivers/r300/r300_render.h index 3f8ac1fb7a..da83069083 100644 --- a/src/gallium/drivers/r300/r300_render.h +++ b/src/gallium/drivers/r300/r300_render.h @@ -42,6 +42,11 @@ boolean r300_draw_elements(struct pipe_context* pipe, boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode, unsigned start, unsigned count); +boolean r300_swtcl_draw_arrays(struct pipe_context* pipe, + unsigned mode, + unsigned start, + unsigned count); + boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe, struct pipe_buffer* indexBuffer, unsigned indexSize, -- cgit v1.2.3 From 7204b92101ecf4e2fbc78cf91f387996396deec8 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Mon, 9 Nov 2009 14:29:00 +0100 Subject: nv50: clarify data for method 0x121c --- src/gallium/drivers/nv50/nv50_state_validate.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index a13d64b7fa..799d2758fe 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -37,13 +37,14 @@ nv50_state_validate_fb(struct nv50_context *nv50) struct pipe_framebuffer_state *fb = &nv50->framebuffer; unsigned i, w, h, gw = 0; - /* Set nr of active RTs. Don't know what 0xfac6880 does, but - * at least 0x880 was required to draw to more than 1 RT. - * In some special cases, 0xfac6880 is not used, we probably - * don't hit any of these though. + /* Set nr of active RTs and select RT for each colour output. + * FP result 0 always goes to RT[0], bits 4 - 6 are ignored. + * Ambiguous assignment results in no rendering (no DATA_ERROR). */ so_method(so, tesla, 0x121c, 1); - so_data (so, 0x0fac6880 | fb->nr_cbufs); + so_data (so, fb->nr_cbufs | + (0 << 4) | (1 << 7) | (2 << 10) | (3 << 13) | + (4 << 16) | (5 << 19) | (6 << 22) | (7 << 25)); for (i = 0; i < fb->nr_cbufs; i++) { struct pipe_texture *pt = fb->cbufs[i]->texture; -- cgit v1.2.3 From bc9d51bb0eab90c47e7b07756e9eba9575f80ffc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Mon, 9 Nov 2009 06:59:03 -0800 Subject: llvmpipe: Ensure stack variables in unit tests are properly aligned. --- src/gallium/drivers/llvmpipe/lp_test_blend.c | 21 +++++++++++---------- src/gallium/drivers/llvmpipe/lp_test_conv.c | 5 +++-- src/gallium/drivers/llvmpipe/lp_test_format.c | 1 + 3 files changed, 15 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_test_blend.c b/src/gallium/drivers/llvmpipe/lp_test_blend.c index 149fec1d54..29fff91981 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_blend.c +++ b/src/gallium/drivers/llvmpipe/lp_test_blend.c @@ -462,6 +462,7 @@ compute_blend_ref(const struct pipe_blend_state *blend, } +ALIGN_STACK static boolean test_one(unsigned verbose, FILE *fp, @@ -530,11 +531,11 @@ test_one(unsigned verbose, success = TRUE; for(i = 0; i < n && success; ++i) { if(mode == AoS) { - uint8_t src[LP_NATIVE_VECTOR_WIDTH/8]; - uint8_t dst[LP_NATIVE_VECTOR_WIDTH/8]; - uint8_t con[LP_NATIVE_VECTOR_WIDTH/8]; - uint8_t res[LP_NATIVE_VECTOR_WIDTH/8]; - uint8_t ref[LP_NATIVE_VECTOR_WIDTH/8]; + ALIGN16_ATTRIB uint8_t src[LP_NATIVE_VECTOR_WIDTH/8]; + ALIGN16_ATTRIB uint8_t dst[LP_NATIVE_VECTOR_WIDTH/8]; + ALIGN16_ATTRIB uint8_t con[LP_NATIVE_VECTOR_WIDTH/8]; + ALIGN16_ATTRIB uint8_t res[LP_NATIVE_VECTOR_WIDTH/8]; + ALIGN16_ATTRIB uint8_t ref[LP_NATIVE_VECTOR_WIDTH/8]; int64_t start_counter = 0; int64_t end_counter = 0; @@ -595,11 +596,11 @@ test_one(unsigned verbose, if(mode == SoA) { const unsigned stride = type.length*type.width/8; - uint8_t src[4*LP_NATIVE_VECTOR_WIDTH/8]; - uint8_t dst[4*LP_NATIVE_VECTOR_WIDTH/8]; - uint8_t con[4*LP_NATIVE_VECTOR_WIDTH/8]; - uint8_t res[4*LP_NATIVE_VECTOR_WIDTH/8]; - uint8_t ref[4*LP_NATIVE_VECTOR_WIDTH/8]; + ALIGN16_ATTRIB uint8_t src[4*LP_NATIVE_VECTOR_WIDTH/8]; + ALIGN16_ATTRIB uint8_t dst[4*LP_NATIVE_VECTOR_WIDTH/8]; + ALIGN16_ATTRIB uint8_t con[4*LP_NATIVE_VECTOR_WIDTH/8]; + ALIGN16_ATTRIB uint8_t res[4*LP_NATIVE_VECTOR_WIDTH/8]; + ALIGN16_ATTRIB uint8_t ref[4*LP_NATIVE_VECTOR_WIDTH/8]; int64_t start_counter = 0; int64_t end_counter = 0; boolean mismatch; diff --git a/src/gallium/drivers/llvmpipe/lp_test_conv.c b/src/gallium/drivers/llvmpipe/lp_test_conv.c index ac2a6d05e3..968c7a2d4a 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_conv.c +++ b/src/gallium/drivers/llvmpipe/lp_test_conv.c @@ -142,6 +142,7 @@ add_conv_test(LLVMModuleRef module, } +ALIGN_STACK static boolean test_one(unsigned verbose, FILE *fp, @@ -229,8 +230,8 @@ test_one(unsigned verbose, for(i = 0; i < n && success; ++i) { unsigned src_stride = src_type.length*src_type.width/8; unsigned dst_stride = dst_type.length*dst_type.width/8; - uint8_t src[LP_MAX_VECTOR_LENGTH*LP_MAX_VECTOR_LENGTH]; - uint8_t dst[LP_MAX_VECTOR_LENGTH*LP_MAX_VECTOR_LENGTH]; + ALIGN16_ATTRIB uint8_t src[LP_MAX_VECTOR_LENGTH*LP_MAX_VECTOR_LENGTH]; + ALIGN16_ATTRIB uint8_t dst[LP_MAX_VECTOR_LENGTH*LP_MAX_VECTOR_LENGTH]; double fref[LP_MAX_VECTOR_LENGTH*LP_MAX_VECTOR_LENGTH]; uint8_t ref[LP_MAX_VECTOR_LENGTH*LP_MAX_VECTOR_LENGTH]; int64_t start_counter = 0; diff --git a/src/gallium/drivers/llvmpipe/lp_test_format.c b/src/gallium/drivers/llvmpipe/lp_test_format.c index b2403ad521..23ea9ebbe7 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_format.c +++ b/src/gallium/drivers/llvmpipe/lp_test_format.c @@ -199,6 +199,7 @@ add_store_rgba_test(LLVMModuleRef module, } +ALIGN_STACK static boolean test_format(unsigned verbose, FILE *fp, const struct pixel_test_case *test) { -- cgit v1.2.3 From a9035f3dc313d047ce3af191d6d7ac8ada8167df Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Mon, 9 Nov 2009 11:34:13 -0500 Subject: r600: add missing ZPASS setup bits for r7xx+ --- src/mesa/drivers/dri/r600/r600_reg_r7xx.h | 2 ++ src/mesa/drivers/dri/r600/r700_state.c | 4 ++++ 2 files changed, 6 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_reg_r7xx.h b/src/mesa/drivers/dri/r600/r600_reg_r7xx.h index e5c01c861a..eb169bd885 100644 --- a/src/mesa/drivers/dri/r600/r600_reg_r7xx.h +++ b/src/mesa/drivers/dri/r600/r600_reg_r7xx.h @@ -143,6 +143,8 @@ enum { // SQ_TEX_SAMPLER_MISC_0 = 0x0003d03c, R7xx_TRUNCATE_COORD_bit = 1 << 9, R7xx_DISABLE_CUBE_WRAP_bit = 1 << 10, +// DB_RENDER_CONTROL = 0x00028d0c, + PERFECT_ZPASS_COUNTS_bit = 1 << 15, } ; diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index b278887266..b95fc87d30 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -1686,6 +1686,10 @@ void r700InitState(GLcontext * ctx) //------------------- SETfield(r700->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIS_ENABLE0_shift, FORCE_HIS_ENABLE0_mask); SETfield(r700->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIS_ENABLE1_shift, FORCE_HIS_ENABLE1_mask); SETbit(r700->DB_RENDER_OVERRIDE.u32All, NOOP_CULL_DISABLE_bit); + if (context->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV770) + { + CLEARbit(r700->DB_RENDER_CONTROL.u32All, PERFECT_ZPASS_COUNTS_bit); + } r700->DB_ALPHA_TO_MASK.u32All = 0; SETfield(r700->DB_ALPHA_TO_MASK.u32All, 2, ALPHA_TO_MASK_OFFSET0_shift, ALPHA_TO_MASK_OFFSET0_mask); -- cgit v1.2.3 From 37676b396a8416ad35253412d3a2e06482859a4d Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Mon, 9 Nov 2009 11:36:10 -0500 Subject: r600: don't emit htile regs These are needed for HiZ which is not currently used and the _BASE reg requires a reloc which is not currently supported in the drm. --- src/mesa/drivers/dri/r600/r700_chip.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index 47b38d2e36..ec76fbcb6d 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -784,8 +784,7 @@ static void r700SendDBState(GLcontext *ctx, struct radeon_state_atom *atom) BATCH_LOCALS(&context->radeon); radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - BEGIN_BATCH_NO_AUTOSTATE(23); - R600_OUT_BATCH_REGVAL(DB_HTILE_DATA_BASE, r700->DB_HTILE_DATA_BASE.u32All); + BEGIN_BATCH_NO_AUTOSTATE(17); R600_OUT_BATCH_REGSEQ(DB_STENCIL_CLEAR, 2); R600_OUT_BATCH(r700->DB_STENCIL_CLEAR.u32All); @@ -798,7 +797,6 @@ static void r700SendDBState(GLcontext *ctx, struct radeon_state_atom *atom) R600_OUT_BATCH(r700->DB_RENDER_CONTROL.u32All); R600_OUT_BATCH(r700->DB_RENDER_OVERRIDE.u32All); - R600_OUT_BATCH_REGVAL(DB_HTILE_SURFACE, r700->DB_HTILE_SURFACE.u32All); R600_OUT_BATCH_REGVAL(DB_ALPHA_TO_MASK, r700->DB_ALPHA_TO_MASK.u32All); END_BATCH(); @@ -1282,7 +1280,7 @@ void r600InitAtoms(context_t *context) context->radeon.hw.atomlist.name = "atom-list"; ALLOC_STATE(sq, always, 34, r700SendSQConfig); - ALLOC_STATE(db, always, 23, r700SendDBState); + ALLOC_STATE(db, always, 17, r700SendDBState); ALLOC_STATE(stencil, always, 4, r700SendStencilState); ALLOC_STATE(db_target, always, 12, r700SendDepthTargetState); ALLOC_STATE(sc, always, 15, r700SendSCState); -- cgit v1.2.3 From 66d6f9e860143c3d705f1d78c324159cadd258cc Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Mon, 9 Nov 2009 12:20:47 -0500 Subject: r600: rework DB render setup - consolidate DB render setup - only enable perfect ZPASS counts and cull disable when OQ is active - enable early Z --- src/mesa/drivers/dri/r600/r700_fragprog.c | 27 ++-------- src/mesa/drivers/dri/r600/r700_render.c | 4 +- src/mesa/drivers/dri/r600/r700_state.c | 82 +++++++++++++++++++++++++------ src/mesa/drivers/dri/r600/r700_state.h | 2 +- 4 files changed, 73 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c index 0f549ead9c..ccafd433bf 100644 --- a/src/mesa/drivers/dri/r600/r700_fragprog.c +++ b/src/mesa/drivers/dri/r600/r700_fragprog.c @@ -393,26 +393,6 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx) SETfield(r700->ps.SQ_PGM_EXPORTS_PS.u32All, fp->r700Shader.exportMode, EXPORT_MODE_shift, EXPORT_MODE_mask); - R600_STATECHANGE(context, db); - - if(fp->r700Shader.killIsUsed) - { - SETbit(r700->DB_SHADER_CONTROL.u32All, KILL_ENABLE_bit); - } - else - { - CLEARbit(r700->DB_SHADER_CONTROL.u32All, KILL_ENABLE_bit); - } - - if(fp->r700Shader.depthIsExported) - { - SETbit(r700->DB_SHADER_CONTROL.u32All, Z_EXPORT_ENABLE_bit); - } - else - { - CLEARbit(r700->DB_SHADER_CONTROL.u32All, Z_EXPORT_ENABLE_bit); - } - // emit ps input map unBit = 1 << FRAG_ATTRIB_WPOS; if(mesa_fp->Base.InputsRead & unBit) @@ -479,9 +459,12 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx) } } - R600_STATECHANGE(context, cb); exportCount = (r700->ps.SQ_PGM_EXPORTS_PS.u32All & EXPORT_MODE_mask) / (1 << EXPORT_MODE_shift); - r700->CB_SHADER_CONTROL.u32All = (1 << exportCount) - 1; + if (r700->CB_SHADER_CONTROL.u32All != ((1 << exportCount) - 1)) + { + R600_STATECHANGE(context, cb); + r700->CB_SHADER_CONTROL.u32All = (1 << exportCount) - 1; + } /* sent out shader constants. */ paramList = fp->mesa_program.Base.Parameters; diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index c345b9d8ac..47f89c91f8 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -59,9 +59,7 @@ void r700WaitForIdle(context_t *context); void r700WaitForIdleClean(context_t *context); -GLboolean r700SendTextureState(context_t *context); static unsigned int r700PrimitiveType(int prim); -void r600UpdateTextureState(GLcontext * ctx); GLboolean r700SyncSurf(context_t *context, struct radeon_bo *pbo, uint32_t read_domain, @@ -891,7 +889,7 @@ static GLboolean r700TryDrawPrims(GLcontext *ctx, r700SetScissor(context); r700SetupVertexProgram(ctx); r700SetupFragmentProgram(ctx); - r600UpdateTextureState(ctx); + r700UpdateShaderStates(ctx); GLuint emit_end = r700PredictRenderSize(ctx, prim, ib, nr_prims) + context->radeon.cmdbuf.cs->cdw; diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index b95fc87d30..41000dc8ce 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -54,7 +54,7 @@ #include "r700_fragprog.h" #include "r700_vertprog.h" - +void r600UpdateTextureState(GLcontext * ctx); static void r700SetClipPlaneState(GLcontext * ctx, GLenum cap, GLboolean state); static void r700UpdatePolygonMode(GLcontext * ctx); static void r700SetPolygonOffsetState(GLcontext * ctx, GLboolean state); @@ -191,6 +191,70 @@ static void r700InvalidateState(GLcontext * ctx, GLuint new_state) //----------- context->radeon.NewGLState |= new_state; } +static void r700SetDBRenderState(GLcontext * ctx) +{ + context_t *context = R700_CONTEXT(ctx); + R700_CHIP_CONTEXT *r700 = (R700_CHIP_CONTEXT*)(&context->hw); + struct r700_fragment_program *fp = (struct r700_fragment_program *) + (ctx->FragmentProgram._Current); + + R600_STATECHANGE(context, db); + + SETbit(r700->DB_SHADER_CONTROL.u32All, DUAL_EXPORT_ENABLE_bit); + SETfield(r700->DB_SHADER_CONTROL.u32All, EARLY_Z_THEN_LATE_Z, Z_ORDER_shift, Z_ORDER_mask); + /* XXX not sure if this is required */ + if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) + SETbit(r700->DB_RENDER_OVERRIDE.u32All, FORCE_SHADER_Z_ORDER_bit); + /* XXX need to enable htile for hiz/s */ + SETfield(r700->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIZ_ENABLE_shift, FORCE_HIZ_ENABLE_mask); + SETfield(r700->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIS_ENABLE0_shift, FORCE_HIS_ENABLE0_mask); + SETfield(r700->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIS_ENABLE1_shift, FORCE_HIS_ENABLE1_mask); + + if (context->radeon.query.current) + { + SETbit(r700->DB_RENDER_OVERRIDE.u32All, NOOP_CULL_DISABLE_bit); + if (context->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV770) + { + SETbit(r700->DB_RENDER_CONTROL.u32All, PERFECT_ZPASS_COUNTS_bit); + } + } + else + { + CLEARbit(r700->DB_RENDER_OVERRIDE.u32All, NOOP_CULL_DISABLE_bit); + if (context->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV770) + { + CLEARbit(r700->DB_RENDER_CONTROL.u32All, PERFECT_ZPASS_COUNTS_bit); + } + } + + if (fp) + { + if (fp->r700Shader.killIsUsed) + { + SETbit(r700->DB_SHADER_CONTROL.u32All, KILL_ENABLE_bit); + } + else + { + CLEARbit(r700->DB_SHADER_CONTROL.u32All, KILL_ENABLE_bit); + } + + if (fp->r700Shader.depthIsExported) + { + SETbit(r700->DB_SHADER_CONTROL.u32All, Z_EXPORT_ENABLE_bit); + } + else + { + CLEARbit(r700->DB_SHADER_CONTROL.u32All, Z_EXPORT_ENABLE_bit); + } + } +} + +void r700UpdateShaderStates(GLcontext * ctx) +{ + r700SetDBRenderState(ctx); + r600UpdateTextureState(ctx); +} + static void r700SetDepthState(GLcontext * ctx) { context_t *context = R700_CONTEXT(ctx); @@ -1672,24 +1736,10 @@ void r700InitState(GLcontext * ctx) //------------------- r700Enable(ctx, GL_DEPTH_TEST, ctx->Depth.Test); r700DepthMask(ctx, ctx->Depth.Mask); r700DepthFunc(ctx, ctx->Depth.Func); - SETbit(r700->DB_SHADER_CONTROL.u32All, DUAL_EXPORT_ENABLE_bit); - r700->DB_DEPTH_CLEAR.u32All = 0x3F800000; - - r700->DB_RENDER_CONTROL.u32All = 0; SETbit(r700->DB_RENDER_CONTROL.u32All, STENCIL_COMPRESS_DISABLE_bit); SETbit(r700->DB_RENDER_CONTROL.u32All, DEPTH_COMPRESS_DISABLE_bit); - r700->DB_RENDER_OVERRIDE.u32All = 0; - if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) - SETbit(r700->DB_RENDER_OVERRIDE.u32All, FORCE_SHADER_Z_ORDER_bit); - SETfield(r700->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIZ_ENABLE_shift, FORCE_HIZ_ENABLE_mask); - SETfield(r700->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIS_ENABLE0_shift, FORCE_HIS_ENABLE0_mask); - SETfield(r700->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIS_ENABLE1_shift, FORCE_HIS_ENABLE1_mask); - SETbit(r700->DB_RENDER_OVERRIDE.u32All, NOOP_CULL_DISABLE_bit); - if (context->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV770) - { - CLEARbit(r700->DB_RENDER_CONTROL.u32All, PERFECT_ZPASS_COUNTS_bit); - } + r700SetDBRenderState(ctx); r700->DB_ALPHA_TO_MASK.u32All = 0; SETfield(r700->DB_ALPHA_TO_MASK.u32All, 2, ALPHA_TO_MASK_OFFSET0_shift, ALPHA_TO_MASK_OFFSET0_mask); diff --git a/src/mesa/drivers/dri/r600/r700_state.h b/src/mesa/drivers/dri/r600/r700_state.h index 209189d8d7..60c6a7f23c 100644 --- a/src/mesa/drivers/dri/r600/r700_state.h +++ b/src/mesa/drivers/dri/r600/r700_state.h @@ -35,7 +35,7 @@ extern void r700UpdateStateParameters(GLcontext * ctx, GLuint new_state); extern void r700UpdateShaders (GLcontext * ctx); -extern void r700UpdateShaders2(GLcontext * ctx); +extern void r700UpdateShaderStates(GLcontext * ctx); extern void r700UpdateViewportOffset(GLcontext * ctx); -- cgit v1.2.3 From 74ef3207d8bd97a529e7b0ab8d99e44c805f3af0 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Mon, 9 Nov 2009 11:36:10 -0500 Subject: r600: don't emit htile regs These are needed for HiZ which is not currently used and the _BASE reg requires a reloc which is not currently supported in the drm. --- src/mesa/drivers/dri/r600/r700_chip.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index 06d7e9c9ab..8707a764ac 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -794,8 +794,7 @@ static void r700SendDBState(GLcontext *ctx, struct radeon_state_atom *atom) BATCH_LOCALS(&context->radeon); radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - BEGIN_BATCH_NO_AUTOSTATE(23); - R600_OUT_BATCH_REGVAL(DB_HTILE_DATA_BASE, r700->DB_HTILE_DATA_BASE.u32All); + BEGIN_BATCH_NO_AUTOSTATE(17); R600_OUT_BATCH_REGSEQ(DB_STENCIL_CLEAR, 2); R600_OUT_BATCH(r700->DB_STENCIL_CLEAR.u32All); @@ -808,7 +807,6 @@ static void r700SendDBState(GLcontext *ctx, struct radeon_state_atom *atom) R600_OUT_BATCH(r700->DB_RENDER_CONTROL.u32All); R600_OUT_BATCH(r700->DB_RENDER_OVERRIDE.u32All); - R600_OUT_BATCH_REGVAL(DB_HTILE_SURFACE, r700->DB_HTILE_SURFACE.u32All); R600_OUT_BATCH_REGVAL(DB_ALPHA_TO_MASK, r700->DB_ALPHA_TO_MASK.u32All); END_BATCH(); @@ -1239,7 +1237,7 @@ void r600InitAtoms(context_t *context) context->radeon.hw.atomlist.name = "atom-list"; ALLOC_STATE(sq, always, 34, r700SendSQConfig); - ALLOC_STATE(db, always, 23, r700SendDBState); + ALLOC_STATE(db, always, 17, r700SendDBState); ALLOC_STATE(stencil, always, 4, r700SendStencilState); ALLOC_STATE(db_target, always, 12, r700SendDepthTargetState); ALLOC_STATE(sc, always, 15, r700SendSCState); -- cgit v1.2.3 From 216319fc0fe5dc3f298dd602812afa0f28a4ee60 Mon Sep 17 00:00:00 2001 From: Jerome Glisse Date: Mon, 9 Nov 2009 22:37:41 +0100 Subject: r600/r700: typo, fix mask of DB_ALPHA_TO_MASK --- src/mesa/drivers/dri/r600/r600_reg_r6xx.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_reg_r6xx.h b/src/mesa/drivers/dri/r600/r600_reg_r6xx.h index f7702c46de..74af7b4fed 100644 --- a/src/mesa/drivers/dri/r600/r600_reg_r6xx.h +++ b/src/mesa/drivers/dri/r600/r600_reg_r6xx.h @@ -415,11 +415,11 @@ enum { ALPHA_TO_MASK_ENABLE = 1 << 0, ALPHA_TO_MASK_OFFSET0_mask = 0x03 << 8, ALPHA_TO_MASK_OFFSET0_shift = 8, - ALPHA_TO_MASK_OFFSET1_mask = 0x03 << 8, + ALPHA_TO_MASK_OFFSET1_mask = 0x03 << 10, ALPHA_TO_MASK_OFFSET1_shift = 10, - ALPHA_TO_MASK_OFFSET2_mask = 0x03 << 8, + ALPHA_TO_MASK_OFFSET2_mask = 0x03 << 12, ALPHA_TO_MASK_OFFSET2_shift = 12, - ALPHA_TO_MASK_OFFSET3_mask = 0x03 << 8, + ALPHA_TO_MASK_OFFSET3_mask = 0x03 << 14, ALPHA_TO_MASK_OFFSET3_shift = 14, // SQ_VTX_CONSTANT_WORD2_0 = 0x00038008, -- cgit v1.2.3 From a6d527d7b82579feae9db20657d47a3f86115bb4 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Mon, 9 Nov 2009 18:01:55 -0500 Subject: st/xorg: fix composite batching quite a large performance optimization (text demo from 1.6fps to 9fps) --- src/gallium/state_trackers/xorg/xorg_composite.c | 10 +++++++++- src/gallium/state_trackers/xorg/xorg_renderer.c | 9 +++++++-- src/gallium/state_trackers/xorg/xorg_renderer.h | 4 ++-- 3 files changed, 18 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 8947d0a67c..4f4b02cdbc 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -287,6 +287,14 @@ bind_samplers(struct exa_context *exa, int op, exa->num_bound_samplers = 0; +#if 0 + if ((pSrc && (exa->pipe->is_texture_referenced(exa->pipe, pSrc->tex, 0, 0) & + PIPE_REFERENCED_FOR_WRITE)) || + (pMask && (exa->pipe->is_texture_referenced(exa->pipe, pMask->tex, 0, 0) & + PIPE_REFERENCED_FOR_WRITE))) + xorg_exa_flush(exa, PIPE_FLUSH_RENDER_CACHE, NULL); +#endif + memset(&src_sampler, 0, sizeof(struct pipe_sampler_state)); memset(&mask_sampler, 0, sizeof(struct pipe_sampler_state)); @@ -461,7 +469,7 @@ void xorg_composite(struct exa_context *exa, if (exa->transform.has_mask) mask_matrix = exa->transform.mask; -#if 1 +#if 0 renderer_draw_textures(exa->renderer, pos, width, height, exa->bound_textures, diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 947f4ca531..c7a04836a5 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -21,6 +21,8 @@ enum AxisOrientation { #define floatsEqual(x, y) (fabs(x - y) <= 0.00001f * MIN2(fabs(x), fabs(y))) #define floatIsZero(x) (floatsEqual((x) + 1, 1)) +#define NUM_COMPONENTS 4 + static INLINE boolean is_affine(float *matrix) { return floatIsZero(matrix[2]) && floatIsZero(matrix[5]) @@ -62,6 +64,7 @@ renderer_draw(struct xorg_renderer *r) { struct pipe_context *pipe = r->pipe; struct pipe_buffer *buf = 0; + int num_verts = r->num_vertices/(r->num_attributes * NUM_COMPONENTS); if (!r->num_vertices) return; @@ -72,7 +75,7 @@ renderer_draw(struct xorg_renderer *r) if (buf) { util_draw_vertex_buffer(pipe, buf, 0, PIPE_PRIM_QUADS, - 4, /* verts */ + num_verts, /* verts */ r->num_attributes); /* attribs/vert */ pipe_buffer_reference(&buf, NULL); @@ -84,8 +87,9 @@ renderer_draw_conditional(struct xorg_renderer *r, int next_batch) { if (r->num_vertices + next_batch >= BUF_SIZE || - (next_batch == 0 && r->num_vertices)) + (next_batch == 0 && r->num_vertices)) { renderer_draw(r); + } } static void @@ -892,6 +896,7 @@ void renderer_begin_textures(struct xorg_renderer *r, int num_textures) { r->num_attributes = 1 + num_textures; + r->num_vertices = 0; } void renderer_texture(struct xorg_renderer *r, diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h index 780d97fe85..4cd929342e 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.h +++ b/src/gallium/state_trackers/xorg/xorg_renderer.h @@ -11,9 +11,9 @@ struct exa_pixmap_priv; * max number of attributes per vertex * * max number of components per attribute * - * currently the max is 5 quads + * currently the max is 100 quads */ -#define BUF_SIZE (20 * 3 * 4) +#define BUF_SIZE (100 * 4 * 3 * 4) struct xorg_renderer { struct pipe_context *pipe; -- cgit v1.2.3 From 031fbb9681d6ddc3b515768a914496b2b550cfce Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Mon, 9 Nov 2009 18:03:18 -0500 Subject: st/xorg: remove deprecated rendering code --- src/gallium/state_trackers/xorg/xorg_composite.c | 8 ---- src/gallium/state_trackers/xorg/xorg_renderer.c | 51 ------------------------ src/gallium/state_trackers/xorg/xorg_renderer.h | 8 ---- 3 files changed, 67 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 4f4b02cdbc..fc449122b6 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -469,19 +469,11 @@ void xorg_composite(struct exa_context *exa, if (exa->transform.has_mask) mask_matrix = exa->transform.mask; -#if 0 - renderer_draw_textures(exa->renderer, - pos, width, height, - exa->bound_textures, - exa->num_bound_samplers, - src_matrix, mask_matrix); -#else renderer_texture(exa->renderer, pos, width, height, exa->bound_textures, exa->num_bound_samplers, src_matrix, mask_matrix); -#endif } } diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index c7a04836a5..f0e889c3c8 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -947,54 +947,3 @@ void renderer_texture(struct xorg_renderer *r, break; } } - - -void renderer_draw_textures(struct xorg_renderer *r, - int *pos, - int width, int height, - struct pipe_texture **textures, - int num_textures, - float *src_matrix, float *mask_matrix) -{ -#if 0 - if (src_matrix) { - debug_printf("src_matrix = \n"); - debug_printf("%f, %f, %f\n", src_matrix[0], src_matrix[1], src_matrix[2]); - debug_printf("%f, %f, %f\n", src_matrix[3], src_matrix[4], src_matrix[5]); - debug_printf("%f, %f, %f\n", src_matrix[6], src_matrix[7], src_matrix[8]); - } - if (mask_matrix) { - debug_printf("mask_matrix = \n"); - debug_printf("%f, %f, %f\n", mask_matrix[0], mask_matrix[1], mask_matrix[2]); - debug_printf("%f, %f, %f\n", mask_matrix[3], mask_matrix[4], mask_matrix[5]); - debug_printf("%f, %f, %f\n", mask_matrix[6], mask_matrix[7], mask_matrix[8]); - } -#endif - - r->num_attributes = 1 + num_textures; - switch(num_textures) { - case 1: - add_vertex_data1(r, - pos[0], pos[1], /* src */ - pos[4], pos[5], /* dst */ - width, height, - textures[0], src_matrix); - break; - case 2: - add_vertex_data2(r, - pos[0], pos[1], /* src */ - pos[2], pos[3], /* mask */ - pos[4], pos[5], /* dst */ - width, height, - textures[0], textures[1], - src_matrix, mask_matrix); - break; - case 3: - default: - debug_assert(!"Unsupported number of textures"); - break; - } - - renderer_draw(r); -} - diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h index 4cd929342e..6b658fdbe8 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.h +++ b/src/gallium/state_trackers/xorg/xorg_renderer.h @@ -73,12 +73,4 @@ void renderer_texture(struct xorg_renderer *r, void renderer_draw_flush(struct xorg_renderer *r); -void renderer_draw_textures(struct xorg_renderer *r, - int *pos, - int width, int height, - struct pipe_texture **textures, - int num_textures, - float *src_matrix, float *mask_matrix); - - #endif -- cgit v1.2.3 From 83760d961fbaeaca8ab82ae497b26e90691f7654 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 10 Nov 2009 02:46:24 +0100 Subject: slang: Handle OOM condition in new_instruction(). --- src/mesa/shader/slang/slang_emit.c | 101 +++++++++++++++++++++++++++++-------- 1 file changed, 81 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 3af301eacd..d4a61dcd49 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -431,6 +431,9 @@ new_instruction(slang_emit_info *emitInfo, gl_inst_opcode opcode) _mesa_realloc_instructions(prog->Instructions, prog->NumInstructions, emitInfo->MaxInstructions); + if (!prog->Instructions) { + return NULL; + } } inst = prog->Instructions + prog->NumInstructions; @@ -451,12 +454,14 @@ emit_arl_load(slang_emit_info *emitInfo, gl_register_file file, GLint index, GLuint swizzle) { struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_ARL); - inst->SrcReg[0].File = file; - inst->SrcReg[0].Index = index; - inst->SrcReg[0].Swizzle = fix_swizzle(swizzle); - inst->DstReg.File = PROGRAM_ADDRESS; - inst->DstReg.Index = 0; - inst->DstReg.WriteMask = WRITEMASK_X; + if (inst) { + inst->SrcReg[0].File = file; + inst->SrcReg[0].Index = index; + inst->SrcReg[0].Swizzle = fix_swizzle(swizzle); + inst->DstReg.File = PROGRAM_ADDRESS; + inst->DstReg.Index = 0; + inst->DstReg.WriteMask = WRITEMASK_X; + } return inst; } @@ -765,7 +770,9 @@ static struct prog_instruction * emit_comment(slang_emit_info *emitInfo, const char *comment) { struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_NOP); - inst_comment(inst, comment); + if (inst) { + inst_comment(inst, comment); + } return inst; } @@ -1191,6 +1198,9 @@ emit_fcall(slang_emit_info *emitInfo, slang_ir_node *n) * really just a NOP to attach the label to. */ inst = new_instruction(emitInfo, OPCODE_BGNSUB); + if (!inst) { + return NULL; + } inst_comment(inst, n->Label->Name); } @@ -1202,10 +1212,16 @@ emit_fcall(slang_emit_info *emitInfo, slang_ir_node *n) inst = prev_instruction(emitInfo); if (inst && inst->Opcode != OPCODE_RET) { inst = new_instruction(emitInfo, OPCODE_RET); + if (!inst) { + return NULL; + } } if (emitInfo->EmitBeginEndSub) { inst = new_instruction(emitInfo, OPCODE_ENDSUB); + if (!inst) { + return NULL; + } inst_comment(inst, n->Label->Name); } @@ -1215,6 +1231,9 @@ emit_fcall(slang_emit_info *emitInfo, slang_ir_node *n) /* emit the function call */ inst = new_instruction(emitInfo, OPCODE_CAL); + if (!inst) { + return NULL; + } /* The branch target is just the subroutine number (changed later) */ inst->BranchTarget = subroutineId; inst_comment(inst, n->Label->Name); @@ -1249,6 +1268,9 @@ emit_kill(slang_emit_info *emitInfo) * Note that ARB-KILL depends on sign of vector operand. */ inst = new_instruction(emitInfo, OPCODE_KIL_NV); + if (!inst) { + return NULL; + } inst->DstReg.CondMask = COND_TR; /* always kill */ assert(emitInfo->prog->Target == GL_FRAGMENT_PROGRAM_ARB); @@ -1600,8 +1622,10 @@ emit_if(slang_emit_info *emitInfo, slang_ir_node *n) if (emitInfo->EmitHighLevelInstructions) { if (emitInfo->EmitCondCodes) { /* IF condcode THEN ... */ - struct prog_instruction *ifInst; - ifInst = new_instruction(emitInfo, OPCODE_IF); + struct prog_instruction *ifInst = new_instruction(emitInfo, OPCODE_IF); + if (!ifInst) { + return NULL; + } ifInst->DstReg.CondMask = COND_NE; /* if cond is non-zero */ /* only test the cond code (1 of 4) that was updated by the * previous instruction. @@ -1620,6 +1644,9 @@ emit_if(slang_emit_info *emitInfo, slang_ir_node *n) else { /* conditional jump to else, or endif */ struct prog_instruction *ifInst = new_instruction(emitInfo, OPCODE_BRA); + if (!ifInst) { + return NULL; + } ifInst->DstReg.CondMask = COND_EQ; /* BRA if cond is zero */ inst_comment(ifInst, "if zero"); ifInst->DstReg.CondSwizzle = writemask_to_swizzle(condWritemask); @@ -1632,12 +1659,17 @@ emit_if(slang_emit_info *emitInfo, slang_ir_node *n) /* have else body */ elseInstLoc = prog->NumInstructions; if (emitInfo->EmitHighLevelInstructions) { - (void) new_instruction(emitInfo, OPCODE_ELSE); + struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_ELSE); + if (!inst) { + return NULL; + } } else { /* jump to endif instruction */ - struct prog_instruction *inst; - inst = new_instruction(emitInfo, OPCODE_BRA); + struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_BRA); + if (!inst) { + return NULL; + } inst_comment(inst, "else"); inst->DstReg.CondMask = COND_TR; /* always branch */ } @@ -1650,7 +1682,10 @@ emit_if(slang_emit_info *emitInfo, slang_ir_node *n) } if (emitInfo->EmitHighLevelInstructions) { - (void) new_instruction(emitInfo, OPCODE_ENDIF); + struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_ENDIF); + if (!inst) { + return NULL; + } } if (n->Children[2]) { @@ -1671,7 +1706,10 @@ emit_loop(slang_emit_info *emitInfo, slang_ir_node *n) /* emit OPCODE_BGNLOOP */ beginInstLoc = prog->NumInstructions; if (emitInfo->EmitHighLevelInstructions) { - (void) new_instruction(emitInfo, OPCODE_BGNLOOP); + struct prog_instruction *inst = new_instruction(emitInfo, OPCODE_BGNLOOP); + if (!inst) { + return NULL; + } } /* body */ @@ -1689,10 +1727,16 @@ emit_loop(slang_emit_info *emitInfo, slang_ir_node *n) if (emitInfo->EmitHighLevelInstructions) { /* emit OPCODE_ENDLOOP */ endInst = new_instruction(emitInfo, OPCODE_ENDLOOP); + if (!endInst) { + return NULL; + } } else { /* emit unconditional BRA-nch */ endInst = new_instruction(emitInfo, OPCODE_BRA); + if (!endInst) { + return NULL; + } endInst->DstReg.CondMask = COND_TR; /* always true */ } /* ENDLOOP's BranchTarget points to the BGNLOOP inst */ @@ -1762,7 +1806,9 @@ emit_cont_break(slang_emit_info *emitInfo, slang_ir_node *n) } n->InstLocation = emitInfo->prog->NumInstructions; inst = new_instruction(emitInfo, opcode); - inst->DstReg.CondMask = COND_TR; /* always true */ + if (inst) { + inst->DstReg.CondMask = COND_TR; /* always true */ + } return inst; } @@ -1798,8 +1844,10 @@ emit_cont_break_if_true(slang_emit_info *emitInfo, slang_ir_node *n) */ const GLuint condWritemask = inst->DstReg.WriteMask; inst = new_instruction(emitInfo, opcode); - inst->DstReg.CondMask = COND_NE; - inst->DstReg.CondSwizzle = writemask_to_swizzle(condWritemask); + if (inst) { + inst->DstReg.CondMask = COND_NE; + inst->DstReg.CondSwizzle = writemask_to_swizzle(condWritemask); + } return inst; } else { @@ -1817,7 +1865,13 @@ emit_cont_break_if_true(slang_emit_info *emitInfo, slang_ir_node *n) n->InstLocation = emitInfo->prog->NumInstructions; inst = new_instruction(emitInfo, opcode); + if (!inst) { + return NULL; + } inst = new_instruction(emitInfo, OPCODE_ENDIF); + if (!inst) { + return NULL; + } emitInfo->prog->Instructions[ifInstLoc].BranchTarget = emitInfo->prog->NumInstructions; @@ -1828,8 +1882,10 @@ emit_cont_break_if_true(slang_emit_info *emitInfo, slang_ir_node *n) const GLuint condWritemask = inst->DstReg.WriteMask; assert(emitInfo->EmitCondCodes); inst = new_instruction(emitInfo, OPCODE_BRA); - inst->DstReg.CondMask = COND_NE; - inst->DstReg.CondSwizzle = writemask_to_swizzle(condWritemask); + if (inst) { + inst->DstReg.CondMask = COND_NE; + inst->DstReg.CondSwizzle = writemask_to_swizzle(condWritemask); + } return inst; } } @@ -2201,7 +2257,9 @@ emit(slang_emit_info *emitInfo, slang_ir_node *n) if (n->Comment) { inst = new_instruction(emitInfo, OPCODE_NOP); - inst->Comment = _mesa_strdup(n->Comment); + if (inst) { + inst->Comment = _mesa_strdup(n->Comment); + } inst = NULL; } @@ -2503,6 +2561,9 @@ _slang_emit_code(slang_ir_node *n, slang_var_table *vt, if (withEnd) { struct prog_instruction *inst; inst = new_instruction(&emitInfo, OPCODE_END); + if (!inst) { + return GL_FALSE; + } } _slang_resolve_subroutines(&emitInfo); -- cgit v1.2.3 From e44c77028c2964891943e4235e44d93c559de088 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 10 Nov 2009 03:08:21 +0100 Subject: tgsi/ureg: Simplify logic in tokens_expand(). --- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 4731e3bde8..3f752e9352 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -140,8 +140,9 @@ static void tokens_expand( struct ureg_tokens *tokens, { unsigned old_size = tokens->size * sizeof(unsigned); - if (tokens->tokens == error_tokens) - goto fail; + if (tokens->tokens == error_tokens) { + return; + } while (tokens->count + count > tokens->size) { tokens->size = (1 << ++tokens->order); @@ -150,13 +151,9 @@ static void tokens_expand( struct ureg_tokens *tokens, tokens->tokens = REALLOC(tokens->tokens, old_size, tokens->size * sizeof(unsigned)); - if (tokens->tokens == NULL) - goto fail; - - return; - -fail: - tokens_error(tokens); + if (tokens->tokens == NULL) { + tokens_error(tokens); + } } static void set_bad( struct ureg_program *ureg ) -- cgit v1.2.3 From b5d8a7b6dc1b48c2a11131803e1f37c05fe0bd03 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 10 Nov 2009 03:12:02 +0100 Subject: tgsi/exec: Exit early on error. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 1989045985..b7569e74d4 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -1811,8 +1811,8 @@ exec_declaration( break; default: - eval = NULL; assert( 0 ); + return; } if( mask == TGSI_WRITEMASK_XYZW ) { -- cgit v1.2.3 From b2a29ad3092c17f9a7d75ab123ec5c4619c87ec3 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 10 Nov 2009 03:25:06 +0100 Subject: slang: Fix signed/unsigned int handling in _slang_free_temp(). --- src/mesa/shader/slang/slang_vartable.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_vartable.c b/src/mesa/shader/slang/slang_vartable.c index a4ebacc093..e07e3a226a 100644 --- a/src/mesa/shader/slang/slang_vartable.c +++ b/src/mesa/shader/slang/slang_vartable.c @@ -311,10 +311,10 @@ _slang_free_temp(slang_var_table *vt, slang_ir_storage *store) { struct table *t = vt->Top; GLuint i; - GLuint r = store->Index; + GLint r = store->Index; assert(store->Size > 0); assert(r >= 0); - assert(r + store->Size <= vt->MaxRegisters * 4); + assert((GLuint)r + store->Size <= vt->MaxRegisters * 4); if (dbg) printf("Free temp sz %d at %d.%s (level %d) store %p\n", store->Size, r, _mesa_swizzle_string(store->Swizzle, 0, 0), -- cgit v1.2.3 From cc470bf0ca65592b834c31c662fc795fb7acc58c Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 10 Nov 2009 04:03:55 +0100 Subject: slang: Check return value from new_instruction(). --- src/mesa/shader/slang/slang_emit.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index d4a61dcd49..5eabe615b9 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -1254,7 +1254,9 @@ emit_return(slang_emit_info *emitInfo, slang_ir_node *n) assert(n->Opcode == IR_RETURN); assert(n->Label); inst = new_instruction(emitInfo, OPCODE_RET); - inst->DstReg.CondMask = COND_TR; /* always return */ + if (inst) { + inst->DstReg.CondMask = COND_TR; /* always return */ + } return inst; } -- cgit v1.2.3 From eef5a0b3a3e03abd1c69649763efc79575df650f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 10 Nov 2009 05:22:15 -0800 Subject: llvmpipe: Fix derived blend color state. --- src/gallium/drivers/llvmpipe/lp_state_blend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_state_blend.c b/src/gallium/drivers/llvmpipe/lp_state_blend.c index 3f03bd0057..b2e75d3b14 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_blend.c +++ b/src/gallium/drivers/llvmpipe/lp_state_blend.c @@ -76,7 +76,7 @@ void llvmpipe_set_blend_color( struct pipe_context *pipe, for (i = 0; i < 4; ++i) { uint8_t c = float_to_ubyte(blend_color->color[i]); for (j = 0; j < 16; ++j) - llvmpipe->jit_context.blend_color[i*4 + j] = c; + llvmpipe->jit_context.blend_color[i*16 + j] = c; } } -- cgit v1.2.3 From 413e933fd57c53e6d6659cfcf21aba42249f43ca Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 10 Nov 2009 18:27:20 +0100 Subject: slang: Check OOM conditions for alloc_node_storage(). --- src/mesa/shader/slang/slang_emit.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 5eabe615b9..18d0146277 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -195,6 +195,9 @@ alloc_node_storage(slang_emit_info *emitInfo, slang_ir_node *n, if (!n->Store) { assert(defaultSize > 0); n->Store = _slang_new_ir_storage(PROGRAM_TEMPORARY, -1, defaultSize); + if (!n->Store) { + return GL_FALSE; + } } /* now allocate actual register(s). I.e. set n->Store->Index >= 0 */ @@ -799,7 +802,9 @@ emit_arith(slang_emit_info *emitInfo, slang_ir_node *n) emit(emitInfo, n->Children[0]->Children[0]); /* A */ emit(emitInfo, n->Children[0]->Children[1]); /* B */ emit(emitInfo, n->Children[1]); /* C */ - alloc_node_storage(emitInfo, n, -1); /* dest */ + if (alloc_node_storage(emitInfo, n, -1)) { /* dest */ + return NULL; + } inst = emit_instruction(emitInfo, OPCODE_MAD, @@ -820,7 +825,9 @@ emit_arith(slang_emit_info *emitInfo, slang_ir_node *n) emit(emitInfo, n->Children[0]); /* A */ emit(emitInfo, n->Children[1]->Children[0]); /* B */ emit(emitInfo, n->Children[1]->Children[1]); /* C */ - alloc_node_storage(emitInfo, n, -1); /* dest */ + if (!alloc_node_storage(emitInfo, n, -1)) { /* dest */ + return NULL; + } inst = emit_instruction(emitInfo, OPCODE_MAD, @@ -846,7 +853,9 @@ emit_arith(slang_emit_info *emitInfo, slang_ir_node *n) } /* result storage */ - alloc_node_storage(emitInfo, n, -1); + if (!alloc_node_storage(emitInfo, n, -1)) { + return NULL; + } inst = emit_instruction(emitInfo, info->InstOpcode, @@ -1100,7 +1109,9 @@ emit_clamp(slang_emit_info *emitInfo, slang_ir_node *n) * the intermediate result. Use a temp register instead. */ _mesa_bzero(&tmpNode, sizeof(tmpNode)); - alloc_node_storage(emitInfo, &tmpNode, n->Store->Size); + if (!alloc_node_storage(emitInfo, &tmpNode, n->Store->Size)) { + return NULL; + } /* tmp = max(ch[0], ch[1]) */ inst = emit_instruction(emitInfo, OPCODE_MAX, -- cgit v1.2.3 From 5e17c89eadd1a1a5555caa235cf7696e335d25f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 10 Nov 2009 10:09:56 -0800 Subject: st/xorg: Fix SCons build. Check for new DPMS header and add xorg_renderer.c source file. --- src/gallium/state_trackers/xorg/SConscript | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/SConscript b/src/gallium/state_trackers/xorg/SConscript index 6165bae7a4..5d0b6613ac 100644 --- a/src/gallium/state_trackers/xorg/SConscript +++ b/src/gallium/state_trackers/xorg/SConscript @@ -13,6 +13,11 @@ if 'xorg' in env['statetrackers']: env.ParseConfig('pkg-config --cflags --libs xorg-server') + conf = env.Configure() + + if conf.CheckHeader('X11/extensions/dpmsconst.h'): + env.Append(CPPDEFINES = [('HAVE_XEXTPROTO_71', '1')]) + st_xorg = env.ConvenienceLibrary( target = 'st_xorg', source = [ 'xorg_composite.c', @@ -22,6 +27,7 @@ if 'xorg' in env['statetrackers']: 'xorg_exa.c', 'xorg_exa_tgsi.c', 'xorg_output.c', + 'xorg_renderer.c', 'xorg_xv.c', ] ) -- cgit v1.2.3 From 28039ffdc8a7eb7d8578534a46b78ae43d16112c Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 10 Nov 2009 19:25:17 +0100 Subject: slang: Fix return value check. --- src/mesa/shader/slang/slang_emit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 18d0146277..c0e4b27aa5 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -802,7 +802,7 @@ emit_arith(slang_emit_info *emitInfo, slang_ir_node *n) emit(emitInfo, n->Children[0]->Children[0]); /* A */ emit(emitInfo, n->Children[0]->Children[1]); /* B */ emit(emitInfo, n->Children[1]); /* C */ - if (alloc_node_storage(emitInfo, n, -1)) { /* dest */ + if (!alloc_node_storage(emitInfo, n, -1)) { /* dest */ return NULL; } -- cgit v1.2.3 From d52d78b4bcd6d4c0578f972c0b8ebac09e632196 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 10 Nov 2009 10:43:19 -0800 Subject: i965: Allow use of PROGRAM_LOCAL constants in ARB_vp. Fixes piglit arl.vp. --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 1638ef8111..604d63d5f2 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -912,6 +912,7 @@ get_src_reg( struct brw_vs_compile *c, case PROGRAM_CONSTANT: case PROGRAM_UNIFORM: case PROGRAM_ENV_PARAM: + case PROGRAM_LOCAL_PARAM: if (c->vp->use_const_buffer) { return get_constant(c, inst, argIndex); } @@ -930,7 +931,6 @@ get_src_reg( struct brw_vs_compile *c, /* this is a normal case since we loop over all three src args */ return brw_null_reg(); - case PROGRAM_LOCAL_PARAM: case PROGRAM_WRITE_ONLY: default: assert(0); -- cgit v1.2.3 From 56ab92bad8f1d05bc22b8a8471d5aeb663f220de Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 10 Nov 2009 10:54:15 -0800 Subject: i965: Unalias src/dst registers for SGE and friends. Fixes piglit vp-sge-alias test, and the googleearth ground shader. \o/ Bug #22228 --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 40 +++++++++++++++++---------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 604d63d5f2..15154c3b8e 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -331,63 +331,65 @@ static void unalias3( struct brw_vs_compile *c, } } -static void emit_sop( struct brw_compile *p, +static void emit_sop( struct brw_vs_compile *c, struct brw_reg dst, struct brw_reg arg0, struct brw_reg arg1, GLuint cond) { + struct brw_compile *p = &c->func; + brw_MOV(p, dst, brw_imm_f(0.0f)); brw_CMP(p, brw_null_reg(), cond, arg0, arg1); brw_MOV(p, dst, brw_imm_f(1.0f)); brw_set_predicate_control_flag_value(p, 0xff); } -static void emit_seq( struct brw_compile *p, +static void emit_seq( struct brw_vs_compile *c, struct brw_reg dst, struct brw_reg arg0, struct brw_reg arg1 ) { - emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_EQ); + emit_sop(c, dst, arg0, arg1, BRW_CONDITIONAL_EQ); } -static void emit_sne( struct brw_compile *p, +static void emit_sne( struct brw_vs_compile *c, struct brw_reg dst, struct brw_reg arg0, struct brw_reg arg1 ) { - emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_NEQ); + emit_sop(c, dst, arg0, arg1, BRW_CONDITIONAL_NEQ); } -static void emit_slt( struct brw_compile *p, +static void emit_slt( struct brw_vs_compile *c, struct brw_reg dst, struct brw_reg arg0, struct brw_reg arg1 ) { - emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_L); + emit_sop(c, dst, arg0, arg1, BRW_CONDITIONAL_L); } -static void emit_sle( struct brw_compile *p, +static void emit_sle( struct brw_vs_compile *c, struct brw_reg dst, struct brw_reg arg0, struct brw_reg arg1 ) { - emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_LE); + emit_sop(c, dst, arg0, arg1, BRW_CONDITIONAL_LE); } -static void emit_sgt( struct brw_compile *p, +static void emit_sgt( struct brw_vs_compile *c, struct brw_reg dst, struct brw_reg arg0, struct brw_reg arg1 ) { - emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_G); + emit_sop(c, dst, arg0, arg1, BRW_CONDITIONAL_G); } -static void emit_sge( struct brw_compile *p, +static void emit_sge( struct brw_vs_compile *c, struct brw_reg dst, struct brw_reg arg0, struct brw_reg arg1 ) { - emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_GE); + emit_sop(c, dst, arg0, arg1, BRW_CONDITIONAL_GE); } static void emit_max( struct brw_compile *p, @@ -1473,25 +1475,25 @@ void brw_vs_emit(struct brw_vs_compile *c ) break; case OPCODE_SEQ: - emit_seq(p, dst, args[0], args[1]); + unalias2(c, dst, args[0], args[1], emit_seq); break; case OPCODE_SIN: emit_math1(c, BRW_MATH_FUNCTION_SIN, dst, args[0], BRW_MATH_PRECISION_FULL); break; case OPCODE_SNE: - emit_sne(p, dst, args[0], args[1]); + unalias2(c, dst, args[0], args[1], emit_sne); break; case OPCODE_SGE: - emit_sge(p, dst, args[0], args[1]); + unalias2(c, dst, args[0], args[1], emit_sge); break; case OPCODE_SGT: - emit_sgt(p, dst, args[0], args[1]); + unalias2(c, dst, args[0], args[1], emit_sgt); break; case OPCODE_SLT: - emit_slt(p, dst, args[0], args[1]); + unalias2(c, dst, args[0], args[1], emit_slt); break; case OPCODE_SLE: - emit_sle(p, dst, args[0], args[1]); + unalias2(c, dst, args[0], args[1], emit_sle); break; case OPCODE_SUB: brw_ADD(p, dst, args[0], negate(args[1])); -- cgit v1.2.3 From 520b6abdecdaba856e5ca04938e18eb83b33dfaa Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 6 Nov 2009 12:00:14 -0800 Subject: i915g: Fix memory leak when pci id is unknown. --- src/gallium/drivers/i915/i915_screen.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/i915/i915_screen.c b/src/gallium/drivers/i915/i915_screen.c index c66558c320..d4ee8f5339 100644 --- a/src/gallium/drivers/i915/i915_screen.c +++ b/src/gallium/drivers/i915/i915_screen.c @@ -271,6 +271,7 @@ i915_create_screen(struct intel_winsys *iws, uint pci_id) default: debug_printf("%s: unknown pci id 0x%x, cannot create screen\n", __FUNCTION__, pci_id); + FREE(is); return NULL; } -- cgit v1.2.3 From eb6a1f8a00596156cd7164838ef9e9a5b39e7254 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 10 Nov 2009 13:57:29 -0800 Subject: i965: Add a note explaining the data cache domain. --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') 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 0bf735c0f2..e2f0a383e7 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -358,7 +358,10 @@ brw_create_constant_surface( struct brw_context *brw, NULL, NULL); if (key->bo) { - /* Emit relocation to surface contents */ + /* Emit relocation to surface contents. Section 5.1.1 of the gen4 + * bspec ("Data Cache") says that the data cache does not exist as + * a separate cache and is just the sampler cache. + */ dri_bo_emit_reloc(bo, I915_GEM_DOMAIN_SAMPLER, 0, 0, -- cgit v1.2.3 From c5413839b3e99c7b162f1260142f3c175502b0ce Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 10 Nov 2009 15:51:29 -0800 Subject: i965: avoid memsetting all the BRW_WM_MAX_INSN arrays for every compile. For an app that's blowing out the state cache, like sauerbraten, the memset of the giant arrays ended up taking 11% of the CPU even when only a "few" of the entries got used. With this, the WM program compile drops back down to 1% of CPU time. Bug #24981 (bisected to BRW_WM_MAX_INSN increase). --- src/mesa/drivers/dri/i965/brw_wm.c | 14 ++++++++++++++ src/mesa/drivers/dri/i965/brw_wm.h | 8 ++++---- src/mesa/drivers/dri/i965/brw_wm_fp.c | 2 ++ src/mesa/drivers/dri/i965/brw_wm_pass0.c | 3 +++ 4 files changed, 23 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 964ee104c2..d8971321f3 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -152,8 +152,22 @@ static void do_wm_prog( struct brw_context *brw, */ return; } + c->instruction = _mesa_calloc(BRW_WM_MAX_INSN * sizeof(*c->instruction)); + c->prog_instructions = _mesa_calloc(BRW_WM_MAX_INSN * + sizeof(*c->prog_instructions)); + c->vreg = _mesa_calloc(BRW_WM_MAX_VREG * sizeof(*c->vreg)); + c->refs = _mesa_calloc(BRW_WM_MAX_REF * sizeof(*c->refs)); + c->vreg = _mesa_calloc(BRW_WM_MAX_VREG * sizeof(*c->vreg)); } else { + void *instruction = c->instruction; + void *prog_instructions = c->prog_instructions; + void *vreg = c->vreg; + void *refs = c->refs; memset(c, 0, sizeof(*brw->wm.compile_data)); + c->instruction = instruction; + c->prog_instructions = prog_instructions; + c->vreg = vreg; + c->refs = refs; } memcpy(&c->key, key, sizeof(*key)); diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 1fa2f1c06c..7db212e392 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -202,7 +202,7 @@ struct brw_wm_compile { * simplifying and adding instructions for interpolation and * framebuffer writes. */ - struct prog_instruction prog_instructions[BRW_WM_MAX_INSN]; + struct prog_instruction *prog_instructions; GLuint nr_fp_insns; GLuint fp_temp; GLuint fp_interp_emitted; @@ -213,7 +213,7 @@ struct brw_wm_compile { struct prog_src_register pixel_w; - struct brw_wm_value vreg[BRW_WM_MAX_VREG]; + struct brw_wm_value *vreg; GLuint nr_vreg; struct brw_wm_value creg[BRW_WM_MAX_PARAM]; @@ -230,10 +230,10 @@ struct brw_wm_compile { struct brw_wm_ref undef_ref; struct brw_wm_value undef_value; - struct brw_wm_ref refs[BRW_WM_MAX_REF]; + struct brw_wm_ref *refs; GLuint nr_refs; - struct brw_wm_instruction instruction[BRW_WM_MAX_INSN]; + struct brw_wm_instruction *instruction; GLuint nr_insns; struct brw_wm_constref constref[BRW_WM_MAX_CONST]; diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index 549afd31de..1c4f62ba48 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -182,6 +182,8 @@ static void release_temp( struct brw_wm_compile *c, struct prog_dst_register tem static struct prog_instruction *get_fp_inst(struct brw_wm_compile *c) { assert(c->nr_fp_insns < BRW_WM_MAX_INSN); + memset(&c->prog_instructions[c->nr_fp_insns], 0, + sizeof(*c->prog_instructions)); return &c->prog_instructions[c->nr_fp_insns++]; } diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass0.c b/src/mesa/drivers/dri/i965/brw_wm_pass0.c index 602b1351ef..ff4c082d5e 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_pass0.c +++ b/src/mesa/drivers/dri/i965/brw_wm_pass0.c @@ -42,12 +42,14 @@ static struct brw_wm_ref *get_ref( struct brw_wm_compile *c ) { assert(c->nr_refs < BRW_WM_MAX_REF); + memset(&c->refs[c->nr_refs], 0, sizeof(*c->refs)); return &c->refs[c->nr_refs++]; } static struct brw_wm_value *get_value( struct brw_wm_compile *c) { assert(c->nr_refs < BRW_WM_MAX_VREG); + memset(&c->vreg[c->nr_vreg], 0, sizeof(*c->vreg)); return &c->vreg[c->nr_vreg++]; } @@ -55,6 +57,7 @@ static struct brw_wm_value *get_value( struct brw_wm_compile *c) static struct brw_wm_instruction *get_instruction( struct brw_wm_compile *c ) { assert(c->nr_insns < BRW_WM_MAX_INSN); + memset(&c->instruction[c->nr_insns], 0, sizeof(*c->instruction)); return &c->instruction[c->nr_insns++]; } -- cgit v1.2.3 From e08512f3d4e318d0776f58296d7f7dae4c5524ad Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Tue, 10 Nov 2009 13:46:16 -0500 Subject: st/xorg: print ouf the picture formats when compositing --- src/gallium/state_trackers/xorg/xorg_exa.c | 63 ++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 20cfa25d97..19c0151e69 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -51,6 +51,65 @@ /* * Helper functions */ +#if DEBUG_PRINT +struct render_format_str { + int format; + const char *name; +}; +static const struct render_format_str formats_info[] = +{ + {PICT_a2r10g10b10, "PICT_a2r10g10b10"}, + {PICT_x2r10g10b10, "PICT_x2r10g10b10"}, + {PICT_a2b10g10r10, "PICT_a2b10g10r10"}, + {PICT_x2b10g10r10, "PICT_x2b10g10r10"}, + {PICT_a8r8g8b8, "PICT_a8r8g8b8"}, + {PICT_x8r8g8b8, "PICT_x8r8g8b8"}, + {PICT_a8b8g8r8, "PICT_a8b8g8r8"}, + {PICT_x8b8g8r8, "PICT_x8b8g8r8"}, + {PICT_b8g8r8a8, "PICT_b8g8r8a8"}, + {PICT_b8g8r8x8, "PICT_b8g8r8x8"}, + {PICT_r8g8b8, "PICT_r8g8b8"}, + {PICT_b8g8r8, "PICT_b8g8r8"}, + {PICT_r5g6b5, "PICT_r5g6b5"}, + {PICT_b5g6r5, "PICT_b5g6r5"}, + {PICT_a1r5g5b5, "PICT_a1r5g5b5"}, + {PICT_x1r5g5b5, "PICT_x1r5g5b5"}, + {PICT_a1b5g5r5, "PICT_a1b5g5r5"}, + {PICT_x1b5g5r5, "PICT_x1b5g5r5"}, + {PICT_a4r4g4b4, "PICT_a4r4g4b4"}, + {PICT_x4r4g4b4, "PICT_x4r4g4b4"}, + {PICT_a4b4g4r4, "PICT_a4b4g4r4"}, + {PICT_x4b4g4r4, "PICT_x4b4g4r4"}, + {PICT_a8, "PICT_a8"}, + {PICT_r3g3b2, "PICT_r3g3b2"}, + {PICT_b2g3r3, "PICT_b2g3r3"}, + {PICT_a2r2g2b2, "PICT_a2r2g2b2"}, + {PICT_a2b2g2r2, "PICT_a2b2g2r2"}, + {PICT_c8, "PICT_c8"}, + {PICT_g8, "PICT_g8"}, + {PICT_x4a4, "PICT_x4a4"}, + {PICT_x4c4, "PICT_x4c4"}, + {PICT_x4g4, "PICT_x4g4"}, + {PICT_a4, "PICT_a4"}, + {PICT_r1g2b1, "PICT_r1g2b1"}, + {PICT_b1g2r1, "PICT_b1g2r1"}, + {PICT_a1r1g1b1, "PICT_a1r1g1b1"}, + {PICT_a1b1g1r1, "PICT_a1b1g1r1"}, + {PICT_c4, "PICT_c4"}, + {PICT_g4, "PICT_g4"}, + {PICT_a1, "PICT_a1"}, + {PICT_g1, "PICT_g1"} +}; +static const char *render_format_name(int format) +{ + int i = 0; + for (i = 0; i < sizeof(formats_info)/sizeof(formats_info[0]); ++i) { + if (formats_info[i].format == format) + return formats_info[i].name; + } + return NULL; +} +#endif static void exa_get_pipe_format(int depth, enum pipe_format *format, int *bbp) @@ -416,6 +475,10 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, #if DEBUG_PRINT debug_printf("ExaPrepareComposite(%d, src=0x%p, mask=0x%p, dst=0x%p)\n", op, pSrcPicture, pMaskPicture, pDstPicture); + debug_printf("\tFormats: src(%s), mask(%s), dst(%s)\n", + render_format_name(pSrcPicture->format), + render_format_name(pMaskPicture->format), + render_format_name(pDstPicture->format)); #endif if (!exa->pipe) XORG_FALLBACK("accle not enabled"); -- cgit v1.2.3 From d2c886c8caf52c1e3581af350fd23ecf839a2491 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Tue, 10 Nov 2009 13:51:49 -0500 Subject: st/xorg: cleanup the naming --- src/gallium/state_trackers/xorg/xorg_renderer.c | 38 ++++++++++++------------- src/gallium/state_trackers/xorg/xorg_renderer.h | 8 ++++-- 2 files changed, 24 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index f0e889c3c8..05f00710d0 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -51,10 +51,10 @@ renderer_buffer_create(struct xorg_renderer *r) { struct pipe_buffer *buf = pipe_user_buffer_create(r->pipe->screen, - r->vertices, + r->buffer, sizeof(float)* - r->num_vertices); - r->num_vertices = 0; + r->buffer_size); + r->buffer_size = 0; return buf; } @@ -64,9 +64,9 @@ renderer_draw(struct xorg_renderer *r) { struct pipe_context *pipe = r->pipe; struct pipe_buffer *buf = 0; - int num_verts = r->num_vertices/(r->num_attributes * NUM_COMPONENTS); + int num_verts = r->buffer_size/(r->attrs_per_vertex * NUM_COMPONENTS); - if (!r->num_vertices) + if (!r->buffer_size) return; buf = renderer_buffer_create(r); @@ -76,7 +76,7 @@ renderer_draw(struct xorg_renderer *r) util_draw_vertex_buffer(pipe, buf, 0, PIPE_PRIM_QUADS, num_verts, /* verts */ - r->num_attributes); /* attribs/vert */ + r->attrs_per_vertex); /* attribs/vert */ pipe_buffer_reference(&buf, NULL); } @@ -86,8 +86,8 @@ static INLINE void renderer_draw_conditional(struct xorg_renderer *r, int next_batch) { - if (r->num_vertices + next_batch >= BUF_SIZE || - (next_batch == 0 && r->num_vertices)) { + if (r->buffer_size + next_batch >= BUF_SIZE || + (next_batch == 0 && r->buffer_size)) { renderer_draw(r); } } @@ -108,7 +108,7 @@ add_vertex_color(struct xorg_renderer *r, float x, float y, float color[4]) { - float *vertex = r->vertices + r->num_vertices; + float *vertex = r->buffer + r->buffer_size; vertex[0] = x; vertex[1] = y; @@ -120,14 +120,14 @@ add_vertex_color(struct xorg_renderer *r, vertex[6] = color[2]; /*b*/ vertex[7] = color[3]; /*a*/ - r->num_vertices += 8; + r->buffer_size += 8; } static INLINE void add_vertex_1tex(struct xorg_renderer *r, float x, float y, float s, float t) { - float *vertex = r->vertices + r->num_vertices; + float *vertex = r->buffer + r->buffer_size; vertex[0] = x; vertex[1] = y; @@ -139,7 +139,7 @@ add_vertex_1tex(struct xorg_renderer *r, vertex[6] = 0.f; /*r*/ vertex[7] = 1.f; /*q*/ - r->num_vertices += 8; + r->buffer_size += 8; } static void @@ -199,7 +199,7 @@ add_vertex_2tex(struct xorg_renderer *r, float x, float y, float s0, float t0, float s1, float t1) { - float *vertex = r->vertices + r->num_vertices; + float *vertex = r->buffer + r->buffer_size; vertex[0] = x; vertex[1] = y; @@ -216,7 +216,7 @@ add_vertex_2tex(struct xorg_renderer *r, vertex[10] = 0.f; /*r*/ vertex[11] = 1.f; /*q*/ - r->num_vertices += 12; + r->buffer_size += 12; } static void @@ -861,8 +861,8 @@ void renderer_draw_yuv(struct xorg_renderer *r, void renderer_begin_solid(struct xorg_renderer *r) { - r->num_vertices = 0; - r->num_attributes = 2; + r->buffer_size = 0; + r->attrs_per_vertex = 2; } void renderer_solid(struct xorg_renderer *r, @@ -895,8 +895,8 @@ void renderer_begin_textures(struct xorg_renderer *r, struct pipe_texture **textures, int num_textures) { - r->num_attributes = 1 + num_textures; - r->num_vertices = 0; + r->attrs_per_vertex = 1 + num_textures; + r->buffer_size = 0; } void renderer_texture(struct xorg_renderer *r, @@ -923,7 +923,7 @@ void renderer_texture(struct xorg_renderer *r, } #endif - switch(r->num_attributes) { + switch(r->attrs_per_vertex) { case 2: renderer_draw_conditional(r, 4 * 8); add_vertex_data1(r, diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h index 6b658fdbe8..2f0b865dbd 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.h +++ b/src/gallium/state_trackers/xorg/xorg_renderer.h @@ -24,10 +24,12 @@ struct xorg_renderer { struct pipe_constant_buffer vs_const_buffer; struct pipe_constant_buffer fs_const_buffer; - float vertices[BUF_SIZE]; - int num_vertices; + float buffer[BUF_SIZE]; + int buffer_size; - int num_attributes; + /* number of attributes per vertex for the current + * draw operation */ + int attrs_per_vertex; }; struct xorg_renderer *renderer_create(struct pipe_context *pipe); -- cgit v1.2.3 From 4c54f8e9aa0aae570c21c57427fb51c70517e0a9 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 10 Nov 2009 07:00:21 +0100 Subject: st/egl: Probe hardware for depth stencil format --- src/gallium/state_trackers/egl/egl_surface.c | 76 +++++++++++++++++++--------- 1 file changed, 52 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c index 71c013756d..a4493e2637 100644 --- a/src/gallium/state_trackers/egl/egl_surface.c +++ b/src/gallium/state_trackers/egl/egl_surface.c @@ -35,34 +35,62 @@ drm_find_mode(drmModeConnectorPtr connector, _EGLMode *mode) } static struct st_framebuffer * -drm_create_framebuffer(const __GLcontextModes *visual, +drm_create_framebuffer(struct pipe_screen *screen, + const __GLcontextModes *visual, unsigned width, unsigned height, void *priv) { - enum pipe_format colorFormat, depthFormat, stencilFormat; - - if (visual->redBits == 5) - colorFormat = PIPE_FORMAT_R5G6B5_UNORM; - else - colorFormat = PIPE_FORMAT_A8R8G8B8_UNORM; - - if (visual->depthBits == 16) - depthFormat = PIPE_FORMAT_Z16_UNORM; - else if (visual->depthBits == 24) - depthFormat = PIPE_FORMAT_S8Z24_UNORM; - else - depthFormat = PIPE_FORMAT_NONE; + enum pipe_format color_format, depth_stencil_format; + boolean d_depth_bits_last; + boolean ds_depth_bits_last; + + d_depth_bits_last = + screen->is_format_supported(screen, PIPE_FORMAT_X8Z24_UNORM, + PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0); + ds_depth_bits_last = + screen->is_format_supported(screen, PIPE_FORMAT_S8Z24_UNORM, + PIPE_TEXTURE_2D, + PIPE_TEXTURE_USAGE_DEPTH_STENCIL, 0); + + if (visual->redBits == 8) { + if (visual->alphaBits == 8) + color_format = PIPE_FORMAT_A8R8G8B8_UNORM; + else + color_format = PIPE_FORMAT_X8R8G8B8_UNORM; + } else { + color_format = PIPE_FORMAT_R5G6B5_UNORM; + } - if (visual->stencilBits == 8) - stencilFormat = PIPE_FORMAT_S8Z24_UNORM; - else - stencilFormat = PIPE_FORMAT_NONE; + switch(visual->depthBits) { + default: + case 0: + depth_stencil_format = PIPE_FORMAT_NONE; + break; + case 16: + depth_stencil_format = PIPE_FORMAT_Z16_UNORM; + break; + case 24: + if (visual->stencilBits == 0) { + depth_stencil_format = (d_depth_bits_last) ? + PIPE_FORMAT_X8Z24_UNORM: + PIPE_FORMAT_Z24X8_UNORM; + } else { + depth_stencil_format = (ds_depth_bits_last) ? + PIPE_FORMAT_S8Z24_UNORM: + PIPE_FORMAT_Z24S8_UNORM; + } + break; + case 32: + depth_stencil_format = PIPE_FORMAT_Z32_UNORM; + break; + } return st_create_framebuffer(visual, - colorFormat, - depthFormat, - stencilFormat, + color_format, + depth_stencil_format, + depth_stencil_format, width, height, priv); @@ -176,6 +204,7 @@ _EGLSurface * drm_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, const EGLint *attrib_list) { + struct drm_device *dev = lookup_drm_device(dpy); int i; int width = -1; int height = -1; @@ -212,9 +241,8 @@ drm_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, surf->h = height; visual = drm_visual_from_config(conf); - surf->stfb = drm_create_framebuffer(visual, - width, - height, + surf->stfb = drm_create_framebuffer(dev->screen, visual, + width, height, (void*)surf); drm_visual_modes_destroy(visual); -- cgit v1.2.3 From a492ab765a9e36c5f224f0d58e172ca6ecf25a1c Mon Sep 17 00:00:00 2001 From: brian Date: Tue, 10 Nov 2009 15:33:31 -0700 Subject: mesa: added comment for check_begin_texture_render() --- src/mesa/main/fbobject.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index c4454550db..2641123857 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1149,6 +1149,11 @@ _mesa_IsFramebufferEXT(GLuint framebuffer) } +/** + * Check if any of the attachments of the given framebuffer are textures + * (render to texture). Call ctx->Driver.RenderTexture() for such + * attachments. + */ static void check_begin_texture_render(GLcontext *ctx, struct gl_framebuffer *fb) { -- cgit v1.2.3 From e6f60d30375c637c0823a9aade8098a45f70d6a7 Mon Sep 17 00:00:00 2001 From: brian Date: Tue, 10 Nov 2009 15:47:34 -0700 Subject: mesa: rename vars in _mesa_BindFramebufferEXT() --- src/mesa/main/fbobject.c | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 2641123857..5896f1b95f 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1193,7 +1193,7 @@ check_end_texture_render(GLcontext *ctx, struct gl_framebuffer *fb) void GLAPIENTRY _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) { - struct gl_framebuffer *newFb, *newFbread; + struct gl_framebuffer *newDrawFb, *newReadFb; GLboolean bindReadBuf, bindDrawBuf; GET_CURRENT_CONTEXT(ctx); @@ -1242,74 +1242,73 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) if (framebuffer) { /* Binding a user-created framebuffer object */ - newFb = _mesa_lookup_framebuffer(ctx, framebuffer); - if (newFb == &DummyFramebuffer) { + newDrawFb = _mesa_lookup_framebuffer(ctx, framebuffer); + if (newDrawFb == &DummyFramebuffer) { /* ID was reserved, but no real framebuffer object made yet */ - newFb = NULL; + newDrawFb = NULL; } - else if (!newFb && ctx->Extensions.ARB_framebuffer_object) { + else if (!newDrawFb && ctx->Extensions.ARB_framebuffer_object) { /* All FBO IDs must be Gen'd */ _mesa_error(ctx, GL_INVALID_OPERATION, "glBindFramebuffer(buffer)"); return; } - if (!newFb) { + if (!newDrawFb) { /* create new framebuffer object */ - newFb = ctx->Driver.NewFramebuffer(ctx, framebuffer); - if (!newFb) { + newDrawFb = ctx->Driver.NewFramebuffer(ctx, framebuffer); + if (!newDrawFb) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glBindFramebufferEXT"); return; } - _mesa_HashInsert(ctx->Shared->FrameBuffers, framebuffer, newFb); + _mesa_HashInsert(ctx->Shared->FrameBuffers, framebuffer, newDrawFb); } - newFbread = newFb; + newReadFb = newDrawFb; } else { /* Binding the window system framebuffer (which was originally set * with MakeCurrent). */ - newFb = ctx->WinSysDrawBuffer; - newFbread = ctx->WinSysReadBuffer; + newDrawFb = ctx->WinSysDrawBuffer; + newReadFb = ctx->WinSysReadBuffer; } - ASSERT(newFb); - ASSERT(newFb != &DummyFramebuffer); + ASSERT(newDrawFb); + ASSERT(newDrawFb != &DummyFramebuffer); /* * OK, now bind the new Draw/Read framebuffers, if they're changing. */ if (bindReadBuf) { - if (ctx->ReadBuffer == newFbread) { + if (ctx->ReadBuffer == newReadFb) { bindReadBuf = GL_FALSE; /* no change */ } else { FLUSH_VERTICES(ctx, _NEW_BUFFERS); - _mesa_reference_framebuffer(&ctx->ReadBuffer, newFbread); + _mesa_reference_framebuffer(&ctx->ReadBuffer, newReadFb); } } if (bindDrawBuf) { - /* check if old FB had any texture attachments */ if (ctx->DrawBuffer->Name != 0) { check_end_texture_render(ctx, ctx->DrawBuffer); } - if (ctx->DrawBuffer == newFb) { + if (ctx->DrawBuffer == newDrawFb) { bindDrawBuf = GL_FALSE; /* no change */ } else { FLUSH_VERTICES(ctx, _NEW_BUFFERS); - _mesa_reference_framebuffer(&ctx->DrawBuffer, newFb); + _mesa_reference_framebuffer(&ctx->DrawBuffer, newDrawFb); } - if (newFb->Name != 0) { + if (newDrawFb->Name != 0) { /* check if newly bound framebuffer has any texture attachments */ - check_begin_texture_render(ctx, newFb); + check_begin_texture_render(ctx, newDrawFb); } } if ((bindDrawBuf || bindReadBuf) && ctx->Driver.BindFramebuffer) { - ctx->Driver.BindFramebuffer(ctx, target, newFb, newFbread); + ctx->Driver.BindFramebuffer(ctx, target, newDrawFb, newReadFb); } } -- cgit v1.2.3 From d96e55fa7bbbc033f47dbeb942b872c6d21eb42d Mon Sep 17 00:00:00 2001 From: brian Date: Tue, 10 Nov 2009 15:50:22 -0700 Subject: mesa: new vars: oldDrawFb, oldReadFb in _mesa_BindFramebufferEXT() --- src/mesa/main/fbobject.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 5896f1b95f..9bf43416a6 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1194,6 +1194,7 @@ void GLAPIENTRY _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) { struct gl_framebuffer *newDrawFb, *newReadFb; + struct gl_framebuffer *oldDrawFb, *oldReadFb; GLboolean bindReadBuf, bindDrawBuf; GET_CURRENT_CONTEXT(ctx); @@ -1275,11 +1276,14 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) ASSERT(newDrawFb); ASSERT(newDrawFb != &DummyFramebuffer); + oldDrawFb = ctx->DrawBuffer; + oldReadFb = ctx->ReadBuffer; + /* * OK, now bind the new Draw/Read framebuffers, if they're changing. */ if (bindReadBuf) { - if (ctx->ReadBuffer == newReadFb) { + if (oldReadFb == newReadFb) { bindReadBuf = GL_FALSE; /* no change */ } else { @@ -1289,11 +1293,11 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) } if (bindDrawBuf) { - if (ctx->DrawBuffer->Name != 0) { + if (oldDrawFb->Name != 0) { check_end_texture_render(ctx, ctx->DrawBuffer); } - if (ctx->DrawBuffer == newDrawFb) { + if (oldDrawFb == newDrawFb) { bindDrawBuf = GL_FALSE; /* no change */ } else { -- cgit v1.2.3 From bc569cd6bee0550c7f83412476b6b39e89c51ac3 Mon Sep 17 00:00:00 2001 From: brian Date: Tue, 10 Nov 2009 16:00:35 -0700 Subject: mesa: move check_begin/end_texture_render() calls --- src/mesa/main/fbobject.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 9bf43416a6..6d8d1876d6 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1288,26 +1288,28 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) } else { FLUSH_VERTICES(ctx, _NEW_BUFFERS); + _mesa_reference_framebuffer(&ctx->ReadBuffer, newReadFb); } } if (bindDrawBuf) { - if (oldDrawFb->Name != 0) { - check_end_texture_render(ctx, ctx->DrawBuffer); - } - if (oldDrawFb == newDrawFb) { bindDrawBuf = GL_FALSE; /* no change */ } else { FLUSH_VERTICES(ctx, _NEW_BUFFERS); - _mesa_reference_framebuffer(&ctx->DrawBuffer, newDrawFb); - } - if (newDrawFb->Name != 0) { - /* check if newly bound framebuffer has any texture attachments */ - check_begin_texture_render(ctx, newDrawFb); + if (oldDrawFb->Name != 0) { + check_end_texture_render(ctx, oldDrawFb); + } + + if (newDrawFb->Name != 0) { + /* check if newly bound framebuffer has any texture attachments */ + check_begin_texture_render(ctx, newDrawFb); + } + + _mesa_reference_framebuffer(&ctx->DrawBuffer, newDrawFb); } } -- cgit v1.2.3 From a65b84d9554815af891d793012eba17de80cbfa3 Mon Sep 17 00:00:00 2001 From: brian Date: Tue, 10 Nov 2009 18:02:03 -0700 Subject: mesa: fix some begin/end render-to-texture logic Before, we weren't aggressive enough in checking for the start or end of render-to-texture. In particular, if only the ctx->ReadBuffer had texture attachments, we were treating that as a render-to-texture case. This fixes a regression from commit 75bdbdd90b15c8704d87ca195a364ff6a42edbb1 "intel: Don't validate in a texture image used as a render target." --- src/mesa/main/fbobject.c | 59 +++++++++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 6d8d1876d6..2d0bfb3ad7 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1159,6 +1159,10 @@ check_begin_texture_render(GLcontext *ctx, struct gl_framebuffer *fb) { GLuint i; ASSERT(ctx->Driver.RenderTexture); + + if (fb->Name == 0) + return; /* can't render to texture with winsys framebuffers */ + for (i = 0; i < BUFFER_COUNT; i++) { struct gl_renderbuffer_attachment *att = fb->Attachment + i; struct gl_texture_object *texObj = att->Texture; @@ -1178,6 +1182,9 @@ check_begin_texture_render(GLcontext *ctx, struct gl_framebuffer *fb) static void check_end_texture_render(GLcontext *ctx, struct gl_framebuffer *fb) { + if (fb->Name == 0) + return; /* can't render to texture with winsys framebuffers */ + if (ctx->Driver.FinishRenderTexture) { GLuint i; for (i = 0; i < BUFFER_COUNT; i++) { @@ -1276,41 +1283,51 @@ _mesa_BindFramebufferEXT(GLenum target, GLuint framebuffer) ASSERT(newDrawFb); ASSERT(newDrawFb != &DummyFramebuffer); + /* save pointers to current/old framebuffers */ oldDrawFb = ctx->DrawBuffer; oldReadFb = ctx->ReadBuffer; + /* check if really changing bindings */ + if (oldDrawFb == newDrawFb) + bindDrawBuf = GL_FALSE; + if (oldReadFb == newReadFb) + bindReadBuf = GL_FALSE; + /* * OK, now bind the new Draw/Read framebuffers, if they're changing. + * + * We also check if we're beginning and/or ending render-to-texture. + * When a framebuffer with texture attachments is unbound, call + * ctx->Driver.FinishRenderTexture(). + * When a framebuffer with texture attachments is bound, call + * ctx->Driver.RenderTexture(). + * + * Note that if the ReadBuffer has texture attachments we don't consider + * that a render-to-texture case. */ if (bindReadBuf) { - if (oldReadFb == newReadFb) { - bindReadBuf = GL_FALSE; /* no change */ - } - else { - FLUSH_VERTICES(ctx, _NEW_BUFFERS); + FLUSH_VERTICES(ctx, _NEW_BUFFERS); - _mesa_reference_framebuffer(&ctx->ReadBuffer, newReadFb); - } + /* check if old readbuffer was render-to-texture */ + check_end_texture_render(ctx, oldReadFb); + + _mesa_reference_framebuffer(&ctx->ReadBuffer, newReadFb); } if (bindDrawBuf) { - if (oldDrawFb == newDrawFb) { - bindDrawBuf = GL_FALSE; /* no change */ - } - else { - FLUSH_VERTICES(ctx, _NEW_BUFFERS); + FLUSH_VERTICES(ctx, _NEW_BUFFERS); - if (oldDrawFb->Name != 0) { - check_end_texture_render(ctx, oldDrawFb); - } + /* check if old read/draw buffers were render-to-texture */ + if (!bindReadBuf) + check_end_texture_render(ctx, oldReadFb); - if (newDrawFb->Name != 0) { - /* check if newly bound framebuffer has any texture attachments */ - check_begin_texture_render(ctx, newDrawFb); - } + if (oldDrawFb != oldReadFb) + check_end_texture_render(ctx, oldDrawFb); - _mesa_reference_framebuffer(&ctx->DrawBuffer, newDrawFb); - } + /* check if newly bound framebuffer has any texture attachments */ + check_begin_texture_render(ctx, newDrawFb); + + _mesa_reference_framebuffer(&ctx->DrawBuffer, newDrawFb); } if ((bindDrawBuf || bindReadBuf) && ctx->Driver.BindFramebuffer) { -- cgit v1.2.3 From b81f213157538ab050dbdfc22d6be0d2418c634b Mon Sep 17 00:00:00 2001 From: brian Date: Tue, 10 Nov 2009 18:23:59 -0700 Subject: swrast: update renderbuffer format assertions --- src/mesa/swrast/s_readpix.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index a1aeb2e01f..a855fd8068 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -29,6 +29,7 @@ #include "main/convolve.h" #include "main/context.h" #include "main/feedback.h" +#include "main/formats.h" #include "main/image.h" #include "main/macros.h" #include "main/imports.h" @@ -107,7 +108,7 @@ read_depth_pixels( GLcontext *ctx, && !biasOrScale && !packing->SwapBytes) { /* Special case: directly read 16-bit unsigned depth values. */ GLint j; - ASSERT(rb->InternalFormat == GL_DEPTH_COMPONENT16); + ASSERT(rb->Format == MESA_FORMAT_Z16); ASSERT(rb->DataType == GL_UNSIGNED_SHORT); for (j = 0; j < height; j++, y++) { void *dest =_mesa_image_address2d(packing, pixels, width, height, @@ -119,7 +120,7 @@ read_depth_pixels( GLcontext *ctx, && !biasOrScale && !packing->SwapBytes) { /* Special case: directly read 24-bit unsigned depth values. */ GLint j; - ASSERT(rb->InternalFormat == GL_DEPTH_COMPONENT24); + ASSERT(rb->Format == MESA_FORMAT_X8_Z24); ASSERT(rb->DataType == GL_UNSIGNED_INT); for (j = 0; j < height; j++, y++) { GLuint *dest = (GLuint *) @@ -138,7 +139,7 @@ read_depth_pixels( GLcontext *ctx, && !biasOrScale && !packing->SwapBytes) { /* Special case: directly read 32-bit unsigned depth values. */ GLint j; - ASSERT(rb->InternalFormat == GL_DEPTH_COMPONENT32); + ASSERT(rb->Format == MESA_FORMAT_Z32); ASSERT(rb->DataType == GL_UNSIGNED_INT); for (j = 0; j < height; j++, y++) { void *dest = _mesa_image_address2d(packing, pixels, width, height, -- cgit v1.2.3 From fca8b2c3ae53695f8ff6e823cc316aab910490e5 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Tue, 10 Nov 2009 20:28:54 -0500 Subject: st/xorg: wrap to border color --- src/gallium/state_trackers/xorg/xorg_composite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index fc449122b6..315cbfa746 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -118,7 +118,7 @@ render_repeat_to_gallium(int mode) { switch(mode) { case RepeatNone: - return PIPE_TEX_WRAP_CLAMP; + return PIPE_TEX_WRAP_CLAMP_TO_BORDER; case RepeatNormal: return PIPE_TEX_WRAP_REPEAT; case RepeatReflect: -- cgit v1.2.3 From 3201c655e4c393d5ae794e6373de8ef705b979a4 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 10 Nov 2009 08:55:26 +0100 Subject: st/xorg: Don't segfault when debug printing --- src/gallium/state_trackers/xorg/xorg_exa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 19c0151e69..35fba24996 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -476,9 +476,9 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, debug_printf("ExaPrepareComposite(%d, src=0x%p, mask=0x%p, dst=0x%p)\n", op, pSrcPicture, pMaskPicture, pDstPicture); debug_printf("\tFormats: src(%s), mask(%s), dst(%s)\n", - render_format_name(pSrcPicture->format), - render_format_name(pMaskPicture->format), - render_format_name(pDstPicture->format)); + pSrcPicture ? render_format_name(pSrcPicture->format) : "none", + pMaskPicture ? render_format_name(pMaskPicture->format) : "none", + pDstPicture ? render_format_name(pDstPicture->format) : "none"); #endif if (!exa->pipe) XORG_FALLBACK("accle not enabled"); -- cgit v1.2.3 From e4a19ffb13746ae4f62adca412d086d9461ff432 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 10 Nov 2009 10:05:40 +0100 Subject: st/xorg: Fallback if picture format doesn't match texture format --- src/gallium/state_trackers/xorg/xorg_exa.c | 27 ++++++++++++++++++++++++--- src/gallium/state_trackers/xorg/xorg_exa.h | 2 ++ 2 files changed, 26 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 35fba24996..c71779bc20 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -112,27 +112,32 @@ static const char *render_format_name(int format) #endif static void -exa_get_pipe_format(int depth, enum pipe_format *format, int *bbp) +exa_get_pipe_format(int depth, enum pipe_format *format, int *bbp, int *picture_format) { switch (depth) { case 32: *format = PIPE_FORMAT_A8R8G8B8_UNORM; + *picture_format = PICT_a8r8g8b8; assert(*bbp == 32); break; case 24: *format = PIPE_FORMAT_X8R8G8B8_UNORM; + *picture_format = PICT_x8r8g8b8; assert(*bbp == 32); break; case 16: *format = PIPE_FORMAT_R5G6B5_UNORM; + *picture_format = PICT_r5g6b5; assert(*bbp == 16); break; case 15: *format = PIPE_FORMAT_A1R5G5B5_UNORM; + *picture_format = PICT_x1r5g5b5; assert(*bbp == 16); break; case 8: *format = PIPE_FORMAT_L8_UNORM; + *picture_format = PICT_a8; assert(*bbp == 8); break; case 4: @@ -492,6 +497,11 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)) XORG_FALLBACK("pDst format: %s", pf_name(priv->tex->format)); + if (priv->picture_format != pDstPicture->format) + XORG_FALLBACK("pDst pic_format: %s != %s", + render_format_name(priv->picture_format), + render_format_name(pDstPicture->format)); + if (pSrc) { priv = exaGetPixmapDriverPrivate(pSrc); if (!priv || !priv->tex) @@ -501,6 +511,11 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, priv->tex->target, PIPE_TEXTURE_USAGE_SAMPLER, 0)) XORG_FALLBACK("pSrc format: %s", pf_name(priv->tex->format)); + + if (priv->picture_format != pSrcPicture->format) + XORG_FALLBACK("pSrc pic_format: %s != %s", + render_format_name(priv->picture_format), + render_format_name(pSrcPicture->format)); } if (pMask) { @@ -512,6 +527,11 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, priv->tex->target, PIPE_TEXTURE_USAGE_SAMPLER, 0)) XORG_FALLBACK("pMask format: %s", pf_name(priv->tex->format)); + + if (priv->picture_format != pMaskPicture->format) + XORG_FALLBACK("pMask pic_format: %s != %s", + render_format_name(priv->picture_format), + render_format_name(pMaskPicture->format)); } return ACCEL_ENABLED && @@ -702,7 +722,7 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, memset(&template, 0, sizeof(template)); template.target = PIPE_TEXTURE_2D; - exa_get_pipe_format(depth, &template.format, &bitsPerPixel); + exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &priv->picture_format); pf_get_block(template.format, &template.block); template.width[0] = width; template.height[0] = height; @@ -777,10 +797,11 @@ xorg_exa_create_root_texture(ScrnInfoPtr pScrn, modesettingPtr ms = modesettingPTR(pScrn); struct exa_context *exa = ms->exa; struct pipe_texture template; + int dummy; memset(&template, 0, sizeof(template)); template.target = PIPE_TEXTURE_2D; - exa_get_pipe_format(depth, &template.format, &bitsPerPixel); + exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &dummy); pf_get_block(template.format, &template.block); template.width[0] = width; template.height[0] = height; diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h index 45f88d9404..7f4aebb9c3 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.h +++ b/src/gallium/state_trackers/xorg/xorg_exa.h @@ -43,6 +43,8 @@ struct exa_pixmap_priv int flags; int tex_flags; + int picture_format; + struct pipe_texture *tex; struct pipe_texture *depth_stencil_tex; -- cgit v1.2.3 From 23a4a6727efb5c8b2bf84f88f638c15e7255b363 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 10 Nov 2009 10:43:19 -0800 Subject: i965: Allow use of PROGRAM_LOCAL constants in ARB_vp. Fixes piglit arl.vp. (cherry picked from commit d52d78b4bcd6d4c0578f972c0b8ebac09e632196) --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 108e19cdbc..ec1f22c92d 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -912,6 +912,7 @@ get_src_reg( struct brw_vs_compile *c, case PROGRAM_CONSTANT: case PROGRAM_UNIFORM: case PROGRAM_ENV_PARAM: + case PROGRAM_LOCAL_PARAM: if (c->vp->use_const_buffer) { return get_constant(c, inst, argIndex); } @@ -930,7 +931,6 @@ get_src_reg( struct brw_vs_compile *c, /* this is a normal case since we loop over all three src args */ return brw_null_reg(); - case PROGRAM_LOCAL_PARAM: case PROGRAM_WRITE_ONLY: default: assert(0); -- cgit v1.2.3 From e5ffb9f5ea03c2acd148222259a334cde0f3afc9 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 10 Nov 2009 10:54:15 -0800 Subject: i965: Unalias src/dst registers for SGE and friends. Fixes piglit vp-sge-alias test, and the googleearth ground shader. \o/ Bug #22228 (cherry picked from commit 56ab92bad8f1d05bc22b8a8471d5aeb663f220de) --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 40 +++++++++++++++++---------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index ec1f22c92d..a4f34660de 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -331,63 +331,65 @@ static void unalias3( struct brw_vs_compile *c, } } -static void emit_sop( struct brw_compile *p, +static void emit_sop( struct brw_vs_compile *c, struct brw_reg dst, struct brw_reg arg0, struct brw_reg arg1, GLuint cond) { + struct brw_compile *p = &c->func; + brw_MOV(p, dst, brw_imm_f(0.0f)); brw_CMP(p, brw_null_reg(), cond, arg0, arg1); brw_MOV(p, dst, brw_imm_f(1.0f)); brw_set_predicate_control_flag_value(p, 0xff); } -static void emit_seq( struct brw_compile *p, +static void emit_seq( struct brw_vs_compile *c, struct brw_reg dst, struct brw_reg arg0, struct brw_reg arg1 ) { - emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_EQ); + emit_sop(c, dst, arg0, arg1, BRW_CONDITIONAL_EQ); } -static void emit_sne( struct brw_compile *p, +static void emit_sne( struct brw_vs_compile *c, struct brw_reg dst, struct brw_reg arg0, struct brw_reg arg1 ) { - emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_NEQ); + emit_sop(c, dst, arg0, arg1, BRW_CONDITIONAL_NEQ); } -static void emit_slt( struct brw_compile *p, +static void emit_slt( struct brw_vs_compile *c, struct brw_reg dst, struct brw_reg arg0, struct brw_reg arg1 ) { - emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_L); + emit_sop(c, dst, arg0, arg1, BRW_CONDITIONAL_L); } -static void emit_sle( struct brw_compile *p, +static void emit_sle( struct brw_vs_compile *c, struct brw_reg dst, struct brw_reg arg0, struct brw_reg arg1 ) { - emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_LE); + emit_sop(c, dst, arg0, arg1, BRW_CONDITIONAL_LE); } -static void emit_sgt( struct brw_compile *p, +static void emit_sgt( struct brw_vs_compile *c, struct brw_reg dst, struct brw_reg arg0, struct brw_reg arg1 ) { - emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_G); + emit_sop(c, dst, arg0, arg1, BRW_CONDITIONAL_G); } -static void emit_sge( struct brw_compile *p, +static void emit_sge( struct brw_vs_compile *c, struct brw_reg dst, struct brw_reg arg0, struct brw_reg arg1 ) { - emit_sop(p, dst, arg0, arg1, BRW_CONDITIONAL_GE); + emit_sop(c, dst, arg0, arg1, BRW_CONDITIONAL_GE); } static void emit_max( struct brw_compile *p, @@ -1453,25 +1455,25 @@ void brw_vs_emit(struct brw_vs_compile *c ) break; case OPCODE_SEQ: - emit_seq(p, dst, args[0], args[1]); + unalias2(c, dst, args[0], args[1], emit_seq); break; case OPCODE_SIN: emit_math1(c, BRW_MATH_FUNCTION_SIN, dst, args[0], BRW_MATH_PRECISION_FULL); break; case OPCODE_SNE: - emit_sne(p, dst, args[0], args[1]); + unalias2(c, dst, args[0], args[1], emit_sne); break; case OPCODE_SGE: - emit_sge(p, dst, args[0], args[1]); + unalias2(c, dst, args[0], args[1], emit_sge); break; case OPCODE_SGT: - emit_sgt(p, dst, args[0], args[1]); + unalias2(c, dst, args[0], args[1], emit_sgt); break; case OPCODE_SLT: - emit_slt(p, dst, args[0], args[1]); + unalias2(c, dst, args[0], args[1], emit_slt); break; case OPCODE_SLE: - emit_sle(p, dst, args[0], args[1]); + unalias2(c, dst, args[0], args[1], emit_sle); break; case OPCODE_SUB: brw_ADD(p, dst, args[0], negate(args[1])); -- cgit v1.2.3 From 1220aba99bc78290bb89ade649719508e3031e4b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 10 Nov 2009 14:11:46 -0800 Subject: i965: Fix VS constant buffer value loading. Previously, we'd load linearly from ParameterValues[0] for the constants, though ParameterValues[1] may not equal ParameterValues[0] + 4. Additionally, the STATE_VAL type paramters didn't get updated. Fixes piglit vp-constant-array-huge.vpfp and ET:QW object locations. Bug #23226. --- src/mesa/drivers/dri/i965/brw_vs_surface_state.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c index 89f47522a1..746d097d23 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c @@ -53,6 +53,7 @@ brw_vs_update_constant_buffer(struct brw_context *brw) const struct gl_program_parameter_list *params = vp->program.Base.Parameters; const int size = params->NumParameters * 4 * sizeof(GLfloat); drm_intel_bo *const_buffer; + int i; /* BRW_NEW_VERTEX_PROGRAM */ if (!vp->use_const_buffer) @@ -62,7 +63,16 @@ brw_vs_update_constant_buffer(struct brw_context *brw) size, 64); /* _NEW_PROGRAM_CONSTANTS */ - dri_bo_subdata(const_buffer, 0, size, params->ParameterValues); + + /* Updates the ParamaterValues[i] pointers for all parameters of the + * basic type of PROGRAM_STATE_VAR. + */ + _mesa_load_state_parameters(&brw->intel.ctx, vp->program.Base.Parameters); + + for (i = 0; i < params->NumParameters; i++) { + dri_bo_subdata(const_buffer, i * 4 * sizeof(float), 4 * sizeof(float), + params->ParameterValues[i]); + } return const_buffer; } -- cgit v1.2.3 From d030ce6a843f3a374356edfbe8e04924277197db Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 11 Nov 2009 03:04:27 -0800 Subject: dri-st: Add some required GL 2.0 extensions. Two-sided stencil and NPOT textures. --- src/gallium/state_trackers/dri/dri_extensions.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/dri/dri_extensions.c b/src/gallium/state_trackers/dri/dri_extensions.c index 78c4cd8375..8b014a2a8b 100644 --- a/src/gallium/state_trackers/dri/dri_extensions.c +++ b/src/gallium/state_trackers/dri/dri_extensions.c @@ -55,6 +55,7 @@ #define need_GL_EXT_multi_draw_arrays #define need_GL_EXT_provoking_vertex #define need_GL_EXT_secondary_color +#define need_GL_EXT_stencil_two_side #define need_GL_APPLE_vertex_array_object #define need_GL_NV_vertex_program #define need_GL_VERSION_2_0 @@ -84,6 +85,7 @@ static const struct dri_extension card_extensions[] = { {"GL_ARB_texture_env_combine", NULL}, {"GL_ARB_texture_env_dot3", NULL}, {"GL_ARB_texture_mirrored_repeat", NULL}, + {"GL_ARB_texture_non_power_of_two", NULL}, {"GL_ARB_texture_rectangle", NULL}, {"GL_ARB_vertex_array_object", GL_ARB_vertex_array_object_functions}, {"GL_ARB_vertex_buffer_object", GL_ARB_vertex_buffer_object_functions}, @@ -103,6 +105,7 @@ static const struct dri_extension card_extensions[] = { {"GL_EXT_pixel_buffer_object", NULL}, {"GL_EXT_provoking_vertex", GL_EXT_provoking_vertex_functions}, {"GL_EXT_secondary_color", GL_EXT_secondary_color_functions}, + {"GL_EXT_stencil_two_side", GL_EXT_stencil_two_side_functions}, {"GL_EXT_stencil_wrap", NULL}, {"GL_EXT_texture_edge_clamp", NULL}, {"GL_EXT_texture_env_combine", NULL}, -- cgit v1.2.3 From cbee31a1f84a4d28d126356aaca317e2cdd003dc Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 11 Nov 2009 03:05:16 -0800 Subject: r300, r300g: Add missing registers. --- src/gallium/drivers/r300/r300_reg.h | 8 +++++--- src/mesa/drivers/dri/r300/r300_reg.h | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h index 1e4d3f5d70..8ca785cb58 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -1884,6 +1884,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_RGB_ADDR0(x) ((x) << 0) # define R300_RGB_ADDR1(x) ((x) << 6) # define R300_RGB_ADDR2(x) ((x) << 12) +# define R300_RGB_TARGET(x) ((x) << 29) #define R300_US_ALU_ALPHA_ADDR_0 0x47C0 # define R300_ALU_SRC0A_SHIFT 0 @@ -1901,9 +1902,10 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_ALU_DSTA_REG (1 << 23) # define R300_ALU_DSTA_OUTPUT (1 << 24) # define R300_ALU_DSTA_DEPTH (1 << 27) -# define R300_ALPHA_ADDR0(x) ((x) << 0) -# define R300_ALPHA_ADDR1(x) ((x) << 6) -# define R300_ALPHA_ADDR2(x) ((x) << 12) +# define R300_ALPHA_ADDR0(x) ((x) << 0) +# define R300_ALPHA_ADDR1(x) ((x) << 6) +# define R300_ALPHA_ADDR2(x) ((x) << 12) +# define R300_ALPHA_TARGET(x) ((x) << 25) #define R300_US_ALU_RGB_INST_0 0x48C0 # define R300_ALU_ARGC_SRC0C_XYZ 0 diff --git a/src/mesa/drivers/dri/r300/r300_reg.h b/src/mesa/drivers/dri/r300/r300_reg.h index 623da60333..ea684e7df1 100644 --- a/src/mesa/drivers/dri/r300/r300_reg.h +++ b/src/mesa/drivers/dri/r300/r300_reg.h @@ -1789,6 +1789,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_ALU_DSTC_OUTPUT_X (1 << 26) # define R300_ALU_DSTC_OUTPUT_Y (1 << 27) # define R300_ALU_DSTC_OUTPUT_Z (1 << 28) +# define R300_RGB_TARGET(x) ((x) << 29) #define R300_US_ALU_ALPHA_ADDR_0 0x47C0 # define R300_ALU_SRC0A_SHIFT 0 @@ -1806,6 +1807,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_ALU_DSTA_REG (1 << 23) # define R300_ALU_DSTA_OUTPUT (1 << 24) # define R300_ALU_DSTA_DEPTH (1 << 27) +# define R300_ALPHA_TARGET(x) ((x) << 25) #define R300_US_ALU_RGB_INST_0 0x48C0 # define R300_ALU_ARGC_SRC0C_XYZ 0 -- cgit v1.2.3 From 493d599af4f617d52323e0368e65da29ba4638aa Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 11 Nov 2009 18:06:26 -0500 Subject: st/xorg: fallback until daddy can implement you properly --- src/gallium/state_trackers/xorg/xorg_composite.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 315cbfa746..2689daed5f 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -199,6 +199,11 @@ boolean xorg_composite_accelerated(int op, op); } } + if ((pSrcPicture && pSrcPicture->repeatType == RepeatNone) || + (pMaskPicture && pMaskPicture->repeatType == RepeatNone)) { + XORG_FALLBACK("RepeatNone is not supported"); + } + return TRUE; } XORG_FALLBACK("Unsupported composition operation = %d", op); -- cgit v1.2.3 From 2cfbbc76e445d88bdac7dd4dd22aaf36bbc8e4cc Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 11 Nov 2009 19:52:08 -0500 Subject: st/xorg: implement repeatnone and make some code smell less like ass --- src/gallium/state_trackers/xorg/xorg_composite.c | 9 +-- src/gallium/state_trackers/xorg/xorg_exa.c | 2 - src/gallium/state_trackers/xorg/xorg_exa_tgsi.c | 75 +++++++++++++++++++----- src/gallium/state_trackers/xorg/xorg_exa_tgsi.h | 4 +- 4 files changed, 67 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 2689daed5f..02dc949c93 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -199,10 +199,6 @@ boolean xorg_composite_accelerated(int op, op); } } - if ((pSrcPicture && pSrcPicture->repeatType == RepeatNone) || - (pMaskPicture && pMaskPicture->repeatType == RepeatNone)) { - XORG_FALLBACK("RepeatNone is not supported"); - } return TRUE; } @@ -243,6 +239,9 @@ bind_shaders(struct exa_context *exa, int op, exa->has_solid_color = FALSE; if (pSrcPicture) { + if (pSrcPicture->repeatType == RepeatNone && pSrcPicture->transform) + fs_traits |= FS_SRC_REPEAT_NONE; + if (pSrcPicture->pSourcePict) { if (pSrcPicture->pSourcePict->type == SourcePictTypeSolidFill) { fs_traits |= FS_SOLID_FILL; @@ -263,6 +262,8 @@ bind_shaders(struct exa_context *exa, int op, if (pMaskPicture) { vs_traits |= VS_MASK; fs_traits |= FS_MASK; + if (pMaskPicture->repeatType == RepeatNone && pMaskPicture->transform) + fs_traits |= FS_MASK_REPEAT_NONE; if (pMaskPicture->componentAlpha) { struct xorg_composite_blend blend; blend_for_op(&blend, op, diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index c71779bc20..a77ee7a908 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -51,7 +51,6 @@ /* * Helper functions */ -#if DEBUG_PRINT struct render_format_str { int format; const char *name; @@ -109,7 +108,6 @@ static const char *render_format_name(int format) } return NULL; } -#endif static void exa_get_pipe_format(int depth, enum pipe_format *format, int *bbp, int *picture_format) diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c index 83cc12fea9..5880de4154 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c @@ -233,10 +233,10 @@ create_vs(struct pipe_context *pipe, struct ureg_src src; struct ureg_dst dst; struct ureg_src const0, const1; - boolean is_fill = vs_traits & VS_FILL; - boolean is_composite = vs_traits & VS_COMPOSITE; - boolean has_mask = vs_traits & VS_MASK; - boolean is_yuv = vs_traits & VS_YUV; + boolean is_fill = (vs_traits & VS_FILL) != 0; + boolean is_composite = (vs_traits & VS_COMPOSITE) != 0; + boolean has_mask = (vs_traits & VS_MASK) != 0; + boolean is_yuv = (vs_traits & VS_YUV) != 0; unsigned input_slot = 0; ureg = ureg_create(TGSI_PROCESSOR_VERTEX); @@ -353,6 +353,47 @@ create_yuv_shader(struct pipe_context *pipe, struct ureg_program *ureg) return ureg_create_shader_and_destroy(ureg, pipe); } + +static INLINE void +xrender_tex(struct ureg_program *ureg, + struct ureg_dst dst, + struct ureg_src coords, + struct ureg_src sampler, + boolean repeat_none) +{ + if (repeat_none) { + struct ureg_dst tmp0 = ureg_DECL_temporary(ureg); + struct ureg_dst tmp1 = ureg_DECL_temporary(ureg); + struct ureg_src const0 = ureg_DECL_constant(ureg, 0); + unsigned label; + ureg_SLT(ureg, tmp1, ureg_swizzle(coords, + TGSI_SWIZZLE_X, + TGSI_SWIZZLE_Y, + TGSI_SWIZZLE_X, + TGSI_SWIZZLE_Y), + ureg_scalar(const0, TGSI_SWIZZLE_X)); + ureg_SGT(ureg, tmp0, ureg_swizzle(coords, + TGSI_SWIZZLE_X, + TGSI_SWIZZLE_Y, + TGSI_SWIZZLE_X, + TGSI_SWIZZLE_Y), + ureg_scalar(const0, TGSI_SWIZZLE_W)); + ureg_MAX(ureg, tmp0, ureg_src(tmp0), ureg_src(tmp1)); + ureg_MAX(ureg, tmp0, ureg_scalar(ureg_src(tmp0), TGSI_SWIZZLE_X), + ureg_scalar(ureg_src(tmp0), TGSI_SWIZZLE_Y)); + label = ureg_get_instruction_number(ureg) + 2; + ureg_IF(ureg, ureg_src(tmp0), &label); + ureg_MOV(ureg, dst, ureg_scalar(const0, TGSI_SWIZZLE_X)); + label += 2; + ureg_ELSE(ureg, &label); + ureg_TEX(ureg, dst, TGSI_TEXTURE_2D, coords, sampler); + ureg_ENDIF(ureg); + ureg_release_temporary(ureg, tmp0); + ureg_release_temporary(ureg, tmp1); + } else + ureg_TEX(ureg, dst, TGSI_TEXTURE_2D, coords, sampler); +} + static void * create_fs(struct pipe_context *pipe, unsigned fs_traits) @@ -362,14 +403,16 @@ create_fs(struct pipe_context *pipe, struct ureg_src /*dst_pos,*/ src_input, mask_pos; struct ureg_dst src, mask; struct ureg_dst out; - boolean has_mask = fs_traits & FS_MASK; - boolean is_fill = fs_traits & FS_FILL; - boolean is_composite = fs_traits & FS_COMPOSITE; - boolean is_solid = fs_traits & FS_SOLID_FILL; - boolean is_lingrad = fs_traits & FS_LINGRAD_FILL; - boolean is_radgrad = fs_traits & FS_RADGRAD_FILL; - unsigned comp_alpha = fs_traits & FS_COMPONENT_ALPHA; - boolean is_yuv = fs_traits & FS_YUV; + unsigned has_mask = (fs_traits & FS_MASK) != 0; + unsigned is_fill = (fs_traits & FS_FILL) != 0; + unsigned is_composite = (fs_traits & FS_COMPOSITE) != 0; + unsigned is_solid = (fs_traits & FS_SOLID_FILL) != 0; + unsigned is_lingrad = (fs_traits & FS_LINGRAD_FILL) != 0; + unsigned is_radgrad = (fs_traits & FS_RADGRAD_FILL) != 0; + unsigned comp_alpha = (fs_traits & FS_COMPONENT_ALPHA) != 0; + unsigned is_yuv = (fs_traits & FS_YUV) != 0; + unsigned src_repeat_none = (fs_traits & FS_SRC_REPEAT_NONE) != 0; + unsigned mask_repeat_none = (fs_traits & FS_MASK_REPEAT_NONE) != 0; ureg = ureg_create(TGSI_PROCESSOR_FRAGMENT); if (ureg == NULL) @@ -425,8 +468,8 @@ create_fs(struct pipe_context *pipe, src = ureg_DECL_temporary(ureg); else src = out; - ureg_TEX(ureg, src, - TGSI_TEXTURE_2D, src_input, src_sampler); + xrender_tex(ureg, src, src_input, src_sampler, + src_repeat_none); } else if (is_fill) { if (is_solid) { if (has_mask) @@ -465,8 +508,8 @@ create_fs(struct pipe_context *pipe, if (has_mask) { mask = ureg_DECL_temporary(ureg); - ureg_TEX(ureg, mask, - TGSI_TEXTURE_2D, mask_pos, mask_sampler); + xrender_tex(ureg, mask, mask_pos, mask_sampler, + mask_repeat_none); /* src IN mask */ src_in_mask(ureg, out, ureg_src(src), ureg_src(mask), comp_alpha); ureg_release_temporary(ureg, mask); diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h index d3bfa304c2..c038dc2231 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h @@ -25,7 +25,9 @@ enum xorg_fs_traits { FS_RADGRAD_FILL = 1 << 4, FS_CA_FULL = 1 << 5, /* src.rgba * mask.rgba */ FS_CA_SRCALPHA = 1 << 6, /* src.aaaa * mask.rgba */ - FS_YUV = 1<< 7, + FS_YUV = 1 << 7, + FS_SRC_REPEAT_NONE = 1 << 8, + FS_MASK_REPEAT_NONE = 1 << 9, FS_FILL = (FS_SOLID_FILL | FS_LINGRAD_FILL | -- cgit v1.2.3 From ab12e764ba3f57ad9f0d7252262cfc6e07839928 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Wed, 11 Nov 2009 17:57:56 -0800 Subject: i965: fix EXT_provoking_vertex support This didn't work for quad/quadstrips at all, and for all other primitive types it only worked when they were unclipped. Fix up the former in gs stage (could probably do without these changes and instead set QuadsFollowProvokingVertexConvention to false), and the rest in clip stage. --- src/mesa/drivers/dri/i965/brw_clip.c | 1 + src/mesa/drivers/dri/i965/brw_clip.h | 7 +++--- src/mesa/drivers/dri/i965/brw_clip_line.c | 8 +++++-- src/mesa/drivers/dri/i965/brw_clip_tri.c | 12 +++++++--- src/mesa/drivers/dri/i965/brw_gs.c | 10 +++++--- src/mesa/drivers/dri/i965/brw_gs.h | 7 +++--- src/mesa/drivers/dri/i965/brw_gs_emit.c | 38 ++++++++++++++++++++++--------- src/mesa/drivers/dri/i965/brw_sf_state.c | 7 +++--- 8 files changed, 61 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_clip.c b/src/mesa/drivers/dri/i965/brw_clip.c index 20a927cf38..f45dcf8282 100644 --- a/src/mesa/drivers/dri/i965/brw_clip.c +++ b/src/mesa/drivers/dri/i965/brw_clip.c @@ -156,6 +156,7 @@ static void upload_clip_prog(struct brw_context *brw) key.attrs = brw->vs.prog_data->outputs_written; /* _NEW_LIGHT */ key.do_flat_shading = (ctx->Light.ShadeModel == GL_FLAT); + key.pv_first = (ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION); /* _NEW_TRANSFORM */ key.nr_userclip = brw_count_bits(ctx->Transform.ClipPlanesEnabled); diff --git a/src/mesa/drivers/dri/i965/brw_clip.h b/src/mesa/drivers/dri/i965/brw_clip.h index 957df441ab..dc550ac793 100644 --- a/src/mesa/drivers/dri/i965/brw_clip.h +++ b/src/mesa/drivers/dri/i965/brw_clip.h @@ -46,18 +46,17 @@ struct brw_clip_prog_key { GLuint primitive:4; GLuint nr_userclip:3; GLuint do_flat_shading:1; + GLuint pv_first:1; GLuint do_unfilled:1; GLuint fill_cw:2; /* includes cull information */ GLuint fill_ccw:2; /* includes cull information */ GLuint offset_cw:1; GLuint offset_ccw:1; - GLuint pad0:17; - GLuint copy_bfc_cw:1; GLuint copy_bfc_ccw:1; GLuint clip_mode:3; - GLuint pad1:27; - + GLuint pad0:11; + GLfloat offset_factor; GLfloat offset_units; }; diff --git a/src/mesa/drivers/dri/i965/brw_clip_line.c b/src/mesa/drivers/dri/i965/brw_clip_line.c index 048ca620fa..fa9648f50f 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_line.c +++ b/src/mesa/drivers/dri/i965/brw_clip_line.c @@ -269,8 +269,12 @@ void brw_emit_line_clip( struct brw_clip_compile *c ) brw_clip_line_alloc_regs(c); brw_clip_init_ff_sync(c); - if (c->key.do_flat_shading) - brw_clip_copy_colors(c, 0, 1); + if (c->key.do_flat_shading) { + if (c->key.pv_first) + brw_clip_copy_colors(c, 1, 0); + else + brw_clip_copy_colors(c, 0, 1); + } clip_and_emit_line(c); } diff --git a/src/mesa/drivers/dri/i965/brw_clip_tri.c b/src/mesa/drivers/dri/i965/brw_clip_tri.c index 0efd77225e..cf79224be4 100644 --- a/src/mesa/drivers/dri/i965/brw_clip_tri.c +++ b/src/mesa/drivers/dri/i965/brw_clip_tri.c @@ -188,14 +188,20 @@ void brw_clip_tri_flat_shade( struct brw_clip_compile *c ) brw_imm_ud(_3DPRIM_POLYGON)); is_poly = brw_IF(p, BRW_EXECUTE_1); - { + { brw_clip_copy_colors(c, 1, 0); brw_clip_copy_colors(c, 2, 0); } is_poly = brw_ELSE(p, is_poly); { - brw_clip_copy_colors(c, 0, 2); - brw_clip_copy_colors(c, 1, 2); + if (c->key.pv_first) { + brw_clip_copy_colors(c, 1, 0); + brw_clip_copy_colors(c, 2, 0); + } + else { + brw_clip_copy_colors(c, 0, 2); + brw_clip_copy_colors(c, 1, 2); + } } brw_ENDIF(p, is_poly); } diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c index 48c2b9a41c..610b6c35e2 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.c +++ b/src/mesa/drivers/dri/i965/brw_gs.c @@ -85,10 +85,10 @@ static void compile_gs_prog( struct brw_context *brw, */ switch (key->primitive) { case GL_QUADS: - brw_gs_quads( &c ); + brw_gs_quads( &c, key ); break; case GL_QUAD_STRIP: - brw_gs_quad_strip( &c ); + brw_gs_quad_strip( &c, key ); break; case GL_LINE_LOOP: brw_gs_lines( &c ); @@ -149,6 +149,7 @@ static const GLenum gs_prim[GL_POLYGON+1] = { static void populate_key( struct brw_context *brw, struct brw_gs_prog_key *key ) { + GLcontext *ctx = &brw->intel.ctx; memset(key, 0, sizeof(*key)); /* CACHE_NEW_VS_PROG */ @@ -158,6 +159,9 @@ static void populate_key( struct brw_context *brw, key->primitive = gs_prim[brw->primitive]; key->hint_gs_always = 0; /* debug code? */ + + /* _NEW_LIGHT */ + key->pv_first = (ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION); key->need_gs_prog = (key->hint_gs_always || brw->primitive == GL_QUADS || @@ -193,7 +197,7 @@ static void prepare_gs_prog(struct brw_context *brw) const struct brw_tracked_state brw_gs_prog = { .dirty = { - .mesa = 0, + .mesa = _NEW_LIGHT, .brw = BRW_NEW_PRIMITIVE, .cache = CACHE_NEW_VS_PROG }, diff --git a/src/mesa/drivers/dri/i965/brw_gs.h b/src/mesa/drivers/dri/i965/brw_gs.h index bbb991ea2e..e0cf07256b 100644 --- a/src/mesa/drivers/dri/i965/brw_gs.h +++ b/src/mesa/drivers/dri/i965/brw_gs.h @@ -43,8 +43,9 @@ struct brw_gs_prog_key { GLuint attrs:32; GLuint primitive:4; GLuint hint_gs_always:1; + GLuint pv_first:1; GLuint need_gs_prog:1; - GLuint pad:26; + GLuint pad:25; }; struct brw_gs_compile { @@ -67,8 +68,8 @@ struct brw_gs_compile { #define ATTR_SIZE (4*4) -void brw_gs_quads( struct brw_gs_compile *c ); -void brw_gs_quad_strip( struct brw_gs_compile *c ); +void brw_gs_quads( struct brw_gs_compile *c, struct brw_gs_prog_key *key ); +void brw_gs_quad_strip( struct brw_gs_compile *c, struct brw_gs_prog_key *key ); void brw_gs_tris( struct brw_gs_compile *c ); void brw_gs_lines( struct brw_gs_compile *c ); void brw_gs_points( struct brw_gs_compile *c ); diff --git a/src/mesa/drivers/dri/i965/brw_gs_emit.c b/src/mesa/drivers/dri/i965/brw_gs_emit.c index a9b2aa2eac..0fc5b02c61 100644 --- a/src/mesa/drivers/dri/i965/brw_gs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_gs_emit.c @@ -120,7 +120,7 @@ static void brw_gs_ff_sync(struct brw_gs_compile *c, int num_prim) } -void brw_gs_quads( struct brw_gs_compile *c ) +void brw_gs_quads( struct brw_gs_compile *c, struct brw_gs_prog_key *key ) { brw_gs_alloc_regs(c, 4); @@ -128,23 +128,39 @@ void brw_gs_quads( struct brw_gs_compile *c ) * is the PV for quads, but vertex 0 for polygons: */ if (c->need_ff_sync) - brw_gs_ff_sync(c, 1); - brw_gs_emit_vue(c, c->reg.vertex[3], 0, ((_3DPRIM_POLYGON << 2) | R02_PRIM_START)); - brw_gs_emit_vue(c, c->reg.vertex[0], 0, (_3DPRIM_POLYGON << 2)); - brw_gs_emit_vue(c, c->reg.vertex[1], 0, (_3DPRIM_POLYGON << 2)); - brw_gs_emit_vue(c, c->reg.vertex[2], 1, ((_3DPRIM_POLYGON << 2) | R02_PRIM_END)); + brw_gs_ff_sync(c, 1); + if (key->pv_first) { + brw_gs_emit_vue(c, c->reg.vertex[0], 0, ((_3DPRIM_POLYGON << 2) | R02_PRIM_START)); + brw_gs_emit_vue(c, c->reg.vertex[1], 0, (_3DPRIM_POLYGON << 2)); + brw_gs_emit_vue(c, c->reg.vertex[2], 0, (_3DPRIM_POLYGON << 2)); + brw_gs_emit_vue(c, c->reg.vertex[3], 1, ((_3DPRIM_POLYGON << 2) | R02_PRIM_END)); + } + else { + brw_gs_emit_vue(c, c->reg.vertex[3], 0, ((_3DPRIM_POLYGON << 2) | R02_PRIM_START)); + brw_gs_emit_vue(c, c->reg.vertex[0], 0, (_3DPRIM_POLYGON << 2)); + brw_gs_emit_vue(c, c->reg.vertex[1], 0, (_3DPRIM_POLYGON << 2)); + brw_gs_emit_vue(c, c->reg.vertex[2], 1, ((_3DPRIM_POLYGON << 2) | R02_PRIM_END)); + } } -void brw_gs_quad_strip( struct brw_gs_compile *c ) +void brw_gs_quad_strip( struct brw_gs_compile *c, struct brw_gs_prog_key *key ) { brw_gs_alloc_regs(c, 4); if (c->need_ff_sync) brw_gs_ff_sync(c, 1); - brw_gs_emit_vue(c, c->reg.vertex[2], 0, ((_3DPRIM_POLYGON << 2) | R02_PRIM_START)); - brw_gs_emit_vue(c, c->reg.vertex[3], 0, (_3DPRIM_POLYGON << 2)); - brw_gs_emit_vue(c, c->reg.vertex[0], 0, (_3DPRIM_POLYGON << 2)); - brw_gs_emit_vue(c, c->reg.vertex[1], 1, ((_3DPRIM_POLYGON << 2) | R02_PRIM_END)); + if (key->pv_first) { + brw_gs_emit_vue(c, c->reg.vertex[0], 0, ((_3DPRIM_POLYGON << 2) | R02_PRIM_START)); + brw_gs_emit_vue(c, c->reg.vertex[1], 0, (_3DPRIM_POLYGON << 2)); + brw_gs_emit_vue(c, c->reg.vertex[2], 0, (_3DPRIM_POLYGON << 2)); + brw_gs_emit_vue(c, c->reg.vertex[3], 1, ((_3DPRIM_POLYGON << 2) | R02_PRIM_END)); + } + else { + brw_gs_emit_vue(c, c->reg.vertex[2], 0, ((_3DPRIM_POLYGON << 2) | R02_PRIM_START)); + brw_gs_emit_vue(c, c->reg.vertex[3], 0, (_3DPRIM_POLYGON << 2)); + brw_gs_emit_vue(c, c->reg.vertex[0], 0, (_3DPRIM_POLYGON << 2)); + brw_gs_emit_vue(c, c->reg.vertex[1], 1, ((_3DPRIM_POLYGON << 2) | R02_PRIM_END)); + } } void brw_gs_tris( struct brw_gs_compile *c ) diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c index bc0f076073..79f37097d3 100644 --- a/src/mesa/drivers/dri/i965/brw_sf_state.c +++ b/src/mesa/drivers/dri/i965/brw_sf_state.c @@ -113,7 +113,8 @@ struct brw_sf_unit_key { unsigned int nr_urb_entries, urb_size, sfsize; - GLenum front_face, cull_face, provoking_vertex; + GLenum front_face, cull_face; + unsigned pv_first:1; unsigned scissor:1; unsigned line_smooth:1; unsigned point_sprite:1; @@ -154,7 +155,7 @@ sf_unit_populate_key(struct brw_context *brw, struct brw_sf_unit_key *key) key->point_attenuated = ctx->Point._Attenuated; /* _NEW_LIGHT */ - key->provoking_vertex = ctx->Light.ProvokingVertex; + key->pv_first = (ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION); key->render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0; } @@ -287,7 +288,7 @@ sf_unit_create_from_key(struct brw_context *brw, struct brw_sf_unit_key *key, /* might be BRW_NEW_PRIMITIVE if we have to adjust pv for polygons: */ - if (key->provoking_vertex == GL_LAST_VERTEX_CONVENTION) { + if (!key->pv_first) { sf.sf7.trifan_pv = 2; sf.sf7.linestrip_pv = 1; sf.sf7.tristrip_pv = 2; -- cgit v1.2.3 From 0a39620d6de27ae471c181046480d274a2327476 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 11 Nov 2009 19:37:53 -0700 Subject: swrast: handle additional Z24 formats in read_depth_pixels() --- src/mesa/swrast/s_readpix.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/swrast/s_readpix.c b/src/mesa/swrast/s_readpix.c index a855fd8068..44a11cd6dd 100644 --- a/src/mesa/swrast/s_readpix.c +++ b/src/mesa/swrast/s_readpix.c @@ -120,8 +120,12 @@ read_depth_pixels( GLcontext *ctx, && !biasOrScale && !packing->SwapBytes) { /* Special case: directly read 24-bit unsigned depth values. */ GLint j; - ASSERT(rb->Format == MESA_FORMAT_X8_Z24); - ASSERT(rb->DataType == GL_UNSIGNED_INT); + ASSERT(rb->Format == MESA_FORMAT_X8_Z24 || + rb->Format == MESA_FORMAT_S8_Z24 || + rb->Format == MESA_FORMAT_Z24_X8 || + rb->Format == MESA_FORMAT_Z24_S8); + ASSERT(rb->DataType == GL_UNSIGNED_INT || + rb->DataType == GL_UNSIGNED_INT_24_8); for (j = 0; j < height; j++, y++) { GLuint *dest = (GLuint *) _mesa_image_address2d(packing, pixels, width, height, @@ -129,9 +133,18 @@ read_depth_pixels( GLcontext *ctx, GLint k; rb->GetRow(ctx, rb, width, x, y, dest); /* convert range from 24-bit to 32-bit */ - for (k = 0; k < width; k++) { - /* Note: put MSByte of 24-bit value into LSByte */ - dest[k] = (dest[k] << 8) | ((dest[k] >> 16) & 0xff); + if (rb->Format == MESA_FORMAT_X8_Z24 || + rb->Format == MESA_FORMAT_S8_Z24) { + for (k = 0; k < width; k++) { + /* Note: put MSByte of 24-bit value into LSByte */ + dest[k] = (dest[k] << 8) | ((dest[k] >> 16) & 0xff); + } + } + else { + for (k = 0; k < width; k++) { + /* Note: fill in LSByte by replication */ + dest[k] = dest[k] | ((dest[k] >> 8) & 0xff); + } } } } -- cgit v1.2.3 From 72b4a7d67f90a20d774dddccbc6eed30d01a7f38 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 11 Nov 2009 21:40:14 -0500 Subject: st/xorg: don't use flow control --- src/gallium/state_trackers/xorg/xorg_exa_tgsi.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c index 5880de4154..da4f8909f6 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c @@ -365,29 +365,23 @@ xrender_tex(struct ureg_program *ureg, struct ureg_dst tmp0 = ureg_DECL_temporary(ureg); struct ureg_dst tmp1 = ureg_DECL_temporary(ureg); struct ureg_src const0 = ureg_DECL_constant(ureg, 0); - unsigned label; - ureg_SLT(ureg, tmp1, ureg_swizzle(coords, + ureg_SGT(ureg, tmp1, ureg_swizzle(coords, TGSI_SWIZZLE_X, TGSI_SWIZZLE_Y, TGSI_SWIZZLE_X, TGSI_SWIZZLE_Y), ureg_scalar(const0, TGSI_SWIZZLE_X)); - ureg_SGT(ureg, tmp0, ureg_swizzle(coords, + ureg_SLT(ureg, tmp0, ureg_swizzle(coords, TGSI_SWIZZLE_X, TGSI_SWIZZLE_Y, TGSI_SWIZZLE_X, TGSI_SWIZZLE_Y), ureg_scalar(const0, TGSI_SWIZZLE_W)); - ureg_MAX(ureg, tmp0, ureg_src(tmp0), ureg_src(tmp1)); - ureg_MAX(ureg, tmp0, ureg_scalar(ureg_src(tmp0), TGSI_SWIZZLE_X), + ureg_MIN(ureg, tmp0, ureg_src(tmp0), ureg_src(tmp1)); + ureg_MIN(ureg, tmp0, ureg_scalar(ureg_src(tmp0), TGSI_SWIZZLE_X), ureg_scalar(ureg_src(tmp0), TGSI_SWIZZLE_Y)); - label = ureg_get_instruction_number(ureg) + 2; - ureg_IF(ureg, ureg_src(tmp0), &label); - ureg_MOV(ureg, dst, ureg_scalar(const0, TGSI_SWIZZLE_X)); - label += 2; - ureg_ELSE(ureg, &label); - ureg_TEX(ureg, dst, TGSI_TEXTURE_2D, coords, sampler); - ureg_ENDIF(ureg); + ureg_TEX(ureg, tmp1, TGSI_TEXTURE_2D, coords, sampler); + ureg_MUL(ureg, dst, ureg_src(tmp1), ureg_src(tmp0)); ureg_release_temporary(ureg, tmp0); ureg_release_temporary(ureg, tmp1); } else -- cgit v1.2.3 From 4d72f8f520e02366d695e35aa8ef09fc36f36804 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 11 Nov 2009 21:46:43 -0500 Subject: st/xorg: use an immediate instead of a full blown const --- src/gallium/state_trackers/xorg/xorg_exa_tgsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c index da4f8909f6..f8557755ef 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c @@ -364,19 +364,19 @@ xrender_tex(struct ureg_program *ureg, if (repeat_none) { struct ureg_dst tmp0 = ureg_DECL_temporary(ureg); struct ureg_dst tmp1 = ureg_DECL_temporary(ureg); - struct ureg_src const0 = ureg_DECL_constant(ureg, 0); + struct ureg_src imm0 = ureg_imm4f(ureg, 0, 0, 0, 1); ureg_SGT(ureg, tmp1, ureg_swizzle(coords, TGSI_SWIZZLE_X, TGSI_SWIZZLE_Y, TGSI_SWIZZLE_X, TGSI_SWIZZLE_Y), - ureg_scalar(const0, TGSI_SWIZZLE_X)); + ureg_scalar(imm0, TGSI_SWIZZLE_X)); ureg_SLT(ureg, tmp0, ureg_swizzle(coords, TGSI_SWIZZLE_X, TGSI_SWIZZLE_Y, TGSI_SWIZZLE_X, TGSI_SWIZZLE_Y), - ureg_scalar(const0, TGSI_SWIZZLE_W)); + ureg_scalar(imm0, TGSI_SWIZZLE_W)); ureg_MIN(ureg, tmp0, ureg_src(tmp0), ureg_src(tmp1)); ureg_MIN(ureg, tmp0, ureg_scalar(ureg_src(tmp0), TGSI_SWIZZLE_X), ureg_scalar(ureg_src(tmp0), TGSI_SWIZZLE_Y)); -- cgit v1.2.3 From 5f305b1db925c819ddeb29a75f6fbad6500a2d11 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 11 Nov 2009 14:49:03 -0800 Subject: i965: Fix VBO last-valid-offset setup on Ironlake. Instead of doing math based on the (broken for VBO && offset != 0) input->count number, just use the BO size. Fixes assertion failure in ETQW. --- src/mesa/drivers/dri/i965/brw_draw_upload.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 348c66154f..2b1347b698 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -536,16 +536,9 @@ static void brw_emit_vertices(struct brw_context *brw) I915_GEM_DOMAIN_VERTEX, 0, input->offset); if (BRW_IS_IGDNG(brw)) { - if (input->stride) { - OUT_RELOC(input->bo, - I915_GEM_DOMAIN_VERTEX, 0, - input->offset + input->stride * input->count - 1); - } else { - assert(input->count == 1); - OUT_RELOC(input->bo, - I915_GEM_DOMAIN_VERTEX, 0, - input->offset + input->element_size - 1); - } + OUT_RELOC(input->bo, + I915_GEM_DOMAIN_VERTEX, 0, + input->bo->size - 1); } else OUT_BATCH(input->stride ? input->count : 0); OUT_BATCH(0); /* Instance data step rate */ -- cgit v1.2.3 From 514544f373b6e6fae11b7b4426949b8ad64c441b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 12 Nov 2009 09:08:50 -0800 Subject: i965: Fix Ironlake shadow comparisons. The cube map array index arg is always present. --- src/mesa/drivers/dri/i965/brw_wm_emit.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 268f7965c0..9b1f54414b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -745,22 +745,32 @@ static void emit_tex( struct brw_wm_compile *c, abort(); } - if (inst->tex_shadow) { - nr = 4; - emit |= WRITEMASK_W; - } + /* For shadow comparisons, we have to supply u,v,r. */ + if (inst->tex_shadow) + nr = 3; msgLength = 1; for (i = 0; i < nr; i++) { - static const GLuint swz[4] = {0,1,2,2}; - if (emit & (1<brw) && inst->tex_shadow) { + brw_MOV(p, brw_message_reg(msgLength+1), brw_imm_f(0)); + msgLength += 2; + } + + /* Fill in the shadow comparison reference value. */ + if (inst->tex_shadow) { + brw_MOV(p, brw_message_reg(msgLength+1), arg[2]); + msgLength += 2; + } + responseLength = 8; /* always */ if (BRW_IS_IGDNG(p->brw)) { -- cgit v1.2.3 From a736d3f4399a99b54d6af140f2227253f2ee262b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 12 Nov 2009 15:36:02 -0800 Subject: intel: Remove unused enable_imaging parameter to intelInitExtensions --- src/mesa/drivers/dri/intel/intel_context.c | 2 +- src/mesa/drivers/dri/intel/intel_extensions.c | 6 ++---- src/mesa/drivers/dri/intel/intel_extensions.h | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index e0022ad548..2aeca6b81b 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -745,7 +745,7 @@ intelInitContext(struct intel_context *intel, exit(1); } - intelInitExtensions(ctx, GL_FALSE); + intelInitExtensions(ctx); INTEL_DEBUG = driParseDebugString(getenv("INTEL_DEBUG"), debug_control); if (INTEL_DEBUG & DEBUG_BUFMGR) diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index b6754c9fcb..d8a3981b53 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -194,15 +194,13 @@ static const struct dri_extension fragment_shader_extensions[] = { * extensions for a context. */ void -intelInitExtensions(GLcontext *ctx, GLboolean enable_imaging) +intelInitExtensions(GLcontext *ctx) { struct intel_context *intel = ctx?intel_context(ctx):NULL; /* Disable imaging extension until convolution is working in teximage paths. */ - enable_imaging = GL_FALSE; - - driInitExtensions(ctx, card_extensions, enable_imaging); + driInitExtensions(ctx, card_extensions, GL_FALSE); if (intel == NULL || intel->ttm) driInitExtensions(ctx, ttm_extensions, GL_FALSE); diff --git a/src/mesa/drivers/dri/intel/intel_extensions.h b/src/mesa/drivers/dri/intel/intel_extensions.h index 97147ecdb0..1d1c97a4a9 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.h +++ b/src/mesa/drivers/dri/intel/intel_extensions.h @@ -30,7 +30,7 @@ extern void -intelInitExtensions(GLcontext *ctx, GLboolean enable_imaging); +intelInitExtensions(GLcontext *ctx); #endif -- cgit v1.2.3 From b6b753f72728b734fc9886f4ec513ae09e6b269d Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 12 Nov 2009 15:39:59 -0800 Subject: intel: Don't check for context pointer to be NULL during extension init Thanks to Chia-I Wu's changes to the extension function infrastructure, we no longer have to tell the loader which extensions the driver might enable. This means that intelInitExtensions will never be called with a NULL context pointer. Remove all the NULL checks. Signed-off-by: Ian Romanick Reviewed-by: Eric Anholt --- src/mesa/drivers/dri/intel/intel_extensions.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index d8a3981b53..1682e115cc 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -196,27 +196,26 @@ static const struct dri_extension fragment_shader_extensions[] = { void intelInitExtensions(GLcontext *ctx) { - struct intel_context *intel = ctx?intel_context(ctx):NULL; + struct intel_context *intel = intel_context(ctx); /* Disable imaging extension until convolution is working in teximage paths. */ driInitExtensions(ctx, card_extensions, GL_FALSE); - if (intel == NULL || intel->ttm) + if (intel->ttm) driInitExtensions(ctx, ttm_extensions, GL_FALSE); - if (intel == NULL || IS_965(intel->intelScreen->deviceID)) + if (IS_965(intel->intelScreen->deviceID)) driInitExtensions(ctx, brw_extensions, GL_FALSE); - if (intel == NULL || IS_915(intel->intelScreen->deviceID) + if (IS_915(intel->intelScreen->deviceID) || IS_945(intel->intelScreen->deviceID)) { driInitExtensions(ctx, i915_extensions, GL_FALSE); - if (intel == NULL || driQueryOptionb(&intel->optionCache, "fragment_shader")) + if (driQueryOptionb(&intel->optionCache, "fragment_shader")) driInitExtensions(ctx, fragment_shader_extensions, GL_FALSE); - if (intel == NULL || driQueryOptionb(&intel->optionCache, - "stub_occlusion_query")) + if (driQueryOptionb(&intel->optionCache, "stub_occlusion_query")) driInitExtensions(ctx, arb_oq_extensions, GL_FALSE); } } -- cgit v1.2.3 From 654122ba7b813683a893d60d10ca201258deface Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Thu, 12 Nov 2009 16:21:00 -0500 Subject: st/xorg: try to fix non-uniform transforms --- src/gallium/state_trackers/xorg/xorg_renderer.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 05f00710d0..723605312c 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -148,32 +148,42 @@ add_vertex_data1(struct xorg_renderer *r, float width, float height, struct pipe_texture *src, float *src_matrix) { - float s0, t0, s1, t1; - float pt0[2], pt1[2]; + float s0, t0, s1, t1, s2, t2, s3, t3; + float pt0[2], pt1[2], pt2[2], pt3[2]; pt0[0] = srcX; pt0[1] = srcY; pt1[0] = (srcX + width); - pt1[1] = (srcY + height); + pt1[1] = srcY; + pt2[0] = (srcX + width); + pt2[1] = (srcY + height); + pt3[0] = srcX; + pt3[1] = (srcY + height); if (src_matrix) { map_point(src_matrix, pt0[0], pt0[1], &pt0[0], &pt0[1]); map_point(src_matrix, pt1[0], pt1[1], &pt1[0], &pt1[1]); + map_point(src_matrix, pt2[0], pt2[1], &pt2[0], &pt2[1]); + map_point(src_matrix, pt3[0], pt3[1], &pt3[0], &pt3[1]); } s0 = pt0[0] / src->width[0]; s1 = pt1[0] / src->width[0]; + s2 = pt2[0] / src->width[0]; + s3 = pt3[0] / src->width[0]; t0 = pt0[1] / src->height[0]; t1 = pt1[1] / src->height[0]; + t2 = pt2[1] / src->height[0]; + t3 = pt3[1] / src->height[0]; /* 1st vertex */ add_vertex_1tex(r, dstX, dstY, s0, t0); /* 2nd vertex */ - add_vertex_1tex(r, dstX + width, dstY, s1, t0); + add_vertex_1tex(r, dstX + width, dstY, s1, t1); /* 3rd vertex */ - add_vertex_1tex(r, dstX + width, dstY + height, s1, t1); + add_vertex_1tex(r, dstX + width, dstY + height, s2, t2); /* 4th vertex */ - add_vertex_1tex(r, dstX, dstY + height, s0, t1); + add_vertex_1tex(r, dstX, dstY + height, s3, t3); } static struct pipe_buffer * -- cgit v1.2.3 From d6690ce15fb8c7c6abf1bc0d847c1d2da2c33904 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 11 Nov 2009 13:26:26 -0800 Subject: mesa: Improve the eliminate-move-use to work across multiple instructions. This shaves more instructions off of the VS of my GL demo, but no performance difference this time at n=6. This also fixes a regression that was in this path, which is now piglit's glsl-vs-mov-after-deref. --- src/mesa/shader/prog_optimize.c | 126 +++++++++++++++++++++++++++------------- 1 file changed, 85 insertions(+), 41 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c index 8638754e24..3d28d885a4 100644 --- a/src/mesa/shader/prog_optimize.c +++ b/src/mesa/shader/prog_optimize.c @@ -65,6 +65,7 @@ get_src_arg_mask(const struct prog_instruction *inst, int arg) case OPCODE_DP2: return WRITEMASK_XY; case OPCODE_DP3: + case OPCODE_XPD: return WRITEMASK_XYZ; default: return WRITEMASK_XYZW; @@ -396,6 +397,26 @@ find_next_temp_use(const struct gl_program *prog, GLuint start, GLuint index) return END; } +static GLboolean _mesa_is_flow_control_opcode(enum prog_opcode opcode) +{ + switch (opcode) { + case OPCODE_BGNLOOP: + case OPCODE_BGNSUB: + case OPCODE_BRA: + case OPCODE_CAL: + case OPCODE_CONT: + case OPCODE_IF: + case OPCODE_ELSE: + case OPCODE_END: + case OPCODE_ENDIF: + case OPCODE_ENDLOOP: + case OPCODE_ENDSUB: + case OPCODE_RET: + return GL_TRUE; + default: + return GL_FALSE; + } +} /** * Try to remove use of extraneous MOV instructions, to free them up for dead @@ -404,7 +425,7 @@ find_next_temp_use(const struct gl_program *prog, GLuint start, GLuint index) static void _mesa_remove_extra_move_use(struct gl_program *prog) { - GLuint i; + GLuint i, j; if (dbg) { _mesa_printf("Optimize: Begin remove extra move use\n"); @@ -414,63 +435,86 @@ _mesa_remove_extra_move_use(struct gl_program *prog) /* * Look for sequences such as this: * MOV tmpX, arg0; + * ... * FOO tmpY, tmpX, arg1; * and convert into: * MOV tmpX, arg0; + * ... * FOO tmpY, arg0, arg1; */ for (i = 0; i < prog->NumInstructions - 1; i++) { const struct prog_instruction *mov = prog->Instructions + i; - struct prog_instruction *inst2 = prog->Instructions + i + 1; - int arg; if (mov->Opcode != OPCODE_MOV || mov->DstReg.File != PROGRAM_TEMPORARY || mov->DstReg.RelAddr || mov->DstReg.CondMask != COND_TR || - mov->SaturateMode != SATURATE_OFF) + mov->SaturateMode != SATURATE_OFF || + mov->SrcReg[0].RelAddr) continue; - for (arg = 0; arg < _mesa_num_inst_src_regs(inst2->Opcode); arg++) { - int comp; - int read_mask = get_src_arg_mask(inst2, arg); - - if (inst2->SrcReg[arg].File != mov->DstReg.File || - inst2->SrcReg[arg].Index != mov->DstReg.Index || - inst2->SrcReg[arg].RelAddr || - inst2->SrcReg[arg].Abs) - continue; - - /* Check that all the sources for this arg of inst2 come from inst1 - * or constants. - */ - for (comp = 0; comp < 4; comp++) { - int src_swz = GET_SWZ(inst2->SrcReg[arg].Swizzle, comp); - - /* If the MOV didn't write that channel, can't use it. */ - if ((read_mask & (1 << comp)) && - src_swz <= SWIZZLE_W && - (mov->DstReg.WriteMask & (1 << src_swz)) == 0) - break; - } - if (comp != 4) - continue; - - /* Adjust the swizzles of inst2 to point at MOV's source */ - for (comp = 0; comp < 4; comp++) { - int inst2_swz = GET_SWZ(inst2->SrcReg[arg].Swizzle, comp); - - if (inst2_swz <= SWIZZLE_W) { - GLuint s = GET_SWZ(mov->SrcReg[0].Swizzle, inst2_swz); - inst2->SrcReg[arg].Swizzle &= ~(7 << (3 * comp)); - inst2->SrcReg[arg].Swizzle |= s << (3 * comp); - inst2->SrcReg[arg].Negate ^= (((mov->SrcReg[0].Negate >> - inst2_swz) & 0x1) << comp); + /* Walk through remaining instructions until the or src reg gets + * rewritten or we get into some flow-control, eliminating the use of + * this MOV. + */ + for (j = i + 1; j < prog->NumInstructions; j++) { + struct prog_instruction *inst2 = prog->Instructions + j; + int arg; + + if (_mesa_is_flow_control_opcode(inst2->Opcode)) + break; + + /* First rewrite this instruction's args if appropriate. */ + for (arg = 0; arg < _mesa_num_inst_src_regs(inst2->Opcode); arg++) { + int comp; + int read_mask = get_src_arg_mask(inst2, arg); + + if (inst2->SrcReg[arg].File != mov->DstReg.File || + inst2->SrcReg[arg].Index != mov->DstReg.Index || + inst2->SrcReg[arg].RelAddr || + inst2->SrcReg[arg].Abs) + continue; + + /* Check that all the sources for this arg of inst2 come from inst1 + * or constants. + */ + for (comp = 0; comp < 4; comp++) { + int src_swz = GET_SWZ(inst2->SrcReg[arg].Swizzle, comp); + + /* If the MOV didn't write that channel, can't use it. */ + if ((read_mask & (1 << comp)) && + src_swz <= SWIZZLE_W && + (mov->DstReg.WriteMask & (1 << src_swz)) == 0) + break; + } + if (comp != 4) + continue; + + /* Adjust the swizzles of inst2 to point at MOV's source */ + for (comp = 0; comp < 4; comp++) { + int inst2_swz = GET_SWZ(inst2->SrcReg[arg].Swizzle, comp); + + if (inst2_swz <= SWIZZLE_W) { + GLuint s = GET_SWZ(mov->SrcReg[0].Swizzle, inst2_swz); + inst2->SrcReg[arg].Swizzle &= ~(7 << (3 * comp)); + inst2->SrcReg[arg].Swizzle |= s << (3 * comp); + inst2->SrcReg[arg].Negate ^= (((mov->SrcReg[0].Negate >> + inst2_swz) & 0x1) << comp); + } } + inst2->SrcReg[arg].File = mov->SrcReg[0].File; + inst2->SrcReg[arg].Index = mov->SrcReg[0].Index; } - inst2->SrcReg[arg].File = mov->SrcReg[0].File; - inst2->SrcReg[arg].Index = mov->SrcReg[0].Index; + + /* If this instruction overwrote part of the move, our time is up. */ + if ((inst2->DstReg.File == mov->DstReg.File && + (inst2->DstReg.RelAddr || + inst2->DstReg.Index == mov->DstReg.Index)) || + (inst2->DstReg.File == mov->SrcReg[0].File && + (inst2->DstReg.RelAddr || + inst2->DstReg.Index == mov->SrcReg[0].Index))) + break; } } -- cgit v1.2.3 From 91bd593109c71310fb7e101c5f73a14f1bbd5f93 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 11 Nov 2009 11:58:12 -0800 Subject: i965: Avoid moving the current value back into the accumulator for MAD. This is a 2.9% (+/-.3%) performance win for my GL demo, which hits MAD sequences for matrix transforms. --- src/mesa/drivers/dri/i965/brw_vs_emit.c | 35 ++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 15154c3b8e..f7b0726636 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -1271,6 +1271,38 @@ post_vs_emit( struct brw_vs_compile *c, } } +static GLboolean +accumulator_contains(struct brw_vs_compile *c, struct brw_reg val) +{ + struct brw_compile *p = &c->func; + struct brw_instruction *prev_insn = &p->store[p->nr_insn - 1]; + + if (p->nr_insn == 0) + return GL_FALSE; + + if (val.address_mode != BRW_ADDRESS_DIRECT) + return GL_FALSE; + + switch (prev_insn->header.opcode) { + case BRW_OPCODE_MOV: + case BRW_OPCODE_MAC: + case BRW_OPCODE_MUL: + if (prev_insn->header.access_mode == BRW_ALIGN_16 && + prev_insn->header.execution_size == val.width && + prev_insn->bits1.da1.dest_reg_file == val.file && + prev_insn->bits1.da1.dest_reg_type == val.type && + prev_insn->bits1.da1.dest_address_mode == val.address_mode && + prev_insn->bits1.da1.dest_reg_nr == val.nr && + prev_insn->bits1.da16.dest_subreg_nr == val.subnr / 16 && + prev_insn->bits1.da16.dest_writemask == 0xf) + return GL_TRUE; + else + return GL_FALSE; + default: + return GL_FALSE; + } +} + static uint32_t get_predicate(const struct prog_instruction *inst) { @@ -1449,7 +1481,8 @@ void brw_vs_emit(struct brw_vs_compile *c ) unalias3(c, dst, args[0], args[1], args[2], emit_lrp_noalias); break; case OPCODE_MAD: - brw_MOV(p, brw_acc_reg(), args[2]); + if (!accumulator_contains(c, args[2])) + brw_MOV(p, brw_acc_reg(), args[2]); brw_MAC(p, dst, args[0], args[1]); break; case OPCODE_MAX: -- cgit v1.2.3 From 4e50ce35ee1376062de2c6fa69da144be30a61e2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 11 Nov 2009 15:29:34 -0800 Subject: i965: Clean up Ironlake sampler type definitions. They're the same regardless of execution width for 8, 4x2, and 16. --- src/mesa/drivers/dri/i965/brw_defines.h | 16 ++++------------ src/mesa/drivers/dri/i965/brw_wm_emit.c | 6 +++--- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 6 +++--- 3 files changed, 10 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h index 78d457ad2b..c19510bbd4 100644 --- a/src/mesa/drivers/dri/i965/brw_defines.h +++ b/src/mesa/drivers/dri/i965/brw_defines.h @@ -673,18 +673,10 @@ #define BRW_SAMPLER_MESSAGE_SIMD8_LD 3 #define BRW_SAMPLER_MESSAGE_SIMD16_LD 3 -#define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_IGDNG 0 -#define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_IGDNG 0 -#define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_IGDNG 0 -#define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_BIAS_IGDNG 1 -#define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_BIAS_IGDNG 1 -#define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS_IGDNG 1 -#define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_LOD_IGDNG 2 -#define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_LOD_IGDNG 2 -#define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_LOD_IGDNG 2 -#define BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_COMPARE_IGDNG 3 -#define BRW_SAMPLER_MESSAGE_SIMD4X2_SAMPLE_COMPARE_IGDNG 3 -#define BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE_IGDNG 3 +#define BRW_SAMPLER_MESSAGE_SAMPLE_IGDNG 0 +#define BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_IGDNG 1 +#define BRW_SAMPLER_MESSAGE_SAMPLE_LOD_IGDNG 2 +#define BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_IGDNG 3 /* for IGDNG only */ #define BRW_SAMPLER_SIMD_MODE_SIMD4X2 0 diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index eb37ea1864..abad5d2692 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -875,9 +875,9 @@ static void emit_tex( struct brw_wm_compile *c, if (BRW_IS_IGDNG(p->brw)) { if (inst->tex_shadow) - msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE_IGDNG; + msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_IGDNG; else - msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_IGDNG; + msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_IGDNG; } else { if (inst->tex_shadow) msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE; @@ -939,7 +939,7 @@ static void emit_txb( struct brw_wm_compile *c, msgLength = 9; if (BRW_IS_IGDNG(p->brw)) - msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS_IGDNG; + msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_IGDNG; else msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS; diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 9d3bc66f49..42a13fc80f 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -1850,7 +1850,7 @@ static void emit_txb(struct brw_wm_compile *c, brw_MOV(p, brw_message_reg(6), brw_imm_f(0)); /* ref (unused?) */ if (BRW_IS_IGDNG(p->brw)) { - msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_BIAS_IGDNG; + msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_IGDNG; } else { /* Does it work well on SIMD8? */ msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS; @@ -1932,9 +1932,9 @@ static void emit_tex(struct brw_wm_compile *c, if (BRW_IS_IGDNG(p->brw)) { if (shadow) - msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_COMPARE_IGDNG; + msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_IGDNG; else - msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE_IGDNG; + msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_IGDNG; } else { /* Does it work for shadow on SIMD8 ? */ msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE; -- cgit v1.2.3 From 3c05c1eb6326dc28e8ab073d179eb669e5699f4b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 12 Nov 2009 10:45:05 -0800 Subject: intel: When subdataing a busy buffer, use a temporary and blit in. This cuts a massive number of waits in ET:QW, which uses a VBO ringbuffer. Unfortunately it doesn't BufferData when wrapping back to 0, so we can't be clever with tracking what's been initialized. --- src/mesa/drivers/dri/intel/intel_buffer_objects.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index ea9d5a6276..669becdab4 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -209,10 +209,23 @@ intel_bufferobj_subdata(GLcontext * ctx, memcpy((char *)intel_obj->sys_buffer + offset, data, size); else { /* Flush any existing batchbuffer that might reference this data. */ - if (drm_intel_bo_references(intel->batch->buf, intel_obj->buffer)) - intelFlush(ctx); + if (drm_intel_bo_busy(intel_obj->buffer) || + drm_intel_bo_references(intel->batch->buf, intel_obj->buffer)) { + drm_intel_bo *temp_bo; - dri_bo_subdata(intel_obj->buffer, offset, size, data); + temp_bo = drm_intel_bo_alloc(intel->bufmgr, "subdata temp", size, 64); + + drm_intel_bo_subdata(temp_bo, 0, size, data); + + intel_emit_linear_blit(intel, + intel_obj->buffer, offset, + temp_bo, 0, + size); + + drm_intel_bo_unreference(temp_bo); + } else { + dri_bo_subdata(intel_obj->buffer, offset, size, data); + } } } -- cgit v1.2.3 From 8e8586e62671e8337c08b086bf7f3c54cc46191d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 12 Nov 2009 14:05:18 -0800 Subject: i965: Validate the number of URB entries selected for the VS. --- src/mesa/drivers/dri/i965/brw_vs_state.c | 37 ++++++++++++++++++++++++++++---- 1 file changed, 33 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_vs_state.c b/src/mesa/drivers/dri/i965/brw_vs_state.c index d790ab6555..7285466645 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_state.c +++ b/src/mesa/drivers/dri/i965/brw_vs_state.c @@ -109,10 +109,39 @@ vs_unit_create_from_key(struct brw_context *brw, struct brw_vs_unit_key *key) vs.thread3.urb_entry_read_offset = 0; vs.thread3.const_urb_entry_read_offset = key->curbe_offset * 2; - if (BRW_IS_IGDNG(brw)) - vs.thread4.nr_urb_entries = key->nr_urb_entries >> 2; - else - vs.thread4.nr_urb_entries = key->nr_urb_entries; + if (BRW_IS_IGDNG(brw)) { + switch (key->nr_urb_entries) { + case 8: + case 12: + case 16: + case 32: + case 64: + case 96: + case 128: + case 168: + case 192: + case 224: + case 256: + vs.thread4.nr_urb_entries = key->nr_urb_entries >> 2; + break; + default: + assert(0); + } + } else { + switch (key->nr_urb_entries) { + case 8: + case 12: + case 16: + case 32: + break; + case 64: + assert(BRW_IS_G4X(brw)); + break; + default: + assert(0); + } + vs.thread4.nr_urb_entries = key->nr_urb_entries; + } vs.thread4.urb_entry_allocation_size = key->urb_size - 1; -- cgit v1.2.3 From ded0ec1ea5db8e08b0bec8ac0d9d30f98e360003 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 12 Nov 2009 14:57:30 -0800 Subject: i965: Use bo_map instead of subdata to upload the bits of constant buffer. Saves CPU time, resulting in a 2.5% FPS win on ETQW. --- src/mesa/drivers/dri/i965/brw_vs_surface_state.c | 7 +++++-- src/mesa/drivers/dri/intel/intel_context.h | 21 +++++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c index 5dac632969..3bc9840a97 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_vs_surface_state.c @@ -68,10 +68,13 @@ brw_vs_update_constant_buffer(struct brw_context *brw) */ _mesa_load_state_parameters(&brw->intel.ctx, vp->program.Base.Parameters); + intel_bo_map_gtt_preferred(intel, const_buffer, GL_TRUE); for (i = 0; i < params->NumParameters; i++) { - dri_bo_subdata(const_buffer, i * 4 * sizeof(float), 4 * sizeof(float), - params->ParameterValues[i]); + memcpy(const_buffer->virtual + i * 4 * sizeof(float), + params->ParameterValues[i], + 4 * sizeof(float)); } + intel_bo_unmap_gtt_preferred(intel, const_buffer); return const_buffer; } diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 84fbfc564c..8936f757a4 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -590,4 +590,25 @@ is_power_of_two(uint32_t value) return (value & (value - 1)) == 0; } +static inline void +intel_bo_map_gtt_preferred(struct intel_context *intel, + drm_intel_bo *bo, + GLboolean write) +{ + if (intel->intelScreen->kernel_exec_fencing) + drm_intel_gem_bo_map_gtt(bo); + else + drm_intel_bo_map(bo, write); +} + +static inline void +intel_bo_unmap_gtt_preferred(struct intel_context *intel, + drm_intel_bo *bo) +{ + if (intel->intelScreen->kernel_exec_fencing) + drm_intel_gem_bo_unmap_gtt(bo); + else + drm_intel_bo_unmap(bo); +} + #endif -- cgit v1.2.3 From b54f8eeae8e7f5c5b43cb17255fee70227713c9c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 12 Nov 2009 17:48:55 -0800 Subject: i965: Remove long dead structures for ffvertex_prog.c. --- src/mesa/drivers/dri/i965/brw_context.h | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index e01930a4a0..2681913a90 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -412,23 +412,6 @@ struct brw_vertex_info { GLuint sizes[ATTRIB_BIT_DWORDS * 2]; /* sizes:2[VERT_ATTRIB_MAX] */ }; - - - -/* Cache for TNL programs. - */ -struct brw_tnl_cache_item { - GLuint hash; - void *key; - void *data; - struct brw_tnl_cache_item *next; -}; - -struct brw_tnl_cache { - struct brw_tnl_cache_item **items; - GLuint size, n_items; -}; - struct brw_query_object { struct gl_query_object Base; -- cgit v1.2.3 From 3727858ceb324c955b00ae29b8c1e12f47060fce Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 12 Nov 2009 18:27:12 -0800 Subject: i965: Remove an unused cache_item field. --- src/mesa/drivers/dri/i965/brw_context.h | 1 - src/mesa/drivers/dri/i965/brw_state_cache.c | 1 - src/mesa/drivers/dri/intel/intel_tex_copy.c | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 2681913a90..87e8a6aad4 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -320,7 +320,6 @@ struct brw_cache_item { GLuint nr_reloc_bufs; dri_bo *bo; - GLuint data_size; struct brw_cache_item *next; }; diff --git a/src/mesa/drivers/dri/i965/brw_state_cache.c b/src/mesa/drivers/dri/i965/brw_state_cache.c index d2ab624783..e4c9ba7d87 100644 --- a/src/mesa/drivers/dri/i965/brw_state_cache.c +++ b/src/mesa/drivers/dri/i965/brw_state_cache.c @@ -245,7 +245,6 @@ brw_upload_cache( struct brw_cache *cache, item->bo = bo; dri_bo_reference(bo); - item->data_size = data_size; if (cache->n_items > cache->size * 1.5) rehash(cache); diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index bb21dd5ed9..4b5fe7be9f 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -109,7 +109,7 @@ do_copy_texsubimage(struct intel_context *intel, return GL_FALSE; } - intelFlush(ctx); + // intelFlush(ctx); LOCK_HARDWARE(intel); { drm_intel_bo *dst_bo = intel_region_buffer(intel, -- cgit v1.2.3 From 1ffd0a77896d4921677f0717e6fa8708f6586eea Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 12 Nov 2009 19:12:11 -0800 Subject: intel: Remove some dead context structure fields. --- src/mesa/drivers/dri/intel/intel_context.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 8936f757a4..eb7be7ddd0 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -174,7 +174,6 @@ struct intel_context struct dri_metaops meta; - GLint refcount; GLbitfield Fallback; /**< mask of INTEL_FALLBACK_x bits */ GLuint NewGLState; @@ -199,7 +198,6 @@ struct intel_context struct intel_batchbuffer *batch; drm_intel_bo *first_post_swapbuffers_batch; GLboolean no_batch_wrap; - unsigned batch_id; struct { -- cgit v1.2.3 From 99077e77927ec26edf85bfef81a6d433171c3a1e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 12 Nov 2009 20:08:44 -0800 Subject: i965: Flag BRW_NEW_CONTEXT on some context state. Fixing this is a prereq for avoiding flagging all state at new batch time. Eliminating that still causes problems, though (notably glean logicOp fails on my GM965). --- src/mesa/drivers/dri/i965/brw_curbe.c | 2 +- src/mesa/drivers/dri/i965/brw_misc_state.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_curbe.c b/src/mesa/drivers/dri/i965/brw_curbe.c index 4be6c77aa1..aadcfbe2da 100644 --- a/src/mesa/drivers/dri/i965/brw_curbe.c +++ b/src/mesa/drivers/dri/i965/brw_curbe.c @@ -130,7 +130,7 @@ static void calculate_curbe_offsets( struct brw_context *brw ) const struct brw_tracked_state brw_curbe_offsets = { .dirty = { .mesa = _NEW_TRANSFORM, - .brw = BRW_NEW_VERTEX_PROGRAM, + .brw = BRW_NEW_VERTEX_PROGRAM | BRW_NEW_CONTEXT, .cache = CACHE_NEW_WM_PROG }, .prepare = calculate_curbe_offsets diff --git a/src/mesa/drivers/dri/i965/brw_misc_state.c b/src/mesa/drivers/dri/i965/brw_misc_state.c index ea71857548..4b0d598336 100644 --- a/src/mesa/drivers/dri/i965/brw_misc_state.c +++ b/src/mesa/drivers/dri/i965/brw_misc_state.c @@ -66,7 +66,7 @@ static void upload_blend_constant_color(struct brw_context *brw) const struct brw_tracked_state brw_blend_constant_color = { .dirty = { .mesa = _NEW_COLOR, - .brw = 0, + .brw = BRW_NEW_CONTEXT, .cache = 0 }, .emit = upload_blend_constant_color @@ -93,7 +93,7 @@ static void upload_drawing_rect(struct brw_context *brw) const struct brw_tracked_state brw_drawing_rect = { .dirty = { .mesa = _NEW_BUFFERS, - .brw = 0, + .brw = BRW_NEW_CONTEXT, .cache = 0 }, .emit = upload_drawing_rect @@ -317,7 +317,7 @@ static void upload_polygon_stipple(struct brw_context *brw) const struct brw_tracked_state brw_polygon_stipple = { .dirty = { .mesa = _NEW_POLYGONSTIPPLE, - .brw = 0, + .brw = BRW_NEW_CONTEXT, .cache = 0 }, .emit = upload_polygon_stipple @@ -362,7 +362,7 @@ static void upload_polygon_stipple_offset(struct brw_context *brw) const struct brw_tracked_state brw_polygon_stipple_offset = { .dirty = { .mesa = _NEW_WINDOW_POS, - .brw = 0, + .brw = BRW_NEW_CONTEXT, .cache = 0 }, .emit = upload_polygon_stipple_offset @@ -425,7 +425,7 @@ static void upload_line_stipple(struct brw_context *brw) const struct brw_tracked_state brw_line_stipple = { .dirty = { .mesa = _NEW_LINE, - .brw = 0, + .brw = BRW_NEW_CONTEXT, .cache = 0 }, .emit = upload_line_stipple -- cgit v1.2.3 From a0fd49b33455317466a75ec77eb292f41d6021d7 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 13 Nov 2009 15:16:17 -0800 Subject: i965: Clean up emit_tex a bit. --- src/mesa/drivers/dri/i965/brw_wm_emit.c | 51 ++++++++++++++++----------------- 1 file changed, 24 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index d91fad0f45..a47bf3f667 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -828,8 +828,8 @@ static void emit_tex( struct brw_wm_compile *c, struct brw_reg *arg ) { struct brw_compile *p = &c->func; - GLuint msgLength, responseLength; - GLuint i, nr; + GLuint cur_mrf = 2, response_length; + GLuint i, nr_texcoords; GLuint emit; GLuint msg_type; @@ -838,17 +838,17 @@ static void emit_tex( struct brw_wm_compile *c, switch (inst->tex_idx) { case TEXTURE_1D_INDEX: emit = WRITEMASK_X; - nr = 1; + nr_texcoords = 1; break; case TEXTURE_2D_INDEX: case TEXTURE_RECT_INDEX: emit = WRITEMASK_XY; - nr = 2; + nr_texcoords = 2; break; case TEXTURE_3D_INDEX: case TEXTURE_CUBE_INDEX: emit = WRITEMASK_XYZ; - nr = 3; + nr_texcoords = 3; break; default: /* unexpected target */ @@ -857,31 +857,28 @@ static void emit_tex( struct brw_wm_compile *c, /* For shadow comparisons, we have to supply u,v,r. */ if (inst->tex_shadow) - nr = 3; + nr_texcoords = 3; - msgLength = 1; - - for (i = 0; i < nr; i++) { + for (i = 0; i < nr_texcoords; i++) { if (emit & (1<brw) && inst->tex_shadow) { - brw_MOV(p, brw_message_reg(msgLength+1), brw_imm_f(0)); - msgLength += 2; + brw_MOV(p, brw_message_reg(cur_mrf), brw_imm_f(0)); + cur_mrf += 2; } /* Fill in the shadow comparison reference value. */ if (inst->tex_shadow) { - brw_MOV(p, brw_message_reg(msgLength+1), arg[2]); - msgLength += 2; + if (BRW_IS_IGDNG(p->brw)) { + /* Fill in the cube map array index value. */ + brw_MOV(p, brw_message_reg(cur_mrf), brw_imm_f(0)); + cur_mrf += 2; + } + brw_MOV(p, brw_message_reg(cur_mrf), arg[2]); + cur_mrf += 2; } - responseLength = 8; /* always */ + response_length = 8; /* always */ if (BRW_IS_IGDNG(p->brw)) { if (inst->tex_shadow) @@ -895,19 +892,19 @@ static void emit_tex( struct brw_wm_compile *c, msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE; } - brw_SAMPLE(p, + brw_SAMPLE(p, retype(vec16(dst[0]), BRW_REGISTER_TYPE_UW), 1, retype(c->payload.depth[0].hw_reg, BRW_REGISTER_TYPE_UW), SURF_INDEX_TEXTURE(inst->tex_unit), inst->tex_unit, /* sampler */ inst->writemask, - msg_type, - responseLength, - msgLength, - 0, + msg_type, + response_length, + cur_mrf - 1, + 0, 1, - BRW_SAMPLER_SIMD_MODE_SIMD16); + BRW_SAMPLER_SIMD_MODE_SIMD16); } -- cgit v1.2.3 From 1be0efcbdc74f9a84136c9d1f953755c1560e52e Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 19 Aug 2009 14:48:11 -0700 Subject: i965: Share OPCODE_TEX between brw_wm_emit.c and brw_wm_glsl.c. New comments should explain some of the confusion about how this message works. --- src/mesa/drivers/dri/i965/brw_wm.h | 8 +++ src/mesa/drivers/dri/i965/brw_wm_emit.c | 87 ++++++++++++++++++++---------- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 95 +++------------------------------ 3 files changed, 72 insertions(+), 118 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 7db212e392..c497e8a46b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -420,6 +420,14 @@ void emit_sop(struct brw_compile *p, GLuint cond, const struct brw_reg *arg0, const struct brw_reg *arg1); +void emit_tex(struct brw_wm_compile *c, + struct brw_reg *dst, + GLuint dst_flags, + struct brw_reg *arg, + struct brw_reg depth_payload, + GLuint tex_idx, + GLuint sampler, + GLboolean shadow); void emit_wpos_xy(struct brw_wm_compile *c, const struct brw_reg *dst, GLuint mask, diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index a47bf3f667..52bb73971b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -818,24 +818,41 @@ void emit_math2(struct brw_wm_compile *c, } brw_pop_insn_state(p); } - -static void emit_tex( struct brw_wm_compile *c, - const struct brw_wm_instruction *inst, - struct brw_reg *dst, - GLuint dst_flags, - struct brw_reg *arg ) +void emit_tex(struct brw_wm_compile *c, + struct brw_reg *dst, + GLuint dst_flags, + struct brw_reg *arg, + struct brw_reg depth_payload, + GLuint tex_idx, + GLuint sampler, + GLboolean shadow) { struct brw_compile *p = &c->func; + struct brw_reg dst_retyped; GLuint cur_mrf = 2, response_length; GLuint i, nr_texcoords; GLuint emit; GLuint msg_type; + GLuint mrf_per_channel; + GLuint simd_mode; + + if (c->dispatch_width == 16) { + mrf_per_channel = 2; + response_length = 8; + dst_retyped = retype(vec16(dst[0]), BRW_REGISTER_TYPE_UW); + simd_mode = BRW_SAMPLER_SIMD_MODE_SIMD16; + } else { + mrf_per_channel = 1; + response_length = 4; + dst_retyped = retype(vec8(dst[0]), BRW_REGISTER_TYPE_UW); + simd_mode = BRW_SAMPLER_SIMD_MODE_SIMD8; + } /* How many input regs are there? */ - switch (inst->tex_idx) { + switch (tex_idx) { case TEXTURE_1D_INDEX: emit = WRITEMASK_X; nr_texcoords = 1; @@ -855,56 +872,66 @@ static void emit_tex( struct brw_wm_compile *c, abort(); } + /* Pre-Ironlake, the 8-wide sampler always took u,v,r. */ + if (!BRW_IS_IGDNG(p->brw) && c->dispatch_width == 8) + nr_texcoords = 3; + /* For shadow comparisons, we have to supply u,v,r. */ - if (inst->tex_shadow) + if (shadow) nr_texcoords = 3; + /* Emit the texcoords. */ for (i = 0; i < nr_texcoords; i++) { if (emit & (1<tex_shadow) { + if (shadow) { if (BRW_IS_IGDNG(p->brw)) { /* Fill in the cube map array index value. */ brw_MOV(p, brw_message_reg(cur_mrf), brw_imm_f(0)); - cur_mrf += 2; + cur_mrf += mrf_per_channel; + } else if (c->dispatch_width == 8) { + /* Fill in the LOD bias value. */ + brw_MOV(p, brw_message_reg(cur_mrf), brw_imm_f(0)); + cur_mrf += mrf_per_channel; } brw_MOV(p, brw_message_reg(cur_mrf), arg[2]); - cur_mrf += 2; + cur_mrf += mrf_per_channel; } - response_length = 8; /* always */ - if (BRW_IS_IGDNG(p->brw)) { - if (inst->tex_shadow) - msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_IGDNG; - else - msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_IGDNG; + if (shadow) + msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_IGDNG; + else + msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_IGDNG; } else { - if (inst->tex_shadow) - msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE; - else - msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE; + /* Note that G45 and older determines shadow compare and dispatch width + * from message length for most messages. + */ + if (c->dispatch_width == 16 && shadow) + msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_COMPARE; + else + msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE; } brw_SAMPLE(p, - retype(vec16(dst[0]), BRW_REGISTER_TYPE_UW), + dst_retyped, 1, - retype(c->payload.depth[0].hw_reg, BRW_REGISTER_TYPE_UW), - SURF_INDEX_TEXTURE(inst->tex_unit), - inst->tex_unit, /* sampler */ - inst->writemask, + retype(depth_payload, BRW_REGISTER_TYPE_UW), + SURF_INDEX_TEXTURE(sampler), + sampler, + dst_flags & WRITEMASK_XYZW, msg_type, response_length, cur_mrf - 1, 0, 1, - BRW_SAMPLER_SIMD_MODE_SIMD16); + simd_mode); } @@ -1530,7 +1557,9 @@ void brw_wm_emit( struct brw_wm_compile *c ) /* Texturing operations: */ case OPCODE_TEX: - emit_tex(c, inst, dst, dst_flags, args[0]); + emit_tex(c, dst, dst_flags, args[0], c->payload.depth[0].hw_reg, + inst->tex_idx, inst->tex_unit, + inst->tex_shadow); break; case OPCODE_TXB: diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 42a13fc80f..4af01a5f2a 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -1871,94 +1871,6 @@ static void emit_txb(struct brw_wm_compile *c, BRW_SAMPLER_SIMD_MODE_SIMD8); } - -static void emit_tex(struct brw_wm_compile *c, - const struct prog_instruction *inst) -{ - struct brw_compile *p = &c->func; - struct brw_reg dst[4], src[4], payload_reg; - /* Note: TexSrcUnit was already looked up through SamplerTextures[] */ - const GLuint unit = inst->TexSrcUnit; - GLuint msg_len; - GLuint i, nr; - GLuint emit; - GLboolean shadow = (c->key.shadowtex_mask & (1<TexSrcTarget) { - case TEXTURE_1D_INDEX: - emit = WRITEMASK_X; - nr = 1; - break; - case TEXTURE_2D_INDEX: - case TEXTURE_RECT_INDEX: - emit = WRITEMASK_XY; - nr = 2; - break; - case TEXTURE_3D_INDEX: - case TEXTURE_CUBE_INDEX: - emit = WRITEMASK_XYZ; - nr = 3; - break; - default: - /* invalid target */ - abort(); - } - 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<brw)) { - if (shadow) - msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_COMPARE_IGDNG; - else - msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_IGDNG; - } else { - /* Does it work for shadow on SIMD8 ? */ - msg_type = BRW_SAMPLER_MESSAGE_SIMD8_SAMPLE; - } - - brw_SAMPLE(p, - retype(vec8(dst[0]), BRW_REGISTER_TYPE_UW), /* dest */ - 1, /* msg_reg_nr */ - retype(payload_reg, BRW_REGISTER_TYPE_UW), /* src0 */ - SURF_INDEX_TEXTURE(unit), - unit, /* sampler */ - inst->DstReg.WriteMask, /* writemask */ - msg_type, /* msg_type */ - 4, /* response_length */ - shadow ? 6 : 4, /* msg_length */ - 0, /* eot */ - 1, - BRW_SAMPLER_SIMD_MODE_SIMD8); - - if (shadow) - brw_MOV(p, dst[3], brw_imm_f(1.0)); -} - - /** * Resolve subroutine calls after code emit is done. */ @@ -2179,7 +2091,12 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) emit_noise4(c, inst); break; case OPCODE_TEX: - emit_tex(c, inst); + emit_tex(c, dst, dst_flags, args[0], + get_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, + 0, 1, 0, 0), + inst->TexSrcTarget, + inst->TexSrcUnit, + (c->key.shadowtex_mask & (1 << inst->TexSrcUnit)) != 0); break; case OPCODE_TXB: emit_txb(c, inst); -- cgit v1.2.3 From 57f40b18377f87c434f17d5670a13838d58065c9 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 19 Aug 2009 13:44:13 -0700 Subject: i965: Share OPCODE_TXB between brw_wm_emit.c and brw_wm_glsl.c This should fix TXB on G45 and older in the GLSL case. --- src/mesa/drivers/dri/i965/brw_wm.h | 7 +++ src/mesa/drivers/dri/i965/brw_wm_emit.c | 81 +++++++++++++++++++++------------ src/mesa/drivers/dri/i965/brw_wm_glsl.c | 76 ++----------------------------- 3 files changed, 63 insertions(+), 101 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index c497e8a46b..b3c05eb0ad 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -428,6 +428,13 @@ void emit_tex(struct brw_wm_compile *c, GLuint tex_idx, GLuint sampler, GLboolean shadow); +void emit_txb(struct brw_wm_compile *c, + struct brw_reg *dst, + GLuint dst_flags, + struct brw_reg *arg, + struct brw_reg depth_payload, + GLuint tex_idx, + GLuint sampler); void emit_wpos_xy(struct brw_wm_compile *c, const struct brw_reg *dst, GLuint mask, diff --git a/src/mesa/drivers/dri/i965/brw_wm_emit.c b/src/mesa/drivers/dri/i965/brw_wm_emit.c index 52bb73971b..5390fd2584 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_emit.c +++ b/src/mesa/drivers/dri/i965/brw_wm_emit.c @@ -935,57 +935,77 @@ void emit_tex(struct brw_wm_compile *c, } -static void emit_txb( struct brw_wm_compile *c, - const struct brw_wm_instruction *inst, - struct brw_reg *dst, - GLuint dst_flags, - struct brw_reg *arg ) +void emit_txb(struct brw_wm_compile *c, + struct brw_reg *dst, + GLuint dst_flags, + struct brw_reg *arg, + struct brw_reg depth_payload, + GLuint tex_idx, + GLuint sampler) { struct brw_compile *p = &c->func; GLuint msgLength; GLuint msg_type; - /* Shadow ignored for txb. + GLuint mrf_per_channel; + GLuint response_length; + struct brw_reg dst_retyped; + + /* The G45 and older chipsets don't support 8-wide dispatch for LOD biased + * samples, so we'll use the 16-wide instruction, leave the second halves + * undefined, and trust the execution mask to keep the undefined pixels + * from mattering. */ - switch (inst->tex_idx) { + if (c->dispatch_width == 16 || !BRW_IS_IGDNG(p->brw)) { + if (BRW_IS_IGDNG(p->brw)) + msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_IGDNG; + else + msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS; + mrf_per_channel = 2; + dst_retyped = retype(vec16(dst[0]), BRW_REGISTER_TYPE_UW); + response_length = 8; + } else { + msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_IGDNG; + mrf_per_channel = 1; + dst_retyped = retype(vec8(dst[0]), BRW_REGISTER_TYPE_UW); + response_length = 4; + } + + /* Shadow ignored for txb. */ + switch (tex_idx) { case TEXTURE_1D_INDEX: - brw_MOV(p, brw_message_reg(2), arg[0]); - brw_MOV(p, brw_message_reg(4), brw_imm_f(0)); - brw_MOV(p, brw_message_reg(6), brw_imm_f(0)); + brw_MOV(p, brw_message_reg(2 + 0 * mrf_per_channel), arg[0]); + brw_MOV(p, brw_message_reg(2 + 1 * mrf_per_channel), brw_imm_f(0)); + brw_MOV(p, brw_message_reg(2 + 2 * mrf_per_channel), brw_imm_f(0)); break; case TEXTURE_2D_INDEX: case TEXTURE_RECT_INDEX: - brw_MOV(p, brw_message_reg(2), arg[0]); - brw_MOV(p, brw_message_reg(4), arg[1]); - brw_MOV(p, brw_message_reg(6), brw_imm_f(0)); + brw_MOV(p, brw_message_reg(2 + 0 * mrf_per_channel), arg[0]); + brw_MOV(p, brw_message_reg(2 + 1 * mrf_per_channel), arg[1]); + brw_MOV(p, brw_message_reg(2 + 2 * mrf_per_channel), brw_imm_f(0)); break; case TEXTURE_3D_INDEX: case TEXTURE_CUBE_INDEX: - brw_MOV(p, brw_message_reg(2), arg[0]); - brw_MOV(p, brw_message_reg(4), arg[1]); - brw_MOV(p, brw_message_reg(6), arg[2]); + brw_MOV(p, brw_message_reg(2 + 0 * mrf_per_channel), arg[0]); + brw_MOV(p, brw_message_reg(2 + 1 * mrf_per_channel), arg[1]); + brw_MOV(p, brw_message_reg(2 + 2 * mrf_per_channel), arg[2]); break; default: /* unexpected target */ abort(); } - brw_MOV(p, brw_message_reg(8), arg[3]); - msgLength = 9; - - if (BRW_IS_IGDNG(p->brw)) - msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_IGDNG; - else - msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS; + brw_MOV(p, brw_message_reg(2 + 3 * mrf_per_channel), arg[3]); + msgLength = 2 + 4 * mrf_per_channel - 1; brw_SAMPLE(p, - retype(vec16(dst[0]), BRW_REGISTER_TYPE_UW), + dst_retyped, 1, - retype(c->payload.depth[0].hw_reg, BRW_REGISTER_TYPE_UW), - SURF_INDEX_TEXTURE(inst->tex_unit), - inst->tex_unit, /* sampler */ - inst->writemask, + retype(depth_payload, BRW_REGISTER_TYPE_UW), + SURF_INDEX_TEXTURE(sampler), + sampler, + dst_flags & WRITEMASK_XYZW, msg_type, - 8, /* responseLength */ + response_length, msgLength, 0, 1, @@ -1563,7 +1583,8 @@ void brw_wm_emit( struct brw_wm_compile *c ) break; case OPCODE_TXB: - emit_txb(c, inst, dst, dst_flags, args[0]); + emit_txb(c, dst, dst_flags, args[0], c->payload.depth[0].hw_reg, + inst->tex_idx, inst->tex_unit); break; case OPCODE_KIL: diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 4af01a5f2a..3ab446164c 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -1801,76 +1801,6 @@ static void emit_noise4( struct brw_wm_compile *c, release_tmps( c, mark ); } - -/* TODO - BIAS on SIMD8 not working yet... - */ -static void emit_txb(struct brw_wm_compile *c, - const struct prog_instruction *inst) -{ - struct brw_compile *p = &c->func; - struct brw_reg dst[4], src[4], payload_reg; - /* Note: TexSrcUnit was already looked up through SamplerTextures[] */ - const GLuint unit = inst->TexSrcUnit; - GLuint i; - GLuint msg_type; - - assert(unit < BRW_MAX_TEX_UNIT); - - 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++) - src[i] = get_src_reg(c, inst, 0, i); - - switch (inst->TexSrcTarget) { - case TEXTURE_1D_INDEX: - 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: - brw_MOV(p, brw_message_reg(2), src[0]); - brw_MOV(p, brw_message_reg(3), src[1]); - brw_MOV(p, brw_message_reg(4), brw_imm_f(0)); - break; - case TEXTURE_3D_INDEX: - case TEXTURE_CUBE_INDEX: - brw_MOV(p, brw_message_reg(2), src[0]); - brw_MOV(p, brw_message_reg(3), src[1]); - brw_MOV(p, brw_message_reg(4), src[2]); - break; - default: - /* invalid target */ - abort(); - } - brw_MOV(p, brw_message_reg(5), src[3]); /* bias */ - brw_MOV(p, brw_message_reg(6), brw_imm_f(0)); /* ref (unused?) */ - - if (BRW_IS_IGDNG(p->brw)) { - msg_type = BRW_SAMPLER_MESSAGE_SAMPLE_BIAS_IGDNG; - } else { - /* Does it work well on SIMD8? */ - msg_type = BRW_SAMPLER_MESSAGE_SIMD16_SAMPLE_BIAS; - } - - brw_SAMPLE(p, - retype(vec8(dst[0]), BRW_REGISTER_TYPE_UW), /* dest */ - 1, /* msg_reg_nr */ - retype(payload_reg, BRW_REGISTER_TYPE_UW), /* src0 */ - SURF_INDEX_TEXTURE(unit), - unit, /* sampler */ - inst->DstReg.WriteMask, /* writemask */ - msg_type, /* msg_type */ - 4, /* response_length */ - 4, /* msg_length */ - 0, /* eot */ - 1, - BRW_SAMPLER_SIMD_MODE_SIMD8); -} - /** * Resolve subroutine calls after code emit is done. */ @@ -2099,7 +2029,11 @@ static void brw_wm_emit_glsl(struct brw_context *brw, struct brw_wm_compile *c) (c->key.shadowtex_mask & (1 << inst->TexSrcUnit)) != 0); break; case OPCODE_TXB: - emit_txb(c, inst); + emit_txb(c, dst, dst_flags, args[0], + get_reg(c, PROGRAM_PAYLOAD, PAYLOAD_DEPTH, + 0, 1, 0, 0), + inst->TexSrcTarget, + c->fp->program.Base.SamplerUnits[inst->TexSrcUnit]); break; case OPCODE_KIL_NV: emit_kil(c); -- cgit v1.2.3 From e92492295ba6a716b69adcd14e80adf6b5900132 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 7 Nov 2009 22:03:32 +0100 Subject: r300: remove unneeded includes --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 2 -- src/mesa/drivers/dri/r300/r300_emit.h | 1 - src/mesa/drivers/dri/r300/r300_render.c | 2 -- 3 files changed, 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 1e2a54f634..8a56b9e63c 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -46,14 +46,12 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_context.h" #include "r300_ioctl.h" -#include "radeon_reg.h" #include "r300_reg.h" #include "r300_cmdbuf.h" #include "r300_emit.h" #include "radeon_bocs_wrapper.h" #include "radeon_mipmap_tree.h" #include "r300_state.h" -#include "radeon_reg.h" #include "radeon_queryobj.h" /** # of dwords reserved for additional instructions that may need to be written diff --git a/src/mesa/drivers/dri/r300/r300_emit.h b/src/mesa/drivers/dri/r300/r300_emit.h index 8e57e354d1..a456d8867c 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.h +++ b/src/mesa/drivers/dri/r300/r300_emit.h @@ -42,7 +42,6 @@ #include "main/glheader.h" #include "r300_context.h" #include "r300_cmdbuf.h" -#include "radeon_reg.h" static INLINE uint32_t cmdpacket0(struct radeon_screen *rscrn, int reg, int count) diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index 3cd38753b8..4ae593cbe7 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -67,8 +67,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "vbo/vbo_split.h" #include "tnl/tnl.h" #include "tnl/t_vp_build.h" -#include "radeon_reg.h" -#include "radeon_macros.h" #include "r300_context.h" #include "r300_ioctl.h" #include "r300_state.h" -- cgit v1.2.3 From 0aad2aee66392989777ee74078efda197f292ee7 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 8 Nov 2009 16:58:07 +0100 Subject: r300: add missing texformat --- src/mesa/drivers/dri/r300/r300_texstate.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 44ca24daf8..4699342994 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -83,6 +83,7 @@ static const struct tx_table { _ASSIGN(ARGB8888, R300_EASY_TX_FORMAT(W, Z, Y, X, W8Z8Y8X8)), _ASSIGN(ARGB8888_REV, R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8)), #endif + _ASSIGN(XRGB8888, R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8)), _ASSIGN(RGB888, R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8)), _ASSIGN(RGB565, R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5)), _ASSIGN(RGB565_REV, R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5)), -- cgit v1.2.3 From 49876ab6a7f2b06177d7ac9651bd7a07956cbb25 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Mon, 9 Nov 2009 23:11:29 +0100 Subject: radeon: remove unnecessary call to radeonEmitState fixes bo space accounting errors --- src/mesa/drivers/dri/radeon/radeon_common.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index 097ab7cf61..420dce4ac9 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -1123,8 +1123,6 @@ void radeonFlush(GLcontext *ctx) if (radeon->dma.flush) radeon->dma.flush( ctx ); - radeonEmitState(radeon); - if (radeon->cmdbuf.cs->cdw) rcommonFlushCmdBuf(radeon, __FUNCTION__); -- cgit v1.2.3 From 084f43c1502db1988ca53494ea590cf1351180ec Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 11 Nov 2009 12:53:06 +0100 Subject: radeon: add radeon_bo_is_referenced_by_cs function --- src/mesa/drivers/dri/radeon/radeon_bo_drm.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_bo_drm.h b/src/mesa/drivers/dri/radeon/radeon_bo_drm.h index 7141371633..46e30b905a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_bo_drm.h +++ b/src/mesa/drivers/dri/radeon/radeon_bo_drm.h @@ -39,6 +39,7 @@ #define RADEON_BO_FLAGS_MICRO_TILE 2 struct radeon_bo_manager; +struct radeon_cs; struct radeon_bo { uint32_t alignment; @@ -74,6 +75,7 @@ struct radeon_bo_funcs { int (*bo_get_tiling)(struct radeon_bo *bo, uint32_t *tiling_flags, uint32_t *pitch); int (*bo_is_busy)(struct radeon_bo *bo, uint32_t *domain); + int (*bo_is_referenced_by_cs)(struct radeon_bo *bo, struct radeon_cs *cs); }; struct radeon_bo_manager { @@ -199,6 +201,15 @@ static inline int radeon_bo_is_static(struct radeon_bo *bo) return 0; } +static inline int _radeon_bo_is_referenced_by_cs(struct radeon_bo *bo, + struct radeon_cs *cs, + const char *file, + const char *func, + unsigned line) +{ + return bo->cref > 1; +} + #define radeon_bo_open(bom, h, s, a, d, f)\ _radeon_bo_open(bom, h, s, a, d, f, __FILE__, __FUNCTION__, __LINE__) #define radeon_bo_ref(bo)\ @@ -215,5 +226,7 @@ static inline int radeon_bo_is_static(struct radeon_bo *bo) _radeon_bo_wait(bo, __FILE__, __func__, __LINE__) #define radeon_bo_is_busy(bo, domain) \ _radeon_bo_is_busy(bo, domain, __FILE__, __func__, __LINE__) +#define radeon_bo_is_referenced_by_cs(bo, cs) \ + _radeon_bo_is_referenced_by_cs(bo, cs, __FILE__, __FUNCTION__, __LINE__) #endif -- cgit v1.2.3 From f6d0993212fac0eb67827716be1ab4a292c8b4e5 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 11 Nov 2009 13:00:10 +0100 Subject: radeon: fix glBufferSubData --- src/mesa/drivers/dri/radeon/radeon_buffer_objects.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c index 8fac5c6c51..99d3ec7005 100644 --- a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c +++ b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c @@ -136,8 +136,13 @@ radeonBufferSubData(GLcontext * ctx, const GLvoid * data, struct gl_buffer_object *obj) { + radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_buffer_object *radeon_obj = get_radeon_buffer_object(obj); + if (radeon_bo_is_referenced_by_cs(radeon_obj->bo, radeon->cmdbuf.cs)) { + radeon_firevertices(radeon); + } + radeon_bo_map(radeon_obj->bo, GL_TRUE); _mesa_memcpy(radeon_obj->bo->ptr + offset, data, size); -- cgit v1.2.3 From 286bf89e5a1fc931dbf523ded861b809859485e2 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 11 Nov 2009 13:06:19 +0100 Subject: radeon/r300: no need to flush the cmdbuf when changing scissors state in KMM mode --- src/mesa/drivers/dri/r300/r300_state.c | 3 ++- src/mesa/drivers/dri/radeon/radeon_common.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index ac20c08e20..1fd32d497b 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1741,7 +1741,8 @@ static void r300Enable(GLcontext * ctx, GLenum cap, GLboolean state) r300SetPolygonOffsetState(ctx, state); break; case GL_SCISSOR_TEST: - radeon_firevertices(&rmesa->radeon); + if (!rmesa->radeon.radeonScreen->kernel_mm) + radeon_firevertices(&rmesa->radeon); rmesa->radeon.state.scissor.enabled = state; radeonUpdateScissor( ctx ); break; diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index 420dce4ac9..cb344f1d21 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -257,7 +257,9 @@ void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h) radeonContextPtr radeon = RADEON_CONTEXT(ctx); if (ctx->Scissor.Enabled) { /* We don't pipeline cliprect changes */ - radeon_firevertices(radeon); + if (!radeon->radeonScreen->kernel_mm) { + radeon_firevertices(radeon); + } radeonUpdateScissor(ctx); } } -- cgit v1.2.3 From d3fa67c9b83b5736724ca57a0487857631e6c415 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 11 Nov 2009 13:50:06 +0100 Subject: radeon/r300: don't flush cmdbuf if not necessary --- src/mesa/drivers/dri/r300/r300_tex.c | 6 +++++- src/mesa/drivers/dri/radeon/radeon_texture.c | 16 ++++++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c index 27b78a912f..427237d200 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.c +++ b/src/mesa/drivers/dri/r300/r300_tex.c @@ -270,7 +270,11 @@ static void r300DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj) if (rmesa) { int i; - radeon_firevertices(&rmesa->radeon); + struct radeon_bo *bo; + bo = !t->mt ? t->bo : t->mt->bo; + if (bo && radeon_bo_is_referenced_by_cs(bo, rmesa->radeon.cmdbuf.cs)) { + radeon_firevertices(&rmesa->radeon); + } for(i = 0; i < R300_MAX_TEXTURE_UNITS; ++i) if (rmesa->hw.textures[i] == t) diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index baa99b752b..59bc8c34de 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -534,7 +534,13 @@ static void radeon_teximage( GLuint texelBytes; GLuint face = radeon_face_for_target(target); - radeon_firevertices(rmesa); + { + struct radeon_bo *bo; + bo = !image->mt ? image->bo : image->mt->bo; + if (bo && radeon_bo_is_referenced_by_cs(bo, rmesa->cmdbuf.cs)) { + radeon_firevertices(rmesa); + } + } t->validated = GL_FALSE; @@ -731,7 +737,13 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve radeonTexObj* t = radeon_tex_obj(texObj); radeon_texture_image* image = get_radeon_texture_image(texImage); - radeon_firevertices(rmesa); + { + struct radeon_bo *bo; + bo = !image->mt ? image->bo : image->mt->bo; + if (bo && radeon_bo_is_referenced_by_cs(bo, rmesa->cmdbuf.cs)) { + radeon_firevertices(rmesa); + } + } t->validated = GL_FALSE; if (compressed) { -- cgit v1.2.3 From aa195611586cdfb21bb1707b12b16e461a92d42e Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 11 Nov 2009 14:00:15 +0100 Subject: radeon: use radeon_bo_is_referenced_by_cs for query objects --- src/mesa/drivers/dri/radeon/radeon_common.c | 3 --- src/mesa/drivers/dri/radeon/radeon_common_context.c | 1 - src/mesa/drivers/dri/radeon/radeon_common_context.h | 1 - src/mesa/drivers/dri/radeon/radeon_queryobj.c | 21 +++------------------ 4 files changed, 3 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index cb344f1d21..3b4366aa61 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -1147,9 +1147,6 @@ void radeonFlush(GLcontext *ctx) } } } - - make_empty_list(&radeon->query.not_flushed_head); - } /* Make sure all commands have been sent to the hardware and have diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index fe99644907..2a38c4599c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -265,7 +265,6 @@ GLboolean radeonInitContext(radeonContextPtr radeon, radeon->texture_compressed_row_align = 64; } - make_empty_list(&radeon->query.not_flushed_head); radeon_init_dma(radeon); return GL_TRUE; diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h index 0309345393..5a0678b9d6 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h @@ -502,7 +502,6 @@ struct radeon_context { struct { struct radeon_query_object *current; - struct radeon_query_object not_flushed_head; struct radeon_state_atom queryobj; } query; diff --git a/src/mesa/drivers/dri/radeon/radeon_queryobj.c b/src/mesa/drivers/dri/radeon/radeon_queryobj.c index 6539c36268..b734f86eb3 100644 --- a/src/mesa/drivers/dri/radeon/radeon_queryobj.c +++ b/src/mesa/drivers/dri/radeon/radeon_queryobj.c @@ -31,20 +31,6 @@ #include "main/imports.h" #include "main/simple_list.h" -static int radeonQueryIsFlushed(GLcontext *ctx, struct gl_query_object *q) -{ - radeonContextPtr radeon = RADEON_CONTEXT(ctx); - struct radeon_query_object *tmp, *query = (struct radeon_query_object *)q; - - foreach(tmp, &radeon->query.not_flushed_head) { - if (tmp == query) { - return 0; - } - } - - return 1; -} - static void radeonQueryGetResult(GLcontext *ctx, struct gl_query_object *q) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); @@ -120,10 +106,11 @@ static void radeonDeleteQuery(GLcontext *ctx, struct gl_query_object *q) static void radeonWaitQuery(GLcontext *ctx, struct gl_query_object *q) { + radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = (struct radeon_query_object *)q; /* If the cmdbuf with packets for this query hasn't been flushed yet, do it now */ - if (!radeonQueryIsFlushed(ctx, q)) + if (radeon_bo_is_referenced_by_cs(query->bo, radeon->cmdbuf.cs)) ctx->Driver.Flush(ctx); radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s: query id %d, bo %p, offset %d\n", __FUNCTION__, q->Id, query->bo, query->curr_offset); @@ -155,8 +142,6 @@ static void radeonBeginQuery(GLcontext *ctx, struct gl_query_object *q) radeon->query.queryobj.dirty = GL_TRUE; radeon->hw.is_dirty = GL_TRUE; - insert_at_tail(&radeon->query.not_flushed_head, query); - } void radeonEmitQueryEnd(GLcontext *ctx) @@ -204,7 +189,7 @@ static void radeonCheckQuery(GLcontext *ctx, struct gl_query_object *q) uint32_t domain; /* Need to perform a flush, as per ARB_occlusion_query spec */ - if (!radeonQueryIsFlushed(ctx, q)) { + if (radeon_bo_is_referenced_by_cs(query->bo, radeon->cmdbuf.cs)) { ctx->Driver.Flush(ctx); } -- cgit v1.2.3 From 6e5d473cc16ca2d001df213fc1d907f2943a95bb Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 11 Nov 2009 18:55:49 +0100 Subject: r300: fix regression introduced in 1d5a06a1f7812c055db1d724e40d21a0e3686dd1 Spotted by Dave Airlie --- src/mesa/drivers/dri/r300/r300_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 6f66e970e4..3ed49a85c5 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -439,7 +439,7 @@ static void r300InitGLExtensions(GLcontext *ctx) if (r300->options.stencil_two_side_disabled) _mesa_disable_extension(ctx, "GL_EXT_stencil_two_side"); - if (r300->options.s3tc_force_enabled) { + if (ctx->Mesa_DXTn || r300->options.s3tc_force_enabled) { _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); _mesa_enable_extension(ctx, "GL_S3_s3tc"); } else if (r300->options.s3tc_force_disabled) { -- cgit v1.2.3 From 7628b06ba32e42f57a4fdb322bc32e3b411c1f18 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 14 Nov 2009 14:55:13 +0100 Subject: radeon: rework mipmap tree reference counting --- src/mesa/drivers/dri/r300/r300_tex.c | 13 ++++-------- src/mesa/drivers/dri/r300/r300_texstate.c | 12 ++++-------- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 12 ++++++++++-- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h | 5 +++-- src/mesa/drivers/dri/radeon/radeon_texture.c | 25 +++++++++--------------- 5 files changed, 30 insertions(+), 37 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c index 427237d200..7e94e93df2 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.c +++ b/src/mesa/drivers/dri/r300/r300_tex.c @@ -228,11 +228,8 @@ static void r300TexParameter(GLcontext * ctx, GLenum target, * we just have to rely on loading the right subset of mipmap levels * to simulate a clamped LOD. */ - if (t->mt) { - radeon_miptree_unreference(t->mt); - t->mt = 0; - t->validated = GL_FALSE; - } + radeon_miptree_unreference(&t->mt); + t->validated = GL_FALSE; break; case GL_DEPTH_TEXTURE_MODE: @@ -286,10 +283,8 @@ static void r300DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj) t->bo = NULL; } - if (t->mt) { - radeon_miptree_unreference(t->mt); - t->mt = 0; - } + radeon_miptree_unreference(&t->mt); + _mesa_delete_texture_object(ctx, texObj); } diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 4699342994..7b1adcf31d 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -438,14 +438,10 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo radeon_bo_unref(rImage->bo); rImage->bo = NULL; } - if (t->mt) { - radeon_miptree_unreference(t->mt); - t->mt = NULL; - } - if (rImage->mt) { - radeon_miptree_unreference(rImage->mt); - rImage->mt = NULL; - } + + radeon_miptree_unreference(&t->mt); + radeon_miptree_unreference(&rImage->mt); + _mesa_init_teximage_fields(radeon->glCtx, target, texImage, rb->base.Width, rb->base.Height, 1, 0, rb->cpp); texImage->RowStride = rb->pitch / rb->cpp; diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index dadc72f4c1..f635f58d6a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -223,23 +223,31 @@ radeon_mipmap_tree* radeon_miptree_create(radeonContextPtr rmesa, radeonTexObj * return mt; } -void radeon_miptree_reference(radeon_mipmap_tree *mt) +void radeon_miptree_reference(radeon_mipmap_tree *mt, radeon_mipmap_tree **ptr) { + assert(!*ptr); + mt->refcount++; assert(mt->refcount > 0); + + *ptr = mt; } -void radeon_miptree_unreference(radeon_mipmap_tree *mt) +void radeon_miptree_unreference(radeon_mipmap_tree **ptr) { + radeon_mipmap_tree *mt = *ptr; if (!mt) return; assert(mt->refcount > 0); + mt->refcount--; if (!mt->refcount) { radeon_bo_unref(mt->bo); free(mt); } + + *ptr = 0; } diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h index db28252da3..57299ceafa 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h @@ -87,8 +87,9 @@ radeon_mipmap_tree* radeon_miptree_create(radeonContextPtr rmesa, radeonTexObj * GLenum target, GLenum internal_format, GLuint firstLevel, GLuint lastLevel, GLuint width0, GLuint height0, GLuint depth0, GLuint bpp, GLuint tilebits, GLuint compressed); -void radeon_miptree_reference(radeon_mipmap_tree *mt); -void radeon_miptree_unreference(radeon_mipmap_tree *mt); + +void radeon_miptree_reference(radeon_mipmap_tree *mt, radeon_mipmap_tree **ptr); +void radeon_miptree_unreference(radeon_mipmap_tree **ptr); GLboolean radeon_miptree_matches_image(radeon_mipmap_tree *mt, struct gl_texture_image *texImage, GLuint face, GLuint level); diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 59bc8c34de..607ce7864e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -81,8 +81,7 @@ void radeonFreeTexImageData(GLcontext *ctx, struct gl_texture_image *timage) radeon_texture_image* image = get_radeon_texture_image(timage); if (image->mt) { - radeon_miptree_unreference(image->mt); - image->mt = 0; + radeon_miptree_unreference(&image->mt); assert(!image->base.Data); } else { _mesa_free_texture_image_data(ctx, timage); @@ -240,8 +239,7 @@ static void radeon_generate_mipmap(GLcontext *ctx, GLenum target, image->mtlevel = i; image->mtface = face; - radeon_miptree_unreference(image->mt); - image->mt = NULL; + radeon_miptree_unreference(&image->mt); } } @@ -571,18 +569,16 @@ static void radeon_teximage( t->mt->lastLevel == level && t->mt->target != GL_TEXTURE_CUBE_MAP_ARB && !radeon_miptree_matches_image(t->mt, texImage, face, level)) { - radeon_miptree_unreference(t->mt); - t->mt = NULL; + radeon_miptree_unreference(&t->mt); } if (!t->mt) radeon_try_alloc_miptree(rmesa, t, image, face, level); if (t->mt && radeon_miptree_matches_image(t->mt, texImage, face, level)) { radeon_mipmap_level *lvl; - image->mt = t->mt; image->mtlevel = level - t->mt->firstLevel; image->mtface = face; - radeon_miptree_reference(t->mt); + radeon_miptree_reference(t->mt, &image->mt); lvl = &image->mt->levels[image->mtlevel]; dstRowStride = lvl->rowstride; } else { @@ -894,7 +890,7 @@ static void migrate_image_to_miptree(radeon_mipmap_tree *mt, radeon_texture_imag dstlvl->size); radeon_bo_unmap(image->mt->bo); - radeon_miptree_unreference(image->mt); + radeon_miptree_unreference(&image->mt); } else { uint32_t srcrowstride; uint32_t height; @@ -919,10 +915,9 @@ static void migrate_image_to_miptree(radeon_mipmap_tree *mt, radeon_texture_imag radeon_bo_unmap(mt->bo); - image->mt = mt; image->mtface = face; image->mtlevel = level; - radeon_miptree_reference(image->mt); + radeon_miptree_reference(mt, &image->mt); } int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *texObj) @@ -954,12 +949,10 @@ int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *t if (baseimage->mt && baseimage->mt != t->mt && radeon_miptree_matches_texture(baseimage->mt, &t->base)) { - radeon_miptree_unreference(t->mt); - t->mt = baseimage->mt; - radeon_miptree_reference(t->mt); + radeon_miptree_unreference(&t->mt); + radeon_miptree_reference(baseimage->mt, &t->mt); } else if (t->mt && !radeon_miptree_matches_texture(t->mt, &t->base)) { - radeon_miptree_unreference(t->mt); - t->mt = 0; + radeon_miptree_unreference(&t->mt); } if (!t->mt) { -- cgit v1.2.3 From 9d0af686b27b82dce8ad1ee4c951098660807be6 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 14 Nov 2009 15:03:31 +0100 Subject: radeon: minor refactoring of texture code Also properly set dstImageOffsets for TexSubImage case. --- src/mesa/drivers/dri/radeon/radeon_texture.c | 57 ++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 607ce7864e..8fc686581b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -508,6 +508,27 @@ gl_format radeonChooseTextureFormat(GLcontext * ctx, return MESA_FORMAT_NONE; /* never get here */ } +static GLuint * allocate_image_offsets(GLcontext *ctx, + unsigned alignedWidth, + unsigned height, + unsigned depth) +{ + int i; + GLuint *offsets; + + offsets = _mesa_malloc(depth * sizeof(GLuint)) ; + if (!offsets) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTex[Sub]Image"); + return NULL; + } + + for (i = 0; i < depth; ++i) { + offsets[i] = alignedWidth * height * i; + } + + return offsets; +} + /** * All glTexImage calls go through this function. */ @@ -605,8 +626,8 @@ static void radeon_teximage( } if (pixels) { - radeon_teximage_map(image, GL_TRUE); if (compressed) { + radeon_teximage_map(image, GL_TRUE); if (image->mt) { uint32_t srcRowStride, bytesPerRow, rows; srcRowStride = _mesa_format_row_stride(texImage->TexFormat, width); @@ -629,19 +650,17 @@ static void radeon_teximage( } if (dims == 3) { - int i; - - dstImageOffsets = _mesa_malloc(depth * sizeof(GLuint)) ; - if (!dstImageOffsets) - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); - - for (i = 0; i < depth; ++i) { - dstImageOffsets[i] = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat) * height * i; + unsigned alignedWidth = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat); + dstImageOffsets = allocate_image_offsets(ctx, alignedWidth, height, depth); + if (!dstImageOffsets) { + return; } } else { dstImageOffsets = texImage->ImageOffsets; } + radeon_teximage_map(image, GL_TRUE); + if (!_mesa_texstore(ctx, dims, texImage->_BaseFormat, texImage->TexFormat, @@ -752,7 +771,7 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve if (pixels) { GLint dstRowStride; - radeon_teximage_map(image, GL_TRUE); + GLuint *dstImageOffsets; if (image->mt) { radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel]; @@ -761,6 +780,18 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat); } + if (dims == 3) { + unsigned alignedWidth = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat); + dstImageOffsets = allocate_image_offsets(ctx, alignedWidth, height, depth); + if (!dstImageOffsets) { + return; + } + } else { + dstImageOffsets = texImage->ImageOffsets; + } + + radeon_teximage_map(image, GL_TRUE); + if (compressed) { uint32_t srcRowStride, bytesPerRow, rows; GLubyte *img_start; @@ -786,12 +817,16 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve texImage->TexFormat, texImage->Data, xoffset, yoffset, zoffset, dstRowStride, - texImage->ImageOffsets, + dstImageOffsets, width, height, depth, format, type, pixels, packing)) { _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage"); } } + + if (dims == 3) { + _mesa_free(dstImageOffsets); + } } radeon_teximage_unmap(image); -- cgit v1.2.3 From 8f88cf3938f0156d4df6fcc5fde2711d40b85d03 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 14 Nov 2009 15:15:42 +0100 Subject: radeon: more texture code refactoring --- src/mesa/drivers/dri/radeon/radeon_texture.c | 208 ++++++++++++--------------- 1 file changed, 92 insertions(+), 116 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 8fc686581b..c093d1283d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -529,6 +529,83 @@ static GLuint * allocate_image_offsets(GLcontext *ctx, return offsets; } +/** + * Update a subregion of the given texture image. + */ +static void radeon_store_teximage(GLcontext* ctx, int dims, + GLint xoffset, GLint yoffset, GLint zoffset, + GLsizei width, GLsizei height, GLsizei depth, + GLsizei imageSize, + GLenum format, GLenum type, + const GLvoid * pixels, + const struct gl_pixelstore_attrib *packing, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + int compressed) +{ + radeon_texture_image* image = get_radeon_texture_image(texImage); + + GLint dstRowStride; + GLuint *dstImageOffsets; + + if (image->mt) { + radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel]; + dstRowStride = lvl->rowstride; + } else { + dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat); + } + + if (dims == 3) { + unsigned alignedWidth = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat); + dstImageOffsets = allocate_image_offsets(ctx, alignedWidth, height, depth); + if (!dstImageOffsets) { + return; + } + } else { + dstImageOffsets = texImage->ImageOffsets; + } + + radeon_teximage_map(image, GL_TRUE); + + if (compressed) { + uint32_t srcRowStride, bytesPerRow, rows; + GLubyte *img_start; + if (!image->mt) { + dstRowStride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width); + img_start = _mesa_compressed_image_address(xoffset, yoffset, 0, + texImage->TexFormat, + texImage->Width, texImage->Data); + } + else { + uint32_t blocks_x = dstRowStride / (image->mt->bpp * 4); + img_start = texImage->Data + image->mt->bpp * 4 * (blocks_x * (yoffset / 4) + xoffset / 4); + } + srcRowStride = _mesa_format_row_stride(texImage->TexFormat, width); + bytesPerRow = srcRowStride; + rows = (height + 3) / 4; + + copy_rows(img_start, dstRowStride, pixels, srcRowStride, rows, bytesPerRow); + + } + else { + if (!_mesa_texstore(ctx, dims, texImage->_BaseFormat, + texImage->TexFormat, texImage->Data, + xoffset, yoffset, zoffset, + dstRowStride, + dstImageOffsets, + width, height, depth, + format, type, pixels, packing)) { + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage"); + } + } + + if (dims == 3) { + _mesa_free(dstImageOffsets); + } + + radeon_teximage_unmap(image); +} + /** * All glTexImage calls go through this function. */ @@ -626,63 +703,16 @@ static void radeon_teximage( } if (pixels) { - if (compressed) { - radeon_teximage_map(image, GL_TRUE); - if (image->mt) { - uint32_t srcRowStride, bytesPerRow, rows; - srcRowStride = _mesa_format_row_stride(texImage->TexFormat, width); - bytesPerRow = srcRowStride; - rows = (height + 3) / 4; - copy_rows(texImage->Data, image->mt->levels[level].rowstride, - pixels, srcRowStride, rows, bytesPerRow); - } else { - memcpy(texImage->Data, pixels, imageSize); - } - } else { - GLuint dstRowStride; - GLuint *dstImageOffsets; - - if (image->mt) { - radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel]; - dstRowStride = lvl->rowstride; - } else { - dstRowStride = texImage->Width * _mesa_get_format_bytes(texImage->TexFormat); - } - - if (dims == 3) { - unsigned alignedWidth = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat); - dstImageOffsets = allocate_image_offsets(ctx, alignedWidth, height, depth); - if (!dstImageOffsets) { - return; - } - } else { - dstImageOffsets = texImage->ImageOffsets; - } - - radeon_teximage_map(image, GL_TRUE); - - if (!_mesa_texstore(ctx, dims, - texImage->_BaseFormat, - texImage->TexFormat, - texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */ - dstRowStride, - dstImageOffsets, - width, height, depth, - format, type, pixels, packing)) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage"); - } - - if (dims == 3) - _mesa_free(dstImageOffsets); - } + radeon_store_teximage(ctx, dims, + 0, 0, 0, + width, height, depth, + imageSize, format, type, + pixels, packing, + texObj, texImage, + compressed); } _mesa_unmap_teximage_pbo(ctx, packing); - - if (pixels) - radeon_teximage_unmap(image); - - } void radeonTexImage1D(GLcontext * ctx, GLenum target, GLint level, @@ -735,7 +765,7 @@ void radeonTexImage3D(GLcontext * ctx, GLenum target, GLint level, } /** - * Update a subregion of the given texture image. + * All glTexSubImage calls go through this function. */ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int level, GLint xoffset, GLint yoffset, GLint zoffset, @@ -770,70 +800,16 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve } if (pixels) { - GLint dstRowStride; - GLuint *dstImageOffsets; - - if (image->mt) { - radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel]; - dstRowStride = lvl->rowstride; - } else { - dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat); - } - - if (dims == 3) { - unsigned alignedWidth = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat); - dstImageOffsets = allocate_image_offsets(ctx, alignedWidth, height, depth); - if (!dstImageOffsets) { - return; - } - } else { - dstImageOffsets = texImage->ImageOffsets; - } - - radeon_teximage_map(image, GL_TRUE); - - if (compressed) { - uint32_t srcRowStride, bytesPerRow, rows; - GLubyte *img_start; - if (!image->mt) { - dstRowStride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width); - img_start = _mesa_compressed_image_address(xoffset, yoffset, 0, - texImage->TexFormat, - texImage->Width, texImage->Data); - } - else { - uint32_t blocks_x = dstRowStride / (image->mt->bpp * 4); - img_start = texImage->Data + image->mt->bpp * 4 * (blocks_x * (yoffset / 4) + xoffset / 4); - } - srcRowStride = _mesa_format_row_stride(texImage->TexFormat, width); - bytesPerRow = srcRowStride; - rows = (height + 3) / 4; - - copy_rows(img_start, dstRowStride, pixels, srcRowStride, rows, bytesPerRow); - - } - else { - if (!_mesa_texstore(ctx, dims, texImage->_BaseFormat, - texImage->TexFormat, texImage->Data, - xoffset, yoffset, zoffset, - dstRowStride, - dstImageOffsets, - width, height, depth, - format, type, pixels, packing)) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage"); - } - } - - if (dims == 3) { - _mesa_free(dstImageOffsets); - } + radeon_store_teximage(ctx, dims, + xoffset, yoffset, zoffset, + width, height, depth, + imageSize, format, type, + pixels, packing, + texObj, texImage, + compressed); } - radeon_teximage_unmap(image); - _mesa_unmap_teximage_pbo(ctx, packing); - - } void radeonTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, -- cgit v1.2.3 From 23ec7c457483aae1e0d399e9b570f1860c27c780 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 14 Nov 2009 16:55:39 +0100 Subject: radeon: rework mipmap tree --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 2 +- src/mesa/drivers/dri/r300/r300_tex.c | 6 - src/mesa/drivers/dri/r300/r300_texstate.c | 8 +- .../drivers/dri/radeon/radeon_common_context.h | 4 + src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 474 ++++++++++++++------- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h | 24 +- src/mesa/drivers/dri/radeon/radeon_texture.c | 243 +++-------- src/mesa/drivers/dri/radeon/radeon_texture.h | 3 +- 8 files changed, 400 insertions(+), 364 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 8a56b9e63c..4b5ed2d410 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -169,7 +169,7 @@ static void emit_tex_offsets(GLcontext *ctx, struct radeon_state_atom * atom) if (t && !t->image_override) { BEGIN_BATCH_NO_AUTOSTATE(4); OUT_BATCH_REGSEQ(R300_TX_OFFSET_0 + (i * 4), 1); - OUT_BATCH_RELOC(t->tile_bits, t->mt->bo, 0, + OUT_BATCH_RELOC(t->tile_bits, t->mt->bo, get_base_teximage_offset(t), RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); END_BATCH(); } else if (!t) { diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c index 7e94e93df2..726b3ff98e 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.c +++ b/src/mesa/drivers/dri/r300/r300_tex.c @@ -223,12 +223,6 @@ static void r300TexParameter(GLcontext * ctx, GLenum target, case GL_TEXTURE_MAX_LEVEL: case GL_TEXTURE_MIN_LOD: case GL_TEXTURE_MAX_LOD: - /* This isn't the most efficient solution but there doesn't appear to - * be a nice alternative. Since there's no LOD clamping, - * we just have to rely on loading the right subset of mipmap levels - * to simulate a clamped LOD. - */ - radeon_miptree_unreference(&t->mt); t->validated = GL_FALSE; break; diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 7b1adcf31d..e6f2c0c1a7 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -203,9 +203,7 @@ void r300SetDepthTexMode(struct gl_texture_object *tObj) static void setup_hardware_state(r300ContextPtr rmesa, radeonTexObj *t) { const struct gl_texture_image *firstImage; - int firstlevel = t->mt ? t->mt->firstLevel : 0; - - firstImage = t->base.Image[0][firstlevel]; + firstImage = t->base.Image[0][t->minLod]; if (!t->image_override && VALID_FORMAT(firstImage->TexFormat)) { @@ -228,7 +226,7 @@ static void setup_hardware_state(r300ContextPtr rmesa, radeonTexObj *t) t->pp_txsize = (((R300_TX_WIDTHMASK_MASK & ((firstImage->Width - 1) << R300_TX_WIDTHMASK_SHIFT))) | ((R300_TX_HEIGHTMASK_MASK & ((firstImage->Height - 1) << R300_TX_HEIGHTMASK_SHIFT))) | ((R300_TX_DEPTHMASK_MASK & ((firstImage->DepthLog2) << R300_TX_DEPTHMASK_SHIFT))) - | ((R300_TX_MAX_MIP_LEVEL_MASK & ((t->mt->lastLevel - t->mt->firstLevel) << R300_TX_MAX_MIP_LEVEL_SHIFT)))); + | ((R300_TX_MAX_MIP_LEVEL_MASK & ((t->maxLod - t->minLod) << R300_TX_MAX_MIP_LEVEL_SHIFT)))); t->tile_bits = 0; @@ -239,7 +237,7 @@ static void setup_hardware_state(r300ContextPtr rmesa, radeonTexObj *t) if (t->base.Target == GL_TEXTURE_RECTANGLE_NV) { - unsigned int align = (64 / t->mt->bpp) - 1; + unsigned int align = (64 / _mesa_get_format_bytes(firstImage->TexFormat)) - 1; t->pp_txsize |= R300_TX_SIZE_TXPITCH_EN; if (!t->image_override) t->pp_txpitch = ((firstImage->Width + align) & ~align) - 1; diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h index 5a0678b9d6..ded81fff29 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h @@ -208,6 +208,10 @@ struct radeon_tex_obj { * and so on. */ GLboolean validated; + /* Minimum LOD to be used during rendering */ + unsigned minLod; + /* Miximum LOD to be used during rendering */ + unsigned maxLod; GLuint override_offset; GLboolean image_override; /* Image overridden by GLX_EXT_tfp */ diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index f635f58d6a..f01136b9d4 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -1,4 +1,5 @@ /* + * Copyright (C) 2009 Maciej Cencora. * Copyright (C) 2008 Nicolai Haehnle. * * All Rights Reserved. @@ -32,10 +33,14 @@ #include "main/simple_list.h" #include "main/texcompress.h" +#include "main/teximage.h" +/* TODO: remove if texture completeness check is removed */ +#include "main/texobj.h" +#include "radeon_texture.h" static GLuint radeon_compressed_texture_size(GLcontext *ctx, GLsizei width, GLsizei height, GLsizei depth, - GLuint mesaFormat) + gl_format mesaFormat) { GLuint size = _mesa_format_image_size(mesaFormat, width, height, depth); @@ -55,29 +60,6 @@ static GLuint radeon_compressed_texture_size(GLcontext *ctx, return size; } - -static int radeon_compressed_num_bytes(GLuint mesaFormat) -{ - int bytes = 0; - switch(mesaFormat) { - - case MESA_FORMAT_RGB_FXT1: - case MESA_FORMAT_RGBA_FXT1: - case MESA_FORMAT_RGB_DXT1: - case MESA_FORMAT_RGBA_DXT1: - bytes = 2; - break; - - case MESA_FORMAT_RGBA_DXT3: - case MESA_FORMAT_RGBA_DXT5: - bytes = 4; - default: - break; - } - - return bytes; -} - /** * Compute sizes and fill in offset and blit information for the given * image (determined by \p face and \p level). @@ -92,25 +74,24 @@ static void compute_tex_image_offset(radeonContextPtr rmesa, radeon_mipmap_tree uint32_t row_align; /* Find image size in bytes */ - if (mt->compressed) { + if (_mesa_is_format_compressed(mt->mesaFormat)) { /* TODO: Is this correct? Need test cases for compressed textures! */ row_align = rmesa->texture_compressed_row_align - 1; - lvl->rowstride = (lvl->width * mt->bpp + row_align) & ~row_align; - lvl->size = radeon_compressed_texture_size(mt->radeon->glCtx, - lvl->width, lvl->height, lvl->depth, mt->compressed); + lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align; + lvl->size = radeon_compressed_texture_size(rmesa->glCtx, lvl->width, lvl->height, lvl->depth, mt->mesaFormat); } else if (mt->target == GL_TEXTURE_RECTANGLE_NV) { row_align = rmesa->texture_rect_row_align - 1; - lvl->rowstride = (lvl->width * mt->bpp + row_align) & ~row_align; + lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align; lvl->size = lvl->rowstride * lvl->height; } else if (mt->tilebits & RADEON_TXO_MICRO_TILE) { /* tile pattern is 16 bytes x2. mipmaps stay 32 byte aligned, * though the actual offset may be different (if texture is less than * 32 bytes width) to the untiled case */ - lvl->rowstride = (lvl->width * mt->bpp * 2 + 31) & ~31; + lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) * 2 + 31) & ~31; lvl->size = lvl->rowstride * ((lvl->height + 1) / 2) * lvl->depth; } else { row_align = rmesa->texture_row_align - 1; - lvl->rowstride = (lvl->width * mt->bpp + row_align) & ~row_align; + lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align; lvl->size = lvl->rowstride * lvl->height * lvl->depth; } assert(lvl->size > 0); @@ -138,17 +119,15 @@ static GLuint minify(GLuint size, GLuint levels) static void calculate_miptree_layout_r100(radeonContextPtr rmesa, radeon_mipmap_tree *mt) { GLuint curOffset; - GLuint numLevels; GLuint i; GLuint face; - numLevels = mt->lastLevel - mt->firstLevel + 1; - assert(numLevels <= rmesa->glCtx->Const.MaxTextureLevels); + assert(mt->numLevels <= rmesa->glCtx->Const.MaxTextureLevels); curOffset = 0; for(face = 0; face < mt->faces; face++) { - for(i = 0; i < numLevels; i++) { + for(i = 0; i < mt->numLevels; i++) { mt->levels[i].width = minify(mt->width0, i); mt->levels[i].height = minify(mt->height0, i); mt->levels[i].depth = minify(mt->depth0, i); @@ -163,14 +142,12 @@ static void calculate_miptree_layout_r100(radeonContextPtr rmesa, radeon_mipmap_ static void calculate_miptree_layout_r300(radeonContextPtr rmesa, radeon_mipmap_tree *mt) { GLuint curOffset; - GLuint numLevels; GLuint i; - numLevels = mt->lastLevel - mt->firstLevel + 1; - assert(numLevels <= rmesa->glCtx->Const.MaxTextureLevels); + assert(mt->numLevels <= rmesa->glCtx->Const.MaxTextureLevels); curOffset = 0; - for(i = 0; i < numLevels; i++) { + for(i = 0; i < mt->numLevels; i++) { GLuint face; mt->levels[i].width = minify(mt->width0, i); @@ -188,27 +165,22 @@ static void calculate_miptree_layout_r300(radeonContextPtr rmesa, radeon_mipmap_ /** * Create a new mipmap tree, calculate its layout and allocate memory. */ -radeon_mipmap_tree* radeon_miptree_create(radeonContextPtr rmesa, radeonTexObj *t, - GLenum target, GLenum internal_format, GLuint firstLevel, GLuint lastLevel, - GLuint width0, GLuint height0, GLuint depth0, - GLuint bpp, GLuint tilebits, GLuint compressed) +static radeon_mipmap_tree* radeon_miptree_create(radeonContextPtr rmesa, + GLenum target, gl_format mesaFormat, GLuint baseLevel, GLuint numLevels, + GLuint width0, GLuint height0, GLuint depth0, GLuint tilebits) { radeon_mipmap_tree *mt = CALLOC_STRUCT(_radeon_mipmap_tree); - mt->radeon = rmesa; - mt->internal_format = internal_format; + mt->mesaFormat = mesaFormat; mt->refcount = 1; - mt->t = t; mt->target = target; mt->faces = (target == GL_TEXTURE_CUBE_MAP) ? 6 : 1; - mt->firstLevel = firstLevel; - mt->lastLevel = lastLevel; + mt->baseLevel = baseLevel; + mt->numLevels = numLevels; mt->width0 = width0; mt->height0 = height0; mt->depth0 = depth0; - mt->bpp = compressed ? radeon_compressed_num_bytes(compressed) : bpp; mt->tilebits = tilebits; - mt->compressed = compressed; if (rmesa->radeonScreen->chip_family >= CHIP_FAMILY_R300) calculate_miptree_layout_r300(rmesa, mt); @@ -250,34 +222,16 @@ void radeon_miptree_unreference(radeon_mipmap_tree **ptr) *ptr = 0; } - /** - * Calculate first and last mip levels for the given texture object, - * where the dimensions are taken from the given texture image at - * the given level. - * - * Note: level is the OpenGL level number, which is not necessarily the same - * as the first level that is actually present. - * - * The base level image of the given texture face must be non-null, - * or this will fail. + * Calculate min and max LOD for the given texture object. + * @param[in] tObj texture object whose LOD values to calculate + * @param[out] pminLod minimal LOD + * @param[out] pmaxLod maximal LOD */ -static void calculate_first_last_level(struct gl_texture_object *tObj, - GLuint *pfirstLevel, GLuint *plastLevel, - GLuint face, GLuint level) +static void calculate_min_max_lod(struct gl_texture_object *tObj, + unsigned *pminLod, unsigned *pmaxLod) { - const struct gl_texture_image * const baseImage = - tObj->Image[face][level]; - - assert(baseImage); - - /* These must be signed values. MinLod and MaxLod can be negative numbers, - * and having firstLevel and lastLevel as signed prevents the need for - * extra sign checks. - */ - int firstLevel; - int lastLevel; - + int minLod, maxLod; /* Yes, this looks overly complicated, but it's all needed. */ switch (tObj->Target) { @@ -288,55 +242,46 @@ static void calculate_first_last_level(struct gl_texture_object *tObj, if (tObj->MinFilter == GL_NEAREST || tObj->MinFilter == GL_LINEAR) { /* GL_NEAREST and GL_LINEAR only care about GL_TEXTURE_BASE_LEVEL. */ - firstLevel = lastLevel = tObj->BaseLevel; + minLod = maxLod = tObj->BaseLevel; } else { - firstLevel = tObj->BaseLevel + (GLint)(tObj->MinLod + 0.5); - firstLevel = MAX2(firstLevel, tObj->BaseLevel); - firstLevel = MIN2(firstLevel, level + baseImage->MaxLog2); - lastLevel = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5); - lastLevel = MAX2(lastLevel, tObj->BaseLevel); - lastLevel = MIN2(lastLevel, level + baseImage->MaxLog2); - lastLevel = MIN2(lastLevel, tObj->MaxLevel); - lastLevel = MAX2(firstLevel, lastLevel); /* need at least one level */ + minLod = tObj->BaseLevel + (GLint)(tObj->MinLod); + minLod = MAX2(minLod, tObj->BaseLevel); + minLod = MIN2(minLod, tObj->MaxLevel); + maxLod = tObj->BaseLevel + (GLint)(tObj->MaxLod + 0.5); + maxLod = MIN2(maxLod, tObj->MaxLevel); + maxLod = MIN2(maxLod, tObj->Image[0][minLod]->MaxLog2 + minLod); + maxLod = MAX2(maxLod, minLod); /* need at least one level */ } break; case GL_TEXTURE_RECTANGLE_NV: case GL_TEXTURE_4D_SGIS: - firstLevel = lastLevel = 0; + minLod = maxLod = 0; break; default: return; } /* save these values */ - *pfirstLevel = firstLevel; - *plastLevel = lastLevel; + *pminLod = minLod; + *pmaxLod = maxLod; } - /** * Checks whether the given miptree can hold the given texture image at the * given face and level. */ GLboolean radeon_miptree_matches_image(radeon_mipmap_tree *mt, - struct gl_texture_image *texImage, GLuint face, GLuint level) + struct gl_texture_image *texImage, GLuint face, GLuint mtLevel) { - GLboolean isCompressed = _mesa_is_format_compressed(texImage->TexFormat); radeon_mipmap_level *lvl; - if (face >= mt->faces || level < mt->firstLevel || level > mt->lastLevel) - return GL_FALSE; - - if (texImage->InternalFormat != mt->internal_format || - isCompressed != mt->compressed) + if (face >= mt->faces || mtLevel > mt->numLevels) return GL_FALSE; - if (!isCompressed && - !mt->compressed && - _mesa_get_format_bytes(texImage->TexFormat) != mt->bpp) + if (texImage->TexFormat != mt->mesaFormat) return GL_FALSE; - lvl = &mt->levels[level - mt->firstLevel]; + lvl = &mt->levels[mtLevel]; if (lvl->width != texImage->Width || lvl->height != texImage->Height || lvl->depth != texImage->Depth) @@ -345,64 +290,72 @@ GLboolean radeon_miptree_matches_image(radeon_mipmap_tree *mt, return GL_TRUE; } - /** * Checks whether the given miptree has the right format to store the given texture object. */ -GLboolean radeon_miptree_matches_texture(radeon_mipmap_tree *mt, struct gl_texture_object *texObj) +static GLboolean radeon_miptree_matches_texture(radeon_mipmap_tree *mt, struct gl_texture_object *texObj) { struct gl_texture_image *firstImage; - GLuint compressed; - GLuint numfaces = 1; - GLuint firstLevel, lastLevel; - GLuint texelBytes; - - calculate_first_last_level(texObj, &firstLevel, &lastLevel, 0, texObj->BaseLevel); - if (texObj->Target == GL_TEXTURE_CUBE_MAP) - numfaces = 6; - - firstImage = texObj->Image[0][firstLevel]; - compressed = _mesa_is_format_compressed(firstImage->TexFormat) ? firstImage->TexFormat : 0; - texelBytes = _mesa_get_format_bytes(firstImage->TexFormat); - - return (mt->firstLevel == firstLevel && - mt->lastLevel == lastLevel && - mt->width0 == firstImage->Width && - mt->height0 == firstImage->Height && - mt->depth0 == firstImage->Depth && - mt->compressed == compressed && - (!mt->compressed ? (mt->bpp == texelBytes) : 1)); -} + unsigned numLevels; + radeon_mipmap_level *mtBaseLevel; + if (texObj->BaseLevel < mt->baseLevel) + return GL_FALSE; + + mtBaseLevel = &mt->levels[texObj->BaseLevel - mt->baseLevel]; + firstImage = texObj->Image[0][texObj->BaseLevel]; + numLevels = MIN2(texObj->MaxLevel - texObj->BaseLevel + 1, firstImage->MaxLog2 + 1); + + if (RADEON_DEBUG & RADEON_TEXTURE) { + fprintf(stderr, "Checking if miptree %p matches texObj %p\n", mt, texObj); + fprintf(stderr, "target %d vs %d\n", mt->target, texObj->Target); + fprintf(stderr, "format %d vs %d\n", mt->mesaFormat, firstImage->TexFormat); + fprintf(stderr, "numLevels %d vs %d\n", mt->numLevels, numLevels); + fprintf(stderr, "width0 %d vs %d\n", mtBaseLevel->width, firstImage->Width); + fprintf(stderr, "height0 %d vs %d\n", mtBaseLevel->height, firstImage->Height); + fprintf(stderr, "depth0 %d vs %d\n", mtBaseLevel->depth, firstImage->Depth); + if (mt->target == texObj->Target && + mt->mesaFormat == firstImage->TexFormat && + mt->numLevels >= numLevels && + mtBaseLevel->width == firstImage->Width && + mtBaseLevel->height == firstImage->Height && + mtBaseLevel->depth == firstImage->Depth) { + fprintf(stderr, "MATCHED\n"); + } else { + fprintf(stderr, "NOT MATCHED\n"); + } + } + + return (mt->target == texObj->Target && + mt->mesaFormat == firstImage->TexFormat && + mt->numLevels >= numLevels && + mtBaseLevel->width == firstImage->Width && + mtBaseLevel->height == firstImage->Height && + mtBaseLevel->depth == firstImage->Depth); +} /** - * Try to allocate a mipmap tree for the given texture that will fit the - * given image in the given position. + * Try to allocate a mipmap tree for the given texture object. + * @param[in] rmesa radeon context + * @param[in] t radeon texture object */ -void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t, - radeon_texture_image *image, GLuint face, GLuint level) +void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t) { - GLuint compressed = _mesa_is_format_compressed(image->base.TexFormat) ? image->base.TexFormat : 0; - GLuint numfaces = 1; - GLuint firstLevel, lastLevel; - GLuint texelBytes; + struct gl_texture_object *texObj = &t->base; + struct gl_texture_image *texImg = texObj->Image[0][texObj->BaseLevel]; + GLuint numLevels; assert(!t->mt); - calculate_first_last_level(&t->base, &firstLevel, &lastLevel, face, level); - if (t->base.Target == GL_TEXTURE_CUBE_MAP) - numfaces = 6; - - if (level != firstLevel || face >= numfaces) + if (!texImg) return; - texelBytes = _mesa_get_format_bytes(image->base.TexFormat); + numLevels = MIN2(texObj->MaxLevel - texObj->BaseLevel + 1, texImg->MaxLog2 + 1); - t->mt = radeon_miptree_create(rmesa, t, t->base.Target, - image->base.InternalFormat, - firstLevel, lastLevel, - image->base.Width, image->base.Height, image->base.Depth, - texelBytes, t->tile_bits, compressed); + t->mt = radeon_miptree_create(rmesa, t->base.Target, + texImg->TexFormat, texObj->BaseLevel, + numLevels, texImg->Width, texImg->Height, + texImg->Depth, t->tile_bits); } /* Although we use the image_offset[] array to store relative offsets @@ -414,21 +367,238 @@ void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t, void radeon_miptree_depth_offsets(radeon_mipmap_tree *mt, GLuint level, GLuint *offsets) { - if (mt->target != GL_TEXTURE_3D || mt->faces == 1) - offsets[0] = 0; - else { - int i; - for (i = 0; i < 6; i++) - offsets[i] = mt->levels[level].faces[i].offset; - } + if (mt->target != GL_TEXTURE_3D || mt->faces == 1) { + offsets[0] = 0; + } else { + int i; + for (i = 0; i < 6; i++) { + offsets[i] = mt->levels[level].faces[i].offset; + } + } } GLuint radeon_miptree_image_offset(radeon_mipmap_tree *mt, GLuint face, GLuint level) { - if (mt->target == GL_TEXTURE_CUBE_MAP_ARB) - return (mt->levels[level].faces[face].offset); - else - return mt->levels[level].faces[0].offset; + if (mt->target == GL_TEXTURE_CUBE_MAP_ARB) + return (mt->levels[level].faces[face].offset); + else + return mt->levels[level].faces[0].offset; +} + +/** + * Convert radeon miptree texture level to GL texture level + * @param[in] tObj texture object whom level is to be converted + * @param[in] level radeon miptree texture level + * @return GL texture level + */ +unsigned radeon_miptree_level_to_gl_level(struct gl_texture_object *tObj, unsigned level) +{ + return level + tObj->BaseLevel; +} + +/** + * Convert GL texture level to radeon miptree texture level + * @param[in] tObj texture object whom level is to be converted + * @param[in] level GL texture level + * @return radeon miptree texture level + */ +unsigned radeon_gl_level_to_miptree_level(struct gl_texture_object *tObj, unsigned level) +{ + return level - tObj->BaseLevel; } + +/** + * Ensure that the given image is stored in the given miptree from now on. + */ +static void migrate_image_to_miptree(radeon_mipmap_tree *mt, + radeon_texture_image *image, + int face, int mtLevel) +{ + radeon_mipmap_level *dstlvl = &mt->levels[mtLevel]; + unsigned char *dest; + + assert(image->mt != mt); + assert(dstlvl->width == image->base.Width); + assert(dstlvl->height == image->base.Height); + assert(dstlvl->depth == image->base.Depth); + + radeon_bo_map(mt->bo, GL_TRUE); + dest = mt->bo->ptr + dstlvl->faces[face].offset; + + if (image->mt) { + /* Format etc. should match, so we really just need a memcpy(). + * In fact, that memcpy() could be done by the hardware in many + * cases, provided that we have a proper memory manager. + */ + assert(mt->mesaFormat == image->base.TexFormat); + + radeon_mipmap_level *srclvl = &image->mt->levels[image->mtlevel]; + + assert(srclvl->size == dstlvl->size); + assert(srclvl->rowstride == dstlvl->rowstride); + + radeon_bo_map(image->mt->bo, GL_FALSE); + + memcpy(dest, + image->mt->bo->ptr + srclvl->faces[face].offset, + dstlvl->size); + radeon_bo_unmap(image->mt->bo); + + radeon_miptree_unreference(&image->mt); + } else { + /* need to confirm this value is correct */ + if (_mesa_is_format_compressed(image->base.TexFormat)) { + unsigned size = _mesa_format_image_size(image->base.TexFormat, + image->base.Width, + image->base.Height, + image->base.Depth); + memcpy(dest, image->base.Data, size); + } else { + uint32_t srcrowstride; + uint32_t height; + + height = image->base.Height * image->base.Depth; + srcrowstride = image->base.Width * _mesa_get_format_bytes(image->base.TexFormat); + copy_rows(dest, dstlvl->rowstride, image->base.Data, srcrowstride, + height, srcrowstride); + } + + _mesa_free_texmemory(image->base.Data); + image->base.Data = 0; + } + + radeon_bo_unmap(mt->bo); + + radeon_miptree_reference(mt, &image->mt); + image->mtface = face; + image->mtlevel = mtLevel; +} + +/** + * Filter matching miptrees, and select one with the most of data. + * @param[in] texObj radeon texture object + * @param[in] firstLevel first texture level to check + * @param[in] lastLevel last texture level to check + */ +static radeon_mipmap_tree * get_biggest_matching_miptree(radeonTexObj *texObj, + unsigned firstLevel, + unsigned lastLevel) +{ + const unsigned numLevels = lastLevel - firstLevel; + unsigned *mtSizes = calloc(numLevels, sizeof(unsigned)); + radeon_mipmap_tree **mts = calloc(numLevels, sizeof(radeon_mipmap_tree *)); + unsigned mtCount = 0; + unsigned maxMtIndex = 0; + + for (unsigned level = firstLevel; level <= lastLevel; ++level) { + radeon_texture_image *img = get_radeon_texture_image(texObj->base.Image[0][level]); + unsigned found = 0; + // TODO: why this hack?? + if (!img) + break; + + if (!img->mt || !radeon_miptree_matches_texture(img->mt, &texObj->base)) + continue; + + for (int i = 0; i < mtCount; ++i) { + if (mts[i] == img->mt) { + found = 1; + mtSizes[i] += img->mt->levels[img->mtlevel].size; + break; + } + } + + if (!found) { + mtSizes[mtCount] += img->mt->levels[img->mtlevel].size; + mts[mtCount++] = img->mt; + mtCount++; + } + } + + if (mtCount == 0) { + return NULL; + } + + for (int i = 1; i < mtCount; ++i) { + if (mtSizes[i] > mtSizes[maxMtIndex]) { + maxMtIndex = i; + } + } + + return mts[maxMtIndex]; +} + +/** + * Validate texture mipmap tree. + * If individual images are stored in different mipmap trees + * use the mipmap tree that has the most of the correct data. + */ +int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *texObj) +{ + radeonContextPtr rmesa = RADEON_CONTEXT(ctx); + radeonTexObj *t = radeon_tex_obj(texObj); + + if (t->validated || t->image_override) { + return GL_TRUE; + } + + if (texObj->Image[0][texObj->BaseLevel]->Border > 0) + return GL_FALSE; + + /* TODO: is this really necessary? */ + _mesa_test_texobj_completeness(rmesa->glCtx, texObj); + assert(texObj->_Complete); + + calculate_min_max_lod(&t->base, &t->minLod, &t->maxLod); + + if (RADEON_DEBUG & RADEON_TEXTURE) + fprintf(stderr, "%s: Validating texture %p now, minLod = %d, maxLod = %d\n", + __FUNCTION__, texObj ,t->minLod, t->maxLod); + + radeon_mipmap_tree *dst_miptree; + dst_miptree = get_biggest_matching_miptree(t, t->minLod, t->maxLod); + + if (!dst_miptree) { + radeon_miptree_unreference(&t->mt); + radeon_try_alloc_miptree(rmesa, t); + dst_miptree = t->mt; + } + + const unsigned faces = texObj->Target == GL_TEXTURE_CUBE_MAP ? 6 : 1; + unsigned face, level; + radeon_texture_image *img; + /* Validate only the levels that will actually be used during rendering */ + for (face = 0; face < faces; ++face) { + for (level = t->minLod; level <= t->maxLod; ++level) { + img = get_radeon_texture_image(texObj->Image[face][level]); + + if (RADEON_DEBUG & RADEON_TEXTURE) { + fprintf(stderr, "Checking image level %d, face %d, mt %p ... ", level, face, img->mt); + } + + if (img->mt != dst_miptree) { + if (RADEON_DEBUG & RADEON_TEXTURE) { + fprintf(stderr, "MIGRATING\n"); + } + migrate_image_to_miptree(dst_miptree, img, face, radeon_gl_level_to_miptree_level(texObj, level)); + } else if (RADEON_DEBUG & RADEON_TEXTURE) { + fprintf(stderr, "OK\n"); + } + } + } + + t->validated = GL_TRUE; + + return GL_TRUE; +} + +uint32_t get_base_teximage_offset(radeonTexObj *texObj) +{ + if (!texObj->mt) { + return 0; + } else { + return radeon_miptree_image_offset(texObj->mt, 0, texObj->minLod); + } +} \ No newline at end of file diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h index 57299ceafa..28b8485095 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h @@ -59,44 +59,38 @@ struct _radeon_mipmap_level { * changed. */ struct _radeon_mipmap_tree { - radeonContextPtr radeon; - radeonTexObj *t; struct radeon_bo *bo; GLuint refcount; GLuint totalsize; /** total size of the miptree, in bytes */ GLenum target; /** GL_TEXTURE_xxx */ - GLenum internal_format; + GLenum mesaFormat; /** MESA_FORMAT_xxx */ GLuint faces; /** # of faces: 6 for cubemaps, 1 otherwise */ - GLuint firstLevel; /** First mip level stored in this mipmap tree */ - GLuint lastLevel; /** Last mip level stored in this mipmap tree */ + GLuint baseLevel; /** gl_texture_object->baseLevel it was created for */ + GLuint numLevels; /** Number of mip levels stored in this mipmap tree */ GLuint width0; /** Width of firstLevel image */ GLuint height0; /** Height of firstLevel image */ GLuint depth0; /** Depth of firstLevel image */ - GLuint bpp; /** Bytes per texel */ GLuint tilebits; /** RADEON_TXO_xxx_TILE */ - GLuint compressed; /** MESA_FORMAT_xxx indicating a compressed format, or 0 if uncompressed */ radeon_mipmap_level levels[RADEON_MIPTREE_MAX_TEXTURE_LEVELS]; }; -radeon_mipmap_tree* radeon_miptree_create(radeonContextPtr rmesa, radeonTexObj *t, - GLenum target, GLenum internal_format, GLuint firstLevel, GLuint lastLevel, - GLuint width0, GLuint height0, GLuint depth0, - GLuint bpp, GLuint tilebits, GLuint compressed); - void radeon_miptree_reference(radeon_mipmap_tree *mt, radeon_mipmap_tree **ptr); void radeon_miptree_unreference(radeon_mipmap_tree **ptr); GLboolean radeon_miptree_matches_image(radeon_mipmap_tree *mt, struct gl_texture_image *texImage, GLuint face, GLuint level); -GLboolean radeon_miptree_matches_texture(radeon_mipmap_tree *mt, struct gl_texture_object *texObj); -void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t, - radeon_texture_image *texImage, GLuint face, GLuint level); +void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t); GLuint radeon_miptree_image_offset(radeon_mipmap_tree *mt, GLuint face, GLuint level); void radeon_miptree_depth_offsets(radeon_mipmap_tree *mt, GLuint level, GLuint *offsets); + +unsigned radeon_miptree_level_to_gl_level(struct gl_texture_object *tObj, unsigned level); +unsigned radeon_gl_level_to_miptree_level(struct gl_texture_object *tObj, unsigned level); + +uint32_t get_base_teximage_offset(radeonTexObj *texObj); #endif /* __RADEON_MIPMAP_TREE_H_ */ diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index c093d1283d..6f11f1fa4a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -1,4 +1,5 @@ /* + * Copyright (C) 2009 Maciej Cencora. * Copyright (C) 2008 Nicolai Haehnle. * Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. * @@ -46,7 +47,7 @@ #include "radeon_mipmap_tree.h" -static void copy_rows(void* dst, GLuint dststride, const void* src, GLuint srcstride, +void copy_rows(void* dst, GLuint dststride, const void* src, GLuint srcstride, GLuint numrows, GLuint rowsize) { assert(rowsize <= dststride); @@ -107,7 +108,7 @@ static void teximage_set_map_data(radeon_texture_image *image) lvl = &image->mt->levels[image->mtlevel]; image->base.Data = image->mt->bo->ptr + lvl->faces[image->mtface].offset; - image->base.RowStride = lvl->rowstride / image->mt->bpp; + image->base.RowStride = lvl->rowstride / _mesa_get_format_bytes(image->base.TexFormat); } @@ -173,7 +174,7 @@ void radeonMapTexture(GLcontext *ctx, struct gl_texture_object *texObj) radeon_bo_map(t->mt->bo, GL_FALSE); for(face = 0; face < t->mt->faces; ++face) { - for(level = t->mt->firstLevel; level <= t->mt->lastLevel; ++level) + for(level = t->minLod; level <= t->maxLod; ++level) teximage_set_map_data(get_radeon_texture_image(texObj->Image[face][level])); } } @@ -190,7 +191,7 @@ void radeonUnmapTexture(GLcontext *ctx, struct gl_texture_object *texObj) return; for(face = 0; face < t->mt->faces; ++face) { - for(level = t->mt->firstLevel; level <= t->mt->lastLevel; ++level) + for(level = t->minLod; level <= t->maxLod; ++level) texObj->Image[face][level]->Data = 0; } radeon_bo_unmap(t->mt->bo); @@ -508,6 +509,31 @@ gl_format radeonChooseTextureFormat(GLcontext * ctx, return MESA_FORMAT_NONE; /* never get here */ } +static void teximage_assign_miptree(radeonContextPtr rmesa, + struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + unsigned face, + unsigned level) +{ + radeonTexObj *t = radeon_tex_obj(texObj); + radeon_texture_image* image = get_radeon_texture_image(texImage); + + /* Try using current miptree, or create new if there isn't any */ + if (!t->mt || !radeon_miptree_matches_image(t->mt, texImage, face, + radeon_gl_level_to_miptree_level(texObj, level))) { + radeon_miptree_unreference(&t->mt); + radeon_try_alloc_miptree(rmesa, t); + } + + /* Miptree alocation may have failed, + * when there was no image for baselevel specified */ + if (t->mt) { + image->mtface = face; + image->mtlevel = radeon_gl_level_to_miptree_level(texObj, level); + radeon_miptree_reference(t->mt, &image->mt); + } +} + static GLuint * allocate_image_offsets(GLcontext *ctx, unsigned alignedWidth, unsigned height, @@ -543,16 +569,20 @@ static void radeon_store_teximage(GLcontext* ctx, int dims, struct gl_texture_image *texImage, int compressed) { + radeonTexObj *t = radeon_tex_obj(texObj); radeon_texture_image* image = get_radeon_texture_image(texImage); - GLint dstRowStride; + GLuint dstRowStride; GLuint *dstImageOffsets; if (image->mt) { - radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel]; - dstRowStride = lvl->rowstride; + dstRowStride = image->mt->levels[image->mtlevel].rowstride; + } else if (t->bo) { + /* TFP case */ + /* TODO */ + assert(0); } else { - dstRowStride = texImage->RowStride * _mesa_get_format_bytes(texImage->TexFormat); + dstRowStride = _mesa_format_row_stride(texImage->TexFormat, width); } if (dims == 3) { @@ -577,8 +607,10 @@ static void radeon_store_teximage(GLcontext* ctx, int dims, texImage->Width, texImage->Data); } else { - uint32_t blocks_x = dstRowStride / (image->mt->bpp * 4); - img_start = texImage->Data + image->mt->bpp * 4 * (blocks_x * (yoffset / 4) + xoffset / 4); + uint32_t blocks_x, block_width, block_height; + _mesa_get_format_block_size(image->mt->mesaFormat, &block_width, &block_height); + blocks_x = dstRowStride / block_width; + img_start = texImage->Data + _mesa_get_format_bytes(image->mt->mesaFormat) * 4 * (blocks_x * (yoffset / 4) + xoffset / 4); } srcRowStride = _mesa_format_row_stride(texImage->TexFormat, width); bytesPerRow = srcRowStride; @@ -624,10 +656,8 @@ static void radeon_teximage( radeonContextPtr rmesa = RADEON_CONTEXT(ctx); radeonTexObj* t = radeon_tex_obj(texObj); radeon_texture_image* image = get_radeon_texture_image(texImage); - GLuint dstRowStride; GLint postConvWidth = width; GLint postConvHeight = height; - GLuint texelBytes; GLuint face = radeon_face_for_target(target); { @@ -645,51 +675,30 @@ static void radeon_teximage( &postConvHeight); } - if (_mesa_is_format_compressed(texImage->TexFormat)) { - texelBytes = 0; - } else { - texelBytes = _mesa_get_format_bytes(texImage->TexFormat); + if (!_mesa_is_format_compressed(texImage->TexFormat)) { + GLuint texelBytes = _mesa_get_format_bytes(texImage->TexFormat); /* Minimum pitch of 32 bytes */ if (postConvWidth * texelBytes < 32) { - postConvWidth = 32 / texelBytes; - texImage->RowStride = postConvWidth; + postConvWidth = 32 / texelBytes; + texImage->RowStride = postConvWidth; } - if (!image->mt) { + if (!image->mt) { assert(texImage->RowStride == postConvWidth); } } - /* Allocate memory for image */ - radeonFreeTexImageData(ctx, texImage); /* Mesa core only clears texImage->Data but not image->mt */ + /* Mesa core only clears texImage->Data but not image->mt */ + radeonFreeTexImageData(ctx, texImage); - if (t->mt && - t->mt->firstLevel == level && - t->mt->lastLevel == level && - t->mt->target != GL_TEXTURE_CUBE_MAP_ARB && - !radeon_miptree_matches_image(t->mt, texImage, face, level)) { - radeon_miptree_unreference(&t->mt); - } - - if (!t->mt) - radeon_try_alloc_miptree(rmesa, t, image, face, level); - if (t->mt && radeon_miptree_matches_image(t->mt, texImage, face, level)) { - radeon_mipmap_level *lvl; - image->mtlevel = level - t->mt->firstLevel; - image->mtface = face; - radeon_miptree_reference(t->mt, &image->mt); - lvl = &image->mt->levels[image->mtlevel]; - dstRowStride = lvl->rowstride; - } else { - int size; - if (_mesa_is_format_compressed(texImage->TexFormat)) { - size = _mesa_format_image_size(texImage->TexFormat, - texImage->Width, - texImage->Height, - texImage->Depth); - } else { - size = texImage->Width * texImage->Height * texImage->Depth * _mesa_get_format_bytes(texImage->TexFormat); + if (!t->bo) { + teximage_assign_miptree(rmesa, texObj, texImage, face, level); + if (!t->mt) { + int size = _mesa_format_image_size(texImage->TexFormat, + texImage->Width, + texImage->Height, + texImage->Depth); + texImage->Data = _mesa_alloc_texmemory(size); } - texImage->Data = _mesa_alloc_texmemory(size); } /* Upload texture image; note that the spec allows pixels to be NULL */ @@ -793,10 +802,10 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve t->validated = GL_FALSE; if (compressed) { pixels = _mesa_validate_pbo_compressed_teximage( - ctx, imageSize, pixels, packing, "glCompressedTexImage"); + ctx, imageSize, pixels, packing, "glCompressedTexSubImage"); } else { pixels = _mesa_validate_pbo_teximage(ctx, dims, - width, height, depth, format, type, pixels, packing, "glTexSubImage1D"); + width, height, depth, format, type, pixels, packing, "glTexSubImage"); } if (pixels) { @@ -865,140 +874,6 @@ void radeonTexSubImage3D(GLcontext * ctx, GLenum target, GLint level, format, type, pixels, packing, texObj, texImage, 0); } - - -/** - * Ensure that the given image is stored in the given miptree from now on. - */ -static void migrate_image_to_miptree(radeon_mipmap_tree *mt, radeon_texture_image *image, int face, int level) -{ - radeon_mipmap_level *dstlvl = &mt->levels[level - mt->firstLevel]; - unsigned char *dest; - - assert(image->mt != mt); - assert(dstlvl->width == image->base.Width); - assert(dstlvl->height == image->base.Height); - assert(dstlvl->depth == image->base.Depth); - - - radeon_bo_map(mt->bo, GL_TRUE); - dest = mt->bo->ptr + dstlvl->faces[face].offset; - - if (image->mt) { - /* Format etc. should match, so we really just need a memcpy(). - * In fact, that memcpy() could be done by the hardware in many - * cases, provided that we have a proper memory manager. - */ - radeon_mipmap_level *srclvl = &image->mt->levels[image->mtlevel-image->mt->firstLevel]; - - assert(srclvl->size == dstlvl->size); - assert(srclvl->rowstride == dstlvl->rowstride); - - radeon_bo_map(image->mt->bo, GL_FALSE); - - memcpy(dest, - image->mt->bo->ptr + srclvl->faces[face].offset, - dstlvl->size); - radeon_bo_unmap(image->mt->bo); - - radeon_miptree_unreference(&image->mt); - } else { - uint32_t srcrowstride; - uint32_t height; - /* need to confirm this value is correct */ - if (mt->compressed) { - height = (image->base.Height + 3) / 4; - srcrowstride = _mesa_format_row_stride(image->base.TexFormat, image->base.Width); - } else { - height = image->base.Height * image->base.Depth; - srcrowstride = image->base.Width * _mesa_get_format_bytes(image->base.TexFormat); - } - -// if (mt->tilebits) -// WARN_ONCE("%s: tiling not supported yet", __FUNCTION__); - - copy_rows(dest, dstlvl->rowstride, image->base.Data, srcrowstride, - height, srcrowstride); - - _mesa_free_texmemory(image->base.Data); - image->base.Data = 0; - } - - radeon_bo_unmap(mt->bo); - - image->mtface = face; - image->mtlevel = level; - radeon_miptree_reference(mt, &image->mt); -} - -int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *texObj) -{ - radeonContextPtr rmesa = RADEON_CONTEXT(ctx); - radeonTexObj *t = radeon_tex_obj(texObj); - radeon_texture_image *baseimage = get_radeon_texture_image(texObj->Image[0][texObj->BaseLevel]); - int face, level; - - if (t->validated || t->image_override) - return GL_TRUE; - - if (RADEON_DEBUG & RADEON_TEXTURE) - fprintf(stderr, "%s: Validating texture %p now\n", __FUNCTION__, texObj); - - if (baseimage->base.Border > 0) - return GL_FALSE; - - /* Ensure a matching miptree exists. - * - * Differing mipmap trees can result when the app uses TexImage to - * change texture dimensions. - * - * Prefer to use base image's miptree if it - * exists, since that most likely contains more valid data (remember - * that the base level is usually significantly larger than the rest - * of the miptree, so cubemaps are the only possible exception). - */ - if (baseimage->mt && - baseimage->mt != t->mt && - radeon_miptree_matches_texture(baseimage->mt, &t->base)) { - radeon_miptree_unreference(&t->mt); - radeon_miptree_reference(baseimage->mt, &t->mt); - } else if (t->mt && !radeon_miptree_matches_texture(t->mt, &t->base)) { - radeon_miptree_unreference(&t->mt); - } - - if (!t->mt) { - if (RADEON_DEBUG & RADEON_TEXTURE) - fprintf(stderr, " Allocate new miptree\n"); - radeon_try_alloc_miptree(rmesa, t, baseimage, 0, texObj->BaseLevel); - if (!t->mt) { - _mesa_problem(ctx, "radeon_validate_texture failed to alloc miptree"); - return GL_FALSE; - } - } - - /* Ensure all images are stored in the single main miptree */ - for(face = 0; face < t->mt->faces; ++face) { - for(level = t->mt->firstLevel; level <= t->mt->lastLevel; ++level) { - radeon_texture_image *image = get_radeon_texture_image(texObj->Image[face][level]); - if (RADEON_DEBUG & RADEON_TEXTURE) - fprintf(stderr, " face %i, level %i... %p vs %p ", face, level, t->mt, image->mt); - if (t->mt == image->mt || (!image->mt && !image->base.Data)) { - if (RADEON_DEBUG & RADEON_TEXTURE) - fprintf(stderr, "OK\n"); - - continue; - } - - if (RADEON_DEBUG & RADEON_TEXTURE) - fprintf(stderr, "migrating\n"); - migrate_image_to_miptree(t->mt, image, face, level); - } - } - - return GL_TRUE; -} - - /** * Need to map texture image into memory before copying image data, * then unmap it. diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.h b/src/mesa/drivers/dri/radeon/radeon_texture.h index 8995546d77..906daf12d0 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.h +++ b/src/mesa/drivers/dri/radeon/radeon_texture.h @@ -33,7 +33,8 @@ #include "main/formats.h" - +void copy_rows(void* dst, GLuint dststride, const void* src, GLuint srcstride, + GLuint numrows, GLuint rowsize); struct gl_texture_image *radeonNewTextureImage(GLcontext *ctx); void radeonFreeTexImageData(GLcontext *ctx, struct gl_texture_image *timage); -- cgit v1.2.3 From ad83aeccdc54beecf25f217e2dd24c8edf6d6767 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 14 Nov 2009 18:11:16 +0100 Subject: radeon: return false on texture validation if texture isn't complete --- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index f01136b9d4..0497fa7db5 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -34,7 +34,6 @@ #include "main/simple_list.h" #include "main/texcompress.h" #include "main/teximage.h" -/* TODO: remove if texture completeness check is removed */ #include "main/texobj.h" #include "radeon_texture.h" @@ -547,9 +546,10 @@ int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *t if (texObj->Image[0][texObj->BaseLevel]->Border > 0) return GL_FALSE; - /* TODO: is this really necessary? */ _mesa_test_texobj_completeness(rmesa->glCtx, texObj); - assert(texObj->_Complete); + if (!texObj->_Complete) { + return GL_FALSE; + } calculate_min_max_lod(&t->base, &t->minLod, &t->maxLod); -- cgit v1.2.3 From ed9c4933af6fb58269f1efc7c826cb6a5fd81d38 Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Thu, 5 Nov 2009 19:07:19 +0100 Subject: nv10: Fix build for the last nouveau_class.h changes. Signed-off-by: Francisco Jerez Signed-off-by: Pekka Paalanen --- src/gallium/drivers/nv10/nv10_context.c | 2 +- src/gallium/drivers/nv10/nv10_prim_vbuf.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv10/nv10_context.c b/src/gallium/drivers/nv10/nv10_context.c index 933176fc32..65a22b175e 100644 --- a/src/gallium/drivers/nv10/nv10_context.c +++ b/src/gallium/drivers/nv10/nv10_context.c @@ -243,7 +243,7 @@ static void nv10_init_hwctx(struct nv10_context *nv10) OUT_RING (0.0); OUT_RINGf (16777216.0); - BEGIN_RING(celsius, NV10TCL_VIEWPORT_SCALE_X, 4); + BEGIN_RING(celsius, NV10TCL_VIEWPORT_TRANSLATE_X, 4); OUT_RINGf (-2048.0); OUT_RINGf (-2048.0); OUT_RINGf (16777215.0 * 0.5); diff --git a/src/gallium/drivers/nv10/nv10_prim_vbuf.c b/src/gallium/drivers/nv10/nv10_prim_vbuf.c index 1806d5f8cc..7ba9777a22 100644 --- a/src/gallium/drivers/nv10/nv10_prim_vbuf.c +++ b/src/gallium/drivers/nv10/nv10_prim_vbuf.c @@ -69,9 +69,9 @@ void nv10_vtxbuf_bind( struct nv10_context* nv10 ) { int i; for(i = 0; i < 8; i++) { - BEGIN_RING(celsius, NV10TCL_VERTEX_ARRAY_ATTRIB_OFFSET(i), 1); + BEGIN_RING(celsius, NV10TCL_VTXBUF_ADDRESS(i), 1); OUT_RING(0/*nv10->vtxbuf*/); - BEGIN_RING(celsius, NV10TCL_VERTEX_ARRAY_ATTRIB_FORMAT(i) ,1); + BEGIN_RING(celsius, NV10TCL_VTXFMT(i), 1); OUT_RING(0/*XXX*/); } } -- cgit v1.2.3 From abefd7dcdf28c90454b59faaf9401fa6e6c6f526 Mon Sep 17 00:00:00 2001 From: Francisco Jerez Date: Sun, 15 Nov 2009 14:49:02 +0100 Subject: nv20: Fix build for the last nouveau_class.h changes. Signed-off-by: Francisco Jerez Signed-off-by: Pekka Paalanen --- src/gallium/drivers/nv20/nv20_context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv20/nv20_context.c b/src/gallium/drivers/nv20/nv20_context.c index 9a48739661..276db8b57b 100644 --- a/src/gallium/drivers/nv20/nv20_context.c +++ b/src/gallium/drivers/nv20/nv20_context.c @@ -360,13 +360,13 @@ static void nv20_init_hwctx(struct nv20_context *nv20) OUT_RINGf (0.0); OUT_RINGf (16777216.0); /* [0, 1] scaled approx to [0, 2^24] */ - BEGIN_RING(kelvin, NV20TCL_VIEWPORT_SCALE0_X, 4); + BEGIN_RING(kelvin, NV20TCL_VIEWPORT_TRANSLATE_X, 4); OUT_RINGf (0.0); /* x-offset, w/2 + 1.031250 */ OUT_RINGf (0.0); /* y-offset, h/2 + 0.030762 */ OUT_RINGf (0.0); OUT_RINGf (16777215.0); - BEGIN_RING(kelvin, NV20TCL_VIEWPORT_SCALE1_X, 4); + BEGIN_RING(kelvin, NV20TCL_VIEWPORT_SCALE_X, 4); OUT_RINGf (0.0); /* no effect?, w/2 */ OUT_RINGf (0.0); /* no effect?, h/2 */ OUT_RINGf (16777215.0 * 0.5); -- cgit v1.2.3 From b44b70dc114ddcfb4d359759928df4d7b9efaafb Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sat, 14 Nov 2009 19:46:45 -0800 Subject: mesa/st: don't calculate unused vs input semantic tags --- src/mesa/state_tracker/st_program.c | 71 ++----------------------------------- 1 file changed, 2 insertions(+), 69 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index a9be80ce8f..b6c9e7463a 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -69,8 +69,6 @@ st_translate_vertex_program(struct st_context *st, GLuint attr, i; GLuint num_generic = 0; - ubyte vs_input_semantic_name[PIPE_MAX_SHADER_INPUTS]; - ubyte vs_input_semantic_index[PIPE_MAX_SHADER_INPUTS]; uint vs_num_inputs = 0; ubyte vs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; @@ -100,71 +98,6 @@ st_translate_vertex_program(struct st_context *st, stvp->input_to_index[attr] = slot; stvp->index_to_input[slot] = attr; - switch (attr) { - case VERT_ATTRIB_POS: - vs_input_semantic_name[slot] = TGSI_SEMANTIC_POSITION; - vs_input_semantic_index[slot] = 0; - break; - case VERT_ATTRIB_WEIGHT: - /* fall-through */ - case VERT_ATTRIB_NORMAL: - /* just label as a generic */ - vs_input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - vs_input_semantic_index[slot] = 0; - break; - case VERT_ATTRIB_COLOR0: - vs_input_semantic_name[slot] = TGSI_SEMANTIC_COLOR; - vs_input_semantic_index[slot] = 0; - break; - case VERT_ATTRIB_COLOR1: - vs_input_semantic_name[slot] = TGSI_SEMANTIC_COLOR; - vs_input_semantic_index[slot] = 1; - break; - case VERT_ATTRIB_FOG: - vs_input_semantic_name[slot] = TGSI_SEMANTIC_FOG; - vs_input_semantic_index[slot] = 0; - break; - case VERT_ATTRIB_POINT_SIZE: - vs_input_semantic_name[slot] = TGSI_SEMANTIC_PSIZE; - vs_input_semantic_index[slot] = 0; - break; - case VERT_ATTRIB_TEX0: - case VERT_ATTRIB_TEX1: - case VERT_ATTRIB_TEX2: - case VERT_ATTRIB_TEX3: - case VERT_ATTRIB_TEX4: - case VERT_ATTRIB_TEX5: - case VERT_ATTRIB_TEX6: - case VERT_ATTRIB_TEX7: - assert(slot < Elements(vs_input_semantic_name)); - vs_input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - vs_input_semantic_index[slot] = num_generic++; - break; - case VERT_ATTRIB_GENERIC0: - case VERT_ATTRIB_GENERIC1: - case VERT_ATTRIB_GENERIC2: - case VERT_ATTRIB_GENERIC3: - case VERT_ATTRIB_GENERIC4: - case VERT_ATTRIB_GENERIC5: - case VERT_ATTRIB_GENERIC6: - case VERT_ATTRIB_GENERIC7: - case VERT_ATTRIB_GENERIC8: - case VERT_ATTRIB_GENERIC9: - case VERT_ATTRIB_GENERIC10: - case VERT_ATTRIB_GENERIC11: - case VERT_ATTRIB_GENERIC12: - case VERT_ATTRIB_GENERIC13: - case VERT_ATTRIB_GENERIC14: - case VERT_ATTRIB_GENERIC15: - assert(attr < VERT_ATTRIB_MAX); - assert(slot < Elements(vs_input_semantic_name)); - vs_input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - vs_input_semantic_index[slot] = num_generic++; - break; - default: - assert(0); - } - input_flags[slot] = stvp->Base.Base.InputFlags[attr]; } } @@ -330,8 +263,8 @@ st_translate_vertex_program(struct st_context *st, /* inputs */ vs_num_inputs, stvp->input_to_index, - vs_input_semantic_name, - vs_input_semantic_index, + NULL, /* input semantic name */ + NULL, /* input semantic index */ NULL, input_flags, /* outputs */ -- cgit v1.2.3 From 0ffdd1c1e897c448cbc359aea3e3a3ba098bbfe5 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sat, 14 Nov 2009 19:48:42 -0800 Subject: mesa/st: don't calculate unused input_flags data --- src/mesa/state_tracker/st_mesa_to_tgsi.c | 1 - src/mesa/state_tracker/st_mesa_to_tgsi.h | 1 - src/mesa/state_tracker/st_program.c | 16 ++-------------- 3 files changed, 2 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 3d6c215819..81f02d01e9 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -704,7 +704,6 @@ st_translate_mesa_program( const ubyte inputSemanticName[], const ubyte inputSemanticIndex[], const GLuint interpMode[], - const GLbitfield inputFlags[], GLuint numOutputs, const GLuint outputMapping[], const ubyte outputSemanticName[], diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.h b/src/mesa/state_tracker/st_mesa_to_tgsi.h index c0d1ff59e1..384831762d 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.h +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.h @@ -49,7 +49,6 @@ st_translate_mesa_program( const ubyte inputSemanticName[], const ubyte inputSemanticIndex[], const GLuint interpMode[], - const GLbitfield inputFlags[], GLuint numOutputs, const GLuint outputMapping[], const ubyte outputSemanticName[], diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index b6c9e7463a..fd1b213eb8 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -75,11 +75,9 @@ st_translate_vertex_program(struct st_context *st, ubyte vs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS]; uint vs_num_outputs = 0; - GLbitfield input_flags[MAX_PROGRAM_INPUTS]; GLbitfield output_flags[MAX_PROGRAM_OUTPUTS]; // memset(&vs, 0, sizeof(vs)); - memset(input_flags, 0, sizeof(input_flags)); memset(output_flags, 0, sizeof(output_flags)); if (stvp->Base.IsPositionInvariant) @@ -91,14 +89,10 @@ st_translate_vertex_program(struct st_context *st, */ for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { if (stvp->Base.Base.InputsRead & (1 << attr)) { - const GLuint slot = vs_num_inputs; + stvp->input_to_index[attr] = vs_num_inputs; + stvp->index_to_input[vs_num_inputs] = attr; vs_num_inputs++; - - stvp->input_to_index[attr] = slot; - stvp->index_to_input[slot] = attr; - - input_flags[slot] = stvp->Base.Base.InputFlags[attr]; } } @@ -266,7 +260,6 @@ st_translate_vertex_program(struct st_context *st, NULL, /* input semantic name */ NULL, /* input semantic index */ NULL, - input_flags, /* outputs */ vs_num_outputs, outputMapping, @@ -316,11 +309,9 @@ st_translate_fragment_program(struct st_context *st, ubyte fs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS]; uint fs_num_outputs = 0; - GLbitfield input_flags[MAX_PROGRAM_INPUTS]; GLbitfield output_flags[MAX_PROGRAM_OUTPUTS]; // memset(&fs, 0, sizeof(fs)); - memset(input_flags, 0, sizeof(input_flags)); memset(output_flags, 0, sizeof(output_flags)); /* which vertex output goes to the first fragment input: */ @@ -392,8 +383,6 @@ st_translate_fragment_program(struct st_context *st, stfp->input_semantic_index[slot] = num_generic++; interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; } - - input_flags[slot] = stfp->Base.Base.InputFlags[attr]; } } @@ -451,7 +440,6 @@ st_translate_fragment_program(struct st_context *st, stfp->input_semantic_name, stfp->input_semantic_index, interpMode, - input_flags, /* outputs */ fs_num_outputs, outputMapping, -- cgit v1.2.3 From 9953fe4cb48b02a0d75735b88173f0ed170a77f2 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sat, 14 Nov 2009 19:50:45 -0800 Subject: mesa/st: don't calculate unused output_flags data either --- src/mesa/state_tracker/st_mesa_to_tgsi.c | 3 +-- src/mesa/state_tracker/st_mesa_to_tgsi.h | 3 +-- src/mesa/state_tracker/st_program.c | 22 ++-------------------- 3 files changed, 4 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 81f02d01e9..d84832f539 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -707,8 +707,7 @@ st_translate_mesa_program( GLuint numOutputs, const GLuint outputMapping[], const ubyte outputSemanticName[], - const ubyte outputSemanticIndex[], - const GLbitfield outputFlags[] ) + const ubyte outputSemanticIndex[] ) { struct st_translate translate, *t; struct ureg_program *ureg; diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.h b/src/mesa/state_tracker/st_mesa_to_tgsi.h index 384831762d..dc0362fe79 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.h +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.h @@ -52,8 +52,7 @@ st_translate_mesa_program( GLuint numOutputs, const GLuint outputMapping[], const ubyte outputSemanticName[], - const ubyte outputSemanticIndex[], - const GLbitfield outputFlags[] ); + const ubyte outputSemanticIndex[] ); void st_free_tokens(const struct tgsi_token *tokens); diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index fd1b213eb8..5450b59a2d 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -75,11 +75,6 @@ st_translate_vertex_program(struct st_context *st, ubyte vs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS]; uint vs_num_outputs = 0; - GLbitfield output_flags[MAX_PROGRAM_OUTPUTS]; - -// memset(&vs, 0, sizeof(vs)); - memset(output_flags, 0, sizeof(output_flags)); - if (stvp->Base.IsPositionInvariant) _mesa_insert_mvp_code(st->ctx, &stvp->Base); @@ -115,7 +110,6 @@ st_translate_vertex_program(struct st_context *st, assert(i < Elements(vs_output_semantic_name)); vs_output_semantic_name[i] = TGSI_SEMANTIC_GENERIC; vs_output_semantic_index[i] = 0; - output_flags[i] = 0x0; } num_generic = 0; @@ -201,9 +195,6 @@ st_translate_vertex_program(struct st_context *st, vs_output_semantic_index[slot] = num_generic++; } } - - assert(slot < Elements(output_flags)); - output_flags[slot] = stvp->Base.Base.OutputFlags[attr]; } } @@ -264,8 +255,7 @@ st_translate_vertex_program(struct st_context *st, vs_num_outputs, outputMapping, vs_output_semantic_name, - vs_output_semantic_index, - output_flags ); + vs_output_semantic_index ); stvp->num_inputs = vs_num_inputs; stvp->driver_shader = pipe->create_vs_state(pipe, &stvp->state); @@ -309,11 +299,6 @@ st_translate_fragment_program(struct st_context *st, ubyte fs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS]; uint fs_num_outputs = 0; - GLbitfield output_flags[MAX_PROGRAM_OUTPUTS]; - -// memset(&fs, 0, sizeof(fs)); - memset(output_flags, 0, sizeof(output_flags)); - /* which vertex output goes to the first fragment input: */ if (inputsRead & FRAG_BIT_WPOS) vslot = 0; @@ -420,8 +405,6 @@ st_translate_fragment_program(struct st_context *st, break; } - output_flags[fs_num_outputs] = stfp->Base.Base.OutputFlags[attr]; - fs_num_outputs++; } } @@ -444,8 +427,7 @@ st_translate_fragment_program(struct st_context *st, fs_num_outputs, outputMapping, fs_output_semantic_name, - fs_output_semantic_index, - output_flags ); + fs_output_semantic_index ); stfp->driver_shader = pipe->create_fs_state(pipe, &stfp->state); -- cgit v1.2.3 From 1454f20a991ddda35f1a2ffda953012078b407ba Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 15 Nov 2009 10:26:35 -0800 Subject: mesa/st: emit tgsi vertex shader directly for drawpixels One of several cases where we build mesa shaders and then translate them to tgsi. Many of those cases it's because we're combining two mesa programs and there are helpers for that, but in this case at least can go straight to tgsi. --- src/mesa/state_tracker/st_cb_drawpixels.c | 124 +++++++++++------------------- 1 file changed, 47 insertions(+), 77 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 1d33e81c2c..13e454b7a7 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -60,6 +60,7 @@ #include "pipe/p_context.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" +#include "tgsi/tgsi_ureg.h" #include "util/u_tile.h" #include "util/u_draw_quad.h" #include "util/u_math.h" @@ -236,78 +237,41 @@ make_fragment_shader_z(struct st_context *st) * Create a simple vertex shader that just passes through the * vertex position and texcoord (and optionally, color). */ -static struct st_vertex_program * -st_make_passthrough_vertex_shader(struct st_context *st, GLboolean passColor) +static void * +st_make_passthrough_vertex_shader(struct st_context *st, + GLboolean passColor) { - GLcontext *ctx = st->ctx; - struct st_vertex_program *stvp; - struct gl_program *p; - GLuint ic = 0; - - if (st->drawpix.vert_shaders[passColor]) - return st->drawpix.vert_shaders[passColor]; - - /* - * Create shader now - */ - p = ctx->Driver.NewProgram(ctx, GL_VERTEX_PROGRAM_ARB, 0); - if (!p) - return NULL; - - if (passColor) - p->NumInstructions = 4; - else - p->NumInstructions = 3; - - p->Instructions = _mesa_alloc_instructions(p->NumInstructions); - if (!p->Instructions) { - ctx->Driver.DeleteProgram(ctx, p); - return NULL; - } - _mesa_init_instructions(p->Instructions, p->NumInstructions); - /* MOV result.pos, vertex.pos; */ - p->Instructions[0].Opcode = OPCODE_MOV; - p->Instructions[0].DstReg.File = PROGRAM_OUTPUT; - p->Instructions[0].DstReg.Index = VERT_RESULT_HPOS; - p->Instructions[0].SrcReg[0].File = PROGRAM_INPUT; - p->Instructions[0].SrcReg[0].Index = VERT_ATTRIB_POS; - /* MOV result.texcoord0, vertex.texcoord0; */ - p->Instructions[1].Opcode = OPCODE_MOV; - p->Instructions[1].DstReg.File = PROGRAM_OUTPUT; - p->Instructions[1].DstReg.Index = VERT_RESULT_TEX0; - p->Instructions[1].SrcReg[0].File = PROGRAM_INPUT; - p->Instructions[1].SrcReg[0].Index = VERT_ATTRIB_TEX0; - ic = 2; - if (passColor) { - /* MOV result.color0, vertex.color0; */ - p->Instructions[ic].Opcode = OPCODE_MOV; - p->Instructions[ic].DstReg.File = PROGRAM_OUTPUT; - p->Instructions[ic].DstReg.Index = VERT_RESULT_COL0; - p->Instructions[ic].SrcReg[0].File = PROGRAM_INPUT; - p->Instructions[ic].SrcReg[0].Index = VERT_ATTRIB_COLOR0; - ic++; - } - - /* END; */ - p->Instructions[ic].Opcode = OPCODE_END; - ic++; - - assert(ic == p->NumInstructions); + if (!st->drawpix.vert_shaders[passColor]) { + struct ureg_program *ureg = + ureg_create( TGSI_PROCESSOR_VERTEX ); + + if (ureg == NULL) + return NULL; + + /* MOV result.pos, vertex.pos; */ + ureg_MOV(ureg, + ureg_DECL_output( ureg, TGSI_SEMANTIC_POSITION, 0 ), + ureg_DECL_vs_input( ureg, 0 )); + + /* MOV result.texcoord0, vertex.texcoord0; */ + ureg_MOV(ureg, + ureg_DECL_output( ureg, TGSI_SEMANTIC_GENERIC, 0 ), + ureg_DECL_vs_input( ureg, 1 )); + + if (passColor) { + /* MOV result.color0, vertex.color0; */ + ureg_MOV(ureg, + ureg_DECL_output( ureg, TGSI_SEMANTIC_COLOR, 0 ), + ureg_DECL_vs_input( ureg, 2 )); + } - p->InputsRead = VERT_BIT_POS | VERT_BIT_TEX0; - p->OutputsWritten = ((1 << VERT_RESULT_TEX0) | - (1 << VERT_RESULT_HPOS)); - if (passColor) { - p->InputsRead |= VERT_BIT_COLOR0; - p->OutputsWritten |= (1 << VERT_RESULT_COL0); + ureg_END( ureg ); + + st->drawpix.vert_shaders[passColor] = + ureg_create_shader_and_destroy( ureg, st->pipe ); } - stvp = (struct st_vertex_program *) p; - st_translate_vertex_program(st, stvp, NULL, NULL, NULL); - - st->drawpix.vert_shaders[passColor] = stvp; - - return stvp; + return st->drawpix.vert_shaders[passColor]; } @@ -539,8 +503,8 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, GLsizei width, GLsizei height, GLfloat zoomX, GLfloat zoomY, struct pipe_texture *pt, - struct st_vertex_program *stvp, - struct st_fragment_program *stfp, + void *driver_vp, + void *driver_fp, const GLfloat *color, GLboolean invertTex) { @@ -575,10 +539,10 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, } /* fragment shader state: TEX lookup program */ - cso_set_fragment_shader_handle(cso, stfp->driver_shader); + cso_set_fragment_shader_handle(cso, driver_fp); /* vertex shader state: position + texcoord pass-through */ - cso_set_vertex_shader_handle(cso, stvp->driver_shader); + cso_set_vertex_shader_handle(cso, driver_vp); /* texture sampling state: */ @@ -806,7 +770,7 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const struct gl_pixelstore_attrib *unpack, const GLvoid *pixels) { struct st_fragment_program *stfp; - struct st_vertex_program *stvp; + void *driver_vp; struct st_context *st = st_context(ctx); struct pipe_surface *ps; const GLfloat *color; @@ -826,13 +790,13 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, if (format == GL_DEPTH_COMPONENT) { ps = st->state.framebuffer.zsbuf; stfp = make_fragment_shader_z(st); - stvp = st_make_passthrough_vertex_shader(st, GL_TRUE); + driver_vp = st_make_passthrough_vertex_shader(st, GL_TRUE); color = ctx->Current.RasterColor; } else { ps = st->state.framebuffer.cbufs[0]; stfp = combined_drawpix_fragment_program(ctx); - stvp = st_make_passthrough_vertex_shader(st, GL_FALSE); + driver_vp = st_make_passthrough_vertex_shader(st, GL_FALSE); color = NULL; } @@ -843,7 +807,10 @@ st_DrawPixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, if (pt) { draw_textured_quad(ctx, x, y, ctx->Current.RasterPos[2], width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY, - pt, stvp, stfp, color, GL_FALSE); + pt, + driver_vp, + stfp->driver_shader, + color, GL_FALSE); pipe_texture_reference(&pt, NULL); } } @@ -1148,7 +1115,10 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, /* draw textured quad */ draw_textured_quad(ctx, dstx, dsty, ctx->Current.RasterPos[2], width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY, - pt, stvp, stfp, color, GL_TRUE); + pt, + stvp->driver_shader, + stfp->driver_shader, + color, GL_TRUE); pipe_texture_reference(&pt, NULL); } -- cgit v1.2.3 From 07fafc7c9346aa260829603bf3188596481e9e62 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Sun, 15 Nov 2009 11:15:25 -0800 Subject: mesa/st: refactor vertex and fragment shader translation Translate vertex shaders independently of fragment shaders. Previously tried to make fragment shader semantic indexes always start at zero and exclude holes. This was unnecessary but meant that vertex shader translation had to be adjusted to take this into account. Now use a fixed scheme for labelling special FS input semantics (color, etc), and another fixed scheme for the generics. With this, vertex shaders can be translated independently of the bound fragment shader, assuming mesa has done its own job and ensured that the vertex shader provides at least the inputs the fragment shader is looking for. The state-tracker didn't attempt to do anything about this previously, so it shouldn't be needed now. --- src/mesa/state_tracker/st_atom.c | 3 +- src/mesa/state_tracker/st_atom.h | 3 +- src/mesa/state_tracker/st_atom_shader.c | 326 ++++++++---------------------- src/mesa/state_tracker/st_cb_bitmap.c | 5 - src/mesa/state_tracker/st_cb_drawpixels.c | 8 +- src/mesa/state_tracker/st_cb_program.c | 43 +--- src/mesa/state_tracker/st_context.h | 2 + src/mesa/state_tracker/st_debug.c | 3 +- src/mesa/state_tracker/st_draw.c | 2 +- src/mesa/state_tracker/st_draw_feedback.c | 8 +- src/mesa/state_tracker/st_program.c | 267 +++++++++++------------- src/mesa/state_tracker/st_program.h | 75 +++++-- 12 files changed, 276 insertions(+), 469 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index ca15ce1b47..dfce955fd9 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -46,7 +46,8 @@ static const struct st_tracked_state *atoms[] = &st_update_clip, &st_finalize_textures, - &st_update_shader, + &st_update_fp, + &st_update_vp, &st_update_rasterizer, &st_update_polygon_stipple, diff --git a/src/mesa/state_tracker/st_atom.h b/src/mesa/state_tracker/st_atom.h index c7cffd85c8..f34b49203b 100644 --- a/src/mesa/state_tracker/st_atom.h +++ b/src/mesa/state_tracker/st_atom.h @@ -47,7 +47,8 @@ void st_validate_state( struct st_context *st ); extern const struct st_tracked_state st_update_framebuffer; extern const struct st_tracked_state st_update_clip; extern const struct st_tracked_state st_update_depth_stencil_alpha; -extern const struct st_tracked_state st_update_shader; +extern const struct st_tracked_state st_update_fp; +extern const struct st_tracked_state st_update_vp; extern const struct st_tracked_state st_update_rasterizer; extern const struct st_tracked_state st_update_polygon_stipple; extern const struct st_tracked_state st_update_viewport; diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index ee649be885..09baff875b 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -56,82 +56,18 @@ #include "st_mesa_to_tgsi.h" -/** - * This represents a vertex program, especially translated to match - * the inputs of a particular fragment shader. - */ -struct translated_vertex_program -{ - struct st_vertex_program *master; - - /** The fragment shader "signature" this vertex shader is meant for: */ - GLbitfield frag_inputs; - /** Compared against master vertex program's serialNo: */ - GLuint serialNo; - /** Maps VERT_RESULT_x to slot */ - GLuint output_to_slot[VERT_RESULT_MAX]; - ubyte output_to_semantic_name[VERT_RESULT_MAX]; - ubyte output_to_semantic_index[VERT_RESULT_MAX]; - - /** Pointer to the translated vertex program */ - struct st_vertex_program *vp; - - struct translated_vertex_program *next; /**< next in linked list */ -}; - - -/** - * Given a vertex program output attribute, return the corresponding - * fragment program input attribute. - * \return -1 for vertex outputs that have no corresponding fragment input +/* + * Translate fragment program if needed. */ -static GLint -vp_out_to_fp_in(GLuint vertResult) -{ - if (vertResult >= VERT_RESULT_TEX0 && - vertResult < VERT_RESULT_TEX0 + MAX_TEXTURE_COORD_UNITS) - return FRAG_ATTRIB_TEX0 + (vertResult - VERT_RESULT_TEX0); - - if (vertResult >= VERT_RESULT_VAR0 && - vertResult < VERT_RESULT_VAR0 + MAX_VARYING) - return FRAG_ATTRIB_VAR0 + (vertResult - VERT_RESULT_VAR0); - - switch (vertResult) { - case VERT_RESULT_HPOS: - return FRAG_ATTRIB_WPOS; - case VERT_RESULT_COL0: - return FRAG_ATTRIB_COL0; - case VERT_RESULT_COL1: - return FRAG_ATTRIB_COL1; - case VERT_RESULT_FOGC: - return FRAG_ATTRIB_FOGC; - default: - /* Back-face colors, edge flags, etc */ - return -1; - } -} - - -/** - * Find a translated vertex program that corresponds to stvp and - * has outputs matched to stfp's inputs. - * This performs vertex and fragment translation (to TGSI) when needed. - */ -static struct translated_vertex_program * -find_translated_vp(struct st_context *st, - struct st_vertex_program *stvp, - struct st_fragment_program *stfp) +static void +translate_fp(struct st_context *st, + struct st_fragment_program *stfp) { - static const GLuint UNUSED = ~0; - struct translated_vertex_program *xvp; const GLbitfield fragInputsRead = stfp->Base.Base.InputsRead; - /* - * Translate fragment program if needed. - */ if (!stfp->state.tokens) { GLuint inAttr, numIn = 0; @@ -141,7 +77,7 @@ find_translated_vp(struct st_context *st, numIn++; } else { - stfp->input_to_slot[inAttr] = UNUSED; + stfp->input_to_slot[inAttr] = -1; } } @@ -151,170 +87,63 @@ find_translated_vp(struct st_context *st, st_translate_fragment_program(st, stfp, stfp->input_to_slot); } +} - /* See if we've got a translated vertex program whose outputs match - * the fragment program's inputs. - * XXX This could be a hash lookup, using InputsRead as the key. - */ - for (xvp = stfp->vertex_programs; xvp; xvp = xvp->next) { - if (xvp->master == stvp && xvp->frag_inputs == fragInputsRead) { - break; - } - } - /* No? Allocate translated vp object now */ - if (!xvp) { - xvp = ST_CALLOC_STRUCT(translated_vertex_program); - xvp->frag_inputs = fragInputsRead; - xvp->master = stvp; +/** + * Find a translated vertex program that corresponds to stvp and + * has outputs matched to stfp's inputs. + * This performs vertex and fragment translation (to TGSI) when needed. + */ +static struct st_vp_varient * +find_translated_vp(struct st_context *st, + struct st_vertex_program *stvp ) +{ + struct st_vp_varient *vpv; + struct st_vp_varient_key key; - xvp->next = stfp->vertex_programs; - stfp->vertex_programs = xvp; - } + /* Nothing in our key yet. This will change: + */ + memset(&key, 0, sizeof key); + key.dummy = 0; - /* See if we need to translate vertex program to TGSI form */ - if (xvp->serialNo != stvp->serialNo) { - GLuint outAttr; - const GLbitfield outputsWritten = stvp->Base.Base.OutputsWritten; - GLuint numVpOuts = 0; - GLboolean emitPntSize = GL_FALSE, emitBFC0 = GL_FALSE, emitBFC1 = GL_FALSE; - GLbitfield usedGenerics = 0x0; - GLbitfield usedOutputSlots = 0x0; - - /* Compute mapping of vertex program outputs to slots, which depends - * on the fragment program's input->slot mapping. + /* Do we need to throw away old translations after a change in the + * GL program string? + */ + if (stvp->serialNo != stvp->lastSerialNo) { + /* These may have changed if the program string changed. */ - for (outAttr = 0; outAttr < VERT_RESULT_MAX; outAttr++) { - /* set defaults: */ - xvp->output_to_slot[outAttr] = UNUSED; - xvp->output_to_semantic_name[outAttr] = TGSI_SEMANTIC_COUNT; - xvp->output_to_semantic_index[outAttr] = 99; - - if (outAttr == VERT_RESULT_HPOS) { - /* always put xformed position into slot zero */ - GLuint slot = 0; - xvp->output_to_slot[VERT_RESULT_HPOS] = slot; - xvp->output_to_semantic_name[outAttr] = TGSI_SEMANTIC_POSITION; - xvp->output_to_semantic_index[outAttr] = 0; - numVpOuts++; - usedOutputSlots |= (1 << slot); - } - else if (outputsWritten & (1 << outAttr)) { - /* see if the frag prog wants this vert output */ - GLint fpInAttrib = vp_out_to_fp_in(outAttr); - if (fpInAttrib >= 0) { - GLuint fpInSlot = stfp->input_to_slot[fpInAttrib]; - if (fpInSlot != ~0) { - /* match this vp output to the fp input */ - GLuint vpOutSlot = stfp->input_map[fpInSlot]; - xvp->output_to_slot[outAttr] = vpOutSlot; - xvp->output_to_semantic_name[outAttr] = stfp->input_semantic_name[fpInSlot]; - xvp->output_to_semantic_index[outAttr] = stfp->input_semantic_index[fpInSlot]; - numVpOuts++; - usedOutputSlots |= (1 << vpOutSlot); - } - else { -#if 0 /*debug*/ - printf("VP output %d not used by FP\n", outAttr); -#endif - } - } - else if (outAttr == VERT_RESULT_PSIZ) - emitPntSize = GL_TRUE; - else if (outAttr == VERT_RESULT_BFC0) - emitBFC0 = GL_TRUE; - else if (outAttr == VERT_RESULT_BFC1) - emitBFC1 = GL_TRUE; - } -#if 0 /*debug*/ - printf("assign vp output_to_slot[%d] = %d\n", outAttr, - xvp->output_to_slot[outAttr]); -#endif - } - - /* must do these last */ - if (emitPntSize) { - GLuint slot = numVpOuts++; - xvp->output_to_slot[VERT_RESULT_PSIZ] = slot; - xvp->output_to_semantic_name[VERT_RESULT_PSIZ] = TGSI_SEMANTIC_PSIZE; - xvp->output_to_semantic_index[VERT_RESULT_PSIZ] = 0; - usedOutputSlots |= (1 << slot); - } - if (emitBFC0) { - GLuint slot = numVpOuts++; - xvp->output_to_slot[VERT_RESULT_BFC0] = slot; - xvp->output_to_semantic_name[VERT_RESULT_BFC0] = TGSI_SEMANTIC_COLOR; - xvp->output_to_semantic_index[VERT_RESULT_BFC0] = 0; - usedOutputSlots |= (1 << slot); - } - if (emitBFC1) { - GLuint slot = numVpOuts++; - xvp->output_to_slot[VERT_RESULT_BFC1] = slot; - xvp->output_to_semantic_name[VERT_RESULT_BFC1] = TGSI_SEMANTIC_COLOR; - xvp->output_to_semantic_index[VERT_RESULT_BFC1] = 1; - usedOutputSlots |= (1 << slot); - } - - /* build usedGenerics mask */ - usedGenerics = 0x0; - for (outAttr = 0; outAttr < VERT_RESULT_MAX; outAttr++) { - if (xvp->output_to_semantic_name[outAttr] == TGSI_SEMANTIC_GENERIC) { - usedGenerics |= (1 << xvp->output_to_semantic_index[outAttr]); - } - } + st_prepare_vertex_program( st, stvp ); - /* For each vertex program output that doesn't match up to a fragment - * program input, map the vertex program output to a free slot and - * free generic attribute. + /* We are now up-to-date: */ - for (outAttr = 0; outAttr < VERT_RESULT_MAX; outAttr++) { - if (outputsWritten & (1 << outAttr)) { - if (xvp->output_to_slot[outAttr] == UNUSED) { - GLint freeGeneric = _mesa_ffs(~usedGenerics) - 1; - GLint freeSlot = _mesa_ffs(~usedOutputSlots) - 1; - usedGenerics |= (1 << freeGeneric); - usedOutputSlots |= (1 << freeSlot); - xvp->output_to_slot[outAttr] = freeSlot; - xvp->output_to_semantic_name[outAttr] = TGSI_SEMANTIC_GENERIC; - xvp->output_to_semantic_index[outAttr] = freeGeneric; - } - } - -#if 0 /*debug*/ - printf("vp output_to_slot[%d] = %d\n", outAttr, - xvp->output_to_slot[outAttr]); -#endif + stvp->lastSerialNo = stvp->serialNo; + } + + /* See if we've got a translated vertex program whose outputs match + * the fragment program's inputs. + */ + for (vpv = stvp->varients; vpv; vpv = vpv->next) { + if (memcmp(&vpv->key, &key, sizeof key) == 0) { + break; } + } - assert(stvp->Base.Base.NumInstructions > 1); - - st_translate_vertex_program(st, stvp, xvp->output_to_slot, - xvp->output_to_semantic_name, - xvp->output_to_semantic_index); - - xvp->vp = stvp; - - /* translated VP is up to date now */ - xvp->serialNo = stvp->serialNo; + /* No? Perform new translation here. */ + if (!vpv) { + vpv = st_translate_vertex_program(st, stvp, &key); + if (!vpv) + return NULL; + + vpv->next = stvp->varients; + stvp->varients = vpv; } - return xvp; + return vpv; } -void -st_free_translated_vertex_programs(struct st_context *st, - struct translated_vertex_program *xvp) -{ - struct translated_vertex_program *next; - - while (xvp) { - next = xvp->next; - _mesa_free(xvp); - xvp = next; - } -} static void * @@ -328,32 +157,19 @@ get_passthrough_fs(struct st_context *st) return st->passthrough_fs; } - static void -update_linkage( struct st_context *st ) +update_fp( struct st_context *st ) { - struct st_vertex_program *stvp; struct st_fragment_program *stfp; - struct translated_vertex_program *xvp; - - /* find active shader and params -- Should be covered by - * ST_NEW_VERTEX_PROGRAM - */ - assert(st->ctx->VertexProgram._Current); - stvp = st_vertex_program(st->ctx->VertexProgram._Current); - assert(stvp->Base.Base.Target == GL_VERTEX_PROGRAM_ARB); assert(st->ctx->FragmentProgram._Current); stfp = st_fragment_program(st->ctx->FragmentProgram._Current); assert(stfp->Base.Base.Target == GL_FRAGMENT_PROGRAM_ARB); - xvp = find_translated_vp(st, stvp, stfp); + translate_fp(st, stfp); - st_reference_vertprog(st, &st->vp, stvp); st_reference_fragprog(st, &st->fp, stfp); - cso_set_vertex_shader_handle(st->cso_context, stvp->driver_shader); - if (st->missing_textures) { /* use a pass-through frag shader that uses no textures */ void *fs = get_passthrough_fs(st); @@ -362,16 +178,48 @@ update_linkage( struct st_context *st ) else { cso_set_fragment_shader_handle(st->cso_context, stfp->driver_shader); } +} + +const struct st_tracked_state st_update_fp = { + "st_update_fp", /* name */ + { /* dirty */ + 0, /* mesa */ + ST_NEW_FRAGMENT_PROGRAM /* st */ + }, + update_fp /* update */ +}; + + + + +static void +update_vp( struct st_context *st ) +{ + struct st_vertex_program *stvp; + + /* find active shader and params -- Should be covered by + * ST_NEW_VERTEX_PROGRAM + */ + assert(st->ctx->VertexProgram._Current); + stvp = st_vertex_program(st->ctx->VertexProgram._Current); + assert(stvp->Base.Base.Target == GL_VERTEX_PROGRAM_ARB); + + st->vp_varient = find_translated_vp(st, stvp); + + st_reference_vertprog(st, &st->vp, stvp); + + cso_set_vertex_shader_handle(st->cso_context, + st->vp_varient->driver_shader); - st->vertex_result_to_slot = xvp->output_to_slot; + st->vertex_result_to_slot = stvp->result_to_output; } -const struct st_tracked_state st_update_shader = { - "st_update_shader", /* name */ +const struct st_tracked_state st_update_vp = { + "st_update_vp", /* name */ { /* dirty */ 0, /* mesa */ - ST_NEW_VERTEX_PROGRAM | ST_NEW_FRAGMENT_PROGRAM /* st */ + ST_NEW_VERTEX_PROGRAM /* st */ }, - update_linkage /* update */ + update_vp /* update */ }; diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index a22fa68299..226d1ab14c 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -169,11 +169,6 @@ make_bitmap_fragment_program(GLcontext *ctx, GLuint samplerIndex) stfp = (struct st_fragment_program *) p; stfp->Base.UsesKill = GL_TRUE; - /* No need to send this incomplete program down to hardware: - * - * st_translate_fragment_program(ctx->st, stfp, NULL); - */ - return stfp; } diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 13e454b7a7..60394731f7 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -927,7 +927,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, struct pipe_context *pipe = st->pipe; struct pipe_screen *screen = pipe->screen; struct st_renderbuffer *rbRead; - struct st_vertex_program *stvp; + void *driver_vp; struct st_fragment_program *stfp; struct pipe_texture *pt; GLfloat *color; @@ -976,14 +976,14 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, rbRead = st_get_color_read_renderbuffer(ctx); color = NULL; stfp = combined_drawpix_fragment_program(ctx); - stvp = st_make_passthrough_vertex_shader(st, GL_FALSE); + driver_vp = st_make_passthrough_vertex_shader(st, GL_FALSE); } else { assert(type == GL_DEPTH); rbRead = st_renderbuffer(ctx->ReadBuffer->_DepthBuffer); color = ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; stfp = make_fragment_shader_z(st); - stvp = st_make_passthrough_vertex_shader(st, GL_TRUE); + driver_vp = st_make_passthrough_vertex_shader(st, GL_TRUE); } srcFormat = rbRead->texture->format; @@ -1116,7 +1116,7 @@ st_CopyPixels(GLcontext *ctx, GLint srcx, GLint srcy, draw_textured_quad(ctx, dstx, dsty, ctx->Current.RasterPos[2], width, height, ctx->Pixel.ZoomX, ctx->Pixel.ZoomY, pt, - stvp->driver_shader, + driver_vp, stfp->driver_shader, color, GL_TRUE); diff --git a/src/mesa/state_tracker/st_cb_program.c b/src/mesa/state_tracker/st_cb_program.c index b2d5c39a3a..8c276f8128 100644 --- a/src/mesa/state_tracker/st_cb_program.c +++ b/src/mesa/state_tracker/st_cb_program.c @@ -138,24 +138,7 @@ st_delete_program(GLcontext *ctx, struct gl_program *prog) case GL_VERTEX_PROGRAM_ARB: { struct st_vertex_program *stvp = (struct st_vertex_program *) prog; - - if (stvp->driver_shader) { - cso_delete_vertex_shader(st->cso_context, stvp->driver_shader); - stvp->driver_shader = NULL; - } - - if (stvp->draw_shader) { -#if FEATURE_feedback || FEATURE_drawpix - /* this would only have been allocated for the RasterPos path */ - draw_delete_vertex_shader(st->draw, stvp->draw_shader); - stvp->draw_shader = NULL; -#endif - } - - if (stvp->state.tokens) { - st_free_tokens(stvp->state.tokens); - stvp->state.tokens = NULL; - } + st_vp_release_varients( st, stvp ); } break; case GL_FRAGMENT_PROGRAM_ARB: @@ -177,8 +160,6 @@ st_delete_program(GLcontext *ctx, struct gl_program *prog) _mesa_reference_program(ctx, &prg, NULL); stfp->bitmap_program = NULL; } - - st_free_translated_vertex_programs(st, stfp->vertex_programs); } break; default: @@ -219,8 +200,6 @@ static void st_program_string_notify( GLcontext *ctx, stfp->state.tokens = NULL; } - stfp->param_state = stfp->Base.Base.Parameters->StateFlags; - if (st->fp == stfp) st->dirty.st |= ST_NEW_FRAGMENT_PROGRAM; } @@ -229,25 +208,7 @@ static void st_program_string_notify( GLcontext *ctx, stvp->serialNo++; - if (stvp->driver_shader) { - cso_delete_vertex_shader(st->cso_context, stvp->driver_shader); - stvp->driver_shader = NULL; - } - - if (stvp->draw_shader) { -#if FEATURE_feedback || FEATURE_drawpix - /* this would only have been allocated for the RasterPos path */ - draw_delete_vertex_shader(st->draw, stvp->draw_shader); - stvp->draw_shader = NULL; -#endif - } - - if (stvp->state.tokens) { - st_free_tokens(stvp->state.tokens); - stvp->state.tokens = NULL; - } - - stvp->param_state = stvp->Base.Base.Parameters->StateFlags; + st_vp_release_varients( st, stvp ); if (st->vp == stvp) st->dirty.st |= ST_NEW_VERTEX_PROGRAM; diff --git a/src/mesa/state_tracker/st_context.h b/src/mesa/state_tracker/st_context.h index 18adb35e87..b760728658 100644 --- a/src/mesa/state_tracker/st_context.h +++ b/src/mesa/state_tracker/st_context.h @@ -127,6 +127,8 @@ struct st_context struct st_vertex_program *vp; /**< Currently bound vertex program */ struct st_fragment_program *fp; /**< Currently bound fragment program */ + struct st_vp_varient *vp_varient; + struct gl_texture_object *default_texture; struct { diff --git a/src/mesa/state_tracker/st_debug.c b/src/mesa/state_tracker/st_debug.c index 3009cde9d5..6e699ca552 100644 --- a/src/mesa/state_tracker/st_debug.c +++ b/src/mesa/state_tracker/st_debug.c @@ -86,7 +86,8 @@ st_print_current(void) } #endif - tgsi_dump( st->vp->state.tokens, 0 ); + if (st->vp->varients) + tgsi_dump( st->vp->varients[0].state.tokens, 0 ); if (st->vp->Base.Base.Parameters) _mesa_print_parameter_list(st->vp->Base.Base.Parameters); diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index c76bff9181..337c21a6c4 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -563,7 +563,7 @@ st_draw_vbo(GLcontext *ctx, /* must get these after state validation! */ vp = ctx->st->vp; - vs = &ctx->st->vp->state; + vs = &ctx->st->vp_varient->state; #if 0 if (MESA_VERBOSE & VERBOSE_GLSL) { diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index b2d682ef64..d793f820bc 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -120,10 +120,10 @@ st_feedback_draw_vbo(GLcontext *ctx, /* must get these after state validation! */ vp = ctx->st->vp; - vs = &st->vp->state; + vs = &st->vp_varient->state; - if (!st->vp->draw_shader) { - st->vp->draw_shader = draw_create_vertex_shader(draw, vs); + if (!st->vp_varient->draw_shader) { + st->vp_varient->draw_shader = draw_create_vertex_shader(draw, vs); } /* @@ -136,7 +136,7 @@ st_feedback_draw_vbo(GLcontext *ctx, draw_set_viewport_state(draw, &st->state.viewport); draw_set_clip_state(draw, &st->state.clip); draw_set_rasterizer_state(draw, &st->state.rasterizer); - draw_bind_vertex_shader(draw, st->vp->draw_shader); + draw_bind_vertex_shader(draw, st->vp_varient->draw_shader); set_feedback_vertex_format(ctx); /* loop over TGSI shader inputs to determine vertex buffer diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 5450b59a2d..6a2b99cf1b 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -49,6 +49,36 @@ #include "st_mesa_to_tgsi.h" #include "cso_cache/cso_context.h" + /* Clean out any old compilations: + */ +void +st_vp_release_varients( struct st_context *st, + struct st_vertex_program *stvp ) +{ + struct st_vp_varient *vpv; + + for (vpv = stvp->varients; vpv; ) { + struct st_vp_varient *next = vpv->next; + + if (vpv->driver_shader) + cso_delete_vertex_shader(st->cso_context, vpv->driver_shader); + + if (vpv->draw_shader) + draw_delete_vertex_shader( st->draw, vpv->draw_shader ); + + if (vpv->state.tokens) + st_free_tokens(vpv->state.tokens); + + FREE( vpv ); + + vpv = next; + } + + stvp->varients = NULL; +} + + + /** * Translate a Mesa vertex shader into a TGSI shader. @@ -58,22 +88,13 @@ * \return pointer to cached pipe_shader object. */ void -st_translate_vertex_program(struct st_context *st, - struct st_vertex_program *stvp, - const GLuint outputMapping[], - const ubyte *outputSemanticName, - const ubyte *outputSemanticIndex) +st_prepare_vertex_program(struct st_context *st, + struct st_vertex_program *stvp) { - struct pipe_context *pipe = st->pipe; - GLuint defaultOutputMapping[VERT_RESULT_MAX]; - GLuint attr, i; - GLuint num_generic = 0; - - uint vs_num_inputs = 0; + GLuint attr; - ubyte vs_output_semantic_name[PIPE_MAX_SHADER_OUTPUTS]; - ubyte vs_output_semantic_index[PIPE_MAX_SHADER_OUTPUTS]; - uint vs_num_outputs = 0; + stvp->num_inputs = 0; + stvp->num_outputs = 0; if (stvp->Base.IsPositionInvariant) _mesa_insert_mvp_code(st->ctx, &stvp->Base); @@ -84,92 +105,56 @@ st_translate_vertex_program(struct st_context *st, */ for (attr = 0; attr < VERT_ATTRIB_MAX; attr++) { if (stvp->Base.Base.InputsRead & (1 << attr)) { - stvp->input_to_index[attr] = vs_num_inputs; - stvp->index_to_input[vs_num_inputs] = attr; - - vs_num_inputs++; + stvp->input_to_index[attr] = stvp->num_inputs; + stvp->index_to_input[stvp->num_inputs] = attr; + stvp->num_inputs++; } } -#if 0 - if (outputMapping && outputSemanticName) { - printf("VERT_RESULT written out_slot semantic_name semantic_index\n"); - for (attr = 0; attr < VERT_RESULT_MAX; attr++) { - printf(" %-2d %c %3d %2d %2d\n", - attr, - ((stvp->Base.Base.OutputsWritten & (1 << attr)) ? 'Y' : ' '), - outputMapping[attr], - outputSemanticName[attr], - outputSemanticIndex[attr]); - } - } -#endif - - /* initialize output semantics to defaults */ - for (i = 0; i < PIPE_MAX_SHADER_OUTPUTS; i++) { - assert(i < Elements(vs_output_semantic_name)); - vs_output_semantic_name[i] = TGSI_SEMANTIC_GENERIC; - vs_output_semantic_index[i] = 0; - } - - num_generic = 0; - /* - * Determine number of outputs, the (default) output register - * mapping and the semantic information for each output. + /* Compute mapping of vertex program outputs to slots. */ for (attr = 0; attr < VERT_RESULT_MAX; attr++) { - if (stvp->Base.Base.OutputsWritten & (1 << attr)) { - GLuint slot; - - /* XXX - * Pass in the fragment program's input's semantic info. - * Use the generic semantic indexes from there, instead of - * guessing below. - */ - - if (outputMapping) { - slot = outputMapping[attr]; - assert(slot != ~0); - } - else { - slot = vs_num_outputs; - vs_num_outputs++; - defaultOutputMapping[attr] = slot; - } + if ((stvp->Base.Base.OutputsWritten & (1 << attr)) == 0) { + stvp->result_to_output[attr] = ~0; + } + else { + unsigned slot = stvp->num_outputs++; + + stvp->result_to_output[attr] = slot; switch (attr) { case VERT_RESULT_HPOS: - assert(slot == 0); - vs_output_semantic_name[slot] = TGSI_SEMANTIC_POSITION; - vs_output_semantic_index[slot] = 0; + stvp->output_semantic_name[slot] = TGSI_SEMANTIC_POSITION; + stvp->output_semantic_index[slot] = 0; break; case VERT_RESULT_COL0: - vs_output_semantic_name[slot] = TGSI_SEMANTIC_COLOR; - vs_output_semantic_index[slot] = 0; + stvp->output_semantic_name[slot] = TGSI_SEMANTIC_COLOR; + stvp->output_semantic_index[slot] = 0; break; case VERT_RESULT_COL1: - vs_output_semantic_name[slot] = TGSI_SEMANTIC_COLOR; - vs_output_semantic_index[slot] = 1; + stvp->output_semantic_name[slot] = TGSI_SEMANTIC_COLOR; + stvp->output_semantic_index[slot] = 1; break; case VERT_RESULT_BFC0: - vs_output_semantic_name[slot] = TGSI_SEMANTIC_BCOLOR; - vs_output_semantic_index[slot] = 0; + stvp->output_semantic_name[slot] = TGSI_SEMANTIC_BCOLOR; + stvp->output_semantic_index[slot] = 0; break; case VERT_RESULT_BFC1: - vs_output_semantic_name[slot] = TGSI_SEMANTIC_BCOLOR; - vs_output_semantic_index[slot] = 1; + stvp->output_semantic_name[slot] = TGSI_SEMANTIC_BCOLOR; + stvp->output_semantic_index[slot] = 1; break; case VERT_RESULT_FOGC: - vs_output_semantic_name[slot] = TGSI_SEMANTIC_FOG; - vs_output_semantic_index[slot] = 0; + stvp->output_semantic_name[slot] = TGSI_SEMANTIC_FOG; + stvp->output_semantic_index[slot] = 0; break; case VERT_RESULT_PSIZ: - vs_output_semantic_name[slot] = TGSI_SEMANTIC_PSIZE; - vs_output_semantic_index[slot] = 0; + stvp->output_semantic_name[slot] = TGSI_SEMANTIC_PSIZE; + stvp->output_semantic_index[slot] = 0; break; case VERT_RESULT_EDGE: assert(0); break; + case VERT_RESULT_TEX0: case VERT_RESULT_TEX1: case VERT_RESULT_TEX2: @@ -178,87 +163,50 @@ st_translate_vertex_program(struct st_context *st, case VERT_RESULT_TEX5: case VERT_RESULT_TEX6: case VERT_RESULT_TEX7: - /* fall-through */ + stvp->output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; + stvp->output_semantic_index[slot] = attr - VERT_RESULT_TEX0; + break; + case VERT_RESULT_VAR0: - /* fall-through */ default: - assert(slot < Elements(vs_output_semantic_name)); - if (outputSemanticName) { - /* use provided semantic into */ - assert(outputSemanticName[attr] != TGSI_SEMANTIC_COUNT); - vs_output_semantic_name[slot] = outputSemanticName[attr]; - vs_output_semantic_index[slot] = outputSemanticIndex[attr]; - } - else { - /* use default semantic info */ - vs_output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - vs_output_semantic_index[slot] = num_generic++; - } + assert(attr < VERT_RESULT_MAX); + stvp->output_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; + stvp->output_semantic_index[slot] = (FRAG_ATTRIB_VAR0 - + FRAG_ATTRIB_TEX0 + + attr - + VERT_RESULT_VAR0); + break; } } } +} - if (outputMapping) { - /* find max output slot referenced to compute vs_num_outputs */ - GLuint maxSlot = 0; - for (attr = 0; attr < VERT_RESULT_MAX; attr++) { - if (outputMapping[attr] != ~0 && outputMapping[attr] > maxSlot) - maxSlot = outputMapping[attr]; - } - vs_num_outputs = maxSlot + 1; - } - else { - outputMapping = defaultOutputMapping; - } -#if 0 /* debug */ - { - GLuint i; - printf("outputMapping? %d\n", outputMapping ? 1 : 0); - if (outputMapping) { - printf("attr -> slot\n"); - for (i = 0; i < 16; i++) { - printf(" %2d %3d\n", i, outputMapping[i]); - } - } - printf("slot sem_name sem_index\n"); - for (i = 0; i < vs_num_outputs; i++) { - printf(" %2d %d %d\n", - i, - vs_output_semantic_name[i], - vs_output_semantic_index[i]); - } - } -#endif - - /* free old shader state, if any */ - if (stvp->state.tokens) { - st_free_tokens(stvp->state.tokens); - stvp->state.tokens = NULL; - } - if (stvp->driver_shader) { - cso_delete_vertex_shader(st->cso_context, stvp->driver_shader); - stvp->driver_shader = NULL; - } +struct st_vp_varient * +st_translate_vertex_program(struct st_context *st, + struct st_vertex_program *stvp, + const struct st_vp_varient_key *key) +{ + struct st_vp_varient *vpv = CALLOC_STRUCT(st_vp_varient); + struct pipe_context *pipe = st->pipe; - stvp->state.tokens = + vpv->state.tokens = st_translate_mesa_program(st->ctx, TGSI_PROCESSOR_VERTEX, &stvp->Base.Base, /* inputs */ - vs_num_inputs, + stvp->num_inputs, stvp->input_to_index, NULL, /* input semantic name */ NULL, /* input semantic index */ NULL, /* outputs */ - vs_num_outputs, - outputMapping, - vs_output_semantic_name, - vs_output_semantic_index ); + stvp->num_outputs, + stvp->result_to_output, + stvp->output_semantic_name, + stvp->output_semantic_index ); - stvp->num_inputs = vs_num_inputs; - stvp->driver_shader = pipe->create_vs_state(pipe, &stvp->state); + vpv->driver_shader = pipe->create_vs_state(pipe, &vpv->state); if ((ST_DEBUG & DEBUG_TGSI) && (ST_DEBUG & DEBUG_MESA)) { _mesa_print_program(&stvp->Base.Base); @@ -266,9 +214,11 @@ st_translate_vertex_program(struct st_context *st, } if (ST_DEBUG & DEBUG_TGSI) { - tgsi_dump( stvp->state.tokens, 0 ); + tgsi_dump( vpv->state.tokens, 0 ); debug_printf("\n"); } + + return vpv; } @@ -291,7 +241,6 @@ st_translate_fragment_program(struct st_context *st, GLuint attr; const GLbitfield inputsRead = stfp->Base.Base.InputsRead; GLuint vslot = 0; - GLuint num_generic = 0; uint fs_num_inputs = 0; @@ -341,14 +290,25 @@ st_translate_fragment_program(struct st_context *st, break; case FRAG_ATTRIB_FACE: stfp->input_semantic_name[slot] = TGSI_SEMANTIC_FACE; - stfp->input_semantic_index[slot] = num_generic++; + stfp->input_semantic_index[slot] = 0; interpMode[slot] = TGSI_INTERPOLATE_CONSTANT; break; - case FRAG_ATTRIB_PNTC: - stfp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - stfp->input_semantic_index[slot] = num_generic++; - interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; - break; + + /* In most cases, there is nothing special about these + * inputs, so adopt a convention to use the generic + * semantic name and the mesa FRAG_ATTRIB_ number as the + * index. + * + * All that is required is that the vertex shader labels + * its own outputs similarly, and that the vertex shader + * generates at least every output required by the + * fragment shader plus fixed-function hardware (such as + * BFC). + * + * There is no requirement that semantic indexes start at + * zero or be restricted to a particular range -- nobody + * should be building tables based on semantic index. + */ case FRAG_ATTRIB_TEX0: case FRAG_ATTRIB_TEX1: case FRAG_ATTRIB_TEX2: @@ -357,16 +317,17 @@ st_translate_fragment_program(struct st_context *st, case FRAG_ATTRIB_TEX5: case FRAG_ATTRIB_TEX6: case FRAG_ATTRIB_TEX7: - stfp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - stfp->input_semantic_index[slot] = num_generic++; - interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; - break; + case FRAG_ATTRIB_PNTC: case FRAG_ATTRIB_VAR0: - /* fall-through */ default: + /* Actually, let's try and zero-base this just for + * readability of the generated TGSI. + */ + assert(attr >= FRAG_ATTRIB_TEX0); + stfp->input_semantic_index[slot] = (attr - FRAG_ATTRIB_TEX0); stfp->input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC; - stfp->input_semantic_index[slot] = num_generic++; interpMode[slot] = TGSI_INTERPOLATE_PERSPECTIVE; + break; } } } diff --git a/src/mesa/state_tracker/st_program.h b/src/mesa/state_tracker/st_program.h index e2e5eddef2..88aadbd751 100644 --- a/src/mesa/state_tracker/st_program.h +++ b/src/mesa/state_tracker/st_program.h @@ -64,41 +64,70 @@ struct st_fragment_program struct pipe_shader_state state; void *driver_shader; - GLuint param_state; - - /** List of vertex programs which have been translated such that their - * outputs match this fragment program's inputs. - */ - struct translated_vertex_program *vertex_programs; - /** Program prefixed with glBitmap prologue */ struct st_fragment_program *bitmap_program; uint bitmap_sampler; }; + +struct st_vp_varient_key +{ + char dummy; /* currently unused */ +}; + + +/** + * This represents a vertex program, especially translated to match + * the inputs of a particular fragment shader. + */ +struct st_vp_varient +{ + /* Parameters which generated this translated version of a vertex + * shader: + */ + struct st_vp_varient_key key; + + /** TGSI tokens -- why? + */ + struct pipe_shader_state state; + + /** Driver's compiled shader */ + void *driver_shader; + + /** For using our private draw module (glRasterPos) */ + struct draw_vertex_shader *draw_shader; + + /** Next in linked list */ + struct st_vp_varient *next; +}; + + + + /** * Derived from Mesa gl_fragment_program: */ struct st_vertex_program { struct gl_vertex_program Base; /**< The Mesa vertex program */ - GLuint serialNo; + GLuint serialNo, lastSerialNo; /** maps a Mesa VERT_ATTRIB_x to a packed TGSI input index */ GLuint input_to_index[VERT_ATTRIB_MAX]; /** maps a TGSI input index back to a Mesa VERT_ATTRIB_x */ GLuint index_to_input[PIPE_MAX_SHADER_INPUTS]; - GLuint num_inputs; - struct pipe_shader_state state; - void *driver_shader; + /** Maps VERT_RESULT_x to slot */ + GLuint result_to_output[VERT_RESULT_MAX]; + ubyte output_semantic_name[VERT_RESULT_MAX]; + ubyte output_semantic_index[VERT_RESULT_MAX]; + GLuint num_outputs; - /** For using our private draw module (glRasterPos) */ - struct draw_vertex_shader *draw_shader; - - GLuint param_state; + /** List of translated varients of this vertex program. + */ + struct st_vp_varient *varients; }; @@ -143,13 +172,21 @@ st_translate_fragment_program(struct st_context *st, const GLuint inputMapping[]); +/* Called after program string change, discard all previous + * compilation results. + */ extern void +st_prepare_vertex_program(struct st_context *st, + struct st_vertex_program *stvp); + +extern struct st_vp_varient * st_translate_vertex_program(struct st_context *st, - struct st_vertex_program *vp, - const GLuint vert_output_to_slot[], - const ubyte *fs_input_semantic_name, - const ubyte *fs_input_semantic_index); + struct st_vertex_program *stvp, + const struct st_vp_varient_key *key); +void +st_vp_release_varients( struct st_context *st, + struct st_vertex_program *stvp ); extern void st_print_shaders(GLcontext *ctx); -- cgit v1.2.3 From 4581f7057809314c78e17f846890a2d64c22d575 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 12 Nov 2009 17:53:54 -0700 Subject: st/egl: add some basic comments --- src/gallium/state_trackers/egl/egl_surface.c | 21 +++++++++++++++++++++ src/gallium/state_trackers/egl/egl_tracker.c | 4 ++++ 2 files changed, 25 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c index a4493e2637..91615abebe 100644 --- a/src/gallium/state_trackers/egl/egl_surface.c +++ b/src/gallium/state_trackers/egl/egl_surface.c @@ -186,6 +186,9 @@ drm_takedown_shown_screen(_EGLDisplay *dpy, struct drm_screen *screen) screen->shown = 0; } +/** + * Called by libEGL's eglCreateWindowSurface(). + */ _EGLSurface * drm_create_window_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, NativeWindowType window, const EGLint *attrib_list) { @@ -193,6 +196,9 @@ drm_create_window_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, N } +/** + * Called by libEGL's eglCreatePixmapSurface(). + */ _EGLSurface * drm_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, NativePixmapType pixmap, const EGLint *attrib_list) { @@ -200,6 +206,9 @@ drm_create_pixmap_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, N } +/** + * Called by libEGL's eglCreatePbufferSurface(). + */ _EGLSurface * drm_create_pbuffer_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *conf, const EGLint *attrib_list) @@ -254,6 +263,9 @@ err: return NULL; } +/** + * Called by libEGL's eglCreateScreenSurfaceMESA(). + */ _EGLSurface * drm_create_screen_surface_mesa(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *cfg, const EGLint *attrib_list) @@ -263,6 +275,9 @@ drm_create_screen_surface_mesa(_EGLDriver *drv, _EGLDisplay *dpy, _EGLConfig *cf return surf; } +/** + * Called by libEGL's eglShowScreenSurfaceMESA(). + */ EGLBoolean drm_show_screen_surface_mesa(_EGLDriver *drv, _EGLDisplay *dpy, _EGLScreen *screen, @@ -359,6 +374,9 @@ err_tex: return EGL_FALSE; } +/** + * Called by libEGL's eglDestroySurface(). + */ EGLBoolean drm_destroy_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface) { @@ -372,6 +390,9 @@ drm_destroy_surface(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *surface) return EGL_TRUE; } +/** + * Called by libEGL's eglSwapBuffers(). + */ EGLBoolean drm_swap_buffers(_EGLDriver *drv, _EGLDisplay *dpy, _EGLSurface *draw) { diff --git a/src/gallium/state_trackers/egl/egl_tracker.c b/src/gallium/state_trackers/egl/egl_tracker.c index 8d29bf490b..5811c20f03 100644 --- a/src/gallium/state_trackers/egl/egl_tracker.c +++ b/src/gallium/state_trackers/egl/egl_tracker.c @@ -22,6 +22,8 @@ void* driDriverAPI; * Exported functions */ +/** Called by libEGL just prior to unloading/closing the driver. + */ static void drm_unload(_EGLDriver *drv) { @@ -31,6 +33,8 @@ drm_unload(_EGLDriver *drv) /** * The bootstrap function. Return a new drm_driver object and * plug in API functions. + * libEGL finds this function with dlopen()/dlsym() and calls it from + * "load driver" function. */ _EGLDriver * _eglMain(const char *args) -- cgit v1.2.3 From afae49cc152d05e6795ccaba4d818df946248584 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 12 Nov 2009 20:59:26 -0700 Subject: st/mesa: comments for st_draw.c --- src/mesa/state_tracker/st_draw.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index c76bff9181..68bc76b572 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -25,10 +25,20 @@ * **************************************************************************/ - /* - * Authors: - * Keith Whitwell - */ +/* + * This file implements the st_draw_vbo() function which is called from + * Mesa's VBO module. All point/line/triangle rendering is done through + * this function whether the user called glBegin/End, glDrawArrays, + * glDrawElements, glEvalMesh, or glCalList, etc. + * + * We basically convert the VBO's vertex attribute/array information into + * Gallium vertex state, bind the vertex buffer objects and call + * pipe->draw_elements(), pipe->draw_range_elements() or pipe->draw_arrays(). + * + * Authors: + * Keith Whitwell + */ + #include "main/imports.h" #include "main/image.h" -- cgit v1.2.3 From d3a37d93aba86ebca697169a31d88c3ef0ce34b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Mon, 16 Nov 2009 11:59:39 +0100 Subject: st/xorg: Only reference new picture formats when they're defined. Fixes http://bugs.freedesktop.org/show_bug.cgi/?id=25094 . --- src/gallium/state_trackers/xorg/xorg_exa.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index a77ee7a908..735cabfedf 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -57,16 +57,18 @@ struct render_format_str { }; static const struct render_format_str formats_info[] = { - {PICT_a2r10g10b10, "PICT_a2r10g10b10"}, - {PICT_x2r10g10b10, "PICT_x2r10g10b10"}, - {PICT_a2b10g10r10, "PICT_a2b10g10r10"}, - {PICT_x2b10g10r10, "PICT_x2b10g10r10"}, {PICT_a8r8g8b8, "PICT_a8r8g8b8"}, {PICT_x8r8g8b8, "PICT_x8r8g8b8"}, {PICT_a8b8g8r8, "PICT_a8b8g8r8"}, {PICT_x8b8g8r8, "PICT_x8b8g8r8"}, +#ifdef PICT_TYPE_BGRA {PICT_b8g8r8a8, "PICT_b8g8r8a8"}, {PICT_b8g8r8x8, "PICT_b8g8r8x8"}, + {PICT_a2r10g10b10, "PICT_a2r10g10b10"}, + {PICT_x2r10g10b10, "PICT_x2r10g10b10"}, + {PICT_a2b10g10r10, "PICT_a2b10g10r10"}, + {PICT_x2b10g10r10, "PICT_x2b10g10r10"}, +#endif {PICT_r8g8b8, "PICT_r8g8b8"}, {PICT_b8g8r8, "PICT_b8g8r8"}, {PICT_r5g6b5, "PICT_r5g6b5"}, -- cgit v1.2.3 From ecb03d75a2961b28ab3d90fdd5df768608fc9447 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 16 Nov 2009 08:14:23 -0700 Subject: mesa: added another check in check_gen_mipmap() We don't need to call ctx->Driver.GenerateMipmap() if we're updating a texture level >= MAX_LEVEL. --- src/mesa/main/teximage.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index b10076875b..b946f3c69d 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -2035,7 +2035,9 @@ check_gen_mipmap(GLcontext *ctx, GLenum target, struct gl_texture_object *texObj, GLint level) { ASSERT(target != GL_TEXTURE_CUBE_MAP); - if (texObj->GenerateMipmap && level == texObj->BaseLevel) { + if (texObj->GenerateMipmap && + level == texObj->BaseLevel && + level < texObj->MaxLevel) { ASSERT(ctx->Driver.GenerateMipmap); ctx->Driver.GenerateMipmap(ctx, target, texObj); } -- cgit v1.2.3 From a719395b458ef59efe4e8746e390b006a0b8792b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 16 Nov 2009 08:21:28 -0700 Subject: mesa: use _mesa_get_current_tex_object() --- src/mesa/main/fbobject.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 2d0bfb3ad7..a2264b0dbf 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1942,7 +1942,6 @@ _mesa_GetFramebufferAttachmentParameterivEXT(GLenum target, GLenum attachment, void GLAPIENTRY _mesa_GenerateMipmapEXT(GLenum target) { - struct gl_texture_unit *texUnit; struct gl_texture_object *texObj; GET_CURRENT_CONTEXT(ctx); @@ -1961,8 +1960,7 @@ _mesa_GenerateMipmapEXT(GLenum target) return; } - texUnit = _mesa_get_current_tex_unit(ctx); - texObj = _mesa_select_tex_object(ctx, texUnit, target); + texObj = _mesa_get_current_tex_object(ctx, target); _mesa_lock_texture(ctx, texObj); if (target == GL_TEXTURE_CUBE_MAP) { -- cgit v1.2.3 From 652828ec0efd1a7d7a8b497e0324a7bd9f66fd17 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 16 Nov 2009 08:25:17 -0700 Subject: mesa: check BaseLevel, MaxLevel in _mesa_GenerateMipmapEXT() --- src/mesa/main/fbobject.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index a2264b0dbf..7b3599f932 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1962,6 +1962,11 @@ _mesa_GenerateMipmapEXT(GLenum target) texObj = _mesa_get_current_tex_object(ctx, target); + if (texObj->BaseLevel >= texObj->MaxLevel) { + /* nothing to do */ + return; + } + _mesa_lock_texture(ctx, texObj); if (target == GL_TEXTURE_CUBE_MAP) { GLuint face; -- cgit v1.2.3 From f549f4c4b6012178df3706b26539ca672399260f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 12 Nov 2009 23:04:26 -0700 Subject: mesa: remove unused vertex array driver hooks --- src/mesa/drivers/common/driverfuncs.c | 13 ----- src/mesa/main/dd.h | 28 ---------- src/mesa/main/varray.c | 102 +++++++++------------------------- 3 files changed, 26 insertions(+), 117 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index e5aab02a42..4ca0e7bcc3 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -183,19 +183,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->TexParameter = NULL; driver->Viewport = NULL; - /* vertex arrays */ - driver->VertexPointer = NULL; - driver->NormalPointer = NULL; - driver->ColorPointer = NULL; - driver->FogCoordPointer = NULL; - driver->IndexPointer = NULL; - driver->SecondaryColorPointer = NULL; - driver->TexCoordPointer = NULL; - driver->EdgeFlagPointer = NULL; - driver->VertexAttribPointer = NULL; - driver->LockArraysEXT = NULL; - driver->UnlockArraysEXT = NULL; - /* state queries */ driver->GetBooleanv = NULL; driver->GetDoublev = NULL; diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 99f2cad402..27ed921761 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -709,34 +709,6 @@ struct dd_function_table { /*@}*/ - /** - * \name Vertex array functions - * - * Called by the corresponding OpenGL functions. - */ - /*@{*/ - void (*VertexPointer)(GLcontext *ctx, GLint size, GLenum type, - GLsizei stride, const GLvoid *ptr); - void (*NormalPointer)(GLcontext *ctx, GLenum type, - GLsizei stride, const GLvoid *ptr); - void (*ColorPointer)(GLcontext *ctx, GLint size, GLenum type, - GLsizei stride, const GLvoid *ptr); - void (*FogCoordPointer)(GLcontext *ctx, GLenum type, - GLsizei stride, const GLvoid *ptr); - void (*IndexPointer)(GLcontext *ctx, GLenum type, - GLsizei stride, const GLvoid *ptr); - void (*SecondaryColorPointer)(GLcontext *ctx, GLint size, GLenum type, - GLsizei stride, const GLvoid *ptr); - void (*TexCoordPointer)(GLcontext *ctx, GLint size, GLenum type, - GLsizei stride, const GLvoid *ptr); - void (*EdgeFlagPointer)(GLcontext *ctx, GLsizei stride, const GLvoid *ptr); - void (*VertexAttribPointer)(GLcontext *ctx, GLuint index, GLint size, - GLenum type, GLsizei stride, const GLvoid *ptr); - void (*LockArraysEXT)( GLcontext *ctx, GLint first, GLsizei count ); - void (*UnlockArraysEXT)( GLcontext *ctx ); - /*@}*/ - - /** * \name State-query functions * diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 6cd2a2f4f6..c2193074cd 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -51,9 +51,8 @@ * \param stride stride between elements, in elements * \param normalized are integer types converted to floats in [-1, 1]? * \param ptr the address (or offset inside VBO) of the array data - * \return GL_TRUE if no error, GL_FALSE if error */ -static GLboolean +static void update_array(GLcontext *ctx, struct gl_client_array *array, GLbitfield dirtyBit, GLsizei elementSize, GLint size, GLenum type, GLenum format, @@ -68,7 +67,7 @@ update_array(GLcontext *ctx, struct gl_client_array *array, */ _mesa_error(ctx, GL_INVALID_OPERATION, "glVertex/Normal/EtcPointer(non-VBO array)"); - return GL_FALSE; + return; } array->Size = size; @@ -85,8 +84,6 @@ update_array(GLcontext *ctx, struct gl_client_array *array, ctx->NewState |= _NEW_ARRAY; ctx->Array.NewState |= dirtyBit; - - return GL_TRUE; } @@ -140,12 +137,8 @@ _mesa_VertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) return; } - if (!update_array(ctx, &ctx->Array.ArrayObj->Vertex, _NEW_ARRAY_VERTEX, - elementSize, size, type, GL_RGBA, stride, GL_FALSE, ptr)) - return; - - if (ctx->Driver.VertexPointer) - ctx->Driver.VertexPointer( ctx, size, type, stride, ptr ); + update_array(ctx, &ctx->Array.ArrayObj->Vertex, _NEW_ARRAY_VERTEX, + elementSize, size, type, GL_RGBA, stride, GL_FALSE, ptr); } @@ -192,12 +185,8 @@ _mesa_NormalPointer(GLenum type, GLsizei stride, const GLvoid *ptr ) return; } - if (!update_array(ctx, &ctx->Array.ArrayObj->Normal, _NEW_ARRAY_NORMAL, - elementSize, 3, type, GL_RGBA, stride, GL_TRUE, ptr)) - return; - - if (ctx->Driver.NormalPointer) - ctx->Driver.NormalPointer( ctx, type, stride, ptr ); + update_array(ctx, &ctx->Array.ArrayObj->Normal, _NEW_ARRAY_NORMAL, + elementSize, 3, type, GL_RGBA, stride, GL_TRUE, ptr); } @@ -272,12 +261,8 @@ _mesa_ColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr) return; } - if (!update_array(ctx, &ctx->Array.ArrayObj->Color, _NEW_ARRAY_COLOR0, - elementSize, size, type, format, stride, GL_TRUE, ptr)) - return; - - if (ctx->Driver.ColorPointer) - ctx->Driver.ColorPointer( ctx, size, type, stride, ptr ); + update_array(ctx, &ctx->Array.ArrayObj->Color, _NEW_ARRAY_COLOR0, + elementSize, size, type, format, stride, GL_TRUE, ptr); } @@ -305,12 +290,8 @@ _mesa_FogCoordPointerEXT(GLenum type, GLsizei stride, const GLvoid *ptr) return; } - if (!update_array(ctx, &ctx->Array.ArrayObj->FogCoord, _NEW_ARRAY_FOGCOORD, - elementSize, 1, type, GL_RGBA, stride, GL_FALSE, ptr)) - return; - - if (ctx->Driver.FogCoordPointer) - ctx->Driver.FogCoordPointer( ctx, type, stride, ptr ); + update_array(ctx, &ctx->Array.ArrayObj->FogCoord, _NEW_ARRAY_FOGCOORD, + elementSize, 1, type, GL_RGBA, stride, GL_FALSE, ptr); } @@ -347,12 +328,8 @@ _mesa_IndexPointer(GLenum type, GLsizei stride, const GLvoid *ptr) return; } - if (!update_array(ctx, &ctx->Array.ArrayObj->Index, _NEW_ARRAY_INDEX, - elementSize, 1, type, GL_RGBA, stride, GL_FALSE, ptr)) - return; - - if (ctx->Driver.IndexPointer) - ctx->Driver.IndexPointer( ctx, type, stride, ptr ); + update_array(ctx, &ctx->Array.ArrayObj->Index, _NEW_ARRAY_INDEX, + elementSize, 1, type, GL_RGBA, stride, GL_FALSE, ptr); } @@ -423,13 +400,8 @@ _mesa_SecondaryColorPointerEXT(GLint size, GLenum type, return; } - if (!update_array(ctx, &ctx->Array.ArrayObj->SecondaryColor, - _NEW_ARRAY_COLOR1, elementSize, size, type, - format, stride, GL_TRUE, ptr)) - return; - - if (ctx->Driver.SecondaryColorPointer) - ctx->Driver.SecondaryColorPointer( ctx, size, type, stride, ptr ); + update_array(ctx, &ctx->Array.ArrayObj->SecondaryColor, _NEW_ARRAY_COLOR1, + elementSize, size, type, format, stride, GL_TRUE, ptr); } @@ -485,13 +457,9 @@ _mesa_TexCoordPointer(GLint size, GLenum type, GLsizei stride, return; } - if (!update_array(ctx, &ctx->Array.ArrayObj->TexCoord[unit], - _NEW_ARRAY_TEXCOORD(unit), - elementSize, size, type, GL_RGBA, stride, GL_FALSE, ptr)) - return; - - if (ctx->Driver.TexCoordPointer) - ctx->Driver.TexCoordPointer( ctx, size, type, stride, ptr ); + update_array(ctx, &ctx->Array.ArrayObj->TexCoord[unit], + _NEW_ARRAY_TEXCOORD(unit), + elementSize, size, type, GL_RGBA, stride, GL_FALSE, ptr); } @@ -506,13 +474,9 @@ _mesa_EdgeFlagPointer(GLsizei stride, const GLvoid *ptr) return; } - if (!update_array(ctx, &ctx->Array.ArrayObj->EdgeFlag, _NEW_ARRAY_EDGEFLAG, - sizeof(GLboolean), 1, GL_UNSIGNED_BYTE, GL_RGBA, - stride, GL_FALSE, ptr)) - return; - - if (ctx->Driver.EdgeFlagPointer) - ctx->Driver.EdgeFlagPointer( ctx, stride, ptr ); + update_array(ctx, &ctx->Array.ArrayObj->EdgeFlag, _NEW_ARRAY_EDGEFLAG, + sizeof(GLboolean), 1, GL_UNSIGNED_BYTE, GL_RGBA, + stride, GL_FALSE, ptr); } @@ -620,13 +584,9 @@ _mesa_VertexAttribPointerNV(GLuint index, GLint size, GLenum type, return; } - if (!update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index], - _NEW_ARRAY_ATTRIB(index), - elementSize, size, type, format, stride, normalized, ptr)) - return; - - if (ctx->Driver.VertexAttribPointer) - ctx->Driver.VertexAttribPointer( ctx, index, size, type, stride, ptr ); + update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index], + _NEW_ARRAY_ATTRIB(index), + elementSize, size, type, format, stride, normalized, ptr); } #endif @@ -720,13 +680,9 @@ _mesa_VertexAttribPointerARB(GLuint index, GLint size, GLenum type, return; } - if (!update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index], - _NEW_ARRAY_ATTRIB(index), - elementSize, size, type, format, stride, normalized, ptr)) - return; - - if (ctx->Driver.VertexAttribPointer) - ctx->Driver.VertexAttribPointer(ctx, index, size, type, stride, ptr); + update_array(ctx, &ctx->Array.ArrayObj->VertexAttrib[index], + _NEW_ARRAY_ATTRIB(index), + elementSize, size, type, format, stride, normalized, ptr); } #endif @@ -989,9 +945,6 @@ _mesa_LockArraysEXT(GLint first, GLsizei count) ctx->NewState |= _NEW_ARRAY; ctx->Array.NewState |= _NEW_ARRAY_ALL; - - if (ctx->Driver.LockArraysEXT) - ctx->Driver.LockArraysEXT( ctx, first, count ); } @@ -1013,9 +966,6 @@ _mesa_UnlockArraysEXT( void ) ctx->Array.LockCount = 0; ctx->NewState |= _NEW_ARRAY; ctx->Array.NewState |= _NEW_ARRAY_ALL; - - if (ctx->Driver.UnlockArraysEXT) - ctx->Driver.UnlockArraysEXT( ctx ); } -- cgit v1.2.3 From d683acb101a65d0688bfd0818a0ddb4be16e376d Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Mon, 16 Nov 2009 15:03:48 -0500 Subject: r600: don't force Z order Let the hw decide (early vs late Z) fixes fdo bug 25092 Signed-off-by: Alex Deucher --- src/mesa/drivers/dri/r600/r700_state.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c index 41000dc8ce..d7420678ff 100644 --- a/src/mesa/drivers/dri/r600/r700_state.c +++ b/src/mesa/drivers/dri/r600/r700_state.c @@ -202,9 +202,6 @@ static void r700SetDBRenderState(GLcontext * ctx) SETbit(r700->DB_SHADER_CONTROL.u32All, DUAL_EXPORT_ENABLE_bit); SETfield(r700->DB_SHADER_CONTROL.u32All, EARLY_Z_THEN_LATE_Z, Z_ORDER_shift, Z_ORDER_mask); - /* XXX not sure if this is required */ - if (context->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV770) - SETbit(r700->DB_RENDER_OVERRIDE.u32All, FORCE_SHADER_Z_ORDER_bit); /* XXX need to enable htile for hiz/s */ SETfield(r700->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIZ_ENABLE_shift, FORCE_HIZ_ENABLE_mask); SETfield(r700->DB_RENDER_OVERRIDE.u32All, FORCE_DISABLE, FORCE_HIS_ENABLE0_shift, FORCE_HIS_ENABLE0_mask); -- cgit v1.2.3 From 5438ee3ecfe5c25102d196fd6d7258201e27e6ca Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 12 Nov 2009 11:16:30 +0100 Subject: st/xorg: Incase of format missmatch swizzle channels and set alpha This path is only hit for icons in gnome so far --- src/gallium/state_trackers/xorg/xorg_composite.c | 57 +++++++++++++++++++++++- src/gallium/state_trackers/xorg/xorg_exa.c | 39 +++++++++++++++- src/gallium/state_trackers/xorg/xorg_exa_tgsi.c | 48 +++++++++++++++++--- src/gallium/state_trackers/xorg/xorg_exa_tgsi.h | 4 ++ 4 files changed, 138 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 02dc949c93..1ff19a2a5c 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -228,10 +228,59 @@ bind_blend_state(struct exa_context *exa, int op, cso_set_blend(exa->renderer->cso, &blend); } +static unsigned +picture_format_fixups(struct exa_pixmap_priv *pSrc, PicturePtr pSrcPicture, boolean mask) +{ + boolean set_alpha = FALSE; + boolean swizzle = FALSE; + unsigned ret = 0; + + if (pSrc->picture_format == pSrcPicture->format) + return 0; + + if (pSrc->picture_format != PICT_a8r8g8b8) { + assert(!"can not handle formats"); + return 0; + } + + /* pSrc->picture_format == PICT_a8r8g8b8 */ + switch (pSrcPicture->format) { + case PICT_x8b8g8r8: + case PICT_b8g8r8: + set_alpha = TRUE; /* fall trough */ + case PICT_a8b8g8r8: + swizzle = TRUE; + break; + case PICT_x8r8g8b8: + case PICT_r8g8b8: + set_alpha = TRUE; /* fall through */ + case PICT_a8r8g8b8: + break; +#ifdef PICT_TYPE_BGRA + case PICT_b8g8r8a8: + case PICT_b8g8r8x8: + case PICT_a2r10g10b10: + case PICT_x2r10g10b10: + case PICT_a2b10g10r10: + case PICT_x2b10g10r10: +#endif + default: + assert(!"can not handle formats"); + return 0; + } + + if (set_alpha) + ret |= mask ? FS_MASK_SET_ALPHA : FS_SRC_SET_ALPHA; + if (swizzle) + ret |= mask ? FS_MASK_SWIZZLE_RGB : FS_SRC_SWIZZLE_RGB; + + return ret; +} static void bind_shaders(struct exa_context *exa, int op, - PicturePtr pSrcPicture, PicturePtr pMaskPicture) + PicturePtr pSrcPicture, PicturePtr pMaskPicture, + struct exa_pixmap_priv *pSrc, struct exa_pixmap_priv *pMask) { unsigned vs_traits = 0, fs_traits = 0; struct xorg_shader shader; @@ -257,6 +306,8 @@ bind_shaders(struct exa_context *exa, int op, fs_traits |= FS_COMPOSITE; vs_traits |= VS_COMPOSITE; } + + fs_traits |= picture_format_fixups(pSrc, pSrcPicture, FALSE); } if (pMaskPicture) { @@ -273,6 +324,8 @@ bind_shaders(struct exa_context *exa, int op, } else fs_traits |= FS_CA_FULL; } + + fs_traits |= picture_format_fixups(pMask, pMaskPicture, TRUE); } shader = xorg_shaders_get(exa->renderer->shaders, vs_traits, fs_traits); @@ -438,7 +491,7 @@ boolean xorg_composite_bind_state(struct exa_context *exa, renderer_bind_viewport(exa->renderer, pDst); bind_blend_state(exa, op, pSrcPicture, pMaskPicture, pDstPicture); renderer_bind_rasterizer(exa->renderer); - bind_shaders(exa, op, pSrcPicture, pMaskPicture); + bind_shaders(exa, op, pSrcPicture, pMaskPicture, pSrc, pMask); bind_samplers(exa, op, pSrcPicture, pMaskPicture, pDstPicture, pSrc, pMask, pDst); setup_constant_buffers(exa, pDst); diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 735cabfedf..25c9fce254 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -467,6 +467,41 @@ ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY, width, height); } +static Bool +picture_check_formats(struct exa_pixmap_priv *pSrc, PicturePtr pSrcPicture) +{ + if (pSrc->picture_format == pSrcPicture->format) + return TRUE; + + if (pSrc->picture_format != PICT_a8r8g8b8) + return FALSE; + + /* pSrc->picture_format == PICT_a8r8g8b8 */ + switch (pSrcPicture->format) { + case PICT_a8r8g8b8: + case PICT_x8r8g8b8: + case PICT_a8b8g8r8: + case PICT_x8b8g8r8: + /* just treat these two as x8... */ + case PICT_r8g8b8: + case PICT_b8g8r8: + return TRUE; +#ifdef PICT_TYPE_BGRA + case PICT_b8g8r8a8: + case PICT_b8g8r8x8: + return FALSE; /* does not support swizzleing the alpha channel yet */ + case PICT_a2r10g10b10: + case PICT_x2r10g10b10: + case PICT_a2b10g10r10: + case PICT_x2b10g10r10: + return FALSE; +#endif + default: + return FALSE; + } + return FALSE; +} + static Bool ExaPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture, @@ -512,7 +547,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, PIPE_TEXTURE_USAGE_SAMPLER, 0)) XORG_FALLBACK("pSrc format: %s", pf_name(priv->tex->format)); - if (priv->picture_format != pSrcPicture->format) + if (!picture_check_formats(priv, pSrcPicture)) XORG_FALLBACK("pSrc pic_format: %s != %s", render_format_name(priv->picture_format), render_format_name(pSrcPicture->format)); @@ -528,7 +563,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, PIPE_TEXTURE_USAGE_SAMPLER, 0)) XORG_FALLBACK("pMask format: %s", pf_name(priv->tex->format)); - if (priv->picture_format != pMaskPicture->format) + if (!picture_check_formats(priv, pMaskPicture)) XORG_FALLBACK("pMask pic_format: %s != %s", render_format_name(priv->picture_format), render_format_name(pMaskPicture->format)); diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c index f8557755ef..cbb9ec137e 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c @@ -359,12 +359,18 @@ xrender_tex(struct ureg_program *ureg, struct ureg_dst dst, struct ureg_src coords, struct ureg_src sampler, - boolean repeat_none) + boolean repeat_none, + boolean swizzle, + boolean set_alpha) { + struct ureg_src imm0 = { 0 }; + + if (repeat_none || set_alpha) + imm0 = ureg_imm4f(ureg, 0, 0, 0, 1); + if (repeat_none) { struct ureg_dst tmp0 = ureg_DECL_temporary(ureg); struct ureg_dst tmp1 = ureg_DECL_temporary(ureg); - struct ureg_src imm0 = ureg_imm4f(ureg, 0, 0, 0, 1); ureg_SGT(ureg, tmp1, ureg_swizzle(coords, TGSI_SWIZZLE_X, TGSI_SWIZZLE_Y, @@ -381,11 +387,37 @@ xrender_tex(struct ureg_program *ureg, ureg_MIN(ureg, tmp0, ureg_scalar(ureg_src(tmp0), TGSI_SWIZZLE_X), ureg_scalar(ureg_src(tmp0), TGSI_SWIZZLE_Y)); ureg_TEX(ureg, tmp1, TGSI_TEXTURE_2D, coords, sampler); + if (swizzle) + ureg_MOV(ureg, tmp1, ureg_swizzle(ureg_src(tmp1), + TGSI_SWIZZLE_Z, + TGSI_SWIZZLE_Y, + TGSI_SWIZZLE_X, + TGSI_SWIZZLE_W)); + if (set_alpha) + ureg_MOV(ureg, + ureg_writemask(tmp1, TGSI_WRITEMASK_W), + ureg_scalar(imm0, TGSI_SWIZZLE_W)); ureg_MUL(ureg, dst, ureg_src(tmp1), ureg_src(tmp0)); ureg_release_temporary(ureg, tmp0); ureg_release_temporary(ureg, tmp1); - } else - ureg_TEX(ureg, dst, TGSI_TEXTURE_2D, coords, sampler); + } else { + if (swizzle) { + struct ureg_dst tmp = ureg_DECL_temporary(ureg); + ureg_TEX(ureg, tmp, TGSI_TEXTURE_2D, coords, sampler); + ureg_MOV(ureg, dst, ureg_swizzle(ureg_src(tmp), + TGSI_SWIZZLE_Z, + TGSI_SWIZZLE_Y, + TGSI_SWIZZLE_X, + TGSI_SWIZZLE_W)); + ureg_release_temporary(ureg, tmp); + } else { + ureg_TEX(ureg, dst, TGSI_TEXTURE_2D, coords, sampler); + } + if (set_alpha) + ureg_MOV(ureg, + ureg_writemask(dst, TGSI_WRITEMASK_W), + ureg_scalar(imm0, TGSI_SWIZZLE_W)); + } } static void * @@ -407,6 +439,10 @@ create_fs(struct pipe_context *pipe, unsigned is_yuv = (fs_traits & FS_YUV) != 0; unsigned src_repeat_none = (fs_traits & FS_SRC_REPEAT_NONE) != 0; unsigned mask_repeat_none = (fs_traits & FS_MASK_REPEAT_NONE) != 0; + unsigned src_swizzle = (fs_traits & FS_SRC_SWIZZLE_RGB) != 0; + unsigned mask_swizzle = (fs_traits & FS_MASK_SWIZZLE_RGB) != 0; + unsigned src_set_alpha = (fs_traits & FS_SRC_SET_ALPHA) != 0; + unsigned mask_set_alpha = (fs_traits & FS_MASK_SET_ALPHA) != 0; ureg = ureg_create(TGSI_PROCESSOR_FRAGMENT); if (ureg == NULL) @@ -463,7 +499,7 @@ create_fs(struct pipe_context *pipe, else src = out; xrender_tex(ureg, src, src_input, src_sampler, - src_repeat_none); + src_repeat_none, src_swizzle, src_set_alpha); } else if (is_fill) { if (is_solid) { if (has_mask) @@ -503,7 +539,7 @@ create_fs(struct pipe_context *pipe, if (has_mask) { mask = ureg_DECL_temporary(ureg); xrender_tex(ureg, mask, mask_pos, mask_sampler, - mask_repeat_none); + mask_repeat_none, mask_swizzle, mask_set_alpha); /* src IN mask */ src_in_mask(ureg, out, ureg_src(src), ureg_src(mask), comp_alpha); ureg_release_temporary(ureg, mask); diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h index c038dc2231..062de947e6 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h @@ -28,6 +28,10 @@ enum xorg_fs_traits { FS_YUV = 1 << 7, FS_SRC_REPEAT_NONE = 1 << 8, FS_MASK_REPEAT_NONE = 1 << 9, + FS_SRC_SWIZZLE_RGB = 1 << 10, + FS_MASK_SWIZZLE_RGB = 1 << 11, + FS_SRC_SET_ALPHA = 1 << 12, + FS_MASK_SET_ALPHA = 1 << 13, FS_FILL = (FS_SOLID_FILL | FS_LINGRAD_FILL | -- cgit v1.2.3 From cb060f3b987c9fa07ebe06cf2e7e54d1eaded1e1 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 16 Nov 2009 22:57:43 +0100 Subject: st/xorg: Fix comp alpha code and deal with luminance masks There are two fixes in here one is a one liner that fixes component alpha logic. The other deals better with luminance formats used for masks, sources not yet implemented. Fixes component alpha text and icons in gnome. There are a one or two cases that this code misses. Like if src_luminance is set but no mask image is given. --- src/gallium/state_trackers/xorg/xorg_composite.c | 5 +- src/gallium/state_trackers/xorg/xorg_exa.c | 3 ++ src/gallium/state_trackers/xorg/xorg_exa_tgsi.c | 58 ++++++++++++++++++++++-- src/gallium/state_trackers/xorg/xorg_exa_tgsi.h | 2 + 4 files changed, 62 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 1ff19a2a5c..93a3e1b8cf 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -235,8 +235,11 @@ picture_format_fixups(struct exa_pixmap_priv *pSrc, PicturePtr pSrcPicture, bool boolean swizzle = FALSE; unsigned ret = 0; - if (pSrc->picture_format == pSrcPicture->format) + if (pSrc->picture_format == pSrcPicture->format) { + if (pSrc->picture_format == PICT_a8) + return mask ? FS_MASK_LUMINANCE : FS_MASK_LUMINANCE; return 0; + } if (pSrc->picture_format != PICT_a8r8g8b8) { assert(!"can not handle formats"); diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 25c9fce254..6fa274eb0a 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -551,6 +551,9 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, XORG_FALLBACK("pSrc pic_format: %s != %s", render_format_name(priv->picture_format), render_format_name(pSrcPicture->format)); + + if (priv->picture_format == PICT_a8) + XORG_FALLBACK("pSrc pic_format == PICT_a8"); } if (pMask) { diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c index cbb9ec137e..3bf64b6331 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c @@ -43,6 +43,38 @@ * OUT[0] = color */ +static void +print_fs_traits(int fs_traits) +{ + const char *strings[] = { + "FS_COMPOSITE", // = 1 << 0, + "FS_MASK", // = 1 << 1, + "FS_SOLID_FILL", // = 1 << 2, + "FS_LINGRAD_FILL", // = 1 << 3, + "FS_RADGRAD_FILL", // = 1 << 4, + "FS_CA_FULL", // = 1 << 5, /* src.rgba * mask.rgba */ + "FS_CA_SRCALPHA", // = 1 << 6, /* src.aaaa * mask.rgba */ + "FS_YUV", // = 1 << 7, + "FS_SRC_REPEAT_NONE", // = 1 << 8, + "FS_MASK_REPEAT_NONE",// = 1 << 9, + "FS_SRC_SWIZZLE_RGB", // = 1 << 10, + "FS_MASK_SWIZZLE_RGB",// = 1 << 11, + "FS_SRC_SET_ALPHA", // = 1 << 12, + "FS_MASK_SET_ALPHA", // = 1 << 13, + "FS_SRC_LUMINANCE", // = 1 << 14, + "FS_MASK_LUMINANCE", // = 1 << 15, + }; + int i, k; + debug_printf("%s: ", __func__); + + for (i = 0, k = 1; k < (1 << 16); i++, k <<= 1) { + if (fs_traits & k) + debug_printf("%s, ", strings[i]); + } + + debug_printf("\n"); +} + struct xorg_shaders { struct xorg_renderer *r; @@ -55,7 +87,8 @@ src_in_mask(struct ureg_program *ureg, struct ureg_dst dst, struct ureg_src src, struct ureg_src mask, - int component_alpha) + unsigned component_alpha, + unsigned mask_luminance) { if (component_alpha == FS_CA_FULL) { ureg_MUL(ureg, dst, src, mask); @@ -64,8 +97,12 @@ src_in_mask(struct ureg_program *ureg, ureg_scalar(src, TGSI_SWIZZLE_W), mask); } else { - ureg_MUL(ureg, dst, src, - ureg_scalar(mask, TGSI_SWIZZLE_X)); + if (mask_luminance) + ureg_MUL(ureg, dst, src, + ureg_scalar(mask, TGSI_SWIZZLE_X)); + else + ureg_MUL(ureg, dst, src, + ureg_scalar(mask, TGSI_SWIZZLE_W)); } } @@ -435,7 +472,7 @@ create_fs(struct pipe_context *pipe, unsigned is_solid = (fs_traits & FS_SOLID_FILL) != 0; unsigned is_lingrad = (fs_traits & FS_LINGRAD_FILL) != 0; unsigned is_radgrad = (fs_traits & FS_RADGRAD_FILL) != 0; - unsigned comp_alpha = (fs_traits & FS_COMPONENT_ALPHA) != 0; + unsigned comp_alpha_mask = fs_traits & FS_COMPONENT_ALPHA; unsigned is_yuv = (fs_traits & FS_YUV) != 0; unsigned src_repeat_none = (fs_traits & FS_SRC_REPEAT_NONE) != 0; unsigned mask_repeat_none = (fs_traits & FS_MASK_REPEAT_NONE) != 0; @@ -443,6 +480,16 @@ create_fs(struct pipe_context *pipe, unsigned mask_swizzle = (fs_traits & FS_MASK_SWIZZLE_RGB) != 0; unsigned src_set_alpha = (fs_traits & FS_SRC_SET_ALPHA) != 0; unsigned mask_set_alpha = (fs_traits & FS_MASK_SET_ALPHA) != 0; + unsigned src_luminance = (fs_traits & FS_SRC_LUMINANCE) != 0; + unsigned mask_luminance = (fs_traits & FS_MASK_LUMINANCE) != 0; + + if (src_luminance) + assert(!"src_luminance not supported"); +#if 0 + print_fs_traits(fs_traits); +#else + (void)print_fs_traits; +#endif ureg = ureg_create(TGSI_PROCESSOR_FRAGMENT); if (ureg == NULL) @@ -541,7 +588,8 @@ create_fs(struct pipe_context *pipe, xrender_tex(ureg, mask, mask_pos, mask_sampler, mask_repeat_none, mask_swizzle, mask_set_alpha); /* src IN mask */ - src_in_mask(ureg, out, ureg_src(src), ureg_src(mask), comp_alpha); + src_in_mask(ureg, out, ureg_src(src), ureg_src(mask), + comp_alpha_mask, mask_luminance); ureg_release_temporary(ureg, mask); } diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h index 062de947e6..6f2a361d03 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.h @@ -32,6 +32,8 @@ enum xorg_fs_traits { FS_MASK_SWIZZLE_RGB = 1 << 11, FS_SRC_SET_ALPHA = 1 << 12, FS_MASK_SET_ALPHA = 1 << 13, + FS_SRC_LUMINANCE = 1 << 14, + FS_MASK_LUMINANCE = 1 << 15, FS_FILL = (FS_SOLID_FILL | FS_LINGRAD_FILL | -- cgit v1.2.3 From 5fb07a4046a7f00f060bbc6dae92213e635d55f5 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 16 Nov 2009 14:30:47 -0800 Subject: AL1616: Add macros to pack two GLushorts into a texel --- src/mesa/main/colormac.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/mesa/main/colormac.h b/src/mesa/main/colormac.h index 7ae781ae23..905f4e2283 100644 --- a/src/mesa/main/colormac.h +++ b/src/mesa/main/colormac.h @@ -210,6 +210,12 @@ do { \ #define PACK_COLOR_88_REV( L, A ) \ (((A) << 8) | (L)) +#define PACK_COLOR_1616( L, A ) \ + (((L) << 16) | (A)) + +#define PACK_COLOR_1616_REV( L, A ) \ + (((A) << 16) | (L)) + #define PACK_COLOR_332( R, G, B ) \ (((R) & 0xe0) | (((G) & 0xe0) >> 3) | (((B) & 0xc0) >> 6)) -- cgit v1.2.3 From eb437fabe017611e1f855fffa45f59cd38709be8 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 16 Nov 2009 14:49:40 -0800 Subject: AL1616: Add formats for GL_LUMINANCE16_ALPHA16 textures --- src/mesa/main/formats.c | 25 +++++++++++++++++++++++++ src/mesa/main/formats.h | 2 ++ 2 files changed, 27 insertions(+) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 7d0e2d2914..7d64c462b1 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -231,6 +231,24 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 8, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 2 /* BlockWidth/Height,Bytes */ }, + { + MESA_FORMAT_AL1616, /* Name */ + "MESA_FORMAT_AL1616", /* StrName */ + GL_LUMINANCE_ALPHA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */ + 16, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, + { + MESA_FORMAT_AL1616_REV, /* Name */ + "MESA_FORMAT_AL1616_REV", /* StrName */ + GL_LUMINANCE_ALPHA, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 0, 0, 0, 16, /* Red/Green/Blue/AlphaBits */ + 16, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, { MESA_FORMAT_RGB332, /* Name */ "MESA_FORMAT_RGB332", /* StrName */ @@ -974,6 +992,13 @@ _mesa_format_to_type_and_comps(gl_format format, *datatype = GL_UNSIGNED_BYTE; *comps = 2; return; + + case MESA_FORMAT_AL1616: + case MESA_FORMAT_AL1616_REV: + *datatype = GL_UNSIGNED_SHORT; + *comps = 2; + return; + case MESA_FORMAT_RGB332: *datatype = GL_UNSIGNED_BYTE_3_3_2; *comps = 3; diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index fa6359f5c8..d3ac436b1b 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -66,6 +66,8 @@ typedef enum MESA_FORMAT_ARGB1555_REV, /* GGGB BBBB ARRR RRGG */ MESA_FORMAT_AL88, /* AAAA AAAA LLLL LLLL */ MESA_FORMAT_AL88_REV, /* LLLL LLLL AAAA AAAA */ + MESA_FORMAT_AL1616, /* AAAA AAAA AAAA AAAA LLLL LLLL LLLL LLLL */ + MESA_FORMAT_AL1616_REV, /* LLLL LLLL LLLL LLLL AAAA AAAA AAAA AAAA */ MESA_FORMAT_RGB332, /* RRRG GGBB */ MESA_FORMAT_A8, /* AAAA AAAA */ MESA_FORMAT_L8, /* LLLL LLLL */ -- cgit v1.2.3 From 975871b4d5e25ddcd350f4e1600c00d37f65fea1 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 16 Nov 2009 14:52:43 -0800 Subject: AL1616: Add texel fetch / store routines --- src/mesa/main/texfetch.c | 14 +++++++++++++ src/mesa/main/texfetch_tmp.h | 48 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) (limited to 'src') diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c index 314ccb7b65..c431d3a1db 100644 --- a/src/mesa/main/texfetch.c +++ b/src/mesa/main/texfetch.c @@ -452,6 +452,20 @@ texfetch_funcs[MESA_FORMAT_COUNT] = fetch_texel_3d_f_al88_rev, store_texel_al88_rev }, + { + MESA_FORMAT_AL1616, + fetch_texel_1d_f_al1616, + fetch_texel_2d_f_al1616, + fetch_texel_3d_f_al1616, + store_texel_al1616 + }, + { + MESA_FORMAT_AL1616_REV, + fetch_texel_1d_f_al1616_rev, + fetch_texel_2d_f_al1616_rev, + fetch_texel_3d_f_al1616_rev, + store_texel_al1616_rev + }, { MESA_FORMAT_RGB332, fetch_texel_1d_f_rgb332, diff --git a/src/mesa/main/texfetch_tmp.h b/src/mesa/main/texfetch_tmp.h index 27434946ec..093e0abc49 100644 --- a/src/mesa/main/texfetch_tmp.h +++ b/src/mesa/main/texfetch_tmp.h @@ -834,6 +834,54 @@ static void store_texel_al88_rev(struct gl_texture_image *texImage, #endif +/* MESA_FORMAT_AL1616 ********************************************************/ + +/* Fetch texel from 1D, 2D or 3D al1616 texture, return 4 GLchans */ +static void FETCH(f_al1616)( const struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, GLfloat *texel ) +{ + const GLuint s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + texel[RCOMP] = + texel[GCOMP] = + texel[BCOMP] = USHORT_TO_FLOAT( s & 0xffff ); + texel[ACOMP] = USHORT_TO_FLOAT( s >> 16 ); +} + +#if DIM == 3 +static void store_texel_al1616(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLushort *rgba = (const GLushort *) texel; + GLuint *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + *dst = PACK_COLOR_1616(rgba[ACOMP], rgba[RCOMP]); +} +#endif + + +/* MESA_FORMAT_AL1616_REV ****************************************************/ + +/* Fetch texel from 1D, 2D or 3D al1616_rev texture, return 4 GLchans */ +static void FETCH(f_al1616_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] = + texel[GCOMP] = + texel[BCOMP] = USHORT_TO_FLOAT( s >> 16 ); + texel[ACOMP] = USHORT_TO_FLOAT( s & 0xffff ); +} + +#if DIM == 3 +static void store_texel_al1616_rev(struct gl_texture_image *texImage, + GLint i, GLint j, GLint k, const void *texel) +{ + const GLushort *rgba = (const GLushort *) texel; + GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); + *dst = PACK_COLOR_1616(rgba[RCOMP], rgba[ACOMP]); +} +#endif + + /* MESA_FORMAT_RGB332 ********************************************************/ /* Fetch texel from 1D, 2D or 3D rgb332 texture, return 4 GLchans */ -- cgit v1.2.3 From 3325dc91be2534079ebf7997700b6e5f17a75283 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 16 Nov 2009 14:53:12 -0800 Subject: AL1616: Add TexImage storage path --- src/mesa/main/texstore.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) (limited to 'src') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index e48d472061..f43e216bc5 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2145,6 +2145,77 @@ _mesa_texstore_al88(TEXSTORE_PARAMS) } +static GLboolean +_mesa_texstore_al1616(TEXSTORE_PARAMS) +{ + const GLboolean littleEndian = _mesa_little_endian(); + const GLuint texelBytes = _mesa_get_format_bytes(dstFormat); + const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); + + ASSERT(dstFormat == MESA_FORMAT_AL1616 || + dstFormat == MESA_FORMAT_AL1616_REV); + ASSERT(texelBytes == 4); + + if (!ctx->_ImageTransferState && + !srcPacking->SwapBytes && + dstFormat == MESA_FORMAT_AL1616 && + baseInternalFormat == GL_LUMINANCE_ALPHA && + srcFormat == GL_LUMINANCE_ALPHA && + srcType == GL_UNSIGNED_SHORT && + littleEndian) { + /* simple memcpy path */ + memcpy_texture(ctx, dims, + dstFormat, dstAddr, dstXoffset, dstYoffset, dstZoffset, + dstRowStride, + dstImageOffsets, + srcWidth, srcHeight, srcDepth, srcFormat, srcType, + srcAddr, srcPacking); + } + else { + /* general path */ + const GLfloat *tempImage = make_temp_float_image(ctx, dims, + baseInternalFormat, + baseFormat, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + const GLfloat *src = 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] * texelBytes + + dstYoffset * dstRowStride + + dstXoffset * texelBytes; + for (row = 0; row < srcHeight; row++) { + GLuint *dstUI = (GLuint *) dstRow; + if (dstFormat == MESA_FORMAT_AL1616) { + for (col = 0; col < srcWidth; col++) { + /* src[0] is luminance, src[1] is alpha */ + dstUI[col] = PACK_COLOR_88( FLOAT_TO_USHORT(src[1]), + FLOAT_TO_USHORT(src[0]) ); + src += 2; + } + } + else { + for (col = 0; col < srcWidth; col++) { + /* src[0] is luminance, src[1] is alpha */ + dstUI[col] = PACK_COLOR_1616_REV( FLOAT_TO_UBYTE(src[1]), + FLOAT_TO_UBYTE(src[0]) ); + src += 2; + } + } + dstRow += dstRowStride; + } + } + _mesa_free((void *) tempImage); + } + return GL_TRUE; +} + + static GLboolean _mesa_texstore_rgb332(TEXSTORE_PARAMS) { @@ -3073,6 +3144,8 @@ texstore_funcs[MESA_FORMAT_COUNT] = { MESA_FORMAT_ARGB1555_REV, _mesa_texstore_argb1555 }, { MESA_FORMAT_AL88, _mesa_texstore_al88 }, { MESA_FORMAT_AL88_REV, _mesa_texstore_al88 }, + { MESA_FORMAT_AL1616, _mesa_texstore_al1616 }, + { MESA_FORMAT_AL1616_REV, _mesa_texstore_al1616 }, { MESA_FORMAT_RGB332, _mesa_texstore_rgb332 }, { MESA_FORMAT_A8, _mesa_texstore_a8 }, { MESA_FORMAT_L8, _mesa_texstore_a8 }, -- cgit v1.2.3 From 12982e381d3474c5c00f89cc442d442df097339b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 16 Nov 2009 14:53:36 -0800 Subject: AL1616: Enable MESA_FORMAT_AL1616 for software paths --- src/mesa/main/texformat.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 39c561e278..1a374e7bee 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -115,11 +115,13 @@ _mesa_choose_tex_format( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE_ALPHA: case GL_LUMINANCE4_ALPHA4: case GL_LUMINANCE6_ALPHA2: + case GL_LUMINANCE8_ALPHA8: + return MESA_FORMAT_AL88; + case GL_LUMINANCE12_ALPHA4: case GL_LUMINANCE12_ALPHA12: case GL_LUMINANCE16_ALPHA16: - case GL_LUMINANCE8_ALPHA8: - return MESA_FORMAT_AL88; + return MESA_FORMAT_AL1616; case GL_INTENSITY: case GL_INTENSITY4: -- cgit v1.2.3 From b1616b2a811b9a161d1ee2a8251e0efe32a8c192 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 16 Nov 2009 14:56:17 -0800 Subject: Move 'static' to start of declaration to silence compiler warning --- src/mesa/main/texstore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index f43e216bc5..7cf3287713 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -3121,7 +3121,7 @@ _mesa_texstore_sla8(TEXSTORE_PARAMS) * Table mapping MESA_FORMAT_8 to _mesa_texstore_*() * XXX this is somewhat temporary. */ -const static struct { +static const struct { gl_format Name; StoreTexImageFunc Store; } -- cgit v1.2.3 From fdfbae3381553fc93202560abe3b41b4d543f0bf Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 16 Nov 2009 15:09:24 -0800 Subject: i965: Use MESA_FORMAT_AL1616 when appropriate --- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 3 +++ src/mesa/drivers/dri/intel/intel_tex_format.c | 12 +++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src') 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 e2f0a383e7..47035cc6fc 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -86,6 +86,9 @@ static GLuint translate_tex_format( gl_format mesa_format, case MESA_FORMAT_AL88: return BRW_SURFACEFORMAT_L8A8_UNORM; + case MESA_FORMAT_AL1616: + return BRW_SURFACEFORMAT_L16A16_UNORM; + case MESA_FORMAT_RGB888: assert(0); /* not supported for sampling */ return BRW_SURFACEFORMAT_R8G8B8_UNORM; diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c index f37a545c7f..bfa3dba1f5 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_format.c +++ b/src/mesa/drivers/dri/intel/intel_tex_format.c @@ -95,14 +95,20 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_COMPRESSED_LUMINANCE: return MESA_FORMAT_L8; + case GL_LUMINANCE12_ALPHA4: + case GL_LUMINANCE12_ALPHA12: + case GL_LUMINANCE16_ALPHA16: +#ifndef I915 + return MESA_FORMAT_AL1616; +#else + /* FALLTHROUGH */ +#endif + case 2: case GL_LUMINANCE_ALPHA: case GL_LUMINANCE4_ALPHA4: case GL_LUMINANCE6_ALPHA2: case GL_LUMINANCE8_ALPHA8: - case GL_LUMINANCE12_ALPHA4: - case GL_LUMINANCE12_ALPHA12: - case GL_LUMINANCE16_ALPHA16: case GL_COMPRESSED_LUMINANCE_ALPHA: return MESA_FORMAT_AL88; -- cgit v1.2.3 From 648e8b4c46e9ab0374fdbe655321157125b7efe5 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 17 Nov 2009 00:39:09 +0100 Subject: st/xorg: Fix copy-pasto Thanks Alan. --- src/gallium/state_trackers/xorg/xorg_composite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 93a3e1b8cf..733bd53fca 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -237,7 +237,7 @@ picture_format_fixups(struct exa_pixmap_priv *pSrc, PicturePtr pSrcPicture, bool if (pSrc->picture_format == pSrcPicture->format) { if (pSrc->picture_format == PICT_a8) - return mask ? FS_MASK_LUMINANCE : FS_MASK_LUMINANCE; + return mask ? FS_MASK_LUMINANCE : FS_SRC_LUMINANCE; return 0; } -- cgit v1.2.3 From 3192633d4abe262d413e41feb871fe8deed409d8 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 16 Nov 2009 19:56:18 +0100 Subject: svga: Add svga driver --- src/gallium/drivers/svga/Makefile | 63 + src/gallium/drivers/svga/SConscript | 75 + src/gallium/drivers/svga/include/README | 3 + src/gallium/drivers/svga/include/svga3d_caps.h | 139 + src/gallium/drivers/svga/include/svga3d_reg.h | 1793 +++++++++++++ .../drivers/svga/include/svga3d_shaderdefs.h | 519 ++++ src/gallium/drivers/svga/include/svga_reg.h | 1346 ++++++++++ src/gallium/drivers/svga/include/svga_types.h | 46 + src/gallium/drivers/svga/svga_cmd.c | 1427 ++++++++++ src/gallium/drivers/svga/svga_cmd.h | 235 ++ src/gallium/drivers/svga/svga_context.c | 269 ++ src/gallium/drivers/svga/svga_context.h | 443 ++++ src/gallium/drivers/svga/svga_debug.h | 74 + src/gallium/drivers/svga/svga_draw.c | 370 +++ src/gallium/drivers/svga/svga_draw.h | 83 + src/gallium/drivers/svga/svga_draw_arrays.c | 297 +++ src/gallium/drivers/svga/svga_draw_elements.c | 255 ++ src/gallium/drivers/svga/svga_draw_private.h | 158 ++ src/gallium/drivers/svga/svga_hw_reg.h | 42 + src/gallium/drivers/svga/svga_pipe_blend.c | 246 ++ src/gallium/drivers/svga/svga_pipe_blit.c | 84 + src/gallium/drivers/svga/svga_pipe_clear.c | 119 + src/gallium/drivers/svga/svga_pipe_constants.c | 74 + src/gallium/drivers/svga/svga_pipe_depthstencil.c | 153 ++ src/gallium/drivers/svga/svga_pipe_draw.c | 261 ++ src/gallium/drivers/svga/svga_pipe_flush.c | 68 + src/gallium/drivers/svga/svga_pipe_fs.c | 124 + src/gallium/drivers/svga/svga_pipe_misc.c | 187 ++ src/gallium/drivers/svga/svga_pipe_query.c | 267 ++ src/gallium/drivers/svga/svga_pipe_rasterizer.c | 250 ++ src/gallium/drivers/svga/svga_pipe_sampler.c | 243 ++ src/gallium/drivers/svga/svga_pipe_vertex.c | 115 + src/gallium/drivers/svga/svga_pipe_vs.c | 189 ++ src/gallium/drivers/svga/svga_screen.c | 435 ++++ src/gallium/drivers/svga/svga_screen.h | 95 + src/gallium/drivers/svga/svga_screen_buffer.c | 820 ++++++ src/gallium/drivers/svga/svga_screen_buffer.h | 190 ++ src/gallium/drivers/svga/svga_screen_cache.c | 307 +++ src/gallium/drivers/svga/svga_screen_cache.h | 135 + src/gallium/drivers/svga/svga_screen_texture.c | 1065 ++++++++ src/gallium/drivers/svga/svga_screen_texture.h | 177 ++ src/gallium/drivers/svga/svga_state.c | 278 ++ src/gallium/drivers/svga/svga_state.h | 95 + src/gallium/drivers/svga/svga_state_constants.c | 239 ++ src/gallium/drivers/svga/svga_state_framebuffer.c | 455 ++++ src/gallium/drivers/svga/svga_state_fs.c | 282 ++ src/gallium/drivers/svga/svga_state_need_swtnl.c | 200 ++ src/gallium/drivers/svga/svga_state_rss.c | 268 ++ src/gallium/drivers/svga/svga_state_tss.c | 279 ++ src/gallium/drivers/svga/svga_state_vdecl.c | 182 ++ src/gallium/drivers/svga/svga_state_vs.c | 239 ++ src/gallium/drivers/svga/svga_swtnl.h | 52 + src/gallium/drivers/svga/svga_swtnl_backend.c | 349 +++ src/gallium/drivers/svga/svga_swtnl_draw.c | 170 ++ src/gallium/drivers/svga/svga_swtnl_private.h | 93 + src/gallium/drivers/svga/svga_swtnl_state.c | 242 ++ src/gallium/drivers/svga/svga_tgsi.c | 266 ++ src/gallium/drivers/svga/svga_tgsi.h | 139 + src/gallium/drivers/svga/svga_tgsi_decl_sm20.c | 280 ++ src/gallium/drivers/svga/svga_tgsi_decl_sm30.c | 385 +++ src/gallium/drivers/svga/svga_tgsi_emit.h | 345 +++ src/gallium/drivers/svga/svga_tgsi_insn.c | 2716 ++++++++++++++++++++ src/gallium/drivers/svga/svga_winsys.h | 299 +++ src/gallium/drivers/svga/svgadump/st_shader.h | 214 ++ src/gallium/drivers/svga/svgadump/st_shader_dump.c | 649 +++++ src/gallium/drivers/svga/svgadump/st_shader_dump.h | 42 + src/gallium/drivers/svga/svgadump/st_shader_op.c | 168 ++ src/gallium/drivers/svga/svgadump/st_shader_op.h | 46 + src/gallium/drivers/svga/svgadump/svga_dump.c | 1736 +++++++++++++ src/gallium/drivers/svga/svgadump/svga_dump.h | 34 + src/gallium/drivers/svga/svgadump/svga_dump.py | 329 +++ src/gallium/winsys/drm/vmware/Makefile | 12 + src/gallium/winsys/drm/vmware/SConscript | 11 + src/gallium/winsys/drm/vmware/core/Makefile | 47 + src/gallium/winsys/drm/vmware/core/SConscript | 39 + src/gallium/winsys/drm/vmware/core/vmw_buffer.c | 274 ++ src/gallium/winsys/drm/vmware/core/vmw_buffer.h | 65 + src/gallium/winsys/drm/vmware/core/vmw_context.c | 297 +++ src/gallium/winsys/drm/vmware/core/vmw_context.h | 59 + src/gallium/winsys/drm/vmware/core/vmw_fence.c | 108 + src/gallium/winsys/drm/vmware/core/vmw_fence.h | 59 + src/gallium/winsys/drm/vmware/core/vmw_screen.c | 74 + src/gallium/winsys/drm/vmware/core/vmw_screen.h | 134 + .../winsys/drm/vmware/core/vmw_screen_dri.c | 371 +++ .../winsys/drm/vmware/core/vmw_screen_ioctl.c | 503 ++++ .../winsys/drm/vmware/core/vmw_screen_pools.c | 79 + .../winsys/drm/vmware/core/vmw_screen_svga.c | 295 +++ src/gallium/winsys/drm/vmware/core/vmw_surface.c | 59 + src/gallium/winsys/drm/vmware/core/vmw_surface.h | 79 + src/gallium/winsys/drm/vmware/dri/Makefile | 18 + src/gallium/winsys/drm/vmware/dri/SConscript | 63 + src/gallium/winsys/drm/vmware/egl/Makefile | 18 + src/gallium/winsys/drm/vmware/xorg/Makefile | 54 + src/gallium/winsys/drm/vmware/xorg/SConscript | 55 + src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c | 150 ++ 95 files changed, 27235 insertions(+) create mode 100644 src/gallium/drivers/svga/Makefile create mode 100644 src/gallium/drivers/svga/SConscript create mode 100644 src/gallium/drivers/svga/include/README create mode 100644 src/gallium/drivers/svga/include/svga3d_caps.h create mode 100644 src/gallium/drivers/svga/include/svga3d_reg.h create mode 100644 src/gallium/drivers/svga/include/svga3d_shaderdefs.h create mode 100644 src/gallium/drivers/svga/include/svga_reg.h create mode 100644 src/gallium/drivers/svga/include/svga_types.h create mode 100644 src/gallium/drivers/svga/svga_cmd.c create mode 100644 src/gallium/drivers/svga/svga_cmd.h create mode 100644 src/gallium/drivers/svga/svga_context.c create mode 100644 src/gallium/drivers/svga/svga_context.h create mode 100644 src/gallium/drivers/svga/svga_debug.h create mode 100644 src/gallium/drivers/svga/svga_draw.c create mode 100644 src/gallium/drivers/svga/svga_draw.h create mode 100644 src/gallium/drivers/svga/svga_draw_arrays.c create mode 100644 src/gallium/drivers/svga/svga_draw_elements.c create mode 100644 src/gallium/drivers/svga/svga_draw_private.h create mode 100644 src/gallium/drivers/svga/svga_hw_reg.h create mode 100644 src/gallium/drivers/svga/svga_pipe_blend.c create mode 100644 src/gallium/drivers/svga/svga_pipe_blit.c create mode 100644 src/gallium/drivers/svga/svga_pipe_clear.c create mode 100644 src/gallium/drivers/svga/svga_pipe_constants.c create mode 100644 src/gallium/drivers/svga/svga_pipe_depthstencil.c create mode 100644 src/gallium/drivers/svga/svga_pipe_draw.c create mode 100644 src/gallium/drivers/svga/svga_pipe_flush.c create mode 100644 src/gallium/drivers/svga/svga_pipe_fs.c create mode 100644 src/gallium/drivers/svga/svga_pipe_misc.c create mode 100644 src/gallium/drivers/svga/svga_pipe_query.c create mode 100644 src/gallium/drivers/svga/svga_pipe_rasterizer.c create mode 100644 src/gallium/drivers/svga/svga_pipe_sampler.c create mode 100644 src/gallium/drivers/svga/svga_pipe_vertex.c create mode 100644 src/gallium/drivers/svga/svga_pipe_vs.c create mode 100644 src/gallium/drivers/svga/svga_screen.c create mode 100644 src/gallium/drivers/svga/svga_screen.h create mode 100644 src/gallium/drivers/svga/svga_screen_buffer.c create mode 100644 src/gallium/drivers/svga/svga_screen_buffer.h create mode 100644 src/gallium/drivers/svga/svga_screen_cache.c create mode 100644 src/gallium/drivers/svga/svga_screen_cache.h create mode 100644 src/gallium/drivers/svga/svga_screen_texture.c create mode 100644 src/gallium/drivers/svga/svga_screen_texture.h create mode 100644 src/gallium/drivers/svga/svga_state.c create mode 100644 src/gallium/drivers/svga/svga_state.h create mode 100644 src/gallium/drivers/svga/svga_state_constants.c create mode 100644 src/gallium/drivers/svga/svga_state_framebuffer.c create mode 100644 src/gallium/drivers/svga/svga_state_fs.c create mode 100644 src/gallium/drivers/svga/svga_state_need_swtnl.c create mode 100644 src/gallium/drivers/svga/svga_state_rss.c create mode 100644 src/gallium/drivers/svga/svga_state_tss.c create mode 100644 src/gallium/drivers/svga/svga_state_vdecl.c create mode 100644 src/gallium/drivers/svga/svga_state_vs.c create mode 100644 src/gallium/drivers/svga/svga_swtnl.h create mode 100644 src/gallium/drivers/svga/svga_swtnl_backend.c create mode 100644 src/gallium/drivers/svga/svga_swtnl_draw.c create mode 100644 src/gallium/drivers/svga/svga_swtnl_private.h create mode 100644 src/gallium/drivers/svga/svga_swtnl_state.c create mode 100644 src/gallium/drivers/svga/svga_tgsi.c create mode 100644 src/gallium/drivers/svga/svga_tgsi.h create mode 100644 src/gallium/drivers/svga/svga_tgsi_decl_sm20.c create mode 100644 src/gallium/drivers/svga/svga_tgsi_decl_sm30.c create mode 100644 src/gallium/drivers/svga/svga_tgsi_emit.h create mode 100644 src/gallium/drivers/svga/svga_tgsi_insn.c create mode 100644 src/gallium/drivers/svga/svga_winsys.h create mode 100644 src/gallium/drivers/svga/svgadump/st_shader.h create mode 100644 src/gallium/drivers/svga/svgadump/st_shader_dump.c create mode 100644 src/gallium/drivers/svga/svgadump/st_shader_dump.h create mode 100644 src/gallium/drivers/svga/svgadump/st_shader_op.c create mode 100644 src/gallium/drivers/svga/svgadump/st_shader_op.h create mode 100644 src/gallium/drivers/svga/svgadump/svga_dump.c create mode 100644 src/gallium/drivers/svga/svgadump/svga_dump.h create mode 100755 src/gallium/drivers/svga/svgadump/svga_dump.py create mode 100644 src/gallium/winsys/drm/vmware/Makefile create mode 100644 src/gallium/winsys/drm/vmware/SConscript create mode 100644 src/gallium/winsys/drm/vmware/core/Makefile create mode 100644 src/gallium/winsys/drm/vmware/core/SConscript create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_buffer.c create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_buffer.h create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_context.c create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_context.h create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_fence.c create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_fence.h create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_screen.c create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_screen.h create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_screen_pools.c create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_screen_svga.c create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_surface.c create mode 100644 src/gallium/winsys/drm/vmware/core/vmw_surface.h create mode 100644 src/gallium/winsys/drm/vmware/dri/Makefile create mode 100644 src/gallium/winsys/drm/vmware/dri/SConscript create mode 100644 src/gallium/winsys/drm/vmware/egl/Makefile create mode 100644 src/gallium/winsys/drm/vmware/xorg/Makefile create mode 100644 src/gallium/winsys/drm/vmware/xorg/SConscript create mode 100644 src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c (limited to 'src') diff --git a/src/gallium/drivers/svga/Makefile b/src/gallium/drivers/svga/Makefile new file mode 100644 index 0000000000..05ab4ab9b3 --- /dev/null +++ b/src/gallium/drivers/svga/Makefile @@ -0,0 +1,63 @@ +TOP = ../../../.. +include $(TOP)/configs/current + +LIBNAME = svga + +C_SOURCES = \ + svgadump/st_shader_dump.c \ + svgadump/st_shader_op.c \ + svgadump/svga_dump.c \ + svga_cmd.c \ + svga_context.c \ + svga_draw.c \ + svga_draw_arrays.c \ + svga_draw_elements.c \ + svga_pipe_blend.c \ + svga_pipe_blit.c \ + svga_pipe_clear.c \ + svga_pipe_constants.c \ + svga_pipe_depthstencil.c \ + svga_pipe_draw.c \ + svga_pipe_flush.c \ + svga_pipe_fs.c \ + svga_pipe_misc.c \ + svga_pipe_query.c \ + svga_pipe_rasterizer.c \ + svga_pipe_sampler.c \ + svga_pipe_vertex.c \ + svga_pipe_vs.c \ + svga_screen.c \ + svga_screen_buffer.c \ + svga_screen_texture.c \ + svga_screen_cache.c \ + svga_state.c \ + svga_state_need_swtnl.c \ + svga_state_constants.c \ + svga_state_framebuffer.c \ + svga_state_rss.c \ + svga_state_tss.c \ + svga_state_vdecl.c \ + svga_state_fs.c \ + svga_state_vs.c \ + svga_swtnl_backend.c \ + svga_swtnl_draw.c \ + svga_swtnl_state.c \ + svga_tgsi.c \ + svga_tgsi_decl_sm20.c \ + svga_tgsi_decl_sm30.c \ + svga_tgsi_insn.c + +LIBRARY_INCLUDES = \ + -I$(TOP)/src/gallium/drivers/svga/include + +LIBRARY_DEFINES = \ + -DHAVE_STDINT_H -DHAVE_SYS_TYPES_H + +CC = gcc -fvisibility=hidden -msse -msse2 + +# Set the gnu99 standard to enable anonymous structs in vmware headers. +# +CFLAGS = -Wall -Werror -Wmissing-prototypes -std=gnu99 -ffast-math \ + $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) $(ASM_FLAGS) + +include ../../Makefile.template diff --git a/src/gallium/drivers/svga/SConscript b/src/gallium/drivers/svga/SConscript new file mode 100644 index 0000000000..0fa745c9b8 --- /dev/null +++ b/src/gallium/drivers/svga/SConscript @@ -0,0 +1,75 @@ +Import('*') + +env = env.Clone() + +if env['platform'] in ['linux']: + env.Append(CCFLAGS = ['-fvisibility=hidden']) + +if env['gcc']: + env.Append(CPPDEFINES = [ + 'HAVE_STDINT_H', + 'HAVE_SYS_TYPES_H', + ]) + if env['platform'] not in ['windows']: + # The Windows headers cause many gcc warnings + env.Append(CCFLAGS = ['-Werror']) + +env.Prepend(CPPPATH = [ + 'include', +]) + +env.Append(CPPDEFINES = [ +]) + +sources = [ + 'svga_cmd.c', + 'svga_context.c', + 'svga_draw.c', + 'svga_draw_arrays.c', + 'svga_draw_elements.c', + 'svga_pipe_blend.c', + 'svga_pipe_blit.c', + 'svga_pipe_clear.c', + 'svga_pipe_constants.c', + 'svga_pipe_depthstencil.c', + 'svga_pipe_draw.c', + 'svga_pipe_flush.c', + 'svga_pipe_fs.c', + 'svga_pipe_misc.c', + 'svga_pipe_query.c', + 'svga_pipe_rasterizer.c', + 'svga_pipe_sampler.c', + 'svga_pipe_vertex.c', + 'svga_pipe_vs.c', + 'svga_screen.c', + 'svga_screen_buffer.c', + 'svga_screen_cache.c', + 'svga_screen_texture.c', + 'svga_state.c', + 'svga_state_constants.c', + 'svga_state_framebuffer.c', + 'svga_state_need_swtnl.c', + 'svga_state_rss.c', + 'svga_state_tss.c', + 'svga_state_vdecl.c', + 'svga_state_fs.c', + 'svga_state_vs.c', + 'svga_swtnl_backend.c', + 'svga_swtnl_draw.c', + 'svga_swtnl_state.c', + 'svga_tgsi.c', + 'svga_tgsi_decl_sm20.c', + 'svga_tgsi_decl_sm30.c', + 'svga_tgsi_insn.c', + + 'svgadump/svga_dump.c', + 'svgadump/st_shader_dump.c', + 'svgadump/st_shader_op.c', +] + +svga = env.ConvenienceLibrary( + target = 'svga', + source = sources, +) + +Export('svga') diff --git a/src/gallium/drivers/svga/include/README b/src/gallium/drivers/svga/include/README new file mode 100644 index 0000000000..a0b8916104 --- /dev/null +++ b/src/gallium/drivers/svga/include/README @@ -0,0 +1,3 @@ +This directory contains the headers from the VMware SVGA Device Developer Kit: + + https://vmware-svga.svn.sourceforge.net/svnroot/vmware-svga/trunk/lib/vmware/ diff --git a/src/gallium/drivers/svga/include/svga3d_caps.h b/src/gallium/drivers/svga/include/svga3d_caps.h new file mode 100644 index 0000000000..714ce9f45f --- /dev/null +++ b/src/gallium/drivers/svga/include/svga3d_caps.h @@ -0,0 +1,139 @@ +/********************************************************** + * Copyright 2007-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, 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. + * + **********************************************************/ + +/* + * svga3d_caps.h -- + * + * Definitions for SVGA3D hardware capabilities. Capabilities + * are used to query for optional rendering features during + * driver initialization. The capability data is stored as very + * basic key/value dictionary within the "FIFO register" memory + * area at the beginning of BAR2. + * + * Note that these definitions are only for 3D capabilities. + * The SVGA device also has "device capabilities" and "FIFO + * capabilities", which are non-3D-specific and are stored as + * bitfields rather than key/value pairs. + */ + +#ifndef _SVGA3D_CAPS_H_ +#define _SVGA3D_CAPS_H_ + +#define SVGA_FIFO_3D_CAPS_SIZE (SVGA_FIFO_3D_CAPS_LAST - \ + SVGA_FIFO_3D_CAPS + 1) + + +/* + * SVGA3dCapsRecordType + * + * Record types that can be found in the caps block. + * Related record types are grouped together numerically so that + * SVGA3dCaps_FindRecord() can be applied on a range of record + * types. + */ + +typedef enum { + SVGA3DCAPS_RECORD_UNKNOWN = 0, + SVGA3DCAPS_RECORD_DEVCAPS_MIN = 0x100, + SVGA3DCAPS_RECORD_DEVCAPS = 0x100, + SVGA3DCAPS_RECORD_DEVCAPS_MAX = 0x1ff, +} SVGA3dCapsRecordType; + + +/* + * SVGA3dCapsRecordHeader + * + * Header field leading each caps block record. Contains the offset (in + * register words, NOT bytes) to the next caps block record (or the end + * of caps block records which will be a zero word) and the record type + * as defined above. + */ + +typedef +struct SVGA3dCapsRecordHeader { + uint32 length; + SVGA3dCapsRecordType type; +} +SVGA3dCapsRecordHeader; + + +/* + * SVGA3dCapsRecord + * + * Caps block record; "data" is a placeholder for the actual data structure + * contained within the record; for example a record containing a FOOBAR + * structure would be of size "sizeof(SVGA3dCapsRecordHeader) + + * sizeof(FOOBAR)". + */ + +typedef +struct SVGA3dCapsRecord { + SVGA3dCapsRecordHeader header; + uint32 data[1]; +} +SVGA3dCapsRecord; + + +typedef uint32 SVGA3dCapPair[2]; + + +/* + *---------------------------------------------------------------------- + * + * SVGA3dCaps_FindRecord + * + * Finds the record with the highest-valued type within the given range + * in the caps block. + * + * Result: pointer to found record, or NULL if not found. + * + *---------------------------------------------------------------------- + */ + +static INLINE SVGA3dCapsRecord * +SVGA3dCaps_FindRecord(const uint32 *capsBlock, + SVGA3dCapsRecordType recordTypeMin, + SVGA3dCapsRecordType recordTypeMax) +{ + SVGA3dCapsRecord *record, *found = NULL; + uint32 offset; + + /* + * Search linearly through the caps block records for the specified type. + */ + for (offset = 0; capsBlock[offset] != 0; offset += capsBlock[offset]) { + record = (SVGA3dCapsRecord *) (capsBlock + offset); + if ((record->header.type >= recordTypeMin) && + (record->header.type <= recordTypeMax) && + (!found || (record->header.type > found->header.type))) { + found = record; + } + } + + return found; +} + + +#endif // _SVGA3D_CAPS_H_ diff --git a/src/gallium/drivers/svga/include/svga3d_reg.h b/src/gallium/drivers/svga/include/svga3d_reg.h new file mode 100644 index 0000000000..77cb453310 --- /dev/null +++ b/src/gallium/drivers/svga/include/svga3d_reg.h @@ -0,0 +1,1793 @@ +/********************************************************** + * Copyright 1998-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, 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. + * + **********************************************************/ + +/* + * svga3d_reg.h -- + * + * SVGA 3D hardware definitions + */ + +#ifndef _SVGA3D_REG_H_ +#define _SVGA3D_REG_H_ + +#include "svga_reg.h" + + +/* + * 3D Hardware Version + * + * The hardware version is stored in the SVGA_FIFO_3D_HWVERSION fifo + * register. Is set by the host and read by the guest. This lets + * us make new guest drivers which are backwards-compatible with old + * SVGA hardware revisions. It does not let us support old guest + * drivers. Good enough for now. + * + */ + +#define SVGA3D_MAKE_HWVERSION(major, minor) (((major) << 16) | ((minor) & 0xFF)) +#define SVGA3D_MAJOR_HWVERSION(version) ((version) >> 16) +#define SVGA3D_MINOR_HWVERSION(version) ((version) & 0xFF) + +typedef enum { + SVGA3D_HWVERSION_WS5_RC1 = SVGA3D_MAKE_HWVERSION(0, 1), + SVGA3D_HWVERSION_WS5_RC2 = SVGA3D_MAKE_HWVERSION(0, 2), + SVGA3D_HWVERSION_WS51_RC1 = SVGA3D_MAKE_HWVERSION(0, 3), + SVGA3D_HWVERSION_WS6_B1 = SVGA3D_MAKE_HWVERSION(1, 1), + SVGA3D_HWVERSION_FUSION_11 = SVGA3D_MAKE_HWVERSION(1, 4), + SVGA3D_HWVERSION_WS65_B1 = SVGA3D_MAKE_HWVERSION(2, 0), + SVGA3D_HWVERSION_CURRENT = SVGA3D_HWVERSION_WS65_B1, +} SVGA3dHardwareVersion; + +/* + * Generic Types + */ + +typedef uint32 SVGA3dBool; /* 32-bit Bool definition */ +#define SVGA3D_NUM_CLIPPLANES 6 +#define SVGA3D_MAX_SIMULTANEOUS_RENDER_TARGETS 8 + + +/* + * Surface formats. + * + * If you modify this list, be sure to keep GLUtil.c in sync. It + * includes the internal format definition of each surface in + * GLUtil_ConvertSurfaceFormat, and it contains a table of + * human-readable names in GLUtil_GetFormatName. + */ + +typedef enum SVGA3dSurfaceFormat { + SVGA3D_FORMAT_INVALID = 0, + + SVGA3D_X8R8G8B8 = 1, + SVGA3D_A8R8G8B8 = 2, + + SVGA3D_R5G6B5 = 3, + SVGA3D_X1R5G5B5 = 4, + SVGA3D_A1R5G5B5 = 5, + SVGA3D_A4R4G4B4 = 6, + + SVGA3D_Z_D32 = 7, + SVGA3D_Z_D16 = 8, + SVGA3D_Z_D24S8 = 9, + SVGA3D_Z_D15S1 = 10, + + SVGA3D_LUMINANCE8 = 11, + SVGA3D_LUMINANCE4_ALPHA4 = 12, + SVGA3D_LUMINANCE16 = 13, + SVGA3D_LUMINANCE8_ALPHA8 = 14, + + SVGA3D_DXT1 = 15, + SVGA3D_DXT2 = 16, + SVGA3D_DXT3 = 17, + SVGA3D_DXT4 = 18, + SVGA3D_DXT5 = 19, + + SVGA3D_BUMPU8V8 = 20, + SVGA3D_BUMPL6V5U5 = 21, + SVGA3D_BUMPX8L8V8U8 = 22, + SVGA3D_BUMPL8V8U8 = 23, + + SVGA3D_ARGB_S10E5 = 24, /* 16-bit floating-point ARGB */ + SVGA3D_ARGB_S23E8 = 25, /* 32-bit floating-point ARGB */ + + SVGA3D_A2R10G10B10 = 26, + + /* signed formats */ + SVGA3D_V8U8 = 27, + SVGA3D_Q8W8V8U8 = 28, + SVGA3D_CxV8U8 = 29, + + /* mixed formats */ + SVGA3D_X8L8V8U8 = 30, + SVGA3D_A2W10V10U10 = 31, + + SVGA3D_ALPHA8 = 32, + + /* Single- and dual-component floating point formats */ + SVGA3D_R_S10E5 = 33, + SVGA3D_R_S23E8 = 34, + SVGA3D_RG_S10E5 = 35, + SVGA3D_RG_S23E8 = 36, + + /* + * Any surface can be used as a buffer object, but SVGA3D_BUFFER is + * the most efficient format to use when creating new surfaces + * expressly for index or vertex data. + */ + SVGA3D_BUFFER = 37, + + SVGA3D_Z_D24X8 = 38, + + SVGA3D_V16U16 = 39, + + SVGA3D_G16R16 = 40, + SVGA3D_A16B16G16R16 = 41, + + /* Packed Video formats */ + SVGA3D_UYVY = 42, + SVGA3D_YUY2 = 43, + + SVGA3D_FORMAT_MAX +} SVGA3dSurfaceFormat; + +typedef uint32 SVGA3dColor; /* a, r, g, b */ + +/* + * These match the D3DFORMAT_OP definitions used by Direct3D. We need + * them so that we can query the host for what the supported surface + * operations are (when we're using the D3D backend, in particular), + * and so we can send those operations to the guest. + */ +typedef enum { + SVGA3DFORMAT_OP_TEXTURE = 0x00000001, + SVGA3DFORMAT_OP_VOLUMETEXTURE = 0x00000002, + SVGA3DFORMAT_OP_CUBETEXTURE = 0x00000004, + SVGA3DFORMAT_OP_OFFSCREEN_RENDERTARGET = 0x00000008, + SVGA3DFORMAT_OP_SAME_FORMAT_RENDERTARGET = 0x00000010, + SVGA3DFORMAT_OP_ZSTENCIL = 0x00000040, + SVGA3DFORMAT_OP_ZSTENCIL_WITH_ARBITRARY_COLOR_DEPTH = 0x00000080, + +/* + * This format can be used as a render target if the current display mode + * is the same depth if the alpha channel is ignored. e.g. if the device + * can render to A8R8G8B8 when the display mode is X8R8G8B8, then the + * format op list entry for A8R8G8B8 should have this cap. + */ + SVGA3DFORMAT_OP_SAME_FORMAT_UP_TO_ALPHA_RENDERTARGET = 0x00000100, + +/* + * This format contains DirectDraw support (including Flip). This flag + * should not to be set on alpha formats. + */ + SVGA3DFORMAT_OP_DISPLAYMODE = 0x00000400, + +/* + * The rasterizer can support some level of Direct3D support in this format + * and implies that the driver can create a Context in this mode (for some + * render target format). When this flag is set, the SVGA3DFORMAT_OP_DISPLAYMODE + * flag must also be set. + */ + SVGA3DFORMAT_OP_3DACCELERATION = 0x00000800, + +/* + * This is set for a private format when the driver has put the bpp in + * the structure. + */ + SVGA3DFORMAT_OP_PIXELSIZE = 0x00001000, + +/* + * Indicates that this format can be converted to any RGB format for which + * SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB is specified + */ + SVGA3DFORMAT_OP_CONVERT_TO_ARGB = 0x00002000, + +/* + * Indicates that this format can be used to create offscreen plain surfaces. + */ + SVGA3DFORMAT_OP_OFFSCREENPLAIN = 0x00004000, + +/* + * Indicated that this format can be read as an SRGB texture (meaning that the + * sampler will linearize the looked up data) + */ + SVGA3DFORMAT_OP_SRGBREAD = 0x00008000, + +/* + * Indicates that this format can be used in the bumpmap instructions + */ + SVGA3DFORMAT_OP_BUMPMAP = 0x00010000, + +/* + * Indicates that this format can be sampled by the displacement map sampler + */ + SVGA3DFORMAT_OP_DMAP = 0x00020000, + +/* + * Indicates that this format cannot be used with texture filtering + */ + SVGA3DFORMAT_OP_NOFILTER = 0x00040000, + +/* + * Indicates that format conversions are supported to this RGB format if + * SVGA3DFORMAT_OP_CONVERT_TO_ARGB is specified in the source format. + */ + SVGA3DFORMAT_OP_MEMBEROFGROUP_ARGB = 0x00080000, + +/* + * Indicated that this format can be written as an SRGB target (meaning that the + * pixel pipe will DE-linearize data on output to format) + */ + SVGA3DFORMAT_OP_SRGBWRITE = 0x00100000, + +/* + * Indicates that this format cannot be used with alpha blending + */ + SVGA3DFORMAT_OP_NOALPHABLEND = 0x00200000, + +/* + * Indicates that the device can auto-generated sublevels for resources + * of this format + */ + SVGA3DFORMAT_OP_AUTOGENMIPMAP = 0x00400000, + +/* + * Indicates that this format can be used by vertex texture sampler + */ + SVGA3DFORMAT_OP_VERTEXTEXTURE = 0x00800000, + +/* + * Indicates that this format supports neither texture coordinate wrap + * modes, nor mipmapping + */ + SVGA3DFORMAT_OP_NOTEXCOORDWRAPNORMIP = 0x01000000 +} SVGA3dFormatOp; + +/* + * This structure is a conversion of SVGA3DFORMAT_OP_*. + * Entries must be located at the same position. + */ +typedef union { + uint32 value; + struct { + uint32 texture : 1; + uint32 volumeTexture : 1; + uint32 cubeTexture : 1; + uint32 offscreenRenderTarget : 1; + uint32 sameFormatRenderTarget : 1; + uint32 unknown1 : 1; + uint32 zStencil : 1; + uint32 zStencilArbitraryDepth : 1; + uint32 sameFormatUpToAlpha : 1; + uint32 unknown2 : 1; + uint32 displayMode : 1; + uint32 acceleration3d : 1; + uint32 pixelSize : 1; + uint32 convertToARGB : 1; + uint32 offscreenPlain : 1; + uint32 sRGBRead : 1; + uint32 bumpMap : 1; + uint32 dmap : 1; + uint32 noFilter : 1; + uint32 memberOfGroupARGB : 1; + uint32 sRGBWrite : 1; + uint32 noAlphaBlend : 1; + uint32 autoGenMipMap : 1; + uint32 vertexTexture : 1; + uint32 noTexCoordWrapNorMip : 1; + }; +} SVGA3dSurfaceFormatCaps; + +/* + * SVGA_3D_CMD_SETRENDERSTATE Types. All value types + * must fit in a uint32. + */ + +typedef enum { + SVGA3D_RS_INVALID = 0, + SVGA3D_RS_ZENABLE = 1, /* SVGA3dBool */ + SVGA3D_RS_ZWRITEENABLE = 2, /* SVGA3dBool */ + SVGA3D_RS_ALPHATESTENABLE = 3, /* SVGA3dBool */ + SVGA3D_RS_DITHERENABLE = 4, /* SVGA3dBool */ + SVGA3D_RS_BLENDENABLE = 5, /* SVGA3dBool */ + SVGA3D_RS_FOGENABLE = 6, /* SVGA3dBool */ + SVGA3D_RS_SPECULARENABLE = 7, /* SVGA3dBool */ + SVGA3D_RS_STENCILENABLE = 8, /* SVGA3dBool */ + SVGA3D_RS_LIGHTINGENABLE = 9, /* SVGA3dBool */ + SVGA3D_RS_NORMALIZENORMALS = 10, /* SVGA3dBool */ + SVGA3D_RS_POINTSPRITEENABLE = 11, /* SVGA3dBool */ + SVGA3D_RS_POINTSCALEENABLE = 12, /* SVGA3dBool */ + SVGA3D_RS_STENCILREF = 13, /* uint32 */ + SVGA3D_RS_STENCILMASK = 14, /* uint32 */ + SVGA3D_RS_STENCILWRITEMASK = 15, /* uint32 */ + SVGA3D_RS_FOGSTART = 16, /* float */ + SVGA3D_RS_FOGEND = 17, /* float */ + SVGA3D_RS_FOGDENSITY = 18, /* float */ + SVGA3D_RS_POINTSIZE = 19, /* float */ + SVGA3D_RS_POINTSIZEMIN = 20, /* float */ + SVGA3D_RS_POINTSIZEMAX = 21, /* float */ + SVGA3D_RS_POINTSCALE_A = 22, /* float */ + SVGA3D_RS_POINTSCALE_B = 23, /* float */ + SVGA3D_RS_POINTSCALE_C = 24, /* float */ + SVGA3D_RS_FOGCOLOR = 25, /* SVGA3dColor */ + SVGA3D_RS_AMBIENT = 26, /* SVGA3dColor */ + SVGA3D_RS_CLIPPLANEENABLE = 27, /* SVGA3dClipPlanes */ + SVGA3D_RS_FOGMODE = 28, /* SVGA3dFogMode */ + SVGA3D_RS_FILLMODE = 29, /* SVGA3dFillMode */ + SVGA3D_RS_SHADEMODE = 30, /* SVGA3dShadeMode */ + SVGA3D_RS_LINEPATTERN = 31, /* SVGA3dLinePattern */ + SVGA3D_RS_SRCBLEND = 32, /* SVGA3dBlendOp */ + SVGA3D_RS_DSTBLEND = 33, /* SVGA3dBlendOp */ + SVGA3D_RS_BLENDEQUATION = 34, /* SVGA3dBlendEquation */ + SVGA3D_RS_CULLMODE = 35, /* SVGA3dFace */ + SVGA3D_RS_ZFUNC = 36, /* SVGA3dCmpFunc */ + SVGA3D_RS_ALPHAFUNC = 37, /* SVGA3dCmpFunc */ + SVGA3D_RS_STENCILFUNC = 38, /* SVGA3dCmpFunc */ + SVGA3D_RS_STENCILFAIL = 39, /* SVGA3dStencilOp */ + SVGA3D_RS_STENCILZFAIL = 40, /* SVGA3dStencilOp */ + SVGA3D_RS_STENCILPASS = 41, /* SVGA3dStencilOp */ + SVGA3D_RS_ALPHAREF = 42, /* float (0.0 .. 1.0) */ + SVGA3D_RS_FRONTWINDING = 43, /* SVGA3dFrontWinding */ + SVGA3D_RS_COORDINATETYPE = 44, /* SVGA3dCoordinateType */ + SVGA3D_RS_ZBIAS = 45, /* float */ + SVGA3D_RS_RANGEFOGENABLE = 46, /* SVGA3dBool */ + SVGA3D_RS_COLORWRITEENABLE = 47, /* SVGA3dColorMask */ + SVGA3D_RS_VERTEXMATERIALENABLE = 48, /* SVGA3dBool */ + SVGA3D_RS_DIFFUSEMATERIALSOURCE = 49, /* SVGA3dVertexMaterial */ + SVGA3D_RS_SPECULARMATERIALSOURCE = 50, /* SVGA3dVertexMaterial */ + SVGA3D_RS_AMBIENTMATERIALSOURCE = 51, /* SVGA3dVertexMaterial */ + SVGA3D_RS_EMISSIVEMATERIALSOURCE = 52, /* SVGA3dVertexMaterial */ + SVGA3D_RS_TEXTUREFACTOR = 53, /* SVGA3dColor */ + SVGA3D_RS_LOCALVIEWER = 54, /* SVGA3dBool */ + SVGA3D_RS_SCISSORTESTENABLE = 55, /* SVGA3dBool */ + SVGA3D_RS_BLENDCOLOR = 56, /* SVGA3dColor */ + SVGA3D_RS_STENCILENABLE2SIDED = 57, /* SVGA3dBool */ + SVGA3D_RS_CCWSTENCILFUNC = 58, /* SVGA3dCmpFunc */ + SVGA3D_RS_CCWSTENCILFAIL = 59, /* SVGA3dStencilOp */ + SVGA3D_RS_CCWSTENCILZFAIL = 60, /* SVGA3dStencilOp */ + SVGA3D_RS_CCWSTENCILPASS = 61, /* SVGA3dStencilOp */ + SVGA3D_RS_VERTEXBLEND = 62, /* SVGA3dVertexBlendFlags */ + SVGA3D_RS_SLOPESCALEDEPTHBIAS = 63, /* float */ + SVGA3D_RS_DEPTHBIAS = 64, /* float */ + + + /* + * Output Gamma Level + * + * Output gamma effects the gamma curve of colors that are output from the + * rendering pipeline. A value of 1.0 specifies a linear color space. If the + * value is <= 0.0, gamma correction is ignored and linear color space is + * used. + */ + + SVGA3D_RS_OUTPUTGAMMA = 65, /* float */ + SVGA3D_RS_ZVISIBLE = 66, /* SVGA3dBool */ + SVGA3D_RS_LASTPIXEL = 67, /* SVGA3dBool */ + SVGA3D_RS_CLIPPING = 68, /* SVGA3dBool */ + SVGA3D_RS_WRAP0 = 69, /* SVGA3dWrapFlags */ + SVGA3D_RS_WRAP1 = 70, /* SVGA3dWrapFlags */ + SVGA3D_RS_WRAP2 = 71, /* SVGA3dWrapFlags */ + SVGA3D_RS_WRAP3 = 72, /* SVGA3dWrapFlags */ + SVGA3D_RS_WRAP4 = 73, /* SVGA3dWrapFlags */ + SVGA3D_RS_WRAP5 = 74, /* SVGA3dWrapFlags */ + SVGA3D_RS_WRAP6 = 75, /* SVGA3dWrapFlags */ + SVGA3D_RS_WRAP7 = 76, /* SVGA3dWrapFlags */ + SVGA3D_RS_WRAP8 = 77, /* SVGA3dWrapFlags */ + SVGA3D_RS_WRAP9 = 78, /* SVGA3dWrapFlags */ + SVGA3D_RS_WRAP10 = 79, /* SVGA3dWrapFlags */ + SVGA3D_RS_WRAP11 = 80, /* SVGA3dWrapFlags */ + SVGA3D_RS_WRAP12 = 81, /* SVGA3dWrapFlags */ + SVGA3D_RS_WRAP13 = 82, /* SVGA3dWrapFlags */ + SVGA3D_RS_WRAP14 = 83, /* SVGA3dWrapFlags */ + SVGA3D_RS_WRAP15 = 84, /* SVGA3dWrapFlags */ + SVGA3D_RS_MULTISAMPLEANTIALIAS = 85, /* SVGA3dBool */ + SVGA3D_RS_MULTISAMPLEMASK = 86, /* uint32 */ + SVGA3D_RS_INDEXEDVERTEXBLENDENABLE = 87, /* SVGA3dBool */ + SVGA3D_RS_TWEENFACTOR = 88, /* float */ + SVGA3D_RS_ANTIALIASEDLINEENABLE = 89, /* SVGA3dBool */ + SVGA3D_RS_COLORWRITEENABLE1 = 90, /* SVGA3dColorMask */ + SVGA3D_RS_COLORWRITEENABLE2 = 91, /* SVGA3dColorMask */ + SVGA3D_RS_COLORWRITEENABLE3 = 92, /* SVGA3dColorMask */ + SVGA3D_RS_SEPARATEALPHABLENDENABLE = 93, /* SVGA3dBool */ + SVGA3D_RS_SRCBLENDALPHA = 94, /* SVGA3dBlendOp */ + SVGA3D_RS_DSTBLENDALPHA = 95, /* SVGA3dBlendOp */ + SVGA3D_RS_BLENDEQUATIONALPHA = 96, /* SVGA3dBlendEquation */ + SVGA3D_RS_MAX +} SVGA3dRenderStateName; + +typedef enum { + SVGA3D_VERTEXMATERIAL_NONE = 0, /* Use the value in the current material */ + SVGA3D_VERTEXMATERIAL_DIFFUSE = 1, /* Use the value in the diffuse component */ + SVGA3D_VERTEXMATERIAL_SPECULAR = 2, /* Use the value in the specular component */ +} SVGA3dVertexMaterial; + +typedef enum { + SVGA3D_FILLMODE_INVALID = 0, + SVGA3D_FILLMODE_POINT = 1, + SVGA3D_FILLMODE_LINE = 2, + SVGA3D_FILLMODE_FILL = 3, + SVGA3D_FILLMODE_MAX +} SVGA3dFillModeType; + + +typedef +union { + struct { + uint16 mode; /* SVGA3dFillModeType */ + uint16 face; /* SVGA3dFace */ + }; + uint32 uintValue; +} SVGA3dFillMode; + +typedef enum { + SVGA3D_SHADEMODE_INVALID = 0, + SVGA3D_SHADEMODE_FLAT = 1, + SVGA3D_SHADEMODE_SMOOTH = 2, + SVGA3D_SHADEMODE_PHONG = 3, /* Not supported */ + SVGA3D_SHADEMODE_MAX +} SVGA3dShadeMode; + +typedef +union { + struct { + uint16 repeat; + uint16 pattern; + }; + uint32 uintValue; +} SVGA3dLinePattern; + +typedef enum { + SVGA3D_BLENDOP_INVALID = 0, + SVGA3D_BLENDOP_ZERO = 1, + SVGA3D_BLENDOP_ONE = 2, + SVGA3D_BLENDOP_SRCCOLOR = 3, + SVGA3D_BLENDOP_INVSRCCOLOR = 4, + SVGA3D_BLENDOP_SRCALPHA = 5, + SVGA3D_BLENDOP_INVSRCALPHA = 6, + SVGA3D_BLENDOP_DESTALPHA = 7, + SVGA3D_BLENDOP_INVDESTALPHA = 8, + SVGA3D_BLENDOP_DESTCOLOR = 9, + SVGA3D_BLENDOP_INVDESTCOLOR = 10, + SVGA3D_BLENDOP_SRCALPHASAT = 11, + SVGA3D_BLENDOP_BLENDFACTOR = 12, + SVGA3D_BLENDOP_INVBLENDFACTOR = 13, + SVGA3D_BLENDOP_MAX +} SVGA3dBlendOp; + +typedef enum { + SVGA3D_BLENDEQ_INVALID = 0, + SVGA3D_BLENDEQ_ADD = 1, + SVGA3D_BLENDEQ_SUBTRACT = 2, + SVGA3D_BLENDEQ_REVSUBTRACT = 3, + SVGA3D_BLENDEQ_MINIMUM = 4, + SVGA3D_BLENDEQ_MAXIMUM = 5, + SVGA3D_BLENDEQ_MAX +} SVGA3dBlendEquation; + +typedef enum { + SVGA3D_FRONTWINDING_INVALID = 0, + SVGA3D_FRONTWINDING_CW = 1, + SVGA3D_FRONTWINDING_CCW = 2, + SVGA3D_FRONTWINDING_MAX +} SVGA3dFrontWinding; + +typedef enum { + SVGA3D_FACE_INVALID = 0, + SVGA3D_FACE_NONE = 1, + SVGA3D_FACE_FRONT = 2, + SVGA3D_FACE_BACK = 3, + SVGA3D_FACE_FRONT_BACK = 4, + SVGA3D_FACE_MAX +} SVGA3dFace; + +/* + * The order and the values should not be changed + */ + +typedef enum { + SVGA3D_CMP_INVALID = 0, + SVGA3D_CMP_NEVER = 1, + SVGA3D_CMP_LESS = 2, + SVGA3D_CMP_EQUAL = 3, + SVGA3D_CMP_LESSEQUAL = 4, + SVGA3D_CMP_GREATER = 5, + SVGA3D_CMP_NOTEQUAL = 6, + SVGA3D_CMP_GREATEREQUAL = 7, + SVGA3D_CMP_ALWAYS = 8, + SVGA3D_CMP_MAX +} SVGA3dCmpFunc; + +/* + * SVGA3D_FOGFUNC_* specifies the fog equation, or PER_VERTEX which allows + * the fog factor to be specified in the alpha component of the specular + * (a.k.a. secondary) vertex color. + */ +typedef enum { + SVGA3D_FOGFUNC_INVALID = 0, + SVGA3D_FOGFUNC_EXP = 1, + SVGA3D_FOGFUNC_EXP2 = 2, + SVGA3D_FOGFUNC_LINEAR = 3, + SVGA3D_FOGFUNC_PER_VERTEX = 4 +} SVGA3dFogFunction; + +/* + * SVGA3D_FOGTYPE_* specifies if fog factors are computed on a per-vertex + * or per-pixel basis. + */ +typedef enum { + SVGA3D_FOGTYPE_INVALID = 0, + SVGA3D_FOGTYPE_VERTEX = 1, + SVGA3D_FOGTYPE_PIXEL = 2, + SVGA3D_FOGTYPE_MAX = 3 +} SVGA3dFogType; + +/* + * SVGA3D_FOGBASE_* selects depth or range-based fog. Depth-based fog is + * computed using the eye Z value of each pixel (or vertex), whereas range- + * based fog is computed using the actual distance (range) to the eye. + */ +typedef enum { + SVGA3D_FOGBASE_INVALID = 0, + SVGA3D_FOGBASE_DEPTHBASED = 1, + SVGA3D_FOGBASE_RANGEBASED = 2, + SVGA3D_FOGBASE_MAX = 3 +} SVGA3dFogBase; + +typedef enum { + SVGA3D_STENCILOP_INVALID = 0, + SVGA3D_STENCILOP_KEEP = 1, + SVGA3D_STENCILOP_ZERO = 2, + SVGA3D_STENCILOP_REPLACE = 3, + SVGA3D_STENCILOP_INCRSAT = 4, + SVGA3D_STENCILOP_DECRSAT = 5, + SVGA3D_STENCILOP_INVERT = 6, + SVGA3D_STENCILOP_INCR = 7, + SVGA3D_STENCILOP_DECR = 8, + SVGA3D_STENCILOP_MAX +} SVGA3dStencilOp; + +typedef enum { + SVGA3D_CLIPPLANE_0 = (1 << 0), + SVGA3D_CLIPPLANE_1 = (1 << 1), + SVGA3D_CLIPPLANE_2 = (1 << 2), + SVGA3D_CLIPPLANE_3 = (1 << 3), + SVGA3D_CLIPPLANE_4 = (1 << 4), + SVGA3D_CLIPPLANE_5 = (1 << 5), +} SVGA3dClipPlanes; + +typedef enum { + SVGA3D_CLEAR_COLOR = 0x1, + SVGA3D_CLEAR_DEPTH = 0x2, + SVGA3D_CLEAR_STENCIL = 0x4 +} SVGA3dClearFlag; + +typedef enum { + SVGA3D_RT_DEPTH = 0, + SVGA3D_RT_STENCIL = 1, + SVGA3D_RT_COLOR0 = 2, + SVGA3D_RT_COLOR1 = 3, + SVGA3D_RT_COLOR2 = 4, + SVGA3D_RT_COLOR3 = 5, + SVGA3D_RT_COLOR4 = 6, + SVGA3D_RT_COLOR5 = 7, + SVGA3D_RT_COLOR6 = 8, + SVGA3D_RT_COLOR7 = 9, + SVGA3D_RT_MAX, + SVGA3D_RT_INVALID = ((uint32)-1), +} SVGA3dRenderTargetType; + +#define SVGA3D_MAX_RT_COLOR (SVGA3D_RT_COLOR7 - SVGA3D_RT_COLOR0 + 1) + +typedef +union { + struct { + uint32 red : 1; + uint32 green : 1; + uint32 blue : 1; + uint32 alpha : 1; + }; + uint32 uintValue; +} SVGA3dColorMask; + +typedef enum { + SVGA3D_VBLEND_DISABLE = 0, + SVGA3D_VBLEND_1WEIGHT = 1, + SVGA3D_VBLEND_2WEIGHT = 2, + SVGA3D_VBLEND_3WEIGHT = 3, +} SVGA3dVertexBlendFlags; + +typedef enum { + SVGA3D_WRAPCOORD_0 = 1 << 0, + SVGA3D_WRAPCOORD_1 = 1 << 1, + SVGA3D_WRAPCOORD_2 = 1 << 2, + SVGA3D_WRAPCOORD_3 = 1 << 3, + SVGA3D_WRAPCOORD_ALL = 0xF, +} SVGA3dWrapFlags; + +/* + * SVGA_3D_CMD_TEXTURESTATE Types. All value types + * must fit in a uint32. + */ + +typedef enum { + SVGA3D_TS_INVALID = 0, + SVGA3D_TS_BIND_TEXTURE = 1, /* SVGA3dSurfaceId */ + SVGA3D_TS_COLOROP = 2, /* SVGA3dTextureCombiner */ + SVGA3D_TS_COLORARG1 = 3, /* SVGA3dTextureArgData */ + SVGA3D_TS_COLORARG2 = 4, /* SVGA3dTextureArgData */ + SVGA3D_TS_ALPHAOP = 5, /* SVGA3dTextureCombiner */ + SVGA3D_TS_ALPHAARG1 = 6, /* SVGA3dTextureArgData */ + SVGA3D_TS_ALPHAARG2 = 7, /* SVGA3dTextureArgData */ + SVGA3D_TS_ADDRESSU = 8, /* SVGA3dTextureAddress */ + SVGA3D_TS_ADDRESSV = 9, /* SVGA3dTextureAddress */ + SVGA3D_TS_MIPFILTER = 10, /* SVGA3dTextureFilter */ + SVGA3D_TS_MAGFILTER = 11, /* SVGA3dTextureFilter */ + SVGA3D_TS_MINFILTER = 12, /* SVGA3dTextureFilter */ + SVGA3D_TS_BORDERCOLOR = 13, /* SVGA3dColor */ + SVGA3D_TS_TEXCOORDINDEX = 14, /* uint32 */ + SVGA3D_TS_TEXTURETRANSFORMFLAGS = 15, /* SVGA3dTexTransformFlags */ + SVGA3D_TS_TEXCOORDGEN = 16, /* SVGA3dTextureCoordGen */ + SVGA3D_TS_BUMPENVMAT00 = 17, /* float */ + SVGA3D_TS_BUMPENVMAT01 = 18, /* float */ + SVGA3D_TS_BUMPENVMAT10 = 19, /* float */ + SVGA3D_TS_BUMPENVMAT11 = 20, /* float */ + SVGA3D_TS_TEXTURE_MIPMAP_LEVEL = 21, /* uint32 */ + SVGA3D_TS_TEXTURE_LOD_BIAS = 22, /* float */ + SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL = 23, /* uint32 */ + SVGA3D_TS_ADDRESSW = 24, /* SVGA3dTextureAddress */ + + + /* + * Sampler Gamma Level + * + * Sampler gamma effects the color of samples taken from the sampler. A + * value of 1.0 will produce linear samples. If the value is <= 0.0 the + * gamma value is ignored and a linear space is used. + */ + + SVGA3D_TS_GAMMA = 25, /* float */ + SVGA3D_TS_BUMPENVLSCALE = 26, /* float */ + SVGA3D_TS_BUMPENVLOFFSET = 27, /* float */ + SVGA3D_TS_COLORARG0 = 28, /* SVGA3dTextureArgData */ + SVGA3D_TS_ALPHAARG0 = 29, /* SVGA3dTextureArgData */ + SVGA3D_TS_MAX +} SVGA3dTextureStateName; + +typedef enum { + SVGA3D_TC_INVALID = 0, + SVGA3D_TC_DISABLE = 1, + SVGA3D_TC_SELECTARG1 = 2, + SVGA3D_TC_SELECTARG2 = 3, + SVGA3D_TC_MODULATE = 4, + SVGA3D_TC_ADD = 5, + SVGA3D_TC_ADDSIGNED = 6, + SVGA3D_TC_SUBTRACT = 7, + SVGA3D_TC_BLENDTEXTUREALPHA = 8, + SVGA3D_TC_BLENDDIFFUSEALPHA = 9, + SVGA3D_TC_BLENDCURRENTALPHA = 10, + SVGA3D_TC_BLENDFACTORALPHA = 11, + SVGA3D_TC_MODULATE2X = 12, + SVGA3D_TC_MODULATE4X = 13, + SVGA3D_TC_DSDT = 14, + SVGA3D_TC_DOTPRODUCT3 = 15, + SVGA3D_TC_BLENDTEXTUREALPHAPM = 16, + SVGA3D_TC_ADDSIGNED2X = 17, + SVGA3D_TC_ADDSMOOTH = 18, + SVGA3D_TC_PREMODULATE = 19, + SVGA3D_TC_MODULATEALPHA_ADDCOLOR = 20, + SVGA3D_TC_MODULATECOLOR_ADDALPHA = 21, + SVGA3D_TC_MODULATEINVALPHA_ADDCOLOR = 22, + SVGA3D_TC_MODULATEINVCOLOR_ADDALPHA = 23, + SVGA3D_TC_BUMPENVMAPLUMINANCE = 24, + SVGA3D_TC_MULTIPLYADD = 25, + SVGA3D_TC_LERP = 26, + SVGA3D_TC_MAX +} SVGA3dTextureCombiner; + +#define SVGA3D_TC_CAP_BIT(svga3d_tc_op) (svga3d_tc_op ? (1 << (svga3d_tc_op - 1)) : 0) + +typedef enum { + SVGA3D_TEX_ADDRESS_INVALID = 0, + SVGA3D_TEX_ADDRESS_WRAP = 1, + SVGA3D_TEX_ADDRESS_MIRROR = 2, + SVGA3D_TEX_ADDRESS_CLAMP = 3, + SVGA3D_TEX_ADDRESS_BORDER = 4, + SVGA3D_TEX_ADDRESS_MIRRORONCE = 5, + SVGA3D_TEX_ADDRESS_EDGE = 6, + SVGA3D_TEX_ADDRESS_MAX +} SVGA3dTextureAddress; + +/* + * SVGA3D_TEX_FILTER_NONE as the minification filter means mipmapping is + * disabled, and the rasterizer should use the magnification filter instead. + */ +typedef enum { + SVGA3D_TEX_FILTER_NONE = 0, + SVGA3D_TEX_FILTER_NEAREST = 1, + SVGA3D_TEX_FILTER_LINEAR = 2, + SVGA3D_TEX_FILTER_ANISOTROPIC = 3, + SVGA3D_TEX_FILTER_FLATCUBIC = 4, // Deprecated, not implemented + SVGA3D_TEX_FILTER_GAUSSIANCUBIC = 5, // Deprecated, not implemented + SVGA3D_TEX_FILTER_PYRAMIDALQUAD = 6, // Not currently implemented + SVGA3D_TEX_FILTER_GAUSSIANQUAD = 7, // Not currently implemented + SVGA3D_TEX_FILTER_MAX +} SVGA3dTextureFilter; + +typedef enum { + SVGA3D_TEX_TRANSFORM_OFF = 0, + SVGA3D_TEX_TRANSFORM_S = (1 << 0), + SVGA3D_TEX_TRANSFORM_T = (1 << 1), + SVGA3D_TEX_TRANSFORM_R = (1 << 2), + SVGA3D_TEX_TRANSFORM_Q = (1 << 3), + SVGA3D_TEX_PROJECTED = (1 << 15), +} SVGA3dTexTransformFlags; + +typedef enum { + SVGA3D_TEXCOORD_GEN_OFF = 0, + SVGA3D_TEXCOORD_GEN_EYE_POSITION = 1, + SVGA3D_TEXCOORD_GEN_EYE_NORMAL = 2, + SVGA3D_TEXCOORD_GEN_REFLECTIONVECTOR = 3, + SVGA3D_TEXCOORD_GEN_SPHERE = 4, + SVGA3D_TEXCOORD_GEN_MAX +} SVGA3dTextureCoordGen; + +/* + * Texture argument constants for texture combiner + */ +typedef enum { + SVGA3D_TA_INVALID = 0, + SVGA3D_TA_CONSTANT = 1, + SVGA3D_TA_PREVIOUS = 2, + SVGA3D_TA_DIFFUSE = 3, + SVGA3D_TA_TEXTURE = 4, + SVGA3D_TA_SPECULAR = 5, + SVGA3D_TA_MAX +} SVGA3dTextureArgData; + +#define SVGA3D_TM_MASK_LEN 4 + +/* Modifiers for texture argument constants defined above. */ +typedef enum { + SVGA3D_TM_NONE = 0, + SVGA3D_TM_ALPHA = (1 << SVGA3D_TM_MASK_LEN), + SVGA3D_TM_ONE_MINUS = (2 << SVGA3D_TM_MASK_LEN), +} SVGA3dTextureArgModifier; + +#define SVGA3D_INVALID_ID ((uint32)-1) +#define SVGA3D_MAX_CLIP_PLANES 6 + +/* + * This is the limit to the number of fixed-function texture + * transforms and texture coordinates we can support. It does *not* + * correspond to the number of texture image units (samplers) we + * support! + */ +#define SVGA3D_MAX_TEXTURE_COORDS 8 + +/* + * Vertex declarations + * + * Notes: + * + * SVGA3D_DECLUSAGE_POSITIONT is for pre-transformed vertices. If you + * draw with any POSITIONT vertex arrays, the programmable vertex + * pipeline will be implicitly disabled. Drawing will take place as if + * no vertex shader was bound. + */ + +typedef enum { + SVGA3D_DECLUSAGE_POSITION = 0, + SVGA3D_DECLUSAGE_BLENDWEIGHT, // 1 + SVGA3D_DECLUSAGE_BLENDINDICES, // 2 + SVGA3D_DECLUSAGE_NORMAL, // 3 + SVGA3D_DECLUSAGE_PSIZE, // 4 + SVGA3D_DECLUSAGE_TEXCOORD, // 5 + SVGA3D_DECLUSAGE_TANGENT, // 6 + SVGA3D_DECLUSAGE_BINORMAL, // 7 + SVGA3D_DECLUSAGE_TESSFACTOR, // 8 + SVGA3D_DECLUSAGE_POSITIONT, // 9 + SVGA3D_DECLUSAGE_COLOR, // 10 + SVGA3D_DECLUSAGE_FOG, // 11 + SVGA3D_DECLUSAGE_DEPTH, // 12 + SVGA3D_DECLUSAGE_SAMPLE, // 13 + SVGA3D_DECLUSAGE_MAX +} SVGA3dDeclUsage; + +typedef enum { + SVGA3D_DECLMETHOD_DEFAULT = 0, + SVGA3D_DECLMETHOD_PARTIALU, + SVGA3D_DECLMETHOD_PARTIALV, + SVGA3D_DECLMETHOD_CROSSUV, // Normal + SVGA3D_DECLMETHOD_UV, + SVGA3D_DECLMETHOD_LOOKUP, // Lookup a displacement map + SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED, // Lookup a pre-sampled displacement map +} SVGA3dDeclMethod; + +typedef enum { + SVGA3D_DECLTYPE_FLOAT1 = 0, + SVGA3D_DECLTYPE_FLOAT2 = 1, + SVGA3D_DECLTYPE_FLOAT3 = 2, + SVGA3D_DECLTYPE_FLOAT4 = 3, + SVGA3D_DECLTYPE_D3DCOLOR = 4, + SVGA3D_DECLTYPE_UBYTE4 = 5, + SVGA3D_DECLTYPE_SHORT2 = 6, + SVGA3D_DECLTYPE_SHORT4 = 7, + SVGA3D_DECLTYPE_UBYTE4N = 8, + SVGA3D_DECLTYPE_SHORT2N = 9, + SVGA3D_DECLTYPE_SHORT4N = 10, + SVGA3D_DECLTYPE_USHORT2N = 11, + SVGA3D_DECLTYPE_USHORT4N = 12, + SVGA3D_DECLTYPE_UDEC3 = 13, + SVGA3D_DECLTYPE_DEC3N = 14, + SVGA3D_DECLTYPE_FLOAT16_2 = 15, + SVGA3D_DECLTYPE_FLOAT16_4 = 16, + SVGA3D_DECLTYPE_MAX, +} SVGA3dDeclType; + +/* + * This structure is used for the divisor for geometry instancing; + * it's a direct translation of the Direct3D equivalent. + */ +typedef union { + struct { + /* + * For index data, this number represents the number of instances to draw. + * For instance data, this number represents the number of + * instances/vertex in this stream + */ + uint32 count : 30; + + /* + * This is 1 if this is supposed to be the data that is repeated for + * every instance. + */ + uint32 indexedData : 1; + + /* + * This is 1 if this is supposed to be the per-instance data. + */ + uint32 instanceData : 1; + }; + + uint32 value; +} SVGA3dVertexDivisor; + +typedef enum { + SVGA3D_PRIMITIVE_INVALID = 0, + SVGA3D_PRIMITIVE_TRIANGLELIST = 1, + SVGA3D_PRIMITIVE_POINTLIST = 2, + SVGA3D_PRIMITIVE_LINELIST = 3, + SVGA3D_PRIMITIVE_LINESTRIP = 4, + SVGA3D_PRIMITIVE_TRIANGLESTRIP = 5, + SVGA3D_PRIMITIVE_TRIANGLEFAN = 6, + SVGA3D_PRIMITIVE_MAX +} SVGA3dPrimitiveType; + +typedef enum { + SVGA3D_COORDINATE_INVALID = 0, + SVGA3D_COORDINATE_LEFTHANDED = 1, + SVGA3D_COORDINATE_RIGHTHANDED = 2, + SVGA3D_COORDINATE_MAX +} SVGA3dCoordinateType; + +typedef enum { + SVGA3D_TRANSFORM_INVALID = 0, + SVGA3D_TRANSFORM_WORLD = 1, + SVGA3D_TRANSFORM_VIEW = 2, + SVGA3D_TRANSFORM_PROJECTION = 3, + SVGA3D_TRANSFORM_TEXTURE0 = 4, + SVGA3D_TRANSFORM_TEXTURE1 = 5, + SVGA3D_TRANSFORM_TEXTURE2 = 6, + SVGA3D_TRANSFORM_TEXTURE3 = 7, + SVGA3D_TRANSFORM_TEXTURE4 = 8, + SVGA3D_TRANSFORM_TEXTURE5 = 9, + SVGA3D_TRANSFORM_TEXTURE6 = 10, + SVGA3D_TRANSFORM_TEXTURE7 = 11, + SVGA3D_TRANSFORM_WORLD1 = 12, + SVGA3D_TRANSFORM_WORLD2 = 13, + SVGA3D_TRANSFORM_WORLD3 = 14, + SVGA3D_TRANSFORM_MAX +} SVGA3dTransformType; + +typedef enum { + SVGA3D_LIGHTTYPE_INVALID = 0, + SVGA3D_LIGHTTYPE_POINT = 1, + SVGA3D_LIGHTTYPE_SPOT1 = 2, /* 1-cone, in degrees */ + SVGA3D_LIGHTTYPE_SPOT2 = 3, /* 2-cone, in radians */ + SVGA3D_LIGHTTYPE_DIRECTIONAL = 4, + SVGA3D_LIGHTTYPE_MAX +} SVGA3dLightType; + +typedef enum { + SVGA3D_CUBEFACE_POSX = 0, + SVGA3D_CUBEFACE_NEGX = 1, + SVGA3D_CUBEFACE_POSY = 2, + SVGA3D_CUBEFACE_NEGY = 3, + SVGA3D_CUBEFACE_POSZ = 4, + SVGA3D_CUBEFACE_NEGZ = 5, +} SVGA3dCubeFace; + +typedef enum { + SVGA3D_SHADERTYPE_COMPILED_DX8 = 0, + SVGA3D_SHADERTYPE_VS = 1, + SVGA3D_SHADERTYPE_PS = 2, + SVGA3D_SHADERTYPE_MAX +} SVGA3dShaderType; + +typedef enum { + SVGA3D_CONST_TYPE_FLOAT = 0, + SVGA3D_CONST_TYPE_INT = 1, + SVGA3D_CONST_TYPE_BOOL = 2, +} SVGA3dShaderConstType; + +#define SVGA3D_MAX_SURFACE_FACES 6 + +typedef enum { + SVGA3D_STRETCH_BLT_POINT = 0, + SVGA3D_STRETCH_BLT_LINEAR = 1, + SVGA3D_STRETCH_BLT_MAX +} SVGA3dStretchBltMode; + +typedef enum { + SVGA3D_QUERYTYPE_OCCLUSION = 0, + SVGA3D_QUERYTYPE_MAX +} SVGA3dQueryType; + +typedef enum { + SVGA3D_QUERYSTATE_PENDING = 0, /* Waiting on the host (set by guest) */ + SVGA3D_QUERYSTATE_SUCCEEDED = 1, /* Completed successfully (set by host) */ + SVGA3D_QUERYSTATE_FAILED = 2, /* Completed unsuccessfully (set by host) */ + SVGA3D_QUERYSTATE_NEW = 3, /* Never submitted (For guest use only) */ +} SVGA3dQueryState; + +typedef enum { + SVGA3D_WRITE_HOST_VRAM = 1, + SVGA3D_READ_HOST_VRAM = 2, +} SVGA3dTransferType; + +/* + * The maximum number vertex arrays we're guaranteed to support in + * SVGA_3D_CMD_DRAWPRIMITIVES. + */ +#define SVGA3D_MAX_VERTEX_ARRAYS 32 + +/* + * Identifiers for commands in the command FIFO. + * + * IDs between 1000 and 1039 (inclusive) were used by obsolete versions of + * the SVGA3D protocol and remain reserved; they should not be used in the + * future. + * + * IDs between 1040 and 1999 (inclusive) are available for use by the + * current SVGA3D protocol. + * + * FIFO clients other than SVGA3D should stay below 1000, or at 2000 + * and up. + */ + +#define SVGA_3D_CMD_LEGACY_BASE 1000 +#define SVGA_3D_CMD_BASE 1040 + +#define SVGA_3D_CMD_SURFACE_DEFINE SVGA_3D_CMD_BASE + 0 +#define SVGA_3D_CMD_SURFACE_DESTROY SVGA_3D_CMD_BASE + 1 +#define SVGA_3D_CMD_SURFACE_COPY SVGA_3D_CMD_BASE + 2 +#define SVGA_3D_CMD_SURFACE_STRETCHBLT SVGA_3D_CMD_BASE + 3 +#define SVGA_3D_CMD_SURFACE_DMA SVGA_3D_CMD_BASE + 4 +#define SVGA_3D_CMD_CONTEXT_DEFINE SVGA_3D_CMD_BASE + 5 +#define SVGA_3D_CMD_CONTEXT_DESTROY SVGA_3D_CMD_BASE + 6 +#define SVGA_3D_CMD_SETTRANSFORM SVGA_3D_CMD_BASE + 7 +#define SVGA_3D_CMD_SETZRANGE SVGA_3D_CMD_BASE + 8 +#define SVGA_3D_CMD_SETRENDERSTATE SVGA_3D_CMD_BASE + 9 +#define SVGA_3D_CMD_SETRENDERTARGET SVGA_3D_CMD_BASE + 10 +#define SVGA_3D_CMD_SETTEXTURESTATE SVGA_3D_CMD_BASE + 11 +#define SVGA_3D_CMD_SETMATERIAL SVGA_3D_CMD_BASE + 12 +#define SVGA_3D_CMD_SETLIGHTDATA SVGA_3D_CMD_BASE + 13 +#define SVGA_3D_CMD_SETLIGHTENABLED SVGA_3D_CMD_BASE + 14 +#define SVGA_3D_CMD_SETVIEWPORT SVGA_3D_CMD_BASE + 15 +#define SVGA_3D_CMD_SETCLIPPLANE SVGA_3D_CMD_BASE + 16 +#define SVGA_3D_CMD_CLEAR SVGA_3D_CMD_BASE + 17 +#define SVGA_3D_CMD_PRESENT SVGA_3D_CMD_BASE + 18 // Deprecated +#define SVGA_3D_CMD_SHADER_DEFINE SVGA_3D_CMD_BASE + 19 +#define SVGA_3D_CMD_SHADER_DESTROY SVGA_3D_CMD_BASE + 20 +#define SVGA_3D_CMD_SET_SHADER SVGA_3D_CMD_BASE + 21 +#define SVGA_3D_CMD_SET_SHADER_CONST SVGA_3D_CMD_BASE + 22 +#define SVGA_3D_CMD_DRAW_PRIMITIVES SVGA_3D_CMD_BASE + 23 +#define SVGA_3D_CMD_SETSCISSORRECT SVGA_3D_CMD_BASE + 24 +#define SVGA_3D_CMD_BEGIN_QUERY SVGA_3D_CMD_BASE + 25 +#define SVGA_3D_CMD_END_QUERY SVGA_3D_CMD_BASE + 26 +#define SVGA_3D_CMD_WAIT_FOR_QUERY SVGA_3D_CMD_BASE + 27 +#define SVGA_3D_CMD_PRESENT_READBACK SVGA_3D_CMD_BASE + 28 // Deprecated +#define SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN SVGA_3D_CMD_BASE + 29 +#define SVGA_3D_CMD_MAX SVGA_3D_CMD_BASE + 30 + +#define SVGA_3D_CMD_FUTURE_MAX 2000 + +/* + * Common substructures used in multiple FIFO commands: + */ + +typedef struct { + union { + struct { + uint16 function; // SVGA3dFogFunction + uint8 type; // SVGA3dFogType + uint8 base; // SVGA3dFogBase + }; + uint32 uintValue; + }; +} SVGA3dFogMode; + +/* + * Uniquely identify one image (a 1D/2D/3D array) from a surface. This + * is a surface ID as well as face/mipmap indices. + */ + +typedef +struct SVGA3dSurfaceImageId { + uint32 sid; + uint32 face; + uint32 mipmap; +} SVGA3dSurfaceImageId; + +typedef +struct SVGA3dGuestImage { + SVGAGuestPtr ptr; + + /* + * A note on interpretation of pitch: This value of pitch is the + * number of bytes between vertically adjacent image + * blocks. Normally this is the number of bytes between the first + * pixel of two adjacent scanlines. With compressed textures, + * however, this may represent the number of bytes between + * compression blocks rather than between rows of pixels. + * + * XXX: Compressed textures currently must be tightly packed in guest memory. + * + * If the image is 1-dimensional, pitch is ignored. + * + * If 'pitch' is zero, the SVGA3D device calculates a pitch value + * assuming each row of blocks is tightly packed. + */ + uint32 pitch; +} SVGA3dGuestImage; + + +/* + * FIFO command format definitions: + */ + +/* + * The data size header following cmdNum for every 3d command + */ +typedef +struct { + uint32 id; + uint32 size; +} SVGA3dCmdHeader; + +/* + * A surface is a hierarchy of host VRAM surfaces: 1D, 2D, or 3D, with + * optional mipmaps and cube faces. + */ + +typedef +struct { + uint32 width; + uint32 height; + uint32 depth; +} SVGA3dSize; + +typedef enum { + SVGA3D_SURFACE_CUBEMAP = (1 << 0), + SVGA3D_SURFACE_HINT_STATIC = (1 << 1), + SVGA3D_SURFACE_HINT_DYNAMIC = (1 << 2), + SVGA3D_SURFACE_HINT_INDEXBUFFER = (1 << 3), + SVGA3D_SURFACE_HINT_VERTEXBUFFER = (1 << 4), + SVGA3D_SURFACE_HINT_TEXTURE = (1 << 5), + SVGA3D_SURFACE_HINT_RENDERTARGET = (1 << 6), + SVGA3D_SURFACE_HINT_DEPTHSTENCIL = (1 << 7), + SVGA3D_SURFACE_HINT_WRITEONLY = (1 << 8), +} SVGA3dSurfaceFlags; + +typedef +struct { + uint32 numMipLevels; +} SVGA3dSurfaceFace; + +typedef +struct { + uint32 sid; + SVGA3dSurfaceFlags surfaceFlags; + SVGA3dSurfaceFormat format; + SVGA3dSurfaceFace face[SVGA3D_MAX_SURFACE_FACES]; + /* + * Followed by an SVGA3dSize structure for each mip level in each face. + * + * A note on surface sizes: Sizes are always specified in pixels, + * even if the true surface size is not a multiple of the minimum + * block size of the surface's format. For example, a 3x3x1 DXT1 + * compressed texture would actually be stored as a 4x4x1 image in + * memory. + */ +} SVGA3dCmdDefineSurface; /* SVGA_3D_CMD_SURFACE_DEFINE */ + +typedef +struct { + uint32 sid; +} SVGA3dCmdDestroySurface; /* SVGA_3D_CMD_SURFACE_DESTROY */ + +typedef +struct { + uint32 cid; +} SVGA3dCmdDefineContext; /* SVGA_3D_CMD_CONTEXT_DEFINE */ + +typedef +struct { + uint32 cid; +} SVGA3dCmdDestroyContext; /* SVGA_3D_CMD_CONTEXT_DESTROY */ + +typedef +struct { + uint32 cid; + SVGA3dClearFlag clearFlag; + uint32 color; + float depth; + uint32 stencil; + /* Followed by variable number of SVGA3dRect structures */ +} SVGA3dCmdClear; /* SVGA_3D_CMD_CLEAR */ + +typedef +struct SVGA3dCopyRect { + uint32 x; + uint32 y; + uint32 w; + uint32 h; + uint32 srcx; + uint32 srcy; +} SVGA3dCopyRect; + +typedef +struct SVGA3dCopyBox { + uint32 x; + uint32 y; + uint32 z; + uint32 w; + uint32 h; + uint32 d; + uint32 srcx; + uint32 srcy; + uint32 srcz; +} SVGA3dCopyBox; + +typedef +struct { + uint32 x; + uint32 y; + uint32 w; + uint32 h; +} SVGA3dRect; + +typedef +struct { + uint32 x; + uint32 y; + uint32 z; + uint32 w; + uint32 h; + uint32 d; +} SVGA3dBox; + +typedef +struct { + uint32 x; + uint32 y; + uint32 z; +} SVGA3dPoint; + +typedef +struct { + SVGA3dLightType type; + SVGA3dBool inWorldSpace; + float diffuse[4]; + float specular[4]; + float ambient[4]; + float position[4]; + float direction[4]; + float range; + float falloff; + float attenuation0; + float attenuation1; + float attenuation2; + float theta; + float phi; +} SVGA3dLightData; + +typedef +struct { + uint32 sid; + /* Followed by variable number of SVGA3dCopyRect structures */ +} SVGA3dCmdPresent; /* SVGA_3D_CMD_PRESENT */ + +typedef +struct { + SVGA3dRenderStateName state; + union { + uint32 uintValue; + float floatValue; + }; +} SVGA3dRenderState; + +typedef +struct { + uint32 cid; + /* Followed by variable number of SVGA3dRenderState structures */ +} SVGA3dCmdSetRenderState; /* SVGA_3D_CMD_SETRENDERSTATE */ + +typedef +struct { + uint32 cid; + SVGA3dRenderTargetType type; + SVGA3dSurfaceImageId target; +} SVGA3dCmdSetRenderTarget; /* SVGA_3D_CMD_SETRENDERTARGET */ + +typedef +struct { + SVGA3dSurfaceImageId src; + SVGA3dSurfaceImageId dest; + /* Followed by variable number of SVGA3dCopyBox structures */ +} SVGA3dCmdSurfaceCopy; /* SVGA_3D_CMD_SURFACE_COPY */ + +typedef +struct { + SVGA3dSurfaceImageId src; + SVGA3dSurfaceImageId dest; + SVGA3dBox boxSrc; + SVGA3dBox boxDest; + SVGA3dStretchBltMode mode; +} SVGA3dCmdSurfaceStretchBlt; /* SVGA_3D_CMD_SURFACE_STRETCHBLT */ + +typedef +struct { + /* + * If the discard flag is present in a surface DMA operation, the host may + * discard the contents of the current mipmap level and face of the target + * surface before applying the surface DMA contents. + */ + uint32 discard : 1; + + /* + * If the unsynchronized flag is present, the host may perform this upload + * without syncing to pending reads on this surface. + */ + uint32 unsynchronized : 1; + + /* + * Guests *MUST* set the reserved bits to 0 before submitting the command + * suffix as future flags may occupy these bits. + */ + uint32 reserved : 30; +} SVGA3dSurfaceDMAFlags; + +typedef +struct { + SVGA3dGuestImage guest; + SVGA3dSurfaceImageId host; + SVGA3dTransferType transfer; + /* + * Followed by variable number of SVGA3dCopyBox structures. For consistency + * in all clipping logic and coordinate translation, we define the + * "source" in each copyBox as the guest image and the + * "destination" as the host image, regardless of transfer + * direction. + * + * For efficiency, the SVGA3D device is free to copy more data than + * specified. For example, it may round copy boxes outwards such + * that they lie on particular alignment boundaries. + */ +} SVGA3dCmdSurfaceDMA; /* SVGA_3D_CMD_SURFACE_DMA */ + +/* + * SVGA3dCmdSurfaceDMASuffix -- + * + * This is a command suffix that will appear after a SurfaceDMA command in + * the FIFO. It contains some extra information that hosts may use to + * optimize performance or protect the guest. This suffix exists to preserve + * backwards compatibility while also allowing for new functionality to be + * implemented. + */ + +typedef +struct { + uint32 suffixSize; + + /* + * The maximum offset is used to determine the maximum offset from the + * guestPtr base address that will be accessed or written to during this + * surfaceDMA. If the suffix is supported, the host will respect this + * boundary while performing surface DMAs. + * + * Defaults to MAX_UINT32 + */ + uint32 maximumOffset; + + /* + * A set of flags that describes optimizations that the host may perform + * while performing this surface DMA operation. The guest should never rely + * on behaviour that is different when these flags are set for correctness. + * + * Defaults to 0 + */ + SVGA3dSurfaceDMAFlags flags; +} SVGA3dCmdSurfaceDMASuffix; + +/* + * SVGA_3D_CMD_DRAW_PRIMITIVES -- + * + * This command is the SVGA3D device's generic drawing entry point. + * It can draw multiple ranges of primitives, optionally using an + * index buffer, using an arbitrary collection of vertex buffers. + * + * Each SVGA3dVertexDecl defines a distinct vertex array to bind + * during this draw call. The declarations specify which surface + * the vertex data lives in, what that vertex data is used for, + * and how to interpret it. + * + * Each SVGA3dPrimitiveRange defines a collection of primitives + * to render using the same vertex arrays. An index buffer is + * optional. + */ + +typedef +struct { + /* + * A range hint is an optional specification for the range of indices + * in an SVGA3dArray that will be used. If 'last' is zero, it is assumed + * that the entire array will be used. + * + * These are only hints. The SVGA3D device may use them for + * performance optimization if possible, but it's also allowed to + * ignore these values. + */ + uint32 first; + uint32 last; +} SVGA3dArrayRangeHint; + +typedef +struct { + /* + * Define the origin and shape of a vertex or index array. Both + * 'offset' and 'stride' are in bytes. The provided surface will be + * reinterpreted as a flat array of bytes in the same format used + * by surface DMA operations. To avoid unnecessary conversions, the + * surface should be created with the SVGA3D_BUFFER format. + * + * Index 0 in the array starts 'offset' bytes into the surface. + * Index 1 begins at byte 'offset + stride', etc. Array indices may + * not be negative. + */ + uint32 surfaceId; + uint32 offset; + uint32 stride; +} SVGA3dArray; + +typedef +struct { + /* + * Describe a vertex array's data type, and define how it is to be + * used by the fixed function pipeline or the vertex shader. It + * isn't useful to have two VertexDecls with the same + * VertexArrayIdentity in one draw call. + */ + SVGA3dDeclType type; + SVGA3dDeclMethod method; + SVGA3dDeclUsage usage; + uint32 usageIndex; +} SVGA3dVertexArrayIdentity; + +typedef +struct { + SVGA3dVertexArrayIdentity identity; + SVGA3dArray array; + SVGA3dArrayRangeHint rangeHint; +} SVGA3dVertexDecl; + +typedef +struct { + /* + * Define a group of primitives to render, from sequential indices. + * + * The value of 'primitiveType' and 'primitiveCount' imply the + * total number of vertices that will be rendered. + */ + SVGA3dPrimitiveType primType; + uint32 primitiveCount; + + /* + * Optional index buffer. If indexArray.surfaceId is + * SVGA3D_INVALID_ID, we render without an index buffer. Rendering + * without an index buffer is identical to rendering with an index + * buffer containing the sequence [0, 1, 2, 3, ...]. + * + * If an index buffer is in use, indexWidth specifies the width in + * bytes of each index value. It must be less than or equal to + * indexArray.stride. + * + * (Currently, the SVGA3D device requires index buffers to be tightly + * packed. In other words, indexWidth == indexArray.stride) + */ + SVGA3dArray indexArray; + uint32 indexWidth; + + /* + * Optional index bias. This number is added to all indices from + * indexArray before they are used as vertex array indices. This + * can be used in multiple ways: + * + * - When not using an indexArray, this bias can be used to + * specify where in the vertex arrays to begin rendering. + * + * - A positive number here is equivalent to increasing the + * offset in each vertex array. + * + * - A negative number can be used to render using a small + * vertex array and an index buffer that contains large + * values. This may be used by some applications that + * crop a vertex buffer without modifying their index + * buffer. + * + * Note that rendering with a negative bias value may be slower and + * use more memory than rendering with a positive or zero bias. + */ + int32 indexBias; +} SVGA3dPrimitiveRange; + +typedef +struct { + uint32 cid; + uint32 numVertexDecls; + uint32 numRanges; + + /* + * There are two variable size arrays after the + * SVGA3dCmdDrawPrimitives structure. In order, + * they are: + * + * 1. SVGA3dVertexDecl, quantity 'numVertexDecls' + * 2. SVGA3dPrimitiveRange, quantity 'numRanges' + * 3. Optionally, SVGA3dVertexDivisor, quantity 'numVertexDecls' (contains + * the frequency divisor for this the corresponding vertex decl) + */ +} SVGA3dCmdDrawPrimitives; /* SVGA_3D_CMD_DRAWPRIMITIVES */ + +typedef +struct { + uint32 stage; + SVGA3dTextureStateName name; + union { + uint32 value; + float floatValue; + }; +} SVGA3dTextureState; + +typedef +struct { + uint32 cid; + /* Followed by variable number of SVGA3dTextureState structures */ +} SVGA3dCmdSetTextureState; /* SVGA_3D_CMD_SETTEXTURESTATE */ + +typedef +struct { + uint32 cid; + SVGA3dTransformType type; + float matrix[16]; +} SVGA3dCmdSetTransform; /* SVGA_3D_CMD_SETTRANSFORM */ + +typedef +struct { + float min; + float max; +} SVGA3dZRange; + +typedef +struct { + uint32 cid; + SVGA3dZRange zRange; +} SVGA3dCmdSetZRange; /* SVGA_3D_CMD_SETZRANGE */ + +typedef +struct { + float diffuse[4]; + float ambient[4]; + float specular[4]; + float emissive[4]; + float shininess; +} SVGA3dMaterial; + +typedef +struct { + uint32 cid; + SVGA3dFace face; + SVGA3dMaterial material; +} SVGA3dCmdSetMaterial; /* SVGA_3D_CMD_SETMATERIAL */ + +typedef +struct { + uint32 cid; + uint32 index; + SVGA3dLightData data; +} SVGA3dCmdSetLightData; /* SVGA_3D_CMD_SETLIGHTDATA */ + +typedef +struct { + uint32 cid; + uint32 index; + uint32 enabled; +} SVGA3dCmdSetLightEnabled; /* SVGA_3D_CMD_SETLIGHTENABLED */ + +typedef +struct { + uint32 cid; + SVGA3dRect rect; +} SVGA3dCmdSetViewport; /* SVGA_3D_CMD_SETVIEWPORT */ + +typedef +struct { + uint32 cid; + SVGA3dRect rect; +} SVGA3dCmdSetScissorRect; /* SVGA_3D_CMD_SETSCISSORRECT */ + +typedef +struct { + uint32 cid; + uint32 index; + float plane[4]; +} SVGA3dCmdSetClipPlane; /* SVGA_3D_CMD_SETCLIPPLANE */ + +typedef +struct { + uint32 cid; + uint32 shid; + SVGA3dShaderType type; + /* Followed by variable number of DWORDs for shader bycode */ +} SVGA3dCmdDefineShader; /* SVGA_3D_CMD_SHADER_DEFINE */ + +typedef +struct { + uint32 cid; + uint32 shid; + SVGA3dShaderType type; +} SVGA3dCmdDestroyShader; /* SVGA_3D_CMD_SHADER_DESTROY */ + +typedef +struct { + uint32 cid; + uint32 reg; /* register number */ + SVGA3dShaderType type; + SVGA3dShaderConstType ctype; + uint32 values[4]; +} SVGA3dCmdSetShaderConst; /* SVGA_3D_CMD_SET_SHADER_CONST */ + +typedef +struct { + uint32 cid; + SVGA3dShaderType type; + uint32 shid; +} SVGA3dCmdSetShader; /* SVGA_3D_CMD_SET_SHADER */ + +typedef +struct { + uint32 cid; + SVGA3dQueryType type; +} SVGA3dCmdBeginQuery; /* SVGA_3D_CMD_BEGIN_QUERY */ + +typedef +struct { + uint32 cid; + SVGA3dQueryType type; + SVGAGuestPtr guestResult; /* Points to an SVGA3dQueryResult structure */ +} SVGA3dCmdEndQuery; /* SVGA_3D_CMD_END_QUERY */ + +typedef +struct { + uint32 cid; /* Same parameters passed to END_QUERY */ + SVGA3dQueryType type; + SVGAGuestPtr guestResult; +} SVGA3dCmdWaitForQuery; /* SVGA_3D_CMD_WAIT_FOR_QUERY */ + +typedef +struct { + uint32 totalSize; /* Set by guest before query is ended. */ + SVGA3dQueryState state; /* Set by host or guest. See SVGA3dQueryState. */ + union { /* Set by host on exit from PENDING state */ + uint32 result32; + }; +} SVGA3dQueryResult; + +/* + * SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN -- + * + * This is a blit from an SVGA3D surface to a Screen Object. Just + * like GMR-to-screen blits, this blit may be directed at a + * specific screen or to the virtual coordinate space. + * + * The blit copies from a rectangular region of an SVGA3D surface + * image to a rectangular region of a screen or screens. + * + * This command takes an optional variable-length list of clipping + * rectangles after the body of the command. If no rectangles are + * specified, there is no clipping region. The entire destRect is + * drawn to. If one or more rectangles are included, they describe + * a clipping region. The clip rectangle coordinates are measured + * relative to the top-left corner of destRect. + * + * This clipping region serves multiple purposes: + * + * - It can be used to perform an irregularly shaped blit more + * efficiently than by issuing many separate blit commands. + * + * - It is equivalent to allowing blits with non-integer + * source coordinates. You could blit just one half-pixel + * of a source, for example, by specifying a larger + * destination rectangle than you need, then removing + * part of it using a clip rectangle. + * + * Availability: + * SVGA_FIFO_CAP_SCREEN_OBJECT + * + * Limitations: + * + * - Currently, no backend supports blits from a mipmap or face + * other than the first one. + */ + +typedef +struct { + SVGA3dSurfaceImageId srcImage; + SVGASignedRect srcRect; + uint32 destScreenId; /* Screen ID or SVGA_ID_INVALID for virt. coords */ + SVGASignedRect destRect; /* Supports scaling if src/rest different size */ + /* Clipping: zero or more SVGASignedRects follow */ +} SVGA3dCmdBlitSurfaceToScreen; /* SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN */ + + +/* + * Capability query index. + * + * Notes: + * + * 1. SVGA3D_DEVCAP_MAX_TEXTURES reflects the maximum number of + * fixed-function texture units available. Each of these units + * work in both FFP and Shader modes, and they support texture + * transforms and texture coordinates. The host may have additional + * texture image units that are only usable with shaders. + * + * 2. The BUFFER_FORMAT capabilities are deprecated, and they always + * return TRUE. Even on physical hardware that does not support + * these formats natively, the SVGA3D device will provide an emulation + * which should be invisible to the guest OS. + * + * In general, the SVGA3D device should support any operation on + * any surface format, it just may perform some of these + * operations in software depending on the capabilities of the + * available physical hardware. + * + * XXX: In the future, we will add capabilities that describe in + * detail what formats are supported in hardware for what kinds + * of operations. + */ + +typedef enum { + SVGA3D_DEVCAP_3D = 0, + SVGA3D_DEVCAP_MAX_LIGHTS = 1, + SVGA3D_DEVCAP_MAX_TEXTURES = 2, /* See note (1) */ + SVGA3D_DEVCAP_MAX_CLIP_PLANES = 3, + SVGA3D_DEVCAP_VERTEX_SHADER_VERSION = 4, + SVGA3D_DEVCAP_VERTEX_SHADER = 5, + SVGA3D_DEVCAP_FRAGMENT_SHADER_VERSION = 6, + SVGA3D_DEVCAP_FRAGMENT_SHADER = 7, + SVGA3D_DEVCAP_MAX_RENDER_TARGETS = 8, + SVGA3D_DEVCAP_S23E8_TEXTURES = 9, + SVGA3D_DEVCAP_S10E5_TEXTURES = 10, + SVGA3D_DEVCAP_MAX_FIXED_VERTEXBLEND = 11, + SVGA3D_DEVCAP_D16_BUFFER_FORMAT = 12, /* See note (2) */ + SVGA3D_DEVCAP_D24S8_BUFFER_FORMAT = 13, /* See note (2) */ + SVGA3D_DEVCAP_D24X8_BUFFER_FORMAT = 14, /* See note (2) */ + SVGA3D_DEVCAP_QUERY_TYPES = 15, + SVGA3D_DEVCAP_TEXTURE_GRADIENT_SAMPLING = 16, + SVGA3D_DEVCAP_MAX_POINT_SIZE = 17, + SVGA3D_DEVCAP_MAX_SHADER_TEXTURES = 18, + SVGA3D_DEVCAP_MAX_TEXTURE_WIDTH = 19, + SVGA3D_DEVCAP_MAX_TEXTURE_HEIGHT = 20, + SVGA3D_DEVCAP_MAX_VOLUME_EXTENT = 21, + SVGA3D_DEVCAP_MAX_TEXTURE_REPEAT = 22, + SVGA3D_DEVCAP_MAX_TEXTURE_ASPECT_RATIO = 23, + SVGA3D_DEVCAP_MAX_TEXTURE_ANISOTROPY = 24, + SVGA3D_DEVCAP_MAX_PRIMITIVE_COUNT = 25, + SVGA3D_DEVCAP_MAX_VERTEX_INDEX = 26, + SVGA3D_DEVCAP_MAX_VERTEX_SHADER_INSTRUCTIONS = 27, + SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_INSTRUCTIONS = 28, + SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEMPS = 29, + SVGA3D_DEVCAP_MAX_FRAGMENT_SHADER_TEMPS = 30, + SVGA3D_DEVCAP_TEXTURE_OPS = 31, + SVGA3D_DEVCAP_SURFACEFMT_X8R8G8B8 = 32, + SVGA3D_DEVCAP_SURFACEFMT_A8R8G8B8 = 33, + SVGA3D_DEVCAP_SURFACEFMT_A2R10G10B10 = 34, + SVGA3D_DEVCAP_SURFACEFMT_X1R5G5B5 = 35, + SVGA3D_DEVCAP_SURFACEFMT_A1R5G5B5 = 36, + SVGA3D_DEVCAP_SURFACEFMT_A4R4G4B4 = 37, + SVGA3D_DEVCAP_SURFACEFMT_R5G6B5 = 38, + SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE16 = 39, + SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8_ALPHA8 = 40, + SVGA3D_DEVCAP_SURFACEFMT_ALPHA8 = 41, + SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8 = 42, + SVGA3D_DEVCAP_SURFACEFMT_Z_D16 = 43, + SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8 = 44, + SVGA3D_DEVCAP_SURFACEFMT_Z_D24X8 = 45, + SVGA3D_DEVCAP_SURFACEFMT_DXT1 = 46, + SVGA3D_DEVCAP_SURFACEFMT_DXT2 = 47, + SVGA3D_DEVCAP_SURFACEFMT_DXT3 = 48, + SVGA3D_DEVCAP_SURFACEFMT_DXT4 = 49, + SVGA3D_DEVCAP_SURFACEFMT_DXT5 = 50, + SVGA3D_DEVCAP_SURFACEFMT_BUMPX8L8V8U8 = 51, + SVGA3D_DEVCAP_SURFACEFMT_A2W10V10U10 = 52, + SVGA3D_DEVCAP_SURFACEFMT_BUMPU8V8 = 53, + SVGA3D_DEVCAP_SURFACEFMT_Q8W8V8U8 = 54, + SVGA3D_DEVCAP_SURFACEFMT_CxV8U8 = 55, + SVGA3D_DEVCAP_SURFACEFMT_R_S10E5 = 56, + SVGA3D_DEVCAP_SURFACEFMT_R_S23E8 = 57, + SVGA3D_DEVCAP_SURFACEFMT_RG_S10E5 = 58, + SVGA3D_DEVCAP_SURFACEFMT_RG_S23E8 = 59, + SVGA3D_DEVCAP_SURFACEFMT_ARGB_S10E5 = 60, + SVGA3D_DEVCAP_SURFACEFMT_ARGB_S23E8 = 61, + SVGA3D_DEVCAP_MAX_VERTEX_SHADER_TEXTURES = 63, + + /* + * Note that MAX_SIMULTANEOUS_RENDER_TARGETS is a maximum count of color + * render targets. This does no include the depth or stencil targets. + */ + SVGA3D_DEVCAP_MAX_SIMULTANEOUS_RENDER_TARGETS = 64, + + SVGA3D_DEVCAP_SURFACEFMT_V16U16 = 65, + SVGA3D_DEVCAP_SURFACEFMT_G16R16 = 66, + SVGA3D_DEVCAP_SURFACEFMT_A16B16G16R16 = 67, + SVGA3D_DEVCAP_SURFACEFMT_UYVY = 68, + SVGA3D_DEVCAP_SURFACEFMT_YUY2 = 69, + + /* + * Don't add new caps into the previous section; the values in this + * enumeration must not change. You can put new values right before + * SVGA3D_DEVCAP_MAX. + */ + SVGA3D_DEVCAP_MAX /* This must be the last index. */ +} SVGA3dDevCapIndex; + +typedef union { + Bool b; + uint32 u; + int32 i; + float f; +} SVGA3dDevCapResult; + +#endif /* _SVGA3D_REG_H_ */ diff --git a/src/gallium/drivers/svga/include/svga3d_shaderdefs.h b/src/gallium/drivers/svga/include/svga3d_shaderdefs.h new file mode 100644 index 0000000000..2078c4a8a4 --- /dev/null +++ b/src/gallium/drivers/svga/include/svga3d_shaderdefs.h @@ -0,0 +1,519 @@ +/********************************************************** + * Copyright 2007-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, 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. + * + **********************************************************/ + +/* + * svga3d_shaderdefs.h -- + * + * SVGA3D byte code format and limit definitions. + * + * The format of the byte code directly corresponds to that defined + * by Microsoft DirectX SDK 9.0c (file d3d9types.h). The format can + * also be extended so that different shader formats can be supported + * for example GLSL, ARB vp/fp, NV/ATI shader formats, etc. + * + */ + +#ifndef __SVGA3D_SHADER_DEFS__ +#define __SVGA3D_SHADER_DEFS__ + +/* SVGA3D shader hardware limits. */ + +#define SVGA3D_INPUTREG_MAX 16 +#define SVGA3D_OUTPUTREG_MAX 12 +#define SVGA3D_VERTEX_SAMPLERREG_MAX 4 +#define SVGA3D_PIXEL_SAMPLERREG_MAX 16 +#define SVGA3D_SAMPLERREG_MAX (SVGA3D_PIXEL_SAMPLERREG_MAX+\ + SVGA3D_VERTEX_SAMPLERREG_MAX) +#define SVGA3D_TEMPREG_MAX 32 +#define SVGA3D_CONSTREG_MAX 256 +#define SVGA3D_CONSTINTREG_MAX 16 +#define SVGA3D_CONSTBOOLREG_MAX 16 +#define SVGA3D_ADDRREG_MAX 1 +#define SVGA3D_PREDREG_MAX 1 + +/* SVGA3D byte code specific limits */ + +#define SVGA3D_MAX_SRC_REGS 4 +#define SVGA3D_MAX_NESTING_LEVEL 32 + +/* SVGA3D version information. */ + +#define SVGA3D_VS_TYPE 0xFFFE +#define SVGA3D_PS_TYPE 0xFFFF + +typedef struct { + union { + struct { + uint32 minor : 8; + uint32 major : 8; + uint32 type : 16; + }; + + uint32 value; + }; +} SVGA3dShaderVersion; + +#define SVGA3D_VS_10 ((SVGA3D_VS_TYPE << 16) | 1 << 8) +#define SVGA3D_VS_11 (SVGA3D_VS_10 | 1) +#define SVGA3D_VS_20 ((SVGA3D_VS_TYPE << 16) | 2 << 8) +#define SVGA3D_VS_30 ((SVGA3D_VS_TYPE << 16) | 3 << 8) + +#define SVGA3D_PS_10 ((SVGA3D_PS_TYPE << 16) | 1 << 8) +#define SVGA3D_PS_11 (SVGA3D_PS_10 | 1) +#define SVGA3D_PS_12 (SVGA3D_PS_10 | 2) +#define SVGA3D_PS_13 (SVGA3D_PS_10 | 3) +#define SVGA3D_PS_14 (SVGA3D_PS_10 | 4) +#define SVGA3D_PS_20 ((SVGA3D_PS_TYPE << 16) | 2 << 8) +#define SVGA3D_PS_30 ((SVGA3D_PS_TYPE << 16) | 3 << 8) + +/* The *_ENABLED are for backwards compatibility with old drivers */ +typedef enum { + SVGA3DPSVERSION_NONE = 0, + SVGA3DPSVERSION_ENABLED = 1, + SVGA3DPSVERSION_11 = 3, + SVGA3DPSVERSION_12 = 5, + SVGA3DPSVERSION_13 = 7, + SVGA3DPSVERSION_14 = 9, + SVGA3DPSVERSION_20 = 11, + SVGA3DPSVERSION_30 = 13, + SVGA3DPSVERSION_40 = 15, + SVGA3DPSVERSION_MAX +} SVGA3dPixelShaderVersion; + +typedef enum { + SVGA3DVSVERSION_NONE = 0, + SVGA3DVSVERSION_ENABLED = 1, + SVGA3DVSVERSION_11 = 3, + SVGA3DVSVERSION_20 = 5, + SVGA3DVSVERSION_30 = 7, + SVGA3DVSVERSION_40 = 9, + SVGA3DVSVERSION_MAX +} SVGA3dVertexShaderVersion; + +/* SVGA3D instruction op codes. */ + +typedef enum { + SVGA3DOP_NOP = 0, + SVGA3DOP_MOV, + SVGA3DOP_ADD, + SVGA3DOP_SUB, + SVGA3DOP_MAD, + SVGA3DOP_MUL, + SVGA3DOP_RCP, + SVGA3DOP_RSQ, + SVGA3DOP_DP3, + SVGA3DOP_DP4, + SVGA3DOP_MIN, + SVGA3DOP_MAX, + SVGA3DOP_SLT, + SVGA3DOP_SGE, + SVGA3DOP_EXP, + SVGA3DOP_LOG, + SVGA3DOP_LIT, + SVGA3DOP_DST, + SVGA3DOP_LRP, + SVGA3DOP_FRC, + SVGA3DOP_M4x4, + SVGA3DOP_M4x3, + SVGA3DOP_M3x4, + SVGA3DOP_M3x3, + SVGA3DOP_M3x2, + SVGA3DOP_CALL, + SVGA3DOP_CALLNZ, + SVGA3DOP_LOOP, + SVGA3DOP_RET, + SVGA3DOP_ENDLOOP, + SVGA3DOP_LABEL, + SVGA3DOP_DCL, + SVGA3DOP_POW, + SVGA3DOP_CRS, + SVGA3DOP_SGN, + SVGA3DOP_ABS, + SVGA3DOP_NRM, + SVGA3DOP_SINCOS, + SVGA3DOP_REP, + SVGA3DOP_ENDREP, + SVGA3DOP_IF, + SVGA3DOP_IFC, + SVGA3DOP_ELSE, + SVGA3DOP_ENDIF, + SVGA3DOP_BREAK, + SVGA3DOP_BREAKC, + SVGA3DOP_MOVA, + SVGA3DOP_DEFB, + SVGA3DOP_DEFI, + SVGA3DOP_TEXCOORD = 64, + SVGA3DOP_TEXKILL, + SVGA3DOP_TEX, + SVGA3DOP_TEXBEM, + SVGA3DOP_TEXBEML, + SVGA3DOP_TEXREG2AR, + SVGA3DOP_TEXREG2GB = 70, + SVGA3DOP_TEXM3x2PAD, + SVGA3DOP_TEXM3x2TEX, + SVGA3DOP_TEXM3x3PAD, + SVGA3DOP_TEXM3x3TEX, + SVGA3DOP_RESERVED0, + SVGA3DOP_TEXM3x3SPEC, + SVGA3DOP_TEXM3x3VSPEC, + SVGA3DOP_EXPP, + SVGA3DOP_LOGP, + SVGA3DOP_CND = 80, + SVGA3DOP_DEF, + SVGA3DOP_TEXREG2RGB, + SVGA3DOP_TEXDP3TEX, + SVGA3DOP_TEXM3x2DEPTH, + SVGA3DOP_TEXDP3, + SVGA3DOP_TEXM3x3, + SVGA3DOP_TEXDEPTH, + SVGA3DOP_CMP, + SVGA3DOP_BEM, + SVGA3DOP_DP2ADD = 90, + SVGA3DOP_DSX, + SVGA3DOP_DSY, + SVGA3DOP_TEXLDD, + SVGA3DOP_SETP, + SVGA3DOP_TEXLDL, + SVGA3DOP_BREAKP = 96, + SVGA3DOP_LAST_INST, + SVGA3DOP_PHASE = 0xFFFD, + SVGA3DOP_COMMENT = 0xFFFE, + SVGA3DOP_END = 0xFFFF, +} SVGA3dShaderOpCodeType; + +/* SVGA3D operation control/comparison function types */ + +typedef enum { + SVGA3DOPCONT_NONE, + SVGA3DOPCONT_PROJECT, /* Projective texturing */ + SVGA3DOPCONT_BIAS, /* Texturing with a LOD bias */ +} SVGA3dShaderOpCodeControlFnType; + +typedef enum { + SVGA3DOPCOMP_RESERVED0 = 0, + SVGA3DOPCOMP_GT, + SVGA3DOPCOMP_EQ, + SVGA3DOPCOMP_GE, + SVGA3DOPCOMP_LT, + SVGA3DOPCOMPC_NE, + SVGA3DOPCOMP_LE, + SVGA3DOPCOMP_RESERVED1 +} SVGA3dShaderOpCodeCompFnType; + +/* SVGA3D register types */ + +typedef enum { + SVGA3DREG_TEMP = 0, /* Temporary register file */ + SVGA3DREG_INPUT, /* Input register file */ + SVGA3DREG_CONST, /* Constant register file */ + SVGA3DREG_ADDR, /* Address register for VS */ + SVGA3DREG_TEXTURE = 3, /* Texture register file for PS */ + SVGA3DREG_RASTOUT, /* Rasterizer register file */ + SVGA3DREG_ATTROUT, /* Attribute output register file */ + SVGA3DREG_TEXCRDOUT, /* Texture coordinate output register file */ + SVGA3DREG_OUTPUT = 6, /* Output register file for VS 3.0+ */ + SVGA3DREG_CONSTINT, /* Constant integer vector register file */ + SVGA3DREG_COLOROUT, /* Color output register file */ + SVGA3DREG_DEPTHOUT, /* Depth output register file */ + SVGA3DREG_SAMPLER, /* Sampler state register file */ + SVGA3DREG_CONST2, /* Constant register file 2048 - 4095 */ + SVGA3DREG_CONST3, /* Constant register file 4096 - 6143 */ + SVGA3DREG_CONST4, /* Constant register file 6144 - 8191 */ + SVGA3DREG_CONSTBOOL, /* Constant boolean register file */ + SVGA3DREG_LOOP, /* Loop counter register file */ + SVGA3DREG_TEMPFLOAT16, /* 16-bit float temp register file */ + SVGA3DREG_MISCTYPE, /* Miscellaneous (single) registers */ + SVGA3DREG_LABEL, /* Label */ + SVGA3DREG_PREDICATE, /* Predicate register */ +} SVGA3dShaderRegType; + +/* SVGA3D rasterizer output register types */ + +typedef enum { + SVGA3DRASTOUT_POSITION = 0, + SVGA3DRASTOUT_FOG, + SVGA3DRASTOUT_PSIZE +} SVGA3dShaderRastOutRegType; + +/* SVGA3D miscellaneous register types */ + +typedef enum { + SVGA3DMISCREG_POSITION = 0, /* Input position x,y,z,rhw (PS) */ + SVGA3DMISCREG_FACE /* Floating point primitive area (PS) */ +} SVGA3DShaderMiscRegType; + +/* SVGA3D sampler types */ + +typedef enum { + SVGA3DSAMP_UNKNOWN = 0, /* Uninitialized value */ + SVGA3DSAMP_2D = 2, /* dcl_2d s# (for declaring a 2-D texture) */ + SVGA3DSAMP_CUBE, /* dcl_cube s# (for declaring a cube texture) */ + SVGA3DSAMP_VOLUME, /* dcl_volume s# (for declaring a volume texture) */ +} SVGA3dShaderSamplerType; + +/* SVGA3D sampler format classes */ + +typedef enum { + SVGA3DSAMPFORMAT_ARGB, /* ARGB formats */ + SVGA3DSAMPFORMAT_V8U8, /* Sign and normalize (SNORM) V & U */ + SVGA3DSAMPFORMAT_Q8W8V8U8, /* SNORM all */ + SVGA3DSAMPFORMAT_CxV8U8, /* SNORM V & U, C=SQRT(1-U^2-V^2) */ + SVGA3DSAMPFORMAT_X8L8V8U8, /* SNORM V & U */ + SVGA3DSAMPFORMAT_A2W10V10U10, /* SNORM W, V & U */ + SVGA3DSAMPFORMAT_DXT_PMA, /* DXT pre-multiplied alpha */ + SVGA3DSAMPFORMAT_YUV, /* YUV video format */ + SVGA3DSAMPFORMAT_UYVY, /* UYVY video format */ + SVGA3DSAMPFORMAT_Rx, /* R16F/32F */ + SVGA3DSAMPFORMAT_RxGx, /* R16FG16F, R32FG32F */ + SVGA3DSAMPFORMAT_V16U16, /* SNORM all */ +} SVGA3DShaderSamplerFormatClass; + +/* SVGA3D write mask */ + +#define SVGA3DWRITEMASK_0 1 /* Component 0 (X;Red) */ +#define SVGA3DWRITEMASK_1 2 /* Component 1 (Y;Green) */ +#define SVGA3DWRITEMASK_2 4 /* Component 2 (Z;Blue) */ +#define SVGA3DWRITEMASK_3 8 /* Component 3 (W;Alpha) */ +#define SVGA3DWRITEMASK_ALL 15 /* All components */ + +/* SVGA3D destination modifiers */ + +#define SVGA3DDSTMOD_NONE 0 /* nop */ +#define SVGA3DDSTMOD_SATURATE 1 /* clamp to [0, 1] */ +#define SVGA3DDSTMOD_PARTIALPRECISION 2 /* Partial precision hint */ + +/* + * Relevant to multisampling only: + * When the pixel center is not covered, sample + * attribute or compute gradients/LOD + * using multisample "centroid" location. + * "Centroid" is some location within the covered + * region of the pixel. + */ + +#define SVGA3DDSTMOD_MSAMPCENTROID 4 + +/* SVGA3D source swizzle */ + +#define SVGA3DSWIZZLE_REPLICATEX 0x00 +#define SVGA3DSWIZZLE_REPLICATEY 0x55 +#define SVGA3DSWIZZLE_REPLICATEZ 0xAA +#define SVGA3DSWIZZLE_REPLICATEW 0xFF +#define SVGA3DSWIZZLE_NONE 0xE4 +#define SVGA3DSWIZZLE_YZXW 0xC9 +#define SVGA3DSWIZZLE_ZXYW 0xD2 +#define SVGA3DSWIZZLE_WXYZ 0x1B + +/* SVGA3D source modifiers */ + +typedef enum { + SVGA3DSRCMOD_NONE = 0, /* nop */ + SVGA3DSRCMOD_NEG, /* negate */ + SVGA3DSRCMOD_BIAS, /* bias */ + SVGA3DSRCMOD_BIASNEG, /* bias and negate */ + SVGA3DSRCMOD_SIGN, /* sign */ + SVGA3DSRCMOD_SIGNNEG, /* sign and negate */ + SVGA3DSRCMOD_COMP, /* complement */ + SVGA3DSRCMOD_X2, /* x2 */ + SVGA3DSRCMOD_X2NEG, /* x2 and negate */ + SVGA3DSRCMOD_DZ, /* divide through by z component */ + SVGA3DSRCMOD_DW, /* divide through by w component */ + SVGA3DSRCMOD_ABS, /* abs() */ + SVGA3DSRCMOD_ABSNEG, /* -abs() */ + SVGA3DSRCMOD_NOT, /* ! (for predicate register) */ +} SVGA3dShaderSrcModType; + +/* SVGA3D instruction token */ + +typedef struct { + union { + struct { + uint32 comment_op : 16; + uint32 comment_size : 16; + }; + + struct { + uint32 op : 16; + uint32 control : 3; + uint32 reserved2 : 5; + uint32 size : 4; + uint32 predicated : 1; + uint32 reserved1 : 1; + uint32 coissue : 1; + uint32 reserved0 : 1; + }; + + uint32 value; + }; +} SVGA3dShaderInstToken; + +/* SVGA3D destination parameter token */ + +typedef struct { + union { + struct { + uint32 num : 11; + uint32 type_upper : 2; + uint32 relAddr : 1; + uint32 reserved1 : 2; + uint32 mask : 4; + uint32 dstMod : 4; + uint32 shfScale : 4; + uint32 type_lower : 3; + uint32 reserved0 : 1; + }; + + uint32 value; + }; +} SVGA3dShaderDestToken; + +/* SVGA3D source parameter token */ + +typedef struct { + union { + struct { + uint32 num : 11; + uint32 type_upper : 2; + uint32 relAddr : 1; + uint32 reserved1 : 2; + uint32 swizzle : 8; + uint32 srcMod : 4; + uint32 type_lower : 3; + uint32 reserved0 : 1; + }; + + uint32 value; + }; +} SVGA3dShaderSrcToken; + +/* SVGA3DOP_DCL parameter tokens */ + +typedef struct { + union { + struct { + union { + struct { + uint32 usage : 5; + uint32 reserved1 : 11; + uint32 index : 4; + uint32 reserved0 : 12; + }; /* input / output declaration */ + + struct { + uint32 reserved3 : 27; + uint32 type : 4; + uint32 reserved2 : 1; + }; /* sampler declaration */ + }; + + SVGA3dShaderDestToken dst; + }; + + uint32 values[2]; + }; +} SVGA3DOpDclArgs; + +/* SVGA3DOP_DEF parameter tokens */ + +typedef struct { + union { + struct { + SVGA3dShaderDestToken dst; + + union { + float constValues[4]; + int constIValues[4]; + Bool constBValue; + }; + }; + + uint32 values[5]; + }; +} SVGA3DOpDefArgs; + +/* SVGA3D shader token */ + +typedef union { + uint32 value; + SVGA3dShaderInstToken inst; + SVGA3dShaderDestToken dest; + SVGA3dShaderSrcToken src; +} SVGA3dShaderToken; + +/* SVGA3D shader program */ + +typedef struct { + SVGA3dShaderVersion version; + /* SVGA3dShaderToken stream */ +} SVGA3dShaderProgram; + +/* SVGA3D version specific register assignments */ + +static const uint32 SVGA3D_INPUT_REG_POSITION_VS11 = 0; +static const uint32 SVGA3D_INPUT_REG_PSIZE_VS11 = 1; +static const uint32 SVGA3D_INPUT_REG_FOG_VS11 = 3; +static const uint32 SVGA3D_INPUT_REG_FOG_MASK_VS11 = SVGA3DWRITEMASK_3; +static const uint32 SVGA3D_INPUT_REG_COLOR_BASE_VS11 = 2; +static const uint32 SVGA3D_INPUT_REG_TEXCOORD_BASE_VS11 = 4; + +static const uint32 SVGA3D_INPUT_REG_COLOR_BASE_PS11 = 0; +static const uint32 SVGA3D_INPUT_REG_TEXCOORD_BASE_PS11 = 2; +static const uint32 SVGA3D_OUTPUT_REG_DEPTH_PS11 = 0; +static const uint32 SVGA3D_OUTPUT_REG_COLOR_PS11 = 1; + +static const uint32 SVGA3D_INPUT_REG_COLOR_BASE_PS20 = 0; +static const uint32 SVGA3D_INPUT_REG_COLOR_NUM_PS20 = 2; +static const uint32 SVGA3D_INPUT_REG_TEXCOORD_BASE_PS20 = 2; +static const uint32 SVGA3D_INPUT_REG_TEXCOORD_NUM_PS20 = 8; +static const uint32 SVGA3D_OUTPUT_REG_COLOR_BASE_PS20 = 1; +static const uint32 SVGA3D_OUTPUT_REG_COLOR_NUM_PS20 = 4; +static const uint32 SVGA3D_OUTPUT_REG_DEPTH_BASE_PS20 = 0; +static const uint32 SVGA3D_OUTPUT_REG_DEPTH_NUM_PS20 = 1; + +/* + *---------------------------------------------------------------------- + * + * SVGA3dShaderGetRegType -- + * + * As the register type is split into two non sequential fields, + * this function provides an useful way of accessing the actual + * register type without having to manually concatenate the + * type_upper and type_lower fields. + * + * Results: + * Returns the register type. + * + *---------------------------------------------------------------------- + */ + +static INLINE SVGA3dShaderRegType +SVGA3dShaderGetRegType(uint32 token) +{ + SVGA3dShaderSrcToken src; + src.value = token; + return (SVGA3dShaderRegType)(src.type_upper << 3 | src.type_lower); +} + +#endif /* __SVGA3D_SHADER_DEFS__ */ diff --git a/src/gallium/drivers/svga/include/svga_reg.h b/src/gallium/drivers/svga/include/svga_reg.h new file mode 100644 index 0000000000..1b96c2ec07 --- /dev/null +++ b/src/gallium/drivers/svga/include/svga_reg.h @@ -0,0 +1,1346 @@ +/********************************************************** + * Copyright 1998-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, 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. + * + **********************************************************/ + +/* + * svga_reg.h -- + * + * Virtual hardware definitions for the VMware SVGA II device. + */ + +#ifndef _SVGA_REG_H_ +#define _SVGA_REG_H_ + +/* + * PCI device IDs. + */ +#define PCI_VENDOR_ID_VMWARE 0x15AD +#define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405 + +/* + * Legal values for the SVGA_REG_CURSOR_ON register in old-fashioned + * cursor bypass mode. This is still supported, but no new guest + * drivers should use it. + */ +#define SVGA_CURSOR_ON_HIDE 0x0 /* Must be 0 to maintain backward compatibility */ +#define SVGA_CURSOR_ON_SHOW 0x1 /* Must be 1 to maintain backward compatibility */ +#define SVGA_CURSOR_ON_REMOVE_FROM_FB 0x2 /* Remove the cursor from the framebuffer because we need to see what's under it */ +#define SVGA_CURSOR_ON_RESTORE_TO_FB 0x3 /* Put the cursor back in the framebuffer so the user can see it */ + +/* + * The maximum framebuffer size that can traced for e.g. guests in VESA mode. + * The changeMap in the monitor is proportional to this number. Therefore, we'd + * like to keep it as small as possible to reduce monitor overhead (using + * SVGA_VRAM_MAX_SIZE for this increases the size of the shared area by over + * 4k!). + * + * NB: For compatibility reasons, this value must be greater than 0xff0000. + * See bug 335072. + */ +#define SVGA_FB_MAX_TRACEABLE_SIZE 0x1000000 + +#define SVGA_MAX_PSEUDOCOLOR_DEPTH 8 +#define SVGA_MAX_PSEUDOCOLORS (1 << SVGA_MAX_PSEUDOCOLOR_DEPTH) +#define SVGA_NUM_PALETTE_REGS (3 * SVGA_MAX_PSEUDOCOLORS) + +#define SVGA_MAGIC 0x900000UL +#define SVGA_MAKE_ID(ver) (SVGA_MAGIC << 8 | (ver)) + +/* Version 2 let the address of the frame buffer be unsigned on Win32 */ +#define SVGA_VERSION_2 2 +#define SVGA_ID_2 SVGA_MAKE_ID(SVGA_VERSION_2) + +/* Version 1 has new registers starting with SVGA_REG_CAPABILITIES so + PALETTE_BASE has moved */ +#define SVGA_VERSION_1 1 +#define SVGA_ID_1 SVGA_MAKE_ID(SVGA_VERSION_1) + +/* Version 0 is the initial version */ +#define SVGA_VERSION_0 0 +#define SVGA_ID_0 SVGA_MAKE_ID(SVGA_VERSION_0) + +/* "Invalid" value for all SVGA IDs. (Version ID, screen object ID, surface ID...) */ +#define SVGA_ID_INVALID 0xFFFFFFFF + +/* Port offsets, relative to BAR0 */ +#define SVGA_INDEX_PORT 0x0 +#define SVGA_VALUE_PORT 0x1 +#define SVGA_BIOS_PORT 0x2 +#define SVGA_IRQSTATUS_PORT 0x8 + +/* + * Interrupt source flags for IRQSTATUS_PORT and IRQMASK. + * + * Interrupts are only supported when the + * SVGA_CAP_IRQMASK capability is present. + */ +#define SVGA_IRQFLAG_ANY_FENCE 0x1 /* Any fence was passed */ +#define SVGA_IRQFLAG_FIFO_PROGRESS 0x2 /* Made forward progress in the FIFO */ +#define SVGA_IRQFLAG_FENCE_GOAL 0x4 /* SVGA_FIFO_FENCE_GOAL reached */ + +/* + * Registers + */ + +enum { + SVGA_REG_ID = 0, + SVGA_REG_ENABLE = 1, + SVGA_REG_WIDTH = 2, + SVGA_REG_HEIGHT = 3, + SVGA_REG_MAX_WIDTH = 4, + SVGA_REG_MAX_HEIGHT = 5, + SVGA_REG_DEPTH = 6, + SVGA_REG_BITS_PER_PIXEL = 7, /* Current bpp in the guest */ + SVGA_REG_PSEUDOCOLOR = 8, + SVGA_REG_RED_MASK = 9, + SVGA_REG_GREEN_MASK = 10, + SVGA_REG_BLUE_MASK = 11, + SVGA_REG_BYTES_PER_LINE = 12, + SVGA_REG_FB_START = 13, /* (Deprecated) */ + SVGA_REG_FB_OFFSET = 14, + SVGA_REG_VRAM_SIZE = 15, + SVGA_REG_FB_SIZE = 16, + + /* ID 0 implementation only had the above registers, then the palette */ + + SVGA_REG_CAPABILITIES = 17, + SVGA_REG_MEM_START = 18, /* (Deprecated) */ + SVGA_REG_MEM_SIZE = 19, + SVGA_REG_CONFIG_DONE = 20, /* Set when memory area configured */ + SVGA_REG_SYNC = 21, /* See "FIFO Synchronization Registers" */ + SVGA_REG_BUSY = 22, /* See "FIFO Synchronization Registers" */ + SVGA_REG_GUEST_ID = 23, /* Set guest OS identifier */ + SVGA_REG_CURSOR_ID = 24, /* (Deprecated) */ + SVGA_REG_CURSOR_X = 25, /* (Deprecated) */ + SVGA_REG_CURSOR_Y = 26, /* (Deprecated) */ + SVGA_REG_CURSOR_ON = 27, /* (Deprecated) */ + SVGA_REG_HOST_BITS_PER_PIXEL = 28, /* (Deprecated) */ + SVGA_REG_SCRATCH_SIZE = 29, /* Number of scratch registers */ + SVGA_REG_MEM_REGS = 30, /* Number of FIFO registers */ + SVGA_REG_NUM_DISPLAYS = 31, /* (Deprecated) */ + SVGA_REG_PITCHLOCK = 32, /* Fixed pitch for all modes */ + SVGA_REG_IRQMASK = 33, /* Interrupt mask */ + + /* Legacy multi-monitor support */ + SVGA_REG_NUM_GUEST_DISPLAYS = 34,/* Number of guest displays in X/Y direction */ + SVGA_REG_DISPLAY_ID = 35, /* Display ID for the following display attributes */ + SVGA_REG_DISPLAY_IS_PRIMARY = 36,/* Whether this is a primary display */ + SVGA_REG_DISPLAY_POSITION_X = 37,/* The display position x */ + SVGA_REG_DISPLAY_POSITION_Y = 38,/* The display position y */ + SVGA_REG_DISPLAY_WIDTH = 39, /* The display's width */ + SVGA_REG_DISPLAY_HEIGHT = 40, /* The display's height */ + + /* See "Guest memory regions" below. */ + SVGA_REG_GMR_ID = 41, + SVGA_REG_GMR_DESCRIPTOR = 42, + SVGA_REG_GMR_MAX_IDS = 43, + SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH = 44, + + SVGA_REG_TRACES = 45, /* Enable trace-based updates even when FIFO is on */ + SVGA_REG_TOP = 46, /* Must be 1 more than the last register */ + + SVGA_PALETTE_BASE = 1024, /* Base of SVGA color map */ + /* Next 768 (== 256*3) registers exist for colormap */ + + SVGA_SCRATCH_BASE = SVGA_PALETTE_BASE + SVGA_NUM_PALETTE_REGS + /* Base of scratch registers */ + /* Next reg[SVGA_REG_SCRATCH_SIZE] registers exist for scratch usage: + First 4 are reserved for VESA BIOS Extension; any remaining are for + the use of the current SVGA driver. */ +}; + + +/* + * Guest memory regions (GMRs): + * + * This is a new memory mapping feature available in SVGA devices + * which have the SVGA_CAP_GMR bit set. Previously, there were two + * fixed memory regions available with which to share data between the + * device and the driver: the FIFO ('MEM') and the framebuffer. GMRs + * are our name for an extensible way of providing arbitrary DMA + * buffers for use between the driver and the SVGA device. They are a + * new alternative to framebuffer memory, usable for both 2D and 3D + * graphics operations. + * + * Since GMR mapping must be done synchronously with guest CPU + * execution, we use a new pair of SVGA registers: + * + * SVGA_REG_GMR_ID -- + * + * Read/write. + * This register holds the 32-bit ID (a small positive integer) + * of a GMR to create, delete, or redefine. Writing this register + * has no side-effects. + * + * SVGA_REG_GMR_DESCRIPTOR -- + * + * Write-only. + * Writing this register will create, delete, or redefine the GMR + * specified by the above ID register. If this register is zero, + * the GMR is deleted. Any pointers into this GMR (including those + * currently being processed by FIFO commands) will be + * synchronously invalidated. + * + * If this register is nonzero, it must be the physical page + * number (PPN) of a data structure which describes the physical + * layout of the memory region this GMR should describe. The + * descriptor structure will be read synchronously by the SVGA + * device when this register is written. The descriptor need not + * remain allocated for the lifetime of the GMR. + * + * The guest driver should write SVGA_REG_GMR_ID first, then + * SVGA_REG_GMR_DESCRIPTOR. + * + * SVGA_REG_GMR_MAX_IDS -- + * + * Read-only. + * The SVGA device may choose to support a maximum number of + * user-defined GMR IDs. This register holds the number of supported + * IDs. (The maximum supported ID plus 1) + * + * SVGA_REG_GMR_MAX_DESCRIPTOR_LENGTH -- + * + * Read-only. + * The SVGA device may choose to put a limit on the total number + * of SVGAGuestMemDescriptor structures it will read when defining + * a single GMR. + * + * The descriptor structure is an array of SVGAGuestMemDescriptor + * structures. Each structure may do one of three things: + * + * - Terminate the GMR descriptor list. + * (ppn==0, numPages==0) + * + * - Add a PPN or range of PPNs to the GMR's virtual address space. + * (ppn != 0, numPages != 0) + * + * - Provide the PPN of the next SVGAGuestMemDescriptor, in order to + * support multi-page GMR descriptor tables without forcing the + * driver to allocate physically contiguous memory. + * (ppn != 0, numPages == 0) + * + * Note that each physical page of SVGAGuestMemDescriptor structures + * can describe at least 2MB of guest memory. If the driver needs to + * use more than one page of descriptor structures, it must use one of + * its SVGAGuestMemDescriptors to point to an additional page. The + * device will never automatically cross a page boundary. + * + * Once the driver has described a GMR, it is immediately available + * for use via any FIFO command that uses an SVGAGuestPtr structure. + * These pointers include a GMR identifier plus an offset into that + * GMR. + * + * The driver must check the SVGA_CAP_GMR bit before using the GMR + * registers. + */ + +/* + * Special GMR IDs, allowing SVGAGuestPtrs to point to framebuffer + * memory as well. In the future, these IDs could even be used to + * allow legacy memory regions to be redefined by the guest as GMRs. + * + * Using the guest framebuffer (GFB) at BAR1 for general purpose DMA + * is being phased out. Please try to use user-defined GMRs whenever + * possible. + */ +#define SVGA_GMR_NULL ((uint32) -1) +#define SVGA_GMR_FRAMEBUFFER ((uint32) -2) // Guest Framebuffer (GFB) + +typedef +struct SVGAGuestMemDescriptor { + uint32 ppn; + uint32 numPages; +} SVGAGuestMemDescriptor; + +typedef +struct SVGAGuestPtr { + uint32 gmrId; + uint32 offset; +} SVGAGuestPtr; + + +/* + * SVGAGMRImageFormat -- + * + * This is a packed representation of the source 2D image format + * for a GMR-to-screen blit. Currently it is defined as an encoding + * of the screen's color depth and bits-per-pixel, however, 16 bits + * are reserved for future use to identify other encodings (such as + * RGBA or higher-precision images). + * + * Currently supported formats: + * + * bpp depth Format Name + * --- ----- ----------- + * 32 24 32-bit BGRX + * 24 24 24-bit BGR + * 16 16 RGB 5-6-5 + * 16 15 RGB 5-5-5 + * + */ + +typedef +struct SVGAGMRImageFormat { + union { + struct { + uint32 bitsPerPixel : 8; + uint32 colorDepth : 8; + uint32 reserved : 16; // Must be zero + }; + + uint32 value; + }; +} SVGAGMRImageFormat; + +/* + * SVGAColorBGRX -- + * + * A 24-bit color format (BGRX), which does not depend on the + * format of the legacy guest framebuffer (GFB) or the current + * GMRFB state. + */ + +typedef +struct SVGAColorBGRX { + union { + struct { + uint32 b : 8; + uint32 g : 8; + uint32 r : 8; + uint32 x : 8; // Unused + }; + + uint32 value; + }; +} SVGAColorBGRX; + + +/* + * SVGASignedRect -- + * SVGASignedPoint -- + * + * Signed rectangle and point primitives. These are used by the new + * 2D primitives for drawing to Screen Objects, which can occupy a + * signed virtual coordinate space. + * + * SVGASignedRect specifies a half-open interval: the (left, top) + * pixel is part of the rectangle, but the (right, bottom) pixel is + * not. + */ + +typedef +struct SVGASignedRect { + int32 left; + int32 top; + int32 right; + int32 bottom; +} SVGASignedRect; + +typedef +struct SVGASignedPoint { + int32 x; + int32 y; +} SVGASignedPoint; + + +/* + * Capabilities + * + * Note the holes in the bitfield. Missing bits have been deprecated, + * and must not be reused. Those capabilities will never be reported + * by new versions of the SVGA device. + */ + +#define SVGA_CAP_NONE 0x00000000 +#define SVGA_CAP_RECT_COPY 0x00000002 +#define SVGA_CAP_CURSOR 0x00000020 +#define SVGA_CAP_CURSOR_BYPASS 0x00000040 // Legacy (Use Cursor Bypass 3 instead) +#define SVGA_CAP_CURSOR_BYPASS_2 0x00000080 // Legacy (Use Cursor Bypass 3 instead) +#define SVGA_CAP_8BIT_EMULATION 0x00000100 +#define SVGA_CAP_ALPHA_CURSOR 0x00000200 +#define SVGA_CAP_3D 0x00004000 +#define SVGA_CAP_EXTENDED_FIFO 0x00008000 +#define SVGA_CAP_MULTIMON 0x00010000 // Legacy multi-monitor support +#define SVGA_CAP_PITCHLOCK 0x00020000 +#define SVGA_CAP_IRQMASK 0x00040000 +#define SVGA_CAP_DISPLAY_TOPOLOGY 0x00080000 // Legacy multi-monitor support +#define SVGA_CAP_GMR 0x00100000 +#define SVGA_CAP_TRACES 0x00200000 + + +/* + * FIFO register indices. + * + * The FIFO is a chunk of device memory mapped into guest physmem. It + * is always treated as 32-bit words. + * + * The guest driver gets to decide how to partition it between + * - FIFO registers (there are always at least 4, specifying where the + * following data area is and how much data it contains; there may be + * more registers following these, depending on the FIFO protocol + * version in use) + * - FIFO data, written by the guest and slurped out by the VMX. + * These indices are 32-bit word offsets into the FIFO. + */ + +enum { + /* + * Block 1 (basic registers): The originally defined FIFO registers. + * These exist and are valid for all versions of the FIFO protocol. + */ + + SVGA_FIFO_MIN = 0, + SVGA_FIFO_MAX, /* The distance from MIN to MAX must be at least 10K */ + SVGA_FIFO_NEXT_CMD, + SVGA_FIFO_STOP, + + /* + * Block 2 (extended registers): Mandatory registers for the extended + * FIFO. These exist if the SVGA caps register includes + * SVGA_CAP_EXTENDED_FIFO; some of them are valid only if their + * associated capability bit is enabled. + * + * Note that when originally defined, SVGA_CAP_EXTENDED_FIFO implied + * support only for (FIFO registers) CAPABILITIES, FLAGS, and FENCE. + * This means that the guest has to test individually (in most cases + * using FIFO caps) for the presence of registers after this; the VMX + * can define "extended FIFO" to mean whatever it wants, and currently + * won't enable it unless there's room for that set and much more. + */ + + SVGA_FIFO_CAPABILITIES = 4, + SVGA_FIFO_FLAGS, + // Valid with SVGA_FIFO_CAP_FENCE: + SVGA_FIFO_FENCE, + + /* + * Block 3a (optional extended registers): Additional registers for the + * extended FIFO, whose presence isn't actually implied by + * SVGA_CAP_EXTENDED_FIFO; these exist if SVGA_FIFO_MIN is high enough to + * leave room for them. + * + * These in block 3a, the VMX currently considers mandatory for the + * extended FIFO. + */ + + // Valid if exists (i.e. if extended FIFO enabled): + SVGA_FIFO_3D_HWVERSION, /* See SVGA3dHardwareVersion in svga3d_reg.h */ + // Valid with SVGA_FIFO_CAP_PITCHLOCK: + SVGA_FIFO_PITCHLOCK, + + // Valid with SVGA_FIFO_CAP_CURSOR_BYPASS_3: + SVGA_FIFO_CURSOR_ON, /* Cursor bypass 3 show/hide register */ + SVGA_FIFO_CURSOR_X, /* Cursor bypass 3 x register */ + SVGA_FIFO_CURSOR_Y, /* Cursor bypass 3 y register */ + SVGA_FIFO_CURSOR_COUNT, /* Incremented when any of the other 3 change */ + SVGA_FIFO_CURSOR_LAST_UPDATED,/* Last time the host updated the cursor */ + + // Valid with SVGA_FIFO_CAP_RESERVE: + SVGA_FIFO_RESERVED, /* Bytes past NEXT_CMD with real contents */ + + /* + * Valid with SVGA_FIFO_CAP_SCREEN_OBJECT: + * + * By default this is SVGA_ID_INVALID, to indicate that the cursor + * coordinates are specified relative to the virtual root. If this + * is set to a specific screen ID, cursor position is reinterpreted + * as a signed offset relative to that screen's origin. This is the + * only way to place the cursor on a non-rooted screen. + */ + SVGA_FIFO_CURSOR_SCREEN_ID, + + /* + * XXX: The gap here, up until SVGA_FIFO_3D_CAPS, can be used for new + * registers, but this must be done carefully and with judicious use of + * capability bits, since comparisons based on SVGA_FIFO_MIN aren't + * enough to tell you whether the register exists: we've shipped drivers + * and products that used SVGA_FIFO_3D_CAPS but didn't know about some of + * the earlier ones. The actual order of introduction was: + * - PITCHLOCK + * - 3D_CAPS + * - CURSOR_* (cursor bypass 3) + * - RESERVED + * So, code that wants to know whether it can use any of the + * aforementioned registers, or anything else added after PITCHLOCK and + * before 3D_CAPS, needs to reason about something other than + * SVGA_FIFO_MIN. + */ + + /* + * 3D caps block space; valid with 3D hardware version >= + * SVGA3D_HWVERSION_WS6_B1. + */ + SVGA_FIFO_3D_CAPS = 32, + SVGA_FIFO_3D_CAPS_LAST = 32 + 255, + + /* + * End of VMX's current definition of "extended-FIFO registers". + * Registers before here are always enabled/disabled as a block; either + * the extended FIFO is enabled and includes all preceding registers, or + * it's disabled entirely. + * + * Block 3b (truly optional extended registers): Additional registers for + * the extended FIFO, which the VMX already knows how to enable and + * disable with correct granularity. + * + * Registers after here exist if and only if the guest SVGA driver + * sets SVGA_FIFO_MIN high enough to leave room for them. + */ + + // Valid if register exists: + SVGA_FIFO_GUEST_3D_HWVERSION, /* Guest driver's 3D version */ + SVGA_FIFO_FENCE_GOAL, /* Matching target for SVGA_IRQFLAG_FENCE_GOAL */ + SVGA_FIFO_BUSY, /* See "FIFO Synchronization Registers" */ + + /* + * Always keep this last. This defines the maximum number of + * registers we know about. At power-on, this value is placed in + * the SVGA_REG_MEM_REGS register, and we expect the guest driver + * to allocate this much space in FIFO memory for registers. + */ + SVGA_FIFO_NUM_REGS +}; + + +/* + * Definition of registers included in extended FIFO support. + * + * The guest SVGA driver gets to allocate the FIFO between registers + * and data. It must always allocate at least 4 registers, but old + * drivers stopped there. + * + * The VMX will enable extended FIFO support if and only if the guest + * left enough room for all registers defined as part of the mandatory + * set for the extended FIFO. + * + * Note that the guest drivers typically allocate the FIFO only at + * initialization time, not at mode switches, so it's likely that the + * number of FIFO registers won't change without a reboot. + * + * All registers less than this value are guaranteed to be present if + * svgaUser->fifo.extended is set. Any later registers must be tested + * individually for compatibility at each use (in the VMX). + * + * This value is used only by the VMX, so it can change without + * affecting driver compatibility; keep it that way? + */ +#define SVGA_FIFO_EXTENDED_MANDATORY_REGS (SVGA_FIFO_3D_CAPS_LAST + 1) + + +/* + * FIFO Synchronization Registers + * + * This explains the relationship between the various FIFO + * sync-related registers in IOSpace and in FIFO space. + * + * SVGA_REG_SYNC -- + * + * The SYNC register can be used in two different ways by the guest: + * + * 1. If the guest wishes to fully sync (drain) the FIFO, + * it will write once to SYNC then poll on the BUSY + * register. The FIFO is sync'ed once BUSY is zero. + * + * 2. If the guest wants to asynchronously wake up the host, + * it will write once to SYNC without polling on BUSY. + * Ideally it will do this after some new commands have + * been placed in the FIFO, and after reading a zero + * from SVGA_FIFO_BUSY. + * + * (1) is the original behaviour that SYNC was designed to + * support. Originally, a write to SYNC would implicitly + * trigger a read from BUSY. This causes us to synchronously + * process the FIFO. + * + * This behaviour has since been changed so that writing SYNC + * will *not* implicitly cause a read from BUSY. Instead, it + * makes a channel call which asynchronously wakes up the MKS + * thread. + * + * New guests can use this new behaviour to implement (2) + * efficiently. This lets guests get the host's attention + * without waiting for the MKS to poll, which gives us much + * better CPU utilization on SMP hosts and on UP hosts while + * we're blocked on the host GPU. + * + * Old guests shouldn't notice the behaviour change. SYNC was + * never guaranteed to process the entire FIFO, since it was + * bounded to a particular number of CPU cycles. Old guests will + * still loop on the BUSY register until the FIFO is empty. + * + * Writing to SYNC currently has the following side-effects: + * + * - Sets SVGA_REG_BUSY to TRUE (in the monitor) + * - Asynchronously wakes up the MKS thread for FIFO processing + * - The value written to SYNC is recorded as a "reason", for + * stats purposes. + * + * If SVGA_FIFO_BUSY is available, drivers are advised to only + * write to SYNC if SVGA_FIFO_BUSY is FALSE. Drivers should set + * SVGA_FIFO_BUSY to TRUE after writing to SYNC. The MKS will + * eventually set SVGA_FIFO_BUSY on its own, but this approach + * lets the driver avoid sending multiple asynchronous wakeup + * messages to the MKS thread. + * + * SVGA_REG_BUSY -- + * + * This register is set to TRUE when SVGA_REG_SYNC is written, + * and it reads as FALSE when the FIFO has been completely + * drained. + * + * Every read from this register causes us to synchronously + * process FIFO commands. There is no guarantee as to how many + * commands each read will process. + * + * CPU time spent processing FIFO commands will be billed to + * the guest. + * + * New drivers should avoid using this register unless they + * need to guarantee that the FIFO is completely drained. It + * is overkill for performing a sync-to-fence. Older drivers + * will use this register for any type of synchronization. + * + * SVGA_FIFO_BUSY -- + * + * This register is a fast way for the guest driver to check + * whether the FIFO is already being processed. It reads and + * writes at normal RAM speeds, with no monitor intervention. + * + * If this register reads as TRUE, the host is guaranteeing that + * any new commands written into the FIFO will be noticed before + * the MKS goes back to sleep. + * + * If this register reads as FALSE, no such guarantee can be + * made. + * + * The guest should use this register to quickly determine + * whether or not it needs to wake up the host. If the guest + * just wrote a command or group of commands that it would like + * the host to begin processing, it should: + * + * 1. Read SVGA_FIFO_BUSY. If it reads as TRUE, no further + * action is necessary. + * + * 2. Write TRUE to SVGA_FIFO_BUSY. This informs future guest + * code that we've already sent a SYNC to the host and we + * don't need to send a duplicate. + * + * 3. Write a reason to SVGA_REG_SYNC. This will send an + * asynchronous wakeup to the MKS thread. + */ + + +/* + * FIFO Capabilities + * + * Fence -- Fence register and command are supported + * Accel Front -- Front buffer only commands are supported + * Pitch Lock -- Pitch lock register is supported + * Video -- SVGA Video overlay units are supported + * Escape -- Escape command is supported + * + * XXX: Add longer descriptions for each capability, including a list + * of the new features that each capability provides. + * + * SVGA_FIFO_CAP_SCREEN_OBJECT -- + * + * Provides dynamic multi-screen rendering, for improved Unity and + * multi-monitor modes. With Screen Object, the guest can + * dynamically create and destroy 'screens', which can represent + * Unity windows or virtual monitors. Screen Object also provides + * strong guarantees that DMA operations happen only when + * guest-initiated. Screen Object deprecates the BAR1 guest + * framebuffer (GFB) and all commands that work only with the GFB. + * + * New registers: + * FIFO_CURSOR_SCREEN_ID, VIDEO_DATA_GMRID, VIDEO_DST_SCREEN_ID + * + * New 2D commands: + * DEFINE_SCREEN, DESTROY_SCREEN, DEFINE_GMRFB, BLIT_GMRFB_TO_SCREEN, + * BLIT_SCREEN_TO_GMRFB, ANNOTATION_FILL, ANNOTATION_COPY + * + * New 3D commands: + * BLIT_SURFACE_TO_SCREEN + * + * New guarantees: + * + * - The host will not read or write guest memory, including the GFB, + * except when explicitly initiated by a DMA command. + * + * - All DMA, including legacy DMA like UPDATE and PRESENT_READBACK, + * is guaranteed to complete before any subsequent FENCEs. + * + * - All legacy commands which affect a Screen (UPDATE, PRESENT, + * PRESENT_READBACK) as well as new Screen blit commands will + * all behave consistently as blits, and memory will be read + * or written in FIFO order. + * + * For example, if you PRESENT from one SVGA3D surface to multiple + * places on the screen, the data copied will always be from the + * SVGA3D surface at the time the PRESENT was issued in the FIFO. + * This was not necessarily true on devices without Screen Object. + * + * This means that on devices that support Screen Object, the + * PRESENT_READBACK command should not be necessary unless you + * actually want to read back the results of 3D rendering into + * system memory. (And for that, the BLIT_SCREEN_TO_GMRFB + * command provides a strict superset of functionality.) + * + * - When a screen is resized, either using Screen Object commands or + * legacy multimon registers, its contents are preserved. + */ + +#define SVGA_FIFO_CAP_NONE 0 +#define SVGA_FIFO_CAP_FENCE (1<<0) +#define SVGA_FIFO_CAP_ACCELFRONT (1<<1) +#define SVGA_FIFO_CAP_PITCHLOCK (1<<2) +#define SVGA_FIFO_CAP_VIDEO (1<<3) +#define SVGA_FIFO_CAP_CURSOR_BYPASS_3 (1<<4) +#define SVGA_FIFO_CAP_ESCAPE (1<<5) +#define SVGA_FIFO_CAP_RESERVE (1<<6) +#define SVGA_FIFO_CAP_SCREEN_OBJECT (1<<7) + + +/* + * FIFO Flags + * + * Accel Front -- Driver should use front buffer only commands + */ + +#define SVGA_FIFO_FLAG_NONE 0 +#define SVGA_FIFO_FLAG_ACCELFRONT (1<<0) +#define SVGA_FIFO_FLAG_RESERVED (1<<31) // Internal use only + +/* + * FIFO reservation sentinel value + */ + +#define SVGA_FIFO_RESERVED_UNKNOWN 0xffffffff + + +/* + * Video overlay support + */ + +#define SVGA_NUM_OVERLAY_UNITS 32 + + +/* + * Video capabilities that the guest is currently using + */ + +#define SVGA_VIDEO_FLAG_COLORKEY 0x0001 + + +/* + * Offsets for the video overlay registers + */ + +enum { + SVGA_VIDEO_ENABLED = 0, + SVGA_VIDEO_FLAGS, + SVGA_VIDEO_DATA_OFFSET, + SVGA_VIDEO_FORMAT, + SVGA_VIDEO_COLORKEY, + SVGA_VIDEO_SIZE, // Deprecated + SVGA_VIDEO_WIDTH, + SVGA_VIDEO_HEIGHT, + SVGA_VIDEO_SRC_X, + SVGA_VIDEO_SRC_Y, + SVGA_VIDEO_SRC_WIDTH, + SVGA_VIDEO_SRC_HEIGHT, + SVGA_VIDEO_DST_X, // Signed int32 + SVGA_VIDEO_DST_Y, // Signed int32 + SVGA_VIDEO_DST_WIDTH, + SVGA_VIDEO_DST_HEIGHT, + SVGA_VIDEO_PITCH_1, + SVGA_VIDEO_PITCH_2, + SVGA_VIDEO_PITCH_3, + SVGA_VIDEO_DATA_GMRID, // Optional, defaults to SVGA_GMR_FRAMEBUFFER + SVGA_VIDEO_DST_SCREEN_ID, // Optional, defaults to virtual coords (SVGA_ID_INVALID) + SVGA_VIDEO_NUM_REGS +}; + + +/* + * SVGA Overlay Units + * + * width and height relate to the entire source video frame. + * srcX, srcY, srcWidth and srcHeight represent subset of the source + * video frame to be displayed. + */ + +typedef struct SVGAOverlayUnit { + uint32 enabled; + uint32 flags; + uint32 dataOffset; + uint32 format; + uint32 colorKey; + uint32 size; + uint32 width; + uint32 height; + uint32 srcX; + uint32 srcY; + uint32 srcWidth; + uint32 srcHeight; + int32 dstX; + int32 dstY; + uint32 dstWidth; + uint32 dstHeight; + uint32 pitches[3]; + uint32 dataGMRId; + uint32 dstScreenId; +} SVGAOverlayUnit; + + +/* + * SVGAScreenObject -- + * + * This is a new way to represent a guest's multi-monitor screen or + * Unity window. Screen objects are only supported if the + * SVGA_FIFO_CAP_SCREEN_OBJECT capability bit is set. + * + * If Screen Objects are supported, they can be used to fully + * replace the functionality provided by the framebuffer registers + * (SVGA_REG_WIDTH, HEIGHT, etc.) and by SVGA_CAP_DISPLAY_TOPOLOGY. + * + * The screen object is a struct with guaranteed binary + * compatibility. New flags can be added, and the struct may grow, + * but existing fields must retain their meaning. + * + */ + +#define SVGA_SCREEN_HAS_ROOT (1 << 0) // Screen is present in the virtual coord space +#define SVGA_SCREEN_IS_PRIMARY (1 << 1) // Guest considers this screen to be 'primary' +#define SVGA_SCREEN_FULLSCREEN_HINT (1 << 2) // Guest is running a fullscreen app here + +typedef +struct SVGAScreenObject { + uint32 structSize; // sizeof(SVGAScreenObject) + uint32 id; + uint32 flags; + struct { + uint32 width; + uint32 height; + } size; + struct { + int32 x; + int32 y; + } root; // Only used if SVGA_SCREEN_HAS_ROOT is set. +} SVGAScreenObject; + + +/* + * Commands in the command FIFO: + * + * Command IDs defined below are used for the traditional 2D FIFO + * communication (not all commands are available for all versions of the + * SVGA FIFO protocol). + * + * Note the holes in the command ID numbers: These commands have been + * deprecated, and the old IDs must not be reused. + * + * Command IDs from 1000 to 1999 are reserved for use by the SVGA3D + * protocol. + * + * Each command's parameters are described by the comments and + * structs below. + */ + +typedef enum { + SVGA_CMD_INVALID_CMD = 0, + SVGA_CMD_UPDATE = 1, + SVGA_CMD_RECT_COPY = 3, + SVGA_CMD_DEFINE_CURSOR = 19, + SVGA_CMD_DEFINE_ALPHA_CURSOR = 22, + SVGA_CMD_UPDATE_VERBOSE = 25, + SVGA_CMD_FRONT_ROP_FILL = 29, + SVGA_CMD_FENCE = 30, + SVGA_CMD_ESCAPE = 33, + SVGA_CMD_DEFINE_SCREEN = 34, + SVGA_CMD_DESTROY_SCREEN = 35, + SVGA_CMD_DEFINE_GMRFB = 36, + SVGA_CMD_BLIT_GMRFB_TO_SCREEN = 37, + SVGA_CMD_BLIT_SCREEN_TO_GMRFB = 38, + SVGA_CMD_ANNOTATION_FILL = 39, + SVGA_CMD_ANNOTATION_COPY = 40, + SVGA_CMD_MAX +} SVGAFifoCmdId; + +#define SVGA_CMD_MAX_ARGS 64 + + +/* + * SVGA_CMD_UPDATE -- + * + * This is a DMA transfer which copies from the Guest Framebuffer + * (GFB) at BAR1 + SVGA_REG_FB_OFFSET to any screens which + * intersect with the provided virtual rectangle. + * + * This command does not support using arbitrary guest memory as a + * data source- it only works with the pre-defined GFB memory. + * This command also does not support signed virtual coordinates. + * If you have defined screens (using SVGA_CMD_DEFINE_SCREEN) with + * negative root x/y coordinates, the negative portion of those + * screens will not be reachable by this command. + * + * This command is not necessary when using framebuffer + * traces. Traces are automatically enabled if the SVGA FIFO is + * disabled, and you may explicitly enable/disable traces using + * SVGA_REG_TRACES. With traces enabled, any write to the GFB will + * automatically act as if a subsequent SVGA_CMD_UPDATE was issued. + * + * Traces and SVGA_CMD_UPDATE are the only supported ways to render + * pseudocolor screen updates. The newer Screen Object commands + * only support true color formats. + * + * Availability: + * Always available. + */ + +typedef +struct { + uint32 x; + uint32 y; + uint32 width; + uint32 height; +} SVGAFifoCmdUpdate; + + +/* + * SVGA_CMD_RECT_COPY -- + * + * Perform a rectangular DMA transfer from one area of the GFB to + * another, and copy the result to any screens which intersect it. + * + * Availability: + * SVGA_CAP_RECT_COPY + */ + +typedef +struct { + uint32 srcX; + uint32 srcY; + uint32 destX; + uint32 destY; + uint32 width; + uint32 height; +} SVGAFifoCmdRectCopy; + + +/* + * SVGA_CMD_DEFINE_CURSOR -- + * + * Provide a new cursor image, as an AND/XOR mask. + * + * The recommended way to position the cursor overlay is by using + * the SVGA_FIFO_CURSOR_* registers, supported by the + * SVGA_FIFO_CAP_CURSOR_BYPASS_3 capability. + * + * Availability: + * SVGA_CAP_CURSOR + */ + +typedef +struct { + uint32 id; // Reserved, must be zero. + uint32 hotspotX; + uint32 hotspotY; + uint32 width; + uint32 height; + uint32 andMaskDepth; // Value must be 1 or equal to BITS_PER_PIXEL + uint32 xorMaskDepth; // Value must be 1 or equal to BITS_PER_PIXEL + /* + * Followed by scanline data for AND mask, then XOR mask. + * Each scanline is padded to a 32-bit boundary. + */ +} SVGAFifoCmdDefineCursor; + + +/* + * SVGA_CMD_DEFINE_ALPHA_CURSOR -- + * + * Provide a new cursor image, in 32-bit BGRA format. + * + * The recommended way to position the cursor overlay is by using + * the SVGA_FIFO_CURSOR_* registers, supported by the + * SVGA_FIFO_CAP_CURSOR_BYPASS_3 capability. + * + * Availability: + * SVGA_CAP_ALPHA_CURSOR + */ + +typedef +struct { + uint32 id; // Reserved, must be zero. + uint32 hotspotX; + uint32 hotspotY; + uint32 width; + uint32 height; + /* Followed by scanline data */ +} SVGAFifoCmdDefineAlphaCursor; + + +/* + * SVGA_CMD_UPDATE_VERBOSE -- + * + * Just like SVGA_CMD_UPDATE, but also provide a per-rectangle + * 'reason' value, an opaque cookie which is used by internal + * debugging tools. Third party drivers should not use this + * command. + * + * Availability: + * SVGA_CAP_EXTENDED_FIFO + */ + +typedef +struct { + uint32 x; + uint32 y; + uint32 width; + uint32 height; + uint32 reason; +} SVGAFifoCmdUpdateVerbose; + + +/* + * SVGA_CMD_FRONT_ROP_FILL -- + * + * This is a hint which tells the SVGA device that the driver has + * just filled a rectangular region of the GFB with a solid + * color. Instead of reading these pixels from the GFB, the device + * can assume that they all equal 'color'. This is primarily used + * for remote desktop protocols. + * + * Availability: + * SVGA_FIFO_CAP_ACCELFRONT + */ + +#define SVGA_ROP_COPY 0x03 + +typedef +struct { + uint32 color; // In the same format as the GFB + uint32 x; + uint32 y; + uint32 width; + uint32 height; + uint32 rop; // Must be SVGA_ROP_COPY +} SVGAFifoCmdFrontRopFill; + + +/* + * SVGA_CMD_FENCE -- + * + * Insert a synchronization fence. When the SVGA device reaches + * this command, it will copy the 'fence' value into the + * SVGA_FIFO_FENCE register. It will also compare the fence against + * SVGA_FIFO_FENCE_GOAL. If the fence matches the goal and the + * SVGA_IRQFLAG_FENCE_GOAL interrupt is enabled, the device will + * raise this interrupt. + * + * Availability: + * SVGA_FIFO_FENCE for this command, + * SVGA_CAP_IRQMASK for SVGA_FIFO_FENCE_GOAL. + */ + +typedef +struct { + uint32 fence; +} SVGAFifoCmdFence; + + +/* + * SVGA_CMD_ESCAPE -- + * + * Send an extended or vendor-specific variable length command. + * This is used for video overlay, third party plugins, and + * internal debugging tools. See svga_escape.h + * + * Availability: + * SVGA_FIFO_CAP_ESCAPE + */ + +typedef +struct { + uint32 nsid; + uint32 size; + /* followed by 'size' bytes of data */ +} SVGAFifoCmdEscape; + + +/* + * SVGA_CMD_DEFINE_SCREEN -- + * + * Define or redefine an SVGAScreenObject. See the description of + * SVGAScreenObject above. The video driver is responsible for + * generating new screen IDs. They should be small positive + * integers. The virtual device will have an implementation + * specific upper limit on the number of screen IDs + * supported. Drivers are responsible for recycling IDs. The first + * valid ID is zero. + * + * - Interaction with other registers: + * + * For backwards compatibility, when the GFB mode registers (WIDTH, + * HEIGHT, PITCHLOCK, BITS_PER_PIXEL) are modified, the SVGA device + * deletes all screens other than screen #0, and redefines screen + * #0 according to the specified mode. Drivers that use + * SVGA_CMD_DEFINE_SCREEN should destroy or redefine screen #0. + * + * If you use screen objects, do not use the legacy multi-mon + * registers (SVGA_REG_NUM_GUEST_DISPLAYS, SVGA_REG_DISPLAY_*). + * + * Availability: + * SVGA_FIFO_CAP_SCREEN_OBJECT + */ + +typedef +struct { + SVGAScreenObject screen; // Variable-length according to version +} SVGAFifoCmdDefineScreen; + + +/* + * SVGA_CMD_DESTROY_SCREEN -- + * + * Destroy an SVGAScreenObject. Its ID is immediately available for + * re-use. + * + * Availability: + * SVGA_FIFO_CAP_SCREEN_OBJECT + */ + +typedef +struct { + uint32 screenId; +} SVGAFifoCmdDestroyScreen; + + +/* + * SVGA_CMD_DEFINE_GMRFB -- + * + * This command sets a piece of SVGA device state called the + * Guest Memory Region Framebuffer, or GMRFB. The GMRFB is a + * piece of light-weight state which identifies the location and + * format of an image in guest memory or in BAR1. The GMRFB has + * an arbitrary size, and it doesn't need to match the geometry + * of the GFB or any screen object. + * + * The GMRFB can be redefined as often as you like. You could + * always use the same GMRFB, you could redefine it before + * rendering from a different guest screen, or you could even + * redefine it before every blit. + * + * There are multiple ways to use this command. The simplest way is + * to use it to move the framebuffer either to elsewhere in the GFB + * (BAR1) memory region, or to a user-defined GMR. This lets a + * driver use a framebuffer allocated entirely out of normal system + * memory, which we encourage. + * + * Another way to use this command is to set up a ring buffer of + * updates in GFB memory. If a driver wants to ensure that no + * frames are skipped by the SVGA device, it is important that the + * driver not modify the source data for a blit until the device is + * done processing the command. One efficient way to accomplish + * this is to use a ring of small DMA buffers. Each buffer is used + * for one blit, then we move on to the next buffer in the + * ring. The FENCE mechanism is used to protect each buffer from + * re-use until the device is finished with that buffer's + * corresponding blit. + * + * This command does not affect the meaning of SVGA_CMD_UPDATE. + * UPDATEs always occur from the legacy GFB memory area. This + * command has no support for pseudocolor GMRFBs. Currently only + * true-color 15, 16, and 24-bit depths are supported. Future + * devices may expose capabilities for additional framebuffer + * formats. + * + * The default GMRFB value is undefined. Drivers must always send + * this command at least once before performing any blit from the + * GMRFB. + * + * Availability: + * SVGA_FIFO_CAP_SCREEN_OBJECT + */ + +typedef +struct { + SVGAGuestPtr ptr; + uint32 bytesPerLine; + SVGAGMRImageFormat format; +} SVGAFifoCmdDefineGMRFB; + + +/* + * SVGA_CMD_BLIT_GMRFB_TO_SCREEN -- + * + * This is a guest-to-host blit. It performs a DMA operation to + * copy a rectangular region of pixels from the current GMRFB to + * one or more Screen Objects. + * + * The destination coordinate may be specified relative to a + * screen's origin (if a screen ID is specified) or relative to the + * virtual coordinate system's origin (if the screen ID is + * SVGA_ID_INVALID). The actual destination may span zero or more + * screens, in the case of a virtual destination rect or a rect + * which extends off the edge of the specified screen. + * + * This command writes to the screen's "base layer": the underlying + * framebuffer which exists below any cursor or video overlays. No + * action is necessary to explicitly hide or update any overlays + * which exist on top of the updated region. + * + * The SVGA device is guaranteed to finish reading from the GMRFB + * by the time any subsequent FENCE commands are reached. + * + * This command consumes an annotation. See the + * SVGA_CMD_ANNOTATION_* commands for details. + * + * Availability: + * SVGA_FIFO_CAP_SCREEN_OBJECT + */ + +typedef +struct { + SVGASignedPoint srcOrigin; + SVGASignedRect destRect; + uint32 destScreenId; +} SVGAFifoCmdBlitGMRFBToScreen; + + +/* + * SVGA_CMD_BLIT_SCREEN_TO_GMRFB -- + * + * This is a host-to-guest blit. It performs a DMA operation to + * copy a rectangular region of pixels from a single Screen Object + * back to the current GMRFB. + * + * Usage note: This command should be used rarely. It will + * typically be inefficient, but it is necessary for some types of + * synchronization between 3D (GPU) and 2D (CPU) rendering into + * overlapping areas of a screen. + * + * The source coordinate is specified relative to a screen's + * origin. The provided screen ID must be valid. If any parameters + * are invalid, the resulting pixel values are undefined. + * + * This command reads the screen's "base layer". Overlays like + * video and cursor are not included, but any data which was sent + * using a blit-to-screen primitive will be available, no matter + * whether the data's original source was the GMRFB or the 3D + * acceleration hardware. + * + * Note that our guest-to-host blits and host-to-guest blits aren't + * symmetric in their current implementation. While the parameters + * are identical, host-to-guest blits are a lot less featureful. + * They do not support clipping: If the source parameters don't + * fully fit within a screen, the blit fails. They must originate + * from exactly one screen. Virtual coordinates are not directly + * supported. + * + * Host-to-guest blits do support the same set of GMRFB formats + * offered by guest-to-host blits. + * + * The SVGA device is guaranteed to finish writing to the GMRFB by + * the time any subsequent FENCE commands are reached. + * + * Availability: + * SVGA_FIFO_CAP_SCREEN_OBJECT + */ + +typedef +struct { + SVGASignedPoint destOrigin; + SVGASignedRect srcRect; + uint32 srcScreenId; +} SVGAFifoCmdBlitScreenToGMRFB; + + +/* + * SVGA_CMD_ANNOTATION_FILL -- + * + * This is a blit annotation. This command stores a small piece of + * device state which is consumed by the next blit-to-screen + * command. The state is only cleared by commands which are + * specifically documented as consuming an annotation. Other + * commands (such as ESCAPEs for debugging) may intervene between + * the annotation and its associated blit. + * + * This annotation is a promise about the contents of the next + * blit: The video driver is guaranteeing that all pixels in that + * blit will have the same value, specified here as a color in + * SVGAColorBGRX format. + * + * The SVGA device can still render the blit correctly even if it + * ignores this annotation, but the annotation may allow it to + * perform the blit more efficiently, for example by ignoring the + * source data and performing a fill in hardware. + * + * This annotation is most important for performance when the + * user's display is being remoted over a network connection. + * + * Availability: + * SVGA_FIFO_CAP_SCREEN_OBJECT + */ + +typedef +struct { + SVGAColorBGRX color; +} SVGAFifoCmdAnnotationFill; + + +/* + * SVGA_CMD_ANNOTATION_COPY -- + * + * This is a blit annotation. See SVGA_CMD_ANNOTATION_FILL for more + * information about annotations. + * + * This annotation is a promise about the contents of the next + * blit: The video driver is guaranteeing that all pixels in that + * blit will have the same value as those which already exist at an + * identically-sized region on the same or a different screen. + * + * Note that the source pixels for the COPY in this annotation are + * sampled before applying the anqnotation's associated blit. They + * are allowed to overlap with the blit's destination pixels. + * + * The copy source rectangle is specified the same way as the blit + * destination: it can be a rectangle which spans zero or more + * screens, specified relative to either a screen or to the virtual + * coordinate system's origin. If the source rectangle includes + * pixels which are not from exactly one screen, the results are + * undefined. + * + * Availability: + * SVGA_FIFO_CAP_SCREEN_OBJECT + */ + +typedef +struct { + SVGASignedPoint srcOrigin; + uint32 srcScreenId; +} SVGAFifoCmdAnnotationCopy; + +#endif diff --git a/src/gallium/drivers/svga/include/svga_types.h b/src/gallium/drivers/svga/include/svga_types.h new file mode 100644 index 0000000000..7fd9bab03a --- /dev/null +++ b/src/gallium/drivers/svga/include/svga_types.h @@ -0,0 +1,46 @@ +/********************************************************** + * Copyright 1998-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, 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. + * + **********************************************************/ + +#ifndef _SVGA_TYPES_H_ +#define _SVGA_TYPES_H_ + +#include "pipe/p_compiler.h" + +typedef int64_t int64; +typedef uint64_t uint64; + +typedef int32_t int32; +typedef uint32_t uint32; + +typedef int16_t int16; +typedef uint16_t uint16; + +typedef int8_t int8; +typedef uint8_t uint8; + +typedef uint8_t Bool; + +#endif /* _SVGA_TYPES_H_ */ + diff --git a/src/gallium/drivers/svga/svga_cmd.c b/src/gallium/drivers/svga/svga_cmd.c new file mode 100644 index 0000000000..a0da7d7e5d --- /dev/null +++ b/src/gallium/drivers/svga/svga_cmd.c @@ -0,0 +1,1427 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +/** + * svga_cmd.c -- + * + * Command construction utility for the SVGA3D protocol used by + * the VMware SVGA device, based on the svgautil library. + */ + +#include "svga_winsys.h" +#include "svga_screen_buffer.h" +#include "svga_screen_texture.h" +#include "svga_cmd.h" + +/* + *---------------------------------------------------------------------- + * + * surface_to_surfaceid -- + * + * Utility function for surface ids. + * Can handle null surface. Does a surface_reallocation so you need + * to have allocated the fifo space before converting. + * + * Results: + * id is filld out. + * + * Side effects: + * One surface relocation is preformed for texture handle. + * + *---------------------------------------------------------------------- + */ + +static INLINE +void surface_to_surfaceid(struct svga_winsys_context *swc, // IN + struct pipe_surface *surface, // IN + SVGA3dSurfaceImageId *id, // OUT + unsigned flags) // IN +{ + if(surface) { + struct svga_surface *s = svga_surface(surface); + swc->surface_relocation(swc, &id->sid, s->handle, flags); + id->face = s->real_face; /* faces have the same order */ + id->mipmap = s->real_level; + } + else { + id->sid = SVGA3D_INVALID_ID; + id->face = 0; + id->mipmap = 0; + } +} + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_FIFOReserve -- + * + * Reserve space for an SVGA3D FIFO command. + * + * The 2D SVGA commands have been around for a while, so they + * have a rather asymmetric structure. The SVGA3D protocol is + * more uniform: each command begins with a header containing the + * command number and the full size. + * + * This is a convenience wrapper around SVGA_FIFOReserve. We + * reserve space for the whole command, and write the header. + * + * This function must be paired with SVGA_FIFOCommitAll(). + * + * Results: + * Returns a pointer to the space reserved for command-specific + * data. It must be 'cmdSize' bytes long. + * + * Side effects: + * Begins a FIFO reservation. + * + *---------------------------------------------------------------------- + */ + +void * +SVGA3D_FIFOReserve(struct svga_winsys_context *swc, + uint32 cmd, // IN + uint32 cmdSize, // IN + uint32 nr_relocs) // IN +{ + SVGA3dCmdHeader *header; + + header = swc->reserve(swc, sizeof *header + cmdSize, nr_relocs); + if(!header) + return NULL; + + header->id = cmd; + header->size = cmdSize; + + return &header[1]; +} + + +void +SVGA_FIFOCommitAll(struct svga_winsys_context *swc) +{ + swc->commit(swc); +} + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_DefineContext -- + * + * Create a new context, to be referred to with the provided ID. + * + * Context objects encapsulate all render state, and shader + * objects are per-context. + * + * Surfaces are not per-context. The same surface can be shared + * between multiple contexts, and surface operations can occur + * without a context. + * + * If the provided context ID already existed, it is redefined. + * + * Context IDs are arbitrary small non-negative integers, + * global to the entire SVGA device. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_DefineContext(struct svga_winsys_context *swc) // IN +{ + SVGA3dCmdDefineContext *cmd; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_CONTEXT_DEFINE, sizeof *cmd, 0); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + cmd->cid = swc->cid; + + swc->commit(swc); + + return PIPE_OK; +} + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_DestroyContext -- + * + * Delete a context created with SVGA3D_DefineContext. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_DestroyContext(struct svga_winsys_context *swc) // IN +{ + SVGA3dCmdDestroyContext *cmd; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_CONTEXT_DESTROY, sizeof *cmd, 0); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + cmd->cid = swc->cid; + + swc->commit(swc); + + return PIPE_OK; +} + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_BeginDefineSurface -- + * + * Begin a SURFACE_DEFINE command. This reserves space for it in + * the FIFO, and returns pointers to the command's faces and + * mipsizes arrays. + * + * This function must be paired with SVGA_FIFOCommitAll(). + * The faces and mipSizes arrays are initialized to zero. + * + * This creates a "surface" object in the SVGA3D device, + * with the provided surface ID (sid). Surfaces are generic + * containers for host VRAM objects like textures, vertex + * buffers, and depth/stencil buffers. + * + * Surfaces are hierarchial: + * + * - Surface may have multiple faces (for cube maps) + * + * - Each face has a list of mipmap levels + * + * - Each mipmap image may have multiple volume + * slices, if the image is three dimensional. + * + * - Each slice is a 2D array of 'blocks' + * + * - Each block may be one or more pixels. + * (Usually 1, more for DXT or YUV formats.) + * + * Surfaces are generic host VRAM objects. The SVGA3D device + * may optimize surfaces according to the format they were + * created with, but this format does not limit the ways in + * which the surface may be used. For example, a depth surface + * can be used as a texture, or a floating point image may + * be used as a vertex buffer. Some surface usages may be + * lower performance, due to software emulation, but any + * usage should work with any surface. + * + * If 'sid' is already defined, the old surface is deleted + * and this new surface replaces it. + * + * Surface IDs are arbitrary small non-negative integers, + * global to the entire SVGA device. + * + * Results: + * Returns pointers to arrays allocated in the FIFO for 'faces' + * and 'mipSizes'. + * + * Side effects: + * Begins a FIFO reservation. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_BeginDefineSurface(struct svga_winsys_context *swc, + struct svga_winsys_surface *sid, // IN + SVGA3dSurfaceFlags flags, // IN + SVGA3dSurfaceFormat format, // IN + SVGA3dSurfaceFace **faces, // OUT + SVGA3dSize **mipSizes, // OUT + uint32 numMipSizes) // IN +{ + SVGA3dCmdDefineSurface *cmd; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_SURFACE_DEFINE, sizeof *cmd + + sizeof **mipSizes * numMipSizes, 1); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + swc->surface_relocation(swc, &cmd->sid, sid, PIPE_BUFFER_USAGE_GPU_WRITE); + cmd->surfaceFlags = flags; + cmd->format = format; + + *faces = &cmd->face[0]; + *mipSizes = (SVGA3dSize*) &cmd[1]; + + memset(*faces, 0, sizeof **faces * SVGA3D_MAX_SURFACE_FACES); + memset(*mipSizes, 0, sizeof **mipSizes * numMipSizes); + + return PIPE_OK; +} + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_DefineSurface2D -- + * + * This is a simplified version of SVGA3D_BeginDefineSurface(), + * which does not support cube maps, mipmaps, or volume textures. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_DefineSurface2D(struct svga_winsys_context *swc, // IN + struct svga_winsys_surface *sid, // IN + uint32 width, // IN + uint32 height, // IN + SVGA3dSurfaceFormat format) // IN +{ + SVGA3dSize *mipSizes; + SVGA3dSurfaceFace *faces; + enum pipe_error ret; + + ret = SVGA3D_BeginDefineSurface(swc, + sid, 0, format, &faces, &mipSizes, 1); + if(ret != PIPE_OK) + return ret; + + faces[0].numMipLevels = 1; + + mipSizes[0].width = width; + mipSizes[0].height = height; + mipSizes[0].depth = 1; + + swc->commit(swc);; + + return PIPE_OK; +} + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_DestroySurface -- + * + * Release the host VRAM encapsulated by a particular surface ID. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_DestroySurface(struct svga_winsys_context *swc, + struct svga_winsys_surface *sid) // IN +{ + SVGA3dCmdDestroySurface *cmd; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_SURFACE_DESTROY, sizeof *cmd, 1); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + swc->surface_relocation(swc, &cmd->sid, sid, PIPE_BUFFER_USAGE_GPU_READ); + swc->commit(swc);; + + return PIPE_OK; +} + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_BeginSurfaceDMA-- + * + * Begin a SURFACE_DMA command. This reserves space for it in + * the FIFO, and returns a pointer to the command's box array. + * This function must be paired with SVGA_FIFOCommitAll(). + * + * When the SVGA3D device asynchronously processes this FIFO + * command, a DMA operation is performed between host VRAM and + * a generic SVGAGuestPtr. The guest pointer may refer to guest + * VRAM (provided by the SVGA PCI device) or to guest system + * memory that has been set up as a Guest Memory Region (GMR) + * by the SVGA device. + * + * The guest's DMA buffer must remain valid (not freed, paged out, + * or overwritten) until the host has finished processing this + * command. The guest can determine that the host has finished + * by using the SVGA device's FIFO Fence mechanism. + * + * The guest's image buffer can be an arbitrary size and shape. + * Guest image data is interpreted according to the SVGA3D surface + * format specified when the surface was defined. + * + * The caller may optionally define the guest image's pitch. + * guestImage->pitch can either be zero (assume image is tightly + * packed) or it must be the number of bytes between vertically + * adjacent image blocks. + * + * The provided copybox list specifies which regions of the source + * image are to be copied, and where they appear on the destination. + * + * NOTE: srcx/srcy are always on the guest image and x/y are + * always on the host image, regardless of the actual transfer + * direction! + * + * For efficiency, the SVGA3D device is free to copy more data + * than specified. For example, it may round copy boxes outwards + * such that they lie on particular alignment boundaries. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_SurfaceDMA(struct svga_winsys_context *swc, + struct svga_transfer *st, // IN + SVGA3dTransferType transfer, // IN + const SVGA3dCopyBox *boxes, // IN + uint32 numBoxes) // IN +{ + struct svga_texture *texture = svga_texture(st->base.texture); + SVGA3dCmdSurfaceDMA *cmd; + SVGA3dCmdSurfaceDMASuffix *pSuffix; + uint32 boxesSize = sizeof *boxes * numBoxes; + unsigned region_flags; + unsigned surface_flags; + + if(transfer == SVGA3D_WRITE_HOST_VRAM) { + region_flags = PIPE_BUFFER_USAGE_GPU_READ; + surface_flags = PIPE_BUFFER_USAGE_GPU_WRITE; + } + else if(transfer == SVGA3D_READ_HOST_VRAM) { + region_flags = PIPE_BUFFER_USAGE_GPU_WRITE; + surface_flags = PIPE_BUFFER_USAGE_GPU_READ; + } + else { + assert(0); + return PIPE_ERROR_BAD_INPUT; + } + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_SURFACE_DMA, + sizeof *cmd + boxesSize + sizeof *pSuffix, + 2); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + swc->region_relocation(swc, &cmd->guest.ptr, st->hwbuf, 0, region_flags); + cmd->guest.pitch = st->base.stride; + + swc->surface_relocation(swc, &cmd->host.sid, texture->handle, surface_flags); + cmd->host.face = st->base.face; /* PIPE_TEX_FACE_* and SVGA3D_CUBEFACE_* match */ + cmd->host.mipmap = st->base.level; + + cmd->transfer = transfer; + + memcpy(&cmd[1], boxes, boxesSize); + + pSuffix = (SVGA3dCmdSurfaceDMASuffix *)((uint8_t*)cmd + sizeof *cmd + boxesSize); + pSuffix->suffixSize = sizeof *pSuffix; + pSuffix->maximumOffset = st->hw_nblocksy*st->base.stride; + memset(&pSuffix->flags, 0, sizeof pSuffix->flags); + + swc->commit(swc); + + return PIPE_OK; +} + + +enum pipe_error +SVGA3D_BufferDMA(struct svga_winsys_context *swc, + struct svga_winsys_buffer *guest, + struct svga_winsys_surface *host, + SVGA3dTransferType transfer, // IN + uint32 size, // IN + uint32 offset, // IN + SVGA3dSurfaceDMAFlags flags) // IN +{ + SVGA3dCmdSurfaceDMA *cmd; + SVGA3dCopyBox *box; + SVGA3dCmdSurfaceDMASuffix *pSuffix; + unsigned region_flags; + unsigned surface_flags; + + if(transfer == SVGA3D_WRITE_HOST_VRAM) { + region_flags = PIPE_BUFFER_USAGE_GPU_READ; + surface_flags = PIPE_BUFFER_USAGE_GPU_WRITE; + } + else if(transfer == SVGA3D_READ_HOST_VRAM) { + region_flags = PIPE_BUFFER_USAGE_GPU_WRITE; + surface_flags = PIPE_BUFFER_USAGE_GPU_READ; + } + else { + assert(0); + return PIPE_ERROR_BAD_INPUT; + } + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_SURFACE_DMA, + sizeof *cmd + sizeof *box + sizeof *pSuffix, + 2); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + swc->region_relocation(swc, &cmd->guest.ptr, guest, 0, region_flags); + cmd->guest.pitch = 0; + + swc->surface_relocation(swc, &cmd->host.sid, host, surface_flags); + cmd->host.face = 0; + cmd->host.mipmap = 0; + + cmd->transfer = transfer; + + box = (SVGA3dCopyBox *)&cmd[1]; + box->x = offset; + box->y = 0; + box->z = 0; + box->w = size; + box->h = 1; + box->d = 1; + box->srcx = offset; + box->srcy = 0; + box->srcz = 0; + + pSuffix = (SVGA3dCmdSurfaceDMASuffix *)((uint8_t*)cmd + sizeof *cmd + sizeof *box); + pSuffix->suffixSize = sizeof *pSuffix; + pSuffix->maximumOffset = offset + size; + pSuffix->flags = flags; + + swc->commit(swc); + + return PIPE_OK; +} + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_SetRenderTarget -- + * + * Bind a surface object to a particular render target attachment + * point on the current context. Render target attachment points + * exist for color buffers, a depth buffer, and a stencil buffer. + * + * The SVGA3D device is quite lenient about the types of surfaces + * that may be used as render targets. The color buffers must + * all be the same size, but the depth and stencil buffers do not + * have to be the same size as the color buffer. All attachments + * are optional. + * + * Some combinations of render target formats may require software + * emulation, depending on the capabilities of the host graphics + * API and graphics hardware. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_SetRenderTarget(struct svga_winsys_context *swc, + SVGA3dRenderTargetType type, // IN + struct pipe_surface *surface) // IN +{ + SVGA3dCmdSetRenderTarget *cmd; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_SETRENDERTARGET, sizeof *cmd, 1); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + + cmd->cid = swc->cid; + + cmd->type = type; + + surface_to_surfaceid(swc, surface, &cmd->target, PIPE_BUFFER_USAGE_GPU_WRITE); + + swc->commit(swc); + + return PIPE_OK; +} + + + + + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_DefineShader -- + * + * Upload the bytecode for a new shader. The bytecode is "SVGA3D + * format", which is theoretically a binary-compatible superset + * of Microsoft's DirectX shader bytecode. In practice, the + * SVGA3D bytecode doesn't yet have any extensions to DirectX's + * bytecode format. + * + * The SVGA3D device supports shader models 1.1 through 2.0. + * + * The caller chooses a shader ID (small positive integer) by + * which this shader will be identified in future commands. This + * ID is in a namespace which is per-context and per-shader-type. + * + * 'bytecodeLen' is specified in bytes. It must be a multiple of 4. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_DefineShader(struct svga_winsys_context *swc, + uint32 shid, // IN + SVGA3dShaderType type, // IN + const uint32 *bytecode, // IN + uint32 bytecodeLen) // IN +{ + SVGA3dCmdDefineShader *cmd; + + assert(bytecodeLen % 4 == 0); + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_SHADER_DEFINE, sizeof *cmd + bytecodeLen, + 0); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + cmd->cid = swc->cid; + cmd->shid = shid; + cmd->type = type; + memcpy(&cmd[1], bytecode, bytecodeLen); + swc->commit(swc); + + return PIPE_OK; +} + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_DestroyShader -- + * + * Delete a shader that was created by SVGA3D_DefineShader. If + * the shader was the current vertex or pixel shader for its + * context, rendering results are undefined until a new shader is + * bound. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_DestroyShader(struct svga_winsys_context *swc, + uint32 shid, // IN + SVGA3dShaderType type) // IN +{ + SVGA3dCmdDestroyShader *cmd; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_SHADER_DESTROY, sizeof *cmd, + 0); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + cmd->cid = swc->cid; + cmd->shid = shid; + cmd->type = type; + swc->commit(swc); + + return PIPE_OK; +} + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_SetShaderConst -- + * + * Set the value of a shader constant. + * + * Shader constants are analogous to uniform variables in GLSL, + * except that they belong to the render context rather than to + * an individual shader. + * + * Constants may have one of three types: A 4-vector of floats, + * a 4-vector of integers, or a single boolean flag. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_SetShaderConst(struct svga_winsys_context *swc, + uint32 reg, // IN + SVGA3dShaderType type, // IN + SVGA3dShaderConstType ctype, // IN + const void *value) // IN +{ + SVGA3dCmdSetShaderConst *cmd; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_SET_SHADER_CONST, sizeof *cmd, + 0); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + cmd->cid = swc->cid; + cmd->reg = reg; + cmd->type = type; + cmd->ctype = ctype; + + switch (ctype) { + + case SVGA3D_CONST_TYPE_FLOAT: + case SVGA3D_CONST_TYPE_INT: + memcpy(&cmd->values, value, sizeof cmd->values); + break; + + case SVGA3D_CONST_TYPE_BOOL: + memset(&cmd->values, 0, sizeof cmd->values); + cmd->values[0] = *(uint32*)value; + break; + + default: + assert(0); + break; + + } + swc->commit(swc); + + return PIPE_OK; +} + + + + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_SetShader -- + * + * Switch active shaders. This binds a new vertex or pixel shader + * to the specified context. + * + * A shader ID of SVGA3D_INVALID_ID unbinds any shader, switching + * back to the fixed function vertex or pixel pipeline. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_SetShader(struct svga_winsys_context *swc, + SVGA3dShaderType type, // IN + uint32 shid) // IN +{ + SVGA3dCmdSetShader *cmd; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_SET_SHADER, sizeof *cmd, + 0); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + cmd->cid = swc->cid; + cmd->type = type; + cmd->shid = shid; + swc->commit(swc); + + return PIPE_OK; +} + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_BeginClear -- + * + * Begin a CLEAR command. This reserves space for it in the FIFO, + * and returns a pointer to the command's rectangle array. This + * function must be paired with SVGA_FIFOCommitAll(). + * + * Clear is a rendering operation which fills a list of + * rectangles with constant values on all render target types + * indicated by 'flags'. + * + * Clear is not affected by clipping, depth test, or other + * render state which affects the fragment pipeline. + * + * Results: + * None. + * + * Side effects: + * May write to attached render target surfaces. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_BeginClear(struct svga_winsys_context *swc, + SVGA3dClearFlag flags, // IN + uint32 color, // IN + float depth, // IN + uint32 stencil, // IN + SVGA3dRect **rects, // OUT + uint32 numRects) // IN +{ + SVGA3dCmdClear *cmd; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_CLEAR, + sizeof *cmd + sizeof **rects * numRects, + 0); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + cmd->cid = swc->cid; + cmd->clearFlag = flags; + cmd->color = color; + cmd->depth = depth; + cmd->stencil = stencil; + *rects = (SVGA3dRect*) &cmd[1]; + + return PIPE_OK; +} + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_ClearRect -- + * + * This is a simplified version of SVGA3D_BeginClear(). + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_ClearRect(struct svga_winsys_context *swc, + SVGA3dClearFlag flags, // IN + uint32 color, // IN + float depth, // IN + uint32 stencil, // IN + uint32 x, // IN + uint32 y, // IN + uint32 w, // IN + uint32 h) // IN +{ + SVGA3dRect *rect; + enum pipe_error ret; + + ret = SVGA3D_BeginClear(swc, flags, color, depth, stencil, &rect, 1); + if(ret != PIPE_OK) + return PIPE_ERROR_OUT_OF_MEMORY; + + memset(rect, 0, sizeof *rect); + rect->x = x; + rect->y = y; + rect->w = w; + rect->h = h; + swc->commit(swc); + + return PIPE_OK; +} + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_BeginDrawPrimitives -- + * + * Begin a DRAW_PRIMITIVES command. This reserves space for it in + * the FIFO, and returns a pointer to the command's arrays. + * This function must be paired with SVGA_FIFOCommitAll(). + * + * Drawing commands consist of two variable-length arrays: + * SVGA3dVertexDecl elements declare a set of vertex buffers to + * use while rendering, and SVGA3dPrimitiveRange elements specify + * groups of primitives each with an optional index buffer. + * + * The decls and ranges arrays are initialized to zero. + * + * Results: + * None. + * + * Side effects: + * May write to attached render target surfaces. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_BeginDrawPrimitives(struct svga_winsys_context *swc, + SVGA3dVertexDecl **decls, // OUT + uint32 numVertexDecls, // IN + SVGA3dPrimitiveRange **ranges, // OUT + uint32 numRanges) // IN +{ + SVGA3dCmdDrawPrimitives *cmd; + SVGA3dVertexDecl *declArray; + SVGA3dPrimitiveRange *rangeArray; + uint32 declSize = sizeof **decls * numVertexDecls; + uint32 rangeSize = sizeof **ranges * numRanges; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_DRAW_PRIMITIVES, + sizeof *cmd + declSize + rangeSize, + numVertexDecls + numRanges); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + cmd->cid = swc->cid; + cmd->numVertexDecls = numVertexDecls; + cmd->numRanges = numRanges; + + declArray = (SVGA3dVertexDecl*) &cmd[1]; + rangeArray = (SVGA3dPrimitiveRange*) &declArray[numVertexDecls]; + + memset(declArray, 0, declSize); + memset(rangeArray, 0, rangeSize); + + *decls = declArray; + *ranges = rangeArray; + + return PIPE_OK; +} + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_BeginSurfaceCopy -- + * + * Begin a SURFACE_COPY command. This reserves space for it in + * the FIFO, and returns a pointer to the command's arrays. This + * function must be paired with SVGA_FIFOCommitAll(). + * + * The box array is initialized with zeroes. + * + * Results: + * None. + * + * Side effects: + * Asynchronously copies a list of boxes from surface to surface. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_BeginSurfaceCopy(struct svga_winsys_context *swc, + struct pipe_surface *src, // IN + struct pipe_surface *dest, // IN + SVGA3dCopyBox **boxes, // OUT + uint32 numBoxes) // IN +{ + SVGA3dCmdSurfaceCopy *cmd; + uint32 boxesSize = sizeof **boxes * numBoxes; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_SURFACE_COPY, sizeof *cmd + boxesSize, + 2); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + surface_to_surfaceid(swc, src, &cmd->src, PIPE_BUFFER_USAGE_GPU_READ); + surface_to_surfaceid(swc, dest, &cmd->dest, PIPE_BUFFER_USAGE_GPU_WRITE); + *boxes = (SVGA3dCopyBox*) &cmd[1]; + + memset(*boxes, 0, boxesSize); + + return PIPE_OK; +} + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_SurfaceStretchBlt -- + * + * Issue a SURFACE_STRETCHBLT command: an asynchronous + * surface-to-surface blit, with scaling. + * + * Results: + * None. + * + * Side effects: + * Asynchronously copies one box from surface to surface. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_SurfaceStretchBlt(struct svga_winsys_context *swc, + struct pipe_surface *src, // IN + struct pipe_surface *dest, // IN + SVGA3dBox *boxSrc, // IN + SVGA3dBox *boxDest, // IN + SVGA3dStretchBltMode mode) // IN +{ + SVGA3dCmdSurfaceStretchBlt *cmd; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_SURFACE_STRETCHBLT, sizeof *cmd, + 2); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + surface_to_surfaceid(swc, src, &cmd->src, PIPE_BUFFER_USAGE_GPU_READ); + surface_to_surfaceid(swc, dest, &cmd->dest, PIPE_BUFFER_USAGE_GPU_WRITE); + cmd->boxSrc = *boxSrc; + cmd->boxDest = *boxDest; + cmd->mode = mode; + swc->commit(swc); + + return PIPE_OK; +} + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_SetViewport -- + * + * Set the current context's viewport rectangle. The viewport + * is clipped to the dimensions of the current render target, + * then all rendering is clipped to the viewport. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_SetViewport(struct svga_winsys_context *swc, + SVGA3dRect *rect) // IN +{ + SVGA3dCmdSetViewport *cmd; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_SETVIEWPORT, sizeof *cmd, + 0); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + cmd->cid = swc->cid; + cmd->rect = *rect; + swc->commit(swc); + + return PIPE_OK; +} + + + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_SetScissorRect -- + * + * Set the current context's scissor rectangle. If scissor + * is enabled then all rendering is clipped to the scissor. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_SetScissorRect(struct svga_winsys_context *swc, + SVGA3dRect *rect) // IN +{ + SVGA3dCmdSetScissorRect *cmd; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_SETSCISSORRECT, sizeof *cmd, + 0); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + cmd->cid = swc->cid; + cmd->rect = *rect; + swc->commit(swc); + + return PIPE_OK; +} + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_SetClipPlane -- + * + * Set one of the current context's clip planes. If the clip + * plane is enabled then all 3d rendering is clipped to against + * the plane. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error SVGA3D_SetClipPlane(struct svga_winsys_context *swc, + uint32 index, const float *plane) +{ + SVGA3dCmdSetClipPlane *cmd; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_SETCLIPPLANE, sizeof *cmd, + 0); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + cmd->cid = swc->cid; + cmd->index = index; + cmd->plane[0] = plane[0]; + cmd->plane[1] = plane[1]; + cmd->plane[2] = plane[2]; + cmd->plane[3] = plane[3]; + swc->commit(swc); + + return PIPE_OK; +} + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_SetZRange -- + * + * Set the range of the depth buffer to use. 'min' and 'max' + * are values between 0.0 and 1.0. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_SetZRange(struct svga_winsys_context *swc, + float zMin, // IN + float zMax) // IN +{ + SVGA3dCmdSetZRange *cmd; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_SETZRANGE, sizeof *cmd, + 0); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + cmd->cid = swc->cid; + cmd->zRange.min = zMin; + cmd->zRange.max = zMax; + swc->commit(swc); + + return PIPE_OK; +} + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_BeginSetTextureState -- + * + * Begin a SETTEXTURESTATE command. This reserves space for it in + * the FIFO, and returns a pointer to the command's texture state + * array. This function must be paired with SVGA_FIFOCommitAll(). + * + * This command sets rendering state which is per-texture-unit. + * + * XXX: Individual texture states need documentation. However, + * they are very similar to the texture states defined by + * Direct3D. The D3D documentation is a good starting point + * for understanding SVGA3D texture states. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_BeginSetTextureState(struct svga_winsys_context *swc, + SVGA3dTextureState **states, // OUT + uint32 numStates) // IN +{ + SVGA3dCmdSetTextureState *cmd; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_SETTEXTURESTATE, + sizeof *cmd + sizeof **states * numStates, + numStates); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + cmd->cid = swc->cid; + *states = (SVGA3dTextureState*) &cmd[1]; + + return PIPE_OK; +} + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_BeginSetRenderState -- + * + * Begin a SETRENDERSTATE command. This reserves space for it in + * the FIFO, and returns a pointer to the command's texture state + * array. This function must be paired with SVGA_FIFOCommitAll(). + * + * This command sets rendering state which is global to the context. + * + * XXX: Individual render states need documentation. However, + * they are very similar to the render states defined by + * Direct3D. The D3D documentation is a good starting point + * for understanding SVGA3D render states. + * + * Results: + * None. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_BeginSetRenderState(struct svga_winsys_context *swc, + SVGA3dRenderState **states, // OUT + uint32 numStates) // IN +{ + SVGA3dCmdSetRenderState *cmd; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_SETRENDERSTATE, + sizeof *cmd + sizeof **states * numStates, + 0); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + cmd->cid = swc->cid; + *states = (SVGA3dRenderState*) &cmd[1]; + + return PIPE_OK; +} + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_BeginQuery-- + * + * Issues a SVGA_3D_CMD_BEGIN_QUERY command. + * + * Results: + * None. + * + * Side effects: + * Commits space in the FIFO memory. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_BeginQuery(struct svga_winsys_context *swc, + SVGA3dQueryType type) // IN +{ + SVGA3dCmdBeginQuery *cmd; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_BEGIN_QUERY, + sizeof *cmd, + 0); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + cmd->cid = swc->cid; + cmd->type = type; + + swc->commit(swc); + + return PIPE_OK; +} + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_EndQuery-- + * + * Issues a SVGA_3D_CMD_END_QUERY command. + * + * Results: + * None. + * + * Side effects: + * Commits space in the FIFO memory. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_EndQuery(struct svga_winsys_context *swc, + SVGA3dQueryType type, // IN + struct svga_winsys_buffer *buffer) // IN/OUT +{ + SVGA3dCmdEndQuery *cmd; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_END_QUERY, + sizeof *cmd, + 1); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + cmd->cid = swc->cid; + cmd->type = type; + + swc->region_relocation(swc, &cmd->guestResult, buffer, 0, + PIPE_BUFFER_USAGE_GPU_WRITE); + + swc->commit(swc); + + return PIPE_OK; +} + + +/* + *---------------------------------------------------------------------- + * + * SVGA3D_WaitForQuery-- + * + * Issues a SVGA_3D_CMD_WAIT_FOR_QUERY command. This reserves space + * for it in the FIFO. This doesn't actually wait for the query to + * finish but instead tells the host to start a wait at the driver + * level. The caller can wait on the status variable in the + * guestPtr memory or send an insert fence instruction after this + * command and wait on the fence. + * + * Results: + * None. + * + * Side effects: + * Commits space in the FIFO memory. + * + *---------------------------------------------------------------------- + */ + +enum pipe_error +SVGA3D_WaitForQuery(struct svga_winsys_context *swc, + SVGA3dQueryType type, // IN + struct svga_winsys_buffer *buffer) // IN/OUT +{ + SVGA3dCmdWaitForQuery *cmd; + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_WAIT_FOR_QUERY, + sizeof *cmd, + 1); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + cmd->cid = swc->cid; + cmd->type = type; + + swc->region_relocation(swc, &cmd->guestResult, buffer, 0, + PIPE_BUFFER_USAGE_GPU_WRITE); + + swc->commit(swc); + + return PIPE_OK; +} diff --git a/src/gallium/drivers/svga/svga_cmd.h b/src/gallium/drivers/svga/svga_cmd.h new file mode 100644 index 0000000000..8041054769 --- /dev/null +++ b/src/gallium/drivers/svga/svga_cmd.h @@ -0,0 +1,235 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +/* + * svga_cmd.h -- + * + * Command construction utility for the SVGA3D protocol used by + * the VMware SVGA device, based on the svgautil library. + */ + +#ifndef __SVGA3D_H__ +#define __SVGA3D_H__ + + +#include "svga_types.h" +#include "svga_reg.h" +#include "svga3d_reg.h" + +#include "pipe/p_defines.h" + + +struct pipe_buffer; +struct pipe_surface; +struct svga_transfer; +struct svga_winsys_context; +struct svga_winsys_buffer; +struct svga_winsys_surface; + + +/* + * SVGA Device Interoperability + */ + +void * +SVGA3D_FIFOReserve(struct svga_winsys_context *swc, uint32 cmd, uint32 cmdSize, uint32 nr_relocs); + +void +SVGA_FIFOCommitAll(struct svga_winsys_context *swc); + + +/* + * Context Management + */ + +enum pipe_error +SVGA3D_DefineContext(struct svga_winsys_context *swc); + +enum pipe_error +SVGA3D_DestroyContext(struct svga_winsys_context *swc); + + +/* + * Surface Management + */ + +enum pipe_error +SVGA3D_BeginDefineSurface(struct svga_winsys_context *swc, + struct svga_winsys_surface *sid, + SVGA3dSurfaceFlags flags, + SVGA3dSurfaceFormat format, + SVGA3dSurfaceFace **faces, + SVGA3dSize **mipSizes, + uint32 numMipSizes); +enum pipe_error +SVGA3D_DefineSurface2D(struct svga_winsys_context *swc, + struct svga_winsys_surface *sid, + uint32 width, + uint32 height, + SVGA3dSurfaceFormat format); +enum pipe_error +SVGA3D_DestroySurface(struct svga_winsys_context *swc, + struct svga_winsys_surface *sid); + + +/* + * Surface Operations + */ + +enum pipe_error +SVGA3D_SurfaceDMA(struct svga_winsys_context *swc, + struct svga_transfer *st, + SVGA3dTransferType transfer, + const SVGA3dCopyBox *boxes, + uint32 numBoxes); + +enum pipe_error +SVGA3D_BufferDMA(struct svga_winsys_context *swc, + struct svga_winsys_buffer *guest, + struct svga_winsys_surface *host, + SVGA3dTransferType transfer, + uint32 size, + uint32 offset, + SVGA3dSurfaceDMAFlags flags); + +/* + * Drawing Operations + */ + + +enum pipe_error +SVGA3D_BeginClear(struct svga_winsys_context *swc, + SVGA3dClearFlag flags, + uint32 color, float depth, uint32 stencil, + SVGA3dRect **rects, uint32 numRects); + +enum pipe_error +SVGA3D_ClearRect(struct svga_winsys_context *swc, + SVGA3dClearFlag flags, uint32 color, float depth, + uint32 stencil, uint32 x, uint32 y, uint32 w, uint32 h); + +enum pipe_error +SVGA3D_BeginDrawPrimitives(struct svga_winsys_context *swc, + SVGA3dVertexDecl **decls, + uint32 numVertexDecls, + SVGA3dPrimitiveRange **ranges, + uint32 numRanges); + +/* + * Blits + */ + +enum pipe_error +SVGA3D_BeginSurfaceCopy(struct svga_winsys_context *swc, + struct pipe_surface *src, + struct pipe_surface *dest, + SVGA3dCopyBox **boxes, uint32 numBoxes); + + +enum pipe_error +SVGA3D_SurfaceStretchBlt(struct svga_winsys_context *swc, + struct pipe_surface *src, + struct pipe_surface *dest, + SVGA3dBox *boxSrc, SVGA3dBox *boxDest, + SVGA3dStretchBltMode mode); + +/* + * Shared FFP/Shader Render State + */ + +enum pipe_error +SVGA3D_SetRenderTarget(struct svga_winsys_context *swc, + SVGA3dRenderTargetType type, + struct pipe_surface *surface); + +enum pipe_error +SVGA3D_SetZRange(struct svga_winsys_context *swc, + float zMin, float zMax); + +enum pipe_error +SVGA3D_SetViewport(struct svga_winsys_context *swc, + SVGA3dRect *rect); + +enum pipe_error +SVGA3D_SetScissorRect(struct svga_winsys_context *swc, + SVGA3dRect *rect); + +enum pipe_error +SVGA3D_SetClipPlane(struct svga_winsys_context *swc, + uint32 index, const float *plane); + +enum pipe_error +SVGA3D_BeginSetTextureState(struct svga_winsys_context *swc, + SVGA3dTextureState **states, + uint32 numStates); + +enum pipe_error +SVGA3D_BeginSetRenderState(struct svga_winsys_context *swc, + SVGA3dRenderState **states, + uint32 numStates); + + +/* + * Shaders + */ + +enum pipe_error +SVGA3D_DefineShader(struct svga_winsys_context *swc, + uint32 shid, SVGA3dShaderType type, + const uint32 *bytecode, uint32 bytecodeLen); + +enum pipe_error +SVGA3D_DestroyShader(struct svga_winsys_context *swc, + uint32 shid, SVGA3dShaderType type); + +enum pipe_error +SVGA3D_SetShaderConst(struct svga_winsys_context *swc, + uint32 reg, SVGA3dShaderType type, + SVGA3dShaderConstType ctype, const void *value); + +enum pipe_error +SVGA3D_SetShader(struct svga_winsys_context *swc, + SVGA3dShaderType type, uint32 shid); + + +/* + * Queries + */ + +enum pipe_error +SVGA3D_BeginQuery(struct svga_winsys_context *swc, + SVGA3dQueryType type); + +enum pipe_error +SVGA3D_EndQuery(struct svga_winsys_context *swc, + SVGA3dQueryType type, + struct svga_winsys_buffer *buffer); + +enum pipe_error +SVGA3D_WaitForQuery(struct svga_winsys_context *swc, + SVGA3dQueryType type, + struct svga_winsys_buffer *buffer); + +#endif /* __SVGA3D_H__ */ diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c new file mode 100644 index 0000000000..73233957f3 --- /dev/null +++ b/src/gallium/drivers/svga/svga_context.c @@ -0,0 +1,269 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "svga_cmd.h" + +#include "pipe/p_defines.h" +#include "pipe/p_inlines.h" +#include "pipe/p_screen.h" +#include "util/u_memory.h" +#include "util/u_upload_mgr.h" + +#include "svga_context.h" +#include "svga_screen.h" +#include "svga_screen_texture.h" +#include "svga_screen_buffer.h" +#include "svga_winsys.h" +#include "svga_swtnl.h" +#include "svga_draw.h" +#include "svga_debug.h" +#include "svga_state.h" + + +static void svga_destroy( struct pipe_context *pipe ) +{ + struct svga_context *svga = svga_context( pipe ); + unsigned shader; + + svga_cleanup_framebuffer( svga ); + svga_cleanup_tss_binding( svga ); + + svga_hwtnl_destroy( svga->hwtnl ); + + svga_cleanup_vertex_state(svga); + + svga->swc->destroy(svga->swc); + + svga_destroy_swtnl( svga ); + + u_upload_destroy( svga->upload_vb ); + u_upload_destroy( svga->upload_ib ); + + for(shader = 0; shader < PIPE_SHADER_TYPES; ++shader) + pipe_buffer_reference( &svga->curr.cb[shader], NULL ); + + FREE( svga ); +} + +static unsigned int +svga_is_texture_referenced( struct pipe_context *pipe, + struct pipe_texture *texture, + unsigned face, unsigned level) +{ + struct svga_texture *tex = svga_texture(texture); + struct svga_screen *ss = svga_screen(pipe->screen); + + /** + * The screen does not cache texture writes. + */ + + if (!tex->handle || ss->sws->surface_is_flushed(ss->sws, tex->handle)) + return PIPE_UNREFERENCED; + + /** + * sws->surface_is_flushed() does not distinguish between read references + * and write references. So assume a reference is both. + */ + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} + +static unsigned int +svga_is_buffer_referenced( struct pipe_context *pipe, + struct pipe_buffer *buf) + +{ + struct svga_screen *ss = svga_screen(pipe->screen); + struct svga_buffer *sbuf = svga_buffer(buf); + + /** + * XXX: Check this. + * The screen may cache buffer writes, but when we map, we map out + * of those cached writes, so we don't need to set a + * PIPE_REFERENCED_FOR_WRITE flag for cached buffers. + */ + + if (!sbuf->handle || ss->sws->surface_is_flushed(ss->sws, sbuf->handle)) + return PIPE_UNREFERENCED; + + /** + * sws->surface_is_flushed() does not distinguish between read references + * and write references. So assume a reference is both, + * however, we make an exception for index- and vertex buffers, to avoid + * a flush in st_bufferobj_get_subdata, during display list replay. + */ + + if (sbuf->base.usage & (PIPE_BUFFER_USAGE_VERTEX | PIPE_BUFFER_USAGE_INDEX)) + return PIPE_REFERENCED_FOR_READ; + + return PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE; +} + + +struct pipe_context *svga_context_create( struct pipe_screen *screen ) +{ + struct svga_screen *svgascreen = svga_screen(screen); + struct svga_context *svga = NULL; + enum pipe_error ret; + + svga = CALLOC_STRUCT(svga_context); + if (svga == NULL) + goto error1; + + svga->pipe.winsys = screen->winsys; + svga->pipe.screen = screen; + svga->pipe.destroy = svga_destroy; + svga->pipe.clear = svga_clear; + + svga->pipe.is_texture_referenced = svga_is_texture_referenced; + svga->pipe.is_buffer_referenced = svga_is_buffer_referenced; + + svga->swc = svgascreen->sws->context_create(svgascreen->sws); + if(!svga->swc) + goto error2; + + svga_init_blend_functions(svga); + svga_init_blit_functions(svga); + svga_init_depth_stencil_functions(svga); + svga_init_draw_functions(svga); + svga_init_flush_functions(svga); + svga_init_misc_functions(svga); + svga_init_rasterizer_functions(svga); + svga_init_sampler_functions(svga); + svga_init_fs_functions(svga); + svga_init_vs_functions(svga); + svga_init_vertex_functions(svga); + svga_init_constbuffer_functions(svga); + svga_init_query_functions(svga); + + /* debug */ + svga->debug.no_swtnl = debug_get_bool_option("SVGA_NO_SWTNL", FALSE); + svga->debug.force_swtnl = debug_get_bool_option("SVGA_FORCE_SWTNL", FALSE); + svga->debug.use_min_mipmap = debug_get_bool_option("SVGA_USE_MIN_MIPMAP", FALSE); + svga->debug.disable_shader = debug_get_num_option("SVGA_DISABLE_SHADER", ~0); + + if (!svga_init_swtnl(svga)) + goto error3; + + svga->upload_ib = u_upload_create( svga->pipe.screen, + 32 * 1024, + 16, + PIPE_BUFFER_USAGE_INDEX ); + if (svga->upload_ib == NULL) + goto error4; + + svga->upload_vb = u_upload_create( svga->pipe.screen, + 128 * 1024, + 16, + PIPE_BUFFER_USAGE_VERTEX ); + if (svga->upload_vb == NULL) + goto error5; + + svga->hwtnl = svga_hwtnl_create( svga, + svga->upload_ib, + svga->swc ); + if (svga->hwtnl == NULL) + goto error6; + + + ret = svga_emit_initial_state( svga ); + if (ret) + goto error7; + + /* Avoid shortcircuiting state with initial value of zero. + */ + memset(&svga->state.hw_clear, 0xcd, sizeof(svga->state.hw_clear)); + memset(&svga->state.hw_clear.framebuffer, 0x0, + sizeof(svga->state.hw_clear.framebuffer)); + + memset(&svga->state.hw_draw, 0xcd, sizeof(svga->state.hw_draw)); + memset(&svga->state.hw_draw.views, 0x0, sizeof(svga->state.hw_draw.views)); + svga->state.hw_draw.num_views = 0; + + svga->dirty = ~0; + svga->state.white_fs_id = SVGA3D_INVALID_ID; + + LIST_INITHEAD(&svga->dirty_buffers); + + return &svga->pipe; + +error7: + svga_hwtnl_destroy( svga->hwtnl ); +error6: + u_upload_destroy( svga->upload_vb ); +error5: + u_upload_destroy( svga->upload_ib ); +error4: + svga_destroy_swtnl(svga); +error3: + svga->swc->destroy(svga->swc); +error2: + FREE(svga); +error1: + return NULL; +} + + +void svga_context_flush( struct svga_context *svga, + struct pipe_fence_handle **pfence ) +{ + struct svga_screen *svgascreen = svga_screen(svga->pipe.screen); + + /* Unmap upload manager buffers: + */ + u_upload_flush(svga->upload_vb); + u_upload_flush(svga->upload_ib); + + /* Flush screen, to ensure that texture dma uploads are processed + * before submitting commands. + */ + svga_screen_flush(svgascreen, NULL); + + svga_context_flush_buffers(svga); + + /* Flush pending commands to hardware: + */ + svga->swc->flush(svga->swc, pfence); + + if (SVGA_DEBUG & DEBUG_SYNC) { + if (pfence && *pfence) + svga->pipe.screen->fence_finish( svga->pipe.screen, *pfence, 0); + } +} + + +void svga_hwtnl_flush_retry( struct svga_context *svga ) +{ + enum pipe_error ret = PIPE_OK; + + ret = svga_hwtnl_flush( svga->hwtnl ); + if (ret == PIPE_ERROR_OUT_OF_MEMORY) { + svga_context_flush( svga, NULL ); + ret = svga_hwtnl_flush( svga->hwtnl ); + } + + assert(ret == 0); +} + diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h new file mode 100644 index 0000000000..9a3e92fd8d --- /dev/null +++ b/src/gallium/drivers/svga/svga_context.h @@ -0,0 +1,443 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#ifndef SVGA_CONTEXT_H +#define SVGA_CONTEXT_H + + +#include "pipe/p_context.h" +#include "pipe/p_defines.h" +#include "pipe/p_state.h" + +#include "util/u_double_list.h" + +#include "tgsi/tgsi_scan.h" + + +#define SVGA_TEX_UNITS 8 + +struct draw_vertex_shader; +struct svga_shader_result; +struct SVGACmdMemory; +struct u_upload_mgr; + + +struct svga_shader +{ + const struct tgsi_token *tokens; + + struct tgsi_shader_info info; + + struct svga_shader_result *results; + + unsigned id; + + boolean use_sm30; +}; + +struct svga_fragment_shader +{ + struct svga_shader base; +}; + +struct svga_vertex_shader +{ + struct svga_shader base; + + struct draw_vertex_shader *draw_shader; +}; + + +struct svga_cache_context; +struct svga_tracked_state; + +struct svga_blend_state { + + boolean need_white_fragments; + + /* Should be per-render-target: + */ + struct { + uint8_t writemask; + + boolean blend_enable; + uint8_t srcblend; + uint8_t dstblend; + uint8_t blendeq; + + boolean separate_alpha_blend_enable; + uint8_t srcblend_alpha; + uint8_t dstblend_alpha; + uint8_t blendeq_alpha; + + } rt[1]; +}; + +struct svga_depth_stencil_state { + unsigned zfunc:8; + unsigned zenable:1; + unsigned zwriteenable:1; + + unsigned alphatestenable:1; + unsigned alphafunc:8; + + struct { + unsigned enabled:1; + unsigned func:8; + unsigned fail:8; + unsigned zfail:8; + unsigned pass:8; + } stencil[2]; + + /* SVGA3D has one ref/mask/writemask triple shared between front & + * back face stencil. We really need two: + */ + unsigned stencil_ref:8; + unsigned stencil_mask:8; + unsigned stencil_writemask:8; + + float alpharef; +}; + +#define SVGA_UNFILLED_DISABLE 0 +#define SVGA_UNFILLED_LINE 1 +#define SVGA_UNFILLED_POINT 2 + +#define SVGA_PIPELINE_FLAG_POINTS (1<svga = svga; + hwtnl->upload_ib = upload_ib; + + hwtnl->cmd.swc = swc; + + return hwtnl; + +fail: + return NULL; +} + +void svga_hwtnl_destroy( struct svga_hwtnl *hwtnl ) +{ + int i, j; + + for (i = 0; i < PIPE_PRIM_MAX; i++) { + for (j = 0; j < IDX_CACHE_MAX; j++) { + pipe_buffer_reference( &hwtnl->index_cache[i][j].buffer, + NULL ); + } + } + + for (i = 0; i < hwtnl->cmd.vdecl_count; i++) + pipe_buffer_reference(&hwtnl->cmd.vdecl_vb[i], NULL); + + for (i = 0; i < hwtnl->cmd.prim_count; i++) + pipe_buffer_reference(&hwtnl->cmd.prim_ib[i], NULL); + + + FREE(hwtnl); +} + + +void svga_hwtnl_set_flatshade( struct svga_hwtnl *hwtnl, + boolean flatshade, + boolean flatshade_first ) +{ + hwtnl->hw_pv = PV_FIRST; + hwtnl->api_pv = (flatshade && !flatshade_first) ? PV_LAST : PV_FIRST; +} + +void svga_hwtnl_set_unfilled( struct svga_hwtnl *hwtnl, + unsigned mode ) +{ + hwtnl->api_fillmode = mode; +} + +void svga_hwtnl_reset_vdecl( struct svga_hwtnl *hwtnl, + unsigned count ) +{ + unsigned i; + + assert(hwtnl->cmd.prim_count == 0); + + for (i = count; i < hwtnl->cmd.vdecl_count; i++) { + pipe_buffer_reference(&hwtnl->cmd.vdecl_vb[i], + NULL); + } + + hwtnl->cmd.vdecl_count = count; +} + + +void svga_hwtnl_vdecl( struct svga_hwtnl *hwtnl, + unsigned i, + const SVGA3dVertexDecl *decl, + struct pipe_buffer *vb) +{ + assert(hwtnl->cmd.prim_count == 0); + + assert( i < hwtnl->cmd.vdecl_count ); + + hwtnl->cmd.vdecl[i] = *decl; + + pipe_buffer_reference(&hwtnl->cmd.vdecl_vb[i], + vb); +} + + + +enum pipe_error +svga_hwtnl_flush( struct svga_hwtnl *hwtnl ) +{ + struct svga_winsys_context *swc = hwtnl->cmd.swc; + struct svga_context *svga = hwtnl->svga; + enum pipe_error ret; + + if (hwtnl->cmd.prim_count) { + struct svga_winsys_surface *vb_handle[SVGA3D_INPUTREG_MAX]; + struct svga_winsys_surface *ib_handle[QSZ]; + struct svga_winsys_surface *handle; + SVGA3dVertexDecl *vdecl; + SVGA3dPrimitiveRange *prim; + unsigned i; + + for (i = 0; i < hwtnl->cmd.vdecl_count; i++) { + handle = svga_buffer_handle(svga, hwtnl->cmd.vdecl_vb[i]); + if (handle == NULL) + return PIPE_ERROR_OUT_OF_MEMORY; + + vb_handle[i] = handle; + } + + for (i = 0; i < hwtnl->cmd.prim_count; i++) { + if (hwtnl->cmd.prim_ib[i]) { + handle = svga_buffer_handle(svga, hwtnl->cmd.prim_ib[i]); + if (handle == NULL) + return PIPE_ERROR_OUT_OF_MEMORY; + } + else + handle = NULL; + + ib_handle[i] = handle; + } + + ret = SVGA3D_BeginDrawPrimitives(swc, + &vdecl, + hwtnl->cmd.vdecl_count, + &prim, + hwtnl->cmd.prim_count); + if (ret != PIPE_OK) + return ret; + + + memcpy( vdecl, + hwtnl->cmd.vdecl, + hwtnl->cmd.vdecl_count * sizeof hwtnl->cmd.vdecl[0]); + + for (i = 0; i < hwtnl->cmd.vdecl_count; i++) { + /* Given rangeHint is considered to be relative to indexBias, and + * indexBias varies per primitive, we cannot accurately supply an + * rangeHint when emitting more than one primitive per draw command. + */ + if (hwtnl->cmd.prim_count == 1) { + vdecl[i].rangeHint.first = hwtnl->cmd.min_index[0]; + vdecl[i].rangeHint.last = hwtnl->cmd.max_index[0] + 1; + } + else { + vdecl[i].rangeHint.first = 0; + vdecl[i].rangeHint.last = 0; + } + + swc->surface_relocation(swc, + &vdecl[i].array.surfaceId, + vb_handle[i], + PIPE_BUFFER_USAGE_GPU_READ); + } + + memcpy( prim, + hwtnl->cmd.prim, + hwtnl->cmd.prim_count * sizeof hwtnl->cmd.prim[0]); + + for (i = 0; i < hwtnl->cmd.prim_count; i++) { + swc->surface_relocation(swc, + &prim[i].indexArray.surfaceId, + ib_handle[i], + PIPE_BUFFER_USAGE_GPU_READ); + pipe_buffer_reference(&hwtnl->cmd.prim_ib[i], NULL); + } + + SVGA_FIFOCommitAll( swc ); + hwtnl->cmd.prim_count = 0; + } + + return PIPE_OK; +} + + + + + +/*********************************************************************** + * Internal functions: + */ + +enum pipe_error svga_hwtnl_prim( struct svga_hwtnl *hwtnl, + const SVGA3dPrimitiveRange *range, + unsigned min_index, + unsigned max_index, + struct pipe_buffer *ib ) +{ + int ret = PIPE_OK; + +#ifdef DEBUG + { + unsigned i; + for (i = 0; i < hwtnl->cmd.vdecl_count; i++) { + struct pipe_buffer *vb = hwtnl->cmd.vdecl_vb[i]; + unsigned size = vb ? vb->size : 0; + unsigned offset = hwtnl->cmd.vdecl[i].array.offset; + unsigned stride = hwtnl->cmd.vdecl[i].array.stride; + unsigned index_bias = range->indexBias; + unsigned width; + + assert(vb); + assert(size); + assert(offset < size); + assert(index_bias >= 0); + assert(min_index <= max_index); + assert(offset + index_bias*stride < size); + assert(offset + (index_bias + min_index)*stride < size); + + switch (hwtnl->cmd.vdecl[i].identity.type) { + case SVGA3D_DECLTYPE_FLOAT1: + width = 4; + break; + case SVGA3D_DECLTYPE_FLOAT2: + width = 4*2; + break; + case SVGA3D_DECLTYPE_FLOAT3: + width = 4*3; + break; + case SVGA3D_DECLTYPE_FLOAT4: + width = 4*4; + break; + case SVGA3D_DECLTYPE_D3DCOLOR: + width = 4; + break; + case SVGA3D_DECLTYPE_UBYTE4: + width = 1*4; + break; + case SVGA3D_DECLTYPE_SHORT2: + width = 2*2; + break; + case SVGA3D_DECLTYPE_SHORT4: + width = 2*4; + break; + case SVGA3D_DECLTYPE_UBYTE4N: + width = 1*4; + break; + case SVGA3D_DECLTYPE_SHORT2N: + width = 2*2; + break; + case SVGA3D_DECLTYPE_SHORT4N: + width = 2*4; + break; + case SVGA3D_DECLTYPE_USHORT2N: + width = 2*2; + break; + case SVGA3D_DECLTYPE_USHORT4N: + width = 2*4; + break; + case SVGA3D_DECLTYPE_UDEC3: + width = 4; + break; + case SVGA3D_DECLTYPE_DEC3N: + width = 4; + break; + case SVGA3D_DECLTYPE_FLOAT16_2: + width = 2*2; + break; + case SVGA3D_DECLTYPE_FLOAT16_4: + width = 2*4; + break; + default: + assert(0); + width = 0; + break; + } + + assert(!stride || width <= stride); + assert(offset + (index_bias + max_index)*stride + width <= size); + } + + assert(range->indexWidth == range->indexArray.stride); + + if(ib) { + unsigned size = ib->size; + unsigned offset = range->indexArray.offset; + unsigned stride = range->indexArray.stride; + unsigned count; + + assert(size); + assert(offset < size); + assert(stride); + + switch (range->primType) { + case SVGA3D_PRIMITIVE_POINTLIST: + count = range->primitiveCount; + break; + case SVGA3D_PRIMITIVE_LINELIST: + count = range->primitiveCount * 2; + break; + case SVGA3D_PRIMITIVE_LINESTRIP: + count = range->primitiveCount + 1; + break; + case SVGA3D_PRIMITIVE_TRIANGLELIST: + count = range->primitiveCount * 3; + break; + case SVGA3D_PRIMITIVE_TRIANGLESTRIP: + count = range->primitiveCount + 2; + break; + case SVGA3D_PRIMITIVE_TRIANGLEFAN: + count = range->primitiveCount + 2; + break; + default: + assert(0); + count = 0; + break; + } + + assert(offset + count*stride <= size); + } + } +#endif + + if (hwtnl->cmd.prim_count+1 >= QSZ) { + ret = svga_hwtnl_flush( hwtnl ); + if (ret != PIPE_OK) + return ret; + } + + /* min/max indices are relative to bias */ + hwtnl->cmd.min_index[hwtnl->cmd.prim_count] = min_index; + hwtnl->cmd.max_index[hwtnl->cmd.prim_count] = max_index; + + hwtnl->cmd.prim[hwtnl->cmd.prim_count] = *range; + + pipe_buffer_reference(&hwtnl->cmd.prim_ib[hwtnl->cmd.prim_count], ib); + hwtnl->cmd.prim_count++; + + return ret; +} diff --git a/src/gallium/drivers/svga/svga_draw.h b/src/gallium/drivers/svga/svga_draw.h new file mode 100644 index 0000000000..14553b17b5 --- /dev/null +++ b/src/gallium/drivers/svga/svga_draw.h @@ -0,0 +1,83 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#ifndef SVGA_DRAW_H +#define SVGA_DRAW_H + +#include "pipe/p_compiler.h" + +#include "svga_hw_reg.h" + +struct svga_hwtnl; +struct svga_winsys_context; +struct svga_screen; +struct svga_context; +struct pipe_buffer; +struct u_upload_mgr; + +struct svga_hwtnl *svga_hwtnl_create( struct svga_context *svga, + struct u_upload_mgr *upload_ib, + struct svga_winsys_context *swc ); + +void svga_hwtnl_destroy( struct svga_hwtnl *hwtnl ); + +void svga_hwtnl_set_flatshade( struct svga_hwtnl *hwtnl, + boolean flatshade, + boolean flatshade_first ); + +void svga_hwtnl_set_unfilled( struct svga_hwtnl *hwtnl, + unsigned mode ); + +void svga_hwtnl_vdecl( struct svga_hwtnl *hwtnl, + unsigned i, + const SVGA3dVertexDecl *decl, + struct pipe_buffer *vb); + +void svga_hwtnl_reset_vdecl( struct svga_hwtnl *hwtnl, + unsigned count ); + + +enum pipe_error +svga_hwtnl_draw_arrays( struct svga_hwtnl *hwtnl, + unsigned prim, + unsigned start, + unsigned count); + +enum pipe_error +svga_hwtnl_draw_range_elements( struct svga_hwtnl *hwtnl, + struct pipe_buffer *indexBuffer, + unsigned index_size, + unsigned min_index, + unsigned max_index, + unsigned prim, + unsigned start, + unsigned count, + unsigned bias ); + +enum pipe_error +svga_hwtnl_flush( struct svga_hwtnl *hwtnl ); + + +#endif /* SVGA_DRAW_H_ */ diff --git a/src/gallium/drivers/svga/svga_draw_arrays.c b/src/gallium/drivers/svga/svga_draw_arrays.c new file mode 100644 index 0000000000..75492dffca --- /dev/null +++ b/src/gallium/drivers/svga/svga_draw_arrays.c @@ -0,0 +1,297 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "svga_cmd.h" + +#include "pipe/p_inlines.h" +#include "util/u_prim.h" +#include "indices/u_indices.h" + +#include "svga_hw_reg.h" +#include "svga_draw.h" +#include "svga_draw_private.h" +#include "svga_context.h" + + +#define DBG 0 + + + + +static enum pipe_error generate_indices( struct svga_hwtnl *hwtnl, + unsigned nr, + unsigned index_size, + u_generate_func generate, + struct pipe_buffer **out_buf ) +{ + struct pipe_screen *screen = hwtnl->svga->pipe.screen; + unsigned size = index_size * nr; + struct pipe_buffer *dst = NULL; + void *dst_map = NULL; + + dst = screen->buffer_create( screen, 32, + PIPE_BUFFER_USAGE_INDEX | + PIPE_BUFFER_USAGE_CPU_WRITE | + PIPE_BUFFER_USAGE_GPU_READ, + size ); + if (dst == NULL) + goto fail; + + dst_map = pipe_buffer_map( screen, dst, PIPE_BUFFER_USAGE_CPU_WRITE ); + if (dst_map == NULL) + goto fail; + + generate( nr, + dst_map ); + + pipe_buffer_unmap( screen, dst ); + + *out_buf = dst; + return PIPE_OK; + +fail: + if (dst_map) + screen->buffer_unmap( screen, dst ); + + if (dst) + screen->buffer_destroy( dst ); + + return PIPE_ERROR_OUT_OF_MEMORY; +} + +static boolean compare( unsigned cached_nr, + unsigned nr, + unsigned type ) +{ + if (type == U_GENERATE_REUSABLE) + return cached_nr >= nr; + else + return cached_nr == nr; +} + +static enum pipe_error retrieve_or_generate_indices( struct svga_hwtnl *hwtnl, + unsigned prim, + unsigned gen_type, + unsigned gen_nr, + unsigned gen_size, + u_generate_func generate, + struct pipe_buffer **out_buf ) +{ + enum pipe_error ret = PIPE_OK; + int i; + + for (i = 0; i < IDX_CACHE_MAX; i++) { + if (hwtnl->index_cache[prim][i].buffer != NULL && + hwtnl->index_cache[prim][i].generate == generate) + { + if (compare(hwtnl->index_cache[prim][i].gen_nr, gen_nr, gen_type)) + { + pipe_buffer_reference( out_buf, + hwtnl->index_cache[prim][i].buffer ); + + if (DBG) + debug_printf("%s retrieve %d/%d\n", __FUNCTION__, i, gen_nr); + + return PIPE_OK; + } + else if (gen_type == U_GENERATE_REUSABLE) + { + pipe_buffer_reference( &hwtnl->index_cache[prim][i].buffer, + NULL ); + + if (DBG) + debug_printf("%s discard %d/%d\n", __FUNCTION__, + i, hwtnl->index_cache[prim][i].gen_nr); + + break; + } + } + } + + if (i == IDX_CACHE_MAX) + { + unsigned smallest = 0; + unsigned smallest_size = ~0; + + for (i = 0; i < IDX_CACHE_MAX && smallest_size; i++) { + if (hwtnl->index_cache[prim][i].buffer == NULL) + { + smallest = i; + smallest_size = 0; + } + else if (hwtnl->index_cache[prim][i].gen_nr < smallest) + { + smallest = i; + smallest_size = hwtnl->index_cache[prim][i].gen_nr; + } + } + + assert (smallest != IDX_CACHE_MAX); + + pipe_buffer_reference( &hwtnl->index_cache[prim][smallest].buffer, + NULL ); + + if (DBG) + debug_printf("%s discard smallest %d/%d\n", __FUNCTION__, + smallest, smallest_size); + + i = smallest; + } + + + ret = generate_indices( hwtnl, + gen_nr, + gen_size, + generate, + out_buf ); + if (ret != PIPE_OK) + return ret; + + + hwtnl->index_cache[prim][i].generate = generate; + hwtnl->index_cache[prim][i].gen_nr = gen_nr; + pipe_buffer_reference( &hwtnl->index_cache[prim][i].buffer, + *out_buf ); + + if (DBG) + debug_printf("%s cache %d/%d\n", __FUNCTION__, + i, hwtnl->index_cache[prim][i].gen_nr); + + return PIPE_OK; +} + + + +static enum pipe_error +simple_draw_arrays( struct svga_hwtnl *hwtnl, + unsigned prim, unsigned start, unsigned count ) +{ + SVGA3dPrimitiveRange range; + unsigned hw_prim; + unsigned hw_count; + + hw_prim = svga_translate_prim(prim, count, &hw_count); + if (hw_count == 0) + return PIPE_ERROR_BAD_INPUT; + + range.primType = hw_prim; + range.primitiveCount = hw_count; + range.indexArray.surfaceId = SVGA3D_INVALID_ID; + range.indexArray.offset = 0; + range.indexArray.stride = 0; + range.indexWidth = 0; + range.indexBias = start; + + /* Min/max index should be calculated prior to applying bias, so we + * end up with min_index = 0, max_index = count - 1 and everybody + * looking at those numbers knows to adjust them by + * range.indexBias. + */ + return svga_hwtnl_prim( hwtnl, &range, 0, count - 1, NULL ); +} + + + + + + + + + + +enum pipe_error +svga_hwtnl_draw_arrays( struct svga_hwtnl *hwtnl, + unsigned prim, + unsigned start, + unsigned count) +{ + unsigned gen_prim, gen_size, gen_nr, gen_type; + u_generate_func gen_func; + enum pipe_error ret = PIPE_OK; + + if (hwtnl->api_fillmode != PIPE_POLYGON_MODE_FILL && + prim >= PIPE_PRIM_TRIANGLES) + { + gen_type = u_unfilled_generator( prim, + start, + count, + hwtnl->api_fillmode, + &gen_prim, + &gen_size, + &gen_nr, + &gen_func ); + } + else { + gen_type = u_index_generator( svga_hw_prims, + prim, + start, + count, + hwtnl->api_pv, + hwtnl->hw_pv, + &gen_prim, + &gen_size, + &gen_nr, + &gen_func ); + } + + if (gen_type == U_GENERATE_LINEAR) { + return simple_draw_arrays( hwtnl, gen_prim, start, count ); + } + else { + struct pipe_buffer *gen_buf = NULL; + + /* Need to draw as indexed primitive. + * Potentially need to run the gen func to build an index buffer. + */ + ret = retrieve_or_generate_indices( hwtnl, + prim, + gen_type, + gen_nr, + gen_size, + gen_func, + &gen_buf ); + if (ret) + goto done; + + ret = svga_hwtnl_simple_draw_range_elements( hwtnl, + gen_buf, + gen_size, + 0, + count - 1, + gen_prim, + 0, + gen_nr, + start ); + if (ret) + goto done; + + done: + if (gen_buf) + pipe_buffer_reference( &gen_buf, NULL ); + + return ret; + } +} + diff --git a/src/gallium/drivers/svga/svga_draw_elements.c b/src/gallium/drivers/svga/svga_draw_elements.c new file mode 100644 index 0000000000..167d817831 --- /dev/null +++ b/src/gallium/drivers/svga/svga_draw_elements.c @@ -0,0 +1,255 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "pipe/p_inlines.h" +#include "util/u_prim.h" +#include "util/u_upload_mgr.h" +#include "indices/u_indices.h" + +#include "svga_cmd.h" +#include "svga_draw.h" +#include "svga_draw_private.h" +#include "svga_screen_buffer.h" +#include "svga_winsys.h" +#include "svga_context.h" + +#include "svga_hw_reg.h" + + +static enum pipe_error +translate_indices( struct svga_hwtnl *hwtnl, + struct pipe_buffer *src, + unsigned offset, + unsigned nr, + unsigned index_size, + u_translate_func translate, + struct pipe_buffer **out_buf ) +{ + struct pipe_screen *screen = hwtnl->svga->pipe.screen; + unsigned size = index_size * nr; + const void *src_map = NULL; + struct pipe_buffer *dst = NULL; + void *dst_map = NULL; + + dst = screen->buffer_create( screen, 32, + PIPE_BUFFER_USAGE_INDEX | + PIPE_BUFFER_USAGE_CPU_WRITE | + PIPE_BUFFER_USAGE_GPU_READ, + size ); + if (dst == NULL) + goto fail; + + src_map = pipe_buffer_map( screen, src, PIPE_BUFFER_USAGE_CPU_READ ); + if (src_map == NULL) + goto fail; + + dst_map = pipe_buffer_map( screen, dst, PIPE_BUFFER_USAGE_CPU_WRITE ); + if (dst_map == NULL) + goto fail; + + translate( (const char *)src_map + offset, + nr, + dst_map ); + + pipe_buffer_unmap( screen, src ); + pipe_buffer_unmap( screen, dst ); + + *out_buf = dst; + return PIPE_OK; + +fail: + if (src_map) + screen->buffer_unmap( screen, src ); + + if (dst_map) + screen->buffer_unmap( screen, dst ); + + if (dst) + screen->buffer_destroy( dst ); + + return PIPE_ERROR_OUT_OF_MEMORY; +} + + + + + +enum pipe_error +svga_hwtnl_simple_draw_range_elements( struct svga_hwtnl *hwtnl, + struct pipe_buffer *index_buffer, + unsigned index_size, + unsigned min_index, + unsigned max_index, + unsigned prim, + unsigned start, + unsigned count, + unsigned bias ) +{ + struct pipe_buffer *upload_buffer = NULL; + SVGA3dPrimitiveRange range; + unsigned hw_prim; + unsigned hw_count; + unsigned index_offset = start * index_size; + int ret = PIPE_OK; + + hw_prim = svga_translate_prim(prim, count, &hw_count); + if (hw_count == 0) + goto done; + + if (index_buffer && + svga_buffer_is_user_buffer(index_buffer)) + { + assert( index_buffer->size >= index_offset + count * index_size ); + + ret = u_upload_buffer( hwtnl->upload_ib, + index_offset, + count * index_size, + index_buffer, + &index_offset, + &upload_buffer ); + if (ret) + goto done; + + /* Don't need to worry about refcounting index_buffer as this is + * just a stack variable without a counted reference of its own. + * The caller holds the reference. + */ + index_buffer = upload_buffer; + } + + range.primType = hw_prim; + range.primitiveCount = hw_count; + range.indexArray.offset = index_offset; + range.indexArray.stride = index_size; + range.indexWidth = index_size; + range.indexBias = bias; + + ret = svga_hwtnl_prim( hwtnl, &range, min_index, max_index, index_buffer ); + if (ret) + goto done; + +done: + if (upload_buffer) + pipe_buffer_reference( &upload_buffer, NULL ); + + return ret; +} + + + + +enum pipe_error +svga_hwtnl_draw_range_elements( struct svga_hwtnl *hwtnl, + struct pipe_buffer *index_buffer, + unsigned index_size, + unsigned min_index, + unsigned max_index, + unsigned prim, unsigned start, unsigned count, + unsigned bias) +{ + unsigned gen_prim, gen_size, gen_nr, gen_type; + u_translate_func gen_func; + enum pipe_error ret = PIPE_OK; + + if (hwtnl->api_fillmode != PIPE_POLYGON_MODE_FILL && + prim >= PIPE_PRIM_TRIANGLES) + { + gen_type = u_unfilled_translator( prim, + index_size, + count, + hwtnl->api_fillmode, + &gen_prim, + &gen_size, + &gen_nr, + &gen_func ); + } + else + { + gen_type = u_index_translator( svga_hw_prims, + prim, + index_size, + count, + hwtnl->api_pv, + hwtnl->hw_pv, + &gen_prim, + &gen_size, + &gen_nr, + &gen_func ); + } + + + if (gen_type == U_TRANSLATE_MEMCPY) { + /* No need for translation, just pass through to hardware: + */ + return svga_hwtnl_simple_draw_range_elements( hwtnl, index_buffer, + index_size, + min_index, + max_index, + gen_prim, start, count, bias ); + } + else { + struct pipe_buffer *gen_buf = NULL; + + /* Need to allocate a new index buffer and run the translate + * func to populate it. Could potentially cache this translated + * index buffer with the original to avoid future + * re-translations. Not much point if we're just accelerating + * GL though, as index buffers are typically used only once + * there. + */ + ret = translate_indices( hwtnl, + index_buffer, + start * index_size, + gen_nr, + gen_size, + gen_func, + &gen_buf ); + if (ret) + goto done; + + ret = svga_hwtnl_simple_draw_range_elements( hwtnl, + gen_buf, + gen_size, + min_index, + max_index, + gen_prim, + 0, + gen_nr, + bias ); + if (ret) + goto done; + + done: + if (gen_buf) + pipe_buffer_reference( &gen_buf, NULL ); + + return ret; + } +} + + + + + diff --git a/src/gallium/drivers/svga/svga_draw_private.h b/src/gallium/drivers/svga/svga_draw_private.h new file mode 100644 index 0000000000..9aa40e1664 --- /dev/null +++ b/src/gallium/drivers/svga/svga_draw_private.h @@ -0,0 +1,158 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#ifndef SVGA_DRAW_H_ +#define SVGA_DRAW_H_ + +#include "pipe/p_compiler.h" +#include "pipe/p_defines.h" +#include "indices/u_indices.h" +#include "svga_hw_reg.h" +#include "svga3d_shaderdefs.h" + +struct svga_context; +struct u_upload_mgr; + +/* Should include polygon? + */ +static const unsigned svga_hw_prims = + ((1 << PIPE_PRIM_POINTS) | + (1 << PIPE_PRIM_LINES) | + (1 << PIPE_PRIM_LINE_STRIP) | + (1 << PIPE_PRIM_TRIANGLES) | + (1 << PIPE_PRIM_TRIANGLE_STRIP) | + (1 << PIPE_PRIM_TRIANGLE_FAN)); + + +static INLINE unsigned svga_translate_prim(unsigned mode, + unsigned count, + unsigned *out_count) +{ + switch (mode) { + case PIPE_PRIM_POINTS: + *out_count = count; + return SVGA3D_PRIMITIVE_POINTLIST; + + case PIPE_PRIM_LINES: + *out_count = count / 2; + return SVGA3D_PRIMITIVE_LINELIST; + + case PIPE_PRIM_LINE_STRIP: + *out_count = count - 1; + return SVGA3D_PRIMITIVE_LINESTRIP; + + case PIPE_PRIM_TRIANGLES: + *out_count = count / 3; + return SVGA3D_PRIMITIVE_TRIANGLELIST; + + case PIPE_PRIM_TRIANGLE_STRIP: + *out_count = count - 2; + return SVGA3D_PRIMITIVE_TRIANGLESTRIP; + + case PIPE_PRIM_TRIANGLE_FAN: + *out_count = count - 2; + return SVGA3D_PRIMITIVE_TRIANGLEFAN; + + default: + assert(0); + *out_count = 0; + return 0; + } +} + + +struct index_cache { + u_generate_func generate; + unsigned gen_nr; + + /* If non-null, this buffer is filled by calling + * generate(nr, map(buffer)) + */ + struct pipe_buffer *buffer; +}; + +#define QSZ 32 + +struct draw_cmd { + struct svga_winsys_context *swc; + + SVGA3dVertexDecl vdecl[SVGA3D_INPUTREG_MAX]; + struct pipe_buffer *vdecl_vb[SVGA3D_INPUTREG_MAX]; + unsigned vdecl_count; + + SVGA3dPrimitiveRange prim[QSZ]; + struct pipe_buffer *prim_ib[QSZ]; + unsigned prim_count; + unsigned min_index[QSZ]; + unsigned max_index[QSZ]; +}; + +#define IDX_CACHE_MAX 8 + +struct svga_hwtnl { + struct svga_context *svga; + struct u_upload_mgr *upload_ib; + + /* Flatshade information: + */ + unsigned api_pv; + unsigned hw_pv; + unsigned api_fillmode; + + /* Cache the results of running a particular generate func on each + * primitive type. + */ + struct index_cache index_cache[PIPE_PRIM_MAX][IDX_CACHE_MAX]; + + /* Try to build the maximal draw command packet before emitting: + */ + struct draw_cmd cmd; +}; + + + +/*********************************************************************** + * Internal functions + */ +enum pipe_error +svga_hwtnl_prim( struct svga_hwtnl *hwtnl, + const SVGA3dPrimitiveRange *range, + unsigned min_index, + unsigned max_index, + struct pipe_buffer *ib ); + +enum pipe_error +svga_hwtnl_simple_draw_range_elements( struct svga_hwtnl *hwtnl, + struct pipe_buffer *indexBuffer, + unsigned index_size, + unsigned min_index, + unsigned max_index, + unsigned prim, + unsigned start, + unsigned count, + unsigned bias ); + + +#endif diff --git a/src/gallium/drivers/svga/svga_hw_reg.h b/src/gallium/drivers/svga/svga_hw_reg.h new file mode 100644 index 0000000000..183f4b918e --- /dev/null +++ b/src/gallium/drivers/svga/svga_hw_reg.h @@ -0,0 +1,42 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#ifndef SVGA_HW_REG_H +#define SVGA_HW_REG_H + +#include "pipe/p_compiler.h" + +#if defined(PIPE_CC_GCC) +#ifndef HAVE_STDINT_H +#define HAVE_STDINT_H +#endif +#endif + +#include "svga_types.h" + +#include "svga3d_reg.h" + + +#endif diff --git a/src/gallium/drivers/svga/svga_pipe_blend.c b/src/gallium/drivers/svga/svga_pipe_blend.c new file mode 100644 index 0000000000..855d228755 --- /dev/null +++ b/src/gallium/drivers/svga/svga_pipe_blend.c @@ -0,0 +1,246 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "pipe/p_inlines.h" +#include "pipe/p_defines.h" +#include "util/u_math.h" +#include "util/u_memory.h" + +#include "svga_context.h" +#include "svga_state.h" + +#include "svga_hw_reg.h" + + +static INLINE unsigned +svga_translate_blend_factor(unsigned factor) +{ + switch (factor) { + case PIPE_BLENDFACTOR_ZERO: return SVGA3D_BLENDOP_ZERO; + case PIPE_BLENDFACTOR_SRC_ALPHA: return SVGA3D_BLENDOP_SRCALPHA; + case PIPE_BLENDFACTOR_ONE: return SVGA3D_BLENDOP_ONE; + case PIPE_BLENDFACTOR_SRC_COLOR: return SVGA3D_BLENDOP_SRCCOLOR; + case PIPE_BLENDFACTOR_INV_SRC_COLOR: return SVGA3D_BLENDOP_INVSRCCOLOR; + case PIPE_BLENDFACTOR_DST_COLOR: return SVGA3D_BLENDOP_DESTCOLOR; + case PIPE_BLENDFACTOR_INV_DST_COLOR: return SVGA3D_BLENDOP_INVDESTCOLOR; + case PIPE_BLENDFACTOR_INV_SRC_ALPHA: return SVGA3D_BLENDOP_INVSRCALPHA; + case PIPE_BLENDFACTOR_DST_ALPHA: return SVGA3D_BLENDOP_DESTALPHA; + case PIPE_BLENDFACTOR_INV_DST_ALPHA: return SVGA3D_BLENDOP_INVDESTALPHA; + case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE: return SVGA3D_BLENDOP_SRCALPHASAT; + case PIPE_BLENDFACTOR_CONST_COLOR: return SVGA3D_BLENDOP_BLENDFACTOR; + case PIPE_BLENDFACTOR_INV_CONST_COLOR: return SVGA3D_BLENDOP_INVBLENDFACTOR; + case PIPE_BLENDFACTOR_CONST_ALPHA: return SVGA3D_BLENDOP_BLENDFACTOR; /* ? */ + case PIPE_BLENDFACTOR_INV_CONST_ALPHA: return SVGA3D_BLENDOP_INVBLENDFACTOR; /* ? */ + default: + assert(0); + return SVGA3D_BLENDOP_ZERO; + } +} + +static INLINE unsigned +svga_translate_blend_func(unsigned mode) +{ + switch (mode) { + case PIPE_BLEND_ADD: return SVGA3D_BLENDEQ_ADD; + case PIPE_BLEND_SUBTRACT: return SVGA3D_BLENDEQ_SUBTRACT; + case PIPE_BLEND_REVERSE_SUBTRACT: return SVGA3D_BLENDEQ_REVSUBTRACT; + case PIPE_BLEND_MIN: return SVGA3D_BLENDEQ_MINIMUM; + case PIPE_BLEND_MAX: return SVGA3D_BLENDEQ_MAXIMUM; + default: + assert(0); + return SVGA3D_BLENDEQ_ADD; + } +} + + +static void * +svga_create_blend_state(struct pipe_context *pipe, + const struct pipe_blend_state *templ) +{ + struct svga_blend_state *blend = CALLOC_STRUCT( svga_blend_state ); + unsigned i; + + + /* Fill in the per-rendertarget blend state. We currently only + * have one rendertarget. + */ + for (i = 0; i < 1; i++) { + /* No way to set this in SVGA3D, and no way to correctly implement it on + * top of D3D9 API. Instead we try to simulate with various blend modes. + */ + if (templ->logicop_enable) { + switch (templ->logicop_func) { + case PIPE_LOGICOP_XOR: + blend->need_white_fragments = TRUE; + blend->rt[i].blend_enable = TRUE; + blend->rt[i].srcblend = SVGA3D_BLENDOP_ONE; + blend->rt[i].dstblend = SVGA3D_BLENDOP_ONE; + blend->rt[i].blendeq = SVGA3D_BLENDEQ_SUBTRACT; + break; + case PIPE_LOGICOP_CLEAR: + blend->rt[i].blend_enable = TRUE; + blend->rt[i].srcblend = SVGA3D_BLENDOP_ZERO; + blend->rt[i].dstblend = SVGA3D_BLENDOP_ZERO; + blend->rt[i].blendeq = SVGA3D_BLENDEQ_MINIMUM; + break; + case PIPE_LOGICOP_COPY: + blend->rt[i].blend_enable = FALSE; + break; + case PIPE_LOGICOP_COPY_INVERTED: + blend->rt[i].blend_enable = TRUE; + blend->rt[i].srcblend = SVGA3D_BLENDOP_INVSRCCOLOR; + blend->rt[i].dstblend = SVGA3D_BLENDOP_ZERO; + blend->rt[i].blendeq = SVGA3D_BLENDEQ_ADD; + break; + case PIPE_LOGICOP_NOOP: + blend->rt[i].blend_enable = TRUE; + blend->rt[i].srcblend = SVGA3D_BLENDOP_ZERO; + blend->rt[i].dstblend = SVGA3D_BLENDOP_DESTCOLOR; + blend->rt[i].blendeq = SVGA3D_BLENDEQ_ADD; + break; + case PIPE_LOGICOP_SET: + blend->rt[i].blend_enable = TRUE; + blend->rt[i].srcblend = SVGA3D_BLENDOP_ONE; + blend->rt[i].dstblend = SVGA3D_BLENDOP_ONE; + blend->rt[i].blendeq = SVGA3D_BLENDEQ_MAXIMUM; + break; + case PIPE_LOGICOP_INVERT: + blend->rt[i].blend_enable = TRUE; + blend->rt[i].srcblend = SVGA3D_BLENDOP_INVSRCCOLOR; + blend->rt[i].dstblend = SVGA3D_BLENDOP_ZERO; + blend->rt[i].blendeq = SVGA3D_BLENDEQ_ADD; + break; + case PIPE_LOGICOP_AND: + /* Approximate with minimum - works for the 0 & anything case: */ + blend->rt[i].blend_enable = TRUE; + blend->rt[i].srcblend = SVGA3D_BLENDOP_SRCCOLOR; + blend->rt[i].dstblend = SVGA3D_BLENDOP_DESTCOLOR; + blend->rt[i].blendeq = SVGA3D_BLENDEQ_MINIMUM; + break; + case PIPE_LOGICOP_AND_REVERSE: + blend->rt[i].blend_enable = TRUE; + blend->rt[i].srcblend = SVGA3D_BLENDOP_SRCCOLOR; + blend->rt[i].dstblend = SVGA3D_BLENDOP_INVDESTCOLOR; + blend->rt[i].blendeq = SVGA3D_BLENDEQ_MINIMUM; + break; + case PIPE_LOGICOP_AND_INVERTED: + blend->rt[i].blend_enable = TRUE; + blend->rt[i].srcblend = SVGA3D_BLENDOP_INVSRCCOLOR; + blend->rt[i].dstblend = SVGA3D_BLENDOP_DESTCOLOR; + blend->rt[i].blendeq = SVGA3D_BLENDEQ_MINIMUM; + break; + case PIPE_LOGICOP_OR: + /* Approximate with maximum - works for the 1 | anything case: */ + blend->rt[i].blend_enable = TRUE; + blend->rt[i].srcblend = SVGA3D_BLENDOP_SRCCOLOR; + blend->rt[i].dstblend = SVGA3D_BLENDOP_DESTCOLOR; + blend->rt[i].blendeq = SVGA3D_BLENDEQ_MAXIMUM; + break; + case PIPE_LOGICOP_OR_REVERSE: + blend->rt[i].blend_enable = TRUE; + blend->rt[i].srcblend = SVGA3D_BLENDOP_SRCCOLOR; + blend->rt[i].dstblend = SVGA3D_BLENDOP_INVDESTCOLOR; + blend->rt[i].blendeq = SVGA3D_BLENDEQ_MAXIMUM; + break; + case PIPE_LOGICOP_OR_INVERTED: + blend->rt[i].blend_enable = TRUE; + blend->rt[i].srcblend = SVGA3D_BLENDOP_INVSRCCOLOR; + blend->rt[i].dstblend = SVGA3D_BLENDOP_DESTCOLOR; + blend->rt[i].blendeq = SVGA3D_BLENDEQ_MAXIMUM; + break; + case PIPE_LOGICOP_NAND: + case PIPE_LOGICOP_NOR: + case PIPE_LOGICOP_EQUIV: + /* Fill these in with plausible values */ + blend->rt[i].blend_enable = FALSE; + break; + default: + assert(0); + break; + } + } + else { + blend->rt[i].blend_enable = templ->blend_enable; + + if (templ->blend_enable) { + blend->rt[i].srcblend = svga_translate_blend_factor(templ->rgb_src_factor); + blend->rt[i].dstblend = svga_translate_blend_factor(templ->rgb_dst_factor); + blend->rt[i].blendeq = svga_translate_blend_func(templ->rgb_func); + blend->rt[i].srcblend_alpha = svga_translate_blend_factor(templ->alpha_src_factor); + blend->rt[i].dstblend_alpha = svga_translate_blend_factor(templ->alpha_dst_factor); + blend->rt[i].blendeq_alpha = svga_translate_blend_func(templ->alpha_func); + + if (blend->rt[i].srcblend_alpha != blend->rt[i].srcblend || + blend->rt[i].dstblend_alpha != blend->rt[i].dstblend || + blend->rt[i].blendeq_alpha != blend->rt[i].blendeq) + { + blend->rt[i].separate_alpha_blend_enable = TRUE; + } + } + } + + blend->rt[i].writemask = templ->colormask; + } + + return blend; +} + +static void svga_bind_blend_state(struct pipe_context *pipe, + void *blend) +{ + struct svga_context *svga = svga_context(pipe); + + svga->curr.blend = (struct svga_blend_state*)blend; + svga->dirty |= SVGA_NEW_BLEND; +} + + +static void svga_delete_blend_state(struct pipe_context *pipe, void *blend) +{ + FREE(blend); +} + +static void svga_set_blend_color( struct pipe_context *pipe, + const struct pipe_blend_color *blend_color ) +{ + struct svga_context *svga = svga_context(pipe); + + svga->curr.blend_color = *blend_color; + + svga->dirty |= SVGA_NEW_BLEND; +} + + +void svga_init_blend_functions( struct svga_context *svga ) +{ + svga->pipe.create_blend_state = svga_create_blend_state; + svga->pipe.bind_blend_state = svga_bind_blend_state; + svga->pipe.delete_blend_state = svga_delete_blend_state; + + svga->pipe.set_blend_color = svga_set_blend_color; +} + + + diff --git a/src/gallium/drivers/svga/svga_pipe_blit.c b/src/gallium/drivers/svga/svga_pipe_blit.c new file mode 100644 index 0000000000..5a4a8c0f5f --- /dev/null +++ b/src/gallium/drivers/svga/svga_pipe_blit.c @@ -0,0 +1,84 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "svga_screen_texture.h" +#include "svga_context.h" +#include "svga_cmd.h" + +#define FILE_DEBUG_FLAG DEBUG_BLIT + + +static void svga_surface_copy(struct pipe_context *pipe, + struct pipe_surface *dest, + unsigned destx, unsigned desty, + struct pipe_surface *src, + unsigned srcx, unsigned srcy, + unsigned width, unsigned height) +{ + struct svga_context *svga = svga_context(pipe); + SVGA3dCopyBox *box; + enum pipe_error ret; + + svga_hwtnl_flush_retry( svga ); + + ret = SVGA3D_BeginSurfaceCopy(svga->swc, + src, + dest, + &box, + 1); + if(ret != PIPE_OK) { + + svga_context_flush(svga, NULL); + + ret = SVGA3D_BeginSurfaceCopy(svga->swc, + src, + dest, + &box, + 1); + assert(ret == PIPE_OK); + } + + box->x = destx; + box->y = desty; + box->z = 0; + box->w = width; + box->h = height; + box->d = 1; + box->srcx = srcx; + box->srcy = srcy; + box->srcz = 0; + + SVGA_FIFOCommitAll(svga->swc); + + svga_surface(dest)->dirty = TRUE; + svga_propagate_surface(pipe, dest); +} + + +void +svga_init_blit_functions(struct svga_context *svga) +{ + svga->pipe.surface_copy = svga_surface_copy; +} diff --git a/src/gallium/drivers/svga/svga_pipe_clear.c b/src/gallium/drivers/svga/svga_pipe_clear.c new file mode 100644 index 0000000000..8977d26541 --- /dev/null +++ b/src/gallium/drivers/svga/svga_pipe_clear.c @@ -0,0 +1,119 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "svga_cmd.h" + +#include "pipe/p_defines.h" +#include "util/u_pack_color.h" + +#include "svga_context.h" +#include "svga_state.h" + + +static enum pipe_error +try_clear(struct svga_context *svga, + unsigned buffers, + const float *rgba, + double depth, + unsigned stencil) +{ + int ret = PIPE_OK; + SVGA3dRect rect = { 0, 0, 0, 0 }; + boolean restore_viewport = FALSE; + SVGA3dClearFlag flags = 0; + struct pipe_framebuffer_state *fb = &svga->curr.framebuffer; + unsigned color = 0; + + ret = svga_update_state(svga, SVGA_STATE_HW_CLEAR); + if (ret) + return ret; + + if ((buffers & PIPE_CLEAR_COLOR) && fb->cbufs[0]) { + flags |= SVGA3D_CLEAR_COLOR; + util_pack_color(rgba, PIPE_FORMAT_A8R8G8B8_UNORM, &color); + + rect.w = fb->cbufs[0]->width; + rect.h = fb->cbufs[0]->height; + } + + if ((buffers & PIPE_CLEAR_DEPTHSTENCIL) && fb->zsbuf) { + flags |= SVGA3D_CLEAR_DEPTH; + + if (svga->curr.framebuffer.zsbuf->format == PIPE_FORMAT_Z24S8_UNORM) + flags |= SVGA3D_CLEAR_STENCIL; + + rect.w = MAX2(rect.w, fb->zsbuf->width); + rect.h = MAX2(rect.h, fb->zsbuf->height); + } + + if (memcmp(&rect, &svga->state.hw_clear.viewport, sizeof(rect)) != 0) { + restore_viewport = TRUE; + ret = SVGA3D_SetViewport(svga->swc, &rect); + if (ret) + return ret; + } + + ret = SVGA3D_ClearRect(svga->swc, flags, color, depth, stencil, + rect.x, rect.y, rect.w, rect.h); + if (ret != PIPE_OK) + return ret; + + if (restore_viewport) { + memcpy(&rect, &svga->state.hw_clear.viewport, sizeof rect); + ret = SVGA3D_SetViewport(svga->swc, &rect); + } + + return ret; +} + +/** + * Clear the given surface to the specified value. + * No masking, no scissor (clear entire buffer). + */ +void +svga_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, + double depth, unsigned stencil) +{ + struct svga_context *svga = svga_context( pipe ); + int ret; + + ret = try_clear( svga, buffers, rgba, depth, stencil ); + + if (ret == PIPE_ERROR_OUT_OF_MEMORY) { + /* Flush command buffer and retry: + */ + svga_context_flush( svga, NULL ); + + ret = try_clear( svga, buffers, rgba, depth, stencil ); + } + + /* + * Mark target surfaces as dirty + * TODO Mark only cleared surfaces. + */ + svga_mark_surfaces_dirty(svga); + + assert (ret == PIPE_OK); +} diff --git a/src/gallium/drivers/svga/svga_pipe_constants.c b/src/gallium/drivers/svga/svga_pipe_constants.c new file mode 100644 index 0000000000..10e7a12189 --- /dev/null +++ b/src/gallium/drivers/svga/svga_pipe_constants.c @@ -0,0 +1,74 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "pipe/p_inlines.h" +#include "pipe/p_defines.h" +#include "util/u_math.h" +#include "util/u_memory.h" +#include "tgsi/tgsi_parse.h" + +#include "svga_context.h" +#include "svga_state.h" +#include "svga_hw_reg.h" +#include "svga_cmd.h" + +/*********************************************************************** + * Constant buffers + */ + +struct svga_constbuf +{ + unsigned type; + float (*data)[4]; + unsigned count; +}; + + + +static void svga_set_constant_buffer(struct pipe_context *pipe, + uint shader, uint index, + const struct pipe_constant_buffer *buf) +{ + struct svga_context *svga = svga_context(pipe); + + assert(shader < PIPE_SHADER_TYPES); + assert(index == 0); + + pipe_buffer_reference( &svga->curr.cb[shader], + buf->buffer ); + + if (shader == PIPE_SHADER_FRAGMENT) + svga->dirty |= SVGA_NEW_FS_CONST_BUFFER; + else + svga->dirty |= SVGA_NEW_VS_CONST_BUFFER; +} + + + +void svga_init_constbuffer_functions( struct svga_context *svga ) +{ + svga->pipe.set_constant_buffer = svga_set_constant_buffer; +} + diff --git a/src/gallium/drivers/svga/svga_pipe_depthstencil.c b/src/gallium/drivers/svga/svga_pipe_depthstencil.c new file mode 100644 index 0000000000..df636c08a0 --- /dev/null +++ b/src/gallium/drivers/svga/svga_pipe_depthstencil.c @@ -0,0 +1,153 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "pipe/p_inlines.h" +#include "pipe/p_defines.h" +#include "util/u_math.h" +#include "util/u_memory.h" + +#include "svga_context.h" +#include "svga_state.h" +#include "svga_hw_reg.h" + + +static INLINE unsigned +svga_translate_compare_func(unsigned func) +{ + switch (func) { + case PIPE_FUNC_NEVER: return SVGA3D_CMP_NEVER; + case PIPE_FUNC_LESS: return SVGA3D_CMP_LESS; + case PIPE_FUNC_LEQUAL: return SVGA3D_CMP_LESSEQUAL; + case PIPE_FUNC_GREATER: return SVGA3D_CMP_GREATER; + case PIPE_FUNC_GEQUAL: return SVGA3D_CMP_GREATEREQUAL; + case PIPE_FUNC_NOTEQUAL: return SVGA3D_CMP_NOTEQUAL; + case PIPE_FUNC_EQUAL: return SVGA3D_CMP_EQUAL; + case PIPE_FUNC_ALWAYS: return SVGA3D_CMP_ALWAYS; + default: + assert(0); + return SVGA3D_CMP_ALWAYS; + } +} + +static INLINE unsigned +svga_translate_stencil_op(unsigned op) +{ + switch (op) { + case PIPE_STENCIL_OP_KEEP: return SVGA3D_STENCILOP_KEEP; + case PIPE_STENCIL_OP_ZERO: return SVGA3D_STENCILOP_ZERO; + case PIPE_STENCIL_OP_REPLACE: return SVGA3D_STENCILOP_REPLACE; + case PIPE_STENCIL_OP_INCR: return SVGA3D_STENCILOP_INCR; + case PIPE_STENCIL_OP_DECR: return SVGA3D_STENCILOP_DECR; + case PIPE_STENCIL_OP_INCR_WRAP: return SVGA3D_STENCILOP_INCRSAT; /* incorrect? */ + case PIPE_STENCIL_OP_DECR_WRAP: return SVGA3D_STENCILOP_DECRSAT; /* incorrect? */ + case PIPE_STENCIL_OP_INVERT: return SVGA3D_STENCILOP_INVERT; + default: + assert(0); + return SVGA3D_STENCILOP_KEEP; + } +} + + +static void * +svga_create_depth_stencil_state(struct pipe_context *pipe, + const struct pipe_depth_stencil_alpha_state *templ) +{ + struct svga_depth_stencil_state *ds = CALLOC_STRUCT( svga_depth_stencil_state ); + + /* Don't try to figure out CW/CCW correspondence with + * stencil[0]/[1] at this point. Presumably this can change as + * back/front face are modified. + */ + ds->stencil[0].enabled = templ->stencil[0].enabled; + if (ds->stencil[0].enabled) { + ds->stencil[0].func = svga_translate_compare_func(templ->stencil[0].func); + ds->stencil[0].fail = svga_translate_stencil_op(templ->stencil[0].fail_op); + ds->stencil[0].zfail = svga_translate_stencil_op(templ->stencil[0].zfail_op); + ds->stencil[0].pass = svga_translate_stencil_op(templ->stencil[0].zpass_op); + + /* SVGA3D has one ref/mask/writemask triple shared between front & + * back face stencil. We really need two: + */ + ds->stencil_ref = templ->stencil[0].ref_value & 0xff; + ds->stencil_mask = templ->stencil[0].valuemask & 0xff; + ds->stencil_writemask = templ->stencil[0].writemask & 0xff; + } + + + ds->stencil[1].enabled = templ->stencil[1].enabled; + if (templ->stencil[1].enabled) { + ds->stencil[1].func = svga_translate_compare_func(templ->stencil[1].func); + ds->stencil[1].fail = svga_translate_stencil_op(templ->stencil[1].fail_op); + ds->stencil[1].zfail = svga_translate_stencil_op(templ->stencil[1].zfail_op); + ds->stencil[1].pass = svga_translate_stencil_op(templ->stencil[1].zpass_op); + + ds->stencil_ref = templ->stencil[1].ref_value & 0xff; + ds->stencil_mask = templ->stencil[1].valuemask & 0xff; + ds->stencil_writemask = templ->stencil[1].writemask & 0xff; + } + + + ds->zenable = templ->depth.enabled; + if (ds->zenable) { + ds->zfunc = svga_translate_compare_func(templ->depth.func); + ds->zwriteenable = templ->depth.writemask; + } + + ds->alphatestenable = templ->alpha.enabled; + if (ds->alphatestenable) { + ds->alphafunc = svga_translate_compare_func(templ->alpha.func); + ds->alpharef = templ->alpha.ref_value; + } + + return ds; +} + +static void svga_bind_depth_stencil_state(struct pipe_context *pipe, + void *depth_stencil) +{ + struct svga_context *svga = svga_context(pipe); + + svga->curr.depth = (const struct svga_depth_stencil_state *)depth_stencil; + svga->dirty |= SVGA_NEW_DEPTH_STENCIL; +} + +static void svga_delete_depth_stencil_state(struct pipe_context *pipe, + void *depth_stencil) +{ + FREE(depth_stencil); +} + + + +void svga_init_depth_stencil_functions( struct svga_context *svga ) +{ + svga->pipe.create_depth_stencil_alpha_state = svga_create_depth_stencil_state; + svga->pipe.bind_depth_stencil_alpha_state = svga_bind_depth_stencil_state; + svga->pipe.delete_depth_stencil_alpha_state = svga_delete_depth_stencil_state; +} + + + + diff --git a/src/gallium/drivers/svga/svga_pipe_draw.c b/src/gallium/drivers/svga/svga_pipe_draw.c new file mode 100644 index 0000000000..71a552862e --- /dev/null +++ b/src/gallium/drivers/svga/svga_pipe_draw.c @@ -0,0 +1,261 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "svga_cmd.h" + +#include "pipe/p_inlines.h" +#include "util/u_prim.h" +#include "util/u_time.h" +#include "indices/u_indices.h" + +#include "svga_hw_reg.h" +#include "svga_context.h" +#include "svga_screen.h" +#include "svga_winsys.h" +#include "svga_draw.h" +#include "svga_state.h" +#include "svga_swtnl.h" +#include "svga_debug.h" + + + +static enum pipe_error +retry_draw_range_elements( struct svga_context *svga, + struct pipe_buffer *index_buffer, + unsigned index_size, + unsigned min_index, + unsigned max_index, + unsigned prim, + unsigned start, + unsigned count, + boolean do_retry ) +{ + enum pipe_error ret = 0; + + svga_hwtnl_set_unfilled( svga->hwtnl, + svga->curr.rast->hw_unfilled ); + + svga_hwtnl_set_flatshade( svga->hwtnl, + svga->curr.rast->templ.flatshade, + svga->curr.rast->templ.flatshade_first ); + + + ret = svga_update_state( svga, SVGA_STATE_HW_DRAW ); + if (ret) + goto retry; + + ret = svga_hwtnl_draw_range_elements( svga->hwtnl, + index_buffer, index_size, + min_index, max_index, + prim, start, count, 0 ); + if (ret) + goto retry; + + if (svga->curr.any_user_vertex_buffers) { + ret = svga_hwtnl_flush( svga->hwtnl ); + if (ret) + goto retry; + } + + return PIPE_OK; + +retry: + svga_context_flush( svga, NULL ); + + if (do_retry) + { + return retry_draw_range_elements( svga, + index_buffer, index_size, + min_index, max_index, + prim, start, count, + FALSE ); + } + + return ret; +} + + +static enum pipe_error +retry_draw_arrays( struct svga_context *svga, + unsigned prim, + unsigned start, + unsigned count, + boolean do_retry ) +{ + enum pipe_error ret; + + svga_hwtnl_set_unfilled( svga->hwtnl, + svga->curr.rast->hw_unfilled ); + + svga_hwtnl_set_flatshade( svga->hwtnl, + svga->curr.rast->templ.flatshade, + svga->curr.rast->templ.flatshade_first ); + + ret = svga_update_state( svga, SVGA_STATE_HW_DRAW ); + if (ret) + goto retry; + + ret = svga_hwtnl_draw_arrays( svga->hwtnl, prim, + start, count ); + if (ret) + goto retry; + + if (svga->curr.any_user_vertex_buffers) { + ret = svga_hwtnl_flush( svga->hwtnl ); + if (ret) + goto retry; + } + + return 0; + +retry: + if (ret == PIPE_ERROR_OUT_OF_MEMORY && do_retry) + { + svga_context_flush( svga, NULL ); + + return retry_draw_arrays( svga, + prim, + start, + count, + FALSE ); + } + + return ret; +} + + + + + +static boolean +svga_draw_range_elements( struct pipe_context *pipe, + struct pipe_buffer *index_buffer, + unsigned index_size, + unsigned min_index, + unsigned max_index, + unsigned prim, unsigned start, unsigned count) +{ + struct svga_context *svga = svga_context( pipe ); + unsigned reduced_prim = u_reduced_prim(prim); + enum pipe_error ret = 0; + + if (!u_trim_pipe_prim( prim, &count )) + return TRUE; + + /* + * Mark currently bound target surfaces as dirty + * doesn't really matter if it is done before drawing. + * + * TODO If we ever normaly return something other then + * true we should not mark it as dirty then. + */ + svga_mark_surfaces_dirty(svga_context(pipe)); + + if (svga->curr.reduced_prim != reduced_prim) { + svga->curr.reduced_prim = reduced_prim; + svga->dirty |= SVGA_NEW_REDUCED_PRIMITIVE; + } + + svga_update_state_retry( svga, SVGA_STATE_NEED_SWTNL ); + +#ifdef DEBUG + if (svga->curr.vs->base.id == svga->debug.disable_shader || + svga->curr.fs->base.id == svga->debug.disable_shader) + return 0; +#endif + + if (svga->state.sw.need_swtnl) + { + ret = svga_swtnl_draw_range_elements( svga, + index_buffer, + index_size, + min_index, max_index, + prim, + start, count ); + } + else { + if (index_buffer) { + ret = retry_draw_range_elements( svga, + index_buffer, + index_size, + min_index, + max_index, + prim, + start, + count, + TRUE ); + } + else { + ret = retry_draw_arrays( svga, + prim, + start, + count, + TRUE ); + } + } + + if (SVGA_DEBUG & DEBUG_FLUSH) { + static unsigned id; + debug_printf("%s %d\n", __FUNCTION__, id++); + if (id > 1300) + util_time_sleep( 2000 ); + + svga_hwtnl_flush_retry( svga ); + svga_context_flush(svga, NULL); + } + + return ret == PIPE_OK; +} + + +static boolean +svga_draw_elements( struct pipe_context *pipe, + struct pipe_buffer *index_buffer, + unsigned index_size, + unsigned prim, unsigned start, unsigned count) +{ + return svga_draw_range_elements( pipe, index_buffer, + index_size, + 0, 0xffffffff, + prim, start, count ); +} + +static boolean +svga_draw_arrays( struct pipe_context *pipe, + unsigned prim, unsigned start, unsigned count) +{ + return svga_draw_range_elements(pipe, NULL, 0, + start, start + count - 1, + prim, + start, count); +} + + +void svga_init_draw_functions( struct svga_context *svga ) +{ + svga->pipe.draw_arrays = svga_draw_arrays; + svga->pipe.draw_elements = svga_draw_elements; + svga->pipe.draw_range_elements = svga_draw_range_elements; +} diff --git a/src/gallium/drivers/svga/svga_pipe_flush.c b/src/gallium/drivers/svga/svga_pipe_flush.c new file mode 100644 index 0000000000..942366de72 --- /dev/null +++ b/src/gallium/drivers/svga/svga_pipe_flush.c @@ -0,0 +1,68 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "pipe/p_defines.h" +#include "svga_screen.h" +#include "svga_screen_texture.h" +#include "svga_context.h" +#include "svga_winsys.h" +#include "svga_draw.h" +#include "svga_debug.h" + +#include "svga_hw_reg.h" + + + + +static void svga_flush( struct pipe_context *pipe, + unsigned flags, + struct pipe_fence_handle **fence ) +{ + struct svga_context *svga = svga_context(pipe); + int i; + + /* Emit buffered drawing commands. + */ + svga_hwtnl_flush_retry( svga ); + + /* Emit back-copy from render target view to texture. + */ + for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { + if (svga->curr.framebuffer.cbufs[i]) + svga_propagate_surface(pipe, svga->curr.framebuffer.cbufs[i]); + } + if (svga->curr.framebuffer.zsbuf) + svga_propagate_surface(pipe, svga->curr.framebuffer.zsbuf); + + /* Flush command queue. + */ + svga_context_flush(svga, fence); +} + + +void svga_init_flush_functions( struct svga_context *svga ) +{ + svga->pipe.flush = svga_flush; +} diff --git a/src/gallium/drivers/svga/svga_pipe_fs.c b/src/gallium/drivers/svga/svga_pipe_fs.c new file mode 100644 index 0000000000..e3be840d92 --- /dev/null +++ b/src/gallium/drivers/svga/svga_pipe_fs.c @@ -0,0 +1,124 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "pipe/p_inlines.h" +#include "util/u_math.h" +#include "util/u_memory.h" +#include "tgsi/tgsi_parse.h" +#include "tgsi/tgsi_text.h" + +#include "svga_screen.h" +#include "svga_context.h" +#include "svga_state.h" +#include "svga_tgsi.h" +#include "svga_hw_reg.h" +#include "svga_cmd.h" +#include "svga_draw.h" +#include "svga_debug.h" + + +/*********************************************************************** + * Fragment shaders + */ + +static void * +svga_create_fs_state(struct pipe_context *pipe, + const struct pipe_shader_state *templ) +{ + struct svga_context *svga = svga_context(pipe); + struct svga_screen *svgascreen = svga_screen(pipe->screen); + struct svga_fragment_shader *fs; + + fs = CALLOC_STRUCT(svga_fragment_shader); + if (!fs) + return NULL; + + fs->base.tokens = tgsi_dup_tokens(templ->tokens); + + /* Collect basic info that we'll need later: + */ + tgsi_scan_shader(fs->base.tokens, &fs->base.info); + + fs->base.id = svga->debug.shader_id++; + fs->base.use_sm30 = svgascreen->use_ps30; + + if (SVGA_DEBUG & DEBUG_TGSI || 0) { + debug_printf("%s id: %u, inputs: %u, outputs: %u\n", + __FUNCTION__, fs->base.id, + fs->base.info.num_inputs, fs->base.info.num_outputs); + } + + return fs; +} + +static void +svga_bind_fs_state(struct pipe_context *pipe, void *shader) +{ + struct svga_fragment_shader *fs = (struct svga_fragment_shader *) shader; + struct svga_context *svga = svga_context(pipe); + + svga->curr.fs = fs; + svga->dirty |= SVGA_NEW_FS; +} + +static +void svga_delete_fs_state(struct pipe_context *pipe, void *shader) +{ + struct svga_context *svga = svga_context(pipe); + struct svga_fragment_shader *fs = (struct svga_fragment_shader *) shader; + struct svga_shader_result *result, *tmp; + enum pipe_error ret; + + svga_hwtnl_flush_retry( svga ); + + for (result = fs->base.results; result; result = tmp ) { + tmp = result->next; + + ret = SVGA3D_DestroyShader(svga->swc, + result->id, + SVGA3D_SHADERTYPE_PS ); + if(ret != PIPE_OK) { + svga_context_flush(svga, NULL); + ret = SVGA3D_DestroyShader(svga->swc, + result->id, + SVGA3D_SHADERTYPE_PS ); + assert(ret == PIPE_OK); + } + + svga_destroy_shader_result( result ); + } + + FREE((void *)fs->base.tokens); + FREE(fs); +} + + +void svga_init_fs_functions( struct svga_context *svga ) +{ + svga->pipe.create_fs_state = svga_create_fs_state; + svga->pipe.bind_fs_state = svga_bind_fs_state; + svga->pipe.delete_fs_state = svga_delete_fs_state; +} + diff --git a/src/gallium/drivers/svga/svga_pipe_misc.c b/src/gallium/drivers/svga/svga_pipe_misc.c new file mode 100644 index 0000000000..58cb1e6e23 --- /dev/null +++ b/src/gallium/drivers/svga/svga_pipe_misc.c @@ -0,0 +1,187 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "svga_cmd.h" + +#include "svga_context.h" +#include "svga_screen_texture.h" +#include "svga_state.h" +#include "svga_winsys.h" + +#include "svga_hw_reg.h" + + + + +static void svga_set_scissor_state( struct pipe_context *pipe, + const struct pipe_scissor_state *scissor ) +{ + struct svga_context *svga = svga_context(pipe); + + memcpy( &svga->curr.scissor, scissor, sizeof(*scissor) ); + svga->dirty |= SVGA_NEW_SCISSOR; +} + + +static void svga_set_polygon_stipple( struct pipe_context *pipe, + const struct pipe_poly_stipple *stipple ) +{ + /* overridden by the draw module */ +} + + +void svga_cleanup_framebuffer(struct svga_context *svga) +{ + struct pipe_framebuffer_state *curr = &svga->curr.framebuffer; + struct pipe_framebuffer_state *hw = &svga->state.hw_clear.framebuffer; + int i; + + for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { + pipe_surface_reference(&curr->cbufs[i], NULL); + pipe_surface_reference(&hw->cbufs[i], NULL); + } + + pipe_surface_reference(&curr->zsbuf, NULL); + pipe_surface_reference(&hw->zsbuf, NULL); +} + + +#define DEPTH_BIAS_SCALE_FACTOR_D16 ((float)(1<<15)) +#define DEPTH_BIAS_SCALE_FACTOR_D24S8 ((float)(1<<23)) +#define DEPTH_BIAS_SCALE_FACTOR_D32 ((float)(1<<31)) + + +static void svga_set_framebuffer_state(struct pipe_context *pipe, + const struct pipe_framebuffer_state *fb) +{ + struct svga_context *svga = svga_context(pipe); + struct pipe_framebuffer_state *dst = &svga->curr.framebuffer; + boolean propagate = FALSE; + int i; + + dst->width = fb->width; + dst->height = fb->height; + dst->nr_cbufs = fb->nr_cbufs; + + /* check if we need to propaget any of the target surfaces */ + for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { + if (dst->cbufs[i] && dst->cbufs[i] != fb->cbufs[i]) + if (svga_surface_needs_propagation(dst->cbufs[i])) + propagate = TRUE; + } + + if (propagate) { + /* make sure that drawing calls comes before propagation calls */ + svga_hwtnl_flush_retry( svga ); + + for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) + if (dst->cbufs[i] && dst->cbufs[i] != fb->cbufs[i]) + svga_propagate_surface(pipe, dst->cbufs[i]); + } + + /* XXX: Actually the virtual hardware may support rendertargets with + * different size, depending on the host API and driver, but since we cannot + * know that make no such assumption here. */ + for(i = 0; i < fb->nr_cbufs; ++i) { + if (fb->zsbuf && fb->cbufs[i]) { + assert(fb->zsbuf->width == fb->cbufs[i]->width); + assert(fb->zsbuf->height == fb->cbufs[i]->height); + } + } + + for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) + pipe_surface_reference(&dst->cbufs[i], fb->cbufs[i]); + pipe_surface_reference(&dst->zsbuf, fb->zsbuf); + + + if (svga->curr.framebuffer.zsbuf) + { + switch (svga->curr.framebuffer.zsbuf->format) { + case PIPE_FORMAT_Z16_UNORM: + svga->curr.depthscale = 1.0f / DEPTH_BIAS_SCALE_FACTOR_D16; + break; + case PIPE_FORMAT_S8Z24_UNORM: + case PIPE_FORMAT_X8Z24_UNORM: + case PIPE_FORMAT_Z24S8_UNORM: + case PIPE_FORMAT_Z24X8_UNORM: + svga->curr.depthscale = 1.0f / DEPTH_BIAS_SCALE_FACTOR_D24S8; + break; + case PIPE_FORMAT_Z32_UNORM: + svga->curr.depthscale = 1.0f / DEPTH_BIAS_SCALE_FACTOR_D32; + break; + case PIPE_FORMAT_Z32_FLOAT: + svga->curr.depthscale = 1.0f / ((float)(1<<23)); + break; + default: + svga->curr.depthscale = 0.0f; + break; + } + } + else { + svga->curr.depthscale = 0.0f; + } + + svga->dirty |= SVGA_NEW_FRAME_BUFFER; +} + + + +static void svga_set_clip_state( struct pipe_context *pipe, + const struct pipe_clip_state *clip ) +{ + struct svga_context *svga = svga_context(pipe); + + svga->curr.clip = *clip; /* struct copy */ + + svga->dirty |= SVGA_NEW_CLIP; +} + + + +/* Called when driver state tracker notices changes to the viewport + * matrix: + */ +static void svga_set_viewport_state( struct pipe_context *pipe, + const struct pipe_viewport_state *viewport ) +{ + struct svga_context *svga = svga_context(pipe); + + svga->curr.viewport = *viewport; /* struct copy */ + + svga->dirty |= SVGA_NEW_VIEWPORT; +} + + + +void svga_init_misc_functions( struct svga_context *svga ) +{ + svga->pipe.set_scissor_state = svga_set_scissor_state; + svga->pipe.set_polygon_stipple = svga_set_polygon_stipple; + svga->pipe.set_framebuffer_state = svga_set_framebuffer_state; + svga->pipe.set_clip_state = svga_set_clip_state; + svga->pipe.set_viewport_state = svga_set_viewport_state; +} + + diff --git a/src/gallium/drivers/svga/svga_pipe_query.c b/src/gallium/drivers/svga/svga_pipe_query.c new file mode 100644 index 0000000000..01336b0a2c --- /dev/null +++ b/src/gallium/drivers/svga/svga_pipe_query.c @@ -0,0 +1,267 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "pipe/p_state.h" +#include "pipe/p_context.h" +#include "util/u_memory.h" + +#include "svga_cmd.h" +#include "svga_context.h" +#include "svga_screen.h" +#include "svga_screen_buffer.h" +#include "svga_winsys.h" +#include "svga_draw.h" +#include "svga_debug.h" + + +/* Fixme: want a public base class for all pipe structs, even if there + * isn't much in them. + */ +struct pipe_query { + int dummy; +}; + +struct svga_query { + struct pipe_query base; + SVGA3dQueryType type; + struct svga_winsys_buffer *hwbuf; + volatile SVGA3dQueryResult *queryResult; + struct pipe_fence_handle *fence; +}; + +/*********************************************************************** + * Inline conversion functions. These are better-typed than the + * macros used previously: + */ +static INLINE struct svga_query * +svga_query( struct pipe_query *q ) +{ + return (struct svga_query *)q; +} + +static boolean svga_get_query_result(struct pipe_context *pipe, + struct pipe_query *q, + boolean wait, + uint64_t *result); + +static struct pipe_query *svga_create_query( struct pipe_context *pipe, + unsigned query_type ) +{ + struct svga_screen *svgascreen = svga_screen(pipe->screen); + struct svga_winsys_screen *sws = svgascreen->sws; + struct svga_query *sq; + + SVGA_DBG(DEBUG_QUERY, "%s\n", __FUNCTION__); + + sq = CALLOC_STRUCT(svga_query); + if (!sq) + goto no_sq; + + sq->type = SVGA3D_QUERYTYPE_OCCLUSION; + + sq->hwbuf = svga_winsys_buffer_create(svgascreen, + 1, + SVGA_BUFFER_USAGE_PINNED, + sizeof *sq->queryResult); + if(!sq->hwbuf) + goto no_hwbuf; + + sq->queryResult = (SVGA3dQueryResult *)sws->buffer_map(sws, + sq->hwbuf, + PIPE_BUFFER_USAGE_CPU_WRITE); + if(!sq->queryResult) + goto no_query_result; + + sq->queryResult->totalSize = sizeof *sq->queryResult; + sq->queryResult->state = SVGA3D_QUERYSTATE_NEW; + + /* + * We request the buffer to be pinned and assume it is always mapped. + * + * The reason is that we don't want to wait for fences when checking the + * query status. + */ + sws->buffer_unmap(sws, sq->hwbuf); + + return &sq->base; + +no_query_result: + sws->buffer_destroy(sws, sq->hwbuf); +no_hwbuf: + FREE(sq); +no_sq: + return NULL; +} + +static void svga_destroy_query(struct pipe_context *pipe, + struct pipe_query *q) +{ + struct svga_screen *svgascreen = svga_screen(pipe->screen); + struct svga_winsys_screen *sws = svgascreen->sws; + struct svga_query *sq = svga_query( q ); + + SVGA_DBG(DEBUG_QUERY, "%s\n", __FUNCTION__); + sws->buffer_destroy(sws, sq->hwbuf); + sws->fence_reference(sws, &sq->fence, NULL); + FREE(sq); +} + +static void svga_begin_query(struct pipe_context *pipe, + struct pipe_query *q) +{ + struct svga_screen *svgascreen = svga_screen(pipe->screen); + struct svga_winsys_screen *sws = svgascreen->sws; + struct svga_context *svga = svga_context( pipe ); + struct svga_query *sq = svga_query( q ); + enum pipe_error ret; + + SVGA_DBG(DEBUG_QUERY, "%s\n", __FUNCTION__); + + assert(!svga->sq); + + /* Need to flush out buffered drawing commands so that they don't + * get counted in the query results. + */ + svga_hwtnl_flush_retry(svga); + + if(sq->queryResult->state == SVGA3D_QUERYSTATE_PENDING) { + /* The application doesn't care for the pending query result. We cannot + * let go the existing buffer and just get a new one because its storage + * may be reused for other purposes and clobbered by the host when it + * determines the query result. So the only option here is to wait for + * the existing query's result -- not a big deal, given that no sane + * application would do this. + */ + uint64_t result; + + svga_get_query_result(pipe, q, TRUE, &result); + + assert(sq->queryResult->state != SVGA3D_QUERYSTATE_PENDING); + } + + sq->queryResult->state = SVGA3D_QUERYSTATE_NEW; + sws->fence_reference(sws, &sq->fence, NULL); + + ret = SVGA3D_BeginQuery(svga->swc, sq->type); + if(ret != PIPE_OK) { + svga_context_flush(svga, NULL); + ret = SVGA3D_BeginQuery(svga->swc, sq->type); + assert(ret == PIPE_OK); + } + + svga->sq = sq; +} + +static void svga_end_query(struct pipe_context *pipe, + struct pipe_query *q) +{ + struct svga_context *svga = svga_context( pipe ); + struct svga_query *sq = svga_query( q ); + enum pipe_error ret; + + SVGA_DBG(DEBUG_QUERY, "%s\n", __FUNCTION__); + assert(svga->sq == sq); + + svga_hwtnl_flush_retry(svga); + + /* Set to PENDING before sending EndQuery. */ + sq->queryResult->state = SVGA3D_QUERYSTATE_PENDING; + + ret = SVGA3D_EndQuery( svga->swc, sq->type, sq->hwbuf); + if(ret != PIPE_OK) { + svga_context_flush(svga, NULL); + ret = SVGA3D_EndQuery( svga->swc, sq->type, sq->hwbuf); + assert(ret == PIPE_OK); + } + + /* TODO: Delay flushing. We don't really need to flush here, just ensure + * that there is one flush before svga_get_query_result attempts to get the + * result */ + svga_context_flush(svga, NULL); + + svga->sq = NULL; +} + +static boolean svga_get_query_result(struct pipe_context *pipe, + struct pipe_query *q, + boolean wait, + uint64_t *result) +{ + struct svga_context *svga = svga_context( pipe ); + struct svga_screen *svgascreen = svga_screen( pipe->screen ); + struct svga_winsys_screen *sws = svgascreen->sws; + struct svga_query *sq = svga_query( q ); + SVGA3dQueryState state; + + SVGA_DBG(DEBUG_QUERY, "%s wait: %d\n", __FUNCTION__); + + /* The query status won't be updated by the host unless + * SVGA_3D_CMD_WAIT_FOR_QUERY is emitted. Unfortunately this will cause a + * synchronous wait on the host */ + if(!sq->fence) { + enum pipe_error ret; + + ret = SVGA3D_WaitForQuery( svga->swc, sq->type, sq->hwbuf); + if(ret != PIPE_OK) { + svga_context_flush(svga, NULL); + ret = SVGA3D_WaitForQuery( svga->swc, sq->type, sq->hwbuf); + assert(ret == PIPE_OK); + } + + svga_context_flush(svga, &sq->fence); + + assert(sq->fence); + } + + state = sq->queryResult->state; + if(state == SVGA3D_QUERYSTATE_PENDING) { + if(!wait) + return FALSE; + + sws->fence_finish(sws, sq->fence, 0); + + state = sq->queryResult->state; + } + + assert(state == SVGA3D_QUERYSTATE_SUCCEEDED || + state == SVGA3D_QUERYSTATE_FAILED); + + *result = (uint64_t)sq->queryResult->result32; + + SVGA_DBG(DEBUG_QUERY, "%s result %d\n", __FUNCTION__, (unsigned)*result); + + return TRUE; +} + + + +void svga_init_query_functions( struct svga_context *svga ) +{ + svga->pipe.create_query = svga_create_query; + svga->pipe.destroy_query = svga_destroy_query; + svga->pipe.begin_query = svga_begin_query; + svga->pipe.end_query = svga_end_query; + svga->pipe.get_query_result = svga_get_query_result; +} diff --git a/src/gallium/drivers/svga/svga_pipe_rasterizer.c b/src/gallium/drivers/svga/svga_pipe_rasterizer.c new file mode 100644 index 0000000000..b03f8eb9cf --- /dev/null +++ b/src/gallium/drivers/svga/svga_pipe_rasterizer.c @@ -0,0 +1,250 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "draw/draw_context.h" +#include "pipe/p_inlines.h" +#include "pipe/p_defines.h" +#include "util/u_math.h" +#include "util/u_memory.h" + +#include "svga_context.h" +#include "svga_state.h" + +#include "svga_hw_reg.h" + +/* Hardware frontwinding is always set up as SVGA3D_FRONTWINDING_CW. + */ +static SVGA3dFace svga_translate_cullmode( unsigned mode, + unsigned front_winding ) +{ + switch (mode) { + case PIPE_WINDING_NONE: + return SVGA3D_FACE_NONE; + case PIPE_WINDING_CCW: + return SVGA3D_FACE_BACK; + case PIPE_WINDING_CW: + return SVGA3D_FACE_FRONT; + case PIPE_WINDING_BOTH: + return SVGA3D_FACE_FRONT_BACK; + default: + assert(0); + return SVGA3D_FACE_NONE; + } +} + +static SVGA3dShadeMode svga_translate_flatshade( unsigned mode ) +{ + return mode ? SVGA3D_SHADEMODE_FLAT : SVGA3D_SHADEMODE_SMOOTH; +} + + +static void * +svga_create_rasterizer_state(struct pipe_context *pipe, + const struct pipe_rasterizer_state *templ) +{ + struct svga_rasterizer_state *rast = CALLOC_STRUCT( svga_rasterizer_state ); + /* need this for draw module. */ + rast->templ = *templ; + + /* light_twoside - XXX: need fragment shader varient */ + /* poly_smooth - XXX: no fallback available */ + /* poly_stipple_enable - draw module */ + /* point_sprite - ? */ + /* point_size_per_vertex - ? */ + /* sprite_coord_mode - ??? */ + /* bypass_vs_viewport_and_clip - handled by viewport setup */ + /* flatshade_first - handled by index translation */ + /* gl_rasterization_rules - XXX - viewport code */ + /* line_width - draw module */ + /* fill_cw, fill_ccw - draw module or index translation */ + + rast->shademode = svga_translate_flatshade( templ->flatshade ); + rast->cullmode = svga_translate_cullmode( templ->cull_mode, + templ->front_winding ); + rast->scissortestenable = templ->scissor; + rast->multisampleantialias = templ->multisample; + rast->antialiasedlineenable = templ->line_smooth; + rast->lastpixel = templ->line_last_pixel; + rast->pointsize = templ->point_size; + rast->pointsize_min = templ->point_size_min; + rast->pointsize_max = templ->point_size_max; + rast->hw_unfilled = PIPE_POLYGON_MODE_FILL; + + /* Use swtnl + decomposition implement these: + */ + if (templ->poly_stipple_enable) + rast->need_pipeline |= SVGA_PIPELINE_FLAG_TRIS; + + if (templ->line_width != 1.0 && + templ->line_width != 0.0) + rast->need_pipeline |= SVGA_PIPELINE_FLAG_LINES; + + if (templ->line_stipple_enable) { + /* LinePattern not implemented on all backends. + */ + if (0) { + SVGA3dLinePattern lp; + lp.repeat = templ->line_stipple_factor + 1; + lp.pattern = templ->line_stipple_pattern; + rast->linepattern = lp.uintValue; + } + else { + rast->need_pipeline |= SVGA_PIPELINE_FLAG_LINES; + } + } + + if (templ->point_smooth) + rast->need_pipeline |= SVGA_PIPELINE_FLAG_POINTS; + + { + boolean offset_cw = templ->offset_cw; + boolean offset_ccw = templ->offset_ccw; + boolean offset = 0; + int fill_cw = templ->fill_cw; + int fill_ccw = templ->fill_ccw; + int fill = PIPE_POLYGON_MODE_FILL; + + switch (templ->cull_mode) { + case PIPE_WINDING_BOTH: + offset = 0; + fill = PIPE_POLYGON_MODE_FILL; + break; + + case PIPE_WINDING_CW: + offset = offset_ccw; + fill = fill_ccw; + break; + + case PIPE_WINDING_CCW: + offset = offset_cw; + fill = fill_cw; + break; + + case PIPE_WINDING_NONE: + if (fill_cw != fill_ccw || offset_cw != offset_ccw) + { + /* Always need the draw module to work out different + * front/back fill modes: + */ + rast->need_pipeline |= SVGA_PIPELINE_FLAG_TRIS; + } + else { + offset = offset_ccw; + fill = fill_ccw; + } + break; + + default: + assert(0); + break; + } + + /* Unfilled primitive modes aren't implemented on all virtual + * hardware. We can do some unfilled processing with index + * translation, but otherwise need the draw module: + */ + if (fill != PIPE_POLYGON_MODE_FILL && + (templ->flatshade || + templ->light_twoside || + offset || + templ->cull_mode != PIPE_WINDING_NONE)) + { + fill = PIPE_POLYGON_MODE_FILL; + rast->need_pipeline |= SVGA_PIPELINE_FLAG_TRIS; + } + + /* If we are decomposing to lines, and lines need the pipeline, + * then we also need the pipeline for tris. + */ + if (fill == PIPE_POLYGON_MODE_LINE && + (rast->need_pipeline & SVGA_PIPELINE_FLAG_LINES)) + { + fill = PIPE_POLYGON_MODE_FILL; + rast->need_pipeline |= SVGA_PIPELINE_FLAG_TRIS; + } + + /* Similarly for points: + */ + if (fill == PIPE_POLYGON_MODE_POINT && + (rast->need_pipeline & SVGA_PIPELINE_FLAG_POINTS)) + { + fill = PIPE_POLYGON_MODE_FILL; + rast->need_pipeline |= SVGA_PIPELINE_FLAG_TRIS; + } + + if (offset) { + rast->slopescaledepthbias = templ->offset_scale; + rast->depthbias = templ->offset_units; + } + + rast->hw_unfilled = fill; + } + + + + + if (rast->need_pipeline & SVGA_PIPELINE_FLAG_TRIS) { + /* Turn off stuff which will get done in the draw module: + */ + rast->hw_unfilled = PIPE_POLYGON_MODE_FILL; + rast->slopescaledepthbias = 0; + rast->depthbias = 0; + } + + return rast; +} + +static void svga_bind_rasterizer_state( struct pipe_context *pipe, + void *state ) +{ + struct svga_context *svga = svga_context(pipe); + struct svga_rasterizer_state *raster = (struct svga_rasterizer_state *)state; + + svga->curr.rast = raster; + + draw_set_rasterizer_state(svga->swtnl.draw, raster ? &raster->templ : NULL); + + svga->dirty |= SVGA_NEW_RAST; +} + +static void svga_delete_rasterizer_state(struct pipe_context *pipe, + void *raster) +{ + FREE(raster); +} + + +void svga_init_rasterizer_functions( struct svga_context *svga ) +{ + svga->pipe.create_rasterizer_state = svga_create_rasterizer_state; + svga->pipe.bind_rasterizer_state = svga_bind_rasterizer_state; + svga->pipe.delete_rasterizer_state = svga_delete_rasterizer_state; +} + + +/*********************************************************************** + * Hardware state update + */ + diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c new file mode 100644 index 0000000000..3eeca6b784 --- /dev/null +++ b/src/gallium/drivers/svga/svga_pipe_sampler.c @@ -0,0 +1,243 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "pipe/p_inlines.h" +#include "pipe/p_defines.h" +#include "util/u_math.h" +#include "util/u_memory.h" +#include "util/u_pack_color.h" +#include "tgsi/tgsi_parse.h" + +#include "svga_context.h" +#include "svga_screen_texture.h" +#include "svga_state.h" + +#include "svga_hw_reg.h" + +#include "svga_debug.h" + +static INLINE unsigned +translate_wrap_mode(unsigned wrap) +{ + switch (wrap) { + case PIPE_TEX_WRAP_REPEAT: + return SVGA3D_TEX_ADDRESS_WRAP; + + case PIPE_TEX_WRAP_CLAMP: + return SVGA3D_TEX_ADDRESS_CLAMP; + + case PIPE_TEX_WRAP_CLAMP_TO_EDGE: + /* Unfortunately SVGA3D_TEX_ADDRESS_EDGE not respected by + * hardware. + */ + return SVGA3D_TEX_ADDRESS_CLAMP; + + case PIPE_TEX_WRAP_CLAMP_TO_BORDER: + return SVGA3D_TEX_ADDRESS_BORDER; + + case PIPE_TEX_WRAP_MIRROR_REPEAT: + return SVGA3D_TEX_ADDRESS_MIRROR; + + case PIPE_TEX_WRAP_MIRROR_CLAMP: + case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE: + case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER: + return SVGA3D_TEX_ADDRESS_MIRRORONCE; + + default: + assert(0); + return SVGA3D_TEX_ADDRESS_WRAP; + } +} + +static INLINE unsigned translate_img_filter( unsigned filter ) +{ + switch (filter) { + case PIPE_TEX_FILTER_NEAREST: return SVGA3D_TEX_FILTER_NEAREST; + case PIPE_TEX_FILTER_LINEAR: return SVGA3D_TEX_FILTER_LINEAR; + case PIPE_TEX_FILTER_ANISO: return SVGA3D_TEX_FILTER_ANISOTROPIC; + default: + assert(0); + return SVGA3D_TEX_FILTER_NEAREST; + } +} + +static INLINE unsigned translate_mip_filter( unsigned filter ) +{ + switch (filter) { + case PIPE_TEX_MIPFILTER_NONE: return SVGA3D_TEX_FILTER_NONE; + case PIPE_TEX_MIPFILTER_NEAREST: return SVGA3D_TEX_FILTER_NEAREST; + case PIPE_TEX_MIPFILTER_LINEAR: return SVGA3D_TEX_FILTER_LINEAR; + default: + assert(0); + return SVGA3D_TEX_FILTER_NONE; + } +} + +static void * +svga_create_sampler_state(struct pipe_context *pipe, + const struct pipe_sampler_state *sampler) +{ + struct svga_context *svga = svga_context(pipe); + struct svga_sampler_state *cso = CALLOC_STRUCT( svga_sampler_state ); + + cso->mipfilter = translate_mip_filter(sampler->min_mip_filter); + cso->magfilter = translate_img_filter( sampler->mag_img_filter ); + cso->minfilter = translate_img_filter( sampler->min_img_filter ); + cso->aniso_level = MAX2( (unsigned) sampler->max_anisotropy, 1 ); + cso->lod_bias = sampler->lod_bias; + cso->addressu = translate_wrap_mode(sampler->wrap_s); + cso->addressv = translate_wrap_mode(sampler->wrap_t); + cso->addressw = translate_wrap_mode(sampler->wrap_r); + cso->normalized_coords = sampler->normalized_coords; + cso->compare_mode = sampler->compare_mode; + cso->compare_func = sampler->compare_func; + + { + ubyte r = float_to_ubyte(sampler->border_color[0]); + ubyte g = float_to_ubyte(sampler->border_color[1]); + ubyte b = float_to_ubyte(sampler->border_color[2]); + ubyte a = float_to_ubyte(sampler->border_color[3]); + + util_pack_color_ub( r, g, b, a, + PIPE_FORMAT_B8G8R8A8_UNORM, + &cso->bordercolor ); + } + + /* No SVGA3D support for: + * - min/max LOD clamping + */ + cso->min_lod = 0; + cso->view_min_lod = MAX2(sampler->min_lod, 0); + cso->view_max_lod = MAX2(sampler->max_lod, 0); + + /* Use min_mipmap */ + if (svga->debug.use_min_mipmap) { + if (cso->view_min_lod == cso->view_max_lod) { + cso->min_lod = cso->view_min_lod; + cso->view_min_lod = 0; + cso->view_max_lod = 1000; /* Just a high number */ + cso->mipfilter = SVGA3D_TEX_FILTER_NONE; + } + } + + SVGA_DBG(DEBUG_VIEWS, "min %u, view(min %u, max %u) lod, mipfilter %s\n", + cso->min_lod, cso->view_min_lod, cso->view_max_lod, + cso->mipfilter == SVGA3D_TEX_FILTER_NONE ? "SVGA3D_TEX_FILTER_NONE" : "SOMETHING"); + + return cso; +} + +static void svga_bind_sampler_states(struct pipe_context *pipe, + unsigned num, void **sampler) +{ + struct svga_context *svga = svga_context(pipe); + unsigned i; + + assert(num <= PIPE_MAX_SAMPLERS); + + /* Check for no-op */ + if (num == svga->curr.num_samplers && + !memcmp(svga->curr.sampler, sampler, num * sizeof(void *))) { + debug_printf("sampler noop\n"); + return; + } + + for (i = 0; i < num; i++) + svga->curr.sampler[i] = sampler[i]; + + for (i = num; i < svga->curr.num_samplers; i++) + svga->curr.sampler[i] = NULL; + + svga->curr.num_samplers = num; + svga->dirty |= SVGA_NEW_SAMPLER; +} + +static void svga_delete_sampler_state(struct pipe_context *pipe, + void *sampler) +{ + FREE(sampler); +} + + +static void svga_set_sampler_textures(struct pipe_context *pipe, + unsigned num, + struct pipe_texture **texture) +{ + struct svga_context *svga = svga_context(pipe); + unsigned flag_1d = 0; + unsigned flag_srgb = 0; + uint i; + + assert(num <= PIPE_MAX_SAMPLERS); + + /* Check for no-op */ + if (num == svga->curr.num_textures && + !memcmp(svga->curr.texture, texture, num * sizeof(struct pipe_texture *))) { + if (0) debug_printf("texture noop\n"); + return; + } + + for (i = 0; i < num; i++) { + pipe_texture_reference(&svga->curr.texture[i], + texture[i]); + + if (!texture[i]) + continue; + + if (texture[i]->format == PIPE_FORMAT_A8R8G8B8_SRGB) + flag_srgb |= 1 << i; + + if (texture[i]->target == PIPE_TEXTURE_1D) + flag_1d |= 1 << i; + } + + for (i = num; i < svga->curr.num_textures; i++) + pipe_texture_reference(&svga->curr.texture[i], + NULL); + + svga->curr.num_textures = num; + svga->dirty |= SVGA_NEW_TEXTURE_BINDING; + + if (flag_srgb != svga->curr.tex_flags.flag_srgb || + flag_1d != svga->curr.tex_flags.flag_1d) + { + svga->dirty |= SVGA_NEW_TEXTURE_FLAGS; + svga->curr.tex_flags.flag_1d = flag_1d; + svga->curr.tex_flags.flag_srgb = flag_srgb; + } +} + + + +void svga_init_sampler_functions( struct svga_context *svga ) +{ + svga->pipe.create_sampler_state = svga_create_sampler_state; + svga->pipe.bind_sampler_states = svga_bind_sampler_states; + svga->pipe.delete_sampler_state = svga_delete_sampler_state; + svga->pipe.set_sampler_textures = svga_set_sampler_textures; +} + + + diff --git a/src/gallium/drivers/svga/svga_pipe_vertex.c b/src/gallium/drivers/svga/svga_pipe_vertex.c new file mode 100644 index 0000000000..28e2787e0d --- /dev/null +++ b/src/gallium/drivers/svga/svga_pipe_vertex.c @@ -0,0 +1,115 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "pipe/p_inlines.h" +#include "pipe/p_defines.h" +#include "util/u_math.h" +#include "util/u_memory.h" +#include "tgsi/tgsi_parse.h" + +#include "svga_screen.h" +#include "svga_screen_buffer.h" +#include "svga_context.h" +#include "svga_state.h" +#include "svga_winsys.h" + +#include "svga_hw_reg.h" + + +static void svga_set_vertex_buffers(struct pipe_context *pipe, + unsigned count, + const struct pipe_vertex_buffer *buffers) +{ + struct svga_context *svga = svga_context(pipe); + unsigned i; + boolean any_user_buffer = FALSE; + + /* Check for no change */ + if (count == svga->curr.num_vertex_buffers && + memcmp(svga->curr.vb, buffers, count * sizeof buffers[0]) == 0) + return; + + /* Adjust refcounts */ + for (i = 0; i < count; i++) { + pipe_buffer_reference(&svga->curr.vb[i].buffer, buffers[i].buffer); + if (svga_buffer(buffers[i].buffer)->user) + any_user_buffer = TRUE; + } + + for ( ; i < svga->curr.num_vertex_buffers; i++) + pipe_buffer_reference(&svga->curr.vb[i].buffer, NULL); + + /* Copy remaining data */ + memcpy(svga->curr.vb, buffers, count * sizeof buffers[0]); + svga->curr.num_vertex_buffers = count; + svga->curr.any_user_vertex_buffers = any_user_buffer; + + svga->dirty |= SVGA_NEW_VBUFFER; +} + +static void svga_set_vertex_elements(struct pipe_context *pipe, + unsigned count, + const struct pipe_vertex_element *elements) +{ + struct svga_context *svga = svga_context(pipe); + unsigned i; + + for (i = 0; i < count; i++) + svga->curr.ve[i] = elements[i]; + + svga->curr.num_vertex_elements = count; + svga->dirty |= SVGA_NEW_VELEMENT; +} + + +static void svga_set_edgeflags(struct pipe_context *pipe, + const unsigned *bitfield) +{ + struct svga_context *svga = svga_context(pipe); + + if (bitfield != NULL || svga->curr.edgeflags != NULL) { + svga->curr.edgeflags = bitfield; + svga->dirty |= SVGA_NEW_EDGEFLAGS; + } +} + + +void svga_cleanup_vertex_state( struct svga_context *svga ) +{ + unsigned i; + + for (i = 0 ; i < svga->curr.num_vertex_buffers; i++) + pipe_buffer_reference(&svga->curr.vb[i].buffer, NULL); +} + + +void svga_init_vertex_functions( struct svga_context *svga ) +{ + svga->pipe.set_vertex_buffers = svga_set_vertex_buffers; + svga->pipe.set_vertex_elements = svga_set_vertex_elements; + svga->pipe.set_edgeflags = svga_set_edgeflags; +} + + diff --git a/src/gallium/drivers/svga/svga_pipe_vs.c b/src/gallium/drivers/svga/svga_pipe_vs.c new file mode 100644 index 0000000000..e5ffe668c3 --- /dev/null +++ b/src/gallium/drivers/svga/svga_pipe_vs.c @@ -0,0 +1,189 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "draw/draw_context.h" +#include "pipe/p_inlines.h" +#include "util/u_math.h" +#include "util/u_memory.h" +#include "tgsi/tgsi_parse.h" +#include "tgsi/tgsi_text.h" + +#include "svga_screen.h" +#include "svga_context.h" +#include "svga_state.h" +#include "svga_tgsi.h" +#include "svga_hw_reg.h" +#include "svga_cmd.h" +#include "svga_debug.h" + + +static const struct tgsi_token *substitute_vs( + unsigned shader_id, + const struct tgsi_token *old_tokens ) +{ +#if 0 + if (shader_id == 12) { + static struct tgsi_token tokens[300]; + + const char *text = + "VERT1.1\n" + "DCL IN[0]\n" + "DCL IN[1]\n" + "DCL IN[2]\n" + "DCL OUT[0], POSITION\n" + "DCL TEMP[0..4]\n" + "IMM FLT32 { 1.0000, 1.0000, 1.0000, 1.0000 }\n" + "IMM FLT32 { 0.45, 1.0000, 1.0000, 1.0000 }\n" + "IMM FLT32 { 1.297863, 0.039245, 0.035993, 0.035976}\n" + "IMM FLT32 { -0.019398, 1.696131, -0.202151, -0.202050 }\n" + "IMM FLT32 { 0.051711, -0.348713, -0.979204, -0.978714 }\n" + "IMM FLT32 { 0.000000, 0.000003, 139.491577, 141.421356 }\n" + "DCL CONST[0..7]\n" + "DCL CONST[9..16]\n" + " MOV TEMP[2], IMM[0]\n" + + " MOV TEMP[2].xyz, IN[2]\n" + " MOV TEMP[2].xyz, IN[0]\n" + " MOV TEMP[2].xyz, IN[1]\n" + + " MUL TEMP[1], IMM[3], TEMP[2].yyyy\n" + " MAD TEMP[3], IMM[2], TEMP[2].xxxx, TEMP[1]\n" + " MAD TEMP[1], IMM[4], TEMP[2].zzzz, TEMP[3]\n" + " MAD TEMP[4], IMM[5], TEMP[2].wwww, TEMP[1]\n" + + " MOV OUT[0], TEMP[4]\n" + " END\n"; + + if (!tgsi_text_translate( text, + tokens, + Elements(tokens) )) + { + assert(0); + return NULL; + } + + return tokens; + } +#endif + + return old_tokens; +} + + +/*********************************************************************** + * Vertex shaders + */ + +static void * +svga_create_vs_state(struct pipe_context *pipe, + const struct pipe_shader_state *templ) +{ + struct svga_context *svga = svga_context(pipe); + struct svga_screen *svgascreen = svga_screen(pipe->screen); + struct svga_vertex_shader *vs = CALLOC_STRUCT(svga_vertex_shader); + if (!vs) + return NULL; + + /* substitute a debug shader? + */ + vs->base.tokens = tgsi_dup_tokens(substitute_vs(svga->debug.shader_id, + templ->tokens)); + + + /* Collect basic info that we'll need later: + */ + tgsi_scan_shader(vs->base.tokens, &vs->base.info); + + { + /* Need to do construct a new template in case we substitued a + * debug shader. + */ + struct pipe_shader_state tmp2 = *templ; + tmp2.tokens = vs->base.tokens; + vs->draw_shader = draw_create_vertex_shader(svga->swtnl.draw, &tmp2); + } + + vs->base.id = svga->debug.shader_id++; + vs->base.use_sm30 = svgascreen->use_vs30; + + if (SVGA_DEBUG & DEBUG_TGSI || 0) { + debug_printf("%s id: %u, inputs: %u, outputs: %u\n", + __FUNCTION__, vs->base.id, + vs->base.info.num_inputs, vs->base.info.num_outputs); + } + + return vs; +} + +static void svga_bind_vs_state(struct pipe_context *pipe, void *shader) +{ + struct svga_vertex_shader *vs = (struct svga_vertex_shader *)shader; + struct svga_context *svga = svga_context(pipe); + + svga->curr.vs = vs; + svga->dirty |= SVGA_NEW_VS; +} + + +static void svga_delete_vs_state(struct pipe_context *pipe, void *shader) +{ + struct svga_context *svga = svga_context(pipe); + struct svga_vertex_shader *vs = (struct svga_vertex_shader *)shader; + struct svga_shader_result *result, *tmp; + enum pipe_error ret; + + svga_hwtnl_flush_retry( svga ); + + draw_delete_vertex_shader(svga->swtnl.draw, vs->draw_shader); + + for (result = vs->base.results; result; result = tmp ) { + tmp = result->next; + + ret = SVGA3D_DestroyShader(svga->swc, + result->id, + SVGA3D_SHADERTYPE_VS ); + if(ret != PIPE_OK) { + svga_context_flush(svga, NULL); + ret = SVGA3D_DestroyShader(svga->swc, + result->id, + SVGA3D_SHADERTYPE_VS ); + assert(ret == PIPE_OK); + } + + svga_destroy_shader_result( result ); + } + + FREE((void *)vs->base.tokens); + FREE(vs); +} + + +void svga_init_vs_functions( struct svga_context *svga ) +{ + svga->pipe.create_vs_state = svga_create_vs_state; + svga->pipe.bind_vs_state = svga_bind_vs_state; + svga->pipe.delete_vs_state = svga_delete_vs_state; +} + diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c new file mode 100644 index 0000000000..3afcaffff5 --- /dev/null +++ b/src/gallium/drivers/svga/svga_screen.c @@ -0,0 +1,435 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "util/u_memory.h" +#include "pipe/p_inlines.h" +#include "util/u_string.h" +#include "util/u_math.h" + +#include "svga_winsys.h" +#include "svga_context.h" +#include "svga_screen.h" +#include "svga_screen_texture.h" +#include "svga_screen_buffer.h" +#include "svga_cmd.h" +#include "svga_debug.h" + +#include "svga_hw_reg.h" +#include "svga3d_shaderdefs.h" + + +#ifdef DEBUG +int SVGA_DEBUG = 0; + +static const struct debug_named_value svga_debug_flags[] = { + { "dma", DEBUG_DMA }, + { "tgsi", DEBUG_TGSI }, + { "pipe", DEBUG_PIPE }, + { "state", DEBUG_STATE }, + { "screen", DEBUG_SCREEN }, + { "tex", DEBUG_TEX }, + { "swtnl", DEBUG_SWTNL }, + { "const", DEBUG_CONSTS }, + { "viewport", DEBUG_VIEWPORT }, + { "views", DEBUG_VIEWS }, + { "perf", DEBUG_PERF }, + { "flush", DEBUG_FLUSH }, + { "sync", DEBUG_SYNC }, + {NULL, 0} +}; +#endif + +static const char * +svga_get_vendor( struct pipe_screen *pscreen ) +{ + return "VMware, Inc."; +} + + +static const char * +svga_get_name( struct pipe_screen *pscreen ) +{ +#ifdef DEBUG + /* Only return internal details in the DEBUG version: + */ + return "SVGA3D; build: DEBUG; mutex: " PIPE_ATOMIC; +#else + return "SVGA3D; build: RELEASE; "; +#endif +} + + + + +static float +svga_get_paramf(struct pipe_screen *screen, int param) +{ + struct svga_screen *svgascreen = svga_screen(screen); + struct svga_winsys_screen *sws = svgascreen->sws; + SVGA3dDevCapResult result; + + switch (param) { + case PIPE_CAP_MAX_LINE_WIDTH: + /* fall-through */ + case PIPE_CAP_MAX_LINE_WIDTH_AA: + return 7.0; + + case PIPE_CAP_MAX_POINT_WIDTH: + /* fall-through */ + case PIPE_CAP_MAX_POINT_WIDTH_AA: + /* Keep this to a reasonable size to avoid failures in + * conform/pntaa.c: + */ + return 80.0; + + case PIPE_CAP_MAX_TEXTURE_ANISOTROPY: + return 4.0; + + case PIPE_CAP_MAX_TEXTURE_LOD_BIAS: + return 16.0; + + case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: + return 16; + case PIPE_CAP_NPOT_TEXTURES: + return 1; + case PIPE_CAP_TWO_SIDED_STENCIL: + return 1; + case PIPE_CAP_GLSL: + return svgascreen->use_ps30 && svgascreen->use_vs30; + case PIPE_CAP_ANISOTROPIC_FILTER: + return 1; + case PIPE_CAP_POINT_SPRITE: + return 1; + case PIPE_CAP_MAX_RENDER_TARGETS: + if(!sws->get_cap(sws, SVGA3D_DEVCAP_MAX_RENDER_TARGETS, &result)) + return 1; + if(!result.u) + return 1; + return MIN2(result.u, PIPE_MAX_COLOR_BUFS); + case PIPE_CAP_OCCLUSION_QUERY: + return 1; + case PIPE_CAP_TEXTURE_SHADOW_MAP: + return 1; + case PIPE_CAP_MAX_TEXTURE_2D_LEVELS: + return SVGA_MAX_TEXTURE_LEVELS; + case PIPE_CAP_MAX_TEXTURE_3D_LEVELS: + return 8; /* max 128x128x128 */ + case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS: + return SVGA_MAX_TEXTURE_LEVELS; + + case PIPE_CAP_TEXTURE_MIRROR_REPEAT: /* req. for GL 1.4 */ + return 1; + + case PIPE_CAP_BLEND_EQUATION_SEPARATE: /* req. for GL 1.5 */ + return 1; + + default: + return 0; + } +} + + +/* This is a fairly pointless interface + */ +static int +svga_get_param(struct pipe_screen *screen, int param) +{ + return (int) svga_get_paramf( screen, param ); +} + + +static INLINE SVGA3dDevCapIndex +svga_translate_format_cap(enum pipe_format format) +{ + switch(format) { + + case PIPE_FORMAT_A8R8G8B8_UNORM: + return SVGA3D_DEVCAP_SURFACEFMT_A8R8G8B8; + case PIPE_FORMAT_X8R8G8B8_UNORM: + return SVGA3D_DEVCAP_SURFACEFMT_X8R8G8B8; + + case PIPE_FORMAT_R5G6B5_UNORM: + return SVGA3D_DEVCAP_SURFACEFMT_R5G6B5; + case PIPE_FORMAT_A1R5G5B5_UNORM: + return SVGA3D_DEVCAP_SURFACEFMT_A1R5G5B5; + case PIPE_FORMAT_A4R4G4B4_UNORM: + return SVGA3D_DEVCAP_SURFACEFMT_A4R4G4B4; + + case PIPE_FORMAT_Z16_UNORM: + return SVGA3D_DEVCAP_SURFACEFMT_Z_D16; + case PIPE_FORMAT_Z24S8_UNORM: + return SVGA3D_DEVCAP_SURFACEFMT_Z_D24S8; + case PIPE_FORMAT_Z24X8_UNORM: + return SVGA3D_DEVCAP_SURFACEFMT_Z_D24X8; + + case PIPE_FORMAT_A8_UNORM: + return SVGA3D_DEVCAP_SURFACEFMT_ALPHA8; + case PIPE_FORMAT_L8_UNORM: + return SVGA3D_DEVCAP_SURFACEFMT_LUMINANCE8; + + case PIPE_FORMAT_DXT1_RGB: + case PIPE_FORMAT_DXT1_RGBA: + return SVGA3D_DEVCAP_SURFACEFMT_DXT1; + case PIPE_FORMAT_DXT3_RGBA: + return SVGA3D_DEVCAP_SURFACEFMT_DXT3; + case PIPE_FORMAT_DXT5_RGBA: + return SVGA3D_DEVCAP_SURFACEFMT_DXT5; + + default: + return SVGA3D_DEVCAP_MAX; + } +} + + +static boolean +svga_is_format_supported( struct pipe_screen *screen, + enum pipe_format format, + enum pipe_texture_target target, + unsigned tex_usage, + unsigned geom_flags ) +{ + struct svga_winsys_screen *sws = svga_screen(screen)->sws; + SVGA3dDevCapIndex index; + SVGA3dDevCapResult result; + + assert(tex_usage); + + /* Override host capabilities */ + if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) { + switch(format) { + + /* Often unsupported/problematic. This means we end up with the same + * visuals for all virtual hardware implementations. + */ + case PIPE_FORMAT_A4R4G4B4_UNORM: + case PIPE_FORMAT_A1R5G5B5_UNORM: + return FALSE; + + /* Simulate ability to render into compressed textures */ + case PIPE_FORMAT_DXT1_RGB: + case PIPE_FORMAT_DXT1_RGBA: + case PIPE_FORMAT_DXT3_RGBA: + case PIPE_FORMAT_DXT5_RGBA: + return TRUE; + + default: + break; + } + } + + /* Try to query the host */ + index = svga_translate_format_cap(format); + if( index < SVGA3D_DEVCAP_MAX && + sws->get_cap(sws, index, &result) ) + { + SVGA3dSurfaceFormatCaps mask; + + mask.value = 0; + if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) + mask.offscreenRenderTarget = 1; + if (tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) + mask.zStencil = 1; + if (tex_usage & PIPE_TEXTURE_USAGE_SAMPLER) + mask.texture = 1; + + if ((result.u & mask.value) == mask.value) + return TRUE; + else + return FALSE; + } + + /* Use our translate functions directly rather than relying on a + * duplicated list of supported formats which is prone to getting + * out of sync: + */ + if(tex_usage & (PIPE_TEXTURE_USAGE_RENDER_TARGET | PIPE_TEXTURE_USAGE_DEPTH_STENCIL)) + return svga_translate_format_render(format) != SVGA3D_FORMAT_INVALID; + else + return svga_translate_format(format) != SVGA3D_FORMAT_INVALID; +} + + +static void +svga_fence_reference(struct pipe_screen *screen, + struct pipe_fence_handle **ptr, + struct pipe_fence_handle *fence) +{ + struct svga_winsys_screen *sws = svga_screen(screen)->sws; + sws->fence_reference(sws, ptr, fence); +} + + +static int +svga_fence_signalled(struct pipe_screen *screen, + struct pipe_fence_handle *fence, + unsigned flag) +{ + struct svga_winsys_screen *sws = svga_screen(screen)->sws; + return sws->fence_signalled(sws, fence, flag); +} + + +static int +svga_fence_finish(struct pipe_screen *screen, + struct pipe_fence_handle *fence, + unsigned flag) +{ + struct svga_winsys_screen *sws = svga_screen(screen)->sws; + return sws->fence_finish(sws, fence, flag); +} + + +static void +svga_destroy_screen( struct pipe_screen *screen ) +{ + struct svga_screen *svgascreen = svga_screen(screen); + + svga_screen_cache_cleanup(svgascreen); + + pipe_mutex_destroy(svgascreen->swc_mutex); + pipe_mutex_destroy(svgascreen->tex_mutex); + + svgascreen->swc->destroy(svgascreen->swc); + + svgascreen->sws->destroy(svgascreen->sws); + + FREE(svgascreen); +} + + +/** + * Create a new svga_screen object + */ +struct pipe_screen * +svga_screen_create(struct svga_winsys_screen *sws) +{ + struct svga_screen *svgascreen; + struct pipe_screen *screen; + SVGA3dDevCapResult result; + +#ifdef DEBUG + SVGA_DEBUG = debug_get_flags_option("SVGA_DEBUG", svga_debug_flags, 0 ); +#endif + + svgascreen = CALLOC_STRUCT(svga_screen); + if (!svgascreen) + goto error1; + + svgascreen->debug.force_level_surface_view = + debug_get_bool_option("SVGA_FORCE_LEVEL_SURFACE_VIEW", FALSE); + svgascreen->debug.force_surface_view = + debug_get_bool_option("SVGA_FORCE_SURFACE_VIEW", FALSE); + svgascreen->debug.force_sampler_view = + debug_get_bool_option("SVGA_FORCE_SAMPLER_VIEW", FALSE); + svgascreen->debug.no_surface_view = + debug_get_bool_option("SVGA_NO_SURFACE_VIEW", FALSE); + svgascreen->debug.no_sampler_view = + debug_get_bool_option("SVGA_NO_SAMPLER_VIEW", FALSE); + + screen = &svgascreen->screen; + + screen->destroy = svga_destroy_screen; + screen->get_name = svga_get_name; + screen->get_vendor = svga_get_vendor; + screen->get_param = svga_get_param; + screen->get_paramf = svga_get_paramf; + screen->is_format_supported = svga_is_format_supported; + screen->fence_reference = svga_fence_reference; + screen->fence_signalled = svga_fence_signalled; + screen->fence_finish = svga_fence_finish; + svgascreen->sws = sws; + + svga_screen_init_texture_functions(screen); + svga_screen_init_buffer_functions(screen); + + svgascreen->use_ps30 = + sws->get_cap(sws, SVGA3D_DEVCAP_FRAGMENT_SHADER_VERSION, &result) && + result.u >= SVGA3DPSVERSION_30 ? TRUE : FALSE; + + svgascreen->use_vs30 = + sws->get_cap(sws, SVGA3D_DEVCAP_VERTEX_SHADER_VERSION, &result) && + result.u >= SVGA3DVSVERSION_30 ? TRUE : FALSE; + +#if 1 + /* Shader model 2.0 is unsupported at the moment. */ + if(!svgascreen->use_ps30 || !svgascreen->use_vs30) + goto error2; +#else + if(debug_get_bool_option("SVGA_NO_SM30", FALSE)) + svgascreen->use_vs30 = svgascreen->use_ps30 = FALSE; +#endif + + svgascreen->swc = sws->context_create(sws); + if(!svgascreen->swc) + goto error2; + + pipe_mutex_init(svgascreen->tex_mutex); + pipe_mutex_init(svgascreen->swc_mutex); + + LIST_INITHEAD(&svgascreen->cached_buffers); + + svga_screen_cache_init(svgascreen); + + return screen; +error2: + FREE(svgascreen); +error1: + return NULL; +} + +void svga_screen_flush( struct svga_screen *svgascreen, + struct pipe_fence_handle **pfence ) +{ + struct pipe_fence_handle *fence = NULL; + + SVGA_DBG(DEBUG_PERF, "%s\n", __FUNCTION__); + + pipe_mutex_lock(svgascreen->swc_mutex); + svgascreen->swc->flush(svgascreen->swc, &fence); + pipe_mutex_unlock(svgascreen->swc_mutex); + + svga_screen_cache_flush(svgascreen, fence); + + if(pfence) + *pfence = fence; + else + svgascreen->sws->fence_reference(svgascreen->sws, &fence, NULL); +} + +struct svga_winsys_screen * +svga_winsys_screen(struct pipe_screen *screen) +{ + return svga_screen(screen)->sws; +} + +#ifdef DEBUG +struct svga_screen * +svga_screen(struct pipe_screen *screen) +{ + assert(screen); + assert(screen->destroy == svga_destroy_screen); + return (struct svga_screen *)screen; +} +#endif diff --git a/src/gallium/drivers/svga/svga_screen.h b/src/gallium/drivers/svga/svga_screen.h new file mode 100644 index 0000000000..b94ca7fc1c --- /dev/null +++ b/src/gallium/drivers/svga/svga_screen.h @@ -0,0 +1,95 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#ifndef SVGA_SCREEN_H +#define SVGA_SCREEN_H + + +#include "pipe/p_screen.h" +#include "pipe/p_thread.h" + +#include "util/u_double_list.h" + +#include "svga_screen_cache.h" + + +struct svga_winsys_screen; +struct svga_winsys_context; +struct SVGACmdMemory; + +#define SVGA_COMBINE_USERBUFFERS 1 + +/** + * Subclass of pipe_screen + */ +struct svga_screen +{ + struct pipe_screen screen; + struct svga_winsys_screen *sws; + + unsigned use_ps30; + unsigned use_vs30; + + struct { + boolean force_level_surface_view; + boolean force_surface_view; + boolean no_surface_view; + boolean force_sampler_view; + boolean no_sampler_view; + } debug; + + /* The screen needs its own context */ + struct svga_winsys_context *swc; + struct SVGACmdMemory *fifo; + + unsigned texture_timestamp; + pipe_mutex tex_mutex; + pipe_mutex swc_mutex; /* Protects the use of swc and dirty_buffers */ + + /** + * List of buffers with cached GMR. Ordered from the most recently used to + * the least recently used + */ + struct list_head cached_buffers; + + struct svga_host_surface_cache cache; +}; + +#ifndef DEBUG +/** cast wrapper */ +static INLINE struct svga_screen * +svga_screen(struct pipe_screen *pscreen) +{ + return (struct svga_screen *) pscreen; +} +#else +struct svga_screen * +svga_screen(struct pipe_screen *screen); +#endif + +void svga_screen_flush( struct svga_screen *svga_screen, + struct pipe_fence_handle **pfence ); + +#endif /* SVGA_SCREEN_H */ diff --git a/src/gallium/drivers/svga/svga_screen_buffer.c b/src/gallium/drivers/svga/svga_screen_buffer.c new file mode 100644 index 0000000000..3b7811734e --- /dev/null +++ b/src/gallium/drivers/svga/svga_screen_buffer.c @@ -0,0 +1,820 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "svga_cmd.h" + +#include "pipe/p_state.h" +#include "pipe/p_defines.h" +#include "pipe/p_inlines.h" +#include "pipe/p_thread.h" +#include "util/u_math.h" +#include "util/u_memory.h" + +#include "svga_context.h" +#include "svga_screen.h" +#include "svga_screen_buffer.h" +#include "svga_winsys.h" +#include "svga_debug.h" + + +/** + * Vertex and index buffers have to be treated slightly differently from + * regular guest memory regions because the SVGA device sees them as + * surfaces, and the state tracker can create/destroy without the pipe + * driver, therefore we must do the uploads from the vws. + */ +static INLINE boolean +svga_buffer_needs_hw_storage(unsigned usage) +{ + return usage & (PIPE_BUFFER_USAGE_VERTEX | PIPE_BUFFER_USAGE_INDEX); +} + + +static INLINE enum pipe_error +svga_buffer_create_host_surface(struct svga_screen *ss, + struct svga_buffer *sbuf) +{ + if(!sbuf->handle) { + sbuf->key.flags = 0; + + sbuf->key.format = SVGA3D_BUFFER; + if(sbuf->base.usage & PIPE_BUFFER_USAGE_VERTEX) + sbuf->key.flags |= SVGA3D_SURFACE_HINT_VERTEXBUFFER; + if(sbuf->base.usage & PIPE_BUFFER_USAGE_INDEX) + sbuf->key.flags |= SVGA3D_SURFACE_HINT_INDEXBUFFER; + + sbuf->key.size.width = sbuf->base.size; + sbuf->key.size.height = 1; + sbuf->key.size.depth = 1; + + sbuf->key.numFaces = 1; + sbuf->key.numMipLevels = 1; + + sbuf->handle = svga_screen_surface_create(ss, &sbuf->key); + if(!sbuf->handle) + return PIPE_ERROR_OUT_OF_MEMORY; + + /* Always set the discard flag on the first time the buffer is written + * as svga_screen_surface_create might have passed a recycled host + * buffer. + */ + sbuf->hw.flags.discard = TRUE; + + SVGA_DBG(DEBUG_DMA, " grab sid %p sz %d\n", sbuf->handle, sbuf->base.size); + } + + return PIPE_OK; +} + + +static INLINE void +svga_buffer_destroy_host_surface(struct svga_screen *ss, + struct svga_buffer *sbuf) +{ + if(sbuf->handle) { + SVGA_DBG(DEBUG_DMA, " ungrab sid %p sz %d\n", sbuf->handle, sbuf->base.size); + svga_screen_surface_destroy(ss, &sbuf->key, &sbuf->handle); + } +} + + +static INLINE void +svga_buffer_destroy_hw_storage(struct svga_screen *ss, struct svga_buffer *sbuf) +{ + struct svga_winsys_screen *sws = ss->sws; + + assert(!sbuf->map.count); + assert(sbuf->hw.buf); + if(sbuf->hw.buf) { + sws->buffer_destroy(sws, sbuf->hw.buf); + sbuf->hw.buf = NULL; + assert(sbuf->head.prev && sbuf->head.next); + LIST_DEL(&sbuf->head); +#ifdef DEBUG + sbuf->head.next = sbuf->head.prev = NULL; +#endif + } +} + +static INLINE enum pipe_error +svga_buffer_backup(struct svga_screen *ss, struct svga_buffer *sbuf) +{ + if (sbuf->hw.buf && sbuf->hw.num_ranges) { + void *src; + + if (!sbuf->swbuf) + sbuf->swbuf = align_malloc(sbuf->base.size, sbuf->base.alignment); + if (!sbuf->swbuf) + return PIPE_ERROR_OUT_OF_MEMORY; + + src = ss->sws->buffer_map(ss->sws, sbuf->hw.buf, + PIPE_BUFFER_USAGE_CPU_READ); + if (!src) + return PIPE_ERROR; + + memcpy(sbuf->swbuf, src, sbuf->base.size); + ss->sws->buffer_unmap(ss->sws, sbuf->hw.buf); + } + + return PIPE_OK; +} + +/** + * Try to make GMR space available by freeing the hardware storage of + * unmapped + */ +boolean +svga_buffer_free_cached_hw_storage(struct svga_screen *ss) +{ + struct list_head *curr; + struct svga_buffer *sbuf; + enum pipe_error ret = PIPE_OK; + + curr = ss->cached_buffers.prev; + + /* free the least recently used buffer's hw storage which is not mapped */ + do { + if(curr == &ss->cached_buffers) + return FALSE; + + sbuf = LIST_ENTRY(struct svga_buffer, curr, head); + + curr = curr->prev; + if (sbuf->map.count == 0) + ret = svga_buffer_backup(ss, sbuf); + + } while(sbuf->map.count != 0 || ret != PIPE_OK); + + svga_buffer_destroy_hw_storage(ss, sbuf); + + return TRUE; +} + +struct svga_winsys_buffer * +svga_winsys_buffer_create( struct svga_screen *ss, + unsigned alignment, + unsigned usage, + unsigned size ) +{ + struct svga_winsys_screen *sws = ss->sws; + struct svga_winsys_buffer *buf; + + /* Just try */ + buf = sws->buffer_create(sws, alignment, usage, size); + if(!buf) { + + SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "flushing screen to find %d bytes GMR\n", + size); + + /* Try flushing all pending DMAs */ + svga_screen_flush(ss, NULL); + buf = sws->buffer_create(sws, alignment, usage, size); + + SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "evicting buffers to find %d bytes GMR\n", + size); + + /* Try evicing all buffer storage */ + while(!buf && svga_buffer_free_cached_hw_storage(ss)) + buf = sws->buffer_create(sws, alignment, usage, size); + } + + return buf; +} + + +/** + * Allocate DMA'ble storage for the buffer. + * + * Called before mapping a buffer. + */ +static INLINE enum pipe_error +svga_buffer_create_hw_storage(struct svga_screen *ss, + struct svga_buffer *sbuf) +{ + if(!sbuf->hw.buf) { + unsigned alignment = sbuf->base.alignment; + unsigned usage = 0; + unsigned size = sbuf->base.size; + + sbuf->hw.buf = svga_winsys_buffer_create(ss, alignment, usage, size); + if(!sbuf->hw.buf) + return PIPE_ERROR_OUT_OF_MEMORY; + + assert(!sbuf->needs_flush); + assert(!sbuf->head.prev && !sbuf->head.next); + LIST_ADD(&sbuf->head, &ss->cached_buffers); + } + + return PIPE_OK; +} + + +/** + * Variant of SVGA3D_BufferDMA which leaves the copy box temporarily in blank. + */ +static enum pipe_error +svga_buffer_upload_command(struct svga_context *svga, + struct svga_buffer *sbuf) +{ + struct svga_winsys_context *swc = svga->swc; + struct svga_winsys_buffer *guest = sbuf->hw.buf; + struct svga_winsys_surface *host = sbuf->handle; + SVGA3dTransferType transfer = SVGA3D_WRITE_HOST_VRAM; + SVGA3dSurfaceDMAFlags flags = sbuf->hw.flags; + SVGA3dCmdSurfaceDMA *cmd; + uint32 numBoxes = sbuf->hw.num_ranges; + SVGA3dCopyBox *boxes; + SVGA3dCmdSurfaceDMASuffix *pSuffix; + unsigned region_flags; + unsigned surface_flags; + struct pipe_buffer *dummy; + + if(transfer == SVGA3D_WRITE_HOST_VRAM) { + region_flags = PIPE_BUFFER_USAGE_GPU_READ; + surface_flags = PIPE_BUFFER_USAGE_GPU_WRITE; + } + else if(transfer == SVGA3D_READ_HOST_VRAM) { + region_flags = PIPE_BUFFER_USAGE_GPU_WRITE; + surface_flags = PIPE_BUFFER_USAGE_GPU_READ; + } + else { + assert(0); + return PIPE_ERROR_BAD_INPUT; + } + + assert(numBoxes); + + cmd = SVGA3D_FIFOReserve(swc, + SVGA_3D_CMD_SURFACE_DMA, + sizeof *cmd + numBoxes * sizeof *boxes + sizeof *pSuffix, + 2); + if(!cmd) + return PIPE_ERROR_OUT_OF_MEMORY; + + swc->region_relocation(swc, &cmd->guest.ptr, guest, 0, region_flags); + cmd->guest.pitch = 0; + + swc->surface_relocation(swc, &cmd->host.sid, host, surface_flags); + cmd->host.face = 0; + cmd->host.mipmap = 0; + + cmd->transfer = transfer; + + sbuf->hw.boxes = (SVGA3dCopyBox *)&cmd[1]; + sbuf->hw.svga = svga; + + /* Increment reference count */ + dummy = NULL; + pipe_buffer_reference(&dummy, &sbuf->base); + + pSuffix = (SVGA3dCmdSurfaceDMASuffix *)((uint8_t*)cmd + sizeof *cmd + numBoxes * sizeof *boxes); + pSuffix->suffixSize = sizeof *pSuffix; + pSuffix->maximumOffset = sbuf->base.size; + pSuffix->flags = flags; + + swc->commit(swc); + + return PIPE_OK; +} + + +/** + * Patch up the upload DMA command reserved by svga_buffer_upload_command + * with the final ranges. + */ +static void +svga_buffer_upload_flush(struct svga_context *svga, + struct svga_buffer *sbuf) +{ + struct svga_screen *ss = svga_screen(svga->pipe.screen); + SVGA3dCopyBox *boxes; + unsigned i; + + assert(sbuf->handle); + assert(sbuf->hw.buf); + assert(sbuf->hw.num_ranges); + assert(sbuf->hw.svga == svga); + assert(sbuf->hw.boxes); + + /* + * Patch the DMA command with the final copy box. + */ + + SVGA_DBG(DEBUG_DMA, "dma to sid %p\n", sbuf->handle); + + boxes = sbuf->hw.boxes; + for(i = 0; i < sbuf->hw.num_ranges; ++i) { + SVGA_DBG(DEBUG_DMA, " bytes %u - %u\n", + sbuf->hw.ranges[i].start, sbuf->hw.ranges[i].end); + + boxes[i].x = sbuf->hw.ranges[i].start; + boxes[i].y = 0; + boxes[i].z = 0; + boxes[i].w = sbuf->hw.ranges[i].end - sbuf->hw.ranges[i].start; + boxes[i].h = 1; + boxes[i].d = 1; + boxes[i].srcx = sbuf->hw.ranges[i].start; + boxes[i].srcy = 0; + boxes[i].srcz = 0; + } + + sbuf->hw.num_ranges = 0; + memset(&sbuf->hw.flags, 0, sizeof sbuf->hw.flags); + + assert(sbuf->head.prev && sbuf->head.next); + LIST_DEL(&sbuf->head); + sbuf->needs_flush = FALSE; + /* XXX: do we care about cached_buffers any more ?*/ + LIST_ADD(&sbuf->head, &ss->cached_buffers); + + sbuf->hw.svga = NULL; + sbuf->hw.boxes = NULL; + + /* Decrement reference count */ + pipe_buffer_reference((struct pipe_buffer **)&sbuf, NULL); +} + + +/** + * Queue a DMA upload of a range of this buffer to the host. + * + * This function only notes the range down. It doesn't actually emit a DMA + * upload command. That only happens when a context tries to refer to this + * buffer, and the DMA upload command is added to that context's command buffer. + * + * We try to lump as many contiguous DMA transfers together as possible. + */ +static void +svga_buffer_upload_queue(struct svga_buffer *sbuf, + unsigned start, + unsigned end) +{ + unsigned i; + + assert(sbuf->hw.buf); + assert(end > start); + + /* + * Try to grow one of the ranges. + * + * Note that it is not this function task to care about overlapping ranges, + * as the GMR was already given so it is too late to do anything. Situations + * where overlapping ranges may pose a problem should be detected via + * pipe_context::is_buffer_referenced and the context that refers to the + * buffer should be flushed. + */ + + for(i = 0; i < sbuf->hw.num_ranges; ++i) { + if(start <= sbuf->hw.ranges[i].end && sbuf->hw.ranges[i].start <= end) { + sbuf->hw.ranges[i].start = MIN2(sbuf->hw.ranges[i].start, start); + sbuf->hw.ranges[i].end = MAX2(sbuf->hw.ranges[i].end, end); + return; + } + } + + /* + * We cannot add a new range to an existing DMA command, so patch-up the + * pending DMA upload and start clean. + */ + + if(sbuf->needs_flush) + svga_buffer_upload_flush(sbuf->hw.svga, sbuf); + + assert(!sbuf->needs_flush); + assert(!sbuf->hw.svga); + assert(!sbuf->hw.boxes); + + /* + * Add a new range. + */ + + sbuf->hw.ranges[sbuf->hw.num_ranges].start = start; + sbuf->hw.ranges[sbuf->hw.num_ranges].end = end; + ++sbuf->hw.num_ranges; +} + + +static void * +svga_buffer_map_range( struct pipe_screen *screen, + struct pipe_buffer *buf, + unsigned offset, unsigned length, + unsigned usage ) +{ + struct svga_screen *ss = svga_screen(screen); + struct svga_winsys_screen *sws = ss->sws; + struct svga_buffer *sbuf = svga_buffer( buf ); + void *map; + + if(sbuf->swbuf) { + /* User/malloc buffer */ + map = sbuf->swbuf; + } + else { + if(!sbuf->hw.buf) { + struct svga_winsys_surface *handle = sbuf->handle; + + if(svga_buffer_create_hw_storage(ss, sbuf) != PIPE_OK) + return NULL; + + /* Populate the hardware storage if the host surface pre-existed */ + if((usage & PIPE_BUFFER_USAGE_CPU_READ) && handle) { + SVGA3dSurfaceDMAFlags flags; + enum pipe_error ret; + struct pipe_fence_handle *fence = NULL; + + SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "dma from sid %p, bytes %u - %u\n", + sbuf->handle, 0, sbuf->base.size); + + memset(&flags, 0, sizeof flags); + + ret = SVGA3D_BufferDMA(ss->swc, + sbuf->hw.buf, + sbuf->handle, + SVGA3D_READ_HOST_VRAM, + sbuf->base.size, + 0, + flags); + if(ret != PIPE_OK) { + ss->swc->flush(ss->swc, NULL); + + ret = SVGA3D_BufferDMA(ss->swc, + sbuf->hw.buf, + sbuf->handle, + SVGA3D_READ_HOST_VRAM, + sbuf->base.size, + 0, + flags); + assert(ret == PIPE_OK); + } + + ss->swc->flush(ss->swc, &fence); + sws->fence_finish(sws, fence, 0); + sws->fence_reference(sws, &fence, NULL); + } + } + else { + if((usage & PIPE_BUFFER_USAGE_CPU_READ) && !sbuf->needs_flush) { + /* We already had the hardware storage but we would have to issue + * a download if we hadn't, so move the buffer to the begginning + * of the LRU list. + */ + assert(sbuf->head.prev && sbuf->head.next); + LIST_DEL(&sbuf->head); + LIST_ADD(&sbuf->head, &ss->cached_buffers); + } + } + + map = sws->buffer_map(sws, sbuf->hw.buf, usage); + } + + if(map) { + pipe_mutex_lock(ss->swc_mutex); + + ++sbuf->map.count; + + if (usage & PIPE_BUFFER_USAGE_CPU_WRITE) { + assert(sbuf->map.count <= 1); + sbuf->map.writing = TRUE; + if (usage & PIPE_BUFFER_USAGE_FLUSH_EXPLICIT) + sbuf->map.flush_explicit = TRUE; + } + + pipe_mutex_unlock(ss->swc_mutex); + } + + return map; +} + +static void +svga_buffer_flush_mapped_range( struct pipe_screen *screen, + struct pipe_buffer *buf, + unsigned offset, unsigned length) +{ + struct svga_buffer *sbuf = svga_buffer( buf ); + struct svga_screen *ss = svga_screen(screen); + + pipe_mutex_lock(ss->swc_mutex); + assert(sbuf->map.writing); + if(sbuf->map.writing) { + assert(sbuf->map.flush_explicit); + if(sbuf->hw.buf) + svga_buffer_upload_queue(sbuf, offset, offset + length); + } + pipe_mutex_unlock(ss->swc_mutex); +} + +static void +svga_buffer_unmap( struct pipe_screen *screen, + struct pipe_buffer *buf) +{ + struct svga_screen *ss = svga_screen(screen); + struct svga_winsys_screen *sws = ss->sws; + struct svga_buffer *sbuf = svga_buffer( buf ); + + pipe_mutex_lock(ss->swc_mutex); + + assert(sbuf->map.count); + if(sbuf->map.count) + --sbuf->map.count; + + if(sbuf->hw.buf) + sws->buffer_unmap(sws, sbuf->hw.buf); + + if(sbuf->map.writing) { + if(!sbuf->map.flush_explicit) { + /* No mapped range was flushed -- flush the whole buffer */ + SVGA_DBG(DEBUG_DMA, "flushing the whole buffer\n"); + + if(sbuf->hw.buf) + svga_buffer_upload_queue(sbuf, 0, sbuf->base.size); + } + + sbuf->map.writing = FALSE; + sbuf->map.flush_explicit = FALSE; + } + + pipe_mutex_unlock(ss->swc_mutex); +} + +static void +svga_buffer_destroy( struct pipe_buffer *buf ) +{ + struct svga_screen *ss = svga_screen(buf->screen); + struct svga_buffer *sbuf = svga_buffer( buf ); + + assert(!p_atomic_read(&buf->reference.count)); + + assert(!sbuf->needs_flush); + + if(sbuf->handle) { + SVGA_DBG(DEBUG_DMA, "release sid %p sz %d\n", sbuf->handle, sbuf->base.size); + svga_screen_surface_destroy(ss, &sbuf->key, &sbuf->handle); + } + + if(sbuf->hw.buf) + svga_buffer_destroy_hw_storage(ss, sbuf); + + if(sbuf->swbuf && !sbuf->user) + align_free(sbuf->swbuf); + + FREE(sbuf); +} + +static struct pipe_buffer * +svga_buffer_create(struct pipe_screen *screen, + unsigned alignment, + unsigned usage, + unsigned size) +{ + struct svga_screen *ss = svga_screen(screen); + struct svga_buffer *sbuf; + + sbuf = CALLOC_STRUCT(svga_buffer); + if(!sbuf) + goto error1; + + sbuf->magic = SVGA_BUFFER_MAGIC; + + pipe_reference_init(&sbuf->base.reference, 1); + sbuf->base.screen = screen; + sbuf->base.alignment = alignment; + sbuf->base.usage = usage; + sbuf->base.size = size; + + if(svga_buffer_needs_hw_storage(usage)) { + if(svga_buffer_create_host_surface(ss, sbuf) != PIPE_OK) + goto error2; + } + else { + if(alignment < sizeof(void*)) + alignment = sizeof(void*); + + usage |= PIPE_BUFFER_USAGE_CPU_READ_WRITE; + + sbuf->swbuf = align_malloc(size, alignment); + if(!sbuf->swbuf) + goto error2; + } + + return &sbuf->base; + +error2: + FREE(sbuf); +error1: + return NULL; +} + +static struct pipe_buffer * +svga_user_buffer_create(struct pipe_screen *screen, + void *ptr, + unsigned bytes) +{ + struct svga_buffer *sbuf; + + sbuf = CALLOC_STRUCT(svga_buffer); + if(!sbuf) + goto no_sbuf; + + sbuf->magic = SVGA_BUFFER_MAGIC; + + sbuf->swbuf = ptr; + sbuf->user = TRUE; + + pipe_reference_init(&sbuf->base.reference, 1); + sbuf->base.screen = screen; + sbuf->base.alignment = 1; + sbuf->base.usage = 0; + sbuf->base.size = bytes; + + return &sbuf->base; + +no_sbuf: + return NULL; +} + + +void +svga_screen_init_buffer_functions(struct pipe_screen *screen) +{ + screen->buffer_create = svga_buffer_create; + screen->user_buffer_create = svga_user_buffer_create; + screen->buffer_map_range = svga_buffer_map_range; + screen->buffer_flush_mapped_range = svga_buffer_flush_mapped_range; + screen->buffer_unmap = svga_buffer_unmap; + screen->buffer_destroy = svga_buffer_destroy; +} + + +/** + * Copy the contents of the user buffer / malloc buffer to a hardware buffer. + */ +static INLINE enum pipe_error +svga_buffer_update_hw(struct svga_screen *ss, struct svga_buffer *sbuf) +{ + if(!sbuf->hw.buf) { + enum pipe_error ret; + void *map; + + assert(sbuf->swbuf); + if(!sbuf->swbuf) + return PIPE_ERROR; + + ret = svga_buffer_create_hw_storage(ss, sbuf); + assert(ret == PIPE_OK); + if(ret != PIPE_OK) + return ret; + + pipe_mutex_lock(ss->swc_mutex); + map = ss->sws->buffer_map(ss->sws, sbuf->hw.buf, PIPE_BUFFER_USAGE_CPU_WRITE); + assert(map); + if(!map) { + pipe_mutex_unlock(ss->swc_mutex); + return PIPE_ERROR_OUT_OF_MEMORY; + } + + memcpy(map, sbuf->swbuf, sbuf->base.size); + ss->sws->buffer_unmap(ss->sws, sbuf->hw.buf); + + /* This user/malloc buffer is now indistinguishable from a gpu buffer */ + assert(!sbuf->map.count); + if(!sbuf->map.count) { + if(sbuf->user) + sbuf->user = FALSE; + else + align_free(sbuf->swbuf); + sbuf->swbuf = NULL; + } + + svga_buffer_upload_queue(sbuf, 0, sbuf->base.size); + } + + pipe_mutex_unlock(ss->swc_mutex); + return PIPE_OK; +} + + +struct svga_winsys_surface * +svga_buffer_handle(struct svga_context *svga, + struct pipe_buffer *buf) +{ + struct pipe_screen *screen = svga->pipe.screen; + struct svga_screen *ss = svga_screen(screen); + struct svga_buffer *sbuf; + enum pipe_error ret; + + if(!buf) + return NULL; + + sbuf = svga_buffer(buf); + + assert(!sbuf->map.count); + + if(!sbuf->handle) { + ret = svga_buffer_create_host_surface(ss, sbuf); + if(ret != PIPE_OK) + return NULL; + + ret = svga_buffer_update_hw(ss, sbuf); + if(ret != PIPE_OK) + return NULL; + } + + if(!sbuf->needs_flush && sbuf->hw.num_ranges) { + /* Queue the buffer for flushing */ + ret = svga_buffer_upload_command(svga, sbuf); + if(ret != PIPE_OK) + /* XXX: Should probably have a richer return value */ + return NULL; + + assert(sbuf->hw.svga == svga); + + sbuf->needs_flush = TRUE; + assert(sbuf->head.prev && sbuf->head.next); + LIST_DEL(&sbuf->head); + LIST_ADDTAIL(&sbuf->head, &svga->dirty_buffers); + } + + return sbuf->handle; +} + +struct pipe_buffer * +svga_screen_buffer_wrap_surface(struct pipe_screen *screen, + enum SVGA3dSurfaceFormat format, + struct svga_winsys_surface *srf) +{ + struct pipe_buffer *buf; + struct svga_buffer *sbuf; + struct svga_winsys_screen *sws = svga_winsys_screen(screen); + + buf = svga_buffer_create(screen, 0, SVGA_BUFFER_USAGE_WRAPPED, 0); + if (!buf) + return NULL; + + sbuf = svga_buffer(buf); + + /* + * We are not the creator of this surface and therefore we must not + * cache it for reuse. The caching code only caches SVGA3D_BUFFER surfaces + * so make sure this isn't one of those. + */ + + assert(format != SVGA3D_BUFFER); + sbuf->key.format = format; + sws->surface_reference(sws, &sbuf->handle, srf); + + return buf; +} + + +struct svga_winsys_surface * +svga_screen_buffer_get_winsys_surface(struct pipe_buffer *buffer) +{ + struct svga_winsys_screen *sws = svga_winsys_screen(buffer->screen); + struct svga_winsys_surface *vsurf = NULL; + + sws->surface_reference(sws, &vsurf, svga_buffer(buffer)->handle); + return vsurf; +} + +void +svga_context_flush_buffers(struct svga_context *svga) +{ + struct list_head *curr, *next; + struct svga_buffer *sbuf; + + curr = svga->dirty_buffers.next; + next = curr->next; + while(curr != &svga->dirty_buffers) { + sbuf = LIST_ENTRY(struct svga_buffer, curr, head); + + assert(p_atomic_read(&sbuf->base.reference.count) != 0); + assert(sbuf->needs_flush); + + svga_buffer_upload_flush(svga, sbuf); + + curr = next; + next = curr->next; + } +} diff --git a/src/gallium/drivers/svga/svga_screen_buffer.h b/src/gallium/drivers/svga/svga_screen_buffer.h new file mode 100644 index 0000000000..5d7af5a7c5 --- /dev/null +++ b/src/gallium/drivers/svga/svga_screen_buffer.h @@ -0,0 +1,190 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#ifndef SVGA_BUFFER_H +#define SVGA_BUFFER_H + + +#include "pipe/p_compiler.h" +#include "pipe/p_state.h" + +#include "util/u_double_list.h" + +#include "svga_screen_cache.h" + + +#define SVGA_BUFFER_MAGIC 0x344f9005 + +/** + * Maximum number of discontiguous ranges + */ +#define SVGA_BUFFER_MAX_RANGES 32 + + +struct svga_screen; +struct svga_context; +struct svga_winsys_buffer; +struct svga_winsys_surface; + + +struct svga_buffer_range +{ + unsigned start; + unsigned end; +}; + + +/** + * Describe a + * + * This holds the information to emit a SVGA3dCmdSurfaceDMA. + */ +struct svga_buffer_upload +{ + /** + * Guest memory region. + */ + struct svga_winsys_buffer *buf; + + struct svga_buffer_range ranges[SVGA_BUFFER_MAX_RANGES]; + unsigned num_ranges; + + SVGA3dSurfaceDMAFlags flags; + + /** + * Pointer to the DMA copy box *inside* the command buffer. + */ + SVGA3dCopyBox *boxes; + + /** + * Context that has the pending DMA to this buffer. + */ + struct svga_context *svga; +}; + + +/** + * SVGA pipe buffer. + */ +struct svga_buffer +{ + struct pipe_buffer base; + + /** + * Marker to detect bad casts in runtime. + */ + uint32_t magic; + + /** + * Regular (non DMA'able) memory. + * + * Used for user buffers or for buffers which we know before hand that can + * never be used by the virtual hardware directly, such as constant buffers. + */ + void *swbuf; + + /** + * Whether swbuf was created by the user or not. + */ + boolean user; + + /** + * DMA'ble memory. + * + * A piece of GMR memory. It is created when mapping the buffer, and will be + * used to upload/download vertex data from the host. + */ + struct svga_buffer_upload hw; + + /** + * Creation key for the host surface handle. + * + * This structure describes all the host surface characteristics so that it + * can be looked up in cache, since creating a host surface is often a slow + * operation. + */ + struct svga_host_surface_cache_key key; + + /** + * Host surface handle. + * + * This is a platform independent abstraction for host SID. We create when + * trying to bind + */ + struct svga_winsys_surface *handle; + + struct { + unsigned count; + boolean writing; + boolean flush_explicit; + } map; + + boolean needs_flush; + struct list_head head; +}; + + +static INLINE struct svga_buffer * +svga_buffer(struct pipe_buffer *buffer) +{ + if (buffer) { + assert(((struct svga_buffer *)buffer)->magic == SVGA_BUFFER_MAGIC); + return (struct svga_buffer *)buffer; + } + return NULL; +} + + +/** + * Returns TRUE for user buffers. We may + * decide to use an alternate upload path for these buffers. + */ +static INLINE boolean +svga_buffer_is_user_buffer( struct pipe_buffer *buffer ) +{ + return svga_buffer(buffer)->user; +} + + +void +svga_screen_init_buffer_functions(struct pipe_screen *screen); + +struct svga_winsys_surface * +svga_buffer_handle(struct svga_context *svga, + struct pipe_buffer *buf); + +void +svga_context_flush_buffers(struct svga_context *svga); + +boolean +svga_buffer_free_cached_hw_storage(struct svga_screen *ss); + +struct svga_winsys_buffer * +svga_winsys_buffer_create(struct svga_screen *ss, + unsigned alignment, + unsigned usage, + unsigned size); + +#endif /* SVGA_BUFFER_H */ diff --git a/src/gallium/drivers/svga/svga_screen_cache.c b/src/gallium/drivers/svga/svga_screen_cache.c new file mode 100644 index 0000000000..7360c1688b --- /dev/null +++ b/src/gallium/drivers/svga/svga_screen_cache.c @@ -0,0 +1,307 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "util/u_memory.h" + +#include "svga_debug.h" +#include "svga_winsys.h" +#include "svga_screen.h" +#include "svga_screen_cache.h" + + +#define SVGA_SURFACE_CACHE_ENABLED 1 + + +/** + * Compute the bucket for this key. + * + * We simply compute log2(width) for now, but + */ +static INLINE unsigned +svga_screen_cache_bucket(const struct svga_host_surface_cache_key *key) +{ + unsigned bucket = 0; + unsigned size = key->size.width; + + while ((size >>= 1)) + ++bucket; + + if(key->flags & SVGA3D_SURFACE_HINT_INDEXBUFFER) + bucket += 32; + + assert(bucket < SVGA_HOST_SURFACE_CACHE_BUCKETS); + + return bucket; +} + + +static INLINE struct svga_winsys_surface * +svga_screen_cache_lookup(struct svga_screen *svgascreen, + const struct svga_host_surface_cache_key *key) +{ + struct svga_host_surface_cache *cache = &svgascreen->cache; + struct svga_winsys_screen *sws = svgascreen->sws; + struct svga_host_surface_cache_entry *entry; + struct svga_winsys_surface *handle = NULL; + struct list_head *curr, *next; + unsigned bucket; + unsigned tries = 0; + + bucket = svga_screen_cache_bucket(key); + + pipe_mutex_lock(cache->mutex); + + curr = cache->bucket[bucket].next; + next = curr->next; + while(curr != &cache->bucket[bucket]) { + ++tries; + + entry = LIST_ENTRY(struct svga_host_surface_cache_entry, curr, bucket_head); + + assert(entry->handle); + + if(memcmp(&entry->key, key, sizeof *key) == 0 && + sws->fence_signalled( sws, entry->fence, 0 ) == 0) { + assert(sws->surface_is_flushed(sws, entry->handle)); + + handle = entry->handle; // Reference is transfered here. + entry->handle = NULL; + + LIST_DEL(&entry->bucket_head); + + LIST_DEL(&entry->head); + + LIST_ADD(&entry->head, &cache->empty); + + break; + } + + curr = next; + next = curr->next; + } + + pipe_mutex_unlock(cache->mutex); + +#if 0 + _debug_printf("%s: cache %s after %u tries\n", __FUNCTION__, handle ? "hit" : "miss", tries); +#else + (void)tries; +#endif + + return handle; +} + + +/* + * Transfers a handle reference. + */ + +static INLINE void +svga_screen_cache_add(struct svga_screen *svgascreen, + const struct svga_host_surface_cache_key *key, + struct svga_winsys_surface **p_handle) +{ + struct svga_host_surface_cache *cache = &svgascreen->cache; + struct svga_winsys_screen *sws = svgascreen->sws; + struct svga_host_surface_cache_entry *entry = NULL; + struct svga_winsys_surface *handle = *p_handle; + + + assert(handle); + if(!handle) + return; + + *p_handle = NULL; + pipe_mutex_lock(cache->mutex); + + if(!LIST_IS_EMPTY(&cache->empty)) { + /* use the first empty entry */ + entry = LIST_ENTRY(struct svga_host_surface_cache_entry, cache->empty.next, head); + + LIST_DEL(&entry->head); + } + else if(!LIST_IS_EMPTY(&cache->unused)) { + /* free the last used buffer and reuse its entry */ + entry = LIST_ENTRY(struct svga_host_surface_cache_entry, cache->unused.prev, head); + SVGA_DBG(DEBUG_DMA, "unref sid %p\n", entry->handle); + sws->surface_reference(sws, &entry->handle, NULL); + + LIST_DEL(&entry->bucket_head); + + LIST_DEL(&entry->head); + } + + if(entry) { + entry->handle = handle; + memcpy(&entry->key, key, sizeof entry->key); + + LIST_ADD(&entry->head, &cache->validated); + } + else { + /* Couldn't cache the buffer -- this really shouldn't happen */ + SVGA_DBG(DEBUG_DMA, "unref sid %p\n", handle); + sws->surface_reference(sws, &handle, NULL); + } + + pipe_mutex_unlock(cache->mutex); +} + + +/** + * Called during the screen flush to move all buffers not in a validate list + * into the unused list. + */ +void +svga_screen_cache_flush(struct svga_screen *svgascreen, + struct pipe_fence_handle *fence) +{ + struct svga_host_surface_cache *cache = &svgascreen->cache; + struct svga_winsys_screen *sws = svgascreen->sws; + struct svga_host_surface_cache_entry *entry; + struct list_head *curr, *next; + unsigned bucket; + + pipe_mutex_lock(cache->mutex); + + curr = cache->validated.next; + next = curr->next; + while(curr != &cache->validated) { + entry = LIST_ENTRY(struct svga_host_surface_cache_entry, curr, head); + + assert(entry->handle); + + if(sws->surface_is_flushed(sws, entry->handle)) { + LIST_DEL(&entry->head); + + svgascreen->sws->fence_reference(svgascreen->sws, &entry->fence, fence); + + LIST_ADD(&entry->head, &cache->unused); + + bucket = svga_screen_cache_bucket(&entry->key); + LIST_ADD(&entry->bucket_head, &cache->bucket[bucket]); + } + + curr = next; + next = curr->next; + } + + pipe_mutex_unlock(cache->mutex); +} + + +void +svga_screen_cache_cleanup(struct svga_screen *svgascreen) +{ + struct svga_host_surface_cache *cache = &svgascreen->cache; + struct svga_winsys_screen *sws = svgascreen->sws; + unsigned i; + + for(i = 0; i < SVGA_HOST_SURFACE_CACHE_SIZE; ++i) { + if(cache->entries[i].handle) { + SVGA_DBG(DEBUG_DMA, "unref sid %p\n", cache->entries[i].handle); + sws->surface_reference(sws, &cache->entries[i].handle, NULL); + } + + if(cache->entries[i].fence) + svgascreen->sws->fence_reference(svgascreen->sws, &cache->entries[i].fence, NULL); + } + + pipe_mutex_destroy(cache->mutex); +} + + +enum pipe_error +svga_screen_cache_init(struct svga_screen *svgascreen) +{ + struct svga_host_surface_cache *cache = &svgascreen->cache; + unsigned i; + + pipe_mutex_init(cache->mutex); + + for(i = 0; i < SVGA_HOST_SURFACE_CACHE_BUCKETS; ++i) + LIST_INITHEAD(&cache->bucket[i]); + + LIST_INITHEAD(&cache->unused); + + LIST_INITHEAD(&cache->validated); + + LIST_INITHEAD(&cache->empty); + for(i = 0; i < SVGA_HOST_SURFACE_CACHE_SIZE; ++i) + LIST_ADDTAIL(&cache->entries[i].head, &cache->empty); + + return PIPE_OK; +} + + +struct svga_winsys_surface * +svga_screen_surface_create(struct svga_screen *svgascreen, + struct svga_host_surface_cache_key *key) +{ + struct svga_winsys_screen *sws = svgascreen->sws; + struct svga_winsys_surface *handle = NULL; + + if (SVGA_SURFACE_CACHE_ENABLED && key->format == SVGA3D_BUFFER) { + /* round the buffer size up to the nearest power of two to increase the + * probability of cache hits */ + uint32_t size = 1; + while(size < key->size.width) + size <<= 1; + key->size.width = size; + + handle = svga_screen_cache_lookup(svgascreen, key); + if (handle) + SVGA_DBG(DEBUG_DMA, " reuse sid %p sz %d\n", handle, size); + } + + if (!handle) { + handle = sws->surface_create(sws, + key->flags, + key->format, + key->size, + key->numFaces, + key->numMipLevels); + if (handle) + SVGA_DBG(DEBUG_DMA, "create sid %p sz %d\n", handle, key->size); + } + + return handle; +} + + +void +svga_screen_surface_destroy(struct svga_screen *svgascreen, + const struct svga_host_surface_cache_key *key, + struct svga_winsys_surface **p_handle) +{ + struct svga_winsys_screen *sws = svgascreen->sws; + + if(SVGA_SURFACE_CACHE_ENABLED && key->format == SVGA3D_BUFFER) { + svga_screen_cache_add(svgascreen, key, p_handle); + } + else { + SVGA_DBG(DEBUG_DMA, "unref sid %p\n", *p_handle); + sws->surface_reference(sws, p_handle, NULL); + } +} diff --git a/src/gallium/drivers/svga/svga_screen_cache.h b/src/gallium/drivers/svga/svga_screen_cache.h new file mode 100644 index 0000000000..1bbe987768 --- /dev/null +++ b/src/gallium/drivers/svga/svga_screen_cache.h @@ -0,0 +1,135 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#ifndef SVGA_SCREEN_CACHE_H_ +#define SVGA_SCREEN_CACHE_H_ + + +#include "svga_types.h" +#include "svga_reg.h" +#include "svga3d_reg.h" + +#include "pipe/p_thread.h" + +#include "util/u_double_list.h" + + +/* TODO: Reduce this once we don't allocate an index buffer per draw call */ +#define SVGA_HOST_SURFACE_CACHE_SIZE 1024 + +#define SVGA_HOST_SURFACE_CACHE_BUCKETS 64 + + +struct svga_winsys_surface; +struct svga_screen; + +/** + * Same as svga_winsys_screen::surface_create. + */ +struct svga_host_surface_cache_key +{ + SVGA3dSurfaceFlags flags; + SVGA3dSurfaceFormat format; + SVGA3dSize size; + uint32_t numFaces; + uint32_t numMipLevels; +}; + + +struct svga_host_surface_cache_entry +{ + /** + * Head for the LRU list, svga_host_surface_cache::unused, and + * svga_host_surface_cache::empty + */ + struct list_head head; + + /** Head for the bucket lists. */ + struct list_head bucket_head; + + struct svga_host_surface_cache_key key; + struct svga_winsys_surface *handle; + + struct pipe_fence_handle *fence; +}; + + +/** + * Cache of the host surfaces. + * + * A cache entry can be in the following stages: + * 1. empty + * 2. holding a buffer in a validate list + * 3. holding a flushed buffer (not in any validate list) with an active fence + * 4. holding a flushed buffer with an expired fence + * + * An entry progresses from 1 -> 2 -> 3 -> 4. When we need an entry to put a + * buffer into we preferencial take from 1, or from the least recentely used + * buffer from 3/4. + */ +struct svga_host_surface_cache +{ + pipe_mutex mutex; + + /* Unused buffers are put in buckets to speed up lookups */ + struct list_head bucket[SVGA_HOST_SURFACE_CACHE_BUCKETS]; + + /* Entries with unused buffers, ordered from most to least recently used + * (3 and 4) */ + struct list_head unused; + + /* Entries with buffers still in validate lists (2) */ + struct list_head validated; + + /** Empty entries (1) */ + struct list_head empty; + + /** The actual storage for the entries */ + struct svga_host_surface_cache_entry entries[SVGA_HOST_SURFACE_CACHE_SIZE]; +}; + + +void +svga_screen_cache_cleanup(struct svga_screen *svgascreen); + +void +svga_screen_cache_flush(struct svga_screen *svgascreen, + struct pipe_fence_handle *fence); + +enum pipe_error +svga_screen_cache_init(struct svga_screen *svgascreen); + + +struct svga_winsys_surface * +svga_screen_surface_create(struct svga_screen *svgascreen, + struct svga_host_surface_cache_key *key); + +void +svga_screen_surface_destroy(struct svga_screen *svgascreen, + const struct svga_host_surface_cache_key *key, + struct svga_winsys_surface **handle); + + +#endif /* SVGA_SCREEN_CACHE_H_ */ diff --git a/src/gallium/drivers/svga/svga_screen_texture.c b/src/gallium/drivers/svga/svga_screen_texture.c new file mode 100644 index 0000000000..8472dea04d --- /dev/null +++ b/src/gallium/drivers/svga/svga_screen_texture.c @@ -0,0 +1,1065 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "svga_cmd.h" + +#include "pipe/p_state.h" +#include "pipe/p_defines.h" +#include "pipe/p_inlines.h" +#include "pipe/p_thread.h" +#include "util/u_math.h" +#include "util/u_memory.h" + +#include "svga_screen.h" +#include "svga_context.h" +#include "svga_screen_texture.h" +#include "svga_screen_buffer.h" +#include "svga_winsys.h" +#include "svga_debug.h" +#include "svga_screen_buffer.h" + +#include + + +/* XXX: This isn't a real hardware flag, but just a hack for kernel to + * know about primary surfaces. Find a better way to accomplish this. + */ +#define SVGA3D_SURFACE_HINT_SCANOUT (1 << 9) + + +/* + * Helper function and arrays + */ + +SVGA3dSurfaceFormat +svga_translate_format(enum pipe_format format) +{ + switch(format) { + + case PIPE_FORMAT_A8R8G8B8_UNORM: + return SVGA3D_A8R8G8B8; + case PIPE_FORMAT_X8R8G8B8_UNORM: + return SVGA3D_X8R8G8B8; + + /* Required for GL2.1: + */ + case PIPE_FORMAT_A8R8G8B8_SRGB: + return SVGA3D_A8R8G8B8; + + case PIPE_FORMAT_R5G6B5_UNORM: + return SVGA3D_R5G6B5; + case PIPE_FORMAT_A1R5G5B5_UNORM: + return SVGA3D_A1R5G5B5; + case PIPE_FORMAT_A4R4G4B4_UNORM: + return SVGA3D_A4R4G4B4; + + + /* XXX: Doesn't seem to work properly. + case PIPE_FORMAT_Z32_UNORM: + return SVGA3D_Z_D32; + */ + case PIPE_FORMAT_Z16_UNORM: + return SVGA3D_Z_D16; + case PIPE_FORMAT_Z24S8_UNORM: + return SVGA3D_Z_D24S8; + case PIPE_FORMAT_Z24X8_UNORM: + return SVGA3D_Z_D24X8; + + case PIPE_FORMAT_A8_UNORM: + return SVGA3D_ALPHA8; + case PIPE_FORMAT_L8_UNORM: + return SVGA3D_LUMINANCE8; + + case PIPE_FORMAT_DXT1_RGB: + case PIPE_FORMAT_DXT1_RGBA: + return SVGA3D_DXT1; + case PIPE_FORMAT_DXT3_RGBA: + return SVGA3D_DXT3; + case PIPE_FORMAT_DXT5_RGBA: + return SVGA3D_DXT5; + + default: + return SVGA3D_FORMAT_INVALID; + } +} + + +SVGA3dSurfaceFormat +svga_translate_format_render(enum pipe_format format) +{ + switch(format) { + case PIPE_FORMAT_A8R8G8B8_UNORM: + case PIPE_FORMAT_X8R8G8B8_UNORM: + case PIPE_FORMAT_A1R5G5B5_UNORM: + case PIPE_FORMAT_A4R4G4B4_UNORM: + case PIPE_FORMAT_R5G6B5_UNORM: + case PIPE_FORMAT_Z24S8_UNORM: + case PIPE_FORMAT_Z24X8_UNORM: + case PIPE_FORMAT_Z32_UNORM: + case PIPE_FORMAT_Z16_UNORM: + case PIPE_FORMAT_L8_UNORM: + return svga_translate_format(format); + +#if 1 + /* For on host conversion */ + case PIPE_FORMAT_DXT1_RGB: + return SVGA3D_X8R8G8B8; + case PIPE_FORMAT_DXT1_RGBA: + case PIPE_FORMAT_DXT3_RGBA: + case PIPE_FORMAT_DXT5_RGBA: + return SVGA3D_A8R8G8B8; +#endif + + default: + return SVGA3D_FORMAT_INVALID; + } +} + + +static INLINE void +svga_transfer_dma_band(struct svga_transfer *st, + SVGA3dTransferType transfer, + unsigned y, unsigned h, unsigned srcy) +{ + struct svga_texture *texture = svga_texture(st->base.texture); + struct svga_screen *screen = svga_screen(texture->base.screen); + SVGA3dCopyBox box; + enum pipe_error ret; + + SVGA_DBG(DEBUG_DMA, "dma %s sid %p, face %u, (%u, %u, %u) - (%u, %u, %u), %ubpp\n", + transfer == SVGA3D_WRITE_HOST_VRAM ? "to" : "from", + texture->handle, + st->base.face, + st->base.x, + y, + st->base.zslice, + st->base.x + st->base.width, + y + h, + st->base.zslice + 1, + texture->base.block.size*8/(texture->base.block.width*texture->base.block.height)); + + box.x = st->base.x; + box.y = y; + box.z = st->base.zslice; + box.w = st->base.width; + box.h = h; + box.d = 1; + box.srcx = 0; + box.srcy = srcy; + box.srcz = 0; + + pipe_mutex_lock(screen->swc_mutex); + ret = SVGA3D_SurfaceDMA(screen->swc, st, transfer, &box, 1); + if(ret != PIPE_OK) { + screen->swc->flush(screen->swc, NULL); + ret = SVGA3D_SurfaceDMA(screen->swc, st, transfer, &box, 1); + assert(ret == PIPE_OK); + } + pipe_mutex_unlock(screen->swc_mutex); +} + + +static INLINE void +svga_transfer_dma(struct svga_transfer *st, + SVGA3dTransferType transfer) +{ + struct svga_texture *texture = svga_texture(st->base.texture); + struct svga_screen *screen = svga_screen(texture->base.screen); + struct svga_winsys_screen *sws = screen->sws; + struct pipe_fence_handle *fence = NULL; + + if (transfer == SVGA3D_READ_HOST_VRAM) { + SVGA_DBG(DEBUG_PERF, "%s: readback transfer\n", __FUNCTION__); + } + + + if(!st->swbuf) { + /* Do the DMA transfer in a single go */ + + svga_transfer_dma_band(st, transfer, st->base.y, st->base.height, 0); + + if(transfer == SVGA3D_READ_HOST_VRAM) { + svga_screen_flush(screen, &fence); + sws->fence_finish(sws, fence, 0); + //sws->fence_reference(sws, &fence, NULL); + } + } + else { + unsigned y, h, srcy; + h = st->hw_nblocksy * st->base.block.height; + srcy = 0; + for(y = 0; y < st->base.height; y += h) { + unsigned offset, length; + void *hw, *sw; + + if (y + h > st->base.height) + h = st->base.height - y; + + /* Transfer band must be aligned to pixel block boundaries */ + assert(y % st->base.block.height == 0); + assert(h % st->base.block.height == 0); + + offset = y * st->base.stride / st->base.block.height; + length = h * st->base.stride / st->base.block.height; + + sw = (uint8_t *)st->swbuf + offset; + + if(transfer == SVGA3D_WRITE_HOST_VRAM) { + /* Wait for the previous DMAs to complete */ + /* TODO: keep one DMA (at half the size) in the background */ + if(y) { + svga_screen_flush(screen, &fence); + sws->fence_finish(sws, fence, 0); + //sws->fence_reference(sws, &fence, NULL); + } + + hw = sws->buffer_map(sws, st->hwbuf, PIPE_BUFFER_USAGE_CPU_WRITE); + assert(hw); + if(hw) { + memcpy(hw, sw, length); + sws->buffer_unmap(sws, st->hwbuf); + } + } + + svga_transfer_dma_band(st, transfer, y, h, srcy); + + if(transfer == SVGA3D_READ_HOST_VRAM) { + svga_screen_flush(screen, &fence); + sws->fence_finish(sws, fence, 0); + + hw = sws->buffer_map(sws, st->hwbuf, PIPE_BUFFER_USAGE_CPU_READ); + assert(hw); + if(hw) { + memcpy(sw, hw, length); + sws->buffer_unmap(sws, st->hwbuf); + } + } + } + } +} + + +static struct pipe_texture * +svga_texture_create(struct pipe_screen *screen, + const struct pipe_texture *templat) +{ + struct svga_screen *svgascreen = svga_screen(screen); + struct svga_winsys_screen *sws = svgascreen->sws; + struct svga_texture *tex = CALLOC_STRUCT(svga_texture); + unsigned width, height, depth; + SVGA3dSurfaceFlags flags = 0; + SVGA3dSurfaceFormat format; + SVGA3dSize size; + uint32 numFaces; + uint32 numMipLevels; + unsigned level; + + if (!tex) + goto error1; + + tex->base = *templat; + pipe_reference_init(&tex->base.reference, 1); + tex->base.screen = screen; + + assert(templat->last_level < SVGA_MAX_TEXTURE_LEVELS); + if(templat->last_level >= SVGA_MAX_TEXTURE_LEVELS) + goto error2; + + width = templat->width[0]; + height = templat->height[0]; + depth = templat->depth[0]; + for(level = 0; level <= templat->last_level; ++level) { + tex->base.width[level] = width; + tex->base.height[level] = height; + tex->base.depth[level] = depth; + tex->base.nblocksx[level] = pf_get_nblocksx(&tex->base.block, width); + tex->base.nblocksy[level] = pf_get_nblocksy(&tex->base.block, height); + width = minify(width); + height = minify(height); + depth = minify(depth); + } + + size.width = templat->width[0]; + size.height = templat->height[0]; + size.depth = templat->depth[0]; + + if(templat->target == PIPE_TEXTURE_CUBE) { + flags |= SVGA3D_SURFACE_CUBEMAP; + numFaces = 6; + } + else { + numFaces = 1; + } + + if(templat->tex_usage & PIPE_TEXTURE_USAGE_SAMPLER) + flags |= SVGA3D_SURFACE_HINT_TEXTURE; + + if(templat->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY) + flags |= SVGA3D_SURFACE_HINT_SCANOUT; + + /* + * XXX: Never pass the SVGA3D_SURFACE_HINT_RENDERTARGET hint. Mesa cannot + * know beforehand whether a texture will be used as a rendertarget or not + * and it always requests PIPE_TEXTURE_USAGE_RENDER_TARGET, therefore + * passing the SVGA3D_SURFACE_HINT_RENDERTARGET here defeats its purpose. + */ +#if 0 + if((templat->tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) && + !pf_is_compressed(templat->format)) + flags |= SVGA3D_SURFACE_HINT_RENDERTARGET; +#endif + + if(templat->tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) + flags |= SVGA3D_SURFACE_HINT_DEPTHSTENCIL; + + numMipLevels = templat->last_level + 1; + + format = svga_translate_format(templat->format); + if(format == SVGA3D_FORMAT_INVALID) + goto error2; + + tex->handle = sws->surface_create(sws, flags, format, size, numFaces, numMipLevels); + if (tex->handle) + SVGA_DBG(DEBUG_DMA, "create sid %p (texture)\n", tex->handle); + + return &tex->base; + +error2: + FREE(tex); +error1: + return NULL; +} + + +static struct pipe_texture * +svga_texture_blanket(struct pipe_screen * screen, + const struct pipe_texture *base, + const unsigned *stride, + struct pipe_buffer *buffer) +{ + struct svga_texture *tex; + struct svga_buffer *sbuf = svga_buffer(buffer); + struct svga_winsys_screen *sws = svga_winsys_screen(screen); + assert(screen); + + /* Only supports one type */ + if (base->target != PIPE_TEXTURE_2D || + base->last_level != 0 || + base->depth[0] != 1) { + return NULL; + } + + /** + * We currently can't do texture blanket on + * SVGA3D_BUFFER. Need to blit to a temporary surface? + */ + + assert(sbuf->handle); + if (!sbuf->handle) + return NULL; + + if (svga_translate_format(base->format) != sbuf->key.format) { + unsigned f1 = svga_translate_format(base->format); + unsigned f2 = sbuf->key.format; + + /* It's okay for XRGB and ARGB or depth with/out stencil to get mixed up */ + if ( !( (f1 == SVGA3D_X8R8G8B8 && f2 == SVGA3D_A8R8G8B8) || + (f1 == SVGA3D_A8R8G8B8 && f2 == SVGA3D_X8R8G8B8) || + (f1 == SVGA3D_Z_D24X8 && f2 == SVGA3D_Z_D24S8) ) ) { + debug_printf("%s wrong format %u != %u\n", __FUNCTION__, f1, f2); + return NULL; + } + } + + tex = CALLOC_STRUCT(svga_texture); + if (!tex) + return NULL; + + tex->base = *base; + + if (sbuf->key.format == 1) + tex->base.format = PIPE_FORMAT_X8R8G8B8_UNORM; + else if (sbuf->key.format == 2) + tex->base.format = PIPE_FORMAT_A8R8G8B8_UNORM; + + pipe_reference_init(&tex->base.reference, 1); + tex->base.screen = screen; + + sws->surface_reference(sws, &tex->handle, sbuf->handle); + + return &tex->base; +} + + +static void +svga_texture_destroy(struct pipe_texture *pt) +{ + struct svga_screen *ss = svga_screen(pt->screen); + struct svga_texture *tex = (struct svga_texture *)pt; + + ss->texture_timestamp++; + + svga_sampler_view_reference(&tex->cached_view, NULL); + + /* + DBG("%s deleting %p\n", __FUNCTION__, (void *) tex); + */ + SVGA_DBG(DEBUG_DMA, "unref sid %p (texture)\n", tex->handle); + ss->sws->surface_reference(ss->sws, &tex->handle, NULL); + + FREE(tex); +} + + +static void +svga_texture_copy_handle(struct svga_context *svga, + struct svga_screen *ss, + struct svga_winsys_surface *src_handle, + unsigned src_x, unsigned src_y, unsigned src_z, + unsigned src_level, unsigned src_face, + struct svga_winsys_surface *dst_handle, + unsigned dst_x, unsigned dst_y, unsigned dst_z, + unsigned dst_level, unsigned dst_face, + unsigned width, unsigned height, unsigned depth) +{ + struct svga_surface dst, src; + enum pipe_error ret; + SVGA3dCopyBox box, *boxes; + + assert(svga || ss); + + src.handle = src_handle; + src.real_level = src_level; + src.real_face = src_face; + src.real_zslice = 0; + + dst.handle = dst_handle; + dst.real_level = dst_level; + dst.real_face = dst_face; + dst.real_zslice = 0; + + box.x = dst_x; + box.y = dst_y; + box.z = dst_z; + box.w = width; + box.h = height; + box.d = depth; + box.srcx = src_x; + box.srcy = src_y; + box.srcz = src_z; + +/* + SVGA_DBG(DEBUG_VIEWS, "mipcopy src: %p %u (%ux%ux%u), dst: %p %u (%ux%ux%u)\n", + src_handle, src_level, src_x, src_y, src_z, + dst_handle, dst_level, dst_x, dst_y, dst_z); +*/ + + if (svga) { + ret = SVGA3D_BeginSurfaceCopy(svga->swc, + &src.base, + &dst.base, + &boxes, 1); + if(ret != PIPE_OK) { + svga_context_flush(svga, NULL); + ret = SVGA3D_BeginSurfaceCopy(svga->swc, + &src.base, + &dst.base, + &boxes, 1); + assert(ret == PIPE_OK); + } + *boxes = box; + SVGA_FIFOCommitAll(svga->swc); + } else { + pipe_mutex_lock(ss->swc_mutex); + ret = SVGA3D_BeginSurfaceCopy(ss->swc, + &src.base, + &dst.base, + &boxes, 1); + if(ret != PIPE_OK) { + ss->swc->flush(ss->swc, NULL); + ret = SVGA3D_BeginSurfaceCopy(ss->swc, + &src.base, + &dst.base, + &boxes, 1); + assert(ret == PIPE_OK); + } + *boxes = box; + SVGA_FIFOCommitAll(ss->swc); + pipe_mutex_unlock(ss->swc_mutex); + } +} + +static struct svga_winsys_surface * +svga_texture_view_surface(struct pipe_context *pipe, + struct svga_texture *tex, + SVGA3dSurfaceFormat format, + unsigned start_mip, + unsigned num_mip, + int face_pick, + int zslice_pick) +{ + struct svga_screen *ss = svga_screen(tex->base.screen); + struct svga_winsys_screen *sws = ss->sws; + struct svga_winsys_surface *handle; + int i, j; + SVGA3dSurfaceFlags flags = 0; + SVGA3dSize size; + uint32 numFaces; + uint32 numMipLevels = num_mip; + unsigned z_offset = 0; + + SVGA_DBG(DEBUG_PERF, + "svga: Create surface view: face %d zslice %d mips %d..%d\n", + face_pick, zslice_pick, start_mip, start_mip+num_mip-1); + + size.width = tex->base.width[start_mip]; + size.height = tex->base.height[start_mip]; + size.depth = zslice_pick < 0 ? tex->base.depth[start_mip] : 1; + assert(size.depth == 1); + + if(tex->base.target == PIPE_TEXTURE_CUBE && face_pick < 0) { + flags |= SVGA3D_SURFACE_CUBEMAP; + numFaces = 6; + } else { + numFaces = 1; + } + + if(format == SVGA3D_FORMAT_INVALID) + return NULL; + + handle = sws->surface_create(sws, flags, format, size, numFaces, numMipLevels); + + if (!handle) + return NULL; + + SVGA_DBG(DEBUG_DMA, "create sid %p (texture view)\n", handle); + + if (face_pick < 0) + face_pick = 0; + + if (zslice_pick >= 0) + z_offset = zslice_pick; + + for (i = 0; i < num_mip; i++) { + for (j = 0; j < numFaces; j++) { + if(tex->defined[j + face_pick][i + start_mip]) { + unsigned depth = zslice_pick < 0 ? tex->base.depth[i + start_mip] : 1; + svga_texture_copy_handle(svga_context(pipe), ss, + tex->handle, 0, 0, z_offset, i + start_mip, j + face_pick, + handle, 0, 0, 0, i, j, + tex->base.width[i + start_mip], tex->base.height[i + start_mip], depth); + } + } + } + + return handle; +} + + +static struct pipe_surface * +svga_get_tex_surface(struct pipe_screen *screen, + struct pipe_texture *pt, + unsigned face, unsigned level, unsigned zslice, + unsigned flags) +{ + struct svga_texture *tex = svga_texture(pt); + struct svga_surface *s; + struct pipe_surface *ps; + boolean render = flags & PIPE_BUFFER_USAGE_GPU_WRITE ? TRUE : FALSE; + boolean view = FALSE; + SVGA3dSurfaceFormat format; + + s = CALLOC_STRUCT(svga_surface); + ps = &s->base; + if (!ps) + return NULL; + + pipe_reference_init(&ps->reference, 1); + pipe_texture_reference(&ps->texture, pt); + ps->format = pt->format; + ps->width = pt->width[level]; + ps->height = pt->height[level]; + ps->usage = flags; + ps->level = level; + ps->face = face; + ps->zslice = zslice; + + if (!render) + format = svga_translate_format(pt->format); + else + format = svga_translate_format_render(pt->format); + + assert(format != SVGA3D_FORMAT_INVALID); + assert(!(flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE)); + + + if (svga_screen(screen)->debug.force_surface_view) + view = TRUE; + + /* Currently only used for compressed textures */ + if (render && (format != svga_translate_format(pt->format))) { + view = TRUE; + } + + if (level != 0 && svga_screen(screen)->debug.force_level_surface_view) + view = TRUE; + + if (pt->target == PIPE_TEXTURE_3D) + view = TRUE; + + if (svga_screen(screen)->debug.no_surface_view) + view = FALSE; + + if (view) { + SVGA_DBG(DEBUG_VIEWS, "svga: Surface view: yes %p, level %u face %u z %u, %p\n", + pt, level, face, zslice, ps); + + s->handle = svga_texture_view_surface(NULL, tex, format, level, 1, face, zslice); + s->real_face = 0; + s->real_level = 0; + s->real_zslice = 0; + } else { + struct svga_winsys_screen *sws = svga_winsys_screen(screen); + + SVGA_DBG(DEBUG_VIEWS, "svga: Surface view: no %p, level %u, face %u, z %u, %p\n", + pt, level, face, zslice, ps); + + sws->surface_reference(sws, &s->handle, tex->handle); + s->real_face = face; + s->real_level = level; + s->real_zslice = zslice; + } + + return ps; +} + + +static void +svga_tex_surface_destroy(struct pipe_surface *surf) +{ + struct svga_surface *s = svga_surface(surf); + struct svga_screen *ss = svga_screen(surf->texture->screen); + + SVGA_DBG(DEBUG_DMA, "unref sid %p (tex surface)\n", s->handle); + ss->sws->surface_reference(ss->sws, &s->handle, NULL); + pipe_texture_reference(&surf->texture, NULL); + FREE(surf); +} + + +static INLINE void +svga_mark_surface_dirty(struct pipe_surface *surf) +{ + struct svga_surface *s = svga_surface(surf); + + if(!s->dirty) { + struct svga_texture *tex = svga_texture(surf->texture); + + s->dirty = TRUE; + + if (s->handle == tex->handle) + tex->defined[surf->face][surf->level] = TRUE; + else { + /* this will happen later in svga_propagate_surface */ + } + } +} + + +void svga_mark_surfaces_dirty(struct svga_context *svga) +{ + unsigned i; + + for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { + if (svga->curr.framebuffer.cbufs[i]) + svga_mark_surface_dirty(svga->curr.framebuffer.cbufs[i]); + } + if (svga->curr.framebuffer.zsbuf) + svga_mark_surface_dirty(svga->curr.framebuffer.zsbuf); +} + +/** + * Progagate any changes from surfaces to texture. + * pipe is optional context to inline the blit command in. + */ +void +svga_propagate_surface(struct pipe_context *pipe, struct pipe_surface *surf) +{ + struct svga_surface *s = svga_surface(surf); + struct svga_texture *tex = svga_texture(surf->texture); + struct svga_screen *ss = svga_screen(surf->texture->screen); + + if (!s->dirty) + return; + + s->dirty = FALSE; + ss->texture_timestamp++; + tex->view_age[surf->level] = ++(tex->age); + + if (s->handle != tex->handle) { + SVGA_DBG(DEBUG_VIEWS, "svga: Surface propagate: tex %p, level %u, from %p\n", tex, surf->level, surf); + svga_texture_copy_handle(svga_context(pipe), ss, + s->handle, 0, 0, 0, s->real_level, s->real_face, + tex->handle, 0, 0, surf->zslice, surf->level, surf->face, + tex->base.width[surf->level], tex->base.height[surf->level], 1); + tex->defined[surf->face][surf->level] = TRUE; + } +} + +/** + * Check if we should call svga_propagate_surface on the surface. + */ +extern boolean +svga_surface_needs_propagation(struct pipe_surface *surf) +{ + struct svga_surface *s = svga_surface(surf); + struct svga_texture *tex = svga_texture(surf->texture); + + return s->dirty && s->handle != tex->handle; +} + + +static struct pipe_transfer * +svga_get_tex_transfer(struct pipe_screen *screen, + struct pipe_texture *texture, + unsigned face, unsigned level, unsigned zslice, + enum pipe_transfer_usage usage, unsigned x, unsigned y, + unsigned w, unsigned h) +{ + struct svga_screen *ss = svga_screen(screen); + struct svga_winsys_screen *sws = ss->sws; + struct svga_transfer *st; + + /* We can't map texture storage directly */ + if (usage & PIPE_TRANSFER_MAP_DIRECTLY) + return NULL; + + st = CALLOC_STRUCT(svga_transfer); + if (!st) + return NULL; + + st->base.format = texture->format; + st->base.block = texture->block; + st->base.x = x; + st->base.y = y; + st->base.width = w; + st->base.height = h; + st->base.nblocksx = pf_get_nblocksx(&texture->block, w); + st->base.nblocksy = pf_get_nblocksy(&texture->block, h); + st->base.stride = st->base.nblocksx*st->base.block.size; + st->base.usage = usage; + st->base.face = face; + st->base.level = level; + st->base.zslice = zslice; + + st->hw_nblocksy = st->base.nblocksy; + + st->hwbuf = svga_winsys_buffer_create(ss, + 1, + 0, + st->hw_nblocksy*st->base.stride); + while(!st->hwbuf && (st->hw_nblocksy /= 2)) { + st->hwbuf = svga_winsys_buffer_create(ss, + 1, + 0, + st->hw_nblocksy*st->base.stride); + } + + if(!st->hwbuf) + goto no_hwbuf; + + if(st->hw_nblocksy < st->base.nblocksy) { + /* We couldn't allocate a hardware buffer big enough for the transfer, + * so allocate regular malloc memory instead */ + debug_printf("%s: failed to allocate %u KB of DMA, splitting into %u x %u KB DMA transfers\n", + __FUNCTION__, + (st->base.nblocksy*st->base.stride + 1023)/1024, + (st->base.nblocksy + st->hw_nblocksy - 1)/st->hw_nblocksy, + (st->hw_nblocksy*st->base.stride + 1023)/1024); + st->swbuf = MALLOC(st->base.nblocksy*st->base.stride); + if(!st->swbuf) + goto no_swbuf; + } + + pipe_texture_reference(&st->base.texture, texture); + + if (usage & PIPE_TRANSFER_READ) + svga_transfer_dma(st, SVGA3D_READ_HOST_VRAM); + + return &st->base; + +no_swbuf: + sws->buffer_destroy(sws, st->hwbuf); +no_hwbuf: + FREE(st); + return NULL; +} + + +static void * +svga_transfer_map( struct pipe_screen *screen, + struct pipe_transfer *transfer ) +{ + struct svga_screen *ss = svga_screen(screen); + struct svga_winsys_screen *sws = ss->sws; + struct svga_transfer *st = svga_transfer(transfer); + + if(st->swbuf) + return st->swbuf; + else + /* The wait for read transfers already happened when svga_transfer_dma + * was called. */ + return sws->buffer_map(sws, st->hwbuf, + pipe_transfer_buffer_flags(transfer)); +} + + +static void +svga_transfer_unmap(struct pipe_screen *screen, + struct pipe_transfer *transfer) +{ + struct svga_screen *ss = svga_screen(screen); + struct svga_winsys_screen *sws = ss->sws; + struct svga_transfer *st = svga_transfer(transfer); + + if(!st->swbuf) + sws->buffer_unmap(sws, st->hwbuf); +} + + +static void +svga_tex_transfer_destroy(struct pipe_transfer *transfer) +{ + struct svga_texture *tex = svga_texture(transfer->texture); + struct svga_screen *ss = svga_screen(transfer->texture->screen); + struct svga_winsys_screen *sws = ss->sws; + struct svga_transfer *st = svga_transfer(transfer); + + if (st->base.usage & PIPE_TRANSFER_WRITE) { + svga_transfer_dma(st, SVGA3D_WRITE_HOST_VRAM); + ss->texture_timestamp++; + tex->view_age[transfer->level] = ++(tex->age); + tex->defined[transfer->face][transfer->level] = TRUE; + } + + pipe_texture_reference(&st->base.texture, NULL); + FREE(st->swbuf); + sws->buffer_destroy(sws, st->hwbuf); + FREE(st); +} + +void +svga_screen_init_texture_functions(struct pipe_screen *screen) +{ + screen->texture_create = svga_texture_create; + screen->texture_destroy = svga_texture_destroy; + screen->get_tex_surface = svga_get_tex_surface; + screen->tex_surface_destroy = svga_tex_surface_destroy; + screen->texture_blanket = svga_texture_blanket; + screen->get_tex_transfer = svga_get_tex_transfer; + screen->transfer_map = svga_transfer_map; + screen->transfer_unmap = svga_transfer_unmap; + screen->tex_transfer_destroy = svga_tex_transfer_destroy; +} + +/*********************************************************************** + */ + +struct svga_sampler_view * +svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt, + unsigned min_lod, unsigned max_lod) +{ + struct svga_screen *ss = svga_screen(pt->screen); + struct svga_winsys_screen *sws = ss->sws; + struct svga_texture *tex = svga_texture(pt); + struct svga_sampler_view *sv = NULL; + SVGA3dSurfaceFormat format = svga_translate_format(pt->format); + boolean view = TRUE; + + assert(pt); + assert(min_lod >= 0); + assert(min_lod <= max_lod); + assert(max_lod <= pt->last_level); + + + /* Is a view needed */ + { + /* + * Can't control max lod. For first level views and when we only + * look at one level we disable mip filtering to achive the same + * results as a view. + */ + if (min_lod == 0 && max_lod >= pt->last_level) + view = FALSE; + + if (pf_is_compressed(pt->format) && view) { + format = svga_translate_format_render(pt->format); + } + + if (ss->debug.no_sampler_view) + view = FALSE; + + if (ss->debug.force_sampler_view) + view = TRUE; + } + + /* First try the cache */ + if (view) { + pipe_mutex_lock(ss->tex_mutex); + if (tex->cached_view && + tex->cached_view->min_lod == min_lod && + tex->cached_view->max_lod == max_lod) { + svga_sampler_view_reference(&sv, tex->cached_view); + pipe_mutex_unlock(ss->tex_mutex); + SVGA_DBG(DEBUG_VIEWS, "svga: Sampler view: reuse %p, %u %u, last %u\n", + pt, min_lod, max_lod, pt->last_level); + svga_validate_sampler_view(svga_context(pipe), sv); + return sv; + } + pipe_mutex_unlock(ss->tex_mutex); + } + + sv = CALLOC_STRUCT(svga_sampler_view); + pipe_reference_init(&sv->reference, 1); + sv->texture = tex; + sv->min_lod = min_lod; + sv->max_lod = max_lod; + + /* No view needed just use the whole texture */ + if (!view) { + SVGA_DBG(DEBUG_VIEWS, + "svga: Sampler view: no %p, mips %u..%u, nr %u, size (%ux%ux%u), last %u\n", + pt, min_lod, max_lod, + max_lod - min_lod + 1, + pt->width[0], + pt->height[0], + pt->depth[0], + pt->last_level); + sws->surface_reference(sws, &sv->handle, tex->handle); + return sv; + } + + SVGA_DBG(DEBUG_VIEWS, + "svga: Sampler view: yes %p, mips %u..%u, nr %u, size (%ux%ux%u), last %u\n", + pt, min_lod, max_lod, + max_lod - min_lod + 1, + pt->width[0], + pt->height[0], + pt->depth[0], + pt->last_level); + + sv->age = tex->age; + sv->handle = svga_texture_view_surface(pipe, tex, format, + min_lod, + max_lod - min_lod + 1, + -1, -1); + + if (!sv->handle) { + assert(0); + sws->surface_reference(sws, &sv->handle, tex->handle); + return sv; + } + + pipe_mutex_lock(ss->tex_mutex); + svga_sampler_view_reference(&tex->cached_view, sv); + pipe_mutex_unlock(ss->tex_mutex); + + return sv; +} + +void +svga_validate_sampler_view(struct svga_context *svga, struct svga_sampler_view *v) +{ + struct svga_texture *tex = v->texture; + unsigned numFaces; + unsigned age = 0; + int i, k; + + assert(svga); + + if (v->handle == v->texture->handle) + return; + + age = tex->age; + + if(tex->base.target == PIPE_TEXTURE_CUBE) + numFaces = 6; + else + numFaces = 1; + + for (i = v->min_lod; i <= v->max_lod; i++) { + for (k = 0; k < numFaces; k++) { + if (v->age < tex->view_age[i]) + svga_texture_copy_handle(svga, NULL, + tex->handle, 0, 0, 0, i, k, + v->handle, 0, 0, 0, i - v->min_lod, k, + tex->base.width[i], + tex->base.height[i], + tex->base.depth[i]); + } + } + + v->age = age; +} + +void +svga_destroy_sampler_view_priv(struct svga_sampler_view *v) +{ + struct svga_screen *ss = svga_screen(v->texture->base.screen); + + SVGA_DBG(DEBUG_DMA, "unref sid %p (sampler view)\n", v->handle); + ss->sws->surface_reference(ss->sws, &v->handle, NULL); + + FREE(v); +} + +boolean +svga_screen_buffer_from_texture(struct pipe_texture *texture, + struct pipe_buffer **buffer, + unsigned *stride) +{ + struct svga_texture *stex = svga_texture(texture); + + *buffer = svga_screen_buffer_wrap_surface + (texture->screen, + svga_translate_format(texture->format), + stex->handle); + + *stride = pf_get_nblocksx(&texture->block, texture->width[0]) * + texture->block.size; + + return *buffer != NULL; +} + + +struct svga_winsys_surface * +svga_screen_texture_get_winsys_surface(struct pipe_texture *texture) +{ + struct svga_winsys_screen *sws = svga_winsys_screen(texture->screen); + struct svga_winsys_surface *vsurf = NULL; + + sws->surface_reference(sws, &vsurf, svga_texture(texture)->handle); + return vsurf; +} diff --git a/src/gallium/drivers/svga/svga_screen_texture.h b/src/gallium/drivers/svga/svga_screen_texture.h new file mode 100644 index 0000000000..1e6fef59a3 --- /dev/null +++ b/src/gallium/drivers/svga/svga_screen_texture.h @@ -0,0 +1,177 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#ifndef SVGA_TEXTURE_H +#define SVGA_TEXTURE_H + + +#include "pipe/p_compiler.h" +#include "pipe/p_state.h" + + +struct pipe_context; +struct pipe_screen; +struct svga_context; +struct svga_winsys_surface; +enum SVGA3dSurfaceFormat; + + +#define SVGA_MAX_TEXTURE_LEVELS 12 /* 2048x2048 */ + + +/** + * A sampler's view into a texture + * + * We currently cache one sampler view on + * the texture and in there by holding a reference + * from the texture to the sampler view. + * + * Because of this we can not hold a refernce to the + * texture from the sampler view. So the user + * of the sampler views must make sure that the + * texture has a reference take for as long as + * the sampler view is refrenced. + * + * Just unreferencing the sampler_view before the + * texture is enough. + */ +struct svga_sampler_view +{ + struct pipe_reference reference; + + struct svga_texture *texture; + + int min_lod; + int max_lod; + + unsigned age; + + struct svga_winsys_surface *handle; +}; + + +struct svga_texture +{ + struct pipe_texture base; + + struct svga_winsys_surface *handle; + + boolean defined[6][PIPE_MAX_TEXTURE_LEVELS]; + + struct svga_sampler_view *cached_view; + + unsigned view_age[SVGA_MAX_TEXTURE_LEVELS]; + unsigned age; + + boolean views_modified; +}; + + +struct svga_surface +{ + struct pipe_surface base; + + struct svga_winsys_surface *handle; + + unsigned real_face; + unsigned real_level; + unsigned real_zslice; + + boolean dirty; +}; + + +struct svga_transfer +{ + struct pipe_transfer base; + + struct svga_winsys_buffer *hwbuf; + + /* Height of the hardware buffer in pixel blocks */ + unsigned hw_nblocksy; + + /* Temporary malloc buffer when we can't allocate a hardware buffer + * big enough */ + void *swbuf; +}; + + +static INLINE struct svga_texture * +svga_texture(struct pipe_texture *texture) +{ + return (struct svga_texture *)texture; +} + +static INLINE struct svga_surface * +svga_surface(struct pipe_surface *surface) +{ + assert(surface); + return (struct svga_surface *)surface; +} + +static INLINE struct svga_transfer * +svga_transfer(struct pipe_transfer *transfer) +{ + assert(transfer); + return (struct svga_transfer *)transfer; +} + +extern struct svga_sampler_view * +svga_get_tex_sampler_view(struct pipe_context *pipe, + struct pipe_texture *pt, + unsigned min_lod, unsigned max_lod); + +void +svga_validate_sampler_view(struct svga_context *svga, struct svga_sampler_view *v); + +void +svga_destroy_sampler_view_priv(struct svga_sampler_view *v); + +static INLINE void +svga_sampler_view_reference(struct svga_sampler_view **ptr, struct svga_sampler_view *v) +{ + struct svga_sampler_view *old = *ptr; + + if (pipe_reference((struct pipe_reference **)ptr, &v->reference)) + svga_destroy_sampler_view_priv(old); +} + +extern void +svga_propagate_surface(struct pipe_context *pipe, struct pipe_surface *surf); + +extern boolean +svga_surface_needs_propagation(struct pipe_surface *surf); + +extern void +svga_screen_init_texture_functions(struct pipe_screen *screen); + +enum SVGA3dSurfaceFormat +svga_translate_format(enum pipe_format format); + +enum SVGA3dSurfaceFormat +svga_translate_format_render(enum pipe_format format); + + +#endif /* SVGA_TEXTURE_H */ diff --git a/src/gallium/drivers/svga/svga_state.c b/src/gallium/drivers/svga/svga_state.c new file mode 100644 index 0000000000..1c21d3acfe --- /dev/null +++ b/src/gallium/drivers/svga/svga_state.c @@ -0,0 +1,278 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "util/u_debug.h" +#include "pipe/p_defines.h" +#include "util/u_memory.h" +#include "draw/draw_context.h" + +#include "svga_context.h" +#include "svga_screen.h" +#include "svga_state.h" +#include "svga_draw.h" +#include "svga_cmd.h" +#include "svga_hw_reg.h" + +/* This is just enough to decide whether we need to use the draw + * module (swtnl) or not. + */ +static const struct svga_tracked_state *need_swtnl_state[] = +{ + &svga_update_need_swvfetch, + &svga_update_need_pipeline, + &svga_update_need_swtnl, + NULL +}; + + +/* Atoms to update hardware state prior to emitting a clear or draw + * packet. + */ +static const struct svga_tracked_state *hw_clear_state[] = +{ + &svga_hw_scissor, + &svga_hw_viewport, + &svga_hw_framebuffer, + NULL +}; + + +/* Atoms to update hardware state prior to emitting a draw packet. + */ +static const struct svga_tracked_state *hw_draw_state[] = +{ + &svga_hw_update_zero_stride, + &svga_hw_fs, + &svga_hw_vs, + &svga_hw_rss, + &svga_hw_tss, + &svga_hw_tss_binding, + &svga_hw_clip_planes, + &svga_hw_vdecl, + &svga_hw_fs_parameters, + &svga_hw_vs_parameters, + NULL +}; + + +static const struct svga_tracked_state *swtnl_draw_state[] = +{ + &svga_update_swtnl_draw, + &svga_update_swtnl_vdecl, + NULL +}; + +/* Flattens the graph of state dependencies. Could swap the positions + * of hw_clear_state and need_swtnl_state without breaking anything. + */ +static const struct svga_tracked_state **state_levels[] = +{ + need_swtnl_state, + hw_clear_state, + hw_draw_state, + swtnl_draw_state +}; + + + +static unsigned check_state( unsigned a, + unsigned b ) +{ + return (a & b); +} + +static void accumulate_state( unsigned *a, + unsigned b ) +{ + *a |= b; +} + + +static void xor_states( unsigned *result, + unsigned a, + unsigned b ) +{ + *result = a ^ b; +} + + + +static int update_state( struct svga_context *svga, + const struct svga_tracked_state *atoms[], + unsigned *state ) +{ + boolean debug = TRUE; + enum pipe_error ret = 0; + unsigned i; + + ret = svga_hwtnl_flush( svga->hwtnl ); + if (ret != 0) + return ret; + + if (debug) { + /* Debug version which enforces various sanity checks on the + * state flags which are generated and checked to help ensure + * state atoms are ordered correctly in the list. + */ + unsigned examined, prev; + + examined = 0; + prev = *state; + + for (i = 0; atoms[i] != NULL; i++) { + unsigned generated; + + assert(atoms[i]->dirty); + assert(atoms[i]->update); + + if (check_state(*state, atoms[i]->dirty)) { + if (0) + debug_printf("update: %s\n", atoms[i]->name); + ret = atoms[i]->update( svga, *state ); + if (ret != 0) + return ret; + } + + /* generated = (prev ^ state) + * if (examined & generated) + * fail; + */ + xor_states(&generated, prev, *state); + if (check_state(examined, generated)) { + debug_printf("state atom %s generated state already examined\n", + atoms[i]->name); + assert(0); + } + + prev = *state; + accumulate_state(&examined, atoms[i]->dirty); + } + } + else { + for (i = 0; atoms[i] != NULL; i++) { + if (check_state(*state, atoms[i]->dirty)) { + ret = atoms[i]->update( svga, *state ); + if (ret != 0) + return ret; + } + } + } + + return 0; +} + + + +int svga_update_state( struct svga_context *svga, + unsigned max_level ) +{ + struct svga_screen *screen = svga_screen(svga->pipe.screen); + int ret = 0; + int i; + + /* Check for updates to bound textures. This can't be done in an + * atom as there is no flag which could provoke this test, and we + * cannot create one. + */ + if (svga->state.texture_timestamp != screen->texture_timestamp) { + svga->state.texture_timestamp = screen->texture_timestamp; + svga->dirty |= SVGA_NEW_TEXTURE; + } + + for (i = 0; i <= max_level; i++) { + svga->dirty |= svga->state.dirty[i]; + + if (svga->dirty) { + ret = update_state( svga, + state_levels[i], + &svga->dirty ); + if (ret != 0) + return ret; + + svga->state.dirty[i] = 0; + } + } + + for (; i < SVGA_STATE_MAX; i++) + svga->state.dirty[i] |= svga->dirty; + + svga->dirty = 0; + return 0; +} + + + + +void svga_update_state_retry( struct svga_context *svga, + unsigned max_level ) +{ + int ret; + + ret = svga_update_state( svga, max_level ); + + if (ret == PIPE_ERROR_OUT_OF_MEMORY) { + svga_context_flush(svga, NULL); + ret = svga_update_state( svga, max_level ); + } + + assert( ret == 0 ); +} + + + +#define EMIT_RS(_rs, _count, _name, _value) \ +do { \ + _rs[_count].state = _name; \ + _rs[_count].uintValue = _value; \ + _count++; \ +} while (0) + + +/* Setup any hardware state which will be constant through the life of + * a context. + */ +enum pipe_error svga_emit_initial_state( struct svga_context *svga ) +{ + SVGA3dRenderState *rs; + unsigned count = 0; + const unsigned COUNT = 2; + enum pipe_error ret; + + ret = SVGA3D_BeginSetRenderState( svga->swc, &rs, COUNT ); + if (ret) + return ret; + + /* Always use D3D style coordinate space as this is the only one + * which is implemented on all backends. + */ + EMIT_RS(rs, count, SVGA3D_RS_COORDINATETYPE, SVGA3D_COORDINATE_LEFTHANDED ); + EMIT_RS(rs, count, SVGA3D_RS_FRONTWINDING, SVGA3D_FRONTWINDING_CW ); + + assert( COUNT == count ); + SVGA_FIFOCommitAll( svga->swc ); + + return 0; + +} diff --git a/src/gallium/drivers/svga/svga_state.h b/src/gallium/drivers/svga/svga_state.h new file mode 100644 index 0000000000..22d5a6d552 --- /dev/null +++ b/src/gallium/drivers/svga/svga_state.h @@ -0,0 +1,95 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#ifndef SVGA_STATE_H +#define SVGA_STATE_H + + +#include "pipe/p_compiler.h" +#include "pipe/p_defines.h" + +struct svga_context; + + +void svga_init_state( struct svga_context *svga ); +void svga_destroy_state( struct svga_context *svga ); + + +struct svga_tracked_state { + const char *name; + unsigned dirty; + int (*update)( struct svga_context *svga, unsigned dirty ); +}; + +/* NEED_SWTNL + */ +extern struct svga_tracked_state svga_update_need_swvfetch; +extern struct svga_tracked_state svga_update_need_pipeline; +extern struct svga_tracked_state svga_update_need_swtnl; + +/* HW_CLEAR + */ +extern struct svga_tracked_state svga_hw_viewport; +extern struct svga_tracked_state svga_hw_scissor; +extern struct svga_tracked_state svga_hw_framebuffer; + +/* HW_DRAW + */ +extern struct svga_tracked_state svga_hw_vs; +extern struct svga_tracked_state svga_hw_fs; +extern struct svga_tracked_state svga_hw_rss; +extern struct svga_tracked_state svga_hw_tss; +extern struct svga_tracked_state svga_hw_tss_binding; +extern struct svga_tracked_state svga_hw_clip_planes; +extern struct svga_tracked_state svga_hw_vdecl; +extern struct svga_tracked_state svga_hw_fs_parameters; +extern struct svga_tracked_state svga_hw_vs_parameters; +extern struct svga_tracked_state svga_hw_update_zero_stride; + +/* SWTNL_DRAW + */ +extern struct svga_tracked_state svga_update_swtnl_draw; +extern struct svga_tracked_state svga_update_swtnl_vdecl; + +/* Bring the hardware fully up-to-date so that we can emit draw + * commands. + */ +#define SVGA_STATE_NEED_SWTNL 0 +#define SVGA_STATE_HW_CLEAR 1 +#define SVGA_STATE_HW_DRAW 2 +#define SVGA_STATE_SWTNL_DRAW 3 +#define SVGA_STATE_MAX 4 + + +enum pipe_error svga_update_state( struct svga_context *svga, + unsigned level ); + +void svga_update_state_retry( struct svga_context *svga, + unsigned level ); + + +enum pipe_error svga_emit_initial_state( struct svga_context *svga ); + +#endif diff --git a/src/gallium/drivers/svga/svga_state_constants.c b/src/gallium/drivers/svga/svga_state_constants.c new file mode 100644 index 0000000000..18cce7dde1 --- /dev/null +++ b/src/gallium/drivers/svga/svga_state_constants.c @@ -0,0 +1,239 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "pipe/p_inlines.h" +#include "pipe/p_defines.h" + +#include "svga_context.h" +#include "svga_state.h" +#include "svga_cmd.h" +#include "svga_tgsi.h" +#include "svga_debug.h" + +#include "svga_hw_reg.h" + +/*********************************************************************** + * Hardware update + */ + +/* Convert from PIPE_SHADER_* to SVGA3D_SHADERTYPE_* + */ +static int svga_shader_type( int unit ) +{ + return unit + 1; +} + + +static int emit_const( struct svga_context *svga, + int unit, + int i, + const float *value ) +{ + int ret = PIPE_OK; + + if (memcmp(svga->state.hw_draw.cb[unit][i], value, 4 * sizeof(float)) != 0) { + if (SVGA_DEBUG & DEBUG_CONSTS) + debug_printf("%s %s %d: %f %f %f %f\n", + __FUNCTION__, + unit == PIPE_SHADER_VERTEX ? "VERT" : "FRAG", + i, + value[0], + value[1], + value[2], + value[3]); + + ret = SVGA3D_SetShaderConst( svga->swc, + i, + svga_shader_type(unit), + SVGA3D_CONST_TYPE_FLOAT, + value ); + if (ret) + return ret; + + memcpy(svga->state.hw_draw.cb[unit][i], value, 4 * sizeof(float)); + } + + return ret; +} + +static int emit_consts( struct svga_context *svga, + int offset, + int unit ) +{ + struct pipe_screen *screen = svga->pipe.screen; + unsigned count; + const float (*data)[4] = NULL; + unsigned i; + int ret = PIPE_OK; + + if (svga->curr.cb[unit] == NULL) + goto done; + + count = svga->curr.cb[unit]->size / (4 * sizeof(float)); + + data = (const float (*)[4])pipe_buffer_map(screen, + svga->curr.cb[unit], + PIPE_BUFFER_USAGE_CPU_READ); + if (data == NULL) { + ret = PIPE_ERROR_OUT_OF_MEMORY; + goto done; + } + + for (i = 0; i < count; i++) { + ret = emit_const( svga, unit, offset + i, data[i] ); + if (ret) + goto done; + } + +done: + if (data) + pipe_buffer_unmap(screen, svga->curr.cb[unit]); + + return ret; +} + +static int emit_fs_consts( struct svga_context *svga, + unsigned dirty ) +{ + const struct svga_shader_result *result = svga->state.hw_draw.fs; + const struct svga_fs_compile_key *key = &result->key.fkey; + int ret = 0; + + ret = emit_consts( svga, 0, PIPE_SHADER_FRAGMENT ); + if (ret) + return ret; + + /* The internally generated fragment shader for xor blending + * doesn't have a 'result' struct. It should be fixed to avoid + * this special case, but work around it with a NULL check: + */ + if (result != NULL && + key->num_unnormalized_coords) + { + unsigned offset = result->shader->info.file_max[TGSI_FILE_CONSTANT] + 1; + int i; + + for (i = 0; i < key->num_textures; i++) { + if (key->tex[i].unnormalized) { + struct pipe_texture *tex = svga->curr.texture[i]; + float data[4]; + + data[0] = 1.0 / (float)tex->width[0]; + data[1] = 1.0 / (float)tex->height[0]; + data[2] = 1.0; + data[3] = 1.0; + + ret = emit_const( svga, + PIPE_SHADER_FRAGMENT, + key->tex[i].width_height_idx + offset, + data ); + if (ret) + return ret; + } + } + + offset += key->num_unnormalized_coords; + } + + return 0; +} + + +struct svga_tracked_state svga_hw_fs_parameters = +{ + "hw fs params", + (SVGA_NEW_FS_CONST_BUFFER | + SVGA_NEW_FS_RESULT | + SVGA_NEW_TEXTURE_BINDING), + emit_fs_consts +}; + +/*********************************************************************** + */ + +static int emit_vs_consts( struct svga_context *svga, + unsigned dirty ) +{ + const struct svga_shader_result *result = svga->state.hw_draw.vs; + const struct svga_vs_compile_key *key = &result->key.vkey; + int ret = 0; + unsigned offset; + + /* SVGA_NEW_VS_RESULT + */ + if (result == NULL) + return 0; + + /* SVGA_NEW_VS_CONST_BUFFER + */ + ret = emit_consts( svga, 0, PIPE_SHADER_VERTEX ); + if (ret) + return ret; + + offset = result->shader->info.file_max[TGSI_FILE_CONSTANT] + 1; + + /* SVGA_NEW_VS_RESULT + */ + if (key->need_prescale) { + ret = emit_const( svga, PIPE_SHADER_VERTEX, offset++, + svga->state.hw_clear.prescale.scale ); + if (ret) + return ret; + + ret = emit_const( svga, PIPE_SHADER_VERTEX, offset++, + svga->state.hw_clear.prescale.translate ); + if (ret) + return ret; + } + + /* SVGA_NEW_ZERO_STRIDE + */ + if (key->zero_stride_vertex_elements) { + unsigned i, curr_zero_stride = 0; + for (i = 0; i < PIPE_MAX_ATTRIBS; ++i) { + if (key->zero_stride_vertex_elements & (1 << i)) { + ret = emit_const( svga, PIPE_SHADER_VERTEX, offset++, + svga->curr.zero_stride_constants + + 4 * curr_zero_stride ); + if (ret) + return ret; + ++curr_zero_stride; + } + } + } + + return 0; +} + + +struct svga_tracked_state svga_hw_vs_parameters = +{ + "hw vs params", + (SVGA_NEW_VS_CONST_BUFFER | + SVGA_NEW_ZERO_STRIDE | + SVGA_NEW_VS_RESULT), + emit_vs_consts +}; + diff --git a/src/gallium/drivers/svga/svga_state_framebuffer.c b/src/gallium/drivers/svga/svga_state_framebuffer.c new file mode 100644 index 0000000000..7d7f93d8e3 --- /dev/null +++ b/src/gallium/drivers/svga/svga_state_framebuffer.c @@ -0,0 +1,455 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "pipe/p_inlines.h" +#include "pipe/p_defines.h" +#include "util/u_math.h" + +#include "svga_context.h" +#include "svga_state.h" +#include "svga_cmd.h" +#include "svga_debug.h" + +#include "svga_hw_reg.h" + + +/*********************************************************************** + * Hardware state update + */ + + +static int emit_framebuffer( struct svga_context *svga, + unsigned dirty ) +{ + const struct pipe_framebuffer_state *curr = &svga->curr.framebuffer; + struct pipe_framebuffer_state *hw = &svga->state.hw_clear.framebuffer; + unsigned i; + enum pipe_error ret; + + /* XXX: Need shadow state in svga->hw to eliminate redundant + * uploads, especially of NULL buffers. + */ + + for(i = 0; i < PIPE_MAX_COLOR_BUFS; ++i) { + if (curr->cbufs[i] != hw->cbufs[i]) { + ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_COLOR0 + i, curr->cbufs[i]); + if (ret != PIPE_OK) + return ret; + + pipe_surface_reference(&hw->cbufs[i], curr->cbufs[i]); + } + } + + + if (curr->zsbuf != hw->zsbuf) { + ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_DEPTH, curr->zsbuf); + if (ret != PIPE_OK) + return ret; + + if (curr->zsbuf && + curr->zsbuf->format == PIPE_FORMAT_Z24S8_UNORM) { + ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_STENCIL, curr->zsbuf); + if (ret != PIPE_OK) + return ret; + } + else { + ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_STENCIL, NULL); + if (ret != PIPE_OK) + return ret; + } + + pipe_surface_reference(&hw->zsbuf, curr->zsbuf); + } + + + return 0; +} + + +struct svga_tracked_state svga_hw_framebuffer = +{ + "hw framebuffer state", + SVGA_NEW_FRAME_BUFFER, + emit_framebuffer +}; + + + + +/*********************************************************************** + */ + +static int emit_viewport( struct svga_context *svga, + unsigned dirty ) +{ + const struct pipe_viewport_state *viewport = &svga->curr.viewport; + struct svga_prescale prescale; + SVGA3dRect rect; + /* Not sure if this state is relevant with POSITIONT. Probably + * not, but setting to 0,1 avoids some state pingponging. + */ + float range_min = 0.0; + float range_max = 1.0; + float flip = -1.0; + boolean degenerate = FALSE; + enum pipe_error ret; + + float fb_width = svga->curr.framebuffer.width; + float fb_height = svga->curr.framebuffer.height; + + memset( &prescale, 0, sizeof(prescale) ); + + if (svga->curr.rast->templ.bypass_vs_clip_and_viewport) { + + /* Avoid POSITIONT as it has a non trivial implementation outside the D3D + * API. Always generate a vertex shader. + */ + rect.x = 0; + rect.y = 0; + rect.w = svga->curr.framebuffer.width; + rect.h = svga->curr.framebuffer.height; + + prescale.scale[0] = 2.0 / (float)rect.w; + prescale.scale[1] = - 2.0 / (float)rect.h; + prescale.scale[2] = 1.0; + prescale.scale[3] = 1.0; + prescale.translate[0] = -1.0f; + prescale.translate[1] = 1.0f; + prescale.translate[2] = 0; + prescale.translate[3] = 0; + prescale.enabled = TRUE; + } else { + + /* Examine gallium viewport transformation and produce a screen + * rectangle and possibly vertex shader pre-transformation to + * get the same results. + */ + float fx = viewport->scale[0] * -1.0 + viewport->translate[0]; + float fy = flip * viewport->scale[1] * -1.0 + viewport->translate[1]; + float fw = viewport->scale[0] * 2; + float fh = flip * viewport->scale[1] * 2; + + SVGA_DBG(DEBUG_VIEWPORT, + "\ninitial %f,%f %fx%f\n", + fx, + fy, + fw, + fh); + + prescale.scale[0] = 1.0; + prescale.scale[1] = 1.0; + prescale.scale[2] = 1.0; + prescale.scale[3] = 1.0; + prescale.translate[0] = 0; + prescale.translate[1] = 0; + prescale.translate[2] = 0; + prescale.translate[3] = 0; + prescale.enabled = TRUE; + + + + if (fw < 0) { + prescale.scale[0] *= -1.0; + prescale.translate[0] += -fw; + fw = -fw; + fx = viewport->scale[0] * 1.0 + viewport->translate[0]; + } + + if (fh < 0) { + prescale.scale[1] *= -1.0; + prescale.translate[1] += -fh; + fh = -fh; + fy = flip * viewport->scale[1] * 1.0 + viewport->translate[1]; + } + + if (fx < 0) { + prescale.translate[0] += fx; + prescale.scale[0] *= fw / (fw + fx); + fw += fx; + fx = 0; + } + + if (fy < 0) { + prescale.translate[1] += fy; + prescale.scale[1] *= fh / (fh + fy); + fh += fy; + fy = 0; + } + + if (fx + fw > fb_width) { + prescale.scale[0] *= fw / (fb_width - fx); + prescale.translate[0] -= fx * (fw / (fb_width - fx)); + prescale.translate[0] += fx; + fw = fb_width - fx; + + } + + if (fy + fh > fb_height) { + prescale.scale[1] *= fh / (fb_height - fy); + prescale.translate[1] -= fy * (fh / (fb_height - fy)); + prescale.translate[1] += fy; + fh = fb_height - fy; + } + + if (fw < 0 || fh < 0) { + fw = fh = fx = fy = 0; + degenerate = TRUE; + goto out; + } + + + /* D3D viewport is integer space. Convert fx,fy,etc. to + * integers. + * + * TODO: adjust pretranslate correct for any subpixel error + * introduced converting to integers. + */ + rect.x = fx; + rect.y = fy; + rect.w = fw; + rect.h = fh; + + SVGA_DBG(DEBUG_VIEWPORT, + "viewport error %f,%f %fx%f\n", + fabs((float)rect.x - fx), + fabs((float)rect.y - fy), + fabs((float)rect.w - fw), + fabs((float)rect.h - fh)); + + SVGA_DBG(DEBUG_VIEWPORT, + "viewport %d,%d %dx%d\n", + rect.x, + rect.y, + rect.w, + rect.h); + + + /* Finally, to get GL rasterization rules, need to tweak the + * screen-space coordinates slightly relative to D3D which is + * what hardware implements natively. + */ + if (svga->curr.rast->templ.gl_rasterization_rules) { + float adjust_x = 0.0; + float adjust_y = 0.0; + + switch (svga->curr.reduced_prim) { + case PIPE_PRIM_LINES: + adjust_x = -0.5; + adjust_y = 0; + break; + case PIPE_PRIM_POINTS: + case PIPE_PRIM_TRIANGLES: + adjust_x = -0.375; + adjust_y = -0.5; + break; + } + + prescale.translate[0] += adjust_x; + prescale.translate[1] += adjust_y; + prescale.translate[2] = 0.5; /* D3D clip space */ + prescale.scale[2] = 0.5; /* D3D clip space */ + } + + + range_min = viewport->scale[2] * -1.0 + viewport->translate[2]; + range_max = viewport->scale[2] * 1.0 + viewport->translate[2]; + + /* D3D (and by implication SVGA) doesn't like dealing with zmax + * less than zmin. Detect that case, flip the depth range and + * invert our z-scale factor to achieve the same effect. + */ + if (range_min > range_max) { + float range_tmp; + range_tmp = range_min; + range_min = range_max; + range_max = range_tmp; + prescale.scale[2] = -prescale.scale[2]; + } + } + + if (prescale.enabled) { + float H[2]; + float J[2]; + int i; + + SVGA_DBG(DEBUG_VIEWPORT, + "prescale %f,%f %fx%f\n", + prescale.translate[0], + prescale.translate[1], + prescale.scale[0], + prescale.scale[1]); + + H[0] = (float)rect.w / 2.0; + H[1] = -(float)rect.h / 2.0; + J[0] = (float)rect.x + (float)rect.w / 2.0; + J[1] = (float)rect.y + (float)rect.h / 2.0; + + SVGA_DBG(DEBUG_VIEWPORT, + "H %f,%f\n" + "J %fx%f\n", + H[0], + H[1], + J[0], + J[1]); + + /* Adjust prescale to take into account the fact that it is + * going to be applied prior to the perspective divide and + * viewport transformation. + * + * Vwin = H(Vc/Vc.w) + J + * + * We want to tweak Vwin with scale and translation from above, + * as in: + * + * Vwin' = S Vwin + T + * + * But we can only modify the values at Vc. Plugging all the + * above together, and rearranging, eventually we get: + * + * Vwin' = H(Vc'/Vc'.w) + J + * where: + * Vc' = SVc + KVc.w + * K = (T + (S-1)J) / H + * + * Overwrite prescale.translate with values for K: + */ + for (i = 0; i < 2; i++) { + prescale.translate[i] = ((prescale.translate[i] + + (prescale.scale[i] - 1.0) * J[i]) / H[i]); + } + + SVGA_DBG(DEBUG_VIEWPORT, + "clipspace %f,%f %fx%f\n", + prescale.translate[0], + prescale.translate[1], + prescale.scale[0], + prescale.scale[1]); + } + +out: + if (degenerate) { + rect.x = 0; + rect.y = 0; + rect.w = 1; + rect.h = 1; + prescale.enabled = FALSE; + } + + if (memcmp(&rect, &svga->state.hw_clear.viewport, sizeof(rect)) != 0) { + ret = SVGA3D_SetViewport(svga->swc, &rect); + if(ret != PIPE_OK) + return ret; + + memcpy(&svga->state.hw_clear.viewport, &rect, sizeof(rect)); + assert(sizeof(rect) == sizeof(svga->state.hw_clear.viewport)); + } + + if (svga->state.hw_clear.depthrange.zmin != range_min || + svga->state.hw_clear.depthrange.zmax != range_max) + { + ret = SVGA3D_SetZRange(svga->swc, range_min, range_max ); + if(ret != PIPE_OK) + return ret; + + svga->state.hw_clear.depthrange.zmin = range_min; + svga->state.hw_clear.depthrange.zmax = range_max; + } + + if (memcmp(&prescale, &svga->state.hw_clear.prescale, sizeof prescale) != 0) { + svga->dirty |= SVGA_NEW_PRESCALE; + svga->state.hw_clear.prescale = prescale; + } + + return 0; +} + + +struct svga_tracked_state svga_hw_viewport = +{ + "hw viewport state", + ( SVGA_NEW_FRAME_BUFFER | + SVGA_NEW_VIEWPORT | + SVGA_NEW_RAST | + SVGA_NEW_REDUCED_PRIMITIVE ), + emit_viewport +}; + + +/*********************************************************************** + * Scissor state + */ +static int emit_scissor_rect( struct svga_context *svga, + unsigned dirty ) +{ + const struct pipe_scissor_state *scissor = &svga->curr.scissor; + SVGA3dRect rect; + + rect.x = scissor->minx; + rect.y = scissor->miny; + rect.w = scissor->maxx - scissor->minx; /* + 1 ?? */ + rect.h = scissor->maxy - scissor->miny; /* + 1 ?? */ + + return SVGA3D_SetScissorRect(svga->swc, &rect); +} + + +struct svga_tracked_state svga_hw_scissor = +{ + "hw scissor state", + SVGA_NEW_SCISSOR, + emit_scissor_rect +}; + + +/*********************************************************************** + * Userclip state + */ + +static int emit_clip_planes( struct svga_context *svga, + unsigned dirty ) +{ + unsigned i; + enum pipe_error ret; + + /* TODO: just emit directly from svga_set_clip_state()? + */ + for (i = 0; i < svga->curr.clip.nr; i++) { + ret = SVGA3D_SetClipPlane( svga->swc, + i, + svga->curr.clip.ucp[i] ); + if(ret != PIPE_OK) + return ret; + } + + return 0; +} + + +struct svga_tracked_state svga_hw_clip_planes = +{ + "hw viewport state", + SVGA_NEW_CLIP, + emit_clip_planes +}; diff --git a/src/gallium/drivers/svga/svga_state_fs.c b/src/gallium/drivers/svga/svga_state_fs.c new file mode 100644 index 0000000000..6ec38ed3e4 --- /dev/null +++ b/src/gallium/drivers/svga/svga_state_fs.c @@ -0,0 +1,282 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "pipe/p_inlines.h" +#include "pipe/p_defines.h" +#include "util/u_math.h" + +#include "svga_context.h" +#include "svga_state.h" +#include "svga_cmd.h" +#include "svga_tgsi.h" + +#include "svga_hw_reg.h" + + + +static INLINE int compare_fs_keys( const struct svga_fs_compile_key *a, + const struct svga_fs_compile_key *b ) +{ + unsigned keysize = svga_fs_key_size( a ); + return memcmp( a, b, keysize ); +} + + +static struct svga_shader_result *search_fs_key( struct svga_fragment_shader *fs, + const struct svga_fs_compile_key *key ) +{ + struct svga_shader_result *result = fs->base.results; + + assert(key); + + for ( ; result; result = result->next) { + if (compare_fs_keys( key, &result->key.fkey ) == 0) + return result; + } + + return NULL; +} + + +static enum pipe_error compile_fs( struct svga_context *svga, + struct svga_fragment_shader *fs, + const struct svga_fs_compile_key *key, + struct svga_shader_result **out_result ) +{ + struct svga_shader_result *result; + enum pipe_error ret; + + result = svga_translate_fragment_program( fs, key ); + if (result == NULL) { + ret = PIPE_ERROR_OUT_OF_MEMORY; + goto fail; + } + + + ret = SVGA3D_DefineShader(svga->swc, + svga->state.next_fs_id, + SVGA3D_SHADERTYPE_PS, + result->tokens, + result->nr_tokens * sizeof result->tokens[0]); + if (ret) + goto fail; + + *out_result = result; + result->id = svga->state.next_fs_id++; + result->next = fs->base.results; + fs->base.results = result; + return PIPE_OK; + +fail: + if (result) + svga_destroy_shader_result( result ); + return ret; +} + +/* The blend workaround for simulating logicop xor behaviour requires + * that the incoming fragment color be white. This change achieves + * that by hooking up a hard-wired fragment shader that just emits + * color 1,1,1,1 + * + * This is a slightly incomplete solution as it assumes that the + * actual bound shader has no other effects beyond generating a + * fragment color. In particular shaders containing TEXKIL and/or + * depth-write will not have the correct behaviour, nor will those + * expecting to use alphatest. + * + * These are avoidable issues, but they are not much worse than the + * unavoidable ones associated with this technique, so it's not clear + * how much effort should be expended trying to resolve them - the + * ultimate result will still not be correct in most cases. + * + * Shader below was generated with: + * SVGA_DEBUG=tgsi ./mesa/progs/fp/fp-tri white.txt + */ +static int emit_white_fs( struct svga_context *svga ) +{ + int ret; + + /* ps_3_0 + * def c0, 1.000000, 0.000000, 0.000000, 1.000000 + * mov oC0, c0.x + * end + */ + static const unsigned white_tokens[] = { + 0xffff0300, + 0x05000051, + 0xa00f0000, + 0x3f800000, + 0x00000000, + 0x00000000, + 0x3f800000, + 0x02000001, + 0x800f0800, + 0xa0000000, + 0x0000ffff, + }; + + ret = SVGA3D_DefineShader(svga->swc, + svga->state.next_fs_id, + SVGA3D_SHADERTYPE_PS, + white_tokens, + sizeof(white_tokens)); + if (ret) + return ret; + + svga->state.white_fs_id = svga->state.next_fs_id++; + return 0; +} + + +/* SVGA_NEW_TEXTURE_BINDING + * SVGA_NEW_RAST + * SVGA_NEW_NEED_SWTNL + * SVGA_NEW_SAMPLER + */ +static int make_fs_key( const struct svga_context *svga, + struct svga_fs_compile_key *key ) +{ + int i; + int idx = 0; + + memset(key, 0, sizeof *key); + + /* Only need fragment shader fixup for twoside lighting if doing + * hwtnl. Otherwise the draw module does the whole job for us. + * + * SVGA_NEW_SWTNL + */ + if (!svga->state.sw.need_swtnl) { + /* SVGA_NEW_RAST + */ + key->light_twoside = svga->curr.rast->templ.light_twoside; + key->front_cw = (svga->curr.rast->templ.front_winding == + PIPE_WINDING_CW); + } + + + /* XXX: want to limit this to the textures that the shader actually + * refers to. + * + * SVGA_NEW_TEXTURE_BINDING | SVGA_NEW_SAMPLER + */ + for (i = 0; i < svga->curr.num_textures; i++) { + if (svga->curr.texture[i]) { + assert(svga->curr.sampler[i]); + key->tex[i].texture_target = svga->curr.texture[i]->target; + if (!svga->curr.sampler[i]->normalized_coords) { + key->tex[i].width_height_idx = idx++; + key->tex[i].unnormalized = TRUE; + ++key->num_unnormalized_coords; + } + } + } + key->num_textures = svga->curr.num_textures; + + idx = 0; + for (i = 0; i < svga->curr.num_samplers; ++i) { + if (svga->curr.sampler[i]) { + key->tex[i].compare_mode = svga->curr.sampler[i]->compare_mode; + key->tex[i].compare_func = svga->curr.sampler[i]->compare_func; + } + } + + return 0; +} + + + +static int emit_hw_fs( struct svga_context *svga, + unsigned dirty ) +{ + struct svga_shader_result *result = NULL; + unsigned id = SVGA3D_INVALID_ID; + int ret = 0; + + /* SVGA_NEW_BLEND + */ + if (svga->curr.blend->need_white_fragments) { + if (svga->state.white_fs_id == SVGA3D_INVALID_ID) { + ret = emit_white_fs( svga ); + if (ret) + return ret; + } + id = svga->state.white_fs_id; + } + else { + struct svga_fragment_shader *fs = svga->curr.fs; + struct svga_fs_compile_key key; + + /* SVGA_NEW_TEXTURE_BINDING + * SVGA_NEW_RAST + * SVGA_NEW_NEED_SWTNL + * SVGA_NEW_SAMPLER + */ + ret = make_fs_key( svga, &key ); + if (ret) + return ret; + + result = search_fs_key( fs, &key ); + if (!result) { + ret = compile_fs( svga, fs, &key, &result ); + if (ret) + return ret; + } + + assert (result); + id = result->id; + } + + assert(id != SVGA3D_INVALID_ID); + + if (id != svga->state.hw_draw.shader_id[PIPE_SHADER_FRAGMENT]) { + ret = SVGA3D_SetShader(svga->swc, + SVGA3D_SHADERTYPE_PS, + id ); + if (ret) + return ret; + + svga->dirty |= SVGA_NEW_FS_RESULT; + svga->state.hw_draw.shader_id[PIPE_SHADER_FRAGMENT] = id; + svga->state.hw_draw.fs = result; + } + + return 0; +} + +struct svga_tracked_state svga_hw_fs = +{ + "fragment shader (hwtnl)", + (SVGA_NEW_FS | + SVGA_NEW_TEXTURE_BINDING | + SVGA_NEW_NEED_SWTNL | + SVGA_NEW_RAST | + SVGA_NEW_SAMPLER | + SVGA_NEW_BLEND), + emit_hw_fs +}; + + + diff --git a/src/gallium/drivers/svga/svga_state_need_swtnl.c b/src/gallium/drivers/svga/svga_state_need_swtnl.c new file mode 100644 index 0000000000..00201b8091 --- /dev/null +++ b/src/gallium/drivers/svga/svga_state_need_swtnl.c @@ -0,0 +1,200 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "pipe/p_inlines.h" +#include "pipe/p_state.h" + + +#include "svga_context.h" +#include "svga_state.h" +#include "svga_debug.h" +#include "svga_hw_reg.h" + +/*********************************************************************** + */ + +static INLINE SVGA3dDeclType +svga_translate_vertex_format(enum pipe_format format) +{ + switch (format) { + case PIPE_FORMAT_R32_FLOAT: return SVGA3D_DECLTYPE_FLOAT1; + case PIPE_FORMAT_R32G32_FLOAT: return SVGA3D_DECLTYPE_FLOAT2; + case PIPE_FORMAT_R32G32B32_FLOAT: return SVGA3D_DECLTYPE_FLOAT3; + case PIPE_FORMAT_R32G32B32A32_FLOAT: return SVGA3D_DECLTYPE_FLOAT4; + case PIPE_FORMAT_B8G8R8A8_UNORM: return SVGA3D_DECLTYPE_D3DCOLOR; + case PIPE_FORMAT_R8G8B8A8_USCALED: return SVGA3D_DECLTYPE_UBYTE4; + case PIPE_FORMAT_R16G16_SSCALED: return SVGA3D_DECLTYPE_SHORT2; + case PIPE_FORMAT_R16G16B16A16_SSCALED: return SVGA3D_DECLTYPE_SHORT4; + case PIPE_FORMAT_R8G8B8A8_UNORM: return SVGA3D_DECLTYPE_UBYTE4N; + case PIPE_FORMAT_R16G16_SNORM: return SVGA3D_DECLTYPE_SHORT2N; + case PIPE_FORMAT_R16G16B16A16_SNORM: return SVGA3D_DECLTYPE_SHORT4N; + case PIPE_FORMAT_R16G16_UNORM: return SVGA3D_DECLTYPE_USHORT2N; + case PIPE_FORMAT_R16G16B16A16_UNORM: return SVGA3D_DECLTYPE_USHORT4N; + + /* These formats don't exist yet: + * + case PIPE_FORMAT_R10G10B10_USCALED: return SVGA3D_DECLTYPE_UDEC3; + case PIPE_FORMAT_R10G10B10_SNORM: return SVGA3D_DECLTYPE_DEC3N; + case PIPE_FORMAT_R16G16_FLOAT: return SVGA3D_DECLTYPE_FLOAT16_2; + case PIPE_FORMAT_R16G16B16A16_FLOAT: return SVGA3D_DECLTYPE_FLOAT16_4; + */ + + default: + /* There are many formats without hardware support. This case + * will be hit regularly, meaning we'll need swvfetch. + */ + return SVGA3D_DECLTYPE_MAX; + } +} + + +static int update_need_swvfetch( struct svga_context *svga, + unsigned dirty ) +{ + unsigned i; + boolean need_swvfetch = FALSE; + + for (i = 0; i < svga->curr.num_vertex_elements; i++) { + svga->state.sw.ve_format[i] = svga_translate_vertex_format(svga->curr.ve[i].src_format); + if (svga->state.sw.ve_format[i] == SVGA3D_DECLTYPE_MAX) { + need_swvfetch = TRUE; + break; + } + } + + if (need_swvfetch != svga->state.sw.need_swvfetch) { + svga->state.sw.need_swvfetch = need_swvfetch; + svga->dirty |= SVGA_NEW_NEED_SWVFETCH; + } + + return 0; +} + +struct svga_tracked_state svga_update_need_swvfetch = +{ + "update need_swvfetch", + ( SVGA_NEW_VELEMENT ), + update_need_swvfetch +}; + + +/*********************************************************************** + */ + +static int update_need_pipeline( struct svga_context *svga, + unsigned dirty ) +{ + + boolean need_pipeline = FALSE; + + /* SVGA_NEW_RAST, SVGA_NEW_REDUCED_PRIMITIVE + */ + if (svga->curr.rast->need_pipeline & (1 << svga->curr.reduced_prim)) { + SVGA_DBG(DEBUG_SWTNL, "%s: rast need_pipeline (%d) & prim (%x)\n", + __FUNCTION__, + svga->curr.rast->need_pipeline, + (1 << svga->curr.reduced_prim) ); + need_pipeline = TRUE; + } + + /* SVGA_NEW_EDGEFLAGS + */ + if (svga->curr.rast->hw_unfilled != PIPE_POLYGON_MODE_FILL && + svga->curr.reduced_prim == PIPE_PRIM_TRIANGLES && + svga->curr.edgeflags != NULL) { + SVGA_DBG(DEBUG_SWTNL, "%s: edgeflags\n", __FUNCTION__); + need_pipeline = TRUE; + } + + /* SVGA_NEW_CLIP + */ + if (!svga->curr.rast->templ.bypass_vs_clip_and_viewport && + svga->curr.clip.nr) { + SVGA_DBG(DEBUG_SWTNL, "%s: userclip\n", __FUNCTION__); + need_pipeline = TRUE; + } + + if (need_pipeline != svga->state.sw.need_pipeline) { + svga->state.sw.need_pipeline = need_pipeline; + svga->dirty |= SVGA_NEW_NEED_PIPELINE; + } + + return 0; +} + + +struct svga_tracked_state svga_update_need_pipeline = +{ + "need pipeline", + (SVGA_NEW_RAST | + SVGA_NEW_CLIP | + SVGA_NEW_REDUCED_PRIMITIVE), + update_need_pipeline +}; + + +/*********************************************************************** + */ + +static int update_need_swtnl( struct svga_context *svga, + unsigned dirty ) +{ + boolean need_swtnl; + + if (svga->debug.no_swtnl) { + svga->state.sw.need_swvfetch = 0; + svga->state.sw.need_pipeline = 0; + } + + need_swtnl = (svga->state.sw.need_swvfetch || + svga->state.sw.need_pipeline); + + if (svga->debug.force_swtnl) { + need_swtnl = 1; + } + + if (need_swtnl != svga->state.sw.need_swtnl) { + SVGA_DBG(DEBUG_SWTNL|DEBUG_PERF, + "%s need_swvfetch: %s, need_pipeline %s\n", + __FUNCTION__, + svga->state.sw.need_swvfetch ? "true" : "false", + svga->state.sw.need_pipeline ? "true" : "false"); + + svga->state.sw.need_swtnl = need_swtnl; + svga->dirty |= SVGA_NEW_NEED_SWTNL; + svga->swtnl.new_vdecl = TRUE; + } + + return 0; +} + + +struct svga_tracked_state svga_update_need_swtnl = +{ + "need swtnl", + (SVGA_NEW_NEED_PIPELINE | + SVGA_NEW_NEED_SWVFETCH), + update_need_swtnl +}; diff --git a/src/gallium/drivers/svga/svga_state_rss.c b/src/gallium/drivers/svga/svga_state_rss.c new file mode 100644 index 0000000000..8b6803a285 --- /dev/null +++ b/src/gallium/drivers/svga/svga_state_rss.c @@ -0,0 +1,268 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "pipe/p_inlines.h" +#include "pipe/p_defines.h" +#include "util/u_math.h" + +#include "svga_context.h" +#include "svga_state.h" +#include "svga_cmd.h" + +#include "svga_hw_reg.h" + + + +struct rs_queue { + unsigned rs_count; + SVGA3dRenderState rs[SVGA3D_RS_MAX]; +}; + + +#define EMIT_RS(svga, value, token, fail) \ +do { \ + if (svga->state.hw_draw.rs[SVGA3D_RS_##token] != value) { \ + svga_queue_rs( &queue, SVGA3D_RS_##token, value ); \ + svga->state.hw_draw.rs[SVGA3D_RS_##token] = value; \ + } \ +} while (0) + +#define EMIT_RS_FLOAT(svga, fvalue, token, fail) \ +do { \ + unsigned value = fui(fvalue); \ + if (svga->state.hw_draw.rs[SVGA3D_RS_##token] != value) { \ + svga_queue_rs( &queue, SVGA3D_RS_##token, value ); \ + svga->state.hw_draw.rs[SVGA3D_RS_##token] = value; \ + } \ +} while (0) + + +static INLINE void +svga_queue_rs( struct rs_queue *q, + unsigned rss, + unsigned value ) +{ + q->rs[q->rs_count].state = rss; + q->rs[q->rs_count].uintValue = value; + q->rs_count++; +} + + +/* Compare old and new render states and emit differences between them + * to hardware. Simplest implementation would be to emit the whole of + * the "to" state. + */ +static int emit_rss( struct svga_context *svga, + unsigned dirty ) +{ + struct rs_queue queue; + + queue.rs_count = 0; + + if (dirty & SVGA_NEW_BLEND) { + const struct svga_blend_state *curr = svga->curr.blend; + + EMIT_RS( svga, curr->rt[0].writemask, COLORWRITEENABLE, fail ); + EMIT_RS( svga, curr->rt[0].blend_enable, BLENDENABLE, fail ); + + if (curr->rt[0].blend_enable) { + EMIT_RS( svga, curr->rt[0].srcblend, SRCBLEND, fail ); + EMIT_RS( svga, curr->rt[0].dstblend, DSTBLEND, fail ); + EMIT_RS( svga, curr->rt[0].blendeq, BLENDEQUATION, fail ); + + EMIT_RS( svga, curr->rt[0].separate_alpha_blend_enable, + SEPARATEALPHABLENDENABLE, fail ); + + if (curr->rt[0].separate_alpha_blend_enable) { + EMIT_RS( svga, curr->rt[0].srcblend_alpha, SRCBLENDALPHA, fail ); + EMIT_RS( svga, curr->rt[0].dstblend_alpha, DSTBLENDALPHA, fail ); + EMIT_RS( svga, curr->rt[0].blendeq_alpha, BLENDEQUATIONALPHA, fail ); + } + } + } + + + if (dirty & (SVGA_NEW_DEPTH_STENCIL | SVGA_NEW_RAST)) { + const struct svga_depth_stencil_state *curr = svga->curr.depth; + const struct svga_rasterizer_state *rast = svga->curr.rast; + + if (!curr->stencil[0].enabled) + { + /* Stencil disabled + */ + EMIT_RS( svga, FALSE, STENCILENABLE, fail ); + EMIT_RS( svga, FALSE, STENCILENABLE2SIDED, fail ); + } + else if (curr->stencil[0].enabled && !curr->stencil[1].enabled) + { + /* Regular stencil + */ + EMIT_RS( svga, TRUE, STENCILENABLE, fail ); + EMIT_RS( svga, FALSE, STENCILENABLE2SIDED, fail ); + + EMIT_RS( svga, curr->stencil[0].func, STENCILFUNC, fail ); + EMIT_RS( svga, curr->stencil[0].fail, STENCILFAIL, fail ); + EMIT_RS( svga, curr->stencil[0].zfail, STENCILZFAIL, fail ); + EMIT_RS( svga, curr->stencil[0].pass, STENCILPASS, fail ); + + EMIT_RS( svga, curr->stencil_ref, STENCILREF, fail ); + EMIT_RS( svga, curr->stencil_mask, STENCILMASK, fail ); + EMIT_RS( svga, curr->stencil_writemask, STENCILWRITEMASK, fail ); + } + else + { + int cw, ccw; + + /* Hardware frontwinding is always CW, so if ours is also CW, + * then our definition of front face agrees with hardware. + * Otherwise need to flip. + */ + if (rast->templ.front_winding == PIPE_WINDING_CW) { + cw = 0; + ccw = 1; + } + else { + cw = 1; + ccw = 0; + } + + /* Twoside stencil + */ + EMIT_RS( svga, TRUE, STENCILENABLE, fail ); + EMIT_RS( svga, TRUE, STENCILENABLE2SIDED, fail ); + + EMIT_RS( svga, curr->stencil[cw].func, STENCILFUNC, fail ); + EMIT_RS( svga, curr->stencil[cw].fail, STENCILFAIL, fail ); + EMIT_RS( svga, curr->stencil[cw].zfail, STENCILZFAIL, fail ); + EMIT_RS( svga, curr->stencil[cw].pass, STENCILPASS, fail ); + + EMIT_RS( svga, curr->stencil[ccw].func, CCWSTENCILFUNC, fail ); + EMIT_RS( svga, curr->stencil[ccw].fail, CCWSTENCILFAIL, fail ); + EMIT_RS( svga, curr->stencil[ccw].zfail, CCWSTENCILZFAIL, fail ); + EMIT_RS( svga, curr->stencil[ccw].pass, CCWSTENCILPASS, fail ); + + EMIT_RS( svga, curr->stencil_ref, STENCILREF, fail ); + EMIT_RS( svga, curr->stencil_mask, STENCILMASK, fail ); + EMIT_RS( svga, curr->stencil_writemask, STENCILWRITEMASK, fail ); + } + + EMIT_RS( svga, curr->zenable, ZENABLE, fail ); + if (curr->zenable) { + EMIT_RS( svga, curr->zfunc, ZFUNC, fail ); + EMIT_RS( svga, curr->zwriteenable, ZWRITEENABLE, fail ); + } + + EMIT_RS( svga, curr->alphatestenable, ALPHATESTENABLE, fail ); + if (curr->alphatestenable) { + EMIT_RS( svga, curr->alphafunc, ALPHAFUNC, fail ); + EMIT_RS_FLOAT( svga, curr->alpharef, ALPHAREF, fail ); + } + } + + + if (dirty & SVGA_NEW_RAST) + { + const struct svga_rasterizer_state *curr = svga->curr.rast; + + /* Shademode: still need to rearrange index list to move + * flat-shading PV first vertex. + */ + EMIT_RS( svga, curr->shademode, SHADEMODE, fail ); + EMIT_RS( svga, curr->cullmode, CULLMODE, fail ); + EMIT_RS( svga, curr->scissortestenable, SCISSORTESTENABLE, fail ); + EMIT_RS( svga, curr->multisampleantialias, MULTISAMPLEANTIALIAS, fail ); + EMIT_RS( svga, curr->lastpixel, LASTPIXEL, fail ); + EMIT_RS( svga, curr->linepattern, LINEPATTERN, fail ); + EMIT_RS_FLOAT( svga, curr->pointsize, POINTSIZE, fail ); + EMIT_RS_FLOAT( svga, curr->pointsize_min, POINTSIZEMIN, fail ); + EMIT_RS_FLOAT( svga, curr->pointsize_max, POINTSIZEMAX, fail ); + } + + if (dirty & (SVGA_NEW_RAST | SVGA_NEW_FRAME_BUFFER | SVGA_NEW_NEED_PIPELINE)) + { + const struct svga_rasterizer_state *curr = svga->curr.rast; + float slope = 0.0; + float bias = 0.0; + + /* Need to modify depth bias according to bound depthbuffer + * format. Don't do hardware depthbias while the software + * pipeline is active. + */ + if (!svga->state.sw.need_pipeline && + svga->curr.framebuffer.zsbuf) + { + slope = curr->slopescaledepthbias; + bias = svga->curr.depthscale * curr->depthbias; + } + + EMIT_RS_FLOAT( svga, slope, SLOPESCALEDEPTHBIAS, fail ); + EMIT_RS_FLOAT( svga, bias, DEPTHBIAS, fail ); + } + + + if (queue.rs_count) { + SVGA3dRenderState *rs; + + if (SVGA3D_BeginSetRenderState( svga->swc, + &rs, + queue.rs_count ) != PIPE_OK) + goto fail; + + memcpy( rs, + queue.rs, + queue.rs_count * sizeof queue.rs[0]); + + SVGA_FIFOCommitAll( svga->swc ); + } + + /* Also blend color: + */ + + return 0; + +fail: + /* XXX: need to poison cached hardware state on failure to ensure + * dirty state gets re-emitted. Fix this by re-instating partial + * FIFOCommit command and only updating cached hw state once the + * initial allocation has succeeded. + */ + memset(svga->state.hw_draw.rs, 0xcd, sizeof(svga->state.hw_draw.rs)); + + return PIPE_ERROR_OUT_OF_MEMORY; +} + + +struct svga_tracked_state svga_hw_rss = +{ + "hw rss state", + + (SVGA_NEW_BLEND | + SVGA_NEW_DEPTH_STENCIL | + SVGA_NEW_RAST | + SVGA_NEW_FRAME_BUFFER | + SVGA_NEW_NEED_PIPELINE), + + emit_rss +}; diff --git a/src/gallium/drivers/svga/svga_state_tss.c b/src/gallium/drivers/svga/svga_state_tss.c new file mode 100644 index 0000000000..b313794520 --- /dev/null +++ b/src/gallium/drivers/svga/svga_state_tss.c @@ -0,0 +1,279 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "pipe/p_inlines.h" +#include "pipe/p_defines.h" +#include "util/u_math.h" + +#include "svga_screen_texture.h" +#include "svga_winsys.h" +#include "svga_context.h" +#include "svga_state.h" +#include "svga_cmd.h" + +#include "svga_hw_reg.h" + + +void svga_cleanup_tss_binding(struct svga_context *svga) +{ + int i; + unsigned count = MAX2( svga->curr.num_textures, + svga->state.hw_draw.num_views ); + + for (i = 0; i < count; i++) { + struct svga_hw_view_state *view = &svga->state.hw_draw.views[i]; + + svga_sampler_view_reference(&view->v, NULL); + pipe_texture_reference( &svga->curr.texture[i], NULL ); + pipe_texture_reference( &view->texture, NULL ); + + view->dirty = 1; + } +} + + +static int +update_tss_binding(struct svga_context *svga, + unsigned dirty ) +{ + unsigned i; + unsigned count = MAX2( svga->curr.num_textures, + svga->state.hw_draw.num_views ); + unsigned min_lod; + unsigned max_lod; + + + struct { + struct { + unsigned unit; + struct svga_hw_view_state *view; + } bind[PIPE_MAX_SAMPLERS]; + + unsigned bind_count; + } queue; + + queue.bind_count = 0; + + for (i = 0; i < count; i++) { + const struct svga_sampler_state *s = svga->curr.sampler[i]; + struct svga_hw_view_state *view = &svga->state.hw_draw.views[i]; + + /* get min max lod */ + if (svga->curr.texture[i]) { + min_lod = MAX2(s->view_min_lod, 0); + max_lod = MIN2(s->view_max_lod, svga->curr.texture[i]->last_level); + } else { + min_lod = 0; + max_lod = 0; + } + + if (view->texture != svga->curr.texture[i] || + view->min_lod != min_lod || + view->max_lod != max_lod) { + + svga_sampler_view_reference(&view->v, NULL); + pipe_texture_reference( &view->texture, svga->curr.texture[i] ); + + view->dirty = TRUE; + view->min_lod = min_lod; + view->max_lod = max_lod; + + if (svga->curr.texture[i]) + view->v = svga_get_tex_sampler_view(&svga->pipe, + svga->curr.texture[i], + min_lod, + max_lod); + } + + if (view->dirty) { + queue.bind[queue.bind_count].unit = i; + queue.bind[queue.bind_count].view = view; + queue.bind_count++; + } + else if (view->v) { + svga_validate_sampler_view(svga, view->v); + } + } + + svga->state.hw_draw.num_views = svga->curr.num_textures; + + if (queue.bind_count) { + SVGA3dTextureState *ts; + + if (SVGA3D_BeginSetTextureState( svga->swc, + &ts, + queue.bind_count ) != PIPE_OK) + goto fail; + + for (i = 0; i < queue.bind_count; i++) { + ts[i].stage = queue.bind[i].unit; + ts[i].name = SVGA3D_TS_BIND_TEXTURE; + + if (queue.bind[i].view->v) { + svga->swc->surface_relocation(svga->swc, + &ts[i].value, + queue.bind[i].view->v->handle, + PIPE_BUFFER_USAGE_GPU_READ); + } + else { + ts[i].value = SVGA3D_INVALID_ID; + } + + queue.bind[i].view->dirty = FALSE; + } + + SVGA_FIFOCommitAll( svga->swc ); + } + + return 0; + +fail: + return PIPE_ERROR_OUT_OF_MEMORY; +} + + +struct svga_tracked_state svga_hw_tss_binding = { + "texture binding emit", + SVGA_NEW_TEXTURE_BINDING | + SVGA_NEW_SAMPLER, + update_tss_binding +}; + + +/*********************************************************************** + */ + +struct ts_queue { + unsigned ts_count; + SVGA3dTextureState ts[PIPE_MAX_SAMPLERS*SVGA3D_TS_MAX]; +}; + + +#define EMIT_TS(svga, unit, val, token, fail) \ +do { \ + if (svga->state.hw_draw.ts[unit][SVGA3D_TS_##token] != val) { \ + svga_queue_tss( &queue, unit, SVGA3D_TS_##token, val ); \ + svga->state.hw_draw.ts[unit][SVGA3D_TS_##token] = val; \ + } \ +} while (0) + +#define EMIT_TS_FLOAT(svga, unit, fvalue, token, fail) \ +do { \ + unsigned val = fui(fvalue); \ + if (svga->state.hw_draw.ts[unit][SVGA3D_TS_##token] != val) { \ + svga_queue_tss( &queue, unit, SVGA3D_TS_##token, val ); \ + svga->state.hw_draw.ts[unit][SVGA3D_TS_##token] = val; \ + } \ +} while (0) + + +static INLINE void +svga_queue_tss( struct ts_queue *q, + unsigned unit, + unsigned tss, + unsigned value ) +{ + assert(q->ts_count < sizeof(q->ts)/sizeof(q->ts[0])); + q->ts[q->ts_count].stage = unit; + q->ts[q->ts_count].name = tss; + q->ts[q->ts_count].value = value; + q->ts_count++; +} + + +static int +update_tss(struct svga_context *svga, + unsigned dirty ) +{ + unsigned i; + struct ts_queue queue; + + queue.ts_count = 0; + for (i = 0; i < svga->curr.num_samplers; i++) { + if (svga->curr.sampler[i]) { + const struct svga_sampler_state *curr = svga->curr.sampler[i]; + + EMIT_TS(svga, i, curr->mipfilter, MIPFILTER, fail); + EMIT_TS(svga, i, curr->min_lod, TEXTURE_MIPMAP_LEVEL, fail); + EMIT_TS(svga, i, curr->magfilter, MAGFILTER, fail); + EMIT_TS(svga, i, curr->minfilter, MINFILTER, fail); + EMIT_TS(svga, i, curr->aniso_level, TEXTURE_ANISOTROPIC_LEVEL, fail); + EMIT_TS_FLOAT(svga, i, curr->lod_bias, TEXTURE_LOD_BIAS, fail); + EMIT_TS(svga, i, curr->addressu, ADDRESSU, fail); + EMIT_TS(svga, i, curr->addressw, ADDRESSW, fail); + EMIT_TS(svga, i, curr->bordercolor, BORDERCOLOR, fail); + // TEXCOORDINDEX -- hopefully not needed + + if (svga->curr.tex_flags.flag_1d & (1 << i)) { + debug_printf("wrap 1d tex %d\n", i); + EMIT_TS(svga, i, SVGA3D_TEX_ADDRESS_WRAP, ADDRESSV, fail); + } + else + EMIT_TS(svga, i, curr->addressv, ADDRESSV, fail); + + if (svga->curr.tex_flags.flag_srgb & (1 << i)) + EMIT_TS_FLOAT(svga, i, 2.2f, GAMMA, fail); + else + EMIT_TS_FLOAT(svga, i, 1.0f, GAMMA, fail); + + } + } + + if (queue.ts_count) { + SVGA3dTextureState *ts; + + if (SVGA3D_BeginSetTextureState( svga->swc, + &ts, + queue.ts_count ) != PIPE_OK) + goto fail; + + memcpy( ts, + queue.ts, + queue.ts_count * sizeof queue.ts[0]); + + SVGA_FIFOCommitAll( svga->swc ); + } + + return 0; + +fail: + /* XXX: need to poison cached hardware state on failure to ensure + * dirty state gets re-emitted. Fix this by re-instating partial + * FIFOCommit command and only updating cached hw state once the + * initial allocation has succeeded. + */ + memset(svga->state.hw_draw.ts, 0xcd, sizeof(svga->state.hw_draw.ts)); + + return PIPE_ERROR_OUT_OF_MEMORY; +} + + +struct svga_tracked_state svga_hw_tss = { + "texture state emit", + (SVGA_NEW_SAMPLER | + SVGA_NEW_TEXTURE_FLAGS), + update_tss +}; + diff --git a/src/gallium/drivers/svga/svga_state_vdecl.c b/src/gallium/drivers/svga/svga_state_vdecl.c new file mode 100644 index 0000000000..c534308f50 --- /dev/null +++ b/src/gallium/drivers/svga/svga_state_vdecl.c @@ -0,0 +1,182 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "pipe/p_inlines.h" +#include "pipe/p_defines.h" +#include "util/u_math.h" +#include "util/u_upload_mgr.h" + +#include "svga_context.h" +#include "svga_state.h" +#include "svga_draw.h" +#include "svga_tgsi.h" +#include "svga_screen.h" +#include "svga_screen_buffer.h" + +#include "svga_hw_reg.h" + + +static int +upload_user_buffers( struct svga_context *svga ) +{ + enum pipe_error ret = PIPE_OK; + int i; + int nr; + + if (0) + debug_printf("%s: %d\n", __FUNCTION__, svga->curr.num_vertex_buffers); + + nr = svga->curr.num_vertex_buffers; + + for (i = 0; i < nr; i++) + { + if (svga_buffer_is_user_buffer(svga->curr.vb[i].buffer)) + { + struct pipe_buffer *upload_buffer = NULL; + unsigned offset = /*svga->curr.vb[i].buffer_offset*/ 0; + unsigned size = svga->curr.vb[i].buffer->size /*- offset*/; + unsigned upload_offset; + + ret = u_upload_buffer( svga->upload_vb, + offset, + size, + svga->curr.vb[i].buffer, + &upload_offset, + &upload_buffer ); + if (ret) + return ret; + + if (0) + debug_printf("%s: %d: orig buf %p upl buf %p ofs %d sz %d\n", + __FUNCTION__, + i, + svga->curr.vb[i].buffer, + upload_buffer, upload_offset, size); + + /* Make sure we release the old buffer and end up with the + * correct refcount on the uploaded buffer. + */ + pipe_buffer_reference( &svga->curr.vb[i].buffer, NULL ); + svga->curr.vb[i].buffer = upload_buffer; + svga->curr.vb[i].buffer_offset = upload_offset; + } + } + + if (0) + debug_printf("%s: DONE\n", __FUNCTION__); + + return ret; +} + + +/*********************************************************************** + */ + + +static int emit_hw_vs_vdecl( struct svga_context *svga, + unsigned dirty ) +{ + const struct pipe_vertex_element *ve = svga->curr.ve; + SVGA3dVertexDecl decl; + unsigned i; + + assert(svga->curr.num_vertex_elements >= + svga->curr.vs->base.info.file_count[TGSI_FILE_INPUT]); + + svga_hwtnl_reset_vdecl( svga->hwtnl, + svga->curr.num_vertex_elements ); + + for (i = 0; i < svga->curr.num_vertex_elements; i++) { + const struct pipe_vertex_buffer *vb = &svga->curr.vb[ve[i].vertex_buffer_index]; + unsigned usage, index; + + + svga_generate_vdecl_semantics( i, &usage, &index ); + + /* SVGA_NEW_VELEMENT + */ + decl.identity.type = svga->state.sw.ve_format[i]; + decl.identity.method = SVGA3D_DECLMETHOD_DEFAULT; + decl.identity.usage = usage; + decl.identity.usageIndex = index; + decl.array.stride = vb->stride; + decl.array.offset = (vb->buffer_offset + + ve[i].src_offset); + + svga_hwtnl_vdecl( svga->hwtnl, + i, + &decl, + vb->buffer ); + } + + return 0; +} + + +static int emit_hw_vdecl( struct svga_context *svga, + unsigned dirty ) +{ + int ret = 0; + + /* SVGA_NEW_NEED_SWTNL + */ + if (svga->state.sw.need_swtnl) + return 0; /* Do not emit during swtnl */ + + /* If we get to here, we know that we're going to draw. Upload + * userbuffers now and try to combine multiple userbuffers from + * multiple draw calls into a single host buffer for performance. + */ + if (svga->curr.any_user_vertex_buffers && + SVGA_COMBINE_USERBUFFERS) + { + ret = upload_user_buffers( svga ); + if (ret) + return ret; + + svga->curr.any_user_vertex_buffers = FALSE; + } + + return emit_hw_vs_vdecl( svga, dirty ); +} + + +struct svga_tracked_state svga_hw_vdecl = +{ + "hw vertex decl state (hwtnl version)", + ( SVGA_NEW_NEED_SWTNL | + SVGA_NEW_VELEMENT | + SVGA_NEW_VBUFFER | + SVGA_NEW_RAST | + SVGA_NEW_FS | + SVGA_NEW_VS ), + emit_hw_vdecl +}; + + + + + + diff --git a/src/gallium/drivers/svga/svga_state_vs.c b/src/gallium/drivers/svga/svga_state_vs.c new file mode 100644 index 0000000000..a947745732 --- /dev/null +++ b/src/gallium/drivers/svga/svga_state_vs.c @@ -0,0 +1,239 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "pipe/p_inlines.h" +#include "pipe/p_defines.h" +#include "util/u_math.h" +#include "translate/translate.h" + +#include "svga_context.h" +#include "svga_state.h" +#include "svga_cmd.h" +#include "svga_tgsi.h" + +#include "svga_hw_reg.h" + +/*********************************************************************** + */ + + +static INLINE int compare_vs_keys( const struct svga_vs_compile_key *a, + const struct svga_vs_compile_key *b ) +{ + unsigned keysize = svga_vs_key_size( a ); + return memcmp( a, b, keysize ); +} + + +static struct svga_shader_result *search_vs_key( struct svga_vertex_shader *vs, + const struct svga_vs_compile_key *key ) +{ + struct svga_shader_result *result = vs->base.results; + + assert(key); + + for ( ; result; result = result->next) { + if (compare_vs_keys( key, &result->key.vkey ) == 0) + return result; + } + + return NULL; +} + + +static enum pipe_error compile_vs( struct svga_context *svga, + struct svga_vertex_shader *vs, + const struct svga_vs_compile_key *key, + struct svga_shader_result **out_result ) +{ + struct svga_shader_result *result; + enum pipe_error ret = PIPE_OK; + + result = svga_translate_vertex_program( vs, key ); + if (result == NULL) { + ret = PIPE_ERROR_OUT_OF_MEMORY; + goto fail; + } + + ret = SVGA3D_DefineShader(svga->swc, + svga->state.next_vs_id, + SVGA3D_SHADERTYPE_VS, + result->tokens, + result->nr_tokens * sizeof result->tokens[0]); + if (ret) + goto fail; + + *out_result = result; + result->id = svga->state.next_vs_id++; + result->next = vs->base.results; + vs->base.results = result; + return PIPE_OK; + +fail: + if (result) + svga_destroy_shader_result( result ); + return ret; +} + +/* SVGA_NEW_PRESCALE, SVGA_NEW_RAST, SVGA_NEW_ZERO_STRIDE + */ +static int make_vs_key( struct svga_context *svga, + struct svga_vs_compile_key *key ) +{ + memset(key, 0, sizeof *key); + key->need_prescale = svga->state.hw_clear.prescale.enabled; + key->allow_psiz = svga->curr.rast->templ.point_size_per_vertex; + key->zero_stride_vertex_elements = + svga->curr.zero_stride_vertex_elements; + key->num_zero_stride_vertex_elements = + svga->curr.num_zero_stride_vertex_elements; + return 0; +} + + + +static int emit_hw_vs( struct svga_context *svga, + unsigned dirty ) +{ + struct svga_shader_result *result = NULL; + unsigned id = SVGA3D_INVALID_ID; + int ret = 0; + + /* SVGA_NEW_NEED_SWTNL */ + if (!svga->state.sw.need_swtnl) { + struct svga_vertex_shader *vs = svga->curr.vs; + struct svga_vs_compile_key key; + + ret = make_vs_key( svga, &key ); + if (ret) + return ret; + + result = search_vs_key( vs, &key ); + if (!result) { + ret = compile_vs( svga, vs, &key, &result ); + if (ret) + return ret; + } + + assert (result); + id = result->id; + } + + if (id != svga->state.hw_draw.shader_id[PIPE_SHADER_VERTEX]) { + ret = SVGA3D_SetShader(svga->swc, + SVGA3D_SHADERTYPE_VS, + id ); + if (ret) + return ret; + + svga->dirty |= SVGA_NEW_VS_RESULT; + svga->state.hw_draw.shader_id[PIPE_SHADER_VERTEX] = id; + svga->state.hw_draw.vs = result; + } + + return 0; +} + +struct svga_tracked_state svga_hw_vs = +{ + "vertex shader (hwtnl)", + (SVGA_NEW_VS | + SVGA_NEW_PRESCALE | + SVGA_NEW_NEED_SWTNL | + SVGA_NEW_ZERO_STRIDE), + emit_hw_vs +}; + + +/*********************************************************************** + */ +static int update_zero_stride( struct svga_context *svga, + unsigned dirty ) +{ + unsigned i; + + svga->curr.zero_stride_vertex_elements = 0; + svga->curr.num_zero_stride_vertex_elements = 0; + + for (i = 0; i < svga->curr.num_vertex_elements; i++) { + const struct pipe_vertex_element *vel = &svga->curr.ve[i]; + const struct pipe_vertex_buffer *vbuffer = &svga->curr.vb[ + vel->vertex_buffer_index]; + if (vbuffer->stride == 0) { + unsigned const_idx = + svga->curr.num_zero_stride_vertex_elements; + struct translate *translate; + struct translate_key key; + void *mapped_buffer; + + svga->curr.zero_stride_vertex_elements |= (1 << i); + ++svga->curr.num_zero_stride_vertex_elements; + + key.output_stride = 4 * sizeof(float); + key.nr_elements = 1; + key.element[0].input_format = vel->src_format; + key.element[0].output_format = PIPE_FORMAT_R32G32B32A32_FLOAT; + key.element[0].input_buffer = vel->vertex_buffer_index; + key.element[0].input_offset = vel->src_offset; + key.element[0].output_offset = const_idx * 4 * sizeof(float); + + translate_key_sanitize(&key); + /* translate_generic_create is technically private but + * we don't want to code-generate, just want generic + * translation */ + translate = translate_generic_create(&key); + + assert(vel->src_offset == 0); + + mapped_buffer = pipe_buffer_map_range(svga->pipe.screen, + vbuffer->buffer, + vel->src_offset, + pf_get_size(vel->src_format), + PIPE_BUFFER_USAGE_CPU_READ); + translate->set_buffer(translate, vel->vertex_buffer_index, + mapped_buffer, + vbuffer->stride); + translate->run(translate, 0, 1, + svga->curr.zero_stride_constants); + + pipe_buffer_unmap(svga->pipe.screen, + vbuffer->buffer); + translate->release(translate); + } + } + + if (svga->curr.num_zero_stride_vertex_elements) + svga->dirty |= SVGA_NEW_ZERO_STRIDE; + + return 0; +} + +struct svga_tracked_state svga_hw_update_zero_stride = +{ + "update zero_stride", + ( SVGA_NEW_VELEMENT | + SVGA_NEW_VBUFFER ), + update_zero_stride +}; diff --git a/src/gallium/drivers/svga/svga_swtnl.h b/src/gallium/drivers/svga/svga_swtnl.h new file mode 100644 index 0000000000..4882f26b17 --- /dev/null +++ b/src/gallium/drivers/svga/svga_swtnl.h @@ -0,0 +1,52 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#ifndef SVGA_SWTNL_H +#define SVGA_SWTNL_H + +#include "pipe/p_compiler.h" + +struct svga_context; +struct pipe_context; +struct pipe_buffer; +struct vbuf_render; + + +boolean svga_init_swtnl( struct svga_context *svga ); +void svga_destroy_swtnl( struct svga_context *svga ); + + +enum pipe_error +svga_swtnl_draw_range_elements(struct svga_context *svga, + struct pipe_buffer *indexBuffer, + unsigned indexSize, + unsigned min_index, + unsigned max_index, + unsigned prim, + unsigned start, + unsigned count); + + +#endif diff --git a/src/gallium/drivers/svga/svga_swtnl_backend.c b/src/gallium/drivers/svga/svga_swtnl_backend.c new file mode 100644 index 0000000000..b4f757a47a --- /dev/null +++ b/src/gallium/drivers/svga/svga_swtnl_backend.c @@ -0,0 +1,349 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "draw/draw_vbuf.h" +#include "draw/draw_context.h" +#include "draw/draw_vertex.h" + +#include "util/u_debug.h" +#include "pipe/p_inlines.h" +#include "util/u_math.h" +#include "util/u_memory.h" +#include "util/u_simple_shaders.h" + +#include "svga_context.h" +#include "svga_state.h" +#include "svga_swtnl.h" + +#include "svga_types.h" +#include "svga_reg.h" +#include "svga3d_reg.h" +#include "svga_draw.h" +#include "svga_swtnl_private.h" + + +static const struct vertex_info * +svga_vbuf_render_get_vertex_info( struct vbuf_render *render ) +{ + struct svga_vbuf_render *svga_render = svga_vbuf_render(render); + struct svga_context *svga = svga_render->svga; + + svga_swtnl_update_vdecl(svga); + + return &svga_render->vertex_info; +} + + +static boolean +svga_vbuf_render_allocate_vertices( struct vbuf_render *render, + ushort vertex_size, + ushort nr_vertices ) +{ + struct svga_vbuf_render *svga_render = svga_vbuf_render(render); + struct svga_context *svga = svga_render->svga; + struct pipe_screen *screen = svga->pipe.screen; + size_t size = (size_t)nr_vertices * (size_t)vertex_size; + boolean new_vbuf = FALSE; + boolean new_ibuf = FALSE; + + if (svga_render->vertex_size != vertex_size) + svga->swtnl.new_vdecl = TRUE; + svga_render->vertex_size = (size_t)vertex_size; + + if (svga->swtnl.new_vbuf) + new_ibuf = new_vbuf = TRUE; + svga->swtnl.new_vbuf = FALSE; + + if (svga_render->vbuf_size < svga_render->vbuf_offset + svga_render->vbuf_used + size) + new_vbuf = TRUE; + + if (new_vbuf) + pipe_buffer_reference(&svga_render->vbuf, NULL); + if (new_ibuf) + pipe_buffer_reference(&svga_render->ibuf, NULL); + + if (!svga_render->vbuf) { + svga_render->vbuf_size = MAX2(size, svga_render->vbuf_alloc_size); + svga_render->vbuf = pipe_buffer_create(screen, + 0, + PIPE_BUFFER_USAGE_VERTEX, + svga_render->vbuf_size); + if(!svga_render->vbuf) { + svga_context_flush(svga, NULL); + svga_render->vbuf = pipe_buffer_create(screen, + 0, + PIPE_BUFFER_USAGE_VERTEX, + svga_render->vbuf_size); + assert(svga_render->vbuf); + } + + svga->swtnl.new_vdecl = TRUE; + svga_render->vbuf_offset = 0; + } else { + svga_render->vbuf_offset += svga_render->vbuf_used; + } + + svga_render->vbuf_used = 0; + + if (svga->swtnl.new_vdecl) + svga_render->vdecl_offset = svga_render->vbuf_offset; + + return TRUE; +} + +static void * +svga_vbuf_render_map_vertices( struct vbuf_render *render ) +{ + struct svga_vbuf_render *svga_render = svga_vbuf_render(render); + struct svga_context *svga = svga_render->svga; + struct pipe_screen *screen = svga->pipe.screen; + + char *ptr = (char*)pipe_buffer_map(screen, + svga_render->vbuf, + PIPE_BUFFER_USAGE_CPU_WRITE | + PIPE_BUFFER_USAGE_FLUSH_EXPLICIT); + return ptr + svga_render->vbuf_offset; +} + +static void +svga_vbuf_render_unmap_vertices( struct vbuf_render *render, + ushort min_index, + ushort max_index ) +{ + struct svga_vbuf_render *svga_render = svga_vbuf_render(render); + struct svga_context *svga = svga_render->svga; + struct pipe_screen *screen = svga->pipe.screen; + unsigned offset, length; + size_t used = svga_render->vertex_size * ((size_t)max_index + 1); + + offset = svga_render->vbuf_offset + svga_render->vertex_size * min_index; + length = svga_render->vertex_size * (max_index + 1 - min_index); + pipe_buffer_flush_mapped_range(screen, svga_render->vbuf, offset, length); + pipe_buffer_unmap(screen, svga_render->vbuf); + svga_render->min_index = min_index; + svga_render->max_index = max_index; + svga_render->vbuf_used = MAX2(svga_render->vbuf_used, used); +} + +static boolean +svga_vbuf_render_set_primitive( struct vbuf_render *render, + unsigned prim ) +{ + struct svga_vbuf_render *svga_render = svga_vbuf_render(render); + svga_render->prim = prim; + + return TRUE; +} + +static void +svga_vbuf_sumbit_state( struct svga_vbuf_render *svga_render ) +{ + struct svga_context *svga = svga_render->svga; + SVGA3dVertexDecl vdecl[PIPE_MAX_ATTRIBS]; + enum pipe_error ret; + int i; + + /* if the vdecl or vbuf hasn't changed do nothing */ + if (!svga->swtnl.new_vdecl) + return; + + memcpy(vdecl, svga_render->vdecl, sizeof(vdecl)); + + /* flush the hw state */ + ret = svga_hwtnl_flush(svga->hwtnl); + if (ret) { + svga_context_flush(svga, NULL); + ret = svga_hwtnl_flush(svga->hwtnl); + /* if we hit this path we might become synced with hw */ + svga->swtnl.new_vbuf = TRUE; + assert(ret == 0); + } + + svga_hwtnl_reset_vdecl(svga->hwtnl, svga_render->vdecl_count); + + for (i = 0; i < svga_render->vdecl_count; i++) { + vdecl[i].array.offset += svga_render->vdecl_offset; + + svga_hwtnl_vdecl( svga->hwtnl, + i, + &vdecl[i], + svga_render->vbuf ); + } + + /* We have already taken care of flatshading, so let the hwtnl + * module use whatever is most convenient: + */ + if (svga->state.sw.need_pipeline) { + svga_hwtnl_set_flatshade(svga->hwtnl, FALSE, FALSE); + svga_hwtnl_set_unfilled(svga->hwtnl, PIPE_POLYGON_MODE_FILL); + } + else { + svga_hwtnl_set_flatshade( svga->hwtnl, + svga->curr.rast->templ.flatshade, + svga->curr.rast->templ.flatshade_first ); + + svga_hwtnl_set_unfilled( svga->hwtnl, + svga->curr.rast->hw_unfilled ); + } + + svga->swtnl.new_vdecl = FALSE; +} + +static void +svga_vbuf_render_draw_arrays( struct vbuf_render *render, + unsigned start, + uint nr ) +{ + struct svga_vbuf_render *svga_render = svga_vbuf_render(render); + struct svga_context *svga = svga_render->svga; + unsigned bias = (svga_render->vbuf_offset - svga_render->vdecl_offset) / svga_render->vertex_size; + enum pipe_error ret = 0; + + svga_vbuf_sumbit_state(svga_render); + + /* Need to call update_state() again as the draw module may have + * altered some of our state behind our backs. Testcase: + * redbook/polys.c + */ + svga_update_state_retry( svga, SVGA_STATE_HW_DRAW ); + + ret = svga_hwtnl_draw_arrays(svga->hwtnl, svga_render->prim, start + bias, nr); + if (ret != PIPE_OK) { + svga_context_flush(svga, NULL); + ret = svga_hwtnl_draw_arrays(svga->hwtnl, svga_render->prim, start + bias, nr); + svga->swtnl.new_vbuf = TRUE; + assert(ret == PIPE_OK); + } +} + + +static void +svga_vbuf_render_draw( struct vbuf_render *render, + const ushort *indices, + uint nr_indices) +{ + struct svga_vbuf_render *svga_render = svga_vbuf_render(render); + struct svga_context *svga = svga_render->svga; + struct pipe_screen *screen = svga->pipe.screen; + unsigned bias = (svga_render->vbuf_offset - svga_render->vdecl_offset) / svga_render->vertex_size; + boolean ret; + size_t size = 2 * nr_indices; + + assert(( svga_render->vbuf_offset - svga_render->vdecl_offset) % svga_render->vertex_size == 0); + + if (svga_render->ibuf_size < svga_render->ibuf_offset + size) + pipe_buffer_reference(&svga_render->ibuf, NULL); + + if (!svga_render->ibuf) { + svga_render->ibuf_size = MAX2(size, svga_render->ibuf_alloc_size); + svga_render->ibuf = pipe_buffer_create(screen, + 0, + PIPE_BUFFER_USAGE_VERTEX, + svga_render->ibuf_size); + svga_render->ibuf_offset = 0; + } + + pipe_buffer_write(screen, svga_render->ibuf, + svga_render->ibuf_offset, 2 * nr_indices, indices); + + + /* off to hardware */ + svga_vbuf_sumbit_state(svga_render); + + /* Need to call update_state() again as the draw module may have + * altered some of our state behind our backs. Testcase: + * redbook/polys.c + */ + svga_update_state_retry( svga, SVGA_STATE_HW_DRAW ); + + ret = svga_hwtnl_draw_range_elements(svga->hwtnl, + svga_render->ibuf, + 2, + svga_render->min_index, + svga_render->max_index, + svga_render->prim, + svga_render->ibuf_offset / 2, nr_indices, bias); + if(ret != PIPE_OK) { + svga_context_flush(svga, NULL); + ret = svga_hwtnl_draw_range_elements(svga->hwtnl, + svga_render->ibuf, + 2, + svga_render->min_index, + svga_render->max_index, + svga_render->prim, + svga_render->ibuf_offset / 2, nr_indices, bias); + svga->swtnl.new_vbuf = TRUE; + assert(ret == PIPE_OK); + } + + svga_render->ibuf_offset += size; +} + + +static void +svga_vbuf_render_release_vertices( struct vbuf_render *render ) +{ + +} + + +static void +svga_vbuf_render_destroy( struct vbuf_render *render ) +{ + struct svga_vbuf_render *svga_render = svga_vbuf_render(render); + + pipe_buffer_reference(&svga_render->vbuf, NULL); + pipe_buffer_reference(&svga_render->ibuf, NULL); + FREE(svga_render); +} + + +/** + * Create a new primitive render. + */ +struct vbuf_render * +svga_vbuf_render_create( struct svga_context *svga ) +{ + struct svga_vbuf_render *svga_render = CALLOC_STRUCT(svga_vbuf_render); + + svga_render->svga = svga; + svga_render->ibuf_size = 0; + svga_render->vbuf_size = 0; + svga_render->ibuf_alloc_size = 4*1024; + svga_render->vbuf_alloc_size = 64*1024; + svga_render->base.max_vertex_buffer_bytes = 64*1024/10; + svga_render->base.max_indices = 65536; + svga_render->base.get_vertex_info = svga_vbuf_render_get_vertex_info; + svga_render->base.allocate_vertices = svga_vbuf_render_allocate_vertices; + svga_render->base.map_vertices = svga_vbuf_render_map_vertices; + svga_render->base.unmap_vertices = svga_vbuf_render_unmap_vertices; + svga_render->base.set_primitive = svga_vbuf_render_set_primitive; + svga_render->base.draw = svga_vbuf_render_draw; + svga_render->base.draw_arrays = svga_vbuf_render_draw_arrays; + svga_render->base.release_vertices = svga_vbuf_render_release_vertices; + svga_render->base.destroy = svga_vbuf_render_destroy; + + return &svga_render->base; +} diff --git a/src/gallium/drivers/svga/svga_swtnl_draw.c b/src/gallium/drivers/svga/svga_swtnl_draw.c new file mode 100644 index 0000000000..8b14c913f7 --- /dev/null +++ b/src/gallium/drivers/svga/svga_swtnl_draw.c @@ -0,0 +1,170 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "draw/draw_context.h" +#include "draw/draw_vbuf.h" +#include "pipe/p_inlines.h" +#include "pipe/p_state.h" +#include "util/u_memory.h" + +#include "svga_context.h" +#include "svga_swtnl.h" +#include "svga_state.h" +#include "svga_swtnl_private.h" + + + +enum pipe_error +svga_swtnl_draw_range_elements(struct svga_context *svga, + struct pipe_buffer *indexBuffer, + unsigned indexSize, + unsigned min_index, + unsigned max_index, + unsigned prim, unsigned start, unsigned count) +{ + struct draw_context *draw = svga->swtnl.draw; + unsigned i; + const void *map; + enum pipe_error ret; + + assert(!svga->dirty); + assert(svga->state.sw.need_swtnl); + assert(draw); + + ret = svga_update_state(svga, SVGA_STATE_SWTNL_DRAW); + if (ret) { + svga_context_flush(svga, NULL); + ret = svga_update_state(svga, SVGA_STATE_SWTNL_DRAW); + svga->swtnl.new_vbuf = TRUE; + assert(ret == PIPE_OK); + } + + /* + * Map vertex buffers + */ + for (i = 0; i < svga->curr.num_vertex_buffers; i++) { + map = pipe_buffer_map(svga->pipe.screen, + svga->curr.vb[i].buffer, + PIPE_BUFFER_USAGE_CPU_READ); + + draw_set_mapped_vertex_buffer(draw, i, map); + } + + /* Map index buffer, if present */ + if (indexBuffer) { + map = pipe_buffer_map(svga->pipe.screen, indexBuffer, + PIPE_BUFFER_USAGE_CPU_READ); + + draw_set_mapped_element_buffer_range(draw, + indexSize, + min_index, + max_index, + map); + } + + if (svga->curr.cb[PIPE_SHADER_VERTEX]) { + map = pipe_buffer_map(svga->pipe.screen, + svga->curr.cb[PIPE_SHADER_VERTEX], + PIPE_BUFFER_USAGE_CPU_READ); + assert(map); + draw_set_mapped_constant_buffer( + draw, + map, + svga->curr.cb[PIPE_SHADER_VERTEX]->size); + } + + draw_arrays(svga->swtnl.draw, prim, start, count); + + draw_flush(svga->swtnl.draw); + + /* Ensure the draw module didn't touch this */ + assert(i == svga->curr.num_vertex_buffers); + + /* + * unmap vertex/index buffers + */ + for (i = 0; i < svga->curr.num_vertex_buffers; i++) { + pipe_buffer_unmap(svga->pipe.screen, svga->curr.vb[i].buffer); + draw_set_mapped_vertex_buffer(draw, i, NULL); + } + + if (indexBuffer) { + pipe_buffer_unmap(svga->pipe.screen, indexBuffer); + draw_set_mapped_element_buffer(draw, 0, NULL); + } + + if (svga->curr.cb[PIPE_SHADER_VERTEX]) { + pipe_buffer_unmap(svga->pipe.screen, + svga->curr.cb[PIPE_SHADER_VERTEX]); + } + + return ret; +} + + + + +boolean svga_init_swtnl( struct svga_context *svga ) +{ + svga->swtnl.backend = svga_vbuf_render_create(svga); + if(!svga->swtnl.backend) + goto fail; + + /* + * Create drawing context and plug our rendering stage into it. + */ + svga->swtnl.draw = draw_create(); + if (svga->swtnl.draw == NULL) + goto fail; + + + draw_set_rasterize_stage(svga->swtnl.draw, + draw_vbuf_stage( svga->swtnl.draw, svga->swtnl.backend )); + + draw_set_render(svga->swtnl.draw, svga->swtnl.backend); + + draw_install_aaline_stage(svga->swtnl.draw, &svga->pipe); + draw_install_aapoint_stage(svga->swtnl.draw, &svga->pipe); + draw_install_pstipple_stage(svga->swtnl.draw, &svga->pipe); + + draw_set_driver_clipping(svga->swtnl.draw, debug_get_bool_option("SVGA_SWTNL_FSE", FALSE)); + + return TRUE; + +fail: + if (svga->swtnl.backend) + svga->swtnl.backend->destroy( svga->swtnl.backend ); + + if (svga->swtnl.draw) + draw_destroy( svga->swtnl.draw ); + + return FALSE; +} + + +void svga_destroy_swtnl( struct svga_context *svga ) +{ + draw_destroy( svga->swtnl.draw ); +} diff --git a/src/gallium/drivers/svga/svga_swtnl_private.h b/src/gallium/drivers/svga/svga_swtnl_private.h new file mode 100644 index 0000000000..9bbb42910f --- /dev/null +++ b/src/gallium/drivers/svga/svga_swtnl_private.h @@ -0,0 +1,93 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#ifndef SVGA_SWTNL_PRIVATE_H +#define SVGA_SWTNL_PRIVATE_H + +#include "svga_swtnl.h" +#include "draw/draw_vertex.h" + +#include "svga_types.h" +#include "svga3d_reg.h" + +/** + * Primitive renderer for svga. + */ +struct svga_vbuf_render { + struct vbuf_render base; + + struct svga_context *svga; + struct vertex_info vertex_info; + + unsigned vertex_size; + + unsigned prim; + + struct pipe_buffer *vbuf; + struct pipe_buffer *ibuf; + + /* current size of buffer */ + size_t vbuf_size; + size_t ibuf_size; + + /* size of that the buffer should be */ + size_t vbuf_alloc_size; + size_t ibuf_alloc_size; + + /* current write place */ + size_t vbuf_offset; + size_t ibuf_offset; + + /* currently used */ + size_t vbuf_used; + + SVGA3dVertexDecl vdecl[PIPE_MAX_ATTRIBS]; + unsigned vdecl_offset; + unsigned vdecl_count; + + ushort min_index; + ushort max_index; +}; + +/** + * Basically a cast wrapper. + */ +static INLINE struct svga_vbuf_render * +svga_vbuf_render( struct vbuf_render *render ) +{ + assert(render); + return (struct svga_vbuf_render *)render; +} + + +struct vbuf_render * +svga_vbuf_render_create( struct svga_context *svga ); + + +int +svga_swtnl_update_vdecl( struct svga_context *svga ); + + +#endif diff --git a/src/gallium/drivers/svga/svga_swtnl_state.c b/src/gallium/drivers/svga/svga_swtnl_state.c new file mode 100644 index 0000000000..1616312113 --- /dev/null +++ b/src/gallium/drivers/svga/svga_swtnl_state.c @@ -0,0 +1,242 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#include "draw/draw_context.h" +#include "draw/draw_vbuf.h" +#include "pipe/p_inlines.h" +#include "pipe/p_state.h" +#include "util/u_memory.h" + +#include "svga_context.h" +#include "svga_swtnl.h" +#include "svga_state.h" + +#include "svga_swtnl_private.h" + + +#define SVGA_POINT_ADJ_X -0.375 +#define SVGA_POINT_ADJ_Y -0.5 + +#define SVGA_LINE_ADJ_X -0.5 +#define SVGA_LINE_ADJ_Y -0.5 + +#define SVGA_TRIANGLE_ADJ_X -0.375 +#define SVGA_TRIANGLE_ADJ_Y -0.5 + + +static void set_draw_viewport( struct svga_context *svga ) +{ + struct pipe_viewport_state vp = svga->curr.viewport; + float adjx = 0; + float adjy = 0; + + switch (svga->curr.reduced_prim) { + case PIPE_PRIM_POINTS: + adjx = SVGA_POINT_ADJ_X; + adjy = SVGA_POINT_ADJ_Y; + break; + case PIPE_PRIM_LINES: + /* XXX: This is to compensate for the fact that wide lines are + * going to be drawn with triangles, but we're not catching all + * cases where that will happen. + */ + if (svga->curr.rast->templ.line_width > 1.0) + { + adjx = SVGA_LINE_ADJ_X + 0.175; + adjy = SVGA_LINE_ADJ_Y - 0.175; + } + else { + adjx = SVGA_LINE_ADJ_X; + adjy = SVGA_LINE_ADJ_Y; + } + break; + case PIPE_PRIM_TRIANGLES: + adjx += SVGA_TRIANGLE_ADJ_X; + adjy += SVGA_TRIANGLE_ADJ_Y; + break; + } + + vp.translate[0] += adjx; + vp.translate[1] += adjy; + + draw_set_viewport_state(svga->swtnl.draw, &vp); +} + +static int update_swtnl_draw( struct svga_context *svga, + unsigned dirty ) +{ + draw_flush( svga->swtnl.draw ); + + if (dirty & SVGA_NEW_VS) + draw_bind_vertex_shader(svga->swtnl.draw, + svga->curr.vs->draw_shader); + + if (dirty & SVGA_NEW_VBUFFER) + draw_set_vertex_buffers(svga->swtnl.draw, + svga->curr.num_vertex_buffers, + svga->curr.vb); + + if (dirty & SVGA_NEW_VELEMENT) + draw_set_vertex_elements(svga->swtnl.draw, + svga->curr.num_vertex_elements, + svga->curr.ve ); + + if (dirty & SVGA_NEW_CLIP) + draw_set_clip_state(svga->swtnl.draw, + &svga->curr.clip); + + if (dirty & (SVGA_NEW_VIEWPORT | + SVGA_NEW_REDUCED_PRIMITIVE | + SVGA_NEW_RAST)) + set_draw_viewport( svga ); + + if (dirty & SVGA_NEW_RAST) + draw_set_rasterizer_state(svga->swtnl.draw, + &svga->curr.rast->templ); + + if (dirty & SVGA_NEW_FRAME_BUFFER) + draw_set_mrd(svga->swtnl.draw, + svga->curr.depthscale); + + if (dirty & SVGA_NEW_EDGEFLAGS) + draw_set_edgeflags( svga->swtnl.draw, + svga->curr.edgeflags ); + + return 0; +} + + +struct svga_tracked_state svga_update_swtnl_draw = +{ + "update draw module state", + (SVGA_NEW_VS | + SVGA_NEW_VBUFFER | + SVGA_NEW_VELEMENT | + SVGA_NEW_CLIP | + SVGA_NEW_VIEWPORT | + SVGA_NEW_RAST | + SVGA_NEW_FRAME_BUFFER | + SVGA_NEW_REDUCED_PRIMITIVE | + SVGA_NEW_EDGEFLAGS), + update_swtnl_draw +}; + + +int svga_swtnl_update_vdecl( struct svga_context *svga ) +{ + struct svga_vbuf_render *svga_render = svga_vbuf_render(svga->swtnl.backend); + struct draw_context *draw = svga->swtnl.draw; + struct vertex_info *vinfo = &svga_render->vertex_info; + SVGA3dVertexDecl vdecl[PIPE_MAX_ATTRIBS]; + const enum interp_mode colorInterp = + svga->curr.rast->templ.flatshade ? INTERP_CONSTANT : INTERP_LINEAR; + const struct svga_fragment_shader *fs = svga->curr.fs; + int offset = 0; + int nr_decls = 0; + int src, i; + + memset(vinfo, 0, sizeof(*vinfo)); + memset(vdecl, 0, sizeof(vdecl)); + + /* always add position */ + src = draw_find_vs_output(draw, TGSI_SEMANTIC_POSITION, 0); + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_LINEAR, src); + vinfo->attrib[0].emit = EMIT_4F; + vdecl[0].array.offset = offset; + vdecl[0].identity.type = SVGA3D_DECLTYPE_FLOAT4; + vdecl[0].identity.usage = SVGA3D_DECLUSAGE_POSITIONT; + vdecl[0].identity.usageIndex = 0; + offset += 16; + nr_decls++; + + for (i = 0; i < fs->base.info.num_inputs; i++) { + unsigned name = fs->base.info.input_semantic_name[i]; + unsigned index = fs->base.info.input_semantic_index[i]; + src = draw_find_vs_output(draw, name, index); + vdecl[nr_decls].array.offset = offset; + vdecl[nr_decls].identity.usageIndex = fs->base.info.input_semantic_index[i]; + + switch (name) { + case TGSI_SEMANTIC_COLOR: + draw_emit_vertex_attr(vinfo, EMIT_4F, colorInterp, src); + vdecl[nr_decls].identity.usage = SVGA3D_DECLUSAGE_COLOR; + vdecl[nr_decls].identity.type = SVGA3D_DECLTYPE_FLOAT4; + offset += 16; + nr_decls++; + break; + case TGSI_SEMANTIC_GENERIC: + draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, src); + vdecl[nr_decls].identity.usage = SVGA3D_DECLUSAGE_TEXCOORD; + vdecl[nr_decls].identity.type = SVGA3D_DECLTYPE_FLOAT4; + vdecl[nr_decls].identity.usageIndex += 1; + offset += 16; + nr_decls++; + break; + case TGSI_SEMANTIC_FOG: + draw_emit_vertex_attr(vinfo, EMIT_1F, INTERP_PERSPECTIVE, src); + vdecl[nr_decls].identity.usage = SVGA3D_DECLUSAGE_TEXCOORD; + vdecl[nr_decls].identity.type = SVGA3D_DECLTYPE_FLOAT1; + assert(vdecl[nr_decls].identity.usageIndex == 0); + offset += 4; + nr_decls++; + break; + case TGSI_SEMANTIC_POSITION: + /* generated internally, not a vertex shader output */ + break; + default: + assert(0); + } + } + + draw_compute_vertex_size(vinfo); + + svga_render->vdecl_count = nr_decls; + for (i = 0; i < svga_render->vdecl_count; i++) + vdecl[i].array.stride = offset; + + if (memcmp(svga_render->vdecl, vdecl, sizeof(vdecl)) == 0) + return 0; + + memcpy(svga_render->vdecl, vdecl, sizeof(vdecl)); + svga->swtnl.new_vdecl = TRUE; + + return 0; +} + + +static int update_swtnl_vdecl( struct svga_context *svga, + unsigned dirty ) +{ + return svga_swtnl_update_vdecl( svga ); +} + + +struct svga_tracked_state svga_update_swtnl_vdecl = +{ + "update draw module vdecl", + (SVGA_NEW_VS | + SVGA_NEW_FS), + update_swtnl_vdecl +}; diff --git a/src/gallium/drivers/svga/svga_tgsi.c b/src/gallium/drivers/svga/svga_tgsi.c new file mode 100644 index 0000000000..44d0930bc0 --- /dev/null +++ b/src/gallium/drivers/svga/svga_tgsi.c @@ -0,0 +1,266 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + + +#include "pipe/p_compiler.h" +#include "pipe/p_shader_tokens.h" +#include "pipe/p_defines.h" +#include "tgsi/tgsi_parse.h" +#include "tgsi/tgsi_dump.h" +#include "tgsi/tgsi_scan.h" +#include "util/u_memory.h" + +#include "svgadump/st_shader_dump.h" + +#include "svga_context.h" +#include "svga_tgsi.h" +#include "svga_tgsi_emit.h" +#include "svga_debug.h" + +#include "svga_hw_reg.h" +#include "svga3d_shaderdefs.h" + + +/* Sinkhole used only in error conditions. + */ +static char err_buf[128]; + +#if 0 +static void svga_destroy_shader_emitter( struct svga_shader_emitter *emit ) +{ + if (emit->buf != err_buf) + FREE(emit->buf); +} +#endif + + +static boolean svga_shader_expand( struct svga_shader_emitter *emit ) +{ + char *new_buf; + unsigned newsize = emit->size * 2; + + if(emit->buf != err_buf) + new_buf = REALLOC(emit->buf, emit->size, newsize); + else + new_buf = NULL; + + if (new_buf == NULL) { + emit->ptr = err_buf; + emit->buf = err_buf; + emit->size = sizeof(err_buf); + return FALSE; + } + + emit->size = newsize; + emit->ptr = new_buf + (emit->ptr - emit->buf); + emit->buf = new_buf; + return TRUE; +} + +static INLINE boolean reserve( struct svga_shader_emitter *emit, + unsigned nr_dwords ) +{ + if (emit->ptr - emit->buf + nr_dwords * sizeof(unsigned) >= emit->size) { + if (!svga_shader_expand( emit )) + return FALSE; + } + + return TRUE; +} + +boolean svga_shader_emit_dword( struct svga_shader_emitter *emit, + unsigned dword ) +{ + if (!reserve(emit, 1)) + return FALSE; + + *(unsigned *)emit->ptr = dword; + emit->ptr += sizeof dword; + return TRUE; +} + +boolean svga_shader_emit_dwords( struct svga_shader_emitter *emit, + const unsigned *dwords, + unsigned nr ) +{ + if (!reserve(emit, nr)) + return FALSE; + + memcpy( emit->ptr, dwords, nr * sizeof *dwords ); + emit->ptr += nr * sizeof *dwords; + return TRUE; +} + +boolean svga_shader_emit_opcode( struct svga_shader_emitter *emit, + unsigned opcode ) +{ + SVGA3dShaderInstToken *here; + + if (!reserve(emit, 1)) + return FALSE; + + here = (SVGA3dShaderInstToken *)emit->ptr; + here->value = opcode; + + if (emit->insn_offset) { + SVGA3dShaderInstToken *prev = (SVGA3dShaderInstToken *)(emit->buf + + emit->insn_offset); + prev->size = (here - prev) - 1; + } + + emit->insn_offset = emit->ptr - emit->buf; + emit->ptr += sizeof(unsigned); + return TRUE; +} + +#define SVGA3D_PS_2X (SVGA3D_PS_20 | 1) +#define SVGA3D_VS_2X (SVGA3D_VS_20 | 1) + +static boolean svga_shader_emit_header( struct svga_shader_emitter *emit ) +{ + SVGA3dShaderVersion header; + + memset( &header, 0, sizeof header ); + + switch (emit->unit) { + case PIPE_SHADER_FRAGMENT: + header.value = emit->use_sm30 ? SVGA3D_PS_30 : SVGA3D_PS_2X; + break; + case PIPE_SHADER_VERTEX: + header.value = emit->use_sm30 ? SVGA3D_VS_30 : SVGA3D_VS_2X; + break; + } + + return svga_shader_emit_dword( emit, header.value ); +} + + + + + +/* Parse TGSI shader and translate to SVGA/DX9 serialized + * representation. + * + * In this function SVGA shader is emitted to an in-memory buffer that + * can be dynamically grown. Once we've finished and know how large + * it is, it will be copied to a hardware buffer for upload. + */ +static struct svga_shader_result * +svga_tgsi_translate( const struct svga_shader *shader, + union svga_compile_key key, + unsigned unit ) +{ + struct svga_shader_result *result = NULL; + struct svga_shader_emitter emit; + int ret = 0; + + memset(&emit, 0, sizeof(emit)); + + emit.use_sm30 = shader->use_sm30; + emit.size = 1024; + emit.buf = MALLOC(emit.size); + if (emit.buf == NULL) { + ret = PIPE_ERROR_OUT_OF_MEMORY; + goto fail; + } + + emit.ptr = emit.buf; + emit.unit = unit; + emit.key = key; + + tgsi_scan_shader( shader->tokens, &emit.info); + + emit.imm_start = emit.info.file_max[TGSI_FILE_CONSTANT] + 1; + + if (unit == PIPE_SHADER_FRAGMENT) + emit.imm_start += key.fkey.num_unnormalized_coords; + + if (unit == PIPE_SHADER_VERTEX) { + emit.imm_start += key.vkey.need_prescale ? 2 : 0; + emit.imm_start += key.vkey.num_zero_stride_vertex_elements; + } + + emit.nr_hw_const = (emit.imm_start + emit.info.file_max[TGSI_FILE_IMMEDIATE] + 1); + + emit.nr_hw_temp = emit.info.file_max[TGSI_FILE_TEMPORARY] + 1; + emit.in_main_func = TRUE; + + if (!svga_shader_emit_header( &emit )) + goto fail; + + if (!svga_shader_emit_instructions( &emit, shader->tokens )) + goto fail; + + result = CALLOC_STRUCT(svga_shader_result); + if (result == NULL) + goto fail; + + result->shader = shader; + result->tokens = (const unsigned *)emit.buf; + result->nr_tokens = (emit.ptr - emit.buf) / sizeof(unsigned); + memcpy(&result->key, &key, sizeof key); + + return result; + +fail: + FREE(result); + FREE(emit.buf); + return NULL; +} + + + + +struct svga_shader_result * +svga_translate_fragment_program( const struct svga_fragment_shader *fs, + const struct svga_fs_compile_key *fkey ) +{ + union svga_compile_key key; + memcpy(&key.fkey, fkey, sizeof *fkey); + + return svga_tgsi_translate( &fs->base, + key, + PIPE_SHADER_FRAGMENT ); +} + +struct svga_shader_result * +svga_translate_vertex_program( const struct svga_vertex_shader *vs, + const struct svga_vs_compile_key *vkey ) +{ + union svga_compile_key key; + memcpy(&key.vkey, vkey, sizeof *vkey); + + return svga_tgsi_translate( &vs->base, + key, + PIPE_SHADER_VERTEX ); +} + + +void svga_destroy_shader_result( struct svga_shader_result *result ) +{ + FREE((unsigned *)result->tokens); + FREE(result); +} + diff --git a/src/gallium/drivers/svga/svga_tgsi.h b/src/gallium/drivers/svga/svga_tgsi.h new file mode 100644 index 0000000000..896c90a89a --- /dev/null +++ b/src/gallium/drivers/svga/svga_tgsi.h @@ -0,0 +1,139 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#ifndef SVGA_TGSI_H +#define SVGA_TGSI_H + +#include "pipe/p_state.h" + +#include "svga_hw_reg.h" + +struct svga_fragment_shader; +struct svga_vertex_shader; +struct svga_shader; +struct tgsi_shader_info; +struct tgsi_token; + + +struct svga_vs_compile_key +{ + ubyte need_prescale:1; + ubyte allow_psiz:1; + unsigned zero_stride_vertex_elements; + ubyte num_zero_stride_vertex_elements:6; +}; + +struct svga_fs_compile_key +{ + boolean light_twoside:1; + boolean front_cw:1; + ubyte num_textures; + ubyte num_unnormalized_coords; + struct { + ubyte compare_mode : 1; + ubyte compare_func : 3; + ubyte unnormalized : 1; + + ubyte width_height_idx : 7; + + ubyte texture_target; + } tex[PIPE_MAX_SAMPLERS]; +}; + +union svga_compile_key { + struct svga_vs_compile_key vkey; + struct svga_fs_compile_key fkey; +}; + +struct svga_shader_result +{ + const struct svga_shader *shader; + + /* Parameters used to generate this compilation result: + */ + union svga_compile_key key; + + /* Compiled shader tokens: + */ + const unsigned *tokens; + unsigned nr_tokens; + + /* SVGA Shader ID: + */ + unsigned id; + + /* Next compilation result: + */ + struct svga_shader_result *next; +}; + + +/* TGSI doesn't provide use with VS input semantics (they're actually + * pretty meaningless), so we just generate some plausible ones here. + * This is called both from within the TGSI translator and when + * building vdecls to ensure they match up. + * + * The real use of this information is matching vertex elements to + * fragment shader inputs in the case where vertex shader is disabled. + */ +static INLINE void svga_generate_vdecl_semantics( unsigned idx, + unsigned *usage, + unsigned *usage_index ) +{ + if (idx == 0) { + *usage = SVGA3D_DECLUSAGE_POSITION; + *usage_index = 0; + } + else { + *usage = SVGA3D_DECLUSAGE_TEXCOORD; + *usage_index = idx - 1; + } +} + + + +static INLINE unsigned svga_vs_key_size( const struct svga_vs_compile_key *key ) +{ + return sizeof *key; +} + +static INLINE unsigned svga_fs_key_size( const struct svga_fs_compile_key *key ) +{ + return (const char *)&key->tex[key->num_textures].texture_target - + (const char *)key; +} + +struct svga_shader_result * +svga_translate_fragment_program( const struct svga_fragment_shader *fs, + const struct svga_fs_compile_key *fkey ); + +struct svga_shader_result * +svga_translate_vertex_program( const struct svga_vertex_shader *fs, + const struct svga_vs_compile_key *vkey ); + + +void svga_destroy_shader_result( struct svga_shader_result *result ); + +#endif diff --git a/src/gallium/drivers/svga/svga_tgsi_decl_sm20.c b/src/gallium/drivers/svga/svga_tgsi_decl_sm20.c new file mode 100644 index 0000000000..54457082a0 --- /dev/null +++ b/src/gallium/drivers/svga/svga_tgsi_decl_sm20.c @@ -0,0 +1,280 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + + +#include "pipe/p_shader_tokens.h" +#include "tgsi/tgsi_parse.h" +#include "util/u_memory.h" + +#include "svga_tgsi_emit.h" +#include "svga_context.h" + + + + +static boolean ps20_input( struct svga_shader_emitter *emit, + struct tgsi_declaration_semantic semantic, + unsigned idx ) +{ + struct src_register reg; + SVGA3DOpDclArgs dcl; + SVGA3dShaderInstToken opcode; + + opcode = inst_token( SVGA3DOP_DCL ); + dcl.values[0] = 0; + dcl.values[1] = 0; + + switch (semantic.SemanticName) { + case TGSI_SEMANTIC_POSITION: + /* Special case: + */ + reg = src_register( SVGA3DREG_MISCTYPE, + SVGA3DMISCREG_POSITION ); + break; + case TGSI_SEMANTIC_COLOR: + reg = src_register( SVGA3DREG_INPUT, + semantic.SemanticIndex ); + break; + case TGSI_SEMANTIC_FOG: + assert(semantic.SemanticIndex == 0); + reg = src_register( SVGA3DREG_TEXTURE, 0 ); + break; + case TGSI_SEMANTIC_GENERIC: + reg = src_register( SVGA3DREG_TEXTURE, + semantic.SemanticIndex + 1 ); + break; + default: + assert(0); + return TRUE; + } + + emit->input_map[idx] = reg; + + dcl.dst = dst( reg ); + + dcl.usage = 0; + dcl.index = 0; + + dcl.values[0] |= 1<<31; + + return (emit_instruction(emit, opcode) && + svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values))); +} + + +static boolean ps20_output( struct svga_shader_emitter *emit, + struct tgsi_declaration_semantic semantic, + unsigned idx ) +{ + SVGA3dShaderDestToken reg; + + switch (semantic.SemanticName) { + case TGSI_SEMANTIC_COLOR: + if (semantic.SemanticIndex < PIPE_MAX_COLOR_BUFS) { + unsigned cbuf = semantic.SemanticIndex; + + emit->output_map[idx] = dst_register( SVGA3DREG_TEMP, + emit->nr_hw_temp++ ); + emit->temp_col[cbuf] = emit->output_map[idx]; + emit->true_col[cbuf] = dst_register( SVGA3DREG_COLOROUT, + semantic.SemanticIndex ); + } + else { + assert(0); + reg = dst_register( SVGA3DREG_COLOROUT, 0 ); + } + break; + case TGSI_SEMANTIC_POSITION: + emit->output_map[idx] = dst_register( SVGA3DREG_TEMP, + emit->nr_hw_temp++ ); + emit->temp_pos = emit->output_map[idx]; + emit->true_pos = dst_register( SVGA3DREG_DEPTHOUT, + semantic.SemanticIndex ); + break; + default: + assert(0); + reg = dst_register( SVGA3DREG_COLOROUT, 0 ); + break; + } + + return TRUE; +} + + +static boolean vs20_input( struct svga_shader_emitter *emit, + struct tgsi_declaration_semantic semantic, + unsigned idx ) +{ + SVGA3DOpDclArgs dcl; + SVGA3dShaderInstToken opcode; + + opcode = inst_token( SVGA3DOP_DCL ); + dcl.values[0] = 0; + dcl.values[1] = 0; + + emit->input_map[idx] = src_register( SVGA3DREG_INPUT, idx ); + dcl.dst = dst_register( SVGA3DREG_INPUT, idx ); + + assert(dcl.dst.reserved0); + + /* Mesa doesn't provide use with VS input semantics (they're + * actually pretty meaningless), so we just generate some plausible + * ones here. This has to match what we declare in the vdecl code + * in svga_pipe_vertex.c. + */ + if (idx == 0) { + dcl.usage = SVGA3D_DECLUSAGE_POSITION; + dcl.index = 0; + } + else { + dcl.usage = SVGA3D_DECLUSAGE_TEXCOORD; + dcl.index = idx - 1; + } + + dcl.values[0] |= 1<<31; + + return (emit_instruction(emit, opcode) && + svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values))); +} + + +static boolean vs20_output( struct svga_shader_emitter *emit, + struct tgsi_declaration_semantic semantic, + unsigned idx ) +{ + /* Don't emit dcl instruction for vs20 inputs + */ + + /* Just build the register map table: + */ + switch (semantic.SemanticName) { + case TGSI_SEMANTIC_POSITION: + assert(semantic.SemanticIndex == 0); + emit->output_map[idx] = dst_register( SVGA3DREG_TEMP, + emit->nr_hw_temp++ ); + emit->temp_pos = emit->output_map[idx]; + emit->true_pos = dst_register( SVGA3DREG_RASTOUT, + SVGA3DRASTOUT_POSITION); + break; + case TGSI_SEMANTIC_PSIZE: + assert(semantic.SemanticIndex == 0); + emit->output_map[idx] = dst_register( SVGA3DREG_TEMP, + emit->nr_hw_temp++ ); + emit->temp_psiz = emit->output_map[idx]; + emit->true_psiz = dst_register( SVGA3DREG_RASTOUT, + SVGA3DRASTOUT_PSIZE ); + break; + case TGSI_SEMANTIC_FOG: + assert(semantic.SemanticIndex == 0); + emit->output_map[idx] = dst_register( SVGA3DREG_TEXCRDOUT, 0 ); + break; + case TGSI_SEMANTIC_COLOR: + /* oD0 */ + emit->output_map[idx] = dst_register( SVGA3DREG_ATTROUT, + semantic.SemanticIndex ); + break; + case TGSI_SEMANTIC_GENERIC: + emit->output_map[idx] = dst_register( SVGA3DREG_TEXCRDOUT, + semantic.SemanticIndex + 1 ); + break; + default: + assert(0); + emit->output_map[idx] = dst_register( SVGA3DREG_TEMP, 0 ); + return FALSE; + } + + return TRUE; +} + +static boolean ps20_sampler( struct svga_shader_emitter *emit, + struct tgsi_declaration_semantic semantic, + unsigned idx ) +{ + SVGA3DOpDclArgs dcl; + SVGA3dShaderInstToken opcode; + + opcode = inst_token( SVGA3DOP_DCL ); + dcl.values[0] = 0; + dcl.values[1] = 0; + + dcl.dst = dst_register( SVGA3DREG_SAMPLER, idx ); + dcl.type = svga_tgsi_sampler_type( emit, idx ); + + return (emit_instruction(emit, opcode) && + svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values))); +} + + +boolean svga_translate_decl_sm20( struct svga_shader_emitter *emit, + const struct tgsi_full_declaration *decl ) +{ + unsigned first = decl->DeclarationRange.First; + unsigned last = decl->DeclarationRange.Last; + unsigned semantic = 0; + unsigned semantic_idx = 0; + unsigned idx; + + if (decl->Declaration.Semantic) { + semantic = decl->Semantic.SemanticName; + semantic_idx = decl->Semantic.SemanticIndex; + } + + for( idx = first; idx <= last; idx++ ) { + boolean ok; + + switch (decl->Declaration.File) { + case TGSI_FILE_SAMPLER: + assert (emit->unit == PIPE_SHADER_FRAGMENT); + ok = ps20_sampler( emit, decl->Semantic, idx ); + break; + + case TGSI_FILE_INPUT: + if (emit->unit == PIPE_SHADER_VERTEX) + ok = vs20_input( emit, decl->Semantic, idx ); + else + ok = ps20_input( emit, decl->Semantic, idx ); + break; + + case TGSI_FILE_OUTPUT: + if (emit->unit == PIPE_SHADER_VERTEX) + ok = vs20_output( emit, decl->Semantic, idx ); + else + ok = ps20_output( emit, decl->Semantic, idx ); + break; + + default: + /* don't need to declare other vars */ + ok = TRUE; + } + + if (!ok) + return FALSE; + } + + return TRUE; +} + + + diff --git a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c new file mode 100644 index 0000000000..08e7dfb117 --- /dev/null +++ b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c @@ -0,0 +1,385 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + + +#include "pipe/p_shader_tokens.h" +#include "tgsi/tgsi_parse.h" +#include "util/u_memory.h" + +#include "svga_tgsi_emit.h" +#include "svga_context.h" + +static boolean translate_vs_ps_semantic( struct tgsi_declaration_semantic semantic, + unsigned *usage, + unsigned *idx ) +{ + switch (semantic.SemanticName) { + case TGSI_SEMANTIC_POSITION: + *idx = semantic.SemanticIndex; + *usage = SVGA3D_DECLUSAGE_POSITION; + break; + case TGSI_SEMANTIC_COLOR: + + *idx = semantic.SemanticIndex; + *usage = SVGA3D_DECLUSAGE_COLOR; + break; + case TGSI_SEMANTIC_BCOLOR: + *idx = semantic.SemanticIndex + 2; /* sharing with COLOR */ + *usage = SVGA3D_DECLUSAGE_COLOR; + break; + case TGSI_SEMANTIC_FOG: + *idx = 0; + assert(semantic.SemanticIndex == 0); + *usage = SVGA3D_DECLUSAGE_TEXCOORD; + break; + case TGSI_SEMANTIC_PSIZE: + *idx = semantic.SemanticIndex; + *usage = SVGA3D_DECLUSAGE_PSIZE; + break; + case TGSI_SEMANTIC_GENERIC: + *idx = semantic.SemanticIndex + 1; /* texcoord[0] is reserved for fog */ + *usage = SVGA3D_DECLUSAGE_TEXCOORD; + break; + case TGSI_SEMANTIC_NORMAL: + *idx = semantic.SemanticIndex; + *usage = SVGA3D_DECLUSAGE_NORMAL; + break; + default: + assert(0); + *usage = SVGA3D_DECLUSAGE_TEXCOORD; + *idx = 0; + return FALSE; + } + + return TRUE; +} + + +static boolean emit_decl( struct svga_shader_emitter *emit, + SVGA3dShaderDestToken reg, + unsigned usage, + unsigned index ) +{ + SVGA3DOpDclArgs dcl; + SVGA3dShaderInstToken opcode; + + opcode = inst_token( SVGA3DOP_DCL ); + dcl.values[0] = 0; + dcl.values[1] = 0; + + dcl.dst = reg; + dcl.usage = usage; + dcl.index = index; + dcl.values[0] |= 1<<31; + + return (emit_instruction(emit, opcode) && + svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values))); +} + +static boolean emit_vface_decl( struct svga_shader_emitter *emit ) +{ + if (!emit->emitted_vface) { + SVGA3dShaderDestToken reg = + dst_register( SVGA3DREG_MISCTYPE, + SVGA3DMISCREG_FACE ); + + if (!emit_decl( emit, reg, 0, 0 )) + return FALSE; + + emit->emitted_vface = TRUE; + } + return TRUE; +} + +static boolean ps30_input( struct svga_shader_emitter *emit, + struct tgsi_declaration_semantic semantic, + unsigned idx ) +{ + unsigned usage, index; + SVGA3dShaderDestToken reg; + + if (semantic.SemanticName == TGSI_SEMANTIC_POSITION) { + emit->input_map[idx] = src_register( SVGA3DREG_MISCTYPE, + SVGA3DMISCREG_POSITION ); + + emit->input_map[idx].base.swizzle = TRANSLATE_SWIZZLE( TGSI_SWIZZLE_X, + TGSI_SWIZZLE_Y, + TGSI_SWIZZLE_Y, + TGSI_SWIZZLE_Y ); + + reg = writemask( dst(emit->input_map[idx]), + TGSI_WRITEMASK_XY ); + + return emit_decl( emit, reg, 0, 0 ); + } + else if (emit->key.fkey.light_twoside && + (semantic.SemanticName == TGSI_SEMANTIC_COLOR)) { + + if (!translate_vs_ps_semantic( semantic, &usage, &index )) + return FALSE; + + emit->internal_color_idx[emit->internal_color_count] = idx; + emit->input_map[idx] = src_register( SVGA3DREG_INPUT, emit->ps30_input_count ); + emit->ps30_input_count++; + emit->internal_color_count++; + + reg = dst( emit->input_map[idx] ); + + if (!emit_decl( emit, reg, usage, index )) + return FALSE; + + semantic.SemanticName = TGSI_SEMANTIC_BCOLOR; + if (!translate_vs_ps_semantic( semantic, &usage, &index )) + return FALSE; + + reg = dst_register( SVGA3DREG_INPUT, emit->ps30_input_count++ ); + + if (!emit_decl( emit, reg, usage, index )) + return FALSE; + + if (!emit_vface_decl( emit )) + return FALSE; + + return TRUE; + } + else if (semantic.SemanticName == TGSI_SEMANTIC_FACE) { + if (!emit_vface_decl( emit )) + return FALSE; + emit->emit_frontface = TRUE; + emit->internal_frontface_idx = idx; + return TRUE; + } + else { + + if (!translate_vs_ps_semantic( semantic, &usage, &index )) + return FALSE; + + emit->input_map[idx] = src_register( SVGA3DREG_INPUT, emit->ps30_input_count++ ); + reg = dst( emit->input_map[idx] ); + + return emit_decl( emit, reg, usage, index ); + } + +} + + +/* PS output registers are the same as 2.0 + */ +static boolean ps30_output( struct svga_shader_emitter *emit, + struct tgsi_declaration_semantic semantic, + unsigned idx ) +{ + SVGA3dShaderDestToken reg; + + switch (semantic.SemanticName) { + case TGSI_SEMANTIC_COLOR: + emit->output_map[idx] = dst_register( SVGA3DREG_COLOROUT, + semantic.SemanticIndex ); + break; + case TGSI_SEMANTIC_POSITION: + emit->output_map[idx] = dst_register( SVGA3DREG_TEMP, + emit->nr_hw_temp++ ); + emit->temp_pos = emit->output_map[idx]; + emit->true_pos = dst_register( SVGA3DREG_DEPTHOUT, + semantic.SemanticIndex ); + break; + default: + assert(0); + reg = dst_register( SVGA3DREG_COLOROUT, 0 ); + break; + } + + return TRUE; +} + + +/* We still make up the input semantics the same as in 2.0 + */ +static boolean vs30_input( struct svga_shader_emitter *emit, + struct tgsi_declaration_semantic semantic, + unsigned idx ) +{ + SVGA3DOpDclArgs dcl; + SVGA3dShaderInstToken opcode; + unsigned usage, index; + + opcode = inst_token( SVGA3DOP_DCL ); + dcl.values[0] = 0; + dcl.values[1] = 0; + + if (emit->key.vkey.zero_stride_vertex_elements & (1 << idx)) { + unsigned i; + unsigned offset = 0; + unsigned start_idx = emit->info.file_max[TGSI_FILE_CONSTANT] + 1; + /* adjust for prescale constants */ + start_idx += emit->key.vkey.need_prescale ? 2 : 0; + /* compute the offset from the start of zero stride constants */ + for (i = 0; i < PIPE_MAX_ATTRIBS && i < idx; ++i) { + if (emit->key.vkey.zero_stride_vertex_elements & (1<input_map[idx] = src_register( SVGA3DREG_CONST, + start_idx + offset ); + } else { + emit->input_map[idx] = src_register( SVGA3DREG_INPUT, idx ); + dcl.dst = dst_register( SVGA3DREG_INPUT, idx ); + + assert(dcl.dst.reserved0); + + svga_generate_vdecl_semantics( idx, &usage, &index ); + + dcl.usage = usage; + dcl.index = index; + dcl.values[0] |= 1<<31; + + return (emit_instruction(emit, opcode) && + svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values))); + } + return TRUE; +} + +/* VS3.0 outputs have proper declarations and semantic info for + * matching against PS inputs. + */ +static boolean vs30_output( struct svga_shader_emitter *emit, + struct tgsi_declaration_semantic semantic, + unsigned idx ) +{ + SVGA3DOpDclArgs dcl; + SVGA3dShaderInstToken opcode; + unsigned usage, index; + + opcode = inst_token( SVGA3DOP_DCL ); + dcl.values[0] = 0; + dcl.values[1] = 0; + + if (!translate_vs_ps_semantic( semantic, &usage, &index )) + return FALSE; + + dcl.dst = dst_register( SVGA3DREG_OUTPUT, idx ); + dcl.usage = usage; + dcl.index = index; + dcl.values[0] |= 1<<31; + + if (semantic.SemanticName == TGSI_SEMANTIC_POSITION) { + assert(idx == 0); + emit->output_map[idx] = dst_register( SVGA3DREG_TEMP, + emit->nr_hw_temp++ ); + emit->temp_pos = emit->output_map[idx]; + emit->true_pos = dcl.dst; + } + else if (semantic.SemanticName == TGSI_SEMANTIC_PSIZE) { + emit->output_map[idx] = dst_register( SVGA3DREG_TEMP, + emit->nr_hw_temp++ ); + emit->temp_psiz = emit->output_map[idx]; + + /* This has the effect of not declaring psiz (below) and not + * emitting the final MOV to true_psiz in the postamble. + */ + if (!emit->key.vkey.allow_psiz) + return TRUE; + + emit->true_psiz = dcl.dst; + } + else { + emit->output_map[idx] = dcl.dst; + } + + + return (emit_instruction(emit, opcode) && + svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values))); +} + +static boolean ps30_sampler( struct svga_shader_emitter *emit, + struct tgsi_declaration_semantic semantic, + unsigned idx ) +{ + SVGA3DOpDclArgs dcl; + SVGA3dShaderInstToken opcode; + + opcode = inst_token( SVGA3DOP_DCL ); + dcl.values[0] = 0; + dcl.values[1] = 0; + + dcl.dst = dst_register( SVGA3DREG_SAMPLER, idx ); + dcl.type = svga_tgsi_sampler_type( emit, idx ); + dcl.values[0] |= 1<<31; + + return (emit_instruction(emit, opcode) && + svga_shader_emit_dwords( emit, dcl.values, Elements(dcl.values))); +} + + +boolean svga_translate_decl_sm30( struct svga_shader_emitter *emit, + const struct tgsi_full_declaration *decl ) +{ + unsigned first = decl->DeclarationRange.First; + unsigned last = decl->DeclarationRange.Last; + unsigned semantic = 0; + unsigned semantic_idx = 0; + unsigned idx; + + if (decl->Declaration.Semantic) { + semantic = decl->Semantic.SemanticName; + semantic_idx = decl->Semantic.SemanticIndex; + } + + for( idx = first; idx <= last; idx++ ) { + boolean ok; + + switch (decl->Declaration.File) { + case TGSI_FILE_SAMPLER: + assert (emit->unit == PIPE_SHADER_FRAGMENT); + ok = ps30_sampler( emit, decl->Semantic, idx ); + break; + + case TGSI_FILE_INPUT: + if (emit->unit == PIPE_SHADER_VERTEX) + ok = vs30_input( emit, decl->Semantic, idx ); + else + ok = ps30_input( emit, decl->Semantic, idx ); + break; + + case TGSI_FILE_OUTPUT: + if (emit->unit == PIPE_SHADER_VERTEX) + ok = vs30_output( emit, decl->Semantic, idx ); + else + ok = ps30_output( emit, decl->Semantic, idx ); + break; + + default: + /* don't need to declare other vars */ + ok = TRUE; + } + + if (!ok) + return FALSE; + } + + return TRUE; +} + + + diff --git a/src/gallium/drivers/svga/svga_tgsi_emit.h b/src/gallium/drivers/svga/svga_tgsi_emit.h new file mode 100644 index 0000000000..2557824293 --- /dev/null +++ b/src/gallium/drivers/svga/svga_tgsi_emit.h @@ -0,0 +1,345 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +#ifndef SVGA_TGSI_EMIT_H +#define SVGA_TGSI_EMIT_H + +#include "tgsi/tgsi_scan.h" +#include "svga_hw_reg.h" +#include "svga_tgsi.h" +#include "svga3d_shaderdefs.h" + +struct src_register +{ + SVGA3dShaderSrcToken base; + SVGA3dShaderSrcToken indirect; +}; + + +struct svga_arl_consts { + int number; + int idx; + int swizzle; + int arl_num; +}; + +/* Internal functions: + */ + +struct svga_shader_emitter +{ + boolean use_sm30; + + unsigned size; + char *buf; + char *ptr; + + union svga_compile_key key; + struct tgsi_shader_info info; + int unit; + + int imm_start; + + int nr_hw_const; + int nr_hw_temp; + + int insn_offset; + + int internal_temp_count; + int internal_imm_count; + + int internal_color_idx[2]; /* diffuse, specular */ + int internal_color_count; + + boolean emitted_vface; + boolean emit_frontface; + int internal_frontface_idx; + + int ps30_input_count; + + boolean in_main_func; + + boolean created_zero_immediate; + int zero_immediate_idx; + + boolean created_loop_const; + int loop_const_idx; + + boolean created_sincos_consts; + int sincos_consts_idx; + + unsigned label[32]; + unsigned nr_labels; + + struct src_register input_map[PIPE_MAX_ATTRIBS]; + SVGA3dShaderDestToken output_map[PIPE_MAX_ATTRIBS]; + + struct src_register imm_0055; + SVGA3dShaderDestToken temp_pos; + SVGA3dShaderDestToken true_pos; + + SVGA3dShaderDestToken temp_col[PIPE_MAX_COLOR_BUFS]; + SVGA3dShaderDestToken true_col[PIPE_MAX_COLOR_BUFS]; + + SVGA3dShaderDestToken temp_psiz; + SVGA3dShaderDestToken true_psiz; + + struct svga_arl_consts arl_consts[12]; + int num_arl_consts; + int current_arl; +}; + + +boolean svga_shader_emit_dword( struct svga_shader_emitter *emit, + unsigned dword ); + +boolean svga_shader_emit_dwords( struct svga_shader_emitter *emit, + const unsigned *dwords, + unsigned nr ); + +boolean svga_shader_emit_opcode( struct svga_shader_emitter *emit, + unsigned opcode ); + +boolean svga_shader_emit_instructions( struct svga_shader_emitter *emit, + const struct tgsi_token *tokens ); + +boolean svga_translate_decl_sm20( struct svga_shader_emitter *emit, + const struct tgsi_full_declaration *decl ); + +boolean svga_translate_decl_sm30( struct svga_shader_emitter *emit, + const struct tgsi_full_declaration *decl ); + + +static INLINE boolean emit_dst( struct svga_shader_emitter *emit, + SVGA3dShaderDestToken dest ) +{ + assert(dest.reserved0); + return svga_shader_emit_dword( emit, dest.value ); +} + +static INLINE boolean emit_src( struct svga_shader_emitter *emit, + const struct src_register src ) +{ + if (src.base.relAddr) { + assert(src.base.reserved0); + assert(src.indirect.reserved0); + return (svga_shader_emit_dword( emit, src.base.value ) && + svga_shader_emit_dword( emit, src.indirect.value )); + } + else { + assert(src.base.reserved0); + return svga_shader_emit_dword( emit, src.base.value ); + } +} + + +static INLINE boolean emit_instruction( struct svga_shader_emitter *emit, + SVGA3dShaderInstToken opcode ) +{ + return svga_shader_emit_opcode( emit, opcode.value ); +} + + +static INLINE boolean emit_op1( struct svga_shader_emitter *emit, + SVGA3dShaderInstToken inst, + SVGA3dShaderDestToken dest, + struct src_register src0 ) +{ + return (emit_instruction( emit, inst ) && + emit_dst( emit, dest ) && + emit_src( emit, src0 )); +} + +static INLINE boolean emit_op2( struct svga_shader_emitter *emit, + SVGA3dShaderInstToken inst, + SVGA3dShaderDestToken dest, + struct src_register src0, + struct src_register src1 ) +{ + return (emit_instruction( emit, inst ) && + emit_dst( emit, dest ) && + emit_src( emit, src0 ) && + emit_src( emit, src1 )); +} + +static INLINE boolean emit_op3( struct svga_shader_emitter *emit, + SVGA3dShaderInstToken inst, + SVGA3dShaderDestToken dest, + struct src_register src0, + struct src_register src1, + struct src_register src2 ) +{ + return (emit_instruction( emit, inst ) && + emit_dst( emit, dest ) && + emit_src( emit, src0 ) && + emit_src( emit, src1 ) && + emit_src( emit, src2 )); +} + + +#define TRANSLATE_SWIZZLE(x,y,z,w) ((x) | ((y) << 2) | ((z) << 4) | ((w) << 6)) +#define SWIZZLE_XYZW \ + TRANSLATE_SWIZZLE(TGSI_SWIZZLE_X,TGSI_SWIZZLE_Y,TGSI_SWIZZLE_Z,TGSI_SWIZZLE_W) +#define SWIZZLE_XXXX \ + TRANSLATE_SWIZZLE(TGSI_SWIZZLE_X,TGSI_SWIZZLE_X,TGSI_SWIZZLE_X,TGSI_SWIZZLE_X) +#define SWIZZLE_YYYY \ + TRANSLATE_SWIZZLE(TGSI_SWIZZLE_Y,TGSI_SWIZZLE_Y,TGSI_SWIZZLE_Y,TGSI_SWIZZLE_Y) +#define SWIZZLE_ZZZZ \ + TRANSLATE_SWIZZLE(TGSI_SWIZZLE_Z,TGSI_SWIZZLE_Z,TGSI_SWIZZLE_Z,TGSI_SWIZZLE_Z) +#define SWIZZLE_WWWW \ + TRANSLATE_SWIZZLE(TGSI_SWIZZLE_W,TGSI_SWIZZLE_W,TGSI_SWIZZLE_W,TGSI_SWIZZLE_W) + + + +static INLINE SVGA3dShaderInstToken +inst_token( unsigned opcode ) +{ + SVGA3dShaderInstToken inst; + + inst.value = 0; + inst.op = opcode; + + return inst; +} + +static INLINE SVGA3dShaderDestToken +dst_register( unsigned file, + int number ) +{ + SVGA3dShaderDestToken dest; + + dest.value = 0; + dest.num = number; + dest.type_upper = file >> 3; + dest.relAddr = 0; + dest.reserved1 = 0; + dest.mask = 0xf; + dest.dstMod = 0; + dest.shfScale = 0; + dest.type_lower = file & 0x7; + dest.reserved0 = 1; /* is_reg */ + + return dest; +} + +static INLINE SVGA3dShaderDestToken +writemask( SVGA3dShaderDestToken dest, + unsigned mask ) +{ + dest.mask &= mask; + return dest; +} + + +static INLINE SVGA3dShaderSrcToken +src_token( unsigned file, int number ) +{ + SVGA3dShaderSrcToken src; + + src.value = 0; + src.num = number; + src.type_upper = file >> 3; + src.relAddr = 0; + src.reserved1 = 0; + src.swizzle = SWIZZLE_XYZW; + src.srcMod = 0; + src.type_lower = file & 0x7; + src.reserved0 = 1; /* is_reg */ + + return src; +} + + +static INLINE struct src_register +absolute( struct src_register src ) +{ + src.base.srcMod = SVGA3DSRCMOD_ABS; + + return src; +} + + +static INLINE struct src_register +negate( struct src_register src ) +{ + switch (src.base.srcMod) { + case SVGA3DSRCMOD_ABS: + src.base.srcMod = SVGA3DSRCMOD_ABSNEG; + break; + case SVGA3DSRCMOD_ABSNEG: + src.base.srcMod = SVGA3DSRCMOD_ABS; + break; + case SVGA3DSRCMOD_NEG: + src.base.srcMod = SVGA3DSRCMOD_NONE; + break; + case SVGA3DSRCMOD_NONE: + src.base.srcMod = SVGA3DSRCMOD_NEG; + break; + } + return src; +} + + +static INLINE struct src_register +src_register( unsigned file, int number ) +{ + struct src_register src; + + src.base = src_token( file, number ); + src.indirect.value = 0; + + return src; +} + +static INLINE SVGA3dShaderDestToken dst( struct src_register src ) +{ + return dst_register( SVGA3dShaderGetRegType( src.base.value ), + src.base.num ); +} + +static INLINE struct src_register src( SVGA3dShaderDestToken dst ) +{ + return src_register( SVGA3dShaderGetRegType( dst.value ), + dst.num ); +} + +static INLINE ubyte svga_tgsi_sampler_type( struct svga_shader_emitter *emit, + int idx ) +{ + switch (emit->key.fkey.tex[idx].texture_target) { + case PIPE_TEXTURE_1D: + return SVGA3DSAMP_2D; + case PIPE_TEXTURE_2D: + return SVGA3DSAMP_2D; + case PIPE_TEXTURE_3D: + return SVGA3DSAMP_VOLUME; + case PIPE_TEXTURE_CUBE: + return SVGA3DSAMP_CUBE; + } + + return SVGA3DSAMP_UNKNOWN; +} + +#endif diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c b/src/gallium/drivers/svga/svga_tgsi_insn.c new file mode 100644 index 0000000000..ea409b7e16 --- /dev/null +++ b/src/gallium/drivers/svga/svga_tgsi_insn.c @@ -0,0 +1,2716 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + + +#include "pipe/p_shader_tokens.h" +#include "tgsi/tgsi_parse.h" +#include "util/u_memory.h" + +#include "svga_tgsi_emit.h" +#include "svga_context.h" + + +static boolean emit_vs_postamble( struct svga_shader_emitter *emit ); +static boolean emit_ps_postamble( struct svga_shader_emitter *emit ); + + + + +static unsigned +translate_opcode( + uint opcode ) +{ + switch (opcode) { + case TGSI_OPCODE_ABS: return SVGA3DOP_ABS; + case TGSI_OPCODE_ADD: return SVGA3DOP_ADD; + case TGSI_OPCODE_BREAKC: return SVGA3DOP_BREAKC; + case TGSI_OPCODE_DDX: return SVGA3DOP_DSX; + case TGSI_OPCODE_DDY: return SVGA3DOP_DSY; + case TGSI_OPCODE_DP2A: return SVGA3DOP_DP2ADD; + case TGSI_OPCODE_DP3: return SVGA3DOP_DP3; + case TGSI_OPCODE_DP4: return SVGA3DOP_DP4; + case TGSI_OPCODE_ENDFOR: return SVGA3DOP_ENDLOOP; + case TGSI_OPCODE_FRC: return SVGA3DOP_FRC; + case TGSI_OPCODE_BGNFOR: return SVGA3DOP_LOOP; + case TGSI_OPCODE_MAD: return SVGA3DOP_MAD; + case TGSI_OPCODE_MAX: return SVGA3DOP_MAX; + case TGSI_OPCODE_MIN: return SVGA3DOP_MIN; + case TGSI_OPCODE_MOV: return SVGA3DOP_MOV; + case TGSI_OPCODE_MUL: return SVGA3DOP_MUL; + case TGSI_OPCODE_NOP: return SVGA3DOP_NOP; + case TGSI_OPCODE_NRM4: return SVGA3DOP_NRM; + case TGSI_OPCODE_SSG: return SVGA3DOP_SGN; + default: + debug_printf("Unkown opcode %u\n", opcode); + assert( 0 ); + return SVGA3DOP_LAST_INST; + } +} + + +static unsigned translate_file( unsigned file ) +{ + switch (file) { + case TGSI_FILE_TEMPORARY: return SVGA3DREG_TEMP; + case TGSI_FILE_INPUT: return SVGA3DREG_INPUT; + case TGSI_FILE_OUTPUT: return SVGA3DREG_OUTPUT; /* VS3.0+ only */ + case TGSI_FILE_IMMEDIATE: return SVGA3DREG_CONST; + case TGSI_FILE_CONSTANT: return SVGA3DREG_CONST; + case TGSI_FILE_SAMPLER: return SVGA3DREG_SAMPLER; + case TGSI_FILE_ADDRESS: return SVGA3DREG_ADDR; + default: + assert( 0 ); + return SVGA3DREG_TEMP; + } +} + + + + + + +static SVGA3dShaderDestToken +translate_dst_register( struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn, + unsigned idx ) +{ + const struct tgsi_full_dst_register *reg = &insn->FullDstRegisters[idx]; + SVGA3dShaderDestToken dest; + + switch (reg->DstRegister.File) { + case TGSI_FILE_OUTPUT: + /* Output registers encode semantic information in their name. + * Need to lookup a table built at decl time: + */ + dest = emit->output_map[reg->DstRegister.Index]; + break; + + default: + dest = dst_register( translate_file( reg->DstRegister.File ), + reg->DstRegister.Index ); + break; + } + + dest.mask = reg->DstRegister.WriteMask; + + if (insn->Instruction.Saturate) + dest.dstMod = SVGA3DDSTMOD_SATURATE; + + return dest; +} + + +static struct src_register +swizzle( struct src_register src, + int x, + int y, + int z, + int w ) +{ + x = (src.base.swizzle >> (x * 2)) & 0x3; + y = (src.base.swizzle >> (y * 2)) & 0x3; + z = (src.base.swizzle >> (z * 2)) & 0x3; + w = (src.base.swizzle >> (w * 2)) & 0x3; + + src.base.swizzle = TRANSLATE_SWIZZLE(x,y,z,w); + + return src; +} + +static struct src_register +scalar( struct src_register src, + int comp ) +{ + return swizzle( src, comp, comp, comp, comp ); +} + +static INLINE boolean +svga_arl_needs_adjustment( const struct svga_shader_emitter *emit ) +{ + int i; + + for (i = 0; i < emit->num_arl_consts; ++i) { + if (emit->arl_consts[i].arl_num == emit->current_arl) + return TRUE; + } + return FALSE; +} + +static INLINE int +svga_arl_adjustment( const struct svga_shader_emitter *emit ) +{ + int i; + + for (i = 0; i < emit->num_arl_consts; ++i) { + if (emit->arl_consts[i].arl_num == emit->current_arl) + return emit->arl_consts[i].number; + } + return 0; +} + +static struct src_register +translate_src_register( const struct svga_shader_emitter *emit, + const struct tgsi_full_src_register *reg ) +{ + struct src_register src; + + switch (reg->SrcRegister.File) { + case TGSI_FILE_INPUT: + /* Input registers are referred to by their semantic name rather + * than by index. Use the mapping build up from the decls: + */ + src = emit->input_map[reg->SrcRegister.Index]; + break; + + case TGSI_FILE_IMMEDIATE: + /* Immediates are appended after TGSI constants in the D3D + * constant buffer. + */ + src = src_register( translate_file( reg->SrcRegister.File ), + reg->SrcRegister.Index + + emit->imm_start ); + break; + + default: + src = src_register( translate_file( reg->SrcRegister.File ), + reg->SrcRegister.Index ); + + break; + } + + /* Indirect addressing (for coninstant buffer lookups only) + */ + if (reg->SrcRegister.Indirect) + { + /* we shift the offset towards the minimum */ + if (svga_arl_needs_adjustment( emit )) { + src.base.num -= svga_arl_adjustment( emit ); + } + src.base.relAddr = 1; + + /* Not really sure what should go in the second token: + */ + src.indirect = src_token( SVGA3DREG_ADDR, + reg->SrcRegisterInd.Index ); + + src.indirect.swizzle = SWIZZLE_XXXX; + } + + src = swizzle( src, + reg->SrcRegister.SwizzleX, + reg->SrcRegister.SwizzleY, + reg->SrcRegister.SwizzleZ, + reg->SrcRegister.SwizzleW ); + + /* src.mod isn't a bitfield, unfortunately: + * See tgsi_util_get_full_src_register_sign_mode for implementation details. + */ + if (reg->SrcRegisterExtMod.Absolute) { + if (reg->SrcRegisterExtMod.Negate) + src.base.srcMod = SVGA3DSRCMOD_ABSNEG; + else + src.base.srcMod = SVGA3DSRCMOD_ABS; + } + else { + if (reg->SrcRegister.Negate != reg->SrcRegisterExtMod.Negate) + src.base.srcMod = SVGA3DSRCMOD_NEG; + else + src.base.srcMod = SVGA3DSRCMOD_NONE; + } + + return src; +} + + +/* + * Get a temporary register, return -1 if none available + */ +static INLINE SVGA3dShaderDestToken +get_temp( struct svga_shader_emitter *emit ) +{ + int i = emit->nr_hw_temp + emit->internal_temp_count++; + + return dst_register( SVGA3DREG_TEMP, i ); +} + +/* Release a single temp. Currently only effective if it was the last + * allocated temp, otherwise release will be delayed until the next + * call to reset_temp_regs(). + */ +static INLINE void +release_temp( struct svga_shader_emitter *emit, + SVGA3dShaderDestToken temp ) +{ + if (temp.num == emit->internal_temp_count - 1) + emit->internal_temp_count--; +} + +static void reset_temp_regs( struct svga_shader_emitter *emit ) +{ + emit->internal_temp_count = 0; +} + + +static boolean submit_op0( struct svga_shader_emitter *emit, + SVGA3dShaderInstToken inst, + SVGA3dShaderDestToken dest ) +{ + return (emit_instruction( emit, inst ) && + emit_dst( emit, dest )); +} + +static boolean submit_op1( struct svga_shader_emitter *emit, + SVGA3dShaderInstToken inst, + SVGA3dShaderDestToken dest, + struct src_register src0 ) +{ + return emit_op1( emit, inst, dest, src0 ); +} + + +/* SVGA shaders may not refer to >1 constant register in a single + * instruction. This function checks for that usage and inserts a + * move to temporary if detected. + * + * The same applies to input registers -- at most a single input + * register may be read by any instruction. + */ +static boolean submit_op2( struct svga_shader_emitter *emit, + SVGA3dShaderInstToken inst, + SVGA3dShaderDestToken dest, + struct src_register src0, + struct src_register src1 ) +{ + SVGA3dShaderDestToken temp; + SVGA3dShaderRegType type0, type1; + boolean need_temp = FALSE; + + temp.value = 0; + type0 = SVGA3dShaderGetRegType( src0.base.value ); + type1 = SVGA3dShaderGetRegType( src1.base.value ); + + if (type0 == SVGA3DREG_CONST && + type1 == SVGA3DREG_CONST && + src0.base.num != src1.base.num) + need_temp = TRUE; + + if (type0 == SVGA3DREG_INPUT && + type1 == SVGA3DREG_INPUT && + src0.base.num != src1.base.num) + need_temp = TRUE; + + if (need_temp) + { + temp = get_temp( emit ); + + if (!emit_op1( emit, inst_token( SVGA3DOP_MOV ), temp, src0 )) + return FALSE; + + src0 = src( temp ); + } + + if (!emit_op2( emit, inst, dest, src0, src1 )) + return FALSE; + + if (need_temp) + release_temp( emit, temp ); + + return TRUE; +} + + +/* SVGA shaders may not refer to >1 constant register in a single + * instruction. This function checks for that usage and inserts a + * move to temporary if detected. + */ +static boolean submit_op3( struct svga_shader_emitter *emit, + SVGA3dShaderInstToken inst, + SVGA3dShaderDestToken dest, + struct src_register src0, + struct src_register src1, + struct src_register src2 ) +{ + SVGA3dShaderDestToken temp0; + SVGA3dShaderDestToken temp1; + boolean need_temp0 = FALSE; + boolean need_temp1 = FALSE; + SVGA3dShaderRegType type0, type1, type2; + + temp0.value = 0; + temp1.value = 0; + type0 = SVGA3dShaderGetRegType( src0.base.value ); + type1 = SVGA3dShaderGetRegType( src1.base.value ); + type2 = SVGA3dShaderGetRegType( src2.base.value ); + + if (inst.op != SVGA3DOP_SINCOS) { + if (type0 == SVGA3DREG_CONST && + ((type1 == SVGA3DREG_CONST && src0.base.num != src1.base.num) || + (type2 == SVGA3DREG_CONST && src0.base.num != src2.base.num))) + need_temp0 = TRUE; + + if (type1 == SVGA3DREG_CONST && + (type2 == SVGA3DREG_CONST && src1.base.num != src2.base.num)) + need_temp1 = TRUE; + } + + if (type0 == SVGA3DREG_INPUT && + ((type1 == SVGA3DREG_INPUT && src0.base.num != src1.base.num) || + (type2 == SVGA3DREG_INPUT && src0.base.num != src2.base.num))) + need_temp0 = TRUE; + + if (type1 == SVGA3DREG_INPUT && + (type2 == SVGA3DREG_INPUT && src1.base.num != src2.base.num)) + need_temp1 = TRUE; + + if (need_temp0) + { + temp0 = get_temp( emit ); + + if (!emit_op1( emit, inst_token( SVGA3DOP_MOV ), temp0, src0 )) + return FALSE; + + src0 = src( temp0 ); + } + + if (need_temp1) + { + temp1 = get_temp( emit ); + + if (!emit_op1( emit, inst_token( SVGA3DOP_MOV ), temp1, src1 )) + return FALSE; + + src1 = src( temp1 ); + } + + if (!emit_op3( emit, inst, dest, src0, src1, src2 )) + return FALSE; + + if (need_temp1) + release_temp( emit, temp1 ); + if (need_temp0) + release_temp( emit, temp0 ); + return TRUE; +} + + +static boolean emit_def_const( struct svga_shader_emitter *emit, + SVGA3dShaderConstType type, + unsigned idx, + float a, + float b, + float c, + float d ) +{ + SVGA3DOpDefArgs def; + SVGA3dShaderInstToken opcode; + + switch (type) { + case SVGA3D_CONST_TYPE_FLOAT: + opcode = inst_token( SVGA3DOP_DEF ); + def.dst = dst_register( SVGA3DREG_CONST, idx ); + def.constValues[0] = a; + def.constValues[1] = b; + def.constValues[2] = c; + def.constValues[3] = d; + break; + case SVGA3D_CONST_TYPE_INT: + opcode = inst_token( SVGA3DOP_DEFI ); + def.dst = dst_register( SVGA3DREG_CONSTINT, idx ); + def.constIValues[0] = (int)a; + def.constIValues[1] = (int)b; + def.constIValues[2] = (int)c; + def.constIValues[3] = (int)d; + break; + default: + assert(0); + break; + } + + if (!emit_instruction(emit, opcode) || + !svga_shader_emit_dwords( emit, def.values, Elements(def.values))) + return FALSE; + + return TRUE; +} + +static INLINE boolean +create_zero_immediate( struct svga_shader_emitter *emit ) +{ + unsigned idx = emit->nr_hw_const++; + + if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT, + idx, 0, 0, 0, 1 )) + return FALSE; + + emit->zero_immediate_idx = idx; + emit->created_zero_immediate = TRUE; + + return TRUE; +} + +static INLINE boolean +create_loop_const( struct svga_shader_emitter *emit ) +{ + unsigned idx = emit->nr_hw_const++; + + if (!emit_def_const( emit, SVGA3D_CONST_TYPE_INT, idx, + 255, /* iteration count */ + 0, /* initial value */ + 1, /* step size */ + 0 /* not used, must be 0 */)) + return FALSE; + + emit->loop_const_idx = idx; + emit->created_loop_const = TRUE; + + return TRUE; +} + +static INLINE boolean +create_sincos_consts( struct svga_shader_emitter *emit ) +{ + unsigned idx = emit->nr_hw_const++; + + if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT, idx, + -1.5500992e-006f, + -2.1701389e-005f, + 0.0026041667f, + 0.00026041668f )) + return FALSE; + + emit->sincos_consts_idx = idx; + idx = emit->nr_hw_const++; + + if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT, idx, + -0.020833334f, + -0.12500000f, + 1.0f, + 0.50000000f )) + return FALSE; + + emit->created_sincos_consts = TRUE; + + return TRUE; +} + +static INLINE boolean +create_arl_consts( struct svga_shader_emitter *emit ) +{ + int i; + + for (i = 0; i < emit->num_arl_consts; i += 4) { + int j; + unsigned idx = emit->nr_hw_const++; + float vals[4]; + for (j = 0; j < 4 && (j + i) < emit->num_arl_consts; ++j) { + vals[j] = emit->arl_consts[i + j].number; + emit->arl_consts[i + j].idx = idx; + switch (j) { + case 0: + emit->arl_consts[i + 0].swizzle = TGSI_SWIZZLE_X; + break; + case 1: + emit->arl_consts[i + 0].swizzle = TGSI_SWIZZLE_Y; + break; + case 2: + emit->arl_consts[i + 0].swizzle = TGSI_SWIZZLE_Z; + break; + case 3: + emit->arl_consts[i + 0].swizzle = TGSI_SWIZZLE_W; + break; + } + } + while (j < 4) + vals[j++] = 0; + + if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT, idx, + vals[0], vals[1], + vals[2], vals[3])) + return FALSE; + } + + return TRUE; +} + +static INLINE struct src_register +get_vface( struct svga_shader_emitter *emit ) +{ + assert(emit->emitted_vface); + return src_register(SVGA3DREG_MISCTYPE, + SVGA3DMISCREG_FACE); +} + +/* returns {0, 0, 0, 1} immediate */ +static INLINE struct src_register +get_zero_immediate( struct svga_shader_emitter *emit ) +{ + assert(emit->created_zero_immediate); + assert(emit->zero_immediate_idx >= 0); + return src_register( SVGA3DREG_CONST, + emit->zero_immediate_idx ); +} + +/* returns the loop const */ +static INLINE struct src_register +get_loop_const( struct svga_shader_emitter *emit ) +{ + assert(emit->created_loop_const); + assert(emit->loop_const_idx >= 0); + return src_register( SVGA3DREG_CONSTINT, + emit->loop_const_idx ); +} + +/* returns a sincos const */ +static INLINE struct src_register +get_sincos_const( struct svga_shader_emitter *emit, + unsigned index ) +{ + assert(emit->created_sincos_consts); + assert(emit->sincos_consts_idx >= 0); + assert(index == 0 || index == 1); + return src_register( SVGA3DREG_CONST, + emit->sincos_consts_idx + index ); +} + +static INLINE struct src_register +get_fake_arl_const( struct svga_shader_emitter *emit ) +{ + struct src_register reg; + int idx = 0, swizzle = 0, i; + + for (i = 0; i < emit->num_arl_consts; ++ i) { + if (emit->arl_consts[i].arl_num == emit->current_arl) { + idx = emit->arl_consts[i].idx; + swizzle = emit->arl_consts[i].swizzle; + } + } + + reg = src_register( SVGA3DREG_CONST, idx ); + return scalar(reg, swizzle); +} + +static INLINE struct src_register +get_tex_dimensions( struct svga_shader_emitter *emit, int sampler_num ) +{ + int idx; + struct src_register reg; + + /* the width/height indexes start right after constants */ + idx = emit->key.fkey.tex[sampler_num].width_height_idx + + emit->info.file_max[TGSI_FILE_CONSTANT] + 1; + + reg = src_register( SVGA3DREG_CONST, idx ); + return reg; +} + +static boolean emit_fake_arl(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn) +{ + const struct src_register src0 = translate_src_register( + emit, &insn->FullSrcRegisters[0] ); + struct src_register src1 = get_fake_arl_const( emit ); + SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); + SVGA3dShaderDestToken tmp = get_temp( emit ); + + if (!submit_op1(emit, inst_token( SVGA3DOP_MOV ), tmp, src0)) + return FALSE; + + if (!submit_op2( emit, inst_token( SVGA3DOP_ADD ), tmp, src( tmp ), + src1)) + return FALSE; + + /* replicate the original swizzle */ + src1 = src(tmp); + src1.base.swizzle = src0.base.swizzle; + + return submit_op1( emit, inst_token( SVGA3DOP_MOVA ), + dst, src1 ); +} + +static boolean emit_if(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn) +{ + const struct src_register src = translate_src_register( + emit, &insn->FullSrcRegisters[0] ); + struct src_register zero = get_zero_immediate( emit ); + SVGA3dShaderInstToken if_token = inst_token( SVGA3DOP_IFC ); + + if_token.control = SVGA3DOPCOMPC_NE; + zero = scalar(zero, TGSI_SWIZZLE_X); + + return (emit_instruction( emit, if_token ) && + emit_src( emit, src ) && + emit_src( emit, zero ) ); +} + +static boolean emit_endif(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn) +{ + return (emit_instruction( emit, + inst_token( SVGA3DOP_ENDIF ))); +} + +static boolean emit_else(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn) +{ + return (emit_instruction( emit, + inst_token( SVGA3DOP_ELSE ))); +} + +/* Translate the following TGSI FLR instruction. + * FLR DST, SRC + * To the following SVGA3D instruction sequence. + * FRC TMP, SRC + * SUB DST, SRC, TMP + */ +static boolean emit_floor(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn ) +{ + SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); + const struct src_register src0 = translate_src_register( + emit, &insn->FullSrcRegisters[0] ); + SVGA3dShaderDestToken temp = get_temp( emit ); + + /* FRC TMP, SRC */ + if (!submit_op1( emit, inst_token( SVGA3DOP_FRC ), temp, src0 )) + return FALSE; + + /* SUB DST, SRC, TMP */ + if (!submit_op2( emit, inst_token( SVGA3DOP_ADD ), dst, src0, + negate( src( temp ) ) )) + return FALSE; + + return TRUE; +} + + +/* Translate the following TGSI CMP instruction. + * CMP DST, SRC0, SRC1, SRC2 + * To the following SVGA3D instruction sequence. + * CMP DST, SRC0, SRC2, SRC1 + */ +static boolean emit_cmp(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn ) +{ + SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); + const struct src_register src0 = translate_src_register( + emit, &insn->FullSrcRegisters[0] ); + const struct src_register src1 = translate_src_register( + emit, &insn->FullSrcRegisters[1] ); + const struct src_register src2 = translate_src_register( + emit, &insn->FullSrcRegisters[2] ); + + /* CMP DST, SRC0, SRC2, SRC1 */ + return submit_op3( emit, inst_token( SVGA3DOP_CMP ), dst, src0, src2, src1); +} + + + +/* Translate the following TGSI DIV instruction. + * DIV DST.xy, SRC0, SRC1 + * To the following SVGA3D instruction sequence. + * RCP TMP.x, SRC1.xxxx + * RCP TMP.y, SRC1.yyyy + * MUL DST.xy, SRC0, TMP + */ +static boolean emit_div(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn ) +{ + SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); + const struct src_register src0 = translate_src_register( + emit, &insn->FullSrcRegisters[0] ); + const struct src_register src1 = translate_src_register( + emit, &insn->FullSrcRegisters[1] ); + SVGA3dShaderDestToken temp = get_temp( emit ); + int i; + + /* For each enabled element, perform a RCP instruction. Note that + * RCP is scalar in SVGA3D: + */ + for (i = 0; i < 4; i++) { + unsigned channel = 1 << i; + if (dst.mask & channel) { + /* RCP TMP.?, SRC1.???? */ + if (!submit_op1( emit, inst_token( SVGA3DOP_RCP ), + writemask(temp, channel), + scalar(src1, i) )) + return FALSE; + } + } + + /* Then multiply them out with a single mul: + * + * MUL DST, SRC0, TMP + */ + if (!submit_op2( emit, inst_token( SVGA3DOP_MUL ), dst, src0, + src( temp ) )) + return FALSE; + + return TRUE; +} + +/* Translate the following TGSI DP2 instruction. + * DP2 DST, SRC1, SRC2 + * To the following SVGA3D instruction sequence. + * MUL TMP, SRC1, SRC2 + * ADD DST, TMP.xxxx, TMP.yyyy + */ +static boolean emit_dp2(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn ) +{ + SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); + const struct src_register src0 = translate_src_register( + emit, &insn->FullSrcRegisters[0] ); + const struct src_register src1 = translate_src_register( + emit, &insn->FullSrcRegisters[1] ); + SVGA3dShaderDestToken temp = get_temp( emit ); + struct src_register temp_src0, temp_src1; + + /* MUL TMP, SRC1, SRC2 */ + if (!submit_op2( emit, inst_token( SVGA3DOP_MUL ), temp, src0, src1 )) + return FALSE; + + temp_src0 = scalar(src( temp ), TGSI_SWIZZLE_X); + temp_src1 = scalar(src( temp ), TGSI_SWIZZLE_Y); + + /* ADD DST, TMP.xxxx, TMP.yyyy */ + if (!submit_op2( emit, inst_token( SVGA3DOP_ADD ), dst, + temp_src0, temp_src1 )) + return FALSE; + + return TRUE; +} + + +/* Translate the following TGSI DPH instruction. + * DPH DST, SRC1, SRC2 + * To the following SVGA3D instruction sequence. + * DP3 TMP, SRC1, SRC2 + * ADD DST, TMP, SRC2.wwww + */ +static boolean emit_dph(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn ) +{ + SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); + const struct src_register src0 = translate_src_register( + emit, &insn->FullSrcRegisters[0] ); + struct src_register src1 = translate_src_register( + emit, &insn->FullSrcRegisters[1] ); + SVGA3dShaderDestToken temp = get_temp( emit ); + + /* DP3 TMP, SRC1, SRC2 */ + if (!submit_op2( emit, inst_token( SVGA3DOP_DP3 ), temp, src0, src1 )) + return FALSE; + + src1 = scalar(src1, TGSI_SWIZZLE_W); + + /* ADD DST, TMP, SRC2.wwww */ + if (!submit_op2( emit, inst_token( SVGA3DOP_ADD ), dst, + src( temp ), src1 )) + return FALSE; + + return TRUE; +} + +/* Translate the following TGSI DST instruction. + * NRM DST, SRC + * To the following SVGA3D instruction sequence. + * DP3 TMP, SRC, SRC + * RSQ TMP, TMP + * MUL DST, SRC, TMP + */ +static boolean emit_nrm(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn ) +{ + SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); + const struct src_register src0 = translate_src_register( + emit, &insn->FullSrcRegisters[0] ); + SVGA3dShaderDestToken temp = get_temp( emit ); + + /* DP3 TMP, SRC, SRC */ + if (!submit_op2( emit, inst_token( SVGA3DOP_DP3 ), temp, src0, src0 )) + return FALSE; + + /* RSQ TMP, TMP */ + if (!submit_op1( emit, inst_token( SVGA3DOP_RSQ ), temp, src( temp ))) + return FALSE; + + /* MUL DST, SRC, TMP */ + if (!submit_op2( emit, inst_token( SVGA3DOP_MUL ), dst, + src0, src( temp ))) + return FALSE; + + return TRUE; + +} + +static boolean do_emit_sincos(struct svga_shader_emitter *emit, + SVGA3dShaderDestToken dst, + struct src_register src0) +{ + src0 = scalar(src0, TGSI_SWIZZLE_X); + + if (emit->use_sm30) { + return submit_op1( emit, inst_token( SVGA3DOP_SINCOS ), + dst, src0 ); + } else { + struct src_register const1 = get_sincos_const( emit, 0 ); + struct src_register const2 = get_sincos_const( emit, 1 ); + + return submit_op3( emit, inst_token( SVGA3DOP_SINCOS ), + dst, src0, const1, const2 ); + } +} + +static boolean emit_sincos(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn) +{ + SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); + struct src_register src0 = translate_src_register( + emit, &insn->FullSrcRegisters[0] ); + SVGA3dShaderDestToken temp = get_temp( emit ); + + /* SCS TMP SRC */ + if (!do_emit_sincos(emit, writemask(temp, TGSI_WRITEMASK_XY), src0 )) + return FALSE; + + /* MOV DST TMP */ + if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), dst, src( temp ) )) + return FALSE; + + return TRUE; +} + +/* + * SCS TMP SRC + * MOV DST TMP.yyyy + */ +static boolean emit_sin(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn ) +{ + SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); + struct src_register src0 = translate_src_register( + emit, &insn->FullSrcRegisters[0] ); + SVGA3dShaderDestToken temp = get_temp( emit ); + + /* SCS TMP SRC */ + if (!do_emit_sincos(emit, writemask(temp, TGSI_WRITEMASK_Y), src0)) + return FALSE; + + src0 = scalar(src( temp ), TGSI_SWIZZLE_Y); + + /* MOV DST TMP.yyyy */ + if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), dst, src0 )) + return FALSE; + + return TRUE; +} + +/* + * SCS TMP SRC + * MOV DST TMP.xxxx + */ +static boolean emit_cos(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn ) +{ + SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); + struct src_register src0 = translate_src_register( + emit, &insn->FullSrcRegisters[0] ); + SVGA3dShaderDestToken temp = get_temp( emit ); + + /* SCS TMP SRC */ + if (!do_emit_sincos( emit, writemask(temp, TGSI_WRITEMASK_X), src0 )) + return FALSE; + + src0 = scalar(src( temp ), TGSI_SWIZZLE_X); + + /* MOV DST TMP.xxxx */ + if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), dst, src0 )) + return FALSE; + + return TRUE; +} + + +/* + * ADD DST SRC0, negate(SRC0) + */ +static boolean emit_sub(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn) +{ + SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); + struct src_register src0 = translate_src_register( + emit, &insn->FullSrcRegisters[0] ); + struct src_register src1 = translate_src_register( + emit, &insn->FullSrcRegisters[1] ); + + src1 = negate(src1); + + if (!submit_op2( emit, inst_token( SVGA3DOP_ADD ), dst, + src0, src1 )) + return FALSE; + + return TRUE; +} + + +static boolean emit_kil(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn ) +{ + SVGA3dShaderInstToken inst; + const struct tgsi_full_src_register *reg = &insn->FullSrcRegisters[0]; + struct src_register src0; + + inst = inst_token( SVGA3DOP_TEXKILL ); + src0 = translate_src_register( emit, reg ); + + if (reg->SrcRegisterExtMod.Absolute || + reg->SrcRegister.Negate != reg->SrcRegisterExtMod.Negate || + reg->SrcRegister.Indirect || + reg->SrcRegister.SwizzleX != 0 || + reg->SrcRegister.SwizzleY != 1 || + reg->SrcRegister.SwizzleZ != 2 || + reg->SrcRegister.File != TGSI_FILE_TEMPORARY) + { + SVGA3dShaderDestToken temp = get_temp( emit ); + + submit_op1( emit, inst_token( SVGA3DOP_MOV ), temp, src0 ); + src0 = src( temp ); + } + + return submit_op0( emit, inst, dst(src0) ); +} + + +/* mesa state tracker always emits kilp as an unconditional + * kil */ +static boolean emit_kilp(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn ) +{ + SVGA3dShaderInstToken inst; + SVGA3dShaderDestToken temp; + struct src_register one = get_zero_immediate( emit ); + + inst = inst_token( SVGA3DOP_TEXKILL ); + one = scalar( one, TGSI_SWIZZLE_W ); + + /* texkill doesn't allow negation on the operand so lets move + * negation of {1} to a temp register */ + temp = get_temp( emit ); + if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), temp, + negate( one ) )) + return FALSE; + + return submit_op0( emit, inst, temp ); +} + +/* Implement conditionals by initializing destination reg to 'fail', + * then set predicate reg with UFOP_SETP, then move 'pass' to dest + * based on predicate reg. + * + * SETP src0, cmp, src1 -- do this first to avoid aliasing problems. + * MOV dst, fail + * MOV dst, pass, p0 + */ +static boolean +emit_conditional(struct svga_shader_emitter *emit, + unsigned compare_func, + SVGA3dShaderDestToken dst, + struct src_register src0, + struct src_register src1, + struct src_register pass, + struct src_register fail) +{ + SVGA3dShaderDestToken pred_reg = dst_register( SVGA3DREG_PREDICATE, 0 ); + SVGA3dShaderInstToken setp_token, mov_token; + setp_token = inst_token( SVGA3DOP_SETP ); + + switch (compare_func) { + case PIPE_FUNC_NEVER: + return submit_op1( emit, inst_token( SVGA3DOP_MOV ), + dst, fail ); + break; + case PIPE_FUNC_LESS: + setp_token.control = SVGA3DOPCOMP_LT; + break; + case PIPE_FUNC_EQUAL: + setp_token.control = SVGA3DOPCOMP_EQ; + break; + case PIPE_FUNC_LEQUAL: + setp_token.control = SVGA3DOPCOMP_LE; + break; + case PIPE_FUNC_GREATER: + setp_token.control = SVGA3DOPCOMP_GT; + break; + case PIPE_FUNC_NOTEQUAL: + setp_token.control = SVGA3DOPCOMPC_NE; + break; + case PIPE_FUNC_GEQUAL: + setp_token.control = SVGA3DOPCOMP_GE; + break; + case PIPE_FUNC_ALWAYS: + return submit_op1( emit, inst_token( SVGA3DOP_MOV ), + dst, pass ); + break; + } + + /* SETP src0, COMPOP, src1 */ + if (!submit_op2( emit, setp_token, pred_reg, + src0, src1 )) + return FALSE; + + mov_token = inst_token( SVGA3DOP_MOV ); + + /* MOV dst, fail */ + if (!submit_op1( emit, mov_token, dst, + fail )) + return FALSE; + + /* MOV dst, pass (predicated) + * + * Note that the predicate reg (and possible modifiers) is passed + * as the first source argument. + */ + mov_token.predicated = 1; + if (!submit_op2( emit, mov_token, dst, + src( pred_reg ), pass )) + return FALSE; + + return TRUE; +} + + +static boolean +emit_select(struct svga_shader_emitter *emit, + unsigned compare_func, + SVGA3dShaderDestToken dst, + struct src_register src0, + struct src_register src1 ) +{ + /* There are some SVGA instructions which implement some selects + * directly, but they are only available in the vertex shader. + */ + if (emit->unit == PIPE_SHADER_VERTEX) { + switch (compare_func) { + case PIPE_FUNC_GEQUAL: + return submit_op2( emit, inst_token( SVGA3DOP_SGE ), dst, src0, src1 ); + case PIPE_FUNC_LEQUAL: + return submit_op2( emit, inst_token( SVGA3DOP_SGE ), dst, src1, src0 ); + case PIPE_FUNC_GREATER: + return submit_op2( emit, inst_token( SVGA3DOP_SLT ), dst, src1, src0 ); + case PIPE_FUNC_LESS: + return submit_op2( emit, inst_token( SVGA3DOP_SLT ), dst, src0, src1 ); + default: + break; + } + } + + + /* Otherwise, need to use the setp approach: + */ + { + struct src_register one, zero; + /* zero immediate is 0,0,0,1 */ + zero = get_zero_immediate( emit ); + one = scalar( zero, TGSI_SWIZZLE_W ); + zero = scalar( zero, TGSI_SWIZZLE_X ); + + return emit_conditional( + emit, + compare_func, + dst, + src0, + src1, + one, zero); + } +} + + +static boolean emit_select_op(struct svga_shader_emitter *emit, + unsigned compare, + const struct tgsi_full_instruction *insn) +{ + SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); + struct src_register src0 = translate_src_register( + emit, &insn->FullSrcRegisters[0] ); + struct src_register src1 = translate_src_register( + emit, &insn->FullSrcRegisters[1] ); + + return emit_select( emit, compare, dst, src0, src1 ); +} + + +/* Translate texture instructions to SVGA3D representation. + */ +static boolean emit_tex2(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn, + SVGA3dShaderDestToken dst ) +{ + SVGA3dShaderInstToken inst; + struct src_register src0; + struct src_register src1; + + inst.value = 0; + inst.op = SVGA3DOP_TEX; + + switch (insn->Instruction.Opcode) { + case TGSI_OPCODE_TEX: + break; + case TGSI_OPCODE_TXP: + inst.control = SVGA3DOPCONT_PROJECT; + break; + case TGSI_OPCODE_TXB: + inst.control = SVGA3DOPCONT_BIAS; + break; + default: + assert(0); + return FALSE; + } + + src0 = translate_src_register( emit, &insn->FullSrcRegisters[0] ); + src1 = translate_src_register( emit, &insn->FullSrcRegisters[1] ); + + if (emit->key.fkey.tex[src1.base.num].unnormalized) { + struct src_register wh = get_tex_dimensions( emit, src1.base.num ); + SVGA3dShaderDestToken tmp = get_temp( emit ); + + /* MUL tmp, SRC0, WH */ + if (!submit_op2( emit, inst_token( SVGA3DOP_MUL ), + tmp, src0, wh )) + return FALSE; + src0 = src( tmp ); + } + + return submit_op2( emit, inst, dst, src0, src1 ); +} + + + + +/* Translate texture instructions to SVGA3D representation. + */ +static boolean emit_tex3(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn, + SVGA3dShaderDestToken dst ) +{ + SVGA3dShaderInstToken inst; + struct src_register src0; + struct src_register src1; + struct src_register src2; + + inst.value = 0; + + switch (insn->Instruction.Opcode) { + case TGSI_OPCODE_TXD: + inst.op = SVGA3DOP_TEXLDD; + break; + case TGSI_OPCODE_TXL: + inst.op = SVGA3DOP_TEXLDL; + break; + } + + src0 = translate_src_register( emit, &insn->FullSrcRegisters[0] ); + src1 = translate_src_register( emit, &insn->FullSrcRegisters[1] ); + src2 = translate_src_register( emit, &insn->FullSrcRegisters[2] ); + + return submit_op3( emit, inst, dst, src0, src1, src2 ); +} + + +static boolean emit_tex(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn ) +{ + SVGA3dShaderDestToken dst = + translate_dst_register( emit, insn, 0 ); + struct src_register src0 = + translate_src_register( emit, &insn->FullSrcRegisters[0] ); + struct src_register src1 = + translate_src_register( emit, &insn->FullSrcRegisters[1] ); + + SVGA3dShaderDestToken tex_result; + + /* check for shadow samplers */ + boolean compare = (emit->key.fkey.tex[src1.base.num].compare_mode == + PIPE_TEX_COMPARE_R_TO_TEXTURE); + + + /* If doing compare processing, need to put this value into a + * temporary so it can be used as a source later on. + */ + if (compare || + (!emit->use_sm30 && dst.mask != TGSI_WRITEMASK_XYZW) ) { + tex_result = get_temp( emit ); + } + else { + tex_result = dst; + } + + switch(insn->Instruction.Opcode) { + case TGSI_OPCODE_TEX: + case TGSI_OPCODE_TXB: + case TGSI_OPCODE_TXP: + if (!emit_tex2( emit, insn, tex_result )) + return FALSE; + break; + case TGSI_OPCODE_TXL: + case TGSI_OPCODE_TXD: + if (!emit_tex3( emit, insn, tex_result )) + return FALSE; + break; + default: + assert(0); + } + + + if (compare) { + SVGA3dShaderDestToken src0_zdivw = get_temp( emit ); + struct src_register tex_src_x = scalar(src(tex_result), TGSI_SWIZZLE_Y); + struct src_register one = + scalar( get_zero_immediate( emit ), TGSI_SWIZZLE_W ); + + /* Divide texcoord R by Q */ + if (!submit_op1( emit, inst_token( SVGA3DOP_RCP ), + src0_zdivw, + scalar(src0, TGSI_SWIZZLE_W) )) + return FALSE; + + if (!submit_op2( emit, inst_token( SVGA3DOP_MUL ), + src0_zdivw, + scalar(src0, TGSI_SWIZZLE_Z), + src(src0_zdivw) )) + return FALSE; + + if (!emit_select( + emit, + emit->key.fkey.tex[src1.base.num].compare_func, + dst, + src(src0_zdivw), + tex_src_x)) + return FALSE; + + return submit_op1( emit, inst_token( SVGA3DOP_MOV ), + writemask( dst, TGSI_WRITEMASK_W), + one ); + } + else if (!emit->use_sm30 && dst.mask != TGSI_WRITEMASK_XYZW) + { + if (!emit_op1( emit, inst_token( SVGA3DOP_MOV ), dst, src(tex_result) )) + return FALSE; + } + + return TRUE; +} + +static boolean emit_bgnloop2( struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn ) +{ + SVGA3dShaderInstToken inst = inst_token( SVGA3DOP_LOOP ); + struct src_register loop_reg = src_register( SVGA3DREG_LOOP, 0 ); + struct src_register const_int = get_loop_const( emit ); + + return (emit_instruction( emit, inst ) && + emit_src( emit, loop_reg ) && + emit_src( emit, const_int ) ); +} + +static boolean emit_endloop2( struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn ) +{ + SVGA3dShaderInstToken inst = inst_token( SVGA3DOP_ENDLOOP ); + return emit_instruction( emit, inst ); +} + +static boolean emit_brk( struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn ) +{ + SVGA3dShaderInstToken inst = inst_token( SVGA3DOP_BREAK ); + return emit_instruction( emit, inst ); +} + +static boolean emit_scalar_op1( struct svga_shader_emitter *emit, + unsigned opcode, + const struct tgsi_full_instruction *insn ) +{ + SVGA3dShaderInstToken inst; + SVGA3dShaderDestToken dst; + struct src_register src; + + inst = inst_token( opcode ); + dst = translate_dst_register( emit, insn, 0 ); + src = translate_src_register( emit, &insn->FullSrcRegisters[0] ); + src = scalar( src, TGSI_SWIZZLE_X ); + + return submit_op1( emit, inst, dst, src ); +} + + +static boolean emit_simple_instruction(struct svga_shader_emitter *emit, + unsigned opcode, + const struct tgsi_full_instruction *insn ) +{ + const struct tgsi_full_src_register *src = insn->FullSrcRegisters; + SVGA3dShaderInstToken inst; + SVGA3dShaderDestToken dst; + + inst = inst_token( opcode ); + dst = translate_dst_register( emit, insn, 0 ); + + switch (insn->Instruction.NumSrcRegs) { + case 0: + return submit_op0( emit, inst, dst ); + case 1: + return submit_op1( emit, inst, dst, + translate_src_register( emit, &src[0] )); + case 2: + return submit_op2( emit, inst, dst, + translate_src_register( emit, &src[0] ), + translate_src_register( emit, &src[1] ) ); + case 3: + return submit_op3( emit, inst, dst, + translate_src_register( emit, &src[0] ), + translate_src_register( emit, &src[1] ), + translate_src_register( emit, &src[2] ) ); + default: + assert(0); + return FALSE; + } +} + +static boolean emit_arl(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn) +{ + ++emit->current_arl; + if (svga_arl_needs_adjustment( emit )) { + return emit_fake_arl( emit, insn ); + } else { + /* no need to adjust, just emit straight arl */ + return emit_simple_instruction(emit, SVGA3DOP_MOVA, insn); + } +} + +static boolean alias_src_dst( struct src_register src, + SVGA3dShaderDestToken dst ) +{ + if (src.base.num != dst.num) + return FALSE; + + if (SVGA3dShaderGetRegType(dst.value) != + SVGA3dShaderGetRegType(src.base.value)) + return FALSE; + + return TRUE; +} + +static boolean emit_pow(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn) +{ + SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); + struct src_register src0 = translate_src_register( + emit, &insn->FullSrcRegisters[0] ); + struct src_register src1 = translate_src_register( + emit, &insn->FullSrcRegisters[1] ); + boolean need_tmp = FALSE; + + /* POW can only output to a temporary */ + if (insn->FullDstRegisters[0].DstRegister.File != TGSI_FILE_TEMPORARY) + need_tmp = TRUE; + + /* POW src1 must not be the same register as dst */ + if (alias_src_dst( src1, dst )) + need_tmp = TRUE; + + /* it's a scalar op */ + src0 = scalar( src0, TGSI_SWIZZLE_X ); + src1 = scalar( src1, TGSI_SWIZZLE_X ); + + if (need_tmp) { + SVGA3dShaderDestToken tmp = writemask(get_temp( emit ), TGSI_WRITEMASK_X ); + + if (!submit_op2(emit, inst_token( SVGA3DOP_POW ), tmp, src0, src1)) + return FALSE; + + return submit_op1(emit, inst_token( SVGA3DOP_MOV ), dst, scalar(src(tmp), 0) ); + } + else { + return submit_op2(emit, inst_token( SVGA3DOP_POW ), dst, src0, src1); + } +} + +static boolean emit_xpd(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn) +{ + SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); + const struct src_register src0 = translate_src_register( + emit, &insn->FullSrcRegisters[0] ); + const struct src_register src1 = translate_src_register( + emit, &insn->FullSrcRegisters[1] ); + boolean need_dst_tmp = FALSE; + + /* XPD can only output to a temporary */ + if (SVGA3dShaderGetRegType(dst.value) != SVGA3DREG_TEMP) + need_dst_tmp = TRUE; + + /* The dst reg must not be the same as src0 or src1*/ + if (alias_src_dst(src0, dst) || + alias_src_dst(src1, dst)) + need_dst_tmp = TRUE; + + if (need_dst_tmp) { + SVGA3dShaderDestToken tmp = get_temp( emit ); + + /* Obey DX9 restrictions on mask: + */ + tmp.mask = dst.mask & TGSI_WRITEMASK_XYZ; + + if (!submit_op2(emit, inst_token( SVGA3DOP_CRS ), tmp, src0, src1)) + return FALSE; + + if (!submit_op1(emit, inst_token( SVGA3DOP_MOV ), dst, src( tmp ))) + return FALSE; + } + else { + if (!submit_op2(emit, inst_token( SVGA3DOP_CRS ), dst, src0, src1)) + return FALSE; + } + + /* Need to emit 1.0 to dst.w? + */ + if (dst.mask & TGSI_WRITEMASK_W) { + struct src_register zero = get_zero_immediate( emit ); + + if (!submit_op1(emit, + inst_token( SVGA3DOP_MOV ), + writemask(dst, TGSI_WRITEMASK_W), + zero)) + return FALSE; + } + + return TRUE; +} + + +static boolean emit_lrp(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn) +{ + SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); + SVGA3dShaderDestToken tmp; + const struct src_register src0 = translate_src_register( + emit, &insn->FullSrcRegisters[0] ); + const struct src_register src1 = translate_src_register( + emit, &insn->FullSrcRegisters[1] ); + const struct src_register src2 = translate_src_register( + emit, &insn->FullSrcRegisters[2] ); + boolean need_dst_tmp = FALSE; + + /* The dst reg must not be the same as src0 or src2 */ + if (alias_src_dst(src0, dst) || + alias_src_dst(src2, dst)) + need_dst_tmp = TRUE; + + if (need_dst_tmp) { + tmp = get_temp( emit ); + tmp.mask = dst.mask; + } + else { + tmp = dst; + } + + if (!submit_op3(emit, inst_token( SVGA3DOP_LRP ), tmp, src0, src1, src2)) + return FALSE; + + if (need_dst_tmp) { + if (!submit_op1(emit, inst_token( SVGA3DOP_MOV ), dst, src( tmp ))) + return FALSE; + } + + return TRUE; +} + + +static boolean emit_dst_insn(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn ) +{ + if (emit->unit == PIPE_SHADER_VERTEX) { + /* SVGA/DX9 has a DST instruction, but only for vertex shaders: + */ + return emit_simple_instruction(emit, SVGA3DOP_DST, insn); + } + else { + + /* result[0] = 1 * 1; + * result[1] = a[1] * b[1]; + * result[2] = a[2] * 1; + * result[3] = 1 * b[3]; + */ + + SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); + SVGA3dShaderDestToken tmp; + const struct src_register src0 = translate_src_register( + emit, &insn->FullSrcRegisters[0] ); + const struct src_register src1 = translate_src_register( + emit, &insn->FullSrcRegisters[1] ); + struct src_register zero = get_zero_immediate( emit ); + boolean need_tmp = FALSE; + + if (SVGA3dShaderGetRegType(dst.value) != SVGA3DREG_TEMP || + alias_src_dst(src0, dst) || + alias_src_dst(src1, dst)) + need_tmp = TRUE; + + if (need_tmp) { + tmp = get_temp( emit ); + } + else { + tmp = dst; + } + + /* tmp.xw = 1.0 + */ + if (tmp.mask & TGSI_WRITEMASK_XW) { + if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), + writemask(tmp, TGSI_WRITEMASK_XW ), + scalar( zero, 3 ))) + return FALSE; + } + + /* tmp.yz = src0 + */ + if (tmp.mask & TGSI_WRITEMASK_YZ) { + if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), + writemask(tmp, TGSI_WRITEMASK_YZ ), + src0)) + return FALSE; + } + + /* tmp.yw = tmp * src1 + */ + if (tmp.mask & TGSI_WRITEMASK_YW) { + if (!submit_op2( emit, inst_token( SVGA3DOP_MUL ), + writemask(tmp, TGSI_WRITEMASK_YW ), + src(tmp), + src1)) + return FALSE; + } + + /* dst = tmp + */ + if (need_tmp) { + if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), + dst, + src(tmp))) + return FALSE; + } + } + + return TRUE; +} + + +static boolean emit_exp(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn) +{ + SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); + struct src_register src0 = + translate_src_register( emit, &insn->FullSrcRegisters[0] ); + struct src_register zero = get_zero_immediate( emit ); + SVGA3dShaderDestToken fraction; + + if (dst.mask & TGSI_WRITEMASK_Y) + fraction = dst; + else if (dst.mask & TGSI_WRITEMASK_X) + fraction = get_temp( emit ); + + /* If y is being written, fill it with src0 - floor(src0). + */ + if (dst.mask & TGSI_WRITEMASK_XY) { + if (!submit_op1( emit, inst_token( SVGA3DOP_FRC ), + writemask( fraction, TGSI_WRITEMASK_Y ), + src0 )) + return FALSE; + } + + /* If x is being written, fill it with 2 ^ floor(src0). + */ + if (dst.mask & TGSI_WRITEMASK_X) { + if (!submit_op2( emit, inst_token( SVGA3DOP_ADD ), + writemask( dst, dst.mask & TGSI_WRITEMASK_X ), + src0, + scalar( negate( src( fraction ) ), TGSI_SWIZZLE_Y ) ) ) + return FALSE; + + if (!submit_op1( emit, inst_token( SVGA3DOP_EXP ), + writemask( dst, dst.mask & TGSI_WRITEMASK_X ), + scalar( src( dst ), TGSI_SWIZZLE_X ) ) ) + return FALSE; + + if (!(dst.mask & TGSI_WRITEMASK_Y)) + release_temp( emit, fraction ); + } + + /* If z is being written, fill it with 2 ^ src0 (partial precision). + */ + if (dst.mask & TGSI_WRITEMASK_Z) { + if (!submit_op1( emit, inst_token( SVGA3DOP_EXPP ), + writemask( dst, dst.mask & TGSI_WRITEMASK_Z ), + src0 ) ) + return FALSE; + } + + /* If w is being written, fill it with one. + */ + if (dst.mask & TGSI_WRITEMASK_W) { + if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), + writemask(dst, TGSI_WRITEMASK_W), + scalar( zero, TGSI_SWIZZLE_W ) )) + return FALSE; + } + + return TRUE; +} + +static boolean emit_lit(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn ) +{ + if (emit->unit == PIPE_SHADER_VERTEX) { + /* SVGA/DX9 has a LIT instruction, but only for vertex shaders: + */ + return emit_simple_instruction(emit, SVGA3DOP_LIT, insn); + } + else { + + /* D3D vs. GL semantics can be fairly easily accomodated by + * variations on this sequence. + * + * GL: + * tmp.y = src.x + * tmp.z = pow(src.y,src.w) + * p0 = src0.xxxx > 0 + * result = zero.wxxw + * (p0) result.yz = tmp + * + * D3D: + * tmp.y = src.x + * tmp.z = pow(src.y,src.w) + * p0 = src0.xxyy > 0 + * result = zero.wxxw + * (p0) result.yz = tmp + * + * Will implement the GL version for now. + */ + + SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); + SVGA3dShaderDestToken tmp = get_temp( emit ); + const struct src_register src0 = translate_src_register( + emit, &insn->FullSrcRegisters[0] ); + struct src_register zero = get_zero_immediate( emit ); + + /* tmp = pow(src.y, src.w) + */ + if (dst.mask & TGSI_WRITEMASK_Z) { + if (!submit_op2(emit, inst_token( SVGA3DOP_POW ), + tmp, + scalar(src0, 1), + scalar(src0, 3))) + return FALSE; + } + + /* tmp.y = src.x + */ + if (dst.mask & TGSI_WRITEMASK_Y) { + if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), + writemask(tmp, TGSI_WRITEMASK_Y ), + scalar(src0, 0))) + return FALSE; + } + + /* Can't quite do this with emit conditional due to the extra + * writemask on the predicated mov: + */ + { + SVGA3dShaderDestToken pred_reg = dst_register( SVGA3DREG_PREDICATE, 0 ); + SVGA3dShaderInstToken setp_token, mov_token; + struct src_register predsrc; + + setp_token = inst_token( SVGA3DOP_SETP ); + mov_token = inst_token( SVGA3DOP_MOV ); + + setp_token.control = SVGA3DOPCOMP_GT; + + /* D3D vs GL semantics: + */ + if (0) + predsrc = swizzle(src0, 0, 0, 1, 1); /* D3D */ + else + predsrc = swizzle(src0, 0, 0, 0, 0); /* GL */ + + /* SETP src0.xxyy, GT, {0}.x */ + if (!submit_op2( emit, setp_token, pred_reg, + predsrc, + swizzle(zero, 0, 0, 0, 0) )) + return FALSE; + + /* MOV dst, fail */ + if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), dst, + swizzle(zero, 3, 0, 0, 3 ))) + return FALSE; + + /* MOV dst.yz, tmp (predicated) + * + * Note that the predicate reg (and possible modifiers) is passed + * as the first source argument. + */ + if (dst.mask & TGSI_WRITEMASK_YZ) { + mov_token.predicated = 1; + if (!submit_op2( emit, mov_token, + writemask(dst, TGSI_WRITEMASK_YZ), + src( pred_reg ), src( tmp ) )) + return FALSE; + } + } + } + + return TRUE; +} + + + + +static boolean emit_ex2( struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn ) +{ + SVGA3dShaderInstToken inst; + SVGA3dShaderDestToken dst; + struct src_register src0; + + inst = inst_token( SVGA3DOP_EXP ); + dst = translate_dst_register( emit, insn, 0 ); + src0 = translate_src_register( emit, &insn->FullSrcRegisters[0] ); + src0 = scalar( src0, TGSI_SWIZZLE_X ); + + if (dst.mask != TGSI_WRITEMASK_XYZW) { + SVGA3dShaderDestToken tmp = get_temp( emit ); + + if (!submit_op1( emit, inst, tmp, src0 )) + return FALSE; + + return submit_op1( emit, inst_token( SVGA3DOP_MOV ), + dst, + scalar( src( tmp ), TGSI_SWIZZLE_X ) ); + } + + return submit_op1( emit, inst, dst, src0 ); +} + + +static boolean emit_log(struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn) +{ + SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); + struct src_register src0 = + translate_src_register( emit, &insn->FullSrcRegisters[0] ); + struct src_register zero = get_zero_immediate( emit ); + SVGA3dShaderDestToken abs_tmp; + struct src_register abs_src0; + SVGA3dShaderDestToken log2_abs; + + if (dst.mask & TGSI_WRITEMASK_Z) + log2_abs = dst; + else if (dst.mask & TGSI_WRITEMASK_XY) + log2_abs = get_temp( emit ); + + /* If z is being written, fill it with log2( abs( src0 ) ). + */ + if (dst.mask & TGSI_WRITEMASK_XYZ) { + if (!src0.base.srcMod || src0.base.srcMod == SVGA3DSRCMOD_ABS) + abs_src0 = src0; + else { + abs_tmp = get_temp( emit ); + + if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), + abs_tmp, + src0 ) ) + return FALSE; + + abs_src0 = src( abs_tmp ); + } + + abs_src0 = absolute( scalar( abs_src0, TGSI_SWIZZLE_X ) ); + + if (!submit_op1( emit, inst_token( SVGA3DOP_LOG ), + writemask( log2_abs, TGSI_WRITEMASK_Z ), + abs_src0 ) ) + return FALSE; + } + + if (dst.mask & TGSI_WRITEMASK_XY) { + SVGA3dShaderDestToken floor_log2; + + if (dst.mask & TGSI_WRITEMASK_X) + floor_log2 = dst; + else + floor_log2 = get_temp( emit ); + + /* If x is being written, fill it with floor( log2( abs( src0 ) ) ). + */ + if (!submit_op1( emit, inst_token( SVGA3DOP_FRC ), + writemask( floor_log2, TGSI_WRITEMASK_X ), + scalar( src( log2_abs ), TGSI_SWIZZLE_Z ) ) ) + return FALSE; + + if (!submit_op2( emit, inst_token( SVGA3DOP_ADD ), + writemask( floor_log2, TGSI_WRITEMASK_X ), + scalar( src( log2_abs ), TGSI_SWIZZLE_Z ), + negate( src( floor_log2 ) ) ) ) + return FALSE; + + /* If y is being written, fill it with + * abs ( src0 ) / ( 2 ^ floor( log2( abs( src0 ) ) ) ). + */ + if (dst.mask & TGSI_WRITEMASK_Y) { + if (!submit_op1( emit, inst_token( SVGA3DOP_EXP ), + writemask( dst, TGSI_WRITEMASK_Y ), + negate( scalar( src( floor_log2 ), + TGSI_SWIZZLE_X ) ) ) ) + return FALSE; + + if (!submit_op2( emit, inst_token( SVGA3DOP_MUL ), + writemask( dst, TGSI_WRITEMASK_Y ), + src( dst ), + abs_src0 ) ) + return FALSE; + } + + if (!(dst.mask & TGSI_WRITEMASK_X)) + release_temp( emit, floor_log2 ); + + if (!(dst.mask & TGSI_WRITEMASK_Z)) + release_temp( emit, log2_abs ); + } + + if (dst.mask & TGSI_WRITEMASK_XYZ && src0.base.srcMod && + src0.base.srcMod != SVGA3DSRCMOD_ABS) + release_temp( emit, abs_tmp ); + + /* If w is being written, fill it with one. + */ + if (dst.mask & TGSI_WRITEMASK_W) { + if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), + writemask(dst, TGSI_WRITEMASK_W), + scalar( zero, TGSI_SWIZZLE_W ) )) + return FALSE; + } + + return TRUE; +} + + +static boolean emit_bgnsub( struct svga_shader_emitter *emit, + unsigned position, + const struct tgsi_full_instruction *insn ) +{ + unsigned i; + + /* Note that we've finished the main function and are now emitting + * subroutines. This affects how we terminate the generated + * shader. + */ + emit->in_main_func = FALSE; + + for (i = 0; i < emit->nr_labels; i++) { + if (emit->label[i] == position) { + return (emit_instruction( emit, inst_token( SVGA3DOP_RET ) ) && + emit_instruction( emit, inst_token( SVGA3DOP_LABEL ) ) && + emit_src( emit, src_register( SVGA3DREG_LABEL, i ))); + } + } + + assert(0); + return TRUE; +} + +static boolean emit_call( struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn ) +{ + unsigned position = insn->InstructionExtLabel.Label; + unsigned i; + + for (i = 0; i < emit->nr_labels; i++) { + if (emit->label[i] == position) + break; + } + + if (emit->nr_labels == Elements(emit->label)) + return FALSE; + + if (i == emit->nr_labels) { + emit->label[i] = position; + emit->nr_labels++; + } + + return (emit_instruction( emit, inst_token( SVGA3DOP_CALL ) ) && + emit_src( emit, src_register( SVGA3DREG_LABEL, i ))); +} + + +static boolean emit_end( struct svga_shader_emitter *emit ) +{ + if (emit->unit == PIPE_SHADER_VERTEX) { + return emit_vs_postamble( emit ); + } + else { + return emit_ps_postamble( emit ); + } +} + + + +static boolean svga_emit_instruction( struct svga_shader_emitter *emit, + unsigned position, + const struct tgsi_full_instruction *insn ) +{ + switch (insn->Instruction.Opcode) { + + case TGSI_OPCODE_ARL: + return emit_arl( emit, insn ); + + case TGSI_OPCODE_TEX: + case TGSI_OPCODE_TXB: + case TGSI_OPCODE_TXP: + case TGSI_OPCODE_TXL: + case TGSI_OPCODE_TXD: + return emit_tex( emit, insn ); + + case TGSI_OPCODE_BGNSUB: + return emit_bgnsub( emit, position, insn ); + + case TGSI_OPCODE_ENDSUB: + return TRUE; + + case TGSI_OPCODE_CAL: + return emit_call( emit, insn ); + + case TGSI_OPCODE_FLR: + case TGSI_OPCODE_TRUNC: /* should be TRUNC, not FLR */ + return emit_floor( emit, insn ); + + case TGSI_OPCODE_CMP: + return emit_cmp( emit, insn ); + + case TGSI_OPCODE_DIV: + return emit_div( emit, insn ); + + case TGSI_OPCODE_DP2: + return emit_dp2( emit, insn ); + + case TGSI_OPCODE_DPH: + return emit_dph( emit, insn ); + + case TGSI_OPCODE_NRM: + return emit_nrm( emit, insn ); + + case TGSI_OPCODE_COS: + return emit_cos( emit, insn ); + + case TGSI_OPCODE_SIN: + return emit_sin( emit, insn ); + + case TGSI_OPCODE_SCS: + return emit_sincos( emit, insn ); + + case TGSI_OPCODE_END: + /* TGSI always finishes the main func with an END */ + return emit_end( emit ); + + case TGSI_OPCODE_KIL: + return emit_kil( emit, insn ); + + /* Selection opcodes. The underlying language is fairly + * non-orthogonal about these. + */ + case TGSI_OPCODE_SEQ: + return emit_select_op( emit, PIPE_FUNC_EQUAL, insn ); + + case TGSI_OPCODE_SNE: + return emit_select_op( emit, PIPE_FUNC_NOTEQUAL, insn ); + + case TGSI_OPCODE_SGT: + return emit_select_op( emit, PIPE_FUNC_GREATER, insn ); + + case TGSI_OPCODE_SGE: + return emit_select_op( emit, PIPE_FUNC_GEQUAL, insn ); + + case TGSI_OPCODE_SLT: + return emit_select_op( emit, PIPE_FUNC_LESS, insn ); + + case TGSI_OPCODE_SLE: + return emit_select_op( emit, PIPE_FUNC_LEQUAL, insn ); + + case TGSI_OPCODE_SUB: + return emit_sub( emit, insn ); + + case TGSI_OPCODE_POW: + return emit_pow( emit, insn ); + + case TGSI_OPCODE_EX2: + return emit_ex2( emit, insn ); + + case TGSI_OPCODE_EXP: + return emit_exp( emit, insn ); + + case TGSI_OPCODE_LOG: + return emit_log( emit, insn ); + + case TGSI_OPCODE_LG2: + return emit_scalar_op1( emit, SVGA3DOP_LOG, insn ); + + case TGSI_OPCODE_RSQ: + return emit_scalar_op1( emit, SVGA3DOP_RSQ, insn ); + + case TGSI_OPCODE_RCP: + return emit_scalar_op1( emit, SVGA3DOP_RCP, insn ); + + case TGSI_OPCODE_CONT: + case TGSI_OPCODE_RET: + /* This is a noop -- we tell mesa that we can't support RET + * within a function (early return), so this will always be + * followed by an ENDSUB. + */ + return TRUE; + + /* These aren't actually used by any of the frontends we care + * about: + */ + case TGSI_OPCODE_CLAMP: + case TGSI_OPCODE_ROUND: + case TGSI_OPCODE_AND: + case TGSI_OPCODE_OR: + case TGSI_OPCODE_I2F: + case TGSI_OPCODE_NOT: + case TGSI_OPCODE_SHL: + case TGSI_OPCODE_SHR: + case TGSI_OPCODE_XOR: + return FALSE; + + case TGSI_OPCODE_IF: + return emit_if( emit, insn ); + case TGSI_OPCODE_ELSE: + return emit_else( emit, insn ); + case TGSI_OPCODE_ENDIF: + return emit_endif( emit, insn ); + + case TGSI_OPCODE_BGNLOOP: + return emit_bgnloop2( emit, insn ); + case TGSI_OPCODE_ENDLOOP: + return emit_endloop2( emit, insn ); + case TGSI_OPCODE_BRK: + return emit_brk( emit, insn ); + + case TGSI_OPCODE_XPD: + return emit_xpd( emit, insn ); + + case TGSI_OPCODE_KILP: + return emit_kilp( emit, insn ); + + case TGSI_OPCODE_DST: + return emit_dst_insn( emit, insn ); + + case TGSI_OPCODE_LIT: + return emit_lit( emit, insn ); + + case TGSI_OPCODE_LRP: + return emit_lrp( emit, insn ); + + default: { + unsigned opcode = translate_opcode(insn->Instruction.Opcode); + + if (opcode == SVGA3DOP_LAST_INST) + return FALSE; + + if (!emit_simple_instruction( emit, opcode, insn )) + return FALSE; + } + } + + return TRUE; +} + + +static boolean svga_emit_immediate( struct svga_shader_emitter *emit, + struct tgsi_full_immediate *imm) +{ + static const float id[4] = {0,0,0,1}; + float value[4]; + unsigned i; + + assert(1 <= imm->Immediate.NrTokens && imm->Immediate.NrTokens <= 5); + for (i = 0; i < imm->Immediate.NrTokens - 1; i++) + value[i] = imm->u[i].Float; + + for ( ; i < 4; i++ ) + value[i] = id[i]; + + return emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT, + emit->imm_start + emit->internal_imm_count++, + value[0], value[1], value[2], value[3]); +} + +static boolean make_immediate( struct svga_shader_emitter *emit, + float a, + float b, + float c, + float d, + struct src_register *out ) +{ + unsigned idx = emit->nr_hw_const++; + + if (!emit_def_const( emit, SVGA3D_CONST_TYPE_FLOAT, + idx, a, b, c, d )) + return FALSE; + + *out = src_register( SVGA3DREG_CONST, idx ); + + return TRUE; +} + +static boolean emit_vs_preamble( struct svga_shader_emitter *emit ) +{ + if (!emit->key.vkey.need_prescale) { + if (!make_immediate( emit, 0, 0, .5, .5, + &emit->imm_0055)) + return FALSE; + } + + return TRUE; +} + +static boolean emit_ps_preamble( struct svga_shader_emitter *emit ) +{ + unsigned i; + + /* For SM20, need to initialize the temporaries we're using to hold + * color outputs to some value. Shaders which don't set all of + * these values are likely to be rejected by the DX9 runtime. + */ + if (!emit->use_sm30) { + struct src_register zero = get_zero_immediate( emit ); + for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { + if (SVGA3dShaderGetRegType(emit->true_col[i].value) != 0) { + + if (!submit_op1( emit, + inst_token(SVGA3DOP_MOV), + emit->temp_col[i], + zero )) + return FALSE; + } + } + } + + return TRUE; +} + +static boolean emit_ps_postamble( struct svga_shader_emitter *emit ) +{ + unsigned i; + + /* PS oDepth is incredibly fragile and it's very hard to catch the + * types of usage that break it during shader emit. Easier just to + * redirect the main program to a temporary and then only touch + * oDepth with a hand-crafted MOV below. + */ + if (SVGA3dShaderGetRegType(emit->true_pos.value) != 0) { + + if (!submit_op1( emit, + inst_token(SVGA3DOP_MOV), + emit->true_pos, + scalar(src(emit->temp_pos), TGSI_SWIZZLE_Z) )) + return FALSE; + } + + /* Similarly for SM20 color outputs... Luckily SM30 isn't so + * fragile. + */ + for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { + if (SVGA3dShaderGetRegType(emit->true_col[i].value) != 0) { + + if (!submit_op1( emit, + inst_token(SVGA3DOP_MOV), + emit->true_col[i], + src(emit->temp_col[i]) )) + return FALSE; + } + } + + return TRUE; +} + +static boolean emit_vs_postamble( struct svga_shader_emitter *emit ) +{ + /* PSIZ output is incredibly fragile and it's very hard to catch + * the types of usage that break it during shader emit. Easier + * just to redirect the main program to a temporary and then only + * touch PSIZ with a hand-crafted MOV below. + */ + if (SVGA3dShaderGetRegType(emit->true_psiz.value) != 0) { + + if (!submit_op1( emit, + inst_token(SVGA3DOP_MOV), + emit->true_psiz, + scalar(src(emit->temp_psiz), TGSI_SWIZZLE_X) )) + return FALSE; + } + + /* Need to perform various manipulations on vertex position to cope + * with the different GL and D3D clip spaces. + */ + if (emit->key.vkey.need_prescale) { + SVGA3dShaderDestToken temp_pos = emit->temp_pos; + SVGA3dShaderDestToken pos = emit->true_pos; + unsigned offset = emit->info.file_max[TGSI_FILE_CONSTANT] + 1; + struct src_register prescale_scale = src_register( SVGA3DREG_CONST, + offset + 0 ); + struct src_register prescale_trans = src_register( SVGA3DREG_CONST, + offset + 1 ); + + /* MUL temp_pos.xyz, temp_pos, prescale.scale + * MAD result.position, temp_pos.wwww, prescale.trans, temp_pos + * --> Note that prescale.trans.w == 0 + */ + if (!submit_op2( emit, + inst_token(SVGA3DOP_MUL), + writemask(temp_pos, TGSI_WRITEMASK_XYZ), + src(temp_pos), + prescale_scale )) + return FALSE; + + if (!submit_op3( emit, + inst_token(SVGA3DOP_MAD), + pos, + swizzle(src(temp_pos), 3, 3, 3, 3), + prescale_trans, + src(temp_pos))) + return FALSE; + } + else { + SVGA3dShaderDestToken temp_pos = emit->temp_pos; + SVGA3dShaderDestToken pos = emit->true_pos; + struct src_register imm_0055 = emit->imm_0055; + + /* Adjust GL clipping coordinate space to hardware (D3D-style): + * + * DP4 temp_pos.z, {0,0,.5,.5}, temp_pos + * MOV result.position, temp_pos + */ + if (!submit_op2( emit, + inst_token(SVGA3DOP_DP4), + writemask(temp_pos, TGSI_WRITEMASK_Z), + imm_0055, + src(temp_pos) )) + return FALSE; + + if (!submit_op1( emit, + inst_token(SVGA3DOP_MOV), + pos, + src(temp_pos) )) + return FALSE; + } + + return TRUE; +} + +/* + 0: IF VFACE :4 + 1: COLOR = FrontColor; + 2: ELSE + 3: COLOR = BackColor; + 4: ENDIF + */ +static boolean emit_light_twoside( struct svga_shader_emitter *emit ) +{ + struct src_register vface, zero; + struct src_register front[2]; + struct src_register back[2]; + SVGA3dShaderDestToken color[2]; + int count = emit->internal_color_count; + int i; + SVGA3dShaderInstToken if_token; + + if (count == 0) + return TRUE; + + vface = get_vface( emit ); + zero = get_zero_immediate( emit ); + + /* Can't use get_temp() to allocate the color reg as such + * temporaries will be reclaimed after each instruction by the call + * to reset_temp_regs(). + */ + for (i = 0; i < count; i++) { + color[i] = dst_register( SVGA3DREG_TEMP, + emit->nr_hw_temp++ ); + + front[i] = emit->input_map[emit->internal_color_idx[i]]; + + /* Back is always the next input: + */ + back[i] = front[i]; + back[i].base.num = front[i].base.num + 1; + + /* Reassign the input_map to the actual front-face color: + */ + emit->input_map[emit->internal_color_idx[i]] = src(color[i]); + } + + if_token = inst_token( SVGA3DOP_IFC ); + + if (emit->key.fkey.front_cw) + if_token.control = SVGA3DOPCOMP_GT; + else + if_token.control = SVGA3DOPCOMP_LT; + + zero = scalar(zero, TGSI_SWIZZLE_X); + + if (!(emit_instruction( emit, if_token ) && + emit_src( emit, vface ) && + emit_src( emit, zero ) )) + return FALSE; + + for (i = 0; i < count; i++) { + if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), color[i], front[i] )) + return FALSE; + } + + if (!(emit_instruction( emit, inst_token( SVGA3DOP_ELSE)))) + return FALSE; + + for (i = 0; i < count; i++) { + if (!submit_op1( emit, inst_token( SVGA3DOP_MOV ), color[i], back[i] )) + return FALSE; + } + + if (!emit_instruction( emit, inst_token( SVGA3DOP_ENDIF ) )) + return FALSE; + + return TRUE; +} + +/* + 0: SETP_GT TEMP, VFACE, 0 + where TEMP is a fake frontface register + */ +static boolean emit_frontface( struct svga_shader_emitter *emit ) +{ + struct src_register vface, zero; + SVGA3dShaderDestToken temp; + struct src_register pass, fail; + + vface = get_vface( emit ); + zero = get_zero_immediate( emit ); + + /* Can't use get_temp() to allocate the fake frontface reg as such + * temporaries will be reclaimed after each instruction by the call + * to reset_temp_regs(). + */ + temp = dst_register( SVGA3DREG_TEMP, + emit->nr_hw_temp++ ); + + if (emit->key.fkey.front_cw) { + pass = scalar( zero, TGSI_SWIZZLE_W ); + fail = scalar( zero, TGSI_SWIZZLE_X ); + } else { + pass = scalar( zero, TGSI_SWIZZLE_X ); + fail = scalar( zero, TGSI_SWIZZLE_W ); + } + + if (!emit_conditional(emit, PIPE_FUNC_GREATER, + temp, vface, scalar( zero, TGSI_SWIZZLE_X ), + pass, fail)) + return FALSE; + + /* Reassign the input_map to the actual front-face color: + */ + emit->input_map[emit->internal_frontface_idx] = src(temp); + + return TRUE; +} + +static INLINE boolean +needs_to_create_zero( struct svga_shader_emitter *emit ) +{ + int i; + + if (emit->unit == PIPE_SHADER_FRAGMENT) { + if (!emit->use_sm30) + return TRUE; + + if (emit->key.fkey.light_twoside) + return TRUE; + + if (emit->emit_frontface) + return TRUE; + + if (emit->info.opcode_count[TGSI_OPCODE_DST] >= 1 || + emit->info.opcode_count[TGSI_OPCODE_LIT] >= 1) + return TRUE; + } + + if (emit->info.opcode_count[TGSI_OPCODE_IF] >= 1 || + emit->info.opcode_count[TGSI_OPCODE_SGE] >= 1 || + emit->info.opcode_count[TGSI_OPCODE_SGT] >= 1 || + emit->info.opcode_count[TGSI_OPCODE_SLE] >= 1 || + emit->info.opcode_count[TGSI_OPCODE_SLT] >= 1 || + emit->info.opcode_count[TGSI_OPCODE_SNE] >= 1 || + emit->info.opcode_count[TGSI_OPCODE_SEQ] >= 1 || + emit->info.opcode_count[TGSI_OPCODE_EXP] >= 1 || + emit->info.opcode_count[TGSI_OPCODE_LOG] >= 1 || + emit->info.opcode_count[TGSI_OPCODE_XPD] >= 1 || + emit->info.opcode_count[TGSI_OPCODE_KILP] >= 1) + return TRUE; + + for (i = 0; i < emit->key.fkey.num_textures; i++) { + if (emit->key.fkey.tex[i].compare_mode == PIPE_TEX_COMPARE_R_TO_TEXTURE) + return TRUE; + } + + return FALSE; +} + +static INLINE boolean +needs_to_create_loop_const( struct svga_shader_emitter *emit ) +{ + return (emit->info.opcode_count[TGSI_OPCODE_BGNLOOP] >= 1); +} + +static INLINE boolean +needs_to_create_sincos_consts( struct svga_shader_emitter *emit ) +{ + return !emit->use_sm30 && (emit->info.opcode_count[TGSI_OPCODE_SIN] >= 1 || + emit->info.opcode_count[TGSI_OPCODE_COS] >= 1 || + emit->info.opcode_count[TGSI_OPCODE_SCS] >= 1); +} + +static INLINE boolean +needs_to_create_arl_consts( struct svga_shader_emitter *emit ) +{ + return (emit->num_arl_consts > 0); +} + +static INLINE boolean +pre_parse_add_indirect( struct svga_shader_emitter *emit, + int num, int current_arl) +{ + int i; + assert(num < 0); + + for (i = 0; i < emit->num_arl_consts; ++i) { + if (emit->arl_consts[i].arl_num == current_arl) + break; + } + /* new entry */ + if (emit->num_arl_consts == i) { + ++emit->num_arl_consts; + } + emit->arl_consts[i].number = (emit->arl_consts[i].number > num) ? + num : + emit->arl_consts[i].number; + emit->arl_consts[i].arl_num = current_arl; + return TRUE; +} + +static boolean +pre_parse_instruction( struct svga_shader_emitter *emit, + const struct tgsi_full_instruction *insn, + int current_arl) +{ + if (insn->FullSrcRegisters[0].SrcRegister.Indirect && + insn->FullSrcRegisters[0].SrcRegisterInd.File == TGSI_FILE_ADDRESS) { + const struct tgsi_full_src_register *reg = &insn->FullSrcRegisters[0]; + if (reg->SrcRegister.Index < 0) { + pre_parse_add_indirect(emit, reg->SrcRegister.Index, current_arl); + } + } + + if (insn->FullSrcRegisters[1].SrcRegister.Indirect && + insn->FullSrcRegisters[1].SrcRegisterInd.File == TGSI_FILE_ADDRESS) { + const struct tgsi_full_src_register *reg = &insn->FullSrcRegisters[1]; + if (reg->SrcRegister.Index < 0) { + pre_parse_add_indirect(emit, reg->SrcRegister.Index, current_arl); + } + } + + if (insn->FullSrcRegisters[2].SrcRegister.Indirect && + insn->FullSrcRegisters[2].SrcRegisterInd.File == TGSI_FILE_ADDRESS) { + const struct tgsi_full_src_register *reg = &insn->FullSrcRegisters[2]; + if (reg->SrcRegister.Index < 0) { + pre_parse_add_indirect(emit, reg->SrcRegister.Index, current_arl); + } + } + + return TRUE; +} + +static boolean +pre_parse_tokens( struct svga_shader_emitter *emit, + const struct tgsi_token *tokens ) +{ + struct tgsi_parse_context parse; + int current_arl = 0; + + tgsi_parse_init( &parse, tokens ); + + while (!tgsi_parse_end_of_tokens( &parse )) { + tgsi_parse_token( &parse ); + switch (parse.FullToken.Token.Type) { + case TGSI_TOKEN_TYPE_IMMEDIATE: + case TGSI_TOKEN_TYPE_DECLARATION: + break; + case TGSI_TOKEN_TYPE_INSTRUCTION: + if (parse.FullToken.FullInstruction.Instruction.Opcode == + TGSI_OPCODE_ARL) { + ++current_arl; + } + if (!pre_parse_instruction( emit, &parse.FullToken.FullInstruction, + current_arl )) + return FALSE; + break; + default: + break; + } + + } + return TRUE; +} + +static boolean svga_shader_emit_helpers( struct svga_shader_emitter *emit ) + +{ + if (needs_to_create_zero( emit )) { + create_zero_immediate( emit ); + } + if (needs_to_create_loop_const( emit )) { + create_loop_const( emit ); + } + if (needs_to_create_sincos_consts( emit )) { + create_sincos_consts( emit ); + } + if (needs_to_create_arl_consts( emit )) { + create_arl_consts( emit ); + } + + if (emit->unit == PIPE_SHADER_FRAGMENT) { + if (!emit_ps_preamble( emit )) + return FALSE; + + if (emit->key.fkey.light_twoside) { + if (!emit_light_twoside( emit )) + return FALSE; + } + if (emit->emit_frontface) { + if (!emit_frontface( emit )) + return FALSE; + } + } + + return TRUE; +} + +boolean svga_shader_emit_instructions( struct svga_shader_emitter *emit, + const struct tgsi_token *tokens ) +{ + struct tgsi_parse_context parse; + boolean ret = TRUE; + boolean helpers_emitted = FALSE; + unsigned line_nr = 0; + + tgsi_parse_init( &parse, tokens ); + emit->internal_imm_count = 0; + + if (emit->unit == PIPE_SHADER_VERTEX) { + ret = emit_vs_preamble( emit ); + if (!ret) + goto done; + } + + pre_parse_tokens(emit, tokens); + + while (!tgsi_parse_end_of_tokens( &parse )) { + tgsi_parse_token( &parse ); + + switch (parse.FullToken.Token.Type) { + case TGSI_TOKEN_TYPE_IMMEDIATE: + ret = svga_emit_immediate( emit, &parse.FullToken.FullImmediate ); + if (!ret) + goto done; + break; + + case TGSI_TOKEN_TYPE_DECLARATION: + if (emit->use_sm30) + ret = svga_translate_decl_sm30( emit, &parse.FullToken.FullDeclaration ); + else + ret = svga_translate_decl_sm20( emit, &parse.FullToken.FullDeclaration ); + if (!ret) + goto done; + break; + + case TGSI_TOKEN_TYPE_INSTRUCTION: + if (!helpers_emitted) { + if (!svga_shader_emit_helpers( emit )) + goto done; + helpers_emitted = TRUE; + } + ret = svga_emit_instruction( emit, + line_nr++, + &parse.FullToken.FullInstruction ); + if (!ret) + goto done; + break; + default: + break; + } + + reset_temp_regs( emit ); + } + + /* Need to terminate the current subroutine. Note that the + * hardware doesn't tolerate shaders without sub-routines + * terminating with RET+END. + */ + if (!emit->in_main_func) { + ret = emit_instruction( emit, inst_token( SVGA3DOP_RET ) ); + if (!ret) + goto done; + } + + /* Need to terminate the whole shader: + */ + ret = emit_instruction( emit, inst_token( SVGA3DOP_END ) ); + if (!ret) + goto done; + +done: + assert(ret); + tgsi_parse_free( &parse ); + return ret; +} + diff --git a/src/gallium/drivers/svga/svga_winsys.h b/src/gallium/drivers/svga/svga_winsys.h new file mode 100644 index 0000000000..59f299c185 --- /dev/null +++ b/src/gallium/drivers/svga/svga_winsys.h @@ -0,0 +1,299 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +/** + * @file + * VMware SVGA specific winsys interface. + * + * @author Jose Fonseca + * + * Documentation taken from the VMware SVGA DDK. + */ + +#ifndef SVGA_WINSYS_H_ +#define SVGA_WINSYS_H_ + + +#include "svga_types.h" +#include "svga_reg.h" +#include "svga3d_reg.h" + +#include "pipe/p_compiler.h" +#include "pipe/p_defines.h" + + +struct svga_winsys_screen; +struct svga_winsys_buffer; +struct pipe_screen; +struct pipe_context; +struct pipe_fence_handle; +struct pipe_texture; +struct svga_region; + + +#define SVGA_BUFFER_USAGE_PINNED (PIPE_BUFFER_USAGE_CUSTOM << 0) +#define SVGA_BUFFER_USAGE_WRAPPED (PIPE_BUFFER_USAGE_CUSTOM << 1) + + +/** Opaque surface handle */ +struct svga_winsys_surface; + +/** Opaque buffer handle */ +struct svga_winsys_handle; + + +/** + * SVGA per-context winsys interface. + */ +struct svga_winsys_context +{ + void + (*destroy)(struct svga_winsys_context *swc); + + void * + (*reserve)(struct svga_winsys_context *swc, + uint32_t nr_bytes, uint32_t nr_relocs ); + + /** + * Emit a relocation for a host surface. + * + * @param flags PIPE_BUFFER_USAGE_GPU_READ/WRITE + * + * NOTE: Order of this call does matter. It should be the same order + * as relocations appear in the command buffer. + */ + void + (*surface_relocation)(struct svga_winsys_context *swc, + uint32 *sid, + struct svga_winsys_surface *surface, + unsigned flags); + + /** + * Emit a relocation for a guest memory region. + * + * @param flags PIPE_BUFFER_USAGE_GPU_READ/WRITE + * + * NOTE: Order of this call does matter. It should be the same order + * as relocations appear in the command buffer. + */ + void + (*region_relocation)(struct svga_winsys_context *swc, + struct SVGAGuestPtr *ptr, + struct svga_winsys_buffer *buffer, + uint32 offset, + unsigned flags); + + void + (*commit)(struct svga_winsys_context *swc); + + enum pipe_error + (*flush)(struct svga_winsys_context *swc, + struct pipe_fence_handle **pfence); + + /** + * Context ID used to fill in the commands + * + * Context IDs are arbitrary small non-negative integers, + * global to the entire SVGA device. + */ + uint32 cid; +}; + + +/** + * SVGA per-screen winsys interface. + */ +struct svga_winsys_screen +{ + void + (*destroy)(struct svga_winsys_screen *sws); + + boolean + (*get_cap)(struct svga_winsys_screen *sws, + SVGA3dDevCapIndex index, + SVGA3dDevCapResult *result); + + /** + * Create a new context. + * + * Context objects encapsulate all render state, and shader + * objects are per-context. + * + * Surfaces are not per-context. The same surface can be shared + * between multiple contexts, and surface operations can occur + * without a context. + */ + struct svga_winsys_context * + (*context_create)(struct svga_winsys_screen *sws); + + + /** + * This creates a "surface" object in the SVGA3D device, + * and returns the surface ID (sid). Surfaces are generic + * containers for host VRAM objects like textures, vertex + * buffers, and depth/stencil buffers. + * + * Surfaces are hierarchial: + * + * - Surface may have multiple faces (for cube maps) + * + * - Each face has a list of mipmap levels + * + * - Each mipmap image may have multiple volume + * slices, if the image is three dimensional. + * + * - Each slice is a 2D array of 'blocks' + * + * - Each block may be one or more pixels. + * (Usually 1, more for DXT or YUV formats.) + * + * Surfaces are generic host VRAM objects. The SVGA3D device + * may optimize surfaces according to the format they were + * created with, but this format does not limit the ways in + * which the surface may be used. For example, a depth surface + * can be used as a texture, or a floating point image may + * be used as a vertex buffer. Some surface usages may be + * lower performance, due to software emulation, but any + * usage should work with any surface. + */ + struct svga_winsys_surface * + (*surface_create)(struct svga_winsys_screen *sws, + SVGA3dSurfaceFlags flags, + SVGA3dSurfaceFormat format, + SVGA3dSize size, + uint32 numFaces, + uint32 numMipLevels); + + /** + * Whether this surface is sitting in a validate list + */ + boolean + (*surface_is_flushed)(struct svga_winsys_screen *sws, + struct svga_winsys_surface *surface); + + /** + * Reference a SVGA3D surface object. This allows sharing of a + * surface between different objects. + */ + void + (*surface_reference)(struct svga_winsys_screen *sws, + struct svga_winsys_surface **pdst, + struct svga_winsys_surface *src); + + /** + * Buffer management. Buffer attributes are mostly fixed over its lifetime. + * + * Remember that gallium gets to choose the interface it needs, and the + * window systems must then implement that interface (rather than the + * other way around...). + * + * usage is a bitmask of PIPE_BUFFER_USAGE_PIXEL/VERTEX/INDEX/CONSTANT. This + * usage argument is only an optimization hint, not a guarantee, therefore + * proper behavior must be observed in all circumstances. + * + * alignment indicates the client's alignment requirements, eg for + * SSE instructions. + */ + struct svga_winsys_buffer * + (*buffer_create)( struct svga_winsys_screen *sws, + unsigned alignment, + unsigned usage, + unsigned size ); + + /** + * Map the entire data store of a buffer object into the client's address. + * flags is a bitmask of: + * - PIPE_BUFFER_USAGE_CPU_READ/WRITE + * - PIPE_BUFFER_USAGE_DONTBLOCK + * - PIPE_BUFFER_USAGE_UNSYNCHRONIZED + */ + void * + (*buffer_map)( struct svga_winsys_screen *sws, + struct svga_winsys_buffer *buf, + unsigned usage ); + + void + (*buffer_unmap)( struct svga_winsys_screen *sws, + struct svga_winsys_buffer *buf ); + + void + (*buffer_destroy)( struct svga_winsys_screen *sws, + struct svga_winsys_buffer *buf ); + + + /** + * Reference a fence object. + */ + void + (*fence_reference)( struct svga_winsys_screen *sws, + struct pipe_fence_handle **pdst, + struct pipe_fence_handle *src ); + + /** + * Checks whether the fence has been signalled. + * \param flags driver-specific meaning + * \return zero on success. + */ + int (*fence_signalled)( struct svga_winsys_screen *sws, + struct pipe_fence_handle *fence, + unsigned flag ); + + /** + * Wait for the fence to finish. + * \param flags driver-specific meaning + * \return zero on success. + */ + int (*fence_finish)( struct svga_winsys_screen *sws, + struct pipe_fence_handle *fence, + unsigned flag ); + +}; + + +struct pipe_context * +svga_context_create(struct pipe_screen *screen); + +struct pipe_screen * +svga_screen_create(struct svga_winsys_screen *sws); + +struct svga_winsys_screen * +svga_winsys_screen(struct pipe_screen *screen); + +struct pipe_buffer * +svga_screen_buffer_wrap_surface(struct pipe_screen *screen, + enum SVGA3dSurfaceFormat format, + struct svga_winsys_surface *srf); + +struct svga_winsys_surface * +svga_screen_texture_get_winsys_surface(struct pipe_texture *texture); +struct svga_winsys_surface * +svga_screen_buffer_get_winsys_surface(struct pipe_buffer *buffer); + +boolean +svga_screen_buffer_from_texture(struct pipe_texture *texture, + struct pipe_buffer **buffer, + unsigned *stride); + +#endif /* SVGA_WINSYS_H_ */ diff --git a/src/gallium/drivers/svga/svgadump/st_shader.h b/src/gallium/drivers/svga/svgadump/st_shader.h new file mode 100644 index 0000000000..2fc1796a90 --- /dev/null +++ b/src/gallium/drivers/svga/svgadump/st_shader.h @@ -0,0 +1,214 @@ +/********************************************************** + * Copyright 2007-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, 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. + * + **********************************************************/ + +/** + * @file + * SVGA Shader Token Definitions + * + * @author Michal Krol + */ + +#ifndef ST_SHADER_SVGA_H +#define ST_SHADER_SVGA_H + +#include "pipe/p_compiler.h" + +struct sh_op +{ + unsigned opcode:16; + unsigned control:8; + unsigned length:4; + unsigned predicated:1; + unsigned unused:1; + unsigned coissue:1; + unsigned is_reg:1; +}; + +struct sh_reg +{ + unsigned number:11; + unsigned type_hi:2; + unsigned relative:1; + unsigned unused:14; + unsigned type_lo:3; + unsigned is_reg:1; +}; + +static INLINE unsigned +sh_reg_type( struct sh_reg reg ) +{ + return reg.type_lo | (reg.type_hi << 3); +} + +struct sh_cdata +{ + float xyzw[4]; +}; + +struct sh_def +{ + struct sh_op op; + struct sh_reg reg; + struct sh_cdata cdata; +}; + +struct sh_defb +{ + struct sh_op op; + struct sh_reg reg; + uint data; +}; + +struct sh_idata +{ + int xyzw[4]; +}; + +struct sh_defi +{ + struct sh_op op; + struct sh_reg reg; + struct sh_idata idata; +}; + +#define PS_TEXTURETYPE_UNKNOWN SVGA3DSAMP_UNKNOWN +#define PS_TEXTURETYPE_2D SVGA3DSAMP_2D +#define PS_TEXTURETYPE_CUBE SVGA3DSAMP_CUBE +#define PS_TEXTURETYPE_VOLUME SVGA3DSAMP_VOLUME + +struct ps_sampleinfo +{ + unsigned unused:27; + unsigned texture_type:4; + unsigned is_reg:1; +}; + +struct vs_semantic +{ + unsigned usage:5; + unsigned unused1:11; + unsigned usage_index:4; + unsigned unused2:12; +}; + +struct sh_dstreg +{ + unsigned number:11; + unsigned type_hi:2; + unsigned relative:1; + unsigned unused:2; + unsigned write_mask:4; + unsigned modifier:4; + unsigned shift_scale:4; + unsigned type_lo:3; + unsigned is_reg:1; +}; + +static INLINE unsigned +sh_dstreg_type( struct sh_dstreg reg ) +{ + return reg.type_lo | (reg.type_hi << 3); +} + +struct sh_dcl +{ + struct sh_op op; + union { + struct { + struct ps_sampleinfo sampleinfo; + } ps; + struct { + struct vs_semantic semantic; + } vs; + } u; + struct sh_dstreg reg; +}; + + +struct sh_srcreg +{ + unsigned number:11; + unsigned type_hi:2; + unsigned relative:1; + unsigned unused:2; + unsigned swizzle_x:2; + unsigned swizzle_y:2; + unsigned swizzle_z:2; + unsigned swizzle_w:2; + unsigned modifier:4; + unsigned type_lo:3; + unsigned is_reg:1; +}; + +static INLINE unsigned +sh_srcreg_type( struct sh_srcreg reg ) +{ + return reg.type_lo | (reg.type_hi << 3); +} + +struct sh_dstop +{ + struct sh_op op; + struct sh_dstreg dst; +}; + +struct sh_srcop +{ + struct sh_op op; + struct sh_srcreg src; +}; + +struct sh_src2op +{ + struct sh_op op; + struct sh_srcreg src0; + struct sh_srcreg src1; +}; + +struct sh_unaryop +{ + struct sh_op op; + struct sh_dstreg dst; + struct sh_srcreg src; +}; + +struct sh_binaryop +{ + struct sh_op op; + struct sh_dstreg dst; + struct sh_srcreg src0; + struct sh_srcreg src1; +}; + +struct sh_trinaryop +{ + struct sh_op op; + struct sh_dstreg dst; + struct sh_srcreg src0; + struct sh_srcreg src1; + struct sh_srcreg src2; +}; + +#endif /* ST_SHADER_SVGA_H */ diff --git a/src/gallium/drivers/svga/svgadump/st_shader_dump.c b/src/gallium/drivers/svga/svgadump/st_shader_dump.c new file mode 100644 index 0000000000..d65cc93bfd --- /dev/null +++ b/src/gallium/drivers/svga/svgadump/st_shader_dump.c @@ -0,0 +1,649 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +/** + * @file + * SVGA Shader Dump Facilities + * + * @author Michal Krol + */ + +#include "st_shader.h" +#include "st_shader_dump.h" +#include "st_shader_op.h" +#include "util/u_debug.h" + +#include "../svga_hw_reg.h" +#include "svga3d_shaderdefs.h" + +struct dump_info +{ + SVGA3dShaderVersion version; + boolean is_ps; +}; + +static void dump_op( struct sh_op op, const char *mnemonic ) +{ + assert( op.predicated == 0 ); + assert( op.is_reg == 0 ); + + if (op.coissue) + debug_printf( "+" ); + debug_printf( "%s", mnemonic ); + switch (op.control) { + case 0: + break; + case SVGA3DOPCONT_PROJECT: + debug_printf( "p" ); + break; + case SVGA3DOPCONT_BIAS: + debug_printf( "b" ); + break; + default: + assert( 0 ); + } +} + + +static void dump_comp_op( struct sh_op op, const char *mnemonic ) +{ + assert( op.is_reg == 0 ); + + if (op.coissue) + debug_printf( "+" ); + debug_printf( "%s", mnemonic ); + switch (op.control) { + case SVGA3DOPCOMP_RESERVED0: + break; + case SVGA3DOPCOMP_GT: + debug_printf("_gt"); + break; + case SVGA3DOPCOMP_EQ: + debug_printf("_eq"); + break; + case SVGA3DOPCOMP_GE: + debug_printf("_ge"); + break; + case SVGA3DOPCOMP_LT: + debug_printf("_lt"); + break; + case SVGA3DOPCOMPC_NE: + debug_printf("_ne"); + break; + case SVGA3DOPCOMP_LE: + debug_printf("_le"); + break; + case SVGA3DOPCOMP_RESERVED1: + default: + assert( 0 ); + } +} + + +static void dump_reg( struct sh_reg reg, struct sh_srcreg *indreg, const struct dump_info *di ) +{ + assert( sh_reg_type( reg ) == SVGA3DREG_CONST || reg.relative == 0 ); + assert( reg.is_reg == 1 ); + + switch (sh_reg_type( reg )) { + case SVGA3DREG_TEMP: + debug_printf( "r%u", reg.number ); + break; + + case SVGA3DREG_INPUT: + debug_printf( "v%u", reg.number ); + break; + + case SVGA3DREG_CONST: + if (reg.relative) { + if (sh_srcreg_type( *indreg ) == SVGA3DREG_LOOP) + debug_printf( "c[aL+%u]", reg.number ); + else + debug_printf( "c[a%u.x+%u]", indreg->number, reg.number ); + } + else + debug_printf( "c%u", reg.number ); + break; + + case SVGA3DREG_ADDR: /* VS */ + /* SVGA3DREG_TEXTURE */ /* PS */ + if (di->is_ps) + debug_printf( "t%u", reg.number ); + else + debug_printf( "a%u", reg.number ); + break; + + case SVGA3DREG_RASTOUT: + switch (reg.number) { + case 0 /*POSITION*/: + debug_printf( "oPos" ); + break; + case 1 /*FOG*/: + debug_printf( "oFog" ); + break; + case 2 /*POINT_SIZE*/: + debug_printf( "oPts" ); + break; + default: + assert( 0 ); + debug_printf( "???" ); + } + break; + + case SVGA3DREG_ATTROUT: + assert( reg.number < 2 ); + debug_printf( "oD%u", reg.number ); + break; + + case SVGA3DREG_TEXCRDOUT: + /* SVGA3DREG_OUTPUT */ + debug_printf( "oT%u", reg.number ); + break; + + case SVGA3DREG_COLOROUT: + debug_printf( "oC%u", reg.number ); + break; + + case SVGA3DREG_DEPTHOUT: + debug_printf( "oD%u", reg.number ); + break; + + case SVGA3DREG_SAMPLER: + debug_printf( "s%u", reg.number ); + break; + + case SVGA3DREG_CONSTBOOL: + assert( !reg.relative ); + debug_printf( "b%u", reg.number ); + break; + + case SVGA3DREG_CONSTINT: + assert( !reg.relative ); + debug_printf( "i%u", reg.number ); + break; + + case SVGA3DREG_LOOP: + assert( reg.number == 0 ); + debug_printf( "aL" ); + break; + + case SVGA3DREG_MISCTYPE: + switch (reg.number) { + case SVGA3DMISCREG_POSITION: + debug_printf( "vPos" ); + break; + case SVGA3DMISCREG_FACE: + debug_printf( "vFace" ); + break; + default: + assert(0); + break; + } + break; + + case SVGA3DREG_LABEL: + debug_printf( "l%u", reg.number ); + break; + + case SVGA3DREG_PREDICATE: + debug_printf( "p%u", reg.number ); + break; + + + default: + assert( 0 ); + debug_printf( "???" ); + } +} + +static void dump_cdata( struct sh_cdata cdata ) +{ + debug_printf( "%f, %f, %f, %f", cdata.xyzw[0], cdata.xyzw[1], cdata.xyzw[2], cdata.xyzw[3] ); +} + +static void dump_idata( struct sh_idata idata ) +{ + debug_printf( "%d, %d, %d, %d", idata.xyzw[0], idata.xyzw[1], idata.xyzw[2], idata.xyzw[3] ); +} + +static void dump_bdata( boolean bdata ) +{ + debug_printf( bdata ? "TRUE" : "FALSE" ); +} + +static void dump_sampleinfo( struct ps_sampleinfo sampleinfo ) +{ + switch (sampleinfo.texture_type) { + case SVGA3DSAMP_2D: + debug_printf( "_2d" ); + break; + case SVGA3DSAMP_CUBE: + debug_printf( "_cube" ); + break; + case SVGA3DSAMP_VOLUME: + debug_printf( "_volume" ); + break; + default: + assert( 0 ); + } +} + + +static void dump_usageinfo( struct vs_semantic semantic ) +{ + switch (semantic.usage) { + case SVGA3D_DECLUSAGE_POSITION: + debug_printf("_position" ); + break; + case SVGA3D_DECLUSAGE_BLENDWEIGHT: + debug_printf("_blendweight" ); + break; + case SVGA3D_DECLUSAGE_BLENDINDICES: + debug_printf("_blendindices" ); + break; + case SVGA3D_DECLUSAGE_NORMAL: + debug_printf("_normal" ); + break; + case SVGA3D_DECLUSAGE_PSIZE: + debug_printf("_psize" ); + break; + case SVGA3D_DECLUSAGE_TEXCOORD: + debug_printf("_texcoord"); + break; + case SVGA3D_DECLUSAGE_TANGENT: + debug_printf("_tangent" ); + break; + case SVGA3D_DECLUSAGE_BINORMAL: + debug_printf("_binormal" ); + break; + case SVGA3D_DECLUSAGE_TESSFACTOR: + debug_printf("_tessfactor" ); + break; + case SVGA3D_DECLUSAGE_POSITIONT: + debug_printf("_positiont" ); + break; + case SVGA3D_DECLUSAGE_COLOR: + debug_printf("_color" ); + break; + case SVGA3D_DECLUSAGE_FOG: + debug_printf("_fog" ); + break; + case SVGA3D_DECLUSAGE_DEPTH: + debug_printf("_depth" ); + break; + case SVGA3D_DECLUSAGE_SAMPLE: + debug_printf("_sample"); + break; + default: + assert( 0 ); + return; + } + + if (semantic.usage_index != 0) { + debug_printf("%d", semantic.usage_index ); + } +} + +static void dump_dstreg( struct sh_dstreg dstreg, const struct dump_info *di ) +{ + union { + struct sh_reg reg; + struct sh_dstreg dstreg; + } u; + + assert( (dstreg.modifier & (SVGA3DDSTMOD_SATURATE | SVGA3DDSTMOD_PARTIALPRECISION)) == dstreg.modifier ); + + if (dstreg.modifier & SVGA3DDSTMOD_SATURATE) + debug_printf( "_sat" ); + if (dstreg.modifier & SVGA3DDSTMOD_PARTIALPRECISION) + debug_printf( "_pp" ); + switch (dstreg.shift_scale) { + case 0: + break; + case 1: + debug_printf( "_x2" ); + break; + case 2: + debug_printf( "_x4" ); + break; + case 3: + debug_printf( "_x8" ); + break; + case 13: + debug_printf( "_d8" ); + break; + case 14: + debug_printf( "_d4" ); + break; + case 15: + debug_printf( "_d2" ); + break; + default: + assert( 0 ); + } + debug_printf( " " ); + + u.dstreg = dstreg; + dump_reg( u.reg, NULL, di ); + if (dstreg.write_mask != SVGA3DWRITEMASK_ALL) { + debug_printf( "." ); + if (dstreg.write_mask & SVGA3DWRITEMASK_0) + debug_printf( "x" ); + if (dstreg.write_mask & SVGA3DWRITEMASK_1) + debug_printf( "y" ); + if (dstreg.write_mask & SVGA3DWRITEMASK_2) + debug_printf( "z" ); + if (dstreg.write_mask & SVGA3DWRITEMASK_3) + debug_printf( "w" ); + } +} + +static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, const struct dump_info *di ) +{ + union { + struct sh_reg reg; + struct sh_srcreg srcreg; + } u; + + switch (srcreg.modifier) { + case SVGA3DSRCMOD_NEG: + case SVGA3DSRCMOD_BIASNEG: + case SVGA3DSRCMOD_SIGNNEG: + case SVGA3DSRCMOD_X2NEG: + debug_printf( "-" ); + break; + case SVGA3DSRCMOD_ABS: + debug_printf( "|" ); + break; + case SVGA3DSRCMOD_ABSNEG: + debug_printf( "-|" ); + break; + case SVGA3DSRCMOD_COMP: + debug_printf( "1-" ); + break; + case SVGA3DSRCMOD_NOT: + debug_printf( "!" ); + } + + u.srcreg = srcreg; + dump_reg( u.reg, indreg, di ); + switch (srcreg.modifier) { + case SVGA3DSRCMOD_NONE: + case SVGA3DSRCMOD_NEG: + case SVGA3DSRCMOD_COMP: + case SVGA3DSRCMOD_NOT: + break; + case SVGA3DSRCMOD_ABS: + case SVGA3DSRCMOD_ABSNEG: + debug_printf( "|" ); + break; + case SVGA3DSRCMOD_BIAS: + case SVGA3DSRCMOD_BIASNEG: + debug_printf( "_bias" ); + break; + case SVGA3DSRCMOD_SIGN: + case SVGA3DSRCMOD_SIGNNEG: + debug_printf( "_bx2" ); + break; + case SVGA3DSRCMOD_X2: + case SVGA3DSRCMOD_X2NEG: + debug_printf( "_x2" ); + break; + case SVGA3DSRCMOD_DZ: + debug_printf( "_dz" ); + break; + case SVGA3DSRCMOD_DW: + debug_printf( "_dw" ); + break; + default: + assert( 0 ); + } + if (srcreg.swizzle_x != 0 || srcreg.swizzle_y != 1 || srcreg.swizzle_z != 2 || srcreg.swizzle_w != 3) { + debug_printf( "." ); + if (srcreg.swizzle_x == srcreg.swizzle_y && srcreg.swizzle_y == srcreg.swizzle_z && srcreg.swizzle_z == srcreg.swizzle_w) { + debug_printf( "%c", "xyzw"[srcreg.swizzle_x] ); + } + else { + debug_printf( "%c", "xyzw"[srcreg.swizzle_x] ); + debug_printf( "%c", "xyzw"[srcreg.swizzle_y] ); + debug_printf( "%c", "xyzw"[srcreg.swizzle_z] ); + debug_printf( "%c", "xyzw"[srcreg.swizzle_w] ); + } + } +} + +void +sh_svga_dump( + const unsigned *assem, + unsigned dwords, + unsigned do_binary ) +{ + const unsigned *start = assem; + boolean finished = FALSE; + struct dump_info di; + unsigned i; + + if (do_binary) { + for (i = 0; i < dwords; i++) + debug_printf(" 0x%08x,\n", assem[i]); + + debug_printf("\n\n"); + } + + di.version.value = *assem++; + di.is_ps = (di.version.type == SVGA3D_PS_TYPE); + + debug_printf( + "%s_%u_%u\n", + di.is_ps ? "ps" : "vs", + di.version.major, + di.version.minor ); + + while (!finished) { + struct sh_op op = *(struct sh_op *) assem; + + if (assem - start >= dwords) { + debug_printf("... ran off end of buffer\n"); + assert(0); + return; + } + + switch (op.opcode) { + case SVGA3DOP_DCL: + { + struct sh_dcl dcl = *(struct sh_dcl *) assem; + + debug_printf( "dcl" ); + if (sh_dstreg_type( dcl.reg ) == SVGA3DREG_SAMPLER) + dump_sampleinfo( dcl.u.ps.sampleinfo ); + else if (di.is_ps) { + if (di.version.major == 3 && + sh_dstreg_type( dcl.reg ) != SVGA3DREG_MISCTYPE) + dump_usageinfo( dcl.u.vs.semantic ); + } + else + dump_usageinfo( dcl.u.vs.semantic ); + dump_dstreg( dcl.reg, &di ); + debug_printf( "\n" ); + assem += sizeof( struct sh_dcl ) / sizeof( unsigned ); + } + break; + + case SVGA3DOP_DEFB: + { + struct sh_defb defb = *(struct sh_defb *) assem; + + debug_printf( "defb " ); + dump_reg( defb.reg, NULL, &di ); + debug_printf( ", " ); + dump_bdata( defb.data ); + debug_printf( "\n" ); + assem += sizeof( struct sh_defb ) / sizeof( unsigned ); + } + break; + + case SVGA3DOP_DEFI: + { + struct sh_defi defi = *(struct sh_defi *) assem; + + debug_printf( "defi " ); + dump_reg( defi.reg, NULL, &di ); + debug_printf( ", " ); + dump_idata( defi.idata ); + debug_printf( "\n" ); + assem += sizeof( struct sh_defi ) / sizeof( unsigned ); + } + break; + + case SVGA3DOP_TEXCOORD: + assert( di.is_ps ); + dump_op( op, "texcoord" ); + if (0) { + struct sh_dstop dstop = *(struct sh_dstop *) assem; + dump_dstreg( dstop.dst, &di ); + assem += sizeof( struct sh_dstop ) / sizeof( unsigned ); + } + else { + struct sh_unaryop unaryop = *(struct sh_unaryop *) assem; + dump_dstreg( unaryop.dst, &di ); + debug_printf( ", " ); + dump_srcreg( unaryop.src, NULL, &di ); + assem += sizeof( struct sh_unaryop ) / sizeof( unsigned ); + } + debug_printf( "\n" ); + break; + + case SVGA3DOP_TEX: + assert( di.is_ps ); + if (0) { + dump_op( op, "tex" ); + if (0) { + struct sh_dstop dstop = *(struct sh_dstop *) assem; + + dump_dstreg( dstop.dst, &di ); + assem += sizeof( struct sh_dstop ) / sizeof( unsigned ); + } + else { + struct sh_unaryop unaryop = *(struct sh_unaryop *) assem; + + dump_dstreg( unaryop.dst, &di ); + debug_printf( ", " ); + dump_srcreg( unaryop.src, NULL, &di ); + assem += sizeof( struct sh_unaryop ) / sizeof( unsigned ); + } + } + else { + struct sh_binaryop binaryop = *(struct sh_binaryop *) assem; + + dump_op( op, "texld" ); + dump_dstreg( binaryop.dst, &di ); + debug_printf( ", " ); + dump_srcreg( binaryop.src0, NULL, &di ); + debug_printf( ", " ); + dump_srcreg( binaryop.src1, NULL, &di ); + assem += sizeof( struct sh_binaryop ) / sizeof( unsigned ); + } + debug_printf( "\n" ); + break; + + case SVGA3DOP_DEF: + { + struct sh_def def = *(struct sh_def *) assem; + + debug_printf( "def " ); + dump_reg( def.reg, NULL, &di ); + debug_printf( ", " ); + dump_cdata( def.cdata ); + debug_printf( "\n" ); + assem += sizeof( struct sh_def ) / sizeof( unsigned ); + } + break; + + case SVGA3DOP_PHASE: + debug_printf( "phase\n" ); + assem += sizeof( struct sh_op ) / sizeof( unsigned ); + break; + + case SVGA3DOP_COMMENT: + assert( 0 ); + break; + + case SVGA3DOP_RET: + debug_printf( "ret\n" ); + assem += sizeof( struct sh_op ) / sizeof( unsigned ); + break; + + case SVGA3DOP_END: + debug_printf( "end\n" ); + finished = TRUE; + break; + + default: + { + const struct sh_opcode_info *info = sh_svga_opcode_info( op.opcode ); + uint i; + uint num_src = info->num_src + op.predicated; + boolean not_first_arg = FALSE; + + assert( info->num_dst <= 1 ); + + if (op.opcode == SVGA3DOP_SINCOS && di.version.major < 3) + num_src += 2; + + dump_comp_op( op, info->mnemonic ); + assem += sizeof( struct sh_op ) / sizeof( unsigned ); + + if (info->num_dst > 0) { + struct sh_dstreg dstreg = *(struct sh_dstreg *) assem; + + dump_dstreg( dstreg, &di ); + assem += sizeof( struct sh_dstreg ) / sizeof( unsigned ); + not_first_arg = TRUE; + } + + for (i = 0; i < num_src; i++) { + struct sh_srcreg srcreg; + struct sh_srcreg indreg; + + srcreg = *(struct sh_srcreg *) assem; + assem += sizeof( struct sh_srcreg ) / sizeof( unsigned ); + if (srcreg.relative && !di.is_ps && di.version.major >= 2) { + indreg = *(struct sh_srcreg *) assem; + assem += sizeof( struct sh_srcreg ) / sizeof( unsigned ); + } + + if (not_first_arg) + debug_printf( ", " ); + else + debug_printf( " " ); + dump_srcreg( srcreg, &indreg, &di ); + not_first_arg = TRUE; + } + + debug_printf( "\n" ); + } + } + } +} diff --git a/src/gallium/drivers/svga/svgadump/st_shader_dump.h b/src/gallium/drivers/svga/svgadump/st_shader_dump.h new file mode 100644 index 0000000000..af5549cdba --- /dev/null +++ b/src/gallium/drivers/svga/svgadump/st_shader_dump.h @@ -0,0 +1,42 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +/** + * @file + * SVGA Shader Dump Facilities + * + * @author Michal Krol + */ + +#ifndef ST_SHADER_SVGA_DUMP_H +#define ST_SHADER_SVGA_DUMP_H + +void +sh_svga_dump( + const unsigned *assem, + unsigned dwords, + unsigned do_binary ); + +#endif /* ST_SHADER_SVGA_DUMP_H */ diff --git a/src/gallium/drivers/svga/svgadump/st_shader_op.c b/src/gallium/drivers/svga/svgadump/st_shader_op.c new file mode 100644 index 0000000000..2c05382ab9 --- /dev/null +++ b/src/gallium/drivers/svga/svgadump/st_shader_op.c @@ -0,0 +1,168 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +/** + * @file + * SVGA Shader Token Opcode Info + * + * @author Michal Krol + */ + +#include "util/u_debug.h" +#include "st_shader_op.h" + +#include "../svga_hw_reg.h" +#include "svga3d_shaderdefs.h" + +#define SVGA3DOP_INVALID SVGA3DOP_END +#define TGSI_OPCODE_INVALID TGSI_OPCODE_LAST + +static struct sh_opcode_info opcode_info[] = +{ + { "nop", 0, 0, SVGA3DOP_NOP }, + { "mov", 1, 1, SVGA3DOP_MOV, }, + { "add", 1, 2, SVGA3DOP_ADD, }, + { "sub", 1, 2, SVGA3DOP_SUB, }, + { "mad", 1, 3, SVGA3DOP_MAD, }, + { "mul", 1, 2, SVGA3DOP_MUL, }, + { "rcp", 1, 1, SVGA3DOP_RCP, }, + { "rsq", 1, 1, SVGA3DOP_RSQ, }, + { "dp3", 1, 2, SVGA3DOP_DP3, }, + { "dp4", 1, 2, SVGA3DOP_DP4, }, + { "min", 1, 2, SVGA3DOP_MIN, }, + { "max", 1, 2, SVGA3DOP_MAX, }, + { "slt", 1, 2, SVGA3DOP_SLT, }, + { "sge", 1, 2, SVGA3DOP_SGE, }, + { "exp", 1, 1, SVGA3DOP_EXP, }, + { "log", 1, 1, SVGA3DOP_LOG, }, + { "lit", 1, 1, SVGA3DOP_LIT, }, + { "dst", 1, 2, SVGA3DOP_DST, }, + { "lrp", 1, 3, SVGA3DOP_LRP, }, + { "frc", 1, 1, SVGA3DOP_FRC, }, + { "m4x4", 1, 2, SVGA3DOP_M4x4, }, + { "m4x3", 1, 2, SVGA3DOP_M4x3, }, + { "m3x4", 1, 2, SVGA3DOP_M3x4, }, + { "m3x3", 1, 2, SVGA3DOP_M3x3, }, + { "m3x2", 1, 2, SVGA3DOP_M3x2, }, + { "call", 0, 1, SVGA3DOP_CALL, }, + { "callnz", 0, 2, SVGA3DOP_CALLNZ, }, + { "loop", 0, 2, SVGA3DOP_LOOP, }, + { "ret", 0, 0, SVGA3DOP_RET, }, + { "endloop", 0, 0, SVGA3DOP_ENDLOOP, }, + { "label", 0, 1, SVGA3DOP_LABEL, }, + { "dcl", 0, 0, SVGA3DOP_DCL, }, + { "pow", 1, 2, SVGA3DOP_POW, }, + { "crs", 1, 2, SVGA3DOP_CRS, }, + { "sgn", 1, 3, SVGA3DOP_SGN, }, + { "abs", 1, 1, SVGA3DOP_ABS, }, + { "nrm", 1, 1, SVGA3DOP_NRM, }, /* 3-componenet normalization */ + { "sincos", 1, 1, SVGA3DOP_SINCOS, }, + { "rep", 0, 1, SVGA3DOP_REP, }, + { "endrep", 0, 0, SVGA3DOP_ENDREP, }, + { "if", 0, 1, SVGA3DOP_IF, }, + { "ifc", 0, 2, SVGA3DOP_IFC, }, + { "else", 0, 0, SVGA3DOP_ELSE, }, + { "endif", 0, 0, SVGA3DOP_ENDIF, }, + { "break", 0, 0, SVGA3DOP_BREAK, }, + { "breakc", 0, 0, SVGA3DOP_BREAKC, }, + { "mova", 1, 1, SVGA3DOP_MOVA, }, + { "defb", 0, 0, SVGA3DOP_DEFB, }, + { "defi", 0, 0, SVGA3DOP_DEFI, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "texcoord", 0, 0, SVGA3DOP_TEXCOORD, }, + { "texkill", 1, 0, SVGA3DOP_TEXKILL, }, + { "tex", 0, 0, SVGA3DOP_TEX, }, + { "texbem", 1, 1, SVGA3DOP_TEXBEM, }, + { "texbeml", 1, 1, SVGA3DOP_TEXBEML, }, + { "texreg2ar", 1, 1, SVGA3DOP_TEXREG2AR, }, + { "texreg2gb", 1, 1, SVGA3DOP_TEXREG2GB, }, + { "texm3x2pad", 1, 1, SVGA3DOP_TEXM3x2PAD, }, + { "texm3x2tex", 1, 1, SVGA3DOP_TEXM3x2TEX, }, + { "texm3x3pad", 1, 1, SVGA3DOP_TEXM3x3PAD, }, + { "texm3x3tex", 1, 1, SVGA3DOP_TEXM3x3TEX, }, + { "reserved0", 0, 0, SVGA3DOP_RESERVED0, }, + { "texm3x3spec", 1, 2, SVGA3DOP_TEXM3x3SPEC, }, + { "texm3x3vspec", 1, 1, SVGA3DOP_TEXM3x3VSPEC,}, + { "expp", 1, 1, SVGA3DOP_EXPP, }, + { "logp", 1, 1, SVGA3DOP_LOGP, }, + { "cnd", 1, 3, SVGA3DOP_CND, }, + { "def", 0, 0, SVGA3DOP_DEF, }, + { "texreg2rgb", 1, 1, SVGA3DOP_TEXREG2RGB, }, + { "texdp3tex", 1, 1, SVGA3DOP_TEXDP3TEX, }, + { "texm3x2depth", 1, 1, SVGA3DOP_TEXM3x2DEPTH,}, + { "texdp3", 1, 1, SVGA3DOP_TEXDP3, }, + { "texm3x3", 1, 1, SVGA3DOP_TEXM3x3, }, + { "texdepth", 1, 0, SVGA3DOP_TEXDEPTH, }, + { "cmp", 1, 3, SVGA3DOP_CMP, }, + { "bem", 1, 2, SVGA3DOP_BEM, }, + { "dp2add", 1, 3, SVGA3DOP_DP2ADD, }, + { "dsx", 1, 1, SVGA3DOP_INVALID, }, + { "dsy", 1, 1, SVGA3DOP_INVALID, }, + { "texldd", 1, 1, SVGA3DOP_INVALID, }, + { "setp", 1, 2, SVGA3DOP_SETP, }, + { "texldl", 1, 1, SVGA3DOP_INVALID, }, + { "breakp", 1, 1, SVGA3DOP_INVALID, }, +}; + +const struct sh_opcode_info *sh_svga_opcode_info( uint op ) +{ + struct sh_opcode_info *info; + + if (op >= sizeof( opcode_info ) / sizeof( opcode_info[0] )) { + /* The opcode is either PHASE, COMMENT, END or out of range. + */ + assert( 0 ); + return NULL; + } + + info = &opcode_info[op]; + + if (info->svga_opcode == SVGA3DOP_INVALID) { + /* No valid information. Please provide number of dst/src registers. + */ + assert( 0 ); + return NULL; + } + + /* Sanity check. + */ + assert( op == info->svga_opcode ); + + return info; +} diff --git a/src/gallium/drivers/svga/svgadump/st_shader_op.h b/src/gallium/drivers/svga/svgadump/st_shader_op.h new file mode 100644 index 0000000000..01d39dca84 --- /dev/null +++ b/src/gallium/drivers/svga/svgadump/st_shader_op.h @@ -0,0 +1,46 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +/** + * @file + * SVGA Shader Token Opcode Info + * + * @author Michal Krol + */ + +#ifndef ST_SHADER_SVGA_OP_H +#define ST_SHADER_SVGA_OP_H + +struct sh_opcode_info +{ + const char *mnemonic; + unsigned num_dst:8; + unsigned num_src:8; + unsigned svga_opcode:16; +}; + +const struct sh_opcode_info *sh_svga_opcode_info( unsigned op ); + +#endif /* ST_SHADER_SVGA_OP_H */ diff --git a/src/gallium/drivers/svga/svgadump/svga_dump.c b/src/gallium/drivers/svga/svgadump/svga_dump.c new file mode 100644 index 0000000000..180dde8dc1 --- /dev/null +++ b/src/gallium/drivers/svga/svgadump/svga_dump.c @@ -0,0 +1,1736 @@ +/********************************************************** + * 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, 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. + * + **********************************************************/ + +/** + * @file + * Dump SVGA commands. + * + * Generated automatically from svga3d_reg.h by svga_dump.py. + */ + +#include "svga_types.h" +#include "st_shader_dump.h" +#include "svga3d_reg.h" + +#include "util/u_debug.h" +#include "svga_dump.h" + +static void +dump_SVGA3dVertexDecl(const SVGA3dVertexDecl *cmd) +{ + switch((*cmd).identity.type) { + case SVGA3D_DECLTYPE_FLOAT1: + debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT1\n"); + break; + case SVGA3D_DECLTYPE_FLOAT2: + debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT2\n"); + break; + case SVGA3D_DECLTYPE_FLOAT3: + debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT3\n"); + break; + case SVGA3D_DECLTYPE_FLOAT4: + debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT4\n"); + break; + case SVGA3D_DECLTYPE_D3DCOLOR: + debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_D3DCOLOR\n"); + break; + case SVGA3D_DECLTYPE_UBYTE4: + debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UBYTE4\n"); + break; + case SVGA3D_DECLTYPE_SHORT2: + debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT2\n"); + break; + case SVGA3D_DECLTYPE_SHORT4: + debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT4\n"); + break; + case SVGA3D_DECLTYPE_UBYTE4N: + debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UBYTE4N\n"); + break; + case SVGA3D_DECLTYPE_SHORT2N: + debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT2N\n"); + break; + case SVGA3D_DECLTYPE_SHORT4N: + debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT4N\n"); + break; + case SVGA3D_DECLTYPE_USHORT2N: + debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_USHORT2N\n"); + break; + case SVGA3D_DECLTYPE_USHORT4N: + debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_USHORT4N\n"); + break; + case SVGA3D_DECLTYPE_UDEC3: + debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UDEC3\n"); + break; + case SVGA3D_DECLTYPE_DEC3N: + debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_DEC3N\n"); + break; + case SVGA3D_DECLTYPE_FLOAT16_2: + debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT16_2\n"); + break; + case SVGA3D_DECLTYPE_FLOAT16_4: + debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT16_4\n"); + break; + case SVGA3D_DECLTYPE_MAX: + debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_MAX\n"); + break; + default: + debug_printf("\t\t.identity.type = %i\n", (*cmd).identity.type); + break; + } + switch((*cmd).identity.method) { + case SVGA3D_DECLMETHOD_DEFAULT: + debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_DEFAULT\n"); + break; + case SVGA3D_DECLMETHOD_PARTIALU: + debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_PARTIALU\n"); + break; + case SVGA3D_DECLMETHOD_PARTIALV: + debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_PARTIALV\n"); + break; + case SVGA3D_DECLMETHOD_CROSSUV: + debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_CROSSUV\n"); + break; + case SVGA3D_DECLMETHOD_UV: + debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_UV\n"); + break; + case SVGA3D_DECLMETHOD_LOOKUP: + debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_LOOKUP\n"); + break; + case SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED: + debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED\n"); + break; + default: + debug_printf("\t\t.identity.method = %i\n", (*cmd).identity.method); + break; + } + switch((*cmd).identity.usage) { + case SVGA3D_DECLUSAGE_POSITION: + debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_POSITION\n"); + break; + case SVGA3D_DECLUSAGE_BLENDWEIGHT: + debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BLENDWEIGHT\n"); + break; + case SVGA3D_DECLUSAGE_BLENDINDICES: + debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BLENDINDICES\n"); + break; + case SVGA3D_DECLUSAGE_NORMAL: + debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_NORMAL\n"); + break; + case SVGA3D_DECLUSAGE_PSIZE: + debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_PSIZE\n"); + break; + case SVGA3D_DECLUSAGE_TEXCOORD: + debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TEXCOORD\n"); + break; + case SVGA3D_DECLUSAGE_TANGENT: + debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TANGENT\n"); + break; + case SVGA3D_DECLUSAGE_BINORMAL: + debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BINORMAL\n"); + break; + case SVGA3D_DECLUSAGE_TESSFACTOR: + debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TESSFACTOR\n"); + break; + case SVGA3D_DECLUSAGE_POSITIONT: + debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_POSITIONT\n"); + break; + case SVGA3D_DECLUSAGE_COLOR: + debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_COLOR\n"); + break; + case SVGA3D_DECLUSAGE_FOG: + debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_FOG\n"); + break; + case SVGA3D_DECLUSAGE_DEPTH: + debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_DEPTH\n"); + break; + case SVGA3D_DECLUSAGE_SAMPLE: + debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_SAMPLE\n"); + break; + case SVGA3D_DECLUSAGE_MAX: + debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_MAX\n"); + break; + default: + debug_printf("\t\t.identity.usage = %i\n", (*cmd).identity.usage); + break; + } + debug_printf("\t\t.identity.usageIndex = %u\n", (*cmd).identity.usageIndex); + debug_printf("\t\t.array.surfaceId = %u\n", (*cmd).array.surfaceId); + debug_printf("\t\t.array.offset = %u\n", (*cmd).array.offset); + debug_printf("\t\t.array.stride = %u\n", (*cmd).array.stride); + debug_printf("\t\t.rangeHint.first = %u\n", (*cmd).rangeHint.first); + debug_printf("\t\t.rangeHint.last = %u\n", (*cmd).rangeHint.last); +} + +static void +dump_SVGA3dTextureState(const SVGA3dTextureState *cmd) +{ + debug_printf("\t\t.stage = %u\n", (*cmd).stage); + switch((*cmd).name) { + case SVGA3D_TS_INVALID: + debug_printf("\t\t.name = SVGA3D_TS_INVALID\n"); + break; + case SVGA3D_TS_BIND_TEXTURE: + debug_printf("\t\t.name = SVGA3D_TS_BIND_TEXTURE\n"); + break; + case SVGA3D_TS_COLOROP: + debug_printf("\t\t.name = SVGA3D_TS_COLOROP\n"); + break; + case SVGA3D_TS_COLORARG1: + debug_printf("\t\t.name = SVGA3D_TS_COLORARG1\n"); + break; + case SVGA3D_TS_COLORARG2: + debug_printf("\t\t.name = SVGA3D_TS_COLORARG2\n"); + break; + case SVGA3D_TS_ALPHAOP: + debug_printf("\t\t.name = SVGA3D_TS_ALPHAOP\n"); + break; + case SVGA3D_TS_ALPHAARG1: + debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG1\n"); + break; + case SVGA3D_TS_ALPHAARG2: + debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG2\n"); + break; + case SVGA3D_TS_ADDRESSU: + debug_printf("\t\t.name = SVGA3D_TS_ADDRESSU\n"); + break; + case SVGA3D_TS_ADDRESSV: + debug_printf("\t\t.name = SVGA3D_TS_ADDRESSV\n"); + break; + case SVGA3D_TS_MIPFILTER: + debug_printf("\t\t.name = SVGA3D_TS_MIPFILTER\n"); + break; + case SVGA3D_TS_MAGFILTER: + debug_printf("\t\t.name = SVGA3D_TS_MAGFILTER\n"); + break; + case SVGA3D_TS_MINFILTER: + debug_printf("\t\t.name = SVGA3D_TS_MINFILTER\n"); + break; + case SVGA3D_TS_BORDERCOLOR: + debug_printf("\t\t.name = SVGA3D_TS_BORDERCOLOR\n"); + break; + case SVGA3D_TS_TEXCOORDINDEX: + debug_printf("\t\t.name = SVGA3D_TS_TEXCOORDINDEX\n"); + break; + case SVGA3D_TS_TEXTURETRANSFORMFLAGS: + debug_printf("\t\t.name = SVGA3D_TS_TEXTURETRANSFORMFLAGS\n"); + break; + case SVGA3D_TS_TEXCOORDGEN: + debug_printf("\t\t.name = SVGA3D_TS_TEXCOORDGEN\n"); + break; + case SVGA3D_TS_BUMPENVMAT00: + debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT00\n"); + break; + case SVGA3D_TS_BUMPENVMAT01: + debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT01\n"); + break; + case SVGA3D_TS_BUMPENVMAT10: + debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT10\n"); + break; + case SVGA3D_TS_BUMPENVMAT11: + debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT11\n"); + break; + case SVGA3D_TS_TEXTURE_MIPMAP_LEVEL: + debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_MIPMAP_LEVEL\n"); + break; + case SVGA3D_TS_TEXTURE_LOD_BIAS: + debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_LOD_BIAS\n"); + break; + case SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL: + debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL\n"); + break; + case SVGA3D_TS_ADDRESSW: + debug_printf("\t\t.name = SVGA3D_TS_ADDRESSW\n"); + break; + case SVGA3D_TS_GAMMA: + debug_printf("\t\t.name = SVGA3D_TS_GAMMA\n"); + break; + case SVGA3D_TS_BUMPENVLSCALE: + debug_printf("\t\t.name = SVGA3D_TS_BUMPENVLSCALE\n"); + break; + case SVGA3D_TS_BUMPENVLOFFSET: + debug_printf("\t\t.name = SVGA3D_TS_BUMPENVLOFFSET\n"); + break; + case SVGA3D_TS_COLORARG0: + debug_printf("\t\t.name = SVGA3D_TS_COLORARG0\n"); + break; + case SVGA3D_TS_ALPHAARG0: + debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG0\n"); + break; + case SVGA3D_TS_MAX: + debug_printf("\t\t.name = SVGA3D_TS_MAX\n"); + break; + default: + debug_printf("\t\t.name = %i\n", (*cmd).name); + break; + } + debug_printf("\t\t.value = %u\n", (*cmd).value); + debug_printf("\t\t.floatValue = %f\n", (*cmd).floatValue); +} + +static void +dump_SVGA3dCopyBox(const SVGA3dCopyBox *cmd) +{ + debug_printf("\t\t.x = %u\n", (*cmd).x); + debug_printf("\t\t.y = %u\n", (*cmd).y); + debug_printf("\t\t.z = %u\n", (*cmd).z); + debug_printf("\t\t.w = %u\n", (*cmd).w); + debug_printf("\t\t.h = %u\n", (*cmd).h); + debug_printf("\t\t.d = %u\n", (*cmd).d); + debug_printf("\t\t.srcx = %u\n", (*cmd).srcx); + debug_printf("\t\t.srcy = %u\n", (*cmd).srcy); + debug_printf("\t\t.srcz = %u\n", (*cmd).srcz); +} + +static void +dump_SVGA3dCmdSetClipPlane(const SVGA3dCmdSetClipPlane *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); + debug_printf("\t\t.index = %u\n", (*cmd).index); + debug_printf("\t\t.plane[0] = %f\n", (*cmd).plane[0]); + debug_printf("\t\t.plane[1] = %f\n", (*cmd).plane[1]); + debug_printf("\t\t.plane[2] = %f\n", (*cmd).plane[2]); + debug_printf("\t\t.plane[3] = %f\n", (*cmd).plane[3]); +} + +static void +dump_SVGA3dCmdWaitForQuery(const SVGA3dCmdWaitForQuery *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); + switch((*cmd).type) { + case SVGA3D_QUERYTYPE_OCCLUSION: + debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n"); + break; + case SVGA3D_QUERYTYPE_MAX: + debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n"); + break; + default: + debug_printf("\t\t.type = %i\n", (*cmd).type); + break; + } + debug_printf("\t\t.guestResult.gmrId = %u\n", (*cmd).guestResult.gmrId); + debug_printf("\t\t.guestResult.offset = %u\n", (*cmd).guestResult.offset); +} + +static void +dump_SVGA3dCmdSetRenderTarget(const SVGA3dCmdSetRenderTarget *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); + switch((*cmd).type) { + case SVGA3D_RT_DEPTH: + debug_printf("\t\t.type = SVGA3D_RT_DEPTH\n"); + break; + case SVGA3D_RT_STENCIL: + debug_printf("\t\t.type = SVGA3D_RT_STENCIL\n"); + break; + default: + debug_printf("\t\t.type = SVGA3D_RT_COLOR%u\n", (*cmd).type - SVGA3D_RT_COLOR0); + break; + } + debug_printf("\t\t.target.sid = %u\n", (*cmd).target.sid); + debug_printf("\t\t.target.face = %u\n", (*cmd).target.face); + debug_printf("\t\t.target.mipmap = %u\n", (*cmd).target.mipmap); +} + +static void +dump_SVGA3dCmdSetTextureState(const SVGA3dCmdSetTextureState *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); +} + +static void +dump_SVGA3dCmdSurfaceCopy(const SVGA3dCmdSurfaceCopy *cmd) +{ + debug_printf("\t\t.src.sid = %u\n", (*cmd).src.sid); + debug_printf("\t\t.src.face = %u\n", (*cmd).src.face); + debug_printf("\t\t.src.mipmap = %u\n", (*cmd).src.mipmap); + debug_printf("\t\t.dest.sid = %u\n", (*cmd).dest.sid); + debug_printf("\t\t.dest.face = %u\n", (*cmd).dest.face); + debug_printf("\t\t.dest.mipmap = %u\n", (*cmd).dest.mipmap); +} + +static void +dump_SVGA3dCmdSetMaterial(const SVGA3dCmdSetMaterial *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); + switch((*cmd).face) { + case SVGA3D_FACE_INVALID: + debug_printf("\t\t.face = SVGA3D_FACE_INVALID\n"); + break; + case SVGA3D_FACE_NONE: + debug_printf("\t\t.face = SVGA3D_FACE_NONE\n"); + break; + case SVGA3D_FACE_FRONT: + debug_printf("\t\t.face = SVGA3D_FACE_FRONT\n"); + break; + case SVGA3D_FACE_BACK: + debug_printf("\t\t.face = SVGA3D_FACE_BACK\n"); + break; + case SVGA3D_FACE_FRONT_BACK: + debug_printf("\t\t.face = SVGA3D_FACE_FRONT_BACK\n"); + break; + case SVGA3D_FACE_MAX: + debug_printf("\t\t.face = SVGA3D_FACE_MAX\n"); + break; + default: + debug_printf("\t\t.face = %i\n", (*cmd).face); + break; + } + debug_printf("\t\t.material.diffuse[0] = %f\n", (*cmd).material.diffuse[0]); + debug_printf("\t\t.material.diffuse[1] = %f\n", (*cmd).material.diffuse[1]); + debug_printf("\t\t.material.diffuse[2] = %f\n", (*cmd).material.diffuse[2]); + debug_printf("\t\t.material.diffuse[3] = %f\n", (*cmd).material.diffuse[3]); + debug_printf("\t\t.material.ambient[0] = %f\n", (*cmd).material.ambient[0]); + debug_printf("\t\t.material.ambient[1] = %f\n", (*cmd).material.ambient[1]); + debug_printf("\t\t.material.ambient[2] = %f\n", (*cmd).material.ambient[2]); + debug_printf("\t\t.material.ambient[3] = %f\n", (*cmd).material.ambient[3]); + debug_printf("\t\t.material.specular[0] = %f\n", (*cmd).material.specular[0]); + debug_printf("\t\t.material.specular[1] = %f\n", (*cmd).material.specular[1]); + debug_printf("\t\t.material.specular[2] = %f\n", (*cmd).material.specular[2]); + debug_printf("\t\t.material.specular[3] = %f\n", (*cmd).material.specular[3]); + debug_printf("\t\t.material.emissive[0] = %f\n", (*cmd).material.emissive[0]); + debug_printf("\t\t.material.emissive[1] = %f\n", (*cmd).material.emissive[1]); + debug_printf("\t\t.material.emissive[2] = %f\n", (*cmd).material.emissive[2]); + debug_printf("\t\t.material.emissive[3] = %f\n", (*cmd).material.emissive[3]); + debug_printf("\t\t.material.shininess = %f\n", (*cmd).material.shininess); +} + +static void +dump_SVGA3dCmdSetLightData(const SVGA3dCmdSetLightData *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); + debug_printf("\t\t.index = %u\n", (*cmd).index); + switch((*cmd).data.type) { + case SVGA3D_LIGHTTYPE_INVALID: + debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_INVALID\n"); + break; + case SVGA3D_LIGHTTYPE_POINT: + debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_POINT\n"); + break; + case SVGA3D_LIGHTTYPE_SPOT1: + debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_SPOT1\n"); + break; + case SVGA3D_LIGHTTYPE_SPOT2: + debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_SPOT2\n"); + break; + case SVGA3D_LIGHTTYPE_DIRECTIONAL: + debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_DIRECTIONAL\n"); + break; + case SVGA3D_LIGHTTYPE_MAX: + debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_MAX\n"); + break; + default: + debug_printf("\t\t.data.type = %i\n", (*cmd).data.type); + break; + } + debug_printf("\t\t.data.inWorldSpace = %u\n", (*cmd).data.inWorldSpace); + debug_printf("\t\t.data.diffuse[0] = %f\n", (*cmd).data.diffuse[0]); + debug_printf("\t\t.data.diffuse[1] = %f\n", (*cmd).data.diffuse[1]); + debug_printf("\t\t.data.diffuse[2] = %f\n", (*cmd).data.diffuse[2]); + debug_printf("\t\t.data.diffuse[3] = %f\n", (*cmd).data.diffuse[3]); + debug_printf("\t\t.data.specular[0] = %f\n", (*cmd).data.specular[0]); + debug_printf("\t\t.data.specular[1] = %f\n", (*cmd).data.specular[1]); + debug_printf("\t\t.data.specular[2] = %f\n", (*cmd).data.specular[2]); + debug_printf("\t\t.data.specular[3] = %f\n", (*cmd).data.specular[3]); + debug_printf("\t\t.data.ambient[0] = %f\n", (*cmd).data.ambient[0]); + debug_printf("\t\t.data.ambient[1] = %f\n", (*cmd).data.ambient[1]); + debug_printf("\t\t.data.ambient[2] = %f\n", (*cmd).data.ambient[2]); + debug_printf("\t\t.data.ambient[3] = %f\n", (*cmd).data.ambient[3]); + debug_printf("\t\t.data.position[0] = %f\n", (*cmd).data.position[0]); + debug_printf("\t\t.data.position[1] = %f\n", (*cmd).data.position[1]); + debug_printf("\t\t.data.position[2] = %f\n", (*cmd).data.position[2]); + debug_printf("\t\t.data.position[3] = %f\n", (*cmd).data.position[3]); + debug_printf("\t\t.data.direction[0] = %f\n", (*cmd).data.direction[0]); + debug_printf("\t\t.data.direction[1] = %f\n", (*cmd).data.direction[1]); + debug_printf("\t\t.data.direction[2] = %f\n", (*cmd).data.direction[2]); + debug_printf("\t\t.data.direction[3] = %f\n", (*cmd).data.direction[3]); + debug_printf("\t\t.data.range = %f\n", (*cmd).data.range); + debug_printf("\t\t.data.falloff = %f\n", (*cmd).data.falloff); + debug_printf("\t\t.data.attenuation0 = %f\n", (*cmd).data.attenuation0); + debug_printf("\t\t.data.attenuation1 = %f\n", (*cmd).data.attenuation1); + debug_printf("\t\t.data.attenuation2 = %f\n", (*cmd).data.attenuation2); + debug_printf("\t\t.data.theta = %f\n", (*cmd).data.theta); + debug_printf("\t\t.data.phi = %f\n", (*cmd).data.phi); +} + +static void +dump_SVGA3dCmdSetViewport(const SVGA3dCmdSetViewport *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); + debug_printf("\t\t.rect.x = %u\n", (*cmd).rect.x); + debug_printf("\t\t.rect.y = %u\n", (*cmd).rect.y); + debug_printf("\t\t.rect.w = %u\n", (*cmd).rect.w); + debug_printf("\t\t.rect.h = %u\n", (*cmd).rect.h); +} + +static void +dump_SVGA3dCmdSetScissorRect(const SVGA3dCmdSetScissorRect *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); + debug_printf("\t\t.rect.x = %u\n", (*cmd).rect.x); + debug_printf("\t\t.rect.y = %u\n", (*cmd).rect.y); + debug_printf("\t\t.rect.w = %u\n", (*cmd).rect.w); + debug_printf("\t\t.rect.h = %u\n", (*cmd).rect.h); +} + +static void +dump_SVGA3dCopyRect(const SVGA3dCopyRect *cmd) +{ + debug_printf("\t\t.x = %u\n", (*cmd).x); + debug_printf("\t\t.y = %u\n", (*cmd).y); + debug_printf("\t\t.w = %u\n", (*cmd).w); + debug_printf("\t\t.h = %u\n", (*cmd).h); + debug_printf("\t\t.srcx = %u\n", (*cmd).srcx); + debug_printf("\t\t.srcy = %u\n", (*cmd).srcy); +} + +static void +dump_SVGA3dCmdSetShader(const SVGA3dCmdSetShader *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); + switch((*cmd).type) { + case SVGA3D_SHADERTYPE_COMPILED_DX8: + debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n"); + break; + case SVGA3D_SHADERTYPE_VS: + debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n"); + break; + case SVGA3D_SHADERTYPE_PS: + debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n"); + break; + case SVGA3D_SHADERTYPE_MAX: + debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n"); + break; + default: + debug_printf("\t\t.type = %i\n", (*cmd).type); + break; + } + debug_printf("\t\t.shid = %u\n", (*cmd).shid); +} + +static void +dump_SVGA3dCmdEndQuery(const SVGA3dCmdEndQuery *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); + switch((*cmd).type) { + case SVGA3D_QUERYTYPE_OCCLUSION: + debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n"); + break; + case SVGA3D_QUERYTYPE_MAX: + debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n"); + break; + default: + debug_printf("\t\t.type = %i\n", (*cmd).type); + break; + } + debug_printf("\t\t.guestResult.gmrId = %u\n", (*cmd).guestResult.gmrId); + debug_printf("\t\t.guestResult.offset = %u\n", (*cmd).guestResult.offset); +} + +static void +dump_SVGA3dSize(const SVGA3dSize *cmd) +{ + debug_printf("\t\t.width = %u\n", (*cmd).width); + debug_printf("\t\t.height = %u\n", (*cmd).height); + debug_printf("\t\t.depth = %u\n", (*cmd).depth); +} + +static void +dump_SVGA3dCmdDestroySurface(const SVGA3dCmdDestroySurface *cmd) +{ + debug_printf("\t\t.sid = %u\n", (*cmd).sid); +} + +static void +dump_SVGA3dCmdDefineContext(const SVGA3dCmdDefineContext *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); +} + +static void +dump_SVGA3dRect(const SVGA3dRect *cmd) +{ + debug_printf("\t\t.x = %u\n", (*cmd).x); + debug_printf("\t\t.y = %u\n", (*cmd).y); + debug_printf("\t\t.w = %u\n", (*cmd).w); + debug_printf("\t\t.h = %u\n", (*cmd).h); +} + +static void +dump_SVGA3dCmdBeginQuery(const SVGA3dCmdBeginQuery *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); + switch((*cmd).type) { + case SVGA3D_QUERYTYPE_OCCLUSION: + debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n"); + break; + case SVGA3D_QUERYTYPE_MAX: + debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n"); + break; + default: + debug_printf("\t\t.type = %i\n", (*cmd).type); + break; + } +} + +static void +dump_SVGA3dRenderState(const SVGA3dRenderState *cmd) +{ + switch((*cmd).state) { + case SVGA3D_RS_INVALID: + debug_printf("\t\t.state = SVGA3D_RS_INVALID\n"); + break; + case SVGA3D_RS_ZENABLE: + debug_printf("\t\t.state = SVGA3D_RS_ZENABLE\n"); + break; + case SVGA3D_RS_ZWRITEENABLE: + debug_printf("\t\t.state = SVGA3D_RS_ZWRITEENABLE\n"); + break; + case SVGA3D_RS_ALPHATESTENABLE: + debug_printf("\t\t.state = SVGA3D_RS_ALPHATESTENABLE\n"); + break; + case SVGA3D_RS_DITHERENABLE: + debug_printf("\t\t.state = SVGA3D_RS_DITHERENABLE\n"); + break; + case SVGA3D_RS_BLENDENABLE: + debug_printf("\t\t.state = SVGA3D_RS_BLENDENABLE\n"); + break; + case SVGA3D_RS_FOGENABLE: + debug_printf("\t\t.state = SVGA3D_RS_FOGENABLE\n"); + break; + case SVGA3D_RS_SPECULARENABLE: + debug_printf("\t\t.state = SVGA3D_RS_SPECULARENABLE\n"); + break; + case SVGA3D_RS_STENCILENABLE: + debug_printf("\t\t.state = SVGA3D_RS_STENCILENABLE\n"); + break; + case SVGA3D_RS_LIGHTINGENABLE: + debug_printf("\t\t.state = SVGA3D_RS_LIGHTINGENABLE\n"); + break; + case SVGA3D_RS_NORMALIZENORMALS: + debug_printf("\t\t.state = SVGA3D_RS_NORMALIZENORMALS\n"); + break; + case SVGA3D_RS_POINTSPRITEENABLE: + debug_printf("\t\t.state = SVGA3D_RS_POINTSPRITEENABLE\n"); + break; + case SVGA3D_RS_POINTSCALEENABLE: + debug_printf("\t\t.state = SVGA3D_RS_POINTSCALEENABLE\n"); + break; + case SVGA3D_RS_STENCILREF: + debug_printf("\t\t.state = SVGA3D_RS_STENCILREF\n"); + break; + case SVGA3D_RS_STENCILMASK: + debug_printf("\t\t.state = SVGA3D_RS_STENCILMASK\n"); + break; + case SVGA3D_RS_STENCILWRITEMASK: + debug_printf("\t\t.state = SVGA3D_RS_STENCILWRITEMASK\n"); + break; + case SVGA3D_RS_FOGSTART: + debug_printf("\t\t.state = SVGA3D_RS_FOGSTART\n"); + break; + case SVGA3D_RS_FOGEND: + debug_printf("\t\t.state = SVGA3D_RS_FOGEND\n"); + break; + case SVGA3D_RS_FOGDENSITY: + debug_printf("\t\t.state = SVGA3D_RS_FOGDENSITY\n"); + break; + case SVGA3D_RS_POINTSIZE: + debug_printf("\t\t.state = SVGA3D_RS_POINTSIZE\n"); + break; + case SVGA3D_RS_POINTSIZEMIN: + debug_printf("\t\t.state = SVGA3D_RS_POINTSIZEMIN\n"); + break; + case SVGA3D_RS_POINTSIZEMAX: + debug_printf("\t\t.state = SVGA3D_RS_POINTSIZEMAX\n"); + break; + case SVGA3D_RS_POINTSCALE_A: + debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_A\n"); + break; + case SVGA3D_RS_POINTSCALE_B: + debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_B\n"); + break; + case SVGA3D_RS_POINTSCALE_C: + debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_C\n"); + break; + case SVGA3D_RS_FOGCOLOR: + debug_printf("\t\t.state = SVGA3D_RS_FOGCOLOR\n"); + break; + case SVGA3D_RS_AMBIENT: + debug_printf("\t\t.state = SVGA3D_RS_AMBIENT\n"); + break; + case SVGA3D_RS_CLIPPLANEENABLE: + debug_printf("\t\t.state = SVGA3D_RS_CLIPPLANEENABLE\n"); + break; + case SVGA3D_RS_FOGMODE: + debug_printf("\t\t.state = SVGA3D_RS_FOGMODE\n"); + break; + case SVGA3D_RS_FILLMODE: + debug_printf("\t\t.state = SVGA3D_RS_FILLMODE\n"); + break; + case SVGA3D_RS_SHADEMODE: + debug_printf("\t\t.state = SVGA3D_RS_SHADEMODE\n"); + break; + case SVGA3D_RS_LINEPATTERN: + debug_printf("\t\t.state = SVGA3D_RS_LINEPATTERN\n"); + break; + case SVGA3D_RS_SRCBLEND: + debug_printf("\t\t.state = SVGA3D_RS_SRCBLEND\n"); + break; + case SVGA3D_RS_DSTBLEND: + debug_printf("\t\t.state = SVGA3D_RS_DSTBLEND\n"); + break; + case SVGA3D_RS_BLENDEQUATION: + debug_printf("\t\t.state = SVGA3D_RS_BLENDEQUATION\n"); + break; + case SVGA3D_RS_CULLMODE: + debug_printf("\t\t.state = SVGA3D_RS_CULLMODE\n"); + break; + case SVGA3D_RS_ZFUNC: + debug_printf("\t\t.state = SVGA3D_RS_ZFUNC\n"); + break; + case SVGA3D_RS_ALPHAFUNC: + debug_printf("\t\t.state = SVGA3D_RS_ALPHAFUNC\n"); + break; + case SVGA3D_RS_STENCILFUNC: + debug_printf("\t\t.state = SVGA3D_RS_STENCILFUNC\n"); + break; + case SVGA3D_RS_STENCILFAIL: + debug_printf("\t\t.state = SVGA3D_RS_STENCILFAIL\n"); + break; + case SVGA3D_RS_STENCILZFAIL: + debug_printf("\t\t.state = SVGA3D_RS_STENCILZFAIL\n"); + break; + case SVGA3D_RS_STENCILPASS: + debug_printf("\t\t.state = SVGA3D_RS_STENCILPASS\n"); + break; + case SVGA3D_RS_ALPHAREF: + debug_printf("\t\t.state = SVGA3D_RS_ALPHAREF\n"); + break; + case SVGA3D_RS_FRONTWINDING: + debug_printf("\t\t.state = SVGA3D_RS_FRONTWINDING\n"); + break; + case SVGA3D_RS_COORDINATETYPE: + debug_printf("\t\t.state = SVGA3D_RS_COORDINATETYPE\n"); + break; + case SVGA3D_RS_ZBIAS: + debug_printf("\t\t.state = SVGA3D_RS_ZBIAS\n"); + break; + case SVGA3D_RS_RANGEFOGENABLE: + debug_printf("\t\t.state = SVGA3D_RS_RANGEFOGENABLE\n"); + break; + case SVGA3D_RS_COLORWRITEENABLE: + debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE\n"); + break; + case SVGA3D_RS_VERTEXMATERIALENABLE: + debug_printf("\t\t.state = SVGA3D_RS_VERTEXMATERIALENABLE\n"); + break; + case SVGA3D_RS_DIFFUSEMATERIALSOURCE: + debug_printf("\t\t.state = SVGA3D_RS_DIFFUSEMATERIALSOURCE\n"); + break; + case SVGA3D_RS_SPECULARMATERIALSOURCE: + debug_printf("\t\t.state = SVGA3D_RS_SPECULARMATERIALSOURCE\n"); + break; + case SVGA3D_RS_AMBIENTMATERIALSOURCE: + debug_printf("\t\t.state = SVGA3D_RS_AMBIENTMATERIALSOURCE\n"); + break; + case SVGA3D_RS_EMISSIVEMATERIALSOURCE: + debug_printf("\t\t.state = SVGA3D_RS_EMISSIVEMATERIALSOURCE\n"); + break; + case SVGA3D_RS_TEXTUREFACTOR: + debug_printf("\t\t.state = SVGA3D_RS_TEXTUREFACTOR\n"); + break; + case SVGA3D_RS_LOCALVIEWER: + debug_printf("\t\t.state = SVGA3D_RS_LOCALVIEWER\n"); + break; + case SVGA3D_RS_SCISSORTESTENABLE: + debug_printf("\t\t.state = SVGA3D_RS_SCISSORTESTENABLE\n"); + break; + case SVGA3D_RS_BLENDCOLOR: + debug_printf("\t\t.state = SVGA3D_RS_BLENDCOLOR\n"); + break; + case SVGA3D_RS_STENCILENABLE2SIDED: + debug_printf("\t\t.state = SVGA3D_RS_STENCILENABLE2SIDED\n"); + break; + case SVGA3D_RS_CCWSTENCILFUNC: + debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILFUNC\n"); + break; + case SVGA3D_RS_CCWSTENCILFAIL: + debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILFAIL\n"); + break; + case SVGA3D_RS_CCWSTENCILZFAIL: + debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILZFAIL\n"); + break; + case SVGA3D_RS_CCWSTENCILPASS: + debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILPASS\n"); + break; + case SVGA3D_RS_VERTEXBLEND: + debug_printf("\t\t.state = SVGA3D_RS_VERTEXBLEND\n"); + break; + case SVGA3D_RS_SLOPESCALEDEPTHBIAS: + debug_printf("\t\t.state = SVGA3D_RS_SLOPESCALEDEPTHBIAS\n"); + break; + case SVGA3D_RS_DEPTHBIAS: + debug_printf("\t\t.state = SVGA3D_RS_DEPTHBIAS\n"); + break; + case SVGA3D_RS_OUTPUTGAMMA: + debug_printf("\t\t.state = SVGA3D_RS_OUTPUTGAMMA\n"); + break; + case SVGA3D_RS_ZVISIBLE: + debug_printf("\t\t.state = SVGA3D_RS_ZVISIBLE\n"); + break; + case SVGA3D_RS_LASTPIXEL: + debug_printf("\t\t.state = SVGA3D_RS_LASTPIXEL\n"); + break; + case SVGA3D_RS_CLIPPING: + debug_printf("\t\t.state = SVGA3D_RS_CLIPPING\n"); + break; + case SVGA3D_RS_WRAP0: + debug_printf("\t\t.state = SVGA3D_RS_WRAP0\n"); + break; + case SVGA3D_RS_WRAP1: + debug_printf("\t\t.state = SVGA3D_RS_WRAP1\n"); + break; + case SVGA3D_RS_WRAP2: + debug_printf("\t\t.state = SVGA3D_RS_WRAP2\n"); + break; + case SVGA3D_RS_WRAP3: + debug_printf("\t\t.state = SVGA3D_RS_WRAP3\n"); + break; + case SVGA3D_RS_WRAP4: + debug_printf("\t\t.state = SVGA3D_RS_WRAP4\n"); + break; + case SVGA3D_RS_WRAP5: + debug_printf("\t\t.state = SVGA3D_RS_WRAP5\n"); + break; + case SVGA3D_RS_WRAP6: + debug_printf("\t\t.state = SVGA3D_RS_WRAP6\n"); + break; + case SVGA3D_RS_WRAP7: + debug_printf("\t\t.state = SVGA3D_RS_WRAP7\n"); + break; + case SVGA3D_RS_WRAP8: + debug_printf("\t\t.state = SVGA3D_RS_WRAP8\n"); + break; + case SVGA3D_RS_WRAP9: + debug_printf("\t\t.state = SVGA3D_RS_WRAP9\n"); + break; + case SVGA3D_RS_WRAP10: + debug_printf("\t\t.state = SVGA3D_RS_WRAP10\n"); + break; + case SVGA3D_RS_WRAP11: + debug_printf("\t\t.state = SVGA3D_RS_WRAP11\n"); + break; + case SVGA3D_RS_WRAP12: + debug_printf("\t\t.state = SVGA3D_RS_WRAP12\n"); + break; + case SVGA3D_RS_WRAP13: + debug_printf("\t\t.state = SVGA3D_RS_WRAP13\n"); + break; + case SVGA3D_RS_WRAP14: + debug_printf("\t\t.state = SVGA3D_RS_WRAP14\n"); + break; + case SVGA3D_RS_WRAP15: + debug_printf("\t\t.state = SVGA3D_RS_WRAP15\n"); + break; + case SVGA3D_RS_MULTISAMPLEANTIALIAS: + debug_printf("\t\t.state = SVGA3D_RS_MULTISAMPLEANTIALIAS\n"); + break; + case SVGA3D_RS_MULTISAMPLEMASK: + debug_printf("\t\t.state = SVGA3D_RS_MULTISAMPLEMASK\n"); + break; + case SVGA3D_RS_INDEXEDVERTEXBLENDENABLE: + debug_printf("\t\t.state = SVGA3D_RS_INDEXEDVERTEXBLENDENABLE\n"); + break; + case SVGA3D_RS_TWEENFACTOR: + debug_printf("\t\t.state = SVGA3D_RS_TWEENFACTOR\n"); + break; + case SVGA3D_RS_ANTIALIASEDLINEENABLE: + debug_printf("\t\t.state = SVGA3D_RS_ANTIALIASEDLINEENABLE\n"); + break; + case SVGA3D_RS_COLORWRITEENABLE1: + debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE1\n"); + break; + case SVGA3D_RS_COLORWRITEENABLE2: + debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE2\n"); + break; + case SVGA3D_RS_COLORWRITEENABLE3: + debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE3\n"); + break; + case SVGA3D_RS_SEPARATEALPHABLENDENABLE: + debug_printf("\t\t.state = SVGA3D_RS_SEPARATEALPHABLENDENABLE\n"); + break; + case SVGA3D_RS_SRCBLENDALPHA: + debug_printf("\t\t.state = SVGA3D_RS_SRCBLENDALPHA\n"); + break; + case SVGA3D_RS_DSTBLENDALPHA: + debug_printf("\t\t.state = SVGA3D_RS_DSTBLENDALPHA\n"); + break; + case SVGA3D_RS_BLENDEQUATIONALPHA: + debug_printf("\t\t.state = SVGA3D_RS_BLENDEQUATIONALPHA\n"); + break; + case SVGA3D_RS_MAX: + debug_printf("\t\t.state = SVGA3D_RS_MAX\n"); + break; + default: + debug_printf("\t\t.state = %i\n", (*cmd).state); + break; + } + debug_printf("\t\t.uintValue = %u\n", (*cmd).uintValue); + debug_printf("\t\t.floatValue = %f\n", (*cmd).floatValue); +} + +static void +dump_SVGA3dVertexDivisor(const SVGA3dVertexDivisor *cmd) +{ + debug_printf("\t\t.value = %u\n", (*cmd).value); + debug_printf("\t\t.count = %u\n", (*cmd).count); + debug_printf("\t\t.indexedData = %u\n", (*cmd).indexedData); + debug_printf("\t\t.instanceData = %u\n", (*cmd).instanceData); +} + +static void +dump_SVGA3dCmdDefineShader(const SVGA3dCmdDefineShader *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); + debug_printf("\t\t.shid = %u\n", (*cmd).shid); + switch((*cmd).type) { + case SVGA3D_SHADERTYPE_COMPILED_DX8: + debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n"); + break; + case SVGA3D_SHADERTYPE_VS: + debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n"); + break; + case SVGA3D_SHADERTYPE_PS: + debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n"); + break; + case SVGA3D_SHADERTYPE_MAX: + debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n"); + break; + default: + debug_printf("\t\t.type = %i\n", (*cmd).type); + break; + } +} + +static void +dump_SVGA3dCmdSetShaderConst(const SVGA3dCmdSetShaderConst *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); + debug_printf("\t\t.reg = %u\n", (*cmd).reg); + switch((*cmd).type) { + case SVGA3D_SHADERTYPE_COMPILED_DX8: + debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n"); + break; + case SVGA3D_SHADERTYPE_VS: + debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n"); + break; + case SVGA3D_SHADERTYPE_PS: + debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n"); + break; + case SVGA3D_SHADERTYPE_MAX: + debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n"); + break; + default: + debug_printf("\t\t.type = %i\n", (*cmd).type); + break; + } + switch((*cmd).ctype) { + case SVGA3D_CONST_TYPE_FLOAT: + debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_FLOAT\n"); + debug_printf("\t\t.values[0] = %f\n", *(const float *)&(*cmd).values[0]); + debug_printf("\t\t.values[1] = %f\n", *(const float *)&(*cmd).values[1]); + debug_printf("\t\t.values[2] = %f\n", *(const float *)&(*cmd).values[2]); + debug_printf("\t\t.values[3] = %f\n", *(const float *)&(*cmd).values[3]); + break; + case SVGA3D_CONST_TYPE_INT: + debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_INT\n"); + debug_printf("\t\t.values[0] = %u\n", (*cmd).values[0]); + debug_printf("\t\t.values[1] = %u\n", (*cmd).values[1]); + debug_printf("\t\t.values[2] = %u\n", (*cmd).values[2]); + debug_printf("\t\t.values[3] = %u\n", (*cmd).values[3]); + break; + case SVGA3D_CONST_TYPE_BOOL: + debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_BOOL\n"); + debug_printf("\t\t.values[0] = %u\n", (*cmd).values[0]); + debug_printf("\t\t.values[1] = %u\n", (*cmd).values[1]); + debug_printf("\t\t.values[2] = %u\n", (*cmd).values[2]); + debug_printf("\t\t.values[3] = %u\n", (*cmd).values[3]); + break; + default: + debug_printf("\t\t.ctype = %i\n", (*cmd).ctype); + debug_printf("\t\t.values[0] = %u\n", (*cmd).values[0]); + debug_printf("\t\t.values[1] = %u\n", (*cmd).values[1]); + debug_printf("\t\t.values[2] = %u\n", (*cmd).values[2]); + debug_printf("\t\t.values[3] = %u\n", (*cmd).values[3]); + break; + } +} + +static void +dump_SVGA3dCmdSetZRange(const SVGA3dCmdSetZRange *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); + debug_printf("\t\t.zRange.min = %f\n", (*cmd).zRange.min); + debug_printf("\t\t.zRange.max = %f\n", (*cmd).zRange.max); +} + +static void +dump_SVGA3dCmdDrawPrimitives(const SVGA3dCmdDrawPrimitives *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); + debug_printf("\t\t.numVertexDecls = %u\n", (*cmd).numVertexDecls); + debug_printf("\t\t.numRanges = %u\n", (*cmd).numRanges); +} + +static void +dump_SVGA3dCmdSetLightEnabled(const SVGA3dCmdSetLightEnabled *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); + debug_printf("\t\t.index = %u\n", (*cmd).index); + debug_printf("\t\t.enabled = %u\n", (*cmd).enabled); +} + +static void +dump_SVGA3dPrimitiveRange(const SVGA3dPrimitiveRange *cmd) +{ + switch((*cmd).primType) { + case SVGA3D_PRIMITIVE_INVALID: + debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_INVALID\n"); + break; + case SVGA3D_PRIMITIVE_TRIANGLELIST: + debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLELIST\n"); + break; + case SVGA3D_PRIMITIVE_POINTLIST: + debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_POINTLIST\n"); + break; + case SVGA3D_PRIMITIVE_LINELIST: + debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_LINELIST\n"); + break; + case SVGA3D_PRIMITIVE_LINESTRIP: + debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_LINESTRIP\n"); + break; + case SVGA3D_PRIMITIVE_TRIANGLESTRIP: + debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLESTRIP\n"); + break; + case SVGA3D_PRIMITIVE_TRIANGLEFAN: + debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLEFAN\n"); + break; + case SVGA3D_PRIMITIVE_MAX: + debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_MAX\n"); + break; + default: + debug_printf("\t\t.primType = %i\n", (*cmd).primType); + break; + } + debug_printf("\t\t.primitiveCount = %u\n", (*cmd).primitiveCount); + debug_printf("\t\t.indexArray.surfaceId = %u\n", (*cmd).indexArray.surfaceId); + debug_printf("\t\t.indexArray.offset = %u\n", (*cmd).indexArray.offset); + debug_printf("\t\t.indexArray.stride = %u\n", (*cmd).indexArray.stride); + debug_printf("\t\t.indexWidth = %u\n", (*cmd).indexWidth); + debug_printf("\t\t.indexBias = %i\n", (*cmd).indexBias); +} + +static void +dump_SVGA3dCmdPresent(const SVGA3dCmdPresent *cmd) +{ + debug_printf("\t\t.sid = %u\n", (*cmd).sid); +} + +static void +dump_SVGA3dCmdSetRenderState(const SVGA3dCmdSetRenderState *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); +} + +static void +dump_SVGA3dCmdSurfaceStretchBlt(const SVGA3dCmdSurfaceStretchBlt *cmd) +{ + debug_printf("\t\t.src.sid = %u\n", (*cmd).src.sid); + debug_printf("\t\t.src.face = %u\n", (*cmd).src.face); + debug_printf("\t\t.src.mipmap = %u\n", (*cmd).src.mipmap); + debug_printf("\t\t.dest.sid = %u\n", (*cmd).dest.sid); + debug_printf("\t\t.dest.face = %u\n", (*cmd).dest.face); + debug_printf("\t\t.dest.mipmap = %u\n", (*cmd).dest.mipmap); + debug_printf("\t\t.boxSrc.x = %u\n", (*cmd).boxSrc.x); + debug_printf("\t\t.boxSrc.y = %u\n", (*cmd).boxSrc.y); + debug_printf("\t\t.boxSrc.z = %u\n", (*cmd).boxSrc.z); + debug_printf("\t\t.boxSrc.w = %u\n", (*cmd).boxSrc.w); + debug_printf("\t\t.boxSrc.h = %u\n", (*cmd).boxSrc.h); + debug_printf("\t\t.boxSrc.d = %u\n", (*cmd).boxSrc.d); + debug_printf("\t\t.boxDest.x = %u\n", (*cmd).boxDest.x); + debug_printf("\t\t.boxDest.y = %u\n", (*cmd).boxDest.y); + debug_printf("\t\t.boxDest.z = %u\n", (*cmd).boxDest.z); + debug_printf("\t\t.boxDest.w = %u\n", (*cmd).boxDest.w); + debug_printf("\t\t.boxDest.h = %u\n", (*cmd).boxDest.h); + debug_printf("\t\t.boxDest.d = %u\n", (*cmd).boxDest.d); + switch((*cmd).mode) { + case SVGA3D_STRETCH_BLT_POINT: + debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_POINT\n"); + break; + case SVGA3D_STRETCH_BLT_LINEAR: + debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_LINEAR\n"); + break; + case SVGA3D_STRETCH_BLT_MAX: + debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_MAX\n"); + break; + default: + debug_printf("\t\t.mode = %i\n", (*cmd).mode); + break; + } +} + +static void +dump_SVGA3dCmdSurfaceDMA(const SVGA3dCmdSurfaceDMA *cmd) +{ + debug_printf("\t\t.guest.ptr.gmrId = %u\n", (*cmd).guest.ptr.gmrId); + debug_printf("\t\t.guest.ptr.offset = %u\n", (*cmd).guest.ptr.offset); + debug_printf("\t\t.guest.pitch = %u\n", (*cmd).guest.pitch); + debug_printf("\t\t.host.sid = %u\n", (*cmd).host.sid); + debug_printf("\t\t.host.face = %u\n", (*cmd).host.face); + debug_printf("\t\t.host.mipmap = %u\n", (*cmd).host.mipmap); + switch((*cmd).transfer) { + case SVGA3D_WRITE_HOST_VRAM: + debug_printf("\t\t.transfer = SVGA3D_WRITE_HOST_VRAM\n"); + break; + case SVGA3D_READ_HOST_VRAM: + debug_printf("\t\t.transfer = SVGA3D_READ_HOST_VRAM\n"); + break; + default: + debug_printf("\t\t.transfer = %i\n", (*cmd).transfer); + break; + } +} + +static void +dump_SVGA3dCmdSurfaceDMASuffix(const SVGA3dCmdSurfaceDMASuffix *cmd) +{ + debug_printf("\t\t.suffixSize = %u\n", (*cmd).suffixSize); + debug_printf("\t\t.maximumOffset = %u\n", (*cmd).maximumOffset); + debug_printf("\t\t.flags.discard = %u\n", (*cmd).flags.discard); + debug_printf("\t\t.flags.unsynchronized = %u\n", (*cmd).flags.unsynchronized); +} + +static void +dump_SVGA3dCmdSetTransform(const SVGA3dCmdSetTransform *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); + switch((*cmd).type) { + case SVGA3D_TRANSFORM_INVALID: + debug_printf("\t\t.type = SVGA3D_TRANSFORM_INVALID\n"); + break; + case SVGA3D_TRANSFORM_WORLD: + debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD\n"); + break; + case SVGA3D_TRANSFORM_VIEW: + debug_printf("\t\t.type = SVGA3D_TRANSFORM_VIEW\n"); + break; + case SVGA3D_TRANSFORM_PROJECTION: + debug_printf("\t\t.type = SVGA3D_TRANSFORM_PROJECTION\n"); + break; + case SVGA3D_TRANSFORM_TEXTURE0: + debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE0\n"); + break; + case SVGA3D_TRANSFORM_TEXTURE1: + debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE1\n"); + break; + case SVGA3D_TRANSFORM_TEXTURE2: + debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE2\n"); + break; + case SVGA3D_TRANSFORM_TEXTURE3: + debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE3\n"); + break; + case SVGA3D_TRANSFORM_TEXTURE4: + debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE4\n"); + break; + case SVGA3D_TRANSFORM_TEXTURE5: + debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE5\n"); + break; + case SVGA3D_TRANSFORM_TEXTURE6: + debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE6\n"); + break; + case SVGA3D_TRANSFORM_TEXTURE7: + debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE7\n"); + break; + case SVGA3D_TRANSFORM_WORLD1: + debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD1\n"); + break; + case SVGA3D_TRANSFORM_WORLD2: + debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD2\n"); + break; + case SVGA3D_TRANSFORM_WORLD3: + debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD3\n"); + break; + case SVGA3D_TRANSFORM_MAX: + debug_printf("\t\t.type = SVGA3D_TRANSFORM_MAX\n"); + break; + default: + debug_printf("\t\t.type = %i\n", (*cmd).type); + break; + } + debug_printf("\t\t.matrix[0] = %f\n", (*cmd).matrix[0]); + debug_printf("\t\t.matrix[1] = %f\n", (*cmd).matrix[1]); + debug_printf("\t\t.matrix[2] = %f\n", (*cmd).matrix[2]); + debug_printf("\t\t.matrix[3] = %f\n", (*cmd).matrix[3]); + debug_printf("\t\t.matrix[4] = %f\n", (*cmd).matrix[4]); + debug_printf("\t\t.matrix[5] = %f\n", (*cmd).matrix[5]); + debug_printf("\t\t.matrix[6] = %f\n", (*cmd).matrix[6]); + debug_printf("\t\t.matrix[7] = %f\n", (*cmd).matrix[7]); + debug_printf("\t\t.matrix[8] = %f\n", (*cmd).matrix[8]); + debug_printf("\t\t.matrix[9] = %f\n", (*cmd).matrix[9]); + debug_printf("\t\t.matrix[10] = %f\n", (*cmd).matrix[10]); + debug_printf("\t\t.matrix[11] = %f\n", (*cmd).matrix[11]); + debug_printf("\t\t.matrix[12] = %f\n", (*cmd).matrix[12]); + debug_printf("\t\t.matrix[13] = %f\n", (*cmd).matrix[13]); + debug_printf("\t\t.matrix[14] = %f\n", (*cmd).matrix[14]); + debug_printf("\t\t.matrix[15] = %f\n", (*cmd).matrix[15]); +} + +static void +dump_SVGA3dCmdDestroyShader(const SVGA3dCmdDestroyShader *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); + debug_printf("\t\t.shid = %u\n", (*cmd).shid); + switch((*cmd).type) { + case SVGA3D_SHADERTYPE_COMPILED_DX8: + debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n"); + break; + case SVGA3D_SHADERTYPE_VS: + debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n"); + break; + case SVGA3D_SHADERTYPE_PS: + debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n"); + break; + case SVGA3D_SHADERTYPE_MAX: + debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n"); + break; + default: + debug_printf("\t\t.type = %i\n", (*cmd).type); + break; + } +} + +static void +dump_SVGA3dCmdDestroyContext(const SVGA3dCmdDestroyContext *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); +} + +static void +dump_SVGA3dCmdClear(const SVGA3dCmdClear *cmd) +{ + debug_printf("\t\t.cid = %u\n", (*cmd).cid); + switch((*cmd).clearFlag) { + case SVGA3D_CLEAR_COLOR: + debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_COLOR\n"); + break; + case SVGA3D_CLEAR_DEPTH: + debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_DEPTH\n"); + break; + case SVGA3D_CLEAR_STENCIL: + debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_STENCIL\n"); + break; + default: + debug_printf("\t\t.clearFlag = %i\n", (*cmd).clearFlag); + break; + } + debug_printf("\t\t.color = %u\n", (*cmd).color); + debug_printf("\t\t.depth = %f\n", (*cmd).depth); + debug_printf("\t\t.stencil = %u\n", (*cmd).stencil); +} + +static void +dump_SVGA3dCmdDefineSurface(const SVGA3dCmdDefineSurface *cmd) +{ + debug_printf("\t\t.sid = %u\n", (*cmd).sid); + switch((*cmd).surfaceFlags) { + case SVGA3D_SURFACE_CUBEMAP: + debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_CUBEMAP\n"); + break; + case SVGA3D_SURFACE_HINT_STATIC: + debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_STATIC\n"); + break; + case SVGA3D_SURFACE_HINT_DYNAMIC: + debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_DYNAMIC\n"); + break; + case SVGA3D_SURFACE_HINT_INDEXBUFFER: + debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_INDEXBUFFER\n"); + break; + case SVGA3D_SURFACE_HINT_VERTEXBUFFER: + debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_VERTEXBUFFER\n"); + break; + default: + debug_printf("\t\t.surfaceFlags = %i\n", (*cmd).surfaceFlags); + break; + } + switch((*cmd).format) { + case SVGA3D_FORMAT_INVALID: + debug_printf("\t\t.format = SVGA3D_FORMAT_INVALID\n"); + break; + case SVGA3D_X8R8G8B8: + debug_printf("\t\t.format = SVGA3D_X8R8G8B8\n"); + break; + case SVGA3D_A8R8G8B8: + debug_printf("\t\t.format = SVGA3D_A8R8G8B8\n"); + break; + case SVGA3D_R5G6B5: + debug_printf("\t\t.format = SVGA3D_R5G6B5\n"); + break; + case SVGA3D_X1R5G5B5: + debug_printf("\t\t.format = SVGA3D_X1R5G5B5\n"); + break; + case SVGA3D_A1R5G5B5: + debug_printf("\t\t.format = SVGA3D_A1R5G5B5\n"); + break; + case SVGA3D_A4R4G4B4: + debug_printf("\t\t.format = SVGA3D_A4R4G4B4\n"); + break; + case SVGA3D_Z_D32: + debug_printf("\t\t.format = SVGA3D_Z_D32\n"); + break; + case SVGA3D_Z_D16: + debug_printf("\t\t.format = SVGA3D_Z_D16\n"); + break; + case SVGA3D_Z_D24S8: + debug_printf("\t\t.format = SVGA3D_Z_D24S8\n"); + break; + case SVGA3D_Z_D15S1: + debug_printf("\t\t.format = SVGA3D_Z_D15S1\n"); + break; + case SVGA3D_LUMINANCE8: + debug_printf("\t\t.format = SVGA3D_LUMINANCE8\n"); + break; + case SVGA3D_LUMINANCE4_ALPHA4: + debug_printf("\t\t.format = SVGA3D_LUMINANCE4_ALPHA4\n"); + break; + case SVGA3D_LUMINANCE16: + debug_printf("\t\t.format = SVGA3D_LUMINANCE16\n"); + break; + case SVGA3D_LUMINANCE8_ALPHA8: + debug_printf("\t\t.format = SVGA3D_LUMINANCE8_ALPHA8\n"); + break; + case SVGA3D_DXT1: + debug_printf("\t\t.format = SVGA3D_DXT1\n"); + break; + case SVGA3D_DXT2: + debug_printf("\t\t.format = SVGA3D_DXT2\n"); + break; + case SVGA3D_DXT3: + debug_printf("\t\t.format = SVGA3D_DXT3\n"); + break; + case SVGA3D_DXT4: + debug_printf("\t\t.format = SVGA3D_DXT4\n"); + break; + case SVGA3D_DXT5: + debug_printf("\t\t.format = SVGA3D_DXT5\n"); + break; + case SVGA3D_BUMPU8V8: + debug_printf("\t\t.format = SVGA3D_BUMPU8V8\n"); + break; + case SVGA3D_BUMPL6V5U5: + debug_printf("\t\t.format = SVGA3D_BUMPL6V5U5\n"); + break; + case SVGA3D_BUMPX8L8V8U8: + debug_printf("\t\t.format = SVGA3D_BUMPX8L8V8U8\n"); + break; + case SVGA3D_BUMPL8V8U8: + debug_printf("\t\t.format = SVGA3D_BUMPL8V8U8\n"); + break; + case SVGA3D_ARGB_S10E5: + debug_printf("\t\t.format = SVGA3D_ARGB_S10E5\n"); + break; + case SVGA3D_ARGB_S23E8: + debug_printf("\t\t.format = SVGA3D_ARGB_S23E8\n"); + break; + case SVGA3D_A2R10G10B10: + debug_printf("\t\t.format = SVGA3D_A2R10G10B10\n"); + break; + case SVGA3D_V8U8: + debug_printf("\t\t.format = SVGA3D_V8U8\n"); + break; + case SVGA3D_Q8W8V8U8: + debug_printf("\t\t.format = SVGA3D_Q8W8V8U8\n"); + break; + case SVGA3D_CxV8U8: + debug_printf("\t\t.format = SVGA3D_CxV8U8\n"); + break; + case SVGA3D_X8L8V8U8: + debug_printf("\t\t.format = SVGA3D_X8L8V8U8\n"); + break; + case SVGA3D_A2W10V10U10: + debug_printf("\t\t.format = SVGA3D_A2W10V10U10\n"); + break; + case SVGA3D_ALPHA8: + debug_printf("\t\t.format = SVGA3D_ALPHA8\n"); + break; + case SVGA3D_R_S10E5: + debug_printf("\t\t.format = SVGA3D_R_S10E5\n"); + break; + case SVGA3D_R_S23E8: + debug_printf("\t\t.format = SVGA3D_R_S23E8\n"); + break; + case SVGA3D_RG_S10E5: + debug_printf("\t\t.format = SVGA3D_RG_S10E5\n"); + break; + case SVGA3D_RG_S23E8: + debug_printf("\t\t.format = SVGA3D_RG_S23E8\n"); + break; + case SVGA3D_BUFFER: + debug_printf("\t\t.format = SVGA3D_BUFFER\n"); + break; + case SVGA3D_Z_D24X8: + debug_printf("\t\t.format = SVGA3D_Z_D24X8\n"); + break; + case SVGA3D_FORMAT_MAX: + debug_printf("\t\t.format = SVGA3D_FORMAT_MAX\n"); + break; + default: + debug_printf("\t\t.format = %i\n", (*cmd).format); + break; + } + debug_printf("\t\t.face[0].numMipLevels = %u\n", (*cmd).face[0].numMipLevels); + debug_printf("\t\t.face[1].numMipLevels = %u\n", (*cmd).face[1].numMipLevels); + debug_printf("\t\t.face[2].numMipLevels = %u\n", (*cmd).face[2].numMipLevels); + debug_printf("\t\t.face[3].numMipLevels = %u\n", (*cmd).face[3].numMipLevels); + debug_printf("\t\t.face[4].numMipLevels = %u\n", (*cmd).face[4].numMipLevels); + debug_printf("\t\t.face[5].numMipLevels = %u\n", (*cmd).face[5].numMipLevels); +} + + +void +svga_dump_commands(const void *commands, uint32_t size) +{ + const uint8_t *next = commands; + const uint8_t *last = next + size; + + assert(size % sizeof(uint32_t) == 0); + + while(next < last) { + const uint32_t cmd_id = *(const uint32_t *)next; + + if(SVGA_3D_CMD_BASE <= cmd_id && cmd_id < SVGA_3D_CMD_MAX) { + const SVGA3dCmdHeader *header = (const SVGA3dCmdHeader *)next; + const uint8_t *body = (const uint8_t *)&header[1]; + + next = (const uint8_t *)body + header->size; + if(next > last) + break; + + switch(cmd_id) { + case SVGA_3D_CMD_SURFACE_DEFINE: + debug_printf("\tSVGA_3D_CMD_SURFACE_DEFINE\n"); + { + const SVGA3dCmdDefineSurface *cmd = (const SVGA3dCmdDefineSurface *)body; + dump_SVGA3dCmdDefineSurface(cmd); + body = (const uint8_t *)&cmd[1]; + while(body + sizeof(SVGA3dSize) <= next) { + dump_SVGA3dSize((const SVGA3dSize *)body); + body += sizeof(SVGA3dSize); + } + } + break; + case SVGA_3D_CMD_SURFACE_DESTROY: + debug_printf("\tSVGA_3D_CMD_SURFACE_DESTROY\n"); + { + const SVGA3dCmdDestroySurface *cmd = (const SVGA3dCmdDestroySurface *)body; + dump_SVGA3dCmdDestroySurface(cmd); + body = (const uint8_t *)&cmd[1]; + } + break; + case SVGA_3D_CMD_SURFACE_COPY: + debug_printf("\tSVGA_3D_CMD_SURFACE_COPY\n"); + { + const SVGA3dCmdSurfaceCopy *cmd = (const SVGA3dCmdSurfaceCopy *)body; + dump_SVGA3dCmdSurfaceCopy(cmd); + body = (const uint8_t *)&cmd[1]; + while(body + sizeof(SVGA3dCopyBox) <= next) { + dump_SVGA3dCopyBox((const SVGA3dCopyBox *)body); + body += sizeof(SVGA3dCopyBox); + } + } + break; + case SVGA_3D_CMD_SURFACE_STRETCHBLT: + debug_printf("\tSVGA_3D_CMD_SURFACE_STRETCHBLT\n"); + { + const SVGA3dCmdSurfaceStretchBlt *cmd = (const SVGA3dCmdSurfaceStretchBlt *)body; + dump_SVGA3dCmdSurfaceStretchBlt(cmd); + body = (const uint8_t *)&cmd[1]; + } + break; + case SVGA_3D_CMD_SURFACE_DMA: + debug_printf("\tSVGA_3D_CMD_SURFACE_DMA\n"); + { + const SVGA3dCmdSurfaceDMA *cmd = (const SVGA3dCmdSurfaceDMA *)body; + dump_SVGA3dCmdSurfaceDMA(cmd); + body = (const uint8_t *)&cmd[1]; + while(body + sizeof(SVGA3dCopyBox) <= next) { + dump_SVGA3dCopyBox((const SVGA3dCopyBox *)body); + body += sizeof(SVGA3dCopyBox); + } + while(body + sizeof(SVGA3dCmdSurfaceDMASuffix) <= next) { + dump_SVGA3dCmdSurfaceDMASuffix((const SVGA3dCmdSurfaceDMASuffix *)body); + body += sizeof(SVGA3dCmdSurfaceDMASuffix); + } + } + break; + case SVGA_3D_CMD_CONTEXT_DEFINE: + debug_printf("\tSVGA_3D_CMD_CONTEXT_DEFINE\n"); + { + const SVGA3dCmdDefineContext *cmd = (const SVGA3dCmdDefineContext *)body; + dump_SVGA3dCmdDefineContext(cmd); + body = (const uint8_t *)&cmd[1]; + } + break; + case SVGA_3D_CMD_CONTEXT_DESTROY: + debug_printf("\tSVGA_3D_CMD_CONTEXT_DESTROY\n"); + { + const SVGA3dCmdDestroyContext *cmd = (const SVGA3dCmdDestroyContext *)body; + dump_SVGA3dCmdDestroyContext(cmd); + body = (const uint8_t *)&cmd[1]; + } + break; + case SVGA_3D_CMD_SETTRANSFORM: + debug_printf("\tSVGA_3D_CMD_SETTRANSFORM\n"); + { + const SVGA3dCmdSetTransform *cmd = (const SVGA3dCmdSetTransform *)body; + dump_SVGA3dCmdSetTransform(cmd); + body = (const uint8_t *)&cmd[1]; + } + break; + case SVGA_3D_CMD_SETZRANGE: + debug_printf("\tSVGA_3D_CMD_SETZRANGE\n"); + { + const SVGA3dCmdSetZRange *cmd = (const SVGA3dCmdSetZRange *)body; + dump_SVGA3dCmdSetZRange(cmd); + body = (const uint8_t *)&cmd[1]; + } + break; + case SVGA_3D_CMD_SETRENDERSTATE: + debug_printf("\tSVGA_3D_CMD_SETRENDERSTATE\n"); + { + const SVGA3dCmdSetRenderState *cmd = (const SVGA3dCmdSetRenderState *)body; + dump_SVGA3dCmdSetRenderState(cmd); + body = (const uint8_t *)&cmd[1]; + while(body + sizeof(SVGA3dRenderState) <= next) { + dump_SVGA3dRenderState((const SVGA3dRenderState *)body); + body += sizeof(SVGA3dRenderState); + } + } + break; + case SVGA_3D_CMD_SETRENDERTARGET: + debug_printf("\tSVGA_3D_CMD_SETRENDERTARGET\n"); + { + const SVGA3dCmdSetRenderTarget *cmd = (const SVGA3dCmdSetRenderTarget *)body; + dump_SVGA3dCmdSetRenderTarget(cmd); + body = (const uint8_t *)&cmd[1]; + } + break; + case SVGA_3D_CMD_SETTEXTURESTATE: + debug_printf("\tSVGA_3D_CMD_SETTEXTURESTATE\n"); + { + const SVGA3dCmdSetTextureState *cmd = (const SVGA3dCmdSetTextureState *)body; + dump_SVGA3dCmdSetTextureState(cmd); + body = (const uint8_t *)&cmd[1]; + while(body + sizeof(SVGA3dTextureState) <= next) { + dump_SVGA3dTextureState((const SVGA3dTextureState *)body); + body += sizeof(SVGA3dTextureState); + } + } + break; + case SVGA_3D_CMD_SETMATERIAL: + debug_printf("\tSVGA_3D_CMD_SETMATERIAL\n"); + { + const SVGA3dCmdSetMaterial *cmd = (const SVGA3dCmdSetMaterial *)body; + dump_SVGA3dCmdSetMaterial(cmd); + body = (const uint8_t *)&cmd[1]; + } + break; + case SVGA_3D_CMD_SETLIGHTDATA: + debug_printf("\tSVGA_3D_CMD_SETLIGHTDATA\n"); + { + const SVGA3dCmdSetLightData *cmd = (const SVGA3dCmdSetLightData *)body; + dump_SVGA3dCmdSetLightData(cmd); + body = (const uint8_t *)&cmd[1]; + } + break; + case SVGA_3D_CMD_SETLIGHTENABLED: + debug_printf("\tSVGA_3D_CMD_SETLIGHTENABLED\n"); + { + const SVGA3dCmdSetLightEnabled *cmd = (const SVGA3dCmdSetLightEnabled *)body; + dump_SVGA3dCmdSetLightEnabled(cmd); + body = (const uint8_t *)&cmd[1]; + } + break; + case SVGA_3D_CMD_SETVIEWPORT: + debug_printf("\tSVGA_3D_CMD_SETVIEWPORT\n"); + { + const SVGA3dCmdSetViewport *cmd = (const SVGA3dCmdSetViewport *)body; + dump_SVGA3dCmdSetViewport(cmd); + body = (const uint8_t *)&cmd[1]; + } + break; + case SVGA_3D_CMD_SETCLIPPLANE: + debug_printf("\tSVGA_3D_CMD_SETCLIPPLANE\n"); + { + const SVGA3dCmdSetClipPlane *cmd = (const SVGA3dCmdSetClipPlane *)body; + dump_SVGA3dCmdSetClipPlane(cmd); + body = (const uint8_t *)&cmd[1]; + } + break; + case SVGA_3D_CMD_CLEAR: + debug_printf("\tSVGA_3D_CMD_CLEAR\n"); + { + const SVGA3dCmdClear *cmd = (const SVGA3dCmdClear *)body; + dump_SVGA3dCmdClear(cmd); + body = (const uint8_t *)&cmd[1]; + while(body + sizeof(SVGA3dRect) <= next) { + dump_SVGA3dRect((const SVGA3dRect *)body); + body += sizeof(SVGA3dRect); + } + } + break; + case SVGA_3D_CMD_PRESENT: + debug_printf("\tSVGA_3D_CMD_PRESENT\n"); + { + const SVGA3dCmdPresent *cmd = (const SVGA3dCmdPresent *)body; + dump_SVGA3dCmdPresent(cmd); + body = (const uint8_t *)&cmd[1]; + while(body + sizeof(SVGA3dCopyRect) <= next) { + dump_SVGA3dCopyRect((const SVGA3dCopyRect *)body); + body += sizeof(SVGA3dCopyRect); + } + } + break; + case SVGA_3D_CMD_SHADER_DEFINE: + debug_printf("\tSVGA_3D_CMD_SHADER_DEFINE\n"); + { + const SVGA3dCmdDefineShader *cmd = (const SVGA3dCmdDefineShader *)body; + dump_SVGA3dCmdDefineShader(cmd); + body = (const uint8_t *)&cmd[1]; + sh_svga_dump((const uint32_t *)body, + (unsigned)(next - body)/sizeof(uint32_t), + FALSE ); + body = next; + } + break; + case SVGA_3D_CMD_SHADER_DESTROY: + debug_printf("\tSVGA_3D_CMD_SHADER_DESTROY\n"); + { + const SVGA3dCmdDestroyShader *cmd = (const SVGA3dCmdDestroyShader *)body; + dump_SVGA3dCmdDestroyShader(cmd); + body = (const uint8_t *)&cmd[1]; + } + break; + case SVGA_3D_CMD_SET_SHADER: + debug_printf("\tSVGA_3D_CMD_SET_SHADER\n"); + { + const SVGA3dCmdSetShader *cmd = (const SVGA3dCmdSetShader *)body; + dump_SVGA3dCmdSetShader(cmd); + body = (const uint8_t *)&cmd[1]; + } + break; + case SVGA_3D_CMD_SET_SHADER_CONST: + debug_printf("\tSVGA_3D_CMD_SET_SHADER_CONST\n"); + { + const SVGA3dCmdSetShaderConst *cmd = (const SVGA3dCmdSetShaderConst *)body; + dump_SVGA3dCmdSetShaderConst(cmd); + body = (const uint8_t *)&cmd[1]; + } + break; + case SVGA_3D_CMD_DRAW_PRIMITIVES: + debug_printf("\tSVGA_3D_CMD_DRAW_PRIMITIVES\n"); + { + const SVGA3dCmdDrawPrimitives *cmd = (const SVGA3dCmdDrawPrimitives *)body; + unsigned i, j; + dump_SVGA3dCmdDrawPrimitives(cmd); + body = (const uint8_t *)&cmd[1]; + for(i = 0; i < cmd->numVertexDecls; ++i) { + dump_SVGA3dVertexDecl((const SVGA3dVertexDecl *)body); + body += sizeof(SVGA3dVertexDecl); + } + for(j = 0; j < cmd->numRanges; ++j) { + dump_SVGA3dPrimitiveRange((const SVGA3dPrimitiveRange *)body); + body += sizeof(SVGA3dPrimitiveRange); + } + while(body + sizeof(SVGA3dVertexDivisor) <= next) { + dump_SVGA3dVertexDivisor((const SVGA3dVertexDivisor *)body); + body += sizeof(SVGA3dVertexDivisor); + } + } + break; + case SVGA_3D_CMD_SETSCISSORRECT: + debug_printf("\tSVGA_3D_CMD_SETSCISSORRECT\n"); + { + const SVGA3dCmdSetScissorRect *cmd = (const SVGA3dCmdSetScissorRect *)body; + dump_SVGA3dCmdSetScissorRect(cmd); + body = (const uint8_t *)&cmd[1]; + } + break; + case SVGA_3D_CMD_BEGIN_QUERY: + debug_printf("\tSVGA_3D_CMD_BEGIN_QUERY\n"); + { + const SVGA3dCmdBeginQuery *cmd = (const SVGA3dCmdBeginQuery *)body; + dump_SVGA3dCmdBeginQuery(cmd); + body = (const uint8_t *)&cmd[1]; + } + break; + case SVGA_3D_CMD_END_QUERY: + debug_printf("\tSVGA_3D_CMD_END_QUERY\n"); + { + const SVGA3dCmdEndQuery *cmd = (const SVGA3dCmdEndQuery *)body; + dump_SVGA3dCmdEndQuery(cmd); + body = (const uint8_t *)&cmd[1]; + } + break; + case SVGA_3D_CMD_WAIT_FOR_QUERY: + debug_printf("\tSVGA_3D_CMD_WAIT_FOR_QUERY\n"); + { + const SVGA3dCmdWaitForQuery *cmd = (const SVGA3dCmdWaitForQuery *)body; + dump_SVGA3dCmdWaitForQuery(cmd); + body = (const uint8_t *)&cmd[1]; + } + break; + default: + debug_printf("\t0x%08x\n", cmd_id); + break; + } + + while(body + sizeof(uint32_t) <= next) { + debug_printf("\t\t0x%08x\n", *(const uint32_t *)body); + body += sizeof(uint32_t); + } + while(body + sizeof(uint32_t) <= next) + debug_printf("\t\t0x%02x\n", *body++); + } + else if(cmd_id == SVGA_CMD_FENCE) { + debug_printf("\tSVGA_CMD_FENCE\n"); + debug_printf("\t\t0x%08x\n", ((const uint32_t *)next)[1]); + next += 2*sizeof(uint32_t); + } + else { + debug_printf("\t0x%08x\n", cmd_id); + next += sizeof(uint32_t); + } + } +} + diff --git a/src/gallium/drivers/svga/svgadump/svga_dump.h b/src/gallium/drivers/svga/svgadump/svga_dump.h new file mode 100644 index 0000000000..69a8702087 --- /dev/null +++ b/src/gallium/drivers/svga/svgadump/svga_dump.h @@ -0,0 +1,34 @@ +/********************************************************** + * 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, 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. + * + **********************************************************/ + +#ifndef SVGA_DUMP_H_ +#define SVGA_DUMP_H_ + +#include "pipe/p_compiler.h" + +void +svga_dump_commands(const void *commands, uint32_t size); + +#endif /* SVGA_DUMP_H_ */ diff --git a/src/gallium/drivers/svga/svgadump/svga_dump.py b/src/gallium/drivers/svga/svgadump/svga_dump.py new file mode 100755 index 0000000000..3cb29c395b --- /dev/null +++ b/src/gallium/drivers/svga/svgadump/svga_dump.py @@ -0,0 +1,329 @@ +#!/usr/bin/env python +''' +Generates dumper for the SVGA 3D command stream using pygccxml. + +Jose Fonseca +''' + +copyright = ''' +/********************************************************** + * 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, 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 +import sys + +from pygccxml import parser +from pygccxml import declarations + +from pygccxml.declarations import algorithm +from pygccxml.declarations import decl_visitor +from pygccxml.declarations import type_traits +from pygccxml.declarations import type_visitor + + +enums = True + + +class decl_dumper_t(decl_visitor.decl_visitor_t): + + def __init__(self, instance = '', decl = None): + decl_visitor.decl_visitor_t.__init__(self) + self._instance = instance + self.decl = decl + + def clone(self): + return decl_dumper_t(self._instance, self.decl) + + def visit_class(self): + class_ = self.decl + assert self.decl.class_type in ('struct', 'union') + + for variable in class_.variables(): + if variable.name != '': + #print 'variable = %r' % variable.name + dump_type(self._instance + '.' + variable.name, variable.type) + + def visit_enumeration(self): + if enums: + print ' switch(%s) {' % ("(*cmd)" + self._instance,) + for name, value in self.decl.values: + print ' case %s:' % (name,) + print ' debug_printf("\\t\\t%s = %s\\n");' % (self._instance, name) + print ' break;' + print ' default:' + print ' debug_printf("\\t\\t%s = %%i\\n", %s);' % (self._instance, "(*cmd)" + self._instance) + print ' break;' + print ' }' + else: + print ' debug_printf("\\t\\t%s = %%i\\n", %s);' % (self._instance, "(*cmd)" + self._instance) + + +def dump_decl(instance, decl): + dumper = decl_dumper_t(instance, decl) + algorithm.apply_visitor(dumper, decl) + + +class type_dumper_t(type_visitor.type_visitor_t): + + def __init__(self, instance, type_): + type_visitor.type_visitor_t.__init__(self) + self.instance = instance + self.type = type_ + + def clone(self): + return type_dumper_t(self.instance, self.type) + + def visit_char(self): + self.print_instance('%i') + + def visit_unsigned_char(self): + self.print_instance('%u') + + def visit_signed_char(self): + self.print_instance('%i') + + def visit_wchar(self): + self.print_instance('%i') + + def visit_short_int(self): + self.print_instance('%i') + + def visit_short_unsigned_int(self): + self.print_instance('%u') + + def visit_bool(self): + self.print_instance('%i') + + def visit_int(self): + self.print_instance('%i') + + def visit_unsigned_int(self): + self.print_instance('%u') + + def visit_long_int(self): + self.print_instance('%li') + + def visit_long_unsigned_int(self): + self.print_instance('%lu') + + def visit_long_long_int(self): + self.print_instance('%lli') + + def visit_long_long_unsigned_int(self): + self.print_instance('%llu') + + def visit_float(self): + self.print_instance('%f') + + def visit_double(self): + self.print_instance('%f') + + def visit_array(self): + for i in range(type_traits.array_size(self.type)): + dump_type(self.instance + '[%i]' % i, type_traits.base_type(self.type)) + + def visit_pointer(self): + self.print_instance('%p') + + def visit_declarated(self): + #print 'decl = %r' % self.type.decl_string + decl = type_traits.remove_declarated(self.type) + dump_decl(self.instance, decl) + + def print_instance(self, format): + print ' debug_printf("\\t\\t%s = %s\\n", %s);' % (self.instance, format, "(*cmd)" + self.instance) + + +def dump_type(instance, type_): + type_ = type_traits.remove_alias(type_) + visitor = type_dumper_t(instance, type_) + algorithm.apply_visitor(visitor, type_) + + +def dump_struct(decls, class_): + print 'static void' + print 'dump_%s(const %s *cmd)' % (class_.name, class_.name) + print '{' + dump_decl('', class_) + print '}' + print '' + + +cmds = [ + ('SVGA_3D_CMD_SURFACE_DEFINE', 'SVGA3dCmdDefineSurface', (), 'SVGA3dSize'), + ('SVGA_3D_CMD_SURFACE_DESTROY', 'SVGA3dCmdDestroySurface', (), None), + ('SVGA_3D_CMD_SURFACE_COPY', 'SVGA3dCmdSurfaceCopy', (), 'SVGA3dCopyBox'), + ('SVGA_3D_CMD_SURFACE_STRETCHBLT', 'SVGA3dCmdSurfaceStretchBlt', (), None), + ('SVGA_3D_CMD_SURFACE_DMA', 'SVGA3dCmdSurfaceDMA', (), 'SVGA3dCopyBox'), + ('SVGA_3D_CMD_CONTEXT_DEFINE', 'SVGA3dCmdDefineContext', (), None), + ('SVGA_3D_CMD_CONTEXT_DESTROY', 'SVGA3dCmdDestroyContext', (), None), + ('SVGA_3D_CMD_SETTRANSFORM', 'SVGA3dCmdSetTransform', (), None), + ('SVGA_3D_CMD_SETZRANGE', 'SVGA3dCmdSetZRange', (), None), + ('SVGA_3D_CMD_SETRENDERSTATE', 'SVGA3dCmdSetRenderState', (), 'SVGA3dRenderState'), + ('SVGA_3D_CMD_SETRENDERTARGET', 'SVGA3dCmdSetRenderTarget', (), None), + ('SVGA_3D_CMD_SETTEXTURESTATE', 'SVGA3dCmdSetTextureState', (), 'SVGA3dTextureState'), + ('SVGA_3D_CMD_SETMATERIAL', 'SVGA3dCmdSetMaterial', (), None), + ('SVGA_3D_CMD_SETLIGHTDATA', 'SVGA3dCmdSetLightData', (), None), + ('SVGA_3D_CMD_SETLIGHTENABLED', 'SVGA3dCmdSetLightEnabled', (), None), + ('SVGA_3D_CMD_SETVIEWPORT', 'SVGA3dCmdSetViewport', (), None), + ('SVGA_3D_CMD_SETCLIPPLANE', 'SVGA3dCmdSetClipPlane', (), None), + ('SVGA_3D_CMD_CLEAR', 'SVGA3dCmdClear', (), 'SVGA3dRect'), + ('SVGA_3D_CMD_PRESENT', 'SVGA3dCmdPresent', (), 'SVGA3dCopyRect'), + ('SVGA_3D_CMD_SHADER_DEFINE', 'SVGA3dCmdDefineShader', (), None), + ('SVGA_3D_CMD_SHADER_DESTROY', 'SVGA3dCmdDestroyShader', (), None), + ('SVGA_3D_CMD_SET_SHADER', 'SVGA3dCmdSetShader', (), None), + ('SVGA_3D_CMD_SET_SHADER_CONST', 'SVGA3dCmdSetShaderConst', (), None), + ('SVGA_3D_CMD_DRAW_PRIMITIVES', 'SVGA3dCmdDrawPrimitives', (('SVGA3dVertexDecl', 'numVertexDecls'), ('SVGA3dPrimitiveRange', 'numRanges')), 'SVGA3dVertexDivisor'), + ('SVGA_3D_CMD_SETSCISSORRECT', 'SVGA3dCmdSetScissorRect', (), None), + ('SVGA_3D_CMD_BEGIN_QUERY', 'SVGA3dCmdBeginQuery', (), None), + ('SVGA_3D_CMD_END_QUERY', 'SVGA3dCmdEndQuery', (), None), + ('SVGA_3D_CMD_WAIT_FOR_QUERY', 'SVGA3dCmdWaitForQuery', (), None), + #('SVGA_3D_CMD_PRESENT_READBACK', None, (), None), +] + +def dump_cmds(): + print r''' +void +svga_dump_commands(const void *commands, uint32_t size) +{ + const uint8_t *next = commands; + const uint8_t *last = next + size; + + assert(size % sizeof(uint32_t) == 0); + + while(next < last) { + const uint32_t cmd_id = *(const uint32_t *)next; + + if(SVGA_3D_CMD_BASE <= cmd_id && cmd_id < SVGA_3D_CMD_MAX) { + const SVGA3dCmdHeader *header = (const SVGA3dCmdHeader *)next; + const uint8_t *body = (const uint8_t *)&header[1]; + + next = (const uint8_t *)body + header->size; + if(next > last) + break; +''' + + print ' switch(cmd_id) {' + indexes = 'ijklmn' + for id, header, body, footer in cmds: + print ' case %s:' % id + print ' debug_printf("\\t%s\\n");' % id + print ' {' + print ' const %s *cmd = (const %s *)body;' % (header, header) + if len(body): + print ' unsigned ' + ', '.join(indexes[:len(body)]) + ';' + print ' dump_%s(cmd);' % header + print ' body = (const uint8_t *)&cmd[1];' + for i in range(len(body)): + struct, count = body[i] + idx = indexes[i] + print ' for(%s = 0; %s < cmd->%s; ++%s) {' % (idx, idx, count, idx) + print ' dump_%s((const %s *)body);' % (struct, struct) + print ' body += sizeof(%s);' % struct + print ' }' + if footer is not None: + print ' while(body + sizeof(%s) <= next) {' % footer + print ' dump_%s((const %s *)body);' % (footer, footer) + print ' body += sizeof(%s);' % footer + print ' }' + if id == 'SVGA_3D_CMD_SHADER_DEFINE': + print ' sh_svga_dump((const uint32_t *)body, (unsigned)(next - body)/sizeof(uint32_t));' + print ' body = next;' + print ' }' + print ' break;' + print ' default:' + print ' debug_printf("\\t0x%08x\\n", cmd_id);' + print ' break;' + print ' }' + + print r''' + while(body + sizeof(uint32_t) <= next) { + debug_printf("\t\t0x%08x\n", *(const uint32_t *)body); + body += sizeof(uint32_t); + } + while(body + sizeof(uint32_t) <= next) + debug_printf("\t\t0x%02x\n", *body++); + } + else if(cmd_id == SVGA_CMD_FENCE) { + debug_printf("\tSVGA_CMD_FENCE\n"); + debug_printf("\t\t0x%08x\n", ((const uint32_t *)next)[1]); + next += 2*sizeof(uint32_t); + } + else { + debug_printf("\t0x%08x\n", cmd_id); + next += sizeof(uint32_t); + } + } +} +''' + +def main(): + print copyright.strip() + print + print '/**' + print ' * @file' + print ' * Dump SVGA commands.' + print ' *' + print ' * Generated automatically from svga3d_reg.h by svga_dump.py.' + print ' */' + print + print '#include "svga_types.h"' + print '#include "shader_dump/st_shader_dump.h"' + print '#include "svga3d_reg.h"' + print + print '#include "pipe/p_debug.h"' + print '#include "svga_dump.h"' + print + + config = parser.config_t( + include_paths = ['include'], + compiler = 'gcc', + ) + + headers = [ + 'include/svga_types.h', + 'include/svga3d_reg.h', + ] + + decls = parser.parse(headers, config, parser.COMPILATION_MODE.ALL_AT_ONCE) + global_ns = declarations.get_global_namespace(decls) + + names = set() + for id, header, body, footer in cmds: + names.add(header) + for struct, count in body: + names.add(struct) + if footer is not None: + names.add(footer) + + for class_ in global_ns.classes(lambda decl: decl.name in names): + dump_struct(decls, class_) + + dump_cmds() + + +if __name__ == '__main__': + main() diff --git a/src/gallium/winsys/drm/vmware/Makefile b/src/gallium/winsys/drm/vmware/Makefile new file mode 100644 index 0000000000..2ae6dead5c --- /dev/null +++ b/src/gallium/winsys/drm/vmware/Makefile @@ -0,0 +1,12 @@ +# src/gallium/winsys/drm/vmware/Makefile +TOP = ../../../../.. +include $(TOP)/configs/current + +SUBDIRS = core $(GALLIUM_STATE_TRACKERS_DIRS) + +default install clean: + @for dir in $(SUBDIRS) ; do \ + if [ -d $$dir ] ; then \ + (cd $$dir && $(MAKE) $@) || exit 1; \ + fi \ + done diff --git a/src/gallium/winsys/drm/vmware/SConscript b/src/gallium/winsys/drm/vmware/SConscript new file mode 100644 index 0000000000..06e6d5be9c --- /dev/null +++ b/src/gallium/winsys/drm/vmware/SConscript @@ -0,0 +1,11 @@ +Import('*') + +SConscript(['core/SConscript',]) + +if 'mesa' in env['statetrackers']: + + SConscript(['dri/SConscript']) + +if 'xorg' in env['statetrackers']: + + SConscript(['xorg/SConscript']) diff --git a/src/gallium/winsys/drm/vmware/core/Makefile b/src/gallium/winsys/drm/vmware/core/Makefile new file mode 100644 index 0000000000..755dc45935 --- /dev/null +++ b/src/gallium/winsys/drm/vmware/core/Makefile @@ -0,0 +1,47 @@ +TOP = ../../../../../.. +include $(TOP)/configs/current + +LIBNAME = svgadrm + +C_SOURCES = \ + vmw_buffer.c \ + vmw_context.c \ + vmw_fence.c \ + vmw_screen.c \ + vmw_screen_dri.c \ + vmw_screen_ioctl.c \ + vmw_screen_pools.c \ + vmw_screen_svga.c \ + vmw_surface.c + +LIBRARY_INCLUDES = \ + -I$(TOP)/src/gallium/drivers/svga \ + -I$(TOP)/src/gallium/drivers/svga/include \ + -I$(GALLIUM)/src/mesa/drivers/dri/common \ + -I$(GALLIUM)/include \ + -I$(GALLIUM)/include/GL/internal \ + -I$(GALLIUM)/src/mesa \ + -I$(GALLIUM)/src/mesa/main \ + -I$(GALLIUM)/src/mesa/glapi \ + -I$(GALLIUM)/src/egl/main \ + -I$(GALLIUM)/src/egl/drivers/dri \ + $(shell pkg-config libdrm --cflags-only-I) + +LIBRARY_DEFINES = \ + -DHAVE_STDINT_H -D_FILE_OFFSET_BITS=64 \ + $(shell pkg-config libdrm --cflags-only-other) + +CC = gcc -fvisibility=hidden -msse -msse2 + +# Set the gnu99 standard to enable anonymous structs in vmware headers. +# +CFLAGS = -Wall -Werror -Wmissing-prototypes -std=gnu99 -ffast-math \ + $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) $(ASM_FLAGS) + +include ../../../../Makefile.template + + +symlinks: + + +include depend diff --git a/src/gallium/winsys/drm/vmware/core/SConscript b/src/gallium/winsys/drm/vmware/core/SConscript new file mode 100644 index 0000000000..1875b659ac --- /dev/null +++ b/src/gallium/winsys/drm/vmware/core/SConscript @@ -0,0 +1,39 @@ +Import('*') + +env = env.Clone() + +if env['gcc']: + env.Append(CCFLAGS = ['-fvisibility=hidden', '-Werror']) + env.Append(CPPDEFINES = [ + 'HAVE_STDINT_H', + 'HAVE_SYS_TYPES_H', + '-D_FILE_OFFSET_BITS=64', + ]) + +env.Prepend(CPPPATH = [ + 'include', + '#/src/gallium/drivers/svga', + '#/src/gallium/drivers/svga/include', +]) + +env.Append(CPPDEFINES = [ +]) + +sources = [ + 'vmw_buffer.c', + 'vmw_context.c', + 'vmw_fence.c', + 'vmw_screen.c', + 'vmw_screen_dri.c', + 'vmw_screen_ioctl.c', + 'vmw_screen_pools.c', + 'vmw_screen_svga.c', + 'vmw_surface.c', +] + +svgadrm = env.ConvenienceLibrary( + target = 'svgadrm', + source = sources, +) + +Export('svgadrm') diff --git a/src/gallium/winsys/drm/vmware/core/vmw_buffer.c b/src/gallium/winsys/drm/vmware/core/vmw_buffer.c new file mode 100644 index 0000000000..b812fb59d3 --- /dev/null +++ b/src/gallium/winsys/drm/vmware/core/vmw_buffer.c @@ -0,0 +1,274 @@ +/********************************************************** + * 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, 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. + * + **********************************************************/ + +/** + * @file + * SVGA buffer manager for Guest Memory Regions (GMRs). + * + * GMRs are used for pixel and vertex data upload/download to/from the virtual + * SVGA hardware. There is a limited number of GMRs available, and + * creating/destroying them is also a slow operation so we must suballocate + * them. + * + * This file implements a pipebuffer library's buffer manager, so that we can + * use pipepbuffer's suballocation, fencing, and debugging facilities with GMRs. + * + * @author Jose Fonseca + */ + + +#include "svga_cmd.h" + +#include "pipe/p_inlines.h" +#include "util/u_memory.h" +#include "pipebuffer/pb_buffer.h" +#include "pipebuffer/pb_bufmgr.h" + +#include "svga_winsys.h" + +#include "vmw_screen.h" +#include "vmw_buffer.h" + + +struct vmw_gmr_bufmgr; + + +struct vmw_gmr_buffer +{ + struct pb_buffer base; + + struct vmw_gmr_bufmgr *mgr; + + struct vmw_region *region; + void *map; + +#ifdef DEBUG + struct pipe_fence_handle *last_fence; +#endif +}; + + +extern const struct pb_vtbl vmw_gmr_buffer_vtbl; + + +static INLINE struct vmw_gmr_buffer * +vmw_gmr_buffer(struct pb_buffer *buf) +{ + assert(buf); + assert(buf->vtbl == &vmw_gmr_buffer_vtbl); + return (struct vmw_gmr_buffer *)buf; +} + + +struct vmw_gmr_bufmgr +{ + struct pb_manager base; + + struct vmw_winsys_screen *vws; +}; + + +static INLINE struct vmw_gmr_bufmgr * +vmw_gmr_bufmgr(struct pb_manager *mgr) +{ + assert(mgr); + return (struct vmw_gmr_bufmgr *)mgr; +} + + +static void +vmw_gmr_buffer_destroy(struct pb_buffer *_buf) +{ + struct vmw_gmr_buffer *buf = vmw_gmr_buffer(_buf); + +#ifdef DEBUG + if(buf->last_fence) { + struct svga_winsys_screen *sws = &buf->mgr->vws->base; + assert(sws->fence_signalled(sws, buf->last_fence, 0) == 0); + } +#endif + + vmw_ioctl_region_unmap(buf->region); + + vmw_ioctl_region_destroy(buf->region); + + FREE(buf); +} + + +static void * +vmw_gmr_buffer_map(struct pb_buffer *_buf, + unsigned flags) +{ + struct vmw_gmr_buffer *buf = vmw_gmr_buffer(_buf); + return buf->map; +} + + +static void +vmw_gmr_buffer_unmap(struct pb_buffer *_buf) +{ + /* Do nothing */ + (void)_buf; +} + + +static void +vmw_gmr_buffer_get_base_buffer(struct pb_buffer *buf, + struct pb_buffer **base_buf, + unsigned *offset) +{ + *base_buf = buf; + *offset = 0; +} + + +static enum pipe_error +vmw_gmr_buffer_validate( struct pb_buffer *_buf, + struct pb_validate *vl, + unsigned flags ) +{ + /* Always pinned */ + return PIPE_OK; +} + + +static void +vmw_gmr_buffer_fence( struct pb_buffer *_buf, + struct pipe_fence_handle *fence ) +{ + /* We don't need to do anything, as the pipebuffer library + * will take care of delaying the destruction of fenced buffers */ +#ifdef DEBUG + struct vmw_gmr_buffer *buf = vmw_gmr_buffer(_buf); + if(fence) + buf->last_fence = fence; +#endif +} + + +const struct pb_vtbl vmw_gmr_buffer_vtbl = { + vmw_gmr_buffer_destroy, + vmw_gmr_buffer_map, + vmw_gmr_buffer_unmap, + vmw_gmr_buffer_validate, + vmw_gmr_buffer_fence, + vmw_gmr_buffer_get_base_buffer +}; + + +static struct pb_buffer * +vmw_gmr_bufmgr_create_buffer(struct pb_manager *_mgr, + pb_size size, + const struct pb_desc *desc) +{ + struct vmw_gmr_bufmgr *mgr = vmw_gmr_bufmgr(_mgr); + struct vmw_winsys_screen *vws = mgr->vws; + struct vmw_gmr_buffer *buf; + + buf = CALLOC_STRUCT(vmw_gmr_buffer); + if(!buf) + goto error1; + + pipe_reference_init(&buf->base.base.reference, 1); + buf->base.base.alignment = desc->alignment; + buf->base.base.usage = desc->usage; + buf->base.base.size = size; + buf->base.vtbl = &vmw_gmr_buffer_vtbl; + buf->mgr = mgr; + + buf->region = vmw_ioctl_region_create(vws, size); + if(!buf->region) + goto error2; + + buf->map = vmw_ioctl_region_map(buf->region); + if(!buf->map) + goto error3; + + return &buf->base; + +error3: + vmw_ioctl_region_destroy(buf->region); +error2: + FREE(buf); +error1: + return NULL; +} + + +static void +vmw_gmr_bufmgr_flush(struct pb_manager *mgr) +{ + /* No-op */ +} + + +static void +vmw_gmr_bufmgr_destroy(struct pb_manager *_mgr) +{ + struct vmw_gmr_bufmgr *mgr = vmw_gmr_bufmgr(_mgr); + FREE(mgr); +} + + +struct pb_manager * +vmw_gmr_bufmgr_create(struct vmw_winsys_screen *vws) +{ + struct vmw_gmr_bufmgr *mgr; + + mgr = CALLOC_STRUCT(vmw_gmr_bufmgr); + if(!mgr) + return NULL; + + mgr->base.destroy = vmw_gmr_bufmgr_destroy; + mgr->base.create_buffer = vmw_gmr_bufmgr_create_buffer; + mgr->base.flush = vmw_gmr_bufmgr_flush; + + mgr->vws = vws; + + return &mgr->base; +} + + +boolean +vmw_gmr_bufmgr_region_ptr(struct pb_buffer *buf, + struct SVGAGuestPtr *ptr) +{ + struct pb_buffer *base_buf; + unsigned offset = 0; + struct vmw_gmr_buffer *gmr_buf; + + pb_get_base_buffer( buf, &base_buf, &offset ); + + gmr_buf = vmw_gmr_buffer(base_buf); + if(!gmr_buf) + return FALSE; + + *ptr = vmw_ioctl_region_ptr(gmr_buf->region); + + ptr->offset += offset; + + return TRUE; +} diff --git a/src/gallium/winsys/drm/vmware/core/vmw_buffer.h b/src/gallium/winsys/drm/vmware/core/vmw_buffer.h new file mode 100644 index 0000000000..634bdcabd2 --- /dev/null +++ b/src/gallium/winsys/drm/vmware/core/vmw_buffer.h @@ -0,0 +1,65 @@ +/********************************************************** + * 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, 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. + * + **********************************************************/ + + +#ifndef VMW_BUFFER_H_ +#define VMW_BUFFER_H_ + + +#include "pipe/p_compiler.h" + +struct SVGAGuestPtr; +struct pb_buffer; +struct pb_manager; +struct svga_winsys_buffer; +struct svga_winsys_surface; +struct vmw_winsys_screen; + + +static INLINE struct pb_buffer * +vmw_pb_buffer(struct svga_winsys_buffer *buffer) +{ + assert(buffer); + return (struct pb_buffer *)buffer; +} + + +static INLINE struct svga_winsys_buffer * +vmw_svga_winsys_buffer(struct pb_buffer *buffer) +{ + assert(buffer); + return (struct svga_winsys_buffer *)buffer; +} + + +struct pb_manager * +vmw_gmr_bufmgr_create(struct vmw_winsys_screen *vws); + +boolean +vmw_gmr_bufmgr_region_ptr(struct pb_buffer *buf, + struct SVGAGuestPtr *ptr); + + +#endif /* VMW_BUFFER_H_ */ diff --git a/src/gallium/winsys/drm/vmware/core/vmw_context.c b/src/gallium/winsys/drm/vmware/core/vmw_context.c new file mode 100644 index 0000000000..b6997588de --- /dev/null +++ b/src/gallium/winsys/drm/vmware/core/vmw_context.c @@ -0,0 +1,297 @@ +/********************************************************** + * 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, 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. + * + **********************************************************/ + + +#include "svga_cmd.h" + +#include "util/u_debug.h" +#include "util/u_memory.h" +#include "util/u_debug_stack.h" +#include "pipebuffer/pb_buffer.h" +#include "pipebuffer/pb_validate.h" + +#include "svga_winsys.h" +#include "vmw_context.h" +#include "vmw_screen.h" +#include "vmw_buffer.h" +#include "vmw_surface.h" +#include "vmw_fence.h" + +#define VMW_COMMAND_SIZE (64*1024) +#define VMW_SURFACE_RELOCS (1024) + +#define VMW_MUST_FLUSH_STACK 8 + +struct vmw_svga_winsys_context +{ + struct svga_winsys_context base; + + struct vmw_winsys_screen *vws; + +#ifdef DEBUG + boolean must_flush; + struct debug_stack_frame must_flush_stack[VMW_MUST_FLUSH_STACK]; +#endif + + struct { + uint8_t buffer[VMW_COMMAND_SIZE]; + uint32_t size; + uint32_t used; + uint32_t reserved; + } command; + + struct { + struct vmw_svga_winsys_surface *handles[VMW_SURFACE_RELOCS]; + uint32_t size; + uint32_t used; + uint32_t staged; + uint32_t reserved; + } surface; + + struct pb_validate *validate; + + uint32_t last_fence; +}; + + +static INLINE struct vmw_svga_winsys_context * +vmw_svga_winsys_context(struct svga_winsys_context *swc) +{ + assert(swc); + return (struct vmw_svga_winsys_context *)swc; +} + + +static enum pipe_error +vmw_swc_flush(struct svga_winsys_context *swc, + struct pipe_fence_handle **pfence) +{ + struct vmw_svga_winsys_context *vswc = vmw_svga_winsys_context(swc); + struct pipe_fence_handle *fence = NULL; + unsigned i; + enum pipe_error ret; + + ret = pb_validate_validate(vswc->validate); + assert(ret == PIPE_OK); + if(ret == PIPE_OK) { + + if (vswc->command.used) + vmw_ioctl_command(vswc->vws, + vswc->command.buffer, + vswc->command.used, + &vswc->last_fence); + + fence = vmw_pipe_fence(vswc->last_fence); + + pb_validate_fence(vswc->validate, fence); + } + + vswc->command.used = 0; + vswc->command.reserved = 0; + + for(i = 0; i < vswc->surface.used + vswc->surface.staged; ++i) { + struct vmw_svga_winsys_surface *vsurf = + vswc->surface.handles[i]; + p_atomic_dec(&vsurf->validated); + vmw_svga_winsys_surface_reference(&vswc->surface.handles[i], NULL); + } + + vswc->surface.used = 0; + vswc->surface.reserved = 0; + +#ifdef DEBUG + vswc->must_flush = FALSE; +#endif + + if(pfence) + *pfence = fence; + + return ret; +} + + +static void * +vmw_swc_reserve(struct svga_winsys_context *swc, + uint32_t nr_bytes, uint32_t nr_relocs ) +{ + struct vmw_svga_winsys_context *vswc = vmw_svga_winsys_context(swc); + +#ifdef DEBUG + /* Check if somebody forgot to check the previous failure */ + if(vswc->must_flush) { + debug_printf("Forgot to flush:\n"); + debug_backtrace_dump(vswc->must_flush_stack, VMW_MUST_FLUSH_STACK); + assert(!vswc->must_flush); + } +#endif + + assert(nr_bytes <= vswc->command.size); + if(nr_bytes > vswc->command.size) + return NULL; + + if(vswc->command.used + nr_bytes > vswc->command.size || + vswc->surface.used + nr_relocs > vswc->surface.size) { +#ifdef DEBUG + vswc->must_flush = TRUE; + debug_backtrace_capture(vswc->must_flush_stack, 1, + VMW_MUST_FLUSH_STACK); +#endif + return NULL; + } + + assert(vswc->command.used + nr_bytes <= vswc->command.size); + assert(vswc->surface.used + nr_relocs <= vswc->surface.size); + + vswc->command.reserved = nr_bytes; + vswc->surface.reserved = nr_relocs; + vswc->surface.staged = 0; + + return vswc->command.buffer + vswc->command.used; +} + + +static void +vmw_swc_surface_relocation(struct svga_winsys_context *swc, + uint32 *where, + struct svga_winsys_surface *surface, + unsigned flags) +{ + struct vmw_svga_winsys_context *vswc = vmw_svga_winsys_context(swc); + struct vmw_svga_winsys_surface *vsurf; + + if(!surface) { + *where = SVGA3D_INVALID_ID; + return; + } + + assert(vswc->surface.staged < vswc->surface.reserved); + + vsurf = vmw_svga_winsys_surface(surface); + + *where = vsurf->sid; + + vmw_svga_winsys_surface_reference(&vswc->surface.handles[vswc->surface.used + vswc->surface.staged], vsurf); + p_atomic_inc(&vsurf->validated); + ++vswc->surface.staged; +} + + +static void +vmw_swc_region_relocation(struct svga_winsys_context *swc, + struct SVGAGuestPtr *where, + struct svga_winsys_buffer *buffer, + uint32 offset, + unsigned flags) +{ + struct vmw_svga_winsys_context *vswc = vmw_svga_winsys_context(swc); + struct SVGAGuestPtr ptr; + struct pb_buffer *buf = vmw_pb_buffer(buffer); + enum pipe_error ret; + + if(!vmw_gmr_bufmgr_region_ptr(buf, &ptr)) + assert(0); + + ptr.offset += offset; + + *where = ptr; + + ret = pb_validate_add_buffer(vswc->validate, buf, flags); + /* TODO: Update pipebuffer to reserve buffers and not fail here */ + assert(ret == PIPE_OK); +} + + +static void +vmw_swc_commit(struct svga_winsys_context *swc) +{ + struct vmw_svga_winsys_context *vswc = vmw_svga_winsys_context(swc); + + assert(vswc->command.reserved); + assert(vswc->command.used + vswc->command.reserved <= vswc->command.size); + vswc->command.used += vswc->command.reserved; + vswc->command.reserved = 0; + + assert(vswc->surface.staged <= vswc->surface.reserved); + assert(vswc->surface.used + vswc->surface.staged <= vswc->surface.size); + vswc->surface.used += vswc->surface.staged; + vswc->surface.staged = 0; + vswc->surface.reserved = 0; +} + + +static void +vmw_swc_destroy(struct svga_winsys_context *swc) +{ + struct vmw_svga_winsys_context *vswc = vmw_svga_winsys_context(swc); + unsigned i; + for(i = 0; i < vswc->surface.used; ++i) { + p_atomic_dec(&vswc->surface.handles[i]->validated); + vmw_svga_winsys_surface_reference(&vswc->surface.handles[i], NULL); + } + pb_validate_destroy(vswc->validate); + vmw_ioctl_context_destroy(vswc->vws, swc->cid); + FREE(vswc); +} + + +struct svga_winsys_context * +vmw_svga_winsys_context_create(struct svga_winsys_screen *sws) +{ + struct vmw_winsys_screen *vws = vmw_winsys_screen(sws); + struct vmw_svga_winsys_context *vswc; + + vswc = CALLOC_STRUCT(vmw_svga_winsys_context); + if(!vswc) + return NULL; + + vswc->base.destroy = vmw_swc_destroy; + vswc->base.reserve = vmw_swc_reserve; + vswc->base.surface_relocation = vmw_swc_surface_relocation; + vswc->base.region_relocation = vmw_swc_region_relocation; + vswc->base.commit = vmw_swc_commit; + vswc->base.flush = vmw_swc_flush; + + vswc->base.cid = vmw_ioctl_context_create(vws); + + vswc->vws = vws; + + vswc->command.size = VMW_COMMAND_SIZE; + vswc->surface.size = VMW_SURFACE_RELOCS; + + vswc->validate = pb_validate_create(); + if(!vswc->validate) { + FREE(vswc); + return NULL; + } + + return &vswc->base; +} + + +struct pipe_context * +vmw_svga_context_create(struct pipe_screen *screen) +{ + return svga_context_create(screen); +} diff --git a/src/gallium/winsys/drm/vmware/core/vmw_context.h b/src/gallium/winsys/drm/vmware/core/vmw_context.h new file mode 100644 index 0000000000..305ce9b5be --- /dev/null +++ b/src/gallium/winsys/drm/vmware/core/vmw_context.h @@ -0,0 +1,59 @@ +/********************************************************** + * 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, 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. + * + **********************************************************/ + +/** + * @author Jose Fonseca + */ + + +#ifndef VMW_CONTEXT_H_ +#define VMW_CONTEXT_H_ + +#include "pipe/p_compiler.h" + +struct svga_winsys_screen; +struct svga_winsys_context; +struct pipe_context; +struct pipe_screen; + +#define VMW_DEBUG 0 + +#if VMW_DEBUG +#define vmw_printf debug_printf +#define VMW_FUNC debug_printf("%s\n", __FUNCTION__) +#else +#define VMW_FUNC +#define vmw_printf(...) +#endif + + +struct svga_winsys_context * +vmw_svga_winsys_context_create(struct svga_winsys_screen *sws); + +struct pipe_context * +vmw_svga_context_create(struct pipe_screen *screen); + + +#endif /* VMW_CONTEXT_H_ */ diff --git a/src/gallium/winsys/drm/vmware/core/vmw_fence.c b/src/gallium/winsys/drm/vmware/core/vmw_fence.c new file mode 100644 index 0000000000..873dd51166 --- /dev/null +++ b/src/gallium/winsys/drm/vmware/core/vmw_fence.c @@ -0,0 +1,108 @@ +/********************************************************** + * 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, 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. + * + **********************************************************/ + + +#include "util/u_memory.h" +#include "pipebuffer/pb_buffer_fenced.h" + +#include "vmw_screen.h" +#include "vmw_fence.h" + + + +struct vmw_fence_ops +{ + struct pb_fence_ops base; + + struct vmw_winsys_screen *vws; +}; + + +static INLINE struct vmw_fence_ops * +vmw_fence_ops(struct pb_fence_ops *ops) +{ + assert(ops); + return (struct vmw_fence_ops *)ops; +} + + +static void +vmw_fence_ops_fence_reference(struct pb_fence_ops *ops, + struct pipe_fence_handle **ptr, + struct pipe_fence_handle *fence) +{ + *ptr = fence; +} + + +static int +vmw_fence_ops_fence_signalled(struct pb_fence_ops *ops, + struct pipe_fence_handle *fence, + unsigned flag) +{ + struct vmw_winsys_screen *vws = vmw_fence_ops(ops)->vws; + (void)flag; + return vmw_ioctl_fence_signalled(vws, vmw_fence(fence)); +} + + +static int +vmw_fence_ops_fence_finish(struct pb_fence_ops *ops, + struct pipe_fence_handle *fence, + unsigned flag) +{ + struct vmw_winsys_screen *vws = vmw_fence_ops(ops)->vws; + (void)flag; + return vmw_ioctl_fence_finish(vws, vmw_fence(fence)); +} + + +static void +vmw_fence_ops_destroy(struct pb_fence_ops *ops) +{ + FREE(ops); +} + + +struct pb_fence_ops * +vmw_fence_ops_create(struct vmw_winsys_screen *vws) +{ + struct vmw_fence_ops *ops; + + ops = CALLOC_STRUCT(vmw_fence_ops); + if(!ops) + return NULL; + + ops->base.destroy = &vmw_fence_ops_destroy; + ops->base.fence_reference = &vmw_fence_ops_fence_reference; + ops->base.fence_signalled = &vmw_fence_ops_fence_signalled; + ops->base.fence_finish = &vmw_fence_ops_fence_finish; + + ops->vws = vws; + + return &ops->base; +} + + diff --git a/src/gallium/winsys/drm/vmware/core/vmw_fence.h b/src/gallium/winsys/drm/vmware/core/vmw_fence.h new file mode 100644 index 0000000000..5357b4f61d --- /dev/null +++ b/src/gallium/winsys/drm/vmware/core/vmw_fence.h @@ -0,0 +1,59 @@ +/********************************************************** + * 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, 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. + * + **********************************************************/ + + +#ifndef VMW_FENCE_H_ +#define VMW_FENCE_H_ + + +#include "pipe/p_compiler.h" + + +struct pipe_fence_handle; +struct pb_fence_ops; +struct vmw_winsys_screen; + + +/** Cast from a pipe_fence_handle pointer into a SVGA fence */ +static INLINE uint32_t +vmw_fence( struct pipe_fence_handle *fence ) +{ + return (uint32_t)(uintptr_t)fence; +} + + +/** Cast from a SVGA fence number to pipe_fence_handle pointer */ +static INLINE struct pipe_fence_handle * +vmw_pipe_fence( uint32_t fence ) +{ + return (struct pipe_fence_handle *)(uintptr_t)fence; +} + + +struct pb_fence_ops * +vmw_fence_ops_create(struct vmw_winsys_screen *vws); + + +#endif /* VMW_FENCE_H_ */ diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen.c b/src/gallium/winsys/drm/vmware/core/vmw_screen.c new file mode 100644 index 0000000000..911eec5e25 --- /dev/null +++ b/src/gallium/winsys/drm/vmware/core/vmw_screen.c @@ -0,0 +1,74 @@ +/********************************************************** + * 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, 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. + * + **********************************************************/ + + +#include "vmw_screen.h" + +#include "vmw_context.h" + +#include "util/u_memory.h" +#include "pipe/p_compiler.h" + + +/* Called from vmw_drm_create_screen(), creates and initializes the + * vmw_winsys_screen structure, which is the main entity in this + * module. + */ +struct vmw_winsys_screen * +vmw_winsys_create( int fd ) +{ + struct vmw_winsys_screen *vws = CALLOC_STRUCT(vmw_winsys_screen); + if (!vws) + goto out_no_vws; + + vws->ioctl.drm_fd = fd; + + if (!vmw_ioctl_init(vws)) + goto out_no_ioctl; + + if(!vmw_pools_init(vws)) + goto out_no_pools; + + if (!vmw_winsys_screen_init_svga(vws)) + goto out_no_svga; + + return vws; +out_no_svga: + vmw_pools_cleanup(vws); +out_no_pools: + vmw_ioctl_cleanup(vws); +out_no_ioctl: + FREE(vws); +out_no_vws: + return NULL; +} + +void +vmw_winsys_destroy(struct vmw_winsys_screen *vws) +{ + vmw_pools_cleanup(vws); + vmw_ioctl_cleanup(vws); + FREE(vws); +} diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen.h b/src/gallium/winsys/drm/vmware/core/vmw_screen.h new file mode 100644 index 0000000000..a875107370 --- /dev/null +++ b/src/gallium/winsys/drm/vmware/core/vmw_screen.h @@ -0,0 +1,134 @@ +/********************************************************** + * 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, 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. + * + **********************************************************/ + +/** + * @file + * Common definitions for the VMware SVGA winsys. + * + * @author Jose Fonseca + */ + + +#ifndef VMW_SCREEN_H_ +#define VMW_SCREEN_H_ + + +#include "pipe/p_compiler.h" +#include "pipe/p_state.h" + +#include "svga_winsys.h" + +struct pb_manager; +struct vmw_region; + + +struct vmw_winsys_screen +{ + struct svga_winsys_screen base; + + struct { + volatile uint32_t *fifo_map; + uint64_t last_fence; + int drm_fd; + } ioctl; + + struct { + struct pb_manager *gmr; + struct pb_manager *gmr_mm; + struct pb_manager *gmr_fenced; + } pools; +}; + + +static INLINE struct vmw_winsys_screen * +vmw_winsys_screen(struct svga_winsys_screen *base) +{ + return (struct vmw_winsys_screen *)base; +} + +/* */ +uint32 +vmw_ioctl_context_create(struct vmw_winsys_screen *vws); + +void +vmw_ioctl_context_destroy(struct vmw_winsys_screen *vws, + uint32 cid); + +uint32 +vmw_ioctl_surface_create(struct vmw_winsys_screen *vws, + SVGA3dSurfaceFlags flags, + SVGA3dSurfaceFormat format, + SVGA3dSize size, + uint32 numFaces, + uint32 numMipLevels); + +void +vmw_ioctl_surface_destroy(struct vmw_winsys_screen *vws, + uint32 sid); + +void +vmw_ioctl_command(struct vmw_winsys_screen *vws, + void *commands, + uint32_t size, + uint32_t *fence); + +struct vmw_region * +vmw_ioctl_region_create(struct vmw_winsys_screen *vws, uint32_t size); + +void +vmw_ioctl_region_destroy(struct vmw_region *region); + +struct SVGAGuestPtr +vmw_ioctl_region_ptr(struct vmw_region *region); + +void * +vmw_ioctl_region_map(struct vmw_region *region); +void +vmw_ioctl_region_unmap(struct vmw_region *region); + + +int +vmw_ioctl_fence_finish(struct vmw_winsys_screen *vws, + uint32_t fence); + +int +vmw_ioctl_fence_signalled(struct vmw_winsys_screen *vws, + uint32_t fence); + + +/* Initialize parts of vmw_winsys_screen at startup: + */ +boolean vmw_ioctl_init(struct vmw_winsys_screen *vws); +boolean vmw_pools_init(struct vmw_winsys_screen *vws); +boolean vmw_winsys_screen_init_svga(struct vmw_winsys_screen *vws); + +void vmw_ioctl_cleanup(struct vmw_winsys_screen *vws); +void vmw_pools_cleanup(struct vmw_winsys_screen *vws); + +struct vmw_winsys_screen *vmw_winsys_create(int fd); +void vmw_winsys_destroy(struct vmw_winsys_screen *sws); + + +#endif /* VMW_SCREEN_H_ */ diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c b/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c new file mode 100644 index 0000000000..5995eee34b --- /dev/null +++ b/src/gallium/winsys/drm/vmware/core/vmw_screen_dri.c @@ -0,0 +1,371 @@ +/********************************************************** + * 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, 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. + * + **********************************************************/ + + +#include "pipe/p_compiler.h" +#include "pipe/p_inlines.h" +#include "util/u_memory.h" +#include "vmw_screen.h" + +#include "trace/tr_drm.h" + +#include "vmw_screen.h" +#include "vmw_surface.h" +#include "vmw_fence.h" +#include "vmw_context.h" + +#include +#include +#include +#include + +#include + +static struct dri1_api dri1_api_hooks; +static struct dri1_api_version ddx_required = { 0, 1, 0 }; +static struct dri1_api_version ddx_compat = { 0, 0, 0 }; +static struct dri1_api_version dri_required = { 4, 0, 0 }; +static struct dri1_api_version dri_compat = { 4, 0, 0 }; +static struct dri1_api_version drm_required = { 0, 1, 0 }; +static struct dri1_api_version drm_compat = { 0, 0, 0 }; + +static boolean +vmw_dri1_check_version(const struct dri1_api_version *cur, + const struct dri1_api_version *required, + const struct dri1_api_version *compat, + const char component[]) +{ + if (cur->major > required->major && cur->major <= compat->major) + return TRUE; + if (cur->major == required->major && cur->minor >= required->minor) + return TRUE; + + fprintf(stderr, "%s version failure.\n", component); + fprintf(stderr, "%s version is %d.%d.%d and this driver can only work\n" + "with versions %d.%d.x through %d.x.x.\n", + component, + cur->major, + cur->minor, + cur->patch_level, required->major, required->minor, compat->major); + return FALSE; +} + +/* This is actually the entrypoint to the entire driver, called by the + * libGL (or EGL, or ...) code via the drm_api_hooks table at the + * bottom of the file. + */ +static struct pipe_screen * +vmw_drm_create_screen(struct drm_api *drm_api, + int fd, + struct drm_create_screen_arg *arg) +{ + struct vmw_winsys_screen *vws; + struct pipe_screen *screen; + struct dri1_create_screen_arg *dri1; + + if (arg != NULL) { + switch (arg->mode) { + case DRM_CREATE_NORMAL: + break; + case DRM_CREATE_DRI1: + dri1 = (struct dri1_create_screen_arg *)arg; + if (!vmw_dri1_check_version(&dri1->ddx_version, &ddx_required, + &ddx_compat, "ddx - driver api")) + return NULL; + if (!vmw_dri1_check_version(&dri1->dri_version, &dri_required, + &dri_compat, "dri info")) + return NULL; + if (!vmw_dri1_check_version(&dri1->drm_version, &drm_required, + &drm_compat, "vmwgfx drm driver")) + return NULL; + dri1->api = &dri1_api_hooks; + break; + default: + return NULL; + } + } + + vws = vmw_winsys_create( fd ); + if (!vws) + goto out_no_vws; + + screen = svga_screen_create( &vws->base ); + if (!screen) + goto out_no_screen; + + return screen; + + /* Failure cases: + */ +out_no_screen: + vmw_winsys_destroy( vws ); + +out_no_vws: + return NULL; +} + +static INLINE boolean +vmw_dri1_intersect_src_bbox(struct drm_clip_rect *dst, + int dst_x, + int dst_y, + const struct drm_clip_rect *src, + const struct drm_clip_rect *bbox) +{ + int xy1; + int xy2; + + xy1 = ((int)src->x1 > (int)bbox->x1 + dst_x) ? src->x1 : + (int)bbox->x1 + dst_x; + xy2 = ((int)src->x2 < (int)bbox->x2 + dst_x) ? src->x2 : + (int)bbox->x2 + dst_x; + if (xy1 >= xy2 || xy1 < 0) + return FALSE; + + dst->x1 = xy1; + dst->x2 = xy2; + + xy1 = ((int)src->y1 > (int)bbox->y1 + dst_y) ? src->y1 : + (int)bbox->y1 + dst_y; + xy2 = ((int)src->y2 < (int)bbox->y2 + dst_y) ? src->y2 : + (int)bbox->y2 + dst_y; + if (xy1 >= xy2 || xy1 < 0) + return FALSE; + + dst->y1 = xy1; + dst->y2 = xy2; + return TRUE; +} + +/** + * No fancy get-surface-from-sarea stuff here. + * Just use the present blit. + */ + +static void +vmw_dri1_present_locked(struct pipe_context *locked_pipe, + struct pipe_surface *surf, + const struct drm_clip_rect *rect, + unsigned int num_clip, + int x_draw, int y_draw, + const struct drm_clip_rect *bbox, + struct pipe_fence_handle **p_fence) +{ + struct svga_winsys_surface *srf = + svga_screen_texture_get_winsys_surface(surf->texture); + struct vmw_svga_winsys_surface *vsrf = vmw_svga_winsys_surface(srf); + struct vmw_winsys_screen *vws = + vmw_winsys_screen(svga_winsys_screen(locked_pipe->screen)); + struct drm_clip_rect clip; + int i; + struct + { + SVGA3dCmdHeader header; + SVGA3dCmdPresent body; + SVGA3dCopyRect rect; + } cmd; + boolean visible = FALSE; + uint32_t fence_seq = 0; + + VMW_FUNC; + cmd.header.id = SVGA_3D_CMD_PRESENT; + cmd.header.size = sizeof cmd.body + sizeof cmd.rect; + cmd.body.sid = vsrf->sid; + + for (i = 0; i < num_clip; ++i) { + if (!vmw_dri1_intersect_src_bbox(&clip, x_draw, y_draw, rect++, bbox)) + continue; + + cmd.rect.x = clip.x1; + cmd.rect.y = clip.y1; + cmd.rect.w = clip.x2 - clip.x1; + cmd.rect.h = clip.y2 - clip.y1; + cmd.rect.srcx = (int)clip.x1 - x_draw; + cmd.rect.srcy = (int)clip.y1 - y_draw; + + vmw_printf("%s: Clip %d x %d y %d w %d h %d srcx %d srcy %d\n", + __FUNCTION__, + i, + cmd.rect.x, + cmd.rect.y, + cmd.rect.w, cmd.rect.h, cmd.rect.srcx, cmd.rect.srcy); + + vmw_ioctl_command(vws, &cmd, sizeof cmd.header + cmd.header.size, + &fence_seq); + visible = TRUE; + } + + *p_fence = (visible) ? vmw_pipe_fence(fence_seq) : NULL; + vmw_svga_winsys_surface_reference(&vsrf, NULL); +} + +/** + * FIXME: We'd probably want to cache these buffers in the + * screen, based on handle. + */ + +static struct pipe_buffer * +vmw_drm_buffer_from_handle(struct drm_api *drm_api, + struct pipe_screen *screen, + const char *name, + unsigned handle) +{ + struct vmw_svga_winsys_surface *vsrf; + struct svga_winsys_surface *ssrf; + struct vmw_winsys_screen *vws = + vmw_winsys_screen(svga_winsys_screen(screen)); + struct pipe_buffer *buf; + union drm_vmw_surface_reference_arg arg; + struct drm_vmw_surface_arg *req = &arg.req; + struct drm_vmw_surface_create_req *rep = &arg.rep; + int ret; + int i; + + /** + * The vmware device specific handle is the hardware SID. + * FIXME: We probably want to move this to the ioctl implementations. + */ + + memset(&arg, 0, sizeof(arg)); + req->sid = handle; + + ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_REF_SURFACE, + &arg, sizeof(arg)); + + if (ret) { + fprintf(stderr, "Failed referencing shared surface. SID %d.\n" + "Error %d (%s).\n", + handle, ret, strerror(-ret)); + return NULL; + } + + if (rep->mip_levels[0] != 1) { + fprintf(stderr, "Incorrect number of mipmap levels on shared surface." + " SID %d, levels %d\n", + handle, rep->mip_levels[0]); + goto out_mip; + } + + for (i=1; i < DRM_VMW_MAX_SURFACE_FACES; ++i) { + if (rep->mip_levels[i] != 0) { + fprintf(stderr, "Incorrect number of faces levels on shared surface." + " SID %d, face %d present.\n", + handle, i); + goto out_mip; + } + } + + vsrf = CALLOC_STRUCT(vmw_svga_winsys_surface); + if (!vsrf) + goto out_mip; + + pipe_reference_init(&vsrf->refcnt, 1); + p_atomic_set(&vsrf->validated, 0); + vsrf->sid = handle; + ssrf = svga_winsys_surface(vsrf); + buf = svga_screen_buffer_wrap_surface(screen, rep->format, ssrf); + if (!buf) + vmw_svga_winsys_surface_reference(&vsrf, NULL); + + return buf; + out_mip: + vmw_ioctl_surface_destroy(vws, handle); + return NULL; +} + +static struct pipe_texture * +vmw_drm_texture_from_handle(struct drm_api *drm_api, + struct pipe_screen *screen, + struct pipe_texture *templat, + const char *name, + unsigned stride, + unsigned handle) +{ + struct pipe_buffer *buffer; + buffer = vmw_drm_buffer_from_handle(drm_api, screen, name, handle); + + if (!buffer) + return NULL; + + return screen->texture_blanket(screen, templat, &stride, buffer); +} + +static boolean +vmw_drm_handle_from_buffer(struct drm_api *drm_api, + struct pipe_screen *screen, + struct pipe_buffer *buffer, + unsigned *handle) +{ + struct svga_winsys_surface *surface = + svga_screen_buffer_get_winsys_surface(buffer); + struct vmw_svga_winsys_surface *vsrf; + + if (!surface) + return FALSE; + + vsrf = vmw_svga_winsys_surface(surface); + *handle = vsrf->sid; + vmw_svga_winsys_surface_reference(&vsrf, NULL); + return TRUE; +} + +static boolean +vmw_drm_handle_from_texture(struct drm_api *drm_api, + struct pipe_screen *screen, + struct pipe_texture *texture, + unsigned *stride, + unsigned *handle) +{ + struct pipe_buffer *buffer; + + if (!svga_screen_buffer_from_texture(texture, &buffer, stride)) + return FALSE; + + return vmw_drm_handle_from_buffer(drm_api, screen, buffer, handle); +} + +static struct pipe_context* +vmw_drm_create_context(struct drm_api *drm_api, + struct pipe_screen *screen) +{ + return vmw_svga_context_create(screen); +} + +static struct dri1_api dri1_api_hooks = { + .front_srf_locked = NULL, + .present_locked = vmw_dri1_present_locked +}; + +static struct drm_api vmw_drm_api_hooks = { + .create_screen = vmw_drm_create_screen, + .create_context = vmw_drm_create_context, + .texture_from_shared_handle = vmw_drm_texture_from_handle, + .shared_handle_from_texture = vmw_drm_handle_from_texture, + .local_handle_from_texture = vmw_drm_handle_from_texture, +}; + +struct drm_api* drm_api_create() +{ + return trace_drm_create(&vmw_drm_api_hooks); +} diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c b/src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c new file mode 100644 index 0000000000..b3515732a2 --- /dev/null +++ b/src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c @@ -0,0 +1,503 @@ +/********************************************************** + * 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, 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. + * + **********************************************************/ + +/** + * @file + * + * Wrappers for DRM ioctl functionlaity used by the rest of the vmw + * drm winsys. + * + * Based on svgaicd_escape.c + */ + + +#include "svga_cmd.h" +#include "util/u_memory.h" +#include "util/u_math.h" +#include "svgadump/svga_dump.h" +#include "vmw_screen.h" +#include "vmw_context.h" +#include "xf86drm.h" +#include "vmwgfx_drm.h" + +#include +#include +#include + +struct vmw_region +{ + SVGAGuestPtr ptr; + uint32_t handle; + uint64_t map_handle; + void *data; + uint32_t map_count; + int drm_fd; + uint32_t size; +}; + +static void +vmw_check_last_cmd(struct vmw_winsys_screen *vws) +{ + static uint32_t buffer[16384]; + struct drm_vmw_fifo_debug_arg arg; + int ret; + + return; + memset(&arg, 0, sizeof(arg)); + arg.debug_buffer = (unsigned long)buffer; + arg.debug_buffer_size = 65536; + + ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_FIFO_DEBUG, + &arg, sizeof(arg)); + + if (ret) { + debug_printf("%s Ioctl error: \"%s\".\n", __FUNCTION__, strerror(-ret)); + return; + } + + if (arg.did_not_fit) { + debug_printf("%s Command did not fit completely.\n", __FUNCTION__); + } + + svga_dump_commands(buffer, arg.used_size); +} + +static void +vmw_ioctl_fifo_unmap(struct vmw_winsys_screen *vws, void *mapping) +{ + VMW_FUNC; + (void)munmap(mapping, getpagesize()); +} + + +static void * +vmw_ioctl_fifo_map(struct vmw_winsys_screen *vws, + uint32_t fifo_offset ) +{ + void *map; + + VMW_FUNC; + + map = mmap(NULL, getpagesize(), PROT_READ, MAP_SHARED, + vws->ioctl.drm_fd, fifo_offset); + + if (map == MAP_FAILED) { + debug_printf("Map failed %s\n", strerror(errno)); + return NULL; + } + + vmw_printf("Fifo (min) is 0x%08x\n", ((uint32_t *) map)[SVGA_FIFO_MIN]); + + return map; +} + +uint32 +vmw_ioctl_context_create(struct vmw_winsys_screen *vws) +{ + struct drm_vmw_context_arg c_arg; + int ret; + + VMW_FUNC; + + ret = drmCommandRead(vws->ioctl.drm_fd, DRM_VMW_CREATE_CONTEXT, + &c_arg, sizeof(c_arg)); + + if (ret) + return -1; + + vmw_check_last_cmd(vws); + vmw_printf("Context id is %d\n", c_arg.cid); + + return c_arg.cid; +} + +void +vmw_ioctl_context_destroy(struct vmw_winsys_screen *vws, uint32 cid) +{ + struct drm_vmw_context_arg c_arg; + + VMW_FUNC; + + memset(&c_arg, 0, sizeof(c_arg)); + c_arg.cid = cid; + + (void)drmCommandWrite(vws->ioctl.drm_fd, DRM_VMW_UNREF_CONTEXT, + &c_arg, sizeof(c_arg)); + + vmw_check_last_cmd(vws); +} + +uint32 +vmw_ioctl_surface_create(struct vmw_winsys_screen *vws, + SVGA3dSurfaceFlags flags, + SVGA3dSurfaceFormat format, + SVGA3dSize size, + uint32_t numFaces, uint32_t numMipLevels) +{ + union drm_vmw_surface_create_arg s_arg; + struct drm_vmw_surface_create_req *req = &s_arg.req; + struct drm_vmw_surface_arg *rep = &s_arg.rep; + struct drm_vmw_size sizes[DRM_VMW_MAX_SURFACE_FACES* + DRM_VMW_MAX_MIP_LEVELS]; + struct drm_vmw_size *cur_size; + uint32_t iFace; + uint32_t iMipLevel; + int ret; + + vmw_printf("%s flags %d format %d\n", __FUNCTION__, flags, format); + + memset(&s_arg, 0, sizeof(s_arg)); + req->flags = (uint32_t) flags; + req->format = (uint32_t) format; + req->shareable = 1; + + assert(numFaces * numMipLevels < DRM_VMW_MAX_SURFACE_FACES* + DRM_VMW_MAX_MIP_LEVELS); + cur_size = sizes; + for (iFace = 0; iFace < numFaces; ++iFace) { + SVGA3dSize mipSize = size; + + req->mip_levels[iFace] = numMipLevels; + for (iMipLevel = 0; iMipLevel < numMipLevels; ++iMipLevel) { + cur_size->width = mipSize.width; + cur_size->height = mipSize.height; + cur_size->depth = mipSize.depth; + mipSize.width = MAX2(mipSize.width >> 1, 1); + mipSize.height = MAX2(mipSize.height >> 1, 1); + mipSize.depth = MAX2(mipSize.depth >> 1, 1); + cur_size++; + } + } + for (iFace = numFaces; iFace < SVGA3D_MAX_SURFACE_FACES; ++iFace) { + req->mip_levels[iFace] = 0; + } + + req->size_addr = (unsigned long)&sizes; + + ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_CREATE_SURFACE, + &s_arg, sizeof(s_arg)); + + if (ret) + return -1; + + vmw_printf("Surface id is %d\n", rep->sid); + vmw_check_last_cmd(vws); + + return rep->sid; +} + +void +vmw_ioctl_surface_destroy(struct vmw_winsys_screen *vws, uint32 sid) +{ + struct drm_vmw_surface_arg s_arg; + + VMW_FUNC; + + memset(&s_arg, 0, sizeof(s_arg)); + s_arg.sid = sid; + + (void)drmCommandWrite(vws->ioctl.drm_fd, DRM_VMW_UNREF_SURFACE, + &s_arg, sizeof(s_arg)); + vmw_check_last_cmd(vws); + +} + +void +vmw_ioctl_command(struct vmw_winsys_screen *vws, void *commands, uint32_t size, + uint32_t * pfence) +{ + struct drm_vmw_execbuf_arg arg; + struct drm_vmw_fence_rep rep; + int ret; + +#ifdef DEBUG + { + static boolean firsttime = TRUE; + static boolean debug = FALSE; + static boolean skip = FALSE; + if (firsttime) { + debug = debug_get_bool_option("SVGA_DUMP_CMD", FALSE); + skip = debug_get_bool_option("SVGA_SKIP_CMD", FALSE); + } + if (debug) { + VMW_FUNC; + svga_dump_commands(commands, size); + } + firsttime = FALSE; + if (skip) { + size = 0; + } + } +#endif + + memset(&arg, 0, sizeof(arg)); + memset(&rep, 0, sizeof(rep)); + + rep.error = -EFAULT; + arg.fence_rep = (unsigned long)&rep; + arg.commands = (unsigned long)commands; + arg.command_size = size; + + do { + ret = drmCommandWrite(vws->ioctl.drm_fd, DRM_VMW_EXECBUF, &arg, sizeof(arg)); + } while(ret == -ERESTART); + if (ret) { + debug_printf("%s error %s.\n", __FUNCTION__, strerror(-ret)); + } + if (rep.error) { + + /* + * Kernel has synced and put the last fence sequence in the FIFO + * register. + */ + + if (rep.error == -EFAULT) + rep.fence_seq = vws->ioctl.fifo_map[SVGA_FIFO_FENCE]; + + debug_printf("%s Fence error %s.\n", __FUNCTION__, + strerror(-rep.error)); + } + + vws->ioctl.last_fence = rep.fence_seq; + + if (pfence) + *pfence = rep.fence_seq; + vmw_check_last_cmd(vws); + +} + + +struct vmw_region * +vmw_ioctl_region_create(struct vmw_winsys_screen *vws, uint32_t size) +{ + struct vmw_region *region; + union drm_vmw_alloc_dmabuf_arg arg; + struct drm_vmw_alloc_dmabuf_req *req = &arg.req; + struct drm_vmw_dmabuf_rep *rep = &arg.rep; + int ret; + + vmw_printf("%s: size = %u\n", __FUNCTION__, size); + + region = CALLOC_STRUCT(vmw_region); + if (!region) + goto out_err1; + + memset(&arg, 0, sizeof(arg)); + req->size = size; + do { + ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_ALLOC_DMABUF, &arg, + sizeof(arg)); + } while (ret == -ERESTART); + + if (ret) { + debug_printf("IOCTL failed %d: %s\n", ret, strerror(-ret)); + goto out_err1; + } + + region->ptr.gmrId = rep->cur_gmr_id; + region->ptr.offset = rep->cur_gmr_offset; + region->data = NULL; + region->handle = rep->handle; + region->map_handle = rep->map_handle; + region->map_count = 0; + region->size = size; + region->drm_fd = vws->ioctl.drm_fd; + + vmw_printf(" gmrId = %u, offset = %u\n", + region->ptr.gmrId, region->ptr.offset); + + return region; + + out_err1: + return NULL; +} + +void +vmw_ioctl_region_destroy(struct vmw_region *region) +{ + struct drm_vmw_unref_dmabuf_arg arg; + + vmw_printf("%s: gmrId = %u, offset = %u\n", __FUNCTION__, + region->ptr.gmrId, region->ptr.offset); + + if (region->data) { + munmap(region->data, region->size); + region->data = NULL; + } + + memset(&arg, 0, sizeof(arg)); + arg.handle = region->handle; + drmCommandWrite(region->drm_fd, DRM_VMW_UNREF_DMABUF, &arg, sizeof(arg)); + + FREE(region); +} + +SVGAGuestPtr +vmw_ioctl_region_ptr(struct vmw_region *region) +{ + return region->ptr; +} + +void * +vmw_ioctl_region_map(struct vmw_region *region) +{ + void *map; + + vmw_printf("%s: gmrId = %u, offset = %u\n", __FUNCTION__, + region->ptr.gmrId, region->ptr.offset); + + if (region->data == NULL) { + map = mmap(NULL, region->size, PROT_READ | PROT_WRITE, MAP_SHARED, + region->drm_fd, region->map_handle); + if (map == MAP_FAILED) { + debug_printf("%s: Map failed.\n", __FUNCTION__); + return NULL; + } + + region->data = map; + } + + ++region->map_count; + + return region->data; +} + +void +vmw_ioctl_region_unmap(struct vmw_region *region) +{ + vmw_printf("%s: gmrId = %u, offset = %u\n", __FUNCTION__, + region->ptr.gmrId, region->ptr.offset); + --region->map_count; +} + + +int +vmw_ioctl_fence_signalled(struct vmw_winsys_screen *vws, + uint32_t fence) +{ + uint32_t expected; + uint32_t current; + + assert(fence); + if(!fence) + return 0; + + expected = fence; + current = vws->ioctl.fifo_map[SVGA_FIFO_FENCE]; + + if ((int32)(current - expected) >= 0) + return 0; /* fence passed */ + else + return -1; +} + + +static void +vmw_ioctl_sync(struct vmw_winsys_screen *vws, + uint32_t fence) +{ + uint32_t cur_fence; + struct drm_vmw_fence_wait_arg arg; + int ret; + + vmw_printf("%s: fence = %lu\n", __FUNCTION__, + (unsigned long)fence); + + cur_fence = vws->ioctl.fifo_map[SVGA_FIFO_FENCE]; + vmw_printf("%s: Fence id read is 0x%08x\n", __FUNCTION__, + (unsigned int)cur_fence); + + if ((cur_fence - fence) < (1 << 24)) + return; + + memset(&arg, 0, sizeof(arg)); + arg.sequence = fence; + + do { + ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_FENCE_WAIT, &arg, + sizeof(arg)); + } while (ret == -ERESTART); +} + + +int +vmw_ioctl_fence_finish(struct vmw_winsys_screen *vws, + uint32_t fence) +{ + assert(fence); + + if(fence) { + if(vmw_ioctl_fence_signalled(vws, fence) != 0) { + vmw_ioctl_sync(vws, fence); + } + } + + return 0; +} + + +boolean +vmw_ioctl_init(struct vmw_winsys_screen *vws) +{ + struct drm_vmw_getparam_arg gp_arg; + int ret; + + VMW_FUNC; + + memset(&gp_arg, 0, sizeof(gp_arg)); + gp_arg.param = DRM_VMW_PARAM_FIFO_OFFSET; + ret = drmCommandWriteRead(vws->ioctl.drm_fd, DRM_VMW_GET_PARAM, + &gp_arg, sizeof(gp_arg)); + + if (ret) { + debug_printf("GET_PARAM on %d returned %d: %s\n", + vws->ioctl.drm_fd, ret, strerror(-ret)); + goto out_err1; + } + + vmw_printf("Offset to map is 0x%08llx\n", + (unsigned long long)gp_arg.value); + + vws->ioctl.fifo_map = vmw_ioctl_fifo_map(vws, gp_arg.value); + if (vws->ioctl.fifo_map == NULL) + goto out_err1; + + vmw_printf("%s OK\n", __FUNCTION__); + return TRUE; + + out_err1: + debug_printf("%s Failed\n", __FUNCTION__); + return FALSE; +} + + + +void +vmw_ioctl_cleanup(struct vmw_winsys_screen *vws) +{ + VMW_FUNC; + + vmw_ioctl_fifo_unmap(vws, (void *)vws->ioctl.fifo_map); +} diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen_pools.c b/src/gallium/winsys/drm/vmware/core/vmw_screen_pools.c new file mode 100644 index 0000000000..b1c24b0cb6 --- /dev/null +++ b/src/gallium/winsys/drm/vmware/core/vmw_screen_pools.c @@ -0,0 +1,79 @@ +/********************************************************** + * 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, 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. + * + **********************************************************/ + + +#include "vmw_screen.h" + +#include "vmw_buffer.h" +#include "vmw_fence.h" + +#include "pipebuffer/pb_buffer.h" +#include "pipebuffer/pb_bufmgr.h" + +void +vmw_pools_cleanup(struct vmw_winsys_screen *vws) +{ + if(vws->pools.gmr_fenced) + vws->pools.gmr_fenced->destroy(vws->pools.gmr_fenced); + + /* gmr_mm pool is already destroyed above */ + + if(vws->pools.gmr) + vws->pools.gmr->destroy(vws->pools.gmr); +} + + +boolean +vmw_pools_init(struct vmw_winsys_screen *vws) +{ + vws->pools.gmr = vmw_gmr_bufmgr_create(vws); + if(!vws->pools.gmr) + goto error; + + vws->pools.gmr_mm = mm_bufmgr_create(vws->pools.gmr, + 16*1024*1024, + 12 /* 4096 alignment */); + if(!vws->pools.gmr_mm) + goto error; + + vws->pools.gmr_fenced = fenced_bufmgr_create( + vws->pools.gmr_mm, + vmw_fence_ops_create(vws)); + +#ifdef DEBUG + vws->pools.gmr_fenced = pb_debug_manager_create(vws->pools.gmr_fenced, + 4096, + 4096); +#endif + if(!vws->pools.gmr_fenced) + goto error; + + return TRUE; + +error: + vmw_pools_cleanup(vws); + return FALSE; +} + diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen_svga.c b/src/gallium/winsys/drm/vmware/core/vmw_screen_svga.c new file mode 100644 index 0000000000..d7d008859b --- /dev/null +++ b/src/gallium/winsys/drm/vmware/core/vmw_screen_svga.c @@ -0,0 +1,295 @@ +/********************************************************** + * 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, 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. + * + **********************************************************/ + +/** + * @file + * This file implements the SVGA interface into this winsys, defined + * in drivers/svga/svga_winsys.h. + * + * @author Keith Whitwell + * @author Jose Fonseca + */ + + +#include "svga_cmd.h" +#include "svga3d_caps.h" + +#include "pipe/p_inlines.h" +#include "util/u_math.h" +#include "util/u_memory.h" +#include "pipebuffer/pb_buffer.h" +#include "pipebuffer/pb_bufmgr.h" +#include "svga_winsys.h" +#include "vmw_context.h" +#include "vmw_screen.h" +#include "vmw_surface.h" +#include "vmw_buffer.h" +#include "vmw_fence.h" + + +static struct svga_winsys_buffer * +vmw_svga_winsys_buffer_create(struct svga_winsys_screen *sws, + unsigned alignment, + unsigned usage, + unsigned size) +{ + struct vmw_winsys_screen *vws = vmw_winsys_screen(sws); + struct pb_desc desc; + struct pb_manager *provider; + struct pb_buffer *buffer; + + memset(&desc, 0, sizeof desc); + desc.alignment = alignment; + desc.usage = usage; + + provider = vws->pools.gmr_fenced; + + assert(provider); + buffer = provider->create_buffer(provider, size, &desc); + if(!buffer) + return NULL; + + return vmw_svga_winsys_buffer(buffer); +} + + +static void * +vmw_svga_winsys_buffer_map(struct svga_winsys_screen *sws, + struct svga_winsys_buffer *buf, + unsigned flags) +{ + (void)sws; + return pb_map(vmw_pb_buffer(buf), flags); +} + + +static void +vmw_svga_winsys_buffer_unmap(struct svga_winsys_screen *sws, + struct svga_winsys_buffer *buf) +{ + (void)sws; + pb_unmap(vmw_pb_buffer(buf)); +} + + +static void +vmw_svga_winsys_buffer_destroy(struct svga_winsys_screen *sws, + struct svga_winsys_buffer *buf) +{ + struct pb_buffer *pbuf = vmw_pb_buffer(buf); + (void)sws; + pb_reference(&pbuf, NULL); +} + + +static void +vmw_svga_winsys_fence_reference(struct svga_winsys_screen *sws, + struct pipe_fence_handle **pdst, + struct pipe_fence_handle *src) +{ + (void)sws; + *pdst = src; +} + + +static int +vmw_svga_winsys_fence_signalled(struct svga_winsys_screen *sws, + struct pipe_fence_handle *fence, + unsigned flag) +{ + struct vmw_winsys_screen *vws = vmw_winsys_screen(sws); + (void)flag; + return vmw_ioctl_fence_signalled(vws, vmw_fence(fence)); +} + + +static int +vmw_svga_winsys_fence_finish(struct svga_winsys_screen *sws, + struct pipe_fence_handle *fence, + unsigned flag) +{ + struct vmw_winsys_screen *vws = vmw_winsys_screen(sws); + (void)flag; + return vmw_ioctl_fence_finish(vws, vmw_fence(fence)); +} + + + +static struct svga_winsys_surface * +vmw_svga_winsys_surface_create(struct svga_winsys_screen *sws, + SVGA3dSurfaceFlags flags, + SVGA3dSurfaceFormat format, + SVGA3dSize size, + uint32 numFaces, + uint32 numMipLevels) +{ + struct vmw_winsys_screen *vws = vmw_winsys_screen(sws); + struct vmw_svga_winsys_surface *surface; + + surface = CALLOC_STRUCT(vmw_svga_winsys_surface); + if(!surface) + goto no_surface; + + pipe_reference_init(&surface->refcnt, 1); + p_atomic_set(&surface->validated, 0); + surface->screen = vws; + surface->sid = vmw_ioctl_surface_create(vws, + flags, format, size, + numFaces, numMipLevels); + if(surface->sid == SVGA3D_INVALID_ID) + goto no_sid; + + return svga_winsys_surface(surface); + +no_sid: + FREE(surface); +no_surface: + return NULL; +} + + +static boolean +vmw_svga_winsys_surface_is_flushed(struct svga_winsys_screen *sws, + struct svga_winsys_surface *surface) +{ + struct vmw_svga_winsys_surface *vsurf = vmw_svga_winsys_surface(surface); + return (p_atomic_read(&vsurf->validated) == 0); +} + + +static void +vmw_svga_winsys_surface_ref(struct svga_winsys_screen *sws, + struct svga_winsys_surface **pDst, + struct svga_winsys_surface *src) +{ + struct vmw_svga_winsys_surface *d_vsurf = vmw_svga_winsys_surface(*pDst); + struct vmw_svga_winsys_surface *s_vsurf = vmw_svga_winsys_surface(src); + + vmw_svga_winsys_surface_reference(&d_vsurf, s_vsurf); + *pDst = svga_winsys_surface(d_vsurf); +} + + +static void +vmw_svga_winsys_destroy(struct svga_winsys_screen *sws) +{ + struct vmw_winsys_screen *vws = vmw_winsys_screen(sws); + + vmw_winsys_destroy(vws); +} + + +static boolean +vmw_svga_winsys_get_cap(struct svga_winsys_screen *sws, + SVGA3dDevCapIndex index, + SVGA3dDevCapResult *result) +{ + struct vmw_winsys_screen *vws = vmw_winsys_screen(sws); + const uint32 *capsBlock; + const SVGA3dCapsRecord *capsRecord = NULL; + uint32 offset; + const SVGA3dCapPair *capArray; + int numCaps, first, last; + + if(!vws->ioctl.fifo_map) + return FALSE; + + if(vws->ioctl.fifo_map[SVGA_FIFO_3D_HWVERSION] < SVGA3D_HWVERSION_WS6_B1) + return FALSE; + + /* + * Search linearly through the caps block records for the specified type. + */ + capsBlock = (const uint32 *)&vws->ioctl.fifo_map[SVGA_FIFO_3D_CAPS]; + for (offset = 0; capsBlock[offset] != 0; offset += capsBlock[offset]) { + const SVGA3dCapsRecord *record; + assert(offset < SVGA_FIFO_3D_CAPS_SIZE); + record = (const SVGA3dCapsRecord *) (capsBlock + offset); + if ((record->header.type >= SVGA3DCAPS_RECORD_DEVCAPS_MIN) && + (record->header.type <= SVGA3DCAPS_RECORD_DEVCAPS_MAX) && + (!capsRecord || (record->header.type > capsRecord->header.type))) { + capsRecord = record; + } + } + + if(!capsRecord) + return FALSE; + + /* + * Calculate the number of caps from the size of the record. + */ + capArray = (const SVGA3dCapPair *) capsRecord->data; + numCaps = (int) ((capsRecord->header.length * sizeof(uint32) - + sizeof capsRecord->header) / (2 * sizeof(uint32))); + + /* + * Binary-search for the cap with the specified index. + */ + for (first = 0, last = numCaps - 1; first <= last; ) { + int mid = (first + last) / 2; + + if ((SVGA3dDevCapIndex) capArray[mid][0] == index) { + /* + * Found it. + */ + result->u = capArray[mid][1]; + return TRUE; + } + + /* + * Divide and conquer. + */ + if ((SVGA3dDevCapIndex) capArray[mid][0] > index) { + last = mid - 1; + } else { + first = mid + 1; + } + } + + return FALSE; +} + + +boolean +vmw_winsys_screen_init_svga(struct vmw_winsys_screen *vws) +{ + vws->base.destroy = vmw_svga_winsys_destroy; + vws->base.get_cap = vmw_svga_winsys_get_cap; + vws->base.context_create = vmw_svga_winsys_context_create; + vws->base.surface_create = vmw_svga_winsys_surface_create; + vws->base.surface_is_flushed = vmw_svga_winsys_surface_is_flushed; + vws->base.surface_reference = vmw_svga_winsys_surface_ref; + vws->base.buffer_create = vmw_svga_winsys_buffer_create; + vws->base.buffer_map = vmw_svga_winsys_buffer_map; + vws->base.buffer_unmap = vmw_svga_winsys_buffer_unmap; + vws->base.buffer_destroy = vmw_svga_winsys_buffer_destroy; + vws->base.fence_reference = vmw_svga_winsys_fence_reference; + vws->base.fence_signalled = vmw_svga_winsys_fence_signalled; + vws->base.fence_finish = vmw_svga_winsys_fence_finish; + + return TRUE; +} + + diff --git a/src/gallium/winsys/drm/vmware/core/vmw_surface.c b/src/gallium/winsys/drm/vmware/core/vmw_surface.c new file mode 100644 index 0000000000..9ec4bf9272 --- /dev/null +++ b/src/gallium/winsys/drm/vmware/core/vmw_surface.c @@ -0,0 +1,59 @@ +/********************************************************** + * 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, 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. + * + **********************************************************/ + + +#include "svga_cmd.h" +#include "util/u_debug.h" +#include "util/u_memory.h" + +#include "vmw_surface.h" +#include "vmw_screen.h" + +void +vmw_svga_winsys_surface_reference(struct vmw_svga_winsys_surface **pdst, + struct vmw_svga_winsys_surface *src) +{ + struct pipe_reference *src_ref; + struct pipe_reference *dst_ref; + struct vmw_svga_winsys_surface *dst = *pdst; + + if(*pdst == src || pdst == NULL) + return; + + src_ref = src ? &src->refcnt : NULL; + dst_ref = dst ? &dst->refcnt : NULL; + + if (pipe_reference(&dst_ref, src_ref)) { + vmw_ioctl_surface_destroy(dst->screen, dst->sid); +#ifdef DEBUG + /* to detect dangling pointers */ + assert(p_atomic_read(&dst->validated) == 0); + dst->sid = SVGA3D_INVALID_ID; +#endif + FREE(dst); + } + + *pdst = src; +} diff --git a/src/gallium/winsys/drm/vmware/core/vmw_surface.h b/src/gallium/winsys/drm/vmware/core/vmw_surface.h new file mode 100644 index 0000000000..340cc1532e --- /dev/null +++ b/src/gallium/winsys/drm/vmware/core/vmw_surface.h @@ -0,0 +1,79 @@ +/********************************************************** + * 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, 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. + * + **********************************************************/ + +/** + * @file + * Surfaces for VMware SVGA winsys. + * + * @author Jose Fonseca + */ + + +#ifndef VMW_SURFACE_H_ +#define VMW_SURFACE_H_ + + +#include "pipe/p_compiler.h" +#include "pipe/p_atomic.h" +#include "pipe/p_refcnt.h" + +#define VMW_MAX_PRESENTS 3 + + + +struct vmw_svga_winsys_surface +{ + struct pipe_atomic validated; + struct pipe_reference refcnt; + + struct vmw_winsys_screen *screen; + uint32_t sid; + + /* FIXME: make this thread safe */ + unsigned next_present_no; + uint32_t present_fences[VMW_MAX_PRESENTS]; +}; + + +static INLINE struct svga_winsys_surface * +svga_winsys_surface(struct vmw_svga_winsys_surface *surf) +{ + assert(!surf || surf->sid != SVGA3D_INVALID_ID); + return (struct svga_winsys_surface *)surf; +} + + +static INLINE struct vmw_svga_winsys_surface * +vmw_svga_winsys_surface(struct svga_winsys_surface *surf) +{ + return (struct vmw_svga_winsys_surface *)surf; +} + + +void +vmw_svga_winsys_surface_reference(struct vmw_svga_winsys_surface **pdst, + struct vmw_svga_winsys_surface *src); + +#endif /* VMW_SURFACE_H_ */ diff --git a/src/gallium/winsys/drm/vmware/dri/Makefile b/src/gallium/winsys/drm/vmware/dri/Makefile new file mode 100644 index 0000000000..8a39e23da6 --- /dev/null +++ b/src/gallium/winsys/drm/vmware/dri/Makefile @@ -0,0 +1,18 @@ + +TOP = ../../../../../.. +include $(TOP)/configs/current + +LIBNAME = vmwgfx_dri.so + +PIPE_DRIVERS = \ + $(TOP)/src/gallium/state_trackers/dri/libdridrm.a \ + $(TOP)/src/gallium/winsys/drm/vmware/core/libsvgadrm.a \ + $(TOP)/src/gallium/drivers/trace/libtrace.a \ + $(TOP)/src/gallium/drivers/svga/libsvga.a + +C_SOURCES = \ + $(COMMON_GALLIUM_SOURCES) + +include ../../Makefile.template + +symlinks: diff --git a/src/gallium/winsys/drm/vmware/dri/SConscript b/src/gallium/winsys/drm/vmware/dri/SConscript new file mode 100644 index 0000000000..adf2bf16d1 --- /dev/null +++ b/src/gallium/winsys/drm/vmware/dri/SConscript @@ -0,0 +1,63 @@ +import os +import os.path + +Import('*') + +if env['platform'] == 'linux': + + if env['dri']: + env = env.Clone() + + sources = [ + '#/src/mesa/drivers/dri/common/utils.c', + '#/src/mesa/drivers/dri/common/vblank.c', + '#/src/mesa/drivers/dri/common/dri_util.c', + '#/src/mesa/drivers/dri/common/xmlconfig.c', + ] + + + env.ParseConfig('pkg-config --cflags --libs libdrm') + + env.Prepend(CPPPATH = [ + '#/src/mesa/state_tracker', + '#/src/mesa/drivers/dri/common', + '#/src/mesa/main', + '#/src/mesa/glapi', + '#/src/mesa', + '#/include', + '#/src/gallium/drivers/svga', + '#/src/gallium/drivers/svga/include', + ]) + + env.Append(CPPDEFINES = [ + 'HAVE_STDINT_H', + 'HAVE_SYS_TYPES_H', + ]) + + env.Append(CFLAGS = [ + '-Werror', + '-std=gnu99', + '-D_FILE_OFFSET_BITS=64', + ]) + + env.Prepend(LIBPATH = [ + ]) + + env.Prepend(LIBS = [ + trace, + st_dri, + svgadrm, + svga, + mesa, + auxiliaries, + ]) + + # TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions + env.LoadableModule( + target ='vmwgfx_dri.so', + source = sources, + LIBS = env['LIBS'], + SHLIBPREFIX = '', + ) + + diff --git a/src/gallium/winsys/drm/vmware/egl/Makefile b/src/gallium/winsys/drm/vmware/egl/Makefile new file mode 100644 index 0000000000..8e2980c318 --- /dev/null +++ b/src/gallium/winsys/drm/vmware/egl/Makefile @@ -0,0 +1,18 @@ + +TOP = ../../../../../.. +include $(TOP)/configs/current + +LIBNAME = EGL_svga.so + +PIPE_DRIVERS = \ + $(TOP)/src/gallium/state_trackers/egl/libegldrm.a \ + $(TOP)/src/gallium/winsys/drm/vmware/core/libsvgadrm.a \ + $(TOP)/src/gallium/drivers/trace/libtrace.a \ + $(TOP)/src/gallium/drivers/svga/libsvga.a + +C_SOURCES = \ + $(COMMON_GALLIUM_SOURCES) + +include ../../Makefile.template + +symlinks: diff --git a/src/gallium/winsys/drm/vmware/xorg/Makefile b/src/gallium/winsys/drm/vmware/xorg/Makefile new file mode 100644 index 0000000000..e152263256 --- /dev/null +++ b/src/gallium/winsys/drm/vmware/xorg/Makefile @@ -0,0 +1,54 @@ +TARGET = vmwgfx_drv.so +CFILES = $(wildcard ./*.c) +OBJECTS = $(patsubst ./%.c,./%.o,$(CFILES)) +TOP = ../../../../../.. + +include $(TOP)/configs/current + +INCLUDES = \ + $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \ + -I../gem \ + -I$(TOP)/src/gallium/include \ + -I$(TOP)/src/gallium/drivers \ + -I$(TOP)/src/gallium/auxiliary \ + -I$(TOP)/src/gallium + +LIBS = \ + $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a \ + $(TOP)/src/gallium/winsys/drm/vmware/core/libsvgadrm.a \ + $(TOP)/src/gallium/drivers/trace/libtrace.a \ + $(TOP)/src/gallium/drivers/svga/libsvga.a \ + $(GALLIUM_AUXILIARIES) + +DRIVER_DEFINES = \ + -DHAVE_CONFIG_H + + +############################################# + + + +all default: $(TARGET) + +$(TARGET): $(OBJECTS) Makefile $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a $(LIBS) + $(TOP)/bin/mklib -noprefix -o $@ \ + $(OBJECTS) $(LIBS) $(shell pkg-config --libs libdrm) -ldrm_intel + +clean: + rm -rf $(OBJECTS) $(TARGET) + +install: + $(INSTALL) -d $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR) + $(MINSTALL) -m 755 $(TARGET) $(DESTDIR)/$(XORG_DRIVER_INSTALL_DIR) + + +############################################## + + +.c.o: + $(CC) -c $(CFLAGS) $(INCLUDES) $(DRIVER_DEFINES) $< -o $@ + + +############################################## + +.PHONY = all clean install diff --git a/src/gallium/winsys/drm/vmware/xorg/SConscript b/src/gallium/winsys/drm/vmware/xorg/SConscript new file mode 100644 index 0000000000..41a489774c --- /dev/null +++ b/src/gallium/winsys/drm/vmware/xorg/SConscript @@ -0,0 +1,55 @@ +import os.path + +Import('*') + +if env['platform'] == 'linux': + + env = env.Clone() + + env.ParseConfig('pkg-config --cflags --libs libdrm xorg-server') + + env.Prepend(CPPPATH = [ + '#/include', + '#/src/gallium', + '#/src/mesa', + '#/src/gallium/drivers/svga', + '#/src/gallium/drivers/svga/include', + ]) + + env.Append(CPPDEFINES = [ + ]) + + if env['gcc']: + env.Append(CPPDEFINES = [ + 'HAVE_STDINT_H', + 'HAVE_SYS_TYPES_H', + ]) + env.Append(CFLAGS = ['-Werror']) + + env.Append(CFLAGS = [ + '-std=gnu99', + '-D_FILE_OFFSET_BITS=64', + ]) + + env.Prepend(LIBPATH = [ + ]) + + env.Prepend(LIBS = [ + trace, + st_xorg, + svgadrm, + svga, + auxiliaries, + ]) + + sources = [ + 'vmw_xorg.c', + ] + + # TODO: write a wrapper function http://www.scons.org/wiki/WrapperFunctions + env.LoadableModule( + target ='vmwgfx_drv.so', + source = sources, + LIBS = env['LIBS'], + SHLIBPREFIX = '', + ) diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c b/src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c new file mode 100644 index 0000000000..3acc110ae7 --- /dev/null +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c @@ -0,0 +1,150 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +/** + * @file + * Glue file for Xorg State Tracker. + * + * @author Alan Hourihane + * @author Jakob Bornecrantz + */ + +#include "state_trackers/xorg/xorg_winsys.h" + +static void vmw_xorg_identify(int flags); +static Bool vmw_xorg_pci_probe(DriverPtr driver, + int entity_num, + struct pci_device *device, + intptr_t match_data); + +static const struct pci_id_match vmw_xorg_device_match[] = { + {0x15ad, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, 0, 0, 0}, + {0, 0, 0, 0, 0, 0, 0}, +}; + +static SymTabRec vmw_xorg_chipsets[] = { + {PCI_MATCH_ANY, "VMware SVGA Device"}, + {-1, NULL} +}; + +static PciChipsets vmw_xorg_pci_devices[] = { + {PCI_MATCH_ANY, PCI_MATCH_ANY, NULL}, + {-1, -1, NULL} +}; + +static XF86ModuleVersionInfo vmw_xorg_version = { + "vmwgfx", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XORG_VERSION_CURRENT, + 0, 1, 0, /* major, minor, patch */ + ABI_CLASS_VIDEODRV, + ABI_VIDEODRV_VERSION, + MOD_CLASS_VIDEODRV, + {0, 0, 0, 0} +}; + +/* + * Xorg driver exported structures + */ + +_X_EXPORT DriverRec vmwgfx = { + 1, + "vmwgfx", + vmw_xorg_identify, + NULL, + xorg_tracker_available_options, + NULL, + 0, + NULL, + vmw_xorg_device_match, + vmw_xorg_pci_probe +}; + +static MODULESETUPPROTO(vmw_xorg_setup); + +_X_EXPORT XF86ModuleData vmwgfxModuleData = { + &vmw_xorg_version, + vmw_xorg_setup, + NULL +}; + +/* + * Xorg driver functions + */ + +static pointer +vmw_xorg_setup(pointer module, pointer opts, int *errmaj, int *errmin) +{ + static Bool setupDone = 0; + + /* This module should be loaded only once, but check to be sure. + */ + if (!setupDone) { + setupDone = 1; + xf86AddDriver(&vmwgfx, module, HaveDriverFuncs); + + /* + * The return value must be non-NULL on success even though there + * is no TearDownProc. + */ + return (pointer) 1; + } else { + if (errmaj) + *errmaj = LDR_ONCEONLY; + return NULL; + } +} + +static void +vmw_xorg_identify(int flags) +{ + xf86PrintChipsets("vmwgfx", "Driver for VMware SVGA device", + vmw_xorg_chipsets); +} + +static Bool +vmw_xorg_pci_probe(DriverPtr driver, + int entity_num, struct pci_device *device, intptr_t match_data) +{ + ScrnInfoPtr scrn = NULL; + EntityInfoPtr entity; + + scrn = xf86ConfigPciEntity(scrn, 0, entity_num, vmw_xorg_pci_devices, + NULL, NULL, NULL, NULL, NULL); + if (scrn != NULL) { + scrn->driverVersion = 1; + scrn->driverName = "vmwgfx"; + scrn->name = "vmwgfx"; + scrn->Probe = NULL; + + entity = xf86GetEntityInfo(entity_num); + + /* Use all the functions from the xorg tracker */ + xorg_tracker_set_functions(scrn); + } + return scrn != NULL; +} -- cgit v1.2.3 From f7109aaf6c6020da89a0683cf5548181f2db36fb Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 17 Nov 2009 02:56:04 +0100 Subject: svga: Add vmwgfx_drm.h file from vmwgfx kernel driver Add the vmwgfx_drm.h header for now, this allows the svga driver to be enabled by default without forcing people to install the vmwgfx_drm.h header on their system. To be removed once vmwgfx_drm.h is in libdrm. --- src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h | 442 ++++++++++++++++++++++++ 1 file changed, 442 insertions(+) create mode 100644 src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h b/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h new file mode 100644 index 0000000000..6705dd4289 --- /dev/null +++ b/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h @@ -0,0 +1,442 @@ +/************************************************************************** + * + * Copyright © 2009 VMware, Inc., Palo Alto, CA., USA + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + **************************************************************************/ + +#ifndef _VMWGFX_DRM_H_ +#define _VMWGFX_DRM_H_ + +#define DRM_VMW_MAX_SURFACE_FACES 6 +#define DRM_VMW_MAX_MIP_LEVELS 24 + +#define DRM_VMW_EXT_NAME_LEN 128 + +#define DRM_VMW_GET_PARAM 1 +#define DRM_VMW_EXTENSION 2 +#define DRM_VMW_CREATE_CONTEXT 3 +#define DRM_VMW_UNREF_CONTEXT 4 +#define DRM_VMW_CREATE_SURFACE 5 +#define DRM_VMW_UNREF_SURFACE 6 +#define DRM_VMW_REF_SURFACE 7 +#define DRM_VMW_EXECBUF 8 +#define DRM_VMW_ALLOC_DMABUF 9 +#define DRM_VMW_UNREF_DMABUF 10 +#define DRM_VMW_FIFO_DEBUG 11 +#define DRM_VMW_FENCE_WAIT 12 + + +/*************************************************************************/ +/** + * DRM_VMW_GET_PARAM - get device information. + * + * Currently we support only one parameter: + * + * DRM_VMW_PARAM_FIFO_OFFSET: + * Offset to use to map the first page of the FIFO read-only. + * The fifo is mapped using the mmap() system call on the drm device. + */ + +#define DRM_VMW_PARAM_FIFO_OFFSET 0 + +/** + * struct drm_vmw_getparam_arg + * + * @value: Returned value. //Out + * @param: Parameter to query. //In. + * + * Argument to the DRM_VMW_GET_PARAM Ioctl. + */ + +struct drm_vmw_getparam_arg { + uint64_t value; + uint32_t param; + uint32_t pad64; +}; + +/*************************************************************************/ +/** + * DRM_VMW_EXTENSION - Query device extensions. + */ + +/** + * struct drm_vmw_extension_rep + * + * @exists: The queried extension exists. + * @driver_ioctl_offset: Ioctl number of the first ioctl in the extension. + * @driver_sarea_offset: Offset to any space in the DRI SAREA + * used by the extension. + * @major: Major version number of the extension. + * @minor: Minor version number of the extension. + * @pl: Patch level version number of the extension. + * + * Output argument to the DRM_VMW_EXTENSION Ioctl. + */ + +struct drm_vmw_extension_rep { + int32_t exists; + uint32_t driver_ioctl_offset; + uint32_t driver_sarea_offset; + uint32_t major; + uint32_t minor; + uint32_t pl; + uint32_t pad64; +}; + +/** + * union drm_vmw_extension_arg + * + * @extension - Ascii name of the extension to be queried. //In + * @rep - Reply as defined above. //Out + * + * Argument to the DRM_VMW_EXTENSION Ioctl. + */ + +union drm_vmw_extension_arg { + char extension[DRM_VMW_EXT_NAME_LEN]; + struct drm_vmw_extension_rep rep; +}; + +/*************************************************************************/ +/** + * DRM_VMW_CREATE_CONTEXT - Create a host context. + * + * Allocates a device unique context id, and queues a create context command + * for the host. Does not wait for host completion. + */ + +/** + * struct drm_vmw_context_arg + * + * @cid: Device unique context ID. + * + * Output argument to the DRM_VMW_CREATE_CONTEXT Ioctl. + * Input argument to the DRM_VMW_UNREF_CONTEXT Ioctl. + */ + +struct drm_vmw_context_arg { + int32_t cid; + uint32_t pad64; +}; + +/*************************************************************************/ +/** + * DRM_VMW_UNREF_CONTEXT - Create a host context. + * + * Frees a global context id, and queues a destroy host command for the host. + * Does not wait for host completion. The context ID can be used directly + * in the command stream and shows up as the same context ID on the host. + */ + +/*************************************************************************/ +/** + * DRM_VMW_CREATE_SURFACE - Create a host suface. + * + * Allocates a device unique surface id, and queues a create surface command + * for the host. Does not wait for host completion. The surface ID can be + * used directly in the command stream and shows up as the same surface + * ID on the host. + */ + +/** + * struct drm_wmv_surface_create_req + * + * @flags: Surface flags as understood by the host. + * @format: Surface format as understood by the host. + * @mip_levels: Number of mip levels for each face. + * An unused face should have 0 encoded. + * @size_addr: Address of a user-space array of sruct drm_vmw_size + * cast to an uint64_t for 32-64 bit compatibility. + * The size of the array should equal the total number of mipmap levels. + * @shareable: Boolean whether other clients (as identified by file descriptors) + * may reference this surface. + * + * Input data to the DRM_VMW_CREATE_SURFACE Ioctl. + * Output data from the DRM_VMW_REF_SURFACE Ioctl. + */ + +struct drm_vmw_surface_create_req { + uint32_t flags; + uint32_t format; + uint32_t mip_levels[DRM_VMW_MAX_SURFACE_FACES]; + uint64_t size_addr; + int32_t shareable; + uint32_t pad64; +}; + +/** + * struct drm_wmv_surface_arg + * + * @sid: Surface id of created surface or surface to destroy or reference. + * + * Output data from the DRM_VMW_CREATE_SURFACE Ioctl. + * Input argument to the DRM_VMW_UNREF_SURFACE Ioctl. + * Input argument to the DRM_VMW_REF_SURFACE Ioctl. + */ + +struct drm_vmw_surface_arg { + int32_t sid; + uint32_t pad64; +}; + +/** + * struct drm_vmw_size ioctl. + * + * @width - mip level width + * @height - mip level height + * @depth - mip level depth + * + * Description of a mip level. + * Input data to the DRM_WMW_CREATE_SURFACE Ioctl. + */ + +struct drm_vmw_size { + uint32_t width; + uint32_t height; + uint32_t depth; + uint32_t pad64; +}; + +/** + * union drm_vmw_surface_create_arg + * + * @rep: Output data as described above. + * @req: Input data as described above. + * + * Argument to the DRM_VMW_CREATE_SURFACE Ioctl. + */ + +union drm_vmw_surface_create_arg { + struct drm_vmw_surface_arg rep; + struct drm_vmw_surface_create_req req; +}; + +/*************************************************************************/ +/** + * DRM_VMW_REF_SURFACE - Reference a host surface. + * + * Puts a reference on a host surface with a give sid, as previously + * returned by the DRM_VMW_CREATE_SURFACE ioctl. + * A reference will make sure the surface isn't destroyed while we hold + * it and will allow the calling client to use the surface ID in the command + * stream. + * + * On successful return, the Ioctl returns the surface information given + * in the DRM_VMW_CREATE_SURFACE ioctl. + */ + +/** + * union drm_vmw_surface_reference_arg + * + * @rep: Output data as described above. + * @req: Input data as described above. + * + * Argument to the DRM_VMW_REF_SURFACE Ioctl. + */ + +union drm_vmw_surface_reference_arg { + struct drm_vmw_surface_create_req rep; + struct drm_vmw_surface_arg req; +}; + +/*************************************************************************/ +/** + * DRM_VMW_UNREF_SURFACE - Unreference a host surface. + * + * Clear a reference previously put on a host surface. + * When all references are gone, including the one implicitly placed + * on creation, + * a destroy surface command will be queued for the host. + * Does not wait for completion. + */ + +/*************************************************************************/ +/** + * DRM_VMW_EXECBUF + * + * Submit a command buffer for execution on the host, and return a + * fence sequence that when signaled, indicates that the command buffer has + * executed. + */ + +/** + * struct drm_vmw_execbuf_arg + * + * @commands: User-space address of a command buffer cast to an uint64_t. + * @command-size: Size in bytes of the command buffer. + * @fence_rep: User-space address of a struct drm_vmw_fence_rep cast to an + * uint64_t. + * + * Argument to the DRM_VMW_EXECBUF Ioctl. + */ + +struct drm_vmw_execbuf_arg { + uint64_t commands; + uint32_t command_size; + uint32_t pad64; + uint64_t fence_rep; +}; + +/** + * struct drm_vmw_fence_rep + * + * @fence_seq: Fence sequence associated with a command submission. + * @error: This member should've been set to -EFAULT on submission. + * The following actions should be take on completion: + * error == -EFAULT: Fence communication failed. The host is synchronized. + * Use the last fence id read from the FIFO fence register. + * error != 0 && error != -EFAULT: + * Fence submission failed. The host is synchronized. Use the fence_seq member. + * error == 0: All is OK, The host may not be synchronized. + * Use the fence_seq member. + * + * Input / Output data to the DRM_VMW_EXECBUF Ioctl. + */ + +struct drm_vmw_fence_rep { + uint64_t fence_seq; + int32_t error; + uint32_t pad64; +}; + +/*************************************************************************/ +/** + * DRM_VMW_ALLOC_DMABUF + * + * Allocate a DMA buffer that is visible also to the host. + * NOTE: The buffer is + * identified by a handle and an offset, which are private to the guest, but + * useable in the command stream. The guest kernel may translate these + * and patch up the command stream accordingly. In the future, the offset may + * be zero at all times, or it may disappear from the interface before it is + * fixed. + * + * The DMA buffer may stay user-space mapped in the guest at all times, + * and is thus suitable for sub-allocation. + * + * DMA buffers are mapped using the mmap() syscall on the drm device. + */ + +/** + * struct drm_vmw_alloc_dmabuf_req + * + * @size: Required minimum size of the buffer. + * + * Input data to the DRM_VMW_ALLOC_DMABUF Ioctl. + */ + +struct drm_vmw_alloc_dmabuf_req { + uint32_t size; + uint32_t pad64; +}; + +/** + * struct drm_vmw_dmabuf_rep + * + * @map_handle: Offset to use in the mmap() call used to map the buffer. + * @handle: Handle unique to this buffer. Used for unreferencing. + * @cur_gmr_id: GMR id to use in the command stream when this buffer is + * referenced. See not above. + * @cur_gmr_offset: Offset to use in the command stream when this buffer is + * referenced. See note above. + * + * Output data from the DRM_VMW_ALLOC_DMABUF Ioctl. + */ + +struct drm_vmw_dmabuf_rep { + uint64_t map_handle; + uint32_t handle; + uint32_t cur_gmr_id; + uint32_t cur_gmr_offset; + uint32_t pad64; +}; + +/** + * union drm_vmw_dmabuf_arg + * + * @req: Input data as described above. + * @rep: Output data as described above. + * + * Argument to the DRM_VMW_ALLOC_DMABUF Ioctl. + */ + +union drm_vmw_alloc_dmabuf_arg { + struct drm_vmw_alloc_dmabuf_req req; + struct drm_vmw_dmabuf_rep rep; +}; + +/*************************************************************************/ +/** + * DRM_VMW_UNREF_DMABUF - Free a DMA buffer. + * + */ + +/** + * struct drm_vmw_unref_dmabuf_arg + * + * @handle: Handle indicating what buffer to free. Obtained from the + * DRM_VMW_ALLOC_DMABUF Ioctl. + * + * Argument to the DRM_VMW_UNREF_DMABUF Ioctl. + */ + +struct drm_vmw_unref_dmabuf_arg { + uint32_t handle; + uint32_t pad64; +}; + +/*************************************************************************/ +/** + * DRM_VMW_FIFO_DEBUG - Get last FIFO submission. + * + * This IOCTL copies the last FIFO submission directly out of the FIFO buffer. + */ + +/** + * struct drm_vmw_fifo_debug_arg + * + * @debug_buffer: User space address of a debug_buffer cast to an uint64_t //In + * @debug_buffer_size: Size in bytes of debug buffer //In + * @used_size: Number of bytes copied to the buffer // Out + * @did_not_fit: Boolean indicating that the fifo contents did not fit. //Out + * + * Argument to the DRM_VMW_FIFO_DEBUG Ioctl. + */ + +struct drm_vmw_fifo_debug_arg { + uint64_t debug_buffer; + uint32_t debug_buffer_size; + uint32_t used_size; + int32_t did_not_fit; + uint32_t pad64; +}; + +struct drm_vmw_fence_wait_arg { + uint64_t sequence; + uint64_t kernel_cookie; + int32_t cookie_valid; + int32_t pad64; +}; + +#endif -- cgit v1.2.3 From 60769b232c8eedddc24f25ab91f35bcb6973dded Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Thu, 12 Nov 2009 01:28:26 +0100 Subject: svga: Build svga driver --- src/gallium/winsys/drm/SConscript | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/gallium/winsys/drm/SConscript b/src/gallium/winsys/drm/SConscript index a9e9f2682a..9f7b383d2d 100644 --- a/src/gallium/winsys/drm/SConscript +++ b/src/gallium/winsys/drm/SConscript @@ -48,6 +48,11 @@ if env['dri']: # $(INSTALL) -d $(DRI_DRIVER_INSTALL_DIR) # $(INSTALL) -m 755 $(LIBNAME) $(DRI_DRIVER_INSTALL_DIR) + if 'vmware' in env['winsys']: + SConscript([ + 'vmware/SConscript', + ]) + if 'intel' in env['winsys']: SConscript([ 'intel/SConscript', -- cgit v1.2.3 From e015a4c29bf61077a50780cc99381510671b20ec Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 17 Nov 2009 16:06:26 +1000 Subject: radeon: rn50's have no 3D engine so don't try and init 3D driver. --- src/mesa/drivers/dri/radeon/radeon_screen.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 7a124a8be6..2bcceb16d6 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -390,12 +390,14 @@ static int radeon_set_screen_flags(radeonScreenPtr screen, int device_id) screen->device_id = device_id; screen->chip_flags = 0; switch ( device_id ) { + case PCI_CHIP_RN50_515E: + case PCI_CHIP_RN50_5969: + return -1; + case PCI_CHIP_RADEON_LY: case PCI_CHIP_RADEON_LZ: case PCI_CHIP_RADEON_QY: case PCI_CHIP_RADEON_QZ: - case PCI_CHIP_RN50_515E: - case PCI_CHIP_RN50_5969: screen->chip_family = CHIP_FAMILY_RV100; break; -- cgit v1.2.3 From 2d0c2952566810ef1b277b49b064f4874a973112 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 17 Nov 2009 08:05:22 +0100 Subject: Add MESA_FORMAT_XRGB8888_REV. --- src/mesa/main/formats.c | 9 +++++++++ src/mesa/main/formats.h | 1 + src/mesa/main/texfetch.c | 7 +++++++ src/mesa/main/texfetch_tmp.h | 24 ++++++++++++++++++++++++ src/mesa/main/texstore.c | 11 ++++++++--- 5 files changed, 49 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 7d64c462b1..329b795074 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -132,6 +132,15 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ 1, 1, 4 /* BlockWidth/Height,Bytes */ }, + { + MESA_FORMAT_XRGB8888_REV, /* Name */ + "MESA_FORMAT_XRGB8888_REV", /* StrName */ + GL_RGB, /* BaseFormat */ + GL_UNSIGNED_NORMALIZED, /* DataType */ + 8, 8, 8, 0, /* Red/Green/Blue/AlphaBits */ + 0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */ + 1, 1, 4 /* BlockWidth/Height,Bytes */ + }, { MESA_FORMAT_RGB888, /* Name */ "MESA_FORMAT_RGB888", /* StrName */ diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index d3ac436b1b..eba28a69be 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -55,6 +55,7 @@ typedef enum MESA_FORMAT_ARGB8888, /* AAAA AAAA RRRR RRRR GGGG GGGG BBBB BBBB */ MESA_FORMAT_ARGB8888_REV, /* BBBB BBBB GGGG GGGG RRRR RRRR AAAA AAAA */ MESA_FORMAT_XRGB8888, /* xxxx xxxx RRRR RRRR GGGG GGGG BBBB BBBB */ + MESA_FORMAT_XRGB8888_REV, /* BBBB BBBB GGGG GGGG RRRR RRRR xxxx xxxx */ MESA_FORMAT_RGB888, /* RRRR RRRR GGGG GGGG BBBB BBBB */ MESA_FORMAT_BGR888, /* BBBB BBBB GGGG GGGG RRRR RRRR */ MESA_FORMAT_RGB565, /* RRRR RGGG GGGB BBBB */ diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c index c431d3a1db..f4f2be48c3 100644 --- a/src/mesa/main/texfetch.c +++ b/src/mesa/main/texfetch.c @@ -375,6 +375,13 @@ texfetch_funcs[MESA_FORMAT_COUNT] = fetch_texel_3d_f_xrgb8888, store_texel_xrgb8888 }, + { + MESA_FORMAT_XRGB8888_REV, + fetch_texel_1d_f_xrgb8888_rev, + fetch_texel_2d_f_xrgb8888_rev, + fetch_texel_3d_f_xrgb8888_rev, + store_texel_xrgb8888_rev, + }, { MESA_FORMAT_RGB888, fetch_texel_1d_f_rgb888, diff --git a/src/mesa/main/texfetch_tmp.h b/src/mesa/main/texfetch_tmp.h index 093e0abc49..6fac7ba1e1 100644 --- a/src/mesa/main/texfetch_tmp.h +++ b/src/mesa/main/texfetch_tmp.h @@ -559,6 +559,30 @@ static void store_texel_xrgb8888(struct gl_texture_image *texImage, #endif +/* MESA_FORMAT_XRGB8888_REV **************************************************/ + +/* Fetch texel from 1D, 2D or 3D xrgb8888_rev texture, return 4 GLfloats */ +static void FETCH(f_xrgb8888_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_FLOAT( (s >> 8) & 0xff ); + texel[GCOMP] = UBYTE_TO_FLOAT( (s >> 16) & 0xff ); + texel[BCOMP] = UBYTE_TO_FLOAT( (s >> 24) ); + texel[ACOMP] = 1.0f; +} + +#if DIM == 3 +static void store_texel_xrgb8888_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(rgba[BCOMP], rgba[GCOMP], rgba[RCOMP], 0xff); +} +#endif + + /* MESA_FORMAT_RGB888 ********************************************************/ /* Fetch texel from 1D, 2D or 3D rgb888 texture, return 4 GLchans */ diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 7cf3287713..abb4ed2663 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -1410,7 +1410,8 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) ASSERT(dstFormat == MESA_FORMAT_ARGB8888 || dstFormat == MESA_FORMAT_ARGB8888_REV || - dstFormat == MESA_FORMAT_XRGB8888); + dstFormat == MESA_FORMAT_XRGB8888 || + dstFormat == MESA_FORMAT_XRGB8888_REV ); ASSERT(texelBytes == 4); if (!ctx->_ImageTransferState && @@ -1431,7 +1432,8 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) } else if (!ctx->_ImageTransferState && !srcPacking->SwapBytes && - dstFormat == MESA_FORMAT_ARGB8888_REV && + (dstFormat == MESA_FORMAT_ARGB8888_REV || + dstFormat == MESA_FORMAT_XRGB8888_REV) && baseInternalFormat == GL_RGBA && srcFormat == GL_BGRA && ((srcType == GL_UNSIGNED_BYTE && !littleEndian) || @@ -1524,7 +1526,8 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) */ if ((littleEndian && dstFormat == MESA_FORMAT_ARGB8888) || (littleEndian && dstFormat == MESA_FORMAT_XRGB8888) || - (!littleEndian && dstFormat == MESA_FORMAT_ARGB8888_REV)) { + (!littleEndian && dstFormat == MESA_FORMAT_ARGB8888_REV) || + (!littleEndian && dstFormat == MESA_FORMAT_XRGB8888_REV)) { dstmap[3] = 3; /* alpha */ dstmap[2] = 0; /* red */ dstmap[1] = 1; /* green */ @@ -1533,6 +1536,7 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) else { assert((littleEndian && dstFormat == MESA_FORMAT_ARGB8888_REV) || (!littleEndian && dstFormat == MESA_FORMAT_ARGB8888) || + (littleEndian && dstFormat == MESA_FORMAT_XRGB8888_REV) || (!littleEndian && dstFormat == MESA_FORMAT_XRGB8888)); dstmap[3] = 2; dstmap[2] = 1; @@ -3133,6 +3137,7 @@ texstore_funcs[MESA_FORMAT_COUNT] = { MESA_FORMAT_ARGB8888, _mesa_texstore_argb8888 }, { MESA_FORMAT_ARGB8888_REV, _mesa_texstore_argb8888 }, { MESA_FORMAT_XRGB8888, _mesa_texstore_argb8888 }, + { MESA_FORMAT_XRGB8888_REV, _mesa_texstore_argb8888 }, { MESA_FORMAT_RGB888, _mesa_texstore_rgb888 }, { MESA_FORMAT_BGR888, _mesa_texstore_bgr888 }, { MESA_FORMAT_RGB565, _mesa_texstore_rgb565 }, -- cgit v1.2.3 From f2651264d385fb31f89859fc1287ca0e41835cf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 17 Nov 2009 08:05:22 +0100 Subject: radeon: FBO fixes for big endian. --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 15 +++++++++++++ src/mesa/drivers/dri/radeon/radeon_fbo.c | 34 ++++++++++++++++++++++------- src/mesa/drivers/dri/radeon/radeon_screen.c | 6 ++--- 3 files changed, 44 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 1e2a54f634..c7996eb76a 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -281,12 +281,27 @@ static void emit_cb_offset(GLcontext *ctx, struct radeon_state_atom * atom) cbpitch |= R300_COLOR_FORMAT_ARGB8888; else switch (rrb->base.Format) { case MESA_FORMAT_RGB565: + assert(_mesa_little_endian()); + cbpitch |= R300_COLOR_FORMAT_RGB565; + break; + case MESA_FORMAT_RGB565_REV: + assert(!_mesa_little_endian()); cbpitch |= R300_COLOR_FORMAT_RGB565; break; case MESA_FORMAT_ARGB4444: + assert(_mesa_little_endian()); + cbpitch |= R300_COLOR_FORMAT_ARGB4444; + break; + case MESA_FORMAT_ARGB4444_REV: + assert(!_mesa_little_endian()); cbpitch |= R300_COLOR_FORMAT_ARGB4444; break; case MESA_FORMAT_ARGB1555: + assert(_mesa_little_endian()); + cbpitch |= R300_COLOR_FORMAT_ARGB1555; + break; + case MESA_FORMAT_ARGB1555_REV: + assert(!_mesa_little_endian()); cbpitch |= R300_COLOR_FORMAT_ARGB1555; break; default: diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index bf69cd9337..7ec641ff18 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -90,7 +90,7 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: - rb->Format = MESA_FORMAT_RGB565; + rb->Format = _dri_texformat_rgb565; rb->DataType = GL_UNSIGNED_BYTE; cpp = 2; break; @@ -99,7 +99,7 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_RGB10: case GL_RGB12: case GL_RGB16: - rb->Format = MESA_FORMAT_ARGB8888; + rb->Format = _dri_texformat_argb8888; rb->DataType = GL_UNSIGNED_BYTE; cpp = 4; break; @@ -111,7 +111,7 @@ radeon_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: - rb->Format = MESA_FORMAT_ARGB8888; + rb->Format = _dri_texformat_argb8888; rb->DataType = GL_UNSIGNED_BYTE; cpp = 4; break; @@ -261,14 +261,32 @@ radeon_create_renderbuffer(gl_format format, __DRIdrawablePrivate *driDrawPriv) switch (format) { case MESA_FORMAT_RGB565: + assert(_mesa_little_endian()); + rrb->base.DataType = GL_UNSIGNED_BYTE; + rrb->base._BaseFormat = GL_RGB; + break; + case MESA_FORMAT_RGB565_REV: + assert(!_mesa_little_endian()); rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGB; break; case MESA_FORMAT_XRGB8888: + assert(_mesa_little_endian()); + rrb->base.DataType = GL_UNSIGNED_BYTE; + rrb->base._BaseFormat = GL_RGB; + break; + case MESA_FORMAT_XRGB8888_REV: + assert(!_mesa_little_endian()); rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGB; break; case MESA_FORMAT_ARGB8888: + assert(_mesa_little_endian()); + rrb->base.DataType = GL_UNSIGNED_BYTE; + rrb->base._BaseFormat = GL_RGBA; + break; + case MESA_FORMAT_ARGB8888_REV: + assert(!_mesa_little_endian()); rrb->base.DataType = GL_UNSIGNED_BYTE; rrb->base._BaseFormat = GL_RGBA; break; @@ -359,21 +377,21 @@ radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb, gl_format texFormat; restart: - if (texImage->TexFormat == MESA_FORMAT_ARGB8888) { + if (texImage->TexFormat == _dri_texformat_argb8888) { rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGBA8 texture OK\n"); } - else if (texImage->TexFormat == MESA_FORMAT_RGB565) { + else if (texImage->TexFormat == _dri_texformat_rgb565) { rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to RGB5 texture OK\n"); } - else if (texImage->TexFormat == MESA_FORMAT_ARGB1555) { + else if (texImage->TexFormat == _dri_texformat_argb1555) { rrb->base.DataType = GL_UNSIGNED_BYTE; DBG("Render to ARGB1555 texture OK\n"); } - else if (texImage->TexFormat == MESA_FORMAT_ARGB4444) { + else if (texImage->TexFormat == _dri_texformat_argb4444) { rrb->base.DataType = GL_UNSIGNED_BYTE; - DBG("Render to ARGB1555 texture OK\n"); + DBG("Render to ARGB4444 texture OK\n"); } else if (texImage->TexFormat == MESA_FORMAT_Z16) { rrb->base.DataType = GL_UNSIGNED_SHORT; diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index 2bcceb16d6..be2d8365ef 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -1484,11 +1484,11 @@ radeonCreateBuffer( __DRIscreenPrivate *driScrnPriv, _mesa_initialize_framebuffer(&rfb->base, mesaVis); if (mesaVis->redBits == 5) - rgbFormat = MESA_FORMAT_RGB565; + rgbFormat = _mesa_little_endian() ? MESA_FORMAT_RGB565 : MESA_FORMAT_RGB565_REV; else if (mesaVis->alphaBits == 0) - rgbFormat = MESA_FORMAT_XRGB8888; + rgbFormat = _mesa_little_endian() ? MESA_FORMAT_XRGB8888 : MESA_FORMAT_XRGB8888_REV; else - rgbFormat = MESA_FORMAT_ARGB8888; + rgbFormat = _mesa_little_endian() ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_ARGB8888_REV; /* front color renderbuffer */ rfb->color_rb[0] = radeon_create_renderbuffer(rgbFormat, driDrawPriv); -- cgit v1.2.3 From 22627654256ee09bfd659624568865a79eb725b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 17 Nov 2009 08:05:23 +0100 Subject: radeon: Fix software fallbacks with KMS on big endian. --- src/mesa/drivers/dri/common/spantmp2.h | 152 ++++++++++++++++++++++++++++++ src/mesa/drivers/dri/radeon/radeon_span.c | 63 +++++++++++++ 2 files changed, 215 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/common/spantmp2.h b/src/mesa/drivers/dri/common/spantmp2.h index 89c815722f..dd5e29f8ce 100644 --- a/src/mesa/drivers/dri/common/spantmp2.h +++ b/src/mesa/drivers/dri/common/spantmp2.h @@ -82,6 +82,71 @@ rgba[3] = 0xff; \ } while (0) +#elif (SPANTMP_PIXEL_FMT == GL_RGB) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_5_6_5_REV) + +/** + ** GL_RGB, GL_UNSIGNED_SHORT_5_6_5_REV + **/ + +#ifndef GET_VALUE +#ifndef GET_PTR +#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch) +#endif + +#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y)) +#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v) +#endif /* GET_VALUE */ + +#define INIT_MONO_PIXEL(p, color) \ + p = PACK_COLOR_565_REV( color[0], color[1], color[2] ) + +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + PUT_VALUE(_x, _y, PACK_COLOR_565_REV( r, g, b )) + +#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p) + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = bswap_16(GET_VALUE(_x, _y)); \ + rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8; \ + rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc; \ + rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \ + rgba[3] = 0xff; \ + } while (0) + +#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_4_4_4_4) + +/** + ** GL_BGRA, GL_UNSIGNED_SHORT_4_4_4_4 + **/ + +#ifndef GET_VALUE +#ifndef GET_PTR +#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch) +#endif + +#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y)) +#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v) +#endif /* GET_VALUE */ + +#define INIT_MONO_PIXEL(p, color) \ + p = PACK_COLOR_4444_REV(color[3], color[0], color[1], color[2]) + +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + PUT_VALUE(_x, _y, PACK_COLOR_4444_REV(a, r, g, b)) \ + +#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p) + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = GET_VALUE(_x, _y); \ + rgba[0] = ((p >> 0) & 0xf) * 0x11; \ + rgba[1] = ((p >> 12) & 0xf) * 0x11; \ + rgba[2] = ((p >> 4) & 0xf) * 0x11; \ + rgba[3] = ((p >> 8) & 0xf) * 0x11; \ + } while (0) + + #elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_4_4_4_4_REV) /** @@ -147,6 +212,38 @@ rgba[3] = ((p >> 15) & 0x1) * 0xff; \ } while (0) +#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_SHORT_1_5_5_5) + +/** + ** GL_BGRA, GL_UNSIGNED_SHORT_1_5_5_5 + **/ + +#ifndef GET_VALUE +#ifndef GET_PTR +#define GET_PTR(_x, _y) (buf + (_x) * 2 + (_y) * pitch) +#endif + +#define GET_VALUE(_x, _y) *(volatile GLushort *)(GET_PTR(_x, _y)) +#define PUT_VALUE(_x, _y, _v) *(volatile GLushort *)(GET_PTR(_x, _y)) = (_v) +#endif /* GET_VALUE */ + +#define INIT_MONO_PIXEL(p, color) \ + p = PACK_COLOR_1555_REV(color[3], color[0], color[1], color[2]) + +#define WRITE_RGBA( _x, _y, r, g, b, a ) \ + PUT_VALUE(_x, _y, PACK_COLOR_1555_REV(a, r, g, b)) \ + +#define WRITE_PIXEL( _x, _y, p ) PUT_VALUE(_x, _y, p) + +#define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLushort p = bswap_16(GET_VALUE(_x, _y)); \ + rgba[0] = ((p >> 7) & 0xf8) * 255 / 0xf8; \ + rgba[1] = ((p >> 2) & 0xf8) * 255 / 0xf8; \ + rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \ + rgba[3] = ((p >> 15) & 0x1) * 0xff; \ + } while (0) + #elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV) /** @@ -202,6 +299,61 @@ } while (0) # endif +#elif (SPANTMP_PIXEL_FMT == GL_BGRA) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8) + +/** + ** GL_BGRA, GL_UNSIGNED_INT_8_8_8_8 + **/ + +#ifndef GET_VALUE +#ifndef GET_PTR +#define GET_PTR(_x, _y) ( buf + (_x) * 4 + (_y) * pitch) +#endif + +#define GET_VALUE(_x, _y) *(volatile GLuint *)(GET_PTR(_x, _y)) +#define PUT_VALUE(_x, _y, _v) *(volatile GLuint *)(GET_PTR(_x, _y)) = (_v) +#endif /* GET_VALUE */ + +# define INIT_MONO_PIXEL(p, color) \ + p = PACK_COLOR_8888(color[2], color[1], color[0], color[3]) + +# define WRITE_RGBA(_x, _y, r, g, b, a) \ + PUT_VALUE(_x, _y, ((r << 8) | \ + (g << 16) | \ + (b << 24) | \ + (a << 0))) + +#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p) + +# if defined( USE_X86_ASM ) +# define READ_RGBA(rgba, _x, _y) \ + do { \ + GLuint p = GET_VALUE(_x, _y); \ + __asm__ __volatile__( "rorl $8, %0" \ + : "=r" (p) : "0" (p) ); \ + ((GLuint *)rgba)[0] = p; \ + } while (0) +# elif defined( MESA_BIG_ENDIAN ) + /* On PowerPC with GCC 3.4.2 the shift madness below becomes a single + * rotlwi instruction. It also produces good code on SPARC. + */ +# define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLuint p = CPU_TO_LE32(GET_VALUE(_x, _y)); \ + GLuint t = p; \ + *((uint32_t *) rgba) = (t >> 24) | (p << 8); \ + } while (0) +# else +# define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLuint p = GET_VALUE(_x, _y); \ + rgba[0] = (p >> 8) & 0xff; \ + rgba[1] = (p >> 16) & 0xff; \ + rgba[2] = (p >> 24) & 0xff; \ + rgba[3] = (p >> 0) & 0xff; \ + } while (0) +# endif + #else #error SPANTMP_PIXEL_FMT must be set to a valid value! #endif diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c index 2bc7d31254..30a8762586 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.c +++ b/src/mesa/drivers/dri/radeon/radeon_span.c @@ -41,6 +41,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "main/glheader.h" +#include "main/texformat.h" #include "swrast/swrast.h" #include "radeon_common.h" @@ -400,6 +401,18 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #endif #include "spantmp2.h" +#define SPANTMP_PIXEL_FMT GL_RGB +#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_5_6_5_REV + +#define TAG(x) radeon##x##_RGB565_REV +#define TAG2(x,y) radeon##x##_RGB565_REV##y +#if defined(RADEON_R600) +#define GET_PTR(X,Y) r600_ptr_color(rrb, (X) + x_off, (Y) + y_off) +#else +#define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off) +#endif +#include "spantmp2.h" + /* 16 bit, ARGB1555 color spanline and pixel functions */ #define SPANTMP_PIXEL_FMT GL_BGRA @@ -414,6 +427,14 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #endif #include "spantmp2.h" +#define SPANTMP_PIXEL_FMT GL_BGRA +#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_1_5_5_5 + +#define TAG(x) radeon##x##_ARGB1555_REV +#define TAG2(x,y) radeon##x##_ARGB1555_REV##y +#define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off) +#include "spantmp2.h" + /* 16 bit, RGBA4 color spanline and pixel functions */ #define SPANTMP_PIXEL_FMT GL_BGRA @@ -428,6 +449,14 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #endif #include "spantmp2.h" +#define SPANTMP_PIXEL_FMT GL_BGRA +#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_SHORT_4_4_4_4 + +#define TAG(x) radeon##x##_ARGB4444_REV +#define TAG2(x,y) radeon##x##_ARGB4444_REV##y +#define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off) +#include "spantmp2.h" + /* 32 bit, xRGB8888 color spanline and pixel functions */ #define SPANTMP_PIXEL_FMT GL_BGRA @@ -472,6 +501,30 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #endif #include "spantmp2.h" +/* 32 bit, BGRx8888 color spanline and pixel functions + */ +#define SPANTMP_PIXEL_FMT GL_BGRA +#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8 + +#define TAG(x) radeon##x##_BGRx8888 +#define TAG2(x,y) radeon##x##_BGRx8888##y +#define GET_VALUE(_x, _y) ((*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off)) | 0x000000ff)) +#define PUT_VALUE(_x, _y, d) { \ + GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ + *_ptr = d; \ +} while (0) +#include "spantmp2.h" + +/* 32 bit, BGRA8888 color spanline and pixel functions + */ +#define SPANTMP_PIXEL_FMT GL_BGRA +#define SPANTMP_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8 + +#define TAG(x) radeon##x##_BGRA8888 +#define TAG2(x,y) radeon##x##_BGRA8888##y +#define GET_PTR(X,Y) radeon_ptr_4byte(rrb, (X) + x_off, (Y) + y_off) +#include "spantmp2.h" + /* ================================================================ * Depth buffer */ @@ -848,14 +901,24 @@ static void radeonSetSpanFunctions(struct radeon_renderbuffer *rrb) { if (rrb->base.Format == MESA_FORMAT_RGB565) { radeonInitPointers_RGB565(&rrb->base); + } else if (rrb->base.Format == MESA_FORMAT_RGB565_REV) { + radeonInitPointers_RGB565_REV(&rrb->base); } else if (rrb->base.Format == MESA_FORMAT_XRGB8888) { radeonInitPointers_xRGB8888(&rrb->base); + } else if (rrb->base.Format == MESA_FORMAT_XRGB8888_REV) { + radeonInitPointers_BGRx8888(&rrb->base); } else if (rrb->base.Format == MESA_FORMAT_ARGB8888) { radeonInitPointers_ARGB8888(&rrb->base); + } else if (rrb->base.Format == MESA_FORMAT_ARGB8888_REV) { + radeonInitPointers_BGRA8888(&rrb->base); } else if (rrb->base.Format == MESA_FORMAT_ARGB4444) { radeonInitPointers_ARGB4444(&rrb->base); + } else if (rrb->base.Format == MESA_FORMAT_ARGB4444_REV) { + radeonInitPointers_ARGB4444_REV(&rrb->base); } else if (rrb->base.Format == MESA_FORMAT_ARGB1555) { radeonInitPointers_ARGB1555(&rrb->base); + } else if (rrb->base.Format == MESA_FORMAT_ARGB1555_REV) { + radeonInitPointers_ARGB1555_REV(&rrb->base); } else if (rrb->base.Format == MESA_FORMAT_Z16) { radeonInitDepthPointers_z16(&rrb->base); } else if (rrb->base.Format == MESA_FORMAT_X8_Z24) { -- cgit v1.2.3 From 592ce48ce9eecfdd74f59e52c8d51bdb62059e3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 17 Nov 2009 08:05:24 +0100 Subject: radeon: Fix occlusion queries on big endian. --- src/mesa/drivers/dri/radeon/radeon_queryobj.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_queryobj.c b/src/mesa/drivers/dri/radeon/radeon_queryobj.c index 6539c36268..452d0446f9 100644 --- a/src/mesa/drivers/dri/radeon/radeon_queryobj.c +++ b/src/mesa/drivers/dri/radeon/radeon_queryobj.c @@ -49,6 +49,7 @@ static void radeonQueryGetResult(GLcontext *ctx, struct gl_query_object *q) { radeonContextPtr radeon = RADEON_CONTEXT(ctx); struct radeon_query_object *query = (struct radeon_query_object *)q; + uint32_t *result; int i; radeon_print(RADEON_STATE, RADEON_VERBOSE, @@ -56,6 +57,7 @@ static void radeonQueryGetResult(GLcontext *ctx, struct gl_query_object *q) __FUNCTION__, query->Base.Id, (int) query->Base.Result); radeon_bo_map(query->bo, GL_FALSE); + result = query->bo->ptr; query->Base.Result = 0; if (IS_R600_CLASS(radeon->radeonScreen)) { @@ -66,10 +68,11 @@ static void radeonQueryGetResult(GLcontext *ctx, struct gl_query_object *q) * hw writes zpass end counts to qwords 1, 3, 5, 7. * then we substract. MSB is the valid bit. */ - uint64_t *result = query->bo->ptr; - for (i = 0; i < 8; i += 2) { - uint64_t start = result[i]; - uint64_t end = result[i + 1]; + for (i = 0; i < 16; i += 4) { + uint64_t start = (uint64_t)LE32_TO_CPU(result[i]) | + (uint64_t)LE32_TO_CPU(result[i + 1]) << 32; + uint64_t end = (uint64_t)LE32_TO_CPU(result[i + 2]) | + (uint64_t)LE32_TO_CPU(result[i + 3]) << 32; if ((start & 0x8000000000000000) && (end & 0x8000000000000000)) { uint64_t query_count = end - start; query->Base.Result += query_count; @@ -79,10 +82,9 @@ static void radeonQueryGetResult(GLcontext *ctx, struct gl_query_object *q) "%d start: %lx, end: %lx %ld\n", i, start, end, end - start); } } else { - uint32_t *result = query->bo->ptr; for (i = 0; i < query->curr_offset/sizeof(uint32_t); ++i) { - query->Base.Result += result[i]; - radeon_print(RADEON_STATE, RADEON_TRACE, "result[%d] = %d\n", i, result[i]); + query->Base.Result += LE32_TO_CPU(result[i]); + radeon_print(RADEON_STATE, RADEON_TRACE, "result[%d] = %d\n", i, LE32_TO_CPU(result[i])); } } -- cgit v1.2.3 From 081bf9563fca3f64aed8676f20d17af3eb115016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 17 Nov 2009 08:05:24 +0100 Subject: radeon: Depth/stencil span code fixes for big endian. Fixes e.g. text in progs/demos/arbocclude. --- src/mesa/drivers/dri/radeon/radeon_span.c | 48 +++++++++++++++---------------- 1 file changed, 24 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c index 30a8762586..390d522856 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.c +++ b/src/mesa/drivers/dri/radeon/radeon_span.c @@ -579,10 +579,10 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #define WRITE_DEPTH( _x, _y, d ) \ do { \ GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ - GLuint tmp = *_ptr; \ + GLuint tmp = LE32_TO_CPU(*_ptr); \ tmp &= 0x000000ff; \ tmp |= ((d << 8) & 0xffffff00); \ - *_ptr = tmp; \ + *_ptr = CPU_TO_LE32(tmp); \ } while (0) #elif defined(RADEON_R600) #define WRITE_DEPTH( _x, _y, d ) \ @@ -597,26 +597,26 @@ do { \ #define WRITE_DEPTH( _x, _y, d ) \ do { \ GLuint *_ptr = (GLuint*)r200_depth_4byte( rrb, _x + x_off, _y + y_off ); \ - GLuint tmp = *_ptr; \ + GLuint tmp = LE32_TO_CPU(*_ptr); \ tmp &= 0xff000000; \ tmp |= ((d) & 0x00ffffff); \ - *_ptr = tmp; \ + *_ptr = CPU_TO_LE32(tmp); \ } while (0) #else #define WRITE_DEPTH( _x, _y, d ) \ do { \ GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ - GLuint tmp = *_ptr; \ + GLuint tmp = LE32_TO_CPU(*_ptr); \ tmp &= 0xff000000; \ tmp |= ((d) & 0x00ffffff); \ - *_ptr = tmp; \ + *_ptr = CPU_TO_LE32(tmp); \ } while (0) #endif #if defined(RADEON_R300) #define READ_DEPTH( d, _x, _y ) \ do { \ - d = (*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off)) & 0xffffff00) >> 8; \ + d = (LE32_TO_CPU(*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))) & 0xffffff00) >> 8; \ }while(0) #elif defined(RADEON_R600) #define READ_DEPTH( d, _x, _y ) \ @@ -626,11 +626,11 @@ do { \ #elif defined(RADEON_R200) #define READ_DEPTH( d, _x, _y ) \ do { \ - d = *(GLuint*)(r200_depth_4byte(rrb, _x + x_off, _y + y_off)) & 0x00ffffff; \ + d = LE32_TO_CPU(*(GLuint*)(r200_depth_4byte(rrb, _x + x_off, _y + y_off))) & 0x00ffffff; \ }while(0) #else #define READ_DEPTH( d, _x, _y ) \ - d = *(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off)) & 0x00ffffff; + d = LE32_TO_CPU(*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))) & 0x00ffffff; #endif #define TAG(x) radeon##x##_z24 @@ -648,7 +648,7 @@ do { \ #define WRITE_DEPTH( _x, _y, d ) \ do { \ GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ - *_ptr = d; \ + *_ptr = CPU_TO_LE32(d); \ } while (0) #elif defined(RADEON_R600) #define WRITE_DEPTH( _x, _y, d ) \ @@ -668,20 +668,20 @@ do { \ #define WRITE_DEPTH( _x, _y, d ) \ do { \ GLuint *_ptr = (GLuint*)r200_depth_4byte( rrb, _x + x_off, _y + y_off ); \ - *_ptr = d; \ + *_ptr = CPU_TO_LE32(d); \ } while (0) #else #define WRITE_DEPTH( _x, _y, d ) \ do { \ GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ - *_ptr = d; \ + *_ptr = CPU_TO_LE32(d); \ } while (0) #endif #if defined(RADEON_R300) #define READ_DEPTH( d, _x, _y ) \ do { \ - d = (*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))); \ + d = LE32_TO_CPU(*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))); \ }while(0) #elif defined(RADEON_R600) #define READ_DEPTH( d, _x, _y ) \ @@ -692,11 +692,11 @@ do { \ #elif defined(RADEON_R200) #define READ_DEPTH( d, _x, _y ) \ do { \ - d = *(GLuint*)(r200_depth_4byte(rrb, _x + x_off, _y + y_off)); \ + d = LE32_TO_CPU(*(GLuint*)(r200_depth_4byte(rrb, _x + x_off, _y + y_off))); \ }while(0) #else #define READ_DEPTH( d, _x, _y ) do { \ - d = *(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off )); \ + d = LE32_TO_CPU(*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))); \ } while (0) #endif @@ -713,10 +713,10 @@ do { \ #define WRITE_STENCIL( _x, _y, d ) \ do { \ GLuint *_ptr = (GLuint*)radeon_ptr_4byte(rrb, _x + x_off, _y + y_off); \ - GLuint tmp = *_ptr; \ + GLuint tmp = LE32_TO_CPU(*_ptr); \ tmp &= 0xffffff00; \ tmp |= (d) & 0xff; \ - *_ptr = tmp; \ + *_ptr = CPU_TO_LE32(tmp); \ } while (0) #elif defined(RADEON_R600) #define WRITE_STENCIL( _x, _y, d ) \ @@ -731,19 +731,19 @@ do { \ #define WRITE_STENCIL( _x, _y, d ) \ do { \ GLuint *_ptr = (GLuint*)r200_depth_4byte(rrb, _x + x_off, _y + y_off); \ - GLuint tmp = *_ptr; \ + GLuint tmp = LE32_TO_CPU(*_ptr); \ tmp &= 0x00ffffff; \ tmp |= (((d) & 0xff) << 24); \ - *_ptr = tmp; \ + *_ptr = CPU_TO_LE32(tmp); \ } while (0) #else #define WRITE_STENCIL( _x, _y, d ) \ do { \ GLuint *_ptr = (GLuint*)radeon_ptr_4byte(rrb, _x + x_off, _y + y_off); \ - GLuint tmp = *_ptr; \ + GLuint tmp = LE32_TO_CPU(*_ptr); \ tmp &= 0x00ffffff; \ tmp |= (((d) & 0xff) << 24); \ - *_ptr = tmp; \ + *_ptr = CPU_TO_LE32(tmp); \ } while (0) #endif @@ -751,7 +751,7 @@ do { \ #define READ_STENCIL( d, _x, _y ) \ do { \ GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ - GLuint tmp = *_ptr; \ + GLuint tmp = LE32_TO_CPU(*_ptr); \ d = tmp & 0x000000ff; \ } while (0) #elif defined(RADEON_R600) @@ -765,14 +765,14 @@ do { \ #define READ_STENCIL( d, _x, _y ) \ do { \ GLuint *_ptr = (GLuint*)r200_depth_4byte( rrb, _x + x_off, _y + y_off ); \ - GLuint tmp = *_ptr; \ + GLuint tmp = LE32_TO_CPU(*_ptr); \ d = (tmp & 0xff000000) >> 24; \ } while (0) #else #define READ_STENCIL( d, _x, _y ) \ do { \ GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ - GLuint tmp = *_ptr; \ + GLuint tmp = LE32_TO_CPU(*_ptr); \ d = (tmp & 0xff000000) >> 24; \ } while (0) #endif -- cgit v1.2.3 From 29f3e7e1d1e8cdff3596b88990ed84d7eeff6f80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 17 Nov 2009 18:47:24 +0100 Subject: r600: Attempt to fix span breakage introduced by big endian fixes. Only compile tested; I happened to notice people on IRC reporting .../r600_dri.so: undefined symbol: radeon_ptr_2byte_8x2 --- src/mesa/drivers/dri/radeon/radeon_span.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c index 390d522856..459ad4b34a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.c +++ b/src/mesa/drivers/dri/radeon/radeon_span.c @@ -432,7 +432,11 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #define TAG(x) radeon##x##_ARGB1555_REV #define TAG2(x,y) radeon##x##_ARGB1555_REV##y +#if defined(RADEON_R600) +#define GET_PTR(X,Y) r600_ptr_color(rrb, (X) + x_off, (Y) + y_off) +#else #define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off) +#endif #include "spantmp2.h" /* 16 bit, RGBA4 color spanline and pixel functions @@ -454,7 +458,11 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #define TAG(x) radeon##x##_ARGB4444_REV #define TAG2(x,y) radeon##x##_ARGB4444_REV##y +#if defined(RADEON_R600) +#define GET_PTR(X,Y) r600_ptr_color(rrb, (X) + x_off, (Y) + y_off) +#else #define GET_PTR(X,Y) radeon_ptr_2byte_8x2(rrb, (X) + x_off, (Y) + y_off) +#endif #include "spantmp2.h" /* 32 bit, xRGB8888 color spanline and pixel functions -- cgit v1.2.3 From 33e93f42770e344edf1cd693a6c8115acd505a08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 17 Nov 2009 19:02:03 +0100 Subject: r600: More span breakage fixes. At least now the compiler doesn't complain about implicitly declared functions anymore... --- src/mesa/drivers/dri/radeon/radeon_span.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c index 459ad4b34a..b3986ef64d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.c +++ b/src/mesa/drivers/dri/radeon/radeon_span.c @@ -516,11 +516,19 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #define TAG(x) radeon##x##_BGRx8888 #define TAG2(x,y) radeon##x##_BGRx8888##y +#if defined(RADEON_R600) +#define GET_VALUE(_x, _y) ((*(GLuint*)(r600_ptr_color(rrb, _x + x_off, _y + y_off)) | 0x000000ff)) +#define PUT_VALUE(_x, _y, d) { \ + GLuint *_ptr = (GLuint*)r600_ptr_color( rrb, _x + x_off, _y + y_off ); \ + *_ptr = d; \ +} while (0) +#else #define GET_VALUE(_x, _y) ((*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off)) | 0x000000ff)) #define PUT_VALUE(_x, _y, d) { \ GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ *_ptr = d; \ } while (0) +#endif #include "spantmp2.h" /* 32 bit, BGRA8888 color spanline and pixel functions @@ -530,7 +538,11 @@ static GLubyte *radeon_ptr_2byte_8x2(const struct radeon_renderbuffer * rrb, #define TAG(x) radeon##x##_BGRA8888 #define TAG2(x,y) radeon##x##_BGRA8888##y +#if defined(RADEON_R600) +#define GET_PTR(X,Y) r600_ptr_color(rrb, (X) + x_off, (Y) + y_off) +#else #define GET_PTR(X,Y) radeon_ptr_4byte(rrb, (X) + x_off, (Y) + y_off) +#endif #include "spantmp2.h" /* ================================================================ -- cgit v1.2.3 From cf65d81cf1eb031384f7e8bfe849ce59c458f27e Mon Sep 17 00:00:00 2001 From: Dan Nicholson Date: Mon, 9 Nov 2009 05:51:23 -0800 Subject: dri: Ensure subdirs have finished before linking driver Recursive make is hard. If there are subdirectories in the DRI drivers, it's pretty certain we want to finish building in them before linking the driver. Add a new target to serialize the rules. Signed-off-by: Dan Nicholson --- src/mesa/drivers/dri/Makefile.template | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/Makefile.template b/src/mesa/drivers/dri/Makefile.template index 1ce9315530..39d25ce3f4 100644 --- a/src/mesa/drivers/dri/Makefile.template +++ b/src/mesa/drivers/dri/Makefile.template @@ -60,9 +60,13 @@ SHARED_INCLUDES = \ ##### TARGETS ##### -default: symlinks subdirs depend $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME) +default: subdirs lib +.PHONY: lib +lib: symlinks subdirs depend + @$(MAKE) $(LIBNAME) $(TOP)/$(LIB_DIR)/$(LIBNAME) + $(LIBNAME): $(OBJECTS) $(MESA_MODULES) $(EXTRA_MODULES) $(WINOBJ) Makefile \ $(TOP)/src/mesa/drivers/dri/Makefile.template $(MKLIB) -o $@ -noprefix -linker '$(CC)' -ldflags '$(LDFLAGS)' \ -- cgit v1.2.3 From 52be96b7feb23d9d502c74c4de52dadfb546dc82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 17 Nov 2009 19:41:29 +0100 Subject: Remove unconditional use of glibc specific bswap_16() macro. Fixes unresolved symbol bswap_16 on non-glibc or little endian glibc platforms. --- src/mesa/drivers/dri/common/spantmp2.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/common/spantmp2.h b/src/mesa/drivers/dri/common/spantmp2.h index dd5e29f8ce..95f97414a9 100644 --- a/src/mesa/drivers/dri/common/spantmp2.h +++ b/src/mesa/drivers/dri/common/spantmp2.h @@ -107,7 +107,8 @@ #define READ_RGBA( rgba, _x, _y ) \ do { \ - GLushort p = bswap_16(GET_VALUE(_x, _y)); \ + GLushort p = GET_VALUE(_x, _y); \ + p = p << 8 | p >> 8; \ rgba[0] = ((p >> 8) & 0xf8) * 255 / 0xf8; \ rgba[1] = ((p >> 3) & 0xfc) * 255 / 0xfc; \ rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \ @@ -237,7 +238,8 @@ #define READ_RGBA( rgba, _x, _y ) \ do { \ - GLushort p = bswap_16(GET_VALUE(_x, _y)); \ + GLushort p = GET_VALUE(_x, _y); \ + p = p << 8 | p >> 8; \ rgba[0] = ((p >> 7) & 0xf8) * 255 / 0xf8; \ rgba[1] = ((p >> 2) & 0xf8) * 255 / 0xf8; \ rgba[2] = ((p << 3) & 0xf8) * 255 / 0xf8; \ -- cgit v1.2.3 From 49289f1d25d42a6b3eb5da5f85b2dd6a14cda8e7 Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Tue, 17 Nov 2009 19:49:56 +0100 Subject: nouveau: nv30: Add missing include to fix warning --- src/gallium/drivers/nv30/nv30_fragprog.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv30/nv30_fragprog.c b/src/gallium/drivers/nv30/nv30_fragprog.c index cc0385426c..0ce702d6f8 100644 --- a/src/gallium/drivers/nv30/nv30_fragprog.c +++ b/src/gallium/drivers/nv30/nv30_fragprog.c @@ -4,6 +4,7 @@ #include "pipe/p_inlines.h" #include "pipe/p_shader_tokens.h" +#include "tgsi/tgsi_dump.h" #include "tgsi/tgsi_parse.h" #include "tgsi/tgsi_util.h" @@ -131,7 +132,7 @@ emit_src(struct nv30_fpc *fpc, int pos, struct nv30_sreg src) sizeof(uint32_t) * 4); } - sr |= (NV30_FP_REG_TYPE_CONST << NV30_FP_REG_TYPE_SHIFT); + sr |= (NV30_FP_REG_TYPE_CONST << NV30_FP_REG_TYPE_SHIFT); break; case NV30SR_NONE: sr |= (NV30_FP_REG_TYPE_INPUT << NV30_FP_REG_TYPE_SHIFT); @@ -666,7 +667,7 @@ nv30_fragprog_prepare(struct nv30_fpc *fpc) { struct tgsi_full_immediate *imm; float vals[4]; - + imm = &p.FullToken.FullImmediate; assert(imm->Immediate.DataType == TGSI_IMM_FLOAT32); assert(fpc->nr_imm < MAX_IMM); @@ -754,7 +755,7 @@ nv30_fragprog_translate(struct nv30_context *nv30, fp->insn[fpc->inst_offset + 1] = 0x00000000; fp->insn[fpc->inst_offset + 2] = 0x00000000; fp->insn[fpc->inst_offset + 3] = 0x00000000; - + fp->translated = TRUE; fp->on_hw = FALSE; out_err: @@ -838,7 +839,7 @@ nv30_fragprog_validate(struct nv30_context *nv30) update_constants: if (fp->nr_consts) { float *map; - + map = pipe_buffer_map(pscreen, constbuf, PIPE_BUFFER_USAGE_CPU_READ); for (i = 0; i < fp->nr_consts; i++) { -- cgit v1.2.3 From b353106467d386b48877d6ae1048cca3feaf99ff Mon Sep 17 00:00:00 2001 From: Patrice Mandin Date: Tue, 17 Nov 2009 19:50:37 +0100 Subject: nouveau: nv30: Check for NULL front (happens with DRI2) --- src/gallium/drivers/nv30/nv30_screen.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nv30/nv30_screen.c b/src/gallium/drivers/nv30/nv30_screen.c index 221ae1b5f8..7cd36902eb 100644 --- a/src/gallium/drivers/nv30/nv30_screen.c +++ b/src/gallium/drivers/nv30/nv30_screen.c @@ -116,7 +116,10 @@ nv30_screen_surface_format_supported(struct pipe_screen *pscreen, case PIPE_FORMAT_Z24X8_UNORM: return TRUE; case PIPE_FORMAT_Z16_UNORM: - return (front->format == PIPE_FORMAT_R5G6B5_UNORM); + if (front) { + return (front->format == PIPE_FORMAT_R5G6B5_UNORM); + } + return TRUE; default: break; } -- cgit v1.2.3 From aef769207d3e554db8cc452d6ea3f678e5549cfb Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Tue, 17 Nov 2009 21:27:31 +0100 Subject: r300: fix reads and writes for MESA_FORMAT_S8Z24 buffer Regression was introduced by texformat-rework branch merge. --- src/mesa/drivers/dri/radeon/radeon_span.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_span.c b/src/mesa/drivers/dri/radeon/radeon_span.c index b3986ef64d..37904dc8dc 100644 --- a/src/mesa/drivers/dri/radeon/radeon_span.c +++ b/src/mesa/drivers/dri/radeon/radeon_span.c @@ -668,7 +668,7 @@ do { \ #define WRITE_DEPTH( _x, _y, d ) \ do { \ GLuint *_ptr = (GLuint*)radeon_ptr_4byte( rrb, _x + x_off, _y + y_off ); \ - *_ptr = CPU_TO_LE32(d); \ + *_ptr = CPU_TO_LE32((((d) & 0xff000000) >> 24) | (((d) & 0x00ffffff) << 8)); \ } while (0) #elif defined(RADEON_R600) #define WRITE_DEPTH( _x, _y, d ) \ @@ -701,7 +701,8 @@ do { \ #if defined(RADEON_R300) #define READ_DEPTH( d, _x, _y ) \ do { \ - d = LE32_TO_CPU(*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))); \ + GLuint tmp = (*(GLuint*)(radeon_ptr_4byte(rrb, _x + x_off, _y + y_off))); \ + d = LE32_TO_CPU(((tmp & 0x000000ff) << 24) | ((tmp & 0xffffff00) >> 8)); \ }while(0) #elif defined(RADEON_R600) #define READ_DEPTH( d, _x, _y ) \ -- cgit v1.2.3 From 8c5a108dc321c4760e6d70b1104493b5bd54e6de Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 17 Nov 2009 09:07:15 +0100 Subject: svga: Remove -Werror for now as GCC 4.4.x raises a bunch of warnings --- src/gallium/drivers/svga/Makefile | 2 +- src/gallium/drivers/svga/SConscript | 3 --- src/gallium/winsys/drm/vmware/core/SConscript | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/Makefile b/src/gallium/drivers/svga/Makefile index 05ab4ab9b3..fe1d6d7384 100644 --- a/src/gallium/drivers/svga/Makefile +++ b/src/gallium/drivers/svga/Makefile @@ -57,7 +57,7 @@ CC = gcc -fvisibility=hidden -msse -msse2 # Set the gnu99 standard to enable anonymous structs in vmware headers. # -CFLAGS = -Wall -Werror -Wmissing-prototypes -std=gnu99 -ffast-math \ +CFLAGS = -Wall -Wmissing-prototypes -std=gnu99 -ffast-math \ $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) $(ASM_FLAGS) include ../../Makefile.template diff --git a/src/gallium/drivers/svga/SConscript b/src/gallium/drivers/svga/SConscript index 0fa745c9b8..ff9645fc03 100644 --- a/src/gallium/drivers/svga/SConscript +++ b/src/gallium/drivers/svga/SConscript @@ -10,9 +10,6 @@ if env['gcc']: 'HAVE_STDINT_H', 'HAVE_SYS_TYPES_H', ]) - if env['platform'] not in ['windows']: - # The Windows headers cause many gcc warnings - env.Append(CCFLAGS = ['-Werror']) env.Prepend(CPPPATH = [ 'include', diff --git a/src/gallium/winsys/drm/vmware/core/SConscript b/src/gallium/winsys/drm/vmware/core/SConscript index 1875b659ac..edaf9458be 100644 --- a/src/gallium/winsys/drm/vmware/core/SConscript +++ b/src/gallium/winsys/drm/vmware/core/SConscript @@ -3,7 +3,7 @@ Import('*') env = env.Clone() if env['gcc']: - env.Append(CCFLAGS = ['-fvisibility=hidden', '-Werror']) + env.Append(CCFLAGS = ['-fvisibility=hidden']) env.Append(CPPDEFINES = [ 'HAVE_STDINT_H', 'HAVE_SYS_TYPES_H', -- cgit v1.2.3 From 46492f11f6f771e12ab2d13f9d7e9eb9e032c2dc Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 17 Nov 2009 12:04:17 +0100 Subject: svga: More -Werror removal --- src/gallium/winsys/drm/vmware/core/Makefile | 2 +- src/gallium/winsys/drm/vmware/dri/SConscript | 1 - src/gallium/winsys/drm/vmware/xorg/SConscript | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/core/Makefile b/src/gallium/winsys/drm/vmware/core/Makefile index 755dc45935..ff8f01b322 100644 --- a/src/gallium/winsys/drm/vmware/core/Makefile +++ b/src/gallium/winsys/drm/vmware/core/Makefile @@ -35,7 +35,7 @@ CC = gcc -fvisibility=hidden -msse -msse2 # Set the gnu99 standard to enable anonymous structs in vmware headers. # -CFLAGS = -Wall -Werror -Wmissing-prototypes -std=gnu99 -ffast-math \ +CFLAGS = -Wall -Wmissing-prototypes -std=gnu99 -ffast-math \ $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) $(ASM_FLAGS) include ../../../../Makefile.template diff --git a/src/gallium/winsys/drm/vmware/dri/SConscript b/src/gallium/winsys/drm/vmware/dri/SConscript index adf2bf16d1..1019f577a5 100644 --- a/src/gallium/winsys/drm/vmware/dri/SConscript +++ b/src/gallium/winsys/drm/vmware/dri/SConscript @@ -35,7 +35,6 @@ if env['platform'] == 'linux': ]) env.Append(CFLAGS = [ - '-Werror', '-std=gnu99', '-D_FILE_OFFSET_BITS=64', ]) diff --git a/src/gallium/winsys/drm/vmware/xorg/SConscript b/src/gallium/winsys/drm/vmware/xorg/SConscript index 41a489774c..ff7b2ed34e 100644 --- a/src/gallium/winsys/drm/vmware/xorg/SConscript +++ b/src/gallium/winsys/drm/vmware/xorg/SConscript @@ -24,7 +24,6 @@ if env['platform'] == 'linux': 'HAVE_STDINT_H', 'HAVE_SYS_TYPES_H', ]) - env.Append(CFLAGS = ['-Werror']) env.Append(CFLAGS = [ '-std=gnu99', -- cgit v1.2.3 From 93eb2ab8c395f81e40fa298d78805bb2c777f891 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Tue, 17 Nov 2009 19:46:37 +0100 Subject: radeon: align for mipmap tree changes --- src/mesa/drivers/dri/radeon/radeon_state_init.c | 4 ++-- src/mesa/drivers/dri/radeon/radeon_tex.c | 18 +++--------------- src/mesa/drivers/dri/radeon/radeon_texstate.c | 22 +++++++++------------- 3 files changed, 14 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_state_init.c b/src/mesa/drivers/dri/radeon/radeon_state_init.c index 2d19220d8a..dd82888254 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state_init.c +++ b/src/mesa/drivers/dri/radeon/radeon_state_init.c @@ -645,11 +645,11 @@ static void tex_emit_cs(GLcontext *ctx, struct radeon_state_atom *atom) OUT_BATCH(CP_PACKET0(RADEON_PP_TXOFFSET_0 + (24 * i), 0)); if (t->mt && !t->image_override) { if ((ctx->Texture.Unit[i]._ReallyEnabled & TEXTURE_CUBE_BIT)) { - lvl = &t->mt->levels[0]; + lvl = &t->mt->levels[t->minLod]; OUT_BATCH_RELOC(lvl->faces[5].offset, t->mt->bo, lvl->faces[5].offset, RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); } else { - OUT_BATCH_RELOC(t->tile_bits, t->mt->bo, 0, + OUT_BATCH_RELOC(t->tile_bits, t->mt->bo, get_base_teximage_offset(t), RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); } } else { diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.c b/src/mesa/drivers/dri/radeon/radeon_tex.c index 60981aada2..749ab75f20 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex.c +++ b/src/mesa/drivers/dri/radeon/radeon_tex.c @@ -348,17 +348,7 @@ static void radeonTexParameter( GLcontext *ctx, GLenum target, case GL_TEXTURE_MAX_LEVEL: case GL_TEXTURE_MIN_LOD: case GL_TEXTURE_MAX_LOD: - - /* This isn't the most efficient solution but there doesn't appear to - * be a nice alternative. Since there's no LOD clamping, - * we just have to rely on loading the right subset of mipmap levels - * to simulate a clamped LOD. - */ - if (t->mt) { - radeon_miptree_unreference(t->mt); - t->mt = 0; - t->validated = GL_FALSE; - } + t->validated = GL_FALSE; break; default: @@ -388,10 +378,8 @@ static void radeonDeleteTexture( GLcontext *ctx, } } - if (t->mt) { - radeon_miptree_unreference(t->mt); - t->mt = 0; - } + radeon_miptree_unreference(&t->mt); + /* Free mipmap images and the texture object itself */ _mesa_delete_texture_object(ctx, texObj); } diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index 429977a8bc..4d9eb73d20 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -699,14 +699,10 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_ radeon_bo_unref(rImage->bo); rImage->bo = NULL; } - if (t->mt) { - radeon_miptree_unreference(t->mt); - t->mt = NULL; - } - if (rImage->mt) { - radeon_miptree_unreference(rImage->mt); - rImage->mt = NULL; - } + + radeon_miptree_unreference(&t->mt); + radeon_miptree_unreference(&rImage->mt); + _mesa_init_teximage_fields(radeon->glCtx, target, texImage, rb->base.Width, rb->base.Height, 1, 0, rb->cpp); texImage->RowStride = rb->pitch / rb->cpp; @@ -1021,7 +1017,7 @@ static GLboolean setup_hardware_state(r100ContextPtr rmesa, radeonTexObj *t, int return GL_TRUE; } - firstImage = t->base.Image[0][t->mt->firstLevel]; + firstImage = t->base.Image[0][t->minLod]; if (firstImage->Border > 0) { fprintf(stderr, "%s: border\n", __FUNCTION__); @@ -1049,9 +1045,9 @@ static GLboolean setup_hardware_state(r100ContextPtr rmesa, radeonTexObj *t, int return GL_FALSE; } } - + t->pp_txfilter &= ~RADEON_MAX_MIP_LEVEL_MASK; - t->pp_txfilter |= (t->mt->lastLevel - t->mt->firstLevel) << RADEON_MAX_MIP_LEVEL_SHIFT; + t->pp_txfilter |= (t->maxLod - t->minLod) << RADEON_MAX_MIP_LEVEL_SHIFT; t->pp_txformat &= ~(RADEON_TXFORMAT_WIDTH_MASK | RADEON_TXFORMAT_HEIGHT_MASK | @@ -1060,9 +1056,9 @@ static GLboolean setup_hardware_state(r100ContextPtr rmesa, radeonTexObj *t, int RADEON_TXFORMAT_F5_HEIGHT_MASK); t->pp_txformat |= ((log2Width << RADEON_TXFORMAT_WIDTH_SHIFT) | (log2Height << RADEON_TXFORMAT_HEIGHT_SHIFT)); - + t->tile_bits = 0; - + if (t->base.Target == GL_TEXTURE_CUBE_MAP) { ASSERT(log2Width == log2Height); t->pp_txformat |= ((log2Width << RADEON_TXFORMAT_F5_WIDTH_SHIFT) | -- cgit v1.2.3 From afe84fa698eae3e035e967589f0a8d55f6a83698 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Tue, 17 Nov 2009 19:46:59 +0100 Subject: r200: align for mipmap tree changes --- src/mesa/drivers/dri/r200/r200_state_init.c | 2 +- src/mesa/drivers/dri/r200/r200_tex.c | 21 +++++---------------- src/mesa/drivers/dri/r200/r200_texstate.c | 21 ++++++++------------- 3 files changed, 14 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c index 68bfeea701..e53fd72290 100644 --- a/src/mesa/drivers/dri/r200/r200_state_init.c +++ b/src/mesa/drivers/dri/r200/r200_state_init.c @@ -640,7 +640,7 @@ static void tex_emit(GLcontext *ctx, struct radeon_state_atom *atom) OUT_BATCH_TABLE(atom->cmd, 10); if (t && t->mt && !t->image_override) { - OUT_BATCH_RELOC(t->tile_bits, t->mt->bo, 0, + OUT_BATCH_RELOC(t->tile_bits, t->mt->bo, get_base_teximage_offset(t), RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); } else if (!t) { /* workaround for old CS mechanism */ diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c index 5a21a8b9c5..a417721553 100644 --- a/src/mesa/drivers/dri/r200/r200_tex.c +++ b/src/mesa/drivers/dri/r200/r200_tex.c @@ -385,16 +385,7 @@ static void r200TexParameter( GLcontext *ctx, GLenum target, case GL_TEXTURE_MAX_LEVEL: case GL_TEXTURE_MIN_LOD: case GL_TEXTURE_MAX_LOD: - /* This isn't the most efficient solution but there doesn't appear to - * be a nice alternative. Since there's no LOD clamping, - * we just have to rely on loading the right subset of mipmap levels - * to simulate a clamped LOD. - */ - if (t->mt) { - radeon_miptree_unreference(t->mt); - t->mt = 0; - t->validated = GL_FALSE; - } + t->validated = GL_FALSE; break; default: @@ -413,7 +404,7 @@ static void r200DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj) (void *)texObj, _mesa_lookup_enum_by_nr(texObj->Target)); } - + if (rmesa) { int i; radeon_firevertices(&rmesa->radeon); @@ -425,11 +416,9 @@ static void r200DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj) } } } - - if (t->mt) { - radeon_miptree_unreference(t->mt); - t->mt = 0; - } + + radeon_miptree_unreference(&t->mt); + _mesa_delete_texture_object(ctx, texObj); } diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index 7d0afa1add..7782404a79 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -824,14 +824,10 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo radeon_bo_unref(rImage->bo); rImage->bo = NULL; } - if (t->mt) { - radeon_miptree_unreference(t->mt); - t->mt = NULL; - } - if (rImage->mt) { - radeon_miptree_unreference(rImage->mt); - rImage->mt = NULL; - } + + radeon_miptree_unreference(&t->mt); + radeon_miptree_unreference(&rImage->mt); + _mesa_init_teximage_fields(radeon->glCtx, target, texImage, rb->base.Width, rb->base.Height, 1, 0, rb->cpp); texImage->RowStride = rb->pitch / rb->cpp; @@ -1423,10 +1419,9 @@ void set_re_cntl_d3d( GLcontext *ctx, int unit, GLboolean use_d3d ) */ static void setup_hardware_state(r200ContextPtr rmesa, radeonTexObj *t) { - int firstlevel = t->mt ? t->mt->firstLevel : 0; - const struct gl_texture_image *firstImage = t->base.Image[0][firstlevel]; + const struct gl_texture_image *firstImage = t->base.Image[0][t->minLod]; GLint log2Width, log2Height, log2Depth, texelBytes; - + if ( t->bo ) { return; } @@ -1454,9 +1449,9 @@ static void setup_hardware_state(r200ContextPtr rmesa, radeonTexObj *t) return; } } - + t->pp_txfilter &= ~R200_MAX_MIP_LEVEL_MASK; - t->pp_txfilter |= (t->mt->lastLevel - t->mt->firstLevel) << R200_MAX_MIP_LEVEL_SHIFT; + t->pp_txfilter |= (t->maxLod - t->minLod) << R200_MAX_MIP_LEVEL_SHIFT; t->pp_txformat &= ~(R200_TXFORMAT_WIDTH_MASK | R200_TXFORMAT_HEIGHT_MASK | -- cgit v1.2.3 From e36751ec81736a8466b1a6a722c1b2cf578d713b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 17 Nov 2009 16:05:24 -0700 Subject: mesa: remove a bit of old code --- src/mesa/main/buffers.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 7f77c5d772..7c31a46ab9 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -383,7 +383,6 @@ _mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers, if (n == 1) { GLuint count = 0, destMask0 = destMask[0]; /* init to -1 to help catch errors */ - //fb->_ColorDrawBufferIndexes[0] = -1; while (destMask0) { GLint bufIndex = _mesa_ffs(destMask0) - 1; if (fb->_ColorDrawBufferIndexes[count] != bufIndex) { -- cgit v1.2.3 From 0422053eca12b4fb912e0229c96a9d12453e31c4 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 17 Nov 2009 16:05:59 -0700 Subject: mesa: remove trailing comment to silence warning --- src/mesa/main/formats.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index eba28a69be..0eeeb8b2ba 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -140,7 +140,7 @@ typedef enum MESA_FORMAT_SIGNED_RGBA_16, /*@}*/ - MESA_FORMAT_COUNT, + MESA_FORMAT_COUNT } gl_format; -- cgit v1.2.3 From 845ddbc9aa62d1c9142822608370d96b2d68cec0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 17 Nov 2009 16:14:54 -0700 Subject: i915g: remove trailing commas in enum lists to silence warnings --- src/gallium/drivers/i915/intel_winsys.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/i915/intel_winsys.h b/src/gallium/drivers/i915/intel_winsys.h index 2c8dc63f3f..c6bf6e6f7f 100644 --- a/src/gallium/drivers/i915/intel_winsys.h +++ b/src/gallium/drivers/i915/intel_winsys.h @@ -42,21 +42,21 @@ enum intel_buffer_usage INTEL_USAGE_2D_TARGET = 0x04, INTEL_USAGE_2D_SOURCE = 0x08, /* use on vertex */ - INTEL_USAGE_VERTEX = 0x10, + INTEL_USAGE_VERTEX = 0x10 }; enum intel_buffer_type { INTEL_NEW_TEXTURE, INTEL_NEW_SCANOUT, /**< a texture used for scanning out from */ - INTEL_NEW_VERTEX, + INTEL_NEW_VERTEX }; enum intel_buffer_tile { INTEL_TILE_NONE, INTEL_TILE_X, - INTEL_TILE_Y, + INTEL_TILE_Y }; struct intel_batchbuffer { -- cgit v1.2.3 From c4c11eb456b773480d37ac34f98b9b44ae7c514a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 17 Nov 2009 16:15:21 -0700 Subject: gallium/util: replace //-style comments --- src/gallium/auxiliary/util/u_cpu_detect.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_cpu_detect.c b/src/gallium/auxiliary/util/u_cpu_detect.c index facbe69173..a08241971c 100644 --- a/src/gallium/auxiliary/util/u_cpu_detect.c +++ b/src/gallium/auxiliary/util/u_cpu_detect.c @@ -80,7 +80,7 @@ static int has_cpuid(void); #if defined(PIPE_ARCH_X86) /* The sigill handlers */ -#if defined(PIPE_OS_LINUX) //&& defined(_POSIX_SOURCE) && defined(X86_FXSR_MAGIC) +#if defined(PIPE_OS_LINUX) /*&& defined(_POSIX_SOURCE) && defined(X86_FXSR_MAGIC)*/ static void sigill_handler_sse(int signal, struct sigcontext sc) { @@ -240,7 +240,7 @@ check_os_katmai_support(void) __asm __volatile ("xorps %xmm0, %xmm0"); #elif defined(PIPE_CC_MSVC) __asm { - xorps xmm0, xmm0 // executing SSE instruction + xorps xmm0, xmm0 /* executing SSE instruction */ } #else #error Unsupported compiler @@ -283,7 +283,7 @@ check_os_katmai_support(void) * and therefore to be safe I'm going to leave this test in here. */ if (util_cpu_caps.has_sse) { - // test_os_katmai_exception_support(); + /* test_os_katmai_exception_support(); */ } /* Restore the original signal handlers. -- cgit v1.2.3 From 7e3955d8e80c364d9b4c9eee1ec9758ff3ab8a1d Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 17 Nov 2009 16:15:29 -0700 Subject: i915g: replace //-style comments --- src/gallium/drivers/i915/i915_state.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index 7d48e6e84d..71f00bc346 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -58,8 +58,10 @@ translate_wrap_mode(unsigned wrap) return TEXCOORDMODE_CLAMP_EDGE; case PIPE_TEX_WRAP_CLAMP_TO_BORDER: return TEXCOORDMODE_CLAMP_BORDER; -// case PIPE_TEX_WRAP_MIRRORED_REPEAT: -// return TEXCOORDMODE_MIRROR; +/* + case PIPE_TEX_WRAP_MIRRORED_REPEAT: + return TEXCOORDMODE_MIRROR; +*/ default: return TEXCOORDMODE_WRAP; } -- cgit v1.2.3 From bc8fb028c6c9e7c9bd4f6aaf094a606c447e3711 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 17 Nov 2009 16:15:56 -0700 Subject: mesa: fix incorrect type in store_texel_al1616() --- src/mesa/main/texfetch_tmp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texfetch_tmp.h b/src/mesa/main/texfetch_tmp.h index 6fac7ba1e1..1f0d436236 100644 --- a/src/mesa/main/texfetch_tmp.h +++ b/src/mesa/main/texfetch_tmp.h @@ -876,7 +876,7 @@ static void store_texel_al1616(struct gl_texture_image *texImage, GLint i, GLint j, GLint k, const void *texel) { const GLushort *rgba = (const GLushort *) texel; - GLuint *dst = TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + GLuint *dst = TEXEL_ADDR(GLuint, texImage, i, j, k, 1); *dst = PACK_COLOR_1616(rgba[ACOMP], rgba[RCOMP]); } #endif -- cgit v1.2.3 From 133501bef2933395f14b2ebdfeda84279be93c60 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 17 Nov 2009 16:16:16 -0700 Subject: mesa: fix assorted compiler warnings --- src/mesa/shader/program_parser.h | 2 +- src/mesa/shader/slang/slang_codegen.c | 2 +- src/mesa/state_tracker/st_atom.c | 8 ++++---- src/mesa/state_tracker/st_cb_bitmap.c | 2 +- src/mesa/state_tracker/st_program.c | 4 ++-- src/mesa/vbo/vbo_exec_array.c | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/program_parser.h b/src/mesa/shader/program_parser.h index bce6041381..c170948f73 100644 --- a/src/mesa/shader/program_parser.h +++ b/src/mesa/shader/program_parser.h @@ -35,7 +35,7 @@ enum asm_type { at_attrib, at_param, at_temp, - at_output, + at_output }; struct asm_symbol { diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index 344dfdc680..ee5a50ca82 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -925,7 +925,7 @@ gen_return_with_expression(slang_assemble_ctx *A, slang_operation *oper) slang_operation_copy(rhs, &oper->children[0]); } - ///blockOper->locals->outer_scope = oper->locals->outer_scope; + /*blockOper->locals->outer_scope = oper->locals->outer_scope;*/ /*slang_print_tree(blockOper, 0);*/ diff --git a/src/mesa/state_tracker/st_atom.c b/src/mesa/state_tracker/st_atom.c index ca15ce1b47..0e89a624c4 100644 --- a/src/mesa/state_tracker/st_atom.c +++ b/src/mesa/state_tracker/st_atom.c @@ -137,7 +137,7 @@ void st_validate_state( struct st_context *st ) if (state->st == 0) return; -// _mesa_printf("%s %x/%x\n", __FUNCTION__, state->mesa, state->st); + /*_mesa_printf("%s %x/%x\n", __FUNCTION__, state->mesa, state->st);*/ if (1) { /* Debug version which enforces various sanity checks on the @@ -152,7 +152,7 @@ void st_validate_state( struct st_context *st ) const struct st_tracked_state *atom = atoms[i]; struct st_state_flags generated; -// _mesa_printf("atom %s %x/%x\n", atom->name, atom->dirty.mesa, atom->dirty.st); + /*_mesa_printf("atom %s %x/%x\n", atom->name, atom->dirty.mesa, atom->dirty.st);*/ if (!(atom->dirty.mesa || atom->dirty.st) || !atom->update) { @@ -162,7 +162,7 @@ void st_validate_state( struct st_context *st ) if (check_state(state, &atom->dirty)) { atoms[i]->update( st ); -// _mesa_printf("after: %x\n", atom->dirty.mesa); + /*_mesa_printf("after: %x\n", atom->dirty.mesa);*/ } accumulate_state(&examined, &atom->dirty); @@ -175,7 +175,7 @@ void st_validate_state( struct st_context *st ) assert(!check_state(&examined, &generated)); prev = *state; } -// _mesa_printf("\n"); + /*_mesa_printf("\n");*/ } else { diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index a22fa68299..1960d171bf 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -526,7 +526,7 @@ reset_cache(struct st_context *st) struct pipe_screen *screen = pipe->screen; struct bitmap_cache *cache = st->bitmap.cache; - //memset(cache->buffer, 0xff, sizeof(cache->buffer)); + /*memset(cache->buffer, 0xff, sizeof(cache->buffer));*/ cache->empty = GL_TRUE; cache->xmin = 1000000; diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index a9be80ce8f..6d02722c13 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -80,7 +80,7 @@ st_translate_vertex_program(struct st_context *st, GLbitfield input_flags[MAX_PROGRAM_INPUTS]; GLbitfield output_flags[MAX_PROGRAM_OUTPUTS]; -// memset(&vs, 0, sizeof(vs)); + /*memset(&vs, 0, sizeof(vs));*/ memset(input_flags, 0, sizeof(input_flags)); memset(output_flags, 0, sizeof(output_flags)); @@ -386,7 +386,7 @@ st_translate_fragment_program(struct st_context *st, GLbitfield input_flags[MAX_PROGRAM_INPUTS]; GLbitfield output_flags[MAX_PROGRAM_OUTPUTS]; -// memset(&fs, 0, sizeof(fs)); + /*memset(&fs, 0, sizeof(fs));*/ memset(input_flags, 0, sizeof(input_flags)); memset(output_flags, 0, sizeof(output_flags)); diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index fd70b57b72..6de8f059b7 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -146,7 +146,7 @@ check_array_data(GLcontext *ctx, struct gl_client_array *array, array->Ptr, array->BufferObj->Name); f[k] = 1.0; /* XXX replace the bad value! */ } - //assert(!IS_INF_OR_NAN(f[k])); + /*assert(!IS_INF_OR_NAN(f[k]));*/ } } break; -- cgit v1.2.3 From a54033bedb1d3ac7f7a0c1365c25c638e58de566 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 17 Nov 2009 16:18:29 -0700 Subject: mesa: remove old comment --- src/mesa/main/buffers.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c index 7c31a46ab9..97f0659758 100644 --- a/src/mesa/main/buffers.c +++ b/src/mesa/main/buffers.c @@ -382,7 +382,6 @@ _mesa_drawbuffers(GLcontext *ctx, GLuint n, const GLenum *buffers, */ if (n == 1) { GLuint count = 0, destMask0 = destMask[0]; - /* init to -1 to help catch errors */ while (destMask0) { GLint bufIndex = _mesa_ffs(destMask0) - 1; if (fb->_ColorDrawBufferIndexes[count] != bufIndex) { -- cgit v1.2.3 From c185ff96c98b397d494eec5125c668df4db45cf3 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 11 Nov 2009 14:44:43 -0800 Subject: ARB_fbo: Remove _EXT from enum names --- src/mesa/glapi/ARB_framebuffer_object.xml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/glapi/ARB_framebuffer_object.xml b/src/mesa/glapi/ARB_framebuffer_object.xml index b700e7e77d..7fc0f439b1 100644 --- a/src/mesa/glapi/ARB_framebuffer_object.xml +++ b/src/mesa/glapi/ARB_framebuffer_object.xml @@ -12,10 +12,10 @@ - - - - + + + + @@ -98,28 +98,28 @@ - - + + - + - + - + - + - + - + -- cgit v1.2.3 From 30f09573ed4b3b2a5460143b366aa9fb8b91e6a4 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 11 Nov 2009 14:51:29 -0800 Subject: ARB_fbo: Add missing protocol "Get" information --- src/mesa/glapi/ARB_framebuffer_object.xml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/glapi/ARB_framebuffer_object.xml b/src/mesa/glapi/ARB_framebuffer_object.xml index 7fc0f439b1..89c23938fb 100644 --- a/src/mesa/glapi/ARB_framebuffer_object.xml +++ b/src/mesa/glapi/ARB_framebuffer_object.xml @@ -93,7 +93,9 @@ - + + + @@ -131,7 +133,10 @@ - + + + + -- cgit v1.2.3 From 92b38bc3050d8f1ee8c64ff976584ec3c0b77f0c Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 11 Nov 2009 15:01:25 -0800 Subject: EXT_fbo_blit: Add missing GLX protocol render opcode --- src/mesa/glapi/gl_API.xml | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml index da4be14707..2834c5bf51 100644 --- a/src/mesa/glapi/gl_API.xml +++ b/src/mesa/glapi/gl_API.xml @@ -12260,6 +12260,7 @@ + -- cgit v1.2.3 From b244b702b3a7bed08250e20b54192ea73892b552 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 11 Nov 2009 15:08:49 -0800 Subject: EXT_pds: Add GL_EXT_packed_depth_stencil --- src/mesa/glapi/EXT_packed_depth_stencil.xml | 18 ++++++++++++++++++ src/mesa/glapi/gl_API.xml | 2 ++ 2 files changed, 20 insertions(+) create mode 100644 src/mesa/glapi/EXT_packed_depth_stencil.xml (limited to 'src') diff --git a/src/mesa/glapi/EXT_packed_depth_stencil.xml b/src/mesa/glapi/EXT_packed_depth_stencil.xml new file mode 100644 index 0000000000..5be810302f --- /dev/null +++ b/src/mesa/glapi/EXT_packed_depth_stencil.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml index 2834c5bf51..7180334bdb 100644 --- a/src/mesa/glapi/gl_API.xml +++ b/src/mesa/glapi/gl_API.xml @@ -12238,6 +12238,8 @@ + + -- cgit v1.2.3 From daad31d52732b5a954360a0baacdeff89d3c153a Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 11 Nov 2009 15:09:44 -0800 Subject: EXT_pds: Alias GL_NV_packed_depth_stencil to GL_EXT_packed_depth_stencil GL_EXT_packed_depth_stencil is a functional superset of GL_NV_packed_depth_stencil. If a driver enables EXT_pds, make NV_pds available as well. --- src/mesa/main/extensions.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 54cf37c5f4..96f3511273 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -169,6 +169,7 @@ static const struct { { OFF, "GL_NV_fragment_program", F(NV_fragment_program) }, { OFF, "GL_NV_fragment_program_option", F(NV_fragment_program_option) }, { ON, "GL_NV_light_max_exponent", F(NV_light_max_exponent) }, + { OFF, "GL_NV_packed_depth_stencil", F(EXT_packed_depth_stencil) }, { OFF, "GL_NV_point_sprite", F(NV_point_sprite) }, { OFF, "GL_NV_texture_env_combine4", F(NV_texture_env_combine4) }, { OFF, "GL_NV_texture_rectangle", F(NV_texture_rectangle) }, -- cgit v1.2.3 From afab8d9958a4deedca16fb9856bc7f372c21debd Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 11 Nov 2009 15:15:35 -0800 Subject: ARB_fbo: Add GL_EXT_framebuffer_multisample Add GL_EXT_framebuffer_multisample. Make glRenderbufferStorageMultisampleEXT in GL_EXT_framebuffer_object alias glRenderbufferStorageMultisample. Also add the missing GLX render opcode to glRenderbufferStorageMultisample. Since this extension is layered on GL_EXT_framebuffer_object, I put it in EXT_framebuffer_object.xml. --- src/mesa/glapi/ARB_framebuffer_object.xml | 1 + src/mesa/glapi/EXT_framebuffer_object.xml | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) (limited to 'src') diff --git a/src/mesa/glapi/ARB_framebuffer_object.xml b/src/mesa/glapi/ARB_framebuffer_object.xml index 89c23938fb..e6bdcd6e50 100644 --- a/src/mesa/glapi/ARB_framebuffer_object.xml +++ b/src/mesa/glapi/ARB_framebuffer_object.xml @@ -173,6 +173,7 @@ + diff --git a/src/mesa/glapi/EXT_framebuffer_object.xml b/src/mesa/glapi/EXT_framebuffer_object.xml index 5559b48b11..8c5b1c3a1e 100644 --- a/src/mesa/glapi/EXT_framebuffer_object.xml +++ b/src/mesa/glapi/EXT_framebuffer_object.xml @@ -192,4 +192,20 @@ + + + + + + + + + + + + + + + + -- cgit v1.2.3 From 50b05e7c1f64437a12afb56e38bb588b8b85bd5e Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 11 Nov 2009 15:18:22 -0800 Subject: ARB_fbo: Move EXT_fb_blit to EXT_framebuffer_object.xml This extension is layered on GL_EXT_framebuffer_object, so it should live in the same XML file. --- src/mesa/glapi/EXT_framebuffer_object.xml | 24 ++++++++++++++++++++++++ src/mesa/glapi/gl_API.xml | 24 ------------------------ 2 files changed, 24 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/mesa/glapi/EXT_framebuffer_object.xml b/src/mesa/glapi/EXT_framebuffer_object.xml index 8c5b1c3a1e..4f418f7b64 100644 --- a/src/mesa/glapi/EXT_framebuffer_object.xml +++ b/src/mesa/glapi/EXT_framebuffer_object.xml @@ -192,6 +192,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml index 7180334bdb..34c7746e1b 100644 --- a/src/mesa/glapi/gl_API.xml +++ b/src/mesa/glapi/gl_API.xml @@ -12242,30 +12242,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - -- cgit v1.2.3 From 7fd44005ae67d598c0070bb6ad82a26bc0944284 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 12 Nov 2009 11:50:28 -0800 Subject: ARB_fbo: Regenerate files from previous commits. --- src/glx/x11/indirect.c | 46 + src/glx/x11/indirect.h | 2 + src/glx/x11/indirect_init.c | 8 + src/mesa/glapi/glapitemp.h | 6 + src/mesa/glapi/glprocs.h | 198 +- src/mesa/main/enums.c | 5282 ++++++++++++++++++++-------------------- src/mesa/main/remap_helper.h | 2292 ++++++++--------- src/mesa/sparc/glapi_sparc.S | 1 + src/mesa/x86-64/glapi_x86-64.S | 1 + src/mesa/x86/glapi_x86.S | 1 + 10 files changed, 3975 insertions(+), 3862 deletions(-) (limited to 'src') diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c index e0cafd43bc..3ca71f56ff 100644 --- a/src/glx/x11/indirect.c +++ b/src/glx/x11/indirect.c @@ -8604,6 +8604,26 @@ __indirect_glDrawBuffersARB(GLsizei n, const GLenum * bufs) } } +#define X_GLrop_RenderbufferStorageMultisample 4331 +void +__indirect_glRenderbufferStorageMultisample(GLenum target, GLsizei samples, + GLenum internalformat, + GLsizei width, GLsizei height) +{ + __GLXcontext *const gc = __glXGetCurrentContext(); + const GLuint cmdlen = 24; + emit_header(gc->pc, X_GLrop_RenderbufferStorageMultisample, cmdlen); + (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4); + (void) memcpy((void *) (gc->pc + 8), (void *) (&samples), 4); + (void) memcpy((void *) (gc->pc + 12), (void *) (&internalformat), 4); + (void) memcpy((void *) (gc->pc + 16), (void *) (&width), 4); + (void) memcpy((void *) (gc->pc + 20), (void *) (&height), 4); + gc->pc += cmdlen; + if (__builtin_expect(gc->pc > gc->limit, 0)) { + (void) __glXFlushRenderBuffer(gc, gc->pc); + } +} + #define X_GLrop_SampleMaskSGIS 2048 void __indirect_glSampleMaskSGIS(GLclampf value, GLboolean invert) @@ -10597,6 +10617,32 @@ __indirect_glRenderbufferStorageEXT(GLenum target, GLenum internalformat, } } +#define X_GLrop_BlitFramebufferEXT 4330 +void +__indirect_glBlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, + GLint srcY1, GLint dstX0, GLint dstY0, + GLint dstX1, GLint dstY1, GLbitfield mask, + GLenum filter) +{ + __GLXcontext *const gc = __glXGetCurrentContext(); + const GLuint cmdlen = 44; + emit_header(gc->pc, X_GLrop_BlitFramebufferEXT, cmdlen); + (void) memcpy((void *) (gc->pc + 4), (void *) (&srcX0), 4); + (void) memcpy((void *) (gc->pc + 8), (void *) (&srcY0), 4); + (void) memcpy((void *) (gc->pc + 12), (void *) (&srcX1), 4); + (void) memcpy((void *) (gc->pc + 16), (void *) (&srcY1), 4); + (void) memcpy((void *) (gc->pc + 20), (void *) (&dstX0), 4); + (void) memcpy((void *) (gc->pc + 24), (void *) (&dstY0), 4); + (void) memcpy((void *) (gc->pc + 28), (void *) (&dstX1), 4); + (void) memcpy((void *) (gc->pc + 32), (void *) (&dstY1), 4); + (void) memcpy((void *) (gc->pc + 36), (void *) (&mask), 4); + (void) memcpy((void *) (gc->pc + 40), (void *) (&filter), 4); + gc->pc += cmdlen; + if (__builtin_expect(gc->pc > gc->limit, 0)) { + (void) __glXFlushRenderBuffer(gc, gc->pc); + } +} + # undef FASTCALL # undef NOINLINE diff --git a/src/glx/x11/indirect.h b/src/glx/x11/indirect.h index 0719a1b302..4a1b81ca6e 100644 --- a/src/glx/x11/indirect.h +++ b/src/glx/x11/indirect.h @@ -572,6 +572,7 @@ extern HIDDEN void __indirect_glGetQueryObjectuivARB(GLuint id, GLenum pname, GL extern HIDDEN void __indirect_glGetQueryivARB(GLenum target, GLenum pname, GLint * params); extern HIDDEN GLboolean __indirect_glIsQueryARB(GLuint id); extern HIDDEN void __indirect_glDrawBuffersARB(GLsizei n, const GLenum * bufs); +extern HIDDEN void __indirect_glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); extern HIDDEN void __indirect_glSampleMaskSGIS(GLclampf value, GLboolean invert); extern HIDDEN void __indirect_glSamplePatternSGIS(GLenum pattern); extern HIDDEN void __indirect_glColorPointerEXT(GLint size, GLenum type, GLsizei stride, GLsizei count, const GLvoid * pointer); @@ -710,6 +711,7 @@ extern HIDDEN void __indirect_glGetRenderbufferParameterivEXT(GLenum target, GLe extern HIDDEN GLboolean __indirect_glIsFramebufferEXT(GLuint framebuffer); extern HIDDEN GLboolean __indirect_glIsRenderbufferEXT(GLuint renderbuffer); extern HIDDEN void __indirect_glRenderbufferStorageEXT(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +extern HIDDEN void __indirect_glBlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); # undef HIDDEN # undef FASTCALL diff --git a/src/glx/x11/indirect_init.c b/src/glx/x11/indirect_init.c index 852fe712c6..aa9a6bb2b0 100644 --- a/src/glx/x11/indirect_init.c +++ b/src/glx/x11/indirect_init.c @@ -588,6 +588,10 @@ __GLapi * __glXNewIndirectAPI( void ) glAPI->DrawBuffersARB = __indirect_glDrawBuffersARB; + /* 45. GL_ARB_framebuffer_object */ + + glAPI->RenderbufferStorageMultisample = __indirect_glRenderbufferStorageMultisample; + /* 25. GL_SGIS_multisample */ glAPI->SampleMaskSGIS = __indirect_glSampleMaskSGIS; @@ -768,6 +772,10 @@ __GLapi * __glXNewIndirectAPI( void ) glAPI->IsRenderbufferEXT = __indirect_glIsRenderbufferEXT; glAPI->RenderbufferStorageEXT = __indirect_glRenderbufferStorageEXT; + /* 316. GL_EXT_framebuffer_blit */ + + glAPI->BlitFramebufferEXT = __indirect_glBlitFramebufferEXT; + return glAPI; } diff --git a/src/mesa/glapi/glapitemp.h b/src/mesa/glapi/glapitemp.h index d9a3690f2a..319a4ab55b 100644 --- a/src/mesa/glapi/glapitemp.h +++ b/src/mesa/glapi/glapitemp.h @@ -4011,6 +4011,11 @@ KEYWORD1 void KEYWORD2 NAME(RenderbufferStorageMultisample)(GLenum target, GLsiz DISPATCH(RenderbufferStorageMultisample, (target, samples, internalformat, width, height), (F, "glRenderbufferStorageMultisample(0x%x, %d, 0x%x, %d, %d);\n", target, samples, internalformat, width, height)); } +KEYWORD1 void KEYWORD2 NAME(RenderbufferStorageMultisampleEXT)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) +{ + DISPATCH(RenderbufferStorageMultisample, (target, samples, internalformat, width, height), (F, "glRenderbufferStorageMultisampleEXT(0x%x, %d, 0x%x, %d, %d);\n", target, samples, internalformat, width, height)); +} + KEYWORD1 void KEYWORD2 NAME(FlushMappedBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length) { DISPATCH(FlushMappedBufferRange, (target, offset, length), (F, "glFlushMappedBufferRange(0x%x, %d, %d);\n", target, offset, length)); @@ -6837,6 +6842,7 @@ static _glapi_proc UNUSED_TABLE_NAME[] = { TABLE_ENTRY(GetAttribLocation), TABLE_ENTRY(DrawBuffers), TABLE_ENTRY(DrawBuffersATI), + TABLE_ENTRY(RenderbufferStorageMultisampleEXT), TABLE_ENTRY(PointParameterf), TABLE_ENTRY(PointParameterfARB), TABLE_ENTRY(PointParameterfv), diff --git a/src/mesa/glapi/glprocs.h b/src/mesa/glapi/glprocs.h index c29f8b57be..1ad7e84337 100644 --- a/src/mesa/glapi/glprocs.h +++ b/src/mesa/glapi/glprocs.h @@ -1050,6 +1050,7 @@ static const char gl_string_table[] = "glGetAttribLocation\0" "glDrawBuffers\0" "glDrawBuffersATI\0" + "glRenderbufferStorageMultisampleEXT\0" "glSampleMaskEXT\0" "glSamplePatternEXT\0" "glPointParameterf\0" @@ -2257,104 +2258,105 @@ static const glprocs_table_t static_functions[] = { NAME_FUNC_OFFSET(17904, glGetAttribLocationARB, glGetAttribLocationARB, NULL, _gloffset_GetAttribLocationARB), NAME_FUNC_OFFSET(17924, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), NAME_FUNC_OFFSET(17938, glDrawBuffersARB, glDrawBuffersARB, NULL, _gloffset_DrawBuffersARB), - NAME_FUNC_OFFSET(17955, gl_dispatch_stub_584, gl_dispatch_stub_584, NULL, _gloffset_SampleMaskSGIS), - NAME_FUNC_OFFSET(17971, gl_dispatch_stub_585, gl_dispatch_stub_585, NULL, _gloffset_SamplePatternSGIS), - NAME_FUNC_OFFSET(17990, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(18008, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(18029, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), - NAME_FUNC_OFFSET(18051, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(18070, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(18092, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), - NAME_FUNC_OFFSET(18115, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), - NAME_FUNC_OFFSET(18134, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), - NAME_FUNC_OFFSET(18154, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), - NAME_FUNC_OFFSET(18173, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), - NAME_FUNC_OFFSET(18193, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), - NAME_FUNC_OFFSET(18212, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), - NAME_FUNC_OFFSET(18232, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), - NAME_FUNC_OFFSET(18251, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), - NAME_FUNC_OFFSET(18271, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), - NAME_FUNC_OFFSET(18290, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), - NAME_FUNC_OFFSET(18310, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), - NAME_FUNC_OFFSET(18330, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), - NAME_FUNC_OFFSET(18351, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), - NAME_FUNC_OFFSET(18371, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), - NAME_FUNC_OFFSET(18392, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), - NAME_FUNC_OFFSET(18412, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), - NAME_FUNC_OFFSET(18433, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), - NAME_FUNC_OFFSET(18457, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), - NAME_FUNC_OFFSET(18475, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), - NAME_FUNC_OFFSET(18495, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), - NAME_FUNC_OFFSET(18513, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), - NAME_FUNC_OFFSET(18525, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), - NAME_FUNC_OFFSET(18538, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), - NAME_FUNC_OFFSET(18550, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), - NAME_FUNC_OFFSET(18563, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(18583, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), - NAME_FUNC_OFFSET(18607, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(18621, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), - NAME_FUNC_OFFSET(18638, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(18653, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), - NAME_FUNC_OFFSET(18671, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(18685, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), - NAME_FUNC_OFFSET(18702, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(18717, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), - NAME_FUNC_OFFSET(18735, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(18749, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), - NAME_FUNC_OFFSET(18766, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(18781, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), - NAME_FUNC_OFFSET(18799, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(18813, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), - NAME_FUNC_OFFSET(18830, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(18845, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), - NAME_FUNC_OFFSET(18863, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(18877, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), - NAME_FUNC_OFFSET(18894, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(18909, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), - NAME_FUNC_OFFSET(18927, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(18941, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), - NAME_FUNC_OFFSET(18958, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(18973, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), - NAME_FUNC_OFFSET(18991, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(19005, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), - NAME_FUNC_OFFSET(19022, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(19037, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), - NAME_FUNC_OFFSET(19055, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(19069, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), - NAME_FUNC_OFFSET(19086, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(19101, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), - NAME_FUNC_OFFSET(19119, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), - NAME_FUNC_OFFSET(19136, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), - NAME_FUNC_OFFSET(19156, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), - NAME_FUNC_OFFSET(19173, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(19199, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), - NAME_FUNC_OFFSET(19228, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), - NAME_FUNC_OFFSET(19243, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), - NAME_FUNC_OFFSET(19261, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), - NAME_FUNC_OFFSET(19280, gl_dispatch_stub_755, gl_dispatch_stub_755, NULL, _gloffset_DeleteVertexArraysAPPLE), - NAME_FUNC_OFFSET(19301, gl_dispatch_stub_757, gl_dispatch_stub_757, NULL, _gloffset_IsVertexArrayAPPLE), - NAME_FUNC_OFFSET(19317, gl_dispatch_stub_765, gl_dispatch_stub_765, NULL, _gloffset_BlendEquationSeparateEXT), - NAME_FUNC_OFFSET(19341, gl_dispatch_stub_765, gl_dispatch_stub_765, NULL, _gloffset_BlendEquationSeparateEXT), - NAME_FUNC_OFFSET(19368, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT), - NAME_FUNC_OFFSET(19386, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT), - NAME_FUNC_OFFSET(19405, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT), - NAME_FUNC_OFFSET(19430, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT), - NAME_FUNC_OFFSET(19451, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT), - NAME_FUNC_OFFSET(19473, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT), - NAME_FUNC_OFFSET(19499, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT), - NAME_FUNC_OFFSET(19522, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT), - NAME_FUNC_OFFSET(19545, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT), - NAME_FUNC_OFFSET(19568, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT), - NAME_FUNC_OFFSET(19586, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT), - NAME_FUNC_OFFSET(19605, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT), - NAME_FUNC_OFFSET(19622, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT), - NAME_FUNC_OFFSET(19660, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT), - NAME_FUNC_OFFSET(19689, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT), - NAME_FUNC_OFFSET(19705, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT), - NAME_FUNC_OFFSET(19722, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), - NAME_FUNC_OFFSET(19744, gl_dispatch_stub_783, gl_dispatch_stub_783, NULL, _gloffset_BlitFramebufferEXT), - NAME_FUNC_OFFSET(19762, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), - NAME_FUNC_OFFSET(19788, glProvokingVertexEXT, glProvokingVertexEXT, NULL, _gloffset_ProvokingVertexEXT), + NAME_FUNC_OFFSET(17955, glRenderbufferStorageMultisample, glRenderbufferStorageMultisample, NULL, _gloffset_RenderbufferStorageMultisample), + NAME_FUNC_OFFSET(17991, gl_dispatch_stub_584, gl_dispatch_stub_584, NULL, _gloffset_SampleMaskSGIS), + NAME_FUNC_OFFSET(18007, gl_dispatch_stub_585, gl_dispatch_stub_585, NULL, _gloffset_SamplePatternSGIS), + NAME_FUNC_OFFSET(18026, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(18044, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(18065, glPointParameterfEXT, glPointParameterfEXT, NULL, _gloffset_PointParameterfEXT), + NAME_FUNC_OFFSET(18087, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(18106, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(18128, glPointParameterfvEXT, glPointParameterfvEXT, NULL, _gloffset_PointParameterfvEXT), + NAME_FUNC_OFFSET(18151, glSecondaryColor3bEXT, glSecondaryColor3bEXT, NULL, _gloffset_SecondaryColor3bEXT), + NAME_FUNC_OFFSET(18170, glSecondaryColor3bvEXT, glSecondaryColor3bvEXT, NULL, _gloffset_SecondaryColor3bvEXT), + NAME_FUNC_OFFSET(18190, glSecondaryColor3dEXT, glSecondaryColor3dEXT, NULL, _gloffset_SecondaryColor3dEXT), + NAME_FUNC_OFFSET(18209, glSecondaryColor3dvEXT, glSecondaryColor3dvEXT, NULL, _gloffset_SecondaryColor3dvEXT), + NAME_FUNC_OFFSET(18229, glSecondaryColor3fEXT, glSecondaryColor3fEXT, NULL, _gloffset_SecondaryColor3fEXT), + NAME_FUNC_OFFSET(18248, glSecondaryColor3fvEXT, glSecondaryColor3fvEXT, NULL, _gloffset_SecondaryColor3fvEXT), + NAME_FUNC_OFFSET(18268, glSecondaryColor3iEXT, glSecondaryColor3iEXT, NULL, _gloffset_SecondaryColor3iEXT), + NAME_FUNC_OFFSET(18287, glSecondaryColor3ivEXT, glSecondaryColor3ivEXT, NULL, _gloffset_SecondaryColor3ivEXT), + NAME_FUNC_OFFSET(18307, glSecondaryColor3sEXT, glSecondaryColor3sEXT, NULL, _gloffset_SecondaryColor3sEXT), + NAME_FUNC_OFFSET(18326, glSecondaryColor3svEXT, glSecondaryColor3svEXT, NULL, _gloffset_SecondaryColor3svEXT), + NAME_FUNC_OFFSET(18346, glSecondaryColor3ubEXT, glSecondaryColor3ubEXT, NULL, _gloffset_SecondaryColor3ubEXT), + NAME_FUNC_OFFSET(18366, glSecondaryColor3ubvEXT, glSecondaryColor3ubvEXT, NULL, _gloffset_SecondaryColor3ubvEXT), + NAME_FUNC_OFFSET(18387, glSecondaryColor3uiEXT, glSecondaryColor3uiEXT, NULL, _gloffset_SecondaryColor3uiEXT), + NAME_FUNC_OFFSET(18407, glSecondaryColor3uivEXT, glSecondaryColor3uivEXT, NULL, _gloffset_SecondaryColor3uivEXT), + NAME_FUNC_OFFSET(18428, glSecondaryColor3usEXT, glSecondaryColor3usEXT, NULL, _gloffset_SecondaryColor3usEXT), + NAME_FUNC_OFFSET(18448, glSecondaryColor3usvEXT, glSecondaryColor3usvEXT, NULL, _gloffset_SecondaryColor3usvEXT), + NAME_FUNC_OFFSET(18469, glSecondaryColorPointerEXT, glSecondaryColorPointerEXT, NULL, _gloffset_SecondaryColorPointerEXT), + NAME_FUNC_OFFSET(18493, glMultiDrawArraysEXT, glMultiDrawArraysEXT, NULL, _gloffset_MultiDrawArraysEXT), + NAME_FUNC_OFFSET(18511, glMultiDrawElementsEXT, glMultiDrawElementsEXT, NULL, _gloffset_MultiDrawElementsEXT), + NAME_FUNC_OFFSET(18531, glFogCoordPointerEXT, glFogCoordPointerEXT, NULL, _gloffset_FogCoordPointerEXT), + NAME_FUNC_OFFSET(18549, glFogCoorddEXT, glFogCoorddEXT, NULL, _gloffset_FogCoorddEXT), + NAME_FUNC_OFFSET(18561, glFogCoorddvEXT, glFogCoorddvEXT, NULL, _gloffset_FogCoorddvEXT), + NAME_FUNC_OFFSET(18574, glFogCoordfEXT, glFogCoordfEXT, NULL, _gloffset_FogCoordfEXT), + NAME_FUNC_OFFSET(18586, glFogCoordfvEXT, glFogCoordfvEXT, NULL, _gloffset_FogCoordfvEXT), + NAME_FUNC_OFFSET(18599, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(18619, glBlendFuncSeparateEXT, glBlendFuncSeparateEXT, NULL, _gloffset_BlendFuncSeparateEXT), + NAME_FUNC_OFFSET(18643, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(18657, glWindowPos2dMESA, glWindowPos2dMESA, NULL, _gloffset_WindowPos2dMESA), + NAME_FUNC_OFFSET(18674, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(18689, glWindowPos2dvMESA, glWindowPos2dvMESA, NULL, _gloffset_WindowPos2dvMESA), + NAME_FUNC_OFFSET(18707, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(18721, glWindowPos2fMESA, glWindowPos2fMESA, NULL, _gloffset_WindowPos2fMESA), + NAME_FUNC_OFFSET(18738, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(18753, glWindowPos2fvMESA, glWindowPos2fvMESA, NULL, _gloffset_WindowPos2fvMESA), + NAME_FUNC_OFFSET(18771, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(18785, glWindowPos2iMESA, glWindowPos2iMESA, NULL, _gloffset_WindowPos2iMESA), + NAME_FUNC_OFFSET(18802, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(18817, glWindowPos2ivMESA, glWindowPos2ivMESA, NULL, _gloffset_WindowPos2ivMESA), + NAME_FUNC_OFFSET(18835, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(18849, glWindowPos2sMESA, glWindowPos2sMESA, NULL, _gloffset_WindowPos2sMESA), + NAME_FUNC_OFFSET(18866, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(18881, glWindowPos2svMESA, glWindowPos2svMESA, NULL, _gloffset_WindowPos2svMESA), + NAME_FUNC_OFFSET(18899, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(18913, glWindowPos3dMESA, glWindowPos3dMESA, NULL, _gloffset_WindowPos3dMESA), + NAME_FUNC_OFFSET(18930, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(18945, glWindowPos3dvMESA, glWindowPos3dvMESA, NULL, _gloffset_WindowPos3dvMESA), + NAME_FUNC_OFFSET(18963, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(18977, glWindowPos3fMESA, glWindowPos3fMESA, NULL, _gloffset_WindowPos3fMESA), + NAME_FUNC_OFFSET(18994, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(19009, glWindowPos3fvMESA, glWindowPos3fvMESA, NULL, _gloffset_WindowPos3fvMESA), + NAME_FUNC_OFFSET(19027, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(19041, glWindowPos3iMESA, glWindowPos3iMESA, NULL, _gloffset_WindowPos3iMESA), + NAME_FUNC_OFFSET(19058, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(19073, glWindowPos3ivMESA, glWindowPos3ivMESA, NULL, _gloffset_WindowPos3ivMESA), + NAME_FUNC_OFFSET(19091, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(19105, glWindowPos3sMESA, glWindowPos3sMESA, NULL, _gloffset_WindowPos3sMESA), + NAME_FUNC_OFFSET(19122, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(19137, glWindowPos3svMESA, glWindowPos3svMESA, NULL, _gloffset_WindowPos3svMESA), + NAME_FUNC_OFFSET(19155, glBindProgramNV, glBindProgramNV, NULL, _gloffset_BindProgramNV), + NAME_FUNC_OFFSET(19172, glDeleteProgramsNV, glDeleteProgramsNV, NULL, _gloffset_DeleteProgramsNV), + NAME_FUNC_OFFSET(19192, glGenProgramsNV, glGenProgramsNV, NULL, _gloffset_GenProgramsNV), + NAME_FUNC_OFFSET(19209, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(19235, glGetVertexAttribPointervNV, glGetVertexAttribPointervNV, NULL, _gloffset_GetVertexAttribPointervNV), + NAME_FUNC_OFFSET(19264, glIsProgramNV, glIsProgramNV, NULL, _gloffset_IsProgramNV), + NAME_FUNC_OFFSET(19279, glPointParameteriNV, glPointParameteriNV, NULL, _gloffset_PointParameteriNV), + NAME_FUNC_OFFSET(19297, glPointParameterivNV, glPointParameterivNV, NULL, _gloffset_PointParameterivNV), + NAME_FUNC_OFFSET(19316, gl_dispatch_stub_755, gl_dispatch_stub_755, NULL, _gloffset_DeleteVertexArraysAPPLE), + NAME_FUNC_OFFSET(19337, gl_dispatch_stub_757, gl_dispatch_stub_757, NULL, _gloffset_IsVertexArrayAPPLE), + NAME_FUNC_OFFSET(19353, gl_dispatch_stub_765, gl_dispatch_stub_765, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(19377, gl_dispatch_stub_765, gl_dispatch_stub_765, NULL, _gloffset_BlendEquationSeparateEXT), + NAME_FUNC_OFFSET(19404, glBindFramebufferEXT, glBindFramebufferEXT, NULL, _gloffset_BindFramebufferEXT), + NAME_FUNC_OFFSET(19422, glBindRenderbufferEXT, glBindRenderbufferEXT, NULL, _gloffset_BindRenderbufferEXT), + NAME_FUNC_OFFSET(19441, glCheckFramebufferStatusEXT, glCheckFramebufferStatusEXT, NULL, _gloffset_CheckFramebufferStatusEXT), + NAME_FUNC_OFFSET(19466, glDeleteFramebuffersEXT, glDeleteFramebuffersEXT, NULL, _gloffset_DeleteFramebuffersEXT), + NAME_FUNC_OFFSET(19487, glDeleteRenderbuffersEXT, glDeleteRenderbuffersEXT, NULL, _gloffset_DeleteRenderbuffersEXT), + NAME_FUNC_OFFSET(19509, glFramebufferRenderbufferEXT, glFramebufferRenderbufferEXT, NULL, _gloffset_FramebufferRenderbufferEXT), + NAME_FUNC_OFFSET(19535, glFramebufferTexture1DEXT, glFramebufferTexture1DEXT, NULL, _gloffset_FramebufferTexture1DEXT), + NAME_FUNC_OFFSET(19558, glFramebufferTexture2DEXT, glFramebufferTexture2DEXT, NULL, _gloffset_FramebufferTexture2DEXT), + NAME_FUNC_OFFSET(19581, glFramebufferTexture3DEXT, glFramebufferTexture3DEXT, NULL, _gloffset_FramebufferTexture3DEXT), + NAME_FUNC_OFFSET(19604, glGenFramebuffersEXT, glGenFramebuffersEXT, NULL, _gloffset_GenFramebuffersEXT), + NAME_FUNC_OFFSET(19622, glGenRenderbuffersEXT, glGenRenderbuffersEXT, NULL, _gloffset_GenRenderbuffersEXT), + NAME_FUNC_OFFSET(19641, glGenerateMipmapEXT, glGenerateMipmapEXT, NULL, _gloffset_GenerateMipmapEXT), + NAME_FUNC_OFFSET(19658, glGetFramebufferAttachmentParameterivEXT, glGetFramebufferAttachmentParameterivEXT, NULL, _gloffset_GetFramebufferAttachmentParameterivEXT), + NAME_FUNC_OFFSET(19696, glGetRenderbufferParameterivEXT, glGetRenderbufferParameterivEXT, NULL, _gloffset_GetRenderbufferParameterivEXT), + NAME_FUNC_OFFSET(19725, glIsFramebufferEXT, glIsFramebufferEXT, NULL, _gloffset_IsFramebufferEXT), + NAME_FUNC_OFFSET(19741, glIsRenderbufferEXT, glIsRenderbufferEXT, NULL, _gloffset_IsRenderbufferEXT), + NAME_FUNC_OFFSET(19758, glRenderbufferStorageEXT, glRenderbufferStorageEXT, NULL, _gloffset_RenderbufferStorageEXT), + NAME_FUNC_OFFSET(19780, gl_dispatch_stub_783, gl_dispatch_stub_783, NULL, _gloffset_BlitFramebufferEXT), + NAME_FUNC_OFFSET(19798, glFramebufferTextureLayerEXT, glFramebufferTextureLayerEXT, NULL, _gloffset_FramebufferTextureLayerEXT), + NAME_FUNC_OFFSET(19824, glProvokingVertexEXT, glProvokingVertexEXT, NULL, _gloffset_ProvokingVertexEXT), NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0) }; diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c index 606d50c59a..f9f4bc7853 100644 --- a/src/mesa/main/enums.c +++ b/src/mesa/main/enums.c @@ -384,6 +384,7 @@ LONGSTRING static const char enum_string_table[] = "GL_DELETE_STATUS\0" "GL_DEPTH\0" "GL_DEPTH24_STENCIL8\0" + "GL_DEPTH24_STENCIL8_EXT\0" "GL_DEPTH_ATTACHMENT\0" "GL_DEPTH_ATTACHMENT_EXT\0" "GL_DEPTH_BIAS\0" @@ -409,6 +410,7 @@ LONGSTRING static const char enum_string_table[] = "GL_DEPTH_SCALE\0" "GL_DEPTH_STENCIL\0" "GL_DEPTH_STENCIL_ATTACHMENT\0" + "GL_DEPTH_STENCIL_EXT\0" "GL_DEPTH_STENCIL_NV\0" "GL_DEPTH_STENCIL_TO_BGRA_NV\0" "GL_DEPTH_STENCIL_TO_RGBA_NV\0" @@ -478,6 +480,7 @@ LONGSTRING static const char enum_string_table[] = "GL_DRAW_BUFFER9_ARB\0" "GL_DRAW_BUFFER9_ATI\0" "GL_DRAW_FRAMEBUFFER\0" + "GL_DRAW_FRAMEBUFFER_BINDING\0" "GL_DRAW_FRAMEBUFFER_BINDING_EXT\0" "GL_DRAW_FRAMEBUFFER_EXT\0" "GL_DRAW_PIXEL_TOKEN\0" @@ -593,6 +596,7 @@ LONGSTRING static const char enum_string_table[] = "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT\0" "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL\0" "GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT\0" + "GL_FRAMEBUFFER_BINDING\0" "GL_FRAMEBUFFER_BINDING_EXT\0" "GL_FRAMEBUFFER_COMPLETE\0" "GL_FRAMEBUFFER_COMPLETE_EXT\0" @@ -601,12 +605,15 @@ LONGSTRING static const char enum_string_table[] = "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT\0" "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT\0" "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER\0" "GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT\0" "GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT\0" "GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT\0" "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT\0" "GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT\0" "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE\0" + "GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT\0" + "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER\0" "GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT\0" "GL_FRAMEBUFFER_STATUS_ERROR_EXT\0" "GL_FRAMEBUFFER_UNDEFINED\0" @@ -892,6 +899,7 @@ LONGSTRING static const char enum_string_table[] = "GL_MAX_CLIPMAP_DEPTH_SGIX\0" "GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX\0" "GL_MAX_CLIP_PLANES\0" + "GL_MAX_COLOR_ATTACHMENTS\0" "GL_MAX_COLOR_ATTACHMENTS_EXT\0" "GL_MAX_COLOR_MATRIX_STACK_DEPTH\0" "GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI\0" @@ -947,8 +955,10 @@ LONGSTRING static const char enum_string_table[] = "GL_MAX_PROJECTION_STACK_DEPTH\0" "GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB\0" "GL_MAX_RECTANGLE_TEXTURE_SIZE_NV\0" + "GL_MAX_RENDERBUFFER_SIZE\0" "GL_MAX_RENDERBUFFER_SIZE_EXT\0" "GL_MAX_SAMPLES\0" + "GL_MAX_SAMPLES_EXT\0" "GL_MAX_SERVER_WAIT_TIMEOUT\0" "GL_MAX_SHININESS_NV\0" "GL_MAX_SPOT_EXPONENT_NV\0" @@ -1327,6 +1337,7 @@ LONGSTRING static const char enum_string_table[] = "GL_RASTER_POSITION_UNCLIPPED_IBM\0" "GL_READ_BUFFER\0" "GL_READ_FRAMEBUFFER\0" + "GL_READ_FRAMEBUFFER_BINDING\0" "GL_READ_FRAMEBUFFER_BINDING_EXT\0" "GL_READ_FRAMEBUFFER_EXT\0" "GL_READ_ONLY\0" @@ -1345,6 +1356,7 @@ LONGSTRING static const char enum_string_table[] = "GL_RENDER\0" "GL_RENDERBUFFER\0" "GL_RENDERBUFFER_ALPHA_SIZE\0" + "GL_RENDERBUFFER_BINDING\0" "GL_RENDERBUFFER_BINDING_EXT\0" "GL_RENDERBUFFER_BLUE_SIZE\0" "GL_RENDERBUFFER_DEPTH_SIZE\0" @@ -1356,6 +1368,7 @@ LONGSTRING static const char enum_string_table[] = "GL_RENDERBUFFER_INTERNAL_FORMAT_EXT\0" "GL_RENDERBUFFER_RED_SIZE\0" "GL_RENDERBUFFER_SAMPLES\0" + "GL_RENDERBUFFER_SAMPLES_EXT\0" "GL_RENDERBUFFER_STENCIL_SIZE\0" "GL_RENDERBUFFER_WIDTH\0" "GL_RENDERBUFFER_WIDTH_EXT\0" @@ -1541,9 +1554,13 @@ LONGSTRING static const char enum_string_table[] = "GL_STENCIL_FAIL\0" "GL_STENCIL_FUNC\0" "GL_STENCIL_INDEX\0" + "GL_STENCIL_INDEX1\0" + "GL_STENCIL_INDEX16\0" "GL_STENCIL_INDEX16_EXT\0" "GL_STENCIL_INDEX1_EXT\0" + "GL_STENCIL_INDEX4\0" "GL_STENCIL_INDEX4_EXT\0" + "GL_STENCIL_INDEX8\0" "GL_STENCIL_INDEX8_EXT\0" "GL_STENCIL_INDEX_EXT\0" "GL_STENCIL_PASS_DEPTH_FAIL\0" @@ -1761,6 +1778,7 @@ LONGSTRING static const char enum_string_table[] = "GL_TEXTURE_RESIDENT\0" "GL_TEXTURE_STACK_DEPTH\0" "GL_TEXTURE_STENCIL_SIZE\0" + "GL_TEXTURE_STENCIL_SIZE_EXT\0" "GL_TEXTURE_STORAGE_HINT_APPLE\0" "GL_TEXTURE_TOO_LARGE_EXT\0" "GL_TEXTURE_UNSIGNED_REMAP_MODE_NV\0" @@ -1804,6 +1822,7 @@ LONGSTRING static const char enum_string_table[] = "GL_UNSIGNED_INT\0" "GL_UNSIGNED_INT_10_10_10_2\0" "GL_UNSIGNED_INT_24_8\0" + "GL_UNSIGNED_INT_24_8_EXT\0" "GL_UNSIGNED_INT_24_8_NV\0" "GL_UNSIGNED_INT_2_10_10_10_REV\0" "GL_UNSIGNED_INT_8_8_8_8\0" @@ -1900,7 +1919,7 @@ LONGSTRING static const char enum_string_table[] = "GL_ZOOM_Y\0" ; -static const enum_elt all_enums[1862] = +static const enum_elt all_enums[1881] = { { 0, 0x00000600 }, /* GL_2D */ { 6, 0x00001407 }, /* GL_2_BYTES */ @@ -2250,1600 +2269,1619 @@ static const enum_elt all_enums[1862] = { 7144, 0x00008B80 }, /* GL_DELETE_STATUS */ { 7161, 0x00001801 }, /* GL_DEPTH */ { 7170, 0x000088F0 }, /* GL_DEPTH24_STENCIL8 */ - { 7190, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT */ - { 7210, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */ - { 7234, 0x00000D1F }, /* GL_DEPTH_BIAS */ - { 7248, 0x00000D56 }, /* GL_DEPTH_BITS */ - { 7262, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */ - { 7282, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */ - { 7307, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */ - { 7327, 0x0000864F }, /* GL_DEPTH_CLAMP */ - { 7342, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */ - { 7360, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */ - { 7381, 0x00001902 }, /* GL_DEPTH_COMPONENT */ - { 7400, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */ - { 7421, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */ - { 7446, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */ - { 7472, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */ - { 7493, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */ - { 7518, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */ - { 7544, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */ - { 7565, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */ - { 7590, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */ - { 7616, 0x00000B74 }, /* GL_DEPTH_FUNC */ - { 7630, 0x00000B70 }, /* GL_DEPTH_RANGE */ - { 7645, 0x00000D1E }, /* GL_DEPTH_SCALE */ - { 7660, 0x000084F9 }, /* GL_DEPTH_STENCIL */ - { 7677, 0x0000821A }, /* GL_DEPTH_STENCIL_ATTACHMENT */ - { 7705, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */ - { 7725, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ - { 7753, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ - { 7781, 0x00000B71 }, /* GL_DEPTH_TEST */ - { 7795, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */ - { 7817, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */ - { 7843, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */ - { 7862, 0x00001201 }, /* GL_DIFFUSE */ - { 7873, 0x00000BD0 }, /* GL_DITHER */ - { 7883, 0x00000A02 }, /* GL_DOMAIN */ - { 7893, 0x00001100 }, /* GL_DONT_CARE */ - { 7906, 0x000086AE }, /* GL_DOT3_RGB */ - { 7918, 0x000086AF }, /* GL_DOT3_RGBA */ - { 7931, 0x000086AF }, /* GL_DOT3_RGBA_ARB */ - { 7948, 0x00008741 }, /* GL_DOT3_RGBA_EXT */ - { 7965, 0x000086AE }, /* GL_DOT3_RGB_ARB */ - { 7981, 0x00008740 }, /* GL_DOT3_RGB_EXT */ - { 7997, 0x0000140A }, /* GL_DOUBLE */ - { 8007, 0x00000C32 }, /* GL_DOUBLEBUFFER */ - { 8023, 0x00000C01 }, /* GL_DRAW_BUFFER */ - { 8038, 0x00008825 }, /* GL_DRAW_BUFFER0 */ - { 8054, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */ - { 8074, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */ - { 8094, 0x00008826 }, /* GL_DRAW_BUFFER1 */ - { 8110, 0x0000882F }, /* GL_DRAW_BUFFER10 */ - { 8127, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */ - { 8148, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */ - { 8169, 0x00008830 }, /* GL_DRAW_BUFFER11 */ - { 8186, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */ - { 8207, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */ - { 8228, 0x00008831 }, /* GL_DRAW_BUFFER12 */ - { 8245, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */ - { 8266, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */ - { 8287, 0x00008832 }, /* GL_DRAW_BUFFER13 */ - { 8304, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */ - { 8325, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */ - { 8346, 0x00008833 }, /* GL_DRAW_BUFFER14 */ - { 8363, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */ - { 8384, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */ - { 8405, 0x00008834 }, /* GL_DRAW_BUFFER15 */ - { 8422, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */ - { 8443, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */ - { 8464, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */ - { 8484, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */ - { 8504, 0x00008827 }, /* GL_DRAW_BUFFER2 */ - { 8520, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */ - { 8540, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */ - { 8560, 0x00008828 }, /* GL_DRAW_BUFFER3 */ - { 8576, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */ - { 8596, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */ - { 8616, 0x00008829 }, /* GL_DRAW_BUFFER4 */ - { 8632, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */ - { 8652, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */ - { 8672, 0x0000882A }, /* GL_DRAW_BUFFER5 */ - { 8688, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */ - { 8708, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */ - { 8728, 0x0000882B }, /* GL_DRAW_BUFFER6 */ - { 8744, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */ - { 8764, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */ - { 8784, 0x0000882C }, /* GL_DRAW_BUFFER7 */ - { 8800, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */ - { 8820, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */ - { 8840, 0x0000882D }, /* GL_DRAW_BUFFER8 */ - { 8856, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */ - { 8876, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */ - { 8896, 0x0000882E }, /* GL_DRAW_BUFFER9 */ - { 8912, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */ - { 8932, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */ - { 8952, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER */ - { 8972, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */ - { 9004, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER_EXT */ - { 9028, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */ - { 9048, 0x00000304 }, /* GL_DST_ALPHA */ - { 9061, 0x00000306 }, /* GL_DST_COLOR */ - { 9074, 0x0000877A }, /* GL_DU8DV8_ATI */ - { 9088, 0x00008779 }, /* GL_DUDV_ATI */ - { 9100, 0x000088EA }, /* GL_DYNAMIC_COPY */ - { 9116, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */ - { 9136, 0x000088E8 }, /* GL_DYNAMIC_DRAW */ - { 9152, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */ - { 9172, 0x000088E9 }, /* GL_DYNAMIC_READ */ - { 9188, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */ - { 9208, 0x00000B43 }, /* GL_EDGE_FLAG */ - { 9221, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */ - { 9240, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ - { 9274, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */ - { 9312, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */ - { 9339, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */ - { 9365, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */ - { 9389, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ - { 9421, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */ - { 9457, 0x00001600 }, /* GL_EMISSION */ - { 9469, 0x00002000 }, /* GL_ENABLE_BIT */ - { 9483, 0x00000202 }, /* GL_EQUAL */ - { 9492, 0x00001509 }, /* GL_EQUIV */ - { 9501, 0x00010000 }, /* GL_EVAL_BIT */ - { 9513, 0x00000800 }, /* GL_EXP */ - { 9520, 0x00000801 }, /* GL_EXP2 */ - { 9528, 0x00001F03 }, /* GL_EXTENSIONS */ - { 9542, 0x00002400 }, /* GL_EYE_LINEAR */ - { 9556, 0x00002502 }, /* GL_EYE_PLANE */ - { 9569, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */ - { 9594, 0x0000855B }, /* GL_EYE_RADIAL_NV */ - { 9611, 0x00000000 }, /* GL_FALSE */ - { 9620, 0x00001101 }, /* GL_FASTEST */ - { 9631, 0x00001C01 }, /* GL_FEEDBACK */ - { 9643, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */ - { 9670, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */ - { 9694, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */ - { 9718, 0x00001B02 }, /* GL_FILL */ - { 9726, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION */ - { 9753, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION_EXT */ - { 9784, 0x00001D00 }, /* GL_FLAT */ - { 9792, 0x00001406 }, /* GL_FLOAT */ - { 9801, 0x00008B5A }, /* GL_FLOAT_MAT2 */ - { 9815, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */ - { 9833, 0x00008B65 }, /* GL_FLOAT_MAT2x3 */ - { 9849, 0x00008B66 }, /* GL_FLOAT_MAT2x4 */ - { 9865, 0x00008B5B }, /* GL_FLOAT_MAT3 */ - { 9879, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */ - { 9897, 0x00008B67 }, /* GL_FLOAT_MAT3x2 */ - { 9913, 0x00008B68 }, /* GL_FLOAT_MAT3x4 */ - { 9929, 0x00008B5C }, /* GL_FLOAT_MAT4 */ - { 9943, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */ - { 9961, 0x00008B69 }, /* GL_FLOAT_MAT4x2 */ - { 9977, 0x00008B6A }, /* GL_FLOAT_MAT4x3 */ - { 9993, 0x00008B50 }, /* GL_FLOAT_VEC2 */ - { 10007, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */ - { 10025, 0x00008B51 }, /* GL_FLOAT_VEC3 */ - { 10039, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */ - { 10057, 0x00008B52 }, /* GL_FLOAT_VEC4 */ - { 10071, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */ - { 10089, 0x00000B60 }, /* GL_FOG */ - { 10096, 0x00000080 }, /* GL_FOG_BIT */ - { 10107, 0x00000B66 }, /* GL_FOG_COLOR */ - { 10120, 0x00008451 }, /* GL_FOG_COORD */ - { 10133, 0x00008451 }, /* GL_FOG_COORDINATE */ - { 10151, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */ - { 10175, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ - { 10214, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */ - { 10257, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */ - { 10289, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ - { 10320, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */ - { 10349, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */ - { 10374, 0x00008457 }, /* GL_FOG_COORD_ARRAY */ - { 10393, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */ - { 10427, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */ - { 10454, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */ - { 10480, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */ - { 10504, 0x00008450 }, /* GL_FOG_COORD_SRC */ - { 10521, 0x00000B62 }, /* GL_FOG_DENSITY */ - { 10536, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */ - { 10560, 0x00000B64 }, /* GL_FOG_END */ - { 10571, 0x00000C54 }, /* GL_FOG_HINT */ - { 10583, 0x00000B61 }, /* GL_FOG_INDEX */ - { 10596, 0x00000B65 }, /* GL_FOG_MODE */ - { 10608, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */ - { 10627, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */ - { 10652, 0x00000B63 }, /* GL_FOG_START */ - { 10665, 0x00008452 }, /* GL_FRAGMENT_DEPTH */ - { 10683, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */ - { 10707, 0x00008B30 }, /* GL_FRAGMENT_SHADER */ - { 10726, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */ - { 10749, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ - { 10784, 0x00008D40 }, /* GL_FRAMEBUFFER */ - { 10799, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ - { 10836, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ - { 10872, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ - { 10913, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ - { 10954, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ - { 10991, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ - { 11028, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ - { 11066, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */ - { 11108, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ - { 11146, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */ - { 11188, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ - { 11223, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ - { 11262, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */ - { 11311, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ - { 11359, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */ - { 11411, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ - { 11451, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ - { 11495, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ - { 11535, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */ - { 11579, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */ - { 11606, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */ - { 11630, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */ - { 11658, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */ - { 11681, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */ - { 11700, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ - { 11737, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */ - { 11778, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ - { 11819, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ - { 11861, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ - { 11912, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ - { 11950, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ - { 11995, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */ - { 12044, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ - { 12082, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ - { 12124, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ - { 12156, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */ - { 12181, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */ - { 12208, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */ - { 12239, 0x00000404 }, /* GL_FRONT */ - { 12248, 0x00000408 }, /* GL_FRONT_AND_BACK */ - { 12266, 0x00000B46 }, /* GL_FRONT_FACE */ - { 12280, 0x00000400 }, /* GL_FRONT_LEFT */ - { 12294, 0x00000401 }, /* GL_FRONT_RIGHT */ - { 12309, 0x00008006 }, /* GL_FUNC_ADD */ - { 12321, 0x00008006 }, /* GL_FUNC_ADD_EXT */ - { 12337, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */ - { 12362, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */ - { 12391, 0x0000800A }, /* GL_FUNC_SUBTRACT */ - { 12408, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */ - { 12429, 0x00008191 }, /* GL_GENERATE_MIPMAP */ - { 12448, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */ - { 12472, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */ - { 12501, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */ - { 12525, 0x00000206 }, /* GL_GEQUAL */ - { 12535, 0x00000204 }, /* GL_GREATER */ - { 12546, 0x00001904 }, /* GL_GREEN */ - { 12555, 0x00000D19 }, /* GL_GREEN_BIAS */ - { 12569, 0x00000D53 }, /* GL_GREEN_BITS */ - { 12583, 0x00000D18 }, /* GL_GREEN_SCALE */ - { 12598, 0x00008000 }, /* GL_HINT_BIT */ - { 12610, 0x00008024 }, /* GL_HISTOGRAM */ - { 12623, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */ - { 12647, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */ - { 12675, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */ - { 12698, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */ - { 12725, 0x00008024 }, /* GL_HISTOGRAM_EXT */ - { 12742, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */ - { 12762, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */ - { 12786, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */ - { 12810, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */ - { 12838, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */ - { 12866, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */ - { 12898, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */ - { 12920, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */ - { 12946, 0x0000802D }, /* GL_HISTOGRAM_SINK */ - { 12964, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */ - { 12986, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */ - { 13005, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */ - { 13028, 0x0000862A }, /* GL_IDENTITY_NV */ - { 13043, 0x00008150 }, /* GL_IGNORE_BORDER_HP */ - { 13063, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ - { 13103, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ - { 13141, 0x00001E02 }, /* GL_INCR */ - { 13149, 0x00008507 }, /* GL_INCR_WRAP */ - { 13162, 0x00008507 }, /* GL_INCR_WRAP_EXT */ - { 13179, 0x00008222 }, /* GL_INDEX */ - { 13188, 0x00008077 }, /* GL_INDEX_ARRAY */ - { 13203, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */ - { 13233, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */ - { 13267, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */ - { 13290, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */ - { 13312, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */ - { 13332, 0x00000D51 }, /* GL_INDEX_BITS */ - { 13346, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */ - { 13367, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */ - { 13385, 0x00000C30 }, /* GL_INDEX_MODE */ - { 13399, 0x00000D13 }, /* GL_INDEX_OFFSET */ - { 13415, 0x00000D12 }, /* GL_INDEX_SHIFT */ - { 13430, 0x00000C21 }, /* GL_INDEX_WRITEMASK */ - { 13449, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */ - { 13468, 0x00001404 }, /* GL_INT */ - { 13475, 0x00008049 }, /* GL_INTENSITY */ - { 13488, 0x0000804C }, /* GL_INTENSITY12 */ - { 13503, 0x0000804C }, /* GL_INTENSITY12_EXT */ - { 13522, 0x0000804D }, /* GL_INTENSITY16 */ - { 13537, 0x0000804D }, /* GL_INTENSITY16_EXT */ - { 13556, 0x0000804A }, /* GL_INTENSITY4 */ - { 13570, 0x0000804A }, /* GL_INTENSITY4_EXT */ - { 13588, 0x0000804B }, /* GL_INTENSITY8 */ - { 13602, 0x0000804B }, /* GL_INTENSITY8_EXT */ - { 13620, 0x00008049 }, /* GL_INTENSITY_EXT */ - { 13637, 0x00008575 }, /* GL_INTERPOLATE */ - { 13652, 0x00008575 }, /* GL_INTERPOLATE_ARB */ - { 13671, 0x00008575 }, /* GL_INTERPOLATE_EXT */ - { 13690, 0x00008B53 }, /* GL_INT_VEC2 */ - { 13702, 0x00008B53 }, /* GL_INT_VEC2_ARB */ - { 13718, 0x00008B54 }, /* GL_INT_VEC3 */ - { 13730, 0x00008B54 }, /* GL_INT_VEC3_ARB */ - { 13746, 0x00008B55 }, /* GL_INT_VEC4 */ - { 13758, 0x00008B55 }, /* GL_INT_VEC4_ARB */ - { 13774, 0x00000500 }, /* GL_INVALID_ENUM */ - { 13790, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */ - { 13823, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */ - { 13860, 0x00000502 }, /* GL_INVALID_OPERATION */ - { 13881, 0x00000501 }, /* GL_INVALID_VALUE */ - { 13898, 0x0000862B }, /* GL_INVERSE_NV */ - { 13912, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */ - { 13936, 0x0000150A }, /* GL_INVERT */ - { 13946, 0x00001E00 }, /* GL_KEEP */ - { 13954, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION */ - { 13980, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION_EXT */ - { 14010, 0x00000406 }, /* GL_LEFT */ - { 14018, 0x00000203 }, /* GL_LEQUAL */ - { 14028, 0x00000201 }, /* GL_LESS */ - { 14036, 0x00004000 }, /* GL_LIGHT0 */ - { 14046, 0x00004001 }, /* GL_LIGHT1 */ - { 14056, 0x00004002 }, /* GL_LIGHT2 */ - { 14066, 0x00004003 }, /* GL_LIGHT3 */ - { 14076, 0x00004004 }, /* GL_LIGHT4 */ - { 14086, 0x00004005 }, /* GL_LIGHT5 */ - { 14096, 0x00004006 }, /* GL_LIGHT6 */ - { 14106, 0x00004007 }, /* GL_LIGHT7 */ - { 14116, 0x00000B50 }, /* GL_LIGHTING */ - { 14128, 0x00000040 }, /* GL_LIGHTING_BIT */ - { 14144, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */ - { 14167, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */ - { 14196, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */ - { 14229, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ - { 14257, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */ - { 14281, 0x00001B01 }, /* GL_LINE */ - { 14289, 0x00002601 }, /* GL_LINEAR */ - { 14299, 0x00001208 }, /* GL_LINEAR_ATTENUATION */ - { 14321, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ - { 14351, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ - { 14382, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */ - { 14406, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */ - { 14431, 0x00000001 }, /* GL_LINES */ - { 14440, 0x00000004 }, /* GL_LINE_BIT */ - { 14452, 0x00000002 }, /* GL_LINE_LOOP */ - { 14465, 0x00000707 }, /* GL_LINE_RESET_TOKEN */ - { 14485, 0x00000B20 }, /* GL_LINE_SMOOTH */ - { 14500, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */ - { 14520, 0x00000B24 }, /* GL_LINE_STIPPLE */ - { 14536, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */ - { 14560, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */ - { 14583, 0x00000003 }, /* GL_LINE_STRIP */ - { 14597, 0x00000702 }, /* GL_LINE_TOKEN */ - { 14611, 0x00000B21 }, /* GL_LINE_WIDTH */ - { 14625, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */ - { 14651, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */ - { 14671, 0x00008B82 }, /* GL_LINK_STATUS */ - { 14686, 0x00000B32 }, /* GL_LIST_BASE */ - { 14699, 0x00020000 }, /* GL_LIST_BIT */ - { 14711, 0x00000B33 }, /* GL_LIST_INDEX */ - { 14725, 0x00000B30 }, /* GL_LIST_MODE */ - { 14738, 0x00000101 }, /* GL_LOAD */ - { 14746, 0x00000BF1 }, /* GL_LOGIC_OP */ - { 14758, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */ - { 14775, 0x00008CA1 }, /* GL_LOWER_LEFT */ - { 14789, 0x00001909 }, /* GL_LUMINANCE */ - { 14802, 0x00008041 }, /* GL_LUMINANCE12 */ - { 14817, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */ - { 14840, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */ - { 14867, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */ - { 14889, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */ - { 14915, 0x00008041 }, /* GL_LUMINANCE12_EXT */ - { 14934, 0x00008042 }, /* GL_LUMINANCE16 */ - { 14949, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */ - { 14972, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */ - { 14999, 0x00008042 }, /* GL_LUMINANCE16_EXT */ - { 15018, 0x0000803F }, /* GL_LUMINANCE4 */ - { 15032, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */ - { 15053, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */ - { 15078, 0x0000803F }, /* GL_LUMINANCE4_EXT */ - { 15096, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */ - { 15117, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */ - { 15142, 0x00008040 }, /* GL_LUMINANCE8 */ - { 15156, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */ - { 15177, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */ - { 15202, 0x00008040 }, /* GL_LUMINANCE8_EXT */ - { 15220, 0x0000190A }, /* GL_LUMINANCE_ALPHA */ - { 15239, 0x00000D90 }, /* GL_MAP1_COLOR_4 */ - { 15255, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */ - { 15275, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */ - { 15297, 0x00000D91 }, /* GL_MAP1_INDEX */ - { 15311, 0x00000D92 }, /* GL_MAP1_NORMAL */ - { 15326, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */ - { 15350, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */ - { 15374, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */ - { 15398, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */ - { 15422, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */ - { 15439, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */ - { 15456, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ - { 15484, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ - { 15513, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ - { 15542, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ - { 15571, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ - { 15600, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ - { 15629, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ - { 15658, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ - { 15686, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ - { 15714, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ - { 15742, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ - { 15770, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ - { 15798, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ - { 15826, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ - { 15854, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ - { 15882, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ - { 15910, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */ - { 15926, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */ - { 15946, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */ - { 15968, 0x00000DB1 }, /* GL_MAP2_INDEX */ - { 15982, 0x00000DB2 }, /* GL_MAP2_NORMAL */ - { 15997, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */ - { 16021, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */ - { 16045, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */ - { 16069, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */ - { 16093, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */ - { 16110, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */ - { 16127, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ - { 16155, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ - { 16184, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ - { 16213, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ - { 16242, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ - { 16271, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ - { 16300, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ - { 16329, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ - { 16357, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ - { 16385, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ - { 16413, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ - { 16441, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ - { 16469, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ - { 16497, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */ - { 16525, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ - { 16553, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ - { 16581, 0x00000D10 }, /* GL_MAP_COLOR */ - { 16594, 0x00000010 }, /* GL_MAP_FLUSH_EXPLICIT_BIT */ - { 16620, 0x00000008 }, /* GL_MAP_INVALIDATE_BUFFER_BIT */ - { 16649, 0x00000004 }, /* GL_MAP_INVALIDATE_RANGE_BIT */ - { 16677, 0x00000001 }, /* GL_MAP_READ_BIT */ - { 16693, 0x00000D11 }, /* GL_MAP_STENCIL */ - { 16708, 0x00000020 }, /* GL_MAP_UNSYNCHRONIZED_BIT */ - { 16734, 0x00000002 }, /* GL_MAP_WRITE_BIT */ - { 16751, 0x000088C0 }, /* GL_MATRIX0_ARB */ - { 16766, 0x00008630 }, /* GL_MATRIX0_NV */ - { 16780, 0x000088CA }, /* GL_MATRIX10_ARB */ - { 16796, 0x000088CB }, /* GL_MATRIX11_ARB */ - { 16812, 0x000088CC }, /* GL_MATRIX12_ARB */ - { 16828, 0x000088CD }, /* GL_MATRIX13_ARB */ - { 16844, 0x000088CE }, /* GL_MATRIX14_ARB */ - { 16860, 0x000088CF }, /* GL_MATRIX15_ARB */ - { 16876, 0x000088D0 }, /* GL_MATRIX16_ARB */ - { 16892, 0x000088D1 }, /* GL_MATRIX17_ARB */ - { 16908, 0x000088D2 }, /* GL_MATRIX18_ARB */ - { 16924, 0x000088D3 }, /* GL_MATRIX19_ARB */ - { 16940, 0x000088C1 }, /* GL_MATRIX1_ARB */ - { 16955, 0x00008631 }, /* GL_MATRIX1_NV */ - { 16969, 0x000088D4 }, /* GL_MATRIX20_ARB */ - { 16985, 0x000088D5 }, /* GL_MATRIX21_ARB */ - { 17001, 0x000088D6 }, /* GL_MATRIX22_ARB */ - { 17017, 0x000088D7 }, /* GL_MATRIX23_ARB */ - { 17033, 0x000088D8 }, /* GL_MATRIX24_ARB */ - { 17049, 0x000088D9 }, /* GL_MATRIX25_ARB */ - { 17065, 0x000088DA }, /* GL_MATRIX26_ARB */ - { 17081, 0x000088DB }, /* GL_MATRIX27_ARB */ - { 17097, 0x000088DC }, /* GL_MATRIX28_ARB */ - { 17113, 0x000088DD }, /* GL_MATRIX29_ARB */ - { 17129, 0x000088C2 }, /* GL_MATRIX2_ARB */ - { 17144, 0x00008632 }, /* GL_MATRIX2_NV */ - { 17158, 0x000088DE }, /* GL_MATRIX30_ARB */ - { 17174, 0x000088DF }, /* GL_MATRIX31_ARB */ - { 17190, 0x000088C3 }, /* GL_MATRIX3_ARB */ - { 17205, 0x00008633 }, /* GL_MATRIX3_NV */ - { 17219, 0x000088C4 }, /* GL_MATRIX4_ARB */ - { 17234, 0x00008634 }, /* GL_MATRIX4_NV */ - { 17248, 0x000088C5 }, /* GL_MATRIX5_ARB */ - { 17263, 0x00008635 }, /* GL_MATRIX5_NV */ - { 17277, 0x000088C6 }, /* GL_MATRIX6_ARB */ - { 17292, 0x00008636 }, /* GL_MATRIX6_NV */ - { 17306, 0x000088C7 }, /* GL_MATRIX7_ARB */ - { 17321, 0x00008637 }, /* GL_MATRIX7_NV */ - { 17335, 0x000088C8 }, /* GL_MATRIX8_ARB */ - { 17350, 0x000088C9 }, /* GL_MATRIX9_ARB */ - { 17365, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */ - { 17391, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ - { 17425, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ - { 17456, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ - { 17489, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ - { 17520, 0x00000BA0 }, /* GL_MATRIX_MODE */ - { 17535, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */ - { 17557, 0x00008008 }, /* GL_MAX */ - { 17564, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */ - { 17587, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ - { 17619, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */ - { 17645, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ - { 17678, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ - { 17704, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - { 17738, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */ - { 17757, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ - { 17786, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ - { 17818, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */ - { 17854, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ - { 17890, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */ - { 17930, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */ - { 17956, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */ - { 17986, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */ - { 18011, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */ - { 18040, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ - { 18069, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */ - { 18102, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */ - { 18122, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */ - { 18146, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */ - { 18170, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */ - { 18194, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */ - { 18219, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */ - { 18237, 0x00008008 }, /* GL_MAX_EXT */ - { 18248, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ - { 18283, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */ - { 18322, 0x00000D31 }, /* GL_MAX_LIGHTS */ - { 18336, 0x00000B31 }, /* GL_MAX_LIST_NESTING */ - { 18356, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ - { 18394, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */ - { 18423, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */ - { 18447, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */ - { 18475, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */ - { 18498, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ - { 18535, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ - { 18571, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ - { 18598, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ - { 18627, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ - { 18661, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ - { 18697, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ - { 18724, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ - { 18756, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ - { 18792, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ - { 18821, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ - { 18850, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */ - { 18878, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ - { 18916, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - { 18960, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - { 19003, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ - { 19037, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - { 19076, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ - { 19113, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ - { 19151, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - { 19194, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - { 19237, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ - { 19267, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ - { 19298, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ - { 19334, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ - { 19370, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */ - { 19400, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ - { 19434, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */ - { 19467, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ - { 19496, 0x00008D57 }, /* GL_MAX_SAMPLES */ - { 19511, 0x00009111 }, /* GL_MAX_SERVER_WAIT_TIMEOUT */ - { 19538, 0x00008504 }, /* GL_MAX_SHININESS_NV */ - { 19558, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */ - { 19582, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */ - { 19604, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */ - { 19630, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */ - { 19657, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */ - { 19688, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */ - { 19712, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ - { 19746, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */ - { 19766, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */ - { 19793, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */ - { 19814, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */ - { 19839, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */ - { 19864, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */ - { 19899, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */ - { 19921, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */ - { 19947, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */ - { 19969, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */ - { 19995, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ - { 20029, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ - { 20067, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ - { 20100, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */ - { 20137, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */ - { 20161, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */ - { 20182, 0x00008007 }, /* GL_MIN */ - { 20189, 0x0000802E }, /* GL_MINMAX */ - { 20199, 0x0000802E }, /* GL_MINMAX_EXT */ - { 20213, 0x0000802F }, /* GL_MINMAX_FORMAT */ - { 20230, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */ - { 20251, 0x00008030 }, /* GL_MINMAX_SINK */ - { 20266, 0x00008030 }, /* GL_MINMAX_SINK_EXT */ - { 20285, 0x00008007 }, /* GL_MIN_EXT */ - { 20296, 0x00008370 }, /* GL_MIRRORED_REPEAT */ - { 20315, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */ - { 20338, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */ - { 20361, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */ - { 20381, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */ - { 20401, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ - { 20431, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */ - { 20459, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ - { 20487, 0x00001700 }, /* GL_MODELVIEW */ - { 20500, 0x00001700 }, /* GL_MODELVIEW0_ARB */ - { 20518, 0x0000872A }, /* GL_MODELVIEW10_ARB */ - { 20537, 0x0000872B }, /* GL_MODELVIEW11_ARB */ - { 20556, 0x0000872C }, /* GL_MODELVIEW12_ARB */ - { 20575, 0x0000872D }, /* GL_MODELVIEW13_ARB */ - { 20594, 0x0000872E }, /* GL_MODELVIEW14_ARB */ - { 20613, 0x0000872F }, /* GL_MODELVIEW15_ARB */ - { 20632, 0x00008730 }, /* GL_MODELVIEW16_ARB */ - { 20651, 0x00008731 }, /* GL_MODELVIEW17_ARB */ - { 20670, 0x00008732 }, /* GL_MODELVIEW18_ARB */ - { 20689, 0x00008733 }, /* GL_MODELVIEW19_ARB */ - { 20708, 0x0000850A }, /* GL_MODELVIEW1_ARB */ - { 20726, 0x00008734 }, /* GL_MODELVIEW20_ARB */ - { 20745, 0x00008735 }, /* GL_MODELVIEW21_ARB */ - { 20764, 0x00008736 }, /* GL_MODELVIEW22_ARB */ - { 20783, 0x00008737 }, /* GL_MODELVIEW23_ARB */ - { 20802, 0x00008738 }, /* GL_MODELVIEW24_ARB */ - { 20821, 0x00008739 }, /* GL_MODELVIEW25_ARB */ - { 20840, 0x0000873A }, /* GL_MODELVIEW26_ARB */ - { 20859, 0x0000873B }, /* GL_MODELVIEW27_ARB */ - { 20878, 0x0000873C }, /* GL_MODELVIEW28_ARB */ - { 20897, 0x0000873D }, /* GL_MODELVIEW29_ARB */ - { 20916, 0x00008722 }, /* GL_MODELVIEW2_ARB */ - { 20934, 0x0000873E }, /* GL_MODELVIEW30_ARB */ - { 20953, 0x0000873F }, /* GL_MODELVIEW31_ARB */ - { 20972, 0x00008723 }, /* GL_MODELVIEW3_ARB */ - { 20990, 0x00008724 }, /* GL_MODELVIEW4_ARB */ - { 21008, 0x00008725 }, /* GL_MODELVIEW5_ARB */ - { 21026, 0x00008726 }, /* GL_MODELVIEW6_ARB */ - { 21044, 0x00008727 }, /* GL_MODELVIEW7_ARB */ - { 21062, 0x00008728 }, /* GL_MODELVIEW8_ARB */ - { 21080, 0x00008729 }, /* GL_MODELVIEW9_ARB */ - { 21098, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */ - { 21118, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */ - { 21145, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */ - { 21170, 0x00002100 }, /* GL_MODULATE */ - { 21182, 0x00008744 }, /* GL_MODULATE_ADD_ATI */ - { 21202, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */ - { 21229, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */ - { 21254, 0x00000103 }, /* GL_MULT */ - { 21262, 0x0000809D }, /* GL_MULTISAMPLE */ - { 21277, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */ - { 21297, 0x0000809D }, /* GL_MULTISAMPLE_ARB */ - { 21316, 0x20000000 }, /* GL_MULTISAMPLE_BIT */ - { 21335, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */ - { 21359, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */ - { 21382, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */ - { 21412, 0x00002A25 }, /* GL_N3F_V3F */ - { 21423, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */ - { 21443, 0x0000150E }, /* GL_NAND */ - { 21451, 0x00002600 }, /* GL_NEAREST */ - { 21462, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ - { 21493, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ - { 21525, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */ - { 21550, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */ - { 21576, 0x00000200 }, /* GL_NEVER */ - { 21585, 0x00001102 }, /* GL_NICEST */ - { 21595, 0x00000000 }, /* GL_NONE */ - { 21603, 0x00001505 }, /* GL_NOOP */ - { 21611, 0x00001508 }, /* GL_NOR */ - { 21618, 0x00000BA1 }, /* GL_NORMALIZE */ - { 21631, 0x00008075 }, /* GL_NORMAL_ARRAY */ - { 21647, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ - { 21678, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */ - { 21713, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */ - { 21737, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */ - { 21760, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */ - { 21781, 0x00008511 }, /* GL_NORMAL_MAP */ - { 21795, 0x00008511 }, /* GL_NORMAL_MAP_ARB */ - { 21813, 0x00008511 }, /* GL_NORMAL_MAP_NV */ - { 21830, 0x00000205 }, /* GL_NOTEQUAL */ - { 21842, 0x00000000 }, /* GL_NO_ERROR */ - { 21854, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ - { 21888, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */ - { 21926, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */ - { 21958, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */ - { 22000, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */ - { 22030, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */ - { 22070, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */ - { 22101, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */ - { 22130, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */ - { 22158, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */ - { 22188, 0x00002401 }, /* GL_OBJECT_LINEAR */ - { 22205, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */ - { 22231, 0x00002501 }, /* GL_OBJECT_PLANE */ - { 22247, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */ - { 22282, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */ - { 22304, 0x00009112 }, /* GL_OBJECT_TYPE */ - { 22319, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */ - { 22338, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */ - { 22368, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */ - { 22389, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */ - { 22417, 0x00000001 }, /* GL_ONE */ - { 22424, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */ - { 22452, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */ - { 22484, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */ - { 22512, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */ - { 22544, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */ - { 22567, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */ - { 22590, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */ - { 22613, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */ - { 22636, 0x00008598 }, /* GL_OPERAND0_ALPHA */ - { 22654, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */ - { 22676, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */ - { 22698, 0x00008590 }, /* GL_OPERAND0_RGB */ - { 22714, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */ - { 22734, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */ - { 22754, 0x00008599 }, /* GL_OPERAND1_ALPHA */ - { 22772, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */ - { 22794, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */ - { 22816, 0x00008591 }, /* GL_OPERAND1_RGB */ - { 22832, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */ - { 22852, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */ - { 22872, 0x0000859A }, /* GL_OPERAND2_ALPHA */ - { 22890, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */ - { 22912, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */ - { 22934, 0x00008592 }, /* GL_OPERAND2_RGB */ - { 22950, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */ - { 22970, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */ - { 22990, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */ - { 23011, 0x00008593 }, /* GL_OPERAND3_RGB_NV */ - { 23030, 0x00001507 }, /* GL_OR */ - { 23036, 0x00000A01 }, /* GL_ORDER */ - { 23045, 0x0000150D }, /* GL_OR_INVERTED */ - { 23060, 0x0000150B }, /* GL_OR_REVERSE */ - { 23074, 0x00000505 }, /* GL_OUT_OF_MEMORY */ - { 23091, 0x00000D05 }, /* GL_PACK_ALIGNMENT */ - { 23109, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */ - { 23130, 0x00008758 }, /* GL_PACK_INVERT_MESA */ - { 23150, 0x00000D01 }, /* GL_PACK_LSB_FIRST */ - { 23168, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */ - { 23187, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */ - { 23207, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */ - { 23227, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */ - { 23245, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */ - { 23264, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */ - { 23289, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */ - { 23313, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */ - { 23334, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */ - { 23356, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */ - { 23378, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */ - { 23403, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */ - { 23427, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */ - { 23448, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */ - { 23470, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */ - { 23492, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */ - { 23514, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */ - { 23545, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */ - { 23565, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */ - { 23590, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */ - { 23610, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */ - { 23635, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */ - { 23655, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */ - { 23680, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */ - { 23700, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */ - { 23725, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */ - { 23745, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */ - { 23770, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */ - { 23790, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */ - { 23815, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */ - { 23835, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */ - { 23860, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */ - { 23880, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */ - { 23905, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */ - { 23925, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */ - { 23950, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */ - { 23970, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */ - { 23995, 0x00000020 }, /* GL_PIXEL_MODE_BIT */ - { 24013, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */ - { 24034, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */ - { 24063, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */ - { 24096, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */ - { 24121, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */ - { 24144, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ - { 24175, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */ - { 24210, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */ - { 24237, 0x00001B00 }, /* GL_POINT */ - { 24246, 0x00000000 }, /* GL_POINTS */ - { 24256, 0x00000002 }, /* GL_POINT_BIT */ - { 24269, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */ - { 24299, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */ - { 24333, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */ - { 24367, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */ - { 24402, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */ - { 24431, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */ - { 24464, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */ - { 24497, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */ - { 24531, 0x00000B11 }, /* GL_POINT_SIZE */ - { 24545, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */ - { 24571, 0x00008127 }, /* GL_POINT_SIZE_MAX */ - { 24589, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */ - { 24611, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */ - { 24633, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */ - { 24656, 0x00008126 }, /* GL_POINT_SIZE_MIN */ - { 24674, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */ - { 24696, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */ - { 24718, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */ - { 24741, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */ - { 24761, 0x00000B10 }, /* GL_POINT_SMOOTH */ - { 24777, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */ - { 24798, 0x00008861 }, /* GL_POINT_SPRITE */ - { 24814, 0x00008861 }, /* GL_POINT_SPRITE_ARB */ - { 24834, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */ - { 24863, 0x00008861 }, /* GL_POINT_SPRITE_NV */ - { 24882, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */ - { 24908, 0x00000701 }, /* GL_POINT_TOKEN */ - { 24923, 0x00000009 }, /* GL_POLYGON */ - { 24934, 0x00000008 }, /* GL_POLYGON_BIT */ - { 24949, 0x00000B40 }, /* GL_POLYGON_MODE */ - { 24965, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */ - { 24988, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */ - { 25013, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */ - { 25036, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */ - { 25059, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */ - { 25083, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */ - { 25107, 0x00000B41 }, /* GL_POLYGON_SMOOTH */ - { 25125, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */ - { 25148, 0x00000B42 }, /* GL_POLYGON_STIPPLE */ - { 25167, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */ - { 25190, 0x00000703 }, /* GL_POLYGON_TOKEN */ - { 25207, 0x00001203 }, /* GL_POSITION */ - { 25219, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ - { 25251, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */ - { 25287, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ - { 25320, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */ - { 25357, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ - { 25388, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */ - { 25423, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ - { 25455, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */ - { 25491, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ - { 25524, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ - { 25556, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */ - { 25592, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ - { 25625, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */ - { 25662, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */ - { 25692, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */ - { 25726, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */ - { 25757, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */ - { 25792, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ - { 25823, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */ - { 25858, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ - { 25890, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */ - { 25926, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */ - { 25956, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */ - { 25990, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */ - { 26021, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */ - { 26056, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */ - { 26088, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */ - { 26119, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */ - { 26154, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */ - { 26186, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */ - { 26222, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */ - { 26251, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */ - { 26284, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */ - { 26314, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */ - { 26348, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ - { 26387, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ - { 26420, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ - { 26460, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ - { 26494, 0x00008578 }, /* GL_PREVIOUS */ - { 26506, 0x00008578 }, /* GL_PREVIOUS_ARB */ - { 26522, 0x00008578 }, /* GL_PREVIOUS_EXT */ - { 26538, 0x00008577 }, /* GL_PRIMARY_COLOR */ - { 26555, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */ - { 26576, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */ - { 26597, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ - { 26630, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ - { 26662, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */ - { 26685, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */ - { 26708, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */ - { 26738, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */ - { 26767, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */ - { 26795, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */ - { 26817, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */ - { 26845, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */ - { 26873, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */ - { 26895, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */ - { 26916, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - { 26956, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - { 26995, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ - { 27025, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - { 27060, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ - { 27093, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ - { 27127, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - { 27166, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - { 27205, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */ - { 27227, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */ - { 27253, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */ - { 27277, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */ - { 27300, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */ - { 27322, 0x00008628 }, /* GL_PROGRAM_STRING_NV */ - { 27343, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */ - { 27364, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */ - { 27391, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ - { 27423, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ - { 27455, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ - { 27490, 0x00001701 }, /* GL_PROJECTION */ - { 27504, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */ - { 27525, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */ - { 27551, 0x00008E4F }, /* GL_PROVOKING_VERTEX */ - { 27571, 0x00008E4F }, /* GL_PROVOKING_VERTEX_EXT */ - { 27595, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */ - { 27616, 0x00008025 }, /* GL_PROXY_HISTOGRAM */ - { 27635, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */ - { 27658, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ - { 27697, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ - { 27735, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */ - { 27755, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ - { 27785, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */ - { 27809, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */ - { 27829, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ - { 27859, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */ - { 27883, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */ - { 27903, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ - { 27936, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */ - { 27962, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */ - { 27992, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ - { 28023, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */ - { 28053, 0x00002003 }, /* GL_Q */ - { 28058, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */ - { 28083, 0x00000007 }, /* GL_QUADS */ - { 28092, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */ - { 28136, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */ - { 28184, 0x00008614 }, /* GL_QUAD_MESH_SUN */ - { 28201, 0x00000008 }, /* GL_QUAD_STRIP */ - { 28215, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */ - { 28237, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */ - { 28263, 0x00008866 }, /* GL_QUERY_RESULT */ - { 28279, 0x00008866 }, /* GL_QUERY_RESULT_ARB */ - { 28299, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */ - { 28325, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */ - { 28355, 0x00002002 }, /* GL_R */ - { 28360, 0x00002A10 }, /* GL_R3_G3_B2 */ - { 28372, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ - { 28405, 0x00000C02 }, /* GL_READ_BUFFER */ - { 28420, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */ - { 28440, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ - { 28472, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */ - { 28496, 0x000088B8 }, /* GL_READ_ONLY */ - { 28509, 0x000088B8 }, /* GL_READ_ONLY_ARB */ - { 28526, 0x000088BA }, /* GL_READ_WRITE */ - { 28540, 0x000088BA }, /* GL_READ_WRITE_ARB */ - { 28558, 0x00001903 }, /* GL_RED */ - { 28565, 0x00008016 }, /* GL_REDUCE */ - { 28575, 0x00008016 }, /* GL_REDUCE_EXT */ - { 28589, 0x00000D15 }, /* GL_RED_BIAS */ - { 28601, 0x00000D52 }, /* GL_RED_BITS */ - { 28613, 0x00000D14 }, /* GL_RED_SCALE */ - { 28626, 0x00008512 }, /* GL_REFLECTION_MAP */ - { 28644, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */ - { 28666, 0x00008512 }, /* GL_REFLECTION_MAP_NV */ - { 28687, 0x00001C00 }, /* GL_RENDER */ - { 28697, 0x00008D41 }, /* GL_RENDERBUFFER */ - { 28713, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */ - { 28740, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */ - { 28768, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */ - { 28794, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */ - { 28821, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */ - { 28841, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */ - { 28868, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */ - { 28891, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */ - { 28918, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ - { 28950, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */ - { 28986, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */ - { 29011, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */ - { 29035, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */ - { 29064, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */ - { 29086, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */ - { 29112, 0x00001F01 }, /* GL_RENDERER */ - { 29124, 0x00000C40 }, /* GL_RENDER_MODE */ - { 29139, 0x00002901 }, /* GL_REPEAT */ - { 29149, 0x00001E01 }, /* GL_REPLACE */ - { 29160, 0x00008062 }, /* GL_REPLACE_EXT */ - { 29175, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */ - { 29198, 0x0000803A }, /* GL_RESCALE_NORMAL */ - { 29216, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */ - { 29238, 0x00000102 }, /* GL_RETURN */ - { 29248, 0x00001907 }, /* GL_RGB */ - { 29255, 0x00008052 }, /* GL_RGB10 */ - { 29264, 0x00008059 }, /* GL_RGB10_A2 */ - { 29276, 0x00008059 }, /* GL_RGB10_A2_EXT */ - { 29292, 0x00008052 }, /* GL_RGB10_EXT */ - { 29305, 0x00008053 }, /* GL_RGB12 */ - { 29314, 0x00008053 }, /* GL_RGB12_EXT */ - { 29327, 0x00008054 }, /* GL_RGB16 */ - { 29336, 0x00008054 }, /* GL_RGB16_EXT */ - { 29349, 0x0000804E }, /* GL_RGB2_EXT */ - { 29361, 0x0000804F }, /* GL_RGB4 */ - { 29369, 0x0000804F }, /* GL_RGB4_EXT */ - { 29381, 0x000083A1 }, /* GL_RGB4_S3TC */ - { 29394, 0x00008050 }, /* GL_RGB5 */ - { 29402, 0x00008057 }, /* GL_RGB5_A1 */ - { 29413, 0x00008057 }, /* GL_RGB5_A1_EXT */ - { 29428, 0x00008050 }, /* GL_RGB5_EXT */ - { 29440, 0x00008051 }, /* GL_RGB8 */ - { 29448, 0x00008051 }, /* GL_RGB8_EXT */ - { 29460, 0x00001908 }, /* GL_RGBA */ - { 29468, 0x0000805A }, /* GL_RGBA12 */ - { 29478, 0x0000805A }, /* GL_RGBA12_EXT */ - { 29492, 0x0000805B }, /* GL_RGBA16 */ - { 29502, 0x0000805B }, /* GL_RGBA16_EXT */ - { 29516, 0x00008055 }, /* GL_RGBA2 */ - { 29525, 0x00008055 }, /* GL_RGBA2_EXT */ - { 29538, 0x00008056 }, /* GL_RGBA4 */ - { 29547, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */ - { 29566, 0x00008056 }, /* GL_RGBA4_EXT */ - { 29579, 0x000083A3 }, /* GL_RGBA4_S3TC */ - { 29593, 0x00008058 }, /* GL_RGBA8 */ - { 29602, 0x00008058 }, /* GL_RGBA8_EXT */ - { 29615, 0x00008F97 }, /* GL_RGBA8_SNORM */ - { 29630, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */ - { 29648, 0x00000C31 }, /* GL_RGBA_MODE */ - { 29661, 0x000083A2 }, /* GL_RGBA_S3TC */ - { 29674, 0x00008F93 }, /* GL_RGBA_SNORM */ - { 29688, 0x000083A0 }, /* GL_RGB_S3TC */ - { 29700, 0x00008573 }, /* GL_RGB_SCALE */ - { 29713, 0x00008573 }, /* GL_RGB_SCALE_ARB */ - { 29730, 0x00008573 }, /* GL_RGB_SCALE_EXT */ - { 29747, 0x00000407 }, /* GL_RIGHT */ - { 29756, 0x00002000 }, /* GL_S */ - { 29761, 0x00008B5D }, /* GL_SAMPLER_1D */ - { 29775, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */ - { 29796, 0x00008B5E }, /* GL_SAMPLER_2D */ - { 29810, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */ - { 29831, 0x00008B5F }, /* GL_SAMPLER_3D */ - { 29845, 0x00008B60 }, /* GL_SAMPLER_CUBE */ - { 29861, 0x000080A9 }, /* GL_SAMPLES */ - { 29872, 0x000086B4 }, /* GL_SAMPLES_3DFX */ - { 29888, 0x000080A9 }, /* GL_SAMPLES_ARB */ - { 29903, 0x00008914 }, /* GL_SAMPLES_PASSED */ - { 29921, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */ - { 29943, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ - { 29971, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */ - { 30003, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */ - { 30026, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */ - { 30053, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */ - { 30071, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */ - { 30094, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */ - { 30116, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */ - { 30135, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */ - { 30158, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */ - { 30184, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */ - { 30214, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */ - { 30239, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */ - { 30268, 0x00080000 }, /* GL_SCISSOR_BIT */ - { 30283, 0x00000C10 }, /* GL_SCISSOR_BOX */ - { 30298, 0x00000C11 }, /* GL_SCISSOR_TEST */ - { 30314, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */ - { 30339, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ - { 30379, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */ - { 30423, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ - { 30456, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ - { 30486, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ - { 30518, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ - { 30548, 0x00001C02 }, /* GL_SELECT */ - { 30558, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */ - { 30586, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */ - { 30611, 0x00008012 }, /* GL_SEPARABLE_2D */ - { 30627, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */ - { 30654, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */ - { 30685, 0x0000150F }, /* GL_SET */ - { 30692, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */ - { 30713, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */ - { 30737, 0x00008B4F }, /* GL_SHADER_TYPE */ - { 30752, 0x00000B54 }, /* GL_SHADE_MODEL */ - { 30767, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */ - { 30795, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */ - { 30818, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */ - { 30848, 0x00001601 }, /* GL_SHININESS */ - { 30861, 0x00001402 }, /* GL_SHORT */ - { 30870, 0x00009119 }, /* GL_SIGNALED */ - { 30882, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */ - { 30903, 0x000081F9 }, /* GL_SINGLE_COLOR */ - { 30919, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */ - { 30939, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */ - { 30958, 0x00008C46 }, /* GL_SLUMINANCE */ - { 30972, 0x00008C47 }, /* GL_SLUMINANCE8 */ - { 30987, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */ - { 31009, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */ - { 31029, 0x00001D01 }, /* GL_SMOOTH */ - { 31039, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */ - { 31072, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */ - { 31099, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */ - { 31132, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */ - { 31159, 0x00008588 }, /* GL_SOURCE0_ALPHA */ - { 31176, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */ - { 31197, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */ - { 31218, 0x00008580 }, /* GL_SOURCE0_RGB */ - { 31233, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */ - { 31252, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */ - { 31271, 0x00008589 }, /* GL_SOURCE1_ALPHA */ - { 31288, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */ - { 31309, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */ - { 31330, 0x00008581 }, /* GL_SOURCE1_RGB */ - { 31345, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */ - { 31364, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */ - { 31383, 0x0000858A }, /* GL_SOURCE2_ALPHA */ - { 31400, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */ - { 31421, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */ - { 31442, 0x00008582 }, /* GL_SOURCE2_RGB */ - { 31457, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */ - { 31476, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */ - { 31495, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */ - { 31515, 0x00008583 }, /* GL_SOURCE3_RGB_NV */ - { 31533, 0x00001202 }, /* GL_SPECULAR */ - { 31545, 0x00002402 }, /* GL_SPHERE_MAP */ - { 31559, 0x00001206 }, /* GL_SPOT_CUTOFF */ - { 31574, 0x00001204 }, /* GL_SPOT_DIRECTION */ - { 31592, 0x00001205 }, /* GL_SPOT_EXPONENT */ - { 31609, 0x00008588 }, /* GL_SRC0_ALPHA */ - { 31623, 0x00008580 }, /* GL_SRC0_RGB */ - { 31635, 0x00008589 }, /* GL_SRC1_ALPHA */ - { 31649, 0x00008581 }, /* GL_SRC1_RGB */ - { 31661, 0x0000858A }, /* GL_SRC2_ALPHA */ - { 31675, 0x00008582 }, /* GL_SRC2_RGB */ - { 31687, 0x00000302 }, /* GL_SRC_ALPHA */ - { 31700, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */ - { 31722, 0x00000300 }, /* GL_SRC_COLOR */ - { 31735, 0x00008C40 }, /* GL_SRGB */ - { 31743, 0x00008C41 }, /* GL_SRGB8 */ - { 31752, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */ - { 31768, 0x00008C42 }, /* GL_SRGB_ALPHA */ - { 31782, 0x00000503 }, /* GL_STACK_OVERFLOW */ - { 31800, 0x00000504 }, /* GL_STACK_UNDERFLOW */ - { 31819, 0x000088E6 }, /* GL_STATIC_COPY */ - { 31834, 0x000088E6 }, /* GL_STATIC_COPY_ARB */ - { 31853, 0x000088E4 }, /* GL_STATIC_DRAW */ - { 31868, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */ - { 31887, 0x000088E5 }, /* GL_STATIC_READ */ - { 31902, 0x000088E5 }, /* GL_STATIC_READ_ARB */ - { 31921, 0x00001802 }, /* GL_STENCIL */ - { 31932, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */ - { 31954, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */ - { 31980, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */ - { 32001, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */ - { 32026, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */ - { 32047, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */ - { 32072, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ - { 32104, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */ - { 32140, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ - { 32172, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */ - { 32208, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */ - { 32228, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */ - { 32255, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */ - { 32281, 0x00000D57 }, /* GL_STENCIL_BITS */ - { 32297, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */ - { 32319, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */ - { 32342, 0x00000B94 }, /* GL_STENCIL_FAIL */ - { 32358, 0x00000B92 }, /* GL_STENCIL_FUNC */ - { 32374, 0x00001901 }, /* GL_STENCIL_INDEX */ - { 32391, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */ - { 32414, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */ - { 32436, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */ - { 32458, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */ - { 32480, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */ - { 32501, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */ - { 32528, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */ - { 32555, 0x00000B97 }, /* GL_STENCIL_REF */ - { 32570, 0x00000B90 }, /* GL_STENCIL_TEST */ - { 32586, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ - { 32615, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */ - { 32637, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */ - { 32658, 0x00000C33 }, /* GL_STEREO */ - { 32668, 0x000085BE }, /* GL_STORAGE_CACHED_APPLE */ - { 32692, 0x000085BD }, /* GL_STORAGE_PRIVATE_APPLE */ - { 32717, 0x000085BF }, /* GL_STORAGE_SHARED_APPLE */ - { 32741, 0x000088E2 }, /* GL_STREAM_COPY */ - { 32756, 0x000088E2 }, /* GL_STREAM_COPY_ARB */ - { 32775, 0x000088E0 }, /* GL_STREAM_DRAW */ - { 32790, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */ - { 32809, 0x000088E1 }, /* GL_STREAM_READ */ - { 32824, 0x000088E1 }, /* GL_STREAM_READ_ARB */ - { 32843, 0x00000D50 }, /* GL_SUBPIXEL_BITS */ - { 32860, 0x000084E7 }, /* GL_SUBTRACT */ - { 32872, 0x000084E7 }, /* GL_SUBTRACT_ARB */ - { 32888, 0x00009113 }, /* GL_SYNC_CONDITION */ - { 32906, 0x00009116 }, /* GL_SYNC_FENCE */ - { 32920, 0x00009115 }, /* GL_SYNC_FLAGS */ - { 32934, 0x00000001 }, /* GL_SYNC_FLUSH_COMMANDS_BIT */ - { 32961, 0x00009117 }, /* GL_SYNC_GPU_COMMANDS_COMPLETE */ - { 32991, 0x00009114 }, /* GL_SYNC_STATUS */ - { 33006, 0x00002001 }, /* GL_T */ - { 33011, 0x00002A2A }, /* GL_T2F_C3F_V3F */ - { 33026, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */ - { 33045, 0x00002A29 }, /* GL_T2F_C4UB_V3F */ - { 33061, 0x00002A2B }, /* GL_T2F_N3F_V3F */ - { 33076, 0x00002A27 }, /* GL_T2F_V3F */ - { 33087, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */ - { 33106, 0x00002A28 }, /* GL_T4F_V4F */ - { 33117, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */ - { 33140, 0x00001702 }, /* GL_TEXTURE */ - { 33151, 0x000084C0 }, /* GL_TEXTURE0 */ - { 33163, 0x000084C0 }, /* GL_TEXTURE0_ARB */ - { 33179, 0x000084C1 }, /* GL_TEXTURE1 */ - { 33191, 0x000084CA }, /* GL_TEXTURE10 */ - { 33204, 0x000084CA }, /* GL_TEXTURE10_ARB */ - { 33221, 0x000084CB }, /* GL_TEXTURE11 */ - { 33234, 0x000084CB }, /* GL_TEXTURE11_ARB */ - { 33251, 0x000084CC }, /* GL_TEXTURE12 */ - { 33264, 0x000084CC }, /* GL_TEXTURE12_ARB */ - { 33281, 0x000084CD }, /* GL_TEXTURE13 */ - { 33294, 0x000084CD }, /* GL_TEXTURE13_ARB */ - { 33311, 0x000084CE }, /* GL_TEXTURE14 */ - { 33324, 0x000084CE }, /* GL_TEXTURE14_ARB */ - { 33341, 0x000084CF }, /* GL_TEXTURE15 */ - { 33354, 0x000084CF }, /* GL_TEXTURE15_ARB */ - { 33371, 0x000084D0 }, /* GL_TEXTURE16 */ - { 33384, 0x000084D0 }, /* GL_TEXTURE16_ARB */ - { 33401, 0x000084D1 }, /* GL_TEXTURE17 */ - { 33414, 0x000084D1 }, /* GL_TEXTURE17_ARB */ - { 33431, 0x000084D2 }, /* GL_TEXTURE18 */ - { 33444, 0x000084D2 }, /* GL_TEXTURE18_ARB */ - { 33461, 0x000084D3 }, /* GL_TEXTURE19 */ - { 33474, 0x000084D3 }, /* GL_TEXTURE19_ARB */ - { 33491, 0x000084C1 }, /* GL_TEXTURE1_ARB */ - { 33507, 0x000084C2 }, /* GL_TEXTURE2 */ - { 33519, 0x000084D4 }, /* GL_TEXTURE20 */ - { 33532, 0x000084D4 }, /* GL_TEXTURE20_ARB */ - { 33549, 0x000084D5 }, /* GL_TEXTURE21 */ - { 33562, 0x000084D5 }, /* GL_TEXTURE21_ARB */ - { 33579, 0x000084D6 }, /* GL_TEXTURE22 */ - { 33592, 0x000084D6 }, /* GL_TEXTURE22_ARB */ - { 33609, 0x000084D7 }, /* GL_TEXTURE23 */ - { 33622, 0x000084D7 }, /* GL_TEXTURE23_ARB */ - { 33639, 0x000084D8 }, /* GL_TEXTURE24 */ - { 33652, 0x000084D8 }, /* GL_TEXTURE24_ARB */ - { 33669, 0x000084D9 }, /* GL_TEXTURE25 */ - { 33682, 0x000084D9 }, /* GL_TEXTURE25_ARB */ - { 33699, 0x000084DA }, /* GL_TEXTURE26 */ - { 33712, 0x000084DA }, /* GL_TEXTURE26_ARB */ - { 33729, 0x000084DB }, /* GL_TEXTURE27 */ - { 33742, 0x000084DB }, /* GL_TEXTURE27_ARB */ - { 33759, 0x000084DC }, /* GL_TEXTURE28 */ - { 33772, 0x000084DC }, /* GL_TEXTURE28_ARB */ - { 33789, 0x000084DD }, /* GL_TEXTURE29 */ - { 33802, 0x000084DD }, /* GL_TEXTURE29_ARB */ - { 33819, 0x000084C2 }, /* GL_TEXTURE2_ARB */ - { 33835, 0x000084C3 }, /* GL_TEXTURE3 */ - { 33847, 0x000084DE }, /* GL_TEXTURE30 */ - { 33860, 0x000084DE }, /* GL_TEXTURE30_ARB */ - { 33877, 0x000084DF }, /* GL_TEXTURE31 */ - { 33890, 0x000084DF }, /* GL_TEXTURE31_ARB */ - { 33907, 0x000084C3 }, /* GL_TEXTURE3_ARB */ - { 33923, 0x000084C4 }, /* GL_TEXTURE4 */ - { 33935, 0x000084C4 }, /* GL_TEXTURE4_ARB */ - { 33951, 0x000084C5 }, /* GL_TEXTURE5 */ - { 33963, 0x000084C5 }, /* GL_TEXTURE5_ARB */ - { 33979, 0x000084C6 }, /* GL_TEXTURE6 */ - { 33991, 0x000084C6 }, /* GL_TEXTURE6_ARB */ - { 34007, 0x000084C7 }, /* GL_TEXTURE7 */ - { 34019, 0x000084C7 }, /* GL_TEXTURE7_ARB */ - { 34035, 0x000084C8 }, /* GL_TEXTURE8 */ - { 34047, 0x000084C8 }, /* GL_TEXTURE8_ARB */ - { 34063, 0x000084C9 }, /* GL_TEXTURE9 */ - { 34075, 0x000084C9 }, /* GL_TEXTURE9_ARB */ - { 34091, 0x00000DE0 }, /* GL_TEXTURE_1D */ - { 34105, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */ - { 34129, 0x00000DE1 }, /* GL_TEXTURE_2D */ - { 34143, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */ - { 34167, 0x0000806F }, /* GL_TEXTURE_3D */ - { 34181, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */ - { 34203, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */ - { 34229, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */ - { 34251, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */ - { 34273, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ - { 34305, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */ - { 34327, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ - { 34359, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */ - { 34381, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */ - { 34409, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */ - { 34441, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ - { 34474, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */ - { 34506, 0x00040000 }, /* GL_TEXTURE_BIT */ - { 34521, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */ - { 34542, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */ - { 34567, 0x00001005 }, /* GL_TEXTURE_BORDER */ - { 34585, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */ - { 34609, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ - { 34640, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ - { 34670, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ - { 34700, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ - { 34735, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ - { 34766, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - { 34804, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */ - { 34831, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ - { 34863, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ - { 34897, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */ - { 34921, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */ - { 34949, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */ - { 34973, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */ - { 35001, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ - { 35034, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */ - { 35058, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */ - { 35080, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */ - { 35102, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */ - { 35128, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */ - { 35162, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ - { 35195, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */ - { 35232, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */ - { 35260, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */ - { 35292, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */ - { 35315, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ - { 35353, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */ - { 35395, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */ - { 35426, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */ - { 35454, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ - { 35484, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */ - { 35512, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */ - { 35532, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */ - { 35556, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ - { 35587, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */ - { 35622, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ - { 35653, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */ - { 35688, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ - { 35719, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */ - { 35754, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ - { 35785, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */ - { 35820, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ - { 35851, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */ - { 35886, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ - { 35917, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */ - { 35952, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */ - { 35981, 0x00008071 }, /* GL_TEXTURE_DEPTH */ - { 35998, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */ - { 36020, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */ - { 36046, 0x00002300 }, /* GL_TEXTURE_ENV */ - { 36061, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */ - { 36082, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */ - { 36102, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */ - { 36128, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */ - { 36148, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */ - { 36165, 0x00000C62 }, /* GL_TEXTURE_GEN_R */ - { 36182, 0x00000C60 }, /* GL_TEXTURE_GEN_S */ - { 36199, 0x00000C61 }, /* GL_TEXTURE_GEN_T */ - { 36216, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */ - { 36241, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */ - { 36263, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */ - { 36289, 0x00001001 }, /* GL_TEXTURE_HEIGHT */ - { 36307, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */ - { 36333, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */ - { 36359, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */ - { 36389, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */ - { 36416, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */ - { 36441, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */ - { 36461, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */ - { 36485, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ - { 36512, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ - { 36539, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ - { 36566, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */ - { 36592, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */ - { 36622, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */ - { 36644, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */ - { 36662, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ - { 36692, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ - { 36720, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ - { 36748, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ - { 36776, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */ - { 36797, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */ - { 36816, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */ - { 36838, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */ - { 36857, 0x00008066 }, /* GL_TEXTURE_PRIORITY */ - { 36877, 0x000085B7 }, /* GL_TEXTURE_RANGE_LENGTH_APPLE */ - { 36907, 0x000085B8 }, /* GL_TEXTURE_RANGE_POINTER_APPLE */ - { 36938, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */ - { 36963, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */ - { 36987, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */ - { 37007, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */ - { 37031, 0x00008067 }, /* GL_TEXTURE_RESIDENT */ - { 37051, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */ - { 37074, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */ - { 37098, 0x000085BC }, /* GL_TEXTURE_STORAGE_HINT_APPLE */ - { 37128, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */ - { 37153, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ - { 37187, 0x00001000 }, /* GL_TEXTURE_WIDTH */ - { 37204, 0x00008072 }, /* GL_TEXTURE_WRAP_R */ - { 37222, 0x00002802 }, /* GL_TEXTURE_WRAP_S */ - { 37240, 0x00002803 }, /* GL_TEXTURE_WRAP_T */ - { 37258, 0x0000911B }, /* GL_TIMEOUT_EXPIRED */ - { 37277, 0xFFFFFFFFFFFFFFFF }, /* GL_TIMEOUT_IGNORED */ - { 37296, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */ - { 37316, 0x00008648 }, /* GL_TRACK_MATRIX_NV */ - { 37335, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */ - { 37364, 0x00001000 }, /* GL_TRANSFORM_BIT */ - { 37381, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */ - { 37407, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */ - { 37437, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ - { 37469, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ - { 37499, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */ - { 37533, 0x0000862C }, /* GL_TRANSPOSE_NV */ - { 37549, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */ - { 37580, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */ - { 37615, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */ - { 37643, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */ - { 37675, 0x00000004 }, /* GL_TRIANGLES */ - { 37688, 0x00000006 }, /* GL_TRIANGLE_FAN */ - { 37704, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */ - { 37725, 0x00000005 }, /* GL_TRIANGLE_STRIP */ - { 37743, 0x00000001 }, /* GL_TRUE */ - { 37751, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */ - { 37771, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */ - { 37794, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */ - { 37814, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */ - { 37835, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */ - { 37857, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */ - { 37879, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */ - { 37899, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */ - { 37920, 0x00009118 }, /* GL_UNSIGNALED */ - { 37934, 0x00001401 }, /* GL_UNSIGNED_BYTE */ - { 37951, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */ - { 37978, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */ - { 38001, 0x00001405 }, /* GL_UNSIGNED_INT */ - { 38017, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */ - { 38044, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */ - { 38065, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */ - { 38089, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */ - { 38120, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */ - { 38144, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */ - { 38172, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */ - { 38195, 0x00001403 }, /* GL_UNSIGNED_SHORT */ - { 38213, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ - { 38243, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */ - { 38269, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ - { 38299, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */ - { 38325, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */ - { 38349, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */ - { 38377, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */ - { 38405, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */ - { 38432, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ - { 38464, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */ - { 38495, 0x00008CA2 }, /* GL_UPPER_LEFT */ - { 38509, 0x00002A20 }, /* GL_V2F */ - { 38516, 0x00002A21 }, /* GL_V3F */ - { 38523, 0x00008B83 }, /* GL_VALIDATE_STATUS */ - { 38542, 0x00001F00 }, /* GL_VENDOR */ - { 38552, 0x00001F02 }, /* GL_VERSION */ - { 38563, 0x00008074 }, /* GL_VERTEX_ARRAY */ - { 38579, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING */ - { 38603, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */ - { 38633, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ - { 38664, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */ - { 38699, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */ - { 38723, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */ - { 38744, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */ - { 38767, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */ - { 38788, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ - { 38815, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ - { 38843, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ - { 38871, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ - { 38899, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ - { 38927, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ - { 38955, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ - { 38983, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ - { 39010, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ - { 39037, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ - { 39064, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ - { 39091, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ - { 39118, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ - { 39145, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ - { 39172, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ - { 39199, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ - { 39226, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ - { 39264, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */ - { 39306, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ - { 39337, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ - { 39372, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ - { 39406, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ - { 39444, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ - { 39475, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ - { 39510, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ - { 39538, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ - { 39570, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ - { 39600, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ - { 39634, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ - { 39662, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ - { 39694, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */ - { 39714, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */ - { 39736, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */ - { 39765, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */ - { 39786, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */ - { 39815, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ - { 39848, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ - { 39880, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */ - { 39907, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ - { 39938, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ - { 39968, 0x00008B31 }, /* GL_VERTEX_SHADER */ - { 39985, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */ - { 40006, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */ - { 40033, 0x00000BA2 }, /* GL_VIEWPORT */ - { 40045, 0x00000800 }, /* GL_VIEWPORT_BIT */ - { 40061, 0x0000911D }, /* GL_WAIT_FAILED */ - { 40076, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */ - { 40096, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ - { 40127, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */ - { 40162, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */ - { 40190, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */ - { 40215, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ - { 40242, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */ - { 40267, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */ - { 40291, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */ - { 40310, 0x000088B9 }, /* GL_WRITE_ONLY */ - { 40324, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */ - { 40342, 0x00001506 }, /* GL_XOR */ - { 40349, 0x000085B9 }, /* GL_YCBCR_422_APPLE */ - { 40368, 0x00008757 }, /* GL_YCBCR_MESA */ - { 40382, 0x00000000 }, /* GL_ZERO */ - { 40390, 0x00000D16 }, /* GL_ZOOM_X */ - { 40400, 0x00000D17 }, /* GL_ZOOM_Y */ + { 7190, 0x000088F0 }, /* GL_DEPTH24_STENCIL8_EXT */ + { 7214, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT */ + { 7234, 0x00008D00 }, /* GL_DEPTH_ATTACHMENT_EXT */ + { 7258, 0x00000D1F }, /* GL_DEPTH_BIAS */ + { 7272, 0x00000D56 }, /* GL_DEPTH_BITS */ + { 7286, 0x00008891 }, /* GL_DEPTH_BOUNDS_EXT */ + { 7306, 0x00008890 }, /* GL_DEPTH_BOUNDS_TEST_EXT */ + { 7331, 0x00000100 }, /* GL_DEPTH_BUFFER_BIT */ + { 7351, 0x0000864F }, /* GL_DEPTH_CLAMP */ + { 7366, 0x0000864F }, /* GL_DEPTH_CLAMP_NV */ + { 7384, 0x00000B73 }, /* GL_DEPTH_CLEAR_VALUE */ + { 7405, 0x00001902 }, /* GL_DEPTH_COMPONENT */ + { 7424, 0x000081A5 }, /* GL_DEPTH_COMPONENT16 */ + { 7445, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_ARB */ + { 7470, 0x000081A5 }, /* GL_DEPTH_COMPONENT16_SGIX */ + { 7496, 0x000081A6 }, /* GL_DEPTH_COMPONENT24 */ + { 7517, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_ARB */ + { 7542, 0x000081A6 }, /* GL_DEPTH_COMPONENT24_SGIX */ + { 7568, 0x000081A7 }, /* GL_DEPTH_COMPONENT32 */ + { 7589, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_ARB */ + { 7614, 0x000081A7 }, /* GL_DEPTH_COMPONENT32_SGIX */ + { 7640, 0x00000B74 }, /* GL_DEPTH_FUNC */ + { 7654, 0x00000B70 }, /* GL_DEPTH_RANGE */ + { 7669, 0x00000D1E }, /* GL_DEPTH_SCALE */ + { 7684, 0x000084F9 }, /* GL_DEPTH_STENCIL */ + { 7701, 0x0000821A }, /* GL_DEPTH_STENCIL_ATTACHMENT */ + { 7729, 0x000084F9 }, /* GL_DEPTH_STENCIL_EXT */ + { 7750, 0x000084F9 }, /* GL_DEPTH_STENCIL_NV */ + { 7770, 0x0000886F }, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ + { 7798, 0x0000886E }, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ + { 7826, 0x00000B71 }, /* GL_DEPTH_TEST */ + { 7840, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE */ + { 7862, 0x0000884B }, /* GL_DEPTH_TEXTURE_MODE_ARB */ + { 7888, 0x00000B72 }, /* GL_DEPTH_WRITEMASK */ + { 7907, 0x00001201 }, /* GL_DIFFUSE */ + { 7918, 0x00000BD0 }, /* GL_DITHER */ + { 7928, 0x00000A02 }, /* GL_DOMAIN */ + { 7938, 0x00001100 }, /* GL_DONT_CARE */ + { 7951, 0x000086AE }, /* GL_DOT3_RGB */ + { 7963, 0x000086AF }, /* GL_DOT3_RGBA */ + { 7976, 0x000086AF }, /* GL_DOT3_RGBA_ARB */ + { 7993, 0x00008741 }, /* GL_DOT3_RGBA_EXT */ + { 8010, 0x000086AE }, /* GL_DOT3_RGB_ARB */ + { 8026, 0x00008740 }, /* GL_DOT3_RGB_EXT */ + { 8042, 0x0000140A }, /* GL_DOUBLE */ + { 8052, 0x00000C32 }, /* GL_DOUBLEBUFFER */ + { 8068, 0x00000C01 }, /* GL_DRAW_BUFFER */ + { 8083, 0x00008825 }, /* GL_DRAW_BUFFER0 */ + { 8099, 0x00008825 }, /* GL_DRAW_BUFFER0_ARB */ + { 8119, 0x00008825 }, /* GL_DRAW_BUFFER0_ATI */ + { 8139, 0x00008826 }, /* GL_DRAW_BUFFER1 */ + { 8155, 0x0000882F }, /* GL_DRAW_BUFFER10 */ + { 8172, 0x0000882F }, /* GL_DRAW_BUFFER10_ARB */ + { 8193, 0x0000882F }, /* GL_DRAW_BUFFER10_ATI */ + { 8214, 0x00008830 }, /* GL_DRAW_BUFFER11 */ + { 8231, 0x00008830 }, /* GL_DRAW_BUFFER11_ARB */ + { 8252, 0x00008830 }, /* GL_DRAW_BUFFER11_ATI */ + { 8273, 0x00008831 }, /* GL_DRAW_BUFFER12 */ + { 8290, 0x00008831 }, /* GL_DRAW_BUFFER12_ARB */ + { 8311, 0x00008831 }, /* GL_DRAW_BUFFER12_ATI */ + { 8332, 0x00008832 }, /* GL_DRAW_BUFFER13 */ + { 8349, 0x00008832 }, /* GL_DRAW_BUFFER13_ARB */ + { 8370, 0x00008832 }, /* GL_DRAW_BUFFER13_ATI */ + { 8391, 0x00008833 }, /* GL_DRAW_BUFFER14 */ + { 8408, 0x00008833 }, /* GL_DRAW_BUFFER14_ARB */ + { 8429, 0x00008833 }, /* GL_DRAW_BUFFER14_ATI */ + { 8450, 0x00008834 }, /* GL_DRAW_BUFFER15 */ + { 8467, 0x00008834 }, /* GL_DRAW_BUFFER15_ARB */ + { 8488, 0x00008834 }, /* GL_DRAW_BUFFER15_ATI */ + { 8509, 0x00008826 }, /* GL_DRAW_BUFFER1_ARB */ + { 8529, 0x00008826 }, /* GL_DRAW_BUFFER1_ATI */ + { 8549, 0x00008827 }, /* GL_DRAW_BUFFER2 */ + { 8565, 0x00008827 }, /* GL_DRAW_BUFFER2_ARB */ + { 8585, 0x00008827 }, /* GL_DRAW_BUFFER2_ATI */ + { 8605, 0x00008828 }, /* GL_DRAW_BUFFER3 */ + { 8621, 0x00008828 }, /* GL_DRAW_BUFFER3_ARB */ + { 8641, 0x00008828 }, /* GL_DRAW_BUFFER3_ATI */ + { 8661, 0x00008829 }, /* GL_DRAW_BUFFER4 */ + { 8677, 0x00008829 }, /* GL_DRAW_BUFFER4_ARB */ + { 8697, 0x00008829 }, /* GL_DRAW_BUFFER4_ATI */ + { 8717, 0x0000882A }, /* GL_DRAW_BUFFER5 */ + { 8733, 0x0000882A }, /* GL_DRAW_BUFFER5_ARB */ + { 8753, 0x0000882A }, /* GL_DRAW_BUFFER5_ATI */ + { 8773, 0x0000882B }, /* GL_DRAW_BUFFER6 */ + { 8789, 0x0000882B }, /* GL_DRAW_BUFFER6_ARB */ + { 8809, 0x0000882B }, /* GL_DRAW_BUFFER6_ATI */ + { 8829, 0x0000882C }, /* GL_DRAW_BUFFER7 */ + { 8845, 0x0000882C }, /* GL_DRAW_BUFFER7_ARB */ + { 8865, 0x0000882C }, /* GL_DRAW_BUFFER7_ATI */ + { 8885, 0x0000882D }, /* GL_DRAW_BUFFER8 */ + { 8901, 0x0000882D }, /* GL_DRAW_BUFFER8_ARB */ + { 8921, 0x0000882D }, /* GL_DRAW_BUFFER8_ATI */ + { 8941, 0x0000882E }, /* GL_DRAW_BUFFER9 */ + { 8957, 0x0000882E }, /* GL_DRAW_BUFFER9_ARB */ + { 8977, 0x0000882E }, /* GL_DRAW_BUFFER9_ATI */ + { 8997, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER */ + { 9017, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING */ + { 9045, 0x00008CA6 }, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */ + { 9077, 0x00008CA9 }, /* GL_DRAW_FRAMEBUFFER_EXT */ + { 9101, 0x00000705 }, /* GL_DRAW_PIXEL_TOKEN */ + { 9121, 0x00000304 }, /* GL_DST_ALPHA */ + { 9134, 0x00000306 }, /* GL_DST_COLOR */ + { 9147, 0x0000877A }, /* GL_DU8DV8_ATI */ + { 9161, 0x00008779 }, /* GL_DUDV_ATI */ + { 9173, 0x000088EA }, /* GL_DYNAMIC_COPY */ + { 9189, 0x000088EA }, /* GL_DYNAMIC_COPY_ARB */ + { 9209, 0x000088E8 }, /* GL_DYNAMIC_DRAW */ + { 9225, 0x000088E8 }, /* GL_DYNAMIC_DRAW_ARB */ + { 9245, 0x000088E9 }, /* GL_DYNAMIC_READ */ + { 9261, 0x000088E9 }, /* GL_DYNAMIC_READ_ARB */ + { 9281, 0x00000B43 }, /* GL_EDGE_FLAG */ + { 9294, 0x00008079 }, /* GL_EDGE_FLAG_ARRAY */ + { 9313, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ + { 9347, 0x0000889B }, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB */ + { 9385, 0x00008093 }, /* GL_EDGE_FLAG_ARRAY_POINTER */ + { 9412, 0x0000808C }, /* GL_EDGE_FLAG_ARRAY_STRIDE */ + { 9438, 0x00008893 }, /* GL_ELEMENT_ARRAY_BUFFER */ + { 9462, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ + { 9494, 0x00008895 }, /* GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB */ + { 9530, 0x00001600 }, /* GL_EMISSION */ + { 9542, 0x00002000 }, /* GL_ENABLE_BIT */ + { 9556, 0x00000202 }, /* GL_EQUAL */ + { 9565, 0x00001509 }, /* GL_EQUIV */ + { 9574, 0x00010000 }, /* GL_EVAL_BIT */ + { 9586, 0x00000800 }, /* GL_EXP */ + { 9593, 0x00000801 }, /* GL_EXP2 */ + { 9601, 0x00001F03 }, /* GL_EXTENSIONS */ + { 9615, 0x00002400 }, /* GL_EYE_LINEAR */ + { 9629, 0x00002502 }, /* GL_EYE_PLANE */ + { 9642, 0x0000855C }, /* GL_EYE_PLANE_ABSOLUTE_NV */ + { 9667, 0x0000855B }, /* GL_EYE_RADIAL_NV */ + { 9684, 0x00000000 }, /* GL_FALSE */ + { 9693, 0x00001101 }, /* GL_FASTEST */ + { 9704, 0x00001C01 }, /* GL_FEEDBACK */ + { 9716, 0x00000DF0 }, /* GL_FEEDBACK_BUFFER_POINTER */ + { 9743, 0x00000DF1 }, /* GL_FEEDBACK_BUFFER_SIZE */ + { 9767, 0x00000DF2 }, /* GL_FEEDBACK_BUFFER_TYPE */ + { 9791, 0x00001B02 }, /* GL_FILL */ + { 9799, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION */ + { 9826, 0x00008E4D }, /* GL_FIRST_VERTEX_CONVENTION_EXT */ + { 9857, 0x00001D00 }, /* GL_FLAT */ + { 9865, 0x00001406 }, /* GL_FLOAT */ + { 9874, 0x00008B5A }, /* GL_FLOAT_MAT2 */ + { 9888, 0x00008B5A }, /* GL_FLOAT_MAT2_ARB */ + { 9906, 0x00008B65 }, /* GL_FLOAT_MAT2x3 */ + { 9922, 0x00008B66 }, /* GL_FLOAT_MAT2x4 */ + { 9938, 0x00008B5B }, /* GL_FLOAT_MAT3 */ + { 9952, 0x00008B5B }, /* GL_FLOAT_MAT3_ARB */ + { 9970, 0x00008B67 }, /* GL_FLOAT_MAT3x2 */ + { 9986, 0x00008B68 }, /* GL_FLOAT_MAT3x4 */ + { 10002, 0x00008B5C }, /* GL_FLOAT_MAT4 */ + { 10016, 0x00008B5C }, /* GL_FLOAT_MAT4_ARB */ + { 10034, 0x00008B69 }, /* GL_FLOAT_MAT4x2 */ + { 10050, 0x00008B6A }, /* GL_FLOAT_MAT4x3 */ + { 10066, 0x00008B50 }, /* GL_FLOAT_VEC2 */ + { 10080, 0x00008B50 }, /* GL_FLOAT_VEC2_ARB */ + { 10098, 0x00008B51 }, /* GL_FLOAT_VEC3 */ + { 10112, 0x00008B51 }, /* GL_FLOAT_VEC3_ARB */ + { 10130, 0x00008B52 }, /* GL_FLOAT_VEC4 */ + { 10144, 0x00008B52 }, /* GL_FLOAT_VEC4_ARB */ + { 10162, 0x00000B60 }, /* GL_FOG */ + { 10169, 0x00000080 }, /* GL_FOG_BIT */ + { 10180, 0x00000B66 }, /* GL_FOG_COLOR */ + { 10193, 0x00008451 }, /* GL_FOG_COORD */ + { 10206, 0x00008451 }, /* GL_FOG_COORDINATE */ + { 10224, 0x00008457 }, /* GL_FOG_COORDINATE_ARRAY */ + { 10248, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ + { 10287, 0x0000889D }, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB */ + { 10330, 0x00008456 }, /* GL_FOG_COORDINATE_ARRAY_POINTER */ + { 10362, 0x00008455 }, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ + { 10393, 0x00008454 }, /* GL_FOG_COORDINATE_ARRAY_TYPE */ + { 10422, 0x00008450 }, /* GL_FOG_COORDINATE_SOURCE */ + { 10447, 0x00008457 }, /* GL_FOG_COORD_ARRAY */ + { 10466, 0x0000889D }, /* GL_FOG_COORD_ARRAY_BUFFER_BINDING */ + { 10500, 0x00008456 }, /* GL_FOG_COORD_ARRAY_POINTER */ + { 10527, 0x00008455 }, /* GL_FOG_COORD_ARRAY_STRIDE */ + { 10553, 0x00008454 }, /* GL_FOG_COORD_ARRAY_TYPE */ + { 10577, 0x00008450 }, /* GL_FOG_COORD_SRC */ + { 10594, 0x00000B62 }, /* GL_FOG_DENSITY */ + { 10609, 0x0000855A }, /* GL_FOG_DISTANCE_MODE_NV */ + { 10633, 0x00000B64 }, /* GL_FOG_END */ + { 10644, 0x00000C54 }, /* GL_FOG_HINT */ + { 10656, 0x00000B61 }, /* GL_FOG_INDEX */ + { 10669, 0x00000B65 }, /* GL_FOG_MODE */ + { 10681, 0x00008198 }, /* GL_FOG_OFFSET_SGIX */ + { 10700, 0x00008199 }, /* GL_FOG_OFFSET_VALUE_SGIX */ + { 10725, 0x00000B63 }, /* GL_FOG_START */ + { 10738, 0x00008452 }, /* GL_FRAGMENT_DEPTH */ + { 10756, 0x00008804 }, /* GL_FRAGMENT_PROGRAM_ARB */ + { 10780, 0x00008B30 }, /* GL_FRAGMENT_SHADER */ + { 10799, 0x00008B30 }, /* GL_FRAGMENT_SHADER_ARB */ + { 10822, 0x00008B8B }, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ + { 10857, 0x00008D40 }, /* GL_FRAMEBUFFER */ + { 10872, 0x00008215 }, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ + { 10909, 0x00008214 }, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ + { 10945, 0x00008210 }, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ + { 10986, 0x00008211 }, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ + { 11027, 0x00008216 }, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ + { 11064, 0x00008213 }, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ + { 11101, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ + { 11139, 0x00008CD1 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT */ + { 11181, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ + { 11219, 0x00008CD0 }, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT */ + { 11261, 0x00008212 }, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ + { 11296, 0x00008217 }, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ + { 11335, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT */ + { 11384, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ + { 11432, 0x00008CD3 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT */ + { 11484, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ + { 11524, 0x00008CD4 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT */ + { 11568, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ + { 11608, 0x00008CD2 }, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT */ + { 11652, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING */ + { 11675, 0x00008CA6 }, /* GL_FRAMEBUFFER_BINDING_EXT */ + { 11702, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE */ + { 11726, 0x00008CD5 }, /* GL_FRAMEBUFFER_COMPLETE_EXT */ + { 11754, 0x00008218 }, /* GL_FRAMEBUFFER_DEFAULT */ + { 11777, 0x00008D40 }, /* GL_FRAMEBUFFER_EXT */ + { 11796, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ + { 11833, 0x00008CD6 }, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT */ + { 11874, 0x00008CD9 }, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ + { 11915, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */ + { 11953, 0x00008CDB }, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ + { 11995, 0x00008CD8 }, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ + { 12046, 0x00008CDA }, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ + { 12084, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ + { 12129, 0x00008CD7 }, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT */ + { 12178, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ + { 12216, 0x00008D56 }, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT */ + { 12258, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */ + { 12296, 0x00008CDC }, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ + { 12338, 0x00008CDE }, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ + { 12370, 0x00008219 }, /* GL_FRAMEBUFFER_UNDEFINED */ + { 12395, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED */ + { 12422, 0x00008CDD }, /* GL_FRAMEBUFFER_UNSUPPORTED_EXT */ + { 12453, 0x00000404 }, /* GL_FRONT */ + { 12462, 0x00000408 }, /* GL_FRONT_AND_BACK */ + { 12480, 0x00000B46 }, /* GL_FRONT_FACE */ + { 12494, 0x00000400 }, /* GL_FRONT_LEFT */ + { 12508, 0x00000401 }, /* GL_FRONT_RIGHT */ + { 12523, 0x00008006 }, /* GL_FUNC_ADD */ + { 12535, 0x00008006 }, /* GL_FUNC_ADD_EXT */ + { 12551, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT */ + { 12576, 0x0000800B }, /* GL_FUNC_REVERSE_SUBTRACT_EXT */ + { 12605, 0x0000800A }, /* GL_FUNC_SUBTRACT */ + { 12622, 0x0000800A }, /* GL_FUNC_SUBTRACT_EXT */ + { 12643, 0x00008191 }, /* GL_GENERATE_MIPMAP */ + { 12662, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT */ + { 12686, 0x00008192 }, /* GL_GENERATE_MIPMAP_HINT_SGIS */ + { 12715, 0x00008191 }, /* GL_GENERATE_MIPMAP_SGIS */ + { 12739, 0x00000206 }, /* GL_GEQUAL */ + { 12749, 0x00000204 }, /* GL_GREATER */ + { 12760, 0x00001904 }, /* GL_GREEN */ + { 12769, 0x00000D19 }, /* GL_GREEN_BIAS */ + { 12783, 0x00000D53 }, /* GL_GREEN_BITS */ + { 12797, 0x00000D18 }, /* GL_GREEN_SCALE */ + { 12812, 0x00008000 }, /* GL_HINT_BIT */ + { 12824, 0x00008024 }, /* GL_HISTOGRAM */ + { 12837, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE */ + { 12861, 0x0000802B }, /* GL_HISTOGRAM_ALPHA_SIZE_EXT */ + { 12889, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE */ + { 12912, 0x0000802A }, /* GL_HISTOGRAM_BLUE_SIZE_EXT */ + { 12939, 0x00008024 }, /* GL_HISTOGRAM_EXT */ + { 12956, 0x00008027 }, /* GL_HISTOGRAM_FORMAT */ + { 12976, 0x00008027 }, /* GL_HISTOGRAM_FORMAT_EXT */ + { 13000, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE */ + { 13024, 0x00008029 }, /* GL_HISTOGRAM_GREEN_SIZE_EXT */ + { 13052, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE */ + { 13080, 0x0000802C }, /* GL_HISTOGRAM_LUMINANCE_SIZE_EXT */ + { 13112, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE */ + { 13134, 0x00008028 }, /* GL_HISTOGRAM_RED_SIZE_EXT */ + { 13160, 0x0000802D }, /* GL_HISTOGRAM_SINK */ + { 13178, 0x0000802D }, /* GL_HISTOGRAM_SINK_EXT */ + { 13200, 0x00008026 }, /* GL_HISTOGRAM_WIDTH */ + { 13219, 0x00008026 }, /* GL_HISTOGRAM_WIDTH_EXT */ + { 13242, 0x0000862A }, /* GL_IDENTITY_NV */ + { 13257, 0x00008150 }, /* GL_IGNORE_BORDER_HP */ + { 13277, 0x00008B9B }, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ + { 13317, 0x00008B9A }, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ + { 13355, 0x00001E02 }, /* GL_INCR */ + { 13363, 0x00008507 }, /* GL_INCR_WRAP */ + { 13376, 0x00008507 }, /* GL_INCR_WRAP_EXT */ + { 13393, 0x00008222 }, /* GL_INDEX */ + { 13402, 0x00008077 }, /* GL_INDEX_ARRAY */ + { 13417, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING */ + { 13447, 0x00008899 }, /* GL_INDEX_ARRAY_BUFFER_BINDING_ARB */ + { 13481, 0x00008091 }, /* GL_INDEX_ARRAY_POINTER */ + { 13504, 0x00008086 }, /* GL_INDEX_ARRAY_STRIDE */ + { 13526, 0x00008085 }, /* GL_INDEX_ARRAY_TYPE */ + { 13546, 0x00000D51 }, /* GL_INDEX_BITS */ + { 13560, 0x00000C20 }, /* GL_INDEX_CLEAR_VALUE */ + { 13581, 0x00000BF1 }, /* GL_INDEX_LOGIC_OP */ + { 13599, 0x00000C30 }, /* GL_INDEX_MODE */ + { 13613, 0x00000D13 }, /* GL_INDEX_OFFSET */ + { 13629, 0x00000D12 }, /* GL_INDEX_SHIFT */ + { 13644, 0x00000C21 }, /* GL_INDEX_WRITEMASK */ + { 13663, 0x00008B84 }, /* GL_INFO_LOG_LENGTH */ + { 13682, 0x00001404 }, /* GL_INT */ + { 13689, 0x00008049 }, /* GL_INTENSITY */ + { 13702, 0x0000804C }, /* GL_INTENSITY12 */ + { 13717, 0x0000804C }, /* GL_INTENSITY12_EXT */ + { 13736, 0x0000804D }, /* GL_INTENSITY16 */ + { 13751, 0x0000804D }, /* GL_INTENSITY16_EXT */ + { 13770, 0x0000804A }, /* GL_INTENSITY4 */ + { 13784, 0x0000804A }, /* GL_INTENSITY4_EXT */ + { 13802, 0x0000804B }, /* GL_INTENSITY8 */ + { 13816, 0x0000804B }, /* GL_INTENSITY8_EXT */ + { 13834, 0x00008049 }, /* GL_INTENSITY_EXT */ + { 13851, 0x00008575 }, /* GL_INTERPOLATE */ + { 13866, 0x00008575 }, /* GL_INTERPOLATE_ARB */ + { 13885, 0x00008575 }, /* GL_INTERPOLATE_EXT */ + { 13904, 0x00008B53 }, /* GL_INT_VEC2 */ + { 13916, 0x00008B53 }, /* GL_INT_VEC2_ARB */ + { 13932, 0x00008B54 }, /* GL_INT_VEC3 */ + { 13944, 0x00008B54 }, /* GL_INT_VEC3_ARB */ + { 13960, 0x00008B55 }, /* GL_INT_VEC4 */ + { 13972, 0x00008B55 }, /* GL_INT_VEC4_ARB */ + { 13988, 0x00000500 }, /* GL_INVALID_ENUM */ + { 14004, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION */ + { 14037, 0x00000506 }, /* GL_INVALID_FRAMEBUFFER_OPERATION_EXT */ + { 14074, 0x00000502 }, /* GL_INVALID_OPERATION */ + { 14095, 0x00000501 }, /* GL_INVALID_VALUE */ + { 14112, 0x0000862B }, /* GL_INVERSE_NV */ + { 14126, 0x0000862D }, /* GL_INVERSE_TRANSPOSE_NV */ + { 14150, 0x0000150A }, /* GL_INVERT */ + { 14160, 0x00001E00 }, /* GL_KEEP */ + { 14168, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION */ + { 14194, 0x00008E4E }, /* GL_LAST_VERTEX_CONVENTION_EXT */ + { 14224, 0x00000406 }, /* GL_LEFT */ + { 14232, 0x00000203 }, /* GL_LEQUAL */ + { 14242, 0x00000201 }, /* GL_LESS */ + { 14250, 0x00004000 }, /* GL_LIGHT0 */ + { 14260, 0x00004001 }, /* GL_LIGHT1 */ + { 14270, 0x00004002 }, /* GL_LIGHT2 */ + { 14280, 0x00004003 }, /* GL_LIGHT3 */ + { 14290, 0x00004004 }, /* GL_LIGHT4 */ + { 14300, 0x00004005 }, /* GL_LIGHT5 */ + { 14310, 0x00004006 }, /* GL_LIGHT6 */ + { 14320, 0x00004007 }, /* GL_LIGHT7 */ + { 14330, 0x00000B50 }, /* GL_LIGHTING */ + { 14342, 0x00000040 }, /* GL_LIGHTING_BIT */ + { 14358, 0x00000B53 }, /* GL_LIGHT_MODEL_AMBIENT */ + { 14381, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL */ + { 14410, 0x000081F8 }, /* GL_LIGHT_MODEL_COLOR_CONTROL_EXT */ + { 14443, 0x00000B51 }, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ + { 14471, 0x00000B52 }, /* GL_LIGHT_MODEL_TWO_SIDE */ + { 14495, 0x00001B01 }, /* GL_LINE */ + { 14503, 0x00002601 }, /* GL_LINEAR */ + { 14513, 0x00001208 }, /* GL_LINEAR_ATTENUATION */ + { 14535, 0x00008170 }, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ + { 14565, 0x0000844F }, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ + { 14596, 0x00002703 }, /* GL_LINEAR_MIPMAP_LINEAR */ + { 14620, 0x00002701 }, /* GL_LINEAR_MIPMAP_NEAREST */ + { 14645, 0x00000001 }, /* GL_LINES */ + { 14654, 0x00000004 }, /* GL_LINE_BIT */ + { 14666, 0x00000002 }, /* GL_LINE_LOOP */ + { 14679, 0x00000707 }, /* GL_LINE_RESET_TOKEN */ + { 14699, 0x00000B20 }, /* GL_LINE_SMOOTH */ + { 14714, 0x00000C52 }, /* GL_LINE_SMOOTH_HINT */ + { 14734, 0x00000B24 }, /* GL_LINE_STIPPLE */ + { 14750, 0x00000B25 }, /* GL_LINE_STIPPLE_PATTERN */ + { 14774, 0x00000B26 }, /* GL_LINE_STIPPLE_REPEAT */ + { 14797, 0x00000003 }, /* GL_LINE_STRIP */ + { 14811, 0x00000702 }, /* GL_LINE_TOKEN */ + { 14825, 0x00000B21 }, /* GL_LINE_WIDTH */ + { 14839, 0x00000B23 }, /* GL_LINE_WIDTH_GRANULARITY */ + { 14865, 0x00000B22 }, /* GL_LINE_WIDTH_RANGE */ + { 14885, 0x00008B82 }, /* GL_LINK_STATUS */ + { 14900, 0x00000B32 }, /* GL_LIST_BASE */ + { 14913, 0x00020000 }, /* GL_LIST_BIT */ + { 14925, 0x00000B33 }, /* GL_LIST_INDEX */ + { 14939, 0x00000B30 }, /* GL_LIST_MODE */ + { 14952, 0x00000101 }, /* GL_LOAD */ + { 14960, 0x00000BF1 }, /* GL_LOGIC_OP */ + { 14972, 0x00000BF0 }, /* GL_LOGIC_OP_MODE */ + { 14989, 0x00008CA1 }, /* GL_LOWER_LEFT */ + { 15003, 0x00001909 }, /* GL_LUMINANCE */ + { 15016, 0x00008041 }, /* GL_LUMINANCE12 */ + { 15031, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12 */ + { 15054, 0x00008047 }, /* GL_LUMINANCE12_ALPHA12_EXT */ + { 15081, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4 */ + { 15103, 0x00008046 }, /* GL_LUMINANCE12_ALPHA4_EXT */ + { 15129, 0x00008041 }, /* GL_LUMINANCE12_EXT */ + { 15148, 0x00008042 }, /* GL_LUMINANCE16 */ + { 15163, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16 */ + { 15186, 0x00008048 }, /* GL_LUMINANCE16_ALPHA16_EXT */ + { 15213, 0x00008042 }, /* GL_LUMINANCE16_EXT */ + { 15232, 0x0000803F }, /* GL_LUMINANCE4 */ + { 15246, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4 */ + { 15267, 0x00008043 }, /* GL_LUMINANCE4_ALPHA4_EXT */ + { 15292, 0x0000803F }, /* GL_LUMINANCE4_EXT */ + { 15310, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2 */ + { 15331, 0x00008044 }, /* GL_LUMINANCE6_ALPHA2_EXT */ + { 15356, 0x00008040 }, /* GL_LUMINANCE8 */ + { 15370, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8 */ + { 15391, 0x00008045 }, /* GL_LUMINANCE8_ALPHA8_EXT */ + { 15416, 0x00008040 }, /* GL_LUMINANCE8_EXT */ + { 15434, 0x0000190A }, /* GL_LUMINANCE_ALPHA */ + { 15453, 0x00000D90 }, /* GL_MAP1_COLOR_4 */ + { 15469, 0x00000DD0 }, /* GL_MAP1_GRID_DOMAIN */ + { 15489, 0x00000DD1 }, /* GL_MAP1_GRID_SEGMENTS */ + { 15511, 0x00000D91 }, /* GL_MAP1_INDEX */ + { 15525, 0x00000D92 }, /* GL_MAP1_NORMAL */ + { 15540, 0x00000D93 }, /* GL_MAP1_TEXTURE_COORD_1 */ + { 15564, 0x00000D94 }, /* GL_MAP1_TEXTURE_COORD_2 */ + { 15588, 0x00000D95 }, /* GL_MAP1_TEXTURE_COORD_3 */ + { 15612, 0x00000D96 }, /* GL_MAP1_TEXTURE_COORD_4 */ + { 15636, 0x00000D97 }, /* GL_MAP1_VERTEX_3 */ + { 15653, 0x00000D98 }, /* GL_MAP1_VERTEX_4 */ + { 15670, 0x00008660 }, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ + { 15698, 0x0000866A }, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ + { 15727, 0x0000866B }, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ + { 15756, 0x0000866C }, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ + { 15785, 0x0000866D }, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ + { 15814, 0x0000866E }, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ + { 15843, 0x0000866F }, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ + { 15872, 0x00008661 }, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ + { 15900, 0x00008662 }, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ + { 15928, 0x00008663 }, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ + { 15956, 0x00008664 }, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ + { 15984, 0x00008665 }, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ + { 16012, 0x00008666 }, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ + { 16040, 0x00008667 }, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ + { 16068, 0x00008668 }, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ + { 16096, 0x00008669 }, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ + { 16124, 0x00000DB0 }, /* GL_MAP2_COLOR_4 */ + { 16140, 0x00000DD2 }, /* GL_MAP2_GRID_DOMAIN */ + { 16160, 0x00000DD3 }, /* GL_MAP2_GRID_SEGMENTS */ + { 16182, 0x00000DB1 }, /* GL_MAP2_INDEX */ + { 16196, 0x00000DB2 }, /* GL_MAP2_NORMAL */ + { 16211, 0x00000DB3 }, /* GL_MAP2_TEXTURE_COORD_1 */ + { 16235, 0x00000DB4 }, /* GL_MAP2_TEXTURE_COORD_2 */ + { 16259, 0x00000DB5 }, /* GL_MAP2_TEXTURE_COORD_3 */ + { 16283, 0x00000DB6 }, /* GL_MAP2_TEXTURE_COORD_4 */ + { 16307, 0x00000DB7 }, /* GL_MAP2_VERTEX_3 */ + { 16324, 0x00000DB8 }, /* GL_MAP2_VERTEX_4 */ + { 16341, 0x00008670 }, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ + { 16369, 0x0000867A }, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ + { 16398, 0x0000867B }, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ + { 16427, 0x0000867C }, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ + { 16456, 0x0000867D }, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ + { 16485, 0x0000867E }, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ + { 16514, 0x0000867F }, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ + { 16543, 0x00008671 }, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ + { 16571, 0x00008672 }, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ + { 16599, 0x00008673 }, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ + { 16627, 0x00008674 }, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ + { 16655, 0x00008675 }, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ + { 16683, 0x00008676 }, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ + { 16711, 0x00008677 }, /* GL_MAP2_VERTEX_ATTRIB7_4_NV */ + { 16739, 0x00008678 }, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ + { 16767, 0x00008679 }, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ + { 16795, 0x00000D10 }, /* GL_MAP_COLOR */ + { 16808, 0x00000010 }, /* GL_MAP_FLUSH_EXPLICIT_BIT */ + { 16834, 0x00000008 }, /* GL_MAP_INVALIDATE_BUFFER_BIT */ + { 16863, 0x00000004 }, /* GL_MAP_INVALIDATE_RANGE_BIT */ + { 16891, 0x00000001 }, /* GL_MAP_READ_BIT */ + { 16907, 0x00000D11 }, /* GL_MAP_STENCIL */ + { 16922, 0x00000020 }, /* GL_MAP_UNSYNCHRONIZED_BIT */ + { 16948, 0x00000002 }, /* GL_MAP_WRITE_BIT */ + { 16965, 0x000088C0 }, /* GL_MATRIX0_ARB */ + { 16980, 0x00008630 }, /* GL_MATRIX0_NV */ + { 16994, 0x000088CA }, /* GL_MATRIX10_ARB */ + { 17010, 0x000088CB }, /* GL_MATRIX11_ARB */ + { 17026, 0x000088CC }, /* GL_MATRIX12_ARB */ + { 17042, 0x000088CD }, /* GL_MATRIX13_ARB */ + { 17058, 0x000088CE }, /* GL_MATRIX14_ARB */ + { 17074, 0x000088CF }, /* GL_MATRIX15_ARB */ + { 17090, 0x000088D0 }, /* GL_MATRIX16_ARB */ + { 17106, 0x000088D1 }, /* GL_MATRIX17_ARB */ + { 17122, 0x000088D2 }, /* GL_MATRIX18_ARB */ + { 17138, 0x000088D3 }, /* GL_MATRIX19_ARB */ + { 17154, 0x000088C1 }, /* GL_MATRIX1_ARB */ + { 17169, 0x00008631 }, /* GL_MATRIX1_NV */ + { 17183, 0x000088D4 }, /* GL_MATRIX20_ARB */ + { 17199, 0x000088D5 }, /* GL_MATRIX21_ARB */ + { 17215, 0x000088D6 }, /* GL_MATRIX22_ARB */ + { 17231, 0x000088D7 }, /* GL_MATRIX23_ARB */ + { 17247, 0x000088D8 }, /* GL_MATRIX24_ARB */ + { 17263, 0x000088D9 }, /* GL_MATRIX25_ARB */ + { 17279, 0x000088DA }, /* GL_MATRIX26_ARB */ + { 17295, 0x000088DB }, /* GL_MATRIX27_ARB */ + { 17311, 0x000088DC }, /* GL_MATRIX28_ARB */ + { 17327, 0x000088DD }, /* GL_MATRIX29_ARB */ + { 17343, 0x000088C2 }, /* GL_MATRIX2_ARB */ + { 17358, 0x00008632 }, /* GL_MATRIX2_NV */ + { 17372, 0x000088DE }, /* GL_MATRIX30_ARB */ + { 17388, 0x000088DF }, /* GL_MATRIX31_ARB */ + { 17404, 0x000088C3 }, /* GL_MATRIX3_ARB */ + { 17419, 0x00008633 }, /* GL_MATRIX3_NV */ + { 17433, 0x000088C4 }, /* GL_MATRIX4_ARB */ + { 17448, 0x00008634 }, /* GL_MATRIX4_NV */ + { 17462, 0x000088C5 }, /* GL_MATRIX5_ARB */ + { 17477, 0x00008635 }, /* GL_MATRIX5_NV */ + { 17491, 0x000088C6 }, /* GL_MATRIX6_ARB */ + { 17506, 0x00008636 }, /* GL_MATRIX6_NV */ + { 17520, 0x000088C7 }, /* GL_MATRIX7_ARB */ + { 17535, 0x00008637 }, /* GL_MATRIX7_NV */ + { 17549, 0x000088C8 }, /* GL_MATRIX8_ARB */ + { 17564, 0x000088C9 }, /* GL_MATRIX9_ARB */ + { 17579, 0x00008844 }, /* GL_MATRIX_INDEX_ARRAY_ARB */ + { 17605, 0x00008849 }, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ + { 17639, 0x00008846 }, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ + { 17670, 0x00008848 }, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ + { 17703, 0x00008847 }, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ + { 17734, 0x00000BA0 }, /* GL_MATRIX_MODE */ + { 17749, 0x00008840 }, /* GL_MATRIX_PALETTE_ARB */ + { 17771, 0x00008008 }, /* GL_MAX */ + { 17778, 0x00008073 }, /* GL_MAX_3D_TEXTURE_SIZE */ + { 17801, 0x000088FF }, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ + { 17833, 0x00000D35 }, /* GL_MAX_ATTRIB_STACK_DEPTH */ + { 17859, 0x00000D3B }, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ + { 17892, 0x00008177 }, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ + { 17918, 0x00008178 }, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + { 17952, 0x00000D32 }, /* GL_MAX_CLIP_PLANES */ + { 17971, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS */ + { 17996, 0x00008CDF }, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ + { 18025, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ + { 18057, 0x000080B3 }, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI */ + { 18093, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ + { 18129, 0x00008B4D }, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB */ + { 18169, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT */ + { 18195, 0x0000801B }, /* GL_MAX_CONVOLUTION_HEIGHT_EXT */ + { 18225, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH */ + { 18250, 0x0000801A }, /* GL_MAX_CONVOLUTION_WIDTH_EXT */ + { 18279, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ + { 18308, 0x0000851C }, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB */ + { 18341, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS */ + { 18361, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ARB */ + { 18385, 0x00008824 }, /* GL_MAX_DRAW_BUFFERS_ATI */ + { 18409, 0x000080E9 }, /* GL_MAX_ELEMENTS_INDICES */ + { 18433, 0x000080E8 }, /* GL_MAX_ELEMENTS_VERTICES */ + { 18458, 0x00000D30 }, /* GL_MAX_EVAL_ORDER */ + { 18476, 0x00008008 }, /* GL_MAX_EXT */ + { 18487, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ + { 18522, 0x00008B49 }, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB */ + { 18561, 0x00000D31 }, /* GL_MAX_LIGHTS */ + { 18575, 0x00000B31 }, /* GL_MAX_LIST_NESTING */ + { 18595, 0x00008841 }, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ + { 18633, 0x00000D36 }, /* GL_MAX_MODELVIEW_STACK_DEPTH */ + { 18662, 0x00000D37 }, /* GL_MAX_NAME_STACK_DEPTH */ + { 18686, 0x00008842 }, /* GL_MAX_PALETTE_MATRICES_ARB */ + { 18714, 0x00000D34 }, /* GL_MAX_PIXEL_MAP_TABLE */ + { 18737, 0x000088B1 }, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ + { 18774, 0x0000880B }, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ + { 18810, 0x000088AD }, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ + { 18837, 0x000088F5 }, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ + { 18866, 0x000088B5 }, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ + { 18900, 0x000088F4 }, /* GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV */ + { 18936, 0x000088F6 }, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ + { 18963, 0x000088A1 }, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ + { 18995, 0x000088B4 }, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ + { 19031, 0x000088F8 }, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ + { 19060, 0x000088F7 }, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ + { 19089, 0x0000862F }, /* GL_MAX_PROGRAM_MATRICES_ARB */ + { 19117, 0x0000862E }, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ + { 19155, 0x000088B3 }, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + { 19199, 0x0000880E }, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + { 19242, 0x000088AF }, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ + { 19276, 0x000088A3 }, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + { 19315, 0x000088AB }, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ + { 19352, 0x000088A7 }, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ + { 19390, 0x00008810 }, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + { 19433, 0x0000880F }, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + { 19476, 0x000088A9 }, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ + { 19506, 0x000088A5 }, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ + { 19537, 0x0000880D }, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ + { 19573, 0x0000880C }, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ + { 19609, 0x00000D38 }, /* GL_MAX_PROJECTION_STACK_DEPTH */ + { 19639, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ + { 19673, 0x000084F8 }, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_NV */ + { 19706, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE */ + { 19731, 0x000084E8 }, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ + { 19760, 0x00008D57 }, /* GL_MAX_SAMPLES */ + { 19775, 0x00008D57 }, /* GL_MAX_SAMPLES_EXT */ + { 19794, 0x00009111 }, /* GL_MAX_SERVER_WAIT_TIMEOUT */ + { 19821, 0x00008504 }, /* GL_MAX_SHININESS_NV */ + { 19841, 0x00008505 }, /* GL_MAX_SPOT_EXPONENT_NV */ + { 19865, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS */ + { 19887, 0x00008871 }, /* GL_MAX_TEXTURE_COORDS_ARB */ + { 19913, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS */ + { 19940, 0x00008872 }, /* GL_MAX_TEXTURE_IMAGE_UNITS_ARB */ + { 19971, 0x000084FD }, /* GL_MAX_TEXTURE_LOD_BIAS */ + { 19995, 0x000084FF }, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ + { 20029, 0x00000D33 }, /* GL_MAX_TEXTURE_SIZE */ + { 20049, 0x00000D39 }, /* GL_MAX_TEXTURE_STACK_DEPTH */ + { 20076, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS */ + { 20097, 0x000084E2 }, /* GL_MAX_TEXTURE_UNITS_ARB */ + { 20122, 0x0000862F }, /* GL_MAX_TRACK_MATRICES_NV */ + { 20147, 0x0000862E }, /* GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV */ + { 20182, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS */ + { 20204, 0x00008B4B }, /* GL_MAX_VARYING_FLOATS_ARB */ + { 20230, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS */ + { 20252, 0x00008869 }, /* GL_MAX_VERTEX_ATTRIBS_ARB */ + { 20278, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ + { 20312, 0x00008B4C }, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB */ + { 20350, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ + { 20383, 0x00008B4A }, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB */ + { 20420, 0x000086A4 }, /* GL_MAX_VERTEX_UNITS_ARB */ + { 20444, 0x00000D3A }, /* GL_MAX_VIEWPORT_DIMS */ + { 20465, 0x00008007 }, /* GL_MIN */ + { 20472, 0x0000802E }, /* GL_MINMAX */ + { 20482, 0x0000802E }, /* GL_MINMAX_EXT */ + { 20496, 0x0000802F }, /* GL_MINMAX_FORMAT */ + { 20513, 0x0000802F }, /* GL_MINMAX_FORMAT_EXT */ + { 20534, 0x00008030 }, /* GL_MINMAX_SINK */ + { 20549, 0x00008030 }, /* GL_MINMAX_SINK_EXT */ + { 20568, 0x00008007 }, /* GL_MIN_EXT */ + { 20579, 0x00008370 }, /* GL_MIRRORED_REPEAT */ + { 20598, 0x00008370 }, /* GL_MIRRORED_REPEAT_ARB */ + { 20621, 0x00008370 }, /* GL_MIRRORED_REPEAT_IBM */ + { 20644, 0x00008742 }, /* GL_MIRROR_CLAMP_ATI */ + { 20664, 0x00008742 }, /* GL_MIRROR_CLAMP_EXT */ + { 20684, 0x00008912 }, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ + { 20714, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_ATI */ + { 20742, 0x00008743 }, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ + { 20770, 0x00001700 }, /* GL_MODELVIEW */ + { 20783, 0x00001700 }, /* GL_MODELVIEW0_ARB */ + { 20801, 0x0000872A }, /* GL_MODELVIEW10_ARB */ + { 20820, 0x0000872B }, /* GL_MODELVIEW11_ARB */ + { 20839, 0x0000872C }, /* GL_MODELVIEW12_ARB */ + { 20858, 0x0000872D }, /* GL_MODELVIEW13_ARB */ + { 20877, 0x0000872E }, /* GL_MODELVIEW14_ARB */ + { 20896, 0x0000872F }, /* GL_MODELVIEW15_ARB */ + { 20915, 0x00008730 }, /* GL_MODELVIEW16_ARB */ + { 20934, 0x00008731 }, /* GL_MODELVIEW17_ARB */ + { 20953, 0x00008732 }, /* GL_MODELVIEW18_ARB */ + { 20972, 0x00008733 }, /* GL_MODELVIEW19_ARB */ + { 20991, 0x0000850A }, /* GL_MODELVIEW1_ARB */ + { 21009, 0x00008734 }, /* GL_MODELVIEW20_ARB */ + { 21028, 0x00008735 }, /* GL_MODELVIEW21_ARB */ + { 21047, 0x00008736 }, /* GL_MODELVIEW22_ARB */ + { 21066, 0x00008737 }, /* GL_MODELVIEW23_ARB */ + { 21085, 0x00008738 }, /* GL_MODELVIEW24_ARB */ + { 21104, 0x00008739 }, /* GL_MODELVIEW25_ARB */ + { 21123, 0x0000873A }, /* GL_MODELVIEW26_ARB */ + { 21142, 0x0000873B }, /* GL_MODELVIEW27_ARB */ + { 21161, 0x0000873C }, /* GL_MODELVIEW28_ARB */ + { 21180, 0x0000873D }, /* GL_MODELVIEW29_ARB */ + { 21199, 0x00008722 }, /* GL_MODELVIEW2_ARB */ + { 21217, 0x0000873E }, /* GL_MODELVIEW30_ARB */ + { 21236, 0x0000873F }, /* GL_MODELVIEW31_ARB */ + { 21255, 0x00008723 }, /* GL_MODELVIEW3_ARB */ + { 21273, 0x00008724 }, /* GL_MODELVIEW4_ARB */ + { 21291, 0x00008725 }, /* GL_MODELVIEW5_ARB */ + { 21309, 0x00008726 }, /* GL_MODELVIEW6_ARB */ + { 21327, 0x00008727 }, /* GL_MODELVIEW7_ARB */ + { 21345, 0x00008728 }, /* GL_MODELVIEW8_ARB */ + { 21363, 0x00008729 }, /* GL_MODELVIEW9_ARB */ + { 21381, 0x00000BA6 }, /* GL_MODELVIEW_MATRIX */ + { 21401, 0x00008629 }, /* GL_MODELVIEW_PROJECTION_NV */ + { 21428, 0x00000BA3 }, /* GL_MODELVIEW_STACK_DEPTH */ + { 21453, 0x00002100 }, /* GL_MODULATE */ + { 21465, 0x00008744 }, /* GL_MODULATE_ADD_ATI */ + { 21485, 0x00008745 }, /* GL_MODULATE_SIGNED_ADD_ATI */ + { 21512, 0x00008746 }, /* GL_MODULATE_SUBTRACT_ATI */ + { 21537, 0x00000103 }, /* GL_MULT */ + { 21545, 0x0000809D }, /* GL_MULTISAMPLE */ + { 21560, 0x000086B2 }, /* GL_MULTISAMPLE_3DFX */ + { 21580, 0x0000809D }, /* GL_MULTISAMPLE_ARB */ + { 21599, 0x20000000 }, /* GL_MULTISAMPLE_BIT */ + { 21618, 0x20000000 }, /* GL_MULTISAMPLE_BIT_3DFX */ + { 21642, 0x20000000 }, /* GL_MULTISAMPLE_BIT_ARB */ + { 21665, 0x00008534 }, /* GL_MULTISAMPLE_FILTER_HINT_NV */ + { 21695, 0x00002A25 }, /* GL_N3F_V3F */ + { 21706, 0x00000D70 }, /* GL_NAME_STACK_DEPTH */ + { 21726, 0x0000150E }, /* GL_NAND */ + { 21734, 0x00002600 }, /* GL_NEAREST */ + { 21745, 0x0000844E }, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ + { 21776, 0x0000844D }, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ + { 21808, 0x00002702 }, /* GL_NEAREST_MIPMAP_LINEAR */ + { 21833, 0x00002700 }, /* GL_NEAREST_MIPMAP_NEAREST */ + { 21859, 0x00000200 }, /* GL_NEVER */ + { 21868, 0x00001102 }, /* GL_NICEST */ + { 21878, 0x00000000 }, /* GL_NONE */ + { 21886, 0x00001505 }, /* GL_NOOP */ + { 21894, 0x00001508 }, /* GL_NOR */ + { 21901, 0x00000BA1 }, /* GL_NORMALIZE */ + { 21914, 0x00008075 }, /* GL_NORMAL_ARRAY */ + { 21930, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ + { 21961, 0x00008897 }, /* GL_NORMAL_ARRAY_BUFFER_BINDING_ARB */ + { 21996, 0x0000808F }, /* GL_NORMAL_ARRAY_POINTER */ + { 22020, 0x0000807F }, /* GL_NORMAL_ARRAY_STRIDE */ + { 22043, 0x0000807E }, /* GL_NORMAL_ARRAY_TYPE */ + { 22064, 0x00008511 }, /* GL_NORMAL_MAP */ + { 22078, 0x00008511 }, /* GL_NORMAL_MAP_ARB */ + { 22096, 0x00008511 }, /* GL_NORMAL_MAP_NV */ + { 22113, 0x00000205 }, /* GL_NOTEQUAL */ + { 22125, 0x00000000 }, /* GL_NO_ERROR */ + { 22137, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ + { 22171, 0x000086A2 }, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB */ + { 22209, 0x00008B89 }, /* GL_OBJECT_ACTIVE_ATTRIBUTES_ARB */ + { 22241, 0x00008B8A }, /* GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB */ + { 22283, 0x00008B86 }, /* GL_OBJECT_ACTIVE_UNIFORMS_ARB */ + { 22313, 0x00008B87 }, /* GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB */ + { 22353, 0x00008B85 }, /* GL_OBJECT_ATTACHED_OBJECTS_ARB */ + { 22384, 0x00008B81 }, /* GL_OBJECT_COMPILE_STATUS_ARB */ + { 22413, 0x00008B80 }, /* GL_OBJECT_DELETE_STATUS_ARB */ + { 22441, 0x00008B84 }, /* GL_OBJECT_INFO_LOG_LENGTH_ARB */ + { 22471, 0x00002401 }, /* GL_OBJECT_LINEAR */ + { 22488, 0x00008B82 }, /* GL_OBJECT_LINK_STATUS_ARB */ + { 22514, 0x00002501 }, /* GL_OBJECT_PLANE */ + { 22530, 0x00008B88 }, /* GL_OBJECT_SHADER_SOURCE_LENGTH_ARB */ + { 22565, 0x00008B4F }, /* GL_OBJECT_SUBTYPE_ARB */ + { 22587, 0x00009112 }, /* GL_OBJECT_TYPE */ + { 22602, 0x00008B4E }, /* GL_OBJECT_TYPE_ARB */ + { 22621, 0x00008B83 }, /* GL_OBJECT_VALIDATE_STATUS_ARB */ + { 22651, 0x00008165 }, /* GL_OCCLUSION_TEST_HP */ + { 22672, 0x00008166 }, /* GL_OCCLUSION_TEST_RESULT_HP */ + { 22700, 0x00000001 }, /* GL_ONE */ + { 22707, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA */ + { 22735, 0x00008004 }, /* GL_ONE_MINUS_CONSTANT_ALPHA_EXT */ + { 22767, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR */ + { 22795, 0x00008002 }, /* GL_ONE_MINUS_CONSTANT_COLOR_EXT */ + { 22827, 0x00000305 }, /* GL_ONE_MINUS_DST_ALPHA */ + { 22850, 0x00000307 }, /* GL_ONE_MINUS_DST_COLOR */ + { 22873, 0x00000303 }, /* GL_ONE_MINUS_SRC_ALPHA */ + { 22896, 0x00000301 }, /* GL_ONE_MINUS_SRC_COLOR */ + { 22919, 0x00008598 }, /* GL_OPERAND0_ALPHA */ + { 22937, 0x00008598 }, /* GL_OPERAND0_ALPHA_ARB */ + { 22959, 0x00008598 }, /* GL_OPERAND0_ALPHA_EXT */ + { 22981, 0x00008590 }, /* GL_OPERAND0_RGB */ + { 22997, 0x00008590 }, /* GL_OPERAND0_RGB_ARB */ + { 23017, 0x00008590 }, /* GL_OPERAND0_RGB_EXT */ + { 23037, 0x00008599 }, /* GL_OPERAND1_ALPHA */ + { 23055, 0x00008599 }, /* GL_OPERAND1_ALPHA_ARB */ + { 23077, 0x00008599 }, /* GL_OPERAND1_ALPHA_EXT */ + { 23099, 0x00008591 }, /* GL_OPERAND1_RGB */ + { 23115, 0x00008591 }, /* GL_OPERAND1_RGB_ARB */ + { 23135, 0x00008591 }, /* GL_OPERAND1_RGB_EXT */ + { 23155, 0x0000859A }, /* GL_OPERAND2_ALPHA */ + { 23173, 0x0000859A }, /* GL_OPERAND2_ALPHA_ARB */ + { 23195, 0x0000859A }, /* GL_OPERAND2_ALPHA_EXT */ + { 23217, 0x00008592 }, /* GL_OPERAND2_RGB */ + { 23233, 0x00008592 }, /* GL_OPERAND2_RGB_ARB */ + { 23253, 0x00008592 }, /* GL_OPERAND2_RGB_EXT */ + { 23273, 0x0000859B }, /* GL_OPERAND3_ALPHA_NV */ + { 23294, 0x00008593 }, /* GL_OPERAND3_RGB_NV */ + { 23313, 0x00001507 }, /* GL_OR */ + { 23319, 0x00000A01 }, /* GL_ORDER */ + { 23328, 0x0000150D }, /* GL_OR_INVERTED */ + { 23343, 0x0000150B }, /* GL_OR_REVERSE */ + { 23357, 0x00000505 }, /* GL_OUT_OF_MEMORY */ + { 23374, 0x00000D05 }, /* GL_PACK_ALIGNMENT */ + { 23392, 0x0000806C }, /* GL_PACK_IMAGE_HEIGHT */ + { 23413, 0x00008758 }, /* GL_PACK_INVERT_MESA */ + { 23433, 0x00000D01 }, /* GL_PACK_LSB_FIRST */ + { 23451, 0x00000D02 }, /* GL_PACK_ROW_LENGTH */ + { 23470, 0x0000806B }, /* GL_PACK_SKIP_IMAGES */ + { 23490, 0x00000D04 }, /* GL_PACK_SKIP_PIXELS */ + { 23510, 0x00000D03 }, /* GL_PACK_SKIP_ROWS */ + { 23528, 0x00000D00 }, /* GL_PACK_SWAP_BYTES */ + { 23547, 0x00008B92 }, /* GL_PALETTE4_R5_G6_B5_OES */ + { 23572, 0x00008B94 }, /* GL_PALETTE4_RGB5_A1_OES */ + { 23596, 0x00008B90 }, /* GL_PALETTE4_RGB8_OES */ + { 23617, 0x00008B93 }, /* GL_PALETTE4_RGBA4_OES */ + { 23639, 0x00008B91 }, /* GL_PALETTE4_RGBA8_OES */ + { 23661, 0x00008B97 }, /* GL_PALETTE8_R5_G6_B5_OES */ + { 23686, 0x00008B99 }, /* GL_PALETTE8_RGB5_A1_OES */ + { 23710, 0x00008B95 }, /* GL_PALETTE8_RGB8_OES */ + { 23731, 0x00008B98 }, /* GL_PALETTE8_RGBA4_OES */ + { 23753, 0x00008B96 }, /* GL_PALETTE8_RGBA8_OES */ + { 23775, 0x00000700 }, /* GL_PASS_THROUGH_TOKEN */ + { 23797, 0x00000C50 }, /* GL_PERSPECTIVE_CORRECTION_HINT */ + { 23828, 0x00000C79 }, /* GL_PIXEL_MAP_A_TO_A */ + { 23848, 0x00000CB9 }, /* GL_PIXEL_MAP_A_TO_A_SIZE */ + { 23873, 0x00000C78 }, /* GL_PIXEL_MAP_B_TO_B */ + { 23893, 0x00000CB8 }, /* GL_PIXEL_MAP_B_TO_B_SIZE */ + { 23918, 0x00000C77 }, /* GL_PIXEL_MAP_G_TO_G */ + { 23938, 0x00000CB7 }, /* GL_PIXEL_MAP_G_TO_G_SIZE */ + { 23963, 0x00000C75 }, /* GL_PIXEL_MAP_I_TO_A */ + { 23983, 0x00000CB5 }, /* GL_PIXEL_MAP_I_TO_A_SIZE */ + { 24008, 0x00000C74 }, /* GL_PIXEL_MAP_I_TO_B */ + { 24028, 0x00000CB4 }, /* GL_PIXEL_MAP_I_TO_B_SIZE */ + { 24053, 0x00000C73 }, /* GL_PIXEL_MAP_I_TO_G */ + { 24073, 0x00000CB3 }, /* GL_PIXEL_MAP_I_TO_G_SIZE */ + { 24098, 0x00000C70 }, /* GL_PIXEL_MAP_I_TO_I */ + { 24118, 0x00000CB0 }, /* GL_PIXEL_MAP_I_TO_I_SIZE */ + { 24143, 0x00000C72 }, /* GL_PIXEL_MAP_I_TO_R */ + { 24163, 0x00000CB2 }, /* GL_PIXEL_MAP_I_TO_R_SIZE */ + { 24188, 0x00000C76 }, /* GL_PIXEL_MAP_R_TO_R */ + { 24208, 0x00000CB6 }, /* GL_PIXEL_MAP_R_TO_R_SIZE */ + { 24233, 0x00000C71 }, /* GL_PIXEL_MAP_S_TO_S */ + { 24253, 0x00000CB1 }, /* GL_PIXEL_MAP_S_TO_S_SIZE */ + { 24278, 0x00000020 }, /* GL_PIXEL_MODE_BIT */ + { 24296, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER */ + { 24317, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING */ + { 24346, 0x000088ED }, /* GL_PIXEL_PACK_BUFFER_BINDING_EXT */ + { 24379, 0x000088EB }, /* GL_PIXEL_PACK_BUFFER_EXT */ + { 24404, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER */ + { 24427, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ + { 24458, 0x000088EF }, /* GL_PIXEL_UNPACK_BUFFER_BINDING_EXT */ + { 24493, 0x000088EC }, /* GL_PIXEL_UNPACK_BUFFER_EXT */ + { 24520, 0x00001B00 }, /* GL_POINT */ + { 24529, 0x00000000 }, /* GL_POINTS */ + { 24539, 0x00000002 }, /* GL_POINT_BIT */ + { 24552, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION */ + { 24582, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_ARB */ + { 24616, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_EXT */ + { 24650, 0x00008129 }, /* GL_POINT_DISTANCE_ATTENUATION_SGIS */ + { 24685, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE */ + { 24714, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_ARB */ + { 24747, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_EXT */ + { 24780, 0x00008128 }, /* GL_POINT_FADE_THRESHOLD_SIZE_SGIS */ + { 24814, 0x00000B11 }, /* GL_POINT_SIZE */ + { 24828, 0x00000B13 }, /* GL_POINT_SIZE_GRANULARITY */ + { 24854, 0x00008127 }, /* GL_POINT_SIZE_MAX */ + { 24872, 0x00008127 }, /* GL_POINT_SIZE_MAX_ARB */ + { 24894, 0x00008127 }, /* GL_POINT_SIZE_MAX_EXT */ + { 24916, 0x00008127 }, /* GL_POINT_SIZE_MAX_SGIS */ + { 24939, 0x00008126 }, /* GL_POINT_SIZE_MIN */ + { 24957, 0x00008126 }, /* GL_POINT_SIZE_MIN_ARB */ + { 24979, 0x00008126 }, /* GL_POINT_SIZE_MIN_EXT */ + { 25001, 0x00008126 }, /* GL_POINT_SIZE_MIN_SGIS */ + { 25024, 0x00000B12 }, /* GL_POINT_SIZE_RANGE */ + { 25044, 0x00000B10 }, /* GL_POINT_SMOOTH */ + { 25060, 0x00000C51 }, /* GL_POINT_SMOOTH_HINT */ + { 25081, 0x00008861 }, /* GL_POINT_SPRITE */ + { 25097, 0x00008861 }, /* GL_POINT_SPRITE_ARB */ + { 25117, 0x00008CA0 }, /* GL_POINT_SPRITE_COORD_ORIGIN */ + { 25146, 0x00008861 }, /* GL_POINT_SPRITE_NV */ + { 25165, 0x00008863 }, /* GL_POINT_SPRITE_R_MODE_NV */ + { 25191, 0x00000701 }, /* GL_POINT_TOKEN */ + { 25206, 0x00000009 }, /* GL_POLYGON */ + { 25217, 0x00000008 }, /* GL_POLYGON_BIT */ + { 25232, 0x00000B40 }, /* GL_POLYGON_MODE */ + { 25248, 0x00008039 }, /* GL_POLYGON_OFFSET_BIAS */ + { 25271, 0x00008038 }, /* GL_POLYGON_OFFSET_FACTOR */ + { 25296, 0x00008037 }, /* GL_POLYGON_OFFSET_FILL */ + { 25319, 0x00002A02 }, /* GL_POLYGON_OFFSET_LINE */ + { 25342, 0x00002A01 }, /* GL_POLYGON_OFFSET_POINT */ + { 25366, 0x00002A00 }, /* GL_POLYGON_OFFSET_UNITS */ + { 25390, 0x00000B41 }, /* GL_POLYGON_SMOOTH */ + { 25408, 0x00000C53 }, /* GL_POLYGON_SMOOTH_HINT */ + { 25431, 0x00000B42 }, /* GL_POLYGON_STIPPLE */ + { 25450, 0x00000010 }, /* GL_POLYGON_STIPPLE_BIT */ + { 25473, 0x00000703 }, /* GL_POLYGON_TOKEN */ + { 25490, 0x00001203 }, /* GL_POSITION */ + { 25502, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ + { 25534, 0x000080BB }, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI */ + { 25570, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ + { 25603, 0x000080B7 }, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI */ + { 25640, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ + { 25671, 0x000080BA }, /* GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI */ + { 25706, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ + { 25738, 0x000080B6 }, /* GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI */ + { 25774, 0x000080D2 }, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ + { 25807, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ + { 25839, 0x000080B9 }, /* GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI */ + { 25875, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ + { 25908, 0x000080B5 }, /* GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI */ + { 25945, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS */ + { 25975, 0x000080B8 }, /* GL_POST_COLOR_MATRIX_RED_BIAS_SGI */ + { 26009, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE */ + { 26040, 0x000080B4 }, /* GL_POST_COLOR_MATRIX_RED_SCALE_SGI */ + { 26075, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ + { 26106, 0x00008023 }, /* GL_POST_CONVOLUTION_ALPHA_BIAS_EXT */ + { 26141, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ + { 26173, 0x0000801F }, /* GL_POST_CONVOLUTION_ALPHA_SCALE_EXT */ + { 26209, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS */ + { 26239, 0x00008022 }, /* GL_POST_CONVOLUTION_BLUE_BIAS_EXT */ + { 26273, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE */ + { 26304, 0x0000801E }, /* GL_POST_CONVOLUTION_BLUE_SCALE_EXT */ + { 26339, 0x000080D1 }, /* GL_POST_CONVOLUTION_COLOR_TABLE */ + { 26371, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS */ + { 26402, 0x00008021 }, /* GL_POST_CONVOLUTION_GREEN_BIAS_EXT */ + { 26437, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE */ + { 26469, 0x0000801D }, /* GL_POST_CONVOLUTION_GREEN_SCALE_EXT */ + { 26505, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS */ + { 26534, 0x00008020 }, /* GL_POST_CONVOLUTION_RED_BIAS_EXT */ + { 26567, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE */ + { 26597, 0x0000801C }, /* GL_POST_CONVOLUTION_RED_SCALE_EXT */ + { 26631, 0x0000817B }, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ + { 26670, 0x00008179 }, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ + { 26703, 0x0000817C }, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ + { 26743, 0x0000817A }, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ + { 26777, 0x00008578 }, /* GL_PREVIOUS */ + { 26789, 0x00008578 }, /* GL_PREVIOUS_ARB */ + { 26805, 0x00008578 }, /* GL_PREVIOUS_EXT */ + { 26821, 0x00008577 }, /* GL_PRIMARY_COLOR */ + { 26838, 0x00008577 }, /* GL_PRIMARY_COLOR_ARB */ + { 26859, 0x00008577 }, /* GL_PRIMARY_COLOR_EXT */ + { 26880, 0x000088B0 }, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ + { 26913, 0x00008805 }, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ + { 26945, 0x000088AC }, /* GL_PROGRAM_ATTRIBS_ARB */ + { 26968, 0x00008677 }, /* GL_PROGRAM_BINDING_ARB */ + { 26991, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_ARB */ + { 27021, 0x0000864B }, /* GL_PROGRAM_ERROR_POSITION_NV */ + { 27050, 0x00008874 }, /* GL_PROGRAM_ERROR_STRING_ARB */ + { 27078, 0x00008876 }, /* GL_PROGRAM_FORMAT_ARB */ + { 27100, 0x00008875 }, /* GL_PROGRAM_FORMAT_ASCII_ARB */ + { 27128, 0x000088A0 }, /* GL_PROGRAM_INSTRUCTIONS_ARB */ + { 27156, 0x00008627 }, /* GL_PROGRAM_LENGTH_ARB */ + { 27178, 0x00008627 }, /* GL_PROGRAM_LENGTH_NV */ + { 27199, 0x000088B2 }, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + { 27239, 0x00008808 }, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + { 27278, 0x000088AE }, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ + { 27308, 0x000088A2 }, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + { 27343, 0x000088AA }, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ + { 27376, 0x000088A6 }, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ + { 27410, 0x0000880A }, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + { 27449, 0x00008809 }, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + { 27488, 0x00008B40 }, /* GL_PROGRAM_OBJECT_ARB */ + { 27510, 0x000088A8 }, /* GL_PROGRAM_PARAMETERS_ARB */ + { 27536, 0x00008644 }, /* GL_PROGRAM_PARAMETER_NV */ + { 27560, 0x00008647 }, /* GL_PROGRAM_RESIDENT_NV */ + { 27583, 0x00008628 }, /* GL_PROGRAM_STRING_ARB */ + { 27605, 0x00008628 }, /* GL_PROGRAM_STRING_NV */ + { 27626, 0x00008646 }, /* GL_PROGRAM_TARGET_NV */ + { 27647, 0x000088A4 }, /* GL_PROGRAM_TEMPORARIES_ARB */ + { 27674, 0x00008807 }, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ + { 27706, 0x00008806 }, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ + { 27738, 0x000088B6 }, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ + { 27773, 0x00001701 }, /* GL_PROJECTION */ + { 27787, 0x00000BA7 }, /* GL_PROJECTION_MATRIX */ + { 27808, 0x00000BA4 }, /* GL_PROJECTION_STACK_DEPTH */ + { 27834, 0x00008E4F }, /* GL_PROVOKING_VERTEX */ + { 27854, 0x00008E4F }, /* GL_PROVOKING_VERTEX_EXT */ + { 27878, 0x000080D3 }, /* GL_PROXY_COLOR_TABLE */ + { 27899, 0x00008025 }, /* GL_PROXY_HISTOGRAM */ + { 27918, 0x00008025 }, /* GL_PROXY_HISTOGRAM_EXT */ + { 27941, 0x000080D5 }, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ + { 27980, 0x000080D4 }, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ + { 28018, 0x00008063 }, /* GL_PROXY_TEXTURE_1D */ + { 28038, 0x00008C19 }, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ + { 28068, 0x00008063 }, /* GL_PROXY_TEXTURE_1D_EXT */ + { 28092, 0x00008064 }, /* GL_PROXY_TEXTURE_2D */ + { 28112, 0x00008C1B }, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ + { 28142, 0x00008064 }, /* GL_PROXY_TEXTURE_2D_EXT */ + { 28166, 0x00008070 }, /* GL_PROXY_TEXTURE_3D */ + { 28186, 0x000080BD }, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ + { 28219, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP */ + { 28245, 0x0000851B }, /* GL_PROXY_TEXTURE_CUBE_MAP_ARB */ + { 28275, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ + { 28306, 0x000084F7 }, /* GL_PROXY_TEXTURE_RECTANGLE_NV */ + { 28336, 0x00002003 }, /* GL_Q */ + { 28341, 0x00001209 }, /* GL_QUADRATIC_ATTENUATION */ + { 28366, 0x00000007 }, /* GL_QUADS */ + { 28375, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */ + { 28419, 0x00008E4C }, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT */ + { 28467, 0x00008614 }, /* GL_QUAD_MESH_SUN */ + { 28484, 0x00000008 }, /* GL_QUAD_STRIP */ + { 28498, 0x00008864 }, /* GL_QUERY_COUNTER_BITS */ + { 28520, 0x00008864 }, /* GL_QUERY_COUNTER_BITS_ARB */ + { 28546, 0x00008866 }, /* GL_QUERY_RESULT */ + { 28562, 0x00008866 }, /* GL_QUERY_RESULT_ARB */ + { 28582, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE */ + { 28608, 0x00008867 }, /* GL_QUERY_RESULT_AVAILABLE_ARB */ + { 28638, 0x00002002 }, /* GL_R */ + { 28643, 0x00002A10 }, /* GL_R3_G3_B2 */ + { 28655, 0x00019262 }, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ + { 28688, 0x00000C02 }, /* GL_READ_BUFFER */ + { 28703, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER */ + { 28723, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING */ + { 28751, 0x00008CAA }, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ + { 28783, 0x00008CA8 }, /* GL_READ_FRAMEBUFFER_EXT */ + { 28807, 0x000088B8 }, /* GL_READ_ONLY */ + { 28820, 0x000088B8 }, /* GL_READ_ONLY_ARB */ + { 28837, 0x000088BA }, /* GL_READ_WRITE */ + { 28851, 0x000088BA }, /* GL_READ_WRITE_ARB */ + { 28869, 0x00001903 }, /* GL_RED */ + { 28876, 0x00008016 }, /* GL_REDUCE */ + { 28886, 0x00008016 }, /* GL_REDUCE_EXT */ + { 28900, 0x00000D15 }, /* GL_RED_BIAS */ + { 28912, 0x00000D52 }, /* GL_RED_BITS */ + { 28924, 0x00000D14 }, /* GL_RED_SCALE */ + { 28937, 0x00008512 }, /* GL_REFLECTION_MAP */ + { 28955, 0x00008512 }, /* GL_REFLECTION_MAP_ARB */ + { 28977, 0x00008512 }, /* GL_REFLECTION_MAP_NV */ + { 28998, 0x00001C00 }, /* GL_RENDER */ + { 29008, 0x00008D41 }, /* GL_RENDERBUFFER */ + { 29024, 0x00008D53 }, /* GL_RENDERBUFFER_ALPHA_SIZE */ + { 29051, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING */ + { 29075, 0x00008CA7 }, /* GL_RENDERBUFFER_BINDING_EXT */ + { 29103, 0x00008D52 }, /* GL_RENDERBUFFER_BLUE_SIZE */ + { 29129, 0x00008D54 }, /* GL_RENDERBUFFER_DEPTH_SIZE */ + { 29156, 0x00008D41 }, /* GL_RENDERBUFFER_EXT */ + { 29176, 0x00008D51 }, /* GL_RENDERBUFFER_GREEN_SIZE */ + { 29203, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT */ + { 29226, 0x00008D43 }, /* GL_RENDERBUFFER_HEIGHT_EXT */ + { 29253, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ + { 29285, 0x00008D44 }, /* GL_RENDERBUFFER_INTERNAL_FORMAT_EXT */ + { 29321, 0x00008D50 }, /* GL_RENDERBUFFER_RED_SIZE */ + { 29346, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES */ + { 29370, 0x00008CAB }, /* GL_RENDERBUFFER_SAMPLES_EXT */ + { 29398, 0x00008D55 }, /* GL_RENDERBUFFER_STENCIL_SIZE */ + { 29427, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH */ + { 29449, 0x00008D42 }, /* GL_RENDERBUFFER_WIDTH_EXT */ + { 29475, 0x00001F01 }, /* GL_RENDERER */ + { 29487, 0x00000C40 }, /* GL_RENDER_MODE */ + { 29502, 0x00002901 }, /* GL_REPEAT */ + { 29512, 0x00001E01 }, /* GL_REPLACE */ + { 29523, 0x00008062 }, /* GL_REPLACE_EXT */ + { 29538, 0x00008153 }, /* GL_REPLICATE_BORDER_HP */ + { 29561, 0x0000803A }, /* GL_RESCALE_NORMAL */ + { 29579, 0x0000803A }, /* GL_RESCALE_NORMAL_EXT */ + { 29601, 0x00000102 }, /* GL_RETURN */ + { 29611, 0x00001907 }, /* GL_RGB */ + { 29618, 0x00008052 }, /* GL_RGB10 */ + { 29627, 0x00008059 }, /* GL_RGB10_A2 */ + { 29639, 0x00008059 }, /* GL_RGB10_A2_EXT */ + { 29655, 0x00008052 }, /* GL_RGB10_EXT */ + { 29668, 0x00008053 }, /* GL_RGB12 */ + { 29677, 0x00008053 }, /* GL_RGB12_EXT */ + { 29690, 0x00008054 }, /* GL_RGB16 */ + { 29699, 0x00008054 }, /* GL_RGB16_EXT */ + { 29712, 0x0000804E }, /* GL_RGB2_EXT */ + { 29724, 0x0000804F }, /* GL_RGB4 */ + { 29732, 0x0000804F }, /* GL_RGB4_EXT */ + { 29744, 0x000083A1 }, /* GL_RGB4_S3TC */ + { 29757, 0x00008050 }, /* GL_RGB5 */ + { 29765, 0x00008057 }, /* GL_RGB5_A1 */ + { 29776, 0x00008057 }, /* GL_RGB5_A1_EXT */ + { 29791, 0x00008050 }, /* GL_RGB5_EXT */ + { 29803, 0x00008051 }, /* GL_RGB8 */ + { 29811, 0x00008051 }, /* GL_RGB8_EXT */ + { 29823, 0x00001908 }, /* GL_RGBA */ + { 29831, 0x0000805A }, /* GL_RGBA12 */ + { 29841, 0x0000805A }, /* GL_RGBA12_EXT */ + { 29855, 0x0000805B }, /* GL_RGBA16 */ + { 29865, 0x0000805B }, /* GL_RGBA16_EXT */ + { 29879, 0x00008055 }, /* GL_RGBA2 */ + { 29888, 0x00008055 }, /* GL_RGBA2_EXT */ + { 29901, 0x00008056 }, /* GL_RGBA4 */ + { 29910, 0x000083A5 }, /* GL_RGBA4_DXT5_S3TC */ + { 29929, 0x00008056 }, /* GL_RGBA4_EXT */ + { 29942, 0x000083A3 }, /* GL_RGBA4_S3TC */ + { 29956, 0x00008058 }, /* GL_RGBA8 */ + { 29965, 0x00008058 }, /* GL_RGBA8_EXT */ + { 29978, 0x00008F97 }, /* GL_RGBA8_SNORM */ + { 29993, 0x000083A4 }, /* GL_RGBA_DXT5_S3TC */ + { 30011, 0x00000C31 }, /* GL_RGBA_MODE */ + { 30024, 0x000083A2 }, /* GL_RGBA_S3TC */ + { 30037, 0x00008F93 }, /* GL_RGBA_SNORM */ + { 30051, 0x000083A0 }, /* GL_RGB_S3TC */ + { 30063, 0x00008573 }, /* GL_RGB_SCALE */ + { 30076, 0x00008573 }, /* GL_RGB_SCALE_ARB */ + { 30093, 0x00008573 }, /* GL_RGB_SCALE_EXT */ + { 30110, 0x00000407 }, /* GL_RIGHT */ + { 30119, 0x00002000 }, /* GL_S */ + { 30124, 0x00008B5D }, /* GL_SAMPLER_1D */ + { 30138, 0x00008B61 }, /* GL_SAMPLER_1D_SHADOW */ + { 30159, 0x00008B5E }, /* GL_SAMPLER_2D */ + { 30173, 0x00008B62 }, /* GL_SAMPLER_2D_SHADOW */ + { 30194, 0x00008B5F }, /* GL_SAMPLER_3D */ + { 30208, 0x00008B60 }, /* GL_SAMPLER_CUBE */ + { 30224, 0x000080A9 }, /* GL_SAMPLES */ + { 30235, 0x000086B4 }, /* GL_SAMPLES_3DFX */ + { 30251, 0x000080A9 }, /* GL_SAMPLES_ARB */ + { 30266, 0x00008914 }, /* GL_SAMPLES_PASSED */ + { 30284, 0x00008914 }, /* GL_SAMPLES_PASSED_ARB */ + { 30306, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ + { 30334, 0x0000809E }, /* GL_SAMPLE_ALPHA_TO_COVERAGE_ARB */ + { 30366, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE */ + { 30389, 0x0000809F }, /* GL_SAMPLE_ALPHA_TO_ONE_ARB */ + { 30416, 0x000080A8 }, /* GL_SAMPLE_BUFFERS */ + { 30434, 0x000086B3 }, /* GL_SAMPLE_BUFFERS_3DFX */ + { 30457, 0x000080A8 }, /* GL_SAMPLE_BUFFERS_ARB */ + { 30479, 0x000080A0 }, /* GL_SAMPLE_COVERAGE */ + { 30498, 0x000080A0 }, /* GL_SAMPLE_COVERAGE_ARB */ + { 30521, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT */ + { 30547, 0x000080AB }, /* GL_SAMPLE_COVERAGE_INVERT_ARB */ + { 30577, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE */ + { 30602, 0x000080AA }, /* GL_SAMPLE_COVERAGE_VALUE_ARB */ + { 30631, 0x00080000 }, /* GL_SCISSOR_BIT */ + { 30646, 0x00000C10 }, /* GL_SCISSOR_BOX */ + { 30661, 0x00000C11 }, /* GL_SCISSOR_TEST */ + { 30677, 0x0000845E }, /* GL_SECONDARY_COLOR_ARRAY */ + { 30702, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ + { 30742, 0x0000889C }, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB */ + { 30786, 0x0000845D }, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ + { 30819, 0x0000845A }, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ + { 30849, 0x0000845C }, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ + { 30881, 0x0000845B }, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ + { 30911, 0x00001C02 }, /* GL_SELECT */ + { 30921, 0x00000DF3 }, /* GL_SELECTION_BUFFER_POINTER */ + { 30949, 0x00000DF4 }, /* GL_SELECTION_BUFFER_SIZE */ + { 30974, 0x00008012 }, /* GL_SEPARABLE_2D */ + { 30990, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR */ + { 31017, 0x000081FA }, /* GL_SEPARATE_SPECULAR_COLOR_EXT */ + { 31048, 0x0000150F }, /* GL_SET */ + { 31055, 0x00008B48 }, /* GL_SHADER_OBJECT_ARB */ + { 31076, 0x00008B88 }, /* GL_SHADER_SOURCE_LENGTH */ + { 31100, 0x00008B4F }, /* GL_SHADER_TYPE */ + { 31115, 0x00000B54 }, /* GL_SHADE_MODEL */ + { 31130, 0x00008B8C }, /* GL_SHADING_LANGUAGE_VERSION */ + { 31158, 0x000080BF }, /* GL_SHADOW_AMBIENT_SGIX */ + { 31181, 0x000081FB }, /* GL_SHARED_TEXTURE_PALETTE_EXT */ + { 31211, 0x00001601 }, /* GL_SHININESS */ + { 31224, 0x00001402 }, /* GL_SHORT */ + { 31233, 0x00009119 }, /* GL_SIGNALED */ + { 31245, 0x00008F9C }, /* GL_SIGNED_NORMALIZED */ + { 31266, 0x000081F9 }, /* GL_SINGLE_COLOR */ + { 31282, 0x000081F9 }, /* GL_SINGLE_COLOR_EXT */ + { 31302, 0x000085CC }, /* GL_SLICE_ACCUM_SUN */ + { 31321, 0x00008C46 }, /* GL_SLUMINANCE */ + { 31335, 0x00008C47 }, /* GL_SLUMINANCE8 */ + { 31350, 0x00008C45 }, /* GL_SLUMINANCE8_ALPHA8 */ + { 31372, 0x00008C44 }, /* GL_SLUMINANCE_ALPHA */ + { 31392, 0x00001D01 }, /* GL_SMOOTH */ + { 31402, 0x00000B23 }, /* GL_SMOOTH_LINE_WIDTH_GRANULARITY */ + { 31435, 0x00000B22 }, /* GL_SMOOTH_LINE_WIDTH_RANGE */ + { 31462, 0x00000B13 }, /* GL_SMOOTH_POINT_SIZE_GRANULARITY */ + { 31495, 0x00000B12 }, /* GL_SMOOTH_POINT_SIZE_RANGE */ + { 31522, 0x00008588 }, /* GL_SOURCE0_ALPHA */ + { 31539, 0x00008588 }, /* GL_SOURCE0_ALPHA_ARB */ + { 31560, 0x00008588 }, /* GL_SOURCE0_ALPHA_EXT */ + { 31581, 0x00008580 }, /* GL_SOURCE0_RGB */ + { 31596, 0x00008580 }, /* GL_SOURCE0_RGB_ARB */ + { 31615, 0x00008580 }, /* GL_SOURCE0_RGB_EXT */ + { 31634, 0x00008589 }, /* GL_SOURCE1_ALPHA */ + { 31651, 0x00008589 }, /* GL_SOURCE1_ALPHA_ARB */ + { 31672, 0x00008589 }, /* GL_SOURCE1_ALPHA_EXT */ + { 31693, 0x00008581 }, /* GL_SOURCE1_RGB */ + { 31708, 0x00008581 }, /* GL_SOURCE1_RGB_ARB */ + { 31727, 0x00008581 }, /* GL_SOURCE1_RGB_EXT */ + { 31746, 0x0000858A }, /* GL_SOURCE2_ALPHA */ + { 31763, 0x0000858A }, /* GL_SOURCE2_ALPHA_ARB */ + { 31784, 0x0000858A }, /* GL_SOURCE2_ALPHA_EXT */ + { 31805, 0x00008582 }, /* GL_SOURCE2_RGB */ + { 31820, 0x00008582 }, /* GL_SOURCE2_RGB_ARB */ + { 31839, 0x00008582 }, /* GL_SOURCE2_RGB_EXT */ + { 31858, 0x0000858B }, /* GL_SOURCE3_ALPHA_NV */ + { 31878, 0x00008583 }, /* GL_SOURCE3_RGB_NV */ + { 31896, 0x00001202 }, /* GL_SPECULAR */ + { 31908, 0x00002402 }, /* GL_SPHERE_MAP */ + { 31922, 0x00001206 }, /* GL_SPOT_CUTOFF */ + { 31937, 0x00001204 }, /* GL_SPOT_DIRECTION */ + { 31955, 0x00001205 }, /* GL_SPOT_EXPONENT */ + { 31972, 0x00008588 }, /* GL_SRC0_ALPHA */ + { 31986, 0x00008580 }, /* GL_SRC0_RGB */ + { 31998, 0x00008589 }, /* GL_SRC1_ALPHA */ + { 32012, 0x00008581 }, /* GL_SRC1_RGB */ + { 32024, 0x0000858A }, /* GL_SRC2_ALPHA */ + { 32038, 0x00008582 }, /* GL_SRC2_RGB */ + { 32050, 0x00000302 }, /* GL_SRC_ALPHA */ + { 32063, 0x00000308 }, /* GL_SRC_ALPHA_SATURATE */ + { 32085, 0x00000300 }, /* GL_SRC_COLOR */ + { 32098, 0x00008C40 }, /* GL_SRGB */ + { 32106, 0x00008C41 }, /* GL_SRGB8 */ + { 32115, 0x00008C43 }, /* GL_SRGB8_ALPHA8 */ + { 32131, 0x00008C42 }, /* GL_SRGB_ALPHA */ + { 32145, 0x00000503 }, /* GL_STACK_OVERFLOW */ + { 32163, 0x00000504 }, /* GL_STACK_UNDERFLOW */ + { 32182, 0x000088E6 }, /* GL_STATIC_COPY */ + { 32197, 0x000088E6 }, /* GL_STATIC_COPY_ARB */ + { 32216, 0x000088E4 }, /* GL_STATIC_DRAW */ + { 32231, 0x000088E4 }, /* GL_STATIC_DRAW_ARB */ + { 32250, 0x000088E5 }, /* GL_STATIC_READ */ + { 32265, 0x000088E5 }, /* GL_STATIC_READ_ARB */ + { 32284, 0x00001802 }, /* GL_STENCIL */ + { 32295, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT */ + { 32317, 0x00008D20 }, /* GL_STENCIL_ATTACHMENT_EXT */ + { 32343, 0x00008801 }, /* GL_STENCIL_BACK_FAIL */ + { 32364, 0x00008801 }, /* GL_STENCIL_BACK_FAIL_ATI */ + { 32389, 0x00008800 }, /* GL_STENCIL_BACK_FUNC */ + { 32410, 0x00008800 }, /* GL_STENCIL_BACK_FUNC_ATI */ + { 32435, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ + { 32467, 0x00008802 }, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI */ + { 32503, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ + { 32535, 0x00008803 }, /* GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI */ + { 32571, 0x00008CA3 }, /* GL_STENCIL_BACK_REF */ + { 32591, 0x00008CA4 }, /* GL_STENCIL_BACK_VALUE_MASK */ + { 32618, 0x00008CA5 }, /* GL_STENCIL_BACK_WRITEMASK */ + { 32644, 0x00000D57 }, /* GL_STENCIL_BITS */ + { 32660, 0x00000400 }, /* GL_STENCIL_BUFFER_BIT */ + { 32682, 0x00000B91 }, /* GL_STENCIL_CLEAR_VALUE */ + { 32705, 0x00000B94 }, /* GL_STENCIL_FAIL */ + { 32721, 0x00000B92 }, /* GL_STENCIL_FUNC */ + { 32737, 0x00001901 }, /* GL_STENCIL_INDEX */ + { 32754, 0x00008D46 }, /* GL_STENCIL_INDEX1 */ + { 32772, 0x00008D49 }, /* GL_STENCIL_INDEX16 */ + { 32791, 0x00008D49 }, /* GL_STENCIL_INDEX16_EXT */ + { 32814, 0x00008D46 }, /* GL_STENCIL_INDEX1_EXT */ + { 32836, 0x00008D47 }, /* GL_STENCIL_INDEX4 */ + { 32854, 0x00008D47 }, /* GL_STENCIL_INDEX4_EXT */ + { 32876, 0x00008D48 }, /* GL_STENCIL_INDEX8 */ + { 32894, 0x00008D48 }, /* GL_STENCIL_INDEX8_EXT */ + { 32916, 0x00008D45 }, /* GL_STENCIL_INDEX_EXT */ + { 32937, 0x00000B95 }, /* GL_STENCIL_PASS_DEPTH_FAIL */ + { 32964, 0x00000B96 }, /* GL_STENCIL_PASS_DEPTH_PASS */ + { 32991, 0x00000B97 }, /* GL_STENCIL_REF */ + { 33006, 0x00000B90 }, /* GL_STENCIL_TEST */ + { 33022, 0x00008910 }, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ + { 33051, 0x00000B93 }, /* GL_STENCIL_VALUE_MASK */ + { 33073, 0x00000B98 }, /* GL_STENCIL_WRITEMASK */ + { 33094, 0x00000C33 }, /* GL_STEREO */ + { 33104, 0x000085BE }, /* GL_STORAGE_CACHED_APPLE */ + { 33128, 0x000085BD }, /* GL_STORAGE_PRIVATE_APPLE */ + { 33153, 0x000085BF }, /* GL_STORAGE_SHARED_APPLE */ + { 33177, 0x000088E2 }, /* GL_STREAM_COPY */ + { 33192, 0x000088E2 }, /* GL_STREAM_COPY_ARB */ + { 33211, 0x000088E0 }, /* GL_STREAM_DRAW */ + { 33226, 0x000088E0 }, /* GL_STREAM_DRAW_ARB */ + { 33245, 0x000088E1 }, /* GL_STREAM_READ */ + { 33260, 0x000088E1 }, /* GL_STREAM_READ_ARB */ + { 33279, 0x00000D50 }, /* GL_SUBPIXEL_BITS */ + { 33296, 0x000084E7 }, /* GL_SUBTRACT */ + { 33308, 0x000084E7 }, /* GL_SUBTRACT_ARB */ + { 33324, 0x00009113 }, /* GL_SYNC_CONDITION */ + { 33342, 0x00009116 }, /* GL_SYNC_FENCE */ + { 33356, 0x00009115 }, /* GL_SYNC_FLAGS */ + { 33370, 0x00000001 }, /* GL_SYNC_FLUSH_COMMANDS_BIT */ + { 33397, 0x00009117 }, /* GL_SYNC_GPU_COMMANDS_COMPLETE */ + { 33427, 0x00009114 }, /* GL_SYNC_STATUS */ + { 33442, 0x00002001 }, /* GL_T */ + { 33447, 0x00002A2A }, /* GL_T2F_C3F_V3F */ + { 33462, 0x00002A2C }, /* GL_T2F_C4F_N3F_V3F */ + { 33481, 0x00002A29 }, /* GL_T2F_C4UB_V3F */ + { 33497, 0x00002A2B }, /* GL_T2F_N3F_V3F */ + { 33512, 0x00002A27 }, /* GL_T2F_V3F */ + { 33523, 0x00002A2D }, /* GL_T4F_C4F_N3F_V4F */ + { 33542, 0x00002A28 }, /* GL_T4F_V4F */ + { 33553, 0x00008031 }, /* GL_TABLE_TOO_LARGE_EXT */ + { 33576, 0x00001702 }, /* GL_TEXTURE */ + { 33587, 0x000084C0 }, /* GL_TEXTURE0 */ + { 33599, 0x000084C0 }, /* GL_TEXTURE0_ARB */ + { 33615, 0x000084C1 }, /* GL_TEXTURE1 */ + { 33627, 0x000084CA }, /* GL_TEXTURE10 */ + { 33640, 0x000084CA }, /* GL_TEXTURE10_ARB */ + { 33657, 0x000084CB }, /* GL_TEXTURE11 */ + { 33670, 0x000084CB }, /* GL_TEXTURE11_ARB */ + { 33687, 0x000084CC }, /* GL_TEXTURE12 */ + { 33700, 0x000084CC }, /* GL_TEXTURE12_ARB */ + { 33717, 0x000084CD }, /* GL_TEXTURE13 */ + { 33730, 0x000084CD }, /* GL_TEXTURE13_ARB */ + { 33747, 0x000084CE }, /* GL_TEXTURE14 */ + { 33760, 0x000084CE }, /* GL_TEXTURE14_ARB */ + { 33777, 0x000084CF }, /* GL_TEXTURE15 */ + { 33790, 0x000084CF }, /* GL_TEXTURE15_ARB */ + { 33807, 0x000084D0 }, /* GL_TEXTURE16 */ + { 33820, 0x000084D0 }, /* GL_TEXTURE16_ARB */ + { 33837, 0x000084D1 }, /* GL_TEXTURE17 */ + { 33850, 0x000084D1 }, /* GL_TEXTURE17_ARB */ + { 33867, 0x000084D2 }, /* GL_TEXTURE18 */ + { 33880, 0x000084D2 }, /* GL_TEXTURE18_ARB */ + { 33897, 0x000084D3 }, /* GL_TEXTURE19 */ + { 33910, 0x000084D3 }, /* GL_TEXTURE19_ARB */ + { 33927, 0x000084C1 }, /* GL_TEXTURE1_ARB */ + { 33943, 0x000084C2 }, /* GL_TEXTURE2 */ + { 33955, 0x000084D4 }, /* GL_TEXTURE20 */ + { 33968, 0x000084D4 }, /* GL_TEXTURE20_ARB */ + { 33985, 0x000084D5 }, /* GL_TEXTURE21 */ + { 33998, 0x000084D5 }, /* GL_TEXTURE21_ARB */ + { 34015, 0x000084D6 }, /* GL_TEXTURE22 */ + { 34028, 0x000084D6 }, /* GL_TEXTURE22_ARB */ + { 34045, 0x000084D7 }, /* GL_TEXTURE23 */ + { 34058, 0x000084D7 }, /* GL_TEXTURE23_ARB */ + { 34075, 0x000084D8 }, /* GL_TEXTURE24 */ + { 34088, 0x000084D8 }, /* GL_TEXTURE24_ARB */ + { 34105, 0x000084D9 }, /* GL_TEXTURE25 */ + { 34118, 0x000084D9 }, /* GL_TEXTURE25_ARB */ + { 34135, 0x000084DA }, /* GL_TEXTURE26 */ + { 34148, 0x000084DA }, /* GL_TEXTURE26_ARB */ + { 34165, 0x000084DB }, /* GL_TEXTURE27 */ + { 34178, 0x000084DB }, /* GL_TEXTURE27_ARB */ + { 34195, 0x000084DC }, /* GL_TEXTURE28 */ + { 34208, 0x000084DC }, /* GL_TEXTURE28_ARB */ + { 34225, 0x000084DD }, /* GL_TEXTURE29 */ + { 34238, 0x000084DD }, /* GL_TEXTURE29_ARB */ + { 34255, 0x000084C2 }, /* GL_TEXTURE2_ARB */ + { 34271, 0x000084C3 }, /* GL_TEXTURE3 */ + { 34283, 0x000084DE }, /* GL_TEXTURE30 */ + { 34296, 0x000084DE }, /* GL_TEXTURE30_ARB */ + { 34313, 0x000084DF }, /* GL_TEXTURE31 */ + { 34326, 0x000084DF }, /* GL_TEXTURE31_ARB */ + { 34343, 0x000084C3 }, /* GL_TEXTURE3_ARB */ + { 34359, 0x000084C4 }, /* GL_TEXTURE4 */ + { 34371, 0x000084C4 }, /* GL_TEXTURE4_ARB */ + { 34387, 0x000084C5 }, /* GL_TEXTURE5 */ + { 34399, 0x000084C5 }, /* GL_TEXTURE5_ARB */ + { 34415, 0x000084C6 }, /* GL_TEXTURE6 */ + { 34427, 0x000084C6 }, /* GL_TEXTURE6_ARB */ + { 34443, 0x000084C7 }, /* GL_TEXTURE7 */ + { 34455, 0x000084C7 }, /* GL_TEXTURE7_ARB */ + { 34471, 0x000084C8 }, /* GL_TEXTURE8 */ + { 34483, 0x000084C8 }, /* GL_TEXTURE8_ARB */ + { 34499, 0x000084C9 }, /* GL_TEXTURE9 */ + { 34511, 0x000084C9 }, /* GL_TEXTURE9_ARB */ + { 34527, 0x00000DE0 }, /* GL_TEXTURE_1D */ + { 34541, 0x00008C18 }, /* GL_TEXTURE_1D_ARRAY_EXT */ + { 34565, 0x00000DE1 }, /* GL_TEXTURE_2D */ + { 34579, 0x00008C1A }, /* GL_TEXTURE_2D_ARRAY_EXT */ + { 34603, 0x0000806F }, /* GL_TEXTURE_3D */ + { 34617, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE */ + { 34639, 0x0000805F }, /* GL_TEXTURE_ALPHA_SIZE_EXT */ + { 34665, 0x0000813C }, /* GL_TEXTURE_BASE_LEVEL */ + { 34687, 0x00008068 }, /* GL_TEXTURE_BINDING_1D */ + { 34709, 0x00008C1C }, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ + { 34741, 0x00008069 }, /* GL_TEXTURE_BINDING_2D */ + { 34763, 0x00008C1D }, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ + { 34795, 0x0000806A }, /* GL_TEXTURE_BINDING_3D */ + { 34817, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP */ + { 34845, 0x00008514 }, /* GL_TEXTURE_BINDING_CUBE_MAP_ARB */ + { 34877, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ + { 34910, 0x000084F6 }, /* GL_TEXTURE_BINDING_RECTANGLE_NV */ + { 34942, 0x00040000 }, /* GL_TEXTURE_BIT */ + { 34957, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE */ + { 34978, 0x0000805E }, /* GL_TEXTURE_BLUE_SIZE_EXT */ + { 35003, 0x00001005 }, /* GL_TEXTURE_BORDER */ + { 35021, 0x00001004 }, /* GL_TEXTURE_BORDER_COLOR */ + { 35045, 0x00008171 }, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ + { 35076, 0x00008176 }, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ + { 35106, 0x00008172 }, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ + { 35136, 0x00008175 }, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ + { 35171, 0x00008173 }, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ + { 35202, 0x00008174 }, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + { 35240, 0x000080BC }, /* GL_TEXTURE_COLOR_TABLE_SGI */ + { 35267, 0x000081EF }, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ + { 35299, 0x000080BF }, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + { 35333, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC */ + { 35357, 0x0000884D }, /* GL_TEXTURE_COMPARE_FUNC_ARB */ + { 35385, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE */ + { 35409, 0x0000884C }, /* GL_TEXTURE_COMPARE_MODE_ARB */ + { 35437, 0x0000819B }, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ + { 35470, 0x0000819A }, /* GL_TEXTURE_COMPARE_SGIX */ + { 35494, 0x00001003 }, /* GL_TEXTURE_COMPONENTS */ + { 35516, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED */ + { 35538, 0x000086A1 }, /* GL_TEXTURE_COMPRESSED_ARB */ + { 35564, 0x000086A3 }, /* GL_TEXTURE_COMPRESSED_FORMATS_ARB */ + { 35598, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ + { 35631, 0x000086A0 }, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB */ + { 35668, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT */ + { 35696, 0x000084EF }, /* GL_TEXTURE_COMPRESSION_HINT_ARB */ + { 35728, 0x00008078 }, /* GL_TEXTURE_COORD_ARRAY */ + { 35751, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ + { 35789, 0x0000889A }, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB */ + { 35831, 0x00008092 }, /* GL_TEXTURE_COORD_ARRAY_POINTER */ + { 35862, 0x00008088 }, /* GL_TEXTURE_COORD_ARRAY_SIZE */ + { 35890, 0x0000808A }, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ + { 35920, 0x00008089 }, /* GL_TEXTURE_COORD_ARRAY_TYPE */ + { 35948, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP */ + { 35968, 0x00008513 }, /* GL_TEXTURE_CUBE_MAP_ARB */ + { 35992, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ + { 36023, 0x00008516 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB */ + { 36058, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ + { 36089, 0x00008518 }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB */ + { 36124, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ + { 36155, 0x0000851A }, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB */ + { 36190, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ + { 36221, 0x00008515 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB */ + { 36256, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ + { 36287, 0x00008517 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB */ + { 36322, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ + { 36353, 0x00008519 }, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB */ + { 36388, 0x000088F4 }, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */ + { 36417, 0x00008071 }, /* GL_TEXTURE_DEPTH */ + { 36434, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE */ + { 36456, 0x0000884A }, /* GL_TEXTURE_DEPTH_SIZE_ARB */ + { 36482, 0x00002300 }, /* GL_TEXTURE_ENV */ + { 36497, 0x00002201 }, /* GL_TEXTURE_ENV_COLOR */ + { 36518, 0x00002200 }, /* GL_TEXTURE_ENV_MODE */ + { 36538, 0x00008500 }, /* GL_TEXTURE_FILTER_CONTROL */ + { 36564, 0x00002500 }, /* GL_TEXTURE_GEN_MODE */ + { 36584, 0x00000C63 }, /* GL_TEXTURE_GEN_Q */ + { 36601, 0x00000C62 }, /* GL_TEXTURE_GEN_R */ + { 36618, 0x00000C60 }, /* GL_TEXTURE_GEN_S */ + { 36635, 0x00000C61 }, /* GL_TEXTURE_GEN_T */ + { 36652, 0x0000819D }, /* GL_TEXTURE_GEQUAL_R_SGIX */ + { 36677, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE */ + { 36699, 0x0000805D }, /* GL_TEXTURE_GREEN_SIZE_EXT */ + { 36725, 0x00001001 }, /* GL_TEXTURE_HEIGHT */ + { 36743, 0x000080ED }, /* GL_TEXTURE_INDEX_SIZE_EXT */ + { 36769, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE */ + { 36795, 0x00008061 }, /* GL_TEXTURE_INTENSITY_SIZE_EXT */ + { 36825, 0x00001003 }, /* GL_TEXTURE_INTERNAL_FORMAT */ + { 36852, 0x0000819C }, /* GL_TEXTURE_LEQUAL_R_SGIX */ + { 36877, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS */ + { 36897, 0x00008501 }, /* GL_TEXTURE_LOD_BIAS_EXT */ + { 36921, 0x00008190 }, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ + { 36948, 0x0000818E }, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ + { 36975, 0x0000818F }, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ + { 37002, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE */ + { 37028, 0x00008060 }, /* GL_TEXTURE_LUMINANCE_SIZE_EXT */ + { 37058, 0x00002800 }, /* GL_TEXTURE_MAG_FILTER */ + { 37080, 0x00000BA8 }, /* GL_TEXTURE_MATRIX */ + { 37098, 0x000084FE }, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ + { 37128, 0x0000836B }, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ + { 37156, 0x00008369 }, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ + { 37184, 0x0000836A }, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ + { 37212, 0x0000813D }, /* GL_TEXTURE_MAX_LEVEL */ + { 37233, 0x0000813B }, /* GL_TEXTURE_MAX_LOD */ + { 37252, 0x00002801 }, /* GL_TEXTURE_MIN_FILTER */ + { 37274, 0x0000813A }, /* GL_TEXTURE_MIN_LOD */ + { 37293, 0x00008066 }, /* GL_TEXTURE_PRIORITY */ + { 37313, 0x000085B7 }, /* GL_TEXTURE_RANGE_LENGTH_APPLE */ + { 37343, 0x000085B8 }, /* GL_TEXTURE_RANGE_POINTER_APPLE */ + { 37374, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_ARB */ + { 37399, 0x000084F5 }, /* GL_TEXTURE_RECTANGLE_NV */ + { 37423, 0x0000805C }, /* GL_TEXTURE_RED_SIZE */ + { 37443, 0x0000805C }, /* GL_TEXTURE_RED_SIZE_EXT */ + { 37467, 0x00008067 }, /* GL_TEXTURE_RESIDENT */ + { 37487, 0x00000BA5 }, /* GL_TEXTURE_STACK_DEPTH */ + { 37510, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE */ + { 37534, 0x000088F1 }, /* GL_TEXTURE_STENCIL_SIZE_EXT */ + { 37562, 0x000085BC }, /* GL_TEXTURE_STORAGE_HINT_APPLE */ + { 37592, 0x00008065 }, /* GL_TEXTURE_TOO_LARGE_EXT */ + { 37617, 0x0000888F }, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ + { 37651, 0x00001000 }, /* GL_TEXTURE_WIDTH */ + { 37668, 0x00008072 }, /* GL_TEXTURE_WRAP_R */ + { 37686, 0x00002802 }, /* GL_TEXTURE_WRAP_S */ + { 37704, 0x00002803 }, /* GL_TEXTURE_WRAP_T */ + { 37722, 0x0000911B }, /* GL_TIMEOUT_EXPIRED */ + { 37741, 0xFFFFFFFFFFFFFFFF }, /* GL_TIMEOUT_IGNORED */ + { 37760, 0x000088BF }, /* GL_TIME_ELAPSED_EXT */ + { 37780, 0x00008648 }, /* GL_TRACK_MATRIX_NV */ + { 37799, 0x00008649 }, /* GL_TRACK_MATRIX_TRANSFORM_NV */ + { 37828, 0x00001000 }, /* GL_TRANSFORM_BIT */ + { 37845, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX */ + { 37871, 0x000084E6 }, /* GL_TRANSPOSE_COLOR_MATRIX_ARB */ + { 37901, 0x000088B7 }, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ + { 37933, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ + { 37963, 0x000084E3 }, /* GL_TRANSPOSE_MODELVIEW_MATRIX_ARB */ + { 37997, 0x0000862C }, /* GL_TRANSPOSE_NV */ + { 38013, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX */ + { 38044, 0x000084E4 }, /* GL_TRANSPOSE_PROJECTION_MATRIX_ARB */ + { 38079, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX */ + { 38107, 0x000084E5 }, /* GL_TRANSPOSE_TEXTURE_MATRIX_ARB */ + { 38139, 0x00000004 }, /* GL_TRIANGLES */ + { 38152, 0x00000006 }, /* GL_TRIANGLE_FAN */ + { 38168, 0x00008615 }, /* GL_TRIANGLE_MESH_SUN */ + { 38189, 0x00000005 }, /* GL_TRIANGLE_STRIP */ + { 38207, 0x00000001 }, /* GL_TRUE */ + { 38215, 0x00000CF5 }, /* GL_UNPACK_ALIGNMENT */ + { 38235, 0x0000806E }, /* GL_UNPACK_IMAGE_HEIGHT */ + { 38258, 0x00000CF1 }, /* GL_UNPACK_LSB_FIRST */ + { 38278, 0x00000CF2 }, /* GL_UNPACK_ROW_LENGTH */ + { 38299, 0x0000806D }, /* GL_UNPACK_SKIP_IMAGES */ + { 38321, 0x00000CF4 }, /* GL_UNPACK_SKIP_PIXELS */ + { 38343, 0x00000CF3 }, /* GL_UNPACK_SKIP_ROWS */ + { 38363, 0x00000CF0 }, /* GL_UNPACK_SWAP_BYTES */ + { 38384, 0x00009118 }, /* GL_UNSIGNALED */ + { 38398, 0x00001401 }, /* GL_UNSIGNED_BYTE */ + { 38415, 0x00008362 }, /* GL_UNSIGNED_BYTE_2_3_3_REV */ + { 38442, 0x00008032 }, /* GL_UNSIGNED_BYTE_3_3_2 */ + { 38465, 0x00001405 }, /* GL_UNSIGNED_INT */ + { 38481, 0x00008036 }, /* GL_UNSIGNED_INT_10_10_10_2 */ + { 38508, 0x000084FA }, /* GL_UNSIGNED_INT_24_8 */ + { 38529, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_EXT */ + { 38554, 0x000084FA }, /* GL_UNSIGNED_INT_24_8_NV */ + { 38578, 0x00008368 }, /* GL_UNSIGNED_INT_2_10_10_10_REV */ + { 38609, 0x00008035 }, /* GL_UNSIGNED_INT_8_8_8_8 */ + { 38633, 0x00008367 }, /* GL_UNSIGNED_INT_8_8_8_8_REV */ + { 38661, 0x00008C17 }, /* GL_UNSIGNED_NORMALIZED */ + { 38684, 0x00001403 }, /* GL_UNSIGNED_SHORT */ + { 38702, 0x00008366 }, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ + { 38732, 0x00008033 }, /* GL_UNSIGNED_SHORT_4_4_4_4 */ + { 38758, 0x00008365 }, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ + { 38788, 0x00008034 }, /* GL_UNSIGNED_SHORT_5_5_5_1 */ + { 38814, 0x00008363 }, /* GL_UNSIGNED_SHORT_5_6_5 */ + { 38838, 0x00008364 }, /* GL_UNSIGNED_SHORT_5_6_5_REV */ + { 38866, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_APPLE */ + { 38894, 0x000085BA }, /* GL_UNSIGNED_SHORT_8_8_MESA */ + { 38921, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ + { 38953, 0x000085BB }, /* GL_UNSIGNED_SHORT_8_8_REV_MESA */ + { 38984, 0x00008CA2 }, /* GL_UPPER_LEFT */ + { 38998, 0x00002A20 }, /* GL_V2F */ + { 39005, 0x00002A21 }, /* GL_V3F */ + { 39012, 0x00008B83 }, /* GL_VALIDATE_STATUS */ + { 39031, 0x00001F00 }, /* GL_VENDOR */ + { 39041, 0x00001F02 }, /* GL_VERSION */ + { 39052, 0x00008074 }, /* GL_VERTEX_ARRAY */ + { 39068, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING */ + { 39092, 0x000085B5 }, /* GL_VERTEX_ARRAY_BINDING_APPLE */ + { 39122, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ + { 39153, 0x00008896 }, /* GL_VERTEX_ARRAY_BUFFER_BINDING_ARB */ + { 39188, 0x0000808E }, /* GL_VERTEX_ARRAY_POINTER */ + { 39212, 0x0000807A }, /* GL_VERTEX_ARRAY_SIZE */ + { 39233, 0x0000807C }, /* GL_VERTEX_ARRAY_STRIDE */ + { 39256, 0x0000807B }, /* GL_VERTEX_ARRAY_TYPE */ + { 39277, 0x00008650 }, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ + { 39304, 0x0000865A }, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ + { 39332, 0x0000865B }, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ + { 39360, 0x0000865C }, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ + { 39388, 0x0000865D }, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ + { 39416, 0x0000865E }, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ + { 39444, 0x0000865F }, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ + { 39472, 0x00008651 }, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ + { 39499, 0x00008652 }, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ + { 39526, 0x00008653 }, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ + { 39553, 0x00008654 }, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ + { 39580, 0x00008655 }, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ + { 39607, 0x00008656 }, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ + { 39634, 0x00008657 }, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ + { 39661, 0x00008658 }, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ + { 39688, 0x00008659 }, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ + { 39715, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ + { 39753, 0x0000889F }, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB */ + { 39795, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ + { 39826, 0x00008622 }, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB */ + { 39861, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ + { 39895, 0x0000886A }, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB */ + { 39933, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ + { 39964, 0x00008645 }, /* GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB */ + { 39999, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ + { 40027, 0x00008623 }, /* GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB */ + { 40059, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ + { 40089, 0x00008624 }, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB */ + { 40123, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ + { 40151, 0x00008625 }, /* GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB */ + { 40183, 0x000086A7 }, /* GL_VERTEX_BLEND_ARB */ + { 40203, 0x00008620 }, /* GL_VERTEX_PROGRAM_ARB */ + { 40225, 0x0000864A }, /* GL_VERTEX_PROGRAM_BINDING_NV */ + { 40254, 0x00008620 }, /* GL_VERTEX_PROGRAM_NV */ + { 40275, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE */ + { 40304, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_ARB */ + { 40337, 0x00008642 }, /* GL_VERTEX_PROGRAM_POINT_SIZE_NV */ + { 40369, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE */ + { 40396, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_ARB */ + { 40427, 0x00008643 }, /* GL_VERTEX_PROGRAM_TWO_SIDE_NV */ + { 40457, 0x00008B31 }, /* GL_VERTEX_SHADER */ + { 40474, 0x00008B31 }, /* GL_VERTEX_SHADER_ARB */ + { 40495, 0x00008621 }, /* GL_VERTEX_STATE_PROGRAM_NV */ + { 40522, 0x00000BA2 }, /* GL_VIEWPORT */ + { 40534, 0x00000800 }, /* GL_VIEWPORT_BIT */ + { 40550, 0x0000911D }, /* GL_WAIT_FAILED */ + { 40565, 0x000086AD }, /* GL_WEIGHT_ARRAY_ARB */ + { 40585, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ + { 40616, 0x0000889E }, /* GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB */ + { 40651, 0x000086AC }, /* GL_WEIGHT_ARRAY_POINTER_ARB */ + { 40679, 0x000086AB }, /* GL_WEIGHT_ARRAY_SIZE_ARB */ + { 40704, 0x000086AA }, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ + { 40731, 0x000086A9 }, /* GL_WEIGHT_ARRAY_TYPE_ARB */ + { 40756, 0x000086A6 }, /* GL_WEIGHT_SUM_UNITY_ARB */ + { 40780, 0x000081D4 }, /* GL_WRAP_BORDER_SUN */ + { 40799, 0x000088B9 }, /* GL_WRITE_ONLY */ + { 40813, 0x000088B9 }, /* GL_WRITE_ONLY_ARB */ + { 40831, 0x00001506 }, /* GL_XOR */ + { 40838, 0x000085B9 }, /* GL_YCBCR_422_APPLE */ + { 40857, 0x00008757 }, /* GL_YCBCR_MESA */ + { 40871, 0x00000000 }, /* GL_ZERO */ + { 40879, 0x00000D16 }, /* GL_ZOOM_X */ + { 40889, 0x00000D17 }, /* GL_ZOOM_Y */ }; static const unsigned reduced_enums[1347] = { - 476, /* GL_FALSE */ - 694, /* GL_LINES */ - 696, /* GL_LINE_LOOP */ - 703, /* GL_LINE_STRIP */ - 1748, /* GL_TRIANGLES */ - 1751, /* GL_TRIANGLE_STRIP */ - 1749, /* GL_TRIANGLE_FAN */ - 1275, /* GL_QUADS */ - 1279, /* GL_QUAD_STRIP */ - 1161, /* GL_POLYGON */ - 1173, /* GL_POLYGON_STIPPLE_BIT */ - 1122, /* GL_PIXEL_MODE_BIT */ - 681, /* GL_LIGHTING_BIT */ - 506, /* GL_FOG_BIT */ + 479, /* GL_FALSE */ + 701, /* GL_LINES */ + 703, /* GL_LINE_LOOP */ + 710, /* GL_LINE_STRIP */ + 1766, /* GL_TRIANGLES */ + 1769, /* GL_TRIANGLE_STRIP */ + 1767, /* GL_TRIANGLE_FAN */ + 1285, /* GL_QUADS */ + 1289, /* GL_QUAD_STRIP */ + 1171, /* GL_POLYGON */ + 1183, /* GL_POLYGON_STIPPLE_BIT */ + 1132, /* GL_PIXEL_MODE_BIT */ + 688, /* GL_LIGHTING_BIT */ + 509, /* GL_FOG_BIT */ 8, /* GL_ACCUM */ - 713, /* GL_LOAD */ - 1331, /* GL_RETURN */ - 994, /* GL_MULT */ + 720, /* GL_LOAD */ + 1344, /* GL_RETURN */ + 1004, /* GL_MULT */ 23, /* GL_ADD */ - 1010, /* GL_NEVER */ - 671, /* GL_LESS */ - 466, /* GL_EQUAL */ - 670, /* GL_LEQUAL */ - 592, /* GL_GREATER */ - 1025, /* GL_NOTEQUAL */ - 591, /* GL_GEQUAL */ + 1020, /* GL_NEVER */ + 678, /* GL_LESS */ + 469, /* GL_EQUAL */ + 677, /* GL_LEQUAL */ + 599, /* GL_GREATER */ + 1035, /* GL_NOTEQUAL */ + 598, /* GL_GEQUAL */ 47, /* GL_ALWAYS */ - 1472, /* GL_SRC_COLOR */ - 1055, /* GL_ONE_MINUS_SRC_COLOR */ - 1470, /* GL_SRC_ALPHA */ - 1054, /* GL_ONE_MINUS_SRC_ALPHA */ - 445, /* GL_DST_ALPHA */ - 1052, /* GL_ONE_MINUS_DST_ALPHA */ - 446, /* GL_DST_COLOR */ - 1053, /* GL_ONE_MINUS_DST_COLOR */ - 1471, /* GL_SRC_ALPHA_SATURATE */ - 579, /* GL_FRONT_LEFT */ - 580, /* GL_FRONT_RIGHT */ + 1485, /* GL_SRC_COLOR */ + 1065, /* GL_ONE_MINUS_SRC_COLOR */ + 1483, /* GL_SRC_ALPHA */ + 1064, /* GL_ONE_MINUS_SRC_ALPHA */ + 448, /* GL_DST_ALPHA */ + 1062, /* GL_ONE_MINUS_DST_ALPHA */ + 449, /* GL_DST_COLOR */ + 1063, /* GL_ONE_MINUS_DST_COLOR */ + 1484, /* GL_SRC_ALPHA_SATURATE */ + 586, /* GL_FRONT_LEFT */ + 587, /* GL_FRONT_RIGHT */ 69, /* GL_BACK_LEFT */ 70, /* GL_BACK_RIGHT */ - 576, /* GL_FRONT */ + 583, /* GL_FRONT */ 68, /* GL_BACK */ - 669, /* GL_LEFT */ - 1373, /* GL_RIGHT */ - 577, /* GL_FRONT_AND_BACK */ + 676, /* GL_LEFT */ + 1386, /* GL_RIGHT */ + 584, /* GL_FRONT_AND_BACK */ 63, /* GL_AUX0 */ 64, /* GL_AUX1 */ 65, /* GL_AUX2 */ 66, /* GL_AUX3 */ - 658, /* GL_INVALID_ENUM */ - 662, /* GL_INVALID_VALUE */ - 661, /* GL_INVALID_OPERATION */ - 1477, /* GL_STACK_OVERFLOW */ - 1478, /* GL_STACK_UNDERFLOW */ - 1080, /* GL_OUT_OF_MEMORY */ - 659, /* GL_INVALID_FRAMEBUFFER_OPERATION */ + 665, /* GL_INVALID_ENUM */ + 669, /* GL_INVALID_VALUE */ + 668, /* GL_INVALID_OPERATION */ + 1490, /* GL_STACK_OVERFLOW */ + 1491, /* GL_STACK_UNDERFLOW */ + 1090, /* GL_OUT_OF_MEMORY */ + 666, /* GL_INVALID_FRAMEBUFFER_OPERATION */ 0, /* GL_2D */ 2, /* GL_3D */ 3, /* GL_3D_COLOR */ 4, /* GL_3D_COLOR_TEXTURE */ 6, /* GL_4D_COLOR_TEXTURE */ - 1100, /* GL_PASS_THROUGH_TOKEN */ - 1160, /* GL_POINT_TOKEN */ - 704, /* GL_LINE_TOKEN */ - 1174, /* GL_POLYGON_TOKEN */ + 1110, /* GL_PASS_THROUGH_TOKEN */ + 1170, /* GL_POINT_TOKEN */ + 711, /* GL_LINE_TOKEN */ + 1184, /* GL_POLYGON_TOKEN */ 74, /* GL_BITMAP_TOKEN */ - 444, /* GL_DRAW_PIXEL_TOKEN */ + 447, /* GL_DRAW_PIXEL_TOKEN */ 301, /* GL_COPY_PIXEL_TOKEN */ - 697, /* GL_LINE_RESET_TOKEN */ - 469, /* GL_EXP */ - 470, /* GL_EXP2 */ + 704, /* GL_LINE_RESET_TOKEN */ + 472, /* GL_EXP */ + 473, /* GL_EXP2 */ 337, /* GL_CW */ 125, /* GL_CCW */ 146, /* GL_COEFF */ - 1077, /* GL_ORDER */ - 382, /* GL_DOMAIN */ + 1087, /* GL_ORDER */ + 384, /* GL_DOMAIN */ 311, /* GL_CURRENT_COLOR */ 314, /* GL_CURRENT_INDEX */ 320, /* GL_CURRENT_NORMAL */ @@ -3854,519 +3892,519 @@ static const unsigned reduced_enums[1347] = 328, /* GL_CURRENT_RASTER_POSITION */ 329, /* GL_CURRENT_RASTER_POSITION_VALID */ 326, /* GL_CURRENT_RASTER_DISTANCE */ - 1153, /* GL_POINT_SMOOTH */ - 1142, /* GL_POINT_SIZE */ - 1152, /* GL_POINT_SIZE_RANGE */ - 1143, /* GL_POINT_SIZE_GRANULARITY */ - 698, /* GL_LINE_SMOOTH */ - 705, /* GL_LINE_WIDTH */ - 707, /* GL_LINE_WIDTH_RANGE */ - 706, /* GL_LINE_WIDTH_GRANULARITY */ - 700, /* GL_LINE_STIPPLE */ - 701, /* GL_LINE_STIPPLE_PATTERN */ - 702, /* GL_LINE_STIPPLE_REPEAT */ - 712, /* GL_LIST_MODE */ - 877, /* GL_MAX_LIST_NESTING */ - 709, /* GL_LIST_BASE */ - 711, /* GL_LIST_INDEX */ - 1163, /* GL_POLYGON_MODE */ - 1170, /* GL_POLYGON_SMOOTH */ - 1172, /* GL_POLYGON_STIPPLE */ - 455, /* GL_EDGE_FLAG */ + 1163, /* GL_POINT_SMOOTH */ + 1152, /* GL_POINT_SIZE */ + 1162, /* GL_POINT_SIZE_RANGE */ + 1153, /* GL_POINT_SIZE_GRANULARITY */ + 705, /* GL_LINE_SMOOTH */ + 712, /* GL_LINE_WIDTH */ + 714, /* GL_LINE_WIDTH_RANGE */ + 713, /* GL_LINE_WIDTH_GRANULARITY */ + 707, /* GL_LINE_STIPPLE */ + 708, /* GL_LINE_STIPPLE_PATTERN */ + 709, /* GL_LINE_STIPPLE_REPEAT */ + 719, /* GL_LIST_MODE */ + 885, /* GL_MAX_LIST_NESTING */ + 716, /* GL_LIST_BASE */ + 718, /* GL_LIST_INDEX */ + 1173, /* GL_POLYGON_MODE */ + 1180, /* GL_POLYGON_SMOOTH */ + 1182, /* GL_POLYGON_STIPPLE */ + 458, /* GL_EDGE_FLAG */ 304, /* GL_CULL_FACE */ 305, /* GL_CULL_FACE_MODE */ - 578, /* GL_FRONT_FACE */ - 680, /* GL_LIGHTING */ - 685, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ - 686, /* GL_LIGHT_MODEL_TWO_SIDE */ - 682, /* GL_LIGHT_MODEL_AMBIENT */ - 1419, /* GL_SHADE_MODEL */ + 585, /* GL_FRONT_FACE */ + 687, /* GL_LIGHTING */ + 692, /* GL_LIGHT_MODEL_LOCAL_VIEWER */ + 693, /* GL_LIGHT_MODEL_TWO_SIDE */ + 689, /* GL_LIGHT_MODEL_AMBIENT */ + 1432, /* GL_SHADE_MODEL */ 193, /* GL_COLOR_MATERIAL_FACE */ 194, /* GL_COLOR_MATERIAL_PARAMETER */ 192, /* GL_COLOR_MATERIAL */ - 505, /* GL_FOG */ - 527, /* GL_FOG_INDEX */ - 523, /* GL_FOG_DENSITY */ - 531, /* GL_FOG_START */ - 525, /* GL_FOG_END */ - 528, /* GL_FOG_MODE */ - 507, /* GL_FOG_COLOR */ - 369, /* GL_DEPTH_RANGE */ - 376, /* GL_DEPTH_TEST */ - 379, /* GL_DEPTH_WRITEMASK */ - 357, /* GL_DEPTH_CLEAR_VALUE */ - 368, /* GL_DEPTH_FUNC */ + 508, /* GL_FOG */ + 530, /* GL_FOG_INDEX */ + 526, /* GL_FOG_DENSITY */ + 534, /* GL_FOG_START */ + 528, /* GL_FOG_END */ + 531, /* GL_FOG_MODE */ + 510, /* GL_FOG_COLOR */ + 370, /* GL_DEPTH_RANGE */ + 378, /* GL_DEPTH_TEST */ + 381, /* GL_DEPTH_WRITEMASK */ + 358, /* GL_DEPTH_CLEAR_VALUE */ + 369, /* GL_DEPTH_FUNC */ 12, /* GL_ACCUM_CLEAR_VALUE */ - 1513, /* GL_STENCIL_TEST */ - 1501, /* GL_STENCIL_CLEAR_VALUE */ - 1503, /* GL_STENCIL_FUNC */ - 1515, /* GL_STENCIL_VALUE_MASK */ - 1502, /* GL_STENCIL_FAIL */ - 1510, /* GL_STENCIL_PASS_DEPTH_FAIL */ - 1511, /* GL_STENCIL_PASS_DEPTH_PASS */ - 1512, /* GL_STENCIL_REF */ - 1516, /* GL_STENCIL_WRITEMASK */ - 846, /* GL_MATRIX_MODE */ - 1015, /* GL_NORMALIZE */ - 1842, /* GL_VIEWPORT */ - 989, /* GL_MODELVIEW_STACK_DEPTH */ - 1253, /* GL_PROJECTION_STACK_DEPTH */ - 1723, /* GL_TEXTURE_STACK_DEPTH */ - 987, /* GL_MODELVIEW_MATRIX */ - 1252, /* GL_PROJECTION_MATRIX */ - 1706, /* GL_TEXTURE_MATRIX */ + 1530, /* GL_STENCIL_TEST */ + 1514, /* GL_STENCIL_CLEAR_VALUE */ + 1516, /* GL_STENCIL_FUNC */ + 1532, /* GL_STENCIL_VALUE_MASK */ + 1515, /* GL_STENCIL_FAIL */ + 1527, /* GL_STENCIL_PASS_DEPTH_FAIL */ + 1528, /* GL_STENCIL_PASS_DEPTH_PASS */ + 1529, /* GL_STENCIL_REF */ + 1533, /* GL_STENCIL_WRITEMASK */ + 853, /* GL_MATRIX_MODE */ + 1025, /* GL_NORMALIZE */ + 1861, /* GL_VIEWPORT */ + 999, /* GL_MODELVIEW_STACK_DEPTH */ + 1263, /* GL_PROJECTION_STACK_DEPTH */ + 1740, /* GL_TEXTURE_STACK_DEPTH */ + 997, /* GL_MODELVIEW_MATRIX */ + 1262, /* GL_PROJECTION_MATRIX */ + 1723, /* GL_TEXTURE_MATRIX */ 61, /* GL_ATTRIB_STACK_DEPTH */ 136, /* GL_CLIENT_ATTRIB_STACK_DEPTH */ 43, /* GL_ALPHA_TEST */ 44, /* GL_ALPHA_TEST_FUNC */ 45, /* GL_ALPHA_TEST_REF */ - 381, /* GL_DITHER */ + 383, /* GL_DITHER */ 78, /* GL_BLEND_DST */ 87, /* GL_BLEND_SRC */ 75, /* GL_BLEND */ - 715, /* GL_LOGIC_OP_MODE */ - 632, /* GL_INDEX_LOGIC_OP */ + 722, /* GL_LOGIC_OP_MODE */ + 639, /* GL_INDEX_LOGIC_OP */ 191, /* GL_COLOR_LOGIC_OP */ 67, /* GL_AUX_BUFFERS */ - 392, /* GL_DRAW_BUFFER */ - 1289, /* GL_READ_BUFFER */ - 1400, /* GL_SCISSOR_BOX */ - 1401, /* GL_SCISSOR_TEST */ - 631, /* GL_INDEX_CLEAR_VALUE */ - 636, /* GL_INDEX_WRITEMASK */ + 394, /* GL_DRAW_BUFFER */ + 1299, /* GL_READ_BUFFER */ + 1413, /* GL_SCISSOR_BOX */ + 1414, /* GL_SCISSOR_TEST */ + 638, /* GL_INDEX_CLEAR_VALUE */ + 643, /* GL_INDEX_WRITEMASK */ 188, /* GL_COLOR_CLEAR_VALUE */ 230, /* GL_COLOR_WRITEMASK */ - 633, /* GL_INDEX_MODE */ - 1366, /* GL_RGBA_MODE */ - 391, /* GL_DOUBLEBUFFER */ - 1517, /* GL_STEREO */ - 1324, /* GL_RENDER_MODE */ - 1101, /* GL_PERSPECTIVE_CORRECTION_HINT */ - 1154, /* GL_POINT_SMOOTH_HINT */ - 699, /* GL_LINE_SMOOTH_HINT */ - 1171, /* GL_POLYGON_SMOOTH_HINT */ - 526, /* GL_FOG_HINT */ - 1687, /* GL_TEXTURE_GEN_S */ - 1688, /* GL_TEXTURE_GEN_T */ - 1686, /* GL_TEXTURE_GEN_R */ - 1685, /* GL_TEXTURE_GEN_Q */ - 1114, /* GL_PIXEL_MAP_I_TO_I */ - 1120, /* GL_PIXEL_MAP_S_TO_S */ - 1116, /* GL_PIXEL_MAP_I_TO_R */ - 1112, /* GL_PIXEL_MAP_I_TO_G */ - 1110, /* GL_PIXEL_MAP_I_TO_B */ - 1108, /* GL_PIXEL_MAP_I_TO_A */ - 1118, /* GL_PIXEL_MAP_R_TO_R */ - 1106, /* GL_PIXEL_MAP_G_TO_G */ - 1104, /* GL_PIXEL_MAP_B_TO_B */ - 1102, /* GL_PIXEL_MAP_A_TO_A */ - 1115, /* GL_PIXEL_MAP_I_TO_I_SIZE */ - 1121, /* GL_PIXEL_MAP_S_TO_S_SIZE */ - 1117, /* GL_PIXEL_MAP_I_TO_R_SIZE */ - 1113, /* GL_PIXEL_MAP_I_TO_G_SIZE */ - 1111, /* GL_PIXEL_MAP_I_TO_B_SIZE */ - 1109, /* GL_PIXEL_MAP_I_TO_A_SIZE */ - 1119, /* GL_PIXEL_MAP_R_TO_R_SIZE */ - 1107, /* GL_PIXEL_MAP_G_TO_G_SIZE */ - 1105, /* GL_PIXEL_MAP_B_TO_B_SIZE */ - 1103, /* GL_PIXEL_MAP_A_TO_A_SIZE */ - 1760, /* GL_UNPACK_SWAP_BYTES */ - 1755, /* GL_UNPACK_LSB_FIRST */ - 1756, /* GL_UNPACK_ROW_LENGTH */ - 1759, /* GL_UNPACK_SKIP_ROWS */ - 1758, /* GL_UNPACK_SKIP_PIXELS */ - 1753, /* GL_UNPACK_ALIGNMENT */ - 1089, /* GL_PACK_SWAP_BYTES */ - 1084, /* GL_PACK_LSB_FIRST */ - 1085, /* GL_PACK_ROW_LENGTH */ - 1088, /* GL_PACK_SKIP_ROWS */ - 1087, /* GL_PACK_SKIP_PIXELS */ - 1081, /* GL_PACK_ALIGNMENT */ - 793, /* GL_MAP_COLOR */ - 798, /* GL_MAP_STENCIL */ - 635, /* GL_INDEX_SHIFT */ - 634, /* GL_INDEX_OFFSET */ - 1302, /* GL_RED_SCALE */ - 1300, /* GL_RED_BIAS */ - 1860, /* GL_ZOOM_X */ - 1861, /* GL_ZOOM_Y */ - 596, /* GL_GREEN_SCALE */ - 594, /* GL_GREEN_BIAS */ + 640, /* GL_INDEX_MODE */ + 1379, /* GL_RGBA_MODE */ + 393, /* GL_DOUBLEBUFFER */ + 1534, /* GL_STEREO */ + 1337, /* GL_RENDER_MODE */ + 1111, /* GL_PERSPECTIVE_CORRECTION_HINT */ + 1164, /* GL_POINT_SMOOTH_HINT */ + 706, /* GL_LINE_SMOOTH_HINT */ + 1181, /* GL_POLYGON_SMOOTH_HINT */ + 529, /* GL_FOG_HINT */ + 1704, /* GL_TEXTURE_GEN_S */ + 1705, /* GL_TEXTURE_GEN_T */ + 1703, /* GL_TEXTURE_GEN_R */ + 1702, /* GL_TEXTURE_GEN_Q */ + 1124, /* GL_PIXEL_MAP_I_TO_I */ + 1130, /* GL_PIXEL_MAP_S_TO_S */ + 1126, /* GL_PIXEL_MAP_I_TO_R */ + 1122, /* GL_PIXEL_MAP_I_TO_G */ + 1120, /* GL_PIXEL_MAP_I_TO_B */ + 1118, /* GL_PIXEL_MAP_I_TO_A */ + 1128, /* GL_PIXEL_MAP_R_TO_R */ + 1116, /* GL_PIXEL_MAP_G_TO_G */ + 1114, /* GL_PIXEL_MAP_B_TO_B */ + 1112, /* GL_PIXEL_MAP_A_TO_A */ + 1125, /* GL_PIXEL_MAP_I_TO_I_SIZE */ + 1131, /* GL_PIXEL_MAP_S_TO_S_SIZE */ + 1127, /* GL_PIXEL_MAP_I_TO_R_SIZE */ + 1123, /* GL_PIXEL_MAP_I_TO_G_SIZE */ + 1121, /* GL_PIXEL_MAP_I_TO_B_SIZE */ + 1119, /* GL_PIXEL_MAP_I_TO_A_SIZE */ + 1129, /* GL_PIXEL_MAP_R_TO_R_SIZE */ + 1117, /* GL_PIXEL_MAP_G_TO_G_SIZE */ + 1115, /* GL_PIXEL_MAP_B_TO_B_SIZE */ + 1113, /* GL_PIXEL_MAP_A_TO_A_SIZE */ + 1778, /* GL_UNPACK_SWAP_BYTES */ + 1773, /* GL_UNPACK_LSB_FIRST */ + 1774, /* GL_UNPACK_ROW_LENGTH */ + 1777, /* GL_UNPACK_SKIP_ROWS */ + 1776, /* GL_UNPACK_SKIP_PIXELS */ + 1771, /* GL_UNPACK_ALIGNMENT */ + 1099, /* GL_PACK_SWAP_BYTES */ + 1094, /* GL_PACK_LSB_FIRST */ + 1095, /* GL_PACK_ROW_LENGTH */ + 1098, /* GL_PACK_SKIP_ROWS */ + 1097, /* GL_PACK_SKIP_PIXELS */ + 1091, /* GL_PACK_ALIGNMENT */ + 800, /* GL_MAP_COLOR */ + 805, /* GL_MAP_STENCIL */ + 642, /* GL_INDEX_SHIFT */ + 641, /* GL_INDEX_OFFSET */ + 1313, /* GL_RED_SCALE */ + 1311, /* GL_RED_BIAS */ + 1879, /* GL_ZOOM_X */ + 1880, /* GL_ZOOM_Y */ + 603, /* GL_GREEN_SCALE */ + 601, /* GL_GREEN_BIAS */ 93, /* GL_BLUE_SCALE */ 91, /* GL_BLUE_BIAS */ 42, /* GL_ALPHA_SCALE */ 40, /* GL_ALPHA_BIAS */ - 370, /* GL_DEPTH_SCALE */ - 350, /* GL_DEPTH_BIAS */ - 872, /* GL_MAX_EVAL_ORDER */ - 876, /* GL_MAX_LIGHTS */ - 855, /* GL_MAX_CLIP_PLANES */ - 922, /* GL_MAX_TEXTURE_SIZE */ - 882, /* GL_MAX_PIXEL_MAP_TABLE */ - 851, /* GL_MAX_ATTRIB_STACK_DEPTH */ - 879, /* GL_MAX_MODELVIEW_STACK_DEPTH */ - 880, /* GL_MAX_NAME_STACK_DEPTH */ - 908, /* GL_MAX_PROJECTION_STACK_DEPTH */ - 923, /* GL_MAX_TEXTURE_STACK_DEPTH */ - 937, /* GL_MAX_VIEWPORT_DIMS */ - 852, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ - 1527, /* GL_SUBPIXEL_BITS */ - 630, /* GL_INDEX_BITS */ - 1301, /* GL_RED_BITS */ - 595, /* GL_GREEN_BITS */ + 371, /* GL_DEPTH_SCALE */ + 351, /* GL_DEPTH_BIAS */ + 880, /* GL_MAX_EVAL_ORDER */ + 884, /* GL_MAX_LIGHTS */ + 862, /* GL_MAX_CLIP_PLANES */ + 932, /* GL_MAX_TEXTURE_SIZE */ + 890, /* GL_MAX_PIXEL_MAP_TABLE */ + 858, /* GL_MAX_ATTRIB_STACK_DEPTH */ + 887, /* GL_MAX_MODELVIEW_STACK_DEPTH */ + 888, /* GL_MAX_NAME_STACK_DEPTH */ + 916, /* GL_MAX_PROJECTION_STACK_DEPTH */ + 933, /* GL_MAX_TEXTURE_STACK_DEPTH */ + 947, /* GL_MAX_VIEWPORT_DIMS */ + 859, /* GL_MAX_CLIENT_ATTRIB_STACK_DEPTH */ + 1544, /* GL_SUBPIXEL_BITS */ + 637, /* GL_INDEX_BITS */ + 1312, /* GL_RED_BITS */ + 602, /* GL_GREEN_BITS */ 92, /* GL_BLUE_BITS */ 41, /* GL_ALPHA_BITS */ - 351, /* GL_DEPTH_BITS */ - 1499, /* GL_STENCIL_BITS */ + 352, /* GL_DEPTH_BITS */ + 1512, /* GL_STENCIL_BITS */ 14, /* GL_ACCUM_RED_BITS */ 13, /* GL_ACCUM_GREEN_BITS */ 10, /* GL_ACCUM_BLUE_BITS */ 9, /* GL_ACCUM_ALPHA_BITS */ - 1003, /* GL_NAME_STACK_DEPTH */ + 1013, /* GL_NAME_STACK_DEPTH */ 62, /* GL_AUTO_NORMAL */ - 739, /* GL_MAP1_COLOR_4 */ - 742, /* GL_MAP1_INDEX */ - 743, /* GL_MAP1_NORMAL */ - 744, /* GL_MAP1_TEXTURE_COORD_1 */ - 745, /* GL_MAP1_TEXTURE_COORD_2 */ - 746, /* GL_MAP1_TEXTURE_COORD_3 */ - 747, /* GL_MAP1_TEXTURE_COORD_4 */ - 748, /* GL_MAP1_VERTEX_3 */ - 749, /* GL_MAP1_VERTEX_4 */ - 766, /* GL_MAP2_COLOR_4 */ - 769, /* GL_MAP2_INDEX */ - 770, /* GL_MAP2_NORMAL */ - 771, /* GL_MAP2_TEXTURE_COORD_1 */ - 772, /* GL_MAP2_TEXTURE_COORD_2 */ - 773, /* GL_MAP2_TEXTURE_COORD_3 */ - 774, /* GL_MAP2_TEXTURE_COORD_4 */ - 775, /* GL_MAP2_VERTEX_3 */ - 776, /* GL_MAP2_VERTEX_4 */ - 740, /* GL_MAP1_GRID_DOMAIN */ - 741, /* GL_MAP1_GRID_SEGMENTS */ - 767, /* GL_MAP2_GRID_DOMAIN */ - 768, /* GL_MAP2_GRID_SEGMENTS */ - 1610, /* GL_TEXTURE_1D */ - 1612, /* GL_TEXTURE_2D */ - 479, /* GL_FEEDBACK_BUFFER_POINTER */ - 480, /* GL_FEEDBACK_BUFFER_SIZE */ - 481, /* GL_FEEDBACK_BUFFER_TYPE */ - 1410, /* GL_SELECTION_BUFFER_POINTER */ - 1411, /* GL_SELECTION_BUFFER_SIZE */ - 1728, /* GL_TEXTURE_WIDTH */ - 1692, /* GL_TEXTURE_HEIGHT */ - 1647, /* GL_TEXTURE_COMPONENTS */ - 1631, /* GL_TEXTURE_BORDER_COLOR */ - 1630, /* GL_TEXTURE_BORDER */ - 383, /* GL_DONT_CARE */ - 477, /* GL_FASTEST */ - 1011, /* GL_NICEST */ + 746, /* GL_MAP1_COLOR_4 */ + 749, /* GL_MAP1_INDEX */ + 750, /* GL_MAP1_NORMAL */ + 751, /* GL_MAP1_TEXTURE_COORD_1 */ + 752, /* GL_MAP1_TEXTURE_COORD_2 */ + 753, /* GL_MAP1_TEXTURE_COORD_3 */ + 754, /* GL_MAP1_TEXTURE_COORD_4 */ + 755, /* GL_MAP1_VERTEX_3 */ + 756, /* GL_MAP1_VERTEX_4 */ + 773, /* GL_MAP2_COLOR_4 */ + 776, /* GL_MAP2_INDEX */ + 777, /* GL_MAP2_NORMAL */ + 778, /* GL_MAP2_TEXTURE_COORD_1 */ + 779, /* GL_MAP2_TEXTURE_COORD_2 */ + 780, /* GL_MAP2_TEXTURE_COORD_3 */ + 781, /* GL_MAP2_TEXTURE_COORD_4 */ + 782, /* GL_MAP2_VERTEX_3 */ + 783, /* GL_MAP2_VERTEX_4 */ + 747, /* GL_MAP1_GRID_DOMAIN */ + 748, /* GL_MAP1_GRID_SEGMENTS */ + 774, /* GL_MAP2_GRID_DOMAIN */ + 775, /* GL_MAP2_GRID_SEGMENTS */ + 1627, /* GL_TEXTURE_1D */ + 1629, /* GL_TEXTURE_2D */ + 482, /* GL_FEEDBACK_BUFFER_POINTER */ + 483, /* GL_FEEDBACK_BUFFER_SIZE */ + 484, /* GL_FEEDBACK_BUFFER_TYPE */ + 1423, /* GL_SELECTION_BUFFER_POINTER */ + 1424, /* GL_SELECTION_BUFFER_SIZE */ + 1746, /* GL_TEXTURE_WIDTH */ + 1709, /* GL_TEXTURE_HEIGHT */ + 1664, /* GL_TEXTURE_COMPONENTS */ + 1648, /* GL_TEXTURE_BORDER_COLOR */ + 1647, /* GL_TEXTURE_BORDER */ + 385, /* GL_DONT_CARE */ + 480, /* GL_FASTEST */ + 1021, /* GL_NICEST */ 48, /* GL_AMBIENT */ - 380, /* GL_DIFFUSE */ - 1459, /* GL_SPECULAR */ - 1175, /* GL_POSITION */ - 1462, /* GL_SPOT_DIRECTION */ - 1463, /* GL_SPOT_EXPONENT */ - 1461, /* GL_SPOT_CUTOFF */ + 382, /* GL_DIFFUSE */ + 1472, /* GL_SPECULAR */ + 1185, /* GL_POSITION */ + 1475, /* GL_SPOT_DIRECTION */ + 1476, /* GL_SPOT_EXPONENT */ + 1474, /* GL_SPOT_CUTOFF */ 275, /* GL_CONSTANT_ATTENUATION */ - 689, /* GL_LINEAR_ATTENUATION */ - 1274, /* GL_QUADRATIC_ATTENUATION */ + 696, /* GL_LINEAR_ATTENUATION */ + 1284, /* GL_QUADRATIC_ATTENUATION */ 244, /* GL_COMPILE */ 245, /* GL_COMPILE_AND_EXECUTE */ 120, /* GL_BYTE */ - 1762, /* GL_UNSIGNED_BYTE */ - 1424, /* GL_SHORT */ - 1773, /* GL_UNSIGNED_SHORT */ - 638, /* GL_INT */ - 1765, /* GL_UNSIGNED_INT */ - 486, /* GL_FLOAT */ + 1780, /* GL_UNSIGNED_BYTE */ + 1437, /* GL_SHORT */ + 1792, /* GL_UNSIGNED_SHORT */ + 645, /* GL_INT */ + 1783, /* GL_UNSIGNED_INT */ + 489, /* GL_FLOAT */ 1, /* GL_2_BYTES */ 5, /* GL_3_BYTES */ 7, /* GL_4_BYTES */ - 390, /* GL_DOUBLE */ + 392, /* GL_DOUBLE */ 132, /* GL_CLEAR */ 50, /* GL_AND */ 52, /* GL_AND_REVERSE */ 299, /* GL_COPY */ 51, /* GL_AND_INVERTED */ - 1013, /* GL_NOOP */ - 1856, /* GL_XOR */ - 1076, /* GL_OR */ - 1014, /* GL_NOR */ - 467, /* GL_EQUIV */ - 665, /* GL_INVERT */ - 1079, /* GL_OR_REVERSE */ + 1023, /* GL_NOOP */ + 1875, /* GL_XOR */ + 1086, /* GL_OR */ + 1024, /* GL_NOR */ + 470, /* GL_EQUIV */ + 672, /* GL_INVERT */ + 1089, /* GL_OR_REVERSE */ 300, /* GL_COPY_INVERTED */ - 1078, /* GL_OR_INVERTED */ - 1004, /* GL_NAND */ - 1415, /* GL_SET */ - 464, /* GL_EMISSION */ - 1423, /* GL_SHININESS */ + 1088, /* GL_OR_INVERTED */ + 1014, /* GL_NAND */ + 1428, /* GL_SET */ + 467, /* GL_EMISSION */ + 1436, /* GL_SHININESS */ 49, /* GL_AMBIENT_AND_DIFFUSE */ 190, /* GL_COLOR_INDEXES */ - 954, /* GL_MODELVIEW */ - 1251, /* GL_PROJECTION */ - 1545, /* GL_TEXTURE */ + 964, /* GL_MODELVIEW */ + 1261, /* GL_PROJECTION */ + 1562, /* GL_TEXTURE */ 147, /* GL_COLOR */ 346, /* GL_DEPTH */ - 1485, /* GL_STENCIL */ + 1498, /* GL_STENCIL */ 189, /* GL_COLOR_INDEX */ - 1504, /* GL_STENCIL_INDEX */ - 358, /* GL_DEPTH_COMPONENT */ - 1297, /* GL_RED */ - 593, /* GL_GREEN */ + 1517, /* GL_STENCIL_INDEX */ + 359, /* GL_DEPTH_COMPONENT */ + 1308, /* GL_RED */ + 600, /* GL_GREEN */ 90, /* GL_BLUE */ 31, /* GL_ALPHA */ - 1332, /* GL_RGB */ - 1351, /* GL_RGBA */ - 717, /* GL_LUMINANCE */ - 738, /* GL_LUMINANCE_ALPHA */ + 1345, /* GL_RGB */ + 1364, /* GL_RGBA */ + 724, /* GL_LUMINANCE */ + 745, /* GL_LUMINANCE_ALPHA */ 73, /* GL_BITMAP */ - 1131, /* GL_POINT */ - 687, /* GL_LINE */ - 482, /* GL_FILL */ - 1306, /* GL_RENDER */ - 478, /* GL_FEEDBACK */ - 1409, /* GL_SELECT */ - 485, /* GL_FLAT */ - 1434, /* GL_SMOOTH */ - 666, /* GL_KEEP */ - 1326, /* GL_REPLACE */ - 620, /* GL_INCR */ + 1141, /* GL_POINT */ + 694, /* GL_LINE */ + 485, /* GL_FILL */ + 1317, /* GL_RENDER */ + 481, /* GL_FEEDBACK */ + 1422, /* GL_SELECT */ + 488, /* GL_FLAT */ + 1447, /* GL_SMOOTH */ + 673, /* GL_KEEP */ + 1339, /* GL_REPLACE */ + 627, /* GL_INCR */ 342, /* GL_DECR */ - 1788, /* GL_VENDOR */ - 1323, /* GL_RENDERER */ - 1789, /* GL_VERSION */ - 471, /* GL_EXTENSIONS */ - 1374, /* GL_S */ - 1536, /* GL_T */ - 1286, /* GL_R */ - 1273, /* GL_Q */ - 990, /* GL_MODULATE */ + 1807, /* GL_VENDOR */ + 1336, /* GL_RENDERER */ + 1808, /* GL_VERSION */ + 474, /* GL_EXTENSIONS */ + 1387, /* GL_S */ + 1553, /* GL_T */ + 1296, /* GL_R */ + 1283, /* GL_Q */ + 1000, /* GL_MODULATE */ 341, /* GL_DECAL */ - 1682, /* GL_TEXTURE_ENV_MODE */ - 1681, /* GL_TEXTURE_ENV_COLOR */ - 1680, /* GL_TEXTURE_ENV */ - 472, /* GL_EYE_LINEAR */ - 1037, /* GL_OBJECT_LINEAR */ - 1460, /* GL_SPHERE_MAP */ - 1684, /* GL_TEXTURE_GEN_MODE */ - 1039, /* GL_OBJECT_PLANE */ - 473, /* GL_EYE_PLANE */ - 1005, /* GL_NEAREST */ - 688, /* GL_LINEAR */ - 1009, /* GL_NEAREST_MIPMAP_NEAREST */ - 693, /* GL_LINEAR_MIPMAP_NEAREST */ - 1008, /* GL_NEAREST_MIPMAP_LINEAR */ - 692, /* GL_LINEAR_MIPMAP_LINEAR */ - 1705, /* GL_TEXTURE_MAG_FILTER */ - 1713, /* GL_TEXTURE_MIN_FILTER */ - 1730, /* GL_TEXTURE_WRAP_S */ - 1731, /* GL_TEXTURE_WRAP_T */ + 1699, /* GL_TEXTURE_ENV_MODE */ + 1698, /* GL_TEXTURE_ENV_COLOR */ + 1697, /* GL_TEXTURE_ENV */ + 475, /* GL_EYE_LINEAR */ + 1047, /* GL_OBJECT_LINEAR */ + 1473, /* GL_SPHERE_MAP */ + 1701, /* GL_TEXTURE_GEN_MODE */ + 1049, /* GL_OBJECT_PLANE */ + 476, /* GL_EYE_PLANE */ + 1015, /* GL_NEAREST */ + 695, /* GL_LINEAR */ + 1019, /* GL_NEAREST_MIPMAP_NEAREST */ + 700, /* GL_LINEAR_MIPMAP_NEAREST */ + 1018, /* GL_NEAREST_MIPMAP_LINEAR */ + 699, /* GL_LINEAR_MIPMAP_LINEAR */ + 1722, /* GL_TEXTURE_MAG_FILTER */ + 1730, /* GL_TEXTURE_MIN_FILTER */ + 1748, /* GL_TEXTURE_WRAP_S */ + 1749, /* GL_TEXTURE_WRAP_T */ 126, /* GL_CLAMP */ - 1325, /* GL_REPEAT */ - 1169, /* GL_POLYGON_OFFSET_UNITS */ - 1168, /* GL_POLYGON_OFFSET_POINT */ - 1167, /* GL_POLYGON_OFFSET_LINE */ - 1287, /* GL_R3_G3_B2 */ - 1785, /* GL_V2F */ - 1786, /* GL_V3F */ + 1338, /* GL_REPEAT */ + 1179, /* GL_POLYGON_OFFSET_UNITS */ + 1178, /* GL_POLYGON_OFFSET_POINT */ + 1177, /* GL_POLYGON_OFFSET_LINE */ + 1297, /* GL_R3_G3_B2 */ + 1804, /* GL_V2F */ + 1805, /* GL_V3F */ 123, /* GL_C4UB_V2F */ 124, /* GL_C4UB_V3F */ 121, /* GL_C3F_V3F */ - 1002, /* GL_N3F_V3F */ + 1012, /* GL_N3F_V3F */ 122, /* GL_C4F_N3F_V3F */ - 1541, /* GL_T2F_V3F */ - 1543, /* GL_T4F_V4F */ - 1539, /* GL_T2F_C4UB_V3F */ - 1537, /* GL_T2F_C3F_V3F */ - 1540, /* GL_T2F_N3F_V3F */ - 1538, /* GL_T2F_C4F_N3F_V3F */ - 1542, /* GL_T4F_C4F_N3F_V4F */ + 1558, /* GL_T2F_V3F */ + 1560, /* GL_T4F_V4F */ + 1556, /* GL_T2F_C4UB_V3F */ + 1554, /* GL_T2F_C3F_V3F */ + 1557, /* GL_T2F_N3F_V3F */ + 1555, /* GL_T2F_C4F_N3F_V3F */ + 1559, /* GL_T4F_C4F_N3F_V4F */ 139, /* GL_CLIP_PLANE0 */ 140, /* GL_CLIP_PLANE1 */ 141, /* GL_CLIP_PLANE2 */ 142, /* GL_CLIP_PLANE3 */ 143, /* GL_CLIP_PLANE4 */ 144, /* GL_CLIP_PLANE5 */ - 672, /* GL_LIGHT0 */ - 673, /* GL_LIGHT1 */ - 674, /* GL_LIGHT2 */ - 675, /* GL_LIGHT3 */ - 676, /* GL_LIGHT4 */ - 677, /* GL_LIGHT5 */ - 678, /* GL_LIGHT6 */ - 679, /* GL_LIGHT7 */ - 597, /* GL_HINT_BIT */ + 679, /* GL_LIGHT0 */ + 680, /* GL_LIGHT1 */ + 681, /* GL_LIGHT2 */ + 682, /* GL_LIGHT3 */ + 683, /* GL_LIGHT4 */ + 684, /* GL_LIGHT5 */ + 685, /* GL_LIGHT6 */ + 686, /* GL_LIGHT7 */ + 604, /* GL_HINT_BIT */ 277, /* GL_CONSTANT_COLOR */ - 1050, /* GL_ONE_MINUS_CONSTANT_COLOR */ + 1060, /* GL_ONE_MINUS_CONSTANT_COLOR */ 272, /* GL_CONSTANT_ALPHA */ - 1048, /* GL_ONE_MINUS_CONSTANT_ALPHA */ + 1058, /* GL_ONE_MINUS_CONSTANT_ALPHA */ 76, /* GL_BLEND_COLOR */ - 581, /* GL_FUNC_ADD */ - 938, /* GL_MIN */ - 848, /* GL_MAX */ + 588, /* GL_FUNC_ADD */ + 948, /* GL_MIN */ + 855, /* GL_MAX */ 81, /* GL_BLEND_EQUATION */ - 585, /* GL_FUNC_SUBTRACT */ - 583, /* GL_FUNC_REVERSE_SUBTRACT */ + 592, /* GL_FUNC_SUBTRACT */ + 590, /* GL_FUNC_REVERSE_SUBTRACT */ 280, /* GL_CONVOLUTION_1D */ 281, /* GL_CONVOLUTION_2D */ - 1412, /* GL_SEPARABLE_2D */ + 1425, /* GL_SEPARABLE_2D */ 284, /* GL_CONVOLUTION_BORDER_MODE */ 288, /* GL_CONVOLUTION_FILTER_SCALE */ 286, /* GL_CONVOLUTION_FILTER_BIAS */ - 1298, /* GL_REDUCE */ + 1309, /* GL_REDUCE */ 290, /* GL_CONVOLUTION_FORMAT */ 294, /* GL_CONVOLUTION_WIDTH */ 292, /* GL_CONVOLUTION_HEIGHT */ - 863, /* GL_MAX_CONVOLUTION_WIDTH */ - 861, /* GL_MAX_CONVOLUTION_HEIGHT */ - 1208, /* GL_POST_CONVOLUTION_RED_SCALE */ - 1204, /* GL_POST_CONVOLUTION_GREEN_SCALE */ - 1199, /* GL_POST_CONVOLUTION_BLUE_SCALE */ - 1195, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ - 1206, /* GL_POST_CONVOLUTION_RED_BIAS */ - 1202, /* GL_POST_CONVOLUTION_GREEN_BIAS */ - 1197, /* GL_POST_CONVOLUTION_BLUE_BIAS */ - 1193, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ - 598, /* GL_HISTOGRAM */ - 1257, /* GL_PROXY_HISTOGRAM */ - 614, /* GL_HISTOGRAM_WIDTH */ - 604, /* GL_HISTOGRAM_FORMAT */ - 610, /* GL_HISTOGRAM_RED_SIZE */ - 606, /* GL_HISTOGRAM_GREEN_SIZE */ - 601, /* GL_HISTOGRAM_BLUE_SIZE */ - 599, /* GL_HISTOGRAM_ALPHA_SIZE */ - 608, /* GL_HISTOGRAM_LUMINANCE_SIZE */ - 612, /* GL_HISTOGRAM_SINK */ - 939, /* GL_MINMAX */ - 941, /* GL_MINMAX_FORMAT */ - 943, /* GL_MINMAX_SINK */ - 1544, /* GL_TABLE_TOO_LARGE_EXT */ - 1764, /* GL_UNSIGNED_BYTE_3_3_2 */ - 1775, /* GL_UNSIGNED_SHORT_4_4_4_4 */ - 1777, /* GL_UNSIGNED_SHORT_5_5_5_1 */ - 1770, /* GL_UNSIGNED_INT_8_8_8_8 */ - 1766, /* GL_UNSIGNED_INT_10_10_10_2 */ - 1166, /* GL_POLYGON_OFFSET_FILL */ - 1165, /* GL_POLYGON_OFFSET_FACTOR */ - 1164, /* GL_POLYGON_OFFSET_BIAS */ - 1329, /* GL_RESCALE_NORMAL */ + 871, /* GL_MAX_CONVOLUTION_WIDTH */ + 869, /* GL_MAX_CONVOLUTION_HEIGHT */ + 1218, /* GL_POST_CONVOLUTION_RED_SCALE */ + 1214, /* GL_POST_CONVOLUTION_GREEN_SCALE */ + 1209, /* GL_POST_CONVOLUTION_BLUE_SCALE */ + 1205, /* GL_POST_CONVOLUTION_ALPHA_SCALE */ + 1216, /* GL_POST_CONVOLUTION_RED_BIAS */ + 1212, /* GL_POST_CONVOLUTION_GREEN_BIAS */ + 1207, /* GL_POST_CONVOLUTION_BLUE_BIAS */ + 1203, /* GL_POST_CONVOLUTION_ALPHA_BIAS */ + 605, /* GL_HISTOGRAM */ + 1267, /* GL_PROXY_HISTOGRAM */ + 621, /* GL_HISTOGRAM_WIDTH */ + 611, /* GL_HISTOGRAM_FORMAT */ + 617, /* GL_HISTOGRAM_RED_SIZE */ + 613, /* GL_HISTOGRAM_GREEN_SIZE */ + 608, /* GL_HISTOGRAM_BLUE_SIZE */ + 606, /* GL_HISTOGRAM_ALPHA_SIZE */ + 615, /* GL_HISTOGRAM_LUMINANCE_SIZE */ + 619, /* GL_HISTOGRAM_SINK */ + 949, /* GL_MINMAX */ + 951, /* GL_MINMAX_FORMAT */ + 953, /* GL_MINMAX_SINK */ + 1561, /* GL_TABLE_TOO_LARGE_EXT */ + 1782, /* GL_UNSIGNED_BYTE_3_3_2 */ + 1794, /* GL_UNSIGNED_SHORT_4_4_4_4 */ + 1796, /* GL_UNSIGNED_SHORT_5_5_5_1 */ + 1789, /* GL_UNSIGNED_INT_8_8_8_8 */ + 1784, /* GL_UNSIGNED_INT_10_10_10_2 */ + 1176, /* GL_POLYGON_OFFSET_FILL */ + 1175, /* GL_POLYGON_OFFSET_FACTOR */ + 1174, /* GL_POLYGON_OFFSET_BIAS */ + 1342, /* GL_RESCALE_NORMAL */ 36, /* GL_ALPHA4 */ 38, /* GL_ALPHA8 */ 32, /* GL_ALPHA12 */ 34, /* GL_ALPHA16 */ - 728, /* GL_LUMINANCE4 */ - 734, /* GL_LUMINANCE8 */ - 718, /* GL_LUMINANCE12 */ - 724, /* GL_LUMINANCE16 */ - 729, /* GL_LUMINANCE4_ALPHA4 */ - 732, /* GL_LUMINANCE6_ALPHA2 */ - 735, /* GL_LUMINANCE8_ALPHA8 */ - 721, /* GL_LUMINANCE12_ALPHA4 */ - 719, /* GL_LUMINANCE12_ALPHA12 */ - 725, /* GL_LUMINANCE16_ALPHA16 */ - 639, /* GL_INTENSITY */ - 644, /* GL_INTENSITY4 */ - 646, /* GL_INTENSITY8 */ - 640, /* GL_INTENSITY12 */ - 642, /* GL_INTENSITY16 */ - 1341, /* GL_RGB2_EXT */ - 1342, /* GL_RGB4 */ - 1345, /* GL_RGB5 */ - 1349, /* GL_RGB8 */ - 1333, /* GL_RGB10 */ - 1337, /* GL_RGB12 */ - 1339, /* GL_RGB16 */ - 1356, /* GL_RGBA2 */ - 1358, /* GL_RGBA4 */ - 1346, /* GL_RGB5_A1 */ - 1362, /* GL_RGBA8 */ - 1334, /* GL_RGB10_A2 */ - 1352, /* GL_RGBA12 */ - 1354, /* GL_RGBA16 */ - 1720, /* GL_TEXTURE_RED_SIZE */ - 1690, /* GL_TEXTURE_GREEN_SIZE */ - 1628, /* GL_TEXTURE_BLUE_SIZE */ - 1615, /* GL_TEXTURE_ALPHA_SIZE */ - 1703, /* GL_TEXTURE_LUMINANCE_SIZE */ - 1694, /* GL_TEXTURE_INTENSITY_SIZE */ - 1327, /* GL_REPLACE_EXT */ - 1261, /* GL_PROXY_TEXTURE_1D */ - 1264, /* GL_PROXY_TEXTURE_2D */ - 1726, /* GL_TEXTURE_TOO_LARGE_EXT */ - 1715, /* GL_TEXTURE_PRIORITY */ - 1722, /* GL_TEXTURE_RESIDENT */ - 1618, /* GL_TEXTURE_BINDING_1D */ - 1620, /* GL_TEXTURE_BINDING_2D */ - 1622, /* GL_TEXTURE_BINDING_3D */ - 1086, /* GL_PACK_SKIP_IMAGES */ - 1082, /* GL_PACK_IMAGE_HEIGHT */ - 1757, /* GL_UNPACK_SKIP_IMAGES */ - 1754, /* GL_UNPACK_IMAGE_HEIGHT */ - 1614, /* GL_TEXTURE_3D */ - 1267, /* GL_PROXY_TEXTURE_3D */ - 1677, /* GL_TEXTURE_DEPTH */ - 1729, /* GL_TEXTURE_WRAP_R */ - 849, /* GL_MAX_3D_TEXTURE_SIZE */ - 1790, /* GL_VERTEX_ARRAY */ - 1016, /* GL_NORMAL_ARRAY */ + 735, /* GL_LUMINANCE4 */ + 741, /* GL_LUMINANCE8 */ + 725, /* GL_LUMINANCE12 */ + 731, /* GL_LUMINANCE16 */ + 736, /* GL_LUMINANCE4_ALPHA4 */ + 739, /* GL_LUMINANCE6_ALPHA2 */ + 742, /* GL_LUMINANCE8_ALPHA8 */ + 728, /* GL_LUMINANCE12_ALPHA4 */ + 726, /* GL_LUMINANCE12_ALPHA12 */ + 732, /* GL_LUMINANCE16_ALPHA16 */ + 646, /* GL_INTENSITY */ + 651, /* GL_INTENSITY4 */ + 653, /* GL_INTENSITY8 */ + 647, /* GL_INTENSITY12 */ + 649, /* GL_INTENSITY16 */ + 1354, /* GL_RGB2_EXT */ + 1355, /* GL_RGB4 */ + 1358, /* GL_RGB5 */ + 1362, /* GL_RGB8 */ + 1346, /* GL_RGB10 */ + 1350, /* GL_RGB12 */ + 1352, /* GL_RGB16 */ + 1369, /* GL_RGBA2 */ + 1371, /* GL_RGBA4 */ + 1359, /* GL_RGB5_A1 */ + 1375, /* GL_RGBA8 */ + 1347, /* GL_RGB10_A2 */ + 1365, /* GL_RGBA12 */ + 1367, /* GL_RGBA16 */ + 1737, /* GL_TEXTURE_RED_SIZE */ + 1707, /* GL_TEXTURE_GREEN_SIZE */ + 1645, /* GL_TEXTURE_BLUE_SIZE */ + 1632, /* GL_TEXTURE_ALPHA_SIZE */ + 1720, /* GL_TEXTURE_LUMINANCE_SIZE */ + 1711, /* GL_TEXTURE_INTENSITY_SIZE */ + 1340, /* GL_REPLACE_EXT */ + 1271, /* GL_PROXY_TEXTURE_1D */ + 1274, /* GL_PROXY_TEXTURE_2D */ + 1744, /* GL_TEXTURE_TOO_LARGE_EXT */ + 1732, /* GL_TEXTURE_PRIORITY */ + 1739, /* GL_TEXTURE_RESIDENT */ + 1635, /* GL_TEXTURE_BINDING_1D */ + 1637, /* GL_TEXTURE_BINDING_2D */ + 1639, /* GL_TEXTURE_BINDING_3D */ + 1096, /* GL_PACK_SKIP_IMAGES */ + 1092, /* GL_PACK_IMAGE_HEIGHT */ + 1775, /* GL_UNPACK_SKIP_IMAGES */ + 1772, /* GL_UNPACK_IMAGE_HEIGHT */ + 1631, /* GL_TEXTURE_3D */ + 1277, /* GL_PROXY_TEXTURE_3D */ + 1694, /* GL_TEXTURE_DEPTH */ + 1747, /* GL_TEXTURE_WRAP_R */ + 856, /* GL_MAX_3D_TEXTURE_SIZE */ + 1809, /* GL_VERTEX_ARRAY */ + 1026, /* GL_NORMAL_ARRAY */ 148, /* GL_COLOR_ARRAY */ - 624, /* GL_INDEX_ARRAY */ - 1655, /* GL_TEXTURE_COORD_ARRAY */ - 456, /* GL_EDGE_FLAG_ARRAY */ - 1796, /* GL_VERTEX_ARRAY_SIZE */ - 1798, /* GL_VERTEX_ARRAY_TYPE */ - 1797, /* GL_VERTEX_ARRAY_STRIDE */ - 1021, /* GL_NORMAL_ARRAY_TYPE */ - 1020, /* GL_NORMAL_ARRAY_STRIDE */ + 631, /* GL_INDEX_ARRAY */ + 1672, /* GL_TEXTURE_COORD_ARRAY */ + 459, /* GL_EDGE_FLAG_ARRAY */ + 1815, /* GL_VERTEX_ARRAY_SIZE */ + 1817, /* GL_VERTEX_ARRAY_TYPE */ + 1816, /* GL_VERTEX_ARRAY_STRIDE */ + 1031, /* GL_NORMAL_ARRAY_TYPE */ + 1030, /* GL_NORMAL_ARRAY_STRIDE */ 152, /* GL_COLOR_ARRAY_SIZE */ 154, /* GL_COLOR_ARRAY_TYPE */ 153, /* GL_COLOR_ARRAY_STRIDE */ - 629, /* GL_INDEX_ARRAY_TYPE */ - 628, /* GL_INDEX_ARRAY_STRIDE */ - 1659, /* GL_TEXTURE_COORD_ARRAY_SIZE */ - 1661, /* GL_TEXTURE_COORD_ARRAY_TYPE */ - 1660, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ - 460, /* GL_EDGE_FLAG_ARRAY_STRIDE */ - 1795, /* GL_VERTEX_ARRAY_POINTER */ - 1019, /* GL_NORMAL_ARRAY_POINTER */ + 636, /* GL_INDEX_ARRAY_TYPE */ + 635, /* GL_INDEX_ARRAY_STRIDE */ + 1676, /* GL_TEXTURE_COORD_ARRAY_SIZE */ + 1678, /* GL_TEXTURE_COORD_ARRAY_TYPE */ + 1677, /* GL_TEXTURE_COORD_ARRAY_STRIDE */ + 463, /* GL_EDGE_FLAG_ARRAY_STRIDE */ + 1814, /* GL_VERTEX_ARRAY_POINTER */ + 1029, /* GL_NORMAL_ARRAY_POINTER */ 151, /* GL_COLOR_ARRAY_POINTER */ - 627, /* GL_INDEX_ARRAY_POINTER */ - 1658, /* GL_TEXTURE_COORD_ARRAY_POINTER */ - 459, /* GL_EDGE_FLAG_ARRAY_POINTER */ - 995, /* GL_MULTISAMPLE */ - 1386, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ - 1388, /* GL_SAMPLE_ALPHA_TO_ONE */ - 1393, /* GL_SAMPLE_COVERAGE */ - 1390, /* GL_SAMPLE_BUFFERS */ - 1381, /* GL_SAMPLES */ - 1397, /* GL_SAMPLE_COVERAGE_VALUE */ - 1395, /* GL_SAMPLE_COVERAGE_INVERT */ + 634, /* GL_INDEX_ARRAY_POINTER */ + 1675, /* GL_TEXTURE_COORD_ARRAY_POINTER */ + 462, /* GL_EDGE_FLAG_ARRAY_POINTER */ + 1005, /* GL_MULTISAMPLE */ + 1399, /* GL_SAMPLE_ALPHA_TO_COVERAGE */ + 1401, /* GL_SAMPLE_ALPHA_TO_ONE */ + 1406, /* GL_SAMPLE_COVERAGE */ + 1403, /* GL_SAMPLE_BUFFERS */ + 1394, /* GL_SAMPLES */ + 1410, /* GL_SAMPLE_COVERAGE_VALUE */ + 1408, /* GL_SAMPLE_COVERAGE_INVERT */ 195, /* GL_COLOR_MATRIX */ 197, /* GL_COLOR_MATRIX_STACK_DEPTH */ - 857, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ - 1191, /* GL_POST_COLOR_MATRIX_RED_SCALE */ - 1187, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ - 1182, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ - 1178, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ - 1189, /* GL_POST_COLOR_MATRIX_RED_BIAS */ - 1185, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ - 1180, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ - 1176, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ - 1638, /* GL_TEXTURE_COLOR_TABLE_SGI */ - 1268, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ - 1640, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ + 865, /* GL_MAX_COLOR_MATRIX_STACK_DEPTH */ + 1201, /* GL_POST_COLOR_MATRIX_RED_SCALE */ + 1197, /* GL_POST_COLOR_MATRIX_GREEN_SCALE */ + 1192, /* GL_POST_COLOR_MATRIX_BLUE_SCALE */ + 1188, /* GL_POST_COLOR_MATRIX_ALPHA_SCALE */ + 1199, /* GL_POST_COLOR_MATRIX_RED_BIAS */ + 1195, /* GL_POST_COLOR_MATRIX_GREEN_BIAS */ + 1190, /* GL_POST_COLOR_MATRIX_BLUE_BIAS */ + 1186, /* GL_POST_COLOR_MATRIX_ALPHA_BIAS */ + 1655, /* GL_TEXTURE_COLOR_TABLE_SGI */ + 1278, /* GL_PROXY_TEXTURE_COLOR_TABLE_SGI */ + 1657, /* GL_TEXTURE_COMPARE_FAIL_VALUE_ARB */ 80, /* GL_BLEND_DST_RGB */ 89, /* GL_BLEND_SRC_RGB */ 79, /* GL_BLEND_DST_ALPHA */ 88, /* GL_BLEND_SRC_ALPHA */ 201, /* GL_COLOR_TABLE */ - 1201, /* GL_POST_CONVOLUTION_COLOR_TABLE */ - 1184, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ - 1256, /* GL_PROXY_COLOR_TABLE */ - 1260, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ - 1259, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ + 1211, /* GL_POST_CONVOLUTION_COLOR_TABLE */ + 1194, /* GL_POST_COLOR_MATRIX_COLOR_TABLE */ + 1266, /* GL_PROXY_COLOR_TABLE */ + 1270, /* GL_PROXY_POST_CONVOLUTION_COLOR_TABLE */ + 1269, /* GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE */ 225, /* GL_COLOR_TABLE_SCALE */ 205, /* GL_COLOR_TABLE_BIAS */ 210, /* GL_COLOR_TABLE_FORMAT */ @@ -4379,380 +4417,380 @@ static const unsigned reduced_enums[1347] = 216, /* GL_COLOR_TABLE_INTENSITY_SIZE */ 71, /* GL_BGR */ 72, /* GL_BGRA */ - 871, /* GL_MAX_ELEMENTS_VERTICES */ - 870, /* GL_MAX_ELEMENTS_INDICES */ - 1693, /* GL_TEXTURE_INDEX_SIZE_EXT */ + 879, /* GL_MAX_ELEMENTS_VERTICES */ + 878, /* GL_MAX_ELEMENTS_INDICES */ + 1710, /* GL_TEXTURE_INDEX_SIZE_EXT */ 145, /* GL_CLIP_VOLUME_CLIPPING_HINT_EXT */ - 1148, /* GL_POINT_SIZE_MIN */ - 1144, /* GL_POINT_SIZE_MAX */ - 1138, /* GL_POINT_FADE_THRESHOLD_SIZE */ - 1134, /* GL_POINT_DISTANCE_ATTENUATION */ + 1158, /* GL_POINT_SIZE_MIN */ + 1154, /* GL_POINT_SIZE_MAX */ + 1148, /* GL_POINT_FADE_THRESHOLD_SIZE */ + 1144, /* GL_POINT_DISTANCE_ATTENUATION */ 127, /* GL_CLAMP_TO_BORDER */ 130, /* GL_CLAMP_TO_EDGE */ - 1714, /* GL_TEXTURE_MIN_LOD */ - 1712, /* GL_TEXTURE_MAX_LOD */ - 1617, /* GL_TEXTURE_BASE_LEVEL */ - 1711, /* GL_TEXTURE_MAX_LEVEL */ - 617, /* GL_IGNORE_BORDER_HP */ + 1731, /* GL_TEXTURE_MIN_LOD */ + 1729, /* GL_TEXTURE_MAX_LOD */ + 1634, /* GL_TEXTURE_BASE_LEVEL */ + 1728, /* GL_TEXTURE_MAX_LEVEL */ + 624, /* GL_IGNORE_BORDER_HP */ 276, /* GL_CONSTANT_BORDER_HP */ - 1328, /* GL_REPLICATE_BORDER_HP */ + 1341, /* GL_REPLICATE_BORDER_HP */ 282, /* GL_CONVOLUTION_BORDER_COLOR */ - 1045, /* GL_OCCLUSION_TEST_HP */ - 1046, /* GL_OCCLUSION_TEST_RESULT_HP */ - 690, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ - 1632, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ - 1634, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ - 1636, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ - 1637, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - 1635, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ - 1633, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ - 853, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ - 854, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ - 1211, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ - 1213, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ - 1210, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ - 1212, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ - 1701, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ - 1702, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ - 1700, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ - 587, /* GL_GENERATE_MIPMAP */ - 588, /* GL_GENERATE_MIPMAP_HINT */ - 529, /* GL_FOG_OFFSET_SGIX */ - 530, /* GL_FOG_OFFSET_VALUE_SGIX */ - 1646, /* GL_TEXTURE_COMPARE_SGIX */ - 1645, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ - 1697, /* GL_TEXTURE_LEQUAL_R_SGIX */ - 1689, /* GL_TEXTURE_GEQUAL_R_SGIX */ - 359, /* GL_DEPTH_COMPONENT16 */ - 362, /* GL_DEPTH_COMPONENT24 */ - 365, /* GL_DEPTH_COMPONENT32 */ + 1055, /* GL_OCCLUSION_TEST_HP */ + 1056, /* GL_OCCLUSION_TEST_RESULT_HP */ + 697, /* GL_LINEAR_CLIPMAP_LINEAR_SGIX */ + 1649, /* GL_TEXTURE_CLIPMAP_CENTER_SGIX */ + 1651, /* GL_TEXTURE_CLIPMAP_FRAME_SGIX */ + 1653, /* GL_TEXTURE_CLIPMAP_OFFSET_SGIX */ + 1654, /* GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + 1652, /* GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX */ + 1650, /* GL_TEXTURE_CLIPMAP_DEPTH_SGIX */ + 860, /* GL_MAX_CLIPMAP_DEPTH_SGIX */ + 861, /* GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX */ + 1221, /* GL_POST_TEXTURE_FILTER_BIAS_SGIX */ + 1223, /* GL_POST_TEXTURE_FILTER_SCALE_SGIX */ + 1220, /* GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX */ + 1222, /* GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX */ + 1718, /* GL_TEXTURE_LOD_BIAS_S_SGIX */ + 1719, /* GL_TEXTURE_LOD_BIAS_T_SGIX */ + 1717, /* GL_TEXTURE_LOD_BIAS_R_SGIX */ + 594, /* GL_GENERATE_MIPMAP */ + 595, /* GL_GENERATE_MIPMAP_HINT */ + 532, /* GL_FOG_OFFSET_SGIX */ + 533, /* GL_FOG_OFFSET_VALUE_SGIX */ + 1663, /* GL_TEXTURE_COMPARE_SGIX */ + 1662, /* GL_TEXTURE_COMPARE_OPERATOR_SGIX */ + 1714, /* GL_TEXTURE_LEQUAL_R_SGIX */ + 1706, /* GL_TEXTURE_GEQUAL_R_SGIX */ + 360, /* GL_DEPTH_COMPONENT16 */ + 363, /* GL_DEPTH_COMPONENT24 */ + 366, /* GL_DEPTH_COMPONENT32 */ 306, /* GL_CULL_VERTEX_EXT */ 308, /* GL_CULL_VERTEX_OBJECT_POSITION_EXT */ 307, /* GL_CULL_VERTEX_EYE_POSITION_EXT */ - 1853, /* GL_WRAP_BORDER_SUN */ - 1639, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ - 683, /* GL_LIGHT_MODEL_COLOR_CONTROL */ - 1427, /* GL_SINGLE_COLOR */ - 1413, /* GL_SEPARATE_SPECULAR_COLOR */ - 1422, /* GL_SHARED_TEXTURE_PALETTE_EXT */ - 540, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ - 541, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ - 548, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ - 543, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ - 539, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ - 538, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ - 542, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ - 549, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ - 560, /* GL_FRAMEBUFFER_DEFAULT */ - 573, /* GL_FRAMEBUFFER_UNDEFINED */ - 372, /* GL_DEPTH_STENCIL_ATTACHMENT */ - 623, /* GL_INDEX */ - 1763, /* GL_UNSIGNED_BYTE_2_3_3_REV */ - 1778, /* GL_UNSIGNED_SHORT_5_6_5 */ - 1779, /* GL_UNSIGNED_SHORT_5_6_5_REV */ - 1776, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ - 1774, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ - 1771, /* GL_UNSIGNED_INT_8_8_8_8_REV */ - 1769, /* GL_UNSIGNED_INT_2_10_10_10_REV */ - 1709, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ - 1710, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ - 1708, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ - 946, /* GL_MIRRORED_REPEAT */ - 1369, /* GL_RGB_S3TC */ - 1344, /* GL_RGB4_S3TC */ - 1367, /* GL_RGBA_S3TC */ - 1361, /* GL_RGBA4_S3TC */ - 1365, /* GL_RGBA_DXT5_S3TC */ - 1359, /* GL_RGBA4_DXT5_S3TC */ + 1872, /* GL_WRAP_BORDER_SUN */ + 1656, /* GL_TEXTURE_COLOR_WRITEMASK_SGIS */ + 690, /* GL_LIGHT_MODEL_COLOR_CONTROL */ + 1440, /* GL_SINGLE_COLOR */ + 1426, /* GL_SEPARATE_SPECULAR_COLOR */ + 1435, /* GL_SHARED_TEXTURE_PALETTE_EXT */ + 543, /* GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING */ + 544, /* GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE */ + 551, /* GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE */ + 546, /* GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE */ + 542, /* GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE */ + 541, /* GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE */ + 545, /* GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE */ + 552, /* GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE */ + 564, /* GL_FRAMEBUFFER_DEFAULT */ + 580, /* GL_FRAMEBUFFER_UNDEFINED */ + 373, /* GL_DEPTH_STENCIL_ATTACHMENT */ + 630, /* GL_INDEX */ + 1781, /* GL_UNSIGNED_BYTE_2_3_3_REV */ + 1797, /* GL_UNSIGNED_SHORT_5_6_5 */ + 1798, /* GL_UNSIGNED_SHORT_5_6_5_REV */ + 1795, /* GL_UNSIGNED_SHORT_4_4_4_4_REV */ + 1793, /* GL_UNSIGNED_SHORT_1_5_5_5_REV */ + 1790, /* GL_UNSIGNED_INT_8_8_8_8_REV */ + 1788, /* GL_UNSIGNED_INT_2_10_10_10_REV */ + 1726, /* GL_TEXTURE_MAX_CLAMP_S_SGIX */ + 1727, /* GL_TEXTURE_MAX_CLAMP_T_SGIX */ + 1725, /* GL_TEXTURE_MAX_CLAMP_R_SGIX */ + 956, /* GL_MIRRORED_REPEAT */ + 1382, /* GL_RGB_S3TC */ + 1357, /* GL_RGB4_S3TC */ + 1380, /* GL_RGBA_S3TC */ + 1374, /* GL_RGBA4_S3TC */ + 1378, /* GL_RGBA_DXT5_S3TC */ + 1372, /* GL_RGBA4_DXT5_S3TC */ 264, /* GL_COMPRESSED_RGB_S3TC_DXT1_EXT */ 259, /* GL_COMPRESSED_RGBA_S3TC_DXT1_EXT */ 260, /* GL_COMPRESSED_RGBA_S3TC_DXT3_EXT */ 261, /* GL_COMPRESSED_RGBA_S3TC_DXT5_EXT */ - 1007, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ - 1006, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ - 691, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ - 516, /* GL_FOG_COORDINATE_SOURCE */ - 508, /* GL_FOG_COORD */ - 532, /* GL_FRAGMENT_DEPTH */ + 1017, /* GL_NEAREST_CLIPMAP_NEAREST_SGIX */ + 1016, /* GL_NEAREST_CLIPMAP_LINEAR_SGIX */ + 698, /* GL_LINEAR_CLIPMAP_NEAREST_SGIX */ + 519, /* GL_FOG_COORDINATE_SOURCE */ + 511, /* GL_FOG_COORD */ + 535, /* GL_FRAGMENT_DEPTH */ 312, /* GL_CURRENT_FOG_COORD */ - 515, /* GL_FOG_COORDINATE_ARRAY_TYPE */ - 514, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ - 513, /* GL_FOG_COORDINATE_ARRAY_POINTER */ - 510, /* GL_FOG_COORDINATE_ARRAY */ + 518, /* GL_FOG_COORDINATE_ARRAY_TYPE */ + 517, /* GL_FOG_COORDINATE_ARRAY_STRIDE */ + 516, /* GL_FOG_COORDINATE_ARRAY_POINTER */ + 513, /* GL_FOG_COORDINATE_ARRAY */ 199, /* GL_COLOR_SUM */ 332, /* GL_CURRENT_SECONDARY_COLOR */ - 1406, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ - 1408, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ - 1407, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ - 1405, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ - 1402, /* GL_SECONDARY_COLOR_ARRAY */ + 1419, /* GL_SECONDARY_COLOR_ARRAY_SIZE */ + 1421, /* GL_SECONDARY_COLOR_ARRAY_TYPE */ + 1420, /* GL_SECONDARY_COLOR_ARRAY_STRIDE */ + 1418, /* GL_SECONDARY_COLOR_ARRAY_POINTER */ + 1415, /* GL_SECONDARY_COLOR_ARRAY */ 330, /* GL_CURRENT_RASTER_SECONDARY_COLOR */ 28, /* GL_ALIASED_POINT_SIZE_RANGE */ 27, /* GL_ALIASED_LINE_WIDTH_RANGE */ - 1546, /* GL_TEXTURE0 */ - 1548, /* GL_TEXTURE1 */ - 1570, /* GL_TEXTURE2 */ - 1592, /* GL_TEXTURE3 */ - 1598, /* GL_TEXTURE4 */ - 1600, /* GL_TEXTURE5 */ - 1602, /* GL_TEXTURE6 */ - 1604, /* GL_TEXTURE7 */ - 1606, /* GL_TEXTURE8 */ - 1608, /* GL_TEXTURE9 */ - 1549, /* GL_TEXTURE10 */ - 1551, /* GL_TEXTURE11 */ - 1553, /* GL_TEXTURE12 */ - 1555, /* GL_TEXTURE13 */ - 1557, /* GL_TEXTURE14 */ - 1559, /* GL_TEXTURE15 */ - 1561, /* GL_TEXTURE16 */ - 1563, /* GL_TEXTURE17 */ - 1565, /* GL_TEXTURE18 */ - 1567, /* GL_TEXTURE19 */ - 1571, /* GL_TEXTURE20 */ - 1573, /* GL_TEXTURE21 */ - 1575, /* GL_TEXTURE22 */ - 1577, /* GL_TEXTURE23 */ - 1579, /* GL_TEXTURE24 */ - 1581, /* GL_TEXTURE25 */ - 1583, /* GL_TEXTURE26 */ - 1585, /* GL_TEXTURE27 */ - 1587, /* GL_TEXTURE28 */ - 1589, /* GL_TEXTURE29 */ - 1593, /* GL_TEXTURE30 */ - 1595, /* GL_TEXTURE31 */ + 1563, /* GL_TEXTURE0 */ + 1565, /* GL_TEXTURE1 */ + 1587, /* GL_TEXTURE2 */ + 1609, /* GL_TEXTURE3 */ + 1615, /* GL_TEXTURE4 */ + 1617, /* GL_TEXTURE5 */ + 1619, /* GL_TEXTURE6 */ + 1621, /* GL_TEXTURE7 */ + 1623, /* GL_TEXTURE8 */ + 1625, /* GL_TEXTURE9 */ + 1566, /* GL_TEXTURE10 */ + 1568, /* GL_TEXTURE11 */ + 1570, /* GL_TEXTURE12 */ + 1572, /* GL_TEXTURE13 */ + 1574, /* GL_TEXTURE14 */ + 1576, /* GL_TEXTURE15 */ + 1578, /* GL_TEXTURE16 */ + 1580, /* GL_TEXTURE17 */ + 1582, /* GL_TEXTURE18 */ + 1584, /* GL_TEXTURE19 */ + 1588, /* GL_TEXTURE20 */ + 1590, /* GL_TEXTURE21 */ + 1592, /* GL_TEXTURE22 */ + 1594, /* GL_TEXTURE23 */ + 1596, /* GL_TEXTURE24 */ + 1598, /* GL_TEXTURE25 */ + 1600, /* GL_TEXTURE26 */ + 1602, /* GL_TEXTURE27 */ + 1604, /* GL_TEXTURE28 */ + 1606, /* GL_TEXTURE29 */ + 1610, /* GL_TEXTURE30 */ + 1612, /* GL_TEXTURE31 */ 18, /* GL_ACTIVE_TEXTURE */ 133, /* GL_CLIENT_ACTIVE_TEXTURE */ - 924, /* GL_MAX_TEXTURE_UNITS */ - 1741, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ - 1744, /* GL_TRANSPOSE_PROJECTION_MATRIX */ - 1746, /* GL_TRANSPOSE_TEXTURE_MATRIX */ - 1738, /* GL_TRANSPOSE_COLOR_MATRIX */ - 1528, /* GL_SUBTRACT */ - 911, /* GL_MAX_RENDERBUFFER_SIZE_EXT */ + 934, /* GL_MAX_TEXTURE_UNITS */ + 1759, /* GL_TRANSPOSE_MODELVIEW_MATRIX */ + 1762, /* GL_TRANSPOSE_PROJECTION_MATRIX */ + 1764, /* GL_TRANSPOSE_TEXTURE_MATRIX */ + 1756, /* GL_TRANSPOSE_COLOR_MATRIX */ + 1545, /* GL_SUBTRACT */ + 919, /* GL_MAX_RENDERBUFFER_SIZE */ 247, /* GL_COMPRESSED_ALPHA */ 251, /* GL_COMPRESSED_LUMINANCE */ 252, /* GL_COMPRESSED_LUMINANCE_ALPHA */ 249, /* GL_COMPRESSED_INTENSITY */ 255, /* GL_COMPRESSED_RGB */ 256, /* GL_COMPRESSED_RGBA */ - 1653, /* GL_TEXTURE_COMPRESSION_HINT */ - 1718, /* GL_TEXTURE_RECTANGLE_ARB */ - 1625, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ - 1271, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ - 909, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ - 371, /* GL_DEPTH_STENCIL */ - 1767, /* GL_UNSIGNED_INT_24_8 */ - 920, /* GL_MAX_TEXTURE_LOD_BIAS */ - 1707, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ - 921, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ - 1683, /* GL_TEXTURE_FILTER_CONTROL */ - 1698, /* GL_TEXTURE_LOD_BIAS */ + 1670, /* GL_TEXTURE_COMPRESSION_HINT */ + 1735, /* GL_TEXTURE_RECTANGLE_ARB */ + 1642, /* GL_TEXTURE_BINDING_RECTANGLE_ARB */ + 1281, /* GL_PROXY_TEXTURE_RECTANGLE_ARB */ + 917, /* GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB */ + 372, /* GL_DEPTH_STENCIL */ + 1785, /* GL_UNSIGNED_INT_24_8 */ + 930, /* GL_MAX_TEXTURE_LOD_BIAS */ + 1724, /* GL_TEXTURE_MAX_ANISOTROPY_EXT */ + 931, /* GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT */ + 1700, /* GL_TEXTURE_FILTER_CONTROL */ + 1715, /* GL_TEXTURE_LOD_BIAS */ 232, /* GL_COMBINE4 */ - 914, /* GL_MAX_SHININESS_NV */ - 915, /* GL_MAX_SPOT_EXPONENT_NV */ - 621, /* GL_INCR_WRAP */ + 924, /* GL_MAX_SHININESS_NV */ + 925, /* GL_MAX_SPOT_EXPONENT_NV */ + 628, /* GL_INCR_WRAP */ 343, /* GL_DECR_WRAP */ - 966, /* GL_MODELVIEW1_ARB */ - 1022, /* GL_NORMAL_MAP */ - 1303, /* GL_REFLECTION_MAP */ - 1662, /* GL_TEXTURE_CUBE_MAP */ - 1623, /* GL_TEXTURE_BINDING_CUBE_MAP */ - 1670, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ - 1664, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ - 1672, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ - 1666, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ - 1674, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ - 1668, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ - 1269, /* GL_PROXY_TEXTURE_CUBE_MAP */ - 865, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ - 1001, /* GL_MULTISAMPLE_FILTER_HINT_NV */ - 524, /* GL_FOG_DISTANCE_MODE_NV */ - 475, /* GL_EYE_RADIAL_NV */ - 474, /* GL_EYE_PLANE_ABSOLUTE_NV */ + 976, /* GL_MODELVIEW1_ARB */ + 1032, /* GL_NORMAL_MAP */ + 1314, /* GL_REFLECTION_MAP */ + 1679, /* GL_TEXTURE_CUBE_MAP */ + 1640, /* GL_TEXTURE_BINDING_CUBE_MAP */ + 1687, /* GL_TEXTURE_CUBE_MAP_POSITIVE_X */ + 1681, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_X */ + 1689, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Y */ + 1683, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Y */ + 1691, /* GL_TEXTURE_CUBE_MAP_POSITIVE_Z */ + 1685, /* GL_TEXTURE_CUBE_MAP_NEGATIVE_Z */ + 1279, /* GL_PROXY_TEXTURE_CUBE_MAP */ + 873, /* GL_MAX_CUBE_MAP_TEXTURE_SIZE */ + 1011, /* GL_MULTISAMPLE_FILTER_HINT_NV */ + 527, /* GL_FOG_DISTANCE_MODE_NV */ + 478, /* GL_EYE_RADIAL_NV */ + 477, /* GL_EYE_PLANE_ABSOLUTE_NV */ 231, /* GL_COMBINE */ 238, /* GL_COMBINE_RGB */ 233, /* GL_COMBINE_ALPHA */ - 1370, /* GL_RGB_SCALE */ + 1383, /* GL_RGB_SCALE */ 24, /* GL_ADD_SIGNED */ - 649, /* GL_INTERPOLATE */ + 656, /* GL_INTERPOLATE */ 271, /* GL_CONSTANT */ - 1217, /* GL_PRIMARY_COLOR */ - 1214, /* GL_PREVIOUS */ - 1442, /* GL_SOURCE0_RGB */ - 1448, /* GL_SOURCE1_RGB */ - 1454, /* GL_SOURCE2_RGB */ - 1458, /* GL_SOURCE3_RGB_NV */ - 1439, /* GL_SOURCE0_ALPHA */ - 1445, /* GL_SOURCE1_ALPHA */ - 1451, /* GL_SOURCE2_ALPHA */ - 1457, /* GL_SOURCE3_ALPHA_NV */ - 1059, /* GL_OPERAND0_RGB */ - 1065, /* GL_OPERAND1_RGB */ - 1071, /* GL_OPERAND2_RGB */ - 1075, /* GL_OPERAND3_RGB_NV */ - 1056, /* GL_OPERAND0_ALPHA */ - 1062, /* GL_OPERAND1_ALPHA */ - 1068, /* GL_OPERAND2_ALPHA */ - 1074, /* GL_OPERAND3_ALPHA_NV */ - 1791, /* GL_VERTEX_ARRAY_BINDING */ - 1716, /* GL_TEXTURE_RANGE_LENGTH_APPLE */ - 1717, /* GL_TEXTURE_RANGE_POINTER_APPLE */ - 1857, /* GL_YCBCR_422_APPLE */ - 1780, /* GL_UNSIGNED_SHORT_8_8_APPLE */ - 1782, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ - 1725, /* GL_TEXTURE_STORAGE_HINT_APPLE */ - 1519, /* GL_STORAGE_PRIVATE_APPLE */ - 1518, /* GL_STORAGE_CACHED_APPLE */ - 1520, /* GL_STORAGE_SHARED_APPLE */ - 1429, /* GL_SLICE_ACCUM_SUN */ - 1278, /* GL_QUAD_MESH_SUN */ - 1750, /* GL_TRIANGLE_MESH_SUN */ - 1830, /* GL_VERTEX_PROGRAM_ARB */ - 1841, /* GL_VERTEX_STATE_PROGRAM_NV */ - 1817, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ - 1823, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ - 1825, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ - 1827, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ + 1227, /* GL_PRIMARY_COLOR */ + 1224, /* GL_PREVIOUS */ + 1455, /* GL_SOURCE0_RGB */ + 1461, /* GL_SOURCE1_RGB */ + 1467, /* GL_SOURCE2_RGB */ + 1471, /* GL_SOURCE3_RGB_NV */ + 1452, /* GL_SOURCE0_ALPHA */ + 1458, /* GL_SOURCE1_ALPHA */ + 1464, /* GL_SOURCE2_ALPHA */ + 1470, /* GL_SOURCE3_ALPHA_NV */ + 1069, /* GL_OPERAND0_RGB */ + 1075, /* GL_OPERAND1_RGB */ + 1081, /* GL_OPERAND2_RGB */ + 1085, /* GL_OPERAND3_RGB_NV */ + 1066, /* GL_OPERAND0_ALPHA */ + 1072, /* GL_OPERAND1_ALPHA */ + 1078, /* GL_OPERAND2_ALPHA */ + 1084, /* GL_OPERAND3_ALPHA_NV */ + 1810, /* GL_VERTEX_ARRAY_BINDING */ + 1733, /* GL_TEXTURE_RANGE_LENGTH_APPLE */ + 1734, /* GL_TEXTURE_RANGE_POINTER_APPLE */ + 1876, /* GL_YCBCR_422_APPLE */ + 1799, /* GL_UNSIGNED_SHORT_8_8_APPLE */ + 1801, /* GL_UNSIGNED_SHORT_8_8_REV_APPLE */ + 1743, /* GL_TEXTURE_STORAGE_HINT_APPLE */ + 1536, /* GL_STORAGE_PRIVATE_APPLE */ + 1535, /* GL_STORAGE_CACHED_APPLE */ + 1537, /* GL_STORAGE_SHARED_APPLE */ + 1442, /* GL_SLICE_ACCUM_SUN */ + 1288, /* GL_QUAD_MESH_SUN */ + 1768, /* GL_TRIANGLE_MESH_SUN */ + 1849, /* GL_VERTEX_PROGRAM_ARB */ + 1860, /* GL_VERTEX_STATE_PROGRAM_NV */ + 1836, /* GL_VERTEX_ATTRIB_ARRAY_ENABLED */ + 1842, /* GL_VERTEX_ATTRIB_ARRAY_SIZE */ + 1844, /* GL_VERTEX_ATTRIB_ARRAY_STRIDE */ + 1846, /* GL_VERTEX_ATTRIB_ARRAY_TYPE */ 334, /* GL_CURRENT_VERTEX_ATTRIB */ - 1230, /* GL_PROGRAM_LENGTH_ARB */ - 1244, /* GL_PROGRAM_STRING_ARB */ - 988, /* GL_MODELVIEW_PROJECTION_NV */ - 616, /* GL_IDENTITY_NV */ - 663, /* GL_INVERSE_NV */ - 1743, /* GL_TRANSPOSE_NV */ - 664, /* GL_INVERSE_TRANSPOSE_NV */ - 895, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ - 894, /* GL_MAX_PROGRAM_MATRICES_ARB */ - 802, /* GL_MATRIX0_NV */ - 814, /* GL_MATRIX1_NV */ - 826, /* GL_MATRIX2_NV */ - 830, /* GL_MATRIX3_NV */ - 832, /* GL_MATRIX4_NV */ - 834, /* GL_MATRIX5_NV */ - 836, /* GL_MATRIX6_NV */ - 838, /* GL_MATRIX7_NV */ + 1240, /* GL_PROGRAM_LENGTH_ARB */ + 1254, /* GL_PROGRAM_STRING_ARB */ + 998, /* GL_MODELVIEW_PROJECTION_NV */ + 623, /* GL_IDENTITY_NV */ + 670, /* GL_INVERSE_NV */ + 1761, /* GL_TRANSPOSE_NV */ + 671, /* GL_INVERSE_TRANSPOSE_NV */ + 903, /* GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB */ + 902, /* GL_MAX_PROGRAM_MATRICES_ARB */ + 809, /* GL_MATRIX0_NV */ + 821, /* GL_MATRIX1_NV */ + 833, /* GL_MATRIX2_NV */ + 837, /* GL_MATRIX3_NV */ + 839, /* GL_MATRIX4_NV */ + 841, /* GL_MATRIX5_NV */ + 843, /* GL_MATRIX6_NV */ + 845, /* GL_MATRIX7_NV */ 318, /* GL_CURRENT_MATRIX_STACK_DEPTH_ARB */ 315, /* GL_CURRENT_MATRIX_ARB */ - 1833, /* GL_VERTEX_PROGRAM_POINT_SIZE */ - 1836, /* GL_VERTEX_PROGRAM_TWO_SIDE */ - 1242, /* GL_PROGRAM_PARAMETER_NV */ - 1821, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ - 1246, /* GL_PROGRAM_TARGET_NV */ - 1243, /* GL_PROGRAM_RESIDENT_NV */ - 1735, /* GL_TRACK_MATRIX_NV */ - 1736, /* GL_TRACK_MATRIX_TRANSFORM_NV */ - 1831, /* GL_VERTEX_PROGRAM_BINDING_NV */ - 1224, /* GL_PROGRAM_ERROR_POSITION_ARB */ - 355, /* GL_DEPTH_CLAMP */ - 1799, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ - 1806, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ - 1807, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ - 1808, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ - 1809, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ - 1810, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ - 1811, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ - 1812, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ - 1813, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ - 1814, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ - 1800, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ - 1801, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ - 1802, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ - 1803, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ - 1804, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ - 1805, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ - 750, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ - 757, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ - 758, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ - 759, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ - 760, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ - 761, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ - 762, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ - 763, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ - 764, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ - 765, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ - 751, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ - 752, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ - 753, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ - 754, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ - 755, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ - 756, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ - 777, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ - 784, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ - 785, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ - 786, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ - 787, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ - 788, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ - 789, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ - 1223, /* GL_PROGRAM_BINDING_ARB */ - 791, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ - 792, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ - 778, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ - 779, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ - 780, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ - 781, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ - 782, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ - 783, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ - 1651, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ - 1648, /* GL_TEXTURE_COMPRESSED */ - 1027, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ + 1852, /* GL_VERTEX_PROGRAM_POINT_SIZE */ + 1855, /* GL_VERTEX_PROGRAM_TWO_SIDE */ + 1252, /* GL_PROGRAM_PARAMETER_NV */ + 1840, /* GL_VERTEX_ATTRIB_ARRAY_POINTER */ + 1256, /* GL_PROGRAM_TARGET_NV */ + 1253, /* GL_PROGRAM_RESIDENT_NV */ + 1753, /* GL_TRACK_MATRIX_NV */ + 1754, /* GL_TRACK_MATRIX_TRANSFORM_NV */ + 1850, /* GL_VERTEX_PROGRAM_BINDING_NV */ + 1234, /* GL_PROGRAM_ERROR_POSITION_ARB */ + 356, /* GL_DEPTH_CLAMP */ + 1818, /* GL_VERTEX_ATTRIB_ARRAY0_NV */ + 1825, /* GL_VERTEX_ATTRIB_ARRAY1_NV */ + 1826, /* GL_VERTEX_ATTRIB_ARRAY2_NV */ + 1827, /* GL_VERTEX_ATTRIB_ARRAY3_NV */ + 1828, /* GL_VERTEX_ATTRIB_ARRAY4_NV */ + 1829, /* GL_VERTEX_ATTRIB_ARRAY5_NV */ + 1830, /* GL_VERTEX_ATTRIB_ARRAY6_NV */ + 1831, /* GL_VERTEX_ATTRIB_ARRAY7_NV */ + 1832, /* GL_VERTEX_ATTRIB_ARRAY8_NV */ + 1833, /* GL_VERTEX_ATTRIB_ARRAY9_NV */ + 1819, /* GL_VERTEX_ATTRIB_ARRAY10_NV */ + 1820, /* GL_VERTEX_ATTRIB_ARRAY11_NV */ + 1821, /* GL_VERTEX_ATTRIB_ARRAY12_NV */ + 1822, /* GL_VERTEX_ATTRIB_ARRAY13_NV */ + 1823, /* GL_VERTEX_ATTRIB_ARRAY14_NV */ + 1824, /* GL_VERTEX_ATTRIB_ARRAY15_NV */ + 757, /* GL_MAP1_VERTEX_ATTRIB0_4_NV */ + 764, /* GL_MAP1_VERTEX_ATTRIB1_4_NV */ + 765, /* GL_MAP1_VERTEX_ATTRIB2_4_NV */ + 766, /* GL_MAP1_VERTEX_ATTRIB3_4_NV */ + 767, /* GL_MAP1_VERTEX_ATTRIB4_4_NV */ + 768, /* GL_MAP1_VERTEX_ATTRIB5_4_NV */ + 769, /* GL_MAP1_VERTEX_ATTRIB6_4_NV */ + 770, /* GL_MAP1_VERTEX_ATTRIB7_4_NV */ + 771, /* GL_MAP1_VERTEX_ATTRIB8_4_NV */ + 772, /* GL_MAP1_VERTEX_ATTRIB9_4_NV */ + 758, /* GL_MAP1_VERTEX_ATTRIB10_4_NV */ + 759, /* GL_MAP1_VERTEX_ATTRIB11_4_NV */ + 760, /* GL_MAP1_VERTEX_ATTRIB12_4_NV */ + 761, /* GL_MAP1_VERTEX_ATTRIB13_4_NV */ + 762, /* GL_MAP1_VERTEX_ATTRIB14_4_NV */ + 763, /* GL_MAP1_VERTEX_ATTRIB15_4_NV */ + 784, /* GL_MAP2_VERTEX_ATTRIB0_4_NV */ + 791, /* GL_MAP2_VERTEX_ATTRIB1_4_NV */ + 792, /* GL_MAP2_VERTEX_ATTRIB2_4_NV */ + 793, /* GL_MAP2_VERTEX_ATTRIB3_4_NV */ + 794, /* GL_MAP2_VERTEX_ATTRIB4_4_NV */ + 795, /* GL_MAP2_VERTEX_ATTRIB5_4_NV */ + 796, /* GL_MAP2_VERTEX_ATTRIB6_4_NV */ + 1233, /* GL_PROGRAM_BINDING_ARB */ + 798, /* GL_MAP2_VERTEX_ATTRIB8_4_NV */ + 799, /* GL_MAP2_VERTEX_ATTRIB9_4_NV */ + 785, /* GL_MAP2_VERTEX_ATTRIB10_4_NV */ + 786, /* GL_MAP2_VERTEX_ATTRIB11_4_NV */ + 787, /* GL_MAP2_VERTEX_ATTRIB12_4_NV */ + 788, /* GL_MAP2_VERTEX_ATTRIB13_4_NV */ + 789, /* GL_MAP2_VERTEX_ATTRIB14_4_NV */ + 790, /* GL_MAP2_VERTEX_ATTRIB15_4_NV */ + 1668, /* GL_TEXTURE_COMPRESSED_IMAGE_SIZE */ + 1665, /* GL_TEXTURE_COMPRESSED */ + 1037, /* GL_NUM_COMPRESSED_TEXTURE_FORMATS */ 269, /* GL_COMPRESSED_TEXTURE_FORMATS */ - 936, /* GL_MAX_VERTEX_UNITS_ARB */ + 946, /* GL_MAX_VERTEX_UNITS_ARB */ 22, /* GL_ACTIVE_VERTEX_UNITS_ARB */ - 1852, /* GL_WEIGHT_SUM_UNITY_ARB */ - 1829, /* GL_VERTEX_BLEND_ARB */ + 1871, /* GL_WEIGHT_SUM_UNITY_ARB */ + 1848, /* GL_VERTEX_BLEND_ARB */ 336, /* GL_CURRENT_WEIGHT_ARB */ - 1851, /* GL_WEIGHT_ARRAY_TYPE_ARB */ - 1850, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ - 1849, /* GL_WEIGHT_ARRAY_SIZE_ARB */ - 1848, /* GL_WEIGHT_ARRAY_POINTER_ARB */ - 1845, /* GL_WEIGHT_ARRAY_ARB */ - 384, /* GL_DOT3_RGB */ - 385, /* GL_DOT3_RGBA */ + 1870, /* GL_WEIGHT_ARRAY_TYPE_ARB */ + 1869, /* GL_WEIGHT_ARRAY_STRIDE_ARB */ + 1868, /* GL_WEIGHT_ARRAY_SIZE_ARB */ + 1867, /* GL_WEIGHT_ARRAY_POINTER_ARB */ + 1864, /* GL_WEIGHT_ARRAY_ARB */ + 386, /* GL_DOT3_RGB */ + 387, /* GL_DOT3_RGBA */ 263, /* GL_COMPRESSED_RGB_FXT1_3DFX */ 258, /* GL_COMPRESSED_RGBA_FXT1_3DFX */ - 996, /* GL_MULTISAMPLE_3DFX */ - 1391, /* GL_SAMPLE_BUFFERS_3DFX */ - 1382, /* GL_SAMPLES_3DFX */ - 977, /* GL_MODELVIEW2_ARB */ - 980, /* GL_MODELVIEW3_ARB */ - 981, /* GL_MODELVIEW4_ARB */ - 982, /* GL_MODELVIEW5_ARB */ - 983, /* GL_MODELVIEW6_ARB */ - 984, /* GL_MODELVIEW7_ARB */ - 985, /* GL_MODELVIEW8_ARB */ - 986, /* GL_MODELVIEW9_ARB */ - 956, /* GL_MODELVIEW10_ARB */ - 957, /* GL_MODELVIEW11_ARB */ - 958, /* GL_MODELVIEW12_ARB */ - 959, /* GL_MODELVIEW13_ARB */ - 960, /* GL_MODELVIEW14_ARB */ - 961, /* GL_MODELVIEW15_ARB */ - 962, /* GL_MODELVIEW16_ARB */ - 963, /* GL_MODELVIEW17_ARB */ - 964, /* GL_MODELVIEW18_ARB */ - 965, /* GL_MODELVIEW19_ARB */ - 967, /* GL_MODELVIEW20_ARB */ - 968, /* GL_MODELVIEW21_ARB */ - 969, /* GL_MODELVIEW22_ARB */ - 970, /* GL_MODELVIEW23_ARB */ - 971, /* GL_MODELVIEW24_ARB */ - 972, /* GL_MODELVIEW25_ARB */ - 973, /* GL_MODELVIEW26_ARB */ - 974, /* GL_MODELVIEW27_ARB */ - 975, /* GL_MODELVIEW28_ARB */ - 976, /* GL_MODELVIEW29_ARB */ - 978, /* GL_MODELVIEW30_ARB */ - 979, /* GL_MODELVIEW31_ARB */ - 389, /* GL_DOT3_RGB_EXT */ - 387, /* GL_DOT3_RGBA_EXT */ - 950, /* GL_MIRROR_CLAMP_EXT */ - 953, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ - 991, /* GL_MODULATE_ADD_ATI */ - 992, /* GL_MODULATE_SIGNED_ADD_ATI */ - 993, /* GL_MODULATE_SUBTRACT_ATI */ - 1858, /* GL_YCBCR_MESA */ - 1083, /* GL_PACK_INVERT_MESA */ + 1006, /* GL_MULTISAMPLE_3DFX */ + 1404, /* GL_SAMPLE_BUFFERS_3DFX */ + 1395, /* GL_SAMPLES_3DFX */ + 987, /* GL_MODELVIEW2_ARB */ + 990, /* GL_MODELVIEW3_ARB */ + 991, /* GL_MODELVIEW4_ARB */ + 992, /* GL_MODELVIEW5_ARB */ + 993, /* GL_MODELVIEW6_ARB */ + 994, /* GL_MODELVIEW7_ARB */ + 995, /* GL_MODELVIEW8_ARB */ + 996, /* GL_MODELVIEW9_ARB */ + 966, /* GL_MODELVIEW10_ARB */ + 967, /* GL_MODELVIEW11_ARB */ + 968, /* GL_MODELVIEW12_ARB */ + 969, /* GL_MODELVIEW13_ARB */ + 970, /* GL_MODELVIEW14_ARB */ + 971, /* GL_MODELVIEW15_ARB */ + 972, /* GL_MODELVIEW16_ARB */ + 973, /* GL_MODELVIEW17_ARB */ + 974, /* GL_MODELVIEW18_ARB */ + 975, /* GL_MODELVIEW19_ARB */ + 977, /* GL_MODELVIEW20_ARB */ + 978, /* GL_MODELVIEW21_ARB */ + 979, /* GL_MODELVIEW22_ARB */ + 980, /* GL_MODELVIEW23_ARB */ + 981, /* GL_MODELVIEW24_ARB */ + 982, /* GL_MODELVIEW25_ARB */ + 983, /* GL_MODELVIEW26_ARB */ + 984, /* GL_MODELVIEW27_ARB */ + 985, /* GL_MODELVIEW28_ARB */ + 986, /* GL_MODELVIEW29_ARB */ + 988, /* GL_MODELVIEW30_ARB */ + 989, /* GL_MODELVIEW31_ARB */ + 391, /* GL_DOT3_RGB_EXT */ + 389, /* GL_DOT3_RGBA_EXT */ + 960, /* GL_MIRROR_CLAMP_EXT */ + 963, /* GL_MIRROR_CLAMP_TO_EDGE_EXT */ + 1001, /* GL_MODULATE_ADD_ATI */ + 1002, /* GL_MODULATE_SIGNED_ADD_ATI */ + 1003, /* GL_MODULATE_SUBTRACT_ATI */ + 1877, /* GL_YCBCR_MESA */ + 1093, /* GL_PACK_INVERT_MESA */ 339, /* GL_DEBUG_OBJECT_MESA */ 340, /* GL_DEBUG_PRINT_MESA */ 338, /* GL_DEBUG_ASSERT_MESA */ @@ -4762,292 +4800,292 @@ static const unsigned reduced_enums[1347] = 117, /* GL_BUMP_ROT_MATRIX_SIZE_ATI */ 115, /* GL_BUMP_NUM_TEX_UNITS_ATI */ 119, /* GL_BUMP_TEX_UNITS_ATI */ - 448, /* GL_DUDV_ATI */ - 447, /* GL_DU8DV8_ATI */ + 451, /* GL_DUDV_ATI */ + 450, /* GL_DU8DV8_ATI */ 114, /* GL_BUMP_ENVMAP_ATI */ 118, /* GL_BUMP_TARGET_ATI */ - 1490, /* GL_STENCIL_BACK_FUNC */ - 1488, /* GL_STENCIL_BACK_FAIL */ - 1492, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ - 1494, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ - 533, /* GL_FRAGMENT_PROGRAM_ARB */ - 1221, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ - 1249, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ - 1248, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ - 1233, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - 1239, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - 1238, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - 884, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ - 907, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ - 906, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ - 897, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ - 903, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ - 902, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ - 867, /* GL_MAX_DRAW_BUFFERS */ - 393, /* GL_DRAW_BUFFER0 */ - 396, /* GL_DRAW_BUFFER1 */ - 417, /* GL_DRAW_BUFFER2 */ - 420, /* GL_DRAW_BUFFER3 */ - 423, /* GL_DRAW_BUFFER4 */ - 426, /* GL_DRAW_BUFFER5 */ - 429, /* GL_DRAW_BUFFER6 */ - 432, /* GL_DRAW_BUFFER7 */ - 435, /* GL_DRAW_BUFFER8 */ - 438, /* GL_DRAW_BUFFER9 */ - 397, /* GL_DRAW_BUFFER10 */ - 400, /* GL_DRAW_BUFFER11 */ - 403, /* GL_DRAW_BUFFER12 */ - 406, /* GL_DRAW_BUFFER13 */ - 409, /* GL_DRAW_BUFFER14 */ - 412, /* GL_DRAW_BUFFER15 */ + 1503, /* GL_STENCIL_BACK_FUNC */ + 1501, /* GL_STENCIL_BACK_FAIL */ + 1505, /* GL_STENCIL_BACK_PASS_DEPTH_FAIL */ + 1507, /* GL_STENCIL_BACK_PASS_DEPTH_PASS */ + 536, /* GL_FRAGMENT_PROGRAM_ARB */ + 1231, /* GL_PROGRAM_ALU_INSTRUCTIONS_ARB */ + 1259, /* GL_PROGRAM_TEX_INSTRUCTIONS_ARB */ + 1258, /* GL_PROGRAM_TEX_INDIRECTIONS_ARB */ + 1243, /* GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + 1249, /* GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + 1248, /* GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + 892, /* GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB */ + 915, /* GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB */ + 914, /* GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB */ + 905, /* GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB */ + 911, /* GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB */ + 910, /* GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB */ + 875, /* GL_MAX_DRAW_BUFFERS */ + 395, /* GL_DRAW_BUFFER0 */ + 398, /* GL_DRAW_BUFFER1 */ + 419, /* GL_DRAW_BUFFER2 */ + 422, /* GL_DRAW_BUFFER3 */ + 425, /* GL_DRAW_BUFFER4 */ + 428, /* GL_DRAW_BUFFER5 */ + 431, /* GL_DRAW_BUFFER6 */ + 434, /* GL_DRAW_BUFFER7 */ + 437, /* GL_DRAW_BUFFER8 */ + 440, /* GL_DRAW_BUFFER9 */ + 399, /* GL_DRAW_BUFFER10 */ + 402, /* GL_DRAW_BUFFER11 */ + 405, /* GL_DRAW_BUFFER12 */ + 408, /* GL_DRAW_BUFFER13 */ + 411, /* GL_DRAW_BUFFER14 */ + 414, /* GL_DRAW_BUFFER15 */ 82, /* GL_BLEND_EQUATION_ALPHA */ - 847, /* GL_MATRIX_PALETTE_ARB */ - 878, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ - 881, /* GL_MAX_PALETTE_MATRICES_ARB */ + 854, /* GL_MATRIX_PALETTE_ARB */ + 886, /* GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB */ + 889, /* GL_MAX_PALETTE_MATRICES_ARB */ 321, /* GL_CURRENT_PALETTE_MATRIX_ARB */ - 841, /* GL_MATRIX_INDEX_ARRAY_ARB */ + 848, /* GL_MATRIX_INDEX_ARRAY_ARB */ 316, /* GL_CURRENT_MATRIX_INDEX_ARB */ - 843, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ - 845, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ - 844, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ - 842, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ - 1678, /* GL_TEXTURE_DEPTH_SIZE */ - 377, /* GL_DEPTH_TEXTURE_MODE */ - 1643, /* GL_TEXTURE_COMPARE_MODE */ - 1641, /* GL_TEXTURE_COMPARE_FUNC */ + 850, /* GL_MATRIX_INDEX_ARRAY_SIZE_ARB */ + 852, /* GL_MATRIX_INDEX_ARRAY_TYPE_ARB */ + 851, /* GL_MATRIX_INDEX_ARRAY_STRIDE_ARB */ + 849, /* GL_MATRIX_INDEX_ARRAY_POINTER_ARB */ + 1695, /* GL_TEXTURE_DEPTH_SIZE */ + 379, /* GL_DEPTH_TEXTURE_MODE */ + 1660, /* GL_TEXTURE_COMPARE_MODE */ + 1658, /* GL_TEXTURE_COMPARE_FUNC */ 242, /* GL_COMPARE_R_TO_TEXTURE */ - 1155, /* GL_POINT_SPRITE */ + 1165, /* GL_POINT_SPRITE */ 296, /* GL_COORD_REPLACE */ - 1159, /* GL_POINT_SPRITE_R_MODE_NV */ - 1280, /* GL_QUERY_COUNTER_BITS */ + 1169, /* GL_POINT_SPRITE_R_MODE_NV */ + 1290, /* GL_QUERY_COUNTER_BITS */ 323, /* GL_CURRENT_QUERY */ - 1282, /* GL_QUERY_RESULT */ - 1284, /* GL_QUERY_RESULT_AVAILABLE */ - 930, /* GL_MAX_VERTEX_ATTRIBS */ - 1819, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ - 375, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ - 374, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ - 916, /* GL_MAX_TEXTURE_COORDS */ - 918, /* GL_MAX_TEXTURE_IMAGE_UNITS */ - 1226, /* GL_PROGRAM_ERROR_STRING_ARB */ - 1228, /* GL_PROGRAM_FORMAT_ASCII_ARB */ - 1227, /* GL_PROGRAM_FORMAT_ARB */ - 1727, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ - 353, /* GL_DEPTH_BOUNDS_TEST_EXT */ - 352, /* GL_DEPTH_BOUNDS_EXT */ + 1292, /* GL_QUERY_RESULT */ + 1294, /* GL_QUERY_RESULT_AVAILABLE */ + 940, /* GL_MAX_VERTEX_ATTRIBS */ + 1838, /* GL_VERTEX_ATTRIB_ARRAY_NORMALIZED */ + 377, /* GL_DEPTH_STENCIL_TO_RGBA_NV */ + 376, /* GL_DEPTH_STENCIL_TO_BGRA_NV */ + 926, /* GL_MAX_TEXTURE_COORDS */ + 928, /* GL_MAX_TEXTURE_IMAGE_UNITS */ + 1236, /* GL_PROGRAM_ERROR_STRING_ARB */ + 1238, /* GL_PROGRAM_FORMAT_ASCII_ARB */ + 1237, /* GL_PROGRAM_FORMAT_ARB */ + 1745, /* GL_TEXTURE_UNSIGNED_REMAP_MODE_NV */ + 354, /* GL_DEPTH_BOUNDS_TEST_EXT */ + 353, /* GL_DEPTH_BOUNDS_EXT */ 53, /* GL_ARRAY_BUFFER */ - 461, /* GL_ELEMENT_ARRAY_BUFFER */ + 464, /* GL_ELEMENT_ARRAY_BUFFER */ 54, /* GL_ARRAY_BUFFER_BINDING */ - 462, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ - 1793, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ - 1017, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ + 465, /* GL_ELEMENT_ARRAY_BUFFER_BINDING */ + 1812, /* GL_VERTEX_ARRAY_BUFFER_BINDING */ + 1027, /* GL_NORMAL_ARRAY_BUFFER_BINDING */ 149, /* GL_COLOR_ARRAY_BUFFER_BINDING */ - 625, /* GL_INDEX_ARRAY_BUFFER_BINDING */ - 1656, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ - 457, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ - 1403, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ - 511, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ - 1846, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ - 1815, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ - 1229, /* GL_PROGRAM_INSTRUCTIONS_ARB */ - 890, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ - 1235, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - 899, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ - 1247, /* GL_PROGRAM_TEMPORARIES_ARB */ - 905, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ - 1237, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ - 901, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ - 1241, /* GL_PROGRAM_PARAMETERS_ARB */ - 904, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ - 1236, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ - 900, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ - 1222, /* GL_PROGRAM_ATTRIBS_ARB */ - 885, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ - 1234, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ - 898, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ - 1220, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ - 883, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ - 1232, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - 896, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ - 891, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ - 887, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ - 1250, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ - 1740, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ - 1293, /* GL_READ_ONLY */ - 1854, /* GL_WRITE_ONLY */ - 1295, /* GL_READ_WRITE */ + 632, /* GL_INDEX_ARRAY_BUFFER_BINDING */ + 1673, /* GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING */ + 460, /* GL_EDGE_FLAG_ARRAY_BUFFER_BINDING */ + 1416, /* GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING */ + 514, /* GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING */ + 1865, /* GL_WEIGHT_ARRAY_BUFFER_BINDING */ + 1834, /* GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING */ + 1239, /* GL_PROGRAM_INSTRUCTIONS_ARB */ + 898, /* GL_MAX_PROGRAM_INSTRUCTIONS_ARB */ + 1245, /* GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + 907, /* GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB */ + 1257, /* GL_PROGRAM_TEMPORARIES_ARB */ + 913, /* GL_MAX_PROGRAM_TEMPORARIES_ARB */ + 1247, /* GL_PROGRAM_NATIVE_TEMPORARIES_ARB */ + 909, /* GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB */ + 1251, /* GL_PROGRAM_PARAMETERS_ARB */ + 912, /* GL_MAX_PROGRAM_PARAMETERS_ARB */ + 1246, /* GL_PROGRAM_NATIVE_PARAMETERS_ARB */ + 908, /* GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB */ + 1232, /* GL_PROGRAM_ATTRIBS_ARB */ + 893, /* GL_MAX_PROGRAM_ATTRIBS_ARB */ + 1244, /* GL_PROGRAM_NATIVE_ATTRIBS_ARB */ + 906, /* GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB */ + 1230, /* GL_PROGRAM_ADDRESS_REGISTERS_ARB */ + 891, /* GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB */ + 1242, /* GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + 904, /* GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB */ + 899, /* GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB */ + 895, /* GL_MAX_PROGRAM_ENV_PARAMETERS_ARB */ + 1260, /* GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB */ + 1758, /* GL_TRANSPOSE_CURRENT_MATRIX_ARB */ + 1304, /* GL_READ_ONLY */ + 1873, /* GL_WRITE_ONLY */ + 1306, /* GL_READ_WRITE */ 102, /* GL_BUFFER_ACCESS */ 105, /* GL_BUFFER_MAPPED */ 107, /* GL_BUFFER_MAP_POINTER */ - 1734, /* GL_TIME_ELAPSED_EXT */ - 801, /* GL_MATRIX0_ARB */ - 813, /* GL_MATRIX1_ARB */ - 825, /* GL_MATRIX2_ARB */ - 829, /* GL_MATRIX3_ARB */ - 831, /* GL_MATRIX4_ARB */ - 833, /* GL_MATRIX5_ARB */ - 835, /* GL_MATRIX6_ARB */ - 837, /* GL_MATRIX7_ARB */ - 839, /* GL_MATRIX8_ARB */ - 840, /* GL_MATRIX9_ARB */ - 803, /* GL_MATRIX10_ARB */ - 804, /* GL_MATRIX11_ARB */ - 805, /* GL_MATRIX12_ARB */ - 806, /* GL_MATRIX13_ARB */ - 807, /* GL_MATRIX14_ARB */ - 808, /* GL_MATRIX15_ARB */ - 809, /* GL_MATRIX16_ARB */ - 810, /* GL_MATRIX17_ARB */ - 811, /* GL_MATRIX18_ARB */ - 812, /* GL_MATRIX19_ARB */ - 815, /* GL_MATRIX20_ARB */ - 816, /* GL_MATRIX21_ARB */ - 817, /* GL_MATRIX22_ARB */ - 818, /* GL_MATRIX23_ARB */ - 819, /* GL_MATRIX24_ARB */ - 820, /* GL_MATRIX25_ARB */ - 821, /* GL_MATRIX26_ARB */ - 822, /* GL_MATRIX27_ARB */ - 823, /* GL_MATRIX28_ARB */ - 824, /* GL_MATRIX29_ARB */ - 827, /* GL_MATRIX30_ARB */ - 828, /* GL_MATRIX31_ARB */ - 1523, /* GL_STREAM_DRAW */ - 1525, /* GL_STREAM_READ */ - 1521, /* GL_STREAM_COPY */ - 1481, /* GL_STATIC_DRAW */ - 1483, /* GL_STATIC_READ */ - 1479, /* GL_STATIC_COPY */ - 451, /* GL_DYNAMIC_DRAW */ - 453, /* GL_DYNAMIC_READ */ - 449, /* GL_DYNAMIC_COPY */ - 1123, /* GL_PIXEL_PACK_BUFFER */ - 1127, /* GL_PIXEL_UNPACK_BUFFER */ - 1124, /* GL_PIXEL_PACK_BUFFER_BINDING */ - 1128, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ + 1752, /* GL_TIME_ELAPSED_EXT */ + 808, /* GL_MATRIX0_ARB */ + 820, /* GL_MATRIX1_ARB */ + 832, /* GL_MATRIX2_ARB */ + 836, /* GL_MATRIX3_ARB */ + 838, /* GL_MATRIX4_ARB */ + 840, /* GL_MATRIX5_ARB */ + 842, /* GL_MATRIX6_ARB */ + 844, /* GL_MATRIX7_ARB */ + 846, /* GL_MATRIX8_ARB */ + 847, /* GL_MATRIX9_ARB */ + 810, /* GL_MATRIX10_ARB */ + 811, /* GL_MATRIX11_ARB */ + 812, /* GL_MATRIX12_ARB */ + 813, /* GL_MATRIX13_ARB */ + 814, /* GL_MATRIX14_ARB */ + 815, /* GL_MATRIX15_ARB */ + 816, /* GL_MATRIX16_ARB */ + 817, /* GL_MATRIX17_ARB */ + 818, /* GL_MATRIX18_ARB */ + 819, /* GL_MATRIX19_ARB */ + 822, /* GL_MATRIX20_ARB */ + 823, /* GL_MATRIX21_ARB */ + 824, /* GL_MATRIX22_ARB */ + 825, /* GL_MATRIX23_ARB */ + 826, /* GL_MATRIX24_ARB */ + 827, /* GL_MATRIX25_ARB */ + 828, /* GL_MATRIX26_ARB */ + 829, /* GL_MATRIX27_ARB */ + 830, /* GL_MATRIX28_ARB */ + 831, /* GL_MATRIX29_ARB */ + 834, /* GL_MATRIX30_ARB */ + 835, /* GL_MATRIX31_ARB */ + 1540, /* GL_STREAM_DRAW */ + 1542, /* GL_STREAM_READ */ + 1538, /* GL_STREAM_COPY */ + 1494, /* GL_STATIC_DRAW */ + 1496, /* GL_STATIC_READ */ + 1492, /* GL_STATIC_COPY */ + 454, /* GL_DYNAMIC_DRAW */ + 456, /* GL_DYNAMIC_READ */ + 452, /* GL_DYNAMIC_COPY */ + 1133, /* GL_PIXEL_PACK_BUFFER */ + 1137, /* GL_PIXEL_UNPACK_BUFFER */ + 1134, /* GL_PIXEL_PACK_BUFFER_BINDING */ + 1138, /* GL_PIXEL_UNPACK_BUFFER_BINDING */ 347, /* GL_DEPTH24_STENCIL8 */ - 1724, /* GL_TEXTURE_STENCIL_SIZE */ - 1676, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */ - 886, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ - 889, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ - 893, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ - 892, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ - 850, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ - 1514, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ + 1741, /* GL_TEXTURE_STENCIL_SIZE */ + 1693, /* GL_TEXTURE_CUBE_MAP_SEAMLESS */ + 894, /* GL_MAX_PROGRAM_CALL_DEPTH_NV */ + 897, /* GL_MAX_PROGRAM_IF_DEPTH_NV */ + 901, /* GL_MAX_PROGRAM_LOOP_DEPTH_NV */ + 900, /* GL_MAX_PROGRAM_LOOP_COUNT_NV */ + 857, /* GL_MAX_ARRAY_TEXTURE_LAYERS_EXT */ + 1531, /* GL_STENCIL_TEST_TWO_SIDE_EXT */ 17, /* GL_ACTIVE_STENCIL_FACE_EXT */ - 951, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ - 1384, /* GL_SAMPLES_PASSED */ + 961, /* GL_MIRROR_CLAMP_TO_BORDER_EXT */ + 1397, /* GL_SAMPLES_PASSED */ 109, /* GL_BUFFER_SERIALIZED_MODIFY_APPLE */ 104, /* GL_BUFFER_FLUSHING_UNMAP_APPLE */ - 534, /* GL_FRAGMENT_SHADER */ - 1839, /* GL_VERTEX_SHADER */ - 1240, /* GL_PROGRAM_OBJECT_ARB */ - 1416, /* GL_SHADER_OBJECT_ARB */ - 874, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ - 934, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ - 928, /* GL_MAX_VARYING_FLOATS */ - 932, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ - 859, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ - 1043, /* GL_OBJECT_TYPE_ARB */ - 1418, /* GL_SHADER_TYPE */ - 499, /* GL_FLOAT_VEC2 */ - 501, /* GL_FLOAT_VEC3 */ - 503, /* GL_FLOAT_VEC4 */ - 652, /* GL_INT_VEC2 */ - 654, /* GL_INT_VEC3 */ - 656, /* GL_INT_VEC4 */ + 537, /* GL_FRAGMENT_SHADER */ + 1858, /* GL_VERTEX_SHADER */ + 1250, /* GL_PROGRAM_OBJECT_ARB */ + 1429, /* GL_SHADER_OBJECT_ARB */ + 882, /* GL_MAX_FRAGMENT_UNIFORM_COMPONENTS */ + 944, /* GL_MAX_VERTEX_UNIFORM_COMPONENTS */ + 938, /* GL_MAX_VARYING_FLOATS */ + 942, /* GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS */ + 867, /* GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS */ + 1053, /* GL_OBJECT_TYPE_ARB */ + 1431, /* GL_SHADER_TYPE */ + 502, /* GL_FLOAT_VEC2 */ + 504, /* GL_FLOAT_VEC3 */ + 506, /* GL_FLOAT_VEC4 */ + 659, /* GL_INT_VEC2 */ + 661, /* GL_INT_VEC3 */ + 663, /* GL_INT_VEC4 */ 94, /* GL_BOOL */ 96, /* GL_BOOL_VEC2 */ 98, /* GL_BOOL_VEC3 */ 100, /* GL_BOOL_VEC4 */ - 487, /* GL_FLOAT_MAT2 */ - 491, /* GL_FLOAT_MAT3 */ - 495, /* GL_FLOAT_MAT4 */ - 1375, /* GL_SAMPLER_1D */ - 1377, /* GL_SAMPLER_2D */ - 1379, /* GL_SAMPLER_3D */ - 1380, /* GL_SAMPLER_CUBE */ - 1376, /* GL_SAMPLER_1D_SHADOW */ - 1378, /* GL_SAMPLER_2D_SHADOW */ - 489, /* GL_FLOAT_MAT2x3 */ - 490, /* GL_FLOAT_MAT2x4 */ - 493, /* GL_FLOAT_MAT3x2 */ - 494, /* GL_FLOAT_MAT3x4 */ - 497, /* GL_FLOAT_MAT4x2 */ - 498, /* GL_FLOAT_MAT4x3 */ + 490, /* GL_FLOAT_MAT2 */ + 494, /* GL_FLOAT_MAT3 */ + 498, /* GL_FLOAT_MAT4 */ + 1388, /* GL_SAMPLER_1D */ + 1390, /* GL_SAMPLER_2D */ + 1392, /* GL_SAMPLER_3D */ + 1393, /* GL_SAMPLER_CUBE */ + 1389, /* GL_SAMPLER_1D_SHADOW */ + 1391, /* GL_SAMPLER_2D_SHADOW */ + 492, /* GL_FLOAT_MAT2x3 */ + 493, /* GL_FLOAT_MAT2x4 */ + 496, /* GL_FLOAT_MAT3x2 */ + 497, /* GL_FLOAT_MAT3x4 */ + 500, /* GL_FLOAT_MAT4x2 */ + 501, /* GL_FLOAT_MAT4x3 */ 345, /* GL_DELETE_STATUS */ 246, /* GL_COMPILE_STATUS */ - 708, /* GL_LINK_STATUS */ - 1787, /* GL_VALIDATE_STATUS */ - 637, /* GL_INFO_LOG_LENGTH */ + 715, /* GL_LINK_STATUS */ + 1806, /* GL_VALIDATE_STATUS */ + 644, /* GL_INFO_LOG_LENGTH */ 56, /* GL_ATTACHED_SHADERS */ 20, /* GL_ACTIVE_UNIFORMS */ 21, /* GL_ACTIVE_UNIFORM_MAX_LENGTH */ - 1417, /* GL_SHADER_SOURCE_LENGTH */ + 1430, /* GL_SHADER_SOURCE_LENGTH */ 15, /* GL_ACTIVE_ATTRIBUTES */ 16, /* GL_ACTIVE_ATTRIBUTE_MAX_LENGTH */ - 536, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ - 1420, /* GL_SHADING_LANGUAGE_VERSION */ + 539, /* GL_FRAGMENT_SHADER_DERIVATIVE_HINT */ + 1433, /* GL_SHADING_LANGUAGE_VERSION */ 322, /* GL_CURRENT_PROGRAM */ - 1092, /* GL_PALETTE4_RGB8_OES */ - 1094, /* GL_PALETTE4_RGBA8_OES */ - 1090, /* GL_PALETTE4_R5_G6_B5_OES */ - 1093, /* GL_PALETTE4_RGBA4_OES */ - 1091, /* GL_PALETTE4_RGB5_A1_OES */ - 1097, /* GL_PALETTE8_RGB8_OES */ - 1099, /* GL_PALETTE8_RGBA8_OES */ - 1095, /* GL_PALETTE8_R5_G6_B5_OES */ - 1098, /* GL_PALETTE8_RGBA4_OES */ - 1096, /* GL_PALETTE8_RGB5_A1_OES */ - 619, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ - 618, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ - 1772, /* GL_UNSIGNED_NORMALIZED */ - 1611, /* GL_TEXTURE_1D_ARRAY_EXT */ - 1262, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ - 1613, /* GL_TEXTURE_2D_ARRAY_EXT */ - 1265, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ - 1619, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ - 1621, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ - 1473, /* GL_SRGB */ - 1474, /* GL_SRGB8 */ - 1476, /* GL_SRGB_ALPHA */ - 1475, /* GL_SRGB8_ALPHA8 */ - 1433, /* GL_SLUMINANCE_ALPHA */ - 1432, /* GL_SLUMINANCE8_ALPHA8 */ - 1430, /* GL_SLUMINANCE */ - 1431, /* GL_SLUMINANCE8 */ + 1102, /* GL_PALETTE4_RGB8_OES */ + 1104, /* GL_PALETTE4_RGBA8_OES */ + 1100, /* GL_PALETTE4_R5_G6_B5_OES */ + 1103, /* GL_PALETTE4_RGBA4_OES */ + 1101, /* GL_PALETTE4_RGB5_A1_OES */ + 1107, /* GL_PALETTE8_RGB8_OES */ + 1109, /* GL_PALETTE8_RGBA8_OES */ + 1105, /* GL_PALETTE8_R5_G6_B5_OES */ + 1108, /* GL_PALETTE8_RGBA4_OES */ + 1106, /* GL_PALETTE8_RGB5_A1_OES */ + 626, /* GL_IMPLEMENTATION_COLOR_READ_TYPE_OES */ + 625, /* GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES */ + 1791, /* GL_UNSIGNED_NORMALIZED */ + 1628, /* GL_TEXTURE_1D_ARRAY_EXT */ + 1272, /* GL_PROXY_TEXTURE_1D_ARRAY_EXT */ + 1630, /* GL_TEXTURE_2D_ARRAY_EXT */ + 1275, /* GL_PROXY_TEXTURE_2D_ARRAY_EXT */ + 1636, /* GL_TEXTURE_BINDING_1D_ARRAY_EXT */ + 1638, /* GL_TEXTURE_BINDING_2D_ARRAY_EXT */ + 1486, /* GL_SRGB */ + 1487, /* GL_SRGB8 */ + 1489, /* GL_SRGB_ALPHA */ + 1488, /* GL_SRGB8_ALPHA8 */ + 1446, /* GL_SLUMINANCE_ALPHA */ + 1445, /* GL_SLUMINANCE8_ALPHA8 */ + 1443, /* GL_SLUMINANCE */ + 1444, /* GL_SLUMINANCE8 */ 267, /* GL_COMPRESSED_SRGB */ 268, /* GL_COMPRESSED_SRGB_ALPHA */ 265, /* GL_COMPRESSED_SLUMINANCE */ 266, /* GL_COMPRESSED_SLUMINANCE_ALPHA */ - 1157, /* GL_POINT_SPRITE_COORD_ORIGIN */ - 716, /* GL_LOWER_LEFT */ - 1784, /* GL_UPPER_LEFT */ - 1496, /* GL_STENCIL_BACK_REF */ - 1497, /* GL_STENCIL_BACK_VALUE_MASK */ - 1498, /* GL_STENCIL_BACK_WRITEMASK */ - 442, /* GL_DRAW_FRAMEBUFFER_BINDING_EXT */ - 1309, /* GL_RENDERBUFFER_BINDING_EXT */ - 1290, /* GL_READ_FRAMEBUFFER */ - 441, /* GL_DRAW_FRAMEBUFFER */ - 1291, /* GL_READ_FRAMEBUFFER_BINDING_EXT */ - 1319, /* GL_RENDERBUFFER_SAMPLES */ - 546, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ - 544, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ - 555, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ - 551, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ - 553, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ - 558, /* GL_FRAMEBUFFER_COMPLETE */ - 562, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ - 568, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ - 566, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ - 564, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ - 567, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ - 565, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT */ - 571, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT */ - 574, /* GL_FRAMEBUFFER_UNSUPPORTED */ - 572, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ - 856, /* GL_MAX_COLOR_ATTACHMENTS_EXT */ + 1167, /* GL_POINT_SPRITE_COORD_ORIGIN */ + 723, /* GL_LOWER_LEFT */ + 1803, /* GL_UPPER_LEFT */ + 1509, /* GL_STENCIL_BACK_REF */ + 1510, /* GL_STENCIL_BACK_VALUE_MASK */ + 1511, /* GL_STENCIL_BACK_WRITEMASK */ + 444, /* GL_DRAW_FRAMEBUFFER_BINDING */ + 1320, /* GL_RENDERBUFFER_BINDING */ + 1300, /* GL_READ_FRAMEBUFFER */ + 443, /* GL_DRAW_FRAMEBUFFER */ + 1301, /* GL_READ_FRAMEBUFFER_BINDING */ + 1331, /* GL_RENDERBUFFER_SAMPLES */ + 549, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE */ + 547, /* GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME */ + 558, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL */ + 554, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE */ + 556, /* GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER */ + 562, /* GL_FRAMEBUFFER_COMPLETE */ + 566, /* GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT */ + 573, /* GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT */ + 571, /* GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT */ + 568, /* GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT */ + 572, /* GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT */ + 569, /* GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER */ + 577, /* GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER */ + 581, /* GL_FRAMEBUFFER_UNSUPPORTED */ + 579, /* GL_FRAMEBUFFER_STATUS_ERROR_EXT */ + 863, /* GL_MAX_COLOR_ATTACHMENTS */ 155, /* GL_COLOR_ATTACHMENT0 */ 157, /* GL_COLOR_ATTACHMENT1 */ 171, /* GL_COLOR_ATTACHMENT2 */ @@ -5064,57 +5102,57 @@ static const unsigned reduced_enums[1347] = 164, /* GL_COLOR_ATTACHMENT13 */ 166, /* GL_COLOR_ATTACHMENT14 */ 168, /* GL_COLOR_ATTACHMENT15 */ - 348, /* GL_DEPTH_ATTACHMENT */ - 1486, /* GL_STENCIL_ATTACHMENT */ - 537, /* GL_FRAMEBUFFER */ - 1307, /* GL_RENDERBUFFER */ - 1321, /* GL_RENDERBUFFER_WIDTH */ - 1314, /* GL_RENDERBUFFER_HEIGHT */ - 1316, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ - 1509, /* GL_STENCIL_INDEX_EXT */ - 1506, /* GL_STENCIL_INDEX1_EXT */ - 1507, /* GL_STENCIL_INDEX4_EXT */ - 1508, /* GL_STENCIL_INDEX8_EXT */ - 1505, /* GL_STENCIL_INDEX16_EXT */ - 1318, /* GL_RENDERBUFFER_RED_SIZE */ - 1313, /* GL_RENDERBUFFER_GREEN_SIZE */ - 1310, /* GL_RENDERBUFFER_BLUE_SIZE */ - 1308, /* GL_RENDERBUFFER_ALPHA_SIZE */ - 1311, /* GL_RENDERBUFFER_DEPTH_SIZE */ - 1320, /* GL_RENDERBUFFER_STENCIL_SIZE */ - 570, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ - 912, /* GL_MAX_SAMPLES */ - 1276, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */ - 483, /* GL_FIRST_VERTEX_CONVENTION */ - 667, /* GL_LAST_VERTEX_CONVENTION */ - 1254, /* GL_PROVOKING_VERTEX */ + 349, /* GL_DEPTH_ATTACHMENT */ + 1499, /* GL_STENCIL_ATTACHMENT */ + 540, /* GL_FRAMEBUFFER */ + 1318, /* GL_RENDERBUFFER */ + 1334, /* GL_RENDERBUFFER_WIDTH */ + 1326, /* GL_RENDERBUFFER_HEIGHT */ + 1328, /* GL_RENDERBUFFER_INTERNAL_FORMAT */ + 1526, /* GL_STENCIL_INDEX_EXT */ + 1518, /* GL_STENCIL_INDEX1 */ + 1522, /* GL_STENCIL_INDEX4 */ + 1524, /* GL_STENCIL_INDEX8 */ + 1519, /* GL_STENCIL_INDEX16 */ + 1330, /* GL_RENDERBUFFER_RED_SIZE */ + 1325, /* GL_RENDERBUFFER_GREEN_SIZE */ + 1322, /* GL_RENDERBUFFER_BLUE_SIZE */ + 1319, /* GL_RENDERBUFFER_ALPHA_SIZE */ + 1323, /* GL_RENDERBUFFER_DEPTH_SIZE */ + 1333, /* GL_RENDERBUFFER_STENCIL_SIZE */ + 575, /* GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE */ + 921, /* GL_MAX_SAMPLES */ + 1286, /* GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION */ + 486, /* GL_FIRST_VERTEX_CONVENTION */ + 674, /* GL_LAST_VERTEX_CONVENTION */ + 1264, /* GL_PROVOKING_VERTEX */ 302, /* GL_COPY_READ_BUFFER */ 303, /* GL_COPY_WRITE_BUFFER */ - 1368, /* GL_RGBA_SNORM */ - 1364, /* GL_RGBA8_SNORM */ - 1426, /* GL_SIGNED_NORMALIZED */ - 913, /* GL_MAX_SERVER_WAIT_TIMEOUT */ - 1042, /* GL_OBJECT_TYPE */ - 1530, /* GL_SYNC_CONDITION */ - 1535, /* GL_SYNC_STATUS */ - 1532, /* GL_SYNC_FLAGS */ - 1531, /* GL_SYNC_FENCE */ - 1534, /* GL_SYNC_GPU_COMMANDS_COMPLETE */ - 1761, /* GL_UNSIGNALED */ - 1425, /* GL_SIGNALED */ + 1381, /* GL_RGBA_SNORM */ + 1377, /* GL_RGBA8_SNORM */ + 1439, /* GL_SIGNED_NORMALIZED */ + 923, /* GL_MAX_SERVER_WAIT_TIMEOUT */ + 1052, /* GL_OBJECT_TYPE */ + 1547, /* GL_SYNC_CONDITION */ + 1552, /* GL_SYNC_STATUS */ + 1549, /* GL_SYNC_FLAGS */ + 1548, /* GL_SYNC_FENCE */ + 1551, /* GL_SYNC_GPU_COMMANDS_COMPLETE */ + 1779, /* GL_UNSIGNALED */ + 1438, /* GL_SIGNALED */ 46, /* GL_ALREADY_SIGNALED */ - 1732, /* GL_TIMEOUT_EXPIRED */ + 1750, /* GL_TIMEOUT_EXPIRED */ 270, /* GL_CONDITION_SATISFIED */ - 1844, /* GL_WAIT_FAILED */ - 468, /* GL_EVAL_BIT */ - 1288, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ - 710, /* GL_LIST_BIT */ - 1627, /* GL_TEXTURE_BIT */ - 1399, /* GL_SCISSOR_BIT */ + 1863, /* GL_WAIT_FAILED */ + 471, /* GL_EVAL_BIT */ + 1298, /* GL_RASTER_POSITION_UNCLIPPED_IBM */ + 717, /* GL_LIST_BIT */ + 1644, /* GL_TEXTURE_BIT */ + 1412, /* GL_SCISSOR_BIT */ 29, /* GL_ALL_ATTRIB_BITS */ - 998, /* GL_MULTISAMPLE_BIT */ + 1008, /* GL_MULTISAMPLE_BIT */ 30, /* GL_ALL_CLIENT_ATTRIB_BITS */ - 1733, /* GL_TIMEOUT_IGNORED */ + 1751, /* GL_TIMEOUT_IGNORED */ }; typedef int (*cfunc)(const void *, const void *); diff --git a/src/mesa/main/remap_helper.h b/src/mesa/main/remap_helper.h index 3886f41862..c80a524b4f 100644 --- a/src/mesa/main/remap_helper.h +++ b/src/mesa/main/remap_helper.h @@ -1584,2742 +1584,2743 @@ static const char _mesa_function_pool[] = "ip\0" "glDeleteFencesNV\0" "\0" - /* _mesa_function_pool[10713]: DepthMask (offset 211) */ + /* _mesa_function_pool[10713]: DeformationMap3dSGIX (dynamic) */ + "iddiiddiiddiip\0" + "glDeformationMap3dSGIX\0" + "\0" + /* _mesa_function_pool[10752]: DepthMask (offset 211) */ "i\0" "glDepthMask\0" "\0" - /* _mesa_function_pool[10728]: IsShader (will be remapped) */ + /* _mesa_function_pool[10767]: IsShader (will be remapped) */ "i\0" "glIsShader\0" "\0" - /* _mesa_function_pool[10742]: Indexf (offset 46) */ + /* _mesa_function_pool[10781]: Indexf (offset 46) */ "f\0" "glIndexf\0" "\0" - /* _mesa_function_pool[10754]: GetImageTransformParameterivHP (dynamic) */ + /* _mesa_function_pool[10793]: GetImageTransformParameterivHP (dynamic) */ "iip\0" "glGetImageTransformParameterivHP\0" "\0" - /* _mesa_function_pool[10792]: Indexd (offset 44) */ + /* _mesa_function_pool[10831]: Indexd (offset 44) */ "d\0" "glIndexd\0" "\0" - /* _mesa_function_pool[10804]: GetMaterialiv (offset 270) */ + /* _mesa_function_pool[10843]: GetMaterialiv (offset 270) */ "iip\0" "glGetMaterialiv\0" "\0" - /* _mesa_function_pool[10825]: StencilOp (offset 244) */ + /* _mesa_function_pool[10864]: StencilOp (offset 244) */ "iii\0" "glStencilOp\0" "\0" - /* _mesa_function_pool[10842]: WindowPos4ivMESA (will be remapped) */ + /* _mesa_function_pool[10881]: WindowPos4ivMESA (will be remapped) */ "p\0" "glWindowPos4ivMESA\0" "\0" - /* _mesa_function_pool[10864]: MultiTexCoord3svARB (offset 399) */ + /* _mesa_function_pool[10903]: MultiTexCoord3svARB (offset 399) */ "ip\0" "glMultiTexCoord3sv\0" "glMultiTexCoord3svARB\0" "\0" - /* _mesa_function_pool[10909]: TexEnvfv (offset 185) */ + /* _mesa_function_pool[10948]: TexEnvfv (offset 185) */ "iip\0" "glTexEnvfv\0" "\0" - /* _mesa_function_pool[10925]: MultiTexCoord4iARB (offset 404) */ + /* _mesa_function_pool[10964]: MultiTexCoord4iARB (offset 404) */ "iiiii\0" "glMultiTexCoord4i\0" "glMultiTexCoord4iARB\0" "\0" - /* _mesa_function_pool[10971]: Indexs (offset 50) */ + /* _mesa_function_pool[11010]: Indexs (offset 50) */ "i\0" "glIndexs\0" "\0" - /* _mesa_function_pool[10983]: Binormal3ivEXT (dynamic) */ + /* _mesa_function_pool[11022]: Binormal3ivEXT (dynamic) */ "p\0" "glBinormal3ivEXT\0" "\0" - /* _mesa_function_pool[11003]: ResizeBuffersMESA (will be remapped) */ + /* _mesa_function_pool[11042]: ResizeBuffersMESA (will be remapped) */ "\0" "glResizeBuffersMESA\0" "\0" - /* _mesa_function_pool[11025]: GetUniformivARB (will be remapped) */ + /* _mesa_function_pool[11064]: GetUniformivARB (will be remapped) */ "iip\0" "glGetUniformiv\0" "glGetUniformivARB\0" "\0" - /* _mesa_function_pool[11063]: PixelTexGenParameteriSGIS (will be remapped) */ + /* _mesa_function_pool[11102]: PixelTexGenParameteriSGIS (will be remapped) */ "ii\0" "glPixelTexGenParameteriSGIS\0" "\0" - /* _mesa_function_pool[11095]: VertexPointervINTEL (dynamic) */ + /* _mesa_function_pool[11134]: VertexPointervINTEL (dynamic) */ "iip\0" "glVertexPointervINTEL\0" "\0" - /* _mesa_function_pool[11122]: Vertex2i (offset 130) */ + /* _mesa_function_pool[11161]: Vertex2i (offset 130) */ "ii\0" "glVertex2i\0" "\0" - /* _mesa_function_pool[11137]: LoadMatrixf (offset 291) */ + /* _mesa_function_pool[11176]: LoadMatrixf (offset 291) */ "p\0" "glLoadMatrixf\0" "\0" - /* _mesa_function_pool[11154]: Vertex2f (offset 128) */ + /* _mesa_function_pool[11193]: Vertex2f (offset 128) */ "ff\0" "glVertex2f\0" "\0" - /* _mesa_function_pool[11169]: ReplacementCodeuiColor4fNormal3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[11208]: ReplacementCodeuiColor4fNormal3fVertex3fvSUN (dynamic) */ "pppp\0" "glReplacementCodeuiColor4fNormal3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[11222]: Color4bv (offset 26) */ + /* _mesa_function_pool[11261]: Color4bv (offset 26) */ "p\0" "glColor4bv\0" "\0" - /* _mesa_function_pool[11236]: VertexPointer (offset 321) */ + /* _mesa_function_pool[11275]: VertexPointer (offset 321) */ "iiip\0" "glVertexPointer\0" "\0" - /* _mesa_function_pool[11258]: SecondaryColor3uiEXT (will be remapped) */ + /* _mesa_function_pool[11297]: SecondaryColor3uiEXT (will be remapped) */ "iii\0" "glSecondaryColor3ui\0" "glSecondaryColor3uiEXT\0" "\0" - /* _mesa_function_pool[11306]: StartInstrumentsSGIX (dynamic) */ + /* _mesa_function_pool[11345]: StartInstrumentsSGIX (dynamic) */ "\0" "glStartInstrumentsSGIX\0" "\0" - /* _mesa_function_pool[11331]: SecondaryColor3usvEXT (will be remapped) */ + /* _mesa_function_pool[11370]: SecondaryColor3usvEXT (will be remapped) */ "p\0" "glSecondaryColor3usv\0" "glSecondaryColor3usvEXT\0" "\0" - /* _mesa_function_pool[11379]: VertexAttrib2fvNV (will be remapped) */ + /* _mesa_function_pool[11418]: VertexAttrib2fvNV (will be remapped) */ "ip\0" "glVertexAttrib2fvNV\0" "\0" - /* _mesa_function_pool[11403]: ProgramLocalParameter4dvARB (will be remapped) */ + /* _mesa_function_pool[11442]: ProgramLocalParameter4dvARB (will be remapped) */ "iip\0" "glProgramLocalParameter4dvARB\0" "\0" - /* _mesa_function_pool[11438]: DeleteLists (offset 4) */ + /* _mesa_function_pool[11477]: DeleteLists (offset 4) */ "ii\0" "glDeleteLists\0" "\0" - /* _mesa_function_pool[11456]: LogicOp (offset 242) */ + /* _mesa_function_pool[11495]: LogicOp (offset 242) */ "i\0" "glLogicOp\0" "\0" - /* _mesa_function_pool[11469]: MatrixIndexuivARB (dynamic) */ + /* _mesa_function_pool[11508]: MatrixIndexuivARB (dynamic) */ "ip\0" "glMatrixIndexuivARB\0" "\0" - /* _mesa_function_pool[11493]: Vertex2s (offset 132) */ + /* _mesa_function_pool[11532]: Vertex2s (offset 132) */ "ii\0" "glVertex2s\0" "\0" - /* _mesa_function_pool[11508]: RenderbufferStorageMultisample (will be remapped) */ + /* _mesa_function_pool[11547]: RenderbufferStorageMultisample (will be remapped) */ "iiiii\0" "glRenderbufferStorageMultisample\0" + "glRenderbufferStorageMultisampleEXT\0" "\0" - /* _mesa_function_pool[11548]: TexCoord4fv (offset 121) */ + /* _mesa_function_pool[11623]: TexCoord4fv (offset 121) */ "p\0" "glTexCoord4fv\0" "\0" - /* _mesa_function_pool[11565]: Tangent3sEXT (dynamic) */ + /* _mesa_function_pool[11640]: Tangent3sEXT (dynamic) */ "iii\0" "glTangent3sEXT\0" "\0" - /* _mesa_function_pool[11585]: GlobalAlphaFactorfSUN (dynamic) */ + /* _mesa_function_pool[11660]: GlobalAlphaFactorfSUN (dynamic) */ "f\0" "glGlobalAlphaFactorfSUN\0" "\0" - /* _mesa_function_pool[11612]: MultiTexCoord3iARB (offset 396) */ + /* _mesa_function_pool[11687]: MultiTexCoord3iARB (offset 396) */ "iiii\0" "glMultiTexCoord3i\0" "glMultiTexCoord3iARB\0" "\0" - /* _mesa_function_pool[11657]: IsProgram (will be remapped) */ + /* _mesa_function_pool[11732]: IsProgram (will be remapped) */ "i\0" "glIsProgram\0" "\0" - /* _mesa_function_pool[11672]: TexCoordPointerListIBM (dynamic) */ + /* _mesa_function_pool[11747]: TexCoordPointerListIBM (dynamic) */ "iiipi\0" "glTexCoordPointerListIBM\0" "\0" - /* _mesa_function_pool[11704]: GlobalAlphaFactorusSUN (dynamic) */ + /* _mesa_function_pool[11779]: GlobalAlphaFactorusSUN (dynamic) */ "i\0" "glGlobalAlphaFactorusSUN\0" "\0" - /* _mesa_function_pool[11732]: VertexAttrib2dvNV (will be remapped) */ + /* _mesa_function_pool[11807]: VertexAttrib2dvNV (will be remapped) */ "ip\0" "glVertexAttrib2dvNV\0" "\0" - /* _mesa_function_pool[11756]: FramebufferRenderbufferEXT (will be remapped) */ + /* _mesa_function_pool[11831]: FramebufferRenderbufferEXT (will be remapped) */ "iiii\0" "glFramebufferRenderbuffer\0" "glFramebufferRenderbufferEXT\0" "\0" - /* _mesa_function_pool[11817]: VertexAttrib1dvNV (will be remapped) */ + /* _mesa_function_pool[11892]: VertexAttrib1dvNV (will be remapped) */ "ip\0" "glVertexAttrib1dvNV\0" "\0" - /* _mesa_function_pool[11841]: GenTextures (offset 328) */ + /* _mesa_function_pool[11916]: GenTextures (offset 328) */ "ip\0" "glGenTextures\0" "glGenTexturesEXT\0" "\0" - /* _mesa_function_pool[11876]: SetFenceNV (will be remapped) */ + /* _mesa_function_pool[11951]: SetFenceNV (will be remapped) */ "ii\0" "glSetFenceNV\0" "\0" - /* _mesa_function_pool[11893]: FramebufferTexture1DEXT (will be remapped) */ + /* _mesa_function_pool[11968]: FramebufferTexture1DEXT (will be remapped) */ "iiiii\0" "glFramebufferTexture1D\0" "glFramebufferTexture1DEXT\0" "\0" - /* _mesa_function_pool[11949]: GetCombinerOutputParameterivNV (will be remapped) */ + /* _mesa_function_pool[12024]: GetCombinerOutputParameterivNV (will be remapped) */ "iiip\0" "glGetCombinerOutputParameterivNV\0" "\0" - /* _mesa_function_pool[11988]: MultiModeDrawArraysIBM (will be remapped) */ - "pppii\0" - "glMultiModeDrawArraysIBM\0" - "\0" - /* _mesa_function_pool[12020]: PixelTexGenParameterivSGIS (will be remapped) */ + /* _mesa_function_pool[12063]: PixelTexGenParameterivSGIS (will be remapped) */ "ip\0" "glPixelTexGenParameterivSGIS\0" "\0" - /* _mesa_function_pool[12053]: TextureNormalEXT (dynamic) */ + /* _mesa_function_pool[12096]: TextureNormalEXT (dynamic) */ "i\0" "glTextureNormalEXT\0" "\0" - /* _mesa_function_pool[12075]: IndexPointerListIBM (dynamic) */ + /* _mesa_function_pool[12118]: IndexPointerListIBM (dynamic) */ "iipi\0" "glIndexPointerListIBM\0" "\0" - /* _mesa_function_pool[12103]: WeightfvARB (dynamic) */ + /* _mesa_function_pool[12146]: WeightfvARB (dynamic) */ "ip\0" "glWeightfvARB\0" "\0" - /* _mesa_function_pool[12121]: RasterPos2sv (offset 69) */ + /* _mesa_function_pool[12164]: RasterPos2sv (offset 69) */ "p\0" "glRasterPos2sv\0" "\0" - /* _mesa_function_pool[12139]: Color4ubv (offset 36) */ + /* _mesa_function_pool[12182]: Color4ubv (offset 36) */ "p\0" "glColor4ubv\0" "\0" - /* _mesa_function_pool[12154]: DrawBuffer (offset 202) */ + /* _mesa_function_pool[12197]: DrawBuffer (offset 202) */ "i\0" "glDrawBuffer\0" "\0" - /* _mesa_function_pool[12170]: TexCoord2fv (offset 105) */ + /* _mesa_function_pool[12213]: TexCoord2fv (offset 105) */ "p\0" "glTexCoord2fv\0" "\0" - /* _mesa_function_pool[12187]: WindowPos4fMESA (will be remapped) */ + /* _mesa_function_pool[12230]: WindowPos4fMESA (will be remapped) */ "ffff\0" "glWindowPos4fMESA\0" "\0" - /* _mesa_function_pool[12211]: TexCoord1sv (offset 101) */ + /* _mesa_function_pool[12254]: TexCoord1sv (offset 101) */ "p\0" "glTexCoord1sv\0" "\0" - /* _mesa_function_pool[12228]: WindowPos3dvMESA (will be remapped) */ + /* _mesa_function_pool[12271]: WindowPos3dvMESA (will be remapped) */ "p\0" "glWindowPos3dv\0" "glWindowPos3dvARB\0" "glWindowPos3dvMESA\0" "\0" - /* _mesa_function_pool[12283]: DepthFunc (offset 245) */ + /* _mesa_function_pool[12326]: DepthFunc (offset 245) */ "i\0" "glDepthFunc\0" "\0" - /* _mesa_function_pool[12298]: PixelMapusv (offset 253) */ + /* _mesa_function_pool[12341]: PixelMapusv (offset 253) */ "iip\0" "glPixelMapusv\0" "\0" - /* _mesa_function_pool[12317]: GetQueryObjecti64vEXT (will be remapped) */ + /* _mesa_function_pool[12360]: GetQueryObjecti64vEXT (will be remapped) */ "iip\0" "glGetQueryObjecti64vEXT\0" "\0" - /* _mesa_function_pool[12346]: MultiTexCoord1dARB (offset 376) */ + /* _mesa_function_pool[12389]: MultiTexCoord1dARB (offset 376) */ "id\0" "glMultiTexCoord1d\0" "glMultiTexCoord1dARB\0" "\0" - /* _mesa_function_pool[12389]: PointParameterivNV (will be remapped) */ + /* _mesa_function_pool[12432]: PointParameterivNV (will be remapped) */ "ip\0" "glPointParameteriv\0" "glPointParameterivNV\0" "\0" - /* _mesa_function_pool[12433]: BlendFunc (offset 241) */ + /* _mesa_function_pool[12476]: BlendFunc (offset 241) */ "ii\0" "glBlendFunc\0" "\0" - /* _mesa_function_pool[12449]: Uniform2fvARB (will be remapped) */ + /* _mesa_function_pool[12492]: Uniform2fvARB (will be remapped) */ "iip\0" "glUniform2fv\0" "glUniform2fvARB\0" "\0" - /* _mesa_function_pool[12483]: BufferParameteriAPPLE (will be remapped) */ + /* _mesa_function_pool[12526]: BufferParameteriAPPLE (will be remapped) */ "iii\0" "glBufferParameteriAPPLE\0" "\0" - /* _mesa_function_pool[12512]: MultiTexCoord3dvARB (offset 393) */ + /* _mesa_function_pool[12555]: MultiTexCoord3dvARB (offset 393) */ "ip\0" "glMultiTexCoord3dv\0" "glMultiTexCoord3dvARB\0" "\0" - /* _mesa_function_pool[12557]: ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[12600]: ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (dynamic) */ "pppp\0" "glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[12613]: DeleteObjectARB (will be remapped) */ + /* _mesa_function_pool[12656]: DeleteObjectARB (will be remapped) */ "i\0" "glDeleteObjectARB\0" "\0" - /* _mesa_function_pool[12634]: MatrixIndexPointerARB (dynamic) */ + /* _mesa_function_pool[12677]: MatrixIndexPointerARB (dynamic) */ "iiip\0" "glMatrixIndexPointerARB\0" "\0" - /* _mesa_function_pool[12664]: ProgramNamedParameter4dvNV (will be remapped) */ + /* _mesa_function_pool[12707]: ProgramNamedParameter4dvNV (will be remapped) */ "iipp\0" "glProgramNamedParameter4dvNV\0" "\0" - /* _mesa_function_pool[12699]: Tangent3fvEXT (dynamic) */ + /* _mesa_function_pool[12742]: Tangent3fvEXT (dynamic) */ "p\0" "glTangent3fvEXT\0" "\0" - /* _mesa_function_pool[12718]: Flush (offset 217) */ + /* _mesa_function_pool[12761]: Flush (offset 217) */ "\0" "glFlush\0" "\0" - /* _mesa_function_pool[12728]: Color4uiv (offset 38) */ + /* _mesa_function_pool[12771]: Color4uiv (offset 38) */ "p\0" "glColor4uiv\0" "\0" - /* _mesa_function_pool[12743]: GenVertexArrays (will be remapped) */ + /* _mesa_function_pool[12786]: GenVertexArrays (will be remapped) */ "ip\0" "glGenVertexArrays\0" "\0" - /* _mesa_function_pool[12765]: RasterPos3sv (offset 77) */ + /* _mesa_function_pool[12808]: RasterPos3sv (offset 77) */ "p\0" "glRasterPos3sv\0" "\0" - /* _mesa_function_pool[12783]: BindFramebufferEXT (will be remapped) */ + /* _mesa_function_pool[12826]: BindFramebufferEXT (will be remapped) */ "ii\0" "glBindFramebuffer\0" "glBindFramebufferEXT\0" "\0" - /* _mesa_function_pool[12826]: ReferencePlaneSGIX (dynamic) */ + /* _mesa_function_pool[12869]: ReferencePlaneSGIX (dynamic) */ "p\0" "glReferencePlaneSGIX\0" "\0" - /* _mesa_function_pool[12850]: PushAttrib (offset 219) */ + /* _mesa_function_pool[12893]: PushAttrib (offset 219) */ "i\0" "glPushAttrib\0" "\0" - /* _mesa_function_pool[12866]: RasterPos2i (offset 66) */ + /* _mesa_function_pool[12909]: RasterPos2i (offset 66) */ "ii\0" "glRasterPos2i\0" "\0" - /* _mesa_function_pool[12884]: ValidateProgramARB (will be remapped) */ + /* _mesa_function_pool[12927]: ValidateProgramARB (will be remapped) */ "i\0" "glValidateProgram\0" "glValidateProgramARB\0" "\0" - /* _mesa_function_pool[12926]: TexParameteriv (offset 181) */ + /* _mesa_function_pool[12969]: TexParameteriv (offset 181) */ "iip\0" "glTexParameteriv\0" "\0" - /* _mesa_function_pool[12948]: UnlockArraysEXT (will be remapped) */ + /* _mesa_function_pool[12991]: UnlockArraysEXT (will be remapped) */ "\0" "glUnlockArraysEXT\0" "\0" - /* _mesa_function_pool[12968]: TexCoord2fColor3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[13011]: TexCoord2fColor3fVertex3fSUN (dynamic) */ "ffffffff\0" "glTexCoord2fColor3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[13009]: WindowPos3fvMESA (will be remapped) */ + /* _mesa_function_pool[13052]: WindowPos3fvMESA (will be remapped) */ "p\0" "glWindowPos3fv\0" "glWindowPos3fvARB\0" "glWindowPos3fvMESA\0" "\0" - /* _mesa_function_pool[13064]: RasterPos2f (offset 64) */ + /* _mesa_function_pool[13107]: RasterPos2f (offset 64) */ "ff\0" "glRasterPos2f\0" "\0" - /* _mesa_function_pool[13082]: VertexAttrib1svNV (will be remapped) */ + /* _mesa_function_pool[13125]: VertexAttrib1svNV (will be remapped) */ "ip\0" "glVertexAttrib1svNV\0" "\0" - /* _mesa_function_pool[13106]: RasterPos2d (offset 62) */ + /* _mesa_function_pool[13149]: RasterPos2d (offset 62) */ "dd\0" "glRasterPos2d\0" "\0" - /* _mesa_function_pool[13124]: RasterPos3fv (offset 73) */ + /* _mesa_function_pool[13167]: RasterPos3fv (offset 73) */ "p\0" "glRasterPos3fv\0" "\0" - /* _mesa_function_pool[13142]: CopyTexSubImage3D (offset 373) */ + /* _mesa_function_pool[13185]: CopyTexSubImage3D (offset 373) */ "iiiiiiiii\0" "glCopyTexSubImage3D\0" "glCopyTexSubImage3DEXT\0" "\0" - /* _mesa_function_pool[13196]: VertexAttrib2dARB (will be remapped) */ + /* _mesa_function_pool[13239]: VertexAttrib2dARB (will be remapped) */ "idd\0" "glVertexAttrib2d\0" "glVertexAttrib2dARB\0" "\0" - /* _mesa_function_pool[13238]: Color4ub (offset 35) */ + /* _mesa_function_pool[13281]: Color4ub (offset 35) */ "iiii\0" "glColor4ub\0" "\0" - /* _mesa_function_pool[13255]: GetInteger64v (will be remapped) */ + /* _mesa_function_pool[13298]: GetInteger64v (will be remapped) */ "ip\0" "glGetInteger64v\0" "\0" - /* _mesa_function_pool[13275]: TextureColorMaskSGIS (dynamic) */ + /* _mesa_function_pool[13318]: TextureColorMaskSGIS (dynamic) */ "iiii\0" "glTextureColorMaskSGIS\0" "\0" - /* _mesa_function_pool[13304]: RasterPos2s (offset 68) */ + /* _mesa_function_pool[13347]: RasterPos2s (offset 68) */ "ii\0" "glRasterPos2s\0" "\0" - /* _mesa_function_pool[13322]: GetColorTable (offset 343) */ + /* _mesa_function_pool[13365]: GetColorTable (offset 343) */ "iiip\0" "glGetColorTable\0" "glGetColorTableSGI\0" "glGetColorTableEXT\0" "\0" - /* _mesa_function_pool[13382]: SelectBuffer (offset 195) */ + /* _mesa_function_pool[13425]: SelectBuffer (offset 195) */ "ip\0" "glSelectBuffer\0" "\0" - /* _mesa_function_pool[13401]: Indexiv (offset 49) */ + /* _mesa_function_pool[13444]: Indexiv (offset 49) */ "p\0" "glIndexiv\0" "\0" - /* _mesa_function_pool[13414]: TexCoord3i (offset 114) */ + /* _mesa_function_pool[13457]: TexCoord3i (offset 114) */ "iii\0" "glTexCoord3i\0" "\0" - /* _mesa_function_pool[13432]: CopyColorTable (offset 342) */ + /* _mesa_function_pool[13475]: CopyColorTable (offset 342) */ "iiiii\0" "glCopyColorTable\0" "glCopyColorTableSGI\0" "\0" - /* _mesa_function_pool[13476]: GetHistogramParameterfv (offset 362) */ + /* _mesa_function_pool[13519]: GetHistogramParameterfv (offset 362) */ "iip\0" "glGetHistogramParameterfv\0" "glGetHistogramParameterfvEXT\0" "\0" - /* _mesa_function_pool[13536]: Frustum (offset 289) */ + /* _mesa_function_pool[13579]: Frustum (offset 289) */ "dddddd\0" "glFrustum\0" "\0" - /* _mesa_function_pool[13554]: GetString (offset 275) */ + /* _mesa_function_pool[13597]: GetString (offset 275) */ "i\0" "glGetString\0" "\0" - /* _mesa_function_pool[13569]: ColorPointervINTEL (dynamic) */ + /* _mesa_function_pool[13612]: ColorPointervINTEL (dynamic) */ "iip\0" "glColorPointervINTEL\0" "\0" - /* _mesa_function_pool[13595]: TexEnvf (offset 184) */ + /* _mesa_function_pool[13638]: TexEnvf (offset 184) */ "iif\0" "glTexEnvf\0" "\0" - /* _mesa_function_pool[13610]: TexCoord3d (offset 110) */ + /* _mesa_function_pool[13653]: TexCoord3d (offset 110) */ "ddd\0" "glTexCoord3d\0" "\0" - /* _mesa_function_pool[13628]: AlphaFragmentOp1ATI (will be remapped) */ + /* _mesa_function_pool[13671]: AlphaFragmentOp1ATI (will be remapped) */ "iiiiii\0" "glAlphaFragmentOp1ATI\0" "\0" - /* _mesa_function_pool[13658]: TexCoord3f (offset 112) */ + /* _mesa_function_pool[13701]: TexCoord3f (offset 112) */ "fff\0" "glTexCoord3f\0" "\0" - /* _mesa_function_pool[13676]: MultiTexCoord3ivARB (offset 397) */ + /* _mesa_function_pool[13719]: MultiTexCoord3ivARB (offset 397) */ "ip\0" "glMultiTexCoord3iv\0" "glMultiTexCoord3ivARB\0" "\0" - /* _mesa_function_pool[13721]: MultiTexCoord2sARB (offset 390) */ + /* _mesa_function_pool[13764]: MultiTexCoord2sARB (offset 390) */ "iii\0" "glMultiTexCoord2s\0" "glMultiTexCoord2sARB\0" "\0" - /* _mesa_function_pool[13765]: VertexAttrib1dvARB (will be remapped) */ + /* _mesa_function_pool[13808]: VertexAttrib1dvARB (will be remapped) */ "ip\0" "glVertexAttrib1dv\0" "glVertexAttrib1dvARB\0" "\0" - /* _mesa_function_pool[13808]: DeleteTextures (offset 327) */ + /* _mesa_function_pool[13851]: DeleteTextures (offset 327) */ "ip\0" "glDeleteTextures\0" "glDeleteTexturesEXT\0" "\0" - /* _mesa_function_pool[13849]: TexCoordPointerEXT (will be remapped) */ + /* _mesa_function_pool[13892]: TexCoordPointerEXT (will be remapped) */ "iiiip\0" "glTexCoordPointerEXT\0" "\0" - /* _mesa_function_pool[13877]: TexSubImage4DSGIS (dynamic) */ + /* _mesa_function_pool[13920]: TexSubImage4DSGIS (dynamic) */ "iiiiiiiiiiiip\0" "glTexSubImage4DSGIS\0" "\0" - /* _mesa_function_pool[13912]: TexCoord3s (offset 116) */ + /* _mesa_function_pool[13955]: TexCoord3s (offset 116) */ "iii\0" "glTexCoord3s\0" "\0" - /* _mesa_function_pool[13930]: GetTexLevelParameteriv (offset 285) */ + /* _mesa_function_pool[13973]: GetTexLevelParameteriv (offset 285) */ "iiip\0" "glGetTexLevelParameteriv\0" "\0" - /* _mesa_function_pool[13961]: CombinerStageParameterfvNV (dynamic) */ + /* _mesa_function_pool[14004]: CombinerStageParameterfvNV (dynamic) */ "iip\0" "glCombinerStageParameterfvNV\0" "\0" - /* _mesa_function_pool[13995]: StopInstrumentsSGIX (dynamic) */ + /* _mesa_function_pool[14038]: StopInstrumentsSGIX (dynamic) */ "i\0" "glStopInstrumentsSGIX\0" "\0" - /* _mesa_function_pool[14020]: TexCoord4fColor4fNormal3fVertex4fSUN (dynamic) */ + /* _mesa_function_pool[14063]: TexCoord4fColor4fNormal3fVertex4fSUN (dynamic) */ "fffffffffffffff\0" "glTexCoord4fColor4fNormal3fVertex4fSUN\0" "\0" - /* _mesa_function_pool[14076]: ClearAccum (offset 204) */ + /* _mesa_function_pool[14119]: ClearAccum (offset 204) */ "ffff\0" "glClearAccum\0" "\0" - /* _mesa_function_pool[14095]: DeformSGIX (dynamic) */ + /* _mesa_function_pool[14138]: DeformSGIX (dynamic) */ "i\0" "glDeformSGIX\0" "\0" - /* _mesa_function_pool[14111]: GetVertexAttribfvARB (will be remapped) */ + /* _mesa_function_pool[14154]: GetVertexAttribfvARB (will be remapped) */ "iip\0" "glGetVertexAttribfv\0" "glGetVertexAttribfvARB\0" "\0" - /* _mesa_function_pool[14159]: SecondaryColor3ivEXT (will be remapped) */ + /* _mesa_function_pool[14202]: SecondaryColor3ivEXT (will be remapped) */ "p\0" "glSecondaryColor3iv\0" "glSecondaryColor3ivEXT\0" "\0" - /* _mesa_function_pool[14205]: TexCoord4iv (offset 123) */ + /* _mesa_function_pool[14248]: TexCoord4iv (offset 123) */ "p\0" "glTexCoord4iv\0" "\0" - /* _mesa_function_pool[14222]: UniformMatrix4x2fv (will be remapped) */ + /* _mesa_function_pool[14265]: UniformMatrix4x2fv (will be remapped) */ "iiip\0" "glUniformMatrix4x2fv\0" "\0" - /* _mesa_function_pool[14249]: GetDetailTexFuncSGIS (dynamic) */ + /* _mesa_function_pool[14292]: GetDetailTexFuncSGIS (dynamic) */ "ip\0" "glGetDetailTexFuncSGIS\0" "\0" - /* _mesa_function_pool[14276]: GetCombinerStageParameterfvNV (dynamic) */ + /* _mesa_function_pool[14319]: GetCombinerStageParameterfvNV (dynamic) */ "iip\0" "glGetCombinerStageParameterfvNV\0" "\0" - /* _mesa_function_pool[14313]: PolygonOffset (offset 319) */ + /* _mesa_function_pool[14356]: PolygonOffset (offset 319) */ "ff\0" "glPolygonOffset\0" "\0" - /* _mesa_function_pool[14333]: BindVertexArray (will be remapped) */ + /* _mesa_function_pool[14376]: BindVertexArray (will be remapped) */ "i\0" "glBindVertexArray\0" "\0" - /* _mesa_function_pool[14354]: Color4ubVertex2fvSUN (dynamic) */ + /* _mesa_function_pool[14397]: Color4ubVertex2fvSUN (dynamic) */ "pp\0" "glColor4ubVertex2fvSUN\0" "\0" - /* _mesa_function_pool[14381]: Rectd (offset 86) */ + /* _mesa_function_pool[14424]: Rectd (offset 86) */ "dddd\0" "glRectd\0" "\0" - /* _mesa_function_pool[14395]: TexFilterFuncSGIS (dynamic) */ + /* _mesa_function_pool[14438]: TexFilterFuncSGIS (dynamic) */ "iiip\0" "glTexFilterFuncSGIS\0" "\0" - /* _mesa_function_pool[14421]: SampleMaskSGIS (will be remapped) */ + /* _mesa_function_pool[14464]: SampleMaskSGIS (will be remapped) */ "fi\0" "glSampleMaskSGIS\0" "glSampleMaskEXT\0" "\0" - /* _mesa_function_pool[14458]: GetAttribLocationARB (will be remapped) */ + /* _mesa_function_pool[14501]: GetAttribLocationARB (will be remapped) */ "ip\0" "glGetAttribLocation\0" "glGetAttribLocationARB\0" "\0" - /* _mesa_function_pool[14505]: RasterPos3i (offset 74) */ + /* _mesa_function_pool[14548]: RasterPos3i (offset 74) */ "iii\0" "glRasterPos3i\0" "\0" - /* _mesa_function_pool[14524]: VertexAttrib4ubvARB (will be remapped) */ + /* _mesa_function_pool[14567]: VertexAttrib4ubvARB (will be remapped) */ "ip\0" "glVertexAttrib4ubv\0" "glVertexAttrib4ubvARB\0" "\0" - /* _mesa_function_pool[14569]: DetailTexFuncSGIS (dynamic) */ + /* _mesa_function_pool[14612]: DetailTexFuncSGIS (dynamic) */ "iip\0" "glDetailTexFuncSGIS\0" "\0" - /* _mesa_function_pool[14594]: Normal3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[14637]: Normal3fVertex3fSUN (dynamic) */ "ffffff\0" "glNormal3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[14624]: CopyTexImage2D (offset 324) */ + /* _mesa_function_pool[14667]: CopyTexImage2D (offset 324) */ "iiiiiiii\0" "glCopyTexImage2D\0" "glCopyTexImage2DEXT\0" "\0" - /* _mesa_function_pool[14671]: GetBufferPointervARB (will be remapped) */ + /* _mesa_function_pool[14714]: GetBufferPointervARB (will be remapped) */ "iip\0" "glGetBufferPointerv\0" "glGetBufferPointervARB\0" "\0" - /* _mesa_function_pool[14719]: ProgramEnvParameter4fARB (will be remapped) */ + /* _mesa_function_pool[14762]: ProgramEnvParameter4fARB (will be remapped) */ "iiffff\0" "glProgramEnvParameter4fARB\0" "glProgramParameter4fNV\0" "\0" - /* _mesa_function_pool[14777]: Uniform3ivARB (will be remapped) */ + /* _mesa_function_pool[14820]: Uniform3ivARB (will be remapped) */ "iip\0" "glUniform3iv\0" "glUniform3ivARB\0" "\0" - /* _mesa_function_pool[14811]: Lightfv (offset 160) */ + /* _mesa_function_pool[14854]: Lightfv (offset 160) */ "iip\0" "glLightfv\0" "\0" - /* _mesa_function_pool[14826]: ClearDepth (offset 208) */ + /* _mesa_function_pool[14869]: ClearDepth (offset 208) */ "d\0" "glClearDepth\0" "\0" - /* _mesa_function_pool[14842]: GetFenceivNV (will be remapped) */ + /* _mesa_function_pool[14885]: GetFenceivNV (will be remapped) */ "iip\0" "glGetFenceivNV\0" "\0" - /* _mesa_function_pool[14862]: WindowPos4dvMESA (will be remapped) */ + /* _mesa_function_pool[14905]: WindowPos4dvMESA (will be remapped) */ "p\0" "glWindowPos4dvMESA\0" "\0" - /* _mesa_function_pool[14884]: ColorSubTable (offset 346) */ + /* _mesa_function_pool[14927]: ColorSubTable (offset 346) */ "iiiiip\0" "glColorSubTable\0" "glColorSubTableEXT\0" "\0" - /* _mesa_function_pool[14927]: Color4fv (offset 30) */ + /* _mesa_function_pool[14970]: Color4fv (offset 30) */ "p\0" "glColor4fv\0" "\0" - /* _mesa_function_pool[14941]: MultiTexCoord4ivARB (offset 405) */ + /* _mesa_function_pool[14984]: MultiTexCoord4ivARB (offset 405) */ "ip\0" "glMultiTexCoord4iv\0" "glMultiTexCoord4ivARB\0" "\0" - /* _mesa_function_pool[14986]: ProgramLocalParameters4fvEXT (will be remapped) */ + /* _mesa_function_pool[15029]: ProgramLocalParameters4fvEXT (will be remapped) */ "iiip\0" "glProgramLocalParameters4fvEXT\0" "\0" - /* _mesa_function_pool[15023]: ColorPointer (offset 308) */ + /* _mesa_function_pool[15066]: ColorPointer (offset 308) */ "iiip\0" "glColorPointer\0" "\0" - /* _mesa_function_pool[15044]: Rects (offset 92) */ + /* _mesa_function_pool[15087]: Rects (offset 92) */ "iiii\0" "glRects\0" "\0" - /* _mesa_function_pool[15058]: GetMapAttribParameterfvNV (dynamic) */ + /* _mesa_function_pool[15101]: GetMapAttribParameterfvNV (dynamic) */ "iiip\0" "glGetMapAttribParameterfvNV\0" "\0" - /* _mesa_function_pool[15092]: Lightiv (offset 162) */ + /* _mesa_function_pool[15135]: Lightiv (offset 162) */ "iip\0" "glLightiv\0" "\0" - /* _mesa_function_pool[15107]: VertexAttrib4sARB (will be remapped) */ + /* _mesa_function_pool[15150]: VertexAttrib4sARB (will be remapped) */ "iiiii\0" "glVertexAttrib4s\0" "glVertexAttrib4sARB\0" "\0" - /* _mesa_function_pool[15151]: GetQueryObjectuivARB (will be remapped) */ + /* _mesa_function_pool[15194]: GetQueryObjectuivARB (will be remapped) */ "iip\0" "glGetQueryObjectuiv\0" "glGetQueryObjectuivARB\0" "\0" - /* _mesa_function_pool[15199]: GetTexParameteriv (offset 283) */ + /* _mesa_function_pool[15242]: GetTexParameteriv (offset 283) */ "iip\0" "glGetTexParameteriv\0" "\0" - /* _mesa_function_pool[15224]: MapParameterivNV (dynamic) */ + /* _mesa_function_pool[15267]: MapParameterivNV (dynamic) */ "iip\0" "glMapParameterivNV\0" "\0" - /* _mesa_function_pool[15248]: GenRenderbuffersEXT (will be remapped) */ + /* _mesa_function_pool[15291]: GenRenderbuffersEXT (will be remapped) */ "ip\0" "glGenRenderbuffers\0" "glGenRenderbuffersEXT\0" "\0" - /* _mesa_function_pool[15293]: VertexAttrib2dvARB (will be remapped) */ + /* _mesa_function_pool[15336]: VertexAttrib2dvARB (will be remapped) */ "ip\0" "glVertexAttrib2dv\0" "glVertexAttrib2dvARB\0" "\0" - /* _mesa_function_pool[15336]: EdgeFlagPointerEXT (will be remapped) */ + /* _mesa_function_pool[15379]: EdgeFlagPointerEXT (will be remapped) */ "iip\0" "glEdgeFlagPointerEXT\0" "\0" - /* _mesa_function_pool[15362]: VertexAttribs2svNV (will be remapped) */ + /* _mesa_function_pool[15405]: VertexAttribs2svNV (will be remapped) */ "iip\0" "glVertexAttribs2svNV\0" "\0" - /* _mesa_function_pool[15388]: WeightbvARB (dynamic) */ + /* _mesa_function_pool[15431]: WeightbvARB (dynamic) */ "ip\0" "glWeightbvARB\0" "\0" - /* _mesa_function_pool[15406]: VertexAttrib2fvARB (will be remapped) */ + /* _mesa_function_pool[15449]: VertexAttrib2fvARB (will be remapped) */ "ip\0" "glVertexAttrib2fv\0" "glVertexAttrib2fvARB\0" "\0" - /* _mesa_function_pool[15449]: GetBufferParameterivARB (will be remapped) */ + /* _mesa_function_pool[15492]: GetBufferParameterivARB (will be remapped) */ "iip\0" "glGetBufferParameteriv\0" "glGetBufferParameterivARB\0" "\0" - /* _mesa_function_pool[15503]: Rectdv (offset 87) */ + /* _mesa_function_pool[15546]: Rectdv (offset 87) */ "pp\0" "glRectdv\0" "\0" - /* _mesa_function_pool[15516]: ListParameteriSGIX (dynamic) */ + /* _mesa_function_pool[15559]: ListParameteriSGIX (dynamic) */ "iii\0" "glListParameteriSGIX\0" "\0" - /* _mesa_function_pool[15542]: ReplacementCodeuiColor4fNormal3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[15585]: ReplacementCodeuiColor4fNormal3fVertex3fSUN (dynamic) */ "iffffffffff\0" "glReplacementCodeuiColor4fNormal3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[15601]: InstrumentsBufferSGIX (dynamic) */ + /* _mesa_function_pool[15644]: InstrumentsBufferSGIX (dynamic) */ "ip\0" "glInstrumentsBufferSGIX\0" "\0" - /* _mesa_function_pool[15629]: VertexAttrib4NivARB (will be remapped) */ + /* _mesa_function_pool[15672]: VertexAttrib4NivARB (will be remapped) */ "ip\0" "glVertexAttrib4Niv\0" "glVertexAttrib4NivARB\0" "\0" - /* _mesa_function_pool[15674]: GetAttachedShaders (will be remapped) */ + /* _mesa_function_pool[15717]: GetAttachedShaders (will be remapped) */ "iipp\0" "glGetAttachedShaders\0" "\0" - /* _mesa_function_pool[15701]: GenVertexArraysAPPLE (will be remapped) */ + /* _mesa_function_pool[15744]: GenVertexArraysAPPLE (will be remapped) */ "ip\0" "glGenVertexArraysAPPLE\0" "\0" - /* _mesa_function_pool[15728]: Materialiv (offset 172) */ + /* _mesa_function_pool[15771]: Materialiv (offset 172) */ "iip\0" "glMaterialiv\0" "\0" - /* _mesa_function_pool[15746]: PushClientAttrib (offset 335) */ + /* _mesa_function_pool[15789]: PushClientAttrib (offset 335) */ "i\0" "glPushClientAttrib\0" "\0" - /* _mesa_function_pool[15768]: ProgramEnvParameters4fvEXT (will be remapped) */ + /* _mesa_function_pool[15811]: ProgramEnvParameters4fvEXT (will be remapped) */ "iiip\0" "glProgramEnvParameters4fvEXT\0" "\0" - /* _mesa_function_pool[15803]: TexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[15846]: TexCoord2fColor4fNormal3fVertex3fvSUN (dynamic) */ "pppp\0" "glTexCoord2fColor4fNormal3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[15849]: WindowPos2iMESA (will be remapped) */ + /* _mesa_function_pool[15892]: WindowPos2iMESA (will be remapped) */ "ii\0" "glWindowPos2i\0" "glWindowPos2iARB\0" "glWindowPos2iMESA\0" "\0" - /* _mesa_function_pool[15902]: SecondaryColor3fvEXT (will be remapped) */ + /* _mesa_function_pool[15945]: SecondaryColor3fvEXT (will be remapped) */ "p\0" "glSecondaryColor3fv\0" "glSecondaryColor3fvEXT\0" "\0" - /* _mesa_function_pool[15948]: PolygonMode (offset 174) */ + /* _mesa_function_pool[15991]: PolygonMode (offset 174) */ "ii\0" "glPolygonMode\0" "\0" - /* _mesa_function_pool[15966]: CompressedTexSubImage1DARB (will be remapped) */ + /* _mesa_function_pool[16009]: CompressedTexSubImage1DARB (will be remapped) */ "iiiiiip\0" "glCompressedTexSubImage1D\0" "glCompressedTexSubImage1DARB\0" "\0" - /* _mesa_function_pool[16030]: GetVertexAttribivNV (will be remapped) */ + /* _mesa_function_pool[16073]: GetVertexAttribivNV (will be remapped) */ "iip\0" "glGetVertexAttribivNV\0" "\0" - /* _mesa_function_pool[16057]: GetProgramStringARB (will be remapped) */ + /* _mesa_function_pool[16100]: GetProgramStringARB (will be remapped) */ "iip\0" "glGetProgramStringARB\0" "\0" - /* _mesa_function_pool[16084]: TexBumpParameterfvATI (will be remapped) */ + /* _mesa_function_pool[16127]: TexBumpParameterfvATI (will be remapped) */ "ip\0" "glTexBumpParameterfvATI\0" "\0" - /* _mesa_function_pool[16112]: CompileShaderARB (will be remapped) */ + /* _mesa_function_pool[16155]: CompileShaderARB (will be remapped) */ "i\0" "glCompileShader\0" "glCompileShaderARB\0" "\0" - /* _mesa_function_pool[16150]: DeleteShader (will be remapped) */ + /* _mesa_function_pool[16193]: DeleteShader (will be remapped) */ "i\0" "glDeleteShader\0" "\0" - /* _mesa_function_pool[16168]: DisableClientState (offset 309) */ + /* _mesa_function_pool[16211]: DisableClientState (offset 309) */ "i\0" "glDisableClientState\0" "\0" - /* _mesa_function_pool[16192]: TexGeni (offset 192) */ + /* _mesa_function_pool[16235]: TexGeni (offset 192) */ "iii\0" "glTexGeni\0" "\0" - /* _mesa_function_pool[16207]: TexGenf (offset 190) */ + /* _mesa_function_pool[16250]: TexGenf (offset 190) */ "iif\0" "glTexGenf\0" "\0" - /* _mesa_function_pool[16222]: Uniform3fARB (will be remapped) */ + /* _mesa_function_pool[16265]: Uniform3fARB (will be remapped) */ "ifff\0" "glUniform3f\0" "glUniform3fARB\0" "\0" - /* _mesa_function_pool[16255]: TexGend (offset 188) */ + /* _mesa_function_pool[16298]: TexGend (offset 188) */ "iid\0" "glTexGend\0" "\0" - /* _mesa_function_pool[16270]: ListParameterfvSGIX (dynamic) */ + /* _mesa_function_pool[16313]: ListParameterfvSGIX (dynamic) */ "iip\0" "glListParameterfvSGIX\0" "\0" - /* _mesa_function_pool[16297]: GetPolygonStipple (offset 274) */ + /* _mesa_function_pool[16340]: GetPolygonStipple (offset 274) */ "p\0" "glGetPolygonStipple\0" "\0" - /* _mesa_function_pool[16320]: Tangent3dvEXT (dynamic) */ + /* _mesa_function_pool[16363]: Tangent3dvEXT (dynamic) */ "p\0" "glTangent3dvEXT\0" "\0" - /* _mesa_function_pool[16339]: GetVertexAttribfvNV (will be remapped) */ + /* _mesa_function_pool[16382]: GetVertexAttribfvNV (will be remapped) */ "iip\0" "glGetVertexAttribfvNV\0" "\0" - /* _mesa_function_pool[16366]: WindowPos3sMESA (will be remapped) */ + /* _mesa_function_pool[16409]: WindowPos3sMESA (will be remapped) */ "iii\0" "glWindowPos3s\0" "glWindowPos3sARB\0" "glWindowPos3sMESA\0" "\0" - /* _mesa_function_pool[16420]: VertexAttrib2svNV (will be remapped) */ + /* _mesa_function_pool[16463]: VertexAttrib2svNV (will be remapped) */ "ip\0" "glVertexAttrib2svNV\0" "\0" - /* _mesa_function_pool[16444]: VertexAttribs1fvNV (will be remapped) */ + /* _mesa_function_pool[16487]: VertexAttribs1fvNV (will be remapped) */ "iip\0" "glVertexAttribs1fvNV\0" "\0" - /* _mesa_function_pool[16470]: TexCoord2fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[16513]: TexCoord2fVertex3fvSUN (dynamic) */ "pp\0" "glTexCoord2fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[16499]: WindowPos4sMESA (will be remapped) */ + /* _mesa_function_pool[16542]: WindowPos4sMESA (will be remapped) */ "iiii\0" "glWindowPos4sMESA\0" "\0" - /* _mesa_function_pool[16523]: VertexAttrib4NuivARB (will be remapped) */ + /* _mesa_function_pool[16566]: VertexAttrib4NuivARB (will be remapped) */ "ip\0" "glVertexAttrib4Nuiv\0" "glVertexAttrib4NuivARB\0" "\0" - /* _mesa_function_pool[16570]: ClientActiveTextureARB (offset 375) */ + /* _mesa_function_pool[16613]: ClientActiveTextureARB (offset 375) */ "i\0" "glClientActiveTexture\0" "glClientActiveTextureARB\0" "\0" - /* _mesa_function_pool[16620]: PixelTexGenSGIX (will be remapped) */ + /* _mesa_function_pool[16663]: PixelTexGenSGIX (will be remapped) */ "i\0" "glPixelTexGenSGIX\0" "\0" - /* _mesa_function_pool[16641]: ReplacementCodeusvSUN (dynamic) */ + /* _mesa_function_pool[16684]: ReplacementCodeusvSUN (dynamic) */ "p\0" "glReplacementCodeusvSUN\0" "\0" - /* _mesa_function_pool[16668]: Uniform4fARB (will be remapped) */ + /* _mesa_function_pool[16711]: Uniform4fARB (will be remapped) */ "iffff\0" "glUniform4f\0" "glUniform4fARB\0" "\0" - /* _mesa_function_pool[16702]: Color4sv (offset 34) */ + /* _mesa_function_pool[16745]: Color4sv (offset 34) */ "p\0" "glColor4sv\0" "\0" - /* _mesa_function_pool[16716]: FlushMappedBufferRange (will be remapped) */ + /* _mesa_function_pool[16759]: FlushMappedBufferRange (will be remapped) */ "iii\0" "glFlushMappedBufferRange\0" "\0" - /* _mesa_function_pool[16746]: IsProgramNV (will be remapped) */ + /* _mesa_function_pool[16789]: IsProgramNV (will be remapped) */ "i\0" "glIsProgramARB\0" "glIsProgramNV\0" "\0" - /* _mesa_function_pool[16778]: FlushMappedBufferRangeAPPLE (will be remapped) */ + /* _mesa_function_pool[16821]: FlushMappedBufferRangeAPPLE (will be remapped) */ "iii\0" "glFlushMappedBufferRangeAPPLE\0" "\0" - /* _mesa_function_pool[16813]: PixelZoom (offset 246) */ + /* _mesa_function_pool[16856]: PixelZoom (offset 246) */ "ff\0" "glPixelZoom\0" "\0" - /* _mesa_function_pool[16829]: ReplacementCodePointerSUN (dynamic) */ + /* _mesa_function_pool[16872]: ReplacementCodePointerSUN (dynamic) */ "iip\0" "glReplacementCodePointerSUN\0" "\0" - /* _mesa_function_pool[16862]: ProgramEnvParameter4dARB (will be remapped) */ + /* _mesa_function_pool[16905]: ProgramEnvParameter4dARB (will be remapped) */ "iidddd\0" "glProgramEnvParameter4dARB\0" "glProgramParameter4dNV\0" "\0" - /* _mesa_function_pool[16920]: ColorTableParameterfv (offset 340) */ + /* _mesa_function_pool[16963]: ColorTableParameterfv (offset 340) */ "iip\0" "glColorTableParameterfv\0" "glColorTableParameterfvSGI\0" "\0" - /* _mesa_function_pool[16976]: FragmentLightModelfSGIX (dynamic) */ + /* _mesa_function_pool[17019]: FragmentLightModelfSGIX (dynamic) */ "if\0" "glFragmentLightModelfSGIX\0" "\0" - /* _mesa_function_pool[17006]: Binormal3bvEXT (dynamic) */ + /* _mesa_function_pool[17049]: Binormal3bvEXT (dynamic) */ "p\0" "glBinormal3bvEXT\0" "\0" - /* _mesa_function_pool[17026]: PixelMapuiv (offset 252) */ + /* _mesa_function_pool[17069]: PixelMapuiv (offset 252) */ "iip\0" "glPixelMapuiv\0" "\0" - /* _mesa_function_pool[17045]: Color3dv (offset 12) */ + /* _mesa_function_pool[17088]: Color3dv (offset 12) */ "p\0" "glColor3dv\0" "\0" - /* _mesa_function_pool[17059]: IsTexture (offset 330) */ + /* _mesa_function_pool[17102]: IsTexture (offset 330) */ "i\0" "glIsTexture\0" "glIsTextureEXT\0" "\0" - /* _mesa_function_pool[17089]: VertexWeightfvEXT (dynamic) */ + /* _mesa_function_pool[17132]: VertexWeightfvEXT (dynamic) */ "p\0" "glVertexWeightfvEXT\0" "\0" - /* _mesa_function_pool[17112]: VertexAttrib1dARB (will be remapped) */ + /* _mesa_function_pool[17155]: VertexAttrib1dARB (will be remapped) */ "id\0" "glVertexAttrib1d\0" "glVertexAttrib1dARB\0" "\0" - /* _mesa_function_pool[17153]: ImageTransformParameterivHP (dynamic) */ + /* _mesa_function_pool[17196]: ImageTransformParameterivHP (dynamic) */ "iip\0" "glImageTransformParameterivHP\0" "\0" - /* _mesa_function_pool[17188]: TexCoord4i (offset 122) */ + /* _mesa_function_pool[17231]: TexCoord4i (offset 122) */ "iiii\0" "glTexCoord4i\0" "\0" - /* _mesa_function_pool[17207]: DeleteQueriesARB (will be remapped) */ + /* _mesa_function_pool[17250]: DeleteQueriesARB (will be remapped) */ "ip\0" "glDeleteQueries\0" "glDeleteQueriesARB\0" "\0" - /* _mesa_function_pool[17246]: Color4ubVertex2fSUN (dynamic) */ + /* _mesa_function_pool[17289]: Color4ubVertex2fSUN (dynamic) */ "iiiiff\0" "glColor4ubVertex2fSUN\0" "\0" - /* _mesa_function_pool[17276]: FragmentColorMaterialSGIX (dynamic) */ + /* _mesa_function_pool[17319]: FragmentColorMaterialSGIX (dynamic) */ "ii\0" "glFragmentColorMaterialSGIX\0" "\0" - /* _mesa_function_pool[17308]: CurrentPaletteMatrixARB (dynamic) */ + /* _mesa_function_pool[17351]: CurrentPaletteMatrixARB (dynamic) */ "i\0" "glCurrentPaletteMatrixARB\0" "\0" - /* _mesa_function_pool[17337]: GetMapdv (offset 266) */ + /* _mesa_function_pool[17380]: GetMapdv (offset 266) */ "iip\0" "glGetMapdv\0" "\0" - /* _mesa_function_pool[17353]: SamplePatternSGIS (will be remapped) */ + /* _mesa_function_pool[17396]: SamplePatternSGIS (will be remapped) */ "i\0" "glSamplePatternSGIS\0" "glSamplePatternEXT\0" "\0" - /* _mesa_function_pool[17395]: PixelStoref (offset 249) */ + /* _mesa_function_pool[17438]: PixelStoref (offset 249) */ "if\0" "glPixelStoref\0" "\0" - /* _mesa_function_pool[17413]: IsQueryARB (will be remapped) */ + /* _mesa_function_pool[17456]: IsQueryARB (will be remapped) */ "i\0" "glIsQuery\0" "glIsQueryARB\0" "\0" - /* _mesa_function_pool[17439]: ReplacementCodeuiColor4ubVertex3fSUN (dynamic) */ + /* _mesa_function_pool[17482]: ReplacementCodeuiColor4ubVertex3fSUN (dynamic) */ "iiiiifff\0" "glReplacementCodeuiColor4ubVertex3fSUN\0" "\0" - /* _mesa_function_pool[17488]: PixelStorei (offset 250) */ + /* _mesa_function_pool[17531]: PixelStorei (offset 250) */ "ii\0" "glPixelStorei\0" "\0" - /* _mesa_function_pool[17506]: VertexAttrib4usvARB (will be remapped) */ + /* _mesa_function_pool[17549]: VertexAttrib4usvARB (will be remapped) */ "ip\0" "glVertexAttrib4usv\0" "glVertexAttrib4usvARB\0" "\0" - /* _mesa_function_pool[17551]: LinkProgramARB (will be remapped) */ + /* _mesa_function_pool[17594]: LinkProgramARB (will be remapped) */ "i\0" "glLinkProgram\0" "glLinkProgramARB\0" "\0" - /* _mesa_function_pool[17585]: VertexAttrib2fNV (will be remapped) */ + /* _mesa_function_pool[17628]: VertexAttrib2fNV (will be remapped) */ "iff\0" "glVertexAttrib2fNV\0" "\0" - /* _mesa_function_pool[17609]: ShaderSourceARB (will be remapped) */ + /* _mesa_function_pool[17652]: ShaderSourceARB (will be remapped) */ "iipp\0" "glShaderSource\0" "glShaderSourceARB\0" "\0" - /* _mesa_function_pool[17648]: FragmentMaterialiSGIX (dynamic) */ + /* _mesa_function_pool[17691]: FragmentMaterialiSGIX (dynamic) */ "iii\0" "glFragmentMaterialiSGIX\0" "\0" - /* _mesa_function_pool[17677]: EvalCoord2dv (offset 233) */ + /* _mesa_function_pool[17720]: EvalCoord2dv (offset 233) */ "p\0" "glEvalCoord2dv\0" "\0" - /* _mesa_function_pool[17695]: VertexAttrib3svARB (will be remapped) */ + /* _mesa_function_pool[17738]: VertexAttrib3svARB (will be remapped) */ "ip\0" "glVertexAttrib3sv\0" "glVertexAttrib3svARB\0" "\0" - /* _mesa_function_pool[17738]: ColorMaterial (offset 151) */ + /* _mesa_function_pool[17781]: ColorMaterial (offset 151) */ "ii\0" "glColorMaterial\0" "\0" - /* _mesa_function_pool[17758]: CompressedTexSubImage3DARB (will be remapped) */ + /* _mesa_function_pool[17801]: CompressedTexSubImage3DARB (will be remapped) */ "iiiiiiiiiip\0" "glCompressedTexSubImage3D\0" "glCompressedTexSubImage3DARB\0" "\0" - /* _mesa_function_pool[17826]: WindowPos2ivMESA (will be remapped) */ + /* _mesa_function_pool[17869]: WindowPos2ivMESA (will be remapped) */ "p\0" "glWindowPos2iv\0" "glWindowPos2ivARB\0" "glWindowPos2ivMESA\0" "\0" - /* _mesa_function_pool[17881]: IsFramebufferEXT (will be remapped) */ + /* _mesa_function_pool[17924]: IsFramebufferEXT (will be remapped) */ "i\0" "glIsFramebuffer\0" "glIsFramebufferEXT\0" "\0" - /* _mesa_function_pool[17919]: Uniform4ivARB (will be remapped) */ + /* _mesa_function_pool[17962]: Uniform4ivARB (will be remapped) */ "iip\0" "glUniform4iv\0" "glUniform4ivARB\0" "\0" - /* _mesa_function_pool[17953]: GetVertexAttribdvARB (will be remapped) */ + /* _mesa_function_pool[17996]: GetVertexAttribdvARB (will be remapped) */ "iip\0" "glGetVertexAttribdv\0" "glGetVertexAttribdvARB\0" "\0" - /* _mesa_function_pool[18001]: TexBumpParameterivATI (will be remapped) */ + /* _mesa_function_pool[18044]: TexBumpParameterivATI (will be remapped) */ "ip\0" "glTexBumpParameterivATI\0" "\0" - /* _mesa_function_pool[18029]: GetSeparableFilter (offset 359) */ + /* _mesa_function_pool[18072]: GetSeparableFilter (offset 359) */ "iiippp\0" "glGetSeparableFilter\0" "glGetSeparableFilterEXT\0" "\0" - /* _mesa_function_pool[18082]: Binormal3dEXT (dynamic) */ + /* _mesa_function_pool[18125]: Binormal3dEXT (dynamic) */ "ddd\0" "glBinormal3dEXT\0" "\0" - /* _mesa_function_pool[18103]: SpriteParameteriSGIX (dynamic) */ + /* _mesa_function_pool[18146]: SpriteParameteriSGIX (dynamic) */ "ii\0" "glSpriteParameteriSGIX\0" "\0" - /* _mesa_function_pool[18130]: RequestResidentProgramsNV (will be remapped) */ + /* _mesa_function_pool[18173]: RequestResidentProgramsNV (will be remapped) */ "ip\0" "glRequestResidentProgramsNV\0" "\0" - /* _mesa_function_pool[18162]: TagSampleBufferSGIX (dynamic) */ + /* _mesa_function_pool[18205]: TagSampleBufferSGIX (dynamic) */ "\0" "glTagSampleBufferSGIX\0" "\0" - /* _mesa_function_pool[18186]: ReplacementCodeusSUN (dynamic) */ + /* _mesa_function_pool[18229]: ReplacementCodeusSUN (dynamic) */ "i\0" "glReplacementCodeusSUN\0" "\0" - /* _mesa_function_pool[18212]: FeedbackBuffer (offset 194) */ + /* _mesa_function_pool[18255]: FeedbackBuffer (offset 194) */ "iip\0" "glFeedbackBuffer\0" "\0" - /* _mesa_function_pool[18234]: RasterPos2iv (offset 67) */ + /* _mesa_function_pool[18277]: RasterPos2iv (offset 67) */ "p\0" "glRasterPos2iv\0" "\0" - /* _mesa_function_pool[18252]: TexImage1D (offset 182) */ + /* _mesa_function_pool[18295]: TexImage1D (offset 182) */ "iiiiiiip\0" "glTexImage1D\0" "\0" - /* _mesa_function_pool[18275]: ListParameterivSGIX (dynamic) */ + /* _mesa_function_pool[18318]: ListParameterivSGIX (dynamic) */ "iip\0" "glListParameterivSGIX\0" "\0" - /* _mesa_function_pool[18302]: MultiDrawElementsEXT (will be remapped) */ + /* _mesa_function_pool[18345]: MultiDrawElementsEXT (will be remapped) */ "ipipi\0" "glMultiDrawElements\0" "glMultiDrawElementsEXT\0" "\0" - /* _mesa_function_pool[18352]: Color3s (offset 17) */ + /* _mesa_function_pool[18395]: Color3s (offset 17) */ "iii\0" "glColor3s\0" "\0" - /* _mesa_function_pool[18367]: Uniform1ivARB (will be remapped) */ + /* _mesa_function_pool[18410]: Uniform1ivARB (will be remapped) */ "iip\0" "glUniform1iv\0" "glUniform1ivARB\0" "\0" - /* _mesa_function_pool[18401]: WindowPos2sMESA (will be remapped) */ + /* _mesa_function_pool[18444]: WindowPos2sMESA (will be remapped) */ "ii\0" "glWindowPos2s\0" "glWindowPos2sARB\0" "glWindowPos2sMESA\0" "\0" - /* _mesa_function_pool[18454]: WeightusvARB (dynamic) */ + /* _mesa_function_pool[18497]: WeightusvARB (dynamic) */ "ip\0" "glWeightusvARB\0" "\0" - /* _mesa_function_pool[18473]: TexCoordPointer (offset 320) */ + /* _mesa_function_pool[18516]: TexCoordPointer (offset 320) */ "iiip\0" "glTexCoordPointer\0" "\0" - /* _mesa_function_pool[18497]: FogCoordPointerEXT (will be remapped) */ + /* _mesa_function_pool[18540]: FogCoordPointerEXT (will be remapped) */ "iip\0" "glFogCoordPointer\0" "glFogCoordPointerEXT\0" "\0" - /* _mesa_function_pool[18541]: IndexMaterialEXT (dynamic) */ + /* _mesa_function_pool[18584]: IndexMaterialEXT (dynamic) */ "ii\0" "glIndexMaterialEXT\0" "\0" - /* _mesa_function_pool[18564]: Color3i (offset 15) */ + /* _mesa_function_pool[18607]: Color3i (offset 15) */ "iii\0" "glColor3i\0" "\0" - /* _mesa_function_pool[18579]: FrontFace (offset 157) */ + /* _mesa_function_pool[18622]: FrontFace (offset 157) */ "i\0" "glFrontFace\0" "\0" - /* _mesa_function_pool[18594]: EvalCoord2d (offset 232) */ + /* _mesa_function_pool[18637]: EvalCoord2d (offset 232) */ "dd\0" "glEvalCoord2d\0" "\0" - /* _mesa_function_pool[18612]: SecondaryColor3ubvEXT (will be remapped) */ + /* _mesa_function_pool[18655]: SecondaryColor3ubvEXT (will be remapped) */ "p\0" "glSecondaryColor3ubv\0" "glSecondaryColor3ubvEXT\0" "\0" - /* _mesa_function_pool[18660]: EvalCoord2f (offset 234) */ + /* _mesa_function_pool[18703]: EvalCoord2f (offset 234) */ "ff\0" "glEvalCoord2f\0" "\0" - /* _mesa_function_pool[18678]: VertexAttrib4dvARB (will be remapped) */ + /* _mesa_function_pool[18721]: VertexAttrib4dvARB (will be remapped) */ "ip\0" "glVertexAttrib4dv\0" "glVertexAttrib4dvARB\0" "\0" - /* _mesa_function_pool[18721]: BindAttribLocationARB (will be remapped) */ + /* _mesa_function_pool[18764]: BindAttribLocationARB (will be remapped) */ "iip\0" "glBindAttribLocation\0" "glBindAttribLocationARB\0" "\0" - /* _mesa_function_pool[18771]: Color3b (offset 9) */ + /* _mesa_function_pool[18814]: Color3b (offset 9) */ "iii\0" "glColor3b\0" "\0" - /* _mesa_function_pool[18786]: MultiTexCoord2dARB (offset 384) */ + /* _mesa_function_pool[18829]: MultiTexCoord2dARB (offset 384) */ "idd\0" "glMultiTexCoord2d\0" "glMultiTexCoord2dARB\0" "\0" - /* _mesa_function_pool[18830]: ExecuteProgramNV (will be remapped) */ + /* _mesa_function_pool[18873]: ExecuteProgramNV (will be remapped) */ "iip\0" "glExecuteProgramNV\0" "\0" - /* _mesa_function_pool[18854]: Color3f (offset 13) */ + /* _mesa_function_pool[18897]: Color3f (offset 13) */ "fff\0" "glColor3f\0" "\0" - /* _mesa_function_pool[18869]: LightEnviSGIX (dynamic) */ + /* _mesa_function_pool[18912]: LightEnviSGIX (dynamic) */ "ii\0" "glLightEnviSGIX\0" "\0" - /* _mesa_function_pool[18889]: Color3d (offset 11) */ + /* _mesa_function_pool[18932]: Color3d (offset 11) */ "ddd\0" "glColor3d\0" "\0" - /* _mesa_function_pool[18904]: Normal3dv (offset 55) */ + /* _mesa_function_pool[18947]: Normal3dv (offset 55) */ "p\0" "glNormal3dv\0" "\0" - /* _mesa_function_pool[18919]: Lightf (offset 159) */ + /* _mesa_function_pool[18962]: Lightf (offset 159) */ "iif\0" "glLightf\0" "\0" - /* _mesa_function_pool[18933]: ReplacementCodeuiSUN (dynamic) */ + /* _mesa_function_pool[18976]: ReplacementCodeuiSUN (dynamic) */ "i\0" "glReplacementCodeuiSUN\0" "\0" - /* _mesa_function_pool[18959]: MatrixMode (offset 293) */ + /* _mesa_function_pool[19002]: MatrixMode (offset 293) */ "i\0" "glMatrixMode\0" "\0" - /* _mesa_function_pool[18975]: GetPixelMapusv (offset 273) */ + /* _mesa_function_pool[19018]: GetPixelMapusv (offset 273) */ "ip\0" "glGetPixelMapusv\0" "\0" - /* _mesa_function_pool[18996]: Lighti (offset 161) */ + /* _mesa_function_pool[19039]: Lighti (offset 161) */ "iii\0" "glLighti\0" "\0" - /* _mesa_function_pool[19010]: VertexAttribPointerNV (will be remapped) */ + /* _mesa_function_pool[19053]: VertexAttribPointerNV (will be remapped) */ "iiiip\0" "glVertexAttribPointerNV\0" "\0" - /* _mesa_function_pool[19041]: GetFramebufferAttachmentParameterivEXT (will be remapped) */ + /* _mesa_function_pool[19084]: GetFramebufferAttachmentParameterivEXT (will be remapped) */ "iiip\0" "glGetFramebufferAttachmentParameteriv\0" "glGetFramebufferAttachmentParameterivEXT\0" "\0" - /* _mesa_function_pool[19126]: PixelTransformParameterfEXT (dynamic) */ + /* _mesa_function_pool[19169]: PixelTransformParameterfEXT (dynamic) */ "iif\0" "glPixelTransformParameterfEXT\0" "\0" - /* _mesa_function_pool[19161]: MultiTexCoord4dvARB (offset 401) */ + /* _mesa_function_pool[19204]: MultiTexCoord4dvARB (offset 401) */ "ip\0" "glMultiTexCoord4dv\0" "glMultiTexCoord4dvARB\0" "\0" - /* _mesa_function_pool[19206]: PixelTransformParameteriEXT (dynamic) */ + /* _mesa_function_pool[19249]: PixelTransformParameteriEXT (dynamic) */ "iii\0" "glPixelTransformParameteriEXT\0" "\0" - /* _mesa_function_pool[19241]: GetDoublev (offset 260) */ + /* _mesa_function_pool[19284]: GetDoublev (offset 260) */ "ip\0" "glGetDoublev\0" "\0" - /* _mesa_function_pool[19258]: MultMatrixd (offset 295) */ + /* _mesa_function_pool[19301]: MultMatrixd (offset 295) */ "p\0" "glMultMatrixd\0" "\0" - /* _mesa_function_pool[19275]: MultMatrixf (offset 294) */ + /* _mesa_function_pool[19318]: MultMatrixf (offset 294) */ "p\0" "glMultMatrixf\0" "\0" - /* _mesa_function_pool[19292]: TexCoord2fColor4ubVertex3fSUN (dynamic) */ + /* _mesa_function_pool[19335]: TexCoord2fColor4ubVertex3fSUN (dynamic) */ "ffiiiifff\0" "glTexCoord2fColor4ubVertex3fSUN\0" "\0" - /* _mesa_function_pool[19335]: Uniform1iARB (will be remapped) */ + /* _mesa_function_pool[19378]: Uniform1iARB (will be remapped) */ "ii\0" "glUniform1i\0" "glUniform1iARB\0" "\0" - /* _mesa_function_pool[19366]: VertexAttribPointerARB (will be remapped) */ + /* _mesa_function_pool[19409]: VertexAttribPointerARB (will be remapped) */ "iiiiip\0" "glVertexAttribPointer\0" "glVertexAttribPointerARB\0" "\0" - /* _mesa_function_pool[19421]: SharpenTexFuncSGIS (dynamic) */ + /* _mesa_function_pool[19464]: SharpenTexFuncSGIS (dynamic) */ "iip\0" "glSharpenTexFuncSGIS\0" "\0" - /* _mesa_function_pool[19447]: MultiTexCoord4fvARB (offset 403) */ + /* _mesa_function_pool[19490]: MultiTexCoord4fvARB (offset 403) */ "ip\0" "glMultiTexCoord4fv\0" "glMultiTexCoord4fvARB\0" "\0" - /* _mesa_function_pool[19492]: UniformMatrix2x3fv (will be remapped) */ + /* _mesa_function_pool[19535]: UniformMatrix2x3fv (will be remapped) */ "iiip\0" "glUniformMatrix2x3fv\0" "\0" - /* _mesa_function_pool[19519]: TrackMatrixNV (will be remapped) */ + /* _mesa_function_pool[19562]: TrackMatrixNV (will be remapped) */ "iiii\0" "glTrackMatrixNV\0" "\0" - /* _mesa_function_pool[19541]: CombinerParameteriNV (will be remapped) */ + /* _mesa_function_pool[19584]: CombinerParameteriNV (will be remapped) */ "ii\0" "glCombinerParameteriNV\0" "\0" - /* _mesa_function_pool[19568]: DeleteAsyncMarkersSGIX (dynamic) */ + /* _mesa_function_pool[19611]: DeleteAsyncMarkersSGIX (dynamic) */ "ii\0" "glDeleteAsyncMarkersSGIX\0" "\0" - /* _mesa_function_pool[19597]: IsAsyncMarkerSGIX (dynamic) */ + /* _mesa_function_pool[19640]: IsAsyncMarkerSGIX (dynamic) */ "i\0" "glIsAsyncMarkerSGIX\0" "\0" - /* _mesa_function_pool[19620]: FrameZoomSGIX (dynamic) */ + /* _mesa_function_pool[19663]: FrameZoomSGIX (dynamic) */ "i\0" "glFrameZoomSGIX\0" "\0" - /* _mesa_function_pool[19639]: Normal3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[19682]: Normal3fVertex3fvSUN (dynamic) */ "pp\0" "glNormal3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[19666]: RasterPos4sv (offset 85) */ + /* _mesa_function_pool[19709]: RasterPos4sv (offset 85) */ "p\0" "glRasterPos4sv\0" "\0" - /* _mesa_function_pool[19684]: VertexAttrib4NsvARB (will be remapped) */ + /* _mesa_function_pool[19727]: VertexAttrib4NsvARB (will be remapped) */ "ip\0" "glVertexAttrib4Nsv\0" "glVertexAttrib4NsvARB\0" "\0" - /* _mesa_function_pool[19729]: VertexAttrib3fvARB (will be remapped) */ + /* _mesa_function_pool[19772]: VertexAttrib3fvARB (will be remapped) */ "ip\0" "glVertexAttrib3fv\0" "glVertexAttrib3fvARB\0" "\0" - /* _mesa_function_pool[19772]: ClearColor (offset 206) */ + /* _mesa_function_pool[19815]: ClearColor (offset 206) */ "ffff\0" "glClearColor\0" "\0" - /* _mesa_function_pool[19791]: GetSynciv (will be remapped) */ + /* _mesa_function_pool[19834]: GetSynciv (will be remapped) */ "iiipp\0" "glGetSynciv\0" "\0" - /* _mesa_function_pool[19810]: DeleteFramebuffersEXT (will be remapped) */ + /* _mesa_function_pool[19853]: DeleteFramebuffersEXT (will be remapped) */ "ip\0" "glDeleteFramebuffers\0" "glDeleteFramebuffersEXT\0" "\0" - /* _mesa_function_pool[19859]: GlobalAlphaFactorsSUN (dynamic) */ + /* _mesa_function_pool[19902]: GlobalAlphaFactorsSUN (dynamic) */ "i\0" "glGlobalAlphaFactorsSUN\0" "\0" - /* _mesa_function_pool[19886]: TexEnviv (offset 187) */ + /* _mesa_function_pool[19929]: TexEnviv (offset 187) */ "iip\0" "glTexEnviv\0" "\0" - /* _mesa_function_pool[19902]: TexSubImage3D (offset 372) */ + /* _mesa_function_pool[19945]: TexSubImage3D (offset 372) */ "iiiiiiiiiip\0" "glTexSubImage3D\0" "glTexSubImage3DEXT\0" "\0" - /* _mesa_function_pool[19950]: Tangent3fEXT (dynamic) */ + /* _mesa_function_pool[19993]: Tangent3fEXT (dynamic) */ "fff\0" "glTangent3fEXT\0" "\0" - /* _mesa_function_pool[19970]: SecondaryColor3uivEXT (will be remapped) */ + /* _mesa_function_pool[20013]: SecondaryColor3uivEXT (will be remapped) */ "p\0" "glSecondaryColor3uiv\0" "glSecondaryColor3uivEXT\0" "\0" - /* _mesa_function_pool[20018]: MatrixIndexubvARB (dynamic) */ + /* _mesa_function_pool[20061]: MatrixIndexubvARB (dynamic) */ "ip\0" "glMatrixIndexubvARB\0" "\0" - /* _mesa_function_pool[20042]: Color4fNormal3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[20085]: Color4fNormal3fVertex3fSUN (dynamic) */ "ffffffffff\0" "glColor4fNormal3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[20083]: PixelTexGenParameterfSGIS (will be remapped) */ + /* _mesa_function_pool[20126]: PixelTexGenParameterfSGIS (will be remapped) */ "if\0" "glPixelTexGenParameterfSGIS\0" "\0" - /* _mesa_function_pool[20115]: CreateShader (will be remapped) */ + /* _mesa_function_pool[20158]: CreateShader (will be remapped) */ "i\0" "glCreateShader\0" "\0" - /* _mesa_function_pool[20133]: GetColorTableParameterfv (offset 344) */ + /* _mesa_function_pool[20176]: GetColorTableParameterfv (offset 344) */ "iip\0" "glGetColorTableParameterfv\0" "glGetColorTableParameterfvSGI\0" "glGetColorTableParameterfvEXT\0" "\0" - /* _mesa_function_pool[20225]: FragmentLightModelfvSGIX (dynamic) */ + /* _mesa_function_pool[20268]: FragmentLightModelfvSGIX (dynamic) */ "ip\0" "glFragmentLightModelfvSGIX\0" "\0" - /* _mesa_function_pool[20256]: Bitmap (offset 8) */ + /* _mesa_function_pool[20299]: Bitmap (offset 8) */ "iiffffp\0" "glBitmap\0" "\0" - /* _mesa_function_pool[20274]: MultiTexCoord3fARB (offset 394) */ + /* _mesa_function_pool[20317]: MultiTexCoord3fARB (offset 394) */ "ifff\0" "glMultiTexCoord3f\0" "glMultiTexCoord3fARB\0" "\0" - /* _mesa_function_pool[20319]: GetTexLevelParameterfv (offset 284) */ + /* _mesa_function_pool[20362]: GetTexLevelParameterfv (offset 284) */ "iiip\0" "glGetTexLevelParameterfv\0" "\0" - /* _mesa_function_pool[20350]: GetPixelTexGenParameterfvSGIS (will be remapped) */ + /* _mesa_function_pool[20393]: GetPixelTexGenParameterfvSGIS (will be remapped) */ "ip\0" "glGetPixelTexGenParameterfvSGIS\0" "\0" - /* _mesa_function_pool[20386]: GenFramebuffersEXT (will be remapped) */ + /* _mesa_function_pool[20429]: GenFramebuffersEXT (will be remapped) */ "ip\0" "glGenFramebuffers\0" "glGenFramebuffersEXT\0" "\0" - /* _mesa_function_pool[20429]: GetProgramParameterdvNV (will be remapped) */ + /* _mesa_function_pool[20472]: GetProgramParameterdvNV (will be remapped) */ "iiip\0" "glGetProgramParameterdvNV\0" "\0" - /* _mesa_function_pool[20461]: Vertex2sv (offset 133) */ + /* _mesa_function_pool[20504]: Vertex2sv (offset 133) */ "p\0" "glVertex2sv\0" "\0" - /* _mesa_function_pool[20476]: GetIntegerv (offset 263) */ + /* _mesa_function_pool[20519]: GetIntegerv (offset 263) */ "ip\0" "glGetIntegerv\0" "\0" - /* _mesa_function_pool[20494]: IsVertexArrayAPPLE (will be remapped) */ + /* _mesa_function_pool[20537]: IsVertexArrayAPPLE (will be remapped) */ "i\0" "glIsVertexArray\0" "glIsVertexArrayAPPLE\0" "\0" - /* _mesa_function_pool[20534]: FragmentLightfvSGIX (dynamic) */ + /* _mesa_function_pool[20577]: FragmentLightfvSGIX (dynamic) */ "iip\0" "glFragmentLightfvSGIX\0" "\0" - /* _mesa_function_pool[20561]: DetachShader (will be remapped) */ + /* _mesa_function_pool[20604]: DetachShader (will be remapped) */ "ii\0" "glDetachShader\0" "\0" - /* _mesa_function_pool[20580]: VertexAttrib4NubARB (will be remapped) */ + /* _mesa_function_pool[20623]: VertexAttrib4NubARB (will be remapped) */ "iiiii\0" "glVertexAttrib4Nub\0" "glVertexAttrib4NubARB\0" "\0" - /* _mesa_function_pool[20628]: GetProgramEnvParameterfvARB (will be remapped) */ + /* _mesa_function_pool[20671]: GetProgramEnvParameterfvARB (will be remapped) */ "iip\0" "glGetProgramEnvParameterfvARB\0" "\0" - /* _mesa_function_pool[20663]: GetTrackMatrixivNV (will be remapped) */ + /* _mesa_function_pool[20706]: GetTrackMatrixivNV (will be remapped) */ "iiip\0" "glGetTrackMatrixivNV\0" "\0" - /* _mesa_function_pool[20690]: VertexAttrib3svNV (will be remapped) */ + /* _mesa_function_pool[20733]: VertexAttrib3svNV (will be remapped) */ "ip\0" "glVertexAttrib3svNV\0" "\0" - /* _mesa_function_pool[20714]: Uniform4fvARB (will be remapped) */ + /* _mesa_function_pool[20757]: Uniform4fvARB (will be remapped) */ "iip\0" "glUniform4fv\0" "glUniform4fvARB\0" "\0" - /* _mesa_function_pool[20748]: MultTransposeMatrixfARB (will be remapped) */ + /* _mesa_function_pool[20791]: MultTransposeMatrixfARB (will be remapped) */ "p\0" "glMultTransposeMatrixf\0" "glMultTransposeMatrixfARB\0" "\0" - /* _mesa_function_pool[20800]: GetTexEnviv (offset 277) */ + /* _mesa_function_pool[20843]: GetTexEnviv (offset 277) */ "iip\0" "glGetTexEnviv\0" "\0" - /* _mesa_function_pool[20819]: ColorFragmentOp1ATI (will be remapped) */ + /* _mesa_function_pool[20862]: ColorFragmentOp1ATI (will be remapped) */ "iiiiiii\0" "glColorFragmentOp1ATI\0" "\0" - /* _mesa_function_pool[20850]: GetUniformfvARB (will be remapped) */ + /* _mesa_function_pool[20893]: GetUniformfvARB (will be remapped) */ "iip\0" "glGetUniformfv\0" "glGetUniformfvARB\0" "\0" - /* _mesa_function_pool[20888]: PopClientAttrib (offset 334) */ + /* _mesa_function_pool[20931]: PopClientAttrib (offset 334) */ "\0" "glPopClientAttrib\0" "\0" - /* _mesa_function_pool[20908]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[20951]: ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (dynamic) */ "iffffffffffff\0" "glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[20979]: DetachObjectARB (will be remapped) */ + /* _mesa_function_pool[21022]: DetachObjectARB (will be remapped) */ "ii\0" "glDetachObjectARB\0" "\0" - /* _mesa_function_pool[21001]: VertexBlendARB (dynamic) */ + /* _mesa_function_pool[21044]: VertexBlendARB (dynamic) */ "i\0" "glVertexBlendARB\0" "\0" - /* _mesa_function_pool[21021]: WindowPos3iMESA (will be remapped) */ + /* _mesa_function_pool[21064]: WindowPos3iMESA (will be remapped) */ "iii\0" "glWindowPos3i\0" "glWindowPos3iARB\0" "glWindowPos3iMESA\0" "\0" - /* _mesa_function_pool[21075]: SeparableFilter2D (offset 360) */ + /* _mesa_function_pool[21118]: SeparableFilter2D (offset 360) */ "iiiiiipp\0" "glSeparableFilter2D\0" "glSeparableFilter2DEXT\0" "\0" - /* _mesa_function_pool[21128]: ReplacementCodeuiColor4ubVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[21171]: ReplacementCodeuiColor4ubVertex3fvSUN (dynamic) */ "ppp\0" "glReplacementCodeuiColor4ubVertex3fvSUN\0" "\0" - /* _mesa_function_pool[21173]: Map1d (offset 220) */ + /* _mesa_function_pool[21216]: Map1d (offset 220) */ "iddiip\0" "glMap1d\0" "\0" - /* _mesa_function_pool[21189]: Map1f (offset 221) */ + /* _mesa_function_pool[21232]: Map1f (offset 221) */ "iffiip\0" "glMap1f\0" "\0" - /* _mesa_function_pool[21205]: CompressedTexImage2DARB (will be remapped) */ + /* _mesa_function_pool[21248]: CompressedTexImage2DARB (will be remapped) */ "iiiiiiip\0" "glCompressedTexImage2D\0" "glCompressedTexImage2DARB\0" "\0" - /* _mesa_function_pool[21264]: ArrayElement (offset 306) */ + /* _mesa_function_pool[21307]: ArrayElement (offset 306) */ "i\0" "glArrayElement\0" "glArrayElementEXT\0" "\0" - /* _mesa_function_pool[21300]: TexImage2D (offset 183) */ + /* _mesa_function_pool[21343]: TexImage2D (offset 183) */ "iiiiiiiip\0" "glTexImage2D\0" "\0" - /* _mesa_function_pool[21324]: DepthBoundsEXT (will be remapped) */ + /* _mesa_function_pool[21367]: DepthBoundsEXT (will be remapped) */ "dd\0" "glDepthBoundsEXT\0" "\0" - /* _mesa_function_pool[21345]: ProgramParameters4fvNV (will be remapped) */ + /* _mesa_function_pool[21388]: ProgramParameters4fvNV (will be remapped) */ "iiip\0" "glProgramParameters4fvNV\0" "\0" - /* _mesa_function_pool[21376]: DeformationMap3fSGIX (dynamic) */ + /* _mesa_function_pool[21419]: DeformationMap3fSGIX (dynamic) */ "iffiiffiiffiip\0" "glDeformationMap3fSGIX\0" "\0" - /* _mesa_function_pool[21415]: GetProgramivNV (will be remapped) */ + /* _mesa_function_pool[21458]: GetProgramivNV (will be remapped) */ "iip\0" "glGetProgramivNV\0" "\0" - /* _mesa_function_pool[21437]: GetMinmaxParameteriv (offset 366) */ + /* _mesa_function_pool[21480]: GetMinmaxParameteriv (offset 366) */ "iip\0" "glGetMinmaxParameteriv\0" "glGetMinmaxParameterivEXT\0" "\0" - /* _mesa_function_pool[21491]: PixelTransferf (offset 247) */ + /* _mesa_function_pool[21534]: PixelTransferf (offset 247) */ "if\0" "glPixelTransferf\0" "\0" - /* _mesa_function_pool[21512]: CopyTexImage1D (offset 323) */ + /* _mesa_function_pool[21555]: CopyTexImage1D (offset 323) */ "iiiiiii\0" "glCopyTexImage1D\0" "glCopyTexImage1DEXT\0" "\0" - /* _mesa_function_pool[21558]: PushMatrix (offset 298) */ + /* _mesa_function_pool[21601]: PushMatrix (offset 298) */ "\0" "glPushMatrix\0" "\0" - /* _mesa_function_pool[21573]: Fogiv (offset 156) */ + /* _mesa_function_pool[21616]: Fogiv (offset 156) */ "ip\0" "glFogiv\0" "\0" - /* _mesa_function_pool[21585]: TexCoord1dv (offset 95) */ + /* _mesa_function_pool[21628]: TexCoord1dv (offset 95) */ "p\0" "glTexCoord1dv\0" "\0" - /* _mesa_function_pool[21602]: AlphaFragmentOp3ATI (will be remapped) */ + /* _mesa_function_pool[21645]: AlphaFragmentOp3ATI (will be remapped) */ "iiiiiiiiiiii\0" "glAlphaFragmentOp3ATI\0" "\0" - /* _mesa_function_pool[21638]: PixelTransferi (offset 248) */ + /* _mesa_function_pool[21681]: PixelTransferi (offset 248) */ "ii\0" "glPixelTransferi\0" "\0" - /* _mesa_function_pool[21659]: GetVertexAttribdvNV (will be remapped) */ + /* _mesa_function_pool[21702]: GetVertexAttribdvNV (will be remapped) */ "iip\0" "glGetVertexAttribdvNV\0" "\0" - /* _mesa_function_pool[21686]: VertexAttrib3fvNV (will be remapped) */ + /* _mesa_function_pool[21729]: VertexAttrib3fvNV (will be remapped) */ "ip\0" "glVertexAttrib3fvNV\0" "\0" - /* _mesa_function_pool[21710]: Rotatef (offset 300) */ + /* _mesa_function_pool[21753]: Rotatef (offset 300) */ "ffff\0" "glRotatef\0" "\0" - /* _mesa_function_pool[21726]: GetFinalCombinerInputParameterivNV (will be remapped) */ + /* _mesa_function_pool[21769]: GetFinalCombinerInputParameterivNV (will be remapped) */ "iip\0" "glGetFinalCombinerInputParameterivNV\0" "\0" - /* _mesa_function_pool[21768]: Vertex3i (offset 138) */ + /* _mesa_function_pool[21811]: Vertex3i (offset 138) */ "iii\0" "glVertex3i\0" "\0" - /* _mesa_function_pool[21784]: Vertex3f (offset 136) */ + /* _mesa_function_pool[21827]: Vertex3f (offset 136) */ "fff\0" "glVertex3f\0" "\0" - /* _mesa_function_pool[21800]: Clear (offset 203) */ + /* _mesa_function_pool[21843]: Clear (offset 203) */ "i\0" "glClear\0" "\0" - /* _mesa_function_pool[21811]: Vertex3d (offset 134) */ + /* _mesa_function_pool[21854]: Vertex3d (offset 134) */ "ddd\0" "glVertex3d\0" "\0" - /* _mesa_function_pool[21827]: GetMapParameterivNV (dynamic) */ + /* _mesa_function_pool[21870]: GetMapParameterivNV (dynamic) */ "iip\0" "glGetMapParameterivNV\0" "\0" - /* _mesa_function_pool[21854]: Uniform4iARB (will be remapped) */ + /* _mesa_function_pool[21897]: Uniform4iARB (will be remapped) */ "iiiii\0" "glUniform4i\0" "glUniform4iARB\0" "\0" - /* _mesa_function_pool[21888]: ReadBuffer (offset 254) */ + /* _mesa_function_pool[21931]: ReadBuffer (offset 254) */ "i\0" "glReadBuffer\0" "\0" - /* _mesa_function_pool[21904]: ConvolutionParameteri (offset 352) */ + /* _mesa_function_pool[21947]: ConvolutionParameteri (offset 352) */ "iii\0" "glConvolutionParameteri\0" "glConvolutionParameteriEXT\0" "\0" - /* _mesa_function_pool[21960]: Ortho (offset 296) */ + /* _mesa_function_pool[22003]: Ortho (offset 296) */ "dddddd\0" "glOrtho\0" "\0" - /* _mesa_function_pool[21976]: Binormal3sEXT (dynamic) */ + /* _mesa_function_pool[22019]: Binormal3sEXT (dynamic) */ "iii\0" "glBinormal3sEXT\0" "\0" - /* _mesa_function_pool[21997]: ListBase (offset 6) */ + /* _mesa_function_pool[22040]: ListBase (offset 6) */ "i\0" "glListBase\0" "\0" - /* _mesa_function_pool[22011]: Vertex3s (offset 140) */ + /* _mesa_function_pool[22054]: Vertex3s (offset 140) */ "iii\0" "glVertex3s\0" "\0" - /* _mesa_function_pool[22027]: ConvolutionParameterf (offset 350) */ + /* _mesa_function_pool[22070]: ConvolutionParameterf (offset 350) */ "iif\0" "glConvolutionParameterf\0" "glConvolutionParameterfEXT\0" "\0" - /* _mesa_function_pool[22083]: GetColorTableParameteriv (offset 345) */ + /* _mesa_function_pool[22126]: GetColorTableParameteriv (offset 345) */ "iip\0" "glGetColorTableParameteriv\0" "glGetColorTableParameterivSGI\0" "glGetColorTableParameterivEXT\0" "\0" - /* _mesa_function_pool[22175]: ProgramEnvParameter4dvARB (will be remapped) */ + /* _mesa_function_pool[22218]: ProgramEnvParameter4dvARB (will be remapped) */ "iip\0" "glProgramEnvParameter4dvARB\0" "glProgramParameter4dvNV\0" "\0" - /* _mesa_function_pool[22232]: ShadeModel (offset 177) */ + /* _mesa_function_pool[22275]: ShadeModel (offset 177) */ "i\0" "glShadeModel\0" "\0" - /* _mesa_function_pool[22248]: VertexAttribs2fvNV (will be remapped) */ + /* _mesa_function_pool[22291]: VertexAttribs2fvNV (will be remapped) */ "iip\0" "glVertexAttribs2fvNV\0" "\0" - /* _mesa_function_pool[22274]: Rectiv (offset 91) */ + /* _mesa_function_pool[22317]: Rectiv (offset 91) */ "pp\0" "glRectiv\0" "\0" - /* _mesa_function_pool[22287]: UseProgramObjectARB (will be remapped) */ + /* _mesa_function_pool[22330]: UseProgramObjectARB (will be remapped) */ "i\0" "glUseProgram\0" "glUseProgramObjectARB\0" "\0" - /* _mesa_function_pool[22325]: GetMapParameterfvNV (dynamic) */ + /* _mesa_function_pool[22368]: GetMapParameterfvNV (dynamic) */ "iip\0" "glGetMapParameterfvNV\0" "\0" - /* _mesa_function_pool[22352]: PassTexCoordATI (will be remapped) */ + /* _mesa_function_pool[22395]: PassTexCoordATI (will be remapped) */ "iii\0" "glPassTexCoordATI\0" "\0" - /* _mesa_function_pool[22375]: DeleteProgram (will be remapped) */ + /* _mesa_function_pool[22418]: DeleteProgram (will be remapped) */ "i\0" "glDeleteProgram\0" "\0" - /* _mesa_function_pool[22394]: Tangent3ivEXT (dynamic) */ + /* _mesa_function_pool[22437]: Tangent3ivEXT (dynamic) */ "p\0" "glTangent3ivEXT\0" "\0" - /* _mesa_function_pool[22413]: Tangent3dEXT (dynamic) */ + /* _mesa_function_pool[22456]: Tangent3dEXT (dynamic) */ "ddd\0" "glTangent3dEXT\0" "\0" - /* _mesa_function_pool[22433]: SecondaryColor3dvEXT (will be remapped) */ + /* _mesa_function_pool[22476]: SecondaryColor3dvEXT (will be remapped) */ "p\0" "glSecondaryColor3dv\0" "glSecondaryColor3dvEXT\0" "\0" - /* _mesa_function_pool[22479]: Vertex2fv (offset 129) */ + /* _mesa_function_pool[22522]: Vertex2fv (offset 129) */ "p\0" "glVertex2fv\0" "\0" - /* _mesa_function_pool[22494]: MultiDrawArraysEXT (will be remapped) */ + /* _mesa_function_pool[22537]: MultiDrawArraysEXT (will be remapped) */ "ippi\0" "glMultiDrawArrays\0" "glMultiDrawArraysEXT\0" "\0" - /* _mesa_function_pool[22539]: BindRenderbufferEXT (will be remapped) */ + /* _mesa_function_pool[22582]: BindRenderbufferEXT (will be remapped) */ "ii\0" "glBindRenderbuffer\0" "glBindRenderbufferEXT\0" "\0" - /* _mesa_function_pool[22584]: MultiTexCoord4dARB (offset 400) */ + /* _mesa_function_pool[22627]: MultiTexCoord4dARB (offset 400) */ "idddd\0" "glMultiTexCoord4d\0" "glMultiTexCoord4dARB\0" "\0" - /* _mesa_function_pool[22630]: Vertex3sv (offset 141) */ + /* _mesa_function_pool[22673]: Vertex3sv (offset 141) */ "p\0" "glVertex3sv\0" "\0" - /* _mesa_function_pool[22645]: SecondaryColor3usEXT (will be remapped) */ + /* _mesa_function_pool[22688]: SecondaryColor3usEXT (will be remapped) */ "iii\0" "glSecondaryColor3us\0" "glSecondaryColor3usEXT\0" "\0" - /* _mesa_function_pool[22693]: ProgramLocalParameter4fvARB (will be remapped) */ + /* _mesa_function_pool[22736]: ProgramLocalParameter4fvARB (will be remapped) */ "iip\0" "glProgramLocalParameter4fvARB\0" "\0" - /* _mesa_function_pool[22728]: DeleteProgramsNV (will be remapped) */ + /* _mesa_function_pool[22771]: DeleteProgramsNV (will be remapped) */ "ip\0" "glDeleteProgramsARB\0" "glDeleteProgramsNV\0" "\0" - /* _mesa_function_pool[22771]: EvalMesh1 (offset 236) */ + /* _mesa_function_pool[22814]: EvalMesh1 (offset 236) */ "iii\0" "glEvalMesh1\0" "\0" - /* _mesa_function_pool[22788]: MultiTexCoord1sARB (offset 382) */ + /* _mesa_function_pool[22831]: MultiTexCoord1sARB (offset 382) */ "ii\0" "glMultiTexCoord1s\0" "glMultiTexCoord1sARB\0" "\0" - /* _mesa_function_pool[22831]: ReplacementCodeuiColor3fVertex3fSUN (dynamic) */ + /* _mesa_function_pool[22874]: ReplacementCodeuiColor3fVertex3fSUN (dynamic) */ "iffffff\0" "glReplacementCodeuiColor3fVertex3fSUN\0" "\0" - /* _mesa_function_pool[22878]: GetVertexAttribPointervNV (will be remapped) */ + /* _mesa_function_pool[22921]: GetVertexAttribPointervNV (will be remapped) */ "iip\0" "glGetVertexAttribPointerv\0" "glGetVertexAttribPointervARB\0" "glGetVertexAttribPointervNV\0" "\0" - /* _mesa_function_pool[22966]: MultiTexCoord1dvARB (offset 377) */ + /* _mesa_function_pool[23009]: MultiTexCoord1dvARB (offset 377) */ "ip\0" "glMultiTexCoord1dv\0" "glMultiTexCoord1dvARB\0" "\0" - /* _mesa_function_pool[23011]: Uniform2iARB (will be remapped) */ + /* _mesa_function_pool[23054]: Uniform2iARB (will be remapped) */ "iii\0" "glUniform2i\0" "glUniform2iARB\0" "\0" - /* _mesa_function_pool[23043]: Vertex2iv (offset 131) */ + /* _mesa_function_pool[23086]: Vertex2iv (offset 131) */ "p\0" "glVertex2iv\0" "\0" - /* _mesa_function_pool[23058]: GetProgramStringNV (will be remapped) */ + /* _mesa_function_pool[23101]: GetProgramStringNV (will be remapped) */ "iip\0" "glGetProgramStringNV\0" "\0" - /* _mesa_function_pool[23084]: ColorPointerEXT (will be remapped) */ + /* _mesa_function_pool[23127]: ColorPointerEXT (will be remapped) */ "iiiip\0" "glColorPointerEXT\0" "\0" - /* _mesa_function_pool[23109]: LineWidth (offset 168) */ + /* _mesa_function_pool[23152]: LineWidth (offset 168) */ "f\0" "glLineWidth\0" "\0" - /* _mesa_function_pool[23124]: MapBufferARB (will be remapped) */ + /* _mesa_function_pool[23167]: MapBufferARB (will be remapped) */ "ii\0" "glMapBuffer\0" "glMapBufferARB\0" "\0" - /* _mesa_function_pool[23155]: MultiDrawElementsBaseVertex (will be remapped) */ + /* _mesa_function_pool[23198]: MultiDrawElementsBaseVertex (will be remapped) */ "ipipip\0" "glMultiDrawElementsBaseVertex\0" "\0" - /* _mesa_function_pool[23193]: Binormal3svEXT (dynamic) */ + /* _mesa_function_pool[23236]: Binormal3svEXT (dynamic) */ "p\0" "glBinormal3svEXT\0" "\0" - /* _mesa_function_pool[23213]: ApplyTextureEXT (dynamic) */ + /* _mesa_function_pool[23256]: ApplyTextureEXT (dynamic) */ "i\0" "glApplyTextureEXT\0" "\0" - /* _mesa_function_pool[23234]: TexGendv (offset 189) */ + /* _mesa_function_pool[23277]: TexGendv (offset 189) */ "iip\0" "glTexGendv\0" "\0" - /* _mesa_function_pool[23250]: TextureMaterialEXT (dynamic) */ + /* _mesa_function_pool[23293]: TextureMaterialEXT (dynamic) */ "ii\0" "glTextureMaterialEXT\0" "\0" - /* _mesa_function_pool[23275]: TextureLightEXT (dynamic) */ + /* _mesa_function_pool[23318]: TextureLightEXT (dynamic) */ "i\0" "glTextureLightEXT\0" "\0" - /* _mesa_function_pool[23296]: ResetMinmax (offset 370) */ + /* _mesa_function_pool[23339]: ResetMinmax (offset 370) */ "i\0" "glResetMinmax\0" "glResetMinmaxEXT\0" "\0" - /* _mesa_function_pool[23330]: SpriteParameterfSGIX (dynamic) */ + /* _mesa_function_pool[23373]: SpriteParameterfSGIX (dynamic) */ "if\0" "glSpriteParameterfSGIX\0" "\0" - /* _mesa_function_pool[23357]: EnableClientState (offset 313) */ + /* _mesa_function_pool[23400]: EnableClientState (offset 313) */ "i\0" "glEnableClientState\0" "\0" - /* _mesa_function_pool[23380]: VertexAttrib4sNV (will be remapped) */ + /* _mesa_function_pool[23423]: VertexAttrib4sNV (will be remapped) */ "iiiii\0" "glVertexAttrib4sNV\0" "\0" - /* _mesa_function_pool[23406]: GetConvolutionParameterfv (offset 357) */ + /* _mesa_function_pool[23449]: GetConvolutionParameterfv (offset 357) */ "iip\0" "glGetConvolutionParameterfv\0" "glGetConvolutionParameterfvEXT\0" "\0" - /* _mesa_function_pool[23470]: VertexAttribs4dvNV (will be remapped) */ + /* _mesa_function_pool[23513]: VertexAttribs4dvNV (will be remapped) */ "iip\0" "glVertexAttribs4dvNV\0" "\0" - /* _mesa_function_pool[23496]: VertexAttrib4dARB (will be remapped) */ + /* _mesa_function_pool[23539]: MultiModeDrawArraysIBM (will be remapped) */ + "pppii\0" + "glMultiModeDrawArraysIBM\0" + "\0" + /* _mesa_function_pool[23571]: VertexAttrib4dARB (will be remapped) */ "idddd\0" "glVertexAttrib4d\0" "glVertexAttrib4dARB\0" "\0" - /* _mesa_function_pool[23540]: GetTexBumpParameterfvATI (will be remapped) */ + /* _mesa_function_pool[23615]: GetTexBumpParameterfvATI (will be remapped) */ "ip\0" "glGetTexBumpParameterfvATI\0" "\0" - /* _mesa_function_pool[23571]: ProgramNamedParameter4dNV (will be remapped) */ + /* _mesa_function_pool[23646]: ProgramNamedParameter4dNV (will be remapped) */ "iipdddd\0" "glProgramNamedParameter4dNV\0" "\0" - /* _mesa_function_pool[23608]: GetMaterialfv (offset 269) */ + /* _mesa_function_pool[23683]: GetMaterialfv (offset 269) */ "iip\0" "glGetMaterialfv\0" "\0" - /* _mesa_function_pool[23629]: VertexWeightfEXT (dynamic) */ + /* _mesa_function_pool[23704]: VertexWeightfEXT (dynamic) */ "f\0" "glVertexWeightfEXT\0" "\0" - /* _mesa_function_pool[23651]: Binormal3fEXT (dynamic) */ + /* _mesa_function_pool[23726]: Binormal3fEXT (dynamic) */ "fff\0" "glBinormal3fEXT\0" "\0" - /* _mesa_function_pool[23672]: CallList (offset 2) */ + /* _mesa_function_pool[23747]: CallList (offset 2) */ "i\0" "glCallList\0" "\0" - /* _mesa_function_pool[23686]: Materialfv (offset 170) */ + /* _mesa_function_pool[23761]: Materialfv (offset 170) */ "iip\0" "glMaterialfv\0" "\0" - /* _mesa_function_pool[23704]: TexCoord3fv (offset 113) */ + /* _mesa_function_pool[23779]: TexCoord3fv (offset 113) */ "p\0" "glTexCoord3fv\0" "\0" - /* _mesa_function_pool[23721]: FogCoordfvEXT (will be remapped) */ + /* _mesa_function_pool[23796]: FogCoordfvEXT (will be remapped) */ "p\0" "glFogCoordfv\0" "glFogCoordfvEXT\0" "\0" - /* _mesa_function_pool[23753]: MultiTexCoord1ivARB (offset 381) */ + /* _mesa_function_pool[23828]: MultiTexCoord1ivARB (offset 381) */ "ip\0" "glMultiTexCoord1iv\0" "glMultiTexCoord1ivARB\0" "\0" - /* _mesa_function_pool[23798]: SecondaryColor3ubEXT (will be remapped) */ + /* _mesa_function_pool[23873]: SecondaryColor3ubEXT (will be remapped) */ "iii\0" "glSecondaryColor3ub\0" "glSecondaryColor3ubEXT\0" "\0" - /* _mesa_function_pool[23846]: MultiTexCoord2ivARB (offset 389) */ + /* _mesa_function_pool[23921]: MultiTexCoord2ivARB (offset 389) */ "ip\0" "glMultiTexCoord2iv\0" "glMultiTexCoord2ivARB\0" "\0" - /* _mesa_function_pool[23891]: FogFuncSGIS (dynamic) */ + /* _mesa_function_pool[23966]: FogFuncSGIS (dynamic) */ "ip\0" "glFogFuncSGIS\0" "\0" - /* _mesa_function_pool[23909]: CopyTexSubImage2D (offset 326) */ + /* _mesa_function_pool[23984]: CopyTexSubImage2D (offset 326) */ "iiiiiiii\0" "glCopyTexSubImage2D\0" "glCopyTexSubImage2DEXT\0" "\0" - /* _mesa_function_pool[23962]: GetObjectParameterivARB (will be remapped) */ + /* _mesa_function_pool[24037]: GetObjectParameterivARB (will be remapped) */ "iip\0" "glGetObjectParameterivARB\0" "\0" - /* _mesa_function_pool[23993]: Color3iv (offset 16) */ + /* _mesa_function_pool[24068]: Color3iv (offset 16) */ "p\0" "glColor3iv\0" "\0" - /* _mesa_function_pool[24007]: TexCoord4fVertex4fSUN (dynamic) */ + /* _mesa_function_pool[24082]: TexCoord4fVertex4fSUN (dynamic) */ "ffffffff\0" "glTexCoord4fVertex4fSUN\0" "\0" - /* _mesa_function_pool[24041]: DrawElements (offset 311) */ + /* _mesa_function_pool[24116]: DrawElements (offset 311) */ "iiip\0" "glDrawElements\0" "\0" - /* _mesa_function_pool[24062]: BindVertexArrayAPPLE (will be remapped) */ + /* _mesa_function_pool[24137]: BindVertexArrayAPPLE (will be remapped) */ "i\0" "glBindVertexArrayAPPLE\0" "\0" - /* _mesa_function_pool[24088]: GetProgramLocalParameterdvARB (will be remapped) */ + /* _mesa_function_pool[24163]: GetProgramLocalParameterdvARB (will be remapped) */ "iip\0" "glGetProgramLocalParameterdvARB\0" "\0" - /* _mesa_function_pool[24125]: GetHistogramParameteriv (offset 363) */ + /* _mesa_function_pool[24200]: GetHistogramParameteriv (offset 363) */ "iip\0" "glGetHistogramParameteriv\0" "glGetHistogramParameterivEXT\0" "\0" - /* _mesa_function_pool[24185]: MultiTexCoord1iARB (offset 380) */ + /* _mesa_function_pool[24260]: MultiTexCoord1iARB (offset 380) */ "ii\0" "glMultiTexCoord1i\0" "glMultiTexCoord1iARB\0" "\0" - /* _mesa_function_pool[24228]: GetConvolutionFilter (offset 356) */ + /* _mesa_function_pool[24303]: GetConvolutionFilter (offset 356) */ "iiip\0" "glGetConvolutionFilter\0" "glGetConvolutionFilterEXT\0" "\0" - /* _mesa_function_pool[24283]: GetProgramivARB (will be remapped) */ + /* _mesa_function_pool[24358]: GetProgramivARB (will be remapped) */ "iip\0" "glGetProgramivARB\0" "\0" - /* _mesa_function_pool[24306]: BlendFuncSeparateEXT (will be remapped) */ + /* _mesa_function_pool[24381]: BlendFuncSeparateEXT (will be remapped) */ "iiii\0" "glBlendFuncSeparate\0" "glBlendFuncSeparateEXT\0" "glBlendFuncSeparateINGR\0" "\0" - /* _mesa_function_pool[24379]: MapBufferRange (will be remapped) */ + /* _mesa_function_pool[24454]: MapBufferRange (will be remapped) */ "iiii\0" "glMapBufferRange\0" "\0" - /* _mesa_function_pool[24402]: ProgramParameters4dvNV (will be remapped) */ + /* _mesa_function_pool[24477]: ProgramParameters4dvNV (will be remapped) */ "iiip\0" "glProgramParameters4dvNV\0" "\0" - /* _mesa_function_pool[24433]: TexCoord2fColor3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[24508]: TexCoord2fColor3fVertex3fvSUN (dynamic) */ "ppp\0" "glTexCoord2fColor3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[24470]: EvalPoint2 (offset 239) */ + /* _mesa_function_pool[24545]: EvalPoint2 (offset 239) */ "ii\0" "glEvalPoint2\0" "\0" - /* _mesa_function_pool[24487]: EvalPoint1 (offset 237) */ + /* _mesa_function_pool[24562]: EvalPoint1 (offset 237) */ "i\0" "glEvalPoint1\0" "\0" - /* _mesa_function_pool[24503]: Binormal3dvEXT (dynamic) */ + /* _mesa_function_pool[24578]: Binormal3dvEXT (dynamic) */ "p\0" "glBinormal3dvEXT\0" "\0" - /* _mesa_function_pool[24523]: PopMatrix (offset 297) */ + /* _mesa_function_pool[24598]: PopMatrix (offset 297) */ "\0" "glPopMatrix\0" "\0" - /* _mesa_function_pool[24537]: FinishFenceNV (will be remapped) */ + /* _mesa_function_pool[24612]: FinishFenceNV (will be remapped) */ "i\0" "glFinishFenceNV\0" "\0" - /* _mesa_function_pool[24556]: GetFogFuncSGIS (dynamic) */ + /* _mesa_function_pool[24631]: GetFogFuncSGIS (dynamic) */ "p\0" "glGetFogFuncSGIS\0" "\0" - /* _mesa_function_pool[24576]: GetUniformLocationARB (will be remapped) */ + /* _mesa_function_pool[24651]: GetUniformLocationARB (will be remapped) */ "ip\0" "glGetUniformLocation\0" "glGetUniformLocationARB\0" "\0" - /* _mesa_function_pool[24625]: SecondaryColor3fEXT (will be remapped) */ + /* _mesa_function_pool[24700]: SecondaryColor3fEXT (will be remapped) */ "fff\0" "glSecondaryColor3f\0" "glSecondaryColor3fEXT\0" "\0" - /* _mesa_function_pool[24671]: GetTexGeniv (offset 280) */ + /* _mesa_function_pool[24746]: GetTexGeniv (offset 280) */ "iip\0" "glGetTexGeniv\0" "\0" - /* _mesa_function_pool[24690]: CombinerInputNV (will be remapped) */ + /* _mesa_function_pool[24765]: CombinerInputNV (will be remapped) */ "iiiiii\0" "glCombinerInputNV\0" "\0" - /* _mesa_function_pool[24716]: VertexAttrib3sARB (will be remapped) */ + /* _mesa_function_pool[24791]: VertexAttrib3sARB (will be remapped) */ "iiii\0" "glVertexAttrib3s\0" "glVertexAttrib3sARB\0" "\0" - /* _mesa_function_pool[24759]: ReplacementCodeuiNormal3fVertex3fvSUN (dynamic) */ + /* _mesa_function_pool[24834]: ReplacementCodeuiNormal3fVertex3fvSUN (dynamic) */ "ppp\0" "glReplacementCodeuiNormal3fVertex3fvSUN\0" "\0" - /* _mesa_function_pool[24804]: Map2d (offset 222) */ + /* _mesa_function_pool[24879]: Map2d (offset 222) */ "iddiiddiip\0" "glMap2d\0" "\0" - /* _mesa_function_pool[24824]: Map2f (offset 223) */ + /* _mesa_function_pool[24899]: Map2f (offset 223) */ "iffiiffiip\0" "glMap2f\0" "\0" - /* _mesa_function_pool[24844]: ProgramStringARB (will be remapped) */ + /* _mesa_function_pool[24919]: ProgramStringARB (will be remapped) */ "iiip\0" "glProgramStringARB\0" "\0" - /* _mesa_function_pool[24869]: Vertex4s (offset 148) */ + /* _mesa_function_pool[24944]: Vertex4s (offset 148) */ "iiii\0" "glVertex4s\0" "\0" - /* _mesa_function_pool[24886]: TexCoord4fVertex4fvSUN (dynamic) */ + /* _mesa_function_pool[24961]: TexCoord4fVertex4fvSUN (dynamic) */ "pp\0" "glTexCoord4fVertex4fvSUN\0" "\0" - /* _mesa_function_pool[24915]: VertexAttrib3sNV (will be remapped) */ + /* _mesa_function_pool[24990]: VertexAttrib3sNV (will be remapped) */ "iiii\0" "glVertexAttrib3sNV\0" "\0" - /* _mesa_function_pool[24940]: VertexAttrib1fNV (will be remapped) */ + /* _mesa_function_pool[25015]: VertexAttrib1fNV (will be remapped) */ "if\0" "glVertexAttrib1fNV\0" "\0" - /* _mesa_function_pool[24963]: Vertex4f (offset 144) */ + /* _mesa_function_pool[25038]: Vertex4f (offset 144) */ "ffff\0" "glVertex4f\0" "\0" - /* _mesa_function_pool[24980]: EvalCoord1d (offset 228) */ + /* _mesa_function_pool[25055]: EvalCoord1d (offset 228) */ "d\0" "glEvalCoord1d\0" "\0" - /* _mesa_function_pool[24997]: Vertex4d (offset 142) */ + /* _mesa_function_pool[25072]: Vertex4d (offset 142) */ "dddd\0" "glVertex4d\0" "\0" - /* _mesa_function_pool[25014]: RasterPos4dv (offset 79) */ + /* _mesa_function_pool[25089]: RasterPos4dv (offset 79) */ "p\0" "glRasterPos4dv\0" "\0" - /* _mesa_function_pool[25032]: FragmentLightfSGIX (dynamic) */ + /* _mesa_function_pool[25107]: FragmentLightfSGIX (dynamic) */ "iif\0" "glFragmentLightfSGIX\0" "\0" - /* _mesa_function_pool[25058]: GetCompressedTexImageARB (will be remapped) */ + /* _mesa_function_pool[25133]: GetCompressedTexImageARB (will be remapped) */ "iip\0" "glGetCompressedTexImage\0" "glGetCompressedTexImageARB\0" "\0" - /* _mesa_function_pool[25114]: GetTexGenfv (offset 279) */ + /* _mesa_function_pool[25189]: GetTexGenfv (offset 279) */ "iip\0" "glGetTexGenfv\0" "\0" - /* _mesa_function_pool[25133]: Vertex4i (offset 146) */ + /* _mesa_function_pool[25208]: Vertex4i (offset 146) */ "iiii\0" "glVertex4i\0" "\0" - /* _mesa_function_pool[25150]: VertexWeightPointerEXT (dynamic) */ + /* _mesa_function_pool[25225]: VertexWeightPointerEXT (dynamic) */ "iiip\0" "glVertexWeightPointerEXT\0" "\0" - /* _mesa_function_pool[25181]: GetHistogram (offset 361) */ + /* _mesa_function_pool[25256]: GetHistogram (offset 361) */ "iiiip\0" "glGetHistogram\0" "glGetHistogramEXT\0" "\0" - /* _mesa_function_pool[25221]: ActiveStencilFaceEXT (will be remapped) */ + /* _mesa_function_pool[25296]: ActiveStencilFaceEXT (will be remapped) */ "i\0" "glActiveStencilFaceEXT\0" "\0" - /* _mesa_function_pool[25247]: StencilFuncSeparateATI (will be remapped) */ + /* _mesa_function_pool[25322]: StencilFuncSeparateATI (will be remapped) */ "iiii\0" "glStencilFuncSeparateATI\0" "\0" - /* _mesa_function_pool[25278]: Materialf (offset 169) */ + /* _mesa_function_pool[25353]: Materialf (offset 169) */ "iif\0" "glMaterialf\0" "\0" - /* _mesa_function_pool[25295]: GetShaderSourceARB (will be remapped) */ + /* _mesa_function_pool[25370]: GetShaderSourceARB (will be remapped) */ "iipp\0" "glGetShaderSource\0" "glGetShaderSourceARB\0" "\0" - /* _mesa_function_pool[25340]: IglooInterfaceSGIX (dynamic) */ + /* _mesa_function_pool[25415]: IglooInterfaceSGIX (dynamic) */ "ip\0" "glIglooInterfaceSGIX\0" "\0" - /* _mesa_function_pool[25365]: Materiali (offset 171) */ + /* _mesa_function_pool[25440]: Materiali (offset 171) */ "iii\0" "glMateriali\0" "\0" - /* _mesa_function_pool[25382]: VertexAttrib4dNV (will be remapped) */ + /* _mesa_function_pool[25457]: VertexAttrib4dNV (will be remapped) */ "idddd\0" "glVertexAttrib4dNV\0" "\0" - /* _mesa_function_pool[25408]: MultiModeDrawElementsIBM (will be remapped) */ + /* _mesa_function_pool[25483]: MultiModeDrawElementsIBM (will be remapped) */ "ppipii\0" "glMultiModeDrawElementsIBM\0" "\0" - /* _mesa_function_pool[25443]: Indexsv (offset 51) */ + /* _mesa_function_pool[25518]: Indexsv (offset 51) */ "p\0" "glIndexsv\0" "\0" - /* _mesa_function_pool[25456]: MultiTexCoord4svARB (offset 407) */ + /* _mesa_function_pool[25531]: MultiTexCoord4svARB (offset 407) */ "ip\0" "glMultiTexCoord4sv\0" "glMultiTexCoord4svARB\0" "\0" - /* _mesa_function_pool[25501]: LightModelfv (offset 164) */ + /* _mesa_function_pool[25576]: LightModelfv (offset 164) */ "ip\0" "glLightModelfv\0" "\0" - /* _mesa_function_pool[25520]: TexCoord2dv (offset 103) */ + /* _mesa_function_pool[25595]: TexCoord2dv (offset 103) */ "p\0" "glTexCoord2dv\0" "\0" - /* _mesa_function_pool[25537]: GenQueriesARB (will be remapped) */ + /* _mesa_function_pool[25612]: GenQueriesARB (will be remapped) */ "ip\0" "glGenQueries\0" "glGenQueriesARB\0" "\0" - /* _mesa_function_pool[25570]: EvalCoord1dv (offset 229) */ + /* _mesa_function_pool[25645]: EvalCoord1dv (offset 229) */ "p\0" "glEvalCoord1dv\0" "\0" - /* _mesa_function_pool[25588]: ReplacementCodeuiVertex3fSUN (dynamic) */ + /* _mesa_function_pool[25663]: ReplacementCodeuiVertex3fSUN (dynamic) */ "ifff\0" "glReplacementCodeuiVertex3fSUN\0" "\0" - /* _mesa_function_pool[25625]: Translated (offset 303) */ + /* _mesa_function_pool[25700]: Translated (offset 303) */ "ddd\0" "glTranslated\0" "\0" - /* _mesa_function_pool[25643]: Translatef (offset 304) */ + /* _mesa_function_pool[25718]: Translatef (offset 304) */ "fff\0" "glTranslatef\0" "\0" - /* _mesa_function_pool[25661]: StencilMask (offset 209) */ + /* _mesa_function_pool[25736]: StencilMask (offset 209) */ "i\0" "glStencilMask\0" "\0" - /* _mesa_function_pool[25678]: Tangent3iEXT (dynamic) */ + /* _mesa_function_pool[25753]: Tangent3iEXT (dynamic) */ "iii\0" "glTangent3iEXT\0" "\0" - /* _mesa_function_pool[25698]: GetLightiv (offset 265) */ + /* _mesa_function_pool[25773]: GetLightiv (offset 265) */ "iip\0" "glGetLightiv\0" "\0" - /* _mesa_function_pool[25716]: DrawMeshArraysSUN (dynamic) */ + /* _mesa_function_pool[25791]: DrawMeshArraysSUN (dynamic) */ "iiii\0" "glDrawMeshArraysSUN\0" "\0" - /* _mesa_function_pool[25742]: IsList (offset 287) */ + /* _mesa_function_pool[25817]: IsList (offset 287) */ "i\0" "glIsList\0" "\0" - /* _mesa_function_pool[25754]: IsSync (will be remapped) */ + /* _mesa_function_pool[25829]: IsSync (will be remapped) */ "i\0" "glIsSync\0" "\0" - /* _mesa_function_pool[25766]: RenderMode (offset 196) */ + /* _mesa_function_pool[25841]: RenderMode (offset 196) */ "i\0" "glRenderMode\0" "\0" - /* _mesa_function_pool[25782]: GetMapControlPointsNV (dynamic) */ + /* _mesa_function_pool[25857]: GetMapControlPointsNV (dynamic) */ "iiiiiip\0" "glGetMapControlPointsNV\0" "\0" - /* _mesa_function_pool[25815]: DrawBuffersARB (will be remapped) */ + /* _mesa_function_pool[25890]: DrawBuffersARB (will be remapped) */ "ip\0" "glDrawBuffers\0" "glDrawBuffersARB\0" "glDrawBuffersATI\0" "\0" - /* _mesa_function_pool[25867]: ProgramLocalParameter4fARB (will be remapped) */ + /* _mesa_function_pool[25942]: ProgramLocalParameter4fARB (will be remapped) */ "iiffff\0" "glProgramLocalParameter4fARB\0" "\0" - /* _mesa_function_pool[25904]: SpriteParameterivSGIX (dynamic) */ + /* _mesa_function_pool[25979]: SpriteParameterivSGIX (dynamic) */ "ip\0" "glSpriteParameterivSGIX\0" "\0" - /* _mesa_function_pool[25932]: ProvokingVertexEXT (will be remapped) */ + /* _mesa_function_pool[26007]: ProvokingVertexEXT (will be remapped) */ "i\0" "glProvokingVertexEXT\0" "glProvokingVertex\0" "\0" - /* _mesa_function_pool[25974]: MultiTexCoord1fARB (offset 378) */ + /* _mesa_function_pool[26049]: MultiTexCoord1fARB (offset 378) */ "if\0" "glMultiTexCoord1f\0" "glMultiTexCoord1fARB\0" "\0" - /* _mesa_function_pool[26017]: LoadName (offset 198) */ + /* _mesa_function_pool[26092]: LoadName (offset 198) */ "i\0" "glLoadName\0" "\0" - /* _mesa_function_pool[26031]: VertexAttribs4ubvNV (will be remapped) */ + /* _mesa_function_pool[26106]: VertexAttribs4ubvNV (will be remapped) */ "iip\0" "glVertexAttribs4ubvNV\0" "\0" - /* _mesa_function_pool[26058]: WeightsvARB (dynamic) */ + /* _mesa_function_pool[26133]: WeightsvARB (dynamic) */ "ip\0" "glWeightsvARB\0" "\0" - /* _mesa_function_pool[26076]: Uniform1fvARB (will be remapped) */ + /* _mesa_function_pool[26151]: Uniform1fvARB (will be remapped) */ "iip\0" "glUniform1fv\0" "glUniform1fvARB\0" "\0" - /* _mesa_function_pool[26110]: CopyTexSubImage1D (offset 325) */ + /* _mesa_function_pool[26185]: CopyTexSubImage1D (offset 325) */ "iiiiii\0" "glCopyTexSubImage1D\0" "glCopyTexSubImage1DEXT\0" "\0" - /* _mesa_function_pool[26161]: CullFace (offset 152) */ + /* _mesa_function_pool[26236]: CullFace (offset 152) */ "i\0" "glCullFace\0" "\0" - /* _mesa_function_pool[26175]: BindTexture (offset 307) */ + /* _mesa_function_pool[26250]: BindTexture (offset 307) */ "ii\0" "glBindTexture\0" "glBindTextureEXT\0" "\0" - /* _mesa_function_pool[26210]: BeginFragmentShaderATI (will be remapped) */ + /* _mesa_function_pool[26285]: BeginFragmentShaderATI (will be remapped) */ "\0" "glBeginFragmentShaderATI\0" "\0" - /* _mesa_function_pool[26237]: MultiTexCoord4fARB (offset 402) */ + /* _mesa_function_pool[26312]: MultiTexCoord4fARB (offset 402) */ "iffff\0" "glMultiTexCoord4f\0" "glMultiTexCoord4fARB\0" "\0" - /* _mesa_function_pool[26283]: VertexAttribs3svNV (will be remapped) */ + /* _mesa_function_pool[26358]: VertexAttribs3svNV (will be remapped) */ "iip\0" "glVertexAttribs3svNV\0" "\0" - /* _mesa_function_pool[26309]: StencilFunc (offset 243) */ + /* _mesa_function_pool[26384]: StencilFunc (offset 243) */ "iii\0" "glStencilFunc\0" "\0" - /* _mesa_function_pool[26328]: CopyPixels (offset 255) */ + /* _mesa_function_pool[26403]: CopyPixels (offset 255) */ "iiiii\0" "glCopyPixels\0" "\0" - /* _mesa_function_pool[26348]: Rectsv (offset 93) */ + /* _mesa_function_pool[26423]: Rectsv (offset 93) */ "pp\0" "glRectsv\0" "\0" - /* _mesa_function_pool[26361]: ReplacementCodeuivSUN (dynamic) */ + /* _mesa_function_pool[26436]: ReplacementCodeuivSUN (dynamic) */ "p\0" "glReplacementCodeuivSUN\0" "\0" - /* _mesa_function_pool[26388]: EnableVertexAttribArrayARB (will be remapped) */ + /* _mesa_function_pool[26463]: EnableVertexAttribArrayARB (will be remapped) */ "i\0" "glEnableVertexAttribArray\0" "glEnableVertexAttribArrayARB\0" "\0" - /* _mesa_function_pool[26446]: NormalPointervINTEL (dynamic) */ + /* _mesa_function_pool[26521]: NormalPointervINTEL (dynamic) */ "ip\0" "glNormalPointervINTEL\0" "\0" - /* _mesa_function_pool[26472]: CopyConvolutionFilter2D (offset 355) */ + /* _mesa_function_pool[26547]: CopyConvolutionFilter2D (offset 355) */ "iiiiii\0" "glCopyConvolutionFilter2D\0" "glCopyConvolutionFilter2DEXT\0" "\0" - /* _mesa_function_pool[26535]: WindowPos3ivMESA (will be remapped) */ + /* _mesa_function_pool[26610]: WindowPos3ivMESA (will be remapped) */ "p\0" "glWindowPos3iv\0" "glWindowPos3ivARB\0" "glWindowPos3ivMESA\0" "\0" - /* _mesa_function_pool[26590]: CopyBufferSubData (will be remapped) */ + /* _mesa_function_pool[26665]: CopyBufferSubData (will be remapped) */ "iiiii\0" "glCopyBufferSubData\0" "\0" - /* _mesa_function_pool[26617]: NormalPointer (offset 318) */ + /* _mesa_function_pool[26692]: NormalPointer (offset 318) */ "iip\0" "glNormalPointer\0" "\0" - /* _mesa_function_pool[26638]: TexParameterfv (offset 179) */ + /* _mesa_function_pool[26713]: TexParameterfv (offset 179) */ "iip\0" "glTexParameterfv\0" "\0" - /* _mesa_function_pool[26660]: IsBufferARB (will be remapped) */ + /* _mesa_function_pool[26735]: IsBufferARB (will be remapped) */ "i\0" "glIsBuffer\0" "glIsBufferARB\0" "\0" - /* _mesa_function_pool[26688]: WindowPos4iMESA (will be remapped) */ + /* _mesa_function_pool[26763]: WindowPos4iMESA (will be remapped) */ "iiii\0" "glWindowPos4iMESA\0" "\0" - /* _mesa_function_pool[26712]: VertexAttrib4uivARB (will be remapped) */ + /* _mesa_function_pool[26787]: VertexAttrib4uivARB (will be remapped) */ "ip\0" "glVertexAttrib4uiv\0" "glVertexAttrib4uivARB\0" "\0" - /* _mesa_function_pool[26757]: Tangent3bvEXT (dynamic) */ + /* _mesa_function_pool[26832]: Tangent3bvEXT (dynamic) */ "p\0" "glTangent3bvEXT\0" "\0" - /* _mesa_function_pool[26776]: UniformMatrix3x4fv (will be remapped) */ + /* _mesa_function_pool[26851]: UniformMatrix3x4fv (will be remapped) */ "iiip\0" "glUniformMatrix3x4fv\0" "\0" - /* _mesa_function_pool[26803]: ClipPlane (offset 150) */ + /* _mesa_function_pool[26878]: ClipPlane (offset 150) */ "ip\0" "glClipPlane\0" "\0" - /* _mesa_function_pool[26819]: Recti (offset 90) */ + /* _mesa_function_pool[26894]: Recti (offset 90) */ "iiii\0" "glRecti\0" "\0" - /* _mesa_function_pool[26833]: DrawRangeElementsBaseVertex (will be remapped) */ + /* _mesa_function_pool[26908]: DrawRangeElementsBaseVertex (will be remapped) */ "iiiiipi\0" "glDrawRangeElementsBaseVertex\0" "\0" - /* _mesa_function_pool[26872]: TexCoordPointervINTEL (dynamic) */ + /* _mesa_function_pool[26947]: TexCoordPointervINTEL (dynamic) */ "iip\0" "glTexCoordPointervINTEL\0" "\0" - /* _mesa_function_pool[26901]: DeleteBuffersARB (will be remapped) */ + /* _mesa_function_pool[26976]: DeleteBuffersARB (will be remapped) */ "ip\0" "glDeleteBuffers\0" "glDeleteBuffersARB\0" "\0" - /* _mesa_function_pool[26940]: WindowPos4fvMESA (will be remapped) */ + /* _mesa_function_pool[27015]: WindowPos4fvMESA (will be remapped) */ "p\0" "glWindowPos4fvMESA\0" "\0" - /* _mesa_function_pool[26962]: GetPixelMapuiv (offset 272) */ + /* _mesa_function_pool[27037]: GetPixelMapuiv (offset 272) */ "ip\0" "glGetPixelMapuiv\0" "\0" - /* _mesa_function_pool[26983]: Rectf (offset 88) */ + /* _mesa_function_pool[27058]: Rectf (offset 88) */ "ffff\0" "glRectf\0" "\0" - /* _mesa_function_pool[26997]: VertexAttrib1sNV (will be remapped) */ + /* _mesa_function_pool[27072]: VertexAttrib1sNV (will be remapped) */ "ii\0" "glVertexAttrib1sNV\0" "\0" - /* _mesa_function_pool[27020]: Indexfv (offset 47) */ + /* _mesa_function_pool[27095]: Indexfv (offset 47) */ "p\0" "glIndexfv\0" "\0" - /* _mesa_function_pool[27033]: SecondaryColor3svEXT (will be remapped) */ + /* _mesa_function_pool[27108]: SecondaryColor3svEXT (will be remapped) */ "p\0" "glSecondaryColor3sv\0" "glSecondaryColor3svEXT\0" "\0" - /* _mesa_function_pool[27079]: LoadTransposeMatrixfARB (will be remapped) */ + /* _mesa_function_pool[27154]: LoadTransposeMatrixfARB (will be remapped) */ "p\0" "glLoadTransposeMatrixf\0" "glLoadTransposeMatrixfARB\0" "\0" - /* _mesa_function_pool[27131]: GetPointerv (offset 329) */ + /* _mesa_function_pool[27206]: GetPointerv (offset 329) */ "ip\0" "glGetPointerv\0" "glGetPointervEXT\0" "\0" - /* _mesa_function_pool[27166]: Tangent3bEXT (dynamic) */ + /* _mesa_function_pool[27241]: Tangent3bEXT (dynamic) */ "iii\0" "glTangent3bEXT\0" "\0" - /* _mesa_function_pool[27186]: CombinerParameterfNV (will be remapped) */ + /* _mesa_function_pool[27261]: CombinerParameterfNV (will be remapped) */ "if\0" "glCombinerParameterfNV\0" "\0" - /* _mesa_function_pool[27213]: IndexMask (offset 212) */ + /* _mesa_function_pool[27288]: IndexMask (offset 212) */ "i\0" "glIndexMask\0" "\0" - /* _mesa_function_pool[27228]: BindProgramNV (will be remapped) */ + /* _mesa_function_pool[27303]: BindProgramNV (will be remapped) */ "ii\0" "glBindProgramARB\0" "glBindProgramNV\0" "\0" - /* _mesa_function_pool[27265]: VertexAttrib4svARB (will be remapped) */ + /* _mesa_function_pool[27340]: VertexAttrib4svARB (will be remapped) */ "ip\0" "glVertexAttrib4sv\0" "glVertexAttrib4svARB\0" "\0" - /* _mesa_function_pool[27308]: GetFloatv (offset 262) */ + /* _mesa_function_pool[27383]: GetFloatv (offset 262) */ "ip\0" "glGetFloatv\0" "\0" - /* _mesa_function_pool[27324]: CreateDebugObjectMESA (dynamic) */ + /* _mesa_function_pool[27399]: CreateDebugObjectMESA (dynamic) */ "\0" "glCreateDebugObjectMESA\0" "\0" - /* _mesa_function_pool[27350]: GetShaderiv (will be remapped) */ + /* _mesa_function_pool[27425]: GetShaderiv (will be remapped) */ "iip\0" "glGetShaderiv\0" "\0" - /* _mesa_function_pool[27369]: ClientWaitSync (will be remapped) */ + /* _mesa_function_pool[27444]: ClientWaitSync (will be remapped) */ "iii\0" "glClientWaitSync\0" "\0" - /* _mesa_function_pool[27391]: TexCoord4s (offset 124) */ + /* _mesa_function_pool[27466]: TexCoord4s (offset 124) */ "iiii\0" "glTexCoord4s\0" "\0" - /* _mesa_function_pool[27410]: TexCoord3sv (offset 117) */ + /* _mesa_function_pool[27485]: TexCoord3sv (offset 117) */ "p\0" "glTexCoord3sv\0" "\0" - /* _mesa_function_pool[27427]: BindFragmentShaderATI (will be remapped) */ + /* _mesa_function_pool[27502]: BindFragmentShaderATI (will be remapped) */ "i\0" "glBindFragmentShaderATI\0" "\0" - /* _mesa_function_pool[27454]: PopAttrib (offset 218) */ + /* _mesa_function_pool[27529]: PopAttrib (offset 218) */ "\0" "glPopAttrib\0" "\0" - /* _mesa_function_pool[27468]: Fogfv (offset 154) */ + /* _mesa_function_pool[27543]: Fogfv (offset 154) */ "ip\0" "glFogfv\0" "\0" - /* _mesa_function_pool[27480]: UnmapBufferARB (will be remapped) */ + /* _mesa_function_pool[27555]: UnmapBufferARB (will be remapped) */ "i\0" "glUnmapBuffer\0" "glUnmapBufferARB\0" "\0" - /* _mesa_function_pool[27514]: InitNames (offset 197) */ + /* _mesa_function_pool[27589]: InitNames (offset 197) */ "\0" "glInitNames\0" "\0" - /* _mesa_function_pool[27528]: Normal3sv (offset 61) */ + /* _mesa_function_pool[27603]: Normal3sv (offset 61) */ "p\0" "glNormal3sv\0" "\0" - /* _mesa_function_pool[27543]: Minmax (offset 368) */ + /* _mesa_function_pool[27618]: Minmax (offset 368) */ "iii\0" "glMinmax\0" "glMinmaxEXT\0" "\0" - /* _mesa_function_pool[27569]: TexCoord4d (offset 118) */ + /* _mesa_function_pool[27644]: TexCoord4d (offset 118) */ "dddd\0" "glTexCoord4d\0" "\0" - /* _mesa_function_pool[27588]: DeformationMap3dSGIX (dynamic) */ - "iddiiddiiddiip\0" - "glDeformationMap3dSGIX\0" - "\0" - /* _mesa_function_pool[27627]: TexCoord4f (offset 120) */ + /* _mesa_function_pool[27663]: TexCoord4f (offset 120) */ "ffff\0" "glTexCoord4f\0" "\0" - /* _mesa_function_pool[27646]: FogCoorddvEXT (will be remapped) */ + /* _mesa_function_pool[27682]: FogCoorddvEXT (will be remapped) */ "p\0" "glFogCoorddv\0" "glFogCoorddvEXT\0" "\0" - /* _mesa_function_pool[27678]: FinishTextureSUNX (dynamic) */ + /* _mesa_function_pool[27714]: FinishTextureSUNX (dynamic) */ "\0" "glFinishTextureSUNX\0" "\0" - /* _mesa_function_pool[27700]: GetFragmentLightfvSGIX (dynamic) */ + /* _mesa_function_pool[27736]: GetFragmentLightfvSGIX (dynamic) */ "iip\0" "glGetFragmentLightfvSGIX\0" "\0" - /* _mesa_function_pool[27730]: Binormal3fvEXT (dynamic) */ + /* _mesa_function_pool[27766]: Binormal3fvEXT (dynamic) */ "p\0" "glBinormal3fvEXT\0" "\0" - /* _mesa_function_pool[27750]: GetBooleanv (offset 258) */ + /* _mesa_function_pool[27786]: GetBooleanv (offset 258) */ "ip\0" "glGetBooleanv\0" "\0" - /* _mesa_function_pool[27768]: ColorFragmentOp3ATI (will be remapped) */ + /* _mesa_function_pool[27804]: ColorFragmentOp3ATI (will be remapped) */ "iiiiiiiiiiiii\0" "glColorFragmentOp3ATI\0" "\0" - /* _mesa_function_pool[27805]: Hint (offset 158) */ + /* _mesa_function_pool[27841]: Hint (offset 158) */ "ii\0" "glHint\0" "\0" - /* _mesa_function_pool[27816]: Color4dv (offset 28) */ + /* _mesa_function_pool[27852]: Color4dv (offset 28) */ "p\0" "glColor4dv\0" "\0" - /* _mesa_function_pool[27830]: VertexAttrib2svARB (will be remapped) */ + /* _mesa_function_pool[27866]: VertexAttrib2svARB (will be remapped) */ "ip\0" "glVertexAttrib2sv\0" "glVertexAttrib2svARB\0" "\0" - /* _mesa_function_pool[27873]: AreProgramsResidentNV (will be remapped) */ + /* _mesa_function_pool[27909]: AreProgramsResidentNV (will be remapped) */ "ipp\0" "glAreProgramsResidentNV\0" "\0" - /* _mesa_function_pool[27902]: WindowPos3svMESA (will be remapped) */ + /* _mesa_function_pool[27938]: WindowPos3svMESA (will be remapped) */ "p\0" "glWindowPos3sv\0" "glWindowPos3svARB\0" "glWindowPos3svMESA\0" "\0" - /* _mesa_function_pool[27957]: CopyColorSubTable (offset 347) */ + /* _mesa_function_pool[27993]: CopyColorSubTable (offset 347) */ "iiiii\0" "glCopyColorSubTable\0" "glCopyColorSubTableEXT\0" "\0" - /* _mesa_function_pool[28007]: WeightdvARB (dynamic) */ + /* _mesa_function_pool[28043]: WeightdvARB (dynamic) */ "ip\0" "glWeightdvARB\0" "\0" - /* _mesa_function_pool[28025]: DeleteRenderbuffersEXT (will be remapped) */ + /* _mesa_function_pool[28061]: DeleteRenderbuffersEXT (will be remapped) */ "ip\0" "glDeleteRenderbuffers\0" "glDeleteRenderbuffersEXT\0" "\0" - /* _mesa_function_pool[28076]: VertexAttrib4NubvARB (will be remapped) */ + /* _mesa_function_pool[28112]: VertexAttrib4NubvARB (will be remapped) */ "ip\0" "glVertexAttrib4Nubv\0" "glVertexAttrib4NubvARB\0" "\0" - /* _mesa_function_pool[28123]: VertexAttrib3dvNV (will be remapped) */ + /* _mesa_function_pool[28159]: VertexAttrib3dvNV (will be remapped) */ "ip\0" "glVertexAttrib3dvNV\0" "\0" - /* _mesa_function_pool[28147]: GetObjectParameterfvARB (will be remapped) */ + /* _mesa_function_pool[28183]: GetObjectParameterfvARB (will be remapped) */ "iip\0" "glGetObjectParameterfvARB\0" "\0" - /* _mesa_function_pool[28178]: Vertex4iv (offset 147) */ + /* _mesa_function_pool[28214]: Vertex4iv (offset 147) */ "p\0" "glVertex4iv\0" "\0" - /* _mesa_function_pool[28193]: GetProgramEnvParameterdvARB (will be remapped) */ + /* _mesa_function_pool[28229]: GetProgramEnvParameterdvARB (will be remapped) */ "iip\0" "glGetProgramEnvParameterdvARB\0" "\0" - /* _mesa_function_pool[28228]: TexCoord4dv (offset 119) */ + /* _mesa_function_pool[28264]: TexCoord4dv (offset 119) */ "p\0" "glTexCoord4dv\0" "\0" - /* _mesa_function_pool[28245]: LockArraysEXT (will be remapped) */ + /* _mesa_function_pool[28281]: LockArraysEXT (will be remapped) */ "ii\0" "glLockArraysEXT\0" "\0" - /* _mesa_function_pool[28265]: Begin (offset 7) */ + /* _mesa_function_pool[28301]: Begin (offset 7) */ "i\0" "glBegin\0" "\0" - /* _mesa_function_pool[28276]: LightModeli (offset 165) */ + /* _mesa_function_pool[28312]: LightModeli (offset 165) */ "ii\0" "glLightModeli\0" "\0" - /* _mesa_function_pool[28294]: Rectfv (offset 89) */ + /* _mesa_function_pool[28330]: Rectfv (offset 89) */ "pp\0" "glRectfv\0" "\0" - /* _mesa_function_pool[28307]: LightModelf (offset 163) */ + /* _mesa_function_pool[28343]: LightModelf (offset 163) */ "if\0" "glLightModelf\0" "\0" - /* _mesa_function_pool[28325]: GetTexParameterfv (offset 282) */ + /* _mesa_function_pool[28361]: GetTexParameterfv (offset 282) */ "iip\0" "glGetTexParameterfv\0" "\0" - /* _mesa_function_pool[28350]: GetLightfv (offset 264) */ + /* _mesa_function_pool[28386]: GetLightfv (offset 264) */ "iip\0" "glGetLightfv\0" "\0" - /* _mesa_function_pool[28368]: PixelTransformParameterivEXT (dynamic) */ + /* _mesa_function_pool[28404]: PixelTransformParameterivEXT (dynamic) */ "iip\0" "glPixelTransformParameterivEXT\0" "\0" - /* _mesa_function_pool[28404]: BinormalPointerEXT (dynamic) */ + /* _mesa_function_pool[28440]: BinormalPointerEXT (dynamic) */ "iip\0" "glBinormalPointerEXT\0" "\0" - /* _mesa_function_pool[28430]: VertexAttrib1dNV (will be remapped) */ + /* _mesa_function_pool[28466]: VertexAttrib1dNV (will be remapped) */ "id\0" "glVertexAttrib1dNV\0" "\0" - /* _mesa_function_pool[28453]: GetCombinerInputParameterivNV (will be remapped) */ + /* _mesa_function_pool[28489]: GetCombinerInputParameterivNV (will be remapped) */ "iiiip\0" "glGetCombinerInputParameterivNV\0" "\0" - /* _mesa_function_pool[28492]: Disable (offset 214) */ + /* _mesa_function_pool[28528]: Disable (offset 214) */ "i\0" "glDisable\0" "\0" - /* _mesa_function_pool[28505]: MultiTexCoord2fvARB (offset 387) */ + /* _mesa_function_pool[28541]: MultiTexCoord2fvARB (offset 387) */ "ip\0" "glMultiTexCoord2fv\0" "glMultiTexCoord2fvARB\0" "\0" - /* _mesa_function_pool[28550]: GetRenderbufferParameterivEXT (will be remapped) */ + /* _mesa_function_pool[28586]: GetRenderbufferParameterivEXT (will be remapped) */ "iip\0" "glGetRenderbufferParameteriv\0" "glGetRenderbufferParameterivEXT\0" "\0" - /* _mesa_function_pool[28616]: CombinerParameterivNV (will be remapped) */ + /* _mesa_function_pool[28652]: CombinerParameterivNV (will be remapped) */ "ip\0" "glCombinerParameterivNV\0" "\0" - /* _mesa_function_pool[28644]: GenFragmentShadersATI (will be remapped) */ + /* _mesa_function_pool[28680]: GenFragmentShadersATI (will be remapped) */ "i\0" "glGenFragmentShadersATI\0" "\0" - /* _mesa_function_pool[28671]: DrawArrays (offset 310) */ + /* _mesa_function_pool[28707]: DrawArrays (offset 310) */ "iii\0" "glDrawArrays\0" "glDrawArraysEXT\0" "\0" - /* _mesa_function_pool[28705]: WeightuivARB (dynamic) */ + /* _mesa_function_pool[28741]: WeightuivARB (dynamic) */ "ip\0" "glWeightuivARB\0" "\0" - /* _mesa_function_pool[28724]: VertexAttrib2sARB (will be remapped) */ + /* _mesa_function_pool[28760]: VertexAttrib2sARB (will be remapped) */ "iii\0" "glVertexAttrib2s\0" "glVertexAttrib2sARB\0" "\0" - /* _mesa_function_pool[28766]: ColorMask (offset 210) */ + /* _mesa_function_pool[28802]: ColorMask (offset 210) */ "iiii\0" "glColorMask\0" "\0" - /* _mesa_function_pool[28784]: GenAsyncMarkersSGIX (dynamic) */ + /* _mesa_function_pool[28820]: GenAsyncMarkersSGIX (dynamic) */ "i\0" "glGenAsyncMarkersSGIX\0" "\0" - /* _mesa_function_pool[28809]: Tangent3svEXT (dynamic) */ + /* _mesa_function_pool[28845]: Tangent3svEXT (dynamic) */ "p\0" "glTangent3svEXT\0" "\0" - /* _mesa_function_pool[28828]: GetListParameterivSGIX (dynamic) */ + /* _mesa_function_pool[28864]: GetListParameterivSGIX (dynamic) */ "iip\0" "glGetListParameterivSGIX\0" "\0" - /* _mesa_function_pool[28858]: BindBufferARB (will be remapped) */ + /* _mesa_function_pool[28894]: BindBufferARB (will be remapped) */ "ii\0" "glBindBuffer\0" "glBindBufferARB\0" "\0" - /* _mesa_function_pool[28891]: GetInfoLogARB (will be remapped) */ + /* _mesa_function_pool[28927]: GetInfoLogARB (will be remapped) */ "iipp\0" "glGetInfoLogARB\0" "\0" - /* _mesa_function_pool[28913]: RasterPos4iv (offset 83) */ + /* _mesa_function_pool[28949]: RasterPos4iv (offset 83) */ "p\0" "glRasterPos4iv\0" "\0" - /* _mesa_function_pool[28931]: Enable (offset 215) */ + /* _mesa_function_pool[28967]: Enable (offset 215) */ "i\0" "glEnable\0" "\0" - /* _mesa_function_pool[28943]: LineStipple (offset 167) */ + /* _mesa_function_pool[28979]: LineStipple (offset 167) */ "ii\0" "glLineStipple\0" "\0" - /* _mesa_function_pool[28961]: VertexAttribs4svNV (will be remapped) */ + /* _mesa_function_pool[28997]: VertexAttribs4svNV (will be remapped) */ "iip\0" "glVertexAttribs4svNV\0" "\0" - /* _mesa_function_pool[28987]: EdgeFlagPointerListIBM (dynamic) */ + /* _mesa_function_pool[29023]: EdgeFlagPointerListIBM (dynamic) */ "ipi\0" "glEdgeFlagPointerListIBM\0" "\0" - /* _mesa_function_pool[29017]: UniformMatrix3x2fv (will be remapped) */ + /* _mesa_function_pool[29053]: UniformMatrix3x2fv (will be remapped) */ "iiip\0" "glUniformMatrix3x2fv\0" "\0" - /* _mesa_function_pool[29044]: GetMinmaxParameterfv (offset 365) */ + /* _mesa_function_pool[29080]: GetMinmaxParameterfv (offset 365) */ "iip\0" "glGetMinmaxParameterfv\0" "glGetMinmaxParameterfvEXT\0" "\0" - /* _mesa_function_pool[29098]: VertexAttrib1fvARB (will be remapped) */ + /* _mesa_function_pool[29134]: VertexAttrib1fvARB (will be remapped) */ "ip\0" "glVertexAttrib1fv\0" "glVertexAttrib1fvARB\0" "\0" - /* _mesa_function_pool[29141]: GenBuffersARB (will be remapped) */ + /* _mesa_function_pool[29177]: GenBuffersARB (will be remapped) */ "ip\0" "glGenBuffers\0" "glGenBuffersARB\0" "\0" - /* _mesa_function_pool[29174]: VertexAttribs1svNV (will be remapped) */ + /* _mesa_function_pool[29210]: VertexAttribs1svNV (will be remapped) */ "iip\0" "glVertexAttribs1svNV\0" "\0" - /* _mesa_function_pool[29200]: Vertex3fv (offset 137) */ + /* _mesa_function_pool[29236]: Vertex3fv (offset 137) */ "p\0" "glVertex3fv\0" "\0" - /* _mesa_function_pool[29215]: GetTexBumpParameterivATI (will be remapped) */ + /* _mesa_function_pool[29251]: GetTexBumpParameterivATI (will be remapped) */ "ip\0" "glGetTexBumpParameterivATI\0" "\0" - /* _mesa_function_pool[29246]: Binormal3bEXT (dynamic) */ + /* _mesa_function_pool[29282]: Binormal3bEXT (dynamic) */ "iii\0" "glBinormal3bEXT\0" "\0" - /* _mesa_function_pool[29267]: FragmentMaterialivSGIX (dynamic) */ + /* _mesa_function_pool[29303]: FragmentMaterialivSGIX (dynamic) */ "iip\0" "glFragmentMaterialivSGIX\0" "\0" - /* _mesa_function_pool[29297]: IsRenderbufferEXT (will be remapped) */ + /* _mesa_function_pool[29333]: IsRenderbufferEXT (will be remapped) */ "i\0" "glIsRenderbuffer\0" "glIsRenderbufferEXT\0" "\0" - /* _mesa_function_pool[29337]: GenProgramsNV (will be remapped) */ + /* _mesa_function_pool[29373]: GenProgramsNV (will be remapped) */ "ip\0" "glGenProgramsARB\0" "glGenProgramsNV\0" "\0" - /* _mesa_function_pool[29374]: VertexAttrib4dvNV (will be remapped) */ + /* _mesa_function_pool[29410]: VertexAttrib4dvNV (will be remapped) */ "ip\0" "glVertexAttrib4dvNV\0" "\0" - /* _mesa_function_pool[29398]: EndFragmentShaderATI (will be remapped) */ + /* _mesa_function_pool[29434]: EndFragmentShaderATI (will be remapped) */ "\0" "glEndFragmentShaderATI\0" "\0" - /* _mesa_function_pool[29423]: Binormal3iEXT (dynamic) */ + /* _mesa_function_pool[29459]: Binormal3iEXT (dynamic) */ "iii\0" "glBinormal3iEXT\0" "\0" - /* _mesa_function_pool[29444]: WindowPos2fMESA (will be remapped) */ + /* _mesa_function_pool[29480]: WindowPos2fMESA (will be remapped) */ "ff\0" "glWindowPos2f\0" "glWindowPos2fARB\0" @@ -4334,390 +4335,390 @@ static const struct { } MESA_remap_table_functions[] = { { 1461, AttachShader_remap_index }, { 8704, CreateProgram_remap_index }, - { 20115, CreateShader_remap_index }, - { 22375, DeleteProgram_remap_index }, - { 16150, DeleteShader_remap_index }, - { 20561, DetachShader_remap_index }, - { 15674, GetAttachedShaders_remap_index }, + { 20158, CreateShader_remap_index }, + { 22418, DeleteProgram_remap_index }, + { 16193, DeleteShader_remap_index }, + { 20604, DetachShader_remap_index }, + { 15717, GetAttachedShaders_remap_index }, { 4244, GetProgramInfoLog_remap_index }, { 361, GetProgramiv_remap_index }, { 5547, GetShaderInfoLog_remap_index }, - { 27350, GetShaderiv_remap_index }, - { 11657, IsProgram_remap_index }, - { 10728, IsShader_remap_index }, + { 27425, GetShaderiv_remap_index }, + { 11732, IsProgram_remap_index }, + { 10767, IsShader_remap_index }, { 8808, StencilFuncSeparate_remap_index }, { 3487, StencilMaskSeparate_remap_index }, { 6623, StencilOpSeparate_remap_index }, - { 19492, UniformMatrix2x3fv_remap_index }, + { 19535, UniformMatrix2x3fv_remap_index }, { 2615, UniformMatrix2x4fv_remap_index }, - { 29017, UniformMatrix3x2fv_remap_index }, - { 26776, UniformMatrix3x4fv_remap_index }, - { 14222, UniformMatrix4x2fv_remap_index }, + { 29053, UniformMatrix3x2fv_remap_index }, + { 26851, UniformMatrix3x4fv_remap_index }, + { 14265, UniformMatrix4x2fv_remap_index }, { 2937, UniformMatrix4x3fv_remap_index }, { 8722, LoadTransposeMatrixdARB_remap_index }, - { 27079, LoadTransposeMatrixfARB_remap_index }, + { 27154, LoadTransposeMatrixfARB_remap_index }, { 4817, MultTransposeMatrixdARB_remap_index }, - { 20748, MultTransposeMatrixfARB_remap_index }, + { 20791, MultTransposeMatrixfARB_remap_index }, { 172, SampleCoverageARB_remap_index }, { 4971, CompressedTexImage1DARB_remap_index }, - { 21205, CompressedTexImage2DARB_remap_index }, + { 21248, CompressedTexImage2DARB_remap_index }, { 3550, CompressedTexImage3DARB_remap_index }, - { 15966, CompressedTexSubImage1DARB_remap_index }, + { 16009, CompressedTexSubImage1DARB_remap_index }, { 1880, CompressedTexSubImage2DARB_remap_index }, - { 17758, CompressedTexSubImage3DARB_remap_index }, - { 25058, GetCompressedTexImageARB_remap_index }, + { 17801, CompressedTexSubImage3DARB_remap_index }, + { 25133, GetCompressedTexImageARB_remap_index }, { 3395, DisableVertexAttribArrayARB_remap_index }, - { 26388, EnableVertexAttribArrayARB_remap_index }, - { 28193, GetProgramEnvParameterdvARB_remap_index }, - { 20628, GetProgramEnvParameterfvARB_remap_index }, - { 24088, GetProgramLocalParameterdvARB_remap_index }, + { 26463, EnableVertexAttribArrayARB_remap_index }, + { 28229, GetProgramEnvParameterdvARB_remap_index }, + { 20671, GetProgramEnvParameterfvARB_remap_index }, + { 24163, GetProgramLocalParameterdvARB_remap_index }, { 7065, GetProgramLocalParameterfvARB_remap_index }, - { 16057, GetProgramStringARB_remap_index }, - { 24283, GetProgramivARB_remap_index }, - { 17953, GetVertexAttribdvARB_remap_index }, - { 14111, GetVertexAttribfvARB_remap_index }, + { 16100, GetProgramStringARB_remap_index }, + { 24358, GetProgramivARB_remap_index }, + { 17996, GetVertexAttribdvARB_remap_index }, + { 14154, GetVertexAttribfvARB_remap_index }, { 8617, GetVertexAttribivARB_remap_index }, - { 16862, ProgramEnvParameter4dARB_remap_index }, - { 22175, ProgramEnvParameter4dvARB_remap_index }, - { 14719, ProgramEnvParameter4fARB_remap_index }, + { 16905, ProgramEnvParameter4dARB_remap_index }, + { 22218, ProgramEnvParameter4dvARB_remap_index }, + { 14762, ProgramEnvParameter4fARB_remap_index }, { 7928, ProgramEnvParameter4fvARB_remap_index }, { 3513, ProgramLocalParameter4dARB_remap_index }, - { 11403, ProgramLocalParameter4dvARB_remap_index }, - { 25867, ProgramLocalParameter4fARB_remap_index }, - { 22693, ProgramLocalParameter4fvARB_remap_index }, - { 24844, ProgramStringARB_remap_index }, - { 17112, VertexAttrib1dARB_remap_index }, - { 13765, VertexAttrib1dvARB_remap_index }, + { 11442, ProgramLocalParameter4dvARB_remap_index }, + { 25942, ProgramLocalParameter4fARB_remap_index }, + { 22736, ProgramLocalParameter4fvARB_remap_index }, + { 24919, ProgramStringARB_remap_index }, + { 17155, VertexAttrib1dARB_remap_index }, + { 13808, VertexAttrib1dvARB_remap_index }, { 3688, VertexAttrib1fARB_remap_index }, - { 29098, VertexAttrib1fvARB_remap_index }, + { 29134, VertexAttrib1fvARB_remap_index }, { 6149, VertexAttrib1sARB_remap_index }, { 2054, VertexAttrib1svARB_remap_index }, - { 13196, VertexAttrib2dARB_remap_index }, - { 15293, VertexAttrib2dvARB_remap_index }, + { 13239, VertexAttrib2dARB_remap_index }, + { 15336, VertexAttrib2dvARB_remap_index }, { 1480, VertexAttrib2fARB_remap_index }, - { 15406, VertexAttrib2fvARB_remap_index }, - { 28724, VertexAttrib2sARB_remap_index }, - { 27830, VertexAttrib2svARB_remap_index }, + { 15449, VertexAttrib2fvARB_remap_index }, + { 28760, VertexAttrib2sARB_remap_index }, + { 27866, VertexAttrib2svARB_remap_index }, { 9926, VertexAttrib3dARB_remap_index }, { 7631, VertexAttrib3dvARB_remap_index }, { 1567, VertexAttrib3fARB_remap_index }, - { 19729, VertexAttrib3fvARB_remap_index }, - { 24716, VertexAttrib3sARB_remap_index }, - { 17695, VertexAttrib3svARB_remap_index }, + { 19772, VertexAttrib3fvARB_remap_index }, + { 24791, VertexAttrib3sARB_remap_index }, + { 17738, VertexAttrib3svARB_remap_index }, { 4270, VertexAttrib4NbvARB_remap_index }, - { 15629, VertexAttrib4NivARB_remap_index }, - { 19684, VertexAttrib4NsvARB_remap_index }, - { 20580, VertexAttrib4NubARB_remap_index }, - { 28076, VertexAttrib4NubvARB_remap_index }, - { 16523, VertexAttrib4NuivARB_remap_index }, + { 15672, VertexAttrib4NivARB_remap_index }, + { 19727, VertexAttrib4NsvARB_remap_index }, + { 20623, VertexAttrib4NubARB_remap_index }, + { 28112, VertexAttrib4NubvARB_remap_index }, + { 16566, VertexAttrib4NuivARB_remap_index }, { 2810, VertexAttrib4NusvARB_remap_index }, { 9549, VertexAttrib4bvARB_remap_index }, - { 23496, VertexAttrib4dARB_remap_index }, - { 18678, VertexAttrib4dvARB_remap_index }, + { 23571, VertexAttrib4dARB_remap_index }, + { 18721, VertexAttrib4dvARB_remap_index }, { 10033, VertexAttrib4fARB_remap_index }, { 10403, VertexAttrib4fvARB_remap_index }, { 9001, VertexAttrib4ivARB_remap_index }, - { 15107, VertexAttrib4sARB_remap_index }, - { 27265, VertexAttrib4svARB_remap_index }, - { 14524, VertexAttrib4ubvARB_remap_index }, - { 26712, VertexAttrib4uivARB_remap_index }, - { 17506, VertexAttrib4usvARB_remap_index }, - { 19366, VertexAttribPointerARB_remap_index }, - { 28858, BindBufferARB_remap_index }, + { 15150, VertexAttrib4sARB_remap_index }, + { 27340, VertexAttrib4svARB_remap_index }, + { 14567, VertexAttrib4ubvARB_remap_index }, + { 26787, VertexAttrib4uivARB_remap_index }, + { 17549, VertexAttrib4usvARB_remap_index }, + { 19409, VertexAttribPointerARB_remap_index }, + { 28894, BindBufferARB_remap_index }, { 5862, BufferDataARB_remap_index }, { 1382, BufferSubDataARB_remap_index }, - { 26901, DeleteBuffersARB_remap_index }, - { 29141, GenBuffersARB_remap_index }, - { 15449, GetBufferParameterivARB_remap_index }, - { 14671, GetBufferPointervARB_remap_index }, + { 26976, DeleteBuffersARB_remap_index }, + { 29177, GenBuffersARB_remap_index }, + { 15492, GetBufferParameterivARB_remap_index }, + { 14714, GetBufferPointervARB_remap_index }, { 1335, GetBufferSubDataARB_remap_index }, - { 26660, IsBufferARB_remap_index }, - { 23124, MapBufferARB_remap_index }, - { 27480, UnmapBufferARB_remap_index }, + { 26735, IsBufferARB_remap_index }, + { 23167, MapBufferARB_remap_index }, + { 27555, UnmapBufferARB_remap_index }, { 268, BeginQueryARB_remap_index }, - { 17207, DeleteQueriesARB_remap_index }, + { 17250, DeleteQueriesARB_remap_index }, { 10664, EndQueryARB_remap_index }, - { 25537, GenQueriesARB_remap_index }, + { 25612, GenQueriesARB_remap_index }, { 1772, GetQueryObjectivARB_remap_index }, - { 15151, GetQueryObjectuivARB_remap_index }, + { 15194, GetQueryObjectuivARB_remap_index }, { 1624, GetQueryivARB_remap_index }, - { 17413, IsQueryARB_remap_index }, + { 17456, IsQueryARB_remap_index }, { 7241, AttachObjectARB_remap_index }, - { 16112, CompileShaderARB_remap_index }, + { 16155, CompileShaderARB_remap_index }, { 2879, CreateProgramObjectARB_remap_index }, { 5807, CreateShaderObjectARB_remap_index }, - { 12613, DeleteObjectARB_remap_index }, - { 20979, DetachObjectARB_remap_index }, + { 12656, DeleteObjectARB_remap_index }, + { 21022, DetachObjectARB_remap_index }, { 10475, GetActiveUniformARB_remap_index }, { 8320, GetAttachedObjectsARB_remap_index }, { 8599, GetHandleARB_remap_index }, - { 28891, GetInfoLogARB_remap_index }, - { 28147, GetObjectParameterfvARB_remap_index }, - { 23962, GetObjectParameterivARB_remap_index }, - { 25295, GetShaderSourceARB_remap_index }, - { 24576, GetUniformLocationARB_remap_index }, - { 20850, GetUniformfvARB_remap_index }, - { 11025, GetUniformivARB_remap_index }, - { 17551, LinkProgramARB_remap_index }, - { 17609, ShaderSourceARB_remap_index }, + { 28927, GetInfoLogARB_remap_index }, + { 28183, GetObjectParameterfvARB_remap_index }, + { 24037, GetObjectParameterivARB_remap_index }, + { 25370, GetShaderSourceARB_remap_index }, + { 24651, GetUniformLocationARB_remap_index }, + { 20893, GetUniformfvARB_remap_index }, + { 11064, GetUniformivARB_remap_index }, + { 17594, LinkProgramARB_remap_index }, + { 17652, ShaderSourceARB_remap_index }, { 6523, Uniform1fARB_remap_index }, - { 26076, Uniform1fvARB_remap_index }, - { 19335, Uniform1iARB_remap_index }, - { 18367, Uniform1ivARB_remap_index }, + { 26151, Uniform1fvARB_remap_index }, + { 19378, Uniform1iARB_remap_index }, + { 18410, Uniform1ivARB_remap_index }, { 2003, Uniform2fARB_remap_index }, - { 12449, Uniform2fvARB_remap_index }, - { 23011, Uniform2iARB_remap_index }, + { 12492, Uniform2fvARB_remap_index }, + { 23054, Uniform2iARB_remap_index }, { 2123, Uniform2ivARB_remap_index }, - { 16222, Uniform3fARB_remap_index }, + { 16265, Uniform3fARB_remap_index }, { 8350, Uniform3fvARB_remap_index }, { 5481, Uniform3iARB_remap_index }, - { 14777, Uniform3ivARB_remap_index }, - { 16668, Uniform4fARB_remap_index }, - { 20714, Uniform4fvARB_remap_index }, - { 21854, Uniform4iARB_remap_index }, - { 17919, Uniform4ivARB_remap_index }, + { 14820, Uniform3ivARB_remap_index }, + { 16711, Uniform4fARB_remap_index }, + { 20757, Uniform4fvARB_remap_index }, + { 21897, Uniform4iARB_remap_index }, + { 17962, Uniform4ivARB_remap_index }, { 7293, UniformMatrix2fvARB_remap_index }, { 17, UniformMatrix3fvARB_remap_index }, { 2475, UniformMatrix4fvARB_remap_index }, - { 22287, UseProgramObjectARB_remap_index }, - { 12884, ValidateProgramARB_remap_index }, - { 18721, BindAttribLocationARB_remap_index }, + { 22330, UseProgramObjectARB_remap_index }, + { 12927, ValidateProgramARB_remap_index }, + { 18764, BindAttribLocationARB_remap_index }, { 4315, GetActiveAttribARB_remap_index }, - { 14458, GetAttribLocationARB_remap_index }, - { 25815, DrawBuffersARB_remap_index }, - { 11508, RenderbufferStorageMultisample_remap_index }, - { 16716, FlushMappedBufferRange_remap_index }, - { 24379, MapBufferRange_remap_index }, - { 14333, BindVertexArray_remap_index }, - { 12743, GenVertexArrays_remap_index }, - { 26590, CopyBufferSubData_remap_index }, - { 27369, ClientWaitSync_remap_index }, + { 14501, GetAttribLocationARB_remap_index }, + { 25890, DrawBuffersARB_remap_index }, + { 11547, RenderbufferStorageMultisample_remap_index }, + { 16759, FlushMappedBufferRange_remap_index }, + { 24454, MapBufferRange_remap_index }, + { 14376, BindVertexArray_remap_index }, + { 12786, GenVertexArrays_remap_index }, + { 26665, CopyBufferSubData_remap_index }, + { 27444, ClientWaitSync_remap_index }, { 2394, DeleteSync_remap_index }, { 6190, FenceSync_remap_index }, - { 13255, GetInteger64v_remap_index }, - { 19791, GetSynciv_remap_index }, - { 25754, IsSync_remap_index }, + { 13298, GetInteger64v_remap_index }, + { 19834, GetSynciv_remap_index }, + { 25829, IsSync_remap_index }, { 8268, WaitSync_remap_index }, { 3363, DrawElementsBaseVertex_remap_index }, - { 26833, DrawRangeElementsBaseVertex_remap_index }, - { 23155, MultiDrawElementsBaseVertex_remap_index }, + { 26908, DrawRangeElementsBaseVertex_remap_index }, + { 23198, MultiDrawElementsBaseVertex_remap_index }, { 4680, PolygonOffsetEXT_remap_index }, - { 20350, GetPixelTexGenParameterfvSGIS_remap_index }, + { 20393, GetPixelTexGenParameterfvSGIS_remap_index }, { 3895, GetPixelTexGenParameterivSGIS_remap_index }, - { 20083, PixelTexGenParameterfSGIS_remap_index }, + { 20126, PixelTexGenParameterfSGIS_remap_index }, { 580, PixelTexGenParameterfvSGIS_remap_index }, - { 11063, PixelTexGenParameteriSGIS_remap_index }, - { 12020, PixelTexGenParameterivSGIS_remap_index }, - { 14421, SampleMaskSGIS_remap_index }, - { 17353, SamplePatternSGIS_remap_index }, - { 23084, ColorPointerEXT_remap_index }, - { 15336, EdgeFlagPointerEXT_remap_index }, + { 11102, PixelTexGenParameteriSGIS_remap_index }, + { 12063, PixelTexGenParameterivSGIS_remap_index }, + { 14464, SampleMaskSGIS_remap_index }, + { 17396, SamplePatternSGIS_remap_index }, + { 23127, ColorPointerEXT_remap_index }, + { 15379, EdgeFlagPointerEXT_remap_index }, { 5135, IndexPointerEXT_remap_index }, { 5215, NormalPointerEXT_remap_index }, - { 13849, TexCoordPointerEXT_remap_index }, + { 13892, TexCoordPointerEXT_remap_index }, { 5985, VertexPointerEXT_remap_index }, { 3165, PointParameterfEXT_remap_index }, { 6830, PointParameterfvEXT_remap_index }, - { 28245, LockArraysEXT_remap_index }, - { 12948, UnlockArraysEXT_remap_index }, + { 28281, LockArraysEXT_remap_index }, + { 12991, UnlockArraysEXT_remap_index }, { 7837, CullParameterdvEXT_remap_index }, { 10270, CullParameterfvEXT_remap_index }, { 1151, SecondaryColor3bEXT_remap_index }, { 6989, SecondaryColor3bvEXT_remap_index }, { 9178, SecondaryColor3dEXT_remap_index }, - { 22433, SecondaryColor3dvEXT_remap_index }, - { 24625, SecondaryColor3fEXT_remap_index }, - { 15902, SecondaryColor3fvEXT_remap_index }, + { 22476, SecondaryColor3dvEXT_remap_index }, + { 24700, SecondaryColor3fEXT_remap_index }, + { 15945, SecondaryColor3fvEXT_remap_index }, { 426, SecondaryColor3iEXT_remap_index }, - { 14159, SecondaryColor3ivEXT_remap_index }, + { 14202, SecondaryColor3ivEXT_remap_index }, { 8836, SecondaryColor3sEXT_remap_index }, - { 27033, SecondaryColor3svEXT_remap_index }, - { 23798, SecondaryColor3ubEXT_remap_index }, - { 18612, SecondaryColor3ubvEXT_remap_index }, - { 11258, SecondaryColor3uiEXT_remap_index }, - { 19970, SecondaryColor3uivEXT_remap_index }, - { 22645, SecondaryColor3usEXT_remap_index }, - { 11331, SecondaryColor3usvEXT_remap_index }, + { 27108, SecondaryColor3svEXT_remap_index }, + { 23873, SecondaryColor3ubEXT_remap_index }, + { 18655, SecondaryColor3ubvEXT_remap_index }, + { 11297, SecondaryColor3uiEXT_remap_index }, + { 20013, SecondaryColor3uivEXT_remap_index }, + { 22688, SecondaryColor3usEXT_remap_index }, + { 11370, SecondaryColor3usvEXT_remap_index }, { 10346, SecondaryColorPointerEXT_remap_index }, - { 22494, MultiDrawArraysEXT_remap_index }, - { 18302, MultiDrawElementsEXT_remap_index }, - { 18497, FogCoordPointerEXT_remap_index }, + { 22537, MultiDrawArraysEXT_remap_index }, + { 18345, MultiDrawElementsEXT_remap_index }, + { 18540, FogCoordPointerEXT_remap_index }, { 4044, FogCoorddEXT_remap_index }, - { 27646, FogCoorddvEXT_remap_index }, + { 27682, FogCoorddvEXT_remap_index }, { 4105, FogCoordfEXT_remap_index }, - { 23721, FogCoordfvEXT_remap_index }, - { 16620, PixelTexGenSGIX_remap_index }, - { 24306, BlendFuncSeparateEXT_remap_index }, + { 23796, FogCoordfvEXT_remap_index }, + { 16663, PixelTexGenSGIX_remap_index }, + { 24381, BlendFuncSeparateEXT_remap_index }, { 5897, FlushVertexArrayRangeNV_remap_index }, { 4629, VertexArrayRangeNV_remap_index }, - { 24690, CombinerInputNV_remap_index }, + { 24765, CombinerInputNV_remap_index }, { 1946, CombinerOutputNV_remap_index }, - { 27186, CombinerParameterfNV_remap_index }, + { 27261, CombinerParameterfNV_remap_index }, { 4549, CombinerParameterfvNV_remap_index }, - { 19541, CombinerParameteriNV_remap_index }, - { 28616, CombinerParameterivNV_remap_index }, + { 19584, CombinerParameteriNV_remap_index }, + { 28652, CombinerParameterivNV_remap_index }, { 6267, FinalCombinerInputNV_remap_index }, { 8665, GetCombinerInputParameterfvNV_remap_index }, - { 28453, GetCombinerInputParameterivNV_remap_index }, + { 28489, GetCombinerInputParameterivNV_remap_index }, { 6066, GetCombinerOutputParameterfvNV_remap_index }, - { 11949, GetCombinerOutputParameterivNV_remap_index }, + { 12024, GetCombinerOutputParameterivNV_remap_index }, { 5642, GetFinalCombinerInputParameterfvNV_remap_index }, - { 21726, GetFinalCombinerInputParameterivNV_remap_index }, - { 11003, ResizeBuffersMESA_remap_index }, + { 21769, GetFinalCombinerInputParameterivNV_remap_index }, + { 11042, ResizeBuffersMESA_remap_index }, { 9753, WindowPos2dMESA_remap_index }, { 944, WindowPos2dvMESA_remap_index }, - { 29444, WindowPos2fMESA_remap_index }, + { 29480, WindowPos2fMESA_remap_index }, { 6934, WindowPos2fvMESA_remap_index }, - { 15849, WindowPos2iMESA_remap_index }, - { 17826, WindowPos2ivMESA_remap_index }, - { 18401, WindowPos2sMESA_remap_index }, + { 15892, WindowPos2iMESA_remap_index }, + { 17869, WindowPos2ivMESA_remap_index }, + { 18444, WindowPos2sMESA_remap_index }, { 4885, WindowPos2svMESA_remap_index }, { 6759, WindowPos3dMESA_remap_index }, - { 12228, WindowPos3dvMESA_remap_index }, + { 12271, WindowPos3dvMESA_remap_index }, { 472, WindowPos3fMESA_remap_index }, - { 13009, WindowPos3fvMESA_remap_index }, - { 21021, WindowPos3iMESA_remap_index }, - { 26535, WindowPos3ivMESA_remap_index }, - { 16366, WindowPos3sMESA_remap_index }, - { 27902, WindowPos3svMESA_remap_index }, + { 13052, WindowPos3fvMESA_remap_index }, + { 21064, WindowPos3iMESA_remap_index }, + { 26610, WindowPos3ivMESA_remap_index }, + { 16409, WindowPos3sMESA_remap_index }, + { 27938, WindowPos3svMESA_remap_index }, { 9704, WindowPos4dMESA_remap_index }, - { 14862, WindowPos4dvMESA_remap_index }, - { 12187, WindowPos4fMESA_remap_index }, - { 26940, WindowPos4fvMESA_remap_index }, - { 26688, WindowPos4iMESA_remap_index }, - { 10842, WindowPos4ivMESA_remap_index }, - { 16499, WindowPos4sMESA_remap_index }, + { 14905, WindowPos4dvMESA_remap_index }, + { 12230, WindowPos4fMESA_remap_index }, + { 27015, WindowPos4fvMESA_remap_index }, + { 26763, WindowPos4iMESA_remap_index }, + { 10881, WindowPos4ivMESA_remap_index }, + { 16542, WindowPos4sMESA_remap_index }, { 2857, WindowPos4svMESA_remap_index }, - { 11988, MultiModeDrawArraysIBM_remap_index }, - { 25408, MultiModeDrawElementsIBM_remap_index }, + { 23539, MultiModeDrawArraysIBM_remap_index }, + { 25483, MultiModeDrawElementsIBM_remap_index }, { 10692, DeleteFencesNV_remap_index }, - { 24537, FinishFenceNV_remap_index }, + { 24612, FinishFenceNV_remap_index }, { 3287, GenFencesNV_remap_index }, - { 14842, GetFenceivNV_remap_index }, + { 14885, GetFenceivNV_remap_index }, { 7226, IsFenceNV_remap_index }, - { 11876, SetFenceNV_remap_index }, + { 11951, SetFenceNV_remap_index }, { 3744, TestFenceNV_remap_index }, - { 27873, AreProgramsResidentNV_remap_index }, - { 27228, BindProgramNV_remap_index }, - { 22728, DeleteProgramsNV_remap_index }, - { 18830, ExecuteProgramNV_remap_index }, - { 29337, GenProgramsNV_remap_index }, - { 20429, GetProgramParameterdvNV_remap_index }, + { 27909, AreProgramsResidentNV_remap_index }, + { 27303, BindProgramNV_remap_index }, + { 22771, DeleteProgramsNV_remap_index }, + { 18873, ExecuteProgramNV_remap_index }, + { 29373, GenProgramsNV_remap_index }, + { 20472, GetProgramParameterdvNV_remap_index }, { 9240, GetProgramParameterfvNV_remap_index }, - { 23058, GetProgramStringNV_remap_index }, - { 21415, GetProgramivNV_remap_index }, - { 20663, GetTrackMatrixivNV_remap_index }, - { 22878, GetVertexAttribPointervNV_remap_index }, - { 21659, GetVertexAttribdvNV_remap_index }, - { 16339, GetVertexAttribfvNV_remap_index }, - { 16030, GetVertexAttribivNV_remap_index }, - { 16746, IsProgramNV_remap_index }, + { 23101, GetProgramStringNV_remap_index }, + { 21458, GetProgramivNV_remap_index }, + { 20706, GetTrackMatrixivNV_remap_index }, + { 22921, GetVertexAttribPointervNV_remap_index }, + { 21702, GetVertexAttribdvNV_remap_index }, + { 16382, GetVertexAttribfvNV_remap_index }, + { 16073, GetVertexAttribivNV_remap_index }, + { 16789, IsProgramNV_remap_index }, { 8246, LoadProgramNV_remap_index }, - { 24402, ProgramParameters4dvNV_remap_index }, - { 21345, ProgramParameters4fvNV_remap_index }, - { 18130, RequestResidentProgramsNV_remap_index }, - { 19519, TrackMatrixNV_remap_index }, - { 28430, VertexAttrib1dNV_remap_index }, - { 11817, VertexAttrib1dvNV_remap_index }, - { 24940, VertexAttrib1fNV_remap_index }, + { 24477, ProgramParameters4dvNV_remap_index }, + { 21388, ProgramParameters4fvNV_remap_index }, + { 18173, RequestResidentProgramsNV_remap_index }, + { 19562, TrackMatrixNV_remap_index }, + { 28466, VertexAttrib1dNV_remap_index }, + { 11892, VertexAttrib1dvNV_remap_index }, + { 25015, VertexAttrib1fNV_remap_index }, { 2245, VertexAttrib1fvNV_remap_index }, - { 26997, VertexAttrib1sNV_remap_index }, - { 13082, VertexAttrib1svNV_remap_index }, + { 27072, VertexAttrib1sNV_remap_index }, + { 13125, VertexAttrib1svNV_remap_index }, { 4220, VertexAttrib2dNV_remap_index }, - { 11732, VertexAttrib2dvNV_remap_index }, - { 17585, VertexAttrib2fNV_remap_index }, - { 11379, VertexAttrib2fvNV_remap_index }, + { 11807, VertexAttrib2dvNV_remap_index }, + { 17628, VertexAttrib2fNV_remap_index }, + { 11418, VertexAttrib2fvNV_remap_index }, { 5045, VertexAttrib2sNV_remap_index }, - { 16420, VertexAttrib2svNV_remap_index }, + { 16463, VertexAttrib2svNV_remap_index }, { 9901, VertexAttrib3dNV_remap_index }, - { 28123, VertexAttrib3dvNV_remap_index }, + { 28159, VertexAttrib3dvNV_remap_index }, { 9052, VertexAttrib3fNV_remap_index }, - { 21686, VertexAttrib3fvNV_remap_index }, - { 24915, VertexAttrib3sNV_remap_index }, - { 20690, VertexAttrib3svNV_remap_index }, - { 25382, VertexAttrib4dNV_remap_index }, - { 29374, VertexAttrib4dvNV_remap_index }, + { 21729, VertexAttrib3fvNV_remap_index }, + { 24990, VertexAttrib3sNV_remap_index }, + { 20733, VertexAttrib3svNV_remap_index }, + { 25457, VertexAttrib4dNV_remap_index }, + { 29410, VertexAttrib4dvNV_remap_index }, { 3945, VertexAttrib4fNV_remap_index }, { 8296, VertexAttrib4fvNV_remap_index }, - { 23380, VertexAttrib4sNV_remap_index }, + { 23423, VertexAttrib4sNV_remap_index }, { 1293, VertexAttrib4svNV_remap_index }, { 4378, VertexAttrib4ubNV_remap_index }, { 734, VertexAttrib4ubvNV_remap_index }, - { 19010, VertexAttribPointerNV_remap_index }, + { 19053, VertexAttribPointerNV_remap_index }, { 2097, VertexAttribs1dvNV_remap_index }, - { 16444, VertexAttribs1fvNV_remap_index }, - { 29174, VertexAttribs1svNV_remap_index }, + { 16487, VertexAttribs1fvNV_remap_index }, + { 29210, VertexAttribs1svNV_remap_index }, { 9077, VertexAttribs2dvNV_remap_index }, - { 22248, VertexAttribs2fvNV_remap_index }, - { 15362, VertexAttribs2svNV_remap_index }, + { 22291, VertexAttribs2fvNV_remap_index }, + { 15405, VertexAttribs2svNV_remap_index }, { 4577, VertexAttribs3dvNV_remap_index }, { 1977, VertexAttribs3fvNV_remap_index }, - { 26283, VertexAttribs3svNV_remap_index }, - { 23470, VertexAttribs4dvNV_remap_index }, + { 26358, VertexAttribs3svNV_remap_index }, + { 23513, VertexAttribs4dvNV_remap_index }, { 4603, VertexAttribs4fvNV_remap_index }, - { 28961, VertexAttribs4svNV_remap_index }, - { 26031, VertexAttribs4ubvNV_remap_index }, - { 23540, GetTexBumpParameterfvATI_remap_index }, - { 29215, GetTexBumpParameterivATI_remap_index }, - { 16084, TexBumpParameterfvATI_remap_index }, - { 18001, TexBumpParameterivATI_remap_index }, - { 13628, AlphaFragmentOp1ATI_remap_index }, + { 28997, VertexAttribs4svNV_remap_index }, + { 26106, VertexAttribs4ubvNV_remap_index }, + { 23615, GetTexBumpParameterfvATI_remap_index }, + { 29251, GetTexBumpParameterivATI_remap_index }, + { 16127, TexBumpParameterfvATI_remap_index }, + { 18044, TexBumpParameterivATI_remap_index }, + { 13671, AlphaFragmentOp1ATI_remap_index }, { 9592, AlphaFragmentOp2ATI_remap_index }, - { 21602, AlphaFragmentOp3ATI_remap_index }, - { 26210, BeginFragmentShaderATI_remap_index }, - { 27427, BindFragmentShaderATI_remap_index }, - { 20819, ColorFragmentOp1ATI_remap_index }, + { 21645, AlphaFragmentOp3ATI_remap_index }, + { 26285, BeginFragmentShaderATI_remap_index }, + { 27502, BindFragmentShaderATI_remap_index }, + { 20862, ColorFragmentOp1ATI_remap_index }, { 3823, ColorFragmentOp2ATI_remap_index }, - { 27768, ColorFragmentOp3ATI_remap_index }, + { 27804, ColorFragmentOp3ATI_remap_index }, { 4722, DeleteFragmentShaderATI_remap_index }, - { 29398, EndFragmentShaderATI_remap_index }, - { 28644, GenFragmentShadersATI_remap_index }, - { 22352, PassTexCoordATI_remap_index }, + { 29434, EndFragmentShaderATI_remap_index }, + { 28680, GenFragmentShadersATI_remap_index }, + { 22395, PassTexCoordATI_remap_index }, { 5965, SampleMapATI_remap_index }, { 5738, SetFragmentShaderConstantATI_remap_index }, { 319, PointParameteriNV_remap_index }, - { 12389, PointParameterivNV_remap_index }, - { 25221, ActiveStencilFaceEXT_remap_index }, - { 24062, BindVertexArrayAPPLE_remap_index }, + { 12432, PointParameterivNV_remap_index }, + { 25296, ActiveStencilFaceEXT_remap_index }, + { 24137, BindVertexArrayAPPLE_remap_index }, { 2522, DeleteVertexArraysAPPLE_remap_index }, - { 15701, GenVertexArraysAPPLE_remap_index }, - { 20494, IsVertexArrayAPPLE_remap_index }, + { 15744, GenVertexArraysAPPLE_remap_index }, + { 20537, IsVertexArrayAPPLE_remap_index }, { 775, GetProgramNamedParameterdvNV_remap_index }, { 3128, GetProgramNamedParameterfvNV_remap_index }, - { 23571, ProgramNamedParameter4dNV_remap_index }, - { 12664, ProgramNamedParameter4dvNV_remap_index }, + { 23646, ProgramNamedParameter4dNV_remap_index }, + { 12707, ProgramNamedParameter4dvNV_remap_index }, { 7862, ProgramNamedParameter4fNV_remap_index }, { 10311, ProgramNamedParameter4fvNV_remap_index }, - { 21324, DepthBoundsEXT_remap_index }, + { 21367, DepthBoundsEXT_remap_index }, { 1043, BlendEquationSeparateEXT_remap_index }, - { 12783, BindFramebufferEXT_remap_index }, - { 22539, BindRenderbufferEXT_remap_index }, + { 12826, BindFramebufferEXT_remap_index }, + { 22582, BindRenderbufferEXT_remap_index }, { 8515, CheckFramebufferStatusEXT_remap_index }, - { 19810, DeleteFramebuffersEXT_remap_index }, - { 28025, DeleteRenderbuffersEXT_remap_index }, - { 11756, FramebufferRenderbufferEXT_remap_index }, - { 11893, FramebufferTexture1DEXT_remap_index }, + { 19853, DeleteFramebuffersEXT_remap_index }, + { 28061, DeleteRenderbuffersEXT_remap_index }, + { 11831, FramebufferRenderbufferEXT_remap_index }, + { 11968, FramebufferTexture1DEXT_remap_index }, { 10139, FramebufferTexture2DEXT_remap_index }, { 9806, FramebufferTexture3DEXT_remap_index }, - { 20386, GenFramebuffersEXT_remap_index }, - { 15248, GenRenderbuffersEXT_remap_index }, + { 20429, GenFramebuffersEXT_remap_index }, + { 15291, GenRenderbuffersEXT_remap_index }, { 5684, GenerateMipmapEXT_remap_index }, - { 19041, GetFramebufferAttachmentParameterivEXT_remap_index }, - { 28550, GetRenderbufferParameterivEXT_remap_index }, - { 17881, IsFramebufferEXT_remap_index }, - { 29297, IsRenderbufferEXT_remap_index }, + { 19084, GetFramebufferAttachmentParameterivEXT_remap_index }, + { 28586, GetRenderbufferParameterivEXT_remap_index }, + { 17924, IsFramebufferEXT_remap_index }, + { 29333, IsRenderbufferEXT_remap_index }, { 7173, RenderbufferStorageEXT_remap_index }, { 651, BlitFramebufferEXT_remap_index }, - { 12483, BufferParameteriAPPLE_remap_index }, - { 16778, FlushMappedBufferRangeAPPLE_remap_index }, + { 12526, BufferParameteriAPPLE_remap_index }, + { 16821, FlushMappedBufferRangeAPPLE_remap_index }, { 2701, FramebufferTextureLayerEXT_remap_index }, - { 25932, ProvokingVertexEXT_remap_index }, + { 26007, ProvokingVertexEXT_remap_index }, { 9461, GetTexParameterPointervAPPLE_remap_index }, { 4405, TextureRangeAPPLE_remap_index }, - { 25247, StencilFuncSeparateATI_remap_index }, - { 15768, ProgramEnvParameters4fvEXT_remap_index }, - { 14986, ProgramLocalParameters4fvEXT_remap_index }, - { 12317, GetQueryObjecti64vEXT_remap_index }, + { 25322, StencilFuncSeparateATI_remap_index }, + { 15811, ProgramEnvParameters4fvEXT_remap_index }, + { 15029, ProgramLocalParameters4fvEXT_remap_index }, + { 12360, GetQueryObjecti64vEXT_remap_index }, { 9103, GetQueryObjectui64vEXT_remap_index }, { -1, -1 } }; @@ -4729,8 +4730,8 @@ static const struct gl_function_remap MESA_alt_functions[] = { /* from GL_EXT_blend_minmax */ { 9863, _gloffset_BlendEquation }, /* from GL_EXT_color_subtable */ - { 14884, _gloffset_ColorSubTable }, - { 27957, _gloffset_CopyColorSubTable }, + { 14927, _gloffset_ColorSubTable }, + { 27993, _gloffset_CopyColorSubTable }, /* from GL_EXT_convolution */ { 213, _gloffset_ConvolutionFilter1D }, { 2284, _gloffset_CopyConvolutionFilter1D }, @@ -4738,62 +4739,62 @@ static const struct gl_function_remap MESA_alt_functions[] = { { 7522, _gloffset_ConvolutionFilter2D }, { 7688, _gloffset_ConvolutionParameteriv }, { 8148, _gloffset_ConvolutionParameterfv }, - { 18029, _gloffset_GetSeparableFilter }, - { 21075, _gloffset_SeparableFilter2D }, - { 21904, _gloffset_ConvolutionParameteri }, - { 22027, _gloffset_ConvolutionParameterf }, - { 23406, _gloffset_GetConvolutionParameterfv }, - { 24228, _gloffset_GetConvolutionFilter }, - { 26472, _gloffset_CopyConvolutionFilter2D }, + { 18072, _gloffset_GetSeparableFilter }, + { 21118, _gloffset_SeparableFilter2D }, + { 21947, _gloffset_ConvolutionParameteri }, + { 22070, _gloffset_ConvolutionParameterf }, + { 23449, _gloffset_GetConvolutionParameterfv }, + { 24303, _gloffset_GetConvolutionFilter }, + { 26547, _gloffset_CopyConvolutionFilter2D }, /* from GL_EXT_copy_texture */ - { 13142, _gloffset_CopyTexSubImage3D }, - { 14624, _gloffset_CopyTexImage2D }, - { 21512, _gloffset_CopyTexImage1D }, - { 23909, _gloffset_CopyTexSubImage2D }, - { 26110, _gloffset_CopyTexSubImage1D }, + { 13185, _gloffset_CopyTexSubImage3D }, + { 14667, _gloffset_CopyTexImage2D }, + { 21555, _gloffset_CopyTexImage1D }, + { 23984, _gloffset_CopyTexSubImage2D }, + { 26185, _gloffset_CopyTexSubImage1D }, /* from GL_EXT_draw_range_elements */ { 8402, _gloffset_DrawRangeElements }, /* from GL_EXT_histogram */ { 812, _gloffset_Histogram }, { 3088, _gloffset_ResetHistogram }, { 8774, _gloffset_GetMinmax }, - { 13476, _gloffset_GetHistogramParameterfv }, - { 21437, _gloffset_GetMinmaxParameteriv }, - { 23296, _gloffset_ResetMinmax }, - { 24125, _gloffset_GetHistogramParameteriv }, - { 25181, _gloffset_GetHistogram }, - { 27543, _gloffset_Minmax }, - { 29044, _gloffset_GetMinmaxParameterfv }, + { 13519, _gloffset_GetHistogramParameterfv }, + { 21480, _gloffset_GetMinmaxParameteriv }, + { 23339, _gloffset_ResetMinmax }, + { 24200, _gloffset_GetHistogramParameteriv }, + { 25256, _gloffset_GetHistogram }, + { 27618, _gloffset_Minmax }, + { 29080, _gloffset_GetMinmaxParameterfv }, /* from GL_EXT_paletted_texture */ { 7384, _gloffset_ColorTable }, - { 13322, _gloffset_GetColorTable }, - { 20133, _gloffset_GetColorTableParameterfv }, - { 22083, _gloffset_GetColorTableParameteriv }, + { 13365, _gloffset_GetColorTable }, + { 20176, _gloffset_GetColorTableParameterfv }, + { 22126, _gloffset_GetColorTableParameteriv }, /* from GL_EXT_subtexture */ { 6105, _gloffset_TexSubImage1D }, { 9388, _gloffset_TexSubImage2D }, /* from GL_EXT_texture3D */ { 1658, _gloffset_TexImage3D }, - { 19902, _gloffset_TexSubImage3D }, + { 19945, _gloffset_TexSubImage3D }, /* from GL_EXT_texture_object */ { 2964, _gloffset_PrioritizeTextures }, { 6554, _gloffset_AreTexturesResident }, - { 11841, _gloffset_GenTextures }, - { 13808, _gloffset_DeleteTextures }, - { 17059, _gloffset_IsTexture }, - { 26175, _gloffset_BindTexture }, + { 11916, _gloffset_GenTextures }, + { 13851, _gloffset_DeleteTextures }, + { 17102, _gloffset_IsTexture }, + { 26250, _gloffset_BindTexture }, /* from GL_EXT_vertex_array */ - { 21264, _gloffset_ArrayElement }, - { 27131, _gloffset_GetPointerv }, - { 28671, _gloffset_DrawArrays }, + { 21307, _gloffset_ArrayElement }, + { 27206, _gloffset_GetPointerv }, + { 28707, _gloffset_DrawArrays }, /* from GL_SGI_color_table */ { 6672, _gloffset_ColorTableParameteriv }, { 7384, _gloffset_ColorTable }, - { 13322, _gloffset_GetColorTable }, - { 13432, _gloffset_CopyColorTable }, - { 16920, _gloffset_ColorTableParameterfv }, - { 20133, _gloffset_GetColorTableParameterfv }, - { 22083, _gloffset_GetColorTableParameteriv }, + { 13365, _gloffset_GetColorTable }, + { 13475, _gloffset_CopyColorTable }, + { 16963, _gloffset_ColorTableParameterfv }, + { 20176, _gloffset_GetColorTableParameterfv }, + { 22126, _gloffset_GetColorTableParameteriv }, /* from GL_VERSION_1_3 */ { 381, _gloffset_MultiTexCoord3sARB }, { 613, _gloffset_ActiveTextureARB }, @@ -4806,29 +4807,29 @@ static const struct gl_function_remap MESA_alt_functions[] = { { 9625, _gloffset_MultiTexCoord4sARB }, { 10225, _gloffset_MultiTexCoord2dvARB }, { 10607, _gloffset_MultiTexCoord1svARB }, - { 10864, _gloffset_MultiTexCoord3svARB }, - { 10925, _gloffset_MultiTexCoord4iARB }, - { 11612, _gloffset_MultiTexCoord3iARB }, - { 12346, _gloffset_MultiTexCoord1dARB }, - { 12512, _gloffset_MultiTexCoord3dvARB }, - { 13676, _gloffset_MultiTexCoord3ivARB }, - { 13721, _gloffset_MultiTexCoord2sARB }, - { 14941, _gloffset_MultiTexCoord4ivARB }, - { 16570, _gloffset_ClientActiveTextureARB }, - { 18786, _gloffset_MultiTexCoord2dARB }, - { 19161, _gloffset_MultiTexCoord4dvARB }, - { 19447, _gloffset_MultiTexCoord4fvARB }, - { 20274, _gloffset_MultiTexCoord3fARB }, - { 22584, _gloffset_MultiTexCoord4dARB }, - { 22788, _gloffset_MultiTexCoord1sARB }, - { 22966, _gloffset_MultiTexCoord1dvARB }, - { 23753, _gloffset_MultiTexCoord1ivARB }, - { 23846, _gloffset_MultiTexCoord2ivARB }, - { 24185, _gloffset_MultiTexCoord1iARB }, - { 25456, _gloffset_MultiTexCoord4svARB }, - { 25974, _gloffset_MultiTexCoord1fARB }, - { 26237, _gloffset_MultiTexCoord4fARB }, - { 28505, _gloffset_MultiTexCoord2fvARB }, + { 10903, _gloffset_MultiTexCoord3svARB }, + { 10964, _gloffset_MultiTexCoord4iARB }, + { 11687, _gloffset_MultiTexCoord3iARB }, + { 12389, _gloffset_MultiTexCoord1dARB }, + { 12555, _gloffset_MultiTexCoord3dvARB }, + { 13719, _gloffset_MultiTexCoord3ivARB }, + { 13764, _gloffset_MultiTexCoord2sARB }, + { 14984, _gloffset_MultiTexCoord4ivARB }, + { 16613, _gloffset_ClientActiveTextureARB }, + { 18829, _gloffset_MultiTexCoord2dARB }, + { 19204, _gloffset_MultiTexCoord4dvARB }, + { 19490, _gloffset_MultiTexCoord4fvARB }, + { 20317, _gloffset_MultiTexCoord3fARB }, + { 22627, _gloffset_MultiTexCoord4dARB }, + { 22831, _gloffset_MultiTexCoord1sARB }, + { 23009, _gloffset_MultiTexCoord1dvARB }, + { 23828, _gloffset_MultiTexCoord1ivARB }, + { 23921, _gloffset_MultiTexCoord2ivARB }, + { 24260, _gloffset_MultiTexCoord1iARB }, + { 25531, _gloffset_MultiTexCoord4svARB }, + { 26049, _gloffset_MultiTexCoord1fARB }, + { 26312, _gloffset_MultiTexCoord4fARB }, + { 28541, _gloffset_MultiTexCoord2fvARB }, { -1, -1 } }; @@ -4900,10 +4901,10 @@ static const struct gl_function_remap GL_ARB_map_buffer_range_functions[] = { #if defined(need_GL_ARB_matrix_palette) static const struct gl_function_remap GL_ARB_matrix_palette_functions[] = { { 3339, -1 }, /* MatrixIndexusvARB */ - { 11469, -1 }, /* MatrixIndexuivARB */ - { 12634, -1 }, /* MatrixIndexPointerARB */ - { 17308, -1 }, /* CurrentPaletteMatrixARB */ - { 20018, -1 }, /* MatrixIndexubvARB */ + { 11508, -1 }, /* MatrixIndexuivARB */ + { 12677, -1 }, /* MatrixIndexPointerARB */ + { 17351, -1 }, /* CurrentPaletteMatrixARB */ + { 20061, -1 }, /* MatrixIndexubvARB */ { -1, -1 } }; #endif @@ -4976,13 +4977,13 @@ static const struct gl_function_remap GL_ARB_vertex_blend_functions[] = { { 2226, -1 }, /* WeightubvARB */ { 5572, -1 }, /* WeightivARB */ { 9728, -1 }, /* WeightPointerARB */ - { 12103, -1 }, /* WeightfvARB */ - { 15388, -1 }, /* WeightbvARB */ - { 18454, -1 }, /* WeightusvARB */ - { 21001, -1 }, /* VertexBlendARB */ - { 26058, -1 }, /* WeightsvARB */ - { 28007, -1 }, /* WeightdvARB */ - { 28705, -1 }, /* WeightuivARB */ + { 12146, -1 }, /* WeightfvARB */ + { 15431, -1 }, /* WeightbvARB */ + { 18497, -1 }, /* WeightusvARB */ + { 21044, -1 }, /* VertexBlendARB */ + { 26133, -1 }, /* WeightsvARB */ + { 28043, -1 }, /* WeightdvARB */ + { 28741, -1 }, /* WeightuivARB */ { -1, -1 } }; #endif @@ -5080,8 +5081,8 @@ static const struct gl_function_remap GL_EXT_blend_minmax_functions[] = { #if defined(need_GL_EXT_color_subtable) static const struct gl_function_remap GL_EXT_color_subtable_functions[] = { - { 14884, _gloffset_ColorSubTable }, - { 27957, _gloffset_CopyColorSubTable }, + { 14927, _gloffset_ColorSubTable }, + { 27993, _gloffset_CopyColorSubTable }, { -1, -1 } }; #endif @@ -5101,13 +5102,13 @@ static const struct gl_function_remap GL_EXT_convolution_functions[] = { { 7522, _gloffset_ConvolutionFilter2D }, { 7688, _gloffset_ConvolutionParameteriv }, { 8148, _gloffset_ConvolutionParameterfv }, - { 18029, _gloffset_GetSeparableFilter }, - { 21075, _gloffset_SeparableFilter2D }, - { 21904, _gloffset_ConvolutionParameteri }, - { 22027, _gloffset_ConvolutionParameterf }, - { 23406, _gloffset_GetConvolutionParameterfv }, - { 24228, _gloffset_GetConvolutionFilter }, - { 26472, _gloffset_CopyConvolutionFilter2D }, + { 18072, _gloffset_GetSeparableFilter }, + { 21118, _gloffset_SeparableFilter2D }, + { 21947, _gloffset_ConvolutionParameteri }, + { 22070, _gloffset_ConvolutionParameterf }, + { 23449, _gloffset_GetConvolutionParameterfv }, + { 24303, _gloffset_GetConvolutionFilter }, + { 26547, _gloffset_CopyConvolutionFilter2D }, { -1, -1 } }; #endif @@ -5115,38 +5116,38 @@ static const struct gl_function_remap GL_EXT_convolution_functions[] = { #if defined(need_GL_EXT_coordinate_frame) static const struct gl_function_remap GL_EXT_coordinate_frame_functions[] = { { 9272, -1 }, /* TangentPointerEXT */ - { 10983, -1 }, /* Binormal3ivEXT */ - { 11565, -1 }, /* Tangent3sEXT */ - { 12699, -1 }, /* Tangent3fvEXT */ - { 16320, -1 }, /* Tangent3dvEXT */ - { 17006, -1 }, /* Binormal3bvEXT */ - { 18082, -1 }, /* Binormal3dEXT */ - { 19950, -1 }, /* Tangent3fEXT */ - { 21976, -1 }, /* Binormal3sEXT */ - { 22394, -1 }, /* Tangent3ivEXT */ - { 22413, -1 }, /* Tangent3dEXT */ - { 23193, -1 }, /* Binormal3svEXT */ - { 23651, -1 }, /* Binormal3fEXT */ - { 24503, -1 }, /* Binormal3dvEXT */ - { 25678, -1 }, /* Tangent3iEXT */ - { 26757, -1 }, /* Tangent3bvEXT */ - { 27166, -1 }, /* Tangent3bEXT */ - { 27730, -1 }, /* Binormal3fvEXT */ - { 28404, -1 }, /* BinormalPointerEXT */ - { 28809, -1 }, /* Tangent3svEXT */ - { 29246, -1 }, /* Binormal3bEXT */ - { 29423, -1 }, /* Binormal3iEXT */ + { 11022, -1 }, /* Binormal3ivEXT */ + { 11640, -1 }, /* Tangent3sEXT */ + { 12742, -1 }, /* Tangent3fvEXT */ + { 16363, -1 }, /* Tangent3dvEXT */ + { 17049, -1 }, /* Binormal3bvEXT */ + { 18125, -1 }, /* Binormal3dEXT */ + { 19993, -1 }, /* Tangent3fEXT */ + { 22019, -1 }, /* Binormal3sEXT */ + { 22437, -1 }, /* Tangent3ivEXT */ + { 22456, -1 }, /* Tangent3dEXT */ + { 23236, -1 }, /* Binormal3svEXT */ + { 23726, -1 }, /* Binormal3fEXT */ + { 24578, -1 }, /* Binormal3dvEXT */ + { 25753, -1 }, /* Tangent3iEXT */ + { 26832, -1 }, /* Tangent3bvEXT */ + { 27241, -1 }, /* Tangent3bEXT */ + { 27766, -1 }, /* Binormal3fvEXT */ + { 28440, -1 }, /* BinormalPointerEXT */ + { 28845, -1 }, /* Tangent3svEXT */ + { 29282, -1 }, /* Binormal3bEXT */ + { 29459, -1 }, /* Binormal3iEXT */ { -1, -1 } }; #endif #if defined(need_GL_EXT_copy_texture) static const struct gl_function_remap GL_EXT_copy_texture_functions[] = { - { 13142, _gloffset_CopyTexSubImage3D }, - { 14624, _gloffset_CopyTexImage2D }, - { 21512, _gloffset_CopyTexImage1D }, - { 23909, _gloffset_CopyTexSubImage2D }, - { 26110, _gloffset_CopyTexSubImage1D }, + { 13185, _gloffset_CopyTexSubImage3D }, + { 14667, _gloffset_CopyTexImage2D }, + { 21555, _gloffset_CopyTexImage1D }, + { 23984, _gloffset_CopyTexSubImage2D }, + { 26185, _gloffset_CopyTexSubImage1D }, { -1, -1 } }; #endif @@ -5186,6 +5187,13 @@ static const struct gl_function_remap GL_EXT_framebuffer_blit_functions[] = { }; #endif +#if defined(need_GL_EXT_framebuffer_multisample) +/* functions defined in MESA_remap_table_functions are excluded */ +static const struct gl_function_remap GL_EXT_framebuffer_multisample_functions[] = { + { -1, -1 } +}; +#endif + #if defined(need_GL_EXT_framebuffer_object) /* functions defined in MESA_remap_table_functions are excluded */ static const struct gl_function_remap GL_EXT_framebuffer_object_functions[] = { @@ -5205,13 +5213,13 @@ static const struct gl_function_remap GL_EXT_histogram_functions[] = { { 812, _gloffset_Histogram }, { 3088, _gloffset_ResetHistogram }, { 8774, _gloffset_GetMinmax }, - { 13476, _gloffset_GetHistogramParameterfv }, - { 21437, _gloffset_GetMinmaxParameteriv }, - { 23296, _gloffset_ResetMinmax }, - { 24125, _gloffset_GetHistogramParameteriv }, - { 25181, _gloffset_GetHistogram }, - { 27543, _gloffset_Minmax }, - { 29044, _gloffset_GetMinmaxParameterfv }, + { 13519, _gloffset_GetHistogramParameterfv }, + { 21480, _gloffset_GetMinmaxParameteriv }, + { 23339, _gloffset_ResetMinmax }, + { 24200, _gloffset_GetHistogramParameteriv }, + { 25256, _gloffset_GetHistogram }, + { 27618, _gloffset_Minmax }, + { 29080, _gloffset_GetMinmaxParameterfv }, { -1, -1 } }; #endif @@ -5225,16 +5233,16 @@ static const struct gl_function_remap GL_EXT_index_func_functions[] = { #if defined(need_GL_EXT_index_material) static const struct gl_function_remap GL_EXT_index_material_functions[] = { - { 18541, -1 }, /* IndexMaterialEXT */ + { 18584, -1 }, /* IndexMaterialEXT */ { -1, -1 } }; #endif #if defined(need_GL_EXT_light_texture) static const struct gl_function_remap GL_EXT_light_texture_functions[] = { - { 23213, -1 }, /* ApplyTextureEXT */ - { 23250, -1 }, /* TextureMaterialEXT */ - { 23275, -1 }, /* TextureLightEXT */ + { 23256, -1 }, /* ApplyTextureEXT */ + { 23293, -1 }, /* TextureMaterialEXT */ + { 23318, -1 }, /* TextureLightEXT */ { -1, -1 } }; #endif @@ -5256,9 +5264,9 @@ static const struct gl_function_remap GL_EXT_multisample_functions[] = { #if defined(need_GL_EXT_paletted_texture) static const struct gl_function_remap GL_EXT_paletted_texture_functions[] = { { 7384, _gloffset_ColorTable }, - { 13322, _gloffset_GetColorTable }, - { 20133, _gloffset_GetColorTableParameterfv }, - { 22083, _gloffset_GetColorTableParameteriv }, + { 13365, _gloffset_GetColorTable }, + { 20176, _gloffset_GetColorTableParameterfv }, + { 22126, _gloffset_GetColorTableParameteriv }, { -1, -1 } }; #endif @@ -5266,9 +5274,9 @@ static const struct gl_function_remap GL_EXT_paletted_texture_functions[] = { #if defined(need_GL_EXT_pixel_transform) static const struct gl_function_remap GL_EXT_pixel_transform_functions[] = { { 9513, -1 }, /* PixelTransformParameterfvEXT */ - { 19126, -1 }, /* PixelTransformParameterfEXT */ - { 19206, -1 }, /* PixelTransformParameteriEXT */ - { 28368, -1 }, /* PixelTransformParameterivEXT */ + { 19169, -1 }, /* PixelTransformParameterfEXT */ + { 19249, -1 }, /* PixelTransformParameteriEXT */ + { 28404, -1 }, /* PixelTransformParameterivEXT */ { -1, -1 } }; #endif @@ -5319,7 +5327,7 @@ static const struct gl_function_remap GL_EXT_subtexture_functions[] = { #if defined(need_GL_EXT_texture3D) static const struct gl_function_remap GL_EXT_texture3D_functions[] = { { 1658, _gloffset_TexImage3D }, - { 19902, _gloffset_TexSubImage3D }, + { 19945, _gloffset_TexSubImage3D }, { -1, -1 } }; #endif @@ -5335,17 +5343,17 @@ static const struct gl_function_remap GL_EXT_texture_array_functions[] = { static const struct gl_function_remap GL_EXT_texture_object_functions[] = { { 2964, _gloffset_PrioritizeTextures }, { 6554, _gloffset_AreTexturesResident }, - { 11841, _gloffset_GenTextures }, - { 13808, _gloffset_DeleteTextures }, - { 17059, _gloffset_IsTexture }, - { 26175, _gloffset_BindTexture }, + { 11916, _gloffset_GenTextures }, + { 13851, _gloffset_DeleteTextures }, + { 17102, _gloffset_IsTexture }, + { 26250, _gloffset_BindTexture }, { -1, -1 } }; #endif #if defined(need_GL_EXT_texture_perturb_normal) static const struct gl_function_remap GL_EXT_texture_perturb_normal_functions[] = { - { 12053, -1 }, /* TextureNormalEXT */ + { 12096, -1 }, /* TextureNormalEXT */ { -1, -1 } }; #endif @@ -5360,18 +5368,18 @@ static const struct gl_function_remap GL_EXT_timer_query_functions[] = { #if defined(need_GL_EXT_vertex_array) /* functions defined in MESA_remap_table_functions are excluded */ static const struct gl_function_remap GL_EXT_vertex_array_functions[] = { - { 21264, _gloffset_ArrayElement }, - { 27131, _gloffset_GetPointerv }, - { 28671, _gloffset_DrawArrays }, + { 21307, _gloffset_ArrayElement }, + { 27206, _gloffset_GetPointerv }, + { 28707, _gloffset_DrawArrays }, { -1, -1 } }; #endif #if defined(need_GL_EXT_vertex_weighting) static const struct gl_function_remap GL_EXT_vertex_weighting_functions[] = { - { 17089, -1 }, /* VertexWeightfvEXT */ - { 23629, -1 }, /* VertexWeightfEXT */ - { 25150, -1 }, /* VertexWeightPointerEXT */ + { 17132, -1 }, /* VertexWeightfvEXT */ + { 23704, -1 }, /* VertexWeightfEXT */ + { 25225, -1 }, /* VertexWeightPointerEXT */ { -1, -1 } }; #endif @@ -5382,8 +5390,8 @@ static const struct gl_function_remap GL_HP_image_transform_functions[] = { { 3305, -1 }, /* ImageTransformParameterfHP */ { 8966, -1 }, /* ImageTransformParameterfvHP */ { 10525, -1 }, /* ImageTransformParameteriHP */ - { 10754, -1 }, /* GetImageTransformParameterivHP */ - { 17153, -1 }, /* ImageTransformParameterivHP */ + { 10793, -1 }, /* GetImageTransformParameterivHP */ + { 17196, -1 }, /* ImageTransformParameterivHP */ { -1, -1 } }; #endif @@ -5402,9 +5410,9 @@ static const struct gl_function_remap GL_IBM_vertex_array_lists_functions[] = { { 6728, -1 }, /* FogCoordPointerListIBM */ { 7035, -1 }, /* VertexPointerListIBM */ { 10446, -1 }, /* ColorPointerListIBM */ - { 11672, -1 }, /* TexCoordPointerListIBM */ - { 12075, -1 }, /* IndexPointerListIBM */ - { 28987, -1 }, /* EdgeFlagPointerListIBM */ + { 11747, -1 }, /* TexCoordPointerListIBM */ + { 12118, -1 }, /* IndexPointerListIBM */ + { 29023, -1 }, /* EdgeFlagPointerListIBM */ { -1, -1 } }; #endif @@ -5418,10 +5426,10 @@ static const struct gl_function_remap GL_INGR_blend_func_separate_functions[] = #if defined(need_GL_INTEL_parallel_arrays) static const struct gl_function_remap GL_INTEL_parallel_arrays_functions[] = { - { 11095, -1 }, /* VertexPointervINTEL */ - { 13569, -1 }, /* ColorPointervINTEL */ - { 26446, -1 }, /* NormalPointervINTEL */ - { 26872, -1 }, /* TexCoordPointervINTEL */ + { 11134, -1 }, /* VertexPointervINTEL */ + { 13612, -1 }, /* ColorPointervINTEL */ + { 26521, -1 }, /* NormalPointervINTEL */ + { 26947, -1 }, /* TexCoordPointervINTEL */ { -1, -1 } }; #endif @@ -5438,7 +5446,7 @@ static const struct gl_function_remap GL_MESA_shader_debug_functions[] = { { 1522, -1 }, /* GetDebugLogLengthMESA */ { 3063, -1 }, /* ClearDebugLogMESA */ { 4018, -1 }, /* GetDebugLogMESA */ - { 27324, -1 }, /* CreateDebugObjectMESA */ + { 27399, -1 }, /* CreateDebugObjectMESA */ { -1, -1 } }; #endif @@ -5456,11 +5464,11 @@ static const struct gl_function_remap GL_NV_evaluators_functions[] = { { 7490, -1 }, /* MapControlPointsNV */ { 7589, -1 }, /* MapParameterfvNV */ { 9371, -1 }, /* EvalMapsNV */ - { 15058, -1 }, /* GetMapAttribParameterfvNV */ - { 15224, -1 }, /* MapParameterivNV */ - { 21827, -1 }, /* GetMapParameterivNV */ - { 22325, -1 }, /* GetMapParameterfvNV */ - { 25782, -1 }, /* GetMapControlPointsNV */ + { 15101, -1 }, /* GetMapAttribParameterfvNV */ + { 15267, -1 }, /* MapParameterivNV */ + { 21870, -1 }, /* GetMapParameterivNV */ + { 22368, -1 }, /* GetMapParameterfvNV */ + { 25857, -1 }, /* GetMapControlPointsNV */ { -1, -1 } }; #endif @@ -5495,8 +5503,8 @@ static const struct gl_function_remap GL_NV_register_combiners_functions[] = { #if defined(need_GL_NV_register_combiners2) static const struct gl_function_remap GL_NV_register_combiners2_functions[] = { - { 13961, -1 }, /* CombinerStageParameterfvNV */ - { 14276, -1 }, /* GetCombinerStageParameterfvNV */ + { 14004, -1 }, /* CombinerStageParameterfvNV */ + { 14319, -1 }, /* GetCombinerStageParameterfvNV */ { -1, -1 } }; #endif @@ -5524,16 +5532,16 @@ static const struct gl_function_remap GL_PGI_misc_hints_functions[] = { #if defined(need_GL_SGIS_detail_texture) static const struct gl_function_remap GL_SGIS_detail_texture_functions[] = { - { 14249, -1 }, /* GetDetailTexFuncSGIS */ - { 14569, -1 }, /* DetailTexFuncSGIS */ + { 14292, -1 }, /* GetDetailTexFuncSGIS */ + { 14612, -1 }, /* DetailTexFuncSGIS */ { -1, -1 } }; #endif #if defined(need_GL_SGIS_fog_function) static const struct gl_function_remap GL_SGIS_fog_function_functions[] = { - { 23891, -1 }, /* FogFuncSGIS */ - { 24556, -1 }, /* GetFogFuncSGIS */ + { 23966, -1 }, /* FogFuncSGIS */ + { 24631, -1 }, /* GetFogFuncSGIS */ { -1, -1 } }; #endif @@ -5562,7 +5570,7 @@ static const struct gl_function_remap GL_SGIS_point_parameters_functions[] = { #if defined(need_GL_SGIS_sharpen_texture) static const struct gl_function_remap GL_SGIS_sharpen_texture_functions[] = { { 5834, -1 }, /* GetSharpenTexFuncSGIS */ - { 19421, -1 }, /* SharpenTexFuncSGIS */ + { 19464, -1 }, /* SharpenTexFuncSGIS */ { -1, -1 } }; #endif @@ -5570,14 +5578,14 @@ static const struct gl_function_remap GL_SGIS_sharpen_texture_functions[] = { #if defined(need_GL_SGIS_texture4D) static const struct gl_function_remap GL_SGIS_texture4D_functions[] = { { 894, -1 }, /* TexImage4DSGIS */ - { 13877, -1 }, /* TexSubImage4DSGIS */ + { 13920, -1 }, /* TexSubImage4DSGIS */ { -1, -1 } }; #endif #if defined(need_GL_SGIS_texture_color_mask) static const struct gl_function_remap GL_SGIS_texture_color_mask_functions[] = { - { 13275, -1 }, /* TextureColorMaskSGIS */ + { 13318, -1 }, /* TextureColorMaskSGIS */ { -1, -1 } }; #endif @@ -5585,7 +5593,7 @@ static const struct gl_function_remap GL_SGIS_texture_color_mask_functions[] = { #if defined(need_GL_SGIS_texture_filter4) static const struct gl_function_remap GL_SGIS_texture_filter4_functions[] = { { 6011, -1 }, /* GetTexFilterFuncSGIS */ - { 14395, -1 }, /* TexFilterFuncSGIS */ + { 14438, -1 }, /* TexFilterFuncSGIS */ { -1, -1 } }; #endif @@ -5595,9 +5603,9 @@ static const struct gl_function_remap GL_SGIX_async_functions[] = { { 3014, -1 }, /* AsyncMarkerSGIX */ { 3997, -1 }, /* FinishAsyncSGIX */ { 4703, -1 }, /* PollAsyncSGIX */ - { 19568, -1 }, /* DeleteAsyncMarkersSGIX */ - { 19597, -1 }, /* IsAsyncMarkerSGIX */ - { 28784, -1 }, /* GenAsyncMarkersSGIX */ + { 19611, -1 }, /* DeleteAsyncMarkersSGIX */ + { 19640, -1 }, /* IsAsyncMarkerSGIX */ + { 28820, -1 }, /* GenAsyncMarkersSGIX */ { -1, -1 } }; #endif @@ -5620,29 +5628,29 @@ static const struct gl_function_remap GL_SGIX_fragment_lighting_functions[] = { { 8100, -1 }, /* FragmentLightModeliSGIX */ { 9434, -1 }, /* FragmentLightivSGIX */ { 9671, -1 }, /* GetFragmentMaterialivSGIX */ - { 16976, -1 }, /* FragmentLightModelfSGIX */ - { 17276, -1 }, /* FragmentColorMaterialSGIX */ - { 17648, -1 }, /* FragmentMaterialiSGIX */ - { 18869, -1 }, /* LightEnviSGIX */ - { 20225, -1 }, /* FragmentLightModelfvSGIX */ - { 20534, -1 }, /* FragmentLightfvSGIX */ - { 25032, -1 }, /* FragmentLightfSGIX */ - { 27700, -1 }, /* GetFragmentLightfvSGIX */ - { 29267, -1 }, /* FragmentMaterialivSGIX */ + { 17019, -1 }, /* FragmentLightModelfSGIX */ + { 17319, -1 }, /* FragmentColorMaterialSGIX */ + { 17691, -1 }, /* FragmentMaterialiSGIX */ + { 18912, -1 }, /* LightEnviSGIX */ + { 20268, -1 }, /* FragmentLightModelfvSGIX */ + { 20577, -1 }, /* FragmentLightfvSGIX */ + { 25107, -1 }, /* FragmentLightfSGIX */ + { 27736, -1 }, /* GetFragmentLightfvSGIX */ + { 29303, -1 }, /* FragmentMaterialivSGIX */ { -1, -1 } }; #endif #if defined(need_GL_SGIX_framezoom) static const struct gl_function_remap GL_SGIX_framezoom_functions[] = { - { 19620, -1 }, /* FrameZoomSGIX */ + { 19663, -1 }, /* FrameZoomSGIX */ { -1, -1 } }; #endif #if defined(need_GL_SGIX_igloo_interface) static const struct gl_function_remap GL_SGIX_igloo_interface_functions[] = { - { 25340, -1 }, /* IglooInterfaceSGIX */ + { 25415, -1 }, /* IglooInterfaceSGIX */ { -1, -1 } }; #endif @@ -5652,9 +5660,9 @@ static const struct gl_function_remap GL_SGIX_instruments_functions[] = { { 2573, -1 }, /* ReadInstrumentsSGIX */ { 5590, -1 }, /* PollInstrumentsSGIX */ { 9332, -1 }, /* GetInstrumentsSGIX */ - { 11306, -1 }, /* StartInstrumentsSGIX */ - { 13995, -1 }, /* StopInstrumentsSGIX */ - { 15601, -1 }, /* InstrumentsBufferSGIX */ + { 11345, -1 }, /* StartInstrumentsSGIX */ + { 14038, -1 }, /* StopInstrumentsSGIX */ + { 15644, -1 }, /* InstrumentsBufferSGIX */ { -1, -1 } }; #endif @@ -5663,10 +5671,10 @@ static const struct gl_function_remap GL_SGIX_instruments_functions[] = { static const struct gl_function_remap GL_SGIX_list_priority_functions[] = { { 1125, -1 }, /* ListParameterfSGIX */ { 2763, -1 }, /* GetListParameterfvSGIX */ - { 15516, -1 }, /* ListParameteriSGIX */ - { 16270, -1 }, /* ListParameterfvSGIX */ - { 18275, -1 }, /* ListParameterivSGIX */ - { 28828, -1 }, /* GetListParameterivSGIX */ + { 15559, -1 }, /* ListParameteriSGIX */ + { 16313, -1 }, /* ListParameterfvSGIX */ + { 18318, -1 }, /* ListParameterivSGIX */ + { 28864, -1 }, /* GetListParameterivSGIX */ { -1, -1 } }; #endif @@ -5681,16 +5689,16 @@ static const struct gl_function_remap GL_SGIX_pixel_texture_functions[] = { #if defined(need_GL_SGIX_polynomial_ffd) static const struct gl_function_remap GL_SGIX_polynomial_ffd_functions[] = { { 3251, -1 }, /* LoadIdentityDeformationMapSGIX */ - { 14095, -1 }, /* DeformSGIX */ - { 21376, -1 }, /* DeformationMap3fSGIX */ - { 27588, -1 }, /* DeformationMap3dSGIX */ + { 10713, -1 }, /* DeformationMap3dSGIX */ + { 14138, -1 }, /* DeformSGIX */ + { 21419, -1 }, /* DeformationMap3fSGIX */ { -1, -1 } }; #endif #if defined(need_GL_SGIX_reference_plane) static const struct gl_function_remap GL_SGIX_reference_plane_functions[] = { - { 12826, -1 }, /* ReferencePlaneSGIX */ + { 12869, -1 }, /* ReferencePlaneSGIX */ { -1, -1 } }; #endif @@ -5698,16 +5706,16 @@ static const struct gl_function_remap GL_SGIX_reference_plane_functions[] = { #if defined(need_GL_SGIX_sprite) static const struct gl_function_remap GL_SGIX_sprite_functions[] = { { 8487, -1 }, /* SpriteParameterfvSGIX */ - { 18103, -1 }, /* SpriteParameteriSGIX */ - { 23330, -1 }, /* SpriteParameterfSGIX */ - { 25904, -1 }, /* SpriteParameterivSGIX */ + { 18146, -1 }, /* SpriteParameteriSGIX */ + { 23373, -1 }, /* SpriteParameterfSGIX */ + { 25979, -1 }, /* SpriteParameterivSGIX */ { -1, -1 } }; #endif #if defined(need_GL_SGIX_tag_sample_buffer) static const struct gl_function_remap GL_SGIX_tag_sample_buffer_functions[] = { - { 18162, -1 }, /* TagSampleBufferSGIX */ + { 18205, -1 }, /* TagSampleBufferSGIX */ { -1, -1 } }; #endif @@ -5716,18 +5724,18 @@ static const struct gl_function_remap GL_SGIX_tag_sample_buffer_functions[] = { static const struct gl_function_remap GL_SGI_color_table_functions[] = { { 6672, _gloffset_ColorTableParameteriv }, { 7384, _gloffset_ColorTable }, - { 13322, _gloffset_GetColorTable }, - { 13432, _gloffset_CopyColorTable }, - { 16920, _gloffset_ColorTableParameterfv }, - { 20133, _gloffset_GetColorTableParameterfv }, - { 22083, _gloffset_GetColorTableParameteriv }, + { 13365, _gloffset_GetColorTable }, + { 13475, _gloffset_CopyColorTable }, + { 16963, _gloffset_ColorTableParameterfv }, + { 20176, _gloffset_GetColorTableParameterfv }, + { 22126, _gloffset_GetColorTableParameteriv }, { -1, -1 } }; #endif #if defined(need_GL_SUNX_constant_data) static const struct gl_function_remap GL_SUNX_constant_data_functions[] = { - { 27678, -1 }, /* FinishTextureSUNX */ + { 27714, -1 }, /* FinishTextureSUNX */ { -1, -1 } }; #endif @@ -5739,16 +5747,16 @@ static const struct gl_function_remap GL_SUN_global_alpha_functions[] = { { 5615, -1 }, /* GlobalAlphaFactordSUN */ { 8571, -1 }, /* GlobalAlphaFactoruiSUN */ { 8923, -1 }, /* GlobalAlphaFactorbSUN */ - { 11585, -1 }, /* GlobalAlphaFactorfSUN */ - { 11704, -1 }, /* GlobalAlphaFactorusSUN */ - { 19859, -1 }, /* GlobalAlphaFactorsSUN */ + { 11660, -1 }, /* GlobalAlphaFactorfSUN */ + { 11779, -1 }, /* GlobalAlphaFactorusSUN */ + { 19902, -1 }, /* GlobalAlphaFactorsSUN */ { -1, -1 } }; #endif #if defined(need_GL_SUN_mesh_array) static const struct gl_function_remap GL_SUN_mesh_array_functions[] = { - { 25716, -1 }, /* DrawMeshArraysSUN */ + { 25791, -1 }, /* DrawMeshArraysSUN */ { -1, -1 } }; #endif @@ -5757,11 +5765,11 @@ static const struct gl_function_remap GL_SUN_mesh_array_functions[] = { static const struct gl_function_remap GL_SUN_triangle_list_functions[] = { { 3971, -1 }, /* ReplacementCodeubSUN */ { 5454, -1 }, /* ReplacementCodeubvSUN */ - { 16641, -1 }, /* ReplacementCodeusvSUN */ - { 16829, -1 }, /* ReplacementCodePointerSUN */ - { 18186, -1 }, /* ReplacementCodeusSUN */ - { 18933, -1 }, /* ReplacementCodeuiSUN */ - { 26361, -1 }, /* ReplacementCodeuivSUN */ + { 16684, -1 }, /* ReplacementCodeusvSUN */ + { 16872, -1 }, /* ReplacementCodePointerSUN */ + { 18229, -1 }, /* ReplacementCodeusSUN */ + { 18976, -1 }, /* ReplacementCodeuiSUN */ + { 26436, -1 }, /* ReplacementCodeuivSUN */ { -1, -1 } }; #endif @@ -5786,28 +5794,28 @@ static const struct gl_function_remap GL_SUN_vertex_functions[] = { { 8882, -1 }, /* Color3fVertex3fvSUN */ { 9297, -1 }, /* Color4fNormal3fVertex3fvSUN */ { 9969, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN */ - { 11169, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fvSUN */ - { 12557, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN */ - { 12968, -1 }, /* TexCoord2fColor3fVertex3fSUN */ - { 14020, -1 }, /* TexCoord4fColor4fNormal3fVertex4fSUN */ - { 14354, -1 }, /* Color4ubVertex2fvSUN */ - { 14594, -1 }, /* Normal3fVertex3fSUN */ - { 15542, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fSUN */ - { 15803, -1 }, /* TexCoord2fColor4fNormal3fVertex3fvSUN */ - { 16470, -1 }, /* TexCoord2fVertex3fvSUN */ - { 17246, -1 }, /* Color4ubVertex2fSUN */ - { 17439, -1 }, /* ReplacementCodeuiColor4ubVertex3fSUN */ - { 19292, -1 }, /* TexCoord2fColor4ubVertex3fSUN */ - { 19639, -1 }, /* Normal3fVertex3fvSUN */ - { 20042, -1 }, /* Color4fNormal3fVertex3fSUN */ - { 20908, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN */ - { 21128, -1 }, /* ReplacementCodeuiColor4ubVertex3fvSUN */ - { 22831, -1 }, /* ReplacementCodeuiColor3fVertex3fSUN */ - { 24007, -1 }, /* TexCoord4fVertex4fSUN */ - { 24433, -1 }, /* TexCoord2fColor3fVertex3fvSUN */ - { 24759, -1 }, /* ReplacementCodeuiNormal3fVertex3fvSUN */ - { 24886, -1 }, /* TexCoord4fVertex4fvSUN */ - { 25588, -1 }, /* ReplacementCodeuiVertex3fSUN */ + { 11208, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fvSUN */ + { 12600, -1 }, /* ReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN */ + { 13011, -1 }, /* TexCoord2fColor3fVertex3fSUN */ + { 14063, -1 }, /* TexCoord4fColor4fNormal3fVertex4fSUN */ + { 14397, -1 }, /* Color4ubVertex2fvSUN */ + { 14637, -1 }, /* Normal3fVertex3fSUN */ + { 15585, -1 }, /* ReplacementCodeuiColor4fNormal3fVertex3fSUN */ + { 15846, -1 }, /* TexCoord2fColor4fNormal3fVertex3fvSUN */ + { 16513, -1 }, /* TexCoord2fVertex3fvSUN */ + { 17289, -1 }, /* Color4ubVertex2fSUN */ + { 17482, -1 }, /* ReplacementCodeuiColor4ubVertex3fSUN */ + { 19335, -1 }, /* TexCoord2fColor4ubVertex3fSUN */ + { 19682, -1 }, /* Normal3fVertex3fvSUN */ + { 20085, -1 }, /* Color4fNormal3fVertex3fSUN */ + { 20951, -1 }, /* ReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN */ + { 21171, -1 }, /* ReplacementCodeuiColor4ubVertex3fvSUN */ + { 22874, -1 }, /* ReplacementCodeuiColor3fVertex3fSUN */ + { 24082, -1 }, /* TexCoord4fVertex4fSUN */ + { 24508, -1 }, /* TexCoord2fColor3fVertex3fvSUN */ + { 24834, -1 }, /* ReplacementCodeuiNormal3fVertex3fvSUN */ + { 24961, -1 }, /* TexCoord4fVertex4fvSUN */ + { 25663, -1 }, /* ReplacementCodeuiVertex3fSUN */ { -1, -1 } }; #endif @@ -5826,29 +5834,29 @@ static const struct gl_function_remap GL_VERSION_1_3_functions[] = { { 9625, _gloffset_MultiTexCoord4sARB }, { 10225, _gloffset_MultiTexCoord2dvARB }, { 10607, _gloffset_MultiTexCoord1svARB }, - { 10864, _gloffset_MultiTexCoord3svARB }, - { 10925, _gloffset_MultiTexCoord4iARB }, - { 11612, _gloffset_MultiTexCoord3iARB }, - { 12346, _gloffset_MultiTexCoord1dARB }, - { 12512, _gloffset_MultiTexCoord3dvARB }, - { 13676, _gloffset_MultiTexCoord3ivARB }, - { 13721, _gloffset_MultiTexCoord2sARB }, - { 14941, _gloffset_MultiTexCoord4ivARB }, - { 16570, _gloffset_ClientActiveTextureARB }, - { 18786, _gloffset_MultiTexCoord2dARB }, - { 19161, _gloffset_MultiTexCoord4dvARB }, - { 19447, _gloffset_MultiTexCoord4fvARB }, - { 20274, _gloffset_MultiTexCoord3fARB }, - { 22584, _gloffset_MultiTexCoord4dARB }, - { 22788, _gloffset_MultiTexCoord1sARB }, - { 22966, _gloffset_MultiTexCoord1dvARB }, - { 23753, _gloffset_MultiTexCoord1ivARB }, - { 23846, _gloffset_MultiTexCoord2ivARB }, - { 24185, _gloffset_MultiTexCoord1iARB }, - { 25456, _gloffset_MultiTexCoord4svARB }, - { 25974, _gloffset_MultiTexCoord1fARB }, - { 26237, _gloffset_MultiTexCoord4fARB }, - { 28505, _gloffset_MultiTexCoord2fvARB }, + { 10903, _gloffset_MultiTexCoord3svARB }, + { 10964, _gloffset_MultiTexCoord4iARB }, + { 11687, _gloffset_MultiTexCoord3iARB }, + { 12389, _gloffset_MultiTexCoord1dARB }, + { 12555, _gloffset_MultiTexCoord3dvARB }, + { 13719, _gloffset_MultiTexCoord3ivARB }, + { 13764, _gloffset_MultiTexCoord2sARB }, + { 14984, _gloffset_MultiTexCoord4ivARB }, + { 16613, _gloffset_ClientActiveTextureARB }, + { 18829, _gloffset_MultiTexCoord2dARB }, + { 19204, _gloffset_MultiTexCoord4dvARB }, + { 19490, _gloffset_MultiTexCoord4fvARB }, + { 20317, _gloffset_MultiTexCoord3fARB }, + { 22627, _gloffset_MultiTexCoord4dARB }, + { 22831, _gloffset_MultiTexCoord1sARB }, + { 23009, _gloffset_MultiTexCoord1dvARB }, + { 23828, _gloffset_MultiTexCoord1ivARB }, + { 23921, _gloffset_MultiTexCoord2ivARB }, + { 24260, _gloffset_MultiTexCoord1iARB }, + { 25531, _gloffset_MultiTexCoord4svARB }, + { 26049, _gloffset_MultiTexCoord1fARB }, + { 26312, _gloffset_MultiTexCoord4fARB }, + { 28541, _gloffset_MultiTexCoord2fvARB }, { -1, -1 } }; #endif diff --git a/src/mesa/sparc/glapi_sparc.S b/src/mesa/sparc/glapi_sparc.S index aaa17e6a3b..731ff2b823 100644 --- a/src/mesa/sparc/glapi_sparc.S +++ b/src/mesa/sparc/glapi_sparc.S @@ -1272,6 +1272,7 @@ gl_dispatch_functions_start: GL_STUB_ALIAS(glGetAttribLocation, glGetAttribLocationARB) GL_STUB_ALIAS(glDrawBuffers, glDrawBuffersARB) GL_STUB_ALIAS(glDrawBuffersATI, glDrawBuffersARB) + GL_STUB_ALIAS(glRenderbufferStorageMultisampleEXT, glRenderbufferStorageMultisample) GL_STUB_ALIAS(glPointParameterf, glPointParameterfEXT) GL_STUB_ALIAS(glPointParameterfARB, glPointParameterfEXT) GL_STUB_ALIAS(glPointParameterfSGIS, glPointParameterfEXT) diff --git a/src/mesa/x86-64/glapi_x86-64.S b/src/mesa/x86-64/glapi_x86-64.S index 72d0532906..134cff7ca4 100644 --- a/src/mesa/x86-64/glapi_x86-64.S +++ b/src/mesa/x86-64/glapi_x86-64.S @@ -30302,6 +30302,7 @@ GL_PREFIX(_dispatch_stub_794): .globl GL_PREFIX(GetAttribLocation) ; .set GL_PREFIX(GetAttribLocation), GL_PREFIX(GetAttribLocationARB) .globl GL_PREFIX(DrawBuffers) ; .set GL_PREFIX(DrawBuffers), GL_PREFIX(DrawBuffersARB) .globl GL_PREFIX(DrawBuffersATI) ; .set GL_PREFIX(DrawBuffersATI), GL_PREFIX(DrawBuffersARB) + .globl GL_PREFIX(RenderbufferStorageMultisampleEXT) ; .set GL_PREFIX(RenderbufferStorageMultisampleEXT), GL_PREFIX(RenderbufferStorageMultisample) .globl GL_PREFIX(PointParameterf) ; .set GL_PREFIX(PointParameterf), GL_PREFIX(PointParameterfEXT) .globl GL_PREFIX(PointParameterfARB) ; .set GL_PREFIX(PointParameterfARB), GL_PREFIX(PointParameterfEXT) .globl GL_PREFIX(PointParameterfv) ; .set GL_PREFIX(PointParameterfv), GL_PREFIX(PointParameterfvEXT) diff --git a/src/mesa/x86/glapi_x86.S b/src/mesa/x86/glapi_x86.S index 12c77f434e..0da924c37f 100644 --- a/src/mesa/x86/glapi_x86.S +++ b/src/mesa/x86/glapi_x86.S @@ -1226,6 +1226,7 @@ GLNAME(gl_dispatch_functions_start): GL_STUB_ALIAS(GetAttribLocation, _gloffset_GetAttribLocationARB, GetAttribLocation@8, GetAttribLocationARB, GetAttribLocationARB@8) GL_STUB_ALIAS(DrawBuffers, _gloffset_DrawBuffersARB, DrawBuffers@8, DrawBuffersARB, DrawBuffersARB@8) GL_STUB_ALIAS(DrawBuffersATI, _gloffset_DrawBuffersARB, DrawBuffersATI@8, DrawBuffersARB, DrawBuffersARB@8) + GL_STUB_ALIAS(RenderbufferStorageMultisampleEXT, _gloffset_RenderbufferStorageMultisample, RenderbufferStorageMultisampleEXT@20, RenderbufferStorageMultisample, RenderbufferStorageMultisample@20) GL_STUB_ALIAS(PointParameterf, _gloffset_PointParameterfEXT, PointParameterf@8, PointParameterfEXT, PointParameterfEXT@8) GL_STUB_ALIAS(PointParameterfARB, _gloffset_PointParameterfEXT, PointParameterfARB@8, PointParameterfEXT, PointParameterfEXT@8) GL_STUB_ALIAS(PointParameterfSGIS, _gloffset_PointParameterfEXT, PointParameterfSGIS@8, PointParameterfEXT, PointParameterfEXT@8) -- cgit v1.2.3 From 4d6ec214396461c0cf3ad8ede449b299ff06c1aa Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 11 Nov 2009 15:33:23 -0800 Subject: ARB_fbo: Enable GL_EXT_framebuffer_multisample All of this functionality is already included in ARB_fbo. This just enables the string. I was a bit lazy in using FEATURE_ARB_framebuffer_object for this feature as well. I don't think it makes much difference in the long run. --- src/mesa/main/extensions.c | 6 +++++- src/mesa/main/mtypes.h | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 96f3511273..2138bfe40e 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -104,8 +104,9 @@ static const struct { { ON, "GL_EXT_copy_texture", F(EXT_copy_texture) }, { OFF, "GL_EXT_depth_bounds_test", F(EXT_depth_bounds_test) }, { ON, "GL_EXT_draw_range_elements", F(EXT_draw_range_elements) }, - { OFF, "GL_EXT_framebuffer_object", F(EXT_framebuffer_object) }, { OFF, "GL_EXT_framebuffer_blit", F(EXT_framebuffer_blit) }, + { OFF, "GL_EXT_framebuffer_multisample", F(EXT_framebuffer_multisample) }, + { OFF, "GL_EXT_framebuffer_object", F(EXT_framebuffer_object) }, { OFF, "GL_EXT_fog_coord", F(EXT_fog_coord) }, { OFF, "GL_EXT_gpu_program_parameters", F(EXT_gpu_program_parameters) }, { OFF, "GL_EXT_histogram", F(EXT_histogram) }, @@ -274,6 +275,9 @@ _mesa_enable_sw_extensions(GLcontext *ctx) #endif #if FEATURE_EXT_framebuffer_blit ctx->Extensions.EXT_framebuffer_blit = GL_TRUE; +#endif +#if FEATURE_ARB_framebuffer_object + ctx->Extensions.EXT_framebuffer_multisample = GL_TRUE; #endif ctx->Extensions.EXT_histogram = GL_TRUE; /*ctx->Extensions.EXT_multi_draw_arrays = GL_TRUE;*/ diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 94d29a7dbb..34c51b5442 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2412,9 +2412,10 @@ struct gl_extensions GLboolean EXT_copy_texture; GLboolean EXT_depth_bounds_test; GLboolean EXT_draw_range_elements; - GLboolean EXT_framebuffer_object; GLboolean EXT_fog_coord; GLboolean EXT_framebuffer_blit; + GLboolean EXT_framebuffer_multisample; + GLboolean EXT_framebuffer_object; GLboolean EXT_gpu_program_parameters; GLboolean EXT_histogram; GLboolean EXT_multi_draw_arrays; -- cgit v1.2.3 From 5fbfd883386a8ff78bd6ca10ab761aff1b38e46d Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 12 Nov 2009 11:59:35 -0800 Subject: Add missing XML files to API_XML When the files missing from the list were modified, the generated files weren't regenerated. --- src/mesa/glapi/Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/glapi/Makefile b/src/mesa/glapi/Makefile index fb6be1a3a9..71bef68ea5 100644 --- a/src/mesa/glapi/Makefile +++ b/src/mesa/glapi/Makefile @@ -47,16 +47,19 @@ SERVER_OUTPUTS = \ $(SERVER_GLAPI_FILES) API_XML = gl_API.xml \ - EXT_framebuffer_object.xml \ ARB_copy_buffer.xml \ ARB_depth_clamp.xml \ + ARB_draw_elements_base_vertex.xml \ ARB_framebuffer_object.xml \ ARB_map_buffer_range.xml \ ARB_seamless_cube_map.xml \ ARB_sync.xml \ ARB_vertex_array_object.xml \ APPLE_vertex_array_object.xml \ - EXT_provoking_vertex.xml + EXT_framebuffer_object.xml \ + EXT_packed_depth_stencil.xml \ + EXT_provoking_vertex.xml \ + EXT_texture_array.xml COMMON = gl_XML.py glX_XML.py license.py $(API_XML) typeexpr.py COMMON_GLX = $(COMMON) glX_API.xml glX_XML.py glX_proto_common.py -- cgit v1.2.3 From 4e7476f601e15cf4c52d7de44f0f775aaaedd094 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 12 Nov 2009 13:22:12 -0800 Subject: ARB_fbo: Add missing GLX render opcode for glFramebufferTextureLayerEXT Also regenerate the GLX protocol files from this change. --- src/glx/x11/indirect.c | 20 ++++++++++++++++++++ src/glx/x11/indirect.h | 1 + src/glx/x11/indirect_init.c | 4 ++++ src/mesa/glapi/EXT_texture_array.xml | 1 + 4 files changed, 26 insertions(+) (limited to 'src') diff --git a/src/glx/x11/indirect.c b/src/glx/x11/indirect.c index 3ca71f56ff..ea90ce4463 100644 --- a/src/glx/x11/indirect.c +++ b/src/glx/x11/indirect.c @@ -10643,6 +10643,26 @@ __indirect_glBlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, } } +#define X_GLrop_FramebufferTextureLayerEXT 237 +void +__indirect_glFramebufferTextureLayerEXT(GLenum target, GLenum attachment, + GLuint texture, GLint level, + GLint layer) +{ + __GLXcontext *const gc = __glXGetCurrentContext(); + const GLuint cmdlen = 24; + emit_header(gc->pc, X_GLrop_FramebufferTextureLayerEXT, cmdlen); + (void) memcpy((void *) (gc->pc + 4), (void *) (&target), 4); + (void) memcpy((void *) (gc->pc + 8), (void *) (&attachment), 4); + (void) memcpy((void *) (gc->pc + 12), (void *) (&texture), 4); + (void) memcpy((void *) (gc->pc + 16), (void *) (&level), 4); + (void) memcpy((void *) (gc->pc + 20), (void *) (&layer), 4); + gc->pc += cmdlen; + if (__builtin_expect(gc->pc > gc->limit, 0)) { + (void) __glXFlushRenderBuffer(gc, gc->pc); + } +} + # undef FASTCALL # undef NOINLINE diff --git a/src/glx/x11/indirect.h b/src/glx/x11/indirect.h index 4a1b81ca6e..19a8c0d134 100644 --- a/src/glx/x11/indirect.h +++ b/src/glx/x11/indirect.h @@ -712,6 +712,7 @@ extern HIDDEN GLboolean __indirect_glIsFramebufferEXT(GLuint framebuffer); extern HIDDEN GLboolean __indirect_glIsRenderbufferEXT(GLuint renderbuffer); extern HIDDEN void __indirect_glRenderbufferStorageEXT(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); extern HIDDEN void __indirect_glBlitFramebufferEXT(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +extern HIDDEN void __indirect_glFramebufferTextureLayerEXT(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); # undef HIDDEN # undef FASTCALL diff --git a/src/glx/x11/indirect_init.c b/src/glx/x11/indirect_init.c index aa9a6bb2b0..73ca993027 100644 --- a/src/glx/x11/indirect_init.c +++ b/src/glx/x11/indirect_init.c @@ -776,6 +776,10 @@ __GLapi * __glXNewIndirectAPI( void ) glAPI->BlitFramebufferEXT = __indirect_glBlitFramebufferEXT; + /* 329. GL_EXT_texture_array */ + + glAPI->FramebufferTextureLayerEXT = __indirect_glFramebufferTextureLayerEXT; + return glAPI; } diff --git a/src/mesa/glapi/EXT_texture_array.xml b/src/mesa/glapi/EXT_texture_array.xml index e5bd9f3c69..b5b8bd406f 100644 --- a/src/mesa/glapi/EXT_texture_array.xml +++ b/src/mesa/glapi/EXT_texture_array.xml @@ -35,6 +35,7 @@ + -- cgit v1.2.3 From b43887cf7e64cc44cf1409f910d1324549b265d2 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 12 Nov 2009 13:28:12 -0800 Subject: ARB_fbo: Enable extensions related to GL_ARB_framebuffer_object for GLX --- src/glx/x11/glxextensions.c | 5 +++++ src/glx/x11/glxextensions.h | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'src') diff --git a/src/glx/x11/glxextensions.c b/src/glx/x11/glxextensions.c index 473f46d1e5..6852128e2a 100644 --- a/src/glx/x11/glxextensions.c +++ b/src/glx/x11/glxextensions.c @@ -112,6 +112,7 @@ static const struct extension_info known_gl_extensions[] = { { GL(ARB_draw_buffers), VER(0,0), Y, N, N, N }, { GL(ARB_fragment_program), VER(0,0), Y, N, N, N }, { GL(ARB_fragment_program_shadow), VER(0,0), Y, N, N, N }, + { GL(ARB_framebuffer_object), VER(0,0), Y, N, N, N }, { GL(ARB_imaging), VER(0,0), Y, N, N, N }, { GL(ARB_multisample), VER(1,3), Y, N, N, N }, { GL(ARB_multitexture), VER(1,3), Y, N, N, N }, @@ -150,8 +151,11 @@ static const struct extension_info known_gl_extensions[] = { { GL(EXT_depth_bounds_test), VER(0,0), N, N, N, N }, { GL(EXT_draw_range_elements), VER(1,2), Y, N, Y, N }, { GL(EXT_fog_coord), VER(1,4), Y, N, N, N }, + { GL(EXT_framebuffer_blit), VER(0,0), Y, N, N, N }, + { GL(EXT_framebuffer_multisample), VER(0,0), Y, N, N, N }, { GL(EXT_framebuffer_object), VER(0,0), Y, N, N, N }, { GL(EXT_multi_draw_arrays), VER(1,4), Y, N, Y, N }, + { GL(EXT_packed_depth_stencil), VER(0,0), Y, N, N, N }, { GL(EXT_packed_pixels), VER(1,2), Y, N, N, N }, { GL(EXT_paletted_texture), VER(0,0), Y, N, N, N }, { GL(EXT_pixel_buffer_object), VER(0,0), N, N, N, N }, @@ -209,6 +213,7 @@ static const struct extension_info known_gl_extensions[] = { { GL(NV_fragment_program2), VER(0,0), Y, N, N, N }, { GL(NV_light_max_exponent), VER(0,0), Y, N, N, N }, { GL(NV_multisample_filter_hint), VER(0,0), Y, N, N, N }, + { GL(NV_packed_depth_stencil), VER(0,0), Y, N, N, N }, { GL(NV_point_sprite), VER(0,0), Y, N, N, N }, { GL(NV_texgen_reflection), VER(0,0), Y, N, N, N }, { GL(NV_texture_compression_vtc), VER(0,0), Y, N, N, N }, diff --git a/src/glx/x11/glxextensions.h b/src/glx/x11/glxextensions.h index 9f1c697487..652c5db1c8 100644 --- a/src/glx/x11/glxextensions.h +++ b/src/glx/x11/glxextensions.h @@ -74,6 +74,7 @@ enum GL_ARB_draw_buffers_bit, GL_ARB_fragment_program_bit, GL_ARB_fragment_program_shadow_bit, + GL_ARB_framebuffer_object_bit, GL_ARB_imaging_bit, GL_ARB_multisample_bit, GL_ARB_multitexture_bit, @@ -112,8 +113,11 @@ enum GL_EXT_depth_bounds_test_bit, GL_EXT_draw_range_elements_bit, GL_EXT_fog_coord_bit, + GL_EXT_framebuffer_blit_bit, + GL_EXT_framebuffer_multisample_bit, GL_EXT_framebuffer_object_bit, GL_EXT_multi_draw_arrays_bit, + GL_EXT_packed_depth_stencil_bit, GL_EXT_packed_pixels_bit, GL_EXT_paletted_texture_bit, GL_EXT_pixel_buffer_object_bit, @@ -164,6 +168,7 @@ enum GL_NV_fragment_program2_bit, GL_NV_light_max_exponent_bit, GL_NV_multisample_filter_hint_bit, + GL_NV_packed_depth_stencil_bit, GL_NV_point_sprite_bit, GL_NV_texgen_reflection_bit, GL_NV_texture_compression_vtc_bit, -- cgit v1.2.3 From 5606dfb572bf4b89b4882265924705bacc8c182b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 17 Nov 2009 16:10:24 -0800 Subject: Merge branch 'outputswritten64' Add a GLbitfield64 type and several macros to operate on 64-bit fields. The OutputsWritten field of gl_program is changed to use that type. This results in a fair amount of fallout in drivers that use programs. No changes are strictly necessary at this point as all bits used are below the 32-bit boundary. Fairly soon several bits will be added for clip distances written by a vertex shader. This will cause several bits used for varyings to be pushed above the 32-bit boundary. This will affect any drivers that support GLSL. At this point, only the i965 driver has been modified to support this eventuality. I did this as a "squash" merge. There were several places through the outputswritten64 branch where things were broken. I foresee this causing difficulties later for bisecting. The history is still available in the branch. Conflicts: src/mesa/drivers/dri/i965/brw_wm.h --- src/mesa/drivers/dri/i965/brw_clip.c | 2 +- src/mesa/drivers/dri/i965/brw_clip.h | 2 +- src/mesa/drivers/dri/i965/brw_context.h | 6 +----- src/mesa/drivers/dri/i965/brw_gs.h | 2 +- src/mesa/drivers/dri/i965/brw_sf.c | 6 +++--- src/mesa/drivers/dri/i965/brw_sf.h | 2 +- src/mesa/drivers/dri/i965/brw_sf_emit.c | 18 +++++++++--------- src/mesa/drivers/dri/i965/brw_util.c | 2 +- src/mesa/drivers/dri/i965/brw_util.h | 2 +- src/mesa/drivers/dri/i965/brw_vs.c | 2 +- src/mesa/drivers/dri/i965/brw_vs_emit.c | 8 ++++---- src/mesa/drivers/dri/i965/brw_wm.c | 4 ++-- src/mesa/drivers/dri/i965/brw_wm.h | 2 +- src/mesa/drivers/dri/i965/brw_wm_fp.c | 2 +- src/mesa/drivers/dri/i965/brw_wm_glsl.c | 2 +- src/mesa/drivers/dri/i965/brw_wm_pass2.c | 4 ++-- src/mesa/drivers/dri/i965/brw_wm_state.c | 2 +- src/mesa/drivers/dri/r200/r200_tcl.c | 15 ++++++++------- src/mesa/main/config.h | 2 +- src/mesa/main/context.c | 8 +++++--- src/mesa/main/ffvertex_prog.c | 2 +- src/mesa/main/mtypes.h | 27 ++++++++++++++++++++++++++- src/mesa/main/texenvprogram.c | 2 +- src/mesa/shader/prog_print.c | 6 +++--- src/mesa/shader/program_parse.tab.c | 2 +- src/mesa/shader/program_parse.y | 2 +- src/mesa/shader/programopt.c | 8 ++++---- src/mesa/shader/slang/slang_link.c | 25 +++++++++++++++---------- src/mesa/state_tracker/st_atom_shader.c | 2 +- src/mesa/state_tracker/st_program.c | 2 +- src/mesa/swrast/s_fragprog.c | 12 ++++++------ src/mesa/tnl/t_context.c | 2 +- src/mesa/tnl/t_vb_program.c | 8 ++++---- 33 files changed, 111 insertions(+), 82 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_clip.c b/src/mesa/drivers/dri/i965/brw_clip.c index f45dcf8282..dbd10a5297 100644 --- a/src/mesa/drivers/dri/i965/brw_clip.c +++ b/src/mesa/drivers/dri/i965/brw_clip.c @@ -78,7 +78,7 @@ static void compile_clip_prog( struct brw_context *brw, delta = REG_SIZE; for (i = 0; i < VERT_RESULT_MAX; i++) - if (c.key.attrs & (1<= VERT_RESULT_TEX0 && i <= VERT_RESULT_TEX7) { @@ -147,7 +147,7 @@ static void upload_sf_prog(struct brw_context *brw) * edgeflag testing here, it is already done in the clip * program. */ - if (key.attrs & (1<key.attrs & (1<key.attrs & BITFIELD64_BIT(attr)) ? 1 : 0; } /*********************************************************************** @@ -122,8 +122,8 @@ static void do_twoside_color( struct brw_sf_compile *c ) * Flat shading */ -#define VERT_RESULT_COLOR_BITS ((1<nr_setup_regs - 1); - GLuint persp_mask; - GLuint linear_mask; + GLbitfield64 persp_mask; + GLbitfield64 linear_mask; if (c->key.do_flat_shading || c->key.linear_color) persp_mask = c->key.attrs & ~(FRAG_BIT_WPOS | @@ -331,10 +331,10 @@ static GLboolean calculate_masks( struct brw_sf_compile *c, *pc_linear = 0; *pc = 0xf; - if (persp_mask & (1 << c->idx_to_attr[reg*2])) + if (persp_mask & BITFIELD64_BIT(c->idx_to_attr[reg*2])) *pc_persp = 0xf; - if (linear_mask & (1 << c->idx_to_attr[reg*2])) + if (linear_mask & BITFIELD64_BIT(c->idx_to_attr[reg*2])) *pc_linear = 0xf; /* Maybe only processs one attribute on the final round: @@ -342,10 +342,10 @@ static GLboolean calculate_masks( struct brw_sf_compile *c, if (reg*2+1 < c->nr_setup_attrs) { *pc |= 0xf0; - if (persp_mask & (1 << c->idx_to_attr[reg*2+1])) + if (persp_mask & BITFIELD64_BIT(c->idx_to_attr[reg*2+1])) *pc_persp |= 0xf0; - if (linear_mask & (1 << c->idx_to_attr[reg*2+1])) + if (linear_mask & BITFIELD64_BIT(c->idx_to_attr[reg*2+1])) *pc_linear |= 0xf0; } diff --git a/src/mesa/drivers/dri/i965/brw_util.c b/src/mesa/drivers/dri/i965/brw_util.c index ce21aa4869..bba9249d1b 100644 --- a/src/mesa/drivers/dri/i965/brw_util.c +++ b/src/mesa/drivers/dri/i965/brw_util.c @@ -35,7 +35,7 @@ #include "brw_util.h" #include "brw_defines.h" -GLuint brw_count_bits( GLuint val ) +GLuint brw_count_bits(uint64_t val) { GLuint i; for (i = 0; val ; val >>= 1) diff --git a/src/mesa/drivers/dri/i965/brw_util.h b/src/mesa/drivers/dri/i965/brw_util.h index 33e7cd87e4..04f3175d3e 100644 --- a/src/mesa/drivers/dri/i965/brw_util.h +++ b/src/mesa/drivers/dri/i965/brw_util.h @@ -35,7 +35,7 @@ #include "main/mtypes.h" -extern GLuint brw_count_bits( GLuint val ); +extern GLuint brw_count_bits(uint64_t val); extern GLuint brw_parameter_list_state_flags(struct gl_program_parameter_list *paramList); extern GLuint brw_translate_blend_factor( GLenum factor ); extern GLuint brw_translate_blend_equation( GLenum mode ); diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index f0c79efbd9..fd055e225e 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -56,7 +56,7 @@ static void do_vs_prog( struct brw_context *brw, c.prog_data.inputs_read = vp->program.Base.InputsRead; if (c.key.copy_edgeflag) { - c.prog_data.outputs_written |= 1<prog_data.outputs_written & (1 << i)) { + if (c->prog_data.outputs_written & BITFIELD64_BIT(i)) { c->nr_outputs++; assert(i < Elements(c->regs[PROGRAM_OUTPUT])); if (i == VERT_RESULT_HPOS) { @@ -1124,7 +1124,7 @@ static void emit_vertex_write( struct brw_vs_compile *c) /* Update the header for point size, user clipping flags, and -ve rhw * workaround. */ - if ((c->prog_data.outputs_written & (1<prog_data.outputs_written & BITFIELD64_BIT(VERT_RESULT_PSIZ)) || c->key.nr_userclip || BRW_IS_965(p->brw)) { struct brw_reg header1 = retype(get_tmp(c), BRW_REGISTER_TYPE_UD); @@ -1134,7 +1134,7 @@ static void emit_vertex_write( struct brw_vs_compile *c) brw_set_access_mode(p, BRW_ALIGN_16); - if (c->prog_data.outputs_written & (1<prog_data.outputs_written & BITFIELD64_BIT(VERT_RESULT_PSIZ)) { struct brw_reg psiz = c->regs[PROGRAM_OUTPUT][VERT_RESULT_PSIZ]; brw_MUL(p, brw_writemask(header1, WRITEMASK_W), brw_swizzle1(psiz, 0), brw_imm_f(1<<11)); brw_AND(p, brw_writemask(header1, WRITEMASK_W), header1, brw_imm_ud(0x7ff<<8)); @@ -1224,7 +1224,7 @@ static void emit_vertex_write( struct brw_vs_compile *c) */ GLuint i, mrf = 0; for (i = c->first_overflow_output; i < VERT_RESULT_MAX; i++) { - if (c->prog_data.outputs_written & (1 << i)) { + if (c->prog_data.outputs_written & BITFIELD64_BIT(i)) { /* move from GRF to MRF */ brw_MOV(p, brw_message_reg(4+mrf), c->regs[PROGRAM_OUTPUT][i]); mrf++; diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index d8971321f3..77e3b2c32a 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -231,7 +231,7 @@ static void brw_wm_populate_key( struct brw_context *brw, ctx->Color.AlphaEnabled) lookup |= IZ_PS_KILL_ALPHATEST_BIT; - if (fp->program.Base.OutputsWritten & (1<program.Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) lookup |= IZ_PS_COMPUTES_DEPTH_BIT; /* _NEW_DEPTH */ @@ -347,7 +347,7 @@ static void brw_wm_populate_key( struct brw_context *brw, key->nr_color_regions = brw->state.nr_color_regions; /* CACHE_NEW_VS_PROG */ - key->vp_outputs_written = brw->vs.prog_data->outputs_written & DO_SETUP_BITS; + key->vp_outputs_written = brw->vs.prog_data->outputs_written; /* The unique fragment program ID */ key->program_string_id = fp->id; diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index b3c05eb0ad..9dcb6e14bb 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -79,7 +79,7 @@ struct brw_wm_prog_key { GLuint program_string_id:32; GLushort origin_x, origin_y; GLushort drawable_height; - GLuint vp_outputs_written; + GLbitfield64 vp_outputs_written; }; diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index 1c4f62ba48..7d03179588 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -986,7 +986,7 @@ static void emit_render_target_writes( struct brw_wm_compile *c ) } else { /* if gl_FragData[0] is written, use it, else use gl_FragColor */ - if (c->fp->program.Base.OutputsWritten & (1 << FRAG_RESULT_DATA0)) + if (c->fp->program.Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DATA0)) outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_DATA0); else outcolor = src_reg(PROGRAM_OUTPUT, FRAG_RESULT_COLOR); diff --git a/src/mesa/drivers/dri/i965/brw_wm_glsl.c b/src/mesa/drivers/dri/i965/brw_wm_glsl.c index 3ab446164c..e8c2cb66ec 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_glsl.c +++ b/src/mesa/drivers/dri/i965/brw_wm_glsl.c @@ -371,7 +371,7 @@ static void prealloc_reg(struct brw_wm_compile *c) for (j = 0; j < 4; j++) set_reg(c, PROGRAM_PAYLOAD, fp_input, j, reg); } - if (c->key.vp_outputs_written & (1 << i)) { + if (c->key.vp_outputs_written & BITFIELD64_BIT(i)) { reg_index += 2; } } diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass2.c b/src/mesa/drivers/dri/i965/brw_wm_pass2.c index 6faea018fb..31303febf0 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_pass2.c +++ b/src/mesa/drivers/dri/i965/brw_wm_pass2.c @@ -82,8 +82,8 @@ static void init_registers( struct brw_wm_compile *c ) for (j = 0; j < c->nr_creg; j++) prealloc_reg(c, &c->creg[j], i++); - for (j = 0; j < FRAG_ATTRIB_MAX; j++) { - if (c->key.vp_outputs_written & (1<key.vp_outputs_written & BITFIELD64_BIT(j)) { int fp_index; if (j >= VERT_RESULT_VAR0) diff --git a/src/mesa/drivers/dri/i965/brw_wm_state.c b/src/mesa/drivers/dri/i965/brw_wm_state.c index 361f91292b..f89ed9bce7 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_state.c @@ -106,7 +106,7 @@ wm_unit_populate_key(struct brw_context *brw, struct brw_wm_unit_key *key) /* as far as we can tell */ key->computes_depth = - (fp->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH)) != 0; + (fp->Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) != 0; /* BRW_NEW_DEPTH_BUFFER * Override for NULL depthbuffer case, required by the Pixel Shader Computed * Depth field. diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c index c702910ef2..e7d48a7f29 100644 --- a/src/mesa/drivers/dri/r200/r200_tcl.c +++ b/src/mesa/drivers/dri/r200/r200_tcl.c @@ -509,25 +509,26 @@ static GLboolean r200_run_tcl_render( GLcontext *ctx, prog to a not enabled output however, so just don't mess with it. We only need to change compsel. */ GLuint out_compsel = 0; - GLuint vp_out = rmesa->curr_vp_hw->mesa_program.Base.OutputsWritten; + const GLbitfield64 vp_out = + rmesa->curr_vp_hw->mesa_program.Base.OutputsWritten; vimap_rev = &rmesa->curr_vp_hw->inputmap_rev[0]; - assert(vp_out & (1 << VERT_RESULT_HPOS)); + assert(vp_out & BITFIELD64_BIT(VERT_RESULT_HPOS)); out_compsel = R200_OUTPUT_XYZW; - if (vp_out & (1 << VERT_RESULT_COL0)) { + if (vp_out & BITFIELD64_BIT(VERT_RESULT_COL0)) { out_compsel |= R200_OUTPUT_COLOR_0; } - if (vp_out & (1 << VERT_RESULT_COL1)) { + if (vp_out & BITFIELD64_BIT(VERT_RESULT_COL1)) { out_compsel |= R200_OUTPUT_COLOR_1; } - if (vp_out & (1 << VERT_RESULT_FOGC)) { + if (vp_out & BITFIELD64_BIT(VERT_RESULT_FOGC)) { out_compsel |= R200_OUTPUT_DISCRETE_FOG; } - if (vp_out & (1 << VERT_RESULT_PSIZ)) { + if (vp_out & BITFIELD64_BIT(VERT_RESULT_PSIZ)) { out_compsel |= R200_OUTPUT_PT_SIZE; } for (i = VERT_RESULT_TEX0; i < VERT_RESULT_TEX6; i++) { - if (vp_out & (1 << i)) { + if (vp_out & BITFIELD64_BIT(i)) { out_compsel |= R200_OUTPUT_TEX_0 << (i - VERT_RESULT_TEX0); } } diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 8a09efdb53..c5048970cc 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -205,7 +205,7 @@ #define MAX_VARYING 16 /**< number of float[4] vectors */ #define MAX_SAMPLERS MAX_TEXTURE_IMAGE_UNITS #define MAX_PROGRAM_INPUTS 32 -#define MAX_PROGRAM_OUTPUTS 32 +#define MAX_PROGRAM_OUTPUTS 64 /*@}*/ /** For GL_ARB_vertex_program */ diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 101d3c6b67..b5bf46718f 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -601,9 +601,11 @@ _mesa_init_constants(GLcontext *ctx) ASSERT(MAX_NV_VERTEX_PROGRAM_INPUTS <= VERT_ATTRIB_MAX); ASSERT(MAX_NV_VERTEX_PROGRAM_OUTPUTS <= VERT_RESULT_MAX); - /* check that we don't exceed various 32-bit bitfields */ - ASSERT(VERT_RESULT_MAX <= 32); - ASSERT(FRAG_ATTRIB_MAX <= 32); + /* check that we don't exceed the size of various bitfields */ + ASSERT(VERT_RESULT_MAX <= + (8 * sizeof(ctx->VertexProgram._Current->Base.OutputsWritten))); + ASSERT(FRAG_ATTRIB_MAX <= + (8 * sizeof(ctx->FragmentProgram._Current->Base.InputsRead))); } diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index 356476e35a..fe2416d894 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -438,7 +438,7 @@ static struct ureg register_input( struct tnl_program *p, GLuint input ) */ static struct ureg register_output( struct tnl_program *p, GLuint output ) { - p->program->Base.OutputsWritten |= (1<program->Base.OutputsWritten |= BITFIELD64_BIT(output); return make_ureg(PROGRAM_OUTPUT, output); } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 34c51b5442..881d233ca3 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -78,6 +78,31 @@ #endif +/** + * \name 64-bit extension of GLbitfield. + */ +/*@{*/ +typedef GLuint64 GLbitfield64; + +#define BITFIELD64_ONE 1ULL +#define BITFIELD64_ALLONES ~0ULL + +/** Set a single bit */ +#define BITFIELD64_BIT(b) (BITFIELD64_ONE << (b)) + +/** Set a mask of the least significant \c b bits */ +#define BITFIELD64_MASK(b) (((b) >= 64) ? BITFIELD64_ALLONES : \ + (BITFIELD64_BIT(b) - 1)) + +/** + * Set all bits from l (low bit) to h (high bit), inclusive. + * + * \note \C BITFIELD_64_RANGE(0, 63) return 64 set bits. + */ +#define BITFIELD64_RANGE(l, h) (BITFIELD64_MASK((h) + 1) & ~BITFIELD64_MASK(l)) +/*@}*/ + + /** * \name Some forward type declarations */ @@ -1670,7 +1695,7 @@ struct gl_program struct prog_instruction *Instructions; GLbitfield InputsRead; /**< Bitmask of which input regs are read */ - GLbitfield OutputsWritten; /**< Bitmask of which output regs are written to */ + GLbitfield64 OutputsWritten; /**< Bitmask of which output regs are written */ GLbitfield InputFlags[MAX_PROGRAM_INPUTS]; /**< PROG_PARAM_BIT_x flags */ GLbitfield OutputFlags[MAX_PROGRAM_OUTPUTS]; /**< PROG_PARAM_BIT_x flags */ GLbitfield TexturesUsed[MAX_TEXTURE_UNITS]; /**< TEXTURE_x_BIT bitmask */ diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index d7e77e759e..f439d4addb 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -367,7 +367,7 @@ static GLbitfield get_fp_input_mask( GLcontext *ctx ) else { /* calculate from vp->outputs */ struct gl_vertex_program *vprog; - GLbitfield vp_outputs; + GLbitfield64 vp_outputs; /* Choose GLSL vertex shader over ARB vertex program. Need this * since vertex shader state validation comes after fragment state diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index ba4d39452f..52c102cbaa 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -826,11 +826,11 @@ _mesa_print_program(const struct gl_program *prog) * XXX move to imports.[ch] if useful elsewhere. */ static const char * -binary(GLbitfield val) +binary(GLbitfield64 val) { - static char buf[50]; + static char buf[80]; GLint i, len = 0; - for (i = 31; i >= 0; --i) { + for (i = 63; i >= 0; --i) { if (val & (1 << i)) buf[len++] = '1'; else if (len > 0 || i == 0) diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c index b9ef88b64b..d4f8429488 100644 --- a/src/mesa/shader/program_parse.tab.c +++ b/src/mesa/shader/program_parse.tab.c @@ -2622,7 +2622,7 @@ yyreduce: YYERROR; } - state->prog->OutputsWritten |= (1U << (yyval.dst_reg).Index); + state->prog->OutputsWritten |= BITFIELD64_BIT((yyval.dst_reg).Index); } ;} break; diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index d07bf85b36..8ca6f9805b 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -643,7 +643,7 @@ maskedDstReg: dstReg optionalMask optionalCcMask YYERROR; } - state->prog->OutputsWritten |= (1U << $$.Index); + state->prog->OutputsWritten |= BITFIELD64_BIT($$.Index); } } ; diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c index 3b8529592d..a0daac1b80 100644 --- a/src/mesa/shader/programopt.c +++ b/src/mesa/shader/programopt.c @@ -109,7 +109,7 @@ _mesa_insert_mvp_dp4_code(GLcontext *ctx, struct gl_vertex_program *vprog) vprog->Base.Instructions = newInst; vprog->Base.NumInstructions = newLen; vprog->Base.InputsRead |= VERT_BIT_POS; - vprog->Base.OutputsWritten |= (1 << VERT_RESULT_HPOS); + vprog->Base.OutputsWritten |= BITFIELD64_BIT(VERT_RESULT_HPOS); } @@ -211,7 +211,7 @@ _mesa_insert_mvp_mad_code(GLcontext *ctx, struct gl_vertex_program *vprog) vprog->Base.Instructions = newInst; vprog->Base.NumInstructions = newLen; vprog->Base.InputsRead |= VERT_BIT_POS; - vprog->Base.OutputsWritten |= (1 << VERT_RESULT_HPOS); + vprog->Base.OutputsWritten |= BITFIELD64_BIT(VERT_RESULT_HPOS); } @@ -613,7 +613,7 @@ _mesa_nop_fragment_program(GLcontext *ctx, struct gl_fragment_program *prog) prog->Base.Instructions = inst; prog->Base.NumInstructions = 2; prog->Base.InputsRead = 1 << inputAttr; - prog->Base.OutputsWritten = 1 << FRAG_RESULT_COLOR; + prog->Base.OutputsWritten = BITFIELD64_BIT(FRAG_RESULT_COLOR); } @@ -657,7 +657,7 @@ _mesa_nop_vertex_program(GLcontext *ctx, struct gl_vertex_program *prog) prog->Base.Instructions = inst; prog->Base.NumInstructions = 2; prog->Base.InputsRead = 1 << inputAttr; - prog->Base.OutputsWritten = 1 << VERT_RESULT_COL0; + prog->Base.OutputsWritten = BITFIELD64_BIT(VERT_RESULT_COL0); /* * Now insert code to do standard modelview/projection transformation. diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 144c126525..0a2bc49780 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -515,7 +515,7 @@ _slang_update_inputs_outputs(struct gl_program *prog) } if (inst->DstReg.File == PROGRAM_OUTPUT) { - prog->OutputsWritten |= 1 << inst->DstReg.Index; + prog->OutputsWritten |= BITFIELD64_BIT(inst->DstReg.Index); if (inst->DstReg.RelAddr) { /* If the output attribute is indexed with relative addressing * we know that it must be a varying or texcoord such as @@ -528,14 +528,17 @@ _slang_update_inputs_outputs(struct gl_program *prog) if (prog->Target == GL_VERTEX_PROGRAM_ARB) { if (inst->DstReg.Index == VERT_RESULT_TEX0) { /* mark all texcoord outputs as written */ - const GLbitfield mask = - ((1 << MAX_TEXTURE_COORD_UNITS) - 1) << VERT_RESULT_TEX0; + const GLbitfield64 mask = + BITFIELD64_RANGE(VERT_RESULT_TEX0, + (VERT_RESULT_TEX0 + + MAX_TEXTURE_COORD_UNITS - 1)); prog->OutputsWritten |= mask; } else if (inst->DstReg.Index == VERT_RESULT_VAR0) { /* mark all generic varying outputs as written */ - const GLbitfield mask = - ((1 << MAX_VARYING) - 1) << VERT_RESULT_VAR0; + const GLbitfield64 mask = + BITFIELD64_RANGE(VERT_RESULT_VAR0, + (VERT_RESULT_VAR0 + MAX_VARYING - 1)); prog->OutputsWritten |= mask; } } @@ -807,7 +810,8 @@ _slang_link(GLcontext *ctx, if (shProg->VertexProgram) { _slang_update_inputs_outputs(&shProg->VertexProgram->Base); _slang_count_temporaries(&shProg->VertexProgram->Base); - if (!(shProg->VertexProgram->Base.OutputsWritten & (1 << VERT_RESULT_HPOS))) { + if (!(shProg->VertexProgram->Base.OutputsWritten + & BITFIELD64_BIT(VERT_RESULT_HPOS))) { /* the vertex program did not compute a vertex position */ link_error(shProg, "gl_Position was not written by vertex shader\n"); @@ -825,7 +829,7 @@ _slang_link(GLcontext *ctx, if (shProg->FragmentProgram) { const GLbitfield varyingRead = shProg->FragmentProgram->Base.InputsRead >> FRAG_ATTRIB_VAR0; - const GLbitfield varyingWritten = shProg->VertexProgram ? + const GLbitfield64 varyingWritten = shProg->VertexProgram ? shProg->VertexProgram->Base.OutputsWritten >> VERT_RESULT_VAR0 : 0x0; if ((varyingRead & varyingWritten) != varyingRead) { link_error(shProg, @@ -836,9 +840,10 @@ _slang_link(GLcontext *ctx, /* check that gl_FragColor and gl_FragData are not both written to */ if (shProg->FragmentProgram) { - GLbitfield outputsWritten = shProg->FragmentProgram->Base.OutputsWritten; - if ((outputsWritten & ((1 << FRAG_RESULT_COLOR))) && - (outputsWritten >= (1 << FRAG_RESULT_DATA0))) { + const GLbitfield64 outputsWritten = + shProg->FragmentProgram->Base.OutputsWritten; + if ((outputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) && + (outputsWritten >= BITFIELD64_BIT(FRAG_RESULT_DATA0))) { link_error(shProg, "Fragment program cannot write both gl_FragColor" " and gl_FragData[].\n"); return; diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index ee649be885..6e311e537e 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -176,7 +176,7 @@ find_translated_vp(struct st_context *st, /* See if we need to translate vertex program to TGSI form */ if (xvp->serialNo != stvp->serialNo) { GLuint outAttr; - const GLbitfield outputsWritten = stvp->Base.Base.OutputsWritten; + const GLbitfield64 outputsWritten = stvp->Base.Base.OutputsWritten; GLuint numVpOuts = 0; GLboolean emitPntSize = GL_FALSE, emitBFC0 = GL_FALSE, emitBFC1 = GL_FALSE; GLbitfield usedGenerics = 0x0; diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 6d02722c13..190b6a5526 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -469,7 +469,7 @@ st_translate_fragment_program(struct st_context *st, */ { uint numColors = 0; - GLbitfield outputsWritten = stfp->Base.Base.OutputsWritten; + GLbitfield64 outputsWritten = stfp->Base.Base.OutputsWritten; /* if z is written, emit that first */ if (outputsWritten & (1 << FRAG_RESULT_DEPTH)) { diff --git a/src/mesa/swrast/s_fragprog.c b/src/mesa/swrast/s_fragprog.c index 77a77f0bcb..a22d34415d 100644 --- a/src/mesa/swrast/s_fragprog.c +++ b/src/mesa/swrast/s_fragprog.c @@ -190,7 +190,7 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end) { SWcontext *swrast = SWRAST_CONTEXT(ctx); const struct gl_fragment_program *program = ctx->FragmentProgram._Current; - const GLbitfield outputsWritten = program->Base.OutputsWritten; + const GLbitfield64 outputsWritten = program->Base.OutputsWritten; struct gl_program_machine *machine = &swrast->FragProgMachine; GLuint i; @@ -201,7 +201,7 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end) if (_mesa_execute_program(ctx, &program->Base, machine)) { /* Store result color */ - if (outputsWritten & (1 << FRAG_RESULT_COLOR)) { + if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) { COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0][i], machine->Outputs[FRAG_RESULT_COLOR]); } @@ -212,7 +212,7 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end) */ GLuint buf; for (buf = 0; buf < ctx->DrawBuffer->_NumColorDrawBuffers; buf++) { - if (outputsWritten & (1 << (FRAG_RESULT_DATA0 + buf))) { + if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_DATA0 + buf)) { COPY_4V(span->array->attribs[FRAG_ATTRIB_COL0 + buf][i], machine->Outputs[FRAG_RESULT_DATA0 + buf]); } @@ -220,7 +220,7 @@ run_program(GLcontext *ctx, SWspan *span, GLuint start, GLuint end) } /* Store result depth/z */ - if (outputsWritten & (1 << FRAG_RESULT_DEPTH)) { + if (outputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) { const GLfloat depth = machine->Outputs[FRAG_RESULT_DEPTH][2]; if (depth <= 0.0) span->array->z[i] = 0; @@ -256,12 +256,12 @@ _swrast_exec_fragment_program( GLcontext *ctx, SWspan *span ) run_program(ctx, span, 0, span->end); - if (program->Base.OutputsWritten & (1 << FRAG_RESULT_COLOR)) { + if (program->Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_COLOR)) { span->interpMask &= ~SPAN_RGBA; span->arrayMask |= SPAN_RGBA; } - if (program->Base.OutputsWritten & (1 << FRAG_RESULT_DEPTH)) { + if (program->Base.OutputsWritten & BITFIELD64_BIT(FRAG_RESULT_DEPTH)) { span->interpMask &= ~SPAN_Z; span->arrayMask |= SPAN_Z; } diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c index f2771cde09..db21b4589d 100644 --- a/src/mesa/tnl/t_context.c +++ b/src/mesa/tnl/t_context.c @@ -171,7 +171,7 @@ _tnl_InvalidateState( GLcontext *ctx, GLuint new_state ) if (vp) { GLuint i; for (i = 0; i < MAX_VARYING; i++) { - if (vp->Base.OutputsWritten & (1 << (VERT_RESULT_VAR0 + i))) { + if (vp->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_VAR0 + i)) { RENDERINPUTS_SET(tnl->render_inputs_bitset, _TNL_ATTRIB_GENERIC(i)); } diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c index c10a27614f..e69f7d5766 100644 --- a/src/mesa/tnl/t_vb_program.c +++ b/src/mesa/tnl/t_vb_program.c @@ -329,7 +329,7 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage ) /* make list of outputs to save some time below */ numOutputs = 0; for (i = 0; i < VERT_RESULT_MAX; i++) { - if (program->Base.OutputsWritten & (1 << i)) { + if (program->Base.OutputsWritten & BITFIELD64_BIT(i)) { outputs[numOutputs++] = i; } } @@ -407,14 +407,14 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage ) /* Fixup fog and point size results if needed */ if (program->IsNVProgram) { if (ctx->Fog.Enabled && - (program->Base.OutputsWritten & (1 << VERT_RESULT_FOGC)) == 0) { + (program->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_FOGC)) == 0) { for (i = 0; i < VB->Count; i++) { store->results[VERT_RESULT_FOGC].data[i][0] = 1.0; } } if (ctx->VertexProgram.PointSizeEnabled && - (program->Base.OutputsWritten & (1 << VERT_RESULT_PSIZ)) == 0) { + (program->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_PSIZ)) == 0) { for (i = 0; i < VB->Count; i++) { store->results[VERT_RESULT_PSIZ].data[i][0] = ctx->Point.Size; } @@ -472,7 +472,7 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage ) } for (i = 0; i < ctx->Const.MaxVarying; i++) { - if (program->Base.OutputsWritten & (1 << (VERT_RESULT_VAR0 + i))) { + if (program->Base.OutputsWritten & BITFIELD64_BIT(VERT_RESULT_VAR0 + i)) { /* Note: varying results get put into the generic attributes */ VB->AttribPtr[VERT_ATTRIB_GENERIC0+i] = &store->results[VERT_RESULT_VAR0 + i]; -- cgit v1.2.3 From 70dca0c273d681d004b014dd8d4434be664cb202 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 17 Nov 2009 22:53:06 -0800 Subject: AL1616: Fix cut-and-paste bug One of the PACK_COLOR_88 cases was left over from copying _mesa_texstore_al88 to _mesa_texstore_al1616. --- src/mesa/main/texstore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index abb4ed2663..5387eb1283 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2198,8 +2198,8 @@ _mesa_texstore_al1616(TEXSTORE_PARAMS) if (dstFormat == MESA_FORMAT_AL1616) { for (col = 0; col < srcWidth; col++) { /* src[0] is luminance, src[1] is alpha */ - dstUI[col] = PACK_COLOR_88( FLOAT_TO_USHORT(src[1]), - FLOAT_TO_USHORT(src[0]) ); + dstUI[col] = PACK_COLOR_1616( FLOAT_TO_USHORT(src[1]), + FLOAT_TO_USHORT(src[0]) ); src += 2; } } -- cgit v1.2.3 From 7118db870091d4c9c2465e79f361ff0ed36d1f90 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 18 Nov 2009 22:02:48 +0100 Subject: r600: align for mipmap tree changes --- src/mesa/drivers/dri/r600/r600_tex.c | 17 +++----------- src/mesa/drivers/dri/r600/r600_texstate.c | 37 ++++++++++++------------------- src/mesa/drivers/dri/r600/r700_chip.c | 10 ++++++--- 3 files changed, 24 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_tex.c b/src/mesa/drivers/dri/r600/r600_tex.c index 20965bb3c8..9d83a64e22 100644 --- a/src/mesa/drivers/dri/r600/r600_tex.c +++ b/src/mesa/drivers/dri/r600/r600_tex.c @@ -312,16 +312,7 @@ static void r600TexParameter(GLcontext * ctx, GLenum target, case GL_TEXTURE_MAX_LEVEL: case GL_TEXTURE_MIN_LOD: case GL_TEXTURE_MAX_LOD: - /* This isn't the most efficient solution but there doesn't appear to - * be a nice alternative. Since there's no LOD clamping, - * we just have to rely on loading the right subset of mipmap levels - * to simulate a clamped LOD. - */ - if (t->mt) { - radeon_miptree_unreference(t->mt); - t->mt = 0; - t->validated = GL_FALSE; - } + t->validated = GL_FALSE; break; case GL_DEPTH_TEXTURE_MODE: @@ -369,10 +360,8 @@ static void r600DeleteTexture(GLcontext * ctx, struct gl_texture_object *texObj) t->bo = NULL; } - if (t->mt) { - radeon_miptree_unreference(t->mt); - t->mt = 0; - } + radeon_miptree_unreference(&t->mt); + _mesa_delete_texture_object(ctx, texObj); } diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c index 27c8354923..4ec315b78c 100644 --- a/src/mesa/drivers/dri/r600/r600_texstate.c +++ b/src/mesa/drivers/dri/r600/r600_texstate.c @@ -649,7 +649,6 @@ static void setup_hardware_state(context_t *rmesa, struct gl_texture_object *tex { radeonTexObj *t = radeon_tex_obj(texObj); const struct gl_texture_image *firstImage; - int firstlevel = t->mt ? t->mt->firstLevel : 0; GLuint uTexelPitch, row_align; if (rmesa->radeon.radeonScreen->driScreen->dri2.enabled && @@ -657,7 +656,7 @@ static void setup_hardware_state(context_t *rmesa, struct gl_texture_object *tex t->bo) return; - firstImage = t->base.Image[0][firstlevel]; + firstImage = t->base.Image[0][t->minLod]; if (!t->image_override) { if (!r600GetTexFormat(texObj, firstImage->TexFormat)) { @@ -692,7 +691,8 @@ static void setup_hardware_state(context_t *rmesa, struct gl_texture_object *tex } row_align = rmesa->radeon.texture_row_align - 1; - uTexelPitch = ((firstImage->Width * t->mt->bpp + row_align) & ~row_align) / t->mt->bpp; + uTexelPitch = (_mesa_format_row_stride(firstImage->TexFormat, firstImage->Width) + row_align) & ~row_align; + uTexelPitch = uTexelPitch / _mesa_get_format_bytes(firstImage->TexFormat); uTexelPitch = (uTexelPitch + R700_TEXEL_PITCH_ALIGNMENT_MASK) & ~R700_TEXEL_PITCH_ALIGNMENT_MASK; @@ -706,10 +706,10 @@ static void setup_hardware_state(context_t *rmesa, struct gl_texture_object *tex SETfield(t->SQ_TEX_RESOURCE1, firstImage->Height - 1, TEX_HEIGHT_shift, TEX_HEIGHT_mask); - if ((t->mt->lastLevel - t->mt->firstLevel) > 0) { - t->SQ_TEX_RESOURCE3 = t->mt->levels[0].size / 256; - SETfield(t->SQ_TEX_RESOURCE4, t->mt->firstLevel, BASE_LEVEL_shift, BASE_LEVEL_mask); - SETfield(t->SQ_TEX_RESOURCE5, t->mt->lastLevel, LAST_LEVEL_shift, LAST_LEVEL_mask); + if ((t->maxLod - t->minLod) > 0) { + t->SQ_TEX_RESOURCE3 = t->mt->levels[t->minLod].size / 256; + SETfield(t->SQ_TEX_RESOURCE4, 0, BASE_LEVEL_shift, BASE_LEVEL_mask); + SETfield(t->SQ_TEX_RESOURCE5, t->maxLod - t->minLod, LAST_LEVEL_shift, LAST_LEVEL_mask); } } @@ -808,9 +808,8 @@ void r600SetTexOffset(__DRIcontext * pDRICtx, GLint texname, struct gl_texture_object *tObj = _mesa_lookup_texture(rmesa->radeon.glCtx, texname); radeonTexObjPtr t = radeon_tex_obj(tObj); - int firstlevel = t->mt ? t->mt->firstLevel : 0; const struct gl_texture_image *firstImage; - uint32_t pitch_val, size, row_align, bpp; + uint32_t pitch_val, size, row_align; if (!tObj) return; @@ -820,13 +819,9 @@ void r600SetTexOffset(__DRIcontext * pDRICtx, GLint texname, if (!offset) return; - bpp = depth / 8; - if (bpp == 3) - bpp = 4; - - firstImage = t->base.Image[0][firstlevel]; + firstImage = t->base.Image[0][t->minLod]; row_align = rmesa->radeon.texture_row_align - 1; - size = ((firstImage->Width * bpp + row_align) & ~row_align) * firstImage->Height; + size = ((_mesa_format_row_stride(firstImage->TexFormat, firstImage->Width) + row_align) & ~row_align) * firstImage->Height; if (t->bo) { radeon_bo_unref(t->bo); t->bo = NULL; @@ -949,14 +944,10 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo radeon_bo_unref(rImage->bo); rImage->bo = NULL; } - if (t->mt) { - radeon_miptree_unreference(t->mt); - t->mt = NULL; - } - if (rImage->mt) { - radeon_miptree_unreference(rImage->mt); - rImage->mt = NULL; - } + + radeon_miptree_unreference(&t->mt); + radeon_miptree_unreference(&rImage->mt); + _mesa_init_teximage_fields(radeon->glCtx, target, texImage, rb->base.Width, rb->base.Height, 1, 0, rb->cpp); texImage->RowStride = rb->pitch / rb->cpp; diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index ec76fbcb6d..2b2b4d748f 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -54,11 +54,15 @@ static void r700SendTexState(GLcontext *ctx, struct radeon_state_atom *atom) for (i = 0; i < R700_TEXTURE_NUMBERUNITS; i++) { if (ctx->Texture.Unit[i]._ReallyEnabled) { radeonTexObj *t = r700->textures[i]; + uint32_t offset; if (t) { - if (!t->image_override) + if (!t->image_override) { bo = t->mt->bo; - else + offset = get_base_teximage_offset(t); + } else { bo = t->bo; + offset = 0; + } if (bo) { r700SyncSurf(context, bo, @@ -77,7 +81,7 @@ static void r700SendTexState(GLcontext *ctx, struct radeon_state_atom *atom) R600_OUT_BATCH(r700->textures[i]->SQ_TEX_RESOURCE6); R600_OUT_BATCH_RELOC(r700->textures[i]->SQ_TEX_RESOURCE2, bo, - 0, + offset, RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); R600_OUT_BATCH_RELOC(r700->textures[i]->SQ_TEX_RESOURCE3, bo, -- cgit v1.2.3 From 3bf12c8bea667f5fff0b6f495820a27141f595a2 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 18 Nov 2009 22:19:25 +0100 Subject: r300: allow disabling s3tc support if libtxc_dxtn is available --- src/mesa/drivers/dri/r300/r300_context.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 3ed49a85c5..5f07b95634 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -439,11 +439,11 @@ static void r300InitGLExtensions(GLcontext *ctx) if (r300->options.stencil_two_side_disabled) _mesa_disable_extension(ctx, "GL_EXT_stencil_two_side"); - if (ctx->Mesa_DXTn || r300->options.s3tc_force_enabled) { + if (r300->options.s3tc_force_disabled) { + _mesa_disable_extension(ctx, "GL_EXT_texture_compression_s3tc"); + } else if (ctx->Mesa_DXTn || r300->options.s3tc_force_enabled) { _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); _mesa_enable_extension(ctx, "GL_S3_s3tc"); - } else if (r300->options.s3tc_force_disabled) { - _mesa_disable_extension(ctx, "GL_EXT_texture_compression_s3tc"); } if (!r300->radeon.radeonScreen->drmSupportsOcclusionQueries) { -- cgit v1.2.3 From e73553bff74a41f08cba9d52b5fec19f15ab3d48 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 18 Nov 2009 19:51:57 +0000 Subject: st/xorg: Use the correct DRI2BufferPtr struct on 1.6.4 servers --- src/gallium/state_trackers/xorg/xorg_dri2.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index c41a7cd639..adc9531dbd 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -137,6 +137,11 @@ driDoCreateBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int format) buffer->cpp = 4; buffer->driverPrivate = private; buffer->flags = 0; /* not tiled */ +#if defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION == 2 + ((DRI2Buffer2Ptr)buffer)->format = 0; +#elif defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION >= 3 + buffer->format = 0; +#endif private->tex = tex; return TRUE; @@ -157,12 +162,12 @@ driDoDestroyBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer) (*pScreen->DestroyPixmap)(private->pPixmap); } -#if defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION > 2 +#if defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION >= 2 -static DRI2BufferPtr +static DRI2Buffer2Ptr driCreateBuffer(DrawablePtr pDraw, unsigned int attachment, unsigned int format) { - DRI2BufferPtr buffer; + DRI2Buffer2Ptr buffer; BufferPrivatePtr private; buffer = xcalloc(1, sizeof *buffer); @@ -177,7 +182,8 @@ driCreateBuffer(DrawablePtr pDraw, unsigned int attachment, unsigned int format) buffer->attachment = attachment; buffer->driverPrivate = private; - if (driDoCreateBuffer(pDraw, buffer, format)) + /* So far it is safe to downcast a DRI2Buffer2Ptr to DRI2BufferPtr */ + if (driDoCreateBuffer(pDraw, (DRI2BufferPtr)buffer, format)) return buffer; xfree(private); @@ -187,15 +193,16 @@ fail: } static void -driDestroyBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer) +driDestroyBuffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer) { - driDoDestroyBuffer(pDraw, buffer); + /* So far it is safe to downcast a DRI2Buffer2Ptr to DRI2BufferPtr */ + driDoDestroyBuffer(pDraw, (DRI2BufferPtr)buffer); xfree(buffer->driverPrivate); xfree(buffer); } -#else /* DRI2INFOREC_VERSION <= 2 */ +#else /* !defined(DRI2INFOREC_VERSION) || DRI2INFOREC_VERSION < 2 */ static DRI2BufferPtr driCreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count) @@ -245,7 +252,7 @@ driDestroyBuffers(DrawablePtr pDraw, DRI2BufferPtr buffers, int count) } } -#endif /* DRI2INFOREC_VERSION */ +#endif /* defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION >= 2 */ static void driCopyRegion(DrawablePtr pDraw, RegionPtr pRegion, @@ -352,7 +359,7 @@ driScreenInit(ScreenPtr pScreen) dri2info.driverName = pScrn->driverName; dri2info.deviceName = "/dev/dri/card0"; /* FIXME */ -#if defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION > 2 +#if defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION >= 2 dri2info.CreateBuffer = driCreateBuffer; dri2info.DestroyBuffer = driDestroyBuffer; #else -- cgit v1.2.3 From 9ab3c70f6568d980c3910d7ea8a3032445eaf49f Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 18 Nov 2009 19:56:50 +0000 Subject: st/xorg: Make the #if more easier to read --- src/gallium/state_trackers/xorg/xorg_dri2.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index adc9531dbd..bd4acf7f82 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -42,6 +42,12 @@ #include "util/u_rect.h" +/* Make all the #if cases in the code esier to read */ +/* XXX can it be set to 1? */ +#ifndef DRI2INFOREC_VERSION +#define DRI2INFOREC_VERSION 0 +#endif + typedef struct { PixmapPtr pPixmap; struct pipe_texture *tex; @@ -79,7 +85,7 @@ driDoCreateBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int format) case DRI2BufferFrontLeft: break; case DRI2BufferStencil: -#if defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION > 2 +#if DRI2INFOREC_VERSION >= 3 case DRI2BufferDepthStencil: #else /* Works on old X servers because sanity checking is for the weak */ @@ -137,9 +143,9 @@ driDoCreateBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int format) buffer->cpp = 4; buffer->driverPrivate = private; buffer->flags = 0; /* not tiled */ -#if defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION == 2 +#if DRI2INFOREC_VERSION == 2 ((DRI2Buffer2Ptr)buffer)->format = 0; -#elif defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION >= 3 +#elif DRI2INFOREC_VERSION >= 3 buffer->format = 0; #endif private->tex = tex; @@ -162,7 +168,7 @@ driDoDestroyBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer) (*pScreen->DestroyPixmap)(private->pPixmap); } -#if defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION >= 2 +#if DRI2INFOREC_VERSION >= 2 static DRI2Buffer2Ptr driCreateBuffer(DrawablePtr pDraw, unsigned int attachment, unsigned int format) @@ -202,7 +208,7 @@ driDestroyBuffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer) xfree(buffer); } -#else /* !defined(DRI2INFOREC_VERSION) || DRI2INFOREC_VERSION < 2 */ +#else /* DRI2INFOREC_VERSION < 2 */ static DRI2BufferPtr driCreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count) @@ -252,7 +258,7 @@ driDestroyBuffers(DrawablePtr pDraw, DRI2BufferPtr buffers, int count) } } -#endif /* defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION >= 2 */ +#endif /* DRI2INFOREC_VERSION >= 2 */ static void driCopyRegion(DrawablePtr pDraw, RegionPtr pRegion, @@ -349,7 +355,7 @@ driScreenInit(ScreenPtr pScreen) modesettingPtr ms = modesettingPTR(pScrn); DRI2InfoRec dri2info; -#if defined(DRI2INFOREC_VERSION) +#if DRI2INFORCE_VERSION >= 2 dri2info.version = DRI2INFOREC_VERSION; #else dri2info.version = 1; @@ -359,7 +365,7 @@ driScreenInit(ScreenPtr pScreen) dri2info.driverName = pScrn->driverName; dri2info.deviceName = "/dev/dri/card0"; /* FIXME */ -#if defined(DRI2INFOREC_VERSION) && DRI2INFOREC_VERSION >= 2 +#if DRI2INFOREC_VERSION >= 2 dri2info.CreateBuffer = driCreateBuffer; dri2info.DestroyBuffer = driDestroyBuffer; #else -- cgit v1.2.3 From e12c9a6f3af6ec10cbd2e5cd2a6b90056652a2c0 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 18 Nov 2009 22:50:26 +0000 Subject: st/xorg: Init all functions and fix spelling --- src/gallium/state_trackers/xorg/xorg_dri2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index bd4acf7f82..aca889d6f8 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -355,7 +355,7 @@ driScreenInit(ScreenPtr pScreen) modesettingPtr ms = modesettingPTR(pScrn); DRI2InfoRec dri2info; -#if DRI2INFORCE_VERSION >= 2 +#if DRI2INFOREC_VERSION >= 2 dri2info.version = DRI2INFOREC_VERSION; #else dri2info.version = 1; @@ -368,6 +368,8 @@ driScreenInit(ScreenPtr pScreen) #if DRI2INFOREC_VERSION >= 2 dri2info.CreateBuffer = driCreateBuffer; dri2info.DestroyBuffer = driDestroyBuffer; + dri2info.CreateBuffers = NULL; + dri2info.DestroyBuffers = NULL; #else dri2info.CreateBuffers = driCreateBuffers; dri2info.DestroyBuffers = driDestroyBuffers; -- cgit v1.2.3 From 61a3716ab5ad72ed2d2e926055716be99a4b2abd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 18 Nov 2009 07:25:33 -0700 Subject: mesa: bump version to 7.8 --- src/mesa/main/version.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index 0cae1860a3..dc55cb7ccc 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -1,6 +1,6 @@ /* * Mesa 3-D graphics library - * Version: 7.7 + * Version: 7.8 * * Copyright (C) 1999-2008 Brian Paul All Rights Reserved. * Copyright (C) 2009 VMware, Inc. All Rights Reserved. @@ -30,9 +30,9 @@ /* Mesa version */ #define MESA_MAJOR 7 -#define MESA_MINOR 7 +#define MESA_MINOR 8 #define MESA_PATCH 0 -#define MESA_VERSION_STRING "7.7-devel" +#define MESA_VERSION_STRING "7.8-devel" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -- cgit v1.2.3 From d449c07b8bfd1789b4f643b0eb0b1fac5314ebbe Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 18 Nov 2009 08:07:56 -0700 Subject: xorg/st: fixup builds against later dpms headers. (cherry picked from master, commit e9d6ab72be065becf7a077c33919d37faa8db92e) --- src/gallium/state_trackers/xorg/xorg_crtc.c | 4 ++++ src/gallium/state_trackers/xorg/xorg_output.c | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index fe08bde9ef..67fe29a69d 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -42,8 +42,12 @@ #include "xorg_tracker.h" #include "xf86Modes.h" +#ifdef HAVE_XEXTPROTO_71 +#include +#else #define DPMS_SERVER #include +#endif #include "pipe/p_inlines.h" #include "util/u_rect.h" diff --git a/src/gallium/state_trackers/xorg/xorg_output.c b/src/gallium/state_trackers/xorg/xorg_output.c index 950af942f5..26f45f8d64 100644 --- a/src/gallium/state_trackers/xorg/xorg_output.c +++ b/src/gallium/state_trackers/xorg/xorg_output.c @@ -42,8 +42,12 @@ #include #include +#ifdef HAVE_XEXTPROTO_71 +#include +#else #define DPMS_SERVER #include +#endif #include "X11/Xatom.h" -- cgit v1.2.3 From 027abddf4f47163276f55c2fa8f81408b652f072 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 18 Nov 2009 08:08:25 -0700 Subject: mesa: set version string to 7.6.1-rc1 --- src/mesa/main/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index f24e11cc51..3e9143979a 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -32,7 +32,7 @@ #define MESA_MAJOR 7 #define MESA_MINOR 6 #define MESA_PATCH 1 -#define MESA_VERSION_STRING "7.6.1-devel" +#define MESA_VERSION_STRING "7.6.1-rc1" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -- cgit v1.2.3 From 13b5a624b1899c457279907d58046dfb3c95addc Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 18 Nov 2009 11:27:36 -0500 Subject: Revert "radeon: Fix legacy bo not to reuse dma buffers before refcount is 1." This reverts commit 284a7af274bc148f112bd0ebb40583923ee26b49. This breaks kde desktop effects. See fdo bug 24131 --- src/mesa/drivers/dri/radeon/radeon_dma.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_dma.c b/src/mesa/drivers/dri/radeon/radeon_dma.c index c6edbae9a1..c9a32c808b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_dma.c +++ b/src/mesa/drivers/dri/radeon/radeon_dma.c @@ -207,6 +207,7 @@ again_alloc: counter on unused buffers for later freeing them from begin of list */ dma_bo = last_elem(&rmesa->dma.free); + assert(dma_bo->bo->cref == 1); remove_from_list(dma_bo); insert_at_head(&rmesa->dma.reserved, dma_bo); } @@ -306,10 +307,6 @@ static int radeon_bo_is_idle(struct radeon_bo* bo) WARN_ONCE("Your libdrm or kernel doesn't have support for busy query.\n" "This may cause small performance drop for you.\n"); } - /* Protect against bug in legacy bo handling that causes bos stay - * referenced even after they should be freed */ - if (bo->cref != 1) - return 0; return ret != -EBUSY; } @@ -346,9 +343,7 @@ void radeonReleaseDmaRegions(radeonContextPtr rmesa) foreach_s(dma_bo, temp, &rmesa->dma.wait) { if (dma_bo->expire_counter == time) { WARN_ONCE("Leaking dma buffer object!\n"); - /* force free of buffer so we don't realy start - * leaking stuff now*/ - while ((dma_bo->bo = radeon_bo_unref(dma_bo->bo))) {} + radeon_bo_unref(dma_bo->bo); remove_from_list(dma_bo); FREE(dma_bo); continue; -- cgit v1.2.3 From 08cb1d0ce4765536f1cb6a9253a2245c31fb8ea9 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 00:03:10 -0800 Subject: st/xorg: Fix type of 'unknown'. --- src/gallium/state_trackers/xorg/xorg_composite.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 86a52077c3..dd10e12867 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -152,7 +152,7 @@ render_filter_to_gallium(int xrender_filter, int *out_filter) *out_filter = PIPE_TEX_FILTER_LINEAR; break; default: - debug_printf("Unkown xrender filter\n"); + debug_printf("Unknown xrender filter\n"); case PictFilterConvolution: *out_filter = PIPE_TEX_FILTER_NEAREST; return FALSE; -- cgit v1.2.3 From c4e8918cd248189d43cdc8df9f9f0450040261c5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 20 Nov 2009 21:42:06 +0100 Subject: mesa: Fix NULL deref in optimizer when NumInstructions == 0. Bug #24984. --- src/mesa/shader/prog_optimize.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/prog_optimize.c b/src/mesa/shader/prog_optimize.c index 3d28d885a4..4fe351251e 100644 --- a/src/mesa/shader/prog_optimize.c +++ b/src/mesa/shader/prog_optimize.c @@ -443,7 +443,7 @@ _mesa_remove_extra_move_use(struct gl_program *prog) * FOO tmpY, arg0, arg1; */ - for (i = 0; i < prog->NumInstructions - 1; i++) { + for (i = 0; i + 1 < prog->NumInstructions; i++) { const struct prog_instruction *mov = prog->Instructions + i; if (mov->Opcode != OPCODE_MOV || -- cgit v1.2.3 From 1dbf3642b9c1c37f72e2212ce78056cf8959a957 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Fri, 20 Nov 2009 18:08:29 +0000 Subject: Fix memory leak. --- src/gallium/drivers/softpipe/sp_state_fs.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c index 256faa94b8..b41f7e8ab7 100644 --- a/src/gallium/drivers/softpipe/sp_state_fs.c +++ b/src/gallium/drivers/softpipe/sp_state_fs.c @@ -143,6 +143,7 @@ softpipe_delete_vs_state(struct pipe_context *pipe, void *vs) struct sp_vertex_shader *state = (struct sp_vertex_shader *) vs; draw_delete_vertex_shader(softpipe->draw, state->draw_data); + FREE( (void *)state->shader.tokens ); FREE( state ); } -- cgit v1.2.3 From 910b58039a3980d9857380cf367bdbe2395d791f Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Fri, 20 Nov 2009 18:09:10 +0000 Subject: Fix vega compilation. --- src/gallium/state_trackers/vega/arc.c | 6 ++++-- src/gallium/state_trackers/vega/bezier.c | 7 +++++-- src/gallium/state_trackers/vega/vg_context.c | 4 +++- 3 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/vega/arc.c b/src/gallium/state_trackers/vega/arc.c index e74c7f0334..8b04d21ea7 100644 --- a/src/gallium/state_trackers/vega/arc.c +++ b/src/gallium/state_trackers/vega/arc.c @@ -528,6 +528,7 @@ static INLINE int num_beziers_needed(struct arc *arc) double threshold = 0.05; VGboolean found = VG_FALSE; int n = 1; + int i; double min_eta, max_eta; min_eta = MIN2(arc->eta1, arc->eta2); @@ -538,7 +539,7 @@ static INLINE int num_beziers_needed(struct arc *arc) if (d_eta <= 0.5 * M_PI) { double eta_b = min_eta; found = VG_TRUE; - for (int i = 0; found && (i < n); ++i) { + for (i = 0; found && (i < n); ++i) { double etaA = eta_b; eta_b += d_eta; found = (estimate_error(arc, etaA, eta_b) <= threshold); @@ -554,6 +555,7 @@ static void arc_to_beziers(struct arc *arc, struct arc_cb cb, struct matrix *matrix) { + int i; int n = 1; double d_eta, eta_b, cos_eta_b, sin_eta_b, a_cos_eta_b, b_sin_eta_b, a_sin_eta_b, @@ -607,7 +609,7 @@ static void arc_to_beziers(struct arc *arc, t = tan(0.5 * d_eta); alpha = sin(d_eta) * (sqrt(4 + 3 * t * t) - 1) / 3; - for (int i = 0; i < n; ++i) { + for (i = 0; i < n; ++i) { struct bezier bezier; double xA = x_b; double yA = y_b; diff --git a/src/gallium/state_trackers/vega/bezier.c b/src/gallium/state_trackers/vega/bezier.c index 39a7ade016..0d5504004c 100644 --- a/src/gallium/state_trackers/vega/bezier.c +++ b/src/gallium/state_trackers/vega/bezier.c @@ -255,7 +255,9 @@ static enum shift_result good_offset(const struct bezier *b1, const float max_dist_line = threshold*offset*offset; const float max_dist_normal = threshold*offset; const float spacing = 0.25; - for (float i = spacing; i < 0.99; i += spacing) { + float i; + + for (i = spacing; i < 0.99; i += spacing) { float p1[2],p2[2], d, l; float normal[2]; bezier_point_at(b1, i, p1); @@ -330,6 +332,7 @@ static enum shift_result shift(const struct bezier *orig, struct bezier *shifted, float offset, float threshold) { + int i; int map[4]; VGboolean p1_p2_equal = (orig->x1 == orig->x2 && orig->y1 == orig->y2); VGboolean p2_p3_equal = (orig->x2 == orig->x3 && orig->y2 == orig->y3); @@ -404,7 +407,7 @@ static enum shift_result shift(const struct bezier *orig, points_shifted[0][0] = points[0][0] + offset * prev_normal[0]; points_shifted[0][1] = points[0][1] + offset * prev_normal[1]; - for (int i = 1; i < np - 1; ++i) { + for (i = 1; i < np - 1; ++i) { float normal_sum[2], r; float next_normal[2]; compute_pt_normal(points[i], points[i + 1], next_normal); diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c index e0ff02f3a9..00d23f5c22 100644 --- a/src/gallium/state_trackers/vega/vg_context.c +++ b/src/gallium/state_trackers/vega/vg_context.c @@ -231,6 +231,8 @@ static void update_clip_state(struct vg_context *ctx) if (state->scissoring) { struct pipe_blend_state *blend = &ctx->state.g3d.blend; struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb; + int i; + dsa->depth.writemask = 1;/*glDepthMask(TRUE);*/ dsa->depth.func = PIPE_FUNC_ALWAYS; dsa->depth.enabled = 1; @@ -254,7 +256,7 @@ static void update_clip_state(struct vg_context *ctx) cso_set_blend(ctx->cso_context, blend); /* enable scissoring */ - for (int i = 0; i < state->scissor_rects_num; ++i) { + for (i = 0; i < state->scissor_rects_num; ++i) { const float x = state->scissor_rects[i * 4 + 0].f; const float y = state->scissor_rects[i * 4 + 1].f; const float width = state->scissor_rects[i * 4 + 2].f; -- cgit v1.2.3 From 8d6da811d4fff50dc42e71c6149759908a458f7f Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 18 Nov 2009 17:38:49 +0100 Subject: st/xorg: Unbind any textures in solid Helps debuging with rbug --- src/gallium/state_trackers/xorg/xorg_composite.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index dd10e12867..eed7a7d63a 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -565,6 +565,8 @@ boolean xorg_solid_bind_state(struct exa_context *exa, renderer_bind_viewport(exa->renderer, pixmap); renderer_bind_rasterizer(exa->renderer); bind_blend_state(exa, PictOpSrc, NULL, NULL, NULL); + cso_set_samplers(exa->renderer->cso, 0, NULL); + cso_set_sampler_textures(exa->renderer->cso, 0, NULL); setup_constant_buffers(exa, pixmap); shader = xorg_shaders_get(exa->renderer->shaders, vs_traits, fs_traits); -- cgit v1.2.3 From 5109484bd9cd79ed88af59280bd0be5a4150f37c Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 18 Nov 2009 17:45:39 +0100 Subject: st/xorg: Flush any pending operations on upload --- src/gallium/state_trackers/xorg/xorg_exa.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 3a51ad2d59..3d83b5700d 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -230,6 +230,11 @@ ExaUploadToScreen(PixmapPtr pPix, int x, int y, int w, int h, char *src, if (!priv || !priv->tex) return FALSE; + /* make sure that any pending operations are flushed to hardware */ + if (exa->pipe->is_texture_referenced(exa->pipe, priv->tex, 0, 0) & + (PIPE_REFERENCED_FOR_READ | PIPE_REFERENCED_FOR_WRITE)) + xorg_exa_flush(exa, 0, NULL); + transfer = exa->scrn->get_tex_transfer(exa->scrn, priv->tex, 0, 0, 0, PIPE_TRANSFER_WRITE, x, y, w, h); if (!transfer) -- cgit v1.2.3 From fe5c46546e740a16a13fe9e8aaa4b071bc13d70b Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Wed, 18 Nov 2009 11:51:20 -0500 Subject: r600: disable compressed texture support It's not implemented yet. fixes fdo bug 24047 --- src/mesa/drivers/dri/r600/r600_context.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index e0b77d4385..8dab57b433 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -362,6 +362,7 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual, (&r600->radeon.optionCache, "disable_stencil_two_side")) _mesa_disable_extension(ctx, "GL_EXT_stencil_two_side"); +#if 0 if (r600->radeon.glCtx->Mesa_DXTn && !driQueryOptionb(&r600->radeon.optionCache, "disable_s3tc")) { _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); @@ -371,6 +372,9 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual, { _mesa_enable_extension(ctx, "GL_EXT_texture_compression_s3tc"); } +#else + _mesa_disable_extension(ctx, "GL_ARB_texture_compression"); +#endif radeon_fbo_init(&r600->radeon); radeonInitSpanFuncs( ctx ); -- cgit v1.2.3 From fafc016e1f298cfea332124e9d64e8e010ee9c45 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 18 Nov 2009 12:06:32 -0500 Subject: st/xorg: enable yv12 for xv --- src/gallium/state_trackers/xorg/xorg_xv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index 2b935c0f73..5794395771 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -73,10 +73,11 @@ static XF86VideoEncodingRec DummyEncoding[1] = { } }; -#define NUM_IMAGES 2 +#define NUM_IMAGES 3 static XF86ImageRec Images[NUM_IMAGES] = { XVIMAGE_UYVY, XVIMAGE_YUY2, + XVIMAGE_YV12, }; struct xorg_xv_port_priv { @@ -537,6 +538,7 @@ put_image(ScrnInfoPtr pScrn, switch (id) { case FOURCC_UYVY: case FOURCC_YUY2: + case FOURCC_YV12: default: srcPitch = width << 1; break; @@ -585,6 +587,7 @@ query_image_attributes(ScrnInfoPtr pScrn, switch (id) { case FOURCC_UYVY: case FOURCC_YUY2: + case FOURCC_YV12: default: size = *w << 1; if (pitches) -- cgit v1.2.3 From 3132853e1242607d5ff62785cd7dad5ef3a783d0 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Tue, 17 Nov 2009 16:25:02 -0500 Subject: r600 : Initial version of glsl fc. --- src/mesa/drivers/dri/r600/r700_assembler.c | 2572 ++++++++++++++++++++++++---- src/mesa/drivers/dri/r600/r700_assembler.h | 111 +- src/mesa/drivers/dri/r600/r700_chip.c | 99 +- src/mesa/drivers/dri/r600/r700_fragprog.c | 94 +- src/mesa/drivers/dri/r600/r700_shader.c | 9 +- src/mesa/drivers/dri/r600/r700_shader.h | 3 +- src/mesa/drivers/dri/r600/r700_vertprog.c | 21 +- 7 files changed, 2507 insertions(+), 402 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index e0d7d4fa6b..4b5d40bd3a 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -38,6 +38,8 @@ #include "r700_assembler.h" +#define USE_CF_FOR_CONTINUE_BREAK 1 + BITS addrmode_PVSDST(PVSDST * pPVSDST) { return pPVSDST->addrmode0 | ((BITS)pPVSDST->addrmode1 << 1); @@ -343,6 +345,8 @@ unsigned int r700GetNumOperands(r700_AssemblerBase* pAsm) case SQ_OP2_INST_MIN: //case SQ_OP2_INST_MAX_DX10: //case SQ_OP2_INST_MIN_DX10: + case SQ_OP2_INST_SETE: + case SQ_OP2_INST_SETNE: case SQ_OP2_INST_SETGT: case SQ_OP2_INST_SETGE: case SQ_OP2_INST_PRED_SETE: @@ -398,6 +402,9 @@ int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700 pAsm->number_of_exports = 0; pAsm->number_of_export_opcodes = 0; + pAsm->alu_x_opcode = 0; + + pAsm->D2.bits = 0; pAsm->D.bits = 0; pAsm->S[0].bits = 0; @@ -474,6 +481,22 @@ int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700 pAsm->is_tex = GL_FALSE; pAsm->need_tex_barrier = GL_FALSE; + pAsm->subs = NULL; + pAsm->unSubArraySize = 0; + pAsm->unSubArrayPointer = 0; + pAsm->callers = NULL; + pAsm->unCallerArraySize = 0; + pAsm->unCallerArrayPointer = 0; + + pAsm->CALLSP = 0; + pAsm->CALLSTACK[0].FCSP_BeforeEntry; + pAsm->CALLSTACK[0].plstCFInstructions_local + = &(pAsm->pR700Shader->lstCFInstructions); + + SetActiveCFlist(pAsm->pR700Shader, pAsm->CALLSTACK[0].plstCFInstructions_local); + + pAsm->unCFflags = 0; + return 0; } @@ -592,6 +615,31 @@ int check_current_clause(r700_AssemblerBase* pAsm, return GL_TRUE; } +GLboolean add_cf_instruction(r700_AssemblerBase* pAsm) +{ + if(GL_FALSE == check_current_clause(pAsm, CF_OTHER_CLAUSE)) + { + return GL_FALSE; + } + + pAsm->cf_current_cf_clause_ptr = + (R700ControlFlowGenericClause*) CALLOC_STRUCT(R700ControlFlowGenericClause); + + if (pAsm->cf_current_cf_clause_ptr != NULL) + { + Init_R700ControlFlowGenericClause(pAsm->cf_current_cf_clause_ptr); + AddCFInstruction( pAsm->pR700Shader, + (R700ControlFlowInstruction *)pAsm->cf_current_cf_clause_ptr ); + } + else + { + radeon_error("Could not allocate a new VFetch CF instruction.\n"); + return GL_FALSE; + } + + return GL_TRUE; +} + GLboolean add_vfetch_instruction(r700_AssemblerBase* pAsm, R700VertexInstruction* vertex_instruction_ptr) { @@ -1153,6 +1201,7 @@ GLboolean assemble_src(r700_AssemblerBase *pAsm, case PROGRAM_LOCAL_PARAM: case PROGRAM_ENV_PARAM: case PROGRAM_STATE_VAR: + case PROGRAM_UNIFORM: if (1 == pILInst->SrcReg[src].RelAddr) { setaddrmode_PVSSRC(&(pAsm->S[fld].src), ADDR_RELATIVE_A0); @@ -1179,7 +1228,7 @@ GLboolean assemble_src(r700_AssemblerBase *pAsm, } break; default: - radeon_error("Invalid source argument type\n"); + radeon_error("Invalid source argument type : %d \n", pILInst->SrcReg[src].File); return GL_FALSE; } } @@ -1315,7 +1364,7 @@ GLboolean tex_src(r700_AssemblerBase *pAsm) case FRAG_ATTRIB_TEX0: case FRAG_ATTRIB_TEX1: case FRAG_ATTRIB_TEX2: - case FRAG_ATTRIB_TEX3: + case FRAG_ATTRIB_TEX3: case FRAG_ATTRIB_TEX4: case FRAG_ATTRIB_TEX5: case FRAG_ATTRIB_TEX6: @@ -1335,6 +1384,16 @@ GLboolean tex_src(r700_AssemblerBase *pAsm) fprintf(stderr, "FRAG_ATTRIB_VAR0 unsupported\n"); break; } + + if( (pILInst->SrcReg[0].Index >= FRAG_ATTRIB_VAR0) || + (pILInst->SrcReg[0].Index < FRAG_ATTRIB_MAX) ) + { + bValidTexCoord = GL_TRUE; + pAsm->S[0].src.reg = + pAsm->uiFP_AttributeMap[pILInst->SrcReg[0].Index]; + pAsm->S[0].src.rtype = SRC_REG_INPUT; + } + break; } } @@ -1517,6 +1576,10 @@ GLboolean assemble_alu_src(R700ALUInstruction* alu_instruction_ptr, { src_sel = pSource->reg + CFILE_REGISTER_OFFSET; } + else if (pSource->rtype == SRC_REC_LITERAL) + { + src_sel = SQ_ALU_SRC_LITERAL; + } else { radeon_error("Source (%d) register type (%d) not one of TEMP, INPUT, or CONSTANT.\n", @@ -1606,7 +1669,8 @@ GLboolean add_alu_instruction(r700_AssemblerBase* pAsm, return GL_FALSE; } - if ( pAsm->cf_current_alu_clause_ptr == NULL || + if ( pAsm->alu_x_opcode != 0 || + pAsm->cf_current_alu_clause_ptr == NULL || ( (pAsm->cf_current_alu_clause_ptr != NULL) && (pAsm->cf_current_alu_clause_ptr->m_Word1.f.count >= (GetCFMaxInstructions(pAsm->cf_current_alu_clause_ptr->m_ShaderInstType)-contiguous_slots_needed-1) ) ) ) @@ -1636,9 +1700,17 @@ GLboolean add_alu_instruction(r700_AssemblerBase* pAsm, pAsm->cf_current_alu_clause_ptr->m_Word1.f.kcache_addr0 = 0x0; pAsm->cf_current_alu_clause_ptr->m_Word1.f.kcache_addr1 = 0x0; - //cf_current_alu_clause_ptr->m_Word1.f.count = number_of_scalar_operations - 1; pAsm->cf_current_alu_clause_ptr->m_Word1.f.count = 0x0; - pAsm->cf_current_alu_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_ALU; + + if(pAsm->alu_x_opcode != 0) + { + pAsm->cf_current_alu_clause_ptr->m_Word1.f.cf_inst = pAsm->alu_x_opcode; + pAsm->alu_x_opcode = 0; + } + else + { + pAsm->cf_current_alu_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_ALU; + } pAsm->cf_current_alu_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; @@ -2358,146 +2430,711 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) return GL_TRUE; } -GLboolean next_ins(r700_AssemblerBase *pAsm) +GLboolean assemble_alu_instruction2(r700_AssemblerBase *pAsm) { - struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); + GLuint number_of_scalar_operations; + GLboolean is_single_scalar_operation; + GLuint scalar_channel_index; - if( GL_TRUE == pAsm->is_tex ) + PVSSRC * pcurrent_source; + int current_source_index; + GLuint contiguous_slots_needed; + + GLuint uNumSrc = r700GetNumOperands(pAsm); + + GLboolean bSplitInst = GL_FALSE; + + if (1 == pAsm->D.dst.math) { - if (pILInst->TexSrcTarget == TEXTURE_RECT_INDEX) { - if( GL_FALSE == assemble_tex_instruction(pAsm, GL_FALSE) ) - { - radeon_error("Error assembling TEX instruction\n"); - return GL_FALSE; - } - } else { - if( GL_FALSE == assemble_tex_instruction(pAsm, GL_TRUE) ) - { - radeon_error("Error assembling TEX instruction\n"); - return GL_FALSE; - } - } + is_single_scalar_operation = GL_TRUE; + number_of_scalar_operations = 1; } else - { //ALU - if( GL_FALSE == assemble_alu_instruction(pAsm) ) - { - radeon_error("Error assembling ALU instruction\n"); - return GL_FALSE; - } - } - - if(pAsm->D.dst.rtype == DST_REG_OUT) { - if(pAsm->D.dst.op3) - { - // There is no mask for OP3 instructions, so all channels are written - pAsm->pucOutMask[pAsm->D.dst.reg - pAsm->starting_export_register_number] = 0xF; - } - else - { - pAsm->pucOutMask[pAsm->D.dst.reg - pAsm->starting_export_register_number] - |= (unsigned char)pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask; - } + is_single_scalar_operation = GL_FALSE; + number_of_scalar_operations = 4; } - - //reset for next inst. - pAsm->D.bits = 0; - pAsm->S[0].bits = 0; - pAsm->S[1].bits = 0; - pAsm->S[2].bits = 0; - pAsm->is_tex = GL_FALSE; - pAsm->need_tex_barrier = GL_FALSE; - return GL_TRUE; -} - -GLboolean assemble_math_function(r700_AssemblerBase* pAsm, BITS opcode) -{ - BITS tmp; - - checkop1(pAsm); - - tmp = gethelpr(pAsm); - - // opcode tmp.x, a.x - // MOV dst, tmp.x - pAsm->D.dst.opcode = opcode; - pAsm->D.dst.math = 1; - - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - pAsm->D.dst.writex = 1; + contiguous_slots_needed = 0; - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + if(GL_TRUE == is_reduction_opcode(&(pAsm->D)) ) { - return GL_FALSE; + contiguous_slots_needed = 4; } - if ( GL_FALSE == next_ins(pAsm) ) + initialize(pAsm); + + for (scalar_channel_index=0; + scalar_channel_index < number_of_scalar_operations; + scalar_channel_index++) { - return GL_FALSE; - } + R700ALUInstruction* alu_instruction_ptr = (R700ALUInstruction*) CALLOC_STRUCT(R700ALUInstruction); + if (alu_instruction_ptr == NULL) + { + return GL_FALSE; + } + Init_R700ALUInstruction(alu_instruction_ptr); + + //src 0 + current_source_index = 0; + pcurrent_source = &(pAsm->S[0].src); - // Now replicate result to all necessary channels in destination - pAsm->D.dst.opcode = SQ_OP2_INST_MOV; + if (GL_FALSE == assemble_alu_src(alu_instruction_ptr, + current_source_index, + pcurrent_source, + scalar_channel_index) ) + { + return GL_FALSE; + } + + if (uNumSrc > 1) + { + // Process source 1 + current_source_index = 1; + pcurrent_source = &(pAsm->S[current_source_index].src); - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } + if (GL_FALSE == assemble_alu_src(alu_instruction_ptr, + current_source_index, + pcurrent_source, + scalar_channel_index) ) + { + return GL_FALSE; + } + } - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = DST_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; + //other bits + alu_instruction_ptr->m_Word0.f.index_mode = SQ_INDEX_LOOP; - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); - noneg_PVSSRC(&(pAsm->S[0].src)); + if( (is_single_scalar_operation == GL_TRUE) + || (GL_TRUE == bSplitInst) ) + { + alu_instruction_ptr->m_Word0.f.last = 1; + } + else + { + alu_instruction_ptr->m_Word0.f.last = (scalar_channel_index == 3) ? 1 : 0; + } - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } + alu_instruction_ptr->m_Word0.f.pred_sel = (pAsm->D.dst.pred_inv > 0) ? 1 : 0; + if(1 == pAsm->D.dst.predicated) + { + alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0x1; + alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0x1; + } + else + { + alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0x0; + alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0x0; + } + + // dst + if( (pAsm->D.dst.rtype == DST_REG_TEMPORARY) || + (pAsm->D.dst.rtype == DST_REG_OUT) ) + { + alu_instruction_ptr->m_Word1.f.dst_gpr = pAsm->D.dst.reg; + } + else + { + radeon_error("Only temp destination registers supported for ALU dest regs.\n"); + return GL_FALSE; + } - return GL_TRUE; -} + alu_instruction_ptr->m_Word1.f.dst_rel = SQ_ABSOLUTE; //D.rtype -GLboolean assemble_ABS(r700_AssemblerBase *pAsm) -{ - checkop1(pAsm); + if ( is_single_scalar_operation == GL_TRUE ) + { + // Override scalar_channel_index since only one scalar value will be written + if(pAsm->D.dst.writex) + { + scalar_channel_index = 0; + } + else if(pAsm->D.dst.writey) + { + scalar_channel_index = 1; + } + else if(pAsm->D.dst.writez) + { + scalar_channel_index = 2; + } + else if(pAsm->D.dst.writew) + { + scalar_channel_index = 3; + } + } - pAsm->D.dst.opcode = SQ_OP2_INST_MAX; + alu_instruction_ptr->m_Word1.f.dst_chan = scalar_channel_index; - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } - - pAsm->S[1].bits = pAsm->S[0].bits; - flipneg_PVSSRC(&(pAsm->S[1].src)); + alu_instruction_ptr->m_Word1.f.clamp = pAsm->D2.dst2.SaturateMode; - if ( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } + if (pAsm->D.dst.op3) + { + //op3 - return GL_TRUE; -} + alu_instruction_ptr->m_Word1_OP3.f.alu_inst = pAsm->D.dst.opcode; -GLboolean assemble_ADD(r700_AssemblerBase *pAsm) -{ - if( GL_FALSE == checkop2(pAsm) ) - { - return GL_FALSE; - } + //There's 3rd src for op3 + current_source_index = 2; + pcurrent_source = &(pAsm->S[current_source_index].src); - pAsm->D.dst.opcode = SQ_OP2_INST_ADD; - + if ( GL_FALSE == assemble_alu_src(alu_instruction_ptr, + current_source_index, + pcurrent_source, + scalar_channel_index) ) + { + return GL_FALSE; + } + } + else + { + //op2 + if (pAsm->bR6xx) + { + alu_instruction_ptr->m_Word1_OP2.f6.alu_inst = pAsm->D.dst.opcode; + + alu_instruction_ptr->m_Word1_OP2.f6.src0_abs = 0x0; + alu_instruction_ptr->m_Word1_OP2.f6.src1_abs = 0x0; + + //alu_instruction_ptr->m_Word1_OP2.f6.update_execute_mask = 0x0; + //alu_instruction_ptr->m_Word1_OP2.f6.update_pred = 0x0; + switch (scalar_channel_index) + { + case 0: + alu_instruction_ptr->m_Word1_OP2.f6.write_mask = pAsm->D.dst.writex; + break; + case 1: + alu_instruction_ptr->m_Word1_OP2.f6.write_mask = pAsm->D.dst.writey; + break; + case 2: + alu_instruction_ptr->m_Word1_OP2.f6.write_mask = pAsm->D.dst.writez; + break; + case 3: + alu_instruction_ptr->m_Word1_OP2.f6.write_mask = pAsm->D.dst.writew; + break; + default: + alu_instruction_ptr->m_Word1_OP2.f6.write_mask = 1; //SQ_SEL_MASK; + break; + } + alu_instruction_ptr->m_Word1_OP2.f6.omod = SQ_ALU_OMOD_OFF; + } + else + { + alu_instruction_ptr->m_Word1_OP2.f.alu_inst = pAsm->D.dst.opcode; + + alu_instruction_ptr->m_Word1_OP2.f.src0_abs = 0x0; + alu_instruction_ptr->m_Word1_OP2.f.src1_abs = 0x0; + + //alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0x0; + //alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0x0; + switch (scalar_channel_index) + { + case 0: + alu_instruction_ptr->m_Word1_OP2.f.write_mask = pAsm->D.dst.writex; + break; + case 1: + alu_instruction_ptr->m_Word1_OP2.f.write_mask = pAsm->D.dst.writey; + break; + case 2: + alu_instruction_ptr->m_Word1_OP2.f.write_mask = pAsm->D.dst.writez; + break; + case 3: + alu_instruction_ptr->m_Word1_OP2.f.write_mask = pAsm->D.dst.writew; + break; + default: + alu_instruction_ptr->m_Word1_OP2.f.write_mask = 1; //SQ_SEL_MASK; + break; + } + alu_instruction_ptr->m_Word1_OP2.f.omod = SQ_ALU_OMOD_OFF; + } + } + + if(GL_FALSE == add_alu_instruction(pAsm, alu_instruction_ptr, contiguous_slots_needed) ) + { + return GL_FALSE; + } + + /* + * Judge the type of current instruction, is it vector or scalar + * instruction. + */ + if (is_single_scalar_operation) + { + if(GL_FALSE == check_scalar(pAsm, alu_instruction_ptr) ) + { + return GL_FALSE; + } + } + else + { + if(GL_FALSE == check_vector(pAsm, alu_instruction_ptr) ) + { + return 1; + } + } + + contiguous_slots_needed = 0; + } + + return GL_TRUE; +} + +GLboolean assemble_alu_instruction_literal(r700_AssemblerBase *pAsm, GLfloat * pLiteral) +{ + R700ALUInstruction * alu_instruction_ptr; + R700ALUInstructionHalfLiteral * alu_instruction_ptr_hl; + R700ALUInstructionFullLiteral * alu_instruction_ptr_fl; + + GLuint number_of_scalar_operations; + GLboolean is_single_scalar_operation; + GLuint scalar_channel_index; + + GLuint contiguous_slots_needed; + GLuint lastInstruction; + GLuint not_masked[4]; + + GLuint uNumSrc = r700GetNumOperands(pAsm); + + GLboolean bSplitInst = GL_FALSE; + + number_of_scalar_operations = 0; + contiguous_slots_needed = 0; + + if(1 == pAsm->D.dst.writew) + { + lastInstruction = 3; + number_of_scalar_operations++; + not_masked[3] = 1; + } + else + { + not_masked[3] = 0; + } + if(1 == pAsm->D.dst.writez) + { + lastInstruction = 2; + number_of_scalar_operations++; + not_masked[2] = 1; + } + else + { + not_masked[2] = 0; + } + if(1 == pAsm->D.dst.writey) + { + lastInstruction = 1; + number_of_scalar_operations++; + not_masked[1] = 1; + } + else + { + not_masked[1] = 0; + } + if(1 == pAsm->D.dst.writex) + { + lastInstruction = 0; + number_of_scalar_operations++; + not_masked[0] = 1; + } + else + { + not_masked[0] = 0; + } + + if(GL_TRUE == is_reduction_opcode(&(pAsm->D)) ) + { + contiguous_slots_needed = 4; + } + else + { + contiguous_slots_needed = number_of_scalar_operations; + } + + if(1 == pAsm->D2.dst2.literal) + { + contiguous_slots_needed += 1; + } + else if(2 == pAsm->D2.dst2.literal) + { + contiguous_slots_needed += 2; + } + + initialize(pAsm); + + for (scalar_channel_index=0; scalar_channel_index < 4; scalar_channel_index++) + { + if(0 == not_masked[scalar_channel_index]) + { + continue; + } + + if(scalar_channel_index == lastInstruction) + { + switch (pAsm->D2.dst2.literal) + { + case 0: + alu_instruction_ptr = (R700ALUInstruction*) CALLOC_STRUCT(R700ALUInstruction); + if (alu_instruction_ptr == NULL) + { + return GL_FALSE; + } + Init_R700ALUInstruction(alu_instruction_ptr); + break; + case 1: + alu_instruction_ptr_hl = (R700ALUInstructionHalfLiteral*) CALLOC_STRUCT(R700ALUInstructionHalfLiteral); + if (alu_instruction_ptr_hl == NULL) + { + return GL_FALSE; + } + Init_R700ALUInstructionHalfLiteral(alu_instruction_ptr_hl, pLiteral[0], pLiteral[1]); + alu_instruction_ptr = (R700ALUInstruction*)alu_instruction_ptr_hl; + break; + case 2: + alu_instruction_ptr_fl = (R700ALUInstructionFullLiteral*) CALLOC_STRUCT(R700ALUInstructionFullLiteral); + if (alu_instruction_ptr_fl == NULL) + { + return GL_FALSE; + } + Init_R700ALUInstructionFullLiteral(alu_instruction_ptr_fl, pLiteral[0], pLiteral[1], pLiteral[2], pLiteral[3]); + alu_instruction_ptr = (R700ALUInstruction*)alu_instruction_ptr_fl; + break; + default: + break; + }; + } + else + { + alu_instruction_ptr = (R700ALUInstruction*) CALLOC_STRUCT(R700ALUInstruction); + if (alu_instruction_ptr == NULL) + { + return GL_FALSE; + } + Init_R700ALUInstruction(alu_instruction_ptr); + } + + //src 0 + if (GL_FALSE == assemble_alu_src(alu_instruction_ptr, + 0, + &(pAsm->S[0].src), + scalar_channel_index) ) + { + return GL_FALSE; + } + + if (uNumSrc > 1) + { + // Process source 1 + if (GL_FALSE == assemble_alu_src(alu_instruction_ptr, + 1, + &(pAsm->S[1].src), + scalar_channel_index) ) + { + return GL_FALSE; + } + } + + //other bits + alu_instruction_ptr->m_Word0.f.index_mode = SQ_INDEX_LOOP; + + if(scalar_channel_index == lastInstruction) + { + alu_instruction_ptr->m_Word0.f.last = 1; + } + + alu_instruction_ptr->m_Word0.f.pred_sel = 0x0; + if(1 == pAsm->D.dst.predicated) + { + alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0x1; + alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0x1; + } + else + { + alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0; + alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0; + } + + // dst + if( (pAsm->D.dst.rtype == DST_REG_TEMPORARY) || + (pAsm->D.dst.rtype == DST_REG_OUT) ) + { + alu_instruction_ptr->m_Word1.f.dst_gpr = pAsm->D.dst.reg; + } + else + { + radeon_error("Only temp destination registers supported for ALU dest regs.\n"); + return GL_FALSE; + } + + alu_instruction_ptr->m_Word1.f.dst_rel = SQ_ABSOLUTE; //D.rtype + + alu_instruction_ptr->m_Word1.f.dst_chan = scalar_channel_index; + + alu_instruction_ptr->m_Word1.f.clamp = pAsm->D2.dst2.SaturateMode; + + if (pAsm->D.dst.op3) + { + //op3 + alu_instruction_ptr->m_Word1_OP3.f.alu_inst = pAsm->D.dst.opcode; + + //There's 3rd src for op3 + if ( GL_FALSE == assemble_alu_src(alu_instruction_ptr, + 2, + &(pAsm->S[2].src), + scalar_channel_index) ) + { + return GL_FALSE; + } + } + else + { + //op2 + if (pAsm->bR6xx) + { + alu_instruction_ptr->m_Word1_OP2.f6.alu_inst = pAsm->D.dst.opcode; + alu_instruction_ptr->m_Word1_OP2.f6.src0_abs = 0x0; + alu_instruction_ptr->m_Word1_OP2.f6.src1_abs = 0x0; + alu_instruction_ptr->m_Word1_OP2.f6.write_mask = 1; + alu_instruction_ptr->m_Word1_OP2.f6.omod = SQ_ALU_OMOD_OFF; + } + else + { + alu_instruction_ptr->m_Word1_OP2.f.alu_inst = pAsm->D.dst.opcode; + alu_instruction_ptr->m_Word1_OP2.f.src0_abs = 0x0; + alu_instruction_ptr->m_Word1_OP2.f.src1_abs = 0x0; + alu_instruction_ptr->m_Word1_OP2.f.write_mask = 1; + alu_instruction_ptr->m_Word1_OP2.f.omod = SQ_ALU_OMOD_OFF; + } + } + + if(GL_FALSE == add_alu_instruction(pAsm, alu_instruction_ptr, contiguous_slots_needed) ) + { + return GL_FALSE; + } + + if (1 == number_of_scalar_operations) + { + if(GL_FALSE == check_scalar(pAsm, alu_instruction_ptr) ) + { + return GL_FALSE; + } + } + else + { + if(GL_FALSE == check_vector(pAsm, alu_instruction_ptr) ) + { + return GL_FALSE; + } + } + + contiguous_slots_needed -= 2; + } + + return GL_TRUE; +} + +GLboolean next_ins(r700_AssemblerBase *pAsm) +{ + struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); + + if( GL_TRUE == pAsm->is_tex ) + { + if (pILInst->TexSrcTarget == TEXTURE_RECT_INDEX) { + if( GL_FALSE == assemble_tex_instruction(pAsm, GL_FALSE) ) + { + radeon_error("Error assembling TEX instruction\n"); + return GL_FALSE; + } + } else { + if( GL_FALSE == assemble_tex_instruction(pAsm, GL_TRUE) ) + { + radeon_error("Error assembling TEX instruction\n"); + return GL_FALSE; + } + } + } + else + { //ALU + if( GL_FALSE == assemble_alu_instruction(pAsm) ) + { + radeon_error("Error assembling ALU instruction\n"); + return GL_FALSE; + } + } + + if(pAsm->D.dst.rtype == DST_REG_OUT) + { + if(pAsm->D.dst.op3) + { + // There is no mask for OP3 instructions, so all channels are written + pAsm->pucOutMask[pAsm->D.dst.reg - pAsm->starting_export_register_number] = 0xF; + } + else + { + pAsm->pucOutMask[pAsm->D.dst.reg - pAsm->starting_export_register_number] + |= (unsigned char)pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask; + } + } + + //reset for next inst. + pAsm->D.bits = 0; + pAsm->D2.bits = 0; + pAsm->S[0].bits = 0; + pAsm->S[1].bits = 0; + pAsm->S[2].bits = 0; + pAsm->is_tex = GL_FALSE; + pAsm->need_tex_barrier = GL_FALSE; + + return GL_TRUE; +} + +GLboolean next_ins2(r700_AssemblerBase *pAsm) +{ + struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); + + //ALU + if( GL_FALSE == assemble_alu_instruction2(pAsm) ) + { + radeon_error("Error assembling ALU instruction\n"); + return GL_FALSE; + } + + if(pAsm->D.dst.rtype == DST_REG_OUT) + { + if(pAsm->D.dst.op3) + { + // There is no mask for OP3 instructions, so all channels are written + pAsm->pucOutMask[pAsm->D.dst.reg - pAsm->starting_export_register_number] = 0xF; + } + else + { + pAsm->pucOutMask[pAsm->D.dst.reg - pAsm->starting_export_register_number] + |= (unsigned char)pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask; + } + } + + //reset for next inst. + pAsm->D.bits = 0; + pAsm->D2.bits = 0; + pAsm->S[0].bits = 0; + pAsm->S[1].bits = 0; + pAsm->S[2].bits = 0; + pAsm->is_tex = GL_FALSE; + pAsm->need_tex_barrier = GL_FALSE; + + //richard nov.16 glsl + pAsm->D2.bits = 0; + + return GL_TRUE; +} + +/* not work yet */ +GLboolean next_ins_literal(r700_AssemblerBase *pAsm, GLfloat * pLiteral) +{ + struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); + + //ALU + if( GL_FALSE == assemble_alu_instruction_literal(pAsm, pLiteral) ) + { + radeon_error("Error assembling ALU instruction\n"); + return GL_FALSE; + } + + //reset for next inst. + pAsm->D.bits = 0; + pAsm->D2.bits = 0; + pAsm->S[0].bits = 0; + pAsm->S[1].bits = 0; + pAsm->S[2].bits = 0; + pAsm->is_tex = GL_FALSE; + pAsm->need_tex_barrier = GL_FALSE; + return GL_TRUE; +} + +GLboolean assemble_math_function(r700_AssemblerBase* pAsm, BITS opcode) +{ + BITS tmp; + + checkop1(pAsm); + + tmp = gethelpr(pAsm); + + // opcode tmp.x, a.x + // MOV dst, tmp.x + + pAsm->D.dst.opcode = opcode; + pAsm->D.dst.math = 1; + + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp; + pAsm->D.dst.writex = 1; + + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + + if ( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + // Now replicate result to all necessary channels in destination + pAsm->D.dst.opcode = SQ_OP2_INST_MOV; + + if( GL_FALSE == assemble_dst(pAsm) ) + { + return GL_FALSE; + } + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = DST_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp; + + setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); + noneg_PVSSRC(&(pAsm->S[0].src)); + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + return GL_TRUE; +} + +GLboolean assemble_ABS(r700_AssemblerBase *pAsm) +{ + checkop1(pAsm); + + pAsm->D.dst.opcode = SQ_OP2_INST_MAX; + + if( GL_FALSE == assemble_dst(pAsm) ) + { + return GL_FALSE; + } + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + + pAsm->S[1].bits = pAsm->S[0].bits; + flipneg_PVSSRC(&(pAsm->S[1].src)); + + if ( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + return GL_TRUE; +} + +GLboolean assemble_ADD(r700_AssemblerBase *pAsm) +{ + if( GL_FALSE == checkop2(pAsm) ) + { + return GL_FALSE; + } + + pAsm->D.dst.opcode = SQ_OP2_INST_ADD; + if( GL_FALSE == assemble_dst(pAsm) ) { return GL_FALSE; @@ -3809,10 +4446,78 @@ GLboolean assemble_SCS(r700_AssemblerBase *pAsm) pAsm->S[0].src.swizzlez = SQ_SEL_0; pAsm->S[0].src.swizzlew = SQ_SEL_0; - if ( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } + if ( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + return GL_TRUE; +} + +GLboolean assemble_LOGIC(r700_AssemblerBase *pAsm, BITS opcode) +{ + if( GL_FALSE == checkop2(pAsm) ) + { + return GL_FALSE; + } + + pAsm->D.dst.opcode = opcode; + pAsm->D.dst.math = 1; + + if( GL_FALSE == assemble_dst(pAsm) ) + { + return GL_FALSE; + } + + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + + if( GL_FALSE == assemble_src(pAsm, 1, -1) ) + { + return GL_FALSE; + } + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + return GL_TRUE; +} + +GLboolean assemble_LOGIC_PRED(r700_AssemblerBase *pAsm, BITS opcode) +{ + if( GL_FALSE == checkop2(pAsm) ) + { + return GL_FALSE; + } + + pAsm->D.dst.opcode = opcode; + pAsm->D.dst.math = 1; + pAsm->D.dst.predicated = 1; + pAsm->D2.dst2.SaturateMode = pAsm->pILInst[pAsm->uiCurInst].SaturateMode; + + if( GL_FALSE == assemble_dst(pAsm) ) + { + return GL_FALSE; + } + + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + + if( GL_FALSE == assemble_src(pAsm, 1, -1) ) + { + return GL_FALSE; + } + + if( GL_FALSE == next_ins2(pAsm) ) + { + return GL_FALSE; + } return GL_TRUE; } @@ -4077,223 +4782,930 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) pAsm->D.dst.writez = 0; pAsm->D.dst.writew = 0; - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp2; - noswizzle_PVSSRC(&(pAsm->S[0].src)); - setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); - pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[1].src.reg = 252; // SQ_ALU_SRC_0_5 - noswizzle_PVSSRC(&(pAsm->S[1].src)); + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp2; + noswizzle_PVSSRC(&(pAsm->S[0].src)); + setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); + pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[1].src.reg = 252; // SQ_ALU_SRC_0_5 + noswizzle_PVSSRC(&(pAsm->S[1].src)); + + next_ins(pAsm); + + /* tmp1.xy = temp2.xy */ + pAsm->D.dst.opcode = SQ_OP2_INST_MOV; + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp1; + pAsm->D.dst.writex = 1; + pAsm->D.dst.writey = 1; + pAsm->D.dst.writez = 0; + pAsm->D.dst.writew = 0; + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp2; + noswizzle_PVSSRC(&(pAsm->S[0].src)); + + next_ins(pAsm); + pAsm->aArgSubst[1] = tmp1; + need_barrier = GL_TRUE; + + } + + pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE; + pAsm->is_tex = GL_TRUE; + if ( GL_TRUE == need_barrier ) + { + pAsm->need_tex_barrier = GL_TRUE; + } + // Set src1 to tex unit id + pAsm->S[1].src.reg = pAsm->pILInst[pAsm->uiCurInst].TexSrcUnit; + pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; + + //No sw info from mesa compiler, so hard code here. + pAsm->S[1].src.swizzlex = SQ_SEL_X; + pAsm->S[1].src.swizzley = SQ_SEL_Y; + pAsm->S[1].src.swizzlez = SQ_SEL_Z; + pAsm->S[1].src.swizzlew = SQ_SEL_W; + + if( GL_FALSE == tex_dst(pAsm) ) + { + return GL_FALSE; + } + + if( GL_FALSE == tex_src(pAsm) ) + { + return GL_FALSE; + } + + if(pAsm->pILInst[pAsm->uiCurInst].Opcode == OPCODE_TXP) + { + /* hopefully did swizzles before */ + noswizzle_PVSSRC(&(pAsm->S[0].src)); + } + + if(pAsm->pILInst[pAsm->uiCurInst].TexSrcTarget == TEXTURE_CUBE_INDEX) + { + /* SAMPLE dst, tmp.yxwy, CUBE */ + pAsm->S[0].src.swizzlex = SQ_SEL_Y; + pAsm->S[0].src.swizzley = SQ_SEL_X; + pAsm->S[0].src.swizzlez = SQ_SEL_W; + pAsm->S[0].src.swizzlew = SQ_SEL_Y; + } + + if ( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + return GL_TRUE; +} + +GLboolean assemble_XPD(r700_AssemblerBase *pAsm) +{ + BITS tmp; + + if( GL_FALSE == checkop2(pAsm) ) + { + return GL_FALSE; + } + + tmp = gethelpr(pAsm); + + pAsm->D.dst.opcode = SQ_OP2_INST_MUL; + + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp; + nomask_PVSDST(&(pAsm->D.dst)); + + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + + if( GL_FALSE == assemble_src(pAsm, 1, -1) ) + { + return GL_FALSE; + } + + swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_Z, SQ_SEL_X, SQ_SEL_Y, SQ_SEL_0); + swizzleagain_PVSSRC(&(pAsm->S[1].src), SQ_SEL_Y, SQ_SEL_Z, SQ_SEL_X, SQ_SEL_0); + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + pAsm->D.dst.opcode = SQ_OP3_INST_MULADD; + pAsm->D.dst.op3 = 1; + + if(0xF != pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask) + { + tmp = gethelpr(pAsm); + + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp; + + nomask_PVSDST(&(pAsm->D.dst)); + } + else + { + if( GL_FALSE == assemble_dst(pAsm) ) + { + return GL_FALSE; + } + } + + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } + + if( GL_FALSE == assemble_src(pAsm, 1, -1) ) + { + return GL_FALSE; + } + + swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_Y, SQ_SEL_Z, SQ_SEL_X, SQ_SEL_0); + swizzleagain_PVSSRC(&(pAsm->S[1].src), SQ_SEL_Z, SQ_SEL_X, SQ_SEL_Y, SQ_SEL_0); + + // result1 + (neg) result0 + setaddrmode_PVSSRC(&(pAsm->S[2].src),ADDR_ABSOLUTE); + pAsm->S[2].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[2].src.reg = tmp; + + neg_PVSSRC(&(pAsm->S[2].src)); + noswizzle_PVSSRC(&(pAsm->S[2].src)); + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + + + if(0xF != pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask) + { + if( GL_FALSE == assemble_dst(pAsm) ) + { + return GL_FALSE; + } + + pAsm->D.dst.opcode = SQ_OP2_INST_MOV; + + // Use tmp as source + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp; + + noneg_PVSSRC(&(pAsm->S[0].src)); + noswizzle_PVSSRC(&(pAsm->S[0].src)); + + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } + } + + return GL_TRUE; +} + +GLboolean assemble_EXPORT(r700_AssemblerBase *pAsm) +{ + return GL_TRUE; +} + +GLboolean jumpToOffest(r700_AssemblerBase *pAsm, GLuint pops, GLint offset) +{ + if(GL_FALSE == add_cf_instruction(pAsm) ) + { + return GL_FALSE; + } + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = pops; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_JUMP; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + + pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + offset; + + return GL_TRUE; +} + +GLboolean pops(r700_AssemblerBase *pAsm, GLuint pops) +{ + if(GL_FALSE == add_cf_instruction(pAsm) ) + { + return GL_FALSE; + } + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = pops; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_POP; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + 1; + + return GL_TRUE; +} + +GLboolean assemble_IF(r700_AssemblerBase *pAsm) +{ + if(GL_FALSE == add_cf_instruction(pAsm) ) + { + return GL_FALSE; + } + + if(GL_TRUE != bHasElse) + { + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; + } + else + { + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0; + } + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_JUMP; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + + pAsm->FCSP++; + pAsm->fc_stack[pAsm->FCSP].type = FC_IF; + pAsm->fc_stack[pAsm->FCSP].bpush = 0; + pAsm->fc_stack[pAsm->FCSP].mid = NULL; + pAsm->fc_stack[pAsm->FCSP].midLen= 0; + pAsm->fc_stack[pAsm->FCSP].first = pAsm->cf_current_cf_clause_ptr; + + if(GL_TRUE != bHasElse) + { + pAsm->alu_x_opcode = SQ_CF_INST_ALU_POP_AFTER; + } + + pAsm->branch_depth++; + + if(pAsm->branch_depth > pAsm->max_branch_depth) + { + pAsm->max_branch_depth = pAsm->branch_depth; + } + return GL_TRUE; +} + +GLboolean assemble_ELSE(r700_AssemblerBase *pAsm) +{ + if(GL_FALSE == add_cf_instruction(pAsm) ) + { + return GL_FALSE; + } + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; /// + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - next_ins(pAsm); + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_ELSE; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - /* tmp1.xy = temp2.xy */ - pAsm->D.dst.opcode = SQ_OP2_INST_MOV; - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp1; - pAsm->D.dst.writex = 1; - pAsm->D.dst.writey = 1; - pAsm->D.dst.writez = 0; - pAsm->D.dst.writew = 0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp2; - noswizzle_PVSSRC(&(pAsm->S[0].src)); + pAsm->fc_stack[pAsm->FCSP].mid = (R700ControlFlowGenericClause **)_mesa_realloc( (void *)pAsm->fc_stack[pAsm->FCSP].mid, + 0, + sizeof(R700ControlFlowGenericClause *) ); + pAsm->fc_stack[pAsm->FCSP].mid[0] = pAsm->cf_current_cf_clause_ptr; + //pAsm->fc_stack[pAsm->FCSP].unNumMid = 1; - next_ins(pAsm); - pAsm->aArgSubst[1] = tmp1; - need_barrier = GL_TRUE; + pAsm->alu_x_opcode = SQ_CF_INST_ALU_POP_AFTER; + + pAsm->fc_stack[pAsm->FCSP].first->m_Word0.f.addr = pAsm->pR700Shader->plstCFInstructions_active->uNumOfNode - 1; + + return GL_TRUE; +} + +GLboolean assemble_ENDIF(r700_AssemblerBase *pAsm) +{ + pAsm->alu_x_opcode = SQ_CF_INST_ALU; + if(NULL == pAsm->fc_stack[pAsm->FCSP].mid) + { + /* no else in between */ + pAsm->fc_stack[pAsm->FCSP].first->m_Word0.f.addr = pAsm->pR700Shader->plstCFInstructions_active->uNumOfNode; + } + else + { + pAsm->fc_stack[pAsm->FCSP].mid[0]->m_Word0.f.addr = pAsm->pR700Shader->plstCFInstructions_active->uNumOfNode; } - pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE; - pAsm->is_tex = GL_TRUE; - if ( GL_TRUE == need_barrier ) + if(NULL != pAsm->fc_stack[pAsm->FCSP].mid) { - pAsm->need_tex_barrier = GL_TRUE; + FREE(pAsm->fc_stack[pAsm->FCSP].mid); } - // Set src1 to tex unit id - pAsm->S[1].src.reg = pAsm->pILInst[pAsm->uiCurInst].TexSrcUnit; - pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; - //No sw info from mesa compiler, so hard code here. - pAsm->S[1].src.swizzlex = SQ_SEL_X; - pAsm->S[1].src.swizzley = SQ_SEL_Y; - pAsm->S[1].src.swizzlez = SQ_SEL_Z; - pAsm->S[1].src.swizzlew = SQ_SEL_W; + if(pAsm->fc_stack[pAsm->FCSP].type != FC_IF) + { + radeon_error("if/endif in shader code are not paired. \n"); + return GL_FALSE; + } + pAsm->branch_depth--; + pAsm->FCSP--; - if( GL_FALSE == tex_dst(pAsm) ) + return GL_TRUE; +} + +GLboolean assemble_BGNLOOP(r700_AssemblerBase *pAsm) +{ + if(GL_FALSE == add_cf_instruction(pAsm) ) { return GL_FALSE; } - if( GL_FALSE == tex_src(pAsm) ) + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_START_NO_AL; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + + pAsm->FCSP++; + pAsm->fc_stack[pAsm->FCSP].type = FC_LOOP; + pAsm->fc_stack[pAsm->FCSP].bpush = 1; + pAsm->fc_stack[pAsm->FCSP].mid = NULL; + pAsm->fc_stack[pAsm->FCSP].unNumMid = 0; + pAsm->fc_stack[pAsm->FCSP].midLen = 0; + pAsm->fc_stack[pAsm->FCSP].first = pAsm->cf_current_cf_clause_ptr; + + pAsm->branch_depth++; + + if(pAsm->branch_depth > pAsm->max_branch_depth) + { + pAsm->max_branch_depth = pAsm->branch_depth; + } + return GL_TRUE; +} + +GLboolean assemble_BRK(r700_AssemblerBase *pAsm) +{ +#ifdef USE_CF_FOR_CONTINUE_BREAK + unsigned int unFCSP; + for(unFCSP=pAsm->FCSP; unFCSP>0; unFCSP--) + { + if(FC_LOOP == pAsm->fc_stack[unFCSP].type) + { + break; + } + } + if(0 == FC_LOOP) { + radeon_error("Break is not inside loop/endloop pair.\n"); return GL_FALSE; } - if(pAsm->pILInst[pAsm->uiCurInst].Opcode == OPCODE_TXP) + if(GL_FALSE == add_cf_instruction(pAsm) ) { - /* hopefully did swizzles before */ - noswizzle_PVSSRC(&(pAsm->S[0].src)); + return GL_FALSE; } - - if(pAsm->pILInst[pAsm->uiCurInst].TexSrcTarget == TEXTURE_CUBE_INDEX) + + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_BREAK; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + + pAsm->fc_stack[unFCSP].mid = (R700ControlFlowGenericClause **)_mesa_realloc( + (void *)pAsm->fc_stack[unFCSP].mid, + sizeof(R700ControlFlowGenericClause *) * pAsm->fc_stack[unFCSP].unNumMid, + sizeof(R700ControlFlowGenericClause *) * (pAsm->fc_stack[unFCSP].unNumMid + 1) ); + pAsm->fc_stack[unFCSP].mid[pAsm->fc_stack[unFCSP].unNumMid] = pAsm->cf_current_cf_clause_ptr; + pAsm->fc_stack[unFCSP].unNumMid++; + + if(GL_FALSE == add_cf_instruction(pAsm) ) { - /* SAMPLE dst, tmp.yxwy, CUBE */ - pAsm->S[0].src.swizzlex = SQ_SEL_Y; - pAsm->S[0].src.swizzley = SQ_SEL_X; - pAsm->S[0].src.swizzlez = SQ_SEL_W; - pAsm->S[0].src.swizzlew = SQ_SEL_Y; + return GL_FALSE; } + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_POP; - if ( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + 1; +#endif //USE_CF_FOR_CONTINUE_BREAK return GL_TRUE; } -GLboolean assemble_XPD(r700_AssemblerBase *pAsm) +GLboolean assemble_CONT(r700_AssemblerBase *pAsm) { - BITS tmp; +#ifdef USE_CF_FOR_CONTINUE_BREAK + unsigned int unFCSP; + for(unFCSP=pAsm->FCSP; unFCSP>0; unFCSP--) + { + if(FC_LOOP == pAsm->fc_stack[unFCSP].type) + { + break; + } + } + if(0 == FC_LOOP) + { + radeon_error("Continue is not inside loop/endloop pair.\n"); + return GL_FALSE; + } - if( GL_FALSE == checkop2(pAsm) ) + if(GL_FALSE == add_cf_instruction(pAsm) ) { - return GL_FALSE; + return GL_FALSE; } - tmp = gethelpr(pAsm); + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; - pAsm->D.dst.opcode = SQ_OP2_INST_MUL; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_CONTINUE; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - nomask_PVSDST(&(pAsm->D.dst)); - - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + + pAsm->fc_stack[unFCSP].mid = (R700ControlFlowGenericClause **)_mesa_realloc( + (void *)pAsm->fc_stack[unFCSP].mid, + sizeof(R700ControlFlowGenericClause *) * pAsm->fc_stack[unFCSP].unNumMid, + sizeof(R700ControlFlowGenericClause *) * (pAsm->fc_stack[unFCSP].unNumMid + 1) ); + pAsm->fc_stack[unFCSP].mid[pAsm->fc_stack[unFCSP].unNumMid] = pAsm->cf_current_cf_clause_ptr; + pAsm->fc_stack[unFCSP].unNumMid++; + + if(GL_FALSE == add_cf_instruction(pAsm) ) { return GL_FALSE; } - if( GL_FALSE == assemble_src(pAsm, 1, -1) ) + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_POP; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + 1; + +#endif /* USE_CF_FOR_CONTINUE_BREAK */ + + return GL_TRUE; +} + +GLboolean assemble_ENDLOOP(r700_AssemblerBase *pAsm) +{ + GLuint i; + + if(GL_FALSE == add_cf_instruction(pAsm) ) { return GL_FALSE; } - - swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_Z, SQ_SEL_X, SQ_SEL_Y, SQ_SEL_0); - swizzleagain_PVSSRC(&(pAsm->S[1].src), SQ_SEL_Y, SQ_SEL_Z, SQ_SEL_X, SQ_SEL_0); - if( GL_FALSE == next_ins(pAsm) ) + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_END; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + + pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->fc_stack[pAsm->FCSP].first->m_uIndex + 1; + pAsm->fc_stack[pAsm->FCSP].first->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + 1; + +#ifdef USE_CF_FOR_CONTINUE_BREAK + for(i=0; ifc_stack[pAsm->FCSP].unNumMid; i++) + { + pAsm->fc_stack[pAsm->FCSP].mid[i]->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex; + } + if(NULL != pAsm->fc_stack[pAsm->FCSP].mid) + { + FREE(pAsm->fc_stack[pAsm->FCSP].mid); + } +#endif + + if(pAsm->fc_stack[pAsm->FCSP].type != FC_LOOP) { + radeon_error("loop/endloop in shader code are not paired. \n"); return GL_FALSE; } - pAsm->D.dst.opcode = SQ_OP3_INST_MULADD; - pAsm->D.dst.op3 = 1; + unsigned int unFCSP = 0; + if((pAsm->unCFflags & HAS_CURRENT_LOOPRET) > 0) + { + for(unFCSP=(pAsm->FCSP-1); unFCSP>pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry; unFCSP--) + { + if(FC_LOOP == pAsm->fc_stack[unFCSP].type) + { + break; + } + } + if(unFCSP <= pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry) + { + unFCSP = 0; - if(0xF != pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask) - { - tmp = gethelpr(pAsm); + returnOnFlag(pAsm); + pAsm->unCFflags &= ~HAS_CURRENT_LOOPRET; + } + } - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; + pAsm->branch_depth--; + pAsm->FCSP--; - nomask_PVSDST(&(pAsm->D.dst)); + if(unFCSP > 0) + { + breakLoopOnFlag(pAsm, unFCSP); } - else + + return GL_TRUE; +} + +void add_return_inst(r700_AssemblerBase *pAsm) +{ + if(GL_FALSE == add_cf_instruction(pAsm) ) { - if( GL_FALSE == assemble_dst(pAsm) ) + return GL_FALSE; + } + //pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_RETURN; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; +} + +GLboolean assemble_BGNSUB(r700_AssemblerBase *pAsm, GLint nILindex) +{ + /* Put in sub */ + if( (pAsm->unSubArrayPointer + 1) > pAsm->unSubArraySize ) + { + pAsm->subs = (SUB_OFFSET*)_mesa_realloc( (void *)pAsm->subs, + sizeof(SUB_OFFSET) * pAsm->unSubArraySize, + sizeof(SUB_OFFSET) * (pAsm->unSubArraySize + 10) ); + if(NULL == pAsm->subs) { return GL_FALSE; } + pAsm->unSubArraySize += 10; } - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + pAsm->subs[pAsm->unSubArrayPointer].subIL_Offset = nILindex; + pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.pHead=NULL; + pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.pTail=NULL; + pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.uNumOfNode=0; + + pAsm->CALLSP++; + pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry = pAsm->FCSP; + pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local + = &(pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local); + SetActiveCFlist(pAsm->pR700Shader, + pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local); + + pAsm->unSubArrayPointer++; + + /* start sub */ + pAsm->alu_x_opcode = SQ_CF_INST_ALU; + + return GL_TRUE; +} + +GLboolean assemble_ENDSUB(r700_AssemblerBase *pAsm) +{ + pAsm->CALLSP--; + SetActiveCFlist(pAsm->pR700Shader, + pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local); + + pAsm->alu_x_opcode = SQ_CF_INST_ALU; + + return GL_TRUE; +} + +GLboolean assemble_RET(r700_AssemblerBase *pAsm) +{ + if(pAsm->CALLSP > 0) + { /* in sub */ + unsigned int unFCSP; + for(unFCSP=pAsm->FCSP; unFCSP>pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry; unFCSP--) + { + if(FC_LOOP == pAsm->fc_stack[unFCSP].type) + { + setRetInLoopFlag(pAsm, SQ_SEL_1); + breakLoopOnFlag(pAsm, unFCSP); + pAsm->unCFflags |= LOOPRET_FLAGS; + + return GL_TRUE; + } + } + } + + add_return_inst(pAsm); + + return GL_TRUE; +} + +GLboolean assemble_CAL(r700_AssemblerBase *pAsm, + GLint nILindex, + GLuint uiNumberInsts, + struct prog_instruction *pILInst) +{ + pAsm->alu_x_opcode = SQ_CF_INST_ALU; + + if(GL_FALSE == add_cf_instruction(pAsm) ) { return GL_FALSE; } - if( GL_FALSE == assemble_src(pAsm, 1, -1) ) + pAsm->cf_current_cf_clause_ptr->m_Word1.f.call_count = 1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_CALL; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + + /* Put in caller */ + if( (pAsm->unCallerArrayPointer + 1) > pAsm->unCallerArraySize ) { - return GL_FALSE; + pAsm->callers = (CALLER_POINTER*)_mesa_realloc( (void *)pAsm->callers, + sizeof(CALLER_POINTER) * pAsm->unCallerArraySize, + sizeof(CALLER_POINTER) * (pAsm->unCallerArraySize + 10) ); + if(NULL == pAsm->callers) + { + return GL_FALSE; + } + pAsm->unCallerArraySize += 10; } - - swizzleagain_PVSSRC(&(pAsm->S[0].src), SQ_SEL_Y, SQ_SEL_Z, SQ_SEL_X, SQ_SEL_0); - swizzleagain_PVSSRC(&(pAsm->S[1].src), SQ_SEL_Z, SQ_SEL_X, SQ_SEL_Y, SQ_SEL_0); + + pAsm->callers[pAsm->unCallerArrayPointer].subIL_Offset = nILindex; + pAsm->callers[pAsm->unCallerArrayPointer].cf_ptr = pAsm->cf_current_cf_clause_ptr; - // result1 + (neg) result0 - setaddrmode_PVSSRC(&(pAsm->S[2].src),ADDR_ABSOLUTE); - pAsm->S[2].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[2].src.reg = tmp; + pAsm->unCallerArrayPointer++; - neg_PVSSRC(&(pAsm->S[2].src)); - noswizzle_PVSSRC(&(pAsm->S[2].src)); + int j; + for(j=0; junSubArrayPointer; j++) + { + if(nILindex == pAsm->subs[j].subIL_Offset) + { /* compiled before */ + pAsm->callers[pAsm->unCallerArrayPointer - 1].subDescIndex = j; + return GL_TRUE; + } + } + + pAsm->callers[pAsm->unCallerArrayPointer - 1].subDescIndex = pAsm->unSubArrayPointer; + + return AssembleInstr(nILindex, uiNumberInsts, pILInst, pAsm); +} + +GLboolean setRetInLoopFlag(r700_AssemblerBase *pAsm, GLuint flagValue) +{ + GLfloat fLiteral[2] = {0.1, 0.0}; + + pAsm->D.dst.opcode = SQ_OP2_INST_MOV; + pAsm->D.dst.op3 = 0; + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = pAsm->flag_reg_index; + pAsm->D.dst.writex = 1; + pAsm->D.dst.writey = 0; + pAsm->D.dst.writez = 0; + pAsm->D.dst.writew = 0; + pAsm->D2.dst2.literal = 1; + pAsm->D2.dst2.SaturateMode = SATURATE_OFF; + pAsm->D.dst.predicated = 0; +#if 0 + pAsm->S[0].src.rtype = SRC_REC_LITERAL; + //pAsm->S[0].src.reg = 0; + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + noneg_PVSSRC(&(pAsm->S[0].src)); + pAsm->S[0].src.swizzlex = SQ_SEL_X; + pAsm->S[0].src.swizzley = SQ_SEL_Y; + pAsm->S[0].src.swizzlez = SQ_SEL_Z; + pAsm->S[0].src.swizzlew = SQ_SEL_W; + + if( GL_FALSE == next_ins_literal(pAsm, &(fLiteral[0])) ) + { + return GL_FALSE; + } +#else + pAsm->S[0].src.rtype = DST_REG_TEMPORARY; + pAsm->S[0].src.reg = 0; + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + noneg_PVSSRC(&(pAsm->S[0].src)); + pAsm->S[0].src.swizzlex = flagValue; + pAsm->S[0].src.swizzley = flagValue; + pAsm->S[0].src.swizzlez = flagValue; + pAsm->S[0].src.swizzlew = flagValue; - if( GL_FALSE == next_ins(pAsm) ) + if( GL_FALSE == next_ins2(pAsm) ) { return GL_FALSE; } +#endif + return GL_TRUE; +} - if(0xF != pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask) - { - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } +GLboolean testFlag(r700_AssemblerBase *pAsm) +{ + GLfloat fLiteral[2] = {0.1, 0.0}; - pAsm->D.dst.opcode = SQ_OP2_INST_MOV; + //Test flag + GLuint tmp = gethelpr(pAsm); + pAsm->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; - // Use tmp as source - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; + pAsm->D.dst.opcode = SQ_OP2_INST_PRED_SETE; + pAsm->D.dst.math = 1; + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp; + pAsm->D.dst.writex = 1; + pAsm->D.dst.writey = 0; + pAsm->D.dst.writez = 0; + pAsm->D.dst.writew = 0; + pAsm->D2.dst2.literal = 1; + pAsm->D2.dst2.SaturateMode = SATURATE_OFF; + pAsm->D.dst.predicated = 1; - noneg_PVSSRC(&(pAsm->S[0].src)); - noswizzle_PVSSRC(&(pAsm->S[0].src)); + pAsm->S[0].src.rtype = DST_REG_TEMPORARY; + pAsm->S[0].src.reg = pAsm->flag_reg_index; + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + noneg_PVSSRC(&(pAsm->S[0].src)); + pAsm->S[0].src.swizzlex = SQ_SEL_X; + pAsm->S[0].src.swizzley = SQ_SEL_Y; + pAsm->S[0].src.swizzlez = SQ_SEL_Z; + pAsm->S[0].src.swizzlew = SQ_SEL_W; +#if 0 + pAsm->S[1].src.rtype = SRC_REC_LITERAL; + //pAsm->S[1].src.reg = 0; + setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); + noneg_PVSSRC(&(pAsm->S[1].src)); + pAsm->S[1].src.swizzlex = SQ_SEL_X; + pAsm->S[1].src.swizzley = SQ_SEL_Y; + pAsm->S[1].src.swizzlez = SQ_SEL_Z; + pAsm->S[1].src.swizzlew = SQ_SEL_W; - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } + if( GL_FALSE == next_ins_literal(pAsm, &(fLiteral[0])) ) + { + return GL_FALSE; + } +#else + pAsm->S[1].src.rtype = DST_REG_TEMPORARY; + pAsm->S[1].src.reg = 0; + setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); + noneg_PVSSRC(&(pAsm->S[1].src)); + pAsm->S[1].src.swizzlex = SQ_SEL_1; + pAsm->S[1].src.swizzley = SQ_SEL_1; + pAsm->S[1].src.swizzlez = SQ_SEL_1; + pAsm->S[1].src.swizzlew = SQ_SEL_1; + + if( GL_FALSE == next_ins2(pAsm) ) + { + return GL_FALSE; } +#endif return GL_TRUE; } -GLboolean assemble_EXPORT(r700_AssemblerBase *pAsm) +GLboolean returnOnFlag(r700_AssemblerBase *pAsm) { - return GL_TRUE; -} + testFlag(pAsm); + jumpToOffest(pAsm, 1, 4); + setRetInLoopFlag(pAsm, SQ_SEL_0); + pops(pAsm, 1); + add_return_inst(pAsm); -GLboolean assemble_IF(r700_AssemblerBase *pAsm) -{ return GL_TRUE; } -GLboolean assemble_ENDIF(r700_AssemblerBase *pAsm) +GLboolean breakLoopOnFlag(r700_AssemblerBase *pAsm, GLuint unFCSP) { + testFlag(pAsm); + + //break + if(GL_FALSE == add_cf_instruction(pAsm) ) + { + return GL_FALSE; + } + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_const = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cond = SQ_CF_COND_ACTIVE; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.end_of_program = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.valid_pixel_mode = 0x0; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.cf_inst = SQ_CF_INST_LOOP_BREAK; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.whole_quad_mode = 0x0; + + pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; + + pAsm->fc_stack[unFCSP].mid = (R700ControlFlowGenericClause **)_mesa_realloc( + (void *)pAsm->fc_stack[unFCSP].mid, + sizeof(R700ControlFlowGenericClause *) * pAsm->fc_stack[unFCSP].unNumMid, + sizeof(R700ControlFlowGenericClause *) * (pAsm->fc_stack[unFCSP].unNumMid + 1) ); + pAsm->fc_stack[unFCSP].mid[pAsm->fc_stack[unFCSP].unNumMid] = pAsm->cf_current_cf_clause_ptr; + pAsm->fc_stack[unFCSP].unNumMid++; + + pops(pAsm, 1); + return GL_TRUE; } -GLboolean AssembleInstr(GLuint uiNumberInsts, +GLboolean AssembleInstr(GLuint uiFirstInst, + GLuint uiNumberInsts, struct prog_instruction *pILInst, r700_AssemblerBase *pR700AsmCode) { GLuint i; pR700AsmCode->pILInst = pILInst; - for(i=0; iuiCurInst = i; +#ifndef USE_CF_FOR_CONTINUE_BREAK + if(OPCODE_BRK == pILInst[i+1].Opcode) + { + switch(pILInst[i].Opcode) + { + case OPCODE_SLE: + pILInst[i].Opcode = OPCODE_SGT; + break; + case OPCODE_SLT: + pILInst[i].Opcode = OPCODE_SGE; + break; + case OPCODE_SGE: + pILInst[i].Opcode = OPCODE_SLT; + break; + case OPCODE_SGT: + pILInst[i].Opcode = OPCODE_SLE; + break; + case OPCODE_SEQ: + pILInst[i].Opcode = OPCODE_SNE; + break; + case OPCODE_SNE: + pILInst[i].Opcode = OPCODE_SEQ; + break; + default: + break; + } + } +#endif + switch (pILInst[i].Opcode) { case OPCODE_ABS: @@ -4337,101 +5749,383 @@ GLboolean AssembleInstr(GLuint uiNumberInsts, return GL_FALSE; break; - case OPCODE_EX2: - if ( GL_FALSE == assemble_EX2(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_EXP: - if ( GL_FALSE == assemble_EXP(pR700AsmCode) ) - return GL_FALSE; + case OPCODE_EX2: + if ( GL_FALSE == assemble_EX2(pR700AsmCode) ) + return GL_FALSE; + break; + case OPCODE_EXP: + if ( GL_FALSE == assemble_EXP(pR700AsmCode) ) + return GL_FALSE; + break; + + case OPCODE_FLR: + if ( GL_FALSE == assemble_FLR(pR700AsmCode) ) + return GL_FALSE; + break; + //case OP_FLR_INT: + // if ( GL_FALSE == assemble_FLR_INT() ) + // return GL_FALSE; + // break; + + case OPCODE_FRC: + if ( GL_FALSE == assemble_FRC(pR700AsmCode) ) + return GL_FALSE; + break; + + case OPCODE_KIL: + if ( GL_FALSE == assemble_KIL(pR700AsmCode) ) + return GL_FALSE; + break; + case OPCODE_LG2: + if ( GL_FALSE == assemble_LG2(pR700AsmCode) ) + return GL_FALSE; + break; + case OPCODE_LIT: + if ( GL_FALSE == assemble_LIT(pR700AsmCode) ) + return GL_FALSE; + break; + case OPCODE_LRP: + if ( GL_FALSE == assemble_LRP(pR700AsmCode) ) + return GL_FALSE; + break; + case OPCODE_LOG: + if ( GL_FALSE == assemble_LOG(pR700AsmCode) ) + return GL_FALSE; + break; + + case OPCODE_MAD: + if ( GL_FALSE == assemble_MAD(pR700AsmCode) ) + return GL_FALSE; + break; + case OPCODE_MAX: + if ( GL_FALSE == assemble_MAX(pR700AsmCode) ) + return GL_FALSE; + break; + case OPCODE_MIN: + if ( GL_FALSE == assemble_MIN(pR700AsmCode) ) + return GL_FALSE; + break; + + case OPCODE_MOV: + if ( GL_FALSE == assemble_MOV(pR700AsmCode) ) + return GL_FALSE; + break; + case OPCODE_MUL: + if ( GL_FALSE == assemble_MUL(pR700AsmCode) ) + return GL_FALSE; + break; + + case OPCODE_POW: + if ( GL_FALSE == assemble_POW(pR700AsmCode) ) + return GL_FALSE; + break; + case OPCODE_RCP: + if ( GL_FALSE == assemble_RCP(pR700AsmCode) ) + return GL_FALSE; + break; + case OPCODE_RSQ: + if ( GL_FALSE == assemble_RSQ(pR700AsmCode) ) + return GL_FALSE; + break; + case OPCODE_SIN: + if ( GL_FALSE == assemble_SIN(pR700AsmCode) ) + return GL_FALSE; + break; + case OPCODE_SCS: + if ( GL_FALSE == assemble_SCS(pR700AsmCode) ) + return GL_FALSE; + break; + + case OPCODE_SEQ: + if(OPCODE_IF == pILInst[i+1].Opcode) + { + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; + if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETE) ) + { + return GL_FALSE; + } + } + else if(OPCODE_BRK == pILInst[i+1].Opcode) + { +#ifdef USE_CF_FOR_CONTINUE_BREAK + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; +#else + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_BREAK; +#endif + if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETE) ) + { + return GL_FALSE; + } + } + else if(OPCODE_CONT == pILInst[i+1].Opcode) + { +#ifdef USE_CF_FOR_CONTINUE_BREAK + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; +#else + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_CONTINUE; +#endif + if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETE) ) + { + return GL_FALSE; + } + } + else + { + if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETE) ) + { + return GL_FALSE; + } + } + break; + + case OPCODE_SGT: + if(OPCODE_IF == pILInst[i+1].Opcode) + { + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; + if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGT) ) + { + return GL_FALSE; + } + } + else if(OPCODE_BRK == pILInst[i+1].Opcode) + { +#ifdef USE_CF_FOR_CONTINUE_BREAK + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; +#else + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_BREAK; +#endif + if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGT) ) + { + return GL_FALSE; + } + } + else if(OPCODE_CONT == pILInst[i+1].Opcode) + { +#ifdef USE_CF_FOR_CONTINUE_BREAK + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; +#else + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_CONTINUE; +#endif + + if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGT) ) + { + return GL_FALSE; + } + } + else + { + if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETGT) ) + { + return GL_FALSE; + } + } + break; + + case OPCODE_SGE: + if(OPCODE_IF == pILInst[i+1].Opcode) + { + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; + if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGE) ) + { + return GL_FALSE; + } + } + else if(OPCODE_BRK == pILInst[i+1].Opcode) + { +#ifdef USE_CF_FOR_CONTINUE_BREAK + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; +#else + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_BREAK; +#endif + if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGE) ) + { + return GL_FALSE; + } + } + else if(OPCODE_CONT == pILInst[i+1].Opcode) + { +#ifdef USE_CF_FOR_CONTINUE_BREAK + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; +#else + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_CONTINUE; +#endif + + if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGE) ) + { + return GL_FALSE; + } + } + else + { + if ( GL_FALSE == assemble_SGE(pR700AsmCode) ) + { + return GL_FALSE; + } + } + break; + + /* NO LT, LE, TODO : use GE => LE, GT => LT : reverse 2 src order would be simpliest. Or use SQ_CF_COND_FALSE for SQ_CF_COND_ACTIVE.*/ + case OPCODE_SLT: + { + struct prog_src_register SrcRegSave[2]; + SrcRegSave[0] = pILInst[i].SrcReg[0]; + SrcRegSave[1] = pILInst[i].SrcReg[1]; + pILInst[i].SrcReg[0] = SrcRegSave[1]; + pILInst[i].SrcReg[1] = SrcRegSave[0]; + if(OPCODE_IF == pILInst[i+1].Opcode) + { + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; + if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGT) ) + { + pILInst[i].SrcReg[0] = SrcRegSave[0]; + pILInst[i].SrcReg[1] = SrcRegSave[1]; + return GL_FALSE; + } + } + else if(OPCODE_BRK == pILInst[i+1].Opcode) + { +#ifdef USE_CF_FOR_CONTINUE_BREAK + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; +#else + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_BREAK; +#endif + if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGT) ) + { + pILInst[i].SrcReg[0] = SrcRegSave[0]; + pILInst[i].SrcReg[1] = SrcRegSave[1]; + return GL_FALSE; + } + } + else if(OPCODE_CONT == pILInst[i+1].Opcode) + { +#ifdef USE_CF_FOR_CONTINUE_BREAK + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; +#else + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_CONTINUE; +#endif + + if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGT) ) + { + pILInst[i].SrcReg[0] = SrcRegSave[0]; + pILInst[i].SrcReg[1] = SrcRegSave[1]; + return GL_FALSE; + } + } + else + { + if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETGT) ) + { + pILInst[i].SrcReg[0] = SrcRegSave[0]; + pILInst[i].SrcReg[1] = SrcRegSave[1]; + return GL_FALSE; + } + } + pILInst[i].SrcReg[0] = SrcRegSave[0]; + pILInst[i].SrcReg[1] = SrcRegSave[1]; + } break; - case OPCODE_FLR: - if ( GL_FALSE == assemble_FLR(pR700AsmCode) ) - return GL_FALSE; - break; - //case OP_FLR_INT: - // if ( GL_FALSE == assemble_FLR_INT() ) - // return GL_FALSE; - // break; - - case OPCODE_FRC: - if ( GL_FALSE == assemble_FRC(pR700AsmCode) ) - return GL_FALSE; - break; + case OPCODE_SLE: + { + struct prog_src_register SrcRegSave[2]; + SrcRegSave[0] = pILInst[i].SrcReg[0]; + SrcRegSave[1] = pILInst[i].SrcReg[1]; + pILInst[i].SrcReg[0] = SrcRegSave[1]; + pILInst[i].SrcReg[1] = SrcRegSave[0]; + if(OPCODE_IF == pILInst[i+1].Opcode) + { + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; + if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGE) ) + { + pILInst[i].SrcReg[0] = SrcRegSave[0]; + pILInst[i].SrcReg[1] = SrcRegSave[1]; + return GL_FALSE; + } + } + else if(OPCODE_BRK == pILInst[i+1].Opcode) + { +#ifdef USE_CF_FOR_CONTINUE_BREAK + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; +#else + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_BREAK; +#endif + if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGE) ) + { + pILInst[i].SrcReg[0] = SrcRegSave[0]; + pILInst[i].SrcReg[1] = SrcRegSave[1]; + return GL_FALSE; + } + } + else if(OPCODE_CONT == pILInst[i+1].Opcode) + { +#ifdef USE_CF_FOR_CONTINUE_BREAK + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; +#else + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_CONTINUE; +#endif - case OPCODE_KIL: - if ( GL_FALSE == assemble_KIL(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_LG2: - if ( GL_FALSE == assemble_LG2(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_LIT: - if ( GL_FALSE == assemble_LIT(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_LRP: - if ( GL_FALSE == assemble_LRP(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_LOG: - if ( GL_FALSE == assemble_LOG(pR700AsmCode) ) - return GL_FALSE; + if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGE) ) + { + pILInst[i].SrcReg[0] = SrcRegSave[0]; + pILInst[i].SrcReg[1] = SrcRegSave[1]; + return GL_FALSE; + } + } + else + { + if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETGE) ) + { + pILInst[i].SrcReg[0] = SrcRegSave[0]; + pILInst[i].SrcReg[1] = SrcRegSave[1]; + return GL_FALSE; + } + } + pILInst[i].SrcReg[0] = SrcRegSave[0]; + pILInst[i].SrcReg[1] = SrcRegSave[1]; + } break; - case OPCODE_MAD: - if ( GL_FALSE == assemble_MAD(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_MAX: - if ( GL_FALSE == assemble_MAX(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_MIN: - if ( GL_FALSE == assemble_MIN(pR700AsmCode) ) - return GL_FALSE; - break; - - case OPCODE_MOV: - if ( GL_FALSE == assemble_MOV(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_MUL: - if ( GL_FALSE == assemble_MUL(pR700AsmCode) ) - return GL_FALSE; - break; - - case OPCODE_POW: - if ( GL_FALSE == assemble_POW(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_RCP: - if ( GL_FALSE == assemble_RCP(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_RSQ: - if ( GL_FALSE == assemble_RSQ(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_SIN: - if ( GL_FALSE == assemble_SIN(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_SCS: - if ( GL_FALSE == assemble_SCS(pR700AsmCode) ) - return GL_FALSE; - break; - - case OPCODE_SGE: - if ( GL_FALSE == assemble_SGE(pR700AsmCode) ) - return GL_FALSE; - break; - case OPCODE_SLT: - if ( GL_FALSE == assemble_SLT(pR700AsmCode) ) - return GL_FALSE; - break; + case OPCODE_SNE: + if(OPCODE_IF == pILInst[i+1].Opcode) + { + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; + if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETNE) ) + { + return GL_FALSE; + } + } + else if(OPCODE_BRK == pILInst[i+1].Opcode) + { +#ifdef USE_CF_FOR_CONTINUE_BREAK + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; +#else + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_BREAK; +#endif + if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETNE) ) + { + return GL_FALSE; + } + } + else if(OPCODE_CONT == pILInst[i+1].Opcode) + { +#ifdef USE_CF_FOR_CONTINUE_BREAK + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; +#else + pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_CONTINUE; +#endif + if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETNE) ) + { + return GL_FALSE; + } + } + else + { + if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETNE) ) + { + return GL_FALSE; + } + } + break; //case OP_STP: // if ( GL_FALSE == assemble_STP(pR700AsmCode) ) @@ -4471,24 +6165,91 @@ GLboolean AssembleInstr(GLuint uiNumberInsts, break; case OPCODE_IF : - if ( GL_FALSE == assemble_IF(pR700AsmCode) ) - return GL_FALSE; + { + GLboolean bHasElse = GL_FALSE; + + if(pILInst[pILInst[i].BranchTarget - 1].Opcode == OPCODE_ELSE) + { + bHasElse = GL_TRUE; + } + + if ( GL_FALSE == assemble_IF(pR700AsmCode, bHasElse) ) + { + return GL_FALSE; + } + } break; + case OPCODE_ELSE : - radeon_error("Not yet implemented instruction OPCODE_ELSE \n"); - //if ( GL_FALSE == assemble_BAD("ELSE") ) + if ( GL_FALSE == assemble_ELSE(pR700AsmCode) ) return GL_FALSE; break; + case OPCODE_ENDIF: if ( GL_FALSE == assemble_ENDIF(pR700AsmCode) ) return GL_FALSE; break; + case OPCODE_BGNLOOP: + if( GL_FALSE == assemble_BGNLOOP(pR700AsmCode) ) + { + return GL_FALSE; + } + break; + + case OPCODE_BRK: + if( GL_FALSE == assemble_BRK(pR700AsmCode) ) + { + return GL_FALSE; + } + break; + + case OPCODE_CONT: + if( GL_FALSE == assemble_CONT(pR700AsmCode) ) + { + return GL_FALSE; + } + break; + + case OPCODE_ENDLOOP: + if( GL_FALSE == assemble_ENDLOOP(pR700AsmCode) ) + { + return GL_FALSE; + } + break; + + case OPCODE_BGNSUB: + if( GL_FALSE == assemble_BGNSUB(pR700AsmCode, i) ) + { + return GL_FALSE; + } + break; + + case OPCODE_RET: + if( GL_FALSE == assemble_RET(pR700AsmCode) ) + { + return GL_FALSE; + } + break; + + case OPCODE_CAL: + if( GL_FALSE == assemble_CAL(pR700AsmCode, + pILInst[i].BranchTarget, + uiNumberInsts, + pILInst) ) + { + return GL_FALSE; + } + break; + //case OPCODE_EXPORT: // if ( GL_FALSE == assemble_EXPORT() ) // return GL_FALSE; // break; + case OPCODE_ENDSUB: + return assemble_ENDSUB(pR700AsmCode); + case OPCODE_END: //pR700AsmCode->uiCurInst = i; //This is to remaind that if in later exoort there is depth/stencil @@ -4505,6 +6266,116 @@ GLboolean AssembleInstr(GLuint uiNumberInsts, return GL_TRUE; } +GLboolean InitShaderProgram(r700_AssemblerBase * pAsm) +{ + setRetInLoopFlag(pAsm, SQ_SEL_0); + return GL_TRUE; +} + +GLboolean RelocProgram(r700_AssemblerBase * pAsm) +{ + GLuint i; + GLuint unCFoffset; + TypedShaderList * plstCFmain; + TypedShaderList * plstCFsub; + + R700ShaderInstruction * pInst; + R700ControlFlowGenericClause * pCFInst; + + if(0 == pAsm->unSubArrayPointer) + { + return GL_TRUE; + } + + plstCFmain = pAsm->CALLSTACK[0].plstCFInstructions_local; + unCFoffset = plstCFmain->uNumOfNode; + + /* Reloc subs */ + for(i=0; iunSubArrayPointer; i++) + { + pAsm->subs[i].unCFoffset = unCFoffset; + plstCFsub = &(pAsm->subs[i].lstCFInstructions_local); + + pInst = plstCFsub->pHead; + + /* reloc instructions */ + while(pInst) + { + if(SIT_CF_GENERIC == pInst->m_ShaderInstType) + { + pCFInst = (R700ControlFlowGenericClause *)pInst; + + switch (pCFInst->m_Word1.f.cf_inst) + { + case SQ_CF_INST_POP: + case SQ_CF_INST_JUMP: + case SQ_CF_INST_ELSE: + case SQ_CF_INST_LOOP_END: + case SQ_CF_INST_LOOP_START: + case SQ_CF_INST_LOOP_START_NO_AL: + case SQ_CF_INST_LOOP_CONTINUE: + case SQ_CF_INST_LOOP_BREAK: + pCFInst->m_Word0.f.addr += unCFoffset; + break; + default: + break; + } + } + + pInst->m_uIndex += unCFoffset; + + pInst = pInst->pNextInst; + }; + + /* Put sub into main */ + plstCFmain->pTail->pNextInst = plstCFsub->pHead; + plstCFmain->pTail = plstCFsub->pTail; + plstCFmain->uNumOfNode += plstCFsub->uNumOfNode; + + unCFoffset += plstCFsub->uNumOfNode; + } + + /* reloc callers */ + for(i=0; iunCallerArrayPointer; i++) + { + pAsm->callers[i].cf_ptr->m_Word0.f.addr + = pAsm->subs[pAsm->callers[i].subDescIndex].unCFoffset; + } + + /* remove flags init if they are not used */ + if((pAsm->unCFflags & HAS_LOOPRET) == 0) + { + R700ControlFlowALUClause * pCF_ALU; + pInst = plstCFmain->pHead; + while(pInst) + { + if(SIT_CF_ALU == pInst->m_ShaderInstType) + { + pCF_ALU = (R700ControlFlowALUClause *)pInst; + if(1 == pCF_ALU->m_Word1.f.count) + { + pCF_ALU->m_Word1.f.cf_inst = SQ_CF_INST_NOP; + } + else + { + R700ALUInstruction * pALU = pCF_ALU->m_pLinkedALUInstruction; + + pALU->m_pLinkedALUClause = NULL; + pALU = (R700ALUInstruction *)(pALU->pNextInst); + pALU->m_pLinkedALUClause = pCF_ALU; + pCF_ALU->m_pLinkedALUInstruction = pALU; + + pCF_ALU->m_Word1.f.count--; + } + break; + } + pInst = pInst->pNextInst; + }; + } + + return GL_TRUE; +} + GLboolean Process_Export(r700_AssemblerBase* pAsm, GLuint type, GLuint export_starting_index, @@ -4800,6 +6671,25 @@ GLboolean Process_Vertex_Exports(r700_AssemblerBase *pR700AsmCode, } } + for(i=VERT_RESULT_VAR0; iucVP_OutputMap[i], + GL_FALSE) ) + { + return GL_FALSE; + } + + export_starting_index++; + } + } + // At least one param should be exported if (export_count) { @@ -4833,6 +6723,16 @@ GLboolean Clean_Up_Assembler(r700_AssemblerBase *pR700AsmCode) { FREE(pR700AsmCode->pucOutMask); FREE(pR700AsmCode->pInstDeps); + + if(NULL != pR700AsmCode->subs) + { + FREE(pR700AsmCode->subs); + } + if(NULL != pR700AsmCode->callers) + { + FREE(pR700AsmCode->callers); + } + return GL_TRUE; } diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index c66db502a1..85d32212c0 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -72,7 +72,8 @@ typedef enum SrcRegisterType SRC_REG_INPUT = 1, SRC_REG_CONSTANT = 2, SRC_REG_ALT_TEMPORARY = 3, - NUMBER_OF_SRC_REG_TYPE = 4 + SRC_REC_LITERAL = 4, + NUMBER_OF_SRC_REG_TYPE = 5 } SrcRegisterType; typedef enum DstRegisterType @@ -111,6 +112,12 @@ typedef struct PVSDSTtag BITS addrmode1:1; //32 } PVSDST; +typedef struct PVSINSTtag +{ + BITS literal :2; + BITS SaturateMode :2; +} PVSINST; + typedef struct PVSSRCtag { BITS rtype:4; @@ -148,6 +155,7 @@ typedef union PVSDWORDtag { BITS bits; PVSDST dst; + PVSINST dst2; PVSSRC src; PVSMATH math; float f; @@ -263,14 +271,15 @@ enum typedef struct FC_LEVEL { - unsigned int first; ///< first fc instruction on level (if, rep, loop) - unsigned int* mid; ///< middle instructions - else or all breaks on this level - unsigned int midLen; - unsigned int type; - unsigned int cond; - unsigned int inv; - unsigned int bpush; ///< 1 if first instruction does branch stack push - int id; ///< id of bool or int variable + R700ControlFlowGenericClause * first; + R700ControlFlowGenericClause ** mid; + unsigned int unNumMid; + unsigned int midLen; + unsigned int type; + unsigned int cond; + unsigned int inv; + unsigned int bpush; ///< 1 if first instruction does branch stack push + int id; ///< id of bool or int variable } FC_LEVEL; typedef struct VTX_FETCH_METHOD @@ -279,6 +288,28 @@ typedef struct VTX_FETCH_METHOD GLuint mega_fetch_remainder; } VTX_FETCH_METHOD; +typedef struct SUB_OFFSET +{ + GLint subIL_Offset; + GLuint unCFoffset; + TypedShaderList lstCFInstructions_local; +} SUB_OFFSET; + +typedef struct CALLER_POINTER +{ + GLint subIL_Offset; + GLint subDescIndex; + R700ControlFlowGenericClause* cf_ptr; +} CALLER_POINTER; + +#define SQ_MAX_CALL_DEPTH 0x00000020 + +typedef struct CALL_LEVEL +{ + unsigned int FCSP_BeforeEntry; + TypedShaderList * plstCFInstructions_local; +} CALL_LEVEL; + typedef struct r700_AssemblerBase { R700ControlFlowSXClause* cf_last_export_ptr; @@ -294,11 +325,14 @@ typedef struct r700_AssemblerBase // No clause has been created yet CF_CLAUSE_TYPE cf_current_clause_type; + BITS alu_x_opcode; + GLuint number_of_exports; GLuint number_of_colorandz_exports; GLuint number_of_export_opcodes; PVSDWORD D; + PVSDWORD D2; PVSDWORD S[3]; unsigned int uLastPosUpdate; @@ -310,6 +344,8 @@ typedef struct r700_AssemblerBase unsigned int number_used_registers; unsigned int uUsedConsts; + unsigned int flag_reg_index; + // Fragment programs unsigned int uiFP_AttributeMap[FRAG_ATTRIB_MAX]; unsigned int uiFP_OutputMap[FRAG_RESULT_MAX]; @@ -378,6 +414,18 @@ typedef struct r700_AssemblerBase GLboolean is_tex; /* we inserted helper intructions and need barrier on next TEX ins */ GLboolean need_tex_barrier; + + SUB_OFFSET * subs; + GLuint unSubArraySize; + GLuint unSubArrayPointer; + CALLER_POINTER * callers; + GLuint unCallerArraySize; + GLuint unCallerArrayPointer; + unsigned int CALLSP; + CALL_LEVEL CALLSTACK[SQ_MAX_CALL_DEPTH]; + + GLuint unCFflags; + } r700_AssemblerBase; //Internal use @@ -446,6 +494,10 @@ GLboolean assemble_alu_src(R700ALUInstruction* alu_instruction_ptr, GLboolean add_alu_instruction(r700_AssemblerBase* pAsm, R700ALUInstruction* alu_instruction_ptr, GLuint contiguous_slots_needed); + +GLboolean add_cf_instruction(r700_AssemblerBase* pAsm); +void add_return_inst(r700_AssemblerBase *pAsm); + void get_src_properties(R700ALUInstruction* alu_instruction_ptr, int source_index, BITS* psrc_sel, @@ -467,6 +519,21 @@ GLboolean check_vector(r700_AssemblerBase* pAsm, R700ALUInstruction* alu_instruction_ptr); GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm); GLboolean next_ins(r700_AssemblerBase *pAsm); + +GLboolean next_ins2(r700_AssemblerBase *pAsm); +GLboolean assemble_alu_instruction2(r700_AssemblerBase *pAsm); + +/* TODO : merge next_ins/2/literal, assemble_alu_instruction/2/literal */ +GLboolean next_ins_literal(r700_AssemblerBase *pAsm, GLfloat * pLiteral); +GLboolean assemble_alu_instruction_literal(r700_AssemblerBase *pAsm, GLfloat * pLiteral); + +GLboolean pops(r700_AssemblerBase *pAsm, GLuint pops); +GLboolean jumpToOffest(r700_AssemblerBase *pAsm, GLuint pops, GLint offset); +GLboolean setRetInLoopFlag(r700_AssemblerBase *pAsm, GLuint flagValue); +GLboolean testFlag(r700_AssemblerBase *pAsm); +GLboolean breakLoopOnFlag(r700_AssemblerBase *pAsm, GLuint unFCSP); +GLboolean returnOnFlag(r700_AssemblerBase *pAsm); + GLboolean assemble_math_function(r700_AssemblerBase* pAsm, BITS opcode); GLboolean assemble_ABS(r700_AssemblerBase *pAsm); GLboolean assemble_ADD(r700_AssemblerBase *pAsm); @@ -497,14 +564,32 @@ GLboolean assemble_RSQ(r700_AssemblerBase *pAsm); GLboolean assemble_SIN(r700_AssemblerBase *pAsm); GLboolean assemble_SCS(r700_AssemblerBase *pAsm); GLboolean assemble_SGE(r700_AssemblerBase *pAsm); + +GLboolean assemble_LOGIC(r700_AssemblerBase *pAsm, BITS opcode); +GLboolean assemble_LOGIC_PRED(r700_AssemblerBase *pAsm, BITS opcode); + GLboolean assemble_SLT(r700_AssemblerBase *pAsm); GLboolean assemble_STP(r700_AssemblerBase *pAsm); GLboolean assemble_TEX(r700_AssemblerBase *pAsm); GLboolean assemble_XPD(r700_AssemblerBase *pAsm); GLboolean assemble_EXPORT(r700_AssemblerBase *pAsm); -GLboolean assemble_IF(r700_AssemblerBase *pAsm); +GLboolean assemble_IF(r700_AssemblerBase *pAsm, GLboolean bHasElse); +GLboolean assemble_ELSE(r700_AssemblerBase *pAsm); GLboolean assemble_ENDIF(r700_AssemblerBase *pAsm); +GLboolean assemble_BGNLOOP(r700_AssemblerBase *pAsm); +GLboolean assemble_BRK(r700_AssemblerBase *pAsm); +GLboolean assemble_COND(r700_AssemblerBase *pAsm); +GLboolean assemble_ENDLOOP(r700_AssemblerBase *pAsm); + +GLboolean assemble_BGNSUB(r700_AssemblerBase *pAsm, GLint nILindex); +GLboolean assemble_ENDSUB(r700_AssemblerBase *pAsm); +GLboolean assemble_RET(r700_AssemblerBase *pAsm); +GLboolean assemble_CAL(r700_AssemblerBase *pAsm, + GLint nILindex, + GLuint uiNumberInsts, + struct prog_instruction *pILInst); + GLboolean Process_Export(r700_AssemblerBase* pAsm, GLuint type, GLuint export_starting_index, @@ -516,12 +601,16 @@ GLboolean Move_Depth_Exports_To_Correct_Channels(r700_AssemblerBase *pAsm, //Interface -GLboolean AssembleInstr(GLuint uiNumberInsts, +GLboolean AssembleInstr(GLuint uiFirstInst, + GLuint uiNumberInsts, struct prog_instruction *pILInst, r700_AssemblerBase *pR700AsmCode); GLboolean Process_Fragment_Exports(r700_AssemblerBase *pR700AsmCode, GLbitfield OutputsWritten); GLboolean Process_Vertex_Exports(r700_AssemblerBase *pR700AsmCode, GLbitfield OutputsWritten); +GLboolean RelocProgram(r700_AssemblerBase * pAsm); +GLboolean InitShaderProgram(r700_AssemblerBase * pAsm); + int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700_Shader* pShader); GLboolean Clean_Up_Assembler(r700_AssemblerBase *pR700AsmCode); diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index ec76fbcb6d..197916ac0d 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -442,68 +442,77 @@ static void r700SendRenderTargetState(GLcontext *ctx, struct radeon_state_atom * static void r700SendPSState(GLcontext *ctx, struct radeon_state_atom *atom) { - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - struct radeon_bo * pbo; - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); + context_t *context = R700_CONTEXT(ctx); + R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); + struct radeon_bo * pbo; + BATCH_LOCALS(&context->radeon); + radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - pbo = (struct radeon_bo *)r700GetActiveFpShaderBo(GL_CONTEXT(context)); + pbo = (struct radeon_bo *)r700GetActiveFpShaderBo(GL_CONTEXT(context)); - if (!pbo) - return; + if (!pbo) + return; - r700SyncSurf(context, pbo, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit); + r700SyncSurf(context, pbo, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit); - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - R600_OUT_BATCH_REGSEQ(SQ_PGM_START_PS, 1); - R600_OUT_BATCH(r700->ps.SQ_PGM_START_PS.u32All); - R600_OUT_BATCH_RELOC(r700->ps.SQ_PGM_START_PS.u32All, - pbo, - r700->ps.SQ_PGM_START_PS.u32All, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); + BEGIN_BATCH_NO_AUTOSTATE(3 + 2); + R600_OUT_BATCH_REGSEQ(SQ_PGM_START_PS, 1); + R600_OUT_BATCH(r700->ps.SQ_PGM_START_PS.u32All); + R600_OUT_BATCH_RELOC(r700->ps.SQ_PGM_START_PS.u32All, + pbo, + r700->ps.SQ_PGM_START_PS.u32All, + RADEON_GEM_DOMAIN_GTT, 0, 0); + END_BATCH(); - BEGIN_BATCH_NO_AUTOSTATE(9); - R600_OUT_BATCH_REGVAL(SQ_PGM_RESOURCES_PS, r700->ps.SQ_PGM_RESOURCES_PS.u32All); - R600_OUT_BATCH_REGVAL(SQ_PGM_EXPORTS_PS, r700->ps.SQ_PGM_EXPORTS_PS.u32All); - R600_OUT_BATCH_REGVAL(SQ_PGM_CF_OFFSET_PS, r700->ps.SQ_PGM_CF_OFFSET_PS.u32All); - END_BATCH(); + BEGIN_BATCH_NO_AUTOSTATE(9); + R600_OUT_BATCH_REGVAL(SQ_PGM_RESOURCES_PS, r700->ps.SQ_PGM_RESOURCES_PS.u32All); + R600_OUT_BATCH_REGVAL(SQ_PGM_EXPORTS_PS, r700->ps.SQ_PGM_EXPORTS_PS.u32All); + R600_OUT_BATCH_REGVAL(SQ_PGM_CF_OFFSET_PS, r700->ps.SQ_PGM_CF_OFFSET_PS.u32All); + END_BATCH(); - COMMIT_BATCH(); + BEGIN_BATCH_NO_AUTOSTATE(3); + R600_OUT_BATCH_REGVAL(SQ_LOOP_CONST_0, 0x01000FFF); + END_BATCH(); + + COMMIT_BATCH(); } static void r700SendVSState(GLcontext *ctx, struct radeon_state_atom *atom) { - context_t *context = R700_CONTEXT(ctx); - R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); - struct radeon_bo * pbo; - BATCH_LOCALS(&context->radeon); - radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); + context_t *context = R700_CONTEXT(ctx); + R700_CHIP_CONTEXT *r700 = R700_CONTEXT_STATES(context); + struct radeon_bo * pbo; + BATCH_LOCALS(&context->radeon); + radeon_print(RADEON_STATE, RADEON_VERBOSE, "%s\n", __func__); - pbo = (struct radeon_bo *)r700GetActiveVpShaderBo(GL_CONTEXT(context)); + pbo = (struct radeon_bo *)r700GetActiveVpShaderBo(GL_CONTEXT(context)); - if (!pbo) - return; + if (!pbo) + return; - r700SyncSurf(context, pbo, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit); + r700SyncSurf(context, pbo, RADEON_GEM_DOMAIN_GTT, 0, SH_ACTION_ENA_bit); - BEGIN_BATCH_NO_AUTOSTATE(3 + 2); - R600_OUT_BATCH_REGSEQ(SQ_PGM_START_VS, 1); - R600_OUT_BATCH(r700->vs.SQ_PGM_START_VS.u32All); - R600_OUT_BATCH_RELOC(r700->vs.SQ_PGM_START_VS.u32All, - pbo, - r700->vs.SQ_PGM_START_VS.u32All, - RADEON_GEM_DOMAIN_GTT, 0, 0); - END_BATCH(); + BEGIN_BATCH_NO_AUTOSTATE(3 + 2); + R600_OUT_BATCH_REGSEQ(SQ_PGM_START_VS, 1); + R600_OUT_BATCH(r700->vs.SQ_PGM_START_VS.u32All); + R600_OUT_BATCH_RELOC(r700->vs.SQ_PGM_START_VS.u32All, + pbo, + r700->vs.SQ_PGM_START_VS.u32All, + RADEON_GEM_DOMAIN_GTT, 0, 0); + END_BATCH(); - BEGIN_BATCH_NO_AUTOSTATE(6); - R600_OUT_BATCH_REGVAL(SQ_PGM_RESOURCES_VS, r700->vs.SQ_PGM_RESOURCES_VS.u32All); - R600_OUT_BATCH_REGVAL(SQ_PGM_CF_OFFSET_VS, r700->vs.SQ_PGM_CF_OFFSET_VS.u32All); - END_BATCH(); + BEGIN_BATCH_NO_AUTOSTATE(6); + R600_OUT_BATCH_REGVAL(SQ_PGM_RESOURCES_VS, r700->vs.SQ_PGM_RESOURCES_VS.u32All); + R600_OUT_BATCH_REGVAL(SQ_PGM_CF_OFFSET_VS, r700->vs.SQ_PGM_CF_OFFSET_VS.u32All); + END_BATCH(); - COMMIT_BATCH(); + BEGIN_BATCH_NO_AUTOSTATE(3); + R600_OUT_BATCH_REGVAL((SQ_LOOP_CONST_0 + 32*4), 0x0100000F); + //R600_OUT_BATCH_REGVAL((SQ_LOOP_CONST_0 + (SQ_LOOP_CONST_vs<2)), 0x0100000F); + END_BATCH(); + + COMMIT_BATCH(); } static void r700SendFSState(GLcontext *ctx, struct radeon_state_atom *atom) diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c index ccafd433bf..21ac46e7b8 100644 --- a/src/mesa/drivers/dri/r600/r700_fragprog.c +++ b/src/mesa/drivers/dri/r600/r700_fragprog.c @@ -73,11 +73,11 @@ void Map_Fragment_Program(r700_AssemblerBase *pAsm, pAsm->uiFP_AttributeMap[FRAG_ATTRIB_COL1] = pAsm->number_used_registers++; } - unBit = 1 << FRAG_ATTRIB_FOGC; - if(mesa_fp->Base.InputsRead & unBit) - { - pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FOGC] = pAsm->number_used_registers++; - } + unBit = 1 << FRAG_ATTRIB_FOGC; + if(mesa_fp->Base.InputsRead & unBit) + { + pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FOGC] = pAsm->number_used_registers++; + } for(i=0; i<8; i++) { @@ -88,6 +88,62 @@ void Map_Fragment_Program(r700_AssemblerBase *pAsm, } } +/* order has been taken care of */ +#if 1 + for(i=FRAG_ATTRIB_VAR0; iBase.InputsRead & unBit) + { + pAsm->uiFP_AttributeMap[i] = pAsm->number_used_registers++; + } + } +#else + if( (mesa_fp->Base.InputsRead >> FRAG_ATTRIB_VAR0) > 0 ) + { + struct r700_vertex_program_cont *vpc = + (struct r700_vertex_program_cont *)ctx->VertexProgram._Current; + struct gl_program_parameter_list * VsVarying = vpc->mesa_program.Base.Varying; + struct gl_program_parameter_list * PsVarying = mesa_fp->Base.Varying; + struct gl_program_parameter * pVsParam; + struct gl_program_parameter * pPsParam; + GLuint j, k; + GLuint unMaxVarying = 0; + + for(i=0; iNumParameters; i++) + { + pAsm->uiFP_AttributeMap[i + FRAG_ATTRIB_VAR0] = 0; + } + + for(i=FRAG_ATTRIB_VAR0; iBase.InputsRead & unBit) + { + j = i - FRAG_ATTRIB_VAR0; + pPsParam = PsVarying->Parameters + j; + + for(k=0; kNumParameters; k++) + { + pVsParam = VsVarying->Parameters + k; + + if( strcmp(pPsParam->Name, pVsParam->Name) == 0) + { + pAsm->uiFP_AttributeMap[i] = pAsm->number_used_registers + k; + if(k > unMaxVarying) + { + unMaxVarying = k; + } + break; + } + } + } + } + + pAsm->number_used_registers += unMaxVarying + 1; + } +#endif + /* Map temporary registers (GPRs) */ pAsm->starting_temp_register_number = pAsm->number_used_registers; @@ -127,6 +183,8 @@ void Map_Fragment_Program(r700_AssemblerBase *pAsm, pAsm->pucOutMask[ui] = 0x0; } + pAsm->flag_reg_index = pAsm->number_used_registers++; + pAsm->uFirstHelpReg = pAsm->number_used_registers; } @@ -247,8 +305,11 @@ GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp, { return GL_FALSE; } + + InitShaderProgram(&(fp->r700AsmCode)); - if( GL_FALSE == AssembleInstr(mesa_fp->Base.NumInstructions, + if( GL_FALSE == AssembleInstr(0, + mesa_fp->Base.NumInstructions, &(mesa_fp->Base.Instructions[0]), &(fp->r700AsmCode)) ) { @@ -260,6 +321,11 @@ GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp, return GL_FALSE; } + if( GL_FALSE == RelocProgram(&(fp->r700AsmCode)) ) + { + return GL_FALSE; + } + fp->r700Shader.nRegs = (fp->r700AsmCode.number_used_registers == 0) ? 0 : (fp->r700AsmCode.number_used_registers - 1); @@ -459,6 +525,22 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx) } } + for(i=FRAG_ATTRIB_VAR0; iBase.InputsRead & unBit) + { + ui = pAsm->uiFP_AttributeMap[i]; + SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); + SETfield(r700->SPI_PS_INPUT_CNTL[ui].u32All, ui, + SEMANTIC_shift, SEMANTIC_mask); + if (r700->SPI_INTERP_CONTROL_0.u32All & FLAT_SHADE_ENA_bit) + SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); + else + CLEARbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); + } + } + exportCount = (r700->ps.SQ_PGM_EXPORTS_PS.u32All & EXPORT_MODE_mask) / (1 << EXPORT_MODE_shift); if (r700->CB_SHADER_CONTROL.u32All != ((1 << exportCount) - 1)) { diff --git a/src/mesa/drivers/dri/r600/r700_shader.c b/src/mesa/drivers/dri/r600/r700_shader.c index 955ea4e4e1..2eed1acc2f 100644 --- a/src/mesa/drivers/dri/r600/r700_shader.c +++ b/src/mesa/drivers/dri/r600/r700_shader.c @@ -159,13 +159,18 @@ void Init_R700_Shader(R700_Shader * pShader) pShader->lstVTXInstructions.uNumOfNode=0; } +void SetActiveCFlist(R700_Shader *pShader, TypedShaderList * plstCF) +{ + pShader->plstCFInstructions_active = plstCF; +} + void AddCFInstruction(R700_Shader *pShader, R700ControlFlowInstruction *pCFInst) { R700ControlFlowSXClause* pSXClause; R700ControlFlowSMXClause* pSMXClause; - pCFInst->m_uIndex = pShader->lstCFInstructions.uNumOfNode; - AddInstToList(&(pShader->lstCFInstructions), + pCFInst->m_uIndex = pShader->plstCFInstructions_active->uNumOfNode; + AddInstToList(pShader->plstCFInstructions_active, (R700ShaderInstruction*)pCFInst); pShader->uShaderBinaryDWORDSize += GetInstructionSize(pCFInst->m_ShaderInstType); diff --git a/src/mesa/drivers/dri/r600/r700_shader.h b/src/mesa/drivers/dri/r600/r700_shader.h index c6a058617e..0599ffd901 100644 --- a/src/mesa/drivers/dri/r600/r700_shader.h +++ b/src/mesa/drivers/dri/r600/r700_shader.h @@ -109,6 +109,7 @@ typedef struct R700_Shader GLuint uStackSize; GLuint uMaxCallDepth; + TypedShaderList * plstCFInstructions_active; TypedShaderList lstCFInstructions; TypedShaderList lstALUInstructions; TypedShaderList lstTEXInstructions; @@ -132,13 +133,13 @@ void TakeInstOutFromList(TypedShaderList * plstCFInstructions, R700ShaderInstruc void ResolveLinks(R700_Shader *pShader); void Assemble(R700_Shader *pShader); - //Interface void Init_R700_Shader(R700_Shader * pShader); void AddCFInstruction(R700_Shader *pShader, R700ControlFlowInstruction *pCFInst); void AddVTXInstruction(R700_Shader *pShader, R700VertexInstruction *pVTXInst); void AddTEXInstruction(R700_Shader *pShader, R700TextureInstruction *pTEXInst); void AddALUInstruction(R700_Shader *pShader, R700ALUInstruction *pALUInst); +void SetActiveCFlist(R700_Shader *pShader, TypedShaderList * plstCF); void LoadProgram(R700_Shader *pShader); void UpdateShaderRegisters(R700_Shader *pShader); diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c index ffc6068bd8..c8f72d588b 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.c +++ b/src/mesa/drivers/dri/r600/r700_vertprog.c @@ -111,6 +111,15 @@ unsigned int Map_Vertex_Output(r700_AssemblerBase *pAsm, } } + for(i=VERT_RESULT_VAR0; iBase.OutputsWritten & unBit) + { + pAsm->ucVP_OutputMap[i] = unTotal++; + } + } + return (unTotal - unStart); } @@ -235,6 +244,8 @@ void Map_Vertex_Program(GLcontext *ctx, pAsm->number_used_registers += mesa_vp->Base.NumTemporaries; } + pAsm->flag_reg_index = pAsm->number_used_registers++; + pAsm->uFirstHelpReg = pAsm->number_used_registers; } @@ -324,7 +335,10 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, return NULL; } - if(GL_FALSE == AssembleInstr(vp->mesa_program->Base.NumInstructions, + InitShaderProgram(&(vp->r700AsmCode)); + + if(GL_FALSE == AssembleInstr(0, + vp->mesa_program->Base.NumInstructions, &(vp->mesa_program->Base.Instructions[0]), &(vp->r700AsmCode)) ) { @@ -336,6 +350,11 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, return NULL; } + if( GL_FALSE == RelocProgram(&(vp->r700AsmCode)) ) + { + return GL_FALSE; + } + vp->r700Shader.nRegs = (vp->r700AsmCode.number_used_registers == 0) ? 0 : (vp->r700AsmCode.number_used_registers - 1); -- cgit v1.2.3 From de460871605c5575c5513dd1283cb61710b60cfe Mon Sep 17 00:00:00 2001 From: Richard Li Date: Wed, 18 Nov 2009 14:43:59 -0500 Subject: r600 : add some defs --- src/mesa/drivers/dri/r600/r700_assembler.c | 35 ++++++++++++++++++++++++++++-- src/mesa/drivers/dri/r600/r700_assembler.h | 21 ++++++++++++++++++ src/mesa/drivers/dri/r600/r700_shader.c | 2 +- 3 files changed, 55 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 4b5d40bd3a..6e8d1cd927 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -39,6 +39,7 @@ #include "r700_assembler.h" #define USE_CF_FOR_CONTINUE_BREAK 1 +#define USE_CF_FOR_POP_AFTER 1 BITS addrmode_PVSDST(PVSDST * pPVSDST) { @@ -489,10 +490,12 @@ int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700 pAsm->unCallerArrayPointer = 0; pAsm->CALLSP = 0; - pAsm->CALLSTACK[0].FCSP_BeforeEntry; + pAsm->CALLSTACK[0].FCSP_BeforeEntry = 0; pAsm->CALLSTACK[0].plstCFInstructions_local = &(pAsm->pR700Shader->lstCFInstructions); + pAsm->CALLSTACK[0].stackUsage.bits = 0; + SetActiveCFlist(pAsm->pR700Shader, pAsm->CALLSTACK[0].plstCFInstructions_local); pAsm->unCFflags = 0; @@ -4978,6 +4981,21 @@ GLboolean assemble_EXPORT(r700_AssemblerBase *pAsm) return GL_TRUE; } +inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason) +{ + switch (uReason) + { + case FC_PUSH_VPM: + break; + case FC_PUSH_WQM: + break; + case FC_LOOP: + break; + case FC_REP: + break; + }; +} + GLboolean jumpToOffest(r700_AssemblerBase *pAsm, GLuint pops, GLint offset) { if(GL_FALSE == add_cf_instruction(pAsm) ) @@ -5024,7 +5042,7 @@ GLboolean pops(r700_AssemblerBase *pAsm, GLuint pops) return GL_TRUE; } -GLboolean assemble_IF(r700_AssemblerBase *pAsm) +GLboolean assemble_IF(r700_AssemblerBase *pAsm, GLboolean bHasElse) { if(GL_FALSE == add_cf_instruction(pAsm) ) { @@ -5056,10 +5074,12 @@ GLboolean assemble_IF(r700_AssemblerBase *pAsm) pAsm->fc_stack[pAsm->FCSP].midLen= 0; pAsm->fc_stack[pAsm->FCSP].first = pAsm->cf_current_cf_clause_ptr; +#ifndef USE_CF_FOR_POP_AFTER if(GL_TRUE != bHasElse) { pAsm->alu_x_opcode = SQ_CF_INST_ALU_POP_AFTER; } +#endif /* USE_CF_FOR_POP_AFTER */ pAsm->branch_depth++; @@ -5072,6 +5092,10 @@ GLboolean assemble_IF(r700_AssemblerBase *pAsm) GLboolean assemble_ELSE(r700_AssemblerBase *pAsm) { +#ifdef USE_CF_FOR_POP_AFTER + pops(pAsm, 1); +#endif /* USE_CF_FOR_POP_AFTER */ + if(GL_FALSE == add_cf_instruction(pAsm) ) { return GL_FALSE; @@ -5094,7 +5118,9 @@ GLboolean assemble_ELSE(r700_AssemblerBase *pAsm) pAsm->fc_stack[pAsm->FCSP].mid[0] = pAsm->cf_current_cf_clause_ptr; //pAsm->fc_stack[pAsm->FCSP].unNumMid = 1; +#ifndef USE_CF_FOR_POP_AFTER pAsm->alu_x_opcode = SQ_CF_INST_ALU_POP_AFTER; +#endif /* USE_CF_FOR_POP_AFTER */ pAsm->fc_stack[pAsm->FCSP].first->m_Word0.f.addr = pAsm->pR700Shader->plstCFInstructions_active->uNumOfNode - 1; @@ -5103,6 +5129,10 @@ GLboolean assemble_ELSE(r700_AssemblerBase *pAsm) GLboolean assemble_ENDIF(r700_AssemblerBase *pAsm) { +#ifdef USE_CF_FOR_POP_AFTER + pops(pAsm, 1); +#endif /* USE_CF_FOR_POP_AFTER */ + pAsm->alu_x_opcode = SQ_CF_INST_ALU; if(NULL == pAsm->fc_stack[pAsm->FCSP].mid) @@ -5410,6 +5440,7 @@ GLboolean assemble_BGNSUB(r700_AssemblerBase *pAsm, GLint nILindex) pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry = pAsm->FCSP; pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local = &(pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local); + pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.bits = 0; SetActiveCFlist(pAsm->pR700Shader, pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local); diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index 85d32212c0..516923f67c 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -259,6 +259,8 @@ enum FC_IF = 1, FC_LOOP = 2, FC_REP = 3, + FC_PUSH_VPM = 4, + FC_PUSH_WQM = 5, COND_NONE = 0, COND_BOOL = 1, @@ -304,12 +306,30 @@ typedef struct CALLER_POINTER #define SQ_MAX_CALL_DEPTH 0x00000020 +typedef struct STACK_USAGE +{ + BITS pushs :8; + BITS current :8; + BITS max :8; +} STACK_USAGE; + +typedef union STACKDWORDtag +{ + BITS bits; + STACK_USAGE su; +} STACKDWORD; + typedef struct CALL_LEVEL { unsigned int FCSP_BeforeEntry; + STACKDWORD stackUsage; TypedShaderList * plstCFInstructions_local; } CALL_LEVEL; +#define HAS_CURRENT_LOOPRET 0x1L +#define HAS_LOOPRET 0x2L +#define LOOPRET_FLAGS HAS_LOOPRET | HAS_CURRENT_LOOPRET + typedef struct r700_AssemblerBase { R700ControlFlowSXClause* cf_last_export_ptr; @@ -429,6 +449,7 @@ typedef struct r700_AssemblerBase } r700_AssemblerBase; //Internal use +inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason); BITS addrmode_PVSDST(PVSDST * pPVSDST); void setaddrmode_PVSDST(PVSDST * pPVSDST, BITS addrmode); void nomask_PVSDST(PVSDST * pPVSDST); diff --git a/src/mesa/drivers/dri/r600/r700_shader.c b/src/mesa/drivers/dri/r600/r700_shader.c index 2eed1acc2f..db951e48c4 100644 --- a/src/mesa/drivers/dri/r600/r700_shader.c +++ b/src/mesa/drivers/dri/r600/r700_shader.c @@ -140,7 +140,7 @@ void Init_R700_Shader(R700_Shader * pShader) pShader->killIsUsed = GL_FALSE; pShader->uCFOffset = 0; - pShader->uStackSize = 0; + pShader->uStackSize = 10; //richard test pShader->uMaxCallDepth = 0; pShader->bSurfAllocated = GL_FALSE; -- cgit v1.2.3 From eec428280075c12dfef61bf3f18012dece384923 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Wed, 18 Nov 2009 14:56:01 -0500 Subject: r600 : update PS and VS emit count for loop constants. --- src/mesa/drivers/dri/r600/r700_chip.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index 197916ac0d..705b5738ed 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -1310,8 +1310,8 @@ void r600InitAtoms(context_t *context) ALLOC_STATE(spi, always, (59 + R700_MAX_SHADER_EXPORTS), r700SendSPIState); ALLOC_STATE(vpt, always, 16, r700SendViewportState); ALLOC_STATE(fs, always, 18, r700SendFSState); - ALLOC_STATE(vs, always, 18, r700SendVSState); - ALLOC_STATE(ps, always, 21, r700SendPSState); + ALLOC_STATE(vs, always, 21, r700SendVSState); + ALLOC_STATE(ps, always, 24, r700SendPSState); ALLOC_STATE(vs_consts, vs_consts, (2 + (R700_MAX_DX9_CONSTS * 4)), r700SendVSConsts); ALLOC_STATE(ps_consts, ps_consts, (2 + (R700_MAX_DX9_CONSTS * 4)), r700SendPSConsts); ALLOC_STATE(vtx, vtx, (6 + (VERT_ATTRIB_MAX * 18)), r700SendVTXState); -- cgit v1.2.3 From c5dc8d7eccab38bf644ac1b9a58d0c5fe4acc4d7 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 19 Nov 2009 08:17:25 +0100 Subject: tgsi: Provide ultimate solution for SOA dependencies in exec. Reorder STOREs in such a way that they appear after the last FETCH. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 351 ++++++++++++++++++--------------- 1 file changed, 189 insertions(+), 162 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index b7569e74d4..ba7a225db3 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -62,9 +62,6 @@ #define FAST_MATH 1 -/** for tgsi_full_instruction::Flags */ -#define SOA_DEPENDENCY_FLAG 0x1 - #define TILE_TOP_LEFT 0 #define TILE_TOP_RIGHT 1 #define TILE_BOTTOM_LEFT 2 @@ -332,20 +329,6 @@ tgsi_exec_machine_bind_shader( maxInstructions += 10; } - if (tgsi_check_soa_dependencies(&parse.FullToken.FullInstruction)) { - uint opcode = parse.FullToken.FullInstruction.Instruction.Opcode; - parse.FullToken.FullInstruction.Flags = SOA_DEPENDENCY_FLAG; - /* XXX we only handle SOA dependencies properly for MOV/SWZ - * at this time! - */ - if (opcode != TGSI_OPCODE_MOV) { - debug_printf("Warning: SOA dependency in instruction" - " is not handled:\n"); - tgsi_dump_instruction(&parse.FullToken.FullInstruction, - numInstructions); - } - } - memcpy(instructions + numInstructions, &parse.FullToken.FullInstruction, sizeof(instructions[0])); @@ -1847,6 +1830,7 @@ exec_instruction( { uint chan_index; union tgsi_exec_channel r[10]; + union tgsi_exec_channel d[8]; (*pc)++; @@ -1855,42 +1839,27 @@ exec_instruction( case TGSI_OPCODE_FLR: FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); - micro_flr( &r[0], &r[0] ); - STORE( &r[0], 0, chan_index ); + micro_flr(&d[chan_index], &r[0]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; case TGSI_OPCODE_MOV: - if (inst->Flags & SOA_DEPENDENCY_FLAG) { - /* Do all fetches into temp regs, then do all stores to avoid - * intermediate/accidental clobbering. This could be done all the - * time for MOV but for other instructions we'll need more temps... - */ - FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { - FETCH( &r[chan_index], 0, chan_index ); - } - FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { - STORE( &r[chan_index], 0, chan_index ); - } + FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { + FETCH(&d[chan_index], 0, chan_index); } - else { - FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { - FETCH( &r[0], 0, chan_index ); - STORE( &r[0], 0, chan_index ); - } + FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { + STORE(&d[chan_index], 0, chan_index); } break; case TGSI_OPCODE_LIT: - if (IS_CHANNEL_ENABLED( *inst, CHAN_X )) { - STORE( &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_X ); - } - if (IS_CHANNEL_ENABLED( *inst, CHAN_Y ) || IS_CHANNEL_ENABLED( *inst, CHAN_Z )) { FETCH( &r[0], 0, CHAN_X ); if (IS_CHANNEL_ENABLED( *inst, CHAN_Y )) { - micro_max( &r[0], &r[0], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C] ); - STORE( &r[0], 0, CHAN_Y ); + micro_max(&d[CHAN_Y], &r[0], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C]); } if (IS_CHANNEL_ENABLED( *inst, CHAN_Z )) { @@ -1901,11 +1870,19 @@ exec_instruction( micro_min( &r[2], &r[2], &mach->Temps[TEMP_128_I].xyzw[TEMP_128_C] ); micro_max( &r[2], &r[2], &mach->Temps[TEMP_M128_I].xyzw[TEMP_M128_C] ); micro_pow( &r[1], &r[1], &r[2] ); - micro_lt( &r[0], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &r[0], &r[1], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C] ); - STORE( &r[0], 0, CHAN_Z ); + micro_lt(&d[CHAN_Z], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &r[0], &r[1], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C]); } - } + if (IS_CHANNEL_ENABLED(*inst, CHAN_Y)) { + STORE(&d[CHAN_Y], 0, CHAN_Y); + } + if (IS_CHANNEL_ENABLED(*inst, CHAN_Z)) { + STORE(&d[CHAN_Z], 0, CHAN_Z); + } + } + if (IS_CHANNEL_ENABLED( *inst, CHAN_X )) { + STORE( &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_X ); + } if (IS_CHANNEL_ENABLED( *inst, CHAN_W )) { STORE( &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_W ); } @@ -1973,14 +1950,13 @@ exec_instruction( break; case TGSI_OPCODE_MUL: - FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) - { + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { FETCH(&r[0], 0, chan_index); FETCH(&r[1], 1, chan_index); - - micro_mul( &r[0], &r[0], &r[1] ); - - STORE(&r[0], 0, chan_index); + micro_mul(&d[chan_index], &r[0], &r[1]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -1988,8 +1964,10 @@ exec_instruction( FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); FETCH( &r[1], 1, chan_index ); - micro_add( &r[0], &r[0], &r[1] ); - STORE( &r[0], 0, chan_index ); + micro_add(&d[chan_index], &r[0], &r[1]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2045,25 +2023,29 @@ exec_instruction( break; case TGSI_OPCODE_DST: - if (IS_CHANNEL_ENABLED( *inst, CHAN_X )) { - STORE( &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_X ); - } - if (IS_CHANNEL_ENABLED( *inst, CHAN_Y )) { FETCH( &r[0], 0, CHAN_Y ); FETCH( &r[1], 1, CHAN_Y); - micro_mul( &r[0], &r[0], &r[1] ); - STORE( &r[0], 0, CHAN_Y ); + micro_mul(&d[CHAN_Y], &r[0], &r[1]); } - if (IS_CHANNEL_ENABLED( *inst, CHAN_Z )) { - FETCH( &r[0], 0, CHAN_Z ); - STORE( &r[0], 0, CHAN_Z ); + FETCH(&d[CHAN_Z], 0, CHAN_Z); } - if (IS_CHANNEL_ENABLED( *inst, CHAN_W )) { - FETCH( &r[0], 1, CHAN_W ); - STORE( &r[0], 0, CHAN_W ); + FETCH(&d[CHAN_W], 1, CHAN_W); + } + + if (IS_CHANNEL_ENABLED(*inst, CHAN_X)) { + STORE(&mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_X); + } + if (IS_CHANNEL_ENABLED(*inst, CHAN_Y)) { + STORE(&d[CHAN_Y], 0, CHAN_Y); + } + if (IS_CHANNEL_ENABLED(*inst, CHAN_Z)) { + STORE(&d[CHAN_Z], 0, CHAN_Z); + } + if (IS_CHANNEL_ENABLED(*inst, CHAN_W)) { + STORE(&d[CHAN_W], 0, CHAN_W); } break; @@ -2073,9 +2055,10 @@ exec_instruction( FETCH(&r[1], 1, chan_index); /* XXX use micro_min()?? */ - micro_lt( &r[0], &r[0], &r[1], &r[0], &r[1] ); - - STORE(&r[0], 0, chan_index); + micro_lt(&d[chan_index], &r[0], &r[1], &r[0], &r[1]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2085,9 +2068,10 @@ exec_instruction( FETCH(&r[1], 1, chan_index); /* XXX use micro_max()?? */ - micro_lt( &r[0], &r[0], &r[1], &r[1], &r[0] ); - - STORE(&r[0], 0, chan_index ); + micro_lt(&d[chan_index], &r[0], &r[1], &r[1], &r[0] ); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2096,8 +2080,10 @@ exec_instruction( FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); FETCH( &r[1], 1, chan_index ); - micro_lt( &r[0], &r[0], &r[1], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C] ); - STORE( &r[0], 0, chan_index ); + micro_lt(&d[chan_index], &r[0], &r[1], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2106,8 +2092,10 @@ exec_instruction( FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); FETCH( &r[1], 1, chan_index ); - micro_le( &r[0], &r[1], &r[0], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C] ); - STORE( &r[0], 0, chan_index ); + micro_le(&d[chan_index], &r[1], &r[0], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2118,8 +2106,10 @@ exec_instruction( FETCH( &r[1], 1, chan_index ); micro_mul( &r[0], &r[0], &r[1] ); FETCH( &r[1], 2, chan_index ); - micro_add( &r[0], &r[0], &r[1] ); - STORE( &r[0], 0, chan_index ); + micro_add(&d[chan_index], &r[0], &r[1]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2127,10 +2117,10 @@ exec_instruction( FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH(&r[0], 0, chan_index); FETCH(&r[1], 1, chan_index); - - micro_sub( &r[0], &r[0], &r[1] ); - - STORE(&r[0], 0, chan_index); + micro_sub(&d[chan_index], &r[0], &r[1]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2139,12 +2129,12 @@ exec_instruction( FETCH(&r[0], 0, chan_index); FETCH(&r[1], 1, chan_index); FETCH(&r[2], 2, chan_index); - micro_sub( &r[1], &r[1], &r[2] ); micro_mul( &r[0], &r[0], &r[1] ); - micro_add( &r[0], &r[0], &r[2] ); - - STORE(&r[0], 0, chan_index); + micro_add(&d[chan_index], &r[0], &r[2]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2153,8 +2143,10 @@ exec_instruction( FETCH(&r[0], 0, chan_index); FETCH(&r[1], 1, chan_index); FETCH(&r[2], 2, chan_index); - micro_lt(&r[0], &mach->Temps[TEMP_HALF_I].xyzw[TEMP_HALF_C], &r[2], &r[0], &r[1]); - STORE(&r[0], 0, chan_index); + micro_lt(&d[chan_index], &mach->Temps[TEMP_HALF_I].xyzw[TEMP_HALF_C], &r[2], &r[0], &r[1]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2179,8 +2171,10 @@ exec_instruction( case TGSI_OPCODE_FRC: FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); - micro_frc( &r[0], &r[0] ); - STORE( &r[0], 0, chan_index ); + micro_frc(&d[chan_index], &r[0]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2190,8 +2184,10 @@ exec_instruction( FETCH(&r[1], 1, chan_index); micro_max(&r[0], &r[0], &r[1]); FETCH(&r[1], 2, chan_index); - micro_min(&r[0], &r[0], &r[1]); - STORE(&r[0], 0, chan_index); + micro_min(&d[chan_index], &r[0], &r[1]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2199,8 +2195,10 @@ exec_instruction( case TGSI_OPCODE_ARR: FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); - micro_rnd( &r[0], &r[0] ); - STORE( &r[0], 0, chan_index ); + micro_rnd(&d[chan_index], &r[0]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2247,11 +2245,7 @@ exec_instruction( FETCH(&r[4], 1, CHAN_Y); micro_mul( &r[5], &r[3], &r[4] ); - micro_sub( &r[2], &r[2], &r[5] ); - - if (IS_CHANNEL_ENABLED( *inst, CHAN_X )) { - STORE( &r[2], 0, CHAN_X ); - } + micro_sub(&d[CHAN_X], &r[2], &r[5]); FETCH(&r[2], 1, CHAN_X); @@ -2260,20 +2254,21 @@ exec_instruction( FETCH(&r[5], 0, CHAN_X); micro_mul( &r[1], &r[1], &r[5] ); - micro_sub( &r[3], &r[3], &r[1] ); - - if (IS_CHANNEL_ENABLED( *inst, CHAN_Y )) { - STORE( &r[3], 0, CHAN_Y ); - } + micro_sub(&d[CHAN_Y], &r[3], &r[1]); micro_mul( &r[5], &r[5], &r[4] ); micro_mul( &r[0], &r[0], &r[2] ); - micro_sub( &r[5], &r[5], &r[0] ); + micro_sub(&d[CHAN_Z], &r[5], &r[0]); - if (IS_CHANNEL_ENABLED( *inst, CHAN_Z )) { - STORE( &r[5], 0, CHAN_Z ); + if (IS_CHANNEL_ENABLED(*inst, CHAN_X)) { + STORE(&d[CHAN_X], 0, CHAN_X); + } + if (IS_CHANNEL_ENABLED(*inst, CHAN_Y)) { + STORE(&d[CHAN_Y], 0, CHAN_Y); + } + if (IS_CHANNEL_ENABLED(*inst, CHAN_Z)) { + STORE(&d[CHAN_Z], 0, CHAN_Z); } - if (IS_CHANNEL_ENABLED( *inst, CHAN_W )) { STORE( &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], 0, CHAN_W ); } @@ -2282,11 +2277,11 @@ exec_instruction( case TGSI_OPCODE_ABS: FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH(&r[0], 0, chan_index); - - micro_abs( &r[0], &r[0] ); - - STORE(&r[0], 0, chan_index); + micro_abs(&d[chan_index], &r[0]); } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); + } break; case TGSI_OPCODE_RCC: @@ -2338,16 +2333,20 @@ exec_instruction( case TGSI_OPCODE_DDX: FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); - micro_ddx( &r[0], &r[0] ); - STORE( &r[0], 0, chan_index ); + micro_ddx(&d[chan_index], &r[0]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; case TGSI_OPCODE_DDY: FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); - micro_ddy( &r[0], &r[0] ); - STORE( &r[0], 0, chan_index ); + micro_ddy(&d[chan_index], &r[0]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2428,10 +2427,10 @@ exec_instruction( FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); FETCH( &r[1], 1, chan_index ); - micro_eq( &r[0], &r[0], &r[1], - &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], - &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C] ); - STORE( &r[0], 0, chan_index ); + micro_eq(&d[chan_index], &r[0], &r[1], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2445,8 +2444,10 @@ exec_instruction( FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); FETCH( &r[1], 1, chan_index ); - micro_le( &r[0], &r[0], &r[1], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C] ); - STORE( &r[0], 0, chan_index ); + micro_le(&d[chan_index], &r[0], &r[1], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2462,8 +2463,10 @@ exec_instruction( FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); FETCH( &r[1], 1, chan_index ); - micro_le( &r[0], &r[0], &r[1], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C] ); - STORE( &r[0], 0, chan_index ); + micro_le(&d[chan_index], &r[0], &r[1], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2471,8 +2474,10 @@ exec_instruction( FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); FETCH( &r[1], 1, chan_index ); - micro_eq( &r[0], &r[0], &r[1], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C] ); - STORE( &r[0], 0, chan_index ); + micro_eq(&d[chan_index], &r[0], &r[1], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2546,13 +2551,8 @@ exec_instruction( micro_mul(&r[3], &r[3], &r[1]); micro_add(&r[2], &r[2], &r[3]); FETCH(&r[3], 0, CHAN_X); - micro_add(&r[2], &r[2], &r[3]); - if (IS_CHANNEL_ENABLED(*inst, CHAN_X)) { - STORE(&r[2], 0, CHAN_X); - } - if (IS_CHANNEL_ENABLED(*inst, CHAN_Z)) { - STORE(&r[2], 0, CHAN_Z); - } + micro_add(&d[CHAN_X], &r[2], &r[3]); + } if (IS_CHANNEL_ENABLED(*inst, CHAN_Y) || IS_CHANNEL_ENABLED(*inst, CHAN_W)) { @@ -2562,13 +2562,20 @@ exec_instruction( micro_mul(&r[3], &r[3], &r[1]); micro_add(&r[2], &r[2], &r[3]); FETCH(&r[3], 0, CHAN_Y); - micro_add(&r[2], &r[2], &r[3]); - if (IS_CHANNEL_ENABLED(*inst, CHAN_Y)) { - STORE(&r[2], 0, CHAN_Y); - } - if (IS_CHANNEL_ENABLED(*inst, CHAN_W)) { - STORE(&r[2], 0, CHAN_W); - } + micro_add(&d[CHAN_Y], &r[2], &r[3]); + + } + if (IS_CHANNEL_ENABLED(*inst, CHAN_X)) { + STORE(&d[CHAN_X], 0, CHAN_X); + } + if (IS_CHANNEL_ENABLED(*inst, CHAN_Y)) { + STORE(&d[CHAN_Y], 0, CHAN_Y); + } + if (IS_CHANNEL_ENABLED(*inst, CHAN_Z)) { + STORE(&d[CHAN_X], 0, CHAN_Z); + } + if (IS_CHANNEL_ENABLED(*inst, CHAN_W)) { + STORE(&d[CHAN_Y], 0, CHAN_W); } break; @@ -2653,8 +2660,10 @@ exec_instruction( /* TGSI_OPCODE_SGN */ FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); - micro_sgn( &r[0], &r[0] ); - STORE( &r[0], 0, chan_index ); + micro_sgn(&d[chan_index], &r[0]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2663,10 +2672,10 @@ exec_instruction( FETCH(&r[0], 0, chan_index); FETCH(&r[1], 1, chan_index); FETCH(&r[2], 2, chan_index); - - micro_lt( &r[0], &r[0], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &r[1], &r[2] ); - - STORE(&r[0], 0, chan_index); + micro_lt(&d[chan_index], &r[0], &mach->Temps[TEMP_0_I].xyzw[TEMP_0_C], &r[1], &r[2]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2841,32 +2850,40 @@ exec_instruction( case TGSI_OPCODE_CEIL: FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); - micro_ceil( &r[0], &r[0] ); - STORE( &r[0], 0, chan_index ); + micro_ceil(&d[chan_index], &r[0]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; case TGSI_OPCODE_I2F: FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); - micro_i2f( &r[0], &r[0] ); - STORE( &r[0], 0, chan_index ); + micro_i2f(&d[chan_index], &r[0]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; case TGSI_OPCODE_NOT: FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); - micro_not( &r[0], &r[0] ); - STORE( &r[0], 0, chan_index ); + micro_not(&d[chan_index], &r[0]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; case TGSI_OPCODE_TRUNC: FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); - micro_trunc( &r[0], &r[0] ); - STORE( &r[0], 0, chan_index ); + micro_trunc(&d[chan_index], &r[0]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2874,8 +2891,10 @@ exec_instruction( FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); FETCH( &r[1], 1, chan_index ); - micro_shl( &r[0], &r[0], &r[1] ); - STORE( &r[0], 0, chan_index ); + micro_shl(&d[chan_index], &r[0], &r[1]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2883,8 +2902,10 @@ exec_instruction( FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); FETCH( &r[1], 1, chan_index ); - micro_ishr( &r[0], &r[0], &r[1] ); - STORE( &r[0], 0, chan_index ); + micro_ishr(&d[chan_index], &r[0], &r[1]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2892,8 +2913,10 @@ exec_instruction( FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); FETCH( &r[1], 1, chan_index ); - micro_and( &r[0], &r[0], &r[1] ); - STORE( &r[0], 0, chan_index ); + micro_and(&d[chan_index], &r[0], &r[1]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2901,8 +2924,10 @@ exec_instruction( FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); FETCH( &r[1], 1, chan_index ); - micro_or( &r[0], &r[0], &r[1] ); - STORE( &r[0], 0, chan_index ); + micro_or(&d[chan_index], &r[0], &r[1]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; @@ -2914,8 +2939,10 @@ exec_instruction( FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { FETCH( &r[0], 0, chan_index ); FETCH( &r[1], 1, chan_index ); - micro_xor( &r[0], &r[0], &r[1] ); - STORE( &r[0], 0, chan_index ); + micro_xor(&d[chan_index], &r[0], &r[1]); + } + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&d[chan_index], 0, chan_index); } break; -- cgit v1.2.3 From f56b95e40796ea3859b1cb83341730bf74a6f85f Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 19 Nov 2009 08:18:58 +0100 Subject: identity: Add missing screen methods. --- src/gallium/drivers/identity/id_objects.c | 39 +++++++++++++++++++++++++++++++ src/gallium/drivers/identity/id_objects.h | 25 ++++++++++++++++++++ src/gallium/drivers/identity/id_public.h | 2 +- src/gallium/drivers/identity/id_screen.c | 33 ++++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/identity/id_objects.c b/src/gallium/drivers/identity/id_objects.c index e893e59940..bc9bc7121d 100644 --- a/src/gallium/drivers/identity/id_objects.c +++ b/src/gallium/drivers/identity/id_objects.c @@ -180,3 +180,42 @@ identity_transfer_destroy(struct identity_transfer *id_transfer) screen->tex_transfer_destroy(id_transfer->transfer); FREE(id_transfer); } + +struct pipe_video_surface * +identity_video_surface_create(struct identity_screen *id_screen, + struct pipe_video_surface *video_surface) +{ + struct identity_video_surface *id_video_surface; + + if (!video_surface) { + goto error; + } + + assert(video_surface->screen == id_screen->screen); + + id_video_surface = CALLOC_STRUCT(identity_video_surface); + if (!id_video_surface) { + goto error; + } + + memcpy(&id_video_surface->base, + video_surface, + sizeof(struct pipe_video_surface)); + + pipe_reference_init(&id_video_surface->base.reference, 1); + id_video_surface->base.screen = &id_screen->base; + id_video_surface->video_surface = video_surface; + + return &id_video_surface->base; + +error: + pipe_video_surface_reference(&video_surface, NULL); + return NULL; +} + +void +identity_video_surface_destroy(struct identity_video_surface *id_video_surface) +{ + pipe_video_surface_reference(&id_video_surface->video_surface, NULL); + FREE(id_video_surface); +} diff --git a/src/gallium/drivers/identity/id_objects.h b/src/gallium/drivers/identity/id_objects.h index ce58faa3c7..77cc719079 100644 --- a/src/gallium/drivers/identity/id_objects.h +++ b/src/gallium/drivers/identity/id_objects.h @@ -31,6 +31,7 @@ #include "pipe/p_compiler.h" #include "pipe/p_state.h" +#include "pipe/p_video_state.h" #include "id_screen.h" @@ -67,6 +68,14 @@ struct identity_transfer }; +struct identity_video_surface +{ + struct pipe_video_surface base; + + struct pipe_video_surface *video_surface; +}; + + static INLINE struct identity_buffer * identity_buffer(struct pipe_buffer *_buffer) { @@ -103,6 +112,15 @@ identity_transfer(struct pipe_transfer *_transfer) return (struct identity_transfer *)_transfer; } +static INLINE struct identity_video_surface * +identity_video_surface(struct pipe_video_surface *_video_surface) +{ + if (!_video_surface) { + return NULL; + } + (void)identity_screen(_video_surface->screen); + return (struct identity_video_surface *)_video_surface; +} static INLINE struct pipe_buffer * identity_buffer_unwrap(struct pipe_buffer *_buffer) @@ -165,5 +183,12 @@ identity_transfer_create(struct identity_texture *id_texture, void identity_transfer_destroy(struct identity_transfer *id_transfer); +struct pipe_video_surface * +identity_video_surface_create(struct identity_screen *id_screen, + struct pipe_video_surface *video_surface); + +void +identity_video_surface_destroy(struct identity_video_surface *id_video_surface); + #endif /* ID_OBJECTS_H */ diff --git a/src/gallium/drivers/identity/id_public.h b/src/gallium/drivers/identity/id_public.h index cac14cfd60..3d2862eaa0 100644 --- a/src/gallium/drivers/identity/id_public.h +++ b/src/gallium/drivers/identity/id_public.h @@ -37,4 +37,4 @@ identity_screen_create(struct pipe_screen *screen); struct pipe_context * identity_context_create(struct pipe_screen *screen, struct pipe_context *pipe); -#endif /* PT_PUBLIC_H */ +#endif /* ID_PUBLIC_H */ diff --git a/src/gallium/drivers/identity/id_screen.c b/src/gallium/drivers/identity/id_screen.c index 26439637d0..53eae3ef54 100644 --- a/src/gallium/drivers/identity/id_screen.c +++ b/src/gallium/drivers/identity/id_screen.c @@ -379,6 +379,33 @@ identity_screen_buffer_destroy(struct pipe_buffer *_buffer) identity_buffer_destroy(identity_buffer(_buffer)); } +static struct pipe_video_surface * +identity_screen_video_surface_create(struct pipe_screen *_screen, + enum pipe_video_chroma_format chroma_format, + unsigned width, + unsigned height) +{ + struct identity_screen *id_screen = identity_screen(_screen); + struct pipe_screen *screen = id_screen->screen; + struct pipe_video_surface *result; + + result = screen->video_surface_create(screen, + chroma_format, + width, + height); + + if (result) { + return identity_video_surface_create(id_screen, result); + } + return NULL; +} + +static void +identity_screen_video_surface_destroy(struct pipe_video_surface *_vsfc) +{ + identity_video_surface_destroy(identity_video_surface(_vsfc)); +} + static void identity_screen_flush_frontbuffer(struct pipe_screen *_screen, struct pipe_surface *_surface, @@ -472,6 +499,12 @@ identity_screen_create(struct pipe_screen *screen) if (screen->buffer_unmap) id_screen->base.buffer_unmap = identity_screen_buffer_unmap; id_screen->base.buffer_destroy = identity_screen_buffer_destroy; + if (screen->video_surface_create) { + id_screen->base.video_surface_create = identity_screen_video_surface_create; + } + if (screen->video_surface_destroy) { + id_screen->base.video_surface_destroy = identity_screen_video_surface_destroy; + } id_screen->base.flush_frontbuffer = identity_screen_flush_frontbuffer; id_screen->base.fence_reference = identity_screen_fence_reference; id_screen->base.fence_signalled = identity_screen_fence_signalled; -- cgit v1.2.3 From ea114345a6f19331628910745650cb64750b2bda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 19 Nov 2009 10:38:08 +0100 Subject: st/xorg: Don't initialize non-existing fields. --- src/gallium/state_trackers/xorg/xorg_dri2.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index aca889d6f8..660ea6a1ba 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -368,8 +368,6 @@ driScreenInit(ScreenPtr pScreen) #if DRI2INFOREC_VERSION >= 2 dri2info.CreateBuffer = driCreateBuffer; dri2info.DestroyBuffer = driDestroyBuffer; - dri2info.CreateBuffers = NULL; - dri2info.DestroyBuffers = NULL; #else dri2info.CreateBuffers = driCreateBuffers; dri2info.DestroyBuffers = driDestroyBuffers; -- cgit v1.2.3 From 10dbdee05694489edd03b353dfe133a17e65b469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 19 Nov 2009 10:54:49 +0100 Subject: st/xorg: Remove superfluous flushes from the EXA WaitMarker hook. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks to Thomas Hellström for pointing this out. --- src/gallium/state_trackers/xorg/xorg_exa.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 6fa274eb0a..29fc861748 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -170,15 +170,7 @@ xorg_exa_common_done(struct exa_context *exa) static void ExaWaitMarker(ScreenPtr pScreen, int marker) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - modesettingPtr ms = modesettingPTR(pScrn); - struct exa_context *exa = ms->exa; - -#if 0 - xorg_exa_flush(exa, PIPE_FLUSH_RENDER_CACHE, NULL); -#else - xorg_exa_finish(exa); -#endif + /* Nothing to do, handled in the PrepareAccess hook */ } static int -- cgit v1.2.3 From abed06421b892aed9f38ea75862e4b7e8aca25fa Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 Nov 2009 11:15:13 -0800 Subject: tnl: Remove unused NotifyInputChanges() tnl dd hook. --- src/mesa/tnl/t_context.h | 5 ----- src/mesa/tnl/t_pipeline.c | 4 ---- 2 files changed, 9 deletions(-) (limited to 'src') diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index 6137c2d2fe..8915770d8b 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -402,11 +402,6 @@ struct tnl_device_driver /* Alert tnl-aware drivers of changes to material. */ - void (*NotifyInputChanges)(GLcontext *ctx, GLuint bitmask); - /* Alert tnl-aware drivers of changes to size and stride of input - * arrays. - */ - /*** *** Rendering -- These functions called only from t_vb_render.c ***/ diff --git a/src/mesa/tnl/t_pipeline.c b/src/mesa/tnl/t_pipeline.c index 357ef1e24b..01b30babb4 100644 --- a/src/mesa/tnl/t_pipeline.c +++ b/src/mesa/tnl/t_pipeline.c @@ -86,10 +86,6 @@ static GLuint check_input_changes( GLcontext *ctx ) } } - if (tnl->pipeline.input_changes && - tnl->Driver.NotifyInputChanges) - tnl->Driver.NotifyInputChanges( ctx, tnl->pipeline.input_changes ); - return tnl->pipeline.input_changes; } -- cgit v1.2.3 From 22bcb59a95ec833cfd73b300376c918eb6a658f2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 Nov 2009 13:00:01 -0800 Subject: tnl: Replace NormalPtr with AttribPtr[_TNL_ATTRIB_NORMAL] --- src/mesa/drivers/dri/radeon/radeon_maos_arrays.c | 4 ++-- src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h | 6 +++--- src/mesa/tnl/t_context.h | 3 +-- src/mesa/tnl/t_draw.c | 1 - src/mesa/tnl/t_vb_normals.c | 1 - src/mesa/x86/gen_matypes.c | 2 +- 6 files changed, 7 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c index 08e1c5d00d..4769f1cb4d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c @@ -216,9 +216,9 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs ) if (!rmesa->tcl.norm.buf) rcommon_emit_vector( ctx, &(rmesa->tcl.aos[nr]), - (char *)VB->NormalPtr->data, + (char *)VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data, 3, - VB->NormalPtr->stride, + VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride, count); vfmt |= RADEON_CP_VC_FRMT_N0; diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h index 515783135d..1abde5ddee 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h +++ b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h @@ -112,9 +112,9 @@ static void TAG(emit)( GLcontext *ctx, } if (DO_NORM) { - if (VB->NormalPtr) { - norm_stride = VB->NormalPtr->stride; - norm = (GLuint (*)[4])VB->NormalPtr->data; + if (VB->AttribPtr[_TNL_ATTRIB_NORMAL]) { + norm_stride = VB->AttribPtr[_TNL_ATTRIB_NORMAL]->stride; + norm = (GLuint (*)[4])VB->AttribPtr[_TNL_ATTRIB_NORMAL]->data; } else { norm_stride = 0; norm = (GLuint (*)[4])&ctx->Current.Attrib[VERT_ATTRIB_NORMAL]; diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index 8915770d8b..504e8c5044 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -200,7 +200,7 @@ struct vertex_buffer /* Pointers to current data. * XXX some of these fields alias AttribPtr below and should be removed - * such as NormalPtr, TexCoordPtr, FogCoordPtr, etc. + * such as TexCoordPtr, FogCoordPtr, etc. */ GLuint *Elts; GLvector4f *ObjPtr; /* _TNL_BIT_POS */ @@ -210,7 +210,6 @@ struct vertex_buffer GLubyte ClipOrMask; /* _TNL_BIT_POS */ GLubyte ClipAndMask; /* _TNL_BIT_POS */ GLubyte *ClipMask; /* _TNL_BIT_POS */ - GLvector4f *NormalPtr; /* _TNL_BIT_NORMAL */ GLfloat *NormalLengthPtr; /* _TNL_BIT_NORMAL */ GLboolean *EdgeFlag; /* _TNL_BIT_EDGEFLAG */ GLvector4f *TexCoordPtr[MAX_TEXTURE_COORD_UNITS]; /* VERT_TEX_0..n */ diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c index 04fa106300..2df9444d2b 100644 --- a/src/mesa/tnl/t_draw.c +++ b/src/mesa/tnl/t_draw.c @@ -255,7 +255,6 @@ static void bind_inputs( GLcontext *ctx, /* Legacy pointers -- remove one day. */ VB->ObjPtr = VB->AttribPtr[_TNL_ATTRIB_POS]; - VB->NormalPtr = VB->AttribPtr[_TNL_ATTRIB_NORMAL]; VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0]; VB->ColorPtr[1] = NULL; VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX]; diff --git a/src/mesa/tnl/t_vb_normals.c b/src/mesa/tnl/t_vb_normals.c index a4821cc1cc..693d3dc118 100644 --- a/src/mesa/tnl/t_vb_normals.c +++ b/src/mesa/tnl/t_vb_normals.c @@ -79,7 +79,6 @@ run_normal_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) } VB->AttribPtr[_TNL_ATTRIB_NORMAL] = &store->normal; - VB->NormalPtr = &store->normal; VB->NormalLengthPtr = NULL; /* no longer valid */ return GL_TRUE; diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c index d56b701aa8..f78a277601 100644 --- a/src/mesa/x86/gen_matypes.c +++ b/src/mesa/x86/gen_matypes.c @@ -126,7 +126,7 @@ int main( int argc, char **argv ) OFFSET( "VB_PROJ_CLIP_PTR ", struct vertex_buffer, NdcPtr ); OFFSET( "VB_CLIP_OR_MASK ", struct vertex_buffer, ClipOrMask ); OFFSET( "VB_CLIP_MASK ", struct vertex_buffer, ClipMask ); - OFFSET( "VB_NORMAL_PTR ", struct vertex_buffer, NormalPtr ); + OFFSET( "VB_NORMAL_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_NORMAL] ); OFFSET( "VB_EDGE_FLAG ", struct vertex_buffer, EdgeFlag ); OFFSET( "VB_TEX0_COORD_PTR ", struct vertex_buffer, TexCoordPtr[0] ); OFFSET( "VB_TEX1_COORD_PTR ", struct vertex_buffer, TexCoordPtr[1] ); -- cgit v1.2.3 From df582ca767a38f185f9b4c449e7ed4266c414ae2 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 Nov 2009 16:00:53 -0800 Subject: tnl: Replace deprecated TexCoordPtr with AttribPtr[_TNL_ATTRIB_TEX*] --- src/mesa/drivers/dri/gamma/gamma_render.c | 6 +- src/mesa/drivers/dri/i915/i830_vtbl.c | 2 +- src/mesa/drivers/dri/i915/i915_fragprog.c | 2 +- src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h | 20 +++---- src/mesa/drivers/dri/mach64/mach64_vbtmp.h | 64 +++++++++++----------- src/mesa/drivers/dri/r128/r128_tris.c | 4 +- src/mesa/drivers/dri/r200/r200_swtcl.c | 2 +- src/mesa/drivers/dri/r300/r300_swtcl.c | 6 +- src/mesa/drivers/dri/radeon/radeon_maos_arrays.c | 12 ++-- src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h | 30 +++++----- src/mesa/drivers/dri/radeon/radeon_maos_verts.c | 6 +- src/mesa/drivers/dri/radeon/radeon_swtcl.c | 2 +- src/mesa/drivers/dri/savage/savagerender.c | 8 +-- src/mesa/drivers/dri/savage/savagetris.c | 18 +++--- src/mesa/drivers/dri/sis/sis_tris.c | 4 +- src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h | 20 +++---- src/mesa/drivers/dri/unichrome/via_tris.c | 4 +- src/mesa/drivers/glide/fxvbtmp.h | 21 +++---- .../windows/gldirect/dx7/gld_primitive_dx7.c | 8 +-- .../windows/gldirect/dx8/gld_primitive_dx8.c | 8 +-- .../windows/gldirect/dx9/gld_primitive_dx9.c | 8 +-- src/mesa/tnl/t_context.h | 3 +- src/mesa/tnl/t_draw.c | 4 -- src/mesa/tnl/t_vb_program.c | 1 - src/mesa/tnl/t_vb_texgen.c | 1 - src/mesa/tnl/t_vb_texmat.c | 1 - src/mesa/tnl_dd/t_dd_vbtmp.h | 64 +++++++++++----------- src/mesa/x86/gen_matypes.c | 8 +-- 28 files changed, 165 insertions(+), 172 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/gamma/gamma_render.c b/src/mesa/drivers/dri/gamma/gamma_render.c index 1b9fd169f4..741936488a 100644 --- a/src/mesa/drivers/dri/gamma/gamma_render.c +++ b/src/mesa/drivers/dri/gamma/gamma_render.c @@ -57,9 +57,9 @@ static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end) col_stride = VB->ColorPtr[0]->stride; if (ctx->Texture.Unit[0]._ReallyEnabled) { - tc0_stride = VB->TexCoordPtr[0]->stride; - tc0 = VB->TexCoordPtr[0]->data; - tc0_size = VB->TexCoordPtr[0]->size; + tc0_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0]->stride; + tc0 = VB->AttribPtr[_TNL_ATTRIB_TEX0]->data; + tc0_size = VB->AttribPtr[_TNL_ATTRIB_TEX0]->size; coord = VB->ClipPtr->data; coord_stride = VB->ClipPtr->stride; } else { diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index a6f554701e..7d76b39caa 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -126,7 +126,7 @@ i830_render_start(struct intel_context *intel) for (i = 0; i < I830_TEX_UNITS; i++) { if (RENDERINPUTS_TEST(index_bitset, _TNL_ATTRIB_TEX(i))) { - GLuint sz = VB->TexCoordPtr[i]->size; + GLuint sz = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->size; GLuint emit; GLuint mcs = (i830->state.Tex[i][I830_TEXREG_MCS] & ~TEXCOORDTYPE_MASK); diff --git a/src/mesa/drivers/dri/i915/i915_fragprog.c b/src/mesa/drivers/dri/i915/i915_fragprog.c index d9c61446f5..9e4d318036 100644 --- a/src/mesa/drivers/dri/i915/i915_fragprog.c +++ b/src/mesa/drivers/dri/i915/i915_fragprog.c @@ -1301,7 +1301,7 @@ i915ValidateFragmentProgram(struct i915_context *i915) for (i = 0; i < p->ctx->Const.MaxTextureCoordUnits; i++) { if (inputsRead & FRAG_BIT_TEX(i)) { - int sz = VB->TexCoordPtr[i]->size; + int sz = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->size; s2 &= ~S2_TEXCOORD_FMT(i, S2_TEXCOORD_FMT0_MASK); s2 |= S2_TEXCOORD_FMT(i, SZ_TO_HW(sz)); diff --git a/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h b/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h index 684f2acc89..1a93e5f034 100644 --- a/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h +++ b/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h @@ -103,10 +103,10 @@ static void TAG(emit)( GLcontext *ctx, #if DO_TEX1 { const GLuint t1 = GET_TEXSOURCE(1); - tc1 = VB->TexCoordPtr[t1]->data; - tc1_stride = VB->TexCoordPtr[t1]->stride; + tc1 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->data; + tc1_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->stride; #if DO_PTEX - tc1_size = VB->TexCoordPtr[t1]->size; + tc1_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->size; #endif } #endif @@ -114,10 +114,10 @@ static void TAG(emit)( GLcontext *ctx, #if DO_TEX0 { const GLuint t0 = GET_TEXSOURCE(0); - tc0 = VB->TexCoordPtr[t0]->data; - tc0_stride = VB->TexCoordPtr[t0]->stride; + tc0 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->data; + tc0_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->stride; #if DO_PTEX - tc0_size = VB->TexCoordPtr[t0]->size; + tc0_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->size; #endif } #endif @@ -319,8 +319,8 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) /* Force 'missing' texcoords to something valid. */ - if (DO_TEX1 && VB->TexCoordPtr[0] == 0) - VB->TexCoordPtr[0] = VB->TexCoordPtr[1]; + if (DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0] == 0) + VB->AttribPtr[_TNL_ATTRIB_TEX0] = VB->AttribPtr[_TNL_ATTRIB_TEX1]; if (DO_PTEX) return GL_TRUE; @@ -328,12 +328,12 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) /* No hardware support for projective texture. Can fake it for * TEX0 only. */ - if ((DO_TEX1 && VB->TexCoordPtr[GET_TEXSOURCE(1)]->size == 4)) { + if ((DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(1)]->size == 4)) { PTEX_FALLBACK(); return GL_FALSE; } - if (DO_TEX0 && VB->TexCoordPtr[GET_TEXSOURCE(0)]->size == 4) { + if (DO_TEX0 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(0)]->size == 4) { if (DO_TEX1) { PTEX_FALLBACK(); } diff --git a/src/mesa/drivers/dri/mach64/mach64_vbtmp.h b/src/mesa/drivers/dri/mach64/mach64_vbtmp.h index 938804af9e..eb94e6e398 100644 --- a/src/mesa/drivers/dri/mach64/mach64_vbtmp.h +++ b/src/mesa/drivers/dri/mach64/mach64_vbtmp.h @@ -156,34 +156,34 @@ static void TAG(emit)( GLcontext *ctx, if (DO_TEX3) { const GLuint t3 = GET_TEXSOURCE(3); - tc3 = VB->TexCoordPtr[t3]->data; - tc3_stride = VB->TexCoordPtr[t3]->stride; + tc3 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t3]->data; + tc3_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t3]->stride; if (DO_PTEX) - tc3_size = VB->TexCoordPtr[t3]->size; + tc3_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t3]->size; } if (DO_TEX2) { const GLuint t2 = GET_TEXSOURCE(2); - tc2 = VB->TexCoordPtr[t2]->data; - tc2_stride = VB->TexCoordPtr[t2]->stride; + tc2 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->data; + tc2_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->stride; if (DO_PTEX) - tc2_size = VB->TexCoordPtr[t2]->size; + tc2_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->size; } if (DO_TEX1) { const GLuint t1 = GET_TEXSOURCE(1); - tc1 = VB->TexCoordPtr[t1]->data; - tc1_stride = VB->TexCoordPtr[t1]->stride; + tc1 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->data; + tc1_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->stride; if (DO_PTEX) - tc1_size = VB->TexCoordPtr[t1]->size; + tc1_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->size; } if (DO_TEX0) { const GLuint t0 = GET_TEXSOURCE(0); - tc0_stride = VB->TexCoordPtr[t0]->stride; - tc0 = VB->TexCoordPtr[t0]->data; + tc0_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->stride; + tc0 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->data; if (DO_PTEX) - tc0_size = VB->TexCoordPtr[t0]->size; + tc0_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->size; } if (DO_RGBA) { @@ -473,22 +473,22 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) /* Force 'missing' texcoords to something valid. */ - if (DO_TEX3 && VB->TexCoordPtr[2] == 0) - VB->TexCoordPtr[2] = VB->TexCoordPtr[3]; + if (DO_TEX3 && VB->AttribPtr[_TNL_ATTRIB_TEX2] == 0) + VB->AttribPtr[_TNL_ATTRIB_TEX2] = VB->AttribPtr[_TNL_ATTRIB_TEX3]; - if (DO_TEX2 && VB->TexCoordPtr[1] == 0) - VB->TexCoordPtr[1] = VB->TexCoordPtr[2]; + if (DO_TEX2 && VB->AttribPtr[_TNL_ATTRIB_TEX1] == 0) + VB->AttribPtr[_TNL_ATTRIB_TEX1] = VB->AttribPtr[_TNL_ATTRIB_TEX2]; - if (DO_TEX1 && VB->TexCoordPtr[0] == 0) - VB->TexCoordPtr[0] = VB->TexCoordPtr[1]; + if (DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0] == 0) + VB->AttribPtr[_TNL_ATTRIB_TEX0] = VB->AttribPtr[_TNL_ATTRIB_TEX1]; if (DO_PTEX) return GL_TRUE; - if ((DO_TEX3 && VB->TexCoordPtr[GET_TEXSOURCE(3)]->size == 4) || - (DO_TEX2 && VB->TexCoordPtr[GET_TEXSOURCE(2)]->size == 4) || - (DO_TEX1 && VB->TexCoordPtr[GET_TEXSOURCE(1)]->size == 4) || - (DO_TEX0 && VB->TexCoordPtr[GET_TEXSOURCE(0)]->size == 4)) + if ((DO_TEX3 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(3)]->size == 4) || + (DO_TEX2 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(2)]->size == 4) || + (DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(1)]->size == 4) || + (DO_TEX0 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(0)]->size == 4)) return GL_FALSE; return GL_TRUE; @@ -501,14 +501,14 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) /* Force 'missing' texcoords to something valid. */ - if (DO_TEX3 && VB->TexCoordPtr[2] == 0) - VB->TexCoordPtr[2] = VB->TexCoordPtr[3]; + if (DO_TEX3 && VB->AttribPtr[_TNL_ATTRIB_TEX2] == 0) + VB->AttribPtr[_TNL_ATTRIB_TEX2] = VB->AttribPtr[_TNL_ATTRIB_TEX3]; - if (DO_TEX2 && VB->TexCoordPtr[1] == 0) - VB->TexCoordPtr[1] = VB->TexCoordPtr[2]; + if (DO_TEX2 && VB->AttribPtr[_TNL_ATTRIB_TEX1] == 0) + VB->AttribPtr[_TNL_ATTRIB_TEX1] = VB->AttribPtr[_TNL_ATTRIB_TEX2]; - if (DO_TEX1 && VB->TexCoordPtr[0] == 0) - VB->TexCoordPtr[0] = VB->TexCoordPtr[1]; + if (DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0] == 0) + VB->AttribPtr[_TNL_ATTRIB_TEX0] = VB->AttribPtr[_TNL_ATTRIB_TEX1]; if (DO_PTEX) return GL_TRUE; @@ -516,14 +516,14 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) /* No hardware support for projective texture. Can fake it for * TEX0 only. */ - if ((DO_TEX3 && VB->TexCoordPtr[GET_TEXSOURCE(3)]->size == 4) || - (DO_TEX2 && VB->TexCoordPtr[GET_TEXSOURCE(2)]->size == 4) || - (DO_TEX1 && VB->TexCoordPtr[GET_TEXSOURCE(1)]->size == 4)) { + if ((DO_TEX3 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(3)]->size == 4) || + (DO_TEX2 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(2)]->size == 4) || + (DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(1)]->size == 4)) { PTEX_FALLBACK(); return GL_FALSE; } - if (DO_TEX0 && VB->TexCoordPtr[GET_TEXSOURCE(0)]->size == 4) { + if (DO_TEX0 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(0)]->size == 4) { if (DO_TEX1 || DO_TEX2 || DO_TEX3) { PTEX_FALLBACK(); } diff --git a/src/mesa/drivers/dri/r128/r128_tris.c b/src/mesa/drivers/dri/r128/r128_tris.c index 5b91271d74..448e34e047 100644 --- a/src/mesa/drivers/dri/r128/r128_tris.c +++ b/src/mesa/drivers/dri/r128/r128_tris.c @@ -650,12 +650,12 @@ static void r128RenderStart( GLcontext *ctx ) } if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(rmesa->tmu_source[0]) )) { - if ( VB->TexCoordPtr[rmesa->tmu_source[0]]->size > 2 ) + if ( VB->AttribPtr[_TNL_ATTRIB_TEX0 + rmesa->tmu_source[0]]->size > 2 ) fallback_projtex = GL_TRUE; EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_2F, R128_CCE_VC_FRMT_S_T, 8 ); } if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(rmesa->tmu_source[1]) )) { - if ( VB->TexCoordPtr[rmesa->tmu_source[1]]->size > 2 ) + if ( VB->AttribPtr[_TNL_ATTRIB_TEX0 + rmesa->tmu_source[1]]->size > 2 ) fallback_projtex = GL_TRUE; EMIT_ATTR( _TNL_ATTRIB_TEX1, EMIT_2F, R128_CCE_VC_FRMT_S2_T2, 8 ); } diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c index 240fb45078..fadc766b49 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.c +++ b/src/mesa/drivers/dri/r200/r200_swtcl.c @@ -168,7 +168,7 @@ static void r200SetVertexFormat( GLcontext *ctx ) for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(i) )) { - GLuint sz = VB->TexCoordPtr[i]->size; + GLuint sz = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->size; fmt_1 |= sz << (3 * i); EMIT_ATTR( _TNL_ATTRIB_TEX0+i, EMIT_1F + sz - 1, 0 ); diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index ee2c71e1a7..677c504b90 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -159,7 +159,7 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_ int tex_id = rmesa->selected_fp->wpos_attr - FRAG_ATTRIB_TEX0; VB->AttribPtr[VERT_ATTRIB_TEX0 + tex_id] = VB->AttribPtr[VERT_ATTRIB_POS]; - VB->TexCoordPtr[tex_id] = VB->AttribPtr[VERT_ATTRIB_POS]; + VB->AttribPtr[_TNL_ATTRIB_TEX0 + tex_id] = VB->AttribPtr[VERT_ATTRIB_POS]; RENDERINPUTS_SET(tnl->render_inputs_bitset, _TNL_ATTRIB_TEX0 + tex_id); } @@ -167,7 +167,7 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_ int tex_id = rmesa->selected_fp->fog_attr - FRAG_ATTRIB_TEX0; VB->AttribPtr[VERT_ATTRIB_TEX0 + tex_id] = VB->AttribPtr[VERT_ATTRIB_FOG]; - VB->TexCoordPtr[tex_id] = VB->AttribPtr[VERT_ATTRIB_FOG]; + VB->AttribPtr[_TNL_ATTRIB_TEX0 + tex_id] = VB->AttribPtr[VERT_ATTRIB_FOG]; RENDERINPUTS_SET(tnl->render_inputs_bitset, _TNL_ATTRIB_TEX0 + tex_id); } @@ -180,7 +180,7 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_ GLuint swiz, format, hw_format; for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { if (fp_reads & FRAG_BIT_TEX(i)) { - switch (VB->TexCoordPtr[i]->size) { + switch (VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->size) { case 1: format = EMIT_1F; hw_format = R300_DATA_TYPE_FLOAT_1; diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c index 4769f1cb4d..1cd1d6e778 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c @@ -290,24 +290,24 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs ) if (!rmesa->tcl.tex[unit].buf) emit_tex_vector( ctx, &(rmesa->tcl.aos[nr]), - (char *)VB->TexCoordPtr[unit]->data, - VB->TexCoordPtr[unit]->size, - VB->TexCoordPtr[unit]->stride, + (char *)VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->data, + VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->size, + VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->stride, count ); nr++; vfmt |= RADEON_ST_BIT(unit); /* assume we need the 3rd coord if texgen is active for r/q OR at least 3 coords are submitted. This may not be 100% correct */ - if (VB->TexCoordPtr[unit]->size >= 3) { + if (VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->size >= 3) { vtx |= RADEON_Q_BIT(unit); vfmt |= RADEON_Q_BIT(unit); } if ( (ctx->Texture.Unit[unit].TexGenEnabled & (R_BIT | Q_BIT)) ) vtx |= RADEON_Q_BIT(unit); - else if ((VB->TexCoordPtr[unit]->size >= 3) && + else if ((VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->size >= 3) && ((ctx->Texture.Unit[unit]._ReallyEnabled & (TEXTURE_CUBE_BIT)) == 0)) { - GLuint swaptexmatcol = (VB->TexCoordPtr[unit]->size - 3); + GLuint swaptexmatcol = (VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->size - 3); if (((rmesa->NeedTexMatrix >> unit) & 1) && (swaptexmatcol != ((rmesa->TexMatColSwap >> unit) & 1))) radeonUploadTexMatrix( rmesa, unit, swaptexmatcol ) ; diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h index 1abde5ddee..cb57416c3e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h +++ b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h @@ -60,14 +60,14 @@ static void TAG(emit)( GLcontext *ctx, coord_stride = VB->ObjPtr->stride; if (DO_TEX2) { - if (VB->TexCoordPtr[2]) { + if (VB->AttribPtr[_TNL_ATTRIB_TEX2]) { const GLuint t2 = GET_TEXSOURCE(2); - tc2 = (GLuint (*)[4])VB->TexCoordPtr[t2]->data; - tc2_stride = VB->TexCoordPtr[t2]->stride; - if (DO_PTEX && VB->TexCoordPtr[t2]->size < 3) { + tc2 = (GLuint (*)[4])VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->data; + tc2_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->stride; + if (DO_PTEX && VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->size < 3) { fill_tex |= (1<<2); } - else if (DO_PTEX && VB->TexCoordPtr[t2]->size < 4) { + else if (DO_PTEX && VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->size < 4) { rqcoordsnoswap |= (1<<2); } } else { @@ -77,14 +77,14 @@ static void TAG(emit)( GLcontext *ctx, } if (DO_TEX1) { - if (VB->TexCoordPtr[1]) { + if (VB->AttribPtr[_TNL_ATTRIB_TEX1]) { const GLuint t1 = GET_TEXSOURCE(1); - tc1 = (GLuint (*)[4])VB->TexCoordPtr[t1]->data; - tc1_stride = VB->TexCoordPtr[t1]->stride; - if (DO_PTEX && VB->TexCoordPtr[t1]->size < 3) { + tc1 = (GLuint (*)[4])VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->data; + tc1_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->stride; + if (DO_PTEX && VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->size < 3) { fill_tex |= (1<<1); } - else if (DO_PTEX && VB->TexCoordPtr[t1]->size < 4) { + else if (DO_PTEX && VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->size < 4) { rqcoordsnoswap |= (1<<1); } } else { @@ -94,14 +94,14 @@ static void TAG(emit)( GLcontext *ctx, } if (DO_TEX0) { - if (VB->TexCoordPtr[0]) { + if (VB->AttribPtr[_TNL_ATTRIB_TEX0]) { const GLuint t0 = GET_TEXSOURCE(0); - tc0_stride = VB->TexCoordPtr[t0]->stride; - tc0 = (GLuint (*)[4])VB->TexCoordPtr[t0]->data; - if (DO_PTEX && VB->TexCoordPtr[t0]->size < 3) { + tc0_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->stride; + tc0 = (GLuint (*)[4])VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->data; + if (DO_PTEX && VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->size < 3) { fill_tex |= (1<<0); } - else if (DO_PTEX && VB->TexCoordPtr[t0]->size < 4) { + else if (DO_PTEX && VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->size < 4) { rqcoordsnoswap |= (1<<0); } } else { diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c index 78ec119302..a6aff69aac 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c @@ -348,15 +348,15 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs ) req |= RADEON_ST_BIT(unit); /* assume we need the 3rd coord if texgen is active for r/q OR at least 3 coords are submitted. This may not be 100% correct */ - if (VB->TexCoordPtr[unit]->size >= 3) { + if (VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->size >= 3) { req |= RADEON_Q_BIT(unit); vtx |= RADEON_Q_BIT(unit); } if ( (ctx->Texture.Unit[unit].TexGenEnabled & (R_BIT | Q_BIT)) ) vtx |= RADEON_Q_BIT(unit); - else if ((VB->TexCoordPtr[unit]->size >= 3) && + else if ((VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->size >= 3) && ((ctx->Texture.Unit[unit]._ReallyEnabled & (TEXTURE_CUBE_BIT)) == 0)) { - GLuint swaptexmatcol = (VB->TexCoordPtr[unit]->size - 3); + GLuint swaptexmatcol = (VB->AttribPtr[_TNL_ATTRIB_TEX0 + unit]->size - 3); if (((rmesa->NeedTexMatrix >> unit) & 1) && (swaptexmatcol != ((rmesa->TexMatColSwap >> unit) & 1))) radeonUploadTexMatrix( rmesa, unit, swaptexmatcol ) ; diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/src/mesa/drivers/dri/radeon/radeon_swtcl.c index e61f59eaea..6bbe8e252e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c +++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c @@ -179,7 +179,7 @@ static void radeonSetVertexFormat( GLcontext *ctx ) for (i = 0; i < ctx->Const.MaxTextureUnits; i++) { if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX(i) )) { - GLuint sz = VB->TexCoordPtr[i]->size; + GLuint sz = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->size; switch (sz) { case 1: diff --git a/src/mesa/drivers/dri/savage/savagerender.c b/src/mesa/drivers/dri/savage/savagerender.c index 32c74f9467..8221edf387 100644 --- a/src/mesa/drivers/dri/savage/savagerender.c +++ b/src/mesa/drivers/dri/savage/savagerender.c @@ -252,13 +252,13 @@ static GLboolean run_texnorm_stage( GLcontext *ctx, const GLboolean normalizeS = (texObj->WrapS == GL_REPEAT); const GLboolean normalizeT = (reallyEnabled & TEXTURE_2D_BIT) && (texObj->WrapT == GL_REPEAT); - const GLfloat *in = (GLfloat *)VB->TexCoordPtr[i]->data; - const GLint instride = VB->TexCoordPtr[i]->stride; + const GLfloat *in = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->data; + const GLint instride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->stride; GLfloat (*out)[4] = store->texcoord[i].data; GLint j; if (!ctx->Texture.Unit[i]._ReallyEnabled || - VB->TexCoordPtr[i]->size == 4) + VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]->size == 4) /* Never try to normalize homogenous tex coords! */ continue; @@ -297,7 +297,7 @@ static GLboolean run_texnorm_stage( GLcontext *ctx, } if (normalizeS || normalizeT) - VB->AttribPtr[VERT_ATTRIB_TEX0+i] = VB->TexCoordPtr[i] = &store->texcoord[i]; + VB->AttribPtr[_TNL_ATTRIB_TEX0 + i] = &store->texcoord[i]; } } diff --git a/src/mesa/drivers/dri/savage/savagetris.c b/src/mesa/drivers/dri/savage/savagetris.c index c04763b40e..e9529d1939 100644 --- a/src/mesa/drivers/dri/savage/savagetris.c +++ b/src/mesa/drivers/dri/savage/savagetris.c @@ -879,13 +879,13 @@ static GLboolean savageCheckPTexHack( GLcontext *ctx ) RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset ); - if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 ) && VB->TexCoordPtr[0]->size == 4) { + if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 ) && VB->AttribPtr[_TNL_ATTRIB_TEX0]->size == 4) { if (!RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_ATTRIB_TEX1, _TNL_LAST_TEX )) return GL_TRUE; /* apply ptex hack */ else FALLBACK(ctx, SAVAGE_FALLBACK_PROJ_TEXTURE, GL_TRUE); } - if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX1 ) && VB->TexCoordPtr[1]->size == 4) + if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX1 ) && VB->AttribPtr[_TNL_ATTRIB_TEX1]->size == 4) FALLBACK(ctx, SAVAGE_FALLBACK_PROJ_TEXTURE, GL_TRUE); return GL_FALSE; /* don't apply ptex hack */ @@ -976,13 +976,13 @@ static INLINE GLuint savageChooseVertexFormat_s3d( GLcontext *ctx ) if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 )) { if (imesa->ptexHack) EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_3F_XYW, SAVAGE_EMIT_STQ0, SAVAGE_SKIP_ST0); - else if (VB->TexCoordPtr[0]->size == 4) + else if (VB->AttribPtr[_TNL_ATTRIB_TEX0]->size == 4) assert (0); /* should be caught by savageCheckPTexHack */ - else if (VB->TexCoordPtr[0]->size >= 2) + else if (VB->AttribPtr[_TNL_ATTRIB_TEX0]->size >= 2) /* The chromium menu emits some 3D tex coords even though no * 3D texture is enabled. Ignore the 3rd coordinate. */ EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_2F, SAVAGE_EMIT_ST0, SAVAGE_SKIP_ST0 ); - else if (VB->TexCoordPtr[0]->size == 1) { + else if (VB->AttribPtr[_TNL_ATTRIB_TEX0]->size == 1) { EMIT_ATTR( _TNL_ATTRIB_TEX0, EMIT_1F, SAVAGE_EMIT_S0, SAVAGE_SKIP_S0 ); EMIT_PAD( 4 ); } else @@ -1025,9 +1025,9 @@ static INLINE GLuint savageChooseVertexFormat_s4( GLcontext *ctx ) if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 )) { if (imesa->ptexHack) NEED_ATTR( SAVAGE_EMIT_STQ0, SAVAGE_SKIP_ST0); - else if (VB->TexCoordPtr[0]->size == 4) + else if (VB->AttribPtr[_TNL_ATTRIB_TEX0]->size == 4) assert (0); /* should be caught by savageCheckPTexHack */ - else if (VB->TexCoordPtr[0]->size >= 2) + else if (VB->AttribPtr[_TNL_ATTRIB_TEX0]->size >= 2) /* The chromium menu emits some 3D tex coords even though no * 3D texture is enabled. Ignore the 3rd coordinate. */ NEED_ATTR( SAVAGE_EMIT_ST0, SAVAGE_SKIP_ST0 ); @@ -1035,10 +1035,10 @@ static INLINE GLuint savageChooseVertexFormat_s4( GLcontext *ctx ) NEED_ATTR( SAVAGE_EMIT_S0, SAVAGE_SKIP_S0 ); } if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX1 )) { - if (VB->TexCoordPtr[1]->size == 4) + if (VB->AttribPtr[_TNL_ATTRIB_TEX1]->size == 4) /* projective textures are not supported by the hardware */ assert (0); /* should be caught by savageCheckPTexHack */ - else if (VB->TexCoordPtr[1]->size >= 2) + else if (VB->AttribPtr[_TNL_ATTRIB_TEX1]->size >= 2) NEED_ATTR( SAVAGE_EMIT_ST1, SAVAGE_SKIP_ST1 ); else NEED_ATTR( SAVAGE_EMIT_S1, SAVAGE_SKIP_S1 ); diff --git a/src/mesa/drivers/dri/sis/sis_tris.c b/src/mesa/drivers/dri/sis/sis_tris.c index 76d12d07b3..3cf10007b5 100644 --- a/src/mesa/drivers/dri/sis/sis_tris.c +++ b/src/mesa/drivers/dri/sis/sis_tris.c @@ -903,14 +903,14 @@ static void sisRenderStart( GLcontext *ctx ) /* projective textures are not supported by the hardware */ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 )) { - if (VB->TexCoordPtr[0]->size > 2) + if (VB->AttribPtr[_TNL_ATTRIB_TEX0]->size > 2) tex_fallback = GL_TRUE; EMIT_ATTR(_TNL_ATTRIB_TEX0, EMIT_2F); AGPParseSet |= SiS_PS_HAS_UV0; } /* Will only hit tex1 on SiS300 */ if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX1 )) { - if (VB->TexCoordPtr[1]->size > 2) + if (VB->AttribPtr[_TNL_ATTRIB_TEX1]->size > 2) tex_fallback = GL_TRUE; EMIT_ATTR(_TNL_ATTRIB_TEX1, EMIT_2F); AGPParseSet |= SiS_PS_HAS_UV1; diff --git a/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h b/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h index 9b780761f4..809d5d7dd9 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h @@ -58,21 +58,21 @@ static void TAG(emit)( GLcontext *ctx, /* fprintf(stderr, "%s\n", __FUNCTION__); */ if (IND & TDFX_TEX0_BIT) { - tc0_stride = VB->TexCoordPtr[tmu0_source]->stride; - tc0 = VB->TexCoordPtr[tmu0_source]->data; + tc0_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu0_source]->stride; + tc0 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu0_source]->data; u0scale = fxMesa->sScale0; v0scale = fxMesa->tScale0; if (IND & TDFX_PTEX_BIT) - tc0_size = VB->TexCoordPtr[tmu0_source]->size; + tc0_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu0_source]->size; } if (IND & TDFX_TEX1_BIT) { - tc1 = VB->TexCoordPtr[tmu1_source]->data; - tc1_stride = VB->TexCoordPtr[tmu1_source]->stride; + tc1 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu1_source]->data; + tc1_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu1_source]->stride; u1scale = fxMesa->sScale1; v1scale = fxMesa->tScale1; if (IND & TDFX_PTEX_BIT) - tc1_size = VB->TexCoordPtr[tmu1_source]->size; + tc1_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu1_source]->size; } if (IND & TDFX_RGBA_BIT) { @@ -168,14 +168,14 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; if (IND & TDFX_TEX1_BIT) { - if (VB->TexCoordPtr[0] == 0) - VB->TexCoordPtr[0] = VB->TexCoordPtr[1]; + if (VB->AttribPtr[_TNL_ATTRIB_TEX0] == 0) + VB->AttribPtr[_TNL_ATTRIB_TEX0] = VB->AttribPtr[_TNL_ATTRIB_TEX1]; - if (VB->TexCoordPtr[1]->size == 4) + if (VB->AttribPtr[_TNL_ATTRIB_TEX1]->size == 4) return GL_FALSE; } - if (VB->TexCoordPtr[0]->size == 4) + if (VB->AttribPtr[_TNL_ATTRIB_TEX0]->size == 4) return GL_FALSE; } diff --git a/src/mesa/drivers/dri/unichrome/via_tris.c b/src/mesa/drivers/dri/unichrome/via_tris.c index 79e67620c9..ab457d41dc 100644 --- a/src/mesa/drivers/dri/unichrome/via_tris.c +++ b/src/mesa/drivers/dri/unichrome/via_tris.c @@ -832,13 +832,13 @@ static GLboolean viaCheckPTexHack( GLcontext *ctx ) RENDERINPUTS_COPY( index_bitset, tnl->render_inputs_bitset ); - if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 ) && VB->TexCoordPtr[0]->size == 4) { + if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX0 ) && VB->AttribPtr[_TNL_ATTRIB_TEX0]->size == 4) { if (!RENDERINPUTS_TEST_RANGE( index_bitset, _TNL_ATTRIB_TEX1, _TNL_LAST_TEX )) ptexHack = GL_TRUE; else fallback = GL_TRUE; } - if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX1 ) && VB->TexCoordPtr[1]->size == 4) + if (RENDERINPUTS_TEST( index_bitset, _TNL_ATTRIB_TEX1 ) && VB->AttribPtr[_TNL_ATTRIB_TEX1]->size == 4) fallback = GL_TRUE; FALLBACK(VIA_CONTEXT(ctx), VIA_FALLBACK_PROJ_TEXTURE, fallback); diff --git a/src/mesa/drivers/glide/fxvbtmp.h b/src/mesa/drivers/glide/fxvbtmp.h index f7970c78e2..674d9c6799 100644 --- a/src/mesa/drivers/glide/fxvbtmp.h +++ b/src/mesa/drivers/glide/fxvbtmp.h @@ -62,21 +62,21 @@ static void TAG(emit)( GLcontext *ctx, } if (IND & SETUP_TMU0) { - tc0 = VB->TexCoordPtr[tmu0_source]->data; - tc0_stride = VB->TexCoordPtr[tmu0_source]->stride; + tc0 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu0_source]->data; + tc0_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu0_source]->stride; u0scale = fxMesa->s0scale; v0scale = fxMesa->t0scale; if (IND & SETUP_PTEX) - tc0_size = VB->TexCoordPtr[tmu0_source]->size; + tc0_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu0_source]->size; } if (IND & SETUP_TMU1) { - tc1 = VB->TexCoordPtr[tmu1_source]->data; - tc1_stride = VB->TexCoordPtr[tmu1_source]->stride; + tc1 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu1_source]->data; + tc1_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu1_source]->stride; u1scale = fxMesa->s1scale; /* wrong if tmu1_source == 0, possible? */ v1scale = fxMesa->t1scale; if (IND & SETUP_PTEX) - tc1_size = VB->TexCoordPtr[tmu1_source]->size; + tc1_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + tmu1_source]->size; } if (IND & SETUP_RGBA) { @@ -220,14 +220,15 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; if (IND & SETUP_TMU1) { - if (VB->TexCoordPtr[0] == 0) - VB->TexCoordPtr[0] = VB->TexCoordPtr[1]; + if (VB->AttribPtr[_TNL_ATTRIB_TEX0] == 0) + VB->AttribPtr[_TNL_ATTRIB_TEX0] = VB->AttribPtr[_TNL_ATTRIB_TEX1]; - if (VB->TexCoordPtr[1]->size == 4) + if (VB->AttribPtr[_TNL_ATTRIB_TEX1]->size == 4) return GL_FALSE; } - if (VB->TexCoordPtr[0] && VB->TexCoordPtr[0]->size == 4) + if (VB->AttribPtr[_TNL_ATTRIB_TEX0] && + VB->AttribPtr[_TNL_ATTRIB_TEX0]->size == 4) return GL_FALSE; } diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c index c99ba0bba5..aa2e7e3a8d 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c @@ -259,15 +259,15 @@ pV->Diffuse = dwColor; #define GLD_SETUP_TEX0_3D(v) \ - if (VB->TexCoordPtr[0]) { \ - tc = VB->TexCoordPtr[0]->data; \ + if (VB->AttribPtr[_TNL_ATTRIB_TEX0]) { \ + tc = VB->AttribPtr[_TNL_ATTRIB_TEX0]->data; \ pV->TexUnit0.x = tc[##v][0]; \ pV->TexUnit0.y = tc[##v][1]; \ } #define GLD_SETUP_TEX1_3D(v) \ - if (VB->TexCoordPtr[1]) { \ - tc = VB->TexCoordPtr[1]->data; \ + if (VB->AttribPtr[_TNL_ATTRIB_TEX1]) { \ + tc = VB->AttribPtr[_TNL_ATTRIB_TEX1]->data; \ pV->TexUnit1.x = tc[##v][0]; \ pV->TexUnit1.y = tc[##v][1]; \ } diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c index a5b5462f03..7cc2ef6f30 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c @@ -259,15 +259,15 @@ pV->Diffuse = dwColor; #define GLD_SETUP_TEX0_3D(v) \ - if (VB->TexCoordPtr[0]) { \ - tc = VB->TexCoordPtr[0]->data; \ + if (VB->AttribPtr[_TNL_ATTRIB_TEX0]) { \ + tc = VB->TnlAttribPtr[_TNL_ATTRIB_TEX0]->data; \ pV->TexUnit0.x = tc[##v][0]; \ pV->TexUnit0.y = tc[##v][1]; \ } #define GLD_SETUP_TEX1_3D(v) \ - if (VB->TexCoordPtr[1]) { \ - tc = VB->TexCoordPtr[1]->data; \ + if (VB->TnlAttribPtr[_TNL_ATTRIB_TEX1]) { \ + tc = VB->TnlAttribPtr[_TNL_ATTRIB_TEX1]->data; \ pV->TexUnit1.x = tc[##v][0]; \ pV->TexUnit1.y = tc[##v][1]; \ } diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c index 403a9d5f86..3b8af8546e 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c @@ -259,15 +259,15 @@ pV->Diffuse = dwColor; #define GLD_SETUP_TEX0_3D(v) \ - if (VB->TexCoordPtr[0]) { \ - tc = VB->TexCoordPtr[0]->data; \ + if (VB->AttribPtr[_TNL_ATTRIB_TEX0]) { \ + tc = VB->AttribPtr[_TNL_ATTRIB_TEX0]->data; \ pV->TexUnit0.x = tc[##v][0]; \ pV->TexUnit0.y = tc[##v][1]; \ } #define GLD_SETUP_TEX1_3D(v) \ - if (VB->TexCoordPtr[1]) { \ - tc = VB->TexCoordPtr[1]->data; \ + if (VB->AttribPtr[_TNL_ATTRIB_TEX1]) { \ + tc = VB->AttribPtr[_TNL_ATTRIB_TEX1]->data; \ pV->TexUnit1.x = tc[##v][0]; \ pV->TexUnit1.y = tc[##v][1]; \ } diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index 504e8c5044..d2b13f1b02 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -200,7 +200,7 @@ struct vertex_buffer /* Pointers to current data. * XXX some of these fields alias AttribPtr below and should be removed - * such as TexCoordPtr, FogCoordPtr, etc. + * such as FogCoordPtr, etc. */ GLuint *Elts; GLvector4f *ObjPtr; /* _TNL_BIT_POS */ @@ -212,7 +212,6 @@ struct vertex_buffer GLubyte *ClipMask; /* _TNL_BIT_POS */ GLfloat *NormalLengthPtr; /* _TNL_BIT_NORMAL */ GLboolean *EdgeFlag; /* _TNL_BIT_EDGEFLAG */ - GLvector4f *TexCoordPtr[MAX_TEXTURE_COORD_UNITS]; /* VERT_TEX_0..n */ GLvector4f *IndexPtr[2]; /* _TNL_BIT_INDEX */ GLvector4f *ColorPtr[2]; /* _TNL_BIT_COLOR0 */ GLvector4f *SecondaryColorPtr[2]; /* _TNL_BIT_COLOR1 */ diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c index 2df9444d2b..202c6ae3ce 100644 --- a/src/mesa/tnl/t_draw.c +++ b/src/mesa/tnl/t_draw.c @@ -263,10 +263,6 @@ static void bind_inputs( GLcontext *ctx, VB->SecondaryColorPtr[1] = NULL; VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG]; - for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { - VB->TexCoordPtr[i] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]; - } - /* Clipping and drawing code still requires this to be a packed * array of ubytes which can be written into. TODO: Fix and * remove. diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c index e69f7d5766..d76b0a6b9d 100644 --- a/src/mesa/tnl/t_vb_program.c +++ b/src/mesa/tnl/t_vb_program.c @@ -466,7 +466,6 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage ) VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->results[VERT_RESULT_PSIZ]; for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { - VB->TexCoordPtr[i] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + i] = &store->results[VERT_RESULT_TEX0 + i]; } diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c index 7c1819b223..83b74c0ebf 100644 --- a/src/mesa/tnl/t_vb_texgen.c +++ b/src/mesa/tnl/t_vb_texgen.c @@ -498,7 +498,6 @@ static GLboolean run_texgen_stage( GLcontext *ctx, store->TexgenFunc[i]( ctx, store, i ); - VB->TexCoordPtr[i] = VB->AttribPtr[VERT_ATTRIB_TEX0 + i] = &store->texcoord[i]; } } diff --git a/src/mesa/tnl/t_vb_texmat.c b/src/mesa/tnl/t_vb_texmat.c index 0abe8cc35d..83688290e5 100644 --- a/src/mesa/tnl/t_vb_texmat.c +++ b/src/mesa/tnl/t_vb_texmat.c @@ -73,7 +73,6 @@ static GLboolean run_texmat_stage( GLcontext *ctx, ctx->TextureMatrixStack[i].Top, VB->AttribPtr[_TNL_ATTRIB_TEX0 + i]); - VB->TexCoordPtr[i] = VB->AttribPtr[VERT_ATTRIB_TEX0+i] = &store->texcoord[i]; } } diff --git a/src/mesa/tnl_dd/t_dd_vbtmp.h b/src/mesa/tnl_dd/t_dd_vbtmp.h index 92dd8931c3..c1cc6ae1bf 100644 --- a/src/mesa/tnl_dd/t_dd_vbtmp.h +++ b/src/mesa/tnl_dd/t_dd_vbtmp.h @@ -153,34 +153,34 @@ static void TAG(emit)( GLcontext *ctx, if (DO_TEX3) { const GLuint t3 = GET_TEXSOURCE(3); - tc3 = VB->TexCoordPtr[t3]->data; - tc3_stride = VB->TexCoordPtr[t3]->stride; + tc3 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t3]->data; + tc3_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t3]->stride; if (DO_PTEX) - tc3_size = VB->TexCoordPtr[t3]->size; + tc3_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t3]->size; } if (DO_TEX2) { const GLuint t2 = GET_TEXSOURCE(2); - tc2 = VB->TexCoordPtr[t2]->data; - tc2_stride = VB->TexCoordPtr[t2]->stride; + tc2 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->data; + tc2_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->stride; if (DO_PTEX) - tc2_size = VB->TexCoordPtr[t2]->size; + tc2_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t2]->size; } if (DO_TEX1) { const GLuint t1 = GET_TEXSOURCE(1); - tc1 = VB->TexCoordPtr[t1]->data; - tc1_stride = VB->TexCoordPtr[t1]->stride; + tc1 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->data; + tc1_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->stride; if (DO_PTEX) - tc1_size = VB->TexCoordPtr[t1]->size; + tc1_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t1]->size; } if (DO_TEX0) { const GLuint t0 = GET_TEXSOURCE(0); - tc0_stride = VB->TexCoordPtr[t0]->stride; - tc0 = VB->TexCoordPtr[t0]->data; + tc0_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->stride; + tc0 = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->data; if (DO_PTEX) - tc0_size = VB->TexCoordPtr[t0]->size; + tc0_size = VB->AttribPtr[_TNL_ATTRIB_TEX0 + t0]->size; } if (DO_RGBA) { @@ -410,22 +410,22 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) /* Force 'missing' texcoords to something valid. */ - if (DO_TEX3 && VB->TexCoordPtr[2] == 0) - VB->TexCoordPtr[2] = VB->TexCoordPtr[3]; + if (DO_TEX3 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + 2] == 0) + VB->AttribPtr[_TNL_ATTRIB_TEX0 + 2] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + 3]; - if (DO_TEX2 && VB->TexCoordPtr[1] == 0) - VB->TexCoordPtr[1] = VB->TexCoordPtr[2]; + if (DO_TEX2 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + 1] == 0) + VB->AttribPtr[_TNL_ATTRIB_TEX0 + 1] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + 2]; - if (DO_TEX1 && VB->TexCoordPtr[0] == 0) - VB->TexCoordPtr[0] = VB->TexCoordPtr[1]; + if (DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + 0] == 0) + VB->AttribPtr[_TNL_ATTRIB_TEX0 + 0] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + 1]; if (DO_PTEX) return GL_TRUE; - if ((DO_TEX3 && VB->TexCoordPtr[GET_TEXSOURCE(3)]->size == 4) || - (DO_TEX2 && VB->TexCoordPtr[GET_TEXSOURCE(2)]->size == 4) || - (DO_TEX1 && VB->TexCoordPtr[GET_TEXSOURCE(1)]->size == 4) || - (DO_TEX0 && VB->TexCoordPtr[GET_TEXSOURCE(0)]->size == 4)) + if ((DO_TEX3 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(3)]->size == 4) || + (DO_TEX2 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(2)]->size == 4) || + (DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(1)]->size == 4) || + (DO_TEX0 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(0)]->size == 4)) return GL_FALSE; return GL_TRUE; @@ -438,14 +438,14 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) /* Force 'missing' texcoords to something valid. */ - if (DO_TEX3 && VB->TexCoordPtr[2] == 0) - VB->TexCoordPtr[2] = VB->TexCoordPtr[3]; + if (DO_TEX3 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + 2] == 0) + VB->AttribPtr[_TNL_ATTRIB_TEX0 + 2] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + 3]; - if (DO_TEX2 && VB->TexCoordPtr[1] == 0) - VB->TexCoordPtr[1] = VB->TexCoordPtr[2]; + if (DO_TEX2 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + 1] == 0) + VB->AttribPtr[_TNL_ATTRIB_TEX0 + 1] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + 2]; - if (DO_TEX1 && VB->TexCoordPtr[0] == 0) - VB->TexCoordPtr[0] = VB->TexCoordPtr[1]; + if (DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + 0] == 0) + VB->AttribPtr[_TNL_ATTRIB_TEX0 + 0] = VB->AttribPtr[_TNL_ATTRIB_TEX0 + 1]; if (DO_PTEX) return GL_TRUE; @@ -453,14 +453,14 @@ static GLboolean TAG(check_tex_sizes)( GLcontext *ctx ) /* No hardware support for projective texture. Can fake it for * TEX0 only. */ - if ((DO_TEX3 && VB->TexCoordPtr[GET_TEXSOURCE(3)]->size == 4) || - (DO_TEX2 && VB->TexCoordPtr[GET_TEXSOURCE(2)]->size == 4) || - (DO_TEX1 && VB->TexCoordPtr[GET_TEXSOURCE(1)]->size == 4)) { + if ((DO_TEX3 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(3)]->size == 4) || + (DO_TEX2 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(2)]->size == 4) || + (DO_TEX1 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(1)]->size == 4)) { PTEX_FALLBACK(); return GL_FALSE; } - if (DO_TEX0 && VB->TexCoordPtr[GET_TEXSOURCE(0)]->size == 4) { + if (DO_TEX0 && VB->AttribPtr[_TNL_ATTRIB_TEX0 + GET_TEXSOURCE(0)]->size == 4) { if (DO_TEX1 || DO_TEX2 || DO_TEX3) { PTEX_FALLBACK(); } diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c index f78a277601..a70fdc1fa0 100644 --- a/src/mesa/x86/gen_matypes.c +++ b/src/mesa/x86/gen_matypes.c @@ -128,10 +128,10 @@ int main( int argc, char **argv ) OFFSET( "VB_CLIP_MASK ", struct vertex_buffer, ClipMask ); OFFSET( "VB_NORMAL_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_NORMAL] ); OFFSET( "VB_EDGE_FLAG ", struct vertex_buffer, EdgeFlag ); - OFFSET( "VB_TEX0_COORD_PTR ", struct vertex_buffer, TexCoordPtr[0] ); - OFFSET( "VB_TEX1_COORD_PTR ", struct vertex_buffer, TexCoordPtr[1] ); - OFFSET( "VB_TEX2_COORD_PTR ", struct vertex_buffer, TexCoordPtr[2] ); - OFFSET( "VB_TEX3_COORD_PTR ", struct vertex_buffer, TexCoordPtr[3] ); + OFFSET( "VB_TEX0_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX0] ); + OFFSET( "VB_TEX1_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX1] ); + OFFSET( "VB_TEX2_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX2] ); + OFFSET( "VB_TEX3_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX3] ); OFFSET( "VB_INDEX_PTR ", struct vertex_buffer, IndexPtr ); OFFSET( "VB_COLOR_PTR ", struct vertex_buffer, ColorPtr ); OFFSET( "VB_SECONDARY_COLOR_PTR ", struct vertex_buffer, SecondaryColorPtr ); -- cgit v1.2.3 From 165b860da6f16ef4817a4959774a57f57ba3756d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 Nov 2009 23:27:13 -0800 Subject: tnl: Replace deprecated ObjPtr with AttribPtr[_TNL_ATTRIB_POS] --- src/mesa/drivers/dri/radeon/radeon_maos_arrays.c | 8 ++++---- src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h | 4 ++-- src/mesa/drivers/dri/radeon/radeon_maos_verts.c | 16 ++++++++-------- .../drivers/windows/gldirect/dx7/gld_primitive_dx7.c | 2 +- .../drivers/windows/gldirect/dx8/gld_primitive_dx8.c | 2 +- .../drivers/windows/gldirect/dx9/gld_primitive_dx9.c | 2 +- src/mesa/tnl/t_context.h | 1 - src/mesa/tnl/t_draw.c | 1 - src/mesa/tnl/t_vb_fog.c | 13 +++++++------ src/mesa/tnl/t_vb_light.c | 10 +++++----- src/mesa/tnl/t_vb_texgen.c | 2 +- src/mesa/tnl/t_vb_vertex.c | 6 +++--- src/mesa/x86/gen_matypes.c | 2 +- 13 files changed, 34 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c index 1cd1d6e778..74b66900c9 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c @@ -196,12 +196,12 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs ) if (!rmesa->tcl.obj.buf) rcommon_emit_vector( ctx, &(rmesa->tcl.aos[nr]), - (char *)VB->ObjPtr->data, - VB->ObjPtr->size, - VB->ObjPtr->stride, + (char *)VB->AttribPtr[_TNL_ATTRIB_POS]->data, + VB->AttribPtr[_TNL_ATTRIB_POS]->size, + VB->AttribPtr[_TNL_ATTRIB_POS]->stride, count); - switch( VB->ObjPtr->size ) { + switch( VB->AttribPtr[_TNL_ATTRIB_POS]->size ) { case 4: vfmt |= RADEON_CP_VC_FRMT_W0; case 3: vfmt |= RADEON_CP_VC_FRMT_Z; case 2: vfmt |= RADEON_CP_VC_FRMT_XY; diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h index cb57416c3e..efb06db80e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h +++ b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h @@ -56,8 +56,8 @@ static void TAG(emit)( GLcontext *ctx, radeon_print(RADEON_SWRENDER, RADEON_VERBOSE, "%s\n", __FUNCTION__); - coord = (GLuint (*)[4])VB->ObjPtr->data; - coord_stride = VB->ObjPtr->stride; + coord = (GLuint (*)[4])VB->AttribPtr[_TNL_ATTRIB_POS]->data; + coord_stride = VB->AttribPtr[_TNL_ATTRIB_POS]->stride; if (DO_TEX2) { if (VB->AttribPtr[_TNL_ATTRIB_TEX2]) { diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c index a6aff69aac..5ed11d0a9d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c @@ -326,7 +326,7 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs ) if (1) { req |= RADEON_CP_VC_FRMT_Z; - if (VB->ObjPtr->size == 4) { + if (VB->AttribPtr[_TNL_ATTRIB_POS]->size == 4) { req |= RADEON_CP_VC_FRMT_W0; } } @@ -390,19 +390,19 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs ) * this, add more vertex code (for obj-2, obj-3) or preferably move * to maos. */ - if (VB->ObjPtr->size < 3 || - (VB->ObjPtr->size == 3 && + if (VB->AttribPtr[_TNL_ATTRIB_POS]->size < 3 || + (VB->AttribPtr[_TNL_ATTRIB_POS]->size == 3 && (setup_tab[i].vertex_format & RADEON_CP_VC_FRMT_W0))) { _math_trans_4f( rmesa->tcl.ObjClean.data, - VB->ObjPtr->data, - VB->ObjPtr->stride, + VB->AttribPtr[_TNL_ATTRIB_POS]->data, + VB->AttribPtr[_TNL_ATTRIB_POS]->stride, GL_FLOAT, - VB->ObjPtr->size, + VB->AttribPtr[_TNL_ATTRIB_POS]->size, 0, VB->Count ); - switch (VB->ObjPtr->size) { + switch (VB->AttribPtr[_TNL_ATTRIB_POS]->size) { case 1: _mesa_vector4f_clean_elem(&rmesa->tcl.ObjClean, VB->Count, 1); case 2: @@ -416,7 +416,7 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs ) break; } - VB->ObjPtr = &rmesa->tcl.ObjClean; + VB->AttribPtr[_TNL_ATTRIB_POS] = &rmesa->tcl.ObjClean; } diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c index aa2e7e3a8d..46e652dc73 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c @@ -241,7 +241,7 @@ DWORD dwColor; #define GLD_SETUP_3D_VERTEX(v) \ - p4f = VB->ObjPtr->data; \ + p4f = VB->AttribPtr[_TNL_ATTRIB_POS]->data; \ pV->Position.x = p4f[##v][0]; \ pV->Position.y = p4f[##v][1]; \ pV->Position.z = p4f[##v][2]; diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c index 7cc2ef6f30..b95351553c 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c @@ -241,7 +241,7 @@ DWORD dwColor; #define GLD_SETUP_3D_VERTEX(v) \ - p4f = VB->ObjPtr->data; \ + p4f = VB->AttribPtr[_TNL_ATTRIB_POS]->data; \ pV->Position.x = p4f[##v][0]; \ pV->Position.y = p4f[##v][1]; \ pV->Position.z = p4f[##v][2]; diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c index 3b8af8546e..1b84cdee28 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c @@ -241,7 +241,7 @@ DWORD dwColor; #define GLD_SETUP_3D_VERTEX(v) \ - p4f = VB->ObjPtr->data; \ + p4f = VB->AttribPtr[_TNL_ATTRIB_POS]->data; \ pV->Position.x = p4f[##v][0]; \ pV->Position.y = p4f[##v][1]; \ pV->Position.z = p4f[##v][2]; diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index d2b13f1b02..bfba09fd56 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -203,7 +203,6 @@ struct vertex_buffer * such as FogCoordPtr, etc. */ GLuint *Elts; - GLvector4f *ObjPtr; /* _TNL_BIT_POS */ GLvector4f *EyePtr; /* _TNL_BIT_POS */ GLvector4f *ClipPtr; /* _TNL_BIT_POS */ GLvector4f *NdcPtr; /* _TNL_BIT_POS */ diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c index 202c6ae3ce..2a293243e5 100644 --- a/src/mesa/tnl/t_draw.c +++ b/src/mesa/tnl/t_draw.c @@ -254,7 +254,6 @@ static void bind_inputs( GLcontext *ctx, /* Legacy pointers -- remove one day. */ - VB->ObjPtr = VB->AttribPtr[_TNL_ATTRIB_POS]; VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0]; VB->ColorPtr[1] = NULL; VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX]; diff --git a/src/mesa/tnl/t_vb_fog.c b/src/mesa/tnl/t_vb_fog.c index f3a7bd49f4..a68310de4d 100644 --- a/src/mesa/tnl/t_vb_fog.c +++ b/src/mesa/tnl/t_vb_fog.c @@ -156,7 +156,7 @@ run_fog_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) GLuint i; GLfloat *coord; /* Fog is computed from vertex or fragment Z values */ - /* source = VB->ObjPtr or VB->EyePtr coords */ + /* source = VB->AttribPtr[_TNL_ATTRIB_POS] or VB->EyePtr coords */ /* dest = VB->AttribPtr[_TNL_ATTRIB_FOG] = fog stage private storage */ VB->AttribPtr[_TNL_ATTRIB_FOG] = &store->fogcoord; @@ -176,11 +176,12 @@ run_fog_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) /* Full eye coords weren't required, just calculate the * eye Z values. */ - _mesa_dotprod_tab[VB->ObjPtr->size]( (GLfloat *) input->data, - 4 * sizeof(GLfloat), - VB->ObjPtr, plane ); + _mesa_dotprod_tab[VB->AttribPtr[_TNL_ATTRIB_POS]->size] + ( (GLfloat *) input->data, + 4 * sizeof(GLfloat), + VB->AttribPtr[_TNL_ATTRIB_POS], plane ); - input->count = VB->ObjPtr->count; + input->count = VB->AttribPtr[_TNL_ATTRIB_POS]->count; /* make sure coords are really positive NOTE should avoid going through array twice */ @@ -213,7 +214,7 @@ run_fog_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) /* input->count may be one if glFogCoord was only called once * before glBegin. But we need to compute fog for all vertices. */ - input->count = VB->ObjPtr->count; + input->count = VB->AttribPtr[_TNL_ATTRIB_POS]->count; VB->AttribPtr[_TNL_ATTRIB_FOG] = &store->fogcoord; /* dest data */ } diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c index f47f99397c..360452192d 100644 --- a/src/mesa/tnl/t_vb_light.c +++ b/src/mesa/tnl/t_vb_light.c @@ -200,7 +200,7 @@ static GLboolean run_lighting( GLcontext *ctx, struct light_stage_data *store = LIGHT_STAGE_DATA(stage); TNLcontext *tnl = TNL_CONTEXT(ctx); struct vertex_buffer *VB = &tnl->vb; - GLvector4f *input = ctx->_NeedEyeCoords ? VB->EyePtr : VB->ObjPtr; + GLvector4f *input = ctx->_NeedEyeCoords ? VB->EyePtr : VB->AttribPtr[_TNL_ATTRIB_POS]; GLuint idx; if (!ctx->Light.Enabled || ctx->VertexProgram._Current) @@ -208,13 +208,13 @@ static GLboolean run_lighting( GLcontext *ctx, /* Make sure we can talk about position x,y and z: */ - if (input->size <= 2 && input == VB->ObjPtr) { + if (input->size <= 2 && input == VB->AttribPtr[_TNL_ATTRIB_POS]) { _math_trans_4f( store->Input.data, - VB->ObjPtr->data, - VB->ObjPtr->stride, + VB->AttribPtr[_TNL_ATTRIB_POS]->data, + VB->AttribPtr[_TNL_ATTRIB_POS]->stride, GL_FLOAT, - VB->ObjPtr->size, + VB->AttribPtr[_TNL_ATTRIB_POS]->size, 0, VB->Count ); diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c index 83b74c0ebf..9ef13bc96d 100644 --- a/src/mesa/tnl/t_vb_texgen.c +++ b/src/mesa/tnl/t_vb_texgen.c @@ -341,7 +341,7 @@ static void texgen( GLcontext *ctx, GLvector4f *in = VB->AttribPtr[VERT_ATTRIB_TEX0 + unit]; GLvector4f *out = &store->texcoord[unit]; const struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit]; - const GLvector4f *obj = VB->ObjPtr; + const GLvector4f *obj = VB->AttribPtr[_TNL_ATTRIB_POS]; const GLvector4f *eye = VB->EyePtr; const GLvector4f *normal = VB->AttribPtr[_TNL_ATTRIB_NORMAL]; const GLfloat *m = store->tmp_m; diff --git a/src/mesa/tnl/t_vb_vertex.c b/src/mesa/tnl/t_vb_vertex.c index 4734754ea4..bc7e0951ec 100644 --- a/src/mesa/tnl/t_vb_vertex.c +++ b/src/mesa/tnl/t_vb_vertex.c @@ -152,16 +152,16 @@ static GLboolean run_vertex_stage( GLcontext *ctx, * Use combined ModelProject to avoid some depth artifacts */ if (ctx->ModelviewMatrixStack.Top->type == MATRIX_IDENTITY) - VB->EyePtr = VB->ObjPtr; + VB->EyePtr = VB->AttribPtr[_TNL_ATTRIB_POS]; else VB->EyePtr = TransformRaw( &store->eye, ctx->ModelviewMatrixStack.Top, - VB->ObjPtr); + VB->AttribPtr[_TNL_ATTRIB_POS]); } VB->ClipPtr = TransformRaw( &store->clip, &ctx->_ModelProjectMatrix, - VB->ObjPtr ); + VB->AttribPtr[_TNL_ATTRIB_POS] ); /* Drivers expect this to be clean to element 4... */ diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c index a70fdc1fa0..61d6d16a76 100644 --- a/src/mesa/x86/gen_matypes.c +++ b/src/mesa/x86/gen_matypes.c @@ -120,7 +120,7 @@ int main( int argc, char **argv ) OFFSET( "VB_COUNT ", struct vertex_buffer, Count ); printf( "\n" ); OFFSET( "VB_ELTS ", struct vertex_buffer, Elts ); - OFFSET( "VB_OBJ_PTR ", struct vertex_buffer, ObjPtr ); + OFFSET( "VB_OBJ_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_POS] ); OFFSET( "VB_EYE_PTR ", struct vertex_buffer, EyePtr ); OFFSET( "VB_CLIP_PTR ", struct vertex_buffer, ClipPtr ); OFFSET( "VB_PROJ_CLIP_PTR ", struct vertex_buffer, NdcPtr ); -- cgit v1.2.3 From fc9a2970dc539b21b035ea0a770ec69822962145 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 17 Nov 2009 23:38:35 -0800 Subject: tnl: Replace deprecated IndexPtr[] with AttribPtr[] or new BackfaceIndexPtr --- src/mesa/swrast_setup/ss_tritmp.h | 2 +- src/mesa/tnl/t_context.h | 7 +++++-- src/mesa/tnl/t_draw.c | 3 +-- src/mesa/tnl/t_vb_light.c | 1 - src/mesa/tnl/t_vb_lighttmp.h | 8 ++++---- src/mesa/tnl/t_vertex_generic.c | 12 ++++++------ src/mesa/tnl_dd/t_dd_tritmp.h | 4 ++-- src/mesa/x86/gen_matypes.c | 2 +- 8 files changed, 20 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h index 724b5e94fa..9700cf8c54 100644 --- a/src/mesa/swrast_setup/ss_tritmp.h +++ b/src/mesa/swrast_setup/ss_tritmp.h @@ -127,7 +127,7 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) } } } else { - GLfloat *vbindex = (GLfloat *)VB->IndexPtr[1]->data; + GLfloat *vbindex = (GLfloat *)VB->BackfaceIndexPtr->data; saved_index[0] = v[0]->attrib[FRAG_ATTRIB_CI][0]; saved_index[1] = v[1]->attrib[FRAG_ATTRIB_CI][0]; saved_index[2] = v[2]->attrib[FRAG_ATTRIB_CI][0]; diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index bfba09fd56..b41cf93897 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -198,7 +198,10 @@ struct vertex_buffer */ GLuint Count; /**< Number of vertices currently in buffer */ - /* Pointers to current data. + /* Pointers to current data. Most of the data is in AttribPtr -- all of + * it that is one of VERT_ATTRIB_X. For things only produced by TNL, + * such as backface color or eye-space coordinates, they are stored + * here. * XXX some of these fields alias AttribPtr below and should be removed * such as FogCoordPtr, etc. */ @@ -211,7 +214,7 @@ struct vertex_buffer GLubyte *ClipMask; /* _TNL_BIT_POS */ GLfloat *NormalLengthPtr; /* _TNL_BIT_NORMAL */ GLboolean *EdgeFlag; /* _TNL_BIT_EDGEFLAG */ - GLvector4f *IndexPtr[2]; /* _TNL_BIT_INDEX */ + GLvector4f *BackfaceIndexPtr; /* _TNL_BIT_INDEX */ GLvector4f *ColorPtr[2]; /* _TNL_BIT_COLOR0 */ GLvector4f *SecondaryColorPtr[2]; /* _TNL_BIT_COLOR1 */ GLvector4f *FogCoordPtr; /* _TNL_BIT_FOG */ diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c index 2a293243e5..8092627645 100644 --- a/src/mesa/tnl/t_draw.c +++ b/src/mesa/tnl/t_draw.c @@ -256,8 +256,7 @@ static void bind_inputs( GLcontext *ctx, */ VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0]; VB->ColorPtr[1] = NULL; - VB->IndexPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX]; - VB->IndexPtr[1] = NULL; + VB->BackfaceIndexPtr = NULL; VB->SecondaryColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR1]; VB->SecondaryColorPtr[1] = NULL; VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG]; diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c index 360452192d..e72a807f0d 100644 --- a/src/mesa/tnl/t_vb_light.c +++ b/src/mesa/tnl/t_vb_light.c @@ -248,7 +248,6 @@ static GLboolean run_lighting( GLcontext *ctx, VB->AttribPtr[_TNL_ATTRIB_COLOR0] = VB->ColorPtr[0]; VB->AttribPtr[_TNL_ATTRIB_COLOR1] = VB->SecondaryColorPtr[0]; - VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX] = VB->IndexPtr[0]; return GL_TRUE; } diff --git a/src/mesa/tnl/t_vb_lighttmp.h b/src/mesa/tnl/t_vb_lighttmp.h index 124ca3c74f..dd117e435c 100644 --- a/src/mesa/tnl/t_vb_lighttmp.h +++ b/src/mesa/tnl/t_vb_lighttmp.h @@ -665,14 +665,14 @@ static void TAG(light_ci)( GLcontext *ctx, fprintf(stderr, "%s\n", __FUNCTION__ ); #endif - VB->IndexPtr[0] = &store->LitIndex[0]; + VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX] = &store->LitIndex[0]; #if IDX & LIGHT_TWOSIDE - VB->IndexPtr[1] = &store->LitIndex[1]; + VB->BackfaceIndexPtr = &store->LitIndex[1]; #endif - indexResult[0] = (GLfloat *)VB->IndexPtr[0]->data; + indexResult[0] = (GLfloat *)VB->AttribPtr[_TNL_ATTRIB_COLOR_INDEX]->data; #if IDX & LIGHT_TWOSIDE - indexResult[1] = (GLfloat *)VB->IndexPtr[1]->data; + indexResult[1] = (GLfloat *)VB->BackfaceIndexPtr->data; #endif /* loop over vertices */ diff --git a/src/mesa/tnl/t_vertex_generic.c b/src/mesa/tnl/t_vertex_generic.c index 9812f8c808..f97ad7c2ed 100644 --- a/src/mesa/tnl/t_vertex_generic.c +++ b/src/mesa/tnl/t_vertex_generic.c @@ -1115,10 +1115,10 @@ void _tnl_generic_interp_extras( GLcontext *ctx, VB->SecondaryColorPtr[1]->data[in] ); } - if (VB->IndexPtr[1]) { - VB->IndexPtr[1]->data[dst][0] = LINTERP( t, - VB->IndexPtr[1]->data[out][0], - VB->IndexPtr[1]->data[in][0] ); + if (VB->BackfaceIndexPtr) { + VB->BackfaceIndexPtr->data[dst][0] = LINTERP( t, + VB->BackfaceIndexPtr->data[out][0], + VB->BackfaceIndexPtr->data[in][0] ); } if (VB->EdgeFlag) { @@ -1145,8 +1145,8 @@ void _tnl_generic_copy_pv_extras( GLcontext *ctx, VB->SecondaryColorPtr[1]->data[src] ); } - if (VB->IndexPtr[1]) { - VB->IndexPtr[1]->data[dst][0] = VB->IndexPtr[1]->data[src][0]; + if (VB->BackfaceIndexPtr) { + VB->BackfaceIndexPtr->data[dst][0] = VB->BackfaceIndexPtr->data[src][0]; } _tnl_generic_copy_pv(ctx, dst, src); diff --git a/src/mesa/tnl_dd/t_dd_tritmp.h b/src/mesa/tnl_dd/t_dd_tritmp.h index 1ae70f4059..0e3bc1329d 100644 --- a/src/mesa/tnl_dd/t_dd_tritmp.h +++ b/src/mesa/tnl_dd/t_dd_tritmp.h @@ -237,7 +237,7 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) } } else { - GLfloat (*vbindex) = (GLfloat *)VB->IndexPtr[1]->data; + GLfloat (*vbindex) = (GLfloat *)VB->BackfaceIndexPtr->data; if (!DO_FLAT) { VERT_SAVE_IND( 0 ); VERT_SAVE_IND( 1 ); @@ -506,7 +506,7 @@ static void TAG(quadr)( GLcontext *ctx, } } else { - GLfloat *vbindex = (GLfloat *)VB->IndexPtr[1]->data; + GLfloat *vbindex = (GLfloat *)VB->BackfaceIndexPtr->data; if (!DO_FLAT) { VERT_SAVE_IND( 0 ); VERT_SAVE_IND( 1 ); diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c index 61d6d16a76..5355c26874 100644 --- a/src/mesa/x86/gen_matypes.c +++ b/src/mesa/x86/gen_matypes.c @@ -132,7 +132,7 @@ int main( int argc, char **argv ) OFFSET( "VB_TEX1_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX1] ); OFFSET( "VB_TEX2_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX2] ); OFFSET( "VB_TEX3_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX3] ); - OFFSET( "VB_INDEX_PTR ", struct vertex_buffer, IndexPtr ); + OFFSET( "VB_INDEX_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_COLOR_INDEX] ); OFFSET( "VB_COLOR_PTR ", struct vertex_buffer, ColorPtr ); OFFSET( "VB_SECONDARY_COLOR_PTR ", struct vertex_buffer, SecondaryColorPtr ); OFFSET( "VB_FOG_COORD_PTR ", struct vertex_buffer, FogCoordPtr ); -- cgit v1.2.3 From 0a9187801505130738ae947c69cafa8a1dd118d1 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Nov 2009 01:38:55 -0800 Subject: tnl: Replace deprecated ColorPtr[] with AttribPtr or new BackfaceColorPtr. --- src/mesa/drivers/dri/ffb/ffb_vbtmp.h | 8 ++--- src/mesa/drivers/dri/gamma/gamma_render.c | 4 +-- src/mesa/drivers/dri/mach64/mach64_native_vb.c | 30 +++++++++---------- src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h | 10 +++---- src/mesa/drivers/dri/mach64/mach64_vbtmp.h | 16 +++++----- src/mesa/drivers/dri/r300/r300_swtcl.c | 4 +-- src/mesa/drivers/dri/radeon/radeon_maos_arrays.c | 14 ++++----- src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h | 12 ++++---- src/mesa/drivers/dri/tdfx/tdfx_vb.c | 14 ++++----- src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h | 6 ++-- src/mesa/drivers/glide/fxvb.c | 34 +++++++++++----------- src/mesa/drivers/glide/fxvbtmp.h | 10 +++---- .../windows/gldirect/dx7/gld_primitive_dx7.c | 10 +++---- .../windows/gldirect/dx7/gld_vb_d3d_render_dx7.c | 2 +- .../windows/gldirect/dx8/gld_primitive_dx8.c | 10 +++---- .../windows/gldirect/dx8/gld_vb_d3d_render_dx8.c | 2 +- .../windows/gldirect/dx9/gld_primitive_dx9.c | 10 +++---- .../windows/gldirect/dx9/gld_vb_d3d_render_dx9.c | 2 +- src/mesa/swrast_setup/ss_tritmp.h | 16 +++++----- src/mesa/tnl/t_context.h | 6 ++-- src/mesa/tnl/t_draw.c | 6 ++-- src/mesa/tnl/t_vb_light.c | 5 +--- src/mesa/tnl/t_vb_lighttmp.h | 20 ++++++------- src/mesa/tnl/t_vb_program.c | 8 ++--- src/mesa/tnl/t_vertex_generic.c | 34 +++++++++++----------- src/mesa/tnl_dd/t_dd_dmatmp.h | 4 +-- src/mesa/tnl_dd/t_dd_tritmp.h | 34 +++++++++++----------- src/mesa/tnl_dd/t_dd_vb.c | 30 +++++++++---------- src/mesa/tnl_dd/t_dd_vbtmp.h | 18 ++++++------ src/mesa/x86/gen_matypes.c | 4 +-- 30 files changed, 189 insertions(+), 194 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/ffb/ffb_vbtmp.h b/src/mesa/drivers/dri/ffb/ffb_vbtmp.h index 0495d0e276..c548ef3ad5 100644 --- a/src/mesa/drivers/dri/ffb/ffb_vbtmp.h +++ b/src/mesa/drivers/dri/ffb/ffb_vbtmp.h @@ -38,11 +38,11 @@ static void TAG(emit)(GLcontext *ctx, GLuint start, GLuint end) #endif #if (IND & (FFB_VB_RGBA_BIT)) - col0 = VB->ColorPtr[0]->data; - col0_stride = VB->ColorPtr[0]->stride; + col0 = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data; + col0_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride; #if (IND & (FFB_VB_TWOSIDE_BIT)) - col1 = VB->ColorPtr[1]->data; - col1_stride = VB->ColorPtr[1]->stride; + col1 = VB->BackfaceColorPtr->data; + col1_stride = VB->BackfaceColorPtr->stride; #endif #endif diff --git a/src/mesa/drivers/dri/gamma/gamma_render.c b/src/mesa/drivers/dri/gamma/gamma_render.c index 741936488a..a03a93d132 100644 --- a/src/mesa/drivers/dri/gamma/gamma_render.c +++ b/src/mesa/drivers/dri/gamma/gamma_render.c @@ -53,8 +53,8 @@ static void gamma_emit( GLcontext *ctx, GLuint start, GLuint end) GLfloat (*tc0)[4] = 0; GLuint tc0_size = 0; - col = VB->ColorPtr[0]->data; - col_stride = VB->ColorPtr[0]->stride; + col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data; + col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride; if (ctx->Texture.Unit[0]._ReallyEnabled) { tc0_stride = VB->AttribPtr[_TNL_ATTRIB_TEX0]->stride; diff --git a/src/mesa/drivers/dri/mach64/mach64_native_vb.c b/src/mesa/drivers/dri/mach64/mach64_native_vb.c index 99f1a14e17..816682ec5f 100644 --- a/src/mesa/drivers/dri/mach64/mach64_native_vb.c +++ b/src/mesa/drivers/dri/mach64/mach64_native_vb.c @@ -207,19 +207,19 @@ INTERP_QUALIFIER void TAG(interp_extras)( GLcontext *ctx, LOCALVARS struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - if (VB->ColorPtr[1]) { - assert(VB->ColorPtr[1]->stride == 4 * sizeof(GLfloat)); + if (VB->BackfaceColorPtr) { + assert(VB->BackfaceColorPtr->stride == 4 * sizeof(GLfloat)); INTERP_4F( t, - GET_COLOR(VB->ColorPtr[1], dst), - GET_COLOR(VB->ColorPtr[1], out), - GET_COLOR(VB->ColorPtr[1], in) ); + GET_COLOR(VB->BackfaceColorPtr, dst), + GET_COLOR(VB->BackfaceColorPtr, out), + GET_COLOR(VB->BackfaceColorPtr, in) ); - if (VB->SecondaryColorPtr[1]) { + if (VB->BackfaceSecondaryColorPtr) { INTERP_3F( t, - GET_COLOR(VB->SecondaryColorPtr[1], dst), - GET_COLOR(VB->SecondaryColorPtr[1], out), - GET_COLOR(VB->SecondaryColorPtr[1], in) ); + GET_COLOR(VB->BackfaceSecondaryColorPtr, dst), + GET_COLOR(VB->BackfaceSecondaryColorPtr, out), + GET_COLOR(VB->BackfaceSecondaryColorPtr, in) ); } } @@ -236,13 +236,13 @@ INTERP_QUALIFIER void TAG(copy_pv_extras)( GLcontext *ctx, LOCALVARS struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - if (VB->ColorPtr[1]) { - COPY_4FV( GET_COLOR(VB->ColorPtr[1], dst), - GET_COLOR(VB->ColorPtr[1], src) ); + if (VB->BackfaceColorPtr) { + COPY_4FV( GET_COLOR(VB->BackfaceColorPtr, dst), + GET_COLOR(VB->BackfaceColorPtr, src) ); - if (VB->SecondaryColorPtr[1]) { - COPY_4FV( GET_COLOR(VB->SecondaryColorPtr[1], dst), - GET_COLOR(VB->SecondaryColorPtr[1], src) ); + if (VB->BackfaceSecondaryColorPtr) { + COPY_4FV( GET_COLOR(VB->BackfaceSecondaryColorPtr, dst), + GET_COLOR(VB->BackfaceSecondaryColorPtr, src) ); } } diff --git a/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h b/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h index 1a93e5f034..2af84fa9b6 100644 --- a/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h +++ b/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h @@ -123,9 +123,9 @@ static void TAG(emit)( GLcontext *ctx, #endif #if DO_SPEC - if (VB->SecondaryColorPtr[0]) { - spec = VB->SecondaryColorPtr[0]->data; - spec_stride = VB->SecondaryColorPtr[0]->stride; + if (VB->AttribPtr[_TNL_ATTRIB_COLOR1]) { + spec = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->data; + spec_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->stride; } else { spec = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; spec_stride = 0; @@ -144,8 +144,8 @@ static void TAG(emit)( GLcontext *ctx, #endif #if DO_RGBA - col = VB->ColorPtr[0]->data; - col_stride = VB->ColorPtr[0]->stride; + col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data; + col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride; #endif coord = VB->NdcPtr->data; diff --git a/src/mesa/drivers/dri/mach64/mach64_vbtmp.h b/src/mesa/drivers/dri/mach64/mach64_vbtmp.h index eb94e6e398..636b7de80f 100644 --- a/src/mesa/drivers/dri/mach64/mach64_vbtmp.h +++ b/src/mesa/drivers/dri/mach64/mach64_vbtmp.h @@ -187,13 +187,13 @@ static void TAG(emit)( GLcontext *ctx, } if (DO_RGBA) { - col = VB->ColorPtr[0]->data; - col_stride = VB->ColorPtr[0]->stride; + col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data; + col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride; } if (DO_SPEC) { - spec = VB->SecondaryColorPtr[0]->data; - spec_stride = VB->SecondaryColorPtr[0]->stride; + spec = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->data; + spec_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->stride; } else { spec = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; spec_stride = 0; @@ -384,8 +384,8 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, ASSERT(stride == 4); - col = VB->ColorPtr[0]->data; - col_stride = VB->ColorPtr[0]->stride; + col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data; + col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride; /* Pack what's left into a 4-dword vertex. Color is in a different * place, and there is no 'w' coordinate. @@ -432,8 +432,8 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, GLfloat *v = (GLfloat *)dest; int i; - col = VB->ColorPtr[0]->data; - col_stride = VB->ColorPtr[0]->stride; + col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data; + col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride; if (start) STRIDE_4F(col, col_stride * start); diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index 677c504b90..99bd22edac 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -124,7 +124,7 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_ } if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) { - VB->AttribPtr[VERT_ATTRIB_GENERIC0] = VB->ColorPtr[1]; + VB->AttribPtr[VERT_ATTRIB_GENERIC0] = VB->BackfaceColorPtr; OutputsWritten |= 1 << VERT_RESULT_BFC0; #if MESA_LITTLE_ENDIAN EMIT_ATTR( _TNL_ATTRIB_GENERIC0, EMIT_4UB_4F_RGBA ); @@ -134,7 +134,7 @@ void r300ChooseSwtclVertexFormat(GLcontext *ctx, GLuint *_InputsRead, GLuint *_ ADD_ATTR(VERT_ATTRIB_GENERIC0, R300_DATA_TYPE_BYTE, SWTCL_OVM_COLOR2, SWIZZLE_XYZW, MASK_XYZW, 1); #endif if (fp_reads & FRAG_BIT_COL1) { - VB->AttribPtr[VERT_ATTRIB_GENERIC1] = VB->SecondaryColorPtr[1]; + VB->AttribPtr[VERT_ATTRIB_GENERIC1] = VB->BackfaceSecondaryColorPtr; GLuint swiz = MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_Y, SWIZZLE_Z, SWIZZLE_ONE); OutputsWritten |= 1 << VERT_RESULT_BFC1; #if MESA_LITTLE_ENDIAN diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c index 74b66900c9..8b51af81a6 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c @@ -227,9 +227,9 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs ) if (inputs & VERT_BIT_COLOR0) { int emitsize; - if (VB->ColorPtr[0]->size == 4 && - (VB->ColorPtr[0]->stride != 0 || - VB->ColorPtr[0]->data[0][3] != 1.0)) { + if (VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size == 4 && + (VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride != 0 || + VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data[0][3] != 1.0)) { vfmt |= RADEON_CP_VC_FRMT_FPCOLOR | RADEON_CP_VC_FRMT_FPALPHA; emitsize = 4; } @@ -242,9 +242,9 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs ) if (!rmesa->tcl.rgba.buf) rcommon_emit_vector( ctx, &(rmesa->tcl.aos[nr]), - (char *)VB->ColorPtr[0]->data, + (char *)VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data, emitsize, - VB->ColorPtr[0]->stride, + VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride, count); nr++; @@ -256,9 +256,9 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs ) rcommon_emit_vector( ctx, &(rmesa->tcl.aos[nr]), - (char *)VB->SecondaryColorPtr[0]->data, + (char *)VB->AttribPtr[_TNL_ATTRIB_COLOR1]->data, 3, - VB->SecondaryColorPtr[0]->stride, + VB->AttribPtr[_TNL_ATTRIB_COLOR1]->stride, count); } diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h index efb06db80e..aa53e98fc8 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h +++ b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h @@ -122,9 +122,9 @@ static void TAG(emit)( GLcontext *ctx, } if (DO_RGBA) { - if (VB->ColorPtr[0]) { - col = VB->ColorPtr[0]->data; - col_stride = VB->ColorPtr[0]->stride; + if (VB->AttribPtr[_TNL_ATTRIB_COLOR0]) { + col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data; + col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride; } else { col = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR0]; col_stride = 0; @@ -132,9 +132,9 @@ static void TAG(emit)( GLcontext *ctx, } if (DO_SPEC_OR_FOG) { - if (VB->SecondaryColorPtr[0]) { - spec = VB->SecondaryColorPtr[0]->data; - spec_stride = VB->SecondaryColorPtr[0]->stride; + if (VB->AttribPtr[_TNL_ATTRIB_COLOR1]) { + spec = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->data; + spec_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->stride; } else { spec = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; spec_stride = 0; diff --git a/src/mesa/drivers/dri/tdfx/tdfx_vb.c b/src/mesa/drivers/dri/tdfx/tdfx_vb.c index 4928802232..c200ba3255 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_vb.c +++ b/src/mesa/drivers/dri/tdfx/tdfx_vb.c @@ -69,11 +69,11 @@ static void interp_extras( GLcontext *ctx, /*fprintf(stderr, "%s\n", __FUNCTION__);*/ - if (VB->ColorPtr[1]) { + if (VB->BackfaceColorPtr) { INTERP_4F( t, - GET_COLOR(VB->ColorPtr[1], dst), - GET_COLOR(VB->ColorPtr[1], out), - GET_COLOR(VB->ColorPtr[1], in) ); + GET_COLOR(VB->BackfaceColorPtr, dst), + GET_COLOR(VB->BackfaceColorPtr, out), + GET_COLOR(VB->BackfaceColorPtr, in) ); } if (VB->EdgeFlag) { @@ -88,9 +88,9 @@ static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - if (VB->ColorPtr[1]) { - COPY_4FV( GET_COLOR(VB->ColorPtr[1], dst), - GET_COLOR(VB->ColorPtr[1], src) ); + if (VB->BackfaceColorPtr) { + COPY_4FV( GET_COLOR(VB->BackfaceColorPtr, dst), + GET_COLOR(VB->BackfaceColorPtr, src) ); } setup_tab[TDFX_CONTEXT(ctx)->SetupIndex].copy_pv(ctx, dst, src); diff --git a/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h b/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h index 809d5d7dd9..07e6e9a6a7 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h @@ -76,9 +76,9 @@ static void TAG(emit)( GLcontext *ctx, } if (IND & TDFX_RGBA_BIT) { - col = VB->ColorPtr[0]->data; - col_stride = VB->ColorPtr[0]->stride; - col_size = VB->ColorPtr[0]->size; + col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data; + col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride; + col_size = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size; } if (IND & TDFX_FOGC_BIT) { diff --git a/src/mesa/drivers/glide/fxvb.c b/src/mesa/drivers/glide/fxvb.c index 1dc5f9891a..cc9ad0e8b8 100644 --- a/src/mesa/drivers/glide/fxvb.c +++ b/src/mesa/drivers/glide/fxvb.c @@ -104,24 +104,24 @@ static void interp_extras( GLcontext *ctx, { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - if (VB->ColorPtr[1]) { - /* If stride is zero, ColorPtr[1] is constant across the VB, so + if (VB->BackfaceColorPtr) { + /* If stride is zero, BackfaceColorPtr is constant across the VB, so * there is no point interpolating between two values as they will * be identical. This case is handled in t_dd_tritmp.h */ - if (VB->ColorPtr[1]->stride) { - assert(VB->ColorPtr[1]->stride == 4 * sizeof(GLfloat)); + if (VB->BackfaceColorPtr->stride) { + assert(VB->BackfaceColorPtr->stride == 4 * sizeof(GLfloat)); INTERP_4F( t, - GET_COLOR(VB->ColorPtr[1], dst), - GET_COLOR(VB->ColorPtr[1], out), - GET_COLOR(VB->ColorPtr[1], in) ); + GET_COLOR(VB->BackfaceColorPtr, dst), + GET_COLOR(VB->BackfaceColorPtr, out), + GET_COLOR(VB->BackfaceColorPtr, in) ); } - if (VB->SecondaryColorPtr[1]) { + if (VB->BackfaceSecondaryColorPtr) { INTERP_3F( t, - GET_COLOR(VB->SecondaryColorPtr[1], dst), - GET_COLOR(VB->SecondaryColorPtr[1], out), - GET_COLOR(VB->SecondaryColorPtr[1], in) ); + GET_COLOR(VB->BackfaceSecondaryColorPtr, dst), + GET_COLOR(VB->BackfaceSecondaryColorPtr, out), + GET_COLOR(VB->BackfaceSecondaryColorPtr, in) ); } } @@ -137,13 +137,13 @@ static void copy_pv_extras( GLcontext *ctx, GLuint dst, GLuint src ) { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - if (VB->ColorPtr[1]) { - COPY_4FV( GET_COLOR(VB->ColorPtr[1], dst), - GET_COLOR(VB->ColorPtr[1], src) ); + if (VB->BackfaceColorPtr) { + COPY_4FV( GET_COLOR(VB->BackfaceColorPtr, dst), + GET_COLOR(VB->BackfaceColorPtr, src) ); - if (VB->SecondaryColorPtr[1]) { - COPY_3FV( GET_COLOR(VB->SecondaryColorPtr[1], dst), - GET_COLOR(VB->SecondaryColorPtr[1], src) ); + if (VB->BackfaceSecondaryColorPtr) { + COPY_3FV( GET_COLOR(VB->BackfaceSecondaryColorPtr, dst), + GET_COLOR(VB->BackfaceSecondaryColorPtr, src) ); } } diff --git a/src/mesa/drivers/glide/fxvbtmp.h b/src/mesa/drivers/glide/fxvbtmp.h index 674d9c6799..742f500863 100644 --- a/src/mesa/drivers/glide/fxvbtmp.h +++ b/src/mesa/drivers/glide/fxvbtmp.h @@ -80,14 +80,14 @@ static void TAG(emit)( GLcontext *ctx, } if (IND & SETUP_RGBA) { - col = VB->ColorPtr[0]->data; - col_stride = VB->ColorPtr[0]->stride; - col_size = VB->ColorPtr[0]->size; + col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data; + col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride; + col_size = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size; } if (IND & SETUP_SPEC) { - spec = VB->SecondaryColorPtr[0]->data; - spec_stride = VB->SecondaryColorPtr[0]->stride; + spec = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->data; + spec_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->stride; } if (IND & SETUP_FOGC) { diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c index 46e652dc73..0b373814fe 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_primitive_dx7.c @@ -189,9 +189,9 @@ GLfloat ex,ey,fx,fy,cc; \ /* Get vars for later */ \ VB = &TNL_CONTEXT(ctx)->vb; \ - vbcolor = (GLchan (*)[4])VB->ColorPtr[1]->data; \ - if (VB->SecondaryColorPtr[1]) { \ - vbspec = (GLchan (*)[4])VB->SecondaryColorPtr[1]->data; \ + vbcolor = (GLchan (*)[4])VB->BackfaceColorPtr->data; \ + if (VB->BackfaceSecondaryColorPtr) { \ + vbspec = (GLchan (*)[4])VB->BackfaceSecondaryColorPtr->data; \ } else { \ vbspec = NULL; \ } \ @@ -247,12 +247,12 @@ pV->Position.z = p4f[##v][2]; #define GLD_SETUP_SMOOTH_COLOUR_3D(v) \ - p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \ + p4f = (GLfloat (*)[4])VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data; \ pV->Diffuse = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]); #define GLD_SETUP_GET_FLAT_COLOUR_3D(v) \ - p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \ + p4f = (GLfloat (*)[4])VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data; \ dwColor = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]); #define GLD_SETUP_USE_FLAT_COLOUR_3D \ diff --git a/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c b/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c index a85620dde8..c39775cad3 100644 --- a/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c +++ b/src/mesa/drivers/windows/gldirect/dx7/gld_vb_d3d_render_dx7.c @@ -151,7 +151,7 @@ static GLboolean gld_d3d_render_stage_run( #if 0 // For debugging: Useful to see if an app passes colour data in // an unusual format. - switch (VB->ColorPtr[0]->Type) { + switch (VB->AttribPtr[_TNL_ATTRIB_COLOR0]->Type) { case GL_FLOAT: ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_FLOAT\n"); break; diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c index b95351553c..990922580a 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_primitive_dx8.c @@ -189,9 +189,9 @@ GLfloat ex,ey,fx,fy,cc; \ /* Get vars for later */ \ VB = &TNL_CONTEXT(ctx)->vb; \ - vbcolor = (GLchan (*)[4])VB->ColorPtr[1]->data; \ - if (VB->SecondaryColorPtr[1]) { \ - vbspec = (GLchan (*)[4])VB->SecondaryColorPtr[1]->data; \ + vbcolor = (GLchan (*)[4])VB->BackfaceColorPtr->data; \ + if (VB->BackfaceSecondaryColorPtr) { \ + vbspec = (GLchan (*)[4])VB->BackfaceSecondaryColorPtr->data; \ } else { \ vbspec = NULL; \ } \ @@ -247,12 +247,12 @@ pV->Position.z = p4f[##v][2]; #define GLD_SETUP_SMOOTH_COLOUR_3D(v) \ - p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \ + p4f = (GLfloat (*)[4])VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data; \ pV->Diffuse = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]); #define GLD_SETUP_GET_FLAT_COLOUR_3D(v) \ - p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \ + p4f = (GLfloat (*)[4])VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data; \ dwColor = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]); #define GLD_SETUP_USE_FLAT_COLOUR_3D \ diff --git a/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c b/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c index cafbf4f5c5..265c81fb4a 100644 --- a/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c +++ b/src/mesa/drivers/windows/gldirect/dx8/gld_vb_d3d_render_dx8.c @@ -149,7 +149,7 @@ static GLboolean gld_d3d_render_stage_run( #if 0 // For debugging: Useful to see if an app passes colour data in // an unusual format. - switch (VB->ColorPtr[0]->Type) { + switch (VB->AttribPtr[_TNL_ATTRIB_COLOR0]->Type) { case GL_FLOAT: ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_FLOAT\n"); break; diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c index 1b84cdee28..fd4dd4ed75 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_primitive_dx9.c @@ -189,9 +189,9 @@ GLfloat ex,ey,fx,fy,cc; \ /* Get vars for later */ \ VB = &TNL_CONTEXT(ctx)->vb; \ - vbcolor = (GLchan (*)[4])VB->ColorPtr[1]->data; \ - if (VB->SecondaryColorPtr[1]) { \ - vbspec = (GLchan (*)[4])VB->SecondaryColorPtr[1]->data; \ + vbcolor = (GLchan (*)[4])VB->BackfaceColorPtr->data; \ + if (VB->BackfaceSecondaryColorPtr) { \ + vbspec = (GLchan (*)[4])VB->BackfaceSecondaryColorPtr->data; \ } else { \ vbspec = NULL; \ } \ @@ -247,12 +247,12 @@ pV->Position.z = p4f[##v][2]; #define GLD_SETUP_SMOOTH_COLOUR_3D(v) \ - p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \ + p4f = (GLfloat (*)[4])VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data; \ pV->Diffuse = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]); #define GLD_SETUP_GET_FLAT_COLOUR_3D(v) \ - p4f = (GLfloat (*)[4])VB->ColorPtr[0]->data; \ + p4f = (GLfloat (*)[4])VB->AttribPtr[_TNL_ATTRIB_COLOR00]->data; \ dwColor = D3DCOLOR_COLORVALUE(p4f[##v][0], p4f[##v][1], p4f[##v][2], p4f[##v][3]); #define GLD_SETUP_USE_FLAT_COLOUR_3D \ diff --git a/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c b/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c index 4fa6bcaf1a..91a68b3f2d 100644 --- a/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c +++ b/src/mesa/drivers/windows/gldirect/dx9/gld_vb_d3d_render_dx9.c @@ -149,7 +149,7 @@ static GLboolean gld_d3d_render_stage_run( #if 0 // For debugging: Useful to see if an app passes colour data in // an unusual format. - switch (VB->ColorPtr[0]->Type) { + switch (VB->AttribPtr[_TNL_ATTRIB_COLOR0]->Type) { case GL_FLOAT: ddlogMessage(GLDLOG_SYSTEM, "ColorPtr: GL_FLOAT\n"); break; diff --git a/src/mesa/swrast_setup/ss_tritmp.h b/src/mesa/swrast_setup/ss_tritmp.h index 9700cf8c54..17f3863956 100644 --- a/src/mesa/swrast_setup/ss_tritmp.h +++ b/src/mesa/swrast_setup/ss_tritmp.h @@ -67,8 +67,8 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) if (facing == 1) { if (IND & SS_TWOSIDE_BIT) { if (IND & SS_RGBA_BIT) { - if (VB->ColorPtr[1]) { - GLfloat (*vbcolor)[4] = VB->ColorPtr[1]->data; + if (VB->BackfaceColorPtr) { + GLfloat (*vbcolor)[4] = VB->BackfaceColorPtr->data; if (swsetup->intColors) { COPY_CHAN4(saved_color[0], v[0]->color); @@ -81,7 +81,7 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) COPY_4V(saved_col0[2], v[2]->attrib[FRAG_ATTRIB_COL0]); } - if (VB->ColorPtr[1]->stride) { + if (VB->BackfaceColorPtr->stride) { if (swsetup->intColors) { SS_COLOR(v[0]->color, vbcolor[e0]); SS_COLOR(v[1]->color, vbcolor[e1]); @@ -108,14 +108,14 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) } } - if (VB->SecondaryColorPtr[1]) { - GLfloat (*vbspec)[4] = VB->SecondaryColorPtr[1]->data; + if (VB->BackfaceSecondaryColorPtr) { + GLfloat (*vbspec)[4] = VB->BackfaceSecondaryColorPtr->data; COPY_4V(saved_spec[0], v[0]->attrib[FRAG_ATTRIB_COL1]); COPY_4V(saved_spec[1], v[1]->attrib[FRAG_ATTRIB_COL1]); COPY_4V(saved_spec[2], v[2]->attrib[FRAG_ATTRIB_COL1]); - if (VB->SecondaryColorPtr[1]->stride) { + if (VB->BackfaceSecondaryColorPtr->stride) { SS_SPEC(v[0]->attrib[FRAG_ATTRIB_COL1], vbspec[e0]); SS_SPEC(v[1]->attrib[FRAG_ATTRIB_COL1], vbspec[e1]); SS_SPEC(v[2]->attrib[FRAG_ATTRIB_COL1], vbspec[e2]); @@ -200,7 +200,7 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) if (IND & SS_TWOSIDE_BIT) { if (facing == 1) { if (IND & SS_RGBA_BIT) { - if (VB->ColorPtr[1]) { + if (VB->BackfaceColorPtr) { if (swsetup->intColors) { COPY_CHAN4(v[0]->color, saved_color[0]); COPY_CHAN4(v[1]->color, saved_color[1]); @@ -213,7 +213,7 @@ static void TAG(triangle)(GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) } } - if (VB->SecondaryColorPtr[1]) { + if (VB->BackfaceSecondaryColorPtr) { COPY_4V(v[0]->attrib[FRAG_ATTRIB_COL1], saved_spec[0]); COPY_4V(v[1]->attrib[FRAG_ATTRIB_COL1], saved_spec[1]); COPY_4V(v[2]->attrib[FRAG_ATTRIB_COL1], saved_spec[2]); diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index b41cf93897..09ff8f8252 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -214,9 +214,9 @@ struct vertex_buffer GLubyte *ClipMask; /* _TNL_BIT_POS */ GLfloat *NormalLengthPtr; /* _TNL_BIT_NORMAL */ GLboolean *EdgeFlag; /* _TNL_BIT_EDGEFLAG */ - GLvector4f *BackfaceIndexPtr; /* _TNL_BIT_INDEX */ - GLvector4f *ColorPtr[2]; /* _TNL_BIT_COLOR0 */ - GLvector4f *SecondaryColorPtr[2]; /* _TNL_BIT_COLOR1 */ + GLvector4f *BackfaceIndexPtr; + GLvector4f *BackfaceColorPtr; + GLvector4f *BackfaceSecondaryColorPtr; GLvector4f *FogCoordPtr; /* _TNL_BIT_FOG */ const struct _mesa_prim *Primitive; diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c index 8092627645..0862fdfa85 100644 --- a/src/mesa/tnl/t_draw.c +++ b/src/mesa/tnl/t_draw.c @@ -254,11 +254,9 @@ static void bind_inputs( GLcontext *ctx, /* Legacy pointers -- remove one day. */ - VB->ColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR0]; - VB->ColorPtr[1] = NULL; + VB->BackfaceColorPtr = NULL; VB->BackfaceIndexPtr = NULL; - VB->SecondaryColorPtr[0] = VB->AttribPtr[_TNL_ATTRIB_COLOR1]; - VB->SecondaryColorPtr[1] = NULL; + VB->BackfaceSecondaryColorPtr = NULL; VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG]; /* Clipping and drawing code still requires this to be a packed diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c index e72a807f0d..8a0fe63fd8 100644 --- a/src/mesa/tnl/t_vb_light.c +++ b/src/mesa/tnl/t_vb_light.c @@ -127,7 +127,7 @@ prepare_materials(GLcontext *ctx, const GLuint bitmask = ctx->Light.ColorMaterialBitmask; for (i = 0 ; i < MAT_ATTRIB_MAX ; i++) if (bitmask & (1<AttribPtr[_TNL_ATTRIB_MAT_FRONT_AMBIENT + i] = VB->ColorPtr[0]; + VB->AttribPtr[_TNL_ATTRIB_MAT_FRONT_AMBIENT + i] = VB->AttribPtr[_TNL_ATTRIB_COLOR0]; } /* Now, for each material attribute that's tracking vertex color, save @@ -246,9 +246,6 @@ static GLboolean run_lighting( GLcontext *ctx, */ store->light_func_tab[idx]( ctx, VB, stage, input ); - VB->AttribPtr[_TNL_ATTRIB_COLOR0] = VB->ColorPtr[0]; - VB->AttribPtr[_TNL_ATTRIB_COLOR1] = VB->SecondaryColorPtr[0]; - return GL_TRUE; } diff --git a/src/mesa/tnl/t_vb_lighttmp.h b/src/mesa/tnl/t_vb_lighttmp.h index dd117e435c..4ebef2356f 100644 --- a/src/mesa/tnl/t_vb_lighttmp.h +++ b/src/mesa/tnl/t_vb_lighttmp.h @@ -72,13 +72,13 @@ static void TAG(light_rgba_spec)( GLcontext *ctx, fprintf(stderr, "%s\n", __FUNCTION__ ); #endif - VB->ColorPtr[0] = &store->LitColor[0]; - VB->SecondaryColorPtr[0] = &store->LitSecondary[0]; + VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->LitColor[0]; + VB->AttribPtr[_TNL_ATTRIB_COLOR1] = &store->LitSecondary[0]; sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; #if IDX & LIGHT_TWOSIDE - VB->ColorPtr[1] = &store->LitColor[1]; - VB->SecondaryColorPtr[1] = &store->LitSecondary[1]; + VB->BackfaceColorPtr = &store->LitColor[1]; + VB->BackfaceSecondaryColorPtr = &store->LitSecondary[1]; sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; #endif @@ -259,11 +259,11 @@ static void TAG(light_rgba)( GLcontext *ctx, fprintf(stderr, "%s\n", __FUNCTION__ ); #endif - VB->ColorPtr[0] = &store->LitColor[0]; + VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->LitColor[0]; sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; #if IDX & LIGHT_TWOSIDE - VB->ColorPtr[1] = &store->LitColor[1]; + VB->BackfaceColorPtr = &store->LitColor[1]; sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; #endif @@ -449,9 +449,9 @@ static void TAG(light_fast_rgba_single)( GLcontext *ctx, (void) input; /* doesn't refer to Eye or Obj */ - VB->ColorPtr[0] = &store->LitColor[0]; + VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->LitColor[0]; #if IDX & LIGHT_TWOSIDE - VB->ColorPtr[1] = &store->LitColor[1]; + VB->BackfaceColorPtr = &store->LitColor[1]; #endif if (nr > 1) { @@ -559,9 +559,9 @@ static void TAG(light_fast_rgba)( GLcontext *ctx, sumA[0] = ctx->Light.Material.Attrib[MAT_ATTRIB_FRONT_DIFFUSE][3]; sumA[1] = ctx->Light.Material.Attrib[MAT_ATTRIB_BACK_DIFFUSE][3]; - VB->ColorPtr[0] = &store->LitColor[0]; + VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->LitColor[0]; #if IDX & LIGHT_TWOSIDE - VB->ColorPtr[1] = &store->LitColor[1]; + VB->BackfaceColorPtr = &store->LitColor[1]; #endif if (nr > 1) { diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c index d76b0a6b9d..7002f74a00 100644 --- a/src/mesa/tnl/t_vb_program.c +++ b/src/mesa/tnl/t_vb_program.c @@ -454,10 +454,10 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage ) VB->ClipPtr->count = VB->Count; } - VB->ColorPtr[0] = &store->results[VERT_RESULT_COL0]; - VB->ColorPtr[1] = &store->results[VERT_RESULT_BFC0]; - VB->SecondaryColorPtr[0] = &store->results[VERT_RESULT_COL1]; - VB->SecondaryColorPtr[1] = &store->results[VERT_RESULT_BFC1]; + VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->results[VERT_RESULT_COL0]; + VB->BackfaceColorPtr = &store->results[VERT_RESULT_BFC0]; + VB->AttribPtr[_TNL_ATTRIB_COLOR1] = &store->results[VERT_RESULT_COL1]; + VB->BackfaceSecondaryColorPtr = &store->results[VERT_RESULT_BFC1]; VB->FogCoordPtr = &store->results[VERT_RESULT_FOGC]; VB->AttribPtr[VERT_ATTRIB_COLOR0] = &store->results[VERT_RESULT_COL0]; diff --git a/src/mesa/tnl/t_vertex_generic.c b/src/mesa/tnl/t_vertex_generic.c index f97ad7c2ed..fa34d11d7b 100644 --- a/src/mesa/tnl/t_vertex_generic.c +++ b/src/mesa/tnl/t_vertex_generic.c @@ -1092,27 +1092,27 @@ void _tnl_generic_interp_extras( GLcontext *ctx, { struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - /* If stride is zero, ColorPtr[1] is constant across the VB, so + /* If stride is zero, BackfaceColorPtr is constant across the VB, so * there is no point interpolating between two values as they will * be identical. In all other cases, this value is generated by * t_vb_lighttmp.h and has a stride of 4 dwords. */ - if (VB->ColorPtr[1] && VB->ColorPtr[1]->stride) { - assert(VB->ColorPtr[1]->stride == 4 * sizeof(GLfloat)); + if (VB->BackfaceColorPtr && VB->BackfaceColorPtr->stride) { + assert(VB->BackfaceColorPtr->stride == 4 * sizeof(GLfloat)); INTERP_4F( t, - VB->ColorPtr[1]->data[dst], - VB->ColorPtr[1]->data[out], - VB->ColorPtr[1]->data[in] ); + VB->BackfaceColorPtr->data[dst], + VB->BackfaceColorPtr->data[out], + VB->BackfaceColorPtr->data[in] ); } - if (VB->SecondaryColorPtr[1]) { - assert(VB->SecondaryColorPtr[1]->stride == 4 * sizeof(GLfloat)); + if (VB->BackfaceSecondaryColorPtr) { + assert(VB->BackfaceSecondaryColorPtr->stride == 4 * sizeof(GLfloat)); INTERP_3F( t, - VB->SecondaryColorPtr[1]->data[dst], - VB->SecondaryColorPtr[1]->data[out], - VB->SecondaryColorPtr[1]->data[in] ); + VB->BackfaceSecondaryColorPtr->data[dst], + VB->BackfaceSecondaryColorPtr->data[out], + VB->BackfaceSecondaryColorPtr->data[in] ); } if (VB->BackfaceIndexPtr) { @@ -1135,14 +1135,14 @@ void _tnl_generic_copy_pv_extras( GLcontext *ctx, /* See above comment: */ - if (VB->ColorPtr[1] && VB->ColorPtr[1]->stride) { - COPY_4FV( VB->ColorPtr[1]->data[dst], - VB->ColorPtr[1]->data[src] ); + if (VB->BackfaceColorPtr && VB->BackfaceColorPtr->stride) { + COPY_4FV( VB->BackfaceColorPtr->data[dst], + VB->BackfaceColorPtr->data[src] ); } - if (VB->SecondaryColorPtr[1]) { - COPY_4FV( VB->SecondaryColorPtr[1]->data[dst], - VB->SecondaryColorPtr[1]->data[src] ); + if (VB->BackfaceSecondaryColorPtr) { + COPY_4FV( VB->BackfaceSecondaryColorPtr->data[dst], + VB->BackfaceSecondaryColorPtr->data[src] ); } if (VB->BackfaceIndexPtr) { diff --git a/src/mesa/tnl_dd/t_dd_dmatmp.h b/src/mesa/tnl_dd/t_dd_dmatmp.h index e4b535fb68..e5885782c7 100644 --- a/src/mesa/tnl_dd/t_dd_dmatmp.h +++ b/src/mesa/tnl_dd/t_dd_dmatmp.h @@ -443,7 +443,7 @@ static void TAG(render_quad_strip_verts)( GLcontext *ctx, } else if (HAVE_TRI_STRIPS && ctx->Light.ShadeModel == GL_FLAT && - TNL_CONTEXT(ctx)->vb.ColorPtr[0]->stride) { + TNL_CONTEXT(ctx)->vb.AttribPtr[_TNL_ATTRIB_COLOR0]->stride) { if (HAVE_ELTS) { LOCAL_VARS; int dmasz = GET_SUBSEQUENT_VB_MAX_ELTS(); @@ -1221,7 +1221,7 @@ static GLboolean TAG(validate_render)( GLcontext *ctx, ok = GL_TRUE; } else if (HAVE_TRI_STRIPS && ctx->Light.ShadeModel == GL_FLAT && - VB->ColorPtr[0]->stride != 0) { + VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride != 0) { if (HAVE_ELTS) { ok = (GLint) count < GET_SUBSEQUENT_VB_MAX_ELTS(); } diff --git a/src/mesa/tnl_dd/t_dd_tritmp.h b/src/mesa/tnl_dd/t_dd_tritmp.h index 0e3bc1329d..8574fe618b 100644 --- a/src/mesa/tnl_dd/t_dd_tritmp.h +++ b/src/mesa/tnl_dd/t_dd_tritmp.h @@ -195,7 +195,7 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) } } else { - GLfloat (*vbcolor)[4] = VB->ColorPtr[1]->data; + GLfloat (*vbcolor)[4] = VB->BackfaceColorPtr->data; (void) vbcolor; if (!DO_FLAT) { @@ -204,8 +204,8 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) } VERT_SAVE_RGBA( 2 ); - if (VB->ColorPtr[1]->stride) { - ASSERT(VB->ColorPtr[1]->stride == 4*sizeof(GLfloat)); + if (VB->BackfaceColorPtr->stride) { + ASSERT(VB->BackfaceColorPtr->stride == 4*sizeof(GLfloat)); if (!DO_FLAT) { VERT_SET_RGBA( v[0], vbcolor[e0] ); @@ -221,9 +221,9 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) VERT_SET_RGBA( v[2], vbcolor[0] ); } - if (HAVE_SPEC && VB->SecondaryColorPtr[1]) { - GLfloat (*vbspec)[4] = VB->SecondaryColorPtr[1]->data; - ASSERT(VB->SecondaryColorPtr[1]->stride == 4*sizeof(GLfloat)); + if (HAVE_SPEC && VB->BackfaceSecondaryColorPtr) { + GLfloat (*vbspec)[4] = VB->BackfaceSecondaryColorPtr->data; + ASSERT(VB->BackfaceSecondaryColorPtr->stride == 4*sizeof(GLfloat)); if (!DO_FLAT) { VERT_SAVE_SPEC( 0 ); @@ -279,7 +279,7 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) VERT_SAVE_RGBA( 1 ); VERT_COPY_RGBA( v[0], v[2] ); VERT_COPY_RGBA( v[1], v[2] ); - if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { + if (HAVE_SPEC && VB->AttribPtr[_TNL_ATTRIB_COLOR1]) { VERT_SAVE_SPEC( 0 ); VERT_SAVE_SPEC( 1 ); VERT_COPY_SPEC( v[0], v[2] ); @@ -374,7 +374,7 @@ static void TAG(triangle)( GLcontext *ctx, GLuint e0, GLuint e1, GLuint e2 ) if (HAVE_RGBA) { VERT_RESTORE_RGBA( 0 ); VERT_RESTORE_RGBA( 1 ); - if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { + if (HAVE_SPEC && VB->AttribPtr[_TNL_ATTRIB_COLOR1]) { VERT_RESTORE_SPEC( 0 ); VERT_RESTORE_SPEC( 1 ); } @@ -436,7 +436,7 @@ static void TAG(quadr)( GLcontext *ctx, if (DO_TWOSIDE && facing == 1) { if (HAVE_RGBA) { - GLfloat (*vbcolor)[4] = VB->ColorPtr[1]->data; + GLfloat (*vbcolor)[4] = VB->BackfaceColorPtr->data; (void)vbcolor; if (HAVE_BACK_COLORS) { @@ -471,7 +471,7 @@ static void TAG(quadr)( GLcontext *ctx, } VERT_SAVE_RGBA( 3 ); - if (VB->ColorPtr[1]->stride) { + if (VB->BackfaceColorPtr->stride) { if (!DO_FLAT) { VERT_SET_RGBA( v[0], vbcolor[e0] ); VERT_SET_RGBA( v[1], vbcolor[e1] ); @@ -488,9 +488,9 @@ static void TAG(quadr)( GLcontext *ctx, VERT_SET_RGBA( v[3], vbcolor[0] ); } - if (HAVE_SPEC && VB->SecondaryColorPtr[1]) { - GLfloat (*vbspec)[4] = VB->SecondaryColorPtr[1]->data; - ASSERT(VB->SecondaryColorPtr[1]->stride==4*sizeof(GLfloat)); + if (HAVE_SPEC && VB->BackfaceSecondaryColorPtr) { + GLfloat (*vbspec)[4] = VB->BackfaceSecondaryColorPtr->data; + ASSERT(VB->BackfaceSecondaryColorPtr->stride==4*sizeof(GLfloat)); if (!DO_FLAT) { VERT_SAVE_SPEC( 0 ); @@ -553,7 +553,7 @@ static void TAG(quadr)( GLcontext *ctx, VERT_COPY_RGBA( v[0], v[3] ); VERT_COPY_RGBA( v[1], v[3] ); VERT_COPY_RGBA( v[2], v[3] ); - if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { + if (HAVE_SPEC && VB->AttribPtr[_TNL_ATTRIB_COLOR1]) { VERT_SAVE_SPEC( 0 ); VERT_SAVE_SPEC( 1 ); VERT_SAVE_SPEC( 2 ); @@ -659,7 +659,7 @@ static void TAG(quadr)( GLcontext *ctx, VERT_RESTORE_RGBA( 0 ); VERT_RESTORE_RGBA( 1 ); VERT_RESTORE_RGBA( 2 ); - if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { + if (HAVE_SPEC && VB->AttribPtr[_TNL_ATTRIB_COLOR1]) { VERT_RESTORE_SPEC( 0 ); VERT_RESTORE_SPEC( 1 ); VERT_RESTORE_SPEC( 2 ); @@ -708,7 +708,7 @@ static void TAG(line)( GLcontext *ctx, GLuint e0, GLuint e1 ) if (HAVE_RGBA) { VERT_SAVE_RGBA( 0 ); VERT_COPY_RGBA( v[0], v[1] ); - if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { + if (HAVE_SPEC && VB->AttribPtr[_TNL_ATTRIB_COLOR1]) { VERT_SAVE_SPEC( 0 ); VERT_COPY_SPEC( v[0], v[1] ); } @@ -725,7 +725,7 @@ static void TAG(line)( GLcontext *ctx, GLuint e0, GLuint e1 ) if (HAVE_RGBA) { VERT_RESTORE_RGBA( 0 ); - if (HAVE_SPEC && VB->SecondaryColorPtr[0]) { + if (HAVE_SPEC && VB->AttribPtr[_TNL_ATTRIB_COLOR1]) { VERT_RESTORE_SPEC( 0 ); } } diff --git a/src/mesa/tnl_dd/t_dd_vb.c b/src/mesa/tnl_dd/t_dd_vb.c index b3937c29a0..a8a0a69768 100644 --- a/src/mesa/tnl_dd/t_dd_vb.c +++ b/src/mesa/tnl_dd/t_dd_vb.c @@ -297,19 +297,19 @@ INTERP_QUALIFIER void TAG(interp_extras)( GLcontext *ctx, LOCALVARS struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - if (VB->ColorPtr[1]) { - assert(VB->ColorPtr[1]->stride == 4 * sizeof(GLfloat)); + if (VB->BackfaceColorPtr) { + assert(VB->BackfaceColorPtr->stride == 4 * sizeof(GLfloat)); INTERP_4F( t, - GET_COLOR(VB->ColorPtr[1], dst), - GET_COLOR(VB->ColorPtr[1], out), - GET_COLOR(VB->ColorPtr[1], in) ); + GET_COLOR(VB->BackfaceColorPtr, dst), + GET_COLOR(VB->BackfaceColorPtr, out), + GET_COLOR(VB->BackfaceColorPtr, in) ); - if (VB->SecondaryColorPtr[1]) { + if (VB->BackfaceSecondaryColorPtr) { INTERP_3F( t, - GET_COLOR(VB->SecondaryColorPtr[1], dst), - GET_COLOR(VB->SecondaryColorPtr[1], out), - GET_COLOR(VB->SecondaryColorPtr[1], in) ); + GET_COLOR(VB->BackfaceSecondaryColorPtr, dst), + GET_COLOR(VB->BackfaceSecondaryColorPtr, out), + GET_COLOR(VB->BackfaceSecondaryColorPtr, in) ); } } @@ -326,13 +326,13 @@ INTERP_QUALIFIER void TAG(copy_pv_extras)( GLcontext *ctx, LOCALVARS struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; - if (VB->ColorPtr[1]) { - COPY_4FV( GET_COLOR(VB->ColorPtr[1], dst), - GET_COLOR(VB->ColorPtr[1], src) ); + if (VB->BackfaceColorPtr) { + COPY_4FV( GET_COLOR(VB->BackfaceColorPtr, dst), + GET_COLOR(VB->BackfaceColorPtr, src) ); - if (VB->SecondaryColorPtr[1]) { - COPY_4FV( GET_COLOR(VB->SecondaryColorPtr[1], dst), - GET_COLOR(VB->SecondaryColorPtr[1], src) ); + if (VB->BackfaceSecondaryColorPtr) { + COPY_4FV( GET_COLOR(VB->BackfaceSecondaryColorPtr, dst), + GET_COLOR(VB->BackfaceSecondaryColorPtr, src) ); } } diff --git a/src/mesa/tnl_dd/t_dd_vbtmp.h b/src/mesa/tnl_dd/t_dd_vbtmp.h index c1cc6ae1bf..a35218a158 100644 --- a/src/mesa/tnl_dd/t_dd_vbtmp.h +++ b/src/mesa/tnl_dd/t_dd_vbtmp.h @@ -184,15 +184,15 @@ static void TAG(emit)( GLcontext *ctx, } if (DO_RGBA) { - col_stride = VB->ColorPtr[0]->stride; - col = VB->ColorPtr[0]->data; - col_size = VB->ColorPtr[0]->size; + col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride; + col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data; + col_size = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size; } if (DO_SPEC) { - if (VB->SecondaryColorPtr[0]) { - spec_stride = VB->SecondaryColorPtr[0]->stride; - spec = VB->SecondaryColorPtr[0]->data; + if (VB->AttribPtr[_TNL_ATTRIB_COLOR1]) { + spec_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->stride; + spec = VB->AttribPtr[_TNL_ATTRIB_COLOR1]->data; } else { spec = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_COLOR1]; spec_stride = 0; @@ -356,9 +356,9 @@ static void TAG(emit)( GLcontext *ctx, GLuint start, GLuint end, ASSERT(stride == 4); - col = VB->ColorPtr[0]->data; - col_stride = VB->ColorPtr[0]->stride; - col_size = VB->ColorPtr[0]->size; + col = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->data; + col_stride = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->stride; + col_size = VB->AttribPtr[_TNL_ATTRIB_COLOR0]->size; /* fprintf(stderr, "%s(small) importable %x\n", */ /* __FUNCTION__, VB->importable_data); */ diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c index 5355c26874..ce91b75f3a 100644 --- a/src/mesa/x86/gen_matypes.c +++ b/src/mesa/x86/gen_matypes.c @@ -133,8 +133,8 @@ int main( int argc, char **argv ) OFFSET( "VB_TEX2_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX2] ); OFFSET( "VB_TEX3_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_TEX3] ); OFFSET( "VB_INDEX_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_COLOR_INDEX] ); - OFFSET( "VB_COLOR_PTR ", struct vertex_buffer, ColorPtr ); - OFFSET( "VB_SECONDARY_COLOR_PTR ", struct vertex_buffer, SecondaryColorPtr ); + OFFSET( "VB_COLOR_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_COLOR0] ); + OFFSET( "VB_SECONDARY_COLOR_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_COLOR1] ); OFFSET( "VB_FOG_COORD_PTR ", struct vertex_buffer, FogCoordPtr ); OFFSET( "VB_PRIMITIVE ", struct vertex_buffer, Primitive ); printf( "\n" ); -- cgit v1.2.3 From 37c79d4d765b10a79e0cf217cc1e70d3fbb7a0c5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Nov 2009 01:45:42 -0800 Subject: tnl: Replace deprecated FogCoordPtr with AttribPtr[_TNL_ATTRIB_FOG] --- src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h | 6 +++--- src/mesa/drivers/dri/mach64/mach64_vbtmp.h | 6 +++--- src/mesa/drivers/dri/radeon/radeon_maos_arrays.c | 4 ++-- src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h | 6 +++--- src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h | 4 ++-- src/mesa/drivers/glide/fxvbtmp.h | 4 ++-- src/mesa/tnl/t_context.h | 3 --- src/mesa/tnl/t_draw.c | 5 +---- src/mesa/tnl/t_vb_fog.c | 1 - src/mesa/tnl/t_vb_program.c | 8 ++------ src/mesa/tnl_dd/t_dd_vbtmp.h | 6 +++--- src/mesa/x86/gen_matypes.c | 2 +- 12 files changed, 22 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h b/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h index 2af84fa9b6..6e5fa3520e 100644 --- a/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h +++ b/src/mesa/drivers/dri/mach64/mach64_native_vbtmp.h @@ -133,9 +133,9 @@ static void TAG(emit)( GLcontext *ctx, #endif #if DO_FOG - if (VB->FogCoordPtr) { - fog = VB->FogCoordPtr->data; - fog_stride = VB->FogCoordPtr->stride; + if (VB->AttribPtr[_TNL_ATTRIB_FOG]) { + fog = VB->AttribPtr[_TNL_ATTRIB_FOG]->data; + fog_stride = VB->AttribPtr[_TNL_ATTRIB_FOG]->stride; } else { static GLfloat tmp[4] = {0, 0, 0, 0}; fog = &tmp; diff --git a/src/mesa/drivers/dri/mach64/mach64_vbtmp.h b/src/mesa/drivers/dri/mach64/mach64_vbtmp.h index 636b7de80f..60bfab8f6d 100644 --- a/src/mesa/drivers/dri/mach64/mach64_vbtmp.h +++ b/src/mesa/drivers/dri/mach64/mach64_vbtmp.h @@ -200,9 +200,9 @@ static void TAG(emit)( GLcontext *ctx, } if (DO_FOG) { - if (VB->FogCoordPtr) { - fog = VB->FogCoordPtr->data; - fog_stride = VB->FogCoordPtr->stride; + if (VB->AttribPtr[_TNL_ATTRIB_FOG]) { + fog = VB->AttribPtr[_TNL_ATTRIB_FOG]->data; + fog_stride = VB->AttribPtr[_TNL_ATTRIB_FOG]->stride; } else { static GLfloat tmp[4] = {0, 0, 0, 0}; fog = &tmp; diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c index 8b51af81a6..de18d2ddd6 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c @@ -273,8 +273,8 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs ) if (!rmesa->tcl.fog.buf) emit_vecfog( ctx, &(rmesa->tcl.aos[nr]), - (char *)VB->FogCoordPtr->data, - VB->FogCoordPtr->stride, + (char *)VB->AttribPtr[_TNL_ATTRIB_FOG]->data, + VB->AttribPtr[_TNL_ATTRIB_FOG]->stride, count); vfmt |= RADEON_CP_VC_FRMT_FPFOG; diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h index aa53e98fc8..d764ccb982 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h +++ b/src/mesa/drivers/dri/radeon/radeon_maos_vbtmp.h @@ -142,9 +142,9 @@ static void TAG(emit)( GLcontext *ctx, } if (DO_SPEC_OR_FOG) { - if (VB->FogCoordPtr) { - fog = VB->FogCoordPtr->data; - fog_stride = VB->FogCoordPtr->stride; + if (VB->AttribPtr[_TNL_ATTRIB_FOG]) { + fog = VB->AttribPtr[_TNL_ATTRIB_FOG]->data; + fog_stride = VB->AttribPtr[_TNL_ATTRIB_FOG]->stride; } else { fog = (GLfloat (*)[4])ctx->Current.Attrib[VERT_ATTRIB_FOG]; fog_stride = 0; diff --git a/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h b/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h index 07e6e9a6a7..19baf7d0d2 100644 --- a/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h +++ b/src/mesa/drivers/dri/tdfx/tdfx_vbtmp.h @@ -82,8 +82,8 @@ static void TAG(emit)( GLcontext *ctx, } if (IND & TDFX_FOGC_BIT) { - fog = VB->FogCoordPtr->data; - fog_stride = VB->FogCoordPtr->stride; + fog = VB->AttribPtr[_TNL_ATTRIB_FOG]->data; + fog_stride = VB->AttribPtr[_TNL_ATTRIB_FOG]->stride; } { diff --git a/src/mesa/drivers/glide/fxvbtmp.h b/src/mesa/drivers/glide/fxvbtmp.h index 742f500863..f7893c1573 100644 --- a/src/mesa/drivers/glide/fxvbtmp.h +++ b/src/mesa/drivers/glide/fxvbtmp.h @@ -91,8 +91,8 @@ static void TAG(emit)( GLcontext *ctx, } if (IND & SETUP_FOGC) { - fog = VB->FogCoordPtr->data; - fog_stride = VB->FogCoordPtr->stride; + fog = VB->AttribPtr[_TNL_ATTRIB_FOG]->data; + fog_stride = VB->AttribPtr[_TNL_ATTRIB_FOG]->stride; } if (start) { diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index 09ff8f8252..ebaae6335b 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -202,8 +202,6 @@ struct vertex_buffer * it that is one of VERT_ATTRIB_X. For things only produced by TNL, * such as backface color or eye-space coordinates, they are stored * here. - * XXX some of these fields alias AttribPtr below and should be removed - * such as FogCoordPtr, etc. */ GLuint *Elts; GLvector4f *EyePtr; /* _TNL_BIT_POS */ @@ -217,7 +215,6 @@ struct vertex_buffer GLvector4f *BackfaceIndexPtr; GLvector4f *BackfaceColorPtr; GLvector4f *BackfaceSecondaryColorPtr; - GLvector4f *FogCoordPtr; /* _TNL_BIT_FOG */ const struct _mesa_prim *Primitive; GLuint PrimitiveCount; diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c index 0862fdfa85..1c7c733883 100644 --- a/src/mesa/tnl/t_draw.c +++ b/src/mesa/tnl/t_draw.c @@ -251,13 +251,10 @@ static void bind_inputs( GLcontext *ctx, */ VB->Count = count; - - /* Legacy pointers -- remove one day. - */ + /* These should perhaps be part of _TNL_ATTRIB_* */ VB->BackfaceColorPtr = NULL; VB->BackfaceIndexPtr = NULL; VB->BackfaceSecondaryColorPtr = NULL; - VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG]; /* Clipping and drawing code still requires this to be a packed * array of ubytes which can be written into. TODO: Fix and diff --git a/src/mesa/tnl/t_vb_fog.c b/src/mesa/tnl/t_vb_fog.c index a68310de4d..4a0e6ad4f9 100644 --- a/src/mesa/tnl/t_vb_fog.c +++ b/src/mesa/tnl/t_vb_fog.c @@ -228,7 +228,6 @@ run_fog_stage(GLcontext *ctx, struct tnl_pipeline_stage *stage) VB->AttribPtr[_TNL_ATTRIB_FOG] = input; } - VB->FogCoordPtr = VB->AttribPtr[_TNL_ATTRIB_FOG]; return GL_TRUE; } diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c index 7002f74a00..c289cdfbaa 100644 --- a/src/mesa/tnl/t_vb_program.c +++ b/src/mesa/tnl/t_vb_program.c @@ -454,16 +454,12 @@ run_vp( GLcontext *ctx, struct tnl_pipeline_stage *stage ) VB->ClipPtr->count = VB->Count; } - VB->AttribPtr[_TNL_ATTRIB_COLOR0] = &store->results[VERT_RESULT_COL0]; - VB->BackfaceColorPtr = &store->results[VERT_RESULT_BFC0]; - VB->AttribPtr[_TNL_ATTRIB_COLOR1] = &store->results[VERT_RESULT_COL1]; - VB->BackfaceSecondaryColorPtr = &store->results[VERT_RESULT_BFC1]; - VB->FogCoordPtr = &store->results[VERT_RESULT_FOGC]; - VB->AttribPtr[VERT_ATTRIB_COLOR0] = &store->results[VERT_RESULT_COL0]; VB->AttribPtr[VERT_ATTRIB_COLOR1] = &store->results[VERT_RESULT_COL1]; VB->AttribPtr[VERT_ATTRIB_FOG] = &store->results[VERT_RESULT_FOGC]; VB->AttribPtr[_TNL_ATTRIB_POINTSIZE] = &store->results[VERT_RESULT_PSIZ]; + VB->BackfaceColorPtr = &store->results[VERT_RESULT_BFC0]; + VB->BackfaceSecondaryColorPtr = &store->results[VERT_RESULT_BFC1]; for (i = 0; i < ctx->Const.MaxTextureCoordUnits; i++) { VB->AttribPtr[_TNL_ATTRIB_TEX0 + i] diff --git a/src/mesa/tnl_dd/t_dd_vbtmp.h b/src/mesa/tnl_dd/t_dd_vbtmp.h index a35218a158..85101b9ceb 100644 --- a/src/mesa/tnl_dd/t_dd_vbtmp.h +++ b/src/mesa/tnl_dd/t_dd_vbtmp.h @@ -200,9 +200,9 @@ static void TAG(emit)( GLcontext *ctx, } if (DO_FOG) { - if (VB->FogCoordPtr) { - fog = VB->FogCoordPtr->data; - fog_stride = VB->FogCoordPtr->stride; + if (VB->AttribPtr[_TNL_ATTRIB_FOG]) { + fog = VB->AttribPtr[_TNL_ATTRIB_FOG]->data; + fog_stride = VB->AttribPtr[_TNL_ATTRIB_FOG]->stride; } else { static GLfloat tmp[4] = {0, 0, 0, 0}; diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c index ce91b75f3a..0d7e0f1f98 100644 --- a/src/mesa/x86/gen_matypes.c +++ b/src/mesa/x86/gen_matypes.c @@ -135,7 +135,7 @@ int main( int argc, char **argv ) OFFSET( "VB_INDEX_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_COLOR_INDEX] ); OFFSET( "VB_COLOR_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_COLOR0] ); OFFSET( "VB_SECONDARY_COLOR_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_COLOR1] ); - OFFSET( "VB_FOG_COORD_PTR ", struct vertex_buffer, FogCoordPtr ); + OFFSET( "VB_FOG_COORD_PTR ", struct vertex_buffer, AttribPtr[_TNL_ATTRIB_FOG] ); OFFSET( "VB_PRIMITIVE ", struct vertex_buffer, Primitive ); printf( "\n" ); -- cgit v1.2.3 From cc39fcad89db2a4fc96b64915d42e5b1ac59d345 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Nov 2009 02:58:15 -0800 Subject: i915: Remove dead meta_draw_quad code. --- src/mesa/drivers/dri/i915/intel_tris.c | 78 ------------------------------ src/mesa/drivers/dri/intel/intel_context.h | 8 --- 2 files changed, 86 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/intel_tris.c b/src/mesa/drivers/dri/i915/intel_tris.c index bc527aae47..8a3ab39bc2 100644 --- a/src/mesa/drivers/dri/i915/intel_tris.c +++ b/src/mesa/drivers/dri/i915/intel_tris.c @@ -1250,81 +1250,6 @@ union fi GLint i; }; - -/**********************************************************************/ -/* Used only with the metaops callbacks. */ -/**********************************************************************/ -static void -intel_meta_draw_poly(struct intel_context *intel, - GLuint n, - GLfloat xy[][2], - GLfloat z, GLuint color, GLfloat tex[][2]) -{ - union fi *vb; - GLint i; - unsigned int saved_vertex_size = intel->vertex_size; - - LOCK_HARDWARE(intel); - - intel->vertex_size = 6; - - /* All 3d primitives should be emitted with LOOP_CLIPRECTS, - * otherwise the drawing origin (DR4) might not be set correctly. - */ - intel_set_prim(intel, PRIM3D_TRIFAN); - vb = (union fi *) intel_get_prim_space(intel, n); - - for (i = 0; i < n; i++) { - vb[0].f = xy[i][0]; - vb[1].f = xy[i][1]; - vb[2].f = z; - vb[3].i = color; - vb[4].f = tex[i][0]; - vb[5].f = tex[i][1]; - vb += 6; - } - - INTEL_FIREVERTICES(intel); - - intel->vertex_size = saved_vertex_size; - - UNLOCK_HARDWARE(intel); -} - -static void -intel_meta_draw_quad(struct intel_context *intel, - GLfloat x0, GLfloat x1, - GLfloat y0, GLfloat y1, - GLfloat z, - GLuint color, - GLfloat s0, GLfloat s1, GLfloat t0, GLfloat t1) -{ - GLfloat xy[4][2]; - GLfloat tex[4][2]; - - xy[0][0] = x0; - xy[0][1] = y0; - xy[1][0] = x1; - xy[1][1] = y0; - xy[2][0] = x1; - xy[2][1] = y1; - xy[3][0] = x0; - xy[3][1] = y1; - - tex[0][0] = s0; - tex[0][1] = t0; - tex[1][0] = s1; - tex[1][1] = t0; - tex[2][0] = s1; - tex[2][1] = t1; - tex[3][0] = s0; - tex[3][1] = t1; - - intel_meta_draw_poly(intel, 4, xy, z, color, tex); -} - - - /**********************************************************************/ /* Initialization. */ /**********************************************************************/ @@ -1333,7 +1258,6 @@ intel_meta_draw_quad(struct intel_context *intel, void intelInitTriFuncs(GLcontext * ctx) { - struct intel_context *intel = intel_context(ctx); TNLcontext *tnl = TNL_CONTEXT(ctx); static int firsttime = 1; @@ -1350,6 +1274,4 @@ intelInitTriFuncs(GLcontext * ctx) tnl->Driver.Render.BuildVertices = _tnl_build_vertices; tnl->Driver.Render.CopyPV = _tnl_copy_pv; tnl->Driver.Render.Interp = _tnl_interp; - - intel->vtbl.meta_draw_quad = intel_meta_draw_quad; } diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index eb7be7ddd0..81beff4819 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -135,14 +135,6 @@ struct intel_context struct intel_region * draw_region, struct intel_region * depth_region); - void (*meta_draw_quad)(struct intel_context *intel, - GLfloat x0, GLfloat x1, - GLfloat y0, GLfloat y1, - GLfloat z, - GLuint color, /* ARGB32 */ - GLfloat s0, GLfloat s1, - GLfloat t0, GLfloat t1); - void (*meta_color_mask) (struct intel_context * intel, GLboolean); void (*meta_stencil_replace) (struct intel_context * intel, -- cgit v1.2.3 From 92d35b91f132deda1fb27d2071a50e8187301fe5 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Nov 2009 03:01:42 -0800 Subject: i965: Pack the brw_wm_prog_key better. --- src/mesa/drivers/dri/i965/brw_wm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm.h b/src/mesa/drivers/dri/i965/brw_wm.h index 9dcb6e14bb..b9b987ea70 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.h +++ b/src/mesa/drivers/dri/i965/brw_wm.h @@ -76,10 +76,10 @@ struct brw_wm_prog_key { GLushort tex_swizzles[BRW_MAX_TEX_UNIT]; - GLuint program_string_id:32; GLushort origin_x, origin_y; GLushort drawable_height; GLbitfield64 vp_outputs_written; + GLuint program_string_id:32; }; -- cgit v1.2.3 From 15fa484f514726a29bbf24df33c0551844f878d0 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Nov 2009 03:05:14 -0800 Subject: mesa: Remove gratuitous padding in prog_dst_register. The padding was there to indicate the amount of space left from the number of expected bytes in the struct minus allocated bits. But uint bitfields get packed so that they don't cross uint boundaries, and we ended up allocating an extra dword to hold the pad field! --- src/mesa/drivers/dri/i965/brw_wm_fp.c | 1 - src/mesa/main/ffvertex_prog.c | 1 - src/mesa/shader/prog_instruction.h | 1 - 3 files changed, 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c index 7d03179588..3737faf26f 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_fp.c +++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c @@ -138,7 +138,6 @@ static struct prog_dst_register dst_reg(GLuint file, GLuint idx) reg.CondMask = COND_TR; reg.CondSwizzle = 0; reg.CondSrc = 0; - reg.pad = 0; return reg; } diff --git a/src/mesa/main/ffvertex_prog.c b/src/mesa/main/ffvertex_prog.c index fe2416d894..5cfa898031 100644 --- a/src/mesa/main/ffvertex_prog.c +++ b/src/mesa/main/ffvertex_prog.c @@ -523,7 +523,6 @@ static void emit_dst( struct prog_dst_register *dst, dst->CondMask = COND_TR; /* always pass cond test */ dst->CondSwizzle = SWIZZLE_NOOP; dst->CondSrc = 0; - dst->pad = 0; /* Check that bitfield sizes aren't exceeded */ ASSERT(dst->Index == reg.idx); } diff --git a/src/mesa/shader/prog_instruction.h b/src/mesa/shader/prog_instruction.h index 1c687bc16c..224350caac 100644 --- a/src/mesa/shader/prog_instruction.h +++ b/src/mesa/shader/prog_instruction.h @@ -312,7 +312,6 @@ struct prog_dst_register */ GLuint CondSrc:1; /*@}*/ - GLuint pad:28; }; -- cgit v1.2.3 From edd449fb9714ec1aa2d6c0cf95623f460594e685 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Nov 2009 03:13:14 -0800 Subject: i965: Pack brw_wm_fragment_program better. --- src/mesa/drivers/dri/i965/brw_context.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index fded47aa2f..6d2ce15682 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -172,8 +172,8 @@ struct brw_fragment_program { GLuint id; /**< serial no. to identify frag progs, never re-used */ GLboolean isGLSL; /**< really, any IF/LOOP/CONT/BREAK instructions */ - dri_bo *const_buffer; /** Program constant buffer/surface */ GLboolean use_const_buffer; + dri_bo *const_buffer; /** Program constant buffer/surface */ /** for debugging, which texture units are referenced */ GLbitfield tex_units_used; -- cgit v1.2.3 From a376e5c48237be0300bce6702ed947086d3ee23f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Nov 2009 03:21:17 -0800 Subject: intel: Consistently use no_batch_wrap in intel_context struct. --- src/mesa/drivers/dri/i915/i830_vtbl.c | 3 --- src/mesa/drivers/dri/i915/i915_vtbl.c | 3 --- src/mesa/drivers/dri/i965/brw_context.h | 1 - src/mesa/drivers/dri/i965/brw_draw.c | 4 ++-- src/mesa/drivers/dri/i965/brw_vtbl.c | 3 --- src/mesa/drivers/dri/intel/intel_batchbuffer.c | 3 +++ 6 files changed, 5 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index 7d76b39caa..c05c7759ac 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -714,9 +714,6 @@ i830_new_batch(struct intel_context *intel) { struct i830_context *i830 = i830_context(&intel->ctx); i830->state.emitted = 0; - - /* Check that we didn't just wrap our batchbuffer at a bad time. */ - assert(!intel->no_batch_wrap); } static void diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index 77ba8d5581..3e7b5101cc 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -667,9 +667,6 @@ i915_new_batch(struct intel_context *intel) * difficulties associated with them (physical address requirements). */ i915->state.emitted = 0; - - /* Check that we didn't just wrap our batchbuffer at a bad time. */ - assert(!intel->no_batch_wrap); } static void diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 6d2ce15682..e73e21433c 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -438,7 +438,6 @@ struct brw_context GLuint primitive; GLboolean emit_state_always; - GLboolean no_batch_wrap; struct { struct brw_state_flags dirty; diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index 8bcb6083f7..7ad860898f 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -145,7 +145,7 @@ static void brw_emit_prim(struct brw_context *brw, prim_packet.base_vert_location = prim->basevertex; /* Can't wrap here, since we rely on the validated state. */ - brw->no_batch_wrap = GL_TRUE; + intel->no_batch_wrap = GL_TRUE; /* If we're set to always flush, do it before and after the primitive emit. * We want to catch both missed flushes that hurt instruction/state cache @@ -163,7 +163,7 @@ static void brw_emit_prim(struct brw_context *brw, intel_batchbuffer_emit_mi_flush(intel->batch); } - brw->no_batch_wrap = GL_FALSE; + intel->no_batch_wrap = GL_FALSE; } static void brw_merge_inputs( struct brw_context *brw, diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c index 114e6bd018..dc47f08dd4 100644 --- a/src/mesa/drivers/dri/i965/brw_vtbl.c +++ b/src/mesa/drivers/dri/i965/brw_vtbl.c @@ -144,9 +144,6 @@ static void brw_new_batch( struct intel_context *intel ) { struct brw_context *brw = brw_context(&intel->ctx); - /* Check that we didn't just wrap our batchbuffer at a bad time. */ - assert(!brw->no_batch_wrap); - brw->curbe.need_new_bo = GL_TRUE; /* Mark all context state as needing to be re-emitted. diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c index ca6e2fa5b1..12c5a30d6b 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c @@ -244,6 +244,9 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file, if (intel->vtbl.finish_batch) intel->vtbl.finish_batch(intel); + /* Check that we didn't just wrap our batchbuffer at a bad time. */ + assert(!intel->no_batch_wrap); + batch->reserved_space = BATCH_RESERVED; /* TODO: Just pass the relocation list and dma buffer up to the -- cgit v1.2.3 From c4b7c47fe3135f852919cf2d4a2f64210e8cf125 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Nov 2009 03:32:35 -0800 Subject: intel: Pack colors for blit at blit time, rather than at ClearColor. --- src/mesa/drivers/dri/intel/intel_blit.c | 5 +++-- src/mesa/drivers/dri/intel/intel_context.h | 4 ---- src/mesa/drivers/dri/intel/intel_state.c | 20 -------------------- 3 files changed, 3 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index 817223da41..f14854602b 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -499,10 +499,11 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) switch (irb->texformat) { case MESA_FORMAT_ARGB8888: case MESA_FORMAT_XRGB8888: - clearVal = intel->ClearColor8888; + clearVal = PACK_COLOR_8888(clear[3], clear[0], + clear[1], clear[2]); break; case MESA_FORMAT_RGB565: - clearVal = intel->ClearColor565; + clearVal = PACK_COLOR_565(clear[0], clear[1], clear[2]); break; case MESA_FORMAT_ARGB4444: clearVal = PACK_COLOR_4444(clear[3], clear[0], diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 81beff4819..2d352090a5 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -209,10 +209,6 @@ struct intel_context char *prevLockFile; int prevLockLine; - GLuint ClearColor565; - GLuint ClearColor8888; - - /* Offsets of fields within the current vertex: */ GLuint coloroffset; diff --git a/src/mesa/drivers/dri/intel/intel_state.c b/src/mesa/drivers/dri/intel/intel_state.c index 4ee742377d..aefae53eb2 100644 --- a/src/mesa/drivers/dri/intel/intel_state.c +++ b/src/mesa/drivers/dri/intel/intel_state.c @@ -196,25 +196,6 @@ intel_translate_logic_op(GLenum opcode) } } - -static void -intelClearColor(GLcontext *ctx, const GLfloat color[4]) -{ - struct intel_context *intel = intel_context(ctx); - GLubyte clear[4]; - - CLAMPED_FLOAT_TO_UBYTE(clear[0], color[0]); - CLAMPED_FLOAT_TO_UBYTE(clear[1], color[1]); - CLAMPED_FLOAT_TO_UBYTE(clear[2], color[2]); - CLAMPED_FLOAT_TO_UBYTE(clear[3], color[3]); - - /* compute both 32 and 16-bit clear values */ - intel->ClearColor8888 = INTEL_PACKCOLOR8888(clear[0], clear[1], - clear[2], clear[3]); - intel->ClearColor565 = INTEL_PACKCOLOR565(clear[0], clear[1], clear[2]); -} - - /* Fallback to swrast for select and feedback. */ static void @@ -229,5 +210,4 @@ void intelInitStateFuncs(struct dd_function_table *functions) { functions->RenderMode = intelRenderMode; - functions->ClearColor = intelClearColor; } -- cgit v1.2.3 From ee64347979b4e22976910cb97869887f7de4241c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Nov 2009 03:39:20 -0800 Subject: intel: Remove our special color packing macros and just use colormac.h. --- src/mesa/drivers/dri/i915/i830_texstate.c | 10 +++++----- src/mesa/drivers/dri/i915/i915_texstate.c | 17 +++++++++-------- src/mesa/drivers/dri/intel/intel_context.h | 23 ----------------------- src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 5 ++--- 4 files changed, 16 insertions(+), 39 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index f4bbb53b86..c62281d341 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -27,6 +27,7 @@ #include "main/mtypes.h" #include "main/enums.h" +#include "main/colormac.h" #include "intel_mipmap_tree.h" #include "intel_tex.h" @@ -311,11 +312,10 @@ i830_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) CLAMPED_FLOAT_TO_UBYTE(border[2], tObj->BorderColor[2]); CLAMPED_FLOAT_TO_UBYTE(border[3], tObj->BorderColor[3]); - state[I830_TEXREG_TM0S4] = INTEL_PACKCOLOR8888(border[0], - border[1], - border[2], - border[3]); - + state[I830_TEXREG_TM0S4] = PACK_COLOR_8888(border[3], + border[0], + border[1], + border[2]); I830_ACTIVESTATE(i830, I830_UPLOAD_TEX(unit), GL_TRUE); /* memcmp was already disabled, but definitely won't work as the diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index d6689af53f..1bacd51aec 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -28,6 +28,7 @@ #include "main/mtypes.h" #include "main/enums.h" #include "main/macros.h" +#include "main/colormac.h" #include "intel_mipmap_tree.h" #include "intel_tex.h" @@ -363,15 +364,15 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3) * R channel, while the hardware uses A. Spam R into all the channels * for safety. */ - state[I915_TEXREG_SS4] = INTEL_PACKCOLOR8888(border[0], - border[0], - border[0], - border[0]); + state[I915_TEXREG_SS4] = PACK_COLOR_8888(border[0], + border[0], + border[0], + border[0]); } else { - state[I915_TEXREG_SS4] = INTEL_PACKCOLOR8888(border[0], - border[1], - border[2], - border[3]); + state[I915_TEXREG_SS4] = PACK_COLOR_8888(border[3], + border[0], + border[1], + border[2]); } diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 2d352090a5..8cd3efea8a 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -361,29 +361,6 @@ do { \ (intel)->prim.flush(intel); \ } while (0) -/* ================================================================ - * Color packing: - */ - -#define INTEL_PACKCOLOR4444(r,g,b,a) \ - ((((a) & 0xf0) << 8) | (((r) & 0xf0) << 4) | ((g) & 0xf0) | ((b) >> 4)) - -#define INTEL_PACKCOLOR1555(r,g,b,a) \ - ((((r) & 0xf8) << 7) | (((g) & 0xf8) << 2) | (((b) & 0xf8) >> 3) | \ - ((a) ? 0x8000 : 0)) - -#define INTEL_PACKCOLOR565(r,g,b) \ - ((((r) & 0xf8) << 8) | (((g) & 0xfc) << 3) | (((b) & 0xf8) >> 3)) - -#define INTEL_PACKCOLOR8888(r,g,b,a) \ - ((a<<24) | (r<<16) | (g<<8) | b) - -#define INTEL_PACKCOLOR(format, r, g, b, a) \ -(format == DV_PF_555 ? INTEL_PACKCOLOR1555(r,g,b,a) : \ - (format == DV_PF_565 ? INTEL_PACKCOLOR565(r,g,b) : \ - (format == DV_PF_8888 ? INTEL_PACKCOLOR8888(r,g,b,a) : \ - 0))) - /* ================================================================ * From linux kernel i386 header files, copes with odd sizes better * than COPY_DWORDS would: diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index 99330b6ddf..9572b67326 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -228,10 +228,9 @@ do_blit_bitmap( GLcontext *ctx, UNCLAMPED_FLOAT_TO_UBYTE(ubcolor[3], tmpColor[3]); if (dst->cpp == 2) - color = INTEL_PACKCOLOR565(ubcolor[0], ubcolor[1], ubcolor[2]); + color = PACK_COLOR_565(ubcolor[0], ubcolor[1], ubcolor[2]); else - color = INTEL_PACKCOLOR8888(ubcolor[0], ubcolor[1], - ubcolor[2], ubcolor[3]); + color = PACK_COLOR_8888(ubcolor[3], ubcolor[0], ubcolor[1], ubcolor[2]); if (!intel_check_blit_fragment_ops(ctx, tmpColor[3] == 1.0F)) return GL_FALSE; -- cgit v1.2.3 From 667760f53c16fae45ab29881c5ea12eef5fcda54 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Nov 2009 03:43:16 -0800 Subject: intel: Remove dead intel_context members and move some packing around. --- src/mesa/drivers/dri/intel/intel_context.c | 6 ------ src/mesa/drivers/dri/intel/intel_context.h | 10 +--------- 2 files changed, 1 insertion(+), 15 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 2aeca6b81b..7b7c0a0b5a 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -733,12 +733,6 @@ intelInitContext(struct intel_context *intel, intel->RenderIndex = ~0; fthrottle_mode = driQueryOptioni(&intel->optionCache, "fthrottle_mode"); - intel->irqsEmitted = 0; - - intel->do_irqs = (intel->intelScreen->irq_active && - fthrottle_mode == DRI_CONF_FTHROTTLE_IRQS); - - intel->do_usleeps = (fthrottle_mode == DRI_CONF_FTHROTTLE_USLEEPS); if (intel->gen >= 4 && !intel->intelScreen->irq_active) { _mesa_printf("IRQs not active. Exiting\n"); diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 8cd3efea8a..f16f502c1d 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -225,6 +225,7 @@ struct intel_context GLboolean hw_stipple; GLboolean depth_buffer_is_float; GLboolean no_rast; + GLboolean no_hw; GLboolean always_flush_batch; GLboolean always_flush_cache; @@ -290,13 +291,6 @@ struct intel_context GLboolean use_early_z; drm_clip_rect_t fboRect; /**< cliprect for FBO rendering */ - int perf_boxes; - - GLuint do_usleeps; - int do_irqs; - GLuint irqsEmitted; - - GLboolean scissor; drm_clip_rect_t draw_rect; drm_clip_rect_t scissor_rect; @@ -313,8 +307,6 @@ struct intel_context GLuint lastStamp; - GLboolean no_hw; - /** * Configuration cache */ -- cgit v1.2.3 From 827ba44f6ee83ab21c6a2b09323f6f1df4a7d4c8 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 18 Nov 2009 18:15:25 +0100 Subject: intel: Remove non-GEM support. This really isn't supported at this point. GEM's been in the kernel for a year, and the fake bufmgr never really worked. --- src/mesa/drivers/dri/i965/brw_draw_upload.c | 8 ---- src/mesa/drivers/dri/intel/intel_batchbuffer.c | 4 +- src/mesa/drivers/dri/intel/intel_context.c | 38 ++++------------- src/mesa/drivers/dri/intel/intel_context.h | 6 --- src/mesa/drivers/dri/intel/intel_extensions.c | 14 ++----- src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 16 +++----- src/mesa/drivers/dri/intel/intel_regions.c | 57 +++++--------------------- src/mesa/drivers/dri/intel/intel_screen.c | 38 ++++------------- src/mesa/drivers/dri/intel/intel_screen.h | 1 - src/mesa/drivers/dri/intel/intel_span.c | 13 ++---- 10 files changed, 43 insertions(+), 152 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_draw_upload.c b/src/mesa/drivers/dri/i965/brw_draw_upload.c index 271a88dae0..7c796dae93 100644 --- a/src/mesa/drivers/dri/i965/brw_draw_upload.c +++ b/src/mesa/drivers/dri/i965/brw_draw_upload.c @@ -243,14 +243,6 @@ static void wrap_buffers( struct brw_context *brw, dri_bo_unreference(brw->vb.upload.bo); brw->vb.upload.bo = dri_bo_alloc(brw->intel.bufmgr, "temporary VBO", size, 1); - - /* Set the internal VBO\ to no-backing-store. We only use them as a - * temporary within a brw_try_draw_prims while the lock is held. - */ - /* DON'T DO THIS AS IF WE HAVE TO RE-ORG MEMORY WE NEED SOMEWHERE WITH - FAKE TO PUSH THIS STUFF */ -// if (!brw->intel.ttm) -// dri_bo_fake_disable_backing_store(brw->vb.upload.bo, NULL, NULL); } static void get_space( struct brw_context *brw, diff --git a/src/mesa/drivers/dri/intel/intel_batchbuffer.c b/src/mesa/drivers/dri/intel/intel_batchbuffer.c index 12c5a30d6b..2eae9b66d8 100644 --- a/src/mesa/drivers/dri/intel/intel_batchbuffer.c +++ b/src/mesa/drivers/dri/intel/intel_batchbuffer.c @@ -80,7 +80,7 @@ intel_batchbuffer_reset(struct intel_batchbuffer *batch) batch->buf = NULL; } - if (!batch->buffer && intel->ttm == GL_TRUE) + if (!batch->buffer) batch->buffer = malloc (intel->maxBatchSize); batch->buf = dri_bo_alloc(intel->bufmgr, "batchbuffer", @@ -212,7 +212,7 @@ _intel_batchbuffer_flush(struct intel_batchbuffer *batch, const char *file, batch->reserved_space = 0; /* Emit a flush if the bufmgr doesn't do it for us. */ - if (intel->always_flush_cache || !intel->ttm) { + if (intel->always_flush_cache) { intel_batchbuffer_emit_mi_flush(batch); used = batch->ptr - batch->map; } diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 7b7c0a0b5a..1434ae530b 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -176,9 +176,7 @@ intelGetString(GLcontext * ctx, GLenum name) break; } - (void) driGetRendererString(buffer, chipset, - (intel->ttm) ? DRIVER_DATE_GEM : DRIVER_DATE, - 0); + (void) driGetRendererString(buffer, chipset, DRIVER_DATE_GEM, 0); return (GLubyte *) buffer; default: @@ -601,6 +599,7 @@ intelInitContext(struct intel_context *intel, __DRIscreenPrivate *sPriv = driContextPriv->driScreenPriv; intelScreenPrivate *intelScreen = (intelScreenPrivate *) sPriv->private; int fthrottle_mode; + int bo_reuse_mode; if (!_mesa_initialize_context(&intel->ctx, mesaVis, shareCtx, functions, (void *) intel)) { @@ -635,18 +634,14 @@ intelInitContext(struct intel_context *intel, intel->maxBatchSize = BATCH_SZ; intel->bufmgr = intelScreen->bufmgr; - intel->ttm = intelScreen->ttm; - if (intel->ttm) { - int bo_reuse_mode; - bo_reuse_mode = driQueryOptioni(&intel->optionCache, "bo_reuse"); - switch (bo_reuse_mode) { - case DRI_CONF_BO_REUSE_DISABLED: - break; - case DRI_CONF_BO_REUSE_ALL: - intel_bufmgr_gem_enable_reuse(intel->bufmgr); - break; - } + bo_reuse_mode = driQueryOptioni(&intel->optionCache, "bo_reuse"); + switch (bo_reuse_mode) { + case DRI_CONF_BO_REUSE_DISABLED: + break; + case DRI_CONF_BO_REUSE_ALL: + intel_bufmgr_gem_enable_reuse(intel->bufmgr); + break; } /* This doesn't yet catch all non-conformant rendering, but it's a @@ -1052,21 +1047,6 @@ intelContendedLock(struct intel_context *intel, GLuint flags) sarea->ctxOwner = me; } - /* If the last consumer of the texture memory wasn't us, notify the fake - * bufmgr and record the new owner. We should have the memory shared - * between contexts of a single fake bufmgr, but this will at least make - * things correct for now. - */ - if (!intel->ttm && sarea->texAge != intel->hHWContext) { - sarea->texAge = intel->hHWContext; - intel_bufmgr_fake_contended_lock_take(intel->bufmgr); - if (INTEL_DEBUG & DEBUG_BATCH) - intel_decode_context_reset(); - if (INTEL_DEBUG & DEBUG_BUFMGR) - fprintf(stderr, "Lost Textures: sarea->texAge %x hw context %x\n", - sarea->ctxOwner, intel->hHWContext); - } - /* Drawable changed? */ if (dPriv && intel->lastStamp != dPriv->lastStamp) { diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index f16f502c1d..481202c971 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -181,12 +181,6 @@ struct intel_context struct intel_region *back_region; struct intel_region *depth_region; - /** - * This value indicates that the kernel memory manager is being used - * instead of the fake client-side memory manager. - */ - GLboolean ttm; - struct intel_batchbuffer *batch; drm_intel_bo *first_post_swapbuffers_batch; GLboolean no_batch_wrap; diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index 1682e115cc..f5fe543b5d 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -79,6 +79,7 @@ static const struct dri_extension card_extensions[] = { { "GL_ARB_half_float_pixel", NULL }, { "GL_ARB_map_buffer_range", GL_ARB_map_buffer_range_functions }, { "GL_ARB_multitexture", NULL }, + { "GL_ARB_pixel_buffer_object", NULL }, { "GL_ARB_point_parameters", GL_ARB_point_parameters_functions }, { "GL_ARB_point_sprite", NULL }, { "GL_ARB_shader_objects", GL_ARB_shader_objects_functions }, @@ -104,6 +105,8 @@ static const struct dri_extension card_extensions[] = { { "GL_EXT_blend_logic_op", NULL }, { "GL_EXT_blend_subtract", NULL }, { "GL_EXT_cull_vertex", GL_EXT_cull_vertex_functions }, + { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions }, + { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, { "GL_EXT_fog_coord", GL_EXT_fog_coord_functions }, { "GL_EXT_gpu_program_parameters", GL_EXT_gpu_program_parameters_functions }, { "GL_EXT_packed_depth_stencil", NULL }, @@ -176,14 +179,6 @@ static const struct dri_extension arb_oq_extensions[] = { { NULL, NULL } }; - -static const struct dri_extension ttm_extensions[] = { - { "GL_ARB_pixel_buffer_object", NULL }, - { "GL_EXT_framebuffer_blit", GL_EXT_framebuffer_blit_functions }, - { "GL_EXT_framebuffer_object", GL_EXT_framebuffer_object_functions }, - { NULL, NULL } -}; - static const struct dri_extension fragment_shader_extensions[] = { { "GL_ARB_fragment_shader", NULL }, { NULL, NULL } @@ -202,9 +197,6 @@ intelInitExtensions(GLcontext *ctx) */ driInitExtensions(ctx, card_extensions, GL_FALSE); - if (intel->ttm) - driInitExtensions(ctx, ttm_extensions, GL_FALSE); - if (IS_965(intel->intelScreen->deviceID)) driInitExtensions(ctx, brw_extensions, GL_FALSE); diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index abb3024bfb..6a565f80cf 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -224,16 +224,12 @@ int intel_miptree_pitch_align (struct intel_context *intel, if (!mt->compressed) { int pitch_align; - if (intel->ttm) { - /* XXX: Align pitch to multiple of 64 bytes for now to allow - * render-to-texture to work in all cases. This should probably be - * replaced at some point by some scheme to only do this when really - * necessary. - */ - pitch_align = 64; - } else { - pitch_align = 4; - } + /* XXX: Align pitch to multiple of 64 bytes for now to allow + * render-to-texture to work in all cases. This should probably be + * replaced at some point by some scheme to only do this when really + * necessary. + */ + pitch_align = 64; if (tiling == I915_TILING_X) pitch_align = 512; diff --git a/src/mesa/drivers/dri/intel/intel_regions.c b/src/mesa/drivers/dri/intel/intel_regions.c index 80975163d4..d6b9dc4446 100644 --- a/src/mesa/drivers/dri/intel/intel_regions.c +++ b/src/mesa/drivers/dri/intel/intel_regions.c @@ -542,55 +542,18 @@ intel_recreate_static(struct intel_context *intel, region->buffer = NULL; } - if (intel->ttm) { - assert(region_desc->bo_handle != -1); - region->buffer = intel_bo_gem_create_from_name(intel->bufmgr, - name, - region_desc->bo_handle); - - ret = dri_bo_get_tiling(region->buffer, ®ion->tiling, - ®ion->bit_6_swizzle); - if (ret != 0) { - fprintf(stderr, "Couldn't get tiling of buffer %d (%s): %s\n", - region_desc->bo_handle, name, strerror(-ret)); - intel_region_release(®ion); - return NULL; - } - } else { - if (region->classic_map != NULL) { - drmUnmap(region->classic_map, - region->pitch * region->cpp * region->height); - region->classic_map = NULL; - } - ret = drmMap(intel->driFd, region_desc->handle, - region->pitch * region->cpp * region->height, - ®ion->classic_map); - if (ret != 0) { - fprintf(stderr, "Failed to drmMap %s buffer\n", name); - free(region); - return NULL; - } - - region->buffer = intel_bo_fake_alloc_static(intel->bufmgr, + assert(region_desc->bo_handle != -1); + region->buffer = intel_bo_gem_create_from_name(intel->bufmgr, name, - region_desc->offset, - region->pitch * region->cpp * - region->height, - region->classic_map); - - /* The sarea just gives us a boolean for whether it's tiled or not, - * instead of which tiling mode it is. Guess. - */ - if (region_desc->tiled) { - if (intel->gen >= 4 && region_desc == &intelScreen->depth) - region->tiling = I915_TILING_Y; - else - region->tiling = I915_TILING_X; - } else { - region->tiling = I915_TILING_NONE; - } + region_desc->bo_handle); - region->bit_6_swizzle = I915_BIT_6_SWIZZLE_NONE; + ret = dri_bo_get_tiling(region->buffer, ®ion->tiling, + ®ion->bit_6_swizzle); + if (ret != 0) { + fprintf(stderr, "Couldn't get tiling of buffer %d (%s): %s\n", + region_desc->bo_handle, name, strerror(-ret)); + intel_region_release(®ion); + return NULL; } assert(region->buffer != NULL); diff --git a/src/mesa/drivers/dri/intel/intel_screen.c b/src/mesa/drivers/dri/intel/intel_screen.c index 789135b49f..2c5a884a9b 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.c +++ b/src/mesa/drivers/dri/intel/intel_screen.c @@ -605,7 +605,6 @@ intelFillInModes(__DRIscreenPrivate *psp, static GLboolean intel_init_bufmgr(intelScreenPrivate *intelScreen) { - GLboolean gem_disable = getenv("INTEL_NO_GEM") != NULL; int gem_kernel = 0; GLboolean gem_supported; struct drm_i915_getparam gp; @@ -622,43 +621,24 @@ intel_init_bufmgr(intelScreenPrivate *intelScreen) /* If we've got a new enough DDX that's initializing GEM and giving us * object handles for the shared buffers, use that. */ - intelScreen->ttm = GL_FALSE; if (intelScreen->driScrnPriv->dri2.enabled) gem_supported = GL_TRUE; else if (intelScreen->driScrnPriv->ddx_version.minor >= 9 && gem_kernel && intelScreen->front.bo_handle != -1) gem_supported = GL_TRUE; - else - gem_supported = GL_FALSE; - - if (!gem_disable && gem_supported) { - intelScreen->bufmgr = intel_bufmgr_gem_init(spriv->fd, BATCH_SZ); - if (intelScreen->bufmgr != NULL) - intelScreen->ttm = GL_TRUE; + else { + fprintf(stderr, "[%s:%u] Error initializing GEM.\n", + __func__, __LINE__); + return GL_FALSE; } + + intelScreen->bufmgr = intel_bufmgr_gem_init(spriv->fd, BATCH_SZ); /* Otherwise, use the classic buffer manager. */ if (intelScreen->bufmgr == NULL) { - if (gem_disable) { - _mesa_warning(NULL, "GEM disabled. Using classic."); - } else { - _mesa_warning(NULL, - "Failed to initialize GEM. Falling back to classic."); - } - - if (intelScreen->tex.size == 0) { - fprintf(stderr, "[%s:%u] Error initializing buffer manager.\n", - __func__, __LINE__); - return GL_FALSE; - } - - intelScreen->bufmgr = - intel_bufmgr_fake_init(spriv->fd, - intelScreen->tex.offset, - intelScreen->tex.map, - intelScreen->tex.size, - (unsigned int * volatile) - &intelScreen->sarea->last_dispatch); + fprintf(stderr, "[%s:%u] Error initializing buffer manager.\n", + __func__, __LINE__); + return GL_FALSE; } if (intel_get_param(spriv, I915_PARAM_NUM_FENCES_AVAIL, &num_fences)) diff --git a/src/mesa/drivers/dri/intel/intel_screen.h b/src/mesa/drivers/dri/intel/intel_screen.h index a9b9e109a6..14ca0903b6 100644 --- a/src/mesa/drivers/dri/intel/intel_screen.h +++ b/src/mesa/drivers/dri/intel/intel_screen.h @@ -77,7 +77,6 @@ typedef struct GLboolean no_hw; GLboolean no_vbo; - int ttm; dri_bufmgr *bufmgr; GLboolean kernel_exec_fencing; diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 3607c7dded..2c89a66a95 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -613,15 +613,7 @@ intel_set_span_functions(struct intel_context *intel, struct gl_renderbuffer *rb) { struct intel_renderbuffer *irb = (struct intel_renderbuffer *) rb; - uint32_t tiling; - - /* If in GEM mode, we need to do the tile address swizzling ourselves, - * instead of the fence registers handling it. - */ - if (intel->ttm) - tiling = irb->region->tiling; - else - tiling = I915_TILING_NONE; + uint32_t tiling = irb->region->tiling; if (intel->intelScreen->kernel_exec_fencing) { switch (irb->texformat) { @@ -673,6 +665,9 @@ intel_set_span_functions(struct intel_context *intel, return; } + /* If in GEM mode, we need to do the tile address swizzling ourselves, + * instead of the fence registers handling it. + */ switch (irb->texformat) { case MESA_FORMAT_RGB565: switch (tiling) { -- cgit v1.2.3 From 4e6e2462ea1fb5b7fc24bb0e707a9cf6507c47c9 Mon Sep 17 00:00:00 2001 From: Tom Fogal Date: Thu, 19 Nov 2009 09:18:48 -0700 Subject: mesa: define 32bit byteswap for AIX. Fixes `xlib' driver build on AIX. Signed-off-by: Brian Paul --- src/mesa/main/compiler.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h index 9319505a75..522295a9bf 100644 --- a/src/mesa/main/compiler.h +++ b/src/mesa/main/compiler.h @@ -235,7 +235,12 @@ extern "C" { #elif defined(__APPLE__) #include #define CPU_TO_LE32( x ) CFSwapInt32HostToLittle( x ) -#else /*__linux__ __APPLE__*/ +#elif defined(_AIX) +#define CPU_TO_LE32( x ) x = ((x & 0x000000ff) << 24) | \ + ((x & 0x0000ff00) << 8) | \ + ((x & 0x00ff0000) >> 8) | \ + ((x & 0xff000000) >> 24); +#else /*__linux__ */ #include #define CPU_TO_LE32( x ) bswap32( x ) #endif /*__linux__*/ -- cgit v1.2.3 From 012d0193cc9ad6fdc9829db0a6884a5a590dd4c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 19 Nov 2009 17:25:05 +0100 Subject: st/xorg: Don't complain about convolution filter being 'unknown'. Also add a newline to the complaint so it'll be a little less annoying if we actually encounter an unknown filter value again. --- src/gallium/state_trackers/xorg/xorg_composite.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 733bd53fca..86a52077c3 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -152,7 +152,8 @@ render_filter_to_gallium(int xrender_filter, int *out_filter) *out_filter = PIPE_TEX_FILTER_LINEAR; break; default: - debug_printf("Unkown xrender filter"); + debug_printf("Unkown xrender filter\n"); + case PictFilterConvolution: *out_filter = PIPE_TEX_FILTER_NEAREST; return FALSE; } -- cgit v1.2.3 From 34145fc3b739d21387e7df483ca902c8373ce319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 19 Nov 2009 17:30:32 +0100 Subject: st/xorg: Try harder to ensure a shared texture has valid contents right away. --- src/gallium/state_trackers/xorg/xorg_dri2.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index 660ea6a1ba..9a7c356860 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -127,9 +127,12 @@ driDoCreateBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int format) } if (!tex) { + /* First call to make sure we have a pixmap private */ exaMoveInPixmap(private->pPixmap); xorg_exa_set_shared_usage(private->pPixmap); pScreen->ModifyPixmapHeader(private->pPixmap, 0, 0, 0, 0, 0, NULL); + /* Second call to make sure texture has valid contents */ + exaMoveInPixmap(private->pPixmap); tex = xorg_exa_get_texture(private->pPixmap); } -- cgit v1.2.3 From 10c67f938194a3b99ce2717318c77d86abc54933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 19 Nov 2009 17:47:21 +0100 Subject: st/xorg: Miscellaneous XVideo fixes. * Make sure the destination pixmap has a texture to render into. * Fix damage reporting so the EXA migration code can do the right thing. * Fix destination coordinates for redirected windows. --- src/gallium/state_trackers/xorg/xorg_xv.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index 2b935c0f73..7cc532b1c8 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -446,6 +446,11 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id, int x, y, w, h; struct exa_pixmap_priv *dst = exaGetPixmapDriverPrivate(pPixmap); + if (!dst->tex) { + xorg_exa_set_shared_usage(pPixmap); + pScrn->pScreen->ModifyPixmapHeader(pPixmap, 0, 0, 0, 0, 0, NULL); + } + if (!dst || !dst->tex) XORG_FALLBACK("Xv destination %s", !dst ? "!dst" : "!dst->tex"); @@ -469,6 +474,9 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id, setup_vs_video_constants(pPriv->r, dst); setup_fs_video_constants(pPriv->r, hdtv); + exaMoveInPixmap(pPixmap); + DamageDamageRegion(&pPixmap->drawable, dstRegion); + while (nbox--) { int box_x1 = pbox->x1; int box_y1 = pbox->y1; @@ -476,8 +484,8 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id, int box_y2 = pbox->y2; float diff_x = (float)src_w / (float)dst_w; float diff_y = (float)src_h / (float)dst_h; - int offset_x = box_x1 - dstX; - int offset_y = box_y1 - dstY; + int offset_x = box_x1 - dstX + pPixmap->screen_x; + int offset_y = box_y1 - dstY + pPixmap->screen_y; int offset_w; int offset_h; @@ -495,7 +503,7 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id, pbox++; } - DamageDamageRegion(&pPixmap->drawable, dstRegion); + DamageRegionProcessPending(&pPixmap->drawable); return TRUE; } -- cgit v1.2.3 From 31ea323b4d432b557d7664187f17ccefc6d3947b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 19 Nov 2009 17:52:55 +0100 Subject: st/xorg: Replace compile-time acceleration switch with Option "2DAccel". This option can be used to disable 2D acceleration. DRI2 and XVideo blits will still be accelerated, at least to some degree even with compositing. --- src/gallium/state_trackers/xorg/xorg_dri2.c | 4 ++++ src/gallium/state_trackers/xorg/xorg_driver.c | 5 ++++- src/gallium/state_trackers/xorg/xorg_exa.c | 24 ++++++++++++++---------- src/gallium/state_trackers/xorg/xorg_exa.h | 2 ++ src/gallium/state_trackers/xorg/xorg_tracker.h | 2 +- 5 files changed, 25 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index 9a7c356860..ca3c712dcd 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -276,6 +276,7 @@ driCopyRegion(DrawablePtr pDraw, RegionPtr pRegion, PixmapPtr dst_pixmap; GCPtr gc; RegionPtr copy_clip; + Bool save_accel; /* * In driCreateBuffers we dewrap windows into the @@ -341,8 +342,11 @@ driCopyRegion(DrawablePtr pDraw, RegionPtr pRegion, } } + save_accel = ms->exa->accel; + ms->exa->accel = TRUE; (*gc->ops->CopyArea)(&src_pixmap->drawable, &dst_pixmap->drawable, gc, 0, 0, pDraw->width, pDraw->height, 0, 0); + ms->exa->accel = save_accel; FreeScratchGC(gc); diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 26cf2dd772..d949167adc 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -75,10 +75,12 @@ static Bool PreInit(ScrnInfoPtr pScrn, int flags); typedef enum { OPTION_SW_CURSOR, + OPTION_2D_ACCEL, } modesettingOpts; static const OptionInfoRec Options[] = { {OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE}, + {OPTION_2D_ACCEL, "2DAccel", OPTV_BOOLEAN, {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE} }; @@ -609,7 +611,8 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86SetBlackWhitePixels(pScreen); - ms->exa = xorg_exa_init(pScrn); + ms->exa = xorg_exa_init(pScrn, xf86ReturnOptValBool(ms->Options, + OPTION_2D_ACCEL, TRUE)); ms->debug_fallback = debug_get_bool_option("XORG_DEBUG_FALLBACK", TRUE); xorg_init_video(pScreen); diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 29fc861748..3a51ad2d59 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -46,7 +46,6 @@ #include "util/u_rect.h" #define DEBUG_PRINT 0 -#define ACCEL_ENABLED TRUE /* * Helper functions @@ -376,7 +375,7 @@ ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) XORG_FALLBACK("format %s", pf_name(priv->tex->format)); } - return ACCEL_ENABLED && xorg_solid_bind_state(exa, priv, fg); + return exa->accel && xorg_solid_bind_state(exa, priv, fg); } static void @@ -435,7 +434,7 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, exa->copy.src = src_priv; exa->copy.dst = priv; - return ACCEL_ENABLED; + return exa->accel; } static void @@ -564,7 +563,7 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, render_format_name(pMaskPicture->format)); } - return ACCEL_ENABLED && + return exa->accel && xorg_composite_bind_state(exa, op, pSrcPicture, pMaskPicture, pDstPicture, pSrc ? exaGetPixmapDriverPrivate(pSrc) : NULL, @@ -597,6 +596,9 @@ ExaCheckComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture) { + ScrnInfoPtr pScrn = xf86Screens[pDstPicture->pDrawable->pScreen->myNum]; + modesettingPtr ms = modesettingPTR(pScrn); + struct exa_context *exa = ms->exa; boolean accelerated = xorg_composite_accelerated(op, pSrcPicture, pMaskPicture, @@ -605,7 +607,7 @@ ExaCheckComposite(int op, debug_printf("ExaCheckComposite(%d, %p, %p, %p) = %d\n", op, pSrcPicture, pMaskPicture, pDstPicture, accelerated); #endif - return ACCEL_ENABLED && accelerated; + return exa->accel && accelerated; } static void * @@ -743,10 +745,11 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, bitsPerPixel, devKind, NULL); /* Deal with screen resize */ - if (!priv->tex || - (priv->tex->width[0] != width || - priv->tex->height[0] != height || - priv->tex_flags != priv->flags)) { + if ((exa->accel || priv->flags) && + (!priv->tex || + (priv->tex->width[0] != width || + priv->tex->height[0] != height || + priv->tex_flags != priv->flags))) { struct pipe_texture *texture = NULL; struct pipe_texture template; @@ -861,7 +864,7 @@ xorg_exa_close(ScrnInfoPtr pScrn) } void * -xorg_exa_init(ScrnInfoPtr pScrn) +xorg_exa_init(ScrnInfoPtr pScrn, Bool accel) { modesettingPtr ms = modesettingPTR(pScrn); struct exa_context *exa; @@ -926,6 +929,7 @@ xorg_exa_init(ScrnInfoPtr pScrn) ms->ctx = exa->pipe; exa->renderer = renderer_create(exa->pipe); + exa->accel = accel; return (void *)exa; diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h index 7f4aebb9c3..15cc29d662 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.h +++ b/src/gallium/state_trackers/xorg/xorg_exa.h @@ -24,6 +24,8 @@ struct exa_context float solid_color[4]; boolean has_solid_color; + boolean accel; + /* float[9] projective matrix bound to pictures */ struct { float src[9]; diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h index 6130cf6621..20c9259c7b 100644 --- a/src/gallium/state_trackers/xorg/xorg_tracker.h +++ b/src/gallium/state_trackers/xorg/xorg_tracker.h @@ -131,7 +131,7 @@ xorg_exa_create_root_texture(ScrnInfoPtr pScrn, int depth, int bpp); void * -xorg_exa_init(ScrnInfoPtr pScrn); +xorg_exa_init(ScrnInfoPtr pScrn, Bool accel); void xorg_exa_close(ScrnInfoPtr pScrn); -- cgit v1.2.3 From 367cfca808e74101689dd0acb247f3ec38fc4c7f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 19 Nov 2009 11:37:50 -0700 Subject: softpipe: add missing check in softpipe_is_texture_referenced() Check if the named texture is referenced by the texture cache. --- src/gallium/drivers/softpipe/sp_context.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 94d000a5ac..d325499bf8 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -120,7 +120,7 @@ softpipe_destroy( struct pipe_context *pipe ) * if (the texture is being used as a framebuffer surface) * return PIPE_REFERENCED_FOR_WRITE * else if (the texture is a bound texture source) - * return PIPE_REFERENCED_FOR_READ XXX not done yet + * return PIPE_REFERENCED_FOR_READ * else * return PIPE_UNREFERENCED */ @@ -132,6 +132,7 @@ softpipe_is_texture_referenced( struct pipe_context *pipe, struct softpipe_context *softpipe = softpipe_context( pipe ); unsigned i; + /* check if any of the bound drawing surfaces are this texture */ if (softpipe->dirty_render_cache) { for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) { if (softpipe->framebuffer.cbufs[i] && @@ -145,7 +146,12 @@ softpipe_is_texture_referenced( struct pipe_context *pipe, } } - /* FIXME: we also need to do the same for the texture cache */ + /* check if any of the tex_cache textures are this texture */ + for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { + if (softpipe->tex_cache[i] && + softpipe->tex_cache[i]->texture == texture) + return PIPE_REFERENCED_FOR_READ; + } return PIPE_UNREFERENCED; } -- cgit v1.2.3 From 90e69c81e445136b7d14c569cab5b517b8073498 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 19 Nov 2009 19:46:21 +0000 Subject: pb: Make fenced buffers threadsafe. --- .../auxiliary/pipebuffer/pb_buffer_fenced.c | 280 ++++++++++++--------- 1 file changed, 168 insertions(+), 112 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c index 2ef4293d4d..2f973684f6 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c @@ -1,6 +1,6 @@ /************************************************************************** * - * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas. + * Copyright 2007-2009 VMware, Inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a @@ -18,7 +18,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. @@ -80,11 +80,27 @@ struct fenced_buffer_list */ struct fenced_buffer { + /* + * Immutable members. + */ + struct pb_buffer base; - struct pb_buffer *buffer; + struct fenced_buffer_list *list; + + /** + * Protected by fenced_buffer_list::mutex + */ + struct list_head head; - /* FIXME: protect access with mutex */ + /** + * Following members are mutable and protected by this mutex. + * + * You may lock this mutex alone, or lock it with fenced_buffer_list::mutex + * held, but in order to prevent deadlocks you must never lock + * fenced_buffer_list::mutex with this mutex held. + */ + pipe_mutex mutex; /** * A bitmask of PIPE_BUFFER_USAGE_CPU/GPU_READ/WRITE describing the current @@ -96,9 +112,6 @@ struct fenced_buffer struct pb_validate *vl; unsigned validation_flags; struct pipe_fence_handle *fence; - - struct list_head head; - struct fenced_buffer_list *list; }; @@ -110,15 +123,24 @@ fenced_buffer(struct pb_buffer *buf) } +/** + * Add the buffer to the fenced list. + * + * fenced_buffer_list::mutex and fenced_buffer::mutex must be held, in this + * order before calling this function. + * + * Reference count should be incremented before calling this function. + */ static INLINE void -_fenced_buffer_add(struct fenced_buffer *fenced_buf) +fenced_buffer_add_locked(struct fenced_buffer_list *fenced_list, + struct fenced_buffer *fenced_buf) { - struct fenced_buffer_list *fenced_list = fenced_buf->list; - assert(pipe_is_referenced(&fenced_buf->base.base.reference)); assert(fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE); assert(fenced_buf->fence); + /* TODO: Move the reference count increment here */ + #ifdef DEBUG LIST_DEL(&fenced_buf->head); assert(fenced_list->numUnfenced); @@ -130,32 +152,16 @@ _fenced_buffer_add(struct fenced_buffer *fenced_buf) /** - * Actually destroy the buffer. + * Remove the buffer from the fenced list. + * + * fenced_buffer_list::mutex and fenced_buffer::mutex must be held, in this + * order before calling this function. + * + * Reference count should be decremented after calling this function. */ static INLINE void -_fenced_buffer_destroy(struct fenced_buffer *fenced_buf) -{ - struct fenced_buffer_list *fenced_list = fenced_buf->list; - - assert(!pipe_is_referenced(&fenced_buf->base.base.reference)); - assert(!fenced_buf->fence); -#ifdef DEBUG - assert(fenced_buf->head.prev); - assert(fenced_buf->head.next); - LIST_DEL(&fenced_buf->head); - assert(fenced_list->numUnfenced); - --fenced_list->numUnfenced; -#else - (void)fenced_list; -#endif - pb_reference(&fenced_buf->buffer, NULL); - FREE(fenced_buf); -} - - -static INLINE void -_fenced_buffer_remove(struct fenced_buffer_list *fenced_list, - struct fenced_buffer *fenced_buf) +fenced_buffer_remove_locked(struct fenced_buffer_list *fenced_list, + struct fenced_buffer *fenced_buf) { struct pb_fence_ops *ops = fenced_list->ops; @@ -177,37 +183,53 @@ _fenced_buffer_remove(struct fenced_buffer_list *fenced_list, ++fenced_list->numUnfenced; #endif - /** - * FIXME!!! - */ - - if(!pipe_is_referenced(&fenced_buf->base.base.reference)) - _fenced_buffer_destroy(fenced_buf); + /* TODO: Move the reference count decrement and destruction here */ } +/** + * Wait for the fence to expire, and remove it from the fenced list. + * + * fenced_buffer::mutex must be held. fenced_buffer_list::mutex must not be + * held -- it will + */ static INLINE enum pipe_error -_fenced_buffer_finish(struct fenced_buffer *fenced_buf) +fenced_buffer_finish_locked(struct fenced_buffer_list *fenced_list, + struct fenced_buffer *fenced_buf) { - struct fenced_buffer_list *fenced_list = fenced_buf->list; struct pb_fence_ops *ops = fenced_list->ops; + enum pipe_error ret = PIPE_ERROR; #if 0 debug_warning("waiting for GPU"); #endif + assert(pipe_is_referenced(&fenced_buf->base.base.reference)); assert(fenced_buf->fence); + + /* Acquire the global lock */ + pipe_mutex_unlock(fenced_buf->mutex); + pipe_mutex_lock(fenced_list->mutex); + pipe_mutex_lock(fenced_buf->mutex); + if(fenced_buf->fence) { - if(ops->fence_finish(ops, fenced_buf->fence, 0) != 0) { - return PIPE_ERROR; + if(ops->fence_finish(ops, fenced_buf->fence, 0) == 0) { + /* Remove from the fenced list */ + /* TODO: remove consequents */ + fenced_buffer_remove_locked(fenced_list, fenced_buf); + + p_atomic_dec(&fenced_buf->base.base.reference.count); + assert(pipe_is_referenced(&fenced_buf->base.base.reference)); + + fenced_buf->flags &= ~PIPE_BUFFER_USAGE_GPU_READ_WRITE; + + ret = PIPE_OK; } - /* Remove from the fenced list */ - /* TODO: remove consequents */ - _fenced_buffer_remove(fenced_list, fenced_buf); } - fenced_buf->flags &= ~PIPE_BUFFER_USAGE_GPU_READ_WRITE; - return PIPE_OK; + pipe_mutex_unlock(fenced_list->mutex); + + return ret; } @@ -215,7 +237,7 @@ _fenced_buffer_finish(struct fenced_buffer *fenced_buf) * Free as many fenced buffers from the list head as possible. */ static void -_fenced_buffer_list_check_free(struct fenced_buffer_list *fenced_list, +fenced_buffer_list_check_free_locked(struct fenced_buffer_list *fenced_list, int wait) { struct pb_fence_ops *ops = fenced_list->ops; @@ -228,21 +250,28 @@ _fenced_buffer_list_check_free(struct fenced_buffer_list *fenced_list, while(curr != &fenced_list->delayed) { fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head); + pipe_mutex_lock(fenced_buf->mutex); + if(fenced_buf->fence != prev_fence) { int signaled; if (wait) signaled = ops->fence_finish(ops, fenced_buf->fence, 0); else signaled = ops->fence_signalled(ops, fenced_buf->fence, 0); - if (signaled != 0) + if (signaled != 0) { + pipe_mutex_unlock(fenced_buf->mutex); break; + } prev_fence = fenced_buf->fence; } else { assert(ops->fence_signalled(ops, fenced_buf->fence, 0) == 0); } - _fenced_buffer_remove(fenced_list, fenced_buf); + fenced_buffer_remove_locked(fenced_list, fenced_buf); + pipe_mutex_unlock(fenced_buf->mutex); + + pb_reference((struct pb_buffer **)&fenced_buf, NULL); curr = next; next = curr->next; @@ -256,30 +285,25 @@ fenced_buffer_destroy(struct pb_buffer *buf) struct fenced_buffer *fenced_buf = fenced_buffer(buf); struct fenced_buffer_list *fenced_list = fenced_buf->list; - pipe_mutex_lock(fenced_list->mutex); 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) { - struct list_head *curr, *prev; - curr = &fenced_buf->head; - prev = curr->prev; - do { - fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head); - assert(ops->fence_signalled(ops, fenced_buf->fence, 0) == 0); - _fenced_buffer_remove(fenced_list, fenced_buf); - curr = prev; - prev = curr->prev; - } while (curr != &fenced_list->delayed); - } - else { - /* delay destruction */ - } - } - else { - _fenced_buffer_destroy(fenced_buf); - } + assert(!fenced_buf->fence); + +#ifdef DEBUG + pipe_mutex_lock(fenced_list->mutex); + assert(fenced_buf->head.prev); + assert(fenced_buf->head.next); + LIST_DEL(&fenced_buf->head); + assert(fenced_list->numUnfenced); + --fenced_list->numUnfenced; pipe_mutex_unlock(fenced_list->mutex); +#else + (void)fenced_list; +#endif + + pb_reference(&fenced_buf->buffer, NULL); + + pipe_mutex_destroy(fenced_buf->mutex); + FREE(fenced_buf); } @@ -290,24 +314,23 @@ fenced_buffer_map(struct pb_buffer *buf, struct fenced_buffer *fenced_buf = fenced_buffer(buf); struct fenced_buffer_list *fenced_list = fenced_buf->list; struct pb_fence_ops *ops = fenced_list->ops; - void *map; + void *map = NULL; + + pipe_mutex_lock(fenced_buf->mutex); assert(!(flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE)); /* Serialize writes */ if((fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_WRITE) || ((fenced_buf->flags & PIPE_BUFFER_USAGE_GPU_READ) && (flags & PIPE_BUFFER_USAGE_CPU_WRITE))) { - if(flags & PIPE_BUFFER_USAGE_DONTBLOCK) { + if((flags & PIPE_BUFFER_USAGE_DONTBLOCK) && + ops->fence_signalled(ops, fenced_buf->fence, 0) == 0) { /* Don't wait for the GPU to finish writing */ - if(ops->fence_signalled(ops, fenced_buf->fence, 0) == 0) - _fenced_buffer_remove(fenced_list, fenced_buf); - else - return NULL; - } - else { - /* Wait for the GPU to finish writing */ - _fenced_buffer_finish(fenced_buf); + goto finish; } + + /* Wait for the GPU to finish writing */ + fenced_buffer_finish_locked(fenced_list, fenced_buf); } #if 0 @@ -324,6 +347,9 @@ fenced_buffer_map(struct pb_buffer *buf, fenced_buf->flags |= flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE; } +finish: + pipe_mutex_unlock(fenced_buf->mutex); + return map; } @@ -332,6 +358,9 @@ static void fenced_buffer_unmap(struct pb_buffer *buf) { struct fenced_buffer *fenced_buf = fenced_buffer(buf); + + pipe_mutex_lock(fenced_buf->mutex); + assert(fenced_buf->mapcount); if(fenced_buf->mapcount) { pb_unmap(fenced_buf->buffer); @@ -339,6 +368,8 @@ fenced_buffer_unmap(struct pb_buffer *buf) if(!fenced_buf->mapcount) fenced_buf->flags &= ~PIPE_BUFFER_USAGE_CPU_READ_WRITE; } + + pipe_mutex_unlock(fenced_buf->mutex); } @@ -350,11 +381,14 @@ fenced_buffer_validate(struct pb_buffer *buf, struct fenced_buffer *fenced_buf = fenced_buffer(buf); enum pipe_error ret; + pipe_mutex_lock(fenced_buf->mutex); + if(!vl) { /* invalidate */ fenced_buf->vl = NULL; fenced_buf->validation_flags = 0; - return PIPE_OK; + ret = PIPE_OK; + goto finish; } assert(flags & PIPE_BUFFER_USAGE_GPU_READ_WRITE); @@ -362,14 +396,17 @@ fenced_buffer_validate(struct pb_buffer *buf, flags &= PIPE_BUFFER_USAGE_GPU_READ_WRITE; /* Buffer cannot be validated in two different lists */ - if(fenced_buf->vl && fenced_buf->vl != vl) - return PIPE_ERROR_RETRY; + if(fenced_buf->vl && fenced_buf->vl != vl) { + ret = PIPE_ERROR_RETRY; + goto finish; + } #if 0 /* Do not validate if buffer is still mapped */ if(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE) { /* TODO: wait for the thread that mapped the buffer to unmap it */ - return PIPE_ERROR_RETRY; + ret = PIPE_ERROR_RETRY; + goto finish; } /* Final sanity checking */ assert(!(fenced_buf->flags & PIPE_BUFFER_USAGE_CPU_READ_WRITE)); @@ -379,17 +416,21 @@ fenced_buffer_validate(struct pb_buffer *buf, if(fenced_buf->vl == vl && (fenced_buf->validation_flags & flags) == flags) { /* Nothing to do -- buffer already validated */ - return PIPE_OK; + ret = PIPE_OK; + goto finish; } ret = pb_validate(fenced_buf->buffer, vl, flags); if (ret != PIPE_OK) - return ret; + goto finish; fenced_buf->vl = vl; fenced_buf->validation_flags |= flags; - return PIPE_OK; +finish: + pipe_mutex_unlock(fenced_buf->mutex); + + return ret; } @@ -404,29 +445,36 @@ fenced_buffer_fence(struct pb_buffer *buf, fenced_buf = fenced_buffer(buf); fenced_list = fenced_buf->list; ops = fenced_list->ops; - - if(fence == fenced_buf->fence) { - /* Nothing to do */ - return; - } - assert(fenced_buf->vl); - assert(fenced_buf->validation_flags); - pipe_mutex_lock(fenced_list->mutex); - if (fenced_buf->fence) - _fenced_buffer_remove(fenced_list, fenced_buf); - if (fence) { - ops->fence_reference(ops, &fenced_buf->fence, fence); - fenced_buf->flags |= fenced_buf->validation_flags; - _fenced_buffer_add(fenced_buf); - } - pipe_mutex_unlock(fenced_list->mutex); + pipe_mutex_lock(fenced_buf->mutex); + + assert(pipe_is_referenced(&fenced_buf->base.base.reference)); + + if(fence != fenced_buf->fence) { + assert(fenced_buf->vl); + assert(fenced_buf->validation_flags); + + if (fenced_buf->fence) { + fenced_buffer_remove_locked(fenced_list, fenced_buf); + p_atomic_dec(&fenced_buf->base.base.reference.count); + assert(pipe_is_referenced(&fenced_buf->base.base.reference)); + } + if (fence) { + ops->fence_reference(ops, &fenced_buf->fence, fence); + fenced_buf->flags |= fenced_buf->validation_flags; + p_atomic_inc(&fenced_buf->base.base.reference.count); + fenced_buffer_add_locked(fenced_list, fenced_buf); + } + + pb_fence(fenced_buf->buffer, fence); - pb_fence(fenced_buf->buffer, fence); + fenced_buf->vl = NULL; + fenced_buf->validation_flags = 0; + } - fenced_buf->vl = NULL; - fenced_buf->validation_flags = 0; + pipe_mutex_unlock(fenced_buf->mutex); + pipe_mutex_unlock(fenced_list->mutex); } @@ -436,6 +484,7 @@ fenced_buffer_get_base_buffer(struct pb_buffer *buf, pb_size *offset) { struct fenced_buffer *fenced_buf = fenced_buffer(buf); + /* NOTE: accesses immutable members only -- mutex not necessary */ pb_get_base_buffer(fenced_buf->buffer, base_buf, offset); } @@ -475,6 +524,8 @@ fenced_buffer_create(struct fenced_buffer_list *fenced_list, buf->buffer = buffer; buf->list = fenced_list; + pipe_mutex_init(buf->mutex); + #ifdef DEBUG pipe_mutex_lock(fenced_list->mutex); LIST_ADDTAIL(&buf->head, &fenced_list->unfenced); @@ -516,7 +567,7 @@ fenced_buffer_list_check_free(struct fenced_buffer_list *fenced_list, int wait) { pipe_mutex_lock(fenced_list->mutex); - _fenced_buffer_list_check_free(fenced_list, wait); + fenced_buffer_list_check_free_locked(fenced_list, wait); pipe_mutex_unlock(fenced_list->mutex); } @@ -538,11 +589,13 @@ fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list) next = curr->next; while(curr != &fenced_list->unfenced) { fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head); + pipe_mutex_lock(fenced_buf->mutex); assert(!fenced_buf->fence); debug_printf("%10p %7u %7u\n", (void *) fenced_buf, fenced_buf->base.base.size, p_atomic_read(&fenced_buf->base.base.reference.count)); + pipe_mutex_unlock(fenced_buf->mutex); curr = next; next = curr->next; } @@ -552,6 +605,7 @@ fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list) while(curr != &fenced_list->delayed) { int signaled; fenced_buf = LIST_ENTRY(struct fenced_buffer, curr, head); + pipe_mutex_lock(fenced_buf->mutex); signaled = ops->fence_signalled(ops, fenced_buf->fence, 0); debug_printf("%10p %7u %7u %10p %s\n", (void *) fenced_buf, @@ -559,6 +613,7 @@ fenced_buffer_list_dump(struct fenced_buffer_list *fenced_list) p_atomic_read(&fenced_buf->base.base.reference.count), (void *) fenced_buf->fence, signaled == 0 ? "y" : "n"); + pipe_mutex_unlock(fenced_buf->mutex); curr = next; next = curr->next; } @@ -579,8 +634,8 @@ fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list) #if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS) sched_yield(); #endif - _fenced_buffer_list_check_free(fenced_list, 1); pipe_mutex_lock(fenced_list->mutex); + fenced_buffer_list_check_free_locked(fenced_list, 1); } #ifdef DEBUG @@ -588,6 +643,7 @@ fenced_buffer_list_destroy(struct fenced_buffer_list *fenced_list) #endif pipe_mutex_unlock(fenced_list->mutex); + pipe_mutex_destroy(fenced_list->mutex); fenced_list->ops->destroy(fenced_list->ops); -- cgit v1.2.3 From 6345a7ba447d3e04b939ead6fee44fe9201ec2e3 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Thu, 19 Nov 2009 16:05:43 -0500 Subject: r600 : check in shader code test enable flag: if flag R600_ENABLE_GLSL_TEST defined, IL shader code will goto r600 assembler. The test base is /mesa/progs/glsl/brick, and changes shader code in CH06-brick.frag/vert to test different logic op combination. (if,else,while,function,...). The stack depth code is not in yet, so it is hard coded now. So complex code would not run (such as things like 8 loops embeded loop in loop). --- src/mesa/drivers/dri/r600/r600_context.c | 54 +++++++++++++++++++++++++++--- src/mesa/drivers/dri/r600/r700_assembler.c | 44 +++++++++++++++--------- 2 files changed, 77 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index dbd233729c..ca0a670f3c 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -72,7 +72,9 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "vblank.h" #include "utils.h" -#include "xmlpool.h" /* for symbolic values of enum-type options */ +#include "xmlpool.h" /* for symbolic values of enum-type options */ + +//#define R600_ENABLE_GLSL_TEST 1 #define need_GL_VERSION_2_0 #define need_GL_ARB_occlusion_query @@ -154,8 +156,12 @@ static const struct dri_extension mm_extensions[] = { * The GL 2.0 functions are needed to make display lists work with * functions added by GL_ATI_separate_stencil. */ -static const struct dri_extension gl_20_extension[] = { - {"GL_VERSION_2_0", GL_VERSION_2_0_functions }, +static const struct dri_extension gl_20_extension[] = { +#ifdef R600_ENABLE_GLSL_TEST + {"GL_ARB_shading_language_100", GL_VERSION_2_0_functions }, +#else + {"GL_VERSION_2_0", GL_VERSION_2_0_functions }, +#endif /* R600_ENABLE_GLSL_TEST */ }; static const struct tnl_pipeline_stage *r600_pipeline[] = { @@ -306,7 +312,28 @@ static void r600InitGLExtensions(GLcontext *ctx) driInitExtensions(ctx, card_extensions, GL_TRUE); if (r600->radeon.radeonScreen->kernel_mm) - driInitExtensions(ctx, mm_extensions, GL_FALSE); + driInitExtensions(ctx, mm_extensions, GL_FALSE); + +#ifdef R600_ENABLE_GLSL_TEST + driInitExtensions(ctx, gl_20_extension, GL_TRUE); + //_mesa_enable_2_0_extensions(ctx); + //1.5 + ctx->Extensions.ARB_occlusion_query = GL_TRUE; + ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE; + ctx->Extensions.EXT_shadow_funcs = GL_TRUE; + //2.0 + ctx->Extensions.ARB_draw_buffers = GL_TRUE; + ctx->Extensions.ARB_point_sprite = GL_TRUE; + ctx->Extensions.ARB_shader_objects = GL_TRUE; + ctx->Extensions.ARB_vertex_shader = GL_TRUE; + ctx->Extensions.ARB_fragment_shader = GL_TRUE; + ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE; + ctx->Extensions.EXT_blend_equation_separate = GL_TRUE; + ctx->Extensions.ATI_separate_stencil = GL_TRUE; + + /* glsl compiler has problem if this is not GL_TRUE */ + ctx->Shader.EmitCondCodes = GL_TRUE; +#endif /* R600_ENABLE_GLSL_TEST */ if (driQueryOptionb (&r600->radeon.optionCache, "disable_stencil_two_side")) @@ -341,7 +368,24 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual, assert(glVisual); assert(driContextPriv); - assert(screen); + assert(screen); + + //richard test + FILE *pFile = NULL; + unsigned long ulByteToWrite = 0; + char szStr[1024]; + + pFile = fopen("//home//richard//rtp-log//func_call.log", "a+"); + if(NULL != pFile) + { + sprintf(szStr, "r600CreateContext \r\n"); + ulByteToWrite = strlen(szStr); + fwrite(szStr, 1, ulByteToWrite, pFile); + + fclose(pFile); + pFile = NULL; + } + //------------- /* Allocate the R600 context */ r600 = (context_t*) CALLOC(sizeof(*r600)); diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 6e8d1cd927..16ac920f29 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -4983,17 +4983,31 @@ GLboolean assemble_EXPORT(r700_AssemblerBase *pAsm) inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason) { - switch (uReason) - { - case FC_PUSH_VPM: - break; - case FC_PUSH_WQM: - break; - case FC_LOOP: - break; - case FC_REP: - break; - }; + switch (uReason) + { + case FC_PUSH_VPM: + pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs++; + pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.current++; + break; + case FC_PUSH_WQM: + pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs++; + pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.current += 4; + break; + case FC_LOOP: + pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs += 4; + break; + case FC_REP: + /* TODO : for 16 vp asic, should += 2; */ + pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs += 1; + break; + }; + + if(pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs + > pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.max) + { + pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.max = + pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs; + } } GLboolean jumpToOffest(r700_AssemblerBase *pAsm, GLuint pops, GLint offset) @@ -5092,10 +5106,6 @@ GLboolean assemble_IF(r700_AssemblerBase *pAsm, GLboolean bHasElse) GLboolean assemble_ELSE(r700_AssemblerBase *pAsm) { -#ifdef USE_CF_FOR_POP_AFTER - pops(pAsm, 1); -#endif /* USE_CF_FOR_POP_AFTER */ - if(GL_FALSE == add_cf_instruction(pAsm) ) { return GL_FALSE; @@ -5647,7 +5657,9 @@ GLboolean testFlag(r700_AssemblerBase *pAsm) { return GL_FALSE; } -#endif +#endif + + checkStackDepth(pAsm, FC_PUSH_VPM); return GL_TRUE; } -- cgit v1.2.3 From 3f4016650099642f900fc169c078b1d78128899a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 19 Nov 2009 14:02:06 -0700 Subject: softpipe: whitespace/indentation fixes --- src/gallium/drivers/softpipe/sp_context.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index d325499bf8..5f60139968 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -249,9 +249,9 @@ softpipe_create( struct pipe_screen *screen ) /* setup quad rendering stages */ - softpipe->quad.shade = sp_quad_shade_stage(softpipe); - softpipe->quad.depth_test = sp_quad_depth_test_stage(softpipe); - softpipe->quad.blend = sp_quad_blend_stage(softpipe); + softpipe->quad.shade = sp_quad_shade_stage(softpipe); + softpipe->quad.depth_test = sp_quad_depth_test_stage(softpipe); + softpipe->quad.blend = sp_quad_blend_stage(softpipe); /* @@ -281,7 +281,6 @@ softpipe_create( struct pipe_screen *screen ) draw_set_render(softpipe->draw, softpipe->vbuf_backend); - /* plug in AA line/point stages */ draw_install_aaline_stage(softpipe->draw, &softpipe->pipe); draw_install_aapoint_stage(softpipe->draw, &softpipe->pipe); @@ -297,4 +296,3 @@ softpipe_create( struct pipe_screen *screen ) softpipe_destroy(&softpipe->pipe); return NULL; } - -- cgit v1.2.3 From 273f4d6b5fe125bf0cba44c5ee8b25c76d3396c0 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 19 Nov 2009 14:10:57 -0700 Subject: st/mesa: remove pointless assertion --- src/mesa/state_tracker/st_cb_texture.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 9186db76e1..5283ece551 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -1724,8 +1724,6 @@ copy_image_data_to_texture(struct st_context *st, pipe_texture_reference(&stImage->pt, NULL); } else if (stImage->base.Data) { - assert(stImage->base.Data != NULL); - /* More straightforward upload. */ -- cgit v1.2.3 From 92863109af05acdb4ee5e42141c83ab0f18b7f88 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 19 Nov 2009 14:17:09 -0700 Subject: st/mesa: remove is_compressed_mesa_format() --- src/mesa/state_tracker/st_cb_texture.c | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 5283ece551..76b6bbeb4b 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -119,25 +119,6 @@ compressed_num_bytes(gl_format format) } -static GLboolean -is_compressed_mesa_format(gl_format format) -{ - switch (format) { - case MESA_FORMAT_RGB_DXT1: - case MESA_FORMAT_RGBA_DXT1: - case MESA_FORMAT_RGBA_DXT3: - case MESA_FORMAT_RGBA_DXT5: - 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; - } -} - - /** called via ctx->Driver.NewTextureImage() */ static struct gl_texture_image * st_NewTextureImage(GLcontext * ctx) @@ -663,7 +644,7 @@ st_TexImage(GLcontext * ctx, */ if (!compressed_src && !ctx->Mesa_DXTn && - is_compressed_mesa_format(texImage->TexFormat) && + _mesa_is_format_compressed(texImage->TexFormat) && screen->is_format_supported(screen, stImage->pt->format, stImage->pt->target, @@ -1066,7 +1047,7 @@ st_TexSubimage(GLcontext *ctx, GLint dims, GLenum target, GLint level, /* See if we can do texture compression with a blit/render. */ if (!ctx->Mesa_DXTn && - is_compressed_mesa_format(texImage->TexFormat) && + _mesa_is_format_compressed(texImage->TexFormat) && screen->is_format_supported(screen, stImage->pt->format, stImage->pt->target, -- cgit v1.2.3 From dc41d62250ce51f28e94f1d365836ac9f2ff8907 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 19 Nov 2009 14:35:38 -0700 Subject: st/mesa: get rid of compressed_num_bytes() code --- src/mesa/state_tracker/st_cb_texture.c | 40 ++++------------------------------ 1 file changed, 4 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 76b6bbeb4b..d4630a514f 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -93,32 +93,6 @@ gl_target_to_pipe(GLenum target) } -/** - * Return nominal bytes per texel for a compressed format, 0 for non-compressed - * format. - */ -static GLuint -compressed_num_bytes(gl_format format) -{ - switch (format) { -#if FEATURE_texture_fxt1 - case MESA_FORMAT_RGB_FXT1: - case MESA_FORMAT_RGBA_FXT1: -#endif -#if FEATURE_texture_s3tc - case MESA_FORMAT_RGB_DXT1: - case MESA_FORMAT_RGBA_DXT1: - return 2; - case MESA_FORMAT_RGBA_DXT3: - case MESA_FORMAT_RGBA_DXT5: - return 4; -#endif - default: - return 0; - } -} - - /** called via ctx->Driver.NewTextureImage() */ static struct gl_texture_image * st_NewTextureImage(GLcontext * ctx) @@ -1743,7 +1717,7 @@ st_finalize_texture(GLcontext *ctx, { struct st_texture_object *stObj = st_texture_object(tObj); const GLuint nr_faces = (stObj->base.Target == GL_TEXTURE_CUBE_MAP) ? 6 : 1; - GLuint cpp, face; + GLuint blockSize, face; struct st_texture_image *firstImage; *needFlush = GL_FALSE; @@ -1775,13 +1749,8 @@ st_finalize_texture(GLcontext *ctx, pipe_texture_reference(&stObj->pt, firstImage->pt); } - /* FIXME: determine format block instead of cpp */ - if (_mesa_is_format_compressed(firstImage->base.TexFormat)) { - cpp = compressed_num_bytes(firstImage->base.TexFormat); - } - else { - cpp = _mesa_get_format_bytes(firstImage->base.TexFormat); - } + /* bytes per pixel block (blocks are usually 1x1) */ + blockSize = _mesa_get_format_bytes(firstImage->base.TexFormat); /* If we already have a gallium texture, check that it matches the texture * object's format, target, size, num_levels, etc. @@ -1795,8 +1764,7 @@ st_finalize_texture(GLcontext *ctx, stObj->pt->width[0] != firstImage->base.Width2 || stObj->pt->height[0] != firstImage->base.Height2 || stObj->pt->depth[0] != firstImage->base.Depth2 || - /* Nominal bytes per pixel: */ - stObj->pt->block.size / stObj->pt->block.width != cpp) + stObj->pt->block.size != blockSize) { pipe_texture_reference(&stObj->pt, NULL); ctx->st->dirty.st |= ST_NEW_FRAMEBUFFER; -- cgit v1.2.3 From 48dfd3938e428295c45692cfde0a2afff04a7970 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Thu, 19 Nov 2009 16:55:16 -0500 Subject: r600 : change shader pop method for now. --- src/mesa/drivers/dri/r600/r700_assembler.c | 54 +++++++++++++++--------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 16ac920f29..e3bc46802f 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -39,7 +39,7 @@ #include "r700_assembler.h" #define USE_CF_FOR_CONTINUE_BREAK 1 -#define USE_CF_FOR_POP_AFTER 1 +//#define USE_CF_FOR_POP_AFTER 1 BITS addrmode_PVSDST(PVSDST * pPVSDST) { @@ -4983,30 +4983,30 @@ GLboolean assemble_EXPORT(r700_AssemblerBase *pAsm) inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason) { - switch (uReason) - { - case FC_PUSH_VPM: - pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs++; - pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.current++; - break; - case FC_PUSH_WQM: - pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs++; - pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.current += 4; - break; - case FC_LOOP: - pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs += 4; - break; - case FC_REP: - /* TODO : for 16 vp asic, should += 2; */ - pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs += 1; - break; - }; - - if(pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs - > pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.max) - { - pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.max = - pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs; + switch (uReason) + { + case FC_PUSH_VPM: + pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs++; + pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.current++; + break; + case FC_PUSH_WQM: + pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs++; + pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.current += 4; + break; + case FC_LOOP: + pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs += 4; + break; + case FC_REP: + /* TODO : for 16 vp asic, should += 2; */ + pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs += 1; + break; + }; + + if(pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs + > pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.max) + { + pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.max = + pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs; } } @@ -5657,8 +5657,8 @@ GLboolean testFlag(r700_AssemblerBase *pAsm) { return GL_FALSE; } -#endif - +#endif + checkStackDepth(pAsm, FC_PUSH_VPM); return GL_TRUE; -- cgit v1.2.3 From 2198497203ec427f836978098028abf3350e5e57 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 19 Nov 2009 15:17:56 -0700 Subject: vbo: added recursion check in vbo_exec_FlushVertices() --- src/mesa/vbo/vbo_exec_api.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index f72d2d84f3..c90565eae8 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -867,15 +867,27 @@ void vbo_exec_FlushVertices_internal( GLcontext *ctx, GLboolean unmap ) } - +/** + * \param flags bitmask of FLUSH_STORED_VERTICES, FLUSH_UPDATE_CURRENT + */ void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags ) { struct vbo_exec_context *exec = &vbo_context(ctx)->exec; +#ifdef DEBUG + /* debug check: make sure we don't get called recursively */ + static GLuint callDepth = 0; + callDepth++; + assert(callDepth == 1); +#endif + if (0) _mesa_printf("%s\n", __FUNCTION__); if (exec->ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { if (0) _mesa_printf("%s - inside begin/end\n", __FUNCTION__); +#ifdef DEBUG + callDepth--; +#endif return; } @@ -889,6 +901,10 @@ void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags ) } exec->ctx->Driver.NeedFlush &= ~flags; + +#ifdef DEBUG + callDepth--; +#endif } -- cgit v1.2.3 From 4e6c79ac166b71414f09e671aaad0e1d0d406e42 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 19 Nov 2009 15:18:17 -0700 Subject: st/mesa: replace st_flush() with pipe->flush() We only need to flush the gallium driver in this case. Fixes a recursive state validation bug. --- src/mesa/state_tracker/st_texture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index 3945822f66..10f1351283 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -588,5 +588,5 @@ st_teximage_flush_before_map(struct st_context *st, if (referenced && ((referenced & PIPE_REFERENCED_FOR_WRITE) || (usage & PIPE_TRANSFER_WRITE))) - st_flush(st, PIPE_FLUSH_RENDER_CACHE, NULL); + st->pipe->flush(st->pipe, PIPE_FLUSH_RENDER_CACHE, NULL); } -- cgit v1.2.3 From 683e35f726a182ed9fc6b6d5cb07146eebe14dea Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 19 Nov 2009 14:39:34 -0800 Subject: gallium: don't use arrays for texture width,height,depth --- src/gallium/auxiliary/draw/draw_pipe_aaline.c | 10 +-- src/gallium/auxiliary/draw/draw_pipe_pstipple.c | 6 +- src/gallium/auxiliary/util/u_blit.c | 26 +++---- src/gallium/auxiliary/util/u_gen_mipmap.c | 25 +++--- src/gallium/auxiliary/util/u_math.h | 4 +- src/gallium/auxiliary/util/u_surface.c | 6 +- src/gallium/auxiliary/vl/vl_compositor.c | 12 +-- src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 22 +++--- src/gallium/drivers/i915/i915_state_sampler.c | 2 +- src/gallium/drivers/i915/i915_texture.c | 96 +++++++++++------------- src/gallium/drivers/softpipe/sp_tex_sample.c | 58 +++++++------- src/gallium/drivers/softpipe/sp_tex_tile_cache.c | 7 +- src/gallium/drivers/softpipe/sp_texture.c | 49 ++++++------ src/gallium/drivers/trace/tr_dump_state.c | 6 +- src/gallium/drivers/trace/tr_rbug.c | 6 +- src/gallium/include/pipe/p_state.h | 6 +- src/mesa/state_tracker/st_atom_framebuffer.c | 5 +- src/mesa/state_tracker/st_atom_pixeltransfer.c | 2 +- src/mesa/state_tracker/st_cb_drawpixels.c | 4 +- src/mesa/state_tracker/st_cb_fbo.c | 6 +- src/mesa/state_tracker/st_cb_readpixels.c | 2 +- src/mesa/state_tracker/st_cb_texture.c | 12 +-- src/mesa/state_tracker/st_gen_mipmap.c | 39 +++++----- src/mesa/state_tracker/st_texture.c | 36 ++++----- 24 files changed, 226 insertions(+), 221 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index 9f956715a2..31de84b272 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -398,9 +398,9 @@ aaline_create_texture(struct aaline_stage *aaline) texTemp.target = PIPE_TEXTURE_2D; texTemp.format = PIPE_FORMAT_A8_UNORM; /* XXX verify supported by driver! */ texTemp.last_level = MAX_TEXTURE_LEVEL; - texTemp.width[0] = 1 << MAX_TEXTURE_LEVEL; - texTemp.height[0] = 1 << MAX_TEXTURE_LEVEL; - texTemp.depth[0] = 1; + texTemp.width0 = 1 << MAX_TEXTURE_LEVEL; + texTemp.height0 = 1 << MAX_TEXTURE_LEVEL; + texTemp.depth0 = 1; pf_get_block(texTemp.format, &texTemp.block); aaline->texture = screen->texture_create(screen, &texTemp); @@ -413,11 +413,11 @@ aaline_create_texture(struct aaline_stage *aaline) */ for (level = 0; level <= MAX_TEXTURE_LEVEL; level++) { struct pipe_transfer *transfer; - const uint size = aaline->texture->width[level]; + const uint size = u_minify(aaline->texture->width0, level); ubyte *data; uint i, j; - assert(aaline->texture->width[level] == aaline->texture->height[level]); + assert(aaline->texture->width0 == aaline->texture->height0); /* This texture is new, no need to flush. */ diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c index 283502cdf3..27d89721b1 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c @@ -427,9 +427,9 @@ pstip_create_texture(struct pstip_stage *pstip) texTemp.target = PIPE_TEXTURE_2D; texTemp.format = PIPE_FORMAT_A8_UNORM; /* XXX verify supported by driver! */ texTemp.last_level = 0; - texTemp.width[0] = 32; - texTemp.height[0] = 32; - texTemp.depth[0] = 1; + texTemp.width0 = 32; + texTemp.height0 = 32; + texTemp.depth0 = 1; pf_get_block(texTemp.format, &texTemp.block); pstip->texture = screen->texture_create(screen, &texTemp); diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 5038642599..5372df5735 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -354,9 +354,9 @@ util_blit_pixels_writemask(struct blit_state *ctx, texTemp.target = PIPE_TEXTURE_2D; texTemp.format = src->format; texTemp.last_level = 0; - texTemp.width[0] = srcW; - texTemp.height[0] = srcH; - texTemp.depth[0] = 1; + texTemp.width0 = srcW; + texTemp.height0 = srcH; + texTemp.depth0 = 1; pf_get_block(src->format, &texTemp.block); tex = screen->texture_create(screen, &texTemp); @@ -389,10 +389,10 @@ util_blit_pixels_writemask(struct blit_state *ctx, } else { pipe_texture_reference(&tex, src->texture); - s0 = srcX0 / (float)tex->width[0]; - s1 = srcX1 / (float)tex->width[0]; - t0 = srcY0 / (float)tex->height[0]; - t1 = srcY1 / (float)tex->height[0]; + s0 = srcX0 / (float)tex->width0; + s1 = srcX1 / (float)tex->width0; + t0 = srcY0 / (float)tex->height0; + t1 = srcY1 / (float)tex->height0; } @@ -518,13 +518,13 @@ util_blit_pixels_tex(struct blit_state *ctx, assert(filter == PIPE_TEX_MIPFILTER_NEAREST || filter == PIPE_TEX_MIPFILTER_LINEAR); - assert(tex->width[0] != 0); - assert(tex->height[0] != 0); + assert(tex->width0 != 0); + assert(tex->height0 != 0); - s0 = srcX0 / (float)tex->width[0]; - s1 = srcX1 / (float)tex->width[0]; - t0 = srcY0 / (float)tex->height[0]; - t1 = srcY1 / (float)tex->height[0]; + s0 = srcX0 / (float)tex->width0; + s1 = srcX1 / (float)tex->width0; + t0 = srcY0 / (float)tex->height0; + t1 = srcY1 / (float)tex->height0; assert(ctx->pipe->screen->is_format_supported(ctx->pipe->screen, dst->format, PIPE_TEXTURE_2D, diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index aa823aa218..84db14576e 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -45,6 +45,7 @@ #include "util/u_draw_quad.h" #include "util/u_gen_mipmap.h" #include "util/u_simple_shaders.h" +#include "util/u_math.h" #include "cso_cache/cso_context.h" @@ -1125,12 +1126,12 @@ make_1d_mipmap(struct gen_mipmap_state *ctx, srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice, PIPE_TRANSFER_READ, 0, 0, - pt->width[srcLevel], - pt->height[srcLevel]); + u_minify(pt->width0, srcLevel), + u_minify(pt->height0, srcLevel)); dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice, PIPE_TRANSFER_WRITE, 0, 0, - pt->width[dstLevel], - pt->height[dstLevel]); + u_minify(pt->width0, dstLevel), + u_minify(pt->height0, dstLevel)); srcMap = (ubyte *) screen->transfer_map(screen, srcTrans); dstMap = (ubyte *) screen->transfer_map(screen, dstTrans); @@ -1168,12 +1169,12 @@ make_2d_mipmap(struct gen_mipmap_state *ctx, srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice, PIPE_TRANSFER_READ, 0, 0, - pt->width[srcLevel], - pt->height[srcLevel]); + u_minify(pt->width0, srcLevel), + u_minify(pt->height0, srcLevel)); dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice, PIPE_TRANSFER_WRITE, 0, 0, - pt->width[dstLevel], - pt->height[dstLevel]); + u_minify(pt->width0, dstLevel), + u_minify(pt->height0, dstLevel)); srcMap = (ubyte *) screen->transfer_map(screen, srcTrans); dstMap = (ubyte *) screen->transfer_map(screen, dstTrans); @@ -1575,8 +1576,8 @@ util_gen_mipmap(struct gen_mipmap_state *ctx, * Setup framebuffer / dest surface */ fb.cbufs[0] = surf; - fb.width = pt->width[dstLevel]; - fb.height = pt->height[dstLevel]; + fb.width = u_minify(pt->width0, dstLevel); + fb.height = u_minify(pt->height0, dstLevel); cso_set_framebuffer(ctx->cso, &fb); /* @@ -1597,8 +1598,8 @@ util_gen_mipmap(struct gen_mipmap_state *ctx, offset = set_vertex_data(ctx, pt->target, face, - (float) pt->width[dstLevel], - (float) pt->height[dstLevel]); + (float) u_minify(pt->width0, dstLevel), + (float) u_minify(pt->height0, dstLevel)); util_draw_vertex_buffer(ctx->pipe, ctx->vbuf, diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index 75b075f160..7a598efc3a 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -507,9 +507,9 @@ align(int value, int alignment) } static INLINE unsigned -minify(unsigned value) +u_minify(unsigned value, unsigned levels) { - return MAX2(1, value >> 1); + return MAX2(1, value >> levels); } #ifndef COPY_4V diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c index 85e443204e..de8c266db8 100644 --- a/src/gallium/auxiliary/util/u_surface.c +++ b/src/gallium/auxiliary/util/u_surface.c @@ -79,9 +79,9 @@ util_create_rgba_surface(struct pipe_screen *screen, templ.target = target; templ.format = format; templ.last_level = 0; - templ.width[0] = width; - templ.height[0] = height; - templ.depth[0] = 1; + templ.width0 = width; + templ.height0 = height; + templ.depth0 = 1; pf_get_block(format, &templ.block); templ.tex_usage = usage; diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index cda6dc134a..592dd17421 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -455,8 +455,8 @@ void vl_compositor_render(struct vl_compositor *compositor, assert(dst_area); assert(picture_type == PIPE_MPEG12_PICTURE_TYPE_FRAME); - compositor->fb_state.width = dst_surface->width[0]; - compositor->fb_state.height = dst_surface->height[0]; + compositor->fb_state.width = dst_surface->width0; + compositor->fb_state.height = dst_surface->height0; compositor->fb_state.cbufs[0] = compositor->pipe->screen->get_tex_surface ( compositor->pipe->screen, @@ -504,12 +504,12 @@ void vl_compositor_render(struct vl_compositor *compositor, vs_consts->dst_trans.z = 0; vs_consts->dst_trans.w = 0; - vs_consts->src_scale.x = src_area->w / (float)src_surface->width[0]; - vs_consts->src_scale.y = src_area->h / (float)src_surface->height[0]; + vs_consts->src_scale.x = src_area->w / (float)src_surface->width0; + vs_consts->src_scale.y = src_area->h / (float)src_surface->height0; vs_consts->src_scale.z = 1; vs_consts->src_scale.w = 1; - vs_consts->src_trans.x = src_area->x / (float)src_surface->width[0]; - vs_consts->src_trans.y = src_area->y / (float)src_surface->height[0]; + vs_consts->src_trans.x = src_area->x / (float)src_surface->width0; + vs_consts->src_trans.y = src_area->y / (float)src_surface->height0; vs_consts->src_trans.z = 0; vs_consts->src_trans.w = 0; diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index c4ba69817f..1934965995 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -681,7 +681,7 @@ xfer_buffers_map(struct vl_mpeg12_mc_renderer *r) ( r->pipe->screen, r->textures.all[i], 0, 0, 0, PIPE_TRANSFER_WRITE, 0, 0, - r->textures.all[i]->width[0], r->textures.all[i]->height[0] + r->textures.all[i]->width0, r->textures.all[i]->height0 ); r->texels[i] = r->pipe->screen->transfer_map(r->pipe->screen, r->tex_transfer[i]); @@ -835,26 +835,26 @@ init_buffers(struct vl_mpeg12_mc_renderer *r) /* TODO: Accomodate HW that can't do this and also for cases when this isn't precise enough */ template.format = PIPE_FORMAT_R16_SNORM; template.last_level = 0; - template.width[0] = r->pot_buffers ? + template.width0 = r->pot_buffers ? util_next_power_of_two(r->picture_width) : r->picture_width; - template.height[0] = r->pot_buffers ? + template.height0 = r->pot_buffers ? util_next_power_of_two(r->picture_height) : r->picture_height; - template.depth[0] = 1; + template.depth0 = 1; pf_get_block(template.format, &template.block); template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_DYNAMIC; r->textures.individual.y = r->pipe->screen->texture_create(r->pipe->screen, &template); if (r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420) { - template.width[0] = r->pot_buffers ? + template.width0 = r->pot_buffers ? util_next_power_of_two(r->picture_width / 2) : r->picture_width / 2; - template.height[0] = r->pot_buffers ? + template.height0 = r->pot_buffers ? util_next_power_of_two(r->picture_height / 2) : r->picture_height / 2; } else if (r->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_422) - template.height[0] = r->pot_buffers ? + template.height0 = r->pot_buffers ? util_next_power_of_two(r->picture_height / 2) : r->picture_height / 2; @@ -1283,8 +1283,8 @@ flush(struct vl_mpeg12_mc_renderer *r) PIPE_BUFFER_USAGE_CPU_WRITE | PIPE_BUFFER_USAGE_DISCARD ); - vs_consts->denorm.x = r->surface->width[0]; - vs_consts->denorm.y = r->surface->height[0]; + vs_consts->denorm.x = r->surface->width0; + vs_consts->denorm.y = r->surface->height0; pipe_buffer_unmap(r->pipe->screen, r->vs_const_buf.buffer); @@ -1633,8 +1633,8 @@ vl_mpeg12_mc_renderer_render_macroblocks(struct vl_mpeg12_mc_renderer renderer->past = past; renderer->future = future; renderer->fence = fence; - renderer->surface_tex_inv_size.x = 1.0f / surface->width[0]; - renderer->surface_tex_inv_size.y = 1.0f / surface->height[0]; + renderer->surface_tex_inv_size.x = 1.0f / surface->width0; + renderer->surface_tex_inv_size.y = 1.0f / surface->height0; } while (num_macroblocks) { diff --git a/src/gallium/drivers/i915/i915_state_sampler.c b/src/gallium/drivers/i915/i915_state_sampler.c index c5e9084d12..cbac4175c8 100644 --- a/src/gallium/drivers/i915/i915_state_sampler.c +++ b/src/gallium/drivers/i915/i915_state_sampler.c @@ -231,7 +231,7 @@ i915_update_texture(struct i915_context *i915, { const struct pipe_texture *pt = &tex->base; uint format, pitch; - const uint width = pt->width[0], height = pt->height[0], depth = pt->depth[0]; + const uint width = pt->width0, height = pt->height0, depth = pt->depth0; const uint num_levels = pt->last_level; unsigned max_lod = num_levels * 4; unsigned tiled = MS3_USE_FENCE_REGS; diff --git a/src/gallium/drivers/i915/i915_texture.c b/src/gallium/drivers/i915/i915_texture.c index 286c9ace8e..c7b86dd4c5 100644 --- a/src/gallium/drivers/i915/i915_texture.c +++ b/src/gallium/drivers/i915/i915_texture.c @@ -105,10 +105,6 @@ i915_miptree_set_level_info(struct i915_texture *tex, assert(level < PIPE_MAX_TEXTURE_LEVELS); - pt->width[level] = w; - pt->height[level] = h; - pt->depth[level] = d; - pt->nblocksx[level] = pf_get_nblocksx(&pt->block, w); pt->nblocksy[level] = pf_get_nblocksy(&pt->block, h); @@ -168,16 +164,16 @@ i915_scanout_layout(struct i915_texture *tex) return FALSE; i915_miptree_set_level_info(tex, 0, 1, - tex->base.width[0], - tex->base.height[0], + tex->base.width0, + tex->base.height0, 1); i915_miptree_set_image_offset(tex, 0, 0, 0, 0); - if (tex->base.width[0] >= 240) { + if (tex->base.width0 >= 240) { tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size); tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8); tex->hw_tiled = INTEL_TILE_X; - } else if (tex->base.width[0] == 64 && tex->base.height[0] == 64) { + } else if (tex->base.width0 == 64 && tex->base.height0 == 64) { tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size); tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8); } else { @@ -185,7 +181,7 @@ i915_scanout_layout(struct i915_texture *tex) } debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__, - tex->base.width[0], tex->base.height[0], pt->block.size, + tex->base.width0, tex->base.height0, pt->block.size, tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy); return TRUE; @@ -203,12 +199,12 @@ i915_display_target_layout(struct i915_texture *tex) return FALSE; /* fallback to normal textures for small textures */ - if (tex->base.width[0] < 240) + if (tex->base.width0 < 240) return FALSE; i915_miptree_set_level_info(tex, 0, 1, - tex->base.width[0], - tex->base.height[0], + tex->base.width0, + tex->base.height0, 1); i915_miptree_set_image_offset(tex, 0, 0, 0, 0); @@ -217,7 +213,7 @@ i915_display_target_layout(struct i915_texture *tex) tex->hw_tiled = INTEL_TILE_X; debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__, - tex->base.width[0], tex->base.height[0], pt->block.size, + tex->base.width0, tex->base.height0, pt->block.size, tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy); return TRUE; @@ -228,8 +224,8 @@ i915_miptree_layout_2d(struct i915_texture *tex) { struct pipe_texture *pt = &tex->base; unsigned level; - unsigned width = pt->width[0]; - unsigned height = pt->height[0]; + unsigned width = pt->width0; + unsigned height = pt->height0; unsigned nblocksx = pt->nblocksx[0]; unsigned nblocksy = pt->nblocksy[0]; @@ -254,8 +250,8 @@ i915_miptree_layout_2d(struct i915_texture *tex) tex->total_nblocksy += nblocksy; - width = minify(width); - height = minify(height); + width = u_minify(width, 1); + height = u_minify(height, 1); nblocksx = pf_get_nblocksx(&pt->block, width); nblocksy = pf_get_nblocksy(&pt->block, height); } @@ -267,9 +263,9 @@ i915_miptree_layout_3d(struct i915_texture *tex) struct pipe_texture *pt = &tex->base; unsigned level; - unsigned width = pt->width[0]; - unsigned height = pt->height[0]; - unsigned depth = pt->depth[0]; + unsigned width = pt->width0; + unsigned height = pt->height0; + unsigned depth = pt->depth0; unsigned nblocksx = pt->nblocksx[0]; unsigned nblocksy = pt->nblocksy[0]; unsigned stack_nblocksy = 0; @@ -285,36 +281,34 @@ i915_miptree_layout_3d(struct i915_texture *tex) stack_nblocksy += MAX2(2, nblocksy); - width = minify(width); - height = minify(height); - depth = minify(depth); + width = u_minify(width, 1); + height = u_minify(height, 1); nblocksx = pf_get_nblocksx(&pt->block, width); nblocksy = pf_get_nblocksy(&pt->block, height); } /* Fixup depth image_offsets: */ - depth = pt->depth[0]; for (level = 0; level <= pt->last_level; level++) { unsigned i; for (i = 0; i < depth; i++) i915_miptree_set_image_offset(tex, level, i, 0, i * stack_nblocksy); - depth = minify(depth); + depth = u_minify(depth, 1); } /* Multiply slice size by texture depth for total size. It's * remarkable how wasteful of memory the i915 texture layouts * are. They are largely fixed in the i945. */ - tex->total_nblocksy = stack_nblocksy * pt->depth[0]; + tex->total_nblocksy = stack_nblocksy * pt->depth0; } static void i915_miptree_layout_cube(struct i915_texture *tex) { struct pipe_texture *pt = &tex->base; - unsigned width = pt->width[0], height = pt->height[0]; + unsigned width = pt->width0, height = pt->height0; const unsigned nblocks = pt->nblocksx[0]; unsigned level; unsigned face; @@ -383,8 +377,8 @@ i945_miptree_layout_2d(struct i915_texture *tex) unsigned level; unsigned x = 0; unsigned y = 0; - unsigned width = pt->width[0]; - unsigned height = pt->height[0]; + unsigned width = pt->width0; + unsigned height = pt->height0; unsigned nblocksx = pt->nblocksx[0]; unsigned nblocksy = pt->nblocksy[0]; @@ -407,8 +401,8 @@ i945_miptree_layout_2d(struct i915_texture *tex) */ if (pt->last_level > 0) { unsigned mip1_nblocksx - = align(pf_get_nblocksx(&pt->block, minify(width)), align_x) - + pf_get_nblocksx(&pt->block, minify(minify(width))); + = align(pf_get_nblocksx(&pt->block, u_minify(width, 1)), align_x) + + pf_get_nblocksx(&pt->block, u_minify(width, 2)); if (mip1_nblocksx > nblocksx) tex->stride = mip1_nblocksx * pt->block.size; @@ -439,8 +433,8 @@ i945_miptree_layout_2d(struct i915_texture *tex) y += nblocksy; } - width = minify(width); - height = minify(height); + width = u_minify(width, 1); + height = u_minify(height, 1); nblocksx = pf_get_nblocksx(&pt->block, width); nblocksy = pf_get_nblocksy(&pt->block, height); } @@ -450,9 +444,9 @@ static void i945_miptree_layout_3d(struct i915_texture *tex) { struct pipe_texture *pt = &tex->base; - unsigned width = pt->width[0]; - unsigned height = pt->height[0]; - unsigned depth = pt->depth[0]; + unsigned width = pt->width0; + unsigned height = pt->height0; + unsigned depth = pt->depth0; unsigned nblocksx = pt->nblocksx[0]; unsigned nblocksy = pt->nblocksy[0]; unsigned pack_x_pitch, pack_x_nr; @@ -495,9 +489,9 @@ i945_miptree_layout_3d(struct i915_texture *tex) pack_y_pitch >>= 1; } - width = minify(width); - height = minify(height); - depth = minify(depth); + width = u_minify(width, 1); + height = u_minify(height, 1); + depth = u_minify(depth, 1); nblocksx = pf_get_nblocksx(&pt->block, width); nblocksy = pf_get_nblocksy(&pt->block, height); } @@ -511,11 +505,11 @@ i945_miptree_layout_cube(struct i915_texture *tex) const unsigned nblocks = pt->nblocksx[0]; unsigned face; - unsigned width = pt->width[0]; - unsigned height = pt->height[0]; + unsigned width = pt->width0; + unsigned height = pt->height0; /* - printf("%s %i, %i\n", __FUNCTION__, pt->width[0], pt->height[0]); + printf("%s %i, %i\n", __FUNCTION__, pt->width0, pt->height0); */ assert(width == height); /* cubemap images are square */ @@ -651,8 +645,8 @@ i915_texture_create(struct pipe_screen *screen, pipe_reference_init(&tex->base.reference, 1); tex->base.screen = screen; - tex->base.nblocksx[0] = pf_get_nblocksx(&tex->base.block, tex->base.width[0]); - tex->base.nblocksy[0] = pf_get_nblocksy(&tex->base.block, tex->base.height[0]); + tex->base.nblocksx[0] = pf_get_nblocksx(&tex->base.block, tex->base.width0); + tex->base.nblocksy[0] = pf_get_nblocksy(&tex->base.block, tex->base.height0); if (is->is_i945) { if (!i945_miptree_layout(tex)) @@ -667,7 +661,7 @@ i915_texture_create(struct pipe_screen *screen, /* for scanouts and cursors, cursors arn't scanouts */ - if (templat->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY && templat->width[0] != 64) + if (templat->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY && templat->width0 != 64) buf_usage = INTEL_NEW_SCANOUT; else buf_usage = INTEL_NEW_TEXTURE; @@ -710,7 +704,7 @@ i915_texture_blanket(struct pipe_screen * screen, /* Only supports one type */ if (base->target != PIPE_TEXTURE_2D || base->last_level != 0 || - base->depth[0] != 1) { + base->depth0 != 1) { return NULL; } @@ -724,7 +718,7 @@ i915_texture_blanket(struct pipe_screen * screen, tex->stride = stride[0]; - i915_miptree_set_level_info(tex, 0, 1, base->width[0], base->height[0], 1); + i915_miptree_set_level_info(tex, 0, 1, base->width0, base->height0, 1); i915_miptree_set_image_offset(tex, 0, 0, 0, 0); pipe_buffer_reference(&tex->buffer, buffer); @@ -788,8 +782,8 @@ i915_get_tex_surface(struct pipe_screen *screen, pipe_reference_init(&ps->reference, 1); pipe_texture_reference(&ps->texture, pt); ps->format = pt->format; - ps->width = pt->width[level]; - ps->height = pt->height[level]; + ps->width = u_minify(pt->width0, level); + ps->height = u_minify(pt->height0, level); ps->offset = offset; ps->usage = flags; } @@ -919,7 +913,7 @@ i915_texture_blanket_intel(struct pipe_screen *screen, /* Only supports one type */ if (base->target != PIPE_TEXTURE_2D || base->last_level != 0 || - base->depth[0] != 1) { + base->depth0 != 1) { return NULL; } @@ -933,7 +927,7 @@ i915_texture_blanket_intel(struct pipe_screen *screen, tex->stride = stride; - i915_miptree_set_level_info(tex, 0, 1, base->width[0], base->height[0], 1); + i915_miptree_set_level_info(tex, 0, 1, base->width0, base->height0, 1); i915_miptree_set_image_offset(tex, 0, 0, 0, 0); tex->buffer = buffer; diff --git a/src/gallium/drivers/softpipe/sp_tex_sample.c b/src/gallium/drivers/softpipe/sp_tex_sample.c index c22ee86b66..e26153b1d9 100644 --- a/src/gallium/drivers/softpipe/sp_tex_sample.c +++ b/src/gallium/drivers/softpipe/sp_tex_sample.c @@ -521,7 +521,7 @@ compute_lambda_1d(const struct sp_sampler_varient *samp, const struct pipe_sampler_state *sampler = samp->sampler; float dsdx = fabsf(s[QUAD_BOTTOM_RIGHT] - s[QUAD_BOTTOM_LEFT]); float dsdy = fabsf(s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]); - float rho = MAX2(dsdx, dsdy) * texture->width[0]; + float rho = MAX2(dsdx, dsdy) * texture->width0; float lambda; lambda = util_fast_log2(rho); @@ -545,8 +545,8 @@ compute_lambda_2d(const struct sp_sampler_varient *samp, float dsdy = fabsf(s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]); float dtdx = fabsf(t[QUAD_BOTTOM_RIGHT] - t[QUAD_BOTTOM_LEFT]); float dtdy = fabsf(t[QUAD_TOP_LEFT] - t[QUAD_BOTTOM_LEFT]); - float maxx = MAX2(dsdx, dsdy) * texture->width[0]; - float maxy = MAX2(dtdx, dtdy) * texture->height[0]; + float maxx = MAX2(dsdx, dsdy) * texture->width0; + float maxy = MAX2(dtdx, dtdy) * texture->height0; float rho = MAX2(maxx, maxy); float lambda; @@ -573,9 +573,9 @@ compute_lambda_3d(const struct sp_sampler_varient *samp, float dtdy = fabsf(t[QUAD_TOP_LEFT] - t[QUAD_BOTTOM_LEFT]); float dpdx = fabsf(p[QUAD_BOTTOM_RIGHT] - p[QUAD_BOTTOM_LEFT]); float dpdy = fabsf(p[QUAD_TOP_LEFT] - p[QUAD_BOTTOM_LEFT]); - float maxx = MAX2(dsdx, dsdy) * texture->width[0]; - float maxy = MAX2(dtdx, dtdy) * texture->height[0]; - float maxz = MAX2(dpdx, dpdy) * texture->depth[0]; + float maxx = MAX2(dsdx, dsdy) * texture->width0; + float maxy = MAX2(dtdx, dtdy) * texture->height0; + float maxz = MAX2(dpdx, dpdy) * texture->depth0; float rho, lambda; rho = MAX2(maxx, maxy); @@ -644,8 +644,8 @@ get_texel_2d(const struct sp_sampler_varient *samp, const struct pipe_texture *texture = samp->texture; unsigned level = addr.bits.level; - if (x < 0 || x >= (int) texture->width[level] || - y < 0 || y >= (int) texture->height[level]) { + if (x < 0 || x >= (int) u_minify(texture->width0, level) || + y < 0 || y >= (int) u_minify(texture->height0, level)) { return samp->sampler->border_color; } else { @@ -737,9 +737,9 @@ get_texel_3d(const struct sp_sampler_varient *samp, const struct pipe_texture *texture = samp->texture; unsigned level = addr.bits.level; - if (x < 0 || x >= (int) texture->width[level] || - y < 0 || y >= (int) texture->height[level] || - z < 0 || z >= (int) texture->depth[level]) { + if (x < 0 || x >= (int) u_minify(texture->width0, level) || + y < 0 || y >= (int) u_minify(texture->height0, level) || + z < 0 || z >= (int) u_minify(texture->depth0, level)) { return samp->sampler->border_color; } else { @@ -925,7 +925,7 @@ img_filter_1d_nearest(struct tgsi_sampler *tgsi_sampler, union tex_tile_address addr; level0 = samp->level; - width = texture->width[level0]; + width = u_minify(texture->width0, level0); assert(width > 0); @@ -961,8 +961,8 @@ img_filter_2d_nearest(struct tgsi_sampler *tgsi_sampler, level0 = samp->level; - width = texture->width[level0]; - height = texture->height[level0]; + width = u_minify(texture->width0, level0); + height = u_minify(texture->height0, level0); assert(width > 0); assert(height > 0); @@ -1008,8 +1008,8 @@ img_filter_cube_nearest(struct tgsi_sampler *tgsi_sampler, union tex_tile_address addr; level0 = samp->level; - width = texture->width[level0]; - height = texture->height[level0]; + width = u_minify(texture->width0, level0); + height = u_minify(texture->height0, level0); assert(width > 0); assert(height > 0); @@ -1046,9 +1046,9 @@ img_filter_3d_nearest(struct tgsi_sampler *tgsi_sampler, union tex_tile_address addr; level0 = samp->level; - width = texture->width[level0]; - height = texture->height[level0]; - depth = texture->depth[level0]; + width = u_minify(texture->width0, level0); + height = u_minify(texture->height0, level0); + depth = u_minify(texture->depth0, level0); assert(width > 0); assert(height > 0); @@ -1088,7 +1088,7 @@ img_filter_1d_linear(struct tgsi_sampler *tgsi_sampler, union tex_tile_address addr; level0 = samp->level; - width = texture->width[level0]; + width = u_minify(texture->width0, level0); assert(width > 0); @@ -1127,8 +1127,8 @@ img_filter_2d_linear(struct tgsi_sampler *tgsi_sampler, union tex_tile_address addr; level0 = samp->level; - width = texture->width[level0]; - height = texture->height[level0]; + width = u_minify(texture->width0, level0); + height = u_minify(texture->height0, level0); assert(width > 0); assert(height > 0); @@ -1174,8 +1174,8 @@ img_filter_cube_linear(struct tgsi_sampler *tgsi_sampler, union tex_tile_address addr; level0 = samp->level; - width = texture->width[level0]; - height = texture->height[level0]; + width = u_minify(texture->width0, level0); + height = u_minify(texture->height0, level0); assert(width > 0); assert(height > 0); @@ -1221,9 +1221,9 @@ img_filter_3d_linear(struct tgsi_sampler *tgsi_sampler, union tex_tile_address addr; level0 = samp->level; - width = texture->width[level0]; - height = texture->height[level0]; - depth = texture->depth[level0]; + width = u_minify(texture->width0, level0); + height = u_minify(texture->height0, level0); + depth = u_minify(texture->depth0, level0); addr.value = 0; addr.bits.level = level0; @@ -1778,8 +1778,8 @@ sp_sampler_varient_bind_texture( struct sp_sampler_varient *samp, samp->texture = texture; samp->cache = tex_cache; - samp->xpot = util_unsigned_logbase2( texture->width[0] ); - samp->ypot = util_unsigned_logbase2( texture->height[0] ); + samp->xpot = util_unsigned_logbase2( texture->width0 ); + samp->ypot = util_unsigned_logbase2( texture->height0 ); samp->level = CLAMP((int) sampler->min_lod, 0, (int) texture->last_level); } diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c index 407a22a9f4..e50a76a73b 100644 --- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c @@ -35,6 +35,7 @@ #include "pipe/p_inlines.h" #include "util/u_memory.h" #include "util/u_tile.h" +#include "util/u_math.h" #include "sp_context.h" #include "sp_surface.h" #include "sp_texture.h" @@ -246,9 +247,9 @@ sp_find_cached_tile_tex(struct softpipe_tex_tile_cache *tc, addr.bits.level, addr.bits.z, PIPE_TRANSFER_READ, 0, 0, - tc->texture->width[addr.bits.level], - tc->texture->height[addr.bits.level]); - + u_minify(tc->texture->width0, addr.bits.level), + u_minify(tc->texture->height0, addr.bits.level)); + tc->tex_trans_map = screen->transfer_map(screen, tc->tex_trans); tc->tex_face = addr.bits.face; diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index 7caf2928b4..ac5f61e46f 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -52,16 +52,17 @@ softpipe_texture_layout(struct pipe_screen *screen, { struct pipe_texture *pt = &spt->base; unsigned level; - unsigned width = pt->width[0]; - unsigned height = pt->height[0]; - unsigned depth = pt->depth[0]; + unsigned width = pt->width0; + unsigned height = pt->height0; + unsigned depth = pt->depth0; unsigned buffer_size = 0; + pt->width0 = width; + pt->height0 = height; + pt->depth0 = depth; + for (level = 0; level <= pt->last_level; level++) { - pt->width[level] = width; - pt->height[level] = height; - pt->depth[level] = depth; pt->nblocksx[level] = pf_get_nblocksx(&pt->block, width); pt->nblocksy[level] = pf_get_nblocksy(&pt->block, height); spt->stride[level] = pt->nblocksx[level]*pt->block.size; @@ -72,9 +73,9 @@ softpipe_texture_layout(struct pipe_screen *screen, ((pt->target == PIPE_TEXTURE_CUBE) ? 6 : depth) * spt->stride[level]); - width = minify(width); - height = minify(height); - depth = minify(depth); + width = u_minify(width, 1); + height = u_minify(height, 1); + depth = u_minify(depth, 1); } spt->buffer = screen->buffer_create(screen, 32, @@ -96,12 +97,12 @@ softpipe_displaytarget_layout(struct pipe_screen *screen, PIPE_BUFFER_USAGE_GPU_READ_WRITE); unsigned tex_usage = spt->base.tex_usage; - spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width[0]); - spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height[0]); + spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width0); + spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height0); spt->buffer = screen->surface_buffer_create( screen, - spt->base.width[0], - spt->base.height[0], + spt->base.width0, + spt->base.height0, spt->base.format, usage, tex_usage, @@ -126,9 +127,9 @@ softpipe_texture_create(struct pipe_screen *screen, pipe_reference_init(&spt->base.reference, 1); spt->base.screen = screen; - spt->pot = (util_is_power_of_two(template->width[0]) && - util_is_power_of_two(template->height[0]) && - util_is_power_of_two(template->depth[0])); + spt->pot = (util_is_power_of_two(template->width0) && + util_is_power_of_two(template->height0) && + util_is_power_of_two(template->depth0)); if (spt->base.tex_usage & (PIPE_TEXTURE_USAGE_DISPLAY_TARGET | PIPE_TEXTURE_USAGE_PRIMARY)) { @@ -163,7 +164,7 @@ softpipe_texture_blanket(struct pipe_screen * screen, /* Only supports one type */ if (base->target != PIPE_TEXTURE_2D || base->last_level != 0 || - base->depth[0] != 1) { + base->depth0 != 1) { return NULL; } @@ -174,8 +175,8 @@ softpipe_texture_blanket(struct pipe_screen * screen, spt->base = *base; pipe_reference_init(&spt->base.reference, 1); spt->base.screen = screen; - spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width[0]); - spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height[0]); + spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width0); + spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height0); spt->stride[0] = stride[0]; pipe_buffer_reference(&spt->buffer, buffer); @@ -213,8 +214,8 @@ softpipe_get_tex_surface(struct pipe_screen *screen, pipe_reference_init(&ps->reference, 1); pipe_texture_reference(&ps->texture, pt); ps->format = pt->format; - ps->width = pt->width[level]; - ps->height = pt->height[level]; + ps->width = u_minify(pt->width0, level); + ps->height = u_minify(pt->height0, level); ps->offset = spt->level_offset[level]; ps->usage = usage; @@ -434,9 +435,9 @@ softpipe_video_surface_create(struct pipe_screen *screen, template.format = PIPE_FORMAT_X8R8G8B8_UNORM; template.last_level = 0; /* vl_mpeg12_mc_renderer expects this when it's initialized with pot_buffers=true */ - template.width[0] = util_next_power_of_two(width); - template.height[0] = util_next_power_of_two(height); - template.depth[0] = 1; + template.width0 = util_next_power_of_two(width); + template.height0 = util_next_power_of_two(height); + template.depth0 = 1; pf_get_block(template.format, &template.block); template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_RENDER_TARGET; diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c index bcf6751af4..6d58209294 100644 --- a/src/gallium/drivers/trace/tr_dump_state.c +++ b/src/gallium/drivers/trace/tr_dump_state.c @@ -83,15 +83,15 @@ void trace_dump_template(const struct pipe_texture *templat) trace_dump_member(format, templat, format); trace_dump_member_begin("width"); - trace_dump_array(uint, templat->width, 1); + trace_dump_uint(templat->width0); trace_dump_member_end(); trace_dump_member_begin("height"); - trace_dump_array(uint, templat->height, 1); + trace_dump_uint(templat->height0); trace_dump_member_end(); trace_dump_member_begin("depth"); - trace_dump_array(uint, templat->depth, 1); + trace_dump_uint(templat->depth0); trace_dump_member_end(); trace_dump_member_begin("block"); diff --git a/src/gallium/drivers/trace/tr_rbug.c b/src/gallium/drivers/trace/tr_rbug.c index 81e0a6f3b0..b59458c0e3 100644 --- a/src/gallium/drivers/trace/tr_rbug.c +++ b/src/gallium/drivers/trace/tr_rbug.c @@ -200,9 +200,9 @@ trace_rbug_texture_info(struct trace_rbug *tr_rbug, struct rbug_header *header, t = tr_tex->texture; rbug_send_texture_info_reply(tr_rbug->con, serial, t->target, t->format, - t->width, t->last_level + 1, - t->height, t->last_level + 1, - t->depth, t->last_level + 1, + &t->width0, 1, + &t->height0, 1, + &t->depth0, 1, t->block.width, t->block.height, t->block.size, t->last_level, t->nr_samples, diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 287b424e4a..9766e86620 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -343,9 +343,9 @@ struct pipe_texture enum pipe_texture_target target; /**< PIPE_TEXTURE_x */ enum pipe_format format; /**< PIPE_FORMAT_x */ - unsigned width[PIPE_MAX_TEXTURE_LEVELS]; - unsigned height[PIPE_MAX_TEXTURE_LEVELS]; - unsigned depth[PIPE_MAX_TEXTURE_LEVELS]; + unsigned width0; + unsigned height0; + unsigned depth0; struct pipe_format_block block; unsigned nblocksx[PIPE_MAX_TEXTURE_LEVELS]; /**< allocated width in blocks */ diff --git a/src/mesa/state_tracker/st_atom_framebuffer.c b/src/mesa/state_tracker/st_atom_framebuffer.c index e18c0f6e0a..8ca4335e33 100644 --- a/src/mesa/state_tracker/st_atom_framebuffer.c +++ b/src/mesa/state_tracker/st_atom_framebuffer.c @@ -40,6 +40,7 @@ #include "pipe/p_inlines.h" #include "cso_cache/cso_context.h" #include "util/u_rect.h" +#include "util/u_math.h" @@ -64,8 +65,8 @@ update_renderbuffer_surface(struct st_context *st, GLuint level; /* find matching mipmap level size */ for (level = 0; level <= texture->last_level; level++) { - if (texture->width[level] == rtt_width && - texture->height[level] == rtt_height) { + if (u_minify(texture->width0, level) == rtt_width && + u_minify(texture->height0, level) == rtt_height) { pipe_surface_reference(&strb->surface, NULL); diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c index babfcc87b4..4b35f59cc2 100644 --- a/src/mesa/state_tracker/st_atom_pixeltransfer.c +++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c @@ -145,7 +145,7 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt) const GLuint gSize = ctx->PixelMaps.GtoG.Size; const GLuint bSize = ctx->PixelMaps.BtoB.Size; const GLuint aSize = ctx->PixelMaps.AtoA.Size; - const uint texSize = pt->width[0]; + const uint texSize = pt->width0; uint *dest; uint i, j; diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 1d33e81c2c..7ec4599280 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -637,8 +637,8 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, y1 = y + height * ctx->Pixel.ZoomY; draw_quad(ctx, x0, y0, z, x1, y1, color, invertTex, - (GLfloat) width / pt->width[0], - (GLfloat) height / pt->height[0]); + (GLfloat) width / pt->width0, + (GLfloat) height / pt->height0); /* restore state */ cso_restore_rasterizer(cso); diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 65ce12ccd4..0469fb9978 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -128,9 +128,9 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, template.target = PIPE_TEXTURE_2D; template.format = format; pf_get_block(format, &template.block); - template.width[0] = width; - template.height[0] = height; - template.depth[0] = 1; + template.width0 = width; + template.height0 = height; + template.depth0 = 1; template.last_level = 0; template.nr_samples = rb->NumSamples; if (pf_is_depth_stencil(format)) { diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 772bb3bb69..103861d6f9 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -243,7 +243,7 @@ st_fast_readpixels(GLcontext *ctx, struct st_renderbuffer *strb, GLint row, col, dy, dstStride; if (st_fb_orientation(ctx->ReadBuffer) == Y_0_TOP) { - y = strb->texture->height[0] - y - height; + y = strb->texture->height0 - y - height; } trans = st_cond_flush_get_tex_transfer(st_context(ctx), strb->texture, diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 9186db76e1..72892b7c8c 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -451,9 +451,9 @@ compress_with_blit(GLcontext * ctx, templ.target = PIPE_TEXTURE_2D; templ.format = st_mesa_format_to_pipe_format(mesa_format); pf_get_block(templ.format, &templ.block); - templ.width[0] = width; - templ.height[0] = height; - templ.depth[0] = 1; + templ.width0 = width; + templ.height0 = height; + templ.depth0 = 1; templ.last_level = 0; templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; src_tex = screen->texture_create(screen, &templ); @@ -1813,9 +1813,9 @@ st_finalize_texture(GLcontext *ctx, if (stObj->pt->target != gl_target_to_pipe(stObj->base.Target) || stObj->pt->format != fmt || stObj->pt->last_level < stObj->lastLevel || - stObj->pt->width[0] != firstImage->base.Width2 || - stObj->pt->height[0] != firstImage->base.Height2 || - stObj->pt->depth[0] != firstImage->base.Depth2 || + stObj->pt->width0 != firstImage->base.Width2 || + stObj->pt->height0 != firstImage->base.Height2 || + stObj->pt->depth0 != firstImage->base.Depth2 || /* Nominal bytes per pixel: */ stObj->pt->block.size / stObj->pt->block.width != cpp) { diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index 16ca2771b0..f8068fa12b 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -38,6 +38,7 @@ #include "pipe/p_defines.h" #include "pipe/p_inlines.h" #include "util/u_gen_mipmap.h" +#include "util/u_math.h" #include "cso_cache/cso_cache.h" #include "cso_cache/cso_context.h" @@ -133,14 +134,14 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, srcTrans = st_cond_flush_get_tex_transfer(st_context(ctx), pt, face, srcLevel, zslice, PIPE_TRANSFER_READ, 0, 0, - pt->width[srcLevel], - pt->height[srcLevel]); + u_minify(pt->width0, srcLevel), + u_minify(pt->height0, srcLevel)); dstTrans = st_cond_flush_get_tex_transfer(st_context(ctx), pt, face, dstLevel, zslice, PIPE_TRANSFER_WRITE, 0, 0, - pt->width[dstLevel], - pt->height[dstLevel]); + u_minify(pt->width0, dstLevel), + u_minify(pt->height0, dstLevel)); srcData = (ubyte *) screen->transfer_map(screen, srcTrans); dstData = (ubyte *) screen->transfer_map(screen, dstTrans); @@ -149,13 +150,17 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, dstStride = dstTrans->stride / dstTrans->block.size; _mesa_generate_mipmap_level(target, datatype, comps, - 0 /*border*/, - pt->width[srcLevel], pt->height[srcLevel], pt->depth[srcLevel], - srcData, - srcStride, /* stride in texels */ - pt->width[dstLevel], pt->height[dstLevel], pt->depth[dstLevel], - dstData, - dstStride); /* stride in texels */ + 0 /*border*/, + u_minify(pt->width0, srcLevel), + u_minify(pt->height0, srcLevel), + u_minify(pt->depth0, srcLevel), + srcData, + srcStride, /* stride in texels */ + u_minify(pt->width0, dstLevel), + u_minify(pt->height0, dstLevel), + u_minify(pt->depth0, dstLevel), + dstData, + dstStride); /* stride in texels */ screen->transfer_unmap(screen, srcTrans); screen->transfer_unmap(screen, dstTrans); @@ -232,9 +237,9 @@ st_generate_mipmap(GLcontext *ctx, GLenum target, oldTex->target, oldTex->format, lastLevel, - oldTex->width[0], - oldTex->height[0], - oldTex->depth[0], + oldTex->width0, + oldTex->height0, + oldTex->depth0, oldTex->tex_usage); /* The texture isn't in a "complete" state yet so set the expected @@ -269,9 +274,9 @@ st_generate_mipmap(GLcontext *ctx, GLenum target, = _mesa_get_tex_image(ctx, texObj, target, srcLevel); struct gl_texture_image *dstImage; struct st_texture_image *stImage; - uint dstWidth = pt->width[dstLevel]; - uint dstHeight = pt->height[dstLevel]; - uint dstDepth = pt->depth[dstLevel]; + uint dstWidth = u_minify(pt->width0, dstLevel); + uint dstHeight = u_minify(pt->height0, dstLevel); + uint dstDepth = u_minify(pt->depth0, dstLevel); uint border = srcImage->Border; dstImage = _mesa_get_tex_image(ctx, texObj, target, dstLevel); diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index 3945822f66..aa88fdcd78 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -44,6 +44,7 @@ #include "pipe/p_defines.h" #include "pipe/p_inlines.h" #include "util/u_rect.h" +#include "util/u_math.h" #define DBG if(0) printf @@ -100,9 +101,9 @@ st_texture_create(struct st_context *st, pt.target = target; pt.format = format; pt.last_level = last_level; - pt.width[0] = width0; - pt.height[0] = height0; - pt.depth[0] = depth0; + pt.width0 = width0; + pt.height0 = height0; + pt.depth0 = depth0; pf_get_block(format, &pt.block); pt.tex_usage = usage; @@ -135,9 +136,9 @@ st_texture_match_image(const struct pipe_texture *pt, /* Test if this image's size matches what's expected in the * established texture. */ - if (image->Width != pt->width[level] || - image->Height != pt->height[level] || - image->Depth != pt->depth[level]) + if (image->Width != u_minify(pt->width0, level) || + image->Height != u_minify(pt->height0, level) || + image->Depth != u_minify(pt->depth0, level)) return GL_FALSE; return GL_TRUE; @@ -265,7 +266,7 @@ st_texture_image_data(struct st_context *st, { struct pipe_context *pipe = st->pipe; struct pipe_screen *screen = pipe->screen; - GLuint depth = dst->depth[level]; + GLuint depth = u_minify(dst->depth0, level); GLuint i; const GLubyte *srcUB = src; struct pipe_transfer *dst_transfer; @@ -275,15 +276,16 @@ st_texture_image_data(struct st_context *st, for (i = 0; i < depth; i++) { dst_transfer = st_no_flush_get_tex_transfer(st, dst, face, level, i, PIPE_TRANSFER_WRITE, 0, 0, - dst->width[level], - dst->height[level]); + u_minify(dst->width0, level), + u_minify(dst->height0, level)); st_surface_data(pipe, dst_transfer, 0, 0, /* dstx, dsty */ srcUB, src_row_stride, 0, 0, /* source x, y */ - dst->width[level], dst->height[level]); /* width, height */ + u_minify(dst->width0, level), + u_minify(dst->height0, level)); /* width, height */ screen->tex_transfer_destroy(dst_transfer); @@ -301,9 +303,9 @@ st_texture_image_copy(struct pipe_context *pipe, GLuint face) { struct pipe_screen *screen = pipe->screen; - GLuint width = dst->width[dstLevel]; - GLuint height = dst->height[dstLevel]; - GLuint depth = dst->depth[dstLevel]; + GLuint width = u_minify(dst->width0, dstLevel); + GLuint height = u_minify(dst->height0, dstLevel); + GLuint depth = u_minify(dst->depth0, dstLevel); struct pipe_surface *src_surface; struct pipe_surface *dst_surface; GLuint i; @@ -313,13 +315,13 @@ st_texture_image_copy(struct pipe_context *pipe, /* find src texture level of needed size */ for (srcLevel = 0; srcLevel <= src->last_level; srcLevel++) { - if (src->width[srcLevel] == width && - src->height[srcLevel] == height) { + if (u_minify(src->width0, srcLevel) == width && + u_minify(src->height0, srcLevel) == height) { break; } } - assert(src->width[srcLevel] == width); - assert(src->height[srcLevel] == height); + assert(u_minify(src->width0, srcLevel) == width); + assert(u_minify(src->height0, srcLevel) == height); #if 0 { -- cgit v1.2.3 From 8b808d50e2f4be57c3a245afea462540dab1484e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 19 Nov 2009 14:38:39 -0800 Subject: st/xorg: Fix infinite loop in copy_packed_data. --- src/gallium/state_trackers/xorg/xorg_xv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index 7cc532b1c8..a1e74fad59 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -256,7 +256,7 @@ copy_packed_data(ScrnInfoPtr pScrn, switch (id) { case FOURCC_YV12: { for (i = 0; i < w; ++i) { - for (j = 0; i < h; ++j) { + for (j = 0; j < h; ++j) { /*XXX use src? */ y1 = buf[j*w + i]; u = buf[(j/2) * (w/2) + i/2 + y_array_size]; -- cgit v1.2.3 From b09e74901a4f92299fe3f52f57d27fd5ca5bdd2d Mon Sep 17 00:00:00 2001 From: Richard Li Date: Thu, 19 Nov 2009 17:41:10 -0500 Subject: r600 : Clean up a bit test code mess. --- src/mesa/drivers/dri/r600/r600_context.c | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index ca0a670f3c..97b25ea3ff 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -369,23 +369,6 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual, assert(glVisual); assert(driContextPriv); assert(screen); - - //richard test - FILE *pFile = NULL; - unsigned long ulByteToWrite = 0; - char szStr[1024]; - - pFile = fopen("//home//richard//rtp-log//func_call.log", "a+"); - if(NULL != pFile) - { - sprintf(szStr, "r600CreateContext \r\n"); - ulByteToWrite = strlen(szStr); - fwrite(szStr, 1, ulByteToWrite, pFile); - - fclose(pFile); - pFile = NULL; - } - //------------- /* Allocate the R600 context */ r600 = (context_t*) CALLOC(sizeof(*r600)); -- cgit v1.2.3 From f8ea5318200c1ed839fc387b16a57c8d9969974b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Fri, 20 Nov 2009 11:45:43 +1000 Subject: r100: fix texture_from_pixmap and compiz. r100 state emission has separate rect and non-rect states, if we are doing TFP for a TEXTURE_2D we shouldn't use the rect states as they won't get emitted properly. Signed-off-by: Dave Airlie --- src/mesa/drivers/dri/radeon/radeon_texstate.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index 4d9eb73d20..3cbe3b4725 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -714,8 +714,6 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_ t->tile_bits = 0; t->image_override = GL_TRUE; t->override_offset = 0; - t->pp_txpitch &= (1 << 13) -1; - pitch_val = rb->pitch; switch (rb->cpp) { case 4: if (glx_texture_format == GLX_TEXTURE_FORMAT_RGB_EXT) @@ -734,12 +732,17 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_ t->pp_txfilter |= tx_table[MESA_FORMAT_RGB565].filter; break; } - t->pp_txsize = ((rb->base.Width - 1) << RADEON_TEX_USIZE_SHIFT) - | ((rb->base.Height - 1) << RADEON_TEX_VSIZE_SHIFT); - t->pp_txformat |= RADEON_TXFORMAT_NON_POWER2; - t->pp_txpitch = pitch_val; - t->pp_txpitch -= 32; + t->pp_txpitch &= (1 << 13) -1; + pitch_val = rb->pitch; + + t->pp_txsize = ((rb->base.Width - 1) << RADEON_TEX_USIZE_SHIFT) + | ((rb->base.Height - 1) << RADEON_TEX_VSIZE_SHIFT); + if (target == GL_TEXTURE_RECTANGLE_NV) { + t->pp_txformat |= RADEON_TXFORMAT_NON_POWER2; + t->pp_txpitch = pitch_val; + t->pp_txpitch -= 32; + } t->validated = GL_TRUE; _mesa_unlock_texture(radeon->glCtx, texObj); return; -- cgit v1.2.3 From 08e5d1ecad79d1c08541ba08a436f5145c5c9376 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Fri, 20 Nov 2009 10:58:05 -0500 Subject: r600 : eliminate Wondows line ending for test code. --- src/mesa/drivers/dri/r600/r600_context.c | 56 ++++++++++++++++---------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index 97b25ea3ff..7de29e5bb8 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -72,8 +72,8 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "vblank.h" #include "utils.h" -#include "xmlpool.h" /* for symbolic values of enum-type options */ - +#include "xmlpool.h" /* for symbolic values of enum-type options */ + //#define R600_ENABLE_GLSL_TEST 1 #define need_GL_VERSION_2_0 @@ -156,11 +156,11 @@ static const struct dri_extension mm_extensions[] = { * The GL 2.0 functions are needed to make display lists work with * functions added by GL_ATI_separate_stencil. */ -static const struct dri_extension gl_20_extension[] = { -#ifdef R600_ENABLE_GLSL_TEST - {"GL_ARB_shading_language_100", GL_VERSION_2_0_functions }, +static const struct dri_extension gl_20_extension[] = { +#ifdef R600_ENABLE_GLSL_TEST + {"GL_ARB_shading_language_100", GL_VERSION_2_0_functions }, #else - {"GL_VERSION_2_0", GL_VERSION_2_0_functions }, + {"GL_VERSION_2_0", GL_VERSION_2_0_functions }, #endif /* R600_ENABLE_GLSL_TEST */ }; @@ -312,27 +312,27 @@ static void r600InitGLExtensions(GLcontext *ctx) driInitExtensions(ctx, card_extensions, GL_TRUE); if (r600->radeon.radeonScreen->kernel_mm) - driInitExtensions(ctx, mm_extensions, GL_FALSE); - -#ifdef R600_ENABLE_GLSL_TEST - driInitExtensions(ctx, gl_20_extension, GL_TRUE); - //_mesa_enable_2_0_extensions(ctx); - //1.5 - ctx->Extensions.ARB_occlusion_query = GL_TRUE; - ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE; - ctx->Extensions.EXT_shadow_funcs = GL_TRUE; - //2.0 - ctx->Extensions.ARB_draw_buffers = GL_TRUE; - ctx->Extensions.ARB_point_sprite = GL_TRUE; - ctx->Extensions.ARB_shader_objects = GL_TRUE; - ctx->Extensions.ARB_vertex_shader = GL_TRUE; - ctx->Extensions.ARB_fragment_shader = GL_TRUE; - ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE; - ctx->Extensions.EXT_blend_equation_separate = GL_TRUE; - ctx->Extensions.ATI_separate_stencil = GL_TRUE; - - /* glsl compiler has problem if this is not GL_TRUE */ - ctx->Shader.EmitCondCodes = GL_TRUE; + driInitExtensions(ctx, mm_extensions, GL_FALSE); + +#ifdef R600_ENABLE_GLSL_TEST + driInitExtensions(ctx, gl_20_extension, GL_TRUE); + //_mesa_enable_2_0_extensions(ctx); + //1.5 + ctx->Extensions.ARB_occlusion_query = GL_TRUE; + ctx->Extensions.ARB_vertex_buffer_object = GL_TRUE; + ctx->Extensions.EXT_shadow_funcs = GL_TRUE; + //2.0 + ctx->Extensions.ARB_draw_buffers = GL_TRUE; + ctx->Extensions.ARB_point_sprite = GL_TRUE; + ctx->Extensions.ARB_shader_objects = GL_TRUE; + ctx->Extensions.ARB_vertex_shader = GL_TRUE; + ctx->Extensions.ARB_fragment_shader = GL_TRUE; + ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE; + ctx->Extensions.EXT_blend_equation_separate = GL_TRUE; + ctx->Extensions.ATI_separate_stencil = GL_TRUE; + + /* glsl compiler has problem if this is not GL_TRUE */ + ctx->Shader.EmitCondCodes = GL_TRUE; #endif /* R600_ENABLE_GLSL_TEST */ if (driQueryOptionb @@ -368,7 +368,7 @@ GLboolean r600CreateContext(const __GLcontextModes * glVisual, assert(glVisual); assert(driContextPriv); - assert(screen); + assert(screen); /* Allocate the R600 context */ r600 = (context_t*) CALLOC(sizeof(*r600)); -- cgit v1.2.3 From a24631bcd7ab2cbc6fff2a536502a07a13a9bc83 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Fri, 20 Nov 2009 18:08:29 +0000 Subject: Fix memory leak. --- src/gallium/drivers/softpipe/sp_state_fs.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_state_fs.c b/src/gallium/drivers/softpipe/sp_state_fs.c index 256faa94b8..b41f7e8ab7 100644 --- a/src/gallium/drivers/softpipe/sp_state_fs.c +++ b/src/gallium/drivers/softpipe/sp_state_fs.c @@ -143,6 +143,7 @@ softpipe_delete_vs_state(struct pipe_context *pipe, void *vs) struct sp_vertex_shader *state = (struct sp_vertex_shader *) vs; draw_delete_vertex_shader(softpipe->draw, state->draw_data); + FREE( (void *)state->shader.tokens ); FREE( state ); } -- cgit v1.2.3 From 8f648cd3e45f2364e8f3b956f1250364ba56af81 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Fri, 20 Nov 2009 18:09:10 +0000 Subject: Fix vega compilation. --- src/gallium/state_trackers/vega/arc.c | 6 ++++-- src/gallium/state_trackers/vega/bezier.c | 7 +++++-- src/gallium/state_trackers/vega/vg_context.c | 4 +++- 3 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/vega/arc.c b/src/gallium/state_trackers/vega/arc.c index e74c7f0334..8b04d21ea7 100644 --- a/src/gallium/state_trackers/vega/arc.c +++ b/src/gallium/state_trackers/vega/arc.c @@ -528,6 +528,7 @@ static INLINE int num_beziers_needed(struct arc *arc) double threshold = 0.05; VGboolean found = VG_FALSE; int n = 1; + int i; double min_eta, max_eta; min_eta = MIN2(arc->eta1, arc->eta2); @@ -538,7 +539,7 @@ static INLINE int num_beziers_needed(struct arc *arc) if (d_eta <= 0.5 * M_PI) { double eta_b = min_eta; found = VG_TRUE; - for (int i = 0; found && (i < n); ++i) { + for (i = 0; found && (i < n); ++i) { double etaA = eta_b; eta_b += d_eta; found = (estimate_error(arc, etaA, eta_b) <= threshold); @@ -554,6 +555,7 @@ static void arc_to_beziers(struct arc *arc, struct arc_cb cb, struct matrix *matrix) { + int i; int n = 1; double d_eta, eta_b, cos_eta_b, sin_eta_b, a_cos_eta_b, b_sin_eta_b, a_sin_eta_b, @@ -607,7 +609,7 @@ static void arc_to_beziers(struct arc *arc, t = tan(0.5 * d_eta); alpha = sin(d_eta) * (sqrt(4 + 3 * t * t) - 1) / 3; - for (int i = 0; i < n; ++i) { + for (i = 0; i < n; ++i) { struct bezier bezier; double xA = x_b; double yA = y_b; diff --git a/src/gallium/state_trackers/vega/bezier.c b/src/gallium/state_trackers/vega/bezier.c index 39a7ade016..0d5504004c 100644 --- a/src/gallium/state_trackers/vega/bezier.c +++ b/src/gallium/state_trackers/vega/bezier.c @@ -255,7 +255,9 @@ static enum shift_result good_offset(const struct bezier *b1, const float max_dist_line = threshold*offset*offset; const float max_dist_normal = threshold*offset; const float spacing = 0.25; - for (float i = spacing; i < 0.99; i += spacing) { + float i; + + for (i = spacing; i < 0.99; i += spacing) { float p1[2],p2[2], d, l; float normal[2]; bezier_point_at(b1, i, p1); @@ -330,6 +332,7 @@ static enum shift_result shift(const struct bezier *orig, struct bezier *shifted, float offset, float threshold) { + int i; int map[4]; VGboolean p1_p2_equal = (orig->x1 == orig->x2 && orig->y1 == orig->y2); VGboolean p2_p3_equal = (orig->x2 == orig->x3 && orig->y2 == orig->y3); @@ -404,7 +407,7 @@ static enum shift_result shift(const struct bezier *orig, points_shifted[0][0] = points[0][0] + offset * prev_normal[0]; points_shifted[0][1] = points[0][1] + offset * prev_normal[1]; - for (int i = 1; i < np - 1; ++i) { + for (i = 1; i < np - 1; ++i) { float normal_sum[2], r; float next_normal[2]; compute_pt_normal(points[i], points[i + 1], next_normal); diff --git a/src/gallium/state_trackers/vega/vg_context.c b/src/gallium/state_trackers/vega/vg_context.c index e0ff02f3a9..00d23f5c22 100644 --- a/src/gallium/state_trackers/vega/vg_context.c +++ b/src/gallium/state_trackers/vega/vg_context.c @@ -231,6 +231,8 @@ static void update_clip_state(struct vg_context *ctx) if (state->scissoring) { struct pipe_blend_state *blend = &ctx->state.g3d.blend; struct pipe_framebuffer_state *fb = &ctx->state.g3d.fb; + int i; + dsa->depth.writemask = 1;/*glDepthMask(TRUE);*/ dsa->depth.func = PIPE_FUNC_ALWAYS; dsa->depth.enabled = 1; @@ -254,7 +256,7 @@ static void update_clip_state(struct vg_context *ctx) cso_set_blend(ctx->cso_context, blend); /* enable scissoring */ - for (int i = 0; i < state->scissor_rects_num; ++i) { + for (i = 0; i < state->scissor_rects_num; ++i) { const float x = state->scissor_rects[i * 4 + 0].f; const float y = state->scissor_rects[i * 4 + 1].f; const float width = state->scissor_rects[i * 4 + 2].f; -- cgit v1.2.3 From 904469dcd2e50d950c5e061103907da659053ff2 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Fri, 20 Nov 2009 18:10:54 +0000 Subject: Fix indentation. --- src/gallium/drivers/softpipe/sp_context.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index 5f60139968..bdbb7fa9b9 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -90,14 +90,15 @@ softpipe_destroy( struct pipe_context *pipe ) if (softpipe->draw) draw_destroy( softpipe->draw ); - softpipe->quad.shade->destroy( softpipe->quad.shade ); - softpipe->quad.depth_test->destroy( softpipe->quad.depth_test ); - softpipe->quad.blend->destroy( softpipe->quad.blend ); + softpipe->quad.shade->destroy( softpipe->quad.shade ); + softpipe->quad.depth_test->destroy( softpipe->quad.depth_test ); + softpipe->quad.blend->destroy( softpipe->quad.blend ); for (i = 0; i < PIPE_MAX_COLOR_BUFS; i++) { sp_destroy_tile_cache(softpipe->cbuf_cache[i]); pipe_surface_reference(&softpipe->framebuffer.cbufs[i], NULL); } + sp_destroy_tile_cache(softpipe->zsbuf_cache); pipe_surface_reference(&softpipe->framebuffer.zsbuf, NULL); -- cgit v1.2.3 From 0295edf5963a4abf812c68df3c937f0767d6ad7a Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Fri, 20 Nov 2009 18:11:30 +0000 Subject: Fix comment to use /* */ rather than // --- src/gallium/state_trackers/xorg/xorg_exa_tgsi.c | 32 ++++++++++++------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c index 3bf64b6331..52b97af163 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c @@ -47,22 +47,22 @@ static void print_fs_traits(int fs_traits) { const char *strings[] = { - "FS_COMPOSITE", // = 1 << 0, - "FS_MASK", // = 1 << 1, - "FS_SOLID_FILL", // = 1 << 2, - "FS_LINGRAD_FILL", // = 1 << 3, - "FS_RADGRAD_FILL", // = 1 << 4, - "FS_CA_FULL", // = 1 << 5, /* src.rgba * mask.rgba */ - "FS_CA_SRCALPHA", // = 1 << 6, /* src.aaaa * mask.rgba */ - "FS_YUV", // = 1 << 7, - "FS_SRC_REPEAT_NONE", // = 1 << 8, - "FS_MASK_REPEAT_NONE",// = 1 << 9, - "FS_SRC_SWIZZLE_RGB", // = 1 << 10, - "FS_MASK_SWIZZLE_RGB",// = 1 << 11, - "FS_SRC_SET_ALPHA", // = 1 << 12, - "FS_MASK_SET_ALPHA", // = 1 << 13, - "FS_SRC_LUMINANCE", // = 1 << 14, - "FS_MASK_LUMINANCE", // = 1 << 15, + "FS_COMPOSITE", /* = 1 << 0 */ + "FS_MASK", /* = 1 << 1 */ + "FS_SOLID_FILL", /* = 1 << 2 */ + "FS_LINGRAD_FILL", /* = 1 << 3 */ + "FS_RADGRAD_FILL", /* = 1 << 4 */ + "FS_CA_FULL", /* = 1 << 5 - src.rgba * mask.rgba */ + "FS_CA_SRCALPHA", /* = 1 << 6 - src.aaaa * mask.rgba */ + "FS_YUV", /* = 1 << 7 */ + "FS_SRC_REPEAT_NONE", /* = 1 << 8 */ + "FS_MASK_REPEAT_NONE",/* = 1 << 9 */ + "FS_SRC_SWIZZLE_RGB", /* = 1 << 10 */ + "FS_MASK_SWIZZLE_RGB",/* = 1 << 11 */ + "FS_SRC_SET_ALPHA", /* = 1 << 12 */ + "FS_MASK_SET_ALPHA", /* = 1 << 13 */ + "FS_SRC_LUMINANCE", /* = 1 << 14 */ + "FS_MASK_LUMINANCE", /* = 1 << 15 */ }; int i, k; debug_printf("%s: ", __func__); -- cgit v1.2.3 From beea241374a91b8aab81db175b28e98c2b4835d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 19 Nov 2009 01:35:08 +0100 Subject: r300g: set better values in the R300_VAP_CNTL register --- src/gallium/drivers/r300/r300_emit.c | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index eeb97a2d37..2a8d32242b 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -690,12 +690,35 @@ void r300_emit_vertex_format_state(struct r300_context* r300) END_CS; } +/* XXX This should probably go to util ... */ +/* Return the number of bits set in the given number. */ +static unsigned bitcount(unsigned n) +{ + unsigned bits; + for (bits = 0; n > 0; n = n >> 1) { + bits += n & 1; + } + return bits; +} + +/* XXX ... and this one too. */ +#define MIN3(x, y, z) MIN2(MIN2(x, y), z) + void r300_emit_vertex_program_code(struct r300_context* r300, struct r300_vertex_program_code* code) { int i; struct r300_screen* r300screen = r300_screen(r300->context.screen); unsigned instruction_count = code->length / 4; + + int vtx_mem_size = r300screen->caps->is_r500 ? 128 : 72; + int input_count = MAX2(bitcount(code->InputsRead), 1); + int output_count = MAX2(bitcount(code->OutputsWritten), 1); + int temp_count = MAX2(code->num_temporaries, 1); + int pvs_num_slots = MIN3(vtx_mem_size / input_count, + vtx_mem_size / output_count, 10); + int pvs_num_controllers = MIN2(6, vtx_mem_size / temp_count); + CS_LOCALS(r300); if (!r300screen->caps->has_tcl) { @@ -708,8 +731,7 @@ void r300_emit_vertex_program_code(struct r300_context* r300, /* R300_VAP_PVS_CODE_CNTL_0 * R300_VAP_PVS_CONST_CNTL * R300_VAP_PVS_CODE_CNTL_1 - * See the r5xx docs for instructions on how to use these. - * XXX these could be optimized to select better values... */ + * See the r5xx docs for instructions on how to use these. */ OUT_CS_REG_SEQ(R300_VAP_PVS_CODE_CNTL_0, 3); OUT_CS(R300_PVS_FIRST_INST(0) | R300_PVS_XYZW_VALID_INST(instruction_count - 1) | @@ -722,10 +744,11 @@ void r300_emit_vertex_program_code(struct r300_context* r300, for (i = 0; i < code->length; i++) OUT_CS(code->body.d[i]); - OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(10) | - R300_PVS_NUM_CNTLRS(5) | + OUT_CS_REG(R300_VAP_CNTL, R300_PVS_NUM_SLOTS(pvs_num_slots) | + R300_PVS_NUM_CNTLRS(pvs_num_controllers) | R300_PVS_NUM_FPUS(r300screen->caps->num_vert_fpus) | - R300_PVS_VF_MAX_VTX_NUM(12)); + R300_PVS_VF_MAX_VTX_NUM(12) | + (r300screen->caps->is_r500 ? R500_TCL_STATE_OPTIMIZATION : 0)); END_CS; } -- cgit v1.2.3 From 37ba97421c5cf351e2e3c7c1e41ffd72fb73f7e9 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 20 Nov 2009 14:08:58 -0800 Subject: util: Add MAX3 and MIN3. --- src/gallium/auxiliary/util/u_math.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index 75b075f160..731a11475e 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -499,6 +499,9 @@ util_next_power_of_two(unsigned x) #define MIN2( A, B ) ( (A)<(B) ? (A) : (B) ) #define MAX2( A, B ) ( (A)>(B) ? (A) : (B) ) +#define MIN3( A, B, C ) MIN2( MIN2( A, B ), C ) +#define MAX3( A, B, C ) MAX2( MAX2( A, B ), C ) + static INLINE int align(int value, int alignment) -- cgit v1.2.3 From 6a3eb1f91b4ccd4ee7ac6b91505e0dfa476922d4 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 20 Nov 2009 14:10:45 -0800 Subject: r300g: Use MAX3 and MIN3. --- src/gallium/drivers/r300/r300_emit.c | 3 --- src/gallium/drivers/r300/r300_state_derived.c | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 2a8d32242b..4cd5074379 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -701,9 +701,6 @@ static unsigned bitcount(unsigned n) return bits; } -/* XXX ... and this one too. */ -#define MIN3(x, y, z) MIN2(MIN2(x, y), z) - void r300_emit_vertex_program_code(struct r300_context* r300, struct r300_vertex_program_code* code) { diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 7166694edf..b4d0eeaf8c 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -458,7 +458,7 @@ static void r300_update_rs_block(struct r300_context* r300, rs->count = (rs_tex_comp) | (col_count << R300_IC_COUNT_SHIFT) | R300_HIRES_EN; - rs->inst_count = MAX2(MAX2(col_count - 1, tex_count - 1), 0); + rs->inst_count = MAX3(col_count - 1, tex_count - 1, 0); } /* Update the vertex format. */ -- cgit v1.2.3 From 06ec216d191e160494dd0a922ab0395418a78402 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 20 Nov 2009 14:10:59 -0800 Subject: r300g: Clean up bitcounting function. I didn't see this in u_math; surely somebody else has this wheel reinvented elsewhere. --- src/gallium/drivers/r300/r300_emit.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 4cd5074379..c50c989f01 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -690,14 +690,19 @@ void r300_emit_vertex_format_state(struct r300_context* r300) END_CS; } -/* XXX This should probably go to util ... */ +/* XXX This should go to util ... */ /* Return the number of bits set in the given number. */ static unsigned bitcount(unsigned n) { - unsigned bits; - for (bits = 0; n > 0; n = n >> 1) { - bits += n & 1; + unsigned bits = 0; + + while (n) { + if (n & 1) { + bits++; + } + n >>= 1; } + return bits; } @@ -714,7 +719,7 @@ void r300_emit_vertex_program_code(struct r300_context* r300, int temp_count = MAX2(code->num_temporaries, 1); int pvs_num_slots = MIN3(vtx_mem_size / input_count, vtx_mem_size / output_count, 10); - int pvs_num_controllers = MIN2(6, vtx_mem_size / temp_count); + int pvs_num_controllers = MIN2(vtx_mem_size / temp_count, 6); CS_LOCALS(r300); -- cgit v1.2.3 From 36e2074b63e3e5bc489eb74cad0cd97eafcedb40 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 14:20:15 -0800 Subject: gallium/util: Initialize variables in u_pack_color.h. --- src/gallium/auxiliary/util/u_pack_color.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h index eda883b3b9..9dacc6d83d 100644 --- a/src/gallium/auxiliary/util/u_pack_color.h +++ b/src/gallium/auxiliary/util/u_pack_color.h @@ -302,7 +302,10 @@ util_unpack_color_ub(enum pipe_format format, const void *src, static INLINE void util_pack_color(const float rgba[4], enum pipe_format format, void *dest) { - ubyte r, g, b, a; + ubyte r = 0; + ubyte g = 0; + ubyte b = 0; + ubyte a = 0; if (pf_size_x(format) <= 8) { /* format uses 8-bit components or less */ -- cgit v1.2.3 From f6541773c4661247879995637207dcc5803bbf00 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 14:31:42 -0800 Subject: i915g: Add missing break statement in i915_debug.c. --- src/gallium/drivers/i915/i915_debug.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/i915/i915_debug.c b/src/gallium/drivers/i915/i915_debug.c index e6640e587b..c6e6d6fd31 100644 --- a/src/gallium/drivers/i915/i915_debug.c +++ b/src/gallium/drivers/i915/i915_debug.c @@ -851,6 +851,7 @@ static boolean i915_debug_packet( struct debug_stream *stream ) default: return debug(stream, "", 0); } + break; default: assert(0); return 0; -- cgit v1.2.3 From f4041b37e2d305cff0a97eb836250e9f8b1840a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 14 Nov 2009 22:14:42 +0100 Subject: r300g: fix rectangle textures on r3xx Adapted from Maciej Cencora's patch. --- src/gallium/drivers/r300/r300_emit.c | 22 ++++++++++++++++++++-- src/gallium/drivers/r300/r300_state.c | 8 ++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index c50c989f01..0bdf58202f 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -129,7 +129,9 @@ static const float * get_shader_constant( struct rc_constant * constant, struct r300_constant_buffer * externals) { - static const float zero[4] = { 0.0, 0.0, 0.0, 0.0 }; + static float vec[4] = { 0.0, 0.0, 0.0, 0.0 }; + struct pipe_texture *tex; + switch(constant->Type) { case RC_CONSTANT_EXTERNAL: return externals->constants[constant->u.External]; @@ -137,10 +139,26 @@ static const float * get_shader_constant( case RC_CONSTANT_IMMEDIATE: return constant->u.Immediate; + case RC_CONSTANT_STATE: + switch (constant->u.State[0]) + { + /* R3xx-specific */ + case RC_STATE_R300_TEXRECT_FACTOR: + tex = &r300->textures[constant->u.State[1]]->tex; + vec[0] = 1.0 / tex->width[0]; + vec[1] = 1.0 / tex->height[0]; + vec[2] = vec[3] = 1; + break; + + default: + assert(0); + } + return vec; + default: debug_printf("r300: Implementation error: Unhandled constant type %i\n", constant->Type); - return zero; + return vec; } } diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index d1eced61db..00f10ffd73 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -571,6 +571,7 @@ static void r300_set_sampler_textures(struct pipe_context* pipe, struct pipe_texture** texture) { struct r300_context* r300 = r300_context(pipe); + boolean is_r500 = r300_screen(r300->context.screen)->caps->is_r500; int i; /* XXX magic num */ @@ -585,6 +586,13 @@ static void r300_set_sampler_textures(struct pipe_context* pipe, pipe_texture_reference((struct pipe_texture**)&r300->textures[i], texture[i]); r300->dirty_state |= (R300_NEW_TEXTURE << i); + + /* R300-specific - set the texrect factor in a fragment shader */ + if (!is_r500 && r300->textures[i]->is_npot) { + /* XXX It would be nice to re-emit just 1 constant, + * XXX not all of them */ + r300->dirty_state |= R300_NEW_FRAGMENT_SHADER_CONSTANTS; + } } } -- cgit v1.2.3 From 6a95996abb33a040f957ffedf3824afcc98a9e71 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Fri, 20 Nov 2009 14:55:22 -0800 Subject: r300g: Texrect factor cleanup. (0, 0, 0, 1) is a much saner default value, and texrect factors only need to be (1/s, 1/t, 0, 1). --- src/gallium/drivers/r300/r300_emit.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 0bdf58202f..37e75ba061 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -129,7 +129,7 @@ static const float * get_shader_constant( struct rc_constant * constant, struct r300_constant_buffer * externals) { - static float vec[4] = { 0.0, 0.0, 0.0, 0.0 }; + static float vec[4] = { 0.0, 0.0, 0.0, 1.0 }; struct pipe_texture *tex; switch(constant->Type) { @@ -140,26 +140,30 @@ static const float * get_shader_constant( return constant->u.Immediate; case RC_CONSTANT_STATE: - switch (constant->u.State[0]) - { - /* R3xx-specific */ + switch (constant->u.State[0]) { + /* Factor for converting rectangle coords to + * normalized coords. Should only show up on non-r500. */ case RC_STATE_R300_TEXRECT_FACTOR: tex = &r300->textures[constant->u.State[1]]->tex; vec[0] = 1.0 / tex->width[0]; vec[1] = 1.0 / tex->height[0]; - vec[2] = vec[3] = 1; break; default: - assert(0); + debug_printf("r300: Implementation error: " + "Unknown RC_CONSTANT type %d\n", constant->u.State[0]); } - return vec; + break; default: - debug_printf("r300: Implementation error: Unhandled constant type %i\n", - constant->Type); - return vec; + debug_printf("r300: Implementation error: " + "Unhandled constant type %d\n", constant->Type); } + + /* This should either be (0, 0, 0, 1), which should be a relatively safe + * RGBA or STRQ value, or it could be one of the RC_CONSTANT_STATE + * state factors. */ + return vec; } /* Convert a normal single-precision float into the 7.16 format -- cgit v1.2.3 From ae70cd1f027bdfc7f500d78b6c5333e6b35d3ee8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 19 Nov 2009 21:07:20 +0100 Subject: r300g: remove variant states from emit_state_invariant --- src/gallium/drivers/r300/r300_state_invariant.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_invariant.c b/src/gallium/drivers/r300/r300_state_invariant.c index c07e6ae676..46d1cb39b5 100644 --- a/src/gallium/drivers/r300/r300_state_invariant.c +++ b/src/gallium/drivers/r300/r300_state_invariant.c @@ -84,7 +84,7 @@ void r300_emit_invariant_state(struct r300_context* r300) END_CS; /* XXX unsorted stuff from surface_fill */ - BEGIN_CS(60 + (caps->has_tcl ? 5 : 0) + (caps->is_r500 ? 4 : 0)); + BEGIN_CS(56 + (caps->has_tcl ? 5 : 0) + (caps->is_r500 ? 4 : 0)); /* Flush PVS. */ OUT_CS_REG(R300_VAP_PVS_STATE_FLUSH_REG, 0x0); @@ -135,8 +135,6 @@ 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); - 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); /* XXX */ -- cgit v1.2.3 From 015e7e7724a64d3d9e02e57f6a8eb88a6441f596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 20 Nov 2009 05:17:00 +0100 Subject: r300g: emit R300_TEX_ENABLE to indicate there are no textures bound Previously, this reg wasn't emitted at all if texture_count == 0. --- src/gallium/drivers/r300/r300_emit.c | 15 +++++++++++++-- src/gallium/drivers/r300/r300_emit.h | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 37e75ba061..6d702c0027 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -837,13 +837,22 @@ void r300_emit_viewport_state(struct r300_context* r300, END_CS; } +void r300_emit_texture_count(struct r300_context* r300) +{ + CS_LOCALS(r300); + + BEGIN_CS(2); + OUT_CS_REG(R300_TX_ENABLE, (1 << r300->texture_count) - 1); + END_CS; + +} + void r300_flush_textures(struct r300_context* r300) { CS_LOCALS(r300); - BEGIN_CS(4); + BEGIN_CS(2); OUT_CS_REG(R300_TX_INVALTAGS, 0); - OUT_CS_REG(R300_TX_ENABLE, (1 << r300->texture_count) - 1); END_CS; } @@ -997,6 +1006,8 @@ validate: /* Samplers and textures are tracked separately but emitted together. */ if (r300->dirty_state & (R300_ANY_NEW_SAMPLERS | R300_ANY_NEW_TEXTURES)) { + r300_emit_texture_count(r300); + for (i = 0; i < MIN2(r300->sampler_count, r300->texture_count); i++) { if (r300->dirty_state & ((R300_NEW_SAMPLER << i) | (R300_NEW_TEXTURE << i))) { diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h index 7c83c5166d..3797d3d332 100644 --- a/src/gallium/drivers/r300/r300_emit.h +++ b/src/gallium/drivers/r300/r300_emit.h @@ -92,6 +92,8 @@ void r300_emit_vertex_shader(struct r300_context* r300, void r300_emit_viewport_state(struct r300_context* r300, struct r300_viewport_state* viewport); +void r300_emit_texture_count(struct r300_context* r300); + void r300_flush_textures(struct r300_context* r300); /* Emit all dirty state. */ -- cgit v1.2.3 From ea98e9820d7117f7a187f355445796b1ef5d9e0c Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 16:03:48 -0800 Subject: draw: Initialize variable in draw_pt.c. --- src/gallium/auxiliary/draw/draw_pt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index dbb5ac7182..4865a2d854 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -192,7 +192,8 @@ draw_print_arrays(struct draw_context *draw, uint prim, int start, uint count) prim, start, count); for (i = 0; i < count; i++) { - uint ii, j; + uint ii = 0; + uint j; if (draw->pt.user.elts) { /* indexed arrays */ -- cgit v1.2.3 From 052b127842af3372fd768eae8e29b240a696a12a Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 16:33:25 -0800 Subject: st/egl: Fix memory leak in egl_tracker.c. --- src/gallium/state_trackers/egl/egl_tracker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/egl/egl_tracker.c b/src/gallium/state_trackers/egl/egl_tracker.c index 5811c20f03..745803c7eb 100644 --- a/src/gallium/state_trackers/egl/egl_tracker.c +++ b/src/gallium/state_trackers/egl/egl_tracker.c @@ -88,11 +88,11 @@ drm_get_device_id(struct drm_device *device) } ret = fgets(path, sizeof( path ), file); + fclose(file); if (!ret) return; sscanf(path, "%x", &device->deviceID); - fclose(file); } static void -- cgit v1.2.3 From 1c181a7eff96816b5d72ea5daab5818eef0ebc60 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 15 Nov 2009 05:25:15 +0100 Subject: r300g: Begin separating HW TCL and SW TCL state and setup. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch removes draw_context entirely from the HW TCL path and cleans up a few other things along the way. Hopefully, nothing got broken. Thanks to Marek Olšák for testing, review, and pointing out my bugs. :3 --- src/gallium/drivers/r300/r300_context.c | 31 ++--- src/gallium/drivers/r300/r300_render.c | 4 - src/gallium/drivers/r300/r300_state.c | 8 +- src/gallium/drivers/r300/r300_state_derived.c | 192 +++++++++++++------------- src/gallium/drivers/r300/r300_vbo.c | 46 ------ src/gallium/drivers/r300/r300_vs.h | 3 - 6 files changed, 110 insertions(+), 174 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index ae23329b83..26db536248 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -123,15 +123,24 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->context.clear = r300_clear; - if (r300screen->caps->has_tcl) - { + if (r300screen->caps->has_tcl) { r300->context.draw_arrays = r300_draw_arrays; r300->context.draw_elements = r300_draw_elements; r300->context.draw_range_elements = r300_draw_range_elements; - } - else - { - assert(0); + } else { + r300->context.draw_arrays = r300_swtcl_draw_arrays; + r300->context.draw_elements = r300_draw_elements; + r300->context.draw_range_elements = r300_swtcl_draw_range_elements; + + /* Create a Draw. This is used for SW TCL. */ + r300->draw = draw_create(); + /* Enable our renderer. */ + draw_set_rasterize_stage(r300->draw, r300_draw_stage(r300)); + /* Enable Draw's clipping. */ + draw_set_driver_clipping(r300->draw, FALSE); + /* Force Draw to never do viewport transform, since we can do + * transform in hardware, always. */ + draw_set_viewport_state(r300->draw, &r300_viewport_identity); } r300->context.is_texture_referenced = r300_is_texture_referenced; @@ -145,16 +154,6 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->scissor_state = CALLOC_STRUCT(r300_scissor_state); r300->viewport_state = CALLOC_STRUCT(r300_viewport_state); - /* Create a Draw. This is used for vert collation and SW TCL. */ - r300->draw = draw_create(); - /* Enable our renderer. */ - draw_set_rasterize_stage(r300->draw, r300_draw_stage(r300)); - /* Disable Draw's clipping if TCL is present. */ - draw_set_driver_clipping(r300->draw, r300_screen(screen)->caps->has_tcl); - /* Force Draw to never do viewport transform, since (again) we can do - * transform in hardware, always. */ - draw_set_viewport_state(r300->draw, &r300_viewport_identity); - /* Open up the OQ BO. */ r300->oqbo = screen->buffer_create(screen, 4096, PIPE_BUFFER_USAGE_VERTEX, 4096); diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 62e1456ed3..4c5fb405c6 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -183,8 +183,6 @@ boolean r300_draw_range_elements(struct pipe_context* pipe, return FALSE; } - setup_vertex_attributes(r300); - setup_index_buffer(r300, indexBuffer, indexSize); r300_emit_dirty_state(r300); @@ -226,8 +224,6 @@ boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode, return FALSE; } - setup_vertex_attributes(r300); - r300_emit_dirty_state(r300); r300_emit_aos(r300, start); diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 00f10ffd73..5422a2cc9c 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -714,9 +714,6 @@ 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); @@ -727,8 +724,6 @@ static void r300_bind_vs_state(struct pipe_context* pipe, void* shader) { struct r300_context* r300 = r300_context(pipe); - draw_flush(r300->draw); - if (r300_screen(pipe->screen)->caps->has_tcl) { struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader; @@ -739,10 +734,10 @@ 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 | R300_NEW_VERTEX_SHADER_CONSTANTS; } else { + draw_flush(r300->draw); draw_bind_vertex_shader(r300->draw, (struct draw_vertex_shader*)shader); } @@ -756,7 +751,6 @@ static void r300_delete_vs_state(struct pipe_context* pipe, void* shader) struct r300_vertex_shader* vs = (struct r300_vertex_shader*)shader; rc_constants_destroy(&vs->code.constants); - draw_delete_vertex_shader(r300->draw, vs->draw); FREE((void*)vs->state.tokens); FREE(shader); } else { diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index b4d0eeaf8c..5aa4166d93 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -65,84 +65,43 @@ int r300_shader_key_compare(void* key1, void* key2) { static void r300_vs_tab_routes(struct r300_context* r300, struct r300_vertex_info* vformat) { - struct r300_screen* r300screen = r300_screen(r300->context.screen); struct vertex_info* vinfo = &vformat->vinfo; int* tab = vformat->vs_tab; boolean pos = FALSE, psize = FALSE, fog = FALSE; int i, texs = 0, cols = 0; - struct tgsi_shader_info* info; - - if (r300screen->caps->has_tcl) { - /* Use vertex shader to determine required routes. */ - info = &r300->vs->info; - } else { - /* Use fragment shader to determine required routes. */ - info = &r300->fs->info; - } + struct tgsi_shader_info* info = &r300->fs->info; - assert(info->num_inputs <= 16); + /* XXX One day we should figure out how to handle a different number of + * VS outputs and FS inputs, as well as a different number of vertex streams + * and VS inputs. It's definitely one of the sources of hardlocks. */ - if (!r300screen->caps->has_tcl || !r300->rs_state->enable_vte) - { - for (i = 0; i < info->num_inputs; i++) { - switch (r300->vs->code.inputs[i]) { - case TGSI_SEMANTIC_POSITION: - pos = TRUE; - tab[i] = 0; - break; - case TGSI_SEMANTIC_COLOR: - tab[i] = 2 + cols; - cols++; - break; - case TGSI_SEMANTIC_PSIZE: - assert(psize == FALSE); - psize = TRUE; - tab[i] = 15; - break; - case TGSI_SEMANTIC_FOG: - assert(fog == FALSE); - fog = TRUE; - /* Fall through */ - case TGSI_SEMANTIC_GENERIC: - tab[i] = 6 + texs; - texs++; - break; - default: - debug_printf("r300: Unknown vertex input %d\n", - info->input_semantic_name[i]); - break; - } - } - } - else - { - /* Just copy vert attribs over as-is. */ - for (i = 0; i < info->num_inputs; i++) { - tab[i] = i; - } - - for (i = 0; i < info->num_outputs; i++) { - switch (info->output_semantic_name[i]) { - case TGSI_SEMANTIC_POSITION: - pos = TRUE; - break; - case TGSI_SEMANTIC_COLOR: - cols++; - break; - case TGSI_SEMANTIC_PSIZE: - psize = TRUE; - break; - case TGSI_SEMANTIC_FOG: - fog = TRUE; - /* Fall through */ - case TGSI_SEMANTIC_GENERIC: - texs++; - break; - default: - debug_printf("r300: Unknown vertex output %d\n", - info->output_semantic_name[i]); - break; - } + for (i = 0; i < info->num_inputs; i++) { + switch (info->input_semantic_name[i]) { + case TGSI_SEMANTIC_POSITION: + pos = TRUE; + tab[i] = 0; + break; + case TGSI_SEMANTIC_COLOR: + tab[i] = 2 + cols; + cols++; + break; + case TGSI_SEMANTIC_PSIZE: + assert(psize == FALSE); + psize = TRUE; + tab[i] = 15; + break; + case TGSI_SEMANTIC_FOG: + assert(fog == FALSE); + fog = TRUE; + /* Fall through */ + case TGSI_SEMANTIC_GENERIC: + tab[i] = 6 + texs; + texs++; + break; + default: + debug_printf("r300: Unknown vertex input %d\n", + info->input_semantic_name[i]); + break; } } @@ -161,8 +120,7 @@ static void r300_vs_tab_routes(struct r300_context* r300, /* We need to add vertex position attribute only for SW TCL case, * for HW TCL case it could be generated by vertex shader */ - if (!pos && !r300screen->caps->has_tcl) { - debug_printf("r300: Forcing vertex position attribute emit...\n"); + if (!pos) { /* Make room for the position attribute * at the beginning of the tab. */ for (i = 15; i > 0; i--) { @@ -230,31 +188,66 @@ static void r300_vs_tab_routes(struct r300_context* r300, static void r300_vertex_psc(struct r300_context* r300, struct r300_vertex_info* vformat) { - struct r300_screen* r300screen = r300_screen(r300->context.screen); - struct vertex_info* vinfo = &vformat->vinfo; - int* tab = vformat->vs_tab; uint16_t type, swizzle; enum pipe_format format; - unsigned i, attrib_count; + unsigned i; /* Vertex shaders have no semantics on their inputs, - * so PSC should just route stuff based on their info, + * so PSC should just route stuff based on the vertex elements, * and not on attrib information. */ - if (r300screen->caps->has_tcl) { - attrib_count = r300->vs->info.num_inputs; - DBG(r300, DBG_DRAW, "r300: routing %d attribs in psc for vs\n", - attrib_count); - } else { - attrib_count = vinfo->num_attribs; - DBG(r300, DBG_DRAW, "r300: attrib count: %d\n", attrib_count); - for (i = 0; i < attrib_count; i++) { - DBG(r300, DBG_DRAW, "r300: attrib: offset %d, interp %d, size %d," - " tab %d\n", vinfo->attrib[i].src_index, - vinfo->attrib[i].interp_mode, vinfo->attrib[i].emit, - tab[i]); + DBG(r300, DBG_DRAW, "r300: vs expects %d attribs, routing %d elements" + " in psc\n", + r300->vs->info.num_inputs, + r300->vertex_element_count); + + for (i = 0; i < r300->vertex_element_count; i++) { + format = r300->vertex_element[i].src_format; + + type = r300_translate_vertex_data_type(format) | + (i << R300_DST_VEC_LOC_SHIFT); + swizzle = r300_translate_vertex_data_swizzle(format); + + if (i % 2) { + vformat->vap_prog_stream_cntl[i >> 1] |= type << 16; + vformat->vap_prog_stream_cntl_ext[i >> 1] |= swizzle << 16; + } else { + vformat->vap_prog_stream_cntl[i >> 1] |= type; + vformat->vap_prog_stream_cntl_ext[i >> 1] |= swizzle; } } + + assert(i <= 15); + + /* Set the last vector in the PSC. */ + if (i) { + i -= 1; + } + vformat->vap_prog_stream_cntl[i >> 1] |= + (R300_LAST_VEC << (i & 1 ? 16 : 0)); +} + +/* Update the PSC tables for SW TCL, using Draw. */ +static void r300_swtcl_vertex_psc(struct r300_context* r300, + struct r300_vertex_info* vformat) +{ + struct vertex_info* vinfo = &vformat->vinfo; + int* tab = vformat->vs_tab; + uint16_t type, swizzle; + enum pipe_format format; + unsigned i, attrib_count; + + /* For each Draw attribute, route it to the fragment shader according + * to the tab. */ + attrib_count = vinfo->num_attribs; + DBG(r300, DBG_DRAW, "r300: attrib count: %d\n", attrib_count); + for (i = 0; i < attrib_count; i++) { + DBG(r300, DBG_DRAW, "r300: attrib: offset %d, interp %d, size %d," + " tab %d\n", vinfo->attrib[i].src_index, + vinfo->attrib[i].interp_mode, vinfo->attrib[i].emit, + tab[i]); + } + for (i = 0; i < attrib_count; i++) { /* Make sure we have a proper destination for our attribute. */ assert(tab[i] != -1); @@ -272,12 +265,10 @@ static void r300_vertex_psc(struct r300_context* r300, /* Add the attribute to the PSC table. */ if (i & 1) { vformat->vap_prog_stream_cntl[i >> 1] |= type << 16; - vformat->vap_prog_stream_cntl_ext[i >> 1] |= swizzle << 16; } else { - vformat->vap_prog_stream_cntl[i >> 1] |= type << 0; - - vformat->vap_prog_stream_cntl_ext[i >> 1] |= swizzle << 0; + vformat->vap_prog_stream_cntl[i >> 1] |= type; + vformat->vap_prog_stream_cntl_ext[i >> 1] |= swizzle; } } @@ -505,7 +496,13 @@ static void r300_update_derived_shader_state(struct r300_context* r300) } r300_vs_tab_routes(r300, vformat); - r300_vertex_psc(r300, vformat); + + if (r300screen->caps->has_tcl) { + r300_vertex_psc(r300, vformat); + } else { + r300_swtcl_vertex_psc(r300, vformat); + } + r300_update_fs_tab(r300, vformat); r300_update_rs_block(r300, rs_block); @@ -553,8 +550,7 @@ static void r300_update_ztop(struct r300_context* r300) void r300_update_derived_state(struct r300_context* r300) { - /* XXX */ - if (TRUE || r300->dirty_state & + if (r300->dirty_state & (R300_NEW_FRAGMENT_SHADER | R300_NEW_VERTEX_SHADER)) { r300_update_derived_shader_state(r300); } diff --git a/src/gallium/drivers/r300/r300_vbo.c b/src/gallium/drivers/r300/r300_vbo.c index a6a159667a..6ebaf715dc 100644 --- a/src/gallium/drivers/r300/r300_vbo.c +++ b/src/gallium/drivers/r300/r300_vbo.c @@ -34,52 +34,6 @@ #include "r300_reg.h" #include "r300_winsys.h" -static INLINE void setup_vertex_attribute(struct r300_vertex_info *vinfo, - struct pipe_vertex_element *vert_elem, - unsigned attr_num) -{ - uint16_t hw_fmt1, hw_fmt2; - - hw_fmt1 = r300_translate_vertex_data_type(vert_elem->src_format) | - (attr_num << R300_DST_VEC_LOC_SHIFT); - hw_fmt2 = r300_translate_vertex_data_swizzle(vert_elem->src_format); - - if (attr_num % 2 == 0) - { - vinfo->vap_prog_stream_cntl[attr_num >> 1] = hw_fmt1; - vinfo->vap_prog_stream_cntl_ext[attr_num >> 1] = hw_fmt2; - } - else - { - vinfo->vap_prog_stream_cntl[attr_num >> 1] |= hw_fmt1 << 16; - vinfo->vap_prog_stream_cntl_ext[attr_num >> 1] |= hw_fmt2 << 16; - } -} - -static void finish_vertex_attribs_setup(struct r300_vertex_info *vinfo, - unsigned attribs_num) -{ - uint32_t last_vec_bit = (attribs_num % 2 == 0) ? - (R300_LAST_VEC << 16) : R300_LAST_VEC; - - assert(attribs_num > 0 && attribs_num <= 16); - vinfo->vap_prog_stream_cntl[(attribs_num - 1) >> 1] |= last_vec_bit; -} - -void setup_vertex_attributes(struct r300_context *r300) -{ - struct pipe_vertex_element *vert_elem; - int i; - - for (i = 0; i < r300->vertex_element_count; i++) { - vert_elem = &r300->vertex_element[i]; - setup_vertex_attribute(r300->vertex_info, vert_elem, i); - } - - finish_vertex_attribs_setup(r300->vertex_info, - r300->vertex_element_count); -} - static INLINE int get_buffer_offset(struct r300_context *r300, unsigned int buf_nr, unsigned int elem_offset) diff --git a/src/gallium/drivers/r300/r300_vs.h b/src/gallium/drivers/r300/r300_vs.h index 2a4ce315e3..00b02bf510 100644 --- a/src/gallium/drivers/r300/r300_vs.h +++ b/src/gallium/drivers/r300/r300_vs.h @@ -35,9 +35,6 @@ 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; -- cgit v1.2.3 From b7078a88119e248b0196f7446abe029c22f1ee28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 14 Nov 2009 23:27:20 +0100 Subject: r300g: add texture lod clamping These now work: piglit/lodclamp piglit/levelclamp --- src/gallium/drivers/r300/r300_context.h | 4 ++++ src/gallium/drivers/r300/r300_emit.c | 11 ++++++++++- src/gallium/drivers/r300/r300_reg.h | 5 +++-- src/gallium/drivers/r300/r300_state.c | 5 +++++ src/gallium/drivers/r300/r300_texture.c | 3 +-- 5 files changed, 23 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index f954ba7f9a..60ef415caa 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -92,6 +92,10 @@ struct r300_sampler_state { uint32_t filter0; /* R300_TX_FILTER0: 0x4400 */ uint32_t filter1; /* R300_TX_FILTER1: 0x4440 */ uint32_t border_color; /* R300_TX_BORDER_COLOR: 0x45c0 */ + + /* Min/max LOD must be clamped to [0, last_level], thus + * it's dependent on a currently bound texture */ + unsigned min_lod, max_lod; }; struct r300_scissor_state { diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 6d702c0027..ad7dff36be 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -583,6 +583,8 @@ void r300_emit_texture(struct r300_context* r300, unsigned offset) { uint32_t filter0 = sampler->filter0; + uint32_t format0 = tex->state.format0; + unsigned min_level, max_level; CS_LOCALS(r300); /* to emulate 1D textures through 2D ones correctly */ @@ -591,13 +593,20 @@ void r300_emit_texture(struct r300_context* r300, filter0 |= R300_TX_WRAP_T(R300_TX_CLAMP_TO_EDGE); } + /* determine min/max levels */ + /* the MAX_MIP level is the largest (finest) one */ + max_level = MIN2(sampler->max_lod, tex->tex.last_level); + min_level = MIN2(sampler->min_lod, max_level); + format0 |= R300_TX_NUM_LEVELS(max_level); + filter0 |= R300_TX_MAX_MIP_LEVEL(min_level); + BEGIN_CS(16); OUT_CS_REG(R300_TX_FILTER0_0 + (offset * 4), filter0 | (offset << 28)); OUT_CS_REG(R300_TX_FILTER1_0 + (offset * 4), sampler->filter1); OUT_CS_REG(R300_TX_BORDER_COLOR_0 + (offset * 4), sampler->border_color); - OUT_CS_REG(R300_TX_FORMAT0_0 + (offset * 4), tex->state.format0); + OUT_CS_REG(R300_TX_FORMAT0_0 + (offset * 4), format0); OUT_CS_REG(R300_TX_FORMAT1_0 + (offset * 4), tex->state.format1); OUT_CS_REG(R300_TX_FORMAT2_0 + (offset * 4), tex->state.format2); OUT_CS_REG_SEQ(R300_TX_OFFSET_0 + (offset * 4), 1); diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h index 8ca785cb58..66fdada221 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -1463,6 +1463,8 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_TX_MIN_FILTER_MIP_NEAREST (1 << 13) # define R300_TX_MIN_FILTER_MIP_LINEAR (2 << 13) # define R300_TX_MIN_FILTER_MIP_MASK (3 << 13) +# define R300_TX_MAX_MIP_LEVEL_SHIFT 17 +# define R300_TX_MAX_MIP_LEVEL_MASK (0xf << 17) # define R300_TX_MAX_ANISO_1_TO_1 (0 << 21) # define R300_TX_MAX_ANISO_2_TO_1 (1 << 21) # define R300_TX_MAX_ANISO_4_TO_1 (2 << 21) @@ -1471,6 +1473,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # 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_MAX_MIP_LEVEL(x) ((x) << 17) #define R300_TX_FILTER1_0 0x4440 # define R300_CHROMA_KEY_MODE_DISABLE 0 @@ -1500,8 +1503,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_TX_HEIGHTMASK_MASK (2047 << 11) # define R300_TX_DEPTHMASK_SHIFT 22 # define R300_TX_DEPTHMASK_MASK (0xf << 22) -# define R300_TX_MAX_MIP_LEVEL_SHIFT 26 -# define R300_TX_MAX_MIP_LEVEL_MASK (0xf << 26) # define R300_TX_SIZE_PROJECTED (1 << 30) # define R300_TX_PITCH_EN (1 << 31) # define R300_TX_WIDTH(x) ((x) << 0) diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 5422a2cc9c..f2867675f0 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -523,6 +523,11 @@ static void* state->mag_img_filter, state->min_mip_filter); + /* Unfortunately, r300-r500 don't support floating-point mipmap lods. */ + /* We must pass these to the emit function to clamp them properly. */ + sampler->min_lod = MAX2((unsigned)state->min_lod, 0); + sampler->max_lod = MAX2((unsigned)ceilf(state->max_lod), 0); + lod_bias = CLAMP((int)(state->lod_bias * 32), -(1 << 9), (1 << 9) - 1); sampler->filter1 |= lod_bias << R300_LOD_BIAS_SHIFT; diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index aea25cf71d..d13aa8f036 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -43,8 +43,7 @@ static void r300_setup_texture_state(struct r300_texture* tex, boolean is_r500) state->format2 = (tex->pitch[0] - 1) & 0x1fff; } else { /* power of two textures (3D, mipmaps, and no pitch) */ - state->format0 |= R300_TX_DEPTH(util_logbase2(pt->depth[0]) & 0xf) | - R300_TX_NUM_LEVELS(pt->last_level & 0xf); + state->format0 |= R300_TX_DEPTH(util_logbase2(pt->depth[0]) & 0xf); } state->format1 = r300_translate_texformat(pt->format); -- cgit v1.2.3 From 4e1236e60267d036a1a604412bd7efd7a249a588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 15 Nov 2009 16:41:25 +0100 Subject: r300g: fix updating a vertex format We must update PSC when we change the vertex format, e.g. vertex colors from RGBA to BGRA. --- src/gallium/drivers/r300/r300_state.c | 2 ++ src/gallium/drivers/r300/r300_state_derived.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index f2867675f0..997d59ff6f 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -687,6 +687,8 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe, draw_flush(r300->draw); draw_set_vertex_buffers(r300->draw, count, buffers); } + + r300->state |= R300_NEW_VERTEX_FORMAT; } static void r300_set_vertex_elements(struct pipe_context* pipe, diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 5aa4166d93..82f2be3101 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -512,7 +512,7 @@ static void r300_update_derived_shader_state(struct r300_context* r300) r300->vertex_info = vformat; r300->rs_block = rs_block; - r300->dirty_state |= (R300_NEW_VERTEX_FORMAT | R300_NEW_RS_BLOCK); + r300->dirty_state |= R300_NEW_RS_BLOCK; } static void r300_update_ztop(struct r300_context* r300) @@ -551,7 +551,8 @@ static void r300_update_ztop(struct r300_context* r300) void r300_update_derived_state(struct r300_context* r300) { if (r300->dirty_state & - (R300_NEW_FRAGMENT_SHADER | R300_NEW_VERTEX_SHADER)) { + (R300_NEW_FRAGMENT_SHADER | R300_NEW_VERTEX_SHADER | + R300_NEW_VERTEX_FORMAT)) { r300_update_derived_shader_state(r300); } -- cgit v1.2.3 From 624a0cd9c1bcc8d0952bb30e3336237fb99041b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 19 Nov 2009 20:41:19 +0100 Subject: r300g: fix typo in r300_reg.h to prevent the RS unit from doing random things And reorder fragment shader inputs so that the colors are before texcoords, as is allocated by the shader compiler. This commit makes VS->FS attribute routing work on R500. --- src/gallium/drivers/r300/r300_reg.h | 2 +- src/gallium/drivers/r300/r300_state_derived.c | 26 ++++++++++++-------------- 2 files changed, 13 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h index 66fdada221..3a419b24b0 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -1293,7 +1293,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R500_RS_INST_TEX_ID(x) ((x) << 0) #define R500_RS_INST_TEX_CN_WRITE (1 << 4) #define R500_RS_INST_TEX_ADDR_SHIFT 5 -# define R500_RS_INST_TEX_ADDR(x) ((x) << 0) +# define R500_RS_INST_TEX_ADDR(x) ((x) << 5) #define R500_RS_INST_COL_ID_SHIFT 12 # define R500_RS_INST_COL_ID(x) ((x) << 12) #define R500_RS_INST_COL_CN_NO_WRITE (0 << 16) diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 82f2be3101..8faf78932d 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -381,17 +381,18 @@ static void r300_update_rs_block(struct r300_context* r300, col_count++; } + 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); + fp_offset++; + } + 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); 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); - fp_offset++; - } } else { for (i = 0; i < info->num_inputs; i++) { switch (info->input_semantic_name[i]) { @@ -416,8 +417,10 @@ static void r300_update_rs_block(struct r300_context* r300, } } + /* Rasterize at least one color, or bad things happen. */ if (col_count == 0) { rs->ip[0] |= R300_RS_COL_FMT(R300_RS_COL_FMT_0001); + col_count++; } if (tex_count == 0) { @@ -428,9 +431,10 @@ 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 < 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); + fp_offset++; } for (i = 0; i < tex_count; i++) { @@ -438,12 +442,6 @@ static void r300_update_rs_block(struct r300_context* r300, 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); - fp_offset++; - } } rs->count = (rs_tex_comp) | (col_count << R300_IC_COUNT_SHIFT) | -- cgit v1.2.3 From 435c495549d707432f9fb9868e665a42a6923058 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 19 Nov 2009 22:40:11 +0100 Subject: r300g: silence warnings --- src/gallium/drivers/r300/r300_screen.h | 2 ++ src/gallium/drivers/r300/r300_state_derived.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h index 41df31f670..1ce5ff3904 100644 --- a/src/gallium/drivers/r300/r300_screen.h +++ b/src/gallium/drivers/r300/r300_screen.h @@ -27,6 +27,8 @@ #include "r300_chipset.h" +struct r300_winsys; + struct r300_screen { /* Parent class */ struct pipe_screen screen; diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 8faf78932d..962754f3b1 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -47,8 +47,8 @@ struct r300_shader_derived_value { unsigned r300_shader_key_hash(void* key) { struct r300_shader_key* shader_key = (struct r300_shader_key*)key; - unsigned vs = (unsigned)shader_key->vs; - unsigned fs = (unsigned)shader_key->fs; + unsigned vs = (intptr_t)shader_key->vs; + unsigned fs = (intptr_t)shader_key->fs; return (vs << 16) | (fs & 0xffff); } -- cgit v1.2.3 From 8451b29d9628f09b65962385bfbd95cd7f26427f Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 21 Nov 2009 13:33:21 +0100 Subject: i965: Fix several memory leaks on exit. Bug #25194. --- src/mesa/drivers/dri/i965/brw_state.h | 1 + src/mesa/drivers/dri/i965/brw_state_upload.c | 2 +- src/mesa/drivers/dri/i965/brw_vtbl.c | 12 +++++++++--- src/mesa/drivers/dri/i965/brw_wm.c | 1 - 4 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index ab6f158080..b129b1f1c3 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -112,6 +112,7 @@ void brw_validate_state(struct brw_context *brw); void brw_upload_state(struct brw_context *brw); void brw_init_state(struct brw_context *brw); void brw_destroy_state(struct brw_context *brw); +void brw_clear_validated_bos(struct brw_context *brw); /*********************************************************************** * brw_state_cache.c diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index f4283bda1b..af8dfb4c15 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -143,7 +143,7 @@ static void xor_states( struct brw_state_flags *result, result->cache = a->cache ^ b->cache; } -static void +void brw_clear_validated_bos(struct brw_context *brw) { int i; diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c index 114e6bd018..34aaea3736 100644 --- a/src/mesa/drivers/dri/i965/brw_vtbl.c +++ b/src/mesa/drivers/dri/i965/brw_vtbl.c @@ -46,7 +46,7 @@ #include "brw_state.h" #include "brw_fallback.h" #include "brw_vs.h" - +#include "brw_wm.h" static void dri_bo_release(dri_bo **bo) @@ -66,8 +66,14 @@ static void brw_destroy_context( struct intel_context *intel ) brw_destroy_state(brw); brw_draw_destroy( brw ); - - _mesa_free(brw->wm.compile_data); + brw_clear_validated_bos(brw); + if (brw->wm.compile_data) { + _mesa_free(brw->wm.compile_data->instruction); + _mesa_free(brw->wm.compile_data->vreg); + _mesa_free(brw->wm.compile_data->refs); + _mesa_free(brw->wm.compile_data->prog_instructions); + _mesa_free(brw->wm.compile_data); + } for (i = 0; i < brw->state.nr_color_regions; i++) intel_region_release(&brw->state.color_regions[i]); diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c index 77e3b2c32a..6895f64410 100644 --- a/src/mesa/drivers/dri/i965/brw_wm.c +++ b/src/mesa/drivers/dri/i965/brw_wm.c @@ -157,7 +157,6 @@ static void do_wm_prog( struct brw_context *brw, sizeof(*c->prog_instructions)); c->vreg = _mesa_calloc(BRW_WM_MAX_VREG * sizeof(*c->vreg)); c->refs = _mesa_calloc(BRW_WM_MAX_REF * sizeof(*c->refs)); - c->vreg = _mesa_calloc(BRW_WM_MAX_VREG * sizeof(*c->vreg)); } else { void *instruction = c->instruction; void *prog_instructions = c->prog_instructions; -- cgit v1.2.3 From c367f4d46ee70c1d5879031235824e59e13f6677 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Sat, 21 Nov 2009 04:22:50 -0800 Subject: mesa: handle different RowStride in _mesa_get_compressed_teximage drivers storing compressed textures with non-native stride but relying on _mesa_get_compressed_teximage for GetCompressedTexImage otherwise won't work correctly (for instance i965 compressed mipmaps). --- src/mesa/main/texgetimage.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 2f88718933..008407210d 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -521,10 +521,11 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_object *texObj, struct gl_texture_image *texImage) { - const GLuint size = _mesa_format_image_size(texImage->TexFormat, - texImage->Width, - texImage->Height, - texImage->Depth); + const GLuint row_stride = _mesa_format_row_stride(texImage->TexFormat, + texImage->Width); + const GLuint row_stride_stored = _mesa_format_row_stride(texImage->TexFormat, + texImage->RowStride); + GLuint i; if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { /* pack texture image into a PBO */ @@ -540,8 +541,22 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, img = ADD_POINTERS(buf, img); } - /* just memcpy, no pixelstore or pixel transfer */ - _mesa_memcpy(img, texImage->Data, size); + /* no pixelstore or pixel transfer, but respect stride */ + + if (row_stride == row_stride_stored) { + const GLuint size = _mesa_format_image_size(texImage->TexFormat, + texImage->Width, + texImage->Height, + texImage->Depth); + _mesa_memcpy(img, texImage->Data, size); + } + else { + GLuint bw, bh; + _mesa_get_format_block_size(texImage->TexFormat, &bw, &bh); + for (i = 0; i < (texImage->Height + bh - 1) / bh; i++) { + memcpy(img + i * row_stride, texImage->Data + i * row_stride_stored, row_stride); + } + } if (_mesa_is_bufferobj(ctx->Pack.BufferObj)) { ctx->Driver.UnmapBuffer(ctx, GL_PIXEL_PACK_BUFFER_EXT, -- cgit v1.2.3 From 465fee75ee8991349da742e5a1a5be3cd179bb62 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Sat, 21 Nov 2009 04:39:30 -0800 Subject: intel: make CopyTex[Sub]Image fallback debug messages more consistent --- src/mesa/drivers/dri/intel/intel_tex_copy.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index 4b5fe7be9f..767d04d2f4 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -221,6 +221,8 @@ intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level, return; fail: + if (INTEL_DEBUG & DEBUG_FALLBACKS) + fprintf(stderr, "%s - fallback to swrast\n", __FUNCTION__); _mesa_meta_CopyTexImage1D(ctx, target, level, internalFormat, x, y, width, border); } @@ -268,6 +270,8 @@ intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level, return; fail: + if (INTEL_DEBUG & DEBUG_FALLBACKS) + fprintf(stderr, "%s - fallback to swrast\n", __FUNCTION__); _mesa_meta_CopyTexImage2D(ctx, target, level, internalFormat, x, y, width, height, border); } @@ -292,6 +296,8 @@ intelCopyTexSubImage1D(GLcontext * ctx, GLenum target, GLint level, if (!do_copy_texsubimage(intel_context(ctx), target, intel_texture_image(texImage), internalFormat, xoffset, 0, x, y, width, 1)) { + if (INTEL_DEBUG & DEBUG_FALLBACKS) + fprintf(stderr, "%s - fallback to swrast\n", __FUNCTION__); _mesa_meta_CopyTexSubImage1D(ctx, target, level, xoffset, x, y, width); } } @@ -317,8 +323,8 @@ intelCopyTexSubImage2D(GLcontext * ctx, GLenum target, GLint level, internalFormat, xoffset, yoffset, x, y, width, height)) { - DBG("%s - fallback to _mesa_meta_CopyTexSubImage2D\n", __FUNCTION__); - + if (INTEL_DEBUG & DEBUG_FALLBACKS) + fprintf(stderr, "%s - fallback to swrast\n", __FUNCTION__); _mesa_meta_CopyTexSubImage2D(ctx, target, level, xoffset, yoffset, x, y, width, height); } -- cgit v1.2.3 From 1d1f81af93058541992bd0795b86500509edea56 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 21 Nov 2009 15:56:02 +0100 Subject: radeon: fix glCompressedTexSubImage --- src/mesa/drivers/dri/radeon/radeon_texture.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 6f11f1fa4a..1ee9e2792a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -582,12 +582,12 @@ static void radeon_store_teximage(GLcontext* ctx, int dims, /* TODO */ assert(0); } else { - dstRowStride = _mesa_format_row_stride(texImage->TexFormat, width); + dstRowStride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width); } if (dims == 3) { unsigned alignedWidth = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat); - dstImageOffsets = allocate_image_offsets(ctx, alignedWidth, height, depth); + dstImageOffsets = allocate_image_offsets(ctx, alignedWidth, texImage->Height, texImage->Depth); if (!dstImageOffsets) { return; } @@ -598,8 +598,11 @@ static void radeon_store_teximage(GLcontext* ctx, int dims, radeon_teximage_map(image, GL_TRUE); if (compressed) { - uint32_t srcRowStride, bytesPerRow, rows; + uint32_t srcRowStride, bytesPerRow, rows, block_width, block_height; GLubyte *img_start; + + _mesa_get_format_block_size(texImage->TexFormat, &block_width, &block_height); + if (!image->mt) { dstRowStride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width); img_start = _mesa_compressed_image_address(xoffset, yoffset, 0, @@ -607,17 +610,16 @@ static void radeon_store_teximage(GLcontext* ctx, int dims, texImage->Width, texImage->Data); } else { - uint32_t blocks_x, block_width, block_height; - _mesa_get_format_block_size(image->mt->mesaFormat, &block_width, &block_height); - blocks_x = dstRowStride / block_width; - img_start = texImage->Data + _mesa_get_format_bytes(image->mt->mesaFormat) * 4 * (blocks_x * (yoffset / 4) + xoffset / 4); + uint32_t offset; + offset = dstRowStride / _mesa_get_format_bytes(texImage->TexFormat) * yoffset / block_height + xoffset / block_width; + offset *= _mesa_get_format_bytes(texImage->TexFormat); + img_start = texImage->Data + offset; } srcRowStride = _mesa_format_row_stride(texImage->TexFormat, width); bytesPerRow = srcRowStride; - rows = (height + 3) / 4; - - copy_rows(img_start, dstRowStride, pixels, srcRowStride, rows, bytesPerRow); + rows = (height + block_height - 1) / block_height; + copy_rows(img_start, dstRowStride, pixels, srcRowStride, rows, bytesPerRow); } else { if (!_mesa_texstore(ctx, dims, texImage->_BaseFormat, -- cgit v1.2.3 From 563fe6e8f6c021ea45120cb1f201a1950b8d6057 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 21 Nov 2009 15:56:23 +0100 Subject: radeon: fix compressed mipmapped textures Tested on r300 only, other cards may require adjusting texture_compressed_row_align. --- .../drivers/dri/radeon/radeon_common_context.c | 2 +- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 49 ++++++++++++---------- 2 files changed, 29 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index 2a38c4599c..71f70d724b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -262,7 +262,7 @@ GLboolean radeonInitContext(radeonContextPtr radeon, else radeon->texture_row_align = 32; radeon->texture_rect_row_align = 64; - radeon->texture_compressed_row_align = 64; + radeon->texture_compressed_row_align = 32; } radeon_init_dma(radeon); diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index 0497fa7db5..a11b5b9979 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -37,26 +37,35 @@ #include "main/texobj.h" #include "radeon_texture.h" -static GLuint radeon_compressed_texture_size(GLcontext *ctx, - GLsizei width, GLsizei height, GLsizei depth, - gl_format mesaFormat) +static unsigned get_aligned_compressed_row_stride( + gl_format format, + unsigned width, + unsigned minStride) { - GLuint size = _mesa_format_image_size(mesaFormat, width, height, depth); - - if (mesaFormat == MESA_FORMAT_RGB_DXT1 || - mesaFormat == MESA_FORMAT_RGBA_DXT1) { - if (width + 3 < 8) /* width one block */ - size = size * 4; - else if (width + 3 < 16) - size = size * 2; - } else { - /* DXT3/5, 16 bytes per block */ - // WARN_ONCE("DXT 3/5 suffers from multitexturing problems!\n"); - if (width + 3 < 8) - size = size * 2; + const unsigned blockSize = _mesa_get_format_bytes(format); + unsigned blockWidth, blockHeight, numXBlocks; + + _mesa_get_format_block_size(format, &blockWidth, &blockHeight); + numXBlocks = (width + blockWidth - 1) / blockWidth; + + while (numXBlocks * blockSize < minStride) + { + ++numXBlocks; } - return size; + return numXBlocks * blockSize; +} + +static unsigned get_compressed_image_size( + gl_format format, + unsigned rowStride, + unsigned height) +{ + unsigned blockWidth, blockHeight; + + _mesa_get_format_block_size(format, &blockWidth, &blockHeight); + + return rowStride * ((height + blockHeight - 1) / blockHeight); } /** @@ -74,10 +83,8 @@ static void compute_tex_image_offset(radeonContextPtr rmesa, radeon_mipmap_tree /* Find image size in bytes */ if (_mesa_is_format_compressed(mt->mesaFormat)) { - /* TODO: Is this correct? Need test cases for compressed textures! */ - row_align = rmesa->texture_compressed_row_align - 1; - lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align; - lvl->size = radeon_compressed_texture_size(rmesa->glCtx, lvl->width, lvl->height, lvl->depth, mt->mesaFormat); + lvl->rowstride = get_aligned_compressed_row_stride(mt->mesaFormat, lvl->width, rmesa->texture_compressed_row_align); + lvl->size = get_compressed_image_size(mt->mesaFormat, lvl->rowstride, lvl->height); } else if (mt->target == GL_TEXTURE_RECTANGLE_NV) { row_align = rmesa->texture_rect_row_align - 1; lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align; -- cgit v1.2.3 From 3a2cd66af8774af15eabef655ded9b48e67242d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 21 Nov 2009 05:51:13 +0100 Subject: r300g: clean up vs/fs tabs Instead of vs_tab, we use vs_output_tab and it's local now. fs_tab hasn't been used anywhere, so I removed it and r300_update_fs_tab too. --- src/gallium/drivers/r300/r300_context.h | 5 -- src/gallium/drivers/r300/r300_state_derived.c | 114 ++++++-------------------- 2 files changed, 25 insertions(+), 94 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 60ef415caa..39c0914cff 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -223,11 +223,6 @@ struct r300_texture { struct r300_vertex_info { /* Parent class */ struct vertex_info vinfo; - /* Map of vertex attributes into PVS memory for HW TCL, - * or GA memory for SW TCL. */ - int vs_tab[16]; - /* Map of rasterizer attributes from GB through RS to US. */ - int fs_tab[16]; /* R300_VAP_PROG_STREAK_CNTL_[0-7] */ uint32_t vap_prog_stream_cntl[8]; diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 962754f3b1..45aeefb483 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -61,12 +61,12 @@ int r300_shader_key_compare(void* key1, void* key2) { (shader_key1->fs == shader_key2->fs); } -/* Set up the vs_tab and routes. */ -static void r300_vs_tab_routes(struct r300_context* r300, - struct r300_vertex_info* vformat) +/* Set up the vs_output_tab and routes. */ +static void r300_vs_output_tab_routes(struct r300_context* r300, + struct r300_vertex_info* vformat, + int* vs_output_tab) { struct vertex_info* vinfo = &vformat->vinfo; - int* tab = vformat->vs_tab; boolean pos = FALSE, psize = FALSE, fog = FALSE; int i, texs = 0, cols = 0; struct tgsi_shader_info* info = &r300->fs->info; @@ -79,23 +79,23 @@ static void r300_vs_tab_routes(struct r300_context* r300, switch (info->input_semantic_name[i]) { case TGSI_SEMANTIC_POSITION: pos = TRUE; - tab[i] = 0; + vs_output_tab[i] = 0; break; case TGSI_SEMANTIC_COLOR: - tab[i] = 2 + cols; + vs_output_tab[i] = 2 + cols; cols++; break; case TGSI_SEMANTIC_PSIZE: assert(psize == FALSE); psize = TRUE; - tab[i] = 15; + vs_output_tab[i] = 15; break; case TGSI_SEMANTIC_FOG: assert(fog == FALSE); fog = TRUE; /* Fall through */ case TGSI_SEMANTIC_GENERIC: - tab[i] = 6 + texs; + vs_output_tab[i] = 6 + texs; texs++; break; default: @@ -122,11 +122,11 @@ static void r300_vs_tab_routes(struct r300_context* r300, * for HW TCL case it could be generated by vertex shader */ if (!pos) { /* Make room for the position attribute - * at the beginning of the tab. */ + * at the beginning of the vs_output_tab. */ for (i = 15; i > 0; i--) { - tab[i] = tab[i-1]; + vs_output_tab[i] = vs_output_tab[i-1]; } - tab[0] = 0; + vs_output_tab[0] = 0; } /* Position. */ @@ -229,34 +229,34 @@ static void r300_vertex_psc(struct r300_context* r300, /* Update the PSC tables for SW TCL, using Draw. */ static void r300_swtcl_vertex_psc(struct r300_context* r300, - struct r300_vertex_info* vformat) + struct r300_vertex_info* vformat, + int* vs_output_tab) { struct vertex_info* vinfo = &vformat->vinfo; - int* tab = vformat->vs_tab; uint16_t type, swizzle; enum pipe_format format; unsigned i, attrib_count; /* For each Draw attribute, route it to the fragment shader according - * to the tab. */ + * to the vs_output_tab. */ attrib_count = vinfo->num_attribs; DBG(r300, DBG_DRAW, "r300: attrib count: %d\n", attrib_count); for (i = 0; i < attrib_count; i++) { DBG(r300, DBG_DRAW, "r300: attrib: offset %d, interp %d, size %d," - " tab %d\n", vinfo->attrib[i].src_index, + " vs_output_tab %d\n", vinfo->attrib[i].src_index, vinfo->attrib[i].interp_mode, vinfo->attrib[i].emit, - tab[i]); + vs_output_tab[i]); } for (i = 0; i < attrib_count; i++) { /* Make sure we have a proper destination for our attribute. */ - assert(tab[i] != -1); + assert(vs_output_tab[i] != -1); format = draw_translate_vinfo_format(vinfo->attrib[i].emit); /* Obtain the type of data in this attribute. */ type = r300_translate_vertex_data_type(format) | - tab[i] << R300_DST_VEC_LOC_SHIFT; + vs_output_tab[i] << R300_DST_VEC_LOC_SHIFT; /* Obtain the swizzle for this attribute. Note that the default * swizzle in the hardware is not XYZW! */ @@ -280,68 +280,6 @@ static void r300_swtcl_vertex_psc(struct r300_context* r300, (R300_LAST_VEC << (i & 1 ? 16 : 0)); } -/* Set up the mappings from GB to US, for RS block. */ -static void r300_update_fs_tab(struct r300_context* r300, - struct r300_vertex_info* vformat) -{ - struct tgsi_shader_info* info = &r300->fs->info; - int i, cols = 0, texs = 0, cols_emitted = 0; - int* tab = vformat->fs_tab; - - for (i = 0; i < 16; i++) { - tab[i] = -1; - } - - assert(info->num_inputs <= 16); - for (i = 0; i < info->num_inputs; i++) { - switch (info->input_semantic_name[i]) { - case TGSI_SEMANTIC_COLOR: - tab[i] = INTERP_LINEAR; - cols++; - break; - case TGSI_SEMANTIC_POSITION: - case TGSI_SEMANTIC_PSIZE: - debug_printf("r300: Implementation error: Can't use " - "pos attribs in fragshader yet!\n"); - /* Pass through for now */ - case TGSI_SEMANTIC_FOG: - case TGSI_SEMANTIC_GENERIC: - tab[i] = INTERP_PERSPECTIVE; - break; - default: - debug_printf("r300: Unknown vertex input %d\n", - info->input_semantic_name[i]); - break; - } - } - - /* Now that we know where everything is... */ - DBG(r300, DBG_DRAW, "r300: fp input count: %d\n", info->num_inputs); - for (i = 0; i < info->num_inputs; i++) { - switch (tab[i]) { - case INTERP_LINEAR: - DBG(r300, DBG_DRAW, "r300: attrib: " - "stack offset %d, color, tab %d\n", - i, cols_emitted); - tab[i] = cols_emitted; - cols_emitted++; - break; - case INTERP_PERSPECTIVE: - DBG(r300, DBG_DRAW, "r300: attrib: " - "stack offset %d, texcoord, tab %d\n", - i, cols + texs); - tab[i] = cols + texs; - texs++; - break; - case -1: - debug_printf("r300: Implementation error: Bad fp interp!\n"); - default: - break; - } - } - -} - /* Set up the RS block. This is the part of the chipset that actually does * the rasterization of vertices into fragments. This is also the part of the * chipset that locks up if any part of it is even slightly wrong. */ @@ -456,8 +394,13 @@ static void r300_update_derived_shader_state(struct r300_context* r300) struct r300_screen* r300screen = r300_screen(r300->context.screen); struct r300_vertex_info* vformat; struct r300_rs_block* rs_block; + int vs_output_tab[16]; int i; + for (i = 0; i < 16; i++) { + vs_output_tab[i] = -1; + } + /* struct r300_shader_key* key; struct r300_shader_derived_value* value; @@ -488,21 +431,14 @@ static void r300_update_derived_shader_state(struct r300_context* r300) vformat = CALLOC_STRUCT(r300_vertex_info); rs_block = CALLOC_STRUCT(r300_rs_block); - for (i = 0; i < 16; i++) { - vformat->vs_tab[i] = -1; - vformat->fs_tab[i] = -1; - } - - r300_vs_tab_routes(r300, vformat); + r300_vs_output_tab_routes(r300, vformat, vs_output_tab); if (r300screen->caps->has_tcl) { r300_vertex_psc(r300, vformat); } else { - r300_swtcl_vertex_psc(r300, vformat); + r300_swtcl_vertex_psc(r300, vformat, vs_output_tab); } - r300_update_fs_tab(r300, vformat); - r300_update_rs_block(r300, rs_block); FREE(r300->vertex_info); -- cgit v1.2.3 From 44c0aaf990f46c6dcb46d58dda0c182f5d40cb42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 20 Nov 2009 04:52:49 +0100 Subject: r300g: do not reallocate r300_vertex_info and r300_rs_block all the time --- src/gallium/drivers/r300/r300_context.c | 2 ++ src/gallium/drivers/r300/r300_state_derived.c | 42 ++++++++++++--------------- 2 files changed, 20 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 26db536248..769733b6dd 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -69,6 +69,7 @@ static void r300_destroy_context(struct pipe_context* context) FREE(r300->blend_color_state); FREE(r300->rs_block); FREE(r300->scissor_state); + FREE(r300->vertex_info); FREE(r300->viewport_state); FREE(r300); } @@ -152,6 +153,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, r300->blend_color_state = CALLOC_STRUCT(r300_blend_color_state); r300->rs_block = CALLOC_STRUCT(r300_rs_block); r300->scissor_state = CALLOC_STRUCT(r300_scissor_state); + r300->vertex_info = CALLOC_STRUCT(r300_vertex_info); r300->viewport_state = CALLOC_STRUCT(r300_viewport_state); /* Open up the OQ BO. */ diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 45aeefb483..6fb780cb29 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -63,10 +63,9 @@ int r300_shader_key_compare(void* key1, void* key2) { /* Set up the vs_output_tab and routes. */ static void r300_vs_output_tab_routes(struct r300_context* r300, - struct r300_vertex_info* vformat, int* vs_output_tab) { - struct vertex_info* vinfo = &vformat->vinfo; + struct vertex_info* vinfo = &r300->vertex_info->vinfo; boolean pos = FALSE, psize = FALSE, fog = FALSE; int i, texs = 0, cols = 0; struct tgsi_shader_info* info = &r300->fs->info; @@ -185,9 +184,9 @@ static void r300_vs_output_tab_routes(struct r300_context* r300, } /* Update the PSC tables. */ -static void r300_vertex_psc(struct r300_context* r300, - struct r300_vertex_info* vformat) +static void r300_vertex_psc(struct r300_context* r300) { + struct r300_vertex_info *vformat = r300->vertex_info; uint16_t type, swizzle; enum pipe_format format; unsigned i; @@ -229,9 +228,9 @@ static void r300_vertex_psc(struct r300_context* r300, /* Update the PSC tables for SW TCL, using Draw. */ static void r300_swtcl_vertex_psc(struct r300_context* r300, - struct r300_vertex_info* vformat, int* vs_output_tab) { + struct r300_vertex_info *vformat = r300->vertex_info; struct vertex_info* vinfo = &vformat->vinfo; uint16_t type, swizzle; enum pipe_format format; @@ -283,9 +282,9 @@ static void r300_swtcl_vertex_psc(struct r300_context* r300, /* Set up the RS block. This is the part of the chipset that actually does * the rasterization of vertices into fragments. This is also the part of the * chipset that locks up if any part of it is even slightly wrong. */ -static void r300_update_rs_block(struct r300_context* r300, - struct r300_rs_block* rs) +static void r300_update_rs_block(struct r300_context* r300) { + struct r300_rs_block* rs = r300->rs_block; struct tgsi_shader_info* info = &r300->fs->info; int col_count = 0, fp_offset = 0, i, tex_count = 0; int rs_tex_comp = 0; @@ -392,14 +391,9 @@ static void r300_update_rs_block(struct r300_context* r300, static void r300_update_derived_shader_state(struct r300_context* r300) { struct r300_screen* r300screen = r300_screen(r300->context.screen); - struct r300_vertex_info* vformat; - struct r300_rs_block* rs_block; int vs_output_tab[16]; int i; - for (i = 0; i < 16; i++) { - vs_output_tab[i] = -1; - } /* struct r300_shader_key* key; @@ -427,25 +421,25 @@ static void r300_update_derived_shader_state(struct r300_context* r300) (void*)key, (void*)value); } */ - /* XXX This will be refactored ASAP. */ - vformat = CALLOC_STRUCT(r300_vertex_info); - rs_block = CALLOC_STRUCT(r300_rs_block); + /* Reset structures */ + memset(r300->rs_block, 0, sizeof(struct r300_rs_block)); + memset(r300->vertex_info, 0, sizeof(struct r300_vertex_info)); - r300_vs_output_tab_routes(r300, vformat, vs_output_tab); + for (i = 0; i < 16; i++) { + vs_output_tab[i] = -1; + } + + /* Update states */ + r300_vs_output_tab_routes(r300, vs_output_tab); if (r300screen->caps->has_tcl) { - r300_vertex_psc(r300, vformat); + r300_vertex_psc(r300); } else { - r300_swtcl_vertex_psc(r300, vformat, vs_output_tab); + r300_swtcl_vertex_psc(r300, vs_output_tab); } - r300_update_rs_block(r300, rs_block); - - FREE(r300->vertex_info); - FREE(r300->rs_block); + r300_update_rs_block(r300); - r300->vertex_info = vformat; - r300->rs_block = rs_block; r300->dirty_state |= R300_NEW_RS_BLOCK; } -- cgit v1.2.3 From 2b07b640619ac68344276ba0557ea46b2cbc3f26 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 21 Nov 2009 19:13:26 -0800 Subject: r300g: Build fix. Oops. --- src/gallium/drivers/r300/r300_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 997d59ff6f..a88d66db24 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -688,7 +688,7 @@ static void r300_set_vertex_buffers(struct pipe_context* pipe, draw_set_vertex_buffers(r300->draw, count, buffers); } - r300->state |= R300_NEW_VERTEX_FORMAT; + r300->dirty_state |= R300_NEW_VERTEX_FORMAT; } static void r300_set_vertex_elements(struct pipe_context* pipe, -- cgit v1.2.3 From 46feb7db71b05ec67a7c78f6bc608adec0734dec Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 22 Nov 2009 00:55:52 -0500 Subject: st/xorg: Reorder cases in switch statement. Silences missing break statement warning. --- src/gallium/state_trackers/xorg/xorg_composite.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index eed7a7d63a..4dbb490ca5 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -151,9 +151,11 @@ render_filter_to_gallium(int xrender_filter, int *out_filter) case PictFilterBest: *out_filter = PIPE_TEX_FILTER_LINEAR; break; + case PictFilterConvolution: + *out_filter = PIPE_TEX_FILTER_NEAREST; + return FALSE; default: debug_printf("Unknown xrender filter\n"); - case PictFilterConvolution: *out_filter = PIPE_TEX_FILTER_NEAREST; return FALSE; } -- cgit v1.2.3 From 88aab56a26dd33a2d3177a41420f00473d7270af Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 22 Nov 2009 01:10:38 -0500 Subject: st/xorg: Prevent potential null pointer deference in xorg_xv.c. --- src/gallium/state_trackers/xorg/xorg_xv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index a1e74fad59..e7f4900528 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -446,7 +446,7 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id, int x, y, w, h; struct exa_pixmap_priv *dst = exaGetPixmapDriverPrivate(pPixmap); - if (!dst->tex) { + if (dst && !dst->tex) { xorg_exa_set_shared_usage(pPixmap); pScrn->pScreen->ModifyPixmapHeader(pPixmap, 0, 0, 0, 0, 0, NULL); } -- cgit v1.2.3 From b62a74d3b94024bc08b31394f827761d354d2516 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 22 Nov 2009 01:20:07 -0500 Subject: svga: Fix memory leak in vmw_screen_ioctl.c --- src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c b/src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c index b3515732a2..51e455f925 100644 --- a/src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c +++ b/src/gallium/winsys/drm/vmware/core/vmw_screen_ioctl.c @@ -331,6 +331,7 @@ vmw_ioctl_region_create(struct vmw_winsys_screen *vws, uint32_t size) return region; out_err1: + FREE(region); return NULL; } -- cgit v1.2.3 From 57d389aab5ea4462475756c0e262f3cb543f889d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 22 Nov 2009 01:26:32 -0500 Subject: svga: Prevent potential null pointer deference in vmw_surface.c. --- src/gallium/winsys/drm/vmware/core/vmw_surface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/core/vmw_surface.c b/src/gallium/winsys/drm/vmware/core/vmw_surface.c index 9ec4bf9272..c19e556df9 100644 --- a/src/gallium/winsys/drm/vmware/core/vmw_surface.c +++ b/src/gallium/winsys/drm/vmware/core/vmw_surface.c @@ -39,7 +39,7 @@ vmw_svga_winsys_surface_reference(struct vmw_svga_winsys_surface **pdst, struct pipe_reference *dst_ref; struct vmw_svga_winsys_surface *dst = *pdst; - if(*pdst == src || pdst == NULL) + if(pdst == NULL || *pdst == src) return; src_ref = src ? &src->refcnt : NULL; -- cgit v1.2.3 From d3b4c99c703f70a9d0e715a97e52672f7f8fc980 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 22 Nov 2009 01:45:53 -0500 Subject: glu: Fix memory leak in __gl_meshMakeEdge. --- src/glu/sgi/libtess/mesh.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/glu/sgi/libtess/mesh.c b/src/glu/sgi/libtess/mesh.c index ae861f8642..95f87cdc94 100644 --- a/src/glu/sgi/libtess/mesh.c +++ b/src/glu/sgi/libtess/mesh.c @@ -284,7 +284,12 @@ GLUhalfEdge *__gl_meshMakeEdge( GLUmesh *mesh ) } e = MakeEdge( &mesh->eHead ); - if (e == NULL) return NULL; + if (e == NULL) { + memFree(newVertex1); + memFree(newVertex2); + memFree(newFace); + return NULL; + } MakeVertex( newVertex1, e, &mesh->vHead ); MakeVertex( newVertex2, e->Sym, &mesh->vHead ); -- cgit v1.2.3 From a9c540f5dedbf593f8038fdbc95eecb60826ab26 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 22 Nov 2009 01:57:35 -0500 Subject: glu/sgi: Fix memory leak in gluScaleImage. --- src/glu/sgi/libutil/mipmap.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c index af647af73c..4139c304a1 100644 --- a/src/glu/sgi/libutil/mipmap.c +++ b/src/glu/sgi/libutil/mipmap.c @@ -3526,6 +3526,8 @@ gluScaleImage(GLenum format, GLsizei widthin, GLsizei heightin, afterImage = malloc(image_size(widthout, heightout, format, GL_UNSIGNED_SHORT)); if (beforeImage == NULL || afterImage == NULL) { + free(beforeImage); + free(afterImage); return GLU_OUT_OF_MEMORY; } -- cgit v1.2.3 From dfe440c856826450195e3fc5100a3b97d7c0b173 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 22 Nov 2009 14:13:18 +0100 Subject: r300: fix SIN/COS/SCS instructions for R300 fp --- src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c index 0326d25233..ced66af1eb 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_alu.c @@ -560,23 +560,23 @@ static void sincos_constants(struct radeon_compiler* c, unsigned int *constants) * MAD dest, tmp.y, weight, tmp.x */ static void sin_approx( - struct radeon_compiler* c, struct rc_instruction * before, + struct radeon_compiler* c, struct rc_instruction * inst, struct rc_dst_register dst, struct rc_src_register src, const unsigned int* constants) { unsigned int tempreg = rc_find_free_temporary(c); - emit2(c, before, RC_OPCODE_MUL, 0, dstregtmpmask(tempreg, RC_MASK_XY), + emit2(c, inst->Prev, RC_OPCODE_MUL, 0, dstregtmpmask(tempreg, RC_MASK_XY), swizzle(src, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X), srcreg(RC_FILE_CONSTANT, constants[0])); - emit3(c, before, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_X), + emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_X), swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y), absolute(swizzle(src, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X)), swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X)); - emit3(c, before, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_Y), + emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dstregtmpmask(tempreg, RC_MASK_Y), swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X), absolute(swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X)), negate(swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X))); - emit3(c, before, RC_OPCODE_MAD, 0, dst, + emit3(c, inst->Prev, RC_OPCODE_MAD, 0, dst, swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y, RC_SWIZZLE_Y), swizzle(srcreg(RC_FILE_CONSTANT, constants[0]), RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W, RC_SWIZZLE_W), swizzle(srcreg(RC_FILE_TEMPORARY, tempreg), RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X, RC_SWIZZLE_X)); -- cgit v1.2.3 From e0fda040135490fdd54e57000c7995e27dc70657 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 22 Nov 2009 15:08:46 +0100 Subject: r300: fix VP source conflict resolution on 64-bit machines On 32bit machines we were lucky because the sizeof(reg) == sizeof(rc_src_register). On 64bit machines pointers are 8 bytes long, so we were overwriting other data. --- src/mesa/drivers/dri/r300/compiler/radeon_program.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program.h b/src/mesa/drivers/dri/r300/compiler/radeon_program.h index 33db3ea0ff..03592884eb 100644 --- a/src/mesa/drivers/dri/r300/compiler/radeon_program.h +++ b/src/mesa/drivers/dri/r300/compiler/radeon_program.h @@ -191,7 +191,7 @@ struct rc_src_register lmul_swizzle(unsigned int swizzle, struct rc_src_register static inline void reset_srcreg(struct rc_src_register* reg) { - memset(reg, 0, sizeof(reg)); + memset(reg, 0, sizeof(struct rc_src_register)); reg->Swizzle = RC_SWIZZLE_XYZW; } -- cgit v1.2.3 From a02938a8421270389178d4969a5411a1691d929a Mon Sep 17 00:00:00 2001 From: Richard Li Date: Fri, 20 Nov 2009 16:36:55 -0500 Subject: r600 : use cf for all pop now, left optimization for future. --- src/mesa/drivers/dri/r600/r700_assembler.c | 56 ++++++++++++++++++++++-------- src/mesa/drivers/dri/r600/r700_assembler.h | 2 +- 2 files changed, 42 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index e3bc46802f..27083a895c 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -39,7 +39,7 @@ #include "r700_assembler.h" #define USE_CF_FOR_CONTINUE_BREAK 1 -//#define USE_CF_FOR_POP_AFTER 1 +#define USE_CF_FOR_POP_AFTER 1 BITS addrmode_PVSDST(PVSDST * pPVSDST) { @@ -3022,7 +3022,6 @@ GLboolean next_ins2(r700_AssemblerBase *pAsm) pAsm->is_tex = GL_FALSE; pAsm->need_tex_barrier = GL_FALSE; - //richard nov.16 glsl pAsm->D2.bits = 0; return GL_TRUE; @@ -5377,32 +5376,35 @@ GLboolean assemble_ENDLOOP(r700_AssemblerBase *pAsm) return GL_FALSE; } - unsigned int unFCSP = 0; + GLuint unFCSP; + GLuint unIF = 0; if((pAsm->unCFflags & HAS_CURRENT_LOOPRET) > 0) { for(unFCSP=(pAsm->FCSP-1); unFCSP>pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry; unFCSP--) { if(FC_LOOP == pAsm->fc_stack[unFCSP].type) { + breakLoopOnFlag(pAsm, unFCSP); break; } + else if(FC_IF == pAsm->fc_stack[unFCSP].type) + { + unIF++; + } } if(unFCSP <= pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry) { - unFCSP = 0; - - returnOnFlag(pAsm); +#ifdef USE_CF_FOR_POP_AFTER + returnOnFlag(pAsm, unIF); +#else + returnOnFlag(pAsm, 0); +#endif /* USE_CF_FOR_POP_AFTER */ pAsm->unCFflags &= ~HAS_CURRENT_LOOPRET; } } pAsm->branch_depth--; pAsm->FCSP--; - - if(unFCSP > 0) - { - breakLoopOnFlag(pAsm, unFCSP); - } return GL_TRUE; } @@ -5459,25 +5461,38 @@ GLboolean assemble_BGNSUB(r700_AssemblerBase *pAsm, GLint nILindex) /* start sub */ pAsm->alu_x_opcode = SQ_CF_INST_ALU; + pAsm->FCSP++; + pAsm->fc_stack[pAsm->FCSP].type = FC_REP; + return GL_TRUE; } GLboolean assemble_ENDSUB(r700_AssemblerBase *pAsm) { + if(pAsm->fc_stack[pAsm->FCSP].type != FC_REP) + { + radeon_error("BGNSUB/ENDSUB in shader code are not paired. \n"); + return GL_FALSE; + } + pAsm->CALLSP--; SetActiveCFlist(pAsm->pR700Shader, pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local); pAsm->alu_x_opcode = SQ_CF_INST_ALU; + pAsm->FCSP--; + return GL_TRUE; } GLboolean assemble_RET(r700_AssemblerBase *pAsm) { + GLuint unIF = 0; + if(pAsm->CALLSP > 0) { /* in sub */ - unsigned int unFCSP; + GLuint unFCSP; for(unFCSP=pAsm->FCSP; unFCSP>pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry; unFCSP--) { if(FC_LOOP == pAsm->fc_stack[unFCSP].type) @@ -5488,9 +5503,20 @@ GLboolean assemble_RET(r700_AssemblerBase *pAsm) return GL_TRUE; } + else if(FC_IF == pAsm->fc_stack[unFCSP].type) + { + unIF++; + } } } - + +#ifdef USE_CF_FOR_POP_AFTER + if(unIF > 0) + { + pops(pAsm, unIF); + } +#endif /* USE_CF_FOR_POP_AFTER */ + add_return_inst(pAsm); return GL_TRUE; @@ -5664,12 +5690,12 @@ GLboolean testFlag(r700_AssemblerBase *pAsm) return GL_TRUE; } -GLboolean returnOnFlag(r700_AssemblerBase *pAsm) +GLboolean returnOnFlag(r700_AssemblerBase *pAsm, GLuint unIF) { testFlag(pAsm); jumpToOffest(pAsm, 1, 4); setRetInLoopFlag(pAsm, SQ_SEL_0); - pops(pAsm, 1); + pops(pAsm, unIF + 1); add_return_inst(pAsm); return GL_TRUE; diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index 516923f67c..ca562d29f1 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -553,7 +553,7 @@ GLboolean jumpToOffest(r700_AssemblerBase *pAsm, GLuint pops, GLint offset); GLboolean setRetInLoopFlag(r700_AssemblerBase *pAsm, GLuint flagValue); GLboolean testFlag(r700_AssemblerBase *pAsm); GLboolean breakLoopOnFlag(r700_AssemblerBase *pAsm, GLuint unFCSP); -GLboolean returnOnFlag(r700_AssemblerBase *pAsm); +GLboolean returnOnFlag(r700_AssemblerBase *pAsm, GLuint unIF); GLboolean assemble_math_function(r700_AssemblerBase* pAsm, BITS opcode); GLboolean assemble_ABS(r700_AssemblerBase *pAsm); -- cgit v1.2.3 From 1f8c23d9db84178f5b129dcd5f6dbae4a31f796a Mon Sep 17 00:00:00 2001 From: Richard Li Date: Sun, 22 Nov 2009 12:58:28 -0500 Subject: r600 : add stack depth calculation, enable CF pop. --- src/mesa/drivers/dri/r600/r700_assembler.c | 341 ++++++++++++++++++----------- src/mesa/drivers/dri/r600/r700_assembler.h | 41 ++-- src/mesa/drivers/dri/r600/r700_shader.c | 2 +- 3 files changed, 223 insertions(+), 161 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 27083a895c..16cdb741ae 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -388,99 +388,94 @@ int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700 pAsm->pR700Shader = pShader; pAsm->currentShaderType = spt; - pAsm->cf_last_export_ptr = NULL; + pAsm->cf_last_export_ptr = NULL; - pAsm->cf_current_export_clause_ptr = NULL; - pAsm->cf_current_alu_clause_ptr = NULL; - pAsm->cf_current_tex_clause_ptr = NULL; - pAsm->cf_current_vtx_clause_ptr = NULL; - pAsm->cf_current_cf_clause_ptr = NULL; + pAsm->cf_current_export_clause_ptr = NULL; + pAsm->cf_current_alu_clause_ptr = NULL; + pAsm->cf_current_tex_clause_ptr = NULL; + pAsm->cf_current_vtx_clause_ptr = NULL; + pAsm->cf_current_cf_clause_ptr = NULL; - // No clause has been created yet - pAsm->cf_current_clause_type = CF_EMPTY_CLAUSE; + // No clause has been created yet + pAsm->cf_current_clause_type = CF_EMPTY_CLAUSE; - pAsm->number_of_colorandz_exports = 0; - pAsm->number_of_exports = 0; - pAsm->number_of_export_opcodes = 0; + pAsm->number_of_colorandz_exports = 0; + pAsm->number_of_exports = 0; + pAsm->number_of_export_opcodes = 0; pAsm->alu_x_opcode = 0; pAsm->D2.bits = 0; - pAsm->D.bits = 0; - pAsm->S[0].bits = 0; - pAsm->S[1].bits = 0; - pAsm->S[2].bits = 0; + pAsm->D.bits = 0; + pAsm->S[0].bits = 0; + pAsm->S[1].bits = 0; + pAsm->S[2].bits = 0; - pAsm->uLastPosUpdate = 0; + pAsm->uLastPosUpdate = 0; - *(BITS *) &pAsm->fp_stOutFmt0 = 0; - - pAsm->uIIns = 0; - pAsm->uOIns = 0; - pAsm->number_used_registers = 0; - pAsm->uUsedConsts = 256; - + *(BITS *) &pAsm->fp_stOutFmt0 = 0; - // Fragment programs - pAsm->uBoolConsts = 0; - pAsm->uIntConsts = 0; - pAsm->uInsts = 0; - pAsm->uConsts = 0; + pAsm->uIIns = 0; + pAsm->uOIns = 0; + pAsm->number_used_registers = 0; + pAsm->uUsedConsts = 256; - pAsm->FCSP = 0; - pAsm->fc_stack[0].type = FC_NONE; - pAsm->branch_depth = 0; - pAsm->max_branch_depth = 0; + // Fragment programs + pAsm->uBoolConsts = 0; + pAsm->uIntConsts = 0; + pAsm->uInsts = 0; + pAsm->uConsts = 0; - pAsm->aArgSubst[0] = - pAsm->aArgSubst[1] = - pAsm->aArgSubst[2] = - pAsm->aArgSubst[3] = (-1); + pAsm->FCSP = 0; + pAsm->fc_stack[0].type = FC_NONE; - pAsm->uOutputs = 0; - - for (i=0; icolor_export_register_number[i] = (-1); - } + pAsm->aArgSubst[0] = + pAsm->aArgSubst[1] = + pAsm->aArgSubst[2] = + pAsm->aArgSubst[3] = (-1); + pAsm->uOutputs = 0; - pAsm->depth_export_register_number = (-1); - pAsm->stencil_export_register_number = (-1); - pAsm->coverage_to_mask_export_register_number = (-1); - pAsm->mask_export_register_number = (-1); + for (i=0; icolor_export_register_number[i] = (-1); + } - pAsm->starting_export_register_number = 0; - pAsm->starting_vfetch_register_number = 0; - pAsm->starting_temp_register_number = 0; - pAsm->uFirstHelpReg = 0; + pAsm->depth_export_register_number = (-1); + pAsm->stencil_export_register_number = (-1); + pAsm->coverage_to_mask_export_register_number = (-1); + pAsm->mask_export_register_number = (-1); - pAsm->input_position_is_used = GL_FALSE; - pAsm->input_normal_is_used = GL_FALSE; + pAsm->starting_export_register_number = 0; + pAsm->starting_vfetch_register_number = 0; + pAsm->starting_temp_register_number = 0; + pAsm->uFirstHelpReg = 0; + pAsm->input_position_is_used = GL_FALSE; + pAsm->input_normal_is_used = GL_FALSE; - for (i=0; iinput_color_is_used[ i ] = GL_FALSE; - } + for (i=0; iinput_color_is_used[ i ] = GL_FALSE; + } - for (i=0; iinput_texture_unit_is_used[ i ] = GL_FALSE; - } + for (i=0; iinput_texture_unit_is_used[ i ] = GL_FALSE; + } - for (i=0; ivfetch_instruction_ptr_array[ i ] = NULL; - } + for (i=0; ivfetch_instruction_ptr_array[ i ] = NULL; + } - pAsm->number_of_inputs = 0; + pAsm->number_of_inputs = 0; - pAsm->is_tex = GL_FALSE; - pAsm->need_tex_barrier = GL_FALSE; + pAsm->is_tex = GL_FALSE; + pAsm->need_tex_barrier = GL_FALSE; pAsm->subs = NULL; pAsm->unSubArraySize = 0; @@ -494,13 +489,14 @@ int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700 pAsm->CALLSTACK[0].plstCFInstructions_local = &(pAsm->pR700Shader->lstCFInstructions); - pAsm->CALLSTACK[0].stackUsage.bits = 0; + pAsm->CALLSTACK[0].max = 0; + pAsm->CALLSTACK[0].current = 0; SetActiveCFlist(pAsm->pR700Shader, pAsm->CALLSTACK[0].plstCFInstructions_local); pAsm->unCFflags = 0; - return 0; + return 0; } GLboolean IsTex(gl_inst_opcode Opcode) @@ -4980,32 +4976,74 @@ GLboolean assemble_EXPORT(r700_AssemblerBase *pAsm) return GL_TRUE; } -inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason) +inline void decreaseCurrent(r700_AssemblerBase *pAsm, GLuint uReason) +{ + switch (uReason) + { + case FC_PUSH_VPM: + pAsm->CALLSTACK[pAsm->CALLSP].current--; + break; + case FC_PUSH_WQM: + pAsm->CALLSTACK[pAsm->CALLSP].current -= 4; + break; + case FC_LOOP: + pAsm->CALLSTACK[pAsm->CALLSP].current -= 4; + break; + case FC_REP: + /* TODO : for 16 vp asic, should -= 2; */ + pAsm->CALLSTACK[pAsm->CALLSP].current -= 1; + break; + }; +} + +inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason, GLboolean bCheckMaxOnly) { + if(GL_TRUE == bCheckMaxOnly) + { + switch (uReason) + { + case FC_PUSH_VPM: + if((pAsm->CALLSTACK[pAsm->CALLSP].current + 1) + > pAsm->CALLSTACK[pAsm->CALLSP].max) + { + pAsm->CALLSTACK[pAsm->CALLSP].max = + pAsm->CALLSTACK[pAsm->CALLSP].current + 1; + } + break; + case FC_PUSH_WQM: + if((pAsm->CALLSTACK[pAsm->CALLSP].current + 4) + > pAsm->CALLSTACK[pAsm->CALLSP].max) + { + pAsm->CALLSTACK[pAsm->CALLSP].max = + pAsm->CALLSTACK[pAsm->CALLSP].current + 4; + } + break; + } + return; + } + switch (uReason) { case FC_PUSH_VPM: - pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs++; - pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.current++; + pAsm->CALLSTACK[pAsm->CALLSP].current++; break; case FC_PUSH_WQM: - pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs++; - pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.current += 4; + pAsm->CALLSTACK[pAsm->CALLSP].current += 4; break; case FC_LOOP: - pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs += 4; + pAsm->CALLSTACK[pAsm->CALLSP].current += 4; break; case FC_REP: /* TODO : for 16 vp asic, should += 2; */ - pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs += 1; + pAsm->CALLSTACK[pAsm->CALLSP].current += 1; break; }; - if(pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs - > pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.max) + if(pAsm->CALLSTACK[pAsm->CALLSP].current + > pAsm->CALLSTACK[pAsm->CALLSP].max) { - pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.max = - pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.su.pushs; + pAsm->CALLSTACK[pAsm->CALLSP].max = + pAsm->CALLSTACK[pAsm->CALLSP].current; } } @@ -5082,7 +5120,6 @@ GLboolean assemble_IF(r700_AssemblerBase *pAsm, GLboolean bHasElse) pAsm->FCSP++; pAsm->fc_stack[pAsm->FCSP].type = FC_IF; - pAsm->fc_stack[pAsm->FCSP].bpush = 0; pAsm->fc_stack[pAsm->FCSP].mid = NULL; pAsm->fc_stack[pAsm->FCSP].midLen= 0; pAsm->fc_stack[pAsm->FCSP].first = pAsm->cf_current_cf_clause_ptr; @@ -5094,12 +5131,8 @@ GLboolean assemble_IF(r700_AssemblerBase *pAsm, GLboolean bHasElse) } #endif /* USE_CF_FOR_POP_AFTER */ - pAsm->branch_depth++; + checkStackDepth(pAsm, FC_PUSH_VPM, GL_FALSE); - if(pAsm->branch_depth > pAsm->max_branch_depth) - { - pAsm->max_branch_depth = pAsm->branch_depth; - } return GL_TRUE; } @@ -5164,9 +5197,11 @@ GLboolean assemble_ENDIF(r700_AssemblerBase *pAsm) radeon_error("if/endif in shader code are not paired. \n"); return GL_FALSE; } - pAsm->branch_depth--; + pAsm->FCSP--; + decreaseCurrent(pAsm, FC_PUSH_VPM); + return GL_TRUE; } @@ -5191,18 +5226,13 @@ GLboolean assemble_BGNLOOP(r700_AssemblerBase *pAsm) pAsm->FCSP++; pAsm->fc_stack[pAsm->FCSP].type = FC_LOOP; - pAsm->fc_stack[pAsm->FCSP].bpush = 1; pAsm->fc_stack[pAsm->FCSP].mid = NULL; pAsm->fc_stack[pAsm->FCSP].unNumMid = 0; pAsm->fc_stack[pAsm->FCSP].midLen = 0; pAsm->fc_stack[pAsm->FCSP].first = pAsm->cf_current_cf_clause_ptr; - pAsm->branch_depth++; + checkStackDepth(pAsm, FC_LOOP, GL_FALSE); - if(pAsm->branch_depth > pAsm->max_branch_depth) - { - pAsm->max_branch_depth = pAsm->branch_depth; - } return GL_TRUE; } @@ -5266,6 +5296,8 @@ GLboolean assemble_BRK(r700_AssemblerBase *pAsm) pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + 1; + checkStackDepth(pAsm, FC_PUSH_VPM, GL_TRUE); + #endif //USE_CF_FOR_CONTINUE_BREAK return GL_TRUE; } @@ -5330,6 +5362,8 @@ GLboolean assemble_CONT(r700_AssemblerBase *pAsm) pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; pAsm->cf_current_cf_clause_ptr->m_Word0.f.addr = pAsm->cf_current_cf_clause_ptr->m_uIndex + 1; + checkStackDepth(pAsm, FC_PUSH_VPM, GL_TRUE); + #endif /* USE_CF_FOR_CONTINUE_BREAK */ return GL_TRUE; @@ -5403,8 +5437,9 @@ GLboolean assemble_ENDLOOP(r700_AssemblerBase *pAsm) } } - pAsm->branch_depth--; pAsm->FCSP--; + + decreaseCurrent(pAsm, FC_LOOP); return GL_TRUE; } @@ -5445,14 +5480,16 @@ GLboolean assemble_BGNSUB(r700_AssemblerBase *pAsm, GLint nILindex) pAsm->subs[pAsm->unSubArrayPointer].subIL_Offset = nILindex; pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.pHead=NULL; - pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.pTail=NULL; - pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.uNumOfNode=0; + pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.pTail=NULL; + pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.uNumOfNode=0; pAsm->CALLSP++; + pAsm->CALLSTACK[pAsm->CALLSP].subDescIndex = pAsm->unSubArrayPointer; pAsm->CALLSTACK[pAsm->CALLSP].FCSP_BeforeEntry = pAsm->FCSP; pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local = &(pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local); - pAsm->CALLSTACK[pAsm->CALLSP].stackUsage.bits = 0; + pAsm->CALLSTACK[pAsm->CALLSP].max = 0; + pAsm->CALLSTACK[pAsm->CALLSP].current = 0; SetActiveCFlist(pAsm->pR700Shader, pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local); @@ -5462,7 +5499,9 @@ GLboolean assemble_BGNSUB(r700_AssemblerBase *pAsm, GLint nILindex) pAsm->alu_x_opcode = SQ_CF_INST_ALU; pAsm->FCSP++; - pAsm->fc_stack[pAsm->FCSP].type = FC_REP; + pAsm->fc_stack[pAsm->FCSP].type = FC_REP; + + checkStackDepth(pAsm, FC_REP, GL_FALSE); return GL_TRUE; } @@ -5475,6 +5514,12 @@ GLboolean assemble_ENDSUB(r700_AssemblerBase *pAsm) return GL_FALSE; } + /* copy max to sub structure */ + pAsm->subs[pAsm->CALLSTACK[pAsm->CALLSP].subDescIndex].unStackDepthMax + = pAsm->CALLSTACK[pAsm->CALLSP].max; + + decreaseCurrent(pAsm, FC_REP); + pAsm->CALLSP--; SetActiveCFlist(pAsm->pR700Shader, pAsm->CALLSTACK[pAsm->CALLSP].plstCFInstructions_local); @@ -5565,18 +5610,42 @@ GLboolean assemble_CAL(r700_AssemblerBase *pAsm, pAsm->unCallerArrayPointer++; int j; + GLuint max; + GLuint unSubID; + GLboolean bRet; for(j=0; junSubArrayPointer; j++) { if(nILindex == pAsm->subs[j].subIL_Offset) { /* compiled before */ + + max = pAsm->subs[j].unStackDepthMax + + pAsm->CALLSTACK[pAsm->CALLSP].current; + if(max > pAsm->CALLSTACK[pAsm->CALLSP].max) + { + pAsm->CALLSTACK[pAsm->CALLSP].max = max; + } + pAsm->callers[pAsm->unCallerArrayPointer - 1].subDescIndex = j; return GL_TRUE; } } pAsm->callers[pAsm->unCallerArrayPointer - 1].subDescIndex = pAsm->unSubArrayPointer; + unSubID = pAsm->unSubArrayPointer; + + bRet = AssembleInstr(nILindex, uiNumberInsts, pILInst, pAsm); + + if(GL_TRUE == bRet) + { + max = pAsm->subs[unSubID].unStackDepthMax + + pAsm->CALLSTACK[pAsm->CALLSP].current; + if(max > pAsm->CALLSTACK[pAsm->CALLSP].max) + { + pAsm->CALLSTACK[pAsm->CALLSP].max = max; + } + } - return AssembleInstr(nILindex, uiNumberInsts, pILInst, pAsm); + return bRet; } GLboolean setRetInLoopFlag(r700_AssemblerBase *pAsm, GLuint flagValue) @@ -5685,7 +5754,7 @@ GLboolean testFlag(r700_AssemblerBase *pAsm) } #endif - checkStackDepth(pAsm, FC_PUSH_VPM); + checkStackDepth(pAsm, FC_PUSH_VPM, GL_TRUE); return GL_TRUE; } @@ -5704,7 +5773,7 @@ GLboolean returnOnFlag(r700_AssemblerBase *pAsm, GLuint unIF) GLboolean breakLoopOnFlag(r700_AssemblerBase *pAsm, GLuint unFCSP) { testFlag(pAsm); - + //break if(GL_FALSE == add_cf_instruction(pAsm) ) { @@ -5831,7 +5900,8 @@ GLboolean AssembleInstr(GLuint uiFirstInst, if ( GL_FALSE == assemble_FLR(pR700AsmCode) ) return GL_FALSE; break; - //case OP_FLR_INT: + //case OP_FLR_INT: ; + // if ( GL_FALSE == assemble_FLR_INT() ) // return GL_FALSE; // break; @@ -6351,11 +6421,47 @@ GLboolean RelocProgram(r700_AssemblerBase * pAsm) R700ShaderInstruction * pInst; R700ControlFlowGenericClause * pCFInst; + /* remove flags init if they are not used */ + if((pAsm->unCFflags & HAS_LOOPRET) == 0) + { + R700ControlFlowALUClause * pCF_ALU; + pInst = plstCFmain->pHead; + while(pInst) + { + if(SIT_CF_ALU == pInst->m_ShaderInstType) + { + pCF_ALU = (R700ControlFlowALUClause *)pInst; + if(1 == pCF_ALU->m_Word1.f.count) + { + pCF_ALU->m_Word1.f.cf_inst = SQ_CF_INST_NOP; + } + else + { + R700ALUInstruction * pALU = pCF_ALU->m_pLinkedALUInstruction; + + pALU->m_pLinkedALUClause = NULL; + pALU = (R700ALUInstruction *)(pALU->pNextInst); + pALU->m_pLinkedALUClause = pCF_ALU; + pCF_ALU->m_pLinkedALUInstruction = pALU; + + pCF_ALU->m_Word1.f.count--; + } + break; + } + pInst = pInst->pNextInst; + }; + } + if(0 == pAsm->unSubArrayPointer) { return GL_TRUE; } + if(pAsm->CALLSTACK[0].max > 0) + { + pAsm->pR700Shader->uStackSize = ((pAsm->CALLSTACK[0].max + 3)>>2) + 2; + } + plstCFmain = pAsm->CALLSTACK[0].plstCFInstructions_local; unCFoffset = plstCFmain->uNumOfNode; @@ -6411,37 +6517,6 @@ GLboolean RelocProgram(r700_AssemblerBase * pAsm) = pAsm->subs[pAsm->callers[i].subDescIndex].unCFoffset; } - /* remove flags init if they are not used */ - if((pAsm->unCFflags & HAS_LOOPRET) == 0) - { - R700ControlFlowALUClause * pCF_ALU; - pInst = plstCFmain->pHead; - while(pInst) - { - if(SIT_CF_ALU == pInst->m_ShaderInstType) - { - pCF_ALU = (R700ControlFlowALUClause *)pInst; - if(1 == pCF_ALU->m_Word1.f.count) - { - pCF_ALU->m_Word1.f.cf_inst = SQ_CF_INST_NOP; - } - else - { - R700ALUInstruction * pALU = pCF_ALU->m_pLinkedALUInstruction; - - pALU->m_pLinkedALUClause = NULL; - pALU = (R700ALUInstruction *)(pALU->pNextInst); - pALU->m_pLinkedALUClause = pCF_ALU; - pCF_ALU->m_pLinkedALUInstruction = pALU; - - pCF_ALU->m_Word1.f.count--; - } - break; - } - pInst = pInst->pNextInst; - }; - } - return GL_TRUE; } diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index ca562d29f1..7efb346fa7 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -273,27 +273,27 @@ enum typedef struct FC_LEVEL { - R700ControlFlowGenericClause * first; + R700ControlFlowGenericClause * first; R700ControlFlowGenericClause ** mid; unsigned int unNumMid; - unsigned int midLen; - unsigned int type; - unsigned int cond; - unsigned int inv; - unsigned int bpush; ///< 1 if first instruction does branch stack push - int id; ///< id of bool or int variable + unsigned int midLen; + unsigned int type; + unsigned int cond; + unsigned int inv; + int id; ///< id of bool or int variable } FC_LEVEL; typedef struct VTX_FETCH_METHOD { - GLboolean bEnableMini; - GLuint mega_fetch_remainder; + GLboolean bEnableMini; + GLuint mega_fetch_remainder; } VTX_FETCH_METHOD; typedef struct SUB_OFFSET { GLint subIL_Offset; GLuint unCFoffset; + GLuint unStackDepthMax; TypedShaderList lstCFInstructions_local; } SUB_OFFSET; @@ -306,23 +306,12 @@ typedef struct CALLER_POINTER #define SQ_MAX_CALL_DEPTH 0x00000020 -typedef struct STACK_USAGE -{ - BITS pushs :8; - BITS current :8; - BITS max :8; -} STACK_USAGE; - -typedef union STACKDWORDtag -{ - BITS bits; - STACK_USAGE su; -} STACKDWORD; - typedef struct CALL_LEVEL { unsigned int FCSP_BeforeEntry; - STACKDWORD stackUsage; + GLint subDescIndex; + GLushort current; + GLushort max; TypedShaderList * plstCFInstructions_local; } CALL_LEVEL; @@ -386,9 +375,6 @@ typedef struct r700_AssemblerBase unsigned int FCSP; FC_LEVEL fc_stack[32]; - unsigned int branch_depth; - unsigned int max_branch_depth; - //----------------------------------------------------------------------------------- // ArgSubst used in Assemble_Source() function //----------------------------------------------------------------------------------- @@ -449,7 +435,8 @@ typedef struct r700_AssemblerBase } r700_AssemblerBase; //Internal use -inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason); +inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason, GLboolean bCheckMaxOnly); +inline void decreaseCurrent(r700_AssemblerBase *pAsm, GLuint uReason); BITS addrmode_PVSDST(PVSDST * pPVSDST); void setaddrmode_PVSDST(PVSDST * pPVSDST, BITS addrmode); void nomask_PVSDST(PVSDST * pPVSDST); diff --git a/src/mesa/drivers/dri/r600/r700_shader.c b/src/mesa/drivers/dri/r600/r700_shader.c index db951e48c4..2eed1acc2f 100644 --- a/src/mesa/drivers/dri/r600/r700_shader.c +++ b/src/mesa/drivers/dri/r600/r700_shader.c @@ -140,7 +140,7 @@ void Init_R700_Shader(R700_Shader * pShader) pShader->killIsUsed = GL_FALSE; pShader->uCFOffset = 0; - pShader->uStackSize = 10; //richard test + pShader->uStackSize = 0; pShader->uMaxCallDepth = 0; pShader->bSurfAllocated = GL_FALSE; -- cgit v1.2.3 From f9b0f1dfa1695db79553f67fd0c156d445062ffa Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 23 Nov 2009 06:31:29 +1000 Subject: r600: fix inline issues --- src/mesa/drivers/dri/r600/r700_assembler.c | 4 ++-- src/mesa/drivers/dri/r600/r700_assembler.h | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 16cdb741ae..c46dd757d0 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -4976,7 +4976,7 @@ GLboolean assemble_EXPORT(r700_AssemblerBase *pAsm) return GL_TRUE; } -inline void decreaseCurrent(r700_AssemblerBase *pAsm, GLuint uReason) +static inline void decreaseCurrent(r700_AssemblerBase *pAsm, GLuint uReason) { switch (uReason) { @@ -4996,7 +4996,7 @@ inline void decreaseCurrent(r700_AssemblerBase *pAsm, GLuint uReason) }; } -inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason, GLboolean bCheckMaxOnly) +static inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason, GLboolean bCheckMaxOnly) { if(GL_TRUE == bCheckMaxOnly) { diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index 7efb346fa7..3e4106335a 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -435,8 +435,6 @@ typedef struct r700_AssemblerBase } r700_AssemblerBase; //Internal use -inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason, GLboolean bCheckMaxOnly); -inline void decreaseCurrent(r700_AssemblerBase *pAsm, GLuint uReason); BITS addrmode_PVSDST(PVSDST * pPVSDST); void setaddrmode_PVSDST(PVSDST * pPVSDST, BITS addrmode); void nomask_PVSDST(PVSDST * pPVSDST); -- cgit v1.2.3 From c3c8c40cab193e0aa0f1a42bff7b0d726df8cf9f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 23 Nov 2009 06:44:29 +1000 Subject: r600: hopefully fix segfault. --- src/mesa/drivers/dri/r600/r700_assembler.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index c46dd757d0..702add9772 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -6421,6 +6421,8 @@ GLboolean RelocProgram(r700_AssemblerBase * pAsm) R700ShaderInstruction * pInst; R700ControlFlowGenericClause * pCFInst; + plstCFmain = pAsm->CALLSTACK[0].plstCFInstructions_local; + /* remove flags init if they are not used */ if((pAsm->unCFflags & HAS_LOOPRET) == 0) { @@ -6462,7 +6464,6 @@ GLboolean RelocProgram(r700_AssemblerBase * pAsm) pAsm->pR700Shader->uStackSize = ((pAsm->CALLSTACK[0].max + 3)>>2) + 2; } - plstCFmain = pAsm->CALLSTACK[0].plstCFInstructions_local; unCFoffset = plstCFmain->uNumOfNode; /* Reloc subs */ -- cgit v1.2.3 From a12b468d002edb6c8a7c95882edd3e5e7f615a4e Mon Sep 17 00:00:00 2001 From: Richard Li Date: Sun, 22 Nov 2009 21:31:46 -0500 Subject: r600 : add support for shader instruction trunc and discard. --- src/mesa/drivers/dri/r600/r700_assembler.c | 105 +++++++++++++++++++++-------- src/mesa/drivers/dri/r600/r700_assembler.h | 2 +- 2 files changed, 78 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 702add9772..8e57396a0d 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -340,7 +340,10 @@ unsigned int r700GetNumOperands(r700_AssemblerBase* pAsm) switch (pAsm->D.dst.opcode) { case SQ_OP2_INST_ADD: + case SQ_OP2_INST_KILLE: case SQ_OP2_INST_KILLGT: + case SQ_OP2_INST_KILLGE: + case SQ_OP2_INST_KILLNE: case SQ_OP2_INST_MUL: case SQ_OP2_INST_MAX: case SQ_OP2_INST_MIN: @@ -363,6 +366,7 @@ unsigned int r700GetNumOperands(r700_AssemblerBase* pAsm) case SQ_OP2_INST_MOVA_FLOOR: case SQ_OP2_INST_FRACT: case SQ_OP2_INST_FLOOR: + case SQ_OP2_INST_TRUNC: case SQ_OP2_INST_EXP_IEEE: case SQ_OP2_INST_LOG_CLAMPED: case SQ_OP2_INST_LOG_IEEE: @@ -1379,19 +1383,16 @@ GLboolean tex_src(r700_AssemblerBase *pAsm) case FRAG_ATTRIB_PNTC: fprintf(stderr, "FRAG_ATTRIB_PNTC unsupported\n"); break; - case FRAG_ATTRIB_VAR0: - fprintf(stderr, "FRAG_ATTRIB_VAR0 unsupported\n"); - break; } if( (pILInst->SrcReg[0].Index >= FRAG_ATTRIB_VAR0) || - (pILInst->SrcReg[0].Index < FRAG_ATTRIB_MAX) ) - { + (pILInst->SrcReg[0].Index < FRAG_ATTRIB_MAX) ) + { bValidTexCoord = GL_TRUE; pAsm->S[0].src.reg = pAsm->uiFP_AttributeMap[pILInst->SrcReg[0].Index]; pAsm->S[0].src.rtype = SRC_REG_INPUT; - } + } break; } @@ -2469,9 +2470,9 @@ GLboolean assemble_alu_instruction2(r700_AssemblerBase *pAsm) { R700ALUInstruction* alu_instruction_ptr = (R700ALUInstruction*) CALLOC_STRUCT(R700ALUInstruction); if (alu_instruction_ptr == NULL) - { - return GL_FALSE; - } + { + return GL_FALSE; + } Init_R700ALUInstruction(alu_instruction_ptr); //src 0 @@ -3545,13 +3546,12 @@ GLboolean assemble_FRC(r700_AssemblerBase *pAsm) return GL_TRUE; } -GLboolean assemble_KIL(r700_AssemblerBase *pAsm) -{ - /* TODO: doc says KILL has to be last(end) ALU clause */ - - checkop1(pAsm); +GLboolean assemble_KIL(r700_AssemblerBase *pAsm, GLuint opcode) +{ + checkop2(pAsm); - pAsm->D.dst.opcode = SQ_OP2_INST_KILLGT; + pAsm->D.dst.opcode = opcode; + pAsm->D.dst.math = 1; setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); pAsm->D.dst.rtype = DST_REG_TEMPORARY; @@ -3561,24 +3561,24 @@ GLboolean assemble_KIL(r700_AssemblerBase *pAsm) pAsm->D.dst.writez = 0; pAsm->D.dst.writew = 0; - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = 0; - - setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_0); - noneg_PVSSRC(&(pAsm->S[0].src)); + if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + { + return GL_FALSE; + } - if ( GL_FALSE == assemble_src(pAsm, 0, 1) ) + if( GL_FALSE == assemble_src(pAsm, 1, -1) ) { return GL_FALSE; } - if ( GL_FALSE == next_ins(pAsm) ) + if ( GL_FALSE == next_ins2(pAsm) ) { return GL_FALSE; } + /* Doc says KILL has to be last(end) ALU clause */ pAsm->pR700Shader->killIsUsed = GL_TRUE; + pAsm->alu_x_opcode = SQ_CF_INST_ALU; return GL_TRUE; } @@ -5018,7 +5018,7 @@ static inline void checkStackDepth(r700_AssemblerBase *pAsm, GLuint uReason, GLb pAsm->CALLSTACK[pAsm->CALLSP].current + 4; } break; - } + } return; } @@ -5102,7 +5102,7 @@ GLboolean assemble_IF(r700_AssemblerBase *pAsm, GLboolean bHasElse) if(GL_TRUE != bHasElse) { - pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; + pAsm->cf_current_cf_clause_ptr->m_Word1.f.pop_count = 1; } else { @@ -5172,7 +5172,7 @@ GLboolean assemble_ELSE(r700_AssemblerBase *pAsm) GLboolean assemble_ENDIF(r700_AssemblerBase *pAsm) { #ifdef USE_CF_FOR_POP_AFTER - pops(pAsm, 1); + pops(pAsm, 1); #endif /* USE_CF_FOR_POP_AFTER */ pAsm->alu_x_opcode = SQ_CF_INST_ALU; @@ -5912,8 +5912,10 @@ GLboolean AssembleInstr(GLuint uiFirstInst, break; case OPCODE_KIL: - if ( GL_FALSE == assemble_KIL(pR700AsmCode) ) - return GL_FALSE; + case OPCODE_KIL_NV: + /* done at OPCODE_SE/SGT...etc. */ + /* if ( GL_FALSE == assemble_KIL(pR700AsmCode) ) + return GL_FALSE; */ break; case OPCODE_LG2: if ( GL_FALSE == assemble_LG2(pR700AsmCode) ) @@ -6008,6 +6010,13 @@ GLboolean AssembleInstr(GLuint uiFirstInst, return GL_FALSE; } } + else if((OPCODE_KIL == pILInst[i+1].Opcode)||(OPCODE_KIL_NV == pILInst[i+1].Opcode)) + { + if ( GL_FALSE == assemble_KIL(pR700AsmCode, SQ_OP2_INST_KILLE) ) + { + return GL_FALSE; + } + } else { if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETE) ) @@ -6051,6 +6060,13 @@ GLboolean AssembleInstr(GLuint uiFirstInst, return GL_FALSE; } } + else if((OPCODE_KIL == pILInst[i+1].Opcode)||(OPCODE_KIL_NV == pILInst[i+1].Opcode)) + { + if ( GL_FALSE == assemble_KIL(pR700AsmCode, SQ_OP2_INST_KILLGT) ) + { + return GL_FALSE; + } + } else { if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETGT) ) @@ -6094,6 +6110,13 @@ GLboolean AssembleInstr(GLuint uiFirstInst, return GL_FALSE; } } + else if((OPCODE_KIL == pILInst[i+1].Opcode)||(OPCODE_KIL_NV == pILInst[i+1].Opcode)) + { + if ( GL_FALSE == assemble_KIL(pR700AsmCode, SQ_OP2_INST_KILLGE) ) + { + return GL_FALSE; + } + } else { if ( GL_FALSE == assemble_SGE(pR700AsmCode) ) @@ -6150,6 +6173,13 @@ GLboolean AssembleInstr(GLuint uiFirstInst, return GL_FALSE; } } + else if((OPCODE_KIL == pILInst[i+1].Opcode)||(OPCODE_KIL_NV == pILInst[i+1].Opcode)) + { + if ( GL_FALSE == assemble_KIL(pR700AsmCode, SQ_OP2_INST_KILLGT) ) + { + return GL_FALSE; + } + } else { if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETGT) ) @@ -6210,6 +6240,13 @@ GLboolean AssembleInstr(GLuint uiFirstInst, return GL_FALSE; } } + else if((OPCODE_KIL == pILInst[i+1].Opcode)||(OPCODE_KIL_NV == pILInst[i+1].Opcode)) + { + if ( GL_FALSE == assemble_KIL(pR700AsmCode, SQ_OP2_INST_KILLGE) ) + { + return GL_FALSE; + } + } else { if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETGE) ) @@ -6257,6 +6294,13 @@ GLboolean AssembleInstr(GLuint uiFirstInst, return GL_FALSE; } } + else if((OPCODE_KIL == pILInst[i+1].Opcode)||(OPCODE_KIL_NV == pILInst[i+1].Opcode)) + { + if ( GL_FALSE == assemble_KIL(pR700AsmCode, SQ_OP2_INST_KILLNE) ) + { + return GL_FALSE; + } + } else { if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETNE) ) @@ -6298,6 +6342,11 @@ GLboolean AssembleInstr(GLuint uiFirstInst, return GL_FALSE; break; + case OPCODE_TRUNC: + if ( GL_FALSE == assemble_math_function(pR700AsmCode, SQ_OP2_INST_TRUNC) ) + return GL_FALSE; + break; + case OPCODE_XPD: if ( GL_FALSE == assemble_XPD(pR700AsmCode) ) return GL_FALSE; diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index 3e4106335a..130fc89dae 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -554,7 +554,7 @@ GLboolean assemble_EXP(r700_AssemblerBase *pAsm); GLboolean assemble_FLR(r700_AssemblerBase *pAsm); GLboolean assemble_FLR_INT(r700_AssemblerBase *pAsm); GLboolean assemble_FRC(r700_AssemblerBase *pAsm); -GLboolean assemble_KIL(r700_AssemblerBase *pAsm); +GLboolean assemble_KIL(r700_AssemblerBase *pAsm, GLuint opcode); GLboolean assemble_LG2(r700_AssemblerBase *pAsm); GLboolean assemble_LRP(r700_AssemblerBase *pAsm); GLboolean assemble_LOG(r700_AssemblerBase *pAsm); -- cgit v1.2.3 From b611f639b4bffdcca376293f7ce71af9f6bdbff3 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 23 Nov 2009 00:57:37 -0500 Subject: glu/sgi: Fix memory leak in gluScaleImage3D. --- src/glu/sgi/libutil/mipmap.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c index 4139c304a1..223621f49f 100644 --- a/src/glu/sgi/libutil/mipmap.c +++ b/src/glu/sgi/libutil/mipmap.c @@ -7384,6 +7384,8 @@ int gluScaleImage3D(GLenum format, afterImage = malloc(imageSize3D(widthOut, heightOut, depthOut, format, GL_UNSIGNED_SHORT)); if (beforeImage == NULL || afterImage == NULL) { + free(beforeImage); + free(afterImage); return GLU_OUT_OF_MEMORY; } retrieveStoreModes3D(&psm); -- cgit v1.2.3 From 5b925b7daa566d799c4f50911a7fcca114131503 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 23 Nov 2009 01:09:06 -0500 Subject: glu/sgi: Fix memory leak in bitmapBuild2DMipmaps. --- src/glu/sgi/libutil/mipmap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c index 223621f49f..c5faebd6a3 100644 --- a/src/glu/sgi/libutil/mipmap.c +++ b/src/glu/sgi/libutil/mipmap.c @@ -3762,6 +3762,7 @@ static int bitmapBuild2DMipmaps(GLenum target, GLint internalFormat, glPixelStorei(GL_UNPACK_SKIP_PIXELS,psm.unpack_skip_pixels); glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + free(newImage); return GLU_OUT_OF_MEMORY; } } -- cgit v1.2.3 From 4b0b250aae6ae7d48cd24f9d91d05ab58086c4b2 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 23 Nov 2009 01:30:32 -0500 Subject: glx: Prevent potential null pointer deference in driCreateContext. --- src/glx/x11/drisw_glx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/glx/x11/drisw_glx.c b/src/glx/x11/drisw_glx.c index 15e1586658..1866b2cc87 100644 --- a/src/glx/x11/drisw_glx.c +++ b/src/glx/x11/drisw_glx.c @@ -250,12 +250,14 @@ driCreateContext(__GLXscreenConfigs * psc, { __GLXDRIcontextPrivate *pcp, *pcp_shared; __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode; - const __DRIcoreExtension *core = psc->core; + const __DRIcoreExtension *core; __DRIcontext *shared = NULL; if (!psc || !psc->driScreen) return NULL; + core = psc->core; + if (shareList) { pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext; shared = pcp_shared->driContext; -- cgit v1.2.3 From 67125c7f9aa141a7948ebb915ece9d991bb6ff19 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 23 Nov 2009 01:52:59 -0500 Subject: mesa: Initialize variable in _mesa_get_texel_fetch_func. --- src/mesa/main/texfetch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texfetch.c b/src/mesa/main/texfetch.c index f4f2be48c3..b37039429f 100644 --- a/src/mesa/main/texfetch.c +++ b/src/mesa/main/texfetch.c @@ -570,7 +570,7 @@ texfetch_funcs[MESA_FORMAT_COUNT] = static FetchTexelFuncF _mesa_get_texel_fetch_func(gl_format format, GLuint dims) { - FetchTexelFuncF f; + FetchTexelFuncF f = NULL; GLuint i; /* XXX replace loop with direct table lookup */ for (i = 0; i < MESA_FORMAT_COUNT; i++) { -- cgit v1.2.3 From f61865799defe6636ac893c7ddb510911e5bfa0c Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 19 Nov 2009 12:52:58 +0100 Subject: slang: Be more robust with memory in concat_shaders(). --- src/mesa/shader/slang/slang_link.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index 0a2bc49780..ed27821a95 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -590,11 +590,16 @@ concat_shaders(struct gl_shader_program *shProg, GLenum shaderType) { struct gl_shader *newShader; const struct gl_shader *firstShader = NULL; - GLuint shaderLengths[100]; + GLuint *shaderLengths; GLchar *source; GLuint totalLen = 0, len = 0; GLuint i; + shaderLengths = (GLuint *)_mesa_malloc(shProg->NumShaders * sizeof(GLuint)); + if (!shaderLengths) { + return NULL; + } + /* compute total size of new shader source code */ for (i = 0; i < shProg->NumShaders; i++) { const struct gl_shader *shader = shProg->Shaders[i]; @@ -606,12 +611,16 @@ concat_shaders(struct gl_shader_program *shProg, GLenum shaderType) } } - if (totalLen == 0) + if (totalLen == 0) { + _mesa_free(shaderLengths); return NULL; + } source = (GLchar *) _mesa_malloc(totalLen + 1); - if (!source) + if (!source) { + _mesa_free(shaderLengths); return NULL; + } /* concatenate shaders */ for (i = 0; i < shProg->NumShaders; i++) { @@ -626,9 +635,16 @@ concat_shaders(struct gl_shader_program *shProg, GLenum shaderType) _mesa_printf("---NEW CONCATENATED SHADER---:\n%s\n------------\n", source); */ + _mesa_free(shaderLengths); + remove_extra_version_directives(source); newShader = CALLOC_STRUCT(gl_shader); + if (!newShader) { + _mesa_free(source); + return NULL; + } + newShader->Type = shaderType; newShader->Source = source; newShader->Pragmas = firstShader->Pragmas; -- cgit v1.2.3 From f359ac5486b14d98ab4a855302b67d1700f031ae Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 19 Nov 2009 13:01:08 +0100 Subject: tgsi: Add execution debugging facilities to exec. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 67 ++++++++++++++++++++++++++++++++-- 1 file changed, 63 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index ba7a225db3..f164fce5c0 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -3087,6 +3087,8 @@ exec_instruction( } } +#define DEBUG_EXECUTION 0 + /** * Run TGSI interpreter. @@ -3130,10 +3132,67 @@ tgsi_exec_machine_run( struct tgsi_exec_machine *mach ) exec_declaration( mach, mach->Declarations+i ); } - /* execute instructions, until pc is set to -1 */ - while (pc != -1) { - assert(pc < (int) mach->NumInstructions); - exec_instruction( mach, mach->Instructions + pc, &pc ); + { +#if DEBUG_EXECUTION + struct tgsi_exec_vector temps[TGSI_EXEC_NUM_TEMPS + TGSI_EXEC_NUM_TEMP_EXTRAS]; + struct tgsi_exec_vector outputs[PIPE_MAX_ATTRIBS]; + uint inst = 1; + + memcpy(temps, mach->Temps, sizeof(temps)); + memcpy(outputs, mach->Outputs, sizeof(outputs)); +#endif + + /* execute instructions, until pc is set to -1 */ + while (pc != -1) { + +#if DEBUG_EXECUTION + uint i; + + tgsi_dump_instruction(&mach->Instructions[pc], inst++); +#endif + + assert(pc < (int) mach->NumInstructions); + exec_instruction(mach, mach->Instructions + pc, &pc); + +#if DEBUG_EXECUTION + for (i = 0; i < TGSI_EXEC_NUM_TEMPS + TGSI_EXEC_NUM_TEMP_EXTRAS; i++) { + if (memcmp(&temps[i], &mach->Temps[i], sizeof(temps[i]))) { + uint j; + + memcpy(&temps[i], &mach->Temps[i], sizeof(temps[i])); + debug_printf("TEMP[%2u] = ", i); + for (j = 0; j < 4; j++) { + if (j > 0) { + debug_printf(" "); + } + debug_printf("(%6f, %6f, %6f, %6f)\n", + temps[i].xyzw[0].f[j], + temps[i].xyzw[1].f[j], + temps[i].xyzw[2].f[j], + temps[i].xyzw[3].f[j]); + } + } + } + for (i = 0; i < PIPE_MAX_ATTRIBS; i++) { + if (memcmp(&outputs[i], &mach->Outputs[i], sizeof(outputs[i]))) { + uint j; + + memcpy(&outputs[i], &mach->Outputs[i], sizeof(outputs[i])); + debug_printf("OUT[%2u] = ", i); + for (j = 0; j < 4; j++) { + if (j > 0) { + debug_printf(" "); + } + debug_printf("{%6f, %6f, %6f, %6f}\n", + outputs[i].xyzw[0].f[j], + outputs[i].xyzw[1].f[j], + outputs[i].xyzw[2].f[j], + outputs[i].xyzw[3].f[j]); + } + } + } +#endif + } } #if 0 -- cgit v1.2.3 From cde758a2b50da8d7a8db5467f5629ce366380c41 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 19 Nov 2009 13:05:58 +0100 Subject: tgsi: Fake TXD implementation in exec. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 60 +++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index f164fce5c0..b2dc24c2fe 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -1698,6 +1698,64 @@ exec_tex(struct tgsi_exec_machine *mach, } } +static void +exec_txd(struct tgsi_exec_machine *mach, + const struct tgsi_full_instruction *inst) +{ + const uint unit = inst->FullSrcRegisters[3].SrcRegister.Index; + union tgsi_exec_channel r[4]; + uint chan_index; + + /* + * XXX: This is fake TXD -- the derivatives are not taken into account, yet. + */ + + switch (inst->InstructionExtTexture.Texture) { + case TGSI_TEXTURE_1D: + case TGSI_TEXTURE_SHADOW1D: + + FETCH(&r[0], 0, CHAN_X); + + fetch_texel(mach->Samplers[unit], + &r[0], &ZeroVec, &ZeroVec, 0.0f, /* S, T, P, BIAS */ + &r[0], &r[1], &r[2], &r[3]); /* R, G, B, A */ + break; + + case TGSI_TEXTURE_2D: + case TGSI_TEXTURE_RECT: + case TGSI_TEXTURE_SHADOW2D: + case TGSI_TEXTURE_SHADOWRECT: + + FETCH(&r[0], 0, CHAN_X); + FETCH(&r[1], 0, CHAN_Y); + FETCH(&r[2], 0, CHAN_Z); + + fetch_texel(mach->Samplers[unit], + &r[0], &r[1], &r[2], 0.0f, /* inputs */ + &r[0], &r[1], &r[2], &r[3]); /* outputs */ + break; + + case TGSI_TEXTURE_3D: + case TGSI_TEXTURE_CUBE: + + FETCH(&r[0], 0, CHAN_X); + FETCH(&r[1], 0, CHAN_Y); + FETCH(&r[2], 0, CHAN_Z); + + fetch_texel(mach->Samplers[unit], + &r[0], &r[1], &r[2], 0.0f, + &r[0], &r[1], &r[2], &r[3]); + break; + + default: + assert(0); + } + + FOR_EACH_ENABLED_CHANNEL(*inst, chan_index) { + STORE(&r[chan_index], 0, chan_index); + } +} + /** * Evaluate a constant-valued coefficient at the position of the @@ -2507,7 +2565,7 @@ exec_instruction( /* src[1] = d[strq]/dx */ /* src[2] = d[strq]/dy */ /* src[3] = sampler unit */ - assert (0); + exec_txd(mach, inst); break; case TGSI_OPCODE_TXL: -- cgit v1.2.3 From b7590cde4a475cd785030d7c7909846ae72608e5 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 23 Nov 2009 10:40:05 +0100 Subject: tgsi: Bring BGNFOR/ENDFOR implementation up to spec. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 46 +++++++++++++++++++++++++--------- src/gallium/auxiliary/tgsi/tgsi_exec.h | 2 +- 2 files changed, 35 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index b2dc24c2fe..36682bbd30 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -1461,6 +1461,13 @@ store_dest( dst = &mach->Addrs[index].xyzw[chan_index]; break; + case TGSI_FILE_LOOP: + assert(reg->DstRegister.Index == 0); + assert(mach->LoopCounterStackTop > 0); + assert(chan_index == CHAN_X); + dst = &mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[chan_index]; + break; + case TGSI_FILE_PREDICATE: index = reg->DstRegister.Index; assert(index < TGSI_EXEC_NUM_PREDS); @@ -3031,8 +3038,23 @@ exec_instruction( for (chan_index = 0; chan_index < 3; chan_index++) { FETCH( &mach->LoopCounterStack[mach->LoopCounterStackTop].xyzw[chan_index], 0, chan_index ); } - STORE( &mach->LoopCounterStack[mach->LoopCounterStackTop].xyzw[CHAN_Y], 0, CHAN_X ); ++mach->LoopCounterStackTop; + STORE(&mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_X], 0, CHAN_X); + /* update LoopMask */ + if (mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y].f[0] <= 0.0f) { + mach->LoopMask &= ~0x1; + } + if (mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y].f[1] <= 0.0f) { + mach->LoopMask &= ~0x2; + } + if (mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y].f[2] <= 0.0f) { + mach->LoopMask &= ~0x4; + } + if (mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y].f[3] <= 0.0f) { + mach->LoopMask &= ~0x8; + } + /* TODO: if mach->LoopMask == 0, jump to end of loop */ + UPDATE_EXEC_MASK(mach); /* fall-through (for now) */ case TGSI_OPCODE_BGNLOOP: /* push LoopMask and ContMasks */ @@ -3046,28 +3068,28 @@ exec_instruction( case TGSI_OPCODE_ENDFOR: assert(mach->LoopCounterStackTop > 0); - micro_sub( &mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_X], - &mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_X], - &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C] ); + micro_sub(&mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y], + &mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y], + &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C]); /* update LoopMask */ - if( mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_X].f[0] <= 0) { + if (mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y].f[0] <= 0.0f) { mach->LoopMask &= ~0x1; } - if( mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_X].f[1] <= 0 ) { + if (mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y].f[1] <= 0.0f) { mach->LoopMask &= ~0x2; } - if( mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_X].f[2] <= 0 ) { + if (mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y].f[2] <= 0.0f) { mach->LoopMask &= ~0x4; } - if( mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_X].f[3] <= 0 ) { + if (mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y].f[3] <= 0.0f) { mach->LoopMask &= ~0x8; } - micro_add( &mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y], - &mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Y], - &mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Z]); + micro_add(&mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_X], + &mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_X], + &mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[CHAN_Z]); assert(mach->LoopLabelStackTop > 0); inst = mach->Instructions + mach->LoopLabelStack[mach->LoopLabelStackTop - 1]; - STORE( &mach->LoopCounterStack[mach->LoopCounterStackTop].xyzw[CHAN_Y], 0, CHAN_X ); + STORE(&mach->LoopCounterStack[mach->LoopCounterStackTop].xyzw[CHAN_X], 0, CHAN_X); /* Restore ContMask, but don't pop */ assert(mach->ContStackTop > 0); mach->ContMask = mach->ContStack[mach->ContStackTop - 1]; diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h index 471f591dd6..f0aaca92b3 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.h +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h @@ -252,7 +252,7 @@ struct tgsi_exec_machine uint LoopLabelStack[TGSI_EXEC_MAX_LOOP_NESTING]; int LoopLabelStackTop; - /** Loop counter stack (x = count, y = current, z = step) */ + /** Loop counter stack (x = index, y = counter, z = step) */ struct tgsi_exec_vector LoopCounterStack[TGSI_EXEC_MAX_LOOP_NESTING]; int LoopCounterStackTop; -- cgit v1.2.3 From cc35a454da08e7303c76a51972bcccf7d67b7704 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 23 Nov 2009 10:49:41 +0100 Subject: tgsi: Fix POSITION and FACE fragment shader inputs. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 77 ++++++++++++++++++---------------- src/gallium/auxiliary/tgsi/tgsi_exec.h | 1 + 2 files changed, 42 insertions(+), 36 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 36682bbd30..0197db8883 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -1832,53 +1832,58 @@ typedef void (* eval_coef_func)( unsigned chan ); static void -exec_declaration( - struct tgsi_exec_machine *mach, - const struct tgsi_full_declaration *decl ) +exec_declaration(struct tgsi_exec_machine *mach, + const struct tgsi_full_declaration *decl) { - if( mach->Processor == TGSI_PROCESSOR_FRAGMENT ) { - if( decl->Declaration.File == TGSI_FILE_INPUT ) { - unsigned first, last, mask; - eval_coef_func eval; + if (mach->Processor == TGSI_PROCESSOR_FRAGMENT) { + if (decl->Declaration.File == TGSI_FILE_INPUT) { + uint first, last, mask; first = decl->DeclarationRange.First; last = decl->DeclarationRange.Last; mask = decl->Declaration.UsageMask; - switch( decl->Declaration.Interpolate ) { - case TGSI_INTERPOLATE_CONSTANT: - eval = eval_constant_coef; - break; - - case TGSI_INTERPOLATE_LINEAR: - eval = eval_linear_coef; - break; + if (decl->Semantic.SemanticName == TGSI_SEMANTIC_POSITION) { + assert(decl->Semantic.SemanticIndex == 0); + assert(first == last); + assert(mask = TGSI_WRITEMASK_XYZW); - case TGSI_INTERPOLATE_PERSPECTIVE: - eval = eval_perspective_coef; - break; + mach->Inputs[first] = mach->QuadPos; + } else if (decl->Semantic.SemanticName == TGSI_SEMANTIC_FACE) { + uint i; - default: - assert( 0 ); - return; - } + assert(decl->Semantic.SemanticIndex == 0); + assert(first == last); - if( mask == TGSI_WRITEMASK_XYZW ) { - unsigned i, j; - - for( i = first; i <= last; i++ ) { - for( j = 0; j < NUM_CHANNELS; j++ ) { - eval( mach, i, j ); - } + for (i = 0; i < QUAD_SIZE; i++) { + mach->Inputs[first].xyzw[0].f[i] = mach->Face; + } + } else { + eval_coef_func eval; + uint i, j; + + switch (decl->Declaration.Interpolate) { + case TGSI_INTERPOLATE_CONSTANT: + eval = eval_constant_coef; + break; + + case TGSI_INTERPOLATE_LINEAR: + eval = eval_linear_coef; + break; + + case TGSI_INTERPOLATE_PERSPECTIVE: + eval = eval_perspective_coef; + break; + + default: + assert(0); + return; } - } - else { - unsigned i, j; - for( j = 0; j < NUM_CHANNELS; j++ ) { - if( mask & (1 << j) ) { - for( i = first; i <= last; i++ ) { - eval( mach, i, j ); + for (j = 0; j < NUM_CHANNELS; j++) { + if (mask & (1 << j)) { + for (i = first; i <= last; i++) { + eval(mach, i, j); } } } diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h index f0aaca92b3..3dff69a505 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.h +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h @@ -232,6 +232,7 @@ struct tgsi_exec_machine /* FRAGMENT processor only. */ const struct tgsi_interp_coef *InterpCoefs; struct tgsi_exec_vector QuadPos; + float Face; /**< +1 if front facing, -1 if back facing */ /* Conditional execution masks */ uint CondMask; /**< For IF/ELSE/ENDIF */ -- cgit v1.2.3 From cc93fa3527e64963acd0e643d7d1061306d9e1df Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 23 Nov 2009 10:51:07 +0100 Subject: softpipe: Initialise TGSI machine's Face. --- src/gallium/drivers/softpipe/sp_fs_exec.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_fs_exec.c b/src/gallium/drivers/softpipe/sp_fs_exec.c index 4076114d39..a8999ed347 100644 --- a/src/gallium/drivers/softpipe/sp_fs_exec.c +++ b/src/gallium/drivers/softpipe/sp_fs_exec.c @@ -126,7 +126,13 @@ exec_run( const struct sp_fragment_shader *base, setup_pos_vector(quad->posCoef, (float)quad->input.x0, (float)quad->input.y0, &machine->QuadPos); - + + if (quad->input.facing) { + machine->Face = -1.0f; + } else { + machine->Face = 1.0f; + } + quad->inout.mask &= tgsi_exec_machine_run( machine ); if (quad->inout.mask == 0) return FALSE; -- cgit v1.2.3 From eacdd8fa75d83ed1e3e2d7c003cea857a310bffd Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 23 Nov 2009 11:29:29 +0100 Subject: tgsi: Remove code that actually had no effect. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 0197db8883..d52c94fcfa 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -2275,11 +2275,7 @@ exec_instruction( case TGSI_OPCODE_EX2: FETCH(&r[0], 0, CHAN_X); -#if FAST_MATH micro_exp2( &r[0], &r[0] ); -#else - micro_pow( &r[0], &mach->Temps[TEMP_2_I].xyzw[TEMP_2_C], &r[0] ); -#endif FOR_EACH_ENABLED_CHANNEL( *inst, chan_index ) { STORE( &r[0], 0, chan_index ); -- cgit v1.2.3 From c511e0b8442f0ddd4265137446180d5ced3f1671 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 23 Nov 2009 11:32:58 +0100 Subject: tgsi: Clamp the source argument in micro_exp2() to avoid Inf. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index d52c94fcfa..af914f6d08 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -578,6 +578,24 @@ micro_exp2( dst->f[2] = util_fast_exp2( src->f[2] ); dst->f[3] = util_fast_exp2( src->f[3] ); #else + +#if DEBUG + /* Inf is okay for this instruction, so clamp it to silence assertions. */ + uint i; + union tgsi_exec_channel clamped; + + for (i = 0; i < 4; i++) { + if (src->f[i] > 127.99999f) { + clamped.f[i] = 127.99999f; + } else if (src->f[i] < -126.99999f) { + clamped.f[i] = -126.99999f; + } else { + clamped.f[i] = src->f[i]; + } + } + src = &clamped; +#endif + dst->f[0] = powf( 2.0f, src->f[0] ); dst->f[1] = powf( 2.0f, src->f[1] ); dst->f[2] = powf( 2.0f, src->f[2] ); -- cgit v1.2.3 From 18384af7491c408c4182b72807b02c11b55509f8 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 23 Nov 2009 13:22:04 +0100 Subject: slang: Check return value from emit_instruction(). --- src/mesa/shader/slang/slang_emit.c | 73 ++++++++++++++++++++++++++++++++++---- 1 file changed, 67 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index c0e4b27aa5..fe39b46dbb 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -551,6 +551,9 @@ emit_instruction(slang_emit_info *emitInfo, &srcRelAddr, NULL, NULL); + if (!inst) { + return NULL; + } src[i] = &newSrc[i]; } @@ -948,6 +951,9 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n) n->Children[0]->Store, n->Children[1]->Store, NULL); + if (!inst) { + return NULL; + } inst_comment(inst, "Compare values"); /* Compute val = DOT(temp, temp) (reduction) */ @@ -957,6 +963,9 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n) &tempStore, &tempStore, NULL); + if (!inst) { + return NULL; + } inst->SrcReg[0].Swizzle = inst->SrcReg[1].Swizzle = swizzle; /*override*/ inst_comment(inst, "Reduce vec to bool"); @@ -972,6 +981,9 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n) n->Store, &zero, NULL); + if (!inst) { + return NULL; + } inst_comment(inst, "Invert true/false"); } } @@ -1001,6 +1013,9 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n) &srcStore0, &srcStore1, NULL); + if (!inst) { + return NULL; + } inst_comment(inst, "Begin struct/array comparison"); } else { @@ -1010,12 +1025,18 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n) &srcStore0, &srcStore1, NULL); + if (!inst) { + return NULL; + } /* ADD accTemp, accTemp, sneTemp; # like logical-OR */ inst = emit_instruction(emitInfo, OPCODE_ADD, &accTemp, /* dest */ &accTemp, &sneTemp, NULL); + if (!inst) { + return NULL; + } } } @@ -1025,6 +1046,9 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n) &accTemp, &accTemp, NULL); + if (!inst) { + return NULL; + } inst_comment(inst, "End struct/array comparison"); if (n->Opcode == IR_EQUAL) { @@ -1036,6 +1060,9 @@ emit_compare(slang_emit_info *emitInfo, slang_ir_node *n) n->Store, &zero, NULL); + if (!inst) { + return NULL; + } inst_comment(inst, "Invert true/false"); } @@ -1119,6 +1146,9 @@ emit_clamp(slang_emit_info *emitInfo, slang_ir_node *n) n->Children[0]->Store, n->Children[1]->Store, NULL); + if (!inst) { + return NULL; + } /* n->dest = min(tmp, ch[2]) */ inst = emit_instruction(emitInfo, OPCODE_MIN, @@ -1153,7 +1183,9 @@ emit_negation(slang_emit_info *emitInfo, slang_ir_node *n) n->Children[0]->Store, NULL, NULL); - inst->SrcReg[0].Negate = NEGATE_XYZW; + if (inst) { + inst->SrcReg[0].Negate = NEGATE_XYZW; + } return inst; } @@ -1356,6 +1388,9 @@ emit_tex(slang_emit_info *emitInfo, slang_ir_node *n) n->Children[1]->Store, NULL, NULL); + if (!inst) { + return NULL; + } inst->TexShadow = shadow; @@ -1458,6 +1493,9 @@ emit_copy(slang_emit_info *emitInfo, slang_ir_node *n) &srcStore, NULL, NULL); + if (!inst) { + return NULL; + } inst_comment(inst, "IR_COPY block"); srcStore.Index++; dstStore.Index++; @@ -1473,6 +1511,9 @@ emit_copy(slang_emit_info *emitInfo, slang_ir_node *n) n->Children[1]->Store, NULL, NULL); + if (!inst) { + return NULL; + } dstAnnot = storage_annotation(n->Children[0], emitInfo->prog); srcAnnot = storage_annotation(n->Children[1], emitInfo->prog); inst->Comment = instruction_annotation(inst->Opcode, dstAnnot, @@ -1534,6 +1575,9 @@ emit_cond(slang_emit_info *emitInfo, slang_ir_node *n) n->Children[0]->Store, NULL, NULL); + if (!inst) { + return NULL; + } inst->CondUpdate = GL_TRUE; inst_comment(inst, "COND expr"); _slang_free_temp(emitInfo->vt, n->Store); @@ -1596,6 +1640,9 @@ emit_not(slang_emit_info *emitInfo, slang_ir_node *n) n->Children[0]->Store, &zero, NULL); + if (!inst) { + return NULL; + } inst_comment(inst, "NOT"); free_node_storage(emitInfo->vt, n->Children[0]); @@ -1646,12 +1693,17 @@ emit_if(slang_emit_info *emitInfo, slang_ir_node *n) ifInst->DstReg.CondSwizzle = writemask_to_swizzle(condWritemask); } else { + struct prog_instruction *inst; + /* IF src[0] THEN ... */ - emit_instruction(emitInfo, OPCODE_IF, - NULL, /* dst */ - n->Children[0]->Store, /* op0 */ - NULL, - NULL); + inst = emit_instruction(emitInfo, OPCODE_IF, + NULL, /* dst */ + n->Children[0]->Store, /* op0 */ + NULL, + NULL); + if (!inst) { + return NULL; + } } } else { @@ -1875,6 +1927,9 @@ emit_cont_break_if_true(slang_emit_info *emitInfo, slang_ir_node *n) n->Children[0]->Store, NULL, NULL); + if (!inst) { + return NULL; + } n->InstLocation = emitInfo->prog->NumInstructions; inst = new_instruction(emitInfo, opcode); @@ -2045,6 +2100,9 @@ emit_array_element(slang_emit_info *emitInfo, slang_ir_node *n) indexStore, /* the index */ &elemSizeStore, NULL); + if (!inst) { + return NULL; + } indexStore = indexTemp; } @@ -2071,6 +2129,9 @@ emit_array_element(slang_emit_info *emitInfo, slang_ir_node *n) indexStore, /* the index */ &indirectArray, /* indirect array base */ NULL); + if (!inst) { + return NULL; + } indexStore = indexTemp; } -- cgit v1.2.3 From 601edbef172f3106b9e4c0b96b24d8b5eea8d2a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Mon, 23 Nov 2009 19:33:59 +0100 Subject: Fix the DRI swrast driver for big endian platforms. Too bad I didn't realize earlier how easy this could be... Fixes http://bugs.freedesktop.org/show_bug.cgi?id=22767 . --- src/mesa/drivers/dri/swrast/swrast_span.c | 72 +++++++++++++------------------ 1 file changed, 29 insertions(+), 43 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/swrast/swrast_span.c b/src/mesa/drivers/dri/swrast/swrast_span.c index 2d3c25dcbe..f8e503463f 100644 --- a/src/mesa/drivers/dri/swrast/swrast_span.c +++ b/src/mesa/drivers/dri/swrast/swrast_span.c @@ -63,56 +63,42 @@ static const GLubyte kernel[16] = { /* 32-bit BGRA */ #define STORE_PIXEL_A8R8G8B8(DST, X, Y, VALUE) \ - DST[3] = VALUE[ACOMP]; \ - DST[2] = VALUE[RCOMP]; \ - DST[1] = VALUE[GCOMP]; \ - DST[0] = VALUE[BCOMP] + *DST = VALUE[ACOMP] << 24 | VALUE[RCOMP] << 16 | VALUE[GCOMP] << 8 | VALUE[BCOMP] #define STORE_PIXEL_RGB_A8R8G8B8(DST, X, Y, VALUE) \ - DST[3] = 0xff; \ - DST[2] = VALUE[RCOMP]; \ - DST[1] = VALUE[GCOMP]; \ - DST[0] = VALUE[BCOMP] + *DST = 0xff << 24 | VALUE[RCOMP] << 16 | VALUE[GCOMP] << 8 | VALUE[BCOMP] #define FETCH_PIXEL_A8R8G8B8(DST, SRC) \ - DST[ACOMP] = SRC[3]; \ - DST[RCOMP] = SRC[2]; \ - DST[GCOMP] = SRC[1]; \ - DST[BCOMP] = SRC[0] + DST[ACOMP] = *SRC >> 24; \ + DST[RCOMP] = (*SRC >> 16) & 0xff; \ + DST[GCOMP] = (*SRC >> 8) & 0xff; \ + DST[BCOMP] = *SRC & 0xff /* 32-bit BGRX */ #define STORE_PIXEL_X8R8G8B8(DST, X, Y, VALUE) \ - DST[3] = 0xff; \ - DST[2] = VALUE[RCOMP]; \ - DST[1] = VALUE[GCOMP]; \ - DST[0] = VALUE[BCOMP] + *DST = 0xff << 24 | VALUE[RCOMP] << 16 | VALUE[GCOMP] << 8 | VALUE[BCOMP] #define STORE_PIXEL_RGB_X8R8G8B8(DST, X, Y, VALUE) \ - DST[3] = 0xff; \ - DST[2] = VALUE[RCOMP]; \ - DST[1] = VALUE[GCOMP]; \ - DST[0] = VALUE[BCOMP] + *DST = 0xff << 24 | VALUE[RCOMP] << 16 | VALUE[GCOMP] << 8 | VALUE[BCOMP] #define FETCH_PIXEL_X8R8G8B8(DST, SRC) \ - DST[ACOMP] = 0xff; \ - DST[RCOMP] = SRC[2]; \ - DST[GCOMP] = SRC[1]; \ - DST[BCOMP] = SRC[0] + DST[ACOMP] = 0xff; \ + DST[RCOMP] = (*SRC >> 16) & 0xff; \ + DST[GCOMP] = (*SRC >> 8) & 0xff; \ + DST[BCOMP] = *SRC & 0xff /* 16-bit BGR */ #define STORE_PIXEL_R5G6B5(DST, X, Y, VALUE) \ do { \ int d = DITHER_COMP(X, Y) >> 6; \ - GLushort *p = (GLushort *)DST; \ - *p = ( ((DITHER_CLAMP((VALUE[RCOMP]) + d) & 0xf8) << 8) | \ - ((DITHER_CLAMP((VALUE[GCOMP]) + d) & 0xfc) << 3) | \ - ((DITHER_CLAMP((VALUE[BCOMP]) + d) & 0xf8) >> 3) ); \ + *DST = ( ((DITHER_CLAMP((VALUE[RCOMP]) + d) & 0xf8) << 8) | \ + ((DITHER_CLAMP((VALUE[GCOMP]) + d) & 0xfc) << 3) | \ + ((DITHER_CLAMP((VALUE[BCOMP]) + d) & 0xf8) >> 3) ); \ } while(0) #define FETCH_PIXEL_R5G6B5(DST, SRC) \ do { \ - GLushort p = *(GLushort *)SRC; \ DST[ACOMP] = 0xff; \ - DST[RCOMP] = ((p >> 8) & 0xf8) * 255 / 0xf8; \ - DST[GCOMP] = ((p >> 3) & 0xfc) * 255 / 0xfc; \ - DST[BCOMP] = ((p << 3) & 0xf8) * 255 / 0xf8; \ + DST[RCOMP] = ((*SRC >> 8) & 0xf8) * 255 / 0xf8; \ + DST[GCOMP] = ((*SRC >> 3) & 0xfc) * 255 / 0xfc; \ + DST[BCOMP] = ((*SRC << 3) & 0xf8) * 255 / 0xf8; \ } while(0) @@ -145,8 +131,8 @@ static const GLubyte kernel[16] = { #define SPAN_VARS \ struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); #define INIT_PIXEL_PTR(P, X, Y) \ - GLubyte *P = (GLubyte *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch + (X) * 4; -#define INC_PIXEL_PTR(P) P += 4 + GLuint *P = (GLuint *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch / 4 + (X) +#define INC_PIXEL_PTR(P) P++ #define STORE_PIXEL(DST, X, Y, VALUE) \ STORE_PIXEL_A8R8G8B8(DST, X, Y, VALUE) #define STORE_PIXEL_RGB(DST, X, Y, VALUE) \ @@ -163,8 +149,8 @@ static const GLubyte kernel[16] = { #define SPAN_VARS \ struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); #define INIT_PIXEL_PTR(P, X, Y) \ - GLubyte *P = (GLubyte *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch + (X) * 4; -#define INC_PIXEL_PTR(P) P += 4 + GLuint *P = (GLuint *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch / 4 + (X); +#define INC_PIXEL_PTR(P) P++ #define STORE_PIXEL(DST, X, Y, VALUE) \ STORE_PIXEL_X8R8G8B8(DST, X, Y, VALUE) #define STORE_PIXEL_RGB(DST, X, Y, VALUE) \ @@ -181,8 +167,8 @@ static const GLubyte kernel[16] = { #define SPAN_VARS \ struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); #define INIT_PIXEL_PTR(P, X, Y) \ - GLubyte *P = (GLubyte *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch + (X) * 2; -#define INC_PIXEL_PTR(P) P += 2 + GLushort *P = (GLushort *)xrb->Base.Data + YFLIP(xrb, Y) * xrb->pitch / 2 + (X); +#define INC_PIXEL_PTR(P) P++ #define STORE_PIXEL(DST, X, Y, VALUE) \ STORE_PIXEL_R5G6B5(DST, X, Y, VALUE) #define FETCH_PIXEL(DST, SRC) \ @@ -234,8 +220,8 @@ static const GLubyte kernel[16] = { #define SPAN_VARS \ struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); #define INIT_PIXEL_PTR(P, X, Y) \ - GLubyte *P = (GLubyte *)row; -#define INC_PIXEL_PTR(P) P += 4 + GLuint *P = (GLuint *)row; +#define INC_PIXEL_PTR(P) P++ #define STORE_PIXEL(DST, X, Y, VALUE) \ STORE_PIXEL_A8R8G8B8(DST, X, Y, VALUE) #define STORE_PIXEL_RGB(DST, X, Y, VALUE) \ @@ -252,8 +238,8 @@ static const GLubyte kernel[16] = { #define SPAN_VARS \ struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); #define INIT_PIXEL_PTR(P, X, Y) \ - GLubyte *P = (GLubyte *)row; -#define INC_PIXEL_PTR(P) P += 4 + GLuint *P = (GLuint *)row; +#define INC_PIXEL_PTR(P) P++ #define STORE_PIXEL(DST, X, Y, VALUE) \ STORE_PIXEL_X8R8G8B8(DST, X, Y, VALUE) #define STORE_PIXEL_RGB(DST, X, Y, VALUE) \ @@ -270,7 +256,7 @@ static const GLubyte kernel[16] = { #define SPAN_VARS \ struct swrast_renderbuffer *xrb = swrast_renderbuffer(rb); #define INIT_PIXEL_PTR(P, X, Y) \ - GLubyte *P = (GLubyte *)row; + GLushort *P = (GLushort *)row; #define INC_PIXEL_PTR(P) P += 2 #define STORE_PIXEL(DST, X, Y, VALUE) \ STORE_PIXEL_R5G6B5(DST, X, Y, VALUE) -- cgit v1.2.3 From 86710c3334850eeaeffcac6d538e01fd5c203167 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Mon, 23 Nov 2009 19:59:02 +0100 Subject: svga: Scrub Makefiles a bit Remove x86 specific hacks. Not that they will ever be used on none x86 arches, but they are built by default. And the way the flags where added was a hack. --- src/gallium/drivers/svga/Makefile | 8 +------- src/gallium/winsys/drm/vmware/core/Makefile | 14 +------------- 2 files changed, 2 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/Makefile b/src/gallium/drivers/svga/Makefile index fe1d6d7384..d1413319c9 100644 --- a/src/gallium/drivers/svga/Makefile +++ b/src/gallium/drivers/svga/Makefile @@ -51,13 +51,7 @@ LIBRARY_INCLUDES = \ -I$(TOP)/src/gallium/drivers/svga/include LIBRARY_DEFINES = \ + -std=gnu99 -fvisibility=hidden \ -DHAVE_STDINT_H -DHAVE_SYS_TYPES_H -CC = gcc -fvisibility=hidden -msse -msse2 - -# Set the gnu99 standard to enable anonymous structs in vmware headers. -# -CFLAGS = -Wall -Wmissing-prototypes -std=gnu99 -ffast-math \ - $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) $(ASM_FLAGS) - include ../../Makefile.template diff --git a/src/gallium/winsys/drm/vmware/core/Makefile b/src/gallium/winsys/drm/vmware/core/Makefile index ff8f01b322..a52957c1a5 100644 --- a/src/gallium/winsys/drm/vmware/core/Makefile +++ b/src/gallium/winsys/drm/vmware/core/Makefile @@ -28,20 +28,8 @@ LIBRARY_INCLUDES = \ $(shell pkg-config libdrm --cflags-only-I) LIBRARY_DEFINES = \ + -std=gnu99 -fvisibility=hidden \ -DHAVE_STDINT_H -D_FILE_OFFSET_BITS=64 \ $(shell pkg-config libdrm --cflags-only-other) -CC = gcc -fvisibility=hidden -msse -msse2 - -# Set the gnu99 standard to enable anonymous structs in vmware headers. -# -CFLAGS = -Wall -Wmissing-prototypes -std=gnu99 -ffast-math \ - $(OPT_FLAGS) $(PIC_FLAGS) $(ARCH_FLAGS) $(DEFINES) $(ASM_FLAGS) - include ../../../../Makefile.template - - -symlinks: - - -include depend -- cgit v1.2.3 From 960464e42dce138fde11c379ce7744bc4be14aa2 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Mon, 23 Nov 2009 21:59:08 +0100 Subject: radeon: fix errors in miptree related function - typo - memory leak - off by one (spotted by airlied) --- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index a11b5b9979..46603de2e7 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -492,11 +492,12 @@ static radeon_mipmap_tree * get_biggest_matching_miptree(radeonTexObj *texObj, unsigned firstLevel, unsigned lastLevel) { - const unsigned numLevels = lastLevel - firstLevel; + const unsigned numLevels = lastLevel - firstLevel + 1; unsigned *mtSizes = calloc(numLevels, sizeof(unsigned)); radeon_mipmap_tree **mts = calloc(numLevels, sizeof(radeon_mipmap_tree *)); unsigned mtCount = 0; unsigned maxMtIndex = 0; + radeon_mipmap_tree *tmp; for (unsigned level = firstLevel; level <= lastLevel; ++level) { radeon_texture_image *img = get_radeon_texture_image(texObj->base.Image[0][level]); @@ -518,7 +519,7 @@ static radeon_mipmap_tree * get_biggest_matching_miptree(radeonTexObj *texObj, if (!found) { mtSizes[mtCount] += img->mt->levels[img->mtlevel].size; - mts[mtCount++] = img->mt; + mts[mtCount] = img->mt; mtCount++; } } @@ -533,7 +534,11 @@ static radeon_mipmap_tree * get_biggest_matching_miptree(radeonTexObj *texObj, } } - return mts[maxMtIndex]; + tmp = mts[maxMtIndex]; + free(mtSizes); + free(mts); + + return tmp; } /** -- cgit v1.2.3 From 364070b1f2b08d43fb205ec198894a35bec6b2f3 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 24 Nov 2009 00:57:55 -0500 Subject: dri: Fix potential null pointer deference in dri_put_drawable. --- src/mesa/drivers/dri/common/dri_util.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index e48e10d7c0..439f66a7b8 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -498,11 +498,11 @@ static void dri_put_drawable(__DRIdrawable *pdp) { __DRIscreenPrivate *psp; - pdp->refcount--; - if (pdp->refcount) - return; - if (pdp) { + pdp->refcount--; + if (pdp->refcount) + return; + psp = pdp->driScreenPriv; (*psp->DriverAPI.DestroyBuffer)(pdp); if (pdp->pClipRects) { -- cgit v1.2.3 From 326b66d724754ca97012501db1c7c62d7d41a457 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 24 Nov 2009 01:23:12 -0500 Subject: glu/sgi: Fix memory leak in gluBuild3DMipmapLevelsCore. --- src/glu/sgi/libutil/mipmap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c index c5faebd6a3..a5d07a59cf 100644 --- a/src/glu/sgi/libutil/mipmap.c +++ b/src/glu/sgi/libutil/mipmap.c @@ -8232,6 +8232,7 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); glPixelStorei(GL_UNPACK_SKIP_IMAGES, psm.unpack_skip_images); glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, psm.unpack_image_height); + free(srcImage); return GLU_OUT_OF_MEMORY; } } -- cgit v1.2.3 From acc51ac0ace11bb375241467ba35e1014f5fb997 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 24 Nov 2009 01:14:03 +0100 Subject: svga: Filter out pendantic and ansi flags Rather have the driver compile without the flags then having to disable them. --- src/gallium/drivers/svga/Makefile | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/svga/Makefile b/src/gallium/drivers/svga/Makefile index d1413319c9..8158364d25 100644 --- a/src/gallium/drivers/svga/Makefile +++ b/src/gallium/drivers/svga/Makefile @@ -50,6 +50,9 @@ C_SOURCES = \ LIBRARY_INCLUDES = \ -I$(TOP)/src/gallium/drivers/svga/include +# With linux-debug we get a lots of warnings, filter out the bad flags. +CFLAGS := $(filter-out -pedantic, $(filter-out -ansi, $(CFLAGS))) + LIBRARY_DEFINES = \ -std=gnu99 -fvisibility=hidden \ -DHAVE_STDINT_H -DHAVE_SYS_TYPES_H -- cgit v1.2.3 From 15740eb03ca8fb7eda585c612c1b36ec9df4474a Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 23 Nov 2009 18:04:22 -0700 Subject: gallium/util: added util_bitcount() --- src/gallium/auxiliary/util/u_math.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index 731a11475e..9ed1ab6d8e 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -490,6 +490,26 @@ util_next_power_of_two(unsigned x) } +/** + * Return number of bits set in n. + */ +static INLINE unsigned +util_bitcount(unsigned n) +{ +#if defined(PIPE_CC_GCC) + return __builtin_popcount(n); +#else + /* XXX there are more clever ways of doing this */ + unsigned bits = 0; + while (n) { + bits += (n & 1); + n = n >> 1; + } + return bits; +#endif +} + + /** * Clamp X to [MIN, MAX]. * This is a macro to allow float, int, uint, etc. types. -- cgit v1.2.3 From 0a27c7b96337b1a56100d2cc3b5fa0454fc7c165 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 23 Nov 2009 18:04:47 -0700 Subject: egl: use util_bitcount() --- src/gallium/winsys/egl_xlib/egl_xlib.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/egl_xlib/egl_xlib.c b/src/gallium/winsys/egl_xlib/egl_xlib.c index d02f825047..599973ce12 100644 --- a/src/gallium/winsys/egl_xlib/egl_xlib.c +++ b/src/gallium/winsys/egl_xlib/egl_xlib.c @@ -41,6 +41,7 @@ #include "pipe/p_state.h" #include "pipe/internal/p_winsys_screen.h" #include "util/u_memory.h" +#include "util/u_math.h" #include "softpipe/sp_winsys.h" #include "softpipe/sp_texture.h" @@ -138,17 +139,6 @@ lookup_context(_EGLContext *ctx) } -static unsigned int -bitcount(unsigned int n) -{ - unsigned int bits; - for (bits = 0; n > 0; n = n >> 1) { - bits += (n & 1); - } - return bits; -} - - /** * Create the EGLConfigs. (one per X visual) */ @@ -174,9 +164,9 @@ create_configs(struct xlib_egl_display *xdpy, _EGLDisplay *disp) for (i = 0; i < num_visuals; i++) { _EGLConfig *config = calloc(1, sizeof(_EGLConfig)); int id = i + 1; - int rbits = bitcount(visInfo[i].red_mask); - int gbits = bitcount(visInfo[i].green_mask); - int bbits = bitcount(visInfo[i].blue_mask); + int rbits = util_bitcount(visInfo[i].red_mask); + int gbits = util_bitcount(visInfo[i].green_mask); + int bbits = util_bitcount(visInfo[i].blue_mask); int abits = bbits == 8 ? 8 : 0; int zbits = 24; int sbits = 8; -- cgit v1.2.3 From 8d80b5400a1bbf4e959cd8257d11dfe0483e93db Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 23 Nov 2009 18:06:19 -0700 Subject: r300g: use util_bitcount() --- src/gallium/drivers/r300/r300_emit.c | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index ad7dff36be..e6ab8e4af1 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -721,21 +721,6 @@ void r300_emit_vertex_format_state(struct r300_context* r300) END_CS; } -/* XXX This should go to util ... */ -/* Return the number of bits set in the given number. */ -static unsigned bitcount(unsigned n) -{ - unsigned bits = 0; - - while (n) { - if (n & 1) { - bits++; - } - n >>= 1; - } - - return bits; -} void r300_emit_vertex_program_code(struct r300_context* r300, struct r300_vertex_program_code* code) @@ -745,8 +730,8 @@ void r300_emit_vertex_program_code(struct r300_context* r300, unsigned instruction_count = code->length / 4; int vtx_mem_size = r300screen->caps->is_r500 ? 128 : 72; - int input_count = MAX2(bitcount(code->InputsRead), 1); - int output_count = MAX2(bitcount(code->OutputsWritten), 1); + int input_count = MAX2(util_bitcount(code->InputsRead), 1); + int output_count = MAX2(util_bitcount(code->OutputsWritten), 1); int temp_count = MAX2(code->num_temporaries, 1); int pvs_num_slots = MIN3(vtx_mem_size / input_count, vtx_mem_size / output_count, 10); -- cgit v1.2.3 From 863ad9a68388979e1d305f8689146e18ef4f098c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 23 Nov 2009 18:09:46 -0700 Subject: mesa: use gcc __builtin_popcount() --- src/mesa/main/imports.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 46ffb929b6..c9e00cf752 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -629,11 +629,15 @@ _mesa_ffsll(int64_t val) unsigned int _mesa_bitcount(unsigned int n) { +#if defined(__GNUC__) + return __builtin_popcount(n); +#else unsigned int bits; for (bits = 0; n > 0; n = n >> 1) { bits += (n & 1); } return bits; +#endif } -- cgit v1.2.3 From bd13e6e5e2403ada2098e3a07c0af4b4ba989ab7 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 24 Nov 2009 10:49:34 +1000 Subject: radeon/r200/r300/r600: make bo mapping be explicit This moves the bo mapping outside the DMA layer and makes it explicit, this should in theory make it simpler to split the clean up the dma/cmdbuf linkage that I created before that is broken. Tested on: r600, rv380 (tcl/no-tcl), rv200 (tcl/no-tcl) Signed-off-by: Dave Airlie --- src/mesa/drivers/dri/r200/r200_maos_arrays.c | 2 ++ src/mesa/drivers/dri/r200/r200_swtcl.c | 2 +- src/mesa/drivers/dri/r300/r300_draw.c | 15 ++++++++++++-- src/mesa/drivers/dri/r300/r300_swtcl.c | 8 ++++---- src/mesa/drivers/dri/r600/r700_render.c | 21 ++++++++++++++++++- .../drivers/dri/radeon/radeon_common_context.h | 1 + src/mesa/drivers/dri/radeon/radeon_dma.c | 24 +++++++++++----------- src/mesa/drivers/dri/radeon/radeon_maos_arrays.c | 4 ++++ src/mesa/drivers/dri/radeon/radeon_maos_verts.c | 4 ++-- src/mesa/drivers/dri/radeon/radeon_swtcl.c | 2 +- 10 files changed, 60 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r200/r200_maos_arrays.c b/src/mesa/drivers/dri/r200/r200_maos_arrays.c index 383a0c4b0d..249c0bbc11 100644 --- a/src/mesa/drivers/dri/r200/r200_maos_arrays.c +++ b/src/mesa/drivers/dri/r200/r200_maos_arrays.c @@ -90,12 +90,14 @@ static void r200_emit_vecfog(GLcontext *ctx, struct radeon_aos *aos, aos->components = size; aos->count = count; + radeon_bo_map(aos->bo, 1); out = (uint32_t*)((char*)aos->bo->ptr + aos->offset); for (i = 0; i < count; i++) { out[0] = r200ComputeFogBlendFactor( ctx, *(GLfloat *)data ); out++; data += stride; } + radeon_bo_unmap(aos->bo); } /* Emit any changed arrays to new GART memory, re-emit a packet to diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c index fadc766b49..4596912ddc 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.c +++ b/src/mesa/drivers/dri/r200/r200_swtcl.c @@ -297,7 +297,7 @@ void r200_swtcl_flush(GLcontext *ctx, uint32_t current_offset) radeonEmitState(&rmesa->radeon); r200EmitVertexAOS( rmesa, rmesa->radeon.swtcl.vertex_size, - first_elem(&rmesa->radeon.dma.reserved)->bo, + rmesa->radeon.swtcl.bo, current_offset); diff --git a/src/mesa/drivers/dri/r300/r300_draw.c b/src/mesa/drivers/dri/r300/r300_draw.c index e9968f9ffe..3dcd986e22 100644 --- a/src/mesa/drivers/dri/r300/r300_draw.c +++ b/src/mesa/drivers/dri/r300/r300_draw.c @@ -100,7 +100,7 @@ static void r300FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer GLubyte *in = (GLubyte *)src_ptr; radeonAllocDmaRegion(&r300->radeon, &r300->ind_buf.bo, &r300->ind_buf.bo_offset, size, 4); - + radeon_bo_map(r300->ind_buf.bo, 1); assert(r300->ind_buf.bo->ptr != NULL); out = (GLuint *)ADD_POINTERS(r300->ind_buf.bo->ptr, r300->ind_buf.bo_offset); @@ -111,7 +111,7 @@ static void r300FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer if (i < mesa_ind_buf->count) { *out++ = in[i]; } - + radeon_bo_unmap(r300->ind_buf.bo); #if MESA_BIG_ENDIAN } else { /* if (mesa_ind_buf->type == GL_UNSIGNED_SHORT) */ GLushort *in = (GLushort *)src_ptr; @@ -120,6 +120,7 @@ static void r300FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer radeonAllocDmaRegion(&r300->radeon, &r300->ind_buf.bo, &r300->ind_buf.bo_offset, size, 4); + radeon_bo_map(r300->ind_buf.bo, 1); assert(r300->ind_buf.bo->ptr != NULL); out = (GLuint *)ADD_POINTERS(r300->ind_buf.bo->ptr, r300->ind_buf.bo_offset); @@ -130,6 +131,7 @@ static void r300FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer if (i < mesa_ind_buf->count) { *out++ = in[i]; } + radeon_bo_unmap(r300->ind_buf.bo); #endif } @@ -173,10 +175,12 @@ static void r300SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer radeonAllocDmaRegion(&r300->radeon, &r300->ind_buf.bo, &r300->ind_buf.bo_offset, size, 4); + radeon_bo_map(r300->ind_buf.bo, 1); assert(r300->ind_buf.bo->ptr != NULL); dst_ptr = ADD_POINTERS(r300->ind_buf.bo->ptr, r300->ind_buf.bo_offset); _mesa_memcpy(dst_ptr, src_ptr, size); + radeon_bo_unmap(r300->ind_buf.bo); r300->ind_buf.is_32bit = (mesa_ind_buf->type == GL_UNSIGNED_INT); r300->ind_buf.count = mesa_ind_buf->count; @@ -242,6 +246,7 @@ static void r300ConvertAttrib(GLcontext *ctx, int count, const struct gl_client_ } radeonAllocDmaRegion(&r300->radeon, &attr->bo, &attr->bo_offset, sizeof(GLfloat) * input->Size * count, 32); + radeon_bo_map(attr->bo, 1); dst_ptr = (GLfloat *)ADD_POINTERS(attr->bo->ptr, attr->bo_offset); radeon_print(RADEON_FALLBACKS, RADEON_IMPORTANT, @@ -280,6 +285,7 @@ static void r300ConvertAttrib(GLcontext *ctx, int count, const struct gl_client_ break; } + radeon_bo_unmap(attr->bo); if (mapped_named_bo) { ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER, input->BufferObj); } @@ -294,6 +300,8 @@ static void r300AlignDataToDword(GLcontext *ctx, const struct gl_client_array *i radeonAllocDmaRegion(&r300->radeon, &attr->bo, &attr->bo_offset, size, 32); + radeon_bo_map(attr->bo, 1); + if (!input->BufferObj->Pointer) { ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER, GL_READ_ONLY_ARB, input->BufferObj); mapped_named_bo = GL_TRUE; @@ -317,6 +325,7 @@ static void r300AlignDataToDword(GLcontext *ctx, const struct gl_client_array *i ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER, input->BufferObj); } + radeon_bo_unmap(attr->bo); attr->stride = dst_stride; } @@ -527,6 +536,7 @@ static void r300AllocDmaRegions(GLcontext *ctx, const struct gl_client_array *in } radeonAllocDmaRegion(&r300->radeon, &vbuf->attribs[index].bo, &vbuf->attribs[index].bo_offset, size, 32); + radeon_bo_map(vbuf->attribs[index].bo, 1); assert(vbuf->attribs[index].bo->ptr != NULL); dst = (uint32_t *)ADD_POINTERS(vbuf->attribs[index].bo->ptr, vbuf->attribs[index].bo_offset); switch (vbuf->attribs[index].dwords) { @@ -536,6 +546,7 @@ static void r300AllocDmaRegions(GLcontext *ctx, const struct gl_client_array *in case 4: radeonEmitVec16(dst, input[i]->Ptr, input[i]->StrideB, local_count); break; default: assert(0); break; } + radeon_bo_unmap(vbuf->attribs[index].bo); } } diff --git a/src/mesa/drivers/dri/r300/r300_swtcl.c b/src/mesa/drivers/dri/r300/r300_swtcl.c index 99bd22edac..383c8a274b 100644 --- a/src/mesa/drivers/dri/r300/r300_swtcl.c +++ b/src/mesa/drivers/dri/r300/r300_swtcl.c @@ -665,11 +665,11 @@ void r300_swtcl_flush(GLcontext *ctx, uint32_t current_offset) r300EmitCacheFlush(rmesa); radeonEmitState(&rmesa->radeon); - r300_emit_scissor(ctx); + r300_emit_scissor(ctx); r300EmitVertexAOS(rmesa, - rmesa->radeon.swtcl.vertex_size, - first_elem(&rmesa->radeon.dma.reserved)->bo, - current_offset); + rmesa->radeon.swtcl.vertex_size, + rmesa->radeon.swtcl.bo, + current_offset); r300EmitVbufPrim(rmesa, rmesa->radeon.swtcl.hw_primitive, diff --git a/src/mesa/drivers/dri/r600/r700_render.c b/src/mesa/drivers/dri/r600/r700_render.c index 47f89c91f8..eab27cbd84 100644 --- a/src/mesa/drivers/dri/r600/r700_render.c +++ b/src/mesa/drivers/dri/r600/r700_render.c @@ -526,6 +526,9 @@ static void r700ConvertAttrib(GLcontext *ctx, int count, radeonAllocDmaRegion(&context->radeon, &attr->bo, &attr->bo_offset, sizeof(GLfloat) * input->Size * count, 32); + + radeon_bo_map(attr->bo, 1); + dst_ptr = (GLfloat *)ADD_POINTERS(attr->bo->ptr, attr->bo_offset); assert(src_ptr != NULL); @@ -559,6 +562,8 @@ static void r700ConvertAttrib(GLcontext *ctx, int count, break; } + radeon_bo_unmap(attr->bo); + if (mapped_named_bo) { ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER, input->BufferObj); @@ -577,6 +582,8 @@ static void r700AlignDataToDword(GLcontext *ctx, radeonAllocDmaRegion(&context->radeon, &attr->bo, &attr->bo_offset, size, 32); + radeon_bo_map(attr->bo, 1); + if (!input->BufferObj->Pointer) { ctx->Driver.MapBuffer(ctx, GL_ARRAY_BUFFER, GL_READ_ONLY_ARB, input->BufferObj); @@ -596,6 +603,7 @@ static void r700AlignDataToDword(GLcontext *ctx, } } + radeon_bo_unmap(attr->bo); if (mapped_named_bo) { ctx->Driver.UnmapBuffer(ctx, GL_ARRAY_BUFFER, input->BufferObj); @@ -664,14 +672,18 @@ static void r700SetupStreams(GLcontext *ctx, const struct gl_client_array *input radeonAllocDmaRegion(&context->radeon, &context->stream_desc[index].bo, &context->stream_desc[index].bo_offset, size, 32); + + radeon_bo_map(context->stream_desc[index].bo, 1); assert(context->stream_desc[index].bo->ptr != NULL); + + dst = (uint32_t *)ADD_POINTERS(context->stream_desc[index].bo->ptr, context->stream_desc[index].bo_offset); switch (context->stream_desc[index].dwords) { case 1: - radeonEmitVec4(dst, input[i]->Ptr, input[i]->StrideB, local_count); + radeonEmitVec4(dst, input[i]->Ptr, input[i]->StrideB, local_count); break; case 2: radeonEmitVec8(dst, input[i]->Ptr, input[i]->StrideB, local_count); @@ -686,6 +698,7 @@ static void r700SetupStreams(GLcontext *ctx, const struct gl_client_array *input assert(0); break; } + radeon_bo_unmap(context->stream_desc[index].bo); } } @@ -757,6 +770,7 @@ static void r700FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo, &context->ind_buf.bo_offset, size, 4); + radeon_bo_map(context->ind_buf.bo, 1); assert(context->ind_buf.bo->ptr != NULL); out = (GLuint *)ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); @@ -770,6 +784,7 @@ static void r700FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer *out++ = in[i]; } + radeon_bo_unmap(context->ind_buf.bo); #if MESA_BIG_ENDIAN } else @@ -780,6 +795,7 @@ static void r700FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo, &context->ind_buf.bo_offset, size, 4); + radeon_bo_map(context->ind_buf.bo, 1); assert(context->ind_buf.bo->ptr != NULL); out = (GLuint *)ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); @@ -792,6 +808,7 @@ static void r700FixupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer { *out++ = in[i]; } + radeon_bo_unmap(context->ind_buf.bo); #endif } @@ -837,11 +854,13 @@ static void r700SetupIndexBuffer(GLcontext *ctx, const struct _mesa_index_buffer radeonAllocDmaRegion(&context->radeon, &context->ind_buf.bo, &context->ind_buf.bo_offset, size, 4); + radeon_bo_map(context->ind_buf.bo, 1); assert(context->ind_buf.bo->ptr != NULL); dst_ptr = ADD_POINTERS(context->ind_buf.bo->ptr, context->ind_buf.bo_offset); _mesa_memcpy(dst_ptr, src_ptr, size); + radeon_bo_unmap(context->ind_buf.bo); context->ind_buf.is_32bit = (mesa_ind_buf->type == GL_UNSIGNED_INT); context->ind_buf.count = mesa_ind_buf->count; diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h index ded81fff29..ad953ddbb5 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h @@ -328,6 +328,7 @@ struct radeon_swtcl_info { GLuint vertex_attr_count; GLuint emit_prediction; + struct radeon_bo *bo; }; #define RADEON_MAX_AOS_ARRAYS 16 diff --git a/src/mesa/drivers/dri/radeon/radeon_dma.c b/src/mesa/drivers/dri/radeon/radeon_dma.c index c6edbae9a1..2a1bd7357a 100644 --- a/src/mesa/drivers/dri/radeon/radeon_dma.c +++ b/src/mesa/drivers/dri/radeon/radeon_dma.c @@ -151,6 +151,7 @@ void rcommon_emit_vector(GLcontext * ctx, struct radeon_aos *aos, aos->components = size; aos->count = count; + radeon_bo_map(aos->bo, 1); out = (uint32_t*)((char*)aos->bo->ptr + aos->offset); switch (size) { case 1: radeonEmitVec4(out, data, stride, count); break; @@ -161,6 +162,7 @@ void rcommon_emit_vector(GLcontext * ctx, struct radeon_aos *aos, assert(0); break; } + radeon_bo_unmap(aos->bo); } void radeon_init_dma(radeonContextPtr rmesa) @@ -183,10 +185,6 @@ void radeonRefillCurrentDmaRegion(radeonContextPtr rmesa, int size) __FUNCTION__, size, rmesa->dma.minimum_size); - /* unmap old reserved bo */ - if (!is_empty_list(&rmesa->dma.reserved)) - radeon_bo_unmap(first_elem(&rmesa->dma.reserved)->bo); - if (is_empty_list(&rmesa->dma.free) || last_elem(&rmesa->dma.free)->bo->size < size) { dma_bo = CALLOC_STRUCT(radeon_dma_bo); @@ -223,8 +221,6 @@ again_alloc: /* Cmd buff have been flushed in radeon_revalidate_bos */ goto again_alloc; } - - radeon_bo_map(first_elem(&rmesa->dma.reserved)->bo, 1); } /* Allocates a region from rmesa->dma.current. If there isn't enough @@ -281,7 +277,6 @@ void radeonFreeDmaRegions(radeonContextPtr rmesa) foreach_s(dma_bo, temp, &rmesa->dma.reserved) { remove_from_list(dma_bo); - radeon_bo_unmap(dma_bo->bo); radeon_bo_unref(dma_bo->bo); FREE(dma_bo); } @@ -367,9 +362,6 @@ void radeonReleaseDmaRegions(radeonContextPtr rmesa) insert_at_tail(&rmesa->dma.free, dma_bo); } - /* unmap the last dma region */ - if (!is_empty_list(&rmesa->dma.reserved)) - radeon_bo_unmap(first_elem(&rmesa->dma.reserved)->bo); /* move reserved to wait list */ foreach_s(dma_bo, temp, &rmesa->dma.reserved) { /* free objects that are too small to be used because of large request */ @@ -403,11 +395,12 @@ void rcommon_flush_last_swtcl_prim( GLcontext *ctx ) radeonContextPtr rmesa = RADEON_CONTEXT(ctx); struct radeon_dma *dma = &rmesa->dma; - if (RADEON_DEBUG & RADEON_IOCTL) fprintf(stderr, "%s\n", __FUNCTION__); dma->flush = NULL; + radeon_bo_unmap(rmesa->swtcl.bo); + if (!is_empty_list(&dma->reserved)) { GLuint current_offset = dma->current_used; @@ -422,6 +415,8 @@ void rcommon_flush_last_swtcl_prim( GLcontext *ctx ) } rmesa->swtcl.numverts = 0; } + radeon_bo_unref(rmesa->swtcl.bo); + rmesa->swtcl.bo = NULL; } /* Alloc space in the current dma region. */ @@ -432,6 +427,7 @@ rcommonAllocDmaLowVerts( radeonContextPtr rmesa, int nverts, int vsize ) void *head; if (RADEON_DEBUG & RADEON_IOCTL) fprintf(stderr, "%s\n", __FUNCTION__); + if(is_empty_list(&rmesa->dma.reserved) ||rmesa->dma.current_vertexptr + bytes > first_elem(&rmesa->dma.reserved)->bo->size) { if (rmesa->dma.flush) { @@ -455,7 +451,11 @@ rcommonAllocDmaLowVerts( radeonContextPtr rmesa, int nverts, int vsize ) rmesa->swtcl.numverts * rmesa->swtcl.vertex_size * 4 == rmesa->dma.current_vertexptr ); - head = (first_elem(&rmesa->dma.reserved)->bo->ptr + rmesa->dma.current_vertexptr); + rmesa->swtcl.bo = first_elem(&rmesa->dma.reserved)->bo; + radeon_bo_ref(rmesa->swtcl.bo); + radeon_bo_map(rmesa->swtcl.bo, 1); + + head = (rmesa->swtcl.bo->ptr + rmesa->dma.current_vertexptr); rmesa->dma.current_vertexptr += bytes; rmesa->swtcl.numverts += nverts; return head; diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c index de18d2ddd6..d810e6080e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c @@ -76,12 +76,14 @@ static void emit_vecfog(GLcontext *ctx, struct radeon_aos *aos, /* Emit the data */ + radeon_bo_map(aos->bo, 1); out = (uint32_t*)((char*)aos->bo->ptr + aos->offset); for (i = 0; i < count; i++) { out[0] = radeonComputeFogBlendFactor( ctx, *(GLfloat *)data ); out++; data += stride; } + radeon_bo_unmap(aos->bo); } static void emit_s0_vec(uint32_t *out, GLvoid *data, int stride, int count) @@ -151,6 +153,7 @@ static void emit_tex_vector(GLcontext *ctx, struct radeon_aos *aos, /* Emit the data */ + radeon_bo_map(aos->bo, 1); out = (uint32_t*)((char*)aos->bo->ptr + aos->offset); switch (size) { case 1: @@ -170,6 +173,7 @@ static void emit_tex_vector(GLcontext *ctx, struct radeon_aos *aos, exit(1); break; } + radeon_bo_unmap(aos->bo); } diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c index 5ed11d0a9d..98f96ff2a7 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c @@ -420,10 +420,10 @@ void radeonEmitArrays( GLcontext *ctx, GLuint inputs ) } - + radeon_bo_map(rmesa->radeon.tcl.aos[0].bo, 1); setup_tab[i].emit( ctx, 0, VB->Count, rmesa->radeon.tcl.aos[0].bo->ptr + rmesa->radeon.tcl.aos[0].offset); - + radeon_bo_unmap(rmesa->radeon.tcl.aos[0].bo); // rmesa->radeon.tcl.aos[0].size = setup_tab[i].vertex_size; rmesa->radeon.tcl.aos[0].stride = setup_tab[i].vertex_size; rmesa->tcl.vertex_format = setup_tab[i].vertex_format; diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/src/mesa/drivers/dri/radeon/radeon_swtcl.c index 6bbe8e252e..8bf1bfbc57 100644 --- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c +++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c @@ -309,7 +309,7 @@ void r100_swtcl_flush(GLcontext *ctx, uint32_t current_offset) radeonEmitState(&rmesa->radeon); radeonEmitVertexAOS( rmesa, rmesa->radeon.swtcl.vertex_size, - first_elem(&rmesa->radeon.dma.reserved)->bo, + rmesa->radeon.swtcl.bo, current_offset); -- cgit v1.2.3 From 2176b3ed9ab832122e56aed3242dfda102a5fec6 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 24 Nov 2009 11:56:45 +1000 Subject: r300: fix swtcl bo leak problem. We can get a lot of swtcl bo allocations - need to probably abstract this a bit further. Signed-off-by: Dave Airlie --- src/mesa/drivers/dri/radeon/radeon_dma.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_dma.c b/src/mesa/drivers/dri/radeon/radeon_dma.c index 2a1bd7357a..89a99974e2 100644 --- a/src/mesa/drivers/dri/radeon/radeon_dma.c +++ b/src/mesa/drivers/dri/radeon/radeon_dma.c @@ -451,9 +451,11 @@ rcommonAllocDmaLowVerts( radeonContextPtr rmesa, int nverts, int vsize ) rmesa->swtcl.numverts * rmesa->swtcl.vertex_size * 4 == rmesa->dma.current_vertexptr ); - rmesa->swtcl.bo = first_elem(&rmesa->dma.reserved)->bo; - radeon_bo_ref(rmesa->swtcl.bo); - radeon_bo_map(rmesa->swtcl.bo, 1); + if (!rmesa->swtcl.bo) { + rmesa->swtcl.bo = first_elem(&rmesa->dma.reserved)->bo; + radeon_bo_ref(rmesa->swtcl.bo); + radeon_bo_map(rmesa->swtcl.bo, 1); + } head = (rmesa->swtcl.bo->ptr + rmesa->dma.current_vertexptr); rmesa->dma.current_vertexptr += bytes; -- cgit v1.2.3 From b12ca6b87b55e3359e81d5a3be380c860478e353 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 23 Nov 2009 23:14:49 -0800 Subject: i915: Initialize Length and Offset fields when mapping a buffer object This fixes an assertion failure in _mesa_MapBufferARB. Fixes bugzilla #25253. --- src/mesa/drivers/dri/intel/intel_buffer_objects.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_buffer_objects.c b/src/mesa/drivers/dri/intel/intel_buffer_objects.c index a0225936c8..ccce9e712d 100644 --- a/src/mesa/drivers/dri/intel/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/intel/intel_buffer_objects.c @@ -254,6 +254,8 @@ intel_bufferobj_map(GLcontext * ctx, if (intel_obj->sys_buffer) { obj->Pointer = intel_obj->sys_buffer; + obj->Length = obj->Size; + obj->Offset = 0; return obj->Pointer; } -- cgit v1.2.3 From 57221c54387a43e268a80ee6b578d57e03efcc5e Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 24 Nov 2009 08:55:40 +0100 Subject: gallium: Refactor the instruction predicate TGSI token. Rename it to tgsi_instruction_predicate -- it's no longer an extended token. Its presence is indicated by a new flag in tgsi_instruction that indicates whether an instruction is predicated. Also, change predicate index representation to match the other tokens that specify register indices. --- src/gallium/include/pipe/p_shader_tokens.h | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index d4c8aadaf9..c4c28522c8 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -293,6 +293,8 @@ union tgsi_immediate_data * respectively. For a given operation code, those numbers are fixed and are * present here only for convenience. * + * If Predicate is TRUE, tgsi_instruction_predicate token immediately follows. + * * If Extended is TRUE, it is now executed. * * Saturate controls how are final results in destination registers modified. @@ -306,7 +308,8 @@ struct tgsi_instruction unsigned Saturate : 2; /* TGSI_SAT_ */ unsigned NumDstRegs : 2; /* UINT */ unsigned NumSrcRegs : 4; /* UINT */ - unsigned Padding : 3; + unsigned Predicate : 1; /* BOOL */ + unsigned Padding : 2; unsigned Extended : 1; /* BOOL */ }; @@ -323,7 +326,6 @@ struct tgsi_instruction #define TGSI_INSTRUCTION_EXT_TYPE_LABEL 1 #define TGSI_INSTRUCTION_EXT_TYPE_TEXTURE 2 -#define TGSI_INSTRUCTION_EXT_TYPE_PREDICATE 3 struct tgsi_instruction_ext { @@ -339,9 +341,6 @@ struct tgsi_instruction_ext * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_TEXTURE, it * should be cast to tgsi_instruction_ext_texture. * - * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_PREDICATE, it - * should be cast to tgsi_instruction_ext_predicate. - * * If tgsi_instruction_ext::Extended is TRUE, another tgsi_instruction_ext * follows. */ @@ -382,17 +381,15 @@ struct tgsi_instruction_ext_texture * For SM3, the following constraint applies. * - Swizzle is either set to identity or replicate. */ -struct tgsi_instruction_ext_predicate +struct tgsi_instruction_predicate { - unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_PREDICATE */ + int Index : 16; /* SINT */ unsigned SwizzleX : 2; /* TGSI_SWIZZLE_x */ unsigned SwizzleY : 2; /* TGSI_SWIZZLE_x */ unsigned SwizzleZ : 2; /* TGSI_SWIZZLE_x */ unsigned SwizzleW : 2; /* TGSI_SWIZZLE_x */ unsigned Negate : 1; /* BOOL */ - unsigned SrcIndex : 8; /* UINT */ - unsigned Padding : 10; - unsigned Extended : 1; /* BOOL */ + unsigned Padding : 7; }; /** -- cgit v1.2.3 From 5ee0d9f632383339088cc33005b7794b0915d4e0 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 24 Nov 2009 09:01:48 +0100 Subject: tgsi: Account for gallium shader token representation changes. --- src/gallium/auxiliary/tgsi/tgsi_build.c | 166 +++++++++++++++----------------- src/gallium/auxiliary/tgsi/tgsi_build.h | 32 +++--- src/gallium/auxiliary/tgsi/tgsi_parse.c | 8 +- src/gallium/auxiliary/tgsi/tgsi_parse.h | 2 +- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 30 +++--- 5 files changed, 106 insertions(+), 132 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index 4fa10e2f7e..9791e58db3 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -419,6 +419,7 @@ tgsi_default_instruction( void ) instruction.NrTokens = 1; instruction.Opcode = TGSI_OPCODE_MOV; instruction.Saturate = TGSI_SAT_NONE; + instruction.Predicate = 0; instruction.NumDstRegs = 1; instruction.NumSrcRegs = 1; instruction.Padding = 0; @@ -428,12 +429,12 @@ tgsi_default_instruction( void ) } struct tgsi_instruction -tgsi_build_instruction( - unsigned opcode, - unsigned saturate, - unsigned num_dst_regs, - unsigned num_src_regs, - struct tgsi_header *header ) +tgsi_build_instruction(unsigned opcode, + unsigned saturate, + unsigned predicate, + unsigned num_dst_regs, + unsigned num_src_regs, + struct tgsi_header *header) { struct tgsi_instruction instruction; @@ -445,6 +446,7 @@ tgsi_build_instruction( instruction = tgsi_default_instruction(); instruction.Opcode = opcode; instruction.Saturate = saturate; + instruction.Predicate = predicate; instruction.NumDstRegs = num_dst_regs; instruction.NumSrcRegs = num_src_regs; @@ -472,9 +474,9 @@ tgsi_default_full_instruction( void ) unsigned i; full_instruction.Instruction = tgsi_default_instruction(); + full_instruction.InstructionPredicate = tgsi_default_instruction_predicate(); full_instruction.InstructionExtLabel = tgsi_default_instruction_ext_label(); full_instruction.InstructionExtTexture = tgsi_default_instruction_ext_texture(); - full_instruction.InstructionExtPredicate = tgsi_default_instruction_ext_predicate(); for( i = 0; i < TGSI_FULL_MAX_DST_REGISTERS; i++ ) { full_instruction.FullDstRegisters[i] = tgsi_default_full_dst_register(); } @@ -504,14 +506,34 @@ tgsi_build_full_instruction( instruction = (struct tgsi_instruction *) &tokens[size]; size++; - *instruction = tgsi_build_instruction( - full_inst->Instruction.Opcode, - full_inst->Instruction.Saturate, - full_inst->Instruction.NumDstRegs, - full_inst->Instruction.NumSrcRegs, - header ); + *instruction = tgsi_build_instruction(full_inst->Instruction.Opcode, + full_inst->Instruction.Saturate, + full_inst->Instruction.Predicate, + full_inst->Instruction.NumDstRegs, + full_inst->Instruction.NumSrcRegs, + header); prev_token = (struct tgsi_token *) instruction; + if (full_inst->Instruction.Predicate) { + struct tgsi_instruction_predicate *instruction_predicate; + + if (maxsize <= size) { + return 0; + } + instruction_predicate = (struct tgsi_instruction_predicate *)&tokens[size]; + size++; + + *instruction_predicate = + tgsi_build_instruction_predicate(full_inst->InstructionPredicate.Index, + full_inst->InstructionPredicate.Negate, + full_inst->InstructionPredicate.SwizzleX, + full_inst->InstructionPredicate.SwizzleY, + full_inst->InstructionPredicate.SwizzleZ, + full_inst->InstructionPredicate.SwizzleW, + instruction, + header); + } + if( tgsi_compare_instruction_ext_label( full_inst->InstructionExtLabel, tgsi_default_instruction_ext_label() ) ) { @@ -550,29 +572,6 @@ tgsi_build_full_instruction( prev_token = (struct tgsi_token *) instruction_ext_texture; } - if (tgsi_compare_instruction_ext_predicate(full_inst->InstructionExtPredicate, - tgsi_default_instruction_ext_predicate())) { - struct tgsi_instruction_ext_predicate *instruction_ext_predicate; - - if (maxsize <= size) { - return 0; - } - instruction_ext_predicate = (struct tgsi_instruction_ext_predicate *)&tokens[size]; - size++; - - *instruction_ext_predicate = - tgsi_build_instruction_ext_predicate(full_inst->InstructionExtPredicate.SrcIndex, - full_inst->InstructionExtPredicate.Negate, - full_inst->InstructionExtPredicate.SwizzleX, - full_inst->InstructionExtPredicate.SwizzleY, - full_inst->InstructionExtPredicate.SwizzleZ, - full_inst->InstructionExtPredicate.SwizzleW, - prev_token, - instruction, - header); - prev_token = (struct tgsi_token *)instruction_ext_predicate; - } - for( i = 0; i < full_inst->Instruction.NumDstRegs; i++ ) { const struct tgsi_full_dst_register *reg = &full_inst->FullDstRegisters[i]; struct tgsi_dst_register *dst_register; @@ -746,6 +745,47 @@ tgsi_build_full_instruction( return size; } +struct tgsi_instruction_predicate +tgsi_default_instruction_predicate(void) +{ + struct tgsi_instruction_predicate instruction_predicate; + + instruction_predicate.SwizzleX = TGSI_SWIZZLE_X; + instruction_predicate.SwizzleY = TGSI_SWIZZLE_Y; + instruction_predicate.SwizzleZ = TGSI_SWIZZLE_Z; + instruction_predicate.SwizzleW = TGSI_SWIZZLE_W; + instruction_predicate.Negate = 0; + instruction_predicate.Index = 0; + instruction_predicate.Padding = 0; + + return instruction_predicate; +} + +struct tgsi_instruction_predicate +tgsi_build_instruction_predicate(int index, + unsigned negate, + unsigned swizzleX, + unsigned swizzleY, + unsigned swizzleZ, + unsigned swizzleW, + struct tgsi_instruction *instruction, + struct tgsi_header *header) +{ + struct tgsi_instruction_predicate instruction_predicate; + + instruction_predicate = tgsi_default_instruction_predicate(); + instruction_predicate.SwizzleX = swizzleX; + instruction_predicate.SwizzleY = swizzleY; + instruction_predicate.SwizzleZ = swizzleZ; + instruction_predicate.SwizzleW = swizzleW; + instruction_predicate.Negate = negate; + instruction_predicate.Index = index; + + instruction_grow(instruction, header); + + return instruction_predicate; +} + /** test for inequality of 32-bit values pointed to by a and b */ static INLINE boolean compare32(const void *a, const void *b) @@ -835,60 +875,6 @@ tgsi_build_instruction_ext_texture( return instruction_ext_texture; } -struct tgsi_instruction_ext_predicate -tgsi_default_instruction_ext_predicate(void) -{ - struct tgsi_instruction_ext_predicate instruction_ext_predicate; - - instruction_ext_predicate.Type = TGSI_INSTRUCTION_EXT_TYPE_PREDICATE; - instruction_ext_predicate.SwizzleX = TGSI_SWIZZLE_X; - instruction_ext_predicate.SwizzleY = TGSI_SWIZZLE_Y; - instruction_ext_predicate.SwizzleZ = TGSI_SWIZZLE_Z; - instruction_ext_predicate.SwizzleW = TGSI_SWIZZLE_W; - instruction_ext_predicate.Negate = 0; - instruction_ext_predicate.SrcIndex = 0; - instruction_ext_predicate.Padding = 0; - instruction_ext_predicate.Extended = 0; - - return instruction_ext_predicate; -} - -unsigned -tgsi_compare_instruction_ext_predicate(struct tgsi_instruction_ext_predicate a, - struct tgsi_instruction_ext_predicate b) -{ - a.Padding = b.Padding = 0; - a.Extended = b.Extended = 0; - return compare32(&a, &b); -} - -struct tgsi_instruction_ext_predicate -tgsi_build_instruction_ext_predicate(unsigned index, - unsigned negate, - unsigned swizzleX, - unsigned swizzleY, - unsigned swizzleZ, - unsigned swizzleW, - struct tgsi_token *prev_token, - struct tgsi_instruction *instruction, - struct tgsi_header *header) -{ - struct tgsi_instruction_ext_predicate instruction_ext_predicate; - - instruction_ext_predicate = tgsi_default_instruction_ext_predicate(); - instruction_ext_predicate.SwizzleX = swizzleX; - instruction_ext_predicate.SwizzleY = swizzleY; - instruction_ext_predicate.SwizzleZ = swizzleZ; - instruction_ext_predicate.SwizzleW = swizzleW; - instruction_ext_predicate.Negate = negate; - instruction_ext_predicate.SrcIndex = index; - - prev_token->Extended = 1; - instruction_grow(instruction, header); - - return instruction_ext_predicate; -} - struct tgsi_src_register tgsi_default_src_register( void ) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.h b/src/gallium/auxiliary/tgsi/tgsi_build.h index 669712eb8f..0fe5f229d3 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.h +++ b/src/gallium/auxiliary/tgsi/tgsi_build.h @@ -143,6 +143,7 @@ struct tgsi_instruction tgsi_build_instruction( unsigned opcode, unsigned saturate, + unsigned predicate, unsigned num_dst_regs, unsigned num_src_regs, struct tgsi_header *header ); @@ -157,6 +158,19 @@ tgsi_build_full_instruction( struct tgsi_header *header, unsigned maxsize ); +struct tgsi_instruction_predicate +tgsi_default_instruction_predicate(void); + +struct tgsi_instruction_predicate +tgsi_build_instruction_predicate(int index, + unsigned negate, + unsigned swizzleX, + unsigned swizzleY, + unsigned swizzleZ, + unsigned swizzleW, + struct tgsi_instruction *instruction, + struct tgsi_header *header); + struct tgsi_instruction_ext_label tgsi_default_instruction_ext_label( void ); @@ -187,24 +201,6 @@ tgsi_build_instruction_ext_texture( struct tgsi_instruction *instruction, struct tgsi_header *header ); -struct tgsi_instruction_ext_predicate -tgsi_default_instruction_ext_predicate(void); - -unsigned -tgsi_compare_instruction_ext_predicate(struct tgsi_instruction_ext_predicate a, - struct tgsi_instruction_ext_predicate b); - -struct tgsi_instruction_ext_predicate -tgsi_build_instruction_ext_predicate(unsigned index, - unsigned negate, - unsigned swizzleX, - unsigned swizzleY, - unsigned swizzleZ, - unsigned swizzleW, - struct tgsi_token *prev_token, - struct tgsi_instruction *instruction, - struct tgsi_header *header); - struct tgsi_src_register tgsi_default_src_register( void ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c index 83f9df1183..9ca2993452 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.c +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c @@ -175,6 +175,10 @@ tgsi_parse_token( copy_token(&inst->Instruction, &token); extended = inst->Instruction.Extended; + if (inst->Instruction.Predicate) { + next_token(ctx, &inst->InstructionPredicate); + } + while( extended ) { struct tgsi_src_register_ext token; @@ -189,10 +193,6 @@ tgsi_parse_token( copy_token(&inst->InstructionExtTexture, &token); break; - case TGSI_INSTRUCTION_EXT_TYPE_PREDICATE: - copy_token(&inst->InstructionExtPredicate, &token); - break; - default: assert( 0 ); } diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h b/src/gallium/auxiliary/tgsi/tgsi_parse.h index 76f1676d85..cb4772ade8 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.h +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h @@ -80,9 +80,9 @@ struct tgsi_full_immediate struct tgsi_full_instruction { struct tgsi_instruction Instruction; + struct tgsi_instruction_predicate InstructionPredicate; struct tgsi_instruction_ext_label InstructionExtLabel; struct tgsi_instruction_ext_texture InstructionExtTexture; - struct tgsi_instruction_ext_predicate InstructionExtPredicate; struct tgsi_full_dst_register FullDstRegisters[TGSI_FULL_MAX_DST_REGISTERS]; struct tgsi_full_src_register FullSrcRegisters[TGSI_FULL_MAX_SRC_REGISTERS]; uint Flags; /**< user-defined usage */ diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 3f752e9352..61cd3bf407 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -47,9 +47,9 @@ union tgsi_any_token { struct tgsi_immediate imm; union tgsi_immediate_data imm_data; struct tgsi_instruction insn; + struct tgsi_instruction_predicate insn_predicate; struct tgsi_instruction_ext_label insn_ext_label; struct tgsi_instruction_ext_texture insn_ext_texture; - struct tgsi_instruction_ext_predicate insn_ext_predicate; struct tgsi_src_register src; struct tgsi_src_register_ext_mod src_ext_mod; struct tgsi_dimension dim; @@ -661,35 +661,27 @@ ureg_emit_insn(struct ureg_program *ureg, validate( opcode, num_dst, num_src ); out = get_tokens( ureg, DOMAIN_INSN, count ); - out[0].value = 0; - out[0].insn.Type = TGSI_TOKEN_TYPE_INSTRUCTION; - out[0].insn.NrTokens = 0; + out[0].insn = tgsi_default_instruction(); out[0].insn.Opcode = opcode; out[0].insn.Saturate = saturate; out[0].insn.NumDstRegs = num_dst; out[0].insn.NumSrcRegs = num_src; - out[0].insn.Padding = 0; result.insn_token = ureg->domain[DOMAIN_INSN].count - count; + result.extended_token = result.insn_token; if (predicate) { - out[0].insn.Extended = 1; - out[1].insn_ext_predicate = tgsi_default_instruction_ext_predicate(); - out[1].insn_ext_predicate.Negate = pred_negate; - out[1].insn_ext_predicate.SwizzleX = pred_swizzle_x; - out[1].insn_ext_predicate.SwizzleY = pred_swizzle_y; - out[1].insn_ext_predicate.SwizzleZ = pred_swizzle_z; - out[1].insn_ext_predicate.SwizzleW = pred_swizzle_w; - - result.extended_token = result.insn_token + 1; - } else { - out[0].insn.Extended = 0; - - result.extended_token = result.insn_token; + out[0].insn.Predicate = 1; + out[1].insn_predicate = tgsi_default_instruction_predicate(); + out[1].insn_predicate.Negate = pred_negate; + out[1].insn_predicate.SwizzleX = pred_swizzle_x; + out[1].insn_predicate.SwizzleY = pred_swizzle_y; + out[1].insn_predicate.SwizzleZ = pred_swizzle_z; + out[1].insn_predicate.SwizzleW = pred_swizzle_w; } ureg->nr_instructions++; - + return result; } -- cgit v1.2.3 From 59a70c364df03c34abc72bca2cdca8fae12d8f68 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 24 Nov 2009 09:02:29 +0100 Subject: tgsi: Add ureg_DECL_loop(). --- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 22 ++++++++++++++++++++++ src/gallium/auxiliary/tgsi/tgsi_ureg.h | 3 +++ 2 files changed, 25 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 61cd3bf407..5526a5d034 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -72,6 +72,7 @@ struct ureg_tokens { #define UREG_MAX_IMMEDIATE 32 #define UREG_MAX_TEMP 256 #define UREG_MAX_ADDR 2 +#define UREG_MAX_LOOP 1 #define UREG_MAX_PRED 1 #define DOMAIN_DECL 0 @@ -117,6 +118,7 @@ struct ureg_program unsigned nr_addrs; unsigned nr_preds; + unsigned nr_loops; unsigned nr_instructions; struct ureg_tokens domain[2]; @@ -417,6 +419,19 @@ struct ureg_dst ureg_DECL_address( struct ureg_program *ureg ) return ureg_dst_register( TGSI_FILE_ADDRESS, 0 ); } +/* Allocate a new loop register. + */ +struct ureg_dst +ureg_DECL_loop(struct ureg_program *ureg) +{ + if (ureg->nr_loops < UREG_MAX_LOOP) { + return ureg_dst_register(TGSI_FILE_LOOP, ureg->nr_loops++); + } + + assert(0); + return ureg_dst_register(TGSI_FILE_LOOP, 0); +} + /* Allocate a new predicate register. */ struct ureg_dst @@ -1015,6 +1030,13 @@ static void emit_decls( struct ureg_program *ureg ) 0, ureg->nr_addrs ); } + if (ureg->nr_loops) { + emit_decl_range(ureg, + TGSI_FILE_LOOP, + 0, + ureg->nr_loops); + } + if (ureg->nr_preds) { emit_decl_range(ureg, TGSI_FILE_PREDICATE, diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.h b/src/gallium/auxiliary/tgsi/tgsi_ureg.h index dae4291194..94cc70a208 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.h +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.h @@ -157,6 +157,9 @@ ureg_release_temporary( struct ureg_program *ureg, struct ureg_dst ureg_DECL_address( struct ureg_program * ); +struct ureg_dst +ureg_DECL_loop( struct ureg_program * ); + struct ureg_dst ureg_DECL_predicate(struct ureg_program *); -- cgit v1.2.3 From 0c54d76f3783091267cb18e6bd23697d024c95b2 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 24 Nov 2009 09:03:41 +0100 Subject: tgsi: Implement predicated instructions in exec. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 52 ++++++++++++++++++++++++++++++---- src/gallium/auxiliary/tgsi/tgsi_exec.h | 1 + 2 files changed, 48 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index af914f6d08..89740cee89 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -369,6 +369,7 @@ tgsi_exec_machine_create( void ) memset(mach, 0, sizeof(*mach)); mach->Addrs = &mach->Temps[TGSI_EXEC_TEMP_ADDR]; + mach->Predicates = &mach->Temps[TGSI_EXEC_TEMP_P0]; /* Setup constants. */ for( i = 0; i < 4; i++ ) { @@ -1194,10 +1195,10 @@ fetch_src_file_channel( assert(index->i[1] < TGSI_EXEC_NUM_PREDS); assert(index->i[2] < TGSI_EXEC_NUM_PREDS); assert(index->i[3] < TGSI_EXEC_NUM_PREDS); - chan->u[0] = mach->Addrs[0].xyzw[swizzle].u[0]; - chan->u[1] = mach->Addrs[0].xyzw[swizzle].u[1]; - chan->u[2] = mach->Addrs[0].xyzw[swizzle].u[2]; - chan->u[3] = mach->Addrs[0].xyzw[swizzle].u[3]; + chan->u[0] = mach->Predicates[0].xyzw[swizzle].u[0]; + chan->u[1] = mach->Predicates[0].xyzw[swizzle].u[1]; + chan->u[2] = mach->Predicates[0].xyzw[swizzle].u[2]; + chan->u[3] = mach->Predicates[0].xyzw[swizzle].u[3]; break; case TGSI_FILE_OUTPUT: @@ -1489,7 +1490,7 @@ store_dest( case TGSI_FILE_PREDICATE: index = reg->DstRegister.Index; assert(index < TGSI_EXEC_NUM_PREDS); - dst = &mach->Addrs[index].xyzw[chan_index]; + dst = &mach->Predicates[index].xyzw[chan_index]; break; default: @@ -1497,6 +1498,47 @@ store_dest( return; } + if (inst->Instruction.Predicate) { + uint swizzle; + union tgsi_exec_channel *pred; + + switch (chan_index) { + case CHAN_X: + swizzle = inst->InstructionPredicate.SwizzleX; + break; + case CHAN_Y: + swizzle = inst->InstructionPredicate.SwizzleY; + break; + case CHAN_Z: + swizzle = inst->InstructionPredicate.SwizzleZ; + break; + case CHAN_W: + swizzle = inst->InstructionPredicate.SwizzleW; + break; + default: + assert(0); + return; + } + + assert(inst->InstructionPredicate.Index == 0); + + pred = &mach->Predicates[inst->InstructionPredicate.Index].xyzw[swizzle]; + + if (inst->InstructionPredicate.Negate) { + for (i = 0; i < QUAD_SIZE; i++) { + if (pred->u[i]) { + execmask &= ~(1 << i); + } + } + } else { + for (i = 0; i < QUAD_SIZE; i++) { + if (!pred->u[i]) { + execmask &= ~(1 << i); + } + } + } + } + switch (inst->Instruction.Saturate) { case TGSI_SAT_NONE: for (i = 0; i < QUAD_SIZE; i++) diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h index 3dff69a505..fd94c1bc44 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.h +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h @@ -218,6 +218,7 @@ struct tgsi_exec_machine struct tgsi_exec_vector Outputs[PIPE_MAX_ATTRIBS]; struct tgsi_exec_vector *Addrs; + struct tgsi_exec_vector *Predicates; struct tgsi_sampler **Samplers; -- cgit v1.2.3 From 53d9b7d361915d6cf33b73017789e746342cc453 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 24 Nov 2009 11:17:16 +0100 Subject: mesa: Fix pointer arithmetic. --- src/mesa/main/texgetimage.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 008407210d..bd7cc8d278 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -554,7 +554,9 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, GLuint bw, bh; _mesa_get_format_block_size(texImage->TexFormat, &bw, &bh); for (i = 0; i < (texImage->Height + bh - 1) / bh; i++) { - memcpy(img + i * row_stride, texImage->Data + i * row_stride_stored, row_stride); + memcpy((GLubyte *)img + i * row_stride, + (GLubyte *)texImage->Data + i * row_stride_stored, + row_stride); } } -- cgit v1.2.3 From bae9ece685e3c10fc0118e99771845d15895a0cc Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 24 Nov 2009 11:22:03 +0100 Subject: slang: Fix allocation size. We don't need 16K+ to store a single pointer. --- src/mesa/shader/slang/slang_emit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index fe39b46dbb..99eb254cee 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -81,8 +81,8 @@ new_subroutine(slang_emit_info *emitInfo, GLuint *id) emitInfo->Subroutines = (struct gl_program **) _mesa_realloc(emitInfo->Subroutines, - n * sizeof(struct gl_program), - (n + 1) * sizeof(struct gl_program)); + n * sizeof(struct gl_program *), + (n + 1) * sizeof(struct gl_program *)); emitInfo->Subroutines[n] = ctx->Driver.NewProgram(ctx, emitInfo->prog->Target, 0); emitInfo->Subroutines[n]->Parameters = emitInfo->prog->Parameters; emitInfo->NumSubroutines++; -- cgit v1.2.3 From 3c46bbee1bb4f107d68addae472cf7bbc0976653 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 24 Nov 2009 11:58:01 +0100 Subject: tgsi: Document Declaration Semantic token and FACE semantic name. --- .../auxiliary/tgsi/tgsi-instruction-set.txt | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt index eb492076b7..080fd4c731 100644 --- a/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt +++ b/src/gallium/auxiliary/tgsi/tgsi-instruction-set.txt @@ -1129,3 +1129,35 @@ TGSI Instruction Specification target Label of target instruction. + +3 Other tokens +=============== + + +3.1 Declaration Semantic +------------------------- + + + Follows Declaration token if Semantic bit is set. + + Since its purpose is to link a shader with other stages of the pipeline, + it is valid to follow only those Declaration tokens that declare a register + either in INPUT or OUTPUT file. + + SemanticName field contains the semantic name of the register being declared. + There is no default value. + + SemanticIndex is an optional subscript that can be used to distinguish + different register declarations with the same semantic name. The default value + is 0. + + The meanings of the individual semantic names are explained in the following + sections. + + +3.1.1 FACE + + Valid only in a fragment shader INPUT declaration. + + FACE.x is negative when the primitive is back facing. FACE.x is positive + when the primitive is front facing. -- cgit v1.2.3 From 4509f3cbad2972b6fe4a722ed07904666122a759 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Nov 2009 20:48:12 +0000 Subject: st/xorg: use surface_copy for blits if available Even if its not available, we really want to be coalescing blit operations better. --- src/gallium/state_trackers/xorg/xorg_exa.c | 36 +++++++++++++++++++++++++++--- src/gallium/state_trackers/xorg/xorg_exa.h | 3 +++ 2 files changed, 36 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 3d83b5700d..3e2f4e8834 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -156,6 +156,8 @@ xorg_exa_common_done(struct exa_context *exa) exa->copy.src = NULL; exa->copy.dst = NULL; + pipe_surface_reference(&exa->copy.src_surface, NULL); + pipe_surface_reference(&exa->copy.dst_surface, NULL); exa->transform.has_src = FALSE; exa->transform.has_mask = FALSE; exa->has_solid_color = FALSE; @@ -438,6 +440,21 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, exa->copy.src = src_priv; exa->copy.dst = priv; + + if (exa->pipe->surface_copy) { + exa->copy.src_surface = + exa->scrn->get_tex_surface( exa->scrn, + exa->copy.src->tex, + 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_READ); + + exa->copy.dst_surface = + exa->scrn->get_tex_surface( exa->scrn, + exa->copy.dst->tex, + 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_WRITE ); + } + return exa->accel; } @@ -458,11 +475,24 @@ ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY, debug_assert(priv == exa->copy.dst); - renderer_copy_pixmap(exa->renderer, exa->copy.dst, dstX, dstY, - exa->copy.src, srcX, srcY, - width, height); + if (exa->copy.src_surface && exa->copy.dst_surface) { + /* XXX: consider exposing >1 box in surface_copy interface. + */ + exa->pipe->surface_copy( exa->pipe, + exa->copy.dst_surface, + dstX, dstY, + exa->copy.src_surface, + srcX, srcY, + width, height ); + } + else { + renderer_copy_pixmap(exa->renderer, exa->copy.dst, dstX, dstY, + exa->copy.src, srcX, srcY, + width, height); + } } + static Bool picture_check_formats(struct exa_pixmap_priv *pSrc, PicturePtr pSrcPicture) { diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h index 15cc29d662..a67dda65a5 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.h +++ b/src/gallium/state_trackers/xorg/xorg_exa.h @@ -37,6 +37,9 @@ struct exa_context struct { struct exa_pixmap_priv *src; struct exa_pixmap_priv *dst; + + struct pipe_surface *src_surface; + struct pipe_surface *dst_surface; } copy; }; -- cgit v1.2.3 From f1ce37f74aff4854071fe5740b055718b2c0c789 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Nov 2009 21:13:18 +0000 Subject: svga: cache textures as well as buffers --- src/gallium/drivers/svga/svga_screen_buffer.c | 12 ++- src/gallium/drivers/svga/svga_screen_cache.c | 93 +++++++++------- src/gallium/drivers/svga/svga_screen_cache.h | 21 ++-- src/gallium/drivers/svga/svga_screen_texture.c | 142 ++++++++++++++----------- src/gallium/drivers/svga/svga_screen_texture.h | 16 ++- 5 files changed, 167 insertions(+), 117 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_screen_buffer.c b/src/gallium/drivers/svga/svga_screen_buffer.c index 3b7811734e..101c7878bf 100644 --- a/src/gallium/drivers/svga/svga_screen_buffer.c +++ b/src/gallium/drivers/svga/svga_screen_buffer.c @@ -71,7 +71,10 @@ svga_buffer_create_host_surface(struct svga_screen *ss, sbuf->key.numFaces = 1; sbuf->key.numMipLevels = 1; + sbuf->key.cachable = 1; + SVGA_DBG(DEBUG_DMA, "surface_create for buffer sz %d\n", sbuf->base.size); + sbuf->handle = svga_screen_surface_create(ss, &sbuf->key); if(!sbuf->handle) return PIPE_ERROR_OUT_OF_MEMORY; @@ -82,7 +85,7 @@ svga_buffer_create_host_surface(struct svga_screen *ss, */ sbuf->hw.flags.discard = TRUE; - SVGA_DBG(DEBUG_DMA, " grab sid %p sz %d\n", sbuf->handle, sbuf->base.size); + SVGA_DBG(DEBUG_DMA, " --> got sid %p sz %d (buffer)\n", sbuf->handle, sbuf->base.size); } return PIPE_OK; @@ -776,12 +779,11 @@ svga_screen_buffer_wrap_surface(struct pipe_screen *screen, /* * We are not the creator of this surface and therefore we must not - * cache it for reuse. The caching code only caches SVGA3D_BUFFER surfaces - * so make sure this isn't one of those. + * cache it for reuse. Set the cacheable flag to zero in the key to + * prevent this. */ - - assert(format != SVGA3D_BUFFER); sbuf->key.format = format; + sbuf->key.cachable = 0; sws->surface_reference(sws, &sbuf->handle, srf); return buf; diff --git a/src/gallium/drivers/svga/svga_screen_cache.c b/src/gallium/drivers/svga/svga_screen_cache.c index 7360c1688b..65f5c07a72 100644 --- a/src/gallium/drivers/svga/svga_screen_cache.c +++ b/src/gallium/drivers/svga/svga_screen_cache.c @@ -24,6 +24,7 @@ **********************************************************/ #include "util/u_memory.h" +#include "util/u_hash.h" #include "svga_debug.h" #include "svga_winsys.h" @@ -36,24 +37,11 @@ /** * Compute the bucket for this key. - * - * We simply compute log2(width) for now, but */ static INLINE unsigned svga_screen_cache_bucket(const struct svga_host_surface_cache_key *key) { - unsigned bucket = 0; - unsigned size = key->size.width; - - while ((size >>= 1)) - ++bucket; - - if(key->flags & SVGA3D_SURFACE_HINT_INDEXBUFFER) - bucket += 32; - - assert(bucket < SVGA_HOST_SURFACE_CACHE_BUCKETS); - - return bucket; + return util_hash_crc32( key, sizeof key ) % SVGA_HOST_SURFACE_CACHE_BUCKETS; } @@ -69,6 +57,8 @@ svga_screen_cache_lookup(struct svga_screen *svgascreen, unsigned bucket; unsigned tries = 0; + assert(key->cachable); + bucket = svga_screen_cache_bucket(key); pipe_mutex_lock(cache->mutex); @@ -104,11 +94,9 @@ svga_screen_cache_lookup(struct svga_screen *svgascreen, pipe_mutex_unlock(cache->mutex); -#if 0 - _debug_printf("%s: cache %s after %u tries\n", __FUNCTION__, handle ? "hit" : "miss", tries); -#else - (void)tries; -#endif + if (SVGA_DEBUG & DEBUG_DMA) + debug_printf("%s: cache %s after %u tries\n", __FUNCTION__, + handle ? "hit" : "miss", tries); return handle; } @@ -128,6 +116,7 @@ svga_screen_cache_add(struct svga_screen *svgascreen, struct svga_host_surface_cache_entry *entry = NULL; struct svga_winsys_surface *handle = *p_handle; + assert(key->cachable); assert(handle); if(!handle) @@ -137,15 +126,15 @@ svga_screen_cache_add(struct svga_screen *svgascreen, pipe_mutex_lock(cache->mutex); if(!LIST_IS_EMPTY(&cache->empty)) { - /* use the first empty entry */ - entry = LIST_ENTRY(struct svga_host_surface_cache_entry, cache->empty.next, head); + /* use the first empty entry */ + entry = LIST_ENTRY(struct svga_host_surface_cache_entry, cache->empty.next, head); - LIST_DEL(&entry->head); - } + LIST_DEL(&entry->head); + } else if(!LIST_IS_EMPTY(&cache->unused)) { /* free the last used buffer and reuse its entry */ entry = LIST_ENTRY(struct svga_host_surface_cache_entry, cache->unused.prev, head); - SVGA_DBG(DEBUG_DMA, "unref sid %p\n", entry->handle); + SVGA_DBG(DEBUG_DMA, "unref sid %p (make space)\n", entry->handle); sws->surface_reference(sws, &entry->handle, NULL); LIST_DEL(&entry->bucket_head); @@ -161,7 +150,7 @@ svga_screen_cache_add(struct svga_screen *svgascreen, } else { /* Couldn't cache the buffer -- this really shouldn't happen */ - SVGA_DBG(DEBUG_DMA, "unref sid %p\n", handle); + SVGA_DBG(DEBUG_DMA, "unref sid %p (couldn't find space)\n", handle); sws->surface_reference(sws, &handle, NULL); } @@ -220,7 +209,7 @@ svga_screen_cache_cleanup(struct svga_screen *svgascreen) for(i = 0; i < SVGA_HOST_SURFACE_CACHE_SIZE; ++i) { if(cache->entries[i].handle) { - SVGA_DBG(DEBUG_DMA, "unref sid %p\n", cache->entries[i].handle); + SVGA_DBG(DEBUG_DMA, "unref sid %p (shutdown)\n", cache->entries[i].handle); sws->surface_reference(sws, &cache->entries[i].handle, NULL); } @@ -261,18 +250,42 @@ svga_screen_surface_create(struct svga_screen *svgascreen, { struct svga_winsys_screen *sws = svgascreen->sws; struct svga_winsys_surface *handle = NULL; + boolean cachable = SVGA_SURFACE_CACHE_ENABLED && key->cachable; + + SVGA_DBG(DEBUG_DMA, "%s sz %dx%dx%d mips %d faces %d cachable %d\n", + __FUNCTION__, + key->size.width, + key->size.height, + key->size.depth, + key->numMipLevels, + key->numFaces, + key->cachable); + + if (cachable) { + if (key->format == SVGA3D_BUFFER) { + /* For buffers, round the buffer size up to the nearest power + * of two to increase the probability of cache hits. Keep + * texture surface dimensions unchanged. + */ + uint32_t size = 1; + while(size < key->size.width) + size <<= 1; + key->size.width = size; + } - if (SVGA_SURFACE_CACHE_ENABLED && key->format == SVGA3D_BUFFER) { - /* round the buffer size up to the nearest power of two to increase the - * probability of cache hits */ - uint32_t size = 1; - while(size < key->size.width) - size <<= 1; - key->size.width = size; - handle = svga_screen_cache_lookup(svgascreen, key); - if (handle) - SVGA_DBG(DEBUG_DMA, " reuse sid %p sz %d\n", handle, size); + if (handle) { + if (key->format == SVGA3D_BUFFER) + SVGA_DBG(DEBUG_DMA, " reuse sid %p sz %d (buffer)\n", handle, + key->size.width); + else + SVGA_DBG(DEBUG_DMA, " reuse sid %p sz %dx%dx%d mips %d faces %d\n", handle, + key->size.width, + key->size.height, + key->size.depth, + key->numMipLevels, + key->numFaces); + } } if (!handle) { @@ -297,11 +310,15 @@ svga_screen_surface_destroy(struct svga_screen *svgascreen, { struct svga_winsys_screen *sws = svgascreen->sws; - if(SVGA_SURFACE_CACHE_ENABLED && key->format == SVGA3D_BUFFER) { + /* We only set the cachable flag for surfaces of which we are the + * exclusive owner. So just hold onto our existing reference in + * that case. + */ + if(SVGA_SURFACE_CACHE_ENABLED && key->cachable) { svga_screen_cache_add(svgascreen, key, p_handle); } else { - SVGA_DBG(DEBUG_DMA, "unref sid %p\n", *p_handle); + SVGA_DBG(DEBUG_DMA, "unref sid %p (uncachable)\n", *p_handle); sws->surface_reference(sws, p_handle, NULL); } } diff --git a/src/gallium/drivers/svga/svga_screen_cache.h b/src/gallium/drivers/svga/svga_screen_cache.h index 1bbe987768..b745769848 100644 --- a/src/gallium/drivers/svga/svga_screen_cache.h +++ b/src/gallium/drivers/svga/svga_screen_cache.h @@ -36,10 +36,18 @@ #include "util/u_double_list.h" -/* TODO: Reduce this once we don't allocate an index buffer per draw call */ +/* Guess the storage size of cached surfaces and try and keep it under + * this amount: + */ +#define SVGA_HOST_SURFACE_CACHE_BYTES 16*1024*1024 + +/* Maximum number of discrete surfaces in the cache: + */ #define SVGA_HOST_SURFACE_CACHE_SIZE 1024 -#define SVGA_HOST_SURFACE_CACHE_BUCKETS 64 +/* Number of hash buckets: + */ +#define SVGA_HOST_SURFACE_CACHE_BUCKETS 256 struct svga_winsys_surface; @@ -50,11 +58,12 @@ struct svga_screen; */ struct svga_host_surface_cache_key { - SVGA3dSurfaceFlags flags; - SVGA3dSurfaceFormat format; SVGA3dSize size; - uint32_t numFaces; - uint32_t numMipLevels; + uint32_t flags:8; + uint32_t format:8; + uint32_t numFaces:8; + uint32_t numMipLevels:7; + uint32_t cachable:1; /* False if this is a shared surface */ }; diff --git a/src/gallium/drivers/svga/svga_screen_texture.c b/src/gallium/drivers/svga/svga_screen_texture.c index 8472dea04d..158a1e108d 100644 --- a/src/gallium/drivers/svga/svga_screen_texture.c +++ b/src/gallium/drivers/svga/svga_screen_texture.c @@ -266,14 +266,8 @@ svga_texture_create(struct pipe_screen *screen, const struct pipe_texture *templat) { struct svga_screen *svgascreen = svga_screen(screen); - struct svga_winsys_screen *sws = svgascreen->sws; struct svga_texture *tex = CALLOC_STRUCT(svga_texture); unsigned width, height, depth; - SVGA3dSurfaceFlags flags = 0; - SVGA3dSurfaceFormat format; - SVGA3dSize size; - uint32 numFaces; - uint32 numMipLevels; unsigned level; if (!tex) @@ -301,23 +295,24 @@ svga_texture_create(struct pipe_screen *screen, depth = minify(depth); } - size.width = templat->width[0]; - size.height = templat->height[0]; - size.depth = templat->depth[0]; + tex->key.flags = 0; + tex->key.size.width = templat->width[0]; + tex->key.size.height = templat->height[0]; + tex->key.size.depth = templat->depth[0]; if(templat->target == PIPE_TEXTURE_CUBE) { - flags |= SVGA3D_SURFACE_CUBEMAP; - numFaces = 6; + tex->key.flags |= SVGA3D_SURFACE_CUBEMAP; + tex->key.numFaces = 6; } else { - numFaces = 1; + tex->key.numFaces = 1; } if(templat->tex_usage & PIPE_TEXTURE_USAGE_SAMPLER) - flags |= SVGA3D_SURFACE_HINT_TEXTURE; + tex->key.flags |= SVGA3D_SURFACE_HINT_TEXTURE; if(templat->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY) - flags |= SVGA3D_SURFACE_HINT_SCANOUT; + tex->key.flags |= SVGA3D_SURFACE_HINT_SCANOUT; /* * XXX: Never pass the SVGA3D_SURFACE_HINT_RENDERTARGET hint. Mesa cannot @@ -328,21 +323,24 @@ svga_texture_create(struct pipe_screen *screen, #if 0 if((templat->tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) && !pf_is_compressed(templat->format)) - flags |= SVGA3D_SURFACE_HINT_RENDERTARGET; + tex->key.flags |= SVGA3D_SURFACE_HINT_RENDERTARGET; #endif if(templat->tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) - flags |= SVGA3D_SURFACE_HINT_DEPTHSTENCIL; + tex->key.flags |= SVGA3D_SURFACE_HINT_DEPTHSTENCIL; - numMipLevels = templat->last_level + 1; + tex->key.numMipLevels = templat->last_level + 1; - format = svga_translate_format(templat->format); - if(format == SVGA3D_FORMAT_INVALID) + tex->key.format = svga_translate_format(templat->format); + if(tex->key.format == SVGA3D_FORMAT_INVALID) goto error2; + + tex->key.cachable = 1; - tex->handle = sws->surface_create(sws, flags, format, size, numFaces, numMipLevels); + SVGA_DBG(DEBUG_DMA, "surface_create for texture\n", tex->handle); + tex->handle = svga_screen_surface_create(svgascreen, &tex->key); if (tex->handle) - SVGA_DBG(DEBUG_DMA, "create sid %p (texture)\n", tex->handle); + SVGA_DBG(DEBUG_DMA, " --> got sid %p (texture)\n", tex->handle); return &tex->base; @@ -398,6 +396,10 @@ svga_texture_blanket(struct pipe_screen * screen, return NULL; tex->base = *base; + + /* We don't own this storage, so don't try to cache it. + */ + tex->key.cachable = 0; if (sbuf->key.format == 1) tex->base.format = PIPE_FORMAT_X8R8G8B8_UNORM; @@ -407,6 +409,7 @@ svga_texture_blanket(struct pipe_screen * screen, pipe_reference_init(&tex->base.reference, 1); tex->base.screen = screen; + SVGA_DBG(DEBUG_DMA, "blanket sid %p\n", sbuf->handle); sws->surface_reference(sws, &tex->handle, sbuf->handle); return &tex->base; @@ -427,7 +430,7 @@ svga_texture_destroy(struct pipe_texture *pt) DBG("%s deleting %p\n", __FUNCTION__, (void *) tex); */ SVGA_DBG(DEBUG_DMA, "unref sid %p (texture)\n", tex->handle); - ss->sws->surface_reference(ss->sws, &tex->handle, NULL); + svga_screen_surface_destroy(ss, &tex->key, &tex->handle); FREE(tex); } @@ -518,43 +521,43 @@ svga_texture_view_surface(struct pipe_context *pipe, unsigned start_mip, unsigned num_mip, int face_pick, - int zslice_pick) + int zslice_pick, + struct svga_host_surface_cache_key *key) /* OUT */ { struct svga_screen *ss = svga_screen(tex->base.screen); - struct svga_winsys_screen *sws = ss->sws; struct svga_winsys_surface *handle; int i, j; - SVGA3dSurfaceFlags flags = 0; - SVGA3dSize size; - uint32 numFaces; - uint32 numMipLevels = num_mip; unsigned z_offset = 0; SVGA_DBG(DEBUG_PERF, "svga: Create surface view: face %d zslice %d mips %d..%d\n", face_pick, zslice_pick, start_mip, start_mip+num_mip-1); - size.width = tex->base.width[start_mip]; - size.height = tex->base.height[start_mip]; - size.depth = zslice_pick < 0 ? tex->base.depth[start_mip] : 1; - assert(size.depth == 1); + key->flags = 0; + key->format = format; + key->numMipLevels = num_mip; + key->size.width = tex->base.width[start_mip]; + key->size.height = tex->base.height[start_mip]; + key->size.depth = zslice_pick < 0 ? tex->base.depth[start_mip] : 1; + key->cachable = 1; + assert(key->size.depth == 1); if(tex->base.target == PIPE_TEXTURE_CUBE && face_pick < 0) { - flags |= SVGA3D_SURFACE_CUBEMAP; - numFaces = 6; + key->flags |= SVGA3D_SURFACE_CUBEMAP; + key->numFaces = 6; } else { - numFaces = 1; + key->numFaces = 1; } - if(format == SVGA3D_FORMAT_INVALID) + if(key->format == SVGA3D_FORMAT_INVALID) return NULL; - handle = sws->surface_create(sws, flags, format, size, numFaces, numMipLevels); - + SVGA_DBG(DEBUG_DMA, "surface_create for texture view\n", handle); + handle = svga_screen_surface_create(ss, key); if (!handle) return NULL; - SVGA_DBG(DEBUG_DMA, "create sid %p (texture view)\n", handle); + SVGA_DBG(DEBUG_DMA, " --> got sid %p (texture view)\n", handle); if (face_pick < 0) face_pick = 0; @@ -562,14 +565,20 @@ svga_texture_view_surface(struct pipe_context *pipe, if (zslice_pick >= 0) z_offset = zslice_pick; - for (i = 0; i < num_mip; i++) { - for (j = 0; j < numFaces; j++) { + for (i = 0; i < key->numMipLevels; i++) { + for (j = 0; j < key->numFaces; j++) { if(tex->defined[j + face_pick][i + start_mip]) { unsigned depth = zslice_pick < 0 ? tex->base.depth[i + start_mip] : 1; - svga_texture_copy_handle(svga_context(pipe), ss, - tex->handle, 0, 0, z_offset, i + start_mip, j + face_pick, + svga_texture_copy_handle(svga_context(pipe), + ss, + tex->handle, + 0, 0, z_offset, + i + start_mip, + j + face_pick, handle, 0, 0, 0, i, j, - tex->base.width[i + start_mip], tex->base.height[i + start_mip], depth); + tex->base.width[i + start_mip], + tex->base.height[i + start_mip], + depth); } } } @@ -586,25 +595,23 @@ svga_get_tex_surface(struct pipe_screen *screen, { struct svga_texture *tex = svga_texture(pt); struct svga_surface *s; - struct pipe_surface *ps; boolean render = flags & PIPE_BUFFER_USAGE_GPU_WRITE ? TRUE : FALSE; boolean view = FALSE; SVGA3dSurfaceFormat format; s = CALLOC_STRUCT(svga_surface); - ps = &s->base; - if (!ps) + if (!s) return NULL; - pipe_reference_init(&ps->reference, 1); - pipe_texture_reference(&ps->texture, pt); - ps->format = pt->format; - ps->width = pt->width[level]; - ps->height = pt->height[level]; - ps->usage = flags; - ps->level = level; - ps->face = face; - ps->zslice = zslice; + pipe_reference_init(&s->base.reference, 1); + pipe_texture_reference(&s->base.texture, pt); + s->base.format = pt->format; + s->base.width = pt->width[level]; + s->base.height = pt->height[level]; + s->base.usage = flags; + s->base.level = level; + s->base.face = face; + s->base.zslice = zslice; if (!render) format = svga_translate_format(pt->format); @@ -619,11 +626,13 @@ svga_get_tex_surface(struct pipe_screen *screen, view = TRUE; /* Currently only used for compressed textures */ - if (render && (format != svga_translate_format(pt->format))) { + if (render && + format != svga_translate_format(pt->format)) { view = TRUE; } - if (level != 0 && svga_screen(screen)->debug.force_level_surface_view) + if (level != 0 && + svga_screen(screen)->debug.force_level_surface_view) view = TRUE; if (pt->target == PIPE_TEXTURE_3D) @@ -634,9 +643,10 @@ svga_get_tex_surface(struct pipe_screen *screen, if (view) { SVGA_DBG(DEBUG_VIEWS, "svga: Surface view: yes %p, level %u face %u z %u, %p\n", - pt, level, face, zslice, ps); + pt, level, face, zslice, s); - s->handle = svga_texture_view_surface(NULL, tex, format, level, 1, face, zslice); + s->handle = svga_texture_view_surface(NULL, tex, format, level, 1, face, zslice, + &s->key); s->real_face = 0; s->real_level = 0; s->real_zslice = 0; @@ -644,15 +654,16 @@ svga_get_tex_surface(struct pipe_screen *screen, struct svga_winsys_screen *sws = svga_winsys_screen(screen); SVGA_DBG(DEBUG_VIEWS, "svga: Surface view: no %p, level %u, face %u, z %u, %p\n", - pt, level, face, zslice, ps); + pt, level, face, zslice, s); sws->surface_reference(sws, &s->handle, tex->handle); s->real_face = face; s->real_level = level; s->real_zslice = zslice; + memset(&s->key, 0, sizeof s->key); } - return ps; + return &s->base; } @@ -663,7 +674,7 @@ svga_tex_surface_destroy(struct pipe_surface *surf) struct svga_screen *ss = svga_screen(surf->texture->screen); SVGA_DBG(DEBUG_DMA, "unref sid %p (tex surface)\n", s->handle); - ss->sws->surface_reference(ss->sws, &s->handle, NULL); + svga_screen_surface_destroy(ss, &s->key, &s->handle); pipe_texture_reference(&surf->texture, NULL); FREE(surf); } @@ -974,7 +985,8 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt, sv->handle = svga_texture_view_surface(pipe, tex, format, min_lod, max_lod - min_lod + 1, - -1, -1); + -1, -1, + &sv->key); if (!sv->handle) { assert(0); @@ -1030,7 +1042,7 @@ svga_destroy_sampler_view_priv(struct svga_sampler_view *v) struct svga_screen *ss = svga_screen(v->texture->base.screen); SVGA_DBG(DEBUG_DMA, "unref sid %p (sampler view)\n", v->handle); - ss->sws->surface_reference(ss->sws, &v->handle, NULL); + svga_screen_surface_destroy(ss, &v->key, &v->handle); FREE(v); } diff --git a/src/gallium/drivers/svga/svga_screen_texture.h b/src/gallium/drivers/svga/svga_screen_texture.h index 1e6fef59a3..1cc4063e65 100644 --- a/src/gallium/drivers/svga/svga_screen_texture.h +++ b/src/gallium/drivers/svga/svga_screen_texture.h @@ -29,7 +29,7 @@ #include "pipe/p_compiler.h" #include "pipe/p_state.h" - +#include "svga_screen_cache.h" struct pipe_context; struct pipe_screen; @@ -68,6 +68,7 @@ struct svga_sampler_view unsigned age; + struct svga_host_surface_cache_key key; struct svga_winsys_surface *handle; }; @@ -76,8 +77,6 @@ struct svga_texture { struct pipe_texture base; - struct svga_winsys_surface *handle; - boolean defined[6][PIPE_MAX_TEXTURE_LEVELS]; struct svga_sampler_view *cached_view; @@ -86,6 +85,16 @@ struct svga_texture unsigned age; boolean views_modified; + + /** + * Creation key for the host surface handle. + * + * This structure describes all the host surface characteristics so that it + * can be looked up in cache, since creating a host surface is often a slow + * operation. + */ + struct svga_host_surface_cache_key key; + struct svga_winsys_surface *handle; }; @@ -93,6 +102,7 @@ struct svga_surface { struct pipe_surface base; + struct svga_host_surface_cache_key key; struct svga_winsys_surface *handle; unsigned real_face; -- cgit v1.2.3 From f895abbd9777c4985aa40cf660c68f6d7333f0ec Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Nov 2009 00:18:49 -0500 Subject: glu/sgi: Fix memory leak in gluBuild3DMipmapLevelsCore. --- src/glu/sgi/libutil/mipmap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c index a5d07a59cf..22d702291f 100644 --- a/src/glu/sgi/libutil/mipmap.c +++ b/src/glu/sgi/libutil/mipmap.c @@ -8098,6 +8098,7 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); glPixelStorei(GL_UNPACK_SKIP_IMAGES, psm.unpack_skip_images); glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, psm.unpack_image_height); + free(srcImage); return GLU_OUT_OF_MEMORY; } /* level userLevel+1 is in srcImage; level userLevel already saved */ -- cgit v1.2.3 From 0d89f3dc7ff3f89ba8d5d664253730485bca35e2 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Nov 2009 00:28:56 -0500 Subject: glu/sgi: Fix memory leak in gluBuild2DMipmapLevelsCore. --- src/glu/sgi/libutil/mipmap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c index 22d702291f..796be0aad3 100644 --- a/src/glu/sgi/libutil/mipmap.c +++ b/src/glu/sgi/libutil/mipmap.c @@ -4349,6 +4349,7 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels); glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + free(srcImage); return GLU_OUT_OF_MEMORY; } } -- cgit v1.2.3 From 94bcb9f1a43f2ab3bdff09156e3ab5b1c115cbd8 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Nov 2009 00:39:37 -0500 Subject: glu/sgi: Fix memory leak in gluBuild1DMipmapLevelsCore. --- src/glu/sgi/libutil/mipmap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c index 796be0aad3..bf6eaf88c6 100644 --- a/src/glu/sgi/libutil/mipmap.c +++ b/src/glu/sgi/libutil/mipmap.c @@ -3608,6 +3608,7 @@ int gluBuild1DMipmapLevelsCore(GLenum target, GLint internalFormat, glPixelStorei(GL_UNPACK_SKIP_PIXELS,psm.unpack_skip_pixels); glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + free(newImage); return GLU_OUT_OF_MEMORY; } } -- cgit v1.2.3 From 92c6a26a8a0f6ce540fe7c9681fb9a30b0da9e5f Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 25 Nov 2009 20:23:22 +1000 Subject: radeon: fix context destroy needing lock for flushing. Thanks to Intel code which I've just stolen pretty much as usual. This fixes fdo bug 22851 which is a dri1 regression since rewrite. Tested by: fpiobaf (Fabio) on #radeon Signed-off-by: Dave Airlie --- src/mesa/drivers/dri/radeon/radeon_lock.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_lock.c b/src/mesa/drivers/dri/radeon/radeon_lock.c index 02de8e5fd1..7ad781ba61 100644 --- a/src/mesa/drivers/dri/radeon/radeon_lock.c +++ b/src/mesa/drivers/dri/radeon/radeon_lock.c @@ -62,8 +62,6 @@ void radeonGetLock(radeonContextPtr rmesa, GLuint flags) __DRIdrawablePrivate *const readable = radeon_get_readable(rmesa); __DRIscreenPrivate *sPriv = rmesa->dri.screen; - assert(drawable != NULL); - drmGetLock(rmesa->dri.fd, rmesa->dri.hwContext, flags); /* The window might have moved, so we might need to get new clip @@ -74,12 +72,13 @@ void radeonGetLock(radeonContextPtr rmesa, GLuint flags) * Since the hardware state depends on having the latest drawable * clip rects, all state checking must be done _after_ this call. */ - DRI_VALIDATE_DRAWABLE_INFO(sPriv, drawable); - if (drawable != readable) { + if (drawable) + DRI_VALIDATE_DRAWABLE_INFO(sPriv, drawable); + if (readable && drawable != readable) { DRI_VALIDATE_DRAWABLE_INFO(sPriv, readable); } - if (rmesa->lastStamp != drawable->lastStamp) { + if (drawable && (rmesa->lastStamp != drawable->lastStamp)) { radeon_window_moved(rmesa); rmesa->lastStamp = drawable->lastStamp; } -- cgit v1.2.3 From 55b0157860af0eb957262cb0d22ab47eccd85940 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 25 Nov 2009 11:44:41 +0000 Subject: svga: revert packing of surface key Over-ambitious packing of values broke my cursor. --- src/gallium/drivers/svga/svga_screen_cache.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_screen_cache.h b/src/gallium/drivers/svga/svga_screen_cache.h index b745769848..f5aa740d40 100644 --- a/src/gallium/drivers/svga/svga_screen_cache.h +++ b/src/gallium/drivers/svga/svga_screen_cache.h @@ -58,10 +58,10 @@ struct svga_screen; */ struct svga_host_surface_cache_key { + SVGA3dSurfaceFlags flags; + SVGA3dSurfaceFormat format; SVGA3dSize size; - uint32_t flags:8; - uint32_t format:8; - uint32_t numFaces:8; + uint32_t numFaces:24; uint32_t numMipLevels:7; uint32_t cachable:1; /* False if this is a shared surface */ }; -- cgit v1.2.3 From d228e3cc8e7b6a3d4c6d554c5d9aed5e26be7ff0 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Sun, 22 Nov 2009 15:21:14 -0500 Subject: util: also print out memory statistics --- src/gallium/auxiliary/util/u_mm.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_mm.c b/src/gallium/auxiliary/util/u_mm.c index 4b75d4ba1d..82f83702d1 100644 --- a/src/gallium/auxiliary/util/u_mm.c +++ b/src/gallium/auxiliary/util/u_mm.c @@ -39,13 +39,20 @@ u_mmDumpMemInfo(const struct mem_block *heap) } else { const struct mem_block *p; + int total_used = 0, total_free = 0; for (p = heap->next; p != heap; p = p->next) { debug_printf(" Offset:%08x, Size:%08x, %c%c\n", p->ofs, p->size, p->free ? 'F':'.', p->reserved ? 'R':'.'); + if (p->free) + total_free += p->size; + else + total_used += p->size; } + debug_printf("'\nMemory stats: total = %d, used = %d, free = %d\n", + total_used + total_free, total_used, total_free); debug_printf("\nFree list:\n"); for (p = heap->next_free; p != heap; p = p->next_free) { -- cgit v1.2.3 From c712f3374626d96f9c08c3571a5572bcee60a5f2 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Mon, 23 Nov 2009 01:00:34 -0500 Subject: st/xorg: accelerate src luminance --- src/gallium/state_trackers/xorg/xorg_composite.c | 24 ++++++++++++----- src/gallium/state_trackers/xorg/xorg_exa.c | 2 -- src/gallium/state_trackers/xorg/xorg_exa_tgsi.c | 33 +++++++++++++++--------- 3 files changed, 38 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 4dbb490ca5..f16816b2a7 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -232,15 +232,25 @@ bind_blend_state(struct exa_context *exa, int op, } static unsigned -picture_format_fixups(struct exa_pixmap_priv *pSrc, PicturePtr pSrcPicture, boolean mask) +picture_format_fixups(struct exa_pixmap_priv *pSrc, PicturePtr pSrcPicture, boolean mask, + PicturePtr pDstPicture) { boolean set_alpha = FALSE; boolean swizzle = FALSE; unsigned ret = 0; if (pSrc->picture_format == pSrcPicture->format) { - if (pSrc->picture_format == PICT_a8) - return mask ? FS_MASK_LUMINANCE : FS_SRC_LUMINANCE; + if (pSrc->picture_format == PICT_a8) { + if (mask) + return FS_MASK_LUMINANCE; + else if (pDstPicture->format != PICT_a8) { + /* if both dst and src are luminance then + * we don't want to swizzle the alpha (X) of the + * source into W component of the dst because + * it will break our destination */ + return FS_SRC_LUMINANCE; + } + } return 0; } @@ -285,7 +295,7 @@ picture_format_fixups(struct exa_pixmap_priv *pSrc, PicturePtr pSrcPicture, bool static void bind_shaders(struct exa_context *exa, int op, - PicturePtr pSrcPicture, PicturePtr pMaskPicture, + PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture, struct exa_pixmap_priv *pSrc, struct exa_pixmap_priv *pMask) { unsigned vs_traits = 0, fs_traits = 0; @@ -313,7 +323,7 @@ bind_shaders(struct exa_context *exa, int op, vs_traits |= VS_COMPOSITE; } - fs_traits |= picture_format_fixups(pSrc, pSrcPicture, FALSE); + fs_traits |= picture_format_fixups(pSrc, pSrcPicture, FALSE, pDstPicture); } if (pMaskPicture) { @@ -331,7 +341,7 @@ bind_shaders(struct exa_context *exa, int op, fs_traits |= FS_CA_FULL; } - fs_traits |= picture_format_fixups(pMask, pMaskPicture, TRUE); + fs_traits |= picture_format_fixups(pMask, pMaskPicture, TRUE, pDstPicture); } shader = xorg_shaders_get(exa->renderer->shaders, vs_traits, fs_traits); @@ -497,7 +507,7 @@ boolean xorg_composite_bind_state(struct exa_context *exa, renderer_bind_viewport(exa->renderer, pDst); bind_blend_state(exa, op, pSrcPicture, pMaskPicture, pDstPicture); renderer_bind_rasterizer(exa->renderer); - bind_shaders(exa, op, pSrcPicture, pMaskPicture, pSrc, pMask); + bind_shaders(exa, op, pSrcPicture, pMaskPicture, pDstPicture, pSrc, pMask); bind_samplers(exa, op, pSrcPicture, pMaskPicture, pDstPicture, pSrc, pMask, pDst); setup_constant_buffers(exa, pDst); diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 3e2f4e8834..aa04586455 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -578,8 +578,6 @@ ExaPrepareComposite(int op, PicturePtr pSrcPicture, render_format_name(priv->picture_format), render_format_name(pSrcPicture->format)); - if (priv->picture_format == PICT_a8) - XORG_FALLBACK("pSrc pic_format == PICT_a8"); } if (pMask) { diff --git a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c index 3bf64b6331..13a9840bdd 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c +++ b/src/gallium/state_trackers/xorg/xorg_exa_tgsi.c @@ -396,15 +396,11 @@ xrender_tex(struct ureg_program *ureg, struct ureg_dst dst, struct ureg_src coords, struct ureg_src sampler, + struct ureg_src imm0, boolean repeat_none, boolean swizzle, boolean set_alpha) { - struct ureg_src imm0 = { 0 }; - - if (repeat_none || set_alpha) - imm0 = ureg_imm4f(ureg, 0, 0, 0, 1); - if (repeat_none) { struct ureg_dst tmp0 = ureg_DECL_temporary(ureg); struct ureg_dst tmp1 = ureg_DECL_temporary(ureg); @@ -466,6 +462,7 @@ create_fs(struct pipe_context *pipe, struct ureg_src /*dst_pos,*/ src_input, mask_pos; struct ureg_dst src, mask; struct ureg_dst out; + struct ureg_src imm0 = { 0 }; unsigned has_mask = (fs_traits & FS_MASK) != 0; unsigned is_fill = (fs_traits & FS_FILL) != 0; unsigned is_composite = (fs_traits & FS_COMPOSITE) != 0; @@ -483,8 +480,6 @@ create_fs(struct pipe_context *pipe, unsigned src_luminance = (fs_traits & FS_SRC_LUMINANCE) != 0; unsigned mask_luminance = (fs_traits & FS_MASK_LUMINANCE) != 0; - if (src_luminance) - assert(!"src_luminance not supported"); #if 0 print_fs_traits(fs_traits); #else @@ -502,6 +497,11 @@ create_fs(struct pipe_context *pipe, TGSI_SEMANTIC_COLOR, 0); + if (src_repeat_none || mask_repeat_none || + src_set_alpha || mask_set_alpha || + src_luminance) { + imm0 = ureg_imm4f(ureg, 0, 0, 0, 1); + } if (is_composite) { src_sampler = ureg_DECL_sampler(ureg, 0); src_input = ureg_DECL_fs_input(ureg, @@ -540,16 +540,17 @@ create_fs(struct pipe_context *pipe, TGSI_INTERPOLATE_PERSPECTIVE); #endif + if (is_composite) { - if (has_mask) + if (has_mask || src_luminance) src = ureg_DECL_temporary(ureg); else src = out; - xrender_tex(ureg, src, src_input, src_sampler, + xrender_tex(ureg, src, src_input, src_sampler, imm0, src_repeat_none, src_swizzle, src_set_alpha); } else if (is_fill) { if (is_solid) { - if (has_mask) + if (has_mask || src_luminance) src = ureg_dst(src_input); else ureg_MOV(ureg, out, src_input); @@ -557,7 +558,7 @@ create_fs(struct pipe_context *pipe, struct ureg_src coords, const0124, matrow0, matrow1, matrow2; - if (has_mask) + if (has_mask || src_luminance) src = ureg_DECL_temporary(ureg); else src = out; @@ -582,10 +583,18 @@ create_fs(struct pipe_context *pipe, } else debug_assert(!"Unknown fill type!"); } + if (src_luminance) { + ureg_MOV(ureg, src, + ureg_scalar(ureg_src(src), TGSI_SWIZZLE_X)); + ureg_MOV(ureg, ureg_writemask(src, TGSI_WRITEMASK_XYZ), + ureg_scalar(imm0, TGSI_SWIZZLE_X)); + if (!has_mask) + ureg_MOV(ureg, out, ureg_src(src)); + } if (has_mask) { mask = ureg_DECL_temporary(ureg); - xrender_tex(ureg, mask, mask_pos, mask_sampler, + xrender_tex(ureg, mask, mask_pos, mask_sampler, imm0, mask_repeat_none, mask_swizzle, mask_set_alpha); /* src IN mask */ src_in_mask(ureg, out, ureg_src(src), ureg_src(mask), -- cgit v1.2.3 From 2946aea110beda9c2e0382507b0dba7c508ff5eb Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 25 Nov 2009 17:13:04 +0000 Subject: svga: try harder to make the cachable flag work It doesn't though. --- src/gallium/drivers/svga/svga_screen_buffer.c | 2 ++ src/gallium/drivers/svga/svga_screen_texture.c | 23 +++++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_screen_buffer.c b/src/gallium/drivers/svga/svga_screen_buffer.c index 101c7878bf..c0b0f518bc 100644 --- a/src/gallium/drivers/svga/svga_screen_buffer.c +++ b/src/gallium/drivers/svga/svga_screen_buffer.c @@ -796,6 +796,8 @@ svga_screen_buffer_get_winsys_surface(struct pipe_buffer *buffer) struct svga_winsys_screen *sws = svga_winsys_screen(buffer->screen); struct svga_winsys_surface *vsurf = NULL; + assert(svga_buffer(buffer)->key.cachable == 0); + svga_buffer(buffer)->key.cachable = 0; sws->surface_reference(sws, &vsurf, svga_buffer(buffer)->handle); return vsurf; } diff --git a/src/gallium/drivers/svga/svga_screen_texture.c b/src/gallium/drivers/svga/svga_screen_texture.c index 158a1e108d..d61d88114c 100644 --- a/src/gallium/drivers/svga/svga_screen_texture.c +++ b/src/gallium/drivers/svga/svga_screen_texture.c @@ -397,9 +397,6 @@ svga_texture_blanket(struct pipe_screen * screen, tex->base = *base; - /* We don't own this storage, so don't try to cache it. - */ - tex->key.cachable = 0; if (sbuf->key.format == 1) tex->base.format = PIPE_FORMAT_X8R8G8B8_UNORM; @@ -410,6 +407,11 @@ svga_texture_blanket(struct pipe_screen * screen, tex->base.screen = screen; SVGA_DBG(DEBUG_DMA, "blanket sid %p\n", sbuf->handle); + + /* We don't own this storage, so don't try to cache it. + */ + assert(sbuf->key.cachable == 0); + tex->key.cachable = 0; sws->surface_reference(sws, &tex->handle, sbuf->handle); return &tex->base; @@ -549,13 +551,17 @@ svga_texture_view_surface(struct pipe_context *pipe, key->numFaces = 1; } - if(key->format == SVGA3D_FORMAT_INVALID) + if(key->format == SVGA3D_FORMAT_INVALID) { + key->cachable = 0; return NULL; + } SVGA_DBG(DEBUG_DMA, "surface_create for texture view\n", handle); handle = svga_screen_surface_create(ss, key); - if (!handle) + if (!handle) { + key->cachable = 0; return NULL; + } SVGA_DBG(DEBUG_DMA, " --> got sid %p (texture view)\n", handle); @@ -656,11 +662,11 @@ svga_get_tex_surface(struct pipe_screen *screen, SVGA_DBG(DEBUG_VIEWS, "svga: Surface view: no %p, level %u, face %u, z %u, %p\n", pt, level, face, zslice, s); + memset(&s->key, 0, sizeof s->key); sws->surface_reference(sws, &s->handle, tex->handle); s->real_face = face; s->real_level = level; s->real_zslice = zslice; - memset(&s->key, 0, sizeof s->key); } return &s->base; @@ -674,6 +680,7 @@ svga_tex_surface_destroy(struct pipe_surface *surf) struct svga_screen *ss = svga_screen(surf->texture->screen); SVGA_DBG(DEBUG_DMA, "unref sid %p (tex surface)\n", s->handle); + assert(s->key.cachable == 0); svga_screen_surface_destroy(ss, &s->key, &s->handle); pipe_texture_reference(&surf->texture, NULL); FREE(surf); @@ -968,6 +975,7 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt, pt->height[0], pt->depth[0], pt->last_level); + sv->key.cachable = 0; sws->surface_reference(sws, &sv->handle, tex->handle); return sv; } @@ -990,6 +998,7 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt, if (!sv->handle) { assert(0); + sv->key.cachable = 0; sws->surface_reference(sws, &sv->handle, tex->handle); return sv; } @@ -1072,6 +1081,8 @@ svga_screen_texture_get_winsys_surface(struct pipe_texture *texture) struct svga_winsys_screen *sws = svga_winsys_screen(texture->screen); struct svga_winsys_surface *vsurf = NULL; + assert(svga_texture(texture)->key.cachable == 0); + svga_texture(texture)->key.cachable = 0; sws->surface_reference(sws, &vsurf, svga_texture(texture)->handle); return vsurf; } -- cgit v1.2.3 From 26f9eeddf4cf783d7e5d5ac030a7ac5c1e67e60c Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 24 Nov 2009 02:21:16 +0100 Subject: st/xorg: Standardise all function names defined in xorg_tracker.h --- src/gallium/state_trackers/xorg/xorg_crtc.c | 4 ++-- src/gallium/state_trackers/xorg/xorg_dri2.c | 4 ++-- src/gallium/state_trackers/xorg/xorg_driver.c | 14 ++++++-------- src/gallium/state_trackers/xorg/xorg_output.c | 2 +- src/gallium/state_trackers/xorg/xorg_tracker.h | 13 +++++++------ src/gallium/state_trackers/xorg/xorg_xv.c | 2 +- 6 files changed, 19 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index 85b9162d4c..f7d6e51e58 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -235,7 +235,7 @@ crtc_hide_cursor(xf86CrtcPtr crtc) } void -crtc_cursor_destroy(xf86CrtcPtr crtc) +xorg_crtc_cursor_destroy(xf86CrtcPtr crtc) { struct crtc_private *crtcp = crtc->driver_private; @@ -279,7 +279,7 @@ static const xf86CrtcFuncsRec crtc_funcs = { }; void -crtc_init(ScrnInfoPtr pScrn) +xorg_crtc_init(ScrnInfoPtr pScrn) { modesettingPtr ms = modesettingPTR(pScrn); xf86CrtcPtr crtc; diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index ca3c712dcd..32f0648fd6 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -356,7 +356,7 @@ driCopyRegion(DrawablePtr pDraw, RegionPtr pRegion, } Bool -driScreenInit(ScreenPtr pScreen) +xorg_dri2_init(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; modesettingPtr ms = modesettingPTR(pScrn); @@ -395,7 +395,7 @@ driScreenInit(ScreenPtr pScreen) } void -driCloseScreen(ScreenPtr pScreen) +xorg_dri2_close(ScreenPtr pScreen) { DRI2CloseScreen(pScreen); } diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index d949167adc..7c6274677f 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -402,8 +402,8 @@ PreInit(ScrnInfoPtr pScrn, int flags) SaveHWState(pScrn); - crtc_init(pScrn); - output_init(pScrn); + xorg_crtc_init(pScrn); + xorg_output_init(pScrn); if (!xf86InitialConfiguration(pScrn, TRUE)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n"); @@ -615,7 +615,7 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) OPTION_2D_ACCEL, TRUE)); ms->debug_fallback = debug_get_bool_option("XORG_DEBUG_FALLBACK", TRUE); - xorg_init_video(pScreen); + xorg_xv_init(pScreen); miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); @@ -647,10 +647,8 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (serverGeneration == 1) xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); -#if 1 #ifdef DRI2 - driScreenInit(pScreen); -#endif + xorg_dri2_init(pScreen); #endif return EnterVT(scrnIndex, 1); @@ -689,7 +687,7 @@ LeaveVT(int scrnIndex, int flags) for (o = 0; o < config->num_crtc; o++) { xf86CrtcPtr crtc = config->crtc[o]; - crtc_cursor_destroy(crtc); + xorg_crtc_cursor_destroy(crtc); if (crtc->rotatedPixmap || crtc->rotatedData) { crtc->funcs->shadow_destroy(crtc, crtc->rotatedPixmap, @@ -769,7 +767,7 @@ CloseScreen(int scrnIndex, ScreenPtr pScreen) LeaveVT(scrnIndex, 0); } #ifdef DRI2 - driCloseScreen(pScreen); + xorg_dri2_close(pScreen); #endif pScreen->BlockHandler = ms->blockHandler; diff --git a/src/gallium/state_trackers/xorg/xorg_output.c b/src/gallium/state_trackers/xorg/xorg_output.c index bfeddc5e11..99a76d9ed2 100644 --- a/src/gallium/state_trackers/xorg/xorg_output.c +++ b/src/gallium/state_trackers/xorg/xorg_output.c @@ -179,7 +179,7 @@ static const xf86OutputFuncsRec output_funcs = { }; void -output_init(ScrnInfoPtr pScrn) +xorg_output_init(ScrnInfoPtr pScrn) { modesettingPtr ms = modesettingPTR(pScrn); xf86OutputPtr output; diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h index 20c9259c7b..580dae474d 100644 --- a/src/gallium/state_trackers/xorg/xorg_tracker.h +++ b/src/gallium/state_trackers/xorg/xorg_tracker.h @@ -141,33 +141,34 @@ xorg_exa_close(ScrnInfoPtr pScrn); * xorg_dri2.c */ Bool -driScreenInit(ScreenPtr pScreen); +xorg_dri2_init(ScreenPtr pScreen); void -driCloseScreen(ScreenPtr pScreen); +xorg_dri2_close(ScreenPtr pScreen); /*********************************************************************** * xorg_crtc.c */ void -crtc_init(ScrnInfoPtr pScrn); +xorg_crtc_init(ScrnInfoPtr pScrn); void -crtc_cursor_destroy(xf86CrtcPtr crtc); +xorg_crtc_cursor_destroy(xf86CrtcPtr crtc); /*********************************************************************** * xorg_output.c */ void -output_init(ScrnInfoPtr pScrn); +xorg_output_init(ScrnInfoPtr pScrn); + /*********************************************************************** * xorg_xv.c */ void -xorg_init_video(ScreenPtr pScreen); +xorg_xv_init(ScreenPtr pScreen); #endif /* _XORG_TRACKER_H_ */ diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index e7f4900528..a8f74ceea2 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -686,7 +686,7 @@ xorg_setup_textured_adapter(ScreenPtr pScreen) } void -xorg_init_video(ScreenPtr pScreen) +xorg_xv_init(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; /*modesettingPtr ms = modesettingPTR(pScrn);*/ -- cgit v1.2.3 From 6713a83bb8f836f3cb7ba4419a62ec286d5b88fd Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 24 Nov 2009 02:28:09 +0100 Subject: st/xorg: Rename dri2 functions --- src/gallium/state_trackers/xorg/xorg_dri2.c | 34 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index 32f0648fd6..feb842fb2d 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -55,7 +55,7 @@ typedef struct { } *BufferPrivatePtr; static Bool -driDoCreateBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int format) +dri2_do_create_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int format) { struct pipe_texture *tex = NULL; ScreenPtr pScreen = pDraw->pScreen; @@ -157,7 +157,7 @@ driDoCreateBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int format) } static void -driDoDestroyBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer) +dri2_do_destroy_buffer(DrawablePtr pDraw, DRI2BufferPtr buffer) { ScreenPtr pScreen = pDraw->pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -174,7 +174,7 @@ driDoDestroyBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer) #if DRI2INFOREC_VERSION >= 2 static DRI2Buffer2Ptr -driCreateBuffer(DrawablePtr pDraw, unsigned int attachment, unsigned int format) +dri2_create_buffer(DrawablePtr pDraw, unsigned int attachment, unsigned int format) { DRI2Buffer2Ptr buffer; BufferPrivatePtr private; @@ -192,7 +192,7 @@ driCreateBuffer(DrawablePtr pDraw, unsigned int attachment, unsigned int format) buffer->driverPrivate = private; /* So far it is safe to downcast a DRI2Buffer2Ptr to DRI2BufferPtr */ - if (driDoCreateBuffer(pDraw, (DRI2BufferPtr)buffer, format)) + if (dri2_do_create_buffer(pDraw, (DRI2BufferPtr)buffer, format)) return buffer; xfree(private); @@ -202,10 +202,10 @@ fail: } static void -driDestroyBuffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer) +dri2_destroy_buffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer) { /* So far it is safe to downcast a DRI2Buffer2Ptr to DRI2BufferPtr */ - driDoDestroyBuffer(pDraw, (DRI2BufferPtr)buffer); + dri2_do_destroy_buffer(pDraw, (DRI2BufferPtr)buffer); xfree(buffer->driverPrivate); xfree(buffer); @@ -214,7 +214,7 @@ driDestroyBuffer(DrawablePtr pDraw, DRI2Buffer2Ptr buffer) #else /* DRI2INFOREC_VERSION < 2 */ static DRI2BufferPtr -driCreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count) +dri2_create_buffers(DrawablePtr pDraw, unsigned int *attachments, int count) { BufferPrivatePtr privates; DRI2BufferPtr buffers; @@ -232,7 +232,7 @@ driCreateBuffers(DrawablePtr pDraw, unsigned int *attachments, int count) buffers[i].attachment = attachments[i]; buffers[i].driverPrivate = &privates[i]; - if (!driDoCreateBuffer(pDraw, &buffers[i], 0)) + if (!dri2_do_create_buffer(pDraw, &buffers[i], 0)) goto fail; } @@ -247,12 +247,12 @@ fail_buffers: } static void -driDestroyBuffers(DrawablePtr pDraw, DRI2BufferPtr buffers, int count) +dri2_destroy_buffers(DrawablePtr pDraw, DRI2BufferPtr buffers, int count) { int i; for (i = 0; i < count; i++) { - driDoDestroyBuffer(pDraw, &buffers[i]); + dri2_do_destroy_buffer(pDraw, &buffers[i]); } if (buffers) { @@ -264,8 +264,8 @@ driDestroyBuffers(DrawablePtr pDraw, DRI2BufferPtr buffers, int count) #endif /* DRI2INFOREC_VERSION >= 2 */ static void -driCopyRegion(DrawablePtr pDraw, RegionPtr pRegion, - DRI2BufferPtr pDestBuffer, DRI2BufferPtr pSrcBuffer) +dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion, + DRI2BufferPtr pDestBuffer, DRI2BufferPtr pSrcBuffer) { ScreenPtr pScreen = pDraw->pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -373,13 +373,13 @@ xorg_dri2_init(ScreenPtr pScreen) dri2info.deviceName = "/dev/dri/card0"; /* FIXME */ #if DRI2INFOREC_VERSION >= 2 - dri2info.CreateBuffer = driCreateBuffer; - dri2info.DestroyBuffer = driDestroyBuffer; + dri2info.CreateBuffer = dri2_create_buffer; + dri2info.DestroyBuffer = dri2_destroy_buffer; #else - dri2info.CreateBuffers = driCreateBuffers; - dri2info.DestroyBuffers = driDestroyBuffers; + dri2info.CreateBuffers = dri2_create_buffers; + dri2info.DestroyBuffers = dri2_destroy_buffers; #endif - dri2info.CopyRegion = driCopyRegion; + dri2info.CopyRegion = dri2_copy_region; dri2info.Wait = NULL; ms->d_depth_bits_last = -- cgit v1.2.3 From 431e85f894705ee8747555ff01f317953a11222b Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 24 Nov 2009 02:54:24 +0100 Subject: st/xorg: Rename output functions --- src/gallium/state_trackers/xorg/xorg_output.c | 36 +++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_output.c b/src/gallium/state_trackers/xorg/xorg_output.c index 99a76d9ed2..60eef9307d 100644 --- a/src/gallium/state_trackers/xorg/xorg_output.c +++ b/src/gallium/state_trackers/xorg/xorg_output.c @@ -53,7 +53,7 @@ #include "xorg_tracker.h" -static char *connector_enum_list[] = { +static char *output_enum_list[] = { "Unknown", "VGA", "DVI", @@ -70,19 +70,19 @@ static char *connector_enum_list[] = { }; static void -create_resources(xf86OutputPtr output) +output_create_resources(xf86OutputPtr output) { #ifdef RANDR_12_INTERFACE #endif /* RANDR_12_INTERFACE */ } static void -dpms(xf86OutputPtr output, int mode) +output_dpms(xf86OutputPtr output, int mode) { } static xf86OutputStatus -detect(xf86OutputPtr output) +output_detect(xf86OutputPtr output) { drmModeConnectorPtr drm_connector = output->driver_private; @@ -97,7 +97,7 @@ detect(xf86OutputPtr output) } static DisplayModePtr -get_modes(xf86OutputPtr output) +output_get_modes(xf86OutputPtr output) { drmModeConnectorPtr drm_connector = output->driver_private; drmModeModeInfoPtr drm_mode = NULL; @@ -135,14 +135,14 @@ get_modes(xf86OutputPtr output) } static int -mode_valid(xf86OutputPtr output, DisplayModePtr pMode) +output_mode_valid(xf86OutputPtr output, DisplayModePtr pMode) { return MODE_OK; } #ifdef RANDR_12_INTERFACE static Bool -set_property(xf86OutputPtr output, Atom property, RRPropertyValuePtr value) +output_set_property(xf86OutputPtr output, Atom property, RRPropertyValuePtr value) { return TRUE; } @@ -150,32 +150,32 @@ set_property(xf86OutputPtr output, Atom property, RRPropertyValuePtr value) #ifdef RANDR_13_INTERFACE static Bool -get_property(xf86OutputPtr output, Atom property) +output_get_property(xf86OutputPtr output, Atom property) { return TRUE; } #endif /* RANDR_13_INTERFACE */ static void -destroy(xf86OutputPtr output) +output_destroy(xf86OutputPtr output) { drmModeFreeConnector(output->driver_private); } static const xf86OutputFuncsRec output_funcs = { - .create_resources = create_resources, + .create_resources = output_create_resources, #ifdef RANDR_12_INTERFACE - .set_property = set_property, + .set_property = output_set_property, #endif #ifdef RANDR_13_INTERFACE - .get_property = get_property, + .get_property = output_get_property, #endif - .dpms = dpms, - .detect = detect, + .dpms = output_dpms, + .detect = output_detect, - .get_modes = get_modes, - .mode_valid = mode_valid, - .destroy = destroy, + .get_modes = output_get_modes, + .mode_valid = output_mode_valid, + .destroy = output_destroy, }; void @@ -220,7 +220,7 @@ xorg_output_init(ScrnInfoPtr pScrn) #endif snprintf(name, 32, "%s%d", - connector_enum_list[drm_connector->connector_type], + output_enum_list[drm_connector->connector_type], drm_connector->connector_type_id); -- cgit v1.2.3 From def9b0e586e52a0fbdcce15613d96933e9690f38 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 24 Nov 2009 04:19:07 +0100 Subject: st/xorg: Rename driver functions --- src/gallium/state_trackers/xorg/xorg_driver.c | 160 ++++++++++++++------------ 1 file changed, 84 insertions(+), 76 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 7c6274677f..bb8c2f744d 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -56,34 +56,34 @@ #include "xorg_tracker.h" #include "xorg_winsys.h" -static void AdjustFrame(int scrnIndex, int x, int y, int flags); -static Bool CloseScreen(int scrnIndex, ScreenPtr pScreen); -static Bool EnterVT(int scrnIndex, int flags); -static Bool SaveHWState(ScrnInfoPtr pScrn); -static Bool RestoreHWState(ScrnInfoPtr pScrn); - - -static ModeStatus ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, - int flags); -static void FreeScreen(int scrnIndex, int flags); -static void LeaveVT(int scrnIndex, int flags); -static Bool SwitchMode(int scrnIndex, DisplayModePtr mode, int flags); -static Bool ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, - char **argv); -static Bool PreInit(ScrnInfoPtr pScrn, int flags); +/* + * Functions and symbols exported to Xorg via pointers. + */ + +static Bool drv_pre_init(ScrnInfoPtr pScrn, int flags); +static Bool drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, + char **argv); +static Bool drv_switch_mode(int scrnIndex, DisplayModePtr mode, int flags); +static void drv_adjust_frame(int scrnIndex, int x, int y, int flags); +static Bool drv_enter_vt(int scrnIndex, int flags); +static void drv_leave_vt(int scrnIndex, int flags); +static void drv_free_screen(int scrnIndex, int flags); +static ModeStatus drv_valid_mode(int scrnIndex, DisplayModePtr mode, Bool verbose, + int flags); typedef enum { OPTION_SW_CURSOR, OPTION_2D_ACCEL, -} modesettingOpts; +} drv_option_enums; -static const OptionInfoRec Options[] = { +static const OptionInfoRec drv_options[] = { {OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE}, {OPTION_2D_ACCEL, "2DAccel", OPTV_BOOLEAN, {0}, FALSE}, {-1, NULL, OPTV_NONE, {0}, FALSE} }; + /* * Exported Xorg driver functions to winsys */ @@ -91,28 +91,38 @@ static const OptionInfoRec Options[] = { const OptionInfoRec * xorg_tracker_available_options(int chipid, int busid) { - return Options; + return drv_options; } void xorg_tracker_set_functions(ScrnInfoPtr scrn) { - scrn->PreInit = PreInit; - scrn->ScreenInit = ScreenInit; - scrn->SwitchMode = SwitchMode; - scrn->AdjustFrame = AdjustFrame; - scrn->EnterVT = EnterVT; - scrn->LeaveVT = LeaveVT; - scrn->FreeScreen = FreeScreen; - scrn->ValidMode = ValidMode; + scrn->PreInit = drv_pre_init; + scrn->ScreenInit = drv_screen_init; + scrn->SwitchMode = drv_switch_mode; + scrn->AdjustFrame = drv_adjust_frame; + scrn->EnterVT = drv_enter_vt; + scrn->LeaveVT = drv_leave_vt; + scrn->FreeScreen = drv_free_screen; + scrn->ValidMode = drv_valid_mode; } + /* - * Static Xorg funtctions + * Internal function definitions + */ + +static Bool drv_close_screen(int scrnIndex, ScreenPtr pScreen); +static Bool drv_save_hw_state(ScrnInfoPtr pScrn); +static Bool drv_restore_hw_state(ScrnInfoPtr pScrn); + + +/* + * Internal functions */ static Bool -GetRec(ScrnInfoPtr pScrn) +drv_get_rec(ScrnInfoPtr pScrn) { if (pScrn->driverPrivate) return TRUE; @@ -123,7 +133,7 @@ GetRec(ScrnInfoPtr pScrn) } static void -FreeRec(ScrnInfoPtr pScrn) +drv_free_rec(ScrnInfoPtr pScrn) { if (!pScrn) return; @@ -137,13 +147,13 @@ FreeRec(ScrnInfoPtr pScrn) } static void -ProbeDDC(ScrnInfoPtr pScrn, int index) +drv_probe_ddc(ScrnInfoPtr pScrn, int index) { ConfiguredMonitor = NULL; } static Bool -CreateFrontBuffer(ScrnInfoPtr pScrn) +drv_create_front_buffer(ScrnInfoPtr pScrn) { modesettingPtr ms = modesettingPTR(pScrn); unsigned handle, stride; @@ -174,7 +184,7 @@ CreateFrontBuffer(ScrnInfoPtr pScrn) pScrn->frameX0 = 0; pScrn->frameY0 = 0; - AdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + drv_adjust_frame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); pipe_texture_reference(&ms->root_texture, tex); pipe_texture_reference(&tex, NULL); @@ -182,7 +192,7 @@ CreateFrontBuffer(ScrnInfoPtr pScrn) } static Bool -BindTextureToRoot(ScrnInfoPtr pScrn) +drv_bind_texture_to_root(ScrnInfoPtr pScrn) { modesettingPtr ms = modesettingPTR(pScrn); ScreenPtr pScreen = pScrn->pScreen; @@ -207,7 +217,7 @@ BindTextureToRoot(ScrnInfoPtr pScrn) } static Bool -crtc_resize(ScrnInfoPtr pScrn, int width, int height) +drv_crtc_resize(ScrnInfoPtr pScrn, int width, int height) { modesettingPtr ms = modesettingPTR(pScrn); unsigned handle, stride; @@ -217,8 +227,6 @@ crtc_resize(ScrnInfoPtr pScrn, int width, int height) if (width == pScrn->virtualX && height == pScrn->virtualY) return TRUE; - ErrorF("RESIZING TO %dx%d\n", width, height); - pScrn->virtualX = width; pScrn->virtualY = height; @@ -255,15 +263,15 @@ crtc_resize(ScrnInfoPtr pScrn, int width, int height) pScrn->displayWidth = pScrn->virtualX; /* now create new frontbuffer */ - return CreateFrontBuffer(pScrn) && BindTextureToRoot(pScrn); + return drv_create_front_buffer(pScrn) && drv_bind_texture_to_root(pScrn); } static const xf86CrtcConfigFuncsRec crtc_config_funcs = { - crtc_resize + .resize = drv_crtc_resize }; static Bool -InitDRM(ScrnInfoPtr pScrn) +drv_init_drm(ScrnInfoPtr pScrn) { modesettingPtr ms = modesettingPTR(pScrn); @@ -294,7 +302,7 @@ InitDRM(ScrnInfoPtr pScrn) } static Bool -PreInit(ScrnInfoPtr pScrn, int flags) +drv_pre_init(ScrnInfoPtr pScrn, int flags) { xf86CrtcConfigPtr xf86_config; modesettingPtr ms; @@ -309,12 +317,12 @@ PreInit(ScrnInfoPtr pScrn, int flags) pEnt = xf86GetEntityInfo(pScrn->entityList[0]); if (flags & PROBE_DETECT) { - ProbeDDC(pScrn, pEnt->index); + drv_probe_ddc(pScrn, pEnt->index); return TRUE; } /* Allocate driverPrivate */ - if (!GetRec(pScrn)) + if (!drv_get_rec(pScrn)) return FALSE; ms = modesettingPTR(pScrn); @@ -351,7 +359,7 @@ PreInit(ScrnInfoPtr pScrn, int flags) ms->fd = -1; ms->api = NULL; - if (!InitDRM(pScrn)) + if (!drv_init_drm(pScrn)) return FALSE; pScrn->monitor = pScrn->confScreen->monitor; @@ -383,9 +391,9 @@ PreInit(ScrnInfoPtr pScrn, int flags) /* Process the options */ xf86CollectOptions(pScrn, NULL); - if (!(ms->Options = xalloc(sizeof(Options)))) + if (!(ms->Options = xalloc(sizeof(drv_options)))) return FALSE; - memcpy(ms->Options, Options, sizeof(Options)); + memcpy(ms->Options, drv_options, sizeof(drv_options)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, ms->Options); /* Allocate an xf86CrtcConfig */ @@ -400,18 +408,18 @@ PreInit(ScrnInfoPtr pScrn, int flags) ms->SWCursor = TRUE; } - SaveHWState(pScrn); + drv_save_hw_state(pScrn); xorg_crtc_init(pScrn); xorg_output_init(pScrn); if (!xf86InitialConfiguration(pScrn, TRUE)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n"); - RestoreHWState(pScrn); + drv_restore_hw_state(pScrn); return FALSE; } - RestoreHWState(pScrn); + drv_restore_hw_state(pScrn); /* * If the driver can do gamma correction, it should call xf86SetGamma() here. @@ -449,7 +457,7 @@ PreInit(ScrnInfoPtr pScrn, int flags) } static Bool -SaveHWState(ScrnInfoPtr pScrn) +drv_save_hw_state(ScrnInfoPtr pScrn) { /*xf86CrtcConfigPtr xf86_config = XF86_CRTC_CONFIG_PTR(pScrn);*/ @@ -457,22 +465,22 @@ SaveHWState(ScrnInfoPtr pScrn) } static Bool -RestoreHWState(ScrnInfoPtr pScrn) +drv_restore_hw_state(ScrnInfoPtr pScrn) { /*xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);*/ return TRUE; } -static void xorgBlockHandler(int i, pointer blockData, pointer pTimeout, - pointer pReadmask) +static void drv_block_handler(int i, pointer blockData, pointer pTimeout, + pointer pReadmask) { ScreenPtr pScreen = screenInfo.screens[i]; modesettingPtr ms = modesettingPTR(xf86Screens[pScreen->myNum]); pScreen->BlockHandler = ms->blockHandler; pScreen->BlockHandler(i, blockData, pTimeout, pReadmask); - pScreen->BlockHandler = xorgBlockHandler; + pScreen->BlockHandler = drv_block_handler; ms->ctx->flush(ms->ctx, PIPE_FLUSH_RENDER_CACHE, NULL); @@ -504,7 +512,7 @@ static void xorgBlockHandler(int i, pointer blockData, pointer pTimeout, } static Bool -CreateScreenResources(ScreenPtr pScreen) +drv_create_screen_resources(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; modesettingPtr ms = modesettingPTR(pScrn); @@ -515,13 +523,13 @@ CreateScreenResources(ScreenPtr pScreen) pScreen->CreateScreenResources = ms->createScreenResources; ret = pScreen->CreateScreenResources(pScreen); - pScreen->CreateScreenResources = CreateScreenResources; + pScreen->CreateScreenResources = drv_create_screen_resources; - BindTextureToRoot(pScrn); + drv_bind_texture_to_root(pScrn); ms->noEvict = FALSE; - AdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + drv_adjust_frame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); #ifdef DRM_MODE_FEATURE_DIRTYFB rootPixmap = pScreen->GetScreenPixmap(pScreen); @@ -545,13 +553,13 @@ CreateScreenResources(ScreenPtr pScreen) } static Bool -ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) +drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; modesettingPtr ms = modesettingPTR(pScrn); VisualPtr visual; - if (!InitDRM(pScrn)) + if (!drv_init_drm(pScrn)) return FALSE; if (!ms->screen) { @@ -605,9 +613,9 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) fbPictureInit(pScreen, NULL, 0); ms->blockHandler = pScreen->BlockHandler; - pScreen->BlockHandler = xorgBlockHandler; + pScreen->BlockHandler = drv_block_handler; ms->createScreenResources = pScreen->CreateScreenResources; - pScreen->CreateScreenResources = CreateScreenResources; + pScreen->CreateScreenResources = drv_create_screen_resources; xf86SetBlackWhitePixels(pScreen); @@ -634,7 +642,7 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) pScreen->SaveScreen = xf86SaveScreen; ms->CloseScreen = pScreen->CloseScreen; - pScreen->CloseScreen = CloseScreen; + pScreen->CloseScreen = drv_close_screen; if (!xf86CrtcScreenInit(pScreen)) return FALSE; @@ -651,11 +659,11 @@ ScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xorg_dri2_init(pScreen); #endif - return EnterVT(scrnIndex, 1); + return drv_enter_vt(scrnIndex, 1); } static void -AdjustFrame(int scrnIndex, int x, int y, int flags) +drv_adjust_frame(int scrnIndex, int x, int y, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); @@ -671,13 +679,13 @@ AdjustFrame(int scrnIndex, int x, int y, int flags) } static void -FreeScreen(int scrnIndex, int flags) +drv_free_screen(int scrnIndex, int flags) { - FreeRec(xf86Screens[scrnIndex]); + drv_free_rec(xf86Screens[scrnIndex]); } static void -LeaveVT(int scrnIndex, int flags) +drv_leave_vt(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; modesettingPtr ms = modesettingPTR(pScrn); @@ -699,7 +707,7 @@ LeaveVT(int scrnIndex, int flags) drmModeRmFB(ms->fd, ms->fb_id); - RestoreHWState(pScrn); + drv_restore_hw_state(pScrn); if (drmDropMaster(ms->fd)) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, @@ -712,7 +720,7 @@ LeaveVT(int scrnIndex, int flags) * This gets called when gaining control of the VT, and from ScreenInit(). */ static Bool -EnterVT(int scrnIndex, int flags) +drv_enter_vt(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; modesettingPtr ms = modesettingPTR(pScrn); @@ -734,13 +742,13 @@ EnterVT(int scrnIndex, int flags) */ if (ms->SaveGeneration != serverGeneration) { ms->SaveGeneration = serverGeneration; - SaveHWState(pScrn); + drv_save_hw_state(pScrn); } - if (!CreateFrontBuffer(pScrn)) + if (!drv_create_front_buffer(pScrn)) return FALSE; - if (!flags && !BindTextureToRoot(pScrn)) + if (!flags && !drv_bind_texture_to_root(pScrn)) return FALSE; if (!xf86SetDesiredModes(pScrn)) @@ -750,7 +758,7 @@ EnterVT(int scrnIndex, int flags) } static Bool -SwitchMode(int scrnIndex, DisplayModePtr mode, int flags) +drv_switch_mode(int scrnIndex, DisplayModePtr mode, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; @@ -758,13 +766,13 @@ SwitchMode(int scrnIndex, DisplayModePtr mode, int flags) } static Bool -CloseScreen(int scrnIndex, ScreenPtr pScreen) +drv_close_screen(int scrnIndex, ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; modesettingPtr ms = modesettingPTR(pScrn); if (pScrn->vtSema) { - LeaveVT(scrnIndex, 0); + drv_leave_vt(scrnIndex, 0); } #ifdef DRI2 xorg_dri2_close(pScreen); @@ -799,7 +807,7 @@ CloseScreen(int scrnIndex, ScreenPtr pScreen) } static ModeStatus -ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) +drv_valid_mode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { return MODE_OK; } -- cgit v1.2.3 From 1a19b9dbc268973a725a43f4764a2189a705bb88 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 24 Nov 2009 02:49:57 +0100 Subject: st/xorg: Touch up xorg_crtc.c --- src/gallium/state_trackers/xorg/xorg_crtc.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index f7d6e51e58..2db8d45b3b 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -134,6 +134,7 @@ static void crtc_gamma_set(xf86CrtcPtr crtc, CARD16 * red, CARD16 * green, CARD16 * blue, int size) { + /* XXX: hockup */ } static void * @@ -160,6 +161,7 @@ crtc_shadow_destroy(xf86CrtcPtr crtc, PixmapPtr rotate_pixmap, void *data) static void crtc_set_cursor_colors(xf86CrtcPtr crtc, int bg, int fg) { + /* XXX: See if this one is needed, as we only support ARGB cursors */ } static void @@ -170,6 +172,7 @@ crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y) drmModeMoveCursor(ms->fd, crtcp->drm_crtc->crtc_id, x, y); } + static void crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image) { @@ -234,6 +237,9 @@ crtc_hide_cursor(xf86CrtcPtr crtc) drmModeSetCursor(ms->fd, crtcp->drm_crtc->crtc_id, 0, 0, 0); } +/** + * Called at vt leave + */ void xorg_crtc_cursor_destroy(xf86CrtcPtr crtc) { -- cgit v1.2.3 From ee40b20e7aff5dc9d11230e991355c338a64da00 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 24 Nov 2009 12:47:38 +0100 Subject: st/xorg: Add libkms integration --- src/gallium/state_trackers/xorg/Makefile | 3 + src/gallium/state_trackers/xorg/xorg_crtc.c | 69 ++++- src/gallium/state_trackers/xorg/xorg_driver.c | 392 +++++++++++++++++-------- src/gallium/state_trackers/xorg/xorg_tracker.h | 11 + 4 files changed, 353 insertions(+), 122 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/Makefile b/src/gallium/state_trackers/xorg/Makefile index 22c107370e..cb2c3aea41 100644 --- a/src/gallium/state_trackers/xorg/Makefile +++ b/src/gallium/state_trackers/xorg/Makefile @@ -7,6 +7,9 @@ LIBRARY_INCLUDES = \ -DHAVE_CONFIG_H \ $(shell pkg-config xextproto --atleast-version=7.0.99.1 \ && echo "-DHAVE_XEXTPROTO_71") \ + $(shell pkg-config libkms --atleast-version=1.0 \ + && echo "-DHAVE_LIBKMS") \ + $(shell pkg-config libkms --silence-errors --cflags-only-I) \ $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \ -I$(TOP)/src/gallium/include \ -I$(TOP)/src/gallium/auxiliary \ diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index 2db8d45b3b..ddcaedde37 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -52,12 +52,18 @@ #include "pipe/p_inlines.h" #include "util/u_rect.h" +#ifdef HAVE_LIBKMS +#include "libkms.h" +#endif + struct crtc_private { drmModeCrtcPtr drm_crtc; /* hwcursor */ struct pipe_texture *cursor_tex; + struct kms_bo *cursor_bo; + unsigned cursor_handle; }; @@ -174,7 +180,7 @@ crtc_set_cursor_position(xf86CrtcPtr crtc, int x, int y) } static void -crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image) +crtc_load_cursor_argb_ga3d(xf86CrtcPtr crtc, CARD32 * image) { unsigned char *ptr; modesettingPtr ms = modesettingPTR(crtc->scrn); @@ -217,13 +223,63 @@ crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image) ms->screen->tex_transfer_destroy(transfer); } +#if HAVE_LIBKMS +static void +crtc_load_cursor_argb_kms(xf86CrtcPtr crtc, CARD32 * image) +{ + modesettingPtr ms = modesettingPTR(crtc->scrn); + struct crtc_private *crtcp = crtc->driver_private; + unsigned char *ptr; + + if (!crtcp->cursor_bo) { + unsigned attr[8]; + + attr[0] = KMS_BO_TYPE; + attr[1] = KMS_BO_TYPE_CURSOR; + attr[2] = KMS_WIDTH; + attr[3] = 64; + attr[4] = KMS_HEIGHT; + attr[5] = 64; + attr[6] = 0; + + if (kms_bo_create(ms->kms, attr, &crtcp->cursor_bo)) + return; + + if (kms_bo_get_prop(crtcp->cursor_bo, KMS_HANDLE, + &crtcp->cursor_handle)) + goto err_bo_destroy; + } + + kms_bo_map(crtcp->cursor_bo, (void**)&ptr); + memcpy(ptr, image, 64*64*4); + kms_bo_unmap(crtcp->cursor_bo); + + return; + +err_bo_destroy: + kms_bo_destroy(crtcp->cursor_bo); +} +#endif + +static void +crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image) +{ + modesettingPtr ms = modesettingPTR(crtc->scrn); + if (ms->screen) + crtc_load_cursor_argb_ga3d(crtc, image); +#ifdef HAVE_LIBKMS + else if (ms->kms) + crtc_load_cursor_argb_kms(crtc, image); +#endif +} + static void crtc_show_cursor(xf86CrtcPtr crtc) { modesettingPtr ms = modesettingPTR(crtc->scrn); struct crtc_private *crtcp = crtc->driver_private; - if (crtcp->cursor_tex) + if (crtcp->cursor_tex || crtcp->cursor_bo) drmModeSetCursor(ms->fd, crtcp->drm_crtc->crtc_id, crtcp->cursor_handle, 64, 64); } @@ -245,9 +301,14 @@ xorg_crtc_cursor_destroy(xf86CrtcPtr crtc) { struct crtc_private *crtcp = crtc->driver_private; - if (crtcp->cursor_tex) { + if (crtcp->cursor_tex) pipe_texture_reference(&crtcp->cursor_tex, NULL); - } +#ifdef HAVE_LIBKMS + if (crtcp->cursor_bo) + kms_bo_destroy(crtcp->cursor_bo); +#endif + + xfree(crtcp); } /* diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index bb8c2f744d..c74fb28072 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -56,6 +56,10 @@ #include "xorg_tracker.h" #include "xorg_winsys.h" +#ifdef HAVE_LIBKMS +#include "libkms.h" +#endif + /* * Functions and symbols exported to Xorg via pointers. */ @@ -112,6 +116,7 @@ xorg_tracker_set_functions(ScrnInfoPtr scrn) * Internal function definitions */ +static Bool drv_init_front_buffer_functions(ScrnInfoPtr pScrn); static Bool drv_close_screen(int scrnIndex, ScreenPtr pScreen); static Bool drv_save_hw_state(ScrnInfoPtr pScrn); static Bool drv_restore_hw_state(ScrnInfoPtr pScrn); @@ -152,75 +157,10 @@ drv_probe_ddc(ScrnInfoPtr pScrn, int index) ConfiguredMonitor = NULL; } -static Bool -drv_create_front_buffer(ScrnInfoPtr pScrn) -{ - modesettingPtr ms = modesettingPTR(pScrn); - unsigned handle, stride; - struct pipe_texture *tex; - - ms->noEvict = TRUE; - - tex = xorg_exa_create_root_texture(pScrn, pScrn->virtualX, pScrn->virtualY, - pScrn->depth, pScrn->bitsPerPixel); - - if (!tex) - return FALSE; - - if (!ms->api->local_handle_from_texture(ms->api, ms->screen, - tex, - &stride, - &handle)) - return FALSE; - - drmModeAddFB(ms->fd, - pScrn->virtualX, - pScrn->virtualY, - pScrn->depth, - pScrn->bitsPerPixel, - stride, - handle, - &ms->fb_id); - - pScrn->frameX0 = 0; - pScrn->frameY0 = 0; - drv_adjust_frame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); - - pipe_texture_reference(&ms->root_texture, tex); - pipe_texture_reference(&tex, NULL); - return TRUE; -} - -static Bool -drv_bind_texture_to_root(ScrnInfoPtr pScrn) -{ - modesettingPtr ms = modesettingPTR(pScrn); - ScreenPtr pScreen = pScrn->pScreen; - struct pipe_texture *check; - PixmapPtr rootPixmap; - - rootPixmap = pScreen->GetScreenPixmap(pScreen); - - xorg_exa_set_displayed_usage(rootPixmap); - xorg_exa_set_shared_usage(rootPixmap); - xorg_exa_set_texture(rootPixmap, ms->root_texture); - if (!pScreen->ModifyPixmapHeader(rootPixmap, -1, -1, -1, -1, -1, NULL)) - FatalError("Couldn't adjust screen pixmap\n"); - - check = xorg_exa_get_texture(rootPixmap); - if (ms->root_texture != check) - FatalError("Created new root texture\n"); - - pipe_texture_reference(&check, NULL); - - return TRUE; -} - static Bool drv_crtc_resize(ScrnInfoPtr pScrn, int width, int height) { modesettingPtr ms = modesettingPTR(pScrn); - unsigned handle, stride; PixmapPtr rootPixmap; ScreenPtr pScreen = pScrn->pScreen; @@ -234,36 +174,18 @@ drv_crtc_resize(ScrnInfoPtr pScrn, int width, int height) * Remove the old framebuffer & texture. */ drmModeRmFB(ms->fd, ms->fb_id); - pipe_texture_reference(&ms->root_texture, NULL); - + if (!ms->destroy_front_buffer(pScrn)) + FatalError("failed to destroy front buffer\n"); rootPixmap = pScreen->GetScreenPixmap(pScreen); if (!pScreen->ModifyPixmapHeader(rootPixmap, width, height, -1, -1, -1, NULL)) return FALSE; - /* takes one ref */ - ms->root_texture = xorg_exa_get_texture(rootPixmap); - - if (!ms->api->local_handle_from_texture(ms->api, ms->screen, - ms->root_texture, - &stride, - &handle)) - FatalError("Could not get handle and stride from texture\n"); - - drmModeAddFB(ms->fd, - pScrn->virtualX, - pScrn->virtualY, - pScrn->depth, - pScrn->bitsPerPixel, - stride, - handle, - &ms->fb_id); - /* HW dependent - FIXME */ pScrn->displayWidth = pScrn->virtualX; /* now create new frontbuffer */ - return drv_create_front_buffer(pScrn) && drv_bind_texture_to_root(pScrn); + return ms->create_front_buffer(pScrn) && ms->bind_front_buffer(pScrn); } static const xf86CrtcConfigFuncsRec crtc_config_funcs = { @@ -291,13 +213,57 @@ drv_init_drm(ScrnInfoPtr pScrn) return FALSE; } - if (!ms->api) { - ms->api = drm_api_create(); + return TRUE; +} - if (!ms->api) - return FALSE; +static Bool +drv_init_resource_management(ScrnInfoPtr pScrn) +{ + modesettingPtr ms = modesettingPTR(pScrn); + + if (ms->screen || ms->kms) + return TRUE; + + ms->api = drm_api_create(); + if (ms->api) { + ms->screen = ms->api->create_screen(ms->api, ms->fd, NULL); + + if (ms->screen) + return TRUE; + + if (ms->api->destroy) + ms->api->destroy(ms->api); + + ms->api = NULL; } +#ifdef HAVE_LIBKMS + if (!kms_create(ms->fd, &ms->kms)) + return TRUE; +#endif + + return FALSE; +} + +static Bool +drv_close_resource_management(ScrnInfoPtr pScrn) +{ + modesettingPtr ms = modesettingPTR(pScrn); + + if (ms->screen) + ms->screen->destroy(ms->screen); + ms->screen = NULL; + + if (ms->api && ms->api->destroy) + ms->api->destroy(ms->api); + ms->api = NULL; + +#ifdef HAVE_LIBKMS + if (ms->kms) + kms_destroy(ms->kms); + ms->kms = NULL; +#endif + return TRUE; } @@ -443,14 +409,16 @@ drv_pre_init(ScrnInfoPtr pScrn, int flags) xf86SetDpi(pScrn, 0, 0); /* Load the required sub modules */ - if (!xf86LoadSubModule(pScrn, "fb")) { + if (!xf86LoadSubModule(pScrn, "fb")) return FALSE; - } - xf86LoadSubModule(pScrn, "exa"); + /* XXX: these aren't needed when we are using libkms */ + if (!xf86LoadSubModule(pScrn, "exa")) + return FALSE; #ifdef DRI2 - xf86LoadSubModule(pScrn, "dri2"); + if (!xf86LoadSubModule(pScrn, "dri2")) + return FALSE; #endif return TRUE; @@ -482,7 +450,8 @@ static void drv_block_handler(int i, pointer blockData, pointer pTimeout, pScreen->BlockHandler(i, blockData, pTimeout, pReadmask); pScreen->BlockHandler = drv_block_handler; - ms->ctx->flush(ms->ctx, PIPE_FLUSH_RENDER_CACHE, NULL); + if (ms->ctx) + ms->ctx->flush(ms->ctx, PIPE_FLUSH_RENDER_CACHE, NULL); #ifdef DRM_MODE_FEATURE_DIRTYFB { @@ -525,7 +494,7 @@ drv_create_screen_resources(ScreenPtr pScreen) ret = pScreen->CreateScreenResources(pScreen); pScreen->CreateScreenResources = drv_create_screen_resources; - drv_bind_texture_to_root(pScrn); + ms->bind_front_buffer(pScrn); ms->noEvict = FALSE; @@ -559,16 +528,19 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) modesettingPtr ms = modesettingPTR(pScrn); VisualPtr visual; - if (!drv_init_drm(pScrn)) + if (!drv_init_drm(pScrn)) { + FatalError("Could not init DRM"); return FALSE; + } - if (!ms->screen) { - ms->screen = ms->api->create_screen(ms->api, ms->fd, NULL); + if (!drv_init_resource_management(pScrn)) { + FatalError("Could not init resource management (!pipe_screen && !libkms)"); + return FALSE; + } - if (!ms->screen) { - FatalError("Could not init pipe_screen\n"); - return FALSE; - } + if (!drv_init_front_buffer_functions(pScrn)) { + FatalError("Could not init front buffer manager"); + return FALSE; } pScrn->pScreen = pScreen; @@ -619,11 +591,16 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) xf86SetBlackWhitePixels(pScreen); - ms->exa = xorg_exa_init(pScrn, xf86ReturnOptValBool(ms->Options, - OPTION_2D_ACCEL, TRUE)); - ms->debug_fallback = debug_get_bool_option("XORG_DEBUG_FALLBACK", TRUE); + if (ms->screen) { + ms->exa = xorg_exa_init(pScrn, xf86ReturnOptValBool(ms->Options, + OPTION_2D_ACCEL, TRUE)); + ms->debug_fallback = debug_get_bool_option("XORG_DEBUG_FALLBACK", TRUE); - xorg_xv_init(pScreen); + xorg_xv_init(pScreen); +#ifdef DRI2 + xorg_dri2_init(pScreen); +#endif + } miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); @@ -655,10 +632,6 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (serverGeneration == 1) xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); -#ifdef DRI2 - xorg_dri2_init(pScreen); -#endif - return drv_enter_vt(scrnIndex, 1); } @@ -745,10 +718,10 @@ drv_enter_vt(int scrnIndex, int flags) drv_save_hw_state(pScrn); } - if (!drv_create_front_buffer(pScrn)) + if (!ms->create_front_buffer(pScrn)) return FALSE; - if (!flags && !drv_bind_texture_to_root(pScrn)) + if (!flags && !ms->bind_front_buffer(pScrn)) return FALSE; if (!xf86SetDesiredModes(pScrn)) @@ -774,8 +747,10 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen) if (pScrn->vtSema) { drv_leave_vt(scrnIndex, 0); } + #ifdef DRI2 - xorg_dri2_close(pScreen); + if (ms->screen) + xorg_dri2_close(pScreen); #endif pScreen->BlockHandler = ms->blockHandler; @@ -789,14 +764,14 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen) } #endif - pipe_texture_reference(&ms->root_texture, NULL); + drmModeRmFB(ms->fd, ms->fb_id); + ms->destroy_front_buffer(pScrn); if (ms->exa) xorg_exa_close(pScrn); + ms->exa = NULL; - if (ms->api && ms->api->destroy) - ms->api->destroy(ms->api); - ms->api = NULL; + drv_close_resource_management(pScrn); drmClose(ms->fd); ms->fd = -1; @@ -812,4 +787,185 @@ drv_valid_mode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) return MODE_OK; } + +/* + * Front buffer backing store functions. + */ + +static Bool +drv_destroy_front_buffer_ga3d(ScrnInfoPtr pScrn) +{ + modesettingPtr ms = modesettingPTR(pScrn); + pipe_texture_reference(&ms->root_texture, NULL); + return TRUE; +} + +static Bool +drv_create_front_buffer_ga3d(ScrnInfoPtr pScrn) +{ + modesettingPtr ms = modesettingPTR(pScrn); + unsigned handle, stride; + struct pipe_texture *tex; + + ms->noEvict = TRUE; + + tex = xorg_exa_create_root_texture(pScrn, pScrn->virtualX, pScrn->virtualY, + pScrn->depth, pScrn->bitsPerPixel); + + if (!tex) + return FALSE; + + if (!ms->api->local_handle_from_texture(ms->api, ms->screen, + tex, + &stride, + &handle)) + return FALSE; + + drmModeAddFB(ms->fd, + pScrn->virtualX, + pScrn->virtualY, + pScrn->depth, + pScrn->bitsPerPixel, + stride, + handle, + &ms->fb_id); + + pScrn->frameX0 = 0; + pScrn->frameY0 = 0; + drv_adjust_frame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + + pipe_texture_reference(&ms->root_texture, tex); + pipe_texture_reference(&tex, NULL); + + return TRUE; +} + +static Bool +drv_bind_front_buffer_ga3d(ScrnInfoPtr pScrn) +{ + modesettingPtr ms = modesettingPTR(pScrn); + ScreenPtr pScreen = pScrn->pScreen; + PixmapPtr rootPixmap = pScreen->GetScreenPixmap(pScreen); + struct pipe_texture *check; + + xorg_exa_set_displayed_usage(rootPixmap); + xorg_exa_set_shared_usage(rootPixmap); + xorg_exa_set_texture(rootPixmap, ms->root_texture); + if (!pScreen->ModifyPixmapHeader(rootPixmap, -1, -1, -1, -1, -1, NULL)) + FatalError("Couldn't adjust screen pixmap\n"); + + check = xorg_exa_get_texture(rootPixmap); + if (ms->root_texture != check) + FatalError("Created new root texture\n"); + + pipe_texture_reference(&check, NULL); + return TRUE; +} + +#ifdef HAVE_LIBKMS +static Bool +drv_destroy_front_buffer_kms(ScrnInfoPtr pScrn) +{ + modesettingPtr ms = modesettingPTR(pScrn); + + if (!ms->root_bo) + return TRUE; + + kms_bo_unmap(ms->root_bo); + kms_bo_destroy(ms->root_bo); + ms->root_bo = NULL; + return TRUE; +} + +static Bool +drv_create_front_buffer_kms(ScrnInfoPtr pScrn) +{ + modesettingPtr ms = modesettingPTR(pScrn); + unsigned handle, stride; + struct kms_bo *bo; + unsigned attr[8]; + + attr[0] = KMS_BO_TYPE; + attr[1] = KMS_BO_TYPE_SCANOUT; + attr[2] = KMS_WIDTH; + attr[3] = pScrn->virtualX; + attr[4] = KMS_HEIGHT; + attr[5] = pScrn->virtualY; + attr[6] = 0; + + if (kms_bo_create(ms->kms, attr, &bo)) + return FALSE; + + if (kms_bo_get_prop(bo, KMS_PITCH, &stride)) + goto err_destroy; + + if (kms_bo_get_prop(bo, KMS_HANDLE, &handle)) + goto err_destroy; + + drmModeAddFB(ms->fd, + pScrn->virtualX, + pScrn->virtualY, + pScrn->depth, + pScrn->bitsPerPixel, + stride, + handle, + &ms->fb_id); + + pScrn->frameX0 = 0; + pScrn->frameY0 = 0; + drv_adjust_frame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + ms->root_bo = bo; + + return TRUE; + +err_destroy: + kms_bo_destroy(bo); + return FALSE; +} + +static Bool +drv_bind_front_buffer_kms(ScrnInfoPtr pScrn) +{ + modesettingPtr ms = modesettingPTR(pScrn); + ScreenPtr pScreen = pScrn->pScreen; + PixmapPtr rootPixmap = pScreen->GetScreenPixmap(pScreen); + unsigned stride; + void *ptr; + + if (kms_bo_get_prop(ms->root_bo, KMS_PITCH, &stride)) + return FALSE; + + if (kms_bo_map(ms->root_bo, &ptr)) + return FALSE; + + pScreen->ModifyPixmapHeader(rootPixmap, + pScreen->width, + pScreen->height, + pScreen->rootDepth, + pScrn->bitsPerPixel, + stride, + ptr); + return TRUE; +} +#endif /* HAVE_LIBKMS */ + +static Bool drv_init_front_buffer_functions(ScrnInfoPtr pScrn) +{ + modesettingPtr ms = modesettingPTR(pScrn); + if (ms->screen) { + ms->destroy_front_buffer = drv_destroy_front_buffer_ga3d; + ms->create_front_buffer = drv_create_front_buffer_ga3d; + ms->bind_front_buffer = drv_bind_front_buffer_ga3d; +#ifdef HAVE_LIBKMS + } else if (ms->kms) { + ms->destroy_front_buffer = drv_destroy_front_buffer_kms; + ms->create_front_buffer = drv_create_front_buffer_kms; + ms->bind_front_buffer = drv_bind_front_buffer_kms; +#endif + } else + return FALSE; + + return TRUE; +} + /* vim: set sw=4 ts=8 sts=4: */ diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h index 580dae474d..31e11b4809 100644 --- a/src/gallium/state_trackers/xorg/xorg_tracker.h +++ b/src/gallium/state_trackers/xorg/xorg_tracker.h @@ -51,6 +51,8 @@ #define DRV_ERROR(msg) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, msg); +struct kms_bo; +struct kms_driver; struct exa_context; typedef struct @@ -86,6 +88,15 @@ typedef struct _modesettingRec void (*blockHandler)(int, pointer, pointer, pointer); CreateScreenResourcesProcPtr createScreenResources; + /* for frontbuffer backing store */ + Bool (*destroy_front_buffer)(ScrnInfoPtr pScrn); + Bool (*create_front_buffer)(ScrnInfoPtr pScrn); + Bool (*bind_front_buffer)(ScrnInfoPtr pScrn); + + /* kms */ + struct kms_driver *kms; + struct kms_bo *root_bo; + /* gallium */ struct drm_api *api; struct pipe_screen *screen; -- cgit v1.2.3 From ba1ca28cc62fed71c77902b95ae4ed36c6bf25f8 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Nov 2009 13:41:03 +0000 Subject: gallium: simplify tgsi tokens further Drop anonymous 'Extended' fields, have every optional token named explicitly in its parent. Eg. there is now an Instruction.Label flag, etc. Drop destination modifiers and other functionality which cannot be generated by tgsi_ureg.c, which is now the primary way of creating shaders. Pull source modifiers into the source register token, drop the second negate flag. The source register token is now full - if we need to expand it, probably best to move all of the modifiers to a new token and have a single flag for it. --- src/gallium/auxiliary/draw/draw_pipe_aaline.c | 3 +- src/gallium/auxiliary/draw/draw_pipe_pstipple.c | 3 +- src/gallium/auxiliary/tgsi/tgsi_build.c | 271 ++++++------------------ src/gallium/auxiliary/tgsi/tgsi_build.h | 61 ++---- src/gallium/auxiliary/tgsi/tgsi_dump.c | 40 +--- src/gallium/auxiliary/tgsi/tgsi_exec.c | 10 +- src/gallium/auxiliary/tgsi/tgsi_parse.c | 83 +------- src/gallium/auxiliary/tgsi/tgsi_parse.h | 6 +- src/gallium/auxiliary/tgsi/tgsi_scan.c | 7 +- src/gallium/auxiliary/tgsi/tgsi_sse2.c | 3 +- src/gallium/auxiliary/tgsi/tgsi_text.c | 155 +------------- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 34 +-- src/gallium/auxiliary/tgsi/tgsi_util.c | 30 +-- src/gallium/auxiliary/vl/vl_shader_build.c | 3 +- src/gallium/drivers/i915/i915_fpc_translate.c | 2 +- src/gallium/drivers/svga/svga_tgsi_insn.c | 12 +- src/gallium/include/pipe/p_shader_tokens.h | 158 ++------------ 17 files changed, 160 insertions(+), 721 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index 9f956715a2..e374010fee 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -268,7 +268,8 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY; newInst.FullDstRegisters[0].DstRegister.Index = aactx->texTemp; newInst.Instruction.NumSrcRegs = 2; - newInst.InstructionExtTexture.Texture = TGSI_TEXTURE_2D; + newInst.Instruction.Texture = TRUE; + newInst.InstructionTexture.Texture = TGSI_TEXTURE_2D; newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_INPUT; newInst.FullSrcRegisters[0].SrcRegister.Index = aactx->maxInput + 1; newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER; diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c index 283502cdf3..9de06e37ed 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c @@ -296,7 +296,8 @@ pstip_transform_inst(struct tgsi_transform_context *ctx, newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY; newInst.FullDstRegisters[0].DstRegister.Index = pctx->texTemp; newInst.Instruction.NumSrcRegs = 2; - newInst.InstructionExtTexture.Texture = TGSI_TEXTURE_2D; + newInst.Instruction.Texture = TRUE; + newInst.InstructionTexture.Texture = TGSI_TEXTURE_2D; newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY; newInst.FullSrcRegisters[0].SrcRegister.Index = pctx->texTemp; newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER; diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index 9791e58db3..ce9e72e8b5 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -122,7 +122,6 @@ tgsi_default_declaration( void ) declaration.Centroid = 0; declaration.Invariant = 0; declaration.Padding = 0; - declaration.Extended = 0; return declaration; } @@ -311,7 +310,6 @@ tgsi_default_immediate( void ) immediate.NrTokens = 1; immediate.DataType = TGSI_IMM_FLOAT32; immediate.Padding = 0; - immediate.Extended = 0; return immediate; } @@ -422,8 +420,9 @@ tgsi_default_instruction( void ) instruction.Predicate = 0; instruction.NumDstRegs = 1; instruction.NumSrcRegs = 1; + instruction.Label = 0; + instruction.Texture = 0; instruction.Padding = 0; - instruction.Extended = 0; return instruction; } @@ -475,8 +474,8 @@ tgsi_default_full_instruction( void ) full_instruction.Instruction = tgsi_default_instruction(); full_instruction.InstructionPredicate = tgsi_default_instruction_predicate(); - full_instruction.InstructionExtLabel = tgsi_default_instruction_ext_label(); - full_instruction.InstructionExtTexture = tgsi_default_instruction_ext_texture(); + full_instruction.InstructionLabel = tgsi_default_instruction_label(); + full_instruction.InstructionTexture = tgsi_default_instruction_texture(); for( i = 0; i < TGSI_FULL_MAX_DST_REGISTERS; i++ ) { full_instruction.FullDstRegisters[i] = tgsi_default_full_dst_register(); } @@ -534,42 +533,42 @@ tgsi_build_full_instruction( header); } - if( tgsi_compare_instruction_ext_label( - full_inst->InstructionExtLabel, - tgsi_default_instruction_ext_label() ) ) { - struct tgsi_instruction_ext_label *instruction_ext_label; + if( tgsi_compare_instruction_label( + full_inst->InstructionLabel, + tgsi_default_instruction_label() ) ) { + struct tgsi_instruction_label *instruction_label; if( maxsize <= size ) return 0; - instruction_ext_label = - (struct tgsi_instruction_ext_label *) &tokens[size]; + instruction_label = + (struct tgsi_instruction_label *) &tokens[size]; size++; - *instruction_ext_label = tgsi_build_instruction_ext_label( - full_inst->InstructionExtLabel.Label, + *instruction_label = tgsi_build_instruction_label( + full_inst->InstructionLabel.Label, prev_token, instruction, header ); - prev_token = (struct tgsi_token *) instruction_ext_label; + prev_token = (struct tgsi_token *) instruction_label; } - if( tgsi_compare_instruction_ext_texture( - full_inst->InstructionExtTexture, - tgsi_default_instruction_ext_texture() ) ) { - struct tgsi_instruction_ext_texture *instruction_ext_texture; + if( tgsi_compare_instruction_texture( + full_inst->InstructionTexture, + tgsi_default_instruction_texture() ) ) { + struct tgsi_instruction_texture *instruction_texture; if( maxsize <= size ) return 0; - instruction_ext_texture = - (struct tgsi_instruction_ext_texture *) &tokens[size]; + instruction_texture = + (struct tgsi_instruction_texture *) &tokens[size]; size++; - *instruction_ext_texture = tgsi_build_instruction_ext_texture( - full_inst->InstructionExtTexture.Texture, + *instruction_texture = tgsi_build_instruction_texture( + full_inst->InstructionTexture.Texture, prev_token, instruction, header ); - prev_token = (struct tgsi_token *) instruction_ext_texture; + prev_token = (struct tgsi_token *) instruction_texture; } for( i = 0; i < full_inst->Instruction.NumDstRegs; i++ ) { @@ -591,25 +590,6 @@ tgsi_build_full_instruction( header ); prev_token = (struct tgsi_token *) dst_register; - if( tgsi_compare_dst_register_ext_modulate( - reg->DstRegisterExtModulate, - tgsi_default_dst_register_ext_modulate() ) ) { - struct tgsi_dst_register_ext_modulate *dst_register_ext_modulate; - - if( maxsize <= size ) - return 0; - dst_register_ext_modulate = - (struct tgsi_dst_register_ext_modulate *) &tokens[size]; - size++; - - *dst_register_ext_modulate = tgsi_build_dst_register_ext_modulate( - reg->DstRegisterExtModulate.Modulate, - prev_token, - instruction, - header ); - prev_token = (struct tgsi_token *) dst_register_ext_modulate; - } - if( reg->DstRegister.Indirect ) { struct tgsi_src_register *ind; @@ -625,6 +605,7 @@ tgsi_build_full_instruction( reg->DstRegisterInd.SwizzleZ, reg->DstRegisterInd.SwizzleW, reg->DstRegisterInd.Negate, + reg->DstRegisterInd.Absolute, reg->DstRegisterInd.Indirect, reg->DstRegisterInd.Dimension, reg->DstRegisterInd.Index, @@ -650,6 +631,7 @@ tgsi_build_full_instruction( reg->SrcRegister.SwizzleZ, reg->SrcRegister.SwizzleW, reg->SrcRegister.Negate, + reg->SrcRegister.Absolute, reg->SrcRegister.Indirect, reg->SrcRegister.Dimension, reg->SrcRegister.Index, @@ -657,29 +639,6 @@ tgsi_build_full_instruction( header ); prev_token = (struct tgsi_token *) src_register; - if( tgsi_compare_src_register_ext_mod( - reg->SrcRegisterExtMod, - tgsi_default_src_register_ext_mod() ) ) { - struct tgsi_src_register_ext_mod *src_register_ext_mod; - - if( maxsize <= size ) - return 0; - src_register_ext_mod = - (struct tgsi_src_register_ext_mod *) &tokens[size]; - size++; - - *src_register_ext_mod = tgsi_build_src_register_ext_mod( - reg->SrcRegisterExtMod.Complement, - reg->SrcRegisterExtMod.Bias, - reg->SrcRegisterExtMod.Scale2X, - reg->SrcRegisterExtMod.Absolute, - reg->SrcRegisterExtMod.Negate, - prev_token, - instruction, - header ); - prev_token = (struct tgsi_token *) src_register_ext_mod; - } - if( reg->SrcRegister.Indirect ) { struct tgsi_src_register *ind; @@ -695,6 +654,7 @@ tgsi_build_full_instruction( reg->SrcRegisterInd.SwizzleZ, reg->SrcRegisterInd.SwizzleW, reg->SrcRegisterInd.Negate, + reg->SrcRegisterInd.Absolute, reg->SrcRegisterInd.Indirect, reg->SrcRegisterInd.Dimension, reg->SrcRegisterInd.Index, @@ -733,6 +693,7 @@ tgsi_build_full_instruction( reg->SrcRegisterDimInd.SwizzleZ, reg->SrcRegisterDimInd.SwizzleW, reg->SrcRegisterDimInd.Negate, + reg->SrcRegisterDimInd.Absolute, reg->SrcRegisterDimInd.Indirect, reg->SrcRegisterDimInd.Dimension, reg->SrcRegisterDimInd.Index, @@ -793,86 +754,80 @@ compare32(const void *a, const void *b) return *((uint32_t *) a) != *((uint32_t *) b); } -struct tgsi_instruction_ext_label -tgsi_default_instruction_ext_label( void ) +struct tgsi_instruction_label +tgsi_default_instruction_label( void ) { - struct tgsi_instruction_ext_label instruction_ext_label; + struct tgsi_instruction_label instruction_label; - instruction_ext_label.Type = TGSI_INSTRUCTION_EXT_TYPE_LABEL; - instruction_ext_label.Label = 0; - instruction_ext_label.Padding = 0; - instruction_ext_label.Extended = 0; + instruction_label.Label = 0; + instruction_label.Padding = 0; - return instruction_ext_label; + return instruction_label; } unsigned -tgsi_compare_instruction_ext_label( - struct tgsi_instruction_ext_label a, - struct tgsi_instruction_ext_label b ) +tgsi_compare_instruction_label( + struct tgsi_instruction_label a, + struct tgsi_instruction_label b ) { a.Padding = b.Padding = 0; - a.Extended = b.Extended = 0; return compare32(&a, &b); } -struct tgsi_instruction_ext_label -tgsi_build_instruction_ext_label( +struct tgsi_instruction_label +tgsi_build_instruction_label( unsigned label, struct tgsi_token *prev_token, struct tgsi_instruction *instruction, struct tgsi_header *header ) { - struct tgsi_instruction_ext_label instruction_ext_label; + struct tgsi_instruction_label instruction_label; - instruction_ext_label = tgsi_default_instruction_ext_label(); - instruction_ext_label.Label = label; + instruction_label = tgsi_default_instruction_label(); + instruction_label.Label = label; + instruction->Label = 1; - prev_token->Extended = 1; instruction_grow( instruction, header ); - return instruction_ext_label; + return instruction_label; } -struct tgsi_instruction_ext_texture -tgsi_default_instruction_ext_texture( void ) +struct tgsi_instruction_texture +tgsi_default_instruction_texture( void ) { - struct tgsi_instruction_ext_texture instruction_ext_texture; + struct tgsi_instruction_texture instruction_texture; - instruction_ext_texture.Type = TGSI_INSTRUCTION_EXT_TYPE_TEXTURE; - instruction_ext_texture.Texture = TGSI_TEXTURE_UNKNOWN; - instruction_ext_texture.Padding = 0; - instruction_ext_texture.Extended = 0; + instruction_texture.Texture = TGSI_TEXTURE_UNKNOWN; + instruction_texture.Padding = 0; - return instruction_ext_texture; + return instruction_texture; } unsigned -tgsi_compare_instruction_ext_texture( - struct tgsi_instruction_ext_texture a, - struct tgsi_instruction_ext_texture b ) +tgsi_compare_instruction_texture( + struct tgsi_instruction_texture a, + struct tgsi_instruction_texture b ) { a.Padding = b.Padding = 0; - a.Extended = b.Extended = 0; return compare32(&a, &b); } -struct tgsi_instruction_ext_texture -tgsi_build_instruction_ext_texture( +struct tgsi_instruction_texture +tgsi_build_instruction_texture( unsigned texture, struct tgsi_token *prev_token, struct tgsi_instruction *instruction, struct tgsi_header *header ) { - struct tgsi_instruction_ext_texture instruction_ext_texture; + struct tgsi_instruction_texture instruction_texture; - instruction_ext_texture = tgsi_default_instruction_ext_texture(); - instruction_ext_texture.Texture = texture; + instruction_texture = tgsi_default_instruction_texture(); + instruction_texture.Texture = texture; + instruction->Texture = 1; - prev_token->Extended = 1; instruction_grow( instruction, header ); - return instruction_ext_texture; + return instruction_texture; } struct tgsi_src_register @@ -886,10 +841,10 @@ tgsi_default_src_register( void ) src_register.SwizzleZ = TGSI_SWIZZLE_Z; src_register.SwizzleW = TGSI_SWIZZLE_W; src_register.Negate = 0; + src_register.Absolute = 0; src_register.Indirect = 0; src_register.Dimension = 0; src_register.Index = 0; - src_register.Extended = 0; return src_register; } @@ -902,6 +857,7 @@ tgsi_build_src_register( unsigned swizzle_z, unsigned swizzle_w, unsigned negate, + unsigned absolute, unsigned indirect, unsigned dimension, int index, @@ -925,6 +881,7 @@ tgsi_build_src_register( src_register.SwizzleZ = swizzle_z; src_register.SwizzleW = swizzle_w; src_register.Negate = negate; + src_register.Absolute = absolute; src_register.Indirect = indirect; src_register.Dimension = dimension; src_register.Index = index; @@ -940,7 +897,6 @@ tgsi_default_full_src_register( void ) struct tgsi_full_src_register full_src_register; full_src_register.SrcRegister = tgsi_default_src_register(); - full_src_register.SrcRegisterExtMod = tgsi_default_src_register_ext_mod(); full_src_register.SrcRegisterInd = tgsi_default_src_register(); full_src_register.SrcRegisterDim = tgsi_default_dimension(); full_src_register.SrcRegisterDimInd = tgsi_default_src_register(); @@ -949,65 +905,6 @@ tgsi_default_full_src_register( void ) } -struct tgsi_src_register_ext_mod -tgsi_default_src_register_ext_mod( void ) -{ - struct tgsi_src_register_ext_mod src_register_ext_mod; - - src_register_ext_mod.Type = TGSI_SRC_REGISTER_EXT_TYPE_MOD; - src_register_ext_mod.Complement = 0; - src_register_ext_mod.Bias = 0; - src_register_ext_mod.Scale2X = 0; - src_register_ext_mod.Absolute = 0; - src_register_ext_mod.Negate = 0; - src_register_ext_mod.Padding = 0; - src_register_ext_mod.Extended = 0; - - return src_register_ext_mod; -} - -unsigned -tgsi_compare_src_register_ext_mod( - struct tgsi_src_register_ext_mod a, - struct tgsi_src_register_ext_mod b ) -{ - a.Padding = b.Padding = 0; - a.Extended = b.Extended = 0; - return compare32(&a, &b); -} - -struct tgsi_src_register_ext_mod -tgsi_build_src_register_ext_mod( - unsigned complement, - unsigned bias, - unsigned scale_2x, - unsigned absolute, - unsigned negate, - struct tgsi_token *prev_token, - struct tgsi_instruction *instruction, - struct tgsi_header *header ) -{ - struct tgsi_src_register_ext_mod src_register_ext_mod; - - assert( complement <= 1 ); - assert( bias <= 1 ); - assert( scale_2x <= 1 ); - assert( absolute <= 1 ); - assert( negate <= 1 ); - - src_register_ext_mod = tgsi_default_src_register_ext_mod(); - src_register_ext_mod.Complement = complement; - src_register_ext_mod.Bias = bias; - src_register_ext_mod.Scale2X = scale_2x; - src_register_ext_mod.Absolute = absolute; - src_register_ext_mod.Negate = negate; - - prev_token->Extended = 1; - instruction_grow( instruction, header ); - - return src_register_ext_mod; -} - struct tgsi_dimension tgsi_default_dimension( void ) { @@ -1017,7 +914,6 @@ tgsi_default_dimension( void ) dimension.Dimension = 0; dimension.Padding = 0; dimension.Index = 0; - dimension.Extended = 0; return dimension; } @@ -1051,7 +947,6 @@ tgsi_default_dst_register( void ) dst_register.Dimension = 0; dst_register.Index = 0; dst_register.Padding = 0; - dst_register.Extended = 0; return dst_register; } @@ -1089,51 +984,7 @@ tgsi_default_full_dst_register( void ) full_dst_register.DstRegister = tgsi_default_dst_register(); full_dst_register.DstRegisterInd = tgsi_default_src_register(); - full_dst_register.DstRegisterExtModulate = - tgsi_default_dst_register_ext_modulate(); return full_dst_register; } -struct tgsi_dst_register_ext_modulate -tgsi_default_dst_register_ext_modulate( void ) -{ - struct tgsi_dst_register_ext_modulate dst_register_ext_modulate; - - dst_register_ext_modulate.Type = TGSI_DST_REGISTER_EXT_TYPE_MODULATE; - dst_register_ext_modulate.Modulate = TGSI_MODULATE_1X; - dst_register_ext_modulate.Padding = 0; - dst_register_ext_modulate.Extended = 0; - - return dst_register_ext_modulate; -} - -unsigned -tgsi_compare_dst_register_ext_modulate( - struct tgsi_dst_register_ext_modulate a, - struct tgsi_dst_register_ext_modulate b ) -{ - a.Padding = b.Padding = 0; - a.Extended = b.Extended = 0; - return compare32(&a, &b); -} - -struct tgsi_dst_register_ext_modulate -tgsi_build_dst_register_ext_modulate( - unsigned modulate, - struct tgsi_token *prev_token, - struct tgsi_instruction *instruction, - struct tgsi_header *header ) -{ - struct tgsi_dst_register_ext_modulate dst_register_ext_modulate; - - assert( modulate <= TGSI_MODULATE_EIGHTH ); - - dst_register_ext_modulate = tgsi_default_dst_register_ext_modulate(); - dst_register_ext_modulate.Modulate = modulate; - - prev_token->Extended = 1; - instruction_grow( instruction, header ); - - return dst_register_ext_modulate; -} diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.h b/src/gallium/auxiliary/tgsi/tgsi_build.h index 0fe5f229d3..0fbc8b1b0a 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.h +++ b/src/gallium/auxiliary/tgsi/tgsi_build.h @@ -171,31 +171,31 @@ tgsi_build_instruction_predicate(int index, struct tgsi_instruction *instruction, struct tgsi_header *header); -struct tgsi_instruction_ext_label -tgsi_default_instruction_ext_label( void ); +struct tgsi_instruction_label +tgsi_default_instruction_label( void ); unsigned -tgsi_compare_instruction_ext_label( - struct tgsi_instruction_ext_label a, - struct tgsi_instruction_ext_label b ); +tgsi_compare_instruction_label( + struct tgsi_instruction_label a, + struct tgsi_instruction_label b ); -struct tgsi_instruction_ext_label -tgsi_build_instruction_ext_label( +struct tgsi_instruction_label +tgsi_build_instruction_label( unsigned label, struct tgsi_token *prev_token, struct tgsi_instruction *instruction, struct tgsi_header *header ); -struct tgsi_instruction_ext_texture -tgsi_default_instruction_ext_texture( void ); +struct tgsi_instruction_texture +tgsi_default_instruction_texture( void ); unsigned -tgsi_compare_instruction_ext_texture( - struct tgsi_instruction_ext_texture a, - struct tgsi_instruction_ext_texture b ); +tgsi_compare_instruction_texture( + struct tgsi_instruction_texture a, + struct tgsi_instruction_texture b ); -struct tgsi_instruction_ext_texture -tgsi_build_instruction_ext_texture( +struct tgsi_instruction_texture +tgsi_build_instruction_texture( unsigned texture, struct tgsi_token *prev_token, struct tgsi_instruction *instruction, @@ -212,6 +212,7 @@ tgsi_build_src_register( unsigned swizzle_z, unsigned swizzle_w, unsigned negate, + unsigned absolute, unsigned indirect, unsigned dimension, int index, @@ -221,24 +222,6 @@ tgsi_build_src_register( struct tgsi_full_src_register tgsi_default_full_src_register( void ); -struct tgsi_src_register_ext_mod -tgsi_default_src_register_ext_mod( void ); - -unsigned -tgsi_compare_src_register_ext_mod( - struct tgsi_src_register_ext_mod a, - struct tgsi_src_register_ext_mod b ); - -struct tgsi_src_register_ext_mod -tgsi_build_src_register_ext_mod( - unsigned complement, - unsigned bias, - unsigned scale_2x, - unsigned absolute, - unsigned negate, - struct tgsi_token *prev_token, - struct tgsi_instruction *instruction, - struct tgsi_header *header ); struct tgsi_dimension tgsi_default_dimension( void ); @@ -265,20 +248,6 @@ tgsi_build_dst_register( struct tgsi_full_dst_register tgsi_default_full_dst_register( void ); -struct tgsi_dst_register_ext_modulate -tgsi_default_dst_register_ext_modulate( void ); - -unsigned -tgsi_compare_dst_register_ext_modulate( - struct tgsi_dst_register_ext_modulate a, - struct tgsi_dst_register_ext_modulate b ); - -struct tgsi_dst_register_ext_modulate -tgsi_build_dst_register_ext_modulate( - unsigned modulate, - struct tgsi_token *prev_token, - struct tgsi_instruction *instruction, - struct tgsi_header *header ); #if defined __cplusplus } diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index d16e64f9c5..7eb64167fb 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -150,17 +150,6 @@ static const char *texture_names[] = }; -static const char *modulate_names[TGSI_MODULATE_COUNT] = -{ - "", - "_2X", - "_4X", - "_8X", - "_D2", - "_D4", - "_D8" -}; - static void _dump_register( struct dump_ctx *ctx, @@ -385,7 +374,6 @@ iter_instruction( dst->DstRegister.Index, dst->DstRegister.Index ); } - ENM( dst->DstRegisterExtModulate.Modulate, modulate_names ); _dump_writemask( ctx, dst->DstRegister.WriteMask ); first_reg = FALSE; @@ -398,18 +386,10 @@ iter_instruction( CHR( ',' ); CHR( ' ' ); - if (src->SrcRegisterExtMod.Negate) + if (src->SrcRegister.Negate) TXT( "-(" ); - if (src->SrcRegisterExtMod.Absolute) + if (src->SrcRegister.Absolute) CHR( '|' ); - if (src->SrcRegisterExtMod.Scale2X) - TXT( "2*(" ); - if (src->SrcRegisterExtMod.Bias) - CHR( '(' ); - if (src->SrcRegisterExtMod.Complement) - TXT( "1-(" ); - if (src->SrcRegister.Negate) - CHR( '-' ); if (src->SrcRegister.Indirect) { _dump_register_ind( @@ -439,23 +419,17 @@ iter_instruction( ENM( src->SrcRegister.SwizzleW, swizzle_names ); } - if (src->SrcRegisterExtMod.Complement) - CHR( ')' ); - if (src->SrcRegisterExtMod.Bias) - TXT( ")-.5" ); - if (src->SrcRegisterExtMod.Scale2X) - CHR( ')' ); - if (src->SrcRegisterExtMod.Absolute) + if (src->SrcRegister.Absolute) CHR( '|' ); - if (src->SrcRegisterExtMod.Negate) + if (src->SrcRegister.Negate) CHR( ')' ); first_reg = FALSE; } - if (inst->InstructionExtTexture.Texture != TGSI_TEXTURE_UNKNOWN) { + if (inst->Instruction.Texture) { TXT( ", " ); - ENM( inst->InstructionExtTexture.Texture, texture_names ); + ENM( inst->InstructionTexture.Texture, texture_names ); } switch (inst->Instruction.Opcode) { @@ -465,7 +439,7 @@ iter_instruction( case TGSI_OPCODE_ENDLOOP: case TGSI_OPCODE_CAL: TXT( " :" ); - UID( inst->InstructionExtLabel.Label ); + UID( inst->InstructionLabel.Label ); break; } diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 89740cee89..61d38e57f1 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -1397,10 +1397,6 @@ fetch_source( case TGSI_UTIL_SIGN_KEEP: break; } - - if (reg->SrcRegisterExtMod.Complement) { - micro_sub( chan, &mach->Temps[TEMP_1_I].xyzw[TEMP_1_C], chan ); - } } static void @@ -1679,7 +1675,7 @@ exec_tex(struct tgsi_exec_machine *mach, /* debug_printf("Sampler %u unit %u\n", sampler, unit); */ - switch (inst->InstructionExtTexture.Texture) { + switch (inst->InstructionTexture.Texture) { case TGSI_TEXTURE_1D: case TGSI_TEXTURE_SHADOW1D: @@ -1777,7 +1773,7 @@ exec_txd(struct tgsi_exec_machine *mach, * XXX: This is fake TXD -- the derivatives are not taken into account, yet. */ - switch (inst->InstructionExtTexture.Texture) { + switch (inst->InstructionTexture.Texture) { case TGSI_TEXTURE_1D: case TGSI_TEXTURE_SHADOW1D: @@ -2744,7 +2740,7 @@ exec_instruction( mach->FuncStack[mach->FuncStackTop++] = mach->FuncMask; /* Finally, jump to the subroutine */ - *pc = inst->InstructionExtLabel.Label; + *pc = inst->InstructionLabel.Label; } break; diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c index 9ca2993452..853485b48b 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.c +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c @@ -28,7 +28,6 @@ #include "util/u_debug.h" #include "pipe/p_shader_tokens.h" #include "tgsi_parse.h" -#include "tgsi_build.h" #include "util/u_memory.h" void @@ -59,7 +58,7 @@ tgsi_parse_init( ctx->FullHeader.Processor = *(struct tgsi_processor *) &tokens[2]; } else { - ctx->FullHeader.Processor = tgsi_default_processor(); + return TGSI_PARSE_ERROR; } ctx->Tokens = tokens; @@ -129,7 +128,7 @@ tgsi_parse_token( { struct tgsi_full_declaration *decl = &ctx->FullToken.FullDeclaration; - *decl = tgsi_default_full_declaration(); + memset(decl, 0, sizeof *decl); copy_token(&decl->Declaration, &token); next_token( ctx, &decl->DeclarationRange ); @@ -145,9 +144,8 @@ tgsi_parse_token( { struct tgsi_full_immediate *imm = &ctx->FullToken.FullImmediate; - *imm = tgsi_default_full_immediate(); + memset(imm, 0, sizeof *imm); copy_token(&imm->Immediate, &token); - assert( !imm->Immediate.Extended ); switch (imm->Immediate.DataType) { case TGSI_IMM_FLOAT32: @@ -169,41 +167,25 @@ tgsi_parse_token( case TGSI_TOKEN_TYPE_INSTRUCTION: { struct tgsi_full_instruction *inst = &ctx->FullToken.FullInstruction; - unsigned extended; - *inst = tgsi_default_full_instruction(); + memset(inst, 0, sizeof *inst); copy_token(&inst->Instruction, &token); - extended = inst->Instruction.Extended; if (inst->Instruction.Predicate) { next_token(ctx, &inst->InstructionPredicate); } - while( extended ) { - struct tgsi_src_register_ext token; - - next_token( ctx, &token ); - - switch( token.Type ) { - case TGSI_INSTRUCTION_EXT_TYPE_LABEL: - copy_token(&inst->InstructionExtLabel, &token); - break; - - case TGSI_INSTRUCTION_EXT_TYPE_TEXTURE: - copy_token(&inst->InstructionExtTexture, &token); - break; - - default: - assert( 0 ); - } + if (inst->Instruction.Label) { + next_token( ctx, &inst->InstructionLabel); + } - extended = token.Extended; + if (inst->Instruction.Texture) { + next_token( ctx, &inst->InstructionTexture); } assert( inst->Instruction.NumDstRegs <= TGSI_FULL_MAX_DST_REGISTERS ); for( i = 0; i < inst->Instruction.NumDstRegs; i++ ) { - unsigned extended; next_token( ctx, &inst->FullDstRegisters[i].DstRegister ); @@ -212,65 +194,23 @@ tgsi_parse_token( */ assert( !inst->FullDstRegisters[i].DstRegister.Dimension ); - extended = inst->FullDstRegisters[i].DstRegister.Extended; - - while( extended ) { - struct tgsi_src_register_ext token; - - next_token( ctx, &token ); - - switch( token.Type ) { - case TGSI_DST_REGISTER_EXT_TYPE_MODULATE: - copy_token(&inst->FullDstRegisters[i].DstRegisterExtModulate, - &token); - break; - - default: - assert( 0 ); - } - - extended = token.Extended; - } - if( inst->FullDstRegisters[i].DstRegister.Indirect ) { next_token( ctx, &inst->FullDstRegisters[i].DstRegisterInd ); /* * No support for indirect or multi-dimensional addressing. */ - assert( !inst->FullDstRegisters[i].DstRegisterInd.Indirect ); assert( !inst->FullDstRegisters[i].DstRegisterInd.Dimension ); - assert( !inst->FullDstRegisters[i].DstRegisterInd.Extended ); + assert( !inst->FullDstRegisters[i].DstRegisterInd.Indirect ); } } assert( inst->Instruction.NumSrcRegs <= TGSI_FULL_MAX_SRC_REGISTERS ); for( i = 0; i < inst->Instruction.NumSrcRegs; i++ ) { - unsigned extended; next_token( ctx, &inst->FullSrcRegisters[i].SrcRegister ); - extended = inst->FullSrcRegisters[i].SrcRegister.Extended; - - while( extended ) { - struct tgsi_src_register_ext token; - - next_token( ctx, &token ); - - switch( token.Type ) { - case TGSI_SRC_REGISTER_EXT_TYPE_MOD: - copy_token(&inst->FullSrcRegisters[i].SrcRegisterExtMod, - &token); - break; - - default: - assert( 0 ); - } - - extended = token.Extended; - } - if( inst->FullSrcRegisters[i].SrcRegister.Indirect ) { next_token( ctx, &inst->FullSrcRegisters[i].SrcRegisterInd ); @@ -279,7 +219,6 @@ tgsi_parse_token( */ assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Indirect ); assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Dimension ); - assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Extended ); } if( inst->FullSrcRegisters[i].SrcRegister.Dimension ) { @@ -289,7 +228,6 @@ tgsi_parse_token( * No support for multi-dimensional addressing. */ assert( !inst->FullSrcRegisters[i].SrcRegisterDim.Dimension ); - assert( !inst->FullSrcRegisters[i].SrcRegisterDim.Extended ); if( inst->FullSrcRegisters[i].SrcRegisterDim.Indirect ) { next_token( ctx, &inst->FullSrcRegisters[i].SrcRegisterDimInd ); @@ -299,7 +237,6 @@ tgsi_parse_token( */ assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Indirect ); assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Dimension ); - assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Extended ); } } } diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h b/src/gallium/auxiliary/tgsi/tgsi_parse.h index cb4772ade8..ba9578c6a5 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.h +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h @@ -49,13 +49,11 @@ struct tgsi_full_dst_register { struct tgsi_dst_register DstRegister; struct tgsi_src_register DstRegisterInd; - struct tgsi_dst_register_ext_modulate DstRegisterExtModulate; }; struct tgsi_full_src_register { struct tgsi_src_register SrcRegister; - struct tgsi_src_register_ext_mod SrcRegisterExtMod; struct tgsi_src_register SrcRegisterInd; struct tgsi_dimension SrcRegisterDim; struct tgsi_src_register SrcRegisterDimInd; @@ -81,8 +79,8 @@ struct tgsi_full_instruction { struct tgsi_instruction Instruction; struct tgsi_instruction_predicate InstructionPredicate; - struct tgsi_instruction_ext_label InstructionExtLabel; - struct tgsi_instruction_ext_texture InstructionExtTexture; + struct tgsi_instruction_label InstructionLabel; + struct tgsi_instruction_texture InstructionTexture; struct tgsi_full_dst_register FullDstRegisters[TGSI_FULL_MAX_DST_REGISTERS]; struct tgsi_full_src_register FullSrcRegisters[TGSI_FULL_MAX_SRC_REGISTERS]; uint Flags; /**< user-defined usage */ diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c index f9c16f1b6c..55595539ec 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c @@ -35,7 +35,6 @@ #include "util/u_math.h" -#include "tgsi/tgsi_build.h" #include "tgsi/tgsi_parse.h" #include "tgsi/tgsi_scan.h" @@ -217,11 +216,7 @@ tgsi_is_passthrough_shader(const struct tgsi_token *tokens) src->SrcRegister.Index != dst->DstRegister.Index || src->SrcRegister.Negate || - src->SrcRegisterExtMod.Negate || - src->SrcRegisterExtMod.Absolute || - src->SrcRegisterExtMod.Scale2X || - src->SrcRegisterExtMod.Bias || - src->SrcRegisterExtMod.Complement || + src->SrcRegister.Absolute || src->SrcRegister.SwizzleX != TGSI_SWIZZLE_X || src->SrcRegister.SwizzleY != TGSI_SWIZZLE_Y || diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index a96fc94c7a..a6cc3a5398 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -1464,7 +1464,8 @@ emit_tex( struct x86_function *func, unsigned count; unsigned i; - switch (inst->InstructionExtTexture.Texture) { + assert(inst->Instruction.Texture); + switch (inst->InstructionTexture.Texture) { case TGSI_TEXTURE_1D: count = 1; break; diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index d2b03ffb2f..7250f98cc9 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -486,16 +486,6 @@ parse_register_dcl( return TRUE; } -static const char *modulate_names[TGSI_MODULATE_COUNT] = -{ - "_1X", - "_2X", - "_4X", - "_8X", - "_D2", - "_D4", - "_D8" -}; static boolean parse_dst_operand( @@ -512,19 +502,6 @@ parse_dst_operand( cur = ctx->cur; eat_opt_white( &cur ); - if (*cur == '_') { - uint i; - - for (i = 0; i < TGSI_MODULATE_COUNT; i++) { - if (str_match_no_case( &cur, modulate_names[i] )) { - if (!is_digit_alpha_underscore( cur )) { - dst->DstRegisterExtModulate.Modulate = i; - ctx->cur = cur; - break; - } - } - } - } if (!parse_opt_writemask( ctx, &writemask )) return FALSE; @@ -577,92 +554,24 @@ parse_src_operand( struct translate_ctx *ctx, struct tgsi_full_src_register *src ) { - const char *cur; - float value; uint file; int index; uint ind_file; int ind_index; uint ind_comp; uint swizzle[4]; - boolean parsed_ext_negate_paren = FALSE; boolean parsed_swizzle; - if (*ctx->cur == '-') { - cur = ctx->cur; - cur++; - eat_opt_white( &cur ); - if (*cur == '(') { - cur++; - 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; - } - } - else if (*ctx->cur == '|') { - ctx->cur++; - eat_opt_white( &ctx->cur ); - src->SrcRegisterExtMod.Absolute = 1; - } - if (*ctx->cur == '-') { ctx->cur++; eat_opt_white( &ctx->cur ); src->SrcRegister.Negate = 1; } - - cur = ctx->cur; - if (parse_float( &cur, &value )) { - if (value == 2.0f) { - eat_opt_white( &cur ); - if (*cur != '*') { - report_error( ctx, "Expected `*'" ); - return FALSE; - } - cur++; - if (*cur != '(') { - report_error( ctx, "Expected `('" ); - return FALSE; - } - cur++; - src->SrcRegisterExtMod.Scale2X = 1; - eat_opt_white( &cur ); - ctx->cur = cur; - } - } - - if (*ctx->cur == '(') { + + if (*ctx->cur == '|') { ctx->cur++; eat_opt_white( &ctx->cur ); - src->SrcRegisterExtMod.Bias = 1; - } - - cur = ctx->cur; - if (parse_float( &cur, &value )) { - if (value == 1.0f) { - eat_opt_white( &cur ); - if (*cur != '-') { - report_error( ctx, "Expected `-'" ); - return FALSE; - } - cur++; - if (*cur != '(') { - report_error( ctx, "Expected `('" ); - return FALSE; - } - cur++; - src->SrcRegisterExtMod.Complement = 1; - eat_opt_white( &cur ); - ctx->cur = cur; - } + src->SrcRegister.Absolute = 1; } if (!parse_register_src(ctx, &file, &index, &ind_file, &ind_index, &ind_comp)) @@ -690,49 +599,7 @@ parse_src_operand( } } - if (src->SrcRegisterExtMod.Complement) { - eat_opt_white( &ctx->cur ); - if (*ctx->cur != ')') { - report_error( ctx, "Expected `)'" ); - return FALSE; - } - ctx->cur++; - } - - if (src->SrcRegisterExtMod.Bias) { - eat_opt_white( &ctx->cur ); - if (*ctx->cur != ')') { - report_error( ctx, "Expected `)'" ); - return FALSE; - } - ctx->cur++; - eat_opt_white( &ctx->cur ); - if (*ctx->cur != '-') { - report_error( ctx, "Expected `-'" ); - return FALSE; - } - ctx->cur++; - eat_opt_white( &ctx->cur ); - if (!parse_float( &ctx->cur, &value )) { - report_error( ctx, "Expected literal floating point" ); - return FALSE; - } - if (value != 0.5f) { - report_error( ctx, "Expected 0.5" ); - return FALSE; - } - } - - if (src->SrcRegisterExtMod.Scale2X) { - eat_opt_white( &ctx->cur ); - if (*ctx->cur != ')') { - report_error( ctx, "Expected `)'" ); - return FALSE; - } - ctx->cur++; - } - - if (src->SrcRegisterExtMod.Absolute) { + if (src->SrcRegister.Absolute) { eat_opt_white( &ctx->cur ); if (*ctx->cur != '|') { report_error( ctx, "Expected `|'" ); @@ -741,14 +608,6 @@ parse_src_operand( ctx->cur++; } - if (parsed_ext_negate_paren) { - eat_opt_white( &ctx->cur ); - if (*ctx->cur != ')') { - report_error( ctx, "Expected `)'" ); - return FALSE; - } - ctx->cur++; - } return TRUE; } @@ -853,7 +712,8 @@ parse_instruction( for (j = 0; j < TGSI_TEXTURE_COUNT; j++) { if (str_match_no_case( &ctx->cur, texture_names[j] )) { if (!is_digit_alpha_underscore( ctx->cur )) { - inst.InstructionExtTexture.Texture = j; + inst.Instruction.Texture = 1; + inst.InstructionTexture.Texture = j; break; } } @@ -879,7 +739,8 @@ parse_instruction( report_error( ctx, "Expected a label" ); return FALSE; } - inst.InstructionExtLabel.Label = target; + inst.Instruction.Label = 1; + inst.InstructionLabel.Label = target; } advance = tgsi_build_full_instruction( diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 5526a5d034..de4bc6edb0 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -48,13 +48,11 @@ union tgsi_any_token { union tgsi_immediate_data imm_data; struct tgsi_instruction insn; struct tgsi_instruction_predicate insn_predicate; - struct tgsi_instruction_ext_label insn_ext_label; - struct tgsi_instruction_ext_texture insn_ext_texture; + struct tgsi_instruction_label insn_label; + struct tgsi_instruction_texture insn_texture; struct tgsi_src_register src; - struct tgsi_src_register_ext_mod src_ext_mod; struct tgsi_dimension dim; struct tgsi_dst_register dst; - struct tgsi_dst_register_ext_modulate dst_ext_mod; unsigned value; }; @@ -575,17 +573,8 @@ ureg_emit_src( struct ureg_program *ureg, out[n].src.SwizzleW = src.SwizzleW; out[n].src.Index = src.Index; out[n].src.Negate = src.Negate; + out[0].src.Absolute = src.Absolute; n++; - - if (src.Absolute) { - out[0].src.Extended = 1; - out[0].src.Negate = 0; - out[n].value = 0; - out[n].src_ext_mod.Type = TGSI_SRC_REGISTER_EXT_TYPE_MOD; - out[n].src_ext_mod.Absolute = 1; - out[n].src_ext_mod.Negate = src.Negate; - n++; - } if (src.Indirect) { out[0].src.Indirect = 1; @@ -712,13 +701,11 @@ ureg_emit_label(struct ureg_program *ureg, return; out = get_tokens( ureg, DOMAIN_INSN, 1 ); - insn = retrieve_token( ureg, DOMAIN_INSN, extended_token ); + out[0].value = 0; - insn->token.Extended = 1; + insn = retrieve_token( ureg, DOMAIN_INSN, extended_token ); + insn->insn.Label = 1; - out[0].value = 0; - out[0].insn_ext_label.Type = TGSI_INSTRUCTION_EXT_TYPE_LABEL; - *label_token = ureg->domain[DOMAIN_INSN].count - 1; } @@ -741,8 +728,7 @@ ureg_fixup_label(struct ureg_program *ureg, { union tgsi_any_token *out = retrieve_token( ureg, DOMAIN_INSN, label_token ); - assert(out->insn_ext_label.Type == TGSI_INSTRUCTION_EXT_TYPE_LABEL); - out->insn_ext_label.Label = instruction_number; + out->insn_label.Label = instruction_number; } @@ -756,11 +742,10 @@ ureg_emit_texture(struct ureg_program *ureg, out = get_tokens( ureg, DOMAIN_INSN, 1 ); insn = retrieve_token( ureg, DOMAIN_INSN, extended_token ); - insn->token.Extended = 1; + insn->insn.Texture = 1; out[0].value = 0; - out[0].insn_ext_texture.Type = TGSI_INSTRUCTION_EXT_TYPE_TEXTURE; - out[0].insn_ext_texture.Texture = target; + out[0].insn_texture.Texture = target; } @@ -961,7 +946,6 @@ static void emit_immediate( struct ureg_program *ureg, out[0].imm.NrTokens = 5; out[0].imm.DataType = TGSI_IMM_FLOAT32; out[0].imm.Padding = 0; - out[0].imm.Extended = 0; out[1].imm_data.Float = v[0]; out[2].imm_data.Float = v[1]; diff --git a/src/gallium/auxiliary/tgsi/tgsi_util.c b/src/gallium/auxiliary/tgsi/tgsi_util.c index 4dee1be9e8..3544011b47 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_util.c +++ b/src/gallium/auxiliary/tgsi/tgsi_util.c @@ -111,10 +111,10 @@ tgsi_util_get_full_src_register_sign_mode( { unsigned sign_mode; - if( reg->SrcRegisterExtMod.Absolute ) { + if( reg->SrcRegister.Absolute ) { /* Consider only the post-abs negation. */ - if( reg->SrcRegisterExtMod.Negate ) { + if( reg->SrcRegister.Negate ) { sign_mode = TGSI_UTIL_SIGN_SET; } else { @@ -122,17 +122,7 @@ tgsi_util_get_full_src_register_sign_mode( } } else { - /* Accumulate the three negations. */ - - unsigned negate; - - negate = reg->SrcRegister.Negate; - - if( reg->SrcRegisterExtMod.Negate ) { - negate = !negate; - } - - if( negate ) { + if( reg->SrcRegister.Negate ) { sign_mode = TGSI_UTIL_SIGN_TOGGLE; } else { @@ -152,26 +142,22 @@ tgsi_util_set_full_src_register_sign_mode( { case TGSI_UTIL_SIGN_CLEAR: reg->SrcRegister.Negate = 0; - reg->SrcRegisterExtMod.Absolute = 1; - reg->SrcRegisterExtMod.Negate = 0; + reg->SrcRegister.Absolute = 1; break; case TGSI_UTIL_SIGN_SET: - reg->SrcRegister.Negate = 0; - reg->SrcRegisterExtMod.Absolute = 1; - reg->SrcRegisterExtMod.Negate = 1; + reg->SrcRegister.Absolute = 1; + reg->SrcRegister.Negate = 1; break; case TGSI_UTIL_SIGN_TOGGLE: reg->SrcRegister.Negate = 1; - reg->SrcRegisterExtMod.Absolute = 0; - reg->SrcRegisterExtMod.Negate = 0; + reg->SrcRegister.Absolute = 0; break; case TGSI_UTIL_SIGN_KEEP: reg->SrcRegister.Negate = 0; - reg->SrcRegisterExtMod.Absolute = 0; - reg->SrcRegisterExtMod.Negate = 0; + reg->SrcRegister.Absolute = 0; break; default: diff --git a/src/gallium/auxiliary/vl/vl_shader_build.c b/src/gallium/auxiliary/vl/vl_shader_build.c index faa20a903c..9637cbed8a 100644 --- a/src/gallium/auxiliary/vl/vl_shader_build.c +++ b/src/gallium/auxiliary/vl/vl_shader_build.c @@ -191,7 +191,8 @@ struct tgsi_full_instruction vl_tex inst.FullDstRegisters[0].DstRegister.File = dst_file; inst.FullDstRegisters[0].DstRegister.Index = dst_index; inst.Instruction.NumSrcRegs = 2; - inst.InstructionExtTexture.Texture = tex; + inst.Instruction.Texture = 1; + inst.InstructionTexture.Texture = tex; inst.FullSrcRegisters[0].SrcRegister.File = src1_file; inst.FullSrcRegisters[0].SrcRegister.Index = src1_index; inst.FullSrcRegisters[1].SrcRegister.File = src2_file; diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c b/src/gallium/drivers/i915/i915_fpc_translate.c index 379d47e79a..a96ba8f192 100644 --- a/src/gallium/drivers/i915/i915_fpc_translate.c +++ b/src/gallium/drivers/i915/i915_fpc_translate.c @@ -339,7 +339,7 @@ emit_tex(struct i915_fp_compile *p, const struct tgsi_full_instruction *inst, uint opcode) { - uint texture = inst->InstructionExtTexture.Texture; + uint texture = inst->InstructionTexture.Texture; uint unit = inst->FullSrcRegisters[1].SrcRegister.Index; uint tex = translate_tex_src_target( p, texture ); uint sampler = i915_emit_decl(p, REG_TYPE_S, unit, tex); diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c b/src/gallium/drivers/svga/svga_tgsi_insn.c index ea409b7e16..3ef6cb1074 100644 --- a/src/gallium/drivers/svga/svga_tgsi_insn.c +++ b/src/gallium/drivers/svga/svga_tgsi_insn.c @@ -227,14 +227,14 @@ translate_src_register( const struct svga_shader_emitter *emit, /* src.mod isn't a bitfield, unfortunately: * See tgsi_util_get_full_src_register_sign_mode for implementation details. */ - if (reg->SrcRegisterExtMod.Absolute) { - if (reg->SrcRegisterExtMod.Negate) + if (reg->SrcRegister.Absolute) { + if (reg->SrcRegister.Negate) src.base.srcMod = SVGA3DSRCMOD_ABSNEG; else src.base.srcMod = SVGA3DSRCMOD_ABS; } else { - if (reg->SrcRegister.Negate != reg->SrcRegisterExtMod.Negate) + if (reg->SrcRegister.Negate) src.base.srcMod = SVGA3DSRCMOD_NEG; else src.base.srcMod = SVGA3DSRCMOD_NONE; @@ -986,8 +986,8 @@ static boolean emit_kil(struct svga_shader_emitter *emit, inst = inst_token( SVGA3DOP_TEXKILL ); src0 = translate_src_register( emit, reg ); - if (reg->SrcRegisterExtMod.Absolute || - reg->SrcRegister.Negate != reg->SrcRegisterExtMod.Negate || + if (reg->SrcRegister.Absolute || + reg->SrcRegister.Negate || reg->SrcRegister.Indirect || reg->SrcRegister.SwizzleX != 0 || reg->SrcRegister.SwizzleY != 1 || @@ -1953,7 +1953,7 @@ static boolean emit_bgnsub( struct svga_shader_emitter *emit, static boolean emit_call( struct svga_shader_emitter *emit, const struct tgsi_full_instruction *insn ) { - unsigned position = insn->InstructionExtLabel.Label; + unsigned position = insn->InstructionLabel.Label; unsigned i; for (i = 0; i < emit->nr_labels; i++) { diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index c4c28522c8..ac999e0c18 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -66,8 +66,7 @@ struct tgsi_token { unsigned Type : 4; /**< TGSI_TOKEN_TYPE_x */ unsigned NrTokens : 8; /**< UINT */ - unsigned Padding : 19; - unsigned Extended : 1; /**< BOOL */ + unsigned Padding : 20; }; enum tgsi_file_type { @@ -117,8 +116,7 @@ struct tgsi_declaration unsigned Semantic : 1; /**< BOOL, any semantic info? */ unsigned Centroid : 1; /**< centroid sampling? */ unsigned Invariant : 1; /**< invariant optimization? */ - unsigned Padding : 4; - unsigned Extended : 1; /**< BOOL */ + unsigned Padding : 5; }; struct tgsi_declaration_range @@ -151,8 +149,7 @@ struct tgsi_immediate unsigned Type : 4; /**< TGSI_TOKEN_TYPE_IMMEDIATE */ unsigned NrTokens : 8; /**< UINT */ unsigned DataType : 4; /**< one of TGSI_IMM_x */ - unsigned Padding : 15; - unsigned Extended : 1; /**< BOOL */ + unsigned Padding : 16; }; union tgsi_immediate_data @@ -295,8 +292,6 @@ union tgsi_immediate_data * * If Predicate is TRUE, tgsi_instruction_predicate token immediately follows. * - * If Extended is TRUE, it is now executed. - * * Saturate controls how are final results in destination registers modified. */ @@ -309,12 +304,15 @@ struct tgsi_instruction unsigned NumDstRegs : 2; /* UINT */ unsigned NumSrcRegs : 4; /* UINT */ unsigned Predicate : 1; /* BOOL */ - unsigned Padding : 2; - unsigned Extended : 1; /* BOOL */ + unsigned Label : 1; + unsigned Texture : 1; + unsigned Padding : 1; }; /* - * If tgsi_instruction::Extended is TRUE, tgsi_instruction_ext follows. + * If tgsi_instruction::Label is TRUE, tgsi_instruction_label follows. + * + * If tgsi_instruction::Texture is TRUE, tgsi_instruction_texture follows. * * Then, tgsi_instruction::NumDstRegs of tgsi_dst_register follow. * @@ -324,38 +322,15 @@ struct tgsi_instruction * instruction, including the instruction word. */ -#define TGSI_INSTRUCTION_EXT_TYPE_LABEL 1 -#define TGSI_INSTRUCTION_EXT_TYPE_TEXTURE 2 - -struct tgsi_instruction_ext -{ - unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_ */ - unsigned Padding : 27; - unsigned Extended : 1; /* BOOL */ -}; - -/* - * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_LABEL, it - * should be cast to tgsi_instruction_ext_label. - * - * If tgsi_instruction_ext::Type is TGSI_INSTRUCTION_EXT_TYPE_TEXTURE, it - * should be cast to tgsi_instruction_ext_texture. - * - * If tgsi_instruction_ext::Extended is TRUE, another tgsi_instruction_ext - * follows. - */ - #define TGSI_SWIZZLE_X 0 #define TGSI_SWIZZLE_Y 1 #define TGSI_SWIZZLE_Z 2 #define TGSI_SWIZZLE_W 3 -struct tgsi_instruction_ext_label +struct tgsi_instruction_label { - unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_LABEL */ unsigned Label : 24; /* UINT */ - unsigned Padding : 3; - unsigned Extended : 1; /* BOOL */ + unsigned Padding : 8; }; #define TGSI_TEXTURE_UNKNOWN 0 @@ -369,12 +344,10 @@ struct tgsi_instruction_ext_label #define TGSI_TEXTURE_SHADOWRECT 8 #define TGSI_TEXTURE_COUNT 9 -struct tgsi_instruction_ext_texture +struct tgsi_instruction_texture { - unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_TEXTURE */ unsigned Texture : 8; /* TGSI_TEXTURE_ */ - unsigned Padding : 19; - unsigned Extended : 1; /* BOOL */ + unsigned Padding : 24; }; /* @@ -406,26 +379,24 @@ struct tgsi_instruction_predicate * The fetched register components are swizzled according to SwizzleX, SwizzleY, * SwizzleZ and SwizzleW. * - * If Extended is TRUE, any further modifications to the source register are - * made to this temporary storage. */ struct tgsi_src_register { unsigned File : 4; /* TGSI_FILE_ */ + unsigned Indirect : 1; /* BOOL */ + unsigned Dimension : 1; /* BOOL */ + int Index : 16; /* SINT */ unsigned SwizzleX : 2; /* TGSI_SWIZZLE_ */ unsigned SwizzleY : 2; /* TGSI_SWIZZLE_ */ unsigned SwizzleZ : 2; /* TGSI_SWIZZLE_ */ unsigned SwizzleW : 2; /* TGSI_SWIZZLE_ */ - unsigned Negate : 1; /* BOOL */ - unsigned Indirect : 1; /* BOOL */ - unsigned Dimension : 1; /* BOOL */ - int Index : 16; /* SINT */ - unsigned Extended : 1; /* BOOL */ + unsigned Absolute : 1; /* BOOL */ + unsigned Negate : 1; /* BOOL */ }; /** - * If tgsi_src_register::Extended is TRUE, tgsi_src_register_ext follows. + * If tgsi_src_register::Modifier is TRUE, tgsi_src_register_modifier follows. * * Then, if tgsi_src_register::Indirect is TRUE, another tgsi_src_register * follows. @@ -433,58 +404,13 @@ struct tgsi_src_register * Then, if tgsi_src_register::Dimension is TRUE, tgsi_dimension follows. */ -#define TGSI_SRC_REGISTER_EXT_TYPE_MOD 1 - -struct tgsi_src_register_ext -{ - unsigned Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_ */ - unsigned Padding : 27; - unsigned Extended : 1; /* BOOL */ -}; - -/** - * If tgsi_src_register_ext::Type is TGSI_SRC_REGISTER_EXT_TYPE_MOD, - * it should be cast to tgsi_src_register_ext_mod. - * - * If tgsi_dst_register_ext::Extended is TRUE, another tgsi_dst_register_ext - * follows. - */ - - -/** - * Extra src register modifiers - * - * If Complement is TRUE, the source register is modified by subtracting it - * from 1.0. - * - * If Bias is TRUE, the source register is modified by subtracting 0.5 from it. - * - * If Scale2X is TRUE, the source register is modified by multiplying it by 2.0. - * - * If Absolute is TRUE, the source register is modified by removing the sign. - * - * If Negate is TRUE, the source register is modified by negating it. - */ - -struct tgsi_src_register_ext_mod -{ - unsigned Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_MOD */ - unsigned Complement : 1; /* BOOL */ - unsigned Bias : 1; /* BOOL */ - unsigned Scale2X : 1; /* BOOL */ - unsigned Absolute : 1; /* BOOL */ - unsigned Negate : 1; /* BOOL */ - unsigned Padding : 22; - unsigned Extended : 1; /* BOOL */ -}; struct tgsi_dimension { unsigned Indirect : 1; /* BOOL */ unsigned Dimension : 1; /* BOOL */ - unsigned Padding : 13; + unsigned Padding : 14; int Index : 16; /* SINT */ - unsigned Extended : 1; /* BOOL */ }; struct tgsi_dst_register @@ -494,51 +420,9 @@ struct tgsi_dst_register unsigned Indirect : 1; /* BOOL */ unsigned Dimension : 1; /* BOOL */ int Index : 16; /* SINT */ - unsigned Padding : 5; - unsigned Extended : 1; /* BOOL */ -}; - -/* - * If tgsi_dst_register::Extended is TRUE, tgsi_dst_register_ext follows. - * - * Then, if tgsi_dst_register::Indirect is TRUE, tgsi_src_register follows. - */ - -#define TGSI_DST_REGISTER_EXT_TYPE_MODULATE 1 - -struct tgsi_dst_register_ext -{ - unsigned Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_ */ - unsigned Padding : 27; - unsigned Extended : 1; /* BOOL */ + unsigned Padding : 6; }; -/** - * Extra destination register modifiers - * - * If tgsi_dst_register_ext::Type is TGSI_DST_REGISTER_EXT_TYPE_MODULATE, - * it should be cast to tgsi_dst_register_ext_modulate. - * - * If tgsi_dst_register_ext::Extended is TRUE, another tgsi_dst_register_ext - * follows. - */ - -#define TGSI_MODULATE_1X 0 -#define TGSI_MODULATE_2X 1 -#define TGSI_MODULATE_4X 2 -#define TGSI_MODULATE_8X 3 -#define TGSI_MODULATE_HALF 4 -#define TGSI_MODULATE_QUARTER 5 -#define TGSI_MODULATE_EIGHTH 6 -#define TGSI_MODULATE_COUNT 7 - -struct tgsi_dst_register_ext_modulate -{ - unsigned Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_MODULATE */ - unsigned Modulate : 4; /* TGSI_MODULATE_ */ - unsigned Padding : 23; - unsigned Extended : 1; /* BOOL */ -}; #ifdef __cplusplus } -- cgit v1.2.3 From 7fac8ce73bb26147f36acc60870a7e816b2f5b4f Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 24 Nov 2009 14:53:03 +0100 Subject: st/xorg: Pass mode types from the kernel to X --- src/gallium/state_trackers/xorg/xorg_output.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_output.c b/src/gallium/state_trackers/xorg/xorg_output.c index 60eef9307d..251f331ea7 100644 --- a/src/gallium/state_trackers/xorg/xorg_output.c +++ b/src/gallium/state_trackers/xorg/xorg_output.c @@ -110,7 +110,6 @@ output_get_modes(xf86OutputPtr output) mode = xcalloc(1, sizeof(DisplayModeRec)); if (!mode) continue; - mode->type = 0; mode->Clock = drm_mode->clock; mode->HDisplay = drm_mode->hdisplay; mode->HSyncStart = drm_mode->hsync_start; @@ -125,6 +124,11 @@ output_get_modes(xf86OutputPtr output) mode->VScan = drm_mode->vscan; mode->VRefresh = xf86ModeVRefresh(mode); mode->Private = (void *)drm_mode; + mode->type = 0; + if (drm_mode->type & DRM_MODE_TYPE_PREFERRED) + mode->type |= M_T_PREFERRED; + if (drm_mode->type & DRM_MODE_TYPE_DRIVER) + mode->type |= M_T_DRIVER; xf86SetModeDefaultName(mode); modes = xf86ModesAdd(modes, mode); xf86PrintModeline(0, mode); -- cgit v1.2.3 From 56ee132f9671f70ff2b3ee04659beac0dfc6126d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Nov 2009 14:09:24 +0000 Subject: gallium: try and update r300 and nv drivers for tgsi changes It would be nice if these drivers built under the linux-debug header so that these types of interface changes can be minimally propogated into those drivers by people without the hardware. They don't have to generate a working driver -- though a command-dumping winsys would be an excellent for regression checking. --- src/gallium/drivers/i915/i915_fpc_translate.c | 5 ++--- src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c | 2 +- src/gallium/drivers/nv20/nv20_vertprog.c | 2 +- src/gallium/drivers/nv30/nv30_fragprog.c | 2 +- src/gallium/drivers/nv30/nv30_vertprog.c | 2 +- src/gallium/drivers/nv40/nv40_fragprog.c | 2 +- src/gallium/drivers/nv40/nv40_vertprog.c | 2 +- src/gallium/drivers/nv50/nv50_program.c | 10 +++++----- src/gallium/drivers/r300/r300_tgsi_to_rc.c | 7 ++++--- 9 files changed, 17 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c b/src/gallium/drivers/i915/i915_fpc_translate.c index a96ba8f192..f2554998a9 100644 --- a/src/gallium/drivers/i915/i915_fpc_translate.c +++ b/src/gallium/drivers/i915/i915_fpc_translate.c @@ -229,12 +229,11 @@ src_vector(struct i915_fp_compile *p, src = negate(src, n, n, n, n); } - /* no abs() or post-abs negation */ + /* no abs() */ #if 0 /* XXX assertions disabled to allow arbfplight.c to run */ /* XXX enable these assertions, or fix things */ - assert(!source->SrcRegisterExtMod.Absolute); - assert(!source->SrcRegisterExtMod.Negate); + assert(!source->SrcRegister.Absolute); #endif return src; } diff --git a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c index 64027de6aa..b2234ef679 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c @@ -326,7 +326,7 @@ emit_tex( struct lp_build_tgsi_soa_context *bld, unsigned num_coords; unsigned i; - switch (inst->InstructionExtTexture.Texture) { + switch (inst->InstructionTexture.Texture) { case TGSI_TEXTURE_1D: num_coords = 1; break; diff --git a/src/gallium/drivers/nv20/nv20_vertprog.c b/src/gallium/drivers/nv20/nv20_vertprog.c index 388245ecb0..48df356faf 100644 --- a/src/gallium/drivers/nv20/nv20_vertprog.c +++ b/src/gallium/drivers/nv20/nv20_vertprog.c @@ -273,7 +273,7 @@ tgsi_src(struct nv20_vpc *vpc, const struct tgsi_full_src_register *fsrc) { break; } - src.abs = fsrc->SrcRegisterExtMod.Absolute; + src.abs = fsrc->SrcRegister.Absolute; src.negate = fsrc->SrcRegister.Negate; src.swz[0] = fsrc->SrcRegister.SwizzleX; src.swz[1] = fsrc->SrcRegister.SwizzleY; diff --git a/src/gallium/drivers/nv30/nv30_fragprog.c b/src/gallium/drivers/nv30/nv30_fragprog.c index 0ce702d6f8..eb978b6838 100644 --- a/src/gallium/drivers/nv30/nv30_fragprog.c +++ b/src/gallium/drivers/nv30/nv30_fragprog.c @@ -268,7 +268,7 @@ tgsi_src(struct nv30_fpc *fpc, const struct tgsi_full_src_register *fsrc) break; } - src.abs = fsrc->SrcRegisterExtMod.Absolute; + src.abs = fsrc->SrcRegister.Absolute; src.negate = fsrc->SrcRegister.Negate; src.swz[0] = fsrc->SrcRegister.SwizzleX; src.swz[1] = fsrc->SrcRegister.SwizzleY; diff --git a/src/gallium/drivers/nv30/nv30_vertprog.c b/src/gallium/drivers/nv30/nv30_vertprog.c index 14a5c0260d..b04fb229bc 100644 --- a/src/gallium/drivers/nv30/nv30_vertprog.c +++ b/src/gallium/drivers/nv30/nv30_vertprog.c @@ -273,7 +273,7 @@ tgsi_src(struct nv30_vpc *vpc, const struct tgsi_full_src_register *fsrc) { break; } - src.abs = fsrc->SrcRegisterExtMod.Absolute; + src.abs = fsrc->SrcRegister.Absolute; src.negate = fsrc->SrcRegister.Negate; src.swz[0] = fsrc->SrcRegister.SwizzleX; src.swz[1] = fsrc->SrcRegister.SwizzleY; diff --git a/src/gallium/drivers/nv40/nv40_fragprog.c b/src/gallium/drivers/nv40/nv40_fragprog.c index 99277506fc..dbbb736670 100644 --- a/src/gallium/drivers/nv40/nv40_fragprog.c +++ b/src/gallium/drivers/nv40/nv40_fragprog.c @@ -279,7 +279,7 @@ tgsi_src(struct nv40_fpc *fpc, const struct tgsi_full_src_register *fsrc) break; } - src.abs = fsrc->SrcRegisterExtMod.Absolute; + src.abs = fsrc->SrcRegister.Absolute; src.negate = fsrc->SrcRegister.Negate; src.swz[0] = fsrc->SrcRegister.SwizzleX; src.swz[1] = fsrc->SrcRegister.SwizzleY; diff --git a/src/gallium/drivers/nv40/nv40_vertprog.c b/src/gallium/drivers/nv40/nv40_vertprog.c index 31dae2457f..df9cb227a3 100644 --- a/src/gallium/drivers/nv40/nv40_vertprog.c +++ b/src/gallium/drivers/nv40/nv40_vertprog.c @@ -313,7 +313,7 @@ tgsi_src(struct nv40_vpc *vpc, const struct tgsi_full_src_register *fsrc) { break; } - src.abs = fsrc->SrcRegisterExtMod.Absolute; + src.abs = fsrc->SrcRegister.Absolute; src.negate = fsrc->SrcRegister.Negate; src.swz[0] = fsrc->SrcRegister.SwizzleX; src.swz[1] = fsrc->SrcRegister.SwizzleY; diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index bf50982dd1..e40e37d07c 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -1575,10 +1575,10 @@ nv50_tgsi_src_mask(const struct tgsi_full_instruction *insn, int c) case TGSI_OPCODE_TEX: case TGSI_OPCODE_TXP: { - const struct tgsi_instruction_ext_texture *tex; + const struct tgsi_instruction_texture *tex; - assert(insn->Instruction.Extended); - tex = &insn->InstructionExtTexture; + assert(insn->Instruction.Texture); + tex = &insn->InstructionTexture; mask = 0x7; if (insn->Instruction.Opcode == TGSI_OPCODE_TXP) @@ -2181,11 +2181,11 @@ nv50_program_tx_insn(struct nv50_pc *pc, break; case TGSI_OPCODE_TEX: emit_tex(pc, dst, mask, src[0], unit, - inst->InstructionExtTexture.Texture, FALSE); + inst->InstructionTexture.Texture, FALSE); break; case TGSI_OPCODE_TXP: emit_tex(pc, dst, mask, src[0], unit, - inst->InstructionExtTexture.Texture, TRUE); + inst->InstructionTexture.Texture, TRUE); break; case TGSI_OPCODE_TRUNC: for (c = 0; c < 4; c++) { diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/src/gallium/drivers/r300/r300_tgsi_to_rc.c index 589f1984ee..25a634e5a2 100644 --- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c +++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c @@ -208,11 +208,11 @@ static void transform_srcreg( dst->Swizzle |= tgsi_util_get_full_src_register_swizzle(src, 1) << 3; dst->Swizzle |= tgsi_util_get_full_src_register_swizzle(src, 2) << 6; dst->Swizzle |= tgsi_util_get_full_src_register_swizzle(src, 3) << 9; - dst->Abs = src->SrcRegisterExtMod.Absolute; + dst->Abs = src->SrcRegister.Absolute; dst->Negate = src->SrcRegister.Negate ? RC_MASK_XYZW : 0; } -static void transform_texture(struct rc_instruction * dst, struct tgsi_instruction_ext_texture src) +static void transform_texture(struct rc_instruction * dst, struct tgsi_instruction_texture src) { switch(src.Texture) { case TGSI_TEXTURE_1D: @@ -268,7 +268,8 @@ static void transform_instruction(struct tgsi_to_rc * ttr, struct tgsi_full_inst } /* Texturing. */ - transform_texture(dst, src->InstructionExtTexture); + if (src->Instruction.Texture) + transform_texture(dst, src->InstructionTexture); } static void handle_immediate(struct tgsi_to_rc * ttr, struct tgsi_full_immediate * imm) -- cgit v1.2.3 From 52df532b02594e624bddd58ee60fd25075f8ec42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 10 Nov 2009 16:55:44 -0800 Subject: llvmpipe: Fix typo in comparison operator. --- src/gallium/drivers/llvmpipe/lp_bld_depth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c index 98ec1cb1b9..d438c0e63d 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c @@ -90,7 +90,7 @@ lp_depth_type(const struct util_format_description *format_desc, if(format_desc->channel[swizzle].type == UTIL_FORMAT_TYPE_FLOAT) { type.floating = TRUE; - assert(swizzle = 0); + assert(swizzle == 0); assert(format_desc->channel[swizzle].size == format_desc->block.bits); } else if(format_desc->channel[swizzle].type == UTIL_FORMAT_TYPE_UNSIGNED) { -- cgit v1.2.3 From c6d663e6dc8799a178b03bc3059ef5c5c3d7f629 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 10 Nov 2009 16:56:43 -0800 Subject: wgl: Fix copy'n'paste typo in comment. --- src/gallium/state_trackers/wgl/stw_winsys.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/wgl/stw_winsys.h b/src/gallium/state_trackers/wgl/stw_winsys.h index 1ead47d6e6..1de6e906d0 100644 --- a/src/gallium/state_trackers/wgl/stw_winsys.h +++ b/src/gallium/state_trackers/wgl/stw_winsys.h @@ -73,7 +73,7 @@ struct stw_winsys HANDLE hSharedSurface); /** - * Open a shared surface (optional). + * Close a shared surface (optional). */ void (*shared_surface_close)(struct pipe_screen *screen, -- cgit v1.2.3 From b375526b50271317868a20484c8a1f36707e6005 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 10 Nov 2009 17:51:06 -0800 Subject: llvmpipe: Be more conservative with the supported formats. We'll likely support much more formats, but doing this allows to run more testsuites without immediately hit assertion failures. --- src/gallium/drivers/llvmpipe/lp_screen.c | 58 ++++++++++++++++++++++++++++---- 1 file changed, 51 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 0518927458..0fb133486a 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -27,6 +27,7 @@ #include "util/u_memory.h" +#include "util/u_format.h" #include "pipe/p_defines.h" #include "pipe/p_screen.h" @@ -131,17 +132,17 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen, { struct llvmpipe_screen *screen = llvmpipe_screen(_screen); struct llvmpipe_winsys *winsys = screen->winsys; + const struct util_format_description *format_desc; + + format_desc = util_format_description(format); + if(!format_desc) + return FALSE; assert(target == PIPE_TEXTURE_1D || target == PIPE_TEXTURE_2D || target == PIPE_TEXTURE_3D || target == PIPE_TEXTURE_CUBE); - if(format == PIPE_FORMAT_Z16_UNORM) - return FALSE; - if(format == PIPE_FORMAT_S8_UNORM) - return FALSE; - switch(format) { case PIPE_FORMAT_DXT1_RGB: case PIPE_FORMAT_DXT1_RGBA: @@ -152,8 +153,51 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen, break; } - if(tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET) - return winsys->is_displaytarget_format_supported(winsys, format); + if(tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) { + if(format_desc->block.width != 1 || + format_desc->block.height != 1) + return FALSE; + + if(format_desc->layout != UTIL_FORMAT_LAYOUT_SCALAR && + format_desc->layout != UTIL_FORMAT_LAYOUT_ARITH && + format_desc->layout != UTIL_FORMAT_LAYOUT_ARRAY) + return FALSE; + + if(format_desc->colorspace != UTIL_FORMAT_COLORSPACE_RGB && + format_desc->colorspace != UTIL_FORMAT_COLORSPACE_SRGB) + return FALSE; + } + + if(tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET) { + if(!winsys->is_displaytarget_format_supported(winsys, format)) + return FALSE; + } + + if(tex_usage & PIPE_TEXTURE_USAGE_DEPTH_STENCIL) { + if(format_desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS) + return FALSE; + + /* FIXME: Temporary restriction. See lp_state_fs.c. */ + if(format_desc->block.bits != 32) + return FALSE; + } + + /* FIXME: Temporary restrictions. See lp_bld_sample_soa.c */ + if(tex_usage & PIPE_TEXTURE_USAGE_SAMPLER) { + if(format_desc->block.width != 1 || + format_desc->block.height != 1) + return FALSE; + + if(format_desc->layout != UTIL_FORMAT_LAYOUT_SCALAR && + format_desc->layout != UTIL_FORMAT_LAYOUT_ARITH && + format_desc->layout != UTIL_FORMAT_LAYOUT_ARRAY) + return FALSE; + + if(format_desc->colorspace != UTIL_FORMAT_COLORSPACE_RGB && + format_desc->colorspace != UTIL_FORMAT_COLORSPACE_SRGB && + format_desc->colorspace != UTIL_FORMAT_COLORSPACE_ZS) + return FALSE; + } return TRUE; } -- cgit v1.2.3 From 2282fb7710d386bd10ccdd18f030069fae0a5d55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 10 Nov 2009 17:52:53 -0800 Subject: llvmpipe: Use the generic conversion routine for depths. This allows for z32f depth format to work correctly. --- src/gallium/drivers/llvmpipe/lp_state_fs.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 2e9aa9fffe..2bde24430e 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -148,6 +148,20 @@ generate_depth(LLVMBuilderRef builder, format_desc = util_format_description(key->zsbuf_format); assert(format_desc); + /* + * Depths are expected to be between 0 and 1, even if they are stored in + * floats. Setting these bits here will ensure that the lp_build_conv() call + * below won't try to unnecessarily clamp the incoming values. + */ + if(src_type.floating) { + src_type.sign = FALSE; + src_type.norm = TRUE; + } + else { + assert(!src_type.sign); + assert(src_type.norm); + } + /* Pick the depth type. */ dst_type = lp_depth_type(format_desc, src_type.width*src_type.length); @@ -155,14 +169,11 @@ generate_depth(LLVMBuilderRef builder, assert(dst_type.width == src_type.width); assert(dst_type.length == src_type.length); -#if 1 - src = lp_build_clamped_float_to_unsigned_norm(builder, - src_type, - dst_type.width, - src); -#else lp_build_conv(builder, src_type, dst_type, &src, 1, &src, 1); -#endif + + dst_ptr = LLVMBuildBitCast(builder, + dst_ptr, + LLVMPointerType(lp_build_vec_type(dst_type), 0), ""); lp_build_depth_test(builder, &key->depth, -- cgit v1.2.3 From 066991c8d147db94b9661361bb191919b962fc4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 15 Nov 2009 06:46:48 -0800 Subject: llvmpipe: Fix memory leak. --- src/gallium/drivers/llvmpipe/lp_state_vs.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_state_vs.c b/src/gallium/drivers/llvmpipe/lp_state_vs.c index 15c3029614..8a761648e7 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_vs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_vs.c @@ -92,5 +92,6 @@ llvmpipe_delete_vs_state(struct pipe_context *pipe, void *vs) (struct lp_vertex_shader *)vs; draw_delete_vertex_shader(llvmpipe->draw, state->draw_data); + FREE( (void *)state->shader.tokens ); FREE( state ); } -- cgit v1.2.3 From 4ae3e88dc9856f2f32c37dd04a3321765ed61e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Mon, 23 Nov 2009 11:21:11 +0000 Subject: llvmpipe: Use assert instead of abort. Only verify functions on debug builds. --- src/gallium/drivers/llvmpipe/lp_jit.c | 2 +- src/gallium/drivers/llvmpipe/lp_state_fs.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c index 13535dd638..c601c79480 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.c +++ b/src/gallium/drivers/llvmpipe/lp_jit.c @@ -167,7 +167,7 @@ lp_jit_screen_init(struct llvmpipe_screen *screen) if (LLVMCreateJITCompiler(&screen->engine, screen->provider, 1, &error)) { _debug_printf("%s\n", error); LLVMDisposeMessage(error); - abort(); + assert(0); } screen->target = LLVMGetExecutionEngineTargetData(screen->engine); diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 2bde24430e..ee0f69b2af 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -622,10 +622,12 @@ generate_fragment(struct llvmpipe_context *lp, * Translate the LLVM IR into machine code. */ +#ifdef DEBUG if(LLVMVerifyFunction(variant->function, LLVMPrintMessageAction)) { LLVMDumpValue(variant->function); - abort(); + assert(0); } +#endif LLVMRunFunctionPassManager(screen->pass, variant->function); -- cgit v1.2.3 From 1325361abe0f1f89c3f675f04e482f580033abe9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 24 Nov 2009 14:24:38 +0000 Subject: util: Describe a few more formats. --- src/gallium/auxiliary/util/u_format.csv | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_format.csv b/src/gallium/auxiliary/util/u_format.csv index f1bf94f17d..b9cc2aa716 100644 --- a/src/gallium/auxiliary/util/u_format.csv +++ b/src/gallium/auxiliary/util/u_format.csv @@ -97,3 +97,13 @@ PIPE_FORMAT_B8G8R8A8_SRGB , arith , 1, 1, u8 , u8 , u8 , u8 , zyxw, PIPE_FORMAT_B8G8R8X8_SRGB , arith , 1, 1, u8 , u8 , u8 , u8 , zyx1, srgb PIPE_FORMAT_X8UB8UG8SR8S_NORM , arith , 1, 1, sn8 , sn8 , un8 , x8 , 1zyx, rgb PIPE_FORMAT_B6UG5SR5S_NORM , arith , 1, 1, sn5 , sn5 , un6 , , xyz1, rgb +PIPE_FORMAT_YCBCR , yuv , 2, 1, x32 , , , , xyz1, yuv +PIPE_FORMAT_YCBCR_REV , yuv , 2, 1, x32 , , , , xyz1, yuv +PIPE_FORMAT_DXT1_RGBA , dxt , 4, 4, x64 , , , , xyzw, rgb +PIPE_FORMAT_DXT1_RGB , dxt , 4, 4, x64 , , , , xyz1, rgb +PIPE_FORMAT_DXT3_RGBA , dxt , 4, 4, x128, , , , xyzw, rgb +PIPE_FORMAT_DXT5_RGBA , dxt , 4, 4, x128, , , , xyzw, rgb +PIPE_FORMAT_DXT1_SRGBA , dxt , 4, 4, x64 , , , , xyzw, srgb +PIPE_FORMAT_DXT1_SRGB , dxt , 4, 4, x64 , , , , xyz1, srgb +PIPE_FORMAT_DXT3_SRGBA , dxt , 4, 4, x128, , , , xyzw, srgb +PIPE_FORMAT_DXT5_SRGBA , dxt , 4, 4, x128, , , , xyzw, srgb -- cgit v1.2.3 From a71f8365049fb81f63245089b5438dcad6e83b19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 24 Nov 2009 14:37:45 +0000 Subject: svga: Use consistent file names for dumping facilities. --- src/gallium/drivers/svga/Makefile | 4 +- src/gallium/drivers/svga/SConscript | 4 +- src/gallium/drivers/svga/svga_tgsi.c | 2 +- src/gallium/drivers/svga/svgadump/st_shader.h | 214 ------- src/gallium/drivers/svga/svgadump/st_shader_dump.c | 649 --------------------- src/gallium/drivers/svga/svgadump/st_shader_dump.h | 42 -- src/gallium/drivers/svga/svgadump/st_shader_op.c | 168 ------ src/gallium/drivers/svga/svgadump/st_shader_op.h | 46 -- src/gallium/drivers/svga/svgadump/svga_dump.c | 2 +- src/gallium/drivers/svga/svgadump/svga_dump.py | 2 +- src/gallium/drivers/svga/svgadump/svga_shader.h | 214 +++++++ .../drivers/svga/svgadump/svga_shader_dump.c | 649 +++++++++++++++++++++ .../drivers/svga/svgadump/svga_shader_dump.h | 42 ++ src/gallium/drivers/svga/svgadump/svga_shader_op.c | 168 ++++++ src/gallium/drivers/svga/svgadump/svga_shader_op.h | 46 ++ 15 files changed, 1126 insertions(+), 1126 deletions(-) delete mode 100644 src/gallium/drivers/svga/svgadump/st_shader.h delete mode 100644 src/gallium/drivers/svga/svgadump/st_shader_dump.c delete mode 100644 src/gallium/drivers/svga/svgadump/st_shader_dump.h delete mode 100644 src/gallium/drivers/svga/svgadump/st_shader_op.c delete mode 100644 src/gallium/drivers/svga/svgadump/st_shader_op.h create mode 100644 src/gallium/drivers/svga/svgadump/svga_shader.h create mode 100644 src/gallium/drivers/svga/svgadump/svga_shader_dump.c create mode 100644 src/gallium/drivers/svga/svgadump/svga_shader_dump.h create mode 100644 src/gallium/drivers/svga/svgadump/svga_shader_op.c create mode 100644 src/gallium/drivers/svga/svgadump/svga_shader_op.h (limited to 'src') diff --git a/src/gallium/drivers/svga/Makefile b/src/gallium/drivers/svga/Makefile index d1413319c9..38b63394e3 100644 --- a/src/gallium/drivers/svga/Makefile +++ b/src/gallium/drivers/svga/Makefile @@ -4,8 +4,8 @@ include $(TOP)/configs/current LIBNAME = svga C_SOURCES = \ - svgadump/st_shader_dump.c \ - svgadump/st_shader_op.c \ + svgadump/svga_shader_dump.c \ + svgadump/svga_shader_op.c \ svgadump/svga_dump.c \ svga_cmd.c \ svga_context.c \ diff --git a/src/gallium/drivers/svga/SConscript b/src/gallium/drivers/svga/SConscript index ff9645fc03..737b791ceb 100644 --- a/src/gallium/drivers/svga/SConscript +++ b/src/gallium/drivers/svga/SConscript @@ -60,8 +60,8 @@ sources = [ 'svga_tgsi_insn.c', 'svgadump/svga_dump.c', - 'svgadump/st_shader_dump.c', - 'svgadump/st_shader_op.c', + 'svgadump/svga_shader_dump.c', + 'svgadump/svga_shader_op.c', ] svga = env.ConvenienceLibrary( diff --git a/src/gallium/drivers/svga/svga_tgsi.c b/src/gallium/drivers/svga/svga_tgsi.c index 44d0930bc0..81eea1a145 100644 --- a/src/gallium/drivers/svga/svga_tgsi.c +++ b/src/gallium/drivers/svga/svga_tgsi.c @@ -32,7 +32,7 @@ #include "tgsi/tgsi_scan.h" #include "util/u_memory.h" -#include "svgadump/st_shader_dump.h" +#include "svgadump/svga_shader_dump.h" #include "svga_context.h" #include "svga_tgsi.h" diff --git a/src/gallium/drivers/svga/svgadump/st_shader.h b/src/gallium/drivers/svga/svgadump/st_shader.h deleted file mode 100644 index 2fc1796a90..0000000000 --- a/src/gallium/drivers/svga/svgadump/st_shader.h +++ /dev/null @@ -1,214 +0,0 @@ -/********************************************************** - * Copyright 2007-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, 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. - * - **********************************************************/ - -/** - * @file - * SVGA Shader Token Definitions - * - * @author Michal Krol - */ - -#ifndef ST_SHADER_SVGA_H -#define ST_SHADER_SVGA_H - -#include "pipe/p_compiler.h" - -struct sh_op -{ - unsigned opcode:16; - unsigned control:8; - unsigned length:4; - unsigned predicated:1; - unsigned unused:1; - unsigned coissue:1; - unsigned is_reg:1; -}; - -struct sh_reg -{ - unsigned number:11; - unsigned type_hi:2; - unsigned relative:1; - unsigned unused:14; - unsigned type_lo:3; - unsigned is_reg:1; -}; - -static INLINE unsigned -sh_reg_type( struct sh_reg reg ) -{ - return reg.type_lo | (reg.type_hi << 3); -} - -struct sh_cdata -{ - float xyzw[4]; -}; - -struct sh_def -{ - struct sh_op op; - struct sh_reg reg; - struct sh_cdata cdata; -}; - -struct sh_defb -{ - struct sh_op op; - struct sh_reg reg; - uint data; -}; - -struct sh_idata -{ - int xyzw[4]; -}; - -struct sh_defi -{ - struct sh_op op; - struct sh_reg reg; - struct sh_idata idata; -}; - -#define PS_TEXTURETYPE_UNKNOWN SVGA3DSAMP_UNKNOWN -#define PS_TEXTURETYPE_2D SVGA3DSAMP_2D -#define PS_TEXTURETYPE_CUBE SVGA3DSAMP_CUBE -#define PS_TEXTURETYPE_VOLUME SVGA3DSAMP_VOLUME - -struct ps_sampleinfo -{ - unsigned unused:27; - unsigned texture_type:4; - unsigned is_reg:1; -}; - -struct vs_semantic -{ - unsigned usage:5; - unsigned unused1:11; - unsigned usage_index:4; - unsigned unused2:12; -}; - -struct sh_dstreg -{ - unsigned number:11; - unsigned type_hi:2; - unsigned relative:1; - unsigned unused:2; - unsigned write_mask:4; - unsigned modifier:4; - unsigned shift_scale:4; - unsigned type_lo:3; - unsigned is_reg:1; -}; - -static INLINE unsigned -sh_dstreg_type( struct sh_dstreg reg ) -{ - return reg.type_lo | (reg.type_hi << 3); -} - -struct sh_dcl -{ - struct sh_op op; - union { - struct { - struct ps_sampleinfo sampleinfo; - } ps; - struct { - struct vs_semantic semantic; - } vs; - } u; - struct sh_dstreg reg; -}; - - -struct sh_srcreg -{ - unsigned number:11; - unsigned type_hi:2; - unsigned relative:1; - unsigned unused:2; - unsigned swizzle_x:2; - unsigned swizzle_y:2; - unsigned swizzle_z:2; - unsigned swizzle_w:2; - unsigned modifier:4; - unsigned type_lo:3; - unsigned is_reg:1; -}; - -static INLINE unsigned -sh_srcreg_type( struct sh_srcreg reg ) -{ - return reg.type_lo | (reg.type_hi << 3); -} - -struct sh_dstop -{ - struct sh_op op; - struct sh_dstreg dst; -}; - -struct sh_srcop -{ - struct sh_op op; - struct sh_srcreg src; -}; - -struct sh_src2op -{ - struct sh_op op; - struct sh_srcreg src0; - struct sh_srcreg src1; -}; - -struct sh_unaryop -{ - struct sh_op op; - struct sh_dstreg dst; - struct sh_srcreg src; -}; - -struct sh_binaryop -{ - struct sh_op op; - struct sh_dstreg dst; - struct sh_srcreg src0; - struct sh_srcreg src1; -}; - -struct sh_trinaryop -{ - struct sh_op op; - struct sh_dstreg dst; - struct sh_srcreg src0; - struct sh_srcreg src1; - struct sh_srcreg src2; -}; - -#endif /* ST_SHADER_SVGA_H */ diff --git a/src/gallium/drivers/svga/svgadump/st_shader_dump.c b/src/gallium/drivers/svga/svgadump/st_shader_dump.c deleted file mode 100644 index d65cc93bfd..0000000000 --- a/src/gallium/drivers/svga/svgadump/st_shader_dump.c +++ /dev/null @@ -1,649 +0,0 @@ -/********************************************************** - * Copyright 2008-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, 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. - * - **********************************************************/ - -/** - * @file - * SVGA Shader Dump Facilities - * - * @author Michal Krol - */ - -#include "st_shader.h" -#include "st_shader_dump.h" -#include "st_shader_op.h" -#include "util/u_debug.h" - -#include "../svga_hw_reg.h" -#include "svga3d_shaderdefs.h" - -struct dump_info -{ - SVGA3dShaderVersion version; - boolean is_ps; -}; - -static void dump_op( struct sh_op op, const char *mnemonic ) -{ - assert( op.predicated == 0 ); - assert( op.is_reg == 0 ); - - if (op.coissue) - debug_printf( "+" ); - debug_printf( "%s", mnemonic ); - switch (op.control) { - case 0: - break; - case SVGA3DOPCONT_PROJECT: - debug_printf( "p" ); - break; - case SVGA3DOPCONT_BIAS: - debug_printf( "b" ); - break; - default: - assert( 0 ); - } -} - - -static void dump_comp_op( struct sh_op op, const char *mnemonic ) -{ - assert( op.is_reg == 0 ); - - if (op.coissue) - debug_printf( "+" ); - debug_printf( "%s", mnemonic ); - switch (op.control) { - case SVGA3DOPCOMP_RESERVED0: - break; - case SVGA3DOPCOMP_GT: - debug_printf("_gt"); - break; - case SVGA3DOPCOMP_EQ: - debug_printf("_eq"); - break; - case SVGA3DOPCOMP_GE: - debug_printf("_ge"); - break; - case SVGA3DOPCOMP_LT: - debug_printf("_lt"); - break; - case SVGA3DOPCOMPC_NE: - debug_printf("_ne"); - break; - case SVGA3DOPCOMP_LE: - debug_printf("_le"); - break; - case SVGA3DOPCOMP_RESERVED1: - default: - assert( 0 ); - } -} - - -static void dump_reg( struct sh_reg reg, struct sh_srcreg *indreg, const struct dump_info *di ) -{ - assert( sh_reg_type( reg ) == SVGA3DREG_CONST || reg.relative == 0 ); - assert( reg.is_reg == 1 ); - - switch (sh_reg_type( reg )) { - case SVGA3DREG_TEMP: - debug_printf( "r%u", reg.number ); - break; - - case SVGA3DREG_INPUT: - debug_printf( "v%u", reg.number ); - break; - - case SVGA3DREG_CONST: - if (reg.relative) { - if (sh_srcreg_type( *indreg ) == SVGA3DREG_LOOP) - debug_printf( "c[aL+%u]", reg.number ); - else - debug_printf( "c[a%u.x+%u]", indreg->number, reg.number ); - } - else - debug_printf( "c%u", reg.number ); - break; - - case SVGA3DREG_ADDR: /* VS */ - /* SVGA3DREG_TEXTURE */ /* PS */ - if (di->is_ps) - debug_printf( "t%u", reg.number ); - else - debug_printf( "a%u", reg.number ); - break; - - case SVGA3DREG_RASTOUT: - switch (reg.number) { - case 0 /*POSITION*/: - debug_printf( "oPos" ); - break; - case 1 /*FOG*/: - debug_printf( "oFog" ); - break; - case 2 /*POINT_SIZE*/: - debug_printf( "oPts" ); - break; - default: - assert( 0 ); - debug_printf( "???" ); - } - break; - - case SVGA3DREG_ATTROUT: - assert( reg.number < 2 ); - debug_printf( "oD%u", reg.number ); - break; - - case SVGA3DREG_TEXCRDOUT: - /* SVGA3DREG_OUTPUT */ - debug_printf( "oT%u", reg.number ); - break; - - case SVGA3DREG_COLOROUT: - debug_printf( "oC%u", reg.number ); - break; - - case SVGA3DREG_DEPTHOUT: - debug_printf( "oD%u", reg.number ); - break; - - case SVGA3DREG_SAMPLER: - debug_printf( "s%u", reg.number ); - break; - - case SVGA3DREG_CONSTBOOL: - assert( !reg.relative ); - debug_printf( "b%u", reg.number ); - break; - - case SVGA3DREG_CONSTINT: - assert( !reg.relative ); - debug_printf( "i%u", reg.number ); - break; - - case SVGA3DREG_LOOP: - assert( reg.number == 0 ); - debug_printf( "aL" ); - break; - - case SVGA3DREG_MISCTYPE: - switch (reg.number) { - case SVGA3DMISCREG_POSITION: - debug_printf( "vPos" ); - break; - case SVGA3DMISCREG_FACE: - debug_printf( "vFace" ); - break; - default: - assert(0); - break; - } - break; - - case SVGA3DREG_LABEL: - debug_printf( "l%u", reg.number ); - break; - - case SVGA3DREG_PREDICATE: - debug_printf( "p%u", reg.number ); - break; - - - default: - assert( 0 ); - debug_printf( "???" ); - } -} - -static void dump_cdata( struct sh_cdata cdata ) -{ - debug_printf( "%f, %f, %f, %f", cdata.xyzw[0], cdata.xyzw[1], cdata.xyzw[2], cdata.xyzw[3] ); -} - -static void dump_idata( struct sh_idata idata ) -{ - debug_printf( "%d, %d, %d, %d", idata.xyzw[0], idata.xyzw[1], idata.xyzw[2], idata.xyzw[3] ); -} - -static void dump_bdata( boolean bdata ) -{ - debug_printf( bdata ? "TRUE" : "FALSE" ); -} - -static void dump_sampleinfo( struct ps_sampleinfo sampleinfo ) -{ - switch (sampleinfo.texture_type) { - case SVGA3DSAMP_2D: - debug_printf( "_2d" ); - break; - case SVGA3DSAMP_CUBE: - debug_printf( "_cube" ); - break; - case SVGA3DSAMP_VOLUME: - debug_printf( "_volume" ); - break; - default: - assert( 0 ); - } -} - - -static void dump_usageinfo( struct vs_semantic semantic ) -{ - switch (semantic.usage) { - case SVGA3D_DECLUSAGE_POSITION: - debug_printf("_position" ); - break; - case SVGA3D_DECLUSAGE_BLENDWEIGHT: - debug_printf("_blendweight" ); - break; - case SVGA3D_DECLUSAGE_BLENDINDICES: - debug_printf("_blendindices" ); - break; - case SVGA3D_DECLUSAGE_NORMAL: - debug_printf("_normal" ); - break; - case SVGA3D_DECLUSAGE_PSIZE: - debug_printf("_psize" ); - break; - case SVGA3D_DECLUSAGE_TEXCOORD: - debug_printf("_texcoord"); - break; - case SVGA3D_DECLUSAGE_TANGENT: - debug_printf("_tangent" ); - break; - case SVGA3D_DECLUSAGE_BINORMAL: - debug_printf("_binormal" ); - break; - case SVGA3D_DECLUSAGE_TESSFACTOR: - debug_printf("_tessfactor" ); - break; - case SVGA3D_DECLUSAGE_POSITIONT: - debug_printf("_positiont" ); - break; - case SVGA3D_DECLUSAGE_COLOR: - debug_printf("_color" ); - break; - case SVGA3D_DECLUSAGE_FOG: - debug_printf("_fog" ); - break; - case SVGA3D_DECLUSAGE_DEPTH: - debug_printf("_depth" ); - break; - case SVGA3D_DECLUSAGE_SAMPLE: - debug_printf("_sample"); - break; - default: - assert( 0 ); - return; - } - - if (semantic.usage_index != 0) { - debug_printf("%d", semantic.usage_index ); - } -} - -static void dump_dstreg( struct sh_dstreg dstreg, const struct dump_info *di ) -{ - union { - struct sh_reg reg; - struct sh_dstreg dstreg; - } u; - - assert( (dstreg.modifier & (SVGA3DDSTMOD_SATURATE | SVGA3DDSTMOD_PARTIALPRECISION)) == dstreg.modifier ); - - if (dstreg.modifier & SVGA3DDSTMOD_SATURATE) - debug_printf( "_sat" ); - if (dstreg.modifier & SVGA3DDSTMOD_PARTIALPRECISION) - debug_printf( "_pp" ); - switch (dstreg.shift_scale) { - case 0: - break; - case 1: - debug_printf( "_x2" ); - break; - case 2: - debug_printf( "_x4" ); - break; - case 3: - debug_printf( "_x8" ); - break; - case 13: - debug_printf( "_d8" ); - break; - case 14: - debug_printf( "_d4" ); - break; - case 15: - debug_printf( "_d2" ); - break; - default: - assert( 0 ); - } - debug_printf( " " ); - - u.dstreg = dstreg; - dump_reg( u.reg, NULL, di ); - if (dstreg.write_mask != SVGA3DWRITEMASK_ALL) { - debug_printf( "." ); - if (dstreg.write_mask & SVGA3DWRITEMASK_0) - debug_printf( "x" ); - if (dstreg.write_mask & SVGA3DWRITEMASK_1) - debug_printf( "y" ); - if (dstreg.write_mask & SVGA3DWRITEMASK_2) - debug_printf( "z" ); - if (dstreg.write_mask & SVGA3DWRITEMASK_3) - debug_printf( "w" ); - } -} - -static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, const struct dump_info *di ) -{ - union { - struct sh_reg reg; - struct sh_srcreg srcreg; - } u; - - switch (srcreg.modifier) { - case SVGA3DSRCMOD_NEG: - case SVGA3DSRCMOD_BIASNEG: - case SVGA3DSRCMOD_SIGNNEG: - case SVGA3DSRCMOD_X2NEG: - debug_printf( "-" ); - break; - case SVGA3DSRCMOD_ABS: - debug_printf( "|" ); - break; - case SVGA3DSRCMOD_ABSNEG: - debug_printf( "-|" ); - break; - case SVGA3DSRCMOD_COMP: - debug_printf( "1-" ); - break; - case SVGA3DSRCMOD_NOT: - debug_printf( "!" ); - } - - u.srcreg = srcreg; - dump_reg( u.reg, indreg, di ); - switch (srcreg.modifier) { - case SVGA3DSRCMOD_NONE: - case SVGA3DSRCMOD_NEG: - case SVGA3DSRCMOD_COMP: - case SVGA3DSRCMOD_NOT: - break; - case SVGA3DSRCMOD_ABS: - case SVGA3DSRCMOD_ABSNEG: - debug_printf( "|" ); - break; - case SVGA3DSRCMOD_BIAS: - case SVGA3DSRCMOD_BIASNEG: - debug_printf( "_bias" ); - break; - case SVGA3DSRCMOD_SIGN: - case SVGA3DSRCMOD_SIGNNEG: - debug_printf( "_bx2" ); - break; - case SVGA3DSRCMOD_X2: - case SVGA3DSRCMOD_X2NEG: - debug_printf( "_x2" ); - break; - case SVGA3DSRCMOD_DZ: - debug_printf( "_dz" ); - break; - case SVGA3DSRCMOD_DW: - debug_printf( "_dw" ); - break; - default: - assert( 0 ); - } - if (srcreg.swizzle_x != 0 || srcreg.swizzle_y != 1 || srcreg.swizzle_z != 2 || srcreg.swizzle_w != 3) { - debug_printf( "." ); - if (srcreg.swizzle_x == srcreg.swizzle_y && srcreg.swizzle_y == srcreg.swizzle_z && srcreg.swizzle_z == srcreg.swizzle_w) { - debug_printf( "%c", "xyzw"[srcreg.swizzle_x] ); - } - else { - debug_printf( "%c", "xyzw"[srcreg.swizzle_x] ); - debug_printf( "%c", "xyzw"[srcreg.swizzle_y] ); - debug_printf( "%c", "xyzw"[srcreg.swizzle_z] ); - debug_printf( "%c", "xyzw"[srcreg.swizzle_w] ); - } - } -} - -void -sh_svga_dump( - const unsigned *assem, - unsigned dwords, - unsigned do_binary ) -{ - const unsigned *start = assem; - boolean finished = FALSE; - struct dump_info di; - unsigned i; - - if (do_binary) { - for (i = 0; i < dwords; i++) - debug_printf(" 0x%08x,\n", assem[i]); - - debug_printf("\n\n"); - } - - di.version.value = *assem++; - di.is_ps = (di.version.type == SVGA3D_PS_TYPE); - - debug_printf( - "%s_%u_%u\n", - di.is_ps ? "ps" : "vs", - di.version.major, - di.version.minor ); - - while (!finished) { - struct sh_op op = *(struct sh_op *) assem; - - if (assem - start >= dwords) { - debug_printf("... ran off end of buffer\n"); - assert(0); - return; - } - - switch (op.opcode) { - case SVGA3DOP_DCL: - { - struct sh_dcl dcl = *(struct sh_dcl *) assem; - - debug_printf( "dcl" ); - if (sh_dstreg_type( dcl.reg ) == SVGA3DREG_SAMPLER) - dump_sampleinfo( dcl.u.ps.sampleinfo ); - else if (di.is_ps) { - if (di.version.major == 3 && - sh_dstreg_type( dcl.reg ) != SVGA3DREG_MISCTYPE) - dump_usageinfo( dcl.u.vs.semantic ); - } - else - dump_usageinfo( dcl.u.vs.semantic ); - dump_dstreg( dcl.reg, &di ); - debug_printf( "\n" ); - assem += sizeof( struct sh_dcl ) / sizeof( unsigned ); - } - break; - - case SVGA3DOP_DEFB: - { - struct sh_defb defb = *(struct sh_defb *) assem; - - debug_printf( "defb " ); - dump_reg( defb.reg, NULL, &di ); - debug_printf( ", " ); - dump_bdata( defb.data ); - debug_printf( "\n" ); - assem += sizeof( struct sh_defb ) / sizeof( unsigned ); - } - break; - - case SVGA3DOP_DEFI: - { - struct sh_defi defi = *(struct sh_defi *) assem; - - debug_printf( "defi " ); - dump_reg( defi.reg, NULL, &di ); - debug_printf( ", " ); - dump_idata( defi.idata ); - debug_printf( "\n" ); - assem += sizeof( struct sh_defi ) / sizeof( unsigned ); - } - break; - - case SVGA3DOP_TEXCOORD: - assert( di.is_ps ); - dump_op( op, "texcoord" ); - if (0) { - struct sh_dstop dstop = *(struct sh_dstop *) assem; - dump_dstreg( dstop.dst, &di ); - assem += sizeof( struct sh_dstop ) / sizeof( unsigned ); - } - else { - struct sh_unaryop unaryop = *(struct sh_unaryop *) assem; - dump_dstreg( unaryop.dst, &di ); - debug_printf( ", " ); - dump_srcreg( unaryop.src, NULL, &di ); - assem += sizeof( struct sh_unaryop ) / sizeof( unsigned ); - } - debug_printf( "\n" ); - break; - - case SVGA3DOP_TEX: - assert( di.is_ps ); - if (0) { - dump_op( op, "tex" ); - if (0) { - struct sh_dstop dstop = *(struct sh_dstop *) assem; - - dump_dstreg( dstop.dst, &di ); - assem += sizeof( struct sh_dstop ) / sizeof( unsigned ); - } - else { - struct sh_unaryop unaryop = *(struct sh_unaryop *) assem; - - dump_dstreg( unaryop.dst, &di ); - debug_printf( ", " ); - dump_srcreg( unaryop.src, NULL, &di ); - assem += sizeof( struct sh_unaryop ) / sizeof( unsigned ); - } - } - else { - struct sh_binaryop binaryop = *(struct sh_binaryop *) assem; - - dump_op( op, "texld" ); - dump_dstreg( binaryop.dst, &di ); - debug_printf( ", " ); - dump_srcreg( binaryop.src0, NULL, &di ); - debug_printf( ", " ); - dump_srcreg( binaryop.src1, NULL, &di ); - assem += sizeof( struct sh_binaryop ) / sizeof( unsigned ); - } - debug_printf( "\n" ); - break; - - case SVGA3DOP_DEF: - { - struct sh_def def = *(struct sh_def *) assem; - - debug_printf( "def " ); - dump_reg( def.reg, NULL, &di ); - debug_printf( ", " ); - dump_cdata( def.cdata ); - debug_printf( "\n" ); - assem += sizeof( struct sh_def ) / sizeof( unsigned ); - } - break; - - case SVGA3DOP_PHASE: - debug_printf( "phase\n" ); - assem += sizeof( struct sh_op ) / sizeof( unsigned ); - break; - - case SVGA3DOP_COMMENT: - assert( 0 ); - break; - - case SVGA3DOP_RET: - debug_printf( "ret\n" ); - assem += sizeof( struct sh_op ) / sizeof( unsigned ); - break; - - case SVGA3DOP_END: - debug_printf( "end\n" ); - finished = TRUE; - break; - - default: - { - const struct sh_opcode_info *info = sh_svga_opcode_info( op.opcode ); - uint i; - uint num_src = info->num_src + op.predicated; - boolean not_first_arg = FALSE; - - assert( info->num_dst <= 1 ); - - if (op.opcode == SVGA3DOP_SINCOS && di.version.major < 3) - num_src += 2; - - dump_comp_op( op, info->mnemonic ); - assem += sizeof( struct sh_op ) / sizeof( unsigned ); - - if (info->num_dst > 0) { - struct sh_dstreg dstreg = *(struct sh_dstreg *) assem; - - dump_dstreg( dstreg, &di ); - assem += sizeof( struct sh_dstreg ) / sizeof( unsigned ); - not_first_arg = TRUE; - } - - for (i = 0; i < num_src; i++) { - struct sh_srcreg srcreg; - struct sh_srcreg indreg; - - srcreg = *(struct sh_srcreg *) assem; - assem += sizeof( struct sh_srcreg ) / sizeof( unsigned ); - if (srcreg.relative && !di.is_ps && di.version.major >= 2) { - indreg = *(struct sh_srcreg *) assem; - assem += sizeof( struct sh_srcreg ) / sizeof( unsigned ); - } - - if (not_first_arg) - debug_printf( ", " ); - else - debug_printf( " " ); - dump_srcreg( srcreg, &indreg, &di ); - not_first_arg = TRUE; - } - - debug_printf( "\n" ); - } - } - } -} diff --git a/src/gallium/drivers/svga/svgadump/st_shader_dump.h b/src/gallium/drivers/svga/svgadump/st_shader_dump.h deleted file mode 100644 index af5549cdba..0000000000 --- a/src/gallium/drivers/svga/svgadump/st_shader_dump.h +++ /dev/null @@ -1,42 +0,0 @@ -/********************************************************** - * Copyright 2008-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, 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. - * - **********************************************************/ - -/** - * @file - * SVGA Shader Dump Facilities - * - * @author Michal Krol - */ - -#ifndef ST_SHADER_SVGA_DUMP_H -#define ST_SHADER_SVGA_DUMP_H - -void -sh_svga_dump( - const unsigned *assem, - unsigned dwords, - unsigned do_binary ); - -#endif /* ST_SHADER_SVGA_DUMP_H */ diff --git a/src/gallium/drivers/svga/svgadump/st_shader_op.c b/src/gallium/drivers/svga/svgadump/st_shader_op.c deleted file mode 100644 index 2c05382ab9..0000000000 --- a/src/gallium/drivers/svga/svgadump/st_shader_op.c +++ /dev/null @@ -1,168 +0,0 @@ -/********************************************************** - * Copyright 2008-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, 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. - * - **********************************************************/ - -/** - * @file - * SVGA Shader Token Opcode Info - * - * @author Michal Krol - */ - -#include "util/u_debug.h" -#include "st_shader_op.h" - -#include "../svga_hw_reg.h" -#include "svga3d_shaderdefs.h" - -#define SVGA3DOP_INVALID SVGA3DOP_END -#define TGSI_OPCODE_INVALID TGSI_OPCODE_LAST - -static struct sh_opcode_info opcode_info[] = -{ - { "nop", 0, 0, SVGA3DOP_NOP }, - { "mov", 1, 1, SVGA3DOP_MOV, }, - { "add", 1, 2, SVGA3DOP_ADD, }, - { "sub", 1, 2, SVGA3DOP_SUB, }, - { "mad", 1, 3, SVGA3DOP_MAD, }, - { "mul", 1, 2, SVGA3DOP_MUL, }, - { "rcp", 1, 1, SVGA3DOP_RCP, }, - { "rsq", 1, 1, SVGA3DOP_RSQ, }, - { "dp3", 1, 2, SVGA3DOP_DP3, }, - { "dp4", 1, 2, SVGA3DOP_DP4, }, - { "min", 1, 2, SVGA3DOP_MIN, }, - { "max", 1, 2, SVGA3DOP_MAX, }, - { "slt", 1, 2, SVGA3DOP_SLT, }, - { "sge", 1, 2, SVGA3DOP_SGE, }, - { "exp", 1, 1, SVGA3DOP_EXP, }, - { "log", 1, 1, SVGA3DOP_LOG, }, - { "lit", 1, 1, SVGA3DOP_LIT, }, - { "dst", 1, 2, SVGA3DOP_DST, }, - { "lrp", 1, 3, SVGA3DOP_LRP, }, - { "frc", 1, 1, SVGA3DOP_FRC, }, - { "m4x4", 1, 2, SVGA3DOP_M4x4, }, - { "m4x3", 1, 2, SVGA3DOP_M4x3, }, - { "m3x4", 1, 2, SVGA3DOP_M3x4, }, - { "m3x3", 1, 2, SVGA3DOP_M3x3, }, - { "m3x2", 1, 2, SVGA3DOP_M3x2, }, - { "call", 0, 1, SVGA3DOP_CALL, }, - { "callnz", 0, 2, SVGA3DOP_CALLNZ, }, - { "loop", 0, 2, SVGA3DOP_LOOP, }, - { "ret", 0, 0, SVGA3DOP_RET, }, - { "endloop", 0, 0, SVGA3DOP_ENDLOOP, }, - { "label", 0, 1, SVGA3DOP_LABEL, }, - { "dcl", 0, 0, SVGA3DOP_DCL, }, - { "pow", 1, 2, SVGA3DOP_POW, }, - { "crs", 1, 2, SVGA3DOP_CRS, }, - { "sgn", 1, 3, SVGA3DOP_SGN, }, - { "abs", 1, 1, SVGA3DOP_ABS, }, - { "nrm", 1, 1, SVGA3DOP_NRM, }, /* 3-componenet normalization */ - { "sincos", 1, 1, SVGA3DOP_SINCOS, }, - { "rep", 0, 1, SVGA3DOP_REP, }, - { "endrep", 0, 0, SVGA3DOP_ENDREP, }, - { "if", 0, 1, SVGA3DOP_IF, }, - { "ifc", 0, 2, SVGA3DOP_IFC, }, - { "else", 0, 0, SVGA3DOP_ELSE, }, - { "endif", 0, 0, SVGA3DOP_ENDIF, }, - { "break", 0, 0, SVGA3DOP_BREAK, }, - { "breakc", 0, 0, SVGA3DOP_BREAKC, }, - { "mova", 1, 1, SVGA3DOP_MOVA, }, - { "defb", 0, 0, SVGA3DOP_DEFB, }, - { "defi", 0, 0, SVGA3DOP_DEFI, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "texcoord", 0, 0, SVGA3DOP_TEXCOORD, }, - { "texkill", 1, 0, SVGA3DOP_TEXKILL, }, - { "tex", 0, 0, SVGA3DOP_TEX, }, - { "texbem", 1, 1, SVGA3DOP_TEXBEM, }, - { "texbeml", 1, 1, SVGA3DOP_TEXBEML, }, - { "texreg2ar", 1, 1, SVGA3DOP_TEXREG2AR, }, - { "texreg2gb", 1, 1, SVGA3DOP_TEXREG2GB, }, - { "texm3x2pad", 1, 1, SVGA3DOP_TEXM3x2PAD, }, - { "texm3x2tex", 1, 1, SVGA3DOP_TEXM3x2TEX, }, - { "texm3x3pad", 1, 1, SVGA3DOP_TEXM3x3PAD, }, - { "texm3x3tex", 1, 1, SVGA3DOP_TEXM3x3TEX, }, - { "reserved0", 0, 0, SVGA3DOP_RESERVED0, }, - { "texm3x3spec", 1, 2, SVGA3DOP_TEXM3x3SPEC, }, - { "texm3x3vspec", 1, 1, SVGA3DOP_TEXM3x3VSPEC,}, - { "expp", 1, 1, SVGA3DOP_EXPP, }, - { "logp", 1, 1, SVGA3DOP_LOGP, }, - { "cnd", 1, 3, SVGA3DOP_CND, }, - { "def", 0, 0, SVGA3DOP_DEF, }, - { "texreg2rgb", 1, 1, SVGA3DOP_TEXREG2RGB, }, - { "texdp3tex", 1, 1, SVGA3DOP_TEXDP3TEX, }, - { "texm3x2depth", 1, 1, SVGA3DOP_TEXM3x2DEPTH,}, - { "texdp3", 1, 1, SVGA3DOP_TEXDP3, }, - { "texm3x3", 1, 1, SVGA3DOP_TEXM3x3, }, - { "texdepth", 1, 0, SVGA3DOP_TEXDEPTH, }, - { "cmp", 1, 3, SVGA3DOP_CMP, }, - { "bem", 1, 2, SVGA3DOP_BEM, }, - { "dp2add", 1, 3, SVGA3DOP_DP2ADD, }, - { "dsx", 1, 1, SVGA3DOP_INVALID, }, - { "dsy", 1, 1, SVGA3DOP_INVALID, }, - { "texldd", 1, 1, SVGA3DOP_INVALID, }, - { "setp", 1, 2, SVGA3DOP_SETP, }, - { "texldl", 1, 1, SVGA3DOP_INVALID, }, - { "breakp", 1, 1, SVGA3DOP_INVALID, }, -}; - -const struct sh_opcode_info *sh_svga_opcode_info( uint op ) -{ - struct sh_opcode_info *info; - - if (op >= sizeof( opcode_info ) / sizeof( opcode_info[0] )) { - /* The opcode is either PHASE, COMMENT, END or out of range. - */ - assert( 0 ); - return NULL; - } - - info = &opcode_info[op]; - - if (info->svga_opcode == SVGA3DOP_INVALID) { - /* No valid information. Please provide number of dst/src registers. - */ - assert( 0 ); - return NULL; - } - - /* Sanity check. - */ - assert( op == info->svga_opcode ); - - return info; -} diff --git a/src/gallium/drivers/svga/svgadump/st_shader_op.h b/src/gallium/drivers/svga/svgadump/st_shader_op.h deleted file mode 100644 index 01d39dca84..0000000000 --- a/src/gallium/drivers/svga/svgadump/st_shader_op.h +++ /dev/null @@ -1,46 +0,0 @@ -/********************************************************** - * Copyright 2008-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, 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. - * - **********************************************************/ - -/** - * @file - * SVGA Shader Token Opcode Info - * - * @author Michal Krol - */ - -#ifndef ST_SHADER_SVGA_OP_H -#define ST_SHADER_SVGA_OP_H - -struct sh_opcode_info -{ - const char *mnemonic; - unsigned num_dst:8; - unsigned num_src:8; - unsigned svga_opcode:16; -}; - -const struct sh_opcode_info *sh_svga_opcode_info( unsigned op ); - -#endif /* ST_SHADER_SVGA_OP_H */ diff --git a/src/gallium/drivers/svga/svgadump/svga_dump.c b/src/gallium/drivers/svga/svgadump/svga_dump.c index 180dde8dc1..c6c353f58e 100644 --- a/src/gallium/drivers/svga/svgadump/svga_dump.c +++ b/src/gallium/drivers/svga/svgadump/svga_dump.c @@ -31,7 +31,7 @@ */ #include "svga_types.h" -#include "st_shader_dump.h" +#include "svga_shader_dump.h" #include "svga3d_reg.h" #include "util/u_debug.h" diff --git a/src/gallium/drivers/svga/svgadump/svga_dump.py b/src/gallium/drivers/svga/svgadump/svga_dump.py index 3cb29c395b..288e753296 100755 --- a/src/gallium/drivers/svga/svgadump/svga_dump.py +++ b/src/gallium/drivers/svga/svgadump/svga_dump.py @@ -291,7 +291,7 @@ def main(): print ' */' print print '#include "svga_types.h"' - print '#include "shader_dump/st_shader_dump.h"' + print '#include "svga_shader_dump.h"' print '#include "svga3d_reg.h"' print print '#include "pipe/p_debug.h"' diff --git a/src/gallium/drivers/svga/svgadump/svga_shader.h b/src/gallium/drivers/svga/svgadump/svga_shader.h new file mode 100644 index 0000000000..2fc1796a90 --- /dev/null +++ b/src/gallium/drivers/svga/svgadump/svga_shader.h @@ -0,0 +1,214 @@ +/********************************************************** + * Copyright 2007-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, 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. + * + **********************************************************/ + +/** + * @file + * SVGA Shader Token Definitions + * + * @author Michal Krol + */ + +#ifndef ST_SHADER_SVGA_H +#define ST_SHADER_SVGA_H + +#include "pipe/p_compiler.h" + +struct sh_op +{ + unsigned opcode:16; + unsigned control:8; + unsigned length:4; + unsigned predicated:1; + unsigned unused:1; + unsigned coissue:1; + unsigned is_reg:1; +}; + +struct sh_reg +{ + unsigned number:11; + unsigned type_hi:2; + unsigned relative:1; + unsigned unused:14; + unsigned type_lo:3; + unsigned is_reg:1; +}; + +static INLINE unsigned +sh_reg_type( struct sh_reg reg ) +{ + return reg.type_lo | (reg.type_hi << 3); +} + +struct sh_cdata +{ + float xyzw[4]; +}; + +struct sh_def +{ + struct sh_op op; + struct sh_reg reg; + struct sh_cdata cdata; +}; + +struct sh_defb +{ + struct sh_op op; + struct sh_reg reg; + uint data; +}; + +struct sh_idata +{ + int xyzw[4]; +}; + +struct sh_defi +{ + struct sh_op op; + struct sh_reg reg; + struct sh_idata idata; +}; + +#define PS_TEXTURETYPE_UNKNOWN SVGA3DSAMP_UNKNOWN +#define PS_TEXTURETYPE_2D SVGA3DSAMP_2D +#define PS_TEXTURETYPE_CUBE SVGA3DSAMP_CUBE +#define PS_TEXTURETYPE_VOLUME SVGA3DSAMP_VOLUME + +struct ps_sampleinfo +{ + unsigned unused:27; + unsigned texture_type:4; + unsigned is_reg:1; +}; + +struct vs_semantic +{ + unsigned usage:5; + unsigned unused1:11; + unsigned usage_index:4; + unsigned unused2:12; +}; + +struct sh_dstreg +{ + unsigned number:11; + unsigned type_hi:2; + unsigned relative:1; + unsigned unused:2; + unsigned write_mask:4; + unsigned modifier:4; + unsigned shift_scale:4; + unsigned type_lo:3; + unsigned is_reg:1; +}; + +static INLINE unsigned +sh_dstreg_type( struct sh_dstreg reg ) +{ + return reg.type_lo | (reg.type_hi << 3); +} + +struct sh_dcl +{ + struct sh_op op; + union { + struct { + struct ps_sampleinfo sampleinfo; + } ps; + struct { + struct vs_semantic semantic; + } vs; + } u; + struct sh_dstreg reg; +}; + + +struct sh_srcreg +{ + unsigned number:11; + unsigned type_hi:2; + unsigned relative:1; + unsigned unused:2; + unsigned swizzle_x:2; + unsigned swizzle_y:2; + unsigned swizzle_z:2; + unsigned swizzle_w:2; + unsigned modifier:4; + unsigned type_lo:3; + unsigned is_reg:1; +}; + +static INLINE unsigned +sh_srcreg_type( struct sh_srcreg reg ) +{ + return reg.type_lo | (reg.type_hi << 3); +} + +struct sh_dstop +{ + struct sh_op op; + struct sh_dstreg dst; +}; + +struct sh_srcop +{ + struct sh_op op; + struct sh_srcreg src; +}; + +struct sh_src2op +{ + struct sh_op op; + struct sh_srcreg src0; + struct sh_srcreg src1; +}; + +struct sh_unaryop +{ + struct sh_op op; + struct sh_dstreg dst; + struct sh_srcreg src; +}; + +struct sh_binaryop +{ + struct sh_op op; + struct sh_dstreg dst; + struct sh_srcreg src0; + struct sh_srcreg src1; +}; + +struct sh_trinaryop +{ + struct sh_op op; + struct sh_dstreg dst; + struct sh_srcreg src0; + struct sh_srcreg src1; + struct sh_srcreg src2; +}; + +#endif /* ST_SHADER_SVGA_H */ diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c new file mode 100644 index 0000000000..c654126d3a --- /dev/null +++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c @@ -0,0 +1,649 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +/** + * @file + * SVGA Shader Dump Facilities + * + * @author Michal Krol + */ + +#include "svga_shader.h" +#include "svga_shader_dump.h" +#include "svga_shader_op.h" +#include "util/u_debug.h" + +#include "../svga_hw_reg.h" +#include "svga3d_shaderdefs.h" + +struct dump_info +{ + SVGA3dShaderVersion version; + boolean is_ps; +}; + +static void dump_op( struct sh_op op, const char *mnemonic ) +{ + assert( op.predicated == 0 ); + assert( op.is_reg == 0 ); + + if (op.coissue) + debug_printf( "+" ); + debug_printf( "%s", mnemonic ); + switch (op.control) { + case 0: + break; + case SVGA3DOPCONT_PROJECT: + debug_printf( "p" ); + break; + case SVGA3DOPCONT_BIAS: + debug_printf( "b" ); + break; + default: + assert( 0 ); + } +} + + +static void dump_comp_op( struct sh_op op, const char *mnemonic ) +{ + assert( op.is_reg == 0 ); + + if (op.coissue) + debug_printf( "+" ); + debug_printf( "%s", mnemonic ); + switch (op.control) { + case SVGA3DOPCOMP_RESERVED0: + break; + case SVGA3DOPCOMP_GT: + debug_printf("_gt"); + break; + case SVGA3DOPCOMP_EQ: + debug_printf("_eq"); + break; + case SVGA3DOPCOMP_GE: + debug_printf("_ge"); + break; + case SVGA3DOPCOMP_LT: + debug_printf("_lt"); + break; + case SVGA3DOPCOMPC_NE: + debug_printf("_ne"); + break; + case SVGA3DOPCOMP_LE: + debug_printf("_le"); + break; + case SVGA3DOPCOMP_RESERVED1: + default: + assert( 0 ); + } +} + + +static void dump_reg( struct sh_reg reg, struct sh_srcreg *indreg, const struct dump_info *di ) +{ + assert( sh_reg_type( reg ) == SVGA3DREG_CONST || reg.relative == 0 ); + assert( reg.is_reg == 1 ); + + switch (sh_reg_type( reg )) { + case SVGA3DREG_TEMP: + debug_printf( "r%u", reg.number ); + break; + + case SVGA3DREG_INPUT: + debug_printf( "v%u", reg.number ); + break; + + case SVGA3DREG_CONST: + if (reg.relative) { + if (sh_srcreg_type( *indreg ) == SVGA3DREG_LOOP) + debug_printf( "c[aL+%u]", reg.number ); + else + debug_printf( "c[a%u.x+%u]", indreg->number, reg.number ); + } + else + debug_printf( "c%u", reg.number ); + break; + + case SVGA3DREG_ADDR: /* VS */ + /* SVGA3DREG_TEXTURE */ /* PS */ + if (di->is_ps) + debug_printf( "t%u", reg.number ); + else + debug_printf( "a%u", reg.number ); + break; + + case SVGA3DREG_RASTOUT: + switch (reg.number) { + case 0 /*POSITION*/: + debug_printf( "oPos" ); + break; + case 1 /*FOG*/: + debug_printf( "oFog" ); + break; + case 2 /*POINT_SIZE*/: + debug_printf( "oPts" ); + break; + default: + assert( 0 ); + debug_printf( "???" ); + } + break; + + case SVGA3DREG_ATTROUT: + assert( reg.number < 2 ); + debug_printf( "oD%u", reg.number ); + break; + + case SVGA3DREG_TEXCRDOUT: + /* SVGA3DREG_OUTPUT */ + debug_printf( "oT%u", reg.number ); + break; + + case SVGA3DREG_COLOROUT: + debug_printf( "oC%u", reg.number ); + break; + + case SVGA3DREG_DEPTHOUT: + debug_printf( "oD%u", reg.number ); + break; + + case SVGA3DREG_SAMPLER: + debug_printf( "s%u", reg.number ); + break; + + case SVGA3DREG_CONSTBOOL: + assert( !reg.relative ); + debug_printf( "b%u", reg.number ); + break; + + case SVGA3DREG_CONSTINT: + assert( !reg.relative ); + debug_printf( "i%u", reg.number ); + break; + + case SVGA3DREG_LOOP: + assert( reg.number == 0 ); + debug_printf( "aL" ); + break; + + case SVGA3DREG_MISCTYPE: + switch (reg.number) { + case SVGA3DMISCREG_POSITION: + debug_printf( "vPos" ); + break; + case SVGA3DMISCREG_FACE: + debug_printf( "vFace" ); + break; + default: + assert(0); + break; + } + break; + + case SVGA3DREG_LABEL: + debug_printf( "l%u", reg.number ); + break; + + case SVGA3DREG_PREDICATE: + debug_printf( "p%u", reg.number ); + break; + + + default: + assert( 0 ); + debug_printf( "???" ); + } +} + +static void dump_cdata( struct sh_cdata cdata ) +{ + debug_printf( "%f, %f, %f, %f", cdata.xyzw[0], cdata.xyzw[1], cdata.xyzw[2], cdata.xyzw[3] ); +} + +static void dump_idata( struct sh_idata idata ) +{ + debug_printf( "%d, %d, %d, %d", idata.xyzw[0], idata.xyzw[1], idata.xyzw[2], idata.xyzw[3] ); +} + +static void dump_bdata( boolean bdata ) +{ + debug_printf( bdata ? "TRUE" : "FALSE" ); +} + +static void dump_sampleinfo( struct ps_sampleinfo sampleinfo ) +{ + switch (sampleinfo.texture_type) { + case SVGA3DSAMP_2D: + debug_printf( "_2d" ); + break; + case SVGA3DSAMP_CUBE: + debug_printf( "_cube" ); + break; + case SVGA3DSAMP_VOLUME: + debug_printf( "_volume" ); + break; + default: + assert( 0 ); + } +} + + +static void dump_usageinfo( struct vs_semantic semantic ) +{ + switch (semantic.usage) { + case SVGA3D_DECLUSAGE_POSITION: + debug_printf("_position" ); + break; + case SVGA3D_DECLUSAGE_BLENDWEIGHT: + debug_printf("_blendweight" ); + break; + case SVGA3D_DECLUSAGE_BLENDINDICES: + debug_printf("_blendindices" ); + break; + case SVGA3D_DECLUSAGE_NORMAL: + debug_printf("_normal" ); + break; + case SVGA3D_DECLUSAGE_PSIZE: + debug_printf("_psize" ); + break; + case SVGA3D_DECLUSAGE_TEXCOORD: + debug_printf("_texcoord"); + break; + case SVGA3D_DECLUSAGE_TANGENT: + debug_printf("_tangent" ); + break; + case SVGA3D_DECLUSAGE_BINORMAL: + debug_printf("_binormal" ); + break; + case SVGA3D_DECLUSAGE_TESSFACTOR: + debug_printf("_tessfactor" ); + break; + case SVGA3D_DECLUSAGE_POSITIONT: + debug_printf("_positiont" ); + break; + case SVGA3D_DECLUSAGE_COLOR: + debug_printf("_color" ); + break; + case SVGA3D_DECLUSAGE_FOG: + debug_printf("_fog" ); + break; + case SVGA3D_DECLUSAGE_DEPTH: + debug_printf("_depth" ); + break; + case SVGA3D_DECLUSAGE_SAMPLE: + debug_printf("_sample"); + break; + default: + assert( 0 ); + return; + } + + if (semantic.usage_index != 0) { + debug_printf("%d", semantic.usage_index ); + } +} + +static void dump_dstreg( struct sh_dstreg dstreg, const struct dump_info *di ) +{ + union { + struct sh_reg reg; + struct sh_dstreg dstreg; + } u; + + assert( (dstreg.modifier & (SVGA3DDSTMOD_SATURATE | SVGA3DDSTMOD_PARTIALPRECISION)) == dstreg.modifier ); + + if (dstreg.modifier & SVGA3DDSTMOD_SATURATE) + debug_printf( "_sat" ); + if (dstreg.modifier & SVGA3DDSTMOD_PARTIALPRECISION) + debug_printf( "_pp" ); + switch (dstreg.shift_scale) { + case 0: + break; + case 1: + debug_printf( "_x2" ); + break; + case 2: + debug_printf( "_x4" ); + break; + case 3: + debug_printf( "_x8" ); + break; + case 13: + debug_printf( "_d8" ); + break; + case 14: + debug_printf( "_d4" ); + break; + case 15: + debug_printf( "_d2" ); + break; + default: + assert( 0 ); + } + debug_printf( " " ); + + u.dstreg = dstreg; + dump_reg( u.reg, NULL, di ); + if (dstreg.write_mask != SVGA3DWRITEMASK_ALL) { + debug_printf( "." ); + if (dstreg.write_mask & SVGA3DWRITEMASK_0) + debug_printf( "x" ); + if (dstreg.write_mask & SVGA3DWRITEMASK_1) + debug_printf( "y" ); + if (dstreg.write_mask & SVGA3DWRITEMASK_2) + debug_printf( "z" ); + if (dstreg.write_mask & SVGA3DWRITEMASK_3) + debug_printf( "w" ); + } +} + +static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, const struct dump_info *di ) +{ + union { + struct sh_reg reg; + struct sh_srcreg srcreg; + } u; + + switch (srcreg.modifier) { + case SVGA3DSRCMOD_NEG: + case SVGA3DSRCMOD_BIASNEG: + case SVGA3DSRCMOD_SIGNNEG: + case SVGA3DSRCMOD_X2NEG: + debug_printf( "-" ); + break; + case SVGA3DSRCMOD_ABS: + debug_printf( "|" ); + break; + case SVGA3DSRCMOD_ABSNEG: + debug_printf( "-|" ); + break; + case SVGA3DSRCMOD_COMP: + debug_printf( "1-" ); + break; + case SVGA3DSRCMOD_NOT: + debug_printf( "!" ); + } + + u.srcreg = srcreg; + dump_reg( u.reg, indreg, di ); + switch (srcreg.modifier) { + case SVGA3DSRCMOD_NONE: + case SVGA3DSRCMOD_NEG: + case SVGA3DSRCMOD_COMP: + case SVGA3DSRCMOD_NOT: + break; + case SVGA3DSRCMOD_ABS: + case SVGA3DSRCMOD_ABSNEG: + debug_printf( "|" ); + break; + case SVGA3DSRCMOD_BIAS: + case SVGA3DSRCMOD_BIASNEG: + debug_printf( "_bias" ); + break; + case SVGA3DSRCMOD_SIGN: + case SVGA3DSRCMOD_SIGNNEG: + debug_printf( "_bx2" ); + break; + case SVGA3DSRCMOD_X2: + case SVGA3DSRCMOD_X2NEG: + debug_printf( "_x2" ); + break; + case SVGA3DSRCMOD_DZ: + debug_printf( "_dz" ); + break; + case SVGA3DSRCMOD_DW: + debug_printf( "_dw" ); + break; + default: + assert( 0 ); + } + if (srcreg.swizzle_x != 0 || srcreg.swizzle_y != 1 || srcreg.swizzle_z != 2 || srcreg.swizzle_w != 3) { + debug_printf( "." ); + if (srcreg.swizzle_x == srcreg.swizzle_y && srcreg.swizzle_y == srcreg.swizzle_z && srcreg.swizzle_z == srcreg.swizzle_w) { + debug_printf( "%c", "xyzw"[srcreg.swizzle_x] ); + } + else { + debug_printf( "%c", "xyzw"[srcreg.swizzle_x] ); + debug_printf( "%c", "xyzw"[srcreg.swizzle_y] ); + debug_printf( "%c", "xyzw"[srcreg.swizzle_z] ); + debug_printf( "%c", "xyzw"[srcreg.swizzle_w] ); + } + } +} + +void +sh_svga_dump( + const unsigned *assem, + unsigned dwords, + unsigned do_binary ) +{ + const unsigned *start = assem; + boolean finished = FALSE; + struct dump_info di; + unsigned i; + + if (do_binary) { + for (i = 0; i < dwords; i++) + debug_printf(" 0x%08x,\n", assem[i]); + + debug_printf("\n\n"); + } + + di.version.value = *assem++; + di.is_ps = (di.version.type == SVGA3D_PS_TYPE); + + debug_printf( + "%s_%u_%u\n", + di.is_ps ? "ps" : "vs", + di.version.major, + di.version.minor ); + + while (!finished) { + struct sh_op op = *(struct sh_op *) assem; + + if (assem - start >= dwords) { + debug_printf("... ran off end of buffer\n"); + assert(0); + return; + } + + switch (op.opcode) { + case SVGA3DOP_DCL: + { + struct sh_dcl dcl = *(struct sh_dcl *) assem; + + debug_printf( "dcl" ); + if (sh_dstreg_type( dcl.reg ) == SVGA3DREG_SAMPLER) + dump_sampleinfo( dcl.u.ps.sampleinfo ); + else if (di.is_ps) { + if (di.version.major == 3 && + sh_dstreg_type( dcl.reg ) != SVGA3DREG_MISCTYPE) + dump_usageinfo( dcl.u.vs.semantic ); + } + else + dump_usageinfo( dcl.u.vs.semantic ); + dump_dstreg( dcl.reg, &di ); + debug_printf( "\n" ); + assem += sizeof( struct sh_dcl ) / sizeof( unsigned ); + } + break; + + case SVGA3DOP_DEFB: + { + struct sh_defb defb = *(struct sh_defb *) assem; + + debug_printf( "defb " ); + dump_reg( defb.reg, NULL, &di ); + debug_printf( ", " ); + dump_bdata( defb.data ); + debug_printf( "\n" ); + assem += sizeof( struct sh_defb ) / sizeof( unsigned ); + } + break; + + case SVGA3DOP_DEFI: + { + struct sh_defi defi = *(struct sh_defi *) assem; + + debug_printf( "defi " ); + dump_reg( defi.reg, NULL, &di ); + debug_printf( ", " ); + dump_idata( defi.idata ); + debug_printf( "\n" ); + assem += sizeof( struct sh_defi ) / sizeof( unsigned ); + } + break; + + case SVGA3DOP_TEXCOORD: + assert( di.is_ps ); + dump_op( op, "texcoord" ); + if (0) { + struct sh_dstop dstop = *(struct sh_dstop *) assem; + dump_dstreg( dstop.dst, &di ); + assem += sizeof( struct sh_dstop ) / sizeof( unsigned ); + } + else { + struct sh_unaryop unaryop = *(struct sh_unaryop *) assem; + dump_dstreg( unaryop.dst, &di ); + debug_printf( ", " ); + dump_srcreg( unaryop.src, NULL, &di ); + assem += sizeof( struct sh_unaryop ) / sizeof( unsigned ); + } + debug_printf( "\n" ); + break; + + case SVGA3DOP_TEX: + assert( di.is_ps ); + if (0) { + dump_op( op, "tex" ); + if (0) { + struct sh_dstop dstop = *(struct sh_dstop *) assem; + + dump_dstreg( dstop.dst, &di ); + assem += sizeof( struct sh_dstop ) / sizeof( unsigned ); + } + else { + struct sh_unaryop unaryop = *(struct sh_unaryop *) assem; + + dump_dstreg( unaryop.dst, &di ); + debug_printf( ", " ); + dump_srcreg( unaryop.src, NULL, &di ); + assem += sizeof( struct sh_unaryop ) / sizeof( unsigned ); + } + } + else { + struct sh_binaryop binaryop = *(struct sh_binaryop *) assem; + + dump_op( op, "texld" ); + dump_dstreg( binaryop.dst, &di ); + debug_printf( ", " ); + dump_srcreg( binaryop.src0, NULL, &di ); + debug_printf( ", " ); + dump_srcreg( binaryop.src1, NULL, &di ); + assem += sizeof( struct sh_binaryop ) / sizeof( unsigned ); + } + debug_printf( "\n" ); + break; + + case SVGA3DOP_DEF: + { + struct sh_def def = *(struct sh_def *) assem; + + debug_printf( "def " ); + dump_reg( def.reg, NULL, &di ); + debug_printf( ", " ); + dump_cdata( def.cdata ); + debug_printf( "\n" ); + assem += sizeof( struct sh_def ) / sizeof( unsigned ); + } + break; + + case SVGA3DOP_PHASE: + debug_printf( "phase\n" ); + assem += sizeof( struct sh_op ) / sizeof( unsigned ); + break; + + case SVGA3DOP_COMMENT: + assert( 0 ); + break; + + case SVGA3DOP_RET: + debug_printf( "ret\n" ); + assem += sizeof( struct sh_op ) / sizeof( unsigned ); + break; + + case SVGA3DOP_END: + debug_printf( "end\n" ); + finished = TRUE; + break; + + default: + { + const struct sh_opcode_info *info = sh_svga_opcode_info( op.opcode ); + uint i; + uint num_src = info->num_src + op.predicated; + boolean not_first_arg = FALSE; + + assert( info->num_dst <= 1 ); + + if (op.opcode == SVGA3DOP_SINCOS && di.version.major < 3) + num_src += 2; + + dump_comp_op( op, info->mnemonic ); + assem += sizeof( struct sh_op ) / sizeof( unsigned ); + + if (info->num_dst > 0) { + struct sh_dstreg dstreg = *(struct sh_dstreg *) assem; + + dump_dstreg( dstreg, &di ); + assem += sizeof( struct sh_dstreg ) / sizeof( unsigned ); + not_first_arg = TRUE; + } + + for (i = 0; i < num_src; i++) { + struct sh_srcreg srcreg; + struct sh_srcreg indreg; + + srcreg = *(struct sh_srcreg *) assem; + assem += sizeof( struct sh_srcreg ) / sizeof( unsigned ); + if (srcreg.relative && !di.is_ps && di.version.major >= 2) { + indreg = *(struct sh_srcreg *) assem; + assem += sizeof( struct sh_srcreg ) / sizeof( unsigned ); + } + + if (not_first_arg) + debug_printf( ", " ); + else + debug_printf( " " ); + dump_srcreg( srcreg, &indreg, &di ); + not_first_arg = TRUE; + } + + debug_printf( "\n" ); + } + } + } +} diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.h b/src/gallium/drivers/svga/svgadump/svga_shader_dump.h new file mode 100644 index 0000000000..af5549cdba --- /dev/null +++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.h @@ -0,0 +1,42 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +/** + * @file + * SVGA Shader Dump Facilities + * + * @author Michal Krol + */ + +#ifndef ST_SHADER_SVGA_DUMP_H +#define ST_SHADER_SVGA_DUMP_H + +void +sh_svga_dump( + const unsigned *assem, + unsigned dwords, + unsigned do_binary ); + +#endif /* ST_SHADER_SVGA_DUMP_H */ diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_op.c b/src/gallium/drivers/svga/svgadump/svga_shader_op.c new file mode 100644 index 0000000000..cecc22106b --- /dev/null +++ b/src/gallium/drivers/svga/svgadump/svga_shader_op.c @@ -0,0 +1,168 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +/** + * @file + * SVGA Shader Token Opcode Info + * + * @author Michal Krol + */ + +#include "util/u_debug.h" +#include "svga_shader_op.h" + +#include "../svga_hw_reg.h" +#include "svga3d_shaderdefs.h" + +#define SVGA3DOP_INVALID SVGA3DOP_END +#define TGSI_OPCODE_INVALID TGSI_OPCODE_LAST + +static struct sh_opcode_info opcode_info[] = +{ + { "nop", 0, 0, SVGA3DOP_NOP }, + { "mov", 1, 1, SVGA3DOP_MOV, }, + { "add", 1, 2, SVGA3DOP_ADD, }, + { "sub", 1, 2, SVGA3DOP_SUB, }, + { "mad", 1, 3, SVGA3DOP_MAD, }, + { "mul", 1, 2, SVGA3DOP_MUL, }, + { "rcp", 1, 1, SVGA3DOP_RCP, }, + { "rsq", 1, 1, SVGA3DOP_RSQ, }, + { "dp3", 1, 2, SVGA3DOP_DP3, }, + { "dp4", 1, 2, SVGA3DOP_DP4, }, + { "min", 1, 2, SVGA3DOP_MIN, }, + { "max", 1, 2, SVGA3DOP_MAX, }, + { "slt", 1, 2, SVGA3DOP_SLT, }, + { "sge", 1, 2, SVGA3DOP_SGE, }, + { "exp", 1, 1, SVGA3DOP_EXP, }, + { "log", 1, 1, SVGA3DOP_LOG, }, + { "lit", 1, 1, SVGA3DOP_LIT, }, + { "dst", 1, 2, SVGA3DOP_DST, }, + { "lrp", 1, 3, SVGA3DOP_LRP, }, + { "frc", 1, 1, SVGA3DOP_FRC, }, + { "m4x4", 1, 2, SVGA3DOP_M4x4, }, + { "m4x3", 1, 2, SVGA3DOP_M4x3, }, + { "m3x4", 1, 2, SVGA3DOP_M3x4, }, + { "m3x3", 1, 2, SVGA3DOP_M3x3, }, + { "m3x2", 1, 2, SVGA3DOP_M3x2, }, + { "call", 0, 1, SVGA3DOP_CALL, }, + { "callnz", 0, 2, SVGA3DOP_CALLNZ, }, + { "loop", 0, 2, SVGA3DOP_LOOP, }, + { "ret", 0, 0, SVGA3DOP_RET, }, + { "endloop", 0, 0, SVGA3DOP_ENDLOOP, }, + { "label", 0, 1, SVGA3DOP_LABEL, }, + { "dcl", 0, 0, SVGA3DOP_DCL, }, + { "pow", 1, 2, SVGA3DOP_POW, }, + { "crs", 1, 2, SVGA3DOP_CRS, }, + { "sgn", 1, 3, SVGA3DOP_SGN, }, + { "abs", 1, 1, SVGA3DOP_ABS, }, + { "nrm", 1, 1, SVGA3DOP_NRM, }, /* 3-componenet normalization */ + { "sincos", 1, 1, SVGA3DOP_SINCOS, }, + { "rep", 0, 1, SVGA3DOP_REP, }, + { "endrep", 0, 0, SVGA3DOP_ENDREP, }, + { "if", 0, 1, SVGA3DOP_IF, }, + { "ifc", 0, 2, SVGA3DOP_IFC, }, + { "else", 0, 0, SVGA3DOP_ELSE, }, + { "endif", 0, 0, SVGA3DOP_ENDIF, }, + { "break", 0, 0, SVGA3DOP_BREAK, }, + { "breakc", 0, 0, SVGA3DOP_BREAKC, }, + { "mova", 1, 1, SVGA3DOP_MOVA, }, + { "defb", 0, 0, SVGA3DOP_DEFB, }, + { "defi", 0, 0, SVGA3DOP_DEFI, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "texcoord", 0, 0, SVGA3DOP_TEXCOORD, }, + { "texkill", 1, 0, SVGA3DOP_TEXKILL, }, + { "tex", 0, 0, SVGA3DOP_TEX, }, + { "texbem", 1, 1, SVGA3DOP_TEXBEM, }, + { "texbeml", 1, 1, SVGA3DOP_TEXBEML, }, + { "texreg2ar", 1, 1, SVGA3DOP_TEXREG2AR, }, + { "texreg2gb", 1, 1, SVGA3DOP_TEXREG2GB, }, + { "texm3x2pad", 1, 1, SVGA3DOP_TEXM3x2PAD, }, + { "texm3x2tex", 1, 1, SVGA3DOP_TEXM3x2TEX, }, + { "texm3x3pad", 1, 1, SVGA3DOP_TEXM3x3PAD, }, + { "texm3x3tex", 1, 1, SVGA3DOP_TEXM3x3TEX, }, + { "reserved0", 0, 0, SVGA3DOP_RESERVED0, }, + { "texm3x3spec", 1, 2, SVGA3DOP_TEXM3x3SPEC, }, + { "texm3x3vspec", 1, 1, SVGA3DOP_TEXM3x3VSPEC,}, + { "expp", 1, 1, SVGA3DOP_EXPP, }, + { "logp", 1, 1, SVGA3DOP_LOGP, }, + { "cnd", 1, 3, SVGA3DOP_CND, }, + { "def", 0, 0, SVGA3DOP_DEF, }, + { "texreg2rgb", 1, 1, SVGA3DOP_TEXREG2RGB, }, + { "texdp3tex", 1, 1, SVGA3DOP_TEXDP3TEX, }, + { "texm3x2depth", 1, 1, SVGA3DOP_TEXM3x2DEPTH,}, + { "texdp3", 1, 1, SVGA3DOP_TEXDP3, }, + { "texm3x3", 1, 1, SVGA3DOP_TEXM3x3, }, + { "texdepth", 1, 0, SVGA3DOP_TEXDEPTH, }, + { "cmp", 1, 3, SVGA3DOP_CMP, }, + { "bem", 1, 2, SVGA3DOP_BEM, }, + { "dp2add", 1, 3, SVGA3DOP_DP2ADD, }, + { "dsx", 1, 1, SVGA3DOP_INVALID, }, + { "dsy", 1, 1, SVGA3DOP_INVALID, }, + { "texldd", 1, 1, SVGA3DOP_INVALID, }, + { "setp", 1, 2, SVGA3DOP_SETP, }, + { "texldl", 1, 1, SVGA3DOP_INVALID, }, + { "breakp", 1, 1, SVGA3DOP_INVALID, }, +}; + +const struct sh_opcode_info *sh_svga_opcode_info( uint op ) +{ + struct sh_opcode_info *info; + + if (op >= sizeof( opcode_info ) / sizeof( opcode_info[0] )) { + /* The opcode is either PHASE, COMMENT, END or out of range. + */ + assert( 0 ); + return NULL; + } + + info = &opcode_info[op]; + + if (info->svga_opcode == SVGA3DOP_INVALID) { + /* No valid information. Please provide number of dst/src registers. + */ + assert( 0 ); + return NULL; + } + + /* Sanity check. + */ + assert( op == info->svga_opcode ); + + return info; +} diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_op.h b/src/gallium/drivers/svga/svgadump/svga_shader_op.h new file mode 100644 index 0000000000..01d39dca84 --- /dev/null +++ b/src/gallium/drivers/svga/svgadump/svga_shader_op.h @@ -0,0 +1,46 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +/** + * @file + * SVGA Shader Token Opcode Info + * + * @author Michal Krol + */ + +#ifndef ST_SHADER_SVGA_OP_H +#define ST_SHADER_SVGA_OP_H + +struct sh_opcode_info +{ + const char *mnemonic; + unsigned num_dst:8; + unsigned num_src:8; + unsigned svga_opcode:16; +}; + +const struct sh_opcode_info *sh_svga_opcode_info( unsigned op ); + +#endif /* ST_SHADER_SVGA_OP_H */ -- cgit v1.2.3 From d185c2fd1318bd41f303ab4a5f6e0a048b76c11c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 24 Nov 2009 14:43:30 +0000 Subject: svga: Use consistent names for public symbol names of shader dumping facilities. --- src/gallium/drivers/svga/svgadump/svga_dump.c | 2 +- src/gallium/drivers/svga/svgadump/svga_shader_dump.c | 4 ++-- src/gallium/drivers/svga/svgadump/svga_shader_dump.h | 8 ++++---- src/gallium/drivers/svga/svgadump/svga_shader_op.c | 2 +- src/gallium/drivers/svga/svgadump/svga_shader_op.h | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svgadump/svga_dump.c b/src/gallium/drivers/svga/svgadump/svga_dump.c index c6c353f58e..910afa2528 100644 --- a/src/gallium/drivers/svga/svgadump/svga_dump.c +++ b/src/gallium/drivers/svga/svgadump/svga_dump.c @@ -1627,7 +1627,7 @@ svga_dump_commands(const void *commands, uint32_t size) const SVGA3dCmdDefineShader *cmd = (const SVGA3dCmdDefineShader *)body; dump_SVGA3dCmdDefineShader(cmd); body = (const uint8_t *)&cmd[1]; - sh_svga_dump((const uint32_t *)body, + svga_shader_dump((const uint32_t *)body, (unsigned)(next - body)/sizeof(uint32_t), FALSE ); body = next; diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c index c654126d3a..7718bdf757 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c +++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c @@ -435,7 +435,7 @@ static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, cons } void -sh_svga_dump( +svga_shader_dump( const unsigned *assem, unsigned dwords, unsigned do_binary ) @@ -602,7 +602,7 @@ sh_svga_dump( default: { - const struct sh_opcode_info *info = sh_svga_opcode_info( op.opcode ); + const struct sh_opcode_info *info = svga_opcode_info( op.opcode ); uint i; uint num_src = info->num_src + op.predicated; boolean not_first_arg = FALSE; diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.h b/src/gallium/drivers/svga/svgadump/svga_shader_dump.h index af5549cdba..a2657acb2f 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader_dump.h +++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.h @@ -30,13 +30,13 @@ * @author Michal Krol */ -#ifndef ST_SHADER_SVGA_DUMP_H -#define ST_SHADER_SVGA_DUMP_H +#ifndef SVGA_SHADER_DUMP_H +#define SVGA_SHADER_DUMP_H void -sh_svga_dump( +svga_shader_dump( const unsigned *assem, unsigned dwords, unsigned do_binary ); -#endif /* ST_SHADER_SVGA_DUMP_H */ +#endif /* SVGA_SHADER_DUMP_H */ diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_op.c b/src/gallium/drivers/svga/svgadump/svga_shader_op.c index cecc22106b..8343bfdaab 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader_op.c +++ b/src/gallium/drivers/svga/svgadump/svga_shader_op.c @@ -140,7 +140,7 @@ static struct sh_opcode_info opcode_info[] = { "breakp", 1, 1, SVGA3DOP_INVALID, }, }; -const struct sh_opcode_info *sh_svga_opcode_info( uint op ) +const struct sh_opcode_info *svga_opcode_info( uint op ) { struct sh_opcode_info *info; diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_op.h b/src/gallium/drivers/svga/svgadump/svga_shader_op.h index 01d39dca84..e558de02c5 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader_op.h +++ b/src/gallium/drivers/svga/svgadump/svga_shader_op.h @@ -30,8 +30,8 @@ * @author Michal Krol */ -#ifndef ST_SHADER_SVGA_OP_H -#define ST_SHADER_SVGA_OP_H +#ifndef SVGA_SHADER_OP_H +#define SVGA_SHADER_OP_H struct sh_opcode_info { @@ -41,6 +41,6 @@ struct sh_opcode_info unsigned svga_opcode:16; }; -const struct sh_opcode_info *sh_svga_opcode_info( unsigned op ); +const struct sh_opcode_info *svga_opcode_info( unsigned op ); -#endif /* ST_SHADER_SVGA_OP_H */ +#endif /* SVGA_SHADER_OP_H */ -- cgit v1.2.3 From 9fbfe6b65d7d45a70553b603f2166be3272d1e35 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Nov 2009 14:44:45 +0000 Subject: tgsi: remove unused Flags member from full_instruction --- src/gallium/auxiliary/tgsi/tgsi_build.c | 2 -- src/gallium/auxiliary/tgsi/tgsi_parse.h | 1 - 2 files changed, 3 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index ce9e72e8b5..fbac265640 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -483,8 +483,6 @@ tgsi_default_full_instruction( void ) full_instruction.FullSrcRegisters[i] = tgsi_default_full_src_register(); } - full_instruction.Flags = 0x0; - return full_instruction; } diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h b/src/gallium/auxiliary/tgsi/tgsi_parse.h index ba9578c6a5..c78d6e64ff 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.h +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h @@ -83,7 +83,6 @@ struct tgsi_full_instruction struct tgsi_instruction_texture InstructionTexture; struct tgsi_full_dst_register FullDstRegisters[TGSI_FULL_MAX_DST_REGISTERS]; struct tgsi_full_src_register FullSrcRegisters[TGSI_FULL_MAX_SRC_REGISTERS]; - uint Flags; /**< user-defined usage */ }; union tgsi_full_token -- cgit v1.2.3 From 42ae0030696f027050c41babced2b408997bb0ce Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Nov 2009 14:45:56 +0000 Subject: tgsi: remove unnecessary full_token init and free functions --- src/gallium/auxiliary/tgsi/tgsi_parse.c | 19 ------------------- src/gallium/auxiliary/tgsi/tgsi_parse.h | 8 -------- 2 files changed, 27 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c index 853485b48b..52c714ebbd 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.c +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c @@ -30,19 +30,6 @@ #include "tgsi_parse.h" #include "util/u_memory.h" -void -tgsi_full_token_init( - union tgsi_full_token *full_token ) -{ - full_token->Token.Type = TGSI_TOKEN_TYPE_DECLARATION; -} - -void -tgsi_full_token_free( - union tgsi_full_token *full_token ) -{ -} - unsigned tgsi_parse_init( struct tgsi_parse_context *ctx, @@ -64,8 +51,6 @@ tgsi_parse_init( ctx->Tokens = tokens; ctx->Position = 1 + ctx->FullHeader.Header.HeaderSize; - tgsi_full_token_init( &ctx->FullToken ); - return TGSI_PARSE_OK; } @@ -73,7 +58,6 @@ void tgsi_parse_free( struct tgsi_parse_context *ctx ) { - tgsi_full_token_free( &ctx->FullToken ); } boolean @@ -118,9 +102,6 @@ tgsi_parse_token( struct tgsi_token token; unsigned i; - tgsi_full_token_free( &ctx->FullToken ); - tgsi_full_token_init( &ctx->FullToken ); - next_token( ctx, &token ); switch( token.Type ) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h b/src/gallium/auxiliary/tgsi/tgsi_parse.h index c78d6e64ff..48e6987ab7 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.h +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h @@ -93,14 +93,6 @@ union tgsi_full_token struct tgsi_full_instruction FullInstruction; }; -void -tgsi_full_token_init( - union tgsi_full_token *full_token ); - -void -tgsi_full_token_free( - union tgsi_full_token *full_token ); - struct tgsi_parse_context { const struct tgsi_token *Tokens; -- cgit v1.2.3 From f3a0615fb0452f11f4db88861b30b2177bdd948a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 15 Nov 2009 12:14:03 -0800 Subject: svga: Handle comment tokens when dumping. --- src/gallium/drivers/svga/svgadump/svga_shader.h | 6 ++++++ src/gallium/drivers/svga/svgadump/svga_shader_dump.c | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svgadump/svga_shader.h b/src/gallium/drivers/svga/svgadump/svga_shader.h index 2fc1796a90..9217af2dd9 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader.h +++ b/src/gallium/drivers/svga/svgadump/svga_shader.h @@ -211,4 +211,10 @@ struct sh_trinaryop struct sh_srcreg src2; }; +struct sh_comment +{ + unsigned opcode:16; + unsigned size:16; +}; + #endif /* ST_SHADER_SVGA_H */ diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c index 7718bdf757..b0e7fdf378 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c +++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c @@ -587,7 +587,12 @@ svga_shader_dump( break; case SVGA3DOP_COMMENT: - assert( 0 ); + { + struct sh_comment comment = *(struct sh_comment *)assem; + + /* Ignore comment contents. */ + assem += sizeof(struct sh_comment) / sizeof(unsigned) + comment.size; + } break; case SVGA3DOP_RET: -- cgit v1.2.3 From 763426a0256f0ab06f8af53947bd630f8600183a Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Nov 2009 14:53:29 +0000 Subject: tgsi: reduce repetition of structure name in its members Rename Semantic.SemanticName to Semantic.Name. Similar for SemanticIndex, and the members of the tgsi_version struct. --- src/gallium/auxiliary/draw/draw_pipe_aaline.c | 14 ++++----- src/gallium/auxiliary/draw/draw_pipe_aapoint.c | 14 ++++----- src/gallium/auxiliary/draw/draw_pipe_pstipple.c | 6 ++-- src/gallium/auxiliary/tgsi/tgsi_build.c | 16 +++++------ src/gallium/auxiliary/tgsi/tgsi_dump.c | 12 ++++---- src/gallium/auxiliary/tgsi/tgsi_dump_c.c | 16 +++++------ src/gallium/auxiliary/tgsi/tgsi_exec.c | 8 +++--- src/gallium/auxiliary/tgsi/tgsi_parse.c | 2 +- src/gallium/auxiliary/tgsi/tgsi_scan.c | 10 +++---- src/gallium/auxiliary/tgsi/tgsi_text.c | 4 +-- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 8 +++--- src/gallium/auxiliary/vl/vl_shader_build.c | 16 +++++------ src/gallium/drivers/nv20/nv20_vertprog.c | 14 ++++----- src/gallium/drivers/nv30/nv30_fragprog.c | 12 ++++---- src/gallium/drivers/nv30/nv30_vertprog.c | 14 ++++----- src/gallium/drivers/nv40/nv40_fragprog.c | 14 ++++----- src/gallium/drivers/nv40/nv40_vertprog.c | 14 ++++----- src/gallium/drivers/nv50/nv50_program.c | 4 +-- src/gallium/drivers/r300/r300_vs.c | 4 +-- src/gallium/drivers/svga/svga_tgsi_decl_sm20.c | 34 +++++++++++----------- src/gallium/drivers/svga/svga_tgsi_decl_sm30.c | 38 ++++++++++++------------- src/gallium/include/pipe/p_shader_tokens.h | 8 +++--- 22 files changed, 141 insertions(+), 141 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index e374010fee..7b0b236a3d 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -139,8 +139,8 @@ aa_transform_decl(struct tgsi_transform_context *ctx, struct aa_transform_context *aactx = (struct aa_transform_context *) ctx; if (decl->Declaration.File == TGSI_FILE_OUTPUT && - decl->Semantic.SemanticName == TGSI_SEMANTIC_COLOR && - decl->Semantic.SemanticIndex == 0) { + decl->Semantic.Name == TGSI_SEMANTIC_COLOR && + decl->Semantic.Index == 0) { aactx->colorOutput = decl->DeclarationRange.First; } else if (decl->Declaration.File == TGSI_FILE_SAMPLER) { @@ -153,9 +153,9 @@ aa_transform_decl(struct tgsi_transform_context *ctx, else if (decl->Declaration.File == TGSI_FILE_INPUT) { if ((int) decl->DeclarationRange.Last > aactx->maxInput) aactx->maxInput = decl->DeclarationRange.Last; - if (decl->Semantic.SemanticName == TGSI_SEMANTIC_GENERIC && - (int) decl->Semantic.SemanticIndex > aactx->maxGeneric) { - aactx->maxGeneric = decl->Semantic.SemanticIndex; + if (decl->Semantic.Name == TGSI_SEMANTIC_GENERIC && + (int) decl->Semantic.Index > aactx->maxGeneric) { + aactx->maxGeneric = decl->Semantic.Index; } } else if (decl->Declaration.File == TGSI_FILE_TEMPORARY) { @@ -228,8 +228,8 @@ aa_transform_inst(struct tgsi_transform_context *ctx, /* XXX this could be linear... */ decl.Declaration.Interpolate = TGSI_INTERPOLATE_PERSPECTIVE; decl.Declaration.Semantic = 1; - decl.Semantic.SemanticName = TGSI_SEMANTIC_GENERIC; - decl.Semantic.SemanticIndex = aactx->maxGeneric + 1; + decl.Semantic.Name = TGSI_SEMANTIC_GENERIC; + decl.Semantic.Index = aactx->maxGeneric + 1; decl.DeclarationRange.First = decl.DeclarationRange.Last = aactx->maxInput + 1; ctx->emit_declaration(ctx, &decl); diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c index ae1712fe12..1f29448ff8 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c @@ -131,16 +131,16 @@ aa_transform_decl(struct tgsi_transform_context *ctx, struct aa_transform_context *aactx = (struct aa_transform_context *) ctx; if (decl->Declaration.File == TGSI_FILE_OUTPUT && - decl->Semantic.SemanticName == TGSI_SEMANTIC_COLOR && - decl->Semantic.SemanticIndex == 0) { + decl->Semantic.Name == TGSI_SEMANTIC_COLOR && + decl->Semantic.Index == 0) { aactx->colorOutput = decl->DeclarationRange.First; } else if (decl->Declaration.File == TGSI_FILE_INPUT) { if ((int) decl->DeclarationRange.Last > aactx->maxInput) aactx->maxInput = decl->DeclarationRange.Last; - if (decl->Semantic.SemanticName == TGSI_SEMANTIC_GENERIC && - (int) decl->Semantic.SemanticIndex > aactx->maxGeneric) { - aactx->maxGeneric = decl->Semantic.SemanticIndex; + if (decl->Semantic.Name == TGSI_SEMANTIC_GENERIC && + (int) decl->Semantic.Index > aactx->maxGeneric) { + aactx->maxGeneric = decl->Semantic.Index; } } else if (decl->Declaration.File == TGSI_FILE_TEMPORARY) { @@ -198,8 +198,8 @@ aa_transform_inst(struct tgsi_transform_context *ctx, /* XXX this could be linear... */ decl.Declaration.Interpolate = TGSI_INTERPOLATE_PERSPECTIVE; decl.Declaration.Semantic = 1; - decl.Semantic.SemanticName = TGSI_SEMANTIC_GENERIC; - decl.Semantic.SemanticIndex = aactx->maxGeneric + 1; + decl.Semantic.Name = TGSI_SEMANTIC_GENERIC; + decl.Semantic.Index = aactx->maxGeneric + 1; decl.DeclarationRange.First = decl.DeclarationRange.Last = texInput; ctx->emit_declaration(ctx, &decl); diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c index 9de06e37ed..75774e6626 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c @@ -140,7 +140,7 @@ pstip_transform_decl(struct tgsi_transform_context *ctx, } else if (decl->Declaration.File == TGSI_FILE_INPUT) { pctx->maxInput = MAX2(pctx->maxInput, (int) decl->DeclarationRange.Last); - if (decl->Semantic.SemanticName == TGSI_SEMANTIC_POSITION) + if (decl->Semantic.Name == TGSI_SEMANTIC_POSITION) pctx->wincoordInput = (int) decl->DeclarationRange.First; } else if (decl->Declaration.File == TGSI_FILE_TEMPORARY) { @@ -226,8 +226,8 @@ pstip_transform_inst(struct tgsi_transform_context *ctx, decl.Declaration.File = TGSI_FILE_INPUT; decl.Declaration.Interpolate = TGSI_INTERPOLATE_LINEAR; /* XXX? */ decl.Declaration.Semantic = 1; - decl.Semantic.SemanticName = TGSI_SEMANTIC_POSITION; - decl.Semantic.SemanticIndex = 0; + decl.Semantic.Name = TGSI_SEMANTIC_POSITION; + decl.Semantic.Index = 0; decl.DeclarationRange.First = decl.DeclarationRange.Last = wincoordInput; ctx->emit_declaration(ctx, &decl); diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index fbac265640..2e6c5b38b4 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -39,8 +39,8 @@ tgsi_build_version( void ) { struct tgsi_version version; - version.MajorVersion = 1; - version.MinorVersion = 1; + version.Major = 1; + version.Minor = 1; version.Padding = 0; return version; @@ -223,8 +223,8 @@ tgsi_build_full_declaration( size++; *ds = tgsi_build_declaration_semantic( - full_decl->Semantic.SemanticName, - full_decl->Semantic.SemanticIndex, + full_decl->Semantic.Name, + full_decl->Semantic.Index, declaration, header ); } @@ -269,8 +269,8 @@ tgsi_default_declaration_semantic( void ) { struct tgsi_declaration_semantic ds; - ds.SemanticName = TGSI_SEMANTIC_POSITION; - ds.SemanticIndex = 0; + ds.Name = TGSI_SEMANTIC_POSITION; + ds.Index = 0; ds.Padding = 0; return ds; @@ -289,8 +289,8 @@ tgsi_build_declaration_semantic( assert( semantic_index <= 0xFFFF ); ds = tgsi_default_declaration_semantic(); - ds.SemanticName = semantic_name; - ds.SemanticIndex = semantic_index; + ds.Name = semantic_name; + ds.Index = semantic_index; declaration_grow( declaration, header ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index 7eb64167fb..8f26d5dae3 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -232,11 +232,11 @@ iter_declaration( if (decl->Declaration.Semantic) { TXT( ", " ); - ENM( decl->Semantic.SemanticName, semantic_names ); - if (decl->Semantic.SemanticIndex != 0 || - decl->Semantic.SemanticName == TGSI_SEMANTIC_GENERIC) { + ENM( decl->Semantic.Name, semantic_names ); + if (decl->Semantic.Index != 0 || + decl->Semantic.Name == TGSI_SEMANTIC_GENERIC) { CHR( '[' ); - UID( decl->Semantic.SemanticIndex ); + UID( decl->Semantic.Index ); CHR( ']' ); } } @@ -477,9 +477,9 @@ prolog( { struct dump_ctx *ctx = (struct dump_ctx *) iter; ENM( iter->processor.Processor, processor_type_names ); - UID( iter->version.MajorVersion ); + UID( iter->version.Major ); CHR( '.' ); - UID( iter->version.MinorVersion ); + UID( iter->version.Minor ); EOL(); return TRUE; } diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c index 4648051e29..11d28b1653 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c @@ -229,10 +229,10 @@ dump_declaration_verbose( if( decl->Declaration.Semantic ) { EOL(); - TXT( "\nSemanticName : " ); - ENM( decl->Semantic.SemanticName, TGSI_SEMANTICS ); - TXT( "\nSemanticIndex: " ); - UID( decl->Semantic.SemanticIndex ); + TXT( "\nName : " ); + ENM( decl->Semantic.Name, TGSI_SEMANTICS ); + TXT( "\nIndex: " ); + UID( decl->Semantic.Index ); if( ignored ) { TXT( "\nPadding : " ); UIX( decl->Semantic.Padding ); @@ -485,10 +485,10 @@ tgsi_dump_c( TXT( "tgsi-dump begin -----------------" ); - TXT( "\nMajorVersion: " ); - UID( parse.FullVersion.Version.MajorVersion ); - TXT( "\nMinorVersion: " ); - UID( parse.FullVersion.Version.MinorVersion ); + TXT( "\nMajor: " ); + UID( parse.FullVersion.Version.Major ); + TXT( "\nMinor: " ); + UID( parse.FullVersion.Version.Minor ); EOL(); TXT( "\nHeaderSize: " ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 61d38e57f1..c113f4a3bc 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -1899,16 +1899,16 @@ exec_declaration(struct tgsi_exec_machine *mach, last = decl->DeclarationRange.Last; mask = decl->Declaration.UsageMask; - if (decl->Semantic.SemanticName == TGSI_SEMANTIC_POSITION) { - assert(decl->Semantic.SemanticIndex == 0); + if (decl->Semantic.Name == TGSI_SEMANTIC_POSITION) { + assert(decl->Semantic.Index == 0); assert(first == last); assert(mask = TGSI_WRITEMASK_XYZW); mach->Inputs[first] = mach->QuadPos; - } else if (decl->Semantic.SemanticName == TGSI_SEMANTIC_FACE) { + } else if (decl->Semantic.Name == TGSI_SEMANTIC_FACE) { uint i; - assert(decl->Semantic.SemanticIndex == 0); + assert(decl->Semantic.Index == 0); assert(first == last); for (i = 0; i < QUAD_SIZE; i++) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c index 52c714ebbd..d4f27499b8 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.c +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c @@ -36,7 +36,7 @@ tgsi_parse_init( const struct tgsi_token *tokens ) { ctx->FullVersion.Version = *(struct tgsi_version *) &tokens[0]; - if( ctx->FullVersion.Version.MajorVersion > 1 ) { + if( ctx->FullVersion.Version.Major > 1 ) { return TGSI_PARSE_ERROR; } diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c index 55595539ec..69567130e3 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c @@ -129,21 +129,21 @@ tgsi_scan_shader(const struct tgsi_token *tokens, info->file_max[file] = MAX2(info->file_max[file], (int)reg); if (file == TGSI_FILE_INPUT) { - info->input_semantic_name[reg] = (ubyte)fulldecl->Semantic.SemanticName; - info->input_semantic_index[reg] = (ubyte)fulldecl->Semantic.SemanticIndex; + info->input_semantic_name[reg] = (ubyte)fulldecl->Semantic.Name; + info->input_semantic_index[reg] = (ubyte)fulldecl->Semantic.Index; info->input_interpolate[reg] = (ubyte)fulldecl->Declaration.Interpolate; info->num_inputs++; } else if (file == TGSI_FILE_OUTPUT) { - info->output_semantic_name[reg] = (ubyte)fulldecl->Semantic.SemanticName; - info->output_semantic_index[reg] = (ubyte)fulldecl->Semantic.SemanticIndex; + info->output_semantic_name[reg] = (ubyte)fulldecl->Semantic.Name; + info->output_semantic_index[reg] = (ubyte)fulldecl->Semantic.Index; info->num_outputs++; } /* special case */ if (procType == TGSI_PROCESSOR_FRAGMENT && file == TGSI_FILE_OUTPUT && - fulldecl->Semantic.SemanticName == TGSI_SEMANTIC_POSITION) { + fulldecl->Semantic.Name == TGSI_SEMANTIC_POSITION) { info->writes_z = TRUE; } } diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index 7250f98cc9..d25f590df7 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -831,13 +831,13 @@ static boolean parse_declaration( struct translate_ctx *ctx ) } cur2++; - decl.Semantic.SemanticIndex = index; + decl.Semantic.Index = index; cur = cur2; } decl.Declaration.Semantic = 1; - decl.Semantic.SemanticName = i; + decl.Semantic.Name = i; ctx->cur = cur; break; diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index de4bc6edb0..6d646a529a 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -910,8 +910,8 @@ static void emit_decl( struct ureg_program *ureg, out[1].decl_range.Last = index; out[2].value = 0; - out[2].decl_semantic.SemanticName = semantic_name; - out[2].decl_semantic.SemanticIndex = semantic_index; + out[2].decl_semantic.Name = semantic_name; + out[2].decl_semantic.Index = semantic_index; } @@ -1064,8 +1064,8 @@ emit_header( struct ureg_program *ureg ) { union tgsi_any_token *out = get_tokens( ureg, DOMAIN_DECL, 3 ); - out[0].version.MajorVersion = 1; - out[0].version.MinorVersion = 1; + out[0].version.Major = 1; + out[0].version.Minor = 1; out[0].version.Padding = 0; out[1].header.HeaderSize = 2; diff --git a/src/gallium/auxiliary/vl/vl_shader_build.c b/src/gallium/auxiliary/vl/vl_shader_build.c index 9637cbed8a..d052e2c797 100644 --- a/src/gallium/auxiliary/vl/vl_shader_build.c +++ b/src/gallium/auxiliary/vl/vl_shader_build.c @@ -36,8 +36,8 @@ struct tgsi_full_declaration vl_decl_input(unsigned int name, unsigned int index decl.Declaration.File = TGSI_FILE_INPUT; decl.Declaration.Semantic = 1; - decl.Semantic.SemanticName = name; - decl.Semantic.SemanticIndex = index; + decl.Semantic.Name = name; + decl.Semantic.Index = index; decl.DeclarationRange.First = first; decl.DeclarationRange.Last = last; @@ -64,8 +64,8 @@ struct tgsi_full_declaration vl_decl_interpolated_input decl.Declaration.File = TGSI_FILE_INPUT; decl.Declaration.Semantic = 1; - decl.Semantic.SemanticName = name; - decl.Semantic.SemanticIndex = index; + decl.Semantic.Name = name; + decl.Semantic.Index = index; decl.Declaration.Interpolate = interpolation;; decl.DeclarationRange.First = first; decl.DeclarationRange.Last = last; @@ -79,8 +79,8 @@ struct tgsi_full_declaration vl_decl_constants(unsigned int name, unsigned int i decl.Declaration.File = TGSI_FILE_CONSTANT; decl.Declaration.Semantic = 1; - decl.Semantic.SemanticName = name; - decl.Semantic.SemanticIndex = index; + decl.Semantic.Name = name; + decl.Semantic.Index = index; decl.DeclarationRange.First = first; decl.DeclarationRange.Last = last; @@ -93,8 +93,8 @@ struct tgsi_full_declaration vl_decl_output(unsigned int name, unsigned int inde decl.Declaration.File = TGSI_FILE_OUTPUT; decl.Declaration.Semantic = 1; - decl.Semantic.SemanticName = name; - decl.Semantic.SemanticIndex = index; + decl.Semantic.Name = name; + decl.Semantic.Index = index; decl.DeclarationRange.First = first; decl.DeclarationRange.Last = last; diff --git a/src/gallium/drivers/nv20/nv20_vertprog.c b/src/gallium/drivers/nv20/nv20_vertprog.c index 48df356faf..cd76910744 100644 --- a/src/gallium/drivers/nv20/nv20_vertprog.c +++ b/src/gallium/drivers/nv20/nv20_vertprog.c @@ -490,15 +490,15 @@ nv20_vertprog_parse_decl_output(struct nv20_vpc *vpc, { int hw; - switch (fdec->Semantic.SemanticName) { + switch (fdec->Semantic.Name) { case TGSI_SEMANTIC_POSITION: hw = NV30_VP_INST_DEST_POS; break; case TGSI_SEMANTIC_COLOR: - if (fdec->Semantic.SemanticIndex == 0) { + if (fdec->Semantic.Index == 0) { hw = NV30_VP_INST_DEST_COL0; } else - if (fdec->Semantic.SemanticIndex == 1) { + if (fdec->Semantic.Index == 1) { hw = NV30_VP_INST_DEST_COL1; } else { NOUVEAU_ERR("bad colour semantic index\n"); @@ -506,10 +506,10 @@ nv20_vertprog_parse_decl_output(struct nv20_vpc *vpc, } break; case TGSI_SEMANTIC_BCOLOR: - if (fdec->Semantic.SemanticIndex == 0) { + if (fdec->Semantic.Index == 0) { hw = NV30_VP_INST_DEST_BFC0; } else - if (fdec->Semantic.SemanticIndex == 1) { + if (fdec->Semantic.Index == 1) { hw = NV30_VP_INST_DEST_BFC1; } else { NOUVEAU_ERR("bad bcolour semantic index\n"); @@ -523,8 +523,8 @@ nv20_vertprog_parse_decl_output(struct nv20_vpc *vpc, hw = NV30_VP_INST_DEST_PSZ; break; case TGSI_SEMANTIC_GENERIC: - if (fdec->Semantic.SemanticIndex <= 7) { - hw = NV30_VP_INST_DEST_TC(fdec->Semantic.SemanticIndex); + if (fdec->Semantic.Index <= 7) { + hw = NV30_VP_INST_DEST_TC(fdec->Semantic.Index); } else { NOUVEAU_ERR("bad generic semantic index\n"); return FALSE; diff --git a/src/gallium/drivers/nv30/nv30_fragprog.c b/src/gallium/drivers/nv30/nv30_fragprog.c index eb978b6838..acf216bb61 100644 --- a/src/gallium/drivers/nv30/nv30_fragprog.c +++ b/src/gallium/drivers/nv30/nv30_fragprog.c @@ -572,15 +572,15 @@ nv30_fragprog_parse_decl_attrib(struct nv30_fpc *fpc, { int hw; - switch (fdec->Semantic.SemanticName) { + switch (fdec->Semantic.Name) { case TGSI_SEMANTIC_POSITION: hw = NV30_FP_OP_INPUT_SRC_POSITION; break; case TGSI_SEMANTIC_COLOR: - if (fdec->Semantic.SemanticIndex == 0) { + if (fdec->Semantic.Index == 0) { hw = NV30_FP_OP_INPUT_SRC_COL0; } else - if (fdec->Semantic.SemanticIndex == 1) { + if (fdec->Semantic.Index == 1) { hw = NV30_FP_OP_INPUT_SRC_COL1; } else { NOUVEAU_ERR("bad colour semantic index\n"); @@ -591,9 +591,9 @@ nv30_fragprog_parse_decl_attrib(struct nv30_fpc *fpc, hw = NV30_FP_OP_INPUT_SRC_FOGC; break; case TGSI_SEMANTIC_GENERIC: - if (fdec->Semantic.SemanticIndex <= 7) { + if (fdec->Semantic.Index <= 7) { hw = NV30_FP_OP_INPUT_SRC_TC(fdec->Semantic. - SemanticIndex); + Index); } else { NOUVEAU_ERR("bad generic semantic index\n"); return FALSE; @@ -612,7 +612,7 @@ static boolean nv30_fragprog_parse_decl_output(struct nv30_fpc *fpc, const struct tgsi_full_declaration *fdec) { - switch (fdec->Semantic.SemanticName) { + switch (fdec->Semantic.Name) { case TGSI_SEMANTIC_POSITION: fpc->depth_id = fdec->DeclarationRange.First; break; diff --git a/src/gallium/drivers/nv30/nv30_vertprog.c b/src/gallium/drivers/nv30/nv30_vertprog.c index b04fb229bc..e8fba8ab16 100644 --- a/src/gallium/drivers/nv30/nv30_vertprog.c +++ b/src/gallium/drivers/nv30/nv30_vertprog.c @@ -490,15 +490,15 @@ nv30_vertprog_parse_decl_output(struct nv30_vpc *vpc, { int hw; - switch (fdec->Semantic.SemanticName) { + switch (fdec->Semantic.Name) { case TGSI_SEMANTIC_POSITION: hw = NV30_VP_INST_DEST_POS; break; case TGSI_SEMANTIC_COLOR: - if (fdec->Semantic.SemanticIndex == 0) { + if (fdec->Semantic.Index == 0) { hw = NV30_VP_INST_DEST_COL0; } else - if (fdec->Semantic.SemanticIndex == 1) { + if (fdec->Semantic.Index == 1) { hw = NV30_VP_INST_DEST_COL1; } else { NOUVEAU_ERR("bad colour semantic index\n"); @@ -506,10 +506,10 @@ nv30_vertprog_parse_decl_output(struct nv30_vpc *vpc, } break; case TGSI_SEMANTIC_BCOLOR: - if (fdec->Semantic.SemanticIndex == 0) { + if (fdec->Semantic.Index == 0) { hw = NV30_VP_INST_DEST_BFC0; } else - if (fdec->Semantic.SemanticIndex == 1) { + if (fdec->Semantic.Index == 1) { hw = NV30_VP_INST_DEST_BFC1; } else { NOUVEAU_ERR("bad bcolour semantic index\n"); @@ -523,8 +523,8 @@ nv30_vertprog_parse_decl_output(struct nv30_vpc *vpc, hw = NV30_VP_INST_DEST_PSZ; break; case TGSI_SEMANTIC_GENERIC: - if (fdec->Semantic.SemanticIndex <= 7) { - hw = NV30_VP_INST_DEST_TC(fdec->Semantic.SemanticIndex); + if (fdec->Semantic.Index <= 7) { + hw = NV30_VP_INST_DEST_TC(fdec->Semantic.Index); } else { NOUVEAU_ERR("bad generic semantic index\n"); return FALSE; diff --git a/src/gallium/drivers/nv40/nv40_fragprog.c b/src/gallium/drivers/nv40/nv40_fragprog.c index dbbb736670..ca6a957fc1 100644 --- a/src/gallium/drivers/nv40/nv40_fragprog.c +++ b/src/gallium/drivers/nv40/nv40_fragprog.c @@ -644,15 +644,15 @@ nv40_fragprog_parse_decl_attrib(struct nv40_fpc *fpc, { int hw; - switch (fdec->Semantic.SemanticName) { + switch (fdec->Semantic.Name) { case TGSI_SEMANTIC_POSITION: hw = NV40_FP_OP_INPUT_SRC_POSITION; break; case TGSI_SEMANTIC_COLOR: - if (fdec->Semantic.SemanticIndex == 0) { + if (fdec->Semantic.Index == 0) { hw = NV40_FP_OP_INPUT_SRC_COL0; } else - if (fdec->Semantic.SemanticIndex == 1) { + if (fdec->Semantic.Index == 1) { hw = NV40_FP_OP_INPUT_SRC_COL1; } else { NOUVEAU_ERR("bad colour semantic index\n"); @@ -663,9 +663,9 @@ nv40_fragprog_parse_decl_attrib(struct nv40_fpc *fpc, hw = NV40_FP_OP_INPUT_SRC_FOGC; break; case TGSI_SEMANTIC_GENERIC: - if (fdec->Semantic.SemanticIndex <= 7) { + if (fdec->Semantic.Index <= 7) { hw = NV40_FP_OP_INPUT_SRC_TC(fdec->Semantic. - SemanticIndex); + Index); } else { NOUVEAU_ERR("bad generic semantic index\n"); return FALSE; @@ -687,12 +687,12 @@ nv40_fragprog_parse_decl_output(struct nv40_fpc *fpc, unsigned idx = fdec->DeclarationRange.First; unsigned hw; - switch (fdec->Semantic.SemanticName) { + switch (fdec->Semantic.Name) { case TGSI_SEMANTIC_POSITION: hw = 1; break; case TGSI_SEMANTIC_COLOR: - switch (fdec->Semantic.SemanticIndex) { + switch (fdec->Semantic.Index) { case 0: hw = 0; break; case 1: hw = 2; break; case 2: hw = 3; break; diff --git a/src/gallium/drivers/nv40/nv40_vertprog.c b/src/gallium/drivers/nv40/nv40_vertprog.c index df9cb227a3..ed0f1d857d 100644 --- a/src/gallium/drivers/nv40/nv40_vertprog.c +++ b/src/gallium/drivers/nv40/nv40_vertprog.c @@ -580,16 +580,16 @@ nv40_vertprog_parse_decl_output(struct nv40_vpc *vpc, unsigned idx = fdec->DeclarationRange.First; int hw; - switch (fdec->Semantic.SemanticName) { + switch (fdec->Semantic.Name) { case TGSI_SEMANTIC_POSITION: hw = NV40_VP_INST_DEST_POS; vpc->hpos_idx = idx; break; case TGSI_SEMANTIC_COLOR: - if (fdec->Semantic.SemanticIndex == 0) { + if (fdec->Semantic.Index == 0) { hw = NV40_VP_INST_DEST_COL0; } else - if (fdec->Semantic.SemanticIndex == 1) { + if (fdec->Semantic.Index == 1) { hw = NV40_VP_INST_DEST_COL1; } else { NOUVEAU_ERR("bad colour semantic index\n"); @@ -597,10 +597,10 @@ nv40_vertprog_parse_decl_output(struct nv40_vpc *vpc, } break; case TGSI_SEMANTIC_BCOLOR: - if (fdec->Semantic.SemanticIndex == 0) { + if (fdec->Semantic.Index == 0) { hw = NV40_VP_INST_DEST_BFC0; } else - if (fdec->Semantic.SemanticIndex == 1) { + if (fdec->Semantic.Index == 1) { hw = NV40_VP_INST_DEST_BFC1; } else { NOUVEAU_ERR("bad bcolour semantic index\n"); @@ -614,8 +614,8 @@ nv40_vertprog_parse_decl_output(struct nv40_vpc *vpc, hw = NV40_VP_INST_DEST_PSZ; break; case TGSI_SEMANTIC_GENERIC: - if (fdec->Semantic.SemanticIndex <= 7) { - hw = NV40_VP_INST_DEST_TC(fdec->Semantic.SemanticIndex); + if (fdec->Semantic.Index <= 7) { + hw = NV40_VP_INST_DEST_TC(fdec->Semantic.Index); } else { NOUVEAU_ERR("bad generic semantic index\n"); return FALSE; diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index e40e37d07c..00518af8c0 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -2558,8 +2558,8 @@ nv50_program_tx_prep(struct nv50_pc *pc) p->type == PIPE_SHADER_FRAGMENT) break; - si = d->Semantic.SemanticIndex; - switch (d->Semantic.SemanticName) { + si = d->Semantic.Index; + switch (d->Semantic.Name) { case TGSI_SEMANTIC_BCOLOR: p->cfg.two_side[si].hw = first; if (p->cfg.io_nr > first) diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c index 74ef416dc1..939b13e4b3 100644 --- a/src/gallium/drivers/r300/r300_vs.c +++ b/src/gallium/drivers/r300/r300_vs.c @@ -77,7 +77,7 @@ static void set_vertex_inputs_outputs(struct r300_vertex_program_compiler * c) if (decl->Declaration.File != TGSI_FILE_OUTPUT) continue; - switch (decl->Semantic.SemanticName) { + switch (decl->Semantic.Name) { case TGSI_SEMANTIC_POSITION: c->code->outputs[decl->DeclarationRange.First] = 0; break; @@ -98,7 +98,7 @@ static void set_vertex_inputs_outputs(struct r300_vertex_program_compiler * c) break; default: debug_printf("r300: vs: Bad semantic declaration %d\n", - decl->Semantic.SemanticName); + decl->Semantic.Name); break; } } diff --git a/src/gallium/drivers/svga/svga_tgsi_decl_sm20.c b/src/gallium/drivers/svga/svga_tgsi_decl_sm20.c index 54457082a0..6f4822a89d 100644 --- a/src/gallium/drivers/svga/svga_tgsi_decl_sm20.c +++ b/src/gallium/drivers/svga/svga_tgsi_decl_sm20.c @@ -46,7 +46,7 @@ static boolean ps20_input( struct svga_shader_emitter *emit, dcl.values[0] = 0; dcl.values[1] = 0; - switch (semantic.SemanticName) { + switch (semantic.Name) { case TGSI_SEMANTIC_POSITION: /* Special case: */ @@ -55,15 +55,15 @@ static boolean ps20_input( struct svga_shader_emitter *emit, break; case TGSI_SEMANTIC_COLOR: reg = src_register( SVGA3DREG_INPUT, - semantic.SemanticIndex ); + semantic.Index ); break; case TGSI_SEMANTIC_FOG: - assert(semantic.SemanticIndex == 0); + assert(semantic.Index == 0); reg = src_register( SVGA3DREG_TEXTURE, 0 ); break; case TGSI_SEMANTIC_GENERIC: reg = src_register( SVGA3DREG_TEXTURE, - semantic.SemanticIndex + 1 ); + semantic.Index + 1 ); break; default: assert(0); @@ -90,16 +90,16 @@ static boolean ps20_output( struct svga_shader_emitter *emit, { SVGA3dShaderDestToken reg; - switch (semantic.SemanticName) { + switch (semantic.Name) { case TGSI_SEMANTIC_COLOR: - if (semantic.SemanticIndex < PIPE_MAX_COLOR_BUFS) { - unsigned cbuf = semantic.SemanticIndex; + if (semantic.Index < PIPE_MAX_COLOR_BUFS) { + unsigned cbuf = semantic.Index; emit->output_map[idx] = dst_register( SVGA3DREG_TEMP, emit->nr_hw_temp++ ); emit->temp_col[cbuf] = emit->output_map[idx]; emit->true_col[cbuf] = dst_register( SVGA3DREG_COLOROUT, - semantic.SemanticIndex ); + semantic.Index ); } else { assert(0); @@ -111,7 +111,7 @@ static boolean ps20_output( struct svga_shader_emitter *emit, emit->nr_hw_temp++ ); emit->temp_pos = emit->output_map[idx]; emit->true_pos = dst_register( SVGA3DREG_DEPTHOUT, - semantic.SemanticIndex ); + semantic.Index ); break; default: assert(0); @@ -169,9 +169,9 @@ static boolean vs20_output( struct svga_shader_emitter *emit, /* Just build the register map table: */ - switch (semantic.SemanticName) { + switch (semantic.Name) { case TGSI_SEMANTIC_POSITION: - assert(semantic.SemanticIndex == 0); + assert(semantic.Index == 0); emit->output_map[idx] = dst_register( SVGA3DREG_TEMP, emit->nr_hw_temp++ ); emit->temp_pos = emit->output_map[idx]; @@ -179,7 +179,7 @@ static boolean vs20_output( struct svga_shader_emitter *emit, SVGA3DRASTOUT_POSITION); break; case TGSI_SEMANTIC_PSIZE: - assert(semantic.SemanticIndex == 0); + assert(semantic.Index == 0); emit->output_map[idx] = dst_register( SVGA3DREG_TEMP, emit->nr_hw_temp++ ); emit->temp_psiz = emit->output_map[idx]; @@ -187,17 +187,17 @@ static boolean vs20_output( struct svga_shader_emitter *emit, SVGA3DRASTOUT_PSIZE ); break; case TGSI_SEMANTIC_FOG: - assert(semantic.SemanticIndex == 0); + assert(semantic.Index == 0); emit->output_map[idx] = dst_register( SVGA3DREG_TEXCRDOUT, 0 ); break; case TGSI_SEMANTIC_COLOR: /* oD0 */ emit->output_map[idx] = dst_register( SVGA3DREG_ATTROUT, - semantic.SemanticIndex ); + semantic.Index ); break; case TGSI_SEMANTIC_GENERIC: emit->output_map[idx] = dst_register( SVGA3DREG_TEXCRDOUT, - semantic.SemanticIndex + 1 ); + semantic.Index + 1 ); break; default: assert(0); @@ -237,8 +237,8 @@ boolean svga_translate_decl_sm20( struct svga_shader_emitter *emit, unsigned idx; if (decl->Declaration.Semantic) { - semantic = decl->Semantic.SemanticName; - semantic_idx = decl->Semantic.SemanticIndex; + semantic = decl->Semantic.Name; + semantic_idx = decl->Semantic.Index; } for( idx = first; idx <= last; idx++ ) { diff --git a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c index 08e7dfb117..65aa23ce3e 100644 --- a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c +++ b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c @@ -35,35 +35,35 @@ static boolean translate_vs_ps_semantic( struct tgsi_declaration_semantic semant unsigned *usage, unsigned *idx ) { - switch (semantic.SemanticName) { + switch (semantic.Name) { case TGSI_SEMANTIC_POSITION: - *idx = semantic.SemanticIndex; + *idx = semantic.Index; *usage = SVGA3D_DECLUSAGE_POSITION; break; case TGSI_SEMANTIC_COLOR: - *idx = semantic.SemanticIndex; + *idx = semantic.Index; *usage = SVGA3D_DECLUSAGE_COLOR; break; case TGSI_SEMANTIC_BCOLOR: - *idx = semantic.SemanticIndex + 2; /* sharing with COLOR */ + *idx = semantic.Index + 2; /* sharing with COLOR */ *usage = SVGA3D_DECLUSAGE_COLOR; break; case TGSI_SEMANTIC_FOG: *idx = 0; - assert(semantic.SemanticIndex == 0); + assert(semantic.Index == 0); *usage = SVGA3D_DECLUSAGE_TEXCOORD; break; case TGSI_SEMANTIC_PSIZE: - *idx = semantic.SemanticIndex; + *idx = semantic.Index; *usage = SVGA3D_DECLUSAGE_PSIZE; break; case TGSI_SEMANTIC_GENERIC: - *idx = semantic.SemanticIndex + 1; /* texcoord[0] is reserved for fog */ + *idx = semantic.Index + 1; /* texcoord[0] is reserved for fog */ *usage = SVGA3D_DECLUSAGE_TEXCOORD; break; case TGSI_SEMANTIC_NORMAL: - *idx = semantic.SemanticIndex; + *idx = semantic.Index; *usage = SVGA3D_DECLUSAGE_NORMAL; break; default: @@ -120,7 +120,7 @@ static boolean ps30_input( struct svga_shader_emitter *emit, unsigned usage, index; SVGA3dShaderDestToken reg; - if (semantic.SemanticName == TGSI_SEMANTIC_POSITION) { + if (semantic.Name == TGSI_SEMANTIC_POSITION) { emit->input_map[idx] = src_register( SVGA3DREG_MISCTYPE, SVGA3DMISCREG_POSITION ); @@ -135,7 +135,7 @@ static boolean ps30_input( struct svga_shader_emitter *emit, return emit_decl( emit, reg, 0, 0 ); } else if (emit->key.fkey.light_twoside && - (semantic.SemanticName == TGSI_SEMANTIC_COLOR)) { + (semantic.Name == TGSI_SEMANTIC_COLOR)) { if (!translate_vs_ps_semantic( semantic, &usage, &index )) return FALSE; @@ -150,7 +150,7 @@ static boolean ps30_input( struct svga_shader_emitter *emit, if (!emit_decl( emit, reg, usage, index )) return FALSE; - semantic.SemanticName = TGSI_SEMANTIC_BCOLOR; + semantic.Name = TGSI_SEMANTIC_BCOLOR; if (!translate_vs_ps_semantic( semantic, &usage, &index )) return FALSE; @@ -164,7 +164,7 @@ static boolean ps30_input( struct svga_shader_emitter *emit, return TRUE; } - else if (semantic.SemanticName == TGSI_SEMANTIC_FACE) { + else if (semantic.Name == TGSI_SEMANTIC_FACE) { if (!emit_vface_decl( emit )) return FALSE; emit->emit_frontface = TRUE; @@ -193,17 +193,17 @@ static boolean ps30_output( struct svga_shader_emitter *emit, { SVGA3dShaderDestToken reg; - switch (semantic.SemanticName) { + switch (semantic.Name) { case TGSI_SEMANTIC_COLOR: emit->output_map[idx] = dst_register( SVGA3DREG_COLOROUT, - semantic.SemanticIndex ); + semantic.Index ); break; case TGSI_SEMANTIC_POSITION: emit->output_map[idx] = dst_register( SVGA3DREG_TEMP, emit->nr_hw_temp++ ); emit->temp_pos = emit->output_map[idx]; emit->true_pos = dst_register( SVGA3DREG_DEPTHOUT, - semantic.SemanticIndex ); + semantic.Index ); break; default: assert(0); @@ -283,14 +283,14 @@ static boolean vs30_output( struct svga_shader_emitter *emit, dcl.index = index; dcl.values[0] |= 1<<31; - if (semantic.SemanticName == TGSI_SEMANTIC_POSITION) { + if (semantic.Name == TGSI_SEMANTIC_POSITION) { assert(idx == 0); emit->output_map[idx] = dst_register( SVGA3DREG_TEMP, emit->nr_hw_temp++ ); emit->temp_pos = emit->output_map[idx]; emit->true_pos = dcl.dst; } - else if (semantic.SemanticName == TGSI_SEMANTIC_PSIZE) { + else if (semantic.Name == TGSI_SEMANTIC_PSIZE) { emit->output_map[idx] = dst_register( SVGA3DREG_TEMP, emit->nr_hw_temp++ ); emit->temp_psiz = emit->output_map[idx]; @@ -342,8 +342,8 @@ boolean svga_translate_decl_sm30( struct svga_shader_emitter *emit, unsigned idx; if (decl->Declaration.Semantic) { - semantic = decl->Semantic.SemanticName; - semantic_idx = decl->Semantic.SemanticIndex; + semantic = decl->Semantic.Name; + semantic_idx = decl->Semantic.Index; } for( idx = first; idx <= last; idx++ ) { diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index ac999e0c18..7d73d7df85 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -37,8 +37,8 @@ extern "C" { struct tgsi_version { - unsigned MajorVersion : 8; - unsigned MinorVersion : 8; + unsigned Major : 8; + unsigned Minor : 8; unsigned Padding : 16; }; @@ -137,8 +137,8 @@ struct tgsi_declaration_range struct tgsi_declaration_semantic { - unsigned SemanticName : 8; /**< one of TGSI_SEMANTIC_x */ - unsigned SemanticIndex : 16; /**< UINT */ + unsigned Name : 8; /**< one of TGSI_SEMANTIC_x */ + unsigned Index : 16; /**< UINT */ unsigned Padding : 8; }; -- cgit v1.2.3 From 7d6c8f980d1e23ad6f557d650e89c715861a3b0c Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Nov 2009 15:02:23 +0000 Subject: tgsi: rename fields of tgsi_full_instruction to avoid excessive verbosity InstructionPredicate -> Predicate InstructionLabel -> Label InstructionTexture -> Texture FullSrcRegisters -> Src FullDstRegisters -> Dst --- src/gallium/auxiliary/draw/draw_pipe_aaline.c | 40 ++-- src/gallium/auxiliary/draw/draw_pipe_aapoint.c | 238 +++++++++++------------ src/gallium/auxiliary/draw/draw_pipe_pstipple.c | 32 +-- src/gallium/auxiliary/draw/draw_vs_aos.c | 176 ++++++++--------- src/gallium/auxiliary/gallivm/tgsitollvm.cpp | 8 +- src/gallium/auxiliary/tgsi/tgsi_build.c | 34 ++-- src/gallium/auxiliary/tgsi/tgsi_dump.c | 8 +- src/gallium/auxiliary/tgsi/tgsi_dump_c.c | 8 +- src/gallium/auxiliary/tgsi/tgsi_exec.c | 46 ++--- src/gallium/auxiliary/tgsi/tgsi_parse.c | 42 ++-- src/gallium/auxiliary/tgsi/tgsi_parse.h | 10 +- src/gallium/auxiliary/tgsi/tgsi_ppc.c | 8 +- src/gallium/auxiliary/tgsi/tgsi_sanity.c | 24 +-- src/gallium/auxiliary/tgsi/tgsi_scan.c | 6 +- src/gallium/auxiliary/tgsi/tgsi_sse2.c | 16 +- src/gallium/auxiliary/tgsi/tgsi_text.c | 8 +- src/gallium/auxiliary/vl/vl_compositor.c | 2 +- src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 32 +-- src/gallium/auxiliary/vl/vl_shader_build.c | 50 ++--- src/gallium/drivers/cell/ppu/cell_gen_fp.c | 226 ++++++++++----------- src/gallium/drivers/cell/spu/spu_exec.c | 12 +- src/gallium/drivers/i915/i915_fpc_translate.c | 116 +++++------ src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c | 16 +- src/gallium/drivers/nv20/nv20_vertprog.c | 8 +- src/gallium/drivers/nv30/nv30_fragprog.c | 8 +- src/gallium/drivers/nv30/nv30_vertprog.c | 8 +- src/gallium/drivers/nv40/nv40_fragprog.c | 8 +- src/gallium/drivers/nv40/nv40_vertprog.c | 10 +- src/gallium/drivers/nv50/nv50_program.c | 36 ++-- src/gallium/drivers/r300/r300_tgsi_to_rc.c | 10 +- src/gallium/drivers/svga/svga_tgsi_insn.c | 110 +++++------ 31 files changed, 678 insertions(+), 678 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index 7b0b236a3d..58d867faeb 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -265,15 +265,15 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_TEX; newInst.Instruction.NumDstRegs = 1; - newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullDstRegisters[0].DstRegister.Index = aactx->texTemp; + newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].DstRegister.Index = aactx->texTemp; newInst.Instruction.NumSrcRegs = 2; newInst.Instruction.Texture = TRUE; - newInst.InstructionTexture.Texture = TGSI_TEXTURE_2D; - newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_INPUT; - newInst.FullSrcRegisters[0].SrcRegister.Index = aactx->maxInput + 1; - newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER; - newInst.FullSrcRegisters[1].SrcRegister.Index = aactx->freeSampler; + newInst.Texture.Texture = TGSI_TEXTURE_2D; + newInst.Src[0].SrcRegister.File = TGSI_FILE_INPUT; + newInst.Src[0].SrcRegister.Index = aactx->maxInput + 1; + newInst.Src[1].SrcRegister.File = TGSI_FILE_SAMPLER; + newInst.Src[1].SrcRegister.Index = aactx->freeSampler; ctx->emit_instruction(ctx, &newInst); @@ -281,26 +281,26 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_MOV; newInst.Instruction.NumDstRegs = 1; - newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_OUTPUT; - newInst.FullDstRegisters[0].DstRegister.Index = aactx->colorOutput; - newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_XYZ; + newInst.Dst[0].DstRegister.File = TGSI_FILE_OUTPUT; + newInst.Dst[0].DstRegister.Index = aactx->colorOutput; + newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_XYZ; newInst.Instruction.NumSrcRegs = 1; - newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullSrcRegisters[0].SrcRegister.Index = aactx->colorTemp; + newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].SrcRegister.Index = aactx->colorTemp; ctx->emit_instruction(ctx, &newInst); /* MUL alpha */ newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_MUL; newInst.Instruction.NumDstRegs = 1; - newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_OUTPUT; - newInst.FullDstRegisters[0].DstRegister.Index = aactx->colorOutput; - newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_W; + newInst.Dst[0].DstRegister.File = TGSI_FILE_OUTPUT; + newInst.Dst[0].DstRegister.Index = aactx->colorOutput; + newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_W; newInst.Instruction.NumSrcRegs = 2; - newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullSrcRegisters[0].SrcRegister.Index = aactx->colorTemp; - newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullSrcRegisters[1].SrcRegister.Index = aactx->texTemp; + newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].SrcRegister.Index = aactx->colorTemp; + newInst.Src[1].SrcRegister.File = TGSI_FILE_TEMPORARY; + newInst.Src[1].SrcRegister.Index = aactx->texTemp; ctx->emit_instruction(ctx, &newInst); /* END */ @@ -317,7 +317,7 @@ aa_transform_inst(struct tgsi_transform_context *ctx, uint i; for (i = 0; i < inst->Instruction.NumDstRegs; i++) { - struct tgsi_full_dst_register *dst = &inst->FullDstRegisters[i]; + struct tgsi_full_dst_register *dst = &inst->Dst[i]; if (dst->DstRegister.File == TGSI_FILE_OUTPUT && dst->DstRegister.Index == aactx->colorOutput) { dst->DstRegister.File = TGSI_FILE_TEMPORARY; diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c index 1f29448ff8..09fc55cb5e 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c @@ -234,30 +234,30 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_MUL; newInst.Instruction.NumDstRegs = 1; - newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullDstRegisters[0].DstRegister.Index = tmp0; - newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_XY; + newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].DstRegister.Index = tmp0; + newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_XY; newInst.Instruction.NumSrcRegs = 2; - newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_INPUT; - newInst.FullSrcRegisters[0].SrcRegister.Index = texInput; - newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_INPUT; - newInst.FullSrcRegisters[1].SrcRegister.Index = texInput; + newInst.Src[0].SrcRegister.File = TGSI_FILE_INPUT; + newInst.Src[0].SrcRegister.Index = texInput; + newInst.Src[1].SrcRegister.File = TGSI_FILE_INPUT; + newInst.Src[1].SrcRegister.Index = texInput; ctx->emit_instruction(ctx, &newInst); /* ADD t0.x, t0.x, t0.y; # x^2 + y^2 */ newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_ADD; newInst.Instruction.NumDstRegs = 1; - newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullDstRegisters[0].DstRegister.Index = tmp0; - newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X; + newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].DstRegister.Index = tmp0; + newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_X; newInst.Instruction.NumSrcRegs = 2; - newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullSrcRegisters[0].SrcRegister.Index = tmp0; - newInst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; - newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullSrcRegisters[1].SrcRegister.Index = tmp0; - newInst.FullSrcRegisters[1].SrcRegister.SwizzleX = TGSI_SWIZZLE_Y; + newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].SrcRegister.Index = tmp0; + newInst.Src[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; + newInst.Src[1].SrcRegister.File = TGSI_FILE_TEMPORARY; + newInst.Src[1].SrcRegister.Index = tmp0; + newInst.Src[1].SrcRegister.SwizzleX = TGSI_SWIZZLE_Y; ctx->emit_instruction(ctx, &newInst); #if NORMALIZE /* OPTIONAL normalization of length */ @@ -265,24 +265,24 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_RSQ; newInst.Instruction.NumDstRegs = 1; - newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullDstRegisters[0].DstRegister.Index = tmp0; - newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X; + newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].DstRegister.Index = tmp0; + newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_X; newInst.Instruction.NumSrcRegs = 1; - newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullSrcRegisters[0].SrcRegister.Index = tmp0; + newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].SrcRegister.Index = tmp0; ctx->emit_instruction(ctx, &newInst); /* RCP t0.x, t0.x; */ newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_RCP; newInst.Instruction.NumDstRegs = 1; - newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullDstRegisters[0].DstRegister.Index = tmp0; - newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X; + newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].DstRegister.Index = tmp0; + newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_X; newInst.Instruction.NumSrcRegs = 1; - newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullSrcRegisters[0].SrcRegister.Index = tmp0; + newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].SrcRegister.Index = tmp0; ctx->emit_instruction(ctx, &newInst); #endif @@ -290,16 +290,16 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_SGT; newInst.Instruction.NumDstRegs = 1; - newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullDstRegisters[0].DstRegister.Index = tmp0; - newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_Y; + newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].DstRegister.Index = tmp0; + newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_Y; newInst.Instruction.NumSrcRegs = 2; - newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullSrcRegisters[0].SrcRegister.Index = tmp0; - newInst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_INPUT; - newInst.FullSrcRegisters[1].SrcRegister.Index = texInput; - newInst.FullSrcRegisters[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_W; + newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].SrcRegister.Index = tmp0; + newInst.Src[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; + newInst.Src[1].SrcRegister.File = TGSI_FILE_INPUT; + newInst.Src[1].SrcRegister.Index = texInput; + newInst.Src[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_W; ctx->emit_instruction(ctx, &newInst); /* KIL -tmp0.yyyy; # if -tmp0.y < 0, KILL */ @@ -307,13 +307,13 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst.Instruction.Opcode = TGSI_OPCODE_KIL; newInst.Instruction.NumDstRegs = 0; newInst.Instruction.NumSrcRegs = 1; - newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullSrcRegisters[0].SrcRegister.Index = tmp0; - newInst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_Y; - newInst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_Y; - newInst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_Y; - newInst.FullSrcRegisters[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_Y; - newInst.FullSrcRegisters[0].SrcRegister.Negate = 1; + newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].SrcRegister.Index = tmp0; + newInst.Src[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_Y; + newInst.Src[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_Y; + newInst.Src[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_Y; + newInst.Src[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_Y; + newInst.Src[0].SrcRegister.Negate = 1; ctx->emit_instruction(ctx, &newInst); @@ -323,77 +323,77 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_SUB; newInst.Instruction.NumDstRegs = 1; - newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullDstRegisters[0].DstRegister.Index = tmp0; - newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_Z; + newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].DstRegister.Index = tmp0; + newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_Z; newInst.Instruction.NumSrcRegs = 2; - newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_INPUT; - newInst.FullSrcRegisters[0].SrcRegister.Index = texInput; - newInst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_W; - newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_INPUT; - newInst.FullSrcRegisters[1].SrcRegister.Index = texInput; - newInst.FullSrcRegisters[1].SrcRegister.SwizzleZ = TGSI_SWIZZLE_Z; + newInst.Src[0].SrcRegister.File = TGSI_FILE_INPUT; + newInst.Src[0].SrcRegister.Index = texInput; + newInst.Src[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_W; + newInst.Src[1].SrcRegister.File = TGSI_FILE_INPUT; + newInst.Src[1].SrcRegister.Index = texInput; + newInst.Src[1].SrcRegister.SwizzleZ = TGSI_SWIZZLE_Z; ctx->emit_instruction(ctx, &newInst); /* RCP t0.z, t0.z; # t0.z = 1 / m */ newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_RCP; newInst.Instruction.NumDstRegs = 1; - newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullDstRegisters[0].DstRegister.Index = tmp0; - newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_Z; + newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].DstRegister.Index = tmp0; + newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_Z; newInst.Instruction.NumSrcRegs = 1; - newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullSrcRegisters[0].SrcRegister.Index = tmp0; - newInst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_Z; + newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].SrcRegister.Index = tmp0; + newInst.Src[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_Z; ctx->emit_instruction(ctx, &newInst); /* SUB t0.y, 1, t0.x; # d = 1 - d */ newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_SUB; newInst.Instruction.NumDstRegs = 1; - newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullDstRegisters[0].DstRegister.Index = tmp0; - newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_Y; + newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].DstRegister.Index = tmp0; + newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_Y; newInst.Instruction.NumSrcRegs = 2; - newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_INPUT; - newInst.FullSrcRegisters[0].SrcRegister.Index = texInput; - newInst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_W; - newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullSrcRegisters[1].SrcRegister.Index = tmp0; - newInst.FullSrcRegisters[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; + newInst.Src[0].SrcRegister.File = TGSI_FILE_INPUT; + newInst.Src[0].SrcRegister.Index = texInput; + newInst.Src[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_W; + newInst.Src[1].SrcRegister.File = TGSI_FILE_TEMPORARY; + newInst.Src[1].SrcRegister.Index = tmp0; + newInst.Src[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; ctx->emit_instruction(ctx, &newInst); /* MUL t0.w, t0.y, t0.z; # coverage = d * m */ newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_MUL; newInst.Instruction.NumDstRegs = 1; - newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullDstRegisters[0].DstRegister.Index = tmp0; - newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_W; + newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].DstRegister.Index = tmp0; + newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_W; newInst.Instruction.NumSrcRegs = 2; - newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullSrcRegisters[0].SrcRegister.Index = tmp0; - newInst.FullSrcRegisters[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_Y; - newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullSrcRegisters[1].SrcRegister.Index = tmp0; - newInst.FullSrcRegisters[1].SrcRegister.SwizzleW = TGSI_SWIZZLE_Z; + newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].SrcRegister.Index = tmp0; + newInst.Src[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_Y; + newInst.Src[1].SrcRegister.File = TGSI_FILE_TEMPORARY; + newInst.Src[1].SrcRegister.Index = tmp0; + newInst.Src[1].SrcRegister.SwizzleW = TGSI_SWIZZLE_Z; ctx->emit_instruction(ctx, &newInst); /* SLE t0.y, t0.x, tex.z; # bool b = distance <= k */ newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_SLE; newInst.Instruction.NumDstRegs = 1; - newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullDstRegisters[0].DstRegister.Index = tmp0; - newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_Y; + newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].DstRegister.Index = tmp0; + newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_Y; newInst.Instruction.NumSrcRegs = 2; - newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullSrcRegisters[0].SrcRegister.Index = tmp0; - newInst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_INPUT; - newInst.FullSrcRegisters[1].SrcRegister.Index = texInput; - newInst.FullSrcRegisters[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_Z; + newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].SrcRegister.Index = tmp0; + newInst.Src[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; + newInst.Src[1].SrcRegister.File = TGSI_FILE_INPUT; + newInst.Src[1].SrcRegister.Index = texInput; + newInst.Src[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_Z; ctx->emit_instruction(ctx, &newInst); /* CMP t0.w, -t0.y, tex.w, t0.w; @@ -405,29 +405,29 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_CMP; newInst.Instruction.NumDstRegs = 1; - newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullDstRegisters[0].DstRegister.Index = tmp0; - newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_W; + newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].DstRegister.Index = tmp0; + newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_W; newInst.Instruction.NumSrcRegs = 3; - newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullSrcRegisters[0].SrcRegister.Index = tmp0; - newInst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_Y; - newInst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_Y; - newInst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_Y; - newInst.FullSrcRegisters[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_Y; - newInst.FullSrcRegisters[0].SrcRegister.Negate = 1; - newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_INPUT; - newInst.FullSrcRegisters[1].SrcRegister.Index = texInput; - newInst.FullSrcRegisters[1].SrcRegister.SwizzleX = TGSI_SWIZZLE_W; - newInst.FullSrcRegisters[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_W; - newInst.FullSrcRegisters[1].SrcRegister.SwizzleZ = TGSI_SWIZZLE_W; - newInst.FullSrcRegisters[1].SrcRegister.SwizzleW = TGSI_SWIZZLE_W; - newInst.FullSrcRegisters[2].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullSrcRegisters[2].SrcRegister.Index = tmp0; - newInst.FullSrcRegisters[2].SrcRegister.SwizzleX = TGSI_SWIZZLE_W; - newInst.FullSrcRegisters[2].SrcRegister.SwizzleY = TGSI_SWIZZLE_W; - newInst.FullSrcRegisters[2].SrcRegister.SwizzleZ = TGSI_SWIZZLE_W; - newInst.FullSrcRegisters[2].SrcRegister.SwizzleW = TGSI_SWIZZLE_W; + newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].SrcRegister.Index = tmp0; + newInst.Src[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_Y; + newInst.Src[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_Y; + newInst.Src[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_Y; + newInst.Src[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_Y; + newInst.Src[0].SrcRegister.Negate = 1; + newInst.Src[1].SrcRegister.File = TGSI_FILE_INPUT; + newInst.Src[1].SrcRegister.Index = texInput; + newInst.Src[1].SrcRegister.SwizzleX = TGSI_SWIZZLE_W; + newInst.Src[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_W; + newInst.Src[1].SrcRegister.SwizzleZ = TGSI_SWIZZLE_W; + newInst.Src[1].SrcRegister.SwizzleW = TGSI_SWIZZLE_W; + newInst.Src[2].SrcRegister.File = TGSI_FILE_TEMPORARY; + newInst.Src[2].SrcRegister.Index = tmp0; + newInst.Src[2].SrcRegister.SwizzleX = TGSI_SWIZZLE_W; + newInst.Src[2].SrcRegister.SwizzleY = TGSI_SWIZZLE_W; + newInst.Src[2].SrcRegister.SwizzleZ = TGSI_SWIZZLE_W; + newInst.Src[2].SrcRegister.SwizzleW = TGSI_SWIZZLE_W; ctx->emit_instruction(ctx, &newInst); } @@ -439,26 +439,26 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_MOV; newInst.Instruction.NumDstRegs = 1; - newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_OUTPUT; - newInst.FullDstRegisters[0].DstRegister.Index = aactx->colorOutput; - newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_XYZ; + newInst.Dst[0].DstRegister.File = TGSI_FILE_OUTPUT; + newInst.Dst[0].DstRegister.Index = aactx->colorOutput; + newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_XYZ; newInst.Instruction.NumSrcRegs = 1; - newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullSrcRegisters[0].SrcRegister.Index = aactx->colorTemp; + newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].SrcRegister.Index = aactx->colorTemp; ctx->emit_instruction(ctx, &newInst); /* MUL result.color.w, colorTemp, tmp0.w; */ newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_MUL; newInst.Instruction.NumDstRegs = 1; - newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_OUTPUT; - newInst.FullDstRegisters[0].DstRegister.Index = aactx->colorOutput; - newInst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_W; + newInst.Dst[0].DstRegister.File = TGSI_FILE_OUTPUT; + newInst.Dst[0].DstRegister.Index = aactx->colorOutput; + newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_W; newInst.Instruction.NumSrcRegs = 2; - newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullSrcRegisters[0].SrcRegister.Index = aactx->colorTemp; - newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullSrcRegisters[1].SrcRegister.Index = aactx->tmp0; + newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].SrcRegister.Index = aactx->colorTemp; + newInst.Src[1].SrcRegister.File = TGSI_FILE_TEMPORARY; + newInst.Src[1].SrcRegister.Index = aactx->tmp0; ctx->emit_instruction(ctx, &newInst); } else { @@ -468,7 +468,7 @@ aa_transform_inst(struct tgsi_transform_context *ctx, uint i; for (i = 0; i < inst->Instruction.NumDstRegs; i++) { - struct tgsi_full_dst_register *dst = &inst->FullDstRegisters[i]; + struct tgsi_full_dst_register *dst = &inst->Dst[i]; if (dst->DstRegister.File == TGSI_FILE_OUTPUT && dst->DstRegister.Index == aactx->colorOutput) { dst->DstRegister.File = TGSI_FILE_TEMPORARY; diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c index 75774e6626..fe0d511218 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c @@ -280,28 +280,28 @@ pstip_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_MUL; newInst.Instruction.NumDstRegs = 1; - newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullDstRegisters[0].DstRegister.Index = pctx->texTemp; + newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].DstRegister.Index = pctx->texTemp; newInst.Instruction.NumSrcRegs = 2; - newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_INPUT; - newInst.FullSrcRegisters[0].SrcRegister.Index = wincoordInput; - newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_IMMEDIATE; - newInst.FullSrcRegisters[1].SrcRegister.Index = pctx->numImmed; + newInst.Src[0].SrcRegister.File = TGSI_FILE_INPUT; + newInst.Src[0].SrcRegister.Index = wincoordInput; + newInst.Src[1].SrcRegister.File = TGSI_FILE_IMMEDIATE; + newInst.Src[1].SrcRegister.Index = pctx->numImmed; ctx->emit_instruction(ctx, &newInst); /* TEX texTemp, texTemp, sampler; */ newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_TEX; newInst.Instruction.NumDstRegs = 1; - newInst.FullDstRegisters[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullDstRegisters[0].DstRegister.Index = pctx->texTemp; + newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].DstRegister.Index = pctx->texTemp; newInst.Instruction.NumSrcRegs = 2; newInst.Instruction.Texture = TRUE; - newInst.InstructionTexture.Texture = TGSI_TEXTURE_2D; - newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullSrcRegisters[0].SrcRegister.Index = pctx->texTemp; - newInst.FullSrcRegisters[1].SrcRegister.File = TGSI_FILE_SAMPLER; - newInst.FullSrcRegisters[1].SrcRegister.Index = pctx->freeSampler; + newInst.Texture.Texture = TGSI_TEXTURE_2D; + newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].SrcRegister.Index = pctx->texTemp; + newInst.Src[1].SrcRegister.File = TGSI_FILE_SAMPLER; + newInst.Src[1].SrcRegister.Index = pctx->freeSampler; ctx->emit_instruction(ctx, &newInst); /* KIL -texTemp; # if -texTemp < 0, KILL fragment */ @@ -309,9 +309,9 @@ pstip_transform_inst(struct tgsi_transform_context *ctx, newInst.Instruction.Opcode = TGSI_OPCODE_KIL; newInst.Instruction.NumDstRegs = 0; newInst.Instruction.NumSrcRegs = 1; - newInst.FullSrcRegisters[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.FullSrcRegisters[0].SrcRegister.Index = pctx->texTemp; - newInst.FullSrcRegisters[0].SrcRegister.Negate = 1; + newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].SrcRegister.Index = pctx->texTemp; + newInst.Src[0].SrcRegister.Negate = 1; ctx->emit_instruction(ctx, &newInst); } diff --git a/src/gallium/auxiliary/draw/draw_vs_aos.c b/src/gallium/auxiliary/draw/draw_vs_aos.c index 88bc790b62..a9c8715bc8 100644 --- a/src/gallium/auxiliary/draw/draw_vs_aos.c +++ b/src/gallium/auxiliary/draw/draw_vs_aos.c @@ -956,7 +956,7 @@ static void emit_print( struct aos_compilation *cp, static boolean emit_ABS( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); + struct x86_reg arg0 = fetch_src(cp, &op->Src[0]); struct x86_reg neg = aos_get_internal(cp, IMM_NEGS); struct x86_reg tmp = aos_get_xmm_reg(cp); @@ -964,27 +964,27 @@ static boolean emit_ABS( struct aos_compilation *cp, const struct tgsi_full_inst sse_mulps(cp->func, tmp, neg); sse_maxps(cp->func, tmp, arg0); - store_dest(cp, &op->FullDstRegisters[0], tmp); + store_dest(cp, &op->Dst[0], tmp); return TRUE; } static boolean emit_ADD( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); - struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]); + struct x86_reg arg0 = fetch_src(cp, &op->Src[0]); + struct x86_reg arg1 = fetch_src(cp, &op->Src[1]); struct x86_reg dst = get_xmm_writable(cp, arg0); sse_addps(cp->func, dst, arg1); - store_dest(cp, &op->FullDstRegisters[0], dst); + store_dest(cp, &op->Dst[0], dst); return TRUE; } static boolean emit_COS( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - x87_fld_src(cp, &op->FullSrcRegisters[0], 0); + x87_fld_src(cp, &op->Src[0], 0); x87_fcos(cp->func); - x87_fstp_dest4(cp, &op->FullDstRegisters[0]); + x87_fstp_dest4(cp, &op->Dst[0]); return TRUE; } @@ -993,8 +993,8 @@ static boolean emit_COS( struct aos_compilation *cp, const struct tgsi_full_inst */ static boolean emit_DP3( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); - struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]); + struct x86_reg arg0 = fetch_src(cp, &op->Src[0]); + struct x86_reg arg1 = fetch_src(cp, &op->Src[1]); struct x86_reg tmp = aos_get_xmm_reg(cp); struct x86_reg dst = get_xmm_writable(cp, arg0); @@ -1007,14 +1007,14 @@ static boolean emit_DP3( struct aos_compilation *cp, const struct tgsi_full_inst sse_addss(cp->func, dst, tmp); aos_release_xmm_reg(cp, tmp.idx); - store_scalar_dest(cp, &op->FullDstRegisters[0], dst); + store_scalar_dest(cp, &op->Dst[0], dst); return TRUE; } static boolean emit_DP4( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); - struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]); + struct x86_reg arg0 = fetch_src(cp, &op->Src[0]); + struct x86_reg arg1 = fetch_src(cp, &op->Src[1]); struct x86_reg tmp = aos_get_xmm_reg(cp); struct x86_reg dst = get_xmm_writable(cp, arg0); @@ -1028,14 +1028,14 @@ static boolean emit_DP4( struct aos_compilation *cp, const struct tgsi_full_inst sse_addss(cp->func, dst, tmp); aos_release_xmm_reg(cp, tmp.idx); - store_scalar_dest(cp, &op->FullDstRegisters[0], dst); + store_scalar_dest(cp, &op->Dst[0], dst); return TRUE; } static boolean emit_DPH( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); - struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]); + struct x86_reg arg0 = fetch_src(cp, &op->Src[0]); + struct x86_reg arg1 = fetch_src(cp, &op->Src[1]); struct x86_reg tmp = aos_get_xmm_reg(cp); struct x86_reg dst = get_xmm_writable(cp, arg0); @@ -1051,14 +1051,14 @@ static boolean emit_DPH( struct aos_compilation *cp, const struct tgsi_full_inst sse_addss(cp->func, dst, tmp); aos_release_xmm_reg(cp, tmp.idx); - store_scalar_dest(cp, &op->FullDstRegisters[0], dst); + store_scalar_dest(cp, &op->Dst[0], dst); return TRUE; } static boolean emit_DST( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); - struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]); + struct x86_reg arg0 = fetch_src(cp, &op->Src[0]); + struct x86_reg arg1 = fetch_src(cp, &op->Src[1]); struct x86_reg dst = aos_get_xmm_reg(cp); struct x86_reg tmp = aos_get_xmm_reg(cp); struct x86_reg ones = aos_get_internal(cp, IMM_ONES); @@ -1073,25 +1073,25 @@ static boolean emit_DST( struct aos_compilation *cp, const struct tgsi_full_inst sse_mulps(cp->func, dst, tmp); aos_release_xmm_reg(cp, tmp.idx); - store_dest(cp, &op->FullDstRegisters[0], dst); + store_dest(cp, &op->Dst[0], dst); return TRUE; } static boolean emit_LG2( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { x87_fld1(cp->func); /* 1 */ - x87_fld_src(cp, &op->FullSrcRegisters[0], 0); /* a0 1 */ + x87_fld_src(cp, &op->Src[0], 0); /* a0 1 */ x87_fyl2x(cp->func); /* log2(a0) */ - x87_fstp_dest4(cp, &op->FullDstRegisters[0]); + x87_fstp_dest4(cp, &op->Dst[0]); return TRUE; } #if 0 static boolean emit_EX2( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - x87_fld_src(cp, &op->FullSrcRegisters[0], 0); + x87_fld_src(cp, &op->Src[0], 0); x87_emit_ex2(cp); - x87_fstp_dest4(cp, &op->FullDstRegisters[0]); + x87_fstp_dest4(cp, &op->Dst[0]); return TRUE; } #endif @@ -1099,8 +1099,8 @@ static boolean emit_EX2( struct aos_compilation *cp, const struct tgsi_full_inst static boolean emit_FLR( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - struct x86_reg dst = get_dst_ptr(cp, &op->FullDstRegisters[0]); - unsigned writemask = op->FullDstRegisters[0].DstRegister.WriteMask; + struct x86_reg dst = get_dst_ptr(cp, &op->Dst[0]); + unsigned writemask = op->Dst[0].DstRegister.WriteMask; int i; set_fpu_round_neg_inf( cp ); @@ -1109,7 +1109,7 @@ static boolean emit_FLR( struct aos_compilation *cp, const struct tgsi_full_inst */ for (i = 3; i >= 0; i--) { if (writemask & (1<FullSrcRegisters[0], i); + x87_fld_src(cp, &op->Src[0], i); } } @@ -1126,8 +1126,8 @@ static boolean emit_FLR( struct aos_compilation *cp, const struct tgsi_full_inst static boolean emit_RND( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - struct x86_reg dst = get_dst_ptr(cp, &op->FullDstRegisters[0]); - unsigned writemask = op->FullDstRegisters[0].DstRegister.WriteMask; + struct x86_reg dst = get_dst_ptr(cp, &op->Dst[0]); + unsigned writemask = op->Dst[0].DstRegister.WriteMask; int i; set_fpu_round_nearest( cp ); @@ -1136,7 +1136,7 @@ static boolean emit_RND( struct aos_compilation *cp, const struct tgsi_full_inst */ for (i = 3; i >= 0; i--) { if (writemask & (1<FullSrcRegisters[0], i); + x87_fld_src(cp, &op->Src[0], i); } } @@ -1153,10 +1153,10 @@ static boolean emit_RND( struct aos_compilation *cp, const struct tgsi_full_inst static boolean emit_FRC( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - struct x86_reg dst = get_dst_ptr(cp, &op->FullDstRegisters[0]); + struct x86_reg dst = get_dst_ptr(cp, &op->Dst[0]); struct x86_reg st0 = x86_make_reg(file_x87, 0); struct x86_reg st1 = x86_make_reg(file_x87, 1); - unsigned writemask = op->FullDstRegisters[0].DstRegister.WriteMask; + unsigned writemask = op->Dst[0].DstRegister.WriteMask; int i; set_fpu_round_neg_inf( cp ); @@ -1166,7 +1166,7 @@ static boolean emit_FRC( struct aos_compilation *cp, const struct tgsi_full_inst */ for (i = 3; i >= 0; i--) { if (writemask & (1<FullSrcRegisters[0], i); + x87_fld_src(cp, &op->Src[0], i); } } @@ -1190,7 +1190,7 @@ static boolean emit_FRC( struct aos_compilation *cp, const struct tgsi_full_inst static boolean emit_LIT( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { struct x86_reg ecx = x86_make_reg( file_REG32, reg_CX ); - unsigned writemask = op->FullDstRegisters[0].DstRegister.WriteMask; + unsigned writemask = op->Dst[0].DstRegister.WriteMask; unsigned lit_count = cp->lit_count++; struct x86_reg result, arg0; unsigned i; @@ -1209,10 +1209,10 @@ static boolean emit_LIT( struct aos_compilation *cp, const struct tgsi_full_inst if (writemask != TGSI_WRITEMASK_XYZW) result = x86_make_disp(cp->machine_EDX, Offset(struct aos_machine, tmp[0])); else - result = get_dst_ptr(cp, &op->FullDstRegisters[0]); + result = get_dst_ptr(cp, &op->Dst[0]); - arg0 = fetch_src( cp, &op->FullSrcRegisters[0] ); + arg0 = fetch_src( cp, &op->Src[0] ); if (arg0.file == file_XMM) { struct x86_reg tmp = x86_make_disp(cp->machine_EDX, Offset(struct aos_machine, tmp[1])); @@ -1259,7 +1259,7 @@ static boolean emit_LIT( struct aos_compilation *cp, const struct tgsi_full_inst if (writemask != TGSI_WRITEMASK_XYZW) { store_dest( cp, - &op->FullDstRegisters[0], + &op->Dst[0], get_xmm_writable( cp, result ) ); } @@ -1269,8 +1269,8 @@ static boolean emit_LIT( struct aos_compilation *cp, const struct tgsi_full_inst #if 0 static boolean emit_inline_LIT( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - struct x86_reg dst = get_dst_ptr(cp, &op->FullDstRegisters[0]); - unsigned writemask = op->FullDstRegisters[0].DstRegister.WriteMask; + struct x86_reg dst = get_dst_ptr(cp, &op->Dst[0]); + unsigned writemask = op->Dst[0].DstRegister.WriteMask; if (writemask & TGSI_WRITEMASK_YZ) { struct x86_reg st1 = x86_make_reg(file_x87, 1); @@ -1286,13 +1286,13 @@ static boolean emit_inline_LIT( struct aos_compilation *cp, const struct tgsi_fu */ x87_fldz(cp->func); /* 1 0 */ #endif - x87_fld_src(cp, &op->FullSrcRegisters[0], 1); /* a1 1 0 */ + x87_fld_src(cp, &op->Src[0], 1); /* a1 1 0 */ x87_fcomi(cp->func, st2); /* a1 1 0 */ x87_fcmovb(cp->func, st1); /* a1' 1 0 */ x87_fstp(cp->func, st1); /* a1' 0 */ x87_fstp(cp->func, st1); /* a1' */ - x87_fld_src(cp, &op->FullSrcRegisters[0], 3); /* a3 a1' */ + x87_fld_src(cp, &op->Src[0], 3); /* a3 a1' */ x87_fxch(cp->func, st1); /* a1' a3 */ @@ -1305,7 +1305,7 @@ static boolean emit_inline_LIT( struct aos_compilation *cp, const struct tgsi_fu /* a0' = max2(a0, 0): */ x87_fldz(cp->func); /* 0 r2 */ - x87_fld_src(cp, &op->FullSrcRegisters[0], 0); /* a0 0 r2 */ + x87_fld_src(cp, &op->Src[0], 0); /* a0 0 r2 */ x87_fcomi(cp->func, st1); x87_fcmovb(cp->func, st1); /* a0' 0 r2 */ @@ -1333,58 +1333,58 @@ static boolean emit_inline_LIT( struct aos_compilation *cp, const struct tgsi_fu static boolean emit_MAX( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); - struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]); + struct x86_reg arg0 = fetch_src(cp, &op->Src[0]); + struct x86_reg arg1 = fetch_src(cp, &op->Src[1]); struct x86_reg dst = get_xmm_writable(cp, arg0); sse_maxps(cp->func, dst, arg1); - store_dest(cp, &op->FullDstRegisters[0], dst); + store_dest(cp, &op->Dst[0], dst); return TRUE; } static boolean emit_MIN( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); - struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]); + struct x86_reg arg0 = fetch_src(cp, &op->Src[0]); + struct x86_reg arg1 = fetch_src(cp, &op->Src[1]); struct x86_reg dst = get_xmm_writable(cp, arg0); sse_minps(cp->func, dst, arg1); - store_dest(cp, &op->FullDstRegisters[0], dst); + store_dest(cp, &op->Dst[0], dst); return TRUE; } static boolean emit_MOV( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); + struct x86_reg arg0 = fetch_src(cp, &op->Src[0]); struct x86_reg dst = get_xmm_writable(cp, arg0); /* potentially nothing to do */ - store_dest(cp, &op->FullDstRegisters[0], dst); + store_dest(cp, &op->Dst[0], dst); return TRUE; } static boolean emit_MUL( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); - struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]); + struct x86_reg arg0 = fetch_src(cp, &op->Src[0]); + struct x86_reg arg1 = fetch_src(cp, &op->Src[1]); struct x86_reg dst = get_xmm_writable(cp, arg0); sse_mulps(cp->func, dst, arg1); - store_dest(cp, &op->FullDstRegisters[0], dst); + store_dest(cp, &op->Dst[0], dst); return TRUE; } static boolean emit_MAD( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); - struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]); - struct x86_reg arg2 = fetch_src(cp, &op->FullSrcRegisters[2]); + struct x86_reg arg0 = fetch_src(cp, &op->Src[0]); + struct x86_reg arg1 = fetch_src(cp, &op->Src[1]); + struct x86_reg arg2 = fetch_src(cp, &op->Src[2]); /* If we can't clobber old contents of arg0, get a temporary & copy * it there, then clobber it... @@ -1393,7 +1393,7 @@ static boolean emit_MAD( struct aos_compilation *cp, const struct tgsi_full_inst sse_mulps(cp->func, arg0, arg1); sse_addps(cp->func, arg0, arg2); - store_dest(cp, &op->FullDstRegisters[0], arg0); + store_dest(cp, &op->Dst[0], arg0); return TRUE; } @@ -1425,13 +1425,13 @@ static float PIPE_CDECL _exp2(float x) static boolean emit_POW( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { #if 0 - x87_fld_src(cp, &op->FullSrcRegisters[1], 0); /* a1.x */ - x87_fld_src(cp, &op->FullSrcRegisters[0], 0); /* a0.x a1.x */ + x87_fld_src(cp, &op->Src[1], 0); /* a1.x */ + x87_fld_src(cp, &op->Src[0], 0); /* a0.x a1.x */ x87_fyl2x(cp->func); /* a1*log2(a0) */ x87_emit_ex2( cp ); /* 2^(a1*log2(a0)) */ - x87_fstp_dest4(cp, &op->FullDstRegisters[0]); + x87_fstp_dest4(cp, &op->Dst[0]); #else uint i; @@ -1450,9 +1450,9 @@ static boolean emit_POW( struct aos_compilation *cp, const struct tgsi_full_inst x86_lea( cp->func, cp->stack_ESP, x86_make_disp(cp->stack_ESP, -8) ); - x87_fld_src( cp, &op->FullSrcRegisters[1], 0 ); + x87_fld_src( cp, &op->Src[1], 0 ); x87_fstp( cp->func, x86_make_disp( cp->stack_ESP, 4 ) ); - x87_fld_src( cp, &op->FullSrcRegisters[0], 0 ); + x87_fld_src( cp, &op->Src[0], 0 ); x87_fstp( cp->func, x86_make_disp( cp->stack_ESP, 0 ) ); /* tmp_EAX has been pushed & will be restored below */ @@ -1467,7 +1467,7 @@ static boolean emit_POW( struct aos_compilation *cp, const struct tgsi_full_inst */ cp->func->x87_stack++; - x87_fstp_dest4( cp, &op->FullDstRegisters[0] ); + x87_fstp_dest4( cp, &op->Dst[0] ); #endif return TRUE; } @@ -1493,7 +1493,7 @@ static boolean emit_EXPBASE2( struct aos_compilation *cp, const struct tgsi_full x86_lea( cp->func, cp->stack_ESP, x86_make_disp(cp->stack_ESP, -4) ); - x87_fld_src( cp, &op->FullSrcRegisters[0], 0 ); + x87_fld_src( cp, &op->Src[0], 0 ); x87_fstp( cp->func, x86_make_disp( cp->stack_ESP, 0 ) ); /* tmp_EAX has been pushed & will be restored below */ @@ -1508,7 +1508,7 @@ static boolean emit_EXPBASE2( struct aos_compilation *cp, const struct tgsi_full */ cp->func->x87_stack++; - x87_fstp_dest4( cp, &op->FullDstRegisters[0] ); + x87_fstp_dest4( cp, &op->Dst[0] ); return TRUE; } @@ -1517,7 +1517,7 @@ static boolean emit_EXPBASE2( struct aos_compilation *cp, const struct tgsi_full static boolean emit_RCP( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); + struct x86_reg arg0 = fetch_src(cp, &op->Src[0]); struct x86_reg dst = aos_get_xmm_reg(cp); if (cp->have_sse2) { @@ -1531,7 +1531,7 @@ static boolean emit_RCP( struct aos_compilation *cp, const struct tgsi_full_inst sse_divss(cp->func, dst, arg0); } - store_scalar_dest(cp, &op->FullDstRegisters[0], dst); + store_scalar_dest(cp, &op->Dst[0], dst); return TRUE; } @@ -1551,14 +1551,14 @@ static boolean emit_RCP( struct aos_compilation *cp, const struct tgsi_full_inst static boolean emit_RSQ( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { if (0) { - struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); + struct x86_reg arg0 = fetch_src(cp, &op->Src[0]); struct x86_reg r = aos_get_xmm_reg(cp); sse_rsqrtss(cp->func, r, arg0); - store_scalar_dest(cp, &op->FullDstRegisters[0], r); + store_scalar_dest(cp, &op->Dst[0], r); return TRUE; } else { - struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); + struct x86_reg arg0 = fetch_src(cp, &op->Src[0]); struct x86_reg r = aos_get_xmm_reg(cp); struct x86_reg neg_half = get_reg_ptr( cp, AOS_FILE_INTERNAL, IMM_RSQ ); @@ -1578,7 +1578,7 @@ static boolean emit_RSQ( struct aos_compilation *cp, const struct tgsi_full_inst sse_addss( cp->func, tmp, one_point_five ); /* 1.5 - .5 * a * r * r */ sse_mulss( cp->func, r, tmp ); /* r * (1.5 - .5 * a * r * r) */ - store_scalar_dest(cp, &op->FullDstRegisters[0], r); + store_scalar_dest(cp, &op->Dst[0], r); aos_release_xmm_reg(cp, tmp.idx); @@ -1589,23 +1589,23 @@ static boolean emit_RSQ( struct aos_compilation *cp, const struct tgsi_full_inst static boolean emit_SGE( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); - struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]); + struct x86_reg arg0 = fetch_src(cp, &op->Src[0]); + struct x86_reg arg1 = fetch_src(cp, &op->Src[1]); struct x86_reg ones = aos_get_internal(cp, IMM_ONES); struct x86_reg dst = get_xmm_writable(cp, arg0); sse_cmpps(cp->func, dst, arg1, cc_NotLessThan); sse_andps(cp->func, dst, ones); - store_dest(cp, &op->FullDstRegisters[0], dst); + store_dest(cp, &op->Dst[0], dst); return TRUE; } static boolean emit_SIN( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - x87_fld_src(cp, &op->FullSrcRegisters[0], 0); + x87_fld_src(cp, &op->Src[0], 0); x87_fsin(cp->func); - x87_fstp_dest4(cp, &op->FullDstRegisters[0]); + x87_fstp_dest4(cp, &op->Dst[0]); return TRUE; } @@ -1613,46 +1613,46 @@ static boolean emit_SIN( struct aos_compilation *cp, const struct tgsi_full_inst static boolean emit_SLT( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); - struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]); + struct x86_reg arg0 = fetch_src(cp, &op->Src[0]); + struct x86_reg arg1 = fetch_src(cp, &op->Src[1]); struct x86_reg ones = aos_get_internal(cp, IMM_ONES); struct x86_reg dst = get_xmm_writable(cp, arg0); sse_cmpps(cp->func, dst, arg1, cc_LessThan); sse_andps(cp->func, dst, ones); - store_dest(cp, &op->FullDstRegisters[0], dst); + store_dest(cp, &op->Dst[0], dst); return TRUE; } static boolean emit_SUB( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); - struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]); + struct x86_reg arg0 = fetch_src(cp, &op->Src[0]); + struct x86_reg arg1 = fetch_src(cp, &op->Src[1]); struct x86_reg dst = get_xmm_writable(cp, arg0); sse_subps(cp->func, dst, arg1); - store_dest(cp, &op->FullDstRegisters[0], dst); + store_dest(cp, &op->Dst[0], dst); return TRUE; } static boolean emit_TRUNC( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); + struct x86_reg arg0 = fetch_src(cp, &op->Src[0]); struct x86_reg tmp0 = aos_get_xmm_reg(cp); sse2_cvttps2dq(cp->func, tmp0, arg0); sse2_cvtdq2ps(cp->func, tmp0, tmp0); - store_dest(cp, &op->FullDstRegisters[0], tmp0); + store_dest(cp, &op->Dst[0], tmp0); return TRUE; } static boolean emit_XPD( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { - struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); - struct x86_reg arg1 = fetch_src(cp, &op->FullSrcRegisters[1]); + struct x86_reg arg0 = fetch_src(cp, &op->Src[0]); + struct x86_reg arg1 = fetch_src(cp, &op->Src[1]); struct x86_reg tmp0 = aos_get_xmm_reg(cp); struct x86_reg tmp1 = aos_get_xmm_reg(cp); @@ -1670,7 +1670,7 @@ static boolean emit_XPD( struct aos_compilation *cp, const struct tgsi_full_inst aos_release_xmm_reg(cp, tmp0.idx); - store_dest(cp, &op->FullDstRegisters[0], tmp1); + store_dest(cp, &op->Dst[0], tmp1); return TRUE; } @@ -1897,10 +1897,10 @@ static void find_last_write_outputs( struct aos_compilation *cp ) continue; for (i = 0; i < TGSI_FULL_MAX_DST_REGISTERS; i++) { - if (parse.FullToken.FullInstruction.FullDstRegisters[i].DstRegister.File == + if (parse.FullToken.FullInstruction.Dst[i].DstRegister.File == TGSI_FILE_OUTPUT) { - unsigned idx = parse.FullToken.FullInstruction.FullDstRegisters[i].DstRegister.Index; + unsigned idx = parse.FullToken.FullInstruction.Dst[i].DstRegister.Index; cp->output_last_write[idx] = this_instruction; } } diff --git a/src/gallium/auxiliary/gallivm/tgsitollvm.cpp b/src/gallium/auxiliary/gallivm/tgsitollvm.cpp index bf84401e11..fbf4d2636d 100644 --- a/src/gallium/auxiliary/gallivm/tgsitollvm.cpp +++ b/src/gallium/auxiliary/gallivm/tgsitollvm.cpp @@ -234,7 +234,7 @@ translate_instruction(llvm::Module *module, inputs[3] = 0; for (int i = 0; i < inst->Instruction.NumSrcRegs; ++i) { - struct tgsi_full_src_register *src = &inst->FullSrcRegisters[i]; + struct tgsi_full_src_register *src = &inst->Src[i]; llvm::Value *val = 0; llvm::Value *indIdx = 0; @@ -656,7 +656,7 @@ translate_instruction(llvm::Module *module, /* store results */ for (int i = 0; i < inst->Instruction.NumDstRegs; ++i) { - struct tgsi_full_dst_register *dst = &inst->FullDstRegisters[i]; + struct tgsi_full_dst_register *dst = &inst->Dst[i]; if (dst->DstRegister.File == TGSI_FILE_OUTPUT) { storage->setOutputElement(dst->DstRegister.Index, out, dst->DstRegister.WriteMask); @@ -683,7 +683,7 @@ translate_instructionir(llvm::Module *module, std::vector< std::vector > inputs(inst->Instruction.NumSrcRegs); for (int i = 0; i < inst->Instruction.NumSrcRegs; ++i) { - struct tgsi_full_src_register *src = &inst->FullSrcRegisters[i]; + struct tgsi_full_src_register *src = &inst->Src[i]; std::vector val; llvm::Value *indIdx = 0; int swizzle = swizzleInt(src); @@ -993,7 +993,7 @@ translate_instructionir(llvm::Module *module, /* store results */ for (int i = 0; i < inst->Instruction.NumDstRegs; ++i) { - struct tgsi_full_dst_register *dst = &inst->FullDstRegisters[i]; + struct tgsi_full_dst_register *dst = &inst->Dst[i]; storage->store((enum tgsi_file_type)dst->DstRegister.File, dst->DstRegister.Index, out, dst->DstRegister.WriteMask, instr->getIRBuilder() ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index 2e6c5b38b4..7ec832aad9 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -473,14 +473,14 @@ tgsi_default_full_instruction( void ) unsigned i; full_instruction.Instruction = tgsi_default_instruction(); - full_instruction.InstructionPredicate = tgsi_default_instruction_predicate(); - full_instruction.InstructionLabel = tgsi_default_instruction_label(); - full_instruction.InstructionTexture = tgsi_default_instruction_texture(); + full_instruction.Predicate = tgsi_default_instruction_predicate(); + full_instruction.Label = tgsi_default_instruction_label(); + full_instruction.Texture = tgsi_default_instruction_texture(); for( i = 0; i < TGSI_FULL_MAX_DST_REGISTERS; i++ ) { - full_instruction.FullDstRegisters[i] = tgsi_default_full_dst_register(); + full_instruction.Dst[i] = tgsi_default_full_dst_register(); } for( i = 0; i < TGSI_FULL_MAX_SRC_REGISTERS; i++ ) { - full_instruction.FullSrcRegisters[i] = tgsi_default_full_src_register(); + full_instruction.Src[i] = tgsi_default_full_src_register(); } return full_instruction; @@ -521,18 +521,18 @@ tgsi_build_full_instruction( size++; *instruction_predicate = - tgsi_build_instruction_predicate(full_inst->InstructionPredicate.Index, - full_inst->InstructionPredicate.Negate, - full_inst->InstructionPredicate.SwizzleX, - full_inst->InstructionPredicate.SwizzleY, - full_inst->InstructionPredicate.SwizzleZ, - full_inst->InstructionPredicate.SwizzleW, + tgsi_build_instruction_predicate(full_inst->Predicate.Index, + full_inst->Predicate.Negate, + full_inst->Predicate.SwizzleX, + full_inst->Predicate.SwizzleY, + full_inst->Predicate.SwizzleZ, + full_inst->Predicate.SwizzleW, instruction, header); } if( tgsi_compare_instruction_label( - full_inst->InstructionLabel, + full_inst->Label, tgsi_default_instruction_label() ) ) { struct tgsi_instruction_label *instruction_label; @@ -543,7 +543,7 @@ tgsi_build_full_instruction( size++; *instruction_label = tgsi_build_instruction_label( - full_inst->InstructionLabel.Label, + full_inst->Label.Label, prev_token, instruction, header ); @@ -551,7 +551,7 @@ tgsi_build_full_instruction( } if( tgsi_compare_instruction_texture( - full_inst->InstructionTexture, + full_inst->Texture, tgsi_default_instruction_texture() ) ) { struct tgsi_instruction_texture *instruction_texture; @@ -562,7 +562,7 @@ tgsi_build_full_instruction( size++; *instruction_texture = tgsi_build_instruction_texture( - full_inst->InstructionTexture.Texture, + full_inst->Texture.Texture, prev_token, instruction, header ); @@ -570,7 +570,7 @@ tgsi_build_full_instruction( } for( i = 0; i < full_inst->Instruction.NumDstRegs; i++ ) { - const struct tgsi_full_dst_register *reg = &full_inst->FullDstRegisters[i]; + const struct tgsi_full_dst_register *reg = &full_inst->Dst[i]; struct tgsi_dst_register *dst_register; struct tgsi_token *prev_token; @@ -613,7 +613,7 @@ tgsi_build_full_instruction( } for( i = 0; i < full_inst->Instruction.NumSrcRegs; i++ ) { - const struct tgsi_full_src_register *reg = &full_inst->FullSrcRegisters[i]; + const struct tgsi_full_src_register *reg = &full_inst->Src[i]; struct tgsi_src_register *src_register; struct tgsi_token *prev_token; diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index 8f26d5dae3..4ff7f4b11e 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -352,7 +352,7 @@ iter_instruction( } for (i = 0; i < inst->Instruction.NumDstRegs; i++) { - const struct tgsi_full_dst_register *dst = &inst->FullDstRegisters[i]; + const struct tgsi_full_dst_register *dst = &inst->Dst[i]; if (!first_reg) CHR( ',' ); @@ -380,7 +380,7 @@ iter_instruction( } for (i = 0; i < inst->Instruction.NumSrcRegs; i++) { - const struct tgsi_full_src_register *src = &inst->FullSrcRegisters[i]; + const struct tgsi_full_src_register *src = &inst->Src[i]; if (!first_reg) CHR( ',' ); @@ -429,7 +429,7 @@ iter_instruction( if (inst->Instruction.Texture) { TXT( ", " ); - ENM( inst->InstructionTexture.Texture, texture_names ); + ENM( inst->Texture.Texture, texture_names ); } switch (inst->Instruction.Opcode) { @@ -439,7 +439,7 @@ iter_instruction( case TGSI_OPCODE_ENDLOOP: case TGSI_OPCODE_CAL: TXT( " :" ); - UID( inst->InstructionLabel.Label ); + UID( inst->Label.Label ); break; } diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c index 11d28b1653..194b2473bc 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c @@ -334,8 +334,8 @@ dump_instruction_verbose( } for( i = 0; i < inst->Instruction.NumDstRegs; i++ ) { - struct tgsi_full_dst_register *dst = &inst->FullDstRegisters[i]; - struct tgsi_full_dst_register *fd = &fi->FullDstRegisters[i]; + struct tgsi_full_dst_register *dst = &inst->Dst[i]; + struct tgsi_full_dst_register *fd = &fi->Dst[i]; EOL(); TXT( "\nFile : " ); @@ -387,8 +387,8 @@ dump_instruction_verbose( } for( i = 0; i < inst->Instruction.NumSrcRegs; i++ ) { - struct tgsi_full_src_register *src = &inst->FullSrcRegisters[i]; - struct tgsi_full_src_register *fs = &fi->FullSrcRegisters[i]; + struct tgsi_full_src_register *src = &inst->Src[i]; + struct tgsi_full_src_register *fs = &fi->Src[i]; EOL(); TXT( "\nFile : "); diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index c113f4a3bc..a9bfb0d6df 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -107,10 +107,10 @@ #define TEMP_P0 TGSI_EXEC_TEMP_P0 #define IS_CHANNEL_ENABLED(INST, CHAN)\ - ((INST).FullDstRegisters[0].DstRegister.WriteMask & (1 << (CHAN))) + ((INST).Dst[0].DstRegister.WriteMask & (1 << (CHAN))) #define IS_CHANNEL_ENABLED2(INST, CHAN)\ - ((INST).FullDstRegisters[1].DstRegister.WriteMask & (1 << (CHAN))) + ((INST).Dst[1].DstRegister.WriteMask & (1 << (CHAN))) #define FOR_EACH_ENABLED_CHANNEL(INST, CHAN)\ for (CHAN = 0; CHAN < NUM_CHANNELS; CHAN++)\ @@ -188,7 +188,7 @@ tgsi_check_soa_dependencies(const struct tgsi_full_instruction *inst) { uint i, chan; - uint writemask = inst->FullDstRegisters[0].DstRegister.WriteMask; + uint writemask = inst->Dst[0].DstRegister.WriteMask; if (writemask == TGSI_WRITEMASK_X || writemask == TGSI_WRITEMASK_Y || writemask == TGSI_WRITEMASK_Z || @@ -200,15 +200,15 @@ tgsi_check_soa_dependencies(const struct tgsi_full_instruction *inst) /* loop over src regs */ for (i = 0; i < inst->Instruction.NumSrcRegs; i++) { - if ((inst->FullSrcRegisters[i].SrcRegister.File == - inst->FullDstRegisters[0].DstRegister.File) && - (inst->FullSrcRegisters[i].SrcRegister.Index == - inst->FullDstRegisters[0].DstRegister.Index)) { + if ((inst->Src[i].SrcRegister.File == + inst->Dst[0].DstRegister.File) && + (inst->Src[i].SrcRegister.Index == + inst->Dst[0].DstRegister.Index)) { /* loop over dest channels */ uint channelsWritten = 0x0; FOR_EACH_ENABLED_CHANNEL(*inst, chan) { /* check if we're reading a channel that's been written */ - uint swizzle = tgsi_util_get_full_src_register_swizzle(&inst->FullSrcRegisters[i], chan); + uint swizzle = tgsi_util_get_full_src_register_swizzle(&inst->Src[i], chan); if (channelsWritten & (1 << swizzle)) { return TRUE; } @@ -1500,27 +1500,27 @@ store_dest( switch (chan_index) { case CHAN_X: - swizzle = inst->InstructionPredicate.SwizzleX; + swizzle = inst->Predicate.SwizzleX; break; case CHAN_Y: - swizzle = inst->InstructionPredicate.SwizzleY; + swizzle = inst->Predicate.SwizzleY; break; case CHAN_Z: - swizzle = inst->InstructionPredicate.SwizzleZ; + swizzle = inst->Predicate.SwizzleZ; break; case CHAN_W: - swizzle = inst->InstructionPredicate.SwizzleW; + swizzle = inst->Predicate.SwizzleW; break; default: assert(0); return; } - assert(inst->InstructionPredicate.Index == 0); + assert(inst->Predicate.Index == 0); - pred = &mach->Predicates[inst->InstructionPredicate.Index].xyzw[swizzle]; + pred = &mach->Predicates[inst->Predicate.Index].xyzw[swizzle]; - if (inst->InstructionPredicate.Negate) { + if (inst->Predicate.Negate) { for (i = 0; i < QUAD_SIZE; i++) { if (pred->u[i]) { execmask &= ~(1 << i); @@ -1572,10 +1572,10 @@ store_dest( } #define FETCH(VAL,INDEX,CHAN)\ - fetch_source (mach, VAL, &inst->FullSrcRegisters[INDEX], CHAN) + fetch_source (mach, VAL, &inst->Src[INDEX], CHAN) #define STORE(VAL,INDEX,CHAN)\ - store_dest (mach, VAL, &inst->FullDstRegisters[INDEX], inst, CHAN ) + store_dest (mach, VAL, &inst->Dst[INDEX], inst, CHAN ) /** @@ -1601,7 +1601,7 @@ exec_kil(struct tgsi_exec_machine *mach, /* unswizzle channel */ swizzle = tgsi_util_get_full_src_register_swizzle ( - &inst->FullSrcRegisters[0], + &inst->Src[0], chan_index); /* check if the component has not been already tested */ @@ -1668,14 +1668,14 @@ exec_tex(struct tgsi_exec_machine *mach, boolean biasLod, boolean projected) { - const uint unit = inst->FullSrcRegisters[1].SrcRegister.Index; + const uint unit = inst->Src[1].SrcRegister.Index; union tgsi_exec_channel r[4]; uint chan_index; float lodBias; /* debug_printf("Sampler %u unit %u\n", sampler, unit); */ - switch (inst->InstructionTexture.Texture) { + switch (inst->Texture.Texture) { case TGSI_TEXTURE_1D: case TGSI_TEXTURE_SHADOW1D: @@ -1765,7 +1765,7 @@ static void exec_txd(struct tgsi_exec_machine *mach, const struct tgsi_full_instruction *inst) { - const uint unit = inst->FullSrcRegisters[3].SrcRegister.Index; + const uint unit = inst->Src[3].SrcRegister.Index; union tgsi_exec_channel r[4]; uint chan_index; @@ -1773,7 +1773,7 @@ exec_txd(struct tgsi_exec_machine *mach, * XXX: This is fake TXD -- the derivatives are not taken into account, yet. */ - switch (inst->InstructionTexture.Texture) { + switch (inst->Texture.Texture) { case TGSI_TEXTURE_1D: case TGSI_TEXTURE_SHADOW1D: @@ -2740,7 +2740,7 @@ exec_instruction( mach->FuncStack[mach->FuncStackTop++] = mach->FuncMask; /* Finally, jump to the subroutine */ - *pc = inst->InstructionLabel.Label; + *pc = inst->Label.Label; } break; diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c index d4f27499b8..ff593fdc32 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.c +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c @@ -153,36 +153,36 @@ tgsi_parse_token( copy_token(&inst->Instruction, &token); if (inst->Instruction.Predicate) { - next_token(ctx, &inst->InstructionPredicate); + next_token(ctx, &inst->Predicate); } if (inst->Instruction.Label) { - next_token( ctx, &inst->InstructionLabel); + next_token( ctx, &inst->Label); } if (inst->Instruction.Texture) { - next_token( ctx, &inst->InstructionTexture); + next_token( ctx, &inst->Texture); } assert( inst->Instruction.NumDstRegs <= TGSI_FULL_MAX_DST_REGISTERS ); for( i = 0; i < inst->Instruction.NumDstRegs; i++ ) { - next_token( ctx, &inst->FullDstRegisters[i].DstRegister ); + next_token( ctx, &inst->Dst[i].DstRegister ); /* * No support for indirect or multi-dimensional addressing. */ - assert( !inst->FullDstRegisters[i].DstRegister.Dimension ); + assert( !inst->Dst[i].DstRegister.Dimension ); - if( inst->FullDstRegisters[i].DstRegister.Indirect ) { - next_token( ctx, &inst->FullDstRegisters[i].DstRegisterInd ); + if( inst->Dst[i].DstRegister.Indirect ) { + next_token( ctx, &inst->Dst[i].DstRegisterInd ); /* * No support for indirect or multi-dimensional addressing. */ - assert( !inst->FullDstRegisters[i].DstRegisterInd.Dimension ); - assert( !inst->FullDstRegisters[i].DstRegisterInd.Indirect ); + assert( !inst->Dst[i].DstRegisterInd.Dimension ); + assert( !inst->Dst[i].DstRegisterInd.Indirect ); } } @@ -190,34 +190,34 @@ tgsi_parse_token( for( i = 0; i < inst->Instruction.NumSrcRegs; i++ ) { - next_token( ctx, &inst->FullSrcRegisters[i].SrcRegister ); + next_token( ctx, &inst->Src[i].SrcRegister ); - if( inst->FullSrcRegisters[i].SrcRegister.Indirect ) { - next_token( ctx, &inst->FullSrcRegisters[i].SrcRegisterInd ); + if( inst->Src[i].SrcRegister.Indirect ) { + next_token( ctx, &inst->Src[i].SrcRegisterInd ); /* * No support for indirect or multi-dimensional addressing. */ - assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Indirect ); - assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Dimension ); + assert( !inst->Src[i].SrcRegisterInd.Indirect ); + assert( !inst->Src[i].SrcRegisterInd.Dimension ); } - if( inst->FullSrcRegisters[i].SrcRegister.Dimension ) { - next_token( ctx, &inst->FullSrcRegisters[i].SrcRegisterDim ); + if( inst->Src[i].SrcRegister.Dimension ) { + next_token( ctx, &inst->Src[i].SrcRegisterDim ); /* * No support for multi-dimensional addressing. */ - assert( !inst->FullSrcRegisters[i].SrcRegisterDim.Dimension ); + assert( !inst->Src[i].SrcRegisterDim.Dimension ); - if( inst->FullSrcRegisters[i].SrcRegisterDim.Indirect ) { - next_token( ctx, &inst->FullSrcRegisters[i].SrcRegisterDimInd ); + if( inst->Src[i].SrcRegisterDim.Indirect ) { + next_token( ctx, &inst->Src[i].SrcRegisterDimInd ); /* * No support for indirect or multi-dimensional addressing. */ - assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Indirect ); - assert( !inst->FullSrcRegisters[i].SrcRegisterInd.Dimension ); + assert( !inst->Src[i].SrcRegisterInd.Indirect ); + assert( !inst->Src[i].SrcRegisterInd.Dimension ); } } } diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h b/src/gallium/auxiliary/tgsi/tgsi_parse.h index 48e6987ab7..2f8f4d488b 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.h +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h @@ -78,11 +78,11 @@ struct tgsi_full_immediate struct tgsi_full_instruction { struct tgsi_instruction Instruction; - struct tgsi_instruction_predicate InstructionPredicate; - struct tgsi_instruction_label InstructionLabel; - struct tgsi_instruction_texture InstructionTexture; - struct tgsi_full_dst_register FullDstRegisters[TGSI_FULL_MAX_DST_REGISTERS]; - struct tgsi_full_src_register FullSrcRegisters[TGSI_FULL_MAX_SRC_REGISTERS]; + struct tgsi_instruction_predicate Predicate; + struct tgsi_instruction_label Label; + struct tgsi_instruction_texture Texture; + struct tgsi_full_dst_register Dst[TGSI_FULL_MAX_DST_REGISTERS]; + struct tgsi_full_src_register Src[TGSI_FULL_MAX_SRC_REGISTERS]; }; union tgsi_full_token diff --git a/src/gallium/auxiliary/tgsi/tgsi_ppc.c b/src/gallium/auxiliary/tgsi/tgsi_ppc.c index 617fd7f6be..8397f432f9 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ppc.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ppc.c @@ -60,7 +60,7 @@ const float ppc_builtin_constants[] ALIGN16_ATTRIB = { for (CHAN = 0; CHAN < NUM_CHANNELS; CHAN++) #define IS_DST0_CHANNEL_ENABLED( INST, CHAN )\ - ((INST).FullDstRegisters[0].DstRegister.WriteMask & (1 << (CHAN))) + ((INST).Dst[0].DstRegister.WriteMask & (1 << (CHAN))) #define IF_IS_DST0_CHANNEL_ENABLED( INST, CHAN )\ if (IS_DST0_CHANNEL_ENABLED( INST, CHAN )) @@ -431,7 +431,7 @@ get_src_vec(struct gen_context *gen, struct tgsi_full_instruction *inst, int src_reg, uint chan) { const const struct tgsi_full_src_register *src = - &inst->FullSrcRegisters[src_reg]; + &inst->Src[src_reg]; int vec; uint i; @@ -482,7 +482,7 @@ get_dst_vec(struct gen_context *gen, const struct tgsi_full_instruction *inst, unsigned chan_index) { - const struct tgsi_full_dst_register *reg = &inst->FullDstRegisters[0]; + const struct tgsi_full_dst_register *reg = &inst->Dst[0]; if (is_ppc_vec_temporary_dst(reg)) { int vec = gen->temps_map[reg->DstRegister.Index][chan_index]; @@ -505,7 +505,7 @@ emit_store(struct gen_context *gen, unsigned chan_index, boolean free_vec) { - const struct tgsi_full_dst_register *reg = &inst->FullDstRegisters[0]; + const struct tgsi_full_dst_register *reg = &inst->Dst[0]; switch (reg->DstRegister.File) { case TGSI_FILE_OUTPUT: diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c b/src/gallium/auxiliary/tgsi/tgsi_sanity.c index 36e27ea52f..8422b91a30 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c @@ -212,24 +212,24 @@ iter_instruction( for (i = 0; i < inst->Instruction.NumDstRegs; i++) { check_register_usage( ctx, - inst->FullDstRegisters[i].DstRegister.File, - inst->FullDstRegisters[i].DstRegister.Index, + inst->Dst[i].DstRegister.File, + inst->Dst[i].DstRegister.Index, "destination", FALSE ); } for (i = 0; i < inst->Instruction.NumSrcRegs; i++) { check_register_usage( ctx, - inst->FullSrcRegisters[i].SrcRegister.File, - inst->FullSrcRegisters[i].SrcRegister.Index, + inst->Src[i].SrcRegister.File, + inst->Src[i].SrcRegister.Index, "source", - (boolean)inst->FullSrcRegisters[i].SrcRegister.Indirect ); - if (inst->FullSrcRegisters[i].SrcRegister.Indirect) { + (boolean)inst->Src[i].SrcRegister.Indirect ); + if (inst->Src[i].SrcRegister.Indirect) { uint file; int index; - file = inst->FullSrcRegisters[i].SrcRegisterInd.File; - index = inst->FullSrcRegisters[i].SrcRegisterInd.Index; + file = inst->Src[i].SrcRegisterInd.File; + index = inst->Src[i].SrcRegisterInd.Index; check_register_usage( ctx, file, @@ -245,8 +245,8 @@ iter_instruction( switch (inst->Instruction.Opcode) { case TGSI_OPCODE_BGNFOR: case TGSI_OPCODE_ENDFOR: - if (inst->FullDstRegisters[0].DstRegister.File != TGSI_FILE_LOOP || - inst->FullDstRegisters[0].DstRegister.Index != 0) { + if (inst->Dst[0].DstRegister.File != TGSI_FILE_LOOP || + inst->Dst[0].DstRegister.Index != 0) { report_error(ctx, "Destination register must be LOOP[0]"); } break; @@ -254,8 +254,8 @@ iter_instruction( switch (inst->Instruction.Opcode) { case TGSI_OPCODE_BGNFOR: - if (inst->FullSrcRegisters[0].SrcRegister.File != TGSI_FILE_CONSTANT && - inst->FullSrcRegisters[0].SrcRegister.File != TGSI_FILE_IMMEDIATE) { + if (inst->Src[0].SrcRegister.File != TGSI_FILE_CONSTANT && + inst->Src[0].SrcRegister.File != TGSI_FILE_IMMEDIATE) { report_error(ctx, "Source register file must be either CONST or IMM"); } break; diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c index 69567130e3..be25b3dc5c 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c @@ -96,7 +96,7 @@ tgsi_scan_shader(const struct tgsi_token *tokens, uint i; for (i = 0; i < fullinst->Instruction.NumSrcRegs; i++) { const struct tgsi_full_src_register *src = - &fullinst->FullSrcRegisters[i]; + &fullinst->Src[i]; if (src->SrcRegister.File == TGSI_FILE_INPUT) { const int ind = src->SrcRegister.Index; if (info->input_semantic_name[ind] == TGSI_SEMANTIC_FOG) { @@ -205,9 +205,9 @@ tgsi_is_passthrough_shader(const struct tgsi_token *tokens) struct tgsi_full_instruction *fullinst = &parse.FullToken.FullInstruction; const struct tgsi_full_src_register *src = - &fullinst->FullSrcRegisters[0]; + &fullinst->Src[0]; const struct tgsi_full_dst_register *dst = - &fullinst->FullDstRegisters[0]; + &fullinst->Dst[0]; /* Do a whole bunch of checks for a simple move */ if (fullinst->Instruction.Opcode != TGSI_OPCODE_MOV || diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index a6cc3a5398..2d2ee321c9 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -58,7 +58,7 @@ for (CHAN = 0; CHAN < NUM_CHANNELS; CHAN++) #define IS_DST0_CHANNEL_ENABLED( INST, CHAN )\ - ((INST).FullDstRegisters[0].DstRegister.WriteMask & (1 << (CHAN))) + ((INST).Dst[0].DstRegister.WriteMask & (1 << (CHAN))) #define IF_IS_DST0_CHANNEL_ENABLED( INST, CHAN )\ if (IS_DST0_CHANNEL_ENABLED( INST, CHAN )) @@ -1331,7 +1331,7 @@ emit_fetch( } #define FETCH( FUNC, INST, XMM, INDEX, CHAN )\ - emit_fetch( FUNC, XMM, &(INST).FullSrcRegisters[INDEX], CHAN ) + emit_fetch( FUNC, XMM, &(INST).Src[INDEX], CHAN ) /** * Register store. @@ -1402,7 +1402,7 @@ emit_store( } #define STORE( FUNC, INST, XMM, INDEX, CHAN )\ - emit_store( FUNC, XMM, &(INST).FullDstRegisters[INDEX], &(INST), CHAN ) + emit_store( FUNC, XMM, &(INST).Dst[INDEX], &(INST), CHAN ) static void PIPE_CDECL @@ -1459,13 +1459,13 @@ emit_tex( struct x86_function *func, boolean lodbias, boolean projected) { - const uint unit = inst->FullSrcRegisters[1].SrcRegister.Index; + const uint unit = inst->Src[1].SrcRegister.Index; struct x86_reg args[2]; unsigned count; unsigned i; assert(inst->Instruction.Texture); - switch (inst->InstructionTexture.Texture) { + switch (inst->Texture.Texture) { case TGSI_TEXTURE_1D: count = 1; break; @@ -1720,13 +1720,13 @@ indirect_temp_reference(const struct tgsi_full_instruction *inst) { uint i; for (i = 0; i < inst->Instruction.NumSrcRegs; i++) { - const struct tgsi_full_src_register *reg = &inst->FullSrcRegisters[i]; + const struct tgsi_full_src_register *reg = &inst->Src[i]; if (reg->SrcRegister.File == TGSI_FILE_TEMPORARY && reg->SrcRegister.Indirect) return TRUE; } for (i = 0; i < inst->Instruction.NumDstRegs; i++) { - const struct tgsi_full_dst_register *reg = &inst->FullDstRegisters[i]; + const struct tgsi_full_dst_register *reg = &inst->Dst[i]; if (reg->DstRegister.File == TGSI_FILE_TEMPORARY && reg->DstRegister.Indirect) return TRUE; @@ -2244,7 +2244,7 @@ emit_instruction( case TGSI_OPCODE_KIL: /* conditional kill */ - emit_kil( func, &inst->FullSrcRegisters[0] ); + emit_kil( func, &inst->Src[0] ); break; case TGSI_OPCODE_PK2H: diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index d25f590df7..e9b1a21fb4 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -699,11 +699,11 @@ parse_instruction( } if (i < info->num_dst) { - if (!parse_dst_operand( ctx, &inst.FullDstRegisters[i] )) + if (!parse_dst_operand( ctx, &inst.Dst[i] )) return FALSE; } else if (i < info->num_dst + info->num_src) { - if (!parse_src_operand( ctx, &inst.FullSrcRegisters[i - info->num_dst] )) + if (!parse_src_operand( ctx, &inst.Src[i - info->num_dst] )) return FALSE; } else { @@ -713,7 +713,7 @@ parse_instruction( if (str_match_no_case( &ctx->cur, texture_names[j] )) { if (!is_digit_alpha_underscore( ctx->cur )) { inst.Instruction.Texture = 1; - inst.InstructionTexture.Texture = j; + inst.Texture.Texture = j; break; } } @@ -740,7 +740,7 @@ parse_instruction( return FALSE; } inst.Instruction.Label = 1; - inst.InstructionLabel.Label = target; + inst.Label.Label = target; } advance = tgsi_build_full_instruction( diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index cda6dc134a..34a02b5042 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -213,7 +213,7 @@ create_frag_shader(struct vl_compositor *c) */ for (i = 0; i < 4; ++i) { inst = vl_inst3(TGSI_OPCODE_DP4, TGSI_FILE_OUTPUT, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_CONSTANT, i); - inst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; + inst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index c4ba69817f..93e79e7f37 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -237,10 +237,10 @@ create_intra_frag_shader(struct vl_mpeg12_mc_renderer *r) ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1); - inst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; - inst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; + inst.Src[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; + inst.Src[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; + inst.Src[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; + inst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } @@ -415,10 +415,10 @@ create_frame_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1); - inst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; - inst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; + inst.Src[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; + inst.Src[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; + inst.Src[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; + inst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } @@ -620,10 +620,10 @@ create_frame_bi_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1); - inst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; - inst.FullDstRegisters[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; + inst.Src[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; + inst.Src[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; + inst.Src[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; + inst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } @@ -642,10 +642,10 @@ create_frame_bi_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) /* lerp t1, c1.x, t1, t2 ; Blend past and future texels */ inst = vl_inst4(TGSI_OPCODE_LRP, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_CONSTANT, 1, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_TEMPORARY, 2); - inst.FullSrcRegisters[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; - inst.FullSrcRegisters[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_X; + inst.Src[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; + inst.Src[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; + inst.Src[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; + inst.Src[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_X; ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); /* add o0, t0, t1 ; Add past/future ref and differential to form final output */ diff --git a/src/gallium/auxiliary/vl/vl_shader_build.c b/src/gallium/auxiliary/vl/vl_shader_build.c index d052e2c797..82300b1da2 100644 --- a/src/gallium/auxiliary/vl/vl_shader_build.c +++ b/src/gallium/auxiliary/vl/vl_shader_build.c @@ -138,11 +138,11 @@ struct tgsi_full_instruction vl_inst2 inst.Instruction.Opcode = opcode; inst.Instruction.NumDstRegs = 1; - inst.FullDstRegisters[0].DstRegister.File = dst_file; - inst.FullDstRegisters[0].DstRegister.Index = dst_index; + inst.Dst[0].DstRegister.File = dst_file; + inst.Dst[0].DstRegister.Index = dst_index; inst.Instruction.NumSrcRegs = 1; - inst.FullSrcRegisters[0].SrcRegister.File = src_file; - inst.FullSrcRegisters[0].SrcRegister.Index = src_index; + inst.Src[0].SrcRegister.File = src_file; + inst.Src[0].SrcRegister.Index = src_index; return inst; } @@ -162,13 +162,13 @@ struct tgsi_full_instruction vl_inst3 inst.Instruction.Opcode = opcode; inst.Instruction.NumDstRegs = 1; - inst.FullDstRegisters[0].DstRegister.File = dst_file; - inst.FullDstRegisters[0].DstRegister.Index = dst_index; + inst.Dst[0].DstRegister.File = dst_file; + inst.Dst[0].DstRegister.Index = dst_index; inst.Instruction.NumSrcRegs = 2; - inst.FullSrcRegisters[0].SrcRegister.File = src1_file; - inst.FullSrcRegisters[0].SrcRegister.Index = src1_index; - inst.FullSrcRegisters[1].SrcRegister.File = src2_file; - inst.FullSrcRegisters[1].SrcRegister.Index = src2_index; + inst.Src[0].SrcRegister.File = src1_file; + inst.Src[0].SrcRegister.Index = src1_index; + inst.Src[1].SrcRegister.File = src2_file; + inst.Src[1].SrcRegister.Index = src2_index; return inst; } @@ -188,15 +188,15 @@ struct tgsi_full_instruction vl_tex inst.Instruction.Opcode = TGSI_OPCODE_TEX; inst.Instruction.NumDstRegs = 1; - inst.FullDstRegisters[0].DstRegister.File = dst_file; - inst.FullDstRegisters[0].DstRegister.Index = dst_index; + inst.Dst[0].DstRegister.File = dst_file; + inst.Dst[0].DstRegister.Index = dst_index; inst.Instruction.NumSrcRegs = 2; inst.Instruction.Texture = 1; - inst.InstructionTexture.Texture = tex; - inst.FullSrcRegisters[0].SrcRegister.File = src1_file; - inst.FullSrcRegisters[0].SrcRegister.Index = src1_index; - inst.FullSrcRegisters[1].SrcRegister.File = src2_file; - inst.FullSrcRegisters[1].SrcRegister.Index = src2_index; + inst.Texture.Texture = tex; + inst.Src[0].SrcRegister.File = src1_file; + inst.Src[0].SrcRegister.Index = src1_index; + inst.Src[1].SrcRegister.File = src2_file; + inst.Src[1].SrcRegister.Index = src2_index; return inst; } @@ -218,15 +218,15 @@ struct tgsi_full_instruction vl_inst4 inst.Instruction.Opcode = opcode; inst.Instruction.NumDstRegs = 1; - inst.FullDstRegisters[0].DstRegister.File = dst_file; - inst.FullDstRegisters[0].DstRegister.Index = dst_index; + inst.Dst[0].DstRegister.File = dst_file; + inst.Dst[0].DstRegister.Index = dst_index; inst.Instruction.NumSrcRegs = 3; - inst.FullSrcRegisters[0].SrcRegister.File = src1_file; - inst.FullSrcRegisters[0].SrcRegister.Index = src1_index; - inst.FullSrcRegisters[1].SrcRegister.File = src2_file; - inst.FullSrcRegisters[1].SrcRegister.Index = src2_index; - inst.FullSrcRegisters[2].SrcRegister.File = src3_file; - inst.FullSrcRegisters[2].SrcRegister.Index = src3_index; + inst.Src[0].SrcRegister.File = src1_file; + inst.Src[0].SrcRegister.Index = src1_index; + inst.Src[1].SrcRegister.File = src2_file; + inst.Src[1].SrcRegister.Index = src2_index; + inst.Src[2].SrcRegister.File = src3_file; + inst.Src[2].SrcRegister.Index = src3_index; return inst; } diff --git a/src/gallium/drivers/cell/ppu/cell_gen_fp.c b/src/gallium/drivers/cell/ppu/cell_gen_fp.c index 19e3ab0844..b0afad349f 100644 --- a/src/gallium/drivers/cell/ppu/cell_gen_fp.c +++ b/src/gallium/drivers/cell/ppu/cell_gen_fp.c @@ -544,7 +544,7 @@ emit_epilogue(struct codegen *gen) #define FOR_EACH_ENABLED_CHANNEL(inst, ch) \ for (ch = 0; ch < 4; ch++) \ - if (inst->FullDstRegisters[0].DstRegister.WriteMask & (1 << ch)) + if (inst->Dst[0].DstRegister.WriteMask & (1 << ch)) static boolean @@ -552,7 +552,7 @@ emit_ARL(struct codegen *gen, const struct tgsi_full_instruction *inst) { int ch = 0, src_reg, addr_reg; - src_reg = get_src_reg(gen, ch, &inst->FullSrcRegisters[0]); + src_reg = get_src_reg(gen, ch, &inst->Src[0]); addr_reg = get_address_reg(gen); /* convert float to int */ @@ -570,19 +570,19 @@ emit_MOV(struct codegen *gen, const struct tgsi_full_instruction *inst) int ch, src_reg[4], dst_reg[4]; FOR_EACH_ENABLED_CHANNEL(inst, ch) { - src_reg[ch] = get_src_reg(gen, ch, &inst->FullSrcRegisters[0]); - dst_reg[ch] = get_dst_reg(gen, ch, &inst->FullDstRegisters[0]); + src_reg[ch] = get_src_reg(gen, ch, &inst->Src[0]); + dst_reg[ch] = get_dst_reg(gen, ch, &inst->Dst[0]); } FOR_EACH_ENABLED_CHANNEL(inst, ch) { - if (is_register_src(gen, ch, &inst->FullSrcRegisters[0]) && - is_memory_dst(gen, ch, &inst->FullDstRegisters[0])) { + if (is_register_src(gen, ch, &inst->Src[0]) && + is_memory_dst(gen, ch, &inst->Dst[0])) { /* special-case: register to memory store */ - store_dest_reg(gen, src_reg[ch], ch, &inst->FullDstRegisters[0]); + store_dest_reg(gen, src_reg[ch], ch, &inst->Dst[0]); } else { spe_move(gen->f, dst_reg[ch], src_reg[ch]); - store_dest_reg(gen, dst_reg[ch], ch, &inst->FullDstRegisters[0]); + store_dest_reg(gen, dst_reg[ch], ch, &inst->Dst[0]); } } @@ -601,9 +601,9 @@ emit_binop(struct codegen *gen, const struct tgsi_full_instruction *inst) /* Loop over Red/Green/Blue/Alpha channels, fetch src operands */ FOR_EACH_ENABLED_CHANNEL(inst, ch) { - s1_reg[ch] = get_src_reg(gen, ch, &inst->FullSrcRegisters[0]); - s2_reg[ch] = get_src_reg(gen, ch, &inst->FullSrcRegisters[1]); - d_reg[ch] = get_dst_reg(gen, ch, &inst->FullDstRegisters[0]); + s1_reg[ch] = get_src_reg(gen, ch, &inst->Src[0]); + s2_reg[ch] = get_src_reg(gen, ch, &inst->Src[1]); + d_reg[ch] = get_dst_reg(gen, ch, &inst->Dst[0]); } /* Loop over Red/Green/Blue/Alpha channels, do the op, store results */ @@ -626,7 +626,7 @@ emit_binop(struct codegen *gen, const struct tgsi_full_instruction *inst) /* Store the result (a no-op for TGSI_FILE_TEMPORARY dests) */ FOR_EACH_ENABLED_CHANNEL(inst, ch) { - store_dest_reg(gen, d_reg[ch], ch, &inst->FullDstRegisters[0]); + store_dest_reg(gen, d_reg[ch], ch, &inst->Dst[0]); } /* Free any intermediate temps we allocated */ @@ -645,16 +645,16 @@ emit_MAD(struct codegen *gen, const struct tgsi_full_instruction *inst) int ch, s1_reg[4], s2_reg[4], s3_reg[4], d_reg[4]; FOR_EACH_ENABLED_CHANNEL(inst, ch) { - s1_reg[ch] = get_src_reg(gen, ch, &inst->FullSrcRegisters[0]); - s2_reg[ch] = get_src_reg(gen, ch, &inst->FullSrcRegisters[1]); - s3_reg[ch] = get_src_reg(gen, ch, &inst->FullSrcRegisters[2]); - d_reg[ch] = get_dst_reg(gen, ch, &inst->FullDstRegisters[0]); + s1_reg[ch] = get_src_reg(gen, ch, &inst->Src[0]); + s2_reg[ch] = get_src_reg(gen, ch, &inst->Src[1]); + s3_reg[ch] = get_src_reg(gen, ch, &inst->Src[2]); + d_reg[ch] = get_dst_reg(gen, ch, &inst->Dst[0]); } FOR_EACH_ENABLED_CHANNEL(inst, ch) { spe_fma(gen->f, d_reg[ch], s1_reg[ch], s2_reg[ch], s3_reg[ch]); } FOR_EACH_ENABLED_CHANNEL(inst, ch) { - store_dest_reg(gen, d_reg[ch], ch, &inst->FullDstRegisters[0]); + store_dest_reg(gen, d_reg[ch], ch, &inst->Dst[0]); } free_itemps(gen); return TRUE; @@ -671,10 +671,10 @@ emit_LRP(struct codegen *gen, const struct tgsi_full_instruction *inst) /* setup/get src/dst/temp regs */ FOR_EACH_ENABLED_CHANNEL(inst, ch) { - s1_reg[ch] = get_src_reg(gen, ch, &inst->FullSrcRegisters[0]); - s2_reg[ch] = get_src_reg(gen, ch, &inst->FullSrcRegisters[1]); - s3_reg[ch] = get_src_reg(gen, ch, &inst->FullSrcRegisters[2]); - d_reg[ch] = get_dst_reg(gen, ch, &inst->FullDstRegisters[0]); + s1_reg[ch] = get_src_reg(gen, ch, &inst->Src[0]); + s2_reg[ch] = get_src_reg(gen, ch, &inst->Src[1]); + s3_reg[ch] = get_src_reg(gen, ch, &inst->Src[2]); + d_reg[ch] = get_dst_reg(gen, ch, &inst->Dst[0]); tmp_reg[ch] = get_itemp(gen); } @@ -687,7 +687,7 @@ emit_LRP(struct codegen *gen, const struct tgsi_full_instruction *inst) spe_fma(gen->f, d_reg[ch], tmp_reg[ch], s1_reg[ch], s3_reg[ch]); } FOR_EACH_ENABLED_CHANNEL(inst, ch) { - store_dest_reg(gen, d_reg[ch], ch, &inst->FullDstRegisters[0]); + store_dest_reg(gen, d_reg[ch], ch, &inst->Dst[0]); } free_itemps(gen); return TRUE; @@ -704,8 +704,8 @@ emit_RCP_RSQ(struct codegen *gen, const struct tgsi_full_instruction *inst) int ch, s1_reg[4], d_reg[4], tmp_reg[4]; FOR_EACH_ENABLED_CHANNEL(inst, ch) { - s1_reg[ch] = get_src_reg(gen, ch, &inst->FullSrcRegisters[0]); - d_reg[ch] = get_dst_reg(gen, ch, &inst->FullDstRegisters[0]); + s1_reg[ch] = get_src_reg(gen, ch, &inst->Src[0]); + d_reg[ch] = get_dst_reg(gen, ch, &inst->Dst[0]); tmp_reg[ch] = get_itemp(gen); } @@ -726,7 +726,7 @@ emit_RCP_RSQ(struct codegen *gen, const struct tgsi_full_instruction *inst) } FOR_EACH_ENABLED_CHANNEL(inst, ch) { - store_dest_reg(gen, d_reg[ch], ch, &inst->FullDstRegisters[0]); + store_dest_reg(gen, d_reg[ch], ch, &inst->Dst[0]); } free_itemps(gen); @@ -747,8 +747,8 @@ emit_ABS(struct codegen *gen, const struct tgsi_full_instruction *inst) spe_load_uint(gen->f, bit31mask_reg, (1 << 31)); FOR_EACH_ENABLED_CHANNEL(inst, ch) { - s1_reg[ch] = get_src_reg(gen, ch, &inst->FullSrcRegisters[0]); - d_reg[ch] = get_dst_reg(gen, ch, &inst->FullDstRegisters[0]); + s1_reg[ch] = get_src_reg(gen, ch, &inst->Src[0]); + d_reg[ch] = get_dst_reg(gen, ch, &inst->Dst[0]); } /* d = sign bit cleared in s1 */ @@ -757,7 +757,7 @@ emit_ABS(struct codegen *gen, const struct tgsi_full_instruction *inst) } FOR_EACH_ENABLED_CHANNEL(inst, ch) { - store_dest_reg(gen, d_reg[ch], ch, &inst->FullDstRegisters[0]); + store_dest_reg(gen, d_reg[ch], ch, &inst->Dst[0]); } free_itemps(gen); @@ -775,12 +775,12 @@ emit_DP3(struct codegen *gen, const struct tgsi_full_instruction *inst) int s2x_reg, s2y_reg, s2z_reg; int t0_reg = get_itemp(gen), t1_reg = get_itemp(gen); - s1x_reg = get_src_reg(gen, CHAN_X, &inst->FullSrcRegisters[0]); - s2x_reg = get_src_reg(gen, CHAN_X, &inst->FullSrcRegisters[1]); - s1y_reg = get_src_reg(gen, CHAN_Y, &inst->FullSrcRegisters[0]); - s2y_reg = get_src_reg(gen, CHAN_Y, &inst->FullSrcRegisters[1]); - s1z_reg = get_src_reg(gen, CHAN_Z, &inst->FullSrcRegisters[0]); - s2z_reg = get_src_reg(gen, CHAN_Z, &inst->FullSrcRegisters[1]); + s1x_reg = get_src_reg(gen, CHAN_X, &inst->Src[0]); + s2x_reg = get_src_reg(gen, CHAN_X, &inst->Src[1]); + s1y_reg = get_src_reg(gen, CHAN_Y, &inst->Src[0]); + s2y_reg = get_src_reg(gen, CHAN_Y, &inst->Src[1]); + s1z_reg = get_src_reg(gen, CHAN_Z, &inst->Src[0]); + s2z_reg = get_src_reg(gen, CHAN_Z, &inst->Src[1]); /* t0 = x0 * x1 */ spe_fm(gen->f, t0_reg, s1x_reg, s2x_reg); @@ -795,9 +795,9 @@ emit_DP3(struct codegen *gen, const struct tgsi_full_instruction *inst) spe_fa(gen->f, t0_reg, t0_reg, t1_reg); FOR_EACH_ENABLED_CHANNEL(inst, ch) { - int d_reg = get_dst_reg(gen, ch, &inst->FullDstRegisters[0]); + int d_reg = get_dst_reg(gen, ch, &inst->Dst[0]); spe_move(gen->f, d_reg, t0_reg); - store_dest_reg(gen, d_reg, ch, &inst->FullDstRegisters[0]); + store_dest_reg(gen, d_reg, ch, &inst->Dst[0]); } free_itemps(gen); @@ -815,14 +815,14 @@ emit_DP4(struct codegen *gen, const struct tgsi_full_instruction *inst) int s1x_reg, s1y_reg, s1z_reg, s1w_reg; int t0_reg = get_itemp(gen), t1_reg = get_itemp(gen); - s0x_reg = get_src_reg(gen, CHAN_X, &inst->FullSrcRegisters[0]); - s1x_reg = get_src_reg(gen, CHAN_X, &inst->FullSrcRegisters[1]); - s0y_reg = get_src_reg(gen, CHAN_Y, &inst->FullSrcRegisters[0]); - s1y_reg = get_src_reg(gen, CHAN_Y, &inst->FullSrcRegisters[1]); - s0z_reg = get_src_reg(gen, CHAN_Z, &inst->FullSrcRegisters[0]); - s1z_reg = get_src_reg(gen, CHAN_Z, &inst->FullSrcRegisters[1]); - s0w_reg = get_src_reg(gen, CHAN_W, &inst->FullSrcRegisters[0]); - s1w_reg = get_src_reg(gen, CHAN_W, &inst->FullSrcRegisters[1]); + s0x_reg = get_src_reg(gen, CHAN_X, &inst->Src[0]); + s1x_reg = get_src_reg(gen, CHAN_X, &inst->Src[1]); + s0y_reg = get_src_reg(gen, CHAN_Y, &inst->Src[0]); + s1y_reg = get_src_reg(gen, CHAN_Y, &inst->Src[1]); + s0z_reg = get_src_reg(gen, CHAN_Z, &inst->Src[0]); + s1z_reg = get_src_reg(gen, CHAN_Z, &inst->Src[1]); + s0w_reg = get_src_reg(gen, CHAN_W, &inst->Src[0]); + s1w_reg = get_src_reg(gen, CHAN_W, &inst->Src[1]); /* t0 = x0 * x1 */ spe_fm(gen->f, t0_reg, s0x_reg, s1x_reg); @@ -840,9 +840,9 @@ emit_DP4(struct codegen *gen, const struct tgsi_full_instruction *inst) spe_fa(gen->f, t0_reg, t0_reg, t1_reg); FOR_EACH_ENABLED_CHANNEL(inst, ch) { - int d_reg = get_dst_reg(gen, ch, &inst->FullDstRegisters[0]); + int d_reg = get_dst_reg(gen, ch, &inst->Dst[0]); spe_move(gen->f, d_reg, t0_reg); - store_dest_reg(gen, d_reg, ch, &inst->FullDstRegisters[0]); + store_dest_reg(gen, d_reg, ch, &inst->Dst[0]); } free_itemps(gen); @@ -857,31 +857,31 @@ emit_DPH(struct codegen *gen, const struct tgsi_full_instruction *inst) { /* XXX rewrite this function to look more like DP3/DP4 */ int ch; - int s1_reg = get_src_reg(gen, CHAN_X, &inst->FullSrcRegisters[0]); - int s2_reg = get_src_reg(gen, CHAN_X, &inst->FullSrcRegisters[1]); + int s1_reg = get_src_reg(gen, CHAN_X, &inst->Src[0]); + int s2_reg = get_src_reg(gen, CHAN_X, &inst->Src[1]); int tmp_reg = get_itemp(gen); /* t = x0 * x1 */ spe_fm(gen->f, tmp_reg, s1_reg, s2_reg); - s1_reg = get_src_reg(gen, CHAN_Y, &inst->FullSrcRegisters[0]); - s2_reg = get_src_reg(gen, CHAN_Y, &inst->FullSrcRegisters[1]); + s1_reg = get_src_reg(gen, CHAN_Y, &inst->Src[0]); + s2_reg = get_src_reg(gen, CHAN_Y, &inst->Src[1]); /* t = y0 * y1 + t */ spe_fma(gen->f, tmp_reg, s1_reg, s2_reg, tmp_reg); - s1_reg = get_src_reg(gen, CHAN_Z, &inst->FullSrcRegisters[0]); - s2_reg = get_src_reg(gen, CHAN_Z, &inst->FullSrcRegisters[1]); + s1_reg = get_src_reg(gen, CHAN_Z, &inst->Src[0]); + s2_reg = get_src_reg(gen, CHAN_Z, &inst->Src[1]); /* t = z0 * z1 + t */ spe_fma(gen->f, tmp_reg, s1_reg, s2_reg, tmp_reg); - s2_reg = get_src_reg(gen, CHAN_W, &inst->FullSrcRegisters[1]); + s2_reg = get_src_reg(gen, CHAN_W, &inst->Src[1]); /* t = w1 + t */ spe_fa(gen->f, tmp_reg, s2_reg, tmp_reg); FOR_EACH_ENABLED_CHANNEL(inst, ch) { - int d_reg = get_dst_reg(gen, ch, &inst->FullDstRegisters[0]); + int d_reg = get_dst_reg(gen, ch, &inst->Dst[0]); spe_move(gen->f, d_reg, tmp_reg); - store_dest_reg(gen, tmp_reg, ch, &inst->FullDstRegisters[0]); + store_dest_reg(gen, tmp_reg, ch, &inst->Dst[0]); } free_itemps(gen); @@ -898,9 +898,9 @@ emit_NRM3(struct codegen *gen, const struct tgsi_full_instruction *inst) int src_reg[3]; int t0_reg = get_itemp(gen), t1_reg = get_itemp(gen); - src_reg[0] = get_src_reg(gen, CHAN_X, &inst->FullSrcRegisters[0]); - src_reg[1] = get_src_reg(gen, CHAN_Y, &inst->FullSrcRegisters[0]); - src_reg[2] = get_src_reg(gen, CHAN_Z, &inst->FullSrcRegisters[0]); + src_reg[0] = get_src_reg(gen, CHAN_X, &inst->Src[0]); + src_reg[1] = get_src_reg(gen, CHAN_Y, &inst->Src[0]); + src_reg[2] = get_src_reg(gen, CHAN_Z, &inst->Src[0]); /* t0 = x * x */ spe_fm(gen->f, t0_reg, src_reg[0], src_reg[0]); @@ -919,10 +919,10 @@ emit_NRM3(struct codegen *gen, const struct tgsi_full_instruction *inst) spe_fi(gen->f, t1_reg, t0_reg, t1_reg); FOR_EACH_ENABLED_CHANNEL(inst, ch) { - int d_reg = get_dst_reg(gen, ch, &inst->FullDstRegisters[0]); + int d_reg = get_dst_reg(gen, ch, &inst->Dst[0]); /* dst = src[ch] * t1 */ spe_fm(gen->f, d_reg, src_reg[ch], t1_reg); - store_dest_reg(gen, d_reg, ch, &inst->FullDstRegisters[0]); + store_dest_reg(gen, d_reg, ch, &inst->Dst[0]); } free_itemps(gen); @@ -936,48 +936,48 @@ emit_NRM3(struct codegen *gen, const struct tgsi_full_instruction *inst) static boolean emit_XPD(struct codegen *gen, const struct tgsi_full_instruction *inst) { - int s1_reg = get_src_reg(gen, CHAN_Z, &inst->FullSrcRegisters[0]); - int s2_reg = get_src_reg(gen, CHAN_Y, &inst->FullSrcRegisters[1]); + int s1_reg = get_src_reg(gen, CHAN_Z, &inst->Src[0]); + int s2_reg = get_src_reg(gen, CHAN_Y, &inst->Src[1]); int tmp_reg = get_itemp(gen); /* t = z0 * y1 */ spe_fm(gen->f, tmp_reg, s1_reg, s2_reg); - s1_reg = get_src_reg(gen, CHAN_Y, &inst->FullSrcRegisters[0]); - s2_reg = get_src_reg(gen, CHAN_Z, &inst->FullSrcRegisters[1]); + s1_reg = get_src_reg(gen, CHAN_Y, &inst->Src[0]); + s2_reg = get_src_reg(gen, CHAN_Z, &inst->Src[1]); /* t = y0 * z1 - t */ spe_fms(gen->f, tmp_reg, s1_reg, s2_reg, tmp_reg); - if (inst->FullDstRegisters[0].DstRegister.WriteMask & (1 << CHAN_X)) { - store_dest_reg(gen, tmp_reg, CHAN_X, &inst->FullDstRegisters[0]); + if (inst->Dst[0].DstRegister.WriteMask & (1 << CHAN_X)) { + store_dest_reg(gen, tmp_reg, CHAN_X, &inst->Dst[0]); } - s1_reg = get_src_reg(gen, CHAN_X, &inst->FullSrcRegisters[0]); - s2_reg = get_src_reg(gen, CHAN_Z, &inst->FullSrcRegisters[1]); + s1_reg = get_src_reg(gen, CHAN_X, &inst->Src[0]); + s2_reg = get_src_reg(gen, CHAN_Z, &inst->Src[1]); /* t = x0 * z1 */ spe_fm(gen->f, tmp_reg, s1_reg, s2_reg); - s1_reg = get_src_reg(gen, CHAN_Z, &inst->FullSrcRegisters[0]); - s2_reg = get_src_reg(gen, CHAN_X, &inst->FullSrcRegisters[1]); + s1_reg = get_src_reg(gen, CHAN_Z, &inst->Src[0]); + s2_reg = get_src_reg(gen, CHAN_X, &inst->Src[1]); /* t = z0 * x1 - t */ spe_fms(gen->f, tmp_reg, s1_reg, s2_reg, tmp_reg); - if (inst->FullDstRegisters[0].DstRegister.WriteMask & (1 << CHAN_Y)) { - store_dest_reg(gen, tmp_reg, CHAN_Y, &inst->FullDstRegisters[0]); + if (inst->Dst[0].DstRegister.WriteMask & (1 << CHAN_Y)) { + store_dest_reg(gen, tmp_reg, CHAN_Y, &inst->Dst[0]); } - s1_reg = get_src_reg(gen, CHAN_Y, &inst->FullSrcRegisters[0]); - s2_reg = get_src_reg(gen, CHAN_X, &inst->FullSrcRegisters[1]); + s1_reg = get_src_reg(gen, CHAN_Y, &inst->Src[0]); + s2_reg = get_src_reg(gen, CHAN_X, &inst->Src[1]); /* t = y0 * x1 */ spe_fm(gen->f, tmp_reg, s1_reg, s2_reg); - s1_reg = get_src_reg(gen, CHAN_X, &inst->FullSrcRegisters[0]); - s2_reg = get_src_reg(gen, CHAN_Y, &inst->FullSrcRegisters[1]); + s1_reg = get_src_reg(gen, CHAN_X, &inst->Src[0]); + s2_reg = get_src_reg(gen, CHAN_Y, &inst->Src[1]); /* t = x0 * y1 - t */ spe_fms(gen->f, tmp_reg, s1_reg, s2_reg, tmp_reg); - if (inst->FullDstRegisters[0].DstRegister.WriteMask & (1 << CHAN_Z)) { - store_dest_reg(gen, tmp_reg, CHAN_Z, &inst->FullDstRegisters[0]); + if (inst->Dst[0].DstRegister.WriteMask & (1 << CHAN_Z)) { + store_dest_reg(gen, tmp_reg, CHAN_Z, &inst->Dst[0]); } free_itemps(gen); @@ -1000,9 +1000,9 @@ emit_inequality(struct codegen *gen, const struct tgsi_full_instruction *inst) one_reg = get_const_one_reg(gen); FOR_EACH_ENABLED_CHANNEL(inst, ch) { - s1_reg[ch] = get_src_reg(gen, ch, &inst->FullSrcRegisters[0]); - s2_reg[ch] = get_src_reg(gen, ch, &inst->FullSrcRegisters[1]); - d_reg[ch] = get_dst_reg(gen, ch, &inst->FullDstRegisters[0]); + s1_reg[ch] = get_src_reg(gen, ch, &inst->Src[0]); + s2_reg[ch] = get_src_reg(gen, ch, &inst->Src[1]); + d_reg[ch] = get_dst_reg(gen, ch, &inst->Dst[0]); } FOR_EACH_ENABLED_CHANNEL(inst, ch) { @@ -1043,7 +1043,7 @@ emit_inequality(struct codegen *gen, const struct tgsi_full_instruction *inst) } FOR_EACH_ENABLED_CHANNEL(inst, ch) { - store_dest_reg(gen, d_reg[ch], ch, &inst->FullDstRegisters[0]); + store_dest_reg(gen, d_reg[ch], ch, &inst->Dst[0]); } free_itemps(gen); @@ -1060,10 +1060,10 @@ emit_CMP(struct codegen *gen, const struct tgsi_full_instruction *inst) int ch; FOR_EACH_ENABLED_CHANNEL(inst, ch) { - int s1_reg = get_src_reg(gen, ch, &inst->FullSrcRegisters[0]); - int s2_reg = get_src_reg(gen, ch, &inst->FullSrcRegisters[1]); - int s3_reg = get_src_reg(gen, ch, &inst->FullSrcRegisters[2]); - int d_reg = get_dst_reg(gen, ch, &inst->FullDstRegisters[0]); + int s1_reg = get_src_reg(gen, ch, &inst->Src[0]); + int s2_reg = get_src_reg(gen, ch, &inst->Src[1]); + int s3_reg = get_src_reg(gen, ch, &inst->Src[2]); + int d_reg = get_dst_reg(gen, ch, &inst->Dst[0]); int zero_reg = get_itemp(gen); spe_zero(gen->f, zero_reg); @@ -1072,7 +1072,7 @@ emit_CMP(struct codegen *gen, const struct tgsi_full_instruction *inst) spe_fcgt(gen->f, d_reg, zero_reg, s1_reg); spe_selb(gen->f, d_reg, s3_reg, s2_reg, d_reg); - store_dest_reg(gen, d_reg, ch, &inst->FullDstRegisters[0]); + store_dest_reg(gen, d_reg, ch, &inst->Dst[0]); free_itemps(gen); } @@ -1090,8 +1090,8 @@ emit_TRUNC(struct codegen *gen, const struct tgsi_full_instruction *inst) int ch, s1_reg[4], d_reg[4]; FOR_EACH_ENABLED_CHANNEL(inst, ch) { - s1_reg[ch] = get_src_reg(gen, ch, &inst->FullSrcRegisters[0]); - d_reg[ch] = get_dst_reg(gen, ch, &inst->FullDstRegisters[0]); + s1_reg[ch] = get_src_reg(gen, ch, &inst->Src[0]); + d_reg[ch] = get_dst_reg(gen, ch, &inst->Dst[0]); } /* Convert float to int */ @@ -1105,7 +1105,7 @@ emit_TRUNC(struct codegen *gen, const struct tgsi_full_instruction *inst) } FOR_EACH_ENABLED_CHANNEL(inst, ch) { - store_dest_reg(gen, d_reg[ch], ch, &inst->FullDstRegisters[0]); + store_dest_reg(gen, d_reg[ch], ch, &inst->Dst[0]); } free_itemps(gen); @@ -1129,8 +1129,8 @@ emit_FLR(struct codegen *gen, const struct tgsi_full_instruction *inst) one_reg = get_const_one_reg(gen); FOR_EACH_ENABLED_CHANNEL(inst, ch) { - s1_reg[ch] = get_src_reg(gen, ch, &inst->FullSrcRegisters[0]); - d_reg[ch] = get_dst_reg(gen, ch, &inst->FullDstRegisters[0]); + s1_reg[ch] = get_src_reg(gen, ch, &inst->Src[0]); + d_reg[ch] = get_dst_reg(gen, ch, &inst->Dst[0]); tmp_reg[ch] = get_itemp(gen); } @@ -1156,7 +1156,7 @@ emit_FLR(struct codegen *gen, const struct tgsi_full_instruction *inst) } FOR_EACH_ENABLED_CHANNEL(inst, ch) { - store_dest_reg(gen, d_reg[ch], ch, &inst->FullDstRegisters[0]); + store_dest_reg(gen, d_reg[ch], ch, &inst->Dst[0]); } free_itemps(gen); @@ -1177,8 +1177,8 @@ emit_FRC(struct codegen *gen, const struct tgsi_full_instruction *inst) one_reg = get_const_one_reg(gen); FOR_EACH_ENABLED_CHANNEL(inst, ch) { - s1_reg[ch] = get_src_reg(gen, ch, &inst->FullSrcRegisters[0]); - d_reg[ch] = get_dst_reg(gen, ch, &inst->FullDstRegisters[0]); + s1_reg[ch] = get_src_reg(gen, ch, &inst->Src[0]); + d_reg[ch] = get_dst_reg(gen, ch, &inst->Dst[0]); tmp_reg[ch] = get_itemp(gen); } @@ -1210,7 +1210,7 @@ emit_FRC(struct codegen *gen, const struct tgsi_full_instruction *inst) /* store result */ FOR_EACH_ENABLED_CHANNEL(inst, ch) { - store_dest_reg(gen, d_reg[ch], ch, &inst->FullDstRegisters[0]); + store_dest_reg(gen, d_reg[ch], ch, &inst->Dst[0]); } free_itemps(gen); @@ -1272,7 +1272,7 @@ emit_function_call(struct codegen *gen, if (scalar) { for (a = 0; a < num_args; a++) { - s_regs[a] = get_src_reg(gen, CHAN_X, &inst->FullSrcRegisters[a]); + s_regs[a] = get_src_reg(gen, CHAN_X, &inst->Src[a]); } /* we'll call the function, put the return value in this register, * then replicate it across all write-enabled components in d_reg. @@ -1287,11 +1287,11 @@ emit_function_call(struct codegen *gen, if (!scalar) { for (a = 0; a < num_args; a++) { - s_regs[a] = get_src_reg(gen, ch, &inst->FullSrcRegisters[a]); + s_regs[a] = get_src_reg(gen, ch, &inst->Src[a]); } } - d_reg = get_dst_reg(gen, ch, &inst->FullDstRegisters[0]); + d_reg = get_dst_reg(gen, ch, &inst->Dst[0]); if (!scalar || !func_called) { /* for a scalar function, we'll really only call the function once */ @@ -1336,7 +1336,7 @@ emit_function_call(struct codegen *gen, spe_move(gen->f, d_reg, retval_reg); } - store_dest_reg(gen, d_reg, ch, &inst->FullDstRegisters[0]); + store_dest_reg(gen, d_reg, ch, &inst->Dst[0]); free_itemps(gen); } @@ -1352,7 +1352,7 @@ static boolean emit_TEX(struct codegen *gen, const struct tgsi_full_instruction *inst) { const uint target = inst->InstructionExtTexture.Texture; - const uint unit = inst->FullSrcRegisters[1].SrcRegister.Index; + const uint unit = inst->Src[1].SrcRegister.Index; uint addr; int ch; int coord_regs[4], d_regs[4]; @@ -1373,14 +1373,14 @@ emit_TEX(struct codegen *gen, const struct tgsi_full_instruction *inst) return FALSE; } - assert(inst->FullSrcRegisters[1].SrcRegister.File == TGSI_FILE_SAMPLER); + assert(inst->Src[1].SrcRegister.File == TGSI_FILE_SAMPLER); spe_comment(gen->f, -4, "CALL tex:"); /* get src/dst reg info */ for (ch = 0; ch < 4; ch++) { - coord_regs[ch] = get_src_reg(gen, ch, &inst->FullSrcRegisters[0]); - d_regs[ch] = get_dst_reg(gen, ch, &inst->FullDstRegisters[0]); + coord_regs[ch] = get_src_reg(gen, ch, &inst->Src[0]); + d_regs[ch] = get_dst_reg(gen, ch, &inst->Dst[0]); } { @@ -1425,7 +1425,7 @@ emit_TEX(struct codegen *gen, const struct tgsi_full_instruction *inst) } FOR_EACH_ENABLED_CHANNEL(inst, ch) { - store_dest_reg(gen, d_regs[ch], ch, &inst->FullDstRegisters[0]); + store_dest_reg(gen, d_regs[ch], ch, &inst->Dst[0]); free_itemps(gen); } @@ -1452,7 +1452,7 @@ emit_KIL(struct codegen *gen, const struct tgsi_full_instruction *inst) /* get src regs */ FOR_EACH_ENABLED_CHANNEL(inst, ch) { - s_regs[ch] = get_src_reg(gen, ch, &inst->FullSrcRegisters[0]); + s_regs[ch] = get_src_reg(gen, ch, &inst->Src[0]); } /* test if any src regs are < 0 */ @@ -1500,9 +1500,9 @@ emit_MIN_MAX(struct codegen *gen, const struct tgsi_full_instruction *inst) int ch, s0_reg[4], s1_reg[4], d_reg[4], tmp_reg[4]; FOR_EACH_ENABLED_CHANNEL(inst, ch) { - s0_reg[ch] = get_src_reg(gen, ch, &inst->FullSrcRegisters[0]); - s1_reg[ch] = get_src_reg(gen, ch, &inst->FullSrcRegisters[1]); - d_reg[ch] = get_dst_reg(gen, ch, &inst->FullDstRegisters[0]); + s0_reg[ch] = get_src_reg(gen, ch, &inst->Src[0]); + s1_reg[ch] = get_src_reg(gen, ch, &inst->Src[1]); + d_reg[ch] = get_dst_reg(gen, ch, &inst->Dst[0]); tmp_reg[ch] = get_itemp(gen); } @@ -1518,7 +1518,7 @@ emit_MIN_MAX(struct codegen *gen, const struct tgsi_full_instruction *inst) } FOR_EACH_ENABLED_CHANNEL(inst, ch) { - store_dest_reg(gen, d_reg[ch], ch, &inst->FullDstRegisters[0]); + store_dest_reg(gen, d_reg[ch], ch, &inst->Dst[0]); } free_itemps(gen); @@ -1575,7 +1575,7 @@ emit_IF(struct codegen *gen, const struct tgsi_full_instruction *inst) /* update conditional execution mask with the predicate register */ int tmp_reg = get_itemp(gen); - int s1_reg = get_src_reg(gen, channel, &inst->FullSrcRegisters[0]); + int s1_reg = get_src_reg(gen, channel, &inst->Src[0]); /* tmp = (s1_reg == 0) */ spe_ceqi(gen->f, tmp_reg, s1_reg, 0); @@ -1699,8 +1699,8 @@ emit_DDX_DDY(struct codegen *gen, const struct tgsi_full_instruction *inst, int ch; FOR_EACH_ENABLED_CHANNEL(inst, ch) { - int s_reg = get_src_reg(gen, ch, &inst->FullSrcRegisters[0]); - int d_reg = get_dst_reg(gen, ch, &inst->FullDstRegisters[0]); + int s_reg = get_src_reg(gen, ch, &inst->Src[0]); + int d_reg = get_dst_reg(gen, ch, &inst->Dst[0]); int t1_reg = get_itemp(gen); int t2_reg = get_itemp(gen); diff --git a/src/gallium/drivers/cell/spu/spu_exec.c b/src/gallium/drivers/cell/spu/spu_exec.c index 4c32b2d06d..8d58c534be 100644 --- a/src/gallium/drivers/cell/spu/spu_exec.c +++ b/src/gallium/drivers/cell/spu/spu_exec.c @@ -108,10 +108,10 @@ for (CHAN = 0; CHAN < 4; CHAN++) #define IS_CHANNEL_ENABLED(INST, CHAN)\ - ((INST).FullDstRegisters[0].DstRegister.WriteMask & (1 << (CHAN))) + ((INST).Dst[0].DstRegister.WriteMask & (1 << (CHAN))) #define IS_CHANNEL_ENABLED2(INST, CHAN)\ - ((INST).FullDstRegisters[1].DstRegister.WriteMask & (1 << (CHAN))) + ((INST).Dst[1].DstRegister.WriteMask & (1 << (CHAN))) #define FOR_EACH_ENABLED_CHANNEL(INST, CHAN)\ FOR_EACH_CHANNEL( CHAN )\ @@ -583,10 +583,10 @@ store_dest( } #define FETCH(VAL,INDEX,CHAN)\ - fetch_source (mach, VAL, &inst->FullSrcRegisters[INDEX], CHAN) + fetch_source (mach, VAL, &inst->Src[INDEX], CHAN) #define STORE(VAL,INDEX,CHAN)\ - store_dest (mach, VAL, &inst->FullDstRegisters[INDEX], inst, CHAN ) + store_dest (mach, VAL, &inst->Dst[INDEX], inst, CHAN ) /** @@ -612,7 +612,7 @@ exec_kil(struct spu_exec_machine *mach, /* unswizzle channel */ swizzle = tgsi_util_get_full_src_register_swizzle ( - &inst->FullSrcRegisters[0], + &inst->Src[0], chan_index); /* check if the component has not been already tested */ @@ -677,7 +677,7 @@ exec_tex(struct spu_exec_machine *mach, const struct tgsi_full_instruction *inst, boolean biasLod, boolean projected) { - const uint unit = inst->FullSrcRegisters[1].SrcRegister.Index; + const uint unit = inst->Src[1].SrcRegister.Index; union spu_exec_channel r[8]; uint chan_index; float lodBias; diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c b/src/gallium/drivers/i915/i915_fpc_translate.c index f2554998a9..9e626c85c0 100644 --- a/src/gallium/drivers/i915/i915_fpc_translate.c +++ b/src/gallium/drivers/i915/i915_fpc_translate.c @@ -276,7 +276,7 @@ static uint get_result_flags(const struct tgsi_full_instruction *inst) { const uint writeMask - = inst->FullDstRegisters[0].DstRegister.WriteMask; + = inst->Dst[0].DstRegister.WriteMask; uint flags = 0x0; if (inst->Instruction.Saturate == TGSI_SAT_ZERO_ONE) @@ -338,14 +338,14 @@ emit_tex(struct i915_fp_compile *p, const struct tgsi_full_instruction *inst, uint opcode) { - uint texture = inst->InstructionTexture.Texture; - uint unit = inst->FullSrcRegisters[1].SrcRegister.Index; + uint texture = inst->Texture.Texture; + uint unit = inst->Src[1].SrcRegister.Index; uint tex = translate_tex_src_target( p, texture ); uint sampler = i915_emit_decl(p, REG_TYPE_S, unit, tex); - uint coord = src_vector( p, &inst->FullSrcRegisters[0]); + uint coord = src_vector( p, &inst->Src[0]); i915_emit_texld( p, - get_result_vector( p, &inst->FullDstRegisters[0] ), + get_result_vector( p, &inst->Dst[0] ), get_result_flags( inst ), sampler, coord, @@ -367,13 +367,13 @@ emit_simple_arith(struct i915_fp_compile *p, assert(numArgs <= 3); - arg1 = (numArgs < 1) ? 0 : src_vector( p, &inst->FullSrcRegisters[0] ); - arg2 = (numArgs < 2) ? 0 : src_vector( p, &inst->FullSrcRegisters[1] ); - arg3 = (numArgs < 3) ? 0 : src_vector( p, &inst->FullSrcRegisters[2] ); + arg1 = (numArgs < 1) ? 0 : src_vector( p, &inst->Src[0] ); + arg2 = (numArgs < 2) ? 0 : src_vector( p, &inst->Src[1] ); + arg3 = (numArgs < 3) ? 0 : src_vector( p, &inst->Src[2] ); i915_emit_arith( p, opcode, - get_result_vector( p, &inst->FullDstRegisters[0]), + get_result_vector( p, &inst->Dst[0]), get_result_flags( inst ), 0, arg1, arg2, @@ -393,8 +393,8 @@ emit_simple_arith_swap2(struct i915_fp_compile *p, /* transpose first two registers */ inst2 = *inst; - inst2.FullSrcRegisters[0] = inst->FullSrcRegisters[1]; - inst2.FullSrcRegisters[1] = inst->FullSrcRegisters[0]; + inst2.Src[0] = inst->Src[1]; + inst2.Src[1] = inst->Src[0]; emit_simple_arith(p, &inst2, opcode, numArgs); } @@ -423,10 +423,10 @@ i915_translate_instruction(struct i915_fp_compile *p, switch (inst->Instruction.Opcode) { case TGSI_OPCODE_ABS: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); + src0 = src_vector(p, &inst->Src[0]); i915_emit_arith(p, A0_MAX, - get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_vector(p, &inst->Dst[0]), get_result_flags(inst), 0, src0, negate(src0, 1, 1, 1, 1), 0); break; @@ -436,17 +436,17 @@ i915_translate_instruction(struct i915_fp_compile *p, break; case TGSI_OPCODE_CMP: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - src1 = src_vector(p, &inst->FullSrcRegisters[1]); - src2 = src_vector(p, &inst->FullSrcRegisters[2]); + src0 = src_vector(p, &inst->Src[0]); + src1 = src_vector(p, &inst->Src[1]); + src2 = src_vector(p, &inst->Src[2]); i915_emit_arith(p, A0_CMP, - get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_vector(p, &inst->Dst[0]), get_result_flags(inst), 0, src0, src2, src1); /* NOTE: order of src2, src1 */ break; case TGSI_OPCODE_COS: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); + src0 = src_vector(p, &inst->Src[0]); tmp = i915_get_utemp(p); i915_emit_arith(p, @@ -489,7 +489,7 @@ i915_translate_instruction(struct i915_fp_compile *p, i915_emit_arith(p, A0_DP4, - get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_vector(p, &inst->Dst[0]), get_result_flags(inst), 0, swizzle(tmp, ONE, Z, Y, X), i915_emit_const4fv(p, cos_constants), 0); @@ -504,19 +504,19 @@ i915_translate_instruction(struct i915_fp_compile *p, break; case TGSI_OPCODE_DPH: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - src1 = src_vector(p, &inst->FullSrcRegisters[1]); + src0 = src_vector(p, &inst->Src[0]); + src1 = src_vector(p, &inst->Src[1]); i915_emit_arith(p, A0_DP4, - get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_vector(p, &inst->Dst[0]), get_result_flags(inst), 0, swizzle(src0, X, Y, Z, ONE), src1, 0); break; case TGSI_OPCODE_DST: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - src1 = src_vector(p, &inst->FullSrcRegisters[1]); + src0 = src_vector(p, &inst->Src[0]); + src1 = src_vector(p, &inst->Src[1]); /* result[0] = 1 * 1; * result[1] = a[1] * b[1]; @@ -525,7 +525,7 @@ i915_translate_instruction(struct i915_fp_compile *p, */ i915_emit_arith(p, A0_MUL, - get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_vector(p, &inst->Dst[0]), get_result_flags(inst), 0, swizzle(src0, ONE, Y, Z, ONE), swizzle(src1, ONE, Y, ONE, W), 0); @@ -536,11 +536,11 @@ i915_translate_instruction(struct i915_fp_compile *p, break; case TGSI_OPCODE_EX2: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); + src0 = src_vector(p, &inst->Src[0]); i915_emit_arith(p, A0_EXP, - get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_vector(p, &inst->Dst[0]), get_result_flags(inst), 0, swizzle(src0, X, X, X, X), 0, 0); break; @@ -555,7 +555,7 @@ i915_translate_instruction(struct i915_fp_compile *p, case TGSI_OPCODE_KIL: /* kill if src[0].x < 0 || src[0].y < 0 ... */ - src0 = src_vector(p, &inst->FullSrcRegisters[0]); + src0 = src_vector(p, &inst->Src[0]); tmp = i915_get_utemp(p); i915_emit_texld(p, @@ -571,17 +571,17 @@ i915_translate_instruction(struct i915_fp_compile *p, break; case TGSI_OPCODE_LG2: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); + src0 = src_vector(p, &inst->Src[0]); i915_emit_arith(p, A0_LOG, - get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_vector(p, &inst->Dst[0]), get_result_flags(inst), 0, swizzle(src0, X, X, X, X), 0, 0); break; case TGSI_OPCODE_LIT: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); + src0 = src_vector(p, &inst->Src[0]); tmp = i915_get_utemp(p); /* tmp = max( a.xyzw, a.00zw ) @@ -605,7 +605,7 @@ i915_translate_instruction(struct i915_fp_compile *p, swizzle(tmp, Y, Y, Y, Y), 0, 0); i915_emit_arith(p, A0_CMP, - get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_vector(p, &inst->Dst[0]), get_result_flags(inst), 0, negate(swizzle(tmp, ONE, ONE, X, ONE), 0, 0, 1, 0), swizzle(tmp, ONE, X, ZERO, ONE), @@ -614,9 +614,9 @@ i915_translate_instruction(struct i915_fp_compile *p, break; case TGSI_OPCODE_LRP: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - src1 = src_vector(p, &inst->FullSrcRegisters[1]); - src2 = src_vector(p, &inst->FullSrcRegisters[2]); + src0 = src_vector(p, &inst->Src[0]); + src1 = src_vector(p, &inst->Src[1]); + src2 = src_vector(p, &inst->Src[2]); flags = get_result_flags(inst); tmp = i915_get_utemp(p); @@ -631,7 +631,7 @@ i915_translate_instruction(struct i915_fp_compile *p, flags & A0_DEST_CHANNEL_ALL, 0, src1, src0, src2); i915_emit_arith(p, A0_MAD, - get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_vector(p, &inst->Dst[0]), flags, 0, negate(src2, 1, 1, 1, 1), src0, tmp); break; @@ -644,8 +644,8 @@ i915_translate_instruction(struct i915_fp_compile *p, break; case TGSI_OPCODE_MIN: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - src1 = src_vector(p, &inst->FullSrcRegisters[1]); + src0 = src_vector(p, &inst->Src[0]); + src1 = src_vector(p, &inst->Src[1]); tmp = i915_get_utemp(p); flags = get_result_flags(inst); @@ -657,7 +657,7 @@ i915_translate_instruction(struct i915_fp_compile *p, i915_emit_arith(p, A0_MOV, - get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_vector(p, &inst->Dst[0]), flags, 0, negate(tmp, 1, 1, 1, 1), 0, 0); break; @@ -670,8 +670,8 @@ i915_translate_instruction(struct i915_fp_compile *p, break; case TGSI_OPCODE_POW: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - src1 = src_vector(p, &inst->FullSrcRegisters[1]); + src0 = src_vector(p, &inst->Src[0]); + src1 = src_vector(p, &inst->Src[1]); tmp = i915_get_utemp(p); flags = get_result_flags(inst); @@ -686,7 +686,7 @@ i915_translate_instruction(struct i915_fp_compile *p, i915_emit_arith(p, A0_EXP, - get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_vector(p, &inst->Dst[0]), flags, 0, swizzle(tmp, X, X, X, X), 0, 0); break; @@ -695,27 +695,27 @@ i915_translate_instruction(struct i915_fp_compile *p, break; case TGSI_OPCODE_RCP: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); + src0 = src_vector(p, &inst->Src[0]); i915_emit_arith(p, A0_RCP, - get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_vector(p, &inst->Dst[0]), get_result_flags(inst), 0, swizzle(src0, X, X, X, X), 0, 0); break; case TGSI_OPCODE_RSQ: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); + src0 = src_vector(p, &inst->Src[0]); i915_emit_arith(p, A0_RSQ, - get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_vector(p, &inst->Dst[0]), get_result_flags(inst), 0, swizzle(src0, X, X, X, X), 0, 0); break; case TGSI_OPCODE_SCS: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); + src0 = src_vector(p, &inst->Src[0]); tmp = i915_get_utemp(p); /* @@ -738,7 +738,7 @@ i915_translate_instruction(struct i915_fp_compile *p, swizzle(tmp, X, Y, X, Y), swizzle(tmp, X, X, ONE, ONE), 0); - writemask = inst->FullDstRegisters[0].DstRegister.WriteMask; + writemask = inst->Dst[0].DstRegister.WriteMask; if (writemask & TGSI_WRITEMASK_Y) { uint tmp1; @@ -756,7 +756,7 @@ i915_translate_instruction(struct i915_fp_compile *p, i915_emit_arith(p, A0_DP4, - get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_vector(p, &inst->Dst[0]), A0_DEST_CHANNEL_Y, 0, swizzle(tmp1, W, Z, Y, X), i915_emit_const4fv(p, sin_constants), 0); @@ -771,7 +771,7 @@ i915_translate_instruction(struct i915_fp_compile *p, i915_emit_arith(p, A0_DP4, - get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_vector(p, &inst->Dst[0]), A0_DEST_CHANNEL_X, 0, swizzle(tmp, ONE, Z, Y, X), i915_emit_const4fv(p, cos_constants), 0); @@ -788,7 +788,7 @@ i915_translate_instruction(struct i915_fp_compile *p, break; case TGSI_OPCODE_SIN: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); + src0 = src_vector(p, &inst->Src[0]); tmp = i915_get_utemp(p); i915_emit_arith(p, @@ -831,7 +831,7 @@ i915_translate_instruction(struct i915_fp_compile *p, i915_emit_arith(p, A0_DP4, - get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_vector(p, &inst->Dst[0]), get_result_flags(inst), 0, swizzle(tmp, W, Z, Y, X), i915_emit_const4fv(p, sin_constants), 0); @@ -847,12 +847,12 @@ i915_translate_instruction(struct i915_fp_compile *p, break; case TGSI_OPCODE_SUB: - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - src1 = src_vector(p, &inst->FullSrcRegisters[1]); + src0 = src_vector(p, &inst->Src[0]); + src1 = src_vector(p, &inst->Src[1]); i915_emit_arith(p, A0_ADD, - get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_vector(p, &inst->Dst[0]), get_result_flags(inst), 0, src0, negate(src1, 1, 1, 1, 1), 0); break; @@ -876,8 +876,8 @@ i915_translate_instruction(struct i915_fp_compile *p, * result.z = src0.x * src1.y - src0.y * src1.x; * result.w = undef; */ - src0 = src_vector(p, &inst->FullSrcRegisters[0]); - src1 = src_vector(p, &inst->FullSrcRegisters[1]); + src0 = src_vector(p, &inst->Src[0]); + src1 = src_vector(p, &inst->Src[1]); tmp = i915_get_utemp(p); i915_emit_arith(p, @@ -888,7 +888,7 @@ i915_translate_instruction(struct i915_fp_compile *p, i915_emit_arith(p, A0_MAD, - get_result_vector(p, &inst->FullDstRegisters[0]), + get_result_vector(p, &inst->Dst[0]), get_result_flags(inst), 0, swizzle(src0, Y, Z, X, ONE), swizzle(src1, Z, X, Y, ONE), diff --git a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c index b2234ef679..893e665e69 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c @@ -64,7 +64,7 @@ for (CHAN = 0; CHAN < NUM_CHANNELS; CHAN++) #define IS_DST0_CHANNEL_ENABLED( INST, CHAN )\ - ((INST)->FullDstRegisters[0].DstRegister.WriteMask & (1 << (CHAN))) + ((INST)->Dst[0].DstRegister.WriteMask & (1 << (CHAN))) #define IF_IS_DST0_CHANNEL_ENABLED( INST, CHAN )\ if (IS_DST0_CHANNEL_ENABLED( INST, CHAN )) @@ -157,7 +157,7 @@ emit_fetch( unsigned index, const unsigned chan_index ) { - const struct tgsi_full_src_register *reg = &inst->FullSrcRegisters[index]; + const struct tgsi_full_src_register *reg = &inst->Src[index]; unsigned swizzle = tgsi_util_get_full_src_register_swizzle( reg, chan_index ); LLVMValueRef res; @@ -267,7 +267,7 @@ emit_store( unsigned chan_index, LLVMValueRef value) { - const struct tgsi_full_dst_register *reg = &inst->FullDstRegisters[index]; + const struct tgsi_full_dst_register *reg = &inst->Dst[index]; switch( inst->Instruction.Saturate ) { case TGSI_SAT_NONE: @@ -319,14 +319,14 @@ emit_tex( struct lp_build_tgsi_soa_context *bld, boolean projected, LLVMValueRef *texel) { - const uint unit = inst->FullSrcRegisters[1].SrcRegister.Index; + const uint unit = inst->Src[1].SrcRegister.Index; LLVMValueRef lodbias; LLVMValueRef oow; LLVMValueRef coords[3]; unsigned num_coords; unsigned i; - switch (inst->InstructionTexture.Texture) { + switch (inst->Texture.Texture) { case TGSI_TEXTURE_1D: num_coords = 1; break; @@ -375,7 +375,7 @@ emit_kil( struct lp_build_tgsi_soa_context *bld, const struct tgsi_full_instruction *inst ) { - const struct tgsi_full_src_register *reg = &inst->FullSrcRegisters[0]; + const struct tgsi_full_src_register *reg = &inst->Src[0]; LLVMValueRef terms[NUM_CHANNELS]; LLVMValueRef mask; unsigned chan_index; @@ -423,13 +423,13 @@ indirect_temp_reference(const struct tgsi_full_instruction *inst) { uint i; for (i = 0; i < inst->Instruction.NumSrcRegs; i++) { - const struct tgsi_full_src_register *reg = &inst->FullSrcRegisters[i]; + const struct tgsi_full_src_register *reg = &inst->Src[i]; if (reg->SrcRegister.File == TGSI_FILE_TEMPORARY && reg->SrcRegister.Indirect) return TRUE; } for (i = 0; i < inst->Instruction.NumDstRegs; i++) { - const struct tgsi_full_dst_register *reg = &inst->FullDstRegisters[i]; + const struct tgsi_full_dst_register *reg = &inst->Dst[i]; if (reg->DstRegister.File == TGSI_FILE_TEMPORARY && reg->DstRegister.Indirect) return TRUE; diff --git a/src/gallium/drivers/nv20/nv20_vertprog.c b/src/gallium/drivers/nv20/nv20_vertprog.c index cd76910744..e82a23d475 100644 --- a/src/gallium/drivers/nv20/nv20_vertprog.c +++ b/src/gallium/drivers/nv20/nv20_vertprog.c @@ -334,7 +334,7 @@ nv20_vertprog_parse_instruction(struct nv20_vpc *vpc, for (i = 0; i < finst->Instruction.NumSrcRegs; i++) { const struct tgsi_full_src_register *fsrc; - fsrc = &finst->FullSrcRegisters[i]; + fsrc = &finst->Src[i]; if (fsrc->SrcRegister.File == TGSI_FILE_TEMPORARY) { src[i] = tgsi_src(vpc, fsrc); } @@ -343,7 +343,7 @@ nv20_vertprog_parse_instruction(struct nv20_vpc *vpc, for (i = 0; i < finst->Instruction.NumSrcRegs; i++) { const struct tgsi_full_src_register *fsrc; - fsrc = &finst->FullSrcRegisters[i]; + fsrc = &finst->Src[i]; switch (fsrc->SrcRegister.File) { case TGSI_FILE_INPUT: if (ai == -1 || ai == fsrc->SrcRegister.Index) { @@ -378,8 +378,8 @@ nv20_vertprog_parse_instruction(struct nv20_vpc *vpc, } } - dst = tgsi_dst(vpc, &finst->FullDstRegisters[0]); - mask = tgsi_mask(finst->FullDstRegisters[0].DstRegister.WriteMask); + dst = tgsi_dst(vpc, &finst->Dst[0]); + mask = tgsi_mask(finst->Dst[0].DstRegister.WriteMask); switch (finst->Instruction.Opcode) { case TGSI_OPCODE_ABS: diff --git a/src/gallium/drivers/nv30/nv30_fragprog.c b/src/gallium/drivers/nv30/nv30_fragprog.c index acf216bb61..dfffeb3263 100644 --- a/src/gallium/drivers/nv30/nv30_fragprog.c +++ b/src/gallium/drivers/nv30/nv30_fragprog.c @@ -363,7 +363,7 @@ nv30_fragprog_parse_instruction(struct nv30_fpc *fpc, for (i = 0; i < finst->Instruction.NumSrcRegs; i++) { const struct tgsi_full_src_register *fsrc; - fsrc = &finst->FullSrcRegisters[i]; + fsrc = &finst->Src[i]; if (fsrc->SrcRegister.File == TGSI_FILE_TEMPORARY) { src[i] = tgsi_src(fpc, fsrc); } @@ -372,7 +372,7 @@ nv30_fragprog_parse_instruction(struct nv30_fpc *fpc, for (i = 0; i < finst->Instruction.NumSrcRegs; i++) { const struct tgsi_full_src_register *fsrc; - fsrc = &finst->FullSrcRegisters[i]; + fsrc = &finst->Src[i]; switch (fsrc->SrcRegister.File) { case TGSI_FILE_INPUT: @@ -423,8 +423,8 @@ nv30_fragprog_parse_instruction(struct nv30_fpc *fpc, } } - dst = tgsi_dst(fpc, &finst->FullDstRegisters[0]); - mask = tgsi_mask(finst->FullDstRegisters[0].DstRegister.WriteMask); + dst = tgsi_dst(fpc, &finst->Dst[0]); + mask = tgsi_mask(finst->Dst[0].DstRegister.WriteMask); sat = (finst->Instruction.Saturate == TGSI_SAT_ZERO_ONE); switch (finst->Instruction.Opcode) { diff --git a/src/gallium/drivers/nv30/nv30_vertprog.c b/src/gallium/drivers/nv30/nv30_vertprog.c index e8fba8ab16..41bd45ad29 100644 --- a/src/gallium/drivers/nv30/nv30_vertprog.c +++ b/src/gallium/drivers/nv30/nv30_vertprog.c @@ -334,7 +334,7 @@ nv30_vertprog_parse_instruction(struct nv30_vpc *vpc, for (i = 0; i < finst->Instruction.NumSrcRegs; i++) { const struct tgsi_full_src_register *fsrc; - fsrc = &finst->FullSrcRegisters[i]; + fsrc = &finst->Src[i]; if (fsrc->SrcRegister.File == TGSI_FILE_TEMPORARY) { src[i] = tgsi_src(vpc, fsrc); } @@ -343,7 +343,7 @@ nv30_vertprog_parse_instruction(struct nv30_vpc *vpc, for (i = 0; i < finst->Instruction.NumSrcRegs; i++) { const struct tgsi_full_src_register *fsrc; - fsrc = &finst->FullSrcRegisters[i]; + fsrc = &finst->Src[i]; switch (fsrc->SrcRegister.File) { case TGSI_FILE_INPUT: if (ai == -1 || ai == fsrc->SrcRegister.Index) { @@ -378,8 +378,8 @@ nv30_vertprog_parse_instruction(struct nv30_vpc *vpc, } } - dst = tgsi_dst(vpc, &finst->FullDstRegisters[0]); - mask = tgsi_mask(finst->FullDstRegisters[0].DstRegister.WriteMask); + dst = tgsi_dst(vpc, &finst->Dst[0]); + mask = tgsi_mask(finst->Dst[0].DstRegister.WriteMask); switch (finst->Instruction.Opcode) { case TGSI_OPCODE_ABS: diff --git a/src/gallium/drivers/nv40/nv40_fragprog.c b/src/gallium/drivers/nv40/nv40_fragprog.c index ca6a957fc1..6addc45247 100644 --- a/src/gallium/drivers/nv40/nv40_fragprog.c +++ b/src/gallium/drivers/nv40/nv40_fragprog.c @@ -364,7 +364,7 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc, for (i = 0; i < finst->Instruction.NumSrcRegs; i++) { const struct tgsi_full_src_register *fsrc; - fsrc = &finst->FullSrcRegisters[i]; + fsrc = &finst->Src[i]; if (fsrc->SrcRegister.File == TGSI_FILE_TEMPORARY) { src[i] = tgsi_src(fpc, fsrc); } @@ -373,7 +373,7 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc, for (i = 0; i < finst->Instruction.NumSrcRegs; i++) { const struct tgsi_full_src_register *fsrc; - fsrc = &finst->FullSrcRegisters[i]; + fsrc = &finst->Src[i]; switch (fsrc->SrcRegister.File) { case TGSI_FILE_INPUT: @@ -433,8 +433,8 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc, } } - dst = tgsi_dst(fpc, &finst->FullDstRegisters[0]); - mask = tgsi_mask(finst->FullDstRegisters[0].DstRegister.WriteMask); + dst = tgsi_dst(fpc, &finst->Dst[0]); + mask = tgsi_mask(finst->Dst[0].DstRegister.WriteMask); sat = (finst->Instruction.Saturate == TGSI_SAT_ZERO_ONE); switch (finst->Instruction.Opcode) { diff --git a/src/gallium/drivers/nv40/nv40_vertprog.c b/src/gallium/drivers/nv40/nv40_vertprog.c index ed0f1d857d..0cdc511166 100644 --- a/src/gallium/drivers/nv40/nv40_vertprog.c +++ b/src/gallium/drivers/nv40/nv40_vertprog.c @@ -405,7 +405,7 @@ nv40_vertprog_parse_instruction(struct nv40_vpc *vpc, for (i = 0; i < finst->Instruction.NumSrcRegs; i++) { const struct tgsi_full_src_register *fsrc; - fsrc = &finst->FullSrcRegisters[i]; + fsrc = &finst->Src[i]; if (fsrc->SrcRegister.File == TGSI_FILE_TEMPORARY) { src[i] = tgsi_src(vpc, fsrc); } @@ -414,7 +414,7 @@ nv40_vertprog_parse_instruction(struct nv40_vpc *vpc, for (i = 0; i < finst->Instruction.NumSrcRegs; i++) { const struct tgsi_full_src_register *fsrc; - fsrc = &finst->FullSrcRegisters[i]; + fsrc = &finst->Src[i]; switch (fsrc->SrcRegister.File) { case TGSI_FILE_INPUT: @@ -469,8 +469,8 @@ nv40_vertprog_parse_instruction(struct nv40_vpc *vpc, } } - dst = tgsi_dst(vpc, &finst->FullDstRegisters[0]); - mask = tgsi_mask(finst->FullDstRegisters[0].DstRegister.WriteMask); + dst = tgsi_dst(vpc, &finst->Dst[0]); + mask = tgsi_mask(finst->Dst[0].DstRegister.WriteMask); switch (finst->Instruction.Opcode) { case TGSI_OPCODE_ABS: @@ -681,7 +681,7 @@ nv40_vertprog_prepare(struct nv40_vpc *vpc) const struct tgsi_full_dst_register *fdst; finst = &p.FullToken.FullInstruction; - fdst = &finst->FullDstRegisters[0]; + fdst = &finst->Dst[0]; if (fdst->DstRegister.File == TGSI_FILE_ADDRESS) { if (fdst->DstRegister.Index > high_addr) diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 00518af8c0..9fbf918601 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -1535,10 +1535,10 @@ negate_supported(const struct tgsi_full_instruction *insn, int i) for (s = 0; s < insn->Instruction.NumSrcRegs; ++s) { if (s == i) continue; - if ((insn->FullSrcRegisters[s].SrcRegister.Index == - insn->FullSrcRegisters[i].SrcRegister.Index) && - (insn->FullSrcRegisters[s].SrcRegister.File == - insn->FullSrcRegisters[i].SrcRegister.File)) + if ((insn->Src[s].SrcRegister.Index == + insn->Src[i].SrcRegister.Index) && + (insn->Src[s].SrcRegister.File == + insn->Src[i].SrcRegister.File)) return FALSE; } @@ -1549,7 +1549,7 @@ negate_supported(const struct tgsi_full_instruction *insn, int i) static unsigned nv50_tgsi_src_mask(const struct tgsi_full_instruction *insn, int c) { - unsigned x, mask = insn->FullDstRegisters[0].DstRegister.WriteMask; + unsigned x, mask = insn->Dst[0].DstRegister.WriteMask; switch (insn->Instruction.Opcode) { case TGSI_OPCODE_COS: @@ -1578,7 +1578,7 @@ nv50_tgsi_src_mask(const struct tgsi_full_instruction *insn, int c) const struct tgsi_instruction_texture *tex; assert(insn->Instruction.Texture); - tex = &insn->InstructionTexture; + tex = &insn->Texture; mask = 0x7; if (insn->Instruction.Opcode == TGSI_OPCODE_TXP) @@ -1850,21 +1850,21 @@ nv50_program_tx_insn(struct nv50_pc *pc, unsigned mask, sat, unit; int i, c; - mask = inst->FullDstRegisters[0].DstRegister.WriteMask; + mask = inst->Dst[0].DstRegister.WriteMask; sat = inst->Instruction.Saturate == TGSI_SAT_ZERO_ONE; memset(src, 0, sizeof(src)); for (c = 0; c < 4; c++) { if ((mask & (1 << c)) && !pc->r_dst[c]) - dst[c] = tgsi_dst(pc, c, &inst->FullDstRegisters[0]); + dst[c] = tgsi_dst(pc, c, &inst->Dst[0]); else dst[c] = pc->r_dst[c]; rdst[c] = dst[c]; } for (i = 0; i < inst->Instruction.NumSrcRegs; i++) { - const struct tgsi_full_src_register *fs = &inst->FullSrcRegisters[i]; + const struct tgsi_full_src_register *fs = &inst->Src[i]; unsigned src_mask; boolean neg_supp; @@ -2181,11 +2181,11 @@ nv50_program_tx_insn(struct nv50_pc *pc, break; case TGSI_OPCODE_TEX: emit_tex(pc, dst, mask, src[0], unit, - inst->InstructionTexture.Texture, FALSE); + inst->Texture.Texture, FALSE); break; case TGSI_OPCODE_TXP: emit_tex(pc, dst, mask, src[0], unit, - inst->InstructionTexture.Texture, TRUE); + inst->Texture.Texture, TRUE); break; case TGSI_OPCODE_TRUNC: for (c = 0; c < 4; c++) { @@ -2264,7 +2264,7 @@ prep_inspect_insn(struct nv50_pc *pc, const struct tgsi_full_instruction *insn) const struct tgsi_dst_register *dst; unsigned i, c, k, mask; - dst = &insn->FullDstRegisters[0].DstRegister; + dst = &insn->Dst[0].DstRegister; mask = dst->WriteMask; if (dst->File == TGSI_FILE_TEMPORARY) @@ -2282,7 +2282,7 @@ prep_inspect_insn(struct nv50_pc *pc, const struct tgsi_full_instruction *insn) } for (i = 0; i < insn->Instruction.NumSrcRegs; i++) { - src = &insn->FullSrcRegisters[i]; + src = &insn->Src[i]; if (src->SrcRegister.File == TGSI_FILE_TEMPORARY) reg = pc->temp; @@ -2379,7 +2379,7 @@ static unsigned nv50_tgsi_scan_swizzle(const struct tgsi_full_instruction *insn, unsigned rdep[4]) { - const struct tgsi_full_dst_register *fd = &insn->FullDstRegisters[0]; + const struct tgsi_full_dst_register *fd = &insn->Dst[0]; const struct tgsi_full_src_register *fs; unsigned i, deqs = 0; @@ -2390,7 +2390,7 @@ nv50_tgsi_scan_swizzle(const struct tgsi_full_instruction *insn, unsigned chn, mask = nv50_tgsi_src_mask(insn, i); boolean neg_supp = negate_supported(insn, i); - fs = &insn->FullSrcRegisters[i]; + fs = &insn->Src[i]; if (fs->SrcRegister.File != fd->DstRegister.File || fs->SrcRegister.Index != fd->DstRegister.Index) continue; @@ -2427,7 +2427,7 @@ nv50_tgsi_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) const struct tgsi_full_dst_register *fd; unsigned i, deqs, rdep[4], m[4]; - fd = &tok->FullInstruction.FullDstRegisters[0]; + fd = &tok->FullInstruction.Dst[0]; deqs = nv50_tgsi_scan_swizzle(&insn, rdep); if (is_scalar_op(insn.Instruction.Opcode)) { @@ -2446,10 +2446,10 @@ nv50_tgsi_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) for (i = 0; i < 4; ++i) { assert(pc->r_dst[m[i]] == NULL); - insn.FullDstRegisters[0].DstRegister.WriteMask = + insn.Dst[0].DstRegister.WriteMask = fd->DstRegister.WriteMask & (1 << m[i]); - if (!insn.FullDstRegisters[0].DstRegister.WriteMask) + if (!insn.Dst[0].DstRegister.WriteMask) continue; if (deqs & (1 << i)) diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/src/gallium/drivers/r300/r300_tgsi_to_rc.c index 25a634e5a2..82466e245a 100644 --- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c +++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c @@ -258,18 +258,18 @@ static void transform_instruction(struct tgsi_to_rc * ttr, struct tgsi_full_inst dst->U.I.SaturateMode = translate_saturate(src->Instruction.Saturate); if (src->Instruction.NumDstRegs) - transform_dstreg(ttr, &dst->U.I.DstReg, &src->FullDstRegisters[0]); + transform_dstreg(ttr, &dst->U.I.DstReg, &src->Dst[0]); for(i = 0; i < src->Instruction.NumSrcRegs; ++i) { - if (src->FullSrcRegisters[i].SrcRegister.File == TGSI_FILE_SAMPLER) - dst->U.I.TexSrcUnit = src->FullSrcRegisters[i].SrcRegister.Index; + if (src->Src[i].SrcRegister.File == TGSI_FILE_SAMPLER) + dst->U.I.TexSrcUnit = src->Src[i].SrcRegister.Index; else - transform_srcreg(ttr, &dst->U.I.SrcReg[i], &src->FullSrcRegisters[i]); + transform_srcreg(ttr, &dst->U.I.SrcReg[i], &src->Src[i]); } /* Texturing. */ if (src->Instruction.Texture) - transform_texture(dst, src->InstructionTexture); + transform_texture(dst, src->Texture); } static void handle_immediate(struct tgsi_to_rc * ttr, struct tgsi_full_immediate * imm) diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c b/src/gallium/drivers/svga/svga_tgsi_insn.c index 3ef6cb1074..39fd7a6025 100644 --- a/src/gallium/drivers/svga/svga_tgsi_insn.c +++ b/src/gallium/drivers/svga/svga_tgsi_insn.c @@ -96,7 +96,7 @@ translate_dst_register( struct svga_shader_emitter *emit, const struct tgsi_full_instruction *insn, unsigned idx ) { - const struct tgsi_full_dst_register *reg = &insn->FullDstRegisters[idx]; + const struct tgsi_full_dst_register *reg = &insn->Dst[idx]; SVGA3dShaderDestToken dest; switch (reg->DstRegister.File) { @@ -629,7 +629,7 @@ static boolean emit_fake_arl(struct svga_shader_emitter *emit, const struct tgsi_full_instruction *insn) { const struct src_register src0 = translate_src_register( - emit, &insn->FullSrcRegisters[0] ); + emit, &insn->Src[0] ); struct src_register src1 = get_fake_arl_const( emit ); SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); SVGA3dShaderDestToken tmp = get_temp( emit ); @@ -653,7 +653,7 @@ static boolean emit_if(struct svga_shader_emitter *emit, const struct tgsi_full_instruction *insn) { const struct src_register src = translate_src_register( - emit, &insn->FullSrcRegisters[0] ); + emit, &insn->Src[0] ); struct src_register zero = get_zero_immediate( emit ); SVGA3dShaderInstToken if_token = inst_token( SVGA3DOP_IFC ); @@ -690,7 +690,7 @@ static boolean emit_floor(struct svga_shader_emitter *emit, { SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); const struct src_register src0 = translate_src_register( - emit, &insn->FullSrcRegisters[0] ); + emit, &insn->Src[0] ); SVGA3dShaderDestToken temp = get_temp( emit ); /* FRC TMP, SRC */ @@ -716,11 +716,11 @@ static boolean emit_cmp(struct svga_shader_emitter *emit, { SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); const struct src_register src0 = translate_src_register( - emit, &insn->FullSrcRegisters[0] ); + emit, &insn->Src[0] ); const struct src_register src1 = translate_src_register( - emit, &insn->FullSrcRegisters[1] ); + emit, &insn->Src[1] ); const struct src_register src2 = translate_src_register( - emit, &insn->FullSrcRegisters[2] ); + emit, &insn->Src[2] ); /* CMP DST, SRC0, SRC2, SRC1 */ return submit_op3( emit, inst_token( SVGA3DOP_CMP ), dst, src0, src2, src1); @@ -740,9 +740,9 @@ static boolean emit_div(struct svga_shader_emitter *emit, { SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); const struct src_register src0 = translate_src_register( - emit, &insn->FullSrcRegisters[0] ); + emit, &insn->Src[0] ); const struct src_register src1 = translate_src_register( - emit, &insn->FullSrcRegisters[1] ); + emit, &insn->Src[1] ); SVGA3dShaderDestToken temp = get_temp( emit ); int i; @@ -782,9 +782,9 @@ static boolean emit_dp2(struct svga_shader_emitter *emit, { SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); const struct src_register src0 = translate_src_register( - emit, &insn->FullSrcRegisters[0] ); + emit, &insn->Src[0] ); const struct src_register src1 = translate_src_register( - emit, &insn->FullSrcRegisters[1] ); + emit, &insn->Src[1] ); SVGA3dShaderDestToken temp = get_temp( emit ); struct src_register temp_src0, temp_src1; @@ -815,9 +815,9 @@ static boolean emit_dph(struct svga_shader_emitter *emit, { SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); const struct src_register src0 = translate_src_register( - emit, &insn->FullSrcRegisters[0] ); + emit, &insn->Src[0] ); struct src_register src1 = translate_src_register( - emit, &insn->FullSrcRegisters[1] ); + emit, &insn->Src[1] ); SVGA3dShaderDestToken temp = get_temp( emit ); /* DP3 TMP, SRC1, SRC2 */ @@ -846,7 +846,7 @@ static boolean emit_nrm(struct svga_shader_emitter *emit, { SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); const struct src_register src0 = translate_src_register( - emit, &insn->FullSrcRegisters[0] ); + emit, &insn->Src[0] ); SVGA3dShaderDestToken temp = get_temp( emit ); /* DP3 TMP, SRC, SRC */ @@ -889,7 +889,7 @@ static boolean emit_sincos(struct svga_shader_emitter *emit, { SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); struct src_register src0 = translate_src_register( - emit, &insn->FullSrcRegisters[0] ); + emit, &insn->Src[0] ); SVGA3dShaderDestToken temp = get_temp( emit ); /* SCS TMP SRC */ @@ -912,7 +912,7 @@ static boolean emit_sin(struct svga_shader_emitter *emit, { SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); struct src_register src0 = translate_src_register( - emit, &insn->FullSrcRegisters[0] ); + emit, &insn->Src[0] ); SVGA3dShaderDestToken temp = get_temp( emit ); /* SCS TMP SRC */ @@ -937,7 +937,7 @@ static boolean emit_cos(struct svga_shader_emitter *emit, { SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); struct src_register src0 = translate_src_register( - emit, &insn->FullSrcRegisters[0] ); + emit, &insn->Src[0] ); SVGA3dShaderDestToken temp = get_temp( emit ); /* SCS TMP SRC */ @@ -962,9 +962,9 @@ static boolean emit_sub(struct svga_shader_emitter *emit, { SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); struct src_register src0 = translate_src_register( - emit, &insn->FullSrcRegisters[0] ); + emit, &insn->Src[0] ); struct src_register src1 = translate_src_register( - emit, &insn->FullSrcRegisters[1] ); + emit, &insn->Src[1] ); src1 = negate(src1); @@ -980,7 +980,7 @@ static boolean emit_kil(struct svga_shader_emitter *emit, const struct tgsi_full_instruction *insn ) { SVGA3dShaderInstToken inst; - const struct tgsi_full_src_register *reg = &insn->FullSrcRegisters[0]; + const struct tgsi_full_src_register *reg = &insn->Src[0]; struct src_register src0; inst = inst_token( SVGA3DOP_TEXKILL ); @@ -1154,9 +1154,9 @@ static boolean emit_select_op(struct svga_shader_emitter *emit, { SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); struct src_register src0 = translate_src_register( - emit, &insn->FullSrcRegisters[0] ); + emit, &insn->Src[0] ); struct src_register src1 = translate_src_register( - emit, &insn->FullSrcRegisters[1] ); + emit, &insn->Src[1] ); return emit_select( emit, compare, dst, src0, src1 ); } @@ -1189,8 +1189,8 @@ static boolean emit_tex2(struct svga_shader_emitter *emit, return FALSE; } - src0 = translate_src_register( emit, &insn->FullSrcRegisters[0] ); - src1 = translate_src_register( emit, &insn->FullSrcRegisters[1] ); + src0 = translate_src_register( emit, &insn->Src[0] ); + src1 = translate_src_register( emit, &insn->Src[1] ); if (emit->key.fkey.tex[src1.base.num].unnormalized) { struct src_register wh = get_tex_dimensions( emit, src1.base.num ); @@ -1231,9 +1231,9 @@ static boolean emit_tex3(struct svga_shader_emitter *emit, break; } - src0 = translate_src_register( emit, &insn->FullSrcRegisters[0] ); - src1 = translate_src_register( emit, &insn->FullSrcRegisters[1] ); - src2 = translate_src_register( emit, &insn->FullSrcRegisters[2] ); + src0 = translate_src_register( emit, &insn->Src[0] ); + src1 = translate_src_register( emit, &insn->Src[1] ); + src2 = translate_src_register( emit, &insn->Src[2] ); return submit_op3( emit, inst, dst, src0, src1, src2 ); } @@ -1245,9 +1245,9 @@ static boolean emit_tex(struct svga_shader_emitter *emit, SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); struct src_register src0 = - translate_src_register( emit, &insn->FullSrcRegisters[0] ); + translate_src_register( emit, &insn->Src[0] ); struct src_register src1 = - translate_src_register( emit, &insn->FullSrcRegisters[1] ); + translate_src_register( emit, &insn->Src[1] ); SVGA3dShaderDestToken tex_result; @@ -1359,7 +1359,7 @@ static boolean emit_scalar_op1( struct svga_shader_emitter *emit, inst = inst_token( opcode ); dst = translate_dst_register( emit, insn, 0 ); - src = translate_src_register( emit, &insn->FullSrcRegisters[0] ); + src = translate_src_register( emit, &insn->Src[0] ); src = scalar( src, TGSI_SWIZZLE_X ); return submit_op1( emit, inst, dst, src ); @@ -1370,7 +1370,7 @@ static boolean emit_simple_instruction(struct svga_shader_emitter *emit, unsigned opcode, const struct tgsi_full_instruction *insn ) { - const struct tgsi_full_src_register *src = insn->FullSrcRegisters; + const struct tgsi_full_src_register *src = insn->Src; SVGA3dShaderInstToken inst; SVGA3dShaderDestToken dst; @@ -1428,13 +1428,13 @@ static boolean emit_pow(struct svga_shader_emitter *emit, { SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); struct src_register src0 = translate_src_register( - emit, &insn->FullSrcRegisters[0] ); + emit, &insn->Src[0] ); struct src_register src1 = translate_src_register( - emit, &insn->FullSrcRegisters[1] ); + emit, &insn->Src[1] ); boolean need_tmp = FALSE; /* POW can only output to a temporary */ - if (insn->FullDstRegisters[0].DstRegister.File != TGSI_FILE_TEMPORARY) + if (insn->Dst[0].DstRegister.File != TGSI_FILE_TEMPORARY) need_tmp = TRUE; /* POW src1 must not be the same register as dst */ @@ -1463,9 +1463,9 @@ static boolean emit_xpd(struct svga_shader_emitter *emit, { SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); const struct src_register src0 = translate_src_register( - emit, &insn->FullSrcRegisters[0] ); + emit, &insn->Src[0] ); const struct src_register src1 = translate_src_register( - emit, &insn->FullSrcRegisters[1] ); + emit, &insn->Src[1] ); boolean need_dst_tmp = FALSE; /* XPD can only output to a temporary */ @@ -1517,11 +1517,11 @@ static boolean emit_lrp(struct svga_shader_emitter *emit, SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); SVGA3dShaderDestToken tmp; const struct src_register src0 = translate_src_register( - emit, &insn->FullSrcRegisters[0] ); + emit, &insn->Src[0] ); const struct src_register src1 = translate_src_register( - emit, &insn->FullSrcRegisters[1] ); + emit, &insn->Src[1] ); const struct src_register src2 = translate_src_register( - emit, &insn->FullSrcRegisters[2] ); + emit, &insn->Src[2] ); boolean need_dst_tmp = FALSE; /* The dst reg must not be the same as src0 or src2 */ @@ -1568,9 +1568,9 @@ static boolean emit_dst_insn(struct svga_shader_emitter *emit, SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); SVGA3dShaderDestToken tmp; const struct src_register src0 = translate_src_register( - emit, &insn->FullSrcRegisters[0] ); + emit, &insn->Src[0] ); const struct src_register src1 = translate_src_register( - emit, &insn->FullSrcRegisters[1] ); + emit, &insn->Src[1] ); struct src_register zero = get_zero_immediate( emit ); boolean need_tmp = FALSE; @@ -1633,7 +1633,7 @@ static boolean emit_exp(struct svga_shader_emitter *emit, { SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); struct src_register src0 = - translate_src_register( emit, &insn->FullSrcRegisters[0] ); + translate_src_register( emit, &insn->Src[0] ); struct src_register zero = get_zero_immediate( emit ); SVGA3dShaderDestToken fraction; @@ -1723,7 +1723,7 @@ static boolean emit_lit(struct svga_shader_emitter *emit, SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); SVGA3dShaderDestToken tmp = get_temp( emit ); const struct src_register src0 = translate_src_register( - emit, &insn->FullSrcRegisters[0] ); + emit, &insn->Src[0] ); struct src_register zero = get_zero_immediate( emit ); /* tmp = pow(src.y, src.w) @@ -1806,7 +1806,7 @@ static boolean emit_ex2( struct svga_shader_emitter *emit, inst = inst_token( SVGA3DOP_EXP ); dst = translate_dst_register( emit, insn, 0 ); - src0 = translate_src_register( emit, &insn->FullSrcRegisters[0] ); + src0 = translate_src_register( emit, &insn->Src[0] ); src0 = scalar( src0, TGSI_SWIZZLE_X ); if (dst.mask != TGSI_WRITEMASK_XYZW) { @@ -1829,7 +1829,7 @@ static boolean emit_log(struct svga_shader_emitter *emit, { SVGA3dShaderDestToken dst = translate_dst_register( emit, insn, 0 ); struct src_register src0 = - translate_src_register( emit, &insn->FullSrcRegisters[0] ); + translate_src_register( emit, &insn->Src[0] ); struct src_register zero = get_zero_immediate( emit ); SVGA3dShaderDestToken abs_tmp; struct src_register abs_src0; @@ -1953,7 +1953,7 @@ static boolean emit_bgnsub( struct svga_shader_emitter *emit, static boolean emit_call( struct svga_shader_emitter *emit, const struct tgsi_full_instruction *insn ) { - unsigned position = insn->InstructionLabel.Label; + unsigned position = insn->Label.Label; unsigned i; for (i = 0; i < emit->nr_labels; i++) { @@ -2543,25 +2543,25 @@ pre_parse_instruction( struct svga_shader_emitter *emit, const struct tgsi_full_instruction *insn, int current_arl) { - if (insn->FullSrcRegisters[0].SrcRegister.Indirect && - insn->FullSrcRegisters[0].SrcRegisterInd.File == TGSI_FILE_ADDRESS) { - const struct tgsi_full_src_register *reg = &insn->FullSrcRegisters[0]; + if (insn->Src[0].SrcRegister.Indirect && + insn->Src[0].SrcRegisterInd.File == TGSI_FILE_ADDRESS) { + const struct tgsi_full_src_register *reg = &insn->Src[0]; if (reg->SrcRegister.Index < 0) { pre_parse_add_indirect(emit, reg->SrcRegister.Index, current_arl); } } - if (insn->FullSrcRegisters[1].SrcRegister.Indirect && - insn->FullSrcRegisters[1].SrcRegisterInd.File == TGSI_FILE_ADDRESS) { - const struct tgsi_full_src_register *reg = &insn->FullSrcRegisters[1]; + if (insn->Src[1].SrcRegister.Indirect && + insn->Src[1].SrcRegisterInd.File == TGSI_FILE_ADDRESS) { + const struct tgsi_full_src_register *reg = &insn->Src[1]; if (reg->SrcRegister.Index < 0) { pre_parse_add_indirect(emit, reg->SrcRegister.Index, current_arl); } } - if (insn->FullSrcRegisters[2].SrcRegister.Indirect && - insn->FullSrcRegisters[2].SrcRegisterInd.File == TGSI_FILE_ADDRESS) { - const struct tgsi_full_src_register *reg = &insn->FullSrcRegisters[2]; + if (insn->Src[2].SrcRegister.Indirect && + insn->Src[2].SrcRegisterInd.File == TGSI_FILE_ADDRESS) { + const struct tgsi_full_src_register *reg = &insn->Src[2]; if (reg->SrcRegister.Index < 0) { pre_parse_add_indirect(emit, reg->SrcRegister.Index, current_arl); } -- cgit v1.2.3 From fe2b31e4a896167a33d267822b36eb2de0ceecba Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Nov 2009 15:04:18 +0000 Subject: tgsi: rename fields of tgsi_full_declaration to reduce verbosity DeclarationRange -> Range --- src/gallium/auxiliary/draw/draw_pipe_aaline.c | 30 ++++++++++++------------- src/gallium/auxiliary/draw/draw_pipe_aapoint.c | 22 +++++++++--------- src/gallium/auxiliary/draw/draw_pipe_pstipple.c | 24 ++++++++++---------- src/gallium/auxiliary/gallivm/tgsitollvm.cpp | 6 ++--- src/gallium/auxiliary/tgsi/tgsi_build.c | 6 ++--- src/gallium/auxiliary/tgsi/tgsi_dump.c | 4 ++-- src/gallium/auxiliary/tgsi/tgsi_dump_c.c | 4 ++-- src/gallium/auxiliary/tgsi/tgsi_exec.c | 4 ++-- src/gallium/auxiliary/tgsi/tgsi_parse.c | 2 +- src/gallium/auxiliary/tgsi/tgsi_parse.h | 2 +- src/gallium/auxiliary/tgsi/tgsi_ppc.c | 4 ++-- src/gallium/auxiliary/tgsi/tgsi_sanity.c | 2 +- src/gallium/auxiliary/tgsi/tgsi_scan.c | 4 ++-- src/gallium/auxiliary/tgsi/tgsi_sse2.c | 4 ++-- src/gallium/auxiliary/tgsi/tgsi_text.c | 4 ++-- src/gallium/auxiliary/vl/vl_shader_build.c | 24 ++++++++++---------- src/gallium/drivers/cell/ppu/cell_gen_fp.c | 4 ++-- src/gallium/drivers/cell/spu/spu_exec.c | 4 ++-- src/gallium/drivers/i915/i915_fpc_translate.c | 8 +++---- src/gallium/drivers/llvmpipe/lp_bld_interp.c | 4 ++-- src/gallium/drivers/nv20/nv20_vertprog.c | 2 +- src/gallium/drivers/nv30/nv30_fragprog.c | 10 ++++----- src/gallium/drivers/nv30/nv30_vertprog.c | 2 +- src/gallium/drivers/nv40/nv40_fragprog.c | 8 +++---- src/gallium/drivers/nv40/nv40_vertprog.c | 10 ++++----- src/gallium/drivers/nv50/nv50_program.c | 4 ++-- src/gallium/drivers/r300/r300_vs.c | 8 +++---- src/gallium/drivers/svga/svga_tgsi_decl_sm20.c | 4 ++-- src/gallium/drivers/svga/svga_tgsi_decl_sm30.c | 4 ++-- 29 files changed, 109 insertions(+), 109 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index 58d867faeb..f1d1715237 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -141,18 +141,18 @@ aa_transform_decl(struct tgsi_transform_context *ctx, if (decl->Declaration.File == TGSI_FILE_OUTPUT && decl->Semantic.Name == TGSI_SEMANTIC_COLOR && decl->Semantic.Index == 0) { - aactx->colorOutput = decl->DeclarationRange.First; + aactx->colorOutput = decl->Range.First; } else if (decl->Declaration.File == TGSI_FILE_SAMPLER) { uint i; - for (i = decl->DeclarationRange.First; - i <= decl->DeclarationRange.Last; i++) { + for (i = decl->Range.First; + i <= decl->Range.Last; i++) { aactx->samplersUsed |= 1 << i; } } else if (decl->Declaration.File == TGSI_FILE_INPUT) { - if ((int) decl->DeclarationRange.Last > aactx->maxInput) - aactx->maxInput = decl->DeclarationRange.Last; + if ((int) decl->Range.Last > aactx->maxInput) + aactx->maxInput = decl->Range.Last; if (decl->Semantic.Name == TGSI_SEMANTIC_GENERIC && (int) decl->Semantic.Index > aactx->maxGeneric) { aactx->maxGeneric = decl->Semantic.Index; @@ -160,8 +160,8 @@ aa_transform_decl(struct tgsi_transform_context *ctx, } else if (decl->Declaration.File == TGSI_FILE_TEMPORARY) { uint i; - for (i = decl->DeclarationRange.First; - i <= decl->DeclarationRange.Last; i++) { + for (i = decl->Range.First; + i <= decl->Range.Last; i++) { aactx->tempsUsed |= (1 << i); } } @@ -230,28 +230,28 @@ aa_transform_inst(struct tgsi_transform_context *ctx, decl.Declaration.Semantic = 1; decl.Semantic.Name = TGSI_SEMANTIC_GENERIC; decl.Semantic.Index = aactx->maxGeneric + 1; - decl.DeclarationRange.First = - decl.DeclarationRange.Last = aactx->maxInput + 1; + decl.Range.First = + decl.Range.Last = aactx->maxInput + 1; ctx->emit_declaration(ctx, &decl); /* declare new sampler */ decl = tgsi_default_full_declaration(); decl.Declaration.File = TGSI_FILE_SAMPLER; - decl.DeclarationRange.First = - decl.DeclarationRange.Last = aactx->freeSampler; + decl.Range.First = + decl.Range.Last = aactx->freeSampler; ctx->emit_declaration(ctx, &decl); /* declare new temp regs */ decl = tgsi_default_full_declaration(); decl.Declaration.File = TGSI_FILE_TEMPORARY; - decl.DeclarationRange.First = - decl.DeclarationRange.Last = aactx->texTemp; + decl.Range.First = + decl.Range.Last = aactx->texTemp; ctx->emit_declaration(ctx, &decl); decl = tgsi_default_full_declaration(); decl.Declaration.File = TGSI_FILE_TEMPORARY; - decl.DeclarationRange.First = - decl.DeclarationRange.Last = aactx->colorTemp; + decl.Range.First = + decl.Range.Last = aactx->colorTemp; ctx->emit_declaration(ctx, &decl); aactx->firstInstruction = FALSE; diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c index 09fc55cb5e..e9e2402c23 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c @@ -133,11 +133,11 @@ aa_transform_decl(struct tgsi_transform_context *ctx, if (decl->Declaration.File == TGSI_FILE_OUTPUT && decl->Semantic.Name == TGSI_SEMANTIC_COLOR && decl->Semantic.Index == 0) { - aactx->colorOutput = decl->DeclarationRange.First; + aactx->colorOutput = decl->Range.First; } else if (decl->Declaration.File == TGSI_FILE_INPUT) { - if ((int) decl->DeclarationRange.Last > aactx->maxInput) - aactx->maxInput = decl->DeclarationRange.Last; + if ((int) decl->Range.Last > aactx->maxInput) + aactx->maxInput = decl->Range.Last; if (decl->Semantic.Name == TGSI_SEMANTIC_GENERIC && (int) decl->Semantic.Index > aactx->maxGeneric) { aactx->maxGeneric = decl->Semantic.Index; @@ -145,8 +145,8 @@ aa_transform_decl(struct tgsi_transform_context *ctx, } else if (decl->Declaration.File == TGSI_FILE_TEMPORARY) { uint i; - for (i = decl->DeclarationRange.First; - i <= decl->DeclarationRange.Last; i++) { + for (i = decl->Range.First; + i <= decl->Range.Last; i++) { aactx->tempsUsed |= (1 << i); } } @@ -200,21 +200,21 @@ aa_transform_inst(struct tgsi_transform_context *ctx, decl.Declaration.Semantic = 1; decl.Semantic.Name = TGSI_SEMANTIC_GENERIC; decl.Semantic.Index = aactx->maxGeneric + 1; - decl.DeclarationRange.First = - decl.DeclarationRange.Last = texInput; + decl.Range.First = + decl.Range.Last = texInput; ctx->emit_declaration(ctx, &decl); /* declare new temp regs */ decl = tgsi_default_full_declaration(); decl.Declaration.File = TGSI_FILE_TEMPORARY; - decl.DeclarationRange.First = - decl.DeclarationRange.Last = tmp0; + decl.Range.First = + decl.Range.Last = tmp0; ctx->emit_declaration(ctx, &decl); decl = tgsi_default_full_declaration(); decl.Declaration.File = TGSI_FILE_TEMPORARY; - decl.DeclarationRange.First = - decl.DeclarationRange.Last = aactx->colorTemp; + decl.Range.First = + decl.Range.Last = aactx->colorTemp; ctx->emit_declaration(ctx, &decl); aactx->firstInstruction = FALSE; diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c index fe0d511218..218dcb9d12 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c @@ -133,20 +133,20 @@ pstip_transform_decl(struct tgsi_transform_context *ctx, if (decl->Declaration.File == TGSI_FILE_SAMPLER) { uint i; - for (i = decl->DeclarationRange.First; - i <= decl->DeclarationRange.Last; i++) { + for (i = decl->Range.First; + i <= decl->Range.Last; i++) { pctx->samplersUsed |= 1 << i; } } else if (decl->Declaration.File == TGSI_FILE_INPUT) { - pctx->maxInput = MAX2(pctx->maxInput, (int) decl->DeclarationRange.Last); + pctx->maxInput = MAX2(pctx->maxInput, (int) decl->Range.Last); if (decl->Semantic.Name == TGSI_SEMANTIC_POSITION) - pctx->wincoordInput = (int) decl->DeclarationRange.First; + pctx->wincoordInput = (int) decl->Range.First; } else if (decl->Declaration.File == TGSI_FILE_TEMPORARY) { uint i; - for (i = decl->DeclarationRange.First; - i <= decl->DeclarationRange.Last; i++) { + for (i = decl->Range.First; + i <= decl->Range.Last; i++) { pctx->tempsUsed |= (1 << i); } } @@ -228,23 +228,23 @@ pstip_transform_inst(struct tgsi_transform_context *ctx, decl.Declaration.Semantic = 1; decl.Semantic.Name = TGSI_SEMANTIC_POSITION; decl.Semantic.Index = 0; - decl.DeclarationRange.First = - decl.DeclarationRange.Last = wincoordInput; + decl.Range.First = + decl.Range.Last = wincoordInput; ctx->emit_declaration(ctx, &decl); } /* declare new sampler */ decl = tgsi_default_full_declaration(); decl.Declaration.File = TGSI_FILE_SAMPLER; - decl.DeclarationRange.First = - decl.DeclarationRange.Last = pctx->freeSampler; + decl.Range.First = + decl.Range.Last = pctx->freeSampler; ctx->emit_declaration(ctx, &decl); /* declare new temp regs */ decl = tgsi_default_full_declaration(); decl.Declaration.File = TGSI_FILE_TEMPORARY; - decl.DeclarationRange.First = - decl.DeclarationRange.Last = pctx->texTemp; + decl.Range.First = + decl.Range.Last = pctx->texTemp; ctx->emit_declaration(ctx, &decl); /* emit immediate = {1/32, 1/32, 1, 1} diff --git a/src/gallium/auxiliary/gallivm/tgsitollvm.cpp b/src/gallium/auxiliary/gallivm/tgsitollvm.cpp index fbf4d2636d..3edff0e5b2 100644 --- a/src/gallium/auxiliary/gallivm/tgsitollvm.cpp +++ b/src/gallium/auxiliary/gallivm/tgsitollvm.cpp @@ -94,8 +94,8 @@ translate_declaration(struct gallivm_ir *prog, unsigned first, last, mask; uint interp_method; - first = decl->DeclarationRange.First; - last = decl->DeclarationRange.Last; + first = decl->Range.First; + last = decl->Range.Last; mask = decl->Declaration.UsageMask; /* Do not touch WPOS.xy */ @@ -149,7 +149,7 @@ translate_declarationir(struct gallivm_ir *, struct tgsi_full_declaration *) { if (decl->Declaration.File == TGSI_FILE_ADDRESS) { - int idx = decl->DeclarationRange.First; + int idx = decl->Range.First; storage->addAddress(idx); } } diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index 7ec832aad9..094d8d52d8 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -172,7 +172,7 @@ tgsi_default_full_declaration( void ) struct tgsi_full_declaration full_declaration; full_declaration.Declaration = tgsi_default_declaration(); - full_declaration.DeclarationRange = tgsi_default_declaration_range(); + full_declaration.Range = tgsi_default_declaration_range(); full_declaration.Semantic = tgsi_default_declaration_semantic(); return full_declaration; @@ -209,8 +209,8 @@ tgsi_build_full_declaration( size++; *dr = tgsi_build_declaration_range( - full_decl->DeclarationRange.First, - full_decl->DeclarationRange.Last, + full_decl->Range.First, + full_decl->Range.Last, declaration, header ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index 4ff7f4b11e..7791f9f4fc 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -224,8 +224,8 @@ iter_declaration( _dump_register( ctx, decl->Declaration.File, - decl->DeclarationRange.First, - decl->DeclarationRange.Last ); + decl->Range.First, + decl->Range.Last ); _dump_writemask( ctx, decl->Declaration.UsageMask ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c index 194b2473bc..5593942154 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c @@ -223,9 +223,9 @@ dump_declaration_verbose( EOL(); TXT( "\nFirst: " ); - UID( decl->DeclarationRange.First ); + UID( decl->Range.First ); TXT( "\nLast : " ); - UID( decl->DeclarationRange.Last ); + UID( decl->Range.Last ); if( decl->Declaration.Semantic ) { EOL(); diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index a9bfb0d6df..3f8d59e46a 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -1895,8 +1895,8 @@ exec_declaration(struct tgsi_exec_machine *mach, if (decl->Declaration.File == TGSI_FILE_INPUT) { uint first, last, mask; - first = decl->DeclarationRange.First; - last = decl->DeclarationRange.Last; + first = decl->Range.First; + last = decl->Range.Last; mask = decl->Declaration.UsageMask; if (decl->Semantic.Name == TGSI_SEMANTIC_POSITION) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c index ff593fdc32..7946fdd732 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.c +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c @@ -112,7 +112,7 @@ tgsi_parse_token( memset(decl, 0, sizeof *decl); copy_token(&decl->Declaration, &token); - next_token( ctx, &decl->DeclarationRange ); + next_token( ctx, &decl->Range ); if( decl->Declaration.Semantic ) { next_token( ctx, &decl->Semantic ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h b/src/gallium/auxiliary/tgsi/tgsi_parse.h index 2f8f4d488b..1965c5181d 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.h +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h @@ -62,7 +62,7 @@ struct tgsi_full_src_register struct tgsi_full_declaration { struct tgsi_declaration Declaration; - struct tgsi_declaration_range DeclarationRange; + struct tgsi_declaration_range Range; struct tgsi_declaration_semantic Semantic; }; diff --git a/src/gallium/auxiliary/tgsi/tgsi_ppc.c b/src/gallium/auxiliary/tgsi/tgsi_ppc.c index 8397f432f9..ec5f235143 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ppc.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ppc.c @@ -1178,8 +1178,8 @@ emit_declaration( unsigned first, last, mask; unsigned i, j; - first = decl->DeclarationRange.First; - last = decl->DeclarationRange.Last; + first = decl->Range.First; + last = decl->Range.Last; mask = decl->Declaration.UsageMask; for( i = first; i <= last; i++ ) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c b/src/gallium/auxiliary/tgsi/tgsi_sanity.c index 8422b91a30..005894e604 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c @@ -286,7 +286,7 @@ iter_declaration( file = decl->Declaration.File; if (!check_file_name( ctx, file )) return TRUE; - for (i = decl->DeclarationRange.First; i <= decl->DeclarationRange.Last; i++) { + for (i = decl->Range.First; i <= decl->Range.Last; i++) { if (is_register_declared( ctx, file, i )) report_error( ctx, "%s[%u]: The same register declared more than once", file_names[file], i ); ctx->regs_decl[file][i / BITS_IN_REG_FLAG] |= (1 << (i % BITS_IN_REG_FLAG)); diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c index be25b3dc5c..6ca25c36ec 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c @@ -119,8 +119,8 @@ tgsi_scan_shader(const struct tgsi_token *tokens, = &parse.FullToken.FullDeclaration; const uint file = fulldecl->Declaration.File; uint reg; - for (reg = fulldecl->DeclarationRange.First; - reg <= fulldecl->DeclarationRange.Last; + for (reg = fulldecl->Range.First; + reg <= fulldecl->Range.Last; reg++) { /* only first 32 regs will appear in this bitfield */ diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index 2d2ee321c9..c23b0cc343 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -2637,8 +2637,8 @@ emit_declaration( unsigned first, last, mask; unsigned i, j; - first = decl->DeclarationRange.First; - last = decl->DeclarationRange.Last; + first = decl->Range.First; + last = decl->Range.Last; mask = decl->Declaration.UsageMask; for( i = first; i <= last; i++ ) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index e9b1a21fb4..295ded9664 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -799,8 +799,8 @@ static boolean parse_declaration( struct translate_ctx *ctx ) decl = tgsi_default_full_declaration(); decl.Declaration.File = file; decl.Declaration.UsageMask = writemask; - decl.DeclarationRange.First = first; - decl.DeclarationRange.Last = last; + decl.Range.First = first; + decl.Range.Last = last; cur = ctx->cur; eat_opt_white( &cur ); diff --git a/src/gallium/auxiliary/vl/vl_shader_build.c b/src/gallium/auxiliary/vl/vl_shader_build.c index 82300b1da2..548dfca05a 100644 --- a/src/gallium/auxiliary/vl/vl_shader_build.c +++ b/src/gallium/auxiliary/vl/vl_shader_build.c @@ -38,8 +38,8 @@ struct tgsi_full_declaration vl_decl_input(unsigned int name, unsigned int index decl.Declaration.Semantic = 1; decl.Semantic.Name = name; decl.Semantic.Index = index; - decl.DeclarationRange.First = first; - decl.DeclarationRange.Last = last; + decl.Range.First = first; + decl.Range.Last = last; return decl; } @@ -67,8 +67,8 @@ struct tgsi_full_declaration vl_decl_interpolated_input decl.Semantic.Name = name; decl.Semantic.Index = index; decl.Declaration.Interpolate = interpolation;; - decl.DeclarationRange.First = first; - decl.DeclarationRange.Last = last; + decl.Range.First = first; + decl.Range.Last = last; return decl; } @@ -81,8 +81,8 @@ struct tgsi_full_declaration vl_decl_constants(unsigned int name, unsigned int i decl.Declaration.Semantic = 1; decl.Semantic.Name = name; decl.Semantic.Index = index; - decl.DeclarationRange.First = first; - decl.DeclarationRange.Last = last; + decl.Range.First = first; + decl.Range.Last = last; return decl; } @@ -95,8 +95,8 @@ struct tgsi_full_declaration vl_decl_output(unsigned int name, unsigned int inde decl.Declaration.Semantic = 1; decl.Semantic.Name = name; decl.Semantic.Index = index; - decl.DeclarationRange.First = first; - decl.DeclarationRange.Last = last; + decl.Range.First = first; + decl.Range.Last = last; return decl; } @@ -107,8 +107,8 @@ struct tgsi_full_declaration vl_decl_temps(unsigned int first, unsigned int last decl = tgsi_default_full_declaration(); decl.Declaration.File = TGSI_FILE_TEMPORARY; - decl.DeclarationRange.First = first; - decl.DeclarationRange.Last = last; + decl.Range.First = first; + decl.Range.Last = last; return decl; } @@ -119,8 +119,8 @@ struct tgsi_full_declaration vl_decl_samplers(unsigned int first, unsigned int l decl = tgsi_default_full_declaration(); decl.Declaration.File = TGSI_FILE_SAMPLER; - decl.DeclarationRange.First = first; - decl.DeclarationRange.Last = last; + decl.Range.First = first; + decl.Range.Last = last; return decl; } diff --git a/src/gallium/drivers/cell/ppu/cell_gen_fp.c b/src/gallium/drivers/cell/ppu/cell_gen_fp.c index b0afad349f..aeabe002d0 100644 --- a/src/gallium/drivers/cell/ppu/cell_gen_fp.c +++ b/src/gallium/drivers/cell/ppu/cell_gen_fp.c @@ -1909,8 +1909,8 @@ emit_declaration(struct cell_context *cell, switch (decl->Declaration.File) { case TGSI_FILE_TEMPORARY: - for (i = decl->DeclarationRange.First; - i <= decl->DeclarationRange.Last; + for (i = decl->Range.First; + i <= decl->Range.Last; i++) { assert(i < MAX_TEMPS); for (ch = 0; ch < 4; ch++) { diff --git a/src/gallium/drivers/cell/spu/spu_exec.c b/src/gallium/drivers/cell/spu/spu_exec.c index 8d58c534be..ee5e3432d5 100644 --- a/src/gallium/drivers/cell/spu/spu_exec.c +++ b/src/gallium/drivers/cell/spu/spu_exec.c @@ -833,8 +833,8 @@ exec_declaration(struct spu_exec_machine *mach, unsigned first, last, mask; interpolation_func interp; - first = decl->DeclarationRange.First; - last = decl->DeclarationRange.Last; + first = decl->Range.First; + last = decl->Range.Last; mask = decl->Declaration.UsageMask; switch( decl->Declaration.Interpolate ) { diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c b/src/gallium/drivers/i915/i915_fpc_translate.c index 9e626c85c0..1a4a7bbe62 100644 --- a/src/gallium/drivers/i915/i915_fpc_translate.c +++ b/src/gallium/drivers/i915/i915_fpc_translate.c @@ -928,8 +928,8 @@ i915_translate_instructions(struct i915_fp_compile *p, if (parse.FullToken.FullDeclaration.Declaration.File == TGSI_FILE_CONSTANT) { uint i; - for (i = parse.FullToken.FullDeclaration.DeclarationRange.First; - i <= parse.FullToken.FullDeclaration.DeclarationRange.Last; + for (i = parse.FullToken.FullDeclaration.Range.First; + i <= parse.FullToken.FullDeclaration.Range.Last; i++) { assert(ifs->constant_flags[i] == 0x0); ifs->constant_flags[i] = I915_CONSTFLAG_USER; @@ -939,8 +939,8 @@ i915_translate_instructions(struct i915_fp_compile *p, else if (parse.FullToken.FullDeclaration.Declaration.File == TGSI_FILE_TEMPORARY) { uint i; - for (i = parse.FullToken.FullDeclaration.DeclarationRange.First; - i <= parse.FullToken.FullDeclaration.DeclarationRange.Last; + for (i = parse.FullToken.FullDeclaration.Range.First; + i <= parse.FullToken.FullDeclaration.Range.Last; i++) { assert(i < I915_MAX_TEMPORARY); /* XXX just use shader->info->file_mask[TGSI_FILE_TEMPORARY] */ diff --git a/src/gallium/drivers/llvmpipe/lp_bld_interp.c b/src/gallium/drivers/llvmpipe/lp_bld_interp.c index 818c0e943e..49dab8ab61 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_interp.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_interp.c @@ -303,8 +303,8 @@ lp_build_interp_soa_init(struct lp_build_interp_soa_context *bld, unsigned first, last, mask; unsigned attrib; - first = decl->DeclarationRange.First; - last = decl->DeclarationRange.Last; + first = decl->Range.First; + last = decl->Range.Last; mask = decl->Declaration.UsageMask; for( attrib = first; attrib <= last; ++attrib ) { diff --git a/src/gallium/drivers/nv20/nv20_vertprog.c b/src/gallium/drivers/nv20/nv20_vertprog.c index e82a23d475..abffbe33a8 100644 --- a/src/gallium/drivers/nv20/nv20_vertprog.c +++ b/src/gallium/drivers/nv20/nv20_vertprog.c @@ -535,7 +535,7 @@ nv20_vertprog_parse_decl_output(struct nv20_vpc *vpc, return FALSE; } - vpc->output_map[fdec->DeclarationRange.First] = hw; + vpc->output_map[fdec->Range.First] = hw; return TRUE; } diff --git a/src/gallium/drivers/nv30/nv30_fragprog.c b/src/gallium/drivers/nv30/nv30_fragprog.c index dfffeb3263..20f7d4152c 100644 --- a/src/gallium/drivers/nv30/nv30_fragprog.c +++ b/src/gallium/drivers/nv30/nv30_fragprog.c @@ -604,7 +604,7 @@ nv30_fragprog_parse_decl_attrib(struct nv30_fpc *fpc, return FALSE; } - fpc->attrib_map[fdec->DeclarationRange.First] = hw; + fpc->attrib_map[fdec->Range.First] = hw; return TRUE; } @@ -614,10 +614,10 @@ nv30_fragprog_parse_decl_output(struct nv30_fpc *fpc, { switch (fdec->Semantic.Name) { case TGSI_SEMANTIC_POSITION: - fpc->depth_id = fdec->DeclarationRange.First; + fpc->depth_id = fdec->Range.First; break; case TGSI_SEMANTIC_COLOR: - fpc->colour_id = fdec->DeclarationRange.First; + fpc->colour_id = fdec->Range.First; break; default: NOUVEAU_ERR("bad output semantic\n"); @@ -653,9 +653,9 @@ nv30_fragprog_prepare(struct nv30_fpc *fpc) goto out_err; break; /*case TGSI_FILE_TEMPORARY: - if (fdec->DeclarationRange.Last > high_temp) { + if (fdec->Range.Last > high_temp) { high_temp = - fdec->DeclarationRange.Last; + fdec->Range.Last; } break;*/ default: diff --git a/src/gallium/drivers/nv30/nv30_vertprog.c b/src/gallium/drivers/nv30/nv30_vertprog.c index 41bd45ad29..99fde93245 100644 --- a/src/gallium/drivers/nv30/nv30_vertprog.c +++ b/src/gallium/drivers/nv30/nv30_vertprog.c @@ -535,7 +535,7 @@ nv30_vertprog_parse_decl_output(struct nv30_vpc *vpc, return FALSE; } - vpc->output_map[fdec->DeclarationRange.First] = hw; + vpc->output_map[fdec->Range.First] = hw; return TRUE; } diff --git a/src/gallium/drivers/nv40/nv40_fragprog.c b/src/gallium/drivers/nv40/nv40_fragprog.c index 6addc45247..8e8cba1a0c 100644 --- a/src/gallium/drivers/nv40/nv40_fragprog.c +++ b/src/gallium/drivers/nv40/nv40_fragprog.c @@ -676,7 +676,7 @@ nv40_fragprog_parse_decl_attrib(struct nv40_fpc *fpc, return FALSE; } - fpc->attrib_map[fdec->DeclarationRange.First] = hw; + fpc->attrib_map[fdec->Range.First] = hw; return TRUE; } @@ -684,7 +684,7 @@ static boolean nv40_fragprog_parse_decl_output(struct nv40_fpc *fpc, const struct tgsi_full_declaration *fdec) { - unsigned idx = fdec->DeclarationRange.First; + unsigned idx = fdec->Range.First; unsigned hw; switch (fdec->Semantic.Name) { @@ -738,9 +738,9 @@ nv40_fragprog_prepare(struct nv40_fpc *fpc) goto out_err; break; case TGSI_FILE_TEMPORARY: - if (fdec->DeclarationRange.Last > high_temp) { + if (fdec->Range.Last > high_temp) { high_temp = - fdec->DeclarationRange.Last; + fdec->Range.Last; } break; default: diff --git a/src/gallium/drivers/nv40/nv40_vertprog.c b/src/gallium/drivers/nv40/nv40_vertprog.c index 0cdc511166..913e050389 100644 --- a/src/gallium/drivers/nv40/nv40_vertprog.c +++ b/src/gallium/drivers/nv40/nv40_vertprog.c @@ -577,7 +577,7 @@ static boolean nv40_vertprog_parse_decl_output(struct nv40_vpc *vpc, const struct tgsi_full_declaration *fdec) { - unsigned idx = fdec->DeclarationRange.First; + unsigned idx = fdec->Range.First; int hw; switch (fdec->Semantic.Name) { @@ -652,16 +652,16 @@ nv40_vertprog_prepare(struct nv40_vpc *vpc) fdec = &p.FullToken.FullDeclaration; switch (fdec->Declaration.File) { case TGSI_FILE_TEMPORARY: - if (fdec->DeclarationRange.Last > high_temp) { + if (fdec->Range.Last > high_temp) { high_temp = - fdec->DeclarationRange.Last; + fdec->Range.Last; } break; #if 0 /* this would be nice.. except gallium doesn't track it */ case TGSI_FILE_ADDRESS: - if (fdec->DeclarationRange.Last > high_addr) { + if (fdec->Range.Last > high_addr) { high_addr = - fdec->DeclarationRange.Last; + fdec->Range.Last; } break; #endif diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 9fbf918601..57747a1840 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -2547,8 +2547,8 @@ nv50_program_tx_prep(struct nv50_pc *pc) unsigned si, last, first, mode; d = &tp.FullToken.FullDeclaration; - first = d->DeclarationRange.First; - last = d->DeclarationRange.Last; + first = d->Range.First; + last = d->Range.Last; switch (d->Declaration.File) { case TGSI_FILE_TEMPORARY: diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c index 939b13e4b3..096707dda4 100644 --- a/src/gallium/drivers/r300/r300_vs.c +++ b/src/gallium/drivers/r300/r300_vs.c @@ -79,19 +79,19 @@ static void set_vertex_inputs_outputs(struct r300_vertex_program_compiler * c) switch (decl->Semantic.Name) { case TGSI_SEMANTIC_POSITION: - c->code->outputs[decl->DeclarationRange.First] = 0; + c->code->outputs[decl->Range.First] = 0; break; case TGSI_SEMANTIC_PSIZE: - c->code->outputs[decl->DeclarationRange.First] = 1; + c->code->outputs[decl->Range.First] = 1; break; case TGSI_SEMANTIC_COLOR: - c->code->outputs[decl->DeclarationRange.First] = 1 + + c->code->outputs[decl->Range.First] = 1 + (pointsize ? 1 : 0) + colors++; break; case TGSI_SEMANTIC_FOG: case TGSI_SEMANTIC_GENERIC: - c->code->outputs[decl->DeclarationRange.First] = 1 + + c->code->outputs[decl->Range.First] = 1 + (pointsize ? 1 : 0) + out_colors + generic++; diff --git a/src/gallium/drivers/svga/svga_tgsi_decl_sm20.c b/src/gallium/drivers/svga/svga_tgsi_decl_sm20.c index 6f4822a89d..23b3ace7f3 100644 --- a/src/gallium/drivers/svga/svga_tgsi_decl_sm20.c +++ b/src/gallium/drivers/svga/svga_tgsi_decl_sm20.c @@ -230,8 +230,8 @@ static boolean ps20_sampler( struct svga_shader_emitter *emit, boolean svga_translate_decl_sm20( struct svga_shader_emitter *emit, const struct tgsi_full_declaration *decl ) { - unsigned first = decl->DeclarationRange.First; - unsigned last = decl->DeclarationRange.Last; + unsigned first = decl->Range.First; + unsigned last = decl->Range.Last; unsigned semantic = 0; unsigned semantic_idx = 0; unsigned idx; diff --git a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c index 65aa23ce3e..d1c7336dec 100644 --- a/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c +++ b/src/gallium/drivers/svga/svga_tgsi_decl_sm30.c @@ -335,8 +335,8 @@ static boolean ps30_sampler( struct svga_shader_emitter *emit, boolean svga_translate_decl_sm30( struct svga_shader_emitter *emit, const struct tgsi_full_declaration *decl ) { - unsigned first = decl->DeclarationRange.First; - unsigned last = decl->DeclarationRange.Last; + unsigned first = decl->Range.First; + unsigned last = decl->Range.Last; unsigned semantic = 0; unsigned semantic_idx = 0; unsigned idx; -- cgit v1.2.3 From 5b0824dfe5eaf59fa87134e7482b3d147b262901 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Nov 2009 15:08:55 +0000 Subject: tgsi: rename fields of tgsi_full_dst_register to reduce verbosity DstRegister -> Register DstRegisterInd -> Indirect --- src/gallium/auxiliary/draw/draw_pipe_aaline.c | 24 +++---- src/gallium/auxiliary/draw/draw_pipe_aapoint.c | 86 ++++++++++++------------ src/gallium/auxiliary/draw/draw_pipe_pstipple.c | 8 +-- src/gallium/auxiliary/draw/draw_vs_aos.c | 50 +++++++------- src/gallium/auxiliary/gallivm/tgsitollvm.cpp | 16 ++--- src/gallium/auxiliary/tgsi/tgsi_build.c | 34 +++++----- src/gallium/auxiliary/tgsi/tgsi_dump.c | 20 +++--- src/gallium/auxiliary/tgsi/tgsi_dump_c.c | 38 +++++------ src/gallium/auxiliary/tgsi/tgsi_exec.c | 36 +++++----- src/gallium/auxiliary/tgsi/tgsi_parse.c | 12 ++-- src/gallium/auxiliary/tgsi/tgsi_parse.h | 4 +- src/gallium/auxiliary/tgsi/tgsi_ppc.c | 18 ++--- src/gallium/auxiliary/tgsi/tgsi_sanity.c | 8 +-- src/gallium/auxiliary/tgsi/tgsi_scan.c | 6 +- src/gallium/auxiliary/tgsi/tgsi_sse2.c | 14 ++-- src/gallium/auxiliary/tgsi/tgsi_text.c | 6 +- src/gallium/auxiliary/vl/vl_compositor.c | 2 +- src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 6 +- src/gallium/auxiliary/vl/vl_shader_build.c | 16 ++--- src/gallium/drivers/cell/ppu/cell_gen_fp.c | 20 +++--- src/gallium/drivers/cell/spu/spu_exec.c | 12 ++-- src/gallium/drivers/i915/i915_fpc_translate.c | 10 +-- src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c | 12 ++-- src/gallium/drivers/nv20/nv20_vertprog.c | 8 +-- src/gallium/drivers/nv30/nv30_fragprog.c | 10 +-- src/gallium/drivers/nv30/nv30_vertprog.c | 8 +-- src/gallium/drivers/nv40/nv40_fragprog.c | 10 +-- src/gallium/drivers/nv40/nv40_vertprog.c | 16 ++--- src/gallium/drivers/nv50/nv50_program.c | 36 +++++----- src/gallium/drivers/r300/r300_tgsi_to_rc.c | 8 +-- src/gallium/drivers/svga/svga_tgsi_insn.c | 12 ++-- 31 files changed, 283 insertions(+), 283 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index f1d1715237..fe200983ca 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -265,8 +265,8 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_TEX; newInst.Instruction.NumDstRegs = 1; - newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.Dst[0].DstRegister.Index = aactx->texTemp; + newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].Register.Index = aactx->texTemp; newInst.Instruction.NumSrcRegs = 2; newInst.Instruction.Texture = TRUE; newInst.Texture.Texture = TGSI_TEXTURE_2D; @@ -281,9 +281,9 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_MOV; newInst.Instruction.NumDstRegs = 1; - newInst.Dst[0].DstRegister.File = TGSI_FILE_OUTPUT; - newInst.Dst[0].DstRegister.Index = aactx->colorOutput; - newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_XYZ; + newInst.Dst[0].Register.File = TGSI_FILE_OUTPUT; + newInst.Dst[0].Register.Index = aactx->colorOutput; + newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_XYZ; newInst.Instruction.NumSrcRegs = 1; newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; newInst.Src[0].SrcRegister.Index = aactx->colorTemp; @@ -293,9 +293,9 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_MUL; newInst.Instruction.NumDstRegs = 1; - newInst.Dst[0].DstRegister.File = TGSI_FILE_OUTPUT; - newInst.Dst[0].DstRegister.Index = aactx->colorOutput; - newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_W; + newInst.Dst[0].Register.File = TGSI_FILE_OUTPUT; + newInst.Dst[0].Register.Index = aactx->colorOutput; + newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_W; newInst.Instruction.NumSrcRegs = 2; newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; newInst.Src[0].SrcRegister.Index = aactx->colorTemp; @@ -318,10 +318,10 @@ aa_transform_inst(struct tgsi_transform_context *ctx, for (i = 0; i < inst->Instruction.NumDstRegs; i++) { struct tgsi_full_dst_register *dst = &inst->Dst[i]; - if (dst->DstRegister.File == TGSI_FILE_OUTPUT && - dst->DstRegister.Index == aactx->colorOutput) { - dst->DstRegister.File = TGSI_FILE_TEMPORARY; - dst->DstRegister.Index = aactx->colorTemp; + if (dst->Register.File == TGSI_FILE_OUTPUT && + dst->Register.Index == aactx->colorOutput) { + dst->Register.File = TGSI_FILE_TEMPORARY; + dst->Register.Index = aactx->colorTemp; } } diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c index e9e2402c23..39e1406e96 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c @@ -234,9 +234,9 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_MUL; newInst.Instruction.NumDstRegs = 1; - newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.Dst[0].DstRegister.Index = tmp0; - newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_XY; + newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].Register.Index = tmp0; + newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_XY; newInst.Instruction.NumSrcRegs = 2; newInst.Src[0].SrcRegister.File = TGSI_FILE_INPUT; newInst.Src[0].SrcRegister.Index = texInput; @@ -248,9 +248,9 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_ADD; newInst.Instruction.NumDstRegs = 1; - newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.Dst[0].DstRegister.Index = tmp0; - newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_X; + newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].Register.Index = tmp0; + newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_X; newInst.Instruction.NumSrcRegs = 2; newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; newInst.Src[0].SrcRegister.Index = tmp0; @@ -265,9 +265,9 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_RSQ; newInst.Instruction.NumDstRegs = 1; - newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.Dst[0].DstRegister.Index = tmp0; - newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_X; + newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].Register.Index = tmp0; + newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_X; newInst.Instruction.NumSrcRegs = 1; newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; newInst.Src[0].SrcRegister.Index = tmp0; @@ -277,9 +277,9 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_RCP; newInst.Instruction.NumDstRegs = 1; - newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.Dst[0].DstRegister.Index = tmp0; - newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_X; + newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].Register.Index = tmp0; + newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_X; newInst.Instruction.NumSrcRegs = 1; newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; newInst.Src[0].SrcRegister.Index = tmp0; @@ -290,9 +290,9 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_SGT; newInst.Instruction.NumDstRegs = 1; - newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.Dst[0].DstRegister.Index = tmp0; - newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_Y; + newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].Register.Index = tmp0; + newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_Y; newInst.Instruction.NumSrcRegs = 2; newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; newInst.Src[0].SrcRegister.Index = tmp0; @@ -323,9 +323,9 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_SUB; newInst.Instruction.NumDstRegs = 1; - newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.Dst[0].DstRegister.Index = tmp0; - newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_Z; + newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].Register.Index = tmp0; + newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_Z; newInst.Instruction.NumSrcRegs = 2; newInst.Src[0].SrcRegister.File = TGSI_FILE_INPUT; newInst.Src[0].SrcRegister.Index = texInput; @@ -339,9 +339,9 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_RCP; newInst.Instruction.NumDstRegs = 1; - newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.Dst[0].DstRegister.Index = tmp0; - newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_Z; + newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].Register.Index = tmp0; + newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_Z; newInst.Instruction.NumSrcRegs = 1; newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; newInst.Src[0].SrcRegister.Index = tmp0; @@ -352,9 +352,9 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_SUB; newInst.Instruction.NumDstRegs = 1; - newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.Dst[0].DstRegister.Index = tmp0; - newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_Y; + newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].Register.Index = tmp0; + newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_Y; newInst.Instruction.NumSrcRegs = 2; newInst.Src[0].SrcRegister.File = TGSI_FILE_INPUT; newInst.Src[0].SrcRegister.Index = texInput; @@ -368,9 +368,9 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_MUL; newInst.Instruction.NumDstRegs = 1; - newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.Dst[0].DstRegister.Index = tmp0; - newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_W; + newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].Register.Index = tmp0; + newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_W; newInst.Instruction.NumSrcRegs = 2; newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; newInst.Src[0].SrcRegister.Index = tmp0; @@ -384,9 +384,9 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_SLE; newInst.Instruction.NumDstRegs = 1; - newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.Dst[0].DstRegister.Index = tmp0; - newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_Y; + newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].Register.Index = tmp0; + newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_Y; newInst.Instruction.NumSrcRegs = 2; newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; newInst.Src[0].SrcRegister.Index = tmp0; @@ -405,9 +405,9 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_CMP; newInst.Instruction.NumDstRegs = 1; - newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.Dst[0].DstRegister.Index = tmp0; - newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_W; + newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].Register.Index = tmp0; + newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_W; newInst.Instruction.NumSrcRegs = 3; newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; newInst.Src[0].SrcRegister.Index = tmp0; @@ -439,9 +439,9 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_MOV; newInst.Instruction.NumDstRegs = 1; - newInst.Dst[0].DstRegister.File = TGSI_FILE_OUTPUT; - newInst.Dst[0].DstRegister.Index = aactx->colorOutput; - newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_XYZ; + newInst.Dst[0].Register.File = TGSI_FILE_OUTPUT; + newInst.Dst[0].Register.Index = aactx->colorOutput; + newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_XYZ; newInst.Instruction.NumSrcRegs = 1; newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; newInst.Src[0].SrcRegister.Index = aactx->colorTemp; @@ -451,9 +451,9 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_MUL; newInst.Instruction.NumDstRegs = 1; - newInst.Dst[0].DstRegister.File = TGSI_FILE_OUTPUT; - newInst.Dst[0].DstRegister.Index = aactx->colorOutput; - newInst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_W; + newInst.Dst[0].Register.File = TGSI_FILE_OUTPUT; + newInst.Dst[0].Register.Index = aactx->colorOutput; + newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_W; newInst.Instruction.NumSrcRegs = 2; newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; newInst.Src[0].SrcRegister.Index = aactx->colorTemp; @@ -469,10 +469,10 @@ aa_transform_inst(struct tgsi_transform_context *ctx, for (i = 0; i < inst->Instruction.NumDstRegs; i++) { struct tgsi_full_dst_register *dst = &inst->Dst[i]; - if (dst->DstRegister.File == TGSI_FILE_OUTPUT && - dst->DstRegister.Index == aactx->colorOutput) { - dst->DstRegister.File = TGSI_FILE_TEMPORARY; - dst->DstRegister.Index = aactx->colorTemp; + if (dst->Register.File == TGSI_FILE_OUTPUT && + dst->Register.Index == aactx->colorOutput) { + dst->Register.File = TGSI_FILE_TEMPORARY; + dst->Register.Index = aactx->colorTemp; } } } diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c index 218dcb9d12..99165b1006 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c @@ -280,8 +280,8 @@ pstip_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_MUL; newInst.Instruction.NumDstRegs = 1; - newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.Dst[0].DstRegister.Index = pctx->texTemp; + newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].Register.Index = pctx->texTemp; newInst.Instruction.NumSrcRegs = 2; newInst.Src[0].SrcRegister.File = TGSI_FILE_INPUT; newInst.Src[0].SrcRegister.Index = wincoordInput; @@ -293,8 +293,8 @@ pstip_transform_inst(struct tgsi_transform_context *ctx, newInst = tgsi_default_full_instruction(); newInst.Instruction.Opcode = TGSI_OPCODE_TEX; newInst.Instruction.NumDstRegs = 1; - newInst.Dst[0].DstRegister.File = TGSI_FILE_TEMPORARY; - newInst.Dst[0].DstRegister.Index = pctx->texTemp; + newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Dst[0].Register.Index = pctx->texTemp; newInst.Instruction.NumSrcRegs = 2; newInst.Instruction.Texture = TRUE; newInst.Texture.Texture = TGSI_TEXTURE_2D; diff --git a/src/gallium/auxiliary/draw/draw_vs_aos.c b/src/gallium/auxiliary/draw/draw_vs_aos.c index a9c8715bc8..8c93642954 100644 --- a/src/gallium/auxiliary/draw/draw_vs_aos.c +++ b/src/gallium/auxiliary/draw/draw_vs_aos.c @@ -361,8 +361,8 @@ static struct x86_reg aos_get_shader_reg_ptr( struct aos_compilation *cp, static struct x86_reg get_dst_ptr( struct aos_compilation *cp, const struct tgsi_full_dst_register *dst ) { - unsigned file = dst->DstRegister.File; - unsigned idx = dst->DstRegister.Index; + unsigned file = dst->Register.File; + unsigned idx = dst->Register.Index; unsigned i; @@ -669,15 +669,15 @@ static void store_dest( struct aos_compilation *cp, { struct x86_reg dst; - switch (reg->DstRegister.WriteMask) { + switch (reg->Register.WriteMask) { case 0: return; case TGSI_WRITEMASK_XYZW: aos_adopt_xmm_reg(cp, get_xmm_writable(cp, result), - reg->DstRegister.File, - reg->DstRegister.Index, + reg->Register.File, + reg->Register.Index, TRUE); return; default: @@ -685,10 +685,10 @@ static void store_dest( struct aos_compilation *cp, } dst = aos_get_shader_reg_xmm(cp, - reg->DstRegister.File, - reg->DstRegister.Index); + reg->Register.File, + reg->Register.Index); - switch (reg->DstRegister.WriteMask) { + switch (reg->Register.WriteMask) { case TGSI_WRITEMASK_X: sse_movss(cp->func, dst, get_xmm(cp, result)); break; @@ -710,14 +710,14 @@ static void store_dest( struct aos_compilation *cp, break; default: - mask_write(cp, dst, result, reg->DstRegister.WriteMask); + mask_write(cp, dst, result, reg->Register.WriteMask); break; } aos_adopt_xmm_reg(cp, dst, - reg->DstRegister.File, - reg->DstRegister.Index, + reg->Register.File, + reg->Register.Index, TRUE); } @@ -737,7 +737,7 @@ static void store_scalar_dest( struct aos_compilation *cp, const struct tgsi_full_dst_register *reg, struct x86_reg result ) { - unsigned writemask = reg->DstRegister.WriteMask; + unsigned writemask = reg->Register.WriteMask; struct x86_reg dst; if (writemask != TGSI_WRITEMASK_X && @@ -754,12 +754,12 @@ static void store_scalar_dest( struct aos_compilation *cp, result = get_xmm(cp, result); dst = aos_get_shader_reg_xmm(cp, - reg->DstRegister.File, - reg->DstRegister.Index); + reg->Register.File, + reg->Register.Index); - switch (reg->DstRegister.WriteMask) { + switch (reg->Register.WriteMask) { case TGSI_WRITEMASK_X: sse_movss(cp->func, dst, result); break; @@ -782,8 +782,8 @@ static void store_scalar_dest( struct aos_compilation *cp, aos_adopt_xmm_reg(cp, dst, - reg->DstRegister.File, - reg->DstRegister.Index, + reg->Register.File, + reg->Register.Index, TRUE); } @@ -819,7 +819,7 @@ static void x87_fstp_dest4( struct aos_compilation *cp, const struct tgsi_full_dst_register *dst ) { struct x86_reg ptr = get_dst_ptr(cp, dst); - unsigned writemask = dst->DstRegister.WriteMask; + unsigned writemask = dst->Register.WriteMask; x87_fst_or_nop(cp->func, writemask, 0, ptr); x87_fst_or_nop(cp->func, writemask, 1, ptr); @@ -1100,7 +1100,7 @@ static boolean emit_EX2( struct aos_compilation *cp, const struct tgsi_full_inst static boolean emit_FLR( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { struct x86_reg dst = get_dst_ptr(cp, &op->Dst[0]); - unsigned writemask = op->Dst[0].DstRegister.WriteMask; + unsigned writemask = op->Dst[0].Register.WriteMask; int i; set_fpu_round_neg_inf( cp ); @@ -1127,7 +1127,7 @@ static boolean emit_FLR( struct aos_compilation *cp, const struct tgsi_full_inst static boolean emit_RND( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { struct x86_reg dst = get_dst_ptr(cp, &op->Dst[0]); - unsigned writemask = op->Dst[0].DstRegister.WriteMask; + unsigned writemask = op->Dst[0].Register.WriteMask; int i; set_fpu_round_nearest( cp ); @@ -1156,7 +1156,7 @@ static boolean emit_FRC( struct aos_compilation *cp, const struct tgsi_full_inst struct x86_reg dst = get_dst_ptr(cp, &op->Dst[0]); struct x86_reg st0 = x86_make_reg(file_x87, 0); struct x86_reg st1 = x86_make_reg(file_x87, 1); - unsigned writemask = op->Dst[0].DstRegister.WriteMask; + unsigned writemask = op->Dst[0].Register.WriteMask; int i; set_fpu_round_neg_inf( cp ); @@ -1190,7 +1190,7 @@ static boolean emit_FRC( struct aos_compilation *cp, const struct tgsi_full_inst static boolean emit_LIT( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { struct x86_reg ecx = x86_make_reg( file_REG32, reg_CX ); - unsigned writemask = op->Dst[0].DstRegister.WriteMask; + unsigned writemask = op->Dst[0].Register.WriteMask; unsigned lit_count = cp->lit_count++; struct x86_reg result, arg0; unsigned i; @@ -1270,7 +1270,7 @@ static boolean emit_LIT( struct aos_compilation *cp, const struct tgsi_full_inst static boolean emit_inline_LIT( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { struct x86_reg dst = get_dst_ptr(cp, &op->Dst[0]); - unsigned writemask = op->Dst[0].DstRegister.WriteMask; + unsigned writemask = op->Dst[0].Register.WriteMask; if (writemask & TGSI_WRITEMASK_YZ) { struct x86_reg st1 = x86_make_reg(file_x87, 1); @@ -1897,10 +1897,10 @@ static void find_last_write_outputs( struct aos_compilation *cp ) continue; for (i = 0; i < TGSI_FULL_MAX_DST_REGISTERS; i++) { - if (parse.FullToken.FullInstruction.Dst[i].DstRegister.File == + if (parse.FullToken.FullInstruction.Dst[i].Register.File == TGSI_FILE_OUTPUT) { - unsigned idx = parse.FullToken.FullInstruction.Dst[i].DstRegister.Index; + unsigned idx = parse.FullToken.FullInstruction.Dst[i].Register.Index; cp->output_last_write[idx] = this_instruction; } } diff --git a/src/gallium/auxiliary/gallivm/tgsitollvm.cpp b/src/gallium/auxiliary/gallivm/tgsitollvm.cpp index 3edff0e5b2..135d307ce1 100644 --- a/src/gallium/auxiliary/gallivm/tgsitollvm.cpp +++ b/src/gallium/auxiliary/gallivm/tgsitollvm.cpp @@ -658,12 +658,12 @@ translate_instruction(llvm::Module *module, for (int i = 0; i < inst->Instruction.NumDstRegs; ++i) { struct tgsi_full_dst_register *dst = &inst->Dst[i]; - if (dst->DstRegister.File == TGSI_FILE_OUTPUT) { - storage->setOutputElement(dst->DstRegister.Index, out, dst->DstRegister.WriteMask); - } else if (dst->DstRegister.File == TGSI_FILE_TEMPORARY) { - storage->setTempElement(dst->DstRegister.Index, out, dst->DstRegister.WriteMask); - } else if (dst->DstRegister.File == TGSI_FILE_ADDRESS) { - storage->setAddrElement(dst->DstRegister.Index, out, dst->DstRegister.WriteMask); + if (dst->Register.File == TGSI_FILE_OUTPUT) { + storage->setOutputElement(dst->Register.Index, out, dst->Register.WriteMask); + } else if (dst->Register.File == TGSI_FILE_TEMPORARY) { + storage->setTempElement(dst->Register.Index, out, dst->Register.WriteMask); + } else if (dst->Register.File == TGSI_FILE_ADDRESS) { + storage->setAddrElement(dst->Register.Index, out, dst->Register.WriteMask); } else { fprintf(stderr, "ERROR: unsupported LLVM destination!"); assert(!"wrong destination"); @@ -994,8 +994,8 @@ translate_instructionir(llvm::Module *module, /* store results */ for (int i = 0; i < inst->Instruction.NumDstRegs; ++i) { struct tgsi_full_dst_register *dst = &inst->Dst[i]; - storage->store((enum tgsi_file_type)dst->DstRegister.File, - dst->DstRegister.Index, out, dst->DstRegister.WriteMask, + storage->store((enum tgsi_file_type)dst->Register.File, + dst->Register.Index, out, dst->Register.WriteMask, instr->getIRBuilder() ); } } diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index 094d8d52d8..91fb4f68e5 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -580,15 +580,15 @@ tgsi_build_full_instruction( size++; *dst_register = tgsi_build_dst_register( - reg->DstRegister.File, - reg->DstRegister.WriteMask, - reg->DstRegister.Indirect, - reg->DstRegister.Index, + reg->Register.File, + reg->Register.WriteMask, + reg->Register.Indirect, + reg->Register.Index, instruction, header ); prev_token = (struct tgsi_token *) dst_register; - if( reg->DstRegister.Indirect ) { + if( reg->Register.Indirect ) { struct tgsi_src_register *ind; if( maxsize <= size ) @@ -597,16 +597,16 @@ tgsi_build_full_instruction( size++; *ind = tgsi_build_src_register( - reg->DstRegisterInd.File, - reg->DstRegisterInd.SwizzleX, - reg->DstRegisterInd.SwizzleY, - reg->DstRegisterInd.SwizzleZ, - reg->DstRegisterInd.SwizzleW, - reg->DstRegisterInd.Negate, - reg->DstRegisterInd.Absolute, - reg->DstRegisterInd.Indirect, - reg->DstRegisterInd.Dimension, - reg->DstRegisterInd.Index, + reg->Indirect.File, + reg->Indirect.SwizzleX, + reg->Indirect.SwizzleY, + reg->Indirect.SwizzleZ, + reg->Indirect.SwizzleW, + reg->Indirect.Negate, + reg->Indirect.Absolute, + reg->Indirect.Indirect, + reg->Indirect.Dimension, + reg->Indirect.Index, instruction, header ); } @@ -980,8 +980,8 @@ tgsi_default_full_dst_register( void ) { struct tgsi_full_dst_register full_dst_register; - full_dst_register.DstRegister = tgsi_default_dst_register(); - full_dst_register.DstRegisterInd = tgsi_default_src_register(); + full_dst_register.Register = tgsi_default_dst_register(); + full_dst_register.Indirect = tgsi_default_src_register(); return full_dst_register; } diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index 7791f9f4fc..6141865f03 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -358,23 +358,23 @@ iter_instruction( CHR( ',' ); CHR( ' ' ); - if (dst->DstRegister.Indirect) { + if (dst->Register.Indirect) { _dump_register_ind( ctx, - dst->DstRegister.File, - dst->DstRegister.Index, - dst->DstRegisterInd.File, - dst->DstRegisterInd.Index, - dst->DstRegisterInd.SwizzleX ); + dst->Register.File, + dst->Register.Index, + dst->Indirect.File, + dst->Indirect.Index, + dst->Indirect.SwizzleX ); } else { _dump_register( ctx, - dst->DstRegister.File, - dst->DstRegister.Index, - dst->DstRegister.Index ); + dst->Register.File, + dst->Register.Index, + dst->Register.Index ); } - _dump_writemask( ctx, dst->DstRegister.WriteMask ); + _dump_writemask( ctx, dst->Register.WriteMask ); first_reg = FALSE; } diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c index 5593942154..5fae5a225f 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c @@ -339,48 +339,48 @@ dump_instruction_verbose( EOL(); TXT( "\nFile : " ); - ENM( dst->DstRegister.File, TGSI_FILES ); - if( deflt || fd->DstRegister.WriteMask != dst->DstRegister.WriteMask ) { + ENM( dst->Register.File, TGSI_FILES ); + if( deflt || fd->Register.WriteMask != dst->Register.WriteMask ) { TXT( "\nWriteMask: " ); - ENM( dst->DstRegister.WriteMask, TGSI_WRITEMASKS ); + ENM( dst->Register.WriteMask, TGSI_WRITEMASKS ); } if( ignored ) { - if( deflt || fd->DstRegister.Indirect != dst->DstRegister.Indirect ) { + if( deflt || fd->Register.Indirect != dst->Register.Indirect ) { TXT( "\nIndirect : " ); - UID( dst->DstRegister.Indirect ); + UID( dst->Register.Indirect ); } - if( deflt || fd->DstRegister.Dimension != dst->DstRegister.Dimension ) { + if( deflt || fd->Register.Dimension != dst->Register.Dimension ) { TXT( "\nDimension: " ); - UID( dst->DstRegister.Dimension ); + UID( dst->Register.Dimension ); } } - if( deflt || fd->DstRegister.Index != dst->DstRegister.Index ) { + if( deflt || fd->Register.Index != dst->Register.Index ) { TXT( "\nIndex : " ); - SID( dst->DstRegister.Index ); + SID( dst->Register.Index ); } if( ignored ) { TXT( "\nPadding : " ); - UIX( dst->DstRegister.Padding ); - if( deflt || fd->DstRegister.Extended != dst->DstRegister.Extended ) { + UIX( dst->Register.Padding ); + if( deflt || fd->Register.Extended != dst->Register.Extended ) { TXT( "\nExtended : " ); - UID( dst->DstRegister.Extended ); + UID( dst->Register.Extended ); } } - if( deflt || tgsi_compare_dst_register_ext_modulate( dst->DstRegisterExtModulate, fd->DstRegisterExtModulate ) ) { + if( deflt || tgsi_compare_dst_register_ext_modulate( dst->RegisterExtModulate, fd->RegisterExtModulate ) ) { EOL(); TXT( "\nType : " ); - ENM( dst->DstRegisterExtModulate.Type, TGSI_DST_REGISTER_EXTS ); - if( deflt || fd->DstRegisterExtModulate.Modulate != dst->DstRegisterExtModulate.Modulate ) { + ENM( dst->RegisterExtModulate.Type, TGSI_DST_REGISTER_EXTS ); + if( deflt || fd->RegisterExtModulate.Modulate != dst->RegisterExtModulate.Modulate ) { TXT( "\nModulate: " ); - ENM( dst->DstRegisterExtModulate.Modulate, TGSI_MODULATES ); + ENM( dst->RegisterExtModulate.Modulate, TGSI_MODULATES ); } if( ignored ) { TXT( "\nPadding : " ); - UIX( dst->DstRegisterExtModulate.Padding ); - if( deflt || fd->DstRegisterExtModulate.Extended != dst->DstRegisterExtModulate.Extended ) { + UIX( dst->RegisterExtModulate.Padding ); + if( deflt || fd->RegisterExtModulate.Extended != dst->RegisterExtModulate.Extended ) { TXT( "\nExtended: " ); - UID( dst->DstRegisterExtModulate.Extended ); + UID( dst->RegisterExtModulate.Extended ); } } } diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 3f8d59e46a..a6bd1a784f 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -107,10 +107,10 @@ #define TEMP_P0 TGSI_EXEC_TEMP_P0 #define IS_CHANNEL_ENABLED(INST, CHAN)\ - ((INST).Dst[0].DstRegister.WriteMask & (1 << (CHAN))) + ((INST).Dst[0].Register.WriteMask & (1 << (CHAN))) #define IS_CHANNEL_ENABLED2(INST, CHAN)\ - ((INST).Dst[1].DstRegister.WriteMask & (1 << (CHAN))) + ((INST).Dst[1].Register.WriteMask & (1 << (CHAN))) #define FOR_EACH_ENABLED_CHANNEL(INST, CHAN)\ for (CHAN = 0; CHAN < NUM_CHANNELS; CHAN++)\ @@ -188,7 +188,7 @@ tgsi_check_soa_dependencies(const struct tgsi_full_instruction *inst) { uint i, chan; - uint writemask = inst->Dst[0].DstRegister.WriteMask; + uint writemask = inst->Dst[0].Register.WriteMask; if (writemask == TGSI_WRITEMASK_X || writemask == TGSI_WRITEMASK_Y || writemask == TGSI_WRITEMASK_Z || @@ -201,9 +201,9 @@ tgsi_check_soa_dependencies(const struct tgsi_full_instruction *inst) /* loop over src regs */ for (i = 0; i < inst->Instruction.NumSrcRegs; i++) { if ((inst->Src[i].SrcRegister.File == - inst->Dst[0].DstRegister.File) && + inst->Dst[0].Register.File) && (inst->Src[i].SrcRegister.Index == - inst->Dst[0].DstRegister.Index)) { + inst->Dst[0].Register.Index)) { /* loop over dest channels */ uint channelsWritten = 0x0; FOR_EACH_ENABLED_CHANNEL(*inst, chan) { @@ -1424,11 +1424,11 @@ store_dest( * * file[ind[2].x+1], * where: - * ind = DstRegisterInd.File - * [2] = DstRegisterInd.Index - * .x = DstRegisterInd.SwizzleX + * ind = Indirect.File + * [2] = Indirect.Index + * .x = Indirect.SwizzleX */ - if (reg->DstRegister.Indirect) { + if (reg->Register.Indirect) { union tgsi_exec_channel index; union tgsi_exec_channel indir_index; uint swizzle; @@ -1437,15 +1437,15 @@ store_dest( index.i[0] = index.i[1] = index.i[2] = - index.i[3] = reg->DstRegisterInd.Index; + index.i[3] = reg->Indirect.Index; /* get current value of address register[swizzle] */ - swizzle = tgsi_util_get_src_register_swizzle( ®->DstRegisterInd, CHAN_X ); + swizzle = tgsi_util_get_src_register_swizzle( ®->Indirect, CHAN_X ); /* fetch values from the address/indirection register */ fetch_src_file_channel( mach, - reg->DstRegisterInd.File, + reg->Indirect.File, swizzle, &index, &indir_index ); @@ -1454,37 +1454,37 @@ store_dest( offset = (int) indir_index.f[0]; } - switch (reg->DstRegister.File) { + switch (reg->Register.File) { case TGSI_FILE_NULL: dst = &null; break; case TGSI_FILE_OUTPUT: index = mach->Temps[TEMP_OUTPUT_I].xyzw[TEMP_OUTPUT_C].u[0] - + reg->DstRegister.Index; + + reg->Register.Index; dst = &mach->Outputs[offset + index].xyzw[chan_index]; break; case TGSI_FILE_TEMPORARY: - index = reg->DstRegister.Index; + index = reg->Register.Index; assert( index < TGSI_EXEC_NUM_TEMPS ); dst = &mach->Temps[offset + index].xyzw[chan_index]; break; case TGSI_FILE_ADDRESS: - index = reg->DstRegister.Index; + index = reg->Register.Index; dst = &mach->Addrs[index].xyzw[chan_index]; break; case TGSI_FILE_LOOP: - assert(reg->DstRegister.Index == 0); + assert(reg->Register.Index == 0); assert(mach->LoopCounterStackTop > 0); assert(chan_index == CHAN_X); dst = &mach->LoopCounterStack[mach->LoopCounterStackTop - 1].xyzw[chan_index]; break; case TGSI_FILE_PREDICATE: - index = reg->DstRegister.Index; + index = reg->Register.Index; assert(index < TGSI_EXEC_NUM_PREDS); dst = &mach->Predicates[index].xyzw[chan_index]; break; diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c index 7946fdd732..e3a6bc0f54 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.c +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c @@ -168,21 +168,21 @@ tgsi_parse_token( for( i = 0; i < inst->Instruction.NumDstRegs; i++ ) { - next_token( ctx, &inst->Dst[i].DstRegister ); + next_token( ctx, &inst->Dst[i].Register ); /* * No support for indirect or multi-dimensional addressing. */ - assert( !inst->Dst[i].DstRegister.Dimension ); + assert( !inst->Dst[i].Register.Dimension ); - if( inst->Dst[i].DstRegister.Indirect ) { - next_token( ctx, &inst->Dst[i].DstRegisterInd ); + if( inst->Dst[i].Register.Indirect ) { + next_token( ctx, &inst->Dst[i].Indirect ); /* * No support for indirect or multi-dimensional addressing. */ - assert( !inst->Dst[i].DstRegisterInd.Dimension ); - assert( !inst->Dst[i].DstRegisterInd.Indirect ); + assert( !inst->Dst[i].Indirect.Dimension ); + assert( !inst->Dst[i].Indirect.Indirect ); } } diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h b/src/gallium/auxiliary/tgsi/tgsi_parse.h index 1965c5181d..331a533dd9 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.h +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h @@ -47,8 +47,8 @@ struct tgsi_full_header struct tgsi_full_dst_register { - struct tgsi_dst_register DstRegister; - struct tgsi_src_register DstRegisterInd; + struct tgsi_dst_register Register; + struct tgsi_src_register Indirect; }; struct tgsi_full_src_register diff --git a/src/gallium/auxiliary/tgsi/tgsi_ppc.c b/src/gallium/auxiliary/tgsi/tgsi_ppc.c index ec5f235143..adb16f6ac9 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ppc.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ppc.c @@ -60,7 +60,7 @@ const float ppc_builtin_constants[] ALIGN16_ATTRIB = { for (CHAN = 0; CHAN < NUM_CHANNELS; CHAN++) #define IS_DST0_CHANNEL_ENABLED( INST, CHAN )\ - ((INST).Dst[0].DstRegister.WriteMask & (1 << (CHAN))) + ((INST).Dst[0].Register.WriteMask & (1 << (CHAN))) #define IF_IS_DST0_CHANNEL_ENABLED( INST, CHAN )\ if (IS_DST0_CHANNEL_ENABLED( INST, CHAN )) @@ -167,8 +167,8 @@ is_ppc_vec_temporary(const struct tgsi_full_src_register *reg) static boolean is_ppc_vec_temporary_dst(const struct tgsi_full_dst_register *reg) { - return (reg->DstRegister.File == TGSI_FILE_TEMPORARY && - reg->DstRegister.Index < MAX_PPC_TEMPS); + return (reg->Register.File == TGSI_FILE_TEMPORARY && + reg->Register.Index < MAX_PPC_TEMPS); } @@ -485,7 +485,7 @@ get_dst_vec(struct gen_context *gen, const struct tgsi_full_dst_register *reg = &inst->Dst[0]; if (is_ppc_vec_temporary_dst(reg)) { - int vec = gen->temps_map[reg->DstRegister.Index][chan_index]; + int vec = gen->temps_map[reg->Register.Index][chan_index]; return vec; } else { @@ -507,10 +507,10 @@ emit_store(struct gen_context *gen, { const struct tgsi_full_dst_register *reg = &inst->Dst[0]; - switch (reg->DstRegister.File) { + switch (reg->Register.File) { case TGSI_FILE_OUTPUT: { - int offset = (reg->DstRegister.Index * 4 + chan_index) * 16; + int offset = (reg->Register.Index * 4 + chan_index) * 16; int offset_reg = emit_li_offset(gen, offset); ppc_stvx(gen->f, src_vec, gen->outputs_reg, offset_reg); } @@ -518,14 +518,14 @@ emit_store(struct gen_context *gen, case TGSI_FILE_TEMPORARY: if (is_ppc_vec_temporary_dst(reg)) { if (!free_vec) { - int dst_vec = gen->temps_map[reg->DstRegister.Index][chan_index]; + int dst_vec = gen->temps_map[reg->Register.Index][chan_index]; if (dst_vec != src_vec) ppc_vmove(gen->f, dst_vec, src_vec); } free_vec = FALSE; } else { - int offset = (reg->DstRegister.Index * 4 + chan_index) * 16; + int offset = (reg->Register.Index * 4 + chan_index) * 16; int offset_reg = emit_li_offset(gen, offset); ppc_stvx(gen->f, src_vec, gen->temps_reg, offset_reg); } @@ -535,7 +535,7 @@ emit_store(struct gen_context *gen, emit_addrs( func, xmm, - reg->DstRegister.Index, + reg->Register.Index, chan_index ); break; #endif diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c b/src/gallium/auxiliary/tgsi/tgsi_sanity.c index 005894e604..7e50e25353 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c @@ -212,8 +212,8 @@ iter_instruction( for (i = 0; i < inst->Instruction.NumDstRegs; i++) { check_register_usage( ctx, - inst->Dst[i].DstRegister.File, - inst->Dst[i].DstRegister.Index, + inst->Dst[i].Register.File, + inst->Dst[i].Register.Index, "destination", FALSE ); } @@ -245,8 +245,8 @@ iter_instruction( switch (inst->Instruction.Opcode) { case TGSI_OPCODE_BGNFOR: case TGSI_OPCODE_ENDFOR: - if (inst->Dst[0].DstRegister.File != TGSI_FILE_LOOP || - inst->Dst[0].DstRegister.Index != 0) { + if (inst->Dst[0].Register.File != TGSI_FILE_LOOP || + inst->Dst[0].Register.Index != 0) { report_error(ctx, "Destination register must be LOOP[0]"); } break; diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c index 6ca25c36ec..90832e71bb 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c @@ -212,8 +212,8 @@ tgsi_is_passthrough_shader(const struct tgsi_token *tokens) /* Do a whole bunch of checks for a simple move */ if (fullinst->Instruction.Opcode != TGSI_OPCODE_MOV || src->SrcRegister.File != TGSI_FILE_INPUT || - dst->DstRegister.File != TGSI_FILE_OUTPUT || - src->SrcRegister.Index != dst->DstRegister.Index || + dst->Register.File != TGSI_FILE_OUTPUT || + src->SrcRegister.Index != dst->Register.Index || src->SrcRegister.Negate || src->SrcRegister.Absolute || @@ -223,7 +223,7 @@ tgsi_is_passthrough_shader(const struct tgsi_token *tokens) src->SrcRegister.SwizzleZ != TGSI_SWIZZLE_Z || src->SrcRegister.SwizzleW != TGSI_SWIZZLE_W || - dst->DstRegister.WriteMask != TGSI_WRITEMASK_XYZW) + dst->Register.WriteMask != TGSI_WRITEMASK_XYZW) { tgsi_parse_free(&parse); return FALSE; diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index c23b0cc343..785076a520 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -58,7 +58,7 @@ for (CHAN = 0; CHAN < NUM_CHANNELS; CHAN++) #define IS_DST0_CHANNEL_ENABLED( INST, CHAN )\ - ((INST).Dst[0].DstRegister.WriteMask & (1 << (CHAN))) + ((INST).Dst[0].Register.WriteMask & (1 << (CHAN))) #define IF_IS_DST0_CHANNEL_ENABLED( INST, CHAN )\ if (IS_DST0_CHANNEL_ENABLED( INST, CHAN )) @@ -1371,12 +1371,12 @@ emit_store( } - switch( reg->DstRegister.File ) { + switch( reg->Register.File ) { case TGSI_FILE_OUTPUT: emit_output( func, xmm, - reg->DstRegister.Index, + reg->Register.Index, chan_index ); break; @@ -1384,7 +1384,7 @@ emit_store( emit_temps( func, xmm, - reg->DstRegister.Index, + reg->Register.Index, chan_index ); break; @@ -1392,7 +1392,7 @@ emit_store( emit_addrs( func, xmm, - reg->DstRegister.Index, + reg->Register.Index, chan_index ); break; @@ -1727,8 +1727,8 @@ indirect_temp_reference(const struct tgsi_full_instruction *inst) } for (i = 0; i < inst->Instruction.NumDstRegs; i++) { const struct tgsi_full_dst_register *reg = &inst->Dst[i]; - if (reg->DstRegister.File == TGSI_FILE_TEMPORARY && - reg->DstRegister.Indirect) + if (reg->Register.File == TGSI_FILE_TEMPORARY && + reg->Register.Indirect) return TRUE; } return FALSE; diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index 295ded9664..27b90f5ab7 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -506,9 +506,9 @@ parse_dst_operand( if (!parse_opt_writemask( ctx, &writemask )) return FALSE; - dst->DstRegister.File = file; - dst->DstRegister.Index = index; - dst->DstRegister.WriteMask = writemask; + dst->Register.File = file; + dst->Register.Index = index; + dst->Register.WriteMask = writemask; return TRUE; } diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index 34a02b5042..e31a46ba46 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -213,7 +213,7 @@ create_frag_shader(struct vl_compositor *c) */ for (i = 0; i < 4; ++i) { inst = vl_inst3(TGSI_OPCODE_DP4, TGSI_FILE_OUTPUT, 0, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_CONSTANT, i); - inst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; + inst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_X << i; ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index 93e79e7f37..4564a6c67f 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -240,7 +240,7 @@ create_intra_frag_shader(struct vl_mpeg12_mc_renderer *r) inst.Src[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; inst.Src[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; inst.Src[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; - inst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; + inst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_X << i; ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } @@ -418,7 +418,7 @@ create_frame_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) inst.Src[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; inst.Src[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; inst.Src[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; - inst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; + inst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_X << i; ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } @@ -623,7 +623,7 @@ create_frame_bi_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) inst.Src[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; inst.Src[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; inst.Src[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; - inst.Dst[0].DstRegister.WriteMask = TGSI_WRITEMASK_X << i; + inst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_X << i; ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } diff --git a/src/gallium/auxiliary/vl/vl_shader_build.c b/src/gallium/auxiliary/vl/vl_shader_build.c index 548dfca05a..9ebb4a9171 100644 --- a/src/gallium/auxiliary/vl/vl_shader_build.c +++ b/src/gallium/auxiliary/vl/vl_shader_build.c @@ -138,8 +138,8 @@ struct tgsi_full_instruction vl_inst2 inst.Instruction.Opcode = opcode; inst.Instruction.NumDstRegs = 1; - inst.Dst[0].DstRegister.File = dst_file; - inst.Dst[0].DstRegister.Index = dst_index; + inst.Dst[0].Register.File = dst_file; + inst.Dst[0].Register.Index = dst_index; inst.Instruction.NumSrcRegs = 1; inst.Src[0].SrcRegister.File = src_file; inst.Src[0].SrcRegister.Index = src_index; @@ -162,8 +162,8 @@ struct tgsi_full_instruction vl_inst3 inst.Instruction.Opcode = opcode; inst.Instruction.NumDstRegs = 1; - inst.Dst[0].DstRegister.File = dst_file; - inst.Dst[0].DstRegister.Index = dst_index; + inst.Dst[0].Register.File = dst_file; + inst.Dst[0].Register.Index = dst_index; inst.Instruction.NumSrcRegs = 2; inst.Src[0].SrcRegister.File = src1_file; inst.Src[0].SrcRegister.Index = src1_index; @@ -188,8 +188,8 @@ struct tgsi_full_instruction vl_tex inst.Instruction.Opcode = TGSI_OPCODE_TEX; inst.Instruction.NumDstRegs = 1; - inst.Dst[0].DstRegister.File = dst_file; - inst.Dst[0].DstRegister.Index = dst_index; + inst.Dst[0].Register.File = dst_file; + inst.Dst[0].Register.Index = dst_index; inst.Instruction.NumSrcRegs = 2; inst.Instruction.Texture = 1; inst.Texture.Texture = tex; @@ -218,8 +218,8 @@ struct tgsi_full_instruction vl_inst4 inst.Instruction.Opcode = opcode; inst.Instruction.NumDstRegs = 1; - inst.Dst[0].DstRegister.File = dst_file; - inst.Dst[0].DstRegister.Index = dst_index; + inst.Dst[0].Register.File = dst_file; + inst.Dst[0].Register.Index = dst_index; inst.Instruction.NumSrcRegs = 3; inst.Src[0].SrcRegister.File = src1_file; inst.Src[0].SrcRegister.Index = src1_index; diff --git a/src/gallium/drivers/cell/ppu/cell_gen_fp.c b/src/gallium/drivers/cell/ppu/cell_gen_fp.c index aeabe002d0..f639c62605 100644 --- a/src/gallium/drivers/cell/ppu/cell_gen_fp.c +++ b/src/gallium/drivers/cell/ppu/cell_gen_fp.c @@ -249,7 +249,7 @@ static boolean is_memory_dst(struct codegen *gen, int channel, const struct tgsi_full_dst_register *dst) { - if (dst->DstRegister.File == TGSI_FILE_OUTPUT) { + if (dst->Register.File == TGSI_FILE_OUTPUT) { return TRUE; } else { @@ -374,12 +374,12 @@ get_dst_reg(struct codegen *gen, { int reg = -1; - switch (dest->DstRegister.File) { + switch (dest->Register.File) { case TGSI_FILE_TEMPORARY: if (gen->if_nesting > 0 || gen->loop_nesting > 0) reg = get_itemp(gen); else - reg = gen->temp_regs[dest->DstRegister.Index][channel]; + reg = gen->temp_regs[dest->Register.Index][channel]; break; case TGSI_FILE_OUTPUT: reg = get_itemp(gen); @@ -419,10 +419,10 @@ store_dest_reg(struct codegen *gen, } #endif - switch (dest->DstRegister.File) { + switch (dest->Register.File) { case TGSI_FILE_TEMPORARY: if (gen->if_nesting > 0 || gen->loop_nesting > 0) { - int d_reg = gen->temp_regs[dest->DstRegister.Index][channel]; + int d_reg = gen->temp_regs[dest->Register.Index][channel]; int exec_reg = get_exec_mask_reg(gen); /* Mix d with new value according to exec mask: * d[i] = mask_reg[i] ? value_reg : d_reg @@ -437,7 +437,7 @@ store_dest_reg(struct codegen *gen, case TGSI_FILE_OUTPUT: { /* offset is measured in quadwords, not bytes */ - int offset = dest->DstRegister.Index * 4 + channel; + int offset = dest->Register.Index * 4 + channel; if (gen->if_nesting > 0 || gen->loop_nesting > 0) { int exec_reg = get_exec_mask_reg(gen); int curval_reg = get_itemp(gen); @@ -544,7 +544,7 @@ emit_epilogue(struct codegen *gen) #define FOR_EACH_ENABLED_CHANNEL(inst, ch) \ for (ch = 0; ch < 4; ch++) \ - if (inst->Dst[0].DstRegister.WriteMask & (1 << ch)) + if (inst->Dst[0].Register.WriteMask & (1 << ch)) static boolean @@ -948,7 +948,7 @@ emit_XPD(struct codegen *gen, const struct tgsi_full_instruction *inst) /* t = y0 * z1 - t */ spe_fms(gen->f, tmp_reg, s1_reg, s2_reg, tmp_reg); - if (inst->Dst[0].DstRegister.WriteMask & (1 << CHAN_X)) { + if (inst->Dst[0].Register.WriteMask & (1 << CHAN_X)) { store_dest_reg(gen, tmp_reg, CHAN_X, &inst->Dst[0]); } @@ -962,7 +962,7 @@ emit_XPD(struct codegen *gen, const struct tgsi_full_instruction *inst) /* t = z0 * x1 - t */ spe_fms(gen->f, tmp_reg, s1_reg, s2_reg, tmp_reg); - if (inst->Dst[0].DstRegister.WriteMask & (1 << CHAN_Y)) { + if (inst->Dst[0].Register.WriteMask & (1 << CHAN_Y)) { store_dest_reg(gen, tmp_reg, CHAN_Y, &inst->Dst[0]); } @@ -976,7 +976,7 @@ emit_XPD(struct codegen *gen, const struct tgsi_full_instruction *inst) /* t = x0 * y1 - t */ spe_fms(gen->f, tmp_reg, s1_reg, s2_reg, tmp_reg); - if (inst->Dst[0].DstRegister.WriteMask & (1 << CHAN_Z)) { + if (inst->Dst[0].Register.WriteMask & (1 << CHAN_Z)) { store_dest_reg(gen, tmp_reg, CHAN_Z, &inst->Dst[0]); } diff --git a/src/gallium/drivers/cell/spu/spu_exec.c b/src/gallium/drivers/cell/spu/spu_exec.c index ee5e3432d5..1b4792a316 100644 --- a/src/gallium/drivers/cell/spu/spu_exec.c +++ b/src/gallium/drivers/cell/spu/spu_exec.c @@ -108,10 +108,10 @@ for (CHAN = 0; CHAN < 4; CHAN++) #define IS_CHANNEL_ENABLED(INST, CHAN)\ - ((INST).Dst[0].DstRegister.WriteMask & (1 << (CHAN))) + ((INST).Dst[0].Register.WriteMask & (1 << (CHAN))) #define IS_CHANNEL_ENABLED2(INST, CHAN)\ - ((INST).Dst[1].DstRegister.WriteMask & (1 << (CHAN))) + ((INST).Dst[1].Register.WriteMask & (1 << (CHAN))) #define FOR_EACH_ENABLED_CHANNEL(INST, CHAN)\ FOR_EACH_CHANNEL( CHAN )\ @@ -532,21 +532,21 @@ store_dest( { union spu_exec_channel *dst; - switch( reg->DstRegister.File ) { + switch( reg->Register.File ) { case TGSI_FILE_NULL: return; case TGSI_FILE_OUTPUT: dst = &mach->Outputs[mach->Temps[TEMP_OUTPUT_I].xyzw[TEMP_OUTPUT_C].u[0] - + reg->DstRegister.Index].xyzw[chan_index]; + + reg->Register.Index].xyzw[chan_index]; break; case TGSI_FILE_TEMPORARY: - dst = &mach->Temps[reg->DstRegister.Index].xyzw[chan_index]; + dst = &mach->Temps[reg->Register.Index].xyzw[chan_index]; break; case TGSI_FILE_ADDRESS: - dst = &mach->Addrs[reg->DstRegister.Index].xyzw[chan_index]; + dst = &mach->Addrs[reg->Register.Index].xyzw[chan_index]; break; default: diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c b/src/gallium/drivers/i915/i915_fpc_translate.c index 1a4a7bbe62..13c280827a 100644 --- a/src/gallium/drivers/i915/i915_fpc_translate.c +++ b/src/gallium/drivers/i915/i915_fpc_translate.c @@ -246,10 +246,10 @@ static uint get_result_vector(struct i915_fp_compile *p, const struct tgsi_full_dst_register *dest) { - switch (dest->DstRegister.File) { + switch (dest->Register.File) { case TGSI_FILE_OUTPUT: { - uint sem_name = p->shader->info.output_semantic_name[dest->DstRegister.Index]; + uint sem_name = p->shader->info.output_semantic_name[dest->Register.Index]; switch (sem_name) { case TGSI_SEMANTIC_POSITION: return UREG(REG_TYPE_OD, 0); @@ -261,7 +261,7 @@ get_result_vector(struct i915_fp_compile *p, } } case TGSI_FILE_TEMPORARY: - return UREG(REG_TYPE_R, dest->DstRegister.Index); + return UREG(REG_TYPE_R, dest->Register.Index); default: i915_program_error(p, "Bad inst->DstReg.File"); return 0; @@ -276,7 +276,7 @@ static uint get_result_flags(const struct tgsi_full_instruction *inst) { const uint writeMask - = inst->Dst[0].DstRegister.WriteMask; + = inst->Dst[0].Register.WriteMask; uint flags = 0x0; if (inst->Instruction.Saturate == TGSI_SAT_ZERO_ONE) @@ -738,7 +738,7 @@ i915_translate_instruction(struct i915_fp_compile *p, swizzle(tmp, X, Y, X, Y), swizzle(tmp, X, X, ONE, ONE), 0); - writemask = inst->Dst[0].DstRegister.WriteMask; + writemask = inst->Dst[0].Register.WriteMask; if (writemask & TGSI_WRITEMASK_Y) { uint tmp1; diff --git a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c index 893e665e69..99266f34ed 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c @@ -64,7 +64,7 @@ for (CHAN = 0; CHAN < NUM_CHANNELS; CHAN++) #define IS_DST0_CHANNEL_ENABLED( INST, CHAN )\ - ((INST)->Dst[0].DstRegister.WriteMask & (1 << (CHAN))) + ((INST)->Dst[0].Register.WriteMask & (1 << (CHAN))) #define IF_IS_DST0_CHANNEL_ENABLED( INST, CHAN )\ if (IS_DST0_CHANNEL_ENABLED( INST, CHAN )) @@ -287,13 +287,13 @@ emit_store( assert(0); } - switch( reg->DstRegister.File ) { + switch( reg->Register.File ) { case TGSI_FILE_OUTPUT: - bld->outputs[reg->DstRegister.Index][chan_index] = value; + bld->outputs[reg->Register.Index][chan_index] = value; break; case TGSI_FILE_TEMPORARY: - bld->temps[reg->DstRegister.Index][chan_index] = value; + bld->temps[reg->Register.Index][chan_index] = value; break; case TGSI_FILE_ADDRESS: @@ -430,8 +430,8 @@ indirect_temp_reference(const struct tgsi_full_instruction *inst) } for (i = 0; i < inst->Instruction.NumDstRegs; i++) { const struct tgsi_full_dst_register *reg = &inst->Dst[i]; - if (reg->DstRegister.File == TGSI_FILE_TEMPORARY && - reg->DstRegister.Indirect) + if (reg->Register.File == TGSI_FILE_TEMPORARY && + reg->Register.Indirect) return TRUE; } return FALSE; diff --git a/src/gallium/drivers/nv20/nv20_vertprog.c b/src/gallium/drivers/nv20/nv20_vertprog.c index abffbe33a8..e3bb9f9d7f 100644 --- a/src/gallium/drivers/nv20/nv20_vertprog.c +++ b/src/gallium/drivers/nv20/nv20_vertprog.c @@ -286,14 +286,14 @@ static INLINE struct nv20_sreg tgsi_dst(struct nv20_vpc *vpc, const struct tgsi_full_dst_register *fdst) { struct nv20_sreg dst; - switch (fdst->DstRegister.File) { + switch (fdst->Register.File) { case TGSI_FILE_OUTPUT: dst = nv20_sr(NV30SR_OUTPUT, - vpc->output_map[fdst->DstRegister.Index]); + vpc->output_map[fdst->Register.Index]); break; case TGSI_FILE_TEMPORARY: - dst = nv20_sr(NV30SR_TEMP, fdst->DstRegister.Index); + dst = nv20_sr(NV30SR_TEMP, fdst->Register.Index); if (vpc->high_temp < dst.index) vpc->high_temp = dst.index; break; @@ -379,7 +379,7 @@ nv20_vertprog_parse_instruction(struct nv20_vpc *vpc, } dst = tgsi_dst(vpc, &finst->Dst[0]); - mask = tgsi_mask(finst->Dst[0].DstRegister.WriteMask); + mask = tgsi_mask(finst->Dst[0].Register.WriteMask); switch (finst->Instruction.Opcode) { case TGSI_OPCODE_ABS: diff --git a/src/gallium/drivers/nv30/nv30_fragprog.c b/src/gallium/drivers/nv30/nv30_fragprog.c index 20f7d4152c..14dc884b3a 100644 --- a/src/gallium/drivers/nv30/nv30_fragprog.c +++ b/src/gallium/drivers/nv30/nv30_fragprog.c @@ -281,22 +281,22 @@ static INLINE struct nv30_sreg tgsi_dst(struct nv30_fpc *fpc, const struct tgsi_full_dst_register *fdst) { int idx; - switch (fdst->DstRegister.File) { + switch (fdst->Register.File) { case TGSI_FILE_OUTPUT: - if (fdst->DstRegister.Index == fpc->colour_id) + if (fdst->Register.Index == fpc->colour_id) return nv30_sr(NV30SR_OUTPUT, 0); else return nv30_sr(NV30SR_OUTPUT, 1); break; case TGSI_FILE_TEMPORARY: - idx = fdst->DstRegister.Index + 1; + idx = fdst->Register.Index + 1; if (fpc->high_temp < idx) fpc->high_temp = idx; return nv30_sr(NV30SR_TEMP, idx); case TGSI_FILE_NULL: return nv30_sr(NV30SR_NONE, 0); default: - NOUVEAU_ERR("bad dst file %d\n", fdst->DstRegister.File); + NOUVEAU_ERR("bad dst file %d\n", fdst->Register.File); return nv30_sr(NV30SR_NONE, 0); } } @@ -424,7 +424,7 @@ nv30_fragprog_parse_instruction(struct nv30_fpc *fpc, } dst = tgsi_dst(fpc, &finst->Dst[0]); - mask = tgsi_mask(finst->Dst[0].DstRegister.WriteMask); + mask = tgsi_mask(finst->Dst[0].Register.WriteMask); sat = (finst->Instruction.Saturate == TGSI_SAT_ZERO_ONE); switch (finst->Instruction.Opcode) { diff --git a/src/gallium/drivers/nv30/nv30_vertprog.c b/src/gallium/drivers/nv30/nv30_vertprog.c index 99fde93245..41e4161dda 100644 --- a/src/gallium/drivers/nv30/nv30_vertprog.c +++ b/src/gallium/drivers/nv30/nv30_vertprog.c @@ -286,14 +286,14 @@ static INLINE struct nv30_sreg tgsi_dst(struct nv30_vpc *vpc, const struct tgsi_full_dst_register *fdst) { struct nv30_sreg dst; - switch (fdst->DstRegister.File) { + switch (fdst->Register.File) { case TGSI_FILE_OUTPUT: dst = nv30_sr(NV30SR_OUTPUT, - vpc->output_map[fdst->DstRegister.Index]); + vpc->output_map[fdst->Register.Index]); break; case TGSI_FILE_TEMPORARY: - dst = nv30_sr(NV30SR_TEMP, fdst->DstRegister.Index); + dst = nv30_sr(NV30SR_TEMP, fdst->Register.Index); if (vpc->high_temp < dst.index) vpc->high_temp = dst.index; break; @@ -379,7 +379,7 @@ nv30_vertprog_parse_instruction(struct nv30_vpc *vpc, } dst = tgsi_dst(vpc, &finst->Dst[0]); - mask = tgsi_mask(finst->Dst[0].DstRegister.WriteMask); + mask = tgsi_mask(finst->Dst[0].Register.WriteMask); switch (finst->Instruction.Opcode) { case TGSI_OPCODE_ABS: diff --git a/src/gallium/drivers/nv40/nv40_fragprog.c b/src/gallium/drivers/nv40/nv40_fragprog.c index 8e8cba1a0c..02c23e92c0 100644 --- a/src/gallium/drivers/nv40/nv40_fragprog.c +++ b/src/gallium/drivers/nv40/nv40_fragprog.c @@ -290,15 +290,15 @@ tgsi_src(struct nv40_fpc *fpc, const struct tgsi_full_src_register *fsrc) static INLINE struct nv40_sreg tgsi_dst(struct nv40_fpc *fpc, const struct tgsi_full_dst_register *fdst) { - switch (fdst->DstRegister.File) { + switch (fdst->Register.File) { case TGSI_FILE_OUTPUT: - return fpc->r_result[fdst->DstRegister.Index]; + return fpc->r_result[fdst->Register.Index]; case TGSI_FILE_TEMPORARY: - return fpc->r_temp[fdst->DstRegister.Index]; + return fpc->r_temp[fdst->Register.Index]; case TGSI_FILE_NULL: return nv40_sr(NV40SR_NONE, 0); default: - NOUVEAU_ERR("bad dst file %d\n", fdst->DstRegister.File); + NOUVEAU_ERR("bad dst file %d\n", fdst->Register.File); return nv40_sr(NV40SR_NONE, 0); } } @@ -434,7 +434,7 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc, } dst = tgsi_dst(fpc, &finst->Dst[0]); - mask = tgsi_mask(finst->Dst[0].DstRegister.WriteMask); + mask = tgsi_mask(finst->Dst[0].Register.WriteMask); sat = (finst->Instruction.Saturate == TGSI_SAT_ZERO_ONE); switch (finst->Instruction.Opcode) { diff --git a/src/gallium/drivers/nv40/nv40_vertprog.c b/src/gallium/drivers/nv40/nv40_vertprog.c index 913e050389..c4f51d622c 100644 --- a/src/gallium/drivers/nv40/nv40_vertprog.c +++ b/src/gallium/drivers/nv40/nv40_vertprog.c @@ -326,15 +326,15 @@ static INLINE struct nv40_sreg tgsi_dst(struct nv40_vpc *vpc, const struct tgsi_full_dst_register *fdst) { struct nv40_sreg dst; - switch (fdst->DstRegister.File) { + switch (fdst->Register.File) { case TGSI_FILE_OUTPUT: - dst = vpc->r_result[fdst->DstRegister.Index]; + dst = vpc->r_result[fdst->Register.Index]; break; case TGSI_FILE_TEMPORARY: - dst = vpc->r_temp[fdst->DstRegister.Index]; + dst = vpc->r_temp[fdst->Register.Index]; break; case TGSI_FILE_ADDRESS: - dst = vpc->r_address[fdst->DstRegister.Index]; + dst = vpc->r_address[fdst->Register.Index]; break; default: NOUVEAU_ERR("bad dst file\n"); @@ -470,7 +470,7 @@ nv40_vertprog_parse_instruction(struct nv40_vpc *vpc, } dst = tgsi_dst(vpc, &finst->Dst[0]); - mask = tgsi_mask(finst->Dst[0].DstRegister.WriteMask); + mask = tgsi_mask(finst->Dst[0].Register.WriteMask); switch (finst->Instruction.Opcode) { case TGSI_OPCODE_ABS: @@ -683,9 +683,9 @@ nv40_vertprog_prepare(struct nv40_vpc *vpc) finst = &p.FullToken.FullInstruction; fdst = &finst->Dst[0]; - if (fdst->DstRegister.File == TGSI_FILE_ADDRESS) { - if (fdst->DstRegister.Index > high_addr) - high_addr = fdst->DstRegister.Index; + if (fdst->Register.File == TGSI_FILE_ADDRESS) { + if (fdst->Register.Index > high_addr) + high_addr = fdst->Register.Index; } } diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 57747a1840..3409edb4c8 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -1549,7 +1549,7 @@ negate_supported(const struct tgsi_full_instruction *insn, int i) static unsigned nv50_tgsi_src_mask(const struct tgsi_full_instruction *insn, int c) { - unsigned x, mask = insn->Dst[0].DstRegister.WriteMask; + unsigned x, mask = insn->Dst[0].Register.WriteMask; switch (insn->Instruction.Opcode) { case TGSI_OPCODE_COS: @@ -1612,17 +1612,17 @@ nv50_tgsi_src_mask(const struct tgsi_full_instruction *insn, int c) static struct nv50_reg * tgsi_dst(struct nv50_pc *pc, int c, const struct tgsi_full_dst_register *dst) { - switch (dst->DstRegister.File) { + switch (dst->Register.File) { case TGSI_FILE_TEMPORARY: - return &pc->temp[dst->DstRegister.Index * 4 + c]; + return &pc->temp[dst->Register.Index * 4 + c]; case TGSI_FILE_OUTPUT: - return &pc->result[dst->DstRegister.Index * 4 + c]; + return &pc->result[dst->Register.Index * 4 + c]; case TGSI_FILE_ADDRESS: { - struct nv50_reg *r = pc->addr[dst->DstRegister.Index * 4 + c]; + struct nv50_reg *r = pc->addr[dst->Register.Index * 4 + c]; if (!r) { r = alloc_addr(pc, NULL); - pc->addr[dst->DstRegister.Index * 4 + c] = r; + pc->addr[dst->Register.Index * 4 + c] = r; } assert(r); return r; @@ -1850,7 +1850,7 @@ nv50_program_tx_insn(struct nv50_pc *pc, unsigned mask, sat, unit; int i, c; - mask = inst->Dst[0].DstRegister.WriteMask; + mask = inst->Dst[0].Register.WriteMask; sat = inst->Instruction.Saturate == TGSI_SAT_ZERO_ONE; memset(src, 0, sizeof(src)); @@ -2264,7 +2264,7 @@ prep_inspect_insn(struct nv50_pc *pc, const struct tgsi_full_instruction *insn) const struct tgsi_dst_register *dst; unsigned i, c, k, mask; - dst = &insn->Dst[0].DstRegister; + dst = &insn->Dst[0].Register; mask = dst->WriteMask; if (dst->File == TGSI_FILE_TEMPORARY) @@ -2359,13 +2359,13 @@ static struct nv50_reg * tgsi_broadcast_dst(struct nv50_pc *pc, const struct tgsi_full_dst_register *fd, unsigned mask) { - if (fd->DstRegister.File == TGSI_FILE_TEMPORARY) { - int c = ffs(~mask & fd->DstRegister.WriteMask); + if (fd->Register.File == TGSI_FILE_TEMPORARY) { + int c = ffs(~mask & fd->Register.WriteMask); if (c) return tgsi_dst(pc, c - 1, fd); } else { - int c = ffs(fd->DstRegister.WriteMask) - 1; - if ((1 << c) == fd->DstRegister.WriteMask) + int c = ffs(fd->Register.WriteMask) - 1; + if ((1 << c) == fd->Register.WriteMask) return tgsi_dst(pc, c, fd); } @@ -2391,8 +2391,8 @@ nv50_tgsi_scan_swizzle(const struct tgsi_full_instruction *insn, boolean neg_supp = negate_supported(insn, i); fs = &insn->Src[i]; - if (fs->SrcRegister.File != fd->DstRegister.File || - fs->SrcRegister.Index != fd->DstRegister.Index) + if (fs->SrcRegister.File != fd->Register.File || + fs->SrcRegister.Index != fd->Register.Index) continue; for (chn = 0; chn < 4; ++chn) { @@ -2403,7 +2403,7 @@ nv50_tgsi_scan_swizzle(const struct tgsi_full_instruction *insn, c = tgsi_util_get_full_src_register_swizzle(fs, chn); s = tgsi_util_get_full_src_register_sign_mode(fs, chn); - if (!(fd->DstRegister.WriteMask & (1 << c))) + if (!(fd->Register.WriteMask & (1 << c))) continue; /* no danger if src is copied to TEMP first */ @@ -2446,10 +2446,10 @@ nv50_tgsi_insn(struct nv50_pc *pc, const union tgsi_full_token *tok) for (i = 0; i < 4; ++i) { assert(pc->r_dst[m[i]] == NULL); - insn.Dst[0].DstRegister.WriteMask = - fd->DstRegister.WriteMask & (1 << m[i]); + insn.Dst[0].Register.WriteMask = + fd->Register.WriteMask & (1 << m[i]); - if (!insn.Dst[0].DstRegister.WriteMask) + if (!insn.Dst[0].Register.WriteMask) continue; if (deqs & (1 << i)) diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/src/gallium/drivers/r300/r300_tgsi_to_rc.c index 82466e245a..92796d150b 100644 --- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c +++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c @@ -190,10 +190,10 @@ static void transform_dstreg( struct rc_dst_register * dst, struct tgsi_full_dst_register * src) { - dst->File = translate_register_file(src->DstRegister.File); - dst->Index = translate_register_index(ttr, src->DstRegister.File, src->DstRegister.Index); - dst->WriteMask = src->DstRegister.WriteMask; - dst->RelAddr = src->DstRegister.Indirect; + dst->File = translate_register_file(src->Register.File); + dst->Index = translate_register_index(ttr, src->Register.File, src->Register.Index); + dst->WriteMask = src->Register.WriteMask; + dst->RelAddr = src->Register.Indirect; } static void transform_srcreg( diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c b/src/gallium/drivers/svga/svga_tgsi_insn.c index 39fd7a6025..9ca89f1cdd 100644 --- a/src/gallium/drivers/svga/svga_tgsi_insn.c +++ b/src/gallium/drivers/svga/svga_tgsi_insn.c @@ -99,21 +99,21 @@ translate_dst_register( struct svga_shader_emitter *emit, const struct tgsi_full_dst_register *reg = &insn->Dst[idx]; SVGA3dShaderDestToken dest; - switch (reg->DstRegister.File) { + switch (reg->Register.File) { case TGSI_FILE_OUTPUT: /* Output registers encode semantic information in their name. * Need to lookup a table built at decl time: */ - dest = emit->output_map[reg->DstRegister.Index]; + dest = emit->output_map[reg->Register.Index]; break; default: - dest = dst_register( translate_file( reg->DstRegister.File ), - reg->DstRegister.Index ); + dest = dst_register( translate_file( reg->Register.File ), + reg->Register.Index ); break; } - dest.mask = reg->DstRegister.WriteMask; + dest.mask = reg->Register.WriteMask; if (insn->Instruction.Saturate) dest.dstMod = SVGA3DDSTMOD_SATURATE; @@ -1434,7 +1434,7 @@ static boolean emit_pow(struct svga_shader_emitter *emit, boolean need_tmp = FALSE; /* POW can only output to a temporary */ - if (insn->Dst[0].DstRegister.File != TGSI_FILE_TEMPORARY) + if (insn->Dst[0].Register.File != TGSI_FILE_TEMPORARY) need_tmp = TRUE; /* POW src1 must not be the same register as dst */ -- cgit v1.2.3 From 91a4e6d53f83c45c1da9240b6325011d96b61386 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 24 Nov 2009 15:13:17 +0000 Subject: tgsi: rename fields of tgsi_full_src_register to reduce verbosity SrcRegister -> Register SrcRegisterInd -> Indirect SrcRegisterDim -> Dimension SrcRegisterDimInd -> DimIndirect --- src/gallium/auxiliary/draw/draw_pipe_aaline.c | 20 +-- src/gallium/auxiliary/draw/draw_pipe_aapoint.c | 158 +++++++++++------------ src/gallium/auxiliary/draw/draw_pipe_pstipple.c | 22 ++-- src/gallium/auxiliary/draw/draw_vs_aos.c | 8 +- src/gallium/auxiliary/gallivm/tgsitollvm.cpp | 34 ++--- src/gallium/auxiliary/tgsi/tgsi_build.c | 80 ++++++------ src/gallium/auxiliary/tgsi/tgsi_dump.c | 42 +++--- src/gallium/auxiliary/tgsi/tgsi_dump_c.c | 68 +++++----- src/gallium/auxiliary/tgsi/tgsi_exec.c | 60 ++++----- src/gallium/auxiliary/tgsi/tgsi_parse.c | 24 ++-- src/gallium/auxiliary/tgsi/tgsi_parse.h | 8 +- src/gallium/auxiliary/tgsi/tgsi_ppc.c | 20 +-- src/gallium/auxiliary/tgsi/tgsi_sanity.c | 16 +-- src/gallium/auxiliary/tgsi/tgsi_scan.c | 24 ++-- src/gallium/auxiliary/tgsi/tgsi_sse2.c | 22 ++-- src/gallium/auxiliary/tgsi/tgsi_text.c | 32 ++--- src/gallium/auxiliary/tgsi/tgsi_util.c | 24 ++-- src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 26 ++-- src/gallium/auxiliary/vl/vl_shader_build.c | 32 ++--- src/gallium/drivers/cell/ppu/cell_gen_fp.c | 14 +- src/gallium/drivers/cell/spu/spu_exec.c | 36 +++--- src/gallium/drivers/cell/spu/spu_util.c | 10 +- src/gallium/drivers/i915/i915_fpc_translate.c | 20 +-- src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c | 16 +-- src/gallium/drivers/nv20/nv20_vertprog.c | 38 +++--- src/gallium/drivers/nv30/nv30_fragprog.c | 44 +++---- src/gallium/drivers/nv30/nv30_vertprog.c | 38 +++--- src/gallium/drivers/nv40/nv40_fragprog.c | 46 +++---- src/gallium/drivers/nv40/nv40_vertprog.c | 40 +++--- src/gallium/drivers/nv50/nv50_program.c | 46 +++---- src/gallium/drivers/r300/r300_tgsi_to_rc.c | 14 +- src/gallium/drivers/svga/svga_tgsi_insn.c | 68 +++++----- 32 files changed, 575 insertions(+), 575 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index fe200983ca..3bb9616122 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -270,10 +270,10 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst.Instruction.NumSrcRegs = 2; newInst.Instruction.Texture = TRUE; newInst.Texture.Texture = TGSI_TEXTURE_2D; - newInst.Src[0].SrcRegister.File = TGSI_FILE_INPUT; - newInst.Src[0].SrcRegister.Index = aactx->maxInput + 1; - newInst.Src[1].SrcRegister.File = TGSI_FILE_SAMPLER; - newInst.Src[1].SrcRegister.Index = aactx->freeSampler; + newInst.Src[0].Register.File = TGSI_FILE_INPUT; + newInst.Src[0].Register.Index = aactx->maxInput + 1; + newInst.Src[1].Register.File = TGSI_FILE_SAMPLER; + newInst.Src[1].Register.Index = aactx->freeSampler; ctx->emit_instruction(ctx, &newInst); @@ -285,8 +285,8 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst.Dst[0].Register.Index = aactx->colorOutput; newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_XYZ; newInst.Instruction.NumSrcRegs = 1; - newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.Src[0].SrcRegister.Index = aactx->colorTemp; + newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].Register.Index = aactx->colorTemp; ctx->emit_instruction(ctx, &newInst); /* MUL alpha */ @@ -297,10 +297,10 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst.Dst[0].Register.Index = aactx->colorOutput; newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_W; newInst.Instruction.NumSrcRegs = 2; - newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.Src[0].SrcRegister.Index = aactx->colorTemp; - newInst.Src[1].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.Src[1].SrcRegister.Index = aactx->texTemp; + newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].Register.Index = aactx->colorTemp; + newInst.Src[1].Register.File = TGSI_FILE_TEMPORARY; + newInst.Src[1].Register.Index = aactx->texTemp; ctx->emit_instruction(ctx, &newInst); /* END */ diff --git a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c index 39e1406e96..75130a8fb0 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aapoint.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aapoint.c @@ -238,10 +238,10 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst.Dst[0].Register.Index = tmp0; newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_XY; newInst.Instruction.NumSrcRegs = 2; - newInst.Src[0].SrcRegister.File = TGSI_FILE_INPUT; - newInst.Src[0].SrcRegister.Index = texInput; - newInst.Src[1].SrcRegister.File = TGSI_FILE_INPUT; - newInst.Src[1].SrcRegister.Index = texInput; + newInst.Src[0].Register.File = TGSI_FILE_INPUT; + newInst.Src[0].Register.Index = texInput; + newInst.Src[1].Register.File = TGSI_FILE_INPUT; + newInst.Src[1].Register.Index = texInput; ctx->emit_instruction(ctx, &newInst); /* ADD t0.x, t0.x, t0.y; # x^2 + y^2 */ @@ -252,12 +252,12 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst.Dst[0].Register.Index = tmp0; newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_X; newInst.Instruction.NumSrcRegs = 2; - newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.Src[0].SrcRegister.Index = tmp0; - newInst.Src[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; - newInst.Src[1].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.Src[1].SrcRegister.Index = tmp0; - newInst.Src[1].SrcRegister.SwizzleX = TGSI_SWIZZLE_Y; + newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].Register.Index = tmp0; + newInst.Src[0].Register.SwizzleX = TGSI_SWIZZLE_X; + newInst.Src[1].Register.File = TGSI_FILE_TEMPORARY; + newInst.Src[1].Register.Index = tmp0; + newInst.Src[1].Register.SwizzleX = TGSI_SWIZZLE_Y; ctx->emit_instruction(ctx, &newInst); #if NORMALIZE /* OPTIONAL normalization of length */ @@ -269,8 +269,8 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst.Dst[0].Register.Index = tmp0; newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_X; newInst.Instruction.NumSrcRegs = 1; - newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.Src[0].SrcRegister.Index = tmp0; + newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].Register.Index = tmp0; ctx->emit_instruction(ctx, &newInst); /* RCP t0.x, t0.x; */ @@ -281,8 +281,8 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst.Dst[0].Register.Index = tmp0; newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_X; newInst.Instruction.NumSrcRegs = 1; - newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.Src[0].SrcRegister.Index = tmp0; + newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].Register.Index = tmp0; ctx->emit_instruction(ctx, &newInst); #endif @@ -294,12 +294,12 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst.Dst[0].Register.Index = tmp0; newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_Y; newInst.Instruction.NumSrcRegs = 2; - newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.Src[0].SrcRegister.Index = tmp0; - newInst.Src[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - newInst.Src[1].SrcRegister.File = TGSI_FILE_INPUT; - newInst.Src[1].SrcRegister.Index = texInput; - newInst.Src[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_W; + newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].Register.Index = tmp0; + newInst.Src[0].Register.SwizzleY = TGSI_SWIZZLE_X; + newInst.Src[1].Register.File = TGSI_FILE_INPUT; + newInst.Src[1].Register.Index = texInput; + newInst.Src[1].Register.SwizzleY = TGSI_SWIZZLE_W; ctx->emit_instruction(ctx, &newInst); /* KIL -tmp0.yyyy; # if -tmp0.y < 0, KILL */ @@ -307,13 +307,13 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst.Instruction.Opcode = TGSI_OPCODE_KIL; newInst.Instruction.NumDstRegs = 0; newInst.Instruction.NumSrcRegs = 1; - newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.Src[0].SrcRegister.Index = tmp0; - newInst.Src[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_Y; - newInst.Src[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_Y; - newInst.Src[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_Y; - newInst.Src[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_Y; - newInst.Src[0].SrcRegister.Negate = 1; + newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].Register.Index = tmp0; + newInst.Src[0].Register.SwizzleX = TGSI_SWIZZLE_Y; + newInst.Src[0].Register.SwizzleY = TGSI_SWIZZLE_Y; + newInst.Src[0].Register.SwizzleZ = TGSI_SWIZZLE_Y; + newInst.Src[0].Register.SwizzleW = TGSI_SWIZZLE_Y; + newInst.Src[0].Register.Negate = 1; ctx->emit_instruction(ctx, &newInst); @@ -327,12 +327,12 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst.Dst[0].Register.Index = tmp0; newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_Z; newInst.Instruction.NumSrcRegs = 2; - newInst.Src[0].SrcRegister.File = TGSI_FILE_INPUT; - newInst.Src[0].SrcRegister.Index = texInput; - newInst.Src[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_W; - newInst.Src[1].SrcRegister.File = TGSI_FILE_INPUT; - newInst.Src[1].SrcRegister.Index = texInput; - newInst.Src[1].SrcRegister.SwizzleZ = TGSI_SWIZZLE_Z; + newInst.Src[0].Register.File = TGSI_FILE_INPUT; + newInst.Src[0].Register.Index = texInput; + newInst.Src[0].Register.SwizzleZ = TGSI_SWIZZLE_W; + newInst.Src[1].Register.File = TGSI_FILE_INPUT; + newInst.Src[1].Register.Index = texInput; + newInst.Src[1].Register.SwizzleZ = TGSI_SWIZZLE_Z; ctx->emit_instruction(ctx, &newInst); /* RCP t0.z, t0.z; # t0.z = 1 / m */ @@ -343,9 +343,9 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst.Dst[0].Register.Index = tmp0; newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_Z; newInst.Instruction.NumSrcRegs = 1; - newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.Src[0].SrcRegister.Index = tmp0; - newInst.Src[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_Z; + newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].Register.Index = tmp0; + newInst.Src[0].Register.SwizzleX = TGSI_SWIZZLE_Z; ctx->emit_instruction(ctx, &newInst); /* SUB t0.y, 1, t0.x; # d = 1 - d */ @@ -356,12 +356,12 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst.Dst[0].Register.Index = tmp0; newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_Y; newInst.Instruction.NumSrcRegs = 2; - newInst.Src[0].SrcRegister.File = TGSI_FILE_INPUT; - newInst.Src[0].SrcRegister.Index = texInput; - newInst.Src[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_W; - newInst.Src[1].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.Src[1].SrcRegister.Index = tmp0; - newInst.Src[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; + newInst.Src[0].Register.File = TGSI_FILE_INPUT; + newInst.Src[0].Register.Index = texInput; + newInst.Src[0].Register.SwizzleY = TGSI_SWIZZLE_W; + newInst.Src[1].Register.File = TGSI_FILE_TEMPORARY; + newInst.Src[1].Register.Index = tmp0; + newInst.Src[1].Register.SwizzleY = TGSI_SWIZZLE_X; ctx->emit_instruction(ctx, &newInst); /* MUL t0.w, t0.y, t0.z; # coverage = d * m */ @@ -372,12 +372,12 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst.Dst[0].Register.Index = tmp0; newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_W; newInst.Instruction.NumSrcRegs = 2; - newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.Src[0].SrcRegister.Index = tmp0; - newInst.Src[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_Y; - newInst.Src[1].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.Src[1].SrcRegister.Index = tmp0; - newInst.Src[1].SrcRegister.SwizzleW = TGSI_SWIZZLE_Z; + newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].Register.Index = tmp0; + newInst.Src[0].Register.SwizzleW = TGSI_SWIZZLE_Y; + newInst.Src[1].Register.File = TGSI_FILE_TEMPORARY; + newInst.Src[1].Register.Index = tmp0; + newInst.Src[1].Register.SwizzleW = TGSI_SWIZZLE_Z; ctx->emit_instruction(ctx, &newInst); /* SLE t0.y, t0.x, tex.z; # bool b = distance <= k */ @@ -388,12 +388,12 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst.Dst[0].Register.Index = tmp0; newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_Y; newInst.Instruction.NumSrcRegs = 2; - newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.Src[0].SrcRegister.Index = tmp0; - newInst.Src[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - newInst.Src[1].SrcRegister.File = TGSI_FILE_INPUT; - newInst.Src[1].SrcRegister.Index = texInput; - newInst.Src[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_Z; + newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].Register.Index = tmp0; + newInst.Src[0].Register.SwizzleY = TGSI_SWIZZLE_X; + newInst.Src[1].Register.File = TGSI_FILE_INPUT; + newInst.Src[1].Register.Index = texInput; + newInst.Src[1].Register.SwizzleY = TGSI_SWIZZLE_Z; ctx->emit_instruction(ctx, &newInst); /* CMP t0.w, -t0.y, tex.w, t0.w; @@ -409,25 +409,25 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst.Dst[0].Register.Index = tmp0; newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_W; newInst.Instruction.NumSrcRegs = 3; - newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.Src[0].SrcRegister.Index = tmp0; - newInst.Src[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_Y; - newInst.Src[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_Y; - newInst.Src[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_Y; - newInst.Src[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_Y; - newInst.Src[0].SrcRegister.Negate = 1; - newInst.Src[1].SrcRegister.File = TGSI_FILE_INPUT; - newInst.Src[1].SrcRegister.Index = texInput; - newInst.Src[1].SrcRegister.SwizzleX = TGSI_SWIZZLE_W; - newInst.Src[1].SrcRegister.SwizzleY = TGSI_SWIZZLE_W; - newInst.Src[1].SrcRegister.SwizzleZ = TGSI_SWIZZLE_W; - newInst.Src[1].SrcRegister.SwizzleW = TGSI_SWIZZLE_W; - newInst.Src[2].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.Src[2].SrcRegister.Index = tmp0; - newInst.Src[2].SrcRegister.SwizzleX = TGSI_SWIZZLE_W; - newInst.Src[2].SrcRegister.SwizzleY = TGSI_SWIZZLE_W; - newInst.Src[2].SrcRegister.SwizzleZ = TGSI_SWIZZLE_W; - newInst.Src[2].SrcRegister.SwizzleW = TGSI_SWIZZLE_W; + newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].Register.Index = tmp0; + newInst.Src[0].Register.SwizzleX = TGSI_SWIZZLE_Y; + newInst.Src[0].Register.SwizzleY = TGSI_SWIZZLE_Y; + newInst.Src[0].Register.SwizzleZ = TGSI_SWIZZLE_Y; + newInst.Src[0].Register.SwizzleW = TGSI_SWIZZLE_Y; + newInst.Src[0].Register.Negate = 1; + newInst.Src[1].Register.File = TGSI_FILE_INPUT; + newInst.Src[1].Register.Index = texInput; + newInst.Src[1].Register.SwizzleX = TGSI_SWIZZLE_W; + newInst.Src[1].Register.SwizzleY = TGSI_SWIZZLE_W; + newInst.Src[1].Register.SwizzleZ = TGSI_SWIZZLE_W; + newInst.Src[1].Register.SwizzleW = TGSI_SWIZZLE_W; + newInst.Src[2].Register.File = TGSI_FILE_TEMPORARY; + newInst.Src[2].Register.Index = tmp0; + newInst.Src[2].Register.SwizzleX = TGSI_SWIZZLE_W; + newInst.Src[2].Register.SwizzleY = TGSI_SWIZZLE_W; + newInst.Src[2].Register.SwizzleZ = TGSI_SWIZZLE_W; + newInst.Src[2].Register.SwizzleW = TGSI_SWIZZLE_W; ctx->emit_instruction(ctx, &newInst); } @@ -443,8 +443,8 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst.Dst[0].Register.Index = aactx->colorOutput; newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_XYZ; newInst.Instruction.NumSrcRegs = 1; - newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.Src[0].SrcRegister.Index = aactx->colorTemp; + newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].Register.Index = aactx->colorTemp; ctx->emit_instruction(ctx, &newInst); /* MUL result.color.w, colorTemp, tmp0.w; */ @@ -455,10 +455,10 @@ aa_transform_inst(struct tgsi_transform_context *ctx, newInst.Dst[0].Register.Index = aactx->colorOutput; newInst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_W; newInst.Instruction.NumSrcRegs = 2; - newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.Src[0].SrcRegister.Index = aactx->colorTemp; - newInst.Src[1].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.Src[1].SrcRegister.Index = aactx->tmp0; + newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].Register.Index = aactx->colorTemp; + newInst.Src[1].Register.File = TGSI_FILE_TEMPORARY; + newInst.Src[1].Register.Index = aactx->tmp0; ctx->emit_instruction(ctx, &newInst); } else { diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c index 99165b1006..45317227a8 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c @@ -283,10 +283,10 @@ pstip_transform_inst(struct tgsi_transform_context *ctx, newInst.Dst[0].Register.File = TGSI_FILE_TEMPORARY; newInst.Dst[0].Register.Index = pctx->texTemp; newInst.Instruction.NumSrcRegs = 2; - newInst.Src[0].SrcRegister.File = TGSI_FILE_INPUT; - newInst.Src[0].SrcRegister.Index = wincoordInput; - newInst.Src[1].SrcRegister.File = TGSI_FILE_IMMEDIATE; - newInst.Src[1].SrcRegister.Index = pctx->numImmed; + newInst.Src[0].Register.File = TGSI_FILE_INPUT; + newInst.Src[0].Register.Index = wincoordInput; + newInst.Src[1].Register.File = TGSI_FILE_IMMEDIATE; + newInst.Src[1].Register.Index = pctx->numImmed; ctx->emit_instruction(ctx, &newInst); /* TEX texTemp, texTemp, sampler; */ @@ -298,10 +298,10 @@ pstip_transform_inst(struct tgsi_transform_context *ctx, newInst.Instruction.NumSrcRegs = 2; newInst.Instruction.Texture = TRUE; newInst.Texture.Texture = TGSI_TEXTURE_2D; - newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.Src[0].SrcRegister.Index = pctx->texTemp; - newInst.Src[1].SrcRegister.File = TGSI_FILE_SAMPLER; - newInst.Src[1].SrcRegister.Index = pctx->freeSampler; + newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].Register.Index = pctx->texTemp; + newInst.Src[1].Register.File = TGSI_FILE_SAMPLER; + newInst.Src[1].Register.Index = pctx->freeSampler; ctx->emit_instruction(ctx, &newInst); /* KIL -texTemp; # if -texTemp < 0, KILL fragment */ @@ -309,9 +309,9 @@ pstip_transform_inst(struct tgsi_transform_context *ctx, newInst.Instruction.Opcode = TGSI_OPCODE_KIL; newInst.Instruction.NumDstRegs = 0; newInst.Instruction.NumSrcRegs = 1; - newInst.Src[0].SrcRegister.File = TGSI_FILE_TEMPORARY; - newInst.Src[0].SrcRegister.Index = pctx->texTemp; - newInst.Src[0].SrcRegister.Negate = 1; + newInst.Src[0].Register.File = TGSI_FILE_TEMPORARY; + newInst.Src[0].Register.Index = pctx->texTemp; + newInst.Src[0].Register.Negate = 1; ctx->emit_instruction(ctx, &newInst); } diff --git a/src/gallium/auxiliary/draw/draw_vs_aos.c b/src/gallium/auxiliary/draw/draw_vs_aos.c index 8c93642954..1aaae4ab7a 100644 --- a/src/gallium/auxiliary/draw/draw_vs_aos.c +++ b/src/gallium/auxiliary/draw/draw_vs_aos.c @@ -529,8 +529,8 @@ static struct x86_reg fetch_src( struct aos_compilation *cp, const struct tgsi_full_src_register *src ) { struct x86_reg arg0 = aos_get_shader_reg(cp, - src->SrcRegister.File, - src->SrcRegister.Index); + src->Register.File, + src->Register.Index); unsigned i; ubyte swz = 0; unsigned negs = 0; @@ -620,8 +620,8 @@ static void x87_fld_src( struct aos_compilation *cp, unsigned channel ) { struct x86_reg arg0 = aos_get_shader_reg_ptr(cp, - src->SrcRegister.File, - src->SrcRegister.Index); + src->Register.File, + src->Register.Index); unsigned swizzle = tgsi_util_get_full_src_register_swizzle( src, channel ); unsigned neg = tgsi_util_get_full_src_register_sign_mode( src, channel ); diff --git a/src/gallium/auxiliary/gallivm/tgsitollvm.cpp b/src/gallium/auxiliary/gallivm/tgsitollvm.cpp index 135d307ce1..5cafe8c3f0 100644 --- a/src/gallium/auxiliary/gallivm/tgsitollvm.cpp +++ b/src/gallium/auxiliary/gallivm/tgsitollvm.cpp @@ -238,22 +238,22 @@ translate_instruction(llvm::Module *module, llvm::Value *val = 0; llvm::Value *indIdx = 0; - if (src->SrcRegister.Indirect) { - indIdx = storage->addrElement(src->SrcRegisterInd.Index); + if (src->Register.Indirect) { + indIdx = storage->addrElement(src->Indirect.Index); indIdx = storage->extractIndex(indIdx); } - if (src->SrcRegister.File == TGSI_FILE_CONSTANT) { - val = storage->constElement(src->SrcRegister.Index, indIdx); - } else if (src->SrcRegister.File == TGSI_FILE_INPUT) { - val = storage->inputElement(src->SrcRegister.Index, indIdx); - } else if (src->SrcRegister.File == TGSI_FILE_TEMPORARY) { - val = storage->tempElement(src->SrcRegister.Index); - } else if (src->SrcRegister.File == TGSI_FILE_OUTPUT) { - val = storage->outputElement(src->SrcRegister.Index, indIdx); - } else if (src->SrcRegister.File == TGSI_FILE_IMMEDIATE) { - val = storage->immediateElement(src->SrcRegister.Index); + if (src->Register.File == TGSI_FILE_CONSTANT) { + val = storage->constElement(src->Register.Index, indIdx); + } else if (src->Register.File == TGSI_FILE_INPUT) { + val = storage->inputElement(src->Register.Index, indIdx); + } else if (src->Register.File == TGSI_FILE_TEMPORARY) { + val = storage->tempElement(src->Register.Index); + } else if (src->Register.File == TGSI_FILE_OUTPUT) { + val = storage->outputElement(src->Register.Index, indIdx); + } else if (src->Register.File == TGSI_FILE_IMMEDIATE) { + val = storage->immediateElement(src->Register.Index); } else { - fprintf(stderr, "ERROR: not supported llvm source %d\n", src->SrcRegister.File); + fprintf(stderr, "ERROR: not supported llvm source %d\n", src->Register.File); return; } @@ -688,11 +688,11 @@ translate_instructionir(llvm::Module *module, llvm::Value *indIdx = 0; int swizzle = swizzleInt(src); - if (src->SrcRegister.Indirect) { - indIdx = storage->addrElement(src->SrcRegisterInd.Index); + if (src->Register.Indirect) { + indIdx = storage->addrElement(src->Indirect.Index); } - val = storage->load((enum tgsi_file_type)src->SrcRegister.File, - src->SrcRegister.Index, swizzle, instr->getIRBuilder(), indIdx); + val = storage->load((enum tgsi_file_type)src->Register.File, + src->Register.Index, swizzle, instr->getIRBuilder(), indIdx); inputs[i] = val; } diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index 91fb4f68e5..c35634c69a 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -623,21 +623,21 @@ tgsi_build_full_instruction( size++; *src_register = tgsi_build_src_register( - reg->SrcRegister.File, - reg->SrcRegister.SwizzleX, - reg->SrcRegister.SwizzleY, - reg->SrcRegister.SwizzleZ, - reg->SrcRegister.SwizzleW, - reg->SrcRegister.Negate, - reg->SrcRegister.Absolute, - reg->SrcRegister.Indirect, - reg->SrcRegister.Dimension, - reg->SrcRegister.Index, + reg->Register.File, + reg->Register.SwizzleX, + reg->Register.SwizzleY, + reg->Register.SwizzleZ, + reg->Register.SwizzleW, + reg->Register.Negate, + reg->Register.Absolute, + reg->Register.Indirect, + reg->Register.Dimension, + reg->Register.Index, instruction, header ); prev_token = (struct tgsi_token *) src_register; - if( reg->SrcRegister.Indirect ) { + if( reg->Register.Indirect ) { struct tgsi_src_register *ind; if( maxsize <= size ) @@ -646,24 +646,24 @@ tgsi_build_full_instruction( size++; *ind = tgsi_build_src_register( - reg->SrcRegisterInd.File, - reg->SrcRegisterInd.SwizzleX, - reg->SrcRegisterInd.SwizzleY, - reg->SrcRegisterInd.SwizzleZ, - reg->SrcRegisterInd.SwizzleW, - reg->SrcRegisterInd.Negate, - reg->SrcRegisterInd.Absolute, - reg->SrcRegisterInd.Indirect, - reg->SrcRegisterInd.Dimension, - reg->SrcRegisterInd.Index, + reg->Indirect.File, + reg->Indirect.SwizzleX, + reg->Indirect.SwizzleY, + reg->Indirect.SwizzleZ, + reg->Indirect.SwizzleW, + reg->Indirect.Negate, + reg->Indirect.Absolute, + reg->Indirect.Indirect, + reg->Indirect.Dimension, + reg->Indirect.Index, instruction, header ); } - if( reg->SrcRegister.Dimension ) { + if( reg->Register.Dimension ) { struct tgsi_dimension *dim; - assert( !reg->SrcRegisterDim.Dimension ); + assert( !reg->Dimension.Dimension ); if( maxsize <= size ) return 0; @@ -671,12 +671,12 @@ tgsi_build_full_instruction( size++; *dim = tgsi_build_dimension( - reg->SrcRegisterDim.Indirect, - reg->SrcRegisterDim.Index, + reg->Dimension.Indirect, + reg->Dimension.Index, instruction, header ); - if( reg->SrcRegisterDim.Indirect ) { + if( reg->Dimension.Indirect ) { struct tgsi_src_register *ind; if( maxsize <= size ) @@ -685,16 +685,16 @@ tgsi_build_full_instruction( size++; *ind = tgsi_build_src_register( - reg->SrcRegisterDimInd.File, - reg->SrcRegisterDimInd.SwizzleX, - reg->SrcRegisterDimInd.SwizzleY, - reg->SrcRegisterDimInd.SwizzleZ, - reg->SrcRegisterDimInd.SwizzleW, - reg->SrcRegisterDimInd.Negate, - reg->SrcRegisterDimInd.Absolute, - reg->SrcRegisterDimInd.Indirect, - reg->SrcRegisterDimInd.Dimension, - reg->SrcRegisterDimInd.Index, + reg->DimIndirect.File, + reg->DimIndirect.SwizzleX, + reg->DimIndirect.SwizzleY, + reg->DimIndirect.SwizzleZ, + reg->DimIndirect.SwizzleW, + reg->DimIndirect.Negate, + reg->DimIndirect.Absolute, + reg->DimIndirect.Indirect, + reg->DimIndirect.Dimension, + reg->DimIndirect.Index, instruction, header ); } @@ -894,10 +894,10 @@ tgsi_default_full_src_register( void ) { struct tgsi_full_src_register full_src_register; - full_src_register.SrcRegister = tgsi_default_src_register(); - full_src_register.SrcRegisterInd = tgsi_default_src_register(); - full_src_register.SrcRegisterDim = tgsi_default_dimension(); - full_src_register.SrcRegisterDimInd = tgsi_default_src_register(); + full_src_register.Register = tgsi_default_src_register(); + full_src_register.Indirect = tgsi_default_src_register(); + full_src_register.Dimension = tgsi_default_dimension(); + full_src_register.DimIndirect = tgsi_default_src_register(); return full_src_register; } diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index 6141865f03..da126f3b01 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -386,42 +386,42 @@ iter_instruction( CHR( ',' ); CHR( ' ' ); - if (src->SrcRegister.Negate) + if (src->Register.Negate) TXT( "-(" ); - if (src->SrcRegister.Absolute) + if (src->Register.Absolute) CHR( '|' ); - if (src->SrcRegister.Indirect) { + if (src->Register.Indirect) { _dump_register_ind( ctx, - src->SrcRegister.File, - src->SrcRegister.Index, - src->SrcRegisterInd.File, - src->SrcRegisterInd.Index, - src->SrcRegisterInd.SwizzleX ); + src->Register.File, + src->Register.Index, + src->Indirect.File, + src->Indirect.Index, + src->Indirect.SwizzleX ); } else { _dump_register( ctx, - src->SrcRegister.File, - src->SrcRegister.Index, - src->SrcRegister.Index ); + src->Register.File, + src->Register.Index, + src->Register.Index ); } - if (src->SrcRegister.SwizzleX != TGSI_SWIZZLE_X || - src->SrcRegister.SwizzleY != TGSI_SWIZZLE_Y || - src->SrcRegister.SwizzleZ != TGSI_SWIZZLE_Z || - src->SrcRegister.SwizzleW != TGSI_SWIZZLE_W) { + if (src->Register.SwizzleX != TGSI_SWIZZLE_X || + src->Register.SwizzleY != TGSI_SWIZZLE_Y || + src->Register.SwizzleZ != TGSI_SWIZZLE_Z || + src->Register.SwizzleW != TGSI_SWIZZLE_W) { CHR( '.' ); - ENM( src->SrcRegister.SwizzleX, swizzle_names ); - ENM( src->SrcRegister.SwizzleY, swizzle_names ); - ENM( src->SrcRegister.SwizzleZ, swizzle_names ); - ENM( src->SrcRegister.SwizzleW, swizzle_names ); + ENM( src->Register.SwizzleX, swizzle_names ); + ENM( src->Register.SwizzleY, swizzle_names ); + ENM( src->Register.SwizzleZ, swizzle_names ); + ENM( src->Register.SwizzleW, swizzle_names ); } - if (src->SrcRegister.Absolute) + if (src->Register.Absolute) CHR( '|' ); - if (src->SrcRegister.Negate) + if (src->Register.Negate) CHR( ')' ); first_reg = FALSE; diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c index 5fae5a225f..77f671e9eb 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c @@ -392,78 +392,78 @@ dump_instruction_verbose( EOL(); TXT( "\nFile : "); - ENM( src->SrcRegister.File, TGSI_FILES ); - if( deflt || fs->SrcRegister.SwizzleX != src->SrcRegister.SwizzleX ) { + ENM( src->Register.File, TGSI_FILES ); + if( deflt || fs->Register.SwizzleX != src->Register.SwizzleX ) { TXT( "\nSwizzleX : " ); - ENM( src->SrcRegister.SwizzleX, TGSI_SWIZZLES ); + ENM( src->Register.SwizzleX, TGSI_SWIZZLES ); } - if( deflt || fs->SrcRegister.SwizzleY != src->SrcRegister.SwizzleY ) { + if( deflt || fs->Register.SwizzleY != src->Register.SwizzleY ) { TXT( "\nSwizzleY : " ); - ENM( src->SrcRegister.SwizzleY, TGSI_SWIZZLES ); + ENM( src->Register.SwizzleY, TGSI_SWIZZLES ); } - if( deflt || fs->SrcRegister.SwizzleZ != src->SrcRegister.SwizzleZ ) { + if( deflt || fs->Register.SwizzleZ != src->Register.SwizzleZ ) { TXT( "\nSwizzleZ : " ); - ENM( src->SrcRegister.SwizzleZ, TGSI_SWIZZLES ); + ENM( src->Register.SwizzleZ, TGSI_SWIZZLES ); } - if( deflt || fs->SrcRegister.SwizzleW != src->SrcRegister.SwizzleW ) { + if( deflt || fs->Register.SwizzleW != src->Register.SwizzleW ) { TXT( "\nSwizzleW : " ); - ENM( src->SrcRegister.SwizzleW, TGSI_SWIZZLES ); + ENM( src->Register.SwizzleW, TGSI_SWIZZLES ); } - if( deflt || fs->SrcRegister.Negate != src->SrcRegister.Negate ) { + if( deflt || fs->Register.Negate != src->Register.Negate ) { TXT( "\nNegate : " ); - UID( src->SrcRegister.Negate ); + UID( src->Register.Negate ); } if( ignored ) { - if( deflt || fs->SrcRegister.Indirect != src->SrcRegister.Indirect ) { + if( deflt || fs->Register.Indirect != src->Register.Indirect ) { TXT( "\nIndirect : " ); - UID( src->SrcRegister.Indirect ); + UID( src->Register.Indirect ); } - if( deflt || fs->SrcRegister.Dimension != src->SrcRegister.Dimension ) { + if( deflt || fs->Register.Dimension != src->Register.Dimension ) { TXT( "\nDimension: " ); - UID( src->SrcRegister.Dimension ); + UID( src->Register.Dimension ); } } - if( deflt || fs->SrcRegister.Index != src->SrcRegister.Index ) { + if( deflt || fs->Register.Index != src->Register.Index ) { TXT( "\nIndex : " ); - SID( src->SrcRegister.Index ); + SID( src->Register.Index ); } if( ignored ) { - if( deflt || fs->SrcRegister.Extended != src->SrcRegister.Extended ) { + if( deflt || fs->Register.Extended != src->Register.Extended ) { TXT( "\nExtended : " ); - UID( src->SrcRegister.Extended ); + UID( src->Register.Extended ); } } - if( deflt || tgsi_compare_src_register_ext_mod( src->SrcRegisterExtMod, fs->SrcRegisterExtMod ) ) { + if( deflt || tgsi_compare_src_register_ext_mod( src->RegisterExtMod, fs->RegisterExtMod ) ) { EOL(); TXT( "\nType : " ); - ENM( src->SrcRegisterExtMod.Type, TGSI_SRC_REGISTER_EXTS ); - if( deflt || fs->SrcRegisterExtMod.Complement != src->SrcRegisterExtMod.Complement ) { + ENM( src->RegisterExtMod.Type, TGSI_SRC_REGISTER_EXTS ); + if( deflt || fs->RegisterExtMod.Complement != src->RegisterExtMod.Complement ) { TXT( "\nComplement: " ); - UID( src->SrcRegisterExtMod.Complement ); + UID( src->RegisterExtMod.Complement ); } - if( deflt || fs->SrcRegisterExtMod.Bias != src->SrcRegisterExtMod.Bias ) { + if( deflt || fs->RegisterExtMod.Bias != src->RegisterExtMod.Bias ) { TXT( "\nBias : " ); - UID( src->SrcRegisterExtMod.Bias ); + UID( src->RegisterExtMod.Bias ); } - if( deflt || fs->SrcRegisterExtMod.Scale2X != src->SrcRegisterExtMod.Scale2X ) { + if( deflt || fs->RegisterExtMod.Scale2X != src->RegisterExtMod.Scale2X ) { TXT( "\nScale2X : " ); - UID( src->SrcRegisterExtMod.Scale2X ); + UID( src->RegisterExtMod.Scale2X ); } - if( deflt || fs->SrcRegisterExtMod.Absolute != src->SrcRegisterExtMod.Absolute ) { + if( deflt || fs->RegisterExtMod.Absolute != src->RegisterExtMod.Absolute ) { TXT( "\nAbsolute : " ); - UID( src->SrcRegisterExtMod.Absolute ); + UID( src->RegisterExtMod.Absolute ); } - if( deflt || fs->SrcRegisterExtMod.Negate != src->SrcRegisterExtMod.Negate ) { + if( deflt || fs->RegisterExtMod.Negate != src->RegisterExtMod.Negate ) { TXT( "\nNegate : " ); - UID( src->SrcRegisterExtMod.Negate ); + UID( src->RegisterExtMod.Negate ); } if( ignored ) { TXT( "\nPadding : " ); - UIX( src->SrcRegisterExtMod.Padding ); - if( deflt || fs->SrcRegisterExtMod.Extended != src->SrcRegisterExtMod.Extended ) { + UIX( src->RegisterExtMod.Padding ); + if( deflt || fs->RegisterExtMod.Extended != src->RegisterExtMod.Extended ) { TXT( "\nExtended : " ); - UID( src->SrcRegisterExtMod.Extended ); + UID( src->RegisterExtMod.Extended ); } } } diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index a6bd1a784f..6cd23b37be 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -200,9 +200,9 @@ tgsi_check_soa_dependencies(const struct tgsi_full_instruction *inst) /* loop over src regs */ for (i = 0; i < inst->Instruction.NumSrcRegs; i++) { - if ((inst->Src[i].SrcRegister.File == + if ((inst->Src[i].Register.File == inst->Dst[0].Register.File) && - (inst->Src[i].SrcRegister.Index == + (inst->Src[i].Register.Index == inst->Dst[0].Register.Index)) { /* loop over dest channels */ uint channelsWritten = 0x0; @@ -1233,13 +1233,13 @@ fetch_source( * * file[1], * where: - * file = SrcRegister.File - * [1] = SrcRegister.Index + * file = Register.File + * [1] = Register.Index */ index.i[0] = index.i[1] = index.i[2] = - index.i[3] = reg->SrcRegister.Index; + index.i[3] = reg->Register.Index; /* There is an extra source register that indirectly subscripts * a register file. The direct index now becomes an offset @@ -1247,11 +1247,11 @@ fetch_source( * * file[ind[2].x+1], * where: - * ind = SrcRegisterInd.File - * [2] = SrcRegisterInd.Index - * .x = SrcRegisterInd.SwizzleX + * ind = Indirect.File + * [2] = Indirect.Index + * .x = Indirect.SwizzleX */ - if (reg->SrcRegister.Indirect) { + if (reg->Register.Indirect) { union tgsi_exec_channel index2; union tgsi_exec_channel indir_index; const uint execmask = mach->ExecMask; @@ -1261,13 +1261,13 @@ fetch_source( index2.i[0] = index2.i[1] = index2.i[2] = - index2.i[3] = reg->SrcRegisterInd.Index; + index2.i[3] = reg->Indirect.Index; /* get current value of address register[swizzle] */ - swizzle = tgsi_util_get_src_register_swizzle( ®->SrcRegisterInd, CHAN_X ); + swizzle = tgsi_util_get_src_register_swizzle( ®->Indirect, CHAN_X ); fetch_src_file_channel( mach, - reg->SrcRegisterInd.File, + reg->Indirect.File, swizzle, &index2, &indir_index ); @@ -1293,14 +1293,14 @@ fetch_source( * * file[1][3] == file[1*sizeof(file[1])+3], * where: - * [3] = SrcRegisterDim.Index + * [3] = Dimension.Index */ - if (reg->SrcRegister.Dimension) { + if (reg->Register.Dimension) { /* The size of the first-order array depends on the register file type. * We need to multiply the index to the first array to get an effective, * "flat" index that points to the beginning of the second-order array. */ - switch (reg->SrcRegister.File) { + switch (reg->Register.File) { case TGSI_FILE_INPUT: index.i[0] *= TGSI_EXEC_MAX_INPUT_ATTRIBS; index.i[1] *= TGSI_EXEC_MAX_INPUT_ATTRIBS; @@ -1317,10 +1317,10 @@ fetch_source( assert( 0 ); } - index.i[0] += reg->SrcRegisterDim.Index; - index.i[1] += reg->SrcRegisterDim.Index; - index.i[2] += reg->SrcRegisterDim.Index; - index.i[3] += reg->SrcRegisterDim.Index; + index.i[0] += reg->Dimension.Index; + index.i[1] += reg->Dimension.Index; + index.i[2] += reg->Dimension.Index; + index.i[3] += reg->Dimension.Index; /* Again, the second subscript index can be addressed indirectly * identically to the first one. @@ -1329,11 +1329,11 @@ fetch_source( * * file[1][ind[4].y+3], * where: - * ind = SrcRegisterDimInd.File - * [4] = SrcRegisterDimInd.Index - * .y = SrcRegisterDimInd.SwizzleX + * ind = DimIndirect.File + * [4] = DimIndirect.Index + * .y = DimIndirect.SwizzleX */ - if (reg->SrcRegisterDim.Indirect) { + if (reg->Dimension.Indirect) { union tgsi_exec_channel index2; union tgsi_exec_channel indir_index; const uint execmask = mach->ExecMask; @@ -1342,12 +1342,12 @@ fetch_source( index2.i[0] = index2.i[1] = index2.i[2] = - index2.i[3] = reg->SrcRegisterDimInd.Index; + index2.i[3] = reg->DimIndirect.Index; - swizzle = tgsi_util_get_src_register_swizzle( ®->SrcRegisterDimInd, CHAN_X ); + swizzle = tgsi_util_get_src_register_swizzle( ®->DimIndirect, CHAN_X ); fetch_src_file_channel( mach, - reg->SrcRegisterDimInd.File, + reg->DimIndirect.File, swizzle, &index2, &indir_index ); @@ -1367,7 +1367,7 @@ fetch_source( } /* If by any chance there was a need for a 3D array of register - * files, we would have to check whether SrcRegisterDim is followed + * files, we would have to check whether Dimension is followed * by a dimension register and continue the saga. */ } @@ -1375,7 +1375,7 @@ fetch_source( swizzle = tgsi_util_get_full_src_register_swizzle( reg, chan_index ); fetch_src_file_channel( mach, - reg->SrcRegister.File, + reg->Register.File, swizzle, &index, chan ); @@ -1668,7 +1668,7 @@ exec_tex(struct tgsi_exec_machine *mach, boolean biasLod, boolean projected) { - const uint unit = inst->Src[1].SrcRegister.Index; + const uint unit = inst->Src[1].Register.Index; union tgsi_exec_channel r[4]; uint chan_index; float lodBias; @@ -1765,7 +1765,7 @@ static void exec_txd(struct tgsi_exec_machine *mach, const struct tgsi_full_instruction *inst) { - const uint unit = inst->Src[3].SrcRegister.Index; + const uint unit = inst->Src[3].Register.Index; union tgsi_exec_channel r[4]; uint chan_index; diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c index e3a6bc0f54..4b252915c9 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.c +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c @@ -190,34 +190,34 @@ tgsi_parse_token( for( i = 0; i < inst->Instruction.NumSrcRegs; i++ ) { - next_token( ctx, &inst->Src[i].SrcRegister ); + next_token( ctx, &inst->Src[i].Register ); - if( inst->Src[i].SrcRegister.Indirect ) { - next_token( ctx, &inst->Src[i].SrcRegisterInd ); + if( inst->Src[i].Register.Indirect ) { + next_token( ctx, &inst->Src[i].Indirect ); /* * No support for indirect or multi-dimensional addressing. */ - assert( !inst->Src[i].SrcRegisterInd.Indirect ); - assert( !inst->Src[i].SrcRegisterInd.Dimension ); + assert( !inst->Src[i].Indirect.Indirect ); + assert( !inst->Src[i].Indirect.Dimension ); } - if( inst->Src[i].SrcRegister.Dimension ) { - next_token( ctx, &inst->Src[i].SrcRegisterDim ); + if( inst->Src[i].Register.Dimension ) { + next_token( ctx, &inst->Src[i].Dimension ); /* * No support for multi-dimensional addressing. */ - assert( !inst->Src[i].SrcRegisterDim.Dimension ); + assert( !inst->Src[i].Dimension.Dimension ); - if( inst->Src[i].SrcRegisterDim.Indirect ) { - next_token( ctx, &inst->Src[i].SrcRegisterDimInd ); + if( inst->Src[i].Dimension.Indirect ) { + next_token( ctx, &inst->Src[i].DimIndirect ); /* * No support for indirect or multi-dimensional addressing. */ - assert( !inst->Src[i].SrcRegisterInd.Indirect ); - assert( !inst->Src[i].SrcRegisterInd.Dimension ); + assert( !inst->Src[i].Indirect.Indirect ); + assert( !inst->Src[i].Indirect.Dimension ); } } } diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h b/src/gallium/auxiliary/tgsi/tgsi_parse.h index 331a533dd9..e9efa3fdd9 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.h +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h @@ -53,10 +53,10 @@ struct tgsi_full_dst_register struct tgsi_full_src_register { - struct tgsi_src_register SrcRegister; - struct tgsi_src_register SrcRegisterInd; - struct tgsi_dimension SrcRegisterDim; - struct tgsi_src_register SrcRegisterDimInd; + struct tgsi_src_register Register; + struct tgsi_src_register Indirect; + struct tgsi_dimension Dimension; + struct tgsi_src_register DimIndirect; }; struct tgsi_full_declaration diff --git a/src/gallium/auxiliary/tgsi/tgsi_ppc.c b/src/gallium/auxiliary/tgsi/tgsi_ppc.c index adb16f6ac9..da6ad6da04 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ppc.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ppc.c @@ -156,8 +156,8 @@ init_gen_context(struct gen_context *gen, struct ppc_function *func) static boolean is_ppc_vec_temporary(const struct tgsi_full_src_register *reg) { - return (reg->SrcRegister.File == TGSI_FILE_TEMPORARY && - reg->SrcRegister.Index < MAX_PPC_TEMPS); + return (reg->Register.File == TGSI_FILE_TEMPORARY && + reg->Register.Index < MAX_PPC_TEMPS); } @@ -291,10 +291,10 @@ emit_fetch(struct gen_context *gen, case TGSI_SWIZZLE_Y: case TGSI_SWIZZLE_Z: case TGSI_SWIZZLE_W: - switch (reg->SrcRegister.File) { + switch (reg->Register.File) { case TGSI_FILE_INPUT: { - int offset = (reg->SrcRegister.Index * 4 + swizzle) * 16; + int offset = (reg->Register.Index * 4 + swizzle) * 16; int offset_reg = emit_li_offset(gen, offset); dst_vec = ppc_allocate_vec_register(gen->f); ppc_lvx(gen->f, dst_vec, gen->inputs_reg, offset_reg); @@ -303,11 +303,11 @@ emit_fetch(struct gen_context *gen, case TGSI_FILE_TEMPORARY: if (is_ppc_vec_temporary(reg)) { /* use PPC vec register */ - dst_vec = gen->temps_map[reg->SrcRegister.Index][swizzle]; + dst_vec = gen->temps_map[reg->Register.Index][swizzle]; } else { /* use memory-based temp register "file" */ - int offset = (reg->SrcRegister.Index * 4 + swizzle) * 16; + int offset = (reg->Register.Index * 4 + swizzle) * 16; int offset_reg = emit_li_offset(gen, offset); dst_vec = ppc_allocate_vec_register(gen->f); ppc_lvx(gen->f, dst_vec, gen->temps_reg, offset_reg); @@ -315,7 +315,7 @@ emit_fetch(struct gen_context *gen, break; case TGSI_FILE_IMMEDIATE: { - int offset = (reg->SrcRegister.Index * 4 + swizzle) * 4; + int offset = (reg->Register.Index * 4 + swizzle) * 4; int offset_reg = emit_li_offset(gen, offset); dst_vec = ppc_allocate_vec_register(gen->f); /* Load 4-byte word into vector register. @@ -331,7 +331,7 @@ emit_fetch(struct gen_context *gen, break; case TGSI_FILE_CONSTANT: { - int offset = (reg->SrcRegister.Index * 4 + swizzle) * 4; + int offset = (reg->Register.Index * 4 + swizzle) * 4; int offset_reg = emit_li_offset(gen, offset); dst_vec = ppc_allocate_vec_register(gen->f); /* Load 4-byte word into vector register. @@ -404,9 +404,9 @@ equal_src_locs(const struct tgsi_full_src_register *a, uint chan_a, { int swz_a, swz_b; int sign_a, sign_b; - if (a->SrcRegister.File != b->SrcRegister.File) + if (a->Register.File != b->Register.File) return FALSE; - if (a->SrcRegister.Index != b->SrcRegister.Index) + if (a->Register.Index != b->Register.Index) return FALSE; swz_a = tgsi_util_get_full_src_register_swizzle(a, chan_a); swz_b = tgsi_util_get_full_src_register_swizzle(b, chan_b); diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c b/src/gallium/auxiliary/tgsi/tgsi_sanity.c index 7e50e25353..8bd1f31e9c 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c @@ -220,16 +220,16 @@ iter_instruction( for (i = 0; i < inst->Instruction.NumSrcRegs; i++) { check_register_usage( ctx, - inst->Src[i].SrcRegister.File, - inst->Src[i].SrcRegister.Index, + inst->Src[i].Register.File, + inst->Src[i].Register.Index, "source", - (boolean)inst->Src[i].SrcRegister.Indirect ); - if (inst->Src[i].SrcRegister.Indirect) { + (boolean)inst->Src[i].Register.Indirect ); + if (inst->Src[i].Register.Indirect) { uint file; int index; - file = inst->Src[i].SrcRegisterInd.File; - index = inst->Src[i].SrcRegisterInd.Index; + file = inst->Src[i].Indirect.File; + index = inst->Src[i].Indirect.Index; check_register_usage( ctx, file, @@ -254,8 +254,8 @@ iter_instruction( switch (inst->Instruction.Opcode) { case TGSI_OPCODE_BGNFOR: - if (inst->Src[0].SrcRegister.File != TGSI_FILE_CONSTANT && - inst->Src[0].SrcRegister.File != TGSI_FILE_IMMEDIATE) { + if (inst->Src[0].Register.File != TGSI_FILE_CONSTANT && + inst->Src[0].Register.File != TGSI_FILE_IMMEDIATE) { report_error(ctx, "Source register file must be either CONST or IMM"); } break; diff --git a/src/gallium/auxiliary/tgsi/tgsi_scan.c b/src/gallium/auxiliary/tgsi/tgsi_scan.c index 90832e71bb..a5d2db04ec 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_scan.c +++ b/src/gallium/auxiliary/tgsi/tgsi_scan.c @@ -97,13 +97,13 @@ tgsi_scan_shader(const struct tgsi_token *tokens, for (i = 0; i < fullinst->Instruction.NumSrcRegs; i++) { const struct tgsi_full_src_register *src = &fullinst->Src[i]; - if (src->SrcRegister.File == TGSI_FILE_INPUT) { - const int ind = src->SrcRegister.Index; + if (src->Register.File == TGSI_FILE_INPUT) { + const int ind = src->Register.Index; if (info->input_semantic_name[ind] == TGSI_SEMANTIC_FOG) { - if (src->SrcRegister.SwizzleX == TGSI_SWIZZLE_X) { + if (src->Register.SwizzleX == TGSI_SWIZZLE_X) { info->uses_fogcoord = TRUE; } - else if (src->SrcRegister.SwizzleX == TGSI_SWIZZLE_Y) { + else if (src->Register.SwizzleX == TGSI_SWIZZLE_Y) { info->uses_frontfacing = TRUE; } } @@ -211,17 +211,17 @@ tgsi_is_passthrough_shader(const struct tgsi_token *tokens) /* Do a whole bunch of checks for a simple move */ if (fullinst->Instruction.Opcode != TGSI_OPCODE_MOV || - src->SrcRegister.File != TGSI_FILE_INPUT || + src->Register.File != TGSI_FILE_INPUT || dst->Register.File != TGSI_FILE_OUTPUT || - src->SrcRegister.Index != dst->Register.Index || + src->Register.Index != dst->Register.Index || - src->SrcRegister.Negate || - src->SrcRegister.Absolute || + src->Register.Negate || + src->Register.Absolute || - src->SrcRegister.SwizzleX != TGSI_SWIZZLE_X || - src->SrcRegister.SwizzleY != TGSI_SWIZZLE_Y || - src->SrcRegister.SwizzleZ != TGSI_SWIZZLE_Z || - src->SrcRegister.SwizzleW != TGSI_SWIZZLE_W || + src->Register.SwizzleX != TGSI_SWIZZLE_X || + src->Register.SwizzleY != TGSI_SWIZZLE_Y || + src->Register.SwizzleZ != TGSI_SWIZZLE_Z || + src->Register.SwizzleW != TGSI_SWIZZLE_W || dst->Register.WriteMask != TGSI_WRITEMASK_XYZW) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_sse2.c b/src/gallium/auxiliary/tgsi/tgsi_sse2.c index 785076a520..76051ea0d8 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sse2.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sse2.c @@ -1267,23 +1267,23 @@ emit_fetch( case TGSI_SWIZZLE_Y: case TGSI_SWIZZLE_Z: case TGSI_SWIZZLE_W: - switch (reg->SrcRegister.File) { + switch (reg->Register.File) { case TGSI_FILE_CONSTANT: emit_const( func, xmm, - reg->SrcRegister.Index, + reg->Register.Index, swizzle, - reg->SrcRegister.Indirect, - reg->SrcRegisterInd.File, - reg->SrcRegisterInd.Index ); + reg->Register.Indirect, + reg->Indirect.File, + reg->Indirect.Index ); break; case TGSI_FILE_IMMEDIATE: emit_immediate( func, xmm, - reg->SrcRegister.Index, + reg->Register.Index, swizzle ); break; @@ -1291,7 +1291,7 @@ emit_fetch( emit_inputf( func, xmm, - reg->SrcRegister.Index, + reg->Register.Index, swizzle ); break; @@ -1299,7 +1299,7 @@ emit_fetch( emit_tempf( func, xmm, - reg->SrcRegister.Index, + reg->Register.Index, swizzle ); break; @@ -1459,7 +1459,7 @@ emit_tex( struct x86_function *func, boolean lodbias, boolean projected) { - const uint unit = inst->Src[1].SrcRegister.Index; + const uint unit = inst->Src[1].Register.Index; struct x86_reg args[2]; unsigned count; unsigned i; @@ -1721,8 +1721,8 @@ indirect_temp_reference(const struct tgsi_full_instruction *inst) uint i; for (i = 0; i < inst->Instruction.NumSrcRegs; i++) { const struct tgsi_full_src_register *reg = &inst->Src[i]; - if (reg->SrcRegister.File == TGSI_FILE_TEMPORARY && - reg->SrcRegister.Indirect) + if (reg->Register.File == TGSI_FILE_TEMPORARY && + reg->Register.Indirect) return TRUE; } for (i = 0; i < inst->Instruction.NumDstRegs; i++) { diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index 27b90f5ab7..ca2e2bae11 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -565,41 +565,41 @@ parse_src_operand( if (*ctx->cur == '-') { ctx->cur++; eat_opt_white( &ctx->cur ); - src->SrcRegister.Negate = 1; + src->Register.Negate = 1; } if (*ctx->cur == '|') { ctx->cur++; eat_opt_white( &ctx->cur ); - src->SrcRegister.Absolute = 1; + src->Register.Absolute = 1; } if (!parse_register_src(ctx, &file, &index, &ind_file, &ind_index, &ind_comp)) return FALSE; - src->SrcRegister.File = file; - src->SrcRegister.Index = index; + src->Register.File = file; + src->Register.Index = index; if (ind_file != TGSI_FILE_NULL) { - 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; + src->Register.Indirect = 1; + src->Indirect.File = ind_file; + src->Indirect.Index = ind_index; + src->Indirect.SwizzleX = ind_comp; + src->Indirect.SwizzleY = ind_comp; + src->Indirect.SwizzleZ = ind_comp; + src->Indirect.SwizzleW = ind_comp; } /* Parse optional swizzle. */ if (parse_optional_swizzle( ctx, swizzle, &parsed_swizzle )) { if (parsed_swizzle) { - src->SrcRegister.SwizzleX = swizzle[0]; - src->SrcRegister.SwizzleY = swizzle[1]; - src->SrcRegister.SwizzleZ = swizzle[2]; - src->SrcRegister.SwizzleW = swizzle[3]; + src->Register.SwizzleX = swizzle[0]; + src->Register.SwizzleY = swizzle[1]; + src->Register.SwizzleZ = swizzle[2]; + src->Register.SwizzleW = swizzle[3]; } } - if (src->SrcRegister.Absolute) { + if (src->Register.Absolute) { eat_opt_white( &ctx->cur ); if (*ctx->cur != '|') { report_error( ctx, "Expected `|'" ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_util.c b/src/gallium/auxiliary/tgsi/tgsi_util.c index 3544011b47..f4ca9e21ed 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_util.c +++ b/src/gallium/auxiliary/tgsi/tgsi_util.c @@ -76,7 +76,7 @@ tgsi_util_get_full_src_register_swizzle( unsigned component ) { return tgsi_util_get_src_register_swizzle( - ®->SrcRegister, + ®->Register, component ); } @@ -111,10 +111,10 @@ tgsi_util_get_full_src_register_sign_mode( { unsigned sign_mode; - if( reg->SrcRegister.Absolute ) { + if( reg->Register.Absolute ) { /* Consider only the post-abs negation. */ - if( reg->SrcRegister.Negate ) { + if( reg->Register.Negate ) { sign_mode = TGSI_UTIL_SIGN_SET; } else { @@ -122,7 +122,7 @@ tgsi_util_get_full_src_register_sign_mode( } } else { - if( reg->SrcRegister.Negate ) { + if( reg->Register.Negate ) { sign_mode = TGSI_UTIL_SIGN_TOGGLE; } else { @@ -141,23 +141,23 @@ tgsi_util_set_full_src_register_sign_mode( switch (sign_mode) { case TGSI_UTIL_SIGN_CLEAR: - reg->SrcRegister.Negate = 0; - reg->SrcRegister.Absolute = 1; + reg->Register.Negate = 0; + reg->Register.Absolute = 1; break; case TGSI_UTIL_SIGN_SET: - reg->SrcRegister.Absolute = 1; - reg->SrcRegister.Negate = 1; + reg->Register.Absolute = 1; + reg->Register.Negate = 1; break; case TGSI_UTIL_SIGN_TOGGLE: - reg->SrcRegister.Negate = 1; - reg->SrcRegister.Absolute = 0; + reg->Register.Negate = 1; + reg->Register.Absolute = 0; break; case TGSI_UTIL_SIGN_KEEP: - reg->SrcRegister.Negate = 0; - reg->SrcRegister.Absolute = 0; + reg->Register.Negate = 0; + reg->Register.Absolute = 0; break; default: diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index 4564a6c67f..36a7987099 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -237,9 +237,9 @@ create_intra_frag_shader(struct vl_mpeg12_mc_renderer *r) ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1); - inst.Src[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; - inst.Src[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - inst.Src[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; + inst.Src[0].Register.SwizzleX = TGSI_SWIZZLE_X; + inst.Src[0].Register.SwizzleY = TGSI_SWIZZLE_X; + inst.Src[0].Register.SwizzleZ = TGSI_SWIZZLE_X; inst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_X << i; ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } @@ -415,9 +415,9 @@ create_frame_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1); - inst.Src[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; - inst.Src[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - inst.Src[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; + inst.Src[0].Register.SwizzleX = TGSI_SWIZZLE_X; + inst.Src[0].Register.SwizzleY = TGSI_SWIZZLE_X; + inst.Src[0].Register.SwizzleZ = TGSI_SWIZZLE_X; inst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_X << i; ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } @@ -620,9 +620,9 @@ create_frame_bi_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); inst = vl_inst2(TGSI_OPCODE_MOV, TGSI_FILE_TEMPORARY, 0, TGSI_FILE_TEMPORARY, 1); - inst.Src[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; - inst.Src[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - inst.Src[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; + inst.Src[0].Register.SwizzleX = TGSI_SWIZZLE_X; + inst.Src[0].Register.SwizzleY = TGSI_SWIZZLE_X; + inst.Src[0].Register.SwizzleZ = TGSI_SWIZZLE_X; inst.Dst[0].Register.WriteMask = TGSI_WRITEMASK_X << i; ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); } @@ -642,10 +642,10 @@ create_frame_bi_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) /* lerp t1, c1.x, t1, t2 ; Blend past and future texels */ inst = vl_inst4(TGSI_OPCODE_LRP, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_CONSTANT, 1, TGSI_FILE_TEMPORARY, 1, TGSI_FILE_TEMPORARY, 2); - inst.Src[0].SrcRegister.SwizzleX = TGSI_SWIZZLE_X; - inst.Src[0].SrcRegister.SwizzleY = TGSI_SWIZZLE_X; - inst.Src[0].SrcRegister.SwizzleZ = TGSI_SWIZZLE_X; - inst.Src[0].SrcRegister.SwizzleW = TGSI_SWIZZLE_X; + inst.Src[0].Register.SwizzleX = TGSI_SWIZZLE_X; + inst.Src[0].Register.SwizzleY = TGSI_SWIZZLE_X; + inst.Src[0].Register.SwizzleZ = TGSI_SWIZZLE_X; + inst.Src[0].Register.SwizzleW = TGSI_SWIZZLE_X; ti += tgsi_build_full_instruction(&inst, &tokens[ti], header, max_tokens - ti); /* add o0, t0, t1 ; Add past/future ref and differential to form final output */ diff --git a/src/gallium/auxiliary/vl/vl_shader_build.c b/src/gallium/auxiliary/vl/vl_shader_build.c index 9ebb4a9171..d011ef97bd 100644 --- a/src/gallium/auxiliary/vl/vl_shader_build.c +++ b/src/gallium/auxiliary/vl/vl_shader_build.c @@ -141,8 +141,8 @@ struct tgsi_full_instruction vl_inst2 inst.Dst[0].Register.File = dst_file; inst.Dst[0].Register.Index = dst_index; inst.Instruction.NumSrcRegs = 1; - inst.Src[0].SrcRegister.File = src_file; - inst.Src[0].SrcRegister.Index = src_index; + inst.Src[0].Register.File = src_file; + inst.Src[0].Register.Index = src_index; return inst; } @@ -165,10 +165,10 @@ struct tgsi_full_instruction vl_inst3 inst.Dst[0].Register.File = dst_file; inst.Dst[0].Register.Index = dst_index; inst.Instruction.NumSrcRegs = 2; - inst.Src[0].SrcRegister.File = src1_file; - inst.Src[0].SrcRegister.Index = src1_index; - inst.Src[1].SrcRegister.File = src2_file; - inst.Src[1].SrcRegister.Index = src2_index; + inst.Src[0].Register.File = src1_file; + inst.Src[0].Register.Index = src1_index; + inst.Src[1].Register.File = src2_file; + inst.Src[1].Register.Index = src2_index; return inst; } @@ -193,10 +193,10 @@ struct tgsi_full_instruction vl_tex inst.Instruction.NumSrcRegs = 2; inst.Instruction.Texture = 1; inst.Texture.Texture = tex; - inst.Src[0].SrcRegister.File = src1_file; - inst.Src[0].SrcRegister.Index = src1_index; - inst.Src[1].SrcRegister.File = src2_file; - inst.Src[1].SrcRegister.Index = src2_index; + inst.Src[0].Register.File = src1_file; + inst.Src[0].Register.Index = src1_index; + inst.Src[1].Register.File = src2_file; + inst.Src[1].Register.Index = src2_index; return inst; } @@ -221,12 +221,12 @@ struct tgsi_full_instruction vl_inst4 inst.Dst[0].Register.File = dst_file; inst.Dst[0].Register.Index = dst_index; inst.Instruction.NumSrcRegs = 3; - inst.Src[0].SrcRegister.File = src1_file; - inst.Src[0].SrcRegister.Index = src1_index; - inst.Src[1].SrcRegister.File = src2_file; - inst.Src[1].SrcRegister.Index = src2_index; - inst.Src[2].SrcRegister.File = src3_file; - inst.Src[2].SrcRegister.Index = src3_index; + inst.Src[0].Register.File = src1_file; + inst.Src[0].Register.Index = src1_index; + inst.Src[1].Register.File = src2_file; + inst.Src[1].Register.Index = src2_index; + inst.Src[2].Register.File = src3_file; + inst.Src[2].Register.Index = src3_index; return inst; } diff --git a/src/gallium/drivers/cell/ppu/cell_gen_fp.c b/src/gallium/drivers/cell/ppu/cell_gen_fp.c index f639c62605..4d43f65d29 100644 --- a/src/gallium/drivers/cell/ppu/cell_gen_fp.c +++ b/src/gallium/drivers/cell/ppu/cell_gen_fp.c @@ -237,8 +237,8 @@ is_register_src(struct codegen *gen, int channel, if (swizzle > TGSI_SWIZZLE_W || sign_op != TGSI_UTIL_SIGN_KEEP) { return FALSE; } - if (src->SrcRegister.File == TGSI_FILE_TEMPORARY || - src->SrcRegister.File == TGSI_FILE_IMMEDIATE) { + if (src->Register.File == TGSI_FILE_TEMPORARY || + src->Register.File == TGSI_FILE_IMMEDIATE) { return TRUE; } return FALSE; @@ -279,15 +279,15 @@ get_src_reg(struct codegen *gen, assert(swizzle <= TGSI_SWIZZLE_W); { - int index = src->SrcRegister.Index; + int index = src->Register.Index; assert(swizzle < 4); - if (src->SrcRegister.Indirect) { + if (src->Register.Indirect) { /* XXX unfinished */ } - switch (src->SrcRegister.File) { + switch (src->Register.File) { case TGSI_FILE_TEMPORARY: reg = gen->temp_regs[index][swizzle]; break; @@ -1352,7 +1352,7 @@ static boolean emit_TEX(struct codegen *gen, const struct tgsi_full_instruction *inst) { const uint target = inst->InstructionExtTexture.Texture; - const uint unit = inst->Src[1].SrcRegister.Index; + const uint unit = inst->Src[1].Register.Index; uint addr; int ch; int coord_regs[4], d_regs[4]; @@ -1373,7 +1373,7 @@ emit_TEX(struct codegen *gen, const struct tgsi_full_instruction *inst) return FALSE; } - assert(inst->Src[1].SrcRegister.File == TGSI_FILE_SAMPLER); + assert(inst->Src[1].Register.File == TGSI_FILE_SAMPLER); spe_comment(gen->f, -4, "CALL tex:"); diff --git a/src/gallium/drivers/cell/spu/spu_exec.c b/src/gallium/drivers/cell/spu/spu_exec.c index 1b4792a316..5ed330aa6e 100644 --- a/src/gallium/drivers/cell/spu/spu_exec.c +++ b/src/gallium/drivers/cell/spu/spu_exec.c @@ -431,22 +431,22 @@ fetch_source( index.i[0] = index.i[1] = index.i[2] = - index.i[3] = reg->SrcRegister.Index; + index.i[3] = reg->Register.Index; - if (reg->SrcRegister.Indirect) { + if (reg->Register.Indirect) { union spu_exec_channel index2; union spu_exec_channel indir_index; index2.i[0] = index2.i[1] = index2.i[2] = - index2.i[3] = reg->SrcRegisterInd.Index; + index2.i[3] = reg->Indirect.Index; - swizzle = tgsi_util_get_src_register_swizzle(®->SrcRegisterInd, + swizzle = tgsi_util_get_src_register_swizzle(®->Indirect, CHAN_X); fetch_src_file_channel( mach, - reg->SrcRegisterInd.File, + reg->Indirect.File, swizzle, &index2, &indir_index ); @@ -454,8 +454,8 @@ fetch_source( index.q = si_a(index.q, indir_index.q); } - if( reg->SrcRegister.Dimension ) { - switch( reg->SrcRegister.File ) { + if( reg->Register.Dimension ) { + switch( reg->Register.File ) { case TGSI_FILE_INPUT: index.q = si_mpyi(index.q, 17); break; @@ -466,24 +466,24 @@ fetch_source( ASSERT( 0 ); } - index.i[0] += reg->SrcRegisterDim.Index; - index.i[1] += reg->SrcRegisterDim.Index; - index.i[2] += reg->SrcRegisterDim.Index; - index.i[3] += reg->SrcRegisterDim.Index; + index.i[0] += reg->Dimension.Index; + index.i[1] += reg->Dimension.Index; + index.i[2] += reg->Dimension.Index; + index.i[3] += reg->Dimension.Index; - if (reg->SrcRegisterDim.Indirect) { + if (reg->Dimension.Indirect) { union spu_exec_channel index2; union spu_exec_channel indir_index; index2.i[0] = index2.i[1] = index2.i[2] = - index2.i[3] = reg->SrcRegisterDimInd.Index; + index2.i[3] = reg->DimIndirect.Index; - swizzle = tgsi_util_get_src_register_swizzle( ®->SrcRegisterDimInd, CHAN_X ); + swizzle = tgsi_util_get_src_register_swizzle( ®->DimIndirect, CHAN_X ); fetch_src_file_channel( mach, - reg->SrcRegisterDimInd.File, + reg->DimIndirect.File, swizzle, &index2, &indir_index ); @@ -495,7 +495,7 @@ fetch_source( swizzle = tgsi_util_get_full_src_register_swizzle( reg, chan_index ); fetch_src_file_channel( mach, - reg->SrcRegister.File, + reg->Register.File, swizzle, &index, chan ); @@ -517,7 +517,7 @@ fetch_source( break; } - if (reg->SrcRegisterExtMod.Complement) { + if (reg->RegisterExtMod.Complement) { chan->q = si_fs(mach->Temps[TEMP_1_I].xyzw[TEMP_1_C].q, chan->q); } } @@ -677,7 +677,7 @@ exec_tex(struct spu_exec_machine *mach, const struct tgsi_full_instruction *inst, boolean biasLod, boolean projected) { - const uint unit = inst->Src[1].SrcRegister.Index; + const uint unit = inst->Src[1].Register.Index; union spu_exec_channel r[8]; uint chan_index; float lodBias; diff --git a/src/gallium/drivers/cell/spu/spu_util.c b/src/gallium/drivers/cell/spu/spu_util.c index c2c32b22d5..24057e29e3 100644 --- a/src/gallium/drivers/cell/spu/spu_util.c +++ b/src/gallium/drivers/cell/spu/spu_util.c @@ -33,7 +33,7 @@ tgsi_util_get_full_src_register_swizzle( unsigned component ) { return tgsi_util_get_src_register_swizzle( - reg->SrcRegister, + reg->Register, component ); } @@ -45,10 +45,10 @@ tgsi_util_get_full_src_register_sign_mode( { unsigned sign_mode; - if( reg->SrcRegisterExtMod.Absolute ) { + if( reg->RegisterExtMod.Absolute ) { /* Consider only the post-abs negation. */ - if( reg->SrcRegisterExtMod.Negate ) { + if( reg->RegisterExtMod.Negate ) { sign_mode = TGSI_UTIL_SIGN_SET; } else { @@ -60,8 +60,8 @@ tgsi_util_get_full_src_register_sign_mode( unsigned negate; - negate = reg->SrcRegister.Negate; - if( reg->SrcRegisterExtMod.Negate ) { + negate = reg->Register.Negate; + if( reg->RegisterExtMod.Negate ) { negate = !negate; } diff --git a/src/gallium/drivers/i915/i915_fpc_translate.c b/src/gallium/drivers/i915/i915_fpc_translate.c index 13c280827a..25c53210be 100644 --- a/src/gallium/drivers/i915/i915_fpc_translate.c +++ b/src/gallium/drivers/i915/i915_fpc_translate.c @@ -143,12 +143,12 @@ static uint src_vector(struct i915_fp_compile *p, const struct tgsi_full_src_register *source) { - uint index = source->SrcRegister.Index; + uint index = source->Register.Index; uint src = 0, sem_name, sem_ind; - switch (source->SrcRegister.File) { + switch (source->Register.File) { case TGSI_FILE_TEMPORARY: - if (source->SrcRegister.Index >= I915_MAX_TEMPORARY) { + if (source->Register.Index >= I915_MAX_TEMPORARY) { i915_program_error(p, "Exceeded max temporary reg"); return 0; } @@ -215,17 +215,17 @@ src_vector(struct i915_fp_compile *p, } src = swizzle(src, - source->SrcRegister.SwizzleX, - source->SrcRegister.SwizzleY, - source->SrcRegister.SwizzleZ, - source->SrcRegister.SwizzleW); + source->Register.SwizzleX, + source->Register.SwizzleY, + source->Register.SwizzleZ, + source->Register.SwizzleW); /* There's both negate-all-components and per-component negation. * Try to handle both here. */ { - int n = source->SrcRegister.Negate; + int n = source->Register.Negate; src = negate(src, n, n, n, n); } @@ -233,7 +233,7 @@ src_vector(struct i915_fp_compile *p, #if 0 /* XXX assertions disabled to allow arbfplight.c to run */ /* XXX enable these assertions, or fix things */ - assert(!source->SrcRegister.Absolute); + assert(!source->Register.Absolute); #endif return src; } @@ -339,7 +339,7 @@ emit_tex(struct i915_fp_compile *p, uint opcode) { uint texture = inst->Texture.Texture; - uint unit = inst->Src[1].SrcRegister.Index; + uint unit = inst->Src[1].Register.Index; uint tex = translate_tex_src_target( p, texture ); uint sampler = i915_emit_decl(p, REG_TYPE_S, unit, tex); uint coord = src_vector( p, &inst->Src[0]); diff --git a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c index 99266f34ed..fe2db04d8f 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c @@ -167,9 +167,9 @@ emit_fetch( case TGSI_SWIZZLE_Z: case TGSI_SWIZZLE_W: - switch (reg->SrcRegister.File) { + switch (reg->Register.File) { case TGSI_FILE_CONSTANT: { - LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), reg->SrcRegister.Index*4 + swizzle, 0); + LLVMValueRef index = LLVMConstInt(LLVMInt32Type(), reg->Register.Index*4 + swizzle, 0); LLVMValueRef scalar_ptr = LLVMBuildGEP(bld->base.builder, bld->consts_ptr, &index, 1, ""); LLVMValueRef scalar = LLVMBuildLoad(bld->base.builder, scalar_ptr, ""); res = lp_build_broadcast_scalar(&bld->base, scalar); @@ -177,17 +177,17 @@ emit_fetch( } case TGSI_FILE_IMMEDIATE: - res = bld->immediates[reg->SrcRegister.Index][swizzle]; + res = bld->immediates[reg->Register.Index][swizzle]; assert(res); break; case TGSI_FILE_INPUT: - res = bld->inputs[reg->SrcRegister.Index][swizzle]; + res = bld->inputs[reg->Register.Index][swizzle]; assert(res); break; case TGSI_FILE_TEMPORARY: - res = bld->temps[reg->SrcRegister.Index][swizzle]; + res = bld->temps[reg->Register.Index][swizzle]; if(!res) return bld->base.undef; break; @@ -319,7 +319,7 @@ emit_tex( struct lp_build_tgsi_soa_context *bld, boolean projected, LLVMValueRef *texel) { - const uint unit = inst->Src[1].SrcRegister.Index; + const uint unit = inst->Src[1].Register.Index; LLVMValueRef lodbias; LLVMValueRef oow; LLVMValueRef coords[3]; @@ -424,8 +424,8 @@ indirect_temp_reference(const struct tgsi_full_instruction *inst) uint i; for (i = 0; i < inst->Instruction.NumSrcRegs; i++) { const struct tgsi_full_src_register *reg = &inst->Src[i]; - if (reg->SrcRegister.File == TGSI_FILE_TEMPORARY && - reg->SrcRegister.Indirect) + if (reg->Register.File == TGSI_FILE_TEMPORARY && + reg->Register.Indirect) return TRUE; } for (i = 0; i < inst->Instruction.NumDstRegs; i++) { diff --git a/src/gallium/drivers/nv20/nv20_vertprog.c b/src/gallium/drivers/nv20/nv20_vertprog.c index e3bb9f9d7f..9e8aab9754 100644 --- a/src/gallium/drivers/nv20/nv20_vertprog.c +++ b/src/gallium/drivers/nv20/nv20_vertprog.c @@ -253,32 +253,32 @@ static INLINE struct nv20_sreg tgsi_src(struct nv20_vpc *vpc, const struct tgsi_full_src_register *fsrc) { struct nv20_sreg src; - switch (fsrc->SrcRegister.File) { + switch (fsrc->Register.File) { case TGSI_FILE_INPUT: - src = nv20_sr(NV30SR_INPUT, fsrc->SrcRegister.Index); + src = nv20_sr(NV30SR_INPUT, fsrc->Register.Index); break; case TGSI_FILE_CONSTANT: - src = constant(vpc, fsrc->SrcRegister.Index, 0, 0, 0, 0); + src = constant(vpc, fsrc->Register.Index, 0, 0, 0, 0); break; case TGSI_FILE_IMMEDIATE: - src = vpc->imm[fsrc->SrcRegister.Index]; + src = vpc->imm[fsrc->Register.Index]; break; case TGSI_FILE_TEMPORARY: - if (vpc->high_temp < fsrc->SrcRegister.Index) - vpc->high_temp = fsrc->SrcRegister.Index; - src = nv20_sr(NV30SR_TEMP, fsrc->SrcRegister.Index); + if (vpc->high_temp < fsrc->Register.Index) + vpc->high_temp = fsrc->Register.Index; + src = nv20_sr(NV30SR_TEMP, fsrc->Register.Index); break; default: NOUVEAU_ERR("bad src file\n"); break; } - src.abs = fsrc->SrcRegister.Absolute; - src.negate = fsrc->SrcRegister.Negate; - src.swz[0] = fsrc->SrcRegister.SwizzleX; - src.swz[1] = fsrc->SrcRegister.SwizzleY; - src.swz[2] = fsrc->SrcRegister.SwizzleZ; - src.swz[3] = fsrc->SrcRegister.SwizzleW; + src.abs = fsrc->Register.Absolute; + src.negate = fsrc->Register.Negate; + src.swz[0] = fsrc->Register.SwizzleX; + src.swz[1] = fsrc->Register.SwizzleY; + src.swz[2] = fsrc->Register.SwizzleZ; + src.swz[3] = fsrc->Register.SwizzleW; return src; } @@ -335,7 +335,7 @@ nv20_vertprog_parse_instruction(struct nv20_vpc *vpc, const struct tgsi_full_src_register *fsrc; fsrc = &finst->Src[i]; - if (fsrc->SrcRegister.File == TGSI_FILE_TEMPORARY) { + if (fsrc->Register.File == TGSI_FILE_TEMPORARY) { src[i] = tgsi_src(vpc, fsrc); } } @@ -344,10 +344,10 @@ nv20_vertprog_parse_instruction(struct nv20_vpc *vpc, const struct tgsi_full_src_register *fsrc; fsrc = &finst->Src[i]; - switch (fsrc->SrcRegister.File) { + switch (fsrc->Register.File) { case TGSI_FILE_INPUT: - if (ai == -1 || ai == fsrc->SrcRegister.Index) { - ai = fsrc->SrcRegister.Index; + if (ai == -1 || ai == fsrc->Register.Index) { + ai = fsrc->Register.Index; src[i] = tgsi_src(vpc, fsrc); } else { src[i] = temp(vpc); @@ -360,8 +360,8 @@ nv20_vertprog_parse_instruction(struct nv20_vpc *vpc, */ case TGSI_FILE_CONSTANT: case TGSI_FILE_IMMEDIATE: - if (ci == -1 || ci == fsrc->SrcRegister.Index) { - ci = fsrc->SrcRegister.Index; + if (ci == -1 || ci == fsrc->Register.Index) { + ci = fsrc->Register.Index; src[i] = tgsi_src(vpc, fsrc); } else { src[i] = temp(vpc); diff --git a/src/gallium/drivers/nv30/nv30_fragprog.c b/src/gallium/drivers/nv30/nv30_fragprog.c index 14dc884b3a..40965a9772 100644 --- a/src/gallium/drivers/nv30/nv30_fragprog.c +++ b/src/gallium/drivers/nv30/nv30_fragprog.c @@ -237,20 +237,20 @@ tgsi_src(struct nv30_fpc *fpc, const struct tgsi_full_src_register *fsrc) { struct nv30_sreg src; - switch (fsrc->SrcRegister.File) { + switch (fsrc->Register.File) { case TGSI_FILE_INPUT: src = nv30_sr(NV30SR_INPUT, - fpc->attrib_map[fsrc->SrcRegister.Index]); + fpc->attrib_map[fsrc->Register.Index]); break; case TGSI_FILE_CONSTANT: - src = constant(fpc, fsrc->SrcRegister.Index, NULL); + src = constant(fpc, fsrc->Register.Index, NULL); break; case TGSI_FILE_IMMEDIATE: - assert(fsrc->SrcRegister.Index < fpc->nr_imm); - src = fpc->imm[fsrc->SrcRegister.Index]; + assert(fsrc->Register.Index < fpc->nr_imm); + src = fpc->imm[fsrc->Register.Index]; break; case TGSI_FILE_TEMPORARY: - src = nv30_sr(NV30SR_TEMP, fsrc->SrcRegister.Index + 1); + src = nv30_sr(NV30SR_TEMP, fsrc->Register.Index + 1); if (fpc->high_temp < src.index) fpc->high_temp = src.index; break; @@ -258,7 +258,7 @@ tgsi_src(struct nv30_fpc *fpc, const struct tgsi_full_src_register *fsrc) * Luckily fragprog results are just temp regs.. */ case TGSI_FILE_OUTPUT: - if (fsrc->SrcRegister.Index == fpc->colour_id) + if (fsrc->Register.Index == fpc->colour_id) return nv30_sr(NV30SR_OUTPUT, 0); else return nv30_sr(NV30SR_OUTPUT, 1); @@ -268,12 +268,12 @@ tgsi_src(struct nv30_fpc *fpc, const struct tgsi_full_src_register *fsrc) break; } - src.abs = fsrc->SrcRegister.Absolute; - src.negate = fsrc->SrcRegister.Negate; - src.swz[0] = fsrc->SrcRegister.SwizzleX; - src.swz[1] = fsrc->SrcRegister.SwizzleY; - src.swz[2] = fsrc->SrcRegister.SwizzleZ; - src.swz[3] = fsrc->SrcRegister.SwizzleW; + src.abs = fsrc->Register.Absolute; + src.negate = fsrc->Register.Negate; + src.swz[0] = fsrc->Register.SwizzleX; + src.swz[1] = fsrc->Register.SwizzleY; + src.swz[2] = fsrc->Register.SwizzleZ; + src.swz[3] = fsrc->Register.SwizzleW; return src; } @@ -364,7 +364,7 @@ nv30_fragprog_parse_instruction(struct nv30_fpc *fpc, const struct tgsi_full_src_register *fsrc; fsrc = &finst->Src[i]; - if (fsrc->SrcRegister.File == TGSI_FILE_TEMPORARY) { + if (fsrc->Register.File == TGSI_FILE_TEMPORARY) { src[i] = tgsi_src(fpc, fsrc); } } @@ -374,7 +374,7 @@ nv30_fragprog_parse_instruction(struct nv30_fpc *fpc, fsrc = &finst->Src[i]; - switch (fsrc->SrcRegister.File) { + switch (fsrc->Register.File) { case TGSI_FILE_INPUT: case TGSI_FILE_CONSTANT: case TGSI_FILE_TEMPORARY: @@ -385,14 +385,14 @@ nv30_fragprog_parse_instruction(struct nv30_fpc *fpc, break; } - switch (fsrc->SrcRegister.File) { + switch (fsrc->Register.File) { case TGSI_FILE_INPUT: - if (ai == -1 || ai == fsrc->SrcRegister.Index) { - ai = fsrc->SrcRegister.Index; + if (ai == -1 || ai == fsrc->Register.Index) { + ai = fsrc->Register.Index; src[i] = tgsi_src(fpc, fsrc); } else { NOUVEAU_MSG("extra src attr %d\n", - fsrc->SrcRegister.Index); + fsrc->Register.Index); src[i] = temp(fpc); arith(fpc, 0, MOV, src[i], MASK_ALL, tgsi_src(fpc, fsrc), none, none); @@ -400,8 +400,8 @@ nv30_fragprog_parse_instruction(struct nv30_fpc *fpc, break; case TGSI_FILE_CONSTANT: case TGSI_FILE_IMMEDIATE: - if (ci == -1 || ci == fsrc->SrcRegister.Index) { - ci = fsrc->SrcRegister.Index; + if (ci == -1 || ci == fsrc->Register.Index) { + ci = fsrc->Register.Index; src[i] = tgsi_src(fpc, fsrc); } else { src[i] = temp(fpc); @@ -413,7 +413,7 @@ nv30_fragprog_parse_instruction(struct nv30_fpc *fpc, /* handled above */ break; case TGSI_FILE_SAMPLER: - unit = fsrc->SrcRegister.Index; + unit = fsrc->Register.Index; break; case TGSI_FILE_OUTPUT: break; diff --git a/src/gallium/drivers/nv30/nv30_vertprog.c b/src/gallium/drivers/nv30/nv30_vertprog.c index 41e4161dda..36ac8299f0 100644 --- a/src/gallium/drivers/nv30/nv30_vertprog.c +++ b/src/gallium/drivers/nv30/nv30_vertprog.c @@ -253,32 +253,32 @@ static INLINE struct nv30_sreg tgsi_src(struct nv30_vpc *vpc, const struct tgsi_full_src_register *fsrc) { struct nv30_sreg src; - switch (fsrc->SrcRegister.File) { + switch (fsrc->Register.File) { case TGSI_FILE_INPUT: - src = nv30_sr(NV30SR_INPUT, fsrc->SrcRegister.Index); + src = nv30_sr(NV30SR_INPUT, fsrc->Register.Index); break; case TGSI_FILE_CONSTANT: - src = constant(vpc, fsrc->SrcRegister.Index, 0, 0, 0, 0); + src = constant(vpc, fsrc->Register.Index, 0, 0, 0, 0); break; case TGSI_FILE_IMMEDIATE: - src = vpc->imm[fsrc->SrcRegister.Index]; + src = vpc->imm[fsrc->Register.Index]; break; case TGSI_FILE_TEMPORARY: - if (vpc->high_temp < fsrc->SrcRegister.Index) - vpc->high_temp = fsrc->SrcRegister.Index; - src = nv30_sr(NV30SR_TEMP, fsrc->SrcRegister.Index); + if (vpc->high_temp < fsrc->Register.Index) + vpc->high_temp = fsrc->Register.Index; + src = nv30_sr(NV30SR_TEMP, fsrc->Register.Index); break; default: NOUVEAU_ERR("bad src file\n"); break; } - src.abs = fsrc->SrcRegister.Absolute; - src.negate = fsrc->SrcRegister.Negate; - src.swz[0] = fsrc->SrcRegister.SwizzleX; - src.swz[1] = fsrc->SrcRegister.SwizzleY; - src.swz[2] = fsrc->SrcRegister.SwizzleZ; - src.swz[3] = fsrc->SrcRegister.SwizzleW; + src.abs = fsrc->Register.Absolute; + src.negate = fsrc->Register.Negate; + src.swz[0] = fsrc->Register.SwizzleX; + src.swz[1] = fsrc->Register.SwizzleY; + src.swz[2] = fsrc->Register.SwizzleZ; + src.swz[3] = fsrc->Register.SwizzleW; return src; } @@ -335,7 +335,7 @@ nv30_vertprog_parse_instruction(struct nv30_vpc *vpc, const struct tgsi_full_src_register *fsrc; fsrc = &finst->Src[i]; - if (fsrc->SrcRegister.File == TGSI_FILE_TEMPORARY) { + if (fsrc->Register.File == TGSI_FILE_TEMPORARY) { src[i] = tgsi_src(vpc, fsrc); } } @@ -344,10 +344,10 @@ nv30_vertprog_parse_instruction(struct nv30_vpc *vpc, const struct tgsi_full_src_register *fsrc; fsrc = &finst->Src[i]; - switch (fsrc->SrcRegister.File) { + switch (fsrc->Register.File) { case TGSI_FILE_INPUT: - if (ai == -1 || ai == fsrc->SrcRegister.Index) { - ai = fsrc->SrcRegister.Index; + if (ai == -1 || ai == fsrc->Register.Index) { + ai = fsrc->Register.Index; src[i] = tgsi_src(vpc, fsrc); } else { src[i] = temp(vpc); @@ -360,8 +360,8 @@ nv30_vertprog_parse_instruction(struct nv30_vpc *vpc, */ case TGSI_FILE_CONSTANT: case TGSI_FILE_IMMEDIATE: - if (ci == -1 || ci == fsrc->SrcRegister.Index) { - ci = fsrc->SrcRegister.Index; + if (ci == -1 || ci == fsrc->Register.Index) { + ci = fsrc->Register.Index; src[i] = tgsi_src(vpc, fsrc); } else { src[i] = temp(vpc); diff --git a/src/gallium/drivers/nv40/nv40_fragprog.c b/src/gallium/drivers/nv40/nv40_fragprog.c index 02c23e92c0..1bf16726d1 100644 --- a/src/gallium/drivers/nv40/nv40_fragprog.c +++ b/src/gallium/drivers/nv40/nv40_fragprog.c @@ -255,36 +255,36 @@ tgsi_src(struct nv40_fpc *fpc, const struct tgsi_full_src_register *fsrc) { struct nv40_sreg src; - switch (fsrc->SrcRegister.File) { + switch (fsrc->Register.File) { case TGSI_FILE_INPUT: src = nv40_sr(NV40SR_INPUT, - fpc->attrib_map[fsrc->SrcRegister.Index]); + fpc->attrib_map[fsrc->Register.Index]); break; case TGSI_FILE_CONSTANT: - src = constant(fpc, fsrc->SrcRegister.Index, NULL); + src = constant(fpc, fsrc->Register.Index, NULL); break; case TGSI_FILE_IMMEDIATE: - assert(fsrc->SrcRegister.Index < fpc->nr_imm); - src = fpc->imm[fsrc->SrcRegister.Index]; + assert(fsrc->Register.Index < fpc->nr_imm); + src = fpc->imm[fsrc->Register.Index]; break; case TGSI_FILE_TEMPORARY: - src = fpc->r_temp[fsrc->SrcRegister.Index]; + src = fpc->r_temp[fsrc->Register.Index]; break; /* NV40 fragprog result regs are just temps, so this is simple */ case TGSI_FILE_OUTPUT: - src = fpc->r_result[fsrc->SrcRegister.Index]; + src = fpc->r_result[fsrc->Register.Index]; break; default: NOUVEAU_ERR("bad src file\n"); break; } - src.abs = fsrc->SrcRegister.Absolute; - src.negate = fsrc->SrcRegister.Negate; - src.swz[0] = fsrc->SrcRegister.SwizzleX; - src.swz[1] = fsrc->SrcRegister.SwizzleY; - src.swz[2] = fsrc->SrcRegister.SwizzleZ; - src.swz[3] = fsrc->SrcRegister.SwizzleW; + src.abs = fsrc->Register.Absolute; + src.negate = fsrc->Register.Negate; + src.swz[0] = fsrc->Register.SwizzleX; + src.swz[1] = fsrc->Register.SwizzleY; + src.swz[2] = fsrc->Register.SwizzleZ; + src.swz[3] = fsrc->Register.SwizzleW; return src; } @@ -365,7 +365,7 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc, const struct tgsi_full_src_register *fsrc; fsrc = &finst->Src[i]; - if (fsrc->SrcRegister.File == TGSI_FILE_TEMPORARY) { + if (fsrc->Register.File == TGSI_FILE_TEMPORARY) { src[i] = tgsi_src(fpc, fsrc); } } @@ -375,7 +375,7 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc, fsrc = &finst->Src[i]; - switch (fsrc->SrcRegister.File) { + switch (fsrc->Register.File) { case TGSI_FILE_INPUT: case TGSI_FILE_CONSTANT: case TGSI_FILE_TEMPORARY: @@ -386,10 +386,10 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc, break; } - switch (fsrc->SrcRegister.File) { + switch (fsrc->Register.File) { case TGSI_FILE_INPUT: - if (ai == -1 || ai == fsrc->SrcRegister.Index) { - ai = fsrc->SrcRegister.Index; + if (ai == -1 || ai == fsrc->Register.Index) { + ai = fsrc->Register.Index; src[i] = tgsi_src(fpc, fsrc); } else { src[i] = temp(fpc); @@ -399,8 +399,8 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc, break; case TGSI_FILE_CONSTANT: if ((ci == -1 && ii == -1) || - ci == fsrc->SrcRegister.Index) { - ci = fsrc->SrcRegister.Index; + ci == fsrc->Register.Index) { + ci = fsrc->Register.Index; src[i] = tgsi_src(fpc, fsrc); } else { src[i] = temp(fpc); @@ -410,8 +410,8 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc, break; case TGSI_FILE_IMMEDIATE: if ((ci == -1 && ii == -1) || - ii == fsrc->SrcRegister.Index) { - ii = fsrc->SrcRegister.Index; + ii == fsrc->Register.Index) { + ii = fsrc->Register.Index; src[i] = tgsi_src(fpc, fsrc); } else { src[i] = temp(fpc); @@ -423,7 +423,7 @@ nv40_fragprog_parse_instruction(struct nv40_fpc *fpc, /* handled above */ break; case TGSI_FILE_SAMPLER: - unit = fsrc->SrcRegister.Index; + unit = fsrc->Register.Index; break; case TGSI_FILE_OUTPUT: break; diff --git a/src/gallium/drivers/nv40/nv40_vertprog.c b/src/gallium/drivers/nv40/nv40_vertprog.c index c4f51d622c..55835ee644 100644 --- a/src/gallium/drivers/nv40/nv40_vertprog.c +++ b/src/gallium/drivers/nv40/nv40_vertprog.c @@ -295,30 +295,30 @@ static INLINE struct nv40_sreg tgsi_src(struct nv40_vpc *vpc, const struct tgsi_full_src_register *fsrc) { struct nv40_sreg src; - switch (fsrc->SrcRegister.File) { + switch (fsrc->Register.File) { case TGSI_FILE_INPUT: - src = nv40_sr(NV40SR_INPUT, fsrc->SrcRegister.Index); + src = nv40_sr(NV40SR_INPUT, fsrc->Register.Index); break; case TGSI_FILE_CONSTANT: - src = constant(vpc, fsrc->SrcRegister.Index, 0, 0, 0, 0); + src = constant(vpc, fsrc->Register.Index, 0, 0, 0, 0); break; case TGSI_FILE_IMMEDIATE: - src = vpc->imm[fsrc->SrcRegister.Index]; + src = vpc->imm[fsrc->Register.Index]; break; case TGSI_FILE_TEMPORARY: - src = vpc->r_temp[fsrc->SrcRegister.Index]; + src = vpc->r_temp[fsrc->Register.Index]; break; default: NOUVEAU_ERR("bad src file\n"); break; } - src.abs = fsrc->SrcRegister.Absolute; - src.negate = fsrc->SrcRegister.Negate; - src.swz[0] = fsrc->SrcRegister.SwizzleX; - src.swz[1] = fsrc->SrcRegister.SwizzleY; - src.swz[2] = fsrc->SrcRegister.SwizzleZ; - src.swz[3] = fsrc->SrcRegister.SwizzleW; + src.abs = fsrc->Register.Absolute; + src.negate = fsrc->Register.Negate; + src.swz[0] = fsrc->Register.SwizzleX; + src.swz[1] = fsrc->Register.SwizzleY; + src.swz[2] = fsrc->Register.SwizzleZ; + src.swz[3] = fsrc->Register.SwizzleW; return src; } @@ -406,7 +406,7 @@ nv40_vertprog_parse_instruction(struct nv40_vpc *vpc, const struct tgsi_full_src_register *fsrc; fsrc = &finst->Src[i]; - if (fsrc->SrcRegister.File == TGSI_FILE_TEMPORARY) { + if (fsrc->Register.File == TGSI_FILE_TEMPORARY) { src[i] = tgsi_src(vpc, fsrc); } } @@ -416,7 +416,7 @@ nv40_vertprog_parse_instruction(struct nv40_vpc *vpc, fsrc = &finst->Src[i]; - switch (fsrc->SrcRegister.File) { + switch (fsrc->Register.File) { case TGSI_FILE_INPUT: case TGSI_FILE_CONSTANT: case TGSI_FILE_TEMPORARY: @@ -427,10 +427,10 @@ nv40_vertprog_parse_instruction(struct nv40_vpc *vpc, break; } - switch (fsrc->SrcRegister.File) { + switch (fsrc->Register.File) { case TGSI_FILE_INPUT: - if (ai == -1 || ai == fsrc->SrcRegister.Index) { - ai = fsrc->SrcRegister.Index; + if (ai == -1 || ai == fsrc->Register.Index) { + ai = fsrc->Register.Index; src[i] = tgsi_src(vpc, fsrc); } else { src[i] = temp(vpc); @@ -440,8 +440,8 @@ nv40_vertprog_parse_instruction(struct nv40_vpc *vpc, break; case TGSI_FILE_CONSTANT: if ((ci == -1 && ii == -1) || - ci == fsrc->SrcRegister.Index) { - ci = fsrc->SrcRegister.Index; + ci == fsrc->Register.Index) { + ci = fsrc->Register.Index; src[i] = tgsi_src(vpc, fsrc); } else { src[i] = temp(vpc); @@ -451,8 +451,8 @@ nv40_vertprog_parse_instruction(struct nv40_vpc *vpc, break; case TGSI_FILE_IMMEDIATE: if ((ci == -1 && ii == -1) || - ii == fsrc->SrcRegister.Index) { - ii = fsrc->SrcRegister.Index; + ii == fsrc->Register.Index) { + ii = fsrc->Register.Index; src[i] = tgsi_src(vpc, fsrc); } else { src[i] = temp(vpc); diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 3409edb4c8..1509cecaac 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -1535,10 +1535,10 @@ negate_supported(const struct tgsi_full_instruction *insn, int i) for (s = 0; s < insn->Instruction.NumSrcRegs; ++s) { if (s == i) continue; - if ((insn->Src[s].SrcRegister.Index == - insn->Src[i].SrcRegister.Index) && - (insn->Src[s].SrcRegister.File == - insn->Src[i].SrcRegister.File)) + if ((insn->Src[s].Register.Index == + insn->Src[i].Register.Index) && + (insn->Src[s].Register.File == + insn->Src[i].Register.File)) return FALSE; } @@ -1644,8 +1644,8 @@ tgsi_src(struct nv50_pc *pc, int chan, const struct tgsi_full_src_register *src, struct nv50_reg *temp; unsigned sgn, c, swz; - if (src->SrcRegister.File != TGSI_FILE_CONSTANT) - assert(!src->SrcRegister.Indirect); + if (src->Register.File != TGSI_FILE_CONSTANT) + assert(!src->Register.Indirect); sgn = tgsi_util_get_full_src_register_sign_mode(src, chan); @@ -1655,16 +1655,16 @@ tgsi_src(struct nv50_pc *pc, int chan, const struct tgsi_full_src_register *src, case TGSI_SWIZZLE_Y: case TGSI_SWIZZLE_Z: case TGSI_SWIZZLE_W: - switch (src->SrcRegister.File) { + switch (src->Register.File) { case TGSI_FILE_INPUT: - r = &pc->attr[src->SrcRegister.Index * 4 + c]; + r = &pc->attr[src->Register.Index * 4 + c]; break; case TGSI_FILE_TEMPORARY: - r = &pc->temp[src->SrcRegister.Index * 4 + c]; + r = &pc->temp[src->Register.Index * 4 + c]; break; case TGSI_FILE_CONSTANT: - if (!src->SrcRegister.Indirect) { - r = &pc->param[src->SrcRegister.Index * 4 + c]; + if (!src->Register.Indirect) { + r = &pc->param[src->Register.Index * 4 + c]; break; } /* Indicate indirection by setting r->acc < 0 and @@ -1672,19 +1672,19 @@ tgsi_src(struct nv50_pc *pc, int chan, const struct tgsi_full_src_register *src, */ r = MALLOC_STRUCT(nv50_reg); swz = tgsi_util_get_src_register_swizzle( - &src->SrcRegisterInd, 0); + &src->Indirect, 0); ctor_reg(r, P_CONST, - src->SrcRegisterInd.Index * 4 + swz, - src->SrcRegister.Index * 4 + c); + src->Indirect.Index * 4 + swz, + src->Register.Index * 4 + c); r->acc = -1; break; case TGSI_FILE_IMMEDIATE: - r = &pc->immd[src->SrcRegister.Index * 4 + c]; + r = &pc->immd[src->Register.Index * 4 + c]; break; case TGSI_FILE_SAMPLER: break; case TGSI_FILE_ADDRESS: - r = pc->addr[src->SrcRegister.Index * 4 + c]; + r = pc->addr[src->Register.Index * 4 + c]; assert(r); break; default: @@ -1871,8 +1871,8 @@ nv50_program_tx_insn(struct nv50_pc *pc, src_mask = nv50_tgsi_src_mask(inst, i); neg_supp = negate_supported(inst, i); - if (fs->SrcRegister.File == TGSI_FILE_SAMPLER) - unit = fs->SrcRegister.Index; + if (fs->Register.File == TGSI_FILE_SAMPLER) + unit = fs->Register.Index; for (c = 0; c < 4; c++) if (src_mask & (1 << c)) @@ -2284,10 +2284,10 @@ prep_inspect_insn(struct nv50_pc *pc, const struct tgsi_full_instruction *insn) for (i = 0; i < insn->Instruction.NumSrcRegs; i++) { src = &insn->Src[i]; - if (src->SrcRegister.File == TGSI_FILE_TEMPORARY) + if (src->Register.File == TGSI_FILE_TEMPORARY) reg = pc->temp; else - if (src->SrcRegister.File == TGSI_FILE_INPUT) + if (src->Register.File == TGSI_FILE_INPUT) reg = pc->attr; else continue; @@ -2299,7 +2299,7 @@ prep_inspect_insn(struct nv50_pc *pc, const struct tgsi_full_instruction *insn) continue; k = tgsi_util_get_full_src_register_swizzle(src, c); - reg[src->SrcRegister.Index * 4 + k].acc = pc->insn_nr; + reg[src->Register.Index * 4 + k].acc = pc->insn_nr; } } } @@ -2391,8 +2391,8 @@ nv50_tgsi_scan_swizzle(const struct tgsi_full_instruction *insn, boolean neg_supp = negate_supported(insn, i); fs = &insn->Src[i]; - if (fs->SrcRegister.File != fd->Register.File || - fs->SrcRegister.Index != fd->Register.Index) + if (fs->Register.File != fd->Register.File || + fs->Register.Index != fd->Register.Index) continue; for (chn = 0; chn < 4; ++chn) { diff --git a/src/gallium/drivers/r300/r300_tgsi_to_rc.c b/src/gallium/drivers/r300/r300_tgsi_to_rc.c index 92796d150b..9fb2de2403 100644 --- a/src/gallium/drivers/r300/r300_tgsi_to_rc.c +++ b/src/gallium/drivers/r300/r300_tgsi_to_rc.c @@ -201,15 +201,15 @@ static void transform_srcreg( struct rc_src_register * dst, struct tgsi_full_src_register * src) { - dst->File = translate_register_file(src->SrcRegister.File); - dst->Index = translate_register_index(ttr, src->SrcRegister.File, src->SrcRegister.Index); - dst->RelAddr = src->SrcRegister.Indirect; + dst->File = translate_register_file(src->Register.File); + dst->Index = translate_register_index(ttr, src->Register.File, src->Register.Index); + dst->RelAddr = src->Register.Indirect; dst->Swizzle = tgsi_util_get_full_src_register_swizzle(src, 0); dst->Swizzle |= tgsi_util_get_full_src_register_swizzle(src, 1) << 3; dst->Swizzle |= tgsi_util_get_full_src_register_swizzle(src, 2) << 6; dst->Swizzle |= tgsi_util_get_full_src_register_swizzle(src, 3) << 9; - dst->Abs = src->SrcRegister.Absolute; - dst->Negate = src->SrcRegister.Negate ? RC_MASK_XYZW : 0; + dst->Abs = src->Register.Absolute; + dst->Negate = src->Register.Negate ? RC_MASK_XYZW : 0; } static void transform_texture(struct rc_instruction * dst, struct tgsi_instruction_texture src) @@ -261,8 +261,8 @@ static void transform_instruction(struct tgsi_to_rc * ttr, struct tgsi_full_inst transform_dstreg(ttr, &dst->U.I.DstReg, &src->Dst[0]); for(i = 0; i < src->Instruction.NumSrcRegs; ++i) { - if (src->Src[i].SrcRegister.File == TGSI_FILE_SAMPLER) - dst->U.I.TexSrcUnit = src->Src[i].SrcRegister.Index; + if (src->Src[i].Register.File == TGSI_FILE_SAMPLER) + dst->U.I.TexSrcUnit = src->Src[i].Register.Index; else transform_srcreg(ttr, &dst->U.I.SrcReg[i], &src->Src[i]); } diff --git a/src/gallium/drivers/svga/svga_tgsi_insn.c b/src/gallium/drivers/svga/svga_tgsi_insn.c index 9ca89f1cdd..1670da8bfa 100644 --- a/src/gallium/drivers/svga/svga_tgsi_insn.c +++ b/src/gallium/drivers/svga/svga_tgsi_insn.c @@ -176,33 +176,33 @@ translate_src_register( const struct svga_shader_emitter *emit, { struct src_register src; - switch (reg->SrcRegister.File) { + switch (reg->Register.File) { case TGSI_FILE_INPUT: /* Input registers are referred to by their semantic name rather * than by index. Use the mapping build up from the decls: */ - src = emit->input_map[reg->SrcRegister.Index]; + src = emit->input_map[reg->Register.Index]; break; case TGSI_FILE_IMMEDIATE: /* Immediates are appended after TGSI constants in the D3D * constant buffer. */ - src = src_register( translate_file( reg->SrcRegister.File ), - reg->SrcRegister.Index + + src = src_register( translate_file( reg->Register.File ), + reg->Register.Index + emit->imm_start ); break; default: - src = src_register( translate_file( reg->SrcRegister.File ), - reg->SrcRegister.Index ); + src = src_register( translate_file( reg->Register.File ), + reg->Register.Index ); break; } /* Indirect addressing (for coninstant buffer lookups only) */ - if (reg->SrcRegister.Indirect) + if (reg->Register.Indirect) { /* we shift the offset towards the minimum */ if (svga_arl_needs_adjustment( emit )) { @@ -213,28 +213,28 @@ translate_src_register( const struct svga_shader_emitter *emit, /* Not really sure what should go in the second token: */ src.indirect = src_token( SVGA3DREG_ADDR, - reg->SrcRegisterInd.Index ); + reg->Indirect.Index ); src.indirect.swizzle = SWIZZLE_XXXX; } src = swizzle( src, - reg->SrcRegister.SwizzleX, - reg->SrcRegister.SwizzleY, - reg->SrcRegister.SwizzleZ, - reg->SrcRegister.SwizzleW ); + reg->Register.SwizzleX, + reg->Register.SwizzleY, + reg->Register.SwizzleZ, + reg->Register.SwizzleW ); /* src.mod isn't a bitfield, unfortunately: * See tgsi_util_get_full_src_register_sign_mode for implementation details. */ - if (reg->SrcRegister.Absolute) { - if (reg->SrcRegister.Negate) + if (reg->Register.Absolute) { + if (reg->Register.Negate) src.base.srcMod = SVGA3DSRCMOD_ABSNEG; else src.base.srcMod = SVGA3DSRCMOD_ABS; } else { - if (reg->SrcRegister.Negate) + if (reg->Register.Negate) src.base.srcMod = SVGA3DSRCMOD_NEG; else src.base.srcMod = SVGA3DSRCMOD_NONE; @@ -986,13 +986,13 @@ static boolean emit_kil(struct svga_shader_emitter *emit, inst = inst_token( SVGA3DOP_TEXKILL ); src0 = translate_src_register( emit, reg ); - if (reg->SrcRegister.Absolute || - reg->SrcRegister.Negate || - reg->SrcRegister.Indirect || - reg->SrcRegister.SwizzleX != 0 || - reg->SrcRegister.SwizzleY != 1 || - reg->SrcRegister.SwizzleZ != 2 || - reg->SrcRegister.File != TGSI_FILE_TEMPORARY) + if (reg->Register.Absolute || + reg->Register.Negate || + reg->Register.Indirect || + reg->Register.SwizzleX != 0 || + reg->Register.SwizzleY != 1 || + reg->Register.SwizzleZ != 2 || + reg->Register.File != TGSI_FILE_TEMPORARY) { SVGA3dShaderDestToken temp = get_temp( emit ); @@ -2543,27 +2543,27 @@ pre_parse_instruction( struct svga_shader_emitter *emit, const struct tgsi_full_instruction *insn, int current_arl) { - if (insn->Src[0].SrcRegister.Indirect && - insn->Src[0].SrcRegisterInd.File == TGSI_FILE_ADDRESS) { + if (insn->Src[0].Register.Indirect && + insn->Src[0].Indirect.File == TGSI_FILE_ADDRESS) { const struct tgsi_full_src_register *reg = &insn->Src[0]; - if (reg->SrcRegister.Index < 0) { - pre_parse_add_indirect(emit, reg->SrcRegister.Index, current_arl); + if (reg->Register.Index < 0) { + pre_parse_add_indirect(emit, reg->Register.Index, current_arl); } } - if (insn->Src[1].SrcRegister.Indirect && - insn->Src[1].SrcRegisterInd.File == TGSI_FILE_ADDRESS) { + if (insn->Src[1].Register.Indirect && + insn->Src[1].Indirect.File == TGSI_FILE_ADDRESS) { const struct tgsi_full_src_register *reg = &insn->Src[1]; - if (reg->SrcRegister.Index < 0) { - pre_parse_add_indirect(emit, reg->SrcRegister.Index, current_arl); + if (reg->Register.Index < 0) { + pre_parse_add_indirect(emit, reg->Register.Index, current_arl); } } - if (insn->Src[2].SrcRegister.Indirect && - insn->Src[2].SrcRegisterInd.File == TGSI_FILE_ADDRESS) { + if (insn->Src[2].Register.Indirect && + insn->Src[2].Indirect.File == TGSI_FILE_ADDRESS) { const struct tgsi_full_src_register *reg = &insn->Src[2]; - if (reg->SrcRegister.Index < 0) { - pre_parse_add_indirect(emit, reg->SrcRegister.Index, current_arl); + if (reg->Register.Index < 0) { + pre_parse_add_indirect(emit, reg->Register.Index, current_arl); } } -- cgit v1.2.3 From 8bf4e5d6176b0efb93c11bcd14fa5d320088e2e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 24 Nov 2009 16:01:01 +0000 Subject: llvmpipe: Update instructions. --- src/gallium/drivers/llvmpipe/README | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/README b/src/gallium/drivers/llvmpipe/README index 89d08834a3..478e0139c8 100644 --- a/src/gallium/drivers/llvmpipe/README +++ b/src/gallium/drivers/llvmpipe/README @@ -51,21 +51,18 @@ Requirements - Linux - - udis86, http://udis86.sourceforge.net/ . Use my repository, which decodes - opcodes not yet supported by upstream. + - A x86 or amd64 processor with support for sse2, sse3, and sse4.1 SIMD + instructions. This is necessary because we emit several SSE intrinsics for + convenience. See /proc/cpuinfo to know what your CPU supports. - git clone git://people.freedesktop.org/~jrfonseca/udis86 - cd udis86 - ./configure --with-pic - make - sudo make install + - LLVM 2.5 or greater. LLVM 2.6 is preferred. - - LLVM 2.5. On Debian based distributions do: + On Debian based distributions do: aptitude install llvm-dev - There is a typo in one of the llvm-dev 2.5 headers, that causes compilation - errors in the debug build: + There is a typo in one of the llvm 2.5 headers, that may cause compilation + errors. To fix it apply the change: --- /usr/include/llvm-c/Core.h.orig 2009-08-10 15:38:54.000000000 +0100 +++ /usr/include/llvm-c/Core.h 2009-08-10 15:38:25.000000000 +0100 @@ -79,12 +76,17 @@ Requirements #endif return reinterpret_cast(Vals); - - A x86 or amd64 processor with support for sse2, sse3, and sse4.1 SIMD - instructions. This is necessary because we emit several SSE intrinsics for - convenience. See /proc/cpuinfo to know what your CPU supports. - - - scons + - scons (optional) + - udis86, http://udis86.sourceforge.net/ (optional): + + git clone git://udis86.git.sourceforge.net/gitroot/udis86/udis86 + cd udis86 + ./autogen.sh + ./configure --with-pic + make + sudo make install + Building ======== -- cgit v1.2.3 From d4c2f53ca56beb8fe9289fb17c3f5fcc2cc7dc10 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Tue, 24 Nov 2009 12:16:39 -0500 Subject: r600 : fix stack depth setting bug. --- src/mesa/drivers/dri/r600/r700_assembler.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 8e57396a0d..0c16594adc 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -6503,14 +6503,14 @@ GLboolean RelocProgram(r700_AssemblerBase * pAsm) }; } - if(0 == pAsm->unSubArrayPointer) + if(pAsm->CALLSTACK[0].max > 0) { - return GL_TRUE; + pAsm->pR700Shader->uStackSize = ((pAsm->CALLSTACK[0].max + 3)>>2) + 2; } - if(pAsm->CALLSTACK[0].max > 0) + if(0 == pAsm->unSubArrayPointer) { - pAsm->pR700Shader->uStackSize = ((pAsm->CALLSTACK[0].max + 3)>>2) + 2; + return GL_TRUE; } unCFoffset = plstCFmain->uNumOfNode; -- cgit v1.2.3 From eca5d6944aa20e33d1c2c2653f827f5707f8274a Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 24 Nov 2009 18:44:39 +0100 Subject: vmware/xorg: Stage driver in lib/gallium --- src/gallium/winsys/drm/vmware/xorg/Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/xorg/Makefile b/src/gallium/winsys/drm/vmware/xorg/Makefile index e152263256..4f6ec11418 100644 --- a/src/gallium/winsys/drm/vmware/xorg/Makefile +++ b/src/gallium/winsys/drm/vmware/xorg/Makefile @@ -23,17 +23,24 @@ LIBS = \ DRIVER_DEFINES = \ -DHAVE_CONFIG_H +TARGET_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(TARGET) ############################################# -all default: $(TARGET) +all default: $(TARGET) $(TARGET_STAGING) $(TARGET): $(OBJECTS) Makefile $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a $(LIBS) $(TOP)/bin/mklib -noprefix -o $@ \ $(OBJECTS) $(LIBS) $(shell pkg-config --libs libdrm) -ldrm_intel +$(TOP)/$(LIB_DIR)/gallium: + mkdir -p $@ + +$(TARGET_STAGING): $(TARGET) $(TOP)/$(LIB_DIR)/gallium + $(INSTALL) $(TARGET) $(TOP)/$(LIB_DIR)/gallium + clean: rm -rf $(OBJECTS) $(TARGET) -- cgit v1.2.3 From 522e840a91ef9fe35e5830626b9ce388169e5d22 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 24 Nov 2009 18:47:15 +0100 Subject: vmware/xorg: Don't link against libdrm_intel --- src/gallium/winsys/drm/vmware/xorg/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/xorg/Makefile b/src/gallium/winsys/drm/vmware/xorg/Makefile index 4f6ec11418..383a6f975b 100644 --- a/src/gallium/winsys/drm/vmware/xorg/Makefile +++ b/src/gallium/winsys/drm/vmware/xorg/Makefile @@ -33,7 +33,7 @@ all default: $(TARGET) $(TARGET_STAGING) $(TARGET): $(OBJECTS) Makefile $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a $(LIBS) $(TOP)/bin/mklib -noprefix -o $@ \ - $(OBJECTS) $(LIBS) $(shell pkg-config --libs libdrm) -ldrm_intel + $(OBJECTS) $(LIBS) $(shell pkg-config --libs libdrm) $(TOP)/$(LIB_DIR)/gallium: mkdir -p $@ -- cgit v1.2.3 From 77529a2cf296b611fa49ab4fe711d8bbb2177d85 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 24 Nov 2009 19:16:37 +0100 Subject: vmware/xorg: Clean Makefile a bit --- src/gallium/winsys/drm/vmware/xorg/Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/xorg/Makefile b/src/gallium/winsys/drm/vmware/xorg/Makefile index 383a6f975b..ea0ce18fd1 100644 --- a/src/gallium/winsys/drm/vmware/xorg/Makefile +++ b/src/gallium/winsys/drm/vmware/xorg/Makefile @@ -20,6 +20,9 @@ LIBS = \ $(TOP)/src/gallium/drivers/svga/libsvga.a \ $(GALLIUM_AUXILIARIES) +LINKS = \ + $(shell pkg-config --libs libdrm) + DRIVER_DEFINES = \ -DHAVE_CONFIG_H @@ -31,9 +34,8 @@ TARGET_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(TARGET) all default: $(TARGET) $(TARGET_STAGING) -$(TARGET): $(OBJECTS) Makefile $(TOP)/src/gallium/state_trackers/xorg/libxorgtracker.a $(LIBS) - $(TOP)/bin/mklib -noprefix -o $@ \ - $(OBJECTS) $(LIBS) $(shell pkg-config --libs libdrm) +$(TARGET): $(OBJECTS) Makefile $(LIBS) + $(MKLIB) -noprefix -o $@ $(OBJECTS) $(LIBS) $(LINKS) $(TOP)/$(LIB_DIR)/gallium: mkdir -p $@ -- cgit v1.2.3 From 45d9ea361981520a7c5df3ef1e10b76fac14bf02 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 24 Nov 2009 19:20:59 +0100 Subject: vmware/xorg: Link against libkms If the system doesn't have libkms installed it wont try to link against it. --- src/gallium/winsys/drm/vmware/xorg/Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/xorg/Makefile b/src/gallium/winsys/drm/vmware/xorg/Makefile index ea0ce18fd1..423728e2b4 100644 --- a/src/gallium/winsys/drm/vmware/xorg/Makefile +++ b/src/gallium/winsys/drm/vmware/xorg/Makefile @@ -21,6 +21,7 @@ LIBS = \ $(GALLIUM_AUXILIARIES) LINKS = \ + $(shell pkg-config --libs --silence-errors libkms) \ $(shell pkg-config --libs libdrm) DRIVER_DEFINES = \ -- cgit v1.2.3 From 11dce740305ea3f45966a9e9f72ba94b4eae6d40 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Tue, 24 Nov 2009 16:00:25 -0500 Subject: r600 : reset stack flag with one channel only. --- src/mesa/drivers/dri/r600/r700_assembler.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 0c16594adc..ba97d3e073 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -5663,6 +5663,8 @@ GLboolean setRetInLoopFlag(r700_AssemblerBase *pAsm, GLuint flagValue) pAsm->D2.dst2.literal = 1; pAsm->D2.dst2.SaturateMode = SATURATE_OFF; pAsm->D.dst.predicated = 0; + /* in reloc where dislink flag init inst, only one slot alu inst is handled. */ + pAsm->D.dst.math = 1; /* TODO : not math really, but one channel op, more generic alu assembler needed */ #if 0 pAsm->S[0].src.rtype = SRC_REC_LITERAL; //pAsm->S[0].src.reg = 0; @@ -6457,6 +6459,7 @@ GLboolean AssembleInstr(GLuint uiFirstInst, GLboolean InitShaderProgram(r700_AssemblerBase * pAsm) { setRetInLoopFlag(pAsm, SQ_SEL_0); + pAsm->alu_x_opcode = SQ_CF_INST_ALU; return GL_TRUE; } @@ -6482,7 +6485,7 @@ GLboolean RelocProgram(r700_AssemblerBase * pAsm) if(SIT_CF_ALU == pInst->m_ShaderInstType) { pCF_ALU = (R700ControlFlowALUClause *)pInst; - if(1 == pCF_ALU->m_Word1.f.count) + if(0 == pCF_ALU->m_Word1.f.count) { pCF_ALU->m_Word1.f.cf_inst = SQ_CF_INST_NOP; } -- cgit v1.2.3 From 808f0376607b0e2d31dfebc888fd8f1e737fed09 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 26 Nov 2009 00:35:31 -0500 Subject: glu/sgi: Fix memory leak in gluBuild2DMipmapLevelsCore. --- src/glu/sgi/libutil/mipmap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c index bf6eaf88c6..d1fd5a7d72 100644 --- a/src/glu/sgi/libutil/mipmap.c +++ b/src/glu/sgi/libutil/mipmap.c @@ -4108,6 +4108,7 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels); glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + free(srcImage); return GLU_OUT_OF_MEMORY; } /* level userLevel+1 is in srcImage; level userLevel already saved */ -- cgit v1.2.3 From 7fbdbad5c02e3d5bfbf0e641e2aec224e39fa974 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 25 Nov 2009 18:41:11 +0000 Subject: st/xorg: consolidate some dest surface state setting --- src/gallium/state_trackers/xorg/xorg_composite.c | 26 ++---- src/gallium/state_trackers/xorg/xorg_exa.c | 2 +- src/gallium/state_trackers/xorg/xorg_renderer.c | 102 ++++++++--------------- src/gallium/state_trackers/xorg/xorg_renderer.h | 5 ++ src/gallium/state_trackers/xorg/xorg_xv.c | 20 +---- 5 files changed, 50 insertions(+), 105 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index f16816b2a7..99e357328d 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -421,18 +421,6 @@ bind_samplers(struct exa_context *exa, int op, exa->bound_textures); } -static void -setup_vs_constant_buffer(struct exa_context *exa, - int width, int height) -{ - const int param_bytes = 8 * sizeof(float); - float vs_consts[8] = { - 2.f/width, 2.f/height, 1, 1, - -1, -1, 0, 0 - }; - renderer_set_constants(exa->renderer, PIPE_SHADER_VERTEX, - vs_consts, param_bytes); -} static void @@ -449,10 +437,6 @@ setup_fs_constant_buffer(struct exa_context *exa) static void setup_constant_buffers(struct exa_context *exa, struct exa_pixmap_priv *pDst) { - int width = pDst->tex->width[0]; - int height = pDst->tex->height[0]; - - setup_vs_constant_buffer(exa, width, height); setup_fs_constant_buffer(exa); } @@ -503,8 +487,10 @@ boolean xorg_composite_bind_state(struct exa_context *exa, struct exa_pixmap_priv *pMask, struct exa_pixmap_priv *pDst) { - renderer_bind_framebuffer(exa->renderer, pDst); - renderer_bind_viewport(exa->renderer, pDst); + struct pipe_surface *dst_surf = xorg_gpu_surface(exa->scrn, pDst); + + renderer_bind_destination(exa->renderer, dst_surf); + bind_blend_state(exa, op, pSrcPicture, pMaskPicture, pDstPicture); renderer_bind_rasterizer(exa->renderer); bind_shaders(exa, op, pSrcPicture, pMaskPicture, pDstPicture, pSrc, pMask); @@ -556,6 +542,7 @@ boolean xorg_solid_bind_state(struct exa_context *exa, struct exa_pixmap_priv *pixmap, Pixel fg) { + struct pipe_surface *dst_surf = xorg_gpu_surface(exa->scrn, pixmap); unsigned vs_traits, fs_traits; struct xorg_shader shader; @@ -573,8 +560,7 @@ boolean xorg_solid_bind_state(struct exa_context *exa, vs_traits = VS_SOLID_FILL; fs_traits = FS_SOLID_FILL; - renderer_bind_framebuffer(exa->renderer, pixmap); - renderer_bind_viewport(exa->renderer, pixmap); + renderer_bind_destination(exa->renderer, dst_surf); renderer_bind_rasterizer(exa->renderer); bind_blend_state(exa, PictOpSrc, NULL, NULL, NULL); cso_set_samplers(exa->renderer->cso, 0, NULL); diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index aa04586455..308eb2715e 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -441,7 +441,7 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, exa->copy.src = src_priv; exa->copy.dst = priv; - if (exa->pipe->surface_copy) { + if (0 && exa->pipe->surface_copy) { exa->copy.src_surface = exa->scrn->get_tex_surface( exa->scrn, exa->copy.src->tex, diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 723605312c..bf38fa7de2 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -79,6 +79,7 @@ renderer_draw(struct xorg_renderer *r) r->attrs_per_vertex); /* attribs/vert */ pipe_buffer_reference(&buf, NULL); + pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); } } @@ -322,15 +323,28 @@ setup_vertex_data_yuv(struct xorg_renderer *r, -static void -set_viewport(struct xorg_renderer *r, int width, int height, - enum AxisOrientation orientation) +/* Set up framebuffer, viewport and vertex shader constant buffer + * state for a particular destinaton surface. In all our rendering, + * these concepts are linked. + */ +void renderer_bind_destination(struct xorg_renderer *r, + struct pipe_surface *surface ) { + + struct pipe_framebuffer_state fb; struct pipe_viewport_state viewport; - float y_scale = (orientation == Y0_BOTTOM) ? -2.f : 2.f; + int width = surface->width; + int height = surface->height; + + memset(&fb, 0, sizeof fb); + fb.width = width; + fb.height = height; + fb.nr_cbufs = 1; + fb.cbufs[0] = surface; + fb.zsbuf = 0; viewport.scale[0] = width / 2.f; - viewport.scale[1] = height / y_scale; + viewport.scale[1] = height / 2.f; viewport.scale[2] = 1.0; viewport.scale[3] = 1.0; viewport.translate[0] = width / 2.f; @@ -338,11 +352,26 @@ set_viewport(struct xorg_renderer *r, int width, int height, viewport.translate[2] = 0.0; viewport.translate[3] = 0.0; + if (r->fb_width != width || + r->fb_height != height) + { + float vs_consts[8] = { + 2.f/width, 2.f/height, 1, 1, + -1, -1, 0, 0 + }; + + r->fb_width = width; + r->fb_height = height; + + renderer_set_constants(r, PIPE_SHADER_VERTEX, + vs_consts, sizeof vs_consts); + } + + cso_set_framebuffer(r->cso, &fb); cso_set_viewport(r->cso, &viewport); } - struct xorg_renderer * renderer_create(struct pipe_context *pipe) { struct xorg_renderer *renderer = CALLOC_STRUCT(xorg_renderer); @@ -379,41 +408,9 @@ void renderer_destroy(struct xorg_renderer *r) } } -void renderer_bind_framebuffer(struct xorg_renderer *r, - struct exa_pixmap_priv *priv) -{ - unsigned i; - struct pipe_framebuffer_state state; - struct pipe_surface *surface = xorg_gpu_surface(r->pipe->screen, priv); - memset(&state, 0, sizeof(struct pipe_framebuffer_state)); - - state.width = priv->tex->width[0]; - state.height = priv->tex->height[0]; - state.nr_cbufs = 1; - state.cbufs[0] = surface; - for (i = 1; i < PIPE_MAX_COLOR_BUFS; ++i) - state.cbufs[i] = 0; - /* currently we don't use depth/stencil */ - state.zsbuf = 0; - cso_set_framebuffer(r->cso, &state); - - /* we do fire and forget for the framebuffer, this is the forget part */ - pipe_surface_reference(&surface, NULL); -} - -void renderer_bind_viewport(struct xorg_renderer *r, - struct exa_pixmap_priv *dst) -{ - int width = dst->tex->width[0]; - int height = dst->tex->height[0]; - - /*debug_printf("Bind viewport (%d, %d)\n", width, height);*/ - - set_viewport(r, width, height, Y0_TOP); -} void renderer_bind_rasterizer(struct xorg_renderer *r) { @@ -446,19 +443,6 @@ void renderer_set_constants(struct xorg_renderer *r, r->pipe->set_constant_buffer(r->pipe, shader_type, 0, cbuf); } -static void -setup_vs_constant_buffer(struct xorg_renderer *r, - int width, int height) -{ - const int param_bytes = 8 * sizeof(float); - float vs_consts[8] = { - 2.f/width, 2.f/height, 1, 1, - -1, -1, 0, 0 - }; - renderer_set_constants(r, PIPE_SHADER_VERTEX, - vs_consts, param_bytes); -} - static void setup_fs_constant_buffer(struct xorg_renderer *r) { @@ -580,7 +564,6 @@ static void renderer_copy_texture(struct xorg_renderer *r, struct pipe_surface *dst_surf = screen->get_tex_surface( screen, dst, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE); - struct pipe_framebuffer_state fb; float s0, t0, s1, t1; struct xorg_shader shader; @@ -650,7 +633,7 @@ static void renderer_copy_texture(struct xorg_renderer *r, cso_single_sampler_done(r->cso); } - set_viewport(r, dst_surf->width, dst_surf->height, Y0_TOP); + renderer_bind_destination(r, dst_surf); /* texture */ cso_set_sampler_textures(r->cso, 1, &src); @@ -664,19 +647,6 @@ static void renderer_copy_texture(struct xorg_renderer *r, cso_set_vertex_shader_handle(r->cso, shader.vs); cso_set_fragment_shader_handle(r->cso, shader.fs); - /* drawing dest */ - memset(&fb, 0, sizeof(fb)); - fb.width = dst_surf->width; - fb.height = dst_surf->height; - fb.nr_cbufs = 1; - fb.cbufs[0] = dst_surf; - { - int i; - for (i = 1; i < PIPE_MAX_COLOR_BUFS; ++i) - fb.cbufs[i] = 0; - } - cso_set_framebuffer(r->cso, &fb); - setup_vs_constant_buffer(r, fb.width, fb.height); setup_fs_constant_buffer(r); /* draw quad */ diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h index 2f0b865dbd..51e0272b46 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.h +++ b/src/gallium/state_trackers/xorg/xorg_renderer.h @@ -21,6 +21,8 @@ struct xorg_renderer { struct cso_context *cso; struct xorg_shaders *shaders; + int fb_width; + int fb_height; struct pipe_constant_buffer vs_const_buffer; struct pipe_constant_buffer fs_const_buffer; @@ -35,6 +37,9 @@ struct xorg_renderer { struct xorg_renderer *renderer_create(struct pipe_context *pipe); void renderer_destroy(struct xorg_renderer *renderer); +void renderer_bind_destination(struct xorg_renderer *r, + struct pipe_surface *surface ); + void renderer_bind_framebuffer(struct xorg_renderer *r, struct exa_pixmap_priv *priv); void renderer_bind_viewport(struct xorg_renderer *r, diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index a8f74ceea2..7a43da8988 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -317,21 +317,6 @@ copy_packed_data(ScrnInfoPtr pScrn, } -static void -setup_vs_video_constants(struct xorg_renderer *r, struct exa_pixmap_priv *dst) -{ - int width = dst->tex->width[0]; - int height = dst->tex->height[0]; - const int param_bytes = 8 * sizeof(float); - float vs_consts[8] = { - 2.f/width, 2.f/height, 1, 1, - -1, -1, 0, 0 - }; - - renderer_set_constants(r, PIPE_SHADER_VERTEX, - vs_consts, param_bytes); -} - static void setup_fs_video_constants(struct xorg_renderer *r, boolean hdtv) { @@ -445,6 +430,7 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id, Bool hdtv; int x, y, w, h; struct exa_pixmap_priv *dst = exaGetPixmapDriverPrivate(pPixmap); + struct pipe_surface *dst_surf = xorg_gpu_surface(pPriv->r->pipe->screen, dst); if (dst && !dst->tex) { xorg_exa_set_shared_usage(pPixmap); @@ -465,13 +451,11 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id, pbox = REGION_RECTS(dstRegion); nbox = REGION_NUM_RECTS(dstRegion); - renderer_bind_framebuffer(pPriv->r, dst); - renderer_bind_viewport(pPriv->r, dst); + renderer_bind_destination(pPriv->r, dst_surf); bind_blend_state(pPriv); renderer_bind_rasterizer(pPriv->r); bind_shaders(pPriv); bind_samplers(pPriv); - setup_vs_video_constants(pPriv->r, dst); setup_fs_video_constants(pPriv->r, hdtv); exaMoveInPixmap(pPixmap); -- cgit v1.2.3 From 899d20cfaa003913b38ae9e095ca87b8725a19c1 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 25 Nov 2009 18:42:54 +0000 Subject: st/xorg: don't bother with cso save and restore in copy func --- src/gallium/state_trackers/xorg/xorg_renderer.c | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index bf38fa7de2..c9c5ea4c21 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -595,16 +595,6 @@ static void renderer_copy_texture(struct xorg_renderer *r, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)); - /* save state (restored below) */ - cso_save_blend(r->cso); - cso_save_samplers(r->cso); - cso_save_sampler_textures(r->cso); - cso_save_framebuffer(r->cso); - cso_save_fragment_shader(r->cso); - cso_save_vertex_shader(r->cso); - - cso_save_viewport(r->cso); - /* set misc state we care about */ { @@ -665,15 +655,6 @@ static void renderer_copy_texture(struct xorg_renderer *r, pipe_buffer_reference(&buf, NULL); } - /* restore state we changed */ - cso_restore_blend(r->cso); - cso_restore_samplers(r->cso); - cso_restore_sampler_textures(r->cso); - cso_restore_framebuffer(r->cso); - cso_restore_vertex_shader(r->cso); - cso_restore_fragment_shader(r->cso); - cso_restore_viewport(r->cso); - pipe_surface_reference(&dst_surf, NULL); } -- cgit v1.2.3 From 86ba5139a8078f05fa9e1a4b562854d5f3b783f3 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 25 Nov 2009 18:45:20 +0000 Subject: st/xorg: remove redundant clipping code --- src/gallium/state_trackers/xorg/xorg_renderer.c | 120 ------------------------ 1 file changed, 120 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index c9c5ea4c21..63a7883cd1 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -454,101 +454,6 @@ setup_fs_constant_buffer(struct xorg_renderer *r) fs_consts, param_bytes); } -static INLINE void shift_rectx(float coords[4], - const float *bounds, - const float shift) -{ - coords[0] += shift; - coords[2] -= shift; - if (bounds) { - coords[2] = MIN2(coords[2], bounds[2]); - /* bound x/y + width/height */ - if ((coords[0] + coords[2]) > (bounds[0] + bounds[2])) { - coords[2] = (bounds[0] + bounds[2]) - coords[0]; - } - } -} - -static INLINE void shift_recty(float coords[4], - const float *bounds, - const float shift) -{ - coords[1] += shift; - coords[3] -= shift; - if (bounds) { - coords[3] = MIN2(coords[3], bounds[3]); - if ((coords[1] + coords[3]) > (bounds[1] + bounds[3])) { - coords[3] = (bounds[1] + bounds[3]) - coords[1]; - } - } -} - -static INLINE void bound_rect(float coords[4], - const float bounds[4], - float shift[4]) -{ - /* if outside the bounds */ - if (coords[0] > (bounds[0] + bounds[2]) || - coords[1] > (bounds[1] + bounds[3]) || - (coords[0] + coords[2]) < bounds[0] || - (coords[1] + coords[3]) < bounds[1]) { - coords[0] = 0.f; - coords[1] = 0.f; - coords[2] = 0.f; - coords[3] = 0.f; - shift[0] = 0.f; - shift[1] = 0.f; - return; - } - - /* bound x */ - if (coords[0] < bounds[0]) { - shift[0] = bounds[0] - coords[0]; - coords[2] -= shift[0]; - coords[0] = bounds[0]; - } else - shift[0] = 0.f; - - /* bound y */ - if (coords[1] < bounds[1]) { - shift[1] = bounds[1] - coords[1]; - coords[3] -= shift[1]; - coords[1] = bounds[1]; - } else - shift[1] = 0.f; - - shift[2] = bounds[2] - coords[2]; - shift[3] = bounds[3] - coords[3]; - /* bound width/height */ - coords[2] = MIN2(coords[2], bounds[2]); - coords[3] = MIN2(coords[3], bounds[3]); - - /* bound x/y + width/height */ - if ((coords[0] + coords[2]) > (bounds[0] + bounds[2])) { - coords[2] = (bounds[0] + bounds[2]) - coords[0]; - } - if ((coords[1] + coords[3]) > (bounds[1] + bounds[3])) { - coords[3] = (bounds[1] + bounds[3]) - coords[1]; - } - - /* if outside the bounds */ - if ((coords[0] + coords[2]) < bounds[0] || - (coords[1] + coords[3]) < bounds[1]) { - coords[0] = 0.f; - coords[1] = 0.f; - coords[2] = 0.f; - coords[3] = 0.f; - return; - } -} - -static INLINE void sync_size(float *src_loc, float *dst_loc) -{ - src_loc[2] = MIN2(src_loc[2], dst_loc[2]); - src_loc[3] = MIN2(src_loc[3], dst_loc[3]); - dst_loc[2] = src_loc[2]; - dst_loc[3] = src_loc[3]; -} static void renderer_copy_texture(struct xorg_renderer *r, struct pipe_texture *src, @@ -740,36 +645,11 @@ void renderer_copy_pixmap(struct xorg_renderer *r, dst_loc[1] = dy; dst_loc[2] = width; dst_loc[3] = height; - dst_bounds[0] = 0.f; - dst_bounds[1] = 0.f; - dst_bounds[2] = dst->width[0]; - dst_bounds[3] = dst->height[0]; src_loc[0] = sx; src_loc[1] = sy; src_loc[2] = width; src_loc[3] = height; - src_bounds[0] = 0.f; - src_bounds[1] = 0.f; - src_bounds[2] = src->width[0]; - src_bounds[3] = src->height[0]; - - bound_rect(src_loc, src_bounds, src_shift); - bound_rect(dst_loc, dst_bounds, dst_shift); - shift[0] = src_shift[0] - dst_shift[0]; - shift[1] = src_shift[1] - dst_shift[1]; - - if (shift[0] < 0) - shift_rectx(src_loc, src_bounds, -shift[0]); - else - shift_rectx(dst_loc, dst_bounds, shift[0]); - - if (shift[1] < 0) - shift_recty(src_loc, src_bounds, -shift[1]); - else - shift_recty(dst_loc, dst_bounds, shift[1]); - - sync_size(src_loc, dst_loc); if (src_loc[2] >= 0 && src_loc[3] >= 0 && dst_loc[2] >= 0 && dst_loc[3] >= 0) { -- cgit v1.2.3 From b4ea1eb871ec0e5fffd70bf4da6cdec5d25b5c50 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 26 Nov 2009 10:15:01 +0000 Subject: st/xorg: set up rasterizer state in init --- src/gallium/state_trackers/xorg/xorg_composite.c | 2 -- src/gallium/state_trackers/xorg/xorg_renderer.c | 22 ++++++++-------------- src/gallium/state_trackers/xorg/xorg_renderer.h | 1 - 3 files changed, 8 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 99e357328d..67e4eca68c 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -492,7 +492,6 @@ boolean xorg_composite_bind_state(struct exa_context *exa, renderer_bind_destination(exa->renderer, dst_surf); bind_blend_state(exa, op, pSrcPicture, pMaskPicture, pDstPicture); - renderer_bind_rasterizer(exa->renderer); bind_shaders(exa, op, pSrcPicture, pMaskPicture, pDstPicture, pSrc, pMask); bind_samplers(exa, op, pSrcPicture, pMaskPicture, pDstPicture, pSrc, pMask, pDst); @@ -561,7 +560,6 @@ boolean xorg_solid_bind_state(struct exa_context *exa, fs_traits = FS_SOLID_FILL; renderer_bind_destination(exa->renderer, dst_surf); - renderer_bind_rasterizer(exa->renderer); bind_blend_state(exa, PictOpSrc, NULL, NULL, NULL); cso_set_samplers(exa->renderer->cso, 0, NULL); cso_set_sampler_textures(exa->renderer->cso, 0, NULL); diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 63a7883cd1..32b056a362 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -97,10 +97,18 @@ static void renderer_init_state(struct xorg_renderer *r) { struct pipe_depth_stencil_alpha_state dsa; + struct pipe_rasterizer_state raster; /* set common initial clip state */ memset(&dsa, 0, sizeof(struct pipe_depth_stencil_alpha_state)); cso_set_depth_stencil_alpha(r->cso, &dsa); + + + /* XXX: move to renderer_init_state? */ + memset(&raster, 0, sizeof(struct pipe_rasterizer_state)); + raster.gl_rasterization_rules = 1; + cso_set_rasterizer(r->cso, &raster); + } @@ -412,16 +420,6 @@ void renderer_destroy(struct xorg_renderer *r) -void renderer_bind_rasterizer(struct xorg_renderer *r) -{ - struct pipe_rasterizer_state raster; - - /* XXX: move to renderer_init_state? */ - memset(&raster, 0, sizeof(struct pipe_rasterizer_state)); - raster.gl_rasterization_rules = 1; - cso_set_rasterizer(r->cso, &raster); -} - void renderer_set_constants(struct xorg_renderer *r, int shader_type, const float *params, @@ -533,8 +531,6 @@ static void renderer_copy_texture(struct xorg_renderer *r, /* texture */ cso_set_sampler_textures(r->cso, 1, &src); - renderer_bind_rasterizer(r); - /* shaders */ shader = xorg_shaders_get(r->shaders, VS_COMPOSITE, @@ -632,8 +628,6 @@ void renderer_copy_pixmap(struct xorg_renderer *r, int width, int height) { float dst_loc[4], src_loc[4]; - float dst_bounds[4], src_bounds[4]; - float src_shift[4], dst_shift[4], shift[4]; struct pipe_texture *dst = dst_priv->tex; struct pipe_texture *src = src_priv->tex; diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h index 51e0272b46..249bb719b6 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.h +++ b/src/gallium/state_trackers/xorg/xorg_renderer.h @@ -44,7 +44,6 @@ void renderer_bind_framebuffer(struct xorg_renderer *r, struct exa_pixmap_priv *priv); void renderer_bind_viewport(struct xorg_renderer *r, struct exa_pixmap_priv *dst); -void renderer_bind_rasterizer(struct xorg_renderer *r); void renderer_set_constants(struct xorg_renderer *r, int shader_type, const float *buffer, -- cgit v1.2.3 From fa799f81dec1b72e59008b7029d94a00bcf821bb Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 26 Nov 2009 10:34:28 +0000 Subject: st/xorg: split up shared Done call The two users of composite (Composite and Solid) now call a new xorg_composite_done() from their Done functions, while CopyDone is directly implemented on top of xorg_renderer.c. --- src/gallium/state_trackers/xorg/xorg_composite.c | 10 ++ src/gallium/state_trackers/xorg/xorg_composite.h | 4 + src/gallium/state_trackers/xorg/xorg_exa.c | 138 ++++++++++++++--------- 3 files changed, 99 insertions(+), 53 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 67e4eca68c..760adafa06 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -582,3 +582,13 @@ void xorg_solid(struct exa_context *exa, x0, y0, x1, y1, exa->solid_color); } +void +xorg_composite_done(struct exa_context *exa) +{ + renderer_draw_flush(exa->renderer); + + exa->transform.has_src = FALSE; + exa->transform.has_mask = FALSE; + exa->has_solid_color = FALSE; + exa->num_bound_samplers = 0; +} diff --git a/src/gallium/state_trackers/xorg/xorg_composite.h b/src/gallium/state_trackers/xorg/xorg_composite.h index 236addf1ce..ec71ebfe0d 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.h +++ b/src/gallium/state_trackers/xorg/xorg_composite.h @@ -29,4 +29,8 @@ void xorg_solid(struct exa_context *exa, struct exa_pixmap_priv *pixmap, int x0, int y0, int x1, int y1); + +void +xorg_composite_done(struct exa_context *exa); + #endif diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 308eb2715e..336be3f301 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -149,20 +149,6 @@ exa_get_pipe_format(int depth, enum pipe_format *format, int *bbp, int *picture_ } } -static void -xorg_exa_common_done(struct exa_context *exa) -{ - renderer_draw_flush(exa->renderer); - - exa->copy.src = NULL; - exa->copy.dst = NULL; - pipe_surface_reference(&exa->copy.src_surface, NULL); - pipe_surface_reference(&exa->copy.dst_surface, NULL); - exa->transform.has_src = FALSE; - exa->transform.has_mask = FALSE; - exa->has_solid_color = FALSE; - exa->num_bound_samplers = 0; -} /* * Static exported EXA functions @@ -180,6 +166,11 @@ ExaMarkSync(ScreenPtr pScreen) return 1; } + +/*********************************************************************** + * Screen upload/download + */ + static Bool ExaDownloadFromScreen(PixmapPtr pPix, int x, int y, int w, int h, char *dst, int dst_pitch) @@ -329,29 +320,9 @@ ExaFinishAccess(PixmapPtr pPix, int index) } } -static void -ExaDone(PixmapPtr pPixmap) -{ - ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; - modesettingPtr ms = modesettingPTR(pScrn); - struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap); - struct exa_context *exa = ms->exa; - - if (!priv) - return; - - xorg_exa_common_done(exa); -} - -static void -ExaDoneComposite(PixmapPtr pPixmap) -{ - ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; - modesettingPtr ms = modesettingPTR(pScrn); - struct exa_context *exa = ms->exa; - - xorg_exa_common_done(exa); -} +/*********************************************************************** + * Solid Fills + */ static Bool ExaPrepareSolid(PixmapPtr pPixmap, int alu, Pixel planeMask, Pixel fg) @@ -400,6 +371,25 @@ ExaSolid(PixmapPtr pPixmap, int x0, int y0, int x1, int y1) xorg_solid(exa, priv, x0, y0, x1, y1) ; } + +static void +ExaDoneSolid(PixmapPtr pPixmap) +{ + ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; + modesettingPtr ms = modesettingPTR(pScrn); + struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap); + struct exa_context *exa = ms->exa; + + if (!priv) + return; + + xorg_composite_done(exa); +} + +/*********************************************************************** + * Copy Blits + */ + static Bool ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, int ydir, int alu, Pixel planeMask) @@ -492,6 +482,26 @@ ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY, } } +static void +ExaDoneCopy(PixmapPtr pPixmap) +{ + ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; + modesettingPtr ms = modesettingPTR(pScrn); + struct exa_pixmap_priv *priv = exaGetPixmapDriverPrivate(pPixmap); + struct exa_context *exa = ms->exa; + + if (!priv) + return; + + renderer_draw_flush(exa->renderer); + + exa->copy.src = NULL; + exa->copy.dst = NULL; + pipe_surface_reference(&exa->copy.src_surface, NULL); + pipe_surface_reference(&exa->copy.dst_surface, NULL); +} + + static Bool picture_check_formats(struct exa_pixmap_priv *pSrc, PicturePtr pSrcPicture) @@ -528,6 +538,30 @@ picture_check_formats(struct exa_pixmap_priv *pSrc, PicturePtr pSrcPicture) return FALSE; } +/*********************************************************************** + * Composite entrypoints + */ + +static Bool +ExaCheckComposite(int op, + PicturePtr pSrcPicture, PicturePtr pMaskPicture, + PicturePtr pDstPicture) +{ + ScrnInfoPtr pScrn = xf86Screens[pDstPicture->pDrawable->pScreen->myNum]; + modesettingPtr ms = modesettingPTR(pScrn); + struct exa_context *exa = ms->exa; + boolean accelerated = xorg_composite_accelerated(op, + pSrcPicture, + pMaskPicture, + pDstPicture); +#if DEBUG_PRINT + debug_printf("ExaCheckComposite(%d, %p, %p, %p) = %d\n", + op, pSrcPicture, pMaskPicture, pDstPicture, accelerated); +#endif + return exa->accel && accelerated; +} + + static Bool ExaPrepareComposite(int op, PicturePtr pSrcPicture, PicturePtr pMaskPicture, PicturePtr pDstPicture, @@ -624,25 +658,23 @@ ExaComposite(PixmapPtr pDst, int srcX, int srcY, int maskX, int maskY, dstX, dstY, width, height); } -static Bool -ExaCheckComposite(int op, - PicturePtr pSrcPicture, PicturePtr pMaskPicture, - PicturePtr pDstPicture) + + +static void +ExaDoneComposite(PixmapPtr pPixmap) { - ScrnInfoPtr pScrn = xf86Screens[pDstPicture->pDrawable->pScreen->myNum]; + ScrnInfoPtr pScrn = xf86Screens[pPixmap->drawable.pScreen->myNum]; modesettingPtr ms = modesettingPTR(pScrn); struct exa_context *exa = ms->exa; - boolean accelerated = xorg_composite_accelerated(op, - pSrcPicture, - pMaskPicture, - pDstPicture); -#if DEBUG_PRINT - debug_printf("ExaCheckComposite(%d, %p, %p, %p) = %d\n", - op, pSrcPicture, pMaskPicture, pDstPicture, accelerated); -#endif - return exa->accel && accelerated; + + xorg_composite_done(exa); } + +/*********************************************************************** + * Pixmaps + */ + static void * ExaCreatePixmap(ScreenPtr pScreen, int size, int align) { @@ -935,10 +967,10 @@ xorg_exa_init(ScrnInfoPtr pScrn, Bool accel) pExa->MarkSync = ExaMarkSync; pExa->PrepareSolid = ExaPrepareSolid; pExa->Solid = ExaSolid; - pExa->DoneSolid = ExaDone; + pExa->DoneSolid = ExaDoneSolid; pExa->PrepareCopy = ExaPrepareCopy; pExa->Copy = ExaCopy; - pExa->DoneCopy = ExaDone; + pExa->DoneCopy = ExaDoneCopy; pExa->CheckComposite = ExaCheckComposite; pExa->PrepareComposite = ExaPrepareComposite; pExa->Composite = ExaComposite; -- cgit v1.2.3 From 91a5131e6b4b9d55c7123d3a8334826a443abcf6 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 26 Nov 2009 10:40:40 +0000 Subject: st/xorg: don't set up constant buffer for non-xv fragment shaders These currently don't reference any constants. Can add this back if newer shaders need them, but in the meantime don't create a new constant buffer every time we do a blit. --- src/gallium/state_trackers/xorg/xorg_composite.c | 17 ----------------- src/gallium/state_trackers/xorg/xorg_renderer.c | 13 ------------- 2 files changed, 30 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 760adafa06..a35249d60d 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -423,22 +423,7 @@ bind_samplers(struct exa_context *exa, int op, -static void -setup_fs_constant_buffer(struct exa_context *exa) -{ - const int param_bytes = 4 * sizeof(float); - const float fs_consts[8] = { - 0, 0, 0, 1, - }; - renderer_set_constants(exa->renderer, PIPE_SHADER_FRAGMENT, - fs_consts, param_bytes); -} -static void -setup_constant_buffers(struct exa_context *exa, struct exa_pixmap_priv *pDst) -{ - setup_fs_constant_buffer(exa); -} static INLINE boolean matrix_from_pict_transform(PictTransform *trans, float *matrix) { @@ -495,7 +480,6 @@ boolean xorg_composite_bind_state(struct exa_context *exa, bind_shaders(exa, op, pSrcPicture, pMaskPicture, pDstPicture, pSrc, pMask); bind_samplers(exa, op, pSrcPicture, pMaskPicture, pDstPicture, pSrc, pMask, pDst); - setup_constant_buffers(exa, pDst); setup_transforms(exa, pSrcPicture, pMaskPicture); @@ -563,7 +547,6 @@ boolean xorg_solid_bind_state(struct exa_context *exa, bind_blend_state(exa, PictOpSrc, NULL, NULL, NULL); cso_set_samplers(exa->renderer->cso, 0, NULL); cso_set_sampler_textures(exa->renderer->cso, 0, NULL); - setup_constant_buffers(exa, pixmap); shader = xorg_shaders_get(exa->renderer->shaders, vs_traits, fs_traits); cso_set_vertex_shader_handle(exa->renderer->cso, shader.vs); diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 32b056a362..589942c915 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -441,17 +441,6 @@ void renderer_set_constants(struct xorg_renderer *r, r->pipe->set_constant_buffer(r->pipe, shader_type, 0, cbuf); } -static void -setup_fs_constant_buffer(struct xorg_renderer *r) -{ - const int param_bytes = 4 * sizeof(float); - const float fs_consts[8] = { - 0, 0, 0, 1, - }; - renderer_set_constants(r, PIPE_SHADER_FRAGMENT, - fs_consts, param_bytes); -} - static void renderer_copy_texture(struct xorg_renderer *r, struct pipe_texture *src, @@ -538,8 +527,6 @@ static void renderer_copy_texture(struct xorg_renderer *r, cso_set_vertex_shader_handle(r->cso, shader.vs); cso_set_fragment_shader_handle(r->cso, shader.fs); - setup_fs_constant_buffer(r); - /* draw quad */ buf = setup_vertex_data_tex(r, dx1, dy1, -- cgit v1.2.3 From 8544c309d0a296449d11cf2cf52ca306662dc41d Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 26 Nov 2009 11:17:06 +0000 Subject: st/xorg: split copy operation into prepare/copy/done phases Any high-overhead one-off tasks are moved into the prepare hook. --- src/gallium/state_trackers/xorg/xorg_exa.c | 46 ++++++- src/gallium/state_trackers/xorg/xorg_exa.h | 4 + src/gallium/state_trackers/xorg/xorg_renderer.c | 160 +++++++----------------- src/gallium/state_trackers/xorg/xorg_renderer.h | 19 ++- src/gallium/state_trackers/xorg/xorg_xv.c | 1 - 5 files changed, 102 insertions(+), 128 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 336be3f301..b55e161b52 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -430,8 +430,17 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, exa->copy.src = src_priv; exa->copy.dst = priv; - - if (0 && exa->pipe->surface_copy) { + + /* For same-surface copies, the pipe->surface_copy path is clearly + * superior, providing it is implemented. In other cases it's not + * clear what the better path would be, and eventually we'd + * probably want to gather timings and choose dynamically. + */ + if (exa->pipe->surface_copy && + exa->copy.src == exa->copy.dst) { + + exa->copy.use_surface_copy = TRUE; + exa->copy.src_surface = exa->scrn->get_tex_surface( exa->scrn, exa->copy.src->tex, @@ -444,6 +453,27 @@ ExaPrepareCopy(PixmapPtr pSrcPixmap, PixmapPtr pDstPixmap, int xdir, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE ); } + else { + exa->copy.use_surface_copy = FALSE; + + if (exa->copy.dst == exa->copy.src) + exa->copy.src_texture = renderer_clone_texture( exa->renderer, + exa->copy.src->tex ); + else + pipe_texture_reference(&exa->copy.src_texture, + exa->copy.src->tex); + + exa->copy.dst_surface = + exa->scrn->get_tex_surface(exa->scrn, + exa->copy.dst->tex, + 0, 0, 0, + PIPE_BUFFER_USAGE_GPU_WRITE); + + + renderer_copy_prepare(exa->renderer, + exa->copy.dst_surface, + exa->copy.src_texture ); + } return exa->accel; @@ -465,7 +495,7 @@ ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY, debug_assert(priv == exa->copy.dst); - if (exa->copy.src_surface && exa->copy.dst_surface) { + if (exa->copy.use_surface_copy) { /* XXX: consider exposing >1 box in surface_copy interface. */ exa->pipe->surface_copy( exa->pipe, @@ -476,9 +506,12 @@ ExaCopy(PixmapPtr pDstPixmap, int srcX, int srcY, int dstX, int dstY, width, height ); } else { - renderer_copy_pixmap(exa->renderer, exa->copy.dst, dstX, dstY, - exa->copy.src, srcX, srcY, - width, height); + renderer_copy_pixmap(exa->renderer, + dstX, dstY, + srcX, srcY, + width, height, + exa->copy.src_texture->width[0], + exa->copy.src_texture->height[0]); } } @@ -499,6 +532,7 @@ ExaDoneCopy(PixmapPtr pPixmap) exa->copy.dst = NULL; pipe_surface_reference(&exa->copy.src_surface, NULL); pipe_surface_reference(&exa->copy.dst_surface, NULL); + pipe_texture_reference(&exa->copy.src_texture, NULL); } diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h index a67dda65a5..0c29187486 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.h +++ b/src/gallium/state_trackers/xorg/xorg_exa.h @@ -35,11 +35,15 @@ struct exa_context } transform; struct { + boolean use_surface_copy; + struct exa_pixmap_priv *src; struct exa_pixmap_priv *dst; struct pipe_surface *src_surface; struct pipe_surface *dst_surface; + + struct pipe_texture *src_texture; } copy; }; diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 589942c915..16ac5d204d 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -195,23 +195,6 @@ add_vertex_data1(struct xorg_renderer *r, add_vertex_1tex(r, dstX, dstY + height, s3, t3); } -static struct pipe_buffer * -setup_vertex_data_tex(struct xorg_renderer *r, - float x0, float y0, float x1, float y1, - float s0, float t0, float s1, float t1, - float z) -{ - /* 1st vertex */ - add_vertex_1tex(r, x0, y0, s0, t0); - /* 2nd vertex */ - add_vertex_1tex(r, x1, y0, s1, t0); - /* 3rd vertex */ - add_vertex_1tex(r, x1, y1, s1, t1); - /* 4th vertex */ - add_vertex_1tex(r, x0, y1, s0, t1); - - return renderer_buffer_create(r); -} static INLINE void add_vertex_2tex(struct xorg_renderer *r, @@ -442,47 +425,15 @@ void renderer_set_constants(struct xorg_renderer *r, } -static void renderer_copy_texture(struct xorg_renderer *r, - struct pipe_texture *src, - float sx1, float sy1, - float sx2, float sy2, - struct pipe_texture *dst, - float dx1, float dy1, - float dx2, float dy2) +void renderer_copy_prepare(struct xorg_renderer *r, + struct pipe_surface *dst_surface, + struct pipe_texture *src_texture) { struct pipe_context *pipe = r->pipe; struct pipe_screen *screen = pipe->screen; - struct pipe_buffer *buf; - struct pipe_surface *dst_surf = screen->get_tex_surface( - screen, dst, 0, 0, 0, - PIPE_BUFFER_USAGE_GPU_WRITE); - float s0, t0, s1, t1; struct xorg_shader shader; - assert(src->width[0] != 0); - assert(src->height[0] != 0); - assert(dst->width[0] != 0); - assert(dst->height[0] != 0); - -#if 1 - s0 = sx1 / src->width[0]; - s1 = sx2 / src->width[0]; - t0 = sy1 / src->height[0]; - t1 = sy2 / src->height[0]; -#else - s0 = 0; - s1 = 1; - t0 = 0; - t1 = 1; -#endif - -#if 0 - debug_printf("copy texture src=[%f, %f, %f, %f], dst=[%f, %f, %f, %f], tex=[%f, %f, %f, %f]\n", - sx1, sy1, sx2, sy2, dx1, dy1, dx2, dy2, - s0, t0, s1, t1); -#endif - - assert(screen->is_format_supported(screen, dst_surf->format, + assert(screen->is_format_supported(screen, dst_surface->format, PIPE_TEXTURE_2D, PIPE_TEXTURE_USAGE_RENDER_TARGET, 0)); @@ -515,10 +466,10 @@ static void renderer_copy_texture(struct xorg_renderer *r, cso_single_sampler_done(r->cso); } - renderer_bind_destination(r, dst_surf); + renderer_bind_destination(r, dst_surface); /* texture */ - cso_set_sampler_textures(r->cso, 1, &src); + cso_set_sampler_textures(r->cso, 1, &src_texture); /* shaders */ shader = xorg_shaders_get(r->shaders, @@ -527,27 +478,12 @@ static void renderer_copy_texture(struct xorg_renderer *r, cso_set_vertex_shader_handle(r->cso, shader.vs); cso_set_fragment_shader_handle(r->cso, shader.fs); - /* draw quad */ - buf = setup_vertex_data_tex(r, - dx1, dy1, - dx2, dy2, - s0, t0, s1, t1, - 0.0f); - - if (buf) { - util_draw_vertex_buffer(r->pipe, buf, 0, - PIPE_PRIM_QUADS, - 4, /* verts */ - 2); /* attribs/vert */ - - pipe_buffer_reference(&buf, NULL); - } - - pipe_surface_reference(&dst_surf, NULL); + r->buffer_size = 0; + r->attrs_per_vertex = 2; } -static struct pipe_texture * -create_sampler_texture(struct xorg_renderer *r, +struct pipe_texture * +renderer_clone_texture(struct xorg_renderer *r, struct pipe_texture *src) { enum pipe_format format; @@ -556,7 +492,9 @@ create_sampler_texture(struct xorg_renderer *r, struct pipe_texture *pt; struct pipe_texture templ; - pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); + if (pipe->is_texture_referenced(pipe, src, 0, 0) & + PIPE_REFERENCED_FOR_WRITE) + pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); /* the coming in texture should already have that invariance */ debug_assert(screen->is_format_supported(screen, src->format, @@ -610,52 +548,40 @@ create_sampler_texture(struct xorg_renderer *r, void renderer_copy_pixmap(struct xorg_renderer *r, - struct exa_pixmap_priv *dst_priv, int dx, int dy, - struct exa_pixmap_priv *src_priv, int sx, int sy, - int width, int height) + int dx, int dy, + int sx, int sy, + int width, int height, + float src_width, + float src_height) { - float dst_loc[4], src_loc[4]; - struct pipe_texture *dst = dst_priv->tex; - struct pipe_texture *src = src_priv->tex; + float s0, t0, s1, t1; + float x0, y0, x1, y1; - if (r->pipe->is_texture_referenced(r->pipe, src, 0, 0) & - PIPE_REFERENCED_FOR_WRITE) - r->pipe->flush(r->pipe, PIPE_FLUSH_RENDER_CACHE, NULL); - - dst_loc[0] = dx; - dst_loc[1] = dy; - dst_loc[2] = width; - dst_loc[3] = height; - - src_loc[0] = sx; - src_loc[1] = sy; - src_loc[2] = width; - src_loc[3] = height; - - if (src_loc[2] >= 0 && src_loc[3] >= 0 && - dst_loc[2] >= 0 && dst_loc[3] >= 0) { - struct pipe_texture *temp_src = src; - - if (src == dst) - temp_src = create_sampler_texture(r, src); - - renderer_copy_texture(r, - temp_src, - src_loc[0], - src_loc[1], - src_loc[0] + src_loc[2], - src_loc[1] + src_loc[3], - dst, - dst_loc[0], - dst_loc[1], - dst_loc[0] + dst_loc[2], - dst_loc[1] + dst_loc[3]); - - if (src == dst) - pipe_texture_reference(&temp_src, NULL); - } + + /* XXX: could put the texcoord scaling calculation into the vertex + * shader. + */ + s0 = sx / src_width; + s1 = (sx + width) / src_width; + t0 = sy / src_height; + t1 = (sy + height) / src_height; + + x0 = dx; + x1 = dx + width; + y0 = dy; + y1 = dy + height; + + /* draw quad */ + renderer_draw_conditional(r, 4*8); + add_vertex_1tex(r, x0, y0, s0, t0); + add_vertex_1tex(r, x1, y0, s1, t0); + add_vertex_1tex(r, x1, y1, s1, t1); + add_vertex_1tex(r, x0, y1, s0, t1); } + + + void renderer_draw_yuv(struct xorg_renderer *r, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h index 249bb719b6..ba844bf06e 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.h +++ b/src/gallium/state_trackers/xorg/xorg_renderer.h @@ -48,10 +48,6 @@ void renderer_set_constants(struct xorg_renderer *r, int shader_type, const float *buffer, int size); -void renderer_copy_pixmap(struct xorg_renderer *r, - struct exa_pixmap_priv *dst_priv, int dx, int dy, - struct exa_pixmap_priv *src_priv, int sx, int sy, - int width, int height); void renderer_draw_yuv(struct xorg_renderer *r, @@ -78,5 +74,20 @@ void renderer_texture(struct xorg_renderer *r, void renderer_draw_flush(struct xorg_renderer *r); +struct pipe_texture * +renderer_clone_texture(struct xorg_renderer *r, + struct pipe_texture *src); + +void renderer_copy_prepare(struct xorg_renderer *r, + struct pipe_surface *dst_surface, + struct pipe_texture *src_texture); + +void renderer_copy_pixmap(struct xorg_renderer *r, + int dx, int dy, + int sx, int sy, + int width, int height, + float src_width, + float src_height); + #endif diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index 7a43da8988..7c05c7af39 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -453,7 +453,6 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id, renderer_bind_destination(pPriv->r, dst_surf); bind_blend_state(pPriv); - renderer_bind_rasterizer(pPriv->r); bind_shaders(pPriv); bind_samplers(pPriv); setup_fs_video_constants(pPriv->r, hdtv); -- cgit v1.2.3 From 7b0e4adaf21d4c788657eff41cb51d5c89647309 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 26 Nov 2009 11:55:47 +0000 Subject: st/xorg: render throttling in block handler Similar to the classic swapbuffer throttling in GL drivers, put an upper bound on the number of outstanding chunks of rendering the state tracker can generate -- where calling the block handler denotes a chunk. Currently that number is set at around 4 "chunks", but could be tweaked up or down. If a better measure for the amount of outstanding rendering is found, that would be fine too. As it stands, this improves interactivity by preventing the X server from queueing up arbitary amounts of rendering. --- src/gallium/state_trackers/xorg/xorg_driver.c | 20 ++++++++++++++++++-- src/gallium/state_trackers/xorg/xorg_renderer.c | 5 ----- src/gallium/state_trackers/xorg/xorg_tracker.h | 4 ++++ 3 files changed, 22 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index c74fb28072..4c66354ad4 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -450,8 +450,24 @@ static void drv_block_handler(int i, pointer blockData, pointer pTimeout, pScreen->BlockHandler(i, blockData, pTimeout, pReadmask); pScreen->BlockHandler = drv_block_handler; - if (ms->ctx) - ms->ctx->flush(ms->ctx, PIPE_FLUSH_RENDER_CACHE, NULL); + if (ms->ctx) { + int j; + + ms->ctx->flush(ms->ctx, PIPE_FLUSH_RENDER_CACHE, &ms->fence[XORG_NR_FENCES-1]); + + if (ms->fence[0]) + ms->ctx->screen->fence_finish(ms->ctx->screen, ms->fence[0], 0); + + /* The amount of rendering generated by a block handler can be + * quite small. Let us get a fair way ahead of hardware before + * throttling. + */ + for (j = 0; j < XORG_NR_FENCES; j++) + ms->screen->fence_reference(ms->screen, + &ms->fence[j], + ms->fence[j+1]); + } + #ifdef DRM_MODE_FEATURE_DIRTYFB { diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 16ac5d204d..d9698e32e1 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -13,11 +13,6 @@ #include -enum AxisOrientation { - Y0_BOTTOM, - Y0_TOP -}; - #define floatsEqual(x, y) (fabs(x - y) <= 0.00001f * MIN2(fabs(x), fabs(y))) #define floatIsZero(x) (floatsEqual((x) + 1, 1)) diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h index 31e11b4809..c6c7b2fe15 100644 --- a/src/gallium/state_trackers/xorg/xorg_tracker.h +++ b/src/gallium/state_trackers/xorg/xorg_tracker.h @@ -63,6 +63,8 @@ typedef struct ScrnInfoPtr pScrn_2; } EntRec, *EntPtr; +#define XORG_NR_FENCES 3 + typedef struct _modesettingRec { /* drm */ @@ -86,6 +88,8 @@ typedef struct _modesettingRec unsigned int SaveGeneration; void (*blockHandler)(int, pointer, pointer, pointer); + struct pipe_fence_handle *fence[XORG_NR_FENCES]; + CreateScreenResourcesProcPtr createScreenResources; /* for frontbuffer backing store */ -- cgit v1.2.3 From c783f5cfd891e6b8e9dc622ad0950e5859b5a0c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 26 Nov 2009 12:02:14 +0000 Subject: svga: Remove spurious argument to SVGA_DBG. --- src/gallium/drivers/svga/svga_screen_texture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_screen_texture.c b/src/gallium/drivers/svga/svga_screen_texture.c index d61d88114c..e7301aba84 100644 --- a/src/gallium/drivers/svga/svga_screen_texture.c +++ b/src/gallium/drivers/svga/svga_screen_texture.c @@ -556,7 +556,7 @@ svga_texture_view_surface(struct pipe_context *pipe, return NULL; } - SVGA_DBG(DEBUG_DMA, "surface_create for texture view\n", handle); + SVGA_DBG(DEBUG_DMA, "surface_create for texture view\n"); handle = svga_screen_surface_create(ss, key); if (!handle) { key->cachable = 0; -- cgit v1.2.3 From 41423c01b257395b08a5e7a53093bc87aa85739b Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 26 Nov 2009 12:52:45 +0000 Subject: st/xorg: remove debugging flush Accidentally committed in 7fbdbad5c02e3d5bfbf0e641e2aec224e39fa974 ('st/xorg: consolidate some dest surface state setting') --- src/gallium/state_trackers/xorg/xorg_renderer.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index d9698e32e1..9cb65b0aac 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -74,7 +74,6 @@ renderer_draw(struct xorg_renderer *r) r->attrs_per_vertex); /* attribs/vert */ pipe_buffer_reference(&buf, NULL); - pipe->flush(pipe, PIPE_FLUSH_RENDER_CACHE, NULL); } } -- cgit v1.2.3 From dfb871d4032f37b872c975269c5d666491f1056b Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 26 Nov 2009 14:23:07 +0000 Subject: st/xorg: formatting This directory needs indent run over it. --- src/gallium/state_trackers/xorg/xorg_exa.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index b55e161b52..66315e257b 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -871,15 +871,15 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, dst_surf = exa->scrn->get_tex_surface( exa->scrn, texture, 0, 0, 0, PIPE_BUFFER_USAGE_GPU_WRITE); src_surf = xorg_gpu_surface(exa->pipe->screen, priv); - if (exa->pipe->surface_copy) { - exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf, - 0, 0, min(width, texture->width[0]), - min(height, texture->height[0])); - } else { - util_surface_copy(exa->pipe, FALSE, dst_surf, 0, 0, src_surf, - 0, 0, min(width, texture->width[0]), - min(height, texture->height[0])); - } + if (exa->pipe->surface_copy) { + exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf, + 0, 0, min(width, texture->width[0]), + min(height, texture->height[0])); + } else { + util_surface_copy(exa->pipe, FALSE, dst_surf, 0, 0, src_surf, + 0, 0, min(width, texture->width[0]), + min(height, texture->height[0])); + } exa->scrn->tex_surface_destroy(dst_surf); exa->scrn->tex_surface_destroy(src_surf); } -- cgit v1.2.3 From ecfe1352ccce802c9299c76d600c4d2f33352701 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 26 Nov 2009 14:23:24 +0000 Subject: st/xorg: fix refcounting bugs introduced in earlier commit --- src/gallium/state_trackers/xorg/xorg_composite.c | 3 +++ src/gallium/state_trackers/xorg/xorg_xv.c | 2 ++ 2 files changed, 5 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index a35249d60d..bdc1d9f5da 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -491,6 +491,8 @@ boolean xorg_composite_bind_state(struct exa_context *exa, exa->num_bound_samplers); } + + pipe_surface_reference(&dst_surf, NULL); return TRUE; } @@ -554,6 +556,7 @@ boolean xorg_solid_bind_state(struct exa_context *exa, renderer_begin_solid(exa->renderer); + pipe_surface_reference(&dst_surf, NULL); return TRUE; } diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index 7c05c7af39..0b2556b98e 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -488,6 +488,8 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id, } DamageRegionProcessPending(&pPixmap->drawable); + pipe_surface_reference(&dst_surf, NULL); + return TRUE; } -- cgit v1.2.3 From 3eb3bfb7c761ed41a09c4d1c7eff38f2d92ba3ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 26 Nov 2009 16:00:06 +0100 Subject: st/xorg: Make sure DRI2 blits use GPU copy contents even for software fallback. Fixes 3D apps not updating with a non-GL compositing manager and Option "2DAccel" "off". Also clean up a little pixmap vs. drawable mess. --- src/gallium/state_trackers/xorg/xorg_dri2.c | 30 ++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index feb842fb2d..4fa47548a4 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -272,8 +272,8 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion, modesettingPtr ms = modesettingPTR(pScrn); BufferPrivatePtr dst_priv = pDestBuffer->driverPrivate; BufferPrivatePtr src_priv = pSrcBuffer->driverPrivate; - PixmapPtr src_pixmap; - PixmapPtr dst_pixmap; + DrawablePtr src_draw; + DrawablePtr dst_draw; GCPtr gc; RegionPtr copy_clip; Bool save_accel; @@ -284,12 +284,10 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion, * We need to use the real drawable in CopyArea * so that cliprects and offsets are correct. */ - src_pixmap = src_priv->pPixmap; - dst_pixmap = dst_priv->pPixmap; - if (pSrcBuffer->attachment == DRI2BufferFrontLeft) - src_pixmap = (PixmapPtr)pDraw; - if (pDestBuffer->attachment == DRI2BufferFrontLeft) - dst_pixmap = (PixmapPtr)pDraw; + src_draw = (pSrcBuffer->attachment == DRI2BufferFrontLeft) ? pDraw : + &src_priv->pPixmap->drawable; + dst_draw = (pDestBuffer->attachment == DRI2BufferFrontLeft) ? pDraw : + &dst_priv->pPixmap->drawable; /* * The clients implements glXWaitX with a copy front to fake and then @@ -308,7 +306,7 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion, * must in the glXWaitGL case but we don't know if this is a glXWaitGL * or a glFlush/glFinish call. */ - if (dst_pixmap == src_pixmap) { + if (dst_priv->pPixmap == src_priv->pPixmap) { /* pixmap glXWaitX */ if (pSrcBuffer->attachment == DRI2BufferFrontLeft && pDestBuffer->attachment == DRI2BufferFakeFrontLeft) { @@ -329,7 +327,7 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion, copy_clip = REGION_CREATE(pScreen, NULL, 0); REGION_COPY(pScreen, copy_clip, pRegion); (*gc->funcs->ChangeClip) (gc, CT_REGION, copy_clip, 0); - ValidateGC(&dst_pixmap->drawable, gc); + ValidateGC(dst_draw, gc); /* If this is a full buffer swap, throttle on the previous one */ if (dst_priv->fence && REGION_NUM_RECTS(pRegion) == 1) { @@ -342,9 +340,19 @@ dri2_copy_region(DrawablePtr pDraw, RegionPtr pRegion, } } + /* Try to make sure the blit will be accelerated */ save_accel = ms->exa->accel; ms->exa->accel = TRUE; - (*gc->ops->CopyArea)(&src_pixmap->drawable, &dst_pixmap->drawable, gc, + + /* In case it won't be though, make sure the GPU copy contents of the + * source pixmap will be used for the software fallback - presumably the + * client modified them before calling in here. + */ + exaMoveInPixmap(src_priv->pPixmap); + DamageRegionAppend(src_draw, pRegion); + DamageRegionProcessPending(src_draw); + + (*gc->ops->CopyArea)(src_draw, dst_draw, gc, 0, 0, pDraw->width, pDraw->height, 0, 0); ms->exa->accel = save_accel; -- cgit v1.2.3 From b96218c65622a7814ff8154a91874a5e5a9dc773 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 26 Nov 2009 15:25:09 +0000 Subject: svga: hash the whole key, not just the first four bytes --- src/gallium/drivers/svga/svga_screen_cache.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_screen_cache.c b/src/gallium/drivers/svga/svga_screen_cache.c index 65f5c07a72..689981cc6d 100644 --- a/src/gallium/drivers/svga/svga_screen_cache.c +++ b/src/gallium/drivers/svga/svga_screen_cache.c @@ -41,7 +41,7 @@ static INLINE unsigned svga_screen_cache_bucket(const struct svga_host_surface_cache_key *key) { - return util_hash_crc32( key, sizeof key ) % SVGA_HOST_SURFACE_CACHE_BUCKETS; + return util_hash_crc32( key, sizeof *key ) % SVGA_HOST_SURFACE_CACHE_BUCKETS; } @@ -95,8 +95,8 @@ svga_screen_cache_lookup(struct svga_screen *svgascreen, pipe_mutex_unlock(cache->mutex); if (SVGA_DEBUG & DEBUG_DMA) - debug_printf("%s: cache %s after %u tries\n", __FUNCTION__, - handle ? "hit" : "miss", tries); + debug_printf("%s: cache %s after %u tries (bucket %d)\n", __FUNCTION__, + handle ? "hit" : "miss", tries, bucket); return handle; } -- cgit v1.2.3 From 42db8c8cdb28bd5f83dd57f5d9a70fb5b94dd14e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Thu, 26 Nov 2009 16:46:13 +0100 Subject: st/xorg: Use pipe clear hook for solid fills of whole pixmaps. Can give a little boost e.g. for anti-aliased text rendering. --- src/gallium/state_trackers/xorg/xorg_exa.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 66315e257b..9a7384da88 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -368,6 +368,12 @@ ExaSolid(PixmapPtr pPixmap, int x0, int y0, int x1, int y1) debug_printf("\tExaSolid(%d, %d, %d, %d)\n", x0, y0, x1, y1); #endif + if (x0 == 0 && y0 == 0 && + x1 == pPixmap->drawable.width && y1 == pPixmap->drawable.height) { + exa->pipe->clear(exa->pipe, PIPE_CLEAR_COLOR, exa->solid_color, 0.0, 0); + return; + } + xorg_solid(exa, priv, x0, y0, x1, y1) ; } -- cgit v1.2.3 From 949d95e88a18e5047a6a7ceb1e28a8d80a30fb17 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 24 Nov 2009 22:54:00 +0100 Subject: vmware/xorg: Remove gem include --- src/gallium/winsys/drm/vmware/xorg/Makefile | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/xorg/Makefile b/src/gallium/winsys/drm/vmware/xorg/Makefile index 423728e2b4..48a9b08aa7 100644 --- a/src/gallium/winsys/drm/vmware/xorg/Makefile +++ b/src/gallium/winsys/drm/vmware/xorg/Makefile @@ -7,7 +7,6 @@ include $(TOP)/configs/current INCLUDES = \ $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \ - -I../gem \ -I$(TOP)/src/gallium/include \ -I$(TOP)/src/gallium/drivers \ -I$(TOP)/src/gallium/auxiliary \ -- cgit v1.2.3 From ce56a867f71d0a74172a00869a3c5cb1862f4b04 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 25 Nov 2009 15:45:31 +1000 Subject: r600: add ARB_texture_non_power_of_two support. This makes the miptree rounds up to the near POT for each level for all radeons, however since mipmaps aren't support with NPOT on previous radeons this calculation shouldn't cause any problems. If it does we can just make it r600 only. I tested a few mipmap demos on r500 and they all seem to work. Signed-off-by: Dave Airlie --- src/mesa/drivers/dri/r600/r600_context.c | 2 +- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 26 +++++++++++++++++++----- 2 files changed, 22 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r600_context.c b/src/mesa/drivers/dri/r600/r600_context.c index 7de29e5bb8..25314eff56 100644 --- a/src/mesa/drivers/dri/r600/r600_context.c +++ b/src/mesa/drivers/dri/r600/r600_context.c @@ -111,6 +111,7 @@ static const struct dri_extension card_extensions[] = { {"GL_ARB_texture_env_crossbar", NULL}, {"GL_ARB_texture_env_dot3", NULL}, {"GL_ARB_texture_mirrored_repeat", NULL}, + {"GL_ARB_texture_non_power_of_two", NULL}, {"GL_ARB_vertex_program", GL_ARB_vertex_program_functions}, {"GL_EXT_blend_equation_separate", GL_EXT_blend_equation_separate_functions}, {"GL_EXT_blend_func_separate", GL_EXT_blend_func_separate_functions}, @@ -327,7 +328,6 @@ static void r600InitGLExtensions(GLcontext *ctx) ctx->Extensions.ARB_shader_objects = GL_TRUE; ctx->Extensions.ARB_vertex_shader = GL_TRUE; ctx->Extensions.ARB_fragment_shader = GL_TRUE; - ctx->Extensions.ARB_texture_non_power_of_two = GL_TRUE; ctx->Extensions.EXT_blend_equation_separate = GL_TRUE; ctx->Extensions.ATI_separate_stencil = GL_TRUE; diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index 46603de2e7..f2f7b2a9fd 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -68,6 +68,19 @@ static unsigned get_compressed_image_size( return rowStride * ((height + blockHeight - 1) / blockHeight); } +static int find_next_power_of_two(GLuint value) +{ + int i, tmp; + + i = 0; + tmp = value - 1; + while (tmp) { + tmp >>= 1; + i++; + } + return (1 << i); +} + /** * Compute sizes and fill in offset and blit information for the given * image (determined by \p face and \p level). @@ -80,25 +93,28 @@ static void compute_tex_image_offset(radeonContextPtr rmesa, radeon_mipmap_tree { radeon_mipmap_level *lvl = &mt->levels[level]; uint32_t row_align; + GLuint height; + + height = find_next_power_of_two(lvl->height); /* Find image size in bytes */ if (_mesa_is_format_compressed(mt->mesaFormat)) { lvl->rowstride = get_aligned_compressed_row_stride(mt->mesaFormat, lvl->width, rmesa->texture_compressed_row_align); - lvl->size = get_compressed_image_size(mt->mesaFormat, lvl->rowstride, lvl->height); + lvl->size = get_compressed_image_size(mt->mesaFormat, lvl->rowstride, height); } else if (mt->target == GL_TEXTURE_RECTANGLE_NV) { row_align = rmesa->texture_rect_row_align - 1; lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align; - lvl->size = lvl->rowstride * lvl->height; + lvl->size = lvl->rowstride * height; } else if (mt->tilebits & RADEON_TXO_MICRO_TILE) { /* tile pattern is 16 bytes x2. mipmaps stay 32 byte aligned, * though the actual offset may be different (if texture is less than * 32 bytes width) to the untiled case */ lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) * 2 + 31) & ~31; - lvl->size = lvl->rowstride * ((lvl->height + 1) / 2) * lvl->depth; + lvl->size = lvl->rowstride * ((height + 1) / 2) * lvl->depth; } else { row_align = rmesa->texture_row_align - 1; lvl->rowstride = (_mesa_format_row_stride(mt->mesaFormat, lvl->width) + row_align) & ~row_align; - lvl->size = lvl->rowstride * lvl->height * lvl->depth; + lvl->size = lvl->rowstride * height * lvl->depth; } assert(lvl->size > 0); @@ -110,7 +126,7 @@ static void compute_tex_image_offset(radeonContextPtr rmesa, radeon_mipmap_tree if (RADEON_DEBUG & RADEON_TEXTURE) fprintf(stderr, "level %d, face %d: rs:%d %dx%d at %d\n", - level, face, lvl->rowstride, lvl->width, lvl->height, lvl->faces[face].offset); + level, face, lvl->rowstride, lvl->width, height, lvl->faces[face].offset); } static GLuint minify(GLuint size, GLuint levels) -- cgit v1.2.3 From e4c5fe52c99bdf651aafa1569d9cf901891004d8 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 25 Nov 2009 20:23:22 +1000 Subject: radeon: fix context destroy needing lock for flushing. Thanks to Intel code which I've just stolen pretty much as usual. This fixes fdo bug 22851 which is a dri1 regression since rewrite. Tested by: fpiobaf (Fabio) on #radeon Signed-off-by: Dave Airlie --- src/mesa/drivers/dri/radeon/radeon_lock.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_lock.c b/src/mesa/drivers/dri/radeon/radeon_lock.c index 02de8e5fd1..7ad781ba61 100644 --- a/src/mesa/drivers/dri/radeon/radeon_lock.c +++ b/src/mesa/drivers/dri/radeon/radeon_lock.c @@ -62,8 +62,6 @@ void radeonGetLock(radeonContextPtr rmesa, GLuint flags) __DRIdrawablePrivate *const readable = radeon_get_readable(rmesa); __DRIscreenPrivate *sPriv = rmesa->dri.screen; - assert(drawable != NULL); - drmGetLock(rmesa->dri.fd, rmesa->dri.hwContext, flags); /* The window might have moved, so we might need to get new clip @@ -74,12 +72,13 @@ void radeonGetLock(radeonContextPtr rmesa, GLuint flags) * Since the hardware state depends on having the latest drawable * clip rects, all state checking must be done _after_ this call. */ - DRI_VALIDATE_DRAWABLE_INFO(sPriv, drawable); - if (drawable != readable) { + if (drawable) + DRI_VALIDATE_DRAWABLE_INFO(sPriv, drawable); + if (readable && drawable != readable) { DRI_VALIDATE_DRAWABLE_INFO(sPriv, readable); } - if (rmesa->lastStamp != drawable->lastStamp) { + if (drawable && (rmesa->lastStamp != drawable->lastStamp)) { radeon_window_moved(rmesa); rmesa->lastStamp = drawable->lastStamp; } -- cgit v1.2.3 From ea6b36ca3fe519e8c8dcb55b5f16353738455d0a Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 25 Nov 2009 15:56:10 +0100 Subject: tgsi: Update raw token dumper after token definition changes. --- src/gallium/auxiliary/tgsi/tgsi_dump_c.c | 148 +++++++------------------------ 1 file changed, 32 insertions(+), 116 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c index 77f671e9eb..77b653330c 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c @@ -113,13 +113,6 @@ static const char *TGSI_SATS[] = "SAT_MINUS_PLUS_ONE" }; -static const char *TGSI_INSTRUCTION_EXTS[] = -{ - "", - "INSTRUCTION_EXT_TYPE_LABEL", - "INSTRUCTION_EXT_TYPE_TEXTURE" -}; - static const char *TGSI_SWIZZLES[] = { "SWIZZLE_X", @@ -141,12 +134,6 @@ static const char *TGSI_TEXTURES[] = "TEXTURE_SHADOWRECT" }; -static const char *TGSI_SRC_REGISTER_EXTS[] = -{ - "", - "SRC_REGISTER_EXT_TYPE_MOD" -}; - static const char *TGSI_WRITEMASKS[] = { "0", @@ -167,23 +154,6 @@ static const char *TGSI_WRITEMASKS[] = "WRITEMASK_XYZW" }; -static const char *TGSI_DST_REGISTER_EXTS[] = -{ - "", - "DST_REGISTER_EXT_TYPE_MODULATE" -}; - -static const char *TGSI_MODULATES[] = -{ - "MODULATE_1X", - "MODULATE_2X", - "MODULATE_4X", - "MODULATE_8X", - "MODULATE_HALF", - "MODULATE_QUARTER", - "MODULATE_EIGHTH" -}; - static void dump_declaration_verbose( struct tgsi_full_declaration *decl, @@ -216,6 +186,14 @@ dump_declaration_verbose( TXT( "\nSemantic : " ); UID( decl->Declaration.Semantic ); } + if (deflt || fd->Declaration.Centroid != decl->Declaration.Centroid) { + TXT("\nCentroid : "); + UID(decl->Declaration.Centroid); + } + if (deflt || fd->Declaration.Invariant != decl->Declaration.Invariant) { + TXT("\nInvariant : "); + UID(decl->Declaration.Invariant); + } if( ignored ) { TXT( "\nPadding : " ); UIX( decl->Declaration.Padding ); @@ -292,44 +270,44 @@ dump_instruction_verbose( TXT( "\nNumSrcRegs : " ); UID( inst->Instruction.NumSrcRegs ); } + if (deflt || fi->Instruction.Predicate != inst->Instruction.Predicate) { + TXT("\nPredicate : "); + UID(inst->Instruction.Predicate); + } + if (deflt || fi->Instruction.Label != inst->Instruction.Label) { + TXT("\nLabel : "); + UID(inst->Instruction.Label); + } + if (deflt || fi->Instruction.Texture != inst->Instruction.Texture) { + TXT("\nTexture : "); + UID(inst->Instruction.Texture); + } if( ignored ) { TXT( "\nPadding : " ); UIX( inst->Instruction.Padding ); } - if( deflt || tgsi_compare_instruction_ext_label( inst->InstructionExtLabel, fi->InstructionExtLabel ) ) { + if (deflt || inst->Instruction.Label) { EOL(); - TXT( "\nType : " ); - ENM( inst->InstructionExtLabel.Type, TGSI_INSTRUCTION_EXTS ); - if( deflt || fi->InstructionExtLabel.Label != inst->InstructionExtLabel.Label ) { + if (deflt || fi->Label.Label != inst->Label.Label) { TXT( "\nLabel : " ); - UID( inst->InstructionExtLabel.Label ); + UID(inst->Label.Label); } if( ignored ) { TXT( "\nPadding : " ); - UIX( inst->InstructionExtLabel.Padding ); - if( deflt || fi->InstructionExtLabel.Extended != inst->InstructionExtLabel.Extended ) { - TXT( "\nExtended: " ); - UID( inst->InstructionExtLabel.Extended ); - } + UIX(inst->Label.Padding); } } - if( deflt || tgsi_compare_instruction_ext_texture( inst->InstructionExtTexture, fi->InstructionExtTexture ) ) { + if (deflt || inst->Instruction.Texture) { EOL(); - TXT( "\nType : " ); - ENM( inst->InstructionExtTexture.Type, TGSI_INSTRUCTION_EXTS ); - if( deflt || fi->InstructionExtTexture.Texture != inst->InstructionExtTexture.Texture ) { + if (deflt || fi->Texture.Texture != inst->Texture.Texture) { TXT( "\nTexture : " ); - ENM( inst->InstructionExtTexture.Texture, TGSI_TEXTURES ); + ENM(inst->Texture.Texture, TGSI_TEXTURES); } if( ignored ) { TXT( "\nPadding : " ); - UIX( inst->InstructionExtTexture.Padding ); - if( deflt || fi->InstructionExtTexture.Extended != inst->InstructionExtTexture.Extended ) { - TXT( "\nExtended: " ); - UID( inst->InstructionExtTexture.Extended ); - } + UIX(inst->Texture.Padding); } } @@ -361,28 +339,6 @@ dump_instruction_verbose( if( ignored ) { TXT( "\nPadding : " ); UIX( dst->Register.Padding ); - if( deflt || fd->Register.Extended != dst->Register.Extended ) { - TXT( "\nExtended : " ); - UID( dst->Register.Extended ); - } - } - - if( deflt || tgsi_compare_dst_register_ext_modulate( dst->RegisterExtModulate, fd->RegisterExtModulate ) ) { - EOL(); - TXT( "\nType : " ); - ENM( dst->RegisterExtModulate.Type, TGSI_DST_REGISTER_EXTS ); - if( deflt || fd->RegisterExtModulate.Modulate != dst->RegisterExtModulate.Modulate ) { - TXT( "\nModulate: " ); - ENM( dst->RegisterExtModulate.Modulate, TGSI_MODULATES ); - } - if( ignored ) { - TXT( "\nPadding : " ); - UIX( dst->RegisterExtModulate.Padding ); - if( deflt || fd->RegisterExtModulate.Extended != dst->RegisterExtModulate.Extended ) { - TXT( "\nExtended: " ); - UID( dst->RegisterExtModulate.Extended ); - } - } } } @@ -409,6 +365,10 @@ dump_instruction_verbose( TXT( "\nSwizzleW : " ); ENM( src->Register.SwizzleW, TGSI_SWIZZLES ); } + if (deflt || fs->Register.Absolute != src->Register.Absolute) { + TXT("\nAbsolute : "); + UID(src->Register.Absolute); + } if( deflt || fs->Register.Negate != src->Register.Negate ) { TXT( "\nNegate : " ); UID( src->Register.Negate ); @@ -427,46 +387,6 @@ dump_instruction_verbose( TXT( "\nIndex : " ); SID( src->Register.Index ); } - if( ignored ) { - if( deflt || fs->Register.Extended != src->Register.Extended ) { - TXT( "\nExtended : " ); - UID( src->Register.Extended ); - } - } - - if( deflt || tgsi_compare_src_register_ext_mod( src->RegisterExtMod, fs->RegisterExtMod ) ) { - EOL(); - TXT( "\nType : " ); - ENM( src->RegisterExtMod.Type, TGSI_SRC_REGISTER_EXTS ); - if( deflt || fs->RegisterExtMod.Complement != src->RegisterExtMod.Complement ) { - TXT( "\nComplement: " ); - UID( src->RegisterExtMod.Complement ); - } - if( deflt || fs->RegisterExtMod.Bias != src->RegisterExtMod.Bias ) { - TXT( "\nBias : " ); - UID( src->RegisterExtMod.Bias ); - } - if( deflt || fs->RegisterExtMod.Scale2X != src->RegisterExtMod.Scale2X ) { - TXT( "\nScale2X : " ); - UID( src->RegisterExtMod.Scale2X ); - } - if( deflt || fs->RegisterExtMod.Absolute != src->RegisterExtMod.Absolute ) { - TXT( "\nAbsolute : " ); - UID( src->RegisterExtMod.Absolute ); - } - if( deflt || fs->RegisterExtMod.Negate != src->RegisterExtMod.Negate ) { - TXT( "\nNegate : " ); - UID( src->RegisterExtMod.Negate ); - } - if( ignored ) { - TXT( "\nPadding : " ); - UIX( src->RegisterExtMod.Padding ); - if( deflt || fs->RegisterExtMod.Extended != src->RegisterExtMod.Extended ) { - TXT( "\nExtended : " ); - UID( src->RegisterExtMod.Extended ); - } - } - } } } @@ -510,10 +430,6 @@ tgsi_dump_c( if( ignored ) { TXT( "\nSize : " ); UID( parse.FullToken.Token.NrTokens ); - if( deflt || parse.FullToken.Token.Extended ) { - TXT( "\nExtended : " ); - UID( parse.FullToken.Token.Extended ); - } } switch( parse.FullToken.Token.Type ) { -- cgit v1.2.3 From e13add8cae4637d9cd2f6c40c68de30701736abf Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Wed, 25 Nov 2009 16:08:36 +0100 Subject: tgsi: Fix token builder. --- src/gallium/auxiliary/tgsi/tgsi_build.c | 33 ++------------------------------- src/gallium/auxiliary/tgsi/tgsi_build.h | 10 ---------- 2 files changed, 2 insertions(+), 41 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index c35634c69a..d80222bcf4 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -531,9 +531,7 @@ tgsi_build_full_instruction( header); } - if( tgsi_compare_instruction_label( - full_inst->Label, - tgsi_default_instruction_label() ) ) { + if (full_inst->Instruction.Label) { struct tgsi_instruction_label *instruction_label; if( maxsize <= size ) @@ -550,9 +548,7 @@ tgsi_build_full_instruction( prev_token = (struct tgsi_token *) instruction_label; } - if( tgsi_compare_instruction_texture( - full_inst->Texture, - tgsi_default_instruction_texture() ) ) { + if (full_inst->Instruction.Texture) { struct tgsi_instruction_texture *instruction_texture; if( maxsize <= size ) @@ -745,13 +741,6 @@ tgsi_build_instruction_predicate(int index, return instruction_predicate; } -/** test for inequality of 32-bit values pointed to by a and b */ -static INLINE boolean -compare32(const void *a, const void *b) -{ - return *((uint32_t *) a) != *((uint32_t *) b); -} - struct tgsi_instruction_label tgsi_default_instruction_label( void ) { @@ -763,15 +752,6 @@ tgsi_default_instruction_label( void ) return instruction_label; } -unsigned -tgsi_compare_instruction_label( - struct tgsi_instruction_label a, - struct tgsi_instruction_label b ) -{ - a.Padding = b.Padding = 0; - return compare32(&a, &b); -} - struct tgsi_instruction_label tgsi_build_instruction_label( unsigned label, @@ -801,15 +781,6 @@ tgsi_default_instruction_texture( void ) return instruction_texture; } -unsigned -tgsi_compare_instruction_texture( - struct tgsi_instruction_texture a, - struct tgsi_instruction_texture b ) -{ - a.Padding = b.Padding = 0; - return compare32(&a, &b); -} - struct tgsi_instruction_texture tgsi_build_instruction_texture( unsigned texture, diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.h b/src/gallium/auxiliary/tgsi/tgsi_build.h index 0fbc8b1b0a..f46f9b6307 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.h +++ b/src/gallium/auxiliary/tgsi/tgsi_build.h @@ -174,11 +174,6 @@ tgsi_build_instruction_predicate(int index, struct tgsi_instruction_label tgsi_default_instruction_label( void ); -unsigned -tgsi_compare_instruction_label( - struct tgsi_instruction_label a, - struct tgsi_instruction_label b ); - struct tgsi_instruction_label tgsi_build_instruction_label( unsigned label, @@ -189,11 +184,6 @@ tgsi_build_instruction_label( struct tgsi_instruction_texture tgsi_default_instruction_texture( void ); -unsigned -tgsi_compare_instruction_texture( - struct tgsi_instruction_texture a, - struct tgsi_instruction_texture b ); - struct tgsi_instruction_texture tgsi_build_instruction_texture( unsigned texture, -- cgit v1.2.3 From 0528f40e3b8ca3e59d3a641c4504d34cf9364578 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 25 Nov 2009 16:31:28 -0800 Subject: Improve implementation of GL_POINT_SPRITE_COORD_ORIGIN errors This enum is only supported for OpenGL 2.0. If a driver supports OpenGL 1.4 and GL_ARB_point_sprite, using this enum should generate an error. This is important because, for example, i915 and i830 can support GL_ARB_point_sprite, but they cannot support GL_POINT_SPRITE_COORD_ORIGIN. This commit just removes the check for NV_point_sprite, which is completely wrong, and add some comments describing what the code should do. I don't see an easy way to check for version >= 2.0 from inside Mesa. Perhaps we should add an extension GL_MESA_point_sprite_20 (like Intel's old GL_EXT_packed_pixels_12) to indicate that this added bit of functionality is available. Also note that glean's pointSprite test only checks for GL_ARB_point_sprite before trying to use GL_POINT_SPRITE_COORD_ORIGIN. Naturally, that fails on non-2.0 implementations (i.e., Mac OS X on GMA 950). --- src/mesa/main/points.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c index 4c8fc1f72e..b330544890 100644 --- a/src/mesa/main/points.c +++ b/src/mesa/main/points.c @@ -200,7 +200,12 @@ _mesa_PointParameterfv( GLenum pname, const GLfloat *params) } break; case GL_POINT_SPRITE_COORD_ORIGIN: - if (ctx->Extensions.ARB_point_sprite || ctx->Extensions.NV_point_sprite) { + /* This is not completely correct. GL_POINT_SPRITE_COORD_ORIGIN was + * added to point sprites when the extension was merged into OpenGL + * 2.0. It is expected that an implementation supporting OpenGL 1.4 + * and GL_ARB_point_sprite will generate an error here. + */ + if (ctx->Extensions.ARB_point_sprite) { GLenum value = (GLenum) params[0]; if (value != GL_LOWER_LEFT && value != GL_UPPER_LEFT) { _mesa_error(ctx, GL_INVALID_VALUE, -- cgit v1.2.3 From da1c40260d8cb49eacbb6c394198dc37e020e75a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 26 Nov 2009 11:15:08 +0000 Subject: llvmpipe: Update/correct CPU requirements. There are no hard requirements at the moment. We don't really emit any sse3 yet. Just some ssse3. Thanks to Roland for spotting these incorrections. --- src/gallium/drivers/llvmpipe/README | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/README b/src/gallium/drivers/llvmpipe/README index 478e0139c8..0c3f00fd58 100644 --- a/src/gallium/drivers/llvmpipe/README +++ b/src/gallium/drivers/llvmpipe/README @@ -51,9 +51,13 @@ Requirements - Linux - - A x86 or amd64 processor with support for sse2, sse3, and sse4.1 SIMD - instructions. This is necessary because we emit several SSE intrinsics for - convenience. See /proc/cpuinfo to know what your CPU supports. + - A x86 or amd64 processor. 64bit mode is preferred. + + Support for sse2 is strongly encouraged. Support for ssse3, and sse4.1 will + yield the most efficient code. The less features the CPU has the more + likely is that you ran into underperforming, buggy, or incomplete code. + + See /proc/cpuinfo to know what your CPU supports. - LLVM 2.5 or greater. LLVM 2.6 is preferred. -- cgit v1.2.3 From 953b74d116c88f2b93740b6d1f713bb1b5989e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 26 Nov 2009 11:16:19 +0000 Subject: llvmpipe: Fake missing SSSE3 when simulation less capabable machines. SSE3 != SSSE3 and so far we only use the later. --- src/gallium/drivers/llvmpipe/lp_jit.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c index c601c79480..bce3baec16 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.c +++ b/src/gallium/drivers/llvmpipe/lp_jit.c @@ -154,6 +154,7 @@ lp_jit_screen_init(struct llvmpipe_screen *screen) #if 0 /* For simulating less capable machines */ util_cpu_caps.has_sse3 = 0; + util_cpu_caps.has_ssse3 = 0; util_cpu_caps.has_sse4_1 = 0; #endif -- cgit v1.2.3 From 75df599e30bda03b40c0442eff3e39ec84397ede Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 26 Nov 2009 19:21:55 +0100 Subject: tgsi/ureg: Add forgotten goto in ureg_DECL_constant(). --- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 5526a5d034..bd963267cc 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -352,6 +352,7 @@ struct ureg_src ureg_DECL_constant(struct ureg_program *ureg, i = ureg->nr_constant_ranges++; ureg->constant_range[i].first = index; ureg->constant_range[i].last = index; + goto out; } /* Collapse all ranges down to one: -- cgit v1.2.3 From 3bae72e20493aeb683e16297d67648e59a817b76 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Thu, 26 Nov 2009 19:24:57 +0100 Subject: draw: Fix max_index check. We want to fallback to draw splitting when vertex element indices might be too high for atomic draw path (currently limited to 4095). --- src/gallium/auxiliary/draw/draw_pt_vcache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pt_vcache.c b/src/gallium/auxiliary/draw/draw_pt_vcache.c index d3f179ced1..757c487454 100644 --- a/src/gallium/auxiliary/draw/draw_pt_vcache.c +++ b/src/gallium/auxiliary/draw/draw_pt_vcache.c @@ -346,7 +346,8 @@ vcache_check_run( struct draw_pt_front_end *frontend, vcache->fetch_max, draw_count); - if (max_index == 0xffffffff || + if (max_index >= DRAW_PIPE_MAX_VERTICES || + fetch_count >= UNDEFINED_VERTEX_ID || fetch_count > draw_count) { if (0) debug_printf("fail\n"); goto fail; -- cgit v1.2.3 From a2c101029d5cb3f74ec9a2a9a53cb1d74ab9cc57 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 26 Nov 2009 20:30:04 +0100 Subject: tgsi/exec: Force return from a subroutine at ENDSUB. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 89740cee89..268c5a632a 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -3217,7 +3217,28 @@ exec_instruction( break; case TGSI_OPCODE_ENDSUB: - /* no-op */ + /* + * XXX: This really should be a no-op. We should never reach this opcode. + */ + + assert(mach->CallStackTop > 0); + mach->CallStackTop--; + + mach->CondStackTop = mach->CallStack[mach->CallStackTop].CondStackTop; + mach->CondMask = mach->CondStack[mach->CondStackTop]; + + mach->LoopStackTop = mach->CallStack[mach->CallStackTop].LoopStackTop; + mach->LoopMask = mach->LoopStack[mach->LoopStackTop]; + + mach->ContStackTop = mach->CallStack[mach->CallStackTop].ContStackTop; + mach->ContMask = mach->ContStack[mach->ContStackTop]; + + assert(mach->FuncStackTop > 0); + mach->FuncMask = mach->FuncStack[--mach->FuncStackTop]; + + *pc = mach->CallStack[mach->CallStackTop].ReturnAddr; + + UPDATE_EXEC_MASK(mach); break; case TGSI_OPCODE_NOP: @@ -3347,5 +3368,10 @@ tgsi_exec_machine_run( struct tgsi_exec_machine *mach ) } #endif + assert(mach->CondStackTop == 0); + assert(mach->LoopStackTop == 0); + assert(mach->ContStackTop == 0); + assert(mach->CallStackTop == 0); + return ~mach->Temps[TEMP_KILMASK_I].xyzw[TEMP_KILMASK_C].u[0]; } -- cgit v1.2.3 From 884007546c98b1779bf266ec5111b1e7e2b68b2e Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 26 Nov 2009 20:38:43 +0100 Subject: tgsi/exec: Fix orientation of DDY. --- src/gallium/auxiliary/tgsi/tgsi_exec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 268c5a632a..e22a1643c8 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -501,7 +501,7 @@ micro_ddy( dst->f[0] = dst->f[1] = dst->f[2] = - dst->f[3] = src->f[TILE_TOP_LEFT] - src->f[TILE_BOTTOM_LEFT]; + dst->f[3] = src->f[TILE_BOTTOM_LEFT] - src->f[TILE_TOP_LEFT]; } static void -- cgit v1.2.3 From d509f84543d0979e9bb53c20c195f378dd61e728 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Thu, 26 Nov 2009 22:49:58 +0100 Subject: gallium: fix more statetrackers/drivers for not using texture width/height/depth arrays --- src/gallium/auxiliary/util/u_gen_mipmap.c | 8 +-- src/gallium/drivers/cell/ppu/cell_state_emit.c | 7 +- src/gallium/drivers/cell/ppu/cell_texture.c | 27 ++++--- src/gallium/drivers/llvmpipe/lp_bld_sample.c | 6 +- src/gallium/drivers/llvmpipe/lp_state_sampler.c | 4 +- src/gallium/drivers/llvmpipe/lp_tex_cache.c | 5 +- src/gallium/drivers/llvmpipe/lp_tex_sample_c.c | 30 ++++---- src/gallium/drivers/llvmpipe/lp_texture.c | 31 ++++---- src/gallium/drivers/nv04/nv04_fragtex.c | 4 +- src/gallium/drivers/nv04/nv04_miptree.c | 19 +++-- src/gallium/drivers/nv04/nv04_transfer.c | 7 +- src/gallium/drivers/nv10/nv10_fragtex.c | 8 +-- src/gallium/drivers/nv10/nv10_miptree.c | 18 ++--- src/gallium/drivers/nv10/nv10_transfer.c | 7 +- src/gallium/drivers/nv20/nv20_fragtex.c | 8 +-- src/gallium/drivers/nv20/nv20_miptree.c | 31 ++++---- src/gallium/drivers/nv20/nv20_transfer.c | 7 +- src/gallium/drivers/nv30/nv30_fragtex.c | 10 +-- src/gallium/drivers/nv30/nv30_miptree.c | 36 +++++----- src/gallium/drivers/nv30/nv30_transfer.c | 7 +- src/gallium/drivers/nv40/nv40_fragtex.c | 6 +- src/gallium/drivers/nv40/nv40_miptree.c | 36 +++++----- src/gallium/drivers/nv40/nv40_transfer.c | 7 +- src/gallium/drivers/nv50/nv50_miptree.c | 21 +++--- src/gallium/drivers/nv50/nv50_tex.c | 4 +- src/gallium/drivers/nv50/nv50_transfer.c | 11 +-- src/gallium/drivers/r300/r300_texture.c | 48 ++++++------- src/gallium/state_trackers/dri/dri_drawable.c | 8 +-- src/gallium/state_trackers/egl/egl_surface.c | 6 +- src/gallium/state_trackers/python/p_device.i | 6 +- src/gallium/state_trackers/python/p_texture.i | 12 ++-- .../state_trackers/python/retrace/interpreter.py | 6 +- src/gallium/state_trackers/python/st_device.c | 10 +-- src/gallium/state_trackers/python/st_sample.c | 4 +- src/gallium/state_trackers/vega/api_filters.c | 8 +-- src/gallium/state_trackers/vega/image.c | 16 ++--- src/gallium/state_trackers/vega/mask.c | 12 ++-- src/gallium/state_trackers/vega/paint.c | 10 +-- src/gallium/state_trackers/vega/renderer.c | 46 ++++++------ src/gallium/state_trackers/vega/vg_tracker.c | 6 +- src/gallium/state_trackers/xorg/xorg_composite.c | 4 +- src/gallium/state_trackers/xorg/xorg_crtc.c | 6 +- src/gallium/state_trackers/xorg/xorg_dri2.c | 6 +- src/gallium/state_trackers/xorg/xorg_exa.c | 30 ++++---- src/gallium/state_trackers/xorg/xorg_renderer.c | 82 +++++++++++----------- src/gallium/state_trackers/xorg/xorg_xv.c | 22 +++--- src/gallium/state_trackers/xorg/xvmc/surface.c | 6 +- .../winsys/drm/nouveau/drm/nouveau_drm_api.c | 6 +- src/gallium/winsys/drm/radeon/core/radeon_buffer.c | 6 +- src/mesa/state_tracker/st_cb_fbo.c | 2 +- 50 files changed, 360 insertions(+), 373 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index 84db14576e..f67f1e458d 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -1214,12 +1214,12 @@ make_3d_mipmap(struct gen_mipmap_state *ctx, srcTrans = screen->get_tex_transfer(screen, pt, face, srcLevel, zslice, PIPE_TRANSFER_READ, 0, 0, - pt->width[srcLevel], - pt->height[srcLevel]); + u_minify(pt->width0, srcLevel), + u_minify(pt->height0, srcLevel)); dstTrans = screen->get_tex_transfer(screen, pt, face, dstLevel, zslice, PIPE_TRANSFER_WRITE, 0, 0, - pt->width[dstLevel], - pt->height[dstLevel]); + u_minify(pt->width0, dstLevel), + u_minify(pt->height0, dstLevel)); srcMap = (ubyte *) screen->transfer_map(screen, srcTrans); dstMap = (ubyte *) screen->transfer_map(screen, dstTrans); diff --git a/src/gallium/drivers/cell/ppu/cell_state_emit.c b/src/gallium/drivers/cell/ppu/cell_state_emit.c index 9479c0898f..ac5fafec1a 100644 --- a/src/gallium/drivers/cell/ppu/cell_state_emit.c +++ b/src/gallium/drivers/cell/ppu/cell_state_emit.c @@ -27,6 +27,7 @@ #include "pipe/p_inlines.h" #include "util/u_memory.h" +#include "util/u_math.h" #include "cell_context.h" #include "cell_gen_fragment.h" #include "cell_state.h" @@ -299,9 +300,9 @@ cell_emit_state(struct cell_context *cell) for (level = 0; level < CELL_MAX_TEXTURE_LEVELS; level++) { texture->start[level] = (ct->mapped + ct->level_offset[level]); - texture->width[level] = ct->base.width[level]; - texture->height[level] = ct->base.height[level]; - texture->depth[level] = ct->base.depth[level]; + texture->width[level] = u_minify(ct->base.width0, level); + texture->height[level] = u_minify(ct->base.height0, level); + texture->depth[level] = u_minify(ct->base.depth0, level); } texture->target = ct->base.target; } diff --git a/src/gallium/drivers/cell/ppu/cell_texture.c b/src/gallium/drivers/cell/ppu/cell_texture.c index ae4c61efb3..e6b8a87045 100644 --- a/src/gallium/drivers/cell/ppu/cell_texture.c +++ b/src/gallium/drivers/cell/ppu/cell_texture.c @@ -49,9 +49,9 @@ cell_texture_layout(struct cell_texture *ct) { struct pipe_texture *pt = &ct->base; unsigned level; - unsigned width = pt->width[0]; - unsigned height = pt->height[0]; - unsigned depth = pt->depth[0]; + unsigned width = pt->width0; + unsigned height = pt->height0; + unsigned depth = pt->depth0; ct->buffer_size = 0; @@ -65,9 +65,6 @@ cell_texture_layout(struct cell_texture *ct) w_tile = align(width, TILE_SIZE); h_tile = align(height, TILE_SIZE); - pt->width[level] = width; - pt->height[level] = height; - pt->depth[level] = depth; pt->nblocksx[level] = pf_get_nblocksx(&pt->block, w_tile); pt->nblocksy[level] = pf_get_nblocksy(&pt->block, h_tile); @@ -83,9 +80,9 @@ cell_texture_layout(struct cell_texture *ct) ct->buffer_size += size; - width = minify(width); - height = minify(height); - depth = minify(depth); + width = u_minify(width, 1); + height = u_minify(height, 1); + depth = u_minify(depth, 1); } } @@ -276,8 +273,8 @@ cell_get_tex_surface(struct pipe_screen *screen, pipe_reference_init(&ps->reference, 1); pipe_texture_reference(&ps->texture, pt); ps->format = pt->format; - ps->width = pt->width[level]; - ps->height = pt->height[level]; + ps->width = u_minify(pt->width0, level); + ps->height = u_minify(pt->height0, level); ps->offset = ct->level_offset[level]; /* XXX may need to override usage flags (see sp_texture.c) */ ps->usage = usage; @@ -386,8 +383,8 @@ cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer) struct pipe_texture *pt = transfer->texture; struct cell_texture *ct = cell_texture(pt); const uint level = ctrans->base.level; - const uint texWidth = pt->width[level]; - const uint texHeight = pt->height[level]; + const uint texWidth = u_minify(pt->width0, level); + const uint texHeight = u_minify(pt->height0, level); const uint stride = ct->stride[level]; unsigned size; @@ -440,8 +437,8 @@ cell_transfer_unmap(struct pipe_screen *screen, struct pipe_texture *pt = transfer->texture; struct cell_texture *ct = cell_texture(pt); const uint level = ctrans->base.level; - const uint texWidth = pt->width[level]; - const uint texHeight = pt->height[level]; + const uint texWidth = u_minify(pt->width0, level); + const uint texHeight = u_minify(pt->height0, level); const uint stride = ct->stride[level]; if (!ct->mapped) { diff --git a/src/gallium/drivers/llvmpipe/lp_bld_sample.c b/src/gallium/drivers/llvmpipe/lp_bld_sample.c index 4d272bea87..af70ddc6ab 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_sample.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_sample.c @@ -59,9 +59,9 @@ lp_sampler_static_state(struct lp_sampler_static_state *state, state->format = texture->format; state->target = texture->target; - state->pot_width = util_is_pot(texture->width[0]); - state->pot_height = util_is_pot(texture->height[0]); - state->pot_depth = util_is_pot(texture->depth[0]); + state->pot_width = util_is_pot(texture->width0); + state->pot_height = util_is_pot(texture->height0); + state->pot_depth = util_is_pot(texture->depth0); state->wrap_s = sampler->wrap_s; state->wrap_t = sampler->wrap_t; diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c index c69d90c723..8333805a3f 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c +++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c @@ -102,8 +102,8 @@ llvmpipe_set_sampler_textures(struct pipe_context *pipe, if(tex) { struct llvmpipe_texture *lp_tex = llvmpipe_texture(tex); struct lp_jit_texture *jit_tex = &llvmpipe->jit_context.textures[i]; - jit_tex->width = tex->width[0]; - jit_tex->height = tex->height[0]; + jit_tex->width = tex->width0; + jit_tex->height = tex->height0; jit_tex->stride = lp_tex->stride[0]; if(!lp_tex->dt) jit_tex->data = lp_tex->data; diff --git a/src/gallium/drivers/llvmpipe/lp_tex_cache.c b/src/gallium/drivers/llvmpipe/lp_tex_cache.c index 773e848242..c7c4143bc6 100644 --- a/src/gallium/drivers/llvmpipe/lp_tex_cache.c +++ b/src/gallium/drivers/llvmpipe/lp_tex_cache.c @@ -36,6 +36,7 @@ #include "util/u_memory.h" #include "util/u_tile.h" #include "util/u_format.h" +#include "util/u_math.h" #include "lp_context.h" #include "lp_surface.h" #include "lp_texture.h" @@ -270,8 +271,8 @@ lp_find_cached_tex_tile(struct llvmpipe_tex_tile_cache *tc, addr.bits.level, addr.bits.z, PIPE_TRANSFER_READ, 0, 0, - tc->texture->width[addr.bits.level], - tc->texture->height[addr.bits.level]); + u_minify(tc->texture->width0, addr.bits.level), + u_minify(tc->texture->height0, addr.bits.level)); tc->tex_trans_map = screen->transfer_map(screen, tc->tex_trans); diff --git a/src/gallium/drivers/llvmpipe/lp_tex_sample_c.c b/src/gallium/drivers/llvmpipe/lp_tex_sample_c.c index a1365a045f..0d01c07fb5 100644 --- a/src/gallium/drivers/llvmpipe/lp_tex_sample_c.c +++ b/src/gallium/drivers/llvmpipe/lp_tex_sample_c.c @@ -544,7 +544,7 @@ compute_lambda(struct tgsi_sampler *tgsi_sampler, float dsdy = s[QUAD_TOP_LEFT] - s[QUAD_BOTTOM_LEFT]; dsdx = fabsf(dsdx); dsdy = fabsf(dsdy); - rho = MAX2(dsdx, dsdy) * texture->width[0]; + rho = MAX2(dsdx, dsdy) * texture->width0; } if (t) { float dtdx = t[QUAD_BOTTOM_RIGHT] - t[QUAD_BOTTOM_LEFT]; @@ -552,7 +552,7 @@ compute_lambda(struct tgsi_sampler *tgsi_sampler, float max; dtdx = fabsf(dtdx); dtdy = fabsf(dtdy); - max = MAX2(dtdx, dtdy) * texture->height[0]; + max = MAX2(dtdx, dtdy) * texture->height0; rho = MAX2(rho, max); } if (p) { @@ -561,7 +561,7 @@ compute_lambda(struct tgsi_sampler *tgsi_sampler, float max; dpdx = fabsf(dpdx); dpdy = fabsf(dpdy); - max = MAX2(dpdx, dpdy) * texture->depth[0]; + max = MAX2(dpdx, dpdy) * texture->depth0; rho = MAX2(rho, max); } @@ -726,9 +726,9 @@ get_texel(const struct tgsi_sampler *tgsi_sampler, const struct pipe_texture *texture = samp->texture; const struct pipe_sampler_state *sampler = samp->sampler; - if (x < 0 || x >= (int) texture->width[level] || - y < 0 || y >= (int) texture->height[level] || - z < 0 || z >= (int) texture->depth[level]) { + if (x < 0 || x >= (int) u_minify(texture->width0, level) || + y < 0 || y >= (int) u_minify(texture->height0, level) || + z < 0 || z >= (int) u_minify(texture->depth0, level)) { rgba[0][j] = sampler->border_color[0]; rgba[1][j] = sampler->border_color[1]; rgba[2][j] = sampler->border_color[2]; @@ -1093,8 +1093,8 @@ lp_get_samples_2d_common(struct tgsi_sampler *tgsi_sampler, assert(sampler->normalized_coords); - width = texture->width[level0]; - height = texture->height[level0]; + width = u_minify(texture->width0, level0); + height = u_minify(texture->height0, level0); assert(width > 0); @@ -1250,9 +1250,9 @@ lp_get_samples_3d(struct tgsi_sampler *tgsi_sampler, assert(sampler->normalized_coords); - width = texture->width[level0]; - height = texture->height[level0]; - depth = texture->depth[level0]; + width = u_minify(texture->width0, level0); + height = u_minify(texture->height0, level0); + depth = u_minify(texture->depth0, level0); assert(width > 0); assert(height > 0); @@ -1394,8 +1394,8 @@ lp_get_samples_rect(struct tgsi_sampler *tgsi_sampler, /* texture RECTS cannot be mipmapped */ assert(level0 == level1); - width = texture->width[level0]; - height = texture->height[level0]; + width = u_minify(texture->width0, level0); + height = u_minify(texture->height0, level0); assert(width > 0); @@ -1513,8 +1513,8 @@ lp_get_samples(struct tgsi_sampler *tgsi_sampler, /* Do this elsewhere: */ - samp->xpot = util_unsigned_logbase2( samp->texture->width[0] ); - samp->ypot = util_unsigned_logbase2( samp->texture->height[0] ); + samp->xpot = util_unsigned_logbase2( samp->texture->width0 ); + samp->ypot = util_unsigned_logbase2( samp->texture->height0 ); /* Try to hook in a faster sampler. Ultimately we'll have to * code-generate these. Luckily most of this looks like it is diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index a00f2495df..0a0f31f8a3 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -57,9 +57,9 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen, { struct pipe_texture *pt = &lpt->base; unsigned level; - unsigned width = pt->width[0]; - unsigned height = pt->height[0]; - unsigned depth = pt->depth[0]; + unsigned width = pt->width0; + unsigned height = pt->height0; + unsigned depth = pt->depth0; unsigned buffer_size = 0; @@ -68,9 +68,6 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen, for (level = 0; level <= pt->last_level; level++) { unsigned nblocksx, nblocksy; - pt->width[level] = width; - pt->height[level] = height; - pt->depth[level] = depth; pt->nblocksx[level] = pf_get_nblocksx(&pt->block, width); pt->nblocksy[level] = pf_get_nblocksy(&pt->block, height); @@ -87,9 +84,9 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen, ((pt->target == PIPE_TEXTURE_CUBE) ? 6 : depth) * lpt->stride[level]); - width = minify(width); - height = minify(height); - depth = minify(depth); + width = u_minify(width, 1); + height = u_minify(height, 1); + depth = u_minify(depth, 1); } lpt->data = align_malloc(buffer_size, 16); @@ -104,13 +101,13 @@ llvmpipe_displaytarget_layout(struct llvmpipe_screen *screen, struct llvmpipe_winsys *winsys = screen->winsys; pf_get_block(lpt->base.format, &lpt->base.block); - lpt->base.nblocksx[0] = pf_get_nblocksx(&lpt->base.block, lpt->base.width[0]); - lpt->base.nblocksy[0] = pf_get_nblocksy(&lpt->base.block, lpt->base.height[0]); + lpt->base.nblocksx[0] = pf_get_nblocksx(&lpt->base.block, lpt->base.width0); + lpt->base.nblocksy[0] = pf_get_nblocksy(&lpt->base.block, lpt->base.height0); lpt->dt = winsys->displaytarget_create(winsys, lpt->base.format, - lpt->base.width[0], - lpt->base.height[0], + lpt->base.width0, + lpt->base.height0, 16, &lpt->stride[0] ); @@ -183,8 +180,8 @@ llvmpipe_texture_blanket(struct pipe_screen * screen, lpt->base = *base; pipe_reference_init(&lpt->base.reference, 1); lpt->base.screen = screen; - lpt->base.nblocksx[0] = pf_get_nblocksx(&lpt->base.block, lpt->base.width[0]); - lpt->base.nblocksy[0] = pf_get_nblocksy(&lpt->base.block, lpt->base.height[0]); + lpt->base.nblocksx[0] = pf_get_nblocksx(&lpt->base.block, lpt->base.width0); + lpt->base.nblocksy[0] = pf_get_nblocksy(&lpt->base.block, lpt->base.height0); lpt->stride[0] = stride[0]; pipe_buffer_reference(&lpt->buffer, buffer); @@ -229,8 +226,8 @@ llvmpipe_get_tex_surface(struct pipe_screen *screen, pipe_reference_init(&ps->reference, 1); pipe_texture_reference(&ps->texture, pt); ps->format = pt->format; - ps->width = pt->width[level]; - ps->height = pt->height[level]; + ps->width = u_minify(pt->width0, level); + ps->height = u_minify(pt->height0, level); ps->offset = lpt->level_offset[level]; ps->usage = usage; diff --git a/src/gallium/drivers/nv04/nv04_fragtex.c b/src/gallium/drivers/nv04/nv04_fragtex.c index 21f990fd53..0cce71ad1d 100644 --- a/src/gallium/drivers/nv04/nv04_fragtex.c +++ b/src/gallium/drivers/nv04/nv04_fragtex.c @@ -57,8 +57,8 @@ nv04_fragtex_build(struct nv04_context *nv04, int unit) | NV04_DX5_TEXTURED_TRIANGLE_FORMAT_ORIGIN_FOH_CORNER | nv04_fragtex_format(pt->format) | ( (pt->last_level + 1) << NV04_DX5_TEXTURED_TRIANGLE_FORMAT_MIPMAP_LEVELS_SHIFT ) - | ( log2i(pt->width[0]) << NV04_DX5_TEXTURED_TRIANGLE_FORMAT_BASE_SIZE_U_SHIFT ) - | ( log2i(pt->height[0]) << NV04_DX5_TEXTURED_TRIANGLE_FORMAT_BASE_SIZE_V_SHIFT ) + | ( log2i(pt->width0) << NV04_DX5_TEXTURED_TRIANGLE_FORMAT_BASE_SIZE_U_SHIFT ) + | ( log2i(pt->height0) << NV04_DX5_TEXTURED_TRIANGLE_FORMAT_BASE_SIZE_V_SHIFT ) | NV04_DX5_TEXTURED_TRIANGLE_FORMAT_ADDRESSU_CLAMP_TO_EDGE | NV04_DX5_TEXTURED_TRIANGLE_FORMAT_ADDRESSV_CLAMP_TO_EDGE ; diff --git a/src/gallium/drivers/nv04/nv04_miptree.c b/src/gallium/drivers/nv04/nv04_miptree.c index 93f752faec..4fd72c82e6 100644 --- a/src/gallium/drivers/nv04/nv04_miptree.c +++ b/src/gallium/drivers/nv04/nv04_miptree.c @@ -1,6 +1,7 @@ #include "pipe/p_state.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" +#include "util/u_math.h" #include "nv04_context.h" #include "nv04_screen.h" @@ -9,31 +10,29 @@ static void nv04_miptree_layout(struct nv04_miptree *nv04mt) { struct pipe_texture *pt = &nv04mt->base; - uint width = pt->width[0], height = pt->height[0]; + uint width = pt->width0, height = pt->height0; uint offset = 0; int nr_faces, l; nr_faces = 1; for (l = 0; l <= pt->last_level; l++) { - pt->width[l] = width; - pt->height[l] = height; pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width); pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height); - nv04mt->level[l].pitch = pt->width[0]; + nv04mt->level[l].pitch = pt->width0; nv04mt->level[l].pitch = (nv04mt->level[l].pitch + 63) & ~63; - width = MAX2(1, width >> 1); - height = MAX2(1, height >> 1); + width = u_minify(width, 1); + height = u_minify(height, 1); } for (l = 0; l <= pt->last_level; l++) { nv04mt->level[l].image_offset = CALLOC(nr_faces, sizeof(unsigned)); - offset += nv04mt->level[l].pitch * pt->height[l]; + offset += nv04mt->level[l].pitch * u_minify(pt->height0, l); } nv04mt->total_size = offset; @@ -75,7 +74,7 @@ nv04_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt, /* Only supports 2D, non-mipmapped textures for the moment */ if (pt->target != PIPE_TEXTURE_2D || pt->last_level != 0 || - pt->depth[0] != 1) + pt->depth0 != 1) return NULL; mt = CALLOC_STRUCT(nv04_miptree); @@ -120,8 +119,8 @@ nv04_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt, return NULL; pipe_texture_reference(&ns->base.texture, pt); ns->base.format = pt->format; - ns->base.width = pt->width[level]; - ns->base.height = pt->height[level]; + ns->base.width = u_minify(pt->width0, level); + ns->base.height = u_minify(pt->height0, level); ns->base.usage = flags; pipe_reference_init(&ns->base.reference, 1); ns->base.face = face; diff --git a/src/gallium/drivers/nv04/nv04_transfer.c b/src/gallium/drivers/nv04/nv04_transfer.c index 6618660743..e6456429f4 100644 --- a/src/gallium/drivers/nv04/nv04_transfer.c +++ b/src/gallium/drivers/nv04/nv04_transfer.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include "nv04_context.h" #include "nv04_screen.h" @@ -20,9 +21,9 @@ nv04_compatible_transfer_tex(struct pipe_texture *pt, unsigned level, memset(template, 0, sizeof(struct pipe_texture)); template->target = pt->target; template->format = pt->format; - template->width[0] = pt->width[level]; - template->height[0] = pt->height[level]; - template->depth[0] = 1; + template->width0 = u_minify(pt->width0, level); + template->height0 = u_minify(pt->height0, level); + template->depth0 = 1; template->block = pt->block; template->nblocksx[0] = pt->nblocksx[level]; template->nblocksy[0] = pt->nblocksx[level]; diff --git a/src/gallium/drivers/nv10/nv10_fragtex.c b/src/gallium/drivers/nv10/nv10_fragtex.c index 27f2f87584..906fdfeeb9 100644 --- a/src/gallium/drivers/nv10/nv10_fragtex.c +++ b/src/gallium/drivers/nv10/nv10_fragtex.c @@ -62,9 +62,9 @@ nv10_fragtex_build(struct nv10_context *nv10, int unit) txf = tf->format << 8; txf |= (pt->last_level + 1) << 16; - txf |= log2i(pt->width[0]) << 20; - txf |= log2i(pt->height[0]) << 24; - txf |= log2i(pt->depth[0]) << 28; + txf |= log2i(pt->width0) << 20; + txf |= log2i(pt->height0) << 24; + txf |= log2i(pt->depth0) << 28; txf |= 8; switch (pt->target) { @@ -89,7 +89,7 @@ nv10_fragtex_build(struct nv10_context *nv10, int unit) OUT_RING (0x40000000); /* enable */ OUT_RING (txs); OUT_RING (ps->filt | 0x2000 /* magic */); - OUT_RING ((pt->width[0] << 16) | pt->height[0]); + OUT_RING ((pt->width0 << 16) | pt->height0); OUT_RING (ps->bcol); #endif } diff --git a/src/gallium/drivers/nv10/nv10_miptree.c b/src/gallium/drivers/nv10/nv10_miptree.c index 34e3c2ebd7..b2a6c59b74 100644 --- a/src/gallium/drivers/nv10/nv10_miptree.c +++ b/src/gallium/drivers/nv10/nv10_miptree.c @@ -1,6 +1,7 @@ #include "pipe/p_state.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" +#include "util/u_math.h" #include "nv10_context.h" #include "nv10_screen.h" @@ -10,7 +11,7 @@ nv10_miptree_layout(struct nv10_miptree *nv10mt) { struct pipe_texture *pt = &nv10mt->base; boolean swizzled = FALSE; - uint width = pt->width[0], height = pt->height[0]; + uint width = pt->width0, height = pt->height0; uint offset = 0; int nr_faces, l, f; @@ -21,8 +22,7 @@ nv10_miptree_layout(struct nv10_miptree *nv10mt) } for (l = 0; l <= pt->last_level; l++) { - pt->width[l] = width; - pt->height[l] = height; + pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width); pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height); @@ -35,15 +35,15 @@ nv10_miptree_layout(struct nv10_miptree *nv10mt) nv10mt->level[l].image_offset = CALLOC(nr_faces, sizeof(unsigned)); - width = MAX2(1, width >> 1); - height = MAX2(1, height >> 1); + width = u_minify(width, 1); + height = u_minify(height, 1); } for (f = 0; f < nr_faces; f++) { for (l = 0; l <= pt->last_level; l++) { nv10mt->level[l].image_offset[f] = offset; - offset += nv10mt->level[l].pitch * pt->height[l]; + offset += nv10mt->level[l].pitch * u_minify(pt->height0, l); } } @@ -58,7 +58,7 @@ nv10_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt, /* Only supports 2D, non-mipmapped textures for the moment */ if (pt->target != PIPE_TEXTURE_2D || pt->last_level != 0 || - pt->depth[0] != 1) + pt->depth0 != 1) return NULL; mt = CALLOC_STRUCT(nv10_miptree); @@ -133,8 +133,8 @@ nv10_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt, return NULL; pipe_texture_reference(&ns->base.texture, pt); ns->base.format = pt->format; - ns->base.width = pt->width[level]; - ns->base.height = pt->height[level]; + ns->base.width = u_minify(pt->width0, level); + ns->base.height = u_minify(pt->height0, level); ns->base.usage = flags; pipe_reference_init(&ns->base.reference, 1); ns->base.face = face; diff --git a/src/gallium/drivers/nv10/nv10_transfer.c b/src/gallium/drivers/nv10/nv10_transfer.c index 8feb85e4bd..ec54297ab0 100644 --- a/src/gallium/drivers/nv10/nv10_transfer.c +++ b/src/gallium/drivers/nv10/nv10_transfer.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include "nv10_context.h" #include "nv10_screen.h" @@ -20,9 +21,9 @@ nv10_compatible_transfer_tex(struct pipe_texture *pt, unsigned level, memset(template, 0, sizeof(struct pipe_texture)); template->target = pt->target; template->format = pt->format; - template->width[0] = pt->width[level]; - template->height[0] = pt->height[level]; - template->depth[0] = 1; + template->width0 = u_minify(pt->width0, level); + template->height0 = u_minify(pt->height0, level); + template->depth0 = 1; template->block = pt->block; template->nblocksx[0] = pt->nblocksx[level]; template->nblocksy[0] = pt->nblocksx[level]; diff --git a/src/gallium/drivers/nv20/nv20_fragtex.c b/src/gallium/drivers/nv20/nv20_fragtex.c index 495a7be912..2db4a4015a 100644 --- a/src/gallium/drivers/nv20/nv20_fragtex.c +++ b/src/gallium/drivers/nv20/nv20_fragtex.c @@ -62,9 +62,9 @@ nv20_fragtex_build(struct nv20_context *nv20, int unit) txf = tf->format << 8; txf |= (pt->last_level + 1) << 16; - txf |= log2i(pt->width[0]) << 20; - txf |= log2i(pt->height[0]) << 24; - txf |= log2i(pt->depth[0]) << 28; + txf |= log2i(pt->width0) << 20; + txf |= log2i(pt->height0) << 24; + txf |= log2i(pt->depth0) << 28; txf |= 8; switch (pt->target) { @@ -89,7 +89,7 @@ nv20_fragtex_build(struct nv20_context *nv20, int unit) OUT_RING (0x40000000); /* enable */ OUT_RING (txs); OUT_RING (ps->filt | 0x2000 /* magic */); - OUT_RING ((pt->width[0] << 16) | pt->height[0]); + OUT_RING ((pt->width0 << 16) | pt->height0); OUT_RING (ps->bcol); #endif } diff --git a/src/gallium/drivers/nv20/nv20_miptree.c b/src/gallium/drivers/nv20/nv20_miptree.c index 185fbf53e0..554e28e47d 100644 --- a/src/gallium/drivers/nv20/nv20_miptree.c +++ b/src/gallium/drivers/nv20/nv20_miptree.c @@ -1,6 +1,7 @@ #include "pipe/p_state.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" +#include "util/u_math.h" #include "nv20_context.h" #include "nv20_screen.h" @@ -9,7 +10,7 @@ static void nv20_miptree_layout(struct nv20_miptree *nv20mt) { struct pipe_texture *pt = &nv20mt->base; - uint width = pt->width[0], height = pt->height[0]; + uint width = pt->width0, height = pt->height0; uint offset = 0; int nr_faces, l, f; uint wide_pitch = pt->tex_usage & (PIPE_TEXTURE_USAGE_SAMPLER | @@ -25,21 +26,19 @@ nv20_miptree_layout(struct nv20_miptree *nv20mt) } for (l = 0; l <= pt->last_level; l++) { - pt->width[l] = width; - pt->height[l] = height; pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width); pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height); if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) - nv20mt->level[l].pitch = align(pt->width[0] * pt->block.size, 64); + nv20mt->level[l].pitch = align(pt->width0 * pt->block.size, 64); else - nv20mt->level[l].pitch = pt->width[l] * pt->block.size; + nv20mt->level[l].pitch = u_minify(pt->width0, l) * pt->block.size; nv20mt->level[l].image_offset = CALLOC(nr_faces, sizeof(unsigned)); - width = MAX2(1, width >> 1); - height = MAX2(1, height >> 1); + width = u_minify(width, 1); + height = u_minify(height, 1); } for (f = 0; f < nr_faces; f++) { @@ -47,14 +46,14 @@ nv20_miptree_layout(struct nv20_miptree *nv20mt) nv20mt->level[l].image_offset[f] = offset; if (!(pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR) && - pt->width[l + 1] > 1 && pt->height[l + 1] > 1) - offset += align(nv20mt->level[l].pitch * pt->height[l], 64); + u_minify(pt->width0, l + 1) > 1 && u_minify(pt->height0, l + 1) > 1) + offset += align(nv20mt->level[l].pitch * u_minify(pt->height0, l), 64); else - offset += nv20mt->level[l].pitch * pt->height[l]; + offset += nv20mt->level[l].pitch * u_minify(pt->height0, l); } nv20mt->level[l].image_offset[f] = offset; - offset += nv20mt->level[l].pitch * pt->height[l]; + offset += nv20mt->level[l].pitch * u_minify(pt->height0, l); } nv20mt->total_size = offset; @@ -68,7 +67,7 @@ nv20_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt, /* Only supports 2D, non-mipmapped textures for the moment */ if (pt->target != PIPE_TEXTURE_2D || pt->last_level != 0 || - pt->depth[0] != 1) + pt->depth0 != 1) return NULL; mt = CALLOC_STRUCT(nv20_miptree); @@ -100,8 +99,8 @@ nv20_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt) mt->base.screen = screen; /* Swizzled textures must be POT */ - if (pt->width[0] & (pt->width[0] - 1) || - pt->height[0] & (pt->height[0] - 1)) + if (pt->width0 & (pt->width0 - 1) || + pt->height0 & (pt->height0 - 1)) mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR; else if (pt->tex_usage & (PIPE_TEXTURE_USAGE_PRIMARY | @@ -167,8 +166,8 @@ nv20_miptree_surface_get(struct pipe_screen *screen, struct pipe_texture *pt, return NULL; pipe_texture_reference(&ns->base.texture, pt); ns->base.format = pt->format; - ns->base.width = pt->width[level]; - ns->base.height = pt->height[level]; + ns->base.width = u_minify(pt->width0, level); + ns->base.height = u_minify(pt->height0, level); ns->base.usage = flags; pipe_reference_init(&ns->base.reference, 1); ns->base.face = face; diff --git a/src/gallium/drivers/nv20/nv20_transfer.c b/src/gallium/drivers/nv20/nv20_transfer.c index 81b4f1a917..87b5c14a3c 100644 --- a/src/gallium/drivers/nv20/nv20_transfer.c +++ b/src/gallium/drivers/nv20/nv20_transfer.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include "nv20_context.h" #include "nv20_screen.h" @@ -20,9 +21,9 @@ nv20_compatible_transfer_tex(struct pipe_texture *pt, unsigned level, memset(template, 0, sizeof(struct pipe_texture)); template->target = pt->target; template->format = pt->format; - template->width[0] = pt->width[level]; - template->height[0] = pt->height[level]; - template->depth[0] = 1; + template->width0 = u_minify(pt->width0, level); + template->height0 = u_minify(pt->height0, level); + template->depth0 = 1; template->block = pt->block; template->nblocksx[0] = pt->nblocksx[level]; template->nblocksy[0] = pt->nblocksx[level]; diff --git a/src/gallium/drivers/nv30/nv30_fragtex.c b/src/gallium/drivers/nv30/nv30_fragtex.c index dca760cae6..b3293ee700 100644 --- a/src/gallium/drivers/nv30/nv30_fragtex.c +++ b/src/gallium/drivers/nv30/nv30_fragtex.c @@ -74,9 +74,9 @@ nv30_fragtex_build(struct nv30_context *nv30, int unit) txf = tf->format; txf |= ((pt->last_level>0) ? NV34TCL_TX_FORMAT_MIPMAP : 0); - txf |= log2i(pt->width[0]) << NV34TCL_TX_FORMAT_BASE_SIZE_U_SHIFT; - txf |= log2i(pt->height[0]) << NV34TCL_TX_FORMAT_BASE_SIZE_V_SHIFT; - txf |= log2i(pt->depth[0]) << NV34TCL_TX_FORMAT_BASE_SIZE_W_SHIFT; + txf |= log2i(pt->width0) << NV34TCL_TX_FORMAT_BASE_SIZE_U_SHIFT; + txf |= log2i(pt->height0) << NV34TCL_TX_FORMAT_BASE_SIZE_V_SHIFT; + txf |= log2i(pt->depth0) << NV34TCL_TX_FORMAT_BASE_SIZE_W_SHIFT; txf |= NV34TCL_TX_FORMAT_NO_BORDER | 0x10000; switch (pt->target) { @@ -115,8 +115,8 @@ nv30_fragtex_build(struct nv30_context *nv30, int unit) so_data (so, NV34TCL_TX_ENABLE_ENABLE | ps->en); so_data (so, txs); so_data (so, ps->filt | 0x2000 /*voodoo*/); - so_data (so, (pt->width[0] << NV34TCL_TX_NPOT_SIZE_W_SHIFT) | - pt->height[0]); + so_data (so, (pt->width0 << NV34TCL_TX_NPOT_SIZE_W_SHIFT) | + pt->height0); so_data (so, ps->bcol); return so; diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c index 280696d450..b4c306d127 100644 --- a/src/gallium/drivers/nv30/nv30_miptree.c +++ b/src/gallium/drivers/nv30/nv30_miptree.c @@ -1,6 +1,7 @@ #include "pipe/p_state.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" +#include "util/u_math.h" #include "nv30_context.h" @@ -8,7 +9,7 @@ static void nv30_miptree_layout(struct nv30_miptree *nv30mt) { struct pipe_texture *pt = &nv30mt->base; - uint width = pt->width[0], height = pt->height[0], depth = pt->depth[0]; + uint width = pt->width0, height = pt->height0, depth = pt->depth0; uint offset = 0; int nr_faces, l, f; uint wide_pitch = pt->tex_usage & (PIPE_TEXTURE_USAGE_SAMPLER | @@ -21,29 +22,26 @@ nv30_miptree_layout(struct nv30_miptree *nv30mt) nr_faces = 6; } else if (pt->target == PIPE_TEXTURE_3D) { - nr_faces = pt->depth[0]; + nr_faces = pt->depth0; } else { nr_faces = 1; } for (l = 0; l <= pt->last_level; l++) { - pt->width[l] = width; - pt->height[l] = height; - pt->depth[l] = depth; pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width); pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height); if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) - nv30mt->level[l].pitch = align(pt->width[0] * pt->block.size, 64); + nv30mt->level[l].pitch = align(pt->width0 * pt->block.size, 64); else - nv30mt->level[l].pitch = pt->width[l] * pt->block.size; + nv30mt->level[l].pitch = u_minify(pt->width0, l) * pt->block.size; nv30mt->level[l].image_offset = CALLOC(nr_faces, sizeof(unsigned)); - width = MAX2(1, width >> 1); - height = MAX2(1, height >> 1); - depth = MAX2(1, depth >> 1); + width = u_minify(width, 1); + height = u_minify(height, 1); + depth = u_minify(depth, 1); } for (f = 0; f < nr_faces; f++) { @@ -51,14 +49,14 @@ nv30_miptree_layout(struct nv30_miptree *nv30mt) nv30mt->level[l].image_offset[f] = offset; if (!(pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR) && - pt->width[l + 1] > 1 && pt->height[l + 1] > 1) - offset += align(nv30mt->level[l].pitch * pt->height[l], 64); + u_minify(pt->width0, l + 1) > 1 && u_minify(pt->height0, l + 1) > 1) + offset += align(nv30mt->level[l].pitch * u_minify(pt->height0, l), 64); else - offset += nv30mt->level[l].pitch * pt->height[l]; + offset += nv30mt->level[l].pitch * u_minify(pt->height0, l); } nv30mt->level[l].image_offset[f] = offset; - offset += nv30mt->level[l].pitch * pt->height[l]; + offset += nv30mt->level[l].pitch * u_minify(pt->height0, l); } nv30mt->total_size = offset; @@ -79,8 +77,8 @@ nv30_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt) mt->base.screen = pscreen; /* Swizzled textures must be POT */ - if (pt->width[0] & (pt->width[0] - 1) || - pt->height[0] & (pt->height[0] - 1)) + if (pt->width0 & (pt->width0 - 1) || + pt->height0 & (pt->height0 - 1)) mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR; else if (pt->tex_usage & (PIPE_TEXTURE_USAGE_PRIMARY | @@ -134,7 +132,7 @@ nv30_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt, /* Only supports 2D, non-mipmapped textures for the moment */ if (pt->target != PIPE_TEXTURE_2D || pt->last_level != 0 || - pt->depth[0] != 1) + pt->depth0 != 1) return NULL; mt = CALLOC_STRUCT(nv30_miptree); @@ -182,8 +180,8 @@ nv30_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt, return NULL; pipe_texture_reference(&ns->base.texture, pt); ns->base.format = pt->format; - ns->base.width = pt->width[level]; - ns->base.height = pt->height[level]; + ns->base.width = u_minify(pt->width0, level); + ns->base.height = u_minify(pt->height0, level); ns->base.usage = flags; pipe_reference_init(&ns->base.reference, 1); ns->base.face = face; diff --git a/src/gallium/drivers/nv30/nv30_transfer.c b/src/gallium/drivers/nv30/nv30_transfer.c index 98011decf7..5e429b4d85 100644 --- a/src/gallium/drivers/nv30/nv30_transfer.c +++ b/src/gallium/drivers/nv30/nv30_transfer.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include "nv30_context.h" #include "nv30_screen.h" @@ -20,9 +21,9 @@ nv30_compatible_transfer_tex(struct pipe_texture *pt, unsigned level, memset(template, 0, sizeof(struct pipe_texture)); template->target = pt->target; template->format = pt->format; - template->width[0] = pt->width[level]; - template->height[0] = pt->height[level]; - template->depth[0] = 1; + template->width0 = u_minify(pt->width0, level); + template->height0 = u_minify(pt->height0, level); + template->depth0 = 1; template->block = pt->block; template->nblocksx[0] = pt->nblocksx[level]; template->nblocksy[0] = pt->nblocksx[level]; diff --git a/src/gallium/drivers/nv40/nv40_fragtex.c b/src/gallium/drivers/nv40/nv40_fragtex.c index e2ec57564d..44abc84596 100644 --- a/src/gallium/drivers/nv40/nv40_fragtex.c +++ b/src/gallium/drivers/nv40/nv40_fragtex.c @@ -117,11 +117,11 @@ nv40_fragtex_build(struct nv40_context *nv40, int unit) so_data (so, NV40TCL_TEX_ENABLE_ENABLE | ps->en); so_data (so, txs); so_data (so, ps->filt | tf->sign | 0x2000 /*voodoo*/); - so_data (so, (pt->width[0] << NV40TCL_TEX_SIZE0_W_SHIFT) | - pt->height[0]); + so_data (so, (pt->width0 << NV40TCL_TEX_SIZE0_W_SHIFT) | + pt->height0); so_data (so, ps->bcol); so_method(so, nv40->screen->curie, NV40TCL_TEX_SIZE1(unit), 1); - so_data (so, (pt->depth[0] << NV40TCL_TEX_SIZE1_DEPTH_SHIFT) | txp); + so_data (so, (pt->depth0 << NV40TCL_TEX_SIZE1_DEPTH_SHIFT) | txp); return so; } diff --git a/src/gallium/drivers/nv40/nv40_miptree.c b/src/gallium/drivers/nv40/nv40_miptree.c index 465dd3b069..f73bedff6d 100644 --- a/src/gallium/drivers/nv40/nv40_miptree.c +++ b/src/gallium/drivers/nv40/nv40_miptree.c @@ -1,6 +1,7 @@ #include "pipe/p_state.h" #include "pipe/p_defines.h" #include "pipe/p_inlines.h" +#include "util/u_math.h" #include "nv40_context.h" @@ -8,7 +9,7 @@ static void nv40_miptree_layout(struct nv40_miptree *mt) { struct pipe_texture *pt = &mt->base; - uint width = pt->width[0], height = pt->height[0], depth = pt->depth[0]; + uint width = pt->width0, height = pt->height0, depth = pt->depth0; uint offset = 0; int nr_faces, l, f; uint wide_pitch = pt->tex_usage & (PIPE_TEXTURE_USAGE_SAMPLER | @@ -21,29 +22,26 @@ nv40_miptree_layout(struct nv40_miptree *mt) nr_faces = 6; } else if (pt->target == PIPE_TEXTURE_3D) { - nr_faces = pt->depth[0]; + nr_faces = pt->depth0; } else { nr_faces = 1; } for (l = 0; l <= pt->last_level; l++) { - pt->width[l] = width; - pt->height[l] = height; - pt->depth[l] = depth; pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width); pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height); if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) - mt->level[l].pitch = align(pt->width[0] * pt->block.size, 64); + mt->level[l].pitch = align(pt->width0 * pt->block.size, 64); else - mt->level[l].pitch = pt->width[l] * pt->block.size; + mt->level[l].pitch = u_minify(pt->width0, l) * pt->block.size; mt->level[l].image_offset = CALLOC(nr_faces, sizeof(unsigned)); - width = MAX2(1, width >> 1); - height = MAX2(1, height >> 1); - depth = MAX2(1, depth >> 1); + width = u_minify(width, 1); + height = u_minify(height, 1); + depth = u_minify(depth, 1); } for (f = 0; f < nr_faces; f++) { @@ -51,14 +49,14 @@ nv40_miptree_layout(struct nv40_miptree *mt) mt->level[l].image_offset[f] = offset; if (!(pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR) && - pt->width[l + 1] > 1 && pt->height[l + 1] > 1) - offset += align(mt->level[l].pitch * pt->height[l], 64); + u_minify(pt->width0, l + 1) > 1 && u_minify(pt->height0, l + 1) > 1) + offset += align(mt->level[l].pitch * u_minify(pt->height0, l), 64); else - offset += mt->level[l].pitch * pt->height[l]; + offset += mt->level[l].pitch * u_minify(pt->height0, l); } mt->level[l].image_offset[f] = offset; - offset += mt->level[l].pitch * pt->height[l]; + offset += mt->level[l].pitch * u_minify(pt->height0, l); } mt->total_size = offset; @@ -79,8 +77,8 @@ nv40_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt) mt->base.screen = pscreen; /* Swizzled textures must be POT */ - if (pt->width[0] & (pt->width[0] - 1) || - pt->height[0] & (pt->height[0] - 1)) + if (pt->width0 & (pt->width0 - 1) || + pt->height0 & (pt->height0 - 1)) mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR; else if (pt->tex_usage & (PIPE_TEXTURE_USAGE_PRIMARY | @@ -128,7 +126,7 @@ nv40_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt, /* Only supports 2D, non-mipmapped textures for the moment */ if (pt->target != PIPE_TEXTURE_2D || pt->last_level != 0 || - pt->depth[0] != 1) + pt->depth0 != 1) return NULL; mt = CALLOC_STRUCT(nv40_miptree); @@ -176,8 +174,8 @@ nv40_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt, return NULL; pipe_texture_reference(&ns->base.texture, pt); ns->base.format = pt->format; - ns->base.width = pt->width[level]; - ns->base.height = pt->height[level]; + ns->base.width = u_minify(pt->width0, level); + ns->base.height = u_minify(pt->height0, level); ns->base.usage = flags; pipe_reference_init(&ns->base.reference, 1); ns->base.face = face; diff --git a/src/gallium/drivers/nv40/nv40_transfer.c b/src/gallium/drivers/nv40/nv40_transfer.c index 92caee6f38..36e253c96f 100644 --- a/src/gallium/drivers/nv40/nv40_transfer.c +++ b/src/gallium/drivers/nv40/nv40_transfer.c @@ -2,6 +2,7 @@ #include #include #include +#include #include #include "nv40_context.h" #include "nv40_screen.h" @@ -20,9 +21,9 @@ nv40_compatible_transfer_tex(struct pipe_texture *pt, unsigned level, memset(template, 0, sizeof(struct pipe_texture)); template->target = pt->target; template->format = pt->format; - template->width[0] = pt->width[level]; - template->height[0] = pt->height[level]; - template->depth[0] = 1; + template->width0 = u_minify(pt->width0, level); + template->height0 = u_minify(pt->height0, level); + template->depth0 = 1; template->block = pt->block; template->nblocksx[0] = pt->nblocksx[level]; template->nblocksy[0] = pt->nblocksx[level]; diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c index 9c20c5cc28..3d58746793 100644 --- a/src/gallium/drivers/nv50/nv50_miptree.c +++ b/src/gallium/drivers/nv50/nv50_miptree.c @@ -61,8 +61,8 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp) struct nouveau_device *dev = nouveau_screen(pscreen)->device; struct nv50_miptree *mt = CALLOC_STRUCT(nv50_miptree); struct pipe_texture *pt = &mt->base.base; - unsigned width = tmp->width[0], height = tmp->height[0]; - unsigned depth = tmp->depth[0], image_alignment; + unsigned width = tmp->width0, height = tmp->height0; + unsigned depth = tmp->depth0, image_alignment; uint32_t tile_flags; int ret, i, l; @@ -92,9 +92,6 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp) for (l = 0; l <= pt->last_level; l++) { struct nv50_miptree_level *lvl = &mt->level[l]; - pt->width[l] = width; - pt->height[l] = height; - pt->depth[l] = depth; pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width); pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height); @@ -102,9 +99,9 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp) lvl->pitch = align(pt->nblocksx[l] * pt->block.size, 64); lvl->tile_mode = get_tile_mode(pt->nblocksy[l], depth); - width = MAX2(1, width >> 1); - height = MAX2(1, height >> 1); - depth = MAX2(1, depth >> 1); + width = u_minify(width, 1); + height = u_minify(height, 1); + depth = u_minify(depth, 1); } image_alignment = get_tile_height(mt->level[0].tile_mode) * 64; @@ -122,7 +119,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp) size = lvl->pitch; size *= align(pt->nblocksy[l], tile_h); - size *= align(pt->depth[l], tile_d); + size *= align(u_minify(pt->depth0, l), tile_d); lvl->image_offset[i] = mt->total_size; @@ -151,7 +148,7 @@ nv50_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt, /* Only supports 2D, non-mipmapped textures for the moment */ if (pt->target != PIPE_TEXTURE_2D || pt->last_level != 0 || - pt->depth[0] != 1) + pt->depth0 != 1) return NULL; mt = CALLOC_STRUCT(nv50_miptree); @@ -202,8 +199,8 @@ nv50_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt, return NULL; pipe_texture_reference(&ps->texture, pt); ps->format = pt->format; - ps->width = pt->width[level]; - ps->height = pt->height[level]; + ps->width = u_minify(pt->width0, level); + ps->height = u_minify(pt->height0, level); ps->usage = flags; pipe_reference_init(&ps->reference, 1); ps->face = face; diff --git a/src/gallium/drivers/nv50/nv50_tex.c b/src/gallium/drivers/nv50/nv50_tex.c index 2813f54477..417d367942 100644 --- a/src/gallium/drivers/nv50/nv50_tex.c +++ b/src/gallium/drivers/nv50/nv50_tex.c @@ -131,9 +131,9 @@ nv50_tex_construct(struct nv50_context *nv50, struct nouveau_stateobj *so, NOUVEAU_BO_RD, 0, 0); so_data (so, mode); so_data (so, 0x00300000); - so_data (so, mt->base.base.width[0] | (1 << 31)); + so_data (so, mt->base.base.width0 | (1 << 31)); so_data (so, (mt->base.base.last_level << 28) | - (mt->base.base.depth[0] << 16) | mt->base.base.height[0]); + (mt->base.base.depth0 << 16) | mt->base.base.height0); so_data (so, 0x03000000); so_data (so, mt->base.base.last_level << 4); diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c index ea61357aaa..39d65279fc 100644 --- a/src/gallium/drivers/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nv50/nv50_transfer.c @@ -1,6 +1,7 @@ #include "pipe/p_context.h" #include "pipe/p_inlines.h" +#include "util/u_math.h" #include "nv50_context.h" @@ -156,9 +157,9 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->base.block = pt->block; if (!pt->nblocksx[level]) { tx->base.nblocksx = pf_get_nblocksx(&pt->block, - pt->width[level]); + u_minify(pt->width0, level)); tx->base.nblocksy = pf_get_nblocksy(&pt->block, - pt->height[level]); + u_minify(pt->height0, level)); } else { tx->base.nblocksx = pt->nblocksx[level]; tx->base.nblocksy = pt->nblocksy[level]; @@ -167,9 +168,9 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->base.usage = usage; tx->level_pitch = lvl->pitch; - tx->level_width = mt->base.base.width[level]; - tx->level_height = mt->base.base.height[level]; - tx->level_depth = mt->base.base.depth[level]; + tx->level_width = u_minify(mt->base.base.width0, level); + tx->level_height = u_minify(mt->base.base.height0, level); + tx->level_depth = u_minify(mt->base.base.depth0, level); tx->level_offset = lvl->image_offset[image]; tx->level_tiling = lvl->tile_mode; tx->level_x = pf_get_nblocksx(&tx->base.block, x); diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index aea25cf71d..f4d148cdc5 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -34,8 +34,8 @@ static void r300_setup_texture_state(struct r300_texture* tex, boolean is_r500) struct r300_texture_state* state = &tex->state; struct pipe_texture *pt = &tex->tex; - state->format0 = R300_TX_WIDTH((pt->width[0] - 1) & 0x7ff) | - R300_TX_HEIGHT((pt->height[0] - 1) & 0x7ff); + state->format0 = R300_TX_WIDTH((pt->width0 - 1) & 0x7ff) | + R300_TX_HEIGHT((pt->height0 - 1) & 0x7ff); if (tex->is_npot) { /* rectangles love this */ @@ -43,7 +43,7 @@ static void r300_setup_texture_state(struct r300_texture* tex, boolean is_r500) state->format2 = (tex->pitch[0] - 1) & 0x1fff; } else { /* power of two textures (3D, mipmaps, and no pitch) */ - state->format0 |= R300_TX_DEPTH(util_logbase2(pt->depth[0]) & 0xf) | + state->format0 |= R300_TX_DEPTH(util_logbase2(pt->depth0) & 0xf) | R300_TX_NUM_LEVELS(pt->last_level & 0xf); } @@ -58,17 +58,17 @@ static void r300_setup_texture_state(struct r300_texture* tex, boolean is_r500) /* large textures on r500 */ if (is_r500) { - if (pt->width[0] > 2048) { + if (pt->width0 > 2048) { state->format2 |= R500_TXWIDTH_BIT11; } - if (pt->height[0] > 2048) { + if (pt->height0 > 2048) { state->format2 |= R500_TXHEIGHT_BIT11; } } - assert(is_r500 || (pt->width[0] <= 2048 && pt->height[0] <= 2048)); + assert(is_r500 || (pt->width0 <= 2048 && pt->height0 <= 2048)); debug_printf("r300: Set texture state (%dx%d, %d levels)\n", - pt->width[0], pt->height[0], pt->last_level); + pt->width0, pt->height0, pt->last_level); } unsigned r300_texture_get_offset(struct r300_texture* tex, unsigned level, @@ -106,7 +106,7 @@ unsigned r300_texture_get_stride(struct r300_texture* tex, unsigned level) return 0; } - return align(pf_get_stride(&tex->tex.block, tex->tex.width[level]), 32); + return align(pf_get_stride(&tex->tex.block, u_minify(tex->tex.width0, level)), 32); } static void r300_setup_miptree(struct r300_texture* tex) @@ -116,14 +116,8 @@ static void r300_setup_miptree(struct r300_texture* tex) int i; for (i = 0; i <= base->last_level; i++) { - if (i > 0) { - base->width[i] = minify(base->width[i-1]); - base->height[i] = minify(base->height[i-1]); - base->depth[i] = minify(base->depth[i-1]); - } - - base->nblocksx[i] = pf_get_nblocksx(&base->block, base->width[i]); - base->nblocksy[i] = pf_get_nblocksy(&base->block, base->height[i]); + base->nblocksx[i] = pf_get_nblocksx(&base->block, u_minify(base->width0, i)); + base->nblocksy[i] = pf_get_nblocksy(&base->block, u_minify(base->height0, i)); stride = r300_texture_get_stride(tex, i); layer_size = stride * base->nblocksy[i]; @@ -131,7 +125,7 @@ static void r300_setup_miptree(struct r300_texture* tex) if (base->target == PIPE_TEXTURE_CUBE) size = layer_size * 6; else - size = layer_size * base->depth[i]; + size = layer_size * u_minify(base->depth0, i); tex->offset[i] = align(tex->size, 32); tex->size = tex->offset[i] + size; @@ -140,15 +134,15 @@ static void r300_setup_miptree(struct r300_texture* tex) debug_printf("r300: Texture miptree: Level %d " "(%dx%dx%d px, pitch %d bytes)\n", - i, base->width[i], base->height[i], base->depth[i], - stride); + i, u_minify(base->width0, i), u_minify(base->height0, i), + u_minify(base->depth0, i), stride); } } static void r300_setup_flags(struct r300_texture* tex) { - tex->is_npot = !util_is_power_of_two(tex->tex.width[0]) || - !util_is_power_of_two(tex->tex.height[0]); + tex->is_npot = !util_is_power_of_two(tex->tex.width0) || + !util_is_power_of_two(tex->tex.height0); } /* Create a new texture. */ @@ -208,8 +202,8 @@ static struct pipe_surface* r300_get_tex_surface(struct pipe_screen* screen, pipe_reference_init(&surface->reference, 1); pipe_texture_reference(&surface->texture, texture); surface->format = texture->format; - surface->width = texture->width[level]; - surface->height = texture->height[level]; + surface->width = u_minify(texture->width0, level); + surface->height = u_minify(texture->height0, level); surface->offset = offset; surface->usage = flags; surface->zslice = zslice; @@ -237,7 +231,7 @@ static struct pipe_texture* /* Support only 2D textures without mipmaps */ if (base->target != PIPE_TEXTURE_2D || - base->depth[0] != 1 || + base->depth0 != 1 || base->last_level != 0) { return NULL; } @@ -287,9 +281,9 @@ r300_video_surface_create(struct pipe_screen *screen, template.target = PIPE_TEXTURE_2D; template.format = PIPE_FORMAT_X8R8G8B8_UNORM; template.last_level = 0; - template.width[0] = util_next_power_of_two(width); - template.height[0] = util_next_power_of_two(height); - template.depth[0] = 1; + template.width0 = util_next_power_of_two(width); + template.height0 = util_next_power_of_two(height); + template.depth0 = 1; pf_get_block(template.format, &template.block); template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_RENDER_TARGET; diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index 5625ff53cf..45a6059ea8 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -46,7 +46,7 @@ #include "util/u_memory.h" #include "util/u_rect.h" - + static struct pipe_surface * dri_surface_from_handle(struct drm_api *api, struct pipe_screen *screen, @@ -62,10 +62,10 @@ dri_surface_from_handle(struct drm_api *api, templat.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET; templat.target = PIPE_TEXTURE_2D; templat.last_level = 0; - templat.depth[0] = 1; + templat.depth0 = 1; templat.format = format; - templat.width[0] = width; - templat.height[0] = height; + templat.width0 = width; + templat.height0 = height; pf_get_block(templat.format, &templat.block); texture = api->texture_from_shared_handle(api, screen, &templat, diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c index 91615abebe..ddd9b04cd4 100644 --- a/src/gallium/state_trackers/egl/egl_surface.c +++ b/src/gallium/state_trackers/egl/egl_surface.c @@ -114,10 +114,10 @@ drm_create_texture(_EGLDisplay *dpy, templat.tex_usage |= PIPE_TEXTURE_USAGE_PRIMARY; templat.target = PIPE_TEXTURE_2D; templat.last_level = 0; - templat.depth[0] = 1; + templat.depth0 = 1; templat.format = PIPE_FORMAT_A8R8G8B8_UNORM; - templat.width[0] = w; - templat.height[0] = h; + templat.width0 = w; + templat.height0 = h; pf_get_block(templat.format, &templat.block); texture = screen->texture_create(dev->screen, diff --git a/src/gallium/state_trackers/python/p_device.i b/src/gallium/state_trackers/python/p_device.i index f16fe5b0ff..a83bcc71a1 100644 --- a/src/gallium/state_trackers/python/p_device.i +++ b/src/gallium/state_trackers/python/p_device.i @@ -113,9 +113,9 @@ struct st_device { memset(&templat, 0, sizeof(templat)); templat.format = format; pf_get_block(templat.format, &templat.block); - templat.width[0] = width; - templat.height[0] = height; - templat.depth[0] = depth; + templat.width0 = width; + templat.height0 = height; + templat.depth0 = depth; templat.last_level = last_level; templat.target = target; templat.tex_usage = tex_usage; diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index 1d513abf3c..5416b872f5 100644 --- a/src/gallium/state_trackers/python/p_texture.i +++ b/src/gallium/state_trackers/python/p_texture.i @@ -59,15 +59,15 @@ } unsigned get_width(unsigned level=0) { - return $self->width[level]; + return u_minify($self->width0, level); } unsigned get_height(unsigned level=0) { - return $self->height[level]; + return u_minify($self->height0, level); } unsigned get_depth(unsigned level=0) { - return $self->depth[level]; + return u_minify($self->depth0, level); } unsigned get_nblocksx(unsigned level=0) { @@ -88,7 +88,7 @@ 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]) + if(zslice >= u_minify($self->depth0, level)) SWIG_exception(SWIG_ValueError, "zslice out of bounds"); surface = CALLOC_STRUCT(st_surface); @@ -375,13 +375,13 @@ struct st_surface static unsigned st_surface_width_get(struct st_surface *surface) { - return surface->texture->width[surface->level]; + return u_minify(surface->texture->width0, surface->level); } static unsigned st_surface_height_get(struct st_surface *surface) { - return surface->texture->height[surface->level]; + return u_minify(surface->texture->height0, surface->level); } static unsigned diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index 348f2e4368..d0bcb690a9 100755 --- a/src/gallium/state_trackers/python/retrace/interpreter.py +++ b/src/gallium/state_trackers/python/retrace/interpreter.py @@ -279,9 +279,9 @@ class Screen(Object): def texture_create(self, templat): return self.real.texture_create( format = templat.format, - width = templat.width[0], - height = templat.height[0], - depth = templat.depth[0], + width = templat.width0, + height = templat.height0, + depth = templat.depth0, last_level = templat.last_level, target = templat.target, tex_usage = templat.tex_usage, diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c index ea7d18738f..a791113aba 100644 --- a/src/gallium/state_trackers/python/st_device.c +++ b/src/gallium/state_trackers/python/st_device.c @@ -252,9 +252,9 @@ st_context_create(struct st_device *st_dev) templat.block.size = 4; templat.block.width = 1; templat.block.height = 1; - templat.width[0] = 1; - templat.height[0] = 1; - templat.depth[0] = 1; + templat.width0 = 1; + templat.height0 = 1; + templat.depth0 = 1; templat.last_level = 0; st_ctx->default_texture = screen->texture_create( screen, &templat ); @@ -264,8 +264,8 @@ st_context_create(struct st_device *st_dev) 0, 0, 0, PIPE_TRANSFER_WRITE, 0, 0, - st_ctx->default_texture->width[0], - st_ctx->default_texture->height[0]); + st_ctx->default_texture->width0, + st_ctx->default_texture->height0); if (transfer) { uint32_t *map; map = (uint32_t *) screen->transfer_map(screen, transfer); diff --git a/src/gallium/state_trackers/python/st_sample.c b/src/gallium/state_trackers/python/st_sample.c index 53a01891e1..6fee90afda 100644 --- a/src/gallium/state_trackers/python/st_sample.c +++ b/src/gallium/state_trackers/python/st_sample.c @@ -528,8 +528,8 @@ st_sample_surface(struct st_surface *surface, float *rgba) { struct pipe_texture *texture = surface->texture; struct pipe_screen *screen = texture->screen; - unsigned width = texture->width[surface->level]; - unsigned height = texture->height[surface->level]; + unsigned width = u_minify(texture->width0, surface->level); + unsigned height = u_minify(texture->height0, surface->level); uint rgba_stride = width * 4; struct pipe_transfer *transfer; void *raw; diff --git a/src/gallium/state_trackers/vega/api_filters.c b/src/gallium/state_trackers/vega/api_filters.c index 862cbb03c4..faf396d087 100644 --- a/src/gallium/state_trackers/vega/api_filters.c +++ b/src/gallium/state_trackers/vega/api_filters.c @@ -68,9 +68,9 @@ static INLINE struct pipe_texture *create_texture_1d(struct vg_context *ctx, templ.target = PIPE_TEXTURE_1D; templ.format = PIPE_FORMAT_A8R8G8B8_UNORM; templ.last_level = 0; - templ.width[0] = color_data_len; - templ.height[0] = 1; - templ.depth[0] = 1; + templ.width0 = color_data_len; + templ.height0 = 1; + templ.depth0 = 1; pf_get_block(PIPE_FORMAT_A8R8G8B8_UNORM, &templ.block); templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; @@ -81,7 +81,7 @@ static INLINE struct pipe_texture *create_texture_1d(struct vg_context *ctx, screen->get_tex_transfer(screen, tex, 0, 0, 0, PIPE_TRANSFER_READ_WRITE , - 0, 0, tex->width[0], tex->height[0]); + 0, 0, tex->width0, tex->height0); void *map = screen->transfer_map(screen, transfer); memcpy(map, color_data, sizeof(VGint)*color_data_len); screen->transfer_unmap(screen, transfer); diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c index 9a722980d5..4684a5727d 100644 --- a/src/gallium/state_trackers/vega/image.c +++ b/src/gallium/state_trackers/vega/image.c @@ -93,8 +93,8 @@ static void vg_copy_texture(struct vg_context *ctx, dst_loc[3] = height; dst_bounds[0] = 0.f; dst_bounds[1] = 0.f; - dst_bounds[2] = dst->width[0]; - dst_bounds[3] = dst->height[0]; + dst_bounds[2] = dst->width0; + dst_bounds[3] = dst->height0; src_loc[0] = sx; src_loc[1] = sy; @@ -102,8 +102,8 @@ static void vg_copy_texture(struct vg_context *ctx, src_loc[3] = height; src_bounds[0] = 0.f; src_bounds[1] = 0.f; - src_bounds[2] = src->width[0]; - src_bounds[3] = src->height[0]; + src_bounds[2] = src->width0; + src_bounds[3] = src->height0; vg_bound_rect(src_loc, src_bounds, src_shift); vg_bound_rect(dst_loc, dst_bounds, dst_shift); @@ -272,9 +272,9 @@ struct vg_image * image_create(VGImageFormat format, pt.format = pformat; pf_get_block(pformat, &pt.block); pt.last_level = 0; - pt.width[0] = width; - pt.height[0] = height; - pt.depth[0] = 1; + pt.width0 = width; + pt.height0 = height; + pt.depth0 = 1; pt.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; newtex = screen->texture_create(screen, &pt); @@ -414,7 +414,7 @@ void image_sub_data(struct vg_image *image, { /* upload color_data */ struct pipe_transfer *transfer = screen->get_tex_transfer( screen, texture, 0, 0, 0, - PIPE_TRANSFER_WRITE, 0, 0, texture->width[0], texture->height[0]); + PIPE_TRANSFER_WRITE, 0, 0, texture->width0, texture->height0); src += (dataStride * yoffset); for (i = 0; i < height; i++) { _vega_unpack_float_span_rgba(ctx, width, xoffset, src, dataFormat, temp); diff --git a/src/gallium/state_trackers/vega/mask.c b/src/gallium/state_trackers/vega/mask.c index 24650a37d5..b84103fdba 100644 --- a/src/gallium/state_trackers/vega/mask.c +++ b/src/gallium/state_trackers/vega/mask.c @@ -426,7 +426,7 @@ static void mask_using_texture(struct pipe_texture *texture, if (!surface) return; if (!intersect_rectangles(surface->width, surface->height, - texture->width[0], texture->height[0], + texture->width0, texture->height0, x, y, width, height, offsets, loc)) return; @@ -493,9 +493,9 @@ struct vg_mask_layer * mask_layer_create(VGint width, VGint height) pt.format = PIPE_FORMAT_A8R8G8B8_UNORM; pf_get_block(PIPE_FORMAT_A8R8G8B8_UNORM, &pt.block); pt.last_level = 0; - pt.width[0] = width; - pt.height[0] = height; - pt.depth[0] = 1; + pt.width0 = width; + pt.height0 = height; + pt.depth0 = 1; pt.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; pt.compressed = 0; @@ -607,8 +607,8 @@ void mask_render_to(struct path *path, struct vg_mask_layer *temp_layer; VGint width, height; - width = fb_buffers->alpha_mask->width[0]; - height = fb_buffers->alpha_mask->width[0]; + width = fb_buffers->alpha_mask->width0; + height = fb_buffers->alpha_mask->width0; temp_layer = mask_layer_create(width, height); diff --git a/src/gallium/state_trackers/vega/paint.c b/src/gallium/state_trackers/vega/paint.c index 04a6ba9cdc..e8ca7d9e89 100644 --- a/src/gallium/state_trackers/vega/paint.c +++ b/src/gallium/state_trackers/vega/paint.c @@ -151,9 +151,9 @@ static INLINE struct pipe_texture *create_gradient_texture(struct vg_paint *p) templ.target = PIPE_TEXTURE_1D; templ.format = PIPE_FORMAT_A8R8G8B8_UNORM; templ.last_level = 0; - templ.width[0] = 1024; - templ.height[0] = 1; - templ.depth[0] = 1; + templ.width0 = 1024; + templ.height0 = 1; + templ.depth0 = 1; pf_get_block(PIPE_FORMAT_A8R8G8B8_UNORM, &templ.block); templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; @@ -328,8 +328,8 @@ static INLINE void paint_pattern_buffer(struct vg_paint *paint, void *buffer) map[4] = 0.f; map[5] = 1.f; - map[6] = paint->pattern.texture->width[0]; - map[7] = paint->pattern.texture->height[0]; + map[6] = paint->pattern.texture->width0; + map[7] = paint->pattern.texture->height0; { struct matrix mat; memcpy(&mat, &ctx->state.vg.fill_paint_to_user_matrix, diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c index 396c88aa3d..9085ed1bfe 100644 --- a/src/gallium/state_trackers/vega/renderer.c +++ b/src/gallium/state_trackers/vega/renderer.c @@ -230,13 +230,13 @@ void renderer_draw_texture(struct renderer *r, struct pipe_buffer *buf; VGfloat s0, t0, s1, t1; - assert(tex->width[0] != 0); - assert(tex->height[0] != 0); + assert(tex->width0 != 0); + assert(tex->height0 != 0); - s0 = x1offset / tex->width[0]; - s1 = x2offset / tex->width[0]; - t0 = y1offset / tex->height[0]; - t1 = y2offset / tex->height[0]; + s0 = x1offset / tex->width0; + s1 = x2offset / tex->width0; + t0 = y1offset / tex->height0; + t1 = y2offset / tex->height0; cso_save_vertex_shader(r->cso); /* shaders */ @@ -276,10 +276,10 @@ void renderer_copy_texture(struct renderer *ctx, struct pipe_framebuffer_state fb; float s0, t0, s1, t1; - assert(src->width[0] != 0); - assert(src->height[0] != 0); - assert(dst->width[0] != 0); - assert(dst->height[0] != 0); + assert(src->width0 != 0); + assert(src->height0 != 0); + assert(dst->width0 != 0); + assert(dst->height0 != 0); #if 0 debug_printf("copy texture [%f, %f, %f, %f], [%f, %f, %f, %f]\n", @@ -287,10 +287,10 @@ void renderer_copy_texture(struct renderer *ctx, #endif #if 1 - s0 = sx1 / src->width[0]; - s1 = sx2 / src->width[0]; - t0 = sy1 / src->height[0]; - t1 = sy2 / src->height[0]; + s0 = sx1 / src->width0; + s1 = sx2 / src->width0; + t0 = sy1 / src->height0; + t1 = sy2 / src->height0; #else s0 = 0; s1 = 1; @@ -445,9 +445,9 @@ void renderer_copy_surface(struct renderer *ctx, texTemp.target = PIPE_TEXTURE_2D; texTemp.format = src->format; texTemp.last_level = 0; - texTemp.width[0] = srcW; - texTemp.height[0] = srcH; - texTemp.depth[0] = 1; + texTemp.width0 = srcW; + texTemp.height0 = srcH; + texTemp.depth0 = 1; pf_get_block(src->format, &texTemp.block); tex = screen->texture_create(screen, &texTemp); @@ -570,13 +570,13 @@ void renderer_texture_quad(struct renderer *r, struct pipe_buffer *buf; VGfloat s0, t0, s1, t1; - assert(tex->width[0] != 0); - assert(tex->height[0] != 0); + assert(tex->width0 != 0); + assert(tex->height0 != 0); - s0 = x1offset / tex->width[0]; - s1 = x2offset / tex->width[0]; - t0 = y1offset / tex->height[0]; - t1 = y2offset / tex->height[0]; + s0 = x1offset / tex->width0; + s1 = x2offset / tex->width0; + t0 = y1offset / tex->height0; + t1 = y2offset / tex->height0; cso_save_vertex_shader(r->cso); /* shaders */ diff --git a/src/gallium/state_trackers/vega/vg_tracker.c b/src/gallium/state_trackers/vega/vg_tracker.c index c4da01e52c..d28463dd1b 100644 --- a/src/gallium/state_trackers/vega/vg_tracker.c +++ b/src/gallium/state_trackers/vega/vg_tracker.c @@ -51,9 +51,9 @@ create_texture(struct pipe_context *pipe, enum pipe_format format, templ.target = PIPE_TEXTURE_2D; pf_get_block(templ.format, &templ.block); - templ.width[0] = width; - templ.height[0] = height; - templ.depth[0] = 1; + templ.width0 = width; + templ.height0 = height; + templ.depth0 = 1; templ.last_level = 0; if (pf_get_component_bits(format, PIPE_FORMAT_COMP_S)) { diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index 733bd53fca..6064648ab0 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -436,8 +436,8 @@ setup_fs_constant_buffer(struct exa_context *exa) static void setup_constant_buffers(struct exa_context *exa, struct exa_pixmap_priv *pDst) { - int width = pDst->tex->width[0]; - int height = pDst->tex->height[0]; + int width = pDst->tex->width0; + int height = pDst->tex->height0; setup_vs_constant_buffer(exa, width, height); setup_fs_constant_buffer(exa); diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index 85b9162d4c..c4751724c9 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -187,10 +187,10 @@ crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image) templat.tex_usage |= PIPE_TEXTURE_USAGE_PRIMARY; templat.target = PIPE_TEXTURE_2D; templat.last_level = 0; - templat.depth[0] = 1; + templat.depth0 = 1; templat.format = PIPE_FORMAT_A8R8G8B8_UNORM; - templat.width[0] = 64; - templat.height[0] = 64; + templat.width0 = 64; + templat.height0 = 64; pf_get_block(templat.format, &templat.block); crtcp->cursor_tex = ms->screen->texture_create(ms->screen, diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index c41a7cd639..e16e79719c 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -103,9 +103,9 @@ driDoCreateBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int format) template.format = ms->ds_depth_bits_last ? PIPE_FORMAT_S8Z24_UNORM : PIPE_FORMAT_Z24S8_UNORM; pf_get_block(template.format, &template.block); - template.width[0] = pDraw->width; - template.height[0] = pDraw->height; - template.depth[0] = 1; + template.width0 = pDraw->width; + template.height0 = pDraw->height; + template.depth0 = 1; template.last_level = 0; template.tex_usage = PIPE_TEXTURE_USAGE_DEPTH_STENCIL | PIPE_TEXTURE_USAGE_DISPLAY_TARGET; diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 6fa274eb0a..534d4da13f 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -288,7 +288,7 @@ ExaPrepareAccess(PixmapPtr pPix, int index) PIPE_TRANSFER_MAP_DIRECTLY | #endif PIPE_TRANSFER_READ_WRITE, - 0, 0, priv->tex->width[0], priv->tex->height[0]); + 0, 0, priv->tex->width0, priv->tex->height0); if (!priv->map_transfer) #ifdef EXA_MIXED_PIXMAPS return FALSE; @@ -752,8 +752,8 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, /* Deal with screen resize */ if (!priv->tex || - (priv->tex->width[0] != width || - priv->tex->height[0] != height || + (priv->tex->width0 != width || + priv->tex->height0 != height || priv->tex_flags != priv->flags)) { struct pipe_texture *texture = NULL; struct pipe_texture template; @@ -762,9 +762,9 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, template.target = PIPE_TEXTURE_2D; exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &priv->picture_format); pf_get_block(template.format, &template.block); - template.width[0] = width; - template.height[0] = height; - template.depth[0] = 1; + template.width0 = width; + template.height0 = height; + template.depth0 = 1; template.last_level = 0; template.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET | priv->flags; priv->tex_flags = priv->flags; @@ -779,12 +779,12 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, src_surf = xorg_gpu_surface(exa->pipe->screen, priv); if (exa->pipe->surface_copy) { exa->pipe->surface_copy(exa->pipe, dst_surf, 0, 0, src_surf, - 0, 0, min(width, texture->width[0]), - min(height, texture->height[0])); + 0, 0, min(width, texture->width0), + min(height, texture->height0)); } else { util_surface_copy(exa->pipe, FALSE, dst_surf, 0, 0, src_surf, - 0, 0, min(width, texture->width[0]), - min(height, texture->height[0])); + 0, 0, min(width, texture->width0), + min(height, texture->height0)); } exa->scrn->tex_surface_destroy(dst_surf); exa->scrn->tex_surface_destroy(src_surf); @@ -817,8 +817,8 @@ xorg_exa_set_texture(PixmapPtr pPixmap, struct pipe_texture *tex) if (!priv) return FALSE; - if (pPixmap->drawable.width != tex->width[0] || - pPixmap->drawable.height != tex->height[0]) + if (pPixmap->drawable.width != tex->width0 || + pPixmap->drawable.height != tex->height0) return FALSE; pipe_texture_reference(&priv->tex, tex); @@ -841,9 +841,9 @@ xorg_exa_create_root_texture(ScrnInfoPtr pScrn, template.target = PIPE_TEXTURE_2D; exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &dummy); pf_get_block(template.format, &template.block); - template.width[0] = width; - template.height[0] = height; - template.depth[0] = 1; + template.width0 = width; + template.height0 = height; + template.depth0 = 1; template.last_level = 0; template.tex_usage |= PIPE_TEXTURE_USAGE_RENDER_TARGET; template.tex_usage |= PIPE_TEXTURE_USAGE_PRIMARY; diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 723605312c..418a8dd88b 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -167,14 +167,14 @@ add_vertex_data1(struct xorg_renderer *r, map_point(src_matrix, pt3[0], pt3[1], &pt3[0], &pt3[1]); } - s0 = pt0[0] / src->width[0]; - s1 = pt1[0] / src->width[0]; - s2 = pt2[0] / src->width[0]; - s3 = pt3[0] / src->width[0]; - t0 = pt0[1] / src->height[0]; - t1 = pt1[1] / src->height[0]; - t2 = pt2[1] / src->height[0]; - t3 = pt3[1] / src->height[0]; + s0 = pt0[0] / src->width0; + s1 = pt1[0] / src->width0; + s2 = pt2[0] / src->width0; + s3 = pt3[0] / src->width0; + t0 = pt0[1] / src->height0; + t1 = pt1[1] / src->height0; + t2 = pt2[1] / src->height0; + t3 = pt3[1] / src->height0; /* 1st vertex */ add_vertex_1tex(r, dstX, dstY, s0, t0); @@ -262,15 +262,15 @@ add_vertex_data2(struct xorg_renderer *r, map_point(mask_matrix, mpt1[0], mpt1[1], &mpt1[0], &mpt1[1]); } - src_s0 = spt0[0] / src->width[0]; - src_t0 = spt0[1] / src->height[0]; - src_s1 = spt1[0] / src->width[0]; - src_t1 = spt1[1] / src->height[0]; + src_s0 = spt0[0] / src->width0; + src_t0 = spt0[1] / src->height0; + src_s1 = spt1[0] / src->width0; + src_t1 = spt1[1] / src->height0; - mask_s0 = mpt0[0] / mask->width[0]; - mask_t0 = mpt0[1] / mask->height[0]; - mask_s1 = mpt1[0] / mask->width[0]; - mask_t1 = mpt1[1] / mask->height[0]; + mask_s0 = mpt0[0] / mask->width0; + mask_t0 = mpt0[1] / mask->height0; + mask_s1 = mpt1[0] / mask->width0; + mask_t1 = mpt1[1] / mask->height0; /* 1st vertex */ add_vertex_2tex(r, dstX, dstY, @@ -300,10 +300,10 @@ setup_vertex_data_yuv(struct xorg_renderer *r, spt1[0] = srcX + srcW; spt1[1] = srcY + srcH; - s0 = spt0[0] / tex[0]->width[0]; - t0 = spt0[1] / tex[0]->height[0]; - s1 = spt1[0] / tex[0]->width[0]; - t1 = spt1[1] / tex[0]->height[0]; + s0 = spt0[0] / tex[0]->width0; + t0 = spt0[1] / tex[0]->height0; + s1 = spt1[0] / tex[0]->width0; + t1 = spt1[1] / tex[0]->height0; /* 1st vertex */ add_vertex_1tex(r, dstX, dstY, s0, t0); @@ -387,8 +387,8 @@ void renderer_bind_framebuffer(struct xorg_renderer *r, struct pipe_surface *surface = xorg_gpu_surface(r->pipe->screen, priv); memset(&state, 0, sizeof(struct pipe_framebuffer_state)); - state.width = priv->tex->width[0]; - state.height = priv->tex->height[0]; + state.width = priv->tex->width0; + state.height = priv->tex->height0; state.nr_cbufs = 1; state.cbufs[0] = surface; @@ -407,8 +407,8 @@ void renderer_bind_framebuffer(struct xorg_renderer *r, void renderer_bind_viewport(struct xorg_renderer *r, struct exa_pixmap_priv *dst) { - int width = dst->tex->width[0]; - int height = dst->tex->height[0]; + int width = dst->tex->width0; + int height = dst->tex->height0; /*debug_printf("Bind viewport (%d, %d)\n", width, height);*/ @@ -584,16 +584,16 @@ static void renderer_copy_texture(struct xorg_renderer *r, float s0, t0, s1, t1; struct xorg_shader shader; - assert(src->width[0] != 0); - assert(src->height[0] != 0); - assert(dst->width[0] != 0); - assert(dst->height[0] != 0); + assert(src->width0 != 0); + assert(src->height0 != 0); + assert(dst->width0 != 0); + assert(dst->height0 != 0); #if 1 - s0 = sx1 / src->width[0]; - s1 = sx2 / src->width[0]; - t0 = sy1 / src->height[0]; - t1 = sy2 / src->height[0]; + s0 = sx1 / src->width0; + s1 = sx2 / src->width0; + t0 = sy1 / src->height0; + t1 = sy2 / src->height0; #else s0 = 0; s1 = 1; @@ -730,9 +730,9 @@ create_sampler_texture(struct xorg_renderer *r, templ.target = PIPE_TEXTURE_2D; templ.format = format; templ.last_level = 0; - templ.width[0] = src->width[0]; - templ.height[0] = src->height[0]; - templ.depth[0] = 1; + templ.width0 = src->width0; + templ.height0 = src->height0; + templ.depth0 = 1; pf_get_block(format, &templ.block); templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; @@ -754,13 +754,13 @@ create_sampler_texture(struct xorg_renderer *r, ps_tex, /* dest */ 0, 0, /* destx/y */ ps_read, - 0, 0, src->width[0], src->height[0]); + 0, 0, src->width0, src->height0); } else { util_surface_copy(pipe, FALSE, ps_tex, /* dest */ 0, 0, /* destx/y */ ps_read, - 0, 0, src->width[0], src->height[0]); + 0, 0, src->width0, src->height0); } pipe_surface_reference(&ps_read, NULL); pipe_surface_reference(&ps_tex, NULL); @@ -791,8 +791,8 @@ void renderer_copy_pixmap(struct xorg_renderer *r, dst_loc[3] = height; dst_bounds[0] = 0.f; dst_bounds[1] = 0.f; - dst_bounds[2] = dst->width[0]; - dst_bounds[3] = dst->height[0]; + dst_bounds[2] = dst->width0; + dst_bounds[3] = dst->height0; src_loc[0] = sx; src_loc[1] = sy; @@ -800,8 +800,8 @@ void renderer_copy_pixmap(struct xorg_renderer *r, src_loc[3] = height; src_bounds[0] = 0.f; src_bounds[1] = 0.f; - src_bounds[2] = src->width[0]; - src_bounds[3] = src->height[0]; + src_bounds[2] = src->width0; + src_bounds[3] = src->height0; bound_rect(src_loc, src_bounds, src_shift); bound_rect(dst_loc, dst_bounds, dst_shift); diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index 2b935c0f73..856599e640 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -166,9 +166,9 @@ create_component_texture(struct pipe_context *pipe, templ.target = PIPE_TEXTURE_2D; templ.format = PIPE_FORMAT_L8_UNORM; templ.last_level = 0; - templ.width[0] = width; - templ.height[0] = height; - templ.depth[0] = 1; + templ.width0 = width; + templ.height0 = height; + templ.depth0 = 1; pf_get_block(PIPE_FORMAT_L8_UNORM, &templ.block); templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; @@ -182,18 +182,18 @@ check_yuv_textures(struct xorg_xv_port_priv *priv, int width, int height) { struct pipe_texture **dst = priv->yuv[priv->current_set]; if (!dst[0] || - dst[0]->width[0] != width || - dst[0]->height[0] != height) { + dst[0]->width0 != width || + dst[0]->height0 != height) { pipe_texture_reference(&dst[0], NULL); } if (!dst[1] || - dst[1]->width[0] != width || - dst[1]->height[0] != height) { + dst[1]->width0 != width || + dst[1]->height0 != height) { pipe_texture_reference(&dst[1], NULL); } if (!dst[2] || - dst[2]->width[0] != width || - dst[2]->height[0] != height) { + dst[2]->width0 != width || + dst[2]->height0 != height) { pipe_texture_reference(&dst[2], NULL); } @@ -320,8 +320,8 @@ copy_packed_data(ScrnInfoPtr pScrn, static void setup_vs_video_constants(struct xorg_renderer *r, struct exa_pixmap_priv *dst) { - int width = dst->tex->width[0]; - int height = dst->tex->height[0]; + int width = dst->tex->width0; + int height = dst->tex->height0; const int param_bytes = 8 * sizeof(float); float vs_consts[8] = { 2.f/width, 2.f/height, 1, 1, diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c index bf9038f356..8cb73f4897 100644 --- a/src/gallium/state_trackers/xorg/xvmc/surface.c +++ b/src/gallium/state_trackers/xorg/xvmc/surface.c @@ -103,9 +103,9 @@ CreateOrResizeBackBuffer(struct pipe_video_context *vpipe, unsigned int width, u /* XXX: Needs to match the drawable's format? */ template.format = PIPE_FORMAT_X8R8G8B8_UNORM; template.last_level = 0; - template.width[0] = width; - template.height[0] = height; - template.depth[0] = 1; + template.width0 = width; + template.height0 = height; + template.depth0 = 1; pf_get_block(template.format, &template.block); template.tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET; diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c index 317dc44d22..d497861324 100644 --- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c +++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c @@ -24,10 +24,10 @@ dri_surface_from_handle(struct drm_api *api, struct pipe_screen *pscreen, tmpl.tex_usage = PIPE_TEXTURE_USAGE_PRIMARY; tmpl.target = PIPE_TEXTURE_2D; tmpl.last_level = 0; - tmpl.depth[0] = 1; + tmpl.depth0 = 1; tmpl.format = format; - tmpl.width[0] = width; - tmpl.height[0] = height; + tmpl.width0 = width; + tmpl.height0 = height; pf_get_block(tmpl.format, &tmpl.block); pt = api->texture_from_shared_handle(api, pscreen, &tmpl, diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c index 81cd9dc4fb..74afffc9cf 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c @@ -317,9 +317,9 @@ struct pipe_surface *radeon_surface_from_handle(struct radeon_context *radeon_co memset(&tmpl, 0, sizeof(tmpl)); tmpl.tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET; tmpl.target = PIPE_TEXTURE_2D; - tmpl.width[0] = w; - tmpl.height[0] = h; - tmpl.depth[0] = 1; + tmpl.width0 = w; + tmpl.height0 = h; + tmpl.depth0 = 1; tmpl.format = format; pf_get_block(tmpl.format, &tmpl.block); tmpl.nblocksx[0] = pf_get_nblocksx(&tmpl.block, w); diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 0469fb9978..659a6c9193 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -376,7 +376,7 @@ st_render_texture(GLcontext *ctx, rb->_BaseFormat = texImage->_BaseFormat; /*printf("***** render to texture level %d: %d x %d\n", att->TextureLevel, rb->Width, rb->Height);*/ - /*printf("***** pipe texture %d x %d\n", pt->width[0], pt->height[0]);*/ + /*printf("***** pipe texture %d x %d\n", pt->width0, pt->height0);*/ pipe_texture_reference( &strb->texture, pt ); -- cgit v1.2.3 From 69671df74c8b45f08149c248a7ee905912aec2b0 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 26 Nov 2009 23:02:49 -0500 Subject: svga: Prevent potential null pointer dereference in vmw_surface.c. --- src/gallium/winsys/drm/vmware/core/vmw_surface.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/core/vmw_surface.c b/src/gallium/winsys/drm/vmware/core/vmw_surface.c index c19e556df9..64eb32f8b9 100644 --- a/src/gallium/winsys/drm/vmware/core/vmw_surface.c +++ b/src/gallium/winsys/drm/vmware/core/vmw_surface.c @@ -37,11 +37,13 @@ vmw_svga_winsys_surface_reference(struct vmw_svga_winsys_surface **pdst, { struct pipe_reference *src_ref; struct pipe_reference *dst_ref; - struct vmw_svga_winsys_surface *dst = *pdst; - + struct vmw_svga_winsys_surface *dst; + if(pdst == NULL || *pdst == src) return; - + + dst = *pdst; + src_ref = src ? &src->refcnt : NULL; dst_ref = dst ? &dst->refcnt : NULL; -- cgit v1.2.3 From 5455e88f1c2043b3703650ca827a0ed2779e82ca Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 27 Nov 2009 09:19:01 +0100 Subject: gallium: Remove tgsi_version token. Not really needed, never served its purpose. --- src/gallium/include/pipe/p_shader_tokens.h | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src') diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index 7d73d7df85..588ca5e026 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -35,12 +35,6 @@ extern "C" { #include "p_compiler.h" -struct tgsi_version -{ - unsigned Major : 8; - unsigned Minor : 8; - unsigned Padding : 16; -}; struct tgsi_header { -- cgit v1.2.3 From e6133564bf2e65fc86f626a45d7977bdeaff8579 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 27 Nov 2009 10:06:41 +0100 Subject: tgsi: Remove tgsi_version token. --- src/gallium/auxiliary/tgsi/tgsi_build.c | 15 --------------- src/gallium/auxiliary/tgsi/tgsi_build.h | 6 ------ src/gallium/auxiliary/tgsi/tgsi_dump.c | 3 --- src/gallium/auxiliary/tgsi/tgsi_dump_c.c | 6 ------ src/gallium/auxiliary/tgsi/tgsi_iterate.c | 1 - src/gallium/auxiliary/tgsi/tgsi_iterate.h | 1 - src/gallium/auxiliary/tgsi/tgsi_parse.c | 11 +++-------- src/gallium/auxiliary/tgsi/tgsi_parse.h | 6 ------ src/gallium/auxiliary/tgsi/tgsi_text.c | 16 ++++++---------- src/gallium/auxiliary/tgsi/tgsi_transform.c | 10 ++++------ src/gallium/auxiliary/tgsi/tgsi_ureg.c | 15 +++++---------- 11 files changed, 18 insertions(+), 72 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index d80222bcf4..d75ab1b3ff 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -30,21 +30,6 @@ #include "tgsi_build.h" #include "tgsi_parse.h" -/* - * version - */ - -struct tgsi_version -tgsi_build_version( void ) -{ - struct tgsi_version version; - - version.Major = 1; - version.Minor = 1; - version.Padding = 0; - - return version; -} /* * header diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.h b/src/gallium/auxiliary/tgsi/tgsi_build.h index f46f9b6307..ffea786770 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.h +++ b/src/gallium/auxiliary/tgsi/tgsi_build.h @@ -36,12 +36,6 @@ struct tgsi_token; extern "C" { #endif -/* - * version - */ - -struct tgsi_version -tgsi_build_version( void ); /* * header diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump.c b/src/gallium/auxiliary/tgsi/tgsi_dump.c index da126f3b01..d09ab92565 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump.c @@ -477,9 +477,6 @@ prolog( { struct dump_ctx *ctx = (struct dump_ctx *) iter; ENM( iter->processor.Processor, processor_type_names ); - UID( iter->version.Major ); - CHR( '.' ); - UID( iter->version.Minor ); EOL(); return TRUE; } diff --git a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c index 77b653330c..47fd1dd590 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_dump_c.c +++ b/src/gallium/auxiliary/tgsi/tgsi_dump_c.c @@ -405,12 +405,6 @@ tgsi_dump_c( TXT( "tgsi-dump begin -----------------" ); - TXT( "\nMajor: " ); - UID( parse.FullVersion.Version.Major ); - TXT( "\nMinor: " ); - UID( parse.FullVersion.Version.Minor ); - EOL(); - TXT( "\nHeaderSize: " ); UID( parse.FullHeader.Header.HeaderSize ); TXT( "\nBodySize : " ); diff --git a/src/gallium/auxiliary/tgsi/tgsi_iterate.c b/src/gallium/auxiliary/tgsi/tgsi_iterate.c index d88c2558d8..7b384f5e12 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_iterate.c +++ b/src/gallium/auxiliary/tgsi/tgsi_iterate.c @@ -39,7 +39,6 @@ tgsi_iterate_shader( return FALSE; ctx->processor = parse.FullHeader.Processor; - ctx->version = parse.FullVersion.Version; if (ctx->prolog) if (!ctx->prolog( ctx )) diff --git a/src/gallium/auxiliary/tgsi/tgsi_iterate.h b/src/gallium/auxiliary/tgsi/tgsi_iterate.h index ec7b85bf63..ef5a33ebce 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_iterate.h +++ b/src/gallium/auxiliary/tgsi/tgsi_iterate.h @@ -61,7 +61,6 @@ struct tgsi_iterate_context struct tgsi_iterate_context *ctx ); struct tgsi_processor processor; - struct tgsi_version version; }; boolean diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c index 4b252915c9..356b4473d9 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.c +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c @@ -35,21 +35,16 @@ tgsi_parse_init( struct tgsi_parse_context *ctx, const struct tgsi_token *tokens ) { - ctx->FullVersion.Version = *(struct tgsi_version *) &tokens[0]; - if( ctx->FullVersion.Version.Major > 1 ) { - return TGSI_PARSE_ERROR; - } - - ctx->FullHeader.Header = *(struct tgsi_header *) &tokens[1]; + ctx->FullHeader.Header = *(struct tgsi_header *) &tokens[0]; if( ctx->FullHeader.Header.HeaderSize >= 2 ) { - ctx->FullHeader.Processor = *(struct tgsi_processor *) &tokens[2]; + ctx->FullHeader.Processor = *(struct tgsi_processor *) &tokens[1]; } else { return TGSI_PARSE_ERROR; } ctx->Tokens = tokens; - ctx->Position = 1 + ctx->FullHeader.Header.HeaderSize; + ctx->Position = ctx->FullHeader.Header.HeaderSize; return TGSI_PARSE_OK; } diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.h b/src/gallium/auxiliary/tgsi/tgsi_parse.h index e9efa3fdd9..3aa1979a63 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.h +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.h @@ -34,11 +34,6 @@ extern "C" { #endif -struct tgsi_full_version -{ - struct tgsi_version Version; -}; - struct tgsi_full_header { struct tgsi_header Header; @@ -97,7 +92,6 @@ struct tgsi_parse_context { const struct tgsi_token *Tokens; unsigned Position; - struct tgsi_full_version FullVersion; struct tgsi_full_header FullHeader; union tgsi_full_token FullToken; }; diff --git a/src/gallium/auxiliary/tgsi/tgsi_text.c b/src/gallium/auxiliary/tgsi/tgsi_text.c index ca2e2bae11..eb376fa957 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_text.c +++ b/src/gallium/auxiliary/tgsi/tgsi_text.c @@ -172,29 +172,25 @@ static void report_error( struct translate_ctx *ctx, const char *msg ) /* Parse shader header. * Return TRUE for one of the following headers. - * FRAG1.1 - * GEOM1.1 - * VERT1.1 + * FRAG + * GEOM + * VERT */ static boolean parse_header( struct translate_ctx *ctx ) { uint processor; - if (str_match_no_case( &ctx->cur, "FRAG1.1" )) + if (str_match_no_case( &ctx->cur, "FRAG" )) processor = TGSI_PROCESSOR_FRAGMENT; - else if (str_match_no_case( &ctx->cur, "VERT1.1" )) + else if (str_match_no_case( &ctx->cur, "VERT" )) processor = TGSI_PROCESSOR_VERTEX; - else if (str_match_no_case( &ctx->cur, "GEOM1.1" )) + else if (str_match_no_case( &ctx->cur, "GEOM" )) processor = TGSI_PROCESSOR_GEOMETRY; else { report_error( ctx, "Unknown header" ); return FALSE; } - if (ctx->tokens_cur >= ctx->tokens_end) - return FALSE; - *(struct tgsi_version *) ctx->tokens_cur++ = tgsi_build_version(); - if (ctx->tokens_cur >= ctx->tokens_end) return FALSE; ctx->header = (struct tgsi_header *) ctx->tokens_cur++; diff --git a/src/gallium/auxiliary/tgsi/tgsi_transform.c b/src/gallium/auxiliary/tgsi/tgsi_transform.c index bc9c18fd4a..8b8f489b35 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_transform.c +++ b/src/gallium/auxiliary/tgsi/tgsi_transform.c @@ -130,15 +130,13 @@ tgsi_transform_shader(const struct tgsi_token *tokens_in, /** ** Setup output shader **/ - *(struct tgsi_version *) &tokens_out[0] = tgsi_build_version(); - - ctx->header = (struct tgsi_header *) (tokens_out + 1); + ctx->header = (struct tgsi_header *)tokens_out; *ctx->header = tgsi_build_header(); - processor = (struct tgsi_processor *) (tokens_out + 2); + processor = (struct tgsi_processor *) (tokens_out + 1); *processor = tgsi_build_processor( procType, ctx->header ); - ctx->ti = 3; + ctx->ti = 2; /** @@ -215,7 +213,7 @@ tgsi_transform_foo( struct tgsi_token *tokens_out, uint max_tokens_out ) { const char *text = - "FRAG1.1\n" + "FRAG\n" "DCL IN[0], COLOR, CONSTANT\n" "DCL OUT[0], COLOR\n" " 0: MOV OUT[0], IN[0]\n" diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 6d646a529a..7d860e89c1 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -37,7 +37,6 @@ #include "util/u_math.h" union tgsi_any_token { - struct tgsi_version version; struct tgsi_header header; struct tgsi_processor processor; struct tgsi_token token; @@ -1062,17 +1061,13 @@ fixup_header_size(struct ureg_program *ureg) static void emit_header( struct ureg_program *ureg ) { - union tgsi_any_token *out = get_tokens( ureg, DOMAIN_DECL, 3 ); - - out[0].version.Major = 1; - out[0].version.Minor = 1; - out[0].version.Padding = 0; + union tgsi_any_token *out = get_tokens( ureg, DOMAIN_DECL, 2 ); - out[1].header.HeaderSize = 2; - out[1].header.BodySize = 0; + out[0].header.HeaderSize = 2; + out[0].header.BodySize = 0; - out[2].processor.Processor = ureg->processor; - out[2].processor.Padding = 0; + out[1].processor.Processor = ureg->processor; + out[1].processor.Padding = 0; } -- cgit v1.2.3 From 72420daa21feffb3fefd60ba472c704c4558c5ba Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 27 Nov 2009 10:07:07 +0100 Subject: vl: Do not emit tgsi_version token. --- src/gallium/auxiliary/vl/vl_compositor.c | 14 ++++---- src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 42 ++++++++++-------------- 2 files changed, 24 insertions(+), 32 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index e31a46ba46..70ac3f2831 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -95,12 +95,11 @@ create_vert_shader(struct vl_compositor *c) assert(c); tokens = (struct tgsi_token*)MALLOC(max_tokens * sizeof(struct tgsi_token)); - *(struct tgsi_version*)&tokens[0] = tgsi_build_version(); - header = (struct tgsi_header*)&tokens[1]; + header = (struct tgsi_header*)&tokens[0]; *header = tgsi_build_header(); - *(struct tgsi_processor*)&tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_VERTEX, header); + *(struct tgsi_processor*)&tokens[1] = tgsi_build_processor(TGSI_PROCESSOR_VERTEX, header); - ti = 3; + ti = 2; /* * decl i0 ; Vertex pos @@ -172,12 +171,11 @@ create_frag_shader(struct vl_compositor *c) assert(c); tokens = (struct tgsi_token*)MALLOC(max_tokens * sizeof(struct tgsi_token)); - *(struct tgsi_version*)&tokens[0] = tgsi_build_version(); - header = (struct tgsi_header*)&tokens[1]; + header = (struct tgsi_header*)&tokens[0]; *header = tgsi_build_header(); - *(struct tgsi_processor*)&tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_FRAGMENT, header); + *(struct tgsi_processor*)&tokens[1] = tgsi_build_processor(TGSI_PROCESSOR_FRAGMENT, header); - ti = 3; + ti = 2; /* decl i0 ; Texcoords for s0 */ decl = vl_decl_interpolated_input(TGSI_SEMANTIC_GENERIC, 1, 0, 0, TGSI_INTERPOLATE_LINEAR); diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index 36a7987099..7d5ecbc73d 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -115,12 +115,11 @@ create_intra_vert_shader(struct vl_mpeg12_mc_renderer *r) assert(r); tokens = (struct tgsi_token *) malloc(max_tokens * sizeof(struct tgsi_token)); - *(struct tgsi_version *) &tokens[0] = tgsi_build_version(); - header = (struct tgsi_header *) &tokens[1]; + header = (struct tgsi_header *) &tokens[0]; *header = tgsi_build_header(); - *(struct tgsi_processor *) &tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_VERTEX, header); + *(struct tgsi_processor *) &tokens[1] = tgsi_build_processor(TGSI_PROCESSOR_VERTEX, header); - ti = 3; + ti = 2; /* * decl i0 ; Vertex pos @@ -185,12 +184,11 @@ create_intra_frag_shader(struct vl_mpeg12_mc_renderer *r) assert(r); tokens = (struct tgsi_token *) malloc(max_tokens * sizeof(struct tgsi_token)); - *(struct tgsi_version *) &tokens[0] = tgsi_build_version(); - header = (struct tgsi_header *) &tokens[1]; + header = (struct tgsi_header *) &tokens[0]; *header = tgsi_build_header(); - *(struct tgsi_processor *) &tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_FRAGMENT, header); + *(struct tgsi_processor *) &tokens[1] = tgsi_build_processor(TGSI_PROCESSOR_FRAGMENT, header); - ti = 3; + ti = 2; /* * decl i0 ; Luma texcoords @@ -278,12 +276,11 @@ create_frame_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) assert(r); tokens = (struct tgsi_token *) malloc(max_tokens * sizeof(struct tgsi_token)); - *(struct tgsi_version *) &tokens[0] = tgsi_build_version(); - header = (struct tgsi_header *) &tokens[1]; + header = (struct tgsi_header *) &tokens[0]; *header = tgsi_build_header(); - *(struct tgsi_processor *) &tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_VERTEX, header); + *(struct tgsi_processor *) &tokens[1] = tgsi_build_processor(TGSI_PROCESSOR_VERTEX, header); - ti = 3; + ti = 2; /* * decl i0 ; Vertex pos @@ -361,12 +358,11 @@ create_frame_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) assert(r); tokens = (struct tgsi_token *) malloc(max_tokens * sizeof(struct tgsi_token)); - *(struct tgsi_version *) &tokens[0] = tgsi_build_version(); - header = (struct tgsi_header *) &tokens[1]; + header = (struct tgsi_header *) &tokens[0]; *header = tgsi_build_header(); - *(struct tgsi_processor *) &tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_FRAGMENT, header); + *(struct tgsi_processor *) &tokens[1] = tgsi_build_processor(TGSI_PROCESSOR_FRAGMENT, header); - ti = 3; + ti = 2; /* * decl i0 ; Luma texcoords @@ -470,12 +466,11 @@ create_frame_bi_pred_vert_shader(struct vl_mpeg12_mc_renderer *r) assert(r); tokens = (struct tgsi_token *) malloc(max_tokens * sizeof(struct tgsi_token)); - *(struct tgsi_version *) &tokens[0] = tgsi_build_version(); - header = (struct tgsi_header *) &tokens[1]; + header = (struct tgsi_header *) &tokens[0]; *header = tgsi_build_header(); - *(struct tgsi_processor *) &tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_VERTEX, header); + *(struct tgsi_processor *) &tokens[1] = tgsi_build_processor(TGSI_PROCESSOR_VERTEX, header); - ti = 3; + ti = 2; /* * decl i0 ; Vertex pos @@ -561,12 +556,11 @@ create_frame_bi_pred_frag_shader(struct vl_mpeg12_mc_renderer *r) assert(r); tokens = (struct tgsi_token *) malloc(max_tokens * sizeof(struct tgsi_token)); - *(struct tgsi_version *) &tokens[0] = tgsi_build_version(); - header = (struct tgsi_header *) &tokens[1]; + header = (struct tgsi_header *) &tokens[0]; *header = tgsi_build_header(); - *(struct tgsi_processor *) &tokens[2] = tgsi_build_processor(TGSI_PROCESSOR_FRAGMENT, header); + *(struct tgsi_processor *) &tokens[1] = tgsi_build_processor(TGSI_PROCESSOR_FRAGMENT, header); - ti = 3; + ti = 2; /* * decl i0 ; Luma texcoords -- cgit v1.2.3 From 456b5bd5d0dbed172a5d8f88625eeb63fd87c8dd Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 27 Nov 2009 10:11:18 +0100 Subject: svga: Update text shader header. --- src/gallium/drivers/svga/svga_pipe_vs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_pipe_vs.c b/src/gallium/drivers/svga/svga_pipe_vs.c index e5ffe668c3..c104c41f5f 100644 --- a/src/gallium/drivers/svga/svga_pipe_vs.c +++ b/src/gallium/drivers/svga/svga_pipe_vs.c @@ -48,7 +48,7 @@ static const struct tgsi_token *substitute_vs( static struct tgsi_token tokens[300]; const char *text = - "VERT1.1\n" + "VERT\n" "DCL IN[0]\n" "DCL IN[1]\n" "DCL IN[2]\n" -- cgit v1.2.3 From 9a4e4e035c5e1ff1e84b4a332dfaa35c7fecf139 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 27 Nov 2009 10:13:19 +0100 Subject: python/tests: Update shader headers. Drop the 1.1 version suffix. --- src/gallium/state_trackers/python/samples/tri.py | 4 ++-- .../python/tests/regress/fragment-shader/frag-abs.sh | 2 +- .../python/tests/regress/fragment-shader/frag-add.sh | 2 +- .../python/tests/regress/fragment-shader/frag-dp3.sh | 2 +- .../python/tests/regress/fragment-shader/frag-dp4.sh | 2 +- .../python/tests/regress/fragment-shader/frag-dst.sh | 2 +- .../python/tests/regress/fragment-shader/frag-ex2.sh | 2 +- .../python/tests/regress/fragment-shader/frag-flr.sh | 2 +- .../python/tests/regress/fragment-shader/frag-frc.sh | 2 +- .../python/tests/regress/fragment-shader/frag-lg2.sh | 2 +- .../python/tests/regress/fragment-shader/frag-lit.sh | 2 +- .../python/tests/regress/fragment-shader/frag-lrp.sh | 2 +- .../python/tests/regress/fragment-shader/frag-mad.sh | 2 +- .../python/tests/regress/fragment-shader/frag-max.sh | 2 +- .../python/tests/regress/fragment-shader/frag-min.sh | 2 +- .../python/tests/regress/fragment-shader/frag-mov.sh | 2 +- .../python/tests/regress/fragment-shader/frag-mul.sh | 2 +- .../python/tests/regress/fragment-shader/frag-rcp.sh | 2 +- .../python/tests/regress/fragment-shader/frag-rsq.sh | 2 +- .../python/tests/regress/fragment-shader/frag-sge.sh | 2 +- .../python/tests/regress/fragment-shader/frag-srcmod-abs.sh | 2 +- .../python/tests/regress/fragment-shader/frag-srcmod-absneg.sh | 2 +- .../python/tests/regress/fragment-shader/frag-srcmod-neg.sh | 2 +- .../python/tests/regress/fragment-shader/frag-srcmod-swz.sh | 2 +- .../python/tests/regress/fragment-shader/frag-sub.sh | 2 +- .../python/tests/regress/fragment-shader/frag-xpd.sh | 2 +- .../python/tests/regress/fragment-shader/fragment-shader.py | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-abs.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-add.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-arl.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-arr.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-dp3.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-dp4.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-dst.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-ex2.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-flr.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-frc.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-lg2.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-lit.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-lrp.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-mad.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-max.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-min.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-mov.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-mul.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-rcp.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-rsq.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-sge.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-slt.sh | 2 +- .../python/tests/regress/vertex-shader/vert-srcmod-abs.sh | 2 +- .../python/tests/regress/vertex-shader/vert-srcmod-absneg.sh | 2 +- .../python/tests/regress/vertex-shader/vert-srcmod-neg.sh | 2 +- .../python/tests/regress/vertex-shader/vert-srcmod-swz.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-sub.sh | 2 +- .../state_trackers/python/tests/regress/vertex-shader/vert-xpd.sh | 2 +- .../python/tests/regress/vertex-shader/vertex-shader.py | 2 +- src/gallium/state_trackers/python/tests/texture_render.py | 4 ++-- src/gallium/state_trackers/python/tests/texture_sample.py | 8 ++++---- 58 files changed, 63 insertions(+), 63 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/python/samples/tri.py b/src/gallium/state_trackers/python/samples/tri.py index b721e0b575..87acf60366 100644 --- a/src/gallium/state_trackers/python/samples/tri.py +++ b/src/gallium/state_trackers/python/samples/tri.py @@ -159,7 +159,7 @@ def test(dev): # vertex shader vs = Shader(''' - VERT1.1 + VERT DCL IN[0], POSITION, CONSTANT DCL IN[1], COLOR, CONSTANT DCL OUT[0], POSITION, CONSTANT @@ -172,7 +172,7 @@ def test(dev): # fragment shader fs = Shader(''' - FRAG1.1 + FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR, CONSTANT 0:MOV OUT[0], IN[0] 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 index 7a0006bf66..103d7497f4 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index f7836c85dd..bcb9420596 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index c89cd748a8..b5281975d4 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index 6517e3c494..d59df76e70 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index 464880ba68..fbb20fa9f6 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index 2684076f1d..b511288f4b 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index ad11e28918..99a2f96103 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index 4f3aa30d66..a54c2623b0 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index 54c7c64459..5f5b4be109 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index 0e78ef86b5..6323c4712d 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index e9ee0f8147..740809d22e 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index 439acd5bbd..413b9dc391 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index ab21b245dd..b69f213261 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index 969ae73d98..df284f49e7 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index 612975e057..64af72f381 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index ed158b0fc6..bdd0b0026b 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index cc9feef07e..f4b611b26a 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index 695621fdc9..d1e9b0b53b 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index 9505bc3c3e..1f33fac472 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index 9cd4b68295..ecd19248c6 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index acd6aa750d..c2d99ddd15 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index ba1b61503b..a08ab6d2dc 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index 192aa7bb26..6110647d97 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index 83441fa820..673fca139a 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 index d6f66c4927..6ec8b1184c 100644 --- 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 @@ -1,4 +1,4 @@ -FRAG1.1 +FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR 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 d60fb38d1a..35673b3ec9 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 @@ -131,7 +131,7 @@ def test(dev, name): # vertex shader vs = Shader(''' - VERT1.1 + VERT DCL IN[0], POSITION DCL IN[1], COLOR DCL OUT[0], POSITION 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 f0d0d5de17..79c9ca69fb 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,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 936c851c9d..ca97ad05df 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,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 index 7638e96346..321140e89e 100644 --- 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 @@ -1,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL OUT[0], POSITION 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 index 28ce6f9a0c..d60ea46b36 100644 --- 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 @@ -1,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL OUT[0], POSITION 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 b57d68520f..caff622fe6 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,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 0eb31719c5..3dd2fd1c2f 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,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 index dc5e0eb92e..da9cc18dfc 100644 --- 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 @@ -1,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 index 34057af4e6..4637227e5c 100644 --- 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 @@ -1,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 index 44ad708119..aa80d6e394 100644 --- 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 @@ -1,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL OUT[0], POSITION 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 d179749de8..64d1a494e1 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,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL OUT[0], POSITION 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 index f6e08d087c..5cf16fd1aa 100644 --- 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 @@ -1,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 index da98f30928..a4a752d4d2 100644 --- 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 @@ -1,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 index 8c262580e2..4bb5f3ec3f 100644 --- 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 @@ -1,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 index eb07a3bd56..daaa941f15 100644 --- 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 @@ -1,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 index 2d8b1fe3bf..af279ec7f4 100644 --- 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 @@ -1,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 index 84af0e2905..46d886c55b 100644 --- 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 @@ -1,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 bcdec07c20..0ef91637e0 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,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 f3b57c3038..d34f6cd6e3 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,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 index 78af589b5c..cfb3ec37dc 100644 --- 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 @@ -1,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 index 1675c7d5ff..faf1e6e7d4 100644 --- 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 @@ -1,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 index 3d92cd5aae..6de1d071ef 100644 --- 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 @@ -1,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 index 85c60ff4ec..9a52422984 100644 --- 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 @@ -1,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 index 6db417a62e..dc87ce4ae7 100644 --- 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 @@ -1,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 index fc83238052..d82eb08fd3 100644 --- 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 @@ -1,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 index ce4e90b5e1..e39bebcd9f 100644 --- 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 @@ -1,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 c03de4c674..6f20552f21 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 @@ -1,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 a583b95828..0f9678b8a3 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,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 8def8943b0..39d42ae2a0 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,4 +1,4 @@ -VERT1.1 +VERT DCL IN[0], POSITION DCL IN[1], COLOR 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 472769f259..5be1ca80f3 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 @@ -135,7 +135,7 @@ def test(dev, name): # fragment shader fs = Shader(''' - FRAG1.1 + FRAG DCL IN[0], COLOR, LINEAR DCL OUT[0], COLOR, CONSTANT 0:MOV OUT[0], IN[0] diff --git a/src/gallium/state_trackers/python/tests/texture_render.py b/src/gallium/state_trackers/python/tests/texture_render.py index 0b76932b6e..8a2db9dbcf 100755 --- a/src/gallium/state_trackers/python/tests/texture_render.py +++ b/src/gallium/state_trackers/python/tests/texture_render.py @@ -171,7 +171,7 @@ class TextureTest(TestCase): # vertex shader vs = Shader(''' - VERT1.1 + VERT DCL IN[0], POSITION, CONSTANT DCL IN[1], GENERIC, CONSTANT DCL OUT[0], POSITION, CONSTANT @@ -185,7 +185,7 @@ class TextureTest(TestCase): # fragment shader fs = Shader(''' - FRAG1.1 + FRAG DCL IN[0], GENERIC[0], LINEAR DCL OUT[0], COLOR, CONSTANT DCL SAMP[0], CONSTANT diff --git a/src/gallium/state_trackers/python/tests/texture_sample.py b/src/gallium/state_trackers/python/tests/texture_sample.py index c7b78abbbe..92a6c4dfb9 100755 --- a/src/gallium/state_trackers/python/tests/texture_sample.py +++ b/src/gallium/state_trackers/python/tests/texture_sample.py @@ -216,7 +216,7 @@ class TextureColorSampleTest(TestCase): # vertex shader vs = Shader(''' - VERT1.1 + VERT DCL IN[0], POSITION, CONSTANT DCL IN[1], GENERIC, CONSTANT DCL OUT[0], POSITION, CONSTANT @@ -236,7 +236,7 @@ class TextureColorSampleTest(TestCase): PIPE_TEXTURE_CUBE: "CUBE", }[target] fs = Shader(''' - FRAG1.1 + FRAG DCL IN[0], GENERIC[0], LINEAR DCL OUT[0], COLOR, CONSTANT DCL SAMP[0], CONSTANT @@ -415,7 +415,7 @@ class TextureDepthSampleTest(TestCase): # vertex shader vs = Shader(''' - VERT1.1 + VERT DCL IN[0], POSITION, CONSTANT DCL IN[1], GENERIC, CONSTANT DCL OUT[0], POSITION, CONSTANT @@ -435,7 +435,7 @@ class TextureDepthSampleTest(TestCase): PIPE_TEXTURE_CUBE: "CUBE", }[target] fs = Shader(''' - FRAG1.1 + FRAG DCL IN[0], GENERIC[0], LINEAR DCL SAMP[0], CONSTANT DCL OUT[0].z, POSITION -- cgit v1.2.3 From 5285de7c0fc067dc036a5b421140a696ce2cabbf Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 27 Nov 2009 10:13:53 +0100 Subject: vega: Update shader headers. Drop the 1.1 version suffix. --- src/gallium/state_trackers/vega/asm_filters.h | 8 ++++---- src/gallium/state_trackers/vega/asm_util.h | 16 ++++++++-------- src/gallium/state_trackers/vega/shaders_cache.c | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/vega/asm_filters.h b/src/gallium/state_trackers/vega/asm_filters.h index 9a49f2e12d..60bed197e2 100644 --- a/src/gallium/state_trackers/vega/asm_filters.h +++ b/src/gallium/state_trackers/vega/asm_filters.h @@ -28,7 +28,7 @@ #define ASM_FILTERS_H static const char color_matrix_asm[] = - "FRAG1.1\n" + "FRAG\n" "DCL IN[0], GENERIC[0], PERSPECTIVE\n" "DCL OUT[0], COLOR, CONSTANT\n" "DCL CONST[0..4], CONSTANT\n" @@ -51,7 +51,7 @@ static const char color_matrix_asm[] = "END\n"; static const char convolution_asm[] = - "FRAG1.1\n" + "FRAG\n" "DCL IN[0], GENERIC[0], PERSPECTIVE\n" "DCL OUT[0], COLOR, CONSTANT\n" "DCL TEMP[0..4], CONSTANT\n" @@ -78,7 +78,7 @@ static const char convolution_asm[] = static const char lookup_asm[] = - "FRAG1.1\n" + "FRAG\n" "DCL IN[0], GENERIC[0], PERSPECTIVE\n" "DCL OUT[0], COLOR, CONSTANT\n" "DCL TEMP[0..2], CONSTANT\n" @@ -103,7 +103,7 @@ static const char lookup_asm[] = static const char lookup_single_asm[] = - "FRAG1.1\n" + "FRAG\n" "DCL IN[0], GENERIC[0], PERSPECTIVE\n" "DCL OUT[0], COLOR, CONSTANT\n" "DCL TEMP[0..2], CONSTANT\n" diff --git a/src/gallium/state_trackers/vega/asm_util.h b/src/gallium/state_trackers/vega/asm_util.h index 218e1d166d..903bfc88a4 100644 --- a/src/gallium/state_trackers/vega/asm_util.h +++ b/src/gallium/state_trackers/vega/asm_util.h @@ -29,7 +29,7 @@ static const char pass_through_depth_asm[] = - "FRAG1.1\n" + "FRAG\n" "DCL IN[0], POSITION, LINEAR\n" "DCL OUT[0].z, POSITION, CONSTANT\n" "0: MOV OUT[0].z, IN[0].zzzz\n" @@ -39,7 +39,7 @@ static const char pass_through_depth_asm[] = /* μnew = μmask */ static const char set_mask_asm[] = - "FRAG1.1\n" + "FRAG\n" "DCL IN[0], GENERIC[0], PERSPECTIVE\n" "DCL SAMP[0], CONSTANT\n" "DCL OUT[0], COLOR, CONSTANT\n" @@ -48,7 +48,7 @@ static const char set_mask_asm[] = /* μnew = 1 – (1 – μmask)*(1 – μprev) */ static const char union_mask_asm[] = - "FRAG1.1\n" + "FRAG\n" "DCL IN[0], GENERIC[0], PERSPECTIVE\n" "DCL IN[1], POSITION, LINEAR\n" "DCL CONST[0], CONSTANT\n" @@ -65,7 +65,7 @@ static const char union_mask_asm[] = /* μnew = μmask *μprev */ static const char intersect_mask_asm[] = - "FRAG1.1\n" + "FRAG\n" "DCL IN[0], GENERIC[0], PERSPECTIVE\n" "DCL IN[1], POSITION, LINEAR\n" "DCL CONST[0], CONSTANT\n" @@ -79,7 +79,7 @@ static const char intersect_mask_asm[] = /* μnew = μprev*(1 – μmask) */ static const char subtract_mask_asm[] = - "FRAG1.1\n" + "FRAG\n" "DCL IN[0], GENERIC[0], PERSPECTIVE\n" "DCL IN[1], POSITION, LINEAR\n" "DCL CONST[0], CONSTANT\n" @@ -94,7 +94,7 @@ static const char subtract_mask_asm[] = static const char vs_plain_asm[] = - "VERT1.1\n" + "VERT\n" "DCL IN[0]\n" "DCL OUT[0], POSITION\n" "DCL TEMP[0]\n" @@ -105,7 +105,7 @@ static const char vs_plain_asm[] = "3: END\n"; static const char vs_clear_asm[] = - "VERT1.1\n" + "VERT\n" "DCL IN[0]\n" "DCL IN[1]\n" "DCL OUT[0], POSITION\n" @@ -120,7 +120,7 @@ static const char vs_clear_asm[] = static const char vs_texture_asm[] = - "VERT1.1\n" + "VERT\n" "DCL IN[0]\n" "DCL IN[1]\n" "DCL OUT[0], POSITION\n" diff --git a/src/gallium/state_trackers/vega/shaders_cache.c b/src/gallium/state_trackers/vega/shaders_cache.c index fd0831fab1..f620075d0b 100644 --- a/src/gallium/state_trackers/vega/shaders_cache.c +++ b/src/gallium/state_trackers/vega/shaders_cache.c @@ -97,7 +97,7 @@ static INLINE struct tgsi_token *tokens_from_assembly(const char *txt, int num_t /* static const char max_shader_preamble[] = - "FRAG1.1\n" + "FRAG\n" "DCL IN[0], POSITION, LINEAR\n" "DCL IN[1], GENERIC[0], PERSPECTIVE\n" "DCL OUT[0], COLOR, CONSTANT\n" @@ -168,7 +168,7 @@ create_preamble(char *txt, --end_temp; --end_sampler; - sprintf(txt, "FRAG1.1\n"); + sprintf(txt, "FRAG\n"); if (declare_input) { sprintf(txt + strlen(txt), "DCL IN[0], POSITION, LINEAR\n"); -- cgit v1.2.3 From b911688b87a011eacf2034bd61562e633952a66b Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 27 Nov 2009 12:18:22 +0000 Subject: svga: add DEBUG_CACHE option --- src/gallium/drivers/svga/svga_debug.h | 1 + src/gallium/drivers/svga/svga_draw.c | 7 +++++++ src/gallium/drivers/svga/svga_pipe_blit.c | 8 +++++++ src/gallium/drivers/svga/svga_pipe_clear.c | 6 ++++++ src/gallium/drivers/svga/svga_pipe_flush.c | 3 +++ src/gallium/drivers/svga/svga_screen.c | 5 +++++ src/gallium/drivers/svga/svga_screen_buffer.c | 2 +- src/gallium/drivers/svga/svga_screen_cache.c | 30 ++++++++++++++++++++------- 8 files changed, 53 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_debug.h b/src/gallium/drivers/svga/svga_debug.h index b7bb5686ed..3a3fcd8fae 100644 --- a/src/gallium/drivers/svga/svga_debug.h +++ b/src/gallium/drivers/svga/svga_debug.h @@ -43,6 +43,7 @@ #define DEBUG_FLUSH 0x1000 /* flush after every draw */ #define DEBUG_SYNC 0x2000 /* sync after every flush */ #define DEBUG_QUERY 0x4000 +#define DEBUG_CACHE 0x8000 #ifdef DEBUG extern int SVGA_DEBUG; diff --git a/src/gallium/drivers/svga/svga_draw.c b/src/gallium/drivers/svga/svga_draw.c index 1b371cecc6..8db40d0fd5 100644 --- a/src/gallium/drivers/svga/svga_draw.c +++ b/src/gallium/drivers/svga/svga_draw.c @@ -29,10 +29,13 @@ #include "util/u_memory.h" #include "util/u_math.h" +#include "svga_context.h" #include "svga_draw.h" #include "svga_draw_private.h" +#include "svga_debug.h" #include "svga_screen.h" #include "svga_screen_buffer.h" +#include "svga_screen_texture.h" #include "svga_winsys.h" #include "svga_cmd.h" @@ -160,6 +163,10 @@ svga_hwtnl_flush( struct svga_hwtnl *hwtnl ) ib_handle[i] = handle; } + SVGA_DBG(DEBUG_DMA, "draw to sid %p, %d prims\n", + svga_surface(svga->curr.framebuffer.cbufs[0])->handle, + hwtnl->cmd.prim_count); + ret = SVGA3D_BeginDrawPrimitives(swc, &vdecl, hwtnl->cmd.vdecl_count, diff --git a/src/gallium/drivers/svga/svga_pipe_blit.c b/src/gallium/drivers/svga/svga_pipe_blit.c index 5a4a8c0f5f..4f575b06e6 100644 --- a/src/gallium/drivers/svga/svga_pipe_blit.c +++ b/src/gallium/drivers/svga/svga_pipe_blit.c @@ -25,6 +25,7 @@ #include "svga_screen_texture.h" #include "svga_context.h" +#include "svga_debug.h" #include "svga_cmd.h" #define FILE_DEBUG_FLAG DEBUG_BLIT @@ -43,6 +44,13 @@ static void svga_surface_copy(struct pipe_context *pipe, svga_hwtnl_flush_retry( svga ); + SVGA_DBG(DEBUG_DMA, "blit to sid %p (%d,%d), from sid %p (%d,%d) sz %dx%d\n", + svga_surface(dest)->handle, + destx, desty, + svga_surface(src)->handle, + srcx, srcy, + width, height); + ret = SVGA3D_BeginSurfaceCopy(svga->swc, src, dest, diff --git a/src/gallium/drivers/svga/svga_pipe_clear.c b/src/gallium/drivers/svga/svga_pipe_clear.c index 8977d26541..6195c3897e 100644 --- a/src/gallium/drivers/svga/svga_pipe_clear.c +++ b/src/gallium/drivers/svga/svga_pipe_clear.c @@ -24,12 +24,14 @@ **********************************************************/ #include "svga_cmd.h" +#include "svga_debug.h" #include "pipe/p_defines.h" #include "util/u_pack_color.h" #include "svga_context.h" #include "svga_state.h" +#include "svga_screen_texture.h" static enum pipe_error @@ -98,6 +100,10 @@ svga_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, { struct svga_context *svga = svga_context( pipe ); int ret; + + if (buffers & PIPE_CLEAR_COLOR) + SVGA_DBG(DEBUG_DMA, "clear sid %p\n", + svga_surface(svga->curr.framebuffer.cbufs[0])->handle); ret = try_clear( svga, buffers, rgba, depth, stencil ); diff --git a/src/gallium/drivers/svga/svga_pipe_flush.c b/src/gallium/drivers/svga/svga_pipe_flush.c index 942366de72..0becb0765a 100644 --- a/src/gallium/drivers/svga/svga_pipe_flush.c +++ b/src/gallium/drivers/svga/svga_pipe_flush.c @@ -59,6 +59,9 @@ static void svga_flush( struct pipe_context *pipe, /* Flush command queue. */ svga_context_flush(svga, fence); + + SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "%s flags %x fence_ptr %p\n", + __FUNCTION__, flags, fence ? *fence : 0x0); } diff --git a/src/gallium/drivers/svga/svga_screen.c b/src/gallium/drivers/svga/svga_screen.c index 3afcaffff5..fc1b3c980e 100644 --- a/src/gallium/drivers/svga/svga_screen.c +++ b/src/gallium/drivers/svga/svga_screen.c @@ -57,6 +57,7 @@ static const struct debug_named_value svga_debug_flags[] = { { "perf", DEBUG_PERF }, { "flush", DEBUG_FLUSH }, { "sync", DEBUG_SYNC }, + { "cache", DEBUG_CACHE }, {NULL, 0} }; #endif @@ -297,6 +298,10 @@ svga_fence_finish(struct pipe_screen *screen, unsigned flag) { struct svga_winsys_screen *sws = svga_screen(screen)->sws; + + SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "%s fence_ptr %p\n", + __FUNCTION__, fence); + return sws->fence_finish(sws, fence, flag); } diff --git a/src/gallium/drivers/svga/svga_screen_buffer.c b/src/gallium/drivers/svga/svga_screen_buffer.c index c0b0f518bc..1f8a889672 100644 --- a/src/gallium/drivers/svga/svga_screen_buffer.c +++ b/src/gallium/drivers/svga/svga_screen_buffer.c @@ -447,7 +447,7 @@ svga_buffer_map_range( struct pipe_screen *screen, enum pipe_error ret; struct pipe_fence_handle *fence = NULL; - SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "dma from sid %p, bytes %u - %u\n", + SVGA_DBG(DEBUG_DMA|DEBUG_PERF, "dma from sid %p (buffer), bytes %u - %u\n", sbuf->handle, 0, sbuf->base.size); memset(&flags, 0, sizeof flags); diff --git a/src/gallium/drivers/svga/svga_screen_cache.c b/src/gallium/drivers/svga/svga_screen_cache.c index 689981cc6d..8a06383f61 100644 --- a/src/gallium/drivers/svga/svga_screen_cache.c +++ b/src/gallium/drivers/svga/svga_screen_cache.c @@ -134,7 +134,8 @@ svga_screen_cache_add(struct svga_screen *svgascreen, else if(!LIST_IS_EMPTY(&cache->unused)) { /* free the last used buffer and reuse its entry */ entry = LIST_ENTRY(struct svga_host_surface_cache_entry, cache->unused.prev, head); - SVGA_DBG(DEBUG_DMA, "unref sid %p (make space)\n", entry->handle); + SVGA_DBG(DEBUG_CACHE|DEBUG_DMA, + "unref sid %p (make space)\n", entry->handle); sws->surface_reference(sws, &entry->handle, NULL); LIST_DEL(&entry->bucket_head); @@ -146,11 +147,14 @@ svga_screen_cache_add(struct svga_screen *svgascreen, entry->handle = handle; memcpy(&entry->key, key, sizeof entry->key); + SVGA_DBG(DEBUG_CACHE|DEBUG_DMA, + "cache sid %p\n", entry->handle); LIST_ADD(&entry->head, &cache->validated); } else { /* Couldn't cache the buffer -- this really shouldn't happen */ - SVGA_DBG(DEBUG_DMA, "unref sid %p (couldn't find space)\n", handle); + SVGA_DBG(DEBUG_CACHE|DEBUG_DMA, + "unref sid %p (couldn't find space)\n", handle); sws->surface_reference(sws, &handle, NULL); } @@ -209,7 +213,8 @@ svga_screen_cache_cleanup(struct svga_screen *svgascreen) for(i = 0; i < SVGA_HOST_SURFACE_CACHE_SIZE; ++i) { if(cache->entries[i].handle) { - SVGA_DBG(DEBUG_DMA, "unref sid %p (shutdown)\n", cache->entries[i].handle); + SVGA_DBG(DEBUG_CACHE|DEBUG_DMA, + "unref sid %p (shutdown)\n", cache->entries[i].handle); sws->surface_reference(sws, &cache->entries[i].handle, NULL); } @@ -252,7 +257,8 @@ svga_screen_surface_create(struct svga_screen *svgascreen, struct svga_winsys_surface *handle = NULL; boolean cachable = SVGA_SURFACE_CACHE_ENABLED && key->cachable; - SVGA_DBG(DEBUG_DMA, "%s sz %dx%dx%d mips %d faces %d cachable %d\n", + SVGA_DBG(DEBUG_CACHE|DEBUG_DMA, + "%s sz %dx%dx%d mips %d faces %d cachable %d\n", __FUNCTION__, key->size.width, key->size.height, @@ -276,10 +282,12 @@ svga_screen_surface_create(struct svga_screen *svgascreen, handle = svga_screen_cache_lookup(svgascreen, key); if (handle) { if (key->format == SVGA3D_BUFFER) - SVGA_DBG(DEBUG_DMA, " reuse sid %p sz %d (buffer)\n", handle, + SVGA_DBG(DEBUG_CACHE|DEBUG_DMA, + "reuse sid %p sz %d (buffer)\n", handle, key->size.width); else - SVGA_DBG(DEBUG_DMA, " reuse sid %p sz %dx%dx%d mips %d faces %d\n", handle, + SVGA_DBG(DEBUG_CACHE|DEBUG_DMA, + "reuse sid %p sz %dx%dx%d mips %d faces %d\n", handle, key->size.width, key->size.height, key->size.depth, @@ -296,7 +304,12 @@ svga_screen_surface_create(struct svga_screen *svgascreen, key->numFaces, key->numMipLevels); if (handle) - SVGA_DBG(DEBUG_DMA, "create sid %p sz %d\n", handle, key->size); + SVGA_DBG(DEBUG_CACHE|DEBUG_DMA, + " CREATE sid %p sz %dx%dx%d\n", + handle, + key->size.width, + key->size.height, + key->size.depth); } return handle; @@ -318,7 +331,8 @@ svga_screen_surface_destroy(struct svga_screen *svgascreen, svga_screen_cache_add(svgascreen, key, p_handle); } else { - SVGA_DBG(DEBUG_DMA, "unref sid %p (uncachable)\n", *p_handle); + SVGA_DBG(DEBUG_DMA, + "unref sid %p (uncachable)\n", *p_handle); sws->surface_reference(sws, p_handle, NULL); } } -- cgit v1.2.3 From b84b7f19dfdc0ac02175847065b39110db7ad98f Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 27 Nov 2009 12:19:28 +0000 Subject: svga: flush our command buffer after the 8th distinct render target This helps improve the surface cache behaviour in the face of the large number of single-use render targets generated by EXA and the xorg state tracker. Without this we can reference hundreds of individual render targets from a command buffer, which leaves little scope for sharing or reuse of those targets. Flushing early means we can start reusing textures much sooner. This shouldn't have much effect on normal 3d rendering as it's pretty rare to have a command buffer with >8 different render targets in that world. --- src/gallium/drivers/svga/svga_context.c | 4 +++- src/gallium/drivers/svga/svga_context.h | 5 +++++ src/gallium/drivers/svga/svga_state_framebuffer.c | 3 +++ 3 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_context.c b/src/gallium/drivers/svga/svga_context.c index 73233957f3..c3de12b4a3 100644 --- a/src/gallium/drivers/svga/svga_context.c +++ b/src/gallium/drivers/svga/svga_context.c @@ -230,7 +230,9 @@ void svga_context_flush( struct svga_context *svga, struct pipe_fence_handle **pfence ) { struct svga_screen *svgascreen = svga_screen(svga->pipe.screen); - + + svga->curr.nr_fbs = 0; + /* Unmap upload manager buffers: */ u_upload_flush(svga->upload_vb); diff --git a/src/gallium/drivers/svga/svga_context.h b/src/gallium/drivers/svga/svga_context.h index 9a3e92fd8d..e650a251d1 100644 --- a/src/gallium/drivers/svga/svga_context.h +++ b/src/gallium/drivers/svga/svga_context.h @@ -191,6 +191,11 @@ struct svga_state struct pipe_framebuffer_state framebuffer; float depthscale; + /* Hack to limit the number of different render targets between + * flushes. Helps avoid blowing out our surface cache in EXA. + */ + int nr_fbs; + struct pipe_poly_stipple poly_stipple; struct pipe_scissor_state scissor; struct pipe_blend_color blend_color; diff --git a/src/gallium/drivers/svga/svga_state_framebuffer.c b/src/gallium/drivers/svga/svga_state_framebuffer.c index 7d7f93d8e3..cfdcae4ee4 100644 --- a/src/gallium/drivers/svga/svga_state_framebuffer.c +++ b/src/gallium/drivers/svga/svga_state_framebuffer.c @@ -54,6 +54,9 @@ static int emit_framebuffer( struct svga_context *svga, for(i = 0; i < PIPE_MAX_COLOR_BUFS; ++i) { if (curr->cbufs[i] != hw->cbufs[i]) { + if (svga->curr.nr_fbs++ > 8) + return PIPE_ERROR_OUT_OF_MEMORY; + ret = SVGA3D_SetRenderTarget(svga->swc, SVGA3D_RT_COLOR0 + i, curr->cbufs[i]); if (ret != PIPE_OK) return ret; -- cgit v1.2.3 From e595dd4c179efe06183b8efb430ec6c8845dfd0b Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 27 Nov 2009 12:22:43 +0000 Subject: st/xorg: free last fence --- src/gallium/state_trackers/xorg/xorg_driver.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 4c66354ad4..1291591298 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -466,6 +466,10 @@ static void drv_block_handler(int i, pointer blockData, pointer pTimeout, ms->screen->fence_reference(ms->screen, &ms->fence[j], ms->fence[j+1]); + + ms->screen->fence_reference(ms->screen, + &ms->fence[XORG_NR_FENCES-1], + NULL); } -- cgit v1.2.3 From cf3cdda5cc413093126c7ba42248c3b175a2d126 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 27 Nov 2009 12:24:42 +0000 Subject: st/xorg: speculatively round textures up to nearest POT I'm not sure if this is a great change, but helps with caching. Probably we want to turn this on/off on a driver-by-driver basis. --- src/gallium/state_trackers/xorg/xorg_exa.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 9a7384da88..a22f15f64a 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -44,6 +44,8 @@ #include "pipe/p_inlines.h" #include "util/u_rect.h" +#include "util/u_math.h" +#include "util/u_debug.h" #define DEBUG_PRINT 0 @@ -831,6 +833,17 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, if (!priv || pPixData) return FALSE; + if (0) { + debug_printf("%s pixmap %p sz %dx%dx%d devKind %d\n", + __FUNCTION__, pPixmap, width, height, bitsPerPixel, devKind); + + if (priv->tex) + debug_printf(" ==> old texture %dx%d\n", + priv->tex->width[0], + priv->tex->height[0]); + } + + if (depth <= 0) depth = pPixmap->drawable.depth; @@ -862,8 +875,13 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, template.target = PIPE_TEXTURE_2D; exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &priv->picture_format); pf_get_block(template.format, &template.block); +#if 1 + template.width[0] = util_next_power_of_two(width); + template.height[0] = util_next_power_of_two(height); +#else template.width[0] = width; template.height[0] = height; +#endif template.depth[0] = 1; template.last_level = 0; template.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET | priv->flags; -- cgit v1.2.3 From 178407f33c413cbe7434597b2129abde90041b6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 24 Nov 2009 14:37:45 +0000 Subject: svga: Use consistent file names for dumping facilities. --- src/gallium/drivers/svga/Makefile | 4 +- src/gallium/drivers/svga/SConscript | 4 +- src/gallium/drivers/svga/svga_tgsi.c | 2 +- src/gallium/drivers/svga/svgadump/st_shader.h | 214 ------- src/gallium/drivers/svga/svgadump/st_shader_dump.c | 649 --------------------- src/gallium/drivers/svga/svgadump/st_shader_dump.h | 42 -- src/gallium/drivers/svga/svgadump/st_shader_op.c | 168 ------ src/gallium/drivers/svga/svgadump/st_shader_op.h | 46 -- src/gallium/drivers/svga/svgadump/svga_dump.c | 2 +- src/gallium/drivers/svga/svgadump/svga_dump.py | 2 +- src/gallium/drivers/svga/svgadump/svga_shader.h | 214 +++++++ .../drivers/svga/svgadump/svga_shader_dump.c | 649 +++++++++++++++++++++ .../drivers/svga/svgadump/svga_shader_dump.h | 42 ++ src/gallium/drivers/svga/svgadump/svga_shader_op.c | 168 ++++++ src/gallium/drivers/svga/svgadump/svga_shader_op.h | 46 ++ 15 files changed, 1126 insertions(+), 1126 deletions(-) delete mode 100644 src/gallium/drivers/svga/svgadump/st_shader.h delete mode 100644 src/gallium/drivers/svga/svgadump/st_shader_dump.c delete mode 100644 src/gallium/drivers/svga/svgadump/st_shader_dump.h delete mode 100644 src/gallium/drivers/svga/svgadump/st_shader_op.c delete mode 100644 src/gallium/drivers/svga/svgadump/st_shader_op.h create mode 100644 src/gallium/drivers/svga/svgadump/svga_shader.h create mode 100644 src/gallium/drivers/svga/svgadump/svga_shader_dump.c create mode 100644 src/gallium/drivers/svga/svgadump/svga_shader_dump.h create mode 100644 src/gallium/drivers/svga/svgadump/svga_shader_op.c create mode 100644 src/gallium/drivers/svga/svgadump/svga_shader_op.h (limited to 'src') diff --git a/src/gallium/drivers/svga/Makefile b/src/gallium/drivers/svga/Makefile index 8158364d25..f361908187 100644 --- a/src/gallium/drivers/svga/Makefile +++ b/src/gallium/drivers/svga/Makefile @@ -4,8 +4,8 @@ include $(TOP)/configs/current LIBNAME = svga C_SOURCES = \ - svgadump/st_shader_dump.c \ - svgadump/st_shader_op.c \ + svgadump/svga_shader_dump.c \ + svgadump/svga_shader_op.c \ svgadump/svga_dump.c \ svga_cmd.c \ svga_context.c \ diff --git a/src/gallium/drivers/svga/SConscript b/src/gallium/drivers/svga/SConscript index ff9645fc03..737b791ceb 100644 --- a/src/gallium/drivers/svga/SConscript +++ b/src/gallium/drivers/svga/SConscript @@ -60,8 +60,8 @@ sources = [ 'svga_tgsi_insn.c', 'svgadump/svga_dump.c', - 'svgadump/st_shader_dump.c', - 'svgadump/st_shader_op.c', + 'svgadump/svga_shader_dump.c', + 'svgadump/svga_shader_op.c', ] svga = env.ConvenienceLibrary( diff --git a/src/gallium/drivers/svga/svga_tgsi.c b/src/gallium/drivers/svga/svga_tgsi.c index 44d0930bc0..81eea1a145 100644 --- a/src/gallium/drivers/svga/svga_tgsi.c +++ b/src/gallium/drivers/svga/svga_tgsi.c @@ -32,7 +32,7 @@ #include "tgsi/tgsi_scan.h" #include "util/u_memory.h" -#include "svgadump/st_shader_dump.h" +#include "svgadump/svga_shader_dump.h" #include "svga_context.h" #include "svga_tgsi.h" diff --git a/src/gallium/drivers/svga/svgadump/st_shader.h b/src/gallium/drivers/svga/svgadump/st_shader.h deleted file mode 100644 index 2fc1796a90..0000000000 --- a/src/gallium/drivers/svga/svgadump/st_shader.h +++ /dev/null @@ -1,214 +0,0 @@ -/********************************************************** - * Copyright 2007-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, 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. - * - **********************************************************/ - -/** - * @file - * SVGA Shader Token Definitions - * - * @author Michal Krol - */ - -#ifndef ST_SHADER_SVGA_H -#define ST_SHADER_SVGA_H - -#include "pipe/p_compiler.h" - -struct sh_op -{ - unsigned opcode:16; - unsigned control:8; - unsigned length:4; - unsigned predicated:1; - unsigned unused:1; - unsigned coissue:1; - unsigned is_reg:1; -}; - -struct sh_reg -{ - unsigned number:11; - unsigned type_hi:2; - unsigned relative:1; - unsigned unused:14; - unsigned type_lo:3; - unsigned is_reg:1; -}; - -static INLINE unsigned -sh_reg_type( struct sh_reg reg ) -{ - return reg.type_lo | (reg.type_hi << 3); -} - -struct sh_cdata -{ - float xyzw[4]; -}; - -struct sh_def -{ - struct sh_op op; - struct sh_reg reg; - struct sh_cdata cdata; -}; - -struct sh_defb -{ - struct sh_op op; - struct sh_reg reg; - uint data; -}; - -struct sh_idata -{ - int xyzw[4]; -}; - -struct sh_defi -{ - struct sh_op op; - struct sh_reg reg; - struct sh_idata idata; -}; - -#define PS_TEXTURETYPE_UNKNOWN SVGA3DSAMP_UNKNOWN -#define PS_TEXTURETYPE_2D SVGA3DSAMP_2D -#define PS_TEXTURETYPE_CUBE SVGA3DSAMP_CUBE -#define PS_TEXTURETYPE_VOLUME SVGA3DSAMP_VOLUME - -struct ps_sampleinfo -{ - unsigned unused:27; - unsigned texture_type:4; - unsigned is_reg:1; -}; - -struct vs_semantic -{ - unsigned usage:5; - unsigned unused1:11; - unsigned usage_index:4; - unsigned unused2:12; -}; - -struct sh_dstreg -{ - unsigned number:11; - unsigned type_hi:2; - unsigned relative:1; - unsigned unused:2; - unsigned write_mask:4; - unsigned modifier:4; - unsigned shift_scale:4; - unsigned type_lo:3; - unsigned is_reg:1; -}; - -static INLINE unsigned -sh_dstreg_type( struct sh_dstreg reg ) -{ - return reg.type_lo | (reg.type_hi << 3); -} - -struct sh_dcl -{ - struct sh_op op; - union { - struct { - struct ps_sampleinfo sampleinfo; - } ps; - struct { - struct vs_semantic semantic; - } vs; - } u; - struct sh_dstreg reg; -}; - - -struct sh_srcreg -{ - unsigned number:11; - unsigned type_hi:2; - unsigned relative:1; - unsigned unused:2; - unsigned swizzle_x:2; - unsigned swizzle_y:2; - unsigned swizzle_z:2; - unsigned swizzle_w:2; - unsigned modifier:4; - unsigned type_lo:3; - unsigned is_reg:1; -}; - -static INLINE unsigned -sh_srcreg_type( struct sh_srcreg reg ) -{ - return reg.type_lo | (reg.type_hi << 3); -} - -struct sh_dstop -{ - struct sh_op op; - struct sh_dstreg dst; -}; - -struct sh_srcop -{ - struct sh_op op; - struct sh_srcreg src; -}; - -struct sh_src2op -{ - struct sh_op op; - struct sh_srcreg src0; - struct sh_srcreg src1; -}; - -struct sh_unaryop -{ - struct sh_op op; - struct sh_dstreg dst; - struct sh_srcreg src; -}; - -struct sh_binaryop -{ - struct sh_op op; - struct sh_dstreg dst; - struct sh_srcreg src0; - struct sh_srcreg src1; -}; - -struct sh_trinaryop -{ - struct sh_op op; - struct sh_dstreg dst; - struct sh_srcreg src0; - struct sh_srcreg src1; - struct sh_srcreg src2; -}; - -#endif /* ST_SHADER_SVGA_H */ diff --git a/src/gallium/drivers/svga/svgadump/st_shader_dump.c b/src/gallium/drivers/svga/svgadump/st_shader_dump.c deleted file mode 100644 index d65cc93bfd..0000000000 --- a/src/gallium/drivers/svga/svgadump/st_shader_dump.c +++ /dev/null @@ -1,649 +0,0 @@ -/********************************************************** - * Copyright 2008-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, 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. - * - **********************************************************/ - -/** - * @file - * SVGA Shader Dump Facilities - * - * @author Michal Krol - */ - -#include "st_shader.h" -#include "st_shader_dump.h" -#include "st_shader_op.h" -#include "util/u_debug.h" - -#include "../svga_hw_reg.h" -#include "svga3d_shaderdefs.h" - -struct dump_info -{ - SVGA3dShaderVersion version; - boolean is_ps; -}; - -static void dump_op( struct sh_op op, const char *mnemonic ) -{ - assert( op.predicated == 0 ); - assert( op.is_reg == 0 ); - - if (op.coissue) - debug_printf( "+" ); - debug_printf( "%s", mnemonic ); - switch (op.control) { - case 0: - break; - case SVGA3DOPCONT_PROJECT: - debug_printf( "p" ); - break; - case SVGA3DOPCONT_BIAS: - debug_printf( "b" ); - break; - default: - assert( 0 ); - } -} - - -static void dump_comp_op( struct sh_op op, const char *mnemonic ) -{ - assert( op.is_reg == 0 ); - - if (op.coissue) - debug_printf( "+" ); - debug_printf( "%s", mnemonic ); - switch (op.control) { - case SVGA3DOPCOMP_RESERVED0: - break; - case SVGA3DOPCOMP_GT: - debug_printf("_gt"); - break; - case SVGA3DOPCOMP_EQ: - debug_printf("_eq"); - break; - case SVGA3DOPCOMP_GE: - debug_printf("_ge"); - break; - case SVGA3DOPCOMP_LT: - debug_printf("_lt"); - break; - case SVGA3DOPCOMPC_NE: - debug_printf("_ne"); - break; - case SVGA3DOPCOMP_LE: - debug_printf("_le"); - break; - case SVGA3DOPCOMP_RESERVED1: - default: - assert( 0 ); - } -} - - -static void dump_reg( struct sh_reg reg, struct sh_srcreg *indreg, const struct dump_info *di ) -{ - assert( sh_reg_type( reg ) == SVGA3DREG_CONST || reg.relative == 0 ); - assert( reg.is_reg == 1 ); - - switch (sh_reg_type( reg )) { - case SVGA3DREG_TEMP: - debug_printf( "r%u", reg.number ); - break; - - case SVGA3DREG_INPUT: - debug_printf( "v%u", reg.number ); - break; - - case SVGA3DREG_CONST: - if (reg.relative) { - if (sh_srcreg_type( *indreg ) == SVGA3DREG_LOOP) - debug_printf( "c[aL+%u]", reg.number ); - else - debug_printf( "c[a%u.x+%u]", indreg->number, reg.number ); - } - else - debug_printf( "c%u", reg.number ); - break; - - case SVGA3DREG_ADDR: /* VS */ - /* SVGA3DREG_TEXTURE */ /* PS */ - if (di->is_ps) - debug_printf( "t%u", reg.number ); - else - debug_printf( "a%u", reg.number ); - break; - - case SVGA3DREG_RASTOUT: - switch (reg.number) { - case 0 /*POSITION*/: - debug_printf( "oPos" ); - break; - case 1 /*FOG*/: - debug_printf( "oFog" ); - break; - case 2 /*POINT_SIZE*/: - debug_printf( "oPts" ); - break; - default: - assert( 0 ); - debug_printf( "???" ); - } - break; - - case SVGA3DREG_ATTROUT: - assert( reg.number < 2 ); - debug_printf( "oD%u", reg.number ); - break; - - case SVGA3DREG_TEXCRDOUT: - /* SVGA3DREG_OUTPUT */ - debug_printf( "oT%u", reg.number ); - break; - - case SVGA3DREG_COLOROUT: - debug_printf( "oC%u", reg.number ); - break; - - case SVGA3DREG_DEPTHOUT: - debug_printf( "oD%u", reg.number ); - break; - - case SVGA3DREG_SAMPLER: - debug_printf( "s%u", reg.number ); - break; - - case SVGA3DREG_CONSTBOOL: - assert( !reg.relative ); - debug_printf( "b%u", reg.number ); - break; - - case SVGA3DREG_CONSTINT: - assert( !reg.relative ); - debug_printf( "i%u", reg.number ); - break; - - case SVGA3DREG_LOOP: - assert( reg.number == 0 ); - debug_printf( "aL" ); - break; - - case SVGA3DREG_MISCTYPE: - switch (reg.number) { - case SVGA3DMISCREG_POSITION: - debug_printf( "vPos" ); - break; - case SVGA3DMISCREG_FACE: - debug_printf( "vFace" ); - break; - default: - assert(0); - break; - } - break; - - case SVGA3DREG_LABEL: - debug_printf( "l%u", reg.number ); - break; - - case SVGA3DREG_PREDICATE: - debug_printf( "p%u", reg.number ); - break; - - - default: - assert( 0 ); - debug_printf( "???" ); - } -} - -static void dump_cdata( struct sh_cdata cdata ) -{ - debug_printf( "%f, %f, %f, %f", cdata.xyzw[0], cdata.xyzw[1], cdata.xyzw[2], cdata.xyzw[3] ); -} - -static void dump_idata( struct sh_idata idata ) -{ - debug_printf( "%d, %d, %d, %d", idata.xyzw[0], idata.xyzw[1], idata.xyzw[2], idata.xyzw[3] ); -} - -static void dump_bdata( boolean bdata ) -{ - debug_printf( bdata ? "TRUE" : "FALSE" ); -} - -static void dump_sampleinfo( struct ps_sampleinfo sampleinfo ) -{ - switch (sampleinfo.texture_type) { - case SVGA3DSAMP_2D: - debug_printf( "_2d" ); - break; - case SVGA3DSAMP_CUBE: - debug_printf( "_cube" ); - break; - case SVGA3DSAMP_VOLUME: - debug_printf( "_volume" ); - break; - default: - assert( 0 ); - } -} - - -static void dump_usageinfo( struct vs_semantic semantic ) -{ - switch (semantic.usage) { - case SVGA3D_DECLUSAGE_POSITION: - debug_printf("_position" ); - break; - case SVGA3D_DECLUSAGE_BLENDWEIGHT: - debug_printf("_blendweight" ); - break; - case SVGA3D_DECLUSAGE_BLENDINDICES: - debug_printf("_blendindices" ); - break; - case SVGA3D_DECLUSAGE_NORMAL: - debug_printf("_normal" ); - break; - case SVGA3D_DECLUSAGE_PSIZE: - debug_printf("_psize" ); - break; - case SVGA3D_DECLUSAGE_TEXCOORD: - debug_printf("_texcoord"); - break; - case SVGA3D_DECLUSAGE_TANGENT: - debug_printf("_tangent" ); - break; - case SVGA3D_DECLUSAGE_BINORMAL: - debug_printf("_binormal" ); - break; - case SVGA3D_DECLUSAGE_TESSFACTOR: - debug_printf("_tessfactor" ); - break; - case SVGA3D_DECLUSAGE_POSITIONT: - debug_printf("_positiont" ); - break; - case SVGA3D_DECLUSAGE_COLOR: - debug_printf("_color" ); - break; - case SVGA3D_DECLUSAGE_FOG: - debug_printf("_fog" ); - break; - case SVGA3D_DECLUSAGE_DEPTH: - debug_printf("_depth" ); - break; - case SVGA3D_DECLUSAGE_SAMPLE: - debug_printf("_sample"); - break; - default: - assert( 0 ); - return; - } - - if (semantic.usage_index != 0) { - debug_printf("%d", semantic.usage_index ); - } -} - -static void dump_dstreg( struct sh_dstreg dstreg, const struct dump_info *di ) -{ - union { - struct sh_reg reg; - struct sh_dstreg dstreg; - } u; - - assert( (dstreg.modifier & (SVGA3DDSTMOD_SATURATE | SVGA3DDSTMOD_PARTIALPRECISION)) == dstreg.modifier ); - - if (dstreg.modifier & SVGA3DDSTMOD_SATURATE) - debug_printf( "_sat" ); - if (dstreg.modifier & SVGA3DDSTMOD_PARTIALPRECISION) - debug_printf( "_pp" ); - switch (dstreg.shift_scale) { - case 0: - break; - case 1: - debug_printf( "_x2" ); - break; - case 2: - debug_printf( "_x4" ); - break; - case 3: - debug_printf( "_x8" ); - break; - case 13: - debug_printf( "_d8" ); - break; - case 14: - debug_printf( "_d4" ); - break; - case 15: - debug_printf( "_d2" ); - break; - default: - assert( 0 ); - } - debug_printf( " " ); - - u.dstreg = dstreg; - dump_reg( u.reg, NULL, di ); - if (dstreg.write_mask != SVGA3DWRITEMASK_ALL) { - debug_printf( "." ); - if (dstreg.write_mask & SVGA3DWRITEMASK_0) - debug_printf( "x" ); - if (dstreg.write_mask & SVGA3DWRITEMASK_1) - debug_printf( "y" ); - if (dstreg.write_mask & SVGA3DWRITEMASK_2) - debug_printf( "z" ); - if (dstreg.write_mask & SVGA3DWRITEMASK_3) - debug_printf( "w" ); - } -} - -static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, const struct dump_info *di ) -{ - union { - struct sh_reg reg; - struct sh_srcreg srcreg; - } u; - - switch (srcreg.modifier) { - case SVGA3DSRCMOD_NEG: - case SVGA3DSRCMOD_BIASNEG: - case SVGA3DSRCMOD_SIGNNEG: - case SVGA3DSRCMOD_X2NEG: - debug_printf( "-" ); - break; - case SVGA3DSRCMOD_ABS: - debug_printf( "|" ); - break; - case SVGA3DSRCMOD_ABSNEG: - debug_printf( "-|" ); - break; - case SVGA3DSRCMOD_COMP: - debug_printf( "1-" ); - break; - case SVGA3DSRCMOD_NOT: - debug_printf( "!" ); - } - - u.srcreg = srcreg; - dump_reg( u.reg, indreg, di ); - switch (srcreg.modifier) { - case SVGA3DSRCMOD_NONE: - case SVGA3DSRCMOD_NEG: - case SVGA3DSRCMOD_COMP: - case SVGA3DSRCMOD_NOT: - break; - case SVGA3DSRCMOD_ABS: - case SVGA3DSRCMOD_ABSNEG: - debug_printf( "|" ); - break; - case SVGA3DSRCMOD_BIAS: - case SVGA3DSRCMOD_BIASNEG: - debug_printf( "_bias" ); - break; - case SVGA3DSRCMOD_SIGN: - case SVGA3DSRCMOD_SIGNNEG: - debug_printf( "_bx2" ); - break; - case SVGA3DSRCMOD_X2: - case SVGA3DSRCMOD_X2NEG: - debug_printf( "_x2" ); - break; - case SVGA3DSRCMOD_DZ: - debug_printf( "_dz" ); - break; - case SVGA3DSRCMOD_DW: - debug_printf( "_dw" ); - break; - default: - assert( 0 ); - } - if (srcreg.swizzle_x != 0 || srcreg.swizzle_y != 1 || srcreg.swizzle_z != 2 || srcreg.swizzle_w != 3) { - debug_printf( "." ); - if (srcreg.swizzle_x == srcreg.swizzle_y && srcreg.swizzle_y == srcreg.swizzle_z && srcreg.swizzle_z == srcreg.swizzle_w) { - debug_printf( "%c", "xyzw"[srcreg.swizzle_x] ); - } - else { - debug_printf( "%c", "xyzw"[srcreg.swizzle_x] ); - debug_printf( "%c", "xyzw"[srcreg.swizzle_y] ); - debug_printf( "%c", "xyzw"[srcreg.swizzle_z] ); - debug_printf( "%c", "xyzw"[srcreg.swizzle_w] ); - } - } -} - -void -sh_svga_dump( - const unsigned *assem, - unsigned dwords, - unsigned do_binary ) -{ - const unsigned *start = assem; - boolean finished = FALSE; - struct dump_info di; - unsigned i; - - if (do_binary) { - for (i = 0; i < dwords; i++) - debug_printf(" 0x%08x,\n", assem[i]); - - debug_printf("\n\n"); - } - - di.version.value = *assem++; - di.is_ps = (di.version.type == SVGA3D_PS_TYPE); - - debug_printf( - "%s_%u_%u\n", - di.is_ps ? "ps" : "vs", - di.version.major, - di.version.minor ); - - while (!finished) { - struct sh_op op = *(struct sh_op *) assem; - - if (assem - start >= dwords) { - debug_printf("... ran off end of buffer\n"); - assert(0); - return; - } - - switch (op.opcode) { - case SVGA3DOP_DCL: - { - struct sh_dcl dcl = *(struct sh_dcl *) assem; - - debug_printf( "dcl" ); - if (sh_dstreg_type( dcl.reg ) == SVGA3DREG_SAMPLER) - dump_sampleinfo( dcl.u.ps.sampleinfo ); - else if (di.is_ps) { - if (di.version.major == 3 && - sh_dstreg_type( dcl.reg ) != SVGA3DREG_MISCTYPE) - dump_usageinfo( dcl.u.vs.semantic ); - } - else - dump_usageinfo( dcl.u.vs.semantic ); - dump_dstreg( dcl.reg, &di ); - debug_printf( "\n" ); - assem += sizeof( struct sh_dcl ) / sizeof( unsigned ); - } - break; - - case SVGA3DOP_DEFB: - { - struct sh_defb defb = *(struct sh_defb *) assem; - - debug_printf( "defb " ); - dump_reg( defb.reg, NULL, &di ); - debug_printf( ", " ); - dump_bdata( defb.data ); - debug_printf( "\n" ); - assem += sizeof( struct sh_defb ) / sizeof( unsigned ); - } - break; - - case SVGA3DOP_DEFI: - { - struct sh_defi defi = *(struct sh_defi *) assem; - - debug_printf( "defi " ); - dump_reg( defi.reg, NULL, &di ); - debug_printf( ", " ); - dump_idata( defi.idata ); - debug_printf( "\n" ); - assem += sizeof( struct sh_defi ) / sizeof( unsigned ); - } - break; - - case SVGA3DOP_TEXCOORD: - assert( di.is_ps ); - dump_op( op, "texcoord" ); - if (0) { - struct sh_dstop dstop = *(struct sh_dstop *) assem; - dump_dstreg( dstop.dst, &di ); - assem += sizeof( struct sh_dstop ) / sizeof( unsigned ); - } - else { - struct sh_unaryop unaryop = *(struct sh_unaryop *) assem; - dump_dstreg( unaryop.dst, &di ); - debug_printf( ", " ); - dump_srcreg( unaryop.src, NULL, &di ); - assem += sizeof( struct sh_unaryop ) / sizeof( unsigned ); - } - debug_printf( "\n" ); - break; - - case SVGA3DOP_TEX: - assert( di.is_ps ); - if (0) { - dump_op( op, "tex" ); - if (0) { - struct sh_dstop dstop = *(struct sh_dstop *) assem; - - dump_dstreg( dstop.dst, &di ); - assem += sizeof( struct sh_dstop ) / sizeof( unsigned ); - } - else { - struct sh_unaryop unaryop = *(struct sh_unaryop *) assem; - - dump_dstreg( unaryop.dst, &di ); - debug_printf( ", " ); - dump_srcreg( unaryop.src, NULL, &di ); - assem += sizeof( struct sh_unaryop ) / sizeof( unsigned ); - } - } - else { - struct sh_binaryop binaryop = *(struct sh_binaryop *) assem; - - dump_op( op, "texld" ); - dump_dstreg( binaryop.dst, &di ); - debug_printf( ", " ); - dump_srcreg( binaryop.src0, NULL, &di ); - debug_printf( ", " ); - dump_srcreg( binaryop.src1, NULL, &di ); - assem += sizeof( struct sh_binaryop ) / sizeof( unsigned ); - } - debug_printf( "\n" ); - break; - - case SVGA3DOP_DEF: - { - struct sh_def def = *(struct sh_def *) assem; - - debug_printf( "def " ); - dump_reg( def.reg, NULL, &di ); - debug_printf( ", " ); - dump_cdata( def.cdata ); - debug_printf( "\n" ); - assem += sizeof( struct sh_def ) / sizeof( unsigned ); - } - break; - - case SVGA3DOP_PHASE: - debug_printf( "phase\n" ); - assem += sizeof( struct sh_op ) / sizeof( unsigned ); - break; - - case SVGA3DOP_COMMENT: - assert( 0 ); - break; - - case SVGA3DOP_RET: - debug_printf( "ret\n" ); - assem += sizeof( struct sh_op ) / sizeof( unsigned ); - break; - - case SVGA3DOP_END: - debug_printf( "end\n" ); - finished = TRUE; - break; - - default: - { - const struct sh_opcode_info *info = sh_svga_opcode_info( op.opcode ); - uint i; - uint num_src = info->num_src + op.predicated; - boolean not_first_arg = FALSE; - - assert( info->num_dst <= 1 ); - - if (op.opcode == SVGA3DOP_SINCOS && di.version.major < 3) - num_src += 2; - - dump_comp_op( op, info->mnemonic ); - assem += sizeof( struct sh_op ) / sizeof( unsigned ); - - if (info->num_dst > 0) { - struct sh_dstreg dstreg = *(struct sh_dstreg *) assem; - - dump_dstreg( dstreg, &di ); - assem += sizeof( struct sh_dstreg ) / sizeof( unsigned ); - not_first_arg = TRUE; - } - - for (i = 0; i < num_src; i++) { - struct sh_srcreg srcreg; - struct sh_srcreg indreg; - - srcreg = *(struct sh_srcreg *) assem; - assem += sizeof( struct sh_srcreg ) / sizeof( unsigned ); - if (srcreg.relative && !di.is_ps && di.version.major >= 2) { - indreg = *(struct sh_srcreg *) assem; - assem += sizeof( struct sh_srcreg ) / sizeof( unsigned ); - } - - if (not_first_arg) - debug_printf( ", " ); - else - debug_printf( " " ); - dump_srcreg( srcreg, &indreg, &di ); - not_first_arg = TRUE; - } - - debug_printf( "\n" ); - } - } - } -} diff --git a/src/gallium/drivers/svga/svgadump/st_shader_dump.h b/src/gallium/drivers/svga/svgadump/st_shader_dump.h deleted file mode 100644 index af5549cdba..0000000000 --- a/src/gallium/drivers/svga/svgadump/st_shader_dump.h +++ /dev/null @@ -1,42 +0,0 @@ -/********************************************************** - * Copyright 2008-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, 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. - * - **********************************************************/ - -/** - * @file - * SVGA Shader Dump Facilities - * - * @author Michal Krol - */ - -#ifndef ST_SHADER_SVGA_DUMP_H -#define ST_SHADER_SVGA_DUMP_H - -void -sh_svga_dump( - const unsigned *assem, - unsigned dwords, - unsigned do_binary ); - -#endif /* ST_SHADER_SVGA_DUMP_H */ diff --git a/src/gallium/drivers/svga/svgadump/st_shader_op.c b/src/gallium/drivers/svga/svgadump/st_shader_op.c deleted file mode 100644 index 2c05382ab9..0000000000 --- a/src/gallium/drivers/svga/svgadump/st_shader_op.c +++ /dev/null @@ -1,168 +0,0 @@ -/********************************************************** - * Copyright 2008-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, 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. - * - **********************************************************/ - -/** - * @file - * SVGA Shader Token Opcode Info - * - * @author Michal Krol - */ - -#include "util/u_debug.h" -#include "st_shader_op.h" - -#include "../svga_hw_reg.h" -#include "svga3d_shaderdefs.h" - -#define SVGA3DOP_INVALID SVGA3DOP_END -#define TGSI_OPCODE_INVALID TGSI_OPCODE_LAST - -static struct sh_opcode_info opcode_info[] = -{ - { "nop", 0, 0, SVGA3DOP_NOP }, - { "mov", 1, 1, SVGA3DOP_MOV, }, - { "add", 1, 2, SVGA3DOP_ADD, }, - { "sub", 1, 2, SVGA3DOP_SUB, }, - { "mad", 1, 3, SVGA3DOP_MAD, }, - { "mul", 1, 2, SVGA3DOP_MUL, }, - { "rcp", 1, 1, SVGA3DOP_RCP, }, - { "rsq", 1, 1, SVGA3DOP_RSQ, }, - { "dp3", 1, 2, SVGA3DOP_DP3, }, - { "dp4", 1, 2, SVGA3DOP_DP4, }, - { "min", 1, 2, SVGA3DOP_MIN, }, - { "max", 1, 2, SVGA3DOP_MAX, }, - { "slt", 1, 2, SVGA3DOP_SLT, }, - { "sge", 1, 2, SVGA3DOP_SGE, }, - { "exp", 1, 1, SVGA3DOP_EXP, }, - { "log", 1, 1, SVGA3DOP_LOG, }, - { "lit", 1, 1, SVGA3DOP_LIT, }, - { "dst", 1, 2, SVGA3DOP_DST, }, - { "lrp", 1, 3, SVGA3DOP_LRP, }, - { "frc", 1, 1, SVGA3DOP_FRC, }, - { "m4x4", 1, 2, SVGA3DOP_M4x4, }, - { "m4x3", 1, 2, SVGA3DOP_M4x3, }, - { "m3x4", 1, 2, SVGA3DOP_M3x4, }, - { "m3x3", 1, 2, SVGA3DOP_M3x3, }, - { "m3x2", 1, 2, SVGA3DOP_M3x2, }, - { "call", 0, 1, SVGA3DOP_CALL, }, - { "callnz", 0, 2, SVGA3DOP_CALLNZ, }, - { "loop", 0, 2, SVGA3DOP_LOOP, }, - { "ret", 0, 0, SVGA3DOP_RET, }, - { "endloop", 0, 0, SVGA3DOP_ENDLOOP, }, - { "label", 0, 1, SVGA3DOP_LABEL, }, - { "dcl", 0, 0, SVGA3DOP_DCL, }, - { "pow", 1, 2, SVGA3DOP_POW, }, - { "crs", 1, 2, SVGA3DOP_CRS, }, - { "sgn", 1, 3, SVGA3DOP_SGN, }, - { "abs", 1, 1, SVGA3DOP_ABS, }, - { "nrm", 1, 1, SVGA3DOP_NRM, }, /* 3-componenet normalization */ - { "sincos", 1, 1, SVGA3DOP_SINCOS, }, - { "rep", 0, 1, SVGA3DOP_REP, }, - { "endrep", 0, 0, SVGA3DOP_ENDREP, }, - { "if", 0, 1, SVGA3DOP_IF, }, - { "ifc", 0, 2, SVGA3DOP_IFC, }, - { "else", 0, 0, SVGA3DOP_ELSE, }, - { "endif", 0, 0, SVGA3DOP_ENDIF, }, - { "break", 0, 0, SVGA3DOP_BREAK, }, - { "breakc", 0, 0, SVGA3DOP_BREAKC, }, - { "mova", 1, 1, SVGA3DOP_MOVA, }, - { "defb", 0, 0, SVGA3DOP_DEFB, }, - { "defi", 0, 0, SVGA3DOP_DEFI, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "???", 0, 0, SVGA3DOP_INVALID, }, - { "texcoord", 0, 0, SVGA3DOP_TEXCOORD, }, - { "texkill", 1, 0, SVGA3DOP_TEXKILL, }, - { "tex", 0, 0, SVGA3DOP_TEX, }, - { "texbem", 1, 1, SVGA3DOP_TEXBEM, }, - { "texbeml", 1, 1, SVGA3DOP_TEXBEML, }, - { "texreg2ar", 1, 1, SVGA3DOP_TEXREG2AR, }, - { "texreg2gb", 1, 1, SVGA3DOP_TEXREG2GB, }, - { "texm3x2pad", 1, 1, SVGA3DOP_TEXM3x2PAD, }, - { "texm3x2tex", 1, 1, SVGA3DOP_TEXM3x2TEX, }, - { "texm3x3pad", 1, 1, SVGA3DOP_TEXM3x3PAD, }, - { "texm3x3tex", 1, 1, SVGA3DOP_TEXM3x3TEX, }, - { "reserved0", 0, 0, SVGA3DOP_RESERVED0, }, - { "texm3x3spec", 1, 2, SVGA3DOP_TEXM3x3SPEC, }, - { "texm3x3vspec", 1, 1, SVGA3DOP_TEXM3x3VSPEC,}, - { "expp", 1, 1, SVGA3DOP_EXPP, }, - { "logp", 1, 1, SVGA3DOP_LOGP, }, - { "cnd", 1, 3, SVGA3DOP_CND, }, - { "def", 0, 0, SVGA3DOP_DEF, }, - { "texreg2rgb", 1, 1, SVGA3DOP_TEXREG2RGB, }, - { "texdp3tex", 1, 1, SVGA3DOP_TEXDP3TEX, }, - { "texm3x2depth", 1, 1, SVGA3DOP_TEXM3x2DEPTH,}, - { "texdp3", 1, 1, SVGA3DOP_TEXDP3, }, - { "texm3x3", 1, 1, SVGA3DOP_TEXM3x3, }, - { "texdepth", 1, 0, SVGA3DOP_TEXDEPTH, }, - { "cmp", 1, 3, SVGA3DOP_CMP, }, - { "bem", 1, 2, SVGA3DOP_BEM, }, - { "dp2add", 1, 3, SVGA3DOP_DP2ADD, }, - { "dsx", 1, 1, SVGA3DOP_INVALID, }, - { "dsy", 1, 1, SVGA3DOP_INVALID, }, - { "texldd", 1, 1, SVGA3DOP_INVALID, }, - { "setp", 1, 2, SVGA3DOP_SETP, }, - { "texldl", 1, 1, SVGA3DOP_INVALID, }, - { "breakp", 1, 1, SVGA3DOP_INVALID, }, -}; - -const struct sh_opcode_info *sh_svga_opcode_info( uint op ) -{ - struct sh_opcode_info *info; - - if (op >= sizeof( opcode_info ) / sizeof( opcode_info[0] )) { - /* The opcode is either PHASE, COMMENT, END or out of range. - */ - assert( 0 ); - return NULL; - } - - info = &opcode_info[op]; - - if (info->svga_opcode == SVGA3DOP_INVALID) { - /* No valid information. Please provide number of dst/src registers. - */ - assert( 0 ); - return NULL; - } - - /* Sanity check. - */ - assert( op == info->svga_opcode ); - - return info; -} diff --git a/src/gallium/drivers/svga/svgadump/st_shader_op.h b/src/gallium/drivers/svga/svgadump/st_shader_op.h deleted file mode 100644 index 01d39dca84..0000000000 --- a/src/gallium/drivers/svga/svgadump/st_shader_op.h +++ /dev/null @@ -1,46 +0,0 @@ -/********************************************************** - * Copyright 2008-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, 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. - * - **********************************************************/ - -/** - * @file - * SVGA Shader Token Opcode Info - * - * @author Michal Krol - */ - -#ifndef ST_SHADER_SVGA_OP_H -#define ST_SHADER_SVGA_OP_H - -struct sh_opcode_info -{ - const char *mnemonic; - unsigned num_dst:8; - unsigned num_src:8; - unsigned svga_opcode:16; -}; - -const struct sh_opcode_info *sh_svga_opcode_info( unsigned op ); - -#endif /* ST_SHADER_SVGA_OP_H */ diff --git a/src/gallium/drivers/svga/svgadump/svga_dump.c b/src/gallium/drivers/svga/svgadump/svga_dump.c index 180dde8dc1..c6c353f58e 100644 --- a/src/gallium/drivers/svga/svgadump/svga_dump.c +++ b/src/gallium/drivers/svga/svgadump/svga_dump.c @@ -31,7 +31,7 @@ */ #include "svga_types.h" -#include "st_shader_dump.h" +#include "svga_shader_dump.h" #include "svga3d_reg.h" #include "util/u_debug.h" diff --git a/src/gallium/drivers/svga/svgadump/svga_dump.py b/src/gallium/drivers/svga/svgadump/svga_dump.py index 3cb29c395b..288e753296 100755 --- a/src/gallium/drivers/svga/svgadump/svga_dump.py +++ b/src/gallium/drivers/svga/svgadump/svga_dump.py @@ -291,7 +291,7 @@ def main(): print ' */' print print '#include "svga_types.h"' - print '#include "shader_dump/st_shader_dump.h"' + print '#include "svga_shader_dump.h"' print '#include "svga3d_reg.h"' print print '#include "pipe/p_debug.h"' diff --git a/src/gallium/drivers/svga/svgadump/svga_shader.h b/src/gallium/drivers/svga/svgadump/svga_shader.h new file mode 100644 index 0000000000..2fc1796a90 --- /dev/null +++ b/src/gallium/drivers/svga/svgadump/svga_shader.h @@ -0,0 +1,214 @@ +/********************************************************** + * Copyright 2007-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, 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. + * + **********************************************************/ + +/** + * @file + * SVGA Shader Token Definitions + * + * @author Michal Krol + */ + +#ifndef ST_SHADER_SVGA_H +#define ST_SHADER_SVGA_H + +#include "pipe/p_compiler.h" + +struct sh_op +{ + unsigned opcode:16; + unsigned control:8; + unsigned length:4; + unsigned predicated:1; + unsigned unused:1; + unsigned coissue:1; + unsigned is_reg:1; +}; + +struct sh_reg +{ + unsigned number:11; + unsigned type_hi:2; + unsigned relative:1; + unsigned unused:14; + unsigned type_lo:3; + unsigned is_reg:1; +}; + +static INLINE unsigned +sh_reg_type( struct sh_reg reg ) +{ + return reg.type_lo | (reg.type_hi << 3); +} + +struct sh_cdata +{ + float xyzw[4]; +}; + +struct sh_def +{ + struct sh_op op; + struct sh_reg reg; + struct sh_cdata cdata; +}; + +struct sh_defb +{ + struct sh_op op; + struct sh_reg reg; + uint data; +}; + +struct sh_idata +{ + int xyzw[4]; +}; + +struct sh_defi +{ + struct sh_op op; + struct sh_reg reg; + struct sh_idata idata; +}; + +#define PS_TEXTURETYPE_UNKNOWN SVGA3DSAMP_UNKNOWN +#define PS_TEXTURETYPE_2D SVGA3DSAMP_2D +#define PS_TEXTURETYPE_CUBE SVGA3DSAMP_CUBE +#define PS_TEXTURETYPE_VOLUME SVGA3DSAMP_VOLUME + +struct ps_sampleinfo +{ + unsigned unused:27; + unsigned texture_type:4; + unsigned is_reg:1; +}; + +struct vs_semantic +{ + unsigned usage:5; + unsigned unused1:11; + unsigned usage_index:4; + unsigned unused2:12; +}; + +struct sh_dstreg +{ + unsigned number:11; + unsigned type_hi:2; + unsigned relative:1; + unsigned unused:2; + unsigned write_mask:4; + unsigned modifier:4; + unsigned shift_scale:4; + unsigned type_lo:3; + unsigned is_reg:1; +}; + +static INLINE unsigned +sh_dstreg_type( struct sh_dstreg reg ) +{ + return reg.type_lo | (reg.type_hi << 3); +} + +struct sh_dcl +{ + struct sh_op op; + union { + struct { + struct ps_sampleinfo sampleinfo; + } ps; + struct { + struct vs_semantic semantic; + } vs; + } u; + struct sh_dstreg reg; +}; + + +struct sh_srcreg +{ + unsigned number:11; + unsigned type_hi:2; + unsigned relative:1; + unsigned unused:2; + unsigned swizzle_x:2; + unsigned swizzle_y:2; + unsigned swizzle_z:2; + unsigned swizzle_w:2; + unsigned modifier:4; + unsigned type_lo:3; + unsigned is_reg:1; +}; + +static INLINE unsigned +sh_srcreg_type( struct sh_srcreg reg ) +{ + return reg.type_lo | (reg.type_hi << 3); +} + +struct sh_dstop +{ + struct sh_op op; + struct sh_dstreg dst; +}; + +struct sh_srcop +{ + struct sh_op op; + struct sh_srcreg src; +}; + +struct sh_src2op +{ + struct sh_op op; + struct sh_srcreg src0; + struct sh_srcreg src1; +}; + +struct sh_unaryop +{ + struct sh_op op; + struct sh_dstreg dst; + struct sh_srcreg src; +}; + +struct sh_binaryop +{ + struct sh_op op; + struct sh_dstreg dst; + struct sh_srcreg src0; + struct sh_srcreg src1; +}; + +struct sh_trinaryop +{ + struct sh_op op; + struct sh_dstreg dst; + struct sh_srcreg src0; + struct sh_srcreg src1; + struct sh_srcreg src2; +}; + +#endif /* ST_SHADER_SVGA_H */ diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c new file mode 100644 index 0000000000..c654126d3a --- /dev/null +++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c @@ -0,0 +1,649 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +/** + * @file + * SVGA Shader Dump Facilities + * + * @author Michal Krol + */ + +#include "svga_shader.h" +#include "svga_shader_dump.h" +#include "svga_shader_op.h" +#include "util/u_debug.h" + +#include "../svga_hw_reg.h" +#include "svga3d_shaderdefs.h" + +struct dump_info +{ + SVGA3dShaderVersion version; + boolean is_ps; +}; + +static void dump_op( struct sh_op op, const char *mnemonic ) +{ + assert( op.predicated == 0 ); + assert( op.is_reg == 0 ); + + if (op.coissue) + debug_printf( "+" ); + debug_printf( "%s", mnemonic ); + switch (op.control) { + case 0: + break; + case SVGA3DOPCONT_PROJECT: + debug_printf( "p" ); + break; + case SVGA3DOPCONT_BIAS: + debug_printf( "b" ); + break; + default: + assert( 0 ); + } +} + + +static void dump_comp_op( struct sh_op op, const char *mnemonic ) +{ + assert( op.is_reg == 0 ); + + if (op.coissue) + debug_printf( "+" ); + debug_printf( "%s", mnemonic ); + switch (op.control) { + case SVGA3DOPCOMP_RESERVED0: + break; + case SVGA3DOPCOMP_GT: + debug_printf("_gt"); + break; + case SVGA3DOPCOMP_EQ: + debug_printf("_eq"); + break; + case SVGA3DOPCOMP_GE: + debug_printf("_ge"); + break; + case SVGA3DOPCOMP_LT: + debug_printf("_lt"); + break; + case SVGA3DOPCOMPC_NE: + debug_printf("_ne"); + break; + case SVGA3DOPCOMP_LE: + debug_printf("_le"); + break; + case SVGA3DOPCOMP_RESERVED1: + default: + assert( 0 ); + } +} + + +static void dump_reg( struct sh_reg reg, struct sh_srcreg *indreg, const struct dump_info *di ) +{ + assert( sh_reg_type( reg ) == SVGA3DREG_CONST || reg.relative == 0 ); + assert( reg.is_reg == 1 ); + + switch (sh_reg_type( reg )) { + case SVGA3DREG_TEMP: + debug_printf( "r%u", reg.number ); + break; + + case SVGA3DREG_INPUT: + debug_printf( "v%u", reg.number ); + break; + + case SVGA3DREG_CONST: + if (reg.relative) { + if (sh_srcreg_type( *indreg ) == SVGA3DREG_LOOP) + debug_printf( "c[aL+%u]", reg.number ); + else + debug_printf( "c[a%u.x+%u]", indreg->number, reg.number ); + } + else + debug_printf( "c%u", reg.number ); + break; + + case SVGA3DREG_ADDR: /* VS */ + /* SVGA3DREG_TEXTURE */ /* PS */ + if (di->is_ps) + debug_printf( "t%u", reg.number ); + else + debug_printf( "a%u", reg.number ); + break; + + case SVGA3DREG_RASTOUT: + switch (reg.number) { + case 0 /*POSITION*/: + debug_printf( "oPos" ); + break; + case 1 /*FOG*/: + debug_printf( "oFog" ); + break; + case 2 /*POINT_SIZE*/: + debug_printf( "oPts" ); + break; + default: + assert( 0 ); + debug_printf( "???" ); + } + break; + + case SVGA3DREG_ATTROUT: + assert( reg.number < 2 ); + debug_printf( "oD%u", reg.number ); + break; + + case SVGA3DREG_TEXCRDOUT: + /* SVGA3DREG_OUTPUT */ + debug_printf( "oT%u", reg.number ); + break; + + case SVGA3DREG_COLOROUT: + debug_printf( "oC%u", reg.number ); + break; + + case SVGA3DREG_DEPTHOUT: + debug_printf( "oD%u", reg.number ); + break; + + case SVGA3DREG_SAMPLER: + debug_printf( "s%u", reg.number ); + break; + + case SVGA3DREG_CONSTBOOL: + assert( !reg.relative ); + debug_printf( "b%u", reg.number ); + break; + + case SVGA3DREG_CONSTINT: + assert( !reg.relative ); + debug_printf( "i%u", reg.number ); + break; + + case SVGA3DREG_LOOP: + assert( reg.number == 0 ); + debug_printf( "aL" ); + break; + + case SVGA3DREG_MISCTYPE: + switch (reg.number) { + case SVGA3DMISCREG_POSITION: + debug_printf( "vPos" ); + break; + case SVGA3DMISCREG_FACE: + debug_printf( "vFace" ); + break; + default: + assert(0); + break; + } + break; + + case SVGA3DREG_LABEL: + debug_printf( "l%u", reg.number ); + break; + + case SVGA3DREG_PREDICATE: + debug_printf( "p%u", reg.number ); + break; + + + default: + assert( 0 ); + debug_printf( "???" ); + } +} + +static void dump_cdata( struct sh_cdata cdata ) +{ + debug_printf( "%f, %f, %f, %f", cdata.xyzw[0], cdata.xyzw[1], cdata.xyzw[2], cdata.xyzw[3] ); +} + +static void dump_idata( struct sh_idata idata ) +{ + debug_printf( "%d, %d, %d, %d", idata.xyzw[0], idata.xyzw[1], idata.xyzw[2], idata.xyzw[3] ); +} + +static void dump_bdata( boolean bdata ) +{ + debug_printf( bdata ? "TRUE" : "FALSE" ); +} + +static void dump_sampleinfo( struct ps_sampleinfo sampleinfo ) +{ + switch (sampleinfo.texture_type) { + case SVGA3DSAMP_2D: + debug_printf( "_2d" ); + break; + case SVGA3DSAMP_CUBE: + debug_printf( "_cube" ); + break; + case SVGA3DSAMP_VOLUME: + debug_printf( "_volume" ); + break; + default: + assert( 0 ); + } +} + + +static void dump_usageinfo( struct vs_semantic semantic ) +{ + switch (semantic.usage) { + case SVGA3D_DECLUSAGE_POSITION: + debug_printf("_position" ); + break; + case SVGA3D_DECLUSAGE_BLENDWEIGHT: + debug_printf("_blendweight" ); + break; + case SVGA3D_DECLUSAGE_BLENDINDICES: + debug_printf("_blendindices" ); + break; + case SVGA3D_DECLUSAGE_NORMAL: + debug_printf("_normal" ); + break; + case SVGA3D_DECLUSAGE_PSIZE: + debug_printf("_psize" ); + break; + case SVGA3D_DECLUSAGE_TEXCOORD: + debug_printf("_texcoord"); + break; + case SVGA3D_DECLUSAGE_TANGENT: + debug_printf("_tangent" ); + break; + case SVGA3D_DECLUSAGE_BINORMAL: + debug_printf("_binormal" ); + break; + case SVGA3D_DECLUSAGE_TESSFACTOR: + debug_printf("_tessfactor" ); + break; + case SVGA3D_DECLUSAGE_POSITIONT: + debug_printf("_positiont" ); + break; + case SVGA3D_DECLUSAGE_COLOR: + debug_printf("_color" ); + break; + case SVGA3D_DECLUSAGE_FOG: + debug_printf("_fog" ); + break; + case SVGA3D_DECLUSAGE_DEPTH: + debug_printf("_depth" ); + break; + case SVGA3D_DECLUSAGE_SAMPLE: + debug_printf("_sample"); + break; + default: + assert( 0 ); + return; + } + + if (semantic.usage_index != 0) { + debug_printf("%d", semantic.usage_index ); + } +} + +static void dump_dstreg( struct sh_dstreg dstreg, const struct dump_info *di ) +{ + union { + struct sh_reg reg; + struct sh_dstreg dstreg; + } u; + + assert( (dstreg.modifier & (SVGA3DDSTMOD_SATURATE | SVGA3DDSTMOD_PARTIALPRECISION)) == dstreg.modifier ); + + if (dstreg.modifier & SVGA3DDSTMOD_SATURATE) + debug_printf( "_sat" ); + if (dstreg.modifier & SVGA3DDSTMOD_PARTIALPRECISION) + debug_printf( "_pp" ); + switch (dstreg.shift_scale) { + case 0: + break; + case 1: + debug_printf( "_x2" ); + break; + case 2: + debug_printf( "_x4" ); + break; + case 3: + debug_printf( "_x8" ); + break; + case 13: + debug_printf( "_d8" ); + break; + case 14: + debug_printf( "_d4" ); + break; + case 15: + debug_printf( "_d2" ); + break; + default: + assert( 0 ); + } + debug_printf( " " ); + + u.dstreg = dstreg; + dump_reg( u.reg, NULL, di ); + if (dstreg.write_mask != SVGA3DWRITEMASK_ALL) { + debug_printf( "." ); + if (dstreg.write_mask & SVGA3DWRITEMASK_0) + debug_printf( "x" ); + if (dstreg.write_mask & SVGA3DWRITEMASK_1) + debug_printf( "y" ); + if (dstreg.write_mask & SVGA3DWRITEMASK_2) + debug_printf( "z" ); + if (dstreg.write_mask & SVGA3DWRITEMASK_3) + debug_printf( "w" ); + } +} + +static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, const struct dump_info *di ) +{ + union { + struct sh_reg reg; + struct sh_srcreg srcreg; + } u; + + switch (srcreg.modifier) { + case SVGA3DSRCMOD_NEG: + case SVGA3DSRCMOD_BIASNEG: + case SVGA3DSRCMOD_SIGNNEG: + case SVGA3DSRCMOD_X2NEG: + debug_printf( "-" ); + break; + case SVGA3DSRCMOD_ABS: + debug_printf( "|" ); + break; + case SVGA3DSRCMOD_ABSNEG: + debug_printf( "-|" ); + break; + case SVGA3DSRCMOD_COMP: + debug_printf( "1-" ); + break; + case SVGA3DSRCMOD_NOT: + debug_printf( "!" ); + } + + u.srcreg = srcreg; + dump_reg( u.reg, indreg, di ); + switch (srcreg.modifier) { + case SVGA3DSRCMOD_NONE: + case SVGA3DSRCMOD_NEG: + case SVGA3DSRCMOD_COMP: + case SVGA3DSRCMOD_NOT: + break; + case SVGA3DSRCMOD_ABS: + case SVGA3DSRCMOD_ABSNEG: + debug_printf( "|" ); + break; + case SVGA3DSRCMOD_BIAS: + case SVGA3DSRCMOD_BIASNEG: + debug_printf( "_bias" ); + break; + case SVGA3DSRCMOD_SIGN: + case SVGA3DSRCMOD_SIGNNEG: + debug_printf( "_bx2" ); + break; + case SVGA3DSRCMOD_X2: + case SVGA3DSRCMOD_X2NEG: + debug_printf( "_x2" ); + break; + case SVGA3DSRCMOD_DZ: + debug_printf( "_dz" ); + break; + case SVGA3DSRCMOD_DW: + debug_printf( "_dw" ); + break; + default: + assert( 0 ); + } + if (srcreg.swizzle_x != 0 || srcreg.swizzle_y != 1 || srcreg.swizzle_z != 2 || srcreg.swizzle_w != 3) { + debug_printf( "." ); + if (srcreg.swizzle_x == srcreg.swizzle_y && srcreg.swizzle_y == srcreg.swizzle_z && srcreg.swizzle_z == srcreg.swizzle_w) { + debug_printf( "%c", "xyzw"[srcreg.swizzle_x] ); + } + else { + debug_printf( "%c", "xyzw"[srcreg.swizzle_x] ); + debug_printf( "%c", "xyzw"[srcreg.swizzle_y] ); + debug_printf( "%c", "xyzw"[srcreg.swizzle_z] ); + debug_printf( "%c", "xyzw"[srcreg.swizzle_w] ); + } + } +} + +void +sh_svga_dump( + const unsigned *assem, + unsigned dwords, + unsigned do_binary ) +{ + const unsigned *start = assem; + boolean finished = FALSE; + struct dump_info di; + unsigned i; + + if (do_binary) { + for (i = 0; i < dwords; i++) + debug_printf(" 0x%08x,\n", assem[i]); + + debug_printf("\n\n"); + } + + di.version.value = *assem++; + di.is_ps = (di.version.type == SVGA3D_PS_TYPE); + + debug_printf( + "%s_%u_%u\n", + di.is_ps ? "ps" : "vs", + di.version.major, + di.version.minor ); + + while (!finished) { + struct sh_op op = *(struct sh_op *) assem; + + if (assem - start >= dwords) { + debug_printf("... ran off end of buffer\n"); + assert(0); + return; + } + + switch (op.opcode) { + case SVGA3DOP_DCL: + { + struct sh_dcl dcl = *(struct sh_dcl *) assem; + + debug_printf( "dcl" ); + if (sh_dstreg_type( dcl.reg ) == SVGA3DREG_SAMPLER) + dump_sampleinfo( dcl.u.ps.sampleinfo ); + else if (di.is_ps) { + if (di.version.major == 3 && + sh_dstreg_type( dcl.reg ) != SVGA3DREG_MISCTYPE) + dump_usageinfo( dcl.u.vs.semantic ); + } + else + dump_usageinfo( dcl.u.vs.semantic ); + dump_dstreg( dcl.reg, &di ); + debug_printf( "\n" ); + assem += sizeof( struct sh_dcl ) / sizeof( unsigned ); + } + break; + + case SVGA3DOP_DEFB: + { + struct sh_defb defb = *(struct sh_defb *) assem; + + debug_printf( "defb " ); + dump_reg( defb.reg, NULL, &di ); + debug_printf( ", " ); + dump_bdata( defb.data ); + debug_printf( "\n" ); + assem += sizeof( struct sh_defb ) / sizeof( unsigned ); + } + break; + + case SVGA3DOP_DEFI: + { + struct sh_defi defi = *(struct sh_defi *) assem; + + debug_printf( "defi " ); + dump_reg( defi.reg, NULL, &di ); + debug_printf( ", " ); + dump_idata( defi.idata ); + debug_printf( "\n" ); + assem += sizeof( struct sh_defi ) / sizeof( unsigned ); + } + break; + + case SVGA3DOP_TEXCOORD: + assert( di.is_ps ); + dump_op( op, "texcoord" ); + if (0) { + struct sh_dstop dstop = *(struct sh_dstop *) assem; + dump_dstreg( dstop.dst, &di ); + assem += sizeof( struct sh_dstop ) / sizeof( unsigned ); + } + else { + struct sh_unaryop unaryop = *(struct sh_unaryop *) assem; + dump_dstreg( unaryop.dst, &di ); + debug_printf( ", " ); + dump_srcreg( unaryop.src, NULL, &di ); + assem += sizeof( struct sh_unaryop ) / sizeof( unsigned ); + } + debug_printf( "\n" ); + break; + + case SVGA3DOP_TEX: + assert( di.is_ps ); + if (0) { + dump_op( op, "tex" ); + if (0) { + struct sh_dstop dstop = *(struct sh_dstop *) assem; + + dump_dstreg( dstop.dst, &di ); + assem += sizeof( struct sh_dstop ) / sizeof( unsigned ); + } + else { + struct sh_unaryop unaryop = *(struct sh_unaryop *) assem; + + dump_dstreg( unaryop.dst, &di ); + debug_printf( ", " ); + dump_srcreg( unaryop.src, NULL, &di ); + assem += sizeof( struct sh_unaryop ) / sizeof( unsigned ); + } + } + else { + struct sh_binaryop binaryop = *(struct sh_binaryop *) assem; + + dump_op( op, "texld" ); + dump_dstreg( binaryop.dst, &di ); + debug_printf( ", " ); + dump_srcreg( binaryop.src0, NULL, &di ); + debug_printf( ", " ); + dump_srcreg( binaryop.src1, NULL, &di ); + assem += sizeof( struct sh_binaryop ) / sizeof( unsigned ); + } + debug_printf( "\n" ); + break; + + case SVGA3DOP_DEF: + { + struct sh_def def = *(struct sh_def *) assem; + + debug_printf( "def " ); + dump_reg( def.reg, NULL, &di ); + debug_printf( ", " ); + dump_cdata( def.cdata ); + debug_printf( "\n" ); + assem += sizeof( struct sh_def ) / sizeof( unsigned ); + } + break; + + case SVGA3DOP_PHASE: + debug_printf( "phase\n" ); + assem += sizeof( struct sh_op ) / sizeof( unsigned ); + break; + + case SVGA3DOP_COMMENT: + assert( 0 ); + break; + + case SVGA3DOP_RET: + debug_printf( "ret\n" ); + assem += sizeof( struct sh_op ) / sizeof( unsigned ); + break; + + case SVGA3DOP_END: + debug_printf( "end\n" ); + finished = TRUE; + break; + + default: + { + const struct sh_opcode_info *info = sh_svga_opcode_info( op.opcode ); + uint i; + uint num_src = info->num_src + op.predicated; + boolean not_first_arg = FALSE; + + assert( info->num_dst <= 1 ); + + if (op.opcode == SVGA3DOP_SINCOS && di.version.major < 3) + num_src += 2; + + dump_comp_op( op, info->mnemonic ); + assem += sizeof( struct sh_op ) / sizeof( unsigned ); + + if (info->num_dst > 0) { + struct sh_dstreg dstreg = *(struct sh_dstreg *) assem; + + dump_dstreg( dstreg, &di ); + assem += sizeof( struct sh_dstreg ) / sizeof( unsigned ); + not_first_arg = TRUE; + } + + for (i = 0; i < num_src; i++) { + struct sh_srcreg srcreg; + struct sh_srcreg indreg; + + srcreg = *(struct sh_srcreg *) assem; + assem += sizeof( struct sh_srcreg ) / sizeof( unsigned ); + if (srcreg.relative && !di.is_ps && di.version.major >= 2) { + indreg = *(struct sh_srcreg *) assem; + assem += sizeof( struct sh_srcreg ) / sizeof( unsigned ); + } + + if (not_first_arg) + debug_printf( ", " ); + else + debug_printf( " " ); + dump_srcreg( srcreg, &indreg, &di ); + not_first_arg = TRUE; + } + + debug_printf( "\n" ); + } + } + } +} diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.h b/src/gallium/drivers/svga/svgadump/svga_shader_dump.h new file mode 100644 index 0000000000..af5549cdba --- /dev/null +++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.h @@ -0,0 +1,42 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +/** + * @file + * SVGA Shader Dump Facilities + * + * @author Michal Krol + */ + +#ifndef ST_SHADER_SVGA_DUMP_H +#define ST_SHADER_SVGA_DUMP_H + +void +sh_svga_dump( + const unsigned *assem, + unsigned dwords, + unsigned do_binary ); + +#endif /* ST_SHADER_SVGA_DUMP_H */ diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_op.c b/src/gallium/drivers/svga/svgadump/svga_shader_op.c new file mode 100644 index 0000000000..cecc22106b --- /dev/null +++ b/src/gallium/drivers/svga/svgadump/svga_shader_op.c @@ -0,0 +1,168 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +/** + * @file + * SVGA Shader Token Opcode Info + * + * @author Michal Krol + */ + +#include "util/u_debug.h" +#include "svga_shader_op.h" + +#include "../svga_hw_reg.h" +#include "svga3d_shaderdefs.h" + +#define SVGA3DOP_INVALID SVGA3DOP_END +#define TGSI_OPCODE_INVALID TGSI_OPCODE_LAST + +static struct sh_opcode_info opcode_info[] = +{ + { "nop", 0, 0, SVGA3DOP_NOP }, + { "mov", 1, 1, SVGA3DOP_MOV, }, + { "add", 1, 2, SVGA3DOP_ADD, }, + { "sub", 1, 2, SVGA3DOP_SUB, }, + { "mad", 1, 3, SVGA3DOP_MAD, }, + { "mul", 1, 2, SVGA3DOP_MUL, }, + { "rcp", 1, 1, SVGA3DOP_RCP, }, + { "rsq", 1, 1, SVGA3DOP_RSQ, }, + { "dp3", 1, 2, SVGA3DOP_DP3, }, + { "dp4", 1, 2, SVGA3DOP_DP4, }, + { "min", 1, 2, SVGA3DOP_MIN, }, + { "max", 1, 2, SVGA3DOP_MAX, }, + { "slt", 1, 2, SVGA3DOP_SLT, }, + { "sge", 1, 2, SVGA3DOP_SGE, }, + { "exp", 1, 1, SVGA3DOP_EXP, }, + { "log", 1, 1, SVGA3DOP_LOG, }, + { "lit", 1, 1, SVGA3DOP_LIT, }, + { "dst", 1, 2, SVGA3DOP_DST, }, + { "lrp", 1, 3, SVGA3DOP_LRP, }, + { "frc", 1, 1, SVGA3DOP_FRC, }, + { "m4x4", 1, 2, SVGA3DOP_M4x4, }, + { "m4x3", 1, 2, SVGA3DOP_M4x3, }, + { "m3x4", 1, 2, SVGA3DOP_M3x4, }, + { "m3x3", 1, 2, SVGA3DOP_M3x3, }, + { "m3x2", 1, 2, SVGA3DOP_M3x2, }, + { "call", 0, 1, SVGA3DOP_CALL, }, + { "callnz", 0, 2, SVGA3DOP_CALLNZ, }, + { "loop", 0, 2, SVGA3DOP_LOOP, }, + { "ret", 0, 0, SVGA3DOP_RET, }, + { "endloop", 0, 0, SVGA3DOP_ENDLOOP, }, + { "label", 0, 1, SVGA3DOP_LABEL, }, + { "dcl", 0, 0, SVGA3DOP_DCL, }, + { "pow", 1, 2, SVGA3DOP_POW, }, + { "crs", 1, 2, SVGA3DOP_CRS, }, + { "sgn", 1, 3, SVGA3DOP_SGN, }, + { "abs", 1, 1, SVGA3DOP_ABS, }, + { "nrm", 1, 1, SVGA3DOP_NRM, }, /* 3-componenet normalization */ + { "sincos", 1, 1, SVGA3DOP_SINCOS, }, + { "rep", 0, 1, SVGA3DOP_REP, }, + { "endrep", 0, 0, SVGA3DOP_ENDREP, }, + { "if", 0, 1, SVGA3DOP_IF, }, + { "ifc", 0, 2, SVGA3DOP_IFC, }, + { "else", 0, 0, SVGA3DOP_ELSE, }, + { "endif", 0, 0, SVGA3DOP_ENDIF, }, + { "break", 0, 0, SVGA3DOP_BREAK, }, + { "breakc", 0, 0, SVGA3DOP_BREAKC, }, + { "mova", 1, 1, SVGA3DOP_MOVA, }, + { "defb", 0, 0, SVGA3DOP_DEFB, }, + { "defi", 0, 0, SVGA3DOP_DEFI, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "???", 0, 0, SVGA3DOP_INVALID, }, + { "texcoord", 0, 0, SVGA3DOP_TEXCOORD, }, + { "texkill", 1, 0, SVGA3DOP_TEXKILL, }, + { "tex", 0, 0, SVGA3DOP_TEX, }, + { "texbem", 1, 1, SVGA3DOP_TEXBEM, }, + { "texbeml", 1, 1, SVGA3DOP_TEXBEML, }, + { "texreg2ar", 1, 1, SVGA3DOP_TEXREG2AR, }, + { "texreg2gb", 1, 1, SVGA3DOP_TEXREG2GB, }, + { "texm3x2pad", 1, 1, SVGA3DOP_TEXM3x2PAD, }, + { "texm3x2tex", 1, 1, SVGA3DOP_TEXM3x2TEX, }, + { "texm3x3pad", 1, 1, SVGA3DOP_TEXM3x3PAD, }, + { "texm3x3tex", 1, 1, SVGA3DOP_TEXM3x3TEX, }, + { "reserved0", 0, 0, SVGA3DOP_RESERVED0, }, + { "texm3x3spec", 1, 2, SVGA3DOP_TEXM3x3SPEC, }, + { "texm3x3vspec", 1, 1, SVGA3DOP_TEXM3x3VSPEC,}, + { "expp", 1, 1, SVGA3DOP_EXPP, }, + { "logp", 1, 1, SVGA3DOP_LOGP, }, + { "cnd", 1, 3, SVGA3DOP_CND, }, + { "def", 0, 0, SVGA3DOP_DEF, }, + { "texreg2rgb", 1, 1, SVGA3DOP_TEXREG2RGB, }, + { "texdp3tex", 1, 1, SVGA3DOP_TEXDP3TEX, }, + { "texm3x2depth", 1, 1, SVGA3DOP_TEXM3x2DEPTH,}, + { "texdp3", 1, 1, SVGA3DOP_TEXDP3, }, + { "texm3x3", 1, 1, SVGA3DOP_TEXM3x3, }, + { "texdepth", 1, 0, SVGA3DOP_TEXDEPTH, }, + { "cmp", 1, 3, SVGA3DOP_CMP, }, + { "bem", 1, 2, SVGA3DOP_BEM, }, + { "dp2add", 1, 3, SVGA3DOP_DP2ADD, }, + { "dsx", 1, 1, SVGA3DOP_INVALID, }, + { "dsy", 1, 1, SVGA3DOP_INVALID, }, + { "texldd", 1, 1, SVGA3DOP_INVALID, }, + { "setp", 1, 2, SVGA3DOP_SETP, }, + { "texldl", 1, 1, SVGA3DOP_INVALID, }, + { "breakp", 1, 1, SVGA3DOP_INVALID, }, +}; + +const struct sh_opcode_info *sh_svga_opcode_info( uint op ) +{ + struct sh_opcode_info *info; + + if (op >= sizeof( opcode_info ) / sizeof( opcode_info[0] )) { + /* The opcode is either PHASE, COMMENT, END or out of range. + */ + assert( 0 ); + return NULL; + } + + info = &opcode_info[op]; + + if (info->svga_opcode == SVGA3DOP_INVALID) { + /* No valid information. Please provide number of dst/src registers. + */ + assert( 0 ); + return NULL; + } + + /* Sanity check. + */ + assert( op == info->svga_opcode ); + + return info; +} diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_op.h b/src/gallium/drivers/svga/svgadump/svga_shader_op.h new file mode 100644 index 0000000000..01d39dca84 --- /dev/null +++ b/src/gallium/drivers/svga/svgadump/svga_shader_op.h @@ -0,0 +1,46 @@ +/********************************************************** + * Copyright 2008-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, 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. + * + **********************************************************/ + +/** + * @file + * SVGA Shader Token Opcode Info + * + * @author Michal Krol + */ + +#ifndef ST_SHADER_SVGA_OP_H +#define ST_SHADER_SVGA_OP_H + +struct sh_opcode_info +{ + const char *mnemonic; + unsigned num_dst:8; + unsigned num_src:8; + unsigned svga_opcode:16; +}; + +const struct sh_opcode_info *sh_svga_opcode_info( unsigned op ); + +#endif /* ST_SHADER_SVGA_OP_H */ -- cgit v1.2.3 From d3f26a84204d589e69e82627395771ed7273315d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 24 Nov 2009 14:43:30 +0000 Subject: svga: Use consistent names for public symbol names of shader dumping facilities. --- src/gallium/drivers/svga/svgadump/svga_dump.c | 2 +- src/gallium/drivers/svga/svgadump/svga_shader_dump.c | 4 ++-- src/gallium/drivers/svga/svgadump/svga_shader_dump.h | 8 ++++---- src/gallium/drivers/svga/svgadump/svga_shader_op.c | 2 +- src/gallium/drivers/svga/svgadump/svga_shader_op.h | 8 ++++---- 5 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svgadump/svga_dump.c b/src/gallium/drivers/svga/svgadump/svga_dump.c index c6c353f58e..910afa2528 100644 --- a/src/gallium/drivers/svga/svgadump/svga_dump.c +++ b/src/gallium/drivers/svga/svgadump/svga_dump.c @@ -1627,7 +1627,7 @@ svga_dump_commands(const void *commands, uint32_t size) const SVGA3dCmdDefineShader *cmd = (const SVGA3dCmdDefineShader *)body; dump_SVGA3dCmdDefineShader(cmd); body = (const uint8_t *)&cmd[1]; - sh_svga_dump((const uint32_t *)body, + svga_shader_dump((const uint32_t *)body, (unsigned)(next - body)/sizeof(uint32_t), FALSE ); body = next; diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c index c654126d3a..7718bdf757 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c +++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c @@ -435,7 +435,7 @@ static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, cons } void -sh_svga_dump( +svga_shader_dump( const unsigned *assem, unsigned dwords, unsigned do_binary ) @@ -602,7 +602,7 @@ sh_svga_dump( default: { - const struct sh_opcode_info *info = sh_svga_opcode_info( op.opcode ); + const struct sh_opcode_info *info = svga_opcode_info( op.opcode ); uint i; uint num_src = info->num_src + op.predicated; boolean not_first_arg = FALSE; diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.h b/src/gallium/drivers/svga/svgadump/svga_shader_dump.h index af5549cdba..a2657acb2f 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader_dump.h +++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.h @@ -30,13 +30,13 @@ * @author Michal Krol */ -#ifndef ST_SHADER_SVGA_DUMP_H -#define ST_SHADER_SVGA_DUMP_H +#ifndef SVGA_SHADER_DUMP_H +#define SVGA_SHADER_DUMP_H void -sh_svga_dump( +svga_shader_dump( const unsigned *assem, unsigned dwords, unsigned do_binary ); -#endif /* ST_SHADER_SVGA_DUMP_H */ +#endif /* SVGA_SHADER_DUMP_H */ diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_op.c b/src/gallium/drivers/svga/svgadump/svga_shader_op.c index cecc22106b..8343bfdaab 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader_op.c +++ b/src/gallium/drivers/svga/svgadump/svga_shader_op.c @@ -140,7 +140,7 @@ static struct sh_opcode_info opcode_info[] = { "breakp", 1, 1, SVGA3DOP_INVALID, }, }; -const struct sh_opcode_info *sh_svga_opcode_info( uint op ) +const struct sh_opcode_info *svga_opcode_info( uint op ) { struct sh_opcode_info *info; diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_op.h b/src/gallium/drivers/svga/svgadump/svga_shader_op.h index 01d39dca84..e558de02c5 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader_op.h +++ b/src/gallium/drivers/svga/svgadump/svga_shader_op.h @@ -30,8 +30,8 @@ * @author Michal Krol */ -#ifndef ST_SHADER_SVGA_OP_H -#define ST_SHADER_SVGA_OP_H +#ifndef SVGA_SHADER_OP_H +#define SVGA_SHADER_OP_H struct sh_opcode_info { @@ -41,6 +41,6 @@ struct sh_opcode_info unsigned svga_opcode:16; }; -const struct sh_opcode_info *sh_svga_opcode_info( unsigned op ); +const struct sh_opcode_info *svga_opcode_info( unsigned op ); -#endif /* ST_SHADER_SVGA_OP_H */ +#endif /* SVGA_SHADER_OP_H */ -- cgit v1.2.3 From 135d7e12991312d7aff637565fbe67f666e4e39f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sun, 15 Nov 2009 12:14:03 -0800 Subject: svga: Handle comment tokens when dumping. --- src/gallium/drivers/svga/svgadump/svga_shader.h | 6 ++++++ src/gallium/drivers/svga/svgadump/svga_shader_dump.c | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svgadump/svga_shader.h b/src/gallium/drivers/svga/svgadump/svga_shader.h index 2fc1796a90..9217af2dd9 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader.h +++ b/src/gallium/drivers/svga/svgadump/svga_shader.h @@ -211,4 +211,10 @@ struct sh_trinaryop struct sh_srcreg src2; }; +struct sh_comment +{ + unsigned opcode:16; + unsigned size:16; +}; + #endif /* ST_SHADER_SVGA_H */ diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c index 7718bdf757..b0e7fdf378 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c +++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c @@ -587,7 +587,12 @@ svga_shader_dump( break; case SVGA3DOP_COMMENT: - assert( 0 ); + { + struct sh_comment comment = *(struct sh_comment *)assem; + + /* Ignore comment contents. */ + assem += sizeof(struct sh_comment) / sizeof(unsigned) + comment.size; + } break; case SVGA3DOP_RET: -- cgit v1.2.3 From dc86f4a20b6ffe0340ca178dc303271a8a112bb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Tue, 10 Nov 2009 16:56:43 -0800 Subject: wgl: Fix copy'n'paste typo in comment. --- src/gallium/state_trackers/wgl/stw_winsys.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/wgl/stw_winsys.h b/src/gallium/state_trackers/wgl/stw_winsys.h index 1ead47d6e6..1de6e906d0 100644 --- a/src/gallium/state_trackers/wgl/stw_winsys.h +++ b/src/gallium/state_trackers/wgl/stw_winsys.h @@ -73,7 +73,7 @@ struct stw_winsys HANDLE hSharedSurface); /** - * Open a shared surface (optional). + * Close a shared surface (optional). */ void (*shared_surface_close)(struct pipe_screen *screen, -- cgit v1.2.3 From 124ae596806f1a77af46f1f0e446d448da6e953a Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 27 Nov 2009 13:59:00 +0000 Subject: st/xorg: fix composite after texture size changes --- src/gallium/state_trackers/xorg/xorg_exa.c | 32 +++++++++++++++++++++---- src/gallium/state_trackers/xorg/xorg_renderer.c | 16 +++++++++---- 2 files changed, 38 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index a22f15f64a..cbada42e0e 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -48,6 +48,7 @@ #include "util/u_debug.h" #define DEBUG_PRINT 0 +#define ROUND_UP_TEXTURES 1 /* * Helper functions @@ -273,13 +274,18 @@ ExaPrepareAccess(PixmapPtr pPix, int index) PIPE_REFERENCED_FOR_WRITE) exa->pipe->flush(exa->pipe, 0, NULL); + assert(pPix->drawable.width <= priv->tex->width[0]); + assert(pPix->drawable.height <= priv->tex->height[0]); + priv->map_transfer = exa->scrn->get_tex_transfer(exa->scrn, priv->tex, 0, 0, 0, #ifdef EXA_MIXED_PIXMAPS PIPE_TRANSFER_MAP_DIRECTLY | #endif PIPE_TRANSFER_READ_WRITE, - 0, 0, priv->tex->width[0], priv->tex->height[0]); + 0, 0, + pPix->drawable.width, + pPix->drawable.height ); if (!priv->map_transfer) #ifdef EXA_MIXED_PIXMAPS return FALSE; @@ -819,6 +825,22 @@ xorg_exa_get_pixmap_handle(PixmapPtr pPixmap, unsigned *stride_out) return handle; } +static Bool +size_match( int width, int tex_width ) +{ +#if ROUND_UP_TEXTURES + if (width > tex_width) + return FALSE; + + if (width * 2 < tex_width) + return FALSE; + + return TRUE; +#else + return width == tex_width; +#endif +} + static Bool ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, @@ -865,9 +887,9 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, /* Deal with screen resize */ if ((exa->accel || priv->flags) && (!priv->tex || - (priv->tex->width[0] != width || - priv->tex->height[0] != height || - priv->tex_flags != priv->flags))) { + !size_match(priv->tex->width[0], width) || + !size_match(priv->tex->height[0], height) || + priv->tex_flags != priv->flags)) { struct pipe_texture *texture = NULL; struct pipe_texture template; @@ -875,7 +897,7 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, template.target = PIPE_TEXTURE_2D; exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &priv->picture_format); pf_get_block(template.format, &template.block); -#if 1 +#if ROUND_UP_TEXTURES template.width[0] = util_next_power_of_two(width); template.height[0] = util_next_power_of_two(height); #else diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 9cb65b0aac..4f8985a75e 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -313,21 +313,25 @@ setup_vertex_data_yuv(struct xorg_renderer *r, * these concepts are linked. */ void renderer_bind_destination(struct xorg_renderer *r, - struct pipe_surface *surface ) + struct pipe_surface *surface, + int width, + int height ) { struct pipe_framebuffer_state fb; struct pipe_viewport_state viewport; - int width = surface->width; - int height = surface->height; + /* Framebuffer uses actual surface width/height + */ memset(&fb, 0, sizeof fb); - fb.width = width; - fb.height = height; + fb.width = surface->width; + fb.height = surface->height; fb.nr_cbufs = 1; fb.cbufs[0] = surface; fb.zsbuf = 0; + /* Viewport sets us up to just touch the bit we're interested in: + */ viewport.scale[0] = width / 2.f; viewport.scale[1] = height / 2.f; viewport.scale[2] = 1.0; @@ -337,6 +341,8 @@ void renderer_bind_destination(struct xorg_renderer *r, viewport.translate[2] = 0.0; viewport.translate[3] = 0.0; + /* Constant buffer set up to match viewport dimensions: + */ if (r->fb_width != width || r->fb_height != height) { -- cgit v1.2.3 From 6810ce005a067f20c04f0b3abd1e422adec71d28 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 27 Nov 2009 14:03:10 +0000 Subject: Revert "st/xorg: fix composite after texture size changes" This reverts commit 124ae596806f1a77af46f1f0e446d448da6e953a. Pushed by mistake --- src/gallium/state_trackers/xorg/xorg_exa.c | 32 ++++--------------------- src/gallium/state_trackers/xorg/xorg_renderer.c | 16 ++++--------- 2 files changed, 10 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index cbada42e0e..a22f15f64a 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -48,7 +48,6 @@ #include "util/u_debug.h" #define DEBUG_PRINT 0 -#define ROUND_UP_TEXTURES 1 /* * Helper functions @@ -274,18 +273,13 @@ ExaPrepareAccess(PixmapPtr pPix, int index) PIPE_REFERENCED_FOR_WRITE) exa->pipe->flush(exa->pipe, 0, NULL); - assert(pPix->drawable.width <= priv->tex->width[0]); - assert(pPix->drawable.height <= priv->tex->height[0]); - priv->map_transfer = exa->scrn->get_tex_transfer(exa->scrn, priv->tex, 0, 0, 0, #ifdef EXA_MIXED_PIXMAPS PIPE_TRANSFER_MAP_DIRECTLY | #endif PIPE_TRANSFER_READ_WRITE, - 0, 0, - pPix->drawable.width, - pPix->drawable.height ); + 0, 0, priv->tex->width[0], priv->tex->height[0]); if (!priv->map_transfer) #ifdef EXA_MIXED_PIXMAPS return FALSE; @@ -825,22 +819,6 @@ xorg_exa_get_pixmap_handle(PixmapPtr pPixmap, unsigned *stride_out) return handle; } -static Bool -size_match( int width, int tex_width ) -{ -#if ROUND_UP_TEXTURES - if (width > tex_width) - return FALSE; - - if (width * 2 < tex_width) - return FALSE; - - return TRUE; -#else - return width == tex_width; -#endif -} - static Bool ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, @@ -887,9 +865,9 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, /* Deal with screen resize */ if ((exa->accel || priv->flags) && (!priv->tex || - !size_match(priv->tex->width[0], width) || - !size_match(priv->tex->height[0], height) || - priv->tex_flags != priv->flags)) { + (priv->tex->width[0] != width || + priv->tex->height[0] != height || + priv->tex_flags != priv->flags))) { struct pipe_texture *texture = NULL; struct pipe_texture template; @@ -897,7 +875,7 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, template.target = PIPE_TEXTURE_2D; exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &priv->picture_format); pf_get_block(template.format, &template.block); -#if ROUND_UP_TEXTURES +#if 1 template.width[0] = util_next_power_of_two(width); template.height[0] = util_next_power_of_two(height); #else diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 4f8985a75e..9cb65b0aac 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -313,25 +313,21 @@ setup_vertex_data_yuv(struct xorg_renderer *r, * these concepts are linked. */ void renderer_bind_destination(struct xorg_renderer *r, - struct pipe_surface *surface, - int width, - int height ) + struct pipe_surface *surface ) { struct pipe_framebuffer_state fb; struct pipe_viewport_state viewport; + int width = surface->width; + int height = surface->height; - /* Framebuffer uses actual surface width/height - */ memset(&fb, 0, sizeof fb); - fb.width = surface->width; - fb.height = surface->height; + fb.width = width; + fb.height = height; fb.nr_cbufs = 1; fb.cbufs[0] = surface; fb.zsbuf = 0; - /* Viewport sets us up to just touch the bit we're interested in: - */ viewport.scale[0] = width / 2.f; viewport.scale[1] = height / 2.f; viewport.scale[2] = 1.0; @@ -341,8 +337,6 @@ void renderer_bind_destination(struct xorg_renderer *r, viewport.translate[2] = 0.0; viewport.translate[3] = 0.0; - /* Constant buffer set up to match viewport dimensions: - */ if (r->fb_width != width || r->fb_height != height) { -- cgit v1.2.3 From 6dd9676a8fc43062a7017f2951e0f032889fac9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 27 Nov 2009 13:59:37 +0000 Subject: svga: Re-add shader dumping. --- src/gallium/drivers/svga/svga_tgsi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_tgsi.c b/src/gallium/drivers/svga/svga_tgsi.c index 81eea1a145..b8ef137c01 100644 --- a/src/gallium/drivers/svga/svga_tgsi.c +++ b/src/gallium/drivers/svga/svga_tgsi.c @@ -222,6 +222,20 @@ svga_tgsi_translate( const struct svga_shader *shader, result->nr_tokens = (emit.ptr - emit.buf) / sizeof(unsigned); memcpy(&result->key, &key, sizeof key); + if (SVGA_DEBUG & DEBUG_TGSI) + { + debug_printf( "#####################################\n" ); + debug_printf( "Shader %u below\n", shader->id ); + tgsi_dump( shader->tokens, 0 ); + if (SVGA_DEBUG & DEBUG_TGSI) { + debug_printf( "Shader %u compiled below\n", shader->id ); + svga_shader_dump( result->tokens, + result->nr_tokens , + FALSE ); + } + debug_printf( "#####################################\n" ); + } + return result; fail: -- cgit v1.2.3 From 1310811469e7a1e27669ad1513b5bd4a60207c4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 27 Nov 2009 14:55:20 +0000 Subject: rbug: Mention where the GUI can be found. --- src/gallium/auxiliary/rbug/README | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/rbug/README b/src/gallium/auxiliary/rbug/README index 33d76371de..d984067893 100644 --- a/src/gallium/auxiliary/rbug/README +++ b/src/gallium/auxiliary/rbug/README @@ -16,6 +16,10 @@ for information about applications look in: progs/rbug/README +for a GUI see: + + http://cgit.freedesktop.org/mesa/rbug-gui + -- Jakob Bornecrantz -- cgit v1.2.3 From 4236493899b9ccfcc8df3dcf81697776621fa1f8 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 27 Nov 2009 15:28:46 +0000 Subject: st/xorg: proper fix for compositing after rounding up Basically don't round up shared textures. This fixes compiz, but I'm afraid that rounding up texture sizes here in the driver is doomed, as it will inevitably break texture wrap modes. --- src/gallium/state_trackers/xorg/xorg_composite.c | 7 +++- src/gallium/state_trackers/xorg/xorg_exa.c | 49 ++++++++++++++++++------ src/gallium/state_trackers/xorg/xorg_exa.h | 2 + src/gallium/state_trackers/xorg/xorg_renderer.c | 20 +++++++--- src/gallium/state_trackers/xorg/xorg_renderer.h | 4 +- src/gallium/state_trackers/xorg/xorg_xv.c | 4 +- 6 files changed, 65 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_composite.c b/src/gallium/state_trackers/xorg/xorg_composite.c index bdc1d9f5da..a5975aad51 100644 --- a/src/gallium/state_trackers/xorg/xorg_composite.c +++ b/src/gallium/state_trackers/xorg/xorg_composite.c @@ -474,7 +474,9 @@ boolean xorg_composite_bind_state(struct exa_context *exa, { struct pipe_surface *dst_surf = xorg_gpu_surface(exa->scrn, pDst); - renderer_bind_destination(exa->renderer, dst_surf); + renderer_bind_destination(exa->renderer, dst_surf, + pDst->width, + pDst->height); bind_blend_state(exa, op, pSrcPicture, pMaskPicture, pDstPicture); bind_shaders(exa, op, pSrcPicture, pMaskPicture, pDstPicture, pSrc, pMask); @@ -545,7 +547,8 @@ boolean xorg_solid_bind_state(struct exa_context *exa, vs_traits = VS_SOLID_FILL; fs_traits = FS_SOLID_FILL; - renderer_bind_destination(exa->renderer, dst_surf); + renderer_bind_destination(exa->renderer, dst_surf, + pixmap->width, pixmap->height); bind_blend_state(exa, PictOpSrc, NULL, NULL, NULL); cso_set_samplers(exa->renderer->cso, 0, NULL); cso_set_sampler_textures(exa->renderer->cso, 0, NULL); diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index a22f15f64a..32485add94 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -48,6 +48,7 @@ #include "util/u_debug.h" #define DEBUG_PRINT 0 +#define ROUND_UP_TEXTURES 1 /* * Helper functions @@ -273,13 +274,18 @@ ExaPrepareAccess(PixmapPtr pPix, int index) PIPE_REFERENCED_FOR_WRITE) exa->pipe->flush(exa->pipe, 0, NULL); + assert(pPix->drawable.width <= priv->tex->width[0]); + assert(pPix->drawable.height <= priv->tex->height[0]); + priv->map_transfer = exa->scrn->get_tex_transfer(exa->scrn, priv->tex, 0, 0, 0, #ifdef EXA_MIXED_PIXMAPS PIPE_TRANSFER_MAP_DIRECTLY | #endif PIPE_TRANSFER_READ_WRITE, - 0, 0, priv->tex->width[0], priv->tex->height[0]); + 0, 0, + pPix->drawable.width, + pPix->drawable.height ); if (!priv->map_transfer) #ifdef EXA_MIXED_PIXMAPS return FALSE; @@ -819,6 +825,22 @@ xorg_exa_get_pixmap_handle(PixmapPtr pPixmap, unsigned *stride_out) return handle; } +static Bool +size_match( int width, int tex_width ) +{ +#if ROUND_UP_TEXTURES + if (width > tex_width) + return FALSE; + + if (width * 2 < tex_width) + return FALSE; + + return TRUE; +#else + return width == tex_width; +#endif +} + static Bool ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, int bitsPerPixel, int devKind, @@ -862,12 +884,15 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, miModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel, devKind, NULL); + priv->width = width; + priv->height = height; + /* Deal with screen resize */ if ((exa->accel || priv->flags) && (!priv->tex || - (priv->tex->width[0] != width || - priv->tex->height[0] != height || - priv->tex_flags != priv->flags))) { + !size_match(width, priv->tex->width[0]) || + !size_match(height, priv->tex->height[0]) || + priv->tex_flags != priv->flags)) { struct pipe_texture *texture = NULL; struct pipe_texture template; @@ -875,13 +900,15 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, template.target = PIPE_TEXTURE_2D; exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &priv->picture_format); pf_get_block(template.format, &template.block); -#if 1 - template.width[0] = util_next_power_of_two(width); - template.height[0] = util_next_power_of_two(height); -#else - template.width[0] = width; - template.height[0] = height; -#endif + if (ROUND_UP_TEXTURES && priv->flags == 0) { + template.width[0] = util_next_power_of_two(width); + template.height[0] = util_next_power_of_two(height); + } + else { + template.width[0] = width; + template.height[0] = height; + } + template.depth[0] = 1; template.last_level = 0; template.tex_usage = PIPE_TEXTURE_USAGE_RENDER_TARGET | priv->flags; diff --git a/src/gallium/state_trackers/xorg/xorg_exa.h b/src/gallium/state_trackers/xorg/xorg_exa.h index 0c29187486..f2cefe23b9 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.h +++ b/src/gallium/state_trackers/xorg/xorg_exa.h @@ -49,6 +49,8 @@ struct exa_context struct exa_pixmap_priv { + int width, height; + int flags; int tex_flags; diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 9cb65b0aac..cbb84a8c0d 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -313,21 +313,25 @@ setup_vertex_data_yuv(struct xorg_renderer *r, * these concepts are linked. */ void renderer_bind_destination(struct xorg_renderer *r, - struct pipe_surface *surface ) + struct pipe_surface *surface, + int width, + int height ) { struct pipe_framebuffer_state fb; struct pipe_viewport_state viewport; - int width = surface->width; - int height = surface->height; + /* Framebuffer uses actual surface width/height + */ memset(&fb, 0, sizeof fb); - fb.width = width; - fb.height = height; + fb.width = surface->width; + fb.height = surface->height; fb.nr_cbufs = 1; fb.cbufs[0] = surface; fb.zsbuf = 0; + /* Viewport just touches the bit we're interested in: + */ viewport.scale[0] = width / 2.f; viewport.scale[1] = height / 2.f; viewport.scale[2] = 1.0; @@ -337,6 +341,8 @@ void renderer_bind_destination(struct xorg_renderer *r, viewport.translate[2] = 0.0; viewport.translate[3] = 0.0; + /* Constant buffer set up to match viewport dimensions: + */ if (r->fb_width != width || r->fb_height != height) { @@ -460,7 +466,9 @@ void renderer_copy_prepare(struct xorg_renderer *r, cso_single_sampler_done(r->cso); } - renderer_bind_destination(r, dst_surface); + renderer_bind_destination(r, dst_surface, + dst_surface->width, + dst_surface->height); /* texture */ cso_set_sampler_textures(r->cso, 1, &src_texture); diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.h b/src/gallium/state_trackers/xorg/xorg_renderer.h index ba844bf06e..5272cde2b3 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.h +++ b/src/gallium/state_trackers/xorg/xorg_renderer.h @@ -38,7 +38,9 @@ struct xorg_renderer *renderer_create(struct pipe_context *pipe); void renderer_destroy(struct xorg_renderer *renderer); void renderer_bind_destination(struct xorg_renderer *r, - struct pipe_surface *surface ); + struct pipe_surface *surface, + int width, + int height ); void renderer_bind_framebuffer(struct xorg_renderer *r, struct exa_pixmap_priv *priv); diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index 0b2556b98e..b3315dccad 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -451,7 +451,9 @@ display_video(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *pPriv, int id, pbox = REGION_RECTS(dstRegion); nbox = REGION_NUM_RECTS(dstRegion); - renderer_bind_destination(pPriv->r, dst_surf); + renderer_bind_destination(pPriv->r, dst_surf, + dst_surf->width, dst_surf->height); + bind_blend_state(pPriv); bind_shaders(pPriv); bind_samplers(pPriv); -- cgit v1.2.3 From b748a9f574361273df6b05c06c647ac4fd9b3e41 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 27 Nov 2009 17:40:24 +0100 Subject: r300g,llvmpipe: fix some more merge problems --- src/gallium/drivers/llvmpipe/lp_texture.c | 2 +- src/gallium/drivers/r300/r300_emit.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index 0a0f31f8a3..65d62fd072 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -169,7 +169,7 @@ llvmpipe_texture_blanket(struct pipe_screen * screen, /* Only supports one type */ if (base->target != PIPE_TEXTURE_2D || base->last_level != 0 || - base->depth[0] != 1) { + base->depth0 != 1) { return NULL; } diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index e6ab8e4af1..98a39390bf 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -145,8 +145,8 @@ static const float * get_shader_constant( * normalized coords. Should only show up on non-r500. */ case RC_STATE_R300_TEXRECT_FACTOR: tex = &r300->textures[constant->u.State[1]]->tex; - vec[0] = 1.0 / tex->width[0]; - vec[1] = 1.0 / tex->height[0]; + vec[0] = 1.0 / tex->width0; + vec[1] = 1.0 / tex->height0; break; default: -- cgit v1.2.3 From 7fa1bcc05a237365e5ea09512453f29a91c7a141 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 27 Nov 2009 17:41:42 +0100 Subject: svga: fix for not using texture width/height/depth arrays --- src/gallium/drivers/svga/svga_screen_texture.c | 61 ++++++++++++------------- src/gallium/drivers/svga/svga_state_constants.c | 4 +- 2 files changed, 32 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_screen_texture.c b/src/gallium/drivers/svga/svga_screen_texture.c index 8472dea04d..fb11b80dcf 100644 --- a/src/gallium/drivers/svga/svga_screen_texture.c +++ b/src/gallium/drivers/svga/svga_screen_texture.c @@ -287,23 +287,20 @@ svga_texture_create(struct pipe_screen *screen, if(templat->last_level >= SVGA_MAX_TEXTURE_LEVELS) goto error2; - width = templat->width[0]; - height = templat->height[0]; - depth = templat->depth[0]; + width = templat->width0; + height = templat->height0; + depth = templat->depth0; for(level = 0; level <= templat->last_level; ++level) { - tex->base.width[level] = width; - tex->base.height[level] = height; - tex->base.depth[level] = depth; tex->base.nblocksx[level] = pf_get_nblocksx(&tex->base.block, width); tex->base.nblocksy[level] = pf_get_nblocksy(&tex->base.block, height); - width = minify(width); - height = minify(height); - depth = minify(depth); + width = u_minify(width, 1); + height = u_minify(height, 1); + depth = u_minify(depth, 1); } - size.width = templat->width[0]; - size.height = templat->height[0]; - size.depth = templat->depth[0]; + size.width = templat->width0; + size.height = templat->height0; + size.depth = templat->depth0; if(templat->target == PIPE_TEXTURE_CUBE) { flags |= SVGA3D_SURFACE_CUBEMAP; @@ -367,7 +364,7 @@ svga_texture_blanket(struct pipe_screen * screen, /* Only supports one type */ if (base->target != PIPE_TEXTURE_2D || base->last_level != 0 || - base->depth[0] != 1) { + base->depth0 != 1) { return NULL; } @@ -534,9 +531,9 @@ svga_texture_view_surface(struct pipe_context *pipe, "svga: Create surface view: face %d zslice %d mips %d..%d\n", face_pick, zslice_pick, start_mip, start_mip+num_mip-1); - size.width = tex->base.width[start_mip]; - size.height = tex->base.height[start_mip]; - size.depth = zslice_pick < 0 ? tex->base.depth[start_mip] : 1; + size.width = u_minify(tex->base.width0, start_mip); + size.height = u_minify(tex->base.height0, start_mip); + size.depth = zslice_pick < 0 ? u_minify(tex->base.depth0, start_mip) : 1; assert(size.depth == 1); if(tex->base.target == PIPE_TEXTURE_CUBE && face_pick < 0) { @@ -565,11 +562,12 @@ svga_texture_view_surface(struct pipe_context *pipe, for (i = 0; i < num_mip; i++) { for (j = 0; j < numFaces; j++) { if(tex->defined[j + face_pick][i + start_mip]) { - unsigned depth = zslice_pick < 0 ? tex->base.depth[i + start_mip] : 1; + unsigned depth = zslice_pick < 0 ? u_minify(tex->base.depth0, i + start_mip) : 1; svga_texture_copy_handle(svga_context(pipe), ss, tex->handle, 0, 0, z_offset, i + start_mip, j + face_pick, handle, 0, 0, 0, i, j, - tex->base.width[i + start_mip], tex->base.height[i + start_mip], depth); + u_minify(tex->base.width0, i + start_mip), + u_minify(tex->base.height0, i + start_mip), depth); } } } @@ -599,8 +597,8 @@ svga_get_tex_surface(struct pipe_screen *screen, pipe_reference_init(&ps->reference, 1); pipe_texture_reference(&ps->texture, pt); ps->format = pt->format; - ps->width = pt->width[level]; - ps->height = pt->height[level]; + ps->width = u_minify(pt->width0, level); + ps->height = u_minify(pt->height0, level); ps->usage = flags; ps->level = level; ps->face = face; @@ -723,7 +721,8 @@ svga_propagate_surface(struct pipe_context *pipe, struct pipe_surface *surf) svga_texture_copy_handle(svga_context(pipe), ss, s->handle, 0, 0, 0, s->real_level, s->real_face, tex->handle, 0, 0, surf->zslice, surf->level, surf->face, - tex->base.width[surf->level], tex->base.height[surf->level], 1); + u_minify(tex->base.width0, surf->level), + u_minify(tex->base.height0, surf->level), 1); tex->defined[surf->face][surf->level] = TRUE; } } @@ -953,9 +952,9 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt, "svga: Sampler view: no %p, mips %u..%u, nr %u, size (%ux%ux%u), last %u\n", pt, min_lod, max_lod, max_lod - min_lod + 1, - pt->width[0], - pt->height[0], - pt->depth[0], + pt->width0, + pt->height0, + pt->depth0, pt->last_level); sws->surface_reference(sws, &sv->handle, tex->handle); return sv; @@ -965,9 +964,9 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt, "svga: Sampler view: yes %p, mips %u..%u, nr %u, size (%ux%ux%u), last %u\n", pt, min_lod, max_lod, max_lod - min_lod + 1, - pt->width[0], - pt->height[0], - pt->depth[0], + pt->width0, + pt->height0, + pt->depth0, pt->last_level); sv->age = tex->age; @@ -1015,9 +1014,9 @@ svga_validate_sampler_view(struct svga_context *svga, struct svga_sampler_view * svga_texture_copy_handle(svga, NULL, tex->handle, 0, 0, 0, i, k, v->handle, 0, 0, 0, i - v->min_lod, k, - tex->base.width[i], - tex->base.height[i], - tex->base.depth[i]); + u_minify(tex->base.width0, i), + u_minify(tex->base.height0, i), + u_minify(tex->base.depth0, i)); } } @@ -1047,7 +1046,7 @@ svga_screen_buffer_from_texture(struct pipe_texture *texture, svga_translate_format(texture->format), stex->handle); - *stride = pf_get_nblocksx(&texture->block, texture->width[0]) * + *stride = pf_get_nblocksx(&texture->block, texture->width0) * texture->block.size; return *buffer != NULL; diff --git a/src/gallium/drivers/svga/svga_state_constants.c b/src/gallium/drivers/svga/svga_state_constants.c index 18cce7dde1..209ed28245 100644 --- a/src/gallium/drivers/svga/svga_state_constants.c +++ b/src/gallium/drivers/svga/svga_state_constants.c @@ -140,8 +140,8 @@ static int emit_fs_consts( struct svga_context *svga, struct pipe_texture *tex = svga->curr.texture[i]; float data[4]; - data[0] = 1.0 / (float)tex->width[0]; - data[1] = 1.0 / (float)tex->height[0]; + data[0] = 1.0 / (float)tex->width0; + data[1] = 1.0 / (float)tex->height0; data[2] = 1.0; data[3] = 1.0; -- cgit v1.2.3 From f62f976e3ff9ff83d760e706c615e098d131e103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 27 Nov 2009 15:58:02 +0000 Subject: mesa: Avoid void pointer arithmetic. --- src/mesa/main/texgetimage.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texgetimage.c b/src/mesa/main/texgetimage.c index 008407210d..23765d2753 100644 --- a/src/mesa/main/texgetimage.c +++ b/src/mesa/main/texgetimage.c @@ -554,7 +554,8 @@ _mesa_get_compressed_teximage(GLcontext *ctx, GLenum target, GLint level, GLuint bw, bh; _mesa_get_format_block_size(texImage->TexFormat, &bw, &bh); for (i = 0; i < (texImage->Height + bh - 1) / bh; i++) { - memcpy(img + i * row_stride, texImage->Data + i * row_stride_stored, row_stride); + memcpy((GLubyte *)img + i * row_stride, + (GLubyte *)texImage->Data + i * row_stride_stored, row_stride); } } -- cgit v1.2.3 From e65258abf52bd1923a547f76bd7346bf5ed1c5c6 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Thu, 26 Nov 2009 16:58:59 +0100 Subject: gallium/util: added util_bswap32() --- src/gallium/auxiliary/util/u_math.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index b7fc0586f3..7e75702701 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -510,6 +510,23 @@ util_bitcount(unsigned n) } +/** + * Reverse byte order of a 32 bit word. + */ +static INLINE uint32_t +util_bswap32(uint32_t n) +{ +#if defined(PIPE_CC_GCC) + return __builtin_bswap32(n); +#else + return (n >> 24) | + ((n >> 8) & 0x0000ff00) | + ((n << 8) & 0x00ff0000) | + (n << 24); +#endif +} + + /** * Clamp X to [MIN, MAX]. * This is a macro to allow float, int, uint, etc. types. -- cgit v1.2.3 From 510fd280b54fa33ed229ef297a1a77c78811c592 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Thu, 26 Nov 2009 16:59:39 +0100 Subject: nv50: bswap32 the polygon stipple pattern The hardware wants the pattern the same way it is passed to glPolygonStipple. --- src/gallium/drivers/nv50/nv50_state_validate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index 799d2758fe..19b8ef07b5 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -285,7 +285,7 @@ nv50_state_validate(struct nv50_context *nv50) so = so_new(33, 0); so_method(so, tesla, NV50TCL_POLYGON_STIPPLE_PATTERN(0), 32); for (i = 0; i < 32; i++) - so_data(so, nv50->stipple.stipple[i]); + so_data(so, util_bswap32(nv50->stipple.stipple[i])); so_ref(so, &nv50->state.stipple); so_ref(NULL, &so); } -- cgit v1.2.3 From cad14c2542698de144bb5434cefa02d7a00aaa74 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Fri, 27 Nov 2009 21:29:38 +0100 Subject: nv50: do conversion of last insn to 64 bit format first Simplifies things since the second to last one will then be converted in the subsequent pass that ensures alignment automatically. --- src/gallium/drivers/nv50/nv50_program.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index bf50982dd1..855079f293 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -2914,7 +2914,7 @@ nv50_fp_move_results(struct nv50_pc *pc) static void nv50_program_fixup_insns(struct nv50_pc *pc) { - struct nv50_program_exec *e, *prev = NULL, **bra_list; + struct nv50_program_exec *e, **bra_list; unsigned i, n, pos; bra_list = CALLOC(pc->p->exec_size, sizeof(struct nv50_program_exec *)); @@ -2926,6 +2926,16 @@ nv50_program_fixup_insns(struct nv50_pc *pc) if (e->param.index >= 0 && !e->param.mask) bra_list[n++] = e; + /* last instruction must be long so it can have the exit bit set */ + if (!is_long(pc->p->exec_tail)) + convert_to_long(pc, pc->p->exec_tail); + /* set exit bit */ + pc->p->exec_tail->inst[1] |= 1; + + /* !immd on exit insn simultaneously means !join */ + assert(!is_immd(pc->p->exec_head)); + assert(!is_immd(pc->p->exec_tail)); + /* Make sure we don't have any single 32 bit instructions. */ for (e = pc->p->exec_head, pos = 0; e; e = e->next) { pos += is_long(e) ? 2 : 1; @@ -2937,23 +2947,8 @@ nv50_program_fixup_insns(struct nv50_pc *pc) convert_to_long(pc, e); ++pos; } - if (e->next) - prev = e; } - assert(!is_immd(pc->p->exec_head)); - assert(!is_immd(pc->p->exec_tail)); - - /* last instruction must be long so it can have the end bit set */ - if (!is_long(pc->p->exec_tail)) { - convert_to_long(pc, pc->p->exec_tail); - if (prev) - convert_to_long(pc, prev); - } - assert(!(pc->p->exec_tail->inst[1] & 2)); - /* set the end-bit */ - pc->p->exec_tail->inst[1] |= 1; - FREE(bra_list); } -- cgit v1.2.3 From c93dcbfea7b8e1cd0f14a96bc466419bdce7eb30 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 28 Nov 2009 10:13:51 -0800 Subject: util: Improve bitcount. Sorry for not pushing this before, it got lost in stashes. --- src/gallium/auxiliary/util/u_math.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index 7e75702701..c4faec671c 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -499,11 +499,15 @@ util_bitcount(unsigned n) #if defined(PIPE_CC_GCC) return __builtin_popcount(n); #else - /* XXX there are more clever ways of doing this */ + /* K&R classic bitcount. + * + * For each iteration, clear the LSB from the bitfield. + * Requires only one iteration per set bit, instead of + * one iteration per bit less than highest set bit. + */ unsigned bits = 0; - while (n) { - bits += (n & 1); - n = n >> 1; + for (bits, n, bits++) { + n &= n - 1; } return bits; #endif -- cgit v1.2.3 From 287bdd8e75aa3b2c20f50de359711158981dfa09 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sat, 28 Nov 2009 10:45:17 -0800 Subject: util: Fix bad code. Uf. How embarrassing. --- src/gallium/auxiliary/util/u_math.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index c4faec671c..a5cd6574c0 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -506,7 +506,7 @@ util_bitcount(unsigned n) * one iteration per bit less than highest set bit. */ unsigned bits = 0; - for (bits, n, bits++) { + for (bits; n; bits++) { n &= n - 1; } return bits; -- cgit v1.2.3 From e5159996a43d64f71d44dd2bd477d10e37ec9a27 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 28 Nov 2009 21:31:24 +0100 Subject: radeon: need to flush cs when moving images between mipmap trees --- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index 46603de2e7..94211048ae 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -594,6 +594,10 @@ int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *t if (RADEON_DEBUG & RADEON_TEXTURE) { fprintf(stderr, "MIGRATING\n"); } + struct radeon_bo *src_bo = (img->mt) ? img->mt->bo : img->bo; + if (src_bo && radeon_bo_is_referenced_by_cs(src_bo, rmesa->cmdbuf.cs)) { + radeon_firevertices(rmesa); + } migrate_image_to_miptree(dst_miptree, img, face, radeon_gl_level_to_miptree_level(texObj, level)); } else if (RADEON_DEBUG & RADEON_TEXTURE) { fprintf(stderr, "OK\n"); -- cgit v1.2.3 From a11d60d14caf8efc07f70af63b57b33273f8cf9b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 28 Nov 2009 22:04:06 -0500 Subject: mesa: Fix array out-of-bounds access in _mesa_TexEnvf. _mesa_TexEnvf calls _mesa_TexEnvfv, which uses the param argument as an array. --- src/mesa/main/texenv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c index 6d86a4275c..4442fb8cf8 100644 --- a/src/mesa/main/texenv.c +++ b/src/mesa/main/texenv.c @@ -598,7 +598,10 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) void GLAPIENTRY _mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param ) { - _mesa_TexEnvfv( target, pname, ¶m ); + GLfloat p[4]; + p[0] = param; + p[1] = p[2] = p[3] = 0.0; + _mesa_TexEnvfv( target, pname, p ); } -- cgit v1.2.3 From 919898e92fa23ff71a59d86a46ff0886a6f34e4d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 28 Nov 2009 23:22:31 -0500 Subject: dri: Fix potential null pointer dereference in driBindContext. --- src/mesa/drivers/dri/common/dri_util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 439f66a7b8..da81ec9de5 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -167,11 +167,12 @@ static int driBindContext(__DRIcontext *pcp, __DRIdrawable *pdp, __DRIdrawable *prp) { - __DRIscreenPrivate *psp = pcp->driScreenPriv; + __DRIscreenPrivate *psp; /* Bind the drawable to the context */ if (pcp) { + psp = pcp->driScreenPriv; pcp->driDrawablePriv = pdp; pcp->driReadablePriv = prp; if (pdp) { -- cgit v1.2.3 From d55fb7c835b56951f05a058083e7eda264ba192e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 28 Nov 2009 23:47:23 -0500 Subject: mesa: Fix array out-of-bounds access by _mesa_TexGeni. _mesa_TexGeni calls _mesa_TexGeniv, which uses the params argument as an array. --- src/mesa/main/texgen.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c index 733e129fcf..087f66bbf3 100644 --- a/src/mesa/main/texgen.c +++ b/src/mesa/main/texgen.c @@ -218,7 +218,10 @@ _mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ) void GLAPIENTRY _mesa_TexGeni( GLenum coord, GLenum pname, GLint param ) { - _mesa_TexGeniv( coord, pname, ¶m ); + GLint p[4]; + p[0] = param; + p[1] = p[2] = p[3] = 0; + _mesa_TexGeniv( coord, pname, p ); } -- cgit v1.2.3 From ca5a7aadb4361e7d053aea8687372cd44cbd8795 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 29 Nov 2009 00:50:48 -0500 Subject: mesa: Fix array out-of-bounds access by _mesa_TexGenf. _mesa_TexGenf calls _mesa_TexGenfv, which uses the params argument as an array. --- src/mesa/main/texgen.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c index 087f66bbf3..5abb1ff0ab 100644 --- a/src/mesa/main/texgen.c +++ b/src/mesa/main/texgen.c @@ -211,7 +211,10 @@ _mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) static void GLAPIENTRY _mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ) { - _mesa_TexGenfv(coord, pname, ¶m); + GLfloat p[4]; + p[0] = param; + p[1] = p[2] = p[3] = 0.0F; + _mesa_TexGenfv(coord, pname, p); } -- cgit v1.2.3 From 3f471c7948425a9c8ae23a563e0e816954a7589a Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Thu, 26 Nov 2009 17:03:00 +0100 Subject: nv50: don't permanently negate src in emit_ddy --- src/gallium/drivers/nv50/nv50_program.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index 855079f293..f93c864c2a 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -1440,19 +1440,25 @@ emit_ddx(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src) static void emit_ddy(struct nv50_pc *pc, struct nv50_reg *dst, struct nv50_reg *src) { + struct nv50_reg *r = src; struct nv50_program_exec *e = exec(pc); assert(src->type == P_TEMP); - if (!(src->mod & NV50_MOD_NEG)) /* ! double negation */ - emit_neg(pc, src, src); + if (!(src->mod & NV50_MOD_NEG)) { /* ! double negation */ + r = alloc_temp(pc, NULL); + emit_neg(pc, r, src); + } e->inst[0] = 0xc0150000; e->inst[1] = 0x8a400000; set_long(pc, e); set_dst(pc, dst, e); - set_src_0(pc, src, e); - set_src_2(pc, src, e); + set_src_0(pc, r, e); + set_src_2(pc, r, e); + + if (r != src) + free_temp(pc, r); emit(pc, e); } -- cgit v1.2.3 From 7494b829052a87d7a8c56c68300a110b40e401e8 Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sun, 29 Nov 2009 13:33:16 +0100 Subject: nv50: match VP outputs to FP inputs ourselves For each FP input, don't assume that the VP output will be at the same position, but scan the semantics instead, then put the correct output reg indices into VP_RESULT_MAP. Position is still assumed to be the first output/input. See 07fafc7c9346aa260829603bf3188596481e9e62, which renders previous assumptions incorrect. --- src/gallium/drivers/nv50/nv50_program.c | 70 ++++++++++++++++++--------------- src/gallium/drivers/nv50/nv50_program.h | 3 +- 2 files changed, 40 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_program.c b/src/gallium/drivers/nv50/nv50_program.c index f93c864c2a..bad0ace7e5 100644 --- a/src/gallium/drivers/nv50/nv50_program.c +++ b/src/gallium/drivers/nv50/nv50_program.c @@ -2643,7 +2643,7 @@ nv50_program_tx_prep(struct nv50_pc *pc) for (i = 0, rid = 0; i < pc->result_nr; ++i) { p->cfg.io[i].hw = rid; - p->cfg.io[i].id_vp = i; + p->cfg.io[i].id = i; for (c = 0; c < 4; ++c) { int n = i * 4 + c; @@ -2675,14 +2675,12 @@ nv50_program_tx_prep(struct nv50_pc *pc) * the lower hardware IDs, so sort them: */ for (i = 0; i < pc->attr_nr; i++) { - if (pc->interp_mode[i] == INTERP_FLAT) { - p->cfg.io[m].id_vp = i + base; - p->cfg.io[m++].id_fp = i; - } else { + if (pc->interp_mode[i] == INTERP_FLAT) + p->cfg.io[m++].id = i; + else { if (!(pc->interp_mode[i] & INTERP_PERSPECTIVE)) p->cfg.io[n].linear = TRUE; - p->cfg.io[n].id_vp = i + base; - p->cfg.io[n++].id_fp = i; + p->cfg.io[n++].id = i; } } @@ -2694,7 +2692,7 @@ nv50_program_tx_prep(struct nv50_pc *pc) for (n = 0; n < pc->attr_nr; ++n) { p->cfg.io[n].hw = rid = aid; - i = p->cfg.io[n].id_fp; + i = p->cfg.io[n].id; if (p->info.input_semantic_name[n] == TGSI_SEMANTIC_FACE) { @@ -2734,8 +2732,8 @@ nv50_program_tx_prep(struct nv50_pc *pc) for (i = 0; i < pc->attr_nr; i++) { ubyte si, sn; - sn = p->info.input_semantic_name[p->cfg.io[i].id_fp]; - si = p->info.input_semantic_index[p->cfg.io[i].id_fp]; + sn = p->info.input_semantic_name[p->cfg.io[i].id]; + si = p->info.input_semantic_index[p->cfg.io[i].id]; if (sn == TGSI_SEMANTIC_COLOR) { p->cfg.two_side[si] = p->cfg.io[i]; @@ -3237,15 +3235,15 @@ nv50_pntc_replace(struct nv50_context *nv50, uint32_t pntc[8], unsigned base) struct nv50_program *vp = nv50->vertprog; unsigned i, c, m = base; - /* XXX: This can't work correctly in all cases yet, we either - * have to create TGSI_SEMANTIC_PNTC or sprite_coord_mode has - * to be per FP input instead of per VP output + /* XXX: this might not work correctly in all cases yet - we'll + * just assume that an FP generic input that is not written in + * the VP is PointCoord. */ memset(pntc, 0, 8 * sizeof(uint32_t)); for (i = 0; i < fp->cfg.io_nr; i++) { uint8_t sn, si; - uint8_t j = fp->cfg.io[i].id_vp, k = fp->cfg.io[i].id_fp; + uint8_t j, k = fp->cfg.io[i].id; unsigned n = popcnt4(fp->cfg.io[i].mask); if (fp->info.input_semantic_name[k] != TGSI_SEMANTIC_GENERIC) { @@ -3253,10 +3251,16 @@ nv50_pntc_replace(struct nv50_context *nv50, uint32_t pntc[8], unsigned base) continue; } - sn = vp->info.input_semantic_name[j]; - si = vp->info.input_semantic_index[j]; + for (j = 0; j < vp->info.num_outputs; ++j) { + sn = vp->info.output_semantic_name[j]; + si = vp->info.output_semantic_index[j]; - if (j < fp->cfg.io_nr && sn == TGSI_SEMANTIC_GENERIC) { + if (sn == fp->info.input_semantic_name[k] && + si == fp->info.input_semantic_index[k]) + break; + } + + if (j < vp->info.num_outputs) { ubyte mode = nv50->rasterizer->pipe.sprite_coord_mode[si]; @@ -3344,20 +3348,24 @@ nv50_linkage_validate(struct nv50_context *nv50) reg[0] += m - 4; /* adjust FFC0 id */ reg[4] |= m << 8; /* set mid where 'normal' FP inputs start */ - i = 0; - if (fp->info.input_semantic_name[0] == TGSI_SEMANTIC_POSITION) - i = 1; - for (; i < fp->cfg.io_nr; i++) { - ubyte sn = fp->info.input_semantic_name[fp->cfg.io[i].id_fp]; - ubyte si = fp->info.input_semantic_index[fp->cfg.io[i].id_fp]; - - n = fp->cfg.io[i].id_vp; - if (n >= vp->cfg.io_nr || - vp->info.output_semantic_name[n] != sn || - vp->info.output_semantic_index[n] != si) - vpo = &dummy; - else - vpo = &vp->cfg.io[n]; + for (i = 0; i < fp->cfg.io_nr; i++) { + ubyte sn = fp->info.input_semantic_name[fp->cfg.io[i].id]; + ubyte si = fp->info.input_semantic_index[fp->cfg.io[i].id]; + + /* position must be mapped first */ + assert(i == 0 || sn != TGSI_SEMANTIC_POSITION); + + /* maybe even remove these from cfg.io */ + if (sn == TGSI_SEMANTIC_POSITION || sn == TGSI_SEMANTIC_FACE) + continue; + + /* VP outputs and vp->cfg.io are in the same order */ + for (n = 0; n < vp->info.num_outputs; ++n) { + if (vp->info.output_semantic_name[n] == sn && + vp->info.output_semantic_index[n] == si) + break; + } + vpo = (n < vp->info.num_outputs) ? &vp->cfg.io[n] : &dummy; m = nv50_sreg4_map(map, m, lin, &fp->cfg.io[i], vpo); } diff --git a/src/gallium/drivers/nv50/nv50_program.h b/src/gallium/drivers/nv50/nv50_program.h index d78dee083f..255c7c737e 100644 --- a/src/gallium/drivers/nv50/nv50_program.h +++ b/src/gallium/drivers/nv50/nv50_program.h @@ -17,8 +17,7 @@ struct nv50_program_exec { struct nv50_sreg4 { uint8_t hw; - uint8_t id_vp; - uint8_t id_fp; + uint8_t id; /* tgsi index, nv50 needs them sorted: flat ones last */ uint8_t mask; boolean linear; -- cgit v1.2.3 From c332525ad3cf8e946e60c3f9b96af525ca4cb71c Mon Sep 17 00:00:00 2001 From: Christoph Bumiller Date: Sat, 28 Nov 2009 13:57:38 +0100 Subject: nv50: update linkage on rasterizer change We need to update VP_RESULT_MAP and/or COORD_REPLACE_MAP when light_twoside and/or point_sprite are changed. --- src/gallium/drivers/nv50/nv50_state_validate.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv50/nv50_state_validate.c b/src/gallium/drivers/nv50/nv50_state_validate.c index 19b8ef07b5..c871acaab8 100644 --- a/src/gallium/drivers/nv50/nv50_state_validate.c +++ b/src/gallium/drivers/nv50/nv50_state_validate.c @@ -201,7 +201,8 @@ nv50_state_emit(struct nv50_context *nv50) so_emit(chan, nv50->state.vertprog); if (nv50->state.dirty & NV50_NEW_FRAGPROG) so_emit(chan, nv50->state.fragprog); - if (nv50->state.dirty & (NV50_NEW_FRAGPROG | NV50_NEW_VERTPROG)) + if (nv50->state.dirty & (NV50_NEW_FRAGPROG | NV50_NEW_VERTPROG | + NV50_NEW_RASTERIZER)) so_emit(chan, nv50->state.programs); if (nv50->state.dirty & NV50_NEW_RASTERIZER) so_emit(chan, nv50->state.rast); @@ -264,7 +265,8 @@ nv50_state_validate(struct nv50_context *nv50) if (nv50->dirty & (NV50_NEW_FRAGPROG | NV50_NEW_FRAGPROG_CB)) nv50_fragprog_validate(nv50); - if (nv50->dirty & (NV50_NEW_FRAGPROG | NV50_NEW_VERTPROG)) + if (nv50->dirty & (NV50_NEW_FRAGPROG | NV50_NEW_VERTPROG | + NV50_NEW_RASTERIZER)) nv50_linkage_validate(nv50); if (nv50->dirty & NV50_NEW_RASTERIZER) -- cgit v1.2.3 From e8f0c8ab9d3509dc399ea58c320056ed90895792 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 29 Nov 2009 12:27:29 +0100 Subject: radeon: add some debugging info --- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 5 +++++ src/mesa/drivers/dri/radeon/radeon_texture.c | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index 94211048ae..d0b9691204 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -576,6 +576,11 @@ int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *t radeon_miptree_unreference(&t->mt); radeon_try_alloc_miptree(rmesa, t); dst_miptree = t->mt; + if (RADEON_DEBUG & RADEON_TEXTURE) { + fprintf(stderr, "%s: No matching miptree found, allocated new one %p\n", __FUNCTION__, t->mt); + } + } else if (RADEON_DEBUG & RADEON_TEXTURE) { + fprintf(stderr, "%s: Using miptree %p\n", __FUNCTION__, t->mt); } const unsigned faces = texObj->Target == GL_TEXTURE_CUBE_MAP ? 6 : 1; diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 1ee9e2792a..c715650d55 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -523,6 +523,11 @@ static void teximage_assign_miptree(radeonContextPtr rmesa, radeon_gl_level_to_miptree_level(texObj, level))) { radeon_miptree_unreference(&t->mt); radeon_try_alloc_miptree(rmesa, t); + if (RADEON_DEBUG & RADEON_TEXTURE) { + fprintf(stderr, "%s: texObj %p, texImage %p, face %d, level %d, " + "texObj miptree doesn't match, allocated new miptree %p\n", + __FUNCTION__, texObj, texImage, face, level, t->mt); + } } /* Miptree alocation may have failed, @@ -670,6 +675,11 @@ static void radeon_teximage( } } + if (RADEON_DEBUG & RADEON_TEXTURE) { + fprintf(stderr, "radeon_teximage%dd: texObj %p, texImage %p, face %d, level %d\n", + dims, texObj, texImage, face, level); + } + t->validated = GL_FALSE; if (ctx->_ImageTransferState & IMAGE_CONVOLUTION_BIT) { @@ -700,6 +710,11 @@ static void radeon_teximage( texImage->Height, texImage->Depth); texImage->Data = _mesa_alloc_texmemory(size); + if (RADEON_DEBUG & RADEON_TEXTURE) { + fprintf(stderr, "radeon_teximage%dd: texObj %p, texImage %p, " + " no miptree assigned, using local memory %p\n", + dims, texObj, texImage, texImage->Data); + } } } @@ -801,6 +816,11 @@ static void radeon_texsubimage(GLcontext* ctx, int dims, GLenum target, int leve } } + if (RADEON_DEBUG & RADEON_TEXTURE) { + fprintf(stderr, "radeon_texsubimage%dd: texObj %p, texImage %p, face %d, level %d\n", + dims, texObj, texImage, radeon_face_for_target(target), level); + } + t->validated = GL_FALSE; if (compressed) { pixels = _mesa_validate_pbo_compressed_teximage( -- cgit v1.2.3 From 2773556d55fe6043bee3d4c86f7b78906e5d60e0 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 29 Nov 2009 12:36:09 +0100 Subject: radeon: don't check the same miptree many times when looking for matching miptrees --- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index d0b9691204..39b6d50094 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -506,7 +506,7 @@ static radeon_mipmap_tree * get_biggest_matching_miptree(radeonTexObj *texObj, if (!img) break; - if (!img->mt || !radeon_miptree_matches_texture(img->mt, &texObj->base)) + if (!img->mt) continue; for (int i = 0; i < mtCount; ++i) { @@ -517,8 +517,8 @@ static radeon_mipmap_tree * get_biggest_matching_miptree(radeonTexObj *texObj, } } - if (!found) { - mtSizes[mtCount] += img->mt->levels[img->mtlevel].size; + if (!found && radeon_miptree_matches_texture(img->mt, &texObj->base)) { + mtSizes[mtCount] = img->mt->levels[img->mtlevel].size; mts[mtCount] = img->mt; mtCount++; } -- cgit v1.2.3 From 63c00c53a3019b801c5eee8a12f7862422f79f10 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 29 Nov 2009 15:40:13 +0100 Subject: radeon: update miptree code a little Simplify gl image level <-> miptree level mapping (are equal now). Don't allocate miptree for images that won't fit in it (fixes #25230). --- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 70 +++++++++--------------- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h | 10 ++-- src/mesa/drivers/dri/radeon/radeon_texture.c | 36 ++++++++++-- 3 files changed, 61 insertions(+), 55 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index 39b6d50094..a9d601a0b5 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -124,20 +124,19 @@ static GLuint minify(GLuint size, GLuint levels) static void calculate_miptree_layout_r100(radeonContextPtr rmesa, radeon_mipmap_tree *mt) { - GLuint curOffset; - GLuint i; - GLuint face; + GLuint curOffset, i, face, level; assert(mt->numLevels <= rmesa->glCtx->Const.MaxTextureLevels); curOffset = 0; for(face = 0; face < mt->faces; face++) { - for(i = 0; i < mt->numLevels; i++) { - mt->levels[i].width = minify(mt->width0, i); - mt->levels[i].height = minify(mt->height0, i); - mt->levels[i].depth = minify(mt->depth0, i); - compute_tex_image_offset(rmesa, mt, face, i, &curOffset); + for(i = 0, level = mt->baseLevel; i < mt->numLevels; i++, level++) { + mt->levels[level].valid = 1; + mt->levels[level].width = minify(mt->width0, i); + mt->levels[level].height = minify(mt->height0, i); + mt->levels[level].depth = minify(mt->depth0, i); + compute_tex_image_offset(rmesa, mt, face, level, &curOffset); } } @@ -147,21 +146,21 @@ static void calculate_miptree_layout_r100(radeonContextPtr rmesa, radeon_mipmap_ static void calculate_miptree_layout_r300(radeonContextPtr rmesa, radeon_mipmap_tree *mt) { - GLuint curOffset; - GLuint i; + GLuint curOffset, i, level; assert(mt->numLevels <= rmesa->glCtx->Const.MaxTextureLevels); curOffset = 0; - for(i = 0; i < mt->numLevels; i++) { + for(i = 0, level = mt->baseLevel; i < mt->numLevels; i++, level++) { GLuint face; - mt->levels[i].width = minify(mt->width0, i); - mt->levels[i].height = minify(mt->height0, i); - mt->levels[i].depth = minify(mt->depth0, i); + mt->levels[level].valid = 1; + mt->levels[level].width = minify(mt->width0, i); + mt->levels[level].height = minify(mt->height0, i); + mt->levels[level].depth = minify(mt->depth0, i); for(face = 0; face < mt->faces; face++) - compute_tex_image_offset(rmesa, mt, face, i, &curOffset); + compute_tex_image_offset(rmesa, mt, face, level, &curOffset); } /* Note the required size in memory */ @@ -277,18 +276,19 @@ static void calculate_min_max_lod(struct gl_texture_object *tObj, * given face and level. */ GLboolean radeon_miptree_matches_image(radeon_mipmap_tree *mt, - struct gl_texture_image *texImage, GLuint face, GLuint mtLevel) + struct gl_texture_image *texImage, GLuint face, GLuint level) { radeon_mipmap_level *lvl; - if (face >= mt->faces || mtLevel > mt->numLevels) + if (face >= mt->faces) return GL_FALSE; if (texImage->TexFormat != mt->mesaFormat) return GL_FALSE; - lvl = &mt->levels[mtLevel]; - if (lvl->width != texImage->Width || + lvl = &mt->levels[level]; + if (!lvl->valid || + lvl->width != texImage->Width || lvl->height != texImage->Height || lvl->depth != texImage->Depth) return GL_FALSE; @@ -393,39 +393,18 @@ radeon_miptree_image_offset(radeon_mipmap_tree *mt, return mt->levels[level].faces[0].offset; } -/** - * Convert radeon miptree texture level to GL texture level - * @param[in] tObj texture object whom level is to be converted - * @param[in] level radeon miptree texture level - * @return GL texture level - */ -unsigned radeon_miptree_level_to_gl_level(struct gl_texture_object *tObj, unsigned level) -{ - return level + tObj->BaseLevel; -} - -/** - * Convert GL texture level to radeon miptree texture level - * @param[in] tObj texture object whom level is to be converted - * @param[in] level GL texture level - * @return radeon miptree texture level - */ -unsigned radeon_gl_level_to_miptree_level(struct gl_texture_object *tObj, unsigned level) -{ - return level - tObj->BaseLevel; -} - /** * Ensure that the given image is stored in the given miptree from now on. */ static void migrate_image_to_miptree(radeon_mipmap_tree *mt, radeon_texture_image *image, - int face, int mtLevel) + int face, int level) { - radeon_mipmap_level *dstlvl = &mt->levels[mtLevel]; + radeon_mipmap_level *dstlvl = &mt->levels[level]; unsigned char *dest; assert(image->mt != mt); + assert(dstlvl->valid); assert(dstlvl->width == image->base.Width); assert(dstlvl->height == image->base.Height); assert(dstlvl->depth == image->base.Depth); @@ -442,6 +421,7 @@ static void migrate_image_to_miptree(radeon_mipmap_tree *mt, radeon_mipmap_level *srclvl = &image->mt->levels[image->mtlevel]; + assert(image->mtlevel == level); assert(srclvl->size == dstlvl->size); assert(srclvl->rowstride == dstlvl->rowstride); @@ -479,7 +459,7 @@ static void migrate_image_to_miptree(radeon_mipmap_tree *mt, radeon_miptree_reference(mt, &image->mt); image->mtface = face; - image->mtlevel = mtLevel; + image->mtlevel = level; } /** @@ -603,7 +583,7 @@ int radeon_validate_texture_miptree(GLcontext * ctx, struct gl_texture_object *t if (src_bo && radeon_bo_is_referenced_by_cs(src_bo, rmesa->cmdbuf.cs)) { radeon_firevertices(rmesa); } - migrate_image_to_miptree(dst_miptree, img, face, radeon_gl_level_to_miptree_level(texObj, level)); + migrate_image_to_miptree(dst_miptree, img, face, level); } else if (RADEON_DEBUG & RADEON_TEXTURE) { fprintf(stderr, "OK\n"); } diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h index 28b8485095..a10649b5ae 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.h @@ -44,6 +44,7 @@ struct _radeon_mipmap_level { GLuint depth; GLuint size; /** Size of each image, in bytes */ GLuint rowstride; /** in bytes */ + GLuint valid; radeon_mipmap_image faces[6]; }; @@ -70,9 +71,9 @@ struct _radeon_mipmap_tree { GLuint baseLevel; /** gl_texture_object->baseLevel it was created for */ GLuint numLevels; /** Number of mip levels stored in this mipmap tree */ - GLuint width0; /** Width of firstLevel image */ - GLuint height0; /** Height of firstLevel image */ - GLuint depth0; /** Depth of firstLevel image */ + GLuint width0; /** Width of baseLevel image */ + GLuint height0; /** Height of baseLevel image */ + GLuint depth0; /** Depth of baseLevel image */ GLuint tilebits; /** RADEON_TXO_xxx_TILE */ @@ -89,8 +90,5 @@ GLuint radeon_miptree_image_offset(radeon_mipmap_tree *mt, GLuint face, GLuint level); void radeon_miptree_depth_offsets(radeon_mipmap_tree *mt, GLuint level, GLuint *offsets); -unsigned radeon_miptree_level_to_gl_level(struct gl_texture_object *tObj, unsigned level); -unsigned radeon_gl_level_to_miptree_level(struct gl_texture_object *tObj, unsigned level); - uint32_t get_base_teximage_offset(radeonTexObj *texObj); #endif /* __RADEON_MIPMAP_TREE_H_ */ diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index c715650d55..0390d376ba 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -509,6 +509,27 @@ gl_format radeonChooseTextureFormat(GLcontext * ctx, return MESA_FORMAT_NONE; /* never get here */ } +/** Check if given image is valid within current texture object. + */ +static int image_matches_texture_obj(struct gl_texture_object *texObj, + struct gl_texture_image *texImage, + unsigned level) +{ + const struct gl_texture_image *baseImage = texObj->Image[0][level]; + + if (level < texObj->BaseLevel || level > texObj->MaxLevel) + return 0; + + const unsigned levelDiff = level - texObj->BaseLevel; + const unsigned refWidth = baseImage->Width >> levelDiff; + const unsigned refHeight = baseImage->Height >> levelDiff; + const unsigned refDepth = baseImage->Depth >> levelDiff; + + return (texImage->Width == refWidth && + texImage->Height == refHeight && + texImage->Depth == refDepth); +} + static void teximage_assign_miptree(radeonContextPtr rmesa, struct gl_texture_object *texObj, struct gl_texture_image *texImage, @@ -518,9 +539,14 @@ static void teximage_assign_miptree(radeonContextPtr rmesa, radeonTexObj *t = radeon_tex_obj(texObj); radeon_texture_image* image = get_radeon_texture_image(texImage); + /* Since miptree holds only images for levels + * don't allocate the miptree if the teximage won't fit. + */ + if (!image_matches_texture_obj(texObj, texImage, level)) + return; + /* Try using current miptree, or create new if there isn't any */ - if (!t->mt || !radeon_miptree_matches_image(t->mt, texImage, face, - radeon_gl_level_to_miptree_level(texObj, level))) { + if (!t->mt || !radeon_miptree_matches_image(t->mt, texImage, face, level)) { radeon_miptree_unreference(&t->mt); radeon_try_alloc_miptree(rmesa, t); if (RADEON_DEBUG & RADEON_TEXTURE) { @@ -534,7 +560,7 @@ static void teximage_assign_miptree(radeonContextPtr rmesa, * when there was no image for baselevel specified */ if (t->mt) { image->mtface = face; - image->mtlevel = radeon_gl_level_to_miptree_level(texObj, level); + image->mtlevel = level; radeon_miptree_reference(t->mt, &image->mt); } } @@ -590,6 +616,8 @@ static void radeon_store_teximage(GLcontext* ctx, int dims, dstRowStride = _mesa_format_row_stride(texImage->TexFormat, texImage->Width); } + assert(dstRowStride); + if (dims == 3) { unsigned alignedWidth = dstRowStride/_mesa_get_format_bytes(texImage->TexFormat); dstImageOffsets = allocate_image_offsets(ctx, alignedWidth, texImage->Height, texImage->Depth); @@ -704,7 +732,7 @@ static void radeon_teximage( if (!t->bo) { teximage_assign_miptree(rmesa, texObj, texImage, face, level); - if (!t->mt) { + if (!image->mt) { int size = _mesa_format_image_size(texImage->TexFormat, texImage->Width, texImage->Height, -- cgit v1.2.3 From 2db72f329f35ee6e12df3ed472de2ee72cf23399 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Sun, 29 Nov 2009 12:12:19 -0500 Subject: r600 : add read port allocation for uniform; mapping ps input based on vs output; fix bugs including constants updating for vs. --- src/mesa/drivers/dri/r600/r700_assembler.c | 46 +++++++++------- src/mesa/drivers/dri/r600/r700_fragprog.c | 85 +++++++++++++++++------------- src/mesa/drivers/dri/r600/r700_fragprog.h | 6 ++- src/mesa/drivers/dri/r600/r700_vertprog.c | 26 +++++++-- 4 files changed, 101 insertions(+), 62 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index ba97d3e073..309c90fdd0 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -1038,7 +1038,8 @@ GLboolean checkop2(r700_AssemblerBase* pAsm) checkop_init(pAsm); - if( (pILInst->SrcReg[0].File == PROGRAM_CONSTANT) || + if( (pILInst->SrcReg[0].File == PROGRAM_UNIFORM) || + (pILInst->SrcReg[0].File == PROGRAM_CONSTANT) || (pILInst->SrcReg[0].File == PROGRAM_LOCAL_PARAM) || (pILInst->SrcReg[0].File == PROGRAM_ENV_PARAM) || (pILInst->SrcReg[0].File == PROGRAM_STATE_VAR) ) @@ -1049,7 +1050,8 @@ GLboolean checkop2(r700_AssemblerBase* pAsm) { bSrcConst[0] = GL_FALSE; } - if( (pILInst->SrcReg[1].File == PROGRAM_CONSTANT) || + if( (pILInst->SrcReg[1].File == PROGRAM_UNIFORM) || + (pILInst->SrcReg[1].File == PROGRAM_CONSTANT) || (pILInst->SrcReg[1].File == PROGRAM_LOCAL_PARAM) || (pILInst->SrcReg[1].File == PROGRAM_ENV_PARAM) || (pILInst->SrcReg[1].File == PROGRAM_STATE_VAR) ) @@ -1082,7 +1084,8 @@ GLboolean checkop3(r700_AssemblerBase* pAsm) checkop_init(pAsm); - if( (pILInst->SrcReg[0].File == PROGRAM_CONSTANT) || + if( (pILInst->SrcReg[0].File == PROGRAM_UNIFORM) || + (pILInst->SrcReg[0].File == PROGRAM_CONSTANT) || (pILInst->SrcReg[0].File == PROGRAM_LOCAL_PARAM) || (pILInst->SrcReg[0].File == PROGRAM_ENV_PARAM) || (pILInst->SrcReg[0].File == PROGRAM_STATE_VAR) ) @@ -1093,7 +1096,8 @@ GLboolean checkop3(r700_AssemblerBase* pAsm) { bSrcConst[0] = GL_FALSE; } - if( (pILInst->SrcReg[1].File == PROGRAM_CONSTANT) || + if( (pILInst->SrcReg[1].File == PROGRAM_UNIFORM) || + (pILInst->SrcReg[1].File == PROGRAM_CONSTANT) || (pILInst->SrcReg[1].File == PROGRAM_LOCAL_PARAM) || (pILInst->SrcReg[1].File == PROGRAM_ENV_PARAM) || (pILInst->SrcReg[1].File == PROGRAM_STATE_VAR) ) @@ -1104,7 +1108,8 @@ GLboolean checkop3(r700_AssemblerBase* pAsm) { bSrcConst[1] = GL_FALSE; } - if( (pILInst->SrcReg[2].File == PROGRAM_CONSTANT) || + if( (pILInst->SrcReg[2].File == PROGRAM_UNIFORM) || + (pILInst->SrcReg[2].File == PROGRAM_CONSTANT) || (pILInst->SrcReg[2].File == PROGRAM_LOCAL_PARAM) || (pILInst->SrcReg[2].File == PROGRAM_ENV_PARAM) || (pILInst->SrcReg[2].File == PROGRAM_STATE_VAR) ) @@ -1218,7 +1223,7 @@ GLboolean assemble_src(r700_AssemblerBase *pAsm, pAsm->S[fld].src.reg = pILInst->SrcReg[src].Index; break; case PROGRAM_INPUT: - setaddrmode_PVSSRC(&(pAsm->S[fld].src), ADDR_ABSOLUTE); + setaddrmode_PVSSRC(&(pAsm->S[fld].src), ADDR_ABSOLUTE); pAsm->S[fld].src.rtype = SRC_REG_INPUT; switch (pAsm->currentShaderType) { @@ -1346,6 +1351,7 @@ GLboolean tex_src(r700_AssemblerBase *pAsm) else { switch (pILInst->SrcReg[0].File) { + case PROGRAM_UNIFORM: case PROGRAM_CONSTANT: case PROGRAM_LOCAL_PARAM: case PROGRAM_ENV_PARAM: @@ -2117,7 +2123,7 @@ GLboolean check_vector(r700_AssemblerBase* pAsm, if( is_gpr(sel) ) { if( GL_FALSE == cycle_for_vector_bank_swizzle(bank_swizzle, src, &cycle) ) - { + { return GL_FALSE; } @@ -2129,7 +2135,7 @@ GLboolean check_vector(r700_AssemblerBase* pAsm, else { if( GL_FALSE == reserve_gpr(pAsm, sel, chan, cycle) ) - { + { return GL_FALSE; } } @@ -2141,7 +2147,7 @@ GLboolean check_vector(r700_AssemblerBase* pAsm, if( is_cfile(sel) ) { if( GL_FALSE == reserve_cfile(pAsm, sel, chan) ) - { + { return GL_FALSE; } } @@ -2244,7 +2250,7 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) current_source_index, pcurrent_source, scalar_channel_index) ) - { + { return GL_FALSE; } @@ -2258,7 +2264,7 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) current_source_index, pcurrent_source, scalar_channel_index) ) - { + { return GL_FALSE; } } @@ -2287,7 +2293,7 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) alu_instruction_ptr->m_Word1.f.dst_gpr = pAsm->D.dst.reg; } else - { + { radeon_error("Only temp destination registers supported for ALU dest regs.\n"); return GL_FALSE; } @@ -2401,7 +2407,7 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) } if(GL_FALSE == add_alu_instruction(pAsm, alu_instruction_ptr, contiguous_slots_needed) ) - { + { return GL_FALSE; } @@ -2412,15 +2418,15 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) if (is_single_scalar_operation) { if(GL_FALSE == check_scalar(pAsm, alu_instruction_ptr) ) - { + { return GL_FALSE; } } else { if(GL_FALSE == check_vector(pAsm, alu_instruction_ptr) ) - { - return 1; + { + return GL_FALSE; } } @@ -2667,7 +2673,7 @@ GLboolean assemble_alu_instruction2(r700_AssemblerBase *pAsm) { if(GL_FALSE == check_vector(pAsm, alu_instruction_ptr) ) { - return 1; + return GL_FALSE; } } @@ -3642,6 +3648,7 @@ GLboolean assemble_LRP(r700_AssemblerBase *pAsm) { return GL_FALSE; } + if( GL_FALSE == assemble_src(pAsm, 2, -1) ) { return GL_FALSE; @@ -4598,6 +4605,7 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) switch (pAsm->pILInst[pAsm->uiCurInst].SrcReg[0].File) { + case PROGRAM_UNIFORM: case PROGRAM_CONSTANT: case PROGRAM_LOCAL_PARAM: case PROGRAM_ENV_PARAM: @@ -6867,7 +6875,7 @@ GLboolean Process_Vertex_Exports(r700_AssemblerBase *pR700AsmCode, export_starting_index++; } } - + for(i=VERT_RESULT_VAR0; iucVP_OutputMap[i], GL_FALSE) ) - { + { return GL_FALSE; } diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c index 21ac46e7b8..e9ef6c8695 100644 --- a/src/mesa/drivers/dri/r600/r700_fragprog.c +++ b/src/mesa/drivers/dri/r600/r700_fragprog.c @@ -44,12 +44,18 @@ //TODO : Validate FP input with VP output. void Map_Fragment_Program(r700_AssemblerBase *pAsm, - struct gl_fragment_program *mesa_fp) + struct gl_fragment_program *mesa_fp, + GLcontext *ctx) { unsigned int unBit; unsigned int i; GLuint ui; + /* match fp inputs with vp exports. */ + struct r700_vertex_program_cont *vpc = + (struct r700_vertex_program_cont *)ctx->VertexProgram._Current; + GLbitfield OutputsWritten = vpc->mesa_program.Base.OutputsWritten; + pAsm->number_used_registers = 0; //Input mapping : mesa_fp->Base.InputsRead set the flag, set in @@ -61,41 +67,41 @@ void Map_Fragment_Program(r700_AssemblerBase *pAsm, pAsm->uiFP_AttributeMap[FRAG_ATTRIB_WPOS] = pAsm->number_used_registers++; } - unBit = 1 << FRAG_ATTRIB_COL0; - if(mesa_fp->Base.InputsRead & unBit) + unBit = 1 << VERT_RESULT_COL0; + if(OutputsWritten & unBit) { pAsm->uiFP_AttributeMap[FRAG_ATTRIB_COL0] = pAsm->number_used_registers++; } - unBit = 1 << FRAG_ATTRIB_COL1; - if(mesa_fp->Base.InputsRead & unBit) + unBit = 1 << VERT_RESULT_COL1; + if(OutputsWritten & unBit) { pAsm->uiFP_AttributeMap[FRAG_ATTRIB_COL1] = pAsm->number_used_registers++; } - unBit = 1 << FRAG_ATTRIB_FOGC; - if(mesa_fp->Base.InputsRead & unBit) + unBit = 1 << VERT_RESULT_FOGC; + if(OutputsWritten & unBit) { - pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FOGC] = pAsm->number_used_registers++; + pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FOGC] = pAsm->number_used_registers++; } for(i=0; i<8; i++) { - unBit = 1 << (FRAG_ATTRIB_TEX0 + i); - if(mesa_fp->Base.InputsRead & unBit) + unBit = 1 << (VERT_RESULT_TEX0 + i); + if(OutputsWritten & unBit) { pAsm->uiFP_AttributeMap[FRAG_ATTRIB_TEX0 + i] = pAsm->number_used_registers++; } } -/* order has been taken care of */ +/* order has been taken care of */ #if 1 - for(i=FRAG_ATTRIB_VAR0; iBase.InputsRead & unBit) + if(OutputsWritten & unBit) { - pAsm->uiFP_AttributeMap[i] = pAsm->number_used_registers++; + pAsm->uiFP_AttributeMap[i-VERT_RESULT_VAR0+FRAG_ATTRIB_VAR0] = pAsm->number_used_registers++; } } #else @@ -291,7 +297,8 @@ GLboolean Find_Instruction_Dependencies_fp(struct r700_fragment_program *fp, } GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp, - struct gl_fragment_program *mesa_fp) + struct gl_fragment_program *mesa_fp, + GLcontext *ctx) { GLuint number_of_colors_exported; GLboolean z_enabled = GL_FALSE; @@ -299,7 +306,7 @@ GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp, //Init_Program Init_r700_AssemblerBase( SPT_FP, &(fp->r700AsmCode), &(fp->r700Shader) ); - Map_Fragment_Program(&(fp->r700AsmCode), mesa_fp); + Map_Fragment_Program(&(fp->r700AsmCode), mesa_fp, ctx); if( GL_FALSE == Find_Instruction_Dependencies_fp(fp, mesa_fp) ) { @@ -366,7 +373,7 @@ void r700SelectFragmentShader(GLcontext *ctx) } if (GL_FALSE == fp->translated) - r700TranslateFragmentShader(fp, &(fp->mesa_program)); + r700TranslateFragmentShader(fp, &(fp->mesa_program), ctx); } void * r700GetActiveFpShaderBo(GLcontext * ctx) @@ -460,6 +467,9 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx) EXPORT_MODE_shift, EXPORT_MODE_mask); // emit ps input map + struct r700_vertex_program_cont *vpc = + (struct r700_vertex_program_cont *)ctx->VertexProgram._Current; + GLbitfield OutputsWritten = vpc->mesa_program.Base.OutputsWritten; unBit = 1 << FRAG_ATTRIB_WPOS; if(mesa_fp->Base.InputsRead & unBit) { @@ -473,8 +483,8 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx) CLEARbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); } - unBit = 1 << FRAG_ATTRIB_COL0; - if(mesa_fp->Base.InputsRead & unBit) + unBit = 1 << VERT_RESULT_COL0; + if(OutputsWritten & unBit) { ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_COL0]; SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); @@ -486,8 +496,8 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx) CLEARbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); } - unBit = 1 << FRAG_ATTRIB_COL1; - if(mesa_fp->Base.InputsRead & unBit) + unBit = 1 << VERT_RESULT_COL1; + if(OutputsWritten & unBit) { ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_COL1]; SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); @@ -499,8 +509,8 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx) CLEARbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); } - unBit = 1 << FRAG_ATTRIB_FOGC; - if(mesa_fp->Base.InputsRead & unBit) + unBit = 1 << VERT_RESULT_FOGC; + if(OutputsWritten & unBit) { ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FOGC]; SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); @@ -514,8 +524,8 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx) for(i=0; i<8; i++) { - unBit = 1 << (FRAG_ATTRIB_TEX0 + i); - if(mesa_fp->Base.InputsRead & unBit) + unBit = 1 << (VERT_RESULT_TEX0 + i); + if(OutputsWritten & unBit) { ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_TEX0 + i]; SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); @@ -525,12 +535,12 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx) } } - for(i=FRAG_ATTRIB_VAR0; iBase.InputsRead & unBit) + unBit = 1 << i; + if(OutputsWritten & unBit) { - ui = pAsm->uiFP_AttributeMap[i]; + ui = pAsm->uiFP_AttributeMap[i-VERT_RESULT_VAR0+FRAG_ATTRIB_VAR0]; SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); SETfield(r700->SPI_PS_INPUT_CNTL[ui].u32All, ui, SEMANTIC_shift, SEMANTIC_mask); @@ -538,8 +548,8 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx) SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); else CLEARbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); - } - } + } + } exportCount = (r700->ps.SQ_PGM_EXPORTS_PS.u32All & EXPORT_MODE_mask) / (1 << EXPORT_MODE_shift); if (r700->CB_SHADER_CONTROL.u32All != ((1 << exportCount) - 1)) @@ -551,7 +561,8 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx) /* sent out shader constants. */ paramList = fp->mesa_program.Base.Parameters; - if(NULL != paramList) { + if(NULL != paramList) + { _mesa_load_state_parameters(ctx, paramList); if (paramList->NumParameters > R700_MAX_DX9_CONSTS) @@ -564,10 +575,10 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx) unNumParamData = paramList->NumParameters; for(ui=0; uips.consts[ui][0].f32All = paramList->ParameterValues[ui][0]; - r700->ps.consts[ui][1].f32All = paramList->ParameterValues[ui][1]; - r700->ps.consts[ui][2].f32All = paramList->ParameterValues[ui][2]; - r700->ps.consts[ui][3].f32All = paramList->ParameterValues[ui][3]; + r700->ps.consts[ui][0].f32All = paramList->ParameterValues[ui][0]; + r700->ps.consts[ui][1].f32All = paramList->ParameterValues[ui][1]; + r700->ps.consts[ui][2].f32All = paramList->ParameterValues[ui][2]; + r700->ps.consts[ui][3].f32All = paramList->ParameterValues[ui][3]; } } else r700->ps.num_consts = 0; diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.h b/src/mesa/drivers/dri/r600/r700_fragprog.h index cbb108d212..843de2c029 100644 --- a/src/mesa/drivers/dri/r600/r700_fragprog.h +++ b/src/mesa/drivers/dri/r600/r700_fragprog.h @@ -49,12 +49,14 @@ struct r700_fragment_program /* Internal */ void Map_Fragment_Program(r700_AssemblerBase *pAsm, - struct gl_fragment_program *mesa_fp); + struct gl_fragment_program *mesa_fp, + GLcontext *ctx); //richard glsl nov.27 GLboolean Find_Instruction_Dependencies_fp(struct r700_fragment_program *fp, struct gl_fragment_program *mesa_fp); GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp, - struct gl_fragment_program *mesa_vp); + struct gl_fragment_program *mesa_vp, + GLcontext *ctx); //richard glsl nov.27 /* Interface */ extern void r700SelectFragmentShader(GLcontext *ctx); diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c index c8f72d588b..7715214da1 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.c +++ b/src/mesa/drivers/dri/r600/r700_vertprog.c @@ -631,6 +631,14 @@ GLboolean r700SetupVertexProgram(GLcontext * ctx) paramList = vp->mesa_program->Base.Parameters; if(NULL != paramList) { + //vp->mesa_program was cloned, not updated by glsl shader api. + //_mesa_reference_program has already checked glsl shProg is ok and set ctx->VertexProgem._Current + // so, use ctx->VertexProgem._Current + struct gl_program_parameter_list *paramListOrginal = + paramListOrginal = ctx->VertexProgram._Current->Base.Parameters; + + //--------------------------- + _mesa_load_state_parameters(ctx, paramList); if (paramList->NumParameters > R700_MAX_DX9_CONSTS) @@ -643,10 +651,20 @@ GLboolean r700SetupVertexProgram(GLcontext * ctx) unNumParamData = paramList->NumParameters; for(ui=0; uivs.consts[ui][0].f32All = paramList->ParameterValues[ui][0]; - r700->vs.consts[ui][1].f32All = paramList->ParameterValues[ui][1]; - r700->vs.consts[ui][2].f32All = paramList->ParameterValues[ui][2]; - r700->vs.consts[ui][3].f32All = paramList->ParameterValues[ui][3]; + if(paramList->Parameters[ui].Type == PROGRAM_UNIFORM) + { + r700->vs.consts[ui][0].f32All = paramListOrginal->ParameterValues[ui][0]; + r700->vs.consts[ui][1].f32All = paramListOrginal->ParameterValues[ui][1]; + r700->vs.consts[ui][2].f32All = paramListOrginal->ParameterValues[ui][2]; + r700->vs.consts[ui][3].f32All = paramListOrginal->ParameterValues[ui][3]; + } + else + { + r700->vs.consts[ui][0].f32All = paramList->ParameterValues[ui][0]; + r700->vs.consts[ui][1].f32All = paramList->ParameterValues[ui][1]; + r700->vs.consts[ui][2].f32All = paramList->ParameterValues[ui][2]; + r700->vs.consts[ui][3].f32All = paramList->ParameterValues[ui][3]; + } } } else r700->vs.num_consts = 0; -- cgit v1.2.3 From a1b9c4e22a83d2125f66c3a3af3143bc0daee9a4 Mon Sep 17 00:00:00 2001 From: Richard Li Date: Sun, 29 Nov 2009 12:28:32 -0500 Subject: r600 : clena up a bit for last commit. --- src/mesa/drivers/dri/r600/r700_fragprog.h | 4 ++-- src/mesa/drivers/dri/r600/r700_vertprog.c | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.h b/src/mesa/drivers/dri/r600/r700_fragprog.h index 843de2c029..e562bfa478 100644 --- a/src/mesa/drivers/dri/r600/r700_fragprog.h +++ b/src/mesa/drivers/dri/r600/r700_fragprog.h @@ -50,13 +50,13 @@ struct r700_fragment_program /* Internal */ void Map_Fragment_Program(r700_AssemblerBase *pAsm, struct gl_fragment_program *mesa_fp, - GLcontext *ctx); //richard glsl nov.27 + GLcontext *ctx); GLboolean Find_Instruction_Dependencies_fp(struct r700_fragment_program *fp, struct gl_fragment_program *mesa_fp); GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp, struct gl_fragment_program *mesa_vp, - GLcontext *ctx); //richard glsl nov.27 + GLcontext *ctx); /* Interface */ extern void r700SelectFragmentShader(GLcontext *ctx); diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c index 7715214da1..d3d1da7959 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.c +++ b/src/mesa/drivers/dri/r600/r700_vertprog.c @@ -631,14 +631,12 @@ GLboolean r700SetupVertexProgram(GLcontext * ctx) paramList = vp->mesa_program->Base.Parameters; if(NULL != paramList) { - //vp->mesa_program was cloned, not updated by glsl shader api. - //_mesa_reference_program has already checked glsl shProg is ok and set ctx->VertexProgem._Current - // so, use ctx->VertexProgem._Current + /* vp->mesa_program was cloned, not updated by glsl shader api. */ + /* _mesa_reference_program has already checked glsl shProg is ok and set ctx->VertexProgem._Current */ + /* so, use ctx->VertexProgem._Current */ struct gl_program_parameter_list *paramListOrginal = paramListOrginal = ctx->VertexProgram._Current->Base.Parameters; - - //--------------------------- - + _mesa_load_state_parameters(ctx, paramList); if (paramList->NumParameters > R700_MAX_DX9_CONSTS) -- cgit v1.2.3 From a201dfb6bf28b89d6f511c2ec9ae0d81ef18511d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 29 Nov 2009 18:18:23 -0500 Subject: mesa: Fix array out-of-bounds access by _mesa_TexParameterf. _mesa_TexParameterf calls set_tex_parameteri, which uses the params argument as an array. --- src/mesa/main/texparam.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index ab170cde35..032c22b252 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -547,8 +547,10 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param) case GL_DEPTH_TEXTURE_MODE_ARB: { /* convert float param to int */ - GLint p = (GLint) param; - need_update = set_tex_parameteri(ctx, texObj, pname, &p); + GLint p[4]; + p[0] = (GLint) param; + p[1] = p[2] = p[3] = 0; + need_update = set_tex_parameteri(ctx, texObj, pname, p); } break; default: -- cgit v1.2.3 From d8d49716cf5d5cabebadc32d7717eec787c75ff1 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Sun, 29 Nov 2009 17:40:02 -0800 Subject: i915: Enable point sprite coordinate generation Support still isn't completely correct, but it's better. piglit point-sprite now passes. However, glean's pointSprite test fails. In that test the texture on the sprite is somehow inverted as though GL_POINT_SPRITE_COORD_ORIGIN were set to GL_LOWER_LEFT. i915 hardware shouldn't be able to do that! I believe there are also problems when not all texture units have GL_COORD_REPLACE set. The hardware enable seems to be all or nothing. Fixes bug #25313. --- src/mesa/drivers/dri/i915/i915_state.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index b60efea75b..1ec84ef116 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -599,6 +599,24 @@ i915PointSize(GLcontext * ctx, GLfloat size) } +static void +i915PointParameterfv(GLcontext * ctx, GLenum pname, const GLfloat *params) +{ + struct i915_context *i915 = I915_CONTEXT(ctx); + + switch (pname) { + case GL_POINT_SPRITE_COORD_ORIGIN: + /* This could be supported, but it would require modifying the fragment + * program to invert the y component of the texture coordinate by + * inserting a 'SUB tc.y, {1.0}.xxxx, tc' instruction. + */ + FALLBACK(&i915->intel, I915_FALLBACK_POINT_SPRITE_COORD_ORIGIN, + (params[0] != GL_UPPER_LEFT)); + break; + } +} + + /* ============================================================= * Color masks */ @@ -939,6 +957,17 @@ i915Enable(GLcontext * ctx, GLenum cap, GLboolean state) case GL_POLYGON_SMOOTH: break; + case GL_POINT_SPRITE: + /* This state change is handled in i915_reduced_primitive_state because + * the hardware bit should only be set when rendering points. + */ + I915_STATECHANGE(i915, I915_UPLOAD_CTX); + if (state) + i915->state.Ctx[I915_CTXREG_LIS4] |= S4_SPRITE_POINT_ENABLE; + else + i915->state.Ctx[I915_CTXREG_LIS4] &= ~S4_SPRITE_POINT_ENABLE; + break; + case GL_POINT_SMOOTH: break; -- cgit v1.2.3 From 718f31b830b2c4edad8b7e04804ff23e1db93e5a Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Sun, 29 Nov 2009 17:43:38 -0800 Subject: i915: Round point sizes instead of truncate. --- src/mesa/drivers/dri/i915/i915_state.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index 1ec84ef116..86f37379dc 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -585,7 +585,7 @@ i915PointSize(GLcontext * ctx, GLfloat size) { struct i915_context *i915 = I915_CONTEXT(ctx); int lis4 = i915->state.Ctx[I915_CTXREG_LIS4] & ~S4_POINT_WIDTH_MASK; - GLint point_size = (int) size; + GLint point_size = (int) round(size); DBG("%s\n", __FUNCTION__); -- cgit v1.2.3 From 533b7660073f2c1cd1a19105d4989ec11bfdcd87 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Sun, 29 Nov 2009 17:49:55 -0800 Subject: i915: Fallback bit define missed on previous commit --- src/mesa/drivers/dri/i915/i915_context.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_context.h b/src/mesa/drivers/dri/i915/i915_context.h index 8de4a9d0d3..90e698bacf 100644 --- a/src/mesa/drivers/dri/i915/i915_context.h +++ b/src/mesa/drivers/dri/i915/i915_context.h @@ -39,6 +39,7 @@ #define I915_FALLBACK_LOGICOP 0x20000 #define I915_FALLBACK_POLYGON_SMOOTH 0x40000 #define I915_FALLBACK_POINT_SMOOTH 0x80000 +#define I915_FALLBACK_POINT_SPRITE_COORD_ORIGIN 0x100000 #define I915_UPLOAD_CTX 0x1 #define I915_UPLOAD_BUFFERS 0x2 -- cgit v1.2.3 From 270d36da146b899d39e08f830fe34b63833a3731 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 29 Nov 2009 21:17:44 -0500 Subject: mesa: Fix array out-of-bounds access by _mesa_TexParameterf. _mesa_TexParameterf calls set_tex_parameterf, which uses the params argument as an array. --- src/mesa/main/texparam.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 032c22b252..310d594cd5 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -554,8 +554,13 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param) } break; default: - /* this will generate an error if pname is illegal */ - need_update = set_tex_parameterf(ctx, texObj, pname, ¶m); + { + /* this will generate an error if pname is illegal */ + GLfloat p[4]; + p[0] = param; + p[1] = p[2] = p[3] = 0.0F; + need_update = set_tex_parameterf(ctx, texObj, pname, p); + } } if (ctx->Driver.TexParameter && need_update) { -- cgit v1.2.3 From 7725744433827509d1da1cf1b27cda4bc8012ef3 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 30 Nov 2009 08:56:47 -0700 Subject: st/mesa: handle front/back-face +1/-1 vs. 1/0 conversion Fixes progs/glsl/twoside.c demo. --- src/mesa/state_tracker/st_mesa_to_tgsi.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'src') diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index d84832f539..5e8e61135e 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -675,6 +675,31 @@ emit_inverted_wpos( struct st_translate *t, } +/** + * OpenGL's fragment gl_FrontFace input is 1 for front-facing, 0 for back. + * TGSI uses +1 for front, -1 for back. + * This function converts the TGSI value to the GL value. Simply clamping/ + * saturating the value to [0,1] does the job. + */ +static void +emit_face_var( struct st_translate *t, + const struct gl_program *program ) +{ + struct ureg_program *ureg = t->ureg; + struct ureg_dst face_temp = ureg_DECL_temporary( ureg ); + struct ureg_src face_input = t->inputs[t->inputMapping[FRAG_ATTRIB_FACE]]; + + /* MOV_SAT face_temp, input[face] + */ + face_temp = ureg_saturate( face_temp ); + ureg_MOV( ureg, face_temp, face_input ); + + /* Use face_temp as face input from here on: + */ + t->inputs[t->inputMapping[FRAG_ATTRIB_FACE]] = ureg_src(face_temp); +} + + /** * Translate Mesa program to TGSI format. * \param program the program to translate @@ -746,6 +771,10 @@ st_translate_mesa_program( emit_inverted_wpos( t, program ); } + if (program->InputsRead & FRAG_BIT_FACE) { + emit_face_var( t, program ); + } + /* * Declare output attributes. */ -- cgit v1.2.3 From ac400ffce62be47fc77e8d10cabcd39b92b6c627 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Mon, 30 Nov 2009 20:29:18 +0100 Subject: gallium: interface cleanups, remove nblocksx/y from pipe_texture and more This patch removes nblocksx, nblocksy arrays from pipe_texture (can be recalculated if needed). Furthermore, pipe_format_block struct is gone completely (again, contains just derived state). nblocksx, nblocksy, block are also removed from pipe_transfer, together with the format enum (can be obtained from the texture associated with the transfer). --- src/gallium/auxiliary/draw/draw_pipe_aaline.c | 1 - src/gallium/auxiliary/draw/draw_pipe_pstipple.c | 1 - src/gallium/auxiliary/util/u_blit.c | 1 - src/gallium/auxiliary/util/u_debug.c | 8 +- src/gallium/auxiliary/util/u_format.h | 2 +- src/gallium/auxiliary/util/u_gen_mipmap.c | 12 +-- src/gallium/auxiliary/util/u_linear.c | 2 +- src/gallium/auxiliary/util/u_linear.h | 19 +++- src/gallium/auxiliary/util/u_rect.c | 71 +++++++------ src/gallium/auxiliary/util/u_rect.h | 4 +- src/gallium/auxiliary/util/u_surface.c | 1 - src/gallium/auxiliary/util/u_tile.c | 29 +++--- src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 1 - src/gallium/drivers/softpipe/sp_texture.c | 33 +++--- src/gallium/drivers/softpipe/sp_tile_cache.c | 10 +- src/gallium/include/pipe/p_format.h | 123 ++++++++++------------- src/gallium/include/pipe/p_state.h | 8 -- src/mesa/state_tracker/st_cb_drawpixels.c | 8 +- src/mesa/state_tracker/st_cb_fbo.c | 7 +- src/mesa/state_tracker/st_cb_readpixels.c | 14 +-- src/mesa/state_tracker/st_cb_texture.c | 33 +++--- src/mesa/state_tracker/st_gen_mipmap.c | 4 +- src/mesa/state_tracker/st_texture.c | 4 +- 23 files changed, 191 insertions(+), 205 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index 31de84b272..8c631a01af 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -401,7 +401,6 @@ aaline_create_texture(struct aaline_stage *aaline) texTemp.width0 = 1 << MAX_TEXTURE_LEVEL; texTemp.height0 = 1 << MAX_TEXTURE_LEVEL; texTemp.depth0 = 1; - pf_get_block(texTemp.format, &texTemp.block); aaline->texture = screen->texture_create(screen, &texTemp); if (!aaline->texture) diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c index 27d89721b1..7803946baa 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c @@ -430,7 +430,6 @@ pstip_create_texture(struct pstip_stage *pstip) texTemp.width0 = 32; texTemp.height0 = 32; texTemp.depth0 = 1; - pf_get_block(texTemp.format, &texTemp.block); pstip->texture = screen->texture_create(screen, &texTemp); if (pstip->texture == NULL) diff --git a/src/gallium/auxiliary/util/u_blit.c b/src/gallium/auxiliary/util/u_blit.c index 5372df5735..abe1de3302 100644 --- a/src/gallium/auxiliary/util/u_blit.c +++ b/src/gallium/auxiliary/util/u_blit.c @@ -357,7 +357,6 @@ util_blit_pixels_writemask(struct blit_state *ctx, texTemp.width0 = srcW; texTemp.height0 = srcH; texTemp.depth0 = 1; - pf_get_block(src->format, &texTemp.block); tex = screen->texture_create(screen, &texTemp); if (!tex) diff --git a/src/gallium/auxiliary/util/u_debug.c b/src/gallium/auxiliary/util/u_debug.c index 96d400c839..40633574b0 100644 --- a/src/gallium/auxiliary/util/u_debug.c +++ b/src/gallium/auxiliary/util/u_debug.c @@ -669,10 +669,10 @@ void debug_dump_surface(const char *prefix, goto error; debug_dump_image(prefix, - transfer->format, - transfer->block.size, - transfer->nblocksx, - transfer->nblocksy, + texture->format, + pf_get_blocksize(texture->format), + pf_get_nblocksx(texture->format, transfer->width), + pf_get_nblocksy(texture->format, transfer->height), transfer->stride, data); diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h index 7b5b7fcda5..6740683a61 100644 --- a/src/gallium/auxiliary/util/u_format.h +++ b/src/gallium/auxiliary/util/u_format.h @@ -50,7 +50,7 @@ struct util_format_block /** Block height in pixels */ unsigned height; - /** Block size in bytes */ + /** Block size in bits */ unsigned bits; }; diff --git a/src/gallium/auxiliary/util/u_gen_mipmap.c b/src/gallium/auxiliary/util/u_gen_mipmap.c index f67f1e458d..83263d9fe6 100644 --- a/src/gallium/auxiliary/util/u_gen_mipmap.c +++ b/src/gallium/auxiliary/util/u_gen_mipmap.c @@ -996,7 +996,7 @@ reduce_2d(enum pipe_format pformat, { enum dtype datatype; uint comps; - const int bpt = pf_get_size(pformat); + const int bpt = pf_get_blocksize(pformat); const ubyte *srcA, *srcB; ubyte *dst; int row; @@ -1035,7 +1035,7 @@ reduce_3d(enum pipe_format pformat, int dstWidth, int dstHeight, int dstDepth, int dstRowStride, ubyte *dstPtr) { - const int bpt = pf_get_size(pformat); + const int bpt = pf_get_blocksize(pformat); const int border = 0; int img, row; int bytesPerSrcImage, bytesPerDstImage; @@ -1159,8 +1159,8 @@ make_2d_mipmap(struct gen_mipmap_state *ctx, const uint zslice = 0; uint dstLevel; - assert(pt->block.width == 1); - assert(pt->block.height == 1); + assert(pf_get_blockwidth(pt->format) == 1); + assert(pf_get_blockheight(pt->format) == 1); for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) { const uint srcLevel = dstLevel - 1; @@ -1204,8 +1204,8 @@ make_3d_mipmap(struct gen_mipmap_state *ctx, struct pipe_screen *screen = pipe->screen; uint dstLevel, zslice = 0; - assert(pt->block.width == 1); - assert(pt->block.height == 1); + assert(pf_get_blockwidth(pt->format) == 1); + assert(pf_get_blockheight(pt->format) == 1); for (dstLevel = baseLevel + 1; dstLevel <= lastLevel; dstLevel++) { const uint srcLevel = dstLevel - 1; diff --git a/src/gallium/auxiliary/util/u_linear.c b/src/gallium/auxiliary/util/u_linear.c index a1dce3f5cf..f1aef21677 100644 --- a/src/gallium/auxiliary/util/u_linear.c +++ b/src/gallium/auxiliary/util/u_linear.c @@ -82,7 +82,7 @@ void pipe_linear_from_tile(struct pipe_tile_info *t, const void *src_ptr, void pipe_linear_fill_info(struct pipe_tile_info *t, - const struct pipe_format_block *block, + const struct u_linear_format_block *block, unsigned tile_width, unsigned tile_height, unsigned tiles_x, unsigned tiles_y) { diff --git a/src/gallium/auxiliary/util/u_linear.h b/src/gallium/auxiliary/util/u_linear.h index b74308ffa3..42c40b2aa7 100644 --- a/src/gallium/auxiliary/util/u_linear.h +++ b/src/gallium/auxiliary/util/u_linear.h @@ -35,6 +35,19 @@ #include "pipe/p_format.h" +struct u_linear_format_block +{ + /** Block size in bytes */ + unsigned size; + + /** Block width in pixels */ + unsigned width; + + /** Block height in pixels */ + unsigned height; +}; + + struct pipe_tile_info { unsigned size; @@ -49,10 +62,10 @@ struct pipe_tile_info unsigned rows; /* Describe the tile in pixels */ - struct pipe_format_block tile; + struct u_linear_format_block tile; /* Describe each block within the tile */ - struct pipe_format_block block; + struct u_linear_format_block block; }; void pipe_linear_to_tile(size_t src_stride, const void *src_ptr, @@ -71,7 +84,7 @@ void pipe_linear_from_tile(struct pipe_tile_info *t, const void *src_ptr, * @tiles_y number of tiles in y axis */ void pipe_linear_fill_info(struct pipe_tile_info *t, - const struct pipe_format_block *block, + const struct u_linear_format_block *block, unsigned tile_width, unsigned tile_height, unsigned tiles_x, unsigned tiles_y); diff --git a/src/gallium/auxiliary/util/u_rect.c b/src/gallium/auxiliary/util/u_rect.c index 9866b6fc8a..72725b59d2 100644 --- a/src/gallium/auxiliary/util/u_rect.c +++ b/src/gallium/auxiliary/util/u_rect.c @@ -44,7 +44,7 @@ */ void util_copy_rect(ubyte * dst, - const struct pipe_format_block *block, + enum pipe_format format, unsigned dst_stride, unsigned dst_x, unsigned dst_y, @@ -57,27 +57,30 @@ util_copy_rect(ubyte * dst, { unsigned i; int src_stride_pos = src_stride < 0 ? -src_stride : src_stride; + int blocksize = pf_get_blocksize(format); + int blockwidth = pf_get_blockwidth(format); + int blockheight = pf_get_blockheight(format); - assert(block->size > 0); - assert(block->width > 0); - assert(block->height > 0); + assert(blocksize > 0); + assert(blockwidth > 0); + assert(blockheight > 0); assert(src_x >= 0); assert(src_y >= 0); assert(dst_x >= 0); assert(dst_y >= 0); - dst_x /= block->width; - dst_y /= block->height; - width = (width + block->width - 1)/block->width; - height = (height + block->height - 1)/block->height; - src_x /= block->width; - src_y /= block->height; + dst_x /= blockwidth; + dst_y /= blockheight; + width = (width + blockwidth - 1)/blockwidth; + height = (height + blockheight - 1)/blockheight; + src_x /= blockwidth; + src_y /= blockheight; - dst += dst_x * block->size; - src += src_x * block->size; + dst += dst_x * blocksize; + src += src_x * blocksize; dst += dst_y * dst_stride; src += src_y * src_stride_pos; - width *= block->size; + width *= blocksize; if (width == dst_stride && width == src_stride) memcpy(dst, src, height * width); @@ -92,7 +95,7 @@ util_copy_rect(ubyte * dst, void util_fill_rect(ubyte * dst, - const struct pipe_format_block *block, + enum pipe_format format, unsigned dst_stride, unsigned dst_x, unsigned dst_y, @@ -102,23 +105,26 @@ util_fill_rect(ubyte * dst, { unsigned i, j; unsigned width_size; + int blocksize = pf_get_blocksize(format); + int blockwidth = pf_get_blockwidth(format); + int blockheight = pf_get_blockheight(format); - assert(block->size > 0); - assert(block->width > 0); - assert(block->height > 0); + assert(blocksize > 0); + assert(blockwidth > 0); + assert(blockheight > 0); assert(dst_x >= 0); assert(dst_y >= 0); - dst_x /= block->width; - dst_y /= block->height; - width = (width + block->width - 1)/block->width; - height = (height + block->height - 1)/block->height; + dst_x /= blockwidth; + dst_y /= blockheight; + width = (width + blockwidth - 1)/blockwidth; + height = (height + blockheight - 1)/blockheight; - dst += dst_x * block->size; + dst += dst_x * blocksize; dst += dst_y * dst_stride; - width_size = width * block->size; + width_size = width * blocksize; - switch (block->size) { + switch (blocksize) { case 1: if(dst_stride == width_size) memset(dst, (ubyte) value, height * width_size); @@ -172,10 +178,15 @@ util_surface_copy(struct pipe_context *pipe, struct pipe_transfer *src_trans, *dst_trans; void *dst_map; const void *src_map; + enum pipe_format src_format, dst_format; assert(src->texture && dst->texture); if (!src->texture || !dst->texture) return; + + src_format = src->texture->format; + dst_format = dst->texture->format; + src_trans = screen->get_tex_transfer(screen, src->texture, src->face, @@ -192,9 +203,9 @@ util_surface_copy(struct pipe_context *pipe, PIPE_TRANSFER_WRITE, dst_x, dst_y, w, h); - assert(dst_trans->block.size == src_trans->block.size); - assert(dst_trans->block.width == src_trans->block.width); - assert(dst_trans->block.height == src_trans->block.height); + assert(pf_get_blocksize(dst_format) == pf_get_blocksize(src_format)); + assert(pf_get_blockwidth(dst_format) == pf_get_blockwidth(src_format)); + assert(pf_get_blockheight(dst_format) == pf_get_blockheight(src_format)); src_map = pipe->screen->transfer_map(screen, src_trans); dst_map = pipe->screen->transfer_map(screen, dst_trans); @@ -205,7 +216,7 @@ util_surface_copy(struct pipe_context *pipe, if (src_map && dst_map) { /* If do_flip, invert src_y position and pass negative src stride */ util_copy_rect(dst_map, - &dst_trans->block, + dst_format, dst_trans->stride, 0, 0, w, h, @@ -259,11 +270,11 @@ util_surface_fill(struct pipe_context *pipe, if (dst_map) { assert(dst_trans->stride > 0); - switch (dst_trans->block.size) { + switch (pf_get_blocksize(dst_trans->texture->format)) { case 1: case 2: case 4: - util_fill_rect(dst_map, &dst_trans->block, dst_trans->stride, + util_fill_rect(dst_map, dst_trans->texture->format, dst_trans->stride, 0, 0, width, height, value); break; case 8: diff --git a/src/gallium/auxiliary/util/u_rect.h b/src/gallium/auxiliary/util/u_rect.h index daa50834d3..5e444ffae2 100644 --- a/src/gallium/auxiliary/util/u_rect.h +++ b/src/gallium/auxiliary/util/u_rect.h @@ -42,13 +42,13 @@ struct pipe_surface; extern void -util_copy_rect(ubyte * dst, const struct pipe_format_block *block, +util_copy_rect(ubyte * dst, enum pipe_format format, unsigned dst_stride, unsigned dst_x, unsigned dst_y, unsigned width, unsigned height, const ubyte * src, int src_stride, unsigned src_x, int src_y); extern void -util_fill_rect(ubyte * dst, const struct pipe_format_block *block, +util_fill_rect(ubyte * dst, enum pipe_format format, unsigned dst_stride, unsigned dst_x, unsigned dst_y, unsigned width, unsigned height, uint32_t value); diff --git a/src/gallium/auxiliary/util/u_surface.c b/src/gallium/auxiliary/util/u_surface.c index de8c266db8..f828908f0b 100644 --- a/src/gallium/auxiliary/util/u_surface.c +++ b/src/gallium/auxiliary/util/u_surface.c @@ -82,7 +82,6 @@ util_create_rgba_surface(struct pipe_screen *screen, templ.width0 = width; templ.height0 = height; templ.depth0 = 1; - pf_get_block(format, &templ.block); templ.tex_usage = usage; *textureOut = screen->texture_create(screen, &templ); diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c index 8a22f584be..4f34f8a1a6 100644 --- a/src/gallium/auxiliary/util/u_tile.c +++ b/src/gallium/auxiliary/util/u_tile.c @@ -52,7 +52,7 @@ pipe_get_tile_raw(struct pipe_transfer *pt, const void *src; if (dst_stride == 0) - dst_stride = pf_get_nblocksx(&pt->block, w) * pt->block.size; + dst_stride = pf_get_stride(pt->texture->format, w); if (pipe_clip_tile(x, y, &w, &h, pt)) return; @@ -62,7 +62,7 @@ pipe_get_tile_raw(struct pipe_transfer *pt, if(!src) return; - util_copy_rect(dst, &pt->block, dst_stride, 0, 0, w, h, src, pt->stride, x, y); + util_copy_rect(dst, pt->texture->format, dst_stride, 0, 0, w, h, src, pt->stride, x, y); screen->transfer_unmap(screen, pt); } @@ -78,9 +78,10 @@ pipe_put_tile_raw(struct pipe_transfer *pt, { struct pipe_screen *screen = pt->texture->screen; void *dst; + enum pipe_format format = pt->texture->format; if (src_stride == 0) - src_stride = pf_get_nblocksx(&pt->block, w) * pt->block.size; + src_stride = pf_get_stride(format, w); if (pipe_clip_tile(x, y, &w, &h, pt)) return; @@ -90,7 +91,7 @@ pipe_put_tile_raw(struct pipe_transfer *pt, if(!dst) return; - util_copy_rect(dst, &pt->block, pt->stride, x, y, w, h, src, src_stride, 0, 0); + util_copy_rect(dst, format, pt->stride, x, y, w, h, src, src_stride, 0, 0); screen->transfer_unmap(screen, pt); } @@ -1219,21 +1220,22 @@ pipe_get_tile_rgba(struct pipe_transfer *pt, { unsigned dst_stride = w * 4; void *packed; + enum pipe_format format = pt->texture->format; if (pipe_clip_tile(x, y, &w, &h, pt)) return; - packed = MALLOC(pf_get_nblocks(&pt->block, w, h) * pt->block.size); + packed = MALLOC(pf_get_nblocks(format, w, h) * pf_get_blocksize(format)); if (!packed) return; - if(pt->format == PIPE_FORMAT_YCBCR || pt->format == PIPE_FORMAT_YCBCR_REV) + if(format == PIPE_FORMAT_YCBCR || format == PIPE_FORMAT_YCBCR_REV) assert((x & 1) == 0); pipe_get_tile_raw(pt, x, y, w, h, packed, 0); - pipe_tile_raw_to_rgba(pt->format, packed, w, h, p, dst_stride); + pipe_tile_raw_to_rgba(format, packed, w, h, p, dst_stride); FREE(packed); } @@ -1246,16 +1248,17 @@ pipe_put_tile_rgba(struct pipe_transfer *pt, { unsigned src_stride = w * 4; void *packed; + enum pipe_format format = pt->texture->format; if (pipe_clip_tile(x, y, &w, &h, pt)) return; - packed = MALLOC(pf_get_nblocks(&pt->block, w, h) * pt->block.size); + packed = MALLOC(pf_get_nblocks(format, w, h) * pf_get_blocksize(format)); if (!packed) return; - switch (pt->format) { + switch (format) { case PIPE_FORMAT_A8R8G8B8_UNORM: a8r8g8b8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride); break; @@ -1322,7 +1325,7 @@ pipe_put_tile_rgba(struct pipe_transfer *pt, /*z24s8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride);*/ break; default: - debug_printf("%s: unsupported format %s\n", __FUNCTION__, pf_name(pt->format)); + debug_printf("%s: unsupported format %s\n", __FUNCTION__, pf_name(format)); } pipe_put_tile_raw(pt, x, y, w, h, packed, 0); @@ -1344,6 +1347,7 @@ pipe_get_tile_z(struct pipe_transfer *pt, ubyte *map; uint *pDest = z; uint i, j; + enum pipe_format format = pt->texture->format; if (pipe_clip_tile(x, y, &w, &h, pt)) return; @@ -1354,7 +1358,7 @@ pipe_get_tile_z(struct pipe_transfer *pt, return; } - switch (pt->format) { + switch (format) { case PIPE_FORMAT_Z32_UNORM: { const uint *ptrc @@ -1428,6 +1432,7 @@ pipe_put_tile_z(struct pipe_transfer *pt, const uint *ptrc = zSrc; ubyte *map; uint i, j; + enum pipe_format format = pt->texture->format; if (pipe_clip_tile(x, y, &w, &h, pt)) return; @@ -1438,7 +1443,7 @@ pipe_put_tile_z(struct pipe_transfer *pt, return; } - switch (pt->format) { + switch (format) { case PIPE_FORMAT_Z32_UNORM: { uint *pDest = (uint *) (map + y * pt->stride + x*4); diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index 1934965995..8b4c0dc3a2 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -840,7 +840,6 @@ init_buffers(struct vl_mpeg12_mc_renderer *r) template.height0 = r->pot_buffers ? util_next_power_of_two(r->picture_height) : r->picture_height; template.depth0 = 1; - pf_get_block(template.format, &template.block); template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_DYNAMIC; r->textures.individual.y = r->pipe->screen->texture_create(r->pipe->screen, &template); diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index ac5f61e46f..bd653216c0 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -63,13 +63,11 @@ softpipe_texture_layout(struct pipe_screen *screen, pt->depth0 = depth; for (level = 0; level <= pt->last_level; level++) { - pt->nblocksx[level] = pf_get_nblocksx(&pt->block, width); - pt->nblocksy[level] = pf_get_nblocksy(&pt->block, height); - spt->stride[level] = pt->nblocksx[level]*pt->block.size; + spt->stride[level] = pf_get_stride(pt->format, width); spt->level_offset[level] = buffer_size; - buffer_size += (pt->nblocksy[level] * + buffer_size += (pf_get_nblocksy(pt->format, u_minify(height, level)) * ((pt->target == PIPE_TEXTURE_CUBE) ? 6 : depth) * spt->stride[level]); @@ -97,9 +95,6 @@ softpipe_displaytarget_layout(struct pipe_screen *screen, PIPE_BUFFER_USAGE_GPU_READ_WRITE); unsigned tex_usage = spt->base.tex_usage; - spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width0); - spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height0); - spt->buffer = screen->surface_buffer_create( screen, spt->base.width0, spt->base.height0, @@ -175,8 +170,6 @@ softpipe_texture_blanket(struct pipe_screen * screen, spt->base = *base; pipe_reference_init(&spt->base.reference, 1); spt->base.screen = screen; - spt->base.nblocksx[0] = pf_get_nblocksx(&spt->base.block, spt->base.width0); - spt->base.nblocksy[0] = pf_get_nblocksy(&spt->base.block, spt->base.height0); spt->stride[0] = stride[0]; pipe_buffer_reference(&spt->buffer, buffer); @@ -244,10 +237,12 @@ softpipe_get_tex_surface(struct pipe_screen *screen, ps->zslice = zslice; if (pt->target == PIPE_TEXTURE_CUBE) { - ps->offset += face * pt->nblocksy[level] * spt->stride[level]; + ps->offset += face * pf_get_nblocksy(pt->format, u_minify(pt->height0, level)) * + spt->stride[level]; } else if (pt->target == PIPE_TEXTURE_3D) { - ps->offset += zslice * pt->nblocksy[level] * spt->stride[level]; + ps->offset += zslice * pf_get_nblocksy(pt->format, u_minify(pt->height0, level)) * + spt->stride[level]; } else { assert(face == 0); @@ -302,15 +297,12 @@ softpipe_get_tex_transfer(struct pipe_screen *screen, spt = CALLOC_STRUCT(softpipe_transfer); if (spt) { struct pipe_transfer *pt = &spt->base; + int nblocksy = pf_get_nblocksy(texture->format, u_minify(texture->height0, level)); pipe_texture_reference(&pt->texture, texture); - pt->format = texture->format; - pt->block = texture->block; pt->x = x; pt->y = y; pt->width = w; pt->height = h; - pt->nblocksx = texture->nblocksx[level]; - pt->nblocksy = texture->nblocksy[level]; pt->stride = sptex->stride[level]; pt->usage = usage; pt->face = face; @@ -320,10 +312,10 @@ softpipe_get_tex_transfer(struct pipe_screen *screen, spt->offset = sptex->level_offset[level]; if (texture->target == PIPE_TEXTURE_CUBE) { - spt->offset += face * pt->nblocksy * pt->stride; + spt->offset += face * nblocksy * pt->stride; } else if (texture->target == PIPE_TEXTURE_3D) { - spt->offset += zslice * pt->nblocksy * pt->stride; + spt->offset += zslice * nblocksy * pt->stride; } else { assert(face == 0); @@ -361,9 +353,11 @@ softpipe_transfer_map( struct pipe_screen *screen, { ubyte *map, *xfer_map; struct softpipe_texture *spt; + enum pipe_format format; assert(transfer->texture); spt = softpipe_texture(transfer->texture); + format = transfer->texture->format; map = pipe_buffer_map(screen, spt->buffer, pipe_transfer_buffer_flags(transfer)); if (map == NULL) @@ -380,8 +374,8 @@ softpipe_transfer_map( struct pipe_screen *screen, } xfer_map = map + softpipe_transfer(transfer)->offset + - transfer->y / transfer->block.height * transfer->stride + - transfer->x / transfer->block.width * transfer->block.size; + transfer->y / pf_get_blockheight(format) * transfer->stride + + transfer->x / pf_get_blockwidth(format) * pf_get_blocksize(format); /*printf("map = %p xfer map = %p\n", map, xfer_map);*/ return xfer_map; } @@ -438,7 +432,6 @@ softpipe_video_surface_create(struct pipe_screen *screen, template.width0 = util_next_power_of_two(width); template.height0 = util_next_power_of_two(height); template.depth0 = 1; - pf_get_block(template.format, &template.block); template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_RENDER_TARGET; sp_vsfc->tex = screen->texture_create(screen, &template); diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c index 65872cecc4..04f61d16c4 100644 --- a/src/gallium/drivers/softpipe/sp_tile_cache.c +++ b/src/gallium/drivers/softpipe/sp_tile_cache.c @@ -238,7 +238,7 @@ clear_tile(struct softpipe_cached_tile *tile, { uint i, j; - switch (pf_get_size(format)) { + switch (pf_get_blocksize(format)) { case 1: memset(tile->data.any, clear_value, TILE_SIZE * TILE_SIZE); break; @@ -284,8 +284,9 @@ sp_tile_cache_flush_clear(struct softpipe_tile_cache *tc) uint x, y; uint numCleared = 0; + assert(pt->texture); /* clear the scratch tile to the clear value */ - clear_tile(&tc->tile, pt->format, tc->clear_val); + clear_tile(&tc->tile, pt->texture->format, tc->clear_val); /* push the tile to all positions marked as clear */ for (y = 0; y < h; y += TILE_SIZE) { @@ -372,6 +373,7 @@ sp_find_cached_tile(struct softpipe_tile_cache *tc, if (addr.value != tile->addr.value) { + assert(pt->texture); if (tile->addr.bits.invalid == 0) { /* put dirty tile back in framebuffer */ if (tc->depth_stencil) { @@ -395,10 +397,10 @@ sp_find_cached_tile(struct softpipe_tile_cache *tc, if (is_clear_flag_set(tc->clear_flags, addr)) { /* don't get tile from framebuffer, just clear it */ if (tc->depth_stencil) { - clear_tile(tile, pt->format, tc->clear_val); + clear_tile(tile, pt->texture->format, tc->clear_val); } else { - clear_tile_rgba(tile, pt->format, tc->clear_color); + clear_tile_rgba(tile, pt->texture->format, tc->clear_color); } clear_clear_flag(tc->clear_flags, addr); } diff --git a/src/gallium/include/pipe/p_format.h b/src/gallium/include/pipe/p_format.h index af23080920..e6bba777d3 100644 --- a/src/gallium/include/pipe/p_format.h +++ b/src/gallium/include/pipe/p_format.h @@ -422,10 +422,11 @@ static INLINE uint pf_get_component_bits( enum pipe_format format, uint comp ) return size << (pf_mixed_scale8( format ) * 3); } + /** - * Return total bits needed for the pixel format. + * Return total bits needed for the pixel format per block. */ -static INLINE uint pf_get_bits( enum pipe_format format ) +static INLINE uint pf_get_blocksizebits( enum pipe_format format ) { switch (pf_layout(format)) { case PIPE_FORMAT_LAYOUT_RGBAZS: @@ -441,8 +442,24 @@ static INLINE uint pf_get_bits( enum pipe_format format ) pf_get_component_bits( format, PIPE_FORMAT_COMP_S ); case PIPE_FORMAT_LAYOUT_YCBCR: assert( format == PIPE_FORMAT_YCBCR || format == PIPE_FORMAT_YCBCR_REV ); - /* return effective bits per pixel */ - return 16; + return 32; + case PIPE_FORMAT_LAYOUT_DXT: + switch(format) { + case PIPE_FORMAT_DXT1_RGBA: + case PIPE_FORMAT_DXT1_RGB: + case PIPE_FORMAT_DXT1_SRGBA: + case PIPE_FORMAT_DXT1_SRGB: + return 64; + case PIPE_FORMAT_DXT3_RGBA: + case PIPE_FORMAT_DXT5_RGBA: + case PIPE_FORMAT_DXT3_SRGBA: + case PIPE_FORMAT_DXT5_SRGBA: + return 128; + default: + assert( 0 ); + return 0; + } + default: assert( 0 ); return 0; @@ -450,102 +467,66 @@ static INLINE uint pf_get_bits( enum pipe_format format ) } /** - * Return bytes per pixel for the given format. + * Return bytes per element for the given format. */ -static INLINE uint pf_get_size( enum pipe_format format ) +static INLINE uint pf_get_blocksize( enum pipe_format format ) { - assert(pf_get_bits(format) % 8 == 0); - return pf_get_bits(format) / 8; + assert(pf_get_blocksizebits(format) % 8 == 0); + return pf_get_blocksizebits(format) / 8; } -/** - * Describe accurately the pixel format. - * - * The chars-per-pixel concept falls apart with compressed and yuv images, where - * more than one pixel are coded in a single data block. This structure - * describes that block. - * - * Simple pixel formats are effectively a 1x1xcpp block. - */ -struct pipe_format_block +static INLINE uint pf_get_blockwidth( enum pipe_format format ) { - /** Block size in bytes */ - unsigned size; - - /** Block width in pixels */ - unsigned width; - - /** Block height in pixels */ - unsigned height; -}; + switch (pf_layout(format)) { + case PIPE_FORMAT_LAYOUT_YCBCR: + return 2; + case PIPE_FORMAT_LAYOUT_DXT: + return 4; + default: + return 1; + } +} -/** - * Describe pixel format's block. - * - * @sa http://msdn2.microsoft.com/en-us/library/ms796147.aspx - */ -static INLINE void -pf_get_block(enum pipe_format format, struct pipe_format_block *block) +static INLINE uint pf_get_blockheight( enum pipe_format format ) { - switch(format) { - case PIPE_FORMAT_DXT1_RGBA: - case PIPE_FORMAT_DXT1_RGB: - case PIPE_FORMAT_DXT1_SRGBA: - case PIPE_FORMAT_DXT1_SRGB: - block->size = 8; - block->width = 4; - block->height = 4; - break; - case PIPE_FORMAT_DXT3_RGBA: - case PIPE_FORMAT_DXT5_RGBA: - case PIPE_FORMAT_DXT3_SRGBA: - case PIPE_FORMAT_DXT5_SRGBA: - block->size = 16; - block->width = 4; - block->height = 4; - break; - case PIPE_FORMAT_YCBCR: - case PIPE_FORMAT_YCBCR_REV: - block->size = 4; /* 2*cpp */ - block->width = 2; - block->height = 1; - break; + switch (pf_layout(format)) { + case PIPE_FORMAT_LAYOUT_DXT: + return 4; default: - block->size = pf_get_size(format); - block->width = 1; - block->height = 1; - break; + return 1; } } static INLINE unsigned -pf_get_nblocksx(const struct pipe_format_block *block, unsigned x) +pf_get_nblocksx(enum pipe_format format, unsigned x) { - return (x + block->width - 1)/block->width; + unsigned blockwidth = pf_get_blockwidth(format); + return (x + blockwidth - 1) / blockwidth; } static INLINE unsigned -pf_get_nblocksy(const struct pipe_format_block *block, unsigned y) +pf_get_nblocksy(enum pipe_format format, unsigned y) { - return (y + block->height - 1)/block->height; + unsigned blockheight = pf_get_blockheight(format); + return (y + blockheight - 1) / blockheight; } static INLINE unsigned -pf_get_nblocks(const struct pipe_format_block *block, unsigned width, unsigned height) +pf_get_nblocks(enum pipe_format format, unsigned width, unsigned height) { - return pf_get_nblocksx(block, width)*pf_get_nblocksy(block, height); + return pf_get_nblocksx(format, width) * pf_get_nblocksy(format, height); } static INLINE size_t -pf_get_stride(const struct pipe_format_block *block, unsigned width) +pf_get_stride(enum pipe_format format, unsigned width) { - return pf_get_nblocksx(block, width)*block->size; + return pf_get_nblocksx(format, width) * pf_get_blocksize(format); } static INLINE size_t -pf_get_2d_size(const struct pipe_format_block *block, size_t stride, unsigned height) +pf_get_2d_size(enum pipe_format format, size_t stride, unsigned height) { - return pf_get_nblocksy(block, height)*stride; + return pf_get_nblocksy(format, height) * stride; } static INLINE boolean diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 9766e86620..db83c8e157 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -315,14 +315,10 @@ struct pipe_surface */ struct pipe_transfer { - enum pipe_format format; /**< PIPE_FORMAT_x */ unsigned x; /**< x offset from start of texture image */ unsigned y; /**< y offset from start of texture image */ unsigned width; /**< logical width in pixels */ unsigned height; /**< logical height in pixels */ - struct pipe_format_block block; - unsigned nblocksx; /**< allocated width in blocks */ - unsigned nblocksy; /**< allocated height in blocks */ unsigned stride; /**< stride in bytes between rows of blocks */ enum pipe_transfer_usage usage; /**< PIPE_TRANSFER_* */ @@ -347,10 +343,6 @@ struct pipe_texture unsigned height0; unsigned depth0; - struct pipe_format_block block; - unsigned nblocksx[PIPE_MAX_TEXTURE_LEVELS]; /**< allocated width in blocks */ - unsigned nblocksy[PIPE_MAX_TEXTURE_LEVELS]; /**< allocated height in blocks */ - unsigned last_level:8; /**< Index of last mipmap level present/defined */ unsigned nr_samples:8; /**< for multisampled surfaces, nr of samples */ diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index a68a29e126..a15043da78 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -701,7 +701,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y, } /* now pack the stencil (and Z) values in the dest format */ - switch (pt->format) { + switch (pt->texture->format) { case PIPE_FORMAT_S8_UNORM: { ubyte *dest = stmap + spanY * pt->stride + spanX; @@ -856,8 +856,8 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, usage, dstx, dsty, width, height); - assert(ptDraw->block.width == 1); - assert(ptDraw->block.height == 1); + assert(pf_get_blockwidth(ptDraw->texture->format) == 1); + assert(pf_get_blockheight(ptDraw->texture->format) == 1); /* map the stencil buffer */ drawMap = screen->transfer_map(screen, ptDraw); @@ -878,7 +878,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy, dst = drawMap + y * ptDraw->stride; src = buffer + i * width; - switch (ptDraw->format) { + switch (ptDraw->texture->format) { case PIPE_FORMAT_S8Z24_UNORM: { uint *dst4 = (uint *) dst; diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index 659a6c9193..ead8e22888 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -98,16 +98,14 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, strb->defined = GL_FALSE; /* undefined contents now */ if(strb->software) { - struct pipe_format_block block; size_t size; _mesa_free(strb->data); assert(strb->format != PIPE_FORMAT_NONE); - pf_get_block(strb->format, &block); - strb->stride = pf_get_stride(&block, width); - size = pf_get_2d_size(&block, strb->stride, height); + strb->stride = pf_get_stride(strb->format, width); + size = pf_get_2d_size(strb->format, strb->stride, height); strb->data = _mesa_malloc(size); @@ -127,7 +125,6 @@ st_renderbuffer_alloc_storage(GLcontext * ctx, struct gl_renderbuffer *rb, memset(&template, 0, sizeof(template)); template.target = PIPE_TEXTURE_2D; template.format = format; - pf_get_block(format, &template.block); template.width0 = width; template.height0 = height; template.depth0 = 1; diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 103861d6f9..6fa7bb64f2 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -103,7 +103,7 @@ st_read_stencil_pixels(GLcontext *ctx, GLint x, GLint y, } /* get stencil (and Z) values */ - switch (pt->format) { + switch (pt->texture->format) { case PIPE_FORMAT_S8_UNORM: { const ubyte *src = stmap + srcY * pt->stride; @@ -431,8 +431,8 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, const GLint dstStride = _mesa_image_row_stride(&clippedPacking, width, format, type); - if (trans->format == PIPE_FORMAT_S8Z24_UNORM || - trans->format == PIPE_FORMAT_X8Z24_UNORM) { + if (trans->texture->format == PIPE_FORMAT_S8Z24_UNORM || + trans->texture->format == PIPE_FORMAT_X8Z24_UNORM) { if (format == GL_DEPTH_COMPONENT) { for (i = 0; i < height; i++) { GLuint ztemp[MAX_WIDTH]; @@ -463,8 +463,8 @@ 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) { + else if (trans->texture->format == PIPE_FORMAT_Z24S8_UNORM || + trans->texture->format == PIPE_FORMAT_Z24X8_UNORM) { if (format == GL_DEPTH_COMPONENT) { for (i = 0; i < height; i++) { GLuint ztemp[MAX_WIDTH]; @@ -490,7 +490,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, } } } - else if (trans->format == PIPE_FORMAT_Z16_UNORM) { + else if (trans->texture->format == PIPE_FORMAT_Z16_UNORM) { for (i = 0; i < height; i++) { GLushort ztemp[MAX_WIDTH]; GLfloat zfloat[MAX_WIDTH]; @@ -505,7 +505,7 @@ st_readpixels(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei height, dst += dstStride; } } - else if (trans->format == PIPE_FORMAT_Z32_UNORM) { + else if (trans->texture->format == PIPE_FORMAT_Z32_UNORM) { for (i = 0; i < height; i++) { GLuint ztemp[MAX_WIDTH]; GLfloat zfloat[MAX_WIDTH]; diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index 3a2337802f..6d136f5abf 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -405,7 +405,6 @@ compress_with_blit(GLcontext * ctx, memset(&templ, 0, sizeof(templ)); templ.target = PIPE_TEXTURE_2D; templ.format = st_mesa_format_to_pipe_format(mesa_format); - pf_get_block(templ.format, &templ.block); templ.width0 = width; templ.height0 = height; templ.depth0 = 1; @@ -833,7 +832,7 @@ decompress_with_blit(GLcontext * ctx, GLenum target, GLint level, /* copy/pack data into user buffer */ if (st_equal_formats(stImage->pt->format, format, type)) { /* memcpy */ - const uint bytesPerRow = width * pf_get_size(stImage->pt->format); + const uint bytesPerRow = width * pf_get_blocksize(stImage->pt->format); ubyte *map = screen->transfer_map(screen, tex_xfer); GLuint row; for (row = 0; row < height; row++) { @@ -915,7 +914,7 @@ st_get_tex_image(GLcontext * ctx, GLenum target, GLint level, PIPE_TRANSFER_READ, 0, 0, stImage->base.Width, stImage->base.Height); - texImage->RowStride = stImage->transfer->stride / stImage->pt->block.size; + texImage->RowStride = stImage->transfer->stride / pf_get_blocksize(stImage->pt->format); } else { /* Otherwise, the image should actually be stored in @@ -1163,10 +1162,10 @@ st_CompressedTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_image *texImage) { struct st_texture_image *stImage = st_texture_image(texImage); - struct pipe_format_block block; int srcBlockStride; int dstBlockStride; int y; + enum pipe_format pformat= stImage->pt->format; if (stImage->pt) { unsigned face = _mesa_tex_target_to_face(target); @@ -1178,8 +1177,7 @@ st_CompressedTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, xoffset, yoffset, width, height); - block = stImage->pt->block; - srcBlockStride = pf_get_stride(&block, width); + srcBlockStride = pf_get_stride(pformat, width); dstBlockStride = stImage->transfer->stride; } else { assert(stImage->pt); @@ -1193,16 +1191,16 @@ st_CompressedTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, return; } - assert(xoffset % block.width == 0); - assert(yoffset % block.height == 0); - assert(width % block.width == 0); - assert(height % block.height == 0); + assert(xoffset % pf_get_blockwidth(pformat) == 0); + assert(yoffset % pf_get_blockheight(pformat) == 0); + assert(width % pf_get_blockwidth(pformat) == 0); + assert(height % pf_get_blockheight(pformat) == 0); - for (y = 0; y < height; y += block.height) { + for (y = 0; y < height; y += pf_get_blockheight(pformat)) { /* don't need to adjust for xoffset and yoffset as st_texture_image_map does that */ - const char *src = (const char*)data + srcBlockStride * pf_get_nblocksy(&block, y); - char *dst = (char*)texImage->Data + dstBlockStride * pf_get_nblocksy(&block, y); - memcpy(dst, src, pf_get_stride(&block, width)); + const char *src = (const char*)data + srcBlockStride * pf_get_nblocksy(pformat, y); + char *dst = (char*)texImage->Data + dstBlockStride * pf_get_nblocksy(pformat, y); + memcpy(dst, src, pf_get_stride(pformat, width)); } if (stImage->pt) { @@ -1692,10 +1690,10 @@ copy_image_data_to_texture(struct st_context *st, dstLevel, stImage->base.Data, stImage->base.RowStride * - stObj->pt->block.size, + pf_get_blocksize(stObj->pt->format), stImage->base.RowStride * stImage->base.Height * - stObj->pt->block.size); + pf_get_blocksize(stObj->pt->format)); _mesa_align_free(stImage->base.Data); stImage->base.Data = NULL; } @@ -1763,8 +1761,7 @@ st_finalize_texture(GLcontext *ctx, stObj->pt->last_level < stObj->lastLevel || stObj->pt->width0 != firstImage->base.Width2 || stObj->pt->height0 != firstImage->base.Height2 || - stObj->pt->depth0 != firstImage->base.Depth2 || - stObj->pt->block.size != blockSize) + stObj->pt->depth0 != firstImage->base.Depth2) { pipe_texture_reference(&stObj->pt, NULL); ctx->st->dirty.st |= ST_NEW_FRAMEBUFFER; diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index f8068fa12b..7700551830 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -146,8 +146,8 @@ fallback_generate_mipmap(GLcontext *ctx, GLenum target, srcData = (ubyte *) screen->transfer_map(screen, srcTrans); dstData = (ubyte *) screen->transfer_map(screen, dstTrans); - srcStride = srcTrans->stride / srcTrans->block.size; - dstStride = dstTrans->stride / dstTrans->block.size; + srcStride = srcTrans->stride / pf_get_blocksize(srcTrans->texture->format); + dstStride = dstTrans->stride / pf_get_blocksize(dstTrans->texture->format); _mesa_generate_mipmap_level(target, datatype, comps, 0 /*border*/, diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c index dbccee86c1..3035d78b61 100644 --- a/src/mesa/state_tracker/st_texture.c +++ b/src/mesa/state_tracker/st_texture.c @@ -104,7 +104,6 @@ st_texture_create(struct st_context *st, pt.width0 = width0; pt.height0 = height0; pt.depth0 = depth0; - pf_get_block(format, &pt.block); pt.tex_usage = usage; newtex = screen->texture_create(screen, &pt); @@ -242,8 +241,9 @@ st_surface_data(struct pipe_context *pipe, struct pipe_screen *screen = pipe->screen; void *map = screen->transfer_map(screen, dst); + assert(dst->texture); util_copy_rect(map, - &dst->block, + dst->texture->format, dst->stride, dstx, dsty, width, height, -- cgit v1.2.3 From 587a52e95bbe96788e8b96b63f091bb3022fc048 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 30 Nov 2009 12:43:12 -0800 Subject: i915: Actually put i915PointParameterfv in the driver function table. Duh. --- src/mesa/drivers/dri/i915/i915_state.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c index 86f37379dc..cc98d125db 100644 --- a/src/mesa/drivers/dri/i915/i915_state.c +++ b/src/mesa/drivers/dri/i915/i915_state.c @@ -1137,6 +1137,7 @@ i915InitStateFunctions(struct dd_function_table *functions) functions->LineWidth = i915LineWidth; functions->LogicOpcode = i915LogicOp; functions->PointSize = i915PointSize; + functions->PointParameterfv = i915PointParameterfv; functions->PolygonStipple = i915PolygonStipple; functions->Scissor = i915Scissor; functions->ShadeModel = i915ShadeModel; -- cgit v1.2.3 From decf6ed810eae473d043a4a399a5a84f1378a725 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Mon, 30 Nov 2009 23:02:49 +0100 Subject: fixups for interface changes (mostly state trackers) --- src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 4 +-- src/gallium/drivers/trace/tr_dump_state.c | 24 --------------- src/gallium/drivers/trace/tr_dump_state.h | 3 -- src/gallium/drivers/trace/tr_rbug.c | 13 +++++--- src/gallium/drivers/trace/tr_screen.c | 3 +- src/gallium/state_trackers/dri/dri_drawable.c | 1 - src/gallium/state_trackers/egl/egl_surface.c | 1 - src/gallium/state_trackers/python/gallium.i | 1 - src/gallium/state_trackers/python/p_device.i | 1 - src/gallium/state_trackers/python/p_format.i | 8 ----- src/gallium/state_trackers/python/p_texture.i | 32 ++++---------------- .../state_trackers/python/retrace/interpreter.py | 3 +- src/gallium/state_trackers/python/st_device.c | 3 -- src/gallium/state_trackers/python/st_sample.c | 35 ++++++++++++---------- src/gallium/state_trackers/python/st_sample.h | 1 - .../state_trackers/python/st_softpipe_winsys.c | 19 ++---------- .../state_trackers/python/tests/surface_copy.py | 7 +++-- .../python/tests/texture_transfer.py | 5 ++-- src/gallium/state_trackers/vega/api_filters.c | 1 - src/gallium/state_trackers/vega/image.c | 1 - src/gallium/state_trackers/vega/mask.c | 1 - src/gallium/state_trackers/vega/paint.c | 1 - src/gallium/state_trackers/vega/renderer.c | 1 - src/gallium/state_trackers/vega/vg_tracker.c | 1 - src/gallium/state_trackers/xorg/xorg_crtc.c | 3 +- src/gallium/state_trackers/xorg/xorg_dri2.c | 1 - src/gallium/state_trackers/xorg/xorg_exa.c | 6 ++-- src/gallium/state_trackers/xorg/xorg_renderer.c | 1 - src/gallium/state_trackers/xorg/xorg_xv.c | 1 - .../winsys/drm/nouveau/drm/nouveau_drm_api.c | 3 +- src/gallium/winsys/drm/radeon/core/radeon_buffer.c | 17 ++++------- src/gallium/winsys/egl_xlib/sw_winsys.c | 19 ++---------- src/gallium/winsys/g3dvl/xlib/xsp_winsys.c | 9 ++---- src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c | 17 ++--------- src/gallium/winsys/gdi/gdi_softpipe_winsys.c | 23 ++++---------- src/gallium/winsys/xlib/xlib_cell.c | 20 +++---------- src/gallium/winsys/xlib/xlib_llvmpipe.c | 15 ++++------ src/gallium/winsys/xlib/xlib_softpipe.c | 15 ++++------ 38 files changed, 87 insertions(+), 233 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index 8b4c0dc3a2..bffc018848 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -1449,7 +1449,7 @@ grab_blocks(struct vl_mpeg12_mc_renderer *r, unsigned mbx, unsigned mby, assert(r); assert(blocks); - tex_pitch = r->tex_transfer[0]->stride / r->tex_transfer[0]->block.size; + tex_pitch = r->tex_transfer[0]->stride / pf_get_blocksize(r->tex_transfer[0]->texture->format); texels = r->texels[0] + mbpy * tex_pitch + mbpx; for (y = 0; y < 2; ++y) { @@ -1488,7 +1488,7 @@ grab_blocks(struct vl_mpeg12_mc_renderer *r, unsigned mbx, unsigned mby, mbpy /= 2; for (tb = 0; tb < 2; ++tb) { - tex_pitch = r->tex_transfer[tb + 1]->stride / r->tex_transfer[tb + 1]->block.size; + tex_pitch = r->tex_transfer[tb + 1]->stride / pf_get_blocksize(r->tex_transfer[tb + 1]->texture->format); texels = r->texels[tb + 1] + mbpy * tex_pitch + mbpx; if ((cbp >> (1 - tb)) & 1) { diff --git a/src/gallium/drivers/trace/tr_dump_state.c b/src/gallium/drivers/trace/tr_dump_state.c index 6d58209294..0102cc1876 100644 --- a/src/gallium/drivers/trace/tr_dump_state.c +++ b/src/gallium/drivers/trace/tr_dump_state.c @@ -43,19 +43,6 @@ void trace_dump_format(enum pipe_format format) } -void trace_dump_block(const struct pipe_format_block *block) -{ - if (!trace_dumping_enabled_locked()) - return; - - trace_dump_struct_begin("pipe_format_block"); - trace_dump_member(uint, block, size); - trace_dump_member(uint, block, width); - trace_dump_member(uint, block, height); - trace_dump_struct_end(); -} - - static void trace_dump_reference(const struct pipe_reference *reference) { if (!trace_dumping_enabled_locked()) @@ -94,10 +81,6 @@ void trace_dump_template(const struct pipe_texture *templat) trace_dump_uint(templat->depth0); trace_dump_member_end(); - trace_dump_member_begin("block"); - trace_dump_block(&templat->block); - trace_dump_member_end(); - trace_dump_member(uint, templat, last_level); trace_dump_member(uint, templat, tex_usage); @@ -483,16 +466,9 @@ void trace_dump_transfer(const struct pipe_transfer *state) trace_dump_struct_begin("pipe_transfer"); - trace_dump_member(format, state, format); trace_dump_member(uint, state, width); trace_dump_member(uint, state, height); - trace_dump_member_begin("block"); - trace_dump_block(&state->block); - trace_dump_member_end(); - - trace_dump_member(uint, state, nblocksx); - trace_dump_member(uint, state, nblocksy); trace_dump_member(uint, state, stride); trace_dump_member(uint, state, usage); diff --git a/src/gallium/drivers/trace/tr_dump_state.h b/src/gallium/drivers/trace/tr_dump_state.h index 05b821adb6..07ad6fbb20 100644 --- a/src/gallium/drivers/trace/tr_dump_state.h +++ b/src/gallium/drivers/trace/tr_dump_state.h @@ -35,11 +35,8 @@ void trace_dump_format(enum pipe_format format); -void trace_dump_block(const struct pipe_format_block *block); - void trace_dump_template(const struct pipe_texture *templat); - void trace_dump_rasterizer_state(const struct pipe_rasterizer_state *state); void trace_dump_poly_stipple(const struct pipe_poly_stipple *state); diff --git a/src/gallium/drivers/trace/tr_rbug.c b/src/gallium/drivers/trace/tr_rbug.c index b59458c0e3..af1d7f3224 100644 --- a/src/gallium/drivers/trace/tr_rbug.c +++ b/src/gallium/drivers/trace/tr_rbug.c @@ -203,7 +203,9 @@ trace_rbug_texture_info(struct trace_rbug *tr_rbug, struct rbug_header *header, &t->width0, 1, &t->height0, 1, &t->depth0, 1, - t->block.width, t->block.height, t->block.size, + pf_get_blockwidth(t->format), + pf_get_blockheight(t->format), + pf_get_blocksize(t->format), t->last_level, t->nr_samples, t->tex_usage, @@ -251,9 +253,12 @@ trace_rbug_texture_read(struct trace_rbug *tr_rbug, struct rbug_header *header, map = screen->transfer_map(screen, t); rbug_send_texture_read_reply(tr_rbug->con, serial, - t->format, - t->block.width, t->block.height, t->block.size, - (uint8_t*)map, t->stride * t->nblocksy, + t->texture->format, + pf_get_blockwidth(t->texture->format), + pf_get_blockheight(t->texture->format), + pf_get_blocksize(t->texture->format), + (uint8_t*)map, + t->stride * pf_get_nblocksy(t->texture->format, t->height), t->stride, NULL); diff --git a/src/gallium/drivers/trace/tr_screen.c b/src/gallium/drivers/trace/tr_screen.c index 7da9bd3866..f69f7da000 100644 --- a/src/gallium/drivers/trace/tr_screen.c +++ b/src/gallium/drivers/trace/tr_screen.c @@ -35,6 +35,7 @@ #include "tr_screen.h" #include "pipe/p_inlines.h" +#include "pipe/p_format.h" static boolean trace = FALSE; @@ -424,7 +425,7 @@ trace_screen_transfer_unmap(struct pipe_screen *_screen, struct pipe_transfer *transfer = tr_trans->transfer; if(tr_trans->map) { - size_t size = transfer->nblocksy * transfer->stride; + size_t size = pf_get_nblocksy(transfer->texture->format, transfer->width) * transfer->stride; trace_dump_call_begin("pipe_screen", "transfer_write"); diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c index 45a6059ea8..099cf1e064 100644 --- a/src/gallium/state_trackers/dri/dri_drawable.c +++ b/src/gallium/state_trackers/dri/dri_drawable.c @@ -66,7 +66,6 @@ dri_surface_from_handle(struct drm_api *api, templat.format = format; templat.width0 = width; templat.height0 = height; - pf_get_block(templat.format, &templat.block); texture = api->texture_from_shared_handle(api, screen, &templat, "dri2 buffer", pitch, handle); diff --git a/src/gallium/state_trackers/egl/egl_surface.c b/src/gallium/state_trackers/egl/egl_surface.c index ddd9b04cd4..737bdfdd34 100644 --- a/src/gallium/state_trackers/egl/egl_surface.c +++ b/src/gallium/state_trackers/egl/egl_surface.c @@ -118,7 +118,6 @@ drm_create_texture(_EGLDisplay *dpy, templat.format = PIPE_FORMAT_A8R8G8B8_UNORM; templat.width0 = w; templat.height0 = h; - pf_get_block(templat.format, &templat.block); texture = screen->texture_create(dev->screen, &templat); diff --git a/src/gallium/state_trackers/python/gallium.i b/src/gallium/state_trackers/python/gallium.i index 3f79cc1a3d..8e323f4896 100644 --- a/src/gallium/state_trackers/python/gallium.i +++ b/src/gallium/state_trackers/python/gallium.i @@ -80,7 +80,6 @@ %rename(Stencil) pipe_stencil_state; %rename(Alpha) pipe_alpha_state; %rename(DepthStencilAlpha) pipe_depth_stencil_alpha_state; -%rename(FormatBlock) pipe_format_block; %rename(Framebuffer) pipe_framebuffer_state; %rename(PolyStipple) pipe_poly_stipple; %rename(Rasterizer) pipe_rasterizer_state; diff --git a/src/gallium/state_trackers/python/p_device.i b/src/gallium/state_trackers/python/p_device.i index a83bcc71a1..2dc995adb0 100644 --- a/src/gallium/state_trackers/python/p_device.i +++ b/src/gallium/state_trackers/python/p_device.i @@ -112,7 +112,6 @@ struct st_device { struct pipe_texture templat; memset(&templat, 0, sizeof(templat)); templat.format = format; - pf_get_block(templat.format, &templat.block); templat.width0 = width; templat.height0 = height; templat.depth0 = depth; diff --git a/src/gallium/state_trackers/python/p_format.i b/src/gallium/state_trackers/python/p_format.i index 26fb12b387..68df009331 100644 --- a/src/gallium/state_trackers/python/p_format.i +++ b/src/gallium/state_trackers/python/p_format.i @@ -152,11 +152,3 @@ enum pipe_format { PIPE_FORMAT_DXT5_SRGBA, }; - -struct pipe_format_block -{ - unsigned size; - unsigned width; - unsigned height; -}; - diff --git a/src/gallium/state_trackers/python/p_texture.i b/src/gallium/state_trackers/python/p_texture.i index 5416b872f5..1de7f86a3c 100644 --- a/src/gallium/state_trackers/python/p_texture.i +++ b/src/gallium/state_trackers/python/p_texture.i @@ -69,15 +69,7 @@ unsigned get_depth(unsigned level=0) { return u_minify($self->depth0, level); } - - unsigned get_nblocksx(unsigned level=0) { - return $self->nblocksx[level]; - } - - unsigned get_nblocksy(unsigned level=0) { - return $self->nblocksy[level]; - } - + /** Get a surface which is a "view" into a texture */ struct st_surface * get_surface(unsigned face=0, unsigned level=0, unsigned zslice=0) @@ -126,8 +118,6 @@ struct st_surface unsigned format; unsigned width; unsigned height; - unsigned nblocksx; - unsigned nblocksy; ~st_surface() { pipe_texture_reference(&$self->texture, NULL); @@ -142,8 +132,8 @@ struct st_surface struct pipe_transfer *transfer; unsigned stride; - stride = pf_get_nblocksx(&texture->block, w) * texture->block.size; - *LENGTH = pf_get_nblocksy(&texture->block, h) * stride; + stride = pf_get_stride(texture->format, w); + *LENGTH = pf_get_nblocksy(texture->format, h) * stride; *STRING = (char *) malloc(*LENGTH); if(!*STRING) return; @@ -169,9 +159,9 @@ struct st_surface struct pipe_transfer *transfer; if(stride == 0) - stride = pf_get_nblocksx(&texture->block, w) * texture->block.size; + stride = pf_get_stride(texture->format, w); - if(LENGTH < pf_get_nblocksy(&texture->block, h) * stride) + if(LENGTH < pf_get_nblocksy(texture->format, h) * stride) SWIG_exception(SWIG_ValueError, "offset must be smaller than buffer size"); transfer = screen->get_tex_transfer(screen, @@ -383,18 +373,6 @@ struct st_surface { return u_minify(surface->texture->height0, 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 */ diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index d0bcb690a9..3251046c79 100755 --- a/src/gallium/state_trackers/python/retrace/interpreter.py +++ b/src/gallium/state_trackers/python/retrace/interpreter.py @@ -99,7 +99,6 @@ struct_factories = { "pipe_stencil_state": gallium.Stencil, "pipe_alpha_state": gallium.Alpha, "pipe_depth_stencil_alpha_state": gallium.DepthStencilAlpha, - "pipe_format_block": gallium.FormatBlock, #"pipe_framebuffer_state": gallium.Framebuffer, "pipe_poly_stipple": gallium.PolyStipple, "pipe_rasterizer_state": gallium.Rasterizer, @@ -307,7 +306,7 @@ class Screen(Object): def surface_write(self, surface, data, stride, size): if surface is None: return - assert surface.nblocksy * stride == size +# assert surface.nblocksy * stride == size surface.put_tile_raw(0, 0, surface.width, surface.height, data, stride) def get_tex_transfer(self, texture, face, level, zslice, usage, x, y, w, h): diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c index a791113aba..2966b24cdc 100644 --- a/src/gallium/state_trackers/python/st_device.c +++ b/src/gallium/state_trackers/python/st_device.c @@ -249,9 +249,6 @@ st_context_create(struct st_device *st_dev) memset( &templat, 0, sizeof( templat ) ); templat.target = PIPE_TEXTURE_2D; templat.format = PIPE_FORMAT_A8R8G8B8_UNORM; - templat.block.size = 4; - templat.block.width = 1; - templat.block.height = 1; templat.width0 = 1; templat.height0 = 1; templat.depth0 = 1; diff --git a/src/gallium/state_trackers/python/st_sample.c b/src/gallium/state_trackers/python/st_sample.c index 6fee90afda..97ca2afc54 100644 --- a/src/gallium/state_trackers/python/st_sample.c +++ b/src/gallium/state_trackers/python/st_sample.c @@ -423,7 +423,6 @@ dxt5_rgba_data[] = { static INLINE void st_sample_dxt_pixel_block(enum pipe_format format, - const struct pipe_format_block *block, uint8_t *raw, float *rgba, unsigned rgba_stride, unsigned w, unsigned h) @@ -462,21 +461,21 @@ st_sample_dxt_pixel_block(enum pipe_format format, for(ch = 0; ch < 4; ++ch) rgba[y*rgba_stride + x*4 + ch] = (float)(data[i].rgba[y*4*4 + x*4 + ch])/255.0f; - memcpy(raw, data[i].raw, block->size); + memcpy(raw, data[i].raw, pf_get_blocksize(format)); } static INLINE void st_sample_generic_pixel_block(enum pipe_format format, - const struct pipe_format_block *block, uint8_t *raw, float *rgba, unsigned rgba_stride, unsigned w, unsigned h) { unsigned i; unsigned x, y, ch; + int blocksize = pf_get_blocksize(format); - for(i = 0; i < block->size; ++i) + for(i = 0; i < blocksize; ++i) raw[i] = (uint8_t)st_random(); @@ -503,7 +502,6 @@ st_sample_generic_pixel_block(enum pipe_format format, */ void st_sample_pixel_block(enum pipe_format format, - const struct pipe_format_block *block, void *raw, float *rgba, unsigned rgba_stride, unsigned w, unsigned h) @@ -513,11 +511,11 @@ st_sample_pixel_block(enum pipe_format format, case PIPE_FORMAT_DXT1_RGBA: case PIPE_FORMAT_DXT3_RGBA: case PIPE_FORMAT_DXT5_RGBA: - st_sample_dxt_pixel_block(format, block, raw, rgba, rgba_stride, w, h); + st_sample_dxt_pixel_block(format, raw, rgba, rgba_stride, w, h); break; default: - st_sample_generic_pixel_block(format, block, raw, rgba, rgba_stride, w, h); + st_sample_generic_pixel_block(format, raw, rgba, rgba_stride, w, h); break; } } @@ -548,18 +546,23 @@ st_sample_surface(struct st_surface *surface, float *rgba) raw = screen->transfer_map(screen, transfer); if (raw) { - const struct pipe_format_block *block = &texture->block; + enum pipe_format format = texture->format; uint x, y; + int nblocksx = pf_get_nblocksx(format, width); + int nblocksy = pf_get_nblocksy(format, height); + int blockwidth = pf_get_blockwidth(format); + int blockheight = pf_get_blockheight(format); + int blocksize = pf_get_blocksize(format); - for (y = 0; y < transfer->nblocksy; ++y) { - for (x = 0; x < transfer->nblocksx; ++x) { - 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, + + for (y = 0; y < nblocksy; ++y) { + for (x = 0; x < nblocksx; ++x) { + st_sample_pixel_block(format, + (uint8_t *) raw + y * transfer->stride + x * blocksize, + rgba + y * blockheight * rgba_stride + x * blockwidth * 4, rgba_stride, - MIN2(block->width, width - x*block->width), - MIN2(block->height, height - y*block->height)); + MIN2(blockwidth, width - x*blockwidth), + MIN2(blockheight, height - y*blockheight)); } } diff --git a/src/gallium/state_trackers/python/st_sample.h b/src/gallium/state_trackers/python/st_sample.h index 0a27083549..888114d302 100644 --- a/src/gallium/state_trackers/python/st_sample.h +++ b/src/gallium/state_trackers/python/st_sample.h @@ -35,7 +35,6 @@ void st_sample_pixel_block(enum pipe_format format, - const struct pipe_format_block *block, void *raw, float *rgba, unsigned rgba_stride, unsigned w, unsigned h); diff --git a/src/gallium/state_trackers/python/st_softpipe_winsys.c b/src/gallium/state_trackers/python/st_softpipe_winsys.c index f0abd12e3d..43c61af1ff 100644 --- a/src/gallium/state_trackers/python/st_softpipe_winsys.c +++ b/src/gallium/state_trackers/python/st_softpipe_winsys.c @@ -157,16 +157,6 @@ st_softpipe_user_buffer_create(struct pipe_winsys *winsys, } -/** - * Round n up to next multiple. - */ -static INLINE unsigned -round_up(unsigned n, unsigned multiple) -{ - return (n + multiple - 1) & ~(multiple - 1); -} - - static struct pipe_buffer * st_softpipe_surface_buffer_create(struct pipe_winsys *winsys, unsigned width, unsigned height, @@ -176,13 +166,10 @@ st_softpipe_surface_buffer_create(struct pipe_winsys *winsys, unsigned *stride) { const unsigned alignment = 64; - struct pipe_format_block block; - unsigned nblocksx, nblocksy; + unsigned nblocksy; - pf_get_block(format, &block); - nblocksx = pf_get_nblocksx(&block, width); - nblocksy = pf_get_nblocksy(&block, height); - *stride = round_up(nblocksx * block.size, alignment); + nblocksy = pf_get_nblocksy(format, height); + *stride = align(pf_get_stride(format, width), alignment); return winsys->buffer_create(winsys, alignment, usage, diff --git a/src/gallium/state_trackers/python/tests/surface_copy.py b/src/gallium/state_trackers/python/tests/surface_copy.py index 3ceecbbd3a..df5babb78a 100755 --- a/src/gallium/state_trackers/python/tests/surface_copy.py +++ b/src/gallium/state_trackers/python/tests/surface_copy.py @@ -98,9 +98,10 @@ class TextureTest(TestCase): y = 0 w = dst_surface.width h = dst_surface.height - - stride = dst_surface.nblocksx * dst_texture.block.size - size = dst_surface.nblocksy * stride + + # ??? + stride = pf_get_stride(texture->format, w) + size = pf_get_nblocksy(texture->format) * stride src_raw = os.urandom(size) src_surface.put_tile_raw(0, 0, w, h, src_raw, stride) diff --git a/src/gallium/state_trackers/python/tests/texture_transfer.py b/src/gallium/state_trackers/python/tests/texture_transfer.py index e65b425adf..35daca9e49 100755 --- a/src/gallium/state_trackers/python/tests/texture_transfer.py +++ b/src/gallium/state_trackers/python/tests/texture_transfer.py @@ -86,8 +86,9 @@ class TextureTest(TestCase): surface = texture.get_surface(face, level, zslice) - stride = surface.nblocksx * texture.block.size - size = surface.nblocksy * stride + # ??? + stride = pf_get_stride(texture->format, w) + size = pf_get_nblocksy(texture->format) * stride in_raw = os.urandom(size) diff --git a/src/gallium/state_trackers/vega/api_filters.c b/src/gallium/state_trackers/vega/api_filters.c index faf396d087..eb135c1ff4 100644 --- a/src/gallium/state_trackers/vega/api_filters.c +++ b/src/gallium/state_trackers/vega/api_filters.c @@ -71,7 +71,6 @@ static INLINE struct pipe_texture *create_texture_1d(struct vg_context *ctx, templ.width0 = color_data_len; templ.height0 = 1; templ.depth0 = 1; - pf_get_block(PIPE_FORMAT_A8R8G8B8_UNORM, &templ.block); templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; tex = screen->texture_create(screen, &templ); diff --git a/src/gallium/state_trackers/vega/image.c b/src/gallium/state_trackers/vega/image.c index 4684a5727d..172311851e 100644 --- a/src/gallium/state_trackers/vega/image.c +++ b/src/gallium/state_trackers/vega/image.c @@ -270,7 +270,6 @@ struct vg_image * image_create(VGImageFormat format, memset(&pt, 0, sizeof(pt)); pt.target = PIPE_TEXTURE_2D; pt.format = pformat; - pf_get_block(pformat, &pt.block); pt.last_level = 0; pt.width0 = width; pt.height0 = height; diff --git a/src/gallium/state_trackers/vega/mask.c b/src/gallium/state_trackers/vega/mask.c index b84103fdba..868c28239a 100644 --- a/src/gallium/state_trackers/vega/mask.c +++ b/src/gallium/state_trackers/vega/mask.c @@ -491,7 +491,6 @@ struct vg_mask_layer * mask_layer_create(VGint width, VGint height) memset(&pt, 0, sizeof(pt)); pt.target = PIPE_TEXTURE_2D; pt.format = PIPE_FORMAT_A8R8G8B8_UNORM; - pf_get_block(PIPE_FORMAT_A8R8G8B8_UNORM, &pt.block); pt.last_level = 0; pt.width0 = width; pt.height0 = height; diff --git a/src/gallium/state_trackers/vega/paint.c b/src/gallium/state_trackers/vega/paint.c index e8ca7d9e89..785c982943 100644 --- a/src/gallium/state_trackers/vega/paint.c +++ b/src/gallium/state_trackers/vega/paint.c @@ -154,7 +154,6 @@ static INLINE struct pipe_texture *create_gradient_texture(struct vg_paint *p) templ.width0 = 1024; templ.height0 = 1; templ.depth0 = 1; - pf_get_block(PIPE_FORMAT_A8R8G8B8_UNORM, &templ.block); templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; tex = screen->texture_create(screen, &templ); diff --git a/src/gallium/state_trackers/vega/renderer.c b/src/gallium/state_trackers/vega/renderer.c index 9085ed1bfe..c85dae0282 100644 --- a/src/gallium/state_trackers/vega/renderer.c +++ b/src/gallium/state_trackers/vega/renderer.c @@ -448,7 +448,6 @@ void renderer_copy_surface(struct renderer *ctx, texTemp.width0 = srcW; texTemp.height0 = srcH; texTemp.depth0 = 1; - pf_get_block(src->format, &texTemp.block); tex = screen->texture_create(screen, &texTemp); if (!tex) diff --git a/src/gallium/state_trackers/vega/vg_tracker.c b/src/gallium/state_trackers/vega/vg_tracker.c index d28463dd1b..ed18dd6075 100644 --- a/src/gallium/state_trackers/vega/vg_tracker.c +++ b/src/gallium/state_trackers/vega/vg_tracker.c @@ -50,7 +50,6 @@ create_texture(struct pipe_context *pipe, enum pipe_format format, } templ.target = PIPE_TEXTURE_2D; - pf_get_block(templ.format, &templ.block); templ.width0 = width; templ.height0 = height; templ.depth0 = 1; diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index c4751724c9..0d1844b53c 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -191,7 +191,6 @@ crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image) templat.format = PIPE_FORMAT_A8R8G8B8_UNORM; templat.width0 = 64; templat.height0 = 64; - pf_get_block(templat.format, &templat.block); crtcp->cursor_tex = ms->screen->texture_create(ms->screen, &templat); @@ -207,7 +206,7 @@ crtc_load_cursor_argb(xf86CrtcPtr crtc, CARD32 * image) PIPE_TRANSFER_WRITE, 0, 0, 64, 64); ptr = ms->screen->transfer_map(ms->screen, transfer); - util_copy_rect(ptr, &crtcp->cursor_tex->block, + util_copy_rect(ptr, crtcp->cursor_tex->format, transfer->stride, 0, 0, 64, 64, (void*)image, 64 * 4, 0, 0); ms->screen->transfer_unmap(ms->screen, transfer); diff --git a/src/gallium/state_trackers/xorg/xorg_dri2.c b/src/gallium/state_trackers/xorg/xorg_dri2.c index 406e0afff4..d3bb381333 100644 --- a/src/gallium/state_trackers/xorg/xorg_dri2.c +++ b/src/gallium/state_trackers/xorg/xorg_dri2.c @@ -108,7 +108,6 @@ driDoCreateBuffer(DrawablePtr pDraw, DRI2BufferPtr buffer, unsigned int format) else template.format = ms->ds_depth_bits_last ? PIPE_FORMAT_S8Z24_UNORM : PIPE_FORMAT_Z24S8_UNORM; - pf_get_block(template.format, &template.block); template.width0 = pDraw->width; template.height0 = pDraw->height; template.depth0 = 1; diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index a68a626fa4..c02ed39ca1 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -206,7 +206,7 @@ ExaDownloadFromScreen(PixmapPtr pPix, int x, int y, int w, int h, char *dst, x, y, w, h, dst_pitch); #endif - util_copy_rect((unsigned char*)dst, &priv->tex->block, dst_pitch, 0, 0, + util_copy_rect((unsigned char*)dst, priv->tex->format, dst_pitch, 0, 0, w, h, exa->scrn->transfer_map(exa->scrn, transfer), transfer->stride, 0, 0); @@ -246,7 +246,7 @@ ExaUploadToScreen(PixmapPtr pPix, int x, int y, int w, int h, char *src, #endif util_copy_rect(exa->scrn->transfer_map(exa->scrn, transfer), - &priv->tex->block, transfer->stride, 0, 0, w, h, + priv->tex->format, transfer->stride, 0, 0, w, h, (unsigned char*)src, src_pitch, 0, 0); exa->scrn->transfer_unmap(exa->scrn, transfer); @@ -761,7 +761,6 @@ ExaModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, memset(&template, 0, sizeof(template)); template.target = PIPE_TEXTURE_2D; exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &priv->picture_format); - pf_get_block(template.format, &template.block); template.width0 = width; template.height0 = height; template.depth0 = 1; @@ -840,7 +839,6 @@ xorg_exa_create_root_texture(ScrnInfoPtr pScrn, memset(&template, 0, sizeof(template)); template.target = PIPE_TEXTURE_2D; exa_get_pipe_format(depth, &template.format, &bitsPerPixel, &dummy); - pf_get_block(template.format, &template.block); template.width0 = width; template.height0 = height; template.depth0 = 1; diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 418a8dd88b..5c34e71b1b 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -733,7 +733,6 @@ create_sampler_texture(struct xorg_renderer *r, templ.width0 = src->width0; templ.height0 = src->height0; templ.depth0 = 1; - pf_get_block(format, &templ.block); templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; pt = screen->texture_create(screen, &templ); diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index bb515a0f49..459ab3c64e 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -170,7 +170,6 @@ create_component_texture(struct pipe_context *pipe, templ.width0 = width; templ.height0 = height; templ.depth0 = 1; - pf_get_block(PIPE_FORMAT_L8_UNORM, &templ.block); templ.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER; tex = screen->texture_create(screen, &templ); diff --git a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c index d497861324..8d95826c9a 100644 --- a/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c +++ b/src/gallium/winsys/drm/nouveau/drm/nouveau_drm_api.c @@ -28,7 +28,6 @@ dri_surface_from_handle(struct drm_api *api, struct pipe_screen *pscreen, tmpl.format = format; tmpl.width0 = width; tmpl.height0 = height; - pf_get_block(tmpl.format, &tmpl.block); pt = api->texture_from_shared_handle(api, pscreen, &tmpl, "front buffer", pitch, handle); @@ -247,7 +246,7 @@ nouveau_drm_handle_from_pt(struct drm_api *api, struct pipe_screen *pscreen, return false; *handle = mt->bo->handle; - *stride = mt->base.nblocksx[0] * mt->base.block.size; + *stride = pf_get_stride(mt->base.format, mt->base.width0); return true; } diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c index 74afffc9cf..65f7babff2 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c @@ -113,17 +113,13 @@ static struct pipe_buffer *radeon_surface_buffer_create(struct pipe_winsys *ws, unsigned tex_usage, unsigned *stride) { - struct pipe_format_block block; - unsigned nblocksx, nblocksy, size; - - pf_get_block(format, &block); - - nblocksx = pf_get_nblocksx(&block, width); - nblocksy = pf_get_nblocksy(&block, height); - /* Radeons enjoy things in multiples of 32. */ /* XXX this can be 32 when POT */ - *stride = (nblocksx * block.size + 63) & ~63; + const unsigned alignment = 64; + unsigned nblocksy, size; + + nblocksy = pf_get_nblocksy(format, height); + *stride = align(pf_get_stride(format, width), alignment); size = *stride * nblocksy; return radeon_buffer_create(ws, 64, usage, size); @@ -321,9 +317,6 @@ struct pipe_surface *radeon_surface_from_handle(struct radeon_context *radeon_co tmpl.height0 = h; tmpl.depth0 = 1; tmpl.format = format; - pf_get_block(tmpl.format, &tmpl.block); - tmpl.nblocksx[0] = pf_get_nblocksx(&tmpl.block, w); - tmpl.nblocksy[0] = pf_get_nblocksy(&tmpl.block, h); pt = pipe_screen->texture_blanket(pipe_screen, &tmpl, &pitch, pb); if (pt == NULL) { diff --git a/src/gallium/winsys/egl_xlib/sw_winsys.c b/src/gallium/winsys/egl_xlib/sw_winsys.c index 79ff2cc985..d5644c161f 100644 --- a/src/gallium/winsys/egl_xlib/sw_winsys.c +++ b/src/gallium/winsys/egl_xlib/sw_winsys.c @@ -71,16 +71,6 @@ sw_pipe_buffer(struct pipe_buffer *b) } -/** - * Round n up to next multiple. - */ -static INLINE unsigned -round_up(unsigned n, unsigned multiple) -{ - return (n + multiple - 1) & ~(multiple - 1); -} - - static const char * get_name(struct pipe_winsys *pws) { @@ -170,13 +160,10 @@ surface_buffer_create(struct pipe_winsys *winsys, unsigned *stride) { const unsigned alignment = 64; - struct pipe_format_block block; - unsigned nblocksx, nblocksy; + unsigned nblocksy; - pf_get_block(format, &block); - nblocksx = pf_get_nblocksx(&block, width); - nblocksy = pf_get_nblocksy(&block, height); - *stride = round_up(nblocksx * block.size, alignment); + nblocksy = pf_get_nblocksy(format, height); + *stride = align(pf_get_stride(format, width), alignment); return winsys->buffer_create(winsys, alignment, usage, diff --git a/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c b/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c index 08067aad64..b8c8502d7b 100644 --- a/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c +++ b/src/gallium/winsys/g3dvl/xlib/xsp_winsys.c @@ -138,13 +138,10 @@ static struct pipe_buffer* xsp_surface_buffer_create ) { const unsigned int ALIGNMENT = 1; - struct pipe_format_block block; - unsigned nblocksx, nblocksy; + unsigned nblocksy; - pf_get_block(format, &block); - nblocksx = pf_get_nblocksx(&block, width); - nblocksy = pf_get_nblocksy(&block, height); - *stride = align(nblocksx * block.size, ALIGNMENT); + nblocksy = pf_get_nblocksy(format, height); + *stride = align(pf_get_stride(format, width), ALIGNMENT); return pws->buffer_create(pws, ALIGNMENT, usage, *stride * nblocksy); diff --git a/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c b/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c index e8bc0f55ac..81c46c0a96 100644 --- a/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c +++ b/src/gallium/winsys/gdi/gdi_llvmpipe_winsys.c @@ -49,7 +49,6 @@ struct gdi_llvmpipe_displaytarget { enum pipe_format format; - struct pipe_format_block block; unsigned width; unsigned height; unsigned stride; @@ -118,16 +117,6 @@ gdi_llvmpipe_displaytarget_destroy(struct llvmpipe_winsys *winsys, } -/** - * Round n up to next multiple. - */ -static INLINE unsigned -round_up(unsigned n, unsigned multiple) -{ - return (n + multiple - 1) & ~(multiple - 1); -} - - static struct llvmpipe_displaytarget * gdi_llvmpipe_displaytarget_create(struct llvmpipe_winsys *winsys, enum pipe_format format, @@ -147,10 +136,10 @@ gdi_llvmpipe_displaytarget_create(struct llvmpipe_winsys *winsys, gdt->width = width; gdt->height = height; - bpp = pf_get_bits(format); - cpp = pf_get_size(format); + bpp = pf_get_blocksizebits(format); + cpp = pf_get_blocksize(format); - gdt->stride = round_up(width * cpp, alignment); + gdt->stride = align(width * cpp, alignment); gdt->size = gdt->stride * height; gdt->data = align_malloc(gdt->size, alignment); diff --git a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c index 5e0ccf32f4..173fa5b6fe 100644 --- a/src/gallium/winsys/gdi/gdi_softpipe_winsys.c +++ b/src/gallium/winsys/gdi/gdi_softpipe_winsys.c @@ -151,16 +151,6 @@ gdi_softpipe_user_buffer_create(struct pipe_winsys *winsys, } -/** - * Round n up to next multiple. - */ -static INLINE unsigned -round_up(unsigned n, unsigned multiple) -{ - return (n + multiple - 1) & ~(multiple - 1); -} - - static struct pipe_buffer * gdi_softpipe_surface_buffer_create(struct pipe_winsys *winsys, unsigned width, unsigned height, @@ -170,13 +160,10 @@ gdi_softpipe_surface_buffer_create(struct pipe_winsys *winsys, unsigned *stride) { const unsigned alignment = 64; - struct pipe_format_block block; - unsigned nblocksx, nblocksy; + unsigned nblocksy; - pf_get_block(format, &block); - nblocksx = pf_get_nblocksx(&block, width); - nblocksy = pf_get_nblocksy(&block, height); - *stride = round_up(nblocksx * block.size, alignment); + nblocksy = pf_get_nblocksy(format, height); + *stride = align(pf_get_stride(format, width), alignment); return winsys->buffer_create(winsys, alignment, usage, @@ -283,10 +270,10 @@ gdi_softpipe_present(struct pipe_screen *screen, memset(&bmi, 0, sizeof(BITMAPINFO)); bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bmi.bmiHeader.biWidth = texture->stride[surface->level] / pf_get_size(surface->format); + bmi.bmiHeader.biWidth = texture->stride[surface->level] / pf_get_blocksize(surface->format); bmi.bmiHeader.biHeight= -(long)surface->height; bmi.bmiHeader.biPlanes = 1; - bmi.bmiHeader.biBitCount = pf_get_bits(surface->format); + bmi.bmiHeader.biBitCount = pf_get_blocksizebits(surface->format); bmi.bmiHeader.biCompression = BI_RGB; bmi.bmiHeader.biSizeImage = 0; bmi.bmiHeader.biXPelsPerMeter = 0; diff --git a/src/gallium/winsys/xlib/xlib_cell.c b/src/gallium/winsys/xlib/xlib_cell.c index 13e609f58f..6e984ebe3c 100644 --- a/src/gallium/winsys/xlib/xlib_cell.c +++ b/src/gallium/winsys/xlib/xlib_cell.c @@ -277,15 +277,6 @@ xm_user_buffer_create(struct pipe_winsys *pws, void *ptr, unsigned bytes) -/** - * Round n up to next multiple. - */ -static INLINE unsigned -round_up(unsigned n, unsigned multiple) -{ - return (n + multiple - 1) & ~(multiple - 1); -} - static struct pipe_buffer * xm_surface_buffer_create(struct pipe_winsys *winsys, unsigned width, unsigned height, @@ -294,18 +285,15 @@ xm_surface_buffer_create(struct pipe_winsys *winsys, unsigned *stride) { const unsigned alignment = 64; - struct pipe_format_block block; - unsigned nblocksx, nblocksy; + unsigned nblocksy; - pf_get_block(format, &block); - nblocksx = pf_get_nblocksx(&block, width); - nblocksy = pf_get_nblocksy(&block, height); - *stride = round_up(nblocksx * block.size, alignment); + nblocksy = pf_get_nblocksy(format, height); + *stride = align(pf_get_stride(format, width), alignment); return winsys->buffer_create(winsys, alignment, usage, /* XXX a bit of a hack */ - *stride * round_up(nblocksy, TILE_SIZE)); + *stride * align(nblocksy, TILE_SIZE)); } diff --git a/src/gallium/winsys/xlib/xlib_llvmpipe.c b/src/gallium/winsys/xlib/xlib_llvmpipe.c index 3dd15e099b..41f3e248e8 100644 --- a/src/gallium/winsys/xlib/xlib_llvmpipe.c +++ b/src/gallium/winsys/xlib/xlib_llvmpipe.c @@ -58,7 +58,6 @@ struct xm_displaytarget { enum pipe_format format; - struct pipe_format_block block; unsigned width; unsigned height; unsigned stride; @@ -262,10 +261,10 @@ xm_llvmpipe_display(struct xmesa_buffer *xm_buffer, { if (xm_dt->tempImage == NULL) { - assert(xm_dt->block.width == 1); - assert(xm_dt->block.height == 1); + assert(pf_get_blockwidth(xm_dt->format) == 1); + assert(pf_get_blockheight(xm_dt->format) == 1); alloc_shm_ximage(xm_dt, xm_buffer, - xm_dt->stride / xm_dt->block.size, + xm_dt->stride / pf_get_blocksize(xm_dt->format), xm_dt->height); } @@ -321,7 +320,7 @@ xm_displaytarget_create(struct llvmpipe_winsys *winsys, unsigned *stride) { struct xm_displaytarget *xm_dt = CALLOC_STRUCT(xm_displaytarget); - unsigned nblocksx, nblocksy, size; + unsigned nblocksy, size; xm_dt = CALLOC_STRUCT(xm_displaytarget); if(!xm_dt) @@ -331,10 +330,8 @@ xm_displaytarget_create(struct llvmpipe_winsys *winsys, xm_dt->width = width; xm_dt->height = height; - pf_get_block(format, &xm_dt->block); - nblocksx = pf_get_nblocksx(&xm_dt->block, width); - nblocksy = pf_get_nblocksy(&xm_dt->block, height); - xm_dt->stride = align(nblocksx * xm_dt->block.size, alignment); + nblocksy = pf_get_nblocksy(format, height); + xm_dt->stride = align(pf_get_stride(format, width), alignment); size = xm_dt->stride * nblocksy; #ifdef USE_XSHM diff --git a/src/gallium/winsys/xlib/xlib_softpipe.c b/src/gallium/winsys/xlib/xlib_softpipe.c index 260b39e2a0..69a5dcc2b7 100644 --- a/src/gallium/winsys/xlib/xlib_softpipe.c +++ b/src/gallium/winsys/xlib/xlib_softpipe.c @@ -254,10 +254,10 @@ xlib_softpipe_display_surface(struct xmesa_buffer *b, { if (xm_buf->tempImage == NULL) { - assert(surf->texture->block.width == 1); - assert(surf->texture->block.height == 1); + assert(pf_get_blockwidth(surf->texture->format) == 1); + assert(pf_get_blockheight(surf->texture->format) == 1); alloc_shm_ximage(xm_buf, b, spt->stride[surf->level] / - surf->texture->block.size, surf->height); + pf_get_blocksize(surf->texture->format), surf->height); } ximage = xm_buf->tempImage; @@ -360,13 +360,10 @@ xm_surface_buffer_create(struct pipe_winsys *winsys, unsigned *stride) { const unsigned alignment = 64; - struct pipe_format_block block; - unsigned nblocksx, nblocksy, size; + unsigned nblocksy, size; - pf_get_block(format, &block); - nblocksx = pf_get_nblocksx(&block, width); - nblocksy = pf_get_nblocksy(&block, height); - *stride = align(nblocksx * block.size, alignment); + nblocksy = pf_get_nblocksy(format, height); + *stride = align(pf_get_stride(format, width), alignment); size = *stride * nblocksy; #ifdef USE_XSHM -- cgit v1.2.3 From 910aaed4daad319b584b68ae2468432c8f6bac21 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 30 Nov 2009 17:55:21 -0800 Subject: mesa: set version string to 7.6.1-rc2 --- src/mesa/main/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index 3e9143979a..e2fed57080 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -32,7 +32,7 @@ #define MESA_MAJOR 7 #define MESA_MINOR 6 #define MESA_PATCH 1 -#define MESA_VERSION_STRING "7.6.1-rc1" +#define MESA_VERSION_STRING "7.6.1-rc2" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -- cgit v1.2.3 From f17dbe256bb38c35d885260be7e5856f1561de97 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 30 Nov 2009 17:56:07 -0800 Subject: mesa: set version string to 7.7-rc1 --- src/mesa/main/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index 0cae1860a3..fddb9a851f 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -32,7 +32,7 @@ #define MESA_MAJOR 7 #define MESA_MINOR 7 #define MESA_PATCH 0 -#define MESA_VERSION_STRING "7.7-devel" +#define MESA_VERSION_STRING "7.7-rc1" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -- cgit v1.2.3 From 2fd1aee217988caacd5c87d76deab3c0caf1bb00 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Fri, 27 Nov 2009 12:33:17 +0100 Subject: tgsi/sanity: Up MAX_REGISTERS to 1024. --- src/gallium/auxiliary/tgsi/tgsi_sanity.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_sanity.c b/src/gallium/auxiliary/tgsi/tgsi_sanity.c index 36e27ea52f..4d8145032b 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_sanity.c +++ b/src/gallium/auxiliary/tgsi/tgsi_sanity.c @@ -34,7 +34,7 @@ typedef uint reg_flag; #define BITS_IN_REG_FLAG (sizeof( reg_flag ) * 8) -#define MAX_REGISTERS 256 +#define MAX_REGISTERS 1024 #define MAX_REG_FLAGS ((MAX_REGISTERS + BITS_IN_REG_FLAG - 1) / BITS_IN_REG_FLAG) struct sanity_check_ctx -- cgit v1.2.3 From 15d1b406afd733b5f46b16dc933e29c218cdca39 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 08:33:43 +0100 Subject: gallium: Introduce separate vertex texture/sampler state. Previously, gallium shared sampler and texture state between vertex and fragment shader stages. This change generalises this concept by providing separate entrypoints for vertex and fragment sampler state setting. A new capability bit is added to query the driver for the number of samplers that can be utilised by a vertex and fragment shader at the same time. --- src/gallium/include/pipe/p_context.h | 17 +++++++++++++---- src/gallium/include/pipe/p_defines.h | 2 ++ src/gallium/include/pipe/p_state.h | 1 + 3 files changed, 16 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h index 5569001e60..f896001eb1 100644 --- a/src/gallium/include/pipe/p_context.h +++ b/src/gallium/include/pipe/p_context.h @@ -123,7 +123,12 @@ struct pipe_context { void * (*create_sampler_state)(struct pipe_context *, const struct pipe_sampler_state *); - void (*bind_sampler_states)(struct pipe_context *, unsigned num, void **); + void (*bind_fragment_sampler_states)(struct pipe_context *, + unsigned num_samplers, + void **samplers); + void (*bind_vertex_sampler_states)(struct pipe_context *, + unsigned num_samplers, + void **samplers); void (*delete_sampler_state)(struct pipe_context *, void *); void * (*create_rasterizer_state)(struct pipe_context *, @@ -173,9 +178,13 @@ struct pipe_context { void (*set_viewport_state)( struct pipe_context *, const struct pipe_viewport_state * ); - void (*set_sampler_textures)( struct pipe_context *, - unsigned num_textures, - struct pipe_texture ** ); + void (*set_fragment_sampler_textures)(struct pipe_context *, + unsigned num_textures, + struct pipe_texture **); + + void (*set_vertex_sampler_textures)(struct pipe_context *, + unsigned num_textures, + struct pipe_texture **); void (*set_vertex_buffers)( struct pipe_context *, unsigned num_buffers, diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index fd14dc8e92..69a0970d5f 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -390,6 +390,8 @@ enum pipe_transfer_usage { #define PIPE_CAP_BLEND_EQUATION_SEPARATE 28 #define PIPE_CAP_SM3 29 /*< Shader Model 3 supported */ #define PIPE_CAP_MAX_PREDICATE_REGISTERS 30 +#define PIPE_CAP_MAX_COMBINED_SAMPLERS 31 /*< Maximum texture image units accessible from vertex + and fragment shaders combined */ /** diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 9766e86620..6de7af6a81 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -60,6 +60,7 @@ extern "C" { #define PIPE_MAX_COLOR_BUFS 8 #define PIPE_MAX_CONSTANT 32 #define PIPE_MAX_SAMPLERS 16 +#define PIPE_MAX_VERTEX_SAMPLERS 16 #define PIPE_MAX_SHADER_INPUTS 16 #define PIPE_MAX_SHADER_OUTPUTS 16 #define PIPE_MAX_TEXTURE_LEVELS 16 -- cgit v1.2.3 From fd4aa4f32365a5f054e7fc36b558680dcac66d1b Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 08:35:43 +0100 Subject: cso: Add support for separate vertex sampler state. --- src/gallium/auxiliary/cso_cache/cso_context.c | 171 +++++++++++++++++++++++++- src/gallium/auxiliary/cso_cache/cso_context.h | 25 ++++ 2 files changed, 192 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index 4f13b3e2ba..b6f7b88322 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -50,20 +50,35 @@ struct cso_context { struct { void *samplers[PIPE_MAX_SAMPLERS]; unsigned nr_samplers; + + void *vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS]; + unsigned nr_vertex_samplers; } hw; void *samplers[PIPE_MAX_SAMPLERS]; unsigned nr_samplers; + void *vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS]; + unsigned nr_vertex_samplers; + unsigned nr_samplers_saved; void *samplers_saved[PIPE_MAX_SAMPLERS]; + unsigned nr_vertex_samplers_saved; + void *vertex_samplers_saved[PIPE_MAX_VERTEX_SAMPLERS]; + struct pipe_texture *textures[PIPE_MAX_SAMPLERS]; uint nr_textures; + struct pipe_texture *vertex_textures[PIPE_MAX_VERTEX_SAMPLERS]; + uint nr_vertex_textures; + uint nr_textures_saved; struct pipe_texture *textures_saved[PIPE_MAX_SAMPLERS]; + uint nr_vertex_textures_saved; + struct pipe_texture *vertex_textures_saved[PIPE_MAX_SAMPLERS]; + /** Current and saved state. * The saved state is used as a 1-deep stack. */ @@ -244,7 +259,8 @@ void cso_release_all( struct cso_context *ctx ) if (ctx->pipe) { ctx->pipe->bind_blend_state( ctx->pipe, NULL ); ctx->pipe->bind_rasterizer_state( ctx->pipe, NULL ); - ctx->pipe->bind_sampler_states( ctx->pipe, 0, NULL ); + ctx->pipe->bind_fragment_sampler_states( ctx->pipe, 0, NULL ); + ctx->pipe->bind_vertex_sampler_states(ctx->pipe, 0, NULL); ctx->pipe->bind_depth_stencil_alpha_state( ctx->pipe, NULL ); ctx->pipe->bind_fs_state( ctx->pipe, NULL ); ctx->pipe->bind_vs_state( ctx->pipe, NULL ); @@ -255,6 +271,11 @@ void cso_release_all( struct cso_context *ctx ) pipe_texture_reference(&ctx->textures_saved[i], NULL); } + for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { + pipe_texture_reference(&ctx->vertex_textures[i], NULL); + pipe_texture_reference(&ctx->vertex_textures_saved[i], NULL); + } + free_framebuffer_state(&ctx->fb); free_framebuffer_state(&ctx->fb_saved); @@ -378,6 +399,46 @@ enum pipe_error cso_single_sampler(struct cso_context *ctx, return PIPE_OK; } +enum pipe_error +cso_single_vertex_sampler(struct cso_context *ctx, + unsigned idx, + const struct pipe_sampler_state *templ) +{ + void *handle = NULL; + + if (templ != NULL) { + unsigned hash_key = cso_construct_key((void*)templ, sizeof(struct pipe_sampler_state)); + struct cso_hash_iter iter = cso_find_state_template(ctx->cache, + hash_key, CSO_SAMPLER, + (void*)templ); + + if (cso_hash_iter_is_null(iter)) { + struct cso_sampler *cso = MALLOC(sizeof(struct cso_sampler)); + if (!cso) + return PIPE_ERROR_OUT_OF_MEMORY; + + memcpy(&cso->state, templ, sizeof(*templ)); + cso->data = ctx->pipe->create_sampler_state(ctx->pipe, &cso->state); + cso->delete_state = (cso_state_callback)ctx->pipe->delete_sampler_state; + cso->context = ctx->pipe; + + iter = cso_insert_state(ctx->cache, hash_key, CSO_SAMPLER, cso); + if (cso_hash_iter_is_null(iter)) { + FREE(cso); + return PIPE_ERROR_OUT_OF_MEMORY; + } + + handle = cso->data; + } + else { + handle = ((struct cso_sampler *)cso_hash_iter_data(iter))->data; + } + } + + ctx->vertex_samplers[idx] = handle; + return PIPE_OK; +} + void cso_single_sampler_done( struct cso_context *ctx ) { unsigned i; @@ -398,7 +459,36 @@ void cso_single_sampler_done( struct cso_context *ctx ) memcpy(ctx->hw.samplers, ctx->samplers, ctx->nr_samplers * sizeof(void *)); ctx->hw.nr_samplers = ctx->nr_samplers; - ctx->pipe->bind_sampler_states(ctx->pipe, ctx->nr_samplers, ctx->samplers); + ctx->pipe->bind_fragment_sampler_states(ctx->pipe, ctx->nr_samplers, ctx->samplers); + } +} + +void +cso_single_vertex_sampler_done(struct cso_context *ctx) +{ + unsigned i; + + /* find highest non-null sampler */ + for (i = PIPE_MAX_VERTEX_SAMPLERS; i > 0; i--) { + if (ctx->vertex_samplers[i - 1] != NULL) + break; + } + + ctx->nr_vertex_samplers = i; + + if (ctx->hw.nr_vertex_samplers != ctx->nr_vertex_samplers || + memcmp(ctx->hw.vertex_samplers, + ctx->vertex_samplers, + ctx->nr_vertex_samplers * sizeof(void *)) != 0) + { + memcpy(ctx->hw.vertex_samplers, + ctx->vertex_samplers, + ctx->nr_vertex_samplers * sizeof(void *)); + ctx->hw.nr_vertex_samplers = ctx->nr_vertex_samplers; + + ctx->pipe->bind_vertex_sampler_states(ctx->pipe, + ctx->nr_vertex_samplers, + ctx->vertex_samplers); } } @@ -447,6 +537,21 @@ void cso_restore_samplers(struct cso_context *ctx) cso_single_sampler_done( ctx ); } +void +cso_save_vertex_samplers(struct cso_context *ctx) +{ + ctx->nr_vertex_samplers_saved = ctx->nr_vertex_samplers; + memcpy(ctx->vertex_samplers_saved, ctx->vertex_samplers, sizeof(ctx->vertex_samplers)); +} + +void +cso_restore_vertex_samplers(struct cso_context *ctx) +{ + ctx->nr_vertex_samplers = ctx->nr_vertex_samplers_saved; + memcpy(ctx->vertex_samplers, ctx->vertex_samplers_saved, sizeof(ctx->vertex_samplers)); + cso_single_vertex_sampler_done(ctx); +} + enum pipe_error cso_set_sampler_textures( struct cso_context *ctx, uint count, @@ -461,7 +566,7 @@ enum pipe_error cso_set_sampler_textures( struct cso_context *ctx, for ( ; i < PIPE_MAX_SAMPLERS; i++) pipe_texture_reference(&ctx->textures[i], NULL); - ctx->pipe->set_sampler_textures(ctx->pipe, count, textures); + ctx->pipe->set_fragment_sampler_textures(ctx->pipe, count, textures); return PIPE_OK; } @@ -491,13 +596,71 @@ void cso_restore_sampler_textures( struct cso_context *ctx ) for ( ; i < PIPE_MAX_SAMPLERS; i++) pipe_texture_reference(&ctx->textures[i], NULL); - ctx->pipe->set_sampler_textures(ctx->pipe, ctx->nr_textures, ctx->textures); + ctx->pipe->set_fragment_sampler_textures(ctx->pipe, ctx->nr_textures, ctx->textures); ctx->nr_textures_saved = 0; } +enum pipe_error +cso_set_vertex_sampler_textures(struct cso_context *ctx, + uint count, + struct pipe_texture **textures) +{ + uint i; + + ctx->nr_vertex_textures = count; + + for (i = 0; i < count; i++) { + pipe_texture_reference(&ctx->vertex_textures[i], textures[i]); + } + for ( ; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { + pipe_texture_reference(&ctx->vertex_textures[i], NULL); + } + + ctx->pipe->set_vertex_sampler_textures(ctx->pipe, count, textures); + + return PIPE_OK; +} + +void +cso_save_vertex_sampler_textures(struct cso_context *ctx) +{ + uint i; + + ctx->nr_vertex_textures_saved = ctx->nr_vertex_textures; + for (i = 0; i < ctx->nr_vertex_textures; i++) { + assert(!ctx->vertex_textures_saved[i]); + pipe_texture_reference(&ctx->vertex_textures_saved[i], ctx->vertex_textures[i]); + } +} + +void +cso_restore_vertex_sampler_textures(struct cso_context *ctx) +{ + uint i; + + ctx->nr_vertex_textures = ctx->nr_vertex_textures_saved; + + for (i = 0; i < ctx->nr_vertex_textures; i++) { + pipe_texture_reference(&ctx->vertex_textures[i], NULL); + ctx->vertex_textures[i] = ctx->vertex_textures_saved[i]; + ctx->vertex_textures_saved[i] = NULL; + } + for ( ; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { + pipe_texture_reference(&ctx->vertex_textures[i], NULL); + } + + ctx->pipe->set_vertex_sampler_textures(ctx->pipe, + ctx->nr_vertex_textures, + ctx->vertex_textures); + + ctx->nr_vertex_textures_saved = 0; +} + + + enum pipe_error cso_set_depth_stencil_alpha(struct cso_context *ctx, const struct pipe_depth_stencil_alpha_state *templ) { diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index 69630e98ba..4bcc6b5630 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.h +++ b/src/gallium/auxiliary/cso_cache/cso_context.h @@ -84,6 +84,20 @@ enum pipe_error cso_single_sampler( struct cso_context *cso, void cso_single_sampler_done( struct cso_context *cso ); +void +cso_save_vertex_samplers(struct cso_context *cso); + +void +cso_restore_vertex_samplers(struct cso_context *cso); + +enum pipe_error +cso_single_vertex_sampler(struct cso_context *cso, + unsigned nr, + const struct pipe_sampler_state *states); + +void +cso_single_vertex_sampler_done(struct cso_context *cso); + enum pipe_error cso_set_sampler_textures( struct cso_context *cso, @@ -94,6 +108,17 @@ void cso_restore_sampler_textures( struct cso_context *cso ); +enum pipe_error +cso_set_vertex_sampler_textures(struct cso_context *cso, + uint count, + struct pipe_texture **textures); +void +cso_save_vertex_sampler_textures(struct cso_context *cso); +void + cso_restore_sampler_textures(struct cso_context *cso); + + + /* These aren't really sensible -- most of the time the api provides * object semantics for shaders anyway, and the cases where it doesn't * (eg mesa's internall-generated texenv programs), it will be up to -- cgit v1.2.3 From f33c064f32bf3635becd1b2019f670abe7a35ab3 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 08:37:15 +0100 Subject: draw: Update for renamed sampler/texture state setters. --- src/gallium/auxiliary/draw/draw_pipe_aaline.c | 8 ++++---- src/gallium/auxiliary/draw/draw_pipe_pstipple.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pipe_aaline.c b/src/gallium/auxiliary/draw/draw_pipe_aaline.c index 31de84b272..ca04223e3d 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_aaline.c +++ b/src/gallium/auxiliary/draw/draw_pipe_aaline.c @@ -896,16 +896,16 @@ draw_install_aaline_stage(struct draw_context *draw, struct pipe_context *pipe) aaline->driver_bind_fs_state = pipe->bind_fs_state; aaline->driver_delete_fs_state = pipe->delete_fs_state; - aaline->driver_bind_sampler_states = pipe->bind_sampler_states; - aaline->driver_set_sampler_textures = pipe->set_sampler_textures; + aaline->driver_bind_sampler_states = pipe->bind_fragment_sampler_states; + aaline->driver_set_sampler_textures = pipe->set_fragment_sampler_textures; /* override the driver's functions */ pipe->create_fs_state = aaline_create_fs_state; pipe->bind_fs_state = aaline_bind_fs_state; pipe->delete_fs_state = aaline_delete_fs_state; - pipe->bind_sampler_states = aaline_bind_sampler_states; - pipe->set_sampler_textures = aaline_set_sampler_textures; + pipe->bind_fragment_sampler_states = aaline_bind_sampler_states; + pipe->set_fragment_sampler_textures = aaline_set_sampler_textures; /* Install once everything is known to be OK: */ diff --git a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c index 27d89721b1..2fc0b4de55 100644 --- a/src/gallium/auxiliary/draw/draw_pipe_pstipple.c +++ b/src/gallium/auxiliary/draw/draw_pipe_pstipple.c @@ -754,8 +754,8 @@ draw_install_pstipple_stage(struct draw_context *draw, pstip->driver_bind_fs_state = pipe->bind_fs_state; pstip->driver_delete_fs_state = pipe->delete_fs_state; - pstip->driver_bind_sampler_states = pipe->bind_sampler_states; - pstip->driver_set_sampler_textures = pipe->set_sampler_textures; + pstip->driver_bind_sampler_states = pipe->bind_fragment_sampler_states; + pstip->driver_set_sampler_textures = pipe->set_fragment_sampler_textures; pstip->driver_set_polygon_stipple = pipe->set_polygon_stipple; /* override the driver's functions */ @@ -763,8 +763,8 @@ draw_install_pstipple_stage(struct draw_context *draw, pipe->bind_fs_state = pstip_bind_fs_state; pipe->delete_fs_state = pstip_delete_fs_state; - pipe->bind_sampler_states = pstip_bind_sampler_states; - pipe->set_sampler_textures = pstip_set_sampler_textures; + pipe->bind_fragment_sampler_states = pstip_bind_sampler_states; + pipe->set_fragment_sampler_textures = pstip_set_sampler_textures; pipe->set_polygon_stipple = pstip_set_polygon_stipple; return TRUE; -- cgit v1.2.3 From 204e586c5648c384041a6cf1d095e160ef474019 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 08:38:06 +0100 Subject: vl: Update for renamed sampler/texture state setters. --- src/gallium/auxiliary/vl/vl_compositor.c | 4 ++-- src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c | 28 ++++++++++++------------ 2 files changed, 16 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/vl/vl_compositor.c b/src/gallium/auxiliary/vl/vl_compositor.c index 592dd17421..8f52170f90 100644 --- a/src/gallium/auxiliary/vl/vl_compositor.c +++ b/src/gallium/auxiliary/vl/vl_compositor.c @@ -479,8 +479,8 @@ void vl_compositor_render(struct vl_compositor *compositor, compositor->pipe->set_framebuffer_state(compositor->pipe, &compositor->fb_state); compositor->pipe->set_viewport_state(compositor->pipe, &compositor->viewport); compositor->pipe->set_scissor_state(compositor->pipe, &compositor->scissor); - compositor->pipe->bind_sampler_states(compositor->pipe, 1, &compositor->sampler); - compositor->pipe->set_sampler_textures(compositor->pipe, 1, &src_surface); + compositor->pipe->bind_fragment_sampler_states(compositor->pipe, 1, &compositor->sampler); + compositor->pipe->set_fragment_sampler_textures(compositor->pipe, 1, &src_surface); compositor->pipe->bind_vs_state(compositor->pipe, compositor->vertex_shader); compositor->pipe->bind_fs_state(compositor->pipe, compositor->fragment_shader); compositor->pipe->set_vertex_buffers(compositor->pipe, 2, compositor->vertex_bufs); diff --git a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c index 1934965995..93da67b984 100644 --- a/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c +++ b/src/gallium/auxiliary/vl/vl_mpeg12_mc_renderer.c @@ -1296,8 +1296,8 @@ flush(struct vl_mpeg12_mc_renderer *r) if (num_macroblocks[MACROBLOCK_TYPE_INTRA] > 0) { r->pipe->set_vertex_buffers(r->pipe, 1, r->vertex_bufs.all); r->pipe->set_vertex_elements(r->pipe, 4, r->vertex_elems); - r->pipe->set_sampler_textures(r->pipe, 3, r->textures.all); - r->pipe->bind_sampler_states(r->pipe, 3, r->samplers.all); + r->pipe->set_fragment_sampler_textures(r->pipe, 3, r->textures.all); + r->pipe->bind_fragment_sampler_states(r->pipe, 3, r->samplers.all); r->pipe->bind_vs_state(r->pipe, r->i_vs); r->pipe->bind_fs_state(r->pipe, r->i_fs); @@ -1310,8 +1310,8 @@ flush(struct vl_mpeg12_mc_renderer *r) r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all); r->pipe->set_vertex_elements(r->pipe, 6, r->vertex_elems); r->textures.individual.ref[0] = r->past; - r->pipe->set_sampler_textures(r->pipe, 4, r->textures.all); - r->pipe->bind_sampler_states(r->pipe, 4, r->samplers.all); + r->pipe->set_fragment_sampler_textures(r->pipe, 4, r->textures.all); + r->pipe->bind_fragment_sampler_states(r->pipe, 4, r->samplers.all); r->pipe->bind_vs_state(r->pipe, r->p_vs[0]); r->pipe->bind_fs_state(r->pipe, r->p_fs[0]); @@ -1324,8 +1324,8 @@ flush(struct vl_mpeg12_mc_renderer *r) r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all); r->pipe->set_vertex_elements(r->pipe, 6, r->vertex_elems); r->textures.individual.ref[0] = r->past; - r->pipe->set_sampler_textures(r->pipe, 4, r->textures.all); - r->pipe->bind_sampler_states(r->pipe, 4, r->samplers.all); + r->pipe->set_fragment_sampler_textures(r->pipe, 4, r->textures.all); + r->pipe->bind_fragment_sampler_states(r->pipe, 4, r->samplers.all); r->pipe->bind_vs_state(r->pipe, r->p_vs[1]); r->pipe->bind_fs_state(r->pipe, r->p_fs[1]); @@ -1338,8 +1338,8 @@ flush(struct vl_mpeg12_mc_renderer *r) r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all); r->pipe->set_vertex_elements(r->pipe, 6, r->vertex_elems); r->textures.individual.ref[0] = r->future; - r->pipe->set_sampler_textures(r->pipe, 4, r->textures.all); - r->pipe->bind_sampler_states(r->pipe, 4, r->samplers.all); + r->pipe->set_fragment_sampler_textures(r->pipe, 4, r->textures.all); + r->pipe->bind_fragment_sampler_states(r->pipe, 4, r->samplers.all); r->pipe->bind_vs_state(r->pipe, r->p_vs[0]); r->pipe->bind_fs_state(r->pipe, r->p_fs[0]); @@ -1352,8 +1352,8 @@ flush(struct vl_mpeg12_mc_renderer *r) r->pipe->set_vertex_buffers(r->pipe, 2, r->vertex_bufs.all); r->pipe->set_vertex_elements(r->pipe, 6, r->vertex_elems); r->textures.individual.ref[0] = r->future; - r->pipe->set_sampler_textures(r->pipe, 4, r->textures.all); - r->pipe->bind_sampler_states(r->pipe, 4, r->samplers.all); + r->pipe->set_fragment_sampler_textures(r->pipe, 4, r->textures.all); + r->pipe->bind_fragment_sampler_states(r->pipe, 4, r->samplers.all); r->pipe->bind_vs_state(r->pipe, r->p_vs[1]); r->pipe->bind_fs_state(r->pipe, r->p_fs[1]); @@ -1367,8 +1367,8 @@ flush(struct vl_mpeg12_mc_renderer *r) r->pipe->set_vertex_elements(r->pipe, 8, r->vertex_elems); r->textures.individual.ref[0] = r->past; r->textures.individual.ref[1] = r->future; - r->pipe->set_sampler_textures(r->pipe, 5, r->textures.all); - r->pipe->bind_sampler_states(r->pipe, 5, r->samplers.all); + r->pipe->set_fragment_sampler_textures(r->pipe, 5, r->textures.all); + r->pipe->bind_fragment_sampler_states(r->pipe, 5, r->samplers.all); r->pipe->bind_vs_state(r->pipe, r->b_vs[0]); r->pipe->bind_fs_state(r->pipe, r->b_fs[0]); @@ -1382,8 +1382,8 @@ flush(struct vl_mpeg12_mc_renderer *r) r->pipe->set_vertex_elements(r->pipe, 8, r->vertex_elems); r->textures.individual.ref[0] = r->past; r->textures.individual.ref[1] = r->future; - r->pipe->set_sampler_textures(r->pipe, 5, r->textures.all); - r->pipe->bind_sampler_states(r->pipe, 5, r->samplers.all); + r->pipe->set_fragment_sampler_textures(r->pipe, 5, r->textures.all); + r->pipe->bind_fragment_sampler_states(r->pipe, 5, r->samplers.all); r->pipe->bind_vs_state(r->pipe, r->b_vs[1]); r->pipe->bind_fs_state(r->pipe, r->b_fs[1]); -- cgit v1.2.3 From cd3409ce059e46b4b675d2ad6f1f3b75939aa2ab Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 08:38:32 +0100 Subject: cell: Update for renamed sampler/texture state setters. --- src/gallium/drivers/cell/ppu/cell_pipe_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/cell/ppu/cell_pipe_state.c b/src/gallium/drivers/cell/ppu/cell_pipe_state.c index ccd0fef6e8..c18a5d0635 100644 --- a/src/gallium/drivers/cell/ppu/cell_pipe_state.c +++ b/src/gallium/drivers/cell/ppu/cell_pipe_state.c @@ -383,10 +383,10 @@ cell_init_state_functions(struct cell_context *cell) cell->pipe.delete_blend_state = cell_delete_blend_state; cell->pipe.create_sampler_state = cell_create_sampler_state; - cell->pipe.bind_sampler_states = cell_bind_sampler_states; + cell->pipe.bind_fragment_sampler_states = cell_bind_sampler_states; cell->pipe.delete_sampler_state = cell_delete_sampler_state; - cell->pipe.set_sampler_textures = cell_set_sampler_textures; + cell->pipe.set_fragment_sampler_textures = cell_set_sampler_textures; cell->pipe.create_depth_stencil_alpha_state = cell_create_depth_stencil_alpha_state; cell->pipe.bind_depth_stencil_alpha_state = cell_bind_depth_stencil_alpha_state; -- cgit v1.2.3 From e04324b8f93919d75f224644a160a32405740860 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 08:39:07 +0100 Subject: fo: Update for renamed sampler/texture state setters. --- src/gallium/drivers/failover/fo_state.c | 16 ++++++++-------- src/gallium/drivers/failover/fo_state_emit.c | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/failover/fo_state.c b/src/gallium/drivers/failover/fo_state.c index c8eb926299..fca6caa227 100644 --- a/src/gallium/drivers/failover/fo_state.c +++ b/src/gallium/drivers/failover/fo_state.c @@ -339,10 +339,10 @@ failover_bind_sampler_states(struct pipe_context *pipe, } failover->dirty |= FO_NEW_SAMPLER; failover->num_samplers = num; - failover->sw->bind_sampler_states(failover->sw, num, - failover->sw_sampler_state); - failover->hw->bind_sampler_states(failover->hw, num, - failover->hw_sampler_state); + failover->sw->bind_fragment_sampler_states(failover->sw, num, + failover->sw_sampler_state); + failover->hw->bind_fragment_sampler_states(failover->hw, num, + failover->hw_sampler_state); } static void @@ -381,8 +381,8 @@ failover_set_sampler_textures(struct pipe_context *pipe, NULL); failover->dirty |= FO_NEW_TEXTURE; failover->num_textures = num; - failover->sw->set_sampler_textures( failover->sw, num, texture ); - failover->hw->set_sampler_textures( failover->hw, num, texture ); + failover->sw->set_fragment_sampler_textures( failover->sw, num, texture ); + failover->hw->set_fragment_sampler_textures( failover->hw, num, texture ); } @@ -453,7 +453,7 @@ failover_init_state_functions( struct failover_context *failover ) failover->pipe.bind_blend_state = failover_bind_blend_state; failover->pipe.delete_blend_state = failover_delete_blend_state; failover->pipe.create_sampler_state = failover_create_sampler_state; - failover->pipe.bind_sampler_states = failover_bind_sampler_states; + failover->pipe.bind_fragment_sampler_states = failover_bind_sampler_states; failover->pipe.delete_sampler_state = failover_delete_sampler_state; failover->pipe.create_depth_stencil_alpha_state = failover_create_depth_stencil_state; failover->pipe.bind_depth_stencil_alpha_state = failover_bind_depth_stencil_state; @@ -473,7 +473,7 @@ failover_init_state_functions( struct failover_context *failover ) failover->pipe.set_framebuffer_state = failover_set_framebuffer_state; failover->pipe.set_polygon_stipple = failover_set_polygon_stipple; failover->pipe.set_scissor_state = failover_set_scissor_state; - failover->pipe.set_sampler_textures = failover_set_sampler_textures; + failover->pipe.set_fragment_sampler_textures = failover_set_sampler_textures; failover->pipe.set_viewport_state = failover_set_viewport_state; failover->pipe.set_vertex_buffers = failover_set_vertex_buffers; failover->pipe.set_vertex_elements = failover_set_vertex_elements; diff --git a/src/gallium/drivers/failover/fo_state_emit.c b/src/gallium/drivers/failover/fo_state_emit.c index bd4fce9d20..b4b1067924 100644 --- a/src/gallium/drivers/failover/fo_state_emit.c +++ b/src/gallium/drivers/failover/fo_state_emit.c @@ -92,13 +92,13 @@ failover_state_emit( struct failover_context *failover ) failover->sw->set_viewport_state( failover->sw, &failover->viewport ); if (failover->dirty & FO_NEW_SAMPLER) { - failover->sw->bind_sampler_states( failover->sw, failover->num_samplers, - failover->sw_sampler_state ); + failover->sw->bind_fragment_sampler_states( failover->sw, failover->num_samplers, + failover->sw_sampler_state ); } if (failover->dirty & FO_NEW_TEXTURE) { - failover->sw->set_sampler_textures( failover->sw, failover->num_textures, - failover->texture ); + failover->sw->set_fragment_sampler_textures( failover->sw, failover->num_textures, + failover->texture ); } if (failover->dirty & FO_NEW_VERTEX_BUFFER) { -- cgit v1.2.3 From 25bb04a1ee9b3f28bfa6e60d7ce71ff23726c5b6 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 08:39:19 +0100 Subject: i915: Update for renamed sampler/texture state setters. --- src/gallium/drivers/i915/i915_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c index 71f00bc346..9103847f1c 100644 --- a/src/gallium/drivers/i915/i915_state.c +++ b/src/gallium/drivers/i915/i915_state.c @@ -767,7 +767,7 @@ i915_init_state_functions( struct i915_context *i915 ) i915->base.delete_blend_state = i915_delete_blend_state; i915->base.create_sampler_state = i915_create_sampler_state; - i915->base.bind_sampler_states = i915_bind_sampler_states; + i915->base.bind_fragment_sampler_states = i915_bind_sampler_states; i915->base.delete_sampler_state = i915_delete_sampler_state; i915->base.create_depth_stencil_alpha_state = i915_create_depth_stencil_state; @@ -791,7 +791,7 @@ i915_init_state_functions( struct i915_context *i915 ) i915->base.set_polygon_stipple = i915_set_polygon_stipple; i915->base.set_scissor_state = i915_set_scissor_state; - i915->base.set_sampler_textures = i915_set_sampler_textures; + i915->base.set_fragment_sampler_textures = i915_set_sampler_textures; i915->base.set_viewport_state = i915_set_viewport_state; i915->base.set_vertex_buffers = i915_set_vertex_buffers; i915->base.set_vertex_elements = i915_set_vertex_elements; -- cgit v1.2.3 From f0d3abf3834d3ae6107e66b61d8660e6c09a0a99 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 08:39:49 +0100 Subject: id: Update for renamed sampler/texture state setters. --- src/gallium/drivers/identity/id_context.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c index 4e700089e3..2f5b38ea15 100644 --- a/src/gallium/drivers/identity/id_context.c +++ b/src/gallium/drivers/identity/id_context.c @@ -228,9 +228,9 @@ identity_bind_sampler_states(struct pipe_context *_pipe, struct identity_context *id_pipe = identity_context(_pipe); struct pipe_context *pipe = id_pipe->pipe; - pipe->bind_sampler_states(pipe, - num, - samplers); + pipe->bind_fragment_sampler_states(pipe, + num, + samplers); } static void @@ -499,9 +499,9 @@ identity_set_sampler_textures(struct pipe_context *_pipe, textures = unwrapped_textures; } - pipe->set_sampler_textures(pipe, - num_textures, - textures); + pipe->set_fragment_sampler_textures(pipe, + num_textures, + textures); } static void @@ -682,7 +682,7 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) id_pipe->base.bind_blend_state = identity_bind_blend_state; id_pipe->base.delete_blend_state = identity_delete_blend_state; id_pipe->base.create_sampler_state = identity_create_sampler_state; - id_pipe->base.bind_sampler_states = identity_bind_sampler_states; + id_pipe->base.bind_fragment_sampler_states = identity_bind_sampler_states; id_pipe->base.delete_sampler_state = identity_delete_sampler_state; id_pipe->base.create_rasterizer_state = identity_create_rasterizer_state; id_pipe->base.bind_rasterizer_state = identity_bind_rasterizer_state; @@ -703,7 +703,7 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) id_pipe->base.set_polygon_stipple = identity_set_polygon_stipple; id_pipe->base.set_scissor_state = identity_set_scissor_state; id_pipe->base.set_viewport_state = identity_set_viewport_state; - id_pipe->base.set_sampler_textures = identity_set_sampler_textures; + id_pipe->base.set_fragment_sampler_textures = identity_set_sampler_textures; id_pipe->base.set_vertex_buffers = identity_set_vertex_buffers; id_pipe->base.set_vertex_elements = identity_set_vertex_elements; id_pipe->base.surface_copy = identity_surface_copy; -- cgit v1.2.3 From 551b2db82b5e5093dc19bde130785aceb92868a6 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 08:40:04 +0100 Subject: lp: Update for renamed sampler/texture state setters. --- src/gallium/drivers/llvmpipe/lp_context.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index 57e71f3e98..c081f6de03 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -180,7 +180,7 @@ llvmpipe_create( struct pipe_screen *screen ) llvmpipe->pipe.delete_blend_state = llvmpipe_delete_blend_state; llvmpipe->pipe.create_sampler_state = llvmpipe_create_sampler_state; - llvmpipe->pipe.bind_sampler_states = llvmpipe_bind_sampler_states; + llvmpipe->pipe.bind_fragment_sampler_states = llvmpipe_bind_sampler_states; llvmpipe->pipe.delete_sampler_state = llvmpipe_delete_sampler_state; llvmpipe->pipe.create_depth_stencil_alpha_state = llvmpipe_create_depth_stencil_state; @@ -205,7 +205,7 @@ llvmpipe_create( struct pipe_screen *screen ) llvmpipe->pipe.set_framebuffer_state = llvmpipe_set_framebuffer_state; llvmpipe->pipe.set_polygon_stipple = llvmpipe_set_polygon_stipple; llvmpipe->pipe.set_scissor_state = llvmpipe_set_scissor_state; - llvmpipe->pipe.set_sampler_textures = llvmpipe_set_sampler_textures; + llvmpipe->pipe.set_fragment_sampler_textures = llvmpipe_set_sampler_textures; llvmpipe->pipe.set_viewport_state = llvmpipe_set_viewport_state; llvmpipe->pipe.set_vertex_buffers = llvmpipe_set_vertex_buffers; -- cgit v1.2.3 From d15bb1cba3fd2d36c48e33e14cc3c548cf40d555 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 08:40:21 +0100 Subject: nv: Update for renamed sampler/texture state setters. --- src/gallium/drivers/nv04/nv04_state.c | 4 ++-- src/gallium/drivers/nv10/nv10_state.c | 4 ++-- src/gallium/drivers/nv20/nv20_state.c | 4 ++-- src/gallium/drivers/nv30/nv30_state.c | 4 ++-- src/gallium/drivers/nv40/nv40_state.c | 4 ++-- src/gallium/drivers/nv50/nv50_state.c | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv04/nv04_state.c b/src/gallium/drivers/nv04/nv04_state.c index d356ebd8b3..ef3005db5f 100644 --- a/src/gallium/drivers/nv04/nv04_state.c +++ b/src/gallium/drivers/nv04/nv04_state.c @@ -425,9 +425,9 @@ nv04_init_state_functions(struct nv04_context *nv04) nv04->pipe.delete_blend_state = nv04_blend_state_delete; nv04->pipe.create_sampler_state = nv04_sampler_state_create; - nv04->pipe.bind_sampler_states = nv04_sampler_state_bind; + nv04->pipe.bind_fragment_sampler_states = nv04_sampler_state_bind; nv04->pipe.delete_sampler_state = nv04_sampler_state_delete; - nv04->pipe.set_sampler_textures = nv04_set_sampler_texture; + nv04->pipe.set_fragment_sampler_textures = nv04_set_sampler_texture; nv04->pipe.create_rasterizer_state = nv04_rasterizer_state_create; nv04->pipe.bind_rasterizer_state = nv04_rasterizer_state_bind; diff --git a/src/gallium/drivers/nv10/nv10_state.c b/src/gallium/drivers/nv10/nv10_state.c index 9b38219b99..ffc6be3c40 100644 --- a/src/gallium/drivers/nv10/nv10_state.c +++ b/src/gallium/drivers/nv10/nv10_state.c @@ -553,9 +553,9 @@ nv10_init_state_functions(struct nv10_context *nv10) nv10->pipe.delete_blend_state = nv10_blend_state_delete; nv10->pipe.create_sampler_state = nv10_sampler_state_create; - nv10->pipe.bind_sampler_states = nv10_sampler_state_bind; + nv10->pipe.bind_fragment_sampler_states = nv10_sampler_state_bind; nv10->pipe.delete_sampler_state = nv10_sampler_state_delete; - nv10->pipe.set_sampler_textures = nv10_set_sampler_texture; + nv10->pipe.set_fragment_sampler_textures = nv10_set_sampler_texture; nv10->pipe.create_rasterizer_state = nv10_rasterizer_state_create; nv10->pipe.bind_rasterizer_state = nv10_rasterizer_state_bind; diff --git a/src/gallium/drivers/nv20/nv20_state.c b/src/gallium/drivers/nv20/nv20_state.c index ed4084980f..3a82e63423 100644 --- a/src/gallium/drivers/nv20/nv20_state.c +++ b/src/gallium/drivers/nv20/nv20_state.c @@ -546,9 +546,9 @@ nv20_init_state_functions(struct nv20_context *nv20) nv20->pipe.delete_blend_state = nv20_blend_state_delete; nv20->pipe.create_sampler_state = nv20_sampler_state_create; - nv20->pipe.bind_sampler_states = nv20_sampler_state_bind; + nv20->pipe.bind_fragment_sampler_states = nv20_sampler_state_bind; nv20->pipe.delete_sampler_state = nv20_sampler_state_delete; - nv20->pipe.set_sampler_textures = nv20_set_sampler_texture; + nv20->pipe.set_fragment_sampler_textures = nv20_set_sampler_texture; nv20->pipe.create_rasterizer_state = nv20_rasterizer_state_create; nv20->pipe.bind_rasterizer_state = nv20_rasterizer_state_bind; diff --git a/src/gallium/drivers/nv30/nv30_state.c b/src/gallium/drivers/nv30/nv30_state.c index b91e972c12..3f802d9241 100644 --- a/src/gallium/drivers/nv30/nv30_state.c +++ b/src/gallium/drivers/nv30/nv30_state.c @@ -690,9 +690,9 @@ nv30_init_state_functions(struct nv30_context *nv30) nv30->pipe.delete_blend_state = nv30_blend_state_delete; nv30->pipe.create_sampler_state = nv30_sampler_state_create; - nv30->pipe.bind_sampler_states = nv30_sampler_state_bind; + nv30->pipe.bind_fragment_sampler_states = nv30_sampler_state_bind; nv30->pipe.delete_sampler_state = nv30_sampler_state_delete; - nv30->pipe.set_sampler_textures = nv30_set_sampler_texture; + nv30->pipe.set_fragment_sampler_textures = nv30_set_sampler_texture; nv30->pipe.create_rasterizer_state = nv30_rasterizer_state_create; nv30->pipe.bind_rasterizer_state = nv30_rasterizer_state_bind; diff --git a/src/gallium/drivers/nv40/nv40_state.c b/src/gallium/drivers/nv40/nv40_state.c index c3ee4d2345..bc34e32a4b 100644 --- a/src/gallium/drivers/nv40/nv40_state.c +++ b/src/gallium/drivers/nv40/nv40_state.c @@ -705,9 +705,9 @@ nv40_init_state_functions(struct nv40_context *nv40) nv40->pipe.delete_blend_state = nv40_blend_state_delete; nv40->pipe.create_sampler_state = nv40_sampler_state_create; - nv40->pipe.bind_sampler_states = nv40_sampler_state_bind; + nv40->pipe.bind_fragment_sampler_states = nv40_sampler_state_bind; nv40->pipe.delete_sampler_state = nv40_sampler_state_delete; - nv40->pipe.set_sampler_textures = nv40_set_sampler_texture; + nv40->pipe.set_fragment_sampler_textures = nv40_set_sampler_texture; nv40->pipe.create_rasterizer_state = nv40_rasterizer_state_create; nv40->pipe.bind_rasterizer_state = nv40_rasterizer_state_bind; diff --git a/src/gallium/drivers/nv50/nv50_state.c b/src/gallium/drivers/nv50/nv50_state.c index ffaa5e29d1..07318f2394 100644 --- a/src/gallium/drivers/nv50/nv50_state.c +++ b/src/gallium/drivers/nv50/nv50_state.c @@ -648,9 +648,9 @@ nv50_init_state_functions(struct nv50_context *nv50) nv50->pipe.delete_blend_state = nv50_blend_state_delete; nv50->pipe.create_sampler_state = nv50_sampler_state_create; - nv50->pipe.bind_sampler_states = nv50_sampler_state_bind; + nv50->pipe.bind_fragment_sampler_states = nv50_sampler_state_bind; nv50->pipe.delete_sampler_state = nv50_sampler_state_delete; - nv50->pipe.set_sampler_textures = nv50_set_sampler_texture; + nv50->pipe.set_fragment_sampler_textures = nv50_set_sampler_texture; nv50->pipe.create_rasterizer_state = nv50_rasterizer_state_create; nv50->pipe.bind_rasterizer_state = nv50_rasterizer_state_bind; -- cgit v1.2.3 From c1bcedc4ce48031c9e5d2a2430d27c7a9aaa8b37 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 08:40:31 +0100 Subject: r300: Update for renamed sampler/texture state setters. --- src/gallium/drivers/r300/r300_state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index a88d66db24..7505353953 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -822,10 +822,10 @@ void r300_init_state_functions(struct r300_context* r300) r300->context.delete_rasterizer_state = r300_delete_rs_state; r300->context.create_sampler_state = r300_create_sampler_state; - r300->context.bind_sampler_states = r300_bind_sampler_states; + r300->context.bind_fragment_sampler_states = r300_bind_sampler_states; r300->context.delete_sampler_state = r300_delete_sampler_state; - r300->context.set_sampler_textures = r300_set_sampler_textures; + r300->context.set_fragment_sampler_textures = r300_set_sampler_textures; r300->context.set_scissor_state = r300_set_scissor_state; -- cgit v1.2.3 From 8eecd3bafb759df3f1853490cf149d053c8fcbce Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 08:40:53 +0100 Subject: svga: Update for renamed sampler/texture state setters. --- src/gallium/drivers/svga/svga_pipe_sampler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c index 3eeca6b784..b4e57c5d15 100644 --- a/src/gallium/drivers/svga/svga_pipe_sampler.c +++ b/src/gallium/drivers/svga/svga_pipe_sampler.c @@ -234,9 +234,9 @@ static void svga_set_sampler_textures(struct pipe_context *pipe, void svga_init_sampler_functions( struct svga_context *svga ) { svga->pipe.create_sampler_state = svga_create_sampler_state; - svga->pipe.bind_sampler_states = svga_bind_sampler_states; + svga->pipe.bind_fragment_sampler_states = svga_bind_sampler_states; svga->pipe.delete_sampler_state = svga_delete_sampler_state; - svga->pipe.set_sampler_textures = svga_set_sampler_textures; + svga->pipe.set_fragment_sampler_textures = svga_set_sampler_textures; } -- cgit v1.2.3 From eeb8dd12b48c6ad3f466cf0ea88472fca576ebd4 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 08:43:51 +0100 Subject: trace: Update for renamed sampler/texture state setters. --- src/gallium/drivers/trace/tr_context.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index bf470b46ae..26c01c9b84 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -486,13 +486,13 @@ trace_context_bind_sampler_states(struct pipe_context *_pipe, struct trace_context *tr_ctx = trace_context(_pipe); struct pipe_context *pipe = tr_ctx->pipe; - trace_dump_call_begin("pipe_context", "bind_sampler_states"); + trace_dump_call_begin("pipe_context", "bind_fragment_sampler_states"); trace_dump_arg(ptr, pipe); trace_dump_arg(uint, num_states); trace_dump_arg_array(ptr, states, num_states); - pipe->bind_sampler_states(pipe, num_states, states);; + pipe->bind_fragment_sampler_states(pipe, num_states, states); trace_dump_call_end(); } @@ -959,13 +959,13 @@ trace_context_set_sampler_textures(struct pipe_context *_pipe, } textures = unwrapped_textures; - trace_dump_call_begin("pipe_context", "set_sampler_textures"); + trace_dump_call_begin("pipe_context", "set_fragment_sampler_textures"); trace_dump_arg(ptr, pipe); trace_dump_arg(uint, num_textures); trace_dump_arg_array(ptr, textures, num_textures); - pipe->set_sampler_textures(pipe, num_textures, textures);; + pipe->set_fragment_sampler_textures(pipe, num_textures, textures); trace_dump_call_end(); } @@ -1253,7 +1253,7 @@ trace_context_create(struct pipe_screen *_screen, tr_ctx->base.bind_blend_state = trace_context_bind_blend_state; tr_ctx->base.delete_blend_state = trace_context_delete_blend_state; tr_ctx->base.create_sampler_state = trace_context_create_sampler_state; - tr_ctx->base.bind_sampler_states = trace_context_bind_sampler_states; + tr_ctx->base.bind_fragment_sampler_states = trace_context_bind_sampler_states; tr_ctx->base.delete_sampler_state = trace_context_delete_sampler_state; tr_ctx->base.create_rasterizer_state = trace_context_create_rasterizer_state; tr_ctx->base.bind_rasterizer_state = trace_context_bind_rasterizer_state; @@ -1274,7 +1274,7 @@ trace_context_create(struct pipe_screen *_screen, tr_ctx->base.set_polygon_stipple = trace_context_set_polygon_stipple; tr_ctx->base.set_scissor_state = trace_context_set_scissor_state; tr_ctx->base.set_viewport_state = trace_context_set_viewport_state; - tr_ctx->base.set_sampler_textures = trace_context_set_sampler_textures; + tr_ctx->base.set_fragment_sampler_textures = trace_context_set_sampler_textures; tr_ctx->base.set_vertex_buffers = trace_context_set_vertex_buffers; tr_ctx->base.set_vertex_elements = trace_context_set_vertex_elements; if (pipe->surface_copy) -- cgit v1.2.3 From e197652ce08cacf0fdbf0509db5eb26500d556c5 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 08:44:18 +0100 Subject: st: Update for renamed sampler/texture state setters. --- src/mesa/state_tracker/st_cb_drawpixels.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index a68a29e126..03617b7a93 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -585,10 +585,10 @@ draw_textured_quad(GLcontext *ctx, GLint x, GLint y, GLfloat z, struct pipe_texture *textures[2]; textures[0] = pt; textures[1] = st->pixel_xfer.pixelmap_texture; - pipe->set_sampler_textures(pipe, 2, textures); + pipe->set_fragment_sampler_textures(pipe, 2, textures); } else { - pipe->set_sampler_textures(pipe, 1, &pt); + pipe->set_fragment_sampler_textures(pipe, 1, &pt); } /* Compute window coords (y=0=bottom) with pixel zoom. -- cgit v1.2.3 From ee86b1b58dce4c8416b5333d0ed43d059ba2a200 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 08:47:00 +0100 Subject: python: Update for renamed sampler/texture state setters. --- src/gallium/state_trackers/python/p_context.i | 6 +++--- src/gallium/state_trackers/python/retrace/interpreter.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/python/p_context.i b/src/gallium/state_trackers/python/p_context.i index a40aa1e518..9728207d9c 100644 --- a/src/gallium/state_trackers/python/p_context.i +++ b/src/gallium/state_trackers/python/p_context.i @@ -147,9 +147,9 @@ struct st_context { if(!texture) texture = $self->default_texture; pipe_texture_reference(&$self->sampler_textures[index], texture); - $self->pipe->set_sampler_textures($self->pipe, - PIPE_MAX_SAMPLERS, - $self->sampler_textures); + $self->pipe->set_fragment_sampler_textures($self->pipe, + PIPE_MAX_SAMPLERS, + $self->sampler_textures); } void set_vertex_buffer(unsigned index, diff --git a/src/gallium/state_trackers/python/retrace/interpreter.py b/src/gallium/state_trackers/python/retrace/interpreter.py index d0bcb690a9..5f826b1c4c 100755 --- a/src/gallium/state_trackers/python/retrace/interpreter.py +++ b/src/gallium/state_trackers/python/retrace/interpreter.py @@ -388,7 +388,7 @@ class Context(Object): def delete_sampler_state(self, state): pass - def bind_sampler_states(self, num_states, states): + def bind_fragment_sampler_states(self, num_states, states): for i in range(num_states): self.real.set_sampler(i, states[i]) @@ -486,7 +486,7 @@ class Context(Object): def set_viewport_state(self, state): self.real.set_viewport(state) - def set_sampler_textures(self, num_textures, textures): + def set_fragment_sampler_textures(self, num_textures, textures): for i in range(num_textures): self.real.set_sampler_texture(i, textures[i]) -- cgit v1.2.3 From 8a619e62bffa6f21330df747940e322909937806 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 08:51:20 +0100 Subject: sp: Implement separate vertex sampler state. --- src/gallium/drivers/softpipe/sp_context.c | 22 ++++++-- src/gallium/drivers/softpipe/sp_context.h | 7 ++- src/gallium/drivers/softpipe/sp_flush.c | 3 ++ src/gallium/drivers/softpipe/sp_screen.c | 4 +- src/gallium/drivers/softpipe/sp_state.h | 9 ++++ src/gallium/drivers/softpipe/sp_state_derived.c | 13 +++++ src/gallium/drivers/softpipe/sp_state_sampler.c | 69 +++++++++++++++++++++++-- 7 files changed, 116 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_context.c b/src/gallium/drivers/softpipe/sp_context.c index bdbb7fa9b9..f8bf3e9974 100644 --- a/src/gallium/drivers/softpipe/sp_context.c +++ b/src/gallium/drivers/softpipe/sp_context.c @@ -107,6 +107,11 @@ softpipe_destroy( struct pipe_context *pipe ) pipe_texture_reference(&softpipe->texture[i], NULL); } + for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { + sp_destroy_tex_tile_cache(softpipe->vertex_tex_cache[i]); + pipe_texture_reference(&softpipe->vertex_textures[i], NULL); + } + for (i = 0; i < Elements(softpipe->constants); i++) { if (softpipe->constants[i].buffer) { pipe_buffer_reference(&softpipe->constants[i].buffer, NULL); @@ -153,6 +158,11 @@ softpipe_is_texture_referenced( struct pipe_context *pipe, softpipe->tex_cache[i]->texture == texture) return PIPE_REFERENCED_FOR_READ; } + for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { + if (softpipe->vertex_tex_cache[i] && + softpipe->vertex_tex_cache[i]->texture == texture) + return PIPE_REFERENCED_FOR_READ; + } return PIPE_UNREFERENCED; } @@ -192,7 +202,8 @@ softpipe_create( struct pipe_screen *screen ) softpipe->pipe.delete_blend_state = softpipe_delete_blend_state; softpipe->pipe.create_sampler_state = softpipe_create_sampler_state; - softpipe->pipe.bind_sampler_states = softpipe_bind_sampler_states; + softpipe->pipe.bind_fragment_sampler_states = softpipe_bind_sampler_states; + softpipe->pipe.bind_vertex_sampler_states = softpipe_bind_vertex_sampler_states; softpipe->pipe.delete_sampler_state = softpipe_delete_sampler_state; softpipe->pipe.create_depth_stencil_alpha_state = softpipe_create_depth_stencil_state; @@ -217,7 +228,8 @@ softpipe_create( struct pipe_screen *screen ) softpipe->pipe.set_framebuffer_state = softpipe_set_framebuffer_state; softpipe->pipe.set_polygon_stipple = softpipe_set_polygon_stipple; softpipe->pipe.set_scissor_state = softpipe_set_scissor_state; - softpipe->pipe.set_sampler_textures = softpipe_set_sampler_textures; + softpipe->pipe.set_fragment_sampler_textures = softpipe_set_sampler_textures; + softpipe->pipe.set_vertex_sampler_textures = softpipe_set_vertex_sampler_textures; softpipe->pipe.set_viewport_state = softpipe_set_viewport_state; softpipe->pipe.set_vertex_buffers = softpipe_set_vertex_buffers; @@ -247,7 +259,9 @@ softpipe_create( struct pipe_screen *screen ) for (i = 0; i < PIPE_MAX_SAMPLERS; i++) softpipe->tex_cache[i] = sp_create_tex_tile_cache( screen ); - + for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { + softpipe->vertex_tex_cache[i] = sp_create_tex_tile_cache(screen); + } /* setup quad rendering stages */ softpipe->quad.shade = sp_quad_shade_stage(softpipe); @@ -263,7 +277,7 @@ softpipe_create( struct pipe_screen *screen ) goto fail; draw_texture_samplers(softpipe->draw, - PIPE_MAX_SAMPLERS, + PIPE_MAX_VERTEX_SAMPLERS, (struct tgsi_sampler **) softpipe->tgsi.vert_samplers_list); diff --git a/src/gallium/drivers/softpipe/sp_context.h b/src/gallium/drivers/softpipe/sp_context.h index a735573d6f..8ce20c5744 100644 --- a/src/gallium/drivers/softpipe/sp_context.h +++ b/src/gallium/drivers/softpipe/sp_context.h @@ -53,6 +53,7 @@ struct softpipe_context { /** Constant state objects */ struct pipe_blend_state *blend; struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS]; + struct pipe_sampler_state *vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS]; struct pipe_depth_stencil_alpha_state *depth_stencil; struct pipe_rasterizer_state *rasterizer; struct sp_fragment_shader *fs; @@ -66,12 +67,15 @@ struct softpipe_context { struct pipe_poly_stipple poly_stipple; struct pipe_scissor_state scissor; struct pipe_texture *texture[PIPE_MAX_SAMPLERS]; + struct pipe_texture *vertex_textures[PIPE_MAX_VERTEX_SAMPLERS]; struct pipe_viewport_state viewport; struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS]; unsigned num_samplers; unsigned num_textures; + unsigned num_vertex_samplers; + unsigned num_vertex_textures; unsigned num_vertex_elements; unsigned num_vertex_buffers; @@ -121,7 +125,7 @@ struct softpipe_context { /** TGSI exec things */ struct { - struct sp_sampler_varient *vert_samplers_list[PIPE_MAX_SAMPLERS]; + struct sp_sampler_varient *vert_samplers_list[PIPE_MAX_VERTEX_SAMPLERS]; struct sp_sampler_varient *frag_samplers_list[PIPE_MAX_SAMPLERS]; } tgsi; @@ -139,6 +143,7 @@ struct softpipe_context { unsigned tex_timestamp; struct softpipe_tex_tile_cache *tex_cache[PIPE_MAX_SAMPLERS]; + struct softpipe_tex_tile_cache *vertex_tex_cache[PIPE_MAX_VERTEX_SAMPLERS]; unsigned use_sse : 1; unsigned dump_fs : 1; diff --git a/src/gallium/drivers/softpipe/sp_flush.c b/src/gallium/drivers/softpipe/sp_flush.c index e38b767cf2..75dac810a1 100644 --- a/src/gallium/drivers/softpipe/sp_flush.c +++ b/src/gallium/drivers/softpipe/sp_flush.c @@ -55,6 +55,9 @@ softpipe_flush( struct pipe_context *pipe, for (i = 0; i < softpipe->num_textures; i++) { sp_flush_tex_tile_cache(softpipe->tex_cache[i]); } + for (i = 0; i < softpipe->num_vertex_textures; i++) { + sp_flush_tex_tile_cache(softpipe->vertex_tex_cache[i]); + } } if (flags & PIPE_FLUSH_SWAPBUFFERS) { diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 81fb7aa20c..68e4ef4137 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -58,7 +58,9 @@ softpipe_get_param(struct pipe_screen *screen, int param) case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: return PIPE_MAX_SAMPLERS; case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS: - return PIPE_MAX_SAMPLERS; + return PIPE_MAX_VERTEX_SAMPLERS; + case PIPE_CAP_MAX_COMBINED_SAMPLERS: + return PIPE_MAX_SAMPLERS + PIPE_MAX_VERTEX_SAMPLERS; case PIPE_CAP_NPOT_TEXTURES: return 1; case PIPE_CAP_TWO_SIDED_STENCIL: diff --git a/src/gallium/drivers/softpipe/sp_state.h b/src/gallium/drivers/softpipe/sp_state.h index 77ee3c1136..d488fb8710 100644 --- a/src/gallium/drivers/softpipe/sp_state.h +++ b/src/gallium/drivers/softpipe/sp_state.h @@ -104,6 +104,10 @@ void * softpipe_create_sampler_state(struct pipe_context *, const struct pipe_sampler_state *); void softpipe_bind_sampler_states(struct pipe_context *, unsigned, void **); +void +softpipe_bind_vertex_sampler_states(struct pipe_context *, + unsigned num_samplers, + void **samplers); void softpipe_delete_sampler_state(struct pipe_context *, void *); void * @@ -150,6 +154,11 @@ void softpipe_set_sampler_textures( struct pipe_context *, unsigned num, struct pipe_texture ** ); +void +softpipe_set_vertex_sampler_textures(struct pipe_context *, + unsigned num_textures, + struct pipe_texture **); + void softpipe_set_viewport_state( struct pipe_context *, const struct pipe_viewport_state * ); diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index 3bc96b9538..c24a737d07 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -213,6 +213,19 @@ update_tgsi_samplers( struct softpipe_context *softpipe ) } } } + + for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { + struct softpipe_tex_tile_cache *tc = softpipe->vertex_tex_cache[i]; + + if (tc->texture) { + struct softpipe_texture *spt = softpipe_texture(tc->texture); + + if (spt->timestamp != tc->timestamp) { + sp_tex_tile_cache_validate_texture(tc); + tc->timestamp = spt->timestamp; + } + } + } } diff --git a/src/gallium/drivers/softpipe/sp_state_sampler.c b/src/gallium/drivers/softpipe/sp_state_sampler.c index db0b8ab76b..ceb4e338f1 100644 --- a/src/gallium/drivers/softpipe/sp_state_sampler.c +++ b/src/gallium/drivers/softpipe/sp_state_sampler.c @@ -93,6 +93,34 @@ softpipe_bind_sampler_states(struct pipe_context *pipe, } +void +softpipe_bind_vertex_sampler_states(struct pipe_context *pipe, + unsigned num_samplers, + void **samplers) +{ + struct softpipe_context *softpipe = softpipe_context(pipe); + unsigned i; + + assert(num_samplers <= PIPE_MAX_VERTEX_SAMPLERS); + + /* Check for no-op */ + if (num_samplers == softpipe->num_vertex_samplers && + !memcmp(softpipe->vertex_samplers, samplers, num_samplers * sizeof(void *))) + return; + + draw_flush(softpipe->draw); + + for (i = 0; i < num_samplers; ++i) + softpipe->vertex_samplers[i] = samplers[i]; + for (i = num_samplers; i < PIPE_MAX_VERTEX_SAMPLERS; ++i) + softpipe->vertex_samplers[i] = NULL; + + softpipe->num_vertex_samplers = num_samplers; + + softpipe->dirty |= SP_NEW_SAMPLER; +} + + void softpipe_set_sampler_textures(struct pipe_context *pipe, unsigned num, struct pipe_texture **texture) @@ -122,6 +150,37 @@ softpipe_set_sampler_textures(struct pipe_context *pipe, } +void +softpipe_set_vertex_sampler_textures(struct pipe_context *pipe, + unsigned num_textures, + struct pipe_texture **textures) +{ + struct softpipe_context *softpipe = softpipe_context(pipe); + uint i; + + assert(num_textures <= PIPE_MAX_VERTEX_SAMPLERS); + + /* Check for no-op */ + if (num_textures == softpipe->num_vertex_textures && + !memcmp(softpipe->vertex_textures, textures, num_textures * sizeof(struct pipe_texture *))) { + return; + } + + draw_flush(softpipe->draw); + + for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { + struct pipe_texture *tex = i < num_textures ? textures[i] : NULL; + + pipe_texture_reference(&softpipe->vertex_textures[i], tex); + sp_tex_tile_cache_set_texture(softpipe->vertex_tex_cache[i], tex); + } + + softpipe->num_vertex_textures = num_textures; + + softpipe->dirty |= SP_NEW_TEXTURE; +} + + /** * Find/create an sp_sampler_varient object for sampling the given texture, * sampler and tex unit. @@ -185,16 +244,16 @@ softpipe_reset_sampler_varients(struct softpipe_context *softpipe) * fragment programs. */ for (i = 0; i <= softpipe->vs->max_sampler; i++) { - if (softpipe->sampler[i]) { + if (softpipe->vertex_samplers[i]) { softpipe->tgsi.vert_samplers_list[i] = get_sampler_varient( i, - sp_sampler(softpipe->sampler[i]), - softpipe->texture[i], + sp_sampler(softpipe->vertex_samplers[i]), + softpipe->vertex_textures[i], TGSI_PROCESSOR_VERTEX ); sp_sampler_varient_bind_texture( softpipe->tgsi.vert_samplers_list[i], - softpipe->tex_cache[i], - softpipe->texture[i] ); + softpipe->vertex_tex_cache[i], + softpipe->vertex_textures[i] ); } } -- cgit v1.2.3 From 0f884ed993500171ad91fc9f2552574face9ee17 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 08:52:37 +0100 Subject: sp: Do not falsely advertise support for some SNORM formats. --- src/gallium/drivers/softpipe/sp_screen.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 68e4ef4137..6bf3df8e6a 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -145,6 +145,10 @@ softpipe_is_format_supported( struct pipe_screen *screen, case PIPE_FORMAT_DXT3_RGBA: case PIPE_FORMAT_DXT5_RGBA: case PIPE_FORMAT_Z32_FLOAT: + case PIPE_FORMAT_R8G8_SNORM: + case PIPE_FORMAT_B6UG5SR5S_NORM: + case PIPE_FORMAT_X8UB8UG8SR8S_NORM: + case PIPE_FORMAT_A8B8G8R8_SNORM: return FALSE; default: return TRUE; -- cgit v1.2.3 From 3f900c33ae6ede1c6f309628b1369a1b968a115d Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 08:54:30 +0100 Subject: trace: Reduce double semicolons to single ones. --- src/gallium/drivers/trace/tr_context.c | 60 +++++++++++++++++----------------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 26c01c9b84..696b787c74 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -107,7 +107,7 @@ trace_context_set_edgeflags(struct pipe_context *_pipe, /* FIXME: we don't know how big this array is */ trace_dump_arg(ptr, bitfield); - pipe->set_edgeflags(pipe, bitfield);; + pipe->set_edgeflags(pipe, bitfield); trace_dump_call_end(); } @@ -192,7 +192,7 @@ trace_context_draw_arrays(struct pipe_context *_pipe, trace_dump_arg(uint, start); trace_dump_arg(uint, count); - result = pipe->draw_arrays(pipe, mode, start, count);; + result = pipe->draw_arrays(pipe, mode, start, count); trace_dump_ret(bool, result); @@ -232,7 +232,7 @@ trace_context_draw_elements(struct pipe_context *_pipe, trace_dump_arg(uint, start); trace_dump_arg(uint, count); - result = pipe->draw_elements(pipe, indexBuffer, indexSize, mode, start, count);; + result = pipe->draw_elements(pipe, indexBuffer, indexSize, mode, start, count); trace_dump_ret(bool, result); @@ -306,7 +306,7 @@ trace_context_create_query(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(uint, query_type); - result = pipe->create_query(pipe, query_type);; + result = pipe->create_query(pipe, query_type); trace_dump_ret(ptr, result); @@ -328,7 +328,7 @@ trace_context_destroy_query(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(ptr, query); - pipe->destroy_query(pipe, query);; + pipe->destroy_query(pipe, query); trace_dump_call_end(); } @@ -346,7 +346,7 @@ trace_context_begin_query(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(ptr, query); - pipe->begin_query(pipe, query);; + pipe->begin_query(pipe, query); trace_dump_call_end(); } @@ -385,7 +385,7 @@ trace_context_get_query_result(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); - _result = pipe->get_query_result(pipe, query, wait, presult);; + _result = pipe->get_query_result(pipe, query, wait, presult); result = *presult; trace_dump_arg(uint, result); @@ -410,7 +410,7 @@ trace_context_create_blend_state(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(blend_state, state); - result = pipe->create_blend_state(pipe, state);; + result = pipe->create_blend_state(pipe, state); trace_dump_ret(ptr, result); @@ -432,7 +432,7 @@ trace_context_bind_blend_state(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(ptr, state); - pipe->bind_blend_state(pipe, state);; + pipe->bind_blend_state(pipe, state); trace_dump_call_end(); } @@ -450,7 +450,7 @@ trace_context_delete_blend_state(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(ptr, state); - pipe->delete_blend_state(pipe, state);; + pipe->delete_blend_state(pipe, state); trace_dump_call_end(); } @@ -469,7 +469,7 @@ trace_context_create_sampler_state(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(sampler_state, state); - result = pipe->create_sampler_state(pipe, state);; + result = pipe->create_sampler_state(pipe, state); trace_dump_ret(ptr, result); @@ -510,7 +510,7 @@ trace_context_delete_sampler_state(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(ptr, state); - pipe->delete_sampler_state(pipe, state);; + pipe->delete_sampler_state(pipe, state); trace_dump_call_end(); } @@ -529,7 +529,7 @@ trace_context_create_rasterizer_state(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(rasterizer_state, state); - result = pipe->create_rasterizer_state(pipe, state);; + result = pipe->create_rasterizer_state(pipe, state); trace_dump_ret(ptr, result); @@ -551,7 +551,7 @@ trace_context_bind_rasterizer_state(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(ptr, state); - pipe->bind_rasterizer_state(pipe, state);; + pipe->bind_rasterizer_state(pipe, state); trace_dump_call_end(); } @@ -569,7 +569,7 @@ trace_context_delete_rasterizer_state(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(ptr, state); - pipe->delete_rasterizer_state(pipe, state);; + pipe->delete_rasterizer_state(pipe, state); trace_dump_call_end(); } @@ -585,7 +585,7 @@ trace_context_create_depth_stencil_alpha_state(struct pipe_context *_pipe, trace_dump_call_begin("pipe_context", "create_depth_stencil_alpha_state"); - result = pipe->create_depth_stencil_alpha_state(pipe, state);; + result = pipe->create_depth_stencil_alpha_state(pipe, state); trace_dump_arg(ptr, pipe); trace_dump_arg(depth_stencil_alpha_state, state); @@ -610,7 +610,7 @@ trace_context_bind_depth_stencil_alpha_state(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(ptr, state); - pipe->bind_depth_stencil_alpha_state(pipe, state);; + pipe->bind_depth_stencil_alpha_state(pipe, state); trace_dump_call_end(); } @@ -628,7 +628,7 @@ trace_context_delete_depth_stencil_alpha_state(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(ptr, state); - pipe->delete_depth_stencil_alpha_state(pipe, state);; + pipe->delete_depth_stencil_alpha_state(pipe, state); trace_dump_call_end(); } @@ -647,7 +647,7 @@ trace_context_create_fs_state(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(shader_state, state); - result = pipe->create_fs_state(pipe, state);; + result = pipe->create_fs_state(pipe, state); trace_dump_ret(ptr, result); @@ -750,7 +750,7 @@ trace_context_bind_vs_state(struct pipe_context *_pipe, if (tr_shdr && tr_shdr->replaced) state = tr_shdr->replaced; - pipe->bind_vs_state(pipe, state);; + pipe->bind_vs_state(pipe, state); trace_dump_call_end(); } @@ -770,7 +770,7 @@ trace_context_delete_vs_state(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(ptr, state); - pipe->delete_vs_state(pipe, state);; + pipe->delete_vs_state(pipe, state); trace_dump_call_end(); @@ -790,7 +790,7 @@ trace_context_set_blend_color(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(blend_color, state); - pipe->set_blend_color(pipe, state);; + pipe->set_blend_color(pipe, state); trace_dump_call_end(); } @@ -808,7 +808,7 @@ trace_context_set_clip_state(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(clip_state, state); - pipe->set_clip_state(pipe, state);; + pipe->set_clip_state(pipe, state); trace_dump_call_end(); } @@ -880,7 +880,7 @@ trace_context_set_framebuffer_state(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(framebuffer_state, state); - pipe->set_framebuffer_state(pipe, state);; + pipe->set_framebuffer_state(pipe, state); trace_dump_call_end(); } @@ -898,7 +898,7 @@ trace_context_set_polygon_stipple(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(poly_stipple, state); - pipe->set_polygon_stipple(pipe, state);; + pipe->set_polygon_stipple(pipe, state); trace_dump_call_end(); } @@ -916,7 +916,7 @@ trace_context_set_scissor_state(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(scissor_state, state); - pipe->set_scissor_state(pipe, state);; + pipe->set_scissor_state(pipe, state); trace_dump_call_end(); } @@ -934,7 +934,7 @@ trace_context_set_viewport_state(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(viewport_state, state); - pipe->set_viewport_state(pipe, state);; + pipe->set_viewport_state(pipe, state); trace_dump_call_end(); } @@ -1024,7 +1024,7 @@ trace_context_set_vertex_elements(struct pipe_context *_pipe, trace_dump_struct_array(vertex_element, elements, num_elements); trace_dump_arg_end(); - pipe->set_vertex_elements(pipe, num_elements, elements);; + pipe->set_vertex_elements(pipe, num_elements, elements); trace_dump_call_end(); } @@ -1085,7 +1085,7 @@ trace_context_surface_fill(struct pipe_context *_pipe, trace_dump_arg(uint, width); trace_dump_arg(uint, height); - pipe->surface_fill(pipe, dst, dstx, dsty, width, height, value);; + pipe->surface_fill(pipe, dst, dstx, dsty, width, height, value); trace_dump_call_end(); } @@ -1128,7 +1128,7 @@ trace_context_flush(struct pipe_context *_pipe, trace_dump_arg(ptr, pipe); trace_dump_arg(uint, flags); - pipe->flush(pipe, flags, fence);; + pipe->flush(pipe, flags, fence); if(fence) trace_dump_ret(ptr, *fence); -- cgit v1.2.3 From f2f7bd855af49752b1c77746542c62f1c529e953 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 09:01:27 +0100 Subject: id: Implement separate vertex sampler state. --- src/gallium/drivers/identity/id_context.c | 58 ++++++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c index 2f5b38ea15..4509c7b1e5 100644 --- a/src/gallium/drivers/identity/id_context.c +++ b/src/gallium/drivers/identity/id_context.c @@ -221,18 +221,31 @@ identity_create_sampler_state(struct pipe_context *_pipe, } static void -identity_bind_sampler_states(struct pipe_context *_pipe, - unsigned num, - void **samplers) +identity_bind_fragment_sampler_states(struct pipe_context *_pipe, + unsigned num_samplers, + void **samplers) { struct identity_context *id_pipe = identity_context(_pipe); struct pipe_context *pipe = id_pipe->pipe; pipe->bind_fragment_sampler_states(pipe, - num, + num_samplers, samplers); } +static void +identity_bind_vertex_sampler_states(struct pipe_context *_pipe, + unsigned num_samplers, + void **samplers) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + + pipe->bind_vertex_sampler_states(pipe, + num_samplers, + samplers); +} + static void identity_delete_sampler_state(struct pipe_context *_pipe, void *sampler) @@ -480,9 +493,9 @@ identity_set_viewport_state(struct pipe_context *_pipe, } static void -identity_set_sampler_textures(struct pipe_context *_pipe, - unsigned num_textures, - struct pipe_texture **_textures) +identity_set_fragment_sampler_textures(struct pipe_context *_pipe, + unsigned num_textures, + struct pipe_texture **_textures) { struct identity_context *id_pipe = identity_context(_pipe); struct pipe_context *pipe = id_pipe->pipe; @@ -504,6 +517,31 @@ identity_set_sampler_textures(struct pipe_context *_pipe, textures); } +static void +identity_set_vertex_sampler_textures(struct pipe_context *_pipe, + unsigned num_textures, + struct pipe_texture **_textures) +{ + struct identity_context *id_pipe = identity_context(_pipe); + struct pipe_context *pipe = id_pipe->pipe; + struct pipe_texture *unwrapped_textures[PIPE_MAX_VERTEX_SAMPLERS]; + struct pipe_texture **textures = NULL; + unsigned i; + + if (_textures) { + for (i = 0; i < num_textures; i++) + unwrapped_textures[i] = identity_texture_unwrap(_textures[i]); + for (; i < PIPE_MAX_VERTEX_SAMPLERS; i++) + unwrapped_textures[i] = NULL; + + textures = unwrapped_textures; + } + + pipe->set_vertex_sampler_textures(pipe, + num_textures, + textures); +} + static void identity_set_vertex_buffers(struct pipe_context *_pipe, unsigned num_buffers, @@ -682,7 +720,8 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) id_pipe->base.bind_blend_state = identity_bind_blend_state; id_pipe->base.delete_blend_state = identity_delete_blend_state; id_pipe->base.create_sampler_state = identity_create_sampler_state; - id_pipe->base.bind_fragment_sampler_states = identity_bind_sampler_states; + id_pipe->base.bind_fragment_sampler_states = identity_bind_fragment_sampler_states; + id_pipe->base.bind_vertex_sampler_states = identity_bind_vertex_sampler_states; id_pipe->base.delete_sampler_state = identity_delete_sampler_state; id_pipe->base.create_rasterizer_state = identity_create_rasterizer_state; id_pipe->base.bind_rasterizer_state = identity_bind_rasterizer_state; @@ -703,7 +742,8 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) id_pipe->base.set_polygon_stipple = identity_set_polygon_stipple; id_pipe->base.set_scissor_state = identity_set_scissor_state; id_pipe->base.set_viewport_state = identity_set_viewport_state; - id_pipe->base.set_fragment_sampler_textures = identity_set_sampler_textures; + id_pipe->base.set_fragment_sampler_textures = identity_set_vertex_sampler_textures; + id_pipe->base.set_vertex_sampler_textures = identity_set_vertex_sampler_textures; id_pipe->base.set_vertex_buffers = identity_set_vertex_buffers; id_pipe->base.set_vertex_elements = identity_set_vertex_elements; id_pipe->base.surface_copy = identity_surface_copy; -- cgit v1.2.3 From f8969db2f8410fd3b653734948251ada4284a3c6 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 09:39:08 +0100 Subject: fo: Implement separate vertex sampler state. --- src/gallium/drivers/failover/fo_context.h | 6 +++ src/gallium/drivers/failover/fo_state.c | 77 +++++++++++++++++++++++++--- src/gallium/drivers/failover/fo_state_emit.c | 6 +++ 3 files changed, 82 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/failover/fo_context.h b/src/gallium/drivers/failover/fo_context.h index 9ba86ba866..149393712a 100644 --- a/src/gallium/drivers/failover/fo_context.h +++ b/src/gallium/drivers/failover/fo_context.h @@ -72,6 +72,7 @@ struct failover_context { */ const struct fo_state *blend; const struct fo_state *sampler[PIPE_MAX_SAMPLERS]; + const struct fo_state *vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS]; const struct fo_state *depth_stencil; const struct fo_state *rasterizer; const struct fo_state *fragment_shader; @@ -83,6 +84,7 @@ struct failover_context { struct pipe_poly_stipple poly_stipple; struct pipe_scissor_state scissor; struct pipe_texture *texture[PIPE_MAX_SAMPLERS]; + struct pipe_texture *vertex_textures[PIPE_MAX_VERTEX_SAMPLERS]; struct pipe_viewport_state viewport; struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS]; struct pipe_vertex_element vertex_elements[PIPE_MAX_ATTRIBS]; @@ -92,11 +94,15 @@ struct failover_context { void *sw_sampler_state[PIPE_MAX_SAMPLERS]; void *hw_sampler_state[PIPE_MAX_SAMPLERS]; + void *sw_vertex_sampler_state[PIPE_MAX_VERTEX_SAMPLERS]; + void *hw_vertex_sampler_state[PIPE_MAX_VERTEX_SAMPLERS]; unsigned dirty; unsigned num_samplers; + unsigned num_vertex_samplers; unsigned num_textures; + unsigned num_vertex_textures; unsigned mode; struct pipe_context *hw; diff --git a/src/gallium/drivers/failover/fo_state.c b/src/gallium/drivers/failover/fo_state.c index fca6caa227..3f5f556032 100644 --- a/src/gallium/drivers/failover/fo_state.c +++ b/src/gallium/drivers/failover/fo_state.c @@ -322,8 +322,9 @@ failover_create_sampler_state(struct pipe_context *pipe, } static void -failover_bind_sampler_states(struct pipe_context *pipe, - unsigned num, void **sampler) +failover_bind_fragment_sampler_states(struct pipe_context *pipe, + unsigned num, + void **sampler) { struct failover_context *failover = failover_context(pipe); struct fo_state *state = (struct fo_state*)sampler; @@ -345,6 +346,36 @@ failover_bind_sampler_states(struct pipe_context *pipe, failover->hw_sampler_state); } +static void +failover_bind_vertex_sampler_states(struct pipe_context *pipe, + unsigned num_samplers, + void **samplers) +{ + struct failover_context *failover = failover_context(pipe); + struct fo_state *state = (struct fo_state*)samplers; + uint i; + + assert(num_samplers <= PIPE_MAX_VERTEX_SAMPLERS); + + /* Check for no-op */ + if (num_samplers == failover->num_vertex_samplers && + !memcmp(failover->vertex_samplers, samplers, num_samplers * sizeof(void *))) { + return; + } + for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { + failover->sw_vertex_sampler_state[i] = i < num_samplers ? state[i].sw_state : NULL; + failover->hw_vertex_sampler_state[i] = i < num_samplers ? state[i].hw_state : NULL; + } + failover->dirty |= FO_NEW_SAMPLER; + failover->num_vertex_samplers = num_samplers; + failover->sw->bind_vertex_sampler_states(failover->sw, + num_samplers, + failover->sw_vertex_sampler_state); + failover->hw->bind_vertex_sampler_states(failover->hw, + num_samplers, + failover->hw_vertex_sampler_state); +} + static void failover_delete_sampler_state(struct pipe_context *pipe, void *sampler) { @@ -360,9 +391,9 @@ failover_delete_sampler_state(struct pipe_context *pipe, void *sampler) static void -failover_set_sampler_textures(struct pipe_context *pipe, - unsigned num, - struct pipe_texture **texture) +failover_set_fragment_sampler_textures(struct pipe_context *pipe, + unsigned num, + struct pipe_texture **texture) { struct failover_context *failover = failover_context(pipe); uint i; @@ -386,6 +417,36 @@ failover_set_sampler_textures(struct pipe_context *pipe, } +static void +failover_set_vertex_sampler_textures(struct pipe_context *pipe, + unsigned num_textures, + struct pipe_texture **textures) +{ + struct failover_context *failover = failover_context(pipe); + uint i; + + assert(num_textures <= PIPE_MAX_VERTEX_SAMPLERS); + + /* Check for no-op */ + if (num_textures == failover->num_vertex_textures && + !memcmp(failover->vertex_textures, textures, num_textures * sizeof(struct pipe_texture *))) { + return; + } + for (i = 0; i < num_textures; i++) { + pipe_texture_reference((struct pipe_texture **)&failover->vertex_textures[i], + textures[i]); + } + for (i = num_textures; i < failover->num_vertex_textures; i++) { + pipe_texture_reference((struct pipe_texture **)&failover->vertex_textures[i], + NULL); + } + failover->dirty |= FO_NEW_TEXTURE; + failover->num_vertex_textures = num_textures; + failover->sw->set_vertex_sampler_textures(failover->sw, num_textures, textures); + failover->hw->set_vertex_sampler_textures(failover->hw, num_textures, textures); +} + + static void failover_set_viewport_state( struct pipe_context *pipe, const struct pipe_viewport_state *viewport ) @@ -453,7 +514,8 @@ failover_init_state_functions( struct failover_context *failover ) failover->pipe.bind_blend_state = failover_bind_blend_state; failover->pipe.delete_blend_state = failover_delete_blend_state; failover->pipe.create_sampler_state = failover_create_sampler_state; - failover->pipe.bind_fragment_sampler_states = failover_bind_sampler_states; + failover->pipe.bind_fragment_sampler_states = failover_bind_fragment_sampler_states; + failover->pipe.bind_vertex_sampler_states = failover_bind_vertex_sampler_states; failover->pipe.delete_sampler_state = failover_delete_sampler_state; failover->pipe.create_depth_stencil_alpha_state = failover_create_depth_stencil_state; failover->pipe.bind_depth_stencil_alpha_state = failover_bind_depth_stencil_state; @@ -473,7 +535,8 @@ failover_init_state_functions( struct failover_context *failover ) failover->pipe.set_framebuffer_state = failover_set_framebuffer_state; failover->pipe.set_polygon_stipple = failover_set_polygon_stipple; failover->pipe.set_scissor_state = failover_set_scissor_state; - failover->pipe.set_fragment_sampler_textures = failover_set_sampler_textures; + failover->pipe.set_fragment_sampler_textures = failover_set_fragment_sampler_textures; + failover->pipe.set_vertex_sampler_textures = failover_set_vertex_sampler_textures; failover->pipe.set_viewport_state = failover_set_viewport_state; failover->pipe.set_vertex_buffers = failover_set_vertex_buffers; failover->pipe.set_vertex_elements = failover_set_vertex_elements; diff --git a/src/gallium/drivers/failover/fo_state_emit.c b/src/gallium/drivers/failover/fo_state_emit.c index b4b1067924..a3341e33f8 100644 --- a/src/gallium/drivers/failover/fo_state_emit.c +++ b/src/gallium/drivers/failover/fo_state_emit.c @@ -94,11 +94,17 @@ failover_state_emit( struct failover_context *failover ) if (failover->dirty & FO_NEW_SAMPLER) { failover->sw->bind_fragment_sampler_states( failover->sw, failover->num_samplers, failover->sw_sampler_state ); + failover->sw->bind_vertex_sampler_states(failover->sw, + failover->num_vertex_samplers, + failover->sw_vertex_sampler_state); } if (failover->dirty & FO_NEW_TEXTURE) { failover->sw->set_fragment_sampler_textures( failover->sw, failover->num_textures, failover->texture ); + failover->sw->set_vertex_sampler_textures(failover->sw, + failover->num_vertex_textures, + failover->vertex_textures); } if (failover->dirty & FO_NEW_VERTEX_BUFFER) { -- cgit v1.2.3 From 57ed791305ded187c455b07e6c6a5b916f37a293 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 09:50:38 +0100 Subject: trace: Implement separate vertex sampler state. --- src/gallium/drivers/trace/tr_context.c | 76 ++++++++++++++++++++++++++++++---- src/gallium/drivers/trace/tr_context.h | 3 ++ 2 files changed, 71 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/trace/tr_context.c b/src/gallium/drivers/trace/tr_context.c index 696b787c74..2f0f063d2d 100644 --- a/src/gallium/drivers/trace/tr_context.c +++ b/src/gallium/drivers/trace/tr_context.c @@ -143,10 +143,16 @@ trace_context_draw_block(struct trace_context *tr_ctx, int flag) for (k = 0; k < tr_ctx->curr.nr_cbufs; k++) if (tr_ctx->draw_rule.surf == tr_ctx->curr.cbufs[k]) block = TRUE; - if (tr_ctx->draw_rule.tex) + if (tr_ctx->draw_rule.tex) { for (k = 0; k < tr_ctx->curr.num_texs; k++) if (tr_ctx->draw_rule.tex == tr_ctx->curr.tex[k]) block = TRUE; + for (k = 0; k < tr_ctx->curr.num_vert_texs; k++) { + if (tr_ctx->draw_rule.tex == tr_ctx->curr.vert_tex[k]) { + block = TRUE; + } + } + } if (block) tr_ctx->draw_blocked |= (flag | 4); @@ -480,8 +486,9 @@ trace_context_create_sampler_state(struct pipe_context *_pipe, static INLINE void -trace_context_bind_sampler_states(struct pipe_context *_pipe, - unsigned num_states, void **states) +trace_context_bind_fragment_sampler_states(struct pipe_context *_pipe, + unsigned num_states, + void **states) { struct trace_context *tr_ctx = trace_context(_pipe); struct pipe_context *pipe = tr_ctx->pipe; @@ -498,6 +505,26 @@ trace_context_bind_sampler_states(struct pipe_context *_pipe, } +static INLINE void +trace_context_bind_vertex_sampler_states(struct pipe_context *_pipe, + unsigned num_states, + void **states) +{ + struct trace_context *tr_ctx = trace_context(_pipe); + struct pipe_context *pipe = tr_ctx->pipe; + + trace_dump_call_begin("pipe_context", "bind_vertex_sampler_states"); + + trace_dump_arg(ptr, pipe); + trace_dump_arg(uint, num_states); + trace_dump_arg_array(ptr, states, num_states); + + pipe->bind_vertex_sampler_states(pipe, num_states, states); + + trace_dump_call_end(); +} + + static INLINE void trace_context_delete_sampler_state(struct pipe_context *_pipe, void *state) @@ -941,9 +968,9 @@ trace_context_set_viewport_state(struct pipe_context *_pipe, static INLINE void -trace_context_set_sampler_textures(struct pipe_context *_pipe, - unsigned num_textures, - struct pipe_texture **textures) +trace_context_set_fragment_sampler_textures(struct pipe_context *_pipe, + unsigned num_textures, + struct pipe_texture **textures) { struct trace_context *tr_ctx = trace_context(_pipe); struct trace_texture *tr_tex; @@ -971,6 +998,37 @@ trace_context_set_sampler_textures(struct pipe_context *_pipe, } +static INLINE void +trace_context_set_vertex_sampler_textures(struct pipe_context *_pipe, + unsigned num_textures, + struct pipe_texture **textures) +{ + struct trace_context *tr_ctx = trace_context(_pipe); + struct trace_texture *tr_tex; + struct pipe_context *pipe = tr_ctx->pipe; + struct pipe_texture *unwrapped_textures[PIPE_MAX_VERTEX_SAMPLERS]; + unsigned i; + + tr_ctx->curr.num_vert_texs = num_textures; + for(i = 0; i < num_textures; ++i) { + tr_tex = trace_texture(textures[i]); + tr_ctx->curr.vert_tex[i] = tr_tex; + unwrapped_textures[i] = tr_tex ? tr_tex->texture : NULL; + } + textures = unwrapped_textures; + + trace_dump_call_begin("pipe_context", "set_vertex_sampler_textures"); + + trace_dump_arg(ptr, pipe); + trace_dump_arg(uint, num_textures); + trace_dump_arg_array(ptr, textures, num_textures); + + pipe->set_vertex_sampler_textures(pipe, num_textures, textures); + + trace_dump_call_end(); +} + + static INLINE void trace_context_set_vertex_buffers(struct pipe_context *_pipe, unsigned num_buffers, @@ -1253,7 +1311,8 @@ trace_context_create(struct pipe_screen *_screen, tr_ctx->base.bind_blend_state = trace_context_bind_blend_state; tr_ctx->base.delete_blend_state = trace_context_delete_blend_state; tr_ctx->base.create_sampler_state = trace_context_create_sampler_state; - tr_ctx->base.bind_fragment_sampler_states = trace_context_bind_sampler_states; + tr_ctx->base.bind_fragment_sampler_states = trace_context_bind_fragment_sampler_states; + tr_ctx->base.bind_vertex_sampler_states = trace_context_bind_vertex_sampler_states; tr_ctx->base.delete_sampler_state = trace_context_delete_sampler_state; tr_ctx->base.create_rasterizer_state = trace_context_create_rasterizer_state; tr_ctx->base.bind_rasterizer_state = trace_context_bind_rasterizer_state; @@ -1274,7 +1333,8 @@ trace_context_create(struct pipe_screen *_screen, tr_ctx->base.set_polygon_stipple = trace_context_set_polygon_stipple; tr_ctx->base.set_scissor_state = trace_context_set_scissor_state; tr_ctx->base.set_viewport_state = trace_context_set_viewport_state; - tr_ctx->base.set_fragment_sampler_textures = trace_context_set_sampler_textures; + tr_ctx->base.set_fragment_sampler_textures = trace_context_set_fragment_sampler_textures; + tr_ctx->base.set_vertex_sampler_textures = trace_context_set_vertex_sampler_textures; tr_ctx->base.set_vertex_buffers = trace_context_set_vertex_buffers; tr_ctx->base.set_vertex_elements = trace_context_set_vertex_elements; if (pipe->surface_copy) diff --git a/src/gallium/drivers/trace/tr_context.h b/src/gallium/drivers/trace/tr_context.h index 6febe4b411..852b480765 100644 --- a/src/gallium/drivers/trace/tr_context.h +++ b/src/gallium/drivers/trace/tr_context.h @@ -54,6 +54,9 @@ struct trace_context struct trace_texture *tex[PIPE_MAX_SAMPLERS]; unsigned num_texs; + struct trace_texture *vert_tex[PIPE_MAX_VERTEX_SAMPLERS]; + unsigned num_vert_texs; + unsigned nr_cbufs; struct trace_texture *cbufs[PIPE_MAX_COLOR_BUFS]; struct trace_texture *zsbuf; -- cgit v1.2.3 From 7a43c39d202333a74745e7724a76f36d66d8763b Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 10:07:15 +0100 Subject: cso: Fix function prototype. --- src/gallium/auxiliary/cso_cache/cso_context.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/cso_cache/cso_context.h b/src/gallium/auxiliary/cso_cache/cso_context.h index 4bcc6b5630..e5b92177cf 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.h +++ b/src/gallium/auxiliary/cso_cache/cso_context.h @@ -115,7 +115,7 @@ cso_set_vertex_sampler_textures(struct cso_context *cso, void cso_save_vertex_sampler_textures(struct cso_context *cso); void - cso_restore_sampler_textures(struct cso_context *cso); +cso_restore_vertex_sampler_textures(struct cso_context *cso); -- cgit v1.2.3 From 759604e32bb5b00d7b70fbab7bd8125e135d7a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 25 Nov 2009 00:24:28 +0100 Subject: r300g: add R300 prefix in reg definitions --- src/gallium/drivers/r300/r300_reg.h | 82 ++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 41 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h index 3a419b24b0..85b1ea568a 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -661,20 +661,20 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_GB_SUPER_TILE_B (1 << 15) # define R300_GB_SUBPIXEL_1_12 (0 << 16) # define R300_GB_SUBPIXEL_1_16 (1 << 16) -# define GB_TILE_CONFIG_QUADS_PER_RAS_4 (0 << 17) -# define GB_TILE_CONFIG_QUADS_PER_RAS_8 (1 << 17) -# define GB_TILE_CONFIG_QUADS_PER_RAS_16 (2 << 17) -# define GB_TILE_CONFIG_QUADS_PER_RAS_32 (3 << 17) -# define GB_TILE_CONFIG_BB_SCAN_INTERCEPT (0 << 19) -# define GB_TILE_CONFIG_BB_SCAN_BOUND_BOX (1 << 19) -# define GB_TILE_CONFIG_ALT_SCAN_EN_LR (0 << 20) -# define GB_TILE_CONFIG_ALT_SCAN_EN_LRL (1 << 20) -# define GB_TILE_CONFIG_ALT_OFFSET (0 << 21) -# define GB_TILE_CONFIG_SUBPRECISION (0 << 22) -# define GB_TILE_CONFIG_ALT_TILING_DEF (0 << 23) -# define GB_TILE_CONFIG_ALT_TILING_3_2 (1 << 23) -# define GB_TILE_CONFIG_Z_EXTENDED_24_1 (0 << 24) -# define GB_TILE_CONFIG_Z_EXTENDED_S25_1 (1 << 24) +# define R300_GB_TILE_CONFIG_QUADS_PER_RAS_4 (0 << 17) +# define R300_GB_TILE_CONFIG_QUADS_PER_RAS_8 (1 << 17) +# define R300_GB_TILE_CONFIG_QUADS_PER_RAS_16 (2 << 17) +# define R300_GB_TILE_CONFIG_QUADS_PER_RAS_32 (3 << 17) +# define R300_GB_TILE_CONFIG_BB_SCAN_INTERCEPT (0 << 19) +# define R300_GB_TILE_CONFIG_BB_SCAN_BOUND_BOX (1 << 19) +# define R300_GB_TILE_CONFIG_ALT_SCAN_EN_LR (0 << 20) +# define R300_GB_TILE_CONFIG_ALT_SCAN_EN_LRL (1 << 20) +# define R300_GB_TILE_CONFIG_ALT_OFFSET (0 << 21) +# define R300_GB_TILE_CONFIG_SUBPRECISION (0 << 22) +# define R300_GB_TILE_CONFIG_ALT_TILING_DEF (0 << 23) +# define R300_GB_TILE_CONFIG_ALT_TILING_3_2 (1 << 23) +# define R300_GB_TILE_CONFIG_Z_EXTENDED_24_1 (0 << 24) +# define R300_GB_TILE_CONFIG_Z_EXTENDED_S25_1 (1 << 24) /* Specifies the sizes of the various FIFO`s in the sc/rs/us. This register must be the first one written */ #define R300_GB_FIFO_SIZE 0x4024 @@ -700,9 +700,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. # define R300_OFIFO_HIGHWATER_SHIFT 22 /* two bits only */ # define R300_CUBE_FIFO_HIGHWATER_COL_SHIFT 24 -#define GB_Z_PEQ_CONFIG 0x4028 -# define GB_Z_PEQ_CONFIG_Z_PEQ_SIZE_4_4 (0 << 0) -# define GB_Z_PEQ_CONFIG_Z_PEQ_SIZE_8_8 (1 << 0) +#define R300_GB_Z_PEQ_CONFIG 0x4028 +# define R300_GB_Z_PEQ_CONFIG_Z_PEQ_SIZE_4_4 (0 << 0) +# define R300_GB_Z_PEQ_CONFIG_Z_PEQ_SIZE_8_8 (1 << 0) /* Specifies various polygon specific selects (fog, depth, perspective). */ #define R300_GB_SELECT 0x401c @@ -725,39 +725,39 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. /* Specifies the graphics pipeline configuration for antialiasing. */ #define R300_GB_AA_CONFIG 0x4020 -# define GB_AA_CONFIG_AA_DISABLE (0 << 0) -# define GB_AA_CONFIG_AA_ENABLE (1 << 0) -# define GB_AA_CONFIG_NUM_AA_SUBSAMPLES_2 (0 << 1) -# define GB_AA_CONFIG_NUM_AA_SUBSAMPLES_3 (1 << 1) -# define GB_AA_CONFIG_NUM_AA_SUBSAMPLES_4 (2 << 1) -# define GB_AA_CONFIG_NUM_AA_SUBSAMPLES_6 (3 << 1) +# define R300_GB_AA_CONFIG_AA_DISABLE (0 << 0) +# define R300_GB_AA_CONFIG_AA_ENABLE (1 << 0) +# define R300_GB_AA_CONFIG_NUM_AA_SUBSAMPLES_2 (0 << 1) +# define R300_GB_AA_CONFIG_NUM_AA_SUBSAMPLES_3 (1 << 1) +# define R300_GB_AA_CONFIG_NUM_AA_SUBSAMPLES_4 (2 << 1) +# define R300_GB_AA_CONFIG_NUM_AA_SUBSAMPLES_6 (3 << 1) /* Selects which of 4 pipes are active. */ -#define GB_PIPE_SELECT 0x402c -# define GB_PIPE_SELECT_PIPE0_ID_SHIFT 0 -# define GB_PIPE_SELECT_PIPE1_ID_SHIFT 2 -# define GB_PIPE_SELECT_PIPE2_ID_SHIFT 4 -# define GB_PIPE_SELECT_PIPE3_ID_SHIFT 6 -# define GB_PIPE_SELECT_PIPE_MASK_SHIFT 8 -# define GB_PIPE_SELECT_MAX_PIPE 12 -# define GB_PIPE_SELECT_BAD_PIPES 14 -# define GB_PIPE_SELECT_CONFIG_PIPES 18 +#define R300_GB_PIPE_SELECT 0x402c +# define R300_GB_PIPE_SELECT_PIPE0_ID_SHIFT 0 +# define R300_GB_PIPE_SELECT_PIPE1_ID_SHIFT 2 +# define R300_GB_PIPE_SELECT_PIPE2_ID_SHIFT 4 +# define R300_GB_PIPE_SELECT_PIPE3_ID_SHIFT 6 +# define R300_GB_PIPE_SELECT_PIPE_MASK_SHIFT 8 +# define R300_GB_PIPE_SELECT_MAX_PIPE 12 +# define R300_GB_PIPE_SELECT_BAD_PIPES 14 +# define R300_GB_PIPE_SELECT_CONFIG_PIPES 18 /* Specifies the sizes of the various FIFO`s in the sc/rs. */ -#define GB_FIFO_SIZE1 0x4070 +#define R300_GB_FIFO_SIZE1 0x4070 /* High water mark for SC input fifo */ -# define GB_FIFO_SIZE1_SC_HIGHWATER_IFIFO_SHIFT 0 -# define GB_FIFO_SIZE1_SC_HIGHWATER_IFIFO_MASK 0x0000003f +# define R300_GB_FIFO_SIZE1_SC_HIGHWATER_IFIFO_SHIFT 0 +# define R300_GB_FIFO_SIZE1_SC_HIGHWATER_IFIFO_MASK 0x0000003f /* High water mark for SC input fifo (B) */ -# define GB_FIFO_SIZE1_SC_HIGHWATER_BFIFO_SHIFT 6 -# define GB_FIFO_SIZE1_SC_HIGHWATER_BFIFO_MASK 0x00000fc0 +# define R300_GB_FIFO_SIZE1_SC_HIGHWATER_BFIFO_SHIFT 6 +# define R300_GB_FIFO_SIZE1_SC_HIGHWATER_BFIFO_MASK 0x00000fc0 /* High water mark for RS colors' fifo */ -# define GB_FIFO_SIZE1_SC_HIGHWATER_COL_SHIFT 12 -# define GB_FIFO_SIZE1_SC_HIGHWATER_COL_MASK 0x0003f000 +# define R300_GB_FIFO_SIZE1_SC_HIGHWATER_COL_SHIFT 12 +# define R300_GB_FIFO_SIZE1_SC_HIGHWATER_COL_MASK 0x0003f000 /* High water mark for RS textures' fifo */ -# define GB_FIFO_SIZE1_SC_HIGHWATER_TEX_SHIFT 18 -# define GB_FIFO_SIZE1_SC_HIGHWATER_TEX_MASK 0x00fc0000 +# define R300_GB_FIFO_SIZE1_SC_HIGHWATER_TEX_SHIFT 18 +# define R300_GB_FIFO_SIZE1_SC_HIGHWATER_TEX_MASK 0x00fc0000 /* This table specifies the source location and format for up to 16 texture * addresses (i[0]:i[15]) and four colors (c[0]:c[3]) -- cgit v1.2.3 From 6f05eba0204a9f1371bb1ae5cdb0f71bb819eb28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 26 Nov 2009 13:49:41 +0100 Subject: r300g: VS->FS attribute routing rework Now it always correctly pairs up VS and FS even if the semantics and indices of VS outputs and FS inputs don't match. --- src/gallium/drivers/r300/r300_state_derived.c | 562 ++++++++++++++++++-------- 1 file changed, 392 insertions(+), 170 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 6fb780cb29..03cdba0538 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -1,5 +1,6 @@ /* * Copyright 2008 Corbin Simpson + * Copyright 2009 Marek Olšák * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -35,6 +36,25 @@ /* r300_state_derived: Various bits of state which are dependent upon * currently bound CSO data. */ +#define ATTR_UNUSED (-1) +#define ATTR_COLOR_COUNT 2 +#define ATTR_GENERIC_COUNT 16 + +/* This structure contains information about what attributes are written by VS + * or read by FS. (but not both) It's much easier to work with than + * tgsi_shader_info. + * + * The variables basically means used/unused and may optionally contain + * indices to tgsi_shader_info semantics which we need to know for Draw. */ +struct r300_shader_info { + int pos; + int psize; + int color[ATTR_COLOR_COUNT]; + int bcolor[ATTR_COLOR_COUNT]; + int generic[ATTR_GENERIC_COUNT]; + int fog; +}; + struct r300_shader_key { struct r300_vertex_shader* vs; struct r300_fragment_shader* fs; @@ -61,51 +81,184 @@ int r300_shader_key_compare(void* key1, void* key2) { (shader_key1->fs == shader_key2->fs); } -/* Set up the vs_output_tab and routes. */ -static void r300_vs_output_tab_routes(struct r300_context* r300, - int* vs_output_tab) +static void r300_draw_emit_attrib(struct r300_context* r300, + enum attrib_emit emit, + enum interp_mode interp, + int index) { - struct vertex_info* vinfo = &r300->vertex_info->vinfo; - boolean pos = FALSE, psize = FALSE, fog = FALSE; - int i, texs = 0, cols = 0; - struct tgsi_shader_info* info = &r300->fs->info; + struct tgsi_shader_info* info = &r300->vs->info; + int output; - /* XXX One day we should figure out how to handle a different number of - * VS outputs and FS inputs, as well as a different number of vertex streams - * and VS inputs. It's definitely one of the sources of hardlocks. */ + if (r300->draw) { + output = draw_find_vs_output(r300->draw, + info->output_semantic_name[index], + info->output_semantic_index[index]); + draw_emit_vertex_attr(&r300->vertex_info->vinfo, emit, interp, output); + } +} - for (i = 0; i < info->num_inputs; i++) { - switch (info->input_semantic_name[i]) { +static void r300_shader_info_reset(struct r300_shader_info* info) +{ + int i; + + info->pos = ATTR_UNUSED; + info->psize = ATTR_UNUSED; + info->fog = ATTR_UNUSED; + + for (i = 0; i < ATTR_COLOR_COUNT; i++) { + info->color[i] = ATTR_UNUSED; + info->bcolor[i] = ATTR_UNUSED; + } + + for (i = 0; i < ATTR_GENERIC_COUNT; i++) { + info->generic[i] = ATTR_UNUSED; + } +} + +/* Convert info about VS output semantics to r300_shader_info. */ +static void r300_shader_read_vs_outputs(struct tgsi_shader_info* info, + struct r300_shader_info* vs_outputs) +{ + int i; + unsigned index; + + r300_shader_info_reset(vs_outputs); + + for (i = 0; i < info->num_outputs; i++) { + index = info->output_semantic_index[i]; + + switch (info->output_semantic_name[i]) { case TGSI_SEMANTIC_POSITION: - pos = TRUE; - vs_output_tab[i] = 0; + assert(index == 0); + vs_outputs->pos = i; + break; + + case TGSI_SEMANTIC_PSIZE: + assert(index == 0); + vs_outputs->psize = i; break; + case TGSI_SEMANTIC_COLOR: - vs_output_tab[i] = 2 + cols; - cols++; + assert(index <= ATTR_COLOR_COUNT); + vs_outputs->color[index] = i; break; - case TGSI_SEMANTIC_PSIZE: - assert(psize == FALSE); - psize = TRUE; - vs_output_tab[i] = 15; + + case TGSI_SEMANTIC_BCOLOR: + assert(index <= ATTR_COLOR_COUNT); + vs_outputs->bcolor[index] = i; break; - case TGSI_SEMANTIC_FOG: - assert(fog == FALSE); - fog = TRUE; - /* Fall through */ + case TGSI_SEMANTIC_GENERIC: - vs_output_tab[i] = 6 + texs; - texs++; + assert(index <= ATTR_GENERIC_COUNT); + vs_outputs->generic[index] = i; break; - default: - debug_printf("r300: Unknown vertex input %d\n", - info->input_semantic_name[i]); + + case TGSI_SEMANTIC_FOG: + assert(index == 0); + vs_outputs->fog = i; break; + + default: + assert(0); } } +} + +/* Set VS output stream locations for SWTCL. */ +static void r300_stream_locations_swtcl(struct r300_shader_info* vs_outputs, + int* vs_output_tab) +{ + int i, tabi = 0, gen_count; + + /* XXX Check whether the numbers (0, 1, 2+i, etc.) are correct. + * These should go to VAP_PROG_STREAM_CNTL/DST_VEC_LOC. */ + + /* Position. */ + vs_output_tab[tabi++] = 0; + + /* Point size. */ + if (vs_outputs->psize != ATTR_UNUSED) { + vs_output_tab[tabi++] = 1; + } + + /* Colors. */ + for (i = 0; i < ATTR_COLOR_COUNT; i++) { + if (vs_outputs->color[i] != ATTR_UNUSED) { + vs_output_tab[tabi++] = 2 + i; + } + } + + /* Back-face colors. */ + for (i = 0; i < ATTR_COLOR_COUNT; i++) { + if (vs_outputs->bcolor[i] != ATTR_UNUSED) { + vs_output_tab[tabi++] = 4 + i; + } + } + + /* Texture coordinates. */ + gen_count = 0; + for (i = 0; i < ATTR_GENERIC_COUNT; i++) { + if (vs_outputs->bcolor[i] != ATTR_UNUSED) { + assert(tabi < 16); + vs_output_tab[tabi++] = 6 + gen_count; + gen_count++; + } + } + + /* Fog coordinates. */ + if (vs_outputs->fog != ATTR_UNUSED) { + assert(tabi < 16); + vs_output_tab[tabi++] = 6 + gen_count; + gen_count++; + } /* XXX magic */ - assert(texs <= 8); + assert(gen_count <= 8); + + for (; tabi < 16;) { + vs_output_tab[tabi++] = -1; + } +} + +/* Convert info about FS input semantics to r300_shader_info. */ +static void r300_shader_read_fs_inputs(struct tgsi_shader_info* info, + struct r300_shader_info* fs_inputs) +{ + int i; + unsigned index; + + r300_shader_info_reset(fs_inputs); + + for (i = 0; i < info->num_inputs; i++) { + index = info->input_semantic_index[i]; + + switch (info->input_semantic_name[i]) { + case TGSI_SEMANTIC_COLOR: + assert(index <= ATTR_COLOR_COUNT); + fs_inputs->color[index] = i; + break; + + case TGSI_SEMANTIC_GENERIC: + assert(index <= ATTR_GENERIC_COUNT); + fs_inputs->generic[index] = i; + break; + + case TGSI_SEMANTIC_FOG: + assert(index == 0); + fs_inputs->fog = i; + break; + + default: + assert(0); + } + } +} + +static void r300_update_vap_output_fmt(struct r300_context* r300, + struct r300_shader_info* vs_outputs) +{ + struct vertex_info* vinfo = &r300->vertex_info->vinfo; + int i, gen_count; /* Do the actual vertex_info setup. * @@ -117,69 +270,59 @@ static void r300_vs_output_tab_routes(struct r300_context* r300, vinfo->hwfmt[0] = 0x5555; /* XXX this is classic Mesa bonghits */ - /* We need to add vertex position attribute only for SW TCL case, - * for HW TCL case it could be generated by vertex shader */ - if (!pos) { - /* Make room for the position attribute - * at the beginning of the vs_output_tab. */ - for (i = 15; i > 0; i--) { - vs_output_tab[i] = vs_output_tab[i-1]; - } - vs_output_tab[0] = 0; - } - /* Position. */ - if (r300->draw) { - draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, - draw_find_vs_output(r300->draw, TGSI_SEMANTIC_POSITION, 0)); + if (vs_outputs->pos != ATTR_UNUSED) { + r300_draw_emit_attrib(r300, EMIT_4F, INTERP_PERSPECTIVE, + vs_outputs->pos); + vinfo->hwfmt[1] |= R300_INPUT_CNTL_POS; + vinfo->hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT; + } else { + assert(0); } - vinfo->hwfmt[1] |= R300_INPUT_CNTL_POS; - vinfo->hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT; /* Point size. */ - if (psize) { - if (r300->draw) { - draw_emit_vertex_attr(vinfo, EMIT_1F_PSIZE, INTERP_POS, - draw_find_vs_output(r300->draw, TGSI_SEMANTIC_PSIZE, 0)); - } + if (vs_outputs->psize != ATTR_UNUSED) { + r300_draw_emit_attrib(r300, EMIT_1F_PSIZE, INTERP_POS, + vs_outputs->psize); vinfo->hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT; } /* Colors. */ - for (i = 0; i < cols; i++) { - if (r300->draw) { - draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_LINEAR, - draw_find_vs_output(r300->draw, TGSI_SEMANTIC_COLOR, i)); + for (i = 0; i < ATTR_COLOR_COUNT; i++) { + if (vs_outputs->color[i] != ATTR_UNUSED) { + r300_draw_emit_attrib(r300, EMIT_4F, INTERP_LINEAR, + vs_outputs->color[i]); + vinfo->hwfmt[1] |= R300_INPUT_CNTL_COLOR; + vinfo->hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << i; } - vinfo->hwfmt[1] |= R300_INPUT_CNTL_COLOR; - vinfo->hwfmt[2] |= (R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << i); } - /* Init i right here, increment it if fog is enabled. - * This gets around a double-increment problem. */ - i = 0; - - /* Fog. This is a special-cased texcoord. */ - if (fog) { - i++; - if (r300->draw) { - draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, - draw_find_vs_output(r300->draw, TGSI_SEMANTIC_FOG, 0)); + /* XXX Back-face colors. */ + + /* Texture coordinates. */ + gen_count = 0; + for (i = 0; i < ATTR_GENERIC_COUNT; i++) { + if (vs_outputs->generic[i] != ATTR_UNUSED) { + r300_draw_emit_attrib(r300, EMIT_4F, INTERP_PERSPECTIVE, + vs_outputs->generic[i]); + vinfo->hwfmt[1] |= (R300_INPUT_CNTL_TC0 << gen_count); + vinfo->hwfmt[3] |= (4 << (3 * gen_count)); + gen_count++; } - vinfo->hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i); - vinfo->hwfmt[3] |= (4 << (3 * i)); } - /* Texcoords. */ - for (; i < texs; i++) { - if (r300->draw) { - draw_emit_vertex_attr(vinfo, EMIT_4F, INTERP_PERSPECTIVE, - draw_find_vs_output(r300->draw, TGSI_SEMANTIC_GENERIC, i)); - } - vinfo->hwfmt[1] |= (R300_INPUT_CNTL_TC0 << i); - vinfo->hwfmt[3] |= (4 << (3 * i)); + /* Fog coordinates. */ + if (vs_outputs->fog != ATTR_UNUSED) { + r300_draw_emit_attrib(r300, EMIT_4F, INTERP_PERSPECTIVE, + vs_outputs->fog); + vinfo->hwfmt[1] |= (R300_INPUT_CNTL_TC0 << gen_count); + vinfo->hwfmt[3] |= (4 << (3 * gen_count)); + gen_count++; } + /* XXX magic */ + assert(gen_count <= 8); + draw_compute_vertex_size(vinfo); } @@ -279,109 +422,191 @@ static void r300_swtcl_vertex_psc(struct r300_context* r300, (R300_LAST_VEC << (i & 1 ? 16 : 0)); } -/* Set up the RS block. This is the part of the chipset that actually does - * the rasterization of vertices into fragments. This is also the part of the - * chipset that locks up if any part of it is even slightly wrong. */ -static void r300_update_rs_block(struct r300_context* r300) +static void r300_rs_col(struct r300_rs_block* rs, int id, int ptr, + boolean swizzle_0001) { - struct r300_rs_block* rs = r300->rs_block; - struct tgsi_shader_info* info = &r300->fs->info; - int col_count = 0, fp_offset = 0, i, tex_count = 0; - int rs_tex_comp = 0; + rs->ip[id] |= R300_RS_COL_PTR(ptr); + if (swizzle_0001) { + rs->ip[id] |= R300_RS_COL_FMT(R300_RS_COL_FMT_0001); + } else { + rs->ip[id] |= R300_RS_COL_FMT(R300_RS_COL_FMT_RGBA); + } + rs->inst[id] |= R300_RS_INST_COL_ID(id); +} - if (r300_screen(r300->context.screen)->caps->is_r500) { - for (i = 0; i < info->num_inputs; i++) { - switch (info->input_semantic_name[i]) { - case TGSI_SEMANTIC_COLOR: - rs->ip[col_count] |= - R500_RS_COL_PTR(col_count) | - R500_RS_COL_FMT(R300_RS_COL_FMT_RGBA); - col_count++; - break; - case TGSI_SEMANTIC_GENERIC: - rs->ip[tex_count] |= - R500_RS_SEL_S(rs_tex_comp) | - R500_RS_SEL_T(rs_tex_comp + 1) | - R500_RS_SEL_R(rs_tex_comp + 2) | - R500_RS_SEL_Q(rs_tex_comp + 3); - tex_count++; - rs_tex_comp += 4; - break; - default: - break; - } - } +static void r300_rs_col_write(struct r300_rs_block* rs, int id, int fp_offset) +{ + rs->inst[id] |= R300_RS_INST_COL_CN_WRITE | + R300_RS_INST_COL_ADDR(fp_offset); +} - /* Rasterize at least one color, or bad things happen. */ - if ((col_count == 0) && (tex_count == 0)) { - rs->ip[0] |= R500_RS_COL_FMT(R300_RS_COL_FMT_0001); - col_count++; - } +static void r300_rs_tex(struct r300_rs_block* rs, int id, int ptr, + boolean swizzle_X001) +{ + if (swizzle_X001) { + rs->ip[id] |= R300_RS_TEX_PTR(ptr*4) | + R300_RS_SEL_S(R300_RS_SEL_C0) | + R300_RS_SEL_T(R300_RS_SEL_K0) | + R300_RS_SEL_R(R300_RS_SEL_K0) | + R300_RS_SEL_Q(R300_RS_SEL_K1); + } else { + rs->ip[id] |= R300_RS_TEX_PTR(ptr*4) | + R300_RS_SEL_S(R300_RS_SEL_C0) | + R300_RS_SEL_T(R300_RS_SEL_C1) | + R300_RS_SEL_R(R300_RS_SEL_C2) | + R300_RS_SEL_Q(R300_RS_SEL_C3); + } + rs->inst[id] |= R300_RS_INST_TEX_ID(id); +} - 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); - fp_offset++; - } +static void r300_rs_tex_write(struct r300_rs_block* rs, int id, int fp_offset) +{ + rs->inst[id] |= R300_RS_INST_TEX_CN_WRITE | + R300_RS_INST_TEX_ADDR(fp_offset); +} - 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); - fp_offset++; - } +static void r500_rs_col(struct r300_rs_block* rs, int id, int ptr, + boolean swizzle_0001) +{ + rs->ip[id] |= R500_RS_COL_PTR(ptr); + if (swizzle_0001) { + rs->ip[id] |= R500_RS_COL_FMT(R300_RS_COL_FMT_0001); + } else { + rs->ip[id] |= R500_RS_COL_FMT(R300_RS_COL_FMT_RGBA); + } + rs->inst[id] |= R500_RS_INST_COL_ID(id); +} + +static void r500_rs_col_write(struct r300_rs_block* rs, int id, int fp_offset) +{ + rs->inst[id] |= R500_RS_INST_COL_CN_WRITE | + R500_RS_INST_COL_ADDR(fp_offset); +} +static void r500_rs_tex(struct r300_rs_block* rs, int id, int ptr, + boolean swizzle_X001) +{ + int rs_tex_comp = ptr*4; + + if (swizzle_X001) { + rs->ip[id] |= R500_RS_SEL_S(rs_tex_comp) | + 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); } else { - for (i = 0; i < info->num_inputs; i++) { - switch (info->input_semantic_name[i]) { - case TGSI_SEMANTIC_COLOR: - rs->ip[col_count] |= - R300_RS_COL_PTR(col_count) | - R300_RS_COL_FMT(R300_RS_COL_FMT_RGBA); - col_count++; - break; - case TGSI_SEMANTIC_GENERIC: - rs->ip[tex_count] |= - R300_RS_TEX_PTR(rs_tex_comp) | - R300_RS_SEL_S(R300_RS_SEL_C0) | - R300_RS_SEL_T(R300_RS_SEL_C1) | - R300_RS_SEL_R(R300_RS_SEL_C2) | - R300_RS_SEL_Q(R300_RS_SEL_C3); - tex_count++; - rs_tex_comp+=4; - break; - default: - break; - } - } + rs->ip[id] |= R500_RS_SEL_S(rs_tex_comp) | + R500_RS_SEL_T(rs_tex_comp + 1) | + R500_RS_SEL_R(rs_tex_comp + 2) | + R500_RS_SEL_Q(rs_tex_comp + 3); + } + rs->inst[id] |= R500_RS_INST_TEX_ID(id); +} + +static void r500_rs_tex_write(struct r300_rs_block* rs, int id, int fp_offset) +{ + rs->inst[id] |= R500_RS_INST_TEX_CN_WRITE | + R500_RS_INST_TEX_ADDR(fp_offset); +} + +/* Set up the RS block. + * + * This is the part of the chipset that actually does the rasterization + * of vertices into fragments. This is also the part of the chipset that + * locks up if any part of it is even slightly wrong. */ +static void r300_update_rs_block(struct r300_context* r300, + struct r300_shader_info* vs_outputs, + struct r300_shader_info* fs_inputs) +{ + struct r300_rs_block* rs = r300->rs_block; + int i, col_count = 0, tex_count = 0, fp_offset = 0; + void (*rX00_rs_col)(struct r300_rs_block*, int, int, boolean); + void (*rX00_rs_col_write)(struct r300_rs_block*, int, int); + void (*rX00_rs_tex)(struct r300_rs_block*, int, int, boolean); + void (*rX00_rs_tex_write)(struct r300_rs_block*, int, int); - /* Rasterize at least one color, or bad things happen. */ - if (col_count == 0) { - rs->ip[0] |= R300_RS_COL_FMT(R300_RS_COL_FMT_0001); + if (r300_screen(r300->context.screen)->caps->is_r500) { + rX00_rs_col = r500_rs_col; + rX00_rs_col_write = r500_rs_col_write; + rX00_rs_tex = r500_rs_tex; + rX00_rs_tex_write = r500_rs_tex_write; + } else { + rX00_rs_col = r300_rs_col; + rX00_rs_col_write = r300_rs_col_write; + rX00_rs_tex = r300_rs_tex; + rX00_rs_tex_write = r300_rs_tex_write; + } + + /* Rasterize colors. */ + for (i = 0; i < ATTR_COLOR_COUNT; i++) { + if (vs_outputs->color[i] != ATTR_UNUSED) { + /* Always rasterize if it's written by the VS, + * otherwise it locks up. */ + rX00_rs_col(rs, col_count, i, FALSE); + + /* Write it to the FS input register if it's used by the FS. */ + if (fs_inputs->color[i] != ATTR_UNUSED) { + rX00_rs_col_write(rs, col_count, fp_offset); + fp_offset++; + } col_count++; + } else { + /* Skip the FS input register, leave it uninitialized. */ + /* If we try to set it to (0,0,0,1), it will lock up. */ + if (fs_inputs->color[i] != ATTR_UNUSED) { + fp_offset++; + } } + } - if (tex_count == 0) { - rs->ip[0] |= - R300_RS_SEL_S(R300_RS_SEL_K0) | - R300_RS_SEL_T(R300_RS_SEL_K0) | - R300_RS_SEL_R(R300_RS_SEL_K0) | - R300_RS_SEL_Q(R300_RS_SEL_K1); + /* Rasterize texture coordinates. */ + for (i = 0; i < ATTR_GENERIC_COUNT; i++) { + if (vs_outputs->generic[i] != ATTR_UNUSED) { + /* Always rasterize if it's written by the VS, + * otherwise it locks up. */ + rX00_rs_tex(rs, tex_count, tex_count, FALSE); + + /* Write it to the FS input register if it's used by the FS. */ + if (fs_inputs->generic[i] != ATTR_UNUSED) { + rX00_rs_tex_write(rs, tex_count, fp_offset); + fp_offset++; + } + tex_count++; + } else { + /* Skip the FS input register, leave it uninitialized. */ + /* If we try to set it to (0,0,0,1), it will lock up. */ + if (fs_inputs->generic[i] != ATTR_UNUSED) { + 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); + /* Rasterize fog coordinates. */ + if (vs_outputs->fog != ATTR_UNUSED) { + /* Always rasterize if it's written by the VS, + * otherwise it locks up. */ + rX00_rs_tex(rs, tex_count, tex_count, TRUE); + + /* Write it to the FS input register if it's used by the FS. */ + if (fs_inputs->fog != ATTR_UNUSED) { + rX00_rs_tex_write(rs, tex_count, fp_offset); fp_offset++; } - - 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); + tex_count++; + } else { + /* Skip the FS input register, leave it uninitialized. */ + /* If we try to set it to (0,0,0,1), it will lock up. */ + if (fs_inputs->fog != ATTR_UNUSED) { fp_offset++; } } - rs->count = (rs_tex_comp) | (col_count << R300_IC_COUNT_SHIFT) | + /* Rasterize at least one color, or bad things happen. */ + if (col_count == 0 && tex_count == 0) { + rX00_rs_col(rs, 0, 0, TRUE); + col_count++; + } + + rs->count = (tex_count*4) | (col_count << R300_IC_COUNT_SHIFT) | R300_HIRES_EN; rs->inst_count = MAX3(col_count - 1, tex_count - 1, 0); @@ -391,9 +616,8 @@ static void r300_update_rs_block(struct r300_context* r300) static void r300_update_derived_shader_state(struct r300_context* r300) { struct r300_screen* r300screen = r300_screen(r300->context.screen); + struct r300_shader_info vs_outputs, fs_inputs; int vs_output_tab[16]; - int i; - /* struct r300_shader_key* key; @@ -425,21 +649,19 @@ static void r300_update_derived_shader_state(struct r300_context* r300) memset(r300->rs_block, 0, sizeof(struct r300_rs_block)); memset(r300->vertex_info, 0, sizeof(struct r300_vertex_info)); - for (i = 0; i < 16; i++) { - vs_output_tab[i] = -1; - } + r300_shader_read_vs_outputs(&r300->vs->info, &vs_outputs); + r300_shader_read_fs_inputs(&r300->fs->info, &fs_inputs); - /* Update states */ - r300_vs_output_tab_routes(r300, vs_output_tab); + r300_update_vap_output_fmt(r300, &vs_outputs); + r300_update_rs_block(r300, &vs_outputs, &fs_inputs); if (r300screen->caps->has_tcl) { r300_vertex_psc(r300); } else { + r300_stream_locations_swtcl(&vs_outputs, vs_output_tab); r300_swtcl_vertex_psc(r300, vs_output_tab); } - r300_update_rs_block(r300); - r300->dirty_state |= R300_NEW_RS_BLOCK; } -- cgit v1.2.3 From cb90235135ef7c657053657f3bdfbda7ca70d708 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Thu, 26 Nov 2009 19:37:58 +0100 Subject: r300g: clean up derived states The state setups which aren't derived anymore have been moved to the VS and FS objects. --- src/gallium/drivers/r300/r300_fs.c | 42 +++- src/gallium/drivers/r300/r300_fs.h | 6 +- src/gallium/drivers/r300/r300_shader_semantics.h | 64 ++++++ src/gallium/drivers/r300/r300_state_derived.c | 235 ++--------------------- src/gallium/drivers/r300/r300_vs.c | 182 +++++++++++++++++- src/gallium/drivers/r300/r300_vs.h | 11 +- 6 files changed, 311 insertions(+), 229 deletions(-) create mode 100644 src/gallium/drivers/r300/r300_shader_semantics.h (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c index 29ddc84c41..9cc833e606 100644 --- a/src/gallium/drivers/r300/r300_fs.c +++ b/src/gallium/drivers/r300/r300_fs.c @@ -1,6 +1,7 @@ /* * Copyright 2008 Corbin Simpson * Joakim Sindholt + * Copyright 2009 Marek Olšák * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -31,6 +32,40 @@ #include "radeon_code.h" #include "radeon_compiler.h" +/* Convert info about FS input semantics to r300_shader_semantics. */ +static void r300_shader_read_fs_inputs(struct tgsi_shader_info* info, + struct r300_shader_semantics* fs_inputs) +{ + int i; + unsigned index; + + r300_shader_semantics_reset(fs_inputs); + + for (i = 0; i < info->num_inputs; i++) { + index = info->input_semantic_index[i]; + + switch (info->input_semantic_name[i]) { + case TGSI_SEMANTIC_COLOR: + assert(index <= ATTR_COLOR_COUNT); + fs_inputs->color[index] = i; + break; + + case TGSI_SEMANTIC_GENERIC: + assert(index <= ATTR_GENERIC_COUNT); + fs_inputs->generic[index] = i; + break; + + case TGSI_SEMANTIC_FOG: + assert(index == 0); + fs_inputs->fog = i; + break; + + default: + assert(0); + } + } +} + static void find_output_registers(struct r300_fragment_program_compiler * compiler, struct r300_fragment_shader * fs) { @@ -98,6 +133,10 @@ void r300_translate_fragment_shader(struct r300_context* r300, struct r300_fragment_program_compiler compiler; struct tgsi_to_rc ttr; + /* Initialize. */ + r300_shader_read_fs_inputs(&fs->info, &fs->inputs); + + /* Setup the compiler. */ memset(&compiler, 0, sizeof(compiler)); rc_init(&compiler.Base); compiler.Base.Debug = DBG_ON(r300, DBG_FP); @@ -107,7 +146,7 @@ void r300_translate_fragment_shader(struct r300_context* r300, compiler.AllocateHwInputs = &allocate_hardware_inputs; compiler.UserData = fs; - /* TODO: Program compilation depends on texture compare modes, + /* XXX: Program compilation depends on texture compare modes, * which are sampler state. Therefore, programs need to be recompiled * depending on this state as in the classic Mesa driver. * @@ -133,6 +172,7 @@ void r300_translate_fragment_shader(struct r300_context* r300, /* XXX failover maybe? */ DBG(r300, DBG_FP, "r300: Error compiling fragment program: %s\n", compiler.Base.ErrorMsg); + assert(0); } /* And, finally... */ diff --git a/src/gallium/drivers/r300/r300_fs.h b/src/gallium/drivers/r300/r300_fs.h index e831c30301..630e2d0c8a 100644 --- a/src/gallium/drivers/r300/r300_fs.h +++ b/src/gallium/drivers/r300/r300_fs.h @@ -1,6 +1,7 @@ /* * Copyright 2008 Corbin Simpson * Joakim Sindholt + * Copyright 2009 Marek Olšák * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -25,15 +26,16 @@ #define R300_FS_H #include "pipe/p_state.h" - #include "tgsi/tgsi_scan.h" - #include "radeon_code.h" +#include "r300_shader_semantics.h" struct r300_fragment_shader { /* Parent class */ struct pipe_shader_state state; + struct tgsi_shader_info info; + struct r300_shader_semantics inputs; /* Has this shader been translated yet? */ boolean translated; diff --git a/src/gallium/drivers/r300/r300_shader_semantics.h b/src/gallium/drivers/r300/r300_shader_semantics.h new file mode 100644 index 0000000000..85184e2cfd --- /dev/null +++ b/src/gallium/drivers/r300/r300_shader_semantics.h @@ -0,0 +1,64 @@ +/* + * Copyright 2009 Marek Olšák + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef R300_SHADER_SEMANTICS_H +#define R300_SHADER_SEMANTICS_H + +#define ATTR_UNUSED (-1) +#define ATTR_COLOR_COUNT 2 +#define ATTR_GENERIC_COUNT 16 + +/* This structure contains information about what attributes are written by VS + * or read by FS. (but not both) It's much easier to work with than + * tgsi_shader_info. + * + * The variables contain indices to tgsi_shader_info semantics and those + * indices are nothing else than input/output register numbers. */ +struct r300_shader_semantics { + int pos; + int psize; + int color[ATTR_COLOR_COUNT]; + int bcolor[ATTR_COLOR_COUNT]; + int generic[ATTR_GENERIC_COUNT]; + int fog; +}; + +static INLINE void r300_shader_semantics_reset( + struct r300_shader_semantics* info) +{ + int i; + + info->pos = ATTR_UNUSED; + info->psize = ATTR_UNUSED; + info->fog = ATTR_UNUSED; + + for (i = 0; i < ATTR_COLOR_COUNT; i++) { + info->color[i] = ATTR_UNUSED; + info->bcolor[i] = ATTR_UNUSED; + } + + for (i = 0; i < ATTR_GENERIC_COUNT; i++) { + info->generic[i] = ATTR_UNUSED; + } +} + +#endif diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 03cdba0538..cd969d633b 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -29,6 +29,7 @@ #include "r300_context.h" #include "r300_fs.h" #include "r300_screen.h" +#include "r300_shader_semantics.h" #include "r300_state_derived.h" #include "r300_state_inlines.h" #include "r300_vs.h" @@ -36,25 +37,6 @@ /* r300_state_derived: Various bits of state which are dependent upon * currently bound CSO data. */ -#define ATTR_UNUSED (-1) -#define ATTR_COLOR_COUNT 2 -#define ATTR_GENERIC_COUNT 16 - -/* This structure contains information about what attributes are written by VS - * or read by FS. (but not both) It's much easier to work with than - * tgsi_shader_info. - * - * The variables basically means used/unused and may optionally contain - * indices to tgsi_shader_info semantics which we need to know for Draw. */ -struct r300_shader_info { - int pos; - int psize; - int color[ATTR_COLOR_COUNT]; - int bcolor[ATTR_COLOR_COUNT]; - int generic[ATTR_GENERIC_COUNT]; - int fog; -}; - struct r300_shader_key { struct r300_vertex_shader* vs; struct r300_fragment_shader* fs; @@ -89,193 +71,21 @@ static void r300_draw_emit_attrib(struct r300_context* r300, struct tgsi_shader_info* info = &r300->vs->info; int output; - if (r300->draw) { - output = draw_find_vs_output(r300->draw, - info->output_semantic_name[index], - info->output_semantic_index[index]); - draw_emit_vertex_attr(&r300->vertex_info->vinfo, emit, interp, output); - } + output = draw_find_vs_output(r300->draw, + info->output_semantic_name[index], + info->output_semantic_index[index]); + draw_emit_vertex_attr(&r300->vertex_info->vinfo, emit, interp, output); } -static void r300_shader_info_reset(struct r300_shader_info* info) +static void r300_draw_emit_all_attribs(struct r300_context* r300) { - int i; - - info->pos = ATTR_UNUSED; - info->psize = ATTR_UNUSED; - info->fog = ATTR_UNUSED; - - for (i = 0; i < ATTR_COLOR_COUNT; i++) { - info->color[i] = ATTR_UNUSED; - info->bcolor[i] = ATTR_UNUSED; - } - - for (i = 0; i < ATTR_GENERIC_COUNT; i++) { - info->generic[i] = ATTR_UNUSED; - } -} - -/* Convert info about VS output semantics to r300_shader_info. */ -static void r300_shader_read_vs_outputs(struct tgsi_shader_info* info, - struct r300_shader_info* vs_outputs) -{ - int i; - unsigned index; - - r300_shader_info_reset(vs_outputs); - - for (i = 0; i < info->num_outputs; i++) { - index = info->output_semantic_index[i]; - - switch (info->output_semantic_name[i]) { - case TGSI_SEMANTIC_POSITION: - assert(index == 0); - vs_outputs->pos = i; - break; - - case TGSI_SEMANTIC_PSIZE: - assert(index == 0); - vs_outputs->psize = i; - break; - - case TGSI_SEMANTIC_COLOR: - assert(index <= ATTR_COLOR_COUNT); - vs_outputs->color[index] = i; - break; - - case TGSI_SEMANTIC_BCOLOR: - assert(index <= ATTR_COLOR_COUNT); - vs_outputs->bcolor[index] = i; - break; - - case TGSI_SEMANTIC_GENERIC: - assert(index <= ATTR_GENERIC_COUNT); - vs_outputs->generic[index] = i; - break; - - case TGSI_SEMANTIC_FOG: - assert(index == 0); - vs_outputs->fog = i; - break; - - default: - assert(0); - } - } -} - -/* Set VS output stream locations for SWTCL. */ -static void r300_stream_locations_swtcl(struct r300_shader_info* vs_outputs, - int* vs_output_tab) -{ - int i, tabi = 0, gen_count; - - /* XXX Check whether the numbers (0, 1, 2+i, etc.) are correct. - * These should go to VAP_PROG_STREAM_CNTL/DST_VEC_LOC. */ - - /* Position. */ - vs_output_tab[tabi++] = 0; - - /* Point size. */ - if (vs_outputs->psize != ATTR_UNUSED) { - vs_output_tab[tabi++] = 1; - } - - /* Colors. */ - for (i = 0; i < ATTR_COLOR_COUNT; i++) { - if (vs_outputs->color[i] != ATTR_UNUSED) { - vs_output_tab[tabi++] = 2 + i; - } - } - - /* Back-face colors. */ - for (i = 0; i < ATTR_COLOR_COUNT; i++) { - if (vs_outputs->bcolor[i] != ATTR_UNUSED) { - vs_output_tab[tabi++] = 4 + i; - } - } - - /* Texture coordinates. */ - gen_count = 0; - for (i = 0; i < ATTR_GENERIC_COUNT; i++) { - if (vs_outputs->bcolor[i] != ATTR_UNUSED) { - assert(tabi < 16); - vs_output_tab[tabi++] = 6 + gen_count; - gen_count++; - } - } - - /* Fog coordinates. */ - if (vs_outputs->fog != ATTR_UNUSED) { - assert(tabi < 16); - vs_output_tab[tabi++] = 6 + gen_count; - gen_count++; - } - - /* XXX magic */ - assert(gen_count <= 8); - - for (; tabi < 16;) { - vs_output_tab[tabi++] = -1; - } -} - -/* Convert info about FS input semantics to r300_shader_info. */ -static void r300_shader_read_fs_inputs(struct tgsi_shader_info* info, - struct r300_shader_info* fs_inputs) -{ - int i; - unsigned index; - - r300_shader_info_reset(fs_inputs); - - for (i = 0; i < info->num_inputs; i++) { - index = info->input_semantic_index[i]; - - switch (info->input_semantic_name[i]) { - case TGSI_SEMANTIC_COLOR: - assert(index <= ATTR_COLOR_COUNT); - fs_inputs->color[index] = i; - break; - - case TGSI_SEMANTIC_GENERIC: - assert(index <= ATTR_GENERIC_COUNT); - fs_inputs->generic[index] = i; - break; - - case TGSI_SEMANTIC_FOG: - assert(index == 0); - fs_inputs->fog = i; - break; - - default: - assert(0); - } - } -} - -static void r300_update_vap_output_fmt(struct r300_context* r300, - struct r300_shader_info* vs_outputs) -{ - struct vertex_info* vinfo = &r300->vertex_info->vinfo; + struct r300_shader_semantics* vs_outputs = &r300->vs->outputs; int i, gen_count; - /* Do the actual vertex_info setup. - * - * vertex_info has four uints of hardware-specific data in it. - * vinfo.hwfmt[0] is R300_VAP_VTX_STATE_CNTL - * vinfo.hwfmt[1] is R300_VAP_VSM_VTX_ASSM - * vinfo.hwfmt[2] is R300_VAP_OUTPUT_VTX_FMT_0 - * vinfo.hwfmt[3] is R300_VAP_OUTPUT_VTX_FMT_1 */ - - vinfo->hwfmt[0] = 0x5555; /* XXX this is classic Mesa bonghits */ - /* Position. */ if (vs_outputs->pos != ATTR_UNUSED) { r300_draw_emit_attrib(r300, EMIT_4F, INTERP_PERSPECTIVE, vs_outputs->pos); - vinfo->hwfmt[1] |= R300_INPUT_CNTL_POS; - vinfo->hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT; } else { assert(0); } @@ -284,7 +94,6 @@ static void r300_update_vap_output_fmt(struct r300_context* r300, if (vs_outputs->psize != ATTR_UNUSED) { r300_draw_emit_attrib(r300, EMIT_1F_PSIZE, INTERP_POS, vs_outputs->psize); - vinfo->hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT; } /* Colors. */ @@ -292,8 +101,6 @@ static void r300_update_vap_output_fmt(struct r300_context* r300, if (vs_outputs->color[i] != ATTR_UNUSED) { r300_draw_emit_attrib(r300, EMIT_4F, INTERP_LINEAR, vs_outputs->color[i]); - vinfo->hwfmt[1] |= R300_INPUT_CNTL_COLOR; - vinfo->hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << i; } } @@ -305,8 +112,6 @@ static void r300_update_vap_output_fmt(struct r300_context* r300, if (vs_outputs->generic[i] != ATTR_UNUSED) { r300_draw_emit_attrib(r300, EMIT_4F, INTERP_PERSPECTIVE, vs_outputs->generic[i]); - vinfo->hwfmt[1] |= (R300_INPUT_CNTL_TC0 << gen_count); - vinfo->hwfmt[3] |= (4 << (3 * gen_count)); gen_count++; } } @@ -315,15 +120,11 @@ static void r300_update_vap_output_fmt(struct r300_context* r300, if (vs_outputs->fog != ATTR_UNUSED) { r300_draw_emit_attrib(r300, EMIT_4F, INTERP_PERSPECTIVE, vs_outputs->fog); - vinfo->hwfmt[1] |= (R300_INPUT_CNTL_TC0 << gen_count); - vinfo->hwfmt[3] |= (4 << (3 * gen_count)); gen_count++; } /* XXX magic */ assert(gen_count <= 8); - - draw_compute_vertex_size(vinfo); } /* Update the PSC tables. */ @@ -370,14 +171,14 @@ static void r300_vertex_psc(struct r300_context* r300) } /* Update the PSC tables for SW TCL, using Draw. */ -static void r300_swtcl_vertex_psc(struct r300_context* r300, - int* vs_output_tab) +static void r300_swtcl_vertex_psc(struct r300_context* r300) { struct r300_vertex_info *vformat = r300->vertex_info; struct vertex_info* vinfo = &vformat->vinfo; uint16_t type, swizzle; enum pipe_format format; unsigned i, attrib_count; + int* vs_output_tab = r300->vs->output_stream_loc_swtcl; /* For each Draw attribute, route it to the fragment shader according * to the vs_output_tab. */ @@ -514,8 +315,8 @@ static void r500_rs_tex_write(struct r300_rs_block* rs, int id, int fp_offset) * of vertices into fragments. This is also the part of the chipset that * locks up if any part of it is even slightly wrong. */ static void r300_update_rs_block(struct r300_context* r300, - struct r300_shader_info* vs_outputs, - struct r300_shader_info* fs_inputs) + struct r300_shader_semantics* vs_outputs, + struct r300_shader_semantics* fs_inputs) { struct r300_rs_block* rs = r300->rs_block; int i, col_count = 0, tex_count = 0, fp_offset = 0; @@ -616,8 +417,6 @@ static void r300_update_rs_block(struct r300_context* r300, static void r300_update_derived_shader_state(struct r300_context* r300) { struct r300_screen* r300screen = r300_screen(r300->context.screen); - struct r300_shader_info vs_outputs, fs_inputs; - int vs_output_tab[16]; /* struct r300_shader_key* key; @@ -648,18 +447,16 @@ static void r300_update_derived_shader_state(struct r300_context* r300) /* Reset structures */ memset(r300->rs_block, 0, sizeof(struct r300_rs_block)); memset(r300->vertex_info, 0, sizeof(struct r300_vertex_info)); + memcpy(r300->vertex_info->vinfo.hwfmt, r300->vs->hwfmt, sizeof(uint)*4); - r300_shader_read_vs_outputs(&r300->vs->info, &vs_outputs); - r300_shader_read_fs_inputs(&r300->fs->info, &fs_inputs); - - r300_update_vap_output_fmt(r300, &vs_outputs); - r300_update_rs_block(r300, &vs_outputs, &fs_inputs); + r300_update_rs_block(r300, &r300->vs->outputs, &r300->fs->inputs); if (r300screen->caps->has_tcl) { r300_vertex_psc(r300); } else { - r300_stream_locations_swtcl(&vs_outputs, vs_output_tab); - r300_swtcl_vertex_psc(r300, vs_output_tab); + r300_draw_emit_all_attribs(r300); + draw_compute_vertex_size(&r300->vertex_info->vinfo); + r300_swtcl_vertex_psc(r300); } r300->dirty_state |= R300_NEW_RS_BLOCK; diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c index 74ef416dc1..49bff3e931 100644 --- a/src/gallium/drivers/r300/r300_vs.c +++ b/src/gallium/drivers/r300/r300_vs.c @@ -1,5 +1,6 @@ /* * Copyright 2009 Corbin Simpson + * Copyright 2009 Marek Olšák * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -23,13 +24,181 @@ #include "r300_vs.h" #include "r300_context.h" +#include "r300_screen.h" #include "r300_tgsi_to_rc.h" +#include "r300_reg.h" #include "tgsi/tgsi_dump.h" #include "tgsi/tgsi_parse.h" #include "radeon_compiler.h" +/* Convert info about VS output semantics into r300_shader_semantics. */ +static void r300_shader_read_vs_outputs( + struct tgsi_shader_info* info, + struct r300_shader_semantics* vs_outputs) +{ + int i; + unsigned index; + + r300_shader_semantics_reset(vs_outputs); + + for (i = 0; i < info->num_outputs; i++) { + index = info->output_semantic_index[i]; + + switch (info->output_semantic_name[i]) { + case TGSI_SEMANTIC_POSITION: + assert(index == 0); + vs_outputs->pos = i; + break; + + case TGSI_SEMANTIC_PSIZE: + assert(index == 0); + vs_outputs->psize = i; + break; + + case TGSI_SEMANTIC_COLOR: + assert(index <= ATTR_COLOR_COUNT); + vs_outputs->color[index] = i; + break; + + case TGSI_SEMANTIC_BCOLOR: + assert(index <= ATTR_COLOR_COUNT); + vs_outputs->bcolor[index] = i; + break; + + case TGSI_SEMANTIC_GENERIC: + assert(index <= ATTR_GENERIC_COUNT); + vs_outputs->generic[index] = i; + break; + + case TGSI_SEMANTIC_FOG: + assert(index == 0); + vs_outputs->fog = i; + break; + + default: + assert(0); + } + } +} + +static void r300_shader_vap_output_fmt( + struct r300_shader_semantics* vs_outputs, + uint* hwfmt) +{ + int i, gen_count; + + /* Do the actual vertex_info setup. + * + * vertex_info has four uints of hardware-specific data in it. + * vinfo.hwfmt[0] is R300_VAP_VTX_STATE_CNTL + * vinfo.hwfmt[1] is R300_VAP_VSM_VTX_ASSM + * vinfo.hwfmt[2] is R300_VAP_OUTPUT_VTX_FMT_0 + * vinfo.hwfmt[3] is R300_VAP_OUTPUT_VTX_FMT_1 */ + + hwfmt[0] = 0x5555; /* XXX this is classic Mesa bonghits */ + + /* Position. */ + if (vs_outputs->pos != ATTR_UNUSED) { + hwfmt[1] |= R300_INPUT_CNTL_POS; + hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT; + } else { + assert(0); + } + + /* Point size. */ + if (vs_outputs->psize != ATTR_UNUSED) { + hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__PT_SIZE_PRESENT; + } + + /* Colors. */ + for (i = 0; i < ATTR_COLOR_COUNT; i++) { + if (vs_outputs->color[i] != ATTR_UNUSED) { + hwfmt[1] |= R300_INPUT_CNTL_COLOR; + hwfmt[2] |= R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT << i; + } + } + + /* XXX Back-face colors. */ + + /* Texture coordinates. */ + gen_count = 0; + for (i = 0; i < ATTR_GENERIC_COUNT; i++) { + if (vs_outputs->generic[i] != ATTR_UNUSED) { + hwfmt[1] |= (R300_INPUT_CNTL_TC0 << gen_count); + hwfmt[3] |= (4 << (3 * gen_count)); + gen_count++; + } + } + + /* Fog coordinates. */ + if (vs_outputs->fog != ATTR_UNUSED) { + hwfmt[1] |= (R300_INPUT_CNTL_TC0 << gen_count); + hwfmt[3] |= (4 << (3 * gen_count)); + gen_count++; + } + + /* XXX magic */ + assert(gen_count <= 8); +} + +/* Set VS output stream locations for SWTCL. */ +static void r300_stream_locations_swtcl( + struct r300_shader_semantics* vs_outputs, + int* output_stream_loc) +{ + int i, tabi = 0, gen_count; + + /* XXX Check whether the numbers (0, 1, 2+i, etc.) are correct. + * These should go to VAP_PROG_STREAM_CNTL/DST_VEC_LOC. */ + + /* Position. */ + output_stream_loc[tabi++] = 0; + + /* Point size. */ + if (vs_outputs->psize != ATTR_UNUSED) { + output_stream_loc[tabi++] = 1; + } + + /* Colors. */ + for (i = 0; i < ATTR_COLOR_COUNT; i++) { + if (vs_outputs->color[i] != ATTR_UNUSED) { + output_stream_loc[tabi++] = 2 + i; + } + } + + /* Back-face colors. */ + for (i = 0; i < ATTR_COLOR_COUNT; i++) { + if (vs_outputs->bcolor[i] != ATTR_UNUSED) { + output_stream_loc[tabi++] = 4 + i; + } + } + + /* Texture coordinates. */ + gen_count = 0; + for (i = 0; i < ATTR_GENERIC_COUNT; i++) { + if (vs_outputs->bcolor[i] != ATTR_UNUSED) { + assert(tabi < 16); + output_stream_loc[tabi++] = 6 + gen_count; + gen_count++; + } + } + + /* Fog coordinates. */ + if (vs_outputs->fog != ATTR_UNUSED) { + assert(tabi < 16); + output_stream_loc[tabi++] = 6 + gen_count; + gen_count++; + } + + /* XXX magic */ + assert(gen_count <= 8); + + for (; tabi < 16;) { + output_stream_loc[tabi++] = -1; + } +} static void set_vertex_inputs_outputs(struct r300_vertex_program_compiler * c) { @@ -99,20 +268,27 @@ static void set_vertex_inputs_outputs(struct r300_vertex_program_compiler * c) default: debug_printf("r300: vs: Bad semantic declaration %d\n", decl->Semantic.SemanticName); - break; + assert(0); } } tgsi_parse_free(&parser); } - void r300_translate_vertex_shader(struct r300_context* r300, struct r300_vertex_shader* vs) { struct r300_vertex_program_compiler compiler; struct tgsi_to_rc ttr; + /* Initialize. */ + r300_shader_read_vs_outputs(&vs->info, &vs->outputs); + r300_shader_vap_output_fmt(&vs->outputs, vs->hwfmt); + + if (!r300_screen(r300->context.screen)->caps->has_tcl) { + r300_stream_locations_swtcl(&vs->outputs, vs->output_stream_loc_swtcl); + } + /* Setup the compiler */ rc_init(&compiler.Base); @@ -137,7 +313,7 @@ void r300_translate_vertex_shader(struct r300_context* r300, /* Invoke the compiler */ r3xx_compile_vertex_program(&compiler); if (compiler.Base.Error) { - /* Todo: Fail gracefully */ + /* XXX Fail gracefully */ fprintf(stderr, "r300 VP: Compiler error\n"); abort(); } diff --git a/src/gallium/drivers/r300/r300_vs.h b/src/gallium/drivers/r300/r300_vs.h index 00b02bf510..283dd5a9e8 100644 --- a/src/gallium/drivers/r300/r300_vs.h +++ b/src/gallium/drivers/r300/r300_vs.h @@ -1,5 +1,6 @@ /* * Copyright 2009 Corbin Simpson + * Copyright 2009 Marek Olšák * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -25,15 +26,20 @@ #include "pipe/p_state.h" #include "tgsi/tgsi_scan.h" - #include "radeon_code.h" +#include "r300_shader_semantics.h" + struct r300_context; struct r300_vertex_shader { /* Parent class */ struct pipe_shader_state state; + struct tgsi_shader_info info; + struct r300_shader_semantics outputs; + int output_stream_loc_swtcl[16]; + uint hwfmt[4]; /* Has this shader been translated yet? */ boolean translated; @@ -42,9 +48,6 @@ struct r300_vertex_shader { struct r300_vertex_program_code code; }; - -extern struct r300_vertex_program_code r300_passthrough_vertex_shader; - void r300_translate_vertex_shader(struct r300_context* r300, struct r300_vertex_shader* vs); -- cgit v1.2.3 From f55c088f89eeaa6d16480f5f373887c6a2965e21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 27 Nov 2009 06:36:31 +0100 Subject: r300g: simplify allocations of FS input registers --- src/gallium/drivers/r300/r300_fs.c | 43 +++++++++++++------------------------- 1 file changed, 15 insertions(+), 28 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c index 9cc833e606..79b01bb4dc 100644 --- a/src/gallium/drivers/r300/r300_fs.c +++ b/src/gallium/drivers/r300/r300_fs.c @@ -66,6 +66,7 @@ static void r300_shader_read_fs_inputs(struct tgsi_shader_info* info, } } + static void find_output_registers(struct r300_fragment_program_compiler * compiler, struct r300_fragment_shader * fs) { @@ -93,38 +94,24 @@ static void allocate_hardware_inputs( void (*allocate)(void * data, unsigned input, unsigned hwreg), void * mydata) { - struct tgsi_shader_info* info = &((struct r300_fragment_shader*)c->UserData)->info; - int total_colors = 0; - int colors = 0; - int total_generic = 0; - int generic = 0; - int i; - - for (i = 0; i < info->num_inputs; i++) { - switch (info->input_semantic_name[i]) { - case TGSI_SEMANTIC_COLOR: - total_colors++; - break; - case TGSI_SEMANTIC_FOG: - case TGSI_SEMANTIC_GENERIC: - total_generic++; - break; + struct r300_shader_semantics* inputs = + &((struct r300_fragment_shader*)c->UserData)->inputs; + int i, reg = 0; + + /* Allocate input registers. */ + for (i = 0; i < ATTR_COLOR_COUNT; i++) { + if (inputs->color[i] != ATTR_UNUSED) { + allocate(mydata, inputs->color[i], reg++); } } - - for(i = 0; i < info->num_inputs; i++) { - switch (info->input_semantic_name[i]) { - case TGSI_SEMANTIC_COLOR: - allocate(mydata, i, colors); - colors++; - break; - case TGSI_SEMANTIC_FOG: - case TGSI_SEMANTIC_GENERIC: - allocate(mydata, i, total_colors + generic); - generic++; - break; + for (i = 0; i < ATTR_GENERIC_COUNT; i++) { + if (inputs->generic[i] != ATTR_UNUSED) { + allocate(mydata, inputs->generic[i], reg++); } } + if (inputs->fog != ATTR_UNUSED) { + allocate(mydata, inputs->fog, reg++); + } } void r300_translate_fragment_shader(struct r300_context* r300, -- cgit v1.2.3 From af3dea36603687067197c22747537eaeb6c4ad2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 27 Nov 2009 10:19:20 +0100 Subject: r300g: simplify allocations of VS output registers No need to parse TGSI tokens since it's easier to walk through shader semantics. Also fog coordinates now work reliably. --- src/gallium/drivers/r300/r300_vs.c | 82 ++++++++++++-------------------------- 1 file changed, 26 insertions(+), 56 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c index 49bff3e931..31248346bc 100644 --- a/src/gallium/drivers/r300/r300_vs.c +++ b/src/gallium/drivers/r300/r300_vs.c @@ -203,76 +203,46 @@ static void r300_stream_locations_swtcl( static void set_vertex_inputs_outputs(struct r300_vertex_program_compiler * c) { struct r300_vertex_shader * vs = c->UserData; + struct r300_shader_semantics* outputs = &vs->outputs; struct tgsi_shader_info* info = &vs->info; - struct tgsi_parse_context parser; - struct tgsi_full_declaration * decl; - boolean pointsize = FALSE; - int out_colors = 0; - int colors = 0; - int out_generic = 0; - int generic = 0; - int i; + int i, reg = 0; /* Fill in the input mapping */ for (i = 0; i < info->num_inputs; i++) c->code->inputs[i] = i; - /* Fill in the output mapping */ - for (i = 0; i < info->num_outputs; i++) { - switch (info->output_semantic_name[i]) { - case TGSI_SEMANTIC_PSIZE: - pointsize = TRUE; - break; - case TGSI_SEMANTIC_COLOR: - out_colors++; - break; - case TGSI_SEMANTIC_FOG: - case TGSI_SEMANTIC_GENERIC: - out_generic++; - break; - } + /* Position. */ + if (outputs->pos != ATTR_UNUSED) { + c->code->outputs[outputs->pos] = reg++; + } else { + assert(0); } - tgsi_parse_init(&parser, vs->state.tokens); - - while (!tgsi_parse_end_of_tokens(&parser)) { - tgsi_parse_token(&parser); - - if (parser.FullToken.Token.Type != TGSI_TOKEN_TYPE_DECLARATION) - continue; + /* Point size. */ + if (outputs->psize != ATTR_UNUSED) { + c->code->outputs[outputs->psize] = reg++; + } - decl = &parser.FullToken.FullDeclaration; + /* Colors. */ + for (i = 0; i < ATTR_COLOR_COUNT; i++) { + if (outputs->color[i] != ATTR_UNUSED) { + c->code->outputs[outputs->color[i]] = reg++; + } + } - if (decl->Declaration.File != TGSI_FILE_OUTPUT) - continue; + /* XXX Back-face colors. */ - switch (decl->Semantic.SemanticName) { - case TGSI_SEMANTIC_POSITION: - c->code->outputs[decl->DeclarationRange.First] = 0; - break; - case TGSI_SEMANTIC_PSIZE: - c->code->outputs[decl->DeclarationRange.First] = 1; - break; - case TGSI_SEMANTIC_COLOR: - c->code->outputs[decl->DeclarationRange.First] = 1 + - (pointsize ? 1 : 0) + - colors++; - break; - case TGSI_SEMANTIC_FOG: - case TGSI_SEMANTIC_GENERIC: - c->code->outputs[decl->DeclarationRange.First] = 1 + - (pointsize ? 1 : 0) + - out_colors + - generic++; - break; - default: - debug_printf("r300: vs: Bad semantic declaration %d\n", - decl->Semantic.SemanticName); - assert(0); + /* Texture coordinates. */ + for (i = 0; i < ATTR_GENERIC_COUNT; i++) { + if (outputs->generic[i] != ATTR_UNUSED) { + c->code->outputs[outputs->generic[i]] = reg++; } } - tgsi_parse_free(&parser); + /* Fog coordinates. */ + if (outputs->fog != ATTR_UNUSED) { + c->code->outputs[outputs->fog] = reg++; + } } void r300_translate_vertex_shader(struct r300_context* r300, -- cgit v1.2.3 From 853d4807fe220b17cf5af5a76b24f2466238013b Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 1 Dec 2009 11:19:33 +0100 Subject: mesa: Update vertex texture code after gallium changes. --- src/mesa/drivers/dri/i965/brw_context.c | 1 + src/mesa/main/context.c | 1 + src/mesa/main/get.c | 8 ++++---- src/mesa/main/get_gen.py | 2 +- src/mesa/main/mtypes.h | 1 + src/mesa/state_tracker/st_atom_sampler.c | 9 +++++++++ src/mesa/state_tracker/st_atom_texture.c | 8 ++++++++ src/mesa/state_tracker/st_extensions.c | 4 ++++ 8 files changed, 29 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 48685c087b..8bdda60697 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -111,6 +111,7 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis, ctx->Const.MaxTextureUnits = MIN2(ctx->Const.MaxTextureCoordUnits, ctx->Const.MaxTextureImageUnits); ctx->Const.MaxVertexTextureImageUnits = 0; /* no vertex shader textures */ + ctx->Const.MaxCombinedTextureImageUnits = 0; /* Mesa limits textures to 4kx4k; it would be nice to fix that someday */ diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index b5bf46718f..03fc57e665 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -575,6 +575,7 @@ _mesa_init_constants(GLcontext *ctx) #if FEATURE_ARB_vertex_shader ctx->Const.MaxVertexTextureImageUnits = MAX_VERTEX_TEXTURE_IMAGE_UNITS; + ctx->Const.MaxCombinedTextureImageUnits = MAX_COMBINED_TEXTURE_IMAGE_UNITS; ctx->Const.MaxVarying = MAX_VARYING; #endif diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 6c5ce02913..e8932f83b6 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -1876,7 +1876,7 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(MAX_COMBINED_TEXTURE_IMAGE_UNITS); + params[0] = INT_TO_BOOLEAN(ctx->Const.MaxCombinedTextureImageUnits); break; case GL_CURRENT_PROGRAM: CHECK_EXT1(ARB_shader_objects, "GetBooleanv"); @@ -3711,7 +3711,7 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetFloatv"); - params[0] = (GLfloat)(MAX_COMBINED_TEXTURE_IMAGE_UNITS); + params[0] = (GLfloat)(ctx->Const.MaxCombinedTextureImageUnits); break; case GL_CURRENT_PROGRAM: CHECK_EXT1(ARB_shader_objects, "GetFloatv"); @@ -5546,7 +5546,7 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetIntegerv"); - params[0] = MAX_COMBINED_TEXTURE_IMAGE_UNITS; + params[0] = ctx->Const.MaxCombinedTextureImageUnits; break; case GL_CURRENT_PROGRAM: CHECK_EXT1(ARB_shader_objects, "GetIntegerv"); @@ -7382,7 +7382,7 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB: CHECK_EXT1(ARB_vertex_shader, "GetInteger64v"); - params[0] = (GLint64)(MAX_COMBINED_TEXTURE_IMAGE_UNITS); + params[0] = (GLint64)(ctx->Const.MaxCombinedTextureImageUnits); break; case GL_CURRENT_PROGRAM: CHECK_EXT1(ARB_shader_objects, "GetInteger64v"); diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py index 930c3362fa..a29962d334 100644 --- a/src/mesa/main/get_gen.py +++ b/src/mesa/main/get_gen.py @@ -1006,7 +1006,7 @@ StateVars = [ ( "GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB", GLint, ["ctx->Const.MaxVertexTextureImageUnits"], "", ["ARB_vertex_shader"] ), ( "GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB", GLint, - ["MAX_COMBINED_TEXTURE_IMAGE_UNITS"], "", ["ARB_vertex_shader"] ), + ["ctx->Const.MaxCombinedTextureImageUnits"], "", ["ARB_vertex_shader"] ), # GL_ARB_shader_objects # Actually, this token isn't part of GL_ARB_shader_objects, but is diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 881d233ca3..5f01244827 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2319,6 +2319,7 @@ struct gl_constants GLuint MaxTextureCoordUnits; GLuint MaxTextureImageUnits; GLuint MaxVertexTextureImageUnits; + GLuint MaxCombinedTextureImageUnits; GLuint MaxTextureUnits; /**< = MIN(CoordUnits, ImageUnits) */ GLfloat MaxTextureMaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */ GLfloat MaxTextureLodBias; /**< GL_EXT_texture_lod_bias */ diff --git a/src/mesa/state_tracker/st_atom_sampler.c b/src/mesa/state_tracker/st_atom_sampler.c index 6611956ae8..d6e3a3e561 100644 --- a/src/mesa/state_tracker/st_atom_sampler.c +++ b/src/mesa/state_tracker/st_atom_sampler.c @@ -229,14 +229,23 @@ update_samplers(struct st_context *st) /*printf("%s su=%u non-null\n", __FUNCTION__, su);*/ cso_single_sampler(st->cso_context, su, sampler); + if (su < st->ctx->Const.MaxVertexTextureImageUnits) { + cso_single_vertex_sampler(st->cso_context, su, sampler); + } } else { /*printf("%s su=%u null\n", __FUNCTION__, su);*/ cso_single_sampler(st->cso_context, su, NULL); + if (su < st->ctx->Const.MaxVertexTextureImageUnits) { + cso_single_vertex_sampler(st->cso_context, su, NULL); + } } } cso_single_sampler_done(st->cso_context); + if (st->ctx->Const.MaxVertexTextureImageUnits > 0) { + cso_single_vertex_sampler_done(st->cso_context); + } } diff --git a/src/mesa/state_tracker/st_atom_texture.c b/src/mesa/state_tracker/st_atom_texture.c index 4d4f97da7e..0b68447d21 100644 --- a/src/mesa/state_tracker/st_atom_texture.c +++ b/src/mesa/state_tracker/st_atom_texture.c @@ -32,6 +32,8 @@ */ +#include "main/macros.h" + #include "st_context.h" #include "st_atom.h" #include "st_texture.h" @@ -99,6 +101,12 @@ update_textures(struct st_context *st) cso_set_sampler_textures(st->cso_context, st->state.num_textures, st->state.sampler_texture); + if (st->ctx->Const.MaxVertexTextureImageUnits > 0) { + cso_set_vertex_sampler_textures(st->cso_context, + MIN2(st->state.num_textures, + st->ctx->Const.MaxVertexTextureImageUnits), + st->state.sampler_texture); + } } diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 57fe72d76a..ef3cbc53ee 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -92,6 +92,10 @@ void st_init_limits(struct st_context *st) = _min(screen->get_param(screen, PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS), MAX_VERTEX_TEXTURE_IMAGE_UNITS); + c->MaxCombinedTextureImageUnits + = _min(screen->get_param(screen, PIPE_CAP_MAX_COMBINED_SAMPLERS), + MAX_COMBINED_TEXTURE_IMAGE_UNITS); + c->MaxTextureCoordUnits = _min(c->MaxTextureImageUnits, MAX_TEXTURE_COORD_UNITS); -- cgit v1.2.3 From b7f94c9002bd8578e89ce02a22172545ace353a3 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 1 Dec 2009 14:54:32 +0000 Subject: st/xorg: fix merge droppings These were stranded in emacs and not saved before committing. --- src/gallium/state_trackers/xorg/xorg_exa.c | 4 -- src/gallium/state_trackers/xorg/xorg_renderer.c | 64 ------------------------- 2 files changed, 68 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_exa.c b/src/gallium/state_trackers/xorg/xorg_exa.c index 16e683019c..aa46cd45f1 100644 --- a/src/gallium/state_trackers/xorg/xorg_exa.c +++ b/src/gallium/state_trackers/xorg/xorg_exa.c @@ -283,13 +283,9 @@ ExaPrepareAccess(PixmapPtr pPix, int index) PIPE_TRANSFER_MAP_DIRECTLY | #endif PIPE_TRANSFER_READ_WRITE, -<<<<<<< HEAD:src/gallium/state_trackers/xorg/xorg_exa.c - 0, 0, priv->tex->width0, priv->tex->height0); -======= 0, 0, pPix->drawable.width, pPix->drawable.height ); ->>>>>>> origin/mesa_7_7_branch:src/gallium/state_trackers/xorg/xorg_exa.c if (!priv->map_transfer) #ifdef EXA_MIXED_PIXMAPS return FALSE; diff --git a/src/gallium/state_trackers/xorg/xorg_renderer.c b/src/gallium/state_trackers/xorg/xorg_renderer.c index 8f73ec5fe1..f777395100 100644 --- a/src/gallium/state_trackers/xorg/xorg_renderer.c +++ b/src/gallium/state_trackers/xorg/xorg_renderer.c @@ -559,69 +559,6 @@ void renderer_copy_pixmap(struct xorg_renderer *r, float s0, t0, s1, t1; float x0, y0, x1, y1; -<<<<<<< HEAD:src/gallium/state_trackers/xorg/xorg_renderer.c - if (r->pipe->is_texture_referenced(r->pipe, src, 0, 0) & - PIPE_REFERENCED_FOR_WRITE) - r->pipe->flush(r->pipe, PIPE_FLUSH_RENDER_CACHE, NULL); - - dst_loc[0] = dx; - dst_loc[1] = dy; - dst_loc[2] = width; - dst_loc[3] = height; - dst_bounds[0] = 0.f; - dst_bounds[1] = 0.f; - dst_bounds[2] = dst->width0; - dst_bounds[3] = dst->height0; - - src_loc[0] = sx; - src_loc[1] = sy; - src_loc[2] = width; - src_loc[3] = height; - src_bounds[0] = 0.f; - src_bounds[1] = 0.f; - src_bounds[2] = src->width0; - src_bounds[3] = src->height0; - - bound_rect(src_loc, src_bounds, src_shift); - bound_rect(dst_loc, dst_bounds, dst_shift); - shift[0] = src_shift[0] - dst_shift[0]; - shift[1] = src_shift[1] - dst_shift[1]; - - if (shift[0] < 0) - shift_rectx(src_loc, src_bounds, -shift[0]); - else - shift_rectx(dst_loc, dst_bounds, shift[0]); - - if (shift[1] < 0) - shift_recty(src_loc, src_bounds, -shift[1]); - else - shift_recty(dst_loc, dst_bounds, shift[1]); - - sync_size(src_loc, dst_loc); - - if (src_loc[2] >= 0 && src_loc[3] >= 0 && - dst_loc[2] >= 0 && dst_loc[3] >= 0) { - struct pipe_texture *temp_src = src; - - if (src == dst) - temp_src = create_sampler_texture(r, src); - - renderer_copy_texture(r, - temp_src, - src_loc[0], - src_loc[1], - src_loc[0] + src_loc[2], - src_loc[1] + src_loc[3], - dst, - dst_loc[0], - dst_loc[1], - dst_loc[0] + dst_loc[2], - dst_loc[1] + dst_loc[3]); - - if (src == dst) - pipe_texture_reference(&temp_src, NULL); - } -======= /* XXX: could put the texcoord scaling calculation into the vertex * shader. @@ -642,7 +579,6 @@ void renderer_copy_pixmap(struct xorg_renderer *r, add_vertex_1tex(r, x1, y0, s1, t0); add_vertex_1tex(r, x1, y1, s1, t1); add_vertex_1tex(r, x0, y1, s0, t1); ->>>>>>> origin/mesa_7_7_branch:src/gallium/state_trackers/xorg/xorg_renderer.c } -- cgit v1.2.3 From 574715d8368f99c0a5720a9676385d58d6cfdf30 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Tue, 1 Dec 2009 15:01:00 +0000 Subject: tgsi: fix ureg emit after version token change --- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 080bdb5145..fb4b5fa868 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -1053,7 +1053,7 @@ static void copy_instructions( struct ureg_program *ureg ) static void fixup_header_size(struct ureg_program *ureg) { - union tgsi_any_token *out = retrieve_token( ureg, DOMAIN_DECL, 1 ); + union tgsi_any_token *out = retrieve_token( ureg, DOMAIN_DECL, 0 ); out->header.BodySize = ureg->domain[DOMAIN_DECL].count - 3; } -- cgit v1.2.3 From 8c26cefec7ad52c4fa52fd1a89e18f463b85257b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 30 Nov 2009 08:41:37 -0700 Subject: st/mesa: updated emit_swz() comment --- src/mesa/state_tracker/st_mesa_to_tgsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 3d6c215819..bd94c9d79e 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -278,7 +278,7 @@ static struct ureg_src swizzle_4v( struct ureg_src src, /** - * Translate SWZ instructions into a single MAD. EG: + * Translate a SWZ instruction into a MOV, MUL or MAD instruction. EG: * * SWZ dst, src.x-y10 * -- cgit v1.2.3 From c8cdce665790263bb2142d894a81c87abc4da9fb Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 1 Dec 2009 13:26:15 -0700 Subject: vbo: make flush recursion check code per-context This fixes invalid failed assertions when running multi-threaded apps. --- src/mesa/vbo/vbo_exec.h | 4 ++++ src/mesa/vbo/vbo_exec_api.c | 11 ++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h index 0a05b8df89..98c1f363d9 100644 --- a/src/mesa/vbo/vbo_exec.h +++ b/src/mesa/vbo/vbo_exec.h @@ -138,6 +138,10 @@ struct vbo_exec_context */ const struct gl_client_array *inputs[VERT_ATTRIB_MAX]; } array; + +#ifdef DEBUG + GLint flush_call_depth; +#endif }; diff --git a/src/mesa/vbo/vbo_exec_api.c b/src/mesa/vbo/vbo_exec_api.c index c90565eae8..f0a7eeadd0 100644 --- a/src/mesa/vbo/vbo_exec_api.c +++ b/src/mesa/vbo/vbo_exec_api.c @@ -876,9 +876,8 @@ void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags ) #ifdef DEBUG /* debug check: make sure we don't get called recursively */ - static GLuint callDepth = 0; - callDepth++; - assert(callDepth == 1); + exec->flush_call_depth++; + assert(exec->flush_call_depth == 1); #endif if (0) _mesa_printf("%s\n", __FUNCTION__); @@ -886,7 +885,8 @@ void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags ) if (exec->ctx->Driver.CurrentExecPrimitive != PRIM_OUTSIDE_BEGIN_END) { if (0) _mesa_printf("%s - inside begin/end\n", __FUNCTION__); #ifdef DEBUG - callDepth--; + exec->flush_call_depth--; + assert(exec->flush_call_depth == 0); #endif return; } @@ -903,7 +903,8 @@ void vbo_exec_FlushVertices( GLcontext *ctx, GLuint flags ) exec->ctx->Driver.NeedFlush &= ~flags; #ifdef DEBUG - callDepth--; + exec->flush_call_depth--; + assert(exec->flush_call_depth == 0); #endif } -- cgit v1.2.3 From e84dddde9b6eb7727760814ae211c95218bb28a3 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 2 Dec 2009 11:01:19 +1000 Subject: Revert "radeon/r300: no need to flush the cmdbuf when changing scissors state in KMM mode" This reverts commit 286bf89e5a1fc931dbf523ded861b809859485e2. This doesn't appear to be correct, regression so revert it. http://bugs.freedesktop.org/show_bug.cgi?id=25193 --- src/mesa/drivers/dri/r300/r300_state.c | 3 +-- src/mesa/drivers/dri/radeon/radeon_common.c | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index 1fd32d497b..ac20c08e20 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -1741,8 +1741,7 @@ static void r300Enable(GLcontext * ctx, GLenum cap, GLboolean state) r300SetPolygonOffsetState(ctx, state); break; case GL_SCISSOR_TEST: - if (!rmesa->radeon.radeonScreen->kernel_mm) - radeon_firevertices(&rmesa->radeon); + radeon_firevertices(&rmesa->radeon); rmesa->radeon.state.scissor.enabled = state; radeonUpdateScissor( ctx ); break; diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index 3b4366aa61..184287aa44 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -257,9 +257,7 @@ void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h) radeonContextPtr radeon = RADEON_CONTEXT(ctx); if (ctx->Scissor.Enabled) { /* We don't pipeline cliprect changes */ - if (!radeon->radeonScreen->kernel_mm) { - radeon_firevertices(radeon); - } + radeon_firevertices(radeon); radeonUpdateScissor(ctx); } } -- cgit v1.2.3 From b2581dcab41c142c38f2e065c4348cb892931c48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Wed, 2 Dec 2009 17:05:20 +0000 Subject: wgl: Call st_swapbuffers instead of st_notify_swapbuffers. This will get single buffer, double buffer, and joint single/double buffer (typical in CAD applications) done right, at least as far as the frambuffer is concerned. There are still problems with multiple contexts using the same framebuffer because st_framebuffer_* calls assume the framebuffer is bound to a single context. --- src/gallium/state_trackers/wgl/stw_device.c | 14 +---------- src/gallium/state_trackers/wgl/stw_framebuffer.c | 31 ++++++------------------ src/gallium/state_trackers/wgl/stw_framebuffer.h | 3 ++- 3 files changed, 10 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/wgl/stw_device.c b/src/gallium/state_trackers/wgl/stw_device.c index 985b8f0456..7785aba467 100644 --- a/src/gallium/state_trackers/wgl/stw_device.c +++ b/src/gallium/state_trackers/wgl/stw_device.c @@ -72,19 +72,7 @@ stw_flush_frontbuffer(struct pipe_screen *screen, return; } -#if DEBUG - { - /* ensure that a random surface was not passed to us */ - struct pipe_surface *surface2; - - if(!st_get_framebuffer_surface( fb->stfb, ST_SURFACE_FRONT_LEFT, &surface2 )) - assert(0); - else - assert(surface2 == surface); - } -#endif - - stw_framebuffer_present_locked(hdc, fb, ST_SURFACE_FRONT_LEFT); + stw_framebuffer_present_locked(hdc, fb, surface); } diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.c b/src/gallium/state_trackers/wgl/stw_framebuffer.c index 8a3e11b6b4..6d09501981 100644 --- a/src/gallium/state_trackers/wgl/stw_framebuffer.c +++ b/src/gallium/state_trackers/wgl/stw_framebuffer.c @@ -475,8 +475,6 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data) struct stw_framebuffer *fb; struct pipe_screen *screen; struct pipe_surface *surface; - unsigned surface_index; - BOOL ret = FALSE; fb = stw_framebuffer_from_hdc( hdc ); if (fb == NULL) @@ -484,9 +482,7 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data) screen = stw_dev->screen; - surface_index = (unsigned)(uintptr_t)data->pPrivateData; - if(!st_get_framebuffer_surface( fb->stfb, surface_index, &surface )) - goto fail; + surface = (struct pipe_surface *)data->pPrivateData; #ifdef DEBUG if(stw_dev->trace_running) { @@ -520,15 +516,11 @@ DrvPresentBuffers(HDC hdc, PGLPRESENTBUFFERSDATA data) stw_dev->stw_winsys->present( screen, surface, hdc ); } - ret = TRUE; - -fail: - stw_framebuffer_update(fb); stw_framebuffer_release(fb); - return ret; + return TRUE; } @@ -540,7 +532,7 @@ fail: BOOL stw_framebuffer_present_locked(HDC hdc, struct stw_framebuffer *fb, - unsigned surface_index) + struct pipe_surface *surface) { if(stw_dev->callbacks.wglCbPresentBuffers && stw_dev->stw_winsys->compose) { @@ -551,7 +543,7 @@ stw_framebuffer_present_locked(HDC hdc, data.magic2 = 0; data.AdapterLuid = stw_dev->AdapterLuid; data.rect = fb->client_rect; - data.pPrivateData = (void *)(uintptr_t)surface_index; + data.pPrivateData = (void *)surface; stw_framebuffer_release(fb); @@ -559,13 +551,6 @@ stw_framebuffer_present_locked(HDC hdc, } else { struct pipe_screen *screen = stw_dev->screen; - struct pipe_surface *surface; - - if(!st_get_framebuffer_surface( fb->stfb, surface_index, &surface )) { - /* FIXME: this shouldn't happen, but does on glean */ - stw_framebuffer_release(fb); - return FALSE; - } #ifdef DEBUG if(stw_dev->trace_running) { @@ -590,6 +575,7 @@ DrvSwapBuffers( HDC hdc ) { struct stw_framebuffer *fb; + struct pipe_surface *surface = NULL; fb = stw_framebuffer_from_hdc( hdc ); if (fb == NULL) @@ -600,12 +586,9 @@ DrvSwapBuffers( return TRUE; } - /* If we're swapping the buffer associated with the current context - * we have to flush any pending rendering commands first. - */ - st_notify_swapbuffers( fb->stfb ); + st_swapbuffers(fb->stfb, &surface, NULL); - return stw_framebuffer_present_locked(hdc, fb, ST_SURFACE_BACK_LEFT); + return stw_framebuffer_present_locked(hdc, fb, surface); } diff --git a/src/gallium/state_trackers/wgl/stw_framebuffer.h b/src/gallium/state_trackers/wgl/stw_framebuffer.h index 5afbe74908..b80d168a7c 100644 --- a/src/gallium/state_trackers/wgl/stw_framebuffer.h +++ b/src/gallium/state_trackers/wgl/stw_framebuffer.h @@ -34,6 +34,7 @@ #include "pipe/p_thread.h" +struct pipe_surface; struct stw_pixelformat_info; /** @@ -140,7 +141,7 @@ stw_framebuffer_allocate( BOOL stw_framebuffer_present_locked(HDC hdc, struct stw_framebuffer *fb, - unsigned surface_index); + struct pipe_surface *surface); void stw_framebuffer_update( -- cgit v1.2.3 From a7e4a311e971005f7b23572ff3ca93f6d3c17edf Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 2 Dec 2009 11:56:18 -0800 Subject: intel: Fix more front-buffer rendering after Brian's less flushing patch. bcbfda71b03303d3f008a6f3cf8cb7d9667bf8d2 left out many blit paths. This fixes up more of them to get Blender to work again. Bug #25030. --- src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 2 ++ src/mesa/drivers/dri/intel/intel_pixel_copy.c | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index 99330b6ddf..204a233173 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -336,6 +336,8 @@ out: unpack->BufferObj); } + intel_check_front_buffer_rendering(intel); + return GL_TRUE; } diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c b/src/mesa/drivers/dri/intel/intel_pixel_copy.c index f058b3c8e4..622aaa22d6 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c @@ -222,6 +222,8 @@ do_blit_copypixels(GLcontext * ctx, out: UNLOCK_HARDWARE(intel); + intel_check_front_buffer_rendering(intel); + DBG("%s: success\n", __FUNCTION__); return GL_TRUE; } -- cgit v1.2.3 From 9077ddaa2557e1e76c8a052c8d079ef3d443186b Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Wed, 25 Nov 2009 00:33:43 +0100 Subject: svga: Add header files for overlay support --- src/gallium/drivers/svga/include/svga_escape.h | 89 +++++++++++ src/gallium/drivers/svga/include/svga_overlay.h | 201 ++++++++++++++++++++++++ 2 files changed, 290 insertions(+) create mode 100644 src/gallium/drivers/svga/include/svga_escape.h create mode 100644 src/gallium/drivers/svga/include/svga_overlay.h (limited to 'src') diff --git a/src/gallium/drivers/svga/include/svga_escape.h b/src/gallium/drivers/svga/include/svga_escape.h new file mode 100644 index 0000000000..7b85e9b8c8 --- /dev/null +++ b/src/gallium/drivers/svga/include/svga_escape.h @@ -0,0 +1,89 @@ +/********************************************************** + * Copyright 2007-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, 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. + * + **********************************************************/ + +/* + * svga_escape.h -- + * + * Definitions for our own (vendor-specific) SVGA Escape commands. + */ + +#ifndef _SVGA_ESCAPE_H_ +#define _SVGA_ESCAPE_H_ + + +/* + * Namespace IDs for the escape command + */ + +#define SVGA_ESCAPE_NSID_VMWARE 0x00000000 +#define SVGA_ESCAPE_NSID_DEVEL 0xFFFFFFFF + + +/* + * Within SVGA_ESCAPE_NSID_VMWARE, we multiplex commands according to + * the first DWORD of escape data (after the nsID and size). As a + * guideline we're using the high word and low word as a major and + * minor command number, respectively. + * + * Major command number allocation: + * + * 0000: Reserved + * 0001: SVGA_ESCAPE_VMWARE_LOG (svga_binary_logger.h) + * 0002: SVGA_ESCAPE_VMWARE_VIDEO (svga_overlay.h) + * 0003: SVGA_ESCAPE_VMWARE_HINT (svga_escape.h) + */ + +#define SVGA_ESCAPE_VMWARE_MAJOR_MASK 0xFFFF0000 + + +/* + * SVGA Hint commands. + * + * These escapes let the SVGA driver provide optional information to + * he host about the state of the guest or guest applications. The + * host can use these hints to make user interface or performance + * decisions. + * + * Notes: + * + * - SVGA_ESCAPE_VMWARE_HINT_FULLSCREEN is deprecated for guests + * that use the SVGA Screen Object extension. Instead of sending + * this escape, use the SVGA_SCREEN_FULLSCREEN_HINT flag on your + * Screen Object. + */ + +#define SVGA_ESCAPE_VMWARE_HINT 0x00030000 +#define SVGA_ESCAPE_VMWARE_HINT_FULLSCREEN 0x00030001 // Deprecated + +typedef +struct { + uint32 command; + uint32 fullscreen; + struct { + int32 x, y; + } monitorPosition; +} SVGAEscapeHintFullscreen; + +#endif /* _SVGA_ESCAPE_H_ */ diff --git a/src/gallium/drivers/svga/include/svga_overlay.h b/src/gallium/drivers/svga/include/svga_overlay.h new file mode 100644 index 0000000000..82c1d3ff3e --- /dev/null +++ b/src/gallium/drivers/svga/include/svga_overlay.h @@ -0,0 +1,201 @@ +/********************************************************** + * Copyright 2007-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, 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. + * + **********************************************************/ + +/* + * svga_overlay.h -- + * + * Definitions for video-overlay support. + */ + +#ifndef _SVGA_OVERLAY_H_ +#define _SVGA_OVERLAY_H_ + +#include "svga_reg.h" + +/* + * Video formats we support + */ + +#define VMWARE_FOURCC_YV12 0x32315659 // 'Y' 'V' '1' '2' +#define VMWARE_FOURCC_YUY2 0x32595559 // 'Y' 'U' 'Y' '2' +#define VMWARE_FOURCC_UYVY 0x59565955 // 'U' 'Y' 'V' 'Y' + +typedef enum { + SVGA_OVERLAY_FORMAT_INVALID = 0, + SVGA_OVERLAY_FORMAT_YV12 = VMWARE_FOURCC_YV12, + SVGA_OVERLAY_FORMAT_YUY2 = VMWARE_FOURCC_YUY2, + SVGA_OVERLAY_FORMAT_UYVY = VMWARE_FOURCC_UYVY, +} SVGAOverlayFormat; + +#define SVGA_VIDEO_COLORKEY_MASK 0x00ffffff + +#define SVGA_ESCAPE_VMWARE_VIDEO 0x00020000 + +#define SVGA_ESCAPE_VMWARE_VIDEO_SET_REGS 0x00020001 + /* FIFO escape layout: + * Type, Stream Id, (Register Id, Value) pairs */ + +#define SVGA_ESCAPE_VMWARE_VIDEO_FLUSH 0x00020002 + /* FIFO escape layout: + * Type, Stream Id */ + +typedef +struct SVGAEscapeVideoSetRegs { + struct { + uint32 cmdType; + uint32 streamId; + } header; + + // May include zero or more items. + struct { + uint32 registerId; + uint32 value; + } items[1]; +} SVGAEscapeVideoSetRegs; + +typedef +struct SVGAEscapeVideoFlush { + uint32 cmdType; + uint32 streamId; +} SVGAEscapeVideoFlush; + + +/* + * Struct definitions for the video overlay commands built on + * SVGAFifoCmdEscape. + */ +typedef +struct { + uint32 command; + uint32 overlay; +} SVGAFifoEscapeCmdVideoBase; + +typedef +struct { + SVGAFifoEscapeCmdVideoBase videoCmd; +} SVGAFifoEscapeCmdVideoFlush; + +typedef +struct { + SVGAFifoEscapeCmdVideoBase videoCmd; + struct { + uint32 regId; + uint32 value; + } items[1]; +} SVGAFifoEscapeCmdVideoSetRegs; + +typedef +struct { + SVGAFifoEscapeCmdVideoBase videoCmd; + struct { + uint32 regId; + uint32 value; + } items[SVGA_VIDEO_NUM_REGS]; +} SVGAFifoEscapeCmdVideoSetAllRegs; + + +/* + *---------------------------------------------------------------------- + * + * VMwareVideoGetAttributes -- + * + * Computes the size, pitches and offsets for YUV frames. + * + * Results: + * TRUE on success; otherwise FALSE on failure. + * + * Side effects: + * Pitches and offsets for the given YUV frame are put in 'pitches' + * and 'offsets' respectively. They are both optional though. + * + *---------------------------------------------------------------------- + */ + +static INLINE Bool +VMwareVideoGetAttributes(const SVGAOverlayFormat format, // IN + uint32 *width, // IN / OUT + uint32 *height, // IN / OUT + uint32 *size, // OUT + uint32 *pitches, // OUT (optional) + uint32 *offsets) // OUT (optional) +{ + int tmp; + + *width = (*width + 1) & ~1; + + if (offsets) { + offsets[0] = 0; + } + + switch (format) { + case VMWARE_FOURCC_YV12: + *height = (*height + 1) & ~1; + *size = (*width + 3) & ~3; + + if (pitches) { + pitches[0] = *size; + } + + *size *= *height; + + if (offsets) { + offsets[1] = *size; + } + + tmp = ((*width >> 1) + 3) & ~3; + + if (pitches) { + pitches[1] = pitches[2] = tmp; + } + + tmp *= (*height >> 1); + *size += tmp; + + if (offsets) { + offsets[2] = *size; + } + + *size += tmp; + break; + + case VMWARE_FOURCC_YUY2: + case VMWARE_FOURCC_UYVY: + *size = *width * 2; + + if (pitches) { + pitches[0] = *size; + } + + *size *= *height; + break; + + default: + return FALSE; + } + + return TRUE; +} + +#endif // _SVGA_OVERLAY_H_ -- cgit v1.2.3 From 232e59ca6fe678ac370ee5a45bc31e6f7f3e6bcf Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 1 Dec 2009 17:00:43 +0100 Subject: vmware/core: Update vmwgfx_drm.h to latest version --- src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h | 66 ++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h b/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h index 6705dd4289..6bf3183ff5 100644 --- a/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h +++ b/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h @@ -45,7 +45,7 @@ #define DRM_VMW_UNREF_DMABUF 10 #define DRM_VMW_FIFO_DEBUG 11 #define DRM_VMW_FENCE_WAIT 12 - +#define DRM_VMW_OVERLAY 13 /*************************************************************************/ /** @@ -439,4 +439,68 @@ struct drm_vmw_fence_wait_arg { int32_t pad64; }; +/*************************************************************************/ +/** + * DRM_VMW_OVERLAY - Control overlays. + * + * This IOCTL controls the overlay units of the svga device. + * The SVGA overlay units does not work like regular hardware units in + * that they do not automaticaly read back the contents of the given dma + * buffer. But instead only read back for each call to this ioctl, and + * at any point between this call being made and a following call that + * either changes the buffer or disables the stream. + */ + +/** + * struct drm_vmw_rect + * + * Defines a rectangle. Used in the overlay ioctl to define + * source and destination rectangle. + */ + +struct drm_vmw_rect { + int32_t x; + int32_t y; + uint32_t w; + uint32_t h; +}; + +/** + * struct drm_vmw_overlay_arg + * + * @stream_id: Stearm to control + * @enabled: If false all following arguments are ignored. + * @handle: Handle to buffer for getting data from. + * @format: Format of the overlay as understood by the host. + * @width: Width of the overlay. + * @height: Height of the overlay. + * @size: Size of the overlay in bytes. + * @pitch: Array of pitches, the two last are only used for YUV12 formats. + * @offset: Offset from start of dma buffer to overlay. + * @src: Source rect, must be within the defined area above. + * @dst: Destination rect, x and y may be negative. + * + * Argument to the DRM_VMW_OVERLAY Ioctl. + */ + +struct drm_vmw_overlay_arg { + uint32_t stream_id; + uint32_t enabled; + + uint32_t flags; + uint32_t color_key; + + uint32_t handle; + uint32_t offset; + int32_t format; + uint32_t size; + uint32_t width; + uint32_t height; + uint32_t pitch[3]; + + uint32_t pad64; + struct drm_vmw_rect src; + struct drm_vmw_rect dst; +}; + #endif -- cgit v1.2.3 From bb80a93c9eabb430914011513852b18c943c8cfa Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 24 Nov 2009 22:55:24 +0100 Subject: st/xorg: Create winsys hooks that we call into --- src/gallium/state_trackers/xorg/xorg_driver.c | 6 ++++++ src/gallium/state_trackers/xorg/xorg_tracker.h | 5 +++++ 2 files changed, 11 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 1291591298..da86295c31 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -652,6 +652,9 @@ drv_screen_init(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) if (serverGeneration == 1) xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); + if (ms->winsys_screen_init) + ms->winsys_screen_init(pScrn); + return drv_enter_vt(scrnIndex, 1); } @@ -768,6 +771,9 @@ drv_close_screen(int scrnIndex, ScreenPtr pScreen) drv_leave_vt(scrnIndex, 0); } + if (ms->winsys_screen_close) + ms->winsys_screen_close(pScrn); + #ifdef DRI2 if (ms->screen) xorg_dri2_close(pScreen); diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h index c6c7b2fe15..d5fc18448e 100644 --- a/src/gallium/state_trackers/xorg/xorg_tracker.h +++ b/src/gallium/state_trackers/xorg/xorg_tracker.h @@ -114,6 +114,11 @@ typedef struct _modesettingRec Bool noEvict; Bool debug_fallback; + /* winsys hocks */ + Bool (*winsys_screen_init)(ScrnInfoPtr pScr); + Bool (*winsys_screen_close)(ScrnInfoPtr pScr); + void *winsys_priv; + #ifdef DRM_MODE_FEATURE_DIRTYFB DamagePtr damage; #endif -- cgit v1.2.3 From 64102a56256c95f17f59456a78d9ff2b05889bfb Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 24 Nov 2009 23:51:05 +0100 Subject: vmware/xorg: Create a small driver that sits ontop of st/xorg --- src/gallium/winsys/drm/vmware/xorg/Makefile | 11 ++- src/gallium/winsys/drm/vmware/xorg/vmw_driver.h | 55 +++++++++++++ src/gallium/winsys/drm/vmware/xorg/vmw_hook.h | 39 +++++++++ src/gallium/winsys/drm/vmware/xorg/vmw_screen.c | 100 ++++++++++++++++++++++++ src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c | 4 +- 5 files changed, 205 insertions(+), 4 deletions(-) create mode 100644 src/gallium/winsys/drm/vmware/xorg/vmw_driver.h create mode 100644 src/gallium/winsys/drm/vmware/xorg/vmw_hook.h create mode 100644 src/gallium/winsys/drm/vmware/xorg/vmw_screen.c (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/xorg/Makefile b/src/gallium/winsys/drm/vmware/xorg/Makefile index 48a9b08aa7..d9fee4bf3b 100644 --- a/src/gallium/winsys/drm/vmware/xorg/Makefile +++ b/src/gallium/winsys/drm/vmware/xorg/Makefile @@ -1,10 +1,15 @@ -TARGET = vmwgfx_drv.so -CFILES = $(wildcard ./*.c) -OBJECTS = $(patsubst ./%.c,./%.o,$(CFILES)) TOP = ../../../../../.. include $(TOP)/configs/current +TARGET = vmwgfx_drv.so + +CFILES = \ + vmw_xorg.c \ + vmw_screen.c + +OBJECTS = $(patsubst %.c,%.o,$(CFILES)) + INCLUDES = \ $(shell pkg-config --cflags-only-I pixman-1 xorg-server libdrm xproto) \ -I$(TOP)/src/gallium/include \ diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h b/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h new file mode 100644 index 0000000000..e964cb4b57 --- /dev/null +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h @@ -0,0 +1,55 @@ +/********************************************************** + * 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, 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. + * + **********************************************************/ + +/** + * @file + * Contains the shared resources for VMware Xorg driver + * that sits ontop of the Xorg State Traker. + * + * It is initialized in vmw_screen.c. + * + * @author Jakob Bornecrantz + */ + +#ifndef VMW_DRIVER_H_ +#define VMW_DRIVER_H_ + +#include "state_trackers/xorg/xorg_tracker.h" + +struct vmw_driver +{ + int fd; + +}; + +static INLINE struct vmw_driver * +vmw_driver(ScrnInfoPtr pScrn) +{ + modesettingPtr ms = modesettingPTR(pScrn); + return ms ? (struct vmw_driver *)ms->winsys_priv : NULL; +} + + +#endif diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_hook.h b/src/gallium/winsys/drm/vmware/xorg/vmw_hook.h new file mode 100644 index 0000000000..224a2d9299 --- /dev/null +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_hook.h @@ -0,0 +1,39 @@ +/********************************************************** + * 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, 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. + * + **********************************************************/ + +#ifndef VMW_HOOK_H_ +#define VMW_HOOK_H_ + +#include "state_trackers/xorg/xorg_winsys.h" + + +/*********************************************************************** + * vmw_screen.c + */ + +void vmw_screen_set_functions(ScrnInfoPtr pScrn); + + +#endif diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_screen.c b/src/gallium/winsys/drm/vmware/xorg/vmw_screen.c new file mode 100644 index 0000000000..969d48157c --- /dev/null +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_screen.c @@ -0,0 +1,100 @@ +/********************************************************** + * 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, 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. + * + **********************************************************/ + +/** + * @file + * Contains the init code for the VMware Xorg driver. + * + * @author Jakob Bornecrantz + */ + +#include "vmw_hook.h" +#include "vmw_driver.h" + +static Bool +vmw_screen_init(ScrnInfoPtr pScrn) +{ + modesettingPtr ms = modesettingPTR(pScrn); + struct vmw_driver *vmw; + + /* if gallium is used then we don't need to do anything. */ + if (ms->screen) + return TRUE; + + vmw = xnfcalloc(sizeof(*vmw), 1); + if (!vmw) + return FALSE; + + vmw->fd = ms->fd; + ms->winsys_priv = vmw; + + return TRUE; +} + +static Bool +vmw_screen_close(ScrnInfoPtr pScrn) +{ + modesettingPtr ms = modesettingPTR(pScrn); + struct vmw_driver *vmw = vmw_driver(pScrn); + + if (!vmw) + return TRUE; + + ms->winsys_priv = NULL; + xfree(vmw); + + return TRUE; +} + +/* + * Functions for setting up hooks into the xorg state tracker + */ + +static Bool (*vmw_screen_pre_init_saved)(ScrnInfoPtr pScrn, int flags) = NULL; + +static Bool +vmw_screen_pre_init(ScrnInfoPtr pScrn, int flags) +{ + modesettingPtr ms; + + pScrn->PreInit = vmw_screen_pre_init_saved; + if (!pScrn->PreInit(pScrn, flags)) + return FALSE; + + ms = modesettingPTR(pScrn); + ms->winsys_screen_init = vmw_screen_init; + ms->winsys_screen_close = vmw_screen_close; + + return TRUE; +} + +void +vmw_screen_set_functions(ScrnInfoPtr pScrn) +{ + assert(!vmw_screen_pre_init_saved); + + vmw_screen_pre_init_saved = pScrn->PreInit; + pScrn->PreInit = vmw_screen_pre_init; +} diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c b/src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c index 3acc110ae7..4b208719ca 100644 --- a/src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_xorg.c @@ -31,7 +31,7 @@ * @author Jakob Bornecrantz */ -#include "state_trackers/xorg/xorg_winsys.h" +#include "vmw_hook.h" static void vmw_xorg_identify(int flags); static Bool vmw_xorg_pci_probe(DriverPtr driver, @@ -145,6 +145,8 @@ vmw_xorg_pci_probe(DriverPtr driver, /* Use all the functions from the xorg tracker */ xorg_tracker_set_functions(scrn); + + vmw_screen_set_functions(scrn); } return scrn != NULL; } -- cgit v1.2.3 From 77ff3a5619721cfd917f9fd45e4b3a1c866c578f Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 1 Dec 2009 17:13:41 +0100 Subject: vmware/xorg: Add video support By using the hooks st/xorg provides us we can create a driver specific implementation that uses the svga overlay engines. --- src/gallium/winsys/drm/vmware/xorg/Makefile | 3 + src/gallium/winsys/drm/vmware/xorg/vmw_driver.h | 31 + src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c | 140 ++++ src/gallium/winsys/drm/vmware/xorg/vmw_screen.c | 4 + src/gallium/winsys/drm/vmware/xorg/vmw_video.c | 1021 +++++++++++++++++++++++ 5 files changed, 1199 insertions(+) create mode 100644 src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c create mode 100644 src/gallium/winsys/drm/vmware/xorg/vmw_video.c (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/xorg/Makefile b/src/gallium/winsys/drm/vmware/xorg/Makefile index d9fee4bf3b..49e28ae17f 100644 --- a/src/gallium/winsys/drm/vmware/xorg/Makefile +++ b/src/gallium/winsys/drm/vmware/xorg/Makefile @@ -6,6 +6,8 @@ TARGET = vmwgfx_drv.so CFILES = \ vmw_xorg.c \ + vmw_video.c \ + vmw_ioctl.c \ vmw_screen.c OBJECTS = $(patsubst %.c,%.o,$(CFILES)) @@ -29,6 +31,7 @@ LINKS = \ $(shell pkg-config --libs libdrm) DRIVER_DEFINES = \ + -std=gnu99 \ -DHAVE_CONFIG_H TARGET_STAGING = $(TOP)/$(LIB_DIR)/gallium/$(TARGET) diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h b/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h index e964cb4b57..04d446a2df 100644 --- a/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h @@ -38,10 +38,14 @@ #include "state_trackers/xorg/xorg_tracker.h" +struct vmw_dma_buffer; + struct vmw_driver { int fd; + /* vmw_video.c */ + void *video_priv; }; static INLINE struct vmw_driver * @@ -52,4 +56,31 @@ vmw_driver(ScrnInfoPtr pScrn) } +/*********************************************************************** + * vmw_video.c + */ + +Bool vmw_video_init(ScrnInfoPtr pScrn, struct vmw_driver *vmw); + +Bool vmw_video_close(ScrnInfoPtr pScrn, struct vmw_driver *vmw); + + +/*********************************************************************** + * vmw_ioctl.c + */ + +struct vmw_dma_buffer * vmw_ioctl_buffer_create(struct vmw_driver *vmw, + uint32_t size, + unsigned *handle); + +void * vmw_ioctl_buffer_map(struct vmw_driver *vmw, + struct vmw_dma_buffer *buf); + +void vmw_ioctl_buffer_unmap(struct vmw_driver *vmw, + struct vmw_dma_buffer *buf); + +void vmw_ioctl_buffer_destroy(struct vmw_driver *vmw, + struct vmw_dma_buffer *buf); + + #endif diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c b/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c new file mode 100644 index 0000000000..3cac5b7760 --- /dev/null +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.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, 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. + * + **********************************************************/ + +/** + * @file + * Contains the functions for creating dma buffers by calling + * the kernel via driver specific ioctls. + * + * @author Jakob Bornecrantz + */ + +#define HAVE_STDINT_H +#define _FILE_OFFSET_BITS 64 + +#include +#include +#include + +#include +#include "xf86drm.h" +#include "../core/vmwgfx_drm.h" + +#include "vmw_driver.h" +#include "util/u_debug.h" + +struct vmw_dma_buffer +{ + void *data; + unsigned handle; + uint64_t map_handle; + unsigned map_count; + uint32_t size; +}; + +struct vmw_dma_buffer * +vmw_ioctl_buffer_create(struct vmw_driver *vmw, uint32_t size, unsigned *handle) +{ + struct vmw_dma_buffer *buf; + union drm_vmw_alloc_dmabuf_arg arg; + struct drm_vmw_alloc_dmabuf_req *req = &arg.req; + struct drm_vmw_dmabuf_rep *rep = &arg.rep; + int ret; + + buf = xcalloc(1, sizeof(*buf)); + if (!buf) + goto err; + + memset(&arg, 0, sizeof(arg)); + req->size = size; + do { + ret = drmCommandWriteRead(vmw->fd, DRM_VMW_ALLOC_DMABUF, &arg, sizeof(arg)); + } while (ret == -ERESTART); + + if (ret) { + debug_printf("IOCTL failed %d: %s\n", ret, strerror(-ret)); + goto err_free; + } + + + buf->data = NULL; + buf->handle = rep->handle; + buf->map_handle = rep->map_handle; + buf->map_count = 0; + buf->size = size; + + *handle = rep->handle; + + return buf; + +err_free: + xfree(buf); +err: + return NULL; +} + +void +vmw_ioctl_buffer_destroy(struct vmw_driver *vmw, struct vmw_dma_buffer *buf) +{ + struct drm_vmw_unref_dmabuf_arg arg; + + if (buf->data) { + munmap(buf->data, buf->size); + buf->data = NULL; + } + + memset(&arg, 0, sizeof(arg)); + arg.handle = buf->handle; + drmCommandWrite(vmw->fd, DRM_VMW_UNREF_DMABUF, &arg, sizeof(arg)); + + xfree(buf); +} + +void * +vmw_ioctl_buffer_map(struct vmw_driver *vmw, struct vmw_dma_buffer *buf) +{ + void *map; + + if (buf->data == NULL) { + map = mmap(NULL, buf->size, PROT_READ | PROT_WRITE, MAP_SHARED, + vmw->fd, buf->map_handle); + if (map == MAP_FAILED) { + debug_printf("%s: Map failed.\n", __FUNCTION__); + return NULL; + } + + buf->data = map; + } + + ++buf->map_count; + + return buf->data; +} + +void +vmw_ioctl_buffer_unmap(struct vmw_driver *vmw, struct vmw_dma_buffer *buf) +{ + --buf->map_count; +} diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_screen.c b/src/gallium/winsys/drm/vmware/xorg/vmw_screen.c index 969d48157c..344ef0b315 100644 --- a/src/gallium/winsys/drm/vmware/xorg/vmw_screen.c +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_screen.c @@ -50,6 +50,8 @@ vmw_screen_init(ScrnInfoPtr pScrn) vmw->fd = ms->fd; ms->winsys_priv = vmw; + vmw_video_init(pScrn, vmw); + return TRUE; } @@ -62,6 +64,8 @@ vmw_screen_close(ScrnInfoPtr pScrn) if (!vmw) return TRUE; + vmw_video_close(pScrn, vmw); + ms->winsys_priv = NULL; xfree(vmw); diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_video.c b/src/gallium/winsys/drm/vmware/xorg/vmw_video.c new file mode 100644 index 0000000000..6e34aa21f3 --- /dev/null +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_video.c @@ -0,0 +1,1021 @@ +/* + * Copyright 2007 by 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + +/* + * vmwarevideo.c -- + * + * Xv extension support. + * See http://www.xfree86.org/current/DESIGN16.html + * + */ + + +#include "xf86xv.h" +#include "fourcc.h" + +#include "pipe/p_compiler.h" +/* + * We can't incude svga_types.h due to conflicting types for Bool. + */ +typedef int64_t int64; +typedef uint64_t uint64; + +typedef int32_t int32; +typedef uint32_t uint32; + +typedef int16_t int16; +typedef uint16_t uint16; + +typedef int8_t int8; +typedef uint8_t uint8; + +#include "svga/include/svga_reg.h" +#include "svga/include/svga_escape.h" +#include "svga/include/svga_overlay.h" + +#include "vmw_driver.h" + +#include + +#include "xf86drm.h" +#include "../core/vmwgfx_drm.h" + +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +/* + * Number of videos that can be played simultaneously + */ +#define VMWARE_VID_NUM_PORTS 1 + +/* + * Using a dark shade as the default colorKey + */ +#define VMWARE_VIDEO_COLORKEY 0x100701 + +/* + * Maximum dimensions + */ +#define VMWARE_VID_MAX_WIDTH 2048 +#define VMWARE_VID_MAX_HEIGHT 2048 + +#define VMWARE_VID_NUM_ENCODINGS 1 +static XF86VideoEncodingRec vmwareVideoEncodings[] = +{ + { + 0, + "XV_IMAGE", + VMWARE_VID_MAX_WIDTH, VMWARE_VID_MAX_HEIGHT, + {1, 1} + } +}; + +#define VMWARE_VID_NUM_FORMATS 2 +static XF86VideoFormatRec vmwareVideoFormats[] = +{ + { 16, TrueColor}, + { 24, TrueColor} +}; + +#define VMWARE_VID_NUM_IMAGES 3 +static XF86ImageRec vmwareVideoImages[] = +{ + XVIMAGE_YV12, + XVIMAGE_YUY2, + XVIMAGE_UYVY +}; + +#define VMWARE_VID_NUM_ATTRIBUTES 2 +static XF86AttributeRec vmwareVideoAttributes[] = +{ + { + XvGettable | XvSettable, + 0x000000, + 0xffffff, + "XV_COLORKEY" + }, + { + XvGettable | XvSettable, + 0, + 1, + "XV_AUTOPAINT_COLORKEY" + } +}; + +/* + * Video frames are stored in a circular list of buffers. + * Must be power or two, See vmw_video_port_play. + */ +#define VMWARE_VID_NUM_BUFFERS 1 + +/* + * Defines the structure used to hold and pass video data to the host + */ +struct vmw_video_buffer +{ + unsigned handle; + int size; + void *data; + void *extra_data; + struct vmw_dma_buffer *buf; +}; + + +/** + * Structure representing a single video stream, aka port. + * + * Ports maps one to one to a SVGA stream. Port is just + * what Xv calls a SVGA stream. + */ +struct vmw_video_port +{ + /* + * Function prototype same as XvPutImage. + * + * This is either set to vmw_video_port_init or vmw_video_port_play. + * At init this function is set to port_init. In port_init we set it + * to port_play and call it, after initializing the struct. + */ + int (*play)(ScrnInfoPtr, struct vmw_video_port *, + short, short, short, short, short, + short, short, short, int, unsigned char*, + short, short, RegionPtr); + + /* values to go into the SVGAOverlayUnit */ + uint32 streamId; + uint32 colorKey; + uint32 flags; + + /* round robin of buffers */ + unsigned currBuf; + struct vmw_video_buffer bufs[VMWARE_VID_NUM_BUFFERS]; + + /* properties that applies to all buffers */ + int size; + int pitches[3]; + int offsets[3]; + + /* things for X */ + RegionRec clipBoxes; + Bool isAutoPaintColorkey; +}; + + +/** + * Structure holding all the infromation for video. + */ +struct vmw_video_private +{ + int fd; + + /** ports */ + struct vmw_video_port port[VMWARE_VID_NUM_PORTS]; + + /** Used to store port pointers pointers */ + DevUnion port_ptr[VMWARE_VID_NUM_PORTS]; +}; + + +/* + * Callback functions exported to Xv, prefixed with vmw_xv_*. + */ +static int vmw_xv_put_image(ScrnInfoPtr pScrn, short src_x, short src_y, + short drw_x, short drw_y, short src_w, short src_h, + short drw_w, short drw_h, int image, + unsigned char *buf, short width, short height, + Bool sync, RegionPtr clipBoxes, pointer data, + DrawablePtr dst); +static void vmw_xv_stop_video(ScrnInfoPtr pScrn, pointer data, Bool Cleanup); +static int vmw_xv_query_image_attributes(ScrnInfoPtr pScrn, int format, + unsigned short *width, + unsigned short *height, int *pitches, + int *offsets); +static int vmw_xv_set_port_attribute(ScrnInfoPtr pScrn, Atom attribute, + INT32 value, pointer data); +static int vmw_xv_get_port_attribute(ScrnInfoPtr pScrn, Atom attribute, + INT32 *value, pointer data); +static void vmw_xv_query_best_size(ScrnInfoPtr pScrn, Bool motion, + short vid_w, short vid_h, short drw_w, + short drw_h, unsigned int *p_w, + unsigned int *p_h, pointer data); + + +/* + * Local functions. + */ +static XF86VideoAdaptorPtr vmw_video_init_adaptor(ScrnInfoPtr pScrn, struct vmw_driver *vmw); + +static int vmw_video_port_init(ScrnInfoPtr pScrn, + struct vmw_video_port *port, + short src_x, short src_y, short drw_x, + short drw_y, short src_w, short src_h, + short drw_w, short drw_h, int format, + unsigned char *buf, short width, + short height, RegionPtr clipBoxes); +static int vmw_video_port_play(ScrnInfoPtr pScrn, struct vmw_video_port *port, + short src_x, short src_y, short drw_x, + short drw_y, short src_w, short src_h, + short drw_w, short drw_h, int format, + unsigned char *buf, short width, + short height, RegionPtr clipBoxes); +static void vmw_video_port_cleanup(ScrnInfoPtr pScrn, struct vmw_video_port *port); + +static int vmw_video_buffer_alloc(struct vmw_driver *vmw, int size, + struct vmw_video_buffer *out); +static int vmw_video_buffer_free(struct vmw_driver *vmw, + struct vmw_video_buffer *out); + + +/* + *----------------------------------------------------------------------------- + * + * vmw_video_init -- + * + * Initializes Xv support. + * + * Results: + * TRUE on success, FALSE on error. + * + * Side effects: + * Xv support is initialized. Memory is allocated for all supported + * video streams. + * + *----------------------------------------------------------------------------- + */ + +Bool +vmw_video_init(ScrnInfoPtr pScrn, struct vmw_driver *vmw) +{ + ScreenPtr pScreen = pScrn->pScreen; + XF86VideoAdaptorPtr *overlayAdaptors, *newAdaptors = NULL; + XF86VideoAdaptorPtr newAdaptor = NULL; + int numAdaptors; + + debug_printf("%s: enter\n", __func__); + + numAdaptors = xf86XVListGenericAdaptors(pScrn, &overlayAdaptors); + + newAdaptor = vmw_video_init_adaptor(pScrn, vmw); + if (!newAdaptor) { + debug_printf("Failed to initialize Xv extension\n"); + return FALSE; + } + + if (!numAdaptors) { + numAdaptors = 1; + overlayAdaptors = &newAdaptor; + } else { + newAdaptors = xalloc((numAdaptors + 1) * + sizeof(XF86VideoAdaptorPtr*)); + if (!newAdaptors) { + xf86XVFreeVideoAdaptorRec(newAdaptor); + return FALSE; + } + + memcpy(newAdaptors, overlayAdaptors, + numAdaptors * sizeof(XF86VideoAdaptorPtr)); + newAdaptors[numAdaptors++] = newAdaptor; + overlayAdaptors = newAdaptors; + } + + if (!xf86XVScreenInit(pScreen, overlayAdaptors, numAdaptors)) { + debug_printf("Failed to initialize Xv extension\n"); + xf86XVFreeVideoAdaptorRec(newAdaptor); + return FALSE; + } + + if (newAdaptors) { + xfree(newAdaptors); + } + + debug_printf("Initialized VMware Xv extension successfully\n"); + + return TRUE; +} + + +/* + *----------------------------------------------------------------------------- + * + * vmw_video_close -- + * + * Unitializes video. + * + * Results: + * TRUE. + * + * Side effects: + * vmw->video_priv = NULL + * + *----------------------------------------------------------------------------- + */ + +Bool +vmw_video_close(ScrnInfoPtr pScrn, struct vmw_driver *vmw) +{ + struct vmw_video_private *video; + int i; + + debug_printf("%s: enter\n", __func__); + + video = vmw->video_priv; + + for (i = 0; i < VMWARE_VID_NUM_PORTS; ++i) { + vmw_video_port_cleanup(pScrn, &video->port[i]); + } + + /* XXX: I'm sure this function is missing code for turning off Xv */ + + free(vmw->video_priv); + vmw->video_priv = NULL; + + return TRUE; +} + + +/* + *----------------------------------------------------------------------------- + * + * vmw_video_init_adaptor -- + * + * Initializes a XF86VideoAdaptor structure with the capabilities and + * functions supported by this video driver. + * + * Results: + * On success initialized XF86VideoAdaptor struct or NULL on error + * + * Side effects: + * None. + * + *----------------------------------------------------------------------------- + */ + +static XF86VideoAdaptorPtr +vmw_video_init_adaptor(ScrnInfoPtr pScrn, struct vmw_driver *vmw) +{ + XF86VideoAdaptorPtr adaptor; + struct vmw_video_private *video; + int i; + + debug_printf("%s: enter \n", __func__); + + adaptor = xf86XVAllocateVideoAdaptorRec(pScrn); + if (!adaptor) { + debug_printf("Not enough memory\n"); + return NULL; + } + + video = xcalloc(1, sizeof(*video)); + if (!video) { + debug_printf("Not enough memory.\n"); + xf86XVFreeVideoAdaptorRec(adaptor); + return NULL; + } + + vmw->video_priv = video; + + adaptor->type = XvInputMask | XvImageMask | XvWindowMask; + adaptor->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + adaptor->name = "VMware Video Engine"; + adaptor->nEncodings = VMWARE_VID_NUM_ENCODINGS; + adaptor->pEncodings = vmwareVideoEncodings; + adaptor->nFormats = VMWARE_VID_NUM_FORMATS; + adaptor->pFormats = vmwareVideoFormats; + adaptor->nPorts = VMWARE_VID_NUM_PORTS; + adaptor->pPortPrivates = video->port_ptr; + + for (i = 0; i < VMWARE_VID_NUM_PORTS; ++i) { + video->port[i].streamId = i; + video->port[i].play = vmw_video_port_init; + video->port[i].flags = SVGA_VIDEO_FLAG_COLORKEY; + video->port[i].colorKey = VMWARE_VIDEO_COLORKEY; + video->port[i].isAutoPaintColorkey = TRUE; + adaptor->pPortPrivates[i].ptr = &video->port[i]; + } + + adaptor->nAttributes = VMWARE_VID_NUM_ATTRIBUTES; + adaptor->pAttributes = vmwareVideoAttributes; + + adaptor->nImages = VMWARE_VID_NUM_IMAGES; + adaptor->pImages = vmwareVideoImages; + + adaptor->PutVideo = NULL; + adaptor->PutStill = NULL; + adaptor->GetVideo = NULL; + adaptor->GetStill = NULL; + adaptor->StopVideo = vmw_xv_stop_video; + adaptor->SetPortAttribute = vmw_xv_set_port_attribute; + adaptor->GetPortAttribute = vmw_xv_get_port_attribute; + adaptor->QueryBestSize = vmw_xv_query_best_size; + adaptor->PutImage = vmw_xv_put_image; + adaptor->QueryImageAttributes = vmw_xv_query_image_attributes; + + debug_printf("%s: done %p\n", __func__, adaptor); + + return adaptor; +} + + +/* + *----------------------------------------------------------------------------- + * + * vmw_video_port_init -- + * + * Initializes a video stream in response to the first PutImage() on a + * video stream. The process goes as follows: + * - Figure out characteristics according to format + * - Allocate offscreen memory + * - Pass on video to Play() functions + * + * Results: + * Success or XvBadAlloc on failure. + * + * Side effects: + * Video stream is initialized and its first frame sent to the host + * (done by VideoPlay() function called at the end) + * + *----------------------------------------------------------------------------- + */ + +static int +vmw_video_port_init(ScrnInfoPtr pScrn, struct vmw_video_port *port, + short src_x, short src_y, short drw_x, + short drw_y, short src_w, short src_h, + short drw_w, short drw_h, int format, + unsigned char *buf, short width, + short height, RegionPtr clipBoxes) +{ + struct vmw_driver *vmw = vmw_driver(pScrn); + unsigned short w, h; + int i, ret; + + debug_printf("\t%s: id %d, format %d\n", __func__, port->streamId, format); + + w = width; + h = height; + /* init all the format attributes, used for buffers */ + port->size = vmw_xv_query_image_attributes(pScrn, format, &w, &h, + port->pitches, port->offsets); + + if (port->size == -1) + return XvBadAlloc; + + port->play = vmw_video_port_play; + + for (i = 0; i < VMWARE_VID_NUM_BUFFERS; ++i) { + ret = vmw_video_buffer_alloc(vmw, port->size, &port->bufs[i]); + if (ret != Success) + break; + } + + /* Free all allocated buffers on failure */ + if (ret != Success) { + for (--i; i >= 0; --i) { + vmw_video_buffer_free(vmw, &port->bufs[i]); + } + return ret; + } + + port->currBuf = 0; + + REGION_COPY(pScrn->pScreen, &port->clipBoxes, clipBoxes); + + if (port->isAutoPaintColorkey) + xf86XVFillKeyHelper(pScrn->pScreen, port->colorKey, clipBoxes); + + return port->play(pScrn, port, src_x, src_y, drw_x, drw_y, src_w, src_h, + drw_w, drw_h, format, buf, width, height, clipBoxes); +} + + +/* + *----------------------------------------------------------------------------- + * + * vmw_video_port_play -- + * + * Sends all the attributes associated with the video frame using the + * FIFO ESCAPE mechanism to the host. + * + * Results: + * Always returns Success. + * + * Side effects: + * None. + * + *----------------------------------------------------------------------------- + */ + +static int +vmw_video_port_play(ScrnInfoPtr pScrn, struct vmw_video_port *port, + short src_x, short src_y, short drw_x, + short drw_y, short src_w, short src_h, + short drw_w, short drw_h, int format, + unsigned char *buf, short width, + short height, RegionPtr clipBoxes) +{ + struct vmw_driver *vmw = vmw_driver(pScrn); + struct drm_vmw_overlay_arg arg; + unsigned short w, h; + int size; + int ret; + + debug_printf("\t%s: enter\n", __func__); + + w = width; + h = height; + + /* we don't update the ports size */ + size = vmw_xv_query_image_attributes(pScrn, format, &w, &h, + port->pitches, port->offsets); + + if (size > port->size) { + debug_printf("\t%s: Increase in size of Xv video frame streamId:%d.\n", + __func__, port->streamId); + vmw_xv_stop_video(pScrn, port, TRUE); + return port->play(pScrn, port, src_x, src_y, drw_x, drw_y, src_w, + src_h, drw_w, drw_h, format, buf, width, height, + clipBoxes); + } + + memcpy(port->bufs[port->currBuf].data, buf, port->size); + + memset(&arg, 0, sizeof(arg)); + + arg.stream_id = port->streamId; + arg.enabled = TRUE; + arg.flags = port->flags; + arg.color_key = port->colorKey; + arg.handle = port->bufs[port->currBuf].handle; + arg.format = format; + arg.size = port->size; + arg.width = w; + arg.height = h; + arg.src.x = src_x; + arg.src.y = src_y; + arg.src.w = src_w; + arg.src.h = src_h; + arg.dst.x = drw_x; + arg.dst.y = drw_y; + arg.dst.w = drw_w; + arg.dst.h = drw_h; + arg.pitch[0] = port->pitches[0]; + arg.pitch[1] = port->pitches[1]; + arg.pitch[2] = port->pitches[2]; + arg.offset = 0; + + /* + * Update the clipList and paint the colorkey, if required. + */ + if (!REGION_EQUAL(pScrn->pScreen, &port->clipBoxes, clipBoxes)) { + REGION_COPY(pScrn->pScreen, &port->clipBoxes, clipBoxes); + if (port->isAutoPaintColorkey) { + xf86XVFillKeyHelper(pScrn->pScreen, port->colorKey, clipBoxes); + } + } + + ret = drmCommandWrite(vmw->fd, DRM_VMW_OVERLAY, &arg, sizeof(arg)); + if (ret) { + vmw_video_port_cleanup(pScrn, port); + return XvBadAlloc; + } + + port->currBuf = ++port->currBuf & (VMWARE_VID_NUM_BUFFERS - 1); + + return Success; +} + + +/* + *----------------------------------------------------------------------------- + * + * vmw_video_port_cleanup -- + * + * Frees up all resources (if any) taken by a video stream. + * + * Results: + * None. + * + * Side effects: + * Same as above. + * + *----------------------------------------------------------------------------- + */ + +static void +vmw_video_port_cleanup(ScrnInfoPtr pScrn, struct vmw_video_port *port) +{ + struct vmw_driver *vmw = vmw_driver(pScrn); + uint32 id, colorKey, flags; + Bool isAutoPaintColorkey; + int i; + + debug_printf("\t%s: enter\n", __func__); + + for (i = 0; i < VMWARE_VID_NUM_BUFFERS; i++) { + vmw_video_buffer_free(vmw, &port->bufs[i]); + } + + /* + * reset stream for next video + */ + id = port->streamId; + colorKey = port->colorKey; + flags = port->flags; + isAutoPaintColorkey = port->isAutoPaintColorkey; + + memset(port, 0, sizeof(*port)); + + port->streamId = id; + port->play = vmw_video_port_init; + port->colorKey = colorKey; + port->flags = flags; + port->isAutoPaintColorkey = isAutoPaintColorkey; +} + + +/* + *----------------------------------------------------------------------------- + * + * vmw_video_buffer_alloc -- + * + * Allocates and map a kernel buffer to be used as data storage. + * + * Results: + * XvBadAlloc on failure, otherwise Success. + * + * Side effects: + * Calls into the kernel, sets members of out. + * + *----------------------------------------------------------------------------- + */ + +static int +vmw_video_buffer_alloc(struct vmw_driver *vmw, int size, + struct vmw_video_buffer *out) +{ + out->buf = vmw_ioctl_buffer_create(vmw, size, &out->handle); + if (!out->buf) + return XvBadAlloc; + + out->data = vmw_ioctl_buffer_map(vmw, out->buf); + if (!out->data) { + vmw_ioctl_buffer_destroy(vmw, out->buf); + + out->handle = 0; + out->buf = NULL; + + return XvBadAlloc; + } + + out->size = size; + out->extra_data = xcalloc(1, size); + + debug_printf("\t\t%s: allocated buffer %p of size %i\n", __func__, out, size); + + return Success; +} + + +/* + *----------------------------------------------------------------------------- + * + * vmw_video_buffer_free -- + * + * Frees and unmaps an allocated kernel buffer. + * + * Results: + * Success. + * + * Side effects: + * Calls into the kernel, sets members of out to 0. + * + *----------------------------------------------------------------------------- + */ + +static int +vmw_video_buffer_free(struct vmw_driver *vmw, + struct vmw_video_buffer *out) +{ + if (out->size == 0) + return Success; + + xfree(out->extra_data); + vmw_ioctl_buffer_unmap(vmw, out->buf); + vmw_ioctl_buffer_destroy(vmw, out->buf); + + out->buf = NULL; + out->data = NULL; + out->handle = 0; + out->size = 0; + + debug_printf("\t\t%s: freed buffer %p\n", __func__, out); + + return Success; +} + + +/* + *----------------------------------------------------------------------------- + * + * vmw_xv_put_image -- + * + * Main video playback function. It copies the passed data which is in + * the specified format (e.g. FOURCC_YV12) into the overlay. + * + * If sync is TRUE the driver should not return from this + * function until it is through reading the data from buf. + * + * Results: + * Success or XvBadAlloc on failure + * + * Side effects: + * Video port will be played(initialized if 1st frame) on success + * or will fail on error. + * + *----------------------------------------------------------------------------- + */ + +static int +vmw_xv_put_image(ScrnInfoPtr pScrn, short src_x, short src_y, + short drw_x, short drw_y, short src_w, short src_h, + short drw_w, short drw_h, int format, + unsigned char *buf, short width, short height, + Bool sync, RegionPtr clipBoxes, pointer data, + DrawablePtr dst) +{ + struct vmw_driver *vmw = vmw_driver(pScrn); + struct vmw_video_port *port = data; + + debug_printf("%s: enter (%u, %u) (%ux%u) (%u, %u) (%ux%u) (%ux%u)\n", __func__, + src_x, src_y, src_w, src_h, + drw_x, drw_y, drw_w, drw_h, + width, height); + + if (!vmw->video_priv) + return XvBadAlloc; + + return port->play(pScrn, port, src_x, src_y, drw_x, drw_y, src_w, src_h, + drw_w, drw_h, format, buf, width, height, clipBoxes); +} + + +/* + *----------------------------------------------------------------------------- + * + * vmw_xv_stop_video -- + * + * Called when we should stop playing video for a particular stream. If + * Cleanup is FALSE, the "stop" operation is only temporary, and thus we + * don't do anything. If Cleanup is TRUE we kill the video port by + * sending a message to the host and freeing up the stream. + * + * Results: + * None. + * + * Side effects: + * See above. + * + *----------------------------------------------------------------------------- + */ + +static void +vmw_xv_stop_video(ScrnInfoPtr pScrn, pointer data, Bool cleanup) +{ + struct vmw_driver *vmw = vmw_driver(pScrn); + struct vmw_video_port *port = data; + struct drm_vmw_overlay_arg arg; + int ret; + + debug_printf("%s: cleanup is %s\n", __func__, cleanup ? "TRUE" : "FALSE"); + + if (!vmw->video_priv) + return; + + if (!cleanup) + return; + + + memset(&arg, 0, sizeof(arg)); + arg.stream_id = port->streamId; + arg.enabled = FALSE; + + ret = drmCommandWrite(vmw->fd, DRM_VMW_OVERLAY, &arg, sizeof(arg)); + assert(ret == 0); + + vmw_video_port_cleanup(pScrn, port); +} + + +/* + *----------------------------------------------------------------------------- + * + * vmw_xv_query_image_attributes -- + * + * From the spec: This function is called to let the driver specify how data + * for a particular image of size width by height should be stored. + * Sometimes only the size and corrected width and height are needed. In + * that case pitches and offsets are NULL. + * + * Results: + * The size of the memory required for the image, or -1 on error. + * + * Side effects: + * None. + * + *----------------------------------------------------------------------------- + */ + +static int +vmw_xv_query_image_attributes(ScrnInfoPtr pScrn, int format, + unsigned short *width, unsigned short *height, + int *pitches, int *offsets) +{ + INT32 size, tmp; + + if (*width > VMWARE_VID_MAX_WIDTH) { + *width = VMWARE_VID_MAX_WIDTH; + } + if (*height > VMWARE_VID_MAX_HEIGHT) { + *height = VMWARE_VID_MAX_HEIGHT; + } + + *width = (*width + 1) & ~1; + if (offsets != NULL) { + offsets[0] = 0; + } + + switch (format) { + case FOURCC_YV12: + *height = (*height + 1) & ~1; + size = (*width + 3) & ~3; + if (pitches) { + pitches[0] = size; + } + size *= *height; + if (offsets) { + offsets[1] = size; + } + tmp = ((*width >> 1) + 3) & ~3; + if (pitches) { + pitches[1] = pitches[2] = tmp; + } + tmp *= (*height >> 1); + size += tmp; + if (offsets) { + offsets[2] = size; + } + size += tmp; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + size = *width * 2; + if (pitches) { + pitches[0] = size; + } + size *= *height; + break; + default: + debug_printf("Query for invalid video format %d\n", format); + return -1; + } + return size; +} + + +/* + *----------------------------------------------------------------------------- + * + * vmw_xv_set_port_attribute -- + * + * From the spec: A port may have particular attributes such as colorKey, hue, + * saturation, brightness or contrast. Xv clients set these + * attribute values by sending attribute strings (Atoms) to the server. + * + * Results: + * Success if the attribute exists and XvBadAlloc otherwise. + * + * Side effects: + * The respective attribute gets the new value. + * + *----------------------------------------------------------------------------- + */ + +static int +vmw_xv_set_port_attribute(ScrnInfoPtr pScrn, Atom attribute, + INT32 value, pointer data) +{ + struct vmw_video_port *port = data; + Atom xvColorKey = MAKE_ATOM("XV_COLORKEY"); + Atom xvAutoPaint = MAKE_ATOM("XV_AUTOPAINT_COLORKEY"); + + if (attribute == xvColorKey) { + debug_printf("%s: Set colorkey:0x%x\n", __func__, (unsigned)value); + port->colorKey = value; + } else if (attribute == xvAutoPaint) { + debug_printf("%s: Set autoPaint: %s\n", __func__, value? "TRUE": "FALSE"); + port->isAutoPaintColorkey = value; + } else { + return XvBadAlloc; + } + + return Success; +} + + +/* + *----------------------------------------------------------------------------- + * + * vmw_xv_get_port_attribute -- + * + * From the spec: A port may have particular attributes such as hue, + * saturation, brightness or contrast. Xv clients get these + * attribute values by sending attribute strings (Atoms) to the server + * + * Results: + * Success if the attribute exists and XvBadAlloc otherwise. + * + * Side effects: + * "value" contains the requested attribute on success. + * + *----------------------------------------------------------------------------- + */ + +static int +vmw_xv_get_port_attribute(ScrnInfoPtr pScrn, Atom attribute, + INT32 *value, pointer data) +{ + struct vmw_video_port *port = data; + Atom xvColorKey = MAKE_ATOM("XV_COLORKEY"); + Atom xvAutoPaint = MAKE_ATOM("XV_AUTOPAINT_COLORKEY"); + + if (attribute == xvColorKey) { + *value = port->colorKey; + } else if (attribute == xvAutoPaint) { + *value = port->isAutoPaintColorkey; + } else { + return XvBadAlloc; + } + + return Success; +} + + +/* + *----------------------------------------------------------------------------- + * + * vmw_xv_query_best_size -- + * + * From the spec: QueryBestSize provides the client with a way to query what + * the destination dimensions would end up being if they were to request + * that an area vid_w by vid_h from the video stream be scaled to rectangle + * of drw_w by drw_h on the screen. Since it is not expected that all + * hardware will be able to get the target dimensions exactly, it is + * important that the driver provide this function. + * + * This function seems to never be called, but to be on the safe side + * we apply the same logic that QueryImageAttributes has for width + * and height. + * + * Results: + * None. + * + * Side effects: + * None. + * + *----------------------------------------------------------------------------- + */ + +static void +vmw_xv_query_best_size(ScrnInfoPtr pScrn, Bool motion, + short vid_w, short vid_h, short drw_w, + short drw_h, unsigned int *p_w, + unsigned int *p_h, pointer data) +{ + *p_w = (drw_w + 1) & ~1; + *p_h = drw_h; + + return; +} -- cgit v1.2.3 From d8da270a2be18849eee8a168d1c1528e96677b41 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 24 Nov 2009 11:59:23 -0800 Subject: intel: Remove GL_NV_point_sprite from extension list i830 does not (and cannot!) support the any of the non-default GL_POINT_SPRITE_R_MODE_NV settings. i915 and i965 could, but currently do not. In both cases it would require mucking about with the fragment shader. --- src/mesa/drivers/dri/intel/intel_extensions.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_extensions.c b/src/mesa/drivers/dri/intel/intel_extensions.c index 2e61c556d8..877f5b5971 100644 --- a/src/mesa/drivers/dri/intel/intel_extensions.c +++ b/src/mesa/drivers/dri/intel/intel_extensions.c @@ -114,7 +114,6 @@ static const struct dri_extension card_extensions[] = { { "GL_MESA_pack_invert", NULL }, { "GL_MESA_ycbcr_texture", NULL }, { "GL_NV_blend_square", NULL }, - { "GL_NV_point_sprite", GL_NV_point_sprite_functions }, { "GL_NV_vertex_program", GL_NV_vertex_program_functions }, { "GL_NV_vertex_program1_1", NULL }, { "GL_SGIS_generate_mipmap", NULL }, -- cgit v1.2.3 From e0399fddf2efd556ece8b81078368e6ab388c3b7 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 30 Nov 2009 09:21:49 -0700 Subject: softpipe: setup machine->Face without a conditional --- src/gallium/drivers/softpipe/sp_fs_exec.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_fs_exec.c b/src/gallium/drivers/softpipe/sp_fs_exec.c index a8999ed347..27fa126b7c 100644 --- a/src/gallium/drivers/softpipe/sp_fs_exec.c +++ b/src/gallium/drivers/softpipe/sp_fs_exec.c @@ -127,11 +127,8 @@ exec_run( const struct sp_fragment_shader *base, (float)quad->input.x0, (float)quad->input.y0, &machine->QuadPos); - if (quad->input.facing) { - machine->Face = -1.0f; - } else { - machine->Face = 1.0f; - } + /* convert 0 to 1.0 and 1 to -1.0 */ + machine->Face = (float) (quad->input.facing * -2 + 1); quad->inout.mask &= tgsi_exec_machine_run( machine ); if (quad->inout.mask == 0) -- cgit v1.2.3 From 09325b9ff456ae475069bac5a04cf10a32235e43 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 19 Nov 2009 09:55:08 -0700 Subject: mesa: added comment for target_enum_to_index() --- src/mesa/main/texobj.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index aaccc03a7c..7e8a2489ac 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -940,7 +940,8 @@ _mesa_DeleteTextures( GLsizei n, const GLuint *textures) /** * Convert a GL texture target enum such as GL_TEXTURE_2D or GL_TEXTURE_3D * into the corresponding Mesa texture target index. - * Return -1 if target is invalid. + * Note that proxy targets are not valid here. + * \return TEXTURE_x_INDEX or -1 if target is invalid */ static GLint target_enum_to_index(GLenum target) -- cgit v1.2.3 From c78748a5274e58bcbb122923edf81065be9bbe16 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Wed, 2 Dec 2009 02:08:26 +0100 Subject: gallium: adapt drivers to interface cleanups --- src/gallium/drivers/cell/ppu/cell_texture.c | 30 +++--- src/gallium/drivers/i915/i915_surface.c | 21 +++-- src/gallium/drivers/i915/i915_texture.c | 125 ++++++++++--------------- src/gallium/drivers/llvmpipe/lp_setup.c | 2 +- src/gallium/drivers/llvmpipe/lp_tex_cache.c | 2 +- src/gallium/drivers/llvmpipe/lp_texture.c | 48 +++++----- src/gallium/drivers/llvmpipe/lp_tile_cache.c | 6 +- src/gallium/drivers/r300/r300_emit.c | 12 +-- src/gallium/drivers/r300/r300_screen.c | 9 +- src/gallium/drivers/r300/r300_texture.c | 12 +-- src/gallium/drivers/svga/svga_screen_texture.c | 37 ++++---- src/gallium/drivers/svga/svga_state_vs.c | 2 +- 12 files changed, 138 insertions(+), 168 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/cell/ppu/cell_texture.c b/src/gallium/drivers/cell/ppu/cell_texture.c index e6b8a87045..77a57aef14 100644 --- a/src/gallium/drivers/cell/ppu/cell_texture.c +++ b/src/gallium/drivers/cell/ppu/cell_texture.c @@ -65,14 +65,11 @@ cell_texture_layout(struct cell_texture *ct) w_tile = align(width, TILE_SIZE); h_tile = align(height, TILE_SIZE); - pt->nblocksx[level] = pf_get_nblocksx(&pt->block, w_tile); - pt->nblocksy[level] = pf_get_nblocksy(&pt->block, h_tile); - - ct->stride[level] = pt->nblocksx[level] * pt->block.size; + ct->stride[level] = pf_get_stride(pt->format, w_tile); ct->level_offset[level] = ct->buffer_size; - size = pt->nblocksx[level] * pt->nblocksy[level] * pt->block.size; + size = ct->stride[level] * pf_get_nblocksy(pt->format, h_tile); if (pt->target == PIPE_TEXTURE_CUBE) size *= 6; else @@ -283,10 +280,12 @@ cell_get_tex_surface(struct pipe_screen *screen, ps->zslice = zslice; if (pt->target == PIPE_TEXTURE_CUBE) { - ps->offset += face * pt->nblocksy[level] * ct->stride[level]; + unsigned h_tile = align(ps->height, TILE_SIZE); + ps->offset += face * pf_get_nblocksy(ps->format, h_tile) * ct->stride[level]; } else if (pt->target == PIPE_TEXTURE_3D) { - ps->offset += zslice * pt->nblocksy[level] * ct->stride[level]; + unsigned h_tile = align(ps->height, TILE_SIZE); + ps->offset += zslice * pf_get_nblocksy(ps->format, h_tile) * ct->stride[level]; } else { assert(face == 0); @@ -327,14 +326,10 @@ cell_get_tex_transfer(struct pipe_screen *screen, if (ctrans) { struct pipe_transfer *pt = &ctrans->base; pipe_texture_reference(&pt->texture, texture); - pt->format = texture->format; - pt->block = texture->block; pt->x = x; pt->y = y; pt->width = w; pt->height = h; - pt->nblocksx = texture->nblocksx[level]; - pt->nblocksy = texture->nblocksy[level]; pt->stride = ct->stride[level]; pt->usage = usage; pt->face = face; @@ -344,10 +339,12 @@ cell_get_tex_transfer(struct pipe_screen *screen, ctrans->offset = ct->level_offset[level]; if (texture->target == PIPE_TEXTURE_CUBE) { - ctrans->offset += face * pt->nblocksy * pt->stride; + unsigned h_tile = align(u_minify(texture->height0, level), TILE_SIZE); + ctrans->offset += face * pf_get_nblocksy(texture->format, h_tile) * pt->stride; } else if (texture->target == PIPE_TEXTURE_3D) { - ctrans->offset += zslice * pt->nblocksy * pt->stride; + unsigned h_tile = align(u_minify(texture->height0, level), TILE_SIZE); + ctrans->offset += zslice * pf_get_nblocksy(texture->format, h_tile) * pt->stride; } else { assert(face == 0); @@ -400,7 +397,8 @@ cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer) * Create a buffer of ordinary memory for the linear texture. * This is the memory that the user will read/write. */ - size = pt->nblocksx[level] * pt->nblocksy[level] * pt->block.size; + size = pf_get_stride(pt->format, align(texWidth, TILE_SIZE)) * + pf_get_nblocksy(pt->format, align(texHeight, TILE_SIZE)); ctrans->map = align_malloc(size, 16); if (!ctrans->map) @@ -408,7 +406,7 @@ cell_transfer_map(struct pipe_screen *screen, struct pipe_transfer *transfer) if (transfer->usage & PIPE_TRANSFER_READ) { /* need to untwiddle the texture to make a linear version */ - const uint bpp = pf_get_size(ct->base.format); + const uint bpp = pf_get_blocksize(ct->base.format); if (bpp == 4) { const uint *src = (uint *) (ct->mapped + ctrans->offset); uint *dst = ctrans->map; @@ -451,7 +449,7 @@ cell_transfer_unmap(struct pipe_screen *screen, /* The user wrote new texture data into the mapped buffer. * We need to convert the new linear data into the twiddled/tiled format. */ - const uint bpp = pf_get_size(ct->base.format); + const uint bpp = pf_get_blocksize(ct->base.format); if (bpp == 4) { const uint *src = ctrans->map; uint *dst = (uint *) (ct->mapped + ctrans->offset); diff --git a/src/gallium/drivers/i915/i915_surface.c b/src/gallium/drivers/i915/i915_surface.c index ab8331f3e6..24e1024aaa 100644 --- a/src/gallium/drivers/i915/i915_surface.c +++ b/src/gallium/drivers/i915/i915_surface.c @@ -48,17 +48,19 @@ i915_surface_copy(struct pipe_context *pipe, { struct i915_texture *dst_tex = (struct i915_texture *)dst->texture; struct i915_texture *src_tex = (struct i915_texture *)src->texture; + struct pipe_texture *dpt = &dst_tex->base; + struct pipe_texture *spt = &src_tex->base; assert( dst != src ); - assert( dst_tex->base.block.size == src_tex->base.block.size ); - assert( dst_tex->base.block.width == src_tex->base.block.height ); - assert( dst_tex->base.block.height == src_tex->base.block.height ); - assert( dst_tex->base.block.width == 1 ); - assert( dst_tex->base.block.height == 1 ); + assert( pf_get_blocksize(dpt->format) == pf_get_blocksize(spt->format) ); + assert( pf_get_blockwidth(dpt->format) == pf_get_blockwidth(spt->format) ); + assert( pf_get_blockheight(dpt->format) == pf_get_blockheight(spt->format) ); + assert( pf_get_blockwidth(dpt->format) == 1 ); + assert( pf_get_blockheight(dpt->format) == 1 ); i915_copy_blit( i915_context(pipe), FALSE, - dst_tex->base.block.size, + pf_get_blocksize(dpt->format), (unsigned short) src_tex->stride, src_tex->buffer, src->offset, (unsigned short) dst_tex->stride, dst_tex->buffer, dst->offset, (short) srcx, (short) srcy, (short) dstx, (short) dsty, (short) width, (short) height ); @@ -72,12 +74,13 @@ i915_surface_fill(struct pipe_context *pipe, unsigned width, unsigned height, unsigned value) { struct i915_texture *tex = (struct i915_texture *)dst->texture; + struct pipe_texture *pt = &tex->base; - assert(tex->base.block.width == 1); - assert(tex->base.block.height == 1); + assert(pf_get_blockwidth(pt->format) == 1); + assert(pf_get_blockheight(pt->format) == 1); i915_fill_blit( i915_context(pipe), - tex->base.block.size, + pf_get_blocksize(pt->format), (unsigned short) tex->stride, tex->buffer, dst->offset, (short) dstx, (short) dsty, diff --git a/src/gallium/drivers/i915/i915_texture.c b/src/gallium/drivers/i915/i915_texture.c index c7b86dd4c5..b28b413771 100644 --- a/src/gallium/drivers/i915/i915_texture.c +++ b/src/gallium/drivers/i915/i915_texture.c @@ -74,6 +74,9 @@ static const int step_offsets[6][2] = { {-1, 1} }; +/* XXX really need twice the size if x is already pot? + Otherwise just use util_next_power_of_two? +*/ static unsigned power_of_two(unsigned x) { @@ -83,13 +86,6 @@ power_of_two(unsigned x) return value; } -static unsigned -round_up(unsigned n, unsigned multiple) -{ - return (n + multiple - 1) & ~(multiple - 1); -} - - /* * More advanced helper funcs */ @@ -101,13 +97,8 @@ i915_miptree_set_level_info(struct i915_texture *tex, unsigned nr_images, unsigned w, unsigned h, unsigned d) { - struct pipe_texture *pt = &tex->base; - assert(level < PIPE_MAX_TEXTURE_LEVELS); - pt->nblocksx[level] = pf_get_nblocksx(&pt->block, w); - pt->nblocksy[level] = pf_get_nblocksy(&pt->block, h); - tex->nr_images[level] = nr_images; /* @@ -138,7 +129,7 @@ i915_miptree_set_image_offset(struct i915_texture *tex, assert(img < tex->nr_images[level]); - tex->image_offset[level][img] = y * tex->stride + x * tex->base.block.size; + tex->image_offset[level][img] = y * tex->stride + x * pf_get_blocksize(tex->base.format); /* printf("%s level %d img %d pos %d,%d image_offset %x\n", @@ -160,28 +151,28 @@ i915_scanout_layout(struct i915_texture *tex) { struct pipe_texture *pt = &tex->base; - if (pt->last_level > 0 || pt->block.size != 4) + if (pt->last_level > 0 || pf_get_blocksize(pt->format) != 4) return FALSE; i915_miptree_set_level_info(tex, 0, 1, - tex->base.width0, - tex->base.height0, + pt->width0, + pt->height0, 1); i915_miptree_set_image_offset(tex, 0, 0, 0, 0); - if (tex->base.width0 >= 240) { - tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size); - tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8); + if (pt->width0 >= 240) { + tex->stride = power_of_two(pf_get_stride(pt->format, pt->width0)); + tex->total_nblocksy = align(pf_get_nblocksy(pt->format, pt->height0), 8); tex->hw_tiled = INTEL_TILE_X; - } else if (tex->base.width0 == 64 && tex->base.height0 == 64) { - tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size); - tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8); + } else if (pt->width0 == 64 && pt->height0 == 64) { + tex->stride = power_of_two(pf_get_stride(pt->format, pt->width0)); + tex->total_nblocksy = align(pf_get_nblocksy(pt->format, pt->height0), 8); } else { return FALSE; } debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__, - tex->base.width0, tex->base.height0, pt->block.size, + pt->width0, pt->height0, pf_get_blocksize(pt->format), tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy); return TRUE; @@ -195,25 +186,25 @@ i915_display_target_layout(struct i915_texture *tex) { struct pipe_texture *pt = &tex->base; - if (pt->last_level > 0 || pt->block.size != 4) + if (pt->last_level > 0 || pf_get_blocksize(pt->format) != 4) return FALSE; /* fallback to normal textures for small textures */ - if (tex->base.width0 < 240) + if (pt->width0 < 240) return FALSE; i915_miptree_set_level_info(tex, 0, 1, - tex->base.width0, - tex->base.height0, + pt->width0, + pt->height0, 1); i915_miptree_set_image_offset(tex, 0, 0, 0, 0); - tex->stride = power_of_two(tex->base.nblocksx[0] * pt->block.size); - tex->total_nblocksy = round_up(tex->base.nblocksy[0], 8); + tex->stride = power_of_two(pf_get_stride(pt->format, pt->width0)); + tex->total_nblocksy = align(pf_get_nblocksy(pt->format, pt->height0), 8); tex->hw_tiled = INTEL_TILE_X; debug_printf("%s size: %d,%d,%d offset %d,%d (0x%x)\n", __FUNCTION__, - tex->base.width0, tex->base.height0, pt->block.size, + pt->width0, pt->height0, pf_get_blocksize(pt->format), tex->stride, tex->total_nblocksy, tex->stride * tex->total_nblocksy); return TRUE; @@ -226,34 +217,32 @@ i915_miptree_layout_2d(struct i915_texture *tex) unsigned level; unsigned width = pt->width0; unsigned height = pt->height0; - unsigned nblocksx = pt->nblocksx[0]; - unsigned nblocksy = pt->nblocksy[0]; + unsigned nblocksy = pf_get_nblocksy(pt->format, pt->width0); /* used for scanouts that need special layouts */ - if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_PRIMARY) + if (pt->tex_usage & PIPE_TEXTURE_USAGE_PRIMARY) if (i915_scanout_layout(tex)) return; /* for shared buffers we use some very like scanout */ - if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET) + if (pt->tex_usage & PIPE_TEXTURE_USAGE_DISPLAY_TARGET) if (i915_display_target_layout(tex)) return; - tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4); + tex->stride = align(pf_get_stride(pt->format, pt->width0), 4); tex->total_nblocksy = 0; for (level = 0; level <= pt->last_level; level++) { i915_miptree_set_level_info(tex, level, 1, width, height, 1); i915_miptree_set_image_offset(tex, level, 0, 0, tex->total_nblocksy); - nblocksy = round_up(MAX2(2, nblocksy), 2); + nblocksy = align(MAX2(2, nblocksy), 2); tex->total_nblocksy += nblocksy; width = u_minify(width, 1); height = u_minify(height, 1); - nblocksx = pf_get_nblocksx(&pt->block, width); - nblocksy = pf_get_nblocksy(&pt->block, height); + nblocksy = pf_get_nblocksy(pt->format, height); } } @@ -266,13 +255,12 @@ i915_miptree_layout_3d(struct i915_texture *tex) unsigned width = pt->width0; unsigned height = pt->height0; unsigned depth = pt->depth0; - unsigned nblocksx = pt->nblocksx[0]; - unsigned nblocksy = pt->nblocksy[0]; + unsigned nblocksy = pf_get_nblocksy(pt->format, pt->height0); unsigned stack_nblocksy = 0; /* Calculate the size of a single slice. */ - tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4); + tex->stride = align(pf_get_stride(pt->format, pt->width0), 4); /* XXX: hardware expects/requires 9 levels at minimum. */ @@ -283,8 +271,7 @@ i915_miptree_layout_3d(struct i915_texture *tex) width = u_minify(width, 1); height = u_minify(height, 1); - nblocksx = pf_get_nblocksx(&pt->block, width); - nblocksy = pf_get_nblocksy(&pt->block, height); + nblocksy = pf_get_nblocksy(pt->format, height); } /* Fixup depth image_offsets: @@ -309,14 +296,14 @@ i915_miptree_layout_cube(struct i915_texture *tex) { struct pipe_texture *pt = &tex->base; unsigned width = pt->width0, height = pt->height0; - const unsigned nblocks = pt->nblocksx[0]; + const unsigned nblocks = pf_get_nblocksx(pt->format, pt->width0); unsigned level; unsigned face; assert(width == height); /* cubemap images are square */ /* double pitch for cube layouts */ - tex->stride = round_up(nblocks * pt->block.size * 2, 4); + tex->stride = align(nblocks * pf_get_blocksize(pt->format) * 2, 4); tex->total_nblocksy = nblocks * 4; for (level = 0; level <= pt->last_level; level++) { @@ -379,8 +366,8 @@ i945_miptree_layout_2d(struct i915_texture *tex) unsigned y = 0; unsigned width = pt->width0; unsigned height = pt->height0; - unsigned nblocksx = pt->nblocksx[0]; - unsigned nblocksy = pt->nblocksy[0]; + unsigned nblocksx = pf_get_nblocksx(pt->format, pt->width0); + unsigned nblocksy = pf_get_nblocksy(pt->format, pt->height0); /* used for scanouts that need special layouts */ if (tex->base.tex_usage & PIPE_TEXTURE_USAGE_PRIMARY) @@ -392,7 +379,7 @@ i945_miptree_layout_2d(struct i915_texture *tex) if (i915_display_target_layout(tex)) return; - tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4); + tex->stride = align(pf_get_stride(pt->format, pt->width0), 4); /* May need to adjust pitch to accomodate the placement of * the 2nd mipmap level. This occurs when the alignment @@ -401,11 +388,11 @@ i945_miptree_layout_2d(struct i915_texture *tex) */ if (pt->last_level > 0) { unsigned mip1_nblocksx - = align(pf_get_nblocksx(&pt->block, u_minify(width, 1)), align_x) - + pf_get_nblocksx(&pt->block, u_minify(width, 2)); + = align(pf_get_nblocksx(pt->format, u_minify(width, 1)), align_x) + + pf_get_nblocksx(pt->format, u_minify(width, 2)); if (mip1_nblocksx > nblocksx) - tex->stride = mip1_nblocksx * pt->block.size; + tex->stride = mip1_nblocksx * pf_get_blocksize(pt->format); } /* Pitch must be a whole number of dwords @@ -435,8 +422,8 @@ i945_miptree_layout_2d(struct i915_texture *tex) width = u_minify(width, 1); height = u_minify(height, 1); - nblocksx = pf_get_nblocksx(&pt->block, width); - nblocksy = pf_get_nblocksy(&pt->block, height); + nblocksx = pf_get_nblocksx(pt->format, width); + nblocksy = pf_get_nblocksy(pt->format, height); } } @@ -447,17 +434,16 @@ i945_miptree_layout_3d(struct i915_texture *tex) unsigned width = pt->width0; unsigned height = pt->height0; unsigned depth = pt->depth0; - unsigned nblocksx = pt->nblocksx[0]; - unsigned nblocksy = pt->nblocksy[0]; + unsigned nblocksy = pf_get_nblocksy(pt->format, pt->width0); unsigned pack_x_pitch, pack_x_nr; unsigned pack_y_pitch; unsigned level; - tex->stride = round_up(pt->nblocksx[0] * pt->block.size, 4); + tex->stride = align(pf_get_stride(pt->format, pt->width0), 4); tex->total_nblocksy = 0; - pack_y_pitch = MAX2(pt->nblocksy[0], 2); - pack_x_pitch = tex->stride / pt->block.size; + pack_y_pitch = MAX2(nblocksy, 2); + pack_x_pitch = tex->stride / pf_get_blocksize(pt->format); pack_x_nr = 1; for (level = 0; level <= pt->last_level; level++) { @@ -482,7 +468,7 @@ i945_miptree_layout_3d(struct i915_texture *tex) if (pack_x_pitch > 4) { pack_x_pitch >>= 1; pack_x_nr <<= 1; - assert(pack_x_pitch * pack_x_nr * pt->block.size <= tex->stride); + assert(pack_x_pitch * pack_x_nr * pf_get_blocksize(pt->format) <= tex->stride); } if (pack_y_pitch > 2) { @@ -492,8 +478,7 @@ i945_miptree_layout_3d(struct i915_texture *tex) width = u_minify(width, 1); height = u_minify(height, 1); depth = u_minify(depth, 1); - nblocksx = pf_get_nblocksx(&pt->block, width); - nblocksy = pf_get_nblocksy(&pt->block, height); + nblocksy = pf_get_nblocksy(pt->format, height); } } @@ -503,7 +488,7 @@ i945_miptree_layout_cube(struct i915_texture *tex) struct pipe_texture *pt = &tex->base; unsigned level; - const unsigned nblocks = pt->nblocksx[0]; + const unsigned nblocks = pf_get_nblocksx(pt->format, pt->width0); unsigned face; unsigned width = pt->width0; unsigned height = pt->height0; @@ -523,9 +508,9 @@ i945_miptree_layout_cube(struct i915_texture *tex) * or the final row of 4x4, 2x2 and 1x1 faces below this. */ if (nblocks > 32) - tex->stride = round_up(nblocks * pt->block.size * 2, 4); + tex->stride = align(nblocks * pf_get_blocksize(pt->format) * 2, 4); else - tex->stride = 14 * 8 * pt->block.size; + tex->stride = 14 * 8 * pf_get_blocksize(pt->format); tex->total_nblocksy = nblocks * 4; @@ -645,9 +630,6 @@ i915_texture_create(struct pipe_screen *screen, pipe_reference_init(&tex->base.reference, 1); tex->base.screen = screen; - tex->base.nblocksx[0] = pf_get_nblocksx(&tex->base.block, tex->base.width0); - tex->base.nblocksy[0] = pf_get_nblocksy(&tex->base.block, tex->base.height0); - if (is->is_i945) { if (!i945_miptree_layout(tex)) goto fail; @@ -829,14 +811,10 @@ i915_get_tex_transfer(struct pipe_screen *screen, trans = CALLOC_STRUCT(i915_transfer); if (trans) { pipe_texture_reference(&trans->base.texture, texture); - trans->base.format = trans->base.format; trans->base.x = x; trans->base.y = y; trans->base.width = w; trans->base.height = h; - trans->base.block = texture->block; - trans->base.nblocksx = texture->nblocksx[level]; - trans->base.nblocksy = texture->nblocksy[level]; trans->base.stride = tex->stride; trans->offset = offset; trans->base.usage = usage; @@ -852,6 +830,7 @@ i915_transfer_map(struct pipe_screen *screen, struct intel_winsys *iws = i915_screen(tex->base.screen)->iws; char *map; boolean write = FALSE; + enum pipe_format format = tex->base.format; if (transfer->usage & PIPE_TRANSFER_WRITE) write = TRUE; @@ -861,8 +840,8 @@ i915_transfer_map(struct pipe_screen *screen, return NULL; return map + i915_transfer(transfer)->offset + - transfer->y / transfer->block.height * transfer->stride + - transfer->x / transfer->block.width * transfer->block.size; + transfer->y / pf_get_blockheight(format) * transfer->stride + + transfer->x / pf_get_blockwidth(format) * pf_get_blocksize(format); } static void diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index ffcbc9a379..b4aabd4d7c 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -166,7 +166,7 @@ shade_quads(struct llvmpipe_context *llvmpipe, assert((y % 2) == 0); depth = llvmpipe->zsbuf_map + y*llvmpipe->zsbuf_transfer->stride + - 2*x*llvmpipe->zsbuf_transfer->block.size; + 2*x*pf_get_blocksize(llvmpipe->zsbuf_transfer->texture->format); } else depth = NULL; diff --git a/src/gallium/drivers/llvmpipe/lp_tex_cache.c b/src/gallium/drivers/llvmpipe/lp_tex_cache.c index c7c4143bc6..5dbc597d2c 100644 --- a/src/gallium/drivers/llvmpipe/lp_tex_cache.c +++ b/src/gallium/drivers/llvmpipe/lp_tex_cache.c @@ -291,7 +291,7 @@ lp_find_cached_tex_tile(struct llvmpipe_tex_tile_cache *tc, assert(0); } - util_format_read_4ub(tc->tex_trans->format, + util_format_read_4ub(tc->tex_trans->texture->format, (uint8_t *)tile->color, sizeof tile->color[0], tc->tex_trans_map, tc->tex_trans->stride, x, y, w, h); diff --git a/src/gallium/drivers/llvmpipe/lp_texture.c b/src/gallium/drivers/llvmpipe/lp_texture.c index 65d62fd072..f099f903bd 100644 --- a/src/gallium/drivers/llvmpipe/lp_texture.c +++ b/src/gallium/drivers/llvmpipe/lp_texture.c @@ -48,7 +48,6 @@ /* Simple, maximally packed layout. */ - /* Conventional allocation path for non-display textures: */ static boolean @@ -63,20 +62,15 @@ llvmpipe_texture_layout(struct llvmpipe_screen *screen, unsigned buffer_size = 0; - pf_get_block(lpt->base.format, &lpt->base.block); - for (level = 0; level <= pt->last_level; level++) { unsigned nblocksx, nblocksy; - pt->nblocksx[level] = pf_get_nblocksx(&pt->block, width); - pt->nblocksy[level] = pf_get_nblocksy(&pt->block, height); - /* Allocate storage for whole quads. This is particularly important * for depth surfaces, which are currently stored in a swizzled format. */ - nblocksx = pf_get_nblocksx(&pt->block, align(width, 2)); - nblocksy = pf_get_nblocksy(&pt->block, align(height, 2)); + nblocksx = pf_get_nblocksx(pt->format, align(width, 2)); + nblocksy = pf_get_nblocksy(pt->format, align(height, 2)); - lpt->stride[level] = align(nblocksx*pt->block.size, 16); + lpt->stride[level] = align(nblocksx * pf_get_blocksize(pt->format), 16); lpt->level_offset[level] = buffer_size; @@ -100,10 +94,6 @@ llvmpipe_displaytarget_layout(struct llvmpipe_screen *screen, { struct llvmpipe_winsys *winsys = screen->winsys; - pf_get_block(lpt->base.format, &lpt->base.block); - lpt->base.nblocksx[0] = pf_get_nblocksx(&lpt->base.block, lpt->base.width0); - lpt->base.nblocksy[0] = pf_get_nblocksy(&lpt->base.block, lpt->base.height0); - lpt->dt = winsys->displaytarget_create(winsys, lpt->base.format, lpt->base.width0, @@ -180,8 +170,6 @@ llvmpipe_texture_blanket(struct pipe_screen * screen, lpt->base = *base; pipe_reference_init(&lpt->base.reference, 1); lpt->base.screen = screen; - lpt->base.nblocksx[0] = pf_get_nblocksx(&lpt->base.block, lpt->base.width0); - lpt->base.nblocksy[0] = pf_get_nblocksy(&lpt->base.block, lpt->base.height0); lpt->stride[0] = stride[0]; pipe_buffer_reference(&lpt->buffer, buffer); @@ -255,11 +243,17 @@ llvmpipe_get_tex_surface(struct pipe_screen *screen, ps->level = level; ps->zslice = zslice; + /* XXX shouldn't that rather be + tex_height = align(ps->height, 2); + to account for alignment done in llvmpipe_texture_layout ? + */ if (pt->target == PIPE_TEXTURE_CUBE) { - ps->offset += face * pt->nblocksy[level] * lpt->stride[level]; + unsigned tex_height = ps->height; + ps->offset += face * pf_get_nblocksy(pt->format, tex_height) * lpt->stride[level]; } else if (pt->target == PIPE_TEXTURE_3D) { - ps->offset += zslice * pt->nblocksy[level] * lpt->stride[level]; + unsigned tex_height = ps->height; + ps->offset += zslice * pf_get_nblocksy(pt->format, tex_height) * lpt->stride[level]; } else { assert(face == 0); @@ -300,14 +294,10 @@ llvmpipe_get_tex_transfer(struct pipe_screen *screen, if (lpt) { struct pipe_transfer *pt = &lpt->base; pipe_texture_reference(&pt->texture, texture); - pt->format = texture->format; - pt->block = texture->block; pt->x = x; pt->y = y; pt->width = w; pt->height = h; - pt->nblocksx = texture->nblocksx[level]; - pt->nblocksy = texture->nblocksy[level]; pt->stride = lptex->stride[level]; pt->usage = usage; pt->face = face; @@ -316,11 +306,17 @@ llvmpipe_get_tex_transfer(struct pipe_screen *screen, lpt->offset = lptex->level_offset[level]; + /* XXX shouldn't that rather be + tex_height = align(u_minify(texture->height0, level), 2) + to account for alignment done in llvmpipe_texture_layout ? + */ if (texture->target == PIPE_TEXTURE_CUBE) { - lpt->offset += face * pt->nblocksy * pt->stride; + unsigned tex_height = u_minify(texture->height0, level); + lpt->offset += face * pf_get_nblocksy(texture->format, tex_height) * pt->stride; } else if (texture->target == PIPE_TEXTURE_3D) { - lpt->offset += zslice * pt->nblocksy * pt->stride; + unsigned tex_height = u_minify(texture->height0, level); + lpt->offset += zslice * pf_get_nblocksy(texture->format, tex_height) * pt->stride; } else { assert(face == 0); @@ -352,9 +348,11 @@ llvmpipe_transfer_map( struct pipe_screen *_screen, struct llvmpipe_screen *screen = llvmpipe_screen(_screen); ubyte *map, *xfer_map; struct llvmpipe_texture *lpt; + enum pipe_format format; assert(transfer->texture); lpt = llvmpipe_texture(transfer->texture); + format = lpt->base.format; if(lpt->dt) { struct llvmpipe_winsys *winsys = screen->winsys; @@ -379,8 +377,8 @@ llvmpipe_transfer_map( struct pipe_screen *_screen, } xfer_map = map + llvmpipe_transfer(transfer)->offset + - transfer->y / transfer->block.height * transfer->stride + - transfer->x / transfer->block.width * transfer->block.size; + transfer->y / pf_get_blockheight(format) * transfer->stride + + transfer->x / pf_get_blockwidth(format) * pf_get_blocksize(format); /*printf("map = %p xfer map = %p\n", map, xfer_map);*/ return xfer_map; } diff --git a/src/gallium/drivers/llvmpipe/lp_tile_cache.c b/src/gallium/drivers/llvmpipe/lp_tile_cache.c index ec3e002d62..50891c4227 100644 --- a/src/gallium/drivers/llvmpipe/lp_tile_cache.c +++ b/src/gallium/drivers/llvmpipe/lp_tile_cache.c @@ -252,13 +252,13 @@ lp_flush_tile_cache(struct llvmpipe_tile_cache *tc) case LP_TILE_STATUS_CLEAR: /* Actually clear the tiles which were flagged as being in a * clear state. */ - util_fill_rect(tc->transfer_map, &pt->block, pt->stride, + util_fill_rect(tc->transfer_map, pt->texture->format, pt->stride, x, y, w, h, tc->clear_val); break; case LP_TILE_STATUS_DEFINED: - lp_tile_write_4ub(pt->format, + lp_tile_write_4ub(pt->texture->format, tile->color, tc->transfer_map, pt->stride, x, y, w, h); @@ -306,7 +306,7 @@ lp_get_cached_tile(struct llvmpipe_tile_cache *tc, y &= ~(TILE_SIZE - 1); if (!pipe_clip_tile(x, y, &w, &h, tc->transfer)) - lp_tile_read_4ub(pt->format, + lp_tile_read_4ub(pt->texture->format, tile->color, tc->transfer_map, tc->transfer->stride, x, y, w, h); diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 98a39390bf..a479842f9e 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -631,10 +631,10 @@ void r300_emit_aos(struct r300_context* r300, unsigned offset) for (i = 0; i < aos_count - 1; i += 2) { int buf_num1 = velem[i].vertex_buffer_index; int buf_num2 = velem[i+1].vertex_buffer_index; - assert(vbuf[buf_num1].stride % 4 == 0 && pf_get_size(velem[i].src_format) % 4 == 0); - assert(vbuf[buf_num2].stride % 4 == 0 && pf_get_size(velem[i+1].src_format) % 4 == 0); - OUT_CS((pf_get_size(velem[i].src_format) >> 2) | (vbuf[buf_num1].stride << 6) | - (pf_get_size(velem[i+1].src_format) << 14) | (vbuf[buf_num2].stride << 22)); + assert(vbuf[buf_num1].stride % 4 == 0 && pf_get_blocksize(velem[i].src_format) % 4 == 0); + assert(vbuf[buf_num2].stride % 4 == 0 && pf_get_blocksize(velem[i+1].src_format) % 4 == 0); + OUT_CS((pf_get_blocksize(velem[i].src_format) >> 2) | (vbuf[buf_num1].stride << 6) | + (pf_get_blocksize(velem[i+1].src_format) << 14) | (vbuf[buf_num2].stride << 22)); OUT_CS(vbuf[buf_num1].buffer_offset + velem[i].src_offset + offset * vbuf[buf_num1].stride); OUT_CS(vbuf[buf_num2].buffer_offset + velem[i+1].src_offset + @@ -642,8 +642,8 @@ void r300_emit_aos(struct r300_context* r300, unsigned offset) } if (aos_count & 1) { int buf_num = velem[i].vertex_buffer_index; - assert(vbuf[buf_num].stride % 4 == 0 && pf_get_size(velem[i].src_format) % 4 == 0); - OUT_CS((pf_get_size(velem[i].src_format) >> 2) | (vbuf[buf_num].stride << 6)); + assert(vbuf[buf_num].stride % 4 == 0 && pf_get_blocksize(velem[i].src_format) % 4 == 0); + OUT_CS((pf_get_blocksize(velem[i].src_format) >> 2) | (vbuf[buf_num].stride << 6)); OUT_CS(vbuf[buf_num].buffer_offset + velem[i].src_offset + offset * vbuf[buf_num].stride); } diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 390b63007e..032fa69ec0 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -311,14 +311,10 @@ r300_get_tex_transfer(struct pipe_screen *screen, trans = CALLOC_STRUCT(r300_transfer); if (trans) { pipe_texture_reference(&trans->transfer.texture, texture); - trans->transfer.format = texture->format; trans->transfer.x = x; trans->transfer.y = y; trans->transfer.width = w; trans->transfer.height = h; - trans->transfer.block = texture->block; - trans->transfer.nblocksx = texture->nblocksx[level]; - trans->transfer.nblocksy = texture->nblocksy[level]; trans->transfer.stride = r300_texture_get_stride(tex, level); trans->transfer.usage = usage; @@ -344,6 +340,7 @@ static void* r300_transfer_map(struct pipe_screen* screen, { struct r300_texture* tex = (struct r300_texture*)transfer->texture; char* map; + enum pipe_format format = tex->tex.format; map = pipe_buffer_map(screen, tex->buffer, pipe_transfer_buffer_flags(transfer)); @@ -353,8 +350,8 @@ static void* r300_transfer_map(struct pipe_screen* screen, } return map + r300_transfer(transfer)->offset + - transfer->y / transfer->block.height * transfer->stride + - transfer->x / transfer->block.width * transfer->block.size; + transfer->y / pf_get_blockheight(format) * transfer->stride + + transfer->x / pf_get_blockwidth(format) * pf_get_blocksize(format); } static void r300_transfer_unmap(struct pipe_screen* screen, diff --git a/src/gallium/drivers/r300/r300_texture.c b/src/gallium/drivers/r300/r300_texture.c index 093a21ebe2..63fc6a235a 100644 --- a/src/gallium/drivers/r300/r300_texture.c +++ b/src/gallium/drivers/r300/r300_texture.c @@ -105,7 +105,7 @@ unsigned r300_texture_get_stride(struct r300_texture* tex, unsigned level) return 0; } - return align(pf_get_stride(&tex->tex.block, u_minify(tex->tex.width0, level)), 32); + return align(pf_get_stride(tex->tex.format, u_minify(tex->tex.width0, level)), 32); } static void r300_setup_miptree(struct r300_texture* tex) @@ -115,11 +115,10 @@ static void r300_setup_miptree(struct r300_texture* tex) int i; for (i = 0; i <= base->last_level; i++) { - base->nblocksx[i] = pf_get_nblocksx(&base->block, u_minify(base->width0, i)); - base->nblocksy[i] = pf_get_nblocksy(&base->block, u_minify(base->height0, i)); + unsigned nblocksy = pf_get_nblocksy(base->format, u_minify(base->height0, i)); stride = r300_texture_get_stride(tex, i); - layer_size = stride * base->nblocksy[i]; + layer_size = stride * nblocksy; if (base->target == PIPE_TEXTURE_CUBE) size = layer_size * 6; @@ -129,7 +128,7 @@ static void r300_setup_miptree(struct r300_texture* tex) tex->offset[i] = align(tex->size, 32); tex->size = tex->offset[i] + size; tex->layer_size[i] = layer_size; - tex->pitch[i] = stride / base->block.size; + tex->pitch[i] = stride / pf_get_blocksize(base->format); debug_printf("r300: Texture miptree: Level %d " "(%dx%dx%d px, pitch %d bytes)\n", @@ -245,7 +244,7 @@ static struct pipe_texture* tex->tex.screen = screen; tex->stride_override = *stride; - tex->pitch[0] = *stride / base->block.size; + tex->pitch[0] = *stride / pf_get_blocksize(base->format); r300_setup_flags(tex); r300_setup_texture_state(tex, r300_screen(screen)->caps->is_r500); @@ -283,7 +282,6 @@ r300_video_surface_create(struct pipe_screen *screen, template.width0 = util_next_power_of_two(width); template.height0 = util_next_power_of_two(height); template.depth0 = 1; - pf_get_block(template.format, &template.block); template.tex_usage = PIPE_TEXTURE_USAGE_SAMPLER | PIPE_TEXTURE_USAGE_RENDER_TARGET; diff --git a/src/gallium/drivers/svga/svga_screen_texture.c b/src/gallium/drivers/svga/svga_screen_texture.c index fb11b80dcf..410adf881b 100644 --- a/src/gallium/drivers/svga/svga_screen_texture.c +++ b/src/gallium/drivers/svga/svga_screen_texture.c @@ -158,7 +158,8 @@ svga_transfer_dma_band(struct svga_transfer *st, st->base.x + st->base.width, y + h, st->base.zslice + 1, - texture->base.block.size*8/(texture->base.block.width*texture->base.block.height)); + pf_get_blocksize(texture->base.format)*8/ + (pf_get_blockwidth(texture->base.format)*pf_get_blockheight(texture->base.format))); box.x = st->base.x; box.y = y; @@ -208,7 +209,8 @@ svga_transfer_dma(struct svga_transfer *st, } else { unsigned y, h, srcy; - h = st->hw_nblocksy * st->base.block.height; + unsigned blockheight = pf_get_blockheight(st->base.texture->format); + h = st->hw_nblocksy * blockheight; srcy = 0; for(y = 0; y < st->base.height; y += h) { unsigned offset, length; @@ -218,11 +220,11 @@ svga_transfer_dma(struct svga_transfer *st, h = st->base.height - y; /* Transfer band must be aligned to pixel block boundaries */ - assert(y % st->base.block.height == 0); - assert(h % st->base.block.height == 0); + assert(y % blockheight == 0); + assert(h % blockheight == 0); - offset = y * st->base.stride / st->base.block.height; - length = h * st->base.stride / st->base.block.height; + offset = y * st->base.stride / blockheight; + length = h * st->base.stride / blockheight; sw = (uint8_t *)st->swbuf + offset; @@ -291,8 +293,6 @@ svga_texture_create(struct pipe_screen *screen, height = templat->height0; depth = templat->depth0; for(level = 0; level <= templat->last_level; ++level) { - tex->base.nblocksx[level] = pf_get_nblocksx(&tex->base.block, width); - tex->base.nblocksy[level] = pf_get_nblocksy(&tex->base.block, height); width = u_minify(width, 1); height = u_minify(height, 1); depth = u_minify(depth, 1); @@ -750,6 +750,8 @@ svga_get_tex_transfer(struct pipe_screen *screen, struct svga_screen *ss = svga_screen(screen); struct svga_winsys_screen *sws = ss->sws; struct svga_transfer *st; + unsigned nblocksx = pf_get_nblocksx(texture->format, w); + unsigned nblocksy = pf_get_nblocksy(texture->format, h); /* We can't map texture storage directly */ if (usage & PIPE_TRANSFER_MAP_DIRECTLY) @@ -759,21 +761,17 @@ svga_get_tex_transfer(struct pipe_screen *screen, if (!st) return NULL; - st->base.format = texture->format; - st->base.block = texture->block; st->base.x = x; st->base.y = y; st->base.width = w; st->base.height = h; - st->base.nblocksx = pf_get_nblocksx(&texture->block, w); - st->base.nblocksy = pf_get_nblocksy(&texture->block, h); - st->base.stride = st->base.nblocksx*st->base.block.size; + st->base.stride = nblocksx*pf_get_blocksize(texture->format); st->base.usage = usage; st->base.face = face; st->base.level = level; st->base.zslice = zslice; - st->hw_nblocksy = st->base.nblocksy; + st->hw_nblocksy = nblocksy; st->hwbuf = svga_winsys_buffer_create(ss, 1, @@ -789,15 +787,15 @@ svga_get_tex_transfer(struct pipe_screen *screen, if(!st->hwbuf) goto no_hwbuf; - if(st->hw_nblocksy < st->base.nblocksy) { + if(st->hw_nblocksy < nblocksy) { /* We couldn't allocate a hardware buffer big enough for the transfer, * so allocate regular malloc memory instead */ debug_printf("%s: failed to allocate %u KB of DMA, splitting into %u x %u KB DMA transfers\n", __FUNCTION__, - (st->base.nblocksy*st->base.stride + 1023)/1024, - (st->base.nblocksy + st->hw_nblocksy - 1)/st->hw_nblocksy, + (nblocksy*st->base.stride + 1023)/1024, + (nblocksy + st->hw_nblocksy - 1)/st->hw_nblocksy, (st->hw_nblocksy*st->base.stride + 1023)/1024); - st->swbuf = MALLOC(st->base.nblocksy*st->base.stride); + st->swbuf = MALLOC(nblocksy*st->base.stride); if(!st->swbuf) goto no_swbuf; } @@ -1046,8 +1044,7 @@ svga_screen_buffer_from_texture(struct pipe_texture *texture, svga_translate_format(texture->format), stex->handle); - *stride = pf_get_nblocksx(&texture->block, texture->width0) * - texture->block.size; + *stride = pf_get_stride(texture->format, texture->width0); return *buffer != NULL; } diff --git a/src/gallium/drivers/svga/svga_state_vs.c b/src/gallium/drivers/svga/svga_state_vs.c index a947745732..f1b0daf9f6 100644 --- a/src/gallium/drivers/svga/svga_state_vs.c +++ b/src/gallium/drivers/svga/svga_state_vs.c @@ -210,7 +210,7 @@ static int update_zero_stride( struct svga_context *svga, mapped_buffer = pipe_buffer_map_range(svga->pipe.screen, vbuffer->buffer, vel->src_offset, - pf_get_size(vel->src_format), + pf_get_blocksize(vel->src_format), PIPE_BUFFER_USAGE_CPU_READ); translate->set_buffer(translate, vel->vertex_buffer_index, mapped_buffer, -- cgit v1.2.3 From b47f7316dab5eb81bc7e60dc93bb5dbe824c43d4 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 2 Dec 2009 12:15:46 -0800 Subject: mesa: Fix copy'n'paste problem in al1616 texel fetch. --- src/mesa/main/texfetch_tmp.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texfetch_tmp.h b/src/mesa/main/texfetch_tmp.h index 1f0d436236..e6772c89f3 100644 --- a/src/mesa/main/texfetch_tmp.h +++ b/src/mesa/main/texfetch_tmp.h @@ -864,7 +864,7 @@ static void store_texel_al88_rev(struct gl_texture_image *texImage, static void FETCH(f_al1616)( const struct gl_texture_image *texImage, GLint i, GLint j, GLint k, GLfloat *texel ) { - const GLuint s = *TEXEL_ADDR(GLushort, texImage, i, j, k, 1); + const GLuint s = *TEXEL_ADDR(GLuint, texImage, i, j, k, 1); texel[RCOMP] = texel[GCOMP] = texel[BCOMP] = USHORT_TO_FLOAT( s & 0xffff ); -- cgit v1.2.3 From db352f58fab419c475b89418cd27b35f5f5d3822 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 2 Dec 2009 12:42:36 -0800 Subject: mesa: Fix bad conversion in AL1616_REV texstore. --- src/mesa/main/texstore.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 5387eb1283..792c83141e 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -2197,18 +2197,22 @@ _mesa_texstore_al1616(TEXSTORE_PARAMS) GLuint *dstUI = (GLuint *) dstRow; if (dstFormat == MESA_FORMAT_AL1616) { for (col = 0; col < srcWidth; col++) { - /* src[0] is luminance, src[1] is alpha */ - dstUI[col] = PACK_COLOR_1616( FLOAT_TO_USHORT(src[1]), - FLOAT_TO_USHORT(src[0]) ); - src += 2; + GLushort l, a; + + UNCLAMPED_FLOAT_TO_USHORT(l, src[0]); + UNCLAMPED_FLOAT_TO_USHORT(a, src[1]); + dstUI[col] = PACK_COLOR_1616(a, l); + src += 2; } } else { for (col = 0; col < srcWidth; col++) { - /* src[0] is luminance, src[1] is alpha */ - dstUI[col] = PACK_COLOR_1616_REV( FLOAT_TO_UBYTE(src[1]), - FLOAT_TO_UBYTE(src[0]) ); - src += 2; + GLushort l, a; + + UNCLAMPED_FLOAT_TO_USHORT(l, src[0]); + UNCLAMPED_FLOAT_TO_USHORT(a, src[1]); + dstUI[col] = PACK_COLOR_1616_REV(a, l); + src += 2; } } dstRow += dstRowStride; -- cgit v1.2.3 From 4598942b1b88a2a7d5af7febae7e79eedf00e385 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 2 Dec 2009 13:00:15 -0800 Subject: intel: Make RGB renderbuffers use XRGB8888 like we do for RGB system buffers. --- src/mesa/drivers/dri/intel/intel_fbo.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 5615040946..b6e0d823ed 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -126,7 +126,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_RGB16: rb->Format = MESA_FORMAT_ARGB8888; rb->DataType = GL_UNSIGNED_BYTE; - irb->texformat = MESA_FORMAT_ARGB8888; /* XXX: Need xrgb8888 */ + irb->texformat = MESA_FORMAT_XRGB8888; cpp = 4; break; case GL_RGBA: @@ -314,10 +314,6 @@ intel_create_renderbuffer(gl_format format) irb->Base.DataType = GL_UNSIGNED_BYTE; break; case MESA_FORMAT_XRGB8888: - /* XXX this is a hack since XRGB surfaces don't seem to work - * properly yet. Reading the alpha channel returns 0 instead of 1. - */ - format = MESA_FORMAT_ARGB8888; irb->Base._BaseFormat = GL_RGB; irb->Base.DataType = GL_UNSIGNED_BYTE; break; -- cgit v1.2.3 From 7fc75ef7d43038385b5fba73a67f1e4783b045d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 3 Dec 2009 18:18:46 +0000 Subject: util: Fix generated swizzle comments. --- src/gallium/auxiliary/util/u_format_table.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_format_table.py b/src/gallium/auxiliary/util/u_format_table.py index 8834568e8e..2cd0f95678 100755 --- a/src/gallium/auxiliary/util/u_format_table.py +++ b/src/gallium/auxiliary/util/u_format_table.py @@ -44,11 +44,10 @@ def colorspace_map(colorspace): colorspace_channels_map = { - 'rgb': 'rgba', - 'rgba': 'rgba', - 'zs': 'zs', - 'yuv': ['y1', 'y2', 'u', 'v'], - 'dxt': [] + 'rgb': ['r', 'g', 'b', 'a'], + 'srgb': ['sr', 'sg', 'sb', 'a'], + 'zs': ['z', 's'], + 'yuv': ['y', 'u', 'v'], } @@ -94,7 +93,7 @@ def write_format_table(formats): print " {" print " %s," % (format.name,) print " \"%s\"," % (format.name,) - print " {%u, %u, %u}, /* block */" % (format.block_width, format.block_height, format.block_size()) + print " {%u, %u, %u},\t/* block */" % (format.block_width, format.block_height, format.block_size()) print " %s," % (layout_map(format.layout),) print " {" for i in range(4): @@ -103,7 +102,7 @@ def write_format_table(formats): sep = "," else: sep = "" - print " {%s, %s, %u}%s /* %s */" % (kind_map[type.kind], bool_map(type.norm), type.size, sep, "xyzw"[i]) + print " {%s, %s, %u}%s\t/* %s */" % (kind_map[type.kind], bool_map(type.norm), type.size, sep, "xyzw"[i]) print " }," print " {" for i in range(4): @@ -113,10 +112,10 @@ def write_format_table(formats): else: sep = "" try: - comment = layout_channels_map[format.layout][i] - except: + comment = colorspace_channels_map[format.colorspace][i] + except (KeyError, IndexError): comment = 'ignored' - print " %s%s /* %s */" % (swizzle_map[swizzle], sep, comment) + print " %s%s\t/* %s */" % (swizzle_map[swizzle], sep, comment) print " }," print " %s," % (colorspace_map(format.colorspace),) print " }," -- cgit v1.2.3 From 94b5c28a98850f42fbcdab9ceda1450279e1e6fd Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Wed, 2 Dec 2009 16:55:33 +0100 Subject: gallium: adapt nv drivers to interface cleanups --- src/gallium/drivers/nv04/nv04_miptree.c | 13 ++------ src/gallium/drivers/nv04/nv04_surface_2d.c | 12 ++++---- src/gallium/drivers/nv04/nv04_transfer.c | 9 +----- src/gallium/drivers/nv10/nv10_miptree.c | 11 ++----- src/gallium/drivers/nv10/nv10_transfer.c | 9 +----- src/gallium/drivers/nv20/nv20_miptree.c | 10 ++----- src/gallium/drivers/nv20/nv20_transfer.c | 9 +----- src/gallium/drivers/nv30/nv30_miptree.c | 11 ++----- src/gallium/drivers/nv30/nv30_transfer.c | 9 +----- src/gallium/drivers/nv40/nv40_miptree.c | 11 ++----- src/gallium/drivers/nv40/nv40_transfer.c | 9 +----- src/gallium/drivers/nv50/nv50_miptree.c | 10 +++---- src/gallium/drivers/nv50/nv50_transfer.c | 48 +++++++++++++----------------- 13 files changed, 51 insertions(+), 120 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv04/nv04_miptree.c b/src/gallium/drivers/nv04/nv04_miptree.c index 4fd72c82e6..eeab6dfa30 100644 --- a/src/gallium/drivers/nv04/nv04_miptree.c +++ b/src/gallium/drivers/nv04/nv04_miptree.c @@ -10,28 +10,21 @@ static void nv04_miptree_layout(struct nv04_miptree *nv04mt) { struct pipe_texture *pt = &nv04mt->base; - uint width = pt->width0, height = pt->height0; uint offset = 0; int nr_faces, l; nr_faces = 1; for (l = 0; l <= pt->last_level; l++) { - - pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width); - pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height); - nv04mt->level[l].pitch = pt->width0; nv04mt->level[l].pitch = (nv04mt->level[l].pitch + 63) & ~63; - - width = u_minify(width, 1); - height = u_minify(height, 1); } for (l = 0; l <= pt->last_level; l++) { - nv04mt->level[l].image_offset = CALLOC(nr_faces, sizeof(unsigned)); + /* XXX guess was obviously missing */ + nv04mt->level[l].image_offset[0] = offset; offset += nv04mt->level[l].pitch * u_minify(pt->height0, l); } @@ -128,7 +121,7 @@ nv04_miptree_surface_new(struct pipe_screen *pscreen, struct pipe_texture *pt, ns->base.zslice = zslice; ns->pitch = nv04mt->level[level].pitch; - ns->base.offset = nv04mt->level[level].image_offset; + ns->base.offset = nv04mt->level[level].image_offset[0]; return &ns->base; } diff --git a/src/gallium/drivers/nv04/nv04_surface_2d.c b/src/gallium/drivers/nv04/nv04_surface_2d.c index 8be134b83d..932893eef5 100644 --- a/src/gallium/drivers/nv04/nv04_surface_2d.c +++ b/src/gallium/drivers/nv04/nv04_surface_2d.c @@ -155,10 +155,10 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx, sub_w = MIN2(sub_w, w - x); /* Must be 64-byte aligned */ - assert(!((dst->offset + nv04_swizzle_bits(dx+x, dy+y) * dst->texture->block.size) & 63)); + assert(!((dst->offset + nv04_swizzle_bits(dx+x, dy+y) * pf_get_blocksize(dst->texture->format)) & 63)); BEGIN_RING(chan, swzsurf, NV04_SWIZZLED_SURFACE_OFFSET, 1); - OUT_RELOCl(chan, dst_bo, dst->offset + nv04_swizzle_bits(dx+x, dy+y) * dst->texture->block.size, + OUT_RELOCl(chan, dst_bo, dst->offset + nv04_swizzle_bits(dx+x, dy+y) * pf_get_blocksize(dst->texture->format), NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_WR); BEGIN_RING(chan, sifm, NV04_SCALED_IMAGE_FROM_MEMORY_COLOR_CONVERSION, 9); @@ -177,7 +177,7 @@ nv04_surface_copy_swizzle(struct nv04_surface_2d *ctx, OUT_RING (chan, src_pitch | NV04_SCALED_IMAGE_FROM_MEMORY_FORMAT_ORIGIN_CENTER | NV04_SCALED_IMAGE_FROM_MEMORY_FORMAT_FILTER_POINT_SAMPLE); - OUT_RELOCl(chan, src_bo, src->offset + (sy+y) * src_pitch + (sx+x) * src->texture->block.size, + OUT_RELOCl(chan, src_bo, src->offset + (sy+y) * src_pitch + (sx+x) * pf_get_blocksize(src->texture->format), NOUVEAU_BO_GART | NOUVEAU_BO_VRAM | NOUVEAU_BO_RD); OUT_RING (chan, 0); } @@ -198,9 +198,9 @@ nv04_surface_copy_m2mf(struct nv04_surface_2d *ctx, unsigned src_pitch = ((struct nv04_surface *)src)->pitch; unsigned dst_pitch = ((struct nv04_surface *)dst)->pitch; unsigned dst_offset = dst->offset + dy * dst_pitch + - dx * dst->texture->block.size; + dx * pf_get_blocksize(dst->texture->format); unsigned src_offset = src->offset + sy * src_pitch + - sx * src->texture->block.size; + sx * pf_get_blocksize(src->texture->format); WAIT_RING (chan, 3 + ((h / 2047) + 1) * 9); BEGIN_RING(chan, m2mf, NV04_MEMORY_TO_MEMORY_FORMAT_DMA_BUFFER_IN, 2); @@ -219,7 +219,7 @@ nv04_surface_copy_m2mf(struct nv04_surface_2d *ctx, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART | NOUVEAU_BO_WR); OUT_RING (chan, src_pitch); OUT_RING (chan, dst_pitch); - OUT_RING (chan, w * src->texture->block.size); + OUT_RING (chan, w * pf_get_blocksize(src->texture->format)); OUT_RING (chan, count); OUT_RING (chan, 0x0101); OUT_RING (chan, 0); diff --git a/src/gallium/drivers/nv04/nv04_transfer.c b/src/gallium/drivers/nv04/nv04_transfer.c index e6456429f4..e8ff686b4a 100644 --- a/src/gallium/drivers/nv04/nv04_transfer.c +++ b/src/gallium/drivers/nv04/nv04_transfer.c @@ -24,9 +24,6 @@ nv04_compatible_transfer_tex(struct pipe_texture *pt, unsigned level, template->width0 = u_minify(pt->width0, level); template->height0 = u_minify(pt->height0, level); template->depth0 = 1; - template->block = pt->block; - template->nblocksx[0] = pt->nblocksx[level]; - template->nblocksy[0] = pt->nblocksx[level]; template->last_level = 0; template->nr_samples = pt->nr_samples; @@ -49,14 +46,10 @@ nv04_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, return NULL; pipe_texture_reference(&tx->base.texture, pt); - tx->base.format = pt->format; tx->base.x = x; tx->base.y = y; tx->base.width = w; tx->base.height = h; - tx->base.block = pt->block; - tx->base.nblocksx = pt->nblocksx[level]; - tx->base.nblocksy = pt->nblocksy[level]; tx->base.stride = mt->level[level].pitch; tx->base.usage = usage; tx->base.face = face; @@ -158,7 +151,7 @@ nv04_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) pipe_transfer_buffer_flags(ptx)); return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x * ptx->block.size; + ptx->y * ns->pitch + ptx->x * pf_get_blocksize(ptx->texture->format); } static void diff --git a/src/gallium/drivers/nv10/nv10_miptree.c b/src/gallium/drivers/nv10/nv10_miptree.c index b2a6c59b74..439beeccc3 100644 --- a/src/gallium/drivers/nv10/nv10_miptree.c +++ b/src/gallium/drivers/nv10/nv10_miptree.c @@ -11,7 +11,7 @@ nv10_miptree_layout(struct nv10_miptree *nv10mt) { struct pipe_texture *pt = &nv10mt->base; boolean swizzled = FALSE; - uint width = pt->width0, height = pt->height0; + uint width = pt->width0; uint offset = 0; int nr_faces, l, f; @@ -22,21 +22,16 @@ nv10_miptree_layout(struct nv10_miptree *nv10mt) } for (l = 0; l <= pt->last_level; l++) { - - pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width); - pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height); - if (swizzled) - nv10mt->level[l].pitch = pt->nblocksx[l] * pt->block.size; + nv10mt->level[l].pitch = pf_get_stride(pt->format, width); else - nv10mt->level[l].pitch = pt->nblocksx[0] * pt->block.size; + nv10mt->level[l].pitch = pf_get_stride(pt->format, pt->width0); nv10mt->level[l].pitch = (nv10mt->level[l].pitch + 63) & ~63; nv10mt->level[l].image_offset = CALLOC(nr_faces, sizeof(unsigned)); width = u_minify(width, 1); - height = u_minify(height, 1); } diff --git a/src/gallium/drivers/nv10/nv10_transfer.c b/src/gallium/drivers/nv10/nv10_transfer.c index ec54297ab0..9e44d37367 100644 --- a/src/gallium/drivers/nv10/nv10_transfer.c +++ b/src/gallium/drivers/nv10/nv10_transfer.c @@ -24,9 +24,6 @@ nv10_compatible_transfer_tex(struct pipe_texture *pt, unsigned level, template->width0 = u_minify(pt->width0, level); template->height0 = u_minify(pt->height0, level); template->depth0 = 1; - template->block = pt->block; - template->nblocksx[0] = pt->nblocksx[level]; - template->nblocksy[0] = pt->nblocksx[level]; template->last_level = 0; template->nr_samples = pt->nr_samples; @@ -49,14 +46,10 @@ nv10_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, return NULL; pipe_texture_reference(&tx->base.texture, pt); - tx->base.format = pt->format; tx->base.x = x; tx->base.y = y; tx->base.width = w; tx->base.height = h; - tx->base.block = pt->block; - tx->base.nblocksx = pt->nblocksx[level]; - tx->base.nblocksy = pt->nblocksy[level]; tx->base.stride = mt->level[level].pitch; tx->base.usage = usage; tx->base.face = face; @@ -158,7 +151,7 @@ nv10_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) pipe_transfer_buffer_flags(ptx)); return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x * ptx->block.size; + ptx->y * ns->pitch + ptx->x * pf_get_blocksize(ptx->texture->format); } static void diff --git a/src/gallium/drivers/nv20/nv20_miptree.c b/src/gallium/drivers/nv20/nv20_miptree.c index 554e28e47d..2bde9fb75b 100644 --- a/src/gallium/drivers/nv20/nv20_miptree.c +++ b/src/gallium/drivers/nv20/nv20_miptree.c @@ -10,7 +10,7 @@ static void nv20_miptree_layout(struct nv20_miptree *nv20mt) { struct pipe_texture *pt = &nv20mt->base; - uint width = pt->width0, height = pt->height0; + uint width = pt->width0; uint offset = 0; int nr_faces, l, f; uint wide_pitch = pt->tex_usage & (PIPE_TEXTURE_USAGE_SAMPLER | @@ -26,19 +26,15 @@ nv20_miptree_layout(struct nv20_miptree *nv20mt) } for (l = 0; l <= pt->last_level; l++) { - pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width); - pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height); - if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) - nv20mt->level[l].pitch = align(pt->width0 * pt->block.size, 64); + nv20mt->level[l].pitch = align(pf_get_stride(pt->format, pt->width0), 64); else - nv20mt->level[l].pitch = u_minify(pt->width0, l) * pt->block.size; + nv20mt->level[l].pitch = pf_get_stride(pt->format, width); nv20mt->level[l].image_offset = CALLOC(nr_faces, sizeof(unsigned)); width = u_minify(width, 1); - height = u_minify(height, 1); } for (f = 0; f < nr_faces; f++) { diff --git a/src/gallium/drivers/nv20/nv20_transfer.c b/src/gallium/drivers/nv20/nv20_transfer.c index 87b5c14a3c..f2e0a34db9 100644 --- a/src/gallium/drivers/nv20/nv20_transfer.c +++ b/src/gallium/drivers/nv20/nv20_transfer.c @@ -24,9 +24,6 @@ nv20_compatible_transfer_tex(struct pipe_texture *pt, unsigned level, template->width0 = u_minify(pt->width0, level); template->height0 = u_minify(pt->height0, level); template->depth0 = 1; - template->block = pt->block; - template->nblocksx[0] = pt->nblocksx[level]; - template->nblocksy[0] = pt->nblocksx[level]; template->last_level = 0; template->nr_samples = pt->nr_samples; @@ -49,14 +46,10 @@ nv20_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, return NULL; pipe_texture_reference(&tx->base.texture, pt); - tx->base.format = pt->format; tx->base.x = x; tx->base.y = y; tx->base.width = w; tx->base.height = h; - tx->base.block = pt->block; - tx->base.nblocksx = pt->nblocksx[level]; - tx->base.nblocksy = pt->nblocksy[level]; tx->base.stride = mt->level[level].pitch; tx->base.usage = usage; tx->base.face = face; @@ -158,7 +151,7 @@ nv20_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) pipe_transfer_buffer_flags(ptx)); return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x * ptx->block.size; + ptx->y * ns->pitch + ptx->x * pf_get_blocksize(ptx->texture->format); } static void diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c index b4c306d127..9e50a7cf6b 100644 --- a/src/gallium/drivers/nv30/nv30_miptree.c +++ b/src/gallium/drivers/nv30/nv30_miptree.c @@ -9,7 +9,7 @@ static void nv30_miptree_layout(struct nv30_miptree *nv30mt) { struct pipe_texture *pt = &nv30mt->base; - uint width = pt->width0, height = pt->height0, depth = pt->depth0; + uint width = pt->width0; uint offset = 0; int nr_faces, l, f; uint wide_pitch = pt->tex_usage & (PIPE_TEXTURE_USAGE_SAMPLER | @@ -28,20 +28,15 @@ nv30_miptree_layout(struct nv30_miptree *nv30mt) } for (l = 0; l <= pt->last_level; l++) { - pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width); - pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height); - if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) - nv30mt->level[l].pitch = align(pt->width0 * pt->block.size, 64); + nv30mt->level[l].pitch = align(pf_get_stride(pt->format, pt->width0), 64); else - nv30mt->level[l].pitch = u_minify(pt->width0, l) * pt->block.size; + nv30mt->level[l].pitch = pf_get_stride(pt->format, width); nv30mt->level[l].image_offset = CALLOC(nr_faces, sizeof(unsigned)); width = u_minify(width, 1); - height = u_minify(height, 1); - depth = u_minify(depth, 1); } for (f = 0; f < nr_faces; f++) { diff --git a/src/gallium/drivers/nv30/nv30_transfer.c b/src/gallium/drivers/nv30/nv30_transfer.c index 5e429b4d85..c8c3bd1f17 100644 --- a/src/gallium/drivers/nv30/nv30_transfer.c +++ b/src/gallium/drivers/nv30/nv30_transfer.c @@ -24,9 +24,6 @@ nv30_compatible_transfer_tex(struct pipe_texture *pt, unsigned level, template->width0 = u_minify(pt->width0, level); template->height0 = u_minify(pt->height0, level); template->depth0 = 1; - template->block = pt->block; - template->nblocksx[0] = pt->nblocksx[level]; - template->nblocksy[0] = pt->nblocksx[level]; template->last_level = 0; template->nr_samples = pt->nr_samples; @@ -49,14 +46,10 @@ nv30_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, return NULL; pipe_texture_reference(&tx->base.texture, pt); - tx->base.format = pt->format; tx->base.x = x; tx->base.y = y; tx->base.width = w; tx->base.height = h; - tx->base.block = pt->block; - tx->base.nblocksx = pt->nblocksx[level]; - tx->base.nblocksy = pt->nblocksy[level]; tx->base.stride = mt->level[level].pitch; tx->base.usage = usage; tx->base.face = face; @@ -158,7 +151,7 @@ nv30_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) pipe_transfer_buffer_flags(ptx)); return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x * ptx->block.size; + ptx->y * ns->pitch + ptx->x * pf_get_blocksize(ptx->texture->format); } static void diff --git a/src/gallium/drivers/nv40/nv40_miptree.c b/src/gallium/drivers/nv40/nv40_miptree.c index f73bedff6d..8779c5572b 100644 --- a/src/gallium/drivers/nv40/nv40_miptree.c +++ b/src/gallium/drivers/nv40/nv40_miptree.c @@ -9,7 +9,7 @@ static void nv40_miptree_layout(struct nv40_miptree *mt) { struct pipe_texture *pt = &mt->base; - uint width = pt->width0, height = pt->height0, depth = pt->depth0; + uint width = pt->width0; uint offset = 0; int nr_faces, l, f; uint wide_pitch = pt->tex_usage & (PIPE_TEXTURE_USAGE_SAMPLER | @@ -28,20 +28,15 @@ nv40_miptree_layout(struct nv40_miptree *mt) } for (l = 0; l <= pt->last_level; l++) { - pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width); - pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height); - if (wide_pitch && (pt->tex_usage & NOUVEAU_TEXTURE_USAGE_LINEAR)) - mt->level[l].pitch = align(pt->width0 * pt->block.size, 64); + mt->level[l].pitch = align(pf_get_stride(pt->format, pt->width0), 64); else - mt->level[l].pitch = u_minify(pt->width0, l) * pt->block.size; + mt->level[l].pitch = pf_get_stride(pt->format, width); mt->level[l].image_offset = CALLOC(nr_faces, sizeof(unsigned)); width = u_minify(width, 1); - height = u_minify(height, 1); - depth = u_minify(depth, 1); } for (f = 0; f < nr_faces; f++) { diff --git a/src/gallium/drivers/nv40/nv40_transfer.c b/src/gallium/drivers/nv40/nv40_transfer.c index 36e253c96f..1ee5cf39e0 100644 --- a/src/gallium/drivers/nv40/nv40_transfer.c +++ b/src/gallium/drivers/nv40/nv40_transfer.c @@ -24,9 +24,6 @@ nv40_compatible_transfer_tex(struct pipe_texture *pt, unsigned level, template->width0 = u_minify(pt->width0, level); template->height0 = u_minify(pt->height0, level); template->depth0 = 1; - template->block = pt->block; - template->nblocksx[0] = pt->nblocksx[level]; - template->nblocksy[0] = pt->nblocksx[level]; template->last_level = 0; template->nr_samples = pt->nr_samples; @@ -49,14 +46,10 @@ nv40_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, return NULL; pipe_texture_reference(&tx->base.texture, pt); - tx->base.format = pt->format; tx->base.x = x; tx->base.y = y; tx->base.width = w; tx->base.height = h; - tx->base.block = pt->block; - tx->base.nblocksx = pt->nblocksx[level]; - tx->base.nblocksy = pt->nblocksy[level]; tx->base.stride = mt->level[level].pitch; tx->base.usage = usage; tx->base.face = face; @@ -158,7 +151,7 @@ nv40_transfer_map(struct pipe_screen *pscreen, struct pipe_transfer *ptx) pipe_transfer_buffer_flags(ptx)); return map + ns->base.offset + - ptx->y * ns->pitch + ptx->x * ptx->block.size; + ptx->y * ns->pitch + ptx->x * pf_get_blocksize(ptx->texture->format); } static void diff --git a/src/gallium/drivers/nv50/nv50_miptree.c b/src/gallium/drivers/nv50/nv50_miptree.c index 3d58746793..40ee665999 100644 --- a/src/gallium/drivers/nv50/nv50_miptree.c +++ b/src/gallium/drivers/nv50/nv50_miptree.c @@ -91,13 +91,11 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp) for (l = 0; l <= pt->last_level; l++) { struct nv50_miptree_level *lvl = &mt->level[l]; - - pt->nblocksx[l] = pf_get_nblocksx(&pt->block, width); - pt->nblocksy[l] = pf_get_nblocksy(&pt->block, height); + unsigned nblocksy = pf_get_nblocksy(pt->format, height); lvl->image_offset = CALLOC(mt->image_nr, sizeof(int)); - lvl->pitch = align(pt->nblocksx[l] * pt->block.size, 64); - lvl->tile_mode = get_tile_mode(pt->nblocksy[l], depth); + lvl->pitch = align(pf_get_stride(pt->format, width), 64); + lvl->tile_mode = get_tile_mode(nblocksy, depth); width = u_minify(width, 1); height = u_minify(height, 1); @@ -118,7 +116,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *tmp) unsigned tile_d = get_tile_depth(lvl->tile_mode); size = lvl->pitch; - size *= align(pt->nblocksy[l], tile_h); + size *= align(pf_get_nblocksy(pt->format, u_minify(pt->height0, l)), tile_h); size *= align(u_minify(pt->depth0, l), tile_d); lvl->image_offset[i] = mt->total_size; diff --git a/src/gallium/drivers/nv50/nv50_transfer.c b/src/gallium/drivers/nv50/nv50_transfer.c index 39d65279fc..4705f96f57 100644 --- a/src/gallium/drivers/nv50/nv50_transfer.c +++ b/src/gallium/drivers/nv50/nv50_transfer.c @@ -16,6 +16,8 @@ struct nv50_transfer { int level_depth; int level_x; int level_y; + unsigned nblocksx; + unsigned nblocksy; }; static void @@ -151,20 +153,11 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, return NULL; pipe_texture_reference(&tx->base.texture, pt); - tx->base.format = pt->format; + tx->nblocksx = pf_get_nblocksx(pt->format, u_minify(pt->width0, level)); + tx->nblocksy = pf_get_nblocksy(pt->format, u_minify(pt->height0, level)); tx->base.width = w; tx->base.height = h; - tx->base.block = pt->block; - if (!pt->nblocksx[level]) { - tx->base.nblocksx = pf_get_nblocksx(&pt->block, - u_minify(pt->width0, level)); - tx->base.nblocksy = pf_get_nblocksy(&pt->block, - u_minify(pt->height0, level)); - } else { - tx->base.nblocksx = pt->nblocksx[level]; - tx->base.nblocksy = pt->nblocksy[level]; - } - tx->base.stride = tx->base.nblocksx * pt->block.size; + tx->base.stride = tx->nblocksx * pf_get_blocksize(pt->format); tx->base.usage = usage; tx->level_pitch = lvl->pitch; @@ -173,10 +166,10 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, tx->level_depth = u_minify(mt->base.base.depth0, level); tx->level_offset = lvl->image_offset[image]; tx->level_tiling = lvl->tile_mode; - tx->level_x = pf_get_nblocksx(&tx->base.block, x); - tx->level_y = pf_get_nblocksy(&tx->base.block, y); + tx->level_x = pf_get_nblocksx(pt->format, x); + tx->level_y = pf_get_nblocksy(pt->format, y); ret = nouveau_bo_new(dev, NOUVEAU_BO_GART | NOUVEAU_BO_MAP, 0, - tx->base.nblocksy * tx->base.stride, &tx->bo); + tx->nblocksy * tx->base.stride, &tx->bo); if (ret) { FREE(tx); return NULL; @@ -185,22 +178,22 @@ nv50_transfer_new(struct pipe_screen *pscreen, struct pipe_texture *pt, if (pt->target == PIPE_TEXTURE_3D) tx->level_offset += get_zslice_offset(lvl->tile_mode, zslice, lvl->pitch, - tx->base.nblocksy); + tx->nblocksy); if (usage & PIPE_TRANSFER_READ) { - nx = pf_get_nblocksx(&tx->base.block, tx->base.width); - ny = pf_get_nblocksy(&tx->base.block, tx->base.height); + nx = pf_get_nblocksx(pt->format, tx->base.width); + ny = pf_get_nblocksy(pt->format, tx->base.height); nv50_transfer_rect_m2mf(pscreen, mt->base.bo, tx->level_offset, tx->level_pitch, tx->level_tiling, x, y, - tx->base.nblocksx, tx->base.nblocksy, + tx->nblocksx, tx->nblocksy, tx->level_depth, tx->bo, 0, tx->base.stride, tx->bo->tile_mode, 0, 0, - tx->base.nblocksx, tx->base.nblocksy, 1, - tx->base.block.size, nx, ny, + tx->nblocksx, tx->nblocksy, 1, + pf_get_blocksize(pt->format), nx, ny, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART, NOUVEAU_BO_GART); } @@ -213,23 +206,24 @@ nv50_transfer_del(struct pipe_transfer *ptx) { struct nv50_transfer *tx = (struct nv50_transfer *)ptx; struct nv50_miptree *mt = nv50_miptree(ptx->texture); + struct pipe_texture *pt = ptx->texture; - unsigned nx = pf_get_nblocksx(&tx->base.block, tx->base.width); - unsigned ny = pf_get_nblocksy(&tx->base.block, tx->base.height); + unsigned nx = pf_get_nblocksx(pt->format, tx->base.width); + unsigned ny = pf_get_nblocksy(pt->format, tx->base.height); if (ptx->usage & PIPE_TRANSFER_WRITE) { - struct pipe_screen *pscreen = ptx->texture->screen; + struct pipe_screen *pscreen = pt->screen; nv50_transfer_rect_m2mf(pscreen, tx->bo, 0, tx->base.stride, tx->bo->tile_mode, 0, 0, - tx->base.nblocksx, tx->base.nblocksy, 1, + tx->nblocksx, tx->nblocksy, 1, mt->base.bo, tx->level_offset, tx->level_pitch, tx->level_tiling, tx->level_x, tx->level_y, - tx->base.nblocksx, tx->base.nblocksy, + tx->nblocksx, tx->nblocksy, tx->level_depth, - tx->base.block.size, nx, ny, + pf_get_blocksize(pt->format), nx, ny, NOUVEAU_BO_GART, NOUVEAU_BO_VRAM | NOUVEAU_BO_GART); } -- cgit v1.2.3 From f6d5e5842772285f609e2468a06fa30ab8865fd9 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 2 Dec 2009 09:22:42 -0700 Subject: gallium/util: added PIPE_CC_GCC_VERSION symbol --- src/gallium/include/pipe/p_config.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/include/pipe/p_config.h b/src/gallium/include/pipe/p_config.h index f6feea5f74..064605a4a0 100644 --- a/src/gallium/include/pipe/p_config.h +++ b/src/gallium/include/pipe/p_config.h @@ -53,6 +53,7 @@ #if defined(__GNUC__) #define PIPE_CC_GCC +#define PIPE_CC_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) #endif /* -- cgit v1.2.3 From 144afacc6fc67d37780cbb29ccd298de9959b436 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 2 Dec 2009 09:23:15 -0700 Subject: gallium/util: __builtin_bswap32() is in only gcc 4.3 or later --- src/gallium/auxiliary/util/u_math.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_math.h b/src/gallium/auxiliary/util/u_math.h index a5cd6574c0..b76592d1ec 100644 --- a/src/gallium/auxiliary/util/u_math.h +++ b/src/gallium/auxiliary/util/u_math.h @@ -520,7 +520,7 @@ util_bitcount(unsigned n) static INLINE uint32_t util_bswap32(uint32_t n) { -#if defined(PIPE_CC_GCC) +#if defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION >= 403) return __builtin_bswap32(n); #else return (n >> 24) | -- cgit v1.2.3 From 429bf7541777de08e070df3920b8566e3ac78223 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 2 Dec 2009 09:23:37 -0700 Subject: cell: fix TGSI breakage --- src/gallium/drivers/cell/ppu/cell_gen_fp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/cell/ppu/cell_gen_fp.c b/src/gallium/drivers/cell/ppu/cell_gen_fp.c index 4d43f65d29..1895a7940c 100644 --- a/src/gallium/drivers/cell/ppu/cell_gen_fp.c +++ b/src/gallium/drivers/cell/ppu/cell_gen_fp.c @@ -1351,7 +1351,7 @@ emit_function_call(struct codegen *gen, static boolean emit_TEX(struct codegen *gen, const struct tgsi_full_instruction *inst) { - const uint target = inst->InstructionExtTexture.Texture; + const uint target = inst->Texture.Texture; const uint unit = inst->Src[1].Register.Index; uint addr; int ch; -- cgit v1.2.3 From 908a3e56ccf2e6266ebf081e2947e2d6b24f2585 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 2 Dec 2009 09:31:26 -0700 Subject: cell: added tex_usage param to xm_surface_buffer_create() --- src/gallium/winsys/xlib/xlib_cell.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/winsys/xlib/xlib_cell.c b/src/gallium/winsys/xlib/xlib_cell.c index 13e609f58f..5f8dc2ab24 100644 --- a/src/gallium/winsys/xlib/xlib_cell.c +++ b/src/gallium/winsys/xlib/xlib_cell.c @@ -291,6 +291,7 @@ xm_surface_buffer_create(struct pipe_winsys *winsys, unsigned width, unsigned height, enum pipe_format format, unsigned usage, + unsigned tex_usage, unsigned *stride) { const unsigned alignment = 64; -- cgit v1.2.3 From 792888121b92913733daec7526c9441f27ce1231 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 2 Dec 2009 10:09:53 -0700 Subject: llvmpipe: plug in dummy pipe_context::set_vertex_sampler_textures function Fixes immediate segfault. --- src/gallium/drivers/llvmpipe/lp_context.c | 3 ++- src/gallium/drivers/llvmpipe/lp_state.h | 10 +++++++--- src/gallium/drivers/llvmpipe/lp_state_sampler.c | 14 ++++++++++++-- 3 files changed, 21 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index c081f6de03..66549132d4 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -205,7 +205,8 @@ llvmpipe_create( struct pipe_screen *screen ) llvmpipe->pipe.set_framebuffer_state = llvmpipe_set_framebuffer_state; llvmpipe->pipe.set_polygon_stipple = llvmpipe_set_polygon_stipple; llvmpipe->pipe.set_scissor_state = llvmpipe_set_scissor_state; - llvmpipe->pipe.set_fragment_sampler_textures = llvmpipe_set_sampler_textures; + llvmpipe->pipe.set_fragment_sampler_textures = llvmpipe_set_fragment_sampler_textures; + llvmpipe->pipe.set_vertex_sampler_textures = llvmpipe_set_vertex_sampler_textures; llvmpipe->pipe.set_viewport_state = llvmpipe_set_viewport_state; llvmpipe->pipe.set_vertex_buffers = llvmpipe_set_vertex_buffers; diff --git a/src/gallium/drivers/llvmpipe/lp_state.h b/src/gallium/drivers/llvmpipe/lp_state.h index 7b26ce61a3..805959af89 100644 --- a/src/gallium/drivers/llvmpipe/lp_state.h +++ b/src/gallium/drivers/llvmpipe/lp_state.h @@ -168,9 +168,13 @@ void llvmpipe_set_polygon_stipple( struct pipe_context *, void llvmpipe_set_scissor_state( struct pipe_context *, const struct pipe_scissor_state * ); -void llvmpipe_set_sampler_textures( struct pipe_context *, - unsigned num, - struct pipe_texture ** ); +void llvmpipe_set_fragment_sampler_textures( struct pipe_context *, + unsigned num, + struct pipe_texture ** ); + +void llvmpipe_set_vertex_sampler_textures( struct pipe_context *, + unsigned num, + struct pipe_texture ** ); void llvmpipe_set_viewport_state( struct pipe_context *, const struct pipe_viewport_state * ); diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c index 8333805a3f..b61b669093 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c +++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c @@ -78,8 +78,9 @@ llvmpipe_bind_sampler_states(struct pipe_context *pipe, void -llvmpipe_set_sampler_textures(struct pipe_context *pipe, - unsigned num, struct pipe_texture **texture) +llvmpipe_set_fragment_sampler_textures(struct pipe_context *pipe, + unsigned num, + struct pipe_texture **texture) { struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); uint i; @@ -116,6 +117,15 @@ llvmpipe_set_sampler_textures(struct pipe_context *pipe, } +void +llvmpipe_set_vertex_sampler_textures(struct pipe_context *pipe, + unsigned num, + struct pipe_texture **texture) +{ + /* XXX to do */ +} + + void llvmpipe_delete_sampler_state(struct pipe_context *pipe, void *sampler) -- cgit v1.2.3 From f42192e783521f49a7caab09b073740e63ab092b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 2 Dec 2009 12:19:31 -0700 Subject: llvmpipe: return 0 for PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS query The driver (and draw module) don't support vertex shader textures yet. --- src/gallium/drivers/llvmpipe/lp_screen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index 0fb133486a..a6ecaa0b2b 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -59,7 +59,7 @@ llvmpipe_get_param(struct pipe_screen *screen, int param) case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: return PIPE_MAX_SAMPLERS; case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS: - return PIPE_MAX_SAMPLERS; + return 0; case PIPE_CAP_NPOT_TEXTURES: return 1; case PIPE_CAP_TWO_SIDED_STENCIL: -- cgit v1.2.3 From d5e5909f171952bc15f43bc618238fc0699edc09 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 2 Dec 2009 12:20:15 -0700 Subject: Revert "llvmpipe: plug in dummy pipe_context::set_vertex_sampler_textures function" This reverts commit 792888121b92913733daec7526c9441f27ce1231. We're instead returning 0 for the PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS query. --- src/gallium/drivers/llvmpipe/lp_context.c | 3 +-- src/gallium/drivers/llvmpipe/lp_state.h | 10 +++------- src/gallium/drivers/llvmpipe/lp_state_sampler.c | 14 ++------------ 3 files changed, 6 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index 66549132d4..c081f6de03 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -205,8 +205,7 @@ llvmpipe_create( struct pipe_screen *screen ) llvmpipe->pipe.set_framebuffer_state = llvmpipe_set_framebuffer_state; llvmpipe->pipe.set_polygon_stipple = llvmpipe_set_polygon_stipple; llvmpipe->pipe.set_scissor_state = llvmpipe_set_scissor_state; - llvmpipe->pipe.set_fragment_sampler_textures = llvmpipe_set_fragment_sampler_textures; - llvmpipe->pipe.set_vertex_sampler_textures = llvmpipe_set_vertex_sampler_textures; + llvmpipe->pipe.set_fragment_sampler_textures = llvmpipe_set_sampler_textures; llvmpipe->pipe.set_viewport_state = llvmpipe_set_viewport_state; llvmpipe->pipe.set_vertex_buffers = llvmpipe_set_vertex_buffers; diff --git a/src/gallium/drivers/llvmpipe/lp_state.h b/src/gallium/drivers/llvmpipe/lp_state.h index 805959af89..7b26ce61a3 100644 --- a/src/gallium/drivers/llvmpipe/lp_state.h +++ b/src/gallium/drivers/llvmpipe/lp_state.h @@ -168,13 +168,9 @@ void llvmpipe_set_polygon_stipple( struct pipe_context *, void llvmpipe_set_scissor_state( struct pipe_context *, const struct pipe_scissor_state * ); -void llvmpipe_set_fragment_sampler_textures( struct pipe_context *, - unsigned num, - struct pipe_texture ** ); - -void llvmpipe_set_vertex_sampler_textures( struct pipe_context *, - unsigned num, - struct pipe_texture ** ); +void llvmpipe_set_sampler_textures( struct pipe_context *, + unsigned num, + struct pipe_texture ** ); void llvmpipe_set_viewport_state( struct pipe_context *, const struct pipe_viewport_state * ); diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c index b61b669093..8333805a3f 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c +++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c @@ -78,9 +78,8 @@ llvmpipe_bind_sampler_states(struct pipe_context *pipe, void -llvmpipe_set_fragment_sampler_textures(struct pipe_context *pipe, - unsigned num, - struct pipe_texture **texture) +llvmpipe_set_sampler_textures(struct pipe_context *pipe, + unsigned num, struct pipe_texture **texture) { struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); uint i; @@ -117,15 +116,6 @@ llvmpipe_set_fragment_sampler_textures(struct pipe_context *pipe, } -void -llvmpipe_set_vertex_sampler_textures(struct pipe_context *pipe, - unsigned num, - struct pipe_texture **texture) -{ - /* XXX to do */ -} - - void llvmpipe_delete_sampler_state(struct pipe_context *pipe, void *sampler) -- cgit v1.2.3 From debc0b6fa8ce110eb4febc376d8327336259742c Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 2 Dec 2009 12:24:24 -0700 Subject: cso: check if pipe_context::bind_vertex_sampler_states is non-null Fixes segfaults upon exit when the CSO module is releasing its objects. --- src/gallium/auxiliary/cso_cache/cso_context.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c index b6f7b88322..80bd0c91db 100644 --- a/src/gallium/auxiliary/cso_cache/cso_context.c +++ b/src/gallium/auxiliary/cso_cache/cso_context.c @@ -260,7 +260,8 @@ void cso_release_all( struct cso_context *ctx ) ctx->pipe->bind_blend_state( ctx->pipe, NULL ); ctx->pipe->bind_rasterizer_state( ctx->pipe, NULL ); ctx->pipe->bind_fragment_sampler_states( ctx->pipe, 0, NULL ); - ctx->pipe->bind_vertex_sampler_states(ctx->pipe, 0, NULL); + if (ctx->pipe->bind_vertex_sampler_states) + ctx->pipe->bind_vertex_sampler_states(ctx->pipe, 0, NULL); ctx->pipe->bind_depth_stencil_alpha_state( ctx->pipe, NULL ); ctx->pipe->bind_fs_state( ctx->pipe, NULL ); ctx->pipe->bind_vs_state( ctx->pipe, NULL ); -- cgit v1.2.3 From 08383af4c749566dcb58db94d7b72ee02e4cab11 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 2 Dec 2009 11:22:55 -0800 Subject: r300g: No vertex textures here. --- src/gallium/drivers/r300/r300_state.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 7505353953..442af70e14 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -566,6 +566,12 @@ static void r300_bind_sampler_states(struct pipe_context* pipe, r300->sampler_count = count; } +static void r300_lacks_vertex_textures(struct pipe_context* pipe, + unsigned count, + void** states) +{ +} + static void r300_delete_sampler_state(struct pipe_context* pipe, void* state) { FREE(state); @@ -823,6 +829,7 @@ void r300_init_state_functions(struct r300_context* r300) r300->context.create_sampler_state = r300_create_sampler_state; r300->context.bind_fragment_sampler_states = r300_bind_sampler_states; + r300->context.bind_vertex_sampler_states = r300_lacks_vertex_textures; r300->context.delete_sampler_state = r300_delete_sampler_state; r300->context.set_fragment_sampler_textures = r300_set_sampler_textures; -- cgit v1.2.3 From dad193d516422a9e330e58148822735b0decb8da Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 2 Dec 2009 11:34:00 -0800 Subject: radeong: Change ioctl order, document it. --- src/gallium/winsys/drm/radeon/core/radeon_r300.c | 34 +++++++++++++++--------- 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index 7ea5d1fb4e..d3e468a9ef 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -154,37 +154,47 @@ static void do_ioctls(struct r300_winsys* winsys, int fd) info.value = (unsigned long)⌖ - /* First, get the number of pixel pipes */ - info.request = RADEON_INFO_NUM_GB_PIPES; + /* We do things in a specific order here. + * + * First, the PCI ID. This is essential and should return usable numbers + * for all Radeons. If this fails, we probably got handed an FD for some + * non-Radeon card. + * + * The GB and Z pipe requests should always succeed, but they might not + * return sensical values for all chipsets, but that's alright because + * the pipe drivers already know that. + * + * The GEM info is actually bogus on the kernel side, as well as our side + * (see radeon_gem_info_ioctl in radeon_gem.c) but that's alright because + * we don't actually use the info for anything yet. + * XXX update the above when we can safely use vram_size instead of vram_visible */ + info.request = RADEON_INFO_DEVICE_ID; retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)); if (retval) { - fprintf(stderr, "%s: Failed to get GB pipe count, " + fprintf(stderr, "%s: Failed to get PCI ID, " "error number %d\n", __FUNCTION__, retval); exit(1); } - winsys->gb_pipes = target; + winsys->pci_id = target; - /* get Z pipes */ - info.request = RADEON_INFO_NUM_Z_PIPES; + info.request = RADEON_INFO_NUM_GB_PIPES; retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)); if (retval) { fprintf(stderr, "%s: Failed to get GB pipe count, " "error number %d\n", __FUNCTION__, retval); exit(1); } - winsys->z_pipes = target; + winsys->gb_pipes = target; - /* Then, get PCI ID */ - info.request = RADEON_INFO_DEVICE_ID; + info.request = RADEON_INFO_NUM_Z_PIPES; retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)); if (retval) { - fprintf(stderr, "%s: Failed to get PCI ID, " + fprintf(stderr, "%s: Failed to get Z pipe count, " "error number %d\n", __FUNCTION__, retval); exit(1); } - winsys->pci_id = target; + winsys->z_pipes = target; - /* Finally, retrieve MM info */ retval = drmCommandWriteRead(fd, DRM_RADEON_GEM_INFO, &gem_info, sizeof(gem_info)); if (retval) { -- cgit v1.2.3 From 4f77b0103d5f150845300ee8bddcef20d11a9820 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 2 Dec 2009 12:16:19 -0800 Subject: r300g, radeong: De-specialize r300_winsys into radeon_winsys. There's like five good reasons for this, I swear. --- src/gallium/drivers/r300/Makefile | 3 +- src/gallium/drivers/r300/r300_context.c | 9 +- src/gallium/drivers/r300/r300_context.h | 2 +- src/gallium/drivers/r300/r300_cs.h | 5 +- src/gallium/drivers/r300/r300_screen.c | 13 +- src/gallium/drivers/r300/r300_screen.h | 4 +- src/gallium/drivers/r300/r300_vbo.c | 3 +- src/gallium/drivers/r300/r300_winsys.h | 70 +--------- src/gallium/winsys/drm/radeon/core/radeon_buffer.h | 10 +- src/gallium/winsys/drm/radeon/core/radeon_drm.c | 7 +- src/gallium/winsys/drm/radeon/core/radeon_r300.c | 141 ++++++++------------- src/gallium/winsys/drm/radeon/core/radeon_r300.h | 5 +- src/gallium/winsys/drm/radeon/core/radeon_winsys.h | 105 +++++++++++++++ 13 files changed, 190 insertions(+), 187 deletions(-) create mode 100644 src/gallium/winsys/drm/radeon/core/radeon_winsys.h (limited to 'src') diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile index d13bb7a36b..63ae5c2766 100644 --- a/src/gallium/drivers/r300/Makefile +++ b/src/gallium/drivers/r300/Makefile @@ -23,7 +23,8 @@ C_SOURCES = \ r300_tgsi_to_rc.c LIBRARY_INCLUDES = \ - -I$(TOP)/src/mesa/drivers/dri/r300/compiler + -I$(TOP)/src/mesa/drivers/dri/r300/compiler \ + -I$(TOP)/src/gallium/winsys/drm/radeon/core COMPILER_ARCHIVE = $(TOP)/src/mesa/drivers/dri/r300/compiler/libr300compiler.a diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 769733b6dd..68a17dcb63 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -36,7 +36,8 @@ #include "r300_screen.h" #include "r300_state_derived.h" #include "r300_state_invariant.h" -#include "r300_winsys.h" + +#include "radeon_winsys.h" static enum pipe_error r300_clear_hash_table(void* key, void* value, void* data) @@ -105,7 +106,7 @@ static void r300_flush_cb(void *data) } struct pipe_context* r300_create_context(struct pipe_screen* screen, - struct r300_winsys* r300_winsys) + struct radeon_winsys* radeon_winsys) { struct r300_context* r300 = CALLOC_STRUCT(r300_context); struct r300_screen* r300screen = r300_screen(screen); @@ -113,9 +114,9 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen, if (!r300) return NULL; - r300->winsys = r300_winsys; + r300->winsys = radeon_winsys; - r300->context.winsys = (struct pipe_winsys*)r300_winsys; + r300->context.winsys = (struct pipe_winsys*)radeon_winsys; r300->context.screen = screen; r300_init_debug(r300); diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 39c0914cff..dd3f6ac143 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -237,7 +237,7 @@ struct r300_context { struct pipe_context context; /* The interface to the windowing system, etc. */ - struct r300_winsys* winsys; + struct radeon_winsys* winsys; /* Draw module. Used mostly for SW TCL. */ struct draw_context* draw; diff --git a/src/gallium/drivers/r300/r300_cs.h b/src/gallium/drivers/r300/r300_cs.h index 86ba91db52..8b100375fd 100644 --- a/src/gallium/drivers/r300/r300_cs.h +++ b/src/gallium/drivers/r300/r300_cs.h @@ -26,7 +26,8 @@ #include "util/u_math.h" #include "r300_reg.h" -#include "r300_winsys.h" + +#include "radeon_winsys.h" /* Yes, I know macros are ugly. However, they are much prettier than the code * that they neatly hide away, and don't have the cost of function setup,so @@ -50,7 +51,7 @@ #define CS_LOCALS(context) \ struct r300_context* const cs_context_copy = (context); \ - struct r300_winsys* cs_winsys = cs_context_copy->winsys; \ + struct radeon_winsys* cs_winsys = cs_context_copy->winsys; \ int cs_count = 0; #define CHECK_CS(size) \ diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c index 390b63007e..2e7b1423e6 100644 --- a/src/gallium/drivers/r300/r300_screen.c +++ b/src/gallium/drivers/r300/r300_screen.c @@ -27,7 +27,8 @@ #include "r300_context.h" #include "r300_screen.h" #include "r300_texture.h" -#include "r300_winsys.h" + +#include "radeon_winsys.h" /* Return the identifier behind whom the brave coders responsible for this * amalgamation of code, sweat, and duct tape, routinely obscure their names. @@ -372,7 +373,7 @@ static void r300_destroy_screen(struct pipe_screen* pscreen) FREE(r300screen); } -struct pipe_screen* r300_create_screen(struct r300_winsys* r300_winsys) +struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys) { struct r300_screen* r300screen = CALLOC_STRUCT(r300_screen); struct r300_capabilities* caps = CALLOC_STRUCT(r300_capabilities); @@ -380,14 +381,14 @@ struct pipe_screen* r300_create_screen(struct r300_winsys* r300_winsys) if (!r300screen || !caps) return NULL; - caps->pci_id = r300_winsys->pci_id; - caps->num_frag_pipes = r300_winsys->gb_pipes; - caps->num_z_pipes = r300_winsys->z_pipes; + caps->pci_id = radeon_winsys->pci_id; + caps->num_frag_pipes = radeon_winsys->gb_pipes; + caps->num_z_pipes = radeon_winsys->z_pipes; r300_parse_chipset(caps); r300screen->caps = caps; - r300screen->screen.winsys = (struct pipe_winsys*)r300_winsys; + r300screen->screen.winsys = (struct pipe_winsys*)radeon_winsys; r300screen->screen.destroy = r300_destroy_screen; r300screen->screen.get_name = r300_get_name; r300screen->screen.get_vendor = r300_get_vendor; diff --git a/src/gallium/drivers/r300/r300_screen.h b/src/gallium/drivers/r300/r300_screen.h index 1ce5ff3904..2217988add 100644 --- a/src/gallium/drivers/r300/r300_screen.h +++ b/src/gallium/drivers/r300/r300_screen.h @@ -27,7 +27,7 @@ #include "r300_chipset.h" -struct r300_winsys; +struct radeon_winsys; struct r300_screen { /* Parent class */ @@ -58,6 +58,6 @@ r300_transfer(struct pipe_transfer* transfer) } /* Creates a new r300 screen. */ -struct pipe_screen* r300_create_screen(struct r300_winsys* r300_winsys); +struct pipe_screen* r300_create_screen(struct radeon_winsys* radeon_winsys); #endif /* R300_SCREEN_H */ diff --git a/src/gallium/drivers/r300/r300_vbo.c b/src/gallium/drivers/r300/r300_vbo.c index 6ebaf715dc..d8610dadfa 100644 --- a/src/gallium/drivers/r300/r300_vbo.c +++ b/src/gallium/drivers/r300/r300_vbo.c @@ -32,7 +32,8 @@ #include "r300_context.h" #include "r300_state_inlines.h" #include "r300_reg.h" -#include "r300_winsys.h" + +#include "radeon_winsys.h" static INLINE int get_buffer_offset(struct r300_context *r300, unsigned int buf_nr, diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h index 864a6146b2..f86985841f 100644 --- a/src/gallium/drivers/r300/r300_winsys.h +++ b/src/gallium/drivers/r300/r300_winsys.h @@ -35,76 +35,8 @@ extern "C" { #include "pipe/p_state.h" #include "pipe/internal/p_winsys_screen.h" -struct r300_winsys { - /* Parent class */ - struct pipe_winsys base; - - /* Opaque Radeon-specific winsys object. */ - void* radeon_winsys; - - /* PCI ID */ - uint32_t pci_id; - - /* GB pipe count */ - uint32_t gb_pipes; - - /* Z pipe count (rv530 only) */ - uint32_t z_pipes; - - /* GART size. */ - uint32_t gart_size; - - /* VRAM size. */ - uint32_t vram_size; - - /* Add a pipe_buffer to the list of buffer objects to validate. */ - boolean (*add_buffer)(struct r300_winsys* winsys, - struct pipe_buffer* pbuffer, - uint32_t rd, - uint32_t wd); - - /* Revalidate all currently setup pipe_buffers. - * Returns TRUE if a flush is required. */ - boolean (*validate)(struct r300_winsys* winsys); - - /* Check to see if there's room for commands. */ - boolean (*check_cs)(struct r300_winsys* winsys, int size); - - /* Start a command emit. */ - void (*begin_cs)(struct r300_winsys* winsys, - int size, - const char* file, - const char* function, - int line); - - /* Write a dword to the command buffer. */ - void (*write_cs_dword)(struct r300_winsys* winsys, uint32_t dword); - - /* Write a relocated dword to the command buffer. */ - void (*write_cs_reloc)(struct r300_winsys* winsys, - struct pipe_buffer* bo, - uint32_t rd, - uint32_t wd, - uint32_t flags); - - /* Finish a command emit. */ - void (*end_cs)(struct r300_winsys* winsys, - const char* file, - const char* function, - int line); - - /* Flush the CS. */ - void (*flush_cs)(struct r300_winsys* winsys); - - /* winsys flush - callback from winsys when flush required */ - void (*set_flush_cb)(struct r300_winsys *winsys, - void (*flush_cb)(void *), void *data); - - void (*reset_bos)(struct r300_winsys *winsys); -}; - struct pipe_context* r300_create_context(struct pipe_screen* screen, - struct r300_winsys* r300_winsys); + struct radeon_winsys* radeon_winsys); boolean r300_get_texture_buffer(struct pipe_texture* texture, struct pipe_buffer** buffer, diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h index f5153b06af..bfe2221d1e 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.h +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.h @@ -45,6 +45,8 @@ #include "radeon_drm.h" +#include "radeon_winsys.h" + struct radeon_pipe_buffer { struct pipe_buffer base; struct radeon_bo *bo; @@ -68,14 +70,6 @@ struct radeon_winsys_priv { struct radeon_cs* cs; }; -struct radeon_winsys { - /* Parent class. */ - struct pipe_winsys base; - - /* This corresponds to void* radeon_winsys in r300_winsys. */ - struct radeon_winsys_priv* priv; -}; - struct radeon_winsys* radeon_pipe_winsys(int fb); #if 0 struct pipe_surface *radeon_surface_from_handle(struct radeon_context *radeon_context, diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c index 69f14e54f2..770d7c73eb 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c @@ -41,9 +41,8 @@ struct pipe_screen* radeon_create_screen(struct drm_api* api, if (debug_get_bool_option("RADEON_SOFTPIPE", FALSE)) { return softpipe_create_screen((struct pipe_winsys*)winsys); } else { - struct r300_winsys* r300 = radeon_create_r300_winsys(drmFB, winsys); - FREE(winsys); - return r300_create_screen(r300); + radeon_setup_winsys(drmFB, winsys); + return r300_create_screen(winsys); } } @@ -55,7 +54,7 @@ struct pipe_context* radeon_create_context(struct drm_api* api, return radeon_create_softpipe(screen->winsys); } else { return r300_create_context(screen, - (struct r300_winsys*)screen->winsys); + (struct radeon_winsys*)screen->winsys); } } diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index d3e468a9ef..b64e9c16e1 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -22,36 +22,27 @@ #include "radeon_r300.h" -static void radeon_r300_set_flush_cb(struct r300_winsys *winsys, - void (*flush_cb)(void *), - void *data) +static void radeon_set_flush_cb(struct radeon_winsys *winsys, + void (*flush_cb)(void *), + void *data) { - struct radeon_winsys_priv* priv = - (struct radeon_winsys_priv*)winsys->radeon_winsys; - - radeon_cs_space_set_flush(priv->cs, flush_cb, - data); + radeon_cs_space_set_flush(winsys->priv->cs, flush_cb, data); } -static boolean radeon_r300_add_buffer(struct r300_winsys* winsys, - struct pipe_buffer* pbuffer, - uint32_t rd, - uint32_t wd) +static boolean radeon_add_buffer(struct radeon_winsys* winsys, + struct pipe_buffer* pbuffer, + uint32_t rd, + uint32_t wd) { - struct radeon_winsys_priv* priv = - (struct radeon_winsys_priv*)winsys->radeon_winsys; struct radeon_bo* bo = ((struct radeon_pipe_buffer*)pbuffer)->bo; - radeon_cs_space_add_persistent_bo(priv->cs, bo, rd, wd); + radeon_cs_space_add_persistent_bo(winsys->priv->cs, bo, rd, wd); return TRUE; } -static boolean radeon_r300_validate(struct r300_winsys* winsys) +static boolean radeon_validate(struct radeon_winsys* winsys) { - struct radeon_winsys_priv* priv = - (struct radeon_winsys_priv*)winsys->radeon_winsys; - - if (radeon_cs_space_check(priv->cs) < 0) { + if (radeon_cs_space_check(winsys->priv->cs) < 0) { return FALSE; } @@ -59,45 +50,37 @@ static boolean radeon_r300_validate(struct r300_winsys* winsys) return TRUE; } -static boolean radeon_r300_check_cs(struct r300_winsys* winsys, int size) +static boolean radeon_check_cs(struct radeon_winsys* winsys, int size) { /* XXX check size here, lazy ass! */ /* XXX also validate buffers */ return TRUE; } -static void radeon_r300_begin_cs(struct r300_winsys* winsys, - int size, - const char* file, - const char* function, - int line) +static void radeon_begin_cs(struct radeon_winsys* winsys, + int size, + const char* file, + const char* function, + int line) { - struct radeon_winsys_priv* priv = - (struct radeon_winsys_priv*)winsys->radeon_winsys; - - radeon_cs_begin(priv->cs, size, file, function, line); + radeon_cs_begin(winsys->priv->cs, size, file, function, line); } -static void radeon_r300_write_cs_dword(struct r300_winsys* winsys, - uint32_t dword) +static void radeon_write_cs_dword(struct radeon_winsys* winsys, + uint32_t dword) { - struct radeon_winsys_priv* priv = - (struct radeon_winsys_priv*)winsys->radeon_winsys; - - radeon_cs_write_dword(priv->cs, dword); + radeon_cs_write_dword(winsys->priv->cs, dword); } -static void radeon_r300_write_cs_reloc(struct r300_winsys* winsys, - struct pipe_buffer* pbuffer, - uint32_t rd, - uint32_t wd, - uint32_t flags) +static void radeon_write_cs_reloc(struct radeon_winsys* winsys, + struct pipe_buffer* pbuffer, + uint32_t rd, + uint32_t wd, + uint32_t flags) { - struct radeon_winsys_priv* priv = - (struct radeon_winsys_priv*)winsys->radeon_winsys; int retval = 0; - retval = radeon_cs_write_reloc(priv->cs, + retval = radeon_cs_write_reloc(winsys->priv->cs, ((struct radeon_pipe_buffer*)pbuffer)->bo, rd, wd, flags); if (retval) { @@ -106,46 +89,39 @@ static void radeon_r300_write_cs_reloc(struct r300_winsys* winsys, } } -static void radeon_r300_reset_bos(struct r300_winsys *winsys) +static void radeon_reset_bos(struct radeon_winsys *winsys) { - struct radeon_winsys_priv* priv = - (struct radeon_winsys_priv*)winsys->radeon_winsys; - radeon_cs_space_reset_bos(priv->cs); + radeon_cs_space_reset_bos(winsys->priv->cs); } -static void radeon_r300_end_cs(struct r300_winsys* winsys, - const char* file, - const char* function, - int line) +static void radeon_end_cs(struct radeon_winsys* winsys, + const char* file, + const char* function, + int line) { - struct radeon_winsys_priv* priv = - (struct radeon_winsys_priv*)winsys->radeon_winsys; - - radeon_cs_end(priv->cs, file, function, line); + radeon_cs_end(winsys->priv->cs, file, function, line); } -static void radeon_r300_flush_cs(struct r300_winsys* winsys) +static void radeon_flush_cs(struct radeon_winsys* winsys) { - struct radeon_winsys_priv* priv = - (struct radeon_winsys_priv*)winsys->radeon_winsys; int retval; /* Emit the CS. */ - retval = radeon_cs_emit(priv->cs); + retval = radeon_cs_emit(winsys->priv->cs); if (retval) { debug_printf("radeon: Bad CS, dumping...\n"); - radeon_cs_print(priv->cs, stderr); + radeon_cs_print(winsys->priv->cs, stderr); } /* Reset CS. * Someday, when we care about performance, we should really find a way * to rotate between two or three CS objects so that the GPU can be * spinning through one CS while another one is being filled. */ - radeon_cs_erase(priv->cs); + radeon_cs_erase(winsys->priv->cs); } /* Helper function to do the ioctls needed for setup and init. */ -static void do_ioctls(struct r300_winsys* winsys, int fd) +static void do_ioctls(struct radeon_winsys* winsys, int fd) { struct drm_radeon_gem_info gem_info = {0}; struct drm_radeon_info info = {0}; @@ -207,18 +183,17 @@ static void do_ioctls(struct r300_winsys* winsys, int fd) winsys->vram_size = gem_info.vram_visible; } -struct r300_winsys* -radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys) +void +radeon_setup_winsys(int fd, struct radeon_winsys* winsys) { - struct r300_winsys* winsys = CALLOC_STRUCT(r300_winsys); - struct radeon_winsys_priv* priv; - + /* XXX is this check needed now? */ if (winsys == NULL) { - return NULL; + return; } - priv = old_winsys->priv; + struct radeon_winsys_priv* priv = winsys->priv; + /* XXX backwards is bad precedent */ do_ioctls(winsys, fd); priv->csm = radeon_cs_manager_gem_ctor(fd); @@ -229,19 +204,15 @@ radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys) radeon_cs_set_limit(priv->cs, RADEON_GEM_DOMAIN_VRAM, winsys->vram_size); - winsys->add_buffer = radeon_r300_add_buffer; - winsys->validate = radeon_r300_validate; - - winsys->check_cs = radeon_r300_check_cs; - winsys->begin_cs = radeon_r300_begin_cs; - winsys->write_cs_dword = radeon_r300_write_cs_dword; - winsys->write_cs_reloc = radeon_r300_write_cs_reloc; - winsys->end_cs = radeon_r300_end_cs; - winsys->flush_cs = radeon_r300_flush_cs; - winsys->reset_bos = radeon_r300_reset_bos; - winsys->set_flush_cb = radeon_r300_set_flush_cb; - - memcpy(winsys, old_winsys, sizeof(struct radeon_winsys)); - - return winsys; + winsys->add_buffer = radeon_add_buffer; + winsys->validate = radeon_validate; + + winsys->check_cs = radeon_check_cs; + winsys->begin_cs = radeon_begin_cs; + winsys->write_cs_dword = radeon_write_cs_dword; + winsys->write_cs_reloc = radeon_write_cs_reloc; + winsys->end_cs = radeon_end_cs; + winsys->flush_cs = radeon_flush_cs; + winsys->reset_bos = radeon_reset_bos; + winsys->set_flush_cb = radeon_set_flush_cb; } diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.h b/src/gallium/winsys/drm/radeon/core/radeon_r300.h index 775d7937fd..cfbdb30266 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.h +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.h @@ -34,9 +34,6 @@ #include "radeon_buffer.h" -struct radeon_winsys; - -struct r300_winsys* -radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys); +void radeon_setup_winsys(int fd, struct radeon_winsys* winsys); #endif /* RADEON_R300_H */ diff --git a/src/gallium/winsys/drm/radeon/core/radeon_winsys.h b/src/gallium/winsys/drm/radeon/core/radeon_winsys.h new file mode 100644 index 0000000000..9edc9e038c --- /dev/null +++ b/src/gallium/winsys/drm/radeon/core/radeon_winsys.h @@ -0,0 +1,105 @@ +/* + * Copyright © 2009 Corbin Simpson + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sub license, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS + * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + * USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial portions + * of the Software. + */ +/* + * Authors: + * Corbin Simpson + */ +#ifndef RADEON_WINSYS_H +#define RADEON_WINSYS_H + +#include "pipe/internal/p_winsys_screen.h" + +struct radeon_winsys_priv; + +struct radeon_winsys { + /* Parent class. */ + struct pipe_winsys base; + + /* Winsys private */ + struct radeon_winsys_priv* priv; + + /* PCI ID */ + uint32_t pci_id; + + /* GB pipe count */ + uint32_t gb_pipes; + + /* Z pipe count (rv530 only) */ + uint32_t z_pipes; + + /* GART size. */ + uint32_t gart_size; + + /* VRAM size. */ + uint32_t vram_size; + + /* Add a pipe_buffer to the list of buffer objects to validate. */ + boolean (*add_buffer)(struct radeon_winsys* winsys, + struct pipe_buffer* pbuffer, + uint32_t rd, + uint32_t wd); + + /* Revalidate all currently setup pipe_buffers. + * Returns TRUE if a flush is required. */ + boolean (*validate)(struct radeon_winsys* winsys); + + /* Check to see if there's room for commands. */ + boolean (*check_cs)(struct radeon_winsys* winsys, int size); + + /* Start a command emit. */ + void (*begin_cs)(struct radeon_winsys* winsys, + int size, + const char* file, + const char* function, + int line); + + /* Write a dword to the command buffer. */ + void (*write_cs_dword)(struct radeon_winsys* winsys, uint32_t dword); + + /* Write a relocated dword to the command buffer. */ + void (*write_cs_reloc)(struct radeon_winsys* winsys, + struct pipe_buffer* bo, + uint32_t rd, + uint32_t wd, + uint32_t flags); + + /* Finish a command emit. */ + void (*end_cs)(struct radeon_winsys* winsys, + const char* file, + const char* function, + int line); + + /* Flush the CS. */ + void (*flush_cs)(struct radeon_winsys* winsys); + + /* winsys flush - callback from winsys when flush required */ + void (*set_flush_cb)(struct radeon_winsys *winsys, + void (*flush_cb)(void *), void *data); + + void (*reset_bos)(struct radeon_winsys *winsys); +}; + +#endif -- cgit v1.2.3 From 4395d35c8a9f56d5e5614db583e700668933bfd3 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 2 Dec 2009 12:31:04 -0800 Subject: radeong: Do ioctls before selecting pipe driver. --- src/gallium/winsys/drm/radeon/core/radeon_drm.c | 64 ++++++++++++++++++++++ src/gallium/winsys/drm/radeon/core/radeon_r300.c | 67 +----------------------- 2 files changed, 65 insertions(+), 66 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c index 770d7c73eb..04882507a7 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c @@ -31,12 +31,76 @@ #include "radeon_drm.h" +/* Helper function to do the ioctls needed for setup and init. */ +static void do_ioctls(int fd, struct radeon_winsys* winsys) +{ + struct drm_radeon_gem_info gem_info = {0}; + struct drm_radeon_info info = {0}; + int target = 0; + int retval; + + info.value = (unsigned long)⌖ + + /* We do things in a specific order here. + * + * First, the PCI ID. This is essential and should return usable numbers + * for all Radeons. If this fails, we probably got handed an FD for some + * non-Radeon card. + * + * The GB and Z pipe requests should always succeed, but they might not + * return sensical values for all chipsets, but that's alright because + * the pipe drivers already know that. + * + * The GEM info is actually bogus on the kernel side, as well as our side + * (see radeon_gem_info_ioctl in radeon_gem.c) but that's alright because + * we don't actually use the info for anything yet. + * XXX update the above when we can safely use vram_size instead of vram_visible */ + info.request = RADEON_INFO_DEVICE_ID; + retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)); + if (retval) { + fprintf(stderr, "%s: Failed to get PCI ID, " + "error number %d\n", __FUNCTION__, retval); + exit(1); + } + winsys->pci_id = target; + + info.request = RADEON_INFO_NUM_GB_PIPES; + retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)); + if (retval) { + fprintf(stderr, "%s: Failed to get GB pipe count, " + "error number %d\n", __FUNCTION__, retval); + exit(1); + } + winsys->gb_pipes = target; + + info.request = RADEON_INFO_NUM_Z_PIPES; + retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)); + if (retval) { + fprintf(stderr, "%s: Failed to get Z pipe count, " + "error number %d\n", __FUNCTION__, retval); + exit(1); + } + winsys->z_pipes = target; + + retval = drmCommandWriteRead(fd, DRM_RADEON_GEM_INFO, + &gem_info, sizeof(gem_info)); + if (retval) { + fprintf(stderr, "%s: Failed to get MM info, error number %d\n", + __FUNCTION__, retval); + exit(1); + } + winsys->gart_size = gem_info.gart_size; + /* XXX */ + winsys->vram_size = gem_info.vram_visible; +} + /* Create a pipe_screen. */ struct pipe_screen* radeon_create_screen(struct drm_api* api, int drmFB, struct drm_create_screen_arg *arg) { struct radeon_winsys* winsys = radeon_pipe_winsys(drmFB); + do_ioctls(drmFB, winsys); if (debug_get_bool_option("RADEON_SOFTPIPE", FALSE)) { return softpipe_create_screen((struct pipe_winsys*)winsys); diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index b64e9c16e1..e0a45fb67f 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -120,69 +120,6 @@ static void radeon_flush_cs(struct radeon_winsys* winsys) radeon_cs_erase(winsys->priv->cs); } -/* Helper function to do the ioctls needed for setup and init. */ -static void do_ioctls(struct radeon_winsys* winsys, int fd) -{ - struct drm_radeon_gem_info gem_info = {0}; - struct drm_radeon_info info = {0}; - int target = 0; - int retval; - - info.value = (unsigned long)⌖ - - /* We do things in a specific order here. - * - * First, the PCI ID. This is essential and should return usable numbers - * for all Radeons. If this fails, we probably got handed an FD for some - * non-Radeon card. - * - * The GB and Z pipe requests should always succeed, but they might not - * return sensical values for all chipsets, but that's alright because - * the pipe drivers already know that. - * - * The GEM info is actually bogus on the kernel side, as well as our side - * (see radeon_gem_info_ioctl in radeon_gem.c) but that's alright because - * we don't actually use the info for anything yet. - * XXX update the above when we can safely use vram_size instead of vram_visible */ - info.request = RADEON_INFO_DEVICE_ID; - retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)); - if (retval) { - fprintf(stderr, "%s: Failed to get PCI ID, " - "error number %d\n", __FUNCTION__, retval); - exit(1); - } - winsys->pci_id = target; - - info.request = RADEON_INFO_NUM_GB_PIPES; - retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)); - if (retval) { - fprintf(stderr, "%s: Failed to get GB pipe count, " - "error number %d\n", __FUNCTION__, retval); - exit(1); - } - winsys->gb_pipes = target; - - info.request = RADEON_INFO_NUM_Z_PIPES; - retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)); - if (retval) { - fprintf(stderr, "%s: Failed to get Z pipe count, " - "error number %d\n", __FUNCTION__, retval); - exit(1); - } - winsys->z_pipes = target; - - retval = drmCommandWriteRead(fd, DRM_RADEON_GEM_INFO, - &gem_info, sizeof(gem_info)); - if (retval) { - fprintf(stderr, "%s: Failed to get MM info, error number %d\n", - __FUNCTION__, retval); - exit(1); - } - winsys->gart_size = gem_info.gart_size; - /* XXX */ - winsys->vram_size = gem_info.vram_visible; -} - void radeon_setup_winsys(int fd, struct radeon_winsys* winsys) { @@ -193,11 +130,9 @@ radeon_setup_winsys(int fd, struct radeon_winsys* winsys) struct radeon_winsys_priv* priv = winsys->priv; - /* XXX backwards is bad precedent */ - do_ioctls(winsys, fd); - priv->csm = radeon_cs_manager_gem_ctor(fd); + /* XXX there *is* a definite size limit, can't remember it right now */ priv->cs = radeon_cs_create(priv->csm, 1024 * 64 / 4); radeon_cs_set_limit(priv->cs, RADEON_GEM_DOMAIN_GTT, winsys->gart_size); -- cgit v1.2.3 From f79028bbd4398b1c0f5c34014d8283bd6352aca6 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 2 Dec 2009 12:42:58 -0800 Subject: radeong: Add helper to determine pipe driver. --- src/gallium/winsys/drm/radeon/core/radeon_drm.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c index 04882507a7..5241972533 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c @@ -94,6 +94,14 @@ static void do_ioctls(int fd, struct radeon_winsys* winsys) winsys->vram_size = gem_info.vram_visible; } +/* Guess at whether this chipset should use r300g. + * + * I believe that this check is valid, but I haven't been exhaustive. */ +static boolean is_r3xx(int pciid) +{ + return (pciid > 0x3150) && (pciid < 0x796f); +} + /* Create a pipe_screen. */ struct pipe_screen* radeon_create_screen(struct drm_api* api, int drmFB, -- cgit v1.2.3 From ab7e70fabd17ebab755a41142a783d84570f298e Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Wed, 2 Dec 2009 12:54:51 -0800 Subject: radeong: Clean up some bad code. --- src/gallium/winsys/drm/radeon/core/radeon_r300.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index e0a45fb67f..7362279b77 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -53,8 +53,7 @@ static boolean radeon_validate(struct radeon_winsys* winsys) static boolean radeon_check_cs(struct radeon_winsys* winsys, int size) { /* XXX check size here, lazy ass! */ - /* XXX also validate buffers */ - return TRUE; + return radeon_validate(winsys); } static void radeon_begin_cs(struct radeon_winsys* winsys, @@ -123,16 +122,11 @@ static void radeon_flush_cs(struct radeon_winsys* winsys) void radeon_setup_winsys(int fd, struct radeon_winsys* winsys) { - /* XXX is this check needed now? */ - if (winsys == NULL) { - return; - } - struct radeon_winsys_priv* priv = winsys->priv; priv->csm = radeon_cs_manager_gem_ctor(fd); - /* XXX there *is* a definite size limit, can't remember it right now */ + /* Size limit on IBs is 64 kibibytes. */ priv->cs = radeon_cs_create(priv->csm, 1024 * 64 / 4); radeon_cs_set_limit(priv->cs, RADEON_GEM_DOMAIN_GTT, winsys->gart_size); -- cgit v1.2.3 From cdb6849fc1fa0c6e360c89a6388dc8bf19a746ca Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Thu, 3 Dec 2009 09:13:52 +0100 Subject: tgsi/ureg: Fix ureg_emit_src(). --- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index fb4b5fa868..8f0b9842ff 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -554,9 +554,7 @@ void ureg_emit_src( struct ureg_program *ureg, struct ureg_src src ) { - unsigned size = (1 + - (src.Absolute ? 1 : 0) + - (src.Indirect ? 1 : 0)); + unsigned size = 1 + (src.Indirect ? 1 : 0); union tgsi_any_token *out = get_tokens( ureg, DOMAIN_INSN, size ); unsigned n = 0; -- cgit v1.2.3 From 2b5618fc5bdcbee3434f8b5aa3a31eb06fb479c0 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Thu, 3 Dec 2009 11:20:40 -0500 Subject: r200: fix polygon stipple fixes fdo bug 25354 Signed-off-by: Alex Deucher --- src/mesa/drivers/dri/r200/r200_context.c | 4 ++-- src/mesa/drivers/dri/r200/r200_state.c | 7 ++----- src/mesa/drivers/dri/r200/r200_state.h | 2 +- src/mesa/drivers/dri/r200/r200_state_init.c | 15 ++++++--------- 4 files changed, 11 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 3ddb5bf7d6..4e34e0986d 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -325,9 +325,9 @@ GLboolean r200CreateContext( const __GLcontextModes *glVisual, _mesa_init_driver_functions(&functions); r200InitDriverFuncs(&functions); r200InitIoctlFuncs(&functions); - r200InitStateFuncs(&functions, screen->kernel_mm); + r200InitStateFuncs(&functions); r200InitTextureFuncs(&functions); - r200InitShaderFuncs(&functions); + r200InitShaderFuncs(&functions); radeonInitQueryObjFunctions(&functions); if (!radeonInitContext(&rmesa->radeon, &functions, diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index d28e96d9d9..6d99c039de 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -2476,7 +2476,7 @@ static void r200PolygonStipple( GLcontext *ctx, const GLubyte *mask ) } /* Initialize the driver's state functions. */ -void r200InitStateFuncs( struct dd_function_table *functions, GLboolean dri2 ) +void r200InitStateFuncs( struct dd_function_table *functions ) { functions->UpdateState = r200InvalidateState; functions->LightingSpaceChange = r200LightingSpaceChange; @@ -2510,10 +2510,7 @@ void r200InitStateFuncs( struct dd_function_table *functions, GLboolean dri2 ) functions->LogicOpcode = r200LogicOpCode; functions->PolygonMode = r200PolygonMode; functions->PolygonOffset = r200PolygonOffset; - if (dri2) - functions->PolygonStipple = r200PolygonStipple; - else - functions->PolygonStipple = radeonPolygonStipplePreKMS; + functions->PolygonStipple = r200PolygonStipple; functions->PointParameterfv = r200PointParameter; functions->PointSize = r200PointSize; functions->RenderMode = r200RenderMode; diff --git a/src/mesa/drivers/dri/r200/r200_state.h b/src/mesa/drivers/dri/r200/r200_state.h index 9c62f0a644..7b9b0c106a 100644 --- a/src/mesa/drivers/dri/r200/r200_state.h +++ b/src/mesa/drivers/dri/r200/r200_state.h @@ -38,7 +38,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r200_context.h" extern void r200InitState( r200ContextPtr rmesa ); -extern void r200InitStateFuncs( struct dd_function_table *functions, GLboolean dri2 ); +extern void r200InitStateFuncs( struct dd_function_table *functions ); extern void r200InitTnlFuncs( GLcontext *ctx ); extern void r200UpdateMaterial( GLcontext *ctx ); diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c index 7697306d88..8553be0197 100644 --- a/src/mesa/drivers/dri/r200/r200_state_init.c +++ b/src/mesa/drivers/dri/r200/r200_state_init.c @@ -885,10 +885,8 @@ void r200InitState( r200ContextPtr rmesa ) } } } - /* polygon stipple is done with irq for non-kms */ - if (rmesa->radeon.radeonScreen->kernel_mm) { - ALLOC_STATE( stp, always, STP_STATE_SIZE, "STP/stp", 0 ); - } + + ALLOC_STATE( stp, always, STP_STATE_SIZE, "STP/stp", 0 ); for (i = 0; i < 6; i++) if (rmesa->radeon.radeonScreen->kernel_mm) @@ -1120,12 +1118,11 @@ void r200InitState( r200ContextPtr rmesa ) rmesa->hw.sci.cmd[SCI_CMD_1] = CP_PACKET0(R200_RE_TOP_LEFT, 0); rmesa->hw.sci.cmd[SCI_CMD_2] = CP_PACKET0(R200_RE_WIDTH_HEIGHT, 0); - if (rmesa->radeon.radeonScreen->kernel_mm) { - - rmesa->hw.stp.cmd[STP_CMD_0] = CP_PACKET0(RADEON_RE_STIPPLE_ADDR, 0); - rmesa->hw.stp.cmd[STP_DATA_0] = 0; - rmesa->hw.stp.cmd[STP_CMD_1] = CP_PACKET0_ONE(RADEON_RE_STIPPLE_DATA, 31); + rmesa->hw.stp.cmd[STP_CMD_0] = CP_PACKET0(RADEON_RE_STIPPLE_ADDR, 0); + rmesa->hw.stp.cmd[STP_DATA_0] = 0; + rmesa->hw.stp.cmd[STP_CMD_1] = CP_PACKET0_ONE(RADEON_RE_STIPPLE_DATA, 31); + if (rmesa->radeon.radeonScreen->kernel_mm) { rmesa->hw.mtl[0].emit = mtl_emit; rmesa->hw.mtl[1].emit = mtl_emit; -- cgit v1.2.3 From 8cde43eb19c4dcceb74166e1da123d316a429c21 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Wed, 2 Dec 2009 23:03:51 +0100 Subject: radeon: properly check if image should be placed in the miptree Fixes #25355 --- src/mesa/drivers/dri/radeon/radeon_texture.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 0390d376ba..00e0658dc5 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -515,7 +515,10 @@ static int image_matches_texture_obj(struct gl_texture_object *texObj, struct gl_texture_image *texImage, unsigned level) { - const struct gl_texture_image *baseImage = texObj->Image[0][level]; + const struct gl_texture_image *baseImage = texObj->Image[0][texObj->BaseLevel]; + + if (!baseImage) + return 0; if (level < texObj->BaseLevel || level > texObj->MaxLevel) return 0; -- cgit v1.2.3 From 6c41bb25a2e260dbce2c2d72ec64d1beb74527de Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Thu, 3 Dec 2009 20:21:16 +0100 Subject: radeon: workaround an FBO issue Fixes #21501 --- src/mesa/drivers/dri/radeon/radeon_fbo.c | 6 ++++++ src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 3 +++ 2 files changed, 9 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 7ec641ff18..fc21069a92 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -369,6 +369,12 @@ radeon_framebuffer_renderbuffer(GLcontext * ctx, } +/* TODO: According to EXT_fbo spec internal format of texture image + * once set during glTexImage call, should be preserved when + * attaching image to renderbuffer. When HW doesn't support + * rendering to format of attached image, set framebuffer + * completeness accordingly in radeon_validate_framebuffer (issue #79). + */ static GLboolean radeon_update_wrapper(GLcontext *ctx, struct radeon_renderbuffer *rrb, struct gl_texture_image *texImage) diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index a9d601a0b5..0415a50d0b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -421,9 +421,12 @@ static void migrate_image_to_miptree(radeon_mipmap_tree *mt, radeon_mipmap_level *srclvl = &image->mt->levels[image->mtlevel]; + /* TODO: bring back these assertions once the FBOs are fixed */ +#if 0 assert(image->mtlevel == level); assert(srclvl->size == dstlvl->size); assert(srclvl->rowstride == dstlvl->rowstride); +#endif radeon_bo_map(image->mt->bo, GL_FALSE); -- cgit v1.2.3 From 35a15f02634a31c1517363d91aaef8f190e24687 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Thu, 3 Dec 2009 23:15:38 +0100 Subject: gallium: fix reference counting functions to be strict-aliasing compliant Historically, parts of mesa code are not strict-aliasing safe, hence -fno-strict-aliasing is needed to compile (this got forgotten for scons builds for gallium, which indeed not only caused compiler warnings but also unexplicable crashes in non-debug builds). However, we should try to eliminate code not complying with strict-aliasing code at least for gallium. Hence change pipe_reference functions to make them strict-aliasing compliant. This adds a bit more complexity (especially for derived classes) but is the right thing to do, and it does in fact fix a segfault. --- src/gallium/auxiliary/pipebuffer/pb_buffer.h | 3 ++- src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c | 5 ++++- src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c | 3 +++ src/gallium/drivers/svga/svga_screen_texture.h | 3 ++- src/gallium/include/pipe/p_refcnt.h | 18 ++++++++---------- src/gallium/include/pipe/p_state.h | 9 ++++++--- src/gallium/include/pipe/p_video_state.h | 3 ++- 7 files changed, 27 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer.h b/src/gallium/auxiliary/pipebuffer/pb_buffer.h index 4ef372233f..eb7e84be84 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer.h +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer.h @@ -237,8 +237,9 @@ pb_reference(struct pb_buffer **dst, { struct pb_buffer *old = *dst; - if (pipe_reference((struct pipe_reference**)dst, &src->base.reference)) + if (pipe_reference(&(*dst)->base.reference, &src->base.reference)) pb_destroy( old ); + *dst = src; } diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c index 2f973684f6..a9375abd21 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c @@ -243,6 +243,7 @@ fenced_buffer_list_check_free_locked(struct fenced_buffer_list *fenced_list, struct pb_fence_ops *ops = fenced_list->ops; struct list_head *curr, *next; struct fenced_buffer *fenced_buf; + struct pb_buffer *pb_buf; struct pipe_fence_handle *prev_fence = NULL; curr = fenced_list->delayed.next; @@ -271,7 +272,9 @@ fenced_buffer_list_check_free_locked(struct fenced_buffer_list *fenced_list, fenced_buffer_remove_locked(fenced_list, fenced_buf); pipe_mutex_unlock(fenced_buf->mutex); - pb_reference((struct pb_buffer **)&fenced_buf, NULL); + pb_buf = &fenced_buf->base; + pb_reference(&pb_buf, NULL); + curr = next; next = curr->next; diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c index 57d1ede45a..f0c88a0ccb 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c @@ -293,8 +293,11 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr, if(buf) { LIST_DEL(&buf->head); pipe_mutex_unlock(mgr->mutex); +#if 0 + /* XXX this didn't do anything right??? */ /* Increase refcount */ pb_reference((struct pb_buffer**)&buf, &buf->base); +#endif return &buf->base; } diff --git a/src/gallium/drivers/svga/svga_screen_texture.h b/src/gallium/drivers/svga/svga_screen_texture.h index 1cc4063e65..727f2c51d2 100644 --- a/src/gallium/drivers/svga/svga_screen_texture.h +++ b/src/gallium/drivers/svga/svga_screen_texture.h @@ -164,8 +164,9 @@ svga_sampler_view_reference(struct svga_sampler_view **ptr, struct svga_sampler_ { struct svga_sampler_view *old = *ptr; - if (pipe_reference((struct pipe_reference **)ptr, &v->reference)) + if (pipe_reference(&(*ptr)->reference, &v->reference)) svga_destroy_sampler_view_priv(old); + *ptr = v; } extern void diff --git a/src/gallium/include/pipe/p_refcnt.h b/src/gallium/include/pipe/p_refcnt.h index 1f9088b3e9..f1875b6b82 100644 --- a/src/gallium/include/pipe/p_refcnt.h +++ b/src/gallium/include/pipe/p_refcnt.h @@ -59,30 +59,28 @@ pipe_is_referenced(struct pipe_reference *reference) /** - * Set 'ptr' to point to 'reference' and update reference counting. - * The old thing pointed to, if any, will be unreferenced first. - * 'reference' may be NULL. + * Update reference counting. + * The old thing pointed to, if any, will be unreferenced. + * Both 'ptr' and 'reference' may be NULL. */ static INLINE bool -pipe_reference(struct pipe_reference **ptr, struct pipe_reference *reference) +pipe_reference(struct pipe_reference *ptr, struct pipe_reference *reference) { bool destroy = FALSE; - if(*ptr != reference) { + if(ptr != reference) { /* bump the reference.count first */ if (reference) { assert(pipe_is_referenced(reference)); p_atomic_inc(&reference->count); } - if (*ptr) { - assert(pipe_is_referenced(*ptr)); - if (p_atomic_dec_zero(&(*ptr)->count)) { + if (ptr) { + assert(pipe_is_referenced(ptr)); + if (p_atomic_dec_zero(&ptr->count)) { destroy = TRUE; } } - - *ptr = reference; } return destroy; diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h index 6de7af6a81..b9dfa1c7d3 100644 --- a/src/gallium/include/pipe/p_state.h +++ b/src/gallium/include/pipe/p_state.h @@ -400,8 +400,9 @@ pipe_buffer_reference(struct pipe_buffer **ptr, struct pipe_buffer *buf) { struct pipe_buffer *old_buf = *ptr; - if (pipe_reference((struct pipe_reference **)ptr, &buf->reference)) + if (pipe_reference(&(*ptr)->reference, &buf->reference)) old_buf->screen->buffer_destroy(old_buf); + *ptr = buf; } static INLINE void @@ -409,8 +410,9 @@ pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf) { struct pipe_surface *old_surf = *ptr; - if (pipe_reference((struct pipe_reference **)ptr, &surf->reference)) + if (pipe_reference(&(*ptr)->reference, &surf->reference)) old_surf->texture->screen->tex_surface_destroy(old_surf); + *ptr = surf; } static INLINE void @@ -418,8 +420,9 @@ pipe_texture_reference(struct pipe_texture **ptr, struct pipe_texture *tex) { struct pipe_texture *old_tex = *ptr; - if (pipe_reference((struct pipe_reference **)ptr, &tex->reference)) + if (pipe_reference(&(*ptr)->reference, &tex->reference)) old_tex->screen->texture_destroy(old_tex); + *ptr = tex; } diff --git a/src/gallium/include/pipe/p_video_state.h b/src/gallium/include/pipe/p_video_state.h index 4da26d608c..b85f01c2b0 100644 --- a/src/gallium/include/pipe/p_video_state.h +++ b/src/gallium/include/pipe/p_video_state.h @@ -56,8 +56,9 @@ pipe_video_surface_reference(struct pipe_video_surface **ptr, struct pipe_video_ { struct pipe_video_surface *old_surf = *ptr; - if (pipe_reference((struct pipe_reference **)ptr, &surf->reference)) + if (pipe_reference(&(*ptr)->reference, &surf->reference)) old_surf->screen->video_surface_destroy(old_surf); + *ptr = surf; } struct pipe_video_rect -- cgit v1.2.3 From 13c647fa0d3e361efbb10a6d313bdc6bf7c890e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 3 Dec 2009 23:20:56 +0100 Subject: gallium: fix ref counting bug in pb_bufmgr This was discovered by the pipe_reference api change. --- src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c index f0c88a0ccb..7b34c8e357 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_cache.c @@ -293,11 +293,8 @@ pb_cache_manager_create_buffer(struct pb_manager *_mgr, if(buf) { LIST_DEL(&buf->head); pipe_mutex_unlock(mgr->mutex); -#if 0 - /* XXX this didn't do anything right??? */ /* Increase refcount */ - pb_reference((struct pb_buffer**)&buf, &buf->base); -#endif + pipe_reference(NULL, &buf->base.base.reference); return &buf->base; } -- cgit v1.2.3 From 86c8f70db10a584aa78e4d5f397ad3543fdb77d2 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Thu, 3 Dec 2009 23:26:13 +0100 Subject: mesa: use _mesa_memcpy for COPY_4FV macro Gets rid of one of the worst strict-aliasing offenders, and actually produces faster code (at least in some cases, when compiler can use for instance 64bit moves for memcpy). (note _mesa_memcpy should get inlined) --- src/mesa/main/macros.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index 3d9a1aba98..f0ea463fb9 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -202,17 +202,12 @@ do { \ #endif /** - * Copy a 4-element float vector (avoid using FPU registers) - * XXX Could use two 64-bit moves on 64-bit systems + * Copy a 4-element float vector + * memcpy seems to be most efficient */ #define COPY_4FV( DST, SRC ) \ do { \ - const GLuint *_s = (const GLuint *) (SRC); \ - GLuint *_d = (GLuint *) (DST); \ - _d[0] = _s[0]; \ - _d[1] = _s[1]; \ - _d[2] = _s[2]; \ - _d[3] = _s[3]; \ + _mesa_memcpy(DST, SRC, sizeof(GLfloat) * 4); \ } while (0) /** Copy \p SZ elements into a 4-element vector */ -- cgit v1.2.3 From 4153ec547cfb7fcb26bbeb09ac9ef19fe88d3e4e Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Thu, 3 Dec 2009 23:58:30 +0100 Subject: gallium: fix remaining users of pipe_reference function --- src/gallium/drivers/nouveau/nouveau_stateobj.h | 3 ++- src/gallium/state_trackers/python/st_device.c | 3 ++- src/gallium/winsys/drm/intel/gem/intel_drm_fence.c | 3 ++- src/gallium/winsys/drm/vmware/core/vmw_surface.c | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nouveau/nouveau_stateobj.h b/src/gallium/drivers/nouveau/nouveau_stateobj.h index b595405357..62990f9b6a 100644 --- a/src/gallium/drivers/nouveau/nouveau_stateobj.h +++ b/src/gallium/drivers/nouveau/nouveau_stateobj.h @@ -48,13 +48,14 @@ 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)) { + if (pipe_reference(&(*pso)->reference, &ref->reference)) { free(so->push); for (i = 0; i < so->cur_reloc; i++) nouveau_bo_ref(NULL, &so->reloc[i].bo); free(so->reloc); free(so); } + *pso = ref; } static INLINE void diff --git a/src/gallium/state_trackers/python/st_device.c b/src/gallium/state_trackers/python/st_device.c index a791113aba..f19cf4b577 100644 --- a/src/gallium/state_trackers/python/st_device.c +++ b/src/gallium/state_trackers/python/st_device.c @@ -62,8 +62,9 @@ st_device_reference(struct st_device **ptr, struct st_device *st_dev) { struct st_device *old_dev = *ptr; - if (pipe_reference((struct pipe_reference **)ptr, &st_dev->reference)) + if (pipe_reference(&(*ptr)->reference, &st_dev->reference)) st_device_really_destroy(old_dev); + *ptr = st_dev; } diff --git a/src/gallium/winsys/drm/intel/gem/intel_drm_fence.c b/src/gallium/winsys/drm/intel/gem/intel_drm_fence.c index e70bfe7b44..b6248a3bcf 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_drm_fence.c +++ b/src/gallium/winsys/drm/intel/gem/intel_drm_fence.c @@ -39,11 +39,12 @@ intel_drm_fence_reference(struct intel_winsys *iws, struct intel_drm_fence *old = (struct intel_drm_fence *)*ptr; struct intel_drm_fence *f = (struct intel_drm_fence *)fence; - if (pipe_reference((struct pipe_reference**)ptr, &f->reference)) { + if (pipe_reference(&(*ptr)->reference, &f->reference)) { if (old->bo) drm_intel_bo_unreference(old->bo); FREE(old); } + *ptr = fence; } static int diff --git a/src/gallium/winsys/drm/vmware/core/vmw_surface.c b/src/gallium/winsys/drm/vmware/core/vmw_surface.c index 64eb32f8b9..5f1b9ad577 100644 --- a/src/gallium/winsys/drm/vmware/core/vmw_surface.c +++ b/src/gallium/winsys/drm/vmware/core/vmw_surface.c @@ -47,7 +47,7 @@ vmw_svga_winsys_surface_reference(struct vmw_svga_winsys_surface **pdst, src_ref = src ? &src->refcnt : NULL; dst_ref = dst ? &dst->refcnt : NULL; - if (pipe_reference(&dst_ref, src_ref)) { + if (pipe_reference(dst_ref, src_ref)) { vmw_ioctl_surface_destroy(dst->screen, dst->sid); #ifdef DEBUG /* to detect dangling pointers */ -- cgit v1.2.3 From 9dfbd1be446b9c0680a0d55729fb6b3f5938b0c5 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 4 Dec 2009 00:42:53 +0100 Subject: vega: fix missing include --- src/gallium/state_trackers/vega/vg_tracker.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/state_trackers/vega/vg_tracker.c b/src/gallium/state_trackers/vega/vg_tracker.c index ed18dd6075..5a286b1449 100644 --- a/src/gallium/state_trackers/vega/vg_tracker.c +++ b/src/gallium/state_trackers/vega/vg_tracker.c @@ -33,6 +33,7 @@ #include "pipe/p_screen.h" #include "util/u_memory.h" #include "util/u_math.h" +#include "util/u_rect.h" static struct pipe_texture * create_texture(struct pipe_context *pipe, enum pipe_format format, -- cgit v1.2.3 From 905e12f3cce7f1bd8cfa990e4d6d7c0b14610f84 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 14:20:15 -0800 Subject: gallium/util: Initialize variables in u_pack_color.h. (cherry picked from commit 36e2074b63e3e5bc489eb74cad0cd97eafcedb40) --- src/gallium/auxiliary/util/u_pack_color.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h index eda883b3b9..9dacc6d83d 100644 --- a/src/gallium/auxiliary/util/u_pack_color.h +++ b/src/gallium/auxiliary/util/u_pack_color.h @@ -302,7 +302,10 @@ util_unpack_color_ub(enum pipe_format format, const void *src, static INLINE void util_pack_color(const float rgba[4], enum pipe_format format, void *dest) { - ubyte r, g, b, a; + ubyte r = 0; + ubyte g = 0; + ubyte b = 0; + ubyte a = 0; if (pf_size_x(format) <= 8) { /* format uses 8-bit components or less */ -- cgit v1.2.3 From d23bb22f6258a4b55af42fdb3f29fec2e694df72 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 22 Nov 2009 01:45:53 -0500 Subject: glu: Fix memory leak in __gl_meshMakeEdge. (cherry picked from commit d3b4c99c703f70a9d0e715a97e52672f7f8fc980) --- src/glu/sgi/libtess/mesh.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/glu/sgi/libtess/mesh.c b/src/glu/sgi/libtess/mesh.c index ae861f8642..95f87cdc94 100644 --- a/src/glu/sgi/libtess/mesh.c +++ b/src/glu/sgi/libtess/mesh.c @@ -284,7 +284,12 @@ GLUhalfEdge *__gl_meshMakeEdge( GLUmesh *mesh ) } e = MakeEdge( &mesh->eHead ); - if (e == NULL) return NULL; + if (e == NULL) { + memFree(newVertex1); + memFree(newVertex2); + memFree(newFace); + return NULL; + } MakeVertex( newVertex1, e, &mesh->vHead ); MakeVertex( newVertex2, e->Sym, &mesh->vHead ); -- cgit v1.2.3 From fe38c16021694145b2c96818e0c0fb095e42c03b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 22 Nov 2009 01:57:35 -0500 Subject: glu/sgi: Fix memory leak in gluScaleImage. (cherry picked from commit a9c540f5dedbf593f8038fdbc95eecb60826ab26) --- src/glu/sgi/libutil/mipmap.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c index af647af73c..4139c304a1 100644 --- a/src/glu/sgi/libutil/mipmap.c +++ b/src/glu/sgi/libutil/mipmap.c @@ -3526,6 +3526,8 @@ gluScaleImage(GLenum format, GLsizei widthin, GLsizei heightin, afterImage = malloc(image_size(widthout, heightout, format, GL_UNSIGNED_SHORT)); if (beforeImage == NULL || afterImage == NULL) { + free(beforeImage); + free(afterImage); return GLU_OUT_OF_MEMORY; } -- cgit v1.2.3 From 6c1fc2b2a5c80697dff304562e79dae25d9f2cb1 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 23 Nov 2009 00:57:37 -0500 Subject: glu/sgi: Fix memory leak in gluScaleImage3D. (cherry picked from commit b611f639b4bffdcca376293f7ce71af9f6bdbff3) --- src/glu/sgi/libutil/mipmap.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c index 4139c304a1..223621f49f 100644 --- a/src/glu/sgi/libutil/mipmap.c +++ b/src/glu/sgi/libutil/mipmap.c @@ -7384,6 +7384,8 @@ int gluScaleImage3D(GLenum format, afterImage = malloc(imageSize3D(widthOut, heightOut, depthOut, format, GL_UNSIGNED_SHORT)); if (beforeImage == NULL || afterImage == NULL) { + free(beforeImage); + free(afterImage); return GLU_OUT_OF_MEMORY; } retrieveStoreModes3D(&psm); -- cgit v1.2.3 From 80a3944a4d6a07793872d283633546d482cf61b7 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 23 Nov 2009 01:09:06 -0500 Subject: glu/sgi: Fix memory leak in bitmapBuild2DMipmaps. (cherry picked from commit 5b925b7daa566d799c4f50911a7fcca114131503) --- src/glu/sgi/libutil/mipmap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c index 223621f49f..c5faebd6a3 100644 --- a/src/glu/sgi/libutil/mipmap.c +++ b/src/glu/sgi/libutil/mipmap.c @@ -3762,6 +3762,7 @@ static int bitmapBuild2DMipmaps(GLenum target, GLint internalFormat, glPixelStorei(GL_UNPACK_SKIP_PIXELS,psm.unpack_skip_pixels); glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + free(newImage); return GLU_OUT_OF_MEMORY; } } -- cgit v1.2.3 From 7ed749c062c2bc2b048a34f8e4c6b0a5198e32bb Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 24 Nov 2009 01:23:12 -0500 Subject: glu/sgi: Fix memory leak in gluBuild3DMipmapLevelsCore. (cherry picked from commit 326b66d724754ca97012501db1c7c62d7d41a457) --- src/glu/sgi/libutil/mipmap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c index c5faebd6a3..a5d07a59cf 100644 --- a/src/glu/sgi/libutil/mipmap.c +++ b/src/glu/sgi/libutil/mipmap.c @@ -8232,6 +8232,7 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); glPixelStorei(GL_UNPACK_SKIP_IMAGES, psm.unpack_skip_images); glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, psm.unpack_image_height); + free(srcImage); return GLU_OUT_OF_MEMORY; } } -- cgit v1.2.3 From 7b5eba453e08dfad151d09ba4d308cbdf4fc83af Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Nov 2009 00:18:49 -0500 Subject: glu/sgi: Fix memory leak in gluBuild3DMipmapLevelsCore. (cherry picked from commit f895abbd9777c4985aa40cf660c68f6d7333f0ec) --- src/glu/sgi/libutil/mipmap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c index a5d07a59cf..22d702291f 100644 --- a/src/glu/sgi/libutil/mipmap.c +++ b/src/glu/sgi/libutil/mipmap.c @@ -8098,6 +8098,7 @@ static int gluBuild3DMipmapLevelsCore(GLenum target, GLint internalFormat, glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); glPixelStorei(GL_UNPACK_SKIP_IMAGES, psm.unpack_skip_images); glPixelStorei(GL_UNPACK_IMAGE_HEIGHT, psm.unpack_image_height); + free(srcImage); return GLU_OUT_OF_MEMORY; } /* level userLevel+1 is in srcImage; level userLevel already saved */ -- cgit v1.2.3 From ea487c6d0b261bf90e898f51bc9f872de8166ddb Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Nov 2009 00:28:56 -0500 Subject: glu/sgi: Fix memory leak in gluBuild2DMipmapLevelsCore. (cherry picked from commit 0d89f3dc7ff3f89ba8d5d664253730485bca35e2) --- src/glu/sgi/libutil/mipmap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c index 22d702291f..796be0aad3 100644 --- a/src/glu/sgi/libutil/mipmap.c +++ b/src/glu/sgi/libutil/mipmap.c @@ -4349,6 +4349,7 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels); glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + free(srcImage); return GLU_OUT_OF_MEMORY; } } -- cgit v1.2.3 From 8df551c46bc15a4b1ce1dc11e083498442018418 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 25 Nov 2009 00:39:37 -0500 Subject: glu/sgi: Fix memory leak in gluBuild1DMipmapLevelsCore. (cherry picked from commit 94bcb9f1a43f2ab3bdff09156e3ab5b1c115cbd8) --- src/glu/sgi/libutil/mipmap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c index 796be0aad3..bf6eaf88c6 100644 --- a/src/glu/sgi/libutil/mipmap.c +++ b/src/glu/sgi/libutil/mipmap.c @@ -3608,6 +3608,7 @@ int gluBuild1DMipmapLevelsCore(GLenum target, GLint internalFormat, glPixelStorei(GL_UNPACK_SKIP_PIXELS,psm.unpack_skip_pixels); glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + free(newImage); return GLU_OUT_OF_MEMORY; } } -- cgit v1.2.3 From c74afe0c46dbd0f90361c06526f70885a9061e8e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 26 Nov 2009 00:35:31 -0500 Subject: glu/sgi: Fix memory leak in gluBuild2DMipmapLevelsCore. (cherry picked from commit 808f0376607b0e2d31dfebc888fd8f1e737fed09) --- src/glu/sgi/libutil/mipmap.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/glu/sgi/libutil/mipmap.c b/src/glu/sgi/libutil/mipmap.c index bf6eaf88c6..d1fd5a7d72 100644 --- a/src/glu/sgi/libutil/mipmap.c +++ b/src/glu/sgi/libutil/mipmap.c @@ -4108,6 +4108,7 @@ static int gluBuild2DMipmapLevelsCore(GLenum target, GLint internalFormat, glPixelStorei(GL_UNPACK_SKIP_PIXELS, psm.unpack_skip_pixels); glPixelStorei(GL_UNPACK_ROW_LENGTH, psm.unpack_row_length); glPixelStorei(GL_UNPACK_SWAP_BYTES, psm.unpack_swap_bytes); + free(srcImage); return GLU_OUT_OF_MEMORY; } /* level userLevel+1 is in srcImage; level userLevel already saved */ -- cgit v1.2.3 From 47e128331a26fa61506920c48bc82eaf5bd0460a Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 4 Dec 2009 09:42:10 +0100 Subject: vmware/core: Update vmwgfx_drm.h to include cursor bypass --- src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h | 32 +++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h b/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h index 6bf3183ff5..56070a1ba1 100644 --- a/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h +++ b/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h @@ -46,6 +46,7 @@ #define DRM_VMW_FIFO_DEBUG 11 #define DRM_VMW_FENCE_WAIT 12 #define DRM_VMW_OVERLAY 13 +#define DRM_VMW_CURSOR_BYPASS 14 /*************************************************************************/ /** @@ -503,4 +504,35 @@ struct drm_vmw_overlay_arg { struct drm_vmw_rect dst; }; +/*************************************************************************/ +/** + * DRM_VMW_CURSOR_BYPASS - Give extra information about cursor bypass. + * + */ + +#define DRM_VMW_CURSOR_BYPASS_ALL (1 << 0) +#define DRM_VMW_CURSOR_BYPASS_FLAGS (1) + +/** + * struct drm_vmw_cursor_bypass_arg + * + * @flags: Flags. + * @crtc_id: Crtc id, only used if DMR_CURSOR_BYPASS_ALL isn't passed. + * @xpos: X position of cursor. + * @ypos: Y position of cursor. + * @xhot: X hotspot. + * @yhot: Y hotspot. + * + * Argument to the DRM_VMW_CURSOR_BYPASS Ioctl. + */ + +struct drm_vmw_cursor_bypass_arg { + uint32_t flags; + uint32_t crtc_id; + int32_t xpos; + int32_t ypos; + int32_t xhot; + int32_t yhot; +}; + #endif -- cgit v1.2.3 From 12fdef20b02595c10cec91aad75abe6ca59f5513 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 4 Dec 2009 09:40:52 +0100 Subject: vmware/xorg: Handle no init of video in vmw_video_close --- src/gallium/winsys/drm/vmware/xorg/vmw_video.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_video.c b/src/gallium/winsys/drm/vmware/xorg/vmw_video.c index 6e34aa21f3..d62c3b7296 100644 --- a/src/gallium/winsys/drm/vmware/xorg/vmw_video.c +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_video.c @@ -342,6 +342,8 @@ vmw_video_close(ScrnInfoPtr pScrn, struct vmw_driver *vmw) debug_printf("%s: enter\n", __func__); video = vmw->video_priv; + if (!video) + return TRUE; for (i = 0; i < VMWARE_VID_NUM_PORTS; ++i) { vmw_video_port_cleanup(pScrn, &video->port[i]); -- cgit v1.2.3 From cd4d806a47d2cbb706a9f1cd49d990fcb803efb6 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 4 Dec 2009 09:53:00 +0100 Subject: vmware/xorg: Give kernel infromation about cursor bypass --- src/gallium/winsys/drm/vmware/xorg/vmw_driver.h | 4 ++ src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c | 17 ++++++++ src/gallium/winsys/drm/vmware/xorg/vmw_screen.c | 58 +++++++++++++++++++++++-- 3 files changed, 75 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h b/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h index 04d446a2df..db6b89b8bc 100644 --- a/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h @@ -44,6 +44,8 @@ struct vmw_driver { int fd; + void *cursor_priv; + /* vmw_video.c */ void *video_priv; }; @@ -69,6 +71,8 @@ Bool vmw_video_close(ScrnInfoPtr pScrn, struct vmw_driver *vmw); * vmw_ioctl.c */ +int vmw_ioctl_cursor_bypass(struct vmw_driver *vmw, int xhot, int yhot); + struct vmw_dma_buffer * vmw_ioctl_buffer_create(struct vmw_driver *vmw, uint32_t size, unsigned *handle); diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c b/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c index 3cac5b7760..7ec651db05 100644 --- a/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c @@ -54,6 +54,23 @@ struct vmw_dma_buffer uint32_t size; }; +int +vmw_ioctl_cursor_bypass(struct vmw_driver *vmw, int xhot, int yhot) +{ + struct drm_vmw_cursor_bypass_arg arg; + int ret; + + memset(&arg, 0, sizeof(arg)); + arg.flags = DRM_VMW_CURSOR_BYPASS_ALL; + arg.xhot = xhot; + arg.yhot = yhot; + + ret = drmCommandWriteRead(vmw->fd, DRM_VMW_CURSOR_BYPASS, + &arg, sizeof(arg)); + + return ret; +} + struct vmw_dma_buffer * vmw_ioctl_buffer_create(struct vmw_driver *vmw, uint32_t size, unsigned *handle) { diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_screen.c b/src/gallium/winsys/drm/vmware/xorg/vmw_screen.c index 344ef0b315..421906da99 100644 --- a/src/gallium/winsys/drm/vmware/xorg/vmw_screen.c +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_screen.c @@ -33,16 +33,58 @@ #include "vmw_hook.h" #include "vmw_driver.h" +/* modified version of crtc functions */ +xf86CrtcFuncsRec vmw_screen_crtc_funcs; + +static void +vmw_screen_cursor_load_argb(xf86CrtcPtr crtc, CARD32 *image) +{ + struct vmw_driver *vmw = modesettingPTR(crtc->scrn)->winsys_priv; + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(crtc->scrn); + xf86CrtcFuncsPtr funcs = vmw->cursor_priv; + CursorPtr c = config->cursor; + + /* Run the ioctl before uploading the image */ + vmw_ioctl_cursor_bypass(vmw, c->bits->xhot, c->bits->yhot); + + funcs->load_cursor_argb(crtc, image); +} + +static void +vmw_screen_cursor_init(ScrnInfoPtr pScrn, struct vmw_driver *vmw) +{ + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); + int i; + + /* XXX assume that all crtc's have the same function struct */ + + /* Save old struct need to call the old functions as well */ + vmw->cursor_priv = (void*)(config->crtc[0]->funcs); + memcpy(&vmw_screen_crtc_funcs, vmw->cursor_priv, sizeof(xf86CrtcFuncsRec)); + vmw_screen_crtc_funcs.load_cursor_argb = vmw_screen_cursor_load_argb; + + for (i = 0; i < config->num_crtc; i++) + config->crtc[i]->funcs = &vmw_screen_crtc_funcs; +} + +static void +vmw_screen_cursor_close(ScrnInfoPtr pScrn, struct vmw_driver *vmw) +{ + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); + int i; + + vmw_ioctl_cursor_bypass(vmw, 0, 0); + + for (i = 0; i < config->num_crtc; i++) + config->crtc[i]->funcs = vmw->cursor_priv; +} + static Bool vmw_screen_init(ScrnInfoPtr pScrn) { modesettingPtr ms = modesettingPTR(pScrn); struct vmw_driver *vmw; - /* if gallium is used then we don't need to do anything. */ - if (ms->screen) - return TRUE; - vmw = xnfcalloc(sizeof(*vmw), 1); if (!vmw) return FALSE; @@ -50,6 +92,12 @@ vmw_screen_init(ScrnInfoPtr pScrn) vmw->fd = ms->fd; ms->winsys_priv = vmw; + vmw_screen_cursor_init(pScrn, vmw); + + /* if gallium is used then we don't need to do anything more. */ + if (ms->screen) + return TRUE; + vmw_video_init(pScrn, vmw); return TRUE; @@ -64,6 +112,8 @@ vmw_screen_close(ScrnInfoPtr pScrn) if (!vmw) return TRUE; + vmw_screen_cursor_close(pScrn, vmw); + vmw_video_close(pScrn, vmw); ms->winsys_priv = NULL; -- cgit v1.2.3 From 1ef8c493b25cdb4bb006f9198c00acacd19e2c75 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 4 Dec 2009 10:31:51 +0100 Subject: vmware/xorg: Use Write instead of WriteRead for cursor bypass --- src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c b/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c index 7ec651db05..ad6993840d 100644 --- a/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c @@ -65,8 +65,8 @@ vmw_ioctl_cursor_bypass(struct vmw_driver *vmw, int xhot, int yhot) arg.xhot = xhot; arg.yhot = yhot; - ret = drmCommandWriteRead(vmw->fd, DRM_VMW_CURSOR_BYPASS, - &arg, sizeof(arg)); + ret = drmCommandWrite(vmw->fd, DRM_VMW_CURSOR_BYPASS, + &arg, sizeof(arg)); return ret; } -- cgit v1.2.3 From a4b3bb12d7627a0bb39dd625e7646c9ef9ccd7fb Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 4 Dec 2009 11:49:42 +0000 Subject: softpipe: fix double-minify in texture layout --- src/gallium/drivers/softpipe/sp_texture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_texture.c b/src/gallium/drivers/softpipe/sp_texture.c index bd653216c0..4f946ccfcf 100644 --- a/src/gallium/drivers/softpipe/sp_texture.c +++ b/src/gallium/drivers/softpipe/sp_texture.c @@ -67,7 +67,7 @@ softpipe_texture_layout(struct pipe_screen *screen, spt->level_offset[level] = buffer_size; - buffer_size += (pf_get_nblocksy(pt->format, u_minify(height, level)) * + buffer_size += (pf_get_nblocksy(pt->format, height) * ((pt->target == PIPE_TEXTURE_CUBE) ? 6 : depth) * spt->stride[level]); -- cgit v1.2.3 From 6bb415f862fec94b82915f806beb3a7427bd4bb8 Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Fri, 4 Dec 2009 14:15:21 +0000 Subject: softpipe: dont claim to support PIPE_FORMAT_NONE --- src/gallium/drivers/softpipe/sp_screen.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c index 6bf3df8e6a..bd3532de4f 100644 --- a/src/gallium/drivers/softpipe/sp_screen.c +++ b/src/gallium/drivers/softpipe/sp_screen.c @@ -149,6 +149,7 @@ softpipe_is_format_supported( struct pipe_screen *screen, case PIPE_FORMAT_B6UG5SR5S_NORM: case PIPE_FORMAT_X8UB8UG8SR8S_NORM: case PIPE_FORMAT_A8B8G8R8_SNORM: + case PIPE_FORMAT_NONE: return FALSE; default: return TRUE; -- cgit v1.2.3 From 8d8fd9776e23a34e0d22e489ce1f85eb5e383121 Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Fri, 4 Dec 2009 09:52:37 -0500 Subject: radeon: fix polygon stipple fixes fdo bug 25354 Signed-off-by: Alex Deucher --- src/mesa/drivers/dri/radeon/radeon_common.c | 23 ----------------------- src/mesa/drivers/dri/radeon/radeon_common.h | 1 - src/mesa/drivers/dri/radeon/radeon_context.h | 4 ++++ src/mesa/drivers/dri/radeon/radeon_state.c | 25 +++++++++++++++++++++++++ 4 files changed, 29 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index 8032cbcd69..5b2bcfdb24 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -262,29 +262,6 @@ void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h) } } -void radeonPolygonStipplePreKMS( GLcontext *ctx, const GLubyte *mask ) -{ - radeonContextPtr radeon = RADEON_CONTEXT(ctx); - GLuint i; - drm_radeon_stipple_t stipple; - - /* Must flip pattern upside down. - */ - for ( i = 0 ; i < 32 ; i++ ) { - stipple.mask[31 - i] = ((GLuint *) mask)[i]; - } - - /* TODO: push this into cmd mechanism - */ - radeon_firevertices(radeon); - LOCK_HARDWARE( radeon ); - - drmCommandWrite( radeon->dri.fd, DRM_RADEON_STIPPLE, - &stipple, sizeof(stipple) ); - UNLOCK_HARDWARE( radeon ); -} - - /* ================================================================ * SwapBuffers with client-side throttling */ diff --git a/src/mesa/drivers/dri/radeon/radeon_common.h b/src/mesa/drivers/dri/radeon/radeon_common.h index f3201911ac..a9e1ca49eb 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.h +++ b/src/mesa/drivers/dri/radeon/radeon_common.h @@ -10,7 +10,6 @@ void radeonRecalcScissorRects(radeonContextPtr radeon); void radeonSetCliprects(radeonContextPtr radeon); void radeonUpdateScissor( GLcontext *ctx ); void radeonScissor(GLcontext* ctx, GLint x, GLint y, GLsizei w, GLsizei h); -void radeonPolygonStipplePreKMS( GLcontext *ctx, const GLubyte *mask ); void radeonWaitForIdleLocked(radeonContextPtr radeon); extern uint32_t radeonGetAge(radeonContextPtr radeon); diff --git a/src/mesa/drivers/dri/radeon/radeon_context.h b/src/mesa/drivers/dri/radeon/radeon_context.h index 4e2c52c835..12ab33a009 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_context.h @@ -331,8 +331,12 @@ struct r100_hw_state { struct radeon_state_atom stp; }; +struct radeon_stipple_state { + GLuint mask[32]; +}; struct r100_state { + struct radeon_stipple_state stipple; struct radeon_texture_state texture; }; diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index 4d0d35ee0c..f6c733ab20 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -550,6 +550,31 @@ static void radeonPolygonOffset( GLcontext *ctx, rmesa->hw.zbs.cmd[ZBS_SE_ZBIAS_CONSTANT] = constant.ui32; } +static void radeonPolygonStipplePreKMS( GLcontext *ctx, const GLubyte *mask ) +{ + r100ContextPtr rmesa = R100_CONTEXT(ctx); + GLuint i; + drm_radeon_stipple_t stipple; + + /* Must flip pattern upside down. + */ + for ( i = 0 ; i < 32 ; i++ ) { + rmesa->state.stipple.mask[31 - i] = ((GLuint *) mask)[i]; + } + + /* TODO: push this into cmd mechanism + */ + radeon_firevertices(&rmesa->radeon); + LOCK_HARDWARE( &rmesa->radeon ); + + /* FIXME: Use window x,y offsets into stipple RAM. + */ + stipple.mask = rmesa->state.stipple.mask; + drmCommandWrite( rmesa->radeon.dri.fd, DRM_RADEON_STIPPLE, + &stipple, sizeof(drm_radeon_stipple_t) ); + UNLOCK_HARDWARE( &rmesa->radeon ); +} + static void radeonPolygonMode( GLcontext *ctx, GLenum face, GLenum mode ) { r100ContextPtr rmesa = R100_CONTEXT(ctx); -- cgit v1.2.3 From 225bc70b77fcf107dd8abc93be27a15c27743071 Mon Sep 17 00:00:00 2001 From: Coleman Kane Date: Fri, 4 Dec 2009 08:44:57 -0700 Subject: r300g: use $(MAKE) variable Fixes bug 24501 --- src/gallium/drivers/r300/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/Makefile b/src/gallium/drivers/r300/Makefile index d7a2c8c462..8d0c6e33bb 100644 --- a/src/gallium/drivers/r300/Makefile +++ b/src/gallium/drivers/r300/Makefile @@ -38,4 +38,4 @@ include ../../Makefile.template .PHONY : $(COMPILER_ARCHIVE) $(COMPILER_ARCHIVE): - cd $(TOP)/src/mesa/drivers/dri/r300/compiler; make + $(MAKE) -C $(TOP)/src/mesa/drivers/dri/r300/compiler -- cgit v1.2.3 From d5b94b49f602386b75630e73db775a68c72fdf46 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 4 Dec 2009 16:13:57 +0100 Subject: st/xorg: New libkms destroy api --- src/gallium/state_trackers/xorg/xorg_crtc.c | 4 ++-- src/gallium/state_trackers/xorg/xorg_driver.c | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index ddcaedde37..be9fcbc713 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -257,7 +257,7 @@ crtc_load_cursor_argb_kms(xf86CrtcPtr crtc, CARD32 * image) return; err_bo_destroy: - kms_bo_destroy(crtcp->cursor_bo); + kms_bo_destroy(&crtcp->cursor_bo); } #endif @@ -305,7 +305,7 @@ xorg_crtc_cursor_destroy(xf86CrtcPtr crtc) pipe_texture_reference(&crtcp->cursor_tex, NULL); #ifdef HAVE_LIBKMS if (crtcp->cursor_bo) - kms_bo_destroy(crtcp->cursor_bo); + kms_bo_destroy(&crtcp->cursor_bo); #endif xfree(crtcp); diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index da86295c31..22db8bb3c8 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -260,8 +260,7 @@ drv_close_resource_management(ScrnInfoPtr pScrn) #ifdef HAVE_LIBKMS if (ms->kms) - kms_destroy(ms->kms); - ms->kms = NULL; + kms_destroy(&ms->kms); #endif return TRUE; @@ -898,8 +897,7 @@ drv_destroy_front_buffer_kms(ScrnInfoPtr pScrn) return TRUE; kms_bo_unmap(ms->root_bo); - kms_bo_destroy(ms->root_bo); - ms->root_bo = NULL; + kms_bo_destroy(&ms->root_bo); return TRUE; } @@ -945,7 +943,7 @@ drv_create_front_buffer_kms(ScrnInfoPtr pScrn) return TRUE; err_destroy: - kms_bo_destroy(bo); + kms_bo_destroy(&bo); return FALSE; } -- cgit v1.2.3 From c33520b360780bce496b00516384e25a0908e43c Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 4 Dec 2009 16:05:03 +0100 Subject: st/xorg: Fix leave enter vt cycle in crtc code --- src/gallium/state_trackers/xorg/xorg_crtc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_crtc.c b/src/gallium/state_trackers/xorg/xorg_crtc.c index be9fcbc713..337449a745 100644 --- a/src/gallium/state_trackers/xorg/xorg_crtc.c +++ b/src/gallium/state_trackers/xorg/xorg_crtc.c @@ -307,8 +307,6 @@ xorg_crtc_cursor_destroy(xf86CrtcPtr crtc) if (crtcp->cursor_bo) kms_bo_destroy(&crtcp->cursor_bo); #endif - - xfree(crtcp); } /* @@ -320,11 +318,12 @@ crtc_destroy(xf86CrtcPtr crtc) { struct crtc_private *crtcp = crtc->driver_private; - if (crtcp->cursor_tex) - pipe_texture_reference(&crtcp->cursor_tex, NULL); + xorg_crtc_cursor_destroy(crtc); drmModeFreeCrtc(crtcp->drm_crtc); + xfree(crtcp); + crtc->driver_private = NULL; } static const xf86CrtcFuncsRec crtc_funcs = { -- cgit v1.2.3 From f2e3fc18141d29ede2b711d7ddbb225145be35e3 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 4 Dec 2009 16:22:48 +0100 Subject: st/xorg: Add enter/leave vt hooks for winsys --- src/gallium/state_trackers/xorg/xorg_driver.c | 6 ++++++ src/gallium/state_trackers/xorg/xorg_tracker.h | 2 ++ 2 files changed, 8 insertions(+) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_driver.c b/src/gallium/state_trackers/xorg/xorg_driver.c index 22db8bb3c8..5391595891 100644 --- a/src/gallium/state_trackers/xorg/xorg_driver.c +++ b/src/gallium/state_trackers/xorg/xorg_driver.c @@ -687,6 +687,9 @@ drv_leave_vt(int scrnIndex, int flags) xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); int o; + if (ms->winsys_leave_vt) + ms->winsys_leave_vt(pScrn); + for (o = 0; o < config->num_crtc; o++) { xf86CrtcPtr crtc = config->crtc[o]; @@ -749,6 +752,9 @@ drv_enter_vt(int scrnIndex, int flags) if (!xf86SetDesiredModes(pScrn)) return FALSE; + if (ms->winsys_enter_vt) + ms->winsys_enter_vt(pScrn); + return TRUE; } diff --git a/src/gallium/state_trackers/xorg/xorg_tracker.h b/src/gallium/state_trackers/xorg/xorg_tracker.h index d5fc18448e..c0cfbe6061 100644 --- a/src/gallium/state_trackers/xorg/xorg_tracker.h +++ b/src/gallium/state_trackers/xorg/xorg_tracker.h @@ -117,6 +117,8 @@ typedef struct _modesettingRec /* winsys hocks */ Bool (*winsys_screen_init)(ScrnInfoPtr pScr); Bool (*winsys_screen_close)(ScrnInfoPtr pScr); + Bool (*winsys_enter_vt)(ScrnInfoPtr pScr); + Bool (*winsys_leave_vt)(ScrnInfoPtr pScr); void *winsys_priv; #ifdef DRM_MODE_FEATURE_DIRTYFB -- cgit v1.2.3 From 124f4bc97712acfe7d08807b013a101a4d6276e1 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 4 Dec 2009 16:25:59 +0100 Subject: vmware/xorg: Stop video ports on leave vt --- src/gallium/winsys/drm/vmware/xorg/vmw_driver.h | 2 ++ src/gallium/winsys/drm/vmware/xorg/vmw_screen.c | 22 +++++++++++++++++ src/gallium/winsys/drm/vmware/xorg/vmw_video.c | 32 +++++++++++++++++++++++++ 3 files changed, 56 insertions(+) (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h b/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h index db6b89b8bc..85c21ca60e 100644 --- a/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h @@ -66,6 +66,8 @@ Bool vmw_video_init(ScrnInfoPtr pScrn, struct vmw_driver *vmw); Bool vmw_video_close(ScrnInfoPtr pScrn, struct vmw_driver *vmw); +void vmw_video_stop_all(ScrnInfoPtr pScrn, struct vmw_driver *vmw); + /*********************************************************************** * vmw_ioctl.c diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_screen.c b/src/gallium/winsys/drm/vmware/xorg/vmw_screen.c index 18cb509189..7c9757cce9 100644 --- a/src/gallium/winsys/drm/vmware/xorg/vmw_screen.c +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_screen.c @@ -124,6 +124,26 @@ vmw_screen_close(ScrnInfoPtr pScrn) return TRUE; } +static Bool +vmw_screen_enter_vt(ScrnInfoPtr pScrn) +{ + debug_printf("%s: enter\n", __func__); + + return TRUE; +} + +static Bool +vmw_screen_leave_vt(ScrnInfoPtr pScrn) +{ + struct vmw_driver *vmw = vmw_driver(pScrn); + + debug_printf("%s: enter\n", __func__); + + vmw_video_stop_all(pScrn, vmw); + + return TRUE; +} + /* * Functions for setting up hooks into the xorg state tracker */ @@ -142,6 +162,8 @@ vmw_screen_pre_init(ScrnInfoPtr pScrn, int flags) ms = modesettingPTR(pScrn); ms->winsys_screen_init = vmw_screen_init; ms->winsys_screen_close = vmw_screen_close; + ms->winsys_enter_vt = vmw_screen_enter_vt; + ms->winsys_leave_vt = vmw_screen_leave_vt; return TRUE; } diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_video.c b/src/gallium/winsys/drm/vmware/xorg/vmw_video.c index d62c3b7296..ef1e2f1e73 100644 --- a/src/gallium/winsys/drm/vmware/xorg/vmw_video.c +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_video.c @@ -358,6 +358,38 @@ vmw_video_close(ScrnInfoPtr pScrn, struct vmw_driver *vmw) } +/* + *----------------------------------------------------------------------------- + * + * vmw_video_stop_all -- + * + * Stop all video streams from playing. + * + * Results: + * None. + * + * Side effects: + * All buffers are freed. + * + *----------------------------------------------------------------------------- + */ + +void vmw_video_stop_all(ScrnInfoPtr pScrn, struct vmw_driver *vmw) +{ + struct vmw_video_private *video = vmw->video_priv; + int i; + + debug_printf("%s: enter\n", __func__); + + if (!video) + return; + + for (i = 0; i < VMWARE_VID_NUM_PORTS; ++i) { + vmw_xv_stop_video(pScrn, &video->port[i], TRUE); + } +} + + /* *----------------------------------------------------------------------------- * -- cgit v1.2.3 From 6f1db18f148b9014af80abe0524827f1cb3ec013 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Fri, 4 Dec 2009 16:44:18 +0100 Subject: vmware/xorg: Also stop ports on close --- src/gallium/winsys/drm/vmware/xorg/vmw_video.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_video.c b/src/gallium/winsys/drm/vmware/xorg/vmw_video.c index ef1e2f1e73..b99bb2f7e3 100644 --- a/src/gallium/winsys/drm/vmware/xorg/vmw_video.c +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_video.c @@ -346,7 +346,8 @@ vmw_video_close(ScrnInfoPtr pScrn, struct vmw_driver *vmw) return TRUE; for (i = 0; i < VMWARE_VID_NUM_PORTS; ++i) { - vmw_video_port_cleanup(pScrn, &video->port[i]); + /* make sure the port is stoped as well */ + vmw_xv_stop_video(pScrn, &video->port[i], TRUE); } /* XXX: I'm sure this function is missing code for turning off Xv */ -- cgit v1.2.3 From c977dd9c7716b0a086eeb0c07f2da148065c3b18 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 4 Dec 2009 18:23:35 +0100 Subject: svga: fix another pipe_reference strict aliasing violation --- src/gallium/drivers/svga/svga_screen_buffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_screen_buffer.c b/src/gallium/drivers/svga/svga_screen_buffer.c index 1f8a889672..58a1aba464 100644 --- a/src/gallium/drivers/svga/svga_screen_buffer.c +++ b/src/gallium/drivers/svga/svga_screen_buffer.c @@ -356,7 +356,8 @@ svga_buffer_upload_flush(struct svga_context *svga, sbuf->hw.boxes = NULL; /* Decrement reference count */ - pipe_buffer_reference((struct pipe_buffer **)&sbuf, NULL); + pipe_reference(&(sbuf->base.reference), NULL); + sbuf = NULL; } -- cgit v1.2.3 From 3da8265cd3233e2b22ab0f8a28fbba892984e399 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 4 Dec 2009 16:06:16 +0100 Subject: r300g: fix warnings --- src/gallium/drivers/r300/r300_context.c | 4 ++-- src/gallium/drivers/r300/r300_winsys.h | 2 ++ src/gallium/winsys/drm/radeon/core/radeon_buffer.c | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c index 68a17dcb63..5b337f03ac 100644 --- a/src/gallium/drivers/r300/r300_context.c +++ b/src/gallium/drivers/r300/r300_context.c @@ -36,8 +36,8 @@ #include "r300_screen.h" #include "r300_state_derived.h" #include "r300_state_invariant.h" - -#include "radeon_winsys.h" +#include "r300_texture.h" +#include "r300_winsys.h" static enum pipe_error r300_clear_hash_table(void* key, void* value, void* data) diff --git a/src/gallium/drivers/r300/r300_winsys.h b/src/gallium/drivers/r300/r300_winsys.h index f86985841f..1ae6de70fe 100644 --- a/src/gallium/drivers/r300/r300_winsys.h +++ b/src/gallium/drivers/r300/r300_winsys.h @@ -35,6 +35,8 @@ extern "C" { #include "pipe/p_state.h" #include "pipe/internal/p_winsys_screen.h" +#include "radeon_winsys.h" + struct pipe_context* r300_create_context(struct pipe_screen* screen, struct radeon_winsys* radeon_winsys); diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c index 65f7babff2..0ca7b39255 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c @@ -35,7 +35,9 @@ #include "radeon_bo_gem.h" #include "softpipe/sp_texture.h" #include "r300_context.h" +#include "util/u_math.h" #include + struct radeon_vl_context { Display *display; -- cgit v1.2.3 From 7679447b5835fd73ab44b3d77b12a034c95af5c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 2 Dec 2009 17:15:27 +0100 Subject: r300g, radeong: fix the CS overflow --- src/gallium/drivers/r300/r300_cs.h | 2 +- src/gallium/drivers/r300/r300_emit.c | 9 ++++++++- src/gallium/winsys/drm/radeon/core/radeon_r300.c | 5 +++-- 3 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_cs.h b/src/gallium/drivers/r300/r300_cs.h index 8b100375fd..9fcf3ab538 100644 --- a/src/gallium/drivers/r300/r300_cs.h +++ b/src/gallium/drivers/r300/r300_cs.h @@ -55,7 +55,7 @@ int cs_count = 0; #define CHECK_CS(size) \ - cs_winsys->check_cs(cs_winsys, (size)) + assert(cs_winsys->check_cs(cs_winsys, (size))) #define BEGIN_CS(size) do { \ CHECK_CS(size); \ diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index a479842f9e..3bb42f9e43 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -871,10 +871,17 @@ void r300_emit_dirty_state(struct r300_context* r300) return; } + /* Check size of CS. */ + /* Make sure we have at least 8*1024 spare dwords. */ + /* XXX It would be nice to know the number of dwords we really need to + * XXX emit. */ + if (!r300->winsys->check_cs(r300->winsys, 8*1024)) { + r300->context.flush(&r300->context, 0, NULL); + } + /* Clean out BOs. */ r300->winsys->reset_bos(r300->winsys); - /* XXX check size */ validate: /* Color buffers... */ for (i = 0; i < r300->framebuffer_state.nr_cbufs; i++) { diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index 7362279b77..ba0596c30d 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -52,8 +52,9 @@ static boolean radeon_validate(struct radeon_winsys* winsys) static boolean radeon_check_cs(struct radeon_winsys* winsys, int size) { - /* XXX check size here, lazy ass! */ - return radeon_validate(winsys); + struct radeon_cs* cs = winsys->priv->cs; + + return radeon_validate(winsys) && cs->cdw + size <= cs->ndw; } static void radeon_begin_cs(struct radeon_winsys* winsys, -- cgit v1.2.3 From 042b524d48ebb15215430149b9b1653f4b46dee3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Fri, 4 Dec 2009 15:54:29 +0100 Subject: radeong: flush CS if a buffer being mapped is referenced by it Also, overlapping occlusion queries seems to work now. --- src/gallium/drivers/r300/r300_emit.c | 2 -- src/gallium/winsys/drm/radeon/core/radeon_buffer.c | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 3bb42f9e43..60be03f54f 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -382,8 +382,6 @@ static void r300_emit_query_start(struct r300_context *r300) if (!query) return; - /* XXX This will almost certainly not return good results - * for overlapping queries. */ BEGIN_CS(4); if (caps->family == CHIP_FAMILY_RV530) { OUT_CS_REG(RV530_FG_ZBREG_DEST, RV530_FG_ZBREG_DEST_PIPE_SELECT_ALL); diff --git a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c index 0ca7b39255..2a8daed051 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_buffer.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_buffer.c @@ -140,10 +140,15 @@ static void *radeon_buffer_map(struct pipe_winsys *ws, struct pipe_buffer *buffer, unsigned flags) { + struct radeon_winsys_priv *priv = ((struct radeon_winsys *)ws)->priv; struct radeon_pipe_buffer *radeon_buffer = (struct radeon_pipe_buffer*)buffer; int write = 0; + if (radeon_bo_is_referenced_by_cs(radeon_buffer->bo, priv->cs)) { + priv->cs->space_flush_fn(priv->cs->space_flush_data); + } + if (flags & PIPE_BUFFER_USAGE_DONTBLOCK) { uint32_t domain; -- cgit v1.2.3 From 7d9b2edb97419b562a542b5cd701724c009421d4 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Fri, 4 Dec 2009 18:34:52 +0100 Subject: identity: fix copy&paste error --- src/gallium/drivers/identity/id_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/identity/id_context.c b/src/gallium/drivers/identity/id_context.c index 4509c7b1e5..bedab56f59 100644 --- a/src/gallium/drivers/identity/id_context.c +++ b/src/gallium/drivers/identity/id_context.c @@ -742,7 +742,7 @@ identity_context_create(struct pipe_screen *_screen, struct pipe_context *pipe) id_pipe->base.set_polygon_stipple = identity_set_polygon_stipple; id_pipe->base.set_scissor_state = identity_set_scissor_state; id_pipe->base.set_viewport_state = identity_set_viewport_state; - id_pipe->base.set_fragment_sampler_textures = identity_set_vertex_sampler_textures; + id_pipe->base.set_fragment_sampler_textures = identity_set_fragment_sampler_textures; id_pipe->base.set_vertex_sampler_textures = identity_set_vertex_sampler_textures; id_pipe->base.set_vertex_buffers = identity_set_vertex_buffers; id_pipe->base.set_vertex_elements = identity_set_vertex_elements; -- cgit v1.2.3 From 818fd6b10182931a0727819f275f7f1686df09f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 4 Dec 2009 12:02:22 +0000 Subject: gallium: Disable force_align_arg_pointer attribute on x86_64. Apparently not only unnecessary but also causes gcc to complain. --- src/gallium/include/pipe/p_compiler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h index c36286f9be..f7368bb95b 100644 --- a/src/gallium/include/pipe/p_compiler.h +++ b/src/gallium/include/pipe/p_compiler.h @@ -167,7 +167,7 @@ typedef unsigned char boolean; #define ALIGN16_ASSIGN(NAME) NAME##___aligned #define ALIGN16_ATTRIB __attribute__(( aligned( 16 ) )) #define ALIGN8_ATTRIB __attribute__(( aligned( 8 ) )) -#if __GNUC__ > 4 || (__GNUC__ == 4 &&__GNUC_MINOR__>1) +#if (__GNUC__ > 4 || (__GNUC__ == 4 &&__GNUC_MINOR__>1)) && !defined(PIPE_ARCH_X86_64) #define ALIGN_STACK __attribute__((force_align_arg_pointer)) #else #define ALIGN_STACK -- cgit v1.2.3 From b00b06b6e486a87dd88a695ae122863df13ad84e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 4 Dec 2009 18:59:24 +0000 Subject: llvmpipe: Remove debug printf. --- src/gallium/drivers/llvmpipe/lp_tex_cache.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_tex_cache.c b/src/gallium/drivers/llvmpipe/lp_tex_cache.c index 5dbc597d2c..a6d9a2c1ac 100644 --- a/src/gallium/drivers/llvmpipe/lp_tex_cache.c +++ b/src/gallium/drivers/llvmpipe/lp_tex_cache.c @@ -155,7 +155,6 @@ lp_tex_tile_cache_validate_texture(struct llvmpipe_tex_tile_cache *tc) if (lpt->timestamp != tc->timestamp) { /* texture was modified, invalidate all cached tiles */ uint i; - debug_printf("INV %d %d\n", tc->timestamp, lpt->timestamp); for (i = 0; i < NUM_ENTRIES; i++) { tc->entries[i].addr.bits.invalid = 1; } -- cgit v1.2.3 From a312e76468435fc1eb7ec5fe0a98601a7fdfec53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 4 Dec 2009 21:16:14 +0000 Subject: llvmpipe: Ensure transfers are mapped. This shouldn't happen but it does by some misterious reason. Fail the assertion but at least do not segfault on release builds. --- src/gallium/drivers/llvmpipe/lp_tile_cache.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_tile_cache.c b/src/gallium/drivers/llvmpipe/lp_tile_cache.c index 50891c4227..e83210f93b 100644 --- a/src/gallium/drivers/llvmpipe/lp_tile_cache.c +++ b/src/gallium/drivers/llvmpipe/lp_tile_cache.c @@ -290,6 +290,10 @@ lp_get_cached_tile(struct llvmpipe_tile_cache *tc, assert(tc->surface); assert(tc->transfer); + assert(tc->transfer_map); + + if(!tc->transfer_map) + lp_tile_cache_map_transfers(tc); switch(tile->status) { case LP_TILE_STATUS_CLEAR: -- cgit v1.2.3 From c0a13bbae15a471fea278e37b92b874fed1f6b3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 4 Dec 2009 21:25:40 +0000 Subject: llvmpipe: Port vertex sampler support from softpipe. Just enough boilerplate code to avoid segfaulting. --- src/gallium/drivers/llvmpipe/lp_context.c | 20 +++++++-- src/gallium/drivers/llvmpipe/lp_context.h | 5 +++ src/gallium/drivers/llvmpipe/lp_screen.c | 4 +- src/gallium/drivers/llvmpipe/lp_state.h | 9 ++++ src/gallium/drivers/llvmpipe/lp_state_derived.c | 12 +++-- src/gallium/drivers/llvmpipe/lp_state_sampler.c | 59 +++++++++++++++++++++++++ 6 files changed, 101 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_context.c b/src/gallium/drivers/llvmpipe/lp_context.c index c081f6de03..679e244274 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.c +++ b/src/gallium/drivers/llvmpipe/lp_context.c @@ -118,6 +118,11 @@ static void llvmpipe_destroy( struct pipe_context *pipe ) pipe_texture_reference(&llvmpipe->texture[i], NULL); } + for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { + lp_destroy_tex_tile_cache(llvmpipe->vertex_tex_cache[i]); + pipe_texture_reference(&llvmpipe->vertex_textures[i], NULL); + } + for (i = 0; i < Elements(llvmpipe->constants); i++) { if (llvmpipe->constants[i].buffer) { pipe_buffer_reference(&llvmpipe->constants[i].buffer, NULL); @@ -145,6 +150,11 @@ llvmpipe_is_texture_referenced( struct pipe_context *pipe, llvmpipe->framebuffer.zsbuf->texture == texture) return PIPE_REFERENCED_FOR_WRITE; } + for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { + if (llvmpipe->vertex_tex_cache[i] && + llvmpipe->vertex_tex_cache[i]->texture == texture) + return PIPE_REFERENCED_FOR_READ; + } return PIPE_UNREFERENCED; } @@ -181,6 +191,7 @@ llvmpipe_create( struct pipe_screen *screen ) llvmpipe->pipe.create_sampler_state = llvmpipe_create_sampler_state; llvmpipe->pipe.bind_fragment_sampler_states = llvmpipe_bind_sampler_states; + llvmpipe->pipe.bind_vertex_sampler_states = llvmpipe_bind_vertex_sampler_states; llvmpipe->pipe.delete_sampler_state = llvmpipe_delete_sampler_state; llvmpipe->pipe.create_depth_stencil_alpha_state = llvmpipe_create_depth_stencil_state; @@ -206,6 +217,7 @@ llvmpipe_create( struct pipe_screen *screen ) llvmpipe->pipe.set_polygon_stipple = llvmpipe_set_polygon_stipple; llvmpipe->pipe.set_scissor_state = llvmpipe_set_scissor_state; llvmpipe->pipe.set_fragment_sampler_textures = llvmpipe_set_sampler_textures; + llvmpipe->pipe.set_vertex_sampler_textures = llvmpipe_set_vertex_sampler_textures; llvmpipe->pipe.set_viewport_state = llvmpipe_set_viewport_state; llvmpipe->pipe.set_vertex_buffers = llvmpipe_set_vertex_buffers; @@ -234,13 +246,15 @@ llvmpipe_create( struct pipe_screen *screen ) for (i = 0; i < PIPE_MAX_SAMPLERS; i++) llvmpipe->tex_cache[i] = lp_create_tex_tile_cache( screen ); + for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) + llvmpipe->vertex_tex_cache[i] = lp_create_tex_tile_cache(screen); /* vertex shader samplers */ - for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { + for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { llvmpipe->tgsi.vert_samplers[i].base.get_samples = lp_get_samples; llvmpipe->tgsi.vert_samplers[i].processor = TGSI_PROCESSOR_VERTEX; - llvmpipe->tgsi.vert_samplers[i].cache = llvmpipe->tex_cache[i]; + llvmpipe->tgsi.vert_samplers[i].cache = llvmpipe->vertex_tex_cache[i]; llvmpipe->tgsi.vert_samplers_list[i] = &llvmpipe->tgsi.vert_samplers[i]; } @@ -260,7 +274,7 @@ llvmpipe_create( struct pipe_screen *screen ) goto fail; draw_texture_samplers(llvmpipe->draw, - PIPE_MAX_SAMPLERS, + PIPE_MAX_VERTEX_SAMPLERS, (struct tgsi_sampler **) llvmpipe->tgsi.vert_samplers_list); diff --git a/src/gallium/drivers/llvmpipe/lp_context.h b/src/gallium/drivers/llvmpipe/lp_context.h index 3ad95d0bfc..cc4d5ad5fd 100644 --- a/src/gallium/drivers/llvmpipe/lp_context.h +++ b/src/gallium/drivers/llvmpipe/lp_context.h @@ -55,6 +55,7 @@ struct llvmpipe_context { /** Constant state objects */ const struct pipe_blend_state *blend; const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS]; + struct pipe_sampler_state *vertex_samplers[PIPE_MAX_VERTEX_SAMPLERS]; const struct pipe_depth_stencil_alpha_state *depth_stencil; const struct pipe_rasterizer_state *rasterizer; struct lp_fragment_shader *fs; @@ -68,12 +69,15 @@ struct llvmpipe_context { struct pipe_poly_stipple poly_stipple; struct pipe_scissor_state scissor; struct pipe_texture *texture[PIPE_MAX_SAMPLERS]; + struct pipe_texture *vertex_textures[PIPE_MAX_VERTEX_SAMPLERS]; struct pipe_viewport_state viewport; struct pipe_vertex_buffer vertex_buffer[PIPE_MAX_ATTRIBS]; struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS]; unsigned num_samplers; unsigned num_textures; + unsigned num_vertex_samplers; + unsigned num_vertex_textures; unsigned num_vertex_elements; unsigned num_vertex_buffers; @@ -136,6 +140,7 @@ struct llvmpipe_context { unsigned tex_timestamp; struct llvmpipe_tex_tile_cache *tex_cache[PIPE_MAX_SAMPLERS]; + struct llvmpipe_tex_tile_cache *vertex_tex_cache[PIPE_MAX_VERTEX_SAMPLERS]; unsigned no_rast : 1; diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c index a6ecaa0b2b..19fe2850fd 100644 --- a/src/gallium/drivers/llvmpipe/lp_screen.c +++ b/src/gallium/drivers/llvmpipe/lp_screen.c @@ -59,7 +59,9 @@ llvmpipe_get_param(struct pipe_screen *screen, int param) case PIPE_CAP_MAX_TEXTURE_IMAGE_UNITS: return PIPE_MAX_SAMPLERS; case PIPE_CAP_MAX_VERTEX_TEXTURE_UNITS: - return 0; + return PIPE_MAX_VERTEX_SAMPLERS; + case PIPE_CAP_MAX_COMBINED_SAMPLERS: + return PIPE_MAX_SAMPLERS + PIPE_MAX_VERTEX_SAMPLERS; case PIPE_CAP_NPOT_TEXTURES: return 1; case PIPE_CAP_TWO_SIDED_STENCIL: diff --git a/src/gallium/drivers/llvmpipe/lp_state.h b/src/gallium/drivers/llvmpipe/lp_state.h index 7b26ce61a3..d1c74ab07b 100644 --- a/src/gallium/drivers/llvmpipe/lp_state.h +++ b/src/gallium/drivers/llvmpipe/lp_state.h @@ -126,6 +126,10 @@ void * llvmpipe_create_sampler_state(struct pipe_context *, const struct pipe_sampler_state *); void llvmpipe_bind_sampler_states(struct pipe_context *, unsigned, void **); +void +llvmpipe_bind_vertex_sampler_states(struct pipe_context *, + unsigned num_samplers, + void **samplers); void llvmpipe_delete_sampler_state(struct pipe_context *, void *); void * @@ -172,6 +176,11 @@ void llvmpipe_set_sampler_textures( struct pipe_context *, unsigned num, struct pipe_texture ** ); +void +llvmpipe_set_vertex_sampler_textures(struct pipe_context *, + unsigned num_textures, + struct pipe_texture **); + void llvmpipe_set_viewport_state( struct pipe_context *, const struct pipe_viewport_state * ); diff --git a/src/gallium/drivers/llvmpipe/lp_state_derived.c b/src/gallium/drivers/llvmpipe/lp_state_derived.c index c753b183c0..e703964aaa 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_derived.c +++ b/src/gallium/drivers/llvmpipe/lp_state_derived.c @@ -198,10 +198,14 @@ update_tgsi_samplers( struct llvmpipe_context *llvmpipe ) unsigned i; /* vertex shader samplers */ - for (i = 0; i < PIPE_MAX_SAMPLERS; i++) { - llvmpipe->tgsi.vert_samplers[i].sampler = llvmpipe->sampler[i]; - llvmpipe->tgsi.vert_samplers[i].texture = llvmpipe->texture[i]; - llvmpipe->tgsi.frag_samplers[i].base.get_samples = lp_get_samples; + for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { + llvmpipe->tgsi.vert_samplers[i].sampler = llvmpipe->vertex_samplers[i]; + llvmpipe->tgsi.vert_samplers[i].texture = llvmpipe->vertex_textures[i]; + llvmpipe->tgsi.vert_samplers[i].base.get_samples = lp_get_samples; + } + + for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { + lp_tex_tile_cache_validate_texture( llvmpipe->vertex_tex_cache[i] ); } /* fragment shader samplers */ diff --git a/src/gallium/drivers/llvmpipe/lp_state_sampler.c b/src/gallium/drivers/llvmpipe/lp_state_sampler.c index 8333805a3f..d382f9ca87 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_sampler.c +++ b/src/gallium/drivers/llvmpipe/lp_state_sampler.c @@ -77,6 +77,34 @@ llvmpipe_bind_sampler_states(struct pipe_context *pipe, } +void +llvmpipe_bind_vertex_sampler_states(struct pipe_context *pipe, + unsigned num_samplers, + void **samplers) +{ + struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); + unsigned i; + + assert(num_samplers <= PIPE_MAX_VERTEX_SAMPLERS); + + /* Check for no-op */ + if (num_samplers == llvmpipe->num_vertex_samplers && + !memcmp(llvmpipe->vertex_samplers, samplers, num_samplers * sizeof(void *))) + return; + + draw_flush(llvmpipe->draw); + + for (i = 0; i < num_samplers; ++i) + llvmpipe->vertex_samplers[i] = samplers[i]; + for (i = num_samplers; i < PIPE_MAX_VERTEX_SAMPLERS; ++i) + llvmpipe->vertex_samplers[i] = NULL; + + llvmpipe->num_vertex_samplers = num_samplers; + + llvmpipe->dirty |= LP_NEW_SAMPLER; +} + + void llvmpipe_set_sampler_textures(struct pipe_context *pipe, unsigned num, struct pipe_texture **texture) @@ -116,6 +144,37 @@ llvmpipe_set_sampler_textures(struct pipe_context *pipe, } +void +llvmpipe_set_vertex_sampler_textures(struct pipe_context *pipe, + unsigned num_textures, + struct pipe_texture **textures) +{ + struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); + uint i; + + assert(num_textures <= PIPE_MAX_VERTEX_SAMPLERS); + + /* Check for no-op */ + if (num_textures == llvmpipe->num_vertex_textures && + !memcmp(llvmpipe->vertex_textures, textures, num_textures * sizeof(struct pipe_texture *))) { + return; + } + + draw_flush(llvmpipe->draw); + + for (i = 0; i < PIPE_MAX_VERTEX_SAMPLERS; i++) { + struct pipe_texture *tex = i < num_textures ? textures[i] : NULL; + + pipe_texture_reference(&llvmpipe->vertex_textures[i], tex); + lp_tex_tile_cache_set_texture(llvmpipe->vertex_tex_cache[i], tex); + } + + llvmpipe->num_vertex_textures = num_textures; + + llvmpipe->dirty |= LP_NEW_TEXTURE; +} + + void llvmpipe_delete_sampler_state(struct pipe_context *pipe, void *sampler) -- cgit v1.2.3 From fe8e18bcd41a19282ba92350a04a34866fda1d7b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 28 Nov 2009 22:04:06 -0500 Subject: mesa: Fix array out-of-bounds access in _mesa_TexEnvf. _mesa_TexEnvf calls _mesa_TexEnvfv, which uses the param argument as an array. (cherry picked from commit a11d60d14caf8efc07f70af63b57b33273f8cf9b) --- src/mesa/main/texenv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texenv.c b/src/mesa/main/texenv.c index 6d86a4275c..4442fb8cf8 100644 --- a/src/mesa/main/texenv.c +++ b/src/mesa/main/texenv.c @@ -598,7 +598,10 @@ _mesa_TexEnvfv( GLenum target, GLenum pname, const GLfloat *param ) void GLAPIENTRY _mesa_TexEnvf( GLenum target, GLenum pname, GLfloat param ) { - _mesa_TexEnvfv( target, pname, ¶m ); + GLfloat p[4]; + p[0] = param; + p[1] = p[2] = p[3] = 0.0; + _mesa_TexEnvfv( target, pname, p ); } -- cgit v1.2.3 From dd51b4f9091abf762e470f0cd4c802215a108290 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sat, 5 Dec 2009 05:43:10 +0000 Subject: llvmpipe: Stop disassembling when an unsupported opcode is found. Otherwise the terminal gets full of garbage. --- src/gallium/drivers/llvmpipe/lp_bld_debug.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_debug.c b/src/gallium/drivers/llvmpipe/lp_bld_debug.c index 59d8f492e6..354b3af49e 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_debug.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_debug.c @@ -115,7 +115,8 @@ lp_disassemble(const void* func) } } - if (ud_insn_off(&ud_obj) >= max_jmp_pc && ud_obj.mnemonic == UD_Iret) + if ((ud_insn_off(&ud_obj) >= max_jmp_pc && ud_obj.mnemonic == UD_Iret) || + ud_obj.mnemonic == UD_Iinvalid) break; } debug_printf("\n"); -- cgit v1.2.3 From 501989bbcd159f8b44148a22151bb46c4800d298 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sat, 5 Dec 2009 05:43:53 +0000 Subject: llvmpipe: Tweak disassembly to match gdb. Helps verifying udis86 output. --- src/gallium/drivers/llvmpipe/lp_bld_debug.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_debug.c b/src/gallium/drivers/llvmpipe/lp_bld_debug.c index 354b3af49e..39dfc51e50 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_debug.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_debug.c @@ -77,10 +77,10 @@ lp_disassemble(const void* func) while (ud_disassemble(&ud_obj)) { #ifdef PIPE_ARCH_X86 - debug_printf("%08lx: ", (unsigned long)ud_insn_off(&ud_obj)); + debug_printf("0x%08lx:\t", (unsigned long)ud_insn_off(&ud_obj)); #endif #ifdef PIPE_ARCH_X86_64 - debug_printf("%016llx: ", (unsigned long long)ud_insn_off(&ud_obj)); + debug_printf("0x%016llx:\t", (unsigned long long)ud_insn_off(&ud_obj)); #endif #if 0 @@ -119,6 +119,12 @@ lp_disassemble(const void* func) ud_obj.mnemonic == UD_Iinvalid) break; } + +#if 0 + /* Print GDB command, useful to verify udis86 output */ + debug_printf("disassemble %p %p\n", func, (void*)(uintptr_t)ud_obj.pc); +#endif + debug_printf("\n"); #else (void)func; -- cgit v1.2.3 From 781d8fccba1bdaadbae042d23bf1d17e25c800fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sat, 5 Dec 2009 06:05:56 +0000 Subject: svga: Use _debug_printf, so that output may be dumped in release builds too. The dump calls should be wrapped in #ifdef DEBUG .. #endif. --- src/gallium/drivers/svga/svgadump/svga_dump.c | 1122 ++++++++++---------- src/gallium/drivers/svga/svgadump/svga_dump.py | 22 +- .../drivers/svga/svgadump/svga_shader_dump.c | 230 ++-- 3 files changed, 687 insertions(+), 687 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svgadump/svga_dump.c b/src/gallium/drivers/svga/svgadump/svga_dump.c index 910afa2528..18e0eb5139 100644 --- a/src/gallium/drivers/svga/svgadump/svga_dump.c +++ b/src/gallium/drivers/svga/svgadump/svga_dump.c @@ -42,554 +42,554 @@ dump_SVGA3dVertexDecl(const SVGA3dVertexDecl *cmd) { switch((*cmd).identity.type) { case SVGA3D_DECLTYPE_FLOAT1: - debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT1\n"); + _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT1\n"); break; case SVGA3D_DECLTYPE_FLOAT2: - debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT2\n"); + _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT2\n"); break; case SVGA3D_DECLTYPE_FLOAT3: - debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT3\n"); + _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT3\n"); break; case SVGA3D_DECLTYPE_FLOAT4: - debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT4\n"); + _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT4\n"); break; case SVGA3D_DECLTYPE_D3DCOLOR: - debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_D3DCOLOR\n"); + _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_D3DCOLOR\n"); break; case SVGA3D_DECLTYPE_UBYTE4: - debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UBYTE4\n"); + _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UBYTE4\n"); break; case SVGA3D_DECLTYPE_SHORT2: - debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT2\n"); + _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT2\n"); break; case SVGA3D_DECLTYPE_SHORT4: - debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT4\n"); + _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT4\n"); break; case SVGA3D_DECLTYPE_UBYTE4N: - debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UBYTE4N\n"); + _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UBYTE4N\n"); break; case SVGA3D_DECLTYPE_SHORT2N: - debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT2N\n"); + _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT2N\n"); break; case SVGA3D_DECLTYPE_SHORT4N: - debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT4N\n"); + _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_SHORT4N\n"); break; case SVGA3D_DECLTYPE_USHORT2N: - debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_USHORT2N\n"); + _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_USHORT2N\n"); break; case SVGA3D_DECLTYPE_USHORT4N: - debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_USHORT4N\n"); + _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_USHORT4N\n"); break; case SVGA3D_DECLTYPE_UDEC3: - debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UDEC3\n"); + _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_UDEC3\n"); break; case SVGA3D_DECLTYPE_DEC3N: - debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_DEC3N\n"); + _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_DEC3N\n"); break; case SVGA3D_DECLTYPE_FLOAT16_2: - debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT16_2\n"); + _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT16_2\n"); break; case SVGA3D_DECLTYPE_FLOAT16_4: - debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT16_4\n"); + _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_FLOAT16_4\n"); break; case SVGA3D_DECLTYPE_MAX: - debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_MAX\n"); + _debug_printf("\t\t.identity.type = SVGA3D_DECLTYPE_MAX\n"); break; default: - debug_printf("\t\t.identity.type = %i\n", (*cmd).identity.type); + _debug_printf("\t\t.identity.type = %i\n", (*cmd).identity.type); break; } switch((*cmd).identity.method) { case SVGA3D_DECLMETHOD_DEFAULT: - debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_DEFAULT\n"); + _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_DEFAULT\n"); break; case SVGA3D_DECLMETHOD_PARTIALU: - debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_PARTIALU\n"); + _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_PARTIALU\n"); break; case SVGA3D_DECLMETHOD_PARTIALV: - debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_PARTIALV\n"); + _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_PARTIALV\n"); break; case SVGA3D_DECLMETHOD_CROSSUV: - debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_CROSSUV\n"); + _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_CROSSUV\n"); break; case SVGA3D_DECLMETHOD_UV: - debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_UV\n"); + _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_UV\n"); break; case SVGA3D_DECLMETHOD_LOOKUP: - debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_LOOKUP\n"); + _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_LOOKUP\n"); break; case SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED: - debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED\n"); + _debug_printf("\t\t.identity.method = SVGA3D_DECLMETHOD_LOOKUPPRESAMPLED\n"); break; default: - debug_printf("\t\t.identity.method = %i\n", (*cmd).identity.method); + _debug_printf("\t\t.identity.method = %i\n", (*cmd).identity.method); break; } switch((*cmd).identity.usage) { case SVGA3D_DECLUSAGE_POSITION: - debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_POSITION\n"); + _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_POSITION\n"); break; case SVGA3D_DECLUSAGE_BLENDWEIGHT: - debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BLENDWEIGHT\n"); + _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BLENDWEIGHT\n"); break; case SVGA3D_DECLUSAGE_BLENDINDICES: - debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BLENDINDICES\n"); + _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BLENDINDICES\n"); break; case SVGA3D_DECLUSAGE_NORMAL: - debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_NORMAL\n"); + _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_NORMAL\n"); break; case SVGA3D_DECLUSAGE_PSIZE: - debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_PSIZE\n"); + _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_PSIZE\n"); break; case SVGA3D_DECLUSAGE_TEXCOORD: - debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TEXCOORD\n"); + _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TEXCOORD\n"); break; case SVGA3D_DECLUSAGE_TANGENT: - debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TANGENT\n"); + _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TANGENT\n"); break; case SVGA3D_DECLUSAGE_BINORMAL: - debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BINORMAL\n"); + _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_BINORMAL\n"); break; case SVGA3D_DECLUSAGE_TESSFACTOR: - debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TESSFACTOR\n"); + _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_TESSFACTOR\n"); break; case SVGA3D_DECLUSAGE_POSITIONT: - debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_POSITIONT\n"); + _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_POSITIONT\n"); break; case SVGA3D_DECLUSAGE_COLOR: - debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_COLOR\n"); + _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_COLOR\n"); break; case SVGA3D_DECLUSAGE_FOG: - debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_FOG\n"); + _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_FOG\n"); break; case SVGA3D_DECLUSAGE_DEPTH: - debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_DEPTH\n"); + _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_DEPTH\n"); break; case SVGA3D_DECLUSAGE_SAMPLE: - debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_SAMPLE\n"); + _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_SAMPLE\n"); break; case SVGA3D_DECLUSAGE_MAX: - debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_MAX\n"); + _debug_printf("\t\t.identity.usage = SVGA3D_DECLUSAGE_MAX\n"); break; default: - debug_printf("\t\t.identity.usage = %i\n", (*cmd).identity.usage); + _debug_printf("\t\t.identity.usage = %i\n", (*cmd).identity.usage); break; } - debug_printf("\t\t.identity.usageIndex = %u\n", (*cmd).identity.usageIndex); - debug_printf("\t\t.array.surfaceId = %u\n", (*cmd).array.surfaceId); - debug_printf("\t\t.array.offset = %u\n", (*cmd).array.offset); - debug_printf("\t\t.array.stride = %u\n", (*cmd).array.stride); - debug_printf("\t\t.rangeHint.first = %u\n", (*cmd).rangeHint.first); - debug_printf("\t\t.rangeHint.last = %u\n", (*cmd).rangeHint.last); + _debug_printf("\t\t.identity.usageIndex = %u\n", (*cmd).identity.usageIndex); + _debug_printf("\t\t.array.surfaceId = %u\n", (*cmd).array.surfaceId); + _debug_printf("\t\t.array.offset = %u\n", (*cmd).array.offset); + _debug_printf("\t\t.array.stride = %u\n", (*cmd).array.stride); + _debug_printf("\t\t.rangeHint.first = %u\n", (*cmd).rangeHint.first); + _debug_printf("\t\t.rangeHint.last = %u\n", (*cmd).rangeHint.last); } static void dump_SVGA3dTextureState(const SVGA3dTextureState *cmd) { - debug_printf("\t\t.stage = %u\n", (*cmd).stage); + _debug_printf("\t\t.stage = %u\n", (*cmd).stage); switch((*cmd).name) { case SVGA3D_TS_INVALID: - debug_printf("\t\t.name = SVGA3D_TS_INVALID\n"); + _debug_printf("\t\t.name = SVGA3D_TS_INVALID\n"); break; case SVGA3D_TS_BIND_TEXTURE: - debug_printf("\t\t.name = SVGA3D_TS_BIND_TEXTURE\n"); + _debug_printf("\t\t.name = SVGA3D_TS_BIND_TEXTURE\n"); break; case SVGA3D_TS_COLOROP: - debug_printf("\t\t.name = SVGA3D_TS_COLOROP\n"); + _debug_printf("\t\t.name = SVGA3D_TS_COLOROP\n"); break; case SVGA3D_TS_COLORARG1: - debug_printf("\t\t.name = SVGA3D_TS_COLORARG1\n"); + _debug_printf("\t\t.name = SVGA3D_TS_COLORARG1\n"); break; case SVGA3D_TS_COLORARG2: - debug_printf("\t\t.name = SVGA3D_TS_COLORARG2\n"); + _debug_printf("\t\t.name = SVGA3D_TS_COLORARG2\n"); break; case SVGA3D_TS_ALPHAOP: - debug_printf("\t\t.name = SVGA3D_TS_ALPHAOP\n"); + _debug_printf("\t\t.name = SVGA3D_TS_ALPHAOP\n"); break; case SVGA3D_TS_ALPHAARG1: - debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG1\n"); + _debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG1\n"); break; case SVGA3D_TS_ALPHAARG2: - debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG2\n"); + _debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG2\n"); break; case SVGA3D_TS_ADDRESSU: - debug_printf("\t\t.name = SVGA3D_TS_ADDRESSU\n"); + _debug_printf("\t\t.name = SVGA3D_TS_ADDRESSU\n"); break; case SVGA3D_TS_ADDRESSV: - debug_printf("\t\t.name = SVGA3D_TS_ADDRESSV\n"); + _debug_printf("\t\t.name = SVGA3D_TS_ADDRESSV\n"); break; case SVGA3D_TS_MIPFILTER: - debug_printf("\t\t.name = SVGA3D_TS_MIPFILTER\n"); + _debug_printf("\t\t.name = SVGA3D_TS_MIPFILTER\n"); break; case SVGA3D_TS_MAGFILTER: - debug_printf("\t\t.name = SVGA3D_TS_MAGFILTER\n"); + _debug_printf("\t\t.name = SVGA3D_TS_MAGFILTER\n"); break; case SVGA3D_TS_MINFILTER: - debug_printf("\t\t.name = SVGA3D_TS_MINFILTER\n"); + _debug_printf("\t\t.name = SVGA3D_TS_MINFILTER\n"); break; case SVGA3D_TS_BORDERCOLOR: - debug_printf("\t\t.name = SVGA3D_TS_BORDERCOLOR\n"); + _debug_printf("\t\t.name = SVGA3D_TS_BORDERCOLOR\n"); break; case SVGA3D_TS_TEXCOORDINDEX: - debug_printf("\t\t.name = SVGA3D_TS_TEXCOORDINDEX\n"); + _debug_printf("\t\t.name = SVGA3D_TS_TEXCOORDINDEX\n"); break; case SVGA3D_TS_TEXTURETRANSFORMFLAGS: - debug_printf("\t\t.name = SVGA3D_TS_TEXTURETRANSFORMFLAGS\n"); + _debug_printf("\t\t.name = SVGA3D_TS_TEXTURETRANSFORMFLAGS\n"); break; case SVGA3D_TS_TEXCOORDGEN: - debug_printf("\t\t.name = SVGA3D_TS_TEXCOORDGEN\n"); + _debug_printf("\t\t.name = SVGA3D_TS_TEXCOORDGEN\n"); break; case SVGA3D_TS_BUMPENVMAT00: - debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT00\n"); + _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT00\n"); break; case SVGA3D_TS_BUMPENVMAT01: - debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT01\n"); + _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT01\n"); break; case SVGA3D_TS_BUMPENVMAT10: - debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT10\n"); + _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT10\n"); break; case SVGA3D_TS_BUMPENVMAT11: - debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT11\n"); + _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVMAT11\n"); break; case SVGA3D_TS_TEXTURE_MIPMAP_LEVEL: - debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_MIPMAP_LEVEL\n"); + _debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_MIPMAP_LEVEL\n"); break; case SVGA3D_TS_TEXTURE_LOD_BIAS: - debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_LOD_BIAS\n"); + _debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_LOD_BIAS\n"); break; case SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL: - debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL\n"); + _debug_printf("\t\t.name = SVGA3D_TS_TEXTURE_ANISOTROPIC_LEVEL\n"); break; case SVGA3D_TS_ADDRESSW: - debug_printf("\t\t.name = SVGA3D_TS_ADDRESSW\n"); + _debug_printf("\t\t.name = SVGA3D_TS_ADDRESSW\n"); break; case SVGA3D_TS_GAMMA: - debug_printf("\t\t.name = SVGA3D_TS_GAMMA\n"); + _debug_printf("\t\t.name = SVGA3D_TS_GAMMA\n"); break; case SVGA3D_TS_BUMPENVLSCALE: - debug_printf("\t\t.name = SVGA3D_TS_BUMPENVLSCALE\n"); + _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVLSCALE\n"); break; case SVGA3D_TS_BUMPENVLOFFSET: - debug_printf("\t\t.name = SVGA3D_TS_BUMPENVLOFFSET\n"); + _debug_printf("\t\t.name = SVGA3D_TS_BUMPENVLOFFSET\n"); break; case SVGA3D_TS_COLORARG0: - debug_printf("\t\t.name = SVGA3D_TS_COLORARG0\n"); + _debug_printf("\t\t.name = SVGA3D_TS_COLORARG0\n"); break; case SVGA3D_TS_ALPHAARG0: - debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG0\n"); + _debug_printf("\t\t.name = SVGA3D_TS_ALPHAARG0\n"); break; case SVGA3D_TS_MAX: - debug_printf("\t\t.name = SVGA3D_TS_MAX\n"); + _debug_printf("\t\t.name = SVGA3D_TS_MAX\n"); break; default: - debug_printf("\t\t.name = %i\n", (*cmd).name); + _debug_printf("\t\t.name = %i\n", (*cmd).name); break; } - debug_printf("\t\t.value = %u\n", (*cmd).value); - debug_printf("\t\t.floatValue = %f\n", (*cmd).floatValue); + _debug_printf("\t\t.value = %u\n", (*cmd).value); + _debug_printf("\t\t.floatValue = %f\n", (*cmd).floatValue); } static void dump_SVGA3dCopyBox(const SVGA3dCopyBox *cmd) { - debug_printf("\t\t.x = %u\n", (*cmd).x); - debug_printf("\t\t.y = %u\n", (*cmd).y); - debug_printf("\t\t.z = %u\n", (*cmd).z); - debug_printf("\t\t.w = %u\n", (*cmd).w); - debug_printf("\t\t.h = %u\n", (*cmd).h); - debug_printf("\t\t.d = %u\n", (*cmd).d); - debug_printf("\t\t.srcx = %u\n", (*cmd).srcx); - debug_printf("\t\t.srcy = %u\n", (*cmd).srcy); - debug_printf("\t\t.srcz = %u\n", (*cmd).srcz); + _debug_printf("\t\t.x = %u\n", (*cmd).x); + _debug_printf("\t\t.y = %u\n", (*cmd).y); + _debug_printf("\t\t.z = %u\n", (*cmd).z); + _debug_printf("\t\t.w = %u\n", (*cmd).w); + _debug_printf("\t\t.h = %u\n", (*cmd).h); + _debug_printf("\t\t.d = %u\n", (*cmd).d); + _debug_printf("\t\t.srcx = %u\n", (*cmd).srcx); + _debug_printf("\t\t.srcy = %u\n", (*cmd).srcy); + _debug_printf("\t\t.srcz = %u\n", (*cmd).srcz); } static void dump_SVGA3dCmdSetClipPlane(const SVGA3dCmdSetClipPlane *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); - debug_printf("\t\t.index = %u\n", (*cmd).index); - debug_printf("\t\t.plane[0] = %f\n", (*cmd).plane[0]); - debug_printf("\t\t.plane[1] = %f\n", (*cmd).plane[1]); - debug_printf("\t\t.plane[2] = %f\n", (*cmd).plane[2]); - debug_printf("\t\t.plane[3] = %f\n", (*cmd).plane[3]); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.index = %u\n", (*cmd).index); + _debug_printf("\t\t.plane[0] = %f\n", (*cmd).plane[0]); + _debug_printf("\t\t.plane[1] = %f\n", (*cmd).plane[1]); + _debug_printf("\t\t.plane[2] = %f\n", (*cmd).plane[2]); + _debug_printf("\t\t.plane[3] = %f\n", (*cmd).plane[3]); } static void dump_SVGA3dCmdWaitForQuery(const SVGA3dCmdWaitForQuery *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); switch((*cmd).type) { case SVGA3D_QUERYTYPE_OCCLUSION: - debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n"); + _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n"); break; case SVGA3D_QUERYTYPE_MAX: - debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n"); + _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n"); break; default: - debug_printf("\t\t.type = %i\n", (*cmd).type); + _debug_printf("\t\t.type = %i\n", (*cmd).type); break; } - debug_printf("\t\t.guestResult.gmrId = %u\n", (*cmd).guestResult.gmrId); - debug_printf("\t\t.guestResult.offset = %u\n", (*cmd).guestResult.offset); + _debug_printf("\t\t.guestResult.gmrId = %u\n", (*cmd).guestResult.gmrId); + _debug_printf("\t\t.guestResult.offset = %u\n", (*cmd).guestResult.offset); } static void dump_SVGA3dCmdSetRenderTarget(const SVGA3dCmdSetRenderTarget *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); switch((*cmd).type) { case SVGA3D_RT_DEPTH: - debug_printf("\t\t.type = SVGA3D_RT_DEPTH\n"); + _debug_printf("\t\t.type = SVGA3D_RT_DEPTH\n"); break; case SVGA3D_RT_STENCIL: - debug_printf("\t\t.type = SVGA3D_RT_STENCIL\n"); + _debug_printf("\t\t.type = SVGA3D_RT_STENCIL\n"); break; default: - debug_printf("\t\t.type = SVGA3D_RT_COLOR%u\n", (*cmd).type - SVGA3D_RT_COLOR0); + _debug_printf("\t\t.type = SVGA3D_RT_COLOR%u\n", (*cmd).type - SVGA3D_RT_COLOR0); break; } - debug_printf("\t\t.target.sid = %u\n", (*cmd).target.sid); - debug_printf("\t\t.target.face = %u\n", (*cmd).target.face); - debug_printf("\t\t.target.mipmap = %u\n", (*cmd).target.mipmap); + _debug_printf("\t\t.target.sid = %u\n", (*cmd).target.sid); + _debug_printf("\t\t.target.face = %u\n", (*cmd).target.face); + _debug_printf("\t\t.target.mipmap = %u\n", (*cmd).target.mipmap); } static void dump_SVGA3dCmdSetTextureState(const SVGA3dCmdSetTextureState *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); } static void dump_SVGA3dCmdSurfaceCopy(const SVGA3dCmdSurfaceCopy *cmd) { - debug_printf("\t\t.src.sid = %u\n", (*cmd).src.sid); - debug_printf("\t\t.src.face = %u\n", (*cmd).src.face); - debug_printf("\t\t.src.mipmap = %u\n", (*cmd).src.mipmap); - debug_printf("\t\t.dest.sid = %u\n", (*cmd).dest.sid); - debug_printf("\t\t.dest.face = %u\n", (*cmd).dest.face); - debug_printf("\t\t.dest.mipmap = %u\n", (*cmd).dest.mipmap); + _debug_printf("\t\t.src.sid = %u\n", (*cmd).src.sid); + _debug_printf("\t\t.src.face = %u\n", (*cmd).src.face); + _debug_printf("\t\t.src.mipmap = %u\n", (*cmd).src.mipmap); + _debug_printf("\t\t.dest.sid = %u\n", (*cmd).dest.sid); + _debug_printf("\t\t.dest.face = %u\n", (*cmd).dest.face); + _debug_printf("\t\t.dest.mipmap = %u\n", (*cmd).dest.mipmap); } static void dump_SVGA3dCmdSetMaterial(const SVGA3dCmdSetMaterial *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); switch((*cmd).face) { case SVGA3D_FACE_INVALID: - debug_printf("\t\t.face = SVGA3D_FACE_INVALID\n"); + _debug_printf("\t\t.face = SVGA3D_FACE_INVALID\n"); break; case SVGA3D_FACE_NONE: - debug_printf("\t\t.face = SVGA3D_FACE_NONE\n"); + _debug_printf("\t\t.face = SVGA3D_FACE_NONE\n"); break; case SVGA3D_FACE_FRONT: - debug_printf("\t\t.face = SVGA3D_FACE_FRONT\n"); + _debug_printf("\t\t.face = SVGA3D_FACE_FRONT\n"); break; case SVGA3D_FACE_BACK: - debug_printf("\t\t.face = SVGA3D_FACE_BACK\n"); + _debug_printf("\t\t.face = SVGA3D_FACE_BACK\n"); break; case SVGA3D_FACE_FRONT_BACK: - debug_printf("\t\t.face = SVGA3D_FACE_FRONT_BACK\n"); + _debug_printf("\t\t.face = SVGA3D_FACE_FRONT_BACK\n"); break; case SVGA3D_FACE_MAX: - debug_printf("\t\t.face = SVGA3D_FACE_MAX\n"); + _debug_printf("\t\t.face = SVGA3D_FACE_MAX\n"); break; default: - debug_printf("\t\t.face = %i\n", (*cmd).face); + _debug_printf("\t\t.face = %i\n", (*cmd).face); break; } - debug_printf("\t\t.material.diffuse[0] = %f\n", (*cmd).material.diffuse[0]); - debug_printf("\t\t.material.diffuse[1] = %f\n", (*cmd).material.diffuse[1]); - debug_printf("\t\t.material.diffuse[2] = %f\n", (*cmd).material.diffuse[2]); - debug_printf("\t\t.material.diffuse[3] = %f\n", (*cmd).material.diffuse[3]); - debug_printf("\t\t.material.ambient[0] = %f\n", (*cmd).material.ambient[0]); - debug_printf("\t\t.material.ambient[1] = %f\n", (*cmd).material.ambient[1]); - debug_printf("\t\t.material.ambient[2] = %f\n", (*cmd).material.ambient[2]); - debug_printf("\t\t.material.ambient[3] = %f\n", (*cmd).material.ambient[3]); - debug_printf("\t\t.material.specular[0] = %f\n", (*cmd).material.specular[0]); - debug_printf("\t\t.material.specular[1] = %f\n", (*cmd).material.specular[1]); - debug_printf("\t\t.material.specular[2] = %f\n", (*cmd).material.specular[2]); - debug_printf("\t\t.material.specular[3] = %f\n", (*cmd).material.specular[3]); - debug_printf("\t\t.material.emissive[0] = %f\n", (*cmd).material.emissive[0]); - debug_printf("\t\t.material.emissive[1] = %f\n", (*cmd).material.emissive[1]); - debug_printf("\t\t.material.emissive[2] = %f\n", (*cmd).material.emissive[2]); - debug_printf("\t\t.material.emissive[3] = %f\n", (*cmd).material.emissive[3]); - debug_printf("\t\t.material.shininess = %f\n", (*cmd).material.shininess); + _debug_printf("\t\t.material.diffuse[0] = %f\n", (*cmd).material.diffuse[0]); + _debug_printf("\t\t.material.diffuse[1] = %f\n", (*cmd).material.diffuse[1]); + _debug_printf("\t\t.material.diffuse[2] = %f\n", (*cmd).material.diffuse[2]); + _debug_printf("\t\t.material.diffuse[3] = %f\n", (*cmd).material.diffuse[3]); + _debug_printf("\t\t.material.ambient[0] = %f\n", (*cmd).material.ambient[0]); + _debug_printf("\t\t.material.ambient[1] = %f\n", (*cmd).material.ambient[1]); + _debug_printf("\t\t.material.ambient[2] = %f\n", (*cmd).material.ambient[2]); + _debug_printf("\t\t.material.ambient[3] = %f\n", (*cmd).material.ambient[3]); + _debug_printf("\t\t.material.specular[0] = %f\n", (*cmd).material.specular[0]); + _debug_printf("\t\t.material.specular[1] = %f\n", (*cmd).material.specular[1]); + _debug_printf("\t\t.material.specular[2] = %f\n", (*cmd).material.specular[2]); + _debug_printf("\t\t.material.specular[3] = %f\n", (*cmd).material.specular[3]); + _debug_printf("\t\t.material.emissive[0] = %f\n", (*cmd).material.emissive[0]); + _debug_printf("\t\t.material.emissive[1] = %f\n", (*cmd).material.emissive[1]); + _debug_printf("\t\t.material.emissive[2] = %f\n", (*cmd).material.emissive[2]); + _debug_printf("\t\t.material.emissive[3] = %f\n", (*cmd).material.emissive[3]); + _debug_printf("\t\t.material.shininess = %f\n", (*cmd).material.shininess); } static void dump_SVGA3dCmdSetLightData(const SVGA3dCmdSetLightData *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); - debug_printf("\t\t.index = %u\n", (*cmd).index); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.index = %u\n", (*cmd).index); switch((*cmd).data.type) { case SVGA3D_LIGHTTYPE_INVALID: - debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_INVALID\n"); + _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_INVALID\n"); break; case SVGA3D_LIGHTTYPE_POINT: - debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_POINT\n"); + _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_POINT\n"); break; case SVGA3D_LIGHTTYPE_SPOT1: - debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_SPOT1\n"); + _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_SPOT1\n"); break; case SVGA3D_LIGHTTYPE_SPOT2: - debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_SPOT2\n"); + _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_SPOT2\n"); break; case SVGA3D_LIGHTTYPE_DIRECTIONAL: - debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_DIRECTIONAL\n"); + _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_DIRECTIONAL\n"); break; case SVGA3D_LIGHTTYPE_MAX: - debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_MAX\n"); + _debug_printf("\t\t.data.type = SVGA3D_LIGHTTYPE_MAX\n"); break; default: - debug_printf("\t\t.data.type = %i\n", (*cmd).data.type); + _debug_printf("\t\t.data.type = %i\n", (*cmd).data.type); break; } - debug_printf("\t\t.data.inWorldSpace = %u\n", (*cmd).data.inWorldSpace); - debug_printf("\t\t.data.diffuse[0] = %f\n", (*cmd).data.diffuse[0]); - debug_printf("\t\t.data.diffuse[1] = %f\n", (*cmd).data.diffuse[1]); - debug_printf("\t\t.data.diffuse[2] = %f\n", (*cmd).data.diffuse[2]); - debug_printf("\t\t.data.diffuse[3] = %f\n", (*cmd).data.diffuse[3]); - debug_printf("\t\t.data.specular[0] = %f\n", (*cmd).data.specular[0]); - debug_printf("\t\t.data.specular[1] = %f\n", (*cmd).data.specular[1]); - debug_printf("\t\t.data.specular[2] = %f\n", (*cmd).data.specular[2]); - debug_printf("\t\t.data.specular[3] = %f\n", (*cmd).data.specular[3]); - debug_printf("\t\t.data.ambient[0] = %f\n", (*cmd).data.ambient[0]); - debug_printf("\t\t.data.ambient[1] = %f\n", (*cmd).data.ambient[1]); - debug_printf("\t\t.data.ambient[2] = %f\n", (*cmd).data.ambient[2]); - debug_printf("\t\t.data.ambient[3] = %f\n", (*cmd).data.ambient[3]); - debug_printf("\t\t.data.position[0] = %f\n", (*cmd).data.position[0]); - debug_printf("\t\t.data.position[1] = %f\n", (*cmd).data.position[1]); - debug_printf("\t\t.data.position[2] = %f\n", (*cmd).data.position[2]); - debug_printf("\t\t.data.position[3] = %f\n", (*cmd).data.position[3]); - debug_printf("\t\t.data.direction[0] = %f\n", (*cmd).data.direction[0]); - debug_printf("\t\t.data.direction[1] = %f\n", (*cmd).data.direction[1]); - debug_printf("\t\t.data.direction[2] = %f\n", (*cmd).data.direction[2]); - debug_printf("\t\t.data.direction[3] = %f\n", (*cmd).data.direction[3]); - debug_printf("\t\t.data.range = %f\n", (*cmd).data.range); - debug_printf("\t\t.data.falloff = %f\n", (*cmd).data.falloff); - debug_printf("\t\t.data.attenuation0 = %f\n", (*cmd).data.attenuation0); - debug_printf("\t\t.data.attenuation1 = %f\n", (*cmd).data.attenuation1); - debug_printf("\t\t.data.attenuation2 = %f\n", (*cmd).data.attenuation2); - debug_printf("\t\t.data.theta = %f\n", (*cmd).data.theta); - debug_printf("\t\t.data.phi = %f\n", (*cmd).data.phi); + _debug_printf("\t\t.data.inWorldSpace = %u\n", (*cmd).data.inWorldSpace); + _debug_printf("\t\t.data.diffuse[0] = %f\n", (*cmd).data.diffuse[0]); + _debug_printf("\t\t.data.diffuse[1] = %f\n", (*cmd).data.diffuse[1]); + _debug_printf("\t\t.data.diffuse[2] = %f\n", (*cmd).data.diffuse[2]); + _debug_printf("\t\t.data.diffuse[3] = %f\n", (*cmd).data.diffuse[3]); + _debug_printf("\t\t.data.specular[0] = %f\n", (*cmd).data.specular[0]); + _debug_printf("\t\t.data.specular[1] = %f\n", (*cmd).data.specular[1]); + _debug_printf("\t\t.data.specular[2] = %f\n", (*cmd).data.specular[2]); + _debug_printf("\t\t.data.specular[3] = %f\n", (*cmd).data.specular[3]); + _debug_printf("\t\t.data.ambient[0] = %f\n", (*cmd).data.ambient[0]); + _debug_printf("\t\t.data.ambient[1] = %f\n", (*cmd).data.ambient[1]); + _debug_printf("\t\t.data.ambient[2] = %f\n", (*cmd).data.ambient[2]); + _debug_printf("\t\t.data.ambient[3] = %f\n", (*cmd).data.ambient[3]); + _debug_printf("\t\t.data.position[0] = %f\n", (*cmd).data.position[0]); + _debug_printf("\t\t.data.position[1] = %f\n", (*cmd).data.position[1]); + _debug_printf("\t\t.data.position[2] = %f\n", (*cmd).data.position[2]); + _debug_printf("\t\t.data.position[3] = %f\n", (*cmd).data.position[3]); + _debug_printf("\t\t.data.direction[0] = %f\n", (*cmd).data.direction[0]); + _debug_printf("\t\t.data.direction[1] = %f\n", (*cmd).data.direction[1]); + _debug_printf("\t\t.data.direction[2] = %f\n", (*cmd).data.direction[2]); + _debug_printf("\t\t.data.direction[3] = %f\n", (*cmd).data.direction[3]); + _debug_printf("\t\t.data.range = %f\n", (*cmd).data.range); + _debug_printf("\t\t.data.falloff = %f\n", (*cmd).data.falloff); + _debug_printf("\t\t.data.attenuation0 = %f\n", (*cmd).data.attenuation0); + _debug_printf("\t\t.data.attenuation1 = %f\n", (*cmd).data.attenuation1); + _debug_printf("\t\t.data.attenuation2 = %f\n", (*cmd).data.attenuation2); + _debug_printf("\t\t.data.theta = %f\n", (*cmd).data.theta); + _debug_printf("\t\t.data.phi = %f\n", (*cmd).data.phi); } static void dump_SVGA3dCmdSetViewport(const SVGA3dCmdSetViewport *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); - debug_printf("\t\t.rect.x = %u\n", (*cmd).rect.x); - debug_printf("\t\t.rect.y = %u\n", (*cmd).rect.y); - debug_printf("\t\t.rect.w = %u\n", (*cmd).rect.w); - debug_printf("\t\t.rect.h = %u\n", (*cmd).rect.h); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.rect.x = %u\n", (*cmd).rect.x); + _debug_printf("\t\t.rect.y = %u\n", (*cmd).rect.y); + _debug_printf("\t\t.rect.w = %u\n", (*cmd).rect.w); + _debug_printf("\t\t.rect.h = %u\n", (*cmd).rect.h); } static void dump_SVGA3dCmdSetScissorRect(const SVGA3dCmdSetScissorRect *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); - debug_printf("\t\t.rect.x = %u\n", (*cmd).rect.x); - debug_printf("\t\t.rect.y = %u\n", (*cmd).rect.y); - debug_printf("\t\t.rect.w = %u\n", (*cmd).rect.w); - debug_printf("\t\t.rect.h = %u\n", (*cmd).rect.h); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.rect.x = %u\n", (*cmd).rect.x); + _debug_printf("\t\t.rect.y = %u\n", (*cmd).rect.y); + _debug_printf("\t\t.rect.w = %u\n", (*cmd).rect.w); + _debug_printf("\t\t.rect.h = %u\n", (*cmd).rect.h); } static void dump_SVGA3dCopyRect(const SVGA3dCopyRect *cmd) { - debug_printf("\t\t.x = %u\n", (*cmd).x); - debug_printf("\t\t.y = %u\n", (*cmd).y); - debug_printf("\t\t.w = %u\n", (*cmd).w); - debug_printf("\t\t.h = %u\n", (*cmd).h); - debug_printf("\t\t.srcx = %u\n", (*cmd).srcx); - debug_printf("\t\t.srcy = %u\n", (*cmd).srcy); + _debug_printf("\t\t.x = %u\n", (*cmd).x); + _debug_printf("\t\t.y = %u\n", (*cmd).y); + _debug_printf("\t\t.w = %u\n", (*cmd).w); + _debug_printf("\t\t.h = %u\n", (*cmd).h); + _debug_printf("\t\t.srcx = %u\n", (*cmd).srcx); + _debug_printf("\t\t.srcy = %u\n", (*cmd).srcy); } static void dump_SVGA3dCmdSetShader(const SVGA3dCmdSetShader *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); switch((*cmd).type) { case SVGA3D_SHADERTYPE_COMPILED_DX8: - debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n"); + _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n"); break; case SVGA3D_SHADERTYPE_VS: - debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n"); + _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n"); break; case SVGA3D_SHADERTYPE_PS: - debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n"); + _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n"); break; case SVGA3D_SHADERTYPE_MAX: - debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n"); + _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n"); break; default: - debug_printf("\t\t.type = %i\n", (*cmd).type); + _debug_printf("\t\t.type = %i\n", (*cmd).type); break; } - debug_printf("\t\t.shid = %u\n", (*cmd).shid); + _debug_printf("\t\t.shid = %u\n", (*cmd).shid); } static void dump_SVGA3dCmdEndQuery(const SVGA3dCmdEndQuery *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); switch((*cmd).type) { case SVGA3D_QUERYTYPE_OCCLUSION: - debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n"); + _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n"); break; case SVGA3D_QUERYTYPE_MAX: - debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n"); + _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n"); break; default: - debug_printf("\t\t.type = %i\n", (*cmd).type); + _debug_printf("\t\t.type = %i\n", (*cmd).type); break; } - debug_printf("\t\t.guestResult.gmrId = %u\n", (*cmd).guestResult.gmrId); - debug_printf("\t\t.guestResult.offset = %u\n", (*cmd).guestResult.offset); + _debug_printf("\t\t.guestResult.gmrId = %u\n", (*cmd).guestResult.gmrId); + _debug_printf("\t\t.guestResult.offset = %u\n", (*cmd).guestResult.offset); } static void dump_SVGA3dSize(const SVGA3dSize *cmd) { - debug_printf("\t\t.width = %u\n", (*cmd).width); - debug_printf("\t\t.height = %u\n", (*cmd).height); - debug_printf("\t\t.depth = %u\n", (*cmd).depth); + _debug_printf("\t\t.width = %u\n", (*cmd).width); + _debug_printf("\t\t.height = %u\n", (*cmd).height); + _debug_printf("\t\t.depth = %u\n", (*cmd).depth); } static void dump_SVGA3dCmdDestroySurface(const SVGA3dCmdDestroySurface *cmd) { - debug_printf("\t\t.sid = %u\n", (*cmd).sid); + _debug_printf("\t\t.sid = %u\n", (*cmd).sid); } static void dump_SVGA3dCmdDefineContext(const SVGA3dCmdDefineContext *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); } static void dump_SVGA3dRect(const SVGA3dRect *cmd) { - debug_printf("\t\t.x = %u\n", (*cmd).x); - debug_printf("\t\t.y = %u\n", (*cmd).y); - debug_printf("\t\t.w = %u\n", (*cmd).w); - debug_printf("\t\t.h = %u\n", (*cmd).h); + _debug_printf("\t\t.x = %u\n", (*cmd).x); + _debug_printf("\t\t.y = %u\n", (*cmd).y); + _debug_printf("\t\t.w = %u\n", (*cmd).w); + _debug_printf("\t\t.h = %u\n", (*cmd).h); } static void dump_SVGA3dCmdBeginQuery(const SVGA3dCmdBeginQuery *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); switch((*cmd).type) { case SVGA3D_QUERYTYPE_OCCLUSION: - debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n"); + _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_OCCLUSION\n"); break; case SVGA3D_QUERYTYPE_MAX: - debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n"); + _debug_printf("\t\t.type = SVGA3D_QUERYTYPE_MAX\n"); break; default: - debug_printf("\t\t.type = %i\n", (*cmd).type); + _debug_printf("\t\t.type = %i\n", (*cmd).type); break; } } @@ -599,336 +599,336 @@ dump_SVGA3dRenderState(const SVGA3dRenderState *cmd) { switch((*cmd).state) { case SVGA3D_RS_INVALID: - debug_printf("\t\t.state = SVGA3D_RS_INVALID\n"); + _debug_printf("\t\t.state = SVGA3D_RS_INVALID\n"); break; case SVGA3D_RS_ZENABLE: - debug_printf("\t\t.state = SVGA3D_RS_ZENABLE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_ZENABLE\n"); break; case SVGA3D_RS_ZWRITEENABLE: - debug_printf("\t\t.state = SVGA3D_RS_ZWRITEENABLE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_ZWRITEENABLE\n"); break; case SVGA3D_RS_ALPHATESTENABLE: - debug_printf("\t\t.state = SVGA3D_RS_ALPHATESTENABLE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_ALPHATESTENABLE\n"); break; case SVGA3D_RS_DITHERENABLE: - debug_printf("\t\t.state = SVGA3D_RS_DITHERENABLE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_DITHERENABLE\n"); break; case SVGA3D_RS_BLENDENABLE: - debug_printf("\t\t.state = SVGA3D_RS_BLENDENABLE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_BLENDENABLE\n"); break; case SVGA3D_RS_FOGENABLE: - debug_printf("\t\t.state = SVGA3D_RS_FOGENABLE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_FOGENABLE\n"); break; case SVGA3D_RS_SPECULARENABLE: - debug_printf("\t\t.state = SVGA3D_RS_SPECULARENABLE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_SPECULARENABLE\n"); break; case SVGA3D_RS_STENCILENABLE: - debug_printf("\t\t.state = SVGA3D_RS_STENCILENABLE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_STENCILENABLE\n"); break; case SVGA3D_RS_LIGHTINGENABLE: - debug_printf("\t\t.state = SVGA3D_RS_LIGHTINGENABLE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_LIGHTINGENABLE\n"); break; case SVGA3D_RS_NORMALIZENORMALS: - debug_printf("\t\t.state = SVGA3D_RS_NORMALIZENORMALS\n"); + _debug_printf("\t\t.state = SVGA3D_RS_NORMALIZENORMALS\n"); break; case SVGA3D_RS_POINTSPRITEENABLE: - debug_printf("\t\t.state = SVGA3D_RS_POINTSPRITEENABLE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_POINTSPRITEENABLE\n"); break; case SVGA3D_RS_POINTSCALEENABLE: - debug_printf("\t\t.state = SVGA3D_RS_POINTSCALEENABLE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_POINTSCALEENABLE\n"); break; case SVGA3D_RS_STENCILREF: - debug_printf("\t\t.state = SVGA3D_RS_STENCILREF\n"); + _debug_printf("\t\t.state = SVGA3D_RS_STENCILREF\n"); break; case SVGA3D_RS_STENCILMASK: - debug_printf("\t\t.state = SVGA3D_RS_STENCILMASK\n"); + _debug_printf("\t\t.state = SVGA3D_RS_STENCILMASK\n"); break; case SVGA3D_RS_STENCILWRITEMASK: - debug_printf("\t\t.state = SVGA3D_RS_STENCILWRITEMASK\n"); + _debug_printf("\t\t.state = SVGA3D_RS_STENCILWRITEMASK\n"); break; case SVGA3D_RS_FOGSTART: - debug_printf("\t\t.state = SVGA3D_RS_FOGSTART\n"); + _debug_printf("\t\t.state = SVGA3D_RS_FOGSTART\n"); break; case SVGA3D_RS_FOGEND: - debug_printf("\t\t.state = SVGA3D_RS_FOGEND\n"); + _debug_printf("\t\t.state = SVGA3D_RS_FOGEND\n"); break; case SVGA3D_RS_FOGDENSITY: - debug_printf("\t\t.state = SVGA3D_RS_FOGDENSITY\n"); + _debug_printf("\t\t.state = SVGA3D_RS_FOGDENSITY\n"); break; case SVGA3D_RS_POINTSIZE: - debug_printf("\t\t.state = SVGA3D_RS_POINTSIZE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_POINTSIZE\n"); break; case SVGA3D_RS_POINTSIZEMIN: - debug_printf("\t\t.state = SVGA3D_RS_POINTSIZEMIN\n"); + _debug_printf("\t\t.state = SVGA3D_RS_POINTSIZEMIN\n"); break; case SVGA3D_RS_POINTSIZEMAX: - debug_printf("\t\t.state = SVGA3D_RS_POINTSIZEMAX\n"); + _debug_printf("\t\t.state = SVGA3D_RS_POINTSIZEMAX\n"); break; case SVGA3D_RS_POINTSCALE_A: - debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_A\n"); + _debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_A\n"); break; case SVGA3D_RS_POINTSCALE_B: - debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_B\n"); + _debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_B\n"); break; case SVGA3D_RS_POINTSCALE_C: - debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_C\n"); + _debug_printf("\t\t.state = SVGA3D_RS_POINTSCALE_C\n"); break; case SVGA3D_RS_FOGCOLOR: - debug_printf("\t\t.state = SVGA3D_RS_FOGCOLOR\n"); + _debug_printf("\t\t.state = SVGA3D_RS_FOGCOLOR\n"); break; case SVGA3D_RS_AMBIENT: - debug_printf("\t\t.state = SVGA3D_RS_AMBIENT\n"); + _debug_printf("\t\t.state = SVGA3D_RS_AMBIENT\n"); break; case SVGA3D_RS_CLIPPLANEENABLE: - debug_printf("\t\t.state = SVGA3D_RS_CLIPPLANEENABLE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_CLIPPLANEENABLE\n"); break; case SVGA3D_RS_FOGMODE: - debug_printf("\t\t.state = SVGA3D_RS_FOGMODE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_FOGMODE\n"); break; case SVGA3D_RS_FILLMODE: - debug_printf("\t\t.state = SVGA3D_RS_FILLMODE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_FILLMODE\n"); break; case SVGA3D_RS_SHADEMODE: - debug_printf("\t\t.state = SVGA3D_RS_SHADEMODE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_SHADEMODE\n"); break; case SVGA3D_RS_LINEPATTERN: - debug_printf("\t\t.state = SVGA3D_RS_LINEPATTERN\n"); + _debug_printf("\t\t.state = SVGA3D_RS_LINEPATTERN\n"); break; case SVGA3D_RS_SRCBLEND: - debug_printf("\t\t.state = SVGA3D_RS_SRCBLEND\n"); + _debug_printf("\t\t.state = SVGA3D_RS_SRCBLEND\n"); break; case SVGA3D_RS_DSTBLEND: - debug_printf("\t\t.state = SVGA3D_RS_DSTBLEND\n"); + _debug_printf("\t\t.state = SVGA3D_RS_DSTBLEND\n"); break; case SVGA3D_RS_BLENDEQUATION: - debug_printf("\t\t.state = SVGA3D_RS_BLENDEQUATION\n"); + _debug_printf("\t\t.state = SVGA3D_RS_BLENDEQUATION\n"); break; case SVGA3D_RS_CULLMODE: - debug_printf("\t\t.state = SVGA3D_RS_CULLMODE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_CULLMODE\n"); break; case SVGA3D_RS_ZFUNC: - debug_printf("\t\t.state = SVGA3D_RS_ZFUNC\n"); + _debug_printf("\t\t.state = SVGA3D_RS_ZFUNC\n"); break; case SVGA3D_RS_ALPHAFUNC: - debug_printf("\t\t.state = SVGA3D_RS_ALPHAFUNC\n"); + _debug_printf("\t\t.state = SVGA3D_RS_ALPHAFUNC\n"); break; case SVGA3D_RS_STENCILFUNC: - debug_printf("\t\t.state = SVGA3D_RS_STENCILFUNC\n"); + _debug_printf("\t\t.state = SVGA3D_RS_STENCILFUNC\n"); break; case SVGA3D_RS_STENCILFAIL: - debug_printf("\t\t.state = SVGA3D_RS_STENCILFAIL\n"); + _debug_printf("\t\t.state = SVGA3D_RS_STENCILFAIL\n"); break; case SVGA3D_RS_STENCILZFAIL: - debug_printf("\t\t.state = SVGA3D_RS_STENCILZFAIL\n"); + _debug_printf("\t\t.state = SVGA3D_RS_STENCILZFAIL\n"); break; case SVGA3D_RS_STENCILPASS: - debug_printf("\t\t.state = SVGA3D_RS_STENCILPASS\n"); + _debug_printf("\t\t.state = SVGA3D_RS_STENCILPASS\n"); break; case SVGA3D_RS_ALPHAREF: - debug_printf("\t\t.state = SVGA3D_RS_ALPHAREF\n"); + _debug_printf("\t\t.state = SVGA3D_RS_ALPHAREF\n"); break; case SVGA3D_RS_FRONTWINDING: - debug_printf("\t\t.state = SVGA3D_RS_FRONTWINDING\n"); + _debug_printf("\t\t.state = SVGA3D_RS_FRONTWINDING\n"); break; case SVGA3D_RS_COORDINATETYPE: - debug_printf("\t\t.state = SVGA3D_RS_COORDINATETYPE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_COORDINATETYPE\n"); break; case SVGA3D_RS_ZBIAS: - debug_printf("\t\t.state = SVGA3D_RS_ZBIAS\n"); + _debug_printf("\t\t.state = SVGA3D_RS_ZBIAS\n"); break; case SVGA3D_RS_RANGEFOGENABLE: - debug_printf("\t\t.state = SVGA3D_RS_RANGEFOGENABLE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_RANGEFOGENABLE\n"); break; case SVGA3D_RS_COLORWRITEENABLE: - debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE\n"); break; case SVGA3D_RS_VERTEXMATERIALENABLE: - debug_printf("\t\t.state = SVGA3D_RS_VERTEXMATERIALENABLE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_VERTEXMATERIALENABLE\n"); break; case SVGA3D_RS_DIFFUSEMATERIALSOURCE: - debug_printf("\t\t.state = SVGA3D_RS_DIFFUSEMATERIALSOURCE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_DIFFUSEMATERIALSOURCE\n"); break; case SVGA3D_RS_SPECULARMATERIALSOURCE: - debug_printf("\t\t.state = SVGA3D_RS_SPECULARMATERIALSOURCE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_SPECULARMATERIALSOURCE\n"); break; case SVGA3D_RS_AMBIENTMATERIALSOURCE: - debug_printf("\t\t.state = SVGA3D_RS_AMBIENTMATERIALSOURCE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_AMBIENTMATERIALSOURCE\n"); break; case SVGA3D_RS_EMISSIVEMATERIALSOURCE: - debug_printf("\t\t.state = SVGA3D_RS_EMISSIVEMATERIALSOURCE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_EMISSIVEMATERIALSOURCE\n"); break; case SVGA3D_RS_TEXTUREFACTOR: - debug_printf("\t\t.state = SVGA3D_RS_TEXTUREFACTOR\n"); + _debug_printf("\t\t.state = SVGA3D_RS_TEXTUREFACTOR\n"); break; case SVGA3D_RS_LOCALVIEWER: - debug_printf("\t\t.state = SVGA3D_RS_LOCALVIEWER\n"); + _debug_printf("\t\t.state = SVGA3D_RS_LOCALVIEWER\n"); break; case SVGA3D_RS_SCISSORTESTENABLE: - debug_printf("\t\t.state = SVGA3D_RS_SCISSORTESTENABLE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_SCISSORTESTENABLE\n"); break; case SVGA3D_RS_BLENDCOLOR: - debug_printf("\t\t.state = SVGA3D_RS_BLENDCOLOR\n"); + _debug_printf("\t\t.state = SVGA3D_RS_BLENDCOLOR\n"); break; case SVGA3D_RS_STENCILENABLE2SIDED: - debug_printf("\t\t.state = SVGA3D_RS_STENCILENABLE2SIDED\n"); + _debug_printf("\t\t.state = SVGA3D_RS_STENCILENABLE2SIDED\n"); break; case SVGA3D_RS_CCWSTENCILFUNC: - debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILFUNC\n"); + _debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILFUNC\n"); break; case SVGA3D_RS_CCWSTENCILFAIL: - debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILFAIL\n"); + _debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILFAIL\n"); break; case SVGA3D_RS_CCWSTENCILZFAIL: - debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILZFAIL\n"); + _debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILZFAIL\n"); break; case SVGA3D_RS_CCWSTENCILPASS: - debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILPASS\n"); + _debug_printf("\t\t.state = SVGA3D_RS_CCWSTENCILPASS\n"); break; case SVGA3D_RS_VERTEXBLEND: - debug_printf("\t\t.state = SVGA3D_RS_VERTEXBLEND\n"); + _debug_printf("\t\t.state = SVGA3D_RS_VERTEXBLEND\n"); break; case SVGA3D_RS_SLOPESCALEDEPTHBIAS: - debug_printf("\t\t.state = SVGA3D_RS_SLOPESCALEDEPTHBIAS\n"); + _debug_printf("\t\t.state = SVGA3D_RS_SLOPESCALEDEPTHBIAS\n"); break; case SVGA3D_RS_DEPTHBIAS: - debug_printf("\t\t.state = SVGA3D_RS_DEPTHBIAS\n"); + _debug_printf("\t\t.state = SVGA3D_RS_DEPTHBIAS\n"); break; case SVGA3D_RS_OUTPUTGAMMA: - debug_printf("\t\t.state = SVGA3D_RS_OUTPUTGAMMA\n"); + _debug_printf("\t\t.state = SVGA3D_RS_OUTPUTGAMMA\n"); break; case SVGA3D_RS_ZVISIBLE: - debug_printf("\t\t.state = SVGA3D_RS_ZVISIBLE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_ZVISIBLE\n"); break; case SVGA3D_RS_LASTPIXEL: - debug_printf("\t\t.state = SVGA3D_RS_LASTPIXEL\n"); + _debug_printf("\t\t.state = SVGA3D_RS_LASTPIXEL\n"); break; case SVGA3D_RS_CLIPPING: - debug_printf("\t\t.state = SVGA3D_RS_CLIPPING\n"); + _debug_printf("\t\t.state = SVGA3D_RS_CLIPPING\n"); break; case SVGA3D_RS_WRAP0: - debug_printf("\t\t.state = SVGA3D_RS_WRAP0\n"); + _debug_printf("\t\t.state = SVGA3D_RS_WRAP0\n"); break; case SVGA3D_RS_WRAP1: - debug_printf("\t\t.state = SVGA3D_RS_WRAP1\n"); + _debug_printf("\t\t.state = SVGA3D_RS_WRAP1\n"); break; case SVGA3D_RS_WRAP2: - debug_printf("\t\t.state = SVGA3D_RS_WRAP2\n"); + _debug_printf("\t\t.state = SVGA3D_RS_WRAP2\n"); break; case SVGA3D_RS_WRAP3: - debug_printf("\t\t.state = SVGA3D_RS_WRAP3\n"); + _debug_printf("\t\t.state = SVGA3D_RS_WRAP3\n"); break; case SVGA3D_RS_WRAP4: - debug_printf("\t\t.state = SVGA3D_RS_WRAP4\n"); + _debug_printf("\t\t.state = SVGA3D_RS_WRAP4\n"); break; case SVGA3D_RS_WRAP5: - debug_printf("\t\t.state = SVGA3D_RS_WRAP5\n"); + _debug_printf("\t\t.state = SVGA3D_RS_WRAP5\n"); break; case SVGA3D_RS_WRAP6: - debug_printf("\t\t.state = SVGA3D_RS_WRAP6\n"); + _debug_printf("\t\t.state = SVGA3D_RS_WRAP6\n"); break; case SVGA3D_RS_WRAP7: - debug_printf("\t\t.state = SVGA3D_RS_WRAP7\n"); + _debug_printf("\t\t.state = SVGA3D_RS_WRAP7\n"); break; case SVGA3D_RS_WRAP8: - debug_printf("\t\t.state = SVGA3D_RS_WRAP8\n"); + _debug_printf("\t\t.state = SVGA3D_RS_WRAP8\n"); break; case SVGA3D_RS_WRAP9: - debug_printf("\t\t.state = SVGA3D_RS_WRAP9\n"); + _debug_printf("\t\t.state = SVGA3D_RS_WRAP9\n"); break; case SVGA3D_RS_WRAP10: - debug_printf("\t\t.state = SVGA3D_RS_WRAP10\n"); + _debug_printf("\t\t.state = SVGA3D_RS_WRAP10\n"); break; case SVGA3D_RS_WRAP11: - debug_printf("\t\t.state = SVGA3D_RS_WRAP11\n"); + _debug_printf("\t\t.state = SVGA3D_RS_WRAP11\n"); break; case SVGA3D_RS_WRAP12: - debug_printf("\t\t.state = SVGA3D_RS_WRAP12\n"); + _debug_printf("\t\t.state = SVGA3D_RS_WRAP12\n"); break; case SVGA3D_RS_WRAP13: - debug_printf("\t\t.state = SVGA3D_RS_WRAP13\n"); + _debug_printf("\t\t.state = SVGA3D_RS_WRAP13\n"); break; case SVGA3D_RS_WRAP14: - debug_printf("\t\t.state = SVGA3D_RS_WRAP14\n"); + _debug_printf("\t\t.state = SVGA3D_RS_WRAP14\n"); break; case SVGA3D_RS_WRAP15: - debug_printf("\t\t.state = SVGA3D_RS_WRAP15\n"); + _debug_printf("\t\t.state = SVGA3D_RS_WRAP15\n"); break; case SVGA3D_RS_MULTISAMPLEANTIALIAS: - debug_printf("\t\t.state = SVGA3D_RS_MULTISAMPLEANTIALIAS\n"); + _debug_printf("\t\t.state = SVGA3D_RS_MULTISAMPLEANTIALIAS\n"); break; case SVGA3D_RS_MULTISAMPLEMASK: - debug_printf("\t\t.state = SVGA3D_RS_MULTISAMPLEMASK\n"); + _debug_printf("\t\t.state = SVGA3D_RS_MULTISAMPLEMASK\n"); break; case SVGA3D_RS_INDEXEDVERTEXBLENDENABLE: - debug_printf("\t\t.state = SVGA3D_RS_INDEXEDVERTEXBLENDENABLE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_INDEXEDVERTEXBLENDENABLE\n"); break; case SVGA3D_RS_TWEENFACTOR: - debug_printf("\t\t.state = SVGA3D_RS_TWEENFACTOR\n"); + _debug_printf("\t\t.state = SVGA3D_RS_TWEENFACTOR\n"); break; case SVGA3D_RS_ANTIALIASEDLINEENABLE: - debug_printf("\t\t.state = SVGA3D_RS_ANTIALIASEDLINEENABLE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_ANTIALIASEDLINEENABLE\n"); break; case SVGA3D_RS_COLORWRITEENABLE1: - debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE1\n"); + _debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE1\n"); break; case SVGA3D_RS_COLORWRITEENABLE2: - debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE2\n"); + _debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE2\n"); break; case SVGA3D_RS_COLORWRITEENABLE3: - debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE3\n"); + _debug_printf("\t\t.state = SVGA3D_RS_COLORWRITEENABLE3\n"); break; case SVGA3D_RS_SEPARATEALPHABLENDENABLE: - debug_printf("\t\t.state = SVGA3D_RS_SEPARATEALPHABLENDENABLE\n"); + _debug_printf("\t\t.state = SVGA3D_RS_SEPARATEALPHABLENDENABLE\n"); break; case SVGA3D_RS_SRCBLENDALPHA: - debug_printf("\t\t.state = SVGA3D_RS_SRCBLENDALPHA\n"); + _debug_printf("\t\t.state = SVGA3D_RS_SRCBLENDALPHA\n"); break; case SVGA3D_RS_DSTBLENDALPHA: - debug_printf("\t\t.state = SVGA3D_RS_DSTBLENDALPHA\n"); + _debug_printf("\t\t.state = SVGA3D_RS_DSTBLENDALPHA\n"); break; case SVGA3D_RS_BLENDEQUATIONALPHA: - debug_printf("\t\t.state = SVGA3D_RS_BLENDEQUATIONALPHA\n"); + _debug_printf("\t\t.state = SVGA3D_RS_BLENDEQUATIONALPHA\n"); break; case SVGA3D_RS_MAX: - debug_printf("\t\t.state = SVGA3D_RS_MAX\n"); + _debug_printf("\t\t.state = SVGA3D_RS_MAX\n"); break; default: - debug_printf("\t\t.state = %i\n", (*cmd).state); + _debug_printf("\t\t.state = %i\n", (*cmd).state); break; } - debug_printf("\t\t.uintValue = %u\n", (*cmd).uintValue); - debug_printf("\t\t.floatValue = %f\n", (*cmd).floatValue); + _debug_printf("\t\t.uintValue = %u\n", (*cmd).uintValue); + _debug_printf("\t\t.floatValue = %f\n", (*cmd).floatValue); } static void dump_SVGA3dVertexDivisor(const SVGA3dVertexDivisor *cmd) { - debug_printf("\t\t.value = %u\n", (*cmd).value); - debug_printf("\t\t.count = %u\n", (*cmd).count); - debug_printf("\t\t.indexedData = %u\n", (*cmd).indexedData); - debug_printf("\t\t.instanceData = %u\n", (*cmd).instanceData); + _debug_printf("\t\t.value = %u\n", (*cmd).value); + _debug_printf("\t\t.count = %u\n", (*cmd).count); + _debug_printf("\t\t.indexedData = %u\n", (*cmd).indexedData); + _debug_printf("\t\t.instanceData = %u\n", (*cmd).instanceData); } static void dump_SVGA3dCmdDefineShader(const SVGA3dCmdDefineShader *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); - debug_printf("\t\t.shid = %u\n", (*cmd).shid); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.shid = %u\n", (*cmd).shid); switch((*cmd).type) { case SVGA3D_SHADERTYPE_COMPILED_DX8: - debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n"); + _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n"); break; case SVGA3D_SHADERTYPE_VS: - debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n"); + _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n"); break; case SVGA3D_SHADERTYPE_PS: - debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n"); + _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n"); break; case SVGA3D_SHADERTYPE_MAX: - debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n"); + _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n"); break; default: - debug_printf("\t\t.type = %i\n", (*cmd).type); + _debug_printf("\t\t.type = %i\n", (*cmd).type); break; } } @@ -936,53 +936,53 @@ dump_SVGA3dCmdDefineShader(const SVGA3dCmdDefineShader *cmd) static void dump_SVGA3dCmdSetShaderConst(const SVGA3dCmdSetShaderConst *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); - debug_printf("\t\t.reg = %u\n", (*cmd).reg); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.reg = %u\n", (*cmd).reg); switch((*cmd).type) { case SVGA3D_SHADERTYPE_COMPILED_DX8: - debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n"); + _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n"); break; case SVGA3D_SHADERTYPE_VS: - debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n"); + _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n"); break; case SVGA3D_SHADERTYPE_PS: - debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n"); + _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n"); break; case SVGA3D_SHADERTYPE_MAX: - debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n"); + _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n"); break; default: - debug_printf("\t\t.type = %i\n", (*cmd).type); + _debug_printf("\t\t.type = %i\n", (*cmd).type); break; } switch((*cmd).ctype) { case SVGA3D_CONST_TYPE_FLOAT: - debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_FLOAT\n"); - debug_printf("\t\t.values[0] = %f\n", *(const float *)&(*cmd).values[0]); - debug_printf("\t\t.values[1] = %f\n", *(const float *)&(*cmd).values[1]); - debug_printf("\t\t.values[2] = %f\n", *(const float *)&(*cmd).values[2]); - debug_printf("\t\t.values[3] = %f\n", *(const float *)&(*cmd).values[3]); + _debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_FLOAT\n"); + _debug_printf("\t\t.values[0] = %f\n", *(const float *)&(*cmd).values[0]); + _debug_printf("\t\t.values[1] = %f\n", *(const float *)&(*cmd).values[1]); + _debug_printf("\t\t.values[2] = %f\n", *(const float *)&(*cmd).values[2]); + _debug_printf("\t\t.values[3] = %f\n", *(const float *)&(*cmd).values[3]); break; case SVGA3D_CONST_TYPE_INT: - debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_INT\n"); - debug_printf("\t\t.values[0] = %u\n", (*cmd).values[0]); - debug_printf("\t\t.values[1] = %u\n", (*cmd).values[1]); - debug_printf("\t\t.values[2] = %u\n", (*cmd).values[2]); - debug_printf("\t\t.values[3] = %u\n", (*cmd).values[3]); + _debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_INT\n"); + _debug_printf("\t\t.values[0] = %u\n", (*cmd).values[0]); + _debug_printf("\t\t.values[1] = %u\n", (*cmd).values[1]); + _debug_printf("\t\t.values[2] = %u\n", (*cmd).values[2]); + _debug_printf("\t\t.values[3] = %u\n", (*cmd).values[3]); break; case SVGA3D_CONST_TYPE_BOOL: - debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_BOOL\n"); - debug_printf("\t\t.values[0] = %u\n", (*cmd).values[0]); - debug_printf("\t\t.values[1] = %u\n", (*cmd).values[1]); - debug_printf("\t\t.values[2] = %u\n", (*cmd).values[2]); - debug_printf("\t\t.values[3] = %u\n", (*cmd).values[3]); + _debug_printf("\t\t.ctype = SVGA3D_CONST_TYPE_BOOL\n"); + _debug_printf("\t\t.values[0] = %u\n", (*cmd).values[0]); + _debug_printf("\t\t.values[1] = %u\n", (*cmd).values[1]); + _debug_printf("\t\t.values[2] = %u\n", (*cmd).values[2]); + _debug_printf("\t\t.values[3] = %u\n", (*cmd).values[3]); break; default: - debug_printf("\t\t.ctype = %i\n", (*cmd).ctype); - debug_printf("\t\t.values[0] = %u\n", (*cmd).values[0]); - debug_printf("\t\t.values[1] = %u\n", (*cmd).values[1]); - debug_printf("\t\t.values[2] = %u\n", (*cmd).values[2]); - debug_printf("\t\t.values[3] = %u\n", (*cmd).values[3]); + _debug_printf("\t\t.ctype = %i\n", (*cmd).ctype); + _debug_printf("\t\t.values[0] = %u\n", (*cmd).values[0]); + _debug_printf("\t\t.values[1] = %u\n", (*cmd).values[1]); + _debug_printf("\t\t.values[2] = %u\n", (*cmd).values[2]); + _debug_printf("\t\t.values[3] = %u\n", (*cmd).values[3]); break; } } @@ -990,25 +990,25 @@ dump_SVGA3dCmdSetShaderConst(const SVGA3dCmdSetShaderConst *cmd) static void dump_SVGA3dCmdSetZRange(const SVGA3dCmdSetZRange *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); - debug_printf("\t\t.zRange.min = %f\n", (*cmd).zRange.min); - debug_printf("\t\t.zRange.max = %f\n", (*cmd).zRange.max); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.zRange.min = %f\n", (*cmd).zRange.min); + _debug_printf("\t\t.zRange.max = %f\n", (*cmd).zRange.max); } static void dump_SVGA3dCmdDrawPrimitives(const SVGA3dCmdDrawPrimitives *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); - debug_printf("\t\t.numVertexDecls = %u\n", (*cmd).numVertexDecls); - debug_printf("\t\t.numRanges = %u\n", (*cmd).numRanges); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.numVertexDecls = %u\n", (*cmd).numVertexDecls); + _debug_printf("\t\t.numRanges = %u\n", (*cmd).numRanges); } static void dump_SVGA3dCmdSetLightEnabled(const SVGA3dCmdSetLightEnabled *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); - debug_printf("\t\t.index = %u\n", (*cmd).index); - debug_printf("\t\t.enabled = %u\n", (*cmd).enabled); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.index = %u\n", (*cmd).index); + _debug_printf("\t\t.enabled = %u\n", (*cmd).enabled); } static void @@ -1016,86 +1016,86 @@ dump_SVGA3dPrimitiveRange(const SVGA3dPrimitiveRange *cmd) { switch((*cmd).primType) { case SVGA3D_PRIMITIVE_INVALID: - debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_INVALID\n"); + _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_INVALID\n"); break; case SVGA3D_PRIMITIVE_TRIANGLELIST: - debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLELIST\n"); + _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLELIST\n"); break; case SVGA3D_PRIMITIVE_POINTLIST: - debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_POINTLIST\n"); + _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_POINTLIST\n"); break; case SVGA3D_PRIMITIVE_LINELIST: - debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_LINELIST\n"); + _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_LINELIST\n"); break; case SVGA3D_PRIMITIVE_LINESTRIP: - debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_LINESTRIP\n"); + _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_LINESTRIP\n"); break; case SVGA3D_PRIMITIVE_TRIANGLESTRIP: - debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLESTRIP\n"); + _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLESTRIP\n"); break; case SVGA3D_PRIMITIVE_TRIANGLEFAN: - debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLEFAN\n"); + _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_TRIANGLEFAN\n"); break; case SVGA3D_PRIMITIVE_MAX: - debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_MAX\n"); + _debug_printf("\t\t.primType = SVGA3D_PRIMITIVE_MAX\n"); break; default: - debug_printf("\t\t.primType = %i\n", (*cmd).primType); + _debug_printf("\t\t.primType = %i\n", (*cmd).primType); break; } - debug_printf("\t\t.primitiveCount = %u\n", (*cmd).primitiveCount); - debug_printf("\t\t.indexArray.surfaceId = %u\n", (*cmd).indexArray.surfaceId); - debug_printf("\t\t.indexArray.offset = %u\n", (*cmd).indexArray.offset); - debug_printf("\t\t.indexArray.stride = %u\n", (*cmd).indexArray.stride); - debug_printf("\t\t.indexWidth = %u\n", (*cmd).indexWidth); - debug_printf("\t\t.indexBias = %i\n", (*cmd).indexBias); + _debug_printf("\t\t.primitiveCount = %u\n", (*cmd).primitiveCount); + _debug_printf("\t\t.indexArray.surfaceId = %u\n", (*cmd).indexArray.surfaceId); + _debug_printf("\t\t.indexArray.offset = %u\n", (*cmd).indexArray.offset); + _debug_printf("\t\t.indexArray.stride = %u\n", (*cmd).indexArray.stride); + _debug_printf("\t\t.indexWidth = %u\n", (*cmd).indexWidth); + _debug_printf("\t\t.indexBias = %i\n", (*cmd).indexBias); } static void dump_SVGA3dCmdPresent(const SVGA3dCmdPresent *cmd) { - debug_printf("\t\t.sid = %u\n", (*cmd).sid); + _debug_printf("\t\t.sid = %u\n", (*cmd).sid); } static void dump_SVGA3dCmdSetRenderState(const SVGA3dCmdSetRenderState *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); } static void dump_SVGA3dCmdSurfaceStretchBlt(const SVGA3dCmdSurfaceStretchBlt *cmd) { - debug_printf("\t\t.src.sid = %u\n", (*cmd).src.sid); - debug_printf("\t\t.src.face = %u\n", (*cmd).src.face); - debug_printf("\t\t.src.mipmap = %u\n", (*cmd).src.mipmap); - debug_printf("\t\t.dest.sid = %u\n", (*cmd).dest.sid); - debug_printf("\t\t.dest.face = %u\n", (*cmd).dest.face); - debug_printf("\t\t.dest.mipmap = %u\n", (*cmd).dest.mipmap); - debug_printf("\t\t.boxSrc.x = %u\n", (*cmd).boxSrc.x); - debug_printf("\t\t.boxSrc.y = %u\n", (*cmd).boxSrc.y); - debug_printf("\t\t.boxSrc.z = %u\n", (*cmd).boxSrc.z); - debug_printf("\t\t.boxSrc.w = %u\n", (*cmd).boxSrc.w); - debug_printf("\t\t.boxSrc.h = %u\n", (*cmd).boxSrc.h); - debug_printf("\t\t.boxSrc.d = %u\n", (*cmd).boxSrc.d); - debug_printf("\t\t.boxDest.x = %u\n", (*cmd).boxDest.x); - debug_printf("\t\t.boxDest.y = %u\n", (*cmd).boxDest.y); - debug_printf("\t\t.boxDest.z = %u\n", (*cmd).boxDest.z); - debug_printf("\t\t.boxDest.w = %u\n", (*cmd).boxDest.w); - debug_printf("\t\t.boxDest.h = %u\n", (*cmd).boxDest.h); - debug_printf("\t\t.boxDest.d = %u\n", (*cmd).boxDest.d); + _debug_printf("\t\t.src.sid = %u\n", (*cmd).src.sid); + _debug_printf("\t\t.src.face = %u\n", (*cmd).src.face); + _debug_printf("\t\t.src.mipmap = %u\n", (*cmd).src.mipmap); + _debug_printf("\t\t.dest.sid = %u\n", (*cmd).dest.sid); + _debug_printf("\t\t.dest.face = %u\n", (*cmd).dest.face); + _debug_printf("\t\t.dest.mipmap = %u\n", (*cmd).dest.mipmap); + _debug_printf("\t\t.boxSrc.x = %u\n", (*cmd).boxSrc.x); + _debug_printf("\t\t.boxSrc.y = %u\n", (*cmd).boxSrc.y); + _debug_printf("\t\t.boxSrc.z = %u\n", (*cmd).boxSrc.z); + _debug_printf("\t\t.boxSrc.w = %u\n", (*cmd).boxSrc.w); + _debug_printf("\t\t.boxSrc.h = %u\n", (*cmd).boxSrc.h); + _debug_printf("\t\t.boxSrc.d = %u\n", (*cmd).boxSrc.d); + _debug_printf("\t\t.boxDest.x = %u\n", (*cmd).boxDest.x); + _debug_printf("\t\t.boxDest.y = %u\n", (*cmd).boxDest.y); + _debug_printf("\t\t.boxDest.z = %u\n", (*cmd).boxDest.z); + _debug_printf("\t\t.boxDest.w = %u\n", (*cmd).boxDest.w); + _debug_printf("\t\t.boxDest.h = %u\n", (*cmd).boxDest.h); + _debug_printf("\t\t.boxDest.d = %u\n", (*cmd).boxDest.d); switch((*cmd).mode) { case SVGA3D_STRETCH_BLT_POINT: - debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_POINT\n"); + _debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_POINT\n"); break; case SVGA3D_STRETCH_BLT_LINEAR: - debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_LINEAR\n"); + _debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_LINEAR\n"); break; case SVGA3D_STRETCH_BLT_MAX: - debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_MAX\n"); + _debug_printf("\t\t.mode = SVGA3D_STRETCH_BLT_MAX\n"); break; default: - debug_printf("\t\t.mode = %i\n", (*cmd).mode); + _debug_printf("\t\t.mode = %i\n", (*cmd).mode); break; } } @@ -1103,21 +1103,21 @@ dump_SVGA3dCmdSurfaceStretchBlt(const SVGA3dCmdSurfaceStretchBlt *cmd) static void dump_SVGA3dCmdSurfaceDMA(const SVGA3dCmdSurfaceDMA *cmd) { - debug_printf("\t\t.guest.ptr.gmrId = %u\n", (*cmd).guest.ptr.gmrId); - debug_printf("\t\t.guest.ptr.offset = %u\n", (*cmd).guest.ptr.offset); - debug_printf("\t\t.guest.pitch = %u\n", (*cmd).guest.pitch); - debug_printf("\t\t.host.sid = %u\n", (*cmd).host.sid); - debug_printf("\t\t.host.face = %u\n", (*cmd).host.face); - debug_printf("\t\t.host.mipmap = %u\n", (*cmd).host.mipmap); + _debug_printf("\t\t.guest.ptr.gmrId = %u\n", (*cmd).guest.ptr.gmrId); + _debug_printf("\t\t.guest.ptr.offset = %u\n", (*cmd).guest.ptr.offset); + _debug_printf("\t\t.guest.pitch = %u\n", (*cmd).guest.pitch); + _debug_printf("\t\t.host.sid = %u\n", (*cmd).host.sid); + _debug_printf("\t\t.host.face = %u\n", (*cmd).host.face); + _debug_printf("\t\t.host.mipmap = %u\n", (*cmd).host.mipmap); switch((*cmd).transfer) { case SVGA3D_WRITE_HOST_VRAM: - debug_printf("\t\t.transfer = SVGA3D_WRITE_HOST_VRAM\n"); + _debug_printf("\t\t.transfer = SVGA3D_WRITE_HOST_VRAM\n"); break; case SVGA3D_READ_HOST_VRAM: - debug_printf("\t\t.transfer = SVGA3D_READ_HOST_VRAM\n"); + _debug_printf("\t\t.transfer = SVGA3D_READ_HOST_VRAM\n"); break; default: - debug_printf("\t\t.transfer = %i\n", (*cmd).transfer); + _debug_printf("\t\t.transfer = %i\n", (*cmd).transfer); break; } } @@ -1125,107 +1125,107 @@ dump_SVGA3dCmdSurfaceDMA(const SVGA3dCmdSurfaceDMA *cmd) static void dump_SVGA3dCmdSurfaceDMASuffix(const SVGA3dCmdSurfaceDMASuffix *cmd) { - debug_printf("\t\t.suffixSize = %u\n", (*cmd).suffixSize); - debug_printf("\t\t.maximumOffset = %u\n", (*cmd).maximumOffset); - debug_printf("\t\t.flags.discard = %u\n", (*cmd).flags.discard); - debug_printf("\t\t.flags.unsynchronized = %u\n", (*cmd).flags.unsynchronized); + _debug_printf("\t\t.suffixSize = %u\n", (*cmd).suffixSize); + _debug_printf("\t\t.maximumOffset = %u\n", (*cmd).maximumOffset); + _debug_printf("\t\t.flags.discard = %u\n", (*cmd).flags.discard); + _debug_printf("\t\t.flags.unsynchronized = %u\n", (*cmd).flags.unsynchronized); } static void dump_SVGA3dCmdSetTransform(const SVGA3dCmdSetTransform *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); switch((*cmd).type) { case SVGA3D_TRANSFORM_INVALID: - debug_printf("\t\t.type = SVGA3D_TRANSFORM_INVALID\n"); + _debug_printf("\t\t.type = SVGA3D_TRANSFORM_INVALID\n"); break; case SVGA3D_TRANSFORM_WORLD: - debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD\n"); + _debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD\n"); break; case SVGA3D_TRANSFORM_VIEW: - debug_printf("\t\t.type = SVGA3D_TRANSFORM_VIEW\n"); + _debug_printf("\t\t.type = SVGA3D_TRANSFORM_VIEW\n"); break; case SVGA3D_TRANSFORM_PROJECTION: - debug_printf("\t\t.type = SVGA3D_TRANSFORM_PROJECTION\n"); + _debug_printf("\t\t.type = SVGA3D_TRANSFORM_PROJECTION\n"); break; case SVGA3D_TRANSFORM_TEXTURE0: - debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE0\n"); + _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE0\n"); break; case SVGA3D_TRANSFORM_TEXTURE1: - debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE1\n"); + _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE1\n"); break; case SVGA3D_TRANSFORM_TEXTURE2: - debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE2\n"); + _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE2\n"); break; case SVGA3D_TRANSFORM_TEXTURE3: - debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE3\n"); + _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE3\n"); break; case SVGA3D_TRANSFORM_TEXTURE4: - debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE4\n"); + _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE4\n"); break; case SVGA3D_TRANSFORM_TEXTURE5: - debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE5\n"); + _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE5\n"); break; case SVGA3D_TRANSFORM_TEXTURE6: - debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE6\n"); + _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE6\n"); break; case SVGA3D_TRANSFORM_TEXTURE7: - debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE7\n"); + _debug_printf("\t\t.type = SVGA3D_TRANSFORM_TEXTURE7\n"); break; case SVGA3D_TRANSFORM_WORLD1: - debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD1\n"); + _debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD1\n"); break; case SVGA3D_TRANSFORM_WORLD2: - debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD2\n"); + _debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD2\n"); break; case SVGA3D_TRANSFORM_WORLD3: - debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD3\n"); + _debug_printf("\t\t.type = SVGA3D_TRANSFORM_WORLD3\n"); break; case SVGA3D_TRANSFORM_MAX: - debug_printf("\t\t.type = SVGA3D_TRANSFORM_MAX\n"); + _debug_printf("\t\t.type = SVGA3D_TRANSFORM_MAX\n"); break; default: - debug_printf("\t\t.type = %i\n", (*cmd).type); + _debug_printf("\t\t.type = %i\n", (*cmd).type); break; } - debug_printf("\t\t.matrix[0] = %f\n", (*cmd).matrix[0]); - debug_printf("\t\t.matrix[1] = %f\n", (*cmd).matrix[1]); - debug_printf("\t\t.matrix[2] = %f\n", (*cmd).matrix[2]); - debug_printf("\t\t.matrix[3] = %f\n", (*cmd).matrix[3]); - debug_printf("\t\t.matrix[4] = %f\n", (*cmd).matrix[4]); - debug_printf("\t\t.matrix[5] = %f\n", (*cmd).matrix[5]); - debug_printf("\t\t.matrix[6] = %f\n", (*cmd).matrix[6]); - debug_printf("\t\t.matrix[7] = %f\n", (*cmd).matrix[7]); - debug_printf("\t\t.matrix[8] = %f\n", (*cmd).matrix[8]); - debug_printf("\t\t.matrix[9] = %f\n", (*cmd).matrix[9]); - debug_printf("\t\t.matrix[10] = %f\n", (*cmd).matrix[10]); - debug_printf("\t\t.matrix[11] = %f\n", (*cmd).matrix[11]); - debug_printf("\t\t.matrix[12] = %f\n", (*cmd).matrix[12]); - debug_printf("\t\t.matrix[13] = %f\n", (*cmd).matrix[13]); - debug_printf("\t\t.matrix[14] = %f\n", (*cmd).matrix[14]); - debug_printf("\t\t.matrix[15] = %f\n", (*cmd).matrix[15]); + _debug_printf("\t\t.matrix[0] = %f\n", (*cmd).matrix[0]); + _debug_printf("\t\t.matrix[1] = %f\n", (*cmd).matrix[1]); + _debug_printf("\t\t.matrix[2] = %f\n", (*cmd).matrix[2]); + _debug_printf("\t\t.matrix[3] = %f\n", (*cmd).matrix[3]); + _debug_printf("\t\t.matrix[4] = %f\n", (*cmd).matrix[4]); + _debug_printf("\t\t.matrix[5] = %f\n", (*cmd).matrix[5]); + _debug_printf("\t\t.matrix[6] = %f\n", (*cmd).matrix[6]); + _debug_printf("\t\t.matrix[7] = %f\n", (*cmd).matrix[7]); + _debug_printf("\t\t.matrix[8] = %f\n", (*cmd).matrix[8]); + _debug_printf("\t\t.matrix[9] = %f\n", (*cmd).matrix[9]); + _debug_printf("\t\t.matrix[10] = %f\n", (*cmd).matrix[10]); + _debug_printf("\t\t.matrix[11] = %f\n", (*cmd).matrix[11]); + _debug_printf("\t\t.matrix[12] = %f\n", (*cmd).matrix[12]); + _debug_printf("\t\t.matrix[13] = %f\n", (*cmd).matrix[13]); + _debug_printf("\t\t.matrix[14] = %f\n", (*cmd).matrix[14]); + _debug_printf("\t\t.matrix[15] = %f\n", (*cmd).matrix[15]); } static void dump_SVGA3dCmdDestroyShader(const SVGA3dCmdDestroyShader *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); - debug_printf("\t\t.shid = %u\n", (*cmd).shid); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.shid = %u\n", (*cmd).shid); switch((*cmd).type) { case SVGA3D_SHADERTYPE_COMPILED_DX8: - debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n"); + _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_COMPILED_DX8\n"); break; case SVGA3D_SHADERTYPE_VS: - debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n"); + _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_VS\n"); break; case SVGA3D_SHADERTYPE_PS: - debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n"); + _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_PS\n"); break; case SVGA3D_SHADERTYPE_MAX: - debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n"); + _debug_printf("\t\t.type = SVGA3D_SHADERTYPE_MAX\n"); break; default: - debug_printf("\t\t.type = %i\n", (*cmd).type); + _debug_printf("\t\t.type = %i\n", (*cmd).type); break; } } @@ -1233,187 +1233,187 @@ dump_SVGA3dCmdDestroyShader(const SVGA3dCmdDestroyShader *cmd) static void dump_SVGA3dCmdDestroyContext(const SVGA3dCmdDestroyContext *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); } static void dump_SVGA3dCmdClear(const SVGA3dCmdClear *cmd) { - debug_printf("\t\t.cid = %u\n", (*cmd).cid); + _debug_printf("\t\t.cid = %u\n", (*cmd).cid); switch((*cmd).clearFlag) { case SVGA3D_CLEAR_COLOR: - debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_COLOR\n"); + _debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_COLOR\n"); break; case SVGA3D_CLEAR_DEPTH: - debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_DEPTH\n"); + _debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_DEPTH\n"); break; case SVGA3D_CLEAR_STENCIL: - debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_STENCIL\n"); + _debug_printf("\t\t.clearFlag = SVGA3D_CLEAR_STENCIL\n"); break; default: - debug_printf("\t\t.clearFlag = %i\n", (*cmd).clearFlag); + _debug_printf("\t\t.clearFlag = %i\n", (*cmd).clearFlag); break; } - debug_printf("\t\t.color = %u\n", (*cmd).color); - debug_printf("\t\t.depth = %f\n", (*cmd).depth); - debug_printf("\t\t.stencil = %u\n", (*cmd).stencil); + _debug_printf("\t\t.color = %u\n", (*cmd).color); + _debug_printf("\t\t.depth = %f\n", (*cmd).depth); + _debug_printf("\t\t.stencil = %u\n", (*cmd).stencil); } static void dump_SVGA3dCmdDefineSurface(const SVGA3dCmdDefineSurface *cmd) { - debug_printf("\t\t.sid = %u\n", (*cmd).sid); + _debug_printf("\t\t.sid = %u\n", (*cmd).sid); switch((*cmd).surfaceFlags) { case SVGA3D_SURFACE_CUBEMAP: - debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_CUBEMAP\n"); + _debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_CUBEMAP\n"); break; case SVGA3D_SURFACE_HINT_STATIC: - debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_STATIC\n"); + _debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_STATIC\n"); break; case SVGA3D_SURFACE_HINT_DYNAMIC: - debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_DYNAMIC\n"); + _debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_DYNAMIC\n"); break; case SVGA3D_SURFACE_HINT_INDEXBUFFER: - debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_INDEXBUFFER\n"); + _debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_INDEXBUFFER\n"); break; case SVGA3D_SURFACE_HINT_VERTEXBUFFER: - debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_VERTEXBUFFER\n"); + _debug_printf("\t\t.surfaceFlags = SVGA3D_SURFACE_HINT_VERTEXBUFFER\n"); break; default: - debug_printf("\t\t.surfaceFlags = %i\n", (*cmd).surfaceFlags); + _debug_printf("\t\t.surfaceFlags = %i\n", (*cmd).surfaceFlags); break; } switch((*cmd).format) { case SVGA3D_FORMAT_INVALID: - debug_printf("\t\t.format = SVGA3D_FORMAT_INVALID\n"); + _debug_printf("\t\t.format = SVGA3D_FORMAT_INVALID\n"); break; case SVGA3D_X8R8G8B8: - debug_printf("\t\t.format = SVGA3D_X8R8G8B8\n"); + _debug_printf("\t\t.format = SVGA3D_X8R8G8B8\n"); break; case SVGA3D_A8R8G8B8: - debug_printf("\t\t.format = SVGA3D_A8R8G8B8\n"); + _debug_printf("\t\t.format = SVGA3D_A8R8G8B8\n"); break; case SVGA3D_R5G6B5: - debug_printf("\t\t.format = SVGA3D_R5G6B5\n"); + _debug_printf("\t\t.format = SVGA3D_R5G6B5\n"); break; case SVGA3D_X1R5G5B5: - debug_printf("\t\t.format = SVGA3D_X1R5G5B5\n"); + _debug_printf("\t\t.format = SVGA3D_X1R5G5B5\n"); break; case SVGA3D_A1R5G5B5: - debug_printf("\t\t.format = SVGA3D_A1R5G5B5\n"); + _debug_printf("\t\t.format = SVGA3D_A1R5G5B5\n"); break; case SVGA3D_A4R4G4B4: - debug_printf("\t\t.format = SVGA3D_A4R4G4B4\n"); + _debug_printf("\t\t.format = SVGA3D_A4R4G4B4\n"); break; case SVGA3D_Z_D32: - debug_printf("\t\t.format = SVGA3D_Z_D32\n"); + _debug_printf("\t\t.format = SVGA3D_Z_D32\n"); break; case SVGA3D_Z_D16: - debug_printf("\t\t.format = SVGA3D_Z_D16\n"); + _debug_printf("\t\t.format = SVGA3D_Z_D16\n"); break; case SVGA3D_Z_D24S8: - debug_printf("\t\t.format = SVGA3D_Z_D24S8\n"); + _debug_printf("\t\t.format = SVGA3D_Z_D24S8\n"); break; case SVGA3D_Z_D15S1: - debug_printf("\t\t.format = SVGA3D_Z_D15S1\n"); + _debug_printf("\t\t.format = SVGA3D_Z_D15S1\n"); break; case SVGA3D_LUMINANCE8: - debug_printf("\t\t.format = SVGA3D_LUMINANCE8\n"); + _debug_printf("\t\t.format = SVGA3D_LUMINANCE8\n"); break; case SVGA3D_LUMINANCE4_ALPHA4: - debug_printf("\t\t.format = SVGA3D_LUMINANCE4_ALPHA4\n"); + _debug_printf("\t\t.format = SVGA3D_LUMINANCE4_ALPHA4\n"); break; case SVGA3D_LUMINANCE16: - debug_printf("\t\t.format = SVGA3D_LUMINANCE16\n"); + _debug_printf("\t\t.format = SVGA3D_LUMINANCE16\n"); break; case SVGA3D_LUMINANCE8_ALPHA8: - debug_printf("\t\t.format = SVGA3D_LUMINANCE8_ALPHA8\n"); + _debug_printf("\t\t.format = SVGA3D_LUMINANCE8_ALPHA8\n"); break; case SVGA3D_DXT1: - debug_printf("\t\t.format = SVGA3D_DXT1\n"); + _debug_printf("\t\t.format = SVGA3D_DXT1\n"); break; case SVGA3D_DXT2: - debug_printf("\t\t.format = SVGA3D_DXT2\n"); + _debug_printf("\t\t.format = SVGA3D_DXT2\n"); break; case SVGA3D_DXT3: - debug_printf("\t\t.format = SVGA3D_DXT3\n"); + _debug_printf("\t\t.format = SVGA3D_DXT3\n"); break; case SVGA3D_DXT4: - debug_printf("\t\t.format = SVGA3D_DXT4\n"); + _debug_printf("\t\t.format = SVGA3D_DXT4\n"); break; case SVGA3D_DXT5: - debug_printf("\t\t.format = SVGA3D_DXT5\n"); + _debug_printf("\t\t.format = SVGA3D_DXT5\n"); break; case SVGA3D_BUMPU8V8: - debug_printf("\t\t.format = SVGA3D_BUMPU8V8\n"); + _debug_printf("\t\t.format = SVGA3D_BUMPU8V8\n"); break; case SVGA3D_BUMPL6V5U5: - debug_printf("\t\t.format = SVGA3D_BUMPL6V5U5\n"); + _debug_printf("\t\t.format = SVGA3D_BUMPL6V5U5\n"); break; case SVGA3D_BUMPX8L8V8U8: - debug_printf("\t\t.format = SVGA3D_BUMPX8L8V8U8\n"); + _debug_printf("\t\t.format = SVGA3D_BUMPX8L8V8U8\n"); break; case SVGA3D_BUMPL8V8U8: - debug_printf("\t\t.format = SVGA3D_BUMPL8V8U8\n"); + _debug_printf("\t\t.format = SVGA3D_BUMPL8V8U8\n"); break; case SVGA3D_ARGB_S10E5: - debug_printf("\t\t.format = SVGA3D_ARGB_S10E5\n"); + _debug_printf("\t\t.format = SVGA3D_ARGB_S10E5\n"); break; case SVGA3D_ARGB_S23E8: - debug_printf("\t\t.format = SVGA3D_ARGB_S23E8\n"); + _debug_printf("\t\t.format = SVGA3D_ARGB_S23E8\n"); break; case SVGA3D_A2R10G10B10: - debug_printf("\t\t.format = SVGA3D_A2R10G10B10\n"); + _debug_printf("\t\t.format = SVGA3D_A2R10G10B10\n"); break; case SVGA3D_V8U8: - debug_printf("\t\t.format = SVGA3D_V8U8\n"); + _debug_printf("\t\t.format = SVGA3D_V8U8\n"); break; case SVGA3D_Q8W8V8U8: - debug_printf("\t\t.format = SVGA3D_Q8W8V8U8\n"); + _debug_printf("\t\t.format = SVGA3D_Q8W8V8U8\n"); break; case SVGA3D_CxV8U8: - debug_printf("\t\t.format = SVGA3D_CxV8U8\n"); + _debug_printf("\t\t.format = SVGA3D_CxV8U8\n"); break; case SVGA3D_X8L8V8U8: - debug_printf("\t\t.format = SVGA3D_X8L8V8U8\n"); + _debug_printf("\t\t.format = SVGA3D_X8L8V8U8\n"); break; case SVGA3D_A2W10V10U10: - debug_printf("\t\t.format = SVGA3D_A2W10V10U10\n"); + _debug_printf("\t\t.format = SVGA3D_A2W10V10U10\n"); break; case SVGA3D_ALPHA8: - debug_printf("\t\t.format = SVGA3D_ALPHA8\n"); + _debug_printf("\t\t.format = SVGA3D_ALPHA8\n"); break; case SVGA3D_R_S10E5: - debug_printf("\t\t.format = SVGA3D_R_S10E5\n"); + _debug_printf("\t\t.format = SVGA3D_R_S10E5\n"); break; case SVGA3D_R_S23E8: - debug_printf("\t\t.format = SVGA3D_R_S23E8\n"); + _debug_printf("\t\t.format = SVGA3D_R_S23E8\n"); break; case SVGA3D_RG_S10E5: - debug_printf("\t\t.format = SVGA3D_RG_S10E5\n"); + _debug_printf("\t\t.format = SVGA3D_RG_S10E5\n"); break; case SVGA3D_RG_S23E8: - debug_printf("\t\t.format = SVGA3D_RG_S23E8\n"); + _debug_printf("\t\t.format = SVGA3D_RG_S23E8\n"); break; case SVGA3D_BUFFER: - debug_printf("\t\t.format = SVGA3D_BUFFER\n"); + _debug_printf("\t\t.format = SVGA3D_BUFFER\n"); break; case SVGA3D_Z_D24X8: - debug_printf("\t\t.format = SVGA3D_Z_D24X8\n"); + _debug_printf("\t\t.format = SVGA3D_Z_D24X8\n"); break; case SVGA3D_FORMAT_MAX: - debug_printf("\t\t.format = SVGA3D_FORMAT_MAX\n"); + _debug_printf("\t\t.format = SVGA3D_FORMAT_MAX\n"); break; default: - debug_printf("\t\t.format = %i\n", (*cmd).format); + _debug_printf("\t\t.format = %i\n", (*cmd).format); break; } - debug_printf("\t\t.face[0].numMipLevels = %u\n", (*cmd).face[0].numMipLevels); - debug_printf("\t\t.face[1].numMipLevels = %u\n", (*cmd).face[1].numMipLevels); - debug_printf("\t\t.face[2].numMipLevels = %u\n", (*cmd).face[2].numMipLevels); - debug_printf("\t\t.face[3].numMipLevels = %u\n", (*cmd).face[3].numMipLevels); - debug_printf("\t\t.face[4].numMipLevels = %u\n", (*cmd).face[4].numMipLevels); - debug_printf("\t\t.face[5].numMipLevels = %u\n", (*cmd).face[5].numMipLevels); + _debug_printf("\t\t.face[0].numMipLevels = %u\n", (*cmd).face[0].numMipLevels); + _debug_printf("\t\t.face[1].numMipLevels = %u\n", (*cmd).face[1].numMipLevels); + _debug_printf("\t\t.face[2].numMipLevels = %u\n", (*cmd).face[2].numMipLevels); + _debug_printf("\t\t.face[3].numMipLevels = %u\n", (*cmd).face[3].numMipLevels); + _debug_printf("\t\t.face[4].numMipLevels = %u\n", (*cmd).face[4].numMipLevels); + _debug_printf("\t\t.face[5].numMipLevels = %u\n", (*cmd).face[5].numMipLevels); } @@ -1438,7 +1438,7 @@ svga_dump_commands(const void *commands, uint32_t size) switch(cmd_id) { case SVGA_3D_CMD_SURFACE_DEFINE: - debug_printf("\tSVGA_3D_CMD_SURFACE_DEFINE\n"); + _debug_printf("\tSVGA_3D_CMD_SURFACE_DEFINE\n"); { const SVGA3dCmdDefineSurface *cmd = (const SVGA3dCmdDefineSurface *)body; dump_SVGA3dCmdDefineSurface(cmd); @@ -1450,7 +1450,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_SURFACE_DESTROY: - debug_printf("\tSVGA_3D_CMD_SURFACE_DESTROY\n"); + _debug_printf("\tSVGA_3D_CMD_SURFACE_DESTROY\n"); { const SVGA3dCmdDestroySurface *cmd = (const SVGA3dCmdDestroySurface *)body; dump_SVGA3dCmdDestroySurface(cmd); @@ -1458,7 +1458,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_SURFACE_COPY: - debug_printf("\tSVGA_3D_CMD_SURFACE_COPY\n"); + _debug_printf("\tSVGA_3D_CMD_SURFACE_COPY\n"); { const SVGA3dCmdSurfaceCopy *cmd = (const SVGA3dCmdSurfaceCopy *)body; dump_SVGA3dCmdSurfaceCopy(cmd); @@ -1470,7 +1470,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_SURFACE_STRETCHBLT: - debug_printf("\tSVGA_3D_CMD_SURFACE_STRETCHBLT\n"); + _debug_printf("\tSVGA_3D_CMD_SURFACE_STRETCHBLT\n"); { const SVGA3dCmdSurfaceStretchBlt *cmd = (const SVGA3dCmdSurfaceStretchBlt *)body; dump_SVGA3dCmdSurfaceStretchBlt(cmd); @@ -1478,7 +1478,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_SURFACE_DMA: - debug_printf("\tSVGA_3D_CMD_SURFACE_DMA\n"); + _debug_printf("\tSVGA_3D_CMD_SURFACE_DMA\n"); { const SVGA3dCmdSurfaceDMA *cmd = (const SVGA3dCmdSurfaceDMA *)body; dump_SVGA3dCmdSurfaceDMA(cmd); @@ -1494,7 +1494,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_CONTEXT_DEFINE: - debug_printf("\tSVGA_3D_CMD_CONTEXT_DEFINE\n"); + _debug_printf("\tSVGA_3D_CMD_CONTEXT_DEFINE\n"); { const SVGA3dCmdDefineContext *cmd = (const SVGA3dCmdDefineContext *)body; dump_SVGA3dCmdDefineContext(cmd); @@ -1502,7 +1502,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_CONTEXT_DESTROY: - debug_printf("\tSVGA_3D_CMD_CONTEXT_DESTROY\n"); + _debug_printf("\tSVGA_3D_CMD_CONTEXT_DESTROY\n"); { const SVGA3dCmdDestroyContext *cmd = (const SVGA3dCmdDestroyContext *)body; dump_SVGA3dCmdDestroyContext(cmd); @@ -1510,7 +1510,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_SETTRANSFORM: - debug_printf("\tSVGA_3D_CMD_SETTRANSFORM\n"); + _debug_printf("\tSVGA_3D_CMD_SETTRANSFORM\n"); { const SVGA3dCmdSetTransform *cmd = (const SVGA3dCmdSetTransform *)body; dump_SVGA3dCmdSetTransform(cmd); @@ -1518,7 +1518,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_SETZRANGE: - debug_printf("\tSVGA_3D_CMD_SETZRANGE\n"); + _debug_printf("\tSVGA_3D_CMD_SETZRANGE\n"); { const SVGA3dCmdSetZRange *cmd = (const SVGA3dCmdSetZRange *)body; dump_SVGA3dCmdSetZRange(cmd); @@ -1526,7 +1526,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_SETRENDERSTATE: - debug_printf("\tSVGA_3D_CMD_SETRENDERSTATE\n"); + _debug_printf("\tSVGA_3D_CMD_SETRENDERSTATE\n"); { const SVGA3dCmdSetRenderState *cmd = (const SVGA3dCmdSetRenderState *)body; dump_SVGA3dCmdSetRenderState(cmd); @@ -1538,7 +1538,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_SETRENDERTARGET: - debug_printf("\tSVGA_3D_CMD_SETRENDERTARGET\n"); + _debug_printf("\tSVGA_3D_CMD_SETRENDERTARGET\n"); { const SVGA3dCmdSetRenderTarget *cmd = (const SVGA3dCmdSetRenderTarget *)body; dump_SVGA3dCmdSetRenderTarget(cmd); @@ -1546,7 +1546,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_SETTEXTURESTATE: - debug_printf("\tSVGA_3D_CMD_SETTEXTURESTATE\n"); + _debug_printf("\tSVGA_3D_CMD_SETTEXTURESTATE\n"); { const SVGA3dCmdSetTextureState *cmd = (const SVGA3dCmdSetTextureState *)body; dump_SVGA3dCmdSetTextureState(cmd); @@ -1558,7 +1558,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_SETMATERIAL: - debug_printf("\tSVGA_3D_CMD_SETMATERIAL\n"); + _debug_printf("\tSVGA_3D_CMD_SETMATERIAL\n"); { const SVGA3dCmdSetMaterial *cmd = (const SVGA3dCmdSetMaterial *)body; dump_SVGA3dCmdSetMaterial(cmd); @@ -1566,7 +1566,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_SETLIGHTDATA: - debug_printf("\tSVGA_3D_CMD_SETLIGHTDATA\n"); + _debug_printf("\tSVGA_3D_CMD_SETLIGHTDATA\n"); { const SVGA3dCmdSetLightData *cmd = (const SVGA3dCmdSetLightData *)body; dump_SVGA3dCmdSetLightData(cmd); @@ -1574,7 +1574,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_SETLIGHTENABLED: - debug_printf("\tSVGA_3D_CMD_SETLIGHTENABLED\n"); + _debug_printf("\tSVGA_3D_CMD_SETLIGHTENABLED\n"); { const SVGA3dCmdSetLightEnabled *cmd = (const SVGA3dCmdSetLightEnabled *)body; dump_SVGA3dCmdSetLightEnabled(cmd); @@ -1582,7 +1582,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_SETVIEWPORT: - debug_printf("\tSVGA_3D_CMD_SETVIEWPORT\n"); + _debug_printf("\tSVGA_3D_CMD_SETVIEWPORT\n"); { const SVGA3dCmdSetViewport *cmd = (const SVGA3dCmdSetViewport *)body; dump_SVGA3dCmdSetViewport(cmd); @@ -1590,7 +1590,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_SETCLIPPLANE: - debug_printf("\tSVGA_3D_CMD_SETCLIPPLANE\n"); + _debug_printf("\tSVGA_3D_CMD_SETCLIPPLANE\n"); { const SVGA3dCmdSetClipPlane *cmd = (const SVGA3dCmdSetClipPlane *)body; dump_SVGA3dCmdSetClipPlane(cmd); @@ -1598,7 +1598,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_CLEAR: - debug_printf("\tSVGA_3D_CMD_CLEAR\n"); + _debug_printf("\tSVGA_3D_CMD_CLEAR\n"); { const SVGA3dCmdClear *cmd = (const SVGA3dCmdClear *)body; dump_SVGA3dCmdClear(cmd); @@ -1610,7 +1610,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_PRESENT: - debug_printf("\tSVGA_3D_CMD_PRESENT\n"); + _debug_printf("\tSVGA_3D_CMD_PRESENT\n"); { const SVGA3dCmdPresent *cmd = (const SVGA3dCmdPresent *)body; dump_SVGA3dCmdPresent(cmd); @@ -1622,7 +1622,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_SHADER_DEFINE: - debug_printf("\tSVGA_3D_CMD_SHADER_DEFINE\n"); + _debug_printf("\tSVGA_3D_CMD_SHADER_DEFINE\n"); { const SVGA3dCmdDefineShader *cmd = (const SVGA3dCmdDefineShader *)body; dump_SVGA3dCmdDefineShader(cmd); @@ -1634,7 +1634,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_SHADER_DESTROY: - debug_printf("\tSVGA_3D_CMD_SHADER_DESTROY\n"); + _debug_printf("\tSVGA_3D_CMD_SHADER_DESTROY\n"); { const SVGA3dCmdDestroyShader *cmd = (const SVGA3dCmdDestroyShader *)body; dump_SVGA3dCmdDestroyShader(cmd); @@ -1642,7 +1642,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_SET_SHADER: - debug_printf("\tSVGA_3D_CMD_SET_SHADER\n"); + _debug_printf("\tSVGA_3D_CMD_SET_SHADER\n"); { const SVGA3dCmdSetShader *cmd = (const SVGA3dCmdSetShader *)body; dump_SVGA3dCmdSetShader(cmd); @@ -1650,7 +1650,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_SET_SHADER_CONST: - debug_printf("\tSVGA_3D_CMD_SET_SHADER_CONST\n"); + _debug_printf("\tSVGA_3D_CMD_SET_SHADER_CONST\n"); { const SVGA3dCmdSetShaderConst *cmd = (const SVGA3dCmdSetShaderConst *)body; dump_SVGA3dCmdSetShaderConst(cmd); @@ -1658,7 +1658,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_DRAW_PRIMITIVES: - debug_printf("\tSVGA_3D_CMD_DRAW_PRIMITIVES\n"); + _debug_printf("\tSVGA_3D_CMD_DRAW_PRIMITIVES\n"); { const SVGA3dCmdDrawPrimitives *cmd = (const SVGA3dCmdDrawPrimitives *)body; unsigned i, j; @@ -1679,7 +1679,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_SETSCISSORRECT: - debug_printf("\tSVGA_3D_CMD_SETSCISSORRECT\n"); + _debug_printf("\tSVGA_3D_CMD_SETSCISSORRECT\n"); { const SVGA3dCmdSetScissorRect *cmd = (const SVGA3dCmdSetScissorRect *)body; dump_SVGA3dCmdSetScissorRect(cmd); @@ -1687,7 +1687,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_BEGIN_QUERY: - debug_printf("\tSVGA_3D_CMD_BEGIN_QUERY\n"); + _debug_printf("\tSVGA_3D_CMD_BEGIN_QUERY\n"); { const SVGA3dCmdBeginQuery *cmd = (const SVGA3dCmdBeginQuery *)body; dump_SVGA3dCmdBeginQuery(cmd); @@ -1695,7 +1695,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_END_QUERY: - debug_printf("\tSVGA_3D_CMD_END_QUERY\n"); + _debug_printf("\tSVGA_3D_CMD_END_QUERY\n"); { const SVGA3dCmdEndQuery *cmd = (const SVGA3dCmdEndQuery *)body; dump_SVGA3dCmdEndQuery(cmd); @@ -1703,7 +1703,7 @@ svga_dump_commands(const void *commands, uint32_t size) } break; case SVGA_3D_CMD_WAIT_FOR_QUERY: - debug_printf("\tSVGA_3D_CMD_WAIT_FOR_QUERY\n"); + _debug_printf("\tSVGA_3D_CMD_WAIT_FOR_QUERY\n"); { const SVGA3dCmdWaitForQuery *cmd = (const SVGA3dCmdWaitForQuery *)body; dump_SVGA3dCmdWaitForQuery(cmd); @@ -1711,24 +1711,24 @@ svga_dump_commands(const void *commands, uint32_t size) } break; default: - debug_printf("\t0x%08x\n", cmd_id); + _debug_printf("\t0x%08x\n", cmd_id); break; } while(body + sizeof(uint32_t) <= next) { - debug_printf("\t\t0x%08x\n", *(const uint32_t *)body); + _debug_printf("\t\t0x%08x\n", *(const uint32_t *)body); body += sizeof(uint32_t); } while(body + sizeof(uint32_t) <= next) - debug_printf("\t\t0x%02x\n", *body++); + _debug_printf("\t\t0x%02x\n", *body++); } else if(cmd_id == SVGA_CMD_FENCE) { - debug_printf("\tSVGA_CMD_FENCE\n"); - debug_printf("\t\t0x%08x\n", ((const uint32_t *)next)[1]); + _debug_printf("\tSVGA_CMD_FENCE\n"); + _debug_printf("\t\t0x%08x\n", ((const uint32_t *)next)[1]); next += 2*sizeof(uint32_t); } else { - debug_printf("\t0x%08x\n", cmd_id); + _debug_printf("\t0x%08x\n", cmd_id); next += sizeof(uint32_t); } } diff --git a/src/gallium/drivers/svga/svgadump/svga_dump.py b/src/gallium/drivers/svga/svgadump/svga_dump.py index 288e753296..dc5f3267e2 100755 --- a/src/gallium/drivers/svga/svgadump/svga_dump.py +++ b/src/gallium/drivers/svga/svgadump/svga_dump.py @@ -71,14 +71,14 @@ class decl_dumper_t(decl_visitor.decl_visitor_t): print ' switch(%s) {' % ("(*cmd)" + self._instance,) for name, value in self.decl.values: print ' case %s:' % (name,) - print ' debug_printf("\\t\\t%s = %s\\n");' % (self._instance, name) + print ' _debug_printf("\\t\\t%s = %s\\n");' % (self._instance, name) print ' break;' print ' default:' - print ' debug_printf("\\t\\t%s = %%i\\n", %s);' % (self._instance, "(*cmd)" + self._instance) + print ' _debug_printf("\\t\\t%s = %%i\\n", %s);' % (self._instance, "(*cmd)" + self._instance) print ' break;' print ' }' else: - print ' debug_printf("\\t\\t%s = %%i\\n", %s);' % (self._instance, "(*cmd)" + self._instance) + print ' _debug_printf("\\t\\t%s = %%i\\n", %s);' % (self._instance, "(*cmd)" + self._instance) def dump_decl(instance, decl): @@ -154,7 +154,7 @@ class type_dumper_t(type_visitor.type_visitor_t): dump_decl(self.instance, decl) def print_instance(self, format): - print ' debug_printf("\\t\\t%s = %s\\n", %s);' % (self.instance, format, "(*cmd)" + self.instance) + print ' _debug_printf("\\t\\t%s = %s\\n", %s);' % (self.instance, format, "(*cmd)" + self.instance) def dump_type(instance, type_): @@ -230,7 +230,7 @@ svga_dump_commands(const void *commands, uint32_t size) indexes = 'ijklmn' for id, header, body, footer in cmds: print ' case %s:' % id - print ' debug_printf("\\t%s\\n");' % id + print ' _debug_printf("\\t%s\\n");' % id print ' {' print ' const %s *cmd = (const %s *)body;' % (header, header) if len(body): @@ -255,25 +255,25 @@ svga_dump_commands(const void *commands, uint32_t size) print ' }' print ' break;' print ' default:' - print ' debug_printf("\\t0x%08x\\n", cmd_id);' + print ' _debug_printf("\\t0x%08x\\n", cmd_id);' print ' break;' print ' }' print r''' while(body + sizeof(uint32_t) <= next) { - debug_printf("\t\t0x%08x\n", *(const uint32_t *)body); + _debug_printf("\t\t0x%08x\n", *(const uint32_t *)body); body += sizeof(uint32_t); } while(body + sizeof(uint32_t) <= next) - debug_printf("\t\t0x%02x\n", *body++); + _debug_printf("\t\t0x%02x\n", *body++); } else if(cmd_id == SVGA_CMD_FENCE) { - debug_printf("\tSVGA_CMD_FENCE\n"); - debug_printf("\t\t0x%08x\n", ((const uint32_t *)next)[1]); + _debug_printf("\tSVGA_CMD_FENCE\n"); + _debug_printf("\t\t0x%08x\n", ((const uint32_t *)next)[1]); next += 2*sizeof(uint32_t); } else { - debug_printf("\t0x%08x\n", cmd_id); + _debug_printf("\t0x%08x\n", cmd_id); next += sizeof(uint32_t); } } diff --git a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c index b0e7fdf378..70e27d86d3 100644 --- a/src/gallium/drivers/svga/svgadump/svga_shader_dump.c +++ b/src/gallium/drivers/svga/svgadump/svga_shader_dump.c @@ -50,16 +50,16 @@ static void dump_op( struct sh_op op, const char *mnemonic ) assert( op.is_reg == 0 ); if (op.coissue) - debug_printf( "+" ); - debug_printf( "%s", mnemonic ); + _debug_printf( "+" ); + _debug_printf( "%s", mnemonic ); switch (op.control) { case 0: break; case SVGA3DOPCONT_PROJECT: - debug_printf( "p" ); + _debug_printf( "p" ); break; case SVGA3DOPCONT_BIAS: - debug_printf( "b" ); + _debug_printf( "b" ); break; default: assert( 0 ); @@ -72,28 +72,28 @@ static void dump_comp_op( struct sh_op op, const char *mnemonic ) assert( op.is_reg == 0 ); if (op.coissue) - debug_printf( "+" ); - debug_printf( "%s", mnemonic ); + _debug_printf( "+" ); + _debug_printf( "%s", mnemonic ); switch (op.control) { case SVGA3DOPCOMP_RESERVED0: break; case SVGA3DOPCOMP_GT: - debug_printf("_gt"); + _debug_printf("_gt"); break; case SVGA3DOPCOMP_EQ: - debug_printf("_eq"); + _debug_printf("_eq"); break; case SVGA3DOPCOMP_GE: - debug_printf("_ge"); + _debug_printf("_ge"); break; case SVGA3DOPCOMP_LT: - debug_printf("_lt"); + _debug_printf("_lt"); break; case SVGA3DOPCOMPC_NE: - debug_printf("_ne"); + _debug_printf("_ne"); break; case SVGA3DOPCOMP_LE: - debug_printf("_le"); + _debug_printf("_le"); break; case SVGA3DOPCOMP_RESERVED1: default: @@ -109,93 +109,93 @@ static void dump_reg( struct sh_reg reg, struct sh_srcreg *indreg, const struct switch (sh_reg_type( reg )) { case SVGA3DREG_TEMP: - debug_printf( "r%u", reg.number ); + _debug_printf( "r%u", reg.number ); break; case SVGA3DREG_INPUT: - debug_printf( "v%u", reg.number ); + _debug_printf( "v%u", reg.number ); break; case SVGA3DREG_CONST: if (reg.relative) { if (sh_srcreg_type( *indreg ) == SVGA3DREG_LOOP) - debug_printf( "c[aL+%u]", reg.number ); + _debug_printf( "c[aL+%u]", reg.number ); else - debug_printf( "c[a%u.x+%u]", indreg->number, reg.number ); + _debug_printf( "c[a%u.x+%u]", indreg->number, reg.number ); } else - debug_printf( "c%u", reg.number ); + _debug_printf( "c%u", reg.number ); break; case SVGA3DREG_ADDR: /* VS */ /* SVGA3DREG_TEXTURE */ /* PS */ if (di->is_ps) - debug_printf( "t%u", reg.number ); + _debug_printf( "t%u", reg.number ); else - debug_printf( "a%u", reg.number ); + _debug_printf( "a%u", reg.number ); break; case SVGA3DREG_RASTOUT: switch (reg.number) { case 0 /*POSITION*/: - debug_printf( "oPos" ); + _debug_printf( "oPos" ); break; case 1 /*FOG*/: - debug_printf( "oFog" ); + _debug_printf( "oFog" ); break; case 2 /*POINT_SIZE*/: - debug_printf( "oPts" ); + _debug_printf( "oPts" ); break; default: assert( 0 ); - debug_printf( "???" ); + _debug_printf( "???" ); } break; case SVGA3DREG_ATTROUT: assert( reg.number < 2 ); - debug_printf( "oD%u", reg.number ); + _debug_printf( "oD%u", reg.number ); break; case SVGA3DREG_TEXCRDOUT: /* SVGA3DREG_OUTPUT */ - debug_printf( "oT%u", reg.number ); + _debug_printf( "oT%u", reg.number ); break; case SVGA3DREG_COLOROUT: - debug_printf( "oC%u", reg.number ); + _debug_printf( "oC%u", reg.number ); break; case SVGA3DREG_DEPTHOUT: - debug_printf( "oD%u", reg.number ); + _debug_printf( "oD%u", reg.number ); break; case SVGA3DREG_SAMPLER: - debug_printf( "s%u", reg.number ); + _debug_printf( "s%u", reg.number ); break; case SVGA3DREG_CONSTBOOL: assert( !reg.relative ); - debug_printf( "b%u", reg.number ); + _debug_printf( "b%u", reg.number ); break; case SVGA3DREG_CONSTINT: assert( !reg.relative ); - debug_printf( "i%u", reg.number ); + _debug_printf( "i%u", reg.number ); break; case SVGA3DREG_LOOP: assert( reg.number == 0 ); - debug_printf( "aL" ); + _debug_printf( "aL" ); break; case SVGA3DREG_MISCTYPE: switch (reg.number) { case SVGA3DMISCREG_POSITION: - debug_printf( "vPos" ); + _debug_printf( "vPos" ); break; case SVGA3DMISCREG_FACE: - debug_printf( "vFace" ); + _debug_printf( "vFace" ); break; default: assert(0); @@ -204,46 +204,46 @@ static void dump_reg( struct sh_reg reg, struct sh_srcreg *indreg, const struct break; case SVGA3DREG_LABEL: - debug_printf( "l%u", reg.number ); + _debug_printf( "l%u", reg.number ); break; case SVGA3DREG_PREDICATE: - debug_printf( "p%u", reg.number ); + _debug_printf( "p%u", reg.number ); break; default: assert( 0 ); - debug_printf( "???" ); + _debug_printf( "???" ); } } static void dump_cdata( struct sh_cdata cdata ) { - debug_printf( "%f, %f, %f, %f", cdata.xyzw[0], cdata.xyzw[1], cdata.xyzw[2], cdata.xyzw[3] ); + _debug_printf( "%f, %f, %f, %f", cdata.xyzw[0], cdata.xyzw[1], cdata.xyzw[2], cdata.xyzw[3] ); } static void dump_idata( struct sh_idata idata ) { - debug_printf( "%d, %d, %d, %d", idata.xyzw[0], idata.xyzw[1], idata.xyzw[2], idata.xyzw[3] ); + _debug_printf( "%d, %d, %d, %d", idata.xyzw[0], idata.xyzw[1], idata.xyzw[2], idata.xyzw[3] ); } static void dump_bdata( boolean bdata ) { - debug_printf( bdata ? "TRUE" : "FALSE" ); + _debug_printf( bdata ? "TRUE" : "FALSE" ); } static void dump_sampleinfo( struct ps_sampleinfo sampleinfo ) { switch (sampleinfo.texture_type) { case SVGA3DSAMP_2D: - debug_printf( "_2d" ); + _debug_printf( "_2d" ); break; case SVGA3DSAMP_CUBE: - debug_printf( "_cube" ); + _debug_printf( "_cube" ); break; case SVGA3DSAMP_VOLUME: - debug_printf( "_volume" ); + _debug_printf( "_volume" ); break; default: assert( 0 ); @@ -255,46 +255,46 @@ static void dump_usageinfo( struct vs_semantic semantic ) { switch (semantic.usage) { case SVGA3D_DECLUSAGE_POSITION: - debug_printf("_position" ); + _debug_printf("_position" ); break; case SVGA3D_DECLUSAGE_BLENDWEIGHT: - debug_printf("_blendweight" ); + _debug_printf("_blendweight" ); break; case SVGA3D_DECLUSAGE_BLENDINDICES: - debug_printf("_blendindices" ); + _debug_printf("_blendindices" ); break; case SVGA3D_DECLUSAGE_NORMAL: - debug_printf("_normal" ); + _debug_printf("_normal" ); break; case SVGA3D_DECLUSAGE_PSIZE: - debug_printf("_psize" ); + _debug_printf("_psize" ); break; case SVGA3D_DECLUSAGE_TEXCOORD: - debug_printf("_texcoord"); + _debug_printf("_texcoord"); break; case SVGA3D_DECLUSAGE_TANGENT: - debug_printf("_tangent" ); + _debug_printf("_tangent" ); break; case SVGA3D_DECLUSAGE_BINORMAL: - debug_printf("_binormal" ); + _debug_printf("_binormal" ); break; case SVGA3D_DECLUSAGE_TESSFACTOR: - debug_printf("_tessfactor" ); + _debug_printf("_tessfactor" ); break; case SVGA3D_DECLUSAGE_POSITIONT: - debug_printf("_positiont" ); + _debug_printf("_positiont" ); break; case SVGA3D_DECLUSAGE_COLOR: - debug_printf("_color" ); + _debug_printf("_color" ); break; case SVGA3D_DECLUSAGE_FOG: - debug_printf("_fog" ); + _debug_printf("_fog" ); break; case SVGA3D_DECLUSAGE_DEPTH: - debug_printf("_depth" ); + _debug_printf("_depth" ); break; case SVGA3D_DECLUSAGE_SAMPLE: - debug_printf("_sample"); + _debug_printf("_sample"); break; default: assert( 0 ); @@ -302,7 +302,7 @@ static void dump_usageinfo( struct vs_semantic semantic ) } if (semantic.usage_index != 0) { - debug_printf("%d", semantic.usage_index ); + _debug_printf("%d", semantic.usage_index ); } } @@ -316,47 +316,47 @@ static void dump_dstreg( struct sh_dstreg dstreg, const struct dump_info *di ) assert( (dstreg.modifier & (SVGA3DDSTMOD_SATURATE | SVGA3DDSTMOD_PARTIALPRECISION)) == dstreg.modifier ); if (dstreg.modifier & SVGA3DDSTMOD_SATURATE) - debug_printf( "_sat" ); + _debug_printf( "_sat" ); if (dstreg.modifier & SVGA3DDSTMOD_PARTIALPRECISION) - debug_printf( "_pp" ); + _debug_printf( "_pp" ); switch (dstreg.shift_scale) { case 0: break; case 1: - debug_printf( "_x2" ); + _debug_printf( "_x2" ); break; case 2: - debug_printf( "_x4" ); + _debug_printf( "_x4" ); break; case 3: - debug_printf( "_x8" ); + _debug_printf( "_x8" ); break; case 13: - debug_printf( "_d8" ); + _debug_printf( "_d8" ); break; case 14: - debug_printf( "_d4" ); + _debug_printf( "_d4" ); break; case 15: - debug_printf( "_d2" ); + _debug_printf( "_d2" ); break; default: assert( 0 ); } - debug_printf( " " ); + _debug_printf( " " ); u.dstreg = dstreg; dump_reg( u.reg, NULL, di ); if (dstreg.write_mask != SVGA3DWRITEMASK_ALL) { - debug_printf( "." ); + _debug_printf( "." ); if (dstreg.write_mask & SVGA3DWRITEMASK_0) - debug_printf( "x" ); + _debug_printf( "x" ); if (dstreg.write_mask & SVGA3DWRITEMASK_1) - debug_printf( "y" ); + _debug_printf( "y" ); if (dstreg.write_mask & SVGA3DWRITEMASK_2) - debug_printf( "z" ); + _debug_printf( "z" ); if (dstreg.write_mask & SVGA3DWRITEMASK_3) - debug_printf( "w" ); + _debug_printf( "w" ); } } @@ -372,19 +372,19 @@ static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, cons case SVGA3DSRCMOD_BIASNEG: case SVGA3DSRCMOD_SIGNNEG: case SVGA3DSRCMOD_X2NEG: - debug_printf( "-" ); + _debug_printf( "-" ); break; case SVGA3DSRCMOD_ABS: - debug_printf( "|" ); + _debug_printf( "|" ); break; case SVGA3DSRCMOD_ABSNEG: - debug_printf( "-|" ); + _debug_printf( "-|" ); break; case SVGA3DSRCMOD_COMP: - debug_printf( "1-" ); + _debug_printf( "1-" ); break; case SVGA3DSRCMOD_NOT: - debug_printf( "!" ); + _debug_printf( "!" ); } u.srcreg = srcreg; @@ -397,39 +397,39 @@ static void dump_srcreg( struct sh_srcreg srcreg, struct sh_srcreg *indreg, cons break; case SVGA3DSRCMOD_ABS: case SVGA3DSRCMOD_ABSNEG: - debug_printf( "|" ); + _debug_printf( "|" ); break; case SVGA3DSRCMOD_BIAS: case SVGA3DSRCMOD_BIASNEG: - debug_printf( "_bias" ); + _debug_printf( "_bias" ); break; case SVGA3DSRCMOD_SIGN: case SVGA3DSRCMOD_SIGNNEG: - debug_printf( "_bx2" ); + _debug_printf( "_bx2" ); break; case SVGA3DSRCMOD_X2: case SVGA3DSRCMOD_X2NEG: - debug_printf( "_x2" ); + _debug_printf( "_x2" ); break; case SVGA3DSRCMOD_DZ: - debug_printf( "_dz" ); + _debug_printf( "_dz" ); break; case SVGA3DSRCMOD_DW: - debug_printf( "_dw" ); + _debug_printf( "_dw" ); break; default: assert( 0 ); } if (srcreg.swizzle_x != 0 || srcreg.swizzle_y != 1 || srcreg.swizzle_z != 2 || srcreg.swizzle_w != 3) { - debug_printf( "." ); + _debug_printf( "." ); if (srcreg.swizzle_x == srcreg.swizzle_y && srcreg.swizzle_y == srcreg.swizzle_z && srcreg.swizzle_z == srcreg.swizzle_w) { - debug_printf( "%c", "xyzw"[srcreg.swizzle_x] ); + _debug_printf( "%c", "xyzw"[srcreg.swizzle_x] ); } else { - debug_printf( "%c", "xyzw"[srcreg.swizzle_x] ); - debug_printf( "%c", "xyzw"[srcreg.swizzle_y] ); - debug_printf( "%c", "xyzw"[srcreg.swizzle_z] ); - debug_printf( "%c", "xyzw"[srcreg.swizzle_w] ); + _debug_printf( "%c", "xyzw"[srcreg.swizzle_x] ); + _debug_printf( "%c", "xyzw"[srcreg.swizzle_y] ); + _debug_printf( "%c", "xyzw"[srcreg.swizzle_z] ); + _debug_printf( "%c", "xyzw"[srcreg.swizzle_w] ); } } } @@ -447,15 +447,15 @@ svga_shader_dump( if (do_binary) { for (i = 0; i < dwords; i++) - debug_printf(" 0x%08x,\n", assem[i]); + _debug_printf(" 0x%08x,\n", assem[i]); - debug_printf("\n\n"); + _debug_printf("\n\n"); } di.version.value = *assem++; di.is_ps = (di.version.type == SVGA3D_PS_TYPE); - debug_printf( + _debug_printf( "%s_%u_%u\n", di.is_ps ? "ps" : "vs", di.version.major, @@ -465,7 +465,7 @@ svga_shader_dump( struct sh_op op = *(struct sh_op *) assem; if (assem - start >= dwords) { - debug_printf("... ran off end of buffer\n"); + _debug_printf("... ran off end of buffer\n"); assert(0); return; } @@ -475,7 +475,7 @@ svga_shader_dump( { struct sh_dcl dcl = *(struct sh_dcl *) assem; - debug_printf( "dcl" ); + _debug_printf( "dcl" ); if (sh_dstreg_type( dcl.reg ) == SVGA3DREG_SAMPLER) dump_sampleinfo( dcl.u.ps.sampleinfo ); else if (di.is_ps) { @@ -486,7 +486,7 @@ svga_shader_dump( else dump_usageinfo( dcl.u.vs.semantic ); dump_dstreg( dcl.reg, &di ); - debug_printf( "\n" ); + _debug_printf( "\n" ); assem += sizeof( struct sh_dcl ) / sizeof( unsigned ); } break; @@ -495,11 +495,11 @@ svga_shader_dump( { struct sh_defb defb = *(struct sh_defb *) assem; - debug_printf( "defb " ); + _debug_printf( "defb " ); dump_reg( defb.reg, NULL, &di ); - debug_printf( ", " ); + _debug_printf( ", " ); dump_bdata( defb.data ); - debug_printf( "\n" ); + _debug_printf( "\n" ); assem += sizeof( struct sh_defb ) / sizeof( unsigned ); } break; @@ -508,11 +508,11 @@ svga_shader_dump( { struct sh_defi defi = *(struct sh_defi *) assem; - debug_printf( "defi " ); + _debug_printf( "defi " ); dump_reg( defi.reg, NULL, &di ); - debug_printf( ", " ); + _debug_printf( ", " ); dump_idata( defi.idata ); - debug_printf( "\n" ); + _debug_printf( "\n" ); assem += sizeof( struct sh_defi ) / sizeof( unsigned ); } break; @@ -528,11 +528,11 @@ svga_shader_dump( else { struct sh_unaryop unaryop = *(struct sh_unaryop *) assem; dump_dstreg( unaryop.dst, &di ); - debug_printf( ", " ); + _debug_printf( ", " ); dump_srcreg( unaryop.src, NULL, &di ); assem += sizeof( struct sh_unaryop ) / sizeof( unsigned ); } - debug_printf( "\n" ); + _debug_printf( "\n" ); break; case SVGA3DOP_TEX: @@ -549,7 +549,7 @@ svga_shader_dump( struct sh_unaryop unaryop = *(struct sh_unaryop *) assem; dump_dstreg( unaryop.dst, &di ); - debug_printf( ", " ); + _debug_printf( ", " ); dump_srcreg( unaryop.src, NULL, &di ); assem += sizeof( struct sh_unaryop ) / sizeof( unsigned ); } @@ -559,30 +559,30 @@ svga_shader_dump( dump_op( op, "texld" ); dump_dstreg( binaryop.dst, &di ); - debug_printf( ", " ); + _debug_printf( ", " ); dump_srcreg( binaryop.src0, NULL, &di ); - debug_printf( ", " ); + _debug_printf( ", " ); dump_srcreg( binaryop.src1, NULL, &di ); assem += sizeof( struct sh_binaryop ) / sizeof( unsigned ); } - debug_printf( "\n" ); + _debug_printf( "\n" ); break; case SVGA3DOP_DEF: { struct sh_def def = *(struct sh_def *) assem; - debug_printf( "def " ); + _debug_printf( "def " ); dump_reg( def.reg, NULL, &di ); - debug_printf( ", " ); + _debug_printf( ", " ); dump_cdata( def.cdata ); - debug_printf( "\n" ); + _debug_printf( "\n" ); assem += sizeof( struct sh_def ) / sizeof( unsigned ); } break; case SVGA3DOP_PHASE: - debug_printf( "phase\n" ); + _debug_printf( "phase\n" ); assem += sizeof( struct sh_op ) / sizeof( unsigned ); break; @@ -596,12 +596,12 @@ svga_shader_dump( break; case SVGA3DOP_RET: - debug_printf( "ret\n" ); + _debug_printf( "ret\n" ); assem += sizeof( struct sh_op ) / sizeof( unsigned ); break; case SVGA3DOP_END: - debug_printf( "end\n" ); + _debug_printf( "end\n" ); finished = TRUE; break; @@ -640,14 +640,14 @@ svga_shader_dump( } if (not_first_arg) - debug_printf( ", " ); + _debug_printf( ", " ); else - debug_printf( " " ); + _debug_printf( " " ); dump_srcreg( srcreg, &indreg, &di ); not_first_arg = TRUE; } - debug_printf( "\n" ); + _debug_printf( "\n" ); } } } -- cgit v1.2.3 From 5b1a7843f841b2bfdd54538a2eaad9dadae3e09d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Sat, 5 Dec 2009 06:34:59 +0000 Subject: svga: Dump SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN commands. --- src/gallium/drivers/svga/svgadump/svga_dump.c | 38 ++++++++++++++++++++++++++ src/gallium/drivers/svga/svgadump/svga_dump.py | 9 +++--- 2 files changed, 43 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svgadump/svga_dump.c b/src/gallium/drivers/svga/svgadump/svga_dump.c index 18e0eb5139..e6d4a74e86 100644 --- a/src/gallium/drivers/svga/svgadump/svga_dump.c +++ b/src/gallium/drivers/svga/svgadump/svga_dump.c @@ -1416,6 +1416,32 @@ dump_SVGA3dCmdDefineSurface(const SVGA3dCmdDefineSurface *cmd) _debug_printf("\t\t.face[5].numMipLevels = %u\n", (*cmd).face[5].numMipLevels); } +static void +dump_SVGASignedRect(const SVGASignedRect *cmd) +{ + _debug_printf("\t\t.left = %i\n", (*cmd).left); + _debug_printf("\t\t.top = %i\n", (*cmd).top); + _debug_printf("\t\t.right = %i\n", (*cmd).right); + _debug_printf("\t\t.bottom = %i\n", (*cmd).bottom); +} + +static void +dump_SVGA3dCmdBlitSurfaceToScreen(const SVGA3dCmdBlitSurfaceToScreen *cmd) +{ + _debug_printf("\t\t.srcImage.sid = %u\n", (*cmd).srcImage.sid); + _debug_printf("\t\t.srcImage.face = %u\n", (*cmd).srcImage.face); + _debug_printf("\t\t.srcImage.mipmap = %u\n", (*cmd).srcImage.mipmap); + _debug_printf("\t\t.srcRect.left = %i\n", (*cmd).srcRect.left); + _debug_printf("\t\t.srcRect.top = %i\n", (*cmd).srcRect.top); + _debug_printf("\t\t.srcRect.right = %i\n", (*cmd).srcRect.right); + _debug_printf("\t\t.srcRect.bottom = %i\n", (*cmd).srcRect.bottom); + _debug_printf("\t\t.destScreenId = %u\n", (*cmd).destScreenId); + _debug_printf("\t\t.destRect.left = %i\n", (*cmd).destRect.left); + _debug_printf("\t\t.destRect.top = %i\n", (*cmd).destRect.top); + _debug_printf("\t\t.destRect.right = %i\n", (*cmd).destRect.right); + _debug_printf("\t\t.destRect.bottom = %i\n", (*cmd).destRect.bottom); +} + void svga_dump_commands(const void *commands, uint32_t size) @@ -1710,6 +1736,18 @@ svga_dump_commands(const void *commands, uint32_t size) body = (const uint8_t *)&cmd[1]; } break; + case SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN: + _debug_printf("\tSVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN\n"); + { + const SVGA3dCmdBlitSurfaceToScreen *cmd = (const SVGA3dCmdBlitSurfaceToScreen *)body; + dump_SVGA3dCmdBlitSurfaceToScreen(cmd); + body = (const uint8_t *)&cmd[1]; + while(body + sizeof(SVGASignedRect) <= next) { + dump_SVGASignedRect((const SVGASignedRect *)body); + body += sizeof(SVGASignedRect); + } + } + break; default: _debug_printf("\t0x%08x\n", cmd_id); break; diff --git a/src/gallium/drivers/svga/svgadump/svga_dump.py b/src/gallium/drivers/svga/svgadump/svga_dump.py index dc5f3267e2..a1ada29ef8 100755 --- a/src/gallium/drivers/svga/svgadump/svga_dump.py +++ b/src/gallium/drivers/svga/svgadump/svga_dump.py @@ -202,6 +202,7 @@ cmds = [ ('SVGA_3D_CMD_END_QUERY', 'SVGA3dCmdEndQuery', (), None), ('SVGA_3D_CMD_WAIT_FOR_QUERY', 'SVGA3dCmdWaitForQuery', (), None), #('SVGA_3D_CMD_PRESENT_READBACK', None, (), None), + ('SVGA_3D_CMD_BLIT_SURFACE_TO_SCREEN', 'SVGA3dCmdBlitSurfaceToScreen', (), 'SVGASignedRect'), ] def dump_cmds(): @@ -294,18 +295,18 @@ def main(): print '#include "svga_shader_dump.h"' print '#include "svga3d_reg.h"' print - print '#include "pipe/p_debug.h"' + print '#include "util/u_debug.h"' print '#include "svga_dump.h"' print config = parser.config_t( - include_paths = ['include'], + include_paths = ['../../../include', '../include'], compiler = 'gcc', ) headers = [ - 'include/svga_types.h', - 'include/svga3d_reg.h', + 'svga_types.h', + 'svga3d_reg.h', ] decls = parser.parse(headers, config, parser.COMPILATION_MODE.ALL_AT_ONCE) -- cgit v1.2.3 From 433f0a82f5a4696e6b0c4061f645485ec8079bb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Sat, 5 Dec 2009 17:20:03 +0100 Subject: radeon: Only get DRI2 front buffer information for glXBindTexImageEXT. --- src/mesa/drivers/dri/r300/r300_texstate.c | 13 +---- src/mesa/drivers/dri/radeon/radeon_common.c | 8 +-- .../drivers/dri/radeon/radeon_common_context.c | 57 ++++++++++++---------- .../drivers/dri/radeon/radeon_common_context.h | 3 +- 4 files changed, 38 insertions(+), 43 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index e6f2c0c1a7..9eaf390b46 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -409,18 +409,7 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo return; } - radeon_update_renderbuffers(pDRICtx, dPriv); - /* back & depth buffer are useless free them right away */ - rb = (void*)rfb->base.Attachment[BUFFER_DEPTH].Renderbuffer; - if (rb && rb->bo) { - radeon_bo_unref(rb->bo); - rb->bo = NULL; - } - rb = (void*)rfb->base.Attachment[BUFFER_BACK_LEFT].Renderbuffer; - if (rb && rb->bo) { - radeon_bo_unref(rb->bo); - rb->bo = NULL; - } + radeon_update_renderbuffers(pDRICtx, dPriv, GL_TRUE); rb = rfb->color_rb[0]; if (rb->bo == NULL) { /* Failed to BO for the buffer */ diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index 184287aa44..c81e80e820 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -840,7 +840,7 @@ void radeonDrawBuffer( GLcontext *ctx, GLenum mode ) */ if (!was_front_buffer_rendering && radeon->is_front_buffer_rendering) { radeon_update_renderbuffers(radeon->dri.context, - radeon->dri.context->driDrawablePriv); + radeon->dri.context->driDrawablePriv, GL_FALSE); } } @@ -857,7 +857,7 @@ void radeonReadBuffer( GLcontext *ctx, GLenum mode ) if (!was_front_buffer_reading && rmesa->is_front_buffer_reading) { radeon_update_renderbuffers(rmesa->dri.context, - rmesa->dri.context->driReadablePriv); + rmesa->dri.context->driReadablePriv, GL_FALSE); } } /* nothing, until we implement h/w glRead/CopyPixels or CopyTexImage */ @@ -908,9 +908,9 @@ void radeon_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei width, GLsizei he if (radeon->is_front_buffer_rendering) { ctx->Driver.Flush(ctx); } - radeon_update_renderbuffers(driContext, driContext->driDrawablePriv); + radeon_update_renderbuffers(driContext, driContext->driDrawablePriv, GL_FALSE); if (driContext->driDrawablePriv != driContext->driReadablePriv) - radeon_update_renderbuffers(driContext, driContext->driReadablePriv); + radeon_update_renderbuffers(driContext, driContext->driReadablePriv, GL_FALSE); } old_viewport = ctx->Driver.Viewport; diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.c b/src/mesa/drivers/dri/radeon/radeon_common_context.c index 71f70d724b..5c68bf5df6 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.c @@ -499,7 +499,8 @@ radeon_bits_per_pixel(const struct radeon_renderbuffer *rb) } void -radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) +radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable, + GLboolean front_only) { unsigned int attachments[10]; __DRIbuffer *buffers = NULL; @@ -525,7 +526,7 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) struct radeon_renderbuffer *stencil_rb; i = 0; - if ((radeon->is_front_buffer_rendering || + if ((front_only || radeon->is_front_buffer_rendering || radeon->is_front_buffer_reading || !draw->color_rb[1]) && draw->color_rb[0]) { @@ -533,23 +534,25 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) attachments[i++] = radeon_bits_per_pixel(draw->color_rb[0]); } - if (draw->color_rb[1]) { - attachments[i++] = __DRI_BUFFER_BACK_LEFT; - attachments[i++] = radeon_bits_per_pixel(draw->color_rb[1]); - } + if (!front_only) { + if (draw->color_rb[1]) { + attachments[i++] = __DRI_BUFFER_BACK_LEFT; + attachments[i++] = radeon_bits_per_pixel(draw->color_rb[1]); + } - depth_rb = radeon_get_renderbuffer(&draw->base, BUFFER_DEPTH); - stencil_rb = radeon_get_renderbuffer(&draw->base, BUFFER_STENCIL); - - if ((depth_rb != NULL) && (stencil_rb != NULL)) { - attachments[i++] = __DRI_BUFFER_DEPTH_STENCIL; - attachments[i++] = radeon_bits_per_pixel(depth_rb); - } else if (depth_rb != NULL) { - attachments[i++] = __DRI_BUFFER_DEPTH; - attachments[i++] = radeon_bits_per_pixel(depth_rb); - } else if (stencil_rb != NULL) { - attachments[i++] = __DRI_BUFFER_STENCIL; - attachments[i++] = radeon_bits_per_pixel(stencil_rb); + depth_rb = radeon_get_renderbuffer(&draw->base, BUFFER_DEPTH); + stencil_rb = radeon_get_renderbuffer(&draw->base, BUFFER_STENCIL); + + if ((depth_rb != NULL) && (stencil_rb != NULL)) { + attachments[i++] = __DRI_BUFFER_DEPTH_STENCIL; + attachments[i++] = radeon_bits_per_pixel(depth_rb); + } else if (depth_rb != NULL) { + attachments[i++] = __DRI_BUFFER_DEPTH; + attachments[i++] = radeon_bits_per_pixel(depth_rb); + } else if (stencil_rb != NULL) { + attachments[i++] = __DRI_BUFFER_STENCIL; + attachments[i++] = radeon_bits_per_pixel(stencil_rb); + } } buffers = (*screen->dri2.loader->getBuffersWithFormat)(drawable, @@ -562,12 +565,14 @@ radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) i = 0; if (draw->color_rb[0]) attachments[i++] = __DRI_BUFFER_FRONT_LEFT; - if (draw->color_rb[1]) - attachments[i++] = __DRI_BUFFER_BACK_LEFT; - if (radeon_get_renderbuffer(&draw->base, BUFFER_DEPTH)) - attachments[i++] = __DRI_BUFFER_DEPTH; - if (radeon_get_renderbuffer(&draw->base, BUFFER_STENCIL)) - attachments[i++] = __DRI_BUFFER_STENCIL; + if (!front_only) { + if (draw->color_rb[1]) + attachments[i++] = __DRI_BUFFER_BACK_LEFT; + if (radeon_get_renderbuffer(&draw->base, BUFFER_DEPTH)) + attachments[i++] = __DRI_BUFFER_DEPTH; + if (radeon_get_renderbuffer(&draw->base, BUFFER_STENCIL)) + attachments[i++] = __DRI_BUFFER_STENCIL; + } buffers = (*screen->dri2.loader->getBuffers)(drawable, &drawable->w, @@ -735,9 +740,9 @@ GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv, readfb = driReadPriv->driverPrivate; if (driContextPriv->driScreenPriv->dri2.enabled) { - radeon_update_renderbuffers(driContextPriv, driDrawPriv); + radeon_update_renderbuffers(driContextPriv, driDrawPriv, GL_FALSE); if (driDrawPriv != driReadPriv) - radeon_update_renderbuffers(driContextPriv, driReadPriv); + radeon_update_renderbuffers(driContextPriv, driReadPriv, GL_FALSE); _mesa_reference_renderbuffer(&radeon->state.color.rb, &(radeon_get_renderbuffer(&drfb->base, BUFFER_BACK_LEFT)->base)); _mesa_reference_renderbuffer(&radeon->state.depth.rb, diff --git a/src/mesa/drivers/dri/radeon/radeon_common_context.h b/src/mesa/drivers/dri/radeon/radeon_common_context.h index ad953ddbb5..49a9ec5610 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common_context.h +++ b/src/mesa/drivers/dri/radeon/radeon_common_context.h @@ -589,7 +589,8 @@ GLboolean radeonInitContext(radeonContextPtr radeon, void radeonCleanupContext(radeonContextPtr radeon); GLboolean radeonUnbindContext(__DRIcontextPrivate * driContextPriv); -void radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable); +void radeon_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable, + GLboolean front_only); GLboolean radeonMakeCurrent(__DRIcontextPrivate * driContextPriv, __DRIdrawablePrivate * driDrawPriv, __DRIdrawablePrivate * driReadPriv); -- cgit v1.2.3 From 01537a84dfe65cd1512d6fbf71e975fad5639432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Sat, 5 Dec 2009 17:42:50 +0100 Subject: st/mesa: Prefer alpha-less formats for RGB textures. This can e.g. increase the chance of being able to accelerate glCopyTex(Sub)Image from an alpha-less renderbuffer. --- src/mesa/state_tracker/st_format.c | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 02f80057c2..93125afe9e 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -388,6 +388,33 @@ default_rgba_format(struct pipe_screen *screen, return PIPE_FORMAT_NONE; } +/** + * Find an RGB format supported by the context/winsys. + */ +static enum pipe_format +default_rgb_format(struct pipe_screen *screen, + enum pipe_texture_target target, + unsigned tex_usage, + unsigned geom_flags) +{ + static const enum pipe_format colorFormats[] = { + PIPE_FORMAT_X8R8G8B8_UNORM, + PIPE_FORMAT_B8G8R8X8_UNORM, + PIPE_FORMAT_R8G8B8X8_UNORM, + PIPE_FORMAT_A8R8G8B8_UNORM, + PIPE_FORMAT_B8G8R8A8_UNORM, + PIPE_FORMAT_R8G8B8A8_UNORM, + PIPE_FORMAT_R5G6B5_UNORM + }; + uint i; + for (i = 0; i < Elements(colorFormats); i++) { + if (screen->is_format_supported( screen, colorFormats[i], target, tex_usage, geom_flags )) { + return colorFormats[i]; + } + } + return PIPE_FORMAT_NONE; +} + /** * Find an sRGBA format supported by the context/winsys. */ @@ -472,13 +499,14 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, case 4: case GL_RGBA: case GL_COMPRESSED_RGBA: - case 3: - case GL_RGB: - case GL_COMPRESSED_RGB: case GL_RGBA8: case GL_RGB10_A2: case GL_RGBA12: return default_rgba_format( screen, target, tex_usage, geom_flags ); + case 3: + case GL_RGB: + case GL_COMPRESSED_RGB: + return default_rgb_format( screen, target, tex_usage, geom_flags ); case GL_RGBA16: if (tex_usage & PIPE_TEXTURE_USAGE_RENDER_TARGET) return default_deep_rgba_format( screen, target, tex_usage, geom_flags ); @@ -500,7 +528,7 @@ st_choose_format(struct pipe_screen *screen, GLenum internalFormat, case GL_RGB10: case GL_RGB12: case GL_RGB16: - return default_rgba_format( screen, target, tex_usage, geom_flags ); + return default_rgb_format( screen, target, tex_usage, geom_flags ); case GL_RGB5: case GL_RGB4: -- cgit v1.2.3 From 56a4342a0493ad1d502d4791ab941ef171d36e60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Sat, 5 Dec 2009 17:48:00 +0100 Subject: r300g: Need to emit a hardware scissor rectangle even if scissor is disabled. Just make it cover the whole framebuffer in that case. Otherwise the kernel CS checker may complain, e.g. running progs/demos/gearbox. That runs fast now here, but doesn't look right yet. --- src/gallium/drivers/r300/r300_context.h | 2 ++ src/gallium/drivers/r300/r300_emit.c | 9 +++++++-- src/gallium/drivers/r300/r300_state.c | 19 +++++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index dd3f6ac143..11cd9f855f 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -101,6 +101,8 @@ struct r300_sampler_state { struct r300_scissor_state { uint32_t scissor_top_left; /* R300_SC_SCISSORS_TL: 0x43e0 */ uint32_t scissor_bottom_right; /* R300_SC_SCISSORS_BR: 0x43e4 */ + uint32_t no_scissor_top_left; /* R300_SC_SCISSORS_TL: 0x43e0 */ + uint32_t no_scissor_bottom_right; /* R300_SC_SCISSORS_BR: 0x43e4 */ }; struct r300_texture_state { diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 60be03f54f..04dca29216 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -570,8 +570,13 @@ void r300_emit_scissor_state(struct r300_context* r300, BEGIN_CS(3); OUT_CS_REG_SEQ(R300_SC_SCISSORS_TL, 2); - OUT_CS(scissor->scissor_top_left); - OUT_CS(scissor->scissor_bottom_right); + if (r300->rs_state->rs.scissor) { + OUT_CS(scissor->scissor_top_left); + OUT_CS(scissor->scissor_bottom_right); + } else { + OUT_CS(scissor->no_scissor_top_left); + OUT_CS(scissor->no_scissor_bottom_right); + } END_CS; } diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 442af70e14..2bc2b79c02 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -302,6 +302,25 @@ static void r300->framebuffer_state = *state; r300->dirty_state |= R300_NEW_FRAMEBUFFERS; + + if (r300_screen(r300->context.screen)->caps->is_r500) { + r300->scissor_state->no_scissor_top_left = + (0 << R300_SCISSORS_X_SHIFT) | + (0 << R300_SCISSORS_Y_SHIFT); + r300->scissor_state->no_scissor_bottom_right = + ((state->width - 1) << R300_SCISSORS_X_SHIFT) | + ((state->height - 1) << R300_SCISSORS_Y_SHIFT); + } else { + /* Offset of 1440 in non-R500 chipsets. */ + r300->scissor_state->no_scissor_top_left = + ((0 + 1440) << R300_SCISSORS_X_SHIFT) | + ((0 + 1440) << R300_SCISSORS_Y_SHIFT); + r300->scissor_state->no_scissor_bottom_right = + (((state->width - 1) + 1440) << R300_SCISSORS_X_SHIFT) | + (((state->height - 1) + 1440) << R300_SCISSORS_Y_SHIFT); + } + + r300->dirty_state |= R300_NEW_SCISSOR; } /* Create fragment shader state. */ -- cgit v1.2.3 From cbb7226a4b457a3ebc94592660f22324c8e7cfcc Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Sat, 5 Dec 2009 13:19:54 -0500 Subject: st/xvmc: No more pf_get_block(). --- src/gallium/state_trackers/xorg/xvmc/surface.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xvmc/surface.c b/src/gallium/state_trackers/xorg/xvmc/surface.c index 8cb73f4897..0e39a390c6 100644 --- a/src/gallium/state_trackers/xorg/xvmc/surface.c +++ b/src/gallium/state_trackers/xorg/xvmc/surface.c @@ -1,8 +1,8 @@ /************************************************************************** - * + * * Copyright 2009 Younes Manton. * All Rights Reserved. - * + * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including @@ -10,11 +10,11 @@ * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. @@ -22,7 +22,7 @@ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * + * **************************************************************************/ #include @@ -106,7 +106,6 @@ CreateOrResizeBackBuffer(struct pipe_video_context *vpipe, unsigned int width, u template.width0 = width; template.height0 = height; template.depth0 = 1; - pf_get_block(template.format, &template.block); template.tex_usage = PIPE_TEXTURE_USAGE_DISPLAY_TARGET; tex = vpipe->screen->texture_create(vpipe->screen, &template); -- cgit v1.2.3 From 4071d065c2c32a872bb148d108252a2380c42da4 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 29 Nov 2009 18:18:23 -0500 Subject: mesa: Fix array out-of-bounds access by _mesa_TexParameterf. _mesa_TexParameterf calls set_tex_parameteri, which uses the params argument as an array. (cherry picked from commit a201dfb6bf28b89d6f511c2ec9ae0d81ef18511d) --- src/mesa/main/texparam.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 9d1fdd0566..416792f0e9 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -544,8 +544,10 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param) case GL_DEPTH_TEXTURE_MODE_ARB: { /* convert float param to int */ - GLint p = (GLint) param; - need_update = set_tex_parameteri(ctx, texObj, pname, &p); + GLint p[4]; + p[0] = (GLint) param; + p[1] = p[2] = p[3] = 0; + need_update = set_tex_parameteri(ctx, texObj, pname, p); } break; default: -- cgit v1.2.3 From ca8a2150c79899bad0f80e132656863822db045e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 29 Nov 2009 21:17:44 -0500 Subject: mesa: Fix array out-of-bounds access by _mesa_TexParameterf. _mesa_TexParameterf calls set_tex_parameterf, which uses the params argument as an array. (cherry picked from commit 270d36da146b899d39e08f830fe34b63833a3731) --- src/mesa/main/texparam.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 416792f0e9..4ce8c8593a 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -551,8 +551,13 @@ _mesa_TexParameterf(GLenum target, GLenum pname, GLfloat param) } break; default: - /* this will generate an error if pname is illegal */ - need_update = set_tex_parameterf(ctx, texObj, pname, ¶m); + { + /* this will generate an error if pname is illegal */ + GLfloat p[4]; + p[0] = param; + p[1] = p[2] = p[3] = 0.0F; + need_update = set_tex_parameterf(ctx, texObj, pname, p); + } } if (ctx->Driver.TexParameter && need_update) { -- cgit v1.2.3 From d74cd04e6190ebb3a9c53d45cbb2452d92e24ad5 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 28 Nov 2009 23:47:23 -0500 Subject: mesa: Fix array out-of-bounds access by _mesa_TexGeni. _mesa_TexGeni calls _mesa_TexGeniv, which uses the params argument as an array. (cherry picked from commit d55fb7c835b56951f05a058083e7eda264ba192e) --- src/mesa/main/texgen.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c index e3feb024c3..13b33745b8 100644 --- a/src/mesa/main/texgen.c +++ b/src/mesa/main/texgen.c @@ -213,7 +213,10 @@ _mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ) void GLAPIENTRY _mesa_TexGeni( GLenum coord, GLenum pname, GLint param ) { - _mesa_TexGeniv( coord, pname, ¶m ); + GLint p[4]; + p[0] = param; + p[1] = p[2] = p[3] = 0; + _mesa_TexGeniv( coord, pname, p ); } -- cgit v1.2.3 From b2953ee1a655a010f36b5fc1b47f8bd8b06ce368 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sun, 29 Nov 2009 00:50:48 -0500 Subject: mesa: Fix array out-of-bounds access by _mesa_TexGenf. _mesa_TexGenf calls _mesa_TexGenfv, which uses the params argument as an array. (cherry picked from commit ca5a7aadb4361e7d053aea8687372cd44cbd8795) --- src/mesa/main/texgen.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c index 13b33745b8..d3ea7b936b 100644 --- a/src/mesa/main/texgen.c +++ b/src/mesa/main/texgen.c @@ -206,7 +206,10 @@ _mesa_TexGendv(GLenum coord, GLenum pname, const GLdouble *params ) void GLAPIENTRY _mesa_TexGenf( GLenum coord, GLenum pname, GLfloat param ) { - _mesa_TexGenfv(coord, pname, ¶m); + GLfloat p[4]; + p[0] = param; + p[1] = p[2] = p[3] = 0.0F; + _mesa_TexGenfv(coord, pname, p); } -- cgit v1.2.3 From 3cd745515e72c42efcd0c9f7d30e58f46f821b98 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 16:03:48 -0800 Subject: draw: Initialize variable in draw_pt.c. (cherry picked from commit ea98e9820d7117f7a187f355445796b1ef5d9e0c) --- src/gallium/auxiliary/draw/draw_pt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c index dbb5ac7182..4865a2d854 100644 --- a/src/gallium/auxiliary/draw/draw_pt.c +++ b/src/gallium/auxiliary/draw/draw_pt.c @@ -192,7 +192,8 @@ draw_print_arrays(struct draw_context *draw, uint prim, int start, uint count) prim, start, count); for (i = 0; i < count; i++) { - uint ii, j; + uint ii = 0; + uint j; if (draw->pt.user.elts) { /* indexed arrays */ -- cgit v1.2.3 From df02bc42b330fe20679dd3e5e83317df72ddd5ca Mon Sep 17 00:00:00 2001 From: Alex Deucher Date: Sat, 5 Dec 2009 18:24:41 -0500 Subject: radeon/r200/r600: fix drivers for changes in 433f0a82f5a4696e6b0c4061f645485ec8079bb4 --- src/mesa/drivers/dri/r200/r200_texstate.c | 15 ++------------- src/mesa/drivers/dri/r600/r600_texstate.c | 13 +------------ src/mesa/drivers/dri/radeon/radeon_texstate.c | 15 ++------------- 3 files changed, 5 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index 7782404a79..e2f9cf0ea8 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -797,24 +797,13 @@ void r200SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo return; } - radeon_update_renderbuffers(pDRICtx, dPriv); - /* back & depth buffer are useless free them right away */ - rb = (void*)rfb->base.Attachment[BUFFER_DEPTH].Renderbuffer; - if (rb && rb->bo) { - radeon_bo_unref(rb->bo); - rb->bo = NULL; - } - rb = (void*)rfb->base.Attachment[BUFFER_BACK_LEFT].Renderbuffer; - if (rb && rb->bo) { - radeon_bo_unref(rb->bo); - rb->bo = NULL; - } + radeon_update_renderbuffers(pDRICtx, dPriv, GL_TRUE); rb = rfb->color_rb[0]; if (rb->bo == NULL) { /* Failed to BO for the buffer */ return; } - + _mesa_lock_texture(radeon->glCtx, texObj); if (t->bo) { radeon_bo_unref(t->bo); diff --git a/src/mesa/drivers/dri/r600/r600_texstate.c b/src/mesa/drivers/dri/r600/r600_texstate.c index 4ec315b78c..2a4a6e6ee1 100644 --- a/src/mesa/drivers/dri/r600/r600_texstate.c +++ b/src/mesa/drivers/dri/r600/r600_texstate.c @@ -917,18 +917,7 @@ void r600SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo return; } - radeon_update_renderbuffers(pDRICtx, dPriv); - /* back & depth buffer are useless free them right away */ - rb = (void*)rfb->base.Attachment[BUFFER_DEPTH].Renderbuffer; - if (rb && rb->bo) { - radeon_bo_unref(rb->bo); - rb->bo = NULL; - } - rb = (void*)rfb->base.Attachment[BUFFER_BACK_LEFT].Renderbuffer; - if (rb && rb->bo) { - radeon_bo_unref(rb->bo); - rb->bo = NULL; - } + radeon_update_renderbuffers(pDRICtx, dPriv, GL_TRUE); rb = rfb->color_rb[0]; if (rb->bo == NULL) { /* Failed to BO for the buffer */ diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index 3cbe3b4725..84ddcfd4fd 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -672,24 +672,13 @@ void radeonSetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_ return; } - radeon_update_renderbuffers(pDRICtx, dPriv); - /* back & depth buffer are useless free them right away */ - rb = (void*)rfb->base.Attachment[BUFFER_DEPTH].Renderbuffer; - if (rb && rb->bo) { - radeon_bo_unref(rb->bo); - rb->bo = NULL; - } - rb = (void*)rfb->base.Attachment[BUFFER_BACK_LEFT].Renderbuffer; - if (rb && rb->bo) { - radeon_bo_unref(rb->bo); - rb->bo = NULL; - } + radeon_update_renderbuffers(pDRICtx, dPriv, GL_TRUE); rb = rfb->color_rb[0]; if (rb->bo == NULL) { /* Failed to BO for the buffer */ return; } - + _mesa_lock_texture(radeon->glCtx, texObj); if (t->bo) { radeon_bo_unref(t->bo); -- cgit v1.2.3 From 76b3523d752968bc552d4350a39b9b9b1a023cf0 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 23 Nov 2009 01:30:32 -0500 Subject: glx: Prevent potential null pointer deference in driCreateContext. (cherry picked from commit 4b0b250aae6ae7d48cd24f9d91d05ab58086c4b2) --- src/glx/x11/drisw_glx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/glx/x11/drisw_glx.c b/src/glx/x11/drisw_glx.c index 15e1586658..1866b2cc87 100644 --- a/src/glx/x11/drisw_glx.c +++ b/src/glx/x11/drisw_glx.c @@ -250,12 +250,14 @@ driCreateContext(__GLXscreenConfigs * psc, { __GLXDRIcontextPrivate *pcp, *pcp_shared; __GLXDRIconfigPrivate *config = (__GLXDRIconfigPrivate *) mode; - const __DRIcoreExtension *core = psc->core; + const __DRIcoreExtension *core; __DRIcontext *shared = NULL; if (!psc || !psc->driScreen) return NULL; + core = psc->core; + if (shareList) { pcp_shared = (__GLXDRIcontextPrivate *) shareList->driContext; shared = pcp_shared->driContext; -- cgit v1.2.3 From f622b649fb0c55b1640997f9d32ea327743519a1 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 24 Nov 2009 00:57:55 -0500 Subject: dri: Fix potential null pointer deference in dri_put_drawable. (cherry picked from commit 364070b1f2b08d43fb205ec198894a35bec6b2f3) --- src/mesa/drivers/dri/common/dri_util.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index e48e10d7c0..439f66a7b8 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -498,11 +498,11 @@ static void dri_put_drawable(__DRIdrawable *pdp) { __DRIscreenPrivate *psp; - pdp->refcount--; - if (pdp->refcount) - return; - if (pdp) { + pdp->refcount--; + if (pdp->refcount) + return; + psp = pdp->driScreenPriv; (*psp->DriverAPI.DestroyBuffer)(pdp); if (pdp->pClipRects) { -- cgit v1.2.3 From c994f08eb1ec2a4bbaa44fbd6d35e7ff033d5c3c Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Sat, 28 Nov 2009 23:22:31 -0500 Subject: dri: Fix potential null pointer dereference in driBindContext. (cherry picked from commit 919898e92fa23ff71a59d86a46ff0886a6f34e4d) --- src/mesa/drivers/dri/common/dri_util.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/common/dri_util.c b/src/mesa/drivers/dri/common/dri_util.c index 439f66a7b8..da81ec9de5 100644 --- a/src/mesa/drivers/dri/common/dri_util.c +++ b/src/mesa/drivers/dri/common/dri_util.c @@ -167,11 +167,12 @@ static int driBindContext(__DRIcontext *pcp, __DRIdrawable *pdp, __DRIdrawable *prp) { - __DRIscreenPrivate *psp = pcp->driScreenPriv; + __DRIscreenPrivate *psp; /* Bind the drawable to the context */ if (pcp) { + psp = pcp->driScreenPriv; pcp->driDrawablePriv = pdp; pcp->driReadablePriv = prp; if (pdp) { -- cgit v1.2.3 From e1380cae885df37d4a211d0271f59487d9f2db78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 5 Dec 2009 19:17:20 +0100 Subject: r300g: remove redundant code and clean up --- src/gallium/drivers/r300/r300_context.h | 11 +++-- src/gallium/drivers/r300/r300_emit.c | 19 +++++---- src/gallium/drivers/r300/r300_state.c | 73 +++++++++++++++++---------------- 3 files changed, 57 insertions(+), 46 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 11cd9f855f..23ea32c57e 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -98,11 +98,14 @@ struct r300_sampler_state { unsigned min_lod, max_lod; }; +struct r300_scissor_regs { + uint32_t top_left; /* R300_SC_SCISSORS_TL: 0x43e0 */ + uint32_t bottom_right; /* R300_SC_SCISSORS_BR: 0x43e4 */ +}; + struct r300_scissor_state { - uint32_t scissor_top_left; /* R300_SC_SCISSORS_TL: 0x43e0 */ - uint32_t scissor_bottom_right; /* R300_SC_SCISSORS_BR: 0x43e4 */ - uint32_t no_scissor_top_left; /* R300_SC_SCISSORS_TL: 0x43e0 */ - uint32_t no_scissor_bottom_right; /* R300_SC_SCISSORS_BR: 0x43e4 */ + struct r300_scissor_regs framebuffer; + struct r300_scissor_regs scissor; }; struct r300_texture_state { diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 04dca29216..dbf316a9b5 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -563,21 +563,26 @@ void r300_emit_rs_block_state(struct r300_context* r300, END_CS; } -void r300_emit_scissor_state(struct r300_context* r300, - struct r300_scissor_state* scissor) +static void r300_emit_scissor_regs(struct r300_context* r300, + struct r300_scissor_regs* scissor) { CS_LOCALS(r300); BEGIN_CS(3); OUT_CS_REG_SEQ(R300_SC_SCISSORS_TL, 2); + OUT_CS(scissor->top_left); + OUT_CS(scissor->bottom_right); + END_CS; +} + +void r300_emit_scissor_state(struct r300_context* r300, + struct r300_scissor_state* scissor) +{ if (r300->rs_state->rs.scissor) { - OUT_CS(scissor->scissor_top_left); - OUT_CS(scissor->scissor_bottom_right); + r300_emit_scissor_regs(r300, &scissor->scissor); } else { - OUT_CS(scissor->no_scissor_top_left); - OUT_CS(scissor->no_scissor_bottom_right); + r300_emit_scissor_regs(r300, &scissor->framebuffer); } - END_CS; } void r300_emit_texture(struct r300_context* r300, diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 2bc2b79c02..d3233557ce 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -289,11 +289,34 @@ static void r300_set_edgeflags(struct pipe_context* pipe, /* XXX and even worse, I have no idea WTF the bitfield is */ } +static void r300_set_scissor_regs(const struct pipe_scissor_state* state, + struct r300_scissor_regs *scissor, + boolean is_r500) +{ + if (is_r500) { + scissor->top_left = + (state->minx << R300_SCISSORS_X_SHIFT) | + (state->miny << R300_SCISSORS_Y_SHIFT); + scissor->bottom_right = + ((state->maxx - 1) << R300_SCISSORS_X_SHIFT) | + ((state->maxy - 1) << R300_SCISSORS_Y_SHIFT); + } else { + /* Offset of 1440 in non-R500 chipsets. */ + scissor->top_left = + ((state->minx + 1440) << R300_SCISSORS_X_SHIFT) | + ((state->miny + 1440) << R300_SCISSORS_Y_SHIFT); + scissor->bottom_right = + (((state->maxx - 1) + 1440) << R300_SCISSORS_X_SHIFT) | + (((state->maxy - 1) + 1440) << R300_SCISSORS_Y_SHIFT); + } +} + static void r300_set_framebuffer_state(struct pipe_context* pipe, const struct pipe_framebuffer_state* state) { struct r300_context* r300 = r300_context(pipe); + struct pipe_scissor_state scissor; if (r300->draw) { draw_flush(r300->draw); @@ -301,26 +324,17 @@ static void r300->framebuffer_state = *state; - r300->dirty_state |= R300_NEW_FRAMEBUFFERS; + scissor.minx = scissor.miny = 0; + scissor.maxx = state->width; + scissor.maxy = state->height; + r300_set_scissor_regs(&scissor, &r300->scissor_state->framebuffer, + r300_screen(r300->context.screen)->caps->is_r500); - if (r300_screen(r300->context.screen)->caps->is_r500) { - r300->scissor_state->no_scissor_top_left = - (0 << R300_SCISSORS_X_SHIFT) | - (0 << R300_SCISSORS_Y_SHIFT); - r300->scissor_state->no_scissor_bottom_right = - ((state->width - 1) << R300_SCISSORS_X_SHIFT) | - ((state->height - 1) << R300_SCISSORS_Y_SHIFT); - } else { - /* Offset of 1440 in non-R500 chipsets. */ - r300->scissor_state->no_scissor_top_left = - ((0 + 1440) << R300_SCISSORS_X_SHIFT) | - ((0 + 1440) << R300_SCISSORS_Y_SHIFT); - r300->scissor_state->no_scissor_bottom_right = - (((state->width - 1) + 1440) << R300_SCISSORS_X_SHIFT) | - (((state->height - 1) + 1440) << R300_SCISSORS_Y_SHIFT); + /* Don't rely on the order of states being set for the first time. */ + if (!r300->rs_state || !r300->rs_state->rs.scissor) { + r300->dirty_state |= R300_NEW_SCISSOR; } - - r300->dirty_state |= R300_NEW_SCISSOR; + r300->dirty_state |= R300_NEW_FRAMEBUFFERS; } /* Create fragment shader state. */ @@ -642,24 +656,13 @@ static void r300_set_scissor_state(struct pipe_context* pipe, { struct r300_context* r300 = r300_context(pipe); - if (r300_screen(r300->context.screen)->caps->is_r500) { - r300->scissor_state->scissor_top_left = - (state->minx << R300_SCISSORS_X_SHIFT) | - (state->miny << R300_SCISSORS_Y_SHIFT); - r300->scissor_state->scissor_bottom_right = - ((state->maxx - 1) << R300_SCISSORS_X_SHIFT) | - ((state->maxy - 1) << R300_SCISSORS_Y_SHIFT); - } else { - /* Offset of 1440 in non-R500 chipsets. */ - r300->scissor_state->scissor_top_left = - ((state->minx + 1440) << R300_SCISSORS_X_SHIFT) | - ((state->miny + 1440) << R300_SCISSORS_Y_SHIFT); - r300->scissor_state->scissor_bottom_right = - (((state->maxx - 1) + 1440) << R300_SCISSORS_X_SHIFT) | - (((state->maxy - 1) + 1440) << R300_SCISSORS_Y_SHIFT); - } + r300_set_scissor_regs(state, &r300->scissor_state->scissor, + r300_screen(r300->context.screen)->caps->is_r500); - r300->dirty_state |= R300_NEW_SCISSOR; + /* Don't rely on the order of states being set for the first time. */ + if (!r300->rs_state || r300->rs_state->rs.scissor) { + r300->dirty_state |= R300_NEW_SCISSOR; + } } static void r300_set_viewport_state(struct pipe_context* pipe, -- cgit v1.2.3 From 07487643515edb731c6abc3e931c329a89dd9293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 5 Dec 2009 20:39:11 +0100 Subject: r300g: don't render if everything is culled by scissoring Otherwise a CS is refused by kernel 2.6.31 (and maybe all later versions, not sure). --- src/gallium/drivers/r300/r300_context.h | 3 +++ src/gallium/drivers/r300/r300_render.c | 23 +++++++++++++++++++++++ src/gallium/drivers/r300/r300_state.c | 3 +++ 3 files changed, 29 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 23ea32c57e..0be190392a 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -101,6 +101,9 @@ struct r300_sampler_state { struct r300_scissor_regs { uint32_t top_left; /* R300_SC_SCISSORS_TL: 0x43e0 */ uint32_t bottom_right; /* R300_SC_SCISSORS_BR: 0x43e4 */ + + /* Whether everything is culled by scissoring. */ + boolean empty_area; }; struct r300_scissor_state { diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 4c5fb405c6..35b335df6a 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -70,6 +70,12 @@ uint32_t r300_translate_primitive(unsigned prim) } } +static boolean r300_nothing_to_draw(struct r300_context *r300) +{ + return r300->rs_state->rs.scissor && + r300->scissor_state->scissor.empty_area; +} + static void r300_emit_draw_arrays(struct r300_context *r300, unsigned mode, unsigned count) @@ -173,10 +179,15 @@ boolean r300_draw_range_elements(struct pipe_context* pipe, return FALSE; } + if (count > 65535) { return FALSE; } + if (r300_nothing_to_draw(r300)) { + return TRUE; + } + r300_update_derived_state(r300); if (!r300_setup_vertex_buffers(r300)) { @@ -218,6 +229,10 @@ boolean r300_draw_arrays(struct pipe_context* pipe, unsigned mode, return FALSE; } + if (r300_nothing_to_draw(r300)) { + return TRUE; + } + r300_update_derived_state(r300); if (!r300_setup_vertex_buffers(r300)) { @@ -251,6 +266,10 @@ boolean r300_swtcl_draw_arrays(struct pipe_context* pipe, return FALSE; } + if (r300_nothing_to_draw(r300)) { + return TRUE; + } + for (i = 0; i < r300->vertex_buffer_count; i++) { void* buf = pipe_buffer_map(pipe->screen, r300->vertex_buffer[i].buffer, @@ -292,6 +311,10 @@ boolean r300_swtcl_draw_range_elements(struct pipe_context* pipe, return FALSE; } + if (r300_nothing_to_draw(r300)) { + return TRUE; + } + for (i = 0; i < r300->vertex_buffer_count; i++) { void* buf = pipe_buffer_map(pipe->screen, r300->vertex_buffer[i].buffer, diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index d3233557ce..8ef0b3b268 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -309,6 +309,9 @@ static void r300_set_scissor_regs(const struct pipe_scissor_state* state, (((state->maxx - 1) + 1440) << R300_SCISSORS_X_SHIFT) | (((state->maxy - 1) + 1440) << R300_SCISSORS_Y_SHIFT); } + + scissor->empty_area = state->minx >= state->maxx || + state->miny >= state->maxy; } static void -- cgit v1.2.3 From 7005f7cd1a9947e75bf772897d9055e3fe467c3d Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Fri, 20 Nov 2009 16:33:25 -0800 Subject: st/egl: Fix memory leak in egl_tracker.c. (cherry picked from commit 052b127842af3372fd768eae8e29b240a696a12a) --- src/gallium/state_trackers/egl/egl_tracker.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/egl/egl_tracker.c b/src/gallium/state_trackers/egl/egl_tracker.c index 5140755001..4548b4fd27 100644 --- a/src/gallium/state_trackers/egl/egl_tracker.c +++ b/src/gallium/state_trackers/egl/egl_tracker.c @@ -85,11 +85,11 @@ drm_get_device_id(struct drm_device *device) } ret = fgets(path, sizeof( path ), file); + fclose(file); if (!ret) return; sscanf(path, "%x", &device->deviceID); - fclose(file); } static void -- cgit v1.2.3 From c574f515f0aa20ccc3841cf61a6124bc5996e7b2 Mon Sep 17 00:00:00 2001 From: Younes Manton Date: Sun, 6 Dec 2009 12:26:55 -0500 Subject: nouveau: Work around nv04-nv40 miptrees not matching nouveau_miptree. Thanks to Bob Gleitsmann for the patch. I'll clean this up in a better way later if noone else beats me to it. --- src/gallium/drivers/nv04/nv04_miptree.c | 3 ++- src/gallium/drivers/nv04/nv04_state.h | 1 + src/gallium/drivers/nv10/nv10_miptree.c | 2 ++ src/gallium/drivers/nv10/nv10_state.h | 1 + src/gallium/drivers/nv20/nv20_miptree.c | 2 ++ src/gallium/drivers/nv20/nv20_state.h | 1 + src/gallium/drivers/nv30/nv30_miptree.c | 2 ++ src/gallium/drivers/nv30/nv30_state.h | 1 + src/gallium/drivers/nv40/nv40_miptree.c | 5 ++++- src/gallium/drivers/nv40/nv40_state.h | 1 + 10 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv04/nv04_miptree.c b/src/gallium/drivers/nv04/nv04_miptree.c index eeab6dfa30..e0a6948aeb 100644 --- a/src/gallium/drivers/nv04/nv04_miptree.c +++ b/src/gallium/drivers/nv04/nv04_miptree.c @@ -55,7 +55,7 @@ nv04_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt) FREE(mt); return NULL; } - + mt->bo = nouveau_bo(mt->buffer); return &mt->base; } @@ -81,6 +81,7 @@ nv04_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt, mt->level[0].image_offset = CALLOC(1, sizeof(unsigned)); pipe_buffer_reference(&mt->buffer, pb); + mt->bo = nouveau_bo(mt->buffer); return &mt->base; } diff --git a/src/gallium/drivers/nv04/nv04_state.h b/src/gallium/drivers/nv04/nv04_state.h index 399f750dbe..81d1d2ebaa 100644 --- a/src/gallium/drivers/nv04/nv04_state.h +++ b/src/gallium/drivers/nv04/nv04_state.h @@ -31,6 +31,7 @@ struct nv04_rasterizer_state { struct nv04_miptree { struct pipe_texture base; + struct nouveau_bo *bo; struct pipe_buffer *buffer; uint total_size; diff --git a/src/gallium/drivers/nv10/nv10_miptree.c b/src/gallium/drivers/nv10/nv10_miptree.c index 439beeccc3..6a52b6af36 100644 --- a/src/gallium/drivers/nv10/nv10_miptree.c +++ b/src/gallium/drivers/nv10/nv10_miptree.c @@ -67,6 +67,7 @@ nv10_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt, mt->level[0].image_offset = CALLOC(1, sizeof(unsigned)); pipe_buffer_reference(&mt->buffer, pb); + mt->bo = nouveau_bo(mt->buffer); return &mt->base; } @@ -90,6 +91,7 @@ nv10_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt) FREE(mt); return NULL; } + mt->bo = nouveau_bo(mt->buffer); return &mt->base; } diff --git a/src/gallium/drivers/nv10/nv10_state.h b/src/gallium/drivers/nv10/nv10_state.h index 3a3fd0d4f4..2524ac02e2 100644 --- a/src/gallium/drivers/nv10/nv10_state.h +++ b/src/gallium/drivers/nv10/nv10_state.h @@ -126,6 +126,7 @@ struct nv10_depth_stencil_alpha_state { struct nv10_miptree { struct pipe_texture base; + struct nouveau_bo *bo; struct pipe_buffer *buffer; uint total_size; diff --git a/src/gallium/drivers/nv20/nv20_miptree.c b/src/gallium/drivers/nv20/nv20_miptree.c index 2bde9fb75b..e2e01bd849 100644 --- a/src/gallium/drivers/nv20/nv20_miptree.c +++ b/src/gallium/drivers/nv20/nv20_miptree.c @@ -77,6 +77,7 @@ nv20_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt, mt->level[0].image_offset = CALLOC(1, sizeof(unsigned)); pipe_buffer_reference(&mt->buffer, pb); + mt->bo = nouveau_bo(mt->buffer); return &mt->base; } @@ -132,6 +133,7 @@ nv20_miptree_create(struct pipe_screen *screen, const struct pipe_texture *pt) FREE(mt); return NULL; } + mt->bo = nouveau_bo(mt->buffer); return &mt->base; } diff --git a/src/gallium/drivers/nv20/nv20_state.h b/src/gallium/drivers/nv20/nv20_state.h index 34f402fdcb..dde4106568 100644 --- a/src/gallium/drivers/nv20/nv20_state.h +++ b/src/gallium/drivers/nv20/nv20_state.h @@ -126,6 +126,7 @@ struct nv20_depth_stencil_alpha_state { struct nv20_miptree { struct pipe_texture base; + struct nouveau_bo *bo; struct pipe_buffer *buffer; uint total_size; diff --git a/src/gallium/drivers/nv30/nv30_miptree.c b/src/gallium/drivers/nv30/nv30_miptree.c index 9e50a7cf6b..920fe64c32 100644 --- a/src/gallium/drivers/nv30/nv30_miptree.c +++ b/src/gallium/drivers/nv30/nv30_miptree.c @@ -115,6 +115,7 @@ nv30_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt) FREE(mt); return NULL; } + mt->bo = nouveau_bo(mt->buffer); return &mt->base; } @@ -144,6 +145,7 @@ nv30_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt, mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR; pipe_buffer_reference(&mt->buffer, pb); + mt->bo = nouveau_bo(mt->buffer); return &mt->base; } diff --git a/src/gallium/drivers/nv30/nv30_state.h b/src/gallium/drivers/nv30/nv30_state.h index e6f23bf166..e42e872de7 100644 --- a/src/gallium/drivers/nv30/nv30_state.h +++ b/src/gallium/drivers/nv30/nv30_state.h @@ -72,6 +72,7 @@ struct nv30_fragment_program { struct nv30_miptree { struct pipe_texture base; + struct nouveau_bo *bo; struct pipe_buffer *buffer; uint total_size; diff --git a/src/gallium/drivers/nv40/nv40_miptree.c b/src/gallium/drivers/nv40/nv40_miptree.c index 8779c5572b..89ddf373e9 100644 --- a/src/gallium/drivers/nv40/nv40_miptree.c +++ b/src/gallium/drivers/nv40/nv40_miptree.c @@ -5,6 +5,8 @@ #include "nv40_context.h" + + static void nv40_miptree_layout(struct nv40_miptree *mt) { @@ -109,7 +111,7 @@ nv40_miptree_create(struct pipe_screen *pscreen, const struct pipe_texture *pt) FREE(mt); return NULL; } - + mt->bo = nouveau_bo(mt->buffer); return &mt->base; } @@ -138,6 +140,7 @@ nv40_miptree_blanket(struct pipe_screen *pscreen, const struct pipe_texture *pt, mt->base.tex_usage |= NOUVEAU_TEXTURE_USAGE_LINEAR; pipe_buffer_reference(&mt->buffer, pb); + mt->bo = nouveau_bo(mt->buffer); return &mt->base; } diff --git a/src/gallium/drivers/nv40/nv40_state.h b/src/gallium/drivers/nv40/nv40_state.h index 8a9d8c8fdf..192074e747 100644 --- a/src/gallium/drivers/nv40/nv40_state.h +++ b/src/gallium/drivers/nv40/nv40_state.h @@ -75,6 +75,7 @@ struct nv40_fragment_program { struct nv40_miptree { struct pipe_texture base; + struct nouveau_bo *bo; struct pipe_buffer *buffer; uint total_size; -- cgit v1.2.3 From 7091afed789dbba8364deaea0b7a5a99a12ff25e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sat, 5 Dec 2009 01:27:59 +0100 Subject: r300g: enhance ZTOP conditions --- src/gallium/drivers/r300/r300_state_derived.c | 37 ++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index cd969d633b..d448866ef0 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -462,6 +462,31 @@ static void r300_update_derived_shader_state(struct r300_context* r300) r300->dirty_state |= R300_NEW_RS_BLOCK; } +static boolean r300_dsa_writes_depth_stencil(struct r300_dsa_state* dsa) +{ + /* We are interested only in the cases when a new depth or stencil value + * can be written and changed. */ + + /* We might optionally check for [Z func: never] and inspect the stencil + * state in a similar fashion, but it's not terribly important. */ + return (dsa->z_buffer_control & R300_Z_WRITE_ENABLE) + || + (dsa->stencil_ref_mask & R300_STENCILWRITEMASK_MASK) + || + ((dsa->z_buffer_control & R500_STENCIL_REFMASK_FRONT_BACK) && + (dsa->stencil_ref_bf & R300_STENCILWRITEMASK_MASK)); +} + +static boolean r300_dsa_alpha_test_enabled(struct r300_dsa_state* dsa) +{ + /* We are interested only in the cases when alpha testing can kill + * a fragment. */ + uint32_t af = dsa->alpha_function; + + return (af & R300_FG_ALPHA_FUNC_ENABLE) && + (af & R300_FG_ALPHA_FUNC_ALWAYS) != R300_FG_ALPHA_FUNC_ALWAYS; +} + static void r300_update_ztop(struct r300_context* r300) { r300->ztop_state.z_buffer_top = R300_ZTOP_ENABLE; @@ -484,13 +509,13 @@ static void r300_update_ztop(struct r300_context* r300) * * ~C. */ - if (r300->dsa_state->alpha_function) { - r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE; - } else if (r300->fs->info.uses_kill) { - r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE; - } else if (r300_fragment_shader_writes_depth(r300->fs)) { + + if (r300->query_current || + r300_fragment_shader_writes_depth(r300->fs)) { r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE; - } else if (r300->query_current) { + } else if (r300_dsa_writes_depth_stencil(r300->dsa_state) && + (r300->fs->info.uses_kill || + r300_dsa_alpha_test_enabled(r300->dsa_state))) { r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE; } } -- cgit v1.2.3 From c99fb991a3b46c5978248b00eef0efd742127a44 Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 6 Dec 2009 23:33:41 -0800 Subject: r300g: Clean up previous commit. If *I* can't read it, there's a strong possibility others can't, either. --- src/gallium/drivers/r300/r300_state_derived.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index d448866ef0..6af49888b9 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -469,10 +469,8 @@ static boolean r300_dsa_writes_depth_stencil(struct r300_dsa_state* dsa) /* We might optionally check for [Z func: never] and inspect the stencil * state in a similar fashion, but it's not terribly important. */ - return (dsa->z_buffer_control & R300_Z_WRITE_ENABLE) - || - (dsa->stencil_ref_mask & R300_STENCILWRITEMASK_MASK) - || + return (dsa->z_buffer_control & R300_Z_WRITE_ENABLE) || + (dsa->stencil_ref_mask & R300_STENCILWRITEMASK_MASK) || ((dsa->z_buffer_control & R500_STENCIL_REFMASK_FRONT_BACK) && (dsa->stencil_ref_bf & R300_STENCILWRITEMASK_MASK)); } @@ -503,19 +501,25 @@ static void r300_update_ztop(struct r300_context* r300) * The docs claim that for the first three cases, if no ZS writes happen, * then ZTOP can be used. * + * (3) will never apply since we do not support chroma-keyed operations. + * (4) will need to be re-examined (and this comment updated) if/when + * Hyper-Z becomes supported. + * * Additionally, the following conditions require disabled ZTOP: - * ~) Depth writes in fragment shader - * ~) Outstanding occlusion queries + * 5) Depth writes in fragment shader + * 6) Outstanding occlusion queries * * ~C. */ - if (r300->query_current || - r300_fragment_shader_writes_depth(r300->fs)) { + /* ZS writes */ + if (r300_dsa_writes_depth_stencil(r300->dsa_state) && + (r300_dsa_alpha_test_enabled(r300->dsa_state) || /* (1) */ + r300->fs->info.uses_kill)) { /* (2) */ + r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE; + } else if (r300_fragment_shader_writes_depth(r300->fs)) { /* (5) */ r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE; - } else if (r300_dsa_writes_depth_stencil(r300->dsa_state) && - (r300->fs->info.uses_kill || - r300_dsa_alpha_test_enabled(r300->dsa_state))) { + } else if (r300->query_current) { /* (6) */ r300->ztop_state.z_buffer_top = R300_ZTOP_DISABLE; } } -- cgit v1.2.3 From d8d8b0d244d9abfd16f99de7f2f30c635033f66f Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 6 Dec 2009 23:49:02 -0800 Subject: softpipe: sp_winsys.h should define/include what it needs. --- src/gallium/drivers/softpipe/sp_winsys.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/softpipe/sp_winsys.h b/src/gallium/drivers/softpipe/sp_winsys.h index 9e571862b7..f203ded29e 100644 --- a/src/gallium/drivers/softpipe/sp_winsys.h +++ b/src/gallium/drivers/softpipe/sp_winsys.h @@ -34,15 +34,17 @@ #ifndef SP_WINSYS_H #define SP_WINSYS_H - #ifdef __cplusplus extern "C" { #endif +#include "pipe/p_defines.h" struct pipe_screen; struct pipe_winsys; struct pipe_context; +struct pipe_texture; +struct pipe_buffer; struct pipe_context *softpipe_create( struct pipe_screen * ); -- cgit v1.2.3 From e3a3ca097c1859c59daf99b722a788cd432b40dc Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 6 Dec 2009 23:50:31 -0800 Subject: radeong: Call softpipe_create directly. Allows us to finally remove radeon_winsys_softpipe. --- src/gallium/winsys/drm/radeon/core/Makefile | 3 +- src/gallium/winsys/drm/radeon/core/SConscript | 1 - src/gallium/winsys/drm/radeon/core/radeon_drm.c | 4 +- src/gallium/winsys/drm/radeon/core/radeon_drm.h | 1 - .../drm/radeon/core/radeon_winsys_softpipe.c | 41 -------------------- .../drm/radeon/core/radeon_winsys_softpipe.h | 44 ---------------------- 6 files changed, 4 insertions(+), 90 deletions(-) delete mode 100644 src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c delete mode 100644 src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.h (limited to 'src') diff --git a/src/gallium/winsys/drm/radeon/core/Makefile b/src/gallium/winsys/drm/radeon/core/Makefile index 42a6f4abc2..860cbb6dbf 100644 --- a/src/gallium/winsys/drm/radeon/core/Makefile +++ b/src/gallium/winsys/drm/radeon/core/Makefile @@ -7,8 +7,7 @@ LIBNAME = radeonwinsys C_SOURCES = \ radeon_buffer.c \ radeon_drm.c \ - radeon_r300.c \ - radeon_winsys_softpipe.c + radeon_r300.c LIBRARY_INCLUDES = -I$(TOP)/src/gallium/drivers/r300 \ $(shell pkg-config libdrm --cflags-only-I) diff --git a/src/gallium/winsys/drm/radeon/core/SConscript b/src/gallium/winsys/drm/radeon/core/SConscript index 2ad68e403f..f4e9c397bd 100644 --- a/src/gallium/winsys/drm/radeon/core/SConscript +++ b/src/gallium/winsys/drm/radeon/core/SConscript @@ -6,7 +6,6 @@ radeon_sources = [ 'radeon_buffer.c', 'radeon_drm.c', 'radeon_r300.c', - 'radeon_winsys_softpipe.c', ] env.Append(CPPPATH = '#/src/gallium/drivers/r300') diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c index 5241972533..bc66b42fa7 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c @@ -29,6 +29,8 @@ * Joakim Sindholt */ +#include "softpipe/sp_winsys.h" + #include "radeon_drm.h" /* Helper function to do the ioctls needed for setup and init. */ @@ -123,7 +125,7 @@ struct pipe_context* radeon_create_context(struct drm_api* api, struct pipe_screen* screen) { if (debug_get_bool_option("RADEON_SOFTPIPE", FALSE)) { - return radeon_create_softpipe(screen->winsys); + return softpipe_create(screen); } else { return r300_create_context(screen, (struct radeon_winsys*)screen->winsys); diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.h b/src/gallium/winsys/drm/radeon/core/radeon_drm.h index 9a789ec1a4..bf0e78138d 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_drm.h +++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.h @@ -44,7 +44,6 @@ #include "radeon_buffer.h" #include "radeon_r300.h" -#include "radeon_winsys_softpipe.h" /* XXX */ #include "r300_screen.h" diff --git a/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c b/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c deleted file mode 100644 index f038bfa40e..0000000000 --- a/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.c +++ /dev/null @@ -1,41 +0,0 @@ -/************************************************************************** - * - * Copyright 2006 Tungsten Graphics, Inc., Bismarck, ND., USA - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR - * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - * - * - **************************************************************************/ -/* - * Authors: Keith Whitwell - */ - -#include "radeon_winsys_softpipe.h" - -struct pipe_context *radeon_create_softpipe(struct pipe_winsys* winsys) -{ - struct pipe_screen *pipe_screen; - - pipe_screen = softpipe_create_screen(winsys); - - return softpipe_create(pipe_screen); -} diff --git a/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.h b/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.h deleted file mode 100644 index 04740e41a5..0000000000 --- a/src/gallium/winsys/drm/radeon/core/radeon_winsys_softpipe.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright © 2008 Jérôme Glisse - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sub license, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS, AUTHORS - * AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - * USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * The above copyright notice and this permission notice (including the - * next paragraph) shall be included in all copies or substantial portions - * of the Software. - */ -/* - * Authors: - * Jérôme Glisse - */ -#ifndef RADEON_WINSYS_SOFTPIPE_H -#define RADEON_WINSYS_SOFTPIPE_H - -#include - -#include "pipe/p_defines.h" -#include "pipe/p_format.h" - -#include "softpipe/sp_winsys.h" - -#include "util/u_memory.h" - -struct pipe_context *radeon_create_softpipe(struct pipe_winsys* winsys); - -#endif -- cgit v1.2.3 From 12981589b729de0242d6ea74d8e4e9889793088c Mon Sep 17 00:00:00 2001 From: Corbin Simpson Date: Sun, 6 Dec 2009 23:55:58 -0800 Subject: radeong: Automatically softpipe for non-r3xx. Well, technically non-r[345]xx. At any rate... $ glxgears libGL: OpenDriver: trying /home/simpson/mesa/lib/gallium/r600_dri.so 131 frames in 5.0 seconds = 26.107 FPS I'm sure you can see where this is going. :3 --- src/gallium/winsys/drm/radeon/core/radeon_drm.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c index bc66b42fa7..dec7c06503 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c @@ -109,14 +109,15 @@ struct pipe_screen* radeon_create_screen(struct drm_api* api, int drmFB, struct drm_create_screen_arg *arg) { - struct radeon_winsys* winsys = radeon_pipe_winsys(drmFB); - do_ioctls(drmFB, winsys); + struct radeon_winsys* rwinsys = radeon_pipe_winsys(drmFB); + do_ioctls(drmFB, rwinsys); - if (debug_get_bool_option("RADEON_SOFTPIPE", FALSE)) { - return softpipe_create_screen((struct pipe_winsys*)winsys); + if (!is_r3xx(rwinsys->pci_id) || + debug_get_bool_option("RADEON_SOFTPIPE", FALSE)) { + return softpipe_create_screen((struct pipe_winsys*)rwinsys); } else { - radeon_setup_winsys(drmFB, winsys); - return r300_create_screen(winsys); + radeon_setup_winsys(drmFB, rwinsys); + return r300_create_screen(rwinsys); } } @@ -124,11 +125,13 @@ struct pipe_screen* radeon_create_screen(struct drm_api* api, struct pipe_context* radeon_create_context(struct drm_api* api, struct pipe_screen* screen) { - if (debug_get_bool_option("RADEON_SOFTPIPE", FALSE)) { + struct radeon_winsys* rwinsys = (struct radeon_winsys*)screen->winsys; + + if (!is_r3xx(rwinsys->pci_id) || + debug_get_bool_option("RADEON_SOFTPIPE", FALSE)) { return softpipe_create(screen); } else { - return r300_create_context(screen, - (struct radeon_winsys*)screen->winsys); + return r300_create_context(screen, rwinsys); } } -- cgit v1.2.3 From 8468234bfa98be77cbceecc8e91325c00e4e424b Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 7 Dec 2009 08:59:38 -0700 Subject: st/mesa: fix up comment --- src/mesa/state_tracker/st_program.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index d66f45d13e..5c81a033f9 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -49,8 +49,11 @@ #include "st_mesa_to_tgsi.h" #include "cso_cache/cso_context.h" - /* Clean out any old compilations: - */ + + +/** + * Clean out any old compilations: + */ void st_vp_release_varients( struct st_context *st, struct st_vertex_program *stvp ) -- cgit v1.2.3 From 8ce17134431ec27666e8fba2fa4bd22ba3f3ed18 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 7 Dec 2009 09:00:57 -0700 Subject: st/mesa: negate DDY to match GL semantics This fixes the regression from commit 884007546c98b1779bf266ec5111b1e7e2b68b2e Fixes bug 25456 (piglit derivs regression). --- src/mesa/state_tracker/st_mesa_to_tgsi.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index 5e76f4db4e..bf80274c44 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -396,6 +396,23 @@ static void emit_swz( struct st_translate *t, } +/** + * Negate the value of DDY to match GL semantics where (0,0) is the + * lower-left corner of the window. + * Note that the GL_ARB_fragment_coord_conventions extension will + * effect this someday. + */ +static void emit_ddy( struct st_translate *t, + struct ureg_dst dst, + const struct prog_src_register *SrcReg ) +{ + struct ureg_program *ureg = t->ureg; + struct ureg_src src = translate_src( t, SrcReg ); + if(1) src = ureg_negate( src ); + ureg_DDY( ureg, dst, src ); +} + + static unsigned translate_opcode( unsigned op ) @@ -619,7 +636,9 @@ compile_instruction( ureg_MOV( ureg, dst[0], ureg_imm1f(ureg, 0.5) ); break; - + case OPCODE_DDY: + emit_ddy( t, dst[0], &inst->SrcReg[0] ); + break; default: ureg_insn( ureg, -- cgit v1.2.3 From c90baf444ca91d06ae5be392a04c0c8119cb08dd Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 7 Dec 2009 09:05:40 -0700 Subject: st/mesa: remove debug code --- src/mesa/state_tracker/st_mesa_to_tgsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/state_tracker/st_mesa_to_tgsi.c b/src/mesa/state_tracker/st_mesa_to_tgsi.c index bf80274c44..1611d53e2f 100644 --- a/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -408,7 +408,7 @@ static void emit_ddy( struct st_translate *t, { struct ureg_program *ureg = t->ureg; struct ureg_src src = translate_src( t, SrcReg ); - if(1) src = ureg_negate( src ); + src = ureg_negate( src ); ureg_DDY( ureg, dst, src ); } -- cgit v1.2.3 From ac66598ed8bc218720cf2a1a7493b7e25ca9d962 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 7 Dec 2009 18:12:05 +0100 Subject: util/tile: Support R8G8B8A8_UNORM format. --- src/gallium/auxiliary/util/u_tile.c | 56 +++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_tile.c b/src/gallium/auxiliary/util/u_tile.c index 4f34f8a1a6..88c9a1f097 100644 --- a/src/gallium/auxiliary/util/u_tile.c +++ b/src/gallium/auxiliary/util/u_tile.c @@ -247,6 +247,53 @@ b8g8r8a8_put_tile_rgba(unsigned *dst, } +/*** PIPE_FORMAT_R8G8B8A8_UNORM ***/ + +static void +r8g8b8a8_get_tile_rgba(const unsigned *src, + unsigned w, unsigned h, + float *p, + unsigned dst_stride) +{ + unsigned i, j; + + for (i = 0; i < h; i++) { + float *pRow = p; + for (j = 0; j < w; j++, pRow += 4) { + const unsigned pixel = *src++; + pRow[0] = ubyte_to_float((pixel >> 24) & 0xff); + pRow[1] = ubyte_to_float((pixel >> 16) & 0xff); + pRow[2] = ubyte_to_float((pixel >> 8) & 0xff); + pRow[3] = ubyte_to_float((pixel >> 0) & 0xff); + } + p += dst_stride; + } +} + + +static void +r8g8b8a8_put_tile_rgba(unsigned *dst, + unsigned w, unsigned h, + const float *p, + unsigned src_stride) +{ + unsigned i, j; + + for (i = 0; i < h; i++) { + const float *pRow = p; + for (j = 0; j < w; j++, pRow += 4) { + unsigned r, g, b, a; + r = float_to_ubyte(pRow[0]); + g = float_to_ubyte(pRow[1]); + b = float_to_ubyte(pRow[2]); + a = float_to_ubyte(pRow[3]); + *dst++ = (r << 24) | (g << 16) | (b << 8) | a; + } + p += src_stride; + } +} + + /*** PIPE_FORMAT_A1R5G5B5_UNORM ***/ static void @@ -1144,6 +1191,9 @@ pipe_tile_raw_to_rgba(enum pipe_format format, case PIPE_FORMAT_B8G8R8A8_UNORM: b8g8r8a8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride); break; + case PIPE_FORMAT_R8G8B8A8_UNORM: + r8g8b8a8_get_tile_rgba((unsigned *) src, w, h, dst, dst_stride); + break; case PIPE_FORMAT_A1R5G5B5_UNORM: a1r5g5b5_get_tile_rgba((ushort *) src, w, h, dst, dst_stride); break; @@ -1268,6 +1318,9 @@ pipe_put_tile_rgba(struct pipe_transfer *pt, case PIPE_FORMAT_B8G8R8A8_UNORM: b8g8r8a8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride); break; + case PIPE_FORMAT_R8G8B8A8_UNORM: + r8g8b8a8_put_tile_rgba((unsigned *) packed, w, h, p, src_stride); + break; case PIPE_FORMAT_A1R5G5B5_UNORM: a1r5g5b5_put_tile_rgba((ushort *) packed, w, h, p, src_stride); break; @@ -1277,9 +1330,6 @@ pipe_put_tile_rgba(struct pipe_transfer *pt, case PIPE_FORMAT_R8G8B8_UNORM: r8g8b8_put_tile_rgba((ubyte *) packed, w, h, p, src_stride); break; - case PIPE_FORMAT_R8G8B8A8_UNORM: - assert(0); - break; case PIPE_FORMAT_A4R4G4B4_UNORM: a4r4g4b4_put_tile_rgba((ushort *) packed, w, h, p, src_stride); break; -- cgit v1.2.3 From c36d1aacf4c70d76165c91cd7048c0f9f43b8571 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Mon, 7 Dec 2009 20:11:46 +0100 Subject: mesa: fix strict aliasing issues in half-to-float/float-to-half conversions use union instead of casts --- src/mesa/main/imports.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index c9e00cf752..f2ef84f35c 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -460,7 +460,7 @@ _mesa_inv_sqrtf(float n) #if 0 /* not used, see below -BP */ float r3, x3, y3; #endif - union { float f; unsigned int i; } u; + fi_type u; unsigned int magic; /* @@ -649,10 +649,10 @@ _mesa_bitcount(unsigned int n) GLhalfARB _mesa_float_to_half(float val) { - const int flt = *((int *) (void *) &val); - const int flt_m = flt & 0x7fffff; - const int flt_e = (flt >> 23) & 0xff; - const int flt_s = (flt >> 31) & 0x1; + const fi_type fi = {val}; + const int flt_m = fi.i & 0x7fffff; + const int flt_e = (fi.i >> 23) & 0xff; + const int flt_s = (fi.i >> 31) & 0x1; int s, e, m = 0; GLhalfARB result; @@ -739,7 +739,8 @@ _mesa_half_to_float(GLhalfARB val) const int m = val & 0x3ff; const int e = (val >> 10) & 0x1f; const int s = (val >> 15) & 0x1; - int flt_m, flt_e, flt_s, flt; + int flt_m, flt_e, flt_s; + fi_type fi; float result; /* sign bit */ @@ -774,8 +775,8 @@ _mesa_half_to_float(GLhalfARB val) flt_m = m << 13; } - flt = (flt_s << 31) | (flt_e << 23) | flt_m; - result = *((float *) (void *) &flt); + fi.i = (flt_s << 31) | (flt_e << 23) | flt_m; + result = fi.f; return result; } -- cgit v1.2.3 From 3456f9149b3009fcfce80054759d05883d3c4ee5 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Mon, 7 Dec 2009 20:35:42 +0100 Subject: gallium/util: fix util_color_[un]pack[-ub] to be strict aliasing safe use pointer to union instead of void pointer. gcc complained a lot, depending what the pointer originally actually was. Looks like it's in fact maybe legal to cast for instance uint pointers to union pointers as long as union contains a uint type, hence use this with some callers, other just use union util_color in the first place. --- src/gallium/auxiliary/util/u_clear.h | 8 +- src/gallium/auxiliary/util/u_pack_color.h | 147 +++++++++++-------------- src/gallium/drivers/cell/ppu/cell_clear.c | 6 +- src/gallium/drivers/llvmpipe/lp_clear.c | 5 +- src/gallium/drivers/r300/r300_state.c | 4 +- src/gallium/drivers/softpipe/sp_clear.c | 7 +- src/gallium/drivers/svga/svga_pipe_clear.c | 6 +- src/gallium/drivers/svga/svga_pipe_sampler.c | 2 +- src/gallium/state_trackers/vega/vg_translate.c | 54 ++++----- src/mesa/state_tracker/st_atom_pixeltransfer.c | 2 +- 10 files changed, 113 insertions(+), 128 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_clear.h b/src/gallium/auxiliary/util/u_clear.h index 1e65a035ae..2c32db6175 100644 --- a/src/gallium/auxiliary/util/u_clear.h +++ b/src/gallium/auxiliary/util/u_clear.h @@ -46,13 +46,13 @@ util_clear(struct pipe_context *pipe, { if (buffers & PIPE_CLEAR_COLOR) { struct pipe_surface *ps = framebuffer->cbufs[0]; - unsigned color; + union util_color uc; - util_pack_color(rgba, ps->format, &color); + util_pack_color(rgba, ps->format, &uc); if (pipe->surface_fill) { - pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, color); + pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, uc.ui); } else { - util_surface_fill(pipe, ps, 0, 0, ps->width, ps->height, color); + util_surface_fill(pipe, ps, 0, 0, ps->width, ps->height, uc.ui); } } diff --git a/src/gallium/auxiliary/util/u_pack_color.h b/src/gallium/auxiliary/util/u_pack_color.h index 9dacc6d83d..a2e0f26686 100644 --- a/src/gallium/auxiliary/util/u_pack_color.h +++ b/src/gallium/auxiliary/util/u_pack_color.h @@ -40,101 +40,97 @@ #include "util/u_math.h" + +union util_color { + ubyte ub; + ushort us; + uint ui; + float f[4]; +}; + /** * Pack ubyte R,G,B,A into dest pixel. */ static INLINE void util_pack_color_ub(ubyte r, ubyte g, ubyte b, ubyte a, - enum pipe_format format, void *dest) + enum pipe_format format, union util_color *uc) { switch (format) { case PIPE_FORMAT_R8G8B8A8_UNORM: { - uint *d = (uint *) dest; - *d = (r << 24) | (g << 16) | (b << 8) | a; + uc->ui = (r << 24) | (g << 16) | (b << 8) | a; } return; case PIPE_FORMAT_R8G8B8X8_UNORM: { - uint *d = (uint *) dest; - *d = (r << 24) | (g << 16) | (b << 8) | 0xff; + uc->ui = (r << 24) | (g << 16) | (b << 8) | 0xff; } return; case PIPE_FORMAT_A8R8G8B8_UNORM: { - uint *d = (uint *) dest; - *d = (a << 24) | (r << 16) | (g << 8) | b; + uc->ui = (a << 24) | (r << 16) | (g << 8) | b; } return; case PIPE_FORMAT_X8R8G8B8_UNORM: { - uint *d = (uint *) dest; - *d = (0xff << 24) | (r << 16) | (g << 8) | b; + uc->ui = (0xff << 24) | (r << 16) | (g << 8) | b; } return; case PIPE_FORMAT_B8G8R8A8_UNORM: { - uint *d = (uint *) dest; - *d = (b << 24) | (g << 16) | (r << 8) | a; + uc->ui = (b << 24) | (g << 16) | (r << 8) | a; } return; case PIPE_FORMAT_B8G8R8X8_UNORM: { - uint *d = (uint *) dest; - *d = (b << 24) | (g << 16) | (r << 8) | 0xff; + uc->ui = (b << 24) | (g << 16) | (r << 8) | 0xff; } return; case PIPE_FORMAT_R5G6B5_UNORM: { - ushort *d = (ushort *) dest; - *d = ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | (b >> 3); + uc->us = ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | (b >> 3); } return; case PIPE_FORMAT_A1R5G5B5_UNORM: { - ushort *d = (ushort *) dest; - *d = ((a & 0x80) << 8) | ((r & 0xf8) << 7) | ((g & 0xf8) << 2) | (b >> 3); + uc->us = ((a & 0x80) << 8) | ((r & 0xf8) << 7) | ((g & 0xf8) << 2) | (b >> 3); } return; case PIPE_FORMAT_A4R4G4B4_UNORM: { - ushort *d = (ushort *) dest; - *d = ((a & 0xf0) << 8) | ((r & 0xf0) << 4) | ((g & 0xf0) << 0) | (b >> 4); + uc->us = ((a & 0xf0) << 8) | ((r & 0xf0) << 4) | ((g & 0xf0) << 0) | (b >> 4); } return; case PIPE_FORMAT_A8_UNORM: { - ubyte *d = (ubyte *) dest; - *d = a; + uc->ub = a; } return; case PIPE_FORMAT_L8_UNORM: case PIPE_FORMAT_I8_UNORM: { - ubyte *d = (ubyte *) dest; - *d = r; + uc->ub = a; } return; case PIPE_FORMAT_R32G32B32A32_FLOAT: { - float *d = (float *) dest; - d[0] = (float)r / 255.0f; - d[1] = (float)g / 255.0f; - d[2] = (float)b / 255.0f; - d[3] = (float)a / 255.0f; + uc->f[0] = (float)r / 255.0f; + uc->f[1] = (float)g / 255.0f; + uc->f[2] = (float)b / 255.0f; + uc->f[3] = (float)a / 255.0f; } return; case PIPE_FORMAT_R32G32B32_FLOAT: { - float *d = (float *) dest; - d[0] = (float)r / 255.0f; - d[1] = (float)g / 255.0f; - d[2] = (float)b / 255.0f; + uc->f[0] = (float)r / 255.0f; + uc->f[1] = (float)g / 255.0f; + uc->f[2] = (float)b / 255.0f; } return; /* XXX lots more cases to add */ default: + uc->ui = 0; /* keep compiler happy */ debug_print_format("gallium: unhandled format in util_pack_color_ub()", format); assert(0); } @@ -145,13 +141,13 @@ util_pack_color_ub(ubyte r, ubyte g, ubyte b, ubyte a, * Unpack RGBA from a packed pixel, returning values as ubytes in [0,255]. */ static INLINE void -util_unpack_color_ub(enum pipe_format format, const void *src, +util_unpack_color_ub(enum pipe_format format, union util_color *uc, ubyte *r, ubyte *g, ubyte *b, ubyte *a) { switch (format) { case PIPE_FORMAT_R8G8B8A8_UNORM: { - uint p = ((const uint *) src)[0]; + uint p = uc->ui; *r = (ubyte) ((p >> 24) & 0xff); *g = (ubyte) ((p >> 16) & 0xff); *b = (ubyte) ((p >> 8) & 0xff); @@ -160,7 +156,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src, return; case PIPE_FORMAT_R8G8B8X8_UNORM: { - uint p = ((const uint *) src)[0]; + uint p = uc->ui; *r = (ubyte) ((p >> 24) & 0xff); *g = (ubyte) ((p >> 16) & 0xff); *b = (ubyte) ((p >> 8) & 0xff); @@ -169,7 +165,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src, return; case PIPE_FORMAT_A8R8G8B8_UNORM: { - uint p = ((const uint *) src)[0]; + uint p = uc->ui; *r = (ubyte) ((p >> 16) & 0xff); *g = (ubyte) ((p >> 8) & 0xff); *b = (ubyte) ((p >> 0) & 0xff); @@ -178,7 +174,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src, return; case PIPE_FORMAT_X8R8G8B8_UNORM: { - uint p = ((const uint *) src)[0]; + uint p = uc->ui; *r = (ubyte) ((p >> 16) & 0xff); *g = (ubyte) ((p >> 8) & 0xff); *b = (ubyte) ((p >> 0) & 0xff); @@ -187,7 +183,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src, return; case PIPE_FORMAT_B8G8R8A8_UNORM: { - uint p = ((const uint *) src)[0]; + uint p = uc->ui; *r = (ubyte) ((p >> 8) & 0xff); *g = (ubyte) ((p >> 16) & 0xff); *b = (ubyte) ((p >> 24) & 0xff); @@ -196,7 +192,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src, return; case PIPE_FORMAT_B8G8R8X8_UNORM: { - uint p = ((const uint *) src)[0]; + uint p = uc->ui; *r = (ubyte) ((p >> 8) & 0xff); *g = (ubyte) ((p >> 16) & 0xff); *b = (ubyte) ((p >> 24) & 0xff); @@ -205,7 +201,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src, return; case PIPE_FORMAT_R5G6B5_UNORM: { - ushort p = ((const ushort *) src)[0]; + ushort p = uc->us; *r = (ubyte) (((p >> 8) & 0xf8) | ((p >> 13) & 0x7)); *g = (ubyte) (((p >> 3) & 0xfc) | ((p >> 9) & 0x3)); *b = (ubyte) (((p << 3) & 0xf8) | ((p >> 2) & 0x7)); @@ -214,7 +210,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src, return; case PIPE_FORMAT_A1R5G5B5_UNORM: { - ushort p = ((const ushort *) src)[0]; + ushort p = uc->us; *r = (ubyte) (((p >> 7) & 0xf8) | ((p >> 12) & 0x7)); *g = (ubyte) (((p >> 2) & 0xf8) | ((p >> 7) & 0x7)); *b = (ubyte) (((p << 3) & 0xf8) | ((p >> 2) & 0x7)); @@ -223,7 +219,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src, return; case PIPE_FORMAT_A4R4G4B4_UNORM: { - ushort p = ((const ushort *) src)[0]; + ushort p = uc->us; *r = (ubyte) (((p >> 4) & 0xf0) | ((p >> 8) & 0xf)); *g = (ubyte) (((p >> 0) & 0xf0) | ((p >> 4) & 0xf)); *b = (ubyte) (((p << 4) & 0xf0) | ((p >> 0) & 0xf)); @@ -232,27 +228,27 @@ util_unpack_color_ub(enum pipe_format format, const void *src, return; case PIPE_FORMAT_A8_UNORM: { - ubyte p = ((const ubyte *) src)[0]; + ubyte p = uc->ub; *r = *g = *b = (ubyte) 0xff; *a = p; } return; case PIPE_FORMAT_L8_UNORM: { - ubyte p = ((const ubyte *) src)[0]; + ubyte p = uc->ub; *r = *g = *b = p; *a = (ubyte) 0xff; } return; case PIPE_FORMAT_I8_UNORM: { - ubyte p = ((const ubyte *) src)[0]; + ubyte p = uc->ub; *r = *g = *b = *a = p; } return; case PIPE_FORMAT_R32G32B32A32_FLOAT: { - const float *p = (const float *) src; + const float *p = &uc->f[0]; *r = float_to_ubyte(p[0]); *g = float_to_ubyte(p[1]); *b = float_to_ubyte(p[2]); @@ -261,7 +257,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src, return; case PIPE_FORMAT_R32G32B32_FLOAT: { - const float *p = (const float *) src; + const float *p = &uc->f[0]; *r = float_to_ubyte(p[0]); *g = float_to_ubyte(p[1]); *b = float_to_ubyte(p[2]); @@ -271,7 +267,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src, case PIPE_FORMAT_R32G32_FLOAT: { - const float *p = (const float *) src; + const float *p = &uc->f[0]; *r = float_to_ubyte(p[0]); *g = float_to_ubyte(p[1]); *b = *a = (ubyte) 0xff; @@ -280,7 +276,7 @@ util_unpack_color_ub(enum pipe_format format, const void *src, case PIPE_FORMAT_R32_FLOAT: { - const float *p = (const float *) src; + const float *p = &uc->f[0]; *r = float_to_ubyte(p[0]); *g = *b = *a = (ubyte) 0xff; } @@ -293,14 +289,13 @@ util_unpack_color_ub(enum pipe_format format, const void *src, assert(0); } } - /** * Note rgba outside [0,1] will be clamped for int pixel formats. */ static INLINE void -util_pack_color(const float rgba[4], enum pipe_format format, void *dest) +util_pack_color(const float rgba[4], enum pipe_format format, union util_color *uc) { ubyte r = 0; ubyte g = 0; @@ -318,90 +313,78 @@ util_pack_color(const float rgba[4], enum pipe_format format, void *dest) switch (format) { case PIPE_FORMAT_R8G8B8A8_UNORM: { - uint *d = (uint *) dest; - *d = (r << 24) | (g << 16) | (b << 8) | a; + uc->ui = (r << 24) | (g << 16) | (b << 8) | a; } return; case PIPE_FORMAT_R8G8B8X8_UNORM: { - uint *d = (uint *) dest; - *d = (r << 24) | (g << 16) | (b << 8) | 0xff; + uc->ui = (r << 24) | (g << 16) | (b << 8) | 0xff; } return; case PIPE_FORMAT_A8R8G8B8_UNORM: { - uint *d = (uint *) dest; - *d = (a << 24) | (r << 16) | (g << 8) | b; + uc->ui = (a << 24) | (r << 16) | (g << 8) | b; } return; case PIPE_FORMAT_X8R8G8B8_UNORM: { - uint *d = (uint *) dest; - *d = (0xff << 24) | (r << 16) | (g << 8) | b; + uc->ui = (0xff << 24) | (r << 16) | (g << 8) | b; } return; case PIPE_FORMAT_B8G8R8A8_UNORM: { - uint *d = (uint *) dest; - *d = (b << 24) | (g << 16) | (r << 8) | a; + uc->ui = (b << 24) | (g << 16) | (r << 8) | a; } return; case PIPE_FORMAT_B8G8R8X8_UNORM: { - uint *d = (uint *) dest; - *d = (b << 24) | (g << 16) | (r << 8) | 0xff; + uc->ui = (b << 24) | (g << 16) | (r << 8) | 0xff; } return; case PIPE_FORMAT_R5G6B5_UNORM: { - ushort *d = (ushort *) dest; - *d = ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | (b >> 3); + uc->us = ((r & 0xf8) << 8) | ((g & 0xfc) << 3) | (b >> 3); } return; case PIPE_FORMAT_A1R5G5B5_UNORM: { - ushort *d = (ushort *) dest; - *d = ((a & 0x80) << 8) | ((r & 0xf8) << 7) | ((g & 0xf8) << 2) | (b >> 3); + uc->us = ((a & 0x80) << 8) | ((r & 0xf8) << 7) | ((g & 0xf8) << 2) | (b >> 3); } return; case PIPE_FORMAT_A4R4G4B4_UNORM: { - ushort *d = (ushort *) dest; - *d = ((a & 0xf0) << 8) | ((r & 0xf0) << 4) | ((g & 0xf0) << 0) | (b >> 4); + uc->ub = ((a & 0xf0) << 8) | ((r & 0xf0) << 4) | ((g & 0xf0) << 0) | (b >> 4); } return; case PIPE_FORMAT_A8_UNORM: { - ubyte *d = (ubyte *) dest; - *d = a; + uc->ub = a; } return; case PIPE_FORMAT_L8_UNORM: case PIPE_FORMAT_I8_UNORM: { - ubyte *d = (ubyte *) dest; - *d = r; + uc->ub = r; } return; case PIPE_FORMAT_R32G32B32A32_FLOAT: { - float *d = (float *) dest; - d[0] = rgba[0]; - d[1] = rgba[1]; - d[2] = rgba[2]; - d[3] = rgba[3]; + uc->f[0] = rgba[0]; + uc->f[1] = rgba[1]; + uc->f[2] = rgba[2]; + uc->f[3] = rgba[3]; } return; case PIPE_FORMAT_R32G32B32_FLOAT: { - float *d = (float *) dest; - d[0] = rgba[0]; - d[1] = rgba[1]; - d[2] = rgba[2]; + uc->f[0] = rgba[0]; + uc->f[1] = rgba[1]; + uc->f[2] = rgba[2]; } return; /* XXX lots more cases to add */ default: + uc->ui = 0; /* keep compiler happy */ debug_print_format("gallium: unhandled format in util_pack_color()", format); assert(0); } diff --git a/src/gallium/drivers/cell/ppu/cell_clear.c b/src/gallium/drivers/cell/ppu/cell_clear.c index 79ad687ea9..3a3f968a49 100644 --- a/src/gallium/drivers/cell/ppu/cell_clear.c +++ b/src/gallium/drivers/cell/ppu/cell_clear.c @@ -59,9 +59,9 @@ cell_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, if (buffers & PIPE_CLEAR_COLOR) { uint surfIndex = 0; - uint clearValue; + union util_color uc; - util_pack_color(rgba, cell->framebuffer.cbufs[0]->format, &clearValue); + util_pack_color(rgba, cell->framebuffer.cbufs[0]->format, &uc); /* Build a CLEAR command and place it in the current batch buffer */ STATIC_ASSERT(sizeof(struct cell_command_clear_surface) % 16 == 0); @@ -70,7 +70,7 @@ cell_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, cell_batch_alloc16(cell, sizeof(*clr)); clr->opcode[0] = CELL_CMD_CLEAR_SURFACE; clr->surface = surfIndex; - clr->value = clearValue; + clr->value = uc.ui; } if (buffers & PIPE_CLEAR_DEPTHSTENCIL) { diff --git a/src/gallium/drivers/llvmpipe/lp_clear.c b/src/gallium/drivers/llvmpipe/lp_clear.c index bdcff94b9b..08d9f2e273 100644 --- a/src/gallium/drivers/llvmpipe/lp_clear.c +++ b/src/gallium/drivers/llvmpipe/lp_clear.c @@ -50,6 +50,7 @@ llvmpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, double depth, unsigned stencil) { struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe); + union util_color uc; unsigned cv; uint i; @@ -64,8 +65,8 @@ llvmpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, for (i = 0; i < llvmpipe->framebuffer.nr_cbufs; i++) { struct pipe_surface *ps = llvmpipe->framebuffer.cbufs[i]; - util_pack_color(rgba, ps->format, &cv); - lp_tile_cache_clear(llvmpipe->cbuf_cache[i], rgba, cv); + util_pack_color(rgba, ps->format, &uc); + lp_tile_cache_clear(llvmpipe->cbuf_cache[i], rgba, uc.ui); } llvmpipe->dirty_render_cache = TRUE; } diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 442af70e14..4ddbb357b6 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -153,7 +153,7 @@ static void r300_set_blend_color(struct pipe_context* pipe, struct r300_context* r300 = r300_context(pipe); util_pack_color(color->color, PIPE_FORMAT_A8R8G8B8_UNORM, - &r300->blend_color_state->blend_color); + (union util_color *)&r300->blend_color_state->blend_color); /* XXX if FP16 blending is enabled, we should use the FP16 format */ r300->blend_color_state->blend_color_red_alpha = @@ -535,7 +535,7 @@ static void* sampler->filter1 |= r300_anisotropy(state->max_anisotropy); util_pack_color(state->border_color, PIPE_FORMAT_A8R8G8B8_UNORM, - &sampler->border_color); + (union util_color *)&sampler->border_color); /* R500-specific fixups and optimizations */ if (r300_screen(r300->context.screen)->caps->is_r500) { diff --git a/src/gallium/drivers/softpipe/sp_clear.c b/src/gallium/drivers/softpipe/sp_clear.c index 8fac8e6e05..f98087deb8 100644 --- a/src/gallium/drivers/softpipe/sp_clear.c +++ b/src/gallium/drivers/softpipe/sp_clear.c @@ -48,6 +48,7 @@ softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, double depth, unsigned stencil) { struct softpipe_context *softpipe = softpipe_context(pipe); + union util_color uc; unsigned cv; uint i; @@ -62,12 +63,12 @@ softpipe_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba, for (i = 0; i < softpipe->framebuffer.nr_cbufs; i++) { struct pipe_surface *ps = softpipe->framebuffer.cbufs[i]; - util_pack_color(rgba, ps->format, &cv); - sp_tile_cache_clear(softpipe->cbuf_cache[i], rgba, cv); + util_pack_color(rgba, ps->format, &uc); + sp_tile_cache_clear(softpipe->cbuf_cache[i], rgba, uc.ui); #if !TILE_CLEAR_OPTIMIZATION /* non-cached surface */ - pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, cv); + pipe->surface_fill(pipe, ps, 0, 0, ps->width, ps->height, uc.ui); #endif } } diff --git a/src/gallium/drivers/svga/svga_pipe_clear.c b/src/gallium/drivers/svga/svga_pipe_clear.c index 6195c3897e..409b3b41cb 100644 --- a/src/gallium/drivers/svga/svga_pipe_clear.c +++ b/src/gallium/drivers/svga/svga_pipe_clear.c @@ -46,7 +46,7 @@ try_clear(struct svga_context *svga, boolean restore_viewport = FALSE; SVGA3dClearFlag flags = 0; struct pipe_framebuffer_state *fb = &svga->curr.framebuffer; - unsigned color = 0; + union util_color uc; ret = svga_update_state(svga, SVGA_STATE_HW_CLEAR); if (ret) @@ -54,7 +54,7 @@ try_clear(struct svga_context *svga, if ((buffers & PIPE_CLEAR_COLOR) && fb->cbufs[0]) { flags |= SVGA3D_CLEAR_COLOR; - util_pack_color(rgba, PIPE_FORMAT_A8R8G8B8_UNORM, &color); + util_pack_color(rgba, PIPE_FORMAT_A8R8G8B8_UNORM, &uc); rect.w = fb->cbufs[0]->width; rect.h = fb->cbufs[0]->height; @@ -77,7 +77,7 @@ try_clear(struct svga_context *svga, return ret; } - ret = SVGA3D_ClearRect(svga->swc, flags, color, depth, stencil, + ret = SVGA3D_ClearRect(svga->swc, flags, uc.ui, depth, stencil, rect.x, rect.y, rect.w, rect.h); if (ret != PIPE_OK) return ret; diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c index b4e57c5d15..7f530083d6 100644 --- a/src/gallium/drivers/svga/svga_pipe_sampler.c +++ b/src/gallium/drivers/svga/svga_pipe_sampler.c @@ -122,7 +122,7 @@ svga_create_sampler_state(struct pipe_context *pipe, util_pack_color_ub( r, g, b, a, PIPE_FORMAT_B8G8R8A8_UNORM, - &cso->bordercolor ); + (union util_color *)&cso->bordercolor ); } /* No SVGA3D support for: diff --git a/src/gallium/state_trackers/vega/vg_translate.c b/src/gallium/state_trackers/vega/vg_translate.c index 00e0764706..5051d83831 100644 --- a/src/gallium/state_trackers/vega/vg_translate.c +++ b/src/gallium/state_trackers/vega/vg_translate.c @@ -487,7 +487,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, a = 0xff; util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } } @@ -503,7 +503,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, a = (*src >> 0) & 0xff; util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } return; @@ -520,7 +520,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, a = (*src >> 0) & 0xff; util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } return; @@ -537,7 +537,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, clr[3] = 1.f; util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } } @@ -553,7 +553,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, clr[3] = ((*src >> 0) & 1)/1.; util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } } @@ -569,7 +569,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, clr[3] = ((*src >> 0) & 15)/15.; util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } } @@ -579,7 +579,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, src += offset; for (i = 0; i < n; ++i) { util_pack_color_ub(0xff, 0xff, 0xff, *src, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } } @@ -595,7 +595,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, a = 0xff; util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } } @@ -611,7 +611,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, a = (*src >> 0) & 0xff; util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } return; @@ -628,7 +628,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, a = (*src >> 0) & 0xff; util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } return; @@ -639,7 +639,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, src += offset; for (i = 0; i < n; ++i) { util_pack_color_ub(0xff, 0xff, 0xff, *src, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } } @@ -649,7 +649,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, src += offset; for (i = 0; i < n; ++i) { util_pack_color_ub(0xff, 0xff, 0xff, *src, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } } @@ -668,7 +668,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, clr[3] = 1.f; util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i+j]); + (union util_color *)rgba[i+j]); } ++src; } @@ -689,7 +689,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, clr[3] = (((*src) & (1<> shift); util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i+j]); + (union util_color *)rgba[i+j]); } ++src; } @@ -716,7 +716,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, clr[3] = ((*src) & (bitter)) >> shift; util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i +j]); + (union util_color *)rgba[i +j]); } ++src; } @@ -736,7 +736,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, b = (*src >> 0) & 0xff; util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } return; @@ -753,7 +753,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, b = (*src >> 0) & 0xff; util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } return; @@ -776,7 +776,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, b = (*src >> 0) & 0xff; util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } return; @@ -793,7 +793,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, b = (*src >> 0) & 0xff; util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } return; @@ -812,7 +812,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, a = (*src >> 0) & 0xff; util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } return; @@ -829,7 +829,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, a = (*src >> 0) & 0xff; util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } return; @@ -854,7 +854,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, a = (*src >> 0) & 0xff; util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } return; @@ -871,7 +871,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, a = (*src >> 0) & 0xff; util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } return; @@ -890,7 +890,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, r = (*src >> 0) & 0xff; util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } return; @@ -907,7 +907,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, r = (*src >> 0) & 0xff; util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } return; @@ -930,7 +930,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, r = (*src >> 0) & 0xff; util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } return; @@ -947,7 +947,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, r = (*src >> 0) & 0xff; util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - rgba[i]); + (union util_color *)rgba[i]); ++src; } return; diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c index 4b35f59cc2..5e2ae1bb36 100644 --- a/src/mesa/state_tracker/st_atom_pixeltransfer.c +++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c @@ -167,7 +167,7 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt) ubyte g = ctx->PixelMaps.GtoG.Map8[i * gSize / texSize]; ubyte b = ctx->PixelMaps.BtoB.Map8[j * bSize / texSize]; ubyte a = ctx->PixelMaps.AtoA.Map8[i * aSize / texSize]; - util_pack_color_ub(r, g, b, a, pt->format, dest + k); + util_pack_color_ub(r, g, b, a, pt->format, (union util_color *)(dest + k)); } } -- cgit v1.2.3 From 72362a5cd41d97b770980c28fe6719c556f12ab7 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Mon, 7 Dec 2009 21:47:49 +0100 Subject: mesa: fix shader prog_execute strict aliasing violations use unions instead of pointer casts. --- src/mesa/shader/prog_execute.c | 50 +++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/prog_execute.c b/src/mesa/shader/prog_execute.c index 192d39aed1..038ce0b4f0 100644 --- a/src/mesa/shader/prog_execute.c +++ b/src/mesa/shader/prog_execute.c @@ -54,8 +54,18 @@ * Set x to positive or negative infinity. */ #if defined(USE_IEEE) || defined(_WIN32) -#define SET_POS_INFINITY(x) ( *((GLuint *) (void *)&x) = 0x7F800000 ) -#define SET_NEG_INFINITY(x) ( *((GLuint *) (void *)&x) = 0xFF800000 ) +#define SET_POS_INFINITY(x) \ + do { \ + fi_type fi; \ + fi.i = 0x7F800000; \ + x = fi.f; \ + } while (0) +#define SET_NEG_INFINITY(x) \ + do { \ + fi_type fi; \ + fi.i = 0xFF800000; \ + x = fi.f; \ + } while (0) #elif defined(VMS) #define SET_POS_INFINITY(x) x = __MAXFLOAT #define SET_NEG_INFINITY(x) x = -__MAXFLOAT @@ -1635,11 +1645,12 @@ _mesa_execute_program(GLcontext * ctx, case OPCODE_UP2H: /* unpack two 16-bit floats */ { GLfloat a[4], result[4]; - const GLuint *rawBits = (const GLuint *) a; + fi_type fi; GLhalfNV hx, hy; fetch_vector1(&inst->SrcReg[0], machine, a); - hx = rawBits[0] & 0xffff; - hy = rawBits[0] >> 16; + fi.f = a[0]; + hx = fi.i & 0xffff; + hy = fi.i >> 16; result[0] = result[2] = _mesa_half_to_float(hx); result[1] = result[3] = _mesa_half_to_float(hy); store_vector4(inst, machine, result); @@ -1648,11 +1659,12 @@ _mesa_execute_program(GLcontext * ctx, case OPCODE_UP2US: /* unpack two GLushorts */ { GLfloat a[4], result[4]; - const GLuint *rawBits = (const GLuint *) a; + fi_type fi; GLushort usx, usy; fetch_vector1(&inst->SrcReg[0], machine, a); - usx = rawBits[0] & 0xffff; - usy = rawBits[0] >> 16; + fi.f = a[0]; + usx = fi.i & 0xffff; + usy = fi.i >> 16; result[0] = result[2] = usx * (1.0f / 65535.0f); result[1] = result[3] = usy * (1.0f / 65535.0f); store_vector4(inst, machine, result); @@ -1661,24 +1673,26 @@ _mesa_execute_program(GLcontext * ctx, case OPCODE_UP4B: /* unpack four GLbytes */ { GLfloat a[4], result[4]; - const GLuint *rawBits = (const GLuint *) a; + fi_type fi; fetch_vector1(&inst->SrcReg[0], machine, a); - result[0] = (((rawBits[0] >> 0) & 0xff) - 128) / 127.0F; - result[1] = (((rawBits[0] >> 8) & 0xff) - 128) / 127.0F; - result[2] = (((rawBits[0] >> 16) & 0xff) - 128) / 127.0F; - result[3] = (((rawBits[0] >> 24) & 0xff) - 128) / 127.0F; + fi.f = a[0]; + result[0] = (((fi.i >> 0) & 0xff) - 128) / 127.0F; + result[1] = (((fi.i >> 8) & 0xff) - 128) / 127.0F; + result[2] = (((fi.i >> 16) & 0xff) - 128) / 127.0F; + result[3] = (((fi.i >> 24) & 0xff) - 128) / 127.0F; store_vector4(inst, machine, result); } break; case OPCODE_UP4UB: /* unpack four GLubytes */ { GLfloat a[4], result[4]; - const GLuint *rawBits = (const GLuint *) a; + fi_type fi; fetch_vector1(&inst->SrcReg[0], machine, a); - result[0] = ((rawBits[0] >> 0) & 0xff) / 255.0F; - result[1] = ((rawBits[0] >> 8) & 0xff) / 255.0F; - result[2] = ((rawBits[0] >> 16) & 0xff) / 255.0F; - result[3] = ((rawBits[0] >> 24) & 0xff) / 255.0F; + fi.f = a[0]; + result[0] = ((fi.i >> 0) & 0xff) / 255.0F; + result[1] = ((fi.i >> 8) & 0xff) / 255.0F; + result[2] = ((fi.i >> 16) & 0xff) / 255.0F; + result[3] = ((fi.i >> 24) & 0xff) / 255.0F; store_vector4(inst, machine, result); } break; -- cgit v1.2.3 From 013cf1d63deb9c33089777afbdea85013fd46b49 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Mon, 7 Dec 2009 22:22:57 +0100 Subject: radeon: fix image migration for small compressed textures memcpy would give incorrect results if src rowstride != dst rowstride --- src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index 0415a50d0b..91f0db958b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -437,23 +437,18 @@ static void migrate_image_to_miptree(radeon_mipmap_tree *mt, radeon_miptree_unreference(&image->mt); } else { - /* need to confirm this value is correct */ - if (_mesa_is_format_compressed(image->base.TexFormat)) { - unsigned size = _mesa_format_image_size(image->base.TexFormat, - image->base.Width, - image->base.Height, - image->base.Depth); - memcpy(dest, image->base.Data, size); - } else { - uint32_t srcrowstride; - uint32_t height; + const uint32_t srcrowstride = _mesa_format_row_stride(image->base.TexFormat, image->base.Width); + uint32_t rows = image->base.Height * image->base.Depth; - height = image->base.Height * image->base.Depth; - srcrowstride = image->base.Width * _mesa_get_format_bytes(image->base.TexFormat); - copy_rows(dest, dstlvl->rowstride, image->base.Data, srcrowstride, - height, srcrowstride); + if (_mesa_is_format_compressed(image->base.TexFormat)) { + uint32_t blockWidth, blockHeight; + _mesa_get_format_block_size(image->base.TexFormat, &blockWidth, &blockHeight); + rows = (rows + blockHeight - 1) / blockHeight; } + copy_rows(dest, dstlvl->rowstride, image->base.Data, srcrowstride, + rows, srcrowstride); + _mesa_free_texmemory(image->base.Data); image->base.Data = 0; } -- cgit v1.2.3 From 9921b3048e611398460ef774355b7515bc901240 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Mon, 7 Dec 2009 22:24:41 +0100 Subject: radeon: fix cases when only first image where put directly into miptree. Make sure that minimal width, height and depth of texture image is 1. --- src/mesa/drivers/dri/radeon/radeon_texture.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 00e0658dc5..28690325d1 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -524,9 +524,9 @@ static int image_matches_texture_obj(struct gl_texture_object *texObj, return 0; const unsigned levelDiff = level - texObj->BaseLevel; - const unsigned refWidth = baseImage->Width >> levelDiff; - const unsigned refHeight = baseImage->Height >> levelDiff; - const unsigned refDepth = baseImage->Depth >> levelDiff; + const unsigned refWidth = MAX2(baseImage->Width >> levelDiff, 1); + const unsigned refHeight = MAX2(baseImage->Height >> levelDiff, 1); + const unsigned refDepth = MAX2(baseImage->Depth >> levelDiff, 1); return (texImage->Width == refWidth && texImage->Height == refHeight && -- cgit v1.2.3 From 9dbd47fc6b1cf9ddfb318f2e05df0886cd5fe0df Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 7 Dec 2009 16:59:59 -0800 Subject: mesa: set version string to 7.6.1-rc3 --- src/mesa/main/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index e2fed57080..8a2013229a 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -32,7 +32,7 @@ #define MESA_MAJOR 7 #define MESA_MINOR 6 #define MESA_PATCH 1 -#define MESA_VERSION_STRING "7.6.1-rc2" +#define MESA_VERSION_STRING "7.6.1-rc3" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -- cgit v1.2.3 From bb64c9bcdf9962c4f74d71f49307de1da4c3392b Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 7 Dec 2009 17:06:07 -0800 Subject: Revert "intel: Make RGB renderbuffers use XRGB8888 like we do for RGB system buffers." This reverts commit 4598942b1b88a2a7d5af7febae7e79eedf00e385. XRGB8888 doesn't work as intended. Revert this for now, and we'll revisit it for 7.8 or something. --- src/mesa/drivers/dri/intel/intel_fbo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index b6e0d823ed..5615040946 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -126,7 +126,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_RGB16: rb->Format = MESA_FORMAT_ARGB8888; rb->DataType = GL_UNSIGNED_BYTE; - irb->texformat = MESA_FORMAT_XRGB8888; + irb->texformat = MESA_FORMAT_ARGB8888; /* XXX: Need xrgb8888 */ cpp = 4; break; case GL_RGBA: @@ -314,6 +314,10 @@ intel_create_renderbuffer(gl_format format) irb->Base.DataType = GL_UNSIGNED_BYTE; break; case MESA_FORMAT_XRGB8888: + /* XXX this is a hack since XRGB surfaces don't seem to work + * properly yet. Reading the alpha channel returns 0 instead of 1. + */ + format = MESA_FORMAT_ARGB8888; irb->Base._BaseFormat = GL_RGB; irb->Base.DataType = GL_UNSIGNED_BYTE; break; -- cgit v1.2.3 From ba167f812c44c4bb8c8f844c3d5fbff60bfc93eb Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Mon, 7 Dec 2009 17:18:56 -0800 Subject: mesa: set version string to 7.7-rc1 Also modify the Makefile to use the correct version for the tarballs. --- src/mesa/main/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/version.h b/src/mesa/main/version.h index fddb9a851f..fa233b9f30 100644 --- a/src/mesa/main/version.h +++ b/src/mesa/main/version.h @@ -32,7 +32,7 @@ #define MESA_MAJOR 7 #define MESA_MINOR 7 #define MESA_PATCH 0 -#define MESA_VERSION_STRING "7.7-rc1" +#define MESA_VERSION_STRING "7.7-rc2" /* To make version comparison easy */ #define MESA_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -- cgit v1.2.3 From add6dfbba64260c9b314b4a95c8def084e05bd3b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Mon, 7 Dec 2009 19:04:07 -0800 Subject: llvmpipe: Initialize variables in emit_instruction. --- src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c index d4d18febec..f588bde983 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_tgsi_soa.c @@ -496,9 +496,9 @@ emit_instruction( if (IS_DST0_CHANNEL_ENABLED( inst, CHAN_X ) || IS_DST0_CHANNEL_ENABLED( inst, CHAN_Y ) || IS_DST0_CHANNEL_ENABLED( inst, CHAN_Z )) { - LLVMValueRef *p_floor_log2; - LLVMValueRef *p_exp; - LLVMValueRef *p_log2; + LLVMValueRef *p_floor_log2 = NULL; + LLVMValueRef *p_exp = NULL; + LLVMValueRef *p_log2 = NULL; src0 = emit_fetch( bld, inst, 0, CHAN_X ); src0 = lp_build_abs( &bld->base, src0 ); -- cgit v1.2.3 From dc0777d3e3b760d7faa5fb99a189919bde07ca0b Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Wed, 4 Nov 2009 10:00:47 +0200 Subject: r600: reorder state for render_target and blend First time around render targets are not enabled yet (done in r700SendRenderTargetState) so blend state is not emitted for any targets. Affects first glClear in some mesa tests. As a quick fix reorder state emit so that target is set first --- src/mesa/drivers/dri/r600/r700_chip.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index 8707a764ac..d8661b4439 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -1250,9 +1250,9 @@ void r600InitAtoms(context_t *context) ALLOC_STATE(poly, always, 10, r700SendPolyState); ALLOC_STATE(cb, cb, 18, r700SendCBState); ALLOC_STATE(clrcmp, always, 6, r700SendCBCLRCMPState); + ALLOC_STATE(cb_target, always, 25, r700SendRenderTargetState); ALLOC_STATE(blnd, blnd, (6 + (R700_MAX_RENDER_TARGETS * 3)), r700SendCBBlendState); ALLOC_STATE(blnd_clr, always, 6, r700SendCBBlendColorState); - ALLOC_STATE(cb_target, always, 25, r700SendRenderTargetState); ALLOC_STATE(sx, always, 9, r700SendSXState); ALLOC_STATE(vgt, always, 41, r700SendVGTState); ALLOC_STATE(spi, always, (59 + R700_MAX_SHADER_EXPORTS), r700SendSPIState); -- cgit v1.2.3 From 369669ff9a7ff7636cadef8e2b13f2f28face98f Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Thu, 3 Dec 2009 12:26:44 +0200 Subject: r600: add support for TXB instruction makes testing other things easier - does not hang the card TODO: enable TEX dependency tracking in vertex programs --- src/mesa/drivers/dri/r600/r700_assembler.c | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 6ff08e1cfb..be875ae6b8 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -3450,22 +3450,6 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) need_barrier = GL_TRUE; } - switch (pAsm->pILInst[pAsm->uiCurInst].Opcode) - { - case OPCODE_TEX: - break; - case OPCODE_TXB: - radeon_error("do not support TXB yet\n"); - return GL_FALSE; - break; - case OPCODE_TXP: - break; - default: - radeon_error("Internal error: bad texture op (not TEX)\n"); - return GL_FALSE; - break; - } - if (pAsm->pILInst[pAsm->uiCurInst].Opcode == OPCODE_TXP) { GLuint tmp = gethelpr(pAsm); @@ -3644,7 +3628,15 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) } - pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE; + if(pAsm->pILInst[pAsm->uiCurInst].Opcode == OPCODE_TXB) + { + pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE_L; + } + else + { + pAsm->D.dst.opcode = SQ_TEX_INST_SAMPLE; + } + pAsm->is_tex = GL_TRUE; if ( GL_TRUE == need_barrier ) { -- cgit v1.2.3 From 7f8e22aa29b7340d51b1f2e16d55a035c0f9b851 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 8 Dec 2009 00:26:37 -0800 Subject: rbug: Initialize variable in rbug_get_message. Silences uninitialized variable warning. --- src/gallium/auxiliary/rbug/rbug_connection.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/auxiliary/rbug/rbug_connection.c b/src/gallium/auxiliary/rbug/rbug_connection.c index 52acb700af..ae4e27f9f6 100644 --- a/src/gallium/auxiliary/rbug/rbug_connection.c +++ b/src/gallium/auxiliary/rbug/rbug_connection.c @@ -87,6 +87,7 @@ rbug_get_message(struct rbug_connection *c, uint32_t *serial) if (!data) { return NULL; } + data->opcode = 0; do { uint8_t *ptr = ((uint8_t*)data) + read; -- cgit v1.2.3 From 7e93e06781d2f3e0c737c7654c3fb0d83e31e45a Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 8 Dec 2009 00:37:35 -0800 Subject: i915g: Add missing break statement in i915_debug_packet. --- src/gallium/drivers/i915simple/i915_debug.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/i915simple/i915_debug.c b/src/gallium/drivers/i915simple/i915_debug.c index ce92d1af9a..521b516470 100644 --- a/src/gallium/drivers/i915simple/i915_debug.c +++ b/src/gallium/drivers/i915simple/i915_debug.c @@ -851,6 +851,7 @@ static boolean i915_debug_packet( struct debug_stream *stream ) default: return debug(stream, "", 0); } + break; default: assert(0); return 0; -- cgit v1.2.3 From 1de1deffce9c7120a167af8553b606eec82e60a3 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 8 Dec 2009 00:43:38 -0800 Subject: i915g: Fix memory leak when pci id is unknown. --- src/gallium/drivers/i915simple/i915_screen.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/drivers/i915simple/i915_screen.c b/src/gallium/drivers/i915simple/i915_screen.c index 9f017a14cc..9557c80ce1 100644 --- a/src/gallium/drivers/i915simple/i915_screen.c +++ b/src/gallium/drivers/i915simple/i915_screen.c @@ -273,6 +273,7 @@ i915_create_screen(struct intel_winsys *iws, uint pci_id) default: debug_printf("%s: unknown pci id 0x%x, cannot create screen\n", __FUNCTION__, pci_id); + FREE(is); return NULL; } -- cgit v1.2.3 From 9e42683fb3ecd453267a5885a138b425a2b79236 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 8 Dec 2009 11:43:22 +0100 Subject: vmware/xorg: Avoid warning about HAVE_STDINT_H being redefined. --- src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c b/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c index ad6993840d..c84368bab7 100644 --- a/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c @@ -31,7 +31,9 @@ * @author Jakob Bornecrantz */ -#define HAVE_STDINT_H +#ifndef HAVE_STDINT_H +#define HAVE_STDINT_H 1 +#endif #define _FILE_OFFSET_BITS 64 #include -- cgit v1.2.3 From 32ccc9b0bbfad46d2f4ce3b9ac4cdd182d7b64e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Tue, 8 Dec 2009 11:45:19 +0100 Subject: vmware/xorg: Fix SCons build. Not sure how vmw_screen.c could build at all though... --- src/gallium/winsys/drm/vmware/xorg/SConscript | 2 ++ src/gallium/winsys/drm/vmware/xorg/vmw_screen.c | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/xorg/SConscript b/src/gallium/winsys/drm/vmware/xorg/SConscript index ff7b2ed34e..b8968e7137 100644 --- a/src/gallium/winsys/drm/vmware/xorg/SConscript +++ b/src/gallium/winsys/drm/vmware/xorg/SConscript @@ -42,6 +42,8 @@ if env['platform'] == 'linux': ]) sources = [ + 'vmw_ioctl.c', + 'vmw_screen.c', 'vmw_xorg.c', ] diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_screen.c b/src/gallium/winsys/drm/vmware/xorg/vmw_screen.c index 421906da99..18cb509189 100644 --- a/src/gallium/winsys/drm/vmware/xorg/vmw_screen.c +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_screen.c @@ -33,6 +33,8 @@ #include "vmw_hook.h" #include "vmw_driver.h" +#include "cursorstr.h" + /* modified version of crtc functions */ xf86CrtcFuncsRec vmw_screen_crtc_funcs; -- cgit v1.2.3 From 2aebc5e01fbab6046f80c881d30717f788a390bc Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Tue, 8 Dec 2009 13:11:09 +0000 Subject: move assert to avoid crash in debug build. --- src/gallium/drivers/llvmpipe/lp_tile_cache.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/llvmpipe/lp_tile_cache.c b/src/gallium/drivers/llvmpipe/lp_tile_cache.c index e83210f93b..7a1ecf5107 100644 --- a/src/gallium/drivers/llvmpipe/lp_tile_cache.c +++ b/src/gallium/drivers/llvmpipe/lp_tile_cache.c @@ -290,11 +290,12 @@ lp_get_cached_tile(struct llvmpipe_tile_cache *tc, assert(tc->surface); assert(tc->transfer); - assert(tc->transfer_map); if(!tc->transfer_map) lp_tile_cache_map_transfers(tc); + assert(tc->transfer_map); + switch(tile->status) { case LP_TILE_STATUS_CLEAR: /* don't get tile from framebuffer, just clear it */ -- cgit v1.2.3 From 94c6ec5809b08676f12628b49dd88ec694d07a48 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Thu, 3 Dec 2009 18:12:45 +0200 Subject: r600: execute SET funtions on all channels seems assemble_LOGIC was meant for non-condition-code instructions so execute in for all components as previously --- src/mesa/drivers/dri/r600/r700_assembler.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index cf64d170ed..fe006ef19c 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -4467,7 +4467,7 @@ GLboolean assemble_LOGIC(r700_AssemblerBase *pAsm, BITS opcode) } pAsm->D.dst.opcode = opcode; - pAsm->D.dst.math = 1; + //pAsm->D.dst.math = 1; if( GL_FALSE == assemble_dst(pAsm) ) { -- cgit v1.2.3 From c1d79a4235fa2edb05e92f9b93a105ff356a4a18 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Fri, 4 Dec 2009 11:37:15 +0200 Subject: r600: wip glsl - refactor conditional instructions a bit remember the dst register which is used for cond updates when it's time to use the cond codes issue a separate PRED instruction --- src/mesa/drivers/dri/r600/r700_assembler.c | 379 ++++++----------------------- src/mesa/drivers/dri/r600/r700_assembler.h | 1 + 2 files changed, 70 insertions(+), 310 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index fe006ef19c..87c1638de4 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -3557,7 +3557,7 @@ GLboolean assemble_KIL(r700_AssemblerBase *pAsm, GLuint opcode) checkop2(pAsm); pAsm->D.dst.opcode = opcode; - pAsm->D.dst.math = 1; + //pAsm->D.dst.math = 1; setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); pAsm->D.dst.rtype = DST_REG_TEMPORARY; @@ -3567,17 +3567,23 @@ GLboolean assemble_KIL(r700_AssemblerBase *pAsm, GLuint opcode) pAsm->D.dst.writez = 0; pAsm->D.dst.writew = 0; - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = 0; + setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_0); + noneg_PVSSRC(&(pAsm->S[0].src)); + + if( GL_FALSE == assemble_src(pAsm, 0, 1) ) { return GL_FALSE; } - if( GL_FALSE == assemble_src(pAsm, 1, -1) ) + /*if( GL_FALSE == assemble_src(pAsm, 1, -1) ) { return GL_FALSE; } - - if ( GL_FALSE == next_ins2(pAsm) ) + */ + if ( GL_FALSE == next_ins(pAsm) ) { return GL_FALSE; } @@ -4494,30 +4500,32 @@ GLboolean assemble_LOGIC(r700_AssemblerBase *pAsm, BITS opcode) GLboolean assemble_LOGIC_PRED(r700_AssemblerBase *pAsm, BITS opcode) { - if( GL_FALSE == checkop2(pAsm) ) - { - return GL_FALSE; - } + struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); pAsm->D.dst.opcode = opcode; pAsm->D.dst.math = 1; pAsm->D.dst.predicated = 1; - pAsm->D2.dst2.SaturateMode = pAsm->pILInst[pAsm->uiCurInst].SaturateMode; - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = pAsm->uHelpReg; + pAsm->D.dst.writex = 1; + pAsm->D.dst.writey = pAsm->D.dst.writez = pAsm->D.dst.writew = 0; - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = pAsm->last_cond_register + pAsm->starting_temp_register_number; + pAsm->S[0].src.swizzlex = pILInst->DstReg.CondSwizzle & 0x7; + noneg_PVSSRC(&(pAsm->S[0].src)); - if( GL_FALSE == assemble_src(pAsm, 1, -1) ) - { - return GL_FALSE; - } + pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[1].src.reg = pAsm->uHelpReg; + setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); + noneg_PVSSRC(&(pAsm->S[1].src)); + pAsm->S[1].src.swizzlex = SQ_SEL_0; + pAsm->S[1].src.swizzley = SQ_SEL_0; + pAsm->S[1].src.swizzlez = SQ_SEL_0; + pAsm->S[1].src.swizzlew = SQ_SEL_0; if( GL_FALSE == next_ins2(pAsm) ) { @@ -5098,6 +5106,11 @@ GLboolean pops(r700_AssemblerBase *pAsm, GLuint pops) GLboolean assemble_IF(r700_AssemblerBase *pAsm, GLboolean bHasElse) { + pAsm->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; + + assemble_LOGIC_PRED(pAsm, SQ_OP2_INST_PRED_SETNE); + + if(GL_FALSE == add_cf_instruction(pAsm) ) { return GL_FALSE; @@ -5242,6 +5255,11 @@ GLboolean assemble_BGNLOOP(r700_AssemblerBase *pAsm) GLboolean assemble_BRK(r700_AssemblerBase *pAsm) { #ifdef USE_CF_FOR_CONTINUE_BREAK + + pAsm->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; + + assemble_LOGIC_PRED(pAsm, SQ_OP2_INST_PRED_SETNE); + unsigned int unFCSP; for(unFCSP=pAsm->FCSP; unFCSP>0; unFCSP--) { @@ -5308,6 +5326,10 @@ GLboolean assemble_BRK(r700_AssemblerBase *pAsm) GLboolean assemble_CONT(r700_AssemblerBase *pAsm) { #ifdef USE_CF_FOR_CONTINUE_BREAK + pAsm->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; + + assemble_LOGIC_PRED(pAsm, SQ_OP2_INST_PRED_SETNE); + unsigned int unFCSP; for(unFCSP=pAsm->FCSP; unFCSP>0; unFCSP--) { @@ -5848,6 +5870,12 @@ GLboolean AssembleInstr(GLuint uiFirstInst, } } #endif + if(pILInst[i].CondUpdate == 1) + { + /* remember dest register used for cond evaluation */ + /* XXX also handle PROGRAM_OUTPUT registers here? */ + pR700AsmCode->last_cond_register = pILInst[i].DstReg.Index; + } switch (pILInst[i].Opcode) { @@ -5918,9 +5946,8 @@ GLboolean AssembleInstr(GLuint uiFirstInst, case OPCODE_KIL: case OPCODE_KIL_NV: - /* done at OPCODE_SE/SGT...etc. */ - /* if ( GL_FALSE == assemble_KIL(pR700AsmCode) ) - return GL_FALSE; */ + if ( GL_FALSE == assemble_KIL(pR700AsmCode, SQ_OP2_INST_KILLGT) ) + return GL_FALSE; break; case OPCODE_LG2: if ( GL_FALSE == assemble_LG2(pR700AsmCode) ) @@ -5983,151 +6010,23 @@ GLboolean AssembleInstr(GLuint uiFirstInst, break; case OPCODE_SEQ: - if(OPCODE_IF == pILInst[i+1].Opcode) - { - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; - if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETE) ) - { - return GL_FALSE; - } - } - else if(OPCODE_BRK == pILInst[i+1].Opcode) + if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETE) ) { -#ifdef USE_CF_FOR_CONTINUE_BREAK - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; -#else - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_BREAK; -#endif - if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETE) ) - { - return GL_FALSE; - } - } - else if(OPCODE_CONT == pILInst[i+1].Opcode) - { -#ifdef USE_CF_FOR_CONTINUE_BREAK - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; -#else - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_CONTINUE; -#endif - if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETE) ) - { - return GL_FALSE; - } - } - else if((OPCODE_KIL == pILInst[i+1].Opcode)||(OPCODE_KIL_NV == pILInst[i+1].Opcode)) - { - if ( GL_FALSE == assemble_KIL(pR700AsmCode, SQ_OP2_INST_KILLE) ) - { - return GL_FALSE; - } - } - else - { - if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETE) ) - { - return GL_FALSE; - } + return GL_FALSE; } break; case OPCODE_SGT: - if(OPCODE_IF == pILInst[i+1].Opcode) - { - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; - if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGT) ) - { - return GL_FALSE; - } - } - else if(OPCODE_BRK == pILInst[i+1].Opcode) + if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETGT) ) { -#ifdef USE_CF_FOR_CONTINUE_BREAK - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; -#else - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_BREAK; -#endif - if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGT) ) - { - return GL_FALSE; - } - } - else if(OPCODE_CONT == pILInst[i+1].Opcode) - { -#ifdef USE_CF_FOR_CONTINUE_BREAK - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; -#else - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_CONTINUE; -#endif - - if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGT) ) - { - return GL_FALSE; - } - } - else if((OPCODE_KIL == pILInst[i+1].Opcode)||(OPCODE_KIL_NV == pILInst[i+1].Opcode)) - { - if ( GL_FALSE == assemble_KIL(pR700AsmCode, SQ_OP2_INST_KILLGT) ) - { - return GL_FALSE; - } - } - else - { - if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETGT) ) - { - return GL_FALSE; - } + return GL_FALSE; } break; case OPCODE_SGE: - if(OPCODE_IF == pILInst[i+1].Opcode) - { - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; - if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGE) ) - { - return GL_FALSE; - } - } - else if(OPCODE_BRK == pILInst[i+1].Opcode) - { -#ifdef USE_CF_FOR_CONTINUE_BREAK - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; -#else - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_BREAK; -#endif - if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGE) ) - { - return GL_FALSE; - } - } - else if(OPCODE_CONT == pILInst[i+1].Opcode) - { -#ifdef USE_CF_FOR_CONTINUE_BREAK - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; -#else - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_CONTINUE; -#endif - - if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGE) ) - { - return GL_FALSE; - } - } - else if((OPCODE_KIL == pILInst[i+1].Opcode)||(OPCODE_KIL_NV == pILInst[i+1].Opcode)) - { - if ( GL_FALSE == assemble_KIL(pR700AsmCode, SQ_OP2_INST_KILLGE) ) - { - return GL_FALSE; - } - } - else - { - if ( GL_FALSE == assemble_SGE(pR700AsmCode) ) - { - return GL_FALSE; - } + if ( GL_FALSE == assemble_SGE(pR700AsmCode) ) + { + return GL_FALSE; } break; @@ -6139,61 +6038,12 @@ GLboolean AssembleInstr(GLuint uiFirstInst, SrcRegSave[1] = pILInst[i].SrcReg[1]; pILInst[i].SrcReg[0] = SrcRegSave[1]; pILInst[i].SrcReg[1] = SrcRegSave[0]; - if(OPCODE_IF == pILInst[i+1].Opcode) - { - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; - if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGT) ) - { - pILInst[i].SrcReg[0] = SrcRegSave[0]; - pILInst[i].SrcReg[1] = SrcRegSave[1]; - return GL_FALSE; - } - } - else if(OPCODE_BRK == pILInst[i+1].Opcode) - { -#ifdef USE_CF_FOR_CONTINUE_BREAK - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; -#else - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_BREAK; -#endif - if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGT) ) - { - pILInst[i].SrcReg[0] = SrcRegSave[0]; - pILInst[i].SrcReg[1] = SrcRegSave[1]; - return GL_FALSE; - } - } - else if(OPCODE_CONT == pILInst[i+1].Opcode) - { -#ifdef USE_CF_FOR_CONTINUE_BREAK - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; -#else - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_CONTINUE; -#endif - - if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGT) ) - { - pILInst[i].SrcReg[0] = SrcRegSave[0]; - pILInst[i].SrcReg[1] = SrcRegSave[1]; - return GL_FALSE; - } - } - else if((OPCODE_KIL == pILInst[i+1].Opcode)||(OPCODE_KIL_NV == pILInst[i+1].Opcode)) + if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETGT) ) { - if ( GL_FALSE == assemble_KIL(pR700AsmCode, SQ_OP2_INST_KILLGT) ) - { - return GL_FALSE; - } + pILInst[i].SrcReg[0] = SrcRegSave[0]; + pILInst[i].SrcReg[1] = SrcRegSave[1]; + return GL_FALSE; } - else - { - if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETGT) ) - { - pILInst[i].SrcReg[0] = SrcRegSave[0]; - pILInst[i].SrcReg[1] = SrcRegSave[1]; - return GL_FALSE; - } - } pILInst[i].SrcReg[0] = SrcRegSave[0]; pILInst[i].SrcReg[1] = SrcRegSave[1]; } @@ -6206,60 +6056,11 @@ GLboolean AssembleInstr(GLuint uiFirstInst, SrcRegSave[1] = pILInst[i].SrcReg[1]; pILInst[i].SrcReg[0] = SrcRegSave[1]; pILInst[i].SrcReg[1] = SrcRegSave[0]; - if(OPCODE_IF == pILInst[i+1].Opcode) + if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETGE) ) { - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; - if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGE) ) - { - pILInst[i].SrcReg[0] = SrcRegSave[0]; - pILInst[i].SrcReg[1] = SrcRegSave[1]; - return GL_FALSE; - } - } - else if(OPCODE_BRK == pILInst[i+1].Opcode) - { -#ifdef USE_CF_FOR_CONTINUE_BREAK - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; -#else - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_BREAK; -#endif - if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGE) ) - { - pILInst[i].SrcReg[0] = SrcRegSave[0]; - pILInst[i].SrcReg[1] = SrcRegSave[1]; - return GL_FALSE; - } - } - else if(OPCODE_CONT == pILInst[i+1].Opcode) - { -#ifdef USE_CF_FOR_CONTINUE_BREAK - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; -#else - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_CONTINUE; -#endif - - if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETGE) ) - { - pILInst[i].SrcReg[0] = SrcRegSave[0]; - pILInst[i].SrcReg[1] = SrcRegSave[1]; - return GL_FALSE; - } - } - else if((OPCODE_KIL == pILInst[i+1].Opcode)||(OPCODE_KIL_NV == pILInst[i+1].Opcode)) - { - if ( GL_FALSE == assemble_KIL(pR700AsmCode, SQ_OP2_INST_KILLGE) ) - { - return GL_FALSE; - } - } - else - { - if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETGE) ) - { - pILInst[i].SrcReg[0] = SrcRegSave[0]; - pILInst[i].SrcReg[1] = SrcRegSave[1]; - return GL_FALSE; - } + pILInst[i].SrcReg[0] = SrcRegSave[0]; + pILInst[i].SrcReg[1] = SrcRegSave[1]; + return GL_FALSE; } pILInst[i].SrcReg[0] = SrcRegSave[0]; pILInst[i].SrcReg[1] = SrcRegSave[1]; @@ -6267,51 +6068,9 @@ GLboolean AssembleInstr(GLuint uiFirstInst, break; case OPCODE_SNE: - if(OPCODE_IF == pILInst[i+1].Opcode) - { - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; - if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETNE) ) - { - return GL_FALSE; - } - } - else if(OPCODE_BRK == pILInst[i+1].Opcode) + if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETNE) ) { -#ifdef USE_CF_FOR_CONTINUE_BREAK - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; -#else - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_BREAK; -#endif - if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETNE) ) - { - return GL_FALSE; - } - } - else if(OPCODE_CONT == pILInst[i+1].Opcode) - { -#ifdef USE_CF_FOR_CONTINUE_BREAK - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_PUSH_BEFORE; -#else - pR700AsmCode->alu_x_opcode = SQ_CF_INST_ALU_CONTINUE; -#endif - if ( GL_FALSE == assemble_LOGIC_PRED(pR700AsmCode, SQ_OP2_INST_PRED_SETNE) ) - { - return GL_FALSE; - } - } - else if((OPCODE_KIL == pILInst[i+1].Opcode)||(OPCODE_KIL_NV == pILInst[i+1].Opcode)) - { - if ( GL_FALSE == assemble_KIL(pR700AsmCode, SQ_OP2_INST_KILLNE) ) - { - return GL_FALSE; - } - } - else - { - if ( GL_FALSE == assemble_LOGIC(pR700AsmCode, SQ_OP2_INST_SETNE) ) - { - return GL_FALSE; - } + return GL_FALSE; } break; diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index 130fc89dae..ef1f924add 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -345,6 +345,7 @@ typedef struct r700_AssemblerBase PVSDWORD S[3]; unsigned int uLastPosUpdate; + unsigned int last_cond_register; OUT_FRAGMENT_FMT_0 fp_stOutFmt0; -- cgit v1.2.3 From 323d1fb3910d7e53cb5200ee90849b2231fd96fb Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Fri, 4 Dec 2009 12:58:36 +0200 Subject: r600: quick hack to get KIL_NV working - does condition TR only for now --- src/mesa/drivers/dri/r600/r700_assembler.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 87c1638de4..3738edbc2f 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -3554,7 +3554,10 @@ GLboolean assemble_FRC(r700_AssemblerBase *pAsm) GLboolean assemble_KIL(r700_AssemblerBase *pAsm, GLuint opcode) { - checkop2(pAsm); + struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); + + if(pILInst->Opcode == OPCODE_KIL) + checkop1(pAsm); pAsm->D.dst.opcode = opcode; //pAsm->D.dst.math = 1; @@ -3573,16 +3576,23 @@ GLboolean assemble_KIL(r700_AssemblerBase *pAsm, GLuint opcode) setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_0); noneg_PVSSRC(&(pAsm->S[0].src)); - if( GL_FALSE == assemble_src(pAsm, 0, 1) ) + if(pILInst->Opcode == OPCODE_KIL_NV) { - return GL_FALSE; + setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); + pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[1].src.reg = 0; + setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_1); + neg_PVSSRC(&(pAsm->S[1].src)); } - - /*if( GL_FALSE == assemble_src(pAsm, 1, -1) ) + else { - return GL_FALSE; + if( GL_FALSE == assemble_src(pAsm, 0, 1) ) + { + return GL_FALSE; + } + } - */ + if ( GL_FALSE == next_ins(pAsm) ) { return GL_FALSE; -- cgit v1.2.3 From 94723b60cf3dd838dfaf505450db8ef2e089399c Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Fri, 4 Dec 2009 13:53:44 +0200 Subject: r600: implement FRAG_ATTRIB_FACE, glsl/twoside works --- src/mesa/drivers/dri/r600/r700_fragprog.c | 34 ++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c index e9ef6c8695..0cb9707ee6 100644 --- a/src/mesa/drivers/dri/r600/r700_fragprog.c +++ b/src/mesa/drivers/dri/r600/r700_fragprog.c @@ -93,7 +93,7 @@ void Map_Fragment_Program(r700_AssemblerBase *pAsm, pAsm->uiFP_AttributeMap[FRAG_ATTRIB_TEX0 + i] = pAsm->number_used_registers++; } } - + /* order has been taken care of */ #if 1 for(i=VERT_RESULT_VAR0; inumber_used_registers += unMaxVarying + 1; } #endif + unBit = 1 << FRAG_ATTRIB_FACE; + if(mesa_fp->Base.InputsRead & unBit) + { + pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FACE] = pAsm->number_used_registers++; + } /* Map temporary registers (GPRs) */ pAsm->starting_temp_register_number = pAsm->number_used_registers; @@ -451,6 +456,20 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx) CLEARbit(r700->SPI_INPUT_Z.u32All, PROVIDE_Z_TO_SPI_bit); } + if (mesa_fp->Base.InputsRead & (1 << FRAG_ATTRIB_FACE)) + { + ui += 1; + SETfield(r700->SPI_PS_IN_CONTROL_0.u32All, ui, NUM_INTERP_shift, NUM_INTERP_mask); + SETbit(r700->SPI_PS_IN_CONTROL_1.u32All, FRONT_FACE_ENA_bit); + SETbit(r700->SPI_PS_IN_CONTROL_1.u32All, FRONT_FACE_ALL_BITS_bit); + SETfield(r700->SPI_PS_IN_CONTROL_1.u32All, pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FACE], FRONT_FACE_ADDR_shift, FRONT_FACE_ADDR_mask); + } + else + { + CLEARbit(r700->SPI_PS_IN_CONTROL_1.u32All, FRONT_FACE_ENA_bit); + } + + ui = (unNumOfReg < ui) ? ui : unNumOfReg; SETfield(r700->ps.SQ_PGM_RESOURCES_PS.u32All, ui, NUM_GPRS_shift, NUM_GPRS_mask); @@ -535,6 +554,19 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx) } } + unBit = 1 << FRAG_ATTRIB_FACE; + if(mesa_fp->Base.InputsRead & unBit) + { + ui = pAsm->uiFP_AttributeMap[FRAG_ATTRIB_FACE]; + SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, SEL_CENTROID_bit); + SETfield(r700->SPI_PS_INPUT_CNTL[ui].u32All, ui, + SEMANTIC_shift, SEMANTIC_mask); + if (r700->SPI_INTERP_CONTROL_0.u32All & FLAT_SHADE_ENA_bit) + SETbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); + else + CLEARbit(r700->SPI_PS_INPUT_CNTL[ui].u32All, FLAT_SHADE_bit); + } + for(i=VERT_RESULT_VAR0; i Date: Fri, 4 Dec 2009 16:36:41 +0200 Subject: r600: glsl - allow specifying texture sampler via uniforms looks kinda hackish, should rethink later --- src/mesa/drivers/dri/r600/r700_assembler.c | 2 +- src/mesa/drivers/dri/r600/r700_assembler.h | 1 + src/mesa/drivers/dri/r600/r700_fragprog.c | 5 +++++ src/mesa/drivers/dri/r600/r700_vertprog.c | 4 ++++ 4 files changed, 11 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 3738edbc2f..158c5fa549 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -4840,7 +4840,7 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) pAsm->need_tex_barrier = GL_TRUE; } // Set src1 to tex unit id - pAsm->S[1].src.reg = pAsm->pILInst[pAsm->uiCurInst].TexSrcUnit; + pAsm->S[1].src.reg = pAsm->SamplerUnits[pAsm->pILInst[pAsm->uiCurInst].TexSrcUnit]; pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; //No sw info from mesa compiler, so hard code here. diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index ef1f924add..48ffef501f 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -416,6 +416,7 @@ typedef struct r700_AssemblerBase SHADER_PIPE_TYPE currentShaderType; struct prog_instruction * pILInst; GLuint uiCurInst; + GLubyte SamplerUnits[MAX_SAMPLERS]; GLboolean bR6xx; /* helper to decide which type of instruction to assemble */ GLboolean is_tex; diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c index 0cb9707ee6..8eb439a951 100644 --- a/src/mesa/drivers/dri/r600/r700_fragprog.c +++ b/src/mesa/drivers/dri/r600/r700_fragprog.c @@ -308,6 +308,7 @@ GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp, GLuint number_of_colors_exported; GLboolean z_enabled = GL_FALSE; GLuint unBit; + int i; //Init_Program Init_r700_AssemblerBase( SPT_FP, &(fp->r700AsmCode), &(fp->r700Shader) ); @@ -320,6 +321,10 @@ GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp, InitShaderProgram(&(fp->r700AsmCode)); + for(i=0; i < MAX_SAMPLERS; i++) + { + fp->r700AsmCode.SamplerUnits[i] = fp->mesa_program.Base.SamplerUnits[i]; + } if( GL_FALSE == AssembleInstr(0, mesa_fp->Base.NumInstructions, &(mesa_fp->Base.Instructions[0]), diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c index d3d1da7959..759b74dc7e 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.c +++ b/src/mesa/drivers/dri/r600/r700_vertprog.c @@ -337,6 +337,10 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, InitShaderProgram(&(vp->r700AsmCode)); + for(i=0; i < MAX_SAMPLERS; i++) + { + vp->r700AsmCode.SamplerUnits[i] = vp->mesa_program->Base.SamplerUnits[i]; + } if(GL_FALSE == AssembleInstr(0, vp->mesa_program->Base.NumInstructions, &(vp->mesa_program->Base.Instructions[0]), -- cgit v1.2.3 From 17e212e2631cd652c28378399806c3b3bd293e9a Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Mon, 7 Dec 2009 11:51:36 +0200 Subject: r600: add ABS support for source regs to assembler use it in tex cube instruction sequence --- src/mesa/drivers/dri/r600/r700_assembler.c | 27 +++++---------------------- src/mesa/drivers/dri/r600/r700_assembler.h | 7 ++++--- 2 files changed, 9 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 158c5fa549..2f8038adb3 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -2350,8 +2350,8 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) { alu_instruction_ptr->m_Word1_OP2.f6.alu_inst = pAsm->D.dst.opcode; - alu_instruction_ptr->m_Word1_OP2.f6.src0_abs = 0x0; - alu_instruction_ptr->m_Word1_OP2.f6.src1_abs = 0x0; + alu_instruction_ptr->m_Word1_OP2.f6.src0_abs = pAsm->S[0].src.abs; + alu_instruction_ptr->m_Word1_OP2.f6.src1_abs = pAsm->S[1].src.abs; //alu_instruction_ptr->m_Word1_OP2.f6.update_execute_mask = 0x0; //alu_instruction_ptr->m_Word1_OP2.f6.update_pred = 0x0; @@ -2379,8 +2379,8 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) { alu_instruction_ptr->m_Word1_OP2.f.alu_inst = pAsm->D.dst.opcode; - alu_instruction_ptr->m_Word1_OP2.f.src0_abs = 0x0; - alu_instruction_ptr->m_Word1_OP2.f.src1_abs = 0x0; + alu_instruction_ptr->m_Word1_OP2.f.src0_abs = pAsm->S[0].src.abs; + alu_instruction_ptr->m_Word1_OP2.f.src1_abs = pAsm->S[1].src.abs; //alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0x0; //alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0x0; @@ -4721,24 +4721,6 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) return GL_FALSE; } - /* tmp1.z = ABS(tmp1.z) dont have abs support in assembler currently - * have to do explicit instruction - */ - pAsm->D.dst.opcode = SQ_OP2_INST_MAX; - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp1; - pAsm->D.dst.writez = 1; - - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp1; - noswizzle_PVSSRC(&(pAsm->S[0].src)); - pAsm->S[1].bits = pAsm->S[0].bits; - flipneg_PVSSRC(&(pAsm->S[1].src)); - - next_ins(pAsm); - /* tmp1.z = RCP_e(|tmp1.z|) */ pAsm->D.dst.opcode = SQ_OP2_INST_RECIP_IEEE; pAsm->D.dst.math = 1; @@ -4751,6 +4733,7 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; pAsm->S[0].src.reg = tmp1; pAsm->S[0].src.swizzlex = SQ_SEL_Z; + pAsm->S[0].src.abs = 1; next_ins(pAsm); diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index 48ffef501f..cfa2610a55 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -120,14 +120,15 @@ typedef struct PVSINSTtag typedef struct PVSSRCtag { - BITS rtype:4; + BITS rtype:3; BITS addrmode0:1; - BITS reg:10; //15 (8) + BITS reg:10; //14 (8) BITS swizzlex:3; BITS swizzley:3; BITS swizzlez:3; - BITS swizzlew:3; //27 + BITS swizzlew:3; //26 + BITS abs:1; BITS negx:1; BITS negy:1; BITS negz:1; -- cgit v1.2.3 From 602ba357edd640e0db17911b39d3ecfbf5675230 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Mon, 7 Dec 2009 13:04:32 +0200 Subject: r600: merge alu_instruction/alu_instruction2 --- src/mesa/drivers/dri/r600/r700_assembler.c | 320 +++-------------------------- src/mesa/drivers/dri/r600/r700_assembler.h | 6 +- 2 files changed, 29 insertions(+), 297 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 2f8038adb3..8155d53eeb 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -1292,6 +1292,15 @@ GLboolean assemble_dst(r700_AssemblerBase *pAsm) pAsm->D.dst.writez = (pILInst->DstReg.WriteMask >> 2) & 0x1; pAsm->D.dst.writew = (pILInst->DstReg.WriteMask >> 3) & 0x1; + if(pILInst->SaturateMode == SATURATE_ZERO_ONE) + { + pAsm->D2.dst2.SaturateMode = 1; + } + else + { + pAsm->D2.dst2.SaturateMode = 0; + } + return GL_TRUE; } @@ -2270,7 +2279,7 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) } //other bits - alu_instruction_ptr->m_Word0.f.index_mode = SQ_INDEX_AR_X; + alu_instruction_ptr->m_Word0.f.index_mode = pAsm->D2.dst2.index_mode; if( (is_single_scalar_operation == GL_TRUE) || (GL_TRUE == bSplitInst) ) @@ -2282,9 +2291,17 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) alu_instruction_ptr->m_Word0.f.last = (scalar_channel_index == 3) ? 1 : 0; } - alu_instruction_ptr->m_Word0.f.pred_sel = 0x0; - alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0x0; - alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0x0; + alu_instruction_ptr->m_Word0.f.pred_sel = (pAsm->D.dst.pred_inv > 0) ? 1 : 0; + if(1 == pAsm->D.dst.predicated) + { + alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0x1; + alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0x1; + } + else + { + alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0x0; + alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0x0; + } // dst if( (pAsm->D.dst.rtype == DST_REG_TEMPORARY) || @@ -2323,7 +2340,7 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) alu_instruction_ptr->m_Word1.f.dst_chan = scalar_channel_index; - alu_instruction_ptr->m_Word1.f.clamp = pAsm->pILInst[pAsm->uiCurInst].SaturateMode; + alu_instruction_ptr->m_Word1.f.clamp = pAsm->D2.dst2.SaturateMode; if (pAsm->D.dst.op3) { @@ -2436,253 +2453,6 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) return GL_TRUE; } -GLboolean assemble_alu_instruction2(r700_AssemblerBase *pAsm) -{ - GLuint number_of_scalar_operations; - GLboolean is_single_scalar_operation; - GLuint scalar_channel_index; - - PVSSRC * pcurrent_source; - int current_source_index; - GLuint contiguous_slots_needed; - - GLuint uNumSrc = r700GetNumOperands(pAsm); - - GLboolean bSplitInst = GL_FALSE; - - if (1 == pAsm->D.dst.math) - { - is_single_scalar_operation = GL_TRUE; - number_of_scalar_operations = 1; - } - else - { - is_single_scalar_operation = GL_FALSE; - number_of_scalar_operations = 4; - } - - contiguous_slots_needed = 0; - - if(GL_TRUE == is_reduction_opcode(&(pAsm->D)) ) - { - contiguous_slots_needed = 4; - } - - initialize(pAsm); - - for (scalar_channel_index=0; - scalar_channel_index < number_of_scalar_operations; - scalar_channel_index++) - { - R700ALUInstruction* alu_instruction_ptr = (R700ALUInstruction*) CALLOC_STRUCT(R700ALUInstruction); - if (alu_instruction_ptr == NULL) - { - return GL_FALSE; - } - Init_R700ALUInstruction(alu_instruction_ptr); - - //src 0 - current_source_index = 0; - pcurrent_source = &(pAsm->S[0].src); - - if (GL_FALSE == assemble_alu_src(alu_instruction_ptr, - current_source_index, - pcurrent_source, - scalar_channel_index) ) - { - return GL_FALSE; - } - - if (uNumSrc > 1) - { - // Process source 1 - current_source_index = 1; - pcurrent_source = &(pAsm->S[current_source_index].src); - - if (GL_FALSE == assemble_alu_src(alu_instruction_ptr, - current_source_index, - pcurrent_source, - scalar_channel_index) ) - { - return GL_FALSE; - } - } - - //other bits - alu_instruction_ptr->m_Word0.f.index_mode = SQ_INDEX_LOOP; - - if( (is_single_scalar_operation == GL_TRUE) - || (GL_TRUE == bSplitInst) ) - { - alu_instruction_ptr->m_Word0.f.last = 1; - } - else - { - alu_instruction_ptr->m_Word0.f.last = (scalar_channel_index == 3) ? 1 : 0; - } - - alu_instruction_ptr->m_Word0.f.pred_sel = (pAsm->D.dst.pred_inv > 0) ? 1 : 0; - if(1 == pAsm->D.dst.predicated) - { - alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0x1; - alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0x1; - } - else - { - alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0x0; - alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0x0; - } - - // dst - if( (pAsm->D.dst.rtype == DST_REG_TEMPORARY) || - (pAsm->D.dst.rtype == DST_REG_OUT) ) - { - alu_instruction_ptr->m_Word1.f.dst_gpr = pAsm->D.dst.reg; - } - else - { - radeon_error("Only temp destination registers supported for ALU dest regs.\n"); - return GL_FALSE; - } - - alu_instruction_ptr->m_Word1.f.dst_rel = SQ_ABSOLUTE; //D.rtype - - if ( is_single_scalar_operation == GL_TRUE ) - { - // Override scalar_channel_index since only one scalar value will be written - if(pAsm->D.dst.writex) - { - scalar_channel_index = 0; - } - else if(pAsm->D.dst.writey) - { - scalar_channel_index = 1; - } - else if(pAsm->D.dst.writez) - { - scalar_channel_index = 2; - } - else if(pAsm->D.dst.writew) - { - scalar_channel_index = 3; - } - } - - alu_instruction_ptr->m_Word1.f.dst_chan = scalar_channel_index; - - alu_instruction_ptr->m_Word1.f.clamp = pAsm->D2.dst2.SaturateMode; - - if (pAsm->D.dst.op3) - { - //op3 - - alu_instruction_ptr->m_Word1_OP3.f.alu_inst = pAsm->D.dst.opcode; - - //There's 3rd src for op3 - current_source_index = 2; - pcurrent_source = &(pAsm->S[current_source_index].src); - - if ( GL_FALSE == assemble_alu_src(alu_instruction_ptr, - current_source_index, - pcurrent_source, - scalar_channel_index) ) - { - return GL_FALSE; - } - } - else - { - //op2 - if (pAsm->bR6xx) - { - alu_instruction_ptr->m_Word1_OP2.f6.alu_inst = pAsm->D.dst.opcode; - - alu_instruction_ptr->m_Word1_OP2.f6.src0_abs = 0x0; - alu_instruction_ptr->m_Word1_OP2.f6.src1_abs = 0x0; - - //alu_instruction_ptr->m_Word1_OP2.f6.update_execute_mask = 0x0; - //alu_instruction_ptr->m_Word1_OP2.f6.update_pred = 0x0; - switch (scalar_channel_index) - { - case 0: - alu_instruction_ptr->m_Word1_OP2.f6.write_mask = pAsm->D.dst.writex; - break; - case 1: - alu_instruction_ptr->m_Word1_OP2.f6.write_mask = pAsm->D.dst.writey; - break; - case 2: - alu_instruction_ptr->m_Word1_OP2.f6.write_mask = pAsm->D.dst.writez; - break; - case 3: - alu_instruction_ptr->m_Word1_OP2.f6.write_mask = pAsm->D.dst.writew; - break; - default: - alu_instruction_ptr->m_Word1_OP2.f6.write_mask = 1; //SQ_SEL_MASK; - break; - } - alu_instruction_ptr->m_Word1_OP2.f6.omod = SQ_ALU_OMOD_OFF; - } - else - { - alu_instruction_ptr->m_Word1_OP2.f.alu_inst = pAsm->D.dst.opcode; - - alu_instruction_ptr->m_Word1_OP2.f.src0_abs = 0x0; - alu_instruction_ptr->m_Word1_OP2.f.src1_abs = 0x0; - - //alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0x0; - //alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0x0; - switch (scalar_channel_index) - { - case 0: - alu_instruction_ptr->m_Word1_OP2.f.write_mask = pAsm->D.dst.writex; - break; - case 1: - alu_instruction_ptr->m_Word1_OP2.f.write_mask = pAsm->D.dst.writey; - break; - case 2: - alu_instruction_ptr->m_Word1_OP2.f.write_mask = pAsm->D.dst.writez; - break; - case 3: - alu_instruction_ptr->m_Word1_OP2.f.write_mask = pAsm->D.dst.writew; - break; - default: - alu_instruction_ptr->m_Word1_OP2.f.write_mask = 1; //SQ_SEL_MASK; - break; - } - alu_instruction_ptr->m_Word1_OP2.f.omod = SQ_ALU_OMOD_OFF; - } - } - - if(GL_FALSE == add_alu_instruction(pAsm, alu_instruction_ptr, contiguous_slots_needed) ) - { - return GL_FALSE; - } - - /* - * Judge the type of current instruction, is it vector or scalar - * instruction. - */ - if (is_single_scalar_operation) - { - if(GL_FALSE == check_scalar(pAsm, alu_instruction_ptr) ) - { - return GL_FALSE; - } - } - else - { - if(GL_FALSE == check_vector(pAsm, alu_instruction_ptr) ) - { - return GL_FALSE; - } - } - - contiguous_slots_needed = 0; - } - - return GL_TRUE; -} - GLboolean assemble_alu_instruction_literal(r700_AssemblerBase *pAsm, GLfloat * pLiteral) { R700ALUInstruction * alu_instruction_ptr; @@ -2987,44 +2757,6 @@ GLboolean next_ins(r700_AssemblerBase *pAsm) pAsm->S[2].bits = 0; pAsm->is_tex = GL_FALSE; pAsm->need_tex_barrier = GL_FALSE; - - return GL_TRUE; -} - -GLboolean next_ins2(r700_AssemblerBase *pAsm) -{ - struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); - - //ALU - if( GL_FALSE == assemble_alu_instruction2(pAsm) ) - { - radeon_error("Error assembling ALU instruction\n"); - return GL_FALSE; - } - - if(pAsm->D.dst.rtype == DST_REG_OUT) - { - if(pAsm->D.dst.op3) - { - // There is no mask for OP3 instructions, so all channels are written - pAsm->pucOutMask[pAsm->D.dst.reg - pAsm->starting_export_register_number] = 0xF; - } - else - { - pAsm->pucOutMask[pAsm->D.dst.reg - pAsm->starting_export_register_number] - |= (unsigned char)pAsm->pILInst[pAsm->uiCurInst].DstReg.WriteMask; - } - } - - //reset for next inst. - pAsm->D.bits = 0; - pAsm->D2.bits = 0; - pAsm->S[0].bits = 0; - pAsm->S[1].bits = 0; - pAsm->S[2].bits = 0; - pAsm->is_tex = GL_FALSE; - pAsm->need_tex_barrier = GL_FALSE; - pAsm->D2.bits = 0; return GL_TRUE; @@ -4537,7 +4269,7 @@ GLboolean assemble_LOGIC_PRED(r700_AssemblerBase *pAsm, BITS opcode) pAsm->S[1].src.swizzlez = SQ_SEL_0; pAsm->S[1].src.swizzlew = SQ_SEL_0; - if( GL_FALSE == next_ins2(pAsm) ) + if( GL_FALSE == next_ins(pAsm) ) { return GL_FALSE; } @@ -5683,6 +5415,7 @@ GLboolean setRetInLoopFlag(r700_AssemblerBase *pAsm, GLuint flagValue) pAsm->D.dst.predicated = 0; /* in reloc where dislink flag init inst, only one slot alu inst is handled. */ pAsm->D.dst.math = 1; /* TODO : not math really, but one channel op, more generic alu assembler needed */ + pAsm->D2.dst2.index_mode = SQ_INDEX_LOOP; /* Check this ! */ #if 0 pAsm->S[0].src.rtype = SRC_REC_LITERAL; //pAsm->S[0].src.reg = 0; @@ -5707,7 +5440,7 @@ GLboolean setRetInLoopFlag(r700_AssemblerBase *pAsm, GLuint flagValue) pAsm->S[0].src.swizzlez = flagValue; pAsm->S[0].src.swizzlew = flagValue; - if( GL_FALSE == next_ins2(pAsm) ) + if( GL_FALSE == next_ins(pAsm) ) { return GL_FALSE; } @@ -5735,6 +5468,7 @@ GLboolean testFlag(r700_AssemblerBase *pAsm) pAsm->D2.dst2.literal = 1; pAsm->D2.dst2.SaturateMode = SATURATE_OFF; pAsm->D.dst.predicated = 1; + pAsm->D2.dst2.index_mode = SQ_INDEX_LOOP; /* Check this ! */ pAsm->S[0].src.rtype = DST_REG_TEMPORARY; pAsm->S[0].src.reg = pAsm->flag_reg_index; @@ -5768,7 +5502,7 @@ GLboolean testFlag(r700_AssemblerBase *pAsm) pAsm->S[1].src.swizzlez = SQ_SEL_1; pAsm->S[1].src.swizzlew = SQ_SEL_1; - if( GL_FALSE == next_ins2(pAsm) ) + if( GL_FALSE == next_ins(pAsm) ) { return GL_FALSE; } diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index cfa2610a55..cb7685464d 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -116,6 +116,7 @@ typedef struct PVSINSTtag { BITS literal :2; BITS SaturateMode :2; + BITS index_mode :3; } PVSINST; typedef struct PVSSRCtag @@ -529,10 +530,7 @@ GLboolean check_vector(r700_AssemblerBase* pAsm, GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm); GLboolean next_ins(r700_AssemblerBase *pAsm); -GLboolean next_ins2(r700_AssemblerBase *pAsm); -GLboolean assemble_alu_instruction2(r700_AssemblerBase *pAsm); - -/* TODO : merge next_ins/2/literal, assemble_alu_instruction/2/literal */ +/* TODO : merge next_ins/literal, assemble_alu_instruction/literal */ GLboolean next_ins_literal(r700_AssemblerBase *pAsm, GLfloat * pLiteral); GLboolean assemble_alu_instruction_literal(r700_AssemblerBase *pAsm, GLfloat * pLiteral); -- cgit v1.2.3 From 4e86cedf5b7ab98dbe59115fc325f9b3172d58be Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Mon, 7 Dec 2009 15:23:40 +0200 Subject: r600: add assembler support for literal(inline) constants and use it in cubemap instruction sequence for testing --- src/mesa/drivers/dri/r600/r700_assembler.c | 67 +++++++++++++++++++++--------- src/mesa/drivers/dri/r600/r700_assembler.h | 3 +- 2 files changed, 49 insertions(+), 21 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 8155d53eeb..c1e3377af6 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -1733,7 +1733,7 @@ GLboolean add_alu_instruction(r700_AssemblerBase* pAsm, } else { - pAsm->cf_current_alu_clause_ptr->m_Word1.f.count++; + pAsm->cf_current_alu_clause_ptr->m_Word1.f.count += (GetInstructionSize(alu_instruction_ptr->m_ShaderInstType) / 2); } // If this clause constains any instruction that is forward dependent on a TEX instruction, @@ -2168,6 +2168,10 @@ GLboolean check_vector(r700_AssemblerBase* pAsm, GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) { + R700ALUInstruction * alu_instruction_ptr; + R700ALUInstructionHalfLiteral * alu_instruction_ptr_hl; + R700ALUInstructionFullLiteral * alu_instruction_ptr_fl; + GLuint number_of_scalar_operations; GLboolean is_single_scalar_operation; GLuint scalar_channel_index; @@ -2238,18 +2242,39 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) contiguous_slots_needed = 4; } + contiguous_slots_needed += pAsm->D2.dst2.literal_slots; + initialize(pAsm); for (scalar_channel_index=0; scalar_channel_index < number_of_scalar_operations; scalar_channel_index++) { - R700ALUInstruction* alu_instruction_ptr = (R700ALUInstruction*) CALLOC_STRUCT(R700ALUInstruction); - if (alu_instruction_ptr == NULL) - { - return GL_FALSE; - } - Init_R700ALUInstruction(alu_instruction_ptr); + if(scalar_channel_index == (number_of_scalar_operations-1)) + { + switch(pAsm->D2.dst2.literal_slots) + { + case 0: + alu_instruction_ptr = (R700ALUInstruction*) CALLOC_STRUCT(R700ALUInstruction); + Init_R700ALUInstruction(alu_instruction_ptr); + break; + case 1: + alu_instruction_ptr_hl = (R700ALUInstructionHalfLiteral*) CALLOC_STRUCT(R700ALUInstructionHalfLiteral); + Init_R700ALUInstructionHalfLiteral(alu_instruction_ptr_hl, pAsm->C[0].f, pAsm->C[1].f); + alu_instruction_ptr = (R700ALUInstruction*)alu_instruction_ptr_hl; + break; + case 2: + alu_instruction_ptr_fl = (R700ALUInstructionFullLiteral*) CALLOC_STRUCT(R700ALUInstructionFullLiteral); + Init_R700ALUInstructionFullLiteral(alu_instruction_ptr_fl,pAsm->C[0].f, pAsm->C[1].f, pAsm->C[2].f, pAsm->C[3].f); + alu_instruction_ptr = (R700ALUInstruction*)alu_instruction_ptr_fl; + break; + }; + } + else + { + alu_instruction_ptr = (R700ALUInstruction*) CALLOC_STRUCT(R700ALUInstruction); + Init_R700ALUInstruction(alu_instruction_ptr); + } //src 0 current_source_index = 0; @@ -2447,12 +2472,12 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) } } - contiguous_slots_needed = 0; + contiguous_slots_needed -= 1; } return GL_TRUE; } - +#if 0 GLboolean assemble_alu_instruction_literal(r700_AssemblerBase *pAsm, GLfloat * pLiteral) { R700ALUInstruction * alu_instruction_ptr; @@ -2705,7 +2730,7 @@ GLboolean assemble_alu_instruction_literal(r700_AssemblerBase *pAsm, GLfloat * p return GL_TRUE; } - +#endif GLboolean next_ins(r700_AssemblerBase *pAsm) { struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); @@ -2758,11 +2783,11 @@ GLboolean next_ins(r700_AssemblerBase *pAsm) pAsm->is_tex = GL_FALSE; pAsm->need_tex_barrier = GL_FALSE; pAsm->D2.bits = 0; - + pAsm->C[0].bits = pAsm->C[1].bits = pAsm->C[2].bits = pAsm->C[3].bits = 0; return GL_TRUE; } -/* not work yet */ +#if 0/* not work yet */ GLboolean next_ins_literal(r700_AssemblerBase *pAsm, GLfloat * pLiteral) { struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); @@ -2784,7 +2809,7 @@ GLboolean next_ins_literal(r700_AssemblerBase *pAsm, GLfloat * pLiteral) pAsm->need_tex_barrier = GL_FALSE; return GL_TRUE; } - +#endif GLboolean assemble_math_function(r700_AssemblerBase* pAsm, BITS opcode) { BITS tmp; @@ -4472,13 +4497,14 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) /* MULADD R0.x, R0.x, PS1, (0x3FC00000, 1.5f).x * MULADD R0.y, R0.y, PS1, (0x3FC00000, 1.5f).x * muladd has no writemask, have to use another temp - * also no support for imm constants, so add 1 here */ pAsm->D.dst.opcode = SQ_OP3_INST_MULADD; pAsm->D.dst.op3 = 1; setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); pAsm->D.dst.rtype = DST_REG_TEMPORARY; pAsm->D.dst.reg = tmp2; + pAsm->D2.dst2.literal_slots = 1; + pAsm->C[0].f = 1.5F; setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; @@ -4489,12 +4515,13 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) pAsm->S[1].src.reg = tmp1; setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_Z); setaddrmode_PVSSRC(&(pAsm->S[2].src), ADDR_ABSOLUTE); - pAsm->S[2].src.rtype = SRC_REG_TEMPORARY; + /* immediate c 1.5 */ + pAsm->S[2].src.rtype = SRC_REC_LITERAL; pAsm->S[2].src.reg = tmp1; - setswizzle_PVSSRC(&(pAsm->S[2].src), SQ_SEL_1); + setswizzle_PVSSRC(&(pAsm->S[2].src), SQ_SEL_X); next_ins(pAsm); - +#if 0 /* ADD the remaining .5 */ pAsm->D.dst.opcode = SQ_OP2_INST_ADD; setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); @@ -4515,7 +4542,7 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) noswizzle_PVSSRC(&(pAsm->S[1].src)); next_ins(pAsm); - +#endif /* tmp1.xy = temp2.xy */ pAsm->D.dst.opcode = SQ_OP2_INST_MOV; setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); @@ -5410,7 +5437,7 @@ GLboolean setRetInLoopFlag(r700_AssemblerBase *pAsm, GLuint flagValue) pAsm->D.dst.writey = 0; pAsm->D.dst.writez = 0; pAsm->D.dst.writew = 0; - pAsm->D2.dst2.literal = 1; + pAsm->D2.dst2.literal_slots = 1; pAsm->D2.dst2.SaturateMode = SATURATE_OFF; pAsm->D.dst.predicated = 0; /* in reloc where dislink flag init inst, only one slot alu inst is handled. */ @@ -5465,7 +5492,7 @@ GLboolean testFlag(r700_AssemblerBase *pAsm) pAsm->D.dst.writey = 0; pAsm->D.dst.writez = 0; pAsm->D.dst.writew = 0; - pAsm->D2.dst2.literal = 1; + pAsm->D2.dst2.literal_slots = 1; pAsm->D2.dst2.SaturateMode = SATURATE_OFF; pAsm->D.dst.predicated = 1; pAsm->D2.dst2.index_mode = SQ_INDEX_LOOP; /* Check this ! */ diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index cb7685464d..3fe65654ca 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -114,7 +114,7 @@ typedef struct PVSDSTtag typedef struct PVSINSTtag { - BITS literal :2; + BITS literal_slots :2; BITS SaturateMode :2; BITS index_mode :3; } PVSINST; @@ -345,6 +345,7 @@ typedef struct r700_AssemblerBase PVSDWORD D; PVSDWORD D2; PVSDWORD S[3]; + PVSDWORD C[4]; unsigned int uLastPosUpdate; unsigned int last_cond_register; -- cgit v1.2.3 From 2b8b16f6a6ce6091d4939cfb567a65a52757dff0 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Mon, 7 Dec 2009 16:09:10 +0200 Subject: r600: use the new inline constants feature to fix COS --- src/mesa/drivers/dri/r600/r700_assembler.c | 37 +++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index c1e3377af6..660410f1ad 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -3041,7 +3041,42 @@ GLboolean assemble_CMP(r700_AssemblerBase *pAsm) GLboolean assemble_COS(r700_AssemblerBase *pAsm) { - return assemble_math_function(pAsm, SQ_OP2_INST_COS); + int tmp; + //return assemble_math_function(pAsm, SQ_OP2_INST_COS); + checkop1(pAsm); + + tmp = gethelpr(pAsm); + + pAsm->D.dst.opcode = SQ_OP2_INST_MUL; + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp; + pAsm->D.dst.writex = 1; + + assemble_src(pAsm, 0, -1); + + pAsm->S[1].src.rtype = SRC_REC_LITERAL; + setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_X); + pAsm->D2.dst2.literal_slots = 1; + pAsm->C[0].f = 1/(3.1415926535 * 2); + pAsm->C[1].f = 0.0F; + next_ins(pAsm); + + pAsm->D.dst.opcode = SQ_OP2_INST_COS; + pAsm->D.dst.math = 1; + + assemble_dst(pAsm); + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp; + setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); + noneg_PVSSRC(&(pAsm->S[0].src)); + + next_ins(pAsm); + + return GL_TRUE; + } GLboolean assemble_DOT(r700_AssemblerBase *pAsm) -- cgit v1.2.3 From fbe06a9c2999a802333f8310156d58045d723799 Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Mon, 7 Dec 2009 16:23:07 +0200 Subject: r600: fix SIN also --- src/mesa/drivers/dri/r600/r700_assembler.c | 15 +++++---------- src/mesa/drivers/dri/r600/r700_assembler.h | 3 +-- 2 files changed, 6 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index 660410f1ad..caccedabdf 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -3039,10 +3039,9 @@ GLboolean assemble_CMP(r700_AssemblerBase *pAsm) return GL_TRUE; } -GLboolean assemble_COS(r700_AssemblerBase *pAsm) +GLboolean assemble_TRIG(r700_AssemblerBase *pAsm, BITS opcode) { int tmp; - //return assemble_math_function(pAsm, SQ_OP2_INST_COS); checkop1(pAsm); tmp = gethelpr(pAsm); @@ -3062,7 +3061,7 @@ GLboolean assemble_COS(r700_AssemblerBase *pAsm) pAsm->C[1].f = 0.0F; next_ins(pAsm); - pAsm->D.dst.opcode = SQ_OP2_INST_COS; + pAsm->D.dst.opcode = opcode; pAsm->D.dst.math = 1; assemble_dst(pAsm); @@ -3075,6 +3074,7 @@ GLboolean assemble_COS(r700_AssemblerBase *pAsm) next_ins(pAsm); + //TODO - replicate if more channels set in WriteMask return GL_TRUE; } @@ -4192,11 +4192,6 @@ GLboolean assemble_RSQ(r700_AssemblerBase *pAsm) return assemble_math_function(pAsm, SQ_OP2_INST_RECIPSQRT_IEEE); } -GLboolean assemble_SIN(r700_AssemblerBase *pAsm) -{ - return assemble_math_function(pAsm, SQ_OP2_INST_SIN); -} - GLboolean assemble_SCS(r700_AssemblerBase *pAsm) { BITS tmp; @@ -5693,7 +5688,7 @@ GLboolean AssembleInstr(GLuint uiFirstInst, return GL_FALSE; break; case OPCODE_COS: - if ( GL_FALSE == assemble_COS(pR700AsmCode) ) + if ( GL_FALSE == assemble_TRIG(pR700AsmCode, SQ_OP2_INST_COS) ) return GL_FALSE; break; @@ -5790,7 +5785,7 @@ GLboolean AssembleInstr(GLuint uiFirstInst, return GL_FALSE; break; case OPCODE_SIN: - if ( GL_FALSE == assemble_SIN(pR700AsmCode) ) + if ( GL_FALSE == assemble_TRIG(pR700AsmCode, SQ_OP2_INST_SIN) ) return GL_FALSE; break; case OPCODE_SCS: diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index 3fe65654ca..f83206b726 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -548,7 +548,6 @@ GLboolean assemble_ADD(r700_AssemblerBase *pAsm); GLboolean assemble_ARL(r700_AssemblerBase *pAsm); GLboolean assemble_BAD(char *opcode_str); GLboolean assemble_CMP(r700_AssemblerBase *pAsm); -GLboolean assemble_COS(r700_AssemblerBase *pAsm); GLboolean assemble_DOT(r700_AssemblerBase *pAsm); GLboolean assemble_DST(r700_AssemblerBase *pAsm); GLboolean assemble_EX2(r700_AssemblerBase *pAsm); @@ -569,12 +568,12 @@ GLboolean assemble_MUL(r700_AssemblerBase *pAsm); GLboolean assemble_POW(r700_AssemblerBase *pAsm); GLboolean assemble_RCP(r700_AssemblerBase *pAsm); GLboolean assemble_RSQ(r700_AssemblerBase *pAsm); -GLboolean assemble_SIN(r700_AssemblerBase *pAsm); GLboolean assemble_SCS(r700_AssemblerBase *pAsm); GLboolean assemble_SGE(r700_AssemblerBase *pAsm); GLboolean assemble_LOGIC(r700_AssemblerBase *pAsm, BITS opcode); GLboolean assemble_LOGIC_PRED(r700_AssemblerBase *pAsm, BITS opcode); +GLboolean assemble_TRIG(r700_AssemblerBase *pAsm, BITS opcode); GLboolean assemble_SLT(r700_AssemblerBase *pAsm); GLboolean assemble_STP(r700_AssemblerBase *pAsm); -- cgit v1.2.3 From 0f854105f5a430ab36281c9bed530eccb8b8f44c Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Mon, 7 Dec 2009 16:27:05 +0200 Subject: r600: remove (now) dead code --- src/mesa/drivers/dri/r600/r700_assembler.c | 301 +---------------------------- src/mesa/drivers/dri/r600/r700_assembler.h | 4 - 2 files changed, 2 insertions(+), 303 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index caccedabdf..dd1199756d 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -2477,260 +2477,7 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) return GL_TRUE; } -#if 0 -GLboolean assemble_alu_instruction_literal(r700_AssemblerBase *pAsm, GLfloat * pLiteral) -{ - R700ALUInstruction * alu_instruction_ptr; - R700ALUInstructionHalfLiteral * alu_instruction_ptr_hl; - R700ALUInstructionFullLiteral * alu_instruction_ptr_fl; - - GLuint number_of_scalar_operations; - GLboolean is_single_scalar_operation; - GLuint scalar_channel_index; - - GLuint contiguous_slots_needed; - GLuint lastInstruction; - GLuint not_masked[4]; - - GLuint uNumSrc = r700GetNumOperands(pAsm); - - GLboolean bSplitInst = GL_FALSE; - - number_of_scalar_operations = 0; - contiguous_slots_needed = 0; - - if(1 == pAsm->D.dst.writew) - { - lastInstruction = 3; - number_of_scalar_operations++; - not_masked[3] = 1; - } - else - { - not_masked[3] = 0; - } - if(1 == pAsm->D.dst.writez) - { - lastInstruction = 2; - number_of_scalar_operations++; - not_masked[2] = 1; - } - else - { - not_masked[2] = 0; - } - if(1 == pAsm->D.dst.writey) - { - lastInstruction = 1; - number_of_scalar_operations++; - not_masked[1] = 1; - } - else - { - not_masked[1] = 0; - } - if(1 == pAsm->D.dst.writex) - { - lastInstruction = 0; - number_of_scalar_operations++; - not_masked[0] = 1; - } - else - { - not_masked[0] = 0; - } - - if(GL_TRUE == is_reduction_opcode(&(pAsm->D)) ) - { - contiguous_slots_needed = 4; - } - else - { - contiguous_slots_needed = number_of_scalar_operations; - } - - if(1 == pAsm->D2.dst2.literal) - { - contiguous_slots_needed += 1; - } - else if(2 == pAsm->D2.dst2.literal) - { - contiguous_slots_needed += 2; - } - - initialize(pAsm); - - for (scalar_channel_index=0; scalar_channel_index < 4; scalar_channel_index++) - { - if(0 == not_masked[scalar_channel_index]) - { - continue; - } - - if(scalar_channel_index == lastInstruction) - { - switch (pAsm->D2.dst2.literal) - { - case 0: - alu_instruction_ptr = (R700ALUInstruction*) CALLOC_STRUCT(R700ALUInstruction); - if (alu_instruction_ptr == NULL) - { - return GL_FALSE; - } - Init_R700ALUInstruction(alu_instruction_ptr); - break; - case 1: - alu_instruction_ptr_hl = (R700ALUInstructionHalfLiteral*) CALLOC_STRUCT(R700ALUInstructionHalfLiteral); - if (alu_instruction_ptr_hl == NULL) - { - return GL_FALSE; - } - Init_R700ALUInstructionHalfLiteral(alu_instruction_ptr_hl, pLiteral[0], pLiteral[1]); - alu_instruction_ptr = (R700ALUInstruction*)alu_instruction_ptr_hl; - break; - case 2: - alu_instruction_ptr_fl = (R700ALUInstructionFullLiteral*) CALLOC_STRUCT(R700ALUInstructionFullLiteral); - if (alu_instruction_ptr_fl == NULL) - { - return GL_FALSE; - } - Init_R700ALUInstructionFullLiteral(alu_instruction_ptr_fl, pLiteral[0], pLiteral[1], pLiteral[2], pLiteral[3]); - alu_instruction_ptr = (R700ALUInstruction*)alu_instruction_ptr_fl; - break; - default: - break; - }; - } - else - { - alu_instruction_ptr = (R700ALUInstruction*) CALLOC_STRUCT(R700ALUInstruction); - if (alu_instruction_ptr == NULL) - { - return GL_FALSE; - } - Init_R700ALUInstruction(alu_instruction_ptr); - } - - //src 0 - if (GL_FALSE == assemble_alu_src(alu_instruction_ptr, - 0, - &(pAsm->S[0].src), - scalar_channel_index) ) - { - return GL_FALSE; - } - - if (uNumSrc > 1) - { - // Process source 1 - if (GL_FALSE == assemble_alu_src(alu_instruction_ptr, - 1, - &(pAsm->S[1].src), - scalar_channel_index) ) - { - return GL_FALSE; - } - } - - //other bits - alu_instruction_ptr->m_Word0.f.index_mode = SQ_INDEX_LOOP; - - if(scalar_channel_index == lastInstruction) - { - alu_instruction_ptr->m_Word0.f.last = 1; - } - - alu_instruction_ptr->m_Word0.f.pred_sel = 0x0; - if(1 == pAsm->D.dst.predicated) - { - alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0x1; - alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0x1; - } - else - { - alu_instruction_ptr->m_Word1_OP2.f.update_pred = 0; - alu_instruction_ptr->m_Word1_OP2.f.update_execute_mask = 0; - } - - // dst - if( (pAsm->D.dst.rtype == DST_REG_TEMPORARY) || - (pAsm->D.dst.rtype == DST_REG_OUT) ) - { - alu_instruction_ptr->m_Word1.f.dst_gpr = pAsm->D.dst.reg; - } - else - { - radeon_error("Only temp destination registers supported for ALU dest regs.\n"); - return GL_FALSE; - } - - alu_instruction_ptr->m_Word1.f.dst_rel = SQ_ABSOLUTE; //D.rtype - - alu_instruction_ptr->m_Word1.f.dst_chan = scalar_channel_index; - - alu_instruction_ptr->m_Word1.f.clamp = pAsm->D2.dst2.SaturateMode; - - if (pAsm->D.dst.op3) - { - //op3 - alu_instruction_ptr->m_Word1_OP3.f.alu_inst = pAsm->D.dst.opcode; - - //There's 3rd src for op3 - if ( GL_FALSE == assemble_alu_src(alu_instruction_ptr, - 2, - &(pAsm->S[2].src), - scalar_channel_index) ) - { - return GL_FALSE; - } - } - else - { - //op2 - if (pAsm->bR6xx) - { - alu_instruction_ptr->m_Word1_OP2.f6.alu_inst = pAsm->D.dst.opcode; - alu_instruction_ptr->m_Word1_OP2.f6.src0_abs = 0x0; - alu_instruction_ptr->m_Word1_OP2.f6.src1_abs = 0x0; - alu_instruction_ptr->m_Word1_OP2.f6.write_mask = 1; - alu_instruction_ptr->m_Word1_OP2.f6.omod = SQ_ALU_OMOD_OFF; - } - else - { - alu_instruction_ptr->m_Word1_OP2.f.alu_inst = pAsm->D.dst.opcode; - alu_instruction_ptr->m_Word1_OP2.f.src0_abs = 0x0; - alu_instruction_ptr->m_Word1_OP2.f.src1_abs = 0x0; - alu_instruction_ptr->m_Word1_OP2.f.write_mask = 1; - alu_instruction_ptr->m_Word1_OP2.f.omod = SQ_ALU_OMOD_OFF; - } - } - - if(GL_FALSE == add_alu_instruction(pAsm, alu_instruction_ptr, contiguous_slots_needed) ) - { - return GL_FALSE; - } - - if (1 == number_of_scalar_operations) - { - if(GL_FALSE == check_scalar(pAsm, alu_instruction_ptr) ) - { - return GL_FALSE; - } - } - else - { - if(GL_FALSE == check_vector(pAsm, alu_instruction_ptr) ) - { - return GL_FALSE; - } - } - contiguous_slots_needed -= 2; - } - - return GL_TRUE; -} -#endif GLboolean next_ins(r700_AssemblerBase *pAsm) { struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); @@ -2787,29 +2534,6 @@ GLboolean next_ins(r700_AssemblerBase *pAsm) return GL_TRUE; } -#if 0/* not work yet */ -GLboolean next_ins_literal(r700_AssemblerBase *pAsm, GLfloat * pLiteral) -{ - struct prog_instruction *pILInst = &(pAsm->pILInst[pAsm->uiCurInst]); - - //ALU - if( GL_FALSE == assemble_alu_instruction_literal(pAsm, pLiteral) ) - { - radeon_error("Error assembling ALU instruction\n"); - return GL_FALSE; - } - - //reset for next inst. - pAsm->D.bits = 0; - pAsm->D2.bits = 0; - pAsm->S[0].bits = 0; - pAsm->S[1].bits = 0; - pAsm->S[2].bits = 0; - pAsm->is_tex = GL_FALSE; - pAsm->need_tex_barrier = GL_FALSE; - return GL_TRUE; -} -#endif GLboolean assemble_math_function(r700_AssemblerBase* pAsm, BITS opcode) { BITS tmp; @@ -4533,8 +4257,6 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); pAsm->D.dst.rtype = DST_REG_TEMPORARY; pAsm->D.dst.reg = tmp2; - pAsm->D2.dst2.literal_slots = 1; - pAsm->C[0].f = 1.5F; setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; @@ -4546,33 +4268,14 @@ GLboolean assemble_TEX(r700_AssemblerBase *pAsm) setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_Z); setaddrmode_PVSSRC(&(pAsm->S[2].src), ADDR_ABSOLUTE); /* immediate c 1.5 */ + pAsm->D2.dst2.literal_slots = 1; + pAsm->C[0].f = 1.5F; pAsm->S[2].src.rtype = SRC_REC_LITERAL; pAsm->S[2].src.reg = tmp1; setswizzle_PVSSRC(&(pAsm->S[2].src), SQ_SEL_X); next_ins(pAsm); -#if 0 - /* ADD the remaining .5 */ - pAsm->D.dst.opcode = SQ_OP2_INST_ADD; - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp2; - pAsm->D.dst.writex = 1; - pAsm->D.dst.writey = 1; - pAsm->D.dst.writez = 0; - pAsm->D.dst.writew = 0; - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp2; - noswizzle_PVSSRC(&(pAsm->S[0].src)); - setaddrmode_PVSSRC(&(pAsm->S[1].src), ADDR_ABSOLUTE); - pAsm->S[1].src.rtype = SRC_REG_TEMPORARY; - pAsm->S[1].src.reg = 252; // SQ_ALU_SRC_0_5 - noswizzle_PVSSRC(&(pAsm->S[1].src)); - - next_ins(pAsm); -#endif /* tmp1.xy = temp2.xy */ pAsm->D.dst.opcode = SQ_OP2_INST_MOV; setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index f83206b726..6dc44017eb 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -531,10 +531,6 @@ GLboolean check_vector(r700_AssemblerBase* pAsm, GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm); GLboolean next_ins(r700_AssemblerBase *pAsm); -/* TODO : merge next_ins/literal, assemble_alu_instruction/literal */ -GLboolean next_ins_literal(r700_AssemblerBase *pAsm, GLfloat * pLiteral); -GLboolean assemble_alu_instruction_literal(r700_AssemblerBase *pAsm, GLfloat * pLiteral); - GLboolean pops(r700_AssemblerBase *pAsm, GLuint pops); GLboolean jumpToOffest(r700_AssemblerBase *pAsm, GLuint pops, GLint offset); GLboolean setRetInLoopFlag(r700_AssemblerBase *pAsm, GLuint flagValue); -- cgit v1.2.3 From 629a648b059d8a2653b6a9cdf7f460533de0e1da Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Mon, 7 Dec 2009 17:22:03 +0200 Subject: r600: and finally fix SCS --- src/mesa/drivers/dri/r600/r700_assembler.c | 97 ++++++++++++++---------------- 1 file changed, 46 insertions(+), 51 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index dd1199756d..aed84fc3bd 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -2237,7 +2237,7 @@ GLboolean assemble_alu_instruction(r700_AssemblerBase *pAsm) contiguous_slots_needed = 0; - if(GL_TRUE == is_reduction_opcode(&(pAsm->D)) ) + if(!is_single_scalar_operation) { contiguous_slots_needed = 4; } @@ -3920,68 +3920,63 @@ GLboolean assemble_SCS(r700_AssemblerBase *pAsm) { BITS tmp; - checkop1(pAsm); - - tmp = gethelpr(pAsm); - - // COS tmp.x, a.x - pAsm->D.dst.opcode = SQ_OP2_INST_COS; - pAsm->D.dst.math = 1; + checkop1(pAsm); - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - pAsm->D.dst.writex = 1; + tmp = gethelpr(pAsm); + /* tmp.x = src /2*PI */ + pAsm->D.dst.opcode = SQ_OP2_INST_MUL; + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = tmp; + pAsm->D.dst.writex = 1; - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } + assemble_src(pAsm, 0, -1); - if ( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } + pAsm->S[1].src.rtype = SRC_REC_LITERAL; + setswizzle_PVSSRC(&(pAsm->S[1].src), SQ_SEL_X); + pAsm->D2.dst2.literal_slots = 1; + pAsm->C[0].f = 1/(3.1415926535 * 2); + pAsm->C[1].f = 0.0F; - // SIN tmp.y, a.x - pAsm->D.dst.opcode = SQ_OP2_INST_SIN; - pAsm->D.dst.math = 1; + next_ins(pAsm); - setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); - pAsm->D.dst.rtype = DST_REG_TEMPORARY; - pAsm->D.dst.reg = tmp; - pAsm->D.dst.writey = 1; + // COS dst.x, a.x + pAsm->D.dst.opcode = SQ_OP2_INST_COS; + pAsm->D.dst.math = 1; - if( GL_FALSE == assemble_src(pAsm, 0, -1) ) - { - return GL_FALSE; - } + assemble_dst(pAsm); + /* mask y */ + pAsm->D.dst.writey = 0; - if( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp; + setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); + noneg_PVSSRC(&(pAsm->S[0].src)); - // MOV dst.mask, tmp - pAsm->D.dst.opcode = SQ_OP2_INST_MOV; + if ( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } - if( GL_FALSE == assemble_dst(pAsm) ) - { - return GL_FALSE; - } + // SIN dst.y, a.x + pAsm->D.dst.opcode = SQ_OP2_INST_SIN; + pAsm->D.dst.math = 1; - setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); - pAsm->S[0].src.rtype = DST_REG_TEMPORARY; - pAsm->S[0].src.reg = tmp; + assemble_dst(pAsm); + /* mask x */ + pAsm->D.dst.writex = 0; - noswizzle_PVSSRC(&(pAsm->S[0].src)); - pAsm->S[0].src.swizzlez = SQ_SEL_0; - pAsm->S[0].src.swizzlew = SQ_SEL_0; + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = tmp; + setswizzle_PVSSRC(&(pAsm->S[0].src), SQ_SEL_X); + noneg_PVSSRC(&(pAsm->S[0].src)); - if ( GL_FALSE == next_ins(pAsm) ) - { - return GL_FALSE; - } + if( GL_FALSE == next_ins(pAsm) ) + { + return GL_FALSE; + } return GL_TRUE; } -- cgit v1.2.3 From bc7567d9665924650c43c661d07ae9a922554bee Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 7 Dec 2009 14:12:28 -0700 Subject: tgsi: fix some off-by-one errors in shader length, instruction length The ureg and/or tgsi-simplification work introduced some inconsistencies between the ureg and traditional TGSI construction code. Now the tgsi_instruction::NrTokens field is consistant and the tgsi_header::BodySize field isn't off by one. Fixes bug 25455. --- src/gallium/auxiliary/tgsi/tgsi_build.c | 2 +- src/gallium/auxiliary/tgsi/tgsi_parse.c | 5 ++--- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/gallium/auxiliary/tgsi/tgsi_build.c b/src/gallium/auxiliary/tgsi/tgsi_build.c index d75ab1b3ff..4092f78f4a 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_build.c +++ b/src/gallium/auxiliary/tgsi/tgsi_build.c @@ -399,7 +399,7 @@ tgsi_default_instruction( void ) struct tgsi_instruction instruction; instruction.Type = TGSI_TOKEN_TYPE_INSTRUCTION; - instruction.NrTokens = 1; + instruction.NrTokens = 0; instruction.Opcode = TGSI_OPCODE_MOV; instruction.Saturate = TGSI_SAT_NONE; instruction.Predicate = 0; diff --git a/src/gallium/auxiliary/tgsi/tgsi_parse.c b/src/gallium/auxiliary/tgsi/tgsi_parse.c index 356b4473d9..8f2b6a307d 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_parse.c +++ b/src/gallium/auxiliary/tgsi/tgsi_parse.c @@ -60,7 +60,7 @@ tgsi_parse_end_of_tokens( struct tgsi_parse_context *ctx ) { return ctx->Position >= - 1 + ctx->FullHeader.Header.HeaderSize + ctx->FullHeader.Header.BodySize; + ctx->FullHeader.Header.HeaderSize + ctx->FullHeader.Header.BodySize; } @@ -232,8 +232,7 @@ tgsi_num_tokens(const struct tgsi_token *tokens) struct tgsi_parse_context ctx; if (tgsi_parse_init(&ctx, tokens) == TGSI_PARSE_OK) { unsigned len = (ctx.FullHeader.Header.HeaderSize + - ctx.FullHeader.Header.BodySize + - 1); + ctx.FullHeader.Header.BodySize); return len; } return 0; diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 8f0b9842ff..3f943845f5 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -1053,7 +1053,7 @@ fixup_header_size(struct ureg_program *ureg) { union tgsi_any_token *out = retrieve_token( ureg, DOMAIN_DECL, 0 ); - out->header.BodySize = ureg->domain[DOMAIN_DECL].count - 3; + out->header.BodySize = ureg->domain[DOMAIN_DECL].count - 2; } -- cgit v1.2.3 From ee1720b99dfb5964962f2346406a4e3e88374a68 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Tue, 8 Dec 2009 19:13:48 +0100 Subject: gallium: fix more potential strict aliasing issues In particular, gcc man page warns that union a_union { int i; double d; }; int f() { double d = 3.0; return ((union a_union *) &d)->i; } "might" not be ok (why not?), even though it doesn't seem to generate any warnings. Hence don't use this and do the extra step to actually use assignment to get the values in/out of the union. This changes parts of 3456f9149b3009fcfce80054759d05883d3c4ee5. --- src/gallium/drivers/r300/r300_state.c | 10 +- src/gallium/drivers/svga/svga_pipe_sampler.c | 5 +- src/gallium/state_trackers/vega/vg_translate.c | 190 ++++++++++++++++++------- src/mesa/state_tracker/st_atom_pixeltransfer.c | 4 +- 4 files changed, 148 insertions(+), 61 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 4ddbb357b6..a83075df92 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -151,9 +151,10 @@ static void r300_set_blend_color(struct pipe_context* pipe, const struct pipe_blend_color* color) { struct r300_context* r300 = r300_context(pipe); + union util_color uc; - util_pack_color(color->color, PIPE_FORMAT_A8R8G8B8_UNORM, - (union util_color *)&r300->blend_color_state->blend_color); + util_pack_color(color->color, PIPE_FORMAT_A8R8G8B8_UNORM, &uc); + r300->blend_color_state->blend_color = uc.ui; /* XXX if FP16 blending is enabled, we should use the FP16 format */ r300->blend_color_state->blend_color_red_alpha = @@ -513,6 +514,7 @@ static void* struct r300_context* r300 = r300_context(pipe); struct r300_sampler_state* sampler = CALLOC_STRUCT(r300_sampler_state); int lod_bias; + union util_color uc; sampler->filter0 |= (r300_translate_wrap(state->wrap_s) << R300_TX_WRAP_S_SHIFT) | @@ -534,8 +536,8 @@ static void* sampler->filter1 |= r300_anisotropy(state->max_anisotropy); - util_pack_color(state->border_color, PIPE_FORMAT_A8R8G8B8_UNORM, - (union util_color *)&sampler->border_color); + util_pack_color(state->border_color, PIPE_FORMAT_A8R8G8B8_UNORM, &uc); + sampler->border_color = uc.ui; /* R500-specific fixups and optimizations */ if (r300_screen(r300->context.screen)->caps->is_r500) { diff --git a/src/gallium/drivers/svga/svga_pipe_sampler.c b/src/gallium/drivers/svga/svga_pipe_sampler.c index 7f530083d6..78053e755e 100644 --- a/src/gallium/drivers/svga/svga_pipe_sampler.c +++ b/src/gallium/drivers/svga/svga_pipe_sampler.c @@ -101,6 +101,7 @@ svga_create_sampler_state(struct pipe_context *pipe, { struct svga_context *svga = svga_context(pipe); struct svga_sampler_state *cso = CALLOC_STRUCT( svga_sampler_state ); + union util_color uc; cso->mipfilter = translate_mip_filter(sampler->min_mip_filter); cso->magfilter = translate_img_filter( sampler->mag_img_filter ); @@ -121,8 +122,8 @@ svga_create_sampler_state(struct pipe_context *pipe, ubyte a = float_to_ubyte(sampler->border_color[3]); util_pack_color_ub( r, g, b, a, - PIPE_FORMAT_B8G8R8A8_UNORM, - (union util_color *)&cso->bordercolor ); + PIPE_FORMAT_B8G8R8A8_UNORM, &uc); + cso->bordercolor = uc.ui; } /* No SVGA3D support for: diff --git a/src/gallium/state_trackers/vega/vg_translate.c b/src/gallium/state_trackers/vega/vg_translate.c index 5051d83831..03575ca3dd 100644 --- a/src/gallium/state_trackers/vega/vg_translate.c +++ b/src/gallium/state_trackers/vega/vg_translate.c @@ -474,6 +474,7 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, VGfloat rgba[][4]) { VGint i; + union util_color uc; switch (dataFormat) { case VG_sRGBX_8888: { @@ -486,8 +487,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, b = (*src >> 8) & 0xff; a = 0xff; - util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } } @@ -502,8 +506,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, b = (*src >> 8) & 0xff; a = (*src >> 0) & 0xff; - util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } return; @@ -519,8 +526,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, b = (*src >> 8) & 0xff; a = (*src >> 0) & 0xff; - util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } return; @@ -536,8 +546,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, clr[2] = ((*src >> 0) & 31)/31.; clr[3] = 1.f; - util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } } @@ -552,8 +565,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, clr[2] = ((*src >> 1) & 31)/31.; clr[3] = ((*src >> 0) & 1)/1.; - util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } } @@ -568,8 +584,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, clr[2] = ((*src >> 4) & 15)/15.; clr[3] = ((*src >> 0) & 15)/15.; - util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } } @@ -578,8 +597,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, VGubyte *src = (VGubyte *)data; src += offset; for (i = 0; i < n; ++i) { - util_pack_color_ub(0xff, 0xff, 0xff, *src, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color_ub(0xff, 0xff, 0xff, *src, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } } @@ -594,8 +616,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, b = (*src >> 8) & 0xff; a = 0xff; - util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } } @@ -610,8 +635,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, b = (*src >> 8) & 0xff; a = (*src >> 0) & 0xff; - util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } return; @@ -627,8 +655,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, b = (*src >> 8) & 0xff; a = (*src >> 0) & 0xff; - util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } return; @@ -638,8 +669,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, VGubyte *src = (VGubyte *)data; src += offset; for (i = 0; i < n; ++i) { - util_pack_color_ub(0xff, 0xff, 0xff, *src, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color_ub(0xff, 0xff, 0xff, *src, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } } @@ -648,8 +682,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, VGubyte *src = (VGubyte *)data; src += offset; for (i = 0; i < n; ++i) { - util_pack_color_ub(0xff, 0xff, 0xff, *src, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color_ub(0xff, 0xff, 0xff, *src, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } } @@ -667,8 +704,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, clr[2] = clr[0]; clr[3] = 1.f; - util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i+j]); + util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i+j][0] = uc.f[0]; + rgba[i+j][1] = uc.f[1]; + rgba[i+j][2] = uc.f[2]; + rgba[i+j][3] = uc.f[3]; } ++src; } @@ -688,8 +728,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, clr[2] = 0.f; clr[3] = (((*src) & (1<> shift); - util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i+j]); + util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i+j][0] = uc.f[0]; + rgba[i+j][1] = uc.f[1]; + rgba[i+j][2] = uc.f[2]; + rgba[i+j][3] = uc.f[3]; } ++src; } @@ -715,8 +758,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, clr[2] = 0.f; clr[3] = ((*src) & (bitter)) >> shift; - util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i +j]); + util_pack_color(clr, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i+j][0] = uc.f[0]; + rgba[i+j][1] = uc.f[1]; + rgba[i+j][2] = uc.f[2]; + rgba[i+j][3] = uc.f[3]; } ++src; } @@ -735,8 +781,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, g = (*src >> 8) & 0xff; b = (*src >> 0) & 0xff; - util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } return; @@ -752,8 +801,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, g = (*src >> 8) & 0xff; b = (*src >> 0) & 0xff; - util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } return; @@ -775,8 +827,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, g = (*src >> 8) & 0xff; b = (*src >> 0) & 0xff; - util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } return; @@ -792,8 +847,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, g = (*src >> 8) & 0xff; b = (*src >> 0) & 0xff; - util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } return; @@ -811,8 +869,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, r = (*src >> 8) & 0xff; a = (*src >> 0) & 0xff; - util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } return; @@ -828,8 +889,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, r = (*src >> 8) & 0xff; a = (*src >> 0) & 0xff; - util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } return; @@ -853,8 +917,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, r = (*src >> 8) & 0xff; a = (*src >> 0) & 0xff; - util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } return; @@ -870,8 +937,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, r = (*src >> 8) & 0xff; a = (*src >> 0) & 0xff; - util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } return; @@ -889,8 +959,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, g = (*src >> 8) & 0xff; r = (*src >> 0) & 0xff; - util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } return; @@ -906,8 +979,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, g = (*src >> 8) & 0xff; r = (*src >> 0) & 0xff; - util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } return; @@ -929,8 +1005,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, g = (*src >> 8) & 0xff; r = (*src >> 0) & 0xff; - util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } return; @@ -946,8 +1025,11 @@ void _vega_unpack_float_span_rgba(struct vg_context *ctx, g = (*src >> 8) & 0xff; r = (*src >> 0) & 0xff; - util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, - (union util_color *)rgba[i]); + util_pack_color_ub(r, g, b, a, PIPE_FORMAT_R32G32B32A32_FLOAT, &uc); + rgba[i][0] = uc.f[0]; + rgba[i][1] = uc.f[1]; + rgba[i][2] = uc.f[2]; + rgba[i][3] = uc.f[3]; ++src; } return; diff --git a/src/mesa/state_tracker/st_atom_pixeltransfer.c b/src/mesa/state_tracker/st_atom_pixeltransfer.c index 5e2ae1bb36..6a5854e9ba 100644 --- a/src/mesa/state_tracker/st_atom_pixeltransfer.c +++ b/src/mesa/state_tracker/st_atom_pixeltransfer.c @@ -162,12 +162,14 @@ load_color_map_texture(GLcontext *ctx, struct pipe_texture *pt) */ for (i = 0; i < texSize; i++) { for (j = 0; j < texSize; j++) { + union util_color uc; int k = (i * texSize + j); ubyte r = ctx->PixelMaps.RtoR.Map8[j * rSize / texSize]; ubyte g = ctx->PixelMaps.GtoG.Map8[i * gSize / texSize]; ubyte b = ctx->PixelMaps.BtoB.Map8[j * bSize / texSize]; ubyte a = ctx->PixelMaps.AtoA.Map8[i * aSize / texSize]; - util_pack_color_ub(r, g, b, a, pt->format, (union util_color *)(dest + k)); + util_pack_color_ub(r, g, b, a, pt->format, &uc); + *(dest + k) = uc.ui; } } -- cgit v1.2.3 From fd7a9ec7f97d540d22f546d96c3d1c808f163bba Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Tue, 8 Dec 2009 17:42:49 +0100 Subject: gallium: use boolean instead of bool in p_refcnt.h all code in gallium should use boolean not bool --- src/gallium/include/pipe/p_refcnt.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gallium/include/pipe/p_refcnt.h b/src/gallium/include/pipe/p_refcnt.h index f1875b6b82..e252f55900 100644 --- a/src/gallium/include/pipe/p_refcnt.h +++ b/src/gallium/include/pipe/p_refcnt.h @@ -51,7 +51,7 @@ pipe_reference_init(struct pipe_reference *reference, unsigned count) } -static INLINE bool +static INLINE boolean pipe_is_referenced(struct pipe_reference *reference) { return p_atomic_read(&reference->count) != 0; @@ -63,10 +63,10 @@ pipe_is_referenced(struct pipe_reference *reference) * The old thing pointed to, if any, will be unreferenced. * Both 'ptr' and 'reference' may be NULL. */ -static INLINE bool +static INLINE boolean pipe_reference(struct pipe_reference *ptr, struct pipe_reference *reference) { - bool destroy = FALSE; + boolean destroy = FALSE; if(ptr != reference) { /* bump the reference.count first */ -- cgit v1.2.3 From 849a0644ada6ed7c3576babc3b348bee227118ff Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Tue, 8 Dec 2009 17:44:51 +0100 Subject: cell: use boolean instead of bool --- src/gallium/drivers/cell/ppu/cell_gen_fp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/cell/ppu/cell_gen_fp.c b/src/gallium/drivers/cell/ppu/cell_gen_fp.c index 1895a7940c..1d8a11a4ac 100644 --- a/src/gallium/drivers/cell/ppu/cell_gen_fp.c +++ b/src/gallium/drivers/cell/ppu/cell_gen_fp.c @@ -995,7 +995,7 @@ static boolean emit_inequality(struct codegen *gen, const struct tgsi_full_instruction *inst) { int ch, s1_reg[4], s2_reg[4], d_reg[4], one_reg; - bool complement = FALSE; + boolean complement = FALSE; one_reg = get_const_one_reg(gen); -- cgit v1.2.3 From 47c780180b888e115b630cd940fe9c29dd53b4c5 Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Tue, 8 Dec 2009 17:51:19 +0100 Subject: nouveau: use boolean instead of bool --- src/gallium/drivers/nv04/nv04_transfer.c | 2 +- src/gallium/drivers/nv10/nv10_transfer.c | 2 +- src/gallium/drivers/nv20/nv20_transfer.c | 2 +- src/gallium/drivers/nv30/nv30_transfer.c | 2 +- src/gallium/drivers/nv40/nv40_transfer.c | 2 +- src/gallium/drivers/nv50/nv50_context.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/nv04/nv04_transfer.c b/src/gallium/drivers/nv04/nv04_transfer.c index e8ff686b4a..d66d6c6346 100644 --- a/src/gallium/drivers/nv04/nv04_transfer.c +++ b/src/gallium/drivers/nv04/nv04_transfer.c @@ -11,7 +11,7 @@ struct nv04_transfer { struct pipe_transfer base; struct pipe_surface *surface; - bool direct; + boolean direct; }; static void diff --git a/src/gallium/drivers/nv10/nv10_transfer.c b/src/gallium/drivers/nv10/nv10_transfer.c index 9e44d37367..06bb513417 100644 --- a/src/gallium/drivers/nv10/nv10_transfer.c +++ b/src/gallium/drivers/nv10/nv10_transfer.c @@ -11,7 +11,7 @@ struct nv10_transfer { struct pipe_transfer base; struct pipe_surface *surface; - bool direct; + boolean direct; }; static void diff --git a/src/gallium/drivers/nv20/nv20_transfer.c b/src/gallium/drivers/nv20/nv20_transfer.c index f2e0a34db9..26a73c5143 100644 --- a/src/gallium/drivers/nv20/nv20_transfer.c +++ b/src/gallium/drivers/nv20/nv20_transfer.c @@ -11,7 +11,7 @@ struct nv20_transfer { struct pipe_transfer base; struct pipe_surface *surface; - bool direct; + boolean direct; }; static void diff --git a/src/gallium/drivers/nv30/nv30_transfer.c b/src/gallium/drivers/nv30/nv30_transfer.c index c8c3bd1f17..e29bfbd3ef 100644 --- a/src/gallium/drivers/nv30/nv30_transfer.c +++ b/src/gallium/drivers/nv30/nv30_transfer.c @@ -11,7 +11,7 @@ struct nv30_transfer { struct pipe_transfer base; struct pipe_surface *surface; - bool direct; + boolean direct; }; static void diff --git a/src/gallium/drivers/nv40/nv40_transfer.c b/src/gallium/drivers/nv40/nv40_transfer.c index 1ee5cf39e0..ed5be1cf87 100644 --- a/src/gallium/drivers/nv40/nv40_transfer.c +++ b/src/gallium/drivers/nv40/nv40_transfer.c @@ -11,7 +11,7 @@ struct nv40_transfer { struct pipe_transfer base; struct pipe_surface *surface; - bool direct; + boolean direct; }; static void diff --git a/src/gallium/drivers/nv50/nv50_context.h b/src/gallium/drivers/nv50/nv50_context.h index 4b0f062295..79135f2f36 100644 --- a/src/gallium/drivers/nv50/nv50_context.h +++ b/src/gallium/drivers/nv50/nv50_context.h @@ -65,7 +65,7 @@ struct nv50_rasterizer_stateobj { }; struct nv50_sampler_stateobj { - bool normalized; + boolean normalized; unsigned tsc[8]; }; -- cgit v1.2.3 From 54b0ed8360019fc6e0234c2c3413be40fe4d3b59 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Tue, 8 Dec 2009 15:03:15 -0700 Subject: vbo: fix array index out of bounds error, and fix evaluator priorities Fixes bug 25525. Plus, the GL_NV_vertex_program evaluators alias and override the convential evaluator maps, so set their state after the conventional maps. --- src/mesa/vbo/vbo_exec_eval.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/mesa/vbo/vbo_exec_eval.c b/src/mesa/vbo/vbo_exec_eval.c index 0c691b3a5c..a7846213d0 100644 --- a/src/mesa/vbo/vbo_exec_eval.c +++ b/src/mesa/vbo/vbo_exec_eval.c @@ -35,17 +35,20 @@ static void clear_active_eval1( struct vbo_exec_context *exec, GLuint attr ) { + assert(attr < Elements(exec->eval.map1)); exec->eval.map1[attr].map = NULL; } static void clear_active_eval2( struct vbo_exec_context *exec, GLuint attr ) { + assert(attr < Elements(exec->eval.map2)); exec->eval.map2[attr].map = NULL; } static void set_active_eval1( struct vbo_exec_context *exec, GLuint attr, GLuint dim, struct gl_1d_map *map ) { + assert(attr < Elements(exec->eval.map1)); if (!exec->eval.map1[attr].map) { exec->eval.map1[attr].map = map; exec->eval.map1[attr].sz = dim; @@ -55,6 +58,7 @@ static void set_active_eval1( struct vbo_exec_context *exec, GLuint attr, GLuint static void set_active_eval2( struct vbo_exec_context *exec, GLuint attr, GLuint dim, struct gl_2d_map *map ) { + assert(attr < Elements(exec->eval.map2)); if (!exec->eval.map2[attr].map) { exec->eval.map2[attr].map = map; exec->eval.map2[attr].sz = dim; @@ -73,18 +77,6 @@ void vbo_exec_eval_update( struct vbo_exec_context *exec ) clear_active_eval2( exec, attr ); } - /* _NEW_PROGRAM */ - if (ctx->VertexProgram._Enabled) { - for (attr = 0; attr < VBO_ATTRIB_FIRST_MATERIAL; attr++) { - /* _NEW_EVAL */ - if (ctx->Eval.Map1Attrib[attr]) - set_active_eval1( exec, attr, 4, &ctx->EvalMap.Map1Attrib[attr] ); - - if (ctx->Eval.Map2Attrib[attr]) - set_active_eval2( exec, attr, 4, &ctx->EvalMap.Map2Attrib[attr] ); - } - } - if (ctx->Eval.Map1Color4) set_active_eval1( exec, VBO_ATTRIB_COLOR0, 4, &ctx->EvalMap.Map1Color4 ); @@ -125,6 +117,23 @@ void vbo_exec_eval_update( struct vbo_exec_context *exec ) else if (ctx->Eval.Map2Vertex3) set_active_eval2( exec, VBO_ATTRIB_POS, 3, &ctx->EvalMap.Map2Vertex3 ); + /* _NEW_PROGRAM */ + if (ctx->VertexProgram._Enabled) { + /* These are the 16 evaluators which GL_NV_vertex_program defines. + * They alias and override the conventional vertex attributs. + */ + for (attr = 0; attr < 16; attr++) { + /* _NEW_EVAL */ + assert(attr < Elements(ctx->Eval.Map1Attrib)); + if (ctx->Eval.Map1Attrib[attr]) + set_active_eval1( exec, attr, 4, &ctx->EvalMap.Map1Attrib[attr] ); + + assert(attr < Elements(ctx->Eval.Map2Attrib)); + if (ctx->Eval.Map2Attrib[attr]) + set_active_eval2( exec, attr, 4, &ctx->EvalMap.Map2Attrib[attr] ); + } + } + exec->eval.recalculate_maps = 0; } -- cgit v1.2.3 From d88f3b946804f9a3e8cad4f8896e6be488fec2b5 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 8 Dec 2009 14:31:38 -0800 Subject: mesa: Fix array out-of-bounds access by _mesa_TexParameterfv. _mesa_TexParameterfv calls set_tex_parameteri, which uses the params argument as an array. --- src/mesa/main/texparam.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 4ce8c8593a..4c1f690ff1 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -592,8 +592,10 @@ _mesa_TexParameterfv(GLenum target, GLenum pname, const GLfloat *params) case GL_DEPTH_TEXTURE_MODE_ARB: { /* convert float param to int */ - GLint p = (GLint) params[0]; - need_update = set_tex_parameteri(ctx, texObj, pname, &p); + GLint p[4]; + p[0] = (GLint) params[0]; + p[1] = p[2] = p[3] = 0; + need_update = set_tex_parameteri(ctx, texObj, pname, p); } break; -- cgit v1.2.3 From a1d46fbea0b40d7edc668ea5993ea4318f37c9f9 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 8 Dec 2009 15:42:13 -0800 Subject: mesa: Fix array out-of-bounds access by _mesa_TexParameteri. _mesa_TexParameteri calls set_tex_parameterf, which uses the params argument as an array. --- src/mesa/main/texparam.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 4c1f690ff1..59c518c7d2 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -644,9 +644,11 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param) case GL_TEXTURE_LOD_BIAS: case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: { - GLfloat fparam = (GLfloat) param; + GLfloat fparam[4]; + fparam[0] = (GLfloat) param; + fparam[1] = fparam[2] = fparam[3] = 0.0F; /* convert int param to float */ - need_update = set_tex_parameterf(ctx, texObj, pname, &fparam); + need_update = set_tex_parameterf(ctx, texObj, pname, fparam); } break; default: -- cgit v1.2.3 From 7f146b38240e1c4efa6d8d0a4e5a0c8346706de5 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 8 Dec 2009 16:04:33 -0800 Subject: mesa: Fix array out-of-bounds access by _mesa_Fogi. _mesa_Fogi calls _mesa_Fogfv, which uses the params argument as an array. --- src/mesa/main/fog.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/fog.c b/src/mesa/main/fog.c index 4323d3db82..99eb141812 100644 --- a/src/mesa/main/fog.c +++ b/src/mesa/main/fog.c @@ -41,8 +41,10 @@ _mesa_Fogf(GLenum pname, GLfloat param) void GLAPIENTRY _mesa_Fogi(GLenum pname, GLint param ) { - GLfloat fparam = (GLfloat) param; - _mesa_Fogfv(pname, &fparam); + GLfloat fparam[4]; + fparam[0] = (GLfloat) param; + fparam[1] = fparam[2] = fparam[3] = 0.0F; + _mesa_Fogfv(pname, fparam); } -- cgit v1.2.3 From dd9eb8774ad7918187afebf8cd3be6f4b80f0f3b Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Tue, 8 Dec 2009 16:15:07 -0800 Subject: i965: Enable the accelerated ReadPixels path on gen4 along with pre-gen4. Passes piglit pbo-read-argb8888, and doesn't otherwise regress quick.tests. --- src/mesa/drivers/dri/intel/intel_pixel_read.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_pixel_read.c b/src/mesa/drivers/dri/intel/intel_pixel_read.c index 4707500180..20424e2e58 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_read.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_read.c @@ -285,11 +285,11 @@ intelReadPixels(GLcontext * ctx, intelFlush(ctx); -#ifdef I915 if (do_blit_readpixels (ctx, x, y, width, height, format, type, pack, pixels)) return; +#ifdef I915 if (do_texture_readpixels (ctx, x, y, width, height, format, type, pack, pixels)) return; -- cgit v1.2.3 From 3f7c2ac2798b385bed97b6931a1568a7e0223a0a Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 8 Dec 2009 17:25:05 -0800 Subject: mesa: Fix array out-of-bounds access by _mesa_TexParameteri. _mesa_TexParameteri calls set_tex_parameteri, which uses the params argument as an array. --- src/mesa/main/texparam.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 59c518c7d2..1cec4b82fe 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -653,7 +653,12 @@ _mesa_TexParameteri(GLenum target, GLenum pname, GLint param) break; default: /* this will generate an error if pname is illegal */ - need_update = set_tex_parameteri(ctx, texObj, pname, ¶m); + { + GLint iparam[4]; + iparam[0] = param; + iparam[1] = iparam[2] = iparam[3] = 0; + need_update = set_tex_parameteri(ctx, texObj, pname, iparam); + } } if (ctx->Driver.TexParameter && need_update) { -- cgit v1.2.3 From d33bf38d63d233f6a09115acfff230c464d3ee29 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 8 Dec 2009 17:51:07 -0800 Subject: mesa: Fix array out-of-bounds access by _mesa_Fogf. _mesa_Fogf calls _mesa_Fogfv, which uses the params argument as an array. --- src/mesa/main/fog.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/fog.c b/src/mesa/main/fog.c index 99eb141812..269ff3f8b9 100644 --- a/src/mesa/main/fog.c +++ b/src/mesa/main/fog.c @@ -34,7 +34,10 @@ void GLAPIENTRY _mesa_Fogf(GLenum pname, GLfloat param) { - _mesa_Fogfv(pname, ¶m); + GLfloat fparam[4]; + fparam[0] = param; + fparam[1] = fparam[2] = fparam[3] = 0.0F; + _mesa_Fogfv(pname, fparam); } -- cgit v1.2.3 From af16c822a5af8ce0aa7582e8ea44315b62b7356b Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Tue, 8 Dec 2009 18:26:05 -0800 Subject: mesa: Fix array out-of-bounds access by _mesa_LightModeli. _mesa_LightModeli calls _mesa_LightModeliv, which uses the params argument as an array. --- src/mesa/main/light.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index 10c89f4368..5a8f9160f6 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -537,7 +537,10 @@ _mesa_LightModeliv( GLenum pname, const GLint *params ) void GLAPIENTRY _mesa_LightModeli( GLenum pname, GLint param ) { - _mesa_LightModeliv( pname, ¶m ); + GLint iparam[4]; + iparam[0] = param; + iparam[1] = iparam[2] = iparam[3] = 0; + _mesa_LightModeliv( pname, iparam ); } -- cgit v1.2.3 From cd6b8dd9e82fedc55d033131fbc0f8ee950567c8 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 9 Dec 2009 10:08:07 -0800 Subject: mesa: Move OES_read_format support from drivers into the core. The assertion is that the correct read type to be using is the native type of the underlying read renderbuffer. For some fallback paths, this may be worse than GL_RGBA/GL_UNSIGNED_BYTE for reads today, but it gets all drivers the expected GL_BGRA/GL_UNSIGNED_BYTE for ARGB8888 or GL_BGR//GL_UNSIGNED_SHORT_5_6_5_REV for rgb565 with no work. This fixes the intel (and other) DRI drivers to report read formats that should hit blit PBO readpixels paths. --- src/mesa/main/context.c | 4 -- src/mesa/main/framebuffer.c | 26 ++++++++++ src/mesa/main/framebuffer.h | 5 ++ src/mesa/main/get.c | 17 ++++--- src/mesa/main/get_gen.py | 5 +- src/mesa/main/mtypes.h | 3 -- src/mesa/sources.mak | 1 - src/mesa/state_tracker/st_cb_get.c | 97 ------------------------------------- src/mesa/state_tracker/st_cb_get.h | 37 -------------- src/mesa/state_tracker/st_context.c | 2 - 10 files changed, 43 insertions(+), 154 deletions(-) delete mode 100644 src/mesa/state_tracker/st_cb_get.c delete mode 100644 src/mesa/state_tracker/st_cb_get.h (limited to 'src') diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index b5bf46718f..87eae96639 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -564,10 +564,6 @@ _mesa_init_constants(GLcontext *ctx) /* GL_ARB_draw_buffers */ ctx->Const.MaxDrawBuffers = MAX_DRAW_BUFFERS; - /* GL_OES_read_format */ - ctx->Const.ColorReadFormat = GL_RGBA; - ctx->Const.ColorReadType = GL_UNSIGNED_BYTE; - #if FEATURE_EXT_framebuffer_object ctx->Const.MaxColorAttachments = MAX_COLOR_ATTACHMENTS; ctx->Const.MaxRenderbufferSize = MAX_WIDTH; diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 154dedacd5..d958dbf7d4 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -969,3 +969,29 @@ _mesa_dest_buffer_exists(GLcontext *ctx, GLenum format) /* OK */ return GL_TRUE; } + +GLenum +_mesa_get_color_read_format(GLcontext *ctx) +{ + switch (ctx->ReadBuffer->_ColorReadBuffer->Format) { + case MESA_FORMAT_ARGB8888: + return GL_BGRA; + case MESA_FORMAT_RGB565: + return GL_BGR; + default: + return GL_RGBA; + } +} + +GLenum +_mesa_get_color_read_type(GLcontext *ctx) +{ + switch (ctx->ReadBuffer->_ColorReadBuffer->Format) { + case MESA_FORMAT_ARGB8888: + return GL_UNSIGNED_BYTE; + case MESA_FORMAT_RGB565: + return GL_UNSIGNED_SHORT_5_6_5_REV; + default: + return GL_UNSIGNED_BYTE; + } +} diff --git a/src/mesa/main/framebuffer.h b/src/mesa/main/framebuffer.h index 45a4703ba9..ef21dd98e8 100644 --- a/src/mesa/main/framebuffer.h +++ b/src/mesa/main/framebuffer.h @@ -81,5 +81,10 @@ _mesa_source_buffer_exists(GLcontext *ctx, GLenum format); extern GLboolean _mesa_dest_buffer_exists(GLcontext *ctx, GLenum format); +extern GLenum +_mesa_get_color_read_type(GLcontext *ctx); + +extern GLenum +_mesa_get_color_read_format(GLcontext *ctx); #endif /* FRAMEBUFFER_H */ diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c index 6c5ce02913..3f6b03c88a 100644 --- a/src/mesa/main/get.c +++ b/src/mesa/main/get.c @@ -13,6 +13,7 @@ #include "mtypes.h" #include "state.h" #include "texcompress.h" +#include "framebuffer.h" #define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE ) @@ -1767,11 +1768,11 @@ _mesa_GetBooleanv( GLenum pname, GLboolean *params ) break; case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: CHECK_EXT1(OES_read_format, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Const.ColorReadType); + params[0] = INT_TO_BOOLEAN(_mesa_get_color_read_type(ctx)); break; case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: CHECK_EXT1(OES_read_format, "GetBooleanv"); - params[0] = INT_TO_BOOLEAN(ctx->Const.ColorReadFormat); + params[0] = INT_TO_BOOLEAN(_mesa_get_color_read_format(ctx)); break; case GL_NUM_FRAGMENT_REGISTERS_ATI: CHECK_EXT1(ATI_fragment_shader, "GetBooleanv"); @@ -3602,11 +3603,11 @@ _mesa_GetFloatv( GLenum pname, GLfloat *params ) break; case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: CHECK_EXT1(OES_read_format, "GetFloatv"); - params[0] = (GLfloat)(ctx->Const.ColorReadType); + params[0] = (GLfloat)(_mesa_get_color_read_type(ctx)); break; case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: CHECK_EXT1(OES_read_format, "GetFloatv"); - params[0] = (GLfloat)(ctx->Const.ColorReadFormat); + params[0] = (GLfloat)(_mesa_get_color_read_format(ctx)); break; case GL_NUM_FRAGMENT_REGISTERS_ATI: CHECK_EXT1(ATI_fragment_shader, "GetFloatv"); @@ -5437,11 +5438,11 @@ _mesa_GetIntegerv( GLenum pname, GLint *params ) break; case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: CHECK_EXT1(OES_read_format, "GetIntegerv"); - params[0] = ctx->Const.ColorReadType; + params[0] = _mesa_get_color_read_type(ctx); break; case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: CHECK_EXT1(OES_read_format, "GetIntegerv"); - params[0] = ctx->Const.ColorReadFormat; + params[0] = _mesa_get_color_read_format(ctx); break; case GL_NUM_FRAGMENT_REGISTERS_ATI: CHECK_EXT1(ATI_fragment_shader, "GetIntegerv"); @@ -7273,11 +7274,11 @@ _mesa_GetInteger64v( GLenum pname, GLint64 *params ) break; case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: CHECK_EXT1(OES_read_format, "GetInteger64v"); - params[0] = (GLint64)(ctx->Const.ColorReadType); + params[0] = (GLint64)(_mesa_get_color_read_type(ctx)); break; case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: CHECK_EXT1(OES_read_format, "GetInteger64v"); - params[0] = (GLint64)(ctx->Const.ColorReadFormat); + params[0] = (GLint64)(_mesa_get_color_read_format(ctx)); break; case GL_NUM_FRAGMENT_REGISTERS_ATI: CHECK_EXT1(ATI_fragment_shader, "GetInteger64v"); diff --git a/src/mesa/main/get_gen.py b/src/mesa/main/get_gen.py index 930c3362fa..697c4cfd92 100644 --- a/src/mesa/main/get_gen.py +++ b/src/mesa/main/get_gen.py @@ -942,9 +942,9 @@ StateVars = [ # GL_OES_read_format ( "GL_IMPLEMENTATION_COLOR_READ_TYPE_OES", GLint, - ["ctx->Const.ColorReadType"], "", ["OES_read_format"] ), + ["_mesa_get_color_read_type(ctx)"], "", ["OES_read_format"] ), ( "GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES", GLint, - ["ctx->Const.ColorReadFormat"], "", ["OES_read_format"] ), + ["_mesa_get_color_read_format(ctx)"], "", ["OES_read_format"] ), # GL_ATI_fragment_shader ( "GL_NUM_FRAGMENT_REGISTERS_ATI", GLint, ["6"], "", ["ATI_fragment_shader"] ), @@ -1159,6 +1159,7 @@ def EmitHeader(): #include "mtypes.h" #include "state.h" #include "texcompress.h" +#include "framebuffer.h" #define FLOAT_TO_BOOLEAN(X) ( (X) ? GL_TRUE : GL_FALSE ) diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index 881d233ca3..cde2f5fe06 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2355,9 +2355,6 @@ struct gl_constants GLuint MaxDrawBuffers; /**< GL_ARB_draw_buffers */ - GLenum ColorReadFormat; /**< GL_OES_read_format */ - GLenum ColorReadType; /**< GL_OES_read_format */ - GLuint MaxColorAttachments; /**< GL_EXT_framebuffer_object */ GLuint MaxRenderbufferSize; /**< GL_EXT_framebuffer_object */ GLuint MaxSamples; /**< GL_ARB_framebuffer_object */ diff --git a/src/mesa/sources.mak b/src/mesa/sources.mak index 615a5588ea..a0d7dbbace 100644 --- a/src/mesa/sources.mak +++ b/src/mesa/sources.mak @@ -191,7 +191,6 @@ STATETRACKER_SOURCES = \ state_tracker/st_cb_bufferobjects.c \ state_tracker/st_cb_clear.c \ state_tracker/st_cb_flush.c \ - state_tracker/st_cb_get.c \ state_tracker/st_cb_drawpixels.c \ state_tracker/st_cb_fbo.c \ state_tracker/st_cb_feedback.c \ diff --git a/src/mesa/state_tracker/st_cb_get.c b/src/mesa/state_tracker/st_cb_get.c deleted file mode 100644 index e7d7f03bc9..0000000000 --- a/src/mesa/state_tracker/st_cb_get.c +++ /dev/null @@ -1,97 +0,0 @@ -/************************************************************************** - * - * 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. - * - **************************************************************************/ - - -/** - * glGet functions - * - * \author Brian Paul - */ - -#include "main/imports.h" -#include "main/context.h" - -#include "pipe/p_defines.h" - -#include "st_cb_fbo.h" -#include "st_cb_get.h" - - - -/** - * Examine the current color read buffer format to determine - * which GL pixel format/type combo is the best match. - */ -static void -get_preferred_read_format_type(GLcontext *ctx, GLint *format, GLint *type) -{ - struct gl_framebuffer *fb = ctx->ReadBuffer; - struct st_renderbuffer *strb = st_renderbuffer(fb->_ColorReadBuffer); - - /* defaults */ - *format = ctx->Const.ColorReadFormat; - *type = ctx->Const.ColorReadType; - - if (strb) { - /* XXX could add more cases here... */ - if (strb->format == PIPE_FORMAT_A8R8G8B8_UNORM) { - *format = GL_BGRA; - if (_mesa_little_endian()) - *type = GL_UNSIGNED_INT_8_8_8_8_REV; - else - *type = GL_UNSIGNED_INT_8_8_8_8; - } - } -} - - -/** - * We only intercept the OES preferred ReadPixels format/type. - * Everything else goes to the default _mesa_GetIntegerv. - */ -static GLboolean -st_GetIntegerv(GLcontext *ctx, GLenum pname, GLint *params) -{ - GLint dummy; - - switch (pname) { - case GL_IMPLEMENTATION_COLOR_READ_TYPE_OES: - get_preferred_read_format_type(ctx, &dummy, params); - return GL_TRUE; - case GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES: - get_preferred_read_format_type(ctx, params, &dummy); - return GL_TRUE; - default: - return GL_FALSE; - } -} - - -void st_init_get_functions(struct dd_function_table *functions) -{ - functions->GetIntegerv = st_GetIntegerv; -} diff --git a/src/mesa/state_tracker/st_cb_get.h b/src/mesa/state_tracker/st_cb_get.h deleted file mode 100644 index 8e9f3e9306..0000000000 --- a/src/mesa/state_tracker/st_cb_get.h +++ /dev/null @@ -1,37 +0,0 @@ -/************************************************************************** - * - * 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. - * - **************************************************************************/ - - -#ifndef ST_CB_GET_H -#define ST_CB_GET_H - - -extern void -st_init_get_functions(struct dd_function_table *functions); - - -#endif diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index f0eddafd33..d18a25ab51 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -51,7 +51,6 @@ #include "st_cb_drawtex.h" #endif #include "st_cb_fbo.h" -#include "st_cb_get.h" #if FEATURE_feedback #include "st_cb_feedback.h" #endif @@ -331,7 +330,6 @@ void st_init_driver_functions(struct dd_function_table *functions) st_init_rasterpos_functions(functions); #endif st_init_fbo_functions(functions); - st_init_get_functions(functions); #if FEATURE_feedback st_init_feedback_functions(functions); #endif -- cgit v1.2.3 From e3fa700c178e11e6735430119232919176ab7b42 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 9 Dec 2009 11:03:49 -0800 Subject: meta: Bind texture to unit 0 for mipmap generation If the active texture unit on entry to mipmap generation is not zero, bind the texture to unit zero. Fixes bug #24219. --- src/mesa/drivers/common/meta.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index a431519143..39b0ab13c6 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2149,6 +2149,7 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, const GLenum wrapTSave = texObj->WrapT; const GLenum wrapRSave = texObj->WrapR; const GLuint fboSave = ctx->DrawBuffer->Name; + const GLuint original_active_unit = ctx->Texture.CurrentUnit; GLenum faceTarget; GLuint dstLevel; GLuint border = 0; @@ -2288,6 +2289,9 @@ _mesa_meta_GenerateMipmap(GLcontext *ctx, GLenum target, /* texture is already locked, unlock now */ _mesa_unlock_texture(ctx, texObj); + if (original_active_unit != 0) + _mesa_BindTexture(target, texObj->Name); + for (dstLevel = baseLevel + 1; dstLevel <= maxLevel; dstLevel++) { const struct gl_texture_image *srcImage; const GLuint srcLevel = dstLevel - 1; -- cgit v1.2.3 From b7cf8a1f93ef3a81f2e8c44adca9a3990da4466d Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 8 Dec 2009 21:03:29 +0100 Subject: vmware/core: Update vmwgfx_drm.h --- src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h b/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h index 56070a1ba1..89bbf17ce9 100644 --- a/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h +++ b/src/gallium/winsys/drm/vmware/core/vmwgfx_drm.h @@ -52,14 +52,16 @@ /** * DRM_VMW_GET_PARAM - get device information. * - * Currently we support only one parameter: - * * DRM_VMW_PARAM_FIFO_OFFSET: * Offset to use to map the first page of the FIFO read-only. * The fifo is mapped using the mmap() system call on the drm device. + * + * DRM_VMW_PARAM_OVERLAY_IOCTL: + * Does the driver support the overlay ioctl. */ #define DRM_VMW_PARAM_FIFO_OFFSET 0 +#define DRM_VMW_PARAM_OVERLAY_IOCTL 1 /** * struct drm_vmw_getparam_arg -- cgit v1.2.3 From 5e2a86cb1be935f1c54efcf5b4e6a1b7371ff5e7 Mon Sep 17 00:00:00 2001 From: Jakob Bornecrantz Date: Tue, 8 Dec 2009 21:05:30 +0100 Subject: vmware/xorg: Properly detect overlay support --- src/gallium/winsys/drm/vmware/xorg/vmw_driver.h | 2 ++ src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c | 31 +++++++++++++++++++++++++ src/gallium/winsys/drm/vmware/xorg/vmw_video.c | 5 ++++ 3 files changed, 38 insertions(+) (limited to 'src') diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h b/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h index 85c21ca60e..7265f767a5 100644 --- a/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_driver.h @@ -73,6 +73,8 @@ void vmw_video_stop_all(ScrnInfoPtr pScrn, struct vmw_driver *vmw); * vmw_ioctl.c */ +int vmw_ioctl_supports_overlay(struct vmw_driver *vmw); + int vmw_ioctl_cursor_bypass(struct vmw_driver *vmw, int xhot, int yhot); struct vmw_dma_buffer * vmw_ioctl_buffer_create(struct vmw_driver *vmw, diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c b/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c index c84368bab7..0d1a0fcee6 100644 --- a/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_ioctl.c @@ -56,6 +56,37 @@ struct vmw_dma_buffer uint32_t size; }; +static int +vmw_ioctl_get_param(struct vmw_driver *vmw, uint32_t param, uint64_t *out) +{ + struct drm_vmw_getparam_arg gp_arg; + int ret; + + memset(&gp_arg, 0, sizeof(gp_arg)); + gp_arg.param = param; + ret = drmCommandWriteRead(vmw->fd, DRM_VMW_GET_PARAM, + &gp_arg, sizeof(gp_arg)); + + if (ret == 0) { + *out = gp_arg.value; + } + + return ret; +} + +int +vmw_ioctl_supports_overlay(struct vmw_driver *vmw) +{ + uint64_t value; + int ret; + + ret = vmw_ioctl_get_param(vmw, DRM_VMW_PARAM_OVERLAY_IOCTL, &value); + if (ret) + return ret; + + return value ? 0 : -ENOSYS; +} + int vmw_ioctl_cursor_bypass(struct vmw_driver *vmw, int xhot, int yhot) { diff --git a/src/gallium/winsys/drm/vmware/xorg/vmw_video.c b/src/gallium/winsys/drm/vmware/xorg/vmw_video.c index b99bb2f7e3..5674e4f352 100644 --- a/src/gallium/winsys/drm/vmware/xorg/vmw_video.c +++ b/src/gallium/winsys/drm/vmware/xorg/vmw_video.c @@ -276,6 +276,11 @@ vmw_video_init(ScrnInfoPtr pScrn, struct vmw_driver *vmw) debug_printf("%s: enter\n", __func__); + if (vmw_ioctl_supports_overlay(vmw) != 0) { + debug_printf("No overlay ioctl support\n"); + return FALSE; + } + numAdaptors = xf86XVListGenericAdaptors(pScrn, &overlayAdaptors); newAdaptor = vmw_video_init_adaptor(pScrn, vmw); -- cgit v1.2.3 From 33a120e4761a661736ea64a3efc2e3831ac5600a Mon Sep 17 00:00:00 2001 From: Andre Maasikas Date: Wed, 9 Dec 2009 10:51:52 +0200 Subject: r600: fix state size prediction after dc0777d3 --- src/mesa/drivers/dri/r600/r700_chip.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_chip.c b/src/mesa/drivers/dri/r600/r700_chip.c index d8661b4439..dacc2ccc4c 100644 --- a/src/mesa/drivers/dri/r600/r700_chip.c +++ b/src/mesa/drivers/dri/r600/r700_chip.c @@ -1134,7 +1134,11 @@ static int check_blnd(GLcontext *ctx, struct radeon_state_atom *atom) count += 3; if (context->radeon.radeonScreen->chip_family > CHIP_FAMILY_R600) { - for (ui = 0; ui < R700_MAX_RENDER_TARGETS; ui++) { + /* targets are enabled in r700SetRenderTarget but state + size is calculated before that. Until MRT's are done + hardcode target0 as enabled. */ + count += 3; + for (ui = 1; ui < R700_MAX_RENDER_TARGETS; ui++) { if (r700->render_target[ui].enabled) count += 3; } -- cgit v1.2.3 From 59f6af51b858340139fe2139e2698fef8a5ad62f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Wed, 9 Dec 2009 10:59:38 +0000 Subject: util: Document the meaning of util_format_layout. The util_format_layout name was unfortunate and there are as been a lot of confusion due to this. Hopefully this will shed some light on what it was meant for. Bottom line is: do not rely on these values unless you're automatically code generating pixel packing/unpacking routines. Suggestions for better names than util_format_layout are welcome! --- src/gallium/auxiliary/util/u_format.h | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'src') diff --git a/src/gallium/auxiliary/util/u_format.h b/src/gallium/auxiliary/util/u_format.h index 6740683a61..19b902db98 100644 --- a/src/gallium/auxiliary/util/u_format.h +++ b/src/gallium/auxiliary/util/u_format.h @@ -33,10 +33,46 @@ #include "pipe/p_format.h" +/** + * Describe how to best pack/unpack pixels into/from the prescribed format. + * + * These are used for automatic code generation of pixel packing and unpacking + * routines (in compile time, e.g., u_format_access.py, or in runtime, like + * llvmpipe does). + * + * Thumb rule is: if you're not code generating pixel packing/unpacking then + * these are irrelevant for you. + * + * Note that this can be deduced from other values in util_format_description + * structure. This is by design, to make code generation of pixel + * packing/unpacking/sampling routines simple and efficient. + * + * XXX: This should be renamed to something like util_format_pack. + */ enum util_format_layout { + /** + * Single scalar component. + */ UTIL_FORMAT_LAYOUT_SCALAR = 0, + + /** + * One or more components of mixed integer formats, arithmetically encoded + * in a word up to 32bits. + */ UTIL_FORMAT_LAYOUT_ARITH = 1, + + /** + * One or more components, no mixed formats, each with equal power of two + * number of bytes. + */ UTIL_FORMAT_LAYOUT_ARRAY = 2, + + /** + * XXX: Not used yet. These might go away and be replaced by a single entry, + * for formats where multiple pixels have to be + * read in order to determine a single pixel value (i.e., block.width > 1 + * || block.height > 1) + */ UTIL_FORMAT_LAYOUT_YUV = 3, UTIL_FORMAT_LAYOUT_DXT = 4 }; -- cgit v1.2.3 From 3de8fff45d04fd7e702cd656ba97cafd348c3981 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Wed, 9 Dec 2009 08:30:01 -0700 Subject: mesa: fix baseLevel >= MAX_TEXTURE_LEVELS test This fixes invalid array indexing when baseLevel == MAX_TEXTURE_LEVELS. See bug 25528. --- src/mesa/main/texobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index da55ac8697..85f5f78e50 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -418,7 +418,7 @@ _mesa_test_texobj_completeness( const GLcontext *ctx, /* Detect cases where the application set the base level to an invalid * value. */ - if ((baseLevel < 0) || (baseLevel > MAX_TEXTURE_LEVELS)) { + if ((baseLevel < 0) || (baseLevel >= MAX_TEXTURE_LEVELS)) { char s[100]; _mesa_sprintf(s, "base level = %d is invalid", baseLevel); incomplete(t, s); -- cgit v1.2.3 From a082d965de228d5035e59245df528af62761652a Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 9 Dec 2009 11:26:24 -0800 Subject: glsl: Remove unused member x from struct slang_operation. --- src/mesa/shader/slang/slang_compile_operation.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_compile_operation.h b/src/mesa/shader/slang/slang_compile_operation.h index 58f1edeed8..1f15c19896 100644 --- a/src/mesa/shader/slang/slang_compile_operation.h +++ b/src/mesa/shader/slang/slang_compile_operation.h @@ -127,7 +127,6 @@ typedef struct slang_operation_ * indicate such. num_children indicates number of elements. */ GLboolean array_constructor; - double x; } slang_operation; -- cgit v1.2.3 From 8927b72118f9433aafd0e811cfc1981215eb3c5f Mon Sep 17 00:00:00 2001 From: Richard Li Date: Wed, 9 Dec 2009 15:39:16 -0500 Subject: r600 : add pre-compile mesa shader calling interface, in order to handle complex built-in shader instructions. --- src/mesa/drivers/dri/r600/r700_assembler.c | 407 +++++++++++++++++++++++++++-- src/mesa/drivers/dri/r600/r700_assembler.h | 65 ++++- src/mesa/drivers/dri/r600/r700_fragprog.c | 25 +- src/mesa/drivers/dri/r600/r700_vertprog.c | 25 +- 4 files changed, 498 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r600/r700_assembler.c b/src/mesa/drivers/dri/r600/r700_assembler.c index aed84fc3bd..e84f524525 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.c +++ b/src/mesa/drivers/dri/r600/r700_assembler.c @@ -32,6 +32,7 @@ #include "main/mtypes.h" #include "main/imports.h" +#include "shader/prog_parameter.h" #include "radeon_debug.h" #include "r600_context.h" @@ -41,6 +42,39 @@ #define USE_CF_FOR_CONTINUE_BREAK 1 #define USE_CF_FOR_POP_AFTER 1 +struct prog_instruction noise1_insts[12] = { + {OPCODE_BGNSUB , {{13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {13, 0, 15, 0, 8, 1672, 0}, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0}, + {OPCODE_MOV , {{0, 0, 0, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {0, 0, 2, 0, 8, 1672, 0}, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0}, + {OPCODE_MOV , {{8, 0, 0, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {0, 0, 4, 0, 8, 1672, 0}, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0}, + {OPCODE_MOV , {{8, 0, 585, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {0, 0, 8, 0, 8, 1672, 0}, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0}, + {OPCODE_SGT , {{0, 0, 585, 0, 0, 0}, {8, 0, 1170, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {0, 1, 1, 0, 8, 1672, 0}, 1, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0}, + {OPCODE_IF , {{13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {13, 0, 15, 0, 7, 0, 0}, 0, 0, 0, 1, 0, 0, 0, 15, 0, 0, 0}, + {OPCODE_MOV , {{0, 0, 1755, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {0, 0, 1, 0, 8, 1672, 0}, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0}, + {OPCODE_RET , {{13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {13, 0, 15, 0, 8, 1672, 0}, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0}, + {OPCODE_ENDIF , {{13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {13, 0, 15, 0, 8, 1672, 0}, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0}, + {OPCODE_MOV , {{0, 0, 1170, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {0, 0, 1, 0, 8, 1672, 0}, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0}, + {OPCODE_RET , {{13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {13, 0, 15, 0, 8, 1672, 0}, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0}, + {OPCODE_ENDSUB , {{13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}, {13, 0, 1672, 0, 0, 0}}, {13, 0, 15, 0, 8, 1672, 0}, 0, 0, 0, 1, 0, 0, 0, -1, 0, 0, 0} +}; +float noise1_const[2][4] = { + {0.300000f, 0.900000f, 0.500000f, 0.300000f} +}; + +COMPILED_SUB noise1_presub = { + &(noise1_insts[0]), + 12, + 2, + 1, + 0, + &(noise1_const[0]), + SWIZZLE_X, + SWIZZLE_X, + SWIZZLE_X, + SWIZZLE_X, + {0,0,0}, + 0 +}; + BITS addrmode_PVSDST(PVSDST * pPVSDST) { return pPVSDST->addrmode0 | ((BITS)pPVSDST->addrmode1 << 1); @@ -330,14 +364,14 @@ GLuint GetSurfaceFormat(GLenum eType, GLuint nChannels, GLuint * pClient_size) return(format); } -unsigned int r700GetNumOperands(r700_AssemblerBase* pAsm) +unsigned int r700GetNumOperands(GLuint opcode, GLuint nIsOp3) { - if(pAsm->D.dst.op3) + if(nIsOp3 > 0) { return 3; } - switch (pAsm->D.dst.opcode) + switch (opcode) { case SQ_OP2_INST_ADD: case SQ_OP2_INST_KILLE: @@ -378,7 +412,7 @@ unsigned int r700GetNumOperands(r700_AssemblerBase* pAsm) return 1; default: radeon_error( - "Need instruction operand number for %x.\n", pAsm->D.dst.opcode); + "Need instruction operand number for %x.\n", opcode); }; return 3; @@ -500,6 +534,11 @@ int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700 pAsm->unCFflags = 0; + pAsm->presubs = NULL; + pAsm->unPresubArraySize = 0; + pAsm->unNumPresub = 0; + pAsm->unCurNumILInsts = 0; + return 0; } @@ -2010,7 +2049,7 @@ GLboolean check_scalar(r700_AssemblerBase* pAsm, GLuint swizzle_key; - GLuint number_of_operands = r700GetNumOperands(pAsm); + GLuint number_of_operands = r700GetNumOperands(pAsm->D.dst.opcode, pAsm->D.dst.op3); for (src=0; srcD.dst.opcode, pAsm->D.dst.op3); for (src=0; srcD.dst.opcode, pAsm->D.dst.op3); //GLuint channel_swizzle, j; //GLuint chan_counter[4] = {0, 0, 0, 0}; //PVSSRC * pSource[3]; @@ -4968,7 +5007,7 @@ void add_return_inst(r700_AssemblerBase *pAsm) pAsm->cf_current_cf_clause_ptr->m_Word1.f.barrier = 0x1; } -GLboolean assemble_BGNSUB(r700_AssemblerBase *pAsm, GLint nILindex) +GLboolean assemble_BGNSUB(r700_AssemblerBase *pAsm, GLint nILindex, GLuint uiIL_Shift) { /* Put in sub */ if( (pAsm->unSubArrayPointer + 1) > pAsm->unSubArraySize ) @@ -4983,7 +5022,7 @@ GLboolean assemble_BGNSUB(r700_AssemblerBase *pAsm, GLint nILindex) pAsm->unSubArraySize += 10; } - pAsm->subs[pAsm->unSubArrayPointer].subIL_Offset = nILindex; + pAsm->subs[pAsm->unSubArrayPointer].subIL_Offset = nILindex + uiIL_Shift; pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.pHead=NULL; pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.pTail=NULL; pAsm->subs[pAsm->unSubArrayPointer].lstCFInstructions_local.uNumOfNode=0; @@ -5074,9 +5113,13 @@ GLboolean assemble_RET(r700_AssemblerBase *pAsm) GLboolean assemble_CAL(r700_AssemblerBase *pAsm, GLint nILindex, + GLuint uiIL_Shift, GLuint uiNumberInsts, - struct prog_instruction *pILInst) + struct prog_instruction *pILInst, + PRESUB_DESC * pPresubDesc) { + GLint uiIL_Offset; + pAsm->alu_x_opcode = SQ_CF_INST_ALU; if(GL_FALSE == add_cf_instruction(pAsm) ) @@ -5109,8 +5152,12 @@ GLboolean assemble_CAL(r700_AssemblerBase *pAsm, pAsm->unCallerArraySize += 10; } - pAsm->callers[pAsm->unCallerArrayPointer].subIL_Offset = nILindex; - pAsm->callers[pAsm->unCallerArrayPointer].cf_ptr = pAsm->cf_current_cf_clause_ptr; + uiIL_Offset = nILindex + uiIL_Shift; + pAsm->callers[pAsm->unCallerArrayPointer].subIL_Offset = uiIL_Offset; + pAsm->callers[pAsm->unCallerArrayPointer].cf_ptr = pAsm->cf_current_cf_clause_ptr; + + pAsm->callers[pAsm->unCallerArrayPointer].finale_cf_ptr = NULL; + pAsm->callers[pAsm->unCallerArrayPointer].prelude_cf_ptr = NULL; pAsm->unCallerArrayPointer++; @@ -5120,7 +5167,7 @@ GLboolean assemble_CAL(r700_AssemblerBase *pAsm, GLboolean bRet; for(j=0; junSubArrayPointer; j++) { - if(nILindex == pAsm->subs[j].subIL_Offset) + if(uiIL_Offset == pAsm->subs[j].subIL_Offset) { /* compiled before */ max = pAsm->subs[j].unStackDepthMax @@ -5138,7 +5185,7 @@ GLboolean assemble_CAL(r700_AssemblerBase *pAsm, pAsm->callers[pAsm->unCallerArrayPointer - 1].subDescIndex = pAsm->unSubArrayPointer; unSubID = pAsm->unSubArrayPointer; - bRet = AssembleInstr(nILindex, uiNumberInsts, pILInst, pAsm); + bRet = AssembleInstr(nILindex, uiIL_Shift, uiNumberInsts, pILInst, pAsm); if(GL_TRUE == bRet) { @@ -5148,6 +5195,8 @@ GLboolean assemble_CAL(r700_AssemblerBase *pAsm, { pAsm->CALLSTACK[pAsm->CALLSP].max = max; } + + pAsm->subs[unSubID].pPresubDesc = pPresubDesc; } return bRet; @@ -5313,6 +5362,7 @@ GLboolean breakLoopOnFlag(r700_AssemblerBase *pAsm, GLuint unFCSP) } GLboolean AssembleInstr(GLuint uiFirstInst, + GLuint uiIL_Shift, GLuint uiNumberInsts, struct prog_instruction *pILInst, r700_AssemblerBase *pR700AsmCode) @@ -5468,6 +5518,26 @@ GLboolean AssembleInstr(GLuint uiFirstInst, case OPCODE_MUL: if ( GL_FALSE == assemble_MUL(pR700AsmCode) ) return GL_FALSE; + break; + + case OPCODE_NOISE1: + { + callPreSub(pR700AsmCode, + GLSL_NOISE1, + &noise1_presub, + pILInst->DstReg.Index + pR700AsmCode->starting_temp_register_number, + 1); + radeon_error("noise1: not yet supported shader instruction\n"); + }; + break; + case OPCODE_NOISE2: + radeon_error("noise2: not yet supported shader instruction\n"); + break; + case OPCODE_NOISE3: + radeon_error("noise3: not yet supported shader instruction\n"); + break; + case OPCODE_NOISE4: + radeon_error("noise4: not yet supported shader instruction\n"); break; case OPCODE_POW: @@ -5653,7 +5723,7 @@ GLboolean AssembleInstr(GLuint uiFirstInst, break; case OPCODE_BGNSUB: - if( GL_FALSE == assemble_BGNSUB(pR700AsmCode, i) ) + if( GL_FALSE == assemble_BGNSUB(pR700AsmCode, i, uiIL_Shift) ) { return GL_FALSE; } @@ -5668,9 +5738,11 @@ GLboolean AssembleInstr(GLuint uiFirstInst, case OPCODE_CAL: if( GL_FALSE == assemble_CAL(pR700AsmCode, - pILInst[i].BranchTarget, + pILInst[i].BranchTarget, + uiIL_Shift, uiNumberInsts, - pILInst) ) + pILInst, + NULL) ) { return GL_FALSE; } @@ -5707,7 +5779,7 @@ GLboolean InitShaderProgram(r700_AssemblerBase * pAsm) return GL_TRUE; } -GLboolean RelocProgram(r700_AssemblerBase * pAsm) +GLboolean RelocProgram(r700_AssemblerBase * pAsm, struct gl_program * pILProg) { GLuint i; GLuint unCFoffset; @@ -5717,6 +5789,12 @@ GLboolean RelocProgram(r700_AssemblerBase * pAsm) R700ShaderInstruction * pInst; R700ControlFlowGenericClause * pCFInst; + R700ControlFlowALUClause * pCF_ALU; + R700ALUInstruction * pALU; + GLuint unConstOffset = 0; + GLuint unRegOffset; + GLuint unMinRegIndex; + plstCFmain = pAsm->CALLSTACK[0].plstCFInstructions_local; /* remove flags init if they are not used */ @@ -5762,6 +5840,11 @@ GLboolean RelocProgram(r700_AssemblerBase * pAsm) unCFoffset = plstCFmain->uNumOfNode; + if(NULL != pILProg->Parameters) + { + unConstOffset = pILProg->Parameters->NumParameters; + } + /* Reloc subs */ for(i=0; iunSubArrayPointer; i++) { @@ -5799,6 +5882,84 @@ GLboolean RelocProgram(r700_AssemblerBase * pAsm) pInst = pInst->pNextInst; }; + if(NULL != pAsm->subs[i].pPresubDesc) + { + GLuint uNumSrc; + + unMinRegIndex = pAsm->subs[i].pPresubDesc->pCompiledSub->MinRegIndex; + unRegOffset = pAsm->subs[i].pPresubDesc->maxStartReg; + unConstOffset += pAsm->subs[i].pPresubDesc->unConstantsStart; + + pInst = plstCFsub->pHead; + while(pInst) + { + if(SIT_CF_ALU == pInst->m_ShaderInstType) + { + pCF_ALU = (R700ControlFlowALUClause *)pInst; + + pALU = pCF_ALU->m_pLinkedALUInstruction; + for(int j=0; j<=pCF_ALU->m_Word1.f.count; j++) + { + pALU->m_Word1.f.dst_gpr = pALU->m_Word1.f.dst_gpr + unRegOffset - unMinRegIndex; + + if(pALU->m_Word0.f.src0_sel < SQ_ALU_SRC_GPR_SIZE) + { + pALU->m_Word0.f.src0_sel = pALU->m_Word0.f.src0_sel + unRegOffset - unMinRegIndex; + } + else if(pALU->m_Word0.f.src0_sel >= SQ_ALU_SRC_CFILE_BASE) + { + pALU->m_Word0.f.src0_sel += unConstOffset; + } + + if( ((pALU->m_Word1.val >> SQ_ALU_WORD1_OP3_ALU_INST_SHIFT) & 0x0000001F) + >= SQ_OP3_INST_MUL_LIT ) + { /* op3 : 3 srcs */ + if(pALU->m_Word1_OP3.f.src2_sel < SQ_ALU_SRC_GPR_SIZE) + { + pALU->m_Word1_OP3.f.src2_sel = pALU->m_Word1_OP3.f.src2_sel + unRegOffset - unMinRegIndex; + } + else if(pALU->m_Word1_OP3.f.src2_sel >= SQ_ALU_SRC_CFILE_BASE) + { + pALU->m_Word1_OP3.f.src2_sel += unConstOffset; + } + if(pALU->m_Word0.f.src1_sel < SQ_ALU_SRC_GPR_SIZE) + { + pALU->m_Word0.f.src1_sel = pALU->m_Word0.f.src1_sel + unRegOffset - unMinRegIndex; + } + else if(pALU->m_Word0.f.src1_sel >= SQ_ALU_SRC_CFILE_BASE) + { + pALU->m_Word0.f.src1_sel += unConstOffset; + } + } + else + { + if(pAsm->bR6xx) + { + uNumSrc = r700GetNumOperands(pALU->m_Word1_OP2.f6.alu_inst, 0); + } + else + { + uNumSrc = r700GetNumOperands(pALU->m_Word1_OP2.f.alu_inst, 0); + } + if(2 == uNumSrc) + { /* 2 srcs */ + if(pALU->m_Word0.f.src1_sel < SQ_ALU_SRC_GPR_SIZE) + { + pALU->m_Word0.f.src1_sel = pALU->m_Word0.f.src1_sel + unRegOffset - unMinRegIndex; + } + else if(pALU->m_Word0.f.src1_sel >= SQ_ALU_SRC_CFILE_BASE) + { + pALU->m_Word0.f.src1_sel += unConstOffset; + } + } + } + pALU = (R700ALUInstruction*)(pALU->pNextInst); + } + } + pInst = pInst->pNextInst; + }; + } + /* Put sub into main */ plstCFmain->pTail->pNextInst = plstCFsub->pHead; plstCFmain->pTail = plstCFsub->pTail; @@ -5812,11 +5973,216 @@ GLboolean RelocProgram(r700_AssemblerBase * pAsm) { pAsm->callers[i].cf_ptr->m_Word0.f.addr = pAsm->subs[pAsm->callers[i].subDescIndex].unCFoffset; + + if(NULL != pAsm->subs[pAsm->callers[i].subDescIndex].pPresubDesc) + { + unMinRegIndex = pAsm->subs[pAsm->callers[i].subDescIndex].pPresubDesc->pCompiledSub->MinRegIndex; + unRegOffset = pAsm->subs[pAsm->callers[i].subDescIndex].pPresubDesc->maxStartReg; + + if(NULL != pAsm->callers[i].prelude_cf_ptr) + { + pCF_ALU = (R700ControlFlowALUClause * )(pAsm->callers[i].prelude_cf_ptr); + pALU = pCF_ALU->m_pLinkedALUInstruction; + for(int j=0; j<=pCF_ALU->m_Word1.f.count; j++) + { + pALU->m_Word1.f.dst_gpr = pALU->m_Word1.f.dst_gpr + unRegOffset - unMinRegIndex; + pALU = (R700ALUInstruction*)(pALU->pNextInst); + } + } + if(NULL != pAsm->callers[i].finale_cf_ptr) + { + pCF_ALU = (R700ControlFlowALUClause * )(pAsm->callers[i].finale_cf_ptr); + pALU = pCF_ALU->m_pLinkedALUInstruction; + for(int j=0; j<=pCF_ALU->m_Word1.f.count; j++) + { + pALU->m_Word0.f.src0_sel = pALU->m_Word0.f.src0_sel + unRegOffset - unMinRegIndex; + pALU = (R700ALUInstruction*)(pALU->pNextInst); + } + } + } } return GL_TRUE; } +GLboolean callPreSub(r700_AssemblerBase* pAsm, + LOADABLE_SCRIPT_SIGNITURE scriptSigniture, + COMPILED_SUB * pCompiledSub, + GLshort uOutReg, + GLshort uNumValidSrc) +{ + /* save assemble context */ + GLuint starting_temp_register_number_save; + GLuint number_used_registers_save; + GLuint uFirstHelpReg_save; + GLuint uHelpReg_save; + GLuint uiCurInst_save; + struct prog_instruction *pILInst_save; + PRESUB_DESC * pPresubDesc; + GLboolean bRet; + int i; + + R700ControlFlowGenericClause* prelude_cf_ptr = NULL; + + /* copy srcs to presub inputs */ + pAsm->alu_x_opcode = SQ_CF_INST_ALU; + for(i=0; iD.dst.opcode = SQ_OP2_INST_MOV; + setaddrmode_PVSDST(&(pAsm->D.dst), ADDR_ABSOLUTE); + pAsm->D.dst.rtype = DST_REG_TEMPORARY; + pAsm->D.dst.reg = pCompiledSub->srcRegIndex[i]; + pAsm->D.dst.writex = 1; + pAsm->D.dst.writey = 1; + pAsm->D.dst.writez = 1; + pAsm->D.dst.writew = 1; + + if( GL_FALSE == assemble_src(pAsm, i, 0) ) + { + return GL_FALSE; + } + + next_ins(pAsm); + } + if(uNumValidSrc > 0) + { + prelude_cf_ptr = pAsm->cf_current_alu_clause_ptr; + pAsm->alu_x_opcode = SQ_CF_INST_ALU; + } + + /* browse thro existing presubs. */ + for(i=0; iunNumPresub; i++) + { + if(pAsm->presubs[i].sptSigniture == scriptSigniture) + { + break; + } + } + + if(i == pAsm->unNumPresub) + { /* not loaded yet */ + /* save assemble context */ + number_used_registers_save = pAsm->number_used_registers; + uFirstHelpReg_save = pAsm->uFirstHelpReg; + uHelpReg_save = pAsm->uHelpReg; + starting_temp_register_number_save = pAsm->starting_temp_register_number; + pILInst_save = pAsm->pILInst; + uiCurInst_save = pAsm->uiCurInst; + + /* alloc in presub */ + if( (pAsm->unNumPresub + 1) > pAsm->unPresubArraySize ) + { + pAsm->presubs = (PRESUB_DESC*)_mesa_realloc( (void *)pAsm->presubs, + sizeof(PRESUB_DESC) * pAsm->unPresubArraySize, + sizeof(PRESUB_DESC) * (pAsm->unPresubArraySize + 4) ); + if(NULL == pAsm->presubs) + { + radeon_error("No memeory to allocate built in shader function description structures. \n"); + return GL_FALSE; + } + pAsm->unPresubArraySize += 4; + } + + pPresubDesc = &(pAsm->presubs[i]); + pPresubDesc->sptSigniture = scriptSigniture; + + /* constants offsets need to be final resolved at reloc. */ + if(0 == pAsm->unNumPresub) + { + pPresubDesc->unConstantsStart = 0; + } + else + { + pPresubDesc->unConstantsStart = pAsm->presubs[i-1].unConstantsStart + + pAsm->presubs[i-1].pCompiledSub->NumParameters; + } + + pPresubDesc->pCompiledSub = pCompiledSub; + + pPresubDesc->subIL_Shift = pAsm->unCurNumILInsts; + pPresubDesc->maxStartReg = uFirstHelpReg_save; + pAsm->unCurNumILInsts += pCompiledSub->NumInstructions; + + pAsm->unNumPresub++; + + /* setup new assemble context */ + pAsm->starting_temp_register_number = 0; + pAsm->number_used_registers = pCompiledSub->NumTemporaries; + pAsm->uFirstHelpReg = pAsm->number_used_registers; + pAsm->uHelpReg = pAsm->uFirstHelpReg; + + bRet = assemble_CAL(pAsm, + 0, + pPresubDesc->subIL_Shift, + pCompiledSub->NumInstructions, + pCompiledSub->Instructions, + pPresubDesc); + + + pPresubDesc->number_used_registers = pAsm->number_used_registers; + + /* restore assemble context */ + pAsm->number_used_registers = number_used_registers_save; + pAsm->uFirstHelpReg = uFirstHelpReg_save; + pAsm->uHelpReg = uHelpReg_save; + pAsm->starting_temp_register_number = starting_temp_register_number_save; + pAsm->pILInst = pILInst_save; + pAsm->uiCurInst = uiCurInst_save; + } + else + { /* was loaded */ + pPresubDesc = &(pAsm->presubs[i]); + + bRet = assemble_CAL(pAsm, + 0, + pPresubDesc->subIL_Shift, + pCompiledSub->NumInstructions, + pCompiledSub->Instructions, + pPresubDesc); + } + + if(GL_FALSE == bRet) + { + radeon_error("Shader presub assemble failed. \n"); + } + else + { + /* copy presub output to real dst */ + pAsm->alu_x_opcode = SQ_CF_INST_ALU; + pAsm->D.dst.opcode = SQ_OP2_INST_MOV; + + if( GL_FALSE == assemble_dst(pAsm) ) + { + return GL_FALSE; + } + + setaddrmode_PVSSRC(&(pAsm->S[0].src), ADDR_ABSOLUTE); + pAsm->S[0].src.rtype = SRC_REG_TEMPORARY; + pAsm->S[0].src.reg = pCompiledSub->dstRegIndex; + pAsm->S[0].src.swizzlex = pCompiledSub->outputSwizzleX; + pAsm->S[0].src.swizzley = pCompiledSub->outputSwizzleY; + pAsm->S[0].src.swizzlez = pCompiledSub->outputSwizzleZ; + pAsm->S[0].src.swizzlew = pCompiledSub->outputSwizzleW; + + next_ins(pAsm); + + pAsm->callers[pAsm->unCallerArrayPointer - 1].finale_cf_ptr = pAsm->cf_current_alu_clause_ptr; + pAsm->callers[pAsm->unCallerArrayPointer - 1].prelude_cf_ptr = prelude_cf_ptr; + pAsm->alu_x_opcode = SQ_CF_INST_ALU; + } + + if( (pPresubDesc->number_used_registers + pAsm->uFirstHelpReg) > pAsm->number_used_registers ) + { + pAsm->number_used_registers = pPresubDesc->number_used_registers + pAsm->uFirstHelpReg; + } + if(pAsm->uFirstHelpReg > pPresubDesc->maxStartReg) + { + pPresubDesc->maxStartReg = pAsm->uFirstHelpReg; + } + + return bRet; +} + GLboolean Process_Export(r700_AssemblerBase* pAsm, GLuint type, GLuint export_starting_index, @@ -6174,6 +6540,11 @@ GLboolean Clean_Up_Assembler(r700_AssemblerBase *pR700AsmCode) FREE(pR700AsmCode->callers); } + if(NULL != pR700AsmCode->presubs) + { + FREE(pR700AsmCode->presubs); + } + return GL_TRUE; } diff --git a/src/mesa/drivers/dri/r600/r700_assembler.h b/src/mesa/drivers/dri/r600/r700_assembler.h index 6dc44017eb..6ef945dfda 100644 --- a/src/mesa/drivers/dri/r600/r700_assembler.h +++ b/src/mesa/drivers/dri/r600/r700_assembler.h @@ -34,6 +34,45 @@ #include "r700_shaderinst.h" #include "r700_shader.h" +typedef enum LOADABLE_SCRIPT_SIGNITURE +{ + GLSL_NOISE1 = 0x10000001, + GLSL_NOISE2 = 0x10000002, + GLSL_NOISE3 = 0x10000003, + GLSL_NOISE4 = 0x10000004 +}LOADABLE_SCRIPT_SIGNITURE; + +typedef struct COMPILED_SUB +{ + struct prog_instruction *Instructions; + GLuint NumInstructions; + GLuint NumTemporaries; + GLuint NumParameters; + GLuint MinRegIndex; + GLfloat (*ParameterValues)[4]; + GLbyte outputSwizzleX; + GLbyte outputSwizzleY; + GLbyte outputSwizzleZ; + GLbyte outputSwizzleW; + GLshort srcRegIndex[3]; + GLushort dstRegIndex; +}COMPILED_SUB; + +typedef struct PRESUB_DESCtag +{ + LOADABLE_SCRIPT_SIGNITURE sptSigniture; + GLint subIL_Shift; + struct prog_src_register InReg[3]; + struct prog_dst_register OutReg; + + GLushort maxStartReg; + GLushort number_used_registers; + + GLuint unConstantsStart; + + COMPILED_SUB * pCompiledSub; +} PRESUB_DESC; + typedef enum SHADER_PIPE_TYPE { SPT_VP = 0, @@ -296,6 +335,7 @@ typedef struct SUB_OFFSET GLint subIL_Offset; GLuint unCFoffset; GLuint unStackDepthMax; + PRESUB_DESC * pPresubDesc; TypedShaderList lstCFInstructions_local; } SUB_OFFSET; @@ -304,6 +344,9 @@ typedef struct CALLER_POINTER GLint subIL_Offset; GLint subDescIndex; R700ControlFlowGenericClause* cf_ptr; + + R700ControlFlowGenericClause* prelude_cf_ptr; + R700ControlFlowGenericClause* finale_cf_ptr; } CALLER_POINTER; #define SQ_MAX_CALL_DEPTH 0x00000020 @@ -437,6 +480,11 @@ typedef struct r700_AssemblerBase GLuint unCFflags; + PRESUB_DESC * presubs; + GLuint unPresubArraySize; + GLuint unNumPresub; + GLuint unCurNumILInsts; + } r700_AssemblerBase; //Internal use @@ -458,7 +506,7 @@ BITS is_depth_component_exported(OUT_FRAGMENT_FMT_0* pFPOutFmt) ; GLboolean is_reduction_opcode(PVSDWORD * dest); GLuint GetSurfaceFormat(GLenum eType, GLuint nChannels, GLuint * pClient_size); -unsigned int r700GetNumOperands(r700_AssemblerBase* pAsm); +unsigned int r700GetNumOperands(GLuint opcode, GLuint nIsOp3); GLboolean IsTex(gl_inst_opcode Opcode); GLboolean IsAlu(gl_inst_opcode Opcode); @@ -585,13 +633,15 @@ GLboolean assemble_BRK(r700_AssemblerBase *pAsm); GLboolean assemble_COND(r700_AssemblerBase *pAsm); GLboolean assemble_ENDLOOP(r700_AssemblerBase *pAsm); -GLboolean assemble_BGNSUB(r700_AssemblerBase *pAsm, GLint nILindex); +GLboolean assemble_BGNSUB(r700_AssemblerBase *pAsm, GLint nILindex, GLuint uiIL_Shift); GLboolean assemble_ENDSUB(r700_AssemblerBase *pAsm); GLboolean assemble_RET(r700_AssemblerBase *pAsm); GLboolean assemble_CAL(r700_AssemblerBase *pAsm, GLint nILindex, + GLuint uiIL_Offest, GLuint uiNumberInsts, - struct prog_instruction *pILInst); + struct prog_instruction *pILInst, + PRESUB_DESC * pPresubDesc); GLboolean Process_Export(r700_AssemblerBase* pAsm, GLuint type, @@ -602,16 +652,23 @@ GLboolean Process_Export(r700_AssemblerBase* pAsm, GLboolean Move_Depth_Exports_To_Correct_Channels(r700_AssemblerBase *pAsm, BITS depth_channel_select); +GLboolean callPreSub(r700_AssemblerBase* pAsm, + LOADABLE_SCRIPT_SIGNITURE scriptSigniture, + /* struct prog_instruction ** pILInstParent, */ + COMPILED_SUB * pCompiledSub, + GLshort uOutReg, + GLshort uNumValidSrc); //Interface GLboolean AssembleInstr(GLuint uiFirstInst, + GLuint uiIL_Shift, GLuint uiNumberInsts, struct prog_instruction *pILInst, r700_AssemblerBase *pR700AsmCode); GLboolean Process_Fragment_Exports(r700_AssemblerBase *pR700AsmCode, GLbitfield OutputsWritten); GLboolean Process_Vertex_Exports(r700_AssemblerBase *pR700AsmCode, GLbitfield OutputsWritten); -GLboolean RelocProgram(r700_AssemblerBase * pAsm); +GLboolean RelocProgram(r700_AssemblerBase * pAsm, struct gl_program * pILProg); GLboolean InitShaderProgram(r700_AssemblerBase * pAsm); int Init_r700_AssemblerBase(SHADER_PIPE_TYPE spt, r700_AssemblerBase* pAsm, R700_Shader* pShader); diff --git a/src/mesa/drivers/dri/r600/r700_fragprog.c b/src/mesa/drivers/dri/r600/r700_fragprog.c index 8eb439a951..d15f013710 100644 --- a/src/mesa/drivers/dri/r600/r700_fragprog.c +++ b/src/mesa/drivers/dri/r600/r700_fragprog.c @@ -325,7 +325,11 @@ GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp, { fp->r700AsmCode.SamplerUnits[i] = fp->mesa_program.Base.SamplerUnits[i]; } + + fp->r700AsmCode.unCurNumILInsts = mesa_fp->Base.NumInstructions; + if( GL_FALSE == AssembleInstr(0, + 0, mesa_fp->Base.NumInstructions, &(mesa_fp->Base.Instructions[0]), &(fp->r700AsmCode)) ) @@ -338,7 +342,7 @@ GLboolean r700TranslateFragmentShader(struct r700_fragment_program *fp, return GL_FALSE; } - if( GL_FALSE == RelocProgram(&(fp->r700AsmCode)) ) + if( GL_FALSE == RelocProgram(&(fp->r700AsmCode), &(mesa_fp->Base)) ) { return GL_FALSE; } @@ -620,6 +624,25 @@ GLboolean r700SetupFragmentProgram(GLcontext * ctx) } else r700->ps.num_consts = 0; + COMPILED_SUB * pCompiledSub; + GLuint uj; + GLuint unConstOffset = r700->ps.num_consts; + for(ui=0; uiunNumPresub; ui++) + { + pCompiledSub = pAsm->presubs[ui].pCompiledSub; + + r700->ps.num_consts += pCompiledSub->NumParameters; + + for(uj=0; ujNumParameters; uj++) + { + r700->ps.consts[uj + unConstOffset][0].f32All = pCompiledSub->ParameterValues[uj][0]; + r700->ps.consts[uj + unConstOffset][1].f32All = pCompiledSub->ParameterValues[uj][1]; + r700->ps.consts[uj + unConstOffset][2].f32All = pCompiledSub->ParameterValues[uj][2]; + r700->ps.consts[uj + unConstOffset][3].f32All = pCompiledSub->ParameterValues[uj][3]; + } + unConstOffset += pCompiledSub->NumParameters; + } + return GL_TRUE; } diff --git a/src/mesa/drivers/dri/r600/r700_vertprog.c b/src/mesa/drivers/dri/r600/r700_vertprog.c index 759b74dc7e..90fac078ff 100644 --- a/src/mesa/drivers/dri/r600/r700_vertprog.c +++ b/src/mesa/drivers/dri/r600/r700_vertprog.c @@ -341,7 +341,11 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, { vp->r700AsmCode.SamplerUnits[i] = vp->mesa_program->Base.SamplerUnits[i]; } + + vp->r700AsmCode.unCurNumILInsts = vp->mesa_program->Base.NumInstructions; + if(GL_FALSE == AssembleInstr(0, + 0, vp->mesa_program->Base.NumInstructions, &(vp->mesa_program->Base.Instructions[0]), &(vp->r700AsmCode)) ) @@ -354,7 +358,7 @@ struct r700_vertex_program* r700TranslateVertexShader(GLcontext *ctx, return NULL; } - if( GL_FALSE == RelocProgram(&(vp->r700AsmCode)) ) + if( GL_FALSE == RelocProgram(&(vp->r700AsmCode), &(vp->mesa_program->Base)) ) { return GL_FALSE; } @@ -671,5 +675,24 @@ GLboolean r700SetupVertexProgram(GLcontext * ctx) } else r700->vs.num_consts = 0; + COMPILED_SUB * pCompiledSub; + GLuint uj; + GLuint unConstOffset = r700->vs.num_consts; + for(ui=0; uir700AsmCode.unNumPresub; ui++) + { + pCompiledSub = vp->r700AsmCode.presubs[ui].pCompiledSub; + + r700->vs.num_consts += pCompiledSub->NumParameters; + + for(uj=0; ujNumParameters; uj++) + { + r700->vs.consts[uj + unConstOffset][0].f32All = pCompiledSub->ParameterValues[uj][0]; + r700->vs.consts[uj + unConstOffset][1].f32All = pCompiledSub->ParameterValues[uj][1]; + r700->vs.consts[uj + unConstOffset][2].f32All = pCompiledSub->ParameterValues[uj][2]; + r700->vs.consts[uj + unConstOffset][3].f32All = pCompiledSub->ParameterValues[uj][3]; + } + unConstOffset += pCompiledSub->NumParameters; + } + return GL_TRUE; } -- cgit v1.2.3 From 637970aefdcdd1ee50e3759de384b82e6109a45c Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 9 Dec 2009 12:43:28 -0800 Subject: mesa: Fix array out-of-bounds access by _mesa_LightModelf. _mesa_LightModelf calls _mesa_LightModelfv, which uses the params argument as an array. --- src/mesa/main/light.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index 5a8f9160f6..c1d47de330 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -547,7 +547,10 @@ _mesa_LightModeli( GLenum pname, GLint param ) void GLAPIENTRY _mesa_LightModelf( GLenum pname, GLfloat param ) { - _mesa_LightModelfv( pname, ¶m ); + GLfloat fparam[4]; + fparam[0] = param; + fparam[1] = fparam[2] = fparam[3] = 0.0F; + _mesa_LightModelfv( pname, fparam ); } -- cgit v1.2.3 From 6f2d51b81ff907af9727e90153a46e79e246fc66 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 9 Dec 2009 13:00:22 -0800 Subject: mesa: Fix array out-of-bounds access by _mesa_PointParameterf. _mesa_PointParameterf calls _mesa_PointParameterfv, which uses the params argument as an array. --- src/mesa/main/points.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c index b330544890..9ec21c9b76 100644 --- a/src/mesa/main/points.c +++ b/src/mesa/main/points.c @@ -90,7 +90,10 @@ _mesa_PointParameteriv( GLenum pname, const GLint *params ) void GLAPIENTRY _mesa_PointParameterf( GLenum pname, GLfloat param) { - _mesa_PointParameterfv(pname, ¶m); + GLfloat p[3]; + p[0] = param; + p[1] = p[2] = 0.0F; + _mesa_PointParameterfv(pname, p); } -- cgit v1.2.3 From 348883076bd213ec733a1ba2a4768788e4669c97 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 9 Dec 2009 13:15:05 -0800 Subject: mesa: Fix array out-of-bounds access by _mesa_PointParameteri. _mesa_PointParameteri calls _mesa_PointParameterfv, which uses the params argument as an array. --- src/mesa/main/points.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/points.c b/src/mesa/main/points.c index 9ec21c9b76..dcaeccd90d 100644 --- a/src/mesa/main/points.c +++ b/src/mesa/main/points.c @@ -69,8 +69,10 @@ _mesa_PointSize( GLfloat size ) void GLAPIENTRY _mesa_PointParameteri( GLenum pname, GLint param ) { - const GLfloat value = (GLfloat) param; - _mesa_PointParameterfv(pname, &value); + GLfloat p[3]; + p[0] = (GLfloat) param; + p[1] = p[2] = 0.0F; + _mesa_PointParameterfv(pname, p); } -- cgit v1.2.3 From 8cc570a48c2e8e18622027cbd76f16a746b430bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 9 Dec 2009 00:55:51 +0100 Subject: r300g: clean up r300_emit_aos --- src/gallium/drivers/r300/r300_cs.h | 9 +++++ src/gallium/drivers/r300/r300_emit.c | 71 +++++++++++++++++++++++------------- src/gallium/drivers/r300/r300_reg.h | 5 +++ 3 files changed, 59 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_cs.h b/src/gallium/drivers/r300/r300_cs.h index 9fcf3ab538..d142fee050 100644 --- a/src/gallium/drivers/r300/r300_cs.h +++ b/src/gallium/drivers/r300/r300_cs.h @@ -115,6 +115,15 @@ cs_count -= 3; \ } while (0) +#define OUT_CS_RELOC_NO_OFFSET(bo, rd, wd, flags) do { \ + DBG(cs_context_copy, DBG_CS, "r300: writing relocation for buffer %p, " \ + "domains (%d, %d, %d)\n", \ + bo, rd, wd, flags); \ + assert(bo); \ + cs_winsys->write_cs_reloc(cs_winsys, bo, rd, wd, flags); \ + cs_count -= 2; \ +} while (0) + #define END_CS do { \ if (VERY_VERBOSE_CS) { \ DBG(cs_context_copy, DBG_CS, "r300: END_CS in %s (%s:%d)\n", __FUNCTION__, \ diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index dbf316a9b5..7620c73cac 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -1,5 +1,6 @@ /* * Copyright 2008 Corbin Simpson + * Copyright 2009 Marek Olšák * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -623,50 +624,68 @@ void r300_emit_texture(struct r300_context* r300, END_CS; } -/* XXX I can't read this and that's not good */ -void r300_emit_aos(struct r300_context* r300, unsigned offset) +static boolean r300_validate_aos(struct r300_context *r300) { struct pipe_vertex_buffer *vbuf = r300->vertex_buffer; struct pipe_vertex_element *velem = r300->vertex_element; - CS_LOCALS(r300); int i; - unsigned aos_count = r300->vertex_element_count; + /* Check if formats and strides are aligned to the size of DWORD. */ + for (i = 0; i < r300->vertex_element_count; i++) { + if (vbuf[velem[i].vertex_buffer_index].stride % 4 != 0 || + pf_get_blocksize(velem[i].src_format) % 4 != 0) { + return FALSE; + } + } + return TRUE; +} + +void r300_emit_aos(struct r300_context* r300, unsigned offset) +{ + struct pipe_vertex_buffer *vb1, *vb2, *vbuf = r300->vertex_buffer; + struct pipe_vertex_element *velem = r300->vertex_element; + int i; + unsigned size1, size2, aos_count = r300->vertex_element_count; unsigned packet_size = (aos_count * 3 + 1) / 2; + CS_LOCALS(r300); + + /* XXX Move this checking to a more approriate place. */ + if (!r300_validate_aos(r300)) { + /* XXX We should fallback using Draw. */ + assert(0); + } + BEGIN_CS(2 + packet_size + aos_count * 2); OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, packet_size); OUT_CS(aos_count); + for (i = 0; i < aos_count - 1; i += 2) { - int buf_num1 = velem[i].vertex_buffer_index; - int buf_num2 = velem[i+1].vertex_buffer_index; - assert(vbuf[buf_num1].stride % 4 == 0 && pf_get_blocksize(velem[i].src_format) % 4 == 0); - assert(vbuf[buf_num2].stride % 4 == 0 && pf_get_blocksize(velem[i+1].src_format) % 4 == 0); - OUT_CS((pf_get_blocksize(velem[i].src_format) >> 2) | (vbuf[buf_num1].stride << 6) | - (pf_get_blocksize(velem[i+1].src_format) << 14) | (vbuf[buf_num2].stride << 22)); - OUT_CS(vbuf[buf_num1].buffer_offset + velem[i].src_offset + - offset * vbuf[buf_num1].stride); - OUT_CS(vbuf[buf_num2].buffer_offset + velem[i+1].src_offset + - offset * vbuf[buf_num2].stride); + vb1 = &vbuf[velem[i].vertex_buffer_index]; + vb2 = &vbuf[velem[i+1].vertex_buffer_index]; + size1 = pf_get_blocksize(velem[i].src_format); + size2 = pf_get_blocksize(velem[i+1].src_format); + + OUT_CS(R300_VBPNTR_SIZE0(size1) | R300_VBPNTR_STRIDE0(vb1->stride) | + R300_VBPNTR_SIZE1(size2) | R300_VBPNTR_STRIDE1(vb2->stride)); + OUT_CS(vb1->buffer_offset + velem[i].src_offset + offset * vb1->stride); + OUT_CS(vb2->buffer_offset + velem[i+1].src_offset + offset * vb2->stride); } + if (aos_count & 1) { - int buf_num = velem[i].vertex_buffer_index; - assert(vbuf[buf_num].stride % 4 == 0 && pf_get_blocksize(velem[i].src_format) % 4 == 0); - OUT_CS((pf_get_blocksize(velem[i].src_format) >> 2) | (vbuf[buf_num].stride << 6)); - OUT_CS(vbuf[buf_num].buffer_offset + velem[i].src_offset + - offset * vbuf[buf_num].stride); + vb1 = &vbuf[velem[i].vertex_buffer_index]; + size1 = pf_get_blocksize(velem[i].src_format); + + OUT_CS(R300_VBPNTR_SIZE0(size1) | R300_VBPNTR_STRIDE0(vb1->stride)); + OUT_CS(vb1->buffer_offset + velem[i].src_offset + offset * vb1->stride); } - /* XXX bare CS reloc */ for (i = 0; i < aos_count; i++) { - cs_winsys->write_cs_reloc(cs_winsys, - vbuf[velem[i].vertex_buffer_index].buffer, - RADEON_GEM_DOMAIN_GTT, - 0, - 0); - cs_count -= 2; + OUT_CS_RELOC_NO_OFFSET(vbuf[velem[i].vertex_buffer_index].buffer, + RADEON_GEM_DOMAIN_GTT, 0, 0); } END_CS; } + #if 0 void r300_emit_draw_packet(struct r300_context* r300) { diff --git a/src/gallium/drivers/r300/r300_reg.h b/src/gallium/drivers/r300/r300_reg.h index 85b1ea568a..c1ea87d11e 100644 --- a/src/gallium/drivers/r300/r300_reg.h +++ b/src/gallium/drivers/r300/r300_reg.h @@ -3293,6 +3293,11 @@ enum { */ #define R300_PACKET3_3D_LOAD_VBPNTR 0x00002F00 +# define R300_VBPNTR_SIZE0(x) ((x) >> 2) +# define R300_VBPNTR_STRIDE0(x) (((x) >> 2) << 8) +# define R300_VBPNTR_SIZE1(x) (((x) >> 2) << 16) +# define R300_VBPNTR_STRIDE1(x) (((x) >> 2) << 24) + #define R300_PACKET3_INDX_BUFFER 0x00003300 # define R300_INDX_BUFFER_DST_SHIFT 0 # define R300_INDX_BUFFER_SKIP_SHIFT 16 -- cgit v1.2.3 From 87b822e024797ef2fdb51ec9364f21eeb4d07161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 8 Dec 2009 04:55:32 +0100 Subject: r300g: make pow(0,0) return 1 instead of NaN in the R500 fragment shader Unfortunately we can't fix this easily in the R300 fragment shader, and it's probably not worth the effort. --- src/gallium/drivers/r300/r300_emit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 7620c73cac..55bc2b3528 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -277,7 +277,7 @@ void r500_emit_fragment_program_code(struct r300_context* r300, BEGIN_CS(13 + ((code->inst_end + 1) * 6)); - OUT_CS_REG(R500_US_CONFIG, 0); + OUT_CS_REG(R500_US_CONFIG, R500_ZERO_TIMES_ANYTHING_EQUALS_ZERO); OUT_CS_REG(R500_US_PIXSIZE, code->max_temp_idx); OUT_CS_REG(R500_US_CODE_RANGE, R500_US_CODE_RANGE_ADDR(0) | R500_US_CODE_RANGE_SIZE(code->inst_end)); -- cgit v1.2.3 From 6de7ac73bf027b9ace6f5f0c8063cbf724d95cee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 8 Dec 2009 21:53:19 +0100 Subject: r300g: always disable unused colorbuffers --- src/gallium/drivers/r300/r300_emit.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c index 55bc2b3528..f784e1fa8e 100644 --- a/src/gallium/drivers/r300/r300_emit.c +++ b/src/gallium/drivers/r300/r300_emit.c @@ -331,7 +331,13 @@ void r300_emit_fb_state(struct r300_context* r300, int i; CS_LOCALS(r300); - BEGIN_CS((10 * fb->nr_cbufs) + (fb->zsbuf ? 10 : 0) + 4); + /* Shouldn't fail unless there is a bug in the state tracker. */ + assert(fb->nr_cbufs <= 4); + + BEGIN_CS((10 * fb->nr_cbufs) + (2 * (4 - fb->nr_cbufs)) + + (fb->zsbuf ? 10 : 0) + 4); + + /* Flush and free renderbuffer caches. */ OUT_CS_REG(R300_RB3D_DSTCACHE_CTLSTAT, R300_RB3D_DSTCACHE_CTLSTAT_DC_FREE_FREE_3D_TAGS | R300_RB3D_DSTCACHE_CTLSTAT_DC_FLUSH_FLUSH_DIRTY_3D); @@ -339,6 +345,7 @@ void r300_emit_fb_state(struct r300_context* r300, R300_ZB_ZCACHE_CTLSTAT_ZC_FLUSH_FLUSH_AND_FREE | R300_ZB_ZCACHE_CTLSTAT_ZC_FREE_FREE); + /* Set up colorbuffers. */ for (i = 0; i < fb->nr_cbufs; i++) { surf = fb->cbufs[i]; tex = (struct r300_texture*)surf->texture; @@ -356,6 +363,12 @@ void r300_emit_fb_state(struct r300_context* r300, r300_translate_out_fmt(surf->format)); } + /* Disable unused colorbuffers. */ + for (; i < 4; i++) { + OUT_CS_REG(R300_US_OUT_FMT_0 + (4 * i), R300_US_OUT_FMT_UNUSED); + } + + /* Set up a zbuffer. */ if (fb->zsbuf) { surf = fb->zsbuf; tex = (struct r300_texture*)surf->texture; -- cgit v1.2.3 From c6b450033d7ec2a415b1d761da1d94588358c94b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 9 Dec 2009 00:45:18 +0100 Subject: r300g: fix routing of vertex streams if TCL is bypassed Generating mipmaps finally works, among other things. Yay! --- src/gallium/drivers/r300/r300_state.c | 2 -- src/gallium/drivers/r300/r300_state_derived.c | 17 +++++++++++---- src/gallium/drivers/r300/r300_vs.c | 31 +++++++++++---------------- src/gallium/drivers/r300/r300_vs.h | 4 +++- 4 files changed, 29 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 68c5408a64..edf7114bbb 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -419,8 +419,6 @@ static void* r300_create_rs_state(struct pipe_context* pipe, 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->point_size = pack_float_16_6x(state->point_size) | diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c index 6af49888b9..29bc701a86 100644 --- a/src/gallium/drivers/r300/r300_state_derived.c +++ b/src/gallium/drivers/r300/r300_state_derived.c @@ -134,6 +134,16 @@ static void r300_vertex_psc(struct r300_context* r300) uint16_t type, swizzle; enum pipe_format format; unsigned i; + int identity[16] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}; + int* stream_tab; + + /* If TCL is bypassed, map vertex streams to equivalent VS output + * locations. */ + if (r300->rs_state->enable_vte) { + stream_tab = identity; + } else { + stream_tab = r300->vs->stream_loc_notcl; + } /* Vertex shaders have no semantics on their inputs, * so PSC should just route stuff based on the vertex elements, @@ -147,10 +157,10 @@ static void r300_vertex_psc(struct r300_context* r300) format = r300->vertex_element[i].src_format; type = r300_translate_vertex_data_type(format) | - (i << R300_DST_VEC_LOC_SHIFT); + (stream_tab[i] << R300_DST_VEC_LOC_SHIFT); swizzle = r300_translate_vertex_data_swizzle(format); - if (i % 2) { + if (i & 1) { vformat->vap_prog_stream_cntl[i >> 1] |= type << 16; vformat->vap_prog_stream_cntl_ext[i >> 1] |= swizzle << 16; } else { @@ -159,7 +169,6 @@ static void r300_vertex_psc(struct r300_context* r300) } } - assert(i <= 15); /* Set the last vector in the PSC. */ @@ -178,7 +187,7 @@ static void r300_swtcl_vertex_psc(struct r300_context* r300) uint16_t type, swizzle; enum pipe_format format; unsigned i, attrib_count; - int* vs_output_tab = r300->vs->output_stream_loc_swtcl; + int* vs_output_tab = r300->vs->stream_loc_notcl; /* For each Draw attribute, route it to the fragment shader according * to the vs_output_tab. */ diff --git a/src/gallium/drivers/r300/r300_vs.c b/src/gallium/drivers/r300/r300_vs.c index 31248346bc..fa207c939c 100644 --- a/src/gallium/drivers/r300/r300_vs.c +++ b/src/gallium/drivers/r300/r300_vs.c @@ -143,35 +143,33 @@ static void r300_shader_vap_output_fmt( assert(gen_count <= 8); } -/* Set VS output stream locations for SWTCL. */ -static void r300_stream_locations_swtcl( +/* Sets up stream mapping to equivalent VS outputs if TCL is bypassed + * or isn't present. */ +static void r300_stream_locations_notcl( struct r300_shader_semantics* vs_outputs, - int* output_stream_loc) + int* stream_loc) { int i, tabi = 0, gen_count; - /* XXX Check whether the numbers (0, 1, 2+i, etc.) are correct. - * These should go to VAP_PROG_STREAM_CNTL/DST_VEC_LOC. */ - /* Position. */ - output_stream_loc[tabi++] = 0; + stream_loc[tabi++] = 0; /* Point size. */ if (vs_outputs->psize != ATTR_UNUSED) { - output_stream_loc[tabi++] = 1; + stream_loc[tabi++] = 1; } /* Colors. */ for (i = 0; i < ATTR_COLOR_COUNT; i++) { if (vs_outputs->color[i] != ATTR_UNUSED) { - output_stream_loc[tabi++] = 2 + i; + stream_loc[tabi++] = 2 + i; } } /* Back-face colors. */ for (i = 0; i < ATTR_COLOR_COUNT; i++) { if (vs_outputs->bcolor[i] != ATTR_UNUSED) { - output_stream_loc[tabi++] = 4 + i; + stream_loc[tabi++] = 4 + i; } } @@ -180,7 +178,7 @@ static void r300_stream_locations_swtcl( for (i = 0; i < ATTR_GENERIC_COUNT; i++) { if (vs_outputs->bcolor[i] != ATTR_UNUSED) { assert(tabi < 16); - output_stream_loc[tabi++] = 6 + gen_count; + stream_loc[tabi++] = 6 + gen_count; gen_count++; } } @@ -188,7 +186,7 @@ static void r300_stream_locations_swtcl( /* Fog coordinates. */ if (vs_outputs->fog != ATTR_UNUSED) { assert(tabi < 16); - output_stream_loc[tabi++] = 6 + gen_count; + stream_loc[tabi++] = 6 + gen_count; gen_count++; } @@ -196,7 +194,7 @@ static void r300_stream_locations_swtcl( assert(gen_count <= 8); for (; tabi < 16;) { - output_stream_loc[tabi++] = -1; + stream_loc[tabi++] = -1; } } @@ -254,10 +252,7 @@ void r300_translate_vertex_shader(struct r300_context* r300, /* Initialize. */ r300_shader_read_vs_outputs(&vs->info, &vs->outputs); r300_shader_vap_output_fmt(&vs->outputs, vs->hwfmt); - - if (!r300_screen(r300->context.screen)->caps->has_tcl) { - r300_stream_locations_swtcl(&vs->outputs, vs->output_stream_loc_swtcl); - } + r300_stream_locations_notcl(&vs->outputs, vs->stream_loc_notcl); /* Setup the compiler */ rc_init(&compiler.Base); @@ -283,7 +278,7 @@ void r300_translate_vertex_shader(struct r300_context* r300, /* Invoke the compiler */ r3xx_compile_vertex_program(&compiler); if (compiler.Base.Error) { - /* XXX Fail gracefully */ + /* XXX We should fallback using Draw. */ fprintf(stderr, "r300 VP: Compiler error\n"); abort(); } diff --git a/src/gallium/drivers/r300/r300_vs.h b/src/gallium/drivers/r300/r300_vs.h index 283dd5a9e8..67e9db5366 100644 --- a/src/gallium/drivers/r300/r300_vs.h +++ b/src/gallium/drivers/r300/r300_vs.h @@ -38,9 +38,11 @@ struct r300_vertex_shader { struct tgsi_shader_info info; struct r300_shader_semantics outputs; - int output_stream_loc_swtcl[16]; uint hwfmt[4]; + /* Stream locations for SWTCL or if TCL is bypassed. */ + int stream_loc_notcl[16]; + /* Has this shader been translated yet? */ boolean translated; -- cgit v1.2.3 From 34528a34c446afea4442f479713e7f926220f128 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 9 Dec 2009 17:11:30 -0800 Subject: mesa: Fix array out-of-bounds access by _mesa_Lightf. --- src/mesa/main/light.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index c1d47de330..d4f3bb9026 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -206,7 +206,10 @@ _mesa_light(GLcontext *ctx, GLuint lnum, GLenum pname, const GLfloat *params) void GLAPIENTRY _mesa_Lightf( GLenum light, GLenum pname, GLfloat param ) { - _mesa_Lightfv( light, pname, ¶m ); + GLfloat fparam[4]; + fparam[0] = param; + fparam[1] = fparam[2] = fparam[3] = 0.0F; + _mesa_Lightfv( light, pname, fparam ); } -- cgit v1.2.3 From 444d1f39108ab4419843f19f76c968cef3398bab Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 9 Dec 2009 17:34:50 -0800 Subject: mesa: Fix array out-of-bounds access by _mesa_Lighti. _mesa_Lighti calls _mesa_Lightiv, which uses the params argument as an array. --- src/mesa/main/light.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index d4f3bb9026..5150926159 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -288,7 +288,10 @@ _mesa_Lightfv( GLenum light, GLenum pname, const GLfloat *params ) void GLAPIENTRY _mesa_Lighti( GLenum light, GLenum pname, GLint param ) { - _mesa_Lightiv( light, pname, ¶m ); + GLint iparam[4]; + iparam[0] = param; + iparam[1] = iparam[2] = iparam[3] = 0; + _mesa_Lightiv( light, pname, iparam ); } -- cgit v1.2.3 From b82757880545f8bce471ba8f13c16998888cd4b5 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 9 Dec 2009 17:59:23 -0800 Subject: mesa: Fix array out-of-bounds access by _mesa_TexGend. _mesa_TexGend calls _mesa_TexGenfv, which uses the params argument as an array. --- src/mesa/main/texgen.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texgen.c b/src/mesa/main/texgen.c index d3ea7b936b..f9d38215d6 100644 --- a/src/mesa/main/texgen.c +++ b/src/mesa/main/texgen.c @@ -181,8 +181,10 @@ _mesa_TexGeniv(GLenum coord, GLenum pname, const GLint *params ) void GLAPIENTRY _mesa_TexGend(GLenum coord, GLenum pname, GLdouble param ) { - GLfloat p = (GLfloat) param; - _mesa_TexGenfv( coord, pname, &p ); + GLfloat p[4]; + p[0] = (GLfloat) param; + p[1] = p[2] = p[3] = 0.0F; + _mesa_TexGenfv( coord, pname, p ); } -- cgit v1.2.3 From 71f4267ac23f52dcc94590cb94c3e0ce451662aa Mon Sep 17 00:00:00 2001 From: Roland Scheidegger Date: Thu, 10 Dec 2009 03:51:35 +0100 Subject: winsys/intel: fix dereferencing of opaque type due to pipe_reference changes --- src/gallium/winsys/drm/intel/gem/intel_drm_fence.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/winsys/drm/intel/gem/intel_drm_fence.c b/src/gallium/winsys/drm/intel/gem/intel_drm_fence.c index b6248a3bcf..e8b58742ab 100644 --- a/src/gallium/winsys/drm/intel/gem/intel_drm_fence.c +++ b/src/gallium/winsys/drm/intel/gem/intel_drm_fence.c @@ -39,7 +39,7 @@ intel_drm_fence_reference(struct intel_winsys *iws, struct intel_drm_fence *old = (struct intel_drm_fence *)*ptr; struct intel_drm_fence *f = (struct intel_drm_fence *)fence; - if (pipe_reference(&(*ptr)->reference, &f->reference)) { + if (pipe_reference(&((struct intel_drm_fence *)(*ptr))->reference, &f->reference)) { if (old->bo) drm_intel_bo_unreference(old->bo); FREE(old); -- cgit v1.2.3 From 05b62960929b78a53465ffcb0739454519ed157a Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Wed, 9 Dec 2009 22:34:07 -0800 Subject: mesa: Fix SCons build. Commit cd6b8dd9e82fedc55d033131fbc0f8ee950567c8 deleted src/mesa/state_tracker/st_cb_get.c. --- src/mesa/SConscript | 1 - 1 file changed, 1 deletion(-) (limited to 'src') diff --git a/src/mesa/SConscript b/src/mesa/SConscript index 309e0e54d0..ca4a9afce5 100644 --- a/src/mesa/SConscript +++ b/src/mesa/SConscript @@ -164,7 +164,6 @@ if env['platform'] != 'winddk': 'state_tracker/st_cb_flush.c', 'state_tracker/st_cb_drawpixels.c', 'state_tracker/st_cb_fbo.c', - 'state_tracker/st_cb_get.c', 'state_tracker/st_cb_feedback.c', 'state_tracker/st_cb_program.c', 'state_tracker/st_cb_queryobj.c', -- cgit v1.2.3 From 51e945ec9c0b803f5e998f87449fb02a7c39ae65 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 10 Dec 2009 09:16:37 -0800 Subject: intel: Attempt to fix up after "Update vertex texture code." The MaxCombinedTextureImageUnits is the total number of samplers that can be bound between vertex, geometry, and fragment, not 0. This should report the correct value on 965 now. Other DRI drivers may also need updating if their MaxVertexTextureImageUnits != 0 (for example, if using the sw vertex pipeline). It's not clear to me if there's going to be a valid value for this limit other than MaxTextureImageUnits + MaxVertexTextureImageUnits (+ MaxGeometryTextureImageUnits eventually). If not, then we should probably just move this into the core at Get time. Bug #25518 (wine regression). Fixes piglit vp-combined-image-units. --- src/mesa/drivers/dri/i915/i915_context.c | 3 +++ src/mesa/drivers/dri/i965/brw_context.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 7d4c7cfbab..0485be2cc1 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -143,6 +143,9 @@ i915CreateContext(const __GLcontextModes * mesaVis, ctx->Const.MaxTextureImageUnits = I915_TEX_UNITS; ctx->Const.MaxTextureCoordUnits = I915_TEX_UNITS; ctx->Const.MaxVarying = I915_TEX_UNITS; + ctx->Const.MaxCombinedTextureImageUnits = + ctx->Const.MaxVertexTextureImageUnits + + ctx->Const.MaxTextureImageUnits; /* Advertise the full hardware capabilities. The new memory * manager should cope much better with overload situations: diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 8bdda60697..78bea82949 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -111,7 +111,9 @@ GLboolean brwCreateContext( const __GLcontextModes *mesaVis, ctx->Const.MaxTextureUnits = MIN2(ctx->Const.MaxTextureCoordUnits, ctx->Const.MaxTextureImageUnits); ctx->Const.MaxVertexTextureImageUnits = 0; /* no vertex shader textures */ - ctx->Const.MaxCombinedTextureImageUnits = 0; + ctx->Const.MaxCombinedTextureImageUnits = + ctx->Const.MaxVertexTextureImageUnits + + ctx->Const.MaxTextureImageUnits; /* Mesa limits textures to 4kx4k; it would be nice to fix that someday */ -- cgit v1.2.3 From 690d888416909f0449e6ebbfa46f18079b68b1bd Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Wed, 18 Nov 2009 12:06:32 -0500 Subject: st/xorg: enable yv12 for xv --- src/gallium/state_trackers/xorg/xorg_xv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index b3315dccad..fdc1cdb82e 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -73,10 +73,11 @@ static XF86VideoEncodingRec DummyEncoding[1] = { } }; -#define NUM_IMAGES 2 +#define NUM_IMAGES 3 static XF86ImageRec Images[NUM_IMAGES] = { XVIMAGE_UYVY, XVIMAGE_YUY2, + XVIMAGE_YV12, }; struct xorg_xv_port_priv { @@ -532,6 +533,7 @@ put_image(ScrnInfoPtr pScrn, switch (id) { case FOURCC_UYVY: case FOURCC_YUY2: + case FOURCC_YV12: default: srcPitch = width << 1; break; @@ -580,6 +582,7 @@ query_image_attributes(ScrnInfoPtr pScrn, switch (id) { case FOURCC_UYVY: case FOURCC_YUY2: + case FOURCC_YV12: default: size = *w << 1; if (pitches) -- cgit v1.2.3 From 967e6e20099ebd3a7f68f49233e6cf3c99ce3317 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Thu, 10 Dec 2009 13:01:53 -0500 Subject: st/xorg: fix yv12 plus some cleanups in the upload code --- src/gallium/state_trackers/xorg/xorg_xv.c | 127 ++++++++++++++++-------------- 1 file changed, 70 insertions(+), 57 deletions(-) (limited to 'src') diff --git a/src/gallium/state_trackers/xorg/xorg_xv.c b/src/gallium/state_trackers/xorg/xorg_xv.c index fdc1cdb82e..19c50051a8 100644 --- a/src/gallium/state_trackers/xorg/xorg_xv.c +++ b/src/gallium/state_trackers/xorg/xorg_xv.c @@ -213,17 +213,67 @@ check_yuv_textures(struct xorg_xv_port_priv *priv, int width, int height) return Success; } +static int +query_image_attributes(ScrnInfoPtr pScrn, + int id, + unsigned short *w, unsigned short *h, + int *pitches, int *offsets) +{ + int size, tmp; + + if (*w > IMAGE_MAX_WIDTH) + *w = IMAGE_MAX_WIDTH; + if (*h > IMAGE_MAX_HEIGHT) + *h = IMAGE_MAX_HEIGHT; + + *w = (*w + 1) & ~1; + if (offsets) + offsets[0] = 0; + + switch (id) { + case FOURCC_YV12: + *h = (*h + 1) & ~1; + size = (*w + 3) & ~3; + if (pitches) { + pitches[0] = size; + } + size *= *h; + if (offsets) { + offsets[1] = size; + } + tmp = ((*w >> 1) + 3) & ~3; + if (pitches) { + pitches[1] = pitches[2] = tmp; + } + tmp *= (*h >> 1); + size += tmp; + if (offsets) { + offsets[2] = size; + } + size += tmp; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + size = *w << 1; + if (pitches) + pitches[0] = size; + size *= *h; + break; + } + + return size; +} + static void copy_packed_data(ScrnInfoPtr pScrn, struct xorg_xv_port_priv *port, int id, unsigned char *buf, - int srcPitch, int left, int top, - int w, int h) + unsigned short w, unsigned short h) { - unsigned char *src; int i, j; struct pipe_texture **dst = port->yuv[port->current_set]; struct pipe_transfer *ytrans, *utrans, *vtrans; @@ -233,8 +283,6 @@ copy_packed_data(ScrnInfoPtr pScrn, int yidx, uidx, vidx; int y_array_size = w * h; - src = buf + (top * srcPitch) + (left << 1); - ytrans = screen->get_tex_transfer(screen, dst[0], 0, 0, 0, PIPE_TRANSFER_WRITE, @@ -256,15 +304,22 @@ copy_packed_data(ScrnInfoPtr pScrn, switch (id) { case FOURCC_YV12: { - for (i = 0; i < w; ++i) { - for (j = 0; j < h; ++j) { - /*XXX use src? */ - y1 = buf[j*w + i]; - u = buf[(j/2) * (w/2) + i/2 + y_array_size]; - v = buf[(j/2) * (w/2) + i/2 + y_array_size + y_array_size/4]; - ymap[yidx++] = y1; - umap[uidx++] = u; - vmap[vidx++] = v; + int pitches[3], offsets[3]; + unsigned char *y, *u, *v; + query_image_attributes(pScrn, FOURCC_YV12, + &w, &h, pitches, offsets); + + y = buf + offsets[0]; + v = buf + offsets[1]; + u = buf + offsets[2]; + for (i = 0; i < h; ++i) { + for (j = 0; j < w; ++j) { + int yoffset = (w*i+j); + int ii = (i|1), jj = (j|1); + int vuoffset = (w/2)*(ii/2) + (jj/2); + ymap[yidx++] = y[yoffset]; + umap[uidx++] = u[vuoffset]; + vmap[vidx++] = v[vuoffset]; } } } @@ -511,7 +566,6 @@ put_image(ScrnInfoPtr pScrn, ScreenPtr pScreen = screenInfo.screens[pScrn->scrnIndex]; PixmapPtr pPixmap; INT32 x1, x2, y1, y2; - int srcPitch; BoxRec dstBox; int ret; @@ -530,21 +584,12 @@ put_image(ScrnInfoPtr pScrn, width, height)) return Success; - switch (id) { - case FOURCC_UYVY: - case FOURCC_YUY2: - case FOURCC_YV12: - default: - srcPitch = width << 1; - break; - } - ret = check_yuv_textures(pPriv, width, height); if (ret) return ret; - copy_packed_data(pScrn, pPriv, id, buf, srcPitch, + copy_packed_data(pScrn, pPriv, id, buf, src_x, src_y, width, height); if (pDraw->type == DRAWABLE_WINDOW) { @@ -562,38 +607,6 @@ put_image(ScrnInfoPtr pScrn, return Success; } -static int -query_image_attributes(ScrnInfoPtr pScrn, - int id, - unsigned short *w, unsigned short *h, - int *pitches, int *offsets) -{ - int size; - - if (*w > IMAGE_MAX_WIDTH) - *w = IMAGE_MAX_WIDTH; - if (*h > IMAGE_MAX_HEIGHT) - *h = IMAGE_MAX_HEIGHT; - - *w = (*w + 1) & ~1; - if (offsets) - offsets[0] = 0; - - switch (id) { - case FOURCC_UYVY: - case FOURCC_YUY2: - case FOURCC_YV12: - default: - size = *w << 1; - if (pitches) - pitches[0] = size; - size *= *h; - break; - } - - return size; -} - static struct xorg_xv_port_priv * port_priv_create(struct xorg_renderer *r) { -- cgit v1.2.3 From cb640c8d40c4ee34160a14d646c244f44a5013f6 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 10 Dec 2009 10:03:16 -0800 Subject: mesa: Fix default (swrast) GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS. The swrast pipeline shouldn't have any problem with all the frag and vert textures being bound at the same time. Note that this may result in DRI drivers that don't set this limit having an improbable return (fragment + vertex < combined), but it seems like it shouldn't cause problems for apps. --- src/mesa/main/config.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index c5048970cc..2eac1cc2ed 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -243,7 +243,8 @@ /*@{*/ #define MAX_VERTEX_GENERIC_ATTRIBS 16 #define MAX_VERTEX_TEXTURE_IMAGE_UNITS MAX_TEXTURE_IMAGE_UNITS -#define MAX_COMBINED_TEXTURE_IMAGE_UNITS MAX_TEXTURE_IMAGE_UNITS +#define MAX_COMBINED_TEXTURE_IMAGE_UNITS (MAX_VERTEX_TEXTURE_IMAGE_UNITS + \ + MAX_TEXTURE_IMAGE_UNITS) /*@}*/ -- cgit v1.2.3 From dcb4a37fc89924192d923ed6906d2922371b8cb1 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 10 Dec 2009 12:11:09 -0800 Subject: mesa: Fix array out-of-bounds access by _mesa_TexParameteriv. --- src/mesa/main/texparam.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 1cec4b82fe..0f83d226f2 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -700,8 +700,10 @@ _mesa_TexParameteriv(GLenum target, GLenum pname, const GLint *params) case GL_TEXTURE_COMPARE_FAIL_VALUE_ARB: { /* convert int param to float */ - GLfloat fparam = (GLfloat) params[0]; - need_update = set_tex_parameterf(ctx, texObj, pname, &fparam); + GLfloat fparams[4]; + fparams[0] = (GLfloat) params[0]; + fparams[1] = fparams[2] = fparams[3] = 0.0F; + need_update = set_tex_parameterf(ctx, texObj, pname, fparams); } break; default: -- cgit v1.2.3 From 51f52edaf186a927a2c8c29ba9dba56d18928a7e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 10 Dec 2009 12:37:10 -0800 Subject: glsl: Fix array out-of-bounds access by _slang_lookup_constant. --- src/mesa/shader/slang/slang_simplify.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_simplify.c b/src/mesa/shader/slang/slang_simplify.c index b8a21f642c..539c6ff0d1 100644 --- a/src/mesa/shader/slang/slang_simplify.c +++ b/src/mesa/shader/slang/slang_simplify.c @@ -84,10 +84,11 @@ _slang_lookup_constant(const char *name) for (i = 0; info[i].Name; i++) { if (strcmp(info[i].Name, name) == 0) { /* found */ - GLint value = -1; - _mesa_GetIntegerv(info[i].Token, &value); - ASSERT(value >= 0); /* sanity check that glGetFloatv worked */ - return value; + GLint values[4]; + values[0] = -1; + _mesa_GetIntegerv(info[i].Token, values); + ASSERT(values[0] >= 0); /* sanity check that glGetFloatv worked */ + return values[0]; } } return -1; -- cgit v1.2.3 From 539a14a1dd5a0d277b193d9cd2d06423ed98dc8a Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Wed, 9 Dec 2009 11:36:45 -0800 Subject: intel: Flush the render/texture cache when finishing render to texture. Back when we were flushing the entire batch at BindFramebuffer, the kernel would notice the domain transition when someone went to texture from it and flush for us. We no longer do the batch flushing every time, so we get to do aggressive flushing until we move batchbuffer handling to libdrm. Fixes piglit fbo-flushing. Bug #25377. No noticeable performance loss on cairo-gl (so this is better than batch flushing). --- src/mesa/drivers/dri/intel/intel_fbo.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 5615040946..679fa2f82a 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -37,6 +37,7 @@ #include "drivers/common/meta.h" #include "intel_context.h" +#include "intel_batchbuffer.h" #include "intel_buffers.h" #include "intel_fbo.h" #include "intel_mipmap_tree.h" @@ -591,6 +592,7 @@ static void intel_finish_render_texture(GLcontext * ctx, struct gl_renderbuffer_attachment *att) { + struct intel_context *intel = intel_context(ctx); struct gl_texture_object *tex_obj = att->Texture; struct gl_texture_image *image = tex_obj->Image[att->CubeMapFace][att->TextureLevel]; @@ -598,8 +600,14 @@ intel_finish_render_texture(GLcontext * ctx, /* Flag that this image may now be validated into the object's miptree. */ intel_image->used_as_render_target = GL_FALSE; -} + /* Since we've (probably) rendered to the texture and will (likely) use + * it in the texture domain later on in this batchbuffer, flush the + * batch. Once again, we wish for a domain tracker in libdrm to cover + * usage inside of a batchbuffer like GEM does in the kernel. + */ + intel_batchbuffer_emit_mi_flush(intel->batch); +} /** * Do additional "completeness" testing of a framebuffer object. -- cgit v1.2.3 From 3078bd136d6ee1d9ad16b4c834cad23b005304a4 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 8 Dec 2009 09:57:27 -0800 Subject: intel: Axe intel_renderbuffer::texformat Since the texformat branch merge, the value of intel_renderbuffer::texformat is just a copy of gl_renderbuffer::Format. --- src/mesa/drivers/dri/i915/i830_vtbl.c | 4 ++-- src/mesa/drivers/dri/i915/i915_vtbl.c | 4 ++-- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 4 ++-- src/mesa/drivers/dri/intel/intel_blit.c | 4 ++-- src/mesa/drivers/dri/intel/intel_fbo.c | 13 ++----------- src/mesa/drivers/dri/intel/intel_fbo.h | 2 -- src/mesa/drivers/dri/intel/intel_span.c | 6 +++--- 7 files changed, 13 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i830_vtbl.c b/src/mesa/drivers/dri/i915/i830_vtbl.c index a6f554701e..e8c8d5a048 100644 --- a/src/mesa/drivers/dri/i915/i830_vtbl.c +++ b/src/mesa/drivers/dri/i915/i830_vtbl.c @@ -645,7 +645,7 @@ i830_state_draw_region(struct intel_context *intel, DSTORG_VERT_BIAS(0x8) | DEPTH_IS_Z); /* .5 */ if (irb != NULL) { - switch (irb->texformat) { + switch (irb->Base.Format) { case MESA_FORMAT_ARGB8888: case MESA_FORMAT_XRGB8888: value |= DV_PF_8888; @@ -661,7 +661,7 @@ i830_state_draw_region(struct intel_context *intel, break; default: _mesa_problem(ctx, "Bad renderbuffer format: %d\n", - irb->texformat); + irb->Base.Format); } } diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index 77ba8d5581..ff97e5a944 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -587,7 +587,7 @@ i915_state_draw_region(struct intel_context *intel, DSTORG_VERT_BIAS(0x8) | /* .5 */ LOD_PRECLAMP_OGL | TEX_DEFAULT_COLOR_OGL); if (irb != NULL) { - switch (irb->texformat) { + switch (irb->Base.Format) { case MESA_FORMAT_ARGB8888: case MESA_FORMAT_XRGB8888: value |= DV_PF_8888; @@ -603,7 +603,7 @@ i915_state_draw_region(struct intel_context *intel, break; default: _mesa_problem(ctx, "Bad renderbuffer format: %d\n", - irb->texformat); + irb->Base.Format); } } 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 47035cc6fc..b7b6eaec2b 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -537,7 +537,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw, region_bo = region->buffer; key.surface_type = BRW_SURFACE_2D; - switch (irb->texformat) { + switch (irb->Base.Format) { case MESA_FORMAT_ARGB8888: key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; break; @@ -554,7 +554,7 @@ brw_update_renderbuffer_surface(struct brw_context *brw, key.surface_format = BRW_SURFACEFORMAT_B4G4R4A4_UNORM; break; default: - _mesa_problem(ctx, "Bad renderbuffer format: %d\n", irb->texformat); + _mesa_problem(ctx, "Bad renderbuffer format: %d\n", irb->Base.Format); } key.tiling = region->tiling; if (brw->intel.intelScreen->driScrnPriv->dri2.enabled) { diff --git a/src/mesa/drivers/dri/intel/intel_blit.c b/src/mesa/drivers/dri/intel/intel_blit.c index 817223da41..9f638b0ef9 100644 --- a/src/mesa/drivers/dri/intel/intel_blit.c +++ b/src/mesa/drivers/dri/intel/intel_blit.c @@ -496,7 +496,7 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) CLAMPED_FLOAT_TO_UBYTE(clear[2], color[2]); CLAMPED_FLOAT_TO_UBYTE(clear[3], color[3]); - switch (irb->texformat) { + switch (irb->Base.Format) { case MESA_FORMAT_ARGB8888: case MESA_FORMAT_XRGB8888: clearVal = intel->ClearColor8888; @@ -514,7 +514,7 @@ intelClearWithBlit(GLcontext *ctx, GLbitfield mask) break; default: _mesa_problem(ctx, "Unexpected renderbuffer format: %d\n", - irb->texformat); + irb->Base.Format); clearVal = 0; } } diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 679fa2f82a..649fd1a78f 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -117,7 +117,6 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_RGB5: rb->Format = MESA_FORMAT_RGB565; rb->DataType = GL_UNSIGNED_BYTE; - irb->texformat = MESA_FORMAT_RGB565; cpp = 2; break; case GL_RGB: @@ -125,9 +124,8 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_RGB10: case GL_RGB12: case GL_RGB16: - rb->Format = MESA_FORMAT_ARGB8888; + rb->Format = MESA_FORMAT_ARGB8888; /* XXX: Need xrgb8888 */ rb->DataType = GL_UNSIGNED_BYTE; - irb->texformat = MESA_FORMAT_ARGB8888; /* XXX: Need xrgb8888 */ cpp = 4; break; case GL_RGBA: @@ -140,7 +138,6 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_RGBA16: rb->Format = MESA_FORMAT_ARGB8888; rb->DataType = GL_UNSIGNED_BYTE; - irb->texformat = MESA_FORMAT_ARGB8888; cpp = 4; break; case GL_STENCIL_INDEX: @@ -152,13 +149,11 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->Format = MESA_FORMAT_S8_Z24; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; cpp = 4; - irb->texformat = MESA_FORMAT_S8_Z24; break; case GL_DEPTH_COMPONENT16: rb->Format = MESA_FORMAT_Z16; rb->DataType = GL_UNSIGNED_SHORT; cpp = 2; - irb->texformat = MESA_FORMAT_Z16; break; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT24: @@ -166,14 +161,12 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, rb->Format = MESA_FORMAT_S8_Z24; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; cpp = 4; - irb->texformat = MESA_FORMAT_S8_Z24; break; case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: rb->Format = MESA_FORMAT_S8_Z24; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; cpp = 4; - irb->texformat = MESA_FORMAT_S8_Z24; break; default: _mesa_problem(ctx, @@ -347,7 +340,6 @@ intel_create_renderbuffer(gl_format format) irb->Base.Format = format; irb->Base.InternalFormat = irb->Base._BaseFormat; - irb->texformat = format; /* intel-specific methods */ irb->Base.Delete = intel_delete_renderbuffer; @@ -424,7 +416,6 @@ static GLboolean intel_update_wrapper(GLcontext *ctx, struct intel_renderbuffer *irb, struct gl_texture_image *texImage) { - irb->texformat = texImage->TexFormat; gl_format texFormat; if (texImage->TexFormat == MESA_FORMAT_ARGB8888) { @@ -640,7 +631,7 @@ intel_validate_framebuffer(GLcontext *ctx, struct gl_framebuffer *fb) continue; } - switch (irb->texformat) { + switch (irb->Base.Format) { case MESA_FORMAT_ARGB8888: case MESA_FORMAT_XRGB8888: case MESA_FORMAT_RGB565: diff --git a/src/mesa/drivers/dri/intel/intel_fbo.h b/src/mesa/drivers/dri/intel/intel_fbo.h index 50a8a95985..fa43077d6a 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.h +++ b/src/mesa/drivers/dri/intel/intel_fbo.h @@ -62,8 +62,6 @@ struct intel_renderbuffer struct gl_renderbuffer Base; struct intel_region *region; - gl_format texformat; - GLuint vbl_pending; /**< vblank sequence number of pending flip */ uint8_t *span_cache; diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 3607c7dded..f02fbe9875 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -624,7 +624,7 @@ intel_set_span_functions(struct intel_context *intel, tiling = I915_TILING_NONE; if (intel->intelScreen->kernel_exec_fencing) { - switch (irb->texformat) { + switch (irb->Base.Format) { case MESA_FORMAT_RGB565: intel_gttmap_InitPointers_RGB565(rb); break; @@ -667,13 +667,13 @@ intel_set_span_functions(struct intel_context *intel, default: _mesa_problem(NULL, "Unexpected MesaFormat %d in intelSetSpanFunctions", - irb->texformat); + irb->Base.Format); break; } return; } - switch (irb->texformat) { + switch (irb->Base.Format) { case MESA_FORMAT_RGB565: switch (tiling) { case I915_TILING_NONE: -- cgit v1.2.3 From 4eee46efcb7e1f737b7115caf48ddb3b77408626 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 8 Dec 2009 15:51:18 -0800 Subject: intel: softwareBuffer in intel_alloc_renderbuffer_storage was always false, remove --- src/mesa/drivers/dri/intel/intel_fbo.c | 37 ++++++++++++++-------------------- 1 file changed, 15 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 649fd1a78f..9a304b0351 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -106,8 +106,8 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, { struct intel_context *intel = intel_context(ctx); struct intel_renderbuffer *irb = intel_renderbuffer(rb); - GLboolean softwareBuffer = GL_FALSE; int cpp; + GLuint pitch; ASSERT(rb->Name != 0); @@ -184,32 +184,25 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, } /* allocate new memory region/renderbuffer */ - if (softwareBuffer) { - return _mesa_soft_renderbuffer_storage(ctx, rb, internalFormat, - width, height); - } - else { - /* Choose a pitch to match hardware requirements: - */ - GLuint pitch = ((cpp * width + 63) & ~63) / cpp; - /* alloc hardware renderbuffer */ - DBG("Allocating %d x %d Intel RBO (pitch %d)\n", width, - height, pitch); + /* Choose a pitch to match hardware requirements: + */ + pitch = ((cpp * width + 63) & ~63) / cpp; - irb->region = intel_region_alloc(intel, I915_TILING_NONE, - cpp, width, height, pitch, - GL_TRUE); - if (!irb->region) - return GL_FALSE; /* out of memory? */ + /* alloc hardware renderbuffer */ + DBG("Allocating %d x %d Intel RBO (pitch %d)\n", width, height, pitch); - ASSERT(irb->region->buffer); + irb->region = intel_region_alloc(intel, I915_TILING_NONE, cpp, + width, height, pitch, GL_TRUE); + if (!irb->region) + return GL_FALSE; /* out of memory? */ - rb->Width = width; - rb->Height = height; + ASSERT(irb->region->buffer); - return GL_TRUE; - } + rb->Width = width; + rb->Height = height; + + return GL_TRUE; } -- cgit v1.2.3 From 0f01674a584ea6df96acf91d7cd3b8a9b48ee65e Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 8 Dec 2009 16:06:13 -0800 Subject: intel: Use texformat accessor to get bytes-per-pixel --- src/mesa/drivers/dri/intel/intel_fbo.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 9a304b0351..5a67cb1388 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -117,7 +117,6 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_RGB5: rb->Format = MESA_FORMAT_RGB565; rb->DataType = GL_UNSIGNED_BYTE; - cpp = 2; break; case GL_RGB: case GL_RGB8: @@ -126,7 +125,6 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_RGB16: rb->Format = MESA_FORMAT_ARGB8888; /* XXX: Need xrgb8888 */ rb->DataType = GL_UNSIGNED_BYTE; - cpp = 4; break; case GL_RGBA: case GL_RGBA2: @@ -138,7 +136,6 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_RGBA16: rb->Format = MESA_FORMAT_ARGB8888; rb->DataType = GL_UNSIGNED_BYTE; - cpp = 4; break; case GL_STENCIL_INDEX: case GL_STENCIL_INDEX1_EXT: @@ -148,25 +145,21 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, /* alloc a depth+stencil buffer */ rb->Format = MESA_FORMAT_S8_Z24; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; - cpp = 4; break; case GL_DEPTH_COMPONENT16: rb->Format = MESA_FORMAT_Z16; rb->DataType = GL_UNSIGNED_SHORT; - cpp = 2; break; case GL_DEPTH_COMPONENT: case GL_DEPTH_COMPONENT24: case GL_DEPTH_COMPONENT32: rb->Format = MESA_FORMAT_S8_Z24; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; - cpp = 4; break; case GL_DEPTH_STENCIL_EXT: case GL_DEPTH24_STENCIL8_EXT: rb->Format = MESA_FORMAT_S8_Z24; rb->DataType = GL_UNSIGNED_INT_24_8_EXT; - cpp = 4; break; default: _mesa_problem(ctx, @@ -175,6 +168,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, } rb->_BaseFormat = _mesa_base_fbo_format(ctx, internalFormat); + cpp = _mesa_get_format_bytes(rb->Format); intelFlush(ctx); -- cgit v1.2.3 From 430876cd3a70d3b701d136b825518140888f96c8 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 8 Dec 2009 17:03:20 -0800 Subject: intel: name in intel_create_renderbuffer was always 0, remove --- src/mesa/drivers/dri/intel/intel_fbo.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 5a67cb1388..970ffb2e4d 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -278,7 +278,6 @@ intel_create_renderbuffer(gl_format format) GET_CURRENT_CONTEXT(ctx); struct intel_renderbuffer *irb; - const GLuint name = 0; irb = CALLOC_STRUCT(intel_renderbuffer); if (!irb) { @@ -286,7 +285,7 @@ intel_create_renderbuffer(gl_format format) return NULL; } - _mesa_init_renderbuffer(&irb->Base, name); + _mesa_init_renderbuffer(&irb->Base, 0); irb->Base.ClassID = INTEL_RB_CLASS; switch (format) { -- cgit v1.2.3 From ffc1f299e9eaa6eaa4b5586b9fb13132564bd3ae Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 8 Dec 2009 21:10:45 -0800 Subject: spantmp2: Add support for GL_BGR / GL_UNSIGNED_INT_8_8_8_8_REV This is really for MESA_FORMAT_XRGB8888. Clearly spantmp2.h needs some re-work. Any volunteers? --- src/mesa/drivers/dri/common/spantmp2.h | 57 ++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/common/spantmp2.h b/src/mesa/drivers/dri/common/spantmp2.h index 95f97414a9..447f3d15b9 100644 --- a/src/mesa/drivers/dri/common/spantmp2.h +++ b/src/mesa/drivers/dri/common/spantmp2.h @@ -356,6 +356,63 @@ } while (0) # endif +#elif (SPANTMP_PIXEL_FMT == GL_BGR) && (SPANTMP_PIXEL_TYPE == GL_UNSIGNED_INT_8_8_8_8_REV) + +/** + ** GL_BGR, GL_UNSIGNED_INT_8_8_8_8_REV + ** + ** This is really for MESA_FORMAT_XRGB8888. The spantmp code needs to be + ** kicked to the curb, and we need to just code-gen this. + **/ + +#ifndef GET_VALUE +#ifndef GET_PTR +#define GET_PTR(_x, _y) ( buf + (_x) * 4 + (_y) * pitch) +#endif + +#define GET_VALUE(_x, _y) *(volatile GLuint *)(GET_PTR(_x, _y)) +#define PUT_VALUE(_x, _y, _v) *(volatile GLuint *)(GET_PTR(_x, _y)) = (_v) +#endif /* GET_VALUE */ + +# define INIT_MONO_PIXEL(p, color) \ + p = PACK_COLOR_8888(0xff, color[0], color[1], color[2]) + +# define WRITE_RGBA(_x, _y, r, g, b, a) \ + PUT_VALUE(_x, _y, ((r << 16) | \ + (g << 8) | \ + (b << 0) | \ + (0xff << 24))) + +#define WRITE_PIXEL(_x, _y, p) PUT_VALUE(_x, _y, p) + +# if defined( USE_X86_ASM ) +# define READ_RGBA(rgba, _x, _y) \ + do { \ + GLuint p = GET_VALUE(_x, _y); \ + __asm__ __volatile__( "bswap %0; rorl $8, %0" \ + : "=r" (p) : "0" (p) ); \ + ((GLuint *)rgba)[0] = p | 0xff000000; \ + } while (0) +# elif defined( MESA_BIG_ENDIAN ) + /* On PowerPC with GCC 3.4.2 the shift madness below becomes a single + * rotlwi instruction. It also produces good code on SPARC. + */ +# define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLuint p = GET_VALUE(_x, _y); \ + *((uint32_t *) rgba) = (t << 8) | 0xff; \ + } while (0) +# else +# define READ_RGBA( rgba, _x, _y ) \ + do { \ + GLuint p = GET_VALUE(_x, _y); \ + rgba[0] = (p >> 16) & 0xff; \ + rgba[1] = (p >> 8) & 0xff; \ + rgba[2] = (p >> 0) & 0xff; \ + rgba[3] = 0xff; \ + } while (0) +# endif + #else #error SPANTMP_PIXEL_FMT must be set to a valid value! #endif -- cgit v1.2.3 From 4f2b2032f46939b6056f837a086e73f0417183fc Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 8 Dec 2009 21:12:18 -0800 Subject: intel: Use spantmp2 GL_BGR / GL_UNSIGNED_INT_8_8_8_8_REV for XRGB8888 --- src/mesa/drivers/dri/intel/intel_span.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index f02fbe9875..725ba5c97d 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -334,7 +334,7 @@ static uint32_t y_tile_swizzle(struct intel_renderbuffer *irb, #include "intel_spantmp.h" /* x8r8g8b8 color span and pixel functions */ -#define INTEL_PIXEL_FMT GL_BGRA +#define INTEL_PIXEL_FMT GL_BGR #define INTEL_PIXEL_TYPE GL_UNSIGNED_INT_8_8_8_8_REV #define INTEL_READ_VALUE(offset) pread_xrgb8888(irb, offset) #define INTEL_WRITE_VALUE(offset, v) pwrite_xrgb8888(irb, offset, v) -- cgit v1.2.3 From eadd9b8e16e3b1ad35fec54f780a0f94ac43988f Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 8 Dec 2009 21:13:05 -0800 Subject: i965: Fix handling of drawing to MESA_FORMAT_XRGB8888 It turns out that 965 and friends cannot actually render to an xRGB surfaces. Instead, the surface has to be RGBA with writes to alpha disabled and the blend function modified to always use 1.0 for destination alpha. --- src/mesa/drivers/dri/i965/brw_cc.c | 34 ++++++++++++++++++++++++ src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 17 +++++++++--- 2 files changed, 48 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i965/brw_cc.c b/src/mesa/drivers/dri/i965/brw_cc.c index d4ccd28c9e..ab301b9a3a 100644 --- a/src/mesa/drivers/dri/i965/brw_cc.c +++ b/src/mesa/drivers/dri/i965/brw_cc.c @@ -34,6 +34,7 @@ #include "brw_state.h" #include "brw_defines.h" #include "brw_util.h" +#include "intel_fbo.h" #include "main/macros.h" #include "main/enums.h" @@ -89,6 +90,28 @@ struct brw_cc_unit_key { GLenum depth_func; }; +/** + * Modify blend function to force destination alpha to 1.0 + * + * If \c function specifies a blend function that uses destination alpha, + * replace it with a function that hard-wires destination alpha to 1.0. This + * is used when rendering to xRGB targets. + */ +static GLenum +fix_xRGB_alpha(GLenum function) +{ + switch (function) { + case GL_DST_ALPHA: + return GL_ONE; + + case GL_ONE_MINUS_DST_ALPHA: + case GL_SRC_ALPHA_SATURATE: + return GL_ZERO; + } + + return function; +} + static void cc_unit_populate_key(struct brw_context *brw, struct brw_cc_unit_key *key) { @@ -132,6 +155,17 @@ cc_unit_populate_key(struct brw_context *brw, struct brw_cc_unit_key *key) key->blend_dst_rgb = ctx->Color.BlendDstRGB; key->blend_src_a = ctx->Color.BlendSrcA; key->blend_dst_a = ctx->Color.BlendDstA; + + /* If the renderbuffer is XRGB, we have to frob the blend function to + * force the destination alpha to 1.0. This means replacing GL_DST_ALPHA + * with GL_ONE and GL_ONE_MINUS_DST_ALPAH with GL_ZERO. + */ + if (ctx->Visual.alphaBits == 0) { + key->blend_src_rgb = fix_xRGB_alpha(key->blend_src_rgb); + key->blend_src_a = fix_xRGB_alpha(key->blend_src_a); + key->blend_dst_rgb = fix_xRGB_alpha(key->blend_dst_rgb); + key->blend_dst_a = fix_xRGB_alpha(key->blend_dst_a); + } } key->alpha_enabled = ctx->Color.AlphaEnabled; 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 b7b6eaec2b..74cf66f9f8 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -538,11 +538,15 @@ brw_update_renderbuffer_surface(struct brw_context *brw, key.surface_type = BRW_SURFACE_2D; switch (irb->Base.Format) { + /* XRGB and ARGB are treated the same here because the chips in this + * family cannot render to XRGB targets. This means that we have to + * mask writes to alpha (ala glColorMask) and reconfigure the alpha + * blending hardware to use GL_ONE (or GL_ZERO) for cases where + * GL_DST_ALPHA (or GL_ONE_MINUS_DST_ALPHA) is used. + */ case MESA_FORMAT_ARGB8888: - key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; - break; case MESA_FORMAT_XRGB8888: - key.surface_format = BRW_SURFACEFORMAT_B8G8R8X8_UNORM; + key.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; break; case MESA_FORMAT_RGB565: key.surface_format = BRW_SURFACEFORMAT_B5G6R5_UNORM; @@ -579,6 +583,13 @@ brw_update_renderbuffer_surface(struct brw_context *brw, /* _NEW_COLOR */ memcpy(key.color_mask, ctx->Color.ColorMask, sizeof(key.color_mask)); + + /* As mentioned above, disable writes to the alpha component when the + * renderbuffer is XRGB. + */ + if (ctx->Visual.alphaBits == 0) + key.color_mask[3] = GL_FALSE; + key.color_blend = (!ctx->Color._LogicOpEnabled && ctx->Color.BlendEnabled); -- cgit v1.2.3 From cbdeb33209e782f011984a4b93cc0d36f567462e Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 8 Dec 2009 21:15:36 -0800 Subject: intel: Make RGB renderbuffers use XRGB8888 like we do for RGB system buffers. --- src/mesa/drivers/dri/intel/intel_fbo.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c index 970ffb2e4d..608f75b824 100644 --- a/src/mesa/drivers/dri/intel/intel_fbo.c +++ b/src/mesa/drivers/dri/intel/intel_fbo.c @@ -123,7 +123,7 @@ intel_alloc_renderbuffer_storage(GLcontext * ctx, struct gl_renderbuffer *rb, case GL_RGB10: case GL_RGB12: case GL_RGB16: - rb->Format = MESA_FORMAT_ARGB8888; /* XXX: Need xrgb8888 */ + rb->Format = MESA_FORMAT_XRGB8888; rb->DataType = GL_UNSIGNED_BYTE; break; case GL_RGBA: @@ -294,10 +294,6 @@ intel_create_renderbuffer(gl_format format) irb->Base.DataType = GL_UNSIGNED_BYTE; break; case MESA_FORMAT_XRGB8888: - /* XXX this is a hack since XRGB surfaces don't seem to work - * properly yet. Reading the alpha channel returns 0 instead of 1. - */ - format = MESA_FORMAT_ARGB8888; irb->Base._BaseFormat = GL_RGB; irb->Base.DataType = GL_UNSIGNED_BYTE; break; -- cgit v1.2.3 From b4a6169412819cc3a027c6a118f0537911145a30 Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 8 Dec 2009 23:24:58 -0800 Subject: intel: Make RGB textures use XRGB8888 --- src/mesa/drivers/dri/intel/intel_tex_format.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/intel/intel_tex_format.c b/src/mesa/drivers/dri/intel/intel_tex_format.c index bfa3dba1f5..87efb72cc5 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_format.c +++ b/src/mesa/drivers/dri/intel/intel_tex_format.c @@ -50,8 +50,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, if (format == GL_RGB && type == GL_UNSIGNED_SHORT_5_6_5) { return MESA_FORMAT_RGB565; } - /* XXX use MESA_FORMAT_XRGB8888 someday */ - return do32bpt ? MESA_FORMAT_ARGB8888 : MESA_FORMAT_RGB565; + return do32bpt ? MESA_FORMAT_XRGB8888 : MESA_FORMAT_RGB565; case GL_RGBA8: case GL_RGB10_A2: @@ -70,8 +69,7 @@ intelChooseTextureFormat(GLcontext * ctx, GLint internalFormat, case GL_RGB10: case GL_RGB12: case GL_RGB16: - /* XXX use MESA_FORMAT_XRGB8888 someday */ - return MESA_FORMAT_ARGB8888; + return MESA_FORMAT_XRGB8888; case GL_RGB5: case GL_RGB4: -- cgit v1.2.3 From e624b77eb2d594cde053c73a530836e05227126a Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Tue, 8 Dec 2009 23:25:26 -0800 Subject: intel: Remove ARGB internal_format == GL_RGB hacks Now that XRGB is supported, we don't need to hack around cases of an RGBA format buffer with an internal format of GL_RGB. --- src/mesa/drivers/dri/i915/i830_texstate.c | 5 +-- src/mesa/drivers/dri/i915/i915_texstate.c | 5 +-- src/mesa/drivers/dri/i965/brw_wm_surface_state.c | 10 +---- src/mesa/drivers/dri/intel/intel_span.c | 49 +++++++----------------- 4 files changed, 17 insertions(+), 52 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i830_texstate.c b/src/mesa/drivers/dri/i915/i830_texstate.c index f4bbb53b86..ce409b3a60 100644 --- a/src/mesa/drivers/dri/i915/i830_texstate.c +++ b/src/mesa/drivers/dri/i915/i830_texstate.c @@ -55,10 +55,7 @@ translate_texture_format(GLuint mesa_format, GLuint internal_format) case MESA_FORMAT_ARGB4444: return MAPSURF_16BIT | MT_16BIT_ARGB4444; case MESA_FORMAT_ARGB8888: - if (internal_format == GL_RGB) - return MAPSURF_32BIT | MT_32BIT_XRGB8888; - else - return MAPSURF_32BIT | MT_32BIT_ARGB8888; + return MAPSURF_32BIT | MT_32BIT_ARGB8888; case MESA_FORMAT_XRGB8888: return MAPSURF_32BIT | MT_32BIT_XRGB8888; case MESA_FORMAT_YCBCR_REV: diff --git a/src/mesa/drivers/dri/i915/i915_texstate.c b/src/mesa/drivers/dri/i915/i915_texstate.c index d6689af53f..f52ff2bcc4 100644 --- a/src/mesa/drivers/dri/i915/i915_texstate.c +++ b/src/mesa/drivers/dri/i915/i915_texstate.c @@ -56,10 +56,7 @@ translate_texture_format(gl_format mesa_format, GLuint internal_format, case MESA_FORMAT_ARGB4444: return MAPSURF_16BIT | MT_16BIT_ARGB4444; case MESA_FORMAT_ARGB8888: - if (internal_format == GL_RGB) - return MAPSURF_32BIT | MT_32BIT_XRGB8888; - else - return MAPSURF_32BIT | MT_32BIT_ARGB8888; + return MAPSURF_32BIT | MT_32BIT_ARGB8888; case MESA_FORMAT_XRGB8888: return MAPSURF_32BIT | MT_32BIT_XRGB8888; case MESA_FORMAT_YCBCR_REV: 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 74cf66f9f8..3f9b1fbfdc 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c @@ -94,20 +94,14 @@ static GLuint translate_tex_format( gl_format mesa_format, return BRW_SURFACEFORMAT_R8G8B8_UNORM; case MESA_FORMAT_ARGB8888: - if (internal_format == GL_RGB) - return BRW_SURFACEFORMAT_B8G8R8X8_UNORM; - else - return BRW_SURFACEFORMAT_B8G8R8A8_UNORM; + return BRW_SURFACEFORMAT_B8G8R8A8_UNORM; case MESA_FORMAT_XRGB8888: return BRW_SURFACEFORMAT_B8G8R8X8_UNORM; case MESA_FORMAT_RGBA8888_REV: _mesa_problem(NULL, "unexpected format in i965:translate_tex_format()"); - if (internal_format == GL_RGB) - return BRW_SURFACEFORMAT_R8G8B8X8_UNORM; - else - return BRW_SURFACEFORMAT_R8G8B8A8_UNORM; + return BRW_SURFACEFORMAT_R8G8B8A8_UNORM; case MESA_FORMAT_RGB565: return BRW_SURFACEFORMAT_B5G6R5_UNORM; diff --git a/src/mesa/drivers/dri/intel/intel_span.c b/src/mesa/drivers/dri/intel/intel_span.c index 725ba5c97d..34c3d9df74 100644 --- a/src/mesa/drivers/dri/intel/intel_span.c +++ b/src/mesa/drivers/dri/intel/intel_span.c @@ -638,13 +638,7 @@ intel_set_span_functions(struct intel_context *intel, intel_gttmap_InitPointers_xRGB8888(rb); break; case MESA_FORMAT_ARGB8888: - if (rb->_BaseFormat == GL_RGB) { - /* XXX remove this code someday when we enable XRGB surfaces */ - /* 8888 RGBx */ - intel_gttmap_InitPointers_xRGB8888(rb); - } else { - intel_gttmap_InitPointers_ARGB8888(rb); - } + intel_gttmap_InitPointers_ARGB8888(rb); break; case MESA_FORMAT_Z16: intel_gttmap_InitDepthPointers_z16(rb); @@ -731,35 +725,18 @@ intel_set_span_functions(struct intel_context *intel, } break; case MESA_FORMAT_ARGB8888: - if (rb->_BaseFormat == GL_RGB) { - /* XXX remove this code someday when we enable XRGB surfaces */ - /* 8888 RGBx */ - switch (tiling) { - case I915_TILING_NONE: - default: - intelInitPointers_xRGB8888(rb); - break; - case I915_TILING_X: - intel_XTile_InitPointers_xRGB8888(rb); - break; - case I915_TILING_Y: - intel_YTile_InitPointers_xRGB8888(rb); - break; - } - } else { - /* 8888 RGBA */ - switch (tiling) { - case I915_TILING_NONE: - default: - intelInitPointers_ARGB8888(rb); - break; - case I915_TILING_X: - intel_XTile_InitPointers_ARGB8888(rb); - break; - case I915_TILING_Y: - intel_YTile_InitPointers_ARGB8888(rb); - break; - } + /* 8888 RGBA */ + switch (tiling) { + case I915_TILING_NONE: + default: + intelInitPointers_ARGB8888(rb); + break; + case I915_TILING_X: + intel_XTile_InitPointers_ARGB8888(rb); + break; + case I915_TILING_Y: + intel_YTile_InitPointers_ARGB8888(rb); + break; } break; case MESA_FORMAT_Z16: -- cgit v1.2.3 From d38ffed5236adf3ee83c0bc5bdee0233ce566e01 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 10 Dec 2009 17:50:35 -0800 Subject: glsl: Increase size of array in_slang_lookup_constant from 4 to 16. For some cases, _mesa_GetIntegerv reads up to params[15]. --- src/mesa/shader/slang/slang_simplify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/slang/slang_simplify.c b/src/mesa/shader/slang/slang_simplify.c index 539c6ff0d1..13b9ca3c87 100644 --- a/src/mesa/shader/slang/slang_simplify.c +++ b/src/mesa/shader/slang/slang_simplify.c @@ -84,7 +84,7 @@ _slang_lookup_constant(const char *name) for (i = 0; info[i].Name; i++) { if (strcmp(info[i].Name, name) == 0) { /* found */ - GLint values[4]; + GLint values[16]; values[0] = -1; _mesa_GetIntegerv(info[i].Token, values); ASSERT(values[0] >= 0); /* sanity check that glGetFloatv worked */ -- cgit v1.2.3 From cb1dcb55f9884431a5e2b90e9208b42558a95611 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 10 Dec 2009 18:21:59 -0800 Subject: i915: Add missing break statement in i915_debug_packet. --- src/mesa/drivers/dri/i915/i915_debug.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/mesa/drivers/dri/i915/i915_debug.c b/src/mesa/drivers/dri/i915/i915_debug.c index f7bb7ea44c..fecfac3033 100644 --- a/src/mesa/drivers/dri/i915/i915_debug.c +++ b/src/mesa/drivers/dri/i915/i915_debug.c @@ -806,6 +806,7 @@ static GLboolean i915_debug_packet( struct debug_stream *stream ) default: return debug(stream, "", 0); } + break; default: assert(0); return 0; -- cgit v1.2.3 From e31df54754e2305b7cc7072053bf5a4e0b477fd6 Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 10 Dec 2009 18:32:33 -0800 Subject: mesa: Assign _mesa_lookup_parameter_index return value to GLint. --- src/mesa/shader/prog_parameter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/prog_parameter.c b/src/mesa/shader/prog_parameter.c index 2f029b02e5..f22492e029 100644 --- a/src/mesa/shader/prog_parameter.c +++ b/src/mesa/shader/prog_parameter.c @@ -500,7 +500,7 @@ GLfloat * _mesa_lookup_parameter_value(const struct gl_program_parameter_list *paramList, GLsizei nameLen, const char *name) { - GLuint i = _mesa_lookup_parameter_index(paramList, nameLen, name); + GLint i = _mesa_lookup_parameter_index(paramList, nameLen, name); if (i < 0) return NULL; else -- cgit v1.2.3 From 94fba49be97008565c0225bc46894bfd9453bb5e Mon Sep 17 00:00:00 2001 From: Vinson Lee Date: Thu, 10 Dec 2009 18:51:51 -0800 Subject: mesa: Initialize variable in MatchInstruction. --- src/mesa/shader/nvfragparse.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/shader/nvfragparse.c b/src/mesa/shader/nvfragparse.c index 0fd55524ab..b739a6aa07 100644 --- a/src/mesa/shader/nvfragparse.c +++ b/src/mesa/shader/nvfragparse.c @@ -217,6 +217,12 @@ MatchInstruction(const GLubyte *token) const struct instruction_pattern *inst; struct instruction_pattern result; + result.name = NULL; + result.opcode = MAX_OPCODE; /* i.e. invalid instruction */ + result.inputs = 0; + result.outputs = 0; + result.suffixes = 0; + for (inst = Instructions; inst->name; inst++) { if (_mesa_strncmp((const char *) token, inst->name, 3) == 0) { /* matched! */ @@ -247,7 +253,7 @@ MatchInstruction(const GLubyte *token) return result; } } - result.opcode = MAX_OPCODE; /* i.e. invalid instruction */ + return result; } -- cgit v1.2.3 From 770323e33e62169827454af74e9f90f09997f962 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 11 Dec 2009 12:09:02 +0000 Subject: svga: Fix mixed signed comparisons. --- src/gallium/drivers/svga/svga_screen_texture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_screen_texture.c b/src/gallium/drivers/svga/svga_screen_texture.c index e7301aba84..ed83ba48f0 100644 --- a/src/gallium/drivers/svga/svga_screen_texture.c +++ b/src/gallium/drivers/svga/svga_screen_texture.c @@ -528,7 +528,7 @@ svga_texture_view_surface(struct pipe_context *pipe, { struct svga_screen *ss = svga_screen(tex->base.screen); struct svga_winsys_surface *handle; - int i, j; + uint32_t i, j; unsigned z_offset = 0; SVGA_DBG(DEBUG_PERF, -- cgit v1.2.3 From 16876b8328059446b6fa0951f7848e5d500244ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 11 Dec 2009 12:29:02 +0000 Subject: svga: Keep tight control of texture handle ownership. The texture owns the surface handle. All derivatives need to keep a reference to texture. This fixes several assertions failures starting up Jedi Knight 2. Should cause no change for DRM surface sharing -- reference count still done as before there. --- src/gallium/drivers/svga/svga_screen_texture.c | 35 ++++++++++++++------------ src/gallium/drivers/svga/svga_screen_texture.h | 9 ++++++- 2 files changed, 27 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_screen_texture.c b/src/gallium/drivers/svga/svga_screen_texture.c index ed83ba48f0..1eb03db280 100644 --- a/src/gallium/drivers/svga/svga_screen_texture.c +++ b/src/gallium/drivers/svga/svga_screen_texture.c @@ -657,13 +657,11 @@ svga_get_tex_surface(struct pipe_screen *screen, s->real_level = 0; s->real_zslice = 0; } else { - struct svga_winsys_screen *sws = svga_winsys_screen(screen); - SVGA_DBG(DEBUG_VIEWS, "svga: Surface view: no %p, level %u, face %u, z %u, %p\n", pt, level, face, zslice, s); memset(&s->key, 0, sizeof s->key); - sws->surface_reference(sws, &s->handle, tex->handle); + s->handle = tex->handle; s->real_face = face; s->real_level = level; s->real_zslice = zslice; @@ -677,11 +675,14 @@ static void svga_tex_surface_destroy(struct pipe_surface *surf) { struct svga_surface *s = svga_surface(surf); + struct svga_texture *t = svga_texture(surf->texture); struct svga_screen *ss = svga_screen(surf->texture->screen); - SVGA_DBG(DEBUG_DMA, "unref sid %p (tex surface)\n", s->handle); - assert(s->key.cachable == 0); - svga_screen_surface_destroy(ss, &s->key, &s->handle); + if(s->handle != t->handle) { + SVGA_DBG(DEBUG_DMA, "unref sid %p (tex surface)\n", s->handle); + svga_screen_surface_destroy(ss, &s->key, &s->handle); + } + pipe_texture_reference(&surf->texture, NULL); FREE(surf); } @@ -910,7 +911,6 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt, unsigned min_lod, unsigned max_lod) { struct svga_screen *ss = svga_screen(pt->screen); - struct svga_winsys_screen *sws = ss->sws; struct svga_texture *tex = svga_texture(pt); struct svga_sampler_view *sv = NULL; SVGA3dSurfaceFormat format = svga_translate_format(pt->format); @@ -961,7 +961,7 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt, sv = CALLOC_STRUCT(svga_sampler_view); pipe_reference_init(&sv->reference, 1); - sv->texture = tex; + pipe_texture_reference(&sv->texture, pt); sv->min_lod = min_lod; sv->max_lod = max_lod; @@ -976,7 +976,7 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt, pt->depth[0], pt->last_level); sv->key.cachable = 0; - sws->surface_reference(sws, &sv->handle, tex->handle); + sv->handle = tex->handle; return sv; } @@ -999,7 +999,7 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt, if (!sv->handle) { assert(0); sv->key.cachable = 0; - sws->surface_reference(sws, &sv->handle, tex->handle); + sv->handle = tex->handle; return sv; } @@ -1013,14 +1013,14 @@ svga_get_tex_sampler_view(struct pipe_context *pipe, struct pipe_texture *pt, void svga_validate_sampler_view(struct svga_context *svga, struct svga_sampler_view *v) { - struct svga_texture *tex = v->texture; + struct svga_texture *tex = svga_texture(v->texture); unsigned numFaces; unsigned age = 0; int i, k; assert(svga); - if (v->handle == v->texture->handle) + if (v->handle == tex->handle) return; age = tex->age; @@ -1048,11 +1048,14 @@ svga_validate_sampler_view(struct svga_context *svga, struct svga_sampler_view * void svga_destroy_sampler_view_priv(struct svga_sampler_view *v) { - struct svga_screen *ss = svga_screen(v->texture->base.screen); - - SVGA_DBG(DEBUG_DMA, "unref sid %p (sampler view)\n", v->handle); - svga_screen_surface_destroy(ss, &v->key, &v->handle); + struct svga_texture *tex = svga_texture(v->texture); + if(v->handle != tex->handle) { + struct svga_screen *ss = svga_screen(v->texture->screen); + SVGA_DBG(DEBUG_DMA, "unref sid %p (sampler view)\n", v->handle); + svga_screen_surface_destroy(ss, &v->key, &v->handle); + } + pipe_texture_reference(&v->texture, NULL); FREE(v); } diff --git a/src/gallium/drivers/svga/svga_screen_texture.h b/src/gallium/drivers/svga/svga_screen_texture.h index 1cc4063e65..8cfdfea693 100644 --- a/src/gallium/drivers/svga/svga_screen_texture.h +++ b/src/gallium/drivers/svga/svga_screen_texture.h @@ -61,7 +61,7 @@ struct svga_sampler_view { struct pipe_reference reference; - struct svga_texture *texture; + struct pipe_texture *texture; int min_lod; int max_lod; @@ -94,6 +94,13 @@ struct svga_texture * operation. */ struct svga_host_surface_cache_key key; + + /** + * Handle for the host side surface. + * + * This handle is owned by this texture. Views should hold on to a reference + * to this texture and never destroy this handle directly. + */ struct svga_winsys_surface *handle; }; -- cgit v1.2.3 From 8469baf41bd4775eab2403ecf08ed013343943a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 11 Dec 2009 13:15:12 +0000 Subject: svga: Always pass SVGA3D_SURFACE_HINT_DYNAMIC. Since we're reusing buffers we're effectively transforming all of them into dynamic buffers. It would be nice to not cache long lived static buffers. But there is no way to detect the long lived from short lived ones yet. A good heuristic would be buffer size. --- src/gallium/drivers/svga/svga_screen_cache.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_screen_cache.c b/src/gallium/drivers/svga/svga_screen_cache.c index 8a06383f61..eff36e0bcc 100644 --- a/src/gallium/drivers/svga/svga_screen_cache.c +++ b/src/gallium/drivers/svga/svga_screen_cache.c @@ -277,6 +277,15 @@ svga_screen_surface_create(struct svga_screen *svgascreen, while(size < key->size.width) size <<= 1; key->size.width = size; + /* Since we're reusing buffers we're effectively transforming all + * of them into dynamic buffers. + * + * It would be nice to not cache long lived static buffers. But there + * is no way to detect the long lived from short lived ones yet. A + * good heuristic would be buffer size. + */ + key->flags &= ~SVGA3D_SURFACE_HINT_STATIC; + key->flags |= SVGA3D_SURFACE_HINT_DYNAMIC; } handle = svga_screen_cache_lookup(svgascreen, key); -- cgit v1.2.3 From ffae1f938d61165fce620bfd76ea7ae74dc63289 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Fri, 11 Dec 2009 14:14:03 +0000 Subject: svga: Add a missing dependency from the prescale state. Thanks for Keith to finding this. Fixes Jedi Knight 2 menus. --- src/gallium/drivers/svga/svga_state_constants.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/gallium/drivers/svga/svga_state_constants.c b/src/gallium/drivers/svga/svga_state_constants.c index 18cce7dde1..a5777d4fbd 100644 --- a/src/gallium/drivers/svga/svga_state_constants.c +++ b/src/gallium/drivers/svga/svga_state_constants.c @@ -231,7 +231,8 @@ static int emit_vs_consts( struct svga_context *svga, struct svga_tracked_state svga_hw_vs_parameters = { "hw vs params", - (SVGA_NEW_VS_CONST_BUFFER | + (SVGA_NEW_PRESCALE | + SVGA_NEW_VS_CONST_BUFFER | SVGA_NEW_ZERO_STRIDE | SVGA_NEW_VS_RESULT), emit_vs_consts -- cgit v1.2.3 From f7f1211b9b0a8fa0e5f5427b74b4eee4dabf65af Mon Sep 17 00:00:00 2001 From: Aurelien Jarno Date: Fri, 11 Dec 2009 08:46:54 -0700 Subject: sparc: additional preprocessor test for SPARC 64-bit --- src/mesa/sparc/xform.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/sparc/xform.S b/src/mesa/sparc/xform.S index f2b9674bf2..2a7cce41e5 100644 --- a/src/mesa/sparc/xform.S +++ b/src/mesa/sparc/xform.S @@ -17,7 +17,7 @@ #include "sparc_matrix.h" -#if defined(SVR4) || defined(__SVR4) || defined(__svr4__) +#if defined(SVR4) || defined(__SVR4) || defined(__svr4__) || defined(__arch64__) /* Solaris requires this for 64-bit. */ .register %g2, #scratch .register %g3, #scratch -- cgit v1.2.3 From 5076a4f53a2f34cc9116b45951037f639885c7a1 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 11 Dec 2009 09:16:25 -0700 Subject: mesa: check dst reg in _mesa_find_free_register() If a register was only being used as a destination (as will happen when generated condition-codes) we missed its use. So we'd errantly return a register index that was really in-use, not free. Fixes bug 25579. --- src/mesa/shader/program.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/program.c b/src/mesa/shader/program.c index 2cd6eb8a38..18d4ef9759 100644 --- a/src/mesa/shader/program.c +++ b/src/mesa/shader/program.c @@ -813,9 +813,17 @@ _mesa_find_free_register(const struct gl_program *prog, GLuint regFile) const struct prog_instruction *inst = prog->Instructions + i; const GLuint n = _mesa_num_inst_src_regs(inst->Opcode); - for (k = 0; k < n; k++) { - if (inst->SrcReg[k].File == regFile) { - used[inst->SrcReg[k].Index] = GL_TRUE; + /* check dst reg first */ + if (inst->DstReg.File == regFile) { + used[inst->DstReg.Index] = GL_TRUE; + } + else { + /* check src regs otherwise */ + for (k = 0; k < n; k++) { + if (inst->SrcReg[k].File == regFile) { + used[inst->SrcReg[k].Index] = GL_TRUE; + break; + } } } } -- cgit v1.2.3 From d8f8eca9efaf2f537cf9218e4dd1d742e19ffc76 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 11 Dec 2009 09:40:33 -0700 Subject: mesa: remove unnecessary loop in _mesa_remove_output_reads() --- src/mesa/shader/programopt.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/shader/programopt.c b/src/mesa/shader/programopt.c index f70c75cec8..c5b821d94f 100644 --- a/src/mesa/shader/programopt.c +++ b/src/mesa/shader/programopt.c @@ -528,15 +528,11 @@ _mesa_remove_output_reads(struct gl_program *prog, gl_register_file type) /* look for instructions which write to the varying vars identified above */ for (i = 0; i < prog->NumInstructions; i++) { struct prog_instruction *inst = prog->Instructions + i; - const GLuint numSrc = _mesa_num_inst_src_regs(inst->Opcode); - GLuint j; - for (j = 0; j < numSrc; j++) { - if (inst->DstReg.File == type && - outputMap[inst->DstReg.Index] >= 0) { - /* change inst to write to the temp reg, instead of the varying */ - inst->DstReg.File = PROGRAM_TEMPORARY; - inst->DstReg.Index = outputMap[inst->DstReg.Index]; - } + if (inst->DstReg.File == type && + outputMap[inst->DstReg.Index] >= 0) { + /* change inst to write to the temp reg, instead of the varying */ + inst->DstReg.File = PROGRAM_TEMPORARY; + inst->DstReg.Index = outputMap[inst->DstReg.Index]; } } -- cgit v1.2.3 From e24a8de8ba3b0765852dbcc170f770572bd042ac Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 16 Nov 2009 12:43:32 -0700 Subject: mesa: updated comment --- src/mesa/main/dd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 27ed921761..fdcaf05bac 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -182,7 +182,7 @@ struct dd_function_table { * * This is called by the \c _mesa_store_tex[sub]image[123]d() fallback * functions. The driver should examine \p internalFormat and return a - * pointer to an appropriate gl_texture_format. + * gl_format value. */ GLuint (*ChooseTextureFormat)( GLcontext *ctx, GLint internalFormat, GLenum srcFormat, GLenum srcType ); -- cgit v1.2.3 From 56dce15dcc7b0a869813ef97a0e68b166bac244f Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 16 Nov 2009 12:50:54 -0700 Subject: mesa: remove unused ctx->Driver.ActiveTexture() hook --- src/mesa/drivers/common/driverfuncs.c | 1 - src/mesa/drivers/dri/mach64/mach64_tex.c | 1 - src/mesa/main/dd.h | 5 ----- 3 files changed, 7 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index 4ca0e7bcc3..9b271f85e9 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -124,7 +124,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver) driver->UnmapTexture = NULL; driver->TextureMemCpy = _mesa_memcpy; driver->IsTextureResident = NULL; - driver->ActiveTexture = NULL; driver->UpdateTexturePalette = NULL; /* imaging */ diff --git a/src/mesa/drivers/dri/mach64/mach64_tex.c b/src/mesa/drivers/dri/mach64/mach64_tex.c index a757362b11..72917ee13b 100644 --- a/src/mesa/drivers/dri/mach64/mach64_tex.c +++ b/src/mesa/drivers/dri/mach64/mach64_tex.c @@ -565,7 +565,6 @@ void mach64InitTextureFuncs( struct dd_function_table *functions ) functions->IsTextureResident = driIsTextureResident; functions->UpdateTexturePalette = NULL; - functions->ActiveTexture = NULL; driInitTextureFormats(); } diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index fdcaf05bac..9a5145cd46 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -537,11 +537,6 @@ struct dd_function_table { GLboolean (*IsTextureResident)( GLcontext *ctx, struct gl_texture_object *t ); - /** - * Called by glActiveTextureARB() to set current texture unit. - */ - void (*ActiveTexture)( GLcontext *ctx, GLuint texUnitNumber ); - /** * Called when the texture's color lookup table is changed. * -- cgit v1.2.3 From 9c01cf425fac3853c65bd732270a015106766865 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Mon, 16 Nov 2009 12:54:39 -0700 Subject: mesa: minor reformatting/rewrapping in dd.h --- src/mesa/main/dd.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 9a5145cd46..6dadf5c079 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -761,13 +761,13 @@ struct dd_function_table { /* May return NULL if MESA_MAP_NOWAIT_BIT is set in access: */ - void * (*MapBufferRange)( GLcontext *ctx, GLenum target, - GLintptr offset, GLsizeiptr length, GLbitfield access, + void * (*MapBufferRange)( GLcontext *ctx, GLenum target, GLintptr offset, + GLsizeiptr length, GLbitfield access, struct gl_buffer_object *obj); - void (*FlushMappedBufferRange) (GLcontext *ctx, GLenum target, - GLintptr offset, GLsizeiptr length, - struct gl_buffer_object *obj); + void (*FlushMappedBufferRange)(GLcontext *ctx, GLenum target, + GLintptr offset, GLsizeiptr length, + struct gl_buffer_object *obj); GLboolean (*UnmapBuffer)( GLcontext *ctx, GLenum target, struct gl_buffer_object *obj ); @@ -782,7 +782,8 @@ struct dd_function_table { struct gl_framebuffer * (*NewFramebuffer)(GLcontext *ctx, GLuint name); struct gl_renderbuffer * (*NewRenderbuffer)(GLcontext *ctx, GLuint name); void (*BindFramebuffer)(GLcontext *ctx, GLenum target, - struct gl_framebuffer *fb, struct gl_framebuffer *fbread); + struct gl_framebuffer *drawFb, + struct gl_framebuffer *readFb); void (*FramebufferRenderbuffer)(GLcontext *ctx, struct gl_framebuffer *fb, GLenum attachment, -- cgit v1.2.3 From 4430a05a3a65c411996a923d1051bb7879204a53 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 11 Dec 2009 16:50:25 -0700 Subject: gallium: added comment for pipe_reference() return value --- src/gallium/include/pipe/p_refcnt.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/gallium/include/pipe/p_refcnt.h b/src/gallium/include/pipe/p_refcnt.h index e252f55900..c1c7415e02 100644 --- a/src/gallium/include/pipe/p_refcnt.h +++ b/src/gallium/include/pipe/p_refcnt.h @@ -62,6 +62,7 @@ pipe_is_referenced(struct pipe_reference *reference) * Update reference counting. * The old thing pointed to, if any, will be unreferenced. * Both 'ptr' and 'reference' may be NULL. + * \return TRUE if the object's refcount hits zero and should be destroyed. */ static INLINE boolean pipe_reference(struct pipe_reference *ptr, struct pipe_reference *reference) -- cgit v1.2.3 From da73c1ed41c6d2867cca34ca1d481537ec3cb077 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 12 Dec 2009 00:00:34 +0100 Subject: r300: minor texture code refactoring --- src/mesa/drivers/dri/r300/r300_texstate.c | 191 ++++++++++++++++++------------ 1 file changed, 112 insertions(+), 79 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 9eaf390b46..d80284e1b9 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -51,14 +51,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_tex.h" #include "r300_reg.h" -#define VALID_FORMAT(f) ( ((f) <= MESA_FORMAT_RGBA_DXT5 \ - || ((f) >= MESA_FORMAT_RGBA_FLOAT32 && \ - (f) <= MESA_FORMAT_INTENSITY_FLOAT16)) \ - && tx_table[f].flag ) - -#define _ASSIGN(entry, format) \ - [ MESA_FORMAT_ ## entry ] = { format, 0, 1} - /* * Note that the _REV formats are the same as the non-REV formats. This is * because the REV and non-REV formats are identical as a byte string, but @@ -68,67 +60,121 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * identically. -- paulus */ -static const struct tx_table { - GLuint format, filter, flag; -} tx_table[] = { - /* *INDENT-OFF* */ +static uint32_t translateTexFormat(gl_format mesaFormat) +{ + switch (mesaFormat) + { #ifdef MESA_LITTLE_ENDIAN - _ASSIGN(RGBA8888, R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8)), - _ASSIGN(RGBA8888_REV, R300_EASY_TX_FORMAT(Z, Y, X, W, W8Z8Y8X8)), - _ASSIGN(ARGB8888, R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8)), - _ASSIGN(ARGB8888_REV, R300_EASY_TX_FORMAT(W, Z, Y, X, W8Z8Y8X8)), + case MESA_FORMAT_RGBA8888: + return R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8); + case MESA_FORMAT_RGBA8888_REV: + return R300_EASY_TX_FORMAT(Z, Y, X, W, W8Z8Y8X8); + case MESA_FORMAT_ARGB8888: + return R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8); + case MESA_FORMAT_ARGB8888_REV: + return R300_EASY_TX_FORMAT(W, Z, Y, X, W8Z8Y8X8); #else - _ASSIGN(RGBA8888, R300_EASY_TX_FORMAT(Z, Y, X, W, W8Z8Y8X8)), - _ASSIGN(RGBA8888_REV, R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8)), - _ASSIGN(ARGB8888, R300_EASY_TX_FORMAT(W, Z, Y, X, W8Z8Y8X8)), - _ASSIGN(ARGB8888_REV, R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8)), + case MESA_FORMAT_RGBA8888: + return R300_EASY_TX_FORMAT(Z, Y, X, W, W8Z8Y8X8); + case MESA_FORMAT_RGBA8888_REV: + return R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8); + case MESA_FORMAT_ARGB8888: + return R300_EASY_TX_FORMAT(W, Z, Y, X, W8Z8Y8X8); + case MESA_FORMAT_ARGB8888_REV: + return R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8); #endif - _ASSIGN(XRGB8888, R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8)), - _ASSIGN(RGB888, R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8)), - _ASSIGN(RGB565, R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5)), - _ASSIGN(RGB565_REV, R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5)), - _ASSIGN(ARGB4444, R300_EASY_TX_FORMAT(X, Y, Z, W, W4Z4Y4X4)), - _ASSIGN(ARGB4444_REV, R300_EASY_TX_FORMAT(X, Y, Z, W, W4Z4Y4X4)), - _ASSIGN(ARGB1555, R300_EASY_TX_FORMAT(X, Y, Z, W, W1Z5Y5X5)), - _ASSIGN(ARGB1555_REV, R300_EASY_TX_FORMAT(X, Y, Z, W, W1Z5Y5X5)), - _ASSIGN(AL88, R300_EASY_TX_FORMAT(X, X, X, Y, Y8X8)), - _ASSIGN(AL88_REV, R300_EASY_TX_FORMAT(X, X, X, Y, Y8X8)), - _ASSIGN(RGB332, R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z3Y3X2)), - _ASSIGN(A8, R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, X8)), - _ASSIGN(L8, R300_EASY_TX_FORMAT(X, X, X, ONE, X8)), - _ASSIGN(I8, R300_EASY_TX_FORMAT(X, X, X, X, X8)), - _ASSIGN(CI8, R300_EASY_TX_FORMAT(X, X, X, X, X8)), - _ASSIGN(YCBCR, R300_EASY_TX_FORMAT(X, Y, Z, ONE, G8R8_G8B8) | R300_TX_FORMAT_YUV_MODE), - _ASSIGN(YCBCR_REV, R300_EASY_TX_FORMAT(X, Y, Z, ONE, G8R8_G8B8) | R300_TX_FORMAT_YUV_MODE), - _ASSIGN(RGB_DXT1, R300_EASY_TX_FORMAT(X, Y, Z, ONE, DXT1)), - _ASSIGN(RGBA_DXT1, R300_EASY_TX_FORMAT(X, Y, Z, W, DXT1)), - _ASSIGN(RGBA_DXT3, R300_EASY_TX_FORMAT(X, Y, Z, W, DXT3)), - _ASSIGN(RGBA_DXT5, R300_EASY_TX_FORMAT(Y, Z, W, X, DXT5)), - _ASSIGN(RGBA_FLOAT32, R300_EASY_TX_FORMAT(Z, Y, X, W, FL_R32G32B32A32)), - _ASSIGN(RGBA_FLOAT16, R300_EASY_TX_FORMAT(Z, Y, X, W, FL_R16G16B16A16)), - _ASSIGN(RGB_FLOAT32, 0xffffffff), - _ASSIGN(RGB_FLOAT16, 0xffffffff), - _ASSIGN(ALPHA_FLOAT32, R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, FL_I32)), - _ASSIGN(ALPHA_FLOAT16, R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, FL_I16)), - _ASSIGN(LUMINANCE_FLOAT32, R300_EASY_TX_FORMAT(X, X, X, ONE, FL_I32)), - _ASSIGN(LUMINANCE_FLOAT16, R300_EASY_TX_FORMAT(X, X, X, ONE, FL_I16)), - _ASSIGN(LUMINANCE_ALPHA_FLOAT32, R300_EASY_TX_FORMAT(X, X, X, Y, FL_I32A32)), - _ASSIGN(LUMINANCE_ALPHA_FLOAT16, R300_EASY_TX_FORMAT(X, X, X, Y, FL_I16A16)), - _ASSIGN(INTENSITY_FLOAT32, R300_EASY_TX_FORMAT(X, X, X, X, FL_I32)), - _ASSIGN(INTENSITY_FLOAT16, R300_EASY_TX_FORMAT(X, X, X, X, FL_I16)), - _ASSIGN(Z16, R300_EASY_TX_FORMAT(X, X, X, X, X16)), - _ASSIGN(Z24_S8, R300_EASY_TX_FORMAT(X, X, X, X, X24_Y8)), - _ASSIGN(S8_Z24, R300_EASY_TX_FORMAT(Y, Y, Y, Y, X24_Y8)), - _ASSIGN(Z32, R300_EASY_TX_FORMAT(X, X, X, X, X32)), - /* EXT_texture_sRGB */ - _ASSIGN(SRGBA8, R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8) | R300_TX_FORMAT_GAMMA), - _ASSIGN(SLA8, R300_EASY_TX_FORMAT(X, X, X, Y, Y8X8) | R300_TX_FORMAT_GAMMA), - _ASSIGN(SL8, R300_EASY_TX_FORMAT(X, X, X, ONE, X8) | R300_TX_FORMAT_GAMMA), - /* *INDENT-ON* */ + case MESA_FORMAT_XRGB8888: + return R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8); + case MESA_FORMAT_RGB888: + return R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8); + case MESA_FORMAT_RGB565: + return R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5); + case MESA_FORMAT_RGB565_REV: + return R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5); + case MESA_FORMAT_ARGB4444: + return R300_EASY_TX_FORMAT(X, Y, Z, W, W4Z4Y4X4); + case MESA_FORMAT_ARGB4444_REV: + return R300_EASY_TX_FORMAT(X, Y, Z, W, W4Z4Y4X4); + case MESA_FORMAT_ARGB1555: + return R300_EASY_TX_FORMAT(X, Y, Z, W, W1Z5Y5X5); + case MESA_FORMAT_ARGB1555_REV: + return R300_EASY_TX_FORMAT(X, Y, Z, W, W1Z5Y5X5); + case MESA_FORMAT_AL88: + return R300_EASY_TX_FORMAT(X, X, X, Y, Y8X8); + case MESA_FORMAT_AL88_REV: + return R300_EASY_TX_FORMAT(X, X, X, Y, Y8X8); + case MESA_FORMAT_RGB332: + return R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z3Y3X2); + case MESA_FORMAT_A8: + return R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, X8); + case MESA_FORMAT_L8: + return R300_EASY_TX_FORMAT(X, X, X, ONE, X8); + case MESA_FORMAT_I8: + return R300_EASY_TX_FORMAT(X, X, X, X, X8); + case MESA_FORMAT_CI8: + return R300_EASY_TX_FORMAT(X, X, X, X, X8); + case MESA_FORMAT_YCBCR: + return R300_EASY_TX_FORMAT(X, Y, Z, ONE, G8R8_G8B8) | R300_TX_FORMAT_YUV_MODE; + case MESA_FORMAT_YCBCR_REV: + return R300_EASY_TX_FORMAT(X, Y, Z, ONE, G8R8_G8B8) | R300_TX_FORMAT_YUV_MODE; + case MESA_FORMAT_RGB_DXT1: + return R300_EASY_TX_FORMAT(X, Y, Z, ONE, DXT1); + case MESA_FORMAT_RGBA_DXT1: + return R300_EASY_TX_FORMAT(X, Y, Z, W, DXT1); + case MESA_FORMAT_RGBA_DXT3: + return R300_EASY_TX_FORMAT(X, Y, Z, W, DXT3); + case MESA_FORMAT_RGBA_DXT5: + return R300_EASY_TX_FORMAT(Y, Z, W, X, DXT5); + case MESA_FORMAT_RGBA_FLOAT32: + return R300_EASY_TX_FORMAT(Z, Y, X, W, FL_R32G32B32A32); + case MESA_FORMAT_RGBA_FLOAT16: + return R300_EASY_TX_FORMAT(Z, Y, X, W, FL_R16G16B16A16); + case MESA_FORMAT_ALPHA_FLOAT32: + return R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, FL_I32); + case MESA_FORMAT_ALPHA_FLOAT16: + return R300_EASY_TX_FORMAT(ZERO, ZERO, ZERO, X, FL_I16); + case MESA_FORMAT_LUMINANCE_FLOAT32: + return R300_EASY_TX_FORMAT(X, X, X, ONE, FL_I32); + case MESA_FORMAT_LUMINANCE_FLOAT16: + return R300_EASY_TX_FORMAT(X, X, X, ONE, FL_I16); + case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT32: + return R300_EASY_TX_FORMAT(X, X, X, Y, FL_I32A32); + case MESA_FORMAT_LUMINANCE_ALPHA_FLOAT16: + return R300_EASY_TX_FORMAT(X, X, X, Y, FL_I16A16); + case MESA_FORMAT_INTENSITY_FLOAT32: + return R300_EASY_TX_FORMAT(X, X, X, X, FL_I32); + case MESA_FORMAT_INTENSITY_FLOAT16: + return R300_EASY_TX_FORMAT(X, X, X, X, FL_I16); + case MESA_FORMAT_Z16: + return R300_EASY_TX_FORMAT(X, X, X, X, X16); + case MESA_FORMAT_Z24_S8: + return R300_EASY_TX_FORMAT(X, X, X, X, X24_Y8); + case MESA_FORMAT_S8_Z24: + return R300_EASY_TX_FORMAT(Y, Y, Y, Y, X24_Y8); + case MESA_FORMAT_Z32: + return R300_EASY_TX_FORMAT(X, X, X, X, X32); + /* EXT_texture_sRGB */ + case MESA_FORMAT_SRGBA8: + return R300_EASY_TX_FORMAT(Y, Z, W, X, W8Z8Y8X8) | R300_TX_FORMAT_GAMMA; + case MESA_FORMAT_SLA8: + return R300_EASY_TX_FORMAT(X, X, X, Y, Y8X8) | R300_TX_FORMAT_GAMMA; + case MESA_FORMAT_SL8: + return R300_EASY_TX_FORMAT(X, X, X, ONE, X8) | R300_TX_FORMAT_GAMMA; + case MESA_FORMAT_SRGB_DXT1: + return R300_EASY_TX_FORMAT(X, Y, Z, ONE, DXT1) | R300_TX_FORMAT_GAMMA; + case MESA_FORMAT_SRGBA_DXT1: + return R300_EASY_TX_FORMAT(X, Y, Z, W, DXT1) | R300_TX_FORMAT_GAMMA; + case MESA_FORMAT_SRGBA_DXT3: + return R300_EASY_TX_FORMAT(X, Y, Z, W, DXT3) | R300_TX_FORMAT_GAMMA; + case MESA_FORMAT_SRGBA_DXT5: + return R300_EASY_TX_FORMAT(Y, Z, W, X, DXT5) | R300_TX_FORMAT_GAMMA; + default: + fprintf(stderr, "%s: Invalid format %s", __FUNCTION__, _mesa_get_format_name(mesaFormat)); + assert(0); + return 0; + } }; -#undef _ASSIGN - void r300SetDepthTexMode(struct gl_texture_object *tObj) { static const GLuint formats[3][3] = { @@ -205,19 +251,12 @@ static void setup_hardware_state(r300ContextPtr rmesa, radeonTexObj *t) const struct gl_texture_image *firstImage; firstImage = t->base.Image[0][t->minLod]; - if (!t->image_override - && VALID_FORMAT(firstImage->TexFormat)) { + if (!t->image_override) { if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) { r300SetDepthTexMode(&t->base); } else { - t->pp_txformat = tx_table[firstImage->TexFormat].format; + t->pp_txformat = translateTexFormat(firstImage->TexFormat); } - - t->pp_txfilter |= tx_table[firstImage->TexFormat].filter; - } else if (!t->image_override) { - _mesa_problem(NULL, "unexpected texture format in %s", - __FUNCTION__); - return; } if (t->image_override && t->bo) @@ -357,18 +396,15 @@ void r300SetTexOffset(__DRIcontext * pDRICtx, GLint texname, switch (depth) { case 32: t->pp_txformat = R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8); - t->pp_txfilter |= tx_table[2].filter; pitch_val /= 4; break; case 24: default: t->pp_txformat = R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8); - t->pp_txfilter |= tx_table[4].filter; pitch_val /= 4; break; case 16: t->pp_txformat = R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5); - t->pp_txfilter |= tx_table[5].filter; pitch_val /= 2; break; } @@ -447,18 +483,15 @@ void r300SetTexBuffer2(__DRIcontext *pDRICtx, GLint target, GLint glx_texture_fo t->pp_txformat = R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8); else t->pp_txformat = R300_EASY_TX_FORMAT(X, Y, Z, W, W8Z8Y8X8); - t->pp_txfilter |= tx_table[2].filter; pitch_val /= 4; break; case 3: default: t->pp_txformat = R300_EASY_TX_FORMAT(X, Y, Z, ONE, W8Z8Y8X8); - t->pp_txfilter |= tx_table[4].filter; pitch_val /= 4; break; case 2: t->pp_txformat = R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5); - t->pp_txfilter |= tx_table[5].filter; pitch_val /= 2; break; } -- cgit v1.2.3 From 5ee270820ba8dc7bfc6be5812f02c66f4a76f705 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 7 Nov 2009 20:03:57 +0100 Subject: r300: use _mesa_meta_Clear for buffer clears --- src/mesa/drivers/dri/r300/Makefile | 1 - src/mesa/drivers/dri/r300/r300_cmdbuf.c | 1 - src/mesa/drivers/dri/r300/r300_context.c | 9 +- src/mesa/drivers/dri/r300/r300_emit.c | 1 - src/mesa/drivers/dri/r300/r300_ioctl.c | 782 ------------------------------ src/mesa/drivers/dri/r300/r300_ioctl.h | 44 -- src/mesa/drivers/dri/r300/r300_render.c | 1 - src/mesa/drivers/dri/r300/r300_state.c | 1 - src/mesa/drivers/dri/r300/r300_tex.c | 1 - src/mesa/drivers/dri/r300/r300_texstate.c | 1 - 10 files changed, 8 insertions(+), 834 deletions(-) delete mode 100644 src/mesa/drivers/dri/r300/r300_ioctl.c delete mode 100644 src/mesa/drivers/dri/r300/r300_ioctl.h (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/Makefile b/src/mesa/drivers/dri/r300/Makefile index cb0f715fa0..9fd0133fda 100644 --- a/src/mesa/drivers/dri/r300/Makefile +++ b/src/mesa/drivers/dri/r300/Makefile @@ -45,7 +45,6 @@ DRIVER_SOURCES = \ radeon_screen.c \ r300_context.c \ r300_draw.c \ - r300_ioctl.c \ r300_cmdbuf.c \ r300_state.c \ r300_render.c \ diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index ad8db6e68e..efeeb0646d 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -45,7 +45,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "radeon_drm.h" #include "r300_context.h" -#include "r300_ioctl.h" #include "r300_reg.h" #include "r300_cmdbuf.h" #include "r300_emit.h" diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 5f07b95634..67183c3c2a 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -55,13 +55,13 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tnl/t_vp_build.h" #include "drivers/common/driverfuncs.h" +#include "drivers/common/meta.h" #include "r300_context.h" #include "radeon_context.h" #include "radeon_span.h" #include "r300_cmdbuf.h" #include "r300_state.h" -#include "r300_ioctl.h" #include "r300_tex.h" #include "r300_emit.h" #include "r300_swtcl.h" @@ -451,6 +451,13 @@ static void r300InitGLExtensions(GLcontext *ctx) } } +static void r300InitIoctlFuncs(struct dd_function_table *functions) +{ + functions->Clear = _mesa_meta_Clear; + functions->Finish = radeonFinish; + functions->Flush = radeonFlush; +} + /* Create the device specific rendering context. */ GLboolean r300CreateContext(const __GLcontextModes * glVisual, diff --git a/src/mesa/drivers/dri/r300/r300_emit.c b/src/mesa/drivers/dri/r300/r300_emit.c index 07e6223087..3759ca2bea 100644 --- a/src/mesa/drivers/dri/r300/r300_emit.c +++ b/src/mesa/drivers/dri/r300/r300_emit.c @@ -49,7 +49,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_context.h" #include "r300_state.h" #include "r300_emit.h" -#include "r300_ioctl.h" #include "r300_render.h" #include "r300_swtcl.h" diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.c b/src/mesa/drivers/dri/r300/r300_ioctl.c deleted file mode 100644 index 5cb04e2bb6..0000000000 --- a/src/mesa/drivers/dri/r300/r300_ioctl.c +++ /dev/null @@ -1,782 +0,0 @@ -/* -Copyright (C) The Weather Channel, Inc. 2002. -Copyright (C) 2004 Nicolai Haehnle. -All Rights Reserved. - -The Weather Channel (TM) funded Tungsten Graphics to develop the -initial release of the Radeon 8500 driver under the XFree86 license. -This notice must be preserved. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial -portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 - * - * \author Keith Whitwell - * - * \author Nicolai Haehnle - */ - -#include -#include - -#include "main/glheader.h" -#include "main/imports.h" -#include "main/macros.h" -#include "main/context.h" -#include "main/simple_list.h" -#include "swrast/swrast.h" - -#include "radeon_common.h" -#include "radeon_lock.h" -#include "r300_context.h" -#include "r300_ioctl.h" -#include "r300_cmdbuf.h" -#include "r300_state.h" -#include "r300_vertprog.h" -#include "radeon_reg.h" -#include "r300_emit.h" -#include "r300_context.h" - -#include "vblank.h" - -#define R200_3D_DRAW_IMMD_2 0xC0003500 - -#define CLEARBUFFER_COLOR 0x1 -#define CLEARBUFFER_DEPTH 0x2 -#define CLEARBUFFER_STENCIL 0x4 - -#if 1 - -/** - * Fragment program helper macros - */ - -/* Produce unshifted source selectors */ -#define FP_TMP(idx) (idx) -#define FP_CONST(idx) ((idx) | (1 << 5)) - -/* Produce source/dest selector dword */ -#define FP_SELC_MASK_NO 0 -#define FP_SELC_MASK_X 1 -#define FP_SELC_MASK_Y 2 -#define FP_SELC_MASK_XY 3 -#define FP_SELC_MASK_Z 4 -#define FP_SELC_MASK_XZ 5 -#define FP_SELC_MASK_YZ 6 -#define FP_SELC_MASK_XYZ 7 - -#define FP_SELC(destidx,regmask,outmask,src0,src1,src2) \ - (((destidx) << R300_ALU_DSTC_SHIFT) | \ - (FP_SELC_MASK_##regmask << 23) | \ - (FP_SELC_MASK_##outmask << 26) | \ - ((src0) << R300_ALU_SRC0C_SHIFT) | \ - ((src1) << R300_ALU_SRC1C_SHIFT) | \ - ((src2) << R300_ALU_SRC2C_SHIFT)) - -#define FP_SELA_MASK_NO 0 -#define FP_SELA_MASK_W 1 - -#define FP_SELA(destidx,regmask,outmask,src0,src1,src2) \ - (((destidx) << R300_ALU_DSTA_SHIFT) | \ - (FP_SELA_MASK_##regmask << 23) | \ - (FP_SELA_MASK_##outmask << 24) | \ - ((src0) << R300_ALU_SRC0A_SHIFT) | \ - ((src1) << R300_ALU_SRC1A_SHIFT) | \ - ((src2) << R300_ALU_SRC2A_SHIFT)) - -/* Produce unshifted argument selectors */ -#define FP_ARGC(source) R300_ALU_ARGC_##source -#define FP_ARGA(source) R300_ALU_ARGA_##source -#define FP_ABS(arg) ((arg) | (1 << 6)) -#define FP_NEG(arg) ((arg) ^ (1 << 5)) - -/* Produce instruction dword */ -#define FP_INSTRC(opcode,arg0,arg1,arg2) \ - (R300_ALU_OUTC_##opcode | \ - ((arg0) << R300_ALU_ARG0C_SHIFT) | \ - ((arg1) << R300_ALU_ARG1C_SHIFT) | \ - ((arg2) << R300_ALU_ARG2C_SHIFT)) - -#define FP_INSTRA(opcode,arg0,arg1,arg2) \ - (R300_ALU_OUTA_##opcode | \ - ((arg0) << R300_ALU_ARG0A_SHIFT) | \ - ((arg1) << R300_ALU_ARG1A_SHIFT) | \ - ((arg2) << R300_ALU_ARG2A_SHIFT)) - -#endif - -static void r300EmitClearState(GLcontext * ctx); - -static void r300ClearBuffer(r300ContextPtr r300, int flags, - struct radeon_renderbuffer *rrb, - struct radeon_renderbuffer *rrbd) -{ - BATCH_LOCALS(&r300->radeon); - GLcontext *ctx = r300->radeon.glCtx; - __DRIdrawablePrivate *dPriv = radeon_get_drawable(&r300->radeon); - GLuint cbpitch = 0; - r300ContextPtr rmesa = r300; - - if (RADEON_DEBUG & RADEON_IOCTL) - fprintf(stderr, "%s: buffer %p (%i,%i %ix%i)\n", - __FUNCTION__, rrb, dPriv->x, dPriv->y, - dPriv->w, dPriv->h); - - if (rrb) { - cbpitch = (rrb->pitch / rrb->cpp); - if (rrb->cpp == 4) - cbpitch |= R300_COLOR_FORMAT_ARGB8888; - else - cbpitch |= R300_COLOR_FORMAT_RGB565; - - if (rrb->bo->flags & RADEON_BO_FLAGS_MACRO_TILE){ - cbpitch |= R300_COLOR_TILE_ENABLE; - } - } - - /* TODO in bufmgr */ - cp_wait(&r300->radeon, R300_WAIT_3D | R300_WAIT_3D_CLEAN); - end_3d(&rmesa->radeon); - - if (flags & CLEARBUFFER_COLOR) { - assert(rrb != 0); - BEGIN_BATCH_NO_AUTOSTATE(6); - OUT_BATCH_REGSEQ(R300_RB3D_COLOROFFSET0, 1); - OUT_BATCH_RELOC(0, rrb->bo, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0); - OUT_BATCH_REGVAL(R300_RB3D_COLORPITCH0, cbpitch); - END_BATCH(); - } -#if 1 - if (flags & (CLEARBUFFER_DEPTH | CLEARBUFFER_STENCIL)) { - uint32_t zbpitch = (rrbd->pitch / rrbd->cpp); - if (rrbd->bo->flags & RADEON_BO_FLAGS_MACRO_TILE){ - zbpitch |= R300_DEPTHMACROTILE_ENABLE; - } - if (rrbd->bo->flags & RADEON_BO_FLAGS_MICRO_TILE){ - zbpitch |= R300_DEPTHMICROTILE_TILED; - } - BEGIN_BATCH_NO_AUTOSTATE(6); - OUT_BATCH_REGSEQ(R300_ZB_DEPTHOFFSET, 1); - OUT_BATCH_RELOC(0, rrbd->bo, 0, 0, RADEON_GEM_DOMAIN_VRAM, 0); - OUT_BATCH_REGSEQ(R300_ZB_DEPTHPITCH, 1); - if (!r300->radeon.radeonScreen->kernel_mm) - OUT_BATCH(zbpitch); - else - OUT_BATCH_RELOC(zbpitch, rrbd->bo, zbpitch, 0, RADEON_GEM_DOMAIN_VRAM, 0); - END_BATCH(); - } -#endif - BEGIN_BATCH_NO_AUTOSTATE(6); - OUT_BATCH_REGSEQ(RB3D_COLOR_CHANNEL_MASK, 1); - if (flags & CLEARBUFFER_COLOR) { - OUT_BATCH((ctx->Color.ColorMask[BCOMP] ? RB3D_COLOR_CHANNEL_MASK_BLUE_MASK0 : 0) | - (ctx->Color.ColorMask[GCOMP] ? RB3D_COLOR_CHANNEL_MASK_GREEN_MASK0 : 0) | - (ctx->Color.ColorMask[RCOMP] ? RB3D_COLOR_CHANNEL_MASK_RED_MASK0 : 0) | - (ctx->Color.ColorMask[ACOMP] ? RB3D_COLOR_CHANNEL_MASK_ALPHA_MASK0 : 0)); - } else { - OUT_BATCH(0); - } - - - { - uint32_t t1, t2; - - t1 = 0x0; - t2 = 0x0; - - if (flags & CLEARBUFFER_DEPTH) { - t1 |= R300_Z_ENABLE | R300_Z_WRITE_ENABLE; - t2 |= - (R300_ZS_ALWAYS << R300_Z_FUNC_SHIFT); - } - - if (flags & CLEARBUFFER_STENCIL) { - t1 |= R300_STENCIL_ENABLE; - t2 |= - (R300_ZS_ALWAYS << - R300_S_FRONT_FUNC_SHIFT) | - (R300_ZS_REPLACE << - R300_S_FRONT_SFAIL_OP_SHIFT) | - (R300_ZS_REPLACE << - R300_S_FRONT_ZPASS_OP_SHIFT) | - (R300_ZS_REPLACE << - R300_S_FRONT_ZFAIL_OP_SHIFT); - } - - OUT_BATCH_REGSEQ(R300_ZB_CNTL, 3); - OUT_BATCH(t1); - OUT_BATCH(t2); - OUT_BATCH(((ctx->Stencil.WriteMask[0] & R300_STENCILREF_MASK) << - R300_STENCILWRITEMASK_SHIFT) | - (ctx->Stencil.Clear & R300_STENCILREF_MASK)); - END_BATCH(); - } - - if (!rmesa->radeon.radeonScreen->kernel_mm) { - BEGIN_BATCH_NO_AUTOSTATE(9); - OUT_BATCH(cmdpacket3(r300->radeon.radeonScreen, R300_CMD_PACKET3_CLEAR)); - OUT_BATCH_FLOAT32(dPriv->w / 2.0); - OUT_BATCH_FLOAT32(dPriv->h / 2.0); - OUT_BATCH_FLOAT32(ctx->Depth.Clear); - OUT_BATCH_FLOAT32(1.0); - OUT_BATCH_FLOAT32(ctx->Color.ClearColor[0]); - OUT_BATCH_FLOAT32(ctx->Color.ClearColor[1]); - OUT_BATCH_FLOAT32(ctx->Color.ClearColor[2]); - OUT_BATCH_FLOAT32(ctx->Color.ClearColor[3]); - END_BATCH(); - } else { - OUT_BATCH(CP_PACKET3(R200_3D_DRAW_IMMD_2, 8)); - OUT_BATCH(R300_PRIM_TYPE_POINT | R300_PRIM_WALK_RING | - (1 << R300_PRIM_NUM_VERTICES_SHIFT)); - OUT_BATCH_FLOAT32(dPriv->w / 2.0); - OUT_BATCH_FLOAT32(dPriv->h / 2.0); - OUT_BATCH_FLOAT32(ctx->Depth.Clear); - OUT_BATCH_FLOAT32(1.0); - OUT_BATCH_FLOAT32(ctx->Color.ClearColor[0]); - OUT_BATCH_FLOAT32(ctx->Color.ClearColor[1]); - OUT_BATCH_FLOAT32(ctx->Color.ClearColor[2]); - OUT_BATCH_FLOAT32(ctx->Color.ClearColor[3]); - } - - r300EmitCacheFlush(rmesa); - cp_wait(&r300->radeon, R300_WAIT_3D | R300_WAIT_3D_CLEAN); - - R300_STATECHANGE(r300, cb); - R300_STATECHANGE(r300, cmk); - R300_STATECHANGE(r300, zs); -} - -static void r300EmitClearState(GLcontext * ctx) -{ - r300ContextPtr r300 = R300_CONTEXT(ctx); - BATCH_LOCALS(&r300->radeon); - __DRIdrawablePrivate *dPriv = radeon_get_drawable(&r300->radeon); - int i; - int has_tcl; - int is_r500 = 0; - GLuint vap_cntl; - - has_tcl = r300->options.hw_tcl_enabled; - - if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) - is_r500 = 1; - - /* State atom dirty tracking is a little subtle here. - * - * On the one hand, we need to make sure base state is emitted - * here if we start with an empty batch buffer, otherwise clear - * works incorrectly with multiple processes. Therefore, the first - * BEGIN_BATCH cannot be a BEGIN_BATCH_NO_AUTOSTATE. - * - * On the other hand, implicit state emission clears the state atom - * dirty bits, so we have to call R300_STATECHANGE later than the - * first BEGIN_BATCH. - * - * The final trickiness is that, because we change state, we need - * to ensure that any stored swtcl primitives are flushed properly - * before we start changing state. See the R300_NEWPRIM in r300Clear - * for this. - */ - BEGIN_BATCH(31); - OUT_BATCH_REGSEQ(R300_VAP_PROG_STREAM_CNTL_0, 1); - if (!has_tcl) - OUT_BATCH(((((0 << R300_DST_VEC_LOC_SHIFT) | 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))); - else - OUT_BATCH(((((0 << R300_DST_VEC_LOC_SHIFT) | 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))); - - OUT_BATCH_REGVAL(R300_FG_FOG_BLEND, 0); - OUT_BATCH_REGVAL(R300_VAP_PROG_STREAM_CNTL_EXT_0, - ((((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_SHIFT) | - (R300_SWIZZLE_SELECT_Y << R300_SWIZZLE_SELECT_Y_SHIFT) | - (R300_SWIZZLE_SELECT_Z << R300_SWIZZLE_SELECT_Z_SHIFT) | - (R300_SWIZZLE_SELECT_W << R300_SWIZZLE_SELECT_W_SHIFT) | - ((R300_WRITE_ENA_X | R300_WRITE_ENA_Y | R300_WRITE_ENA_Z | R300_WRITE_ENA_W) << R300_WRITE_ENA_SHIFT)) - << R300_SWIZZLE0_SHIFT) | - (((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_SHIFT) | - (R300_SWIZZLE_SELECT_Y << R300_SWIZZLE_SELECT_Y_SHIFT) | - (R300_SWIZZLE_SELECT_Z << R300_SWIZZLE_SELECT_Z_SHIFT) | - (R300_SWIZZLE_SELECT_W << R300_SWIZZLE_SELECT_W_SHIFT) | - ((R300_WRITE_ENA_X | R300_WRITE_ENA_Y | R300_WRITE_ENA_Z | R300_WRITE_ENA_W) << R300_WRITE_ENA_SHIFT)) - << R300_SWIZZLE1_SHIFT))); - - /* R300_VAP_INPUT_CNTL_0, R300_VAP_INPUT_CNTL_1 */ - OUT_BATCH_REGSEQ(R300_VAP_VTX_STATE_CNTL, 2); - OUT_BATCH((R300_SEL_USER_COLOR_0 << R300_COLOR_0_ASSEMBLY_SHIFT)); - OUT_BATCH(R300_INPUT_CNTL_POS | R300_INPUT_CNTL_COLOR | R300_INPUT_CNTL_TC0); - - /* comes from fglrx startup of clear */ - OUT_BATCH_REGSEQ(R300_SE_VTE_CNTL, 2); - OUT_BATCH(R300_VTX_W0_FMT | R300_VPORT_X_SCALE_ENA | - R300_VPORT_X_OFFSET_ENA | R300_VPORT_Y_SCALE_ENA | - R300_VPORT_Y_OFFSET_ENA | R300_VPORT_Z_SCALE_ENA | - R300_VPORT_Z_OFFSET_ENA); - OUT_BATCH(0x8); - - OUT_BATCH_REGVAL(R300_VAP_PSC_SGN_NORM_CNTL, 0xaaaaaaaa); - - OUT_BATCH_REGSEQ(R300_VAP_OUTPUT_VTX_FMT_0, 2); - OUT_BATCH(R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT | - R300_VAP_OUTPUT_VTX_FMT_0__COLOR_0_PRESENT); - OUT_BATCH(0); /* no textures */ - - OUT_BATCH_REGVAL(R300_TX_ENABLE, 0); - - OUT_BATCH_REGSEQ(R300_SE_VPORT_XSCALE, 6); - OUT_BATCH_FLOAT32(1.0); - OUT_BATCH_FLOAT32(dPriv->x); - OUT_BATCH_FLOAT32(1.0); - OUT_BATCH_FLOAT32(dPriv->y); - OUT_BATCH_FLOAT32(1.0); - OUT_BATCH_FLOAT32(0.0); - - OUT_BATCH_REGVAL(R300_FG_ALPHA_FUNC, 0); - - OUT_BATCH_REGSEQ(R300_RB3D_CBLEND, 2); - OUT_BATCH(0x0); - OUT_BATCH(0x0); - END_BATCH(); - - R300_STATECHANGE(r300, vir[0]); - R300_STATECHANGE(r300, fogs); - R300_STATECHANGE(r300, vir[1]); - R300_STATECHANGE(r300, vic); - R300_STATECHANGE(r300, vte); - R300_STATECHANGE(r300, vof); - R300_STATECHANGE(r300, txe); - R300_STATECHANGE(r300, vpt); - R300_STATECHANGE(r300, at); - R300_STATECHANGE(r300, bld); - R300_STATECHANGE(r300, ps); - - if (has_tcl) { - R300_STATECHANGE(r300, vap_clip_cntl); - - BEGIN_BATCH_NO_AUTOSTATE(2); - OUT_BATCH_REGVAL(R300_VAP_CLIP_CNTL, R300_PS_UCP_MODE_CLIP_AS_TRIFAN | R300_CLIP_DISABLE); - END_BATCH(); - } - - BEGIN_BATCH_NO_AUTOSTATE(2); - OUT_BATCH_REGVAL(R300_GA_POINT_SIZE, - ((dPriv->w * 6) << R300_POINTSIZE_X_SHIFT) | - ((dPriv->h * 6) << R300_POINTSIZE_Y_SHIFT)); - END_BATCH(); - - if (!is_r500) { - R300_STATECHANGE(r300, ri); - R300_STATECHANGE(r300, rc); - R300_STATECHANGE(r300, rr); - - BEGIN_BATCH(14); - OUT_BATCH_REGSEQ(R300_RS_IP_0, 8); - for (i = 0; i < 8; ++i) - OUT_BATCH(R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(3)); - - OUT_BATCH_REGSEQ(R300_RS_COUNT, 2); - OUT_BATCH((1 << R300_IC_COUNT_SHIFT) | R300_HIRES_EN); - OUT_BATCH(0x0); - - OUT_BATCH_REGVAL(R300_RS_INST_0, R300_RS_INST_COL_CN_WRITE); - END_BATCH(); - } else { - R300_STATECHANGE(r300, ri); - R300_STATECHANGE(r300, rc); - R300_STATECHANGE(r300, rr); - - BEGIN_BATCH(14); - OUT_BATCH_REGSEQ(R500_RS_IP_0, 8); - for (i = 0; i < 8; ++i) { - OUT_BATCH((R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_S_SHIFT) | - (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_T_SHIFT) | - (R500_RS_IP_PTR_K0 << R500_RS_IP_TEX_PTR_R_SHIFT) | - (R500_RS_IP_PTR_K1 << R500_RS_IP_TEX_PTR_Q_SHIFT)); - } - - OUT_BATCH_REGSEQ(R300_RS_COUNT, 2); - OUT_BATCH((1 << R300_IC_COUNT_SHIFT) | R300_HIRES_EN); - OUT_BATCH(0x0); - - OUT_BATCH_REGVAL(R500_RS_INST_0, R500_RS_INST_COL_CN_WRITE); - END_BATCH(); - } - - if (!is_r500) { - R300_STATECHANGE(r300, fp); - R300_STATECHANGE(r300, fpi[0]); - R300_STATECHANGE(r300, fpi[1]); - R300_STATECHANGE(r300, fpi[2]); - R300_STATECHANGE(r300, fpi[3]); - - BEGIN_BATCH(17); - OUT_BATCH_REGSEQ(R300_US_CONFIG, 3); - OUT_BATCH(0x0); - OUT_BATCH(0x0); - OUT_BATCH(0x0); - OUT_BATCH_REGSEQ(R300_US_CODE_ADDR_0, 4); - OUT_BATCH(0x0); - OUT_BATCH(0x0); - OUT_BATCH(0x0); - OUT_BATCH(R300_RGBA_OUT); - - OUT_BATCH_REGVAL(R300_US_ALU_RGB_INST_0, - FP_INSTRC(MAD, FP_ARGC(SRC0C_XYZ), FP_ARGC(ONE), FP_ARGC(ZERO))); - OUT_BATCH_REGVAL(R300_US_ALU_RGB_ADDR_0, - FP_SELC(0, NO, XYZ, FP_TMP(0), 0, 0)); - OUT_BATCH_REGVAL(R300_US_ALU_ALPHA_INST_0, - FP_INSTRA(MAD, FP_ARGA(SRC0A), FP_ARGA(ONE), FP_ARGA(ZERO))); - OUT_BATCH_REGVAL(R300_US_ALU_ALPHA_ADDR_0, - FP_SELA(0, NO, W, FP_TMP(0), 0, 0)); - END_BATCH(); - } else { - struct radeon_state_atom r500fp; - uint32_t _cmd[10]; - - R300_STATECHANGE(r300, fp); - R300_STATECHANGE(r300, r500fp); - - BEGIN_BATCH(7); - OUT_BATCH_REGSEQ(R500_US_CONFIG, 2); - OUT_BATCH(R500_ZERO_TIMES_ANYTHING_EQUALS_ZERO); - OUT_BATCH(0x0); - OUT_BATCH_REGSEQ(R500_US_CODE_ADDR, 3); - OUT_BATCH(R500_US_CODE_START_ADDR(0) | R500_US_CODE_END_ADDR(1)); - OUT_BATCH(R500_US_CODE_RANGE_ADDR(0) | R500_US_CODE_RANGE_SIZE(1)); - OUT_BATCH(R500_US_CODE_OFFSET_ADDR(0)); - END_BATCH(); - - r500fp.check = check_r500fp; - r500fp.cmd = _cmd; - r500fp.cmd[0] = cmdr500fp(r300->radeon.radeonScreen, 0, 1, 0, 0); - r500fp.cmd[1] = R500_INST_TYPE_OUT | - R500_INST_TEX_SEM_WAIT | - R500_INST_LAST | - R500_INST_RGB_OMASK_R | - R500_INST_RGB_OMASK_G | - R500_INST_RGB_OMASK_B | - R500_INST_ALPHA_OMASK | - R500_INST_RGB_CLAMP | - R500_INST_ALPHA_CLAMP; - r500fp.cmd[2] = R500_RGB_ADDR0(0) | - R500_RGB_ADDR1(0) | - R500_RGB_ADDR1_CONST | - R500_RGB_ADDR2(0) | - R500_RGB_ADDR2_CONST; - r500fp.cmd[3] = R500_ALPHA_ADDR0(0) | - R500_ALPHA_ADDR1(0) | - R500_ALPHA_ADDR1_CONST | - R500_ALPHA_ADDR2(0) | - R500_ALPHA_ADDR2_CONST; - r500fp.cmd[4] = 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; - r500fp.cmd[5] = R500_ALPHA_OP_CMP | - R500_ALPHA_SWIZ_A_A | - R500_ALPHA_SWIZ_B_A; - r500fp.cmd[6] = 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; - - r500fp.cmd[7] = 0; - if (r300->radeon.radeonScreen->kernel_mm) { - emit_r500fp(ctx, &r500fp); - } else { - int dwords = r500fp.check(ctx,&r500fp); - BEGIN_BATCH_NO_AUTOSTATE(dwords); - OUT_BATCH_TABLE(r500fp.cmd, dwords); - END_BATCH(); - } - - } - - BEGIN_BATCH(2); - OUT_BATCH_REGVAL(R300_VAP_PVS_STATE_FLUSH_REG, 0); - END_BATCH(); - - if (has_tcl) { - vap_cntl = ((10 << R300_PVS_NUM_SLOTS_SHIFT) | - (5 << R300_PVS_NUM_CNTLRS_SHIFT) | - (12 << R300_VF_MAX_VTX_NUM_SHIFT)); - if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) - vap_cntl |= R500_TCL_STATE_OPTIMIZATION; - } else { - vap_cntl = ((10 << R300_PVS_NUM_SLOTS_SHIFT) | - (5 << R300_PVS_NUM_CNTLRS_SHIFT) | - (5 << R300_VF_MAX_VTX_NUM_SHIFT)); - } - - if (r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV515) - vap_cntl |= (2 << R300_PVS_NUM_FPUS_SHIFT); - else if ((r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV530) || - (r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV560) || - (r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV570)) - vap_cntl |= (5 << R300_PVS_NUM_FPUS_SHIFT); - else if ((r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_RV410) || - (r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_R420)) - vap_cntl |= (6 << R300_PVS_NUM_FPUS_SHIFT); - else if ((r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_R520) || - (r300->radeon.radeonScreen->chip_family == CHIP_FAMILY_R580)) - vap_cntl |= (8 << R300_PVS_NUM_FPUS_SHIFT); - else - vap_cntl |= (4 << R300_PVS_NUM_FPUS_SHIFT); - - R300_STATECHANGE(r300, vap_cntl); - - BEGIN_BATCH(2); - OUT_BATCH_REGVAL(R300_VAP_CNTL, vap_cntl); - END_BATCH(); - - if (has_tcl) { - struct radeon_state_atom vpu; - uint32_t _cmd[10]; - R300_STATECHANGE(r300, pvs); - R300_STATECHANGE(r300, vap_flush); - R300_STATECHANGE(r300, vpi); - - BEGIN_BATCH(4); - OUT_BATCH_REGSEQ(R300_VAP_PVS_CODE_CNTL_0, 3); - OUT_BATCH((0 << R300_PVS_FIRST_INST_SHIFT) | - (0 << R300_PVS_XYZW_VALID_INST_SHIFT) | - (1 << R300_PVS_LAST_INST_SHIFT)); - OUT_BATCH((0 << R300_PVS_CONST_BASE_OFFSET_SHIFT) | - (0 << R300_PVS_MAX_CONST_ADDR_SHIFT)); - OUT_BATCH(1 << R300_PVS_LAST_VTX_SRC_INST_SHIFT); - END_BATCH(); - - vpu.check = check_vpu; - vpu.cmd = _cmd; - vpu.cmd[0] = cmdvpu(r300->radeon.radeonScreen, 0, 2); - - vpu.cmd[1] = PVS_OP_DST_OPERAND(VE_ADD, GL_FALSE, GL_FALSE, - 0, 0xf, PVS_DST_REG_OUT); - vpu.cmd[2] = PVS_SRC_OPERAND(0, PVS_SRC_SELECT_X, PVS_SRC_SELECT_Y, - PVS_SRC_SELECT_Z, PVS_SRC_SELECT_W, - PVS_SRC_REG_INPUT, NEGATE_NONE); - vpu.cmd[3] = PVS_SRC_OPERAND(0, PVS_SRC_SELECT_FORCE_0, - PVS_SRC_SELECT_FORCE_0, - PVS_SRC_SELECT_FORCE_0, - PVS_SRC_SELECT_FORCE_0, - PVS_SRC_REG_INPUT, NEGATE_NONE); - vpu.cmd[4] = 0x0; - - vpu.cmd[5] = PVS_OP_DST_OPERAND(VE_ADD, GL_FALSE, GL_FALSE, 1, 0xf, - PVS_DST_REG_OUT); - vpu.cmd[6] = PVS_SRC_OPERAND(1, PVS_SRC_SELECT_X, - PVS_SRC_SELECT_Y, PVS_SRC_SELECT_Z, - PVS_SRC_SELECT_W, PVS_SRC_REG_INPUT, - NEGATE_NONE); - vpu.cmd[7] = PVS_SRC_OPERAND(1, PVS_SRC_SELECT_FORCE_0, - PVS_SRC_SELECT_FORCE_0, - PVS_SRC_SELECT_FORCE_0, - PVS_SRC_SELECT_FORCE_0, - PVS_SRC_REG_INPUT, NEGATE_NONE); - vpu.cmd[8] = 0x0; - - if (r300->radeon.radeonScreen->kernel_mm) { - int dwords = r300->hw.vap_flush.check(ctx,&r300->hw.vap_flush); - BEGIN_BATCH_NO_AUTOSTATE(dwords); - OUT_BATCH_TABLE(r300->hw.vap_flush.cmd, dwords); - END_BATCH(); - emit_vpu(ctx, &vpu); - } else { - int dwords = vpu.check(ctx,&vpu); - BEGIN_BATCH_NO_AUTOSTATE(dwords); - OUT_BATCH_TABLE(vpu.cmd, dwords); - END_BATCH(); - } - - } -} - -static int r300KernelClear(GLcontext *ctx, GLuint flags) -{ - r300ContextPtr r300 = R300_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = radeon_get_drawable(&r300->radeon); - struct radeon_framebuffer *rfb = dPriv->driverPrivate; - struct radeon_renderbuffer *rrb; - struct radeon_renderbuffer *rrbd; - int bits = 0, ret; - - /* Make sure it fits there. */ - radeon_cs_space_reset_bos(r300->radeon.cmdbuf.cs); - - if (flags & BUFFER_BIT_COLOR0) { - rrb = radeon_get_renderbuffer(&rfb->base, BUFFER_COLOR0); - radeon_cs_space_add_persistent_bo(r300->radeon.cmdbuf.cs, - rrb->bo, 0, RADEON_GEM_DOMAIN_VRAM); - } - - if (flags & BUFFER_BIT_FRONT_LEFT) { - rrb = radeon_get_renderbuffer(&rfb->base, BUFFER_FRONT_LEFT); - radeon_cs_space_add_persistent_bo(r300->radeon.cmdbuf.cs, - rrb->bo, 0, RADEON_GEM_DOMAIN_VRAM); - } - - if (flags & BUFFER_BIT_BACK_LEFT) { - rrb = radeon_get_renderbuffer(&rfb->base, BUFFER_BACK_LEFT); - radeon_cs_space_add_persistent_bo(r300->radeon.cmdbuf.cs, - rrb->bo, 0, RADEON_GEM_DOMAIN_VRAM); - } - - rrbd = radeon_get_renderbuffer(&rfb->base, BUFFER_DEPTH); - if (rrbd) { - radeon_cs_space_add_persistent_bo(r300->radeon.cmdbuf.cs, - rrbd->bo, 0, RADEON_GEM_DOMAIN_VRAM); - } - - ret = radeon_cs_space_check(r300->radeon.cmdbuf.cs); - if (ret) - return -1; - - rcommonEnsureCmdBufSpace(&r300->radeon, 421 * 3, __FUNCTION__); - if (flags || bits) - r300EmitClearState(ctx); - - rrbd = radeon_get_renderbuffer(&rfb->base, BUFFER_DEPTH); - if (rrbd && (flags & BUFFER_BIT_DEPTH)) - bits |= CLEARBUFFER_DEPTH; - - if (rrbd && (flags & BUFFER_BIT_STENCIL)) - bits |= CLEARBUFFER_STENCIL; - - if (flags & BUFFER_BIT_COLOR0) { - rrb = radeon_get_renderbuffer(&rfb->base, BUFFER_COLOR0); - r300ClearBuffer(r300, CLEARBUFFER_COLOR, rrb, NULL); - bits = 0; - } - - if (flags & BUFFER_BIT_FRONT_LEFT) { - rrb = radeon_get_renderbuffer(&rfb->base, BUFFER_FRONT_LEFT); - r300ClearBuffer(r300, bits | CLEARBUFFER_COLOR, rrb, rrbd); - bits = 0; - } - - if (flags & BUFFER_BIT_BACK_LEFT) { - rrb = radeon_get_renderbuffer(&rfb->base, BUFFER_BACK_LEFT); - r300ClearBuffer(r300, bits | CLEARBUFFER_COLOR, rrb, rrbd); - bits = 0; - } - - if (bits) - r300ClearBuffer(r300, bits, NULL, rrbd); - - COMMIT_BATCH(); - return 0; -} - -/** - * Buffer clear - */ -static void r300Clear(GLcontext * ctx, GLbitfield mask) -{ - r300ContextPtr r300 = R300_CONTEXT(ctx); - __DRIdrawablePrivate *dPriv = radeon_get_drawable(&r300->radeon); - const GLuint colorMask = *((GLuint *) & ctx->Color.ColorMask); - GLbitfield swrast_mask = 0, tri_mask = 0; - int i, ret; - struct gl_framebuffer *fb = ctx->DrawBuffer; - - if (RADEON_DEBUG & RADEON_IOCTL) - fprintf(stderr, "r300Clear\n"); - - if (!r300->radeon.radeonScreen->driScreen->dri2.enabled) { - LOCK_HARDWARE(&r300->radeon); - UNLOCK_HARDWARE(&r300->radeon); - if (dPriv->numClipRects == 0) - return; - } - - /* Flush swtcl vertices if necessary, because we will change hardware - * state during clear. See also the state-related comment in - * r300EmitClearState. - */ - R300_NEWPRIM(r300); - - if (colorMask == ~0) - tri_mask |= (mask & BUFFER_BITS_COLOR); - else - tri_mask |= (mask & (BUFFER_BIT_FRONT_LEFT | BUFFER_BIT_BACK_LEFT)); - - - /* HW stencil */ - if (mask & BUFFER_BIT_STENCIL) { - tri_mask |= BUFFER_BIT_STENCIL; - } - - /* HW depth */ - if (mask & BUFFER_BIT_DEPTH) { - tri_mask |= BUFFER_BIT_DEPTH; - } - - /* If we're doing a tri pass for depth/stencil, include a likely color - * buffer with it. - */ - - for (i = 0; i < BUFFER_COUNT; i++) { - GLuint bufBit = 1 << i; - if ((tri_mask) & bufBit) { - if (!fb->Attachment[i].Renderbuffer->ClassID) { - tri_mask &= ~bufBit; - swrast_mask |= bufBit; - } - } - } - - /* SW fallback clearing */ - swrast_mask = mask & ~tri_mask; - - ret = 0; - if (tri_mask) { - if (r300->radeon.radeonScreen->kernel_mm) - radeonUserClear(ctx, tri_mask); - else { - /* if kernel clear fails due to size restraints fallback */ - ret = r300KernelClear(ctx, tri_mask); - if (ret < 0) - swrast_mask |= tri_mask; - } - } - - if (swrast_mask) { - if (RADEON_DEBUG & RADEON_FALLBACKS) - fprintf(stderr, "%s: swrast clear, mask: %x\n", - __FUNCTION__, swrast_mask); - _swrast_Clear(ctx, swrast_mask); - } -} - -void r300InitIoctlFuncs(struct dd_function_table *functions) -{ - functions->Clear = r300Clear; - functions->Finish = radeonFinish; - functions->Flush = radeonFlush; -} diff --git a/src/mesa/drivers/dri/r300/r300_ioctl.h b/src/mesa/drivers/dri/r300/r300_ioctl.h deleted file mode 100644 index 3abfa71a6e..0000000000 --- a/src/mesa/drivers/dri/r300/r300_ioctl.h +++ /dev/null @@ -1,44 +0,0 @@ -/* -Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved. - -The Weather Channel (TM) funded Tungsten Graphics to develop the -initial release of the Radeon 8500 driver under the XFree86 license. -This notice must be preserved. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial -portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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: - * Keith Whitwell - * Nicolai Haehnle - */ - -#ifndef __R300_IOCTL_H__ -#define __R300_IOCTL_H__ - -#include "r300_context.h" -#include "radeon_drm.h" - -extern void r300InitIoctlFuncs(struct dd_function_table *functions); - -#endif /* __R300_IOCTL_H__ */ diff --git a/src/mesa/drivers/dri/r300/r300_render.c b/src/mesa/drivers/dri/r300/r300_render.c index 4ae593cbe7..02c94250a8 100644 --- a/src/mesa/drivers/dri/r300/r300_render.c +++ b/src/mesa/drivers/dri/r300/r300_render.c @@ -68,7 +68,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tnl/tnl.h" #include "tnl/t_vp_build.h" #include "r300_context.h" -#include "r300_ioctl.h" #include "r300_state.h" #include "r300_reg.h" #include "r300_tex.h" diff --git a/src/mesa/drivers/dri/r300/r300_state.c b/src/mesa/drivers/dri/r300/r300_state.c index ac20c08e20..da0a9dfb4c 100644 --- a/src/mesa/drivers/dri/r300/r300_state.c +++ b/src/mesa/drivers/dri/r300/r300_state.c @@ -55,7 +55,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "tnl/t_vp_build.h" #include "r300_context.h" -#include "r300_ioctl.h" #include "r300_state.h" #include "r300_reg.h" #include "r300_emit.h" diff --git a/src/mesa/drivers/dri/r300/r300_tex.c b/src/mesa/drivers/dri/r300/r300_tex.c index 726b3ff98e..ac3d5b1bec 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.c +++ b/src/mesa/drivers/dri/r300/r300_tex.c @@ -48,7 +48,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_context.h" #include "r300_state.h" -#include "r300_ioctl.h" #include "radeon_mipmap_tree.h" #include "r300_tex.h" diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index d80284e1b9..68b90d3106 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -46,7 +46,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_context.h" #include "r300_state.h" -#include "r300_ioctl.h" #include "radeon_mipmap_tree.h" #include "r300_tex.h" #include "r300_reg.h" -- cgit v1.2.3 From 05fae9fbf6d4409a8718813d9a607afc3c162050 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 7 Nov 2009 21:18:08 +0100 Subject: r300: refactor color buffer setup --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 216 ++++++++++++++++++-------------- src/mesa/drivers/dri/r300/r300_cmdbuf.h | 9 +- 2 files changed, 129 insertions(+), 96 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index efeeb0646d..57641998a4 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -255,110 +255,136 @@ static int check_cb_offset(GLcontext *ctx, struct radeon_state_atom * atom) return dw; } -static void emit_cb_offset(GLcontext *ctx, struct radeon_state_atom * atom) +static void emit_scissor(struct r300_context *r300, + unsigned width, + unsigned height) { - r300ContextPtr r300 = R300_CONTEXT(ctx); - BATCH_LOCALS(&r300->radeon); - struct radeon_renderbuffer *rrb; - uint32_t cbpitch; - uint32_t offset = r300->radeon.state.color.draw_offset; - uint32_t dw = 6; - int i; + int i; + BATCH_LOCALS(&r300->radeon); + if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { + BEGIN_BATCH_NO_AUTOSTATE(3); + OUT_BATCH_REGSEQ(R300_SC_SCISSORS_TL, 2); + OUT_BATCH(0); + OUT_BATCH(((width - 1) << R300_SCISSORS_X_SHIFT) | + ((height - 1) << R300_SCISSORS_Y_SHIFT)); + END_BATCH(); + BEGIN_BATCH_NO_AUTOSTATE(16); + for (i = 0; i < 4; i++) { + OUT_BATCH_REGSEQ(R300_SC_CLIPRECT_TL_0 + (i * 8), 2); + OUT_BATCH((0 << R300_CLIPRECT_X_SHIFT) | (0 << R300_CLIPRECT_Y_SHIFT)); + OUT_BATCH(((width - 1) << R300_CLIPRECT_X_SHIFT) | ((height - 1) << R300_CLIPRECT_Y_SHIFT)); + } + OUT_BATCH_REGSEQ(R300_SC_CLIP_RULE, 1); + OUT_BATCH(0xAAAA); + OUT_BATCH_REGSEQ(R300_SC_SCREENDOOR, 1); + OUT_BATCH(0xffffff); + END_BATCH(); + } else { + BEGIN_BATCH_NO_AUTOSTATE(3); + OUT_BATCH_REGSEQ(R300_SC_SCISSORS_TL, 2); + OUT_BATCH((R300_SCISSORS_OFFSET << R300_SCISSORS_X_SHIFT) | + (R300_SCISSORS_OFFSET << R300_SCISSORS_Y_SHIFT)); + OUT_BATCH(((width + R300_SCISSORS_OFFSET - 1) << R300_SCISSORS_X_SHIFT) | + ((height + R300_SCISSORS_OFFSET - 1) << R300_SCISSORS_Y_SHIFT)); + END_BATCH(); + BEGIN_BATCH_NO_AUTOSTATE(16); + for (i = 0; i < 4; i++) { + OUT_BATCH_REGSEQ(R300_SC_CLIPRECT_TL_0 + (i * 8), 2); + OUT_BATCH((R300_SCISSORS_OFFSET << R300_CLIPRECT_X_SHIFT) | (R300_SCISSORS_OFFSET << R300_CLIPRECT_Y_SHIFT)); + OUT_BATCH(((R300_SCISSORS_OFFSET + width - 1) << R300_CLIPRECT_X_SHIFT) | + ((R300_SCISSORS_OFFSET + height - 1) << R300_CLIPRECT_Y_SHIFT)); + } + OUT_BATCH_REGSEQ(R300_SC_CLIP_RULE, 1); + OUT_BATCH(0xAAAA); + OUT_BATCH_REGSEQ(R300_SC_SCREENDOOR, 1); + OUT_BATCH(0xffffff); + END_BATCH(); + } +} - rrb = radeon_get_colorbuffer(&r300->radeon); - if (!rrb || !rrb->bo) { - fprintf(stderr, "no rrb\n"); - return; - } +void r300_emit_cb_setup(struct r300_context *r300, + struct radeon_bo *bo, + uint32_t offset, + GLuint format, + unsigned cpp, + unsigned pitch) +{ + BATCH_LOCALS(&r300->radeon); + uint32_t cbpitch = pitch / cpp; + uint32_t dw = 6; - if (RADEON_DEBUG & RADEON_STATE) - fprintf(stderr,"rrb is %p %d %dx%d\n", rrb, offset, rrb->base.Width, rrb->base.Height); - cbpitch = (rrb->pitch / rrb->cpp); - if (rrb->cpp == 4) - cbpitch |= R300_COLOR_FORMAT_ARGB8888; - else switch (rrb->base.Format) { + assert(offset % 256 == 0); + + switch (format) { case MESA_FORMAT_RGB565: - assert(_mesa_little_endian()); - cbpitch |= R300_COLOR_FORMAT_RGB565; - break; + assert(_mesa_little_endian()); + cbpitch |= R300_COLOR_FORMAT_RGB565; + break; case MESA_FORMAT_RGB565_REV: - assert(!_mesa_little_endian()); - cbpitch |= R300_COLOR_FORMAT_RGB565; - break; + assert(!_mesa_little_endian()); + cbpitch |= R300_COLOR_FORMAT_RGB565; + break; case MESA_FORMAT_ARGB4444: - assert(_mesa_little_endian()); - cbpitch |= R300_COLOR_FORMAT_ARGB4444; - break; + assert(_mesa_little_endian()); + cbpitch |= R300_COLOR_FORMAT_ARGB4444; + break; case MESA_FORMAT_ARGB4444_REV: - assert(!_mesa_little_endian()); - cbpitch |= R300_COLOR_FORMAT_ARGB4444; - break; - case MESA_FORMAT_ARGB1555: - assert(_mesa_little_endian()); - cbpitch |= R300_COLOR_FORMAT_ARGB1555; - break; - case MESA_FORMAT_ARGB1555_REV: - assert(!_mesa_little_endian()); - cbpitch |= R300_COLOR_FORMAT_ARGB1555; - break; - default: - _mesa_problem(ctx, "unexpected format in emit_cb_offset()"); - } + assert(!_mesa_little_endian()); + cbpitch |= R300_COLOR_FORMAT_ARGB4444; + break; + case MESA_FORMAT_ARGB1555: + assert(_mesa_little_endian()); + cbpitch |= R300_COLOR_FORMAT_ARGB1555; + break; + case MESA_FORMAT_ARGB1555_REV: + assert(!_mesa_little_endian()); + cbpitch |= R300_COLOR_FORMAT_ARGB1555; + break; + default: + if (cpp == 4) { + cbpitch |= R300_COLOR_FORMAT_ARGB8888; + } else { + _mesa_problem(r300->radeon.glCtx, "unexpected format in emit_cb_offset()");; + } + break; + } - if (rrb->bo->flags & RADEON_BO_FLAGS_MACRO_TILE) - cbpitch |= R300_COLOR_TILE_ENABLE; + if (bo->flags & RADEON_BO_FLAGS_MACRO_TILE) + cbpitch |= R300_COLOR_TILE_ENABLE; + + if (r300->radeon.radeonScreen->kernel_mm) + dw += 2; + + BEGIN_BATCH_NO_AUTOSTATE(dw); + OUT_BATCH_REGSEQ(R300_RB3D_COLOROFFSET0, 1); + OUT_BATCH_RELOC(offset, bo, offset, 0, RADEON_GEM_DOMAIN_VRAM, 0); + OUT_BATCH_REGSEQ(R300_RB3D_COLORPITCH0, 1); + if (!r300->radeon.radeonScreen->kernel_mm) + OUT_BATCH(cbpitch); + else + OUT_BATCH_RELOC(cbpitch, bo, cbpitch, 0, RADEON_GEM_DOMAIN_VRAM, 0); + END_BATCH(); +} + +static void emit_cb_offset_atom(GLcontext *ctx, struct radeon_state_atom * atom) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + struct radeon_renderbuffer *rrb; + uint32_t offset = r300->radeon.state.color.draw_offset; + + rrb = radeon_get_colorbuffer(&r300->radeon); + if (!rrb || !rrb->bo) { + fprintf(stderr, "no rrb\n"); + return; + } + + if (RADEON_DEBUG & RADEON_STATE) + fprintf(stderr,"rrb is %p %d %dx%d\n", rrb, offset, rrb->base.Width, rrb->base.Height); + + r300_emit_cb_setup(r300, rrb->bo, offset, rrb->base.Format, rrb->cpp, rrb->pitch); - if (r300->radeon.radeonScreen->kernel_mm) - dw += 2; - BEGIN_BATCH_NO_AUTOSTATE(dw); - OUT_BATCH_REGSEQ(R300_RB3D_COLOROFFSET0, 1); - OUT_BATCH_RELOC(offset, rrb->bo, offset, 0, RADEON_GEM_DOMAIN_VRAM, 0); - OUT_BATCH_REGSEQ(R300_RB3D_COLORPITCH0, 1); - if (!r300->radeon.radeonScreen->kernel_mm) - OUT_BATCH(cbpitch); - else - OUT_BATCH_RELOC(cbpitch, rrb->bo, cbpitch, 0, RADEON_GEM_DOMAIN_VRAM, 0); - END_BATCH(); if (r300->radeon.radeonScreen->driScreen->dri2.enabled) { - if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { - BEGIN_BATCH_NO_AUTOSTATE(3); - OUT_BATCH_REGSEQ(R300_SC_SCISSORS_TL, 2); - OUT_BATCH(0); - OUT_BATCH(((rrb->base.Width - 1) << R300_SCISSORS_X_SHIFT) | - ((rrb->base.Height - 1) << R300_SCISSORS_Y_SHIFT)); - END_BATCH(); - BEGIN_BATCH_NO_AUTOSTATE(16); - for (i = 0; i < 4; i++) { - OUT_BATCH_REGSEQ(R300_SC_CLIPRECT_TL_0 + (i * 8), 2); - OUT_BATCH((0 << R300_CLIPRECT_X_SHIFT) | (0 << R300_CLIPRECT_Y_SHIFT)); - OUT_BATCH(((rrb->base.Width - 1) << R300_CLIPRECT_X_SHIFT) | ((rrb->base.Height - 1) << R300_CLIPRECT_Y_SHIFT)); - } - OUT_BATCH_REGSEQ(R300_SC_CLIP_RULE, 1); - OUT_BATCH(0xAAAA); - OUT_BATCH_REGSEQ(R300_SC_SCREENDOOR, 1); - OUT_BATCH(0xffffff); - END_BATCH(); - } else { - BEGIN_BATCH_NO_AUTOSTATE(3); - OUT_BATCH_REGSEQ(R300_SC_SCISSORS_TL, 2); - OUT_BATCH((R300_SCISSORS_OFFSET << R300_SCISSORS_X_SHIFT) | - (R300_SCISSORS_OFFSET << R300_SCISSORS_Y_SHIFT)); - OUT_BATCH(((rrb->base.Width + R300_SCISSORS_OFFSET - 1) << R300_SCISSORS_X_SHIFT) | - ((rrb->base.Height + R300_SCISSORS_OFFSET - 1) << R300_SCISSORS_Y_SHIFT)); - END_BATCH(); - BEGIN_BATCH_NO_AUTOSTATE(16); - for (i = 0; i < 4; i++) { - OUT_BATCH_REGSEQ(R300_SC_CLIPRECT_TL_0 + (i * 8), 2); - OUT_BATCH((R300_SCISSORS_OFFSET << R300_CLIPRECT_X_SHIFT) | (R300_SCISSORS_OFFSET << R300_CLIPRECT_Y_SHIFT)); - OUT_BATCH(((R300_SCISSORS_OFFSET + rrb->base.Width - 1) << R300_CLIPRECT_X_SHIFT) | - ((R300_SCISSORS_OFFSET + rrb->base.Height - 1) << R300_CLIPRECT_Y_SHIFT)); - } - OUT_BATCH_REGSEQ(R300_SC_CLIP_RULE, 1); - OUT_BATCH(0xAAAA); - OUT_BATCH_REGSEQ(R300_SC_SCREENDOOR, 1); - OUT_BATCH(0xffffff); - END_BATCH(); - } + emit_scissor(r300, rrb->base.Width, rrb->base.Height); } } @@ -693,7 +719,7 @@ void r300InitCmdBuf(r300ContextPtr r300) ALLOC_STATE(rop, always, 2, 0); r300->hw.rop.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R300_RB3D_ROPCNTL, 1); ALLOC_STATE(cb, cb_offset, R300_CB_CMDSIZE, 0); - r300->hw.cb.emit = &emit_cb_offset; + r300->hw.cb.emit = &emit_cb_offset_atom; ALLOC_STATE(rb3d_dither_ctl, always, 10, 0); r300->hw.rb3d_dither_ctl.cmd[0] = cmdpacket0(r300->radeon.radeonScreen, R300_RB3D_DITHER_CTL, 9); ALLOC_STATE(rb3d_aaresolve_ctl, always, 2, 0); diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.h b/src/mesa/drivers/dri/r300/r300_cmdbuf.h index 1b703e518a..4cde1e2dcf 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.h +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.h @@ -54,4 +54,11 @@ void emit_r500fp(GLcontext *ctx, struct radeon_state_atom * atom); int check_r500fp(GLcontext *ctx, struct radeon_state_atom *atom); int check_r500fp_const(GLcontext *ctx, struct radeon_state_atom *atom); -#endif /* __R300_CMDBUF_H__ */ +void r300_emit_cb_setup(struct r300_context *r300, + struct radeon_bo *bo, + uint32_t offset, + GLuint format, + unsigned cpp, + unsigned pitch); + +#endif /* __R300_CMDBUF_H__ */ -- cgit v1.2.3 From 545a2f4f2d94b663e67cf1e682b49d088dd7ee90 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 7 Nov 2009 19:51:44 +0100 Subject: r300: refactor R500 fragment program emission --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 63 ++++++++++++++++++++------------- src/mesa/drivers/dri/r300/r300_cmdbuf.h | 11 +++--- 2 files changed, 45 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 57641998a4..09a6a033d1 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -107,32 +107,45 @@ void emit_vpu(GLcontext *ctx, struct radeon_state_atom * atom) END_BATCH(); } -void emit_r500fp(GLcontext *ctx, struct radeon_state_atom * atom) +void r500_emit_fp(struct r300_context *r300, + uint32_t *data, + unsigned len, + uint32_t addr, + unsigned type, + unsigned clamp) { - r300ContextPtr r300 = R300_CONTEXT(ctx); - BATCH_LOCALS(&r300->radeon); - drm_r300_cmd_header_t cmd; - uint32_t addr, ndw, sz; - int type, clamp; + BATCH_LOCALS(&r300->radeon); - ndw = atom->check(ctx, atom); + addr |= (type << 16); + addr |= (clamp << 17); - cmd.u = atom->cmd[0]; - sz = cmd.r500fp.count; - addr = ((cmd.r500fp.adrhi_flags & 1) << 8) | cmd.r500fp.adrlo; - type = !!(cmd.r500fp.adrhi_flags & R500FP_CONSTANT_TYPE); - clamp = !!(cmd.r500fp.adrhi_flags & R500FP_CONSTANT_CLAMP); + BEGIN_BATCH_NO_AUTOSTATE(len + 3); + OUT_BATCH(CP_PACKET0(R500_GA_US_VECTOR_INDEX, 0)); + OUT_BATCH(addr); + OUT_BATCH(CP_PACKET0(R500_GA_US_VECTOR_DATA, len-1) | RADEON_ONE_REG_WR); + OUT_BATCH_TABLE(data, len); + END_BATCH(); +} - addr |= (type << 16); - addr |= (clamp << 17); +static void emit_r500fp_atom(GLcontext *ctx, struct radeon_state_atom * atom) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + drm_r300_cmd_header_t cmd; + uint32_t addr, count; + int type, clamp; - BEGIN_BATCH_NO_AUTOSTATE(ndw); - OUT_BATCH(CP_PACKET0(R500_GA_US_VECTOR_INDEX, 0)); - OUT_BATCH(addr); - ndw-=3; - OUT_BATCH(CP_PACKET0(R500_GA_US_VECTOR_DATA, ndw-1) | RADEON_ONE_REG_WR); - OUT_BATCH_TABLE(&atom->cmd[1], ndw); - END_BATCH(); + cmd.u = atom->cmd[0]; + addr = ((cmd.r500fp.adrhi_flags & 1) << 8) | cmd.r500fp.adrlo; + type = !!(cmd.r500fp.adrhi_flags & R500FP_CONSTANT_TYPE); + clamp = !!(cmd.r500fp.adrhi_flags & R500FP_CONSTANT_CLAMP); + + if (type) { + count = r500fp_count(atom->cmd) * 4; + } else { + count = r500fp_count(atom->cmd) * 6; + } + + r500_emit_fp(r300, &atom->cmd[1], count, addr, type, clamp); } static int check_tex_offsets(GLcontext *ctx, struct radeon_state_atom * atom) @@ -480,7 +493,7 @@ static int check_variable(GLcontext *ctx, struct radeon_state_atom *atom) return cnt ? cnt + 1 : 0; } -int check_r500fp(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_r500fp(GLcontext *ctx, struct radeon_state_atom *atom) { int cnt; r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -492,7 +505,7 @@ int check_r500fp(GLcontext *ctx, struct radeon_state_atom *atom) return cnt ? (cnt * 6) + extra : 0; } -int check_r500fp_const(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_r500fp_const(GLcontext *ctx, struct radeon_state_atom *atom) { int cnt; r300ContextPtr r300 = R300_CONTEXT(ctx); @@ -669,13 +682,13 @@ void r300InitCmdBuf(r300ContextPtr r300) r300->hw.r500fp.cmd[R300_FPI_CMD_0] = cmdr500fp(r300->radeon.radeonScreen, 0, 0, 0, 0); if (r300->radeon.radeonScreen->kernel_mm) - r300->hw.r500fp.emit = emit_r500fp; + r300->hw.r500fp.emit = emit_r500fp_atom; ALLOC_STATE(r500fp_const, r500fp_const, R500_FPP_CMDSIZE, 0); r300->hw.r500fp_const.cmd[R300_FPI_CMD_0] = cmdr500fp(r300->radeon.radeonScreen, 0, 0, 1, 0); if (r300->radeon.radeonScreen->kernel_mm) - r300->hw.r500fp_const.emit = emit_r500fp; + r300->hw.r500fp_const.emit = emit_r500fp_atom; } else { ALLOC_STATE(fp, always, R300_FP_CMDSIZE, 0); r300->hw.fp.cmd[R300_FP_CMD_0] = cmdpacket0(r300->radeon.radeonScreen, R300_US_CONFIG, 3); diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.h b/src/mesa/drivers/dri/r300/r300_cmdbuf.h index 4cde1e2dcf..ee2db6e21d 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.h +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.h @@ -44,15 +44,18 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #define FIREAOS_BUFSZ (3) #define SCISSORS_BUFSZ (3) -extern void r300InitCmdBuf(r300ContextPtr r300); +void r300InitCmdBuf(r300ContextPtr r300); void r300_emit_scissor(GLcontext *ctx); void emit_vpu(GLcontext *ctx, struct radeon_state_atom * atom); int check_vpu(GLcontext *ctx, struct radeon_state_atom *atom); -void emit_r500fp(GLcontext *ctx, struct radeon_state_atom * atom); -int check_r500fp(GLcontext *ctx, struct radeon_state_atom *atom); -int check_r500fp_const(GLcontext *ctx, struct radeon_state_atom *atom); +void r500_emit_fp(struct r300_context *r300, + uint32_t *data, + unsigned len, + uint32_t addr, + unsigned type, + unsigned clamp); void r300_emit_cb_setup(struct r300_context *r300, struct radeon_bo *bo, -- cgit v1.2.3 From 9975c484ad828c80089c718dcdbdb2040f45b67b Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 7 Nov 2009 21:13:55 +0100 Subject: r300: refactor PVS code and constants emission --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 54 ++++++++++++++++++--------------- src/mesa/drivers/dri/r300/r300_cmdbuf.h | 6 ++-- 2 files changed, 34 insertions(+), 26 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 09a6a033d1..4b0005e155 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -71,7 +71,7 @@ static unsigned packet0_count(r300ContextPtr r300, uint32_t *pkt) #define vpu_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->vpu.count) #define r500fp_count(ptr) (((drm_r300_cmd_header_t*)(ptr))->r500fp.count) -int check_vpu(GLcontext *ctx, struct radeon_state_atom *atom) +static int check_vpu(GLcontext *ctx, struct radeon_state_atom *atom) { r300ContextPtr r300 = R300_CONTEXT(ctx); int cnt; @@ -85,26 +85,32 @@ int check_vpu(GLcontext *ctx, struct radeon_state_atom *atom) return cnt ? (cnt * 4) + extra : 0; } - -void emit_vpu(GLcontext *ctx, struct radeon_state_atom * atom) +void r300_emit_vpu(struct r300_context *r300, + uint32_t *data, + unsigned len, + uint32_t addr) { - r300ContextPtr r300 = R300_CONTEXT(ctx); - BATCH_LOCALS(&r300->radeon); - drm_r300_cmd_header_t cmd; - uint32_t addr, ndw; + BATCH_LOCALS(&r300->radeon); - cmd.u = atom->cmd[0]; - addr = (cmd.vpu.adrhi << 8) | cmd.vpu.adrlo; - ndw = atom->check(ctx, atom); + BEGIN_BATCH_NO_AUTOSTATE(5 + len); + OUT_BATCH_REGVAL(R300_VAP_PVS_STATE_FLUSH_REG, 0); + OUT_BATCH_REGVAL(R300_VAP_PVS_VECTOR_INDX_REG, addr); + OUT_BATCH(CP_PACKET0(R300_VAP_PVS_UPLOAD_DATA, len-1) | RADEON_ONE_REG_WR); + OUT_BATCH_TABLE(data, len); + END_BATCH(); +} - BEGIN_BATCH_NO_AUTOSTATE(ndw); +static void emit_vpu_state(GLcontext *ctx, struct radeon_state_atom * atom) +{ + r300ContextPtr r300 = R300_CONTEXT(ctx); + drm_r300_cmd_header_t cmd; + uint32_t addr, ndw; - ndw -= 5; - OUT_BATCH_REGVAL(R300_VAP_PVS_VECTOR_INDX_REG, addr); - OUT_BATCH(CP_PACKET0(R300_VAP_PVS_UPLOAD_DATA, ndw-1) | RADEON_ONE_REG_WR); - OUT_BATCH_TABLE(&atom->cmd[1], ndw); - OUT_BATCH_REGVAL(R300_VAP_PVS_STATE_FLUSH_REG, 0); - END_BATCH(); + cmd.u = atom->cmd[0]; + addr = (cmd.vpu.adrhi << 8) | cmd.vpu.adrlo; + ndw = atom->check(ctx, atom); + + r300_emit_vpu(r300, &atom->cmd[1], vpu_count(atom->cmd) * 4, addr); } void r500_emit_fp(struct r300_context *r300, @@ -796,20 +802,20 @@ void r300InitCmdBuf(r300ContextPtr r300) r300->hw.vpi.cmd[0] = cmdvpu(r300->radeon.radeonScreen, R300_PVS_CODE_START, 0); if (r300->radeon.radeonScreen->kernel_mm) - r300->hw.vpi.emit = emit_vpu; + r300->hw.vpi.emit = emit_vpu_state; if (is_r500) { ALLOC_STATE(vpp, vpu, R300_VPP_CMDSIZE, 0); r300->hw.vpp.cmd[0] = cmdvpu(r300->radeon.radeonScreen, R500_PVS_CONST_START, 0); if (r300->radeon.radeonScreen->kernel_mm) - r300->hw.vpp.emit = emit_vpu; + r300->hw.vpp.emit = emit_vpu_state; ALLOC_STATE(vps, vpu, R300_VPS_CMDSIZE, 0); r300->hw.vps.cmd[0] = cmdvpu(r300->radeon.radeonScreen, R500_POINT_VPORT_SCALE_OFFSET, 1); if (r300->radeon.radeonScreen->kernel_mm) - r300->hw.vps.emit = emit_vpu; + r300->hw.vps.emit = emit_vpu_state; for (i = 0; i < 6; i++) { ALLOC_STATE(vpucp[i], vpu, R300_VPUCP_CMDSIZE, 0); @@ -817,20 +823,20 @@ void r300InitCmdBuf(r300ContextPtr r300) cmdvpu(r300->radeon.radeonScreen, R500_PVS_UCP_START + i, 1); if (r300->radeon.radeonScreen->kernel_mm) - r300->hw.vpucp[i].emit = emit_vpu; + r300->hw.vpucp[i].emit = emit_vpu_state; } } else { ALLOC_STATE(vpp, vpu, R300_VPP_CMDSIZE, 0); r300->hw.vpp.cmd[0] = cmdvpu(r300->radeon.radeonScreen, R300_PVS_CONST_START, 0); if (r300->radeon.radeonScreen->kernel_mm) - r300->hw.vpp.emit = emit_vpu; + r300->hw.vpp.emit = emit_vpu_state; ALLOC_STATE(vps, vpu, R300_VPS_CMDSIZE, 0); r300->hw.vps.cmd[0] = cmdvpu(r300->radeon.radeonScreen, R300_POINT_VPORT_SCALE_OFFSET, 1); if (r300->radeon.radeonScreen->kernel_mm) - r300->hw.vps.emit = emit_vpu; + r300->hw.vps.emit = emit_vpu_state; for (i = 0; i < 6; i++) { ALLOC_STATE(vpucp[i], vpu, R300_VPUCP_CMDSIZE, 0); @@ -838,7 +844,7 @@ void r300InitCmdBuf(r300ContextPtr r300) cmdvpu(r300->radeon.radeonScreen, R300_PVS_UCP_START + i, 1); if (r300->radeon.radeonScreen->kernel_mm) - r300->hw.vpucp[i].emit = emit_vpu; + r300->hw.vpucp[i].emit = emit_vpu_state; } } } diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.h b/src/mesa/drivers/dri/r300/r300_cmdbuf.h index ee2db6e21d..0e68da928e 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.h +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.h @@ -47,8 +47,10 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. void r300InitCmdBuf(r300ContextPtr r300); void r300_emit_scissor(GLcontext *ctx); -void emit_vpu(GLcontext *ctx, struct radeon_state_atom * atom); -int check_vpu(GLcontext *ctx, struct radeon_state_atom *atom); +void r300_emit_vpu(struct r300_context *ctx, + uint32_t *data, + unsigned len, + uint32_t addr); void r500_emit_fp(struct r300_context *r300, uint32_t *data, -- cgit v1.2.3 From bd58253f675cb37b7521f082f80a3fd9cab6eff1 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 7 Nov 2009 22:48:23 +0100 Subject: r300: export translateTexFormat function --- src/mesa/drivers/dri/r300/r300_tex.h | 2 ++ src/mesa/drivers/dri/r300/r300_texstate.c | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_tex.h b/src/mesa/drivers/dri/r300/r300_tex.h index 8a653ea2d1..beb10072e9 100644 --- a/src/mesa/drivers/dri/r300/r300_tex.h +++ b/src/mesa/drivers/dri/r300/r300_tex.h @@ -51,4 +51,6 @@ extern GLboolean r300ValidateBuffers(GLcontext * ctx); extern void r300InitTextureFuncs(struct dd_function_table *functions); +uint32_t r300TranslateTexFormat(gl_format mesaFormat); + #endif /* __r300_TEX_H__ */ diff --git a/src/mesa/drivers/dri/r300/r300_texstate.c b/src/mesa/drivers/dri/r300/r300_texstate.c index 68b90d3106..6db56ba618 100644 --- a/src/mesa/drivers/dri/r300/r300_texstate.c +++ b/src/mesa/drivers/dri/r300/r300_texstate.c @@ -59,7 +59,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * identically. -- paulus */ -static uint32_t translateTexFormat(gl_format mesaFormat) +uint32_t r300TranslateTexFormat(gl_format mesaFormat) { switch (mesaFormat) { @@ -168,8 +168,6 @@ static uint32_t translateTexFormat(gl_format mesaFormat) case MESA_FORMAT_SRGBA_DXT5: return R300_EASY_TX_FORMAT(Y, Z, W, X, DXT5) | R300_TX_FORMAT_GAMMA; default: - fprintf(stderr, "%s: Invalid format %s", __FUNCTION__, _mesa_get_format_name(mesaFormat)); - assert(0); return 0; } }; @@ -254,7 +252,12 @@ static void setup_hardware_state(r300ContextPtr rmesa, radeonTexObj *t) if (firstImage->_BaseFormat == GL_DEPTH_COMPONENT) { r300SetDepthTexMode(&t->base); } else { - t->pp_txformat = translateTexFormat(firstImage->TexFormat); + t->pp_txformat = r300TranslateTexFormat(firstImage->TexFormat); + if (t->pp_txformat == 0) { + _mesa_problem(rmesa->radeon.glCtx, "%s: Invalid format %s", + __FUNCTION__, _mesa_get_format_name(firstImage->TexFormat)); + _mesa_exit(1); + } } } -- cgit v1.2.3 From 0a0d410bdbbc9ea9b56fca51e077de32d629d20d Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 8 Nov 2009 21:44:24 +0100 Subject: r300: fix wrong assertion --- src/mesa/drivers/dri/r300/r300_cmdbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_cmdbuf.c b/src/mesa/drivers/dri/r300/r300_cmdbuf.c index 4b0005e155..e1c33bbb2c 100644 --- a/src/mesa/drivers/dri/r300/r300_cmdbuf.c +++ b/src/mesa/drivers/dri/r300/r300_cmdbuf.c @@ -332,7 +332,7 @@ void r300_emit_cb_setup(struct r300_context *r300, uint32_t cbpitch = pitch / cpp; uint32_t dw = 6; - assert(offset % 256 == 0); + assert(offset % 32 == 0); switch (format) { case MESA_FORMAT_RGB565: -- cgit v1.2.3 From a4df3f9227f1e068792454920d9ec782326da88f Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 8 Nov 2009 22:01:12 +0100 Subject: r300: accelerated blit support --- src/mesa/drivers/dri/r300/Makefile | 1 + src/mesa/drivers/dri/r300/r300_blit.c | 468 +++++++++++++++++++++++++++++++ src/mesa/drivers/dri/r300/r300_blit.h | 46 +++ src/mesa/drivers/dri/r300/r300_context.c | 2 + src/mesa/drivers/dri/r300/r300_context.h | 5 + 5 files changed, 522 insertions(+) create mode 100644 src/mesa/drivers/dri/r300/r300_blit.c create mode 100644 src/mesa/drivers/dri/r300/r300_blit.h (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/Makefile b/src/mesa/drivers/dri/r300/Makefile index 9fd0133fda..b5145d9838 100644 --- a/src/mesa/drivers/dri/r300/Makefile +++ b/src/mesa/drivers/dri/r300/Makefile @@ -43,6 +43,7 @@ RADEON_COMMON_SOURCES = \ DRIVER_SOURCES = \ radeon_screen.c \ + r300_blit.c \ r300_context.c \ r300_draw.c \ r300_cmdbuf.c \ diff --git a/src/mesa/drivers/dri/r300/r300_blit.c b/src/mesa/drivers/dri/r300/r300_blit.c new file mode 100644 index 0000000000..7cb6f36c02 --- /dev/null +++ b/src/mesa/drivers/dri/r300/r300_blit.c @@ -0,0 +1,468 @@ +/* + * Copyright (C) 2009 Maciej Cencora + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 "radeon_common.h" +#include "r300_context.h" + +#include "r300_blit.h" +#include "r300_cmdbuf.h" +#include "r300_emit.h" +#include "r300_tex.h" +#include "compiler/radeon_compiler.h" +#include "compiler/radeon_opcodes.h" + +/** + * TODO: + * - handle depth buffer + * - r300 fp and rs setup + */ + +static void vp_ins_outs(struct r300_vertex_program_compiler *c) +{ + c->code->inputs[VERT_ATTRIB_POS] = 0; + c->code->inputs[VERT_ATTRIB_TEX0] = 1; + c->code->outputs[VERT_RESULT_HPOS] = 0; + c->code->outputs[VERT_RESULT_TEX0] = 1; +} + +static void fp_allocate_hw_inputs( + struct r300_fragment_program_compiler * c, + void (*allocate)(void * data, unsigned input, unsigned hwreg), + void * mydata) +{ + allocate(mydata, FRAG_ATTRIB_TEX0, 0); +} + +static void create_vertex_program(struct r300_context *r300) +{ + struct r300_vertex_program_compiler compiler; + struct rc_instruction *inst; + + rc_init(&compiler.Base); + + inst = rc_insert_new_instruction(&compiler.Base, compiler.Base.Program.Instructions.Prev); + inst->U.I.Opcode = RC_OPCODE_MOV; + inst->U.I.DstReg.File = RC_FILE_OUTPUT; + inst->U.I.DstReg.Index = VERT_RESULT_HPOS; + inst->U.I.DstReg.RelAddr = 0; + inst->U.I.DstReg.WriteMask = RC_MASK_XYZW; + inst->U.I.SrcReg[0].Abs = 0; + inst->U.I.SrcReg[0].File = RC_FILE_INPUT; + inst->U.I.SrcReg[0].Index = VERT_ATTRIB_POS; + inst->U.I.SrcReg[0].Negate = 0; + inst->U.I.SrcReg[0].RelAddr = 0; + inst->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZW; + + inst = rc_insert_new_instruction(&compiler.Base, compiler.Base.Program.Instructions.Prev); + inst->U.I.Opcode = RC_OPCODE_MOV; + inst->U.I.DstReg.File = RC_FILE_OUTPUT; + inst->U.I.DstReg.Index = VERT_RESULT_TEX0; + inst->U.I.DstReg.RelAddr = 0; + inst->U.I.DstReg.WriteMask = RC_MASK_XYZW; + inst->U.I.SrcReg[0].Abs = 0; + inst->U.I.SrcReg[0].File = RC_FILE_INPUT; + inst->U.I.SrcReg[0].Index = VERT_ATTRIB_TEX0; + inst->U.I.SrcReg[0].Negate = 0; + inst->U.I.SrcReg[0].RelAddr = 0; + inst->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZW; + + compiler.Base.Program.InputsRead = (1 << VERT_ATTRIB_POS) | (1 << VERT_ATTRIB_TEX0); + compiler.RequiredOutputs = compiler.Base.Program.OutputsWritten = (1 << VERT_RESULT_HPOS) | (1 << VERT_RESULT_TEX0); + compiler.SetHwInputOutput = vp_ins_outs; + compiler.code = &r300->blit.vp_code; + + r3xx_compile_vertex_program(&compiler); +} + +static void create_fragment_program(struct r300_context *r300) +{ + struct r300_fragment_program_compiler compiler; + struct rc_instruction *inst; + + rc_init(&compiler.Base); + + inst = rc_insert_new_instruction(&compiler.Base, compiler.Base.Program.Instructions.Prev); + inst->U.I.Opcode = RC_OPCODE_TEX; + inst->U.I.TexSrcTarget = RC_TEXTURE_2D; + inst->U.I.TexSrcUnit = 0; + inst->U.I.DstReg.File = RC_FILE_OUTPUT; + inst->U.I.DstReg.Index = FRAG_RESULT_COLOR; + inst->U.I.DstReg.WriteMask = RC_MASK_XYZW; + inst->U.I.SrcReg[0].Abs = 0; + inst->U.I.SrcReg[0].File = RC_FILE_INPUT; + inst->U.I.SrcReg[0].Index = FRAG_ATTRIB_TEX0; + inst->U.I.SrcReg[0].Negate = 0; + inst->U.I.SrcReg[0].RelAddr = 0; + inst->U.I.SrcReg[0].Swizzle = RC_SWIZZLE_XYZW; + + compiler.Base.Program.InputsRead = (1 << FRAG_ATTRIB_TEX0); + compiler.OutputColor = FRAG_RESULT_COLOR; + compiler.OutputDepth = FRAG_RESULT_DEPTH; + compiler.is_r500 = (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515); + compiler.code = &r300->blit.fp_code; + compiler.AllocateHwInputs = fp_allocate_hw_inputs; + + r3xx_compile_fragment_program(&compiler); +} + +void r300_blit_init(struct r300_context *r300) +{ + create_vertex_program(r300); + create_fragment_program(r300); +} + +static void r500_emit_rs_setup(struct r300_context *r300) +{ + BATCH_LOCALS(&r300->radeon); + + BEGIN_BATCH(7); + OUT_BATCH_REGSEQ(R300_RS_COUNT, 2); + OUT_BATCH((4 << R300_IT_COUNT_SHIFT) | R300_HIRES_EN); + OUT_BATCH(0); + OUT_BATCH_REGVAL(R500_RS_INST_0, + (0 << R500_RS_INST_TEX_ID_SHIFT) | + (0 << R500_RS_INST_TEX_ADDR_SHIFT) | + R500_RS_INST_TEX_CN_WRITE | + R500_RS_INST_COL_CN_NO_WRITE); + OUT_BATCH_REGVAL(R500_RS_IP_0, + (0 << R500_RS_IP_TEX_PTR_S_SHIFT) | + (1 << R500_RS_IP_TEX_PTR_T_SHIFT) | + (2 << R500_RS_IP_TEX_PTR_R_SHIFT) | + (3 << R500_RS_IP_TEX_PTR_Q_SHIFT)); + END_BATCH(); +} + +static void r300_emit_fp_setup(struct r300_context *r300) +{ + assert(0); +} + +static void r300_emit_rs_setup(struct r300_context *r300) +{ + assert(0); +} + +static void r300_emit_tx_setup(struct r300_context *r300, + gl_format mesa_format, + struct radeon_bo *bo, + intptr_t offset, + unsigned width, + unsigned height, + unsigned pitch) +{ + BATCH_LOCALS(&r300->radeon); + + assert(width <= 2048); + assert(height <= 2048); + assert(r300TranslateTexFormat(mesa_format) != 0); + assert(offset % 32 == 0); + + BEGIN_BATCH(17); + OUT_BATCH_REGVAL(R300_TX_FILTER0_0, + (R300_TX_CLAMP_TO_EDGE << R300_TX_WRAP_S_SHIFT) | + (R300_TX_CLAMP_TO_EDGE << R300_TX_WRAP_T_SHIFT) | + (R300_TX_CLAMP_TO_EDGE << R300_TX_WRAP_R_SHIFT) | + R300_TX_MIN_FILTER_MIP_NONE | + R300_TX_MIN_FILTER_LINEAR | + R300_TX_MAG_FILTER_LINEAR | + (0 << 28)); + OUT_BATCH_REGVAL(R300_TX_FILTER1_0, 0); + OUT_BATCH_REGVAL(R300_TX_SIZE_0, + ((width-1) << R300_TX_WIDTHMASK_SHIFT) | + ((height-1) << R300_TX_HEIGHTMASK_SHIFT) | + (0 << R300_TX_DEPTHMASK_SHIFT) | + (0 << R300_TX_MAX_MIP_LEVEL_SHIFT) | + R300_TX_SIZE_TXPITCH_EN); + + OUT_BATCH_REGVAL(R300_TX_FORMAT_0, r300TranslateTexFormat(mesa_format)); + OUT_BATCH_REGVAL(R300_TX_FORMAT2_0, pitch/_mesa_get_format_bytes(mesa_format) - 1); + OUT_BATCH_REGSEQ(R300_TX_OFFSET_0, 1); + OUT_BATCH_RELOC(0, bo, offset, RADEON_GEM_DOMAIN_GTT|RADEON_GEM_DOMAIN_VRAM, 0, 0); + + OUT_BATCH_REGSEQ(R300_TX_INVALTAGS, 2); + OUT_BATCH(0); + OUT_BATCH(1); + + END_BATCH(); +} + +#define EASY_US_FORMAT(FMT, C0, C1, C2, C3, SIGN) \ + (FMT | R500_C0_SEL_##C0 | R500_C1_SEL_##C1 | \ + R500_C2_SEL_##C2 | R500_C3_SEL_##C3 | R500_OUT_SIGN(SIGN)) + +static uint32_t mesa_format_to_us_format(gl_format mesa_format) +{ + switch(mesa_format) + { + case MESA_FORMAT_RGBA8888: // x + return EASY_US_FORMAT(R500_OUT_FMT_C4_8, A, B, G, R, 0); + case MESA_FORMAT_RGB565: // x + case MESA_FORMAT_ARGB1555: // x + case MESA_FORMAT_RGBA8888_REV: // x + return EASY_US_FORMAT(R500_OUT_FMT_C4_8, R, G, B, A, 0); + case MESA_FORMAT_ARGB8888: // x + return EASY_US_FORMAT(R500_OUT_FMT_C4_8, B, G, R, A, 0); + case MESA_FORMAT_ARGB8888_REV: + return EASY_US_FORMAT(R500_OUT_FMT_C4_8, A, R, G, B, 0); + case MESA_FORMAT_XRGB8888: + return EASY_US_FORMAT(R500_OUT_FMT_C4_8, A, R, G, B, 0); + + case MESA_FORMAT_RGB332: + return EASY_US_FORMAT(R500_OUT_FMT_C_3_3_2, A, R, G, B, 0); + + case MESA_FORMAT_RGBA_FLOAT32: + return EASY_US_FORMAT(R500_OUT_FMT_C4_32_FP, R, G, B, A, 0); + case MESA_FORMAT_RGBA_FLOAT16: + return EASY_US_FORMAT(R500_OUT_FMT_C4_16_FP, R, G, B, A, 0); + case MESA_FORMAT_ALPHA_FLOAT32: + return EASY_US_FORMAT(R500_OUT_FMT_C_32_FP, A, A, A, A, 0); + case MESA_FORMAT_ALPHA_FLOAT16: + return EASY_US_FORMAT(R500_OUT_FMT_C_16_FP, A, A, A, A, 0); + + case MESA_FORMAT_SIGNED_RGBA8888: + return EASY_US_FORMAT(R500_OUT_FMT_C4_8, R, G, B, A, 0xf); + case MESA_FORMAT_SIGNED_RGBA8888_REV: + return EASY_US_FORMAT(R500_OUT_FMT_C4_8, A, B, G, R, 0xf); + case MESA_FORMAT_SIGNED_RGBA_16: + return EASY_US_FORMAT(R500_OUT_FMT_C4_16, R, G, B, A, 0xf); + + default: + assert(!"Invalid format for US output\n"); + return 0; + } +} +#undef EASY_US_FORMAT + +static void r500_emit_fp_setup(struct r300_context *r300, + struct r500_fragment_program_code *fp, + gl_format dst_format) +{ + r500_emit_fp(r300, (uint32_t *)fp->inst, (fp->inst_end + 1) * 6, 0, 0, 0); + BATCH_LOCALS(&r300->radeon); + + BEGIN_BATCH(10); + OUT_BATCH_REGSEQ(R500_US_CODE_ADDR, 3); + OUT_BATCH(R500_US_CODE_START_ADDR(0) | R500_US_CODE_END_ADDR(fp->inst_end)); + OUT_BATCH(R500_US_CODE_RANGE_ADDR(0) | R500_US_CODE_RANGE_SIZE(fp->inst_end)); + OUT_BATCH(0); + OUT_BATCH_REGVAL(R500_US_CONFIG, 0); + OUT_BATCH_REGVAL(R500_US_OUT_FMT_0, mesa_format_to_us_format(dst_format)); + OUT_BATCH_REGVAL(R500_US_PIXSIZE, fp->max_temp_idx); + END_BATCH(); +} + +static void emit_pvs_setup(struct r300_context *r300, + uint32_t *vp_code, + unsigned vp_len) +{ + BATCH_LOCALS(&r300->radeon); + + r300_emit_vpu(r300, vp_code, vp_len * 4, R300_PVS_CODE_START); + + BEGIN_BATCH(4); + OUT_BATCH_REGSEQ(R300_VAP_PVS_CODE_CNTL_0, 3); + OUT_BATCH((0 << R300_PVS_FIRST_INST_SHIFT) | + ((vp_len - 1) << R300_PVS_XYZW_VALID_INST_SHIFT) | + ((vp_len - 1)<< R300_PVS_LAST_INST_SHIFT)); + OUT_BATCH(0); + OUT_BATCH((vp_len - 1) << R300_PVS_LAST_VTX_SRC_INST_SHIFT); + END_BATCH(); +} + +static void emit_vap_setup(struct r300_context *r300, unsigned width, unsigned height) +{ + BATCH_LOCALS(&r300->radeon); + + BEGIN_BATCH(12); + OUT_BATCH_REGSEQ(R300_SE_VTE_CNTL, 2); + OUT_BATCH(R300_VTX_XY_FMT | R300_VTX_Z_FMT); + OUT_BATCH(4); + + OUT_BATCH_REGVAL(R300_VAP_PSC_SGN_NORM_CNTL, 0xaaaaaaaa); + OUT_BATCH_REGVAL(R300_VAP_PROG_STREAM_CNTL_0, + ((R300_DATA_TYPE_FLOAT_2 | (0 << R300_DST_VEC_LOC_SHIFT)) << 0) | + (((1 << R300_DST_VEC_LOC_SHIFT) | R300_DATA_TYPE_FLOAT_2 | R300_LAST_VEC) << 16)); + OUT_BATCH_REGVAL(R300_VAP_PROG_STREAM_CNTL_EXT_0, + ((((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_SHIFT) | + (R300_SWIZZLE_SELECT_Y << R300_SWIZZLE_SELECT_Y_SHIFT) | + (R300_SWIZZLE_SELECT_FP_ZERO << R300_SWIZZLE_SELECT_Z_SHIFT) | + (R300_SWIZZLE_SELECT_FP_ONE << R300_SWIZZLE_SELECT_W_SHIFT) | + (0xf << R300_WRITE_ENA_SHIFT) ) << 0) | + (((R300_SWIZZLE_SELECT_X << R300_SWIZZLE_SELECT_X_SHIFT) | + (R300_SWIZZLE_SELECT_Y << R300_SWIZZLE_SELECT_Y_SHIFT) | + (R300_SWIZZLE_SELECT_FP_ZERO << R300_SWIZZLE_SELECT_Z_SHIFT) | + (R300_SWIZZLE_SELECT_FP_ONE << R300_SWIZZLE_SELECT_W_SHIFT) | + (0xf << R300_WRITE_ENA_SHIFT) ) << 16) ) ); + OUT_BATCH_REGSEQ(R300_VAP_OUTPUT_VTX_FMT_0, 2); + OUT_BATCH(R300_VAP_OUTPUT_VTX_FMT_0__POS_PRESENT); + OUT_BATCH(R300_VAP_OUTPUT_VTX_FMT_1__4_COMPONENTS); + END_BATCH(); +} + +static GLboolean validate_buffers(struct r300_context *r300, + struct radeon_bo *src_bo, + struct radeon_bo *dst_bo) +{ + int ret; + radeon_cs_space_add_persistent_bo(r300->radeon.cmdbuf.cs, + src_bo, RADEON_GEM_DOMAIN_VRAM, 0); + + radeon_cs_space_add_persistent_bo(r300->radeon.cmdbuf.cs, + dst_bo, 0, RADEON_GEM_DOMAIN_VRAM); + + ret = radeon_cs_space_check_with_bo(r300->radeon.cmdbuf.cs, + first_elem(&r300->radeon.dma.reserved)->bo, + RADEON_GEM_DOMAIN_GTT, 0); + if (ret) + return GL_FALSE; + + return GL_TRUE; +} + +static void emit_draw_packet(struct r300_context *r300, float width, float height) +{ + float verts[] = { 0.0, 0.0, 0.0, 1.0, + 0.0, height, 0.0, 0.0, + width, height, 1.0, 0.0, + width, 0.0, 1.0, 1.0 }; + + BATCH_LOCALS(&r300->radeon); + + BEGIN_BATCH(19); + OUT_BATCH_PACKET3(R300_PACKET3_3D_DRAW_IMMD_2, 16); + OUT_BATCH(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_EMBEDDED | + (4 << 16) | R300_VAP_VF_CNTL__PRIM_QUADS); + OUT_BATCH_TABLE(verts, 16); + END_BATCH(); +} + +static void other_stuff(struct r300_context *r300) +{ + BATCH_LOCALS(&r300->radeon); + + BEGIN_BATCH(15); + OUT_BATCH_REGVAL(R300_GA_POLY_MODE, + R300_GA_POLY_MODE_FRONT_PTYPE_TRI | R300_GA_POLY_MODE_BACK_PTYPE_TRI); + OUT_BATCH_REGVAL(R300_SU_CULL_MODE, R300_FRONT_FACE_CCW); + OUT_BATCH_REGVAL(R300_FG_FOG_BLEND, 0); + OUT_BATCH_REGVAL(R300_FG_ALPHA_FUNC, 0); + OUT_BATCH_REGSEQ(R300_RB3D_CBLEND, 2); + OUT_BATCH(0x0); + OUT_BATCH(0x0); + OUT_BATCH_REGVAL(R300_VAP_CLIP_CNTL, R300_CLIP_DISABLE); + OUT_BATCH_REGVAL(R300_ZB_CNTL, 0); + END_BATCH(); +} + +static void emit_cb_setup(struct r300_context *r300, + struct radeon_bo *bo, + intptr_t offset, + gl_format mesa_format, + unsigned width, + unsigned height) +{ + BATCH_LOCALS(&r300->radeon); + + unsigned x1, y1, x2, y2; + x1 = 0; + y1 = 0; + x2 = width - 1; + y2 = height - 1; + + if (r300->radeon.radeonScreen->chip_family < CHIP_FAMILY_RV515) { + x1 += R300_SCISSORS_OFFSET; + y1 += R300_SCISSORS_OFFSET; + x2 += R300_SCISSORS_OFFSET; + y2 += R300_SCISSORS_OFFSET; + } + + r300_emit_cb_setup(r300, bo, offset, mesa_format, + _mesa_get_format_bytes(mesa_format), + _mesa_format_row_stride(mesa_format, width)); + + BEGIN_BATCH_NO_AUTOSTATE(3); + OUT_BATCH_REGSEQ(R300_SC_SCISSORS_TL, 2); + OUT_BATCH((x1 << R300_SCISSORS_X_SHIFT)|(y1 << R300_SCISSORS_Y_SHIFT)); + OUT_BATCH((x2 << R300_SCISSORS_X_SHIFT)|(y2 << R300_SCISSORS_Y_SHIFT)); + END_BATCH(); +} + +GLboolean r300_blit(struct r300_context *r300, + struct radeon_bo *src_bo, + intptr_t src_offset, + gl_format src_mesaformat, + unsigned src_pitch, + unsigned src_width, + unsigned src_height, + struct radeon_bo *dst_bo, + intptr_t dst_offset, + gl_format dst_mesaformat, + unsigned dst_width, + unsigned dst_height) +{ + assert(src_width == dst_width); + assert(src_height == dst_height); + + if (0) { + fprintf(stderr, "src: width %d, height %d, pitch %d vs %d, format %s\n", + src_width, src_height, src_pitch, + _mesa_format_row_stride(src_mesaformat, src_width), + _mesa_get_format_name(src_mesaformat)); + fprintf(stderr, "dst: width %d, height %d, pitch %d, format %s\n", + dst_width, dst_height, + _mesa_format_row_stride(dst_mesaformat, dst_width), + _mesa_get_format_name(dst_mesaformat)); + } + + if (!validate_buffers(r300, src_bo, dst_bo)) + return GL_FALSE; + + other_stuff(r300); + + r300_emit_tx_setup(r300, src_mesaformat, src_bo, src_offset, src_width, src_height, src_pitch); + + if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515) { + r500_emit_fp_setup(r300, &r300->blit.fp_code.code.r500, dst_mesaformat); + r500_emit_rs_setup(r300); + } else { + r300_emit_fp_setup(r300); + r300_emit_rs_setup(r300); + } + + emit_pvs_setup(r300, r300->blit.vp_code.body.d, 2); + emit_vap_setup(r300, dst_width, dst_height); + + emit_cb_setup(r300, dst_bo, dst_offset, dst_mesaformat, dst_width, dst_height); + + emit_draw_packet(r300, dst_width, dst_height); + + r300EmitCacheFlush(r300); + + radeonFlush(r300->radeon.glCtx); + + return GL_TRUE; +} \ No newline at end of file diff --git a/src/mesa/drivers/dri/r300/r300_blit.h b/src/mesa/drivers/dri/r300/r300_blit.h new file mode 100644 index 0000000000..29c5aa9514 --- /dev/null +++ b/src/mesa/drivers/dri/r300/r300_blit.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2009 Maciej Cencora + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 R300_BLIT_H +#define R300_BLIT_H + +void r300_blit_init(struct r300_context *r300); + +GLboolean r300_blit(struct r300_context *r300, + struct radeon_bo *src_bo, + intptr_t src_offset, + gl_format src_mesaformat, + unsigned src_pitch, + unsigned src_width, + unsigned src_height, + struct radeon_bo *dst_bo, + intptr_t dst_offset, + gl_format dst_mesaformat, + unsigned dst_width, + unsigned dst_height); + +#endif // R300_BLIT_H \ No newline at end of file diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 67183c3c2a..6995637288 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -60,6 +60,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r300_context.h" #include "radeon_context.h" #include "radeon_span.h" +#include "r300_blit.h" #include "r300_cmdbuf.h" #include "r300_state.h" #include "r300_tex.h" @@ -537,6 +538,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, r300InitSwtcl(ctx); } + r300_blit_init(r300); radeon_fbo_init(&r300->radeon); radeonInitSpanFuncs( ctx ); r300InitCmdBuf(r300); diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 518d5cdbf4..198414a6f8 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -533,6 +533,11 @@ struct r300_context { uint32_t fallback; + struct { + struct r300_vertex_program_code vp_code; + struct rX00_fragment_program_code fp_code; + } blit; + DECLARE_RENDERINPUTS(render_inputs_bitset); }; -- cgit v1.2.3 From 7255a5486dcb3acd5d7d267b9f546aff38685555 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 8 Nov 2009 22:01:17 +0100 Subject: r300: use accelerated emit for CopyTex[Sub]Image functions --- src/mesa/drivers/dri/r300/Makefile | 1 + src/mesa/drivers/dri/r300/r300_context.c | 2 + src/mesa/drivers/dri/r300/r300_context.h | 2 + src/mesa/drivers/dri/r300/r300_texcopy.c | 162 +++++++++++++++++++++++++++++++ 4 files changed, 167 insertions(+) create mode 100644 src/mesa/drivers/dri/r300/r300_texcopy.c (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/Makefile b/src/mesa/drivers/dri/r300/Makefile index b5145d9838..409d126ab2 100644 --- a/src/mesa/drivers/dri/r300/Makefile +++ b/src/mesa/drivers/dri/r300/Makefile @@ -50,6 +50,7 @@ DRIVER_SOURCES = \ r300_state.c \ r300_render.c \ r300_tex.c \ + r300_texcopy.c \ r300_texstate.c \ r300_vertprog.c \ r300_fragprog_common.c \ diff --git a/src/mesa/drivers/dri/r300/r300_context.c b/src/mesa/drivers/dri/r300/r300_context.c index 6995637288..05005f61c3 100644 --- a/src/mesa/drivers/dri/r300/r300_context.c +++ b/src/mesa/drivers/dri/r300/r300_context.c @@ -93,6 +93,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/remap_helper.h" +void r300_init_texcopy_functions(struct dd_function_table *table); static const struct dri_extension card_extensions[] = { /* *INDENT-OFF* */ @@ -485,6 +486,7 @@ GLboolean r300CreateContext(const __GLcontextModes * glVisual, r300_init_vtbl(&r300->radeon); _mesa_init_driver_functions(&functions); + r300_init_texcopy_functions(&functions); r300InitIoctlFuncs(&functions); r300InitStateFuncs(&functions); r300InitTextureFuncs(&functions); diff --git a/src/mesa/drivers/dri/r300/r300_context.h b/src/mesa/drivers/dri/r300/r300_context.h index 198414a6f8..54a92a2e44 100644 --- a/src/mesa/drivers/dri/r300/r300_context.h +++ b/src/mesa/drivers/dri/r300/r300_context.h @@ -554,6 +554,8 @@ extern void r300InitShaderFunctions(r300ContextPtr r300); extern void r300InitDraw(GLcontext *ctx); +extern void r300_init_texcopy_functions(struct dd_function_table *table); + #define r300PackFloat32 radeonPackFloat32 #define r300PackFloat24 radeonPackFloat24 diff --git a/src/mesa/drivers/dri/r300/r300_texcopy.c b/src/mesa/drivers/dri/r300/r300_texcopy.c new file mode 100644 index 0000000000..efbe7538b8 --- /dev/null +++ b/src/mesa/drivers/dri/r300/r300_texcopy.c @@ -0,0 +1,162 @@ +/* + * Copyright (C) 2009 Maciej Cencora + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice (including the + * next paragraph) shall be included in all copies or substantial + * portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) 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 "radeon_common.h" +#include "r300_context.h" + +#include "main/image.h" +#include "main/teximage.h" +#include "main/texstate.h" +#include "drivers/common/meta.h" + +#include "radeon_mipmap_tree.h" +#include "r300_blit.h" +#include
+ +static GLboolean +do_copy_texsubimage(GLcontext *ctx, + GLenum target, GLint level, + struct radeon_tex_obj *tobj, + radeon_texture_image *timg, + GLint dstx, GLint dsty, + GLint x, GLint y, + GLsizei width, GLsizei height) +{ + struct r300_context *r300 = R300_CONTEXT(ctx); + struct radeon_renderbuffer *rrb; + + if (_mesa_get_format_bits(timg->base.TexFormat, GL_DEPTH_BITS) || + _mesa_get_format_bits(timg->base.TexFormat, GL_STENCIL_BITS)) { + rrb = radeon_get_depthbuffer(&r300->radeon); + return GL_FALSE; + } else { + rrb = radeon_get_colorbuffer(&r300->radeon); + } + + assert(rrb && rrb->bo); + assert(timg->mt && timg->mt->bo); + assert(timg->base.Width >= dstx + width); + assert(timg->base.Height >= dsty + height); + assert(tobj->mt == timg->mt); + + intptr_t src_offset = rrb->draw_offset + x * rrb->cpp + y * rrb->pitch; + intptr_t dst_offset = radeon_miptree_image_offset(timg->mt, _mesa_tex_target_to_face(target), level); + dst_offset += dstx * _mesa_get_format_bytes(timg->base.TexFormat) + + dsty * _mesa_format_row_stride(timg->base.TexFormat, timg->base.Width); + + if (0) { + fprintf(stderr, "%s: copying to face %d, level %d\n", + __FUNCTION__, _mesa_tex_target_to_face(target), level); + fprintf(stderr, "to: x %d, y %d, offset %d\n", dstx, dsty, (uint32_t) dst_offset); + fprintf(stderr, "from (%dx%d) width %d, height %d, offset %d, pitch %d, width %d\n", + x, y, width, height, (uint32_t) src_offset, rrb->pitch, rrb->pitch/rrb->cpp); + + } + + /* blit from src buffer to texture */ + return r300_blit(r300, rrb->bo, src_offset, rrb->base.Format, rrb->pitch, + width, height, timg->mt->bo, dst_offset, + timg->base.TexFormat, width, height); +} + +static void +r300CopyTexImage2D(GLcontext *ctx, GLenum target, GLint level, + GLenum internalFormat, + GLint x, GLint y, GLsizei width, GLsizei height, + GLint border) +{ + struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); + struct gl_texture_object *texObj = + _mesa_select_tex_object(ctx, texUnit, target); + struct gl_texture_image *texImage = + _mesa_select_tex_image(ctx, texObj, target, level); + int srcx, srcy, dstx, dsty; + + if (border) + goto fail; + + /* Setup or redefine the texture object, mipmap tree and texture + * image. Don't populate yet. + */ + ctx->Driver.TexImage2D(ctx, target, level, internalFormat, + width, height, border, + GL_RGBA, GL_UNSIGNED_BYTE, NULL, + &ctx->DefaultPacking, texObj, texImage); + + srcx = x; + srcy = y; + dstx = 0; + dsty = 0; + if (!_mesa_clip_copytexsubimage(ctx, + &dstx, &dsty, + &srcx, &srcy, + &width, &height)) { + return; + } + + if (!do_copy_texsubimage(ctx, target, level, + radeon_tex_obj(texObj), (radeon_texture_image *)texImage, + 0, 0, x, y, width, height)) { + goto fail; + } + + return; + +fail: + _mesa_meta_CopyTexImage2D(ctx, target, level, internalFormat, x, y, + width, height, border); +} + +static void +r300CopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, + GLint xoffset, GLint yoffset, + GLint x, GLint y, + GLsizei width, GLsizei height) +{ + struct gl_texture_unit *texUnit = _mesa_get_current_tex_unit(ctx); + struct gl_texture_object *texObj = _mesa_select_tex_object(ctx, texUnit, target); + struct gl_texture_image *texImage = _mesa_select_tex_image(ctx, texObj, target, level); + + assert(target == GL_TEXTURE_2D); + + if (!do_copy_texsubimage(ctx, target, level, + radeon_tex_obj(texObj), (radeon_texture_image *)texImage, + xoffset, yoffset, x, y, width, height)) { + + //DEBUG_FALLBACKS + + _mesa_meta_CopyTexSubImage2D(ctx, target, level, + xoffset, yoffset, x, y, width, height); + } +} + + +void r300_init_texcopy_functions(struct dd_function_table *table) +{ + table->CopyTexImage2D = r300CopyTexImage2D; + table->CopyTexSubImage2D = r300CopyTexSubImage2D; +} \ No newline at end of file -- cgit v1.2.3 From cd5f167353f16fb4f5b349002625b704f3e23778 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Mon, 9 Nov 2009 23:01:35 +0100 Subject: blit WIP --- src/mesa/drivers/dri/r300/r300_blit.c | 15 ++++++++++++--- src/mesa/drivers/dri/r300/r300_texcopy.c | 19 +++++++++++++------ 2 files changed, 25 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_blit.c b/src/mesa/drivers/dri/r300/r300_blit.c index 7cb6f36c02..515a85caa2 100644 --- a/src/mesa/drivers/dri/r300/r300_blit.c +++ b/src/mesa/drivers/dri/r300/r300_blit.c @@ -424,10 +424,16 @@ GLboolean r300_blit(struct r300_context *r300, unsigned dst_width, unsigned dst_height) { - assert(src_width == dst_width); - assert(src_height == dst_height); + //assert(src_width == dst_width); + //assert(src_height == dst_height); - if (0) { + if (src_bo == dst_bo) { + return GL_FALSE; + } + + //return GL_FALSE; + + if (1) { fprintf(stderr, "src: width %d, height %d, pitch %d vs %d, format %s\n", src_width, src_height, src_pitch, _mesa_format_row_stride(src_mesaformat, src_width), @@ -441,6 +447,8 @@ GLboolean r300_blit(struct r300_context *r300, if (!validate_buffers(r300, src_bo, dst_bo)) return GL_FALSE; + rcommonEnsureCmdBufSpace(&r300->radeon, 200, __FUNCTION__); + other_stuff(r300); r300_emit_tx_setup(r300, src_mesaformat, src_bo, src_offset, src_width, src_height, src_pitch); @@ -463,6 +471,7 @@ GLboolean r300_blit(struct r300_context *r300, r300EmitCacheFlush(r300); radeonFlush(r300->radeon.glCtx); + //r300ResetHwState(r300); return GL_TRUE; } \ No newline at end of file diff --git a/src/mesa/drivers/dri/r300/r300_texcopy.c b/src/mesa/drivers/dri/r300/r300_texcopy.c index efbe7538b8..039276eacc 100644 --- a/src/mesa/drivers/dri/r300/r300_texcopy.c +++ b/src/mesa/drivers/dri/r300/r300_texcopy.c @@ -57,29 +57,38 @@ do_copy_texsubimage(GLcontext *ctx, rrb = radeon_get_colorbuffer(&r300->radeon); } + if (!timg->mt) { + radeon_validate_texture_miptree(ctx, &tobj->base); + } + assert(rrb && rrb->bo); - assert(timg->mt && timg->mt->bo); + assert(timg->mt->bo); assert(timg->base.Width >= dstx + width); assert(timg->base.Height >= dsty + height); - assert(tobj->mt == timg->mt); + //assert(tobj->mt == timg->mt); intptr_t src_offset = rrb->draw_offset + x * rrb->cpp + y * rrb->pitch; intptr_t dst_offset = radeon_miptree_image_offset(timg->mt, _mesa_tex_target_to_face(target), level); dst_offset += dstx * _mesa_get_format_bytes(timg->base.TexFormat) + dsty * _mesa_format_row_stride(timg->base.TexFormat, timg->base.Width); - if (0) { + if (src_offset % 32 || dst_offset % 32) { + return GL_FALSE; + } + + if (1) { fprintf(stderr, "%s: copying to face %d, level %d\n", __FUNCTION__, _mesa_tex_target_to_face(target), level); fprintf(stderr, "to: x %d, y %d, offset %d\n", dstx, dsty, (uint32_t) dst_offset); fprintf(stderr, "from (%dx%d) width %d, height %d, offset %d, pitch %d, width %d\n", x, y, width, height, (uint32_t) src_offset, rrb->pitch, rrb->pitch/rrb->cpp); + fprintf(stderr, "src size %d, dst size %d\n", rrb->bo->size, timg->mt->bo->size); } /* blit from src buffer to texture */ return r300_blit(r300, rrb->bo, src_offset, rrb->base.Format, rrb->pitch, - width, height, timg->mt->bo, dst_offset, + rrb->base.Width, rrb->base.Height, timg->mt->bo ? timg->mt->bo : timg->bo, dst_offset, timg->base.TexFormat, width, height); } @@ -141,8 +150,6 @@ r300CopyTexSubImage2D(GLcontext *ctx, GLenum target, GLint level, struct gl_texture_object *texObj = _mesa_select_tex_object(ctx, texUnit, target); struct gl_texture_image *texImage = _mesa_select_tex_image(ctx, texObj, target, level); - assert(target == GL_TEXTURE_2D); - if (!do_copy_texsubimage(ctx, target, level, radeon_tex_obj(texObj), (radeon_texture_image *)texImage, xoffset, yoffset, x, y, width, height)) { -- cgit v1.2.3 From c1a7cc1e44e2c318eaa1de67893d20774f6fec5f Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Tue, 10 Nov 2009 19:47:04 +0100 Subject: more blit fixes --- src/mesa/drivers/dri/r300/r300_blit.c | 2 ++ src/mesa/drivers/dri/r300/r300_texcopy.c | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_blit.c b/src/mesa/drivers/dri/r300/r300_blit.c index 515a85caa2..b4c4b9c9cc 100644 --- a/src/mesa/drivers/dri/r300/r300_blit.c +++ b/src/mesa/drivers/dri/r300/r300_blit.c @@ -218,6 +218,8 @@ static uint32_t mesa_format_to_us_format(gl_format mesa_format) { switch(mesa_format) { + case MESA_FORMAT_S8_Z24: + case MESA_FORMAT_X8_Z24: case MESA_FORMAT_RGBA8888: // x return EASY_US_FORMAT(R500_OUT_FMT_C4_8, A, B, G, R, 0); case MESA_FORMAT_RGB565: // x diff --git a/src/mesa/drivers/dri/r300/r300_texcopy.c b/src/mesa/drivers/dri/r300/r300_texcopy.c index 039276eacc..1e10c7326c 100644 --- a/src/mesa/drivers/dri/r300/r300_texcopy.c +++ b/src/mesa/drivers/dri/r300/r300_texcopy.c @@ -49,10 +49,8 @@ do_copy_texsubimage(GLcontext *ctx, struct r300_context *r300 = R300_CONTEXT(ctx); struct radeon_renderbuffer *rrb; - if (_mesa_get_format_bits(timg->base.TexFormat, GL_DEPTH_BITS) || - _mesa_get_format_bits(timg->base.TexFormat, GL_STENCIL_BITS)) { + if (_mesa_get_format_bits(timg->base.TexFormat, GL_DEPTH_BITS) > 0) { rrb = radeon_get_depthbuffer(&r300->radeon); - return GL_FALSE; } else { rrb = radeon_get_colorbuffer(&r300->radeon); } -- cgit v1.2.3 From 353966b2da7de6d694285617ee5522ee4f3863ac Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 21 Nov 2009 18:16:29 +0100 Subject: r300: finish blit support for r300 --- src/mesa/drivers/dri/r300/r300_blit.c | 56 ++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_blit.c b/src/mesa/drivers/dri/r300/r300_blit.c index b4c4b9c9cc..7b256dac78 100644 --- a/src/mesa/drivers/dri/r300/r300_blit.c +++ b/src/mesa/drivers/dri/r300/r300_blit.c @@ -156,14 +156,62 @@ static void r500_emit_rs_setup(struct r300_context *r300) END_BATCH(); } -static void r300_emit_fp_setup(struct r300_context *r300) +static void r300_emit_fp_setup(struct r300_context *r300, + struct r300_fragment_program_code *code) { - assert(0); + unsigned i; + BATCH_LOCALS(&r300->radeon); + + BEGIN_BATCH((code->alu.length + 1) * 4 + code->tex.length + 1 + 9); + + OUT_BATCH_REGSEQ(R300_US_ALU_RGB_INST_0, code->alu.length); + for (i = 0; i < code->alu.length; i++) { + OUT_BATCH(code->alu.inst[i].rgb_inst); + } + OUT_BATCH_REGSEQ(R300_US_ALU_RGB_ADDR_0, code->alu.length); + for (i = 0; i < code->alu.length; i++) { + OUT_BATCH(code->alu.inst[i].rgb_addr); + } + OUT_BATCH_REGSEQ(R300_US_ALU_ALPHA_INST_0, code->alu.length); + for (i = 0; i < code->alu.length; i++) { + OUT_BATCH(code->alu.inst[i].alpha_inst); + } + OUT_BATCH_REGSEQ(R300_US_ALU_ALPHA_ADDR_0, code->alu.length); + for (i = 0; i < code->alu.length; i++) { + OUT_BATCH(code->alu.inst[i].alpha_addr); + } + + OUT_BATCH_REGSEQ(R300_US_TEX_INST_0, code->tex.length); + OUT_BATCH_TABLE(code->tex.inst, code->tex.length); + + OUT_BATCH_REGSEQ(R300_US_CONFIG, 3); + OUT_BATCH(R300_PFS_CNTL_FIRST_NODE_HAS_TEX); + OUT_BATCH(code->pixsize); + OUT_BATCH(code->code_offset); + OUT_BATCH_REGSEQ(R300_US_CODE_ADDR_0, 4); + OUT_BATCH_TABLE(code->code_addr, 4); + END_BATCH(); } static void r300_emit_rs_setup(struct r300_context *r300) { - assert(0); + BATCH_LOCALS(&r300->radeon); + + BEGIN_BATCH(7); + OUT_BATCH_REGSEQ(R300_RS_COUNT, 2); + OUT_BATCH((4 << R300_IT_COUNT_SHIFT) | R300_HIRES_EN); + OUT_BATCH(0); + OUT_BATCH_REGVAL(R300_RS_INST_0, + R300_RS_INST_TEX_ID(0) | + R300_RS_INST_TEX_ADDR(0) | + R300_RS_INST_TEX_CN_WRITE); + OUT_BATCH_REGVAL(R300_RS_IP_0, + R300_RS_TEX_PTR(0) | + R300_RS_SEL_S(R300_RS_SEL_C0) | + R300_RS_SEL_R(R300_RS_SEL_C1) | + R300_RS_SEL_T(R300_RS_SEL_K0) | + R300_RS_SEL_Q(R300_RS_SEL_K1)); + END_BATCH(); } static void r300_emit_tx_setup(struct r300_context *r300, @@ -459,7 +507,7 @@ GLboolean r300_blit(struct r300_context *r300, r500_emit_fp_setup(r300, &r300->blit.fp_code.code.r500, dst_mesaformat); r500_emit_rs_setup(r300); } else { - r300_emit_fp_setup(r300); + r300_emit_fp_setup(r300, &r300->blit.fp_code.code.r300); r300_emit_rs_setup(r300); } -- cgit v1.2.3 From dbd53f8f55cd4201ee230fec44f35e7dd2eea17d Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 21 Nov 2009 21:18:41 +0100 Subject: r300: setup render target format for r300/r400 cards too --- src/mesa/drivers/dri/r300/r300_blit.c | 168 +++++++++++++++++----------------- 1 file changed, 82 insertions(+), 86 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_blit.c b/src/mesa/drivers/dri/r300/r300_blit.c index 7b256dac78..6eb1108f0d 100644 --- a/src/mesa/drivers/dri/r300/r300_blit.c +++ b/src/mesa/drivers/dri/r300/r300_blit.c @@ -35,12 +35,6 @@ #include "compiler/radeon_compiler.h" #include "compiler/radeon_opcodes.h" -/** - * TODO: - * - handle depth buffer - * - r300 fp and rs setup - */ - static void vp_ins_outs(struct r300_vertex_program_compiler *c) { c->code->inputs[VERT_ATTRIB_POS] = 0; @@ -135,85 +129,6 @@ void r300_blit_init(struct r300_context *r300) create_fragment_program(r300); } -static void r500_emit_rs_setup(struct r300_context *r300) -{ - BATCH_LOCALS(&r300->radeon); - - BEGIN_BATCH(7); - OUT_BATCH_REGSEQ(R300_RS_COUNT, 2); - OUT_BATCH((4 << R300_IT_COUNT_SHIFT) | R300_HIRES_EN); - OUT_BATCH(0); - OUT_BATCH_REGVAL(R500_RS_INST_0, - (0 << R500_RS_INST_TEX_ID_SHIFT) | - (0 << R500_RS_INST_TEX_ADDR_SHIFT) | - R500_RS_INST_TEX_CN_WRITE | - R500_RS_INST_COL_CN_NO_WRITE); - OUT_BATCH_REGVAL(R500_RS_IP_0, - (0 << R500_RS_IP_TEX_PTR_S_SHIFT) | - (1 << R500_RS_IP_TEX_PTR_T_SHIFT) | - (2 << R500_RS_IP_TEX_PTR_R_SHIFT) | - (3 << R500_RS_IP_TEX_PTR_Q_SHIFT)); - END_BATCH(); -} - -static void r300_emit_fp_setup(struct r300_context *r300, - struct r300_fragment_program_code *code) -{ - unsigned i; - BATCH_LOCALS(&r300->radeon); - - BEGIN_BATCH((code->alu.length + 1) * 4 + code->tex.length + 1 + 9); - - OUT_BATCH_REGSEQ(R300_US_ALU_RGB_INST_0, code->alu.length); - for (i = 0; i < code->alu.length; i++) { - OUT_BATCH(code->alu.inst[i].rgb_inst); - } - OUT_BATCH_REGSEQ(R300_US_ALU_RGB_ADDR_0, code->alu.length); - for (i = 0; i < code->alu.length; i++) { - OUT_BATCH(code->alu.inst[i].rgb_addr); - } - OUT_BATCH_REGSEQ(R300_US_ALU_ALPHA_INST_0, code->alu.length); - for (i = 0; i < code->alu.length; i++) { - OUT_BATCH(code->alu.inst[i].alpha_inst); - } - OUT_BATCH_REGSEQ(R300_US_ALU_ALPHA_ADDR_0, code->alu.length); - for (i = 0; i < code->alu.length; i++) { - OUT_BATCH(code->alu.inst[i].alpha_addr); - } - - OUT_BATCH_REGSEQ(R300_US_TEX_INST_0, code->tex.length); - OUT_BATCH_TABLE(code->tex.inst, code->tex.length); - - OUT_BATCH_REGSEQ(R300_US_CONFIG, 3); - OUT_BATCH(R300_PFS_CNTL_FIRST_NODE_HAS_TEX); - OUT_BATCH(code->pixsize); - OUT_BATCH(code->code_offset); - OUT_BATCH_REGSEQ(R300_US_CODE_ADDR_0, 4); - OUT_BATCH_TABLE(code->code_addr, 4); - END_BATCH(); -} - -static void r300_emit_rs_setup(struct r300_context *r300) -{ - BATCH_LOCALS(&r300->radeon); - - BEGIN_BATCH(7); - OUT_BATCH_REGSEQ(R300_RS_COUNT, 2); - OUT_BATCH((4 << R300_IT_COUNT_SHIFT) | R300_HIRES_EN); - OUT_BATCH(0); - OUT_BATCH_REGVAL(R300_RS_INST_0, - R300_RS_INST_TEX_ID(0) | - R300_RS_INST_TEX_ADDR(0) | - R300_RS_INST_TEX_CN_WRITE); - OUT_BATCH_REGVAL(R300_RS_IP_0, - R300_RS_TEX_PTR(0) | - R300_RS_SEL_S(R300_RS_SEL_C0) | - R300_RS_SEL_R(R300_RS_SEL_C1) | - R300_RS_SEL_T(R300_RS_SEL_K0) | - R300_RS_SEL_Q(R300_RS_SEL_K1)); - END_BATCH(); -} - static void r300_emit_tx_setup(struct r300_context *r300, gl_format mesa_format, struct radeon_bo *bo, @@ -325,6 +240,87 @@ static void r500_emit_fp_setup(struct r300_context *r300, END_BATCH(); } +static void r500_emit_rs_setup(struct r300_context *r300) +{ + BATCH_LOCALS(&r300->radeon); + + BEGIN_BATCH(7); + OUT_BATCH_REGSEQ(R300_RS_COUNT, 2); + OUT_BATCH((4 << R300_IT_COUNT_SHIFT) | R300_HIRES_EN); + OUT_BATCH(0); + OUT_BATCH_REGVAL(R500_RS_INST_0, + (0 << R500_RS_INST_TEX_ID_SHIFT) | + (0 << R500_RS_INST_TEX_ADDR_SHIFT) | + R500_RS_INST_TEX_CN_WRITE | + R500_RS_INST_COL_CN_NO_WRITE); + OUT_BATCH_REGVAL(R500_RS_IP_0, + (0 << R500_RS_IP_TEX_PTR_S_SHIFT) | + (1 << R500_RS_IP_TEX_PTR_T_SHIFT) | + (2 << R500_RS_IP_TEX_PTR_R_SHIFT) | + (3 << R500_RS_IP_TEX_PTR_Q_SHIFT)); + END_BATCH(); +} + +static void r300_emit_fp_setup(struct r300_context *r300, + struct r300_fragment_program_code *code, + gl_format dst_format) +{ + unsigned i; + BATCH_LOCALS(&r300->radeon); + + BEGIN_BATCH((code->alu.length + 1) * 4 + code->tex.length + 1 + 11); + + OUT_BATCH_REGSEQ(R300_US_ALU_RGB_INST_0, code->alu.length); + for (i = 0; i < code->alu.length; i++) { + OUT_BATCH(code->alu.inst[i].rgb_inst); + } + OUT_BATCH_REGSEQ(R300_US_ALU_RGB_ADDR_0, code->alu.length); + for (i = 0; i < code->alu.length; i++) { + OUT_BATCH(code->alu.inst[i].rgb_addr); + } + OUT_BATCH_REGSEQ(R300_US_ALU_ALPHA_INST_0, code->alu.length); + for (i = 0; i < code->alu.length; i++) { + OUT_BATCH(code->alu.inst[i].alpha_inst); + } + OUT_BATCH_REGSEQ(R300_US_ALU_ALPHA_ADDR_0, code->alu.length); + for (i = 0; i < code->alu.length; i++) { + OUT_BATCH(code->alu.inst[i].alpha_addr); + } + + OUT_BATCH_REGSEQ(R300_US_TEX_INST_0, code->tex.length); + OUT_BATCH_TABLE(code->tex.inst, code->tex.length); + + OUT_BATCH_REGSEQ(R300_US_CONFIG, 3); + OUT_BATCH(R300_PFS_CNTL_FIRST_NODE_HAS_TEX); + OUT_BATCH(code->pixsize); + OUT_BATCH(code->code_offset); + OUT_BATCH_REGSEQ(R300_US_CODE_ADDR_0, 4); + OUT_BATCH_TABLE(code->code_addr, 4); + OUT_BATCH_REGVAL(R500_US_OUT_FMT_0, mesa_format_to_us_format(dst_format)); + END_BATCH(); +} + +static void r300_emit_rs_setup(struct r300_context *r300) +{ + BATCH_LOCALS(&r300->radeon); + + BEGIN_BATCH(7); + OUT_BATCH_REGSEQ(R300_RS_COUNT, 2); + OUT_BATCH((4 << R300_IT_COUNT_SHIFT) | R300_HIRES_EN); + OUT_BATCH(0); + OUT_BATCH_REGVAL(R300_RS_INST_0, + R300_RS_INST_TEX_ID(0) | + R300_RS_INST_TEX_ADDR(0) | + R300_RS_INST_TEX_CN_WRITE); + OUT_BATCH_REGVAL(R300_RS_IP_0, + R300_RS_TEX_PTR(0) | + R300_RS_SEL_S(R300_RS_SEL_C0) | + R300_RS_SEL_R(R300_RS_SEL_C1) | + R300_RS_SEL_T(R300_RS_SEL_K0) | + R300_RS_SEL_Q(R300_RS_SEL_K1)); + END_BATCH(); +} + static void emit_pvs_setup(struct r300_context *r300, uint32_t *vp_code, unsigned vp_len) @@ -507,7 +503,7 @@ GLboolean r300_blit(struct r300_context *r300, r500_emit_fp_setup(r300, &r300->blit.fp_code.code.r500, dst_mesaformat); r500_emit_rs_setup(r300); } else { - r300_emit_fp_setup(r300, &r300->blit.fp_code.code.r300); + r300_emit_fp_setup(r300, &r300->blit.fp_code.code.r300, dst_mesaformat); r300_emit_rs_setup(r300); } -- cgit v1.2.3 From 6b8315494ac84e6b59ae9113653224ed0a546014 Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sun, 22 Nov 2009 15:12:24 +0100 Subject: r300: emit number of used colorbuffers to pass radeon cs checker --- src/mesa/drivers/dri/r300/r300_blit.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_blit.c b/src/mesa/drivers/dri/r300/r300_blit.c index 6eb1108f0d..4c3d3c8069 100644 --- a/src/mesa/drivers/dri/r300/r300_blit.c +++ b/src/mesa/drivers/dri/r300/r300_blit.c @@ -450,10 +450,11 @@ static void emit_cb_setup(struct r300_context *r300, _mesa_get_format_bytes(mesa_format), _mesa_format_row_stride(mesa_format, width)); - BEGIN_BATCH_NO_AUTOSTATE(3); + BEGIN_BATCH_NO_AUTOSTATE(5); OUT_BATCH_REGSEQ(R300_SC_SCISSORS_TL, 2); OUT_BATCH((x1 << R300_SCISSORS_X_SHIFT)|(y1 << R300_SCISSORS_Y_SHIFT)); OUT_BATCH((x2 << R300_SCISSORS_X_SHIFT)|(y2 << R300_SCISSORS_Y_SHIFT)); + OUT_BATCH_REGVAL(R300_RB3D_CCTL, 0); END_BATCH(); } -- cgit v1.2.3 From 784cca9fa527de771754d76545970f78094b9adf Mon Sep 17 00:00:00 2001 From: Maciej Cencora Date: Sat, 12 Dec 2009 00:50:26 +0100 Subject: r300: disable blit debugging info --- src/mesa/drivers/dri/r300/r300_blit.c | 2 +- src/mesa/drivers/dri/r300/r300_texcopy.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/mesa/drivers/dri/r300/r300_blit.c b/src/mesa/drivers/dri/r300/r300_blit.c index 4c3d3c8069..10e1b3c912 100644 --- a/src/mesa/drivers/dri/r300/r300_blit.c +++ b/src/mesa/drivers/dri/r300/r300_blit.c @@ -480,7 +480,7 @@ GLboolean r300_blit(struct r300_context *r300, //return GL_FALSE; - if (1) { + if (0) { fprintf(stderr, "src: width %d, height %d, pitch %d vs %d, format %s\n", src_width, src_height, src_pitch, _mesa_format_row_stride(src_mesaformat, src_width), diff --git a/src/mesa/drivers/dri/r300/r300_texcopy.c b/src/mesa/drivers/dri/r300/r300_texcopy.c index 1e10c7326c..5e3a724d4e 100644 --- a/src/mesa/drivers/dri/r300/r300_texcopy.c +++ b/src/mesa/drivers/dri/r300/r300_texcopy.c @@ -74,7 +74,7 @@ do_copy_texsubimage(GLcontext *ctx, return GL_FALSE; } - if (1) { + if (0) { fprintf(stderr, "%s: copying to face %d, level %d\n", __FUNCTION__, _mesa_tex_target_to_face(target), level); fprintf(stderr, "to: x %d, y %d, offset %d\n", dstx, dsty, (uint32_t) dst_offset); -- cgit v1.2.3